Upstream merge.
This commit is contained in:
commit
d15f0e91e2
|
@ -338,7 +338,7 @@ if(KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
|
||||||
mark_as_advanced(PYTHON_DEST)
|
mark_as_advanced(PYTHON_DEST)
|
||||||
message( STATUS "Python module install path: ${PYTHON_DEST}")
|
message( STATUS "Python module install path: ${PYTHON_DEST}")
|
||||||
find_package(PythonLibs)
|
find_package(PythonLibs)
|
||||||
include_directories(${PYTHON_INCLUDE_PATH}
|
include_directories(${PYTHON_INCLUDE_DIRS}
|
||||||
./scripting)
|
./scripting)
|
||||||
endif(KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
|
endif(KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
# - helper module to find OSX frameworks
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Copyright 2003-2009 Kitware, Inc.
|
||||||
|
#
|
||||||
|
# Distributed under the OSI-approved BSD License (the "License");
|
||||||
|
# see accompanying file Copyright.txt for details.
|
||||||
|
#
|
||||||
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||||
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
# See the License for more information.
|
||||||
|
#=============================================================================
|
||||||
|
# (To distribute this file outside of CMake, substitute the full
|
||||||
|
# License text for the above reference.)
|
||||||
|
|
||||||
|
if(NOT CMAKE_FIND_FRAMEWORKS_INCLUDED)
|
||||||
|
set(CMAKE_FIND_FRAMEWORKS_INCLUDED 1)
|
||||||
|
macro(CMAKE_FIND_FRAMEWORKS fwk)
|
||||||
|
set(${fwk}_FRAMEWORKS)
|
||||||
|
if(APPLE)
|
||||||
|
foreach(dir
|
||||||
|
~/Library/Frameworks/${fwk}.framework
|
||||||
|
/Library/Frameworks/${fwk}.framework
|
||||||
|
/System/Library/Frameworks/${fwk}.framework
|
||||||
|
/Network/Library/Frameworks/${fwk}.framework)
|
||||||
|
if(EXISTS ${dir})
|
||||||
|
set(${fwk}_FRAMEWORKS ${${fwk}_FRAMEWORKS} ${dir})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
endif()
|
|
@ -0,0 +1,260 @@
|
||||||
|
# FIND_PACKAGE_HANDLE_STANDARD_ARGS(<name> ... )
|
||||||
|
#
|
||||||
|
# This function is intended to be used in FindXXX.cmake modules files.
|
||||||
|
# It handles the REQUIRED, QUIET and version-related arguments to FIND_PACKAGE().
|
||||||
|
# It also sets the <UPPERCASED_NAME>_FOUND variable.
|
||||||
|
# The package is considered found if all variables <var1>... listed contain
|
||||||
|
# valid results, e.g. valid filepaths.
|
||||||
|
#
|
||||||
|
# There are two modes of this function. The first argument in both modes is
|
||||||
|
# the name of the Find-module where it is called (in original casing).
|
||||||
|
#
|
||||||
|
# The first simple mode looks like this:
|
||||||
|
# FIND_PACKAGE_HANDLE_STANDARD_ARGS(<name> (DEFAULT_MSG|"Custom failure message") <var1>...<varN> )
|
||||||
|
# If the variables <var1> to <varN> are all valid, then <UPPERCASED_NAME>_FOUND
|
||||||
|
# will be set to TRUE.
|
||||||
|
# If DEFAULT_MSG is given as second argument, then the function will generate
|
||||||
|
# itself useful success and error messages. You can also supply a custom error message
|
||||||
|
# for the failure case. This is not recommended.
|
||||||
|
#
|
||||||
|
# The second mode is more powerful and also supports version checking:
|
||||||
|
# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME [REQUIRED_VARS <var1>...<varN>]
|
||||||
|
# [VERSION_VAR <versionvar>
|
||||||
|
# [CONFIG_MODE]
|
||||||
|
# [FAIL_MESSAGE "Custom failure message"] )
|
||||||
|
#
|
||||||
|
# As above, if <var1> through <varN> are all valid, <UPPERCASED_NAME>_FOUND
|
||||||
|
# will be set to TRUE.
|
||||||
|
# After REQUIRED_VARS the variables which are required for this package are listed.
|
||||||
|
# Following VERSION_VAR the name of the variable can be specified which holds
|
||||||
|
# the version of the package which has been found. If this is done, this version
|
||||||
|
# will be checked against the (potentially) specified required version used
|
||||||
|
# in the find_package() call. The EXACT keyword is also handled. The default
|
||||||
|
# messages include information about the required version and the version
|
||||||
|
# which has been actually found, both if the version is ok or not.
|
||||||
|
# Use the option CONFIG_MODE if your FindXXX.cmake module is a wrapper for
|
||||||
|
# a find_package(... NO_MODULE) call, in this case all the information
|
||||||
|
# provided by the config-mode of find_package() will be evaluated
|
||||||
|
# automatically.
|
||||||
|
# Via FAIL_MESSAGE a custom failure message can be specified, if this is not
|
||||||
|
# used, the default message will be displayed.
|
||||||
|
#
|
||||||
|
# Example for mode 1:
|
||||||
|
#
|
||||||
|
# FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR)
|
||||||
|
#
|
||||||
|
# LibXml2 is considered to be found, if both LIBXML2_LIBRARY and
|
||||||
|
# LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE.
|
||||||
|
# If it is not found and REQUIRED was used, it fails with FATAL_ERROR,
|
||||||
|
# independent whether QUIET was used or not.
|
||||||
|
# If it is found, success will be reported, including the content of <var1>.
|
||||||
|
# On repeated Cmake runs, the same message won't be printed again.
|
||||||
|
#
|
||||||
|
# Example for mode 2:
|
||||||
|
#
|
||||||
|
# FIND_PACKAGE_HANDLE_STANDARD_ARGS(BISON REQUIRED_VARS BISON_EXECUTABLE
|
||||||
|
# VERSION_VAR BISON_VERSION)
|
||||||
|
# In this case, BISON is considered to be found if the variable(s) listed
|
||||||
|
# after REQUIRED_VAR are all valid, i.e. BISON_EXECUTABLE in this case.
|
||||||
|
# Also the version of BISON will be checked by using the version contained
|
||||||
|
# in BISON_VERSION.
|
||||||
|
# Since no FAIL_MESSAGE is given, the default messages will be printed.
|
||||||
|
#
|
||||||
|
# Another example for mode 2:
|
||||||
|
#
|
||||||
|
# FIND_PACKAGE(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4)
|
||||||
|
# FIND_PACKAGE_HANDLE_STANDARD_ARGS(Automoc4 CONFIG_MODE)
|
||||||
|
# In this case, FindAutmoc4.cmake wraps a call to FIND_PACKAGE(Automoc4 NO_MODULE)
|
||||||
|
# and adds an additional search directory for automoc4.
|
||||||
|
# The following FIND_PACKAGE_HANDLE_STANDARD_ARGS() call produces a proper
|
||||||
|
# success/error message.
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Copyright 2007-2009 Kitware, Inc.
|
||||||
|
#
|
||||||
|
# Distributed under the OSI-approved BSD License (the "License");
|
||||||
|
# see accompanying file Copyright.txt for details.
|
||||||
|
#
|
||||||
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||||
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
# See the License for more information.
|
||||||
|
#=============================================================================
|
||||||
|
# (To distribute this file outside of CMake, substitute the full
|
||||||
|
# License text for the above reference.)
|
||||||
|
|
||||||
|
INCLUDE(FindPackageMessage)
|
||||||
|
INCLUDE(CMakeParseArguments)
|
||||||
|
|
||||||
|
# internal helper macro
|
||||||
|
MACRO(_FPHSA_FAILURE_MESSAGE _msg)
|
||||||
|
IF (${_NAME}_FIND_REQUIRED)
|
||||||
|
MESSAGE(FATAL_ERROR "${_msg}")
|
||||||
|
ELSE (${_NAME}_FIND_REQUIRED)
|
||||||
|
IF (NOT ${_NAME}_FIND_QUIETLY)
|
||||||
|
MESSAGE(STATUS "${_msg}")
|
||||||
|
ENDIF (NOT ${_NAME}_FIND_QUIETLY)
|
||||||
|
ENDIF (${_NAME}_FIND_REQUIRED)
|
||||||
|
ENDMACRO(_FPHSA_FAILURE_MESSAGE _msg)
|
||||||
|
|
||||||
|
|
||||||
|
# internal helper macro to generate the failure message when used in CONFIG_MODE:
|
||||||
|
MACRO(_FPHSA_HANDLE_FAILURE_CONFIG_MODE)
|
||||||
|
# <name>_CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found:
|
||||||
|
IF(${_NAME}_CONFIG)
|
||||||
|
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing: ${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})")
|
||||||
|
ELSE(${_NAME}_CONFIG)
|
||||||
|
# If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version.
|
||||||
|
# List them all in the error message:
|
||||||
|
IF(${_NAME}_CONSIDERED_CONFIGS)
|
||||||
|
SET(configsText "")
|
||||||
|
LIST(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount)
|
||||||
|
MATH(EXPR configsCount "${configsCount} - 1")
|
||||||
|
FOREACH(currentConfigIndex RANGE ${configsCount})
|
||||||
|
LIST(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename)
|
||||||
|
LIST(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version)
|
||||||
|
SET(configsText "${configsText} ${filename} (version ${version})\n")
|
||||||
|
ENDFOREACH(currentConfigIndex)
|
||||||
|
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:\n${configsText}")
|
||||||
|
|
||||||
|
ELSE(${_NAME}_CONSIDERED_CONFIGS)
|
||||||
|
# Simple case: No Config-file was found at all:
|
||||||
|
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}")
|
||||||
|
ENDIF(${_NAME}_CONSIDERED_CONFIGS)
|
||||||
|
ENDIF(${_NAME}_CONFIG)
|
||||||
|
ENDMACRO(_FPHSA_HANDLE_FAILURE_CONFIG_MODE)
|
||||||
|
|
||||||
|
|
||||||
|
FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
|
||||||
|
|
||||||
|
# set up the arguments for CMAKE_PARSE_ARGUMENTS and check whether we are in
|
||||||
|
# new extended or in the "old" mode:
|
||||||
|
SET(options CONFIG_MODE)
|
||||||
|
SET(oneValueArgs FAIL_MESSAGE VERSION_VAR)
|
||||||
|
SET(multiValueArgs REQUIRED_VARS)
|
||||||
|
SET(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} )
|
||||||
|
LIST(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX)
|
||||||
|
|
||||||
|
IF(${INDEX} EQUAL -1)
|
||||||
|
SET(FPHSA_FAIL_MESSAGE ${_FIRST_ARG})
|
||||||
|
SET(FPHSA_REQUIRED_VARS ${ARGN})
|
||||||
|
SET(FPHSA_VERSION_VAR)
|
||||||
|
ELSE(${INDEX} EQUAL -1)
|
||||||
|
|
||||||
|
CMAKE_PARSE_ARGUMENTS(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN})
|
||||||
|
|
||||||
|
IF(FPHSA_UNPARSED_ARGUMENTS)
|
||||||
|
MESSAGE(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"")
|
||||||
|
ENDIF(FPHSA_UNPARSED_ARGUMENTS)
|
||||||
|
|
||||||
|
IF(NOT FPHSA_FAIL_MESSAGE)
|
||||||
|
SET(FPHSA_FAIL_MESSAGE "DEFAULT_MSG")
|
||||||
|
ENDIF(NOT FPHSA_FAIL_MESSAGE)
|
||||||
|
ENDIF(${INDEX} EQUAL -1)
|
||||||
|
|
||||||
|
# now that we collected all arguments, process them
|
||||||
|
|
||||||
|
IF("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG")
|
||||||
|
SET(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}")
|
||||||
|
ENDIF("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG")
|
||||||
|
|
||||||
|
# In config-mode, we rely on the variable <package>_CONFIG, which is set by find_package()
|
||||||
|
# when it successfully found the config-file, including version checking:
|
||||||
|
IF(FPHSA_CONFIG_MODE)
|
||||||
|
LIST(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG)
|
||||||
|
LIST(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS)
|
||||||
|
SET(FPHSA_VERSION_VAR ${_NAME}_VERSION)
|
||||||
|
ENDIF(FPHSA_CONFIG_MODE)
|
||||||
|
|
||||||
|
IF(NOT FPHSA_REQUIRED_VARS)
|
||||||
|
MESSAGE(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()")
|
||||||
|
ENDIF(NOT FPHSA_REQUIRED_VARS)
|
||||||
|
|
||||||
|
LIST(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR)
|
||||||
|
|
||||||
|
STRING(TOUPPER ${_NAME} _NAME_UPPER)
|
||||||
|
STRING(TOLOWER ${_NAME} _NAME_LOWER)
|
||||||
|
|
||||||
|
# collect all variables which were not found, so they can be printed, so the
|
||||||
|
# user knows better what went wrong (#6375)
|
||||||
|
SET(MISSING_VARS "")
|
||||||
|
SET(DETAILS "")
|
||||||
|
SET(${_NAME_UPPER}_FOUND TRUE)
|
||||||
|
# check if all passed variables are valid
|
||||||
|
FOREACH(_CURRENT_VAR ${FPHSA_REQUIRED_VARS})
|
||||||
|
IF(NOT ${_CURRENT_VAR})
|
||||||
|
SET(${_NAME_UPPER}_FOUND FALSE)
|
||||||
|
SET(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}")
|
||||||
|
ELSE(NOT ${_CURRENT_VAR})
|
||||||
|
SET(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]")
|
||||||
|
ENDIF(NOT ${_CURRENT_VAR})
|
||||||
|
ENDFOREACH(_CURRENT_VAR)
|
||||||
|
|
||||||
|
|
||||||
|
# version handling:
|
||||||
|
SET(VERSION_MSG "")
|
||||||
|
SET(VERSION_OK TRUE)
|
||||||
|
SET(VERSION ${${FPHSA_VERSION_VAR}} )
|
||||||
|
IF (${_NAME}_FIND_VERSION)
|
||||||
|
|
||||||
|
IF(VERSION)
|
||||||
|
|
||||||
|
IF(${_NAME}_FIND_VERSION_EXACT) # exact version required
|
||||||
|
IF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}")
|
||||||
|
SET(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"")
|
||||||
|
SET(VERSION_OK FALSE)
|
||||||
|
ELSE (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}")
|
||||||
|
SET(VERSION_MSG "(found suitable exact version \"${VERSION}\")")
|
||||||
|
ENDIF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}")
|
||||||
|
|
||||||
|
ELSE(${_NAME}_FIND_VERSION_EXACT) # minimum version specified:
|
||||||
|
IF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}")
|
||||||
|
SET(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"")
|
||||||
|
SET(VERSION_OK FALSE)
|
||||||
|
ELSE ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}")
|
||||||
|
SET(VERSION_MSG "(found suitable version \"${VERSION}\", required is \"${${_NAME}_FIND_VERSION}\")")
|
||||||
|
ENDIF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}")
|
||||||
|
ENDIF(${_NAME}_FIND_VERSION_EXACT)
|
||||||
|
|
||||||
|
ELSE(VERSION)
|
||||||
|
|
||||||
|
# if the package was not found, but a version was given, add that to the output:
|
||||||
|
IF(${_NAME}_FIND_VERSION_EXACT)
|
||||||
|
SET(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")")
|
||||||
|
ELSE(${_NAME}_FIND_VERSION_EXACT)
|
||||||
|
SET(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")")
|
||||||
|
ENDIF(${_NAME}_FIND_VERSION_EXACT)
|
||||||
|
|
||||||
|
ENDIF(VERSION)
|
||||||
|
ELSE (${_NAME}_FIND_VERSION)
|
||||||
|
IF(VERSION)
|
||||||
|
SET(VERSION_MSG "(found version \"${VERSION}\")")
|
||||||
|
ENDIF(VERSION)
|
||||||
|
ENDIF (${_NAME}_FIND_VERSION)
|
||||||
|
|
||||||
|
IF(VERSION_OK)
|
||||||
|
SET(DETAILS "${DETAILS}[v${VERSION}(${${_NAME}_FIND_VERSION})]")
|
||||||
|
ELSE(VERSION_OK)
|
||||||
|
SET(${_NAME_UPPER}_FOUND FALSE)
|
||||||
|
ENDIF(VERSION_OK)
|
||||||
|
|
||||||
|
|
||||||
|
# print the result:
|
||||||
|
IF (${_NAME_UPPER}_FOUND)
|
||||||
|
FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG}" "${DETAILS}")
|
||||||
|
ELSE (${_NAME_UPPER}_FOUND)
|
||||||
|
|
||||||
|
IF(FPHSA_CONFIG_MODE)
|
||||||
|
_FPHSA_HANDLE_FAILURE_CONFIG_MODE()
|
||||||
|
ELSE(FPHSA_CONFIG_MODE)
|
||||||
|
IF(NOT VERSION_OK)
|
||||||
|
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})")
|
||||||
|
ELSE(NOT VERSION_OK)
|
||||||
|
_FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}")
|
||||||
|
ENDIF(NOT VERSION_OK)
|
||||||
|
ENDIF(FPHSA_CONFIG_MODE)
|
||||||
|
|
||||||
|
ENDIF (${_NAME_UPPER}_FOUND)
|
||||||
|
|
||||||
|
SET(${_NAME_UPPER}_FOUND ${${_NAME_UPPER}_FOUND} PARENT_SCOPE)
|
||||||
|
|
||||||
|
ENDFUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _FIRST_ARG)
|
|
@ -0,0 +1,175 @@
|
||||||
|
# - Find python interpreter
|
||||||
|
# This module finds if Python interpreter is installed and determines where the
|
||||||
|
# executables are. This code sets the following variables:
|
||||||
|
#
|
||||||
|
# PYTHONINTERP_FOUND - Was the Python executable found
|
||||||
|
# PYTHON_EXECUTABLE - path to the Python interpreter
|
||||||
|
#
|
||||||
|
# PYTHON_VERSION_STRING - Python version found e.g. 2.5.2
|
||||||
|
# PYTHON_VERSION_MAJOR - Python major version found e.g. 2
|
||||||
|
# PYTHON_VERSION_MINOR - Python minor version found e.g. 5
|
||||||
|
# PYTHON_VERSION_PATCH - Python patch version found e.g. 2
|
||||||
|
#
|
||||||
|
# The Python_ADDITIONAL_VERSIONS variable can be used to specify a list of
|
||||||
|
# version numbers that should be taken into account when searching for Python.
|
||||||
|
# You need to set this variable before calling find_package(PythonInterp).
|
||||||
|
#
|
||||||
|
# You can point to a preferred python install to use by setting the following
|
||||||
|
# to the point at the root directory of the python install:
|
||||||
|
#
|
||||||
|
# PYTHON_ROOT_DIR - The root directory of the python install
|
||||||
|
#=============================================================================
|
||||||
|
# Copyright 2005-2010 Kitware, Inc.
|
||||||
|
# Copyright 2011 Bjoern Ricks <bjoern.ricks@gmail.com>
|
||||||
|
# Copyright 2012 Rolf Eike Beer <eike@sf-mail.de>
|
||||||
|
#
|
||||||
|
# Distributed under the OSI-approved BSD License (the "License");
|
||||||
|
# see accompanying file Copyright.txt for details.
|
||||||
|
#
|
||||||
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||||
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
# See the License for more information.
|
||||||
|
#=============================================================================
|
||||||
|
# (To distribute this file outside of CMake, substitute the full
|
||||||
|
# License text for the above reference.)
|
||||||
|
|
||||||
|
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.3 3.2 3.1 3.0)
|
||||||
|
|
||||||
|
if(PythonInterp_FIND_VERSION)
|
||||||
|
if(PythonInterp_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
|
||||||
|
string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonInterp_FIND_VERSION}")
|
||||||
|
string(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}")
|
||||||
|
list(APPEND _Python_NAMES python${_PYTHON_FIND_MAJ_MIN} python${_PYTHON_FIND_MAJ})
|
||||||
|
unset(_PYTHON_FIND_OTHER_VERSIONS)
|
||||||
|
if(NOT PythonInterp_FIND_VERSION_EXACT)
|
||||||
|
foreach(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS})
|
||||||
|
if(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN)
|
||||||
|
list(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
unset(_PYTHON_FIND_MAJ_MIN)
|
||||||
|
unset(_PYTHON_FIND_MAJ)
|
||||||
|
else()
|
||||||
|
list(APPEND _Python_NAMES python${PythonInterp_FIND_VERSION})
|
||||||
|
set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonInterp_FIND_VERSION}_VERSIONS})
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
list(APPEND _Python_NAMES python)
|
||||||
|
|
||||||
|
# Search for the preferred executable first
|
||||||
|
if( ${PYTHON_ROOT_DIR} )
|
||||||
|
# Search for any of the executable names solely in the directory we've
|
||||||
|
# been pointed to. Failure to find the python executable here is a fatal
|
||||||
|
# fail.
|
||||||
|
find_program(PYTHON_EXECUTABLE NAMES ${_Python_NAMES}
|
||||||
|
PATHS ${PYTHON_ROOT_DIR}
|
||||||
|
NO_DEFAULT_PATH )
|
||||||
|
else()
|
||||||
|
# If there is no specific path given, look for python in the path
|
||||||
|
find_program(PYTHON_EXECUTABLE NAMES ${_Python_NAMES})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Set up the versions we know about, in the order we will search. Always add
|
||||||
|
# the user supplied additional versions to the front.
|
||||||
|
set(_Python_VERSIONS
|
||||||
|
${Python_ADDITIONAL_VERSIONS}
|
||||||
|
${_PYTHON_FIND_OTHER_VERSIONS}
|
||||||
|
)
|
||||||
|
|
||||||
|
unset(_PYTHON_FIND_OTHER_VERSIONS)
|
||||||
|
unset(_PYTHON1_VERSIONS)
|
||||||
|
unset(_PYTHON2_VERSIONS)
|
||||||
|
unset(_PYTHON3_VERSIONS)
|
||||||
|
|
||||||
|
# Search for newest python version if python executable isn't found
|
||||||
|
if(NOT PYTHON_EXECUTABLE)
|
||||||
|
|
||||||
|
# If using the MINGW compiler, we mustn't find the standard python
|
||||||
|
# distribution because of multiple C-Runtime errors. We must instead
|
||||||
|
# use the Python-a-mingw-us distribution
|
||||||
|
if(MINGW)
|
||||||
|
list( APPEND _Python_PPATHS ${PYTHON_ROOT_DIR} )
|
||||||
|
list( APPEND _Python_PPATHS "C:/python/${_CURRENT_VERSION}.9" )
|
||||||
|
list( APPEND _Python_PPATHS "C:/python/${_CURRENT_VERSION}.8" )
|
||||||
|
list( APPEND _Python_PPATHS "C:/python/${_CURRENT_VERSION}.7" )
|
||||||
|
list( APPEND _Python_PPATHS "C:/python/${_CURRENT_VERSION}.6" )
|
||||||
|
list( APPEND _Python_PPATHS "C:/python/${_CURRENT_VERSION}.5" )
|
||||||
|
list( APPEND _Python_PPATHS "C:/python/${_CURRENT_VERSION}.4" )
|
||||||
|
list( APPEND _Python_PPATHS "C:/python/${_CURRENT_VERSION}.3" )
|
||||||
|
list( APPEND _Python_PPATHS "C:/python/${_CURRENT_VERSION}.2" )
|
||||||
|
list( APPEND _Python_PPATHS "C:/python/${_CURRENT_VERSION}.1" )
|
||||||
|
list( APPEND _Python_PPATHS "C:/python/${_CURRENT_VERSION}.0" )
|
||||||
|
else()
|
||||||
|
list( APPEND _Python_PPATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath] )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
foreach(_CURRENT_VERSION ${_Python_VERSIONS})
|
||||||
|
set(_Python_NAMES python${_CURRENT_VERSION})
|
||||||
|
if(WIN32)
|
||||||
|
list(APPEND _Python_NAMES python)
|
||||||
|
endif()
|
||||||
|
find_program(PYTHON_EXECUTABLE
|
||||||
|
NAMES ${_Python_NAMES}
|
||||||
|
PATHS ${_Python_PPATHS}
|
||||||
|
)
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# determine python version string
|
||||||
|
if(PYTHON_EXECUTABLE)
|
||||||
|
execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c
|
||||||
|
"import sys; sys.stdout.write(';'.join([str(x) for x in sys.version_info[:3]]))"
|
||||||
|
OUTPUT_VARIABLE _VERSION
|
||||||
|
RESULT_VARIABLE _PYTHON_VERSION_RESULT
|
||||||
|
ERROR_QUIET)
|
||||||
|
if(NOT _PYTHON_VERSION_RESULT)
|
||||||
|
string(REPLACE ";" "." PYTHON_VERSION_STRING "${_VERSION}")
|
||||||
|
list(GET _VERSION 0 PYTHON_VERSION_MAJOR)
|
||||||
|
list(GET _VERSION 1 PYTHON_VERSION_MINOR)
|
||||||
|
list(GET _VERSION 2 PYTHON_VERSION_PATCH)
|
||||||
|
if(PYTHON_VERSION_PATCH EQUAL 0)
|
||||||
|
# it's called "Python 2.7", not "2.7.0"
|
||||||
|
string(REGEX REPLACE "\\.0$" "" PYTHON_VERSION_STRING "${PYTHON_VERSION_STRING}")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
# sys.version predates sys.version_info, so use that
|
||||||
|
execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c "import sys; sys.stdout.write(sys.version)"
|
||||||
|
OUTPUT_VARIABLE _VERSION
|
||||||
|
RESULT_VARIABLE _PYTHON_VERSION_RESULT
|
||||||
|
ERROR_QUIET)
|
||||||
|
if(NOT _PYTHON_VERSION_RESULT)
|
||||||
|
string(REGEX REPLACE " .*" "" PYTHON_VERSION_STRING "${_VERSION}")
|
||||||
|
string(REGEX REPLACE "^([0-9]+)\\.[0-9]+.*" "\\1" PYTHON_VERSION_MAJOR "${PYTHON_VERSION_STRING}")
|
||||||
|
string(REGEX REPLACE "^[0-9]+\\.([0-9])+.*" "\\1" PYTHON_VERSION_MINOR "${PYTHON_VERSION_STRING}")
|
||||||
|
if(PYTHON_VERSION_STRING MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+.*")
|
||||||
|
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" PYTHON_VERSION_PATCH "${PYTHON_VERSION_STRING}")
|
||||||
|
else()
|
||||||
|
set(PYTHON_VERSION_PATCH "0")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
# sys.version was first documented for Python 1.5, so assume
|
||||||
|
# this is older.
|
||||||
|
set(PYTHON_VERSION_STRING "1.4")
|
||||||
|
set(PYTHON_VERSION_MAJOR "1")
|
||||||
|
set(PYTHON_VERSION_MAJOR "4")
|
||||||
|
set(PYTHON_VERSION_MAJOR "0")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
unset(_PYTHON_VERSION_RESULT)
|
||||||
|
unset(_VERSION)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# handle the QUIETLY and REQUIRED arguments and set PYTHONINTERP_FOUND to TRUE if
|
||||||
|
# all listed variables are TRUE
|
||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonInterp REQUIRED_VARS PYTHON_EXECUTABLE VERSION_VAR PYTHON_VERSION_STRING)
|
||||||
|
|
||||||
|
mark_as_advanced(PYTHON_EXECUTABLE)
|
|
@ -0,0 +1,338 @@
|
||||||
|
# - Find python libraries
|
||||||
|
# This module finds if Python is installed and determines where the
|
||||||
|
# include files and libraries are. It also determines what the name of
|
||||||
|
# the library is. This code sets the following variables:
|
||||||
|
#
|
||||||
|
# PYTHONLIBS_FOUND - have the Python libs been found
|
||||||
|
# PYTHON_LIBRARIES - path to the python library
|
||||||
|
# PYTHON_INCLUDE_PATH - path to where Python.h is found (deprecated)
|
||||||
|
# PYTHON_INCLUDE_DIRS - path to where Python.h is found
|
||||||
|
# PYTHON_DEBUG_LIBRARIES - path to the debug library (deprecated)
|
||||||
|
# PYTHONLIBS_VERSION_STRING - version of the Python libs found (since CMake 2.8.8)
|
||||||
|
#
|
||||||
|
# The Python_ADDITIONAL_VERSIONS variable can be used to specify a list of
|
||||||
|
# version numbers that should be taken into account when searching for Python.
|
||||||
|
# You need to set this variable before calling find_package(PythonLibs).
|
||||||
|
#
|
||||||
|
# You can point to a preferred python install to use by setting the following
|
||||||
|
# to the point at the root directory of the python install:
|
||||||
|
#
|
||||||
|
# PYTHON_ROOT_DIR - The root directory of the python install
|
||||||
|
#
|
||||||
|
# If you'd like to specify the installation of Python to use, you should modify
|
||||||
|
# the following cache variables:
|
||||||
|
# PYTHON_LIBRARY - path to the python library
|
||||||
|
# PYTHON_INCLUDE_DIR - path to where Python.h is found
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Copyright 2001-2009 Kitware, Inc.
|
||||||
|
#
|
||||||
|
# Distributed under the OSI-approved BSD License (the "License");
|
||||||
|
# see accompanying file Copyright.txt for details.
|
||||||
|
#
|
||||||
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||||
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
# See the License for more information.
|
||||||
|
#=============================================================================
|
||||||
|
# (To distribute this file outside of CMake, substitute the full
|
||||||
|
# License text for the above reference.)
|
||||||
|
|
||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindFrameworks.cmake)
|
||||||
|
# Search for the python framework on Apple.
|
||||||
|
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.3 3.2 3.1 3.0)
|
||||||
|
|
||||||
|
if(PythonLibs_FIND_VERSION)
|
||||||
|
if(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
|
||||||
|
string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonLibs_FIND_VERSION}")
|
||||||
|
string(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}")
|
||||||
|
unset(_PYTHON_FIND_OTHER_VERSIONS)
|
||||||
|
if(PythonLibs_FIND_VERSION_EXACT)
|
||||||
|
if(_PYTHON_FIND_MAJ_MIN STREQUAL PythonLibs_FIND_VERSION)
|
||||||
|
set(_PYTHON_FIND_OTHER_VERSIONS "${PythonLibs_FIND_VERSION}")
|
||||||
|
else()
|
||||||
|
set(_PYTHON_FIND_OTHER_VERSIONS "${PythonLibs_FIND_VERSION}" "${_PYTHON_FIND_MAJ_MIN}")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
foreach(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS})
|
||||||
|
if(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN)
|
||||||
|
list(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
unset(_PYTHON_FIND_MAJ_MIN)
|
||||||
|
unset(_PYTHON_FIND_MAJ)
|
||||||
|
else()
|
||||||
|
set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonLibs_FIND_VERSION}_VERSIONS})
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Set up the versions we know about, in the order we will search. Always add
|
||||||
|
# the user supplied additional versions to the front.
|
||||||
|
set(_Python_VERSIONS
|
||||||
|
${Python_ADDITIONAL_VERSIONS}
|
||||||
|
${_PYTHON_FIND_OTHER_VERSIONS}
|
||||||
|
)
|
||||||
|
|
||||||
|
unset(_PYTHON_FIND_OTHER_VERSIONS)
|
||||||
|
unset(_PYTHON1_VERSIONS)
|
||||||
|
unset(_PYTHON2_VERSIONS)
|
||||||
|
unset(_PYTHON3_VERSIONS)
|
||||||
|
|
||||||
|
foreach(_CURRENT_VERSION ${_Python_VERSIONS})
|
||||||
|
string(REPLACE "." "" _CURRENT_VERSION_NO_DOTS ${_CURRENT_VERSION})
|
||||||
|
if(WIN32)
|
||||||
|
if(MINGW)
|
||||||
|
find_library(PYTHON_DEBUG_LIBRARY
|
||||||
|
NAMES python{$_CURRENT_VERSION}_d
|
||||||
|
PATHS
|
||||||
|
"${PYTHON_ROOT_DIR}"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.9"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.8"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.7"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.6"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.5"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.4"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.3"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.2"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.1"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.0"
|
||||||
|
NO_SYSTEM_ENVIRONMENT_PATH
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
find_library(PYTHON_DEBUG_LIBRARY
|
||||||
|
NAMES python${_CURRENT_VERSION_NO_DOTS}_d python
|
||||||
|
PATHS
|
||||||
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug
|
||||||
|
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs/Debug
|
||||||
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
|
||||||
|
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(MINGW)
|
||||||
|
find_library(PYTHON_LIBRARY
|
||||||
|
NAMES python${_CURRENT_VERSION}
|
||||||
|
PATHS
|
||||||
|
"${PYTHON_ROOT_DIR}"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.9"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.8"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.7"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.6"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.5"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.4"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.3"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.2"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.1"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.0"
|
||||||
|
NO_SYSTEM_ENVIRONMENT_PATH
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
find_library(PYTHON_LIBRARY
|
||||||
|
NAMES
|
||||||
|
python${_CURRENT_VERSION_NO_DOTS}
|
||||||
|
python${_CURRENT_VERSION}mu
|
||||||
|
python${_CURRENT_VERSION}m
|
||||||
|
python${_CURRENT_VERSION}u
|
||||||
|
python${_CURRENT_VERSION}
|
||||||
|
PATHS
|
||||||
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
|
||||||
|
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
|
||||||
|
# Avoid finding the .dll in the PATH. We want the .lib.
|
||||||
|
NO_SYSTEM_ENVIRONMENT_PATH
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Look for the static library in the Python config directory
|
||||||
|
find_library(PYTHON_LIBRARY
|
||||||
|
NAMES python${_CURRENT_VERSION_NO_DOTS} python${_CURRENT_VERSION}
|
||||||
|
# Avoid finding the .dll in the PATH. We want the .lib.
|
||||||
|
NO_SYSTEM_ENVIRONMENT_PATH
|
||||||
|
# This is where the static library is usually located
|
||||||
|
PATH_SUFFIXES python${_CURRENT_VERSION}/config
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# For backward compatibility, honour value of PYTHON_INCLUDE_PATH, if
|
||||||
|
# PYTHON_INCLUDE_DIR is not set.
|
||||||
|
if(DEFINED PYTHON_INCLUDE_PATH AND NOT DEFINED PYTHON_INCLUDE_DIR)
|
||||||
|
set(PYTHON_INCLUDE_DIR "${PYTHON_INCLUDE_PATH}" CACHE PATH
|
||||||
|
"Path to where Python.h is found" FORCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(PYTHON_FRAMEWORK_INCLUDES)
|
||||||
|
if(Python_FRAMEWORKS AND NOT PYTHON_INCLUDE_DIR)
|
||||||
|
foreach(dir ${Python_FRAMEWORKS})
|
||||||
|
set(PYTHON_FRAMEWORK_INCLUDES ${PYTHON_FRAMEWORK_INCLUDES}
|
||||||
|
${dir}/Versions/${_CURRENT_VERSION}/include/python${_CURRENT_VERSION})
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(MINGW)
|
||||||
|
find_path(PYTHON_INCLUDE_DIR
|
||||||
|
NAMES Python.h
|
||||||
|
PATHS
|
||||||
|
"${PYTHON_ROOT_DIR}/include"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.9/include"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.8/include"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.7/include"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.6/include"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.5/include"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.4/include"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.3/include"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.2/include"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.1/include"
|
||||||
|
"C:/python/${_CURRENT_VERSION}.0/include"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
find_path(PYTHON_INCLUDE_DIR
|
||||||
|
NAMES Python.h
|
||||||
|
PATHS
|
||||||
|
${PYTHON_FRAMEWORK_INCLUDES}
|
||||||
|
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include
|
||||||
|
[HKEY_CURRENT_USER\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/include
|
||||||
|
PATH_SUFFIXES
|
||||||
|
python${_CURRENT_VERSION}mu
|
||||||
|
python${_CURRENT_VERSION}m
|
||||||
|
python${_CURRENT_VERSION}u
|
||||||
|
python${_CURRENT_VERSION}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# For backward compatibility, set PYTHON_INCLUDE_PATH.
|
||||||
|
set(PYTHON_INCLUDE_PATH "${PYTHON_INCLUDE_DIR}")
|
||||||
|
|
||||||
|
if(PYTHON_INCLUDE_DIR AND EXISTS "${PYTHON_INCLUDE_DIR}/patchlevel.h")
|
||||||
|
file(STRINGS "${PYTHON_INCLUDE_DIR}/patchlevel.h" python_version_str
|
||||||
|
REGEX "^#define[ \t]+PY_VERSION[ \t]+\"[^\"]+\"")
|
||||||
|
string(REGEX REPLACE "^#define[ \t]+PY_VERSION[ \t]+\"([^\"]+)\".*" "\\1"
|
||||||
|
PYTHONLIBS_VERSION_STRING "${python_version_str}")
|
||||||
|
unset(python_version_str)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(PYTHON_LIBRARY AND PYTHON_INCLUDE_DIR)
|
||||||
|
break()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
mark_as_advanced(
|
||||||
|
PYTHON_DEBUG_LIBRARY
|
||||||
|
PYTHON_LIBRARY
|
||||||
|
PYTHON_INCLUDE_DIR
|
||||||
|
)
|
||||||
|
|
||||||
|
# We use PYTHON_INCLUDE_DIR, PYTHON_LIBRARY and PYTHON_DEBUG_LIBRARY for the
|
||||||
|
# cache entries because they are meant to specify the location of a single
|
||||||
|
# library. We now set the variables listed by the documentation for this
|
||||||
|
# module.
|
||||||
|
set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
|
||||||
|
set(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}")
|
||||||
|
|
||||||
|
# These variables have been historically named in this module different from
|
||||||
|
# what SELECT_LIBRARY_CONFIGURATIONS() expects.
|
||||||
|
set(PYTHON_LIBRARY_DEBUG "${PYTHON_DEBUG_LIBRARY}")
|
||||||
|
set(PYTHON_LIBRARY_RELEASE "${PYTHON_LIBRARY}")
|
||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
|
||||||
|
SELECT_LIBRARY_CONFIGURATIONS(PYTHON)
|
||||||
|
# SELECT_LIBRARY_CONFIGURATIONS() sets ${PREFIX}_FOUND if it has a library.
|
||||||
|
# Unset this, this prefix doesn't match the module prefix, they are different
|
||||||
|
# for historical reasons.
|
||||||
|
unset(PYTHON_FOUND)
|
||||||
|
|
||||||
|
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PythonLibs
|
||||||
|
REQUIRED_VARS PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS
|
||||||
|
VERSION_VAR PYTHONLIBS_VERSION_STRING)
|
||||||
|
|
||||||
|
# PYTHON_ADD_MODULE(<name> src1 src2 ... srcN) is used to build modules for python.
|
||||||
|
# PYTHON_WRITE_MODULES_HEADER(<filename>) writes a header file you can include
|
||||||
|
# in your sources to initialize the static python modules
|
||||||
|
function(PYTHON_ADD_MODULE _NAME )
|
||||||
|
get_property(_TARGET_SUPPORTS_SHARED_LIBS
|
||||||
|
GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS)
|
||||||
|
option(PYTHON_ENABLE_MODULE_${_NAME} "Add module ${_NAME}" TRUE)
|
||||||
|
option(PYTHON_MODULE_${_NAME}_BUILD_SHARED
|
||||||
|
"Add module ${_NAME} shared" ${_TARGET_SUPPORTS_SHARED_LIBS})
|
||||||
|
|
||||||
|
# Mark these options as advanced
|
||||||
|
mark_as_advanced(PYTHON_ENABLE_MODULE_${_NAME}
|
||||||
|
PYTHON_MODULE_${_NAME}_BUILD_SHARED)
|
||||||
|
|
||||||
|
if(PYTHON_ENABLE_MODULE_${_NAME})
|
||||||
|
if(PYTHON_MODULE_${_NAME}_BUILD_SHARED)
|
||||||
|
set(PY_MODULE_TYPE MODULE)
|
||||||
|
else()
|
||||||
|
set(PY_MODULE_TYPE STATIC)
|
||||||
|
set_property(GLOBAL APPEND PROPERTY PY_STATIC_MODULES_LIST ${_NAME})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set_property(GLOBAL APPEND PROPERTY PY_MODULES_LIST ${_NAME})
|
||||||
|
add_library(${_NAME} ${PY_MODULE_TYPE} ${ARGN})
|
||||||
|
# target_link_libraries(${_NAME} ${PYTHON_LIBRARIES})
|
||||||
|
|
||||||
|
if(PYTHON_MODULE_${_NAME}_BUILD_SHARED)
|
||||||
|
set_target_properties(${_NAME} PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}")
|
||||||
|
if(WIN32 AND NOT CYGWIN)
|
||||||
|
set_target_properties(${_NAME} PROPERTIES SUFFIX ".pyd")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(PYTHON_WRITE_MODULES_HEADER _filename)
|
||||||
|
|
||||||
|
get_property(PY_STATIC_MODULES_LIST GLOBAL PROPERTY PY_STATIC_MODULES_LIST)
|
||||||
|
|
||||||
|
get_filename_component(_name "${_filename}" NAME)
|
||||||
|
string(REPLACE "." "_" _name "${_name}")
|
||||||
|
string(TOUPPER ${_name} _nameUpper)
|
||||||
|
set(_filename ${CMAKE_CURRENT_BINARY_DIR}/${_filename})
|
||||||
|
|
||||||
|
set(_filenameTmp "${_filename}.in")
|
||||||
|
file(WRITE ${_filenameTmp} "/*Created by cmake, do not edit, changes will be lost*/\n")
|
||||||
|
file(APPEND ${_filenameTmp}
|
||||||
|
"#ifndef ${_nameUpper}
|
||||||
|
#define ${_nameUpper}
|
||||||
|
|
||||||
|
#include <Python.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern \"C\" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
")
|
||||||
|
|
||||||
|
foreach(_currentModule ${PY_STATIC_MODULES_LIST})
|
||||||
|
file(APPEND ${_filenameTmp} "extern void init${PYTHON_MODULE_PREFIX}${_currentModule}(void);\n\n")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
file(APPEND ${_filenameTmp}
|
||||||
|
"#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
")
|
||||||
|
|
||||||
|
|
||||||
|
foreach(_currentModule ${PY_STATIC_MODULES_LIST})
|
||||||
|
file(APPEND ${_filenameTmp} "int ${_name}_${_currentModule}(void) \n{\n static char name[]=\"${PYTHON_MODULE_PREFIX}${_currentModule}\"; return PyImport_AppendInittab(name, init${PYTHON_MODULE_PREFIX}${_currentModule});\n}\n\n")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
file(APPEND ${_filenameTmp} "void ${_name}_LoadAllPythonModules(void)\n{\n")
|
||||||
|
foreach(_currentModule ${PY_STATIC_MODULES_LIST})
|
||||||
|
file(APPEND ${_filenameTmp} " ${_name}_${_currentModule}();\n")
|
||||||
|
endforeach()
|
||||||
|
file(APPEND ${_filenameTmp} "}\n\n")
|
||||||
|
file(APPEND ${_filenameTmp} "#ifndef EXCLUDE_LOAD_ALL_FUNCTION\nvoid CMakeLoadAllPythonModules(void)\n{\n ${_name}_LoadAllPythonModules();\n}\n#endif\n\n#endif\n")
|
||||||
|
|
||||||
|
# with configure_file() cmake complains that you may not use a file created using file(WRITE) as input file for configure_file()
|
||||||
|
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_filenameTmp}" "${_filename}" OUTPUT_QUIET ERROR_QUIET)
|
||||||
|
|
||||||
|
endfunction()
|
|
@ -56,6 +56,18 @@ macro(perform_feature_checks)
|
||||||
# mean won't fail somewhere down the line.
|
# mean won't fail somewhere down the line.
|
||||||
check_include_file("iso646.h" HAVE_ISO646_H)
|
check_include_file("iso646.h" HAVE_ISO646_H)
|
||||||
|
|
||||||
|
# The STDINT header file test is required because MinGW under Windows
|
||||||
|
# doesn't define HAVE_STDINT_H even though it does have it.
|
||||||
|
#
|
||||||
|
# We need to add it to the global compiler definitions as config.h is not
|
||||||
|
# included in pyport.h which is where the problem ocurrs without this
|
||||||
|
# fix.
|
||||||
|
check_include_file("stdint.h" HAVE_STDINT_H)
|
||||||
|
|
||||||
|
if( HAVE_STDINT_H )
|
||||||
|
add_definitions( -DHAVE_STDINT_H )
|
||||||
|
endif()
|
||||||
|
|
||||||
# no place is this used, and "HAVE_STRINGS_H", if present in config.h then
|
# no place is this used, and "HAVE_STRINGS_H", if present in config.h then
|
||||||
# conflicts with /usr/include/python2.6/Python.h. Please rename the macro if
|
# conflicts with /usr/include/python2.6/Python.h. Please rename the macro if
|
||||||
# re-introduce this.
|
# re-introduce this.
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
# select_library_configurations( basename )
|
||||||
|
#
|
||||||
|
# This macro takes a library base name as an argument, and will choose good
|
||||||
|
# values for basename_LIBRARY, basename_LIBRARIES, basename_LIBRARY_DEBUG, and
|
||||||
|
# basename_LIBRARY_RELEASE depending on what has been found and set. If only
|
||||||
|
# basename_LIBRARY_RELEASE is defined, basename_LIBRARY, basename_LIBRARY_DEBUG,
|
||||||
|
# and basename_LIBRARY_RELEASE will be set to the release value. If only
|
||||||
|
# basename_LIBRARY_DEBUG is defined, then basename_LIBRARY,
|
||||||
|
# basename_LIBRARY_DEBUG and basename_LIBRARY_RELEASE will take the debug value.
|
||||||
|
#
|
||||||
|
# If the generator supports configuration types, then basename_LIBRARY and
|
||||||
|
# basename_LIBRARIES will be set with debug and optimized flags specifying the
|
||||||
|
# library to be used for the given configuration. If no build type has been set
|
||||||
|
# or the generator in use does not support configuration types, then
|
||||||
|
# basename_LIBRARY and basename_LIBRARIES will take only the release values.
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Copyright 2009 Will Dicharry <wdicharry@stellarscience.com>
|
||||||
|
# Copyright 2005-2009 Kitware, Inc.
|
||||||
|
#
|
||||||
|
# Distributed under the OSI-approved BSD License (the "License");
|
||||||
|
# see accompanying file Copyright.txt for details.
|
||||||
|
#
|
||||||
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||||
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
# See the License for more information.
|
||||||
|
#=============================================================================
|
||||||
|
# (To distribute this file outside of CMake, substitute the full
|
||||||
|
# License text for the above reference.)
|
||||||
|
|
||||||
|
# This macro was adapted from the FindQt4 CMake module and is maintained by Will
|
||||||
|
# Dicharry <wdicharry@stellarscience.com>.
|
||||||
|
|
||||||
|
# Utility macro to check if one variable exists while another doesn't, and set
|
||||||
|
# one that doesn't exist to the one that exists.
|
||||||
|
macro( _set_library_name basename GOOD BAD )
|
||||||
|
if( ${basename}_LIBRARY_${GOOD} AND NOT ${basename}_LIBRARY_${BAD} )
|
||||||
|
set( ${basename}_LIBRARY_${BAD} ${${basename}_LIBRARY_${GOOD}} )
|
||||||
|
set( ${basename}_LIBRARY ${${basename}_LIBRARY_${GOOD}} )
|
||||||
|
set( ${basename}_LIBRARIES ${${basename}_LIBRARY_${GOOD}} )
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
macro( select_library_configurations basename )
|
||||||
|
# if only the release version was found, set the debug to be the release
|
||||||
|
# version.
|
||||||
|
_set_library_name( ${basename} RELEASE DEBUG )
|
||||||
|
# if only the debug version was found, set the release value to be the
|
||||||
|
# debug value.
|
||||||
|
_set_library_name( ${basename} DEBUG RELEASE )
|
||||||
|
|
||||||
|
# Set a default case, which will come into effect if
|
||||||
|
# -no build type is set and the generator only supports one build type
|
||||||
|
# at a time (i.e. CMAKE_CONFIGURATION_TYPES is false)
|
||||||
|
# -${basename}_LIBRARY_DEBUG and ${basename}_LIBRARY_RELEASE are the same
|
||||||
|
# -${basename}_LIBRARY_DEBUG and ${basename}_LIBRARY_RELEASE are both empty
|
||||||
|
set( ${basename}_LIBRARY ${${basename}_LIBRARY_RELEASE} )
|
||||||
|
set( ${basename}_LIBRARIES ${${basename}_LIBRARY_RELEASE} )
|
||||||
|
|
||||||
|
if( ${basename}_LIBRARY_DEBUG AND ${basename}_LIBRARY_RELEASE AND
|
||||||
|
NOT ${basename}_LIBRARY_DEBUG STREQUAL ${basename}_LIBRARY_RELEASE )
|
||||||
|
# if the generator supports configuration types or CMAKE_BUILD_TYPE
|
||||||
|
# is set, then set optimized and debug options.
|
||||||
|
if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
|
||||||
|
set( ${basename}_LIBRARY "" )
|
||||||
|
foreach( _libname IN LISTS ${basename}_LIBRARY_RELEASE )
|
||||||
|
list( APPEND ${basename}_LIBRARY optimized "${_libname}" )
|
||||||
|
endforeach()
|
||||||
|
foreach( _libname IN LISTS ${basename}_LIBRARY_DEBUG )
|
||||||
|
list( APPEND ${basename}_LIBRARY debug "${_libname}" )
|
||||||
|
endforeach()
|
||||||
|
set( ${basename}_LIBRARIES "${${basename}_LIBRARY}" )
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set( ${basename}_LIBRARY ${${basename}_LIBRARY} CACHE FILEPATH
|
||||||
|
"The ${basename} library" )
|
||||||
|
|
||||||
|
if( ${basename}_LIBRARY )
|
||||||
|
set( ${basename}_FOUND TRUE )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
mark_as_advanced( ${basename}_LIBRARY
|
||||||
|
${basename}_LIBRARY_RELEASE
|
||||||
|
${basename}_LIBRARY_DEBUG
|
||||||
|
)
|
||||||
|
endmacro()
|
|
@ -288,10 +288,10 @@ GRID_TYPE& BASE_SCREEN::GetGrid( size_t aIndex )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxPoint BASE_SCREEN::GetNearestGridPosition( const wxPoint& aPosition,
|
wxPoint BASE_SCREEN::getNearestGridPosition( const wxPoint& aPosition,
|
||||||
wxRealPoint* aGridSize ) const
|
const wxPoint& aGridOrigin, wxRealPoint* aGridSize ) const
|
||||||
{
|
{
|
||||||
wxPoint pt;
|
wxPoint pt;
|
||||||
wxRealPoint gridSize;
|
wxRealPoint gridSize;
|
||||||
|
|
||||||
if( aGridSize )
|
if( aGridSize )
|
||||||
|
@ -299,13 +299,13 @@ wxPoint BASE_SCREEN::GetNearestGridPosition( const wxPoint& aPosition,
|
||||||
else
|
else
|
||||||
gridSize = GetGridSize();
|
gridSize = GetGridSize();
|
||||||
|
|
||||||
wxPoint gridOrigin = m_GridOrigin;
|
double offset = fmod( aGridOrigin.x, gridSize.x );
|
||||||
|
|
||||||
double offset = fmod( gridOrigin.x, gridSize.x );
|
|
||||||
int x = KiROUND( (aPosition.x - offset) / gridSize.x );
|
int x = KiROUND( (aPosition.x - offset) / gridSize.x );
|
||||||
|
|
||||||
pt.x = KiROUND( x * gridSize.x + offset );
|
pt.x = KiROUND( x * gridSize.x + offset );
|
||||||
|
|
||||||
offset = fmod( gridOrigin.y, gridSize.y );
|
offset = fmod( aGridOrigin.y, gridSize.y );
|
||||||
|
|
||||||
int y = KiROUND( (aPosition.y - offset) / gridSize.y );
|
int y = KiROUND( (aPosition.y - offset) / gridSize.y );
|
||||||
pt.y = KiROUND ( y * gridSize.y + offset );
|
pt.y = KiROUND ( y * gridSize.y + offset );
|
||||||
|
|
||||||
|
@ -313,19 +313,19 @@ wxPoint BASE_SCREEN::GetNearestGridPosition( const wxPoint& aPosition,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxPoint BASE_SCREEN::GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize ) const
|
wxPoint BASE_SCREEN::getCursorPosition( bool aOnGrid, const wxPoint& aGridOrigin, wxRealPoint* aGridSize ) const
|
||||||
{
|
{
|
||||||
if( aOnGrid )
|
if( aOnGrid )
|
||||||
return GetNearestGridPosition( m_crossHairPosition, aGridSize );
|
return getNearestGridPosition( m_crossHairPosition, aGridOrigin, aGridSize );
|
||||||
|
|
||||||
return m_crossHairPosition;
|
return m_crossHairPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxPoint BASE_SCREEN::GetCrossHairScreenPosition() const
|
wxPoint BASE_SCREEN::getCrossHairScreenPosition() const
|
||||||
{
|
{
|
||||||
wxPoint pos = m_crossHairPosition - m_DrawOrg;
|
wxPoint pos = m_crossHairPosition - m_DrawOrg;
|
||||||
double scalar = GetScalingFactor();
|
double scalar = GetScalingFactor();
|
||||||
|
|
||||||
pos.x = KiROUND( (double) pos.x * scalar );
|
pos.x = KiROUND( (double) pos.x * scalar );
|
||||||
pos.y = KiROUND( (double) pos.y * scalar );
|
pos.y = KiROUND( (double) pos.y * scalar );
|
||||||
|
@ -334,10 +334,10 @@ wxPoint BASE_SCREEN::GetCrossHairScreenPosition() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BASE_SCREEN::SetCrossHairPosition( const wxPoint& aPosition, bool aSnapToGrid )
|
void BASE_SCREEN::setCrossHairPosition( const wxPoint& aPosition, const wxPoint& aGridOrigin, bool aSnapToGrid )
|
||||||
{
|
{
|
||||||
if( aSnapToGrid )
|
if( aSnapToGrid )
|
||||||
m_crossHairPosition = GetNearestGridPosition( aPosition );
|
m_crossHairPosition = getNearestGridPosition( aPosition, aGridOrigin, NULL );
|
||||||
else
|
else
|
||||||
m_crossHairPosition = aPosition;
|
m_crossHairPosition = aPosition;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
* depending on the application.
|
* depending on the application.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <macros.h>
|
||||||
#include <base_struct.h>
|
#include <base_struct.h>
|
||||||
#include <class_title_block.h>
|
#include <class_title_block.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
|
@ -187,7 +188,7 @@ void StripTrailingZeros( wxString& aStringValue, unsigned aTrailingZeroAllowed )
|
||||||
|
|
||||||
|
|
||||||
/* Convert a value to a string using double notation.
|
/* Convert a value to a string using double notation.
|
||||||
* For readability, the mantissa has 3 or more digits (max 8 digits),
|
* For readability, the mantissa has 3 or more digits,
|
||||||
* the trailing 0 are removed if the mantissa has more than 3 digits
|
* the trailing 0 are removed if the mantissa has more than 3 digits
|
||||||
* and some trailing 0
|
* and some trailing 0
|
||||||
* This function should be used to display values in dialogs because a value
|
* This function should be used to display values in dialogs because a value
|
||||||
|
@ -198,23 +199,39 @@ void StripTrailingZeros( wxString& aStringValue, unsigned aTrailingZeroAllowed )
|
||||||
*/
|
*/
|
||||||
wxString ReturnStringFromValue( EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol )
|
wxString ReturnStringFromValue( EDA_UNITS_T aUnit, int aValue, bool aAddUnitSymbol )
|
||||||
{
|
{
|
||||||
wxString stringValue;
|
double value_to_print = To_User_Unit( aUnit, aValue );
|
||||||
double value_to_print;
|
|
||||||
|
|
||||||
value_to_print = To_User_Unit( aUnit, aValue );
|
|
||||||
|
|
||||||
#if defined( EESCHEMA )
|
#if defined( EESCHEMA )
|
||||||
stringValue.Printf( wxT( "%.3f" ), value_to_print );
|
wxString stringValue = wxString::Format( wxT( "%.3f" ), value_to_print );
|
||||||
#else
|
|
||||||
#if defined( USE_PCBNEW_NANOMETRES )
|
|
||||||
stringValue.Printf( wxT( "%.8f" ), value_to_print );
|
|
||||||
#else
|
|
||||||
stringValue.Printf( wxT( "%.4f" ), value_to_print );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Strip trailing zeros. However, keep at least 3 digits in mantissa
|
// Strip trailing zeros. However, keep at least 3 digits in mantissa
|
||||||
// For readability
|
// For readability
|
||||||
StripTrailingZeros( stringValue, 3 );
|
StripTrailingZeros( stringValue, 3 );
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
char buf[50];
|
||||||
|
int len;
|
||||||
|
|
||||||
|
if( value_to_print != 0.0 && fabs( value_to_print ) <= 0.0001 )
|
||||||
|
{
|
||||||
|
len = sprintf( buf, "%.10f", value_to_print );
|
||||||
|
|
||||||
|
while( --len > 0 && buf[len] == '0' )
|
||||||
|
buf[len] = '\0';
|
||||||
|
|
||||||
|
if( buf[len]=='.' || buf[len]==',' )
|
||||||
|
buf[len] = '\0';
|
||||||
|
else
|
||||||
|
++len;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
len = sprintf( buf, "%.10g", value_to_print );
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString stringValue( buf, wxConvUTF8 );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( aAddUnitSymbol )
|
if( aAddUnitSymbol )
|
||||||
|
@ -269,8 +286,6 @@ double From_User_Unit( EDA_UNITS_T aUnit, double aValue )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int ReturnValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue )
|
int ReturnValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue )
|
||||||
{
|
{
|
||||||
double value;
|
double value;
|
||||||
|
|
|
@ -42,8 +42,8 @@
|
||||||
BLOCK_SELECTOR::BLOCK_SELECTOR() :
|
BLOCK_SELECTOR::BLOCK_SELECTOR() :
|
||||||
EDA_RECT()
|
EDA_RECT()
|
||||||
{
|
{
|
||||||
m_state = STATE_NO_BLOCK; /* State (enum BLOCK_STATE_T) of block. */
|
m_state = STATE_NO_BLOCK; // State (enum BLOCK_STATE_T) of block.
|
||||||
m_command = BLOCK_IDLE; /* Type (enum BLOCK_COMMAND_T) of operation. */
|
m_command = BLOCK_IDLE; // Type (enum BLOCK_COMMAND_T) of operation.
|
||||||
m_color = BROWN;
|
m_color = BROWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,24 +62,24 @@ void BLOCK_SELECTOR::SetMessageBlock( EDA_DRAW_FRAME* frame )
|
||||||
case BLOCK_IDLE:
|
case BLOCK_IDLE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_MOVE: /* Move */
|
case BLOCK_MOVE: // Move
|
||||||
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
case BLOCK_PRESELECT_MOVE: // Move with preselection list
|
||||||
msg = _( "Block Move" );
|
msg = _( "Block Move" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_DRAG: /* Drag */
|
case BLOCK_DRAG: // Drag
|
||||||
msg = _( "Block Drag" );
|
msg = _( "Block Drag" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_COPY: /* Copy */
|
case BLOCK_COPY: // Copy
|
||||||
msg = _( "Block Copy" );
|
msg = _( "Block Copy" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_DELETE: /* Delete */
|
case BLOCK_DELETE: // Delete
|
||||||
msg = _( "Block Delete" );
|
msg = _( "Block Delete" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_SAVE: /* Save */
|
case BLOCK_SAVE: // Save
|
||||||
msg = _( "Block Save" );
|
msg = _( "Block Save" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -87,20 +87,20 @@ void BLOCK_SELECTOR::SetMessageBlock( EDA_DRAW_FRAME* frame )
|
||||||
msg = _( "Block Paste" );
|
msg = _( "Block Paste" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_ZOOM: /* Window Zoom */
|
case BLOCK_ZOOM: // Window Zoom
|
||||||
msg = _( "Win Zoom" );
|
msg = _( "Win Zoom" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_ROTATE: /* Rotate 90 deg */
|
case BLOCK_ROTATE: // Rotate 90 deg
|
||||||
msg = _( "Block Rotate" );
|
msg = _( "Block Rotate" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_FLIP: /* Flip */
|
case BLOCK_FLIP: // Flip
|
||||||
msg = _( "Block Flip" );
|
msg = _( "Block Flip" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_MIRROR_X:
|
case BLOCK_MIRROR_X:
|
||||||
case BLOCK_MIRROR_Y: /* mirror */
|
case BLOCK_MIRROR_Y: // mirror
|
||||||
msg = _( "Block Mirror" );
|
msg = _( "Block Mirror" );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -185,15 +185,15 @@ void DrawAndSizingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoin
|
||||||
if( aErase )
|
if( aErase )
|
||||||
block->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, block->GetColor() );
|
block->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, block->GetColor() );
|
||||||
|
|
||||||
block->SetLastCursorPosition( aPanel->GetScreen()->GetCrossHairPosition() );
|
block->SetLastCursorPosition( aPanel->GetParent()->GetCrossHairPosition() );
|
||||||
block->SetEnd( aPanel->GetScreen()->GetCrossHairPosition() );
|
block->SetEnd( aPanel->GetParent()->GetCrossHairPosition() );
|
||||||
|
|
||||||
block->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, block->GetColor() );
|
block->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, block->GetColor() );
|
||||||
|
|
||||||
if( block->GetState() == STATE_BLOCK_INIT )
|
if( block->GetState() == STATE_BLOCK_INIT )
|
||||||
{
|
{
|
||||||
if( block->GetWidth() || block->GetHeight() )
|
if( block->GetWidth() || block->GetHeight() )
|
||||||
/* 2nd point exists: the rectangle is not surface anywhere */
|
// 2nd point exists: the rectangle is not surface anywhere
|
||||||
block->SetState( STATE_BLOCK_END );
|
block->SetState( STATE_BLOCK_END );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,14 +203,14 @@ void AbortBlockCurrentCommand( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
|
||||||
{
|
{
|
||||||
BASE_SCREEN* screen = aPanel->GetScreen();
|
BASE_SCREEN* screen = aPanel->GetScreen();
|
||||||
|
|
||||||
if( aPanel->IsMouseCaptured() ) /* Erase current drawing on screen */
|
if( aPanel->IsMouseCaptured() ) // Erase current drawing on screen
|
||||||
{
|
{
|
||||||
/* Clear block outline. */
|
// Clear block outline.
|
||||||
aPanel->CallMouseCapture( aDC, wxDefaultPosition, false );
|
aPanel->CallMouseCapture( aDC, wxDefaultPosition, false );
|
||||||
aPanel->SetMouseCapture( NULL, NULL );
|
aPanel->SetMouseCapture( NULL, NULL );
|
||||||
screen->SetCurItem( NULL );
|
screen->SetCurItem( NULL );
|
||||||
|
|
||||||
/* Delete the picked wrapper if this is a picked list. */
|
// Delete the picked wrapper if this is a picked list.
|
||||||
if( screen->m_BlockLocate.GetCommand() != BLOCK_PASTE )
|
if( screen->m_BlockLocate.GetCommand() != BLOCK_PASTE )
|
||||||
screen->m_BlockLocate.ClearItemsList();
|
screen->m_BlockLocate.ClearItemsList();
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,26 +118,18 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* aParent,
|
||||||
m_snapToGrid = true;
|
m_snapToGrid = true;
|
||||||
m_MsgFrameHeight = EDA_MSG_PANEL::GetRequiredHeight();
|
m_MsgFrameHeight = EDA_MSG_PANEL::GetRequiredHeight();
|
||||||
|
|
||||||
|
|
||||||
//#define ZOOM_DISPLAY_SIZE 60
|
|
||||||
//#define COORD_DISPLAY_SIZE 165
|
|
||||||
//#define DELTA_DISPLAY_SIZE 245
|
|
||||||
//#define UNITS_DISPLAY_SIZE 65
|
|
||||||
#define FUNCTION_DISPLAY_SIZE 110
|
|
||||||
|
|
||||||
CreateStatusBar( 6 );
|
CreateStatusBar( 6 );
|
||||||
|
|
||||||
// set the size of the status bar subwindows:
|
// set the size of the status bar subwindows:
|
||||||
|
|
||||||
wxWindow* stsbar = GetStatusBar();
|
wxWindow* stsbar = GetStatusBar();
|
||||||
|
|
||||||
|
|
||||||
int dims[] = {
|
int dims[] = {
|
||||||
|
|
||||||
// balance of status bar on far left is set to a default or whatever is left over.
|
// remainder of status bar on far left is set to a default or whatever is left over.
|
||||||
-1,
|
-1,
|
||||||
|
|
||||||
// When using GetTextSize() remember the width of '1' is not the same
|
// When using GetTextSize() remember the width of character '1' is not the same
|
||||||
// as the width of '0' unless the font is fixed width, and it usually won't be.
|
// as the width of '0' unless the font is fixed width, and it usually won't be.
|
||||||
|
|
||||||
// zoom:
|
// zoom:
|
||||||
|
@ -152,7 +144,9 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* aParent,
|
||||||
// units display, Inches is bigger than mm
|
// units display, Inches is bigger than mm
|
||||||
GetTextSize( _( "Inches" ), stsbar ).x + 10,
|
GetTextSize( _( "Inches" ), stsbar ).x + 10,
|
||||||
|
|
||||||
FUNCTION_DISPLAY_SIZE,
|
// Size for the panel used as "Current tool in play": will take longest string from
|
||||||
|
// void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent ) in pcbnew/edit.cpp
|
||||||
|
GetTextSize( wxT( "Add layer alignment target" ), stsbar ).x + 10,
|
||||||
};
|
};
|
||||||
|
|
||||||
SetStatusWidths( DIM( dims ), dims );
|
SetStatusWidths( DIM( dims ), dims );
|
||||||
|
@ -391,7 +385,7 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
|
||||||
*/
|
*/
|
||||||
m_LastGridSizeId = id - ID_POPUP_GRID_LEVEL_1000;
|
m_LastGridSizeId = id - ID_POPUP_GRID_LEVEL_1000;
|
||||||
screen->SetGrid( id );
|
screen->SetGrid( id );
|
||||||
screen->SetCrossHairPosition( screen->RefPos( true ) );
|
SetCrossHairPosition( RefPos( true ) );
|
||||||
|
|
||||||
if( m_galCanvasActive )
|
if( m_galCanvasActive )
|
||||||
{
|
{
|
||||||
|
@ -440,7 +434,7 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
|
||||||
m_galCanvas->Refresh();
|
m_galCanvas->Refresh();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
RedrawScreen( GetScreen()->GetScrollCenterPosition(), false );
|
RedrawScreen( GetScrollCenterPosition(), false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -526,7 +520,7 @@ wxPoint EDA_DRAW_FRAME::GetGridPosition( const wxPoint& aPosition ) const
|
||||||
wxPoint pos = aPosition;
|
wxPoint pos = aPosition;
|
||||||
|
|
||||||
if( m_currentScreen != NULL && m_snapToGrid )
|
if( m_currentScreen != NULL && m_snapToGrid )
|
||||||
pos = m_currentScreen->GetNearestGridPosition( aPosition );
|
pos = GetNearestGridPosition( aPosition );
|
||||||
|
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
@ -757,12 +751,9 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU )
|
||||||
{
|
{
|
||||||
BASE_SCREEN* screen = GetScreen();
|
BASE_SCREEN* screen = GetScreen();
|
||||||
|
|
||||||
if( screen == NULL || m_canvas == NULL )
|
if( !screen || !m_canvas )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// There are no safety limits on these calculations, so in NANOMETRES build it
|
|
||||||
// still blows up. This is incomplete work.
|
|
||||||
|
|
||||||
double scale = screen->GetScalingFactor();
|
double scale = screen->GetScalingFactor();
|
||||||
|
|
||||||
wxLogTrace( traceScrollSettings, wxT( "Center Position = ( %d, %d ), scale = %.10g" ),
|
wxLogTrace( traceScrollSettings, wxT( "Center Position = ( %d, %d ), scale = %.10g" ),
|
||||||
|
@ -909,7 +900,7 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU )
|
||||||
|
|
||||||
// Calculate the scroll bar position in internal units to place the
|
// Calculate the scroll bar position in internal units to place the
|
||||||
// center position at the center of client rectangle.
|
// center position at the center of client rectangle.
|
||||||
screen->SetScrollCenterPosition( centerPositionIU );
|
SetScrollCenterPosition( centerPositionIU );
|
||||||
|
|
||||||
double posX = centerPositionIU.x - clientRectIU.GetWidth() / 2.0 - screen->m_DrawOrg.x;
|
double posX = centerPositionIU.x - clientRectIU.GetWidth() / 2.0 - screen->m_DrawOrg.x;
|
||||||
double posY = centerPositionIU.y - clientRectIU.GetHeight() / 2.0 - screen->m_DrawOrg.y;
|
double posY = centerPositionIU.y - clientRectIU.GetHeight() / 2.0 - screen->m_DrawOrg.y;
|
||||||
|
@ -991,7 +982,7 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
|
||||||
//gal->SetGridColor( KiGfx::COLOR4D( GetGridColor() ) );
|
//gal->SetGridColor( KiGfx::COLOR4D( GetGridColor() ) );
|
||||||
gal->SetGridColor( KiGfx::COLOR4D( 0.1, 0.1, 0.1, 1.0 ) );
|
gal->SetGridColor( KiGfx::COLOR4D( 0.1, 0.1, 0.1, 1.0 ) );
|
||||||
gal->SetGridSize( VECTOR2D( screen->GetGridSize().x, screen->GetGridSize().y ) );
|
gal->SetGridSize( VECTOR2D( screen->GetGridSize().x, screen->GetGridSize().y ) );
|
||||||
gal->SetGridOrigin( VECTOR2D( screen->GetGridOrigin() ) );
|
gal->SetGridOrigin( VECTOR2D( GetGridOrigin() ) );
|
||||||
gal->SetGridOriginMarkerSize( 15 );
|
gal->SetGridOriginMarkerSize( 15 );
|
||||||
gal->SetGridDrawThreshold( 10 );
|
gal->SetGridDrawThreshold( 10 );
|
||||||
}
|
}
|
||||||
|
@ -1019,3 +1010,71 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
|
||||||
|
|
||||||
m_galCanvasActive = aEnable;
|
m_galCanvasActive = aEnable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----< BASE_SCREEN API moved here >--------------------------------------------
|
||||||
|
|
||||||
|
wxPoint EDA_DRAW_FRAME::GetCrossHairPosition( bool aInvertY ) const
|
||||||
|
{
|
||||||
|
// subject to change, borrow from old BASE_SCREEN for now.
|
||||||
|
|
||||||
|
BASE_SCREEN* screen = GetScreen(); // virtual call
|
||||||
|
return screen->getCrossHairPosition( aInvertY );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EDA_DRAW_FRAME::SetCrossHairPosition( const wxPoint& aPosition, bool aSnapToGrid )
|
||||||
|
{
|
||||||
|
BASE_SCREEN* screen = GetScreen(); // virtual call
|
||||||
|
screen->setCrossHairPosition( aPosition, GetGridOrigin(), aSnapToGrid );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxPoint EDA_DRAW_FRAME::GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize ) const
|
||||||
|
{
|
||||||
|
BASE_SCREEN* screen = GetScreen(); // virtual call
|
||||||
|
return screen->getCursorPosition( aOnGrid, GetGridOrigin(), aGridSize );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxPoint EDA_DRAW_FRAME::GetNearestGridPosition( const wxPoint& aPosition, wxRealPoint* aGridSize ) const
|
||||||
|
{
|
||||||
|
BASE_SCREEN* screen = GetScreen(); // virtual call
|
||||||
|
return screen->getNearestGridPosition( aPosition, GetGridOrigin(), aGridSize );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxPoint EDA_DRAW_FRAME::GetCrossHairScreenPosition() const
|
||||||
|
{
|
||||||
|
BASE_SCREEN* screen = GetScreen(); // virtual call
|
||||||
|
return screen->getCrossHairScreenPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EDA_DRAW_FRAME::SetMousePosition( const wxPoint& aPosition )
|
||||||
|
{
|
||||||
|
BASE_SCREEN* screen = GetScreen(); // virtual call
|
||||||
|
screen->setMousePosition( aPosition );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxPoint EDA_DRAW_FRAME::RefPos( bool useMouse ) const
|
||||||
|
{
|
||||||
|
BASE_SCREEN* screen = GetScreen(); // virtual call
|
||||||
|
return screen->refPos( useMouse );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const wxPoint& EDA_DRAW_FRAME::GetScrollCenterPosition() const
|
||||||
|
{
|
||||||
|
BASE_SCREEN* screen = GetScreen(); // virtual call
|
||||||
|
return screen->getScrollCenterPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EDA_DRAW_FRAME::SetScrollCenterPosition( const wxPoint& aPoint )
|
||||||
|
{
|
||||||
|
BASE_SCREEN* screen = GetScreen(); // virtual call
|
||||||
|
screen->setScrollCenterPosition( aPoint );
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----</BASE_SCREEN API moved here >--------------------------------------------
|
||||||
|
|
|
@ -182,7 +182,7 @@ void EDA_DRAW_PANEL::DrawCrossHair( wxDC* aDC, EDA_COLOR_T aColor )
|
||||||
if( m_cursorLevel != 0 || aDC == NULL || !m_showCrossHair )
|
if( m_cursorLevel != 0 || aDC == NULL || !m_showCrossHair )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxPoint cursor = GetScreen()->GetCrossHairPosition();
|
wxPoint cursor = GetParent()->GetCrossHairPosition();
|
||||||
|
|
||||||
GRSetDrawMode( aDC, GR_XOR );
|
GRSetDrawMode( aDC, GR_XOR );
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ wxPoint EDA_DRAW_PANEL::GetScreenCenterLogicalPosition()
|
||||||
|
|
||||||
void EDA_DRAW_PANEL::MoveCursorToCrossHair()
|
void EDA_DRAW_PANEL::MoveCursorToCrossHair()
|
||||||
{
|
{
|
||||||
MoveCursor( GetScreen()->GetCrossHairPosition() );
|
MoveCursor( GetParent()->GetCrossHairPosition() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -434,10 +434,10 @@ void EDA_DRAW_PANEL::OnScroll( wxScrollWinEvent& event )
|
||||||
|
|
||||||
double scale = GetParent()->GetScreen()->GetScalingFactor();
|
double scale = GetParent()->GetScreen()->GetScalingFactor();
|
||||||
|
|
||||||
wxPoint center = GetParent()->GetScreen()->GetScrollCenterPosition();
|
wxPoint center = GetParent()->GetScrollCenterPosition();
|
||||||
center.x += KiROUND( (double) ( x - tmpX ) / scale );
|
center.x += KiROUND( (double) ( x - tmpX ) / scale );
|
||||||
center.y += KiROUND( (double) ( y - tmpY ) / scale );
|
center.y += KiROUND( (double) ( y - tmpY ) / scale );
|
||||||
GetParent()->GetScreen()->SetScrollCenterPosition( center );
|
GetParent()->SetScrollCenterPosition( center );
|
||||||
|
|
||||||
Scroll( x, y );
|
Scroll( x, y );
|
||||||
event.Skip();
|
event.Skip();
|
||||||
|
@ -610,7 +610,7 @@ void EDA_DRAW_PANEL::DrawBackGround( wxDC* DC )
|
||||||
DrawAuxiliaryAxis( DC, GR_COPY );
|
DrawAuxiliaryAxis( DC, GR_COPY );
|
||||||
|
|
||||||
if( GetParent()->m_showGridAxis )
|
if( GetParent()->m_showGridAxis )
|
||||||
DrawGridAxis( DC, GR_COPY );
|
DrawGridAxis( DC, GR_COPY, GetParent()->GetGridOrigin() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -646,7 +646,7 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC )
|
||||||
if( screenGridSize.x < MIN_GRID_SIZE || screenGridSize.y < MIN_GRID_SIZE )
|
if( screenGridSize.x < MIN_GRID_SIZE || screenGridSize.y < MIN_GRID_SIZE )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
org = screen->GetNearestGridPosition( org, &gridSize );
|
org = GetParent()->GetNearestGridPosition( org, &gridSize );
|
||||||
|
|
||||||
// Setting the nearest grid position can select grid points outside the clip box.
|
// Setting the nearest grid position can select grid points outside the clip box.
|
||||||
// Incrementing the start point by one grid step should prevent drawing grid points
|
// Incrementing the start point by one grid step should prevent drawing grid points
|
||||||
|
@ -741,7 +741,7 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC )
|
||||||
|
|
||||||
void EDA_DRAW_PANEL::DrawAuxiliaryAxis( wxDC* aDC, GR_DRAWMODE aDrawMode )
|
void EDA_DRAW_PANEL::DrawAuxiliaryAxis( wxDC* aDC, GR_DRAWMODE aDrawMode )
|
||||||
{
|
{
|
||||||
wxPoint origin = GetParent()->GetOriginAxisPosition();
|
wxPoint origin = GetParent()->GetAuxOrigin();
|
||||||
|
|
||||||
if( origin == wxPoint( 0, 0 ) )
|
if( origin == wxPoint( 0, 0 ) )
|
||||||
return;
|
return;
|
||||||
|
@ -769,33 +769,30 @@ void EDA_DRAW_PANEL::DrawAuxiliaryAxis( wxDC* aDC, GR_DRAWMODE aDrawMode )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_PANEL::DrawGridAxis( wxDC* aDC, GR_DRAWMODE aDrawMode )
|
void EDA_DRAW_PANEL::DrawGridAxis( wxDC* aDC, GR_DRAWMODE aDrawMode, const wxPoint& aGridOrigin )
|
||||||
{
|
{
|
||||||
BASE_SCREEN* screen = GetScreen();
|
if( !GetParent()->m_showGridAxis || ( !aGridOrigin.x && !aGridOrigin.y ) )
|
||||||
|
|
||||||
if( !GetParent()->m_showGridAxis
|
|
||||||
|| ( screen->m_GridOrigin.x == 0 && screen->m_GridOrigin.y == 0 ) )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EDA_COLOR_T color = GetParent()->GetGridColor();
|
EDA_COLOR_T color = GetParent()->GetGridColor();
|
||||||
wxSize pageSize = GetParent()->GetPageSizeIU();
|
wxSize pageSize = GetParent()->GetPageSizeIU();
|
||||||
|
|
||||||
GRSetDrawMode( aDC, aDrawMode );
|
GRSetDrawMode( aDC, aDrawMode );
|
||||||
|
|
||||||
// Draw the Y axis
|
// Draw the Y axis
|
||||||
GRDashedLine( &m_ClipBox, aDC,
|
GRDashedLine( &m_ClipBox, aDC,
|
||||||
screen->m_GridOrigin.x,
|
aGridOrigin.x,
|
||||||
-pageSize.y,
|
-pageSize.y,
|
||||||
screen->m_GridOrigin.x,
|
aGridOrigin.x,
|
||||||
pageSize.y,
|
pageSize.y,
|
||||||
0, color );
|
0, color );
|
||||||
|
|
||||||
// Draw the X axis
|
// Draw the X axis
|
||||||
GRDashedLine( &m_ClipBox, aDC,
|
GRDashedLine( &m_ClipBox, aDC,
|
||||||
-pageSize.x,
|
-pageSize.x,
|
||||||
screen->m_GridOrigin.y,
|
aGridOrigin.y,
|
||||||
pageSize.x,
|
pageSize.x,
|
||||||
screen->m_GridOrigin.y,
|
aGridOrigin.y,
|
||||||
0, color );
|
0, color );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -847,7 +844,7 @@ void EDA_DRAW_PANEL::OnMouseLeaving( wxMouseEvent& event )
|
||||||
cross_hair_pos.x = dc.DeviceToLogicalX( cross_hair_pos.x );
|
cross_hair_pos.x = dc.DeviceToLogicalX( cross_hair_pos.x );
|
||||||
cross_hair_pos.y = dc.DeviceToLogicalY( cross_hair_pos.y );
|
cross_hair_pos.y = dc.DeviceToLogicalY( cross_hair_pos.y );
|
||||||
|
|
||||||
GetScreen()->SetCrossHairPosition( cross_hair_pos );
|
GetParent()->SetCrossHairPosition( cross_hair_pos );
|
||||||
|
|
||||||
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_POPUP_ZOOM_CENTER );
|
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_POPUP_ZOOM_CENTER );
|
||||||
cmd.SetEventObject( this );
|
cmd.SetEventObject( this );
|
||||||
|
@ -877,7 +874,7 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
INSTALL_UNBUFFERED_DC( dc, this );
|
INSTALL_UNBUFFERED_DC( dc, this );
|
||||||
GetScreen()->SetCrossHairPosition( event.GetLogicalPosition( dc ) );
|
GetParent()->SetCrossHairPosition( event.GetLogicalPosition( dc ) );
|
||||||
|
|
||||||
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
||||||
cmd.SetEventObject( this );
|
cmd.SetEventObject( this );
|
||||||
|
@ -971,7 +968,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
||||||
DC.SetBackground( *wxBLACK_BRUSH );
|
DC.SetBackground( *wxBLACK_BRUSH );
|
||||||
|
|
||||||
// Compute the cursor position in drawing (logical) units.
|
// Compute the cursor position in drawing (logical) units.
|
||||||
screen->SetMousePosition( event.GetLogicalPosition( DC ) );
|
GetParent()->SetMousePosition( event.GetLogicalPosition( DC ) );
|
||||||
|
|
||||||
int kbstat = 0;
|
int kbstat = 0;
|
||||||
|
|
||||||
|
@ -987,7 +984,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
||||||
// Calling Double Click and Click functions :
|
// Calling Double Click and Click functions :
|
||||||
if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) )
|
if( localbutt == (int) ( GR_M_LEFT_DOWN | GR_M_DCLICK ) )
|
||||||
{
|
{
|
||||||
GetParent()->OnLeftDClick( &DC, screen->RefPos( true ) );
|
GetParent()->OnLeftDClick( &DC, GetParent()->RefPos( true ) );
|
||||||
|
|
||||||
// inhibit a response to the mouse left button release,
|
// inhibit a response to the mouse left button release,
|
||||||
// because we have a double click, and we do not want a new
|
// because we have a double click, and we do not want a new
|
||||||
|
@ -1004,7 +1001,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
||||||
m_ignoreNextLeftButtonRelease = false;
|
m_ignoreNextLeftButtonRelease = false;
|
||||||
|
|
||||||
if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK && !ignoreEvt )
|
if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK && !ignoreEvt )
|
||||||
GetParent()->OnLeftClick( &DC, screen->RefPos( true ) );
|
GetParent()->OnLeftClick( &DC, GetParent()->RefPos( true ) );
|
||||||
|
|
||||||
}
|
}
|
||||||
else if( !event.LeftIsDown() )
|
else if( !event.LeftIsDown() )
|
||||||
|
@ -1028,7 +1025,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
||||||
m_PanStartCenter.y *= ppuy;
|
m_PanStartCenter.y *= ppuy;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_PanStartCenter = GetParent()->GetScreen()->GetScrollCenterPosition();
|
m_PanStartCenter = GetParent()->GetScrollCenterPosition();
|
||||||
|
|
||||||
m_PanStartEventPosition = event.GetPosition();
|
m_PanStartEventPosition = event.GetPosition();
|
||||||
|
|
||||||
|
@ -1102,10 +1099,10 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
||||||
|
|
||||||
double scale = GetParent()->GetScreen()->GetScalingFactor();
|
double scale = GetParent()->GetScreen()->GetScalingFactor();
|
||||||
|
|
||||||
wxPoint center = GetParent()->GetScreen()->GetScrollCenterPosition();
|
wxPoint center = GetParent()->GetScrollCenterPosition();
|
||||||
center.x += KiROUND( (double) ( x - tmpX ) / scale ) / ppux;
|
center.x += KiROUND( (double) ( x - tmpX ) / scale ) / ppux;
|
||||||
center.y += KiROUND( (double) ( y - tmpY ) / scale ) / ppuy;
|
center.y += KiROUND( (double) ( y - tmpY ) / scale ) / ppuy;
|
||||||
GetParent()->GetScreen()->SetScrollCenterPosition( center );
|
GetParent()->SetScrollCenterPosition( center );
|
||||||
|
|
||||||
Refresh();
|
Refresh();
|
||||||
Update();
|
Update();
|
||||||
|
@ -1165,7 +1162,7 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
||||||
* (a filter creates a delay for the real block command start, and
|
* (a filter creates a delay for the real block command start, and
|
||||||
* we must remember this point)
|
* we must remember this point)
|
||||||
*/
|
*/
|
||||||
m_CursorStartPos = screen->GetCrossHairPosition();
|
m_CursorStartPos = GetParent()->GetCrossHairPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_enableBlockCommands && !(localbutt & GR_M_DCLICK) )
|
if( m_enableBlockCommands && !(localbutt & GR_M_DCLICK) )
|
||||||
|
@ -1324,17 +1321,14 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
|
||||||
|
|
||||||
INSTALL_UNBUFFERED_DC( DC, this );
|
INSTALL_UNBUFFERED_DC( DC, this );
|
||||||
|
|
||||||
BASE_SCREEN* Screen = GetScreen();
|
|
||||||
|
|
||||||
// Some key commands use the current mouse position: refresh it.
|
// Some key commands use the current mouse position: refresh it.
|
||||||
pos = wxGetMousePosition() - GetScreenPosition();
|
pos = wxGetMousePosition() - GetScreenPosition();
|
||||||
|
|
||||||
// Compute the cursor position in drawing units. Also known as logical units to wxDC.
|
// Compute the cursor position in drawing units. Also known as logical units to wxDC.
|
||||||
pos = wxPoint( DC.DeviceToLogicalX( pos.x ), DC.DeviceToLogicalY( pos.y ) );
|
pos = wxPoint( DC.DeviceToLogicalX( pos.x ), DC.DeviceToLogicalY( pos.y ) );
|
||||||
Screen->SetMousePosition( pos );
|
|
||||||
|
|
||||||
|
GetParent()->SetMousePosition( pos );
|
||||||
GetParent()->GeneralControl( &DC, pos, localkey );
|
GetParent()->GeneralControl( &DC, pos, localkey );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,7 @@ fp_poly
|
||||||
fp_text
|
fp_text
|
||||||
full
|
full
|
||||||
general
|
general
|
||||||
|
grid_origin
|
||||||
gr_arc
|
gr_arc
|
||||||
gr_circle
|
gr_circle
|
||||||
gr_curve
|
gr_curve
|
||||||
|
|
|
@ -59,7 +59,7 @@ void EDA_DRAW_FRAME::RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointe
|
||||||
void EDA_DRAW_FRAME::RedrawScreen2( const wxPoint& posBefore )
|
void EDA_DRAW_FRAME::RedrawScreen2( const wxPoint& posBefore )
|
||||||
{
|
{
|
||||||
wxPoint dPos = posBefore - m_canvas->GetClientSize() / 2; // relative screen position to center before zoom
|
wxPoint dPos = posBefore - m_canvas->GetClientSize() / 2; // relative screen position to center before zoom
|
||||||
wxPoint newScreenPos = m_canvas->ToDeviceXY( GetScreen()->GetCrossHairPosition() ); // screen position of crosshair after zoom
|
wxPoint newScreenPos = m_canvas->ToDeviceXY( GetCrossHairPosition() ); // screen position of crosshair after zoom
|
||||||
wxPoint newCenter = m_canvas->ToLogicalXY( newScreenPos - dPos );
|
wxPoint newCenter = m_canvas->ToLogicalXY( newScreenPos - dPos );
|
||||||
|
|
||||||
AdjustScrollBars( newCenter );
|
AdjustScrollBars( newCenter );
|
||||||
|
@ -82,10 +82,10 @@ void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer )
|
||||||
screen->SetScalingFactor( bestzoom );
|
screen->SetScalingFactor( bestzoom );
|
||||||
|
|
||||||
if( screen->m_FirstRedraw )
|
if( screen->m_FirstRedraw )
|
||||||
screen->SetCrossHairPosition( screen->GetScrollCenterPosition() );
|
SetCrossHairPosition( GetScrollCenterPosition() );
|
||||||
|
|
||||||
if( !m_galCanvasActive )
|
if( !m_galCanvasActive )
|
||||||
RedrawScreen( screen->GetScrollCenterPosition(), aWarpPointer );
|
RedrawScreen( GetScrollCenterPosition(), aWarpPointer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -123,19 +123,19 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
|
||||||
int id = event.GetId();
|
int id = event.GetId();
|
||||||
bool zoom_at_cursor = false;
|
bool zoom_at_cursor = false;
|
||||||
BASE_SCREEN* screen = GetScreen();
|
BASE_SCREEN* screen = GetScreen();
|
||||||
wxPoint center = screen->GetScrollCenterPosition();
|
wxPoint center = GetScrollCenterPosition();
|
||||||
|
|
||||||
switch( id )
|
switch( id )
|
||||||
{
|
{
|
||||||
case ID_OFFCENTER_ZOOM_IN:
|
case ID_OFFCENTER_ZOOM_IN:
|
||||||
center = m_canvas->ToDeviceXY( screen->GetCrossHairPosition() );
|
center = m_canvas->ToDeviceXY( GetCrossHairPosition() );
|
||||||
if( screen->SetPreviousZoom() )
|
if( screen->SetPreviousZoom() )
|
||||||
RedrawScreen2( center );
|
RedrawScreen2( center );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_ZOOM_IN:
|
case ID_POPUP_ZOOM_IN:
|
||||||
zoom_at_cursor = true;
|
zoom_at_cursor = true;
|
||||||
center = screen->GetCrossHairPosition();
|
center = GetCrossHairPosition();
|
||||||
|
|
||||||
// fall thru
|
// fall thru
|
||||||
case ID_ZOOM_IN:
|
case ID_ZOOM_IN:
|
||||||
|
@ -144,14 +144,14 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_OFFCENTER_ZOOM_OUT:
|
case ID_OFFCENTER_ZOOM_OUT:
|
||||||
center = m_canvas->ToDeviceXY( screen->GetCrossHairPosition() );
|
center = m_canvas->ToDeviceXY( GetCrossHairPosition() );
|
||||||
if( screen->SetNextZoom() )
|
if( screen->SetNextZoom() )
|
||||||
RedrawScreen2( center );
|
RedrawScreen2( center );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_ZOOM_OUT:
|
case ID_POPUP_ZOOM_OUT:
|
||||||
zoom_at_cursor = true;
|
zoom_at_cursor = true;
|
||||||
center = screen->GetCrossHairPosition();
|
center = GetCrossHairPosition();
|
||||||
|
|
||||||
// fall thru
|
// fall thru
|
||||||
case ID_ZOOM_OUT:
|
case ID_ZOOM_OUT:
|
||||||
|
@ -164,7 +164,7 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_ZOOM_CENTER:
|
case ID_POPUP_ZOOM_CENTER:
|
||||||
center = screen->GetCrossHairPosition();
|
center = GetCrossHairPosition();
|
||||||
RedrawScreen( center, true );
|
RedrawScreen( center, true );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -339,8 +339,8 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPositi
|
||||||
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
||||||
cmd.SetEventObject( this );
|
cmd.SetEventObject( this );
|
||||||
|
|
||||||
pos = screen->GetNearestGridPosition( pos );
|
pos = GetNearestGridPosition( pos );
|
||||||
oldpos = screen->GetCrossHairPosition();
|
oldpos = GetCrossHairPosition();
|
||||||
gridSize = screen->GetGridSize();
|
gridSize = screen->GetGridSize();
|
||||||
|
|
||||||
switch( aHotKey )
|
switch( aHotKey )
|
||||||
|
@ -371,7 +371,7 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPositi
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ' ':
|
case ' ':
|
||||||
screen->m_O_Curseur = screen->GetCrossHairPosition();
|
screen->m_O_Curseur = GetCrossHairPosition();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD8: /* cursor moved up */
|
case WXK_NUMPAD8: /* cursor moved up */
|
||||||
|
@ -399,14 +399,14 @@ void DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPositi
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
screen->SetCrossHairPosition( pos );
|
SetCrossHairPosition( pos );
|
||||||
|
|
||||||
if( oldpos != screen->GetCrossHairPosition() )
|
if( oldpos != GetCrossHairPosition() )
|
||||||
{
|
{
|
||||||
pos = screen->GetCrossHairPosition();
|
pos = GetCrossHairPosition();
|
||||||
screen->SetCrossHairPosition( oldpos );
|
SetCrossHairPosition( oldpos );
|
||||||
m_canvas->CrossHairOff( aDC );
|
m_canvas->CrossHairOff( aDC );
|
||||||
screen->SetCrossHairPosition( pos );
|
SetCrossHairPosition( pos );
|
||||||
m_canvas->CrossHairOn( aDC );
|
m_canvas->CrossHairOn( aDC );
|
||||||
|
|
||||||
if( m_canvas->IsMouseCaptured() )
|
if( m_canvas->IsMouseCaptured() )
|
||||||
|
|
|
@ -215,7 +215,7 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
|
||||||
block->SetState( state );
|
block->SetState( state );
|
||||||
block->SetCommand( command );
|
block->SetCommand( command );
|
||||||
m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
|
m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
|
||||||
GetScreen()->SetCrossHairPosition( block->GetEnd() );
|
SetCrossHairPosition( block->GetEnd() );
|
||||||
|
|
||||||
if( block->GetCommand() != BLOCK_ABORT )
|
if( block->GetCommand() != BLOCK_ABORT )
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
|
@ -237,8 +237,8 @@ bool SCH_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
|
||||||
{
|
{
|
||||||
// Compute the rotation center and put it on grid:
|
// Compute the rotation center and put it on grid:
|
||||||
wxPoint rotationPoint = block->Centre();
|
wxPoint rotationPoint = block->Centre();
|
||||||
rotationPoint = GetScreen()->GetNearestGridPosition( rotationPoint );
|
rotationPoint = GetNearestGridPosition( rotationPoint );
|
||||||
GetScreen()->SetCrossHairPosition( rotationPoint );
|
SetCrossHairPosition( rotationPoint );
|
||||||
SaveCopyInUndoList( block->GetItems(), UR_ROTATED, rotationPoint );
|
SaveCopyInUndoList( block->GetItems(), UR_ROTATED, rotationPoint );
|
||||||
RotateListOfItems( block->GetItems(), rotationPoint );
|
RotateListOfItems( block->GetItems(), rotationPoint );
|
||||||
OnModify();
|
OnModify();
|
||||||
|
@ -433,8 +433,8 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
|
||||||
{
|
{
|
||||||
/* Compute the rotation center and put it on grid */
|
/* Compute the rotation center and put it on grid */
|
||||||
wxPoint rotationPoint = block->Centre();
|
wxPoint rotationPoint = block->Centre();
|
||||||
rotationPoint = GetScreen()->GetNearestGridPosition( rotationPoint );
|
rotationPoint = GetNearestGridPosition( rotationPoint );
|
||||||
GetScreen()->SetCrossHairPosition( rotationPoint );
|
SetCrossHairPosition( rotationPoint );
|
||||||
SaveCopyInUndoList( block->GetItems(), UR_ROTATED, rotationPoint );
|
SaveCopyInUndoList( block->GetItems(), UR_ROTATED, rotationPoint );
|
||||||
RotateListOfItems( block->GetItems(), rotationPoint );
|
RotateListOfItems( block->GetItems(), rotationPoint );
|
||||||
OnModify();
|
OnModify();
|
||||||
|
@ -452,8 +452,8 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
|
||||||
{
|
{
|
||||||
/* Compute the mirror center and put it on grid */
|
/* Compute the mirror center and put it on grid */
|
||||||
wxPoint mirrorPoint = block->Centre();
|
wxPoint mirrorPoint = block->Centre();
|
||||||
mirrorPoint = GetScreen()->GetNearestGridPosition( mirrorPoint );
|
mirrorPoint = GetNearestGridPosition( mirrorPoint );
|
||||||
GetScreen()->SetCrossHairPosition( mirrorPoint );
|
SetCrossHairPosition( mirrorPoint );
|
||||||
SaveCopyInUndoList( block->GetItems(), UR_MIRRORED_X, mirrorPoint );
|
SaveCopyInUndoList( block->GetItems(), UR_MIRRORED_X, mirrorPoint );
|
||||||
MirrorX( block->GetItems(), mirrorPoint );
|
MirrorX( block->GetItems(), mirrorPoint );
|
||||||
OnModify();
|
OnModify();
|
||||||
|
@ -471,8 +471,8 @@ void SCH_EDIT_FRAME::HandleBlockEndByPopUp( int Command, wxDC* DC )
|
||||||
{
|
{
|
||||||
/* Compute the mirror center and put it on grid */
|
/* Compute the mirror center and put it on grid */
|
||||||
wxPoint mirrorPoint = block->Centre();
|
wxPoint mirrorPoint = block->Centre();
|
||||||
mirrorPoint = GetScreen()->GetNearestGridPosition( mirrorPoint );
|
mirrorPoint = GetNearestGridPosition( mirrorPoint );
|
||||||
GetScreen()->SetCrossHairPosition( mirrorPoint );
|
SetCrossHairPosition( mirrorPoint );
|
||||||
SaveCopyInUndoList( block->GetItems(), UR_MIRRORED_Y, mirrorPoint );
|
SaveCopyInUndoList( block->GetItems(), UR_MIRRORED_Y, mirrorPoint );
|
||||||
MirrorY( block->GetItems(), mirrorPoint );
|
MirrorY( block->GetItems(), mirrorPoint );
|
||||||
OnModify();
|
OnModify();
|
||||||
|
@ -519,7 +519,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Repaint new view. */
|
/* Repaint new view. */
|
||||||
block->SetMoveVector( screen->GetCrossHairPosition() - block->GetLastCursorPosition() );
|
block->SetMoveVector( aPanel->GetParent()->GetCrossHairPosition() - block->GetLastCursorPosition() );
|
||||||
block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
|
block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < block->GetCount(); ii++ )
|
for( unsigned ii = 0; ii < block->GetCount(); ii++ )
|
||||||
|
|
|
@ -99,8 +99,8 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
|
||||||
GetScreen()->m_BlockLocate.SetState( state );
|
GetScreen()->m_BlockLocate.SetState( state );
|
||||||
GetScreen()->m_BlockLocate.SetCommand( command );
|
GetScreen()->m_BlockLocate.SetCommand( command );
|
||||||
m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
|
m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
|
||||||
GetScreen()->SetCrossHairPosition( wxPoint( GetScreen()->m_BlockLocate.GetRight(),
|
SetCrossHairPosition( wxPoint( GetScreen()->m_BlockLocate.GetRight(),
|
||||||
GetScreen()->m_BlockLocate.GetBottom() ) );
|
GetScreen()->m_BlockLocate.GetBottom() ) );
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
|
||||||
SaveCopyInUndoList( m_component );
|
SaveCopyInUndoList( m_component );
|
||||||
|
|
||||||
pt = GetScreen()->m_BlockLocate.Centre();
|
pt = GetScreen()->m_BlockLocate.Centre();
|
||||||
pt = GetScreen()->GetNearestGridPosition( pt );
|
pt = GetNearestGridPosition( pt );
|
||||||
NEGATE( pt.y );
|
NEGATE( pt.y );
|
||||||
|
|
||||||
if ( m_component )
|
if ( m_component )
|
||||||
|
@ -183,7 +183,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
|
||||||
m_component->MirrorSelectedItemsH( pt );
|
m_component->MirrorSelectedItemsH( pt );
|
||||||
else if( block_cmd == BLOCK_MIRROR_X)
|
else if( block_cmd == BLOCK_MIRROR_X)
|
||||||
m_component->MirrorSelectedItemsV( pt );
|
m_component->MirrorSelectedItemsV( pt );
|
||||||
else if( block_cmd == BLOCK_ROTATE)
|
else if( block_cmd == BLOCK_ROTATE )
|
||||||
m_component->RotateSelectedItems( pt );
|
m_component->RotateSelectedItems( pt );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
|
||||||
SaveCopyInUndoList( m_component );
|
SaveCopyInUndoList( m_component );
|
||||||
|
|
||||||
pt = GetScreen()->m_BlockLocate.Centre();
|
pt = GetScreen()->m_BlockLocate.Centre();
|
||||||
pt = GetScreen()->GetNearestGridPosition( pt );
|
pt = GetNearestGridPosition( pt );
|
||||||
NEGATE( pt.y );
|
NEGATE( pt.y );
|
||||||
|
|
||||||
if ( m_component )
|
if ( m_component )
|
||||||
|
@ -342,7 +342,7 @@ void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
|
||||||
}
|
}
|
||||||
|
|
||||||
// Repaint new view
|
// Repaint new view
|
||||||
block->SetMoveVector( screen->GetCrossHairPosition() - block->GetLastCursorPosition() );
|
block->SetMoveVector( parent->GetCrossHairPosition() - block->GetLastCursorPosition() );
|
||||||
|
|
||||||
GRSetDrawMode( aDC, g_XorMode );
|
GRSetDrawMode( aDC, g_XorMode );
|
||||||
block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
|
block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
|
||||||
|
|
|
@ -81,8 +81,9 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPoint endpos = aPanel->GetScreen()->GetCrossHairPosition();
|
SCH_EDIT_FRAME* frame = (SCH_EDIT_FRAME*) aPanel->GetParent();
|
||||||
SCH_EDIT_FRAME * frame = ( SCH_EDIT_FRAME * ) aPanel->GetParent();
|
|
||||||
|
wxPoint endpos = frame->GetCrossHairPosition();
|
||||||
|
|
||||||
if( frame->GetForceHVLines() ) /* Coerce the line to vertical or horizontal one: */
|
if( frame->GetForceHVLines() ) /* Coerce the line to vertical or horizontal one: */
|
||||||
ComputeBreakPoint( (SCH_LINE*) s_wires.GetLast()->Back(), endpos );
|
ComputeBreakPoint( (SCH_LINE*) s_wires.GetLast()->Back(), endpos );
|
||||||
|
@ -105,7 +106,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
|
||||||
{
|
{
|
||||||
SCH_LINE* segment;
|
SCH_LINE* segment;
|
||||||
SCH_LINE* nextSegment;
|
SCH_LINE* nextSegment;
|
||||||
wxPoint cursorpos = GetScreen()->GetCrossHairPosition();
|
wxPoint cursorpos = GetCrossHairPosition();
|
||||||
|
|
||||||
// We should know if a segment is currently in progress
|
// We should know if a segment is currently in progress
|
||||||
segment = (SCH_LINE*) GetScreen()->GetCurItem();
|
segment = (SCH_LINE*) GetScreen()->GetCurItem();
|
||||||
|
@ -426,8 +427,9 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
|
||||||
|
|
||||||
if( m_itemToRepeat->Type() == SCH_COMPONENT_T ) // If repeat component then put in move mode
|
if( m_itemToRepeat->Type() == SCH_COMPONENT_T ) // If repeat component then put in move mode
|
||||||
{
|
{
|
||||||
wxPoint pos = GetScreen()->GetCrossHairPosition() -
|
wxPoint pos = GetCrossHairPosition() -
|
||||||
( (SCH_COMPONENT*) m_itemToRepeat )->GetPosition();
|
( (SCH_COMPONENT*) m_itemToRepeat )->GetPosition();
|
||||||
|
|
||||||
m_itemToRepeat->SetFlags( IS_NEW );
|
m_itemToRepeat->SetFlags( IS_NEW );
|
||||||
( (SCH_COMPONENT*) m_itemToRepeat )->SetTimeStamp( GetNewTimeStamp() );
|
( (SCH_COMPONENT*) m_itemToRepeat )->SetTimeStamp( GetNewTimeStamp() );
|
||||||
m_itemToRepeat->Move( pos );
|
m_itemToRepeat->Move( pos );
|
||||||
|
|
|
@ -45,10 +45,9 @@ static int s_LastShape = '\\';
|
||||||
|
|
||||||
SCH_BUS_BUS_ENTRY* SCH_EDIT_FRAME::CreateBusBusEntry( wxDC* aDC )
|
SCH_BUS_BUS_ENTRY* SCH_EDIT_FRAME::CreateBusBusEntry( wxDC* aDC )
|
||||||
{
|
{
|
||||||
SCH_SCREEN* screen = GetScreen();
|
|
||||||
|
|
||||||
// Create and place a new bus entry at cursor position
|
// Create and place a new bus entry at cursor position
|
||||||
SCH_BUS_BUS_ENTRY* busEntry = new SCH_BUS_BUS_ENTRY( screen->GetCrossHairPosition(), s_LastShape );
|
SCH_BUS_BUS_ENTRY* busEntry = new SCH_BUS_BUS_ENTRY( GetCrossHairPosition(), s_LastShape );
|
||||||
|
|
||||||
busEntry->SetFlags( IS_NEW );
|
busEntry->SetFlags( IS_NEW );
|
||||||
GetScreen()->SetCurItem( busEntry );
|
GetScreen()->SetCurItem( busEntry );
|
||||||
addCurrentItemToList( aDC );
|
addCurrentItemToList( aDC );
|
||||||
|
@ -57,10 +56,9 @@ SCH_BUS_BUS_ENTRY* SCH_EDIT_FRAME::CreateBusBusEntry( wxDC* aDC )
|
||||||
|
|
||||||
SCH_BUS_WIRE_ENTRY* SCH_EDIT_FRAME::CreateBusWireEntry( wxDC* aDC )
|
SCH_BUS_WIRE_ENTRY* SCH_EDIT_FRAME::CreateBusWireEntry( wxDC* aDC )
|
||||||
{
|
{
|
||||||
SCH_SCREEN* screen = GetScreen();
|
|
||||||
|
|
||||||
// Create and place a new bus entry at cursor position
|
// Create and place a new bus entry at cursor position
|
||||||
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( screen->GetCrossHairPosition(), s_LastShape );
|
SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( GetCrossHairPosition(), s_LastShape );
|
||||||
|
|
||||||
busEntry->SetFlags( IS_NEW );
|
busEntry->SetFlags( IS_NEW );
|
||||||
GetScreen()->SetCurItem( busEntry );
|
GetScreen()->SetCurItem( busEntry );
|
||||||
addCurrentItemToList( aDC );
|
addCurrentItemToList( aDC );
|
||||||
|
|
|
@ -56,7 +56,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, const KIC
|
||||||
wxString msg;
|
wxString msg;
|
||||||
LIB_PIN* Pin = NULL;
|
LIB_PIN* Pin = NULL;
|
||||||
SCH_COMPONENT* LibItem = NULL;
|
SCH_COMPONENT* LibItem = NULL;
|
||||||
wxPoint gridPosition = GetScreen()->GetNearestGridPosition( aPosition );
|
wxPoint gridPosition = GetNearestGridPosition( aPosition );
|
||||||
|
|
||||||
// Check the on grid position first. There is more likely to be multiple items on
|
// Check the on grid position first. There is more likely to be multiple items on
|
||||||
// grid than off grid.
|
// grid than off grid.
|
||||||
|
@ -222,9 +222,9 @@ void SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
|
||||||
snapToGrid = true;
|
snapToGrid = true;
|
||||||
|
|
||||||
if( snapToGrid )
|
if( snapToGrid )
|
||||||
pos = screen->GetNearestGridPosition( pos );
|
pos = GetNearestGridPosition( pos );
|
||||||
|
|
||||||
oldpos = screen->GetCrossHairPosition();
|
oldpos = GetCrossHairPosition();
|
||||||
gridSize = screen->GetGridSize();
|
gridSize = screen->GetGridSize();
|
||||||
|
|
||||||
switch( aHotKey )
|
switch( aHotKey )
|
||||||
|
@ -261,14 +261,14 @@ void SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update cursor position.
|
// Update cursor position.
|
||||||
screen->SetCrossHairPosition( pos, snapToGrid );
|
SetCrossHairPosition( pos, snapToGrid );
|
||||||
|
|
||||||
if( oldpos != screen->GetCrossHairPosition() )
|
if( oldpos != GetCrossHairPosition() )
|
||||||
{
|
{
|
||||||
pos = screen->GetCrossHairPosition();
|
pos = GetCrossHairPosition();
|
||||||
screen->SetCrossHairPosition( oldpos, false);
|
SetCrossHairPosition( oldpos, false);
|
||||||
m_canvas->CrossHairOff( aDC );
|
m_canvas->CrossHairOff( aDC );
|
||||||
screen->SetCrossHairPosition( pos, snapToGrid );
|
SetCrossHairPosition( pos, snapToGrid );
|
||||||
m_canvas->CrossHairOn( aDC );
|
m_canvas->CrossHairOn( aDC );
|
||||||
|
|
||||||
if( m_canvas->IsMouseCaptured() )
|
if( m_canvas->IsMouseCaptured() )
|
||||||
|
@ -304,7 +304,6 @@ void SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
|
||||||
void LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
|
void LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
|
||||||
{
|
{
|
||||||
wxRealPoint gridSize;
|
wxRealPoint gridSize;
|
||||||
SCH_SCREEN* screen = GetScreen();
|
|
||||||
wxPoint oldpos;
|
wxPoint oldpos;
|
||||||
wxPoint pos = aPosition;
|
wxPoint pos = aPosition;
|
||||||
|
|
||||||
|
@ -320,10 +319,10 @@ void LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
|
||||||
snapToGrid = true;
|
snapToGrid = true;
|
||||||
|
|
||||||
if( snapToGrid )
|
if( snapToGrid )
|
||||||
pos = screen->GetNearestGridPosition( pos );
|
pos = GetNearestGridPosition( pos );
|
||||||
|
|
||||||
oldpos = screen->GetCrossHairPosition();
|
oldpos = GetCrossHairPosition();
|
||||||
gridSize = screen->GetGridSize();
|
gridSize = GetScreen()->GetGridSize();
|
||||||
|
|
||||||
switch( aHotKey )
|
switch( aHotKey )
|
||||||
{
|
{
|
||||||
|
@ -359,14 +358,14 @@ void LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the cursor position.
|
// Update the cursor position.
|
||||||
screen->SetCrossHairPosition( pos, snapToGrid );
|
SetCrossHairPosition( pos, snapToGrid );
|
||||||
|
|
||||||
if( oldpos != screen->GetCrossHairPosition() )
|
if( oldpos != GetCrossHairPosition() )
|
||||||
{
|
{
|
||||||
pos = screen->GetCrossHairPosition();
|
pos = GetCrossHairPosition();
|
||||||
screen->SetCrossHairPosition( oldpos, false );
|
SetCrossHairPosition( oldpos, false );
|
||||||
m_canvas->CrossHairOff( aDC );
|
m_canvas->CrossHairOff( aDC );
|
||||||
screen->SetCrossHairPosition( pos, snapToGrid );
|
SetCrossHairPosition( pos, snapToGrid );
|
||||||
m_canvas->CrossHairOn( aDC );
|
m_canvas->CrossHairOn( aDC );
|
||||||
|
|
||||||
if( m_canvas->IsMouseCaptured() )
|
if( m_canvas->IsMouseCaptured() )
|
||||||
|
@ -403,8 +402,8 @@ void LIB_VIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
|
||||||
wxPoint oldpos;
|
wxPoint oldpos;
|
||||||
wxPoint pos = aPosition;
|
wxPoint pos = aPosition;
|
||||||
|
|
||||||
pos = screen->GetNearestGridPosition( pos );
|
pos = GetNearestGridPosition( pos );
|
||||||
oldpos = screen->GetCrossHairPosition();
|
oldpos = GetCrossHairPosition();
|
||||||
gridSize = screen->GetGridSize();
|
gridSize = screen->GetGridSize();
|
||||||
|
|
||||||
switch( aHotKey )
|
switch( aHotKey )
|
||||||
|
@ -441,14 +440,14 @@ void LIB_VIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update cursor position.
|
// Update cursor position.
|
||||||
screen->SetCrossHairPosition( pos );
|
SetCrossHairPosition( pos );
|
||||||
|
|
||||||
if( oldpos != screen->GetCrossHairPosition() )
|
if( oldpos != GetCrossHairPosition() )
|
||||||
{
|
{
|
||||||
pos = screen->GetCrossHairPosition();
|
pos = GetCrossHairPosition();
|
||||||
screen->SetCrossHairPosition( oldpos );
|
SetCrossHairPosition( oldpos );
|
||||||
m_canvas->CrossHairOff( aDC );
|
m_canvas->CrossHairOff( aDC );
|
||||||
screen->SetCrossHairPosition( pos );
|
SetCrossHairPosition( pos );
|
||||||
m_canvas->CrossHairOn( aDC );
|
m_canvas->CrossHairOn( aDC );
|
||||||
|
|
||||||
if( m_canvas->IsMouseCaptured() )
|
if( m_canvas->IsMouseCaptured() )
|
||||||
|
|
|
@ -205,7 +205,7 @@ void DIALOG_ERC::OnLeftClickMarkersList( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
m_lastMarkerFound = marker;
|
m_lastMarkerFound = marker;
|
||||||
m_parent->GetScreen()->SetCrossHairPosition( marker->m_Pos );
|
m_parent->SetCrossHairPosition( marker->m_Pos );
|
||||||
m_parent->RedrawScreen( marker->m_Pos, false);
|
m_parent->RedrawScreen( marker->m_Pos, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ void DIALOG_ERC::OnLeftDblClickMarkersList( wxCommandEvent& event )
|
||||||
// (NULL if not found)
|
// (NULL if not found)
|
||||||
if( m_lastMarkerFound )
|
if( m_lastMarkerFound )
|
||||||
{
|
{
|
||||||
m_parent->GetScreen()->SetCrossHairPosition( m_lastMarkerFound->m_Pos );
|
m_parent->SetCrossHairPosition( m_lastMarkerFound->m_Pos );
|
||||||
m_parent->RedrawScreen( m_lastMarkerFound->m_Pos, true);
|
m_parent->RedrawScreen( m_lastMarkerFound->m_Pos, true);
|
||||||
// prevent a mouse left button release event in
|
// prevent a mouse left button release event in
|
||||||
// coming from the ERC dialog double click
|
// coming from the ERC dialog double click
|
||||||
|
|
|
@ -93,7 +93,7 @@ static void moveBitmap( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosit
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the bitmap at it's new position.
|
// Draw the bitmap at it's new position.
|
||||||
image->SetPosition( screen->GetCrossHairPosition() );
|
image->SetPosition( aPanel->GetParent()->GetCrossHairPosition() );
|
||||||
image->Draw( aPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
|
image->Draw( aPanel, aDC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ SCH_BITMAP* SCH_EDIT_FRAME::CreateNewImage( wxDC* aDC )
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPoint pos = GetScreen()->GetCrossHairPosition();
|
wxPoint pos = GetCrossHairPosition();
|
||||||
|
|
||||||
SCH_BITMAP* image = new SCH_BITMAP( pos );
|
SCH_BITMAP* image = new SCH_BITMAP( pos );
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ void SCH_EDIT_FRAME::MoveImage( SCH_BITMAP* aImageItem, wxDC* aDC )
|
||||||
SetUndoItem( aImageItem );
|
SetUndoItem( aImageItem );
|
||||||
|
|
||||||
m_canvas->CrossHairOff( aDC );
|
m_canvas->CrossHairOff( aDC );
|
||||||
GetScreen()->SetCrossHairPosition( aImageItem->GetPosition() );
|
SetCrossHairPosition( aImageItem->GetPosition() );
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
m_canvas->CrossHairOn( aDC );
|
m_canvas->CrossHairOn( aDC );
|
||||||
|
|
||||||
|
|
|
@ -77,20 +77,20 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType )
|
||||||
switch( aType )
|
switch( aType )
|
||||||
{
|
{
|
||||||
case LAYER_NOTES:
|
case LAYER_NOTES:
|
||||||
textItem = new SCH_TEXT( GetScreen()->GetCrossHairPosition() );
|
textItem = new SCH_TEXT( GetCrossHairPosition() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LAYER_LOCLABEL:
|
case LAYER_LOCLABEL:
|
||||||
textItem = new SCH_LABEL( GetScreen()->GetCrossHairPosition() );
|
textItem = new SCH_LABEL( GetCrossHairPosition() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LAYER_HIERLABEL:
|
case LAYER_HIERLABEL:
|
||||||
textItem = new SCH_HIERLABEL( GetScreen()->GetCrossHairPosition() );
|
textItem = new SCH_HIERLABEL( GetCrossHairPosition() );
|
||||||
textItem->SetShape( lastGlobalLabelShape );
|
textItem->SetShape( lastGlobalLabelShape );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LAYER_GLOBLABEL:
|
case LAYER_GLOBLABEL:
|
||||||
textItem = new SCH_GLOBALLABEL( GetScreen()->GetCrossHairPosition() );
|
textItem = new SCH_GLOBALLABEL( GetCrossHairPosition() );
|
||||||
textItem->SetShape( lastGlobalLabelShape );
|
textItem->SetShape( lastGlobalLabelShape );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event )
|
||||||
m_CurrentSheet->UpdateAllScreenReferences();
|
m_CurrentSheet->UpdateAllScreenReferences();
|
||||||
}
|
}
|
||||||
|
|
||||||
sheetFoundIn->LastScreen()->SetCrossHairPosition( lastMarker->GetPosition() );
|
SetCrossHairPosition( lastMarker->GetPosition() );
|
||||||
|
|
||||||
RedrawScreen( lastMarker->GetPosition(), warpCursor );
|
RedrawScreen( lastMarker->GetPosition(), warpCursor );
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference,
|
||||||
|
|
||||||
if( centerAndRedraw )
|
if( centerAndRedraw )
|
||||||
{
|
{
|
||||||
GetScreen()->SetCrossHairPosition(pos);
|
SetCrossHairPosition( pos );
|
||||||
RedrawScreen( pos, aWarpMouse );
|
RedrawScreen( pos, aWarpMouse );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference,
|
||||||
if( aWarpMouse )
|
if( aWarpMouse )
|
||||||
m_canvas->MoveCursor( pos );
|
m_canvas->MoveCursor( pos );
|
||||||
|
|
||||||
GetScreen()->SetCrossHairPosition(pos);
|
SetCrossHairPosition( pos );
|
||||||
|
|
||||||
m_canvas->CrossHairOn( &dc );
|
m_canvas->CrossHairOn( &dc );
|
||||||
}
|
}
|
||||||
|
@ -351,7 +351,8 @@ void SCH_EDIT_FRAME::OnFindSchematicItem( wxFindDialogEvent& aEvent )
|
||||||
SetScreen( sheet->LastScreen() );
|
SetScreen( sheet->LastScreen() );
|
||||||
}
|
}
|
||||||
|
|
||||||
sheet->LastScreen()->SetCrossHairPosition( data.GetPosition() );
|
// careful here
|
||||||
|
SetCrossHairPosition( data.GetPosition() );
|
||||||
|
|
||||||
RedrawScreen( data.GetPosition(), warpCursor );
|
RedrawScreen( data.GetPosition(), warpCursor );
|
||||||
|
|
||||||
|
|
|
@ -231,7 +231,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* aDC,
|
||||||
|
|
||||||
SCH_COMPONENT* component;
|
SCH_COMPONENT* component;
|
||||||
component = new SCH_COMPONENT( *Entry, m_CurrentSheet, unit, convert,
|
component = new SCH_COMPONENT( *Entry, m_CurrentSheet, unit, convert,
|
||||||
GetScreen()->GetCrossHairPosition(), true );
|
GetCrossHairPosition(), true );
|
||||||
|
|
||||||
// Set the m_ChipName value, from component name in lib, for aliases
|
// Set the m_ChipName value, from component name in lib, for aliases
|
||||||
// Note if Entry is found, and if Name is an alias of a component,
|
// Note if Entry is found, and if Name is an alias of a component,
|
||||||
|
|
|
@ -284,12 +284,12 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet()
|
||||||
{
|
{
|
||||||
Zoom_Automatique( false );
|
Zoom_Automatique( false );
|
||||||
screen->m_FirstRedraw = false;
|
screen->m_FirstRedraw = false;
|
||||||
screen->SetCrossHairPosition( screen->GetScrollCenterPosition() );
|
SetCrossHairPosition( GetScrollCenterPosition() );
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RedrawScreen( screen->GetScrollCenterPosition(), true );
|
RedrawScreen( GetScrollCenterPosition(), true );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now refresh m_canvas. Should be not necessary, but because screen has changed
|
// Now refresh m_canvas. Should be not necessary, but because screen has changed
|
||||||
|
|
|
@ -74,14 +74,14 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* local variables */
|
// local variables
|
||||||
/* Hotkey list: */
|
// Hotkey list:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Common commands
|
* Common commands
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Fit on Screen */
|
// Fit on Screen
|
||||||
#if !defined( __WXMAC__ )
|
#if !defined( __WXMAC__ )
|
||||||
static EDA_HOTKEY HkZoomAuto( wxT( "Fit on Screen" ), HK_ZOOM_AUTO, WXK_HOME, ID_ZOOM_PAGE );
|
static EDA_HOTKEY HkZoomAuto( wxT( "Fit on Screen" ), HK_ZOOM_AUTO, WXK_HOME, ID_ZOOM_PAGE );
|
||||||
#else
|
#else
|
||||||
|
@ -92,7 +92,7 @@ static EDA_HOTKEY HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, GR_KB_CTRL + '0'
|
||||||
static EDA_HOTKEY HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4,
|
static EDA_HOTKEY HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4,
|
||||||
ID_POPUP_ZOOM_CENTER );
|
ID_POPUP_ZOOM_CENTER );
|
||||||
|
|
||||||
/* Refresh Screen */
|
// Refresh Screen
|
||||||
#if !defined( __WXMAC__ )
|
#if !defined( __WXMAC__ )
|
||||||
static EDA_HOTKEY HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3, ID_ZOOM_REDRAW );
|
static EDA_HOTKEY HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3, ID_ZOOM_REDRAW );
|
||||||
#else
|
#else
|
||||||
|
@ -100,14 +100,14 @@ static EDA_HOTKEY HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, GR_KB_CTRL
|
||||||
ID_ZOOM_REDRAW );
|
ID_ZOOM_REDRAW );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Zoom In */
|
// Zoom In
|
||||||
#if !defined( __WXMAC__ )
|
#if !defined( __WXMAC__ )
|
||||||
static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1, ID_POPUP_ZOOM_IN );
|
static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1, ID_POPUP_ZOOM_IN );
|
||||||
#else
|
#else
|
||||||
static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, GR_KB_CTRL + '+', ID_POPUP_ZOOM_IN );
|
static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, GR_KB_CTRL + '+', ID_POPUP_ZOOM_IN );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Zoom Out */
|
// Zoom Out
|
||||||
#if !defined( __WXMAC__ )
|
#if !defined( __WXMAC__ )
|
||||||
static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2, ID_POPUP_ZOOM_OUT );
|
static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2, ID_POPUP_ZOOM_OUT );
|
||||||
#else
|
#else
|
||||||
|
@ -115,13 +115,13 @@ static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, GR_KB_CTRL + '-', I
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static EDA_HOTKEY HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' );
|
static EDA_HOTKEY HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' );
|
||||||
static EDA_HOTKEY HkResetLocalCoord( wxT( "Reset Local Coordinates" ),
|
static EDA_HOTKEY HkResetLocalCoord( wxT( "Reset Local Coordinates" ), HK_RESET_LOCAL_COORD, ' ' );
|
||||||
HK_RESET_LOCAL_COORD, ' ' );
|
|
||||||
|
|
||||||
/* Undo */
|
|
||||||
|
// Undo
|
||||||
static EDA_HOTKEY HkUndo( wxT( "Undo" ), HK_UNDO, GR_KB_CTRL + 'Z', (int) wxID_UNDO );
|
static EDA_HOTKEY HkUndo( wxT( "Undo" ), HK_UNDO, GR_KB_CTRL + 'Z', (int) wxID_UNDO );
|
||||||
|
|
||||||
/* Redo */
|
// Redo
|
||||||
#if !defined( __WXMAC__ )
|
#if !defined( __WXMAC__ )
|
||||||
static EDA_HOTKEY HkRedo( wxT( "Redo" ), HK_REDO, GR_KB_CTRL + 'Y', (int) wxID_REDO );
|
static EDA_HOTKEY HkRedo( wxT( "Redo" ), HK_REDO, GR_KB_CTRL + 'Y', (int) wxID_REDO );
|
||||||
#else
|
#else
|
||||||
|
@ -358,8 +358,8 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||||
DisplayHotkeyList( this, s_Schematic_Hokeys_Descr );
|
DisplayHotkeyList( this, s_Schematic_Hokeys_Descr );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_RESET_LOCAL_COORD: /* Reset the relative coord */
|
case HK_RESET_LOCAL_COORD: // Reset the relative coord
|
||||||
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
|
GetScreen()->m_O_Curseur = GetCrossHairPosition();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_ZOOM_IN:
|
case HK_ZOOM_IN:
|
||||||
|
@ -561,8 +561,8 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||||
DisplayHotkeyList( this, s_Libedit_Hokeys_Descr );
|
DisplayHotkeyList( this, s_Libedit_Hokeys_Descr );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_RESET_LOCAL_COORD: /* Reset the relative coord */
|
case HK_RESET_LOCAL_COORD: // Reset the relative coord
|
||||||
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
|
GetScreen()->m_O_Curseur = GetCrossHairPosition();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_ZOOM_IN:
|
case HK_ZOOM_IN:
|
||||||
|
|
|
@ -218,7 +218,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
|
||||||
|
|
||||||
GetScreen()->m_Center = true;
|
GetScreen()->m_Center = true;
|
||||||
|
|
||||||
GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
|
SetCrossHairPosition( wxPoint( 0, 0 ) );
|
||||||
|
|
||||||
LoadSettings();
|
LoadSettings();
|
||||||
|
|
||||||
|
@ -402,7 +402,7 @@ double LIB_EDIT_FRAME::BestZoom()
|
||||||
BoundaryBox = m_component->GetBoundingBox( m_unit, m_convert );
|
BoundaryBox = m_component->GetBoundingBox( m_unit, m_convert );
|
||||||
dx = BoundaryBox.GetWidth();
|
dx = BoundaryBox.GetWidth();
|
||||||
dy = BoundaryBox.GetHeight();
|
dy = BoundaryBox.GetHeight();
|
||||||
GetScreen()->SetScrollCenterPosition( wxPoint( 0, 0 ) );
|
SetScrollCenterPosition( wxPoint( 0, 0 ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -411,7 +411,7 @@ double LIB_EDIT_FRAME::BestZoom()
|
||||||
dx = pageInfo.GetSizeIU().x;
|
dx = pageInfo.GetSizeIU().x;
|
||||||
dy = pageInfo.GetSizeIU().y;
|
dy = pageInfo.GetSizeIU().y;
|
||||||
|
|
||||||
GetScreen()->SetScrollCenterPosition( wxPoint( 0, 0 ) );
|
SetScrollCenterPosition( wxPoint( 0, 0 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
size = m_canvas->GetClientSize();
|
size = m_canvas->GetClientSize();
|
||||||
|
@ -753,7 +753,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
STATUS_FLAGS oldFlags = m_drawItem->GetFlags();
|
STATUS_FLAGS oldFlags = m_drawItem->GetFlags();
|
||||||
m_drawItem->ClearFlags();
|
m_drawItem->ClearFlags();
|
||||||
m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, NULL, DefaultTransform );
|
m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, NULL, DefaultTransform );
|
||||||
( (LIB_POLYLINE*) m_drawItem )->DeleteSegment( GetScreen()->GetCrossHairPosition( true ) );
|
( (LIB_POLYLINE*) m_drawItem )->DeleteSegment( GetCrossHairPosition( true ) );
|
||||||
m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, NULL, DefaultTransform );
|
m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, NULL, DefaultTransform );
|
||||||
m_drawItem->SetFlags( oldFlags );
|
m_drawItem->SetFlags( oldFlags );
|
||||||
m_lastDrawItem = NULL;
|
m_lastDrawItem = NULL;
|
||||||
|
@ -1139,7 +1139,7 @@ LIB_ITEM* LIB_EDIT_FRAME::LocateItemUsingCursor( const wxPoint& aPosition,
|
||||||
if( item == NULL )
|
if( item == NULL )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
wxPoint pos = GetScreen()->GetNearestGridPosition( aPosition );
|
wxPoint pos = GetNearestGridPosition( aPosition );
|
||||||
|
|
||||||
if( item == NULL && aPosition != pos )
|
if( item == NULL && aPosition != pos )
|
||||||
item = locateItem( pos, aFilterList );
|
item = locateItem( pos, aFilterList );
|
||||||
|
|
|
@ -663,8 +663,8 @@ void SCH_EDIT_FRAME::addJunctionMenuEntries( wxMenu* aMenu, SCH_JUNCTION* aJunct
|
||||||
void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
|
void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
|
||||||
{
|
{
|
||||||
SCH_SCREEN* screen = frame->GetScreen();
|
SCH_SCREEN* screen = frame->GetScreen();
|
||||||
wxPoint pos = screen->GetCrossHairPosition();
|
wxPoint pos = frame->GetCrossHairPosition();
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
if( Wire == NULL )
|
if( Wire == NULL )
|
||||||
{
|
{
|
||||||
|
@ -691,9 +691,9 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
|
||||||
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ),
|
AddMenuItem( PopMenu, ID_POPUP_SCH_DELETE_CONNECTION, _( "Delete Connection" ),
|
||||||
KiBitmap( delete_connection_xpm ) );
|
KiBitmap( delete_connection_xpm ) );
|
||||||
|
|
||||||
SCH_LINE* line = screen->GetWireOrBus( screen->GetCrossHairPosition() );
|
SCH_LINE* line = screen->GetWireOrBus( frame->GetCrossHairPosition() );
|
||||||
|
|
||||||
if( line && !line->IsEndPoint( screen->GetCrossHairPosition() ) )
|
if( line && !line->IsEndPoint( frame->GetCrossHairPosition() ) )
|
||||||
AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ),
|
AddMenuItem( PopMenu, ID_POPUP_SCH_BREAK_WIRE, _( "Break Wire" ),
|
||||||
KiBitmap( break_line_xpm ) );
|
KiBitmap( break_line_xpm ) );
|
||||||
|
|
||||||
|
@ -713,8 +713,8 @@ void AddMenusForWire( wxMenu* PopMenu, SCH_LINE* Wire, SCH_EDIT_FRAME* frame )
|
||||||
|
|
||||||
void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame )
|
void AddMenusForBus( wxMenu* PopMenu, SCH_LINE* Bus, SCH_EDIT_FRAME* frame )
|
||||||
{
|
{
|
||||||
wxPoint pos = frame->GetScreen()->GetCrossHairPosition();
|
wxPoint pos = frame->GetCrossHairPosition();
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
if( Bus == NULL )
|
if( Bus == NULL )
|
||||||
{
|
{
|
||||||
|
|
|
@ -210,7 +210,7 @@ void LIB_EDIT_FRAME::PlacePin()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
newpos = GetScreen()->GetCrossHairPosition( true );
|
newpos = GetCrossHairPosition( true );
|
||||||
|
|
||||||
// Test for an other pin in same new position:
|
// Test for an other pin in same new position:
|
||||||
for( Pin = m_component->GetNextPin(); Pin != NULL; Pin = m_component->GetNextPin( Pin ) )
|
for( Pin = m_component->GetNextPin(); Pin != NULL; Pin = m_component->GetNextPin( Pin ) )
|
||||||
|
@ -308,7 +308,7 @@ void LIB_EDIT_FRAME::StartMovePin( wxDC* DC )
|
||||||
startPos.x = OldPos.x;
|
startPos.x = OldPos.x;
|
||||||
startPos.y = -OldPos.y;
|
startPos.y = -OldPos.y;
|
||||||
// m_canvas->CrossHairOff( DC );
|
// m_canvas->CrossHairOff( DC );
|
||||||
GetScreen()->SetCrossHairPosition( startPos );
|
SetCrossHairPosition( startPos );
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
|
|
||||||
MSG_PANEL_ITEMS items;
|
MSG_PANEL_ITEMS items;
|
||||||
|
@ -350,7 +350,7 @@ static void DrawMovePin( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redraw pin in new position
|
// Redraw pin in new position
|
||||||
CurrentPin->Move( aPanel->GetScreen()->GetCrossHairPosition( true ) );
|
CurrentPin->Move( aPanel->GetParent()->GetCrossHairPosition( true ) );
|
||||||
CurrentPin->Draw( aPanel, aDC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode,
|
CurrentPin->Draw( aPanel, aDC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode,
|
||||||
&showPinText, DefaultTransform );
|
&showPinText, DefaultTransform );
|
||||||
|
|
||||||
|
@ -388,7 +388,7 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC )
|
||||||
if( SynchronizePins() )
|
if( SynchronizePins() )
|
||||||
pin->SetFlags( IS_LINKED );
|
pin->SetFlags( IS_LINKED );
|
||||||
|
|
||||||
pin->Move( GetScreen()->GetCrossHairPosition( true ) );
|
pin->Move( GetCrossHairPosition( true ) );
|
||||||
pin->SetLength( LastPinLength );
|
pin->SetLength( LastPinLength );
|
||||||
pin->SetOrientation( LastPinOrient );
|
pin->SetOrientation( LastPinOrient );
|
||||||
pin->SetType( LastPinType );
|
pin->SetType( LastPinType );
|
||||||
|
@ -555,10 +555,10 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
|
||||||
if( SynchronizePins() )
|
if( SynchronizePins() )
|
||||||
Pin->SetFlags( IS_LINKED );
|
Pin->SetFlags( IS_LINKED );
|
||||||
|
|
||||||
wxPoint savepos = GetScreen()->GetCrossHairPosition();
|
wxPoint savepos = GetCrossHairPosition();
|
||||||
m_canvas->CrossHairOff( DC );
|
m_canvas->CrossHairOff( DC );
|
||||||
GetScreen()->SetCrossHairPosition( wxPoint( Pin->GetPosition().x,
|
|
||||||
-Pin->GetPosition().y ) );
|
SetCrossHairPosition( wxPoint( Pin->GetPosition().x, -Pin->GetPosition().y ) );
|
||||||
|
|
||||||
// Add this new pin in list, and creates pins for others parts if needed
|
// Add this new pin in list, and creates pins for others parts if needed
|
||||||
m_drawItem = Pin;
|
m_drawItem = Pin;
|
||||||
|
@ -566,7 +566,7 @@ void LIB_EDIT_FRAME::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
|
||||||
PlacePin();
|
PlacePin();
|
||||||
m_lastDrawItem = Pin;
|
m_lastDrawItem = Pin;
|
||||||
|
|
||||||
GetScreen()->SetCrossHairPosition( savepos );
|
SetCrossHairPosition( savepos );
|
||||||
m_canvas->CrossHairOn( DC );
|
m_canvas->CrossHairOn( DC );
|
||||||
|
|
||||||
MSG_PANEL_ITEMS items;
|
MSG_PANEL_ITEMS items;
|
||||||
|
|
|
@ -73,17 +73,17 @@ const wxSize SCH_BASE_FRAME::GetPageSizeIU() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const wxPoint& SCH_BASE_FRAME::GetOriginAxisPosition() const
|
const wxPoint& SCH_BASE_FRAME::GetAuxOrigin() const
|
||||||
{
|
{
|
||||||
wxASSERT( GetScreen() );
|
wxASSERT( GetScreen() );
|
||||||
return GetScreen()->GetOriginAxisPosition();
|
return GetScreen()->GetAuxOrigin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_BASE_FRAME::SetOriginAxisPosition( const wxPoint& aPosition )
|
void SCH_BASE_FRAME::SetAuxOrigin( const wxPoint& aPosition )
|
||||||
{
|
{
|
||||||
wxASSERT( GetScreen() );
|
wxASSERT( GetScreen() );
|
||||||
GetScreen()->SetOriginAxisPosition( aPosition );
|
GetScreen()->SetAuxOrigin( aPosition );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,8 +113,8 @@ void SCH_BASE_FRAME::UpdateStatusBar()
|
||||||
EDA_DRAW_FRAME::UpdateStatusBar();
|
EDA_DRAW_FRAME::UpdateStatusBar();
|
||||||
|
|
||||||
// Display absolute coordinates:
|
// Display absolute coordinates:
|
||||||
double dXpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().x );
|
double dXpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().x );
|
||||||
double dYpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().y );
|
double dYpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().y );
|
||||||
|
|
||||||
if ( g_UserUnit == MILLIMETRES )
|
if ( g_UserUnit == MILLIMETRES )
|
||||||
{
|
{
|
||||||
|
@ -147,8 +147,9 @@ void SCH_BASE_FRAME::UpdateStatusBar()
|
||||||
SetStatusText( line, 2 );
|
SetStatusText( line, 2 );
|
||||||
|
|
||||||
// Display relative coordinates:
|
// Display relative coordinates:
|
||||||
dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x;
|
dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
|
||||||
dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y;
|
dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
|
||||||
|
|
||||||
dXpos = To_User_Unit( g_UserUnit, dx );
|
dXpos = To_User_Unit( g_UserUnit, dx );
|
||||||
dYpos = To_User_Unit( g_UserUnit, dy );
|
dYpos = To_User_Unit( g_UserUnit, dy );
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case wxID_PASTE:
|
case wxID_PASTE:
|
||||||
HandleBlockBegin( &dc, BLOCK_PASTE, screen->GetCrossHairPosition() );
|
HandleBlockBegin( &dc, BLOCK_PASTE, GetCrossHairPosition() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_SCH_ENTRY_SELECT_SLASH:
|
case ID_POPUP_SCH_ENTRY_SELECT_SLASH:
|
||||||
|
@ -165,12 +165,12 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
|
||||||
case ID_POPUP_SCH_BEGIN_WIRE:
|
case ID_POPUP_SCH_BEGIN_WIRE:
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
OnLeftClick( &dc, screen->GetCrossHairPosition() );
|
OnLeftClick( &dc, GetCrossHairPosition() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_SCH_BEGIN_BUS:
|
case ID_POPUP_SCH_BEGIN_BUS:
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
OnLeftClick( &dc, screen->GetCrossHairPosition() );
|
OnLeftClick( &dc, GetCrossHairPosition() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_SCH_SET_SHAPE_TEXT:
|
case ID_POPUP_SCH_SET_SHAPE_TEXT:
|
||||||
|
@ -194,7 +194,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
oldWires.SetOwnership( false ); // Prevent DLIST for deleting items in destructor.
|
oldWires.SetOwnership( false ); // Prevent DLIST for deleting items in destructor.
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
screen->ExtractWires( oldWires, true );
|
screen->ExtractWires( oldWires, true );
|
||||||
screen->BreakSegment( screen->GetCrossHairPosition() );
|
screen->BreakSegment( GetCrossHairPosition() );
|
||||||
|
|
||||||
if( oldWires.GetCount() != 0 )
|
if( oldWires.GetCount() != 0 )
|
||||||
{
|
{
|
||||||
|
@ -344,7 +344,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
|
||||||
case ID_POPUP_SCH_ADD_JUNCTION:
|
case ID_POPUP_SCH_ADD_JUNCTION:
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
screen->SetCurItem( AddJunction( &dc, screen->GetCrossHairPosition(), true ) );
|
screen->SetCurItem( AddJunction( &dc, GetCrossHairPosition(), true ) );
|
||||||
screen->TestDanglingEnds( m_canvas, &dc );
|
screen->TestDanglingEnds( m_canvas, &dc );
|
||||||
screen->SetCurItem( NULL );
|
screen->SetCurItem( NULL );
|
||||||
break;
|
break;
|
||||||
|
@ -588,7 +588,7 @@ void SCH_EDIT_FRAME::DeleteConnection( bool aFullConnection )
|
||||||
{
|
{
|
||||||
PICKED_ITEMS_LIST pickList;
|
PICKED_ITEMS_LIST pickList;
|
||||||
SCH_SCREEN* screen = GetScreen();
|
SCH_SCREEN* screen = GetScreen();
|
||||||
wxPoint pos = screen->GetCrossHairPosition();
|
wxPoint pos = GetCrossHairPosition();
|
||||||
|
|
||||||
if( screen->GetConnection( pos, pickList, aFullConnection ) != 0 )
|
if( screen->GetConnection( pos, pickList, aFullConnection ) != 0 )
|
||||||
{
|
{
|
||||||
|
@ -603,7 +603,7 @@ bool SCH_EDIT_FRAME::DeleteItemAtCrossHair( wxDC* DC )
|
||||||
SCH_ITEM* item;
|
SCH_ITEM* item;
|
||||||
SCH_SCREEN* screen = GetScreen();
|
SCH_SCREEN* screen = GetScreen();
|
||||||
|
|
||||||
item = LocateItem( screen->GetCrossHairPosition(), SCH_COLLECTOR::ParentItems );
|
item = LocateItem( GetCrossHairPosition(), SCH_COLLECTOR::ParentItems );
|
||||||
|
|
||||||
if( item )
|
if( item )
|
||||||
{
|
{
|
||||||
|
@ -637,7 +637,7 @@ static void moveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPositio
|
||||||
item->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
|
item->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
item->SetPosition( screen->GetCrossHairPosition() );
|
item->SetPosition( aPanel->GetParent()->GetCrossHairPosition() );
|
||||||
|
|
||||||
// Draw the item item at it's new position.
|
// Draw the item item at it's new position.
|
||||||
item->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
|
item->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
|
||||||
|
@ -713,7 +713,7 @@ void SCH_EDIT_FRAME::MoveItem( SCH_ITEM* aItem, wxDC* aDC )
|
||||||
m_canvas->CrossHairOff( aDC );
|
m_canvas->CrossHairOff( aDC );
|
||||||
|
|
||||||
if( aItem->Type() != SCH_SHEET_PIN_T )
|
if( aItem->Type() != SCH_SHEET_PIN_T )
|
||||||
GetScreen()->SetCrossHairPosition( aItem->GetPosition() );
|
SetCrossHairPosition( aItem->GetPosition() );
|
||||||
|
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
|
|
||||||
|
@ -959,7 +959,7 @@ void SCH_EDIT_FRAME::OnDragItem( wxCommandEvent& aEvent )
|
||||||
// is to simulate a block drag command
|
// is to simulate a block drag command
|
||||||
if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK )
|
if( screen->m_BlockLocate.GetState() == STATE_NO_BLOCK )
|
||||||
{
|
{
|
||||||
if( !HandleBlockBegin( &dc, BLOCK_DRAG, screen->GetCrossHairPosition() ) )
|
if( !HandleBlockBegin( &dc, BLOCK_DRAG, GetCrossHairPosition() ) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Give a non null size to the search block:
|
// Give a non null size to the search block:
|
||||||
|
|
|
@ -501,7 +501,7 @@ double SCH_EDIT_FRAME::BestZoom()
|
||||||
|
|
||||||
double bestzoom = std::max( zx, zy );
|
double bestzoom = std::max( zx, zy );
|
||||||
|
|
||||||
GetScreen()->SetScrollCenterPosition( wxPoint( dx / 2, dy / 2 ) );
|
SetScrollCenterPosition( wxPoint( dx / 2, dy / 2 ) );
|
||||||
|
|
||||||
return bestzoom;
|
return bestzoom;
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,8 +244,8 @@ static void MoveOrResizeSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
|
||||||
|
|
||||||
if( sheet->IsResized() )
|
if( sheet->IsResized() )
|
||||||
{
|
{
|
||||||
int width = screen->GetCrossHairPosition().x - sheet->GetPosition().x;
|
int width = aPanel->GetParent()->GetCrossHairPosition().x - sheet->GetPosition().x;
|
||||||
int height = screen->GetCrossHairPosition().y - sheet->GetPosition().y;
|
int height = aPanel->GetParent()->GetCrossHairPosition().y - sheet->GetPosition().y;
|
||||||
|
|
||||||
// If the sheet doesn't have any pins, clamp the minimum size to the default values.
|
// If the sheet doesn't have any pins, clamp the minimum size to the default values.
|
||||||
width = ( width < MIN_SHEET_WIDTH ) ? MIN_SHEET_WIDTH : width;
|
width = ( width < MIN_SHEET_WIDTH ) ? MIN_SHEET_WIDTH : width;
|
||||||
|
@ -263,12 +263,13 @@ static void MoveOrResizeSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
|
||||||
sheet->GetMinWidth() + gridSizeX : width;
|
sheet->GetMinWidth() + gridSizeX : width;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPoint grid = screen->GetNearestGridPosition( wxPoint( pos.x + width, pos.y + height ) );
|
wxPoint grid = aPanel->GetParent()->GetNearestGridPosition(
|
||||||
|
wxPoint( pos.x + width, pos.y + height ) );
|
||||||
sheet->Resize( wxSize( grid.x - pos.x, grid.y - pos.y ) );
|
sheet->Resize( wxSize( grid.x - pos.x, grid.y - pos.y ) );
|
||||||
}
|
}
|
||||||
else if( sheet->IsMoving() )
|
else if( sheet->IsMoving() )
|
||||||
{
|
{
|
||||||
moveVector = screen->GetCrossHairPosition() - pos;
|
moveVector = aPanel->GetParent()->GetCrossHairPosition() - pos;
|
||||||
sheet->Move( moveVector );
|
sheet->Move( moveVector );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,7 +325,7 @@ SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC )
|
||||||
{
|
{
|
||||||
m_itemToRepeat = NULL;
|
m_itemToRepeat = NULL;
|
||||||
|
|
||||||
SCH_SHEET* sheet = new SCH_SHEET( GetScreen()->GetCrossHairPosition() );
|
SCH_SHEET* sheet = new SCH_SHEET( GetCrossHairPosition() );
|
||||||
|
|
||||||
sheet->SetFlags( IS_NEW | IS_RESIZED );
|
sheet->SetFlags( IS_NEW | IS_RESIZED );
|
||||||
sheet->SetTimeStamp( GetNewTimeStamp() );
|
sheet->SetTimeStamp( GetNewTimeStamp() );
|
||||||
|
@ -338,7 +339,9 @@ SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC )
|
||||||
m_canvas->SetMouseCapture( MoveOrResizeSheet, ExitSheet );
|
m_canvas->SetMouseCapture( MoveOrResizeSheet, ExitSheet );
|
||||||
m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
|
m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
|
||||||
m_canvas->CrossHairOff( aDC );
|
m_canvas->CrossHairOff( aDC );
|
||||||
GetScreen()->SetCrossHairPosition( sheet->GetResizePosition() );
|
|
||||||
|
SetCrossHairPosition( sheet->GetResizePosition() );
|
||||||
|
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
m_canvas->CrossHairOn( aDC );
|
m_canvas->CrossHairOn( aDC );
|
||||||
|
|
||||||
|
@ -356,7 +359,7 @@ void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC )
|
||||||
GetChars( aSheet->GetClass() ) ) );
|
GetChars( aSheet->GetClass() ) ) );
|
||||||
|
|
||||||
m_canvas->CrossHairOff( aDC );
|
m_canvas->CrossHairOff( aDC );
|
||||||
GetScreen()->SetCrossHairPosition( aSheet->GetResizePosition() );
|
SetCrossHairPosition( aSheet->GetResizePosition() );
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
m_canvas->CrossHairOn( aDC );
|
m_canvas->CrossHairOn( aDC );
|
||||||
|
|
||||||
|
@ -377,7 +380,7 @@ void SCH_EDIT_FRAME::StartMoveSheet( SCH_SHEET* aSheet, wxDC* aDC )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_canvas->CrossHairOff( aDC );
|
m_canvas->CrossHairOff( aDC );
|
||||||
GetScreen()->SetCrossHairPosition( aSheet->GetPosition() );
|
SetCrossHairPosition( aSheet->GetPosition() );
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
|
|
||||||
if( !aSheet->IsNew() )
|
if( !aSheet->IsNew() )
|
||||||
|
|
|
@ -136,7 +136,7 @@ static void AbortSymbolTraceOn( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool newItem = item->IsNew();
|
bool newItem = item->IsNew();
|
||||||
item->EndEdit( parent->GetScreen()->GetCrossHairPosition( true ), true );
|
item->EndEdit( parent->GetCrossHairPosition( true ), true );
|
||||||
|
|
||||||
if( newItem )
|
if( newItem )
|
||||||
{
|
{
|
||||||
|
@ -153,7 +153,7 @@ static void AbortSymbolTraceOn( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
||||||
LIB_ITEM* LIB_EDIT_FRAME::CreateGraphicItem( LIB_COMPONENT* LibEntry, wxDC* DC )
|
LIB_ITEM* LIB_EDIT_FRAME::CreateGraphicItem( LIB_COMPONENT* LibEntry, wxDC* DC )
|
||||||
{
|
{
|
||||||
m_canvas->SetMouseCapture( SymbolDisplayDraw, AbortSymbolTraceOn );
|
m_canvas->SetMouseCapture( SymbolDisplayDraw, AbortSymbolTraceOn );
|
||||||
wxPoint drawPos = GetScreen()->GetCrossHairPosition( true );
|
wxPoint drawPos = GetCrossHairPosition( true );
|
||||||
|
|
||||||
// no temp copy -> the current version of component will be used for Undo
|
// no temp copy -> the current version of component will be used for Undo
|
||||||
// This is normal when adding new items to the current component
|
// This is normal when adding new items to the current component
|
||||||
|
@ -239,7 +239,7 @@ void LIB_EDIT_FRAME::GraphicItemBeginDraw( wxDC* DC )
|
||||||
if( m_drawItem == NULL )
|
if( m_drawItem == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxPoint pos = GetScreen()->GetCrossHairPosition( true );
|
wxPoint pos = GetCrossHairPosition( true );
|
||||||
|
|
||||||
if( m_drawItem->ContinueEdit( pos ) )
|
if( m_drawItem->ContinueEdit( pos ) )
|
||||||
{
|
{
|
||||||
|
@ -264,21 +264,20 @@ static void RedrawWhileMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
|
||||||
if( item == NULL )
|
if( item == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BASE_SCREEN* Screen = aPanel->GetScreen();
|
|
||||||
|
|
||||||
item->SetEraseLastDrawItem( aErase );
|
item->SetEraseLastDrawItem( aErase );
|
||||||
|
|
||||||
// if item is the reference field, we must add the current unit id
|
// if item is the reference field, we must add the current unit id
|
||||||
if( item->Type() == LIB_FIELD_T )
|
if( item->Type() == LIB_FIELD_T )
|
||||||
{
|
{
|
||||||
int unit = ((LIB_EDIT_FRAME*)aPanel->GetParent())->GetUnit();
|
int unit = ((LIB_EDIT_FRAME*)aPanel->GetParent())->GetUnit();
|
||||||
wxString text = ((LIB_FIELD*)item)->GetFullText( unit );
|
wxString text = ((LIB_FIELD*)item)->GetFullText( unit );
|
||||||
item->Draw( aPanel, aDC, Screen->GetCrossHairPosition( true ),
|
|
||||||
|
item->Draw( aPanel, aDC, aPanel->GetParent()->GetCrossHairPosition( true ),
|
||||||
UNSPECIFIED_COLOR, g_XorMode, &text,
|
UNSPECIFIED_COLOR, g_XorMode, &text,
|
||||||
DefaultTransform );
|
DefaultTransform );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
item->Draw( aPanel, aDC, Screen->GetCrossHairPosition( true ),
|
item->Draw( aPanel, aDC, aPanel->GetParent()->GetCrossHairPosition( true ),
|
||||||
UNSPECIFIED_COLOR, g_XorMode, NULL,
|
UNSPECIFIED_COLOR, g_XorMode, NULL,
|
||||||
DefaultTransform );
|
DefaultTransform );
|
||||||
}
|
}
|
||||||
|
@ -298,7 +297,7 @@ void LIB_EDIT_FRAME::StartMoveDrawSymbol( wxDC* DC )
|
||||||
if( m_drawItem->Type() == LIB_FIELD_T )
|
if( m_drawItem->Type() == LIB_FIELD_T )
|
||||||
m_drawItem->BeginEdit( IS_MOVED, m_drawItem->GetPosition() );
|
m_drawItem->BeginEdit( IS_MOVED, m_drawItem->GetPosition() );
|
||||||
else
|
else
|
||||||
m_drawItem->BeginEdit( IS_MOVED, GetScreen()->GetCrossHairPosition( true ) );
|
m_drawItem->BeginEdit( IS_MOVED, GetCrossHairPosition( true ) );
|
||||||
|
|
||||||
m_canvas->SetMouseCapture( RedrawWhileMovingCursor, AbortSymbolTraceOn );
|
m_canvas->SetMouseCapture( RedrawWhileMovingCursor, AbortSymbolTraceOn );
|
||||||
m_canvas->CallMouseCapture( DC, wxDefaultPosition, true );
|
m_canvas->CallMouseCapture( DC, wxDefaultPosition, true );
|
||||||
|
@ -312,7 +311,7 @@ void LIB_EDIT_FRAME::StartModifyDrawSymbol( wxDC* DC )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TempCopyComponent();
|
TempCopyComponent();
|
||||||
m_drawItem->BeginEdit( IS_RESIZED, GetScreen()->GetCrossHairPosition( true ) );
|
m_drawItem->BeginEdit( IS_RESIZED, GetCrossHairPosition( true ) );
|
||||||
m_canvas->SetMouseCapture( SymbolDisplayDraw, AbortSymbolTraceOn );
|
m_canvas->SetMouseCapture( SymbolDisplayDraw, AbortSymbolTraceOn );
|
||||||
m_canvas->CallMouseCapture( DC, wxDefaultPosition, true );
|
m_canvas->CallMouseCapture( DC, wxDefaultPosition, true );
|
||||||
}
|
}
|
||||||
|
@ -322,14 +321,13 @@ void LIB_EDIT_FRAME::StartModifyDrawSymbol( wxDC* DC )
|
||||||
static void SymbolDisplayDraw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
static void SymbolDisplayDraw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
||||||
bool aErase )
|
bool aErase )
|
||||||
{
|
{
|
||||||
BASE_SCREEN* Screen = aPanel->GetScreen();
|
|
||||||
LIB_ITEM* item = ( (LIB_EDIT_FRAME*) aPanel->GetParent() )->GetDrawItem();
|
LIB_ITEM* item = ( (LIB_EDIT_FRAME*) aPanel->GetParent() )->GetDrawItem();
|
||||||
|
|
||||||
if( item == NULL )
|
if( item == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
item->SetEraseLastDrawItem( aErase );
|
item->SetEraseLastDrawItem( aErase );
|
||||||
item->Draw( aPanel, aDC, Screen->GetCrossHairPosition( true ), UNSPECIFIED_COLOR, g_XorMode, NULL,
|
item->Draw( aPanel, aDC, aPanel->GetParent()->GetCrossHairPosition( true ), UNSPECIFIED_COLOR, g_XorMode, NULL,
|
||||||
DefaultTransform );
|
DefaultTransform );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,7 +355,7 @@ void LIB_EDIT_FRAME::EndDrawGraphicItem( wxDC* DC )
|
||||||
if( m_drawItem->IsNew() )
|
if( m_drawItem->IsNew() )
|
||||||
m_component->AddDrawItem( m_drawItem );
|
m_component->AddDrawItem( m_drawItem );
|
||||||
|
|
||||||
m_drawItem->EndEdit( GetScreen()->GetCrossHairPosition( true ) );
|
m_drawItem->EndEdit( GetCrossHairPosition( true ) );
|
||||||
|
|
||||||
m_drawItem = NULL;
|
m_drawItem = NULL;
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ void LIB_EDIT_FRAME::LoadOneSymbol()
|
||||||
if( dlg.ShowModal() == wxID_CANCEL )
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
|
SetCrossHairPosition( wxPoint( 0, 0 ) );
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
m_canvas->SetIgnoreMouseEvents( false );
|
m_canvas->SetIgnoreMouseEvents( false );
|
||||||
|
|
||||||
|
@ -238,7 +238,9 @@ void LIB_EDIT_FRAME::PlaceAnchor()
|
||||||
if( m_component == NULL )
|
if( m_component == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxPoint offset( -GetScreen()->GetCrossHairPosition().x, GetScreen()->GetCrossHairPosition().y );
|
const wxPoint& cross_hair = GetCrossHairPosition();
|
||||||
|
|
||||||
|
wxPoint offset( -cross_hair.x, cross_hair.y );
|
||||||
|
|
||||||
OnModify( );
|
OnModify( );
|
||||||
|
|
||||||
|
|
|
@ -335,7 +335,7 @@ void LIB_VIEW_FRAME::OnSize( wxSizeEvent& SizeEv )
|
||||||
|
|
||||||
void LIB_VIEW_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
|
void LIB_VIEW_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
|
GetScreen()->m_O_Curseur = GetCrossHairPosition();
|
||||||
UpdateStatusBar();
|
UpdateStatusBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,18 +348,16 @@ double LIB_VIEW_FRAME::BestZoom()
|
||||||
* search for line static const int VIEWPORT_EXTENT = 1000;
|
* search for line static const int VIEWPORT_EXTENT = 1000;
|
||||||
* and replace by static const int VIEWPORT_EXTENT = 10000;
|
* and replace by static const int VIEWPORT_EXTENT = 10000;
|
||||||
*/
|
*/
|
||||||
LIB_COMPONENT* component = NULL;
|
LIB_COMPONENT* component = NULL;
|
||||||
CMP_LIBRARY* lib;
|
double bestzoom = 16.0; // default value for bestzoom
|
||||||
double bestzoom = 16.0; // default value for bestzoom
|
CMP_LIBRARY* lib = CMP_LIBRARY::FindLibrary( m_libraryName );
|
||||||
|
|
||||||
lib = CMP_LIBRARY::FindLibrary( m_libraryName );
|
|
||||||
|
|
||||||
if( lib )
|
if( lib )
|
||||||
component = lib->FindComponent( m_entryName );
|
component = lib->FindComponent( m_entryName );
|
||||||
|
|
||||||
if( component == NULL )
|
if( component == NULL )
|
||||||
{
|
{
|
||||||
GetScreen()->SetScrollCenterPosition( wxPoint( 0, 0 ) );
|
SetScrollCenterPosition( wxPoint( 0, 0 ) );
|
||||||
return bestzoom;
|
return bestzoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -382,7 +380,7 @@ double LIB_VIEW_FRAME::BestZoom()
|
||||||
if( bestzoom < GetScreen()->m_ZoomList[0] )
|
if( bestzoom < GetScreen()->m_ZoomList[0] )
|
||||||
bestzoom = GetScreen()->m_ZoomList[0];
|
bestzoom = GetScreen()->m_ZoomList[0];
|
||||||
|
|
||||||
GetScreen()->SetScrollCenterPosition( BoundaryBox.Centre() );
|
SetScrollCenterPosition( BoundaryBox.Centre() );
|
||||||
|
|
||||||
return bestzoom;
|
return bestzoom;
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,10 +171,11 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
|
||||||
|
|
||||||
if( screen->m_BlockLocate.GetState() != STATE_BLOCK_STOP )
|
if( screen->m_BlockLocate.GetState() != STATE_BLOCK_STOP )
|
||||||
{
|
{
|
||||||
screen->m_BlockLocate.SetMoveVector( wxPoint( screen->GetCrossHairPosition().x -
|
const wxPoint& cross_hair = aPanel->GetParent()->GetCrossHairPosition();
|
||||||
screen->m_BlockLocate.GetRight(),
|
|
||||||
screen->GetCrossHairPosition().y -
|
screen->m_BlockLocate.SetMoveVector(
|
||||||
screen->m_BlockLocate.GetBottom() ) );
|
wxPoint( cross_hair.x - screen->m_BlockLocate.GetRight(),
|
||||||
|
cross_hair.y - screen->m_BlockLocate.GetBottom() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
screen->m_BlockLocate.Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, Color );
|
screen->m_BlockLocate.Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, Color );
|
||||||
|
@ -195,10 +196,10 @@ void GERBVIEW_FRAME::Block_Move( wxDC* DC )
|
||||||
wxPoint delta;
|
wxPoint delta;
|
||||||
wxPoint oldpos;
|
wxPoint oldpos;
|
||||||
|
|
||||||
oldpos = GetScreen()->GetCrossHairPosition();
|
oldpos = GetCrossHairPosition();
|
||||||
m_canvas->SetMouseCaptureCallback( NULL );
|
m_canvas->SetMouseCaptureCallback( NULL );
|
||||||
|
|
||||||
GetScreen()->SetCrossHairPosition( oldpos );
|
SetCrossHairPosition( oldpos );
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
GetScreen()->m_BlockLocate.Normalize();
|
GetScreen()->m_BlockLocate.Normalize();
|
||||||
|
|
|
@ -38,12 +38,12 @@ public:
|
||||||
const PAGE_INFO& GetPageSettings() const { return m_paper; }
|
const PAGE_INFO& GetPageSettings() const { return m_paper; }
|
||||||
void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
|
void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
|
||||||
|
|
||||||
const wxPoint& GetOriginAxisPosition() const
|
const wxPoint& GetAuxOrigin() const
|
||||||
{
|
{
|
||||||
return m_originAxisPosition;
|
return m_originAxisPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetOriginAxisPosition( const wxPoint& aPosition )
|
void SetAuxOrigin( const wxPoint& aPosition )
|
||||||
{
|
{
|
||||||
m_originAxisPosition = aPosition;
|
m_originAxisPosition = aPosition;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,9 +38,9 @@ void GERBVIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
|
||||||
wxPoint oldpos;
|
wxPoint oldpos;
|
||||||
wxPoint pos = aPosition;
|
wxPoint pos = aPosition;
|
||||||
|
|
||||||
pos = GetScreen()->GetNearestGridPosition( pos );
|
pos = GetNearestGridPosition( pos );
|
||||||
|
|
||||||
oldpos = GetScreen()->GetCrossHairPosition();
|
oldpos = GetCrossHairPosition();
|
||||||
gridSize = GetScreen()->GetGridSize();
|
gridSize = GetScreen()->GetGridSize();
|
||||||
|
|
||||||
switch( aHotKey )
|
switch( aHotKey )
|
||||||
|
@ -73,14 +73,14 @@ void GERBVIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetScreen()->SetCrossHairPosition( pos );
|
SetCrossHairPosition( pos );
|
||||||
|
|
||||||
if( oldpos != GetScreen()->GetCrossHairPosition() )
|
if( oldpos != GetCrossHairPosition() )
|
||||||
{
|
{
|
||||||
pos = GetScreen()->GetCrossHairPosition();
|
pos = GetCrossHairPosition();
|
||||||
GetScreen()->SetCrossHairPosition( oldpos );
|
SetCrossHairPosition( oldpos );
|
||||||
m_canvas->CrossHairOff( aDC );
|
m_canvas->CrossHairOff( aDC );
|
||||||
GetScreen()->SetCrossHairPosition( pos );
|
SetCrossHairPosition( pos );
|
||||||
m_canvas->CrossHairOn( aDC );
|
m_canvas->CrossHairOn( aDC );
|
||||||
|
|
||||||
if( m_canvas->IsMouseCaptured() )
|
if( m_canvas->IsMouseCaptured() )
|
||||||
|
|
|
@ -196,7 +196,7 @@ double GERBVIEW_FRAME::BestZoom()
|
||||||
|
|
||||||
double x = (double) bbox.GetWidth() / (double) size.x;
|
double x = (double) bbox.GetWidth() / (double) size.x;
|
||||||
double y = (double) bbox.GetHeight() / (double) size.y;
|
double y = (double) bbox.GetHeight() / (double) size.y;
|
||||||
GetScreen()->SetScrollCenterPosition( bbox.Centre() );
|
SetScrollCenterPosition( bbox.Centre() );
|
||||||
|
|
||||||
double best_zoom = std::max( x, y );
|
double best_zoom = std::max( x, y );
|
||||||
return best_zoom;
|
return best_zoom;
|
||||||
|
@ -733,17 +733,17 @@ void GERBVIEW_FRAME::SetTitleBlock( const TITLE_BLOCK& aTitleBlock )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const wxPoint& GERBVIEW_FRAME::GetOriginAxisPosition() const
|
const wxPoint& GERBVIEW_FRAME::GetAuxOrigin() const
|
||||||
{
|
{
|
||||||
wxASSERT( m_gerberLayout );
|
wxASSERT( m_gerberLayout );
|
||||||
return m_gerberLayout->GetOriginAxisPosition();
|
return m_gerberLayout->GetAuxOrigin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GERBVIEW_FRAME::SetOriginAxisPosition( const wxPoint& aPosition )
|
void GERBVIEW_FRAME::SetAuxOrigin( const wxPoint& aPosition )
|
||||||
{
|
{
|
||||||
wxASSERT( m_gerberLayout );
|
wxASSERT( m_gerberLayout );
|
||||||
m_gerberLayout->SetOriginAxisPosition( aPosition );
|
m_gerberLayout->SetAuxOrigin( aPosition );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -800,8 +800,8 @@ void GERBVIEW_FRAME::UpdateStatusBar()
|
||||||
{
|
{
|
||||||
double theta, ro;
|
double theta, ro;
|
||||||
|
|
||||||
dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x;
|
dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
|
||||||
dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y;
|
dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
|
||||||
|
|
||||||
// atan2 in the 0,0 case returns 0
|
// atan2 in the 0,0 case returns 0
|
||||||
theta = RAD2DEG( atan2( -dy, dx ) );
|
theta = RAD2DEG( atan2( -dy, dx ) );
|
||||||
|
@ -829,9 +829,8 @@ void GERBVIEW_FRAME::UpdateStatusBar()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display absolute coordinates:
|
// Display absolute coordinates:
|
||||||
dXpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().x );
|
dXpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().x );
|
||||||
dYpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().y );
|
dYpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().y );
|
||||||
|
|
||||||
|
|
||||||
wxString absformatter;
|
wxString absformatter;
|
||||||
|
|
||||||
|
@ -859,8 +858,8 @@ void GERBVIEW_FRAME::UpdateStatusBar()
|
||||||
if( !m_DisplayOptions.m_DisplayPolarCood ) // display relative cartesian coordinates
|
if( !m_DisplayOptions.m_DisplayPolarCood ) // display relative cartesian coordinates
|
||||||
{
|
{
|
||||||
// Display relative coordinates:
|
// Display relative coordinates:
|
||||||
dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x;
|
dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
|
||||||
dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y;
|
dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
|
||||||
dXpos = To_User_Unit( g_UserUnit, dx );
|
dXpos = To_User_Unit( g_UserUnit, dx );
|
||||||
dYpos = To_User_Unit( g_UserUnit, dy );
|
dYpos = To_User_Unit( g_UserUnit, dy );
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,9 @@ public:
|
||||||
|
|
||||||
class GERBVIEW_FRAME : public EDA_DRAW_FRAME // PCB_BASE_FRAME
|
class GERBVIEW_FRAME : public EDA_DRAW_FRAME // PCB_BASE_FRAME
|
||||||
{
|
{
|
||||||
GBR_LAYOUT* m_gerberLayout;
|
GBR_LAYOUT* m_gerberLayout;
|
||||||
|
wxPoint m_grid_origin;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GBR_DISPLAY_OPTIONS m_DisplayOptions;
|
GBR_DISPLAY_OPTIONS m_DisplayOptions;
|
||||||
|
|
||||||
|
@ -126,8 +128,14 @@ public:
|
||||||
const PAGE_INFO& GetPageSettings() const; // overload
|
const PAGE_INFO& GetPageSettings() const; // overload
|
||||||
const wxSize GetPageSizeIU() const; // overload
|
const wxSize GetPageSizeIU() const; // overload
|
||||||
|
|
||||||
const wxPoint& GetOriginAxisPosition() const; // overload
|
const wxPoint& GetAuxOrigin() const; // overload
|
||||||
void SetOriginAxisPosition( const wxPoint& aPosition ); // overload
|
void SetAuxOrigin( const wxPoint& aPoint ); // overload
|
||||||
|
|
||||||
|
const wxPoint& GetGridOrigin() const { return m_grid_origin; } // overload
|
||||||
|
void SetGridOrigin( const wxPoint& aPoint ) // overload
|
||||||
|
{
|
||||||
|
m_grid_origin = aPoint;
|
||||||
|
}
|
||||||
|
|
||||||
const TITLE_BLOCK& GetTitleBlock() const; // overload
|
const TITLE_BLOCK& GetTitleBlock() const; // overload
|
||||||
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ); // overload
|
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ); // overload
|
||||||
|
|
|
@ -31,30 +31,28 @@
|
||||||
* and see this list for some ascii keys (space ...)
|
* and see this list for some ascii keys (space ...)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* local variables */
|
// local variables
|
||||||
/* Hotkey list: */
|
// Hotkey list:
|
||||||
static EDA_HOTKEY HkResetLocalCoord( wxT( "Reset Local Coordinates" ),
|
static EDA_HOTKEY HkResetLocalCoord( wxT( "Reset Local Coordinates" ), HK_RESET_LOCAL_COORD, ' ' );
|
||||||
HK_RESET_LOCAL_COORD, ' ' );
|
static EDA_HOTKEY HkSetGridOrigin( wxT("Set Grid Origin"), HK_SET_GRID_ORIGIN, 'S' );
|
||||||
static EDA_HOTKEY HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, WXK_HOME );
|
|
||||||
static EDA_HOTKEY HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 );
|
|
||||||
static EDA_HOTKEY HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 );
|
|
||||||
static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 );
|
|
||||||
static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 );
|
|
||||||
static EDA_HOTKEY HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' );
|
|
||||||
static EDA_HOTKEY HkSwitchUnits( wxT( "Switch Units" ), HK_SWITCH_UNITS, 'U' );
|
|
||||||
static EDA_HOTKEY HkTrackDisplayMode( wxT( "Track Display Mode" ),
|
|
||||||
HK_SWITCH_GBR_ITEMS_DISPLAY_MODE, 'F' );
|
|
||||||
|
|
||||||
static EDA_HOTKEY HkSwitch2NextCopperLayer( wxT( "Switch to Next Layer" ),
|
static EDA_HOTKEY HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, WXK_HOME );
|
||||||
HK_SWITCH_LAYER_TO_NEXT, '+' );
|
static EDA_HOTKEY HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 );
|
||||||
static EDA_HOTKEY HkSwitch2PreviousCopperLayer( wxT( "Switch to Previous Layer" ),
|
static EDA_HOTKEY HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 );
|
||||||
HK_SWITCH_LAYER_TO_PREVIOUS, '-' );
|
static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 );
|
||||||
|
static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 );
|
||||||
|
static EDA_HOTKEY HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' );
|
||||||
|
static EDA_HOTKEY HkSwitchUnits( wxT( "Switch Units" ), HK_SWITCH_UNITS, 'U' );
|
||||||
|
static EDA_HOTKEY HkTrackDisplayMode( wxT( "Track Display Mode" ), HK_SWITCH_GBR_ITEMS_DISPLAY_MODE, 'F' );
|
||||||
|
|
||||||
|
static EDA_HOTKEY HkSwitch2NextCopperLayer( wxT( "Switch to Next Layer" ), HK_SWITCH_LAYER_TO_NEXT, '+' );
|
||||||
|
static EDA_HOTKEY HkSwitch2PreviousCopperLayer( wxT( "Switch to Previous Layer" ), HK_SWITCH_LAYER_TO_PREVIOUS, '-' );
|
||||||
|
|
||||||
// List of common hotkey descriptors
|
// List of common hotkey descriptors
|
||||||
EDA_HOTKEY* s_Gerbview_Hotkey_List[] = {
|
EDA_HOTKEY* s_Gerbview_Hotkey_List[] = {
|
||||||
&HkHelp,
|
&HkHelp,
|
||||||
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
|
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
|
||||||
&HkZoomAuto, &HkSwitchUnits, &HkResetLocalCoord,
|
&HkZoomAuto, &HkSwitchUnits, &HkResetLocalCoord, &HkSetGridOrigin,
|
||||||
&HkTrackDisplayMode,
|
&HkTrackDisplayMode,
|
||||||
&HkSwitch2NextCopperLayer,
|
&HkSwitch2NextCopperLayer,
|
||||||
&HkSwitch2PreviousCopperLayer,
|
&HkSwitch2PreviousCopperLayer,
|
||||||
|
@ -130,8 +128,12 @@ void GERBVIEW_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
|
||||||
GetEventHandler()->ProcessEvent( cmd );
|
GetEventHandler()->ProcessEvent( cmd );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_RESET_LOCAL_COORD: /*Reset the relative coord */
|
case HK_RESET_LOCAL_COORD: // Reset the relative coord
|
||||||
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
|
GetScreen()->m_O_Curseur = GetCrossHairPosition();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HK_SET_GRID_ORIGIN:
|
||||||
|
SetGridOrigin( GetCrossHairPosition() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_SWITCH_UNITS:
|
case HK_SWITCH_UNITS:
|
||||||
|
|
|
@ -44,7 +44,7 @@ GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
if( aTypeloc == CURSEUR_ON_GRILLE )
|
if( aTypeloc == CURSEUR_ON_GRILLE )
|
||||||
ref = GetScreen()->GetNearestGridPosition( ref );
|
ref = GetNearestGridPosition( ref );
|
||||||
|
|
||||||
LAYER_NUM layer = getActiveLayer();
|
LAYER_NUM layer = getActiveLayer();
|
||||||
|
|
||||||
|
|
|
@ -75,53 +75,134 @@ typedef std::vector< GRID_TYPE > GRIDS;
|
||||||
class BASE_SCREEN : public EDA_ITEM
|
class BASE_SCREEN : public EDA_ITEM
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
GRIDS m_grids; ///< List of valid grid sizes.
|
GRIDS m_grids; ///< List of valid grid sizes.
|
||||||
bool m_FlagModified; ///< Indicates current drawing has been modified.
|
bool m_FlagModified; ///< Indicates current drawing has been modified.
|
||||||
bool m_FlagSave; ///< Indicates automatic file save.
|
bool m_FlagSave; ///< Indicates automatic file save.
|
||||||
EDA_ITEM* m_CurrentItem; ///< Currently selected object
|
EDA_ITEM* m_CurrentItem; ///< Currently selected object
|
||||||
GRID_TYPE m_Grid; ///< Current grid selection.
|
GRID_TYPE m_Grid; ///< Current grid selection.
|
||||||
wxPoint m_scrollCenter; ///< Current scroll center point in logical units.
|
wxPoint m_scrollCenter; ///< Current scroll center point in logical units.
|
||||||
wxPoint m_MousePosition; ///< Mouse cursor coordinate in logical units.
|
wxPoint m_MousePosition; ///< Mouse cursor coordinate in logical units.
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The cross hair position in logical (drawing) units. The cross hair is not the cursor
|
* The cross hair position in logical (drawing) units. The cross hair is not the cursor
|
||||||
* position. It is an addition indicator typically drawn on grid to indicate to the
|
* position. It is an addition indicator typically drawn on grid to indicate to the
|
||||||
* user where the current action will be performed.
|
* user where the current action will be performed.
|
||||||
*/
|
*/
|
||||||
wxPoint m_crossHairPosition;
|
wxPoint m_crossHairPosition;
|
||||||
|
|
||||||
double m_Zoom; ///< Current zoom coefficient.
|
double m_Zoom; ///< Current zoom coefficient.
|
||||||
|
|
||||||
|
//----< Old public API now is private, and migratory>------------------------
|
||||||
|
// called only from EDA_DRAW_FRAME
|
||||||
|
friend class EDA_DRAW_FRAME;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function getCrossHairPosition
|
||||||
|
* return the current cross hair position in logical (drawing) coordinates.
|
||||||
|
* @param aInvertY Inverts the Y axis position.
|
||||||
|
* @return The cross hair position in drawing coordinates.
|
||||||
|
*/
|
||||||
|
wxPoint getCrossHairPosition( bool aInvertY ) const
|
||||||
|
{
|
||||||
|
if( aInvertY )
|
||||||
|
return wxPoint( m_crossHairPosition.x, -m_crossHairPosition.y );
|
||||||
|
|
||||||
|
return wxPoint( m_crossHairPosition.x, m_crossHairPosition.y );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function setCrossHairPosition
|
||||||
|
* sets the screen cross hair position to \a aPosition in logical (drawing) units.
|
||||||
|
* @param aPosition The new cross hair position.
|
||||||
|
* @param aGridOrigin Origin point of the snap grid.
|
||||||
|
* @param aSnapToGrid Sets the cross hair position to the nearest grid position to
|
||||||
|
* \a aPosition.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void setCrossHairPosition( const wxPoint& aPosition, const wxPoint& aGridOrigin, bool aSnapToGrid );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function getCursorScreenPosition
|
||||||
|
* returns the cross hair position in device (display) units.b
|
||||||
|
* @return The current cross hair position.
|
||||||
|
*/
|
||||||
|
wxPoint getCrossHairScreenPosition() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function getNearestGridPosition
|
||||||
|
* returns the nearest \a aGridSize location to \a aPosition.
|
||||||
|
* @param aPosition The position to check.
|
||||||
|
* @param aGridOrigin The origin point of the snap grid.
|
||||||
|
* @param aGridSize The grid size to locate to if provided. If NULL then the current
|
||||||
|
* grid size is used.
|
||||||
|
* @return The nearst grid position.
|
||||||
|
*/
|
||||||
|
wxPoint getNearestGridPosition( const wxPoint& aPosition, const wxPoint& aGridOrigin,
|
||||||
|
wxRealPoint* aGridSize ) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function getCursorPosition
|
||||||
|
* returns the current cursor position in logical (drawing) units.
|
||||||
|
* @param aOnGrid Returns the nearest grid position at the current cursor position.
|
||||||
|
* @param aGridOrigin Origin point of the snap grid.
|
||||||
|
* @param aGridSize Custom grid size instead of the current grid size. Only valid
|
||||||
|
* if \a aOnGrid is true.
|
||||||
|
* @return The current cursor position.
|
||||||
|
*/
|
||||||
|
wxPoint getCursorPosition( bool aOnGrid, const wxPoint& aGridOrigin, wxRealPoint* aGridSize ) const;
|
||||||
|
|
||||||
|
void setMousePosition( const wxPoint& aPosition ) { m_MousePosition = aPosition; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function RefPos
|
||||||
|
* Return the reference position, coming from either the mouse position
|
||||||
|
* or the cursor position.
|
||||||
|
*
|
||||||
|
* @param useMouse If true, return mouse position, else cursor's.
|
||||||
|
*
|
||||||
|
* @return wxPoint - The reference point, either the mouse position or
|
||||||
|
* the cursor position.
|
||||||
|
*/
|
||||||
|
wxPoint refPos( bool useMouse ) const
|
||||||
|
{
|
||||||
|
return useMouse ? m_MousePosition : m_crossHairPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
const wxPoint& getScrollCenterPosition() const { return m_scrollCenter; }
|
||||||
|
void setScrollCenterPosition( const wxPoint& aPoint ) { m_scrollCenter = aPoint; }
|
||||||
|
|
||||||
|
//----</Old public API now is private, and migratory>------------------------
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static wxString m_PageLayoutDescrFileName; ///< the name of the page layout descr file,
|
static wxString m_PageLayoutDescrFileName; ///< the name of the page layout descr file,
|
||||||
///< or emty to used the default pagelayout
|
///< or emty to used the default pagelayout
|
||||||
wxPoint m_DrawOrg; ///< offsets for drawing the circuit on the screen
|
|
||||||
|
|
||||||
wxPoint m_O_Curseur; ///< Relative Screen cursor coordinate (on grid)
|
wxPoint m_DrawOrg; ///< offsets for drawing the circuit on the screen
|
||||||
///< in user units. (coordinates from last reset position)
|
|
||||||
|
wxPoint m_O_Curseur; ///< Relative Screen cursor coordinate (on grid)
|
||||||
|
///< in user units. (coordinates from last reset position)
|
||||||
|
|
||||||
// Scrollbars management:
|
// Scrollbars management:
|
||||||
int m_ScrollPixelsPerUnitX; ///< Pixels per scroll unit in the horizontal direction.
|
int m_ScrollPixelsPerUnitX; ///< Pixels per scroll unit in the horizontal direction.
|
||||||
int m_ScrollPixelsPerUnitY; ///< Pixels per scroll unit in the vertical direction.
|
int m_ScrollPixelsPerUnitY; ///< Pixels per scroll unit in the vertical direction.
|
||||||
|
|
||||||
wxSize m_ScrollbarNumber; /* Current virtual draw area size in scroll units.
|
wxSize m_ScrollbarNumber; /**< Current virtual draw area size in scroll units.
|
||||||
* m_ScrollbarNumber * m_ScrollPixelsPerUnit =
|
* m_ScrollbarNumber * m_ScrollPixelsPerUnit =
|
||||||
* virtual draw area size in pixels */
|
* virtual draw area size in pixels */
|
||||||
|
|
||||||
wxPoint m_ScrollbarPos; ///< Current scroll bar position in scroll units.
|
wxPoint m_ScrollbarPos; ///< Current scroll bar position in scroll units.
|
||||||
|
|
||||||
wxPoint m_StartVisu; /* Coordinates in drawing units of the current
|
wxPoint m_StartVisu; /**< Coordinates in drawing units of the current
|
||||||
* view position (upper left corner of device)
|
* view position (upper left corner of device)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool m_Center; /* Center on screen. If true (0.0) is centered
|
bool m_Center; /**< Center on screen. If true (0.0) is centered
|
||||||
* on screen coordinates can be < 0 and
|
* on screen coordinates can be < 0 and
|
||||||
* > 0 except for schematics.
|
* > 0 except for schematics.
|
||||||
* false: when coordinates can only be >= 0
|
* false: when coordinates can only be >= 0
|
||||||
* Schematic */
|
* Schematic */
|
||||||
bool m_FirstRedraw;
|
bool m_FirstRedraw;
|
||||||
|
|
||||||
// Undo/redo list of commands
|
// Undo/redo list of commands
|
||||||
UNDO_REDO_CONTAINER m_UndoList; ///< Objects list for the undo command (old data)
|
UNDO_REDO_CONTAINER m_UndoList; ///< Objects list for the undo command (old data)
|
||||||
|
@ -134,8 +215,6 @@ public:
|
||||||
int m_ScreenNumber;
|
int m_ScreenNumber;
|
||||||
int m_NumberOfScreens;
|
int m_NumberOfScreens;
|
||||||
|
|
||||||
wxPoint m_GridOrigin;
|
|
||||||
|
|
||||||
std::vector<double> m_ZoomList; ///< standard zoom (i.e. scale) coefficients.
|
std::vector<double> m_ZoomList; ///< standard zoom (i.e. scale) coefficients.
|
||||||
bool m_IsPrinting;
|
bool m_IsPrinting;
|
||||||
|
|
||||||
|
@ -164,30 +243,6 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual int MilsToIuScalar() { return 1; }
|
virtual int MilsToIuScalar() { return 1; }
|
||||||
|
|
||||||
/**
|
|
||||||
* Function GetCrossHairPosition
|
|
||||||
* return the current cross hair position in logical (drawing) coordinates.
|
|
||||||
* @param aInvertY Inverts the Y axis position.
|
|
||||||
* @return The cross hair position in drawing coordinates.
|
|
||||||
*/
|
|
||||||
wxPoint GetCrossHairPosition( bool aInvertY = false ) const
|
|
||||||
{
|
|
||||||
if( aInvertY )
|
|
||||||
return wxPoint( m_crossHairPosition.x, -m_crossHairPosition.y );
|
|
||||||
|
|
||||||
return wxPoint( m_crossHairPosition.x, m_crossHairPosition.y );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function SetCrossHairPosition
|
|
||||||
* sets the screen cross hair position to \a aPosition in logical (drawing) units.
|
|
||||||
* @param aPosition The new cross hair position.
|
|
||||||
* @param aSnapToGrid Sets the cross hair position to the nearest grid position to
|
|
||||||
* \a aPosition.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void SetCrossHairPosition( const wxPoint& aPosition, bool aSnapToGrid = true );
|
|
||||||
|
|
||||||
/* general Undo/Redo command control */
|
/* general Undo/Redo command control */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -247,19 +302,17 @@ public:
|
||||||
return m_UndoList.m_CommandsList.size();
|
return m_UndoList.m_CommandsList.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int GetRedoCommandCount() const
|
int GetRedoCommandCount() const
|
||||||
{
|
{
|
||||||
return m_RedoList.m_CommandsList.size();
|
return m_RedoList.m_CommandsList.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetModify() { m_FlagModified = true; }
|
||||||
void SetModify() { m_FlagModified = true; }
|
void ClrModify() { m_FlagModified = false; }
|
||||||
void ClrModify() { m_FlagModified = false;; }
|
void SetSave() { m_FlagSave = true; }
|
||||||
void SetSave() { m_FlagSave = true; }
|
void ClrSave() { m_FlagSave = false; }
|
||||||
void ClrSave() { m_FlagSave = false; }
|
bool IsModify() const { return m_FlagModified; }
|
||||||
bool IsModify() const { return m_FlagModified; }
|
bool IsSave() const { return m_FlagSave; }
|
||||||
bool IsSave() const { return m_FlagSave; }
|
|
||||||
|
|
||||||
|
|
||||||
//----<zoom stuff>---------------------------------------------------------
|
//----<zoom stuff>---------------------------------------------------------
|
||||||
|
@ -349,8 +402,6 @@ public:
|
||||||
*/
|
*/
|
||||||
const GRID_TYPE& GetGrid() const { return m_Grid; }
|
const GRID_TYPE& GetGrid() const { return m_Grid; }
|
||||||
|
|
||||||
const wxPoint& GetGridOrigin() const { return m_GridOrigin; }
|
|
||||||
|
|
||||||
void SetGrid( const wxRealPoint& size );
|
void SetGrid( const wxRealPoint& size );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -388,51 +439,6 @@ public:
|
||||||
*/
|
*/
|
||||||
void GetGrids( GRIDS& aList );
|
void GetGrids( GRIDS& aList );
|
||||||
|
|
||||||
void SetMousePosition( const wxPoint& aPosition ) { m_MousePosition = aPosition; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function RefPos
|
|
||||||
* Return the reference position, coming from either the mouse position
|
|
||||||
* or the cursor position.
|
|
||||||
*
|
|
||||||
* @param useMouse If true, return mouse position, else cursor's.
|
|
||||||
*
|
|
||||||
* @return wxPoint - The reference point, either the mouse position or
|
|
||||||
* the cursor position.
|
|
||||||
*/
|
|
||||||
wxPoint RefPos( bool useMouse ) const
|
|
||||||
{
|
|
||||||
return useMouse ? m_MousePosition : m_crossHairPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function GetCursorPosition
|
|
||||||
* returns the current cursor position in logical (drawing) units.
|
|
||||||
* @param aOnGrid Returns the nearest grid position at the current cursor position.
|
|
||||||
* @param aGridSize Custom grid size instead of the current grid size. Only valid
|
|
||||||
* if \a aOnGrid is true.
|
|
||||||
* @return The current cursor position.
|
|
||||||
*/
|
|
||||||
wxPoint GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize = NULL ) const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function GetCursorScreenPosition
|
|
||||||
* returns the cross hair position in device (display) units.b
|
|
||||||
* @return The current cross hair position.
|
|
||||||
*/
|
|
||||||
wxPoint GetCrossHairScreenPosition() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function GetNearestGridPosition
|
|
||||||
* returns the nearest \a aGridSize location to \a aPosition.
|
|
||||||
* @param aPosition The position to check.
|
|
||||||
* @param aGridSize The grid size to locate to if provided. If NULL then the current
|
|
||||||
* grid size is used.
|
|
||||||
* @return The nearst grid position.
|
|
||||||
*/
|
|
||||||
wxPoint GetNearestGridPosition( const wxPoint& aPosition,
|
|
||||||
wxRealPoint* aGridSize = NULL ) const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetClass
|
* Function GetClass
|
||||||
* returns the class name.
|
* returns the class name.
|
||||||
|
@ -447,12 +453,6 @@ public:
|
||||||
|
|
||||||
void ClearBlockCommand() { m_BlockLocate.Clear(); }
|
void ClearBlockCommand() { m_BlockLocate.Clear(); }
|
||||||
|
|
||||||
const wxPoint& GetScrollCenterPosition() const { return m_scrollCenter; }
|
|
||||||
void SetScrollCenterPosition( const wxPoint& aCenterPosition )
|
|
||||||
{
|
|
||||||
m_scrollCenter = aCenterPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
void Show( int nestLevel, std::ostream& os ) const; // overload
|
void Show( int nestLevel, std::ostream& os ) const; // overload
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -45,6 +45,8 @@ public:
|
||||||
wxSize m_ModuleTextSize; ///< Default footprint texts size
|
wxSize m_ModuleTextSize; ///< Default footprint texts size
|
||||||
int m_ModuleTextWidth;
|
int m_ModuleTextWidth;
|
||||||
int m_ModuleSegmentWidth;
|
int m_ModuleSegmentWidth;
|
||||||
|
wxPoint m_AuxOrigin; ///< origin for plot exports
|
||||||
|
wxPoint m_GridOrigin; ///< origin for grid offsets
|
||||||
|
|
||||||
D_PAD m_Pad_Master;
|
D_PAD m_Pad_Master;
|
||||||
|
|
||||||
|
|
|
@ -55,52 +55,55 @@ typedef void ( *END_MOUSE_CAPTURE_CALLBACK )( EDA_DRAW_PANEL* aPanel, wxDC* aDC
|
||||||
class EDA_DRAW_PANEL : public wxScrolledWindow
|
class EDA_DRAW_PANEL : public wxScrolledWindow
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
int m_currentCursor; ///< Current mouse cursor shape id.
|
int m_currentCursor; ///< Current mouse cursor shape id.
|
||||||
int m_defaultCursor; ///< The default mouse cursor shape id.
|
int m_defaultCursor; ///< The default mouse cursor shape id.
|
||||||
bool m_showCrossHair; ///< Indicate if cross hair is to be shown.
|
bool m_showCrossHair; ///< Indicate if cross hair is to be shown.
|
||||||
int m_cursorLevel; ///< Index for cursor redraw in XOR mode.
|
int m_cursorLevel; ///< Index for cursor redraw in XOR mode.
|
||||||
int m_scrollIncrementX; ///< X axis scroll increment in pixels per unit.
|
int m_scrollIncrementX; ///< X axis scroll increment in pixels per unit.
|
||||||
int m_scrollIncrementY; ///< Y axis scroll increment in pixels per unit.
|
int m_scrollIncrementY; ///< Y axis scroll increment in pixels per unit.
|
||||||
wxPoint m_CursorStartPos; ///< Used for testing the cursor movement.
|
|
||||||
wxPoint m_PanStartCenter; ///< Initial scroll center position when pan started
|
wxPoint m_CursorStartPos; ///< Used for testing the cursor movement.
|
||||||
wxPoint m_PanStartEventPosition; ///< Initial position of mouse event when pan started
|
wxPoint m_PanStartCenter; ///< Initial scroll center position when pan started
|
||||||
|
wxPoint m_PanStartEventPosition; ///< Initial position of mouse event when pan started
|
||||||
|
|
||||||
/// The drawing area used to redraw the screen which is usually the visible area
|
/// The drawing area used to redraw the screen which is usually the visible area
|
||||||
/// of the drawing in internal units.
|
/// of the drawing in internal units.
|
||||||
EDA_RECT m_ClipBox;
|
EDA_RECT m_ClipBox;
|
||||||
|
|
||||||
bool m_abortRequest; ///< Flag used to abort long commands.
|
bool m_abortRequest; ///< Flag used to abort long commands.
|
||||||
|
|
||||||
bool m_enableZoomNoCenter; ///< True to enable zooming around the crosshair instead of the center
|
bool m_enableZoomNoCenter; ///< True to enable zooming around the crosshair instead of the center
|
||||||
bool m_enableMiddleButtonPan; ///< True to enable middle mouse button panning.
|
bool m_enableMiddleButtonPan; ///< True to enable middle mouse button panning.
|
||||||
bool m_panScrollbarLimits; ///< has meaning only if m_enableMiddleButtonPan = true
|
bool m_panScrollbarLimits; ///< has meaning only if m_enableMiddleButtonPan = true
|
||||||
///< true to limit panning to scrollbar current limits
|
///< true to limit panning to scrollbar current limits
|
||||||
///< false to used unlimited pan
|
///< false to used unlimited pan
|
||||||
|
|
||||||
bool m_enableAutoPan; ///< True to enable automatic panning.
|
bool m_enableAutoPan; ///< True to enable automatic panning.
|
||||||
|
|
||||||
/// true to request an auto pan. Valid only when m_enableAutoPan = true.
|
bool m_requestAutoPan; ///< true to request an auto pan. Valid only when m_enableAutoPan = true.
|
||||||
bool m_requestAutoPan;
|
|
||||||
|
|
||||||
bool m_ignoreMouseEvents; ///< Ignore mouse events when true.
|
bool m_ignoreMouseEvents; ///< Ignore mouse events when true.
|
||||||
|
|
||||||
/* Used to inhibit a response to a mouse left button release, after a double click
|
/* Used to inhibit a response to a mouse left button release, after a double click
|
||||||
* (when releasing the left button at the end of the second click. Used in Eeschema
|
* (when releasing the left button at the end of the second click. Used in Eeschema
|
||||||
* to inhibit a mouse left release command when switching between hierarchical sheets
|
* to inhibit a mouse left release command when switching between hierarchical sheets
|
||||||
* on a double click.
|
* on a double click.
|
||||||
*/
|
*/
|
||||||
bool m_ignoreNextLeftButtonRelease; ///< Ignore the next mouse left button release when true.
|
bool m_ignoreNextLeftButtonRelease; ///< Ignore the next mouse left button release when true.
|
||||||
|
|
||||||
bool m_enableBlockCommands; ///< True enables block commands.
|
bool m_enableBlockCommands; ///< True enables block commands.
|
||||||
|
|
||||||
int m_minDragEventCount; /* Count the drag events. Used to filter mouse moves before starting a
|
/**
|
||||||
* block command. A block command can be started only if
|
* Count the drag events. Used to filter mouse moves before starting a
|
||||||
* MinDragEventCount > MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND
|
* block command. A block command can be started only if
|
||||||
* in order to avoid spurious block commands. */
|
* MinDragEventCount > MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND in order to avoid
|
||||||
|
* spurious block commands.
|
||||||
|
*/
|
||||||
|
int m_minDragEventCount;
|
||||||
|
|
||||||
/// True when drawing in mirror mode. Used by the draw arc function, because arcs
|
/// True when drawing in mirror mode. Used by the draw arc function, because arcs
|
||||||
/// are oriented, and in mirror mode, orientations are reversed.
|
/// are oriented, and in mirror mode, orientations are reversed.
|
||||||
bool m_PrintIsMirrored;
|
bool m_PrintIsMirrored;
|
||||||
|
|
||||||
/// Mouse capture move callback function.
|
/// Mouse capture move callback function.
|
||||||
MOUSE_CAPTURE_CALLBACK m_mouseCaptureCallback;
|
MOUSE_CAPTURE_CALLBACK m_mouseCaptureCallback;
|
||||||
|
@ -108,9 +111,10 @@ private:
|
||||||
/// Abort mouse capture callback function.
|
/// Abort mouse capture callback function.
|
||||||
END_MOUSE_CAPTURE_CALLBACK m_endMouseCaptureCallback;
|
END_MOUSE_CAPTURE_CALLBACK m_endMouseCaptureCallback;
|
||||||
|
|
||||||
// useful to avoid false start block in certain cases
|
/// useful to avoid false start block in certain cases
|
||||||
// (like switch from a sheet to an other sheet
|
/// (like switch from a sheet to an other sheet
|
||||||
int m_canStartBlock; // >= 0 (or >= n) if a block can start
|
/// >= 0 (or >= n) if a block can start
|
||||||
|
int m_canStartBlock;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -155,9 +159,8 @@ public:
|
||||||
|
|
||||||
void SetEnableBlockCommands( bool aEnable ) { m_enableBlockCommands = aEnable; }
|
void SetEnableBlockCommands( bool aEnable ) { m_enableBlockCommands = aEnable; }
|
||||||
|
|
||||||
bool GetPrintMirrored() const { return m_PrintIsMirrored; }
|
bool GetPrintMirrored() const { return m_PrintIsMirrored; }
|
||||||
|
void SetPrintMirrored( bool aMirror ) { m_PrintIsMirrored = aMirror; }
|
||||||
void SetPrintMirrored( bool aMirror ) { m_PrintIsMirrored = aMirror; }
|
|
||||||
|
|
||||||
void SetCanStartBlock( int aStartBlock ) { m_canStartBlock = aStartBlock; }
|
void SetCanStartBlock( int aStartBlock ) { m_canStartBlock = aStartBlock; }
|
||||||
|
|
||||||
|
@ -196,8 +199,9 @@ public:
|
||||||
* the grid origin is set by user, and is not (0,0)
|
* the grid origin is set by user, and is not (0,0)
|
||||||
* @param aDC = current Device Context
|
* @param aDC = current Device Context
|
||||||
* @param aDrawMode = draw mode (GR_COPY, GR_OR ..)
|
* @param aDrawMode = draw mode (GR_COPY, GR_OR ..)
|
||||||
|
* @param aGridOrigin = the absolute coordinate of grid origin for snap.
|
||||||
*/
|
*/
|
||||||
void DrawGridAxis( wxDC* aDC, GR_DRAWMODE aDrawMode );
|
void DrawGridAxis( wxDC* aDC, GR_DRAWMODE aDrawMode, const wxPoint& aGridOrigin );
|
||||||
|
|
||||||
void OnEraseBackground( wxEraseEvent& event ) { }
|
void OnEraseBackground( wxEraseEvent& event ) { }
|
||||||
|
|
||||||
|
@ -324,7 +328,7 @@ public:
|
||||||
* warps the cursor to the current cross hair position.
|
* warps the cursor to the current cross hair position.
|
||||||
*/
|
*/
|
||||||
void MoveCursorToCrossHair();
|
void MoveCursorToCrossHair();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ToDeviceXY
|
* Function ToDeviceXY
|
||||||
* transforms logical to device coordinates
|
* transforms logical to device coordinates
|
||||||
|
|
|
@ -73,8 +73,8 @@ private:
|
||||||
|
|
||||||
TITLE_BLOCK m_titles;
|
TITLE_BLOCK m_titles;
|
||||||
|
|
||||||
/// Position of the origin axis, which is used in exports mostly, but not yet in EESCHEMA
|
/// Origin of the auxilliary axis, which is used in exports mostly, but not yet in EESCHEMA
|
||||||
wxPoint m_originAxisPosition;
|
wxPoint m_aux_origin;
|
||||||
|
|
||||||
DLIST< SCH_ITEM > m_drawList; ///< Object list for the screen.
|
DLIST< SCH_ITEM > m_drawList; ///< Object list for the screen.
|
||||||
/// @todo use DLIST<SCH_ITEM> or superior container
|
/// @todo use DLIST<SCH_ITEM> or superior container
|
||||||
|
@ -108,12 +108,12 @@ public:
|
||||||
const PAGE_INFO& GetPageSettings() const { return m_paper; }
|
const PAGE_INFO& GetPageSettings() const { return m_paper; }
|
||||||
void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
|
void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
|
||||||
|
|
||||||
void SetFileName( const wxString& aFileName ) { m_fileName = aFileName; }
|
void SetFileName( const wxString& aFileName ) { m_fileName = aFileName; }
|
||||||
|
|
||||||
const wxString& GetFileName() const { return m_fileName; }
|
const wxString& GetFileName() const { return m_fileName; }
|
||||||
|
|
||||||
const wxPoint& GetOriginAxisPosition() const { return m_originAxisPosition; }
|
const wxPoint& GetAuxOrigin() const { return m_aux_origin; }
|
||||||
void SetOriginAxisPosition( const wxPoint& aPosition ) { m_originAxisPosition = aPosition; }
|
void SetAuxOrigin( const wxPoint& aPosition ) { m_aux_origin = aPosition; }
|
||||||
|
|
||||||
const TITLE_BLOCK& GetTitleBlock() const { return m_titles; }
|
const TITLE_BLOCK& GetTitleBlock() const { return m_titles; }
|
||||||
//TITLE_BLOCK& GetTitleBlock() const { return (TITLE_BLOCK&) m_titles; }
|
//TITLE_BLOCK& GetTitleBlock() const { return (TITLE_BLOCK&) m_titles; }
|
||||||
|
|
|
@ -217,6 +217,8 @@ void ParseHotkeyConfig( const wxString& data, struct EDA_HOTKEY_CONFIG* aDescLis
|
||||||
enum common_hotkey_id_commnand {
|
enum common_hotkey_id_commnand {
|
||||||
HK_NOT_FOUND = 0,
|
HK_NOT_FOUND = 0,
|
||||||
HK_RESET_LOCAL_COORD,
|
HK_RESET_LOCAL_COORD,
|
||||||
|
HK_SET_GRID_ORIGIN,
|
||||||
|
HK_RESET_GRID_ORIGIN,
|
||||||
HK_HELP,
|
HK_HELP,
|
||||||
HK_ZOOM_IN,
|
HK_ZOOM_IN,
|
||||||
HK_ZOOM_OUT,
|
HK_ZOOM_OUT,
|
||||||
|
|
|
@ -58,8 +58,15 @@ public:
|
||||||
const PAGE_INFO& GetPageSettings () const; // overload EDA_DRAW_FRAME
|
const PAGE_INFO& GetPageSettings () const; // overload EDA_DRAW_FRAME
|
||||||
const wxSize GetPageSizeIU() const; // overload EDA_DRAW_FRAME
|
const wxSize GetPageSizeIU() const; // overload EDA_DRAW_FRAME
|
||||||
|
|
||||||
const wxPoint& GetOriginAxisPosition() const; // overload EDA_DRAW_FRAME
|
const wxPoint& GetAuxOrigin() const; // overload EDA_DRAW_FRAME
|
||||||
void SetOriginAxisPosition( const wxPoint& aPosition ); // overload EDA_DRAW_FRAME
|
void SetAuxOrigin( const wxPoint& aPosition ); // overload EDA_DRAW_FRAME
|
||||||
|
|
||||||
|
const wxPoint& GetGridOrigin() const // overload EDA_DRAW_FRAME
|
||||||
|
{
|
||||||
|
static wxPoint zero;
|
||||||
|
return zero;
|
||||||
|
}
|
||||||
|
void SetGridOrigin( const wxPoint& aPoint ) {} // overload EDA_DRAW_FRAME
|
||||||
|
|
||||||
const TITLE_BLOCK& GetTitleBlock() const; // overload EDA_DRAW_FRAME
|
const TITLE_BLOCK& GetTitleBlock() const; // overload EDA_DRAW_FRAME
|
||||||
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ); // overload EDA_DRAW_FRAME
|
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ); // overload EDA_DRAW_FRAME
|
||||||
|
|
|
@ -131,8 +131,11 @@ public:
|
||||||
const PAGE_INFO& GetPageSettings() const; // overload
|
const PAGE_INFO& GetPageSettings() const; // overload
|
||||||
const wxSize GetPageSizeIU() const; // overload
|
const wxSize GetPageSizeIU() const; // overload
|
||||||
|
|
||||||
const wxPoint& GetOriginAxisPosition() const; // overload
|
const wxPoint& GetAuxOrigin() const; // overload
|
||||||
void SetOriginAxisPosition( const wxPoint& aPosition ); // overload
|
void SetAuxOrigin( const wxPoint& aPoint ); // overload
|
||||||
|
|
||||||
|
const wxPoint& GetGridOrigin() const; // overload
|
||||||
|
void SetGridOrigin( const wxPoint& aPoint ); // overload
|
||||||
|
|
||||||
const TITLE_BLOCK& GetTitleBlock() const; // overload
|
const TITLE_BLOCK& GetTitleBlock() const; // overload
|
||||||
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ); // overload
|
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ); // overload
|
||||||
|
|
|
@ -114,15 +114,15 @@ extern const wxChar* traceAutoSave;
|
||||||
class EDA_BASE_FRAME : public wxFrame
|
class EDA_BASE_FRAME : public wxFrame
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
ID_DRAWFRAME_TYPE m_Ident; // Id Type (pcb, schematic, library..)
|
ID_DRAWFRAME_TYPE m_Ident; ///< Id Type (pcb, schematic, library..)
|
||||||
wxPoint m_FramePos;
|
wxPoint m_FramePos;
|
||||||
wxSize m_FrameSize;
|
wxSize m_FrameSize;
|
||||||
|
|
||||||
wxAuiToolBar* m_mainToolBar; // Standard horizontal Toolbar
|
wxAuiToolBar* m_mainToolBar; ///< Standard horizontal Toolbar
|
||||||
bool m_FrameIsActive;
|
bool m_FrameIsActive;
|
||||||
wxString m_FrameName; // name used for writing and reading setup
|
wxString m_FrameName; ///< name used for writing and reading setup
|
||||||
// It is "SchematicFrame", "PcbFrame" ....
|
///< It is "SchematicFrame", "PcbFrame" ....
|
||||||
wxString m_AboutTitle; // Name of program displayed in About.
|
wxString m_AboutTitle; ///< Name of program displayed in About.
|
||||||
|
|
||||||
wxAuiManager m_auimgr;
|
wxAuiManager m_auimgr;
|
||||||
|
|
||||||
|
@ -409,47 +409,47 @@ protected:
|
||||||
EDA_DRAW_PANEL_GAL* m_galCanvas;
|
EDA_DRAW_PANEL_GAL* m_galCanvas;
|
||||||
|
|
||||||
/// Tool ID of previously active draw tool bar button.
|
/// Tool ID of previously active draw tool bar button.
|
||||||
int m_lastDrawToolId;
|
int m_lastDrawToolId;
|
||||||
|
|
||||||
/// The shape of the KiCad cursor. The default value (0) is the normal cross
|
/// The shape of the KiCad cursor. The default value (0) is the normal cross
|
||||||
/// hair cursor. Set to non-zero value to draw the full screen cursor.
|
/// hair cursor. Set to non-zero value to draw the full screen cursor.
|
||||||
/// @note This is not the system mouse cursor.
|
/// @note This is not the system mouse cursor.
|
||||||
int m_cursorShape;
|
int m_cursorShape;
|
||||||
|
|
||||||
/// True shows the X and Y axis indicators.
|
/// True shows the X and Y axis indicators.
|
||||||
bool m_showAxis;
|
bool m_showAxis;
|
||||||
|
|
||||||
/// True shows the grid axis indicators.
|
/// True shows the grid axis indicators.
|
||||||
bool m_showGridAxis;
|
bool m_showGridAxis;
|
||||||
|
|
||||||
/// True shows the origin axis used to indicate the coordinate offset for
|
/// True shows the origin axis used to indicate the coordinate offset for
|
||||||
/// drill, gerber, and component position files.
|
/// drill, gerber, and component position files.
|
||||||
bool m_showOriginAxis;
|
bool m_showOriginAxis;
|
||||||
|
|
||||||
/// True shows the drawing border and title block.
|
/// True shows the drawing border and title block.
|
||||||
bool m_showBorderAndTitleBlock;
|
bool m_showBorderAndTitleBlock;
|
||||||
|
|
||||||
/// Choice box to choose the grid size.
|
/// Choice box to choose the grid size.
|
||||||
wxComboBox* m_gridSelectBox;
|
wxComboBox* m_gridSelectBox;
|
||||||
|
|
||||||
/// Choice box to choose the zoom value.
|
/// Choice box to choose the zoom value.
|
||||||
wxComboBox* m_zoomSelectBox;
|
wxComboBox* m_zoomSelectBox;
|
||||||
|
|
||||||
/// The tool bar that contains the buttons for quick access to the application draw
|
/// The tool bar that contains the buttons for quick access to the application draw
|
||||||
/// tools. It typically is located on the right side of the main window.
|
/// tools. It typically is located on the right side of the main window.
|
||||||
wxAuiToolBar* m_drawToolBar;
|
wxAuiToolBar* m_drawToolBar;
|
||||||
|
|
||||||
/// The options tool bar typcially located on the left edge of the main window.
|
/// The options tool bar typcially located on the left edge of the main window.
|
||||||
wxAuiToolBar* m_optionsToolBar;
|
wxAuiToolBar* m_optionsToolBar;
|
||||||
|
|
||||||
/// Panel used to display information at the bottom of the main window.
|
/// Panel used to display information at the bottom of the main window.
|
||||||
EDA_MSG_PANEL* m_messagePanel;
|
EDA_MSG_PANEL* m_messagePanel;
|
||||||
|
|
||||||
int m_MsgFrameHeight;
|
int m_MsgFrameHeight;
|
||||||
|
|
||||||
#ifdef USE_WX_OVERLAY
|
#ifdef USE_WX_OVERLAY
|
||||||
// MAC Uses overlay to workaround the wxINVERT and wxXOR miss
|
// MAC Uses overlay to workaround the wxINVERT and wxXOR miss
|
||||||
wxOverlay m_overlay;
|
wxOverlay m_overlay;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -485,8 +485,89 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual const wxSize GetPageSizeIU() const = 0;
|
virtual const wxSize GetPageSizeIU() const = 0;
|
||||||
|
|
||||||
virtual const wxPoint& GetOriginAxisPosition() const = 0;
|
/**
|
||||||
virtual void SetOriginAxisPosition( const wxPoint& aPosition ) = 0;
|
* Function GetAuxOrigin
|
||||||
|
* returns the origin of the axis used for plotting and various exports.
|
||||||
|
*/
|
||||||
|
virtual const wxPoint& GetAuxOrigin() const = 0;
|
||||||
|
virtual void SetAuxOrigin( const wxPoint& aPosition ) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function GetGridOrigin
|
||||||
|
* returns the absolute coordinates of the origin of the snap grid. This is
|
||||||
|
* treated as a relative offset, and snapping will occur at multiples of the grid
|
||||||
|
* size relative to this point.
|
||||||
|
*/
|
||||||
|
virtual const wxPoint& GetGridOrigin() const = 0;
|
||||||
|
virtual void SetGridOrigin( const wxPoint& aPosition ) = 0;
|
||||||
|
|
||||||
|
//-----<BASE_SCREEN API moved here>------------------------------------------
|
||||||
|
/**
|
||||||
|
* Function GetCrossHairPosition
|
||||||
|
* return the current cross hair position in logical (drawing) coordinates.
|
||||||
|
* @param aInvertY Inverts the Y axis position.
|
||||||
|
* @return The cross hair position in drawing coordinates.
|
||||||
|
*/
|
||||||
|
wxPoint GetCrossHairPosition( bool aInvertY = false ) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function SetCrossHairPosition
|
||||||
|
* sets the screen cross hair position to \a aPosition in logical (drawing) units.
|
||||||
|
* @param aPosition The new cross hair position.
|
||||||
|
* @param aGridOrigin Origin point of the snap grid.
|
||||||
|
* @param aSnapToGrid Sets the cross hair position to the nearest grid position to
|
||||||
|
* \a aPosition.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void SetCrossHairPosition( const wxPoint& aPosition, bool aSnapToGrid = true );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function GetCursorPosition
|
||||||
|
* returns the current cursor position in logical (drawing) units.
|
||||||
|
* @param aOnGrid Returns the nearest grid position at the current cursor position.
|
||||||
|
* @param aGridOrigin Origin point of the snap grid.
|
||||||
|
* @param aGridSize Custom grid size instead of the current grid size. Only valid
|
||||||
|
* if \a aOnGrid is true.
|
||||||
|
* @return The current cursor position.
|
||||||
|
*/
|
||||||
|
wxPoint GetCursorPosition( bool aOnGrid, wxRealPoint* aGridSize = NULL ) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function GetNearestGridPosition
|
||||||
|
* returns the nearest \a aGridSize location to \a aPosition.
|
||||||
|
* @param aPosition The position to check.
|
||||||
|
* @param aGridSize The grid size to locate to if provided. If NULL then the current
|
||||||
|
* grid size is used.
|
||||||
|
* @return The nearst grid position.
|
||||||
|
*/
|
||||||
|
wxPoint GetNearestGridPosition( const wxPoint& aPosition, wxRealPoint* aGridSize = NULL ) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function GetCursorScreenPosition
|
||||||
|
* returns the cross hair position in device (display) units.b
|
||||||
|
* @return The current cross hair position.
|
||||||
|
*/
|
||||||
|
wxPoint GetCrossHairScreenPosition() const;
|
||||||
|
|
||||||
|
void SetMousePosition( const wxPoint& aPosition );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function RefPos
|
||||||
|
* Return the reference position, coming from either the mouse position
|
||||||
|
* or the cursor position.
|
||||||
|
*
|
||||||
|
* @param useMouse If true, return mouse position, else cursor's.
|
||||||
|
*
|
||||||
|
* @return wxPoint - The reference point, either the mouse position or
|
||||||
|
* the cursor position.
|
||||||
|
*/
|
||||||
|
wxPoint RefPos( bool useMouse ) const;
|
||||||
|
|
||||||
|
const wxPoint& GetScrollCenterPosition() const;
|
||||||
|
void SetScrollCenterPosition( const wxPoint& aPoint );
|
||||||
|
|
||||||
|
//-----</BASE_SCREEN API moved here>-----------------------------------------
|
||||||
|
|
||||||
|
|
||||||
virtual const TITLE_BLOCK& GetTitleBlock() const = 0;
|
virtual const TITLE_BLOCK& GetTitleBlock() const = 0;
|
||||||
virtual void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) = 0;
|
virtual void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) = 0;
|
||||||
|
@ -723,13 +804,13 @@ public:
|
||||||
void DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth,
|
void DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth,
|
||||||
double aScale, const wxString &aFilename );
|
double aScale, const wxString &aFilename );
|
||||||
|
|
||||||
void DisplayToolMsg( const wxString& msg );
|
void DisplayToolMsg( const wxString& msg );
|
||||||
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
|
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
|
||||||
virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0;
|
virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0;
|
||||||
virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
|
virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
|
||||||
virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
|
virtual bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
|
||||||
virtual void ToolOnRightClick( wxCommandEvent& event );
|
virtual void ToolOnRightClick( wxCommandEvent& event );
|
||||||
void AdjustScrollBars( const wxPoint& aCenterPosition );
|
void AdjustScrollBars( const wxPoint& aCenterPosition );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function OnActivate (virtual)
|
* Function OnActivate (virtual)
|
||||||
|
|
|
@ -33,7 +33,7 @@ public:
|
||||||
m_paper = aPageSettings;
|
m_paper = aPageSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
const wxPoint& GetOriginAxisPosition() const
|
const wxPoint& GetAuxOrigin() const
|
||||||
{
|
{
|
||||||
static wxPoint zero( 0, 0 );
|
static wxPoint zero( 0, 0 );
|
||||||
return zero;
|
return zero;
|
||||||
|
|
|
@ -35,14 +35,9 @@
|
||||||
void PL_EDITOR_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition,
|
void PL_EDITOR_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition,
|
||||||
int aHotKey )
|
int aHotKey )
|
||||||
{
|
{
|
||||||
wxRealPoint gridSize;
|
wxPoint pos = GetNearestGridPosition( aPosition );
|
||||||
wxPoint oldpos;
|
wxPoint oldpos = GetCrossHairPosition();
|
||||||
wxPoint pos = aPosition;
|
wxRealPoint gridSize = GetScreen()->GetGridSize();
|
||||||
|
|
||||||
pos = GetScreen()->GetNearestGridPosition( pos );
|
|
||||||
|
|
||||||
oldpos = GetScreen()->GetCrossHairPosition();
|
|
||||||
gridSize = GetScreen()->GetGridSize();
|
|
||||||
|
|
||||||
switch( aHotKey )
|
switch( aHotKey )
|
||||||
{
|
{
|
||||||
|
@ -74,14 +69,14 @@ void PL_EDITOR_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetScreen()->SetCrossHairPosition( pos );
|
SetCrossHairPosition( pos );
|
||||||
|
|
||||||
if( oldpos != GetScreen()->GetCrossHairPosition() )
|
if( oldpos != GetCrossHairPosition() )
|
||||||
{
|
{
|
||||||
pos = GetScreen()->GetCrossHairPosition();
|
pos = GetCrossHairPosition();
|
||||||
GetScreen()->SetCrossHairPosition( oldpos );
|
SetCrossHairPosition( oldpos );
|
||||||
m_canvas->CrossHairOff( aDC );
|
m_canvas->CrossHairOff( aDC );
|
||||||
GetScreen()->SetCrossHairPosition( pos );
|
SetCrossHairPosition( pos );
|
||||||
m_canvas->CrossHairOn( aDC );
|
m_canvas->CrossHairOn( aDC );
|
||||||
|
|
||||||
if( m_canvas->IsMouseCaptured() )
|
if( m_canvas->IsMouseCaptured() )
|
||||||
|
|
|
@ -250,7 +250,7 @@ static void moveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPositio
|
||||||
WORKSHEET_DATAITEM *item = screen->GetCurItem();
|
WORKSHEET_DATAITEM *item = screen->GetCurItem();
|
||||||
|
|
||||||
wxCHECK_RET( (item != NULL), wxT( "Cannot move NULL item." ) );
|
wxCHECK_RET( (item != NULL), wxT( "Cannot move NULL item." ) );
|
||||||
wxPoint position = screen->GetCrossHairPosition()
|
wxPoint position = aPanel->GetParent()->GetCrossHairPosition()
|
||||||
- ( initialCursorPosition - initialPositionUi );
|
- ( initialCursorPosition - initialPositionUi );
|
||||||
|
|
||||||
if( (item->GetFlags() & LOCATE_STARTPOINT) )
|
if( (item->GetFlags() & LOCATE_STARTPOINT) )
|
||||||
|
@ -285,12 +285,13 @@ static void abortMoveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
|
||||||
aPanel->Refresh();
|
aPanel->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PL_EDITOR_FRAME::MoveItem( WORKSHEET_DATAITEM* aItem )
|
void PL_EDITOR_FRAME::MoveItem( WORKSHEET_DATAITEM* aItem )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( aItem != NULL, wxT( "Cannot move NULL item" ) );
|
wxCHECK_RET( aItem != NULL, wxT( "Cannot move NULL item" ) );
|
||||||
initialPosition = aItem->GetStartPos();
|
initialPosition = aItem->GetStartPos();
|
||||||
initialPositionUi = aItem->GetStartPosUi();
|
initialPositionUi = aItem->GetStartPosUi();
|
||||||
initialCursorPosition = GetScreen()->GetCrossHairPosition();
|
initialCursorPosition = GetCrossHairPosition();
|
||||||
|
|
||||||
if( (aItem->GetFlags() & LOCATE_ENDPOINT) )
|
if( (aItem->GetFlags() & LOCATE_ENDPOINT) )
|
||||||
{
|
{
|
||||||
|
@ -300,8 +301,8 @@ void PL_EDITOR_FRAME::MoveItem( WORKSHEET_DATAITEM* aItem )
|
||||||
|
|
||||||
if( aItem->GetFlags() & (LOCATE_STARTPOINT|LOCATE_ENDPOINT) )
|
if( aItem->GetFlags() & (LOCATE_STARTPOINT|LOCATE_ENDPOINT) )
|
||||||
{
|
{
|
||||||
GetScreen()->SetCrossHairPosition( initialPositionUi, false );
|
SetCrossHairPosition( initialPositionUi, false );
|
||||||
initialCursorPosition = GetScreen()->GetCrossHairPosition();
|
initialCursorPosition = GetCrossHairPosition();
|
||||||
if( m_canvas->IsPointOnDisplay( initialCursorPosition ) )
|
if( m_canvas->IsPointOnDisplay( initialCursorPosition ) )
|
||||||
{
|
{
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
|
@ -317,6 +318,7 @@ void PL_EDITOR_FRAME::MoveItem( WORKSHEET_DATAITEM* aItem )
|
||||||
GetScreen()->SetCurItem( aItem );
|
GetScreen()->SetCurItem( aItem );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save in Undo list the layout, and place an item being moved.
|
* Save in Undo list the layout, and place an item being moved.
|
||||||
* @param aItem is the item moved
|
* @param aItem is the item moved
|
||||||
|
|
|
@ -180,7 +180,11 @@ void PL_EDITOR_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_RESET_LOCAL_COORD: // Reset the relative coord
|
case HK_RESET_LOCAL_COORD: // Reset the relative coord
|
||||||
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
|
GetScreen()->m_O_Curseur = GetCrossHairPosition();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HK_SET_GRID_ORIGIN:
|
||||||
|
SetGridOrigin( GetCrossHairPosition() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_MOVE_ITEM:
|
case HK_MOVE_ITEM:
|
||||||
|
|
|
@ -254,7 +254,7 @@ double PL_EDITOR_FRAME::BestZoom()
|
||||||
|
|
||||||
double bestzoom = std::max( zx, zy );
|
double bestzoom = std::max( zx, zy );
|
||||||
|
|
||||||
GetScreen()->SetScrollCenterPosition( wxPoint( dx / 2, dy / 2 ) );
|
SetScrollCenterPosition( wxPoint( dx / 2, dy / 2 ) );
|
||||||
|
|
||||||
return bestzoom;
|
return bestzoom;
|
||||||
}
|
}
|
||||||
|
@ -369,42 +369,44 @@ void PL_EDITOR_FRAME::UpdateStatusBar()
|
||||||
wxPoint originCoord;
|
wxPoint originCoord;
|
||||||
int Xsign = 1;
|
int Xsign = 1;
|
||||||
int Ysign = 1;
|
int Ysign = 1;
|
||||||
|
|
||||||
WORKSHEET_DATAITEM dummy( WORKSHEET_DATAITEM::WS_SEGMENT );
|
WORKSHEET_DATAITEM dummy( WORKSHEET_DATAITEM::WS_SEGMENT );
|
||||||
|
|
||||||
switch( m_originSelectChoice )
|
switch( m_originSelectChoice )
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case 0: // Origin = paper Left Top corner
|
case 0: // Origin = paper Left Top corner
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: // Origin = page Right Bottom corner
|
case 1: // Origin = page Right Bottom corner
|
||||||
Xsign = -1;
|
Xsign = -1;
|
||||||
Ysign = -1;
|
Ysign = -1;
|
||||||
dummy.SetStart( 0, 0, RB_CORNER );
|
dummy.SetStart( 0, 0, RB_CORNER );
|
||||||
originCoord = dummy.GetStartPosUi();
|
originCoord = dummy.GetStartPosUi();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: // Origin = page Left Bottom corner
|
case 2: // Origin = page Left Bottom corner
|
||||||
Ysign = -1;
|
Ysign = -1;
|
||||||
dummy.SetStart( 0, 0, LB_CORNER );
|
dummy.SetStart( 0, 0, LB_CORNER );
|
||||||
originCoord = dummy.GetStartPosUi();
|
originCoord = dummy.GetStartPosUi();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3: // Origin = page Right Top corner
|
case 3: // Origin = page Right Top corner
|
||||||
Xsign = -1;
|
Xsign = -1;
|
||||||
dummy.SetStart( 0, 0, RT_CORNER );
|
dummy.SetStart( 0, 0, RT_CORNER );
|
||||||
originCoord = dummy.GetStartPosUi();
|
originCoord = dummy.GetStartPosUi();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4: // Origin = page Left Top corner
|
case 4: // Origin = page Left Top corner
|
||||||
dummy.SetStart( 0, 0, LT_CORNER );
|
dummy.SetStart( 0, 0, LT_CORNER );
|
||||||
originCoord = dummy.GetStartPosUi();
|
originCoord = dummy.GetStartPosUi();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
screen->m_GridOrigin = originCoord;
|
SetGridOrigin( originCoord );
|
||||||
|
|
||||||
// Display absolute coordinates:
|
// Display absolute coordinates:
|
||||||
wxPoint coord = screen->GetCrossHairPosition() - originCoord;
|
wxPoint coord = GetCrossHairPosition() - originCoord;
|
||||||
double dXpos = To_User_Unit( g_UserUnit, coord.x*Xsign );
|
double dXpos = To_User_Unit( g_UserUnit, coord.x*Xsign );
|
||||||
double dYpos = To_User_Unit( g_UserUnit, coord.y*Ysign );
|
double dYpos = To_User_Unit( g_UserUnit, coord.y*Ysign );
|
||||||
|
|
||||||
|
@ -441,8 +443,8 @@ void PL_EDITOR_FRAME::UpdateStatusBar()
|
||||||
SetStatusText( line, 2 );
|
SetStatusText( line, 2 );
|
||||||
|
|
||||||
// Display relative coordinates:
|
// Display relative coordinates:
|
||||||
int dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x;
|
int dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
|
||||||
int dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y;
|
int dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
|
||||||
dXpos = To_User_Unit( g_UserUnit, dx * Xsign );
|
dXpos = To_User_Unit( g_UserUnit, dx * Xsign );
|
||||||
dYpos = To_User_Unit( g_UserUnit, dy * Ysign );
|
dYpos = To_User_Unit( g_UserUnit, dy * Ysign );
|
||||||
line.Printf( locformatter, dXpos, dYpos );
|
line.Printf( locformatter, dXpos, dYpos );
|
||||||
|
@ -594,10 +596,11 @@ WORKSHEET_DATAITEM * PL_EDITOR_FRAME::GetSelectedItem()
|
||||||
*/
|
*/
|
||||||
WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition )
|
WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition )
|
||||||
{
|
{
|
||||||
const PAGE_INFO& pageInfo = GetPageSettings();
|
const PAGE_INFO& pageInfo = GetPageSettings();
|
||||||
TITLE_BLOCK t_block = GetTitleBlock();
|
TITLE_BLOCK t_block = GetTitleBlock();
|
||||||
EDA_COLOR_T color = RED; // Needed, not used
|
EDA_COLOR_T color = RED; // Needed, not used
|
||||||
PL_EDITOR_SCREEN* screen = (PL_EDITOR_SCREEN*) GetScreen();
|
PL_EDITOR_SCREEN* screen = (PL_EDITOR_SCREEN*) GetScreen();
|
||||||
|
|
||||||
screen-> m_ScreenNumber = GetPageNumberOption() ? 1 : 2;
|
screen-> m_ScreenNumber = GetPageNumberOption() ? 1 : 2;
|
||||||
|
|
||||||
WS_DRAW_ITEM_LIST drawList;
|
WS_DRAW_ITEM_LIST drawList;
|
||||||
|
@ -623,9 +626,9 @@ WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition )
|
||||||
// Choose item in list if more than 1 item
|
// Choose item in list if more than 1 item
|
||||||
if( list.size() > 1 )
|
if( list.size() > 1 )
|
||||||
{
|
{
|
||||||
wxArrayString choices;
|
wxArrayString choices;
|
||||||
wxString text;
|
wxString text;
|
||||||
wxPoint cursPos = screen->GetCrossHairPosition();
|
wxPoint cursPos = GetCrossHairPosition();
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < list.size(); ++ii )
|
for( unsigned ii = 0; ii < list.size(); ++ii )
|
||||||
{
|
{
|
||||||
|
@ -656,7 +659,7 @@ WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition )
|
||||||
if( selection < 0 )
|
if( selection < 0 )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
screen->SetCrossHairPosition( cursPos );
|
SetCrossHairPosition( cursPos );
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
drawitem = list[selection];
|
drawitem = list[selection];
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,8 @@ class PL_EDITOR_FRAME : public EDA_DRAW_FRAME
|
||||||
// usefull when there are some items which are
|
// usefull when there are some items which are
|
||||||
// only on page 1, not on page 1
|
// only on page 1, not on page 1
|
||||||
|
|
||||||
|
wxPoint m_grid_origin;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// The last filename chosen to be proposed to the user
|
/// The last filename chosen to be proposed to the user
|
||||||
wxString m_lastFileName;
|
wxString m_lastFileName;
|
||||||
|
@ -90,12 +92,21 @@ public:
|
||||||
return (PL_EDITOR_SCREEN*) m_canvas->GetScreen();
|
return (PL_EDITOR_SCREEN*) m_canvas->GetScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
const wxPoint& GetOriginAxisPosition() const // overload EDA_DRAW_FRAME
|
const wxPoint& GetAuxOrigin() const // overload EDA_DRAW_FRAME
|
||||||
{
|
{
|
||||||
static wxPoint dummy( 0,0 );
|
static wxPoint dummy; // ( 0,0 );
|
||||||
return dummy;
|
return dummy;
|
||||||
}
|
}
|
||||||
void SetOriginAxisPosition( const wxPoint& aPosition ) {} // overload EDA_DRAW_FRAME
|
void SetAuxOrigin( const wxPoint& aPosition ) {} // overload EDA_DRAW_FRAME
|
||||||
|
|
||||||
|
const wxPoint& GetGridOrigin() const // overload EDA_DRAW_FRAME
|
||||||
|
{
|
||||||
|
return m_grid_origin;
|
||||||
|
}
|
||||||
|
void SetGridOrigin( const wxPoint& aPoint ) // overload EDA_DRAW_FRAME
|
||||||
|
{
|
||||||
|
m_grid_origin = aPoint;
|
||||||
|
}
|
||||||
|
|
||||||
const TITLE_BLOCK& GetTitleBlock() const; // overload EDA_DRAW_FRAME
|
const TITLE_BLOCK& GetTitleBlock() const; // overload EDA_DRAW_FRAME
|
||||||
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ); // overload EDA_DRAW_FRAME
|
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ); // overload EDA_DRAW_FRAME
|
||||||
|
|
|
@ -106,7 +106,7 @@ void PCB_EDIT_FRAME::AutoPlace( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Erase ratsnest if needed */
|
// Erase ratsnest if needed
|
||||||
if( GetBoard()->IsElementVisible(RATSNEST_VISIBLE) )
|
if( GetBoard()->IsElementVisible(RATSNEST_VISIBLE) )
|
||||||
DrawGeneralRatsnest( &dc );
|
DrawGeneralRatsnest( &dc );
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Confirmation */
|
// Confirmation
|
||||||
if( !IsOK( this, _( "Move modules?" ) ) )
|
if( !IsOK( this, _( "Move modules?" ) ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -223,15 +223,15 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
|
||||||
*/
|
*/
|
||||||
if( PlaceModulesHorsPcb && edgesExist )
|
if( PlaceModulesHorsPcb && edgesExist )
|
||||||
{
|
{
|
||||||
if( GetScreen()->GetCrossHairPosition().y < (bbbox.GetBottom() + 2000) )
|
if( GetCrossHairPosition().y < (bbbox.GetBottom() + 2000) )
|
||||||
{
|
{
|
||||||
wxPoint pos = GetScreen()->GetCrossHairPosition();
|
wxPoint pos = GetCrossHairPosition();
|
||||||
pos.y = bbbox.GetBottom() + 2000;
|
pos.y = bbbox.GetBottom() + 2000;
|
||||||
GetScreen()->SetCrossHairPosition( pos );
|
SetCrossHairPosition( pos );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* calculate the area needed by footprints */
|
// calculate the area needed by footprints
|
||||||
surface = 0.0;
|
surface = 0.0;
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < moduleList.size(); ii++ )
|
for( unsigned ii = 0; ii < moduleList.size(); ii++ )
|
||||||
|
@ -249,7 +249,7 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
|
||||||
|
|
||||||
Xsize_allowed = (int) ( sqrt( surface ) * 4.0 / 3.0 );
|
Xsize_allowed = (int) ( sqrt( surface ) * 4.0 / 3.0 );
|
||||||
|
|
||||||
start = current = GetScreen()->GetCrossHairPosition();
|
start = current = GetCrossHairPosition();
|
||||||
Ymax_size = 0;
|
Ymax_size = 0;
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < moduleList.size(); ii++ )
|
for( unsigned ii = 0; ii < moduleList.size(); ii++ )
|
||||||
|
@ -276,8 +276,8 @@ void PCB_EDIT_FRAME::AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb )
|
||||||
Ymax_size = 0;
|
Ymax_size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetScreen()->SetCrossHairPosition( current + Module->GetPosition() -
|
SetCrossHairPosition( current + Module->GetPosition() -
|
||||||
Module->GetBoundingBox().GetPosition() );
|
Module->GetBoundingBox().GetPosition() );
|
||||||
|
|
||||||
Ymax_size = std::max( Ymax_size, Module->GetBoundingBox().GetHeight() );
|
Ymax_size = std::max( Ymax_size, Module->GetBoundingBox().GetHeight() );
|
||||||
|
|
||||||
|
|
|
@ -62,20 +62,20 @@
|
||||||
*/
|
*/
|
||||||
static const double OrientPenality[11] =
|
static const double OrientPenality[11] =
|
||||||
{
|
{
|
||||||
2.0f, /* CntRot = 0 rotation prohibited */
|
2.0f, // CntRot = 0 rotation prohibited
|
||||||
1.9f, /* CntRot = 1 */
|
1.9f, // CntRot = 1
|
||||||
1.8f, /* CntRot = 2 */
|
1.8f, // CntRot = 2
|
||||||
1.7f, /* CntRot = 3 */
|
1.7f, // CntRot = 3
|
||||||
1.6f, /* CntRot = 4 */
|
1.6f, // CntRot = 4
|
||||||
1.5f, /* CntRot = 5 */
|
1.5f, // CntRot = 5
|
||||||
1.4f, /* CntRot = 5 */
|
1.4f, // CntRot = 5
|
||||||
1.3f, /* CntRot = 7 */
|
1.3f, // CntRot = 7
|
||||||
1.2f, /* CntRot = 8 */
|
1.2f, // CntRot = 8
|
||||||
1.1f, /* CntRot = 9 */
|
1.1f, // CntRot = 9
|
||||||
1.0f /* CntRot = 10 rotation authorized, no penalty */
|
1.0f // CntRot = 10 rotation authorized, no penalty
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Cell states. */
|
// Cell states.
|
||||||
#define OUT_OF_BOARD -2
|
#define OUT_OF_BOARD -2
|
||||||
#define OCCUPED_By_MODULE -1
|
#define OCCUPED_By_MODULE -1
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
||||||
if( RoutingMatrix.m_GridRouting < 10*IU_PER_MILS )
|
if( RoutingMatrix.m_GridRouting < 10*IU_PER_MILS )
|
||||||
RoutingMatrix.m_GridRouting = 10*IU_PER_MILS; // Min value = 1/1000 inch
|
RoutingMatrix.m_GridRouting = 10*IU_PER_MILS; // Min value = 1/1000 inch
|
||||||
|
|
||||||
/* Compute module parameters used in auto place */
|
// Compute module parameters used in auto place
|
||||||
if( GenPlaceBoard() == 0 )
|
if( GenPlaceBoard() == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
||||||
msg.Printf( _("Place module %d of %d"), cnt, moduleCount );
|
msg.Printf( _("Place module %d of %d"), cnt, moduleCount );
|
||||||
SetStatusText( msg );
|
SetStatusText( msg );
|
||||||
|
|
||||||
/* Display fill area of interest, barriers, penalties. */
|
// Display fill area of interest, barriers, penalties.
|
||||||
DrawInfoPlace( DC );
|
DrawInfoPlace( DC );
|
||||||
|
|
||||||
error = GetOptimalModulePlacement( Module, DC );
|
error = GetOptimalModulePlacement( Module, DC );
|
||||||
|
@ -255,7 +255,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
||||||
if( error == ESC )
|
if( error == ESC )
|
||||||
goto end_of_tst;
|
goto end_of_tst;
|
||||||
|
|
||||||
/* Determine if the best orientation of a module is 180. */
|
// Determine if the best orientation of a module is 180.
|
||||||
ii = Module->GetPlacementCost180() & 0x0F;
|
ii = Module->GetPlacementCost180() & 0x0F;
|
||||||
|
|
||||||
if( ii != 0 )
|
if( ii != 0 )
|
||||||
|
@ -266,7 +266,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
||||||
error = GetOptimalModulePlacement( Module, DC );
|
error = GetOptimalModulePlacement( Module, DC );
|
||||||
MinCout *= OrientPenality[ii];
|
MinCout *= OrientPenality[ii];
|
||||||
|
|
||||||
if( BestScore > MinCout ) /* This orientation is best. */
|
if( BestScore > MinCout ) // This orientation is best.
|
||||||
{
|
{
|
||||||
PosOK = CurrPosition;
|
PosOK = CurrPosition;
|
||||||
BestScore = MinCout;
|
BestScore = MinCout;
|
||||||
|
@ -281,7 +281,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
||||||
goto end_of_tst;
|
goto end_of_tst;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Determine if the best orientation of a module is 90. */
|
// Determine if the best orientation of a module is 90.
|
||||||
ii = Module->GetPlacementCost90() & 0x0F;
|
ii = Module->GetPlacementCost90() & 0x0F;
|
||||||
|
|
||||||
if( ii != 0 )
|
if( ii != 0 )
|
||||||
|
@ -291,7 +291,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
||||||
error = GetOptimalModulePlacement( Module, DC );
|
error = GetOptimalModulePlacement( Module, DC );
|
||||||
MinCout *= OrientPenality[ii];
|
MinCout *= OrientPenality[ii];
|
||||||
|
|
||||||
if( BestScore > MinCout ) /* This orientation is best. */
|
if( BestScore > MinCout ) // This orientation is best.
|
||||||
{
|
{
|
||||||
PosOK = CurrPosition;
|
PosOK = CurrPosition;
|
||||||
BestScore = MinCout;
|
BestScore = MinCout;
|
||||||
|
@ -306,7 +306,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
||||||
goto end_of_tst;
|
goto end_of_tst;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Determine if the best orientation of a module is 270. */
|
// Determine if the best orientation of a module is 270.
|
||||||
ii = (Module->GetPlacementCost90() >> 4 ) & 0x0F;
|
ii = (Module->GetPlacementCost90() >> 4 ) & 0x0F;
|
||||||
|
|
||||||
if( ii != 0 )
|
if( ii != 0 )
|
||||||
|
@ -316,7 +316,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC )
|
||||||
error = GetOptimalModulePlacement( Module, DC );
|
error = GetOptimalModulePlacement( Module, DC );
|
||||||
MinCout *= OrientPenality[ii];
|
MinCout *= OrientPenality[ii];
|
||||||
|
|
||||||
if( BestScore > MinCout ) /* This orientation is best. */
|
if( BestScore > MinCout ) // This orientation is best.
|
||||||
{
|
{
|
||||||
PosOK = CurrPosition;
|
PosOK = CurrPosition;
|
||||||
BestScore = MinCout;
|
BestScore = MinCout;
|
||||||
|
@ -336,11 +336,11 @@ end_of_tst:
|
||||||
if( error == ESC )
|
if( error == ESC )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Place module. */
|
// Place module.
|
||||||
CurrPosition = GetScreen()->GetCrossHairPosition();
|
CurrPosition = GetCrossHairPosition();
|
||||||
GetScreen()->SetCrossHairPosition( PosOK );
|
SetCrossHairPosition( PosOK );
|
||||||
PlaceModule( Module, DC );
|
PlaceModule( Module, DC );
|
||||||
GetScreen()->SetCrossHairPosition( CurrPosition );
|
SetCrossHairPosition( CurrPosition );
|
||||||
|
|
||||||
Module->CalculateBoundingBox();
|
Module->CalculateBoundingBox();
|
||||||
|
|
||||||
|
@ -393,14 +393,14 @@ void PCB_EDIT_FRAME::DrawInfoPlace( wxDC* DC )
|
||||||
if( top_state & CELL_is_ZONE )
|
if( top_state & CELL_is_ZONE )
|
||||||
color = BLUE;
|
color = BLUE;
|
||||||
|
|
||||||
/* obstacles */
|
// obstacles
|
||||||
if( ( top_state & CELL_is_EDGE ) || ( bottom_state & CELL_is_EDGE ) )
|
if( ( top_state & CELL_is_EDGE ) || ( bottom_state & CELL_is_EDGE ) )
|
||||||
color = WHITE;
|
color = WHITE;
|
||||||
else if( top_state & ( HOLE | CELL_is_MODULE ) )
|
else if( top_state & ( HOLE | CELL_is_MODULE ) )
|
||||||
color = LIGHTRED;
|
color = LIGHTRED;
|
||||||
else if( bottom_state & (HOLE | CELL_is_MODULE) )
|
else if( bottom_state & (HOLE | CELL_is_MODULE) )
|
||||||
color = LIGHTGREEN;
|
color = LIGHTGREEN;
|
||||||
else /* Display the filling and keep out regions. */
|
else // Display the filling and keep out regions.
|
||||||
{
|
{
|
||||||
if( RoutingMatrix.GetDist( ii, jj, TOP ) ||
|
if( RoutingMatrix.GetDist( ii, jj, TOP ) ||
|
||||||
RoutingMatrix.GetDist( ii, jj, BOTTOM ) )
|
RoutingMatrix.GetDist( ii, jj, BOTTOM ) )
|
||||||
|
@ -438,12 +438,12 @@ int PCB_EDIT_FRAME::GenPlaceBoard()
|
||||||
msg.Printf( wxT( "%d" ), nbCells );
|
msg.Printf( wxT( "%d" ), nbCells );
|
||||||
m_messagePanel->SetMessage( 14, _( "Cells." ), msg, YELLOW );
|
m_messagePanel->SetMessage( 14, _( "Cells." ), msg, YELLOW );
|
||||||
|
|
||||||
/* Choose the number of board sides. */
|
// Choose the number of board sides.
|
||||||
RoutingMatrix.m_RoutingLayersCount = 2;
|
RoutingMatrix.m_RoutingLayersCount = 2;
|
||||||
|
|
||||||
RoutingMatrix.InitRoutingMatrix();
|
RoutingMatrix.InitRoutingMatrix();
|
||||||
|
|
||||||
/* Display memory usage. */
|
// Display memory usage.
|
||||||
msg.Printf( wxT( "%d" ), RoutingMatrix.m_MemSize / 1024 );
|
msg.Printf( wxT( "%d" ), RoutingMatrix.m_MemSize / 1024 );
|
||||||
m_messagePanel->SetMessage( 24, wxT( "Mem(Kb)" ), msg, CYAN );
|
m_messagePanel->SetMessage( 24, wxT( "Mem(Kb)" ), msg, CYAN );
|
||||||
|
|
||||||
|
@ -454,7 +454,7 @@ int PCB_EDIT_FRAME::GenPlaceBoard()
|
||||||
|
|
||||||
g_Route_Layer_TOP = LAYER_N_FRONT;
|
g_Route_Layer_TOP = LAYER_N_FRONT;
|
||||||
|
|
||||||
/* Place the edge layer segments */
|
// Place the edge layer segments
|
||||||
TRACK TmpSegm( NULL );
|
TRACK TmpSegm( NULL );
|
||||||
|
|
||||||
TmpSegm.SetLayer( UNDEFINED_LAYER );
|
TmpSegm.SetLayer( UNDEFINED_LAYER );
|
||||||
|
@ -561,7 +561,7 @@ void PCB_EDIT_FRAME::GenModuleOnBoard( MODULE* Module )
|
||||||
int trackWidth = GetBoard()->m_NetClasses.GetDefault()->GetTrackWidth();
|
int trackWidth = GetBoard()->m_NetClasses.GetDefault()->GetTrackWidth();
|
||||||
int clearance = GetBoard()->m_NetClasses.GetDefault()->GetClearance();
|
int clearance = GetBoard()->m_NetClasses.GetDefault()->GetClearance();
|
||||||
|
|
||||||
/* Trace pads and surface safely. */
|
// Trace pads and surface safely.
|
||||||
marge = trackWidth + clearance;
|
marge = trackWidth + clearance;
|
||||||
|
|
||||||
for( Pad = Module->Pads(); Pad != NULL; Pad = Pad->Next() )
|
for( Pad = Module->Pads(); Pad != NULL; Pad = Pad->Next() )
|
||||||
|
@ -569,7 +569,7 @@ void PCB_EDIT_FRAME::GenModuleOnBoard( MODULE* Module )
|
||||||
::PlacePad( Pad, CELL_is_MODULE, marge, WRITE_OR_CELL );
|
::PlacePad( Pad, CELL_is_MODULE, marge, WRITE_OR_CELL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Trace clearance. */
|
// Trace clearance.
|
||||||
marge = ( RoutingMatrix.m_GridRouting * Module->GetPadCount() ) / GAIN;
|
marge = ( RoutingMatrix.m_GridRouting * Module->GetPadCount() ) / GAIN;
|
||||||
CreateKeepOutRectangle( ox, oy, fx, fy, marge, KEEP_OUT_MARGIN, layerMask );
|
CreateKeepOutRectangle( ox, oy, fx, fy, marge, KEEP_OUT_MARGIN, layerMask );
|
||||||
}
|
}
|
||||||
|
@ -578,7 +578,7 @@ void PCB_EDIT_FRAME::GenModuleOnBoard( MODULE* Module )
|
||||||
int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC )
|
int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC )
|
||||||
{
|
{
|
||||||
int cx, cy;
|
int cx, cy;
|
||||||
int ox, oy, fx, fy; /* occupying part of the module focuses on the cursor */
|
int ox, oy, fx, fy; // occupying part of the module focuses on the cursor
|
||||||
int error = 1;
|
int error = 1;
|
||||||
int showRat = 0;
|
int showRat = 0;
|
||||||
wxPoint LastPosOK;
|
wxPoint LastPosOK;
|
||||||
|
@ -604,7 +604,7 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC )
|
||||||
CurrPosition.x = RoutingMatrix.m_BrdBox.GetX() - ox;
|
CurrPosition.x = RoutingMatrix.m_BrdBox.GetX() - ox;
|
||||||
CurrPosition.y = RoutingMatrix.m_BrdBox.GetY() - oy;
|
CurrPosition.y = RoutingMatrix.m_BrdBox.GetY() - oy;
|
||||||
|
|
||||||
/* Module placement on grid. */
|
// Module placement on grid.
|
||||||
CurrPosition.x -= CurrPosition.x % RoutingMatrix.m_GridRouting;
|
CurrPosition.x -= CurrPosition.x % RoutingMatrix.m_GridRouting;
|
||||||
CurrPosition.y -= CurrPosition.y % RoutingMatrix.m_GridRouting;
|
CurrPosition.y -= CurrPosition.y % RoutingMatrix.m_GridRouting;
|
||||||
|
|
||||||
|
@ -664,7 +664,7 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC )
|
||||||
g_Offset_Module.x = cx - CurrPosition.x;
|
g_Offset_Module.x = cx - CurrPosition.x;
|
||||||
CurrPosition.y = RoutingMatrix.m_BrdBox.GetY() - oy;
|
CurrPosition.y = RoutingMatrix.m_BrdBox.GetY() - oy;
|
||||||
|
|
||||||
/* Placement on grid. */
|
// Placement on grid.
|
||||||
CurrPosition.y -= CurrPosition.y % RoutingMatrix.m_GridRouting;
|
CurrPosition.y -= CurrPosition.y % RoutingMatrix.m_GridRouting;
|
||||||
|
|
||||||
DrawModuleOutlines( m_canvas, aDC, aModule );
|
DrawModuleOutlines( m_canvas, aDC, aModule );
|
||||||
|
@ -673,7 +673,7 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC )
|
||||||
CurrPosition.y += RoutingMatrix.m_GridRouting )
|
CurrPosition.y += RoutingMatrix.m_GridRouting )
|
||||||
{
|
{
|
||||||
#ifndef USE_WX_OVERLAY
|
#ifndef USE_WX_OVERLAY
|
||||||
/* Erase traces. */
|
// Erase traces.
|
||||||
DrawModuleOutlines( m_canvas, aDC, aModule );
|
DrawModuleOutlines( m_canvas, aDC, aModule );
|
||||||
|
|
||||||
if( showRat )
|
if( showRat )
|
||||||
|
@ -717,14 +717,14 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawModuleOutlines( m_canvas, aDC, aModule ); /* erasing the last traces */
|
DrawModuleOutlines( m_canvas, aDC, aModule ); // erasing the last traces
|
||||||
|
|
||||||
g_Show_Module_Ratsnest = showRats;
|
g_Show_Module_Ratsnest = showRats;
|
||||||
|
|
||||||
if( showRat )
|
if( showRat )
|
||||||
Compute_Ratsnest_PlaceModule( aDC );
|
Compute_Ratsnest_PlaceModule( aDC );
|
||||||
|
|
||||||
/* Regeneration of the modified variable. */
|
// Regeneration of the modified variable.
|
||||||
aModule->GetBoundingBox().SetX( ox + cx );
|
aModule->GetBoundingBox().SetX( ox + cx );
|
||||||
aModule->GetBoundingBox().SetY( oy + cy );
|
aModule->GetBoundingBox().SetY( oy + cy );
|
||||||
CurrPosition = LastPosOK;
|
CurrPosition = LastPosOK;
|
||||||
|
@ -926,7 +926,7 @@ double PCB_EDIT_FRAME::Compute_Ratsnest_PlaceModule( wxDC* DC )
|
||||||
GRLine( m_canvas->GetClipBox(), DC, start, end, 0, color );
|
GRLine( m_canvas->GetClipBox(), DC, start, end, 0, color );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* Cost of the ratsnest. */
|
// Cost of the ratsnest.
|
||||||
dx = end.x - start.x;
|
dx = end.x - start.x;
|
||||||
dy = end.y - start.y;
|
dy = end.y - start.y;
|
||||||
|
|
||||||
|
@ -970,10 +970,10 @@ void CreateKeepOutRectangle( int ux0, int uy0, int ux1, int uy1,
|
||||||
int lgain, cgain;
|
int lgain, cgain;
|
||||||
|
|
||||||
if( aLayerMask & GetLayerMask( g_Route_Layer_BOTTOM ) )
|
if( aLayerMask & GetLayerMask( g_Route_Layer_BOTTOM ) )
|
||||||
trace = 1; /* Trace on bottom layer. */
|
trace = 1; // Trace on bottom layer.
|
||||||
|
|
||||||
if( ( aLayerMask & GetLayerMask( g_Route_Layer_TOP ) ) && RoutingMatrix.m_RoutingLayersCount )
|
if( ( aLayerMask & GetLayerMask( g_Route_Layer_TOP ) ) && RoutingMatrix.m_RoutingLayersCount )
|
||||||
trace |= 2; /* Trace on top layer. */
|
trace |= 2; // Trace on top layer.
|
||||||
|
|
||||||
if( trace == 0 )
|
if( trace == 0 )
|
||||||
return;
|
return;
|
||||||
|
@ -991,7 +991,7 @@ void CreateKeepOutRectangle( int ux0, int uy0, int ux1, int uy1,
|
||||||
if( pmarge < 1 )
|
if( pmarge < 1 )
|
||||||
pmarge = 1;
|
pmarge = 1;
|
||||||
|
|
||||||
/* Calculate the coordinate limits of the rectangle. */
|
// Calculate the coordinate limits of the rectangle.
|
||||||
row_max = uy1 / RoutingMatrix.m_GridRouting;
|
row_max = uy1 / RoutingMatrix.m_GridRouting;
|
||||||
col_max = ux1 / RoutingMatrix.m_GridRouting;
|
col_max = ux1 / RoutingMatrix.m_GridRouting;
|
||||||
row_min = uy0 / RoutingMatrix.m_GridRouting;
|
row_min = uy0 / RoutingMatrix.m_GridRouting;
|
||||||
|
@ -1057,7 +1057,7 @@ void CreateKeepOutRectangle( int ux0, int uy0, int ux1, int uy1,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Sort routines */
|
// Sort routines
|
||||||
static bool Tri_PlaceModules( MODULE* ref, MODULE* compare )
|
static bool Tri_PlaceModules( MODULE* ref, MODULE* compare )
|
||||||
{
|
{
|
||||||
double ff1, ff2;
|
double ff1, ff2;
|
||||||
|
@ -1114,7 +1114,7 @@ static MODULE* PickModule( PCB_EDIT_FRAME* pcbframe, wxDC* DC )
|
||||||
pcbframe->SetMsgPanel( Module );
|
pcbframe->SetMsgPanel( Module );
|
||||||
pcbframe->build_ratsnest_module( Module );
|
pcbframe->build_ratsnest_module( Module );
|
||||||
|
|
||||||
/* Calculate external ratsnest. */
|
// Calculate external ratsnest.
|
||||||
for( unsigned ii = 0; ii < pcbframe->GetBoard()->m_LocalRatsnest.size(); ii++ )
|
for( unsigned ii = 0; ii < pcbframe->GetBoard()->m_LocalRatsnest.size(); ii++ )
|
||||||
{
|
{
|
||||||
if( ( pcbframe->GetBoard()->m_LocalRatsnest[ii].m_Status &
|
if( ( pcbframe->GetBoard()->m_LocalRatsnest[ii].m_Status &
|
||||||
|
@ -1127,7 +1127,7 @@ static MODULE* PickModule( PCB_EDIT_FRAME* pcbframe, wxDC* DC )
|
||||||
|
|
||||||
sort( moduleList.begin(), moduleList.end(), Tri_RatsModules );
|
sort( moduleList.begin(), moduleList.end(), Tri_RatsModules );
|
||||||
|
|
||||||
/* Search for "best" module. */
|
// Search for "best" module.
|
||||||
MODULE* bestModule = NULL;
|
MODULE* bestModule = NULL;
|
||||||
MODULE* altModule = NULL;
|
MODULE* altModule = NULL;
|
||||||
|
|
||||||
|
@ -1199,7 +1199,7 @@ int propagate()
|
||||||
{
|
{
|
||||||
current_cell = RoutingMatrix.GetCell( row, col, BOTTOM ) & NO_CELL_ZONE;
|
current_cell = RoutingMatrix.GetCell( row, col, BOTTOM ) & NO_CELL_ZONE;
|
||||||
|
|
||||||
if( current_cell == 0 ) /* a free cell is found */
|
if( current_cell == 0 ) // a free cell is found
|
||||||
{
|
{
|
||||||
if( (old_cell_H & CELL_is_ZONE) || (pt_cell_V[col] & CELL_is_ZONE) )
|
if( (old_cell_H & CELL_is_ZONE) || (pt_cell_V[col] & CELL_is_ZONE) )
|
||||||
{
|
{
|
||||||
|
@ -1224,7 +1224,7 @@ int propagate()
|
||||||
{
|
{
|
||||||
current_cell = RoutingMatrix.GetCell( row, col, BOTTOM ) & NO_CELL_ZONE;
|
current_cell = RoutingMatrix.GetCell( row, col, BOTTOM ) & NO_CELL_ZONE;
|
||||||
|
|
||||||
if( current_cell == 0 ) /* a free cell is found */
|
if( current_cell == 0 ) // a free cell is found
|
||||||
{
|
{
|
||||||
if( (old_cell_H & CELL_is_ZONE) || (pt_cell_V[col] & CELL_is_ZONE) )
|
if( (old_cell_H & CELL_is_ZONE) || (pt_cell_V[col] & CELL_is_ZONE) )
|
||||||
{
|
{
|
||||||
|
@ -1249,7 +1249,7 @@ int propagate()
|
||||||
{
|
{
|
||||||
current_cell = RoutingMatrix.GetCell( row, col, BOTTOM ) & NO_CELL_ZONE;
|
current_cell = RoutingMatrix.GetCell( row, col, BOTTOM ) & NO_CELL_ZONE;
|
||||||
|
|
||||||
if( current_cell == 0 ) /* a free cell is found */
|
if( current_cell == 0 ) // a free cell is found
|
||||||
{
|
{
|
||||||
if( (old_cell_H & CELL_is_ZONE) || (pt_cell_V[row] & CELL_is_ZONE) )
|
if( (old_cell_H & CELL_is_ZONE) || (pt_cell_V[row] & CELL_is_ZONE) )
|
||||||
{
|
{
|
||||||
|
@ -1274,7 +1274,7 @@ int propagate()
|
||||||
{
|
{
|
||||||
current_cell = RoutingMatrix.GetCell( row, col, BOTTOM ) & NO_CELL_ZONE;
|
current_cell = RoutingMatrix.GetCell( row, col, BOTTOM ) & NO_CELL_ZONE;
|
||||||
|
|
||||||
if( current_cell == 0 ) /* a free cell is found */
|
if( current_cell == 0 ) // a free cell is found
|
||||||
{
|
{
|
||||||
if( (old_cell_H & CELL_is_ZONE) || (pt_cell_V[row] & CELL_is_ZONE) )
|
if( (old_cell_H & CELL_is_ZONE) || (pt_cell_V[row] & CELL_is_ZONE) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -217,17 +217,31 @@ const wxSize PCB_BASE_FRAME::GetPageSizeIU() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const wxPoint& PCB_BASE_FRAME::GetOriginAxisPosition() const
|
const wxPoint& PCB_BASE_FRAME::GetAuxOrigin() const
|
||||||
{
|
{
|
||||||
wxASSERT( m_Pcb );
|
wxASSERT( m_Pcb );
|
||||||
return m_Pcb->GetOriginAxisPosition();
|
return m_Pcb->GetAuxOrigin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_BASE_FRAME::SetOriginAxisPosition( const wxPoint& aPosition )
|
void PCB_BASE_FRAME::SetAuxOrigin( const wxPoint& aPoint )
|
||||||
{
|
{
|
||||||
wxASSERT( m_Pcb );
|
wxASSERT( m_Pcb );
|
||||||
m_Pcb->SetOriginAxisPosition( aPosition );
|
m_Pcb->SetAuxOrigin( aPoint );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const wxPoint& PCB_BASE_FRAME::GetGridOrigin() const
|
||||||
|
{
|
||||||
|
wxASSERT( m_Pcb );
|
||||||
|
return m_Pcb->GetGridOrigin();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PCB_BASE_FRAME::SetGridOrigin( const wxPoint& aPoint )
|
||||||
|
{
|
||||||
|
wxASSERT( m_Pcb );
|
||||||
|
m_Pcb->SetGridOrigin( aPoint );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -327,7 +341,7 @@ double PCB_BASE_FRAME::BestZoom()
|
||||||
|
|
||||||
double bestzoom = std::max( iu_per_du_X, iu_per_du_Y );
|
double bestzoom = std::max( iu_per_du_X, iu_per_du_Y );
|
||||||
|
|
||||||
GetScreen()->SetScrollCenterPosition( ibbbox.Centre() );
|
SetScrollCenterPosition( ibbbox.Centre() );
|
||||||
|
|
||||||
return bestzoom;
|
return bestzoom;
|
||||||
}
|
}
|
||||||
|
@ -337,21 +351,19 @@ void PCB_BASE_FRAME::CursorGoto( const wxPoint& aPos, bool aWarp )
|
||||||
{
|
{
|
||||||
// factored out of pcbnew/find.cpp
|
// factored out of pcbnew/find.cpp
|
||||||
|
|
||||||
PCB_SCREEN* screen = (PCB_SCREEN*)GetScreen();
|
|
||||||
|
|
||||||
INSTALL_UNBUFFERED_DC( dc, m_canvas );
|
INSTALL_UNBUFFERED_DC( dc, m_canvas );
|
||||||
|
|
||||||
// There may be need to reframe the drawing.
|
// There may be need to reframe the drawing.
|
||||||
if( !m_canvas->IsPointOnDisplay( aPos ) )
|
if( !m_canvas->IsPointOnDisplay( aPos ) )
|
||||||
{
|
{
|
||||||
screen->SetCrossHairPosition( aPos );
|
SetCrossHairPosition( aPos );
|
||||||
RedrawScreen( aPos, aWarp );
|
RedrawScreen( aPos, aWarp );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Put cursor on item position
|
// Put cursor on item position
|
||||||
m_canvas->CrossHairOff( &dc );
|
m_canvas->CrossHairOff( &dc );
|
||||||
screen->SetCrossHairPosition( aPos );
|
SetCrossHairPosition( aPos );
|
||||||
|
|
||||||
if( aWarp )
|
if( aWarp )
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
|
@ -641,8 +653,8 @@ void PCB_BASE_FRAME::UpdateStatusBar()
|
||||||
{
|
{
|
||||||
double theta, ro;
|
double theta, ro;
|
||||||
|
|
||||||
dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x;
|
dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
|
||||||
dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y;
|
dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
|
||||||
|
|
||||||
theta = ArcTangente( -dy, dx ) / 10;
|
theta = ArcTangente( -dy, dx ) / 10;
|
||||||
|
|
||||||
|
@ -679,8 +691,8 @@ void PCB_BASE_FRAME::UpdateStatusBar()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display absolute coordinates:
|
// Display absolute coordinates:
|
||||||
dXpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().x );
|
dXpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().x );
|
||||||
dYpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().y );
|
dYpos = To_User_Unit( g_UserUnit, GetCrossHairPosition().y );
|
||||||
|
|
||||||
// The following sadly is an if Eeschema/if Pcbnew
|
// The following sadly is an if Eeschema/if Pcbnew
|
||||||
wxString absformatter;
|
wxString absformatter;
|
||||||
|
@ -723,8 +735,8 @@ void PCB_BASE_FRAME::UpdateStatusBar()
|
||||||
if( !DisplayOpt.DisplayPolarCood ) // display relative cartesian coordinates
|
if( !DisplayOpt.DisplayPolarCood ) // display relative cartesian coordinates
|
||||||
{
|
{
|
||||||
// Display relative coordinates:
|
// Display relative coordinates:
|
||||||
dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x;
|
dx = GetCrossHairPosition().x - screen->m_O_Curseur.x;
|
||||||
dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y;
|
dy = GetCrossHairPosition().y - screen->m_O_Curseur.y;
|
||||||
dXpos = To_User_Unit( g_UserUnit, dx );
|
dXpos = To_User_Unit( g_UserUnit, dx );
|
||||||
dYpos = To_User_Unit( g_UserUnit, dy );
|
dYpos = To_User_Unit( g_UserUnit, dy );
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ private:
|
||||||
|
|
||||||
static bool InstallBlockCmdFrame( PCB_BASE_FRAME* parent, const wxString& title )
|
static bool InstallBlockCmdFrame( PCB_BASE_FRAME* parent, const wxString& title )
|
||||||
{
|
{
|
||||||
wxPoint oldpos = parent->GetScreen()->GetCrossHairPosition();
|
wxPoint oldpos = parent->GetCrossHairPosition();
|
||||||
|
|
||||||
parent->GetCanvas()->SetIgnoreMouseEvents( true );
|
parent->GetCanvas()->SetIgnoreMouseEvents( true );
|
||||||
DIALOG_BLOCK_OPTIONS * dlg = new DIALOG_BLOCK_OPTIONS( parent, title );
|
DIALOG_BLOCK_OPTIONS * dlg = new DIALOG_BLOCK_OPTIONS( parent, title );
|
||||||
|
@ -128,7 +128,7 @@ static bool InstallBlockCmdFrame( PCB_BASE_FRAME* parent, const wxString& title
|
||||||
int cmd = dlg->ShowModal();
|
int cmd = dlg->ShowModal();
|
||||||
dlg->Destroy();
|
dlg->Destroy();
|
||||||
|
|
||||||
parent->GetScreen()->SetCrossHairPosition( oldpos );
|
parent->SetCrossHairPosition( oldpos );
|
||||||
parent->GetCanvas()->MoveCursorToCrossHair();
|
parent->GetCanvas()->MoveCursorToCrossHair();
|
||||||
parent->GetCanvas()->SetIgnoreMouseEvents( false );
|
parent->GetCanvas()->SetIgnoreMouseEvents( false );
|
||||||
|
|
||||||
|
@ -232,9 +232,9 @@ void PCB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
|
||||||
case BLOCK_IDLE:
|
case BLOCK_IDLE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_DRAG: /* Drag */
|
case BLOCK_DRAG: // Drag
|
||||||
case BLOCK_MOVE: /* Move */
|
case BLOCK_MOVE: // Move
|
||||||
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
case BLOCK_PRESELECT_MOVE: // Move with preselection list
|
||||||
if( m_canvas->IsMouseCaptured() )
|
if( m_canvas->IsMouseCaptured() )
|
||||||
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
|
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
|
||||||
|
|
||||||
|
@ -242,7 +242,7 @@ void PCB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
|
||||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_COPY: /* Copy */
|
case BLOCK_COPY: // Copy
|
||||||
if( m_canvas->IsMouseCaptured() )
|
if( m_canvas->IsMouseCaptured() )
|
||||||
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
|
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
|
||||||
|
|
||||||
|
@ -315,35 +315,35 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
|
||||||
DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
|
DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_DRAG: /* Drag (not used, for future enhancements)*/
|
case BLOCK_DRAG: // Drag (not used, for future enhancements)
|
||||||
case BLOCK_MOVE: /* Move */
|
case BLOCK_MOVE: // Move
|
||||||
case BLOCK_COPY: /* Copy */
|
case BLOCK_COPY: // Copy
|
||||||
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
case BLOCK_PRESELECT_MOVE: // Move with preselection list
|
||||||
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_MOVE );
|
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_MOVE );
|
||||||
nextcmd = true;
|
nextcmd = true;
|
||||||
m_canvas->SetMouseCaptureCallback( drawMovingBlock );
|
m_canvas->SetMouseCaptureCallback( drawMovingBlock );
|
||||||
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
|
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_DELETE: /* Delete */
|
case BLOCK_DELETE: // Delete
|
||||||
m_canvas->SetMouseCaptureCallback( NULL );
|
m_canvas->SetMouseCaptureCallback( NULL );
|
||||||
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
|
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
|
||||||
Block_Delete();
|
Block_Delete();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_ROTATE: /* Rotation */
|
case BLOCK_ROTATE: // Rotation
|
||||||
m_canvas->SetMouseCaptureCallback( NULL );
|
m_canvas->SetMouseCaptureCallback( NULL );
|
||||||
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
|
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
|
||||||
Block_Rotate();
|
Block_Rotate();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_FLIP: /* Flip */
|
case BLOCK_FLIP: // Flip
|
||||||
m_canvas->SetMouseCaptureCallback( NULL );
|
m_canvas->SetMouseCaptureCallback( NULL );
|
||||||
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
|
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
|
||||||
Block_Flip();
|
Block_Flip();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_SAVE: /* Save (not used, for future enhancements)*/
|
case BLOCK_SAVE: // Save (not used, for future enhancements)
|
||||||
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
|
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_STOP );
|
||||||
|
|
||||||
if( GetScreen()->m_BlockLocate.GetCount() )
|
if( GetScreen()->m_BlockLocate.GetCount() )
|
||||||
|
@ -355,7 +355,7 @@ bool PCB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
|
||||||
case BLOCK_PASTE:
|
case BLOCK_PASTE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_ZOOM: /* Window Zoom */
|
case BLOCK_ZOOM: // Window Zoom
|
||||||
|
|
||||||
// Turn off the redraw block routine now so it is not displayed
|
// Turn off the redraw block routine now so it is not displayed
|
||||||
// with one corner at the new center of the screen
|
// with one corner at the new center of the screen
|
||||||
|
@ -577,7 +577,7 @@ static void drawMovingBlock( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
|
||||||
|
|
||||||
if( screen->m_BlockLocate.GetState() != STATE_BLOCK_STOP )
|
if( screen->m_BlockLocate.GetState() != STATE_BLOCK_STOP )
|
||||||
{
|
{
|
||||||
screen->m_BlockLocate.SetMoveVector( screen->GetCrossHairPosition() -
|
screen->m_BlockLocate.SetMoveVector( aPanel->GetParent()->GetCrossHairPosition() -
|
||||||
screen->m_BlockLocate.GetLastCursorPosition() );
|
screen->m_BlockLocate.GetLastCursorPosition() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -600,7 +600,7 @@ void PCB_EDIT_FRAME::Block_Delete()
|
||||||
PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems();
|
PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems();
|
||||||
itemsList->m_Status = UR_DELETED;
|
itemsList->m_Status = UR_DELETED;
|
||||||
|
|
||||||
/* unlink items and clear flags */
|
// unlink items and clear flags
|
||||||
for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
|
for( unsigned ii = 0; ii < itemsList->GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
|
BOARD_ITEM* item = (BOARD_ITEM*) itemsList->GetPickedItem( ii );
|
||||||
|
@ -658,7 +658,7 @@ void PCB_EDIT_FRAME::Block_Rotate()
|
||||||
wxPoint centre; // rotation cent-re for the rotation transform
|
wxPoint centre; // rotation cent-re for the rotation transform
|
||||||
int rotAngle = 900; // rotation angle in 0.1 deg.
|
int rotAngle = 900; // rotation angle in 0.1 deg.
|
||||||
|
|
||||||
oldpos = GetScreen()->GetCrossHairPosition();
|
oldpos = GetCrossHairPosition();
|
||||||
centre = GetScreen()->m_BlockLocate.Centre();
|
centre = GetScreen()->m_BlockLocate.Centre();
|
||||||
|
|
||||||
OnModify();
|
OnModify();
|
||||||
|
@ -680,7 +680,7 @@ void PCB_EDIT_FRAME::Block_Rotate()
|
||||||
m_Pcb->m_Status_Pcb = 0;
|
m_Pcb->m_Status_Pcb = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Move and rotate the track segments */
|
// Move and rotate the track segments
|
||||||
case PCB_TRACE_T: // a track segment (segment on a copper layer)
|
case PCB_TRACE_T: // a track segment (segment on a copper layer)
|
||||||
case PCB_VIA_T: // a via (like track segment on a copper layer)
|
case PCB_VIA_T: // a via (like track segment on a copper layer)
|
||||||
m_Pcb->m_Status_Pcb = 0;
|
m_Pcb->m_Status_Pcb = 0;
|
||||||
|
@ -716,14 +716,14 @@ void PCB_EDIT_FRAME::Block_Flip()
|
||||||
{
|
{
|
||||||
#define INVERT( pos ) (pos) = center.y - ( (pos) - center.y )
|
#define INVERT( pos ) (pos) = center.y - ( (pos) - center.y )
|
||||||
wxPoint memo;
|
wxPoint memo;
|
||||||
wxPoint center; /* Position of the axis for inversion of all elements */
|
wxPoint center; // Position of the axis for inversion of all elements
|
||||||
|
|
||||||
OnModify();
|
OnModify();
|
||||||
|
|
||||||
PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems();
|
PICKED_ITEMS_LIST* itemsList = &GetScreen()->m_BlockLocate.GetItems();
|
||||||
itemsList->m_Status = UR_FLIPPED;
|
itemsList->m_Status = UR_FLIPPED;
|
||||||
|
|
||||||
memo = GetScreen()->GetCrossHairPosition();
|
memo = GetCrossHairPosition();
|
||||||
|
|
||||||
center = GetScreen()->m_BlockLocate.Centre();
|
center = GetScreen()->m_BlockLocate.Centre();
|
||||||
|
|
||||||
|
@ -741,7 +741,7 @@ void PCB_EDIT_FRAME::Block_Flip()
|
||||||
m_Pcb->m_Status_Pcb = 0;
|
m_Pcb->m_Status_Pcb = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Move and rotate the track segments */
|
// Move and rotate the track segments
|
||||||
case PCB_TRACE_T: // a track segment (segment on a copper layer)
|
case PCB_TRACE_T: // a track segment (segment on a copper layer)
|
||||||
case PCB_VIA_T: // a via (like track segment on a copper layer)
|
case PCB_VIA_T: // a via (like track segment on a copper layer)
|
||||||
m_Pcb->m_Status_Pcb = 0;
|
m_Pcb->m_Status_Pcb = 0;
|
||||||
|
@ -795,7 +795,7 @@ void PCB_EDIT_FRAME::Block_Move()
|
||||||
item->ClearFlags();
|
item->ClearFlags();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Move track segments */
|
// Move track segments
|
||||||
case PCB_TRACE_T: // a track segment (segment on a copper layer)
|
case PCB_TRACE_T: // a track segment (segment on a copper layer)
|
||||||
case PCB_VIA_T: // a via (like a track segment on a copper layer)
|
case PCB_VIA_T: // a via (like a track segment on a copper layer)
|
||||||
m_Pcb->m_Status_Pcb = 0;
|
m_Pcb->m_Status_Pcb = 0;
|
||||||
|
|
|
@ -127,12 +127,14 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
|
||||||
{
|
{
|
||||||
BLOCK_STATE_T state = GetScreen()->m_BlockLocate.GetState();
|
BLOCK_STATE_T state = GetScreen()->m_BlockLocate.GetState();
|
||||||
BLOCK_COMMAND_T command = GetScreen()->m_BlockLocate.GetCommand();
|
BLOCK_COMMAND_T command = GetScreen()->m_BlockLocate.GetCommand();
|
||||||
|
|
||||||
m_canvas->CallEndMouseCapture( DC );
|
m_canvas->CallEndMouseCapture( DC );
|
||||||
GetScreen()->m_BlockLocate.SetState( state );
|
GetScreen()->m_BlockLocate.SetState( state );
|
||||||
GetScreen()->m_BlockLocate.SetCommand( command );
|
GetScreen()->m_BlockLocate.SetCommand( command );
|
||||||
m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
|
m_canvas->SetMouseCapture( DrawAndSizingBlockOutlines, AbortBlockCurrentCommand );
|
||||||
GetScreen()->SetCrossHairPosition( wxPoint( GetScreen()->m_BlockLocate.GetRight(),
|
|
||||||
GetScreen()->m_BlockLocate.GetBottom() ) );
|
SetCrossHairPosition( wxPoint( GetScreen()->m_BlockLocate.GetRight(),
|
||||||
|
GetScreen()->m_BlockLocate.GetBottom() ) );
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,9 +144,9 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
|
||||||
DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
|
DisplayError( this, wxT( "Error in HandleBlockPLace" ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_DRAG: /* Drag */
|
case BLOCK_DRAG: // Drag
|
||||||
case BLOCK_MOVE: /* Move */
|
case BLOCK_MOVE: // Move
|
||||||
case BLOCK_COPY: /* Copy */
|
case BLOCK_COPY: // Copy
|
||||||
itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate );
|
itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate );
|
||||||
|
|
||||||
if( itemsCount )
|
if( itemsCount )
|
||||||
|
@ -164,13 +166,13 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
case BLOCK_PRESELECT_MOVE: // Move with preselection list
|
||||||
nextcmd = true;
|
nextcmd = true;
|
||||||
m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines );
|
m_canvas->SetMouseCaptureCallback( DrawMovingBlockOutlines );
|
||||||
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_MOVE );
|
GetScreen()->m_BlockLocate.SetState( STATE_BLOCK_MOVE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_DELETE: /* Delete */
|
case BLOCK_DELETE: // Delete
|
||||||
itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate );
|
itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate );
|
||||||
|
|
||||||
if( itemsCount )
|
if( itemsCount )
|
||||||
|
@ -179,7 +181,7 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
|
||||||
DeleteMarkedItems( currentModule );
|
DeleteMarkedItems( currentModule );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_SAVE: /* Save */
|
case BLOCK_SAVE: // Save
|
||||||
case BLOCK_PASTE:
|
case BLOCK_PASTE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -195,7 +197,7 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
|
||||||
|
|
||||||
case BLOCK_MIRROR_X:
|
case BLOCK_MIRROR_X:
|
||||||
case BLOCK_MIRROR_Y:
|
case BLOCK_MIRROR_Y:
|
||||||
case BLOCK_FLIP: /* mirror */
|
case BLOCK_FLIP: // mirror
|
||||||
itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate );
|
itemsCount = MarkItemsInBloc( currentModule, GetScreen()->m_BlockLocate );
|
||||||
|
|
||||||
if( itemsCount )
|
if( itemsCount )
|
||||||
|
@ -204,7 +206,7 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
|
||||||
MirrorMarkedItems( currentModule, GetScreen()->m_BlockLocate.Centre() );
|
MirrorMarkedItems( currentModule, GetScreen()->m_BlockLocate.Centre() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_ZOOM: /* Window Zoom */
|
case BLOCK_ZOOM: // Window Zoom
|
||||||
Window_Zoom( GetScreen()->m_BlockLocate );
|
Window_Zoom( GetScreen()->m_BlockLocate );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -249,28 +251,28 @@ void FOOTPRINT_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
|
||||||
case BLOCK_IDLE:
|
case BLOCK_IDLE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_DRAG: /* Drag */
|
case BLOCK_DRAG: // Drag
|
||||||
case BLOCK_MOVE: /* Move */
|
case BLOCK_MOVE: // Move
|
||||||
case BLOCK_PRESELECT_MOVE: /* Move with preselection list*/
|
case BLOCK_PRESELECT_MOVE: // Move with preselection list
|
||||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||||
SaveCopyInUndoList( currentModule, UR_MODEDIT );
|
SaveCopyInUndoList( currentModule, UR_MODEDIT );
|
||||||
MoveMarkedItems( currentModule, GetScreen()->m_BlockLocate.GetMoveVector() );
|
MoveMarkedItems( currentModule, GetScreen()->m_BlockLocate.GetMoveVector() );
|
||||||
m_canvas->Refresh( true );
|
m_canvas->Refresh( true );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_COPY: /* Copy */
|
case BLOCK_COPY: // Copy
|
||||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||||
SaveCopyInUndoList( currentModule, UR_MODEDIT );
|
SaveCopyInUndoList( currentModule, UR_MODEDIT );
|
||||||
CopyMarkedItems( currentModule, GetScreen()->m_BlockLocate.GetMoveVector() );
|
CopyMarkedItems( currentModule, GetScreen()->m_BlockLocate.GetMoveVector() );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_PASTE: /* Paste */
|
case BLOCK_PASTE: // Paste
|
||||||
GetScreen()->m_BlockLocate.ClearItemsList();
|
GetScreen()->m_BlockLocate.ClearItemsList();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK_MIRROR_X:
|
case BLOCK_MIRROR_X:
|
||||||
case BLOCK_MIRROR_Y:
|
case BLOCK_MIRROR_Y:
|
||||||
case BLOCK_FLIP: /* Mirror by popup menu, from block move */
|
case BLOCK_FLIP: // Mirror by popup menu, from block move
|
||||||
SaveCopyInUndoList( currentModule, UR_MODEDIT );
|
SaveCopyInUndoList( currentModule, UR_MODEDIT );
|
||||||
MirrorMarkedItems( currentModule, GetScreen()->m_BlockLocate.Centre() );
|
MirrorMarkedItems( currentModule, GetScreen()->m_BlockLocate.Centre() );
|
||||||
break;
|
break;
|
||||||
|
@ -304,8 +306,8 @@ void FOOTPRINT_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
|
||||||
static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
||||||
bool aErase )
|
bool aErase )
|
||||||
{
|
{
|
||||||
BASE_SCREEN* screen = aPanel->GetScreen();
|
BASE_SCREEN* screen = aPanel->GetScreen();
|
||||||
FOOTPRINT_EDIT_FRAME * moduleEditFrame = FOOTPRINT_EDIT_FRAME::GetActiveFootprintEditor();
|
FOOTPRINT_EDIT_FRAME* moduleEditFrame = FOOTPRINT_EDIT_FRAME::GetActiveFootprintEditor();
|
||||||
|
|
||||||
wxASSERT( moduleEditFrame );
|
wxASSERT( moduleEditFrame );
|
||||||
MODULE* currentModule = moduleEditFrame->GetBoard()->m_Modules;
|
MODULE* currentModule = moduleEditFrame->GetBoard()->m_Modules;
|
||||||
|
@ -319,7 +321,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
|
||||||
|
|
||||||
if( currentModule )
|
if( currentModule )
|
||||||
{
|
{
|
||||||
wxPoint move_offset = -block->GetMoveVector();
|
wxPoint move_offset = -block->GetMoveVector();
|
||||||
BOARD_ITEM* item = currentModule->GraphicalItems();
|
BOARD_ITEM* item = currentModule->GraphicalItems();
|
||||||
|
|
||||||
for( ; item != NULL; item = item->Next() )
|
for( ; item != NULL; item = item->Next() )
|
||||||
|
@ -351,15 +353,15 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Repaint new view. */
|
// Repaint new view.
|
||||||
block->SetMoveVector( screen->GetCrossHairPosition() - block->GetLastCursorPosition() );
|
block->SetMoveVector( moduleEditFrame->GetCrossHairPosition() - block->GetLastCursorPosition() );
|
||||||
|
|
||||||
block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
|
block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
|
||||||
|
|
||||||
if( currentModule )
|
if( currentModule )
|
||||||
{
|
{
|
||||||
BOARD_ITEM* item = currentModule->GraphicalItems();
|
BOARD_ITEM* item = currentModule->GraphicalItems();
|
||||||
wxPoint move_offset = - block->GetMoveVector();
|
wxPoint move_offset = - block->GetMoveVector();
|
||||||
|
|
||||||
for( ; item != NULL; item = item->Next() )
|
for( ; item != NULL; item = item->Next() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -215,6 +215,8 @@ private:
|
||||||
ZONE_CONTAINERS m_ZoneDescriptorList;
|
ZONE_CONTAINERS m_ZoneDescriptorList;
|
||||||
|
|
||||||
LAYER m_Layer[NB_LAYERS];
|
LAYER m_Layer[NB_LAYERS];
|
||||||
|
|
||||||
|
wxPoint m_grid_origin;
|
||||||
// if true m_highLight_NetCode is used
|
// if true m_highLight_NetCode is used
|
||||||
HIGH_LIGHT_INFO m_highLight; // current high light data
|
HIGH_LIGHT_INFO m_highLight; // current high light data
|
||||||
HIGH_LIGHT_INFO m_highLightPrevious; // a previously stored high light data
|
HIGH_LIGHT_INFO m_highLightPrevious; // a previously stored high light data
|
||||||
|
@ -231,9 +233,6 @@ private:
|
||||||
TITLE_BLOCK m_titles; ///< text in lower right of screen and plots
|
TITLE_BLOCK m_titles; ///< text in lower right of screen and plots
|
||||||
PCB_PLOT_PARAMS m_plotOptions;
|
PCB_PLOT_PARAMS m_plotOptions;
|
||||||
|
|
||||||
/// Position of the origin axis, which is used in exports mostly
|
|
||||||
wxPoint m_originAxisPosition;
|
|
||||||
|
|
||||||
/// Number of pads connected to the current net.
|
/// Number of pads connected to the current net.
|
||||||
int m_nodeCount;
|
int m_nodeCount;
|
||||||
|
|
||||||
|
@ -387,6 +386,20 @@ public:
|
||||||
return (int) m_markers.size();
|
return (int) m_markers.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function SetAuxOrigin
|
||||||
|
* sets the origin point used for plotting.
|
||||||
|
*/
|
||||||
|
void SetAuxOrigin( const wxPoint& aPoint ) { m_designSettings.m_AuxOrigin = aPoint; }
|
||||||
|
const wxPoint& GetAuxOrigin() const { return m_designSettings.m_AuxOrigin; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function SetGridOrigin
|
||||||
|
* sets the origin point of the grid.
|
||||||
|
*/
|
||||||
|
void SetGridOrigin( const wxPoint& aPoint ) { m_designSettings.m_GridOrigin = aPoint; }
|
||||||
|
const wxPoint& GetGridOrigin() const { return m_designSettings.m_GridOrigin; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ResetHighLight
|
* Function ResetHighLight
|
||||||
* Reset all high light data to the init state
|
* Reset all high light data to the init state
|
||||||
|
@ -594,9 +607,6 @@ public:
|
||||||
const PCB_PLOT_PARAMS& GetPlotOptions() const { return m_plotOptions; }
|
const PCB_PLOT_PARAMS& GetPlotOptions() const { return m_plotOptions; }
|
||||||
void SetPlotOptions( const PCB_PLOT_PARAMS& aOptions ) { m_plotOptions = aOptions; }
|
void SetPlotOptions( const PCB_PLOT_PARAMS& aOptions ) { m_plotOptions = aOptions; }
|
||||||
|
|
||||||
const wxPoint& GetOriginAxisPosition() const { return m_originAxisPosition; }
|
|
||||||
void SetOriginAxisPosition( const wxPoint& aPosition ) { m_originAxisPosition = aPosition; }
|
|
||||||
|
|
||||||
TITLE_BLOCK& GetTitleBlock() { return m_titles; }
|
TITLE_BLOCK& GetTitleBlock() { return m_titles; }
|
||||||
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; }
|
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; }
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Collector->Collect( m_Pcb, scanList, GetScreen()->RefPos( true ), guide );
|
m_Collector->Collect( m_Pcb, scanList, RefPos( true ), guide );
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// debugging: print out the collected items, showing their priority order too.
|
// debugging: print out the collected items, showing their priority order too.
|
||||||
|
@ -161,7 +161,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
|
||||||
if( item->Type() != PCB_ZONE_T )
|
if( item->Type() != PCB_ZONE_T )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Found a TYPE ZONE */
|
// Found a TYPE ZONE
|
||||||
if( item->GetTimeStamp() == timestampzone ) // Remove it, redundant, zone already found
|
if( item->GetTimeStamp() == timestampzone ) // Remove it, redundant, zone already found
|
||||||
{
|
{
|
||||||
m_Collector->Remove( ii );
|
m_Collector->Remove( ii );
|
||||||
|
@ -200,7 +200,7 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
|
||||||
{
|
{
|
||||||
wxMenu itemMenu;
|
wxMenu itemMenu;
|
||||||
|
|
||||||
/* Give a title to the selection menu. This is also a cancel menu item */
|
// Give a title to the selection menu. This is also a cancel menu item
|
||||||
wxMenuItem * item_title = new wxMenuItem( &itemMenu, -1, _( "Selection Clarification" ) );
|
wxMenuItem * item_title = new wxMenuItem( &itemMenu, -1, _( "Selection Clarification" ) );
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
|
@ -269,9 +269,9 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
|
||||||
snapToGrid = false;
|
snapToGrid = false;
|
||||||
|
|
||||||
if( snapToGrid )
|
if( snapToGrid )
|
||||||
pos = GetScreen()->GetNearestGridPosition( pos );
|
pos = GetNearestGridPosition( pos );
|
||||||
|
|
||||||
oldpos = GetScreen()->GetCrossHairPosition();
|
oldpos = GetCrossHairPosition();
|
||||||
|
|
||||||
gridSize = GetScreen()->GetGridSize();
|
gridSize = GetScreen()->GetGridSize();
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
|
||||||
}
|
}
|
||||||
|
|
||||||
// Put cursor in new position, according to the zoom keys (if any).
|
// Put cursor in new position, according to the zoom keys (if any).
|
||||||
GetScreen()->SetCrossHairPosition( pos, snapToGrid );
|
SetCrossHairPosition( pos, snapToGrid );
|
||||||
|
|
||||||
/* Put cursor on grid or a pad centre if requested. If the tool DELETE is active the
|
/* Put cursor on grid or a pad centre if requested. If the tool DELETE is active the
|
||||||
* cursor is left off grid this is better to reach items to delete off grid,
|
* cursor is left off grid this is better to reach items to delete off grid,
|
||||||
|
@ -326,7 +326,7 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
|
||||||
|
|
||||||
if( Magnetize( this, GetToolId(), igridsize, curs_pos, &pos ) )
|
if( Magnetize( this, GetToolId(), igridsize, curs_pos, &pos ) )
|
||||||
{
|
{
|
||||||
GetScreen()->SetCrossHairPosition( pos, false );
|
SetCrossHairPosition( pos, false );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -335,19 +335,19 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
|
||||||
if( !g_Drc_On || !g_CurrentTrackSegment ||
|
if( !g_Drc_On || !g_CurrentTrackSegment ||
|
||||||
(BOARD_ITEM*)g_CurrentTrackSegment != this->GetCurItem() ||
|
(BOARD_ITEM*)g_CurrentTrackSegment != this->GetCurItem() ||
|
||||||
!LocateIntrusion( m_Pcb->m_Track, g_CurrentTrackSegment,
|
!LocateIntrusion( m_Pcb->m_Track, g_CurrentTrackSegment,
|
||||||
GetScreen()->m_Active_Layer, GetScreen()->RefPos( true ) ) )
|
GetScreen()->m_Active_Layer, RefPos( true ) ) )
|
||||||
{
|
{
|
||||||
GetScreen()->SetCrossHairPosition( curs_pos, snapToGrid );
|
SetCrossHairPosition( curs_pos, snapToGrid );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if( oldpos != GetScreen()->GetCrossHairPosition() )
|
if( oldpos != GetCrossHairPosition() )
|
||||||
{
|
{
|
||||||
pos = GetScreen()->GetCrossHairPosition();
|
pos = GetCrossHairPosition();
|
||||||
GetScreen()->SetCrossHairPosition( oldpos, false );
|
SetCrossHairPosition( oldpos, false );
|
||||||
m_canvas->CrossHairOff( aDC );
|
m_canvas->CrossHairOff( aDC );
|
||||||
GetScreen()->SetCrossHairPosition( pos, false );
|
SetCrossHairPosition( pos, false );
|
||||||
m_canvas->CrossHairOn( aDC );
|
m_canvas->CrossHairOn( aDC );
|
||||||
|
|
||||||
if( m_canvas->IsMouseCaptured() )
|
if( m_canvas->IsMouseCaptured() )
|
||||||
|
@ -373,5 +373,5 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
|
||||||
OnHotKey( aDC, aHotKey, aPosition );
|
OnHotKey( aDC, aHotKey, aPosition );
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateStatusBar(); /* Display new cursor coordinates */
|
UpdateStatusBar(); // Display new cursor coordinates
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ void RemoteCommand( const char* cmdline )
|
||||||
pos = pad->GetPosition();
|
pos = pad->GetPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( netcode > 0 ) /* highlight the pad net*/
|
if( netcode > 0 ) // highlight the pad net
|
||||||
{
|
{
|
||||||
pcb->HighLightON();
|
pcb->HighLightON();
|
||||||
pcb->SetHighLightNet( netcode );
|
pcb->SetHighLightNet( netcode );
|
||||||
|
@ -127,7 +127,7 @@ void RemoteCommand( const char* cmdline )
|
||||||
|
|
||||||
if( module ) // if found, center the module on screen, and redraw the screen.
|
if( module ) // if found, center the module on screen, and redraw the screen.
|
||||||
{
|
{
|
||||||
frame->GetScreen()->SetCrossHairPosition(pos);
|
frame->SetCrossHairPosition( pos );
|
||||||
frame->RedrawScreen( pos, false );
|
frame->RedrawScreen( pos, false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -317,7 +317,7 @@ bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName )
|
||||||
m_plotOpts.SetValueColor( color );
|
m_plotOpts.SetValueColor( color );
|
||||||
|
|
||||||
PAGE_INFO pageInfo = m_board->GetPageSettings();
|
PAGE_INFO pageInfo = m_board->GetPageSettings();
|
||||||
wxPoint axisorigin = m_board->GetOriginAxisPosition();
|
wxPoint axisorigin = m_board->GetAuxOrigin();
|
||||||
|
|
||||||
if( PageIsBoardBoundarySize() )
|
if( PageIsBoardBoundarySize() )
|
||||||
{
|
{
|
||||||
|
@ -328,7 +328,7 @@ bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName )
|
||||||
m_board->SetPageSettings( currpageInfo );
|
m_board->SetPageSettings( currpageInfo );
|
||||||
m_plotOpts.SetUseAuxOrigin( true );
|
m_plotOpts.SetUseAuxOrigin( true );
|
||||||
wxPoint origin = bbox.GetOrigin();
|
wxPoint origin = bbox.GetOrigin();
|
||||||
m_board->SetOriginAxisPosition( origin );
|
m_board->SetAuxOrigin( origin );
|
||||||
}
|
}
|
||||||
|
|
||||||
LOCALE_IO toggle;
|
LOCALE_IO toggle;
|
||||||
|
@ -344,7 +344,7 @@ bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName )
|
||||||
}
|
}
|
||||||
|
|
||||||
delete plotter;
|
delete plotter;
|
||||||
m_board->SetOriginAxisPosition( axisorigin );
|
m_board->SetAuxOrigin( axisorigin );
|
||||||
m_board->SetPageSettings( pageInfo );
|
m_board->SetPageSettings( pageInfo );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -85,7 +85,7 @@ DIALOG_MODULE_BOARD_EDITOR::~DIALOG_MODULE_BOARD_EDITOR()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Creation of the panel properties of the module editor. */
|
// Creation of the panel properties of the module editor.
|
||||||
void DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties()
|
void DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties()
|
||||||
{
|
{
|
||||||
PutValueInLocalUnits( *m_ModPositionX, m_CurrentModule->GetPosition().x );
|
PutValueInLocalUnits( *m_ModPositionX, m_CurrentModule->GetPosition().x );
|
||||||
|
@ -244,7 +244,7 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties()
|
||||||
|
|
||||||
m_LastSelected3DShapeIndex = -1;
|
m_LastSelected3DShapeIndex = -1;
|
||||||
|
|
||||||
/* Init 3D shape list */
|
// Init 3D shape list
|
||||||
S3D_MASTER* draw3D = m_CurrentModule->Models();
|
S3D_MASTER* draw3D = m_CurrentModule->Models();
|
||||||
|
|
||||||
while( draw3D )
|
while( draw3D )
|
||||||
|
@ -276,7 +276,7 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties()
|
||||||
_( "Use this attribute for \"virtual\" components drawn on board\n"
|
_( "Use this attribute for \"virtual\" components drawn on board\n"
|
||||||
"(like a old ISA PC bus connector)" ) );
|
"(like a old ISA PC bus connector)" ) );
|
||||||
|
|
||||||
/* Controls on right side of the dialog */
|
// Controls on right side of the dialog
|
||||||
switch( m_CurrentModule->GetAttributes() & 255 )
|
switch( m_CurrentModule->GetAttributes() & 255 )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -601,7 +601,7 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
|
||||||
if( change_layer )
|
if( change_layer )
|
||||||
m_CurrentModule->Flip( m_CurrentModule->GetPosition() );
|
m_CurrentModule->Flip( m_CurrentModule->GetPosition() );
|
||||||
|
|
||||||
/* Update 3D shape list */
|
// Update 3D shape list
|
||||||
int ii = m_3D_ShapeNameListBox->GetSelection();
|
int ii = m_3D_ShapeNameListBox->GetSelection();
|
||||||
|
|
||||||
if( ii >= 0 )
|
if( ii >= 0 )
|
||||||
|
@ -660,23 +660,23 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
|
||||||
|
|
||||||
void DIALOG_MODULE_BOARD_EDITOR::OnEditReference( wxCommandEvent& event )
|
void DIALOG_MODULE_BOARD_EDITOR::OnEditReference( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxPoint tmp = m_Parent->GetScreen()->GetCrossHairPosition();
|
wxPoint tmp = m_Parent->GetCrossHairPosition();
|
||||||
|
|
||||||
m_Parent->GetScreen()->SetCrossHairPosition( m_ReferenceCopy->GetTextPosition() );
|
m_Parent->SetCrossHairPosition( m_ReferenceCopy->GetTextPosition() );
|
||||||
m_ReferenceCopy->SetParent( m_CurrentModule );
|
m_ReferenceCopy->SetParent( m_CurrentModule );
|
||||||
m_Parent->InstallTextModOptionsFrame( m_ReferenceCopy, NULL );
|
m_Parent->InstallTextModOptionsFrame( m_ReferenceCopy, NULL );
|
||||||
m_Parent->GetScreen()->SetCrossHairPosition( tmp );
|
m_Parent->SetCrossHairPosition( tmp );
|
||||||
m_ReferenceCtrl->SetValue( m_ReferenceCopy->GetText() );
|
m_ReferenceCtrl->SetValue( m_ReferenceCopy->GetText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DIALOG_MODULE_BOARD_EDITOR::OnEditValue( wxCommandEvent& event )
|
void DIALOG_MODULE_BOARD_EDITOR::OnEditValue( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxPoint tmp = m_Parent->GetScreen()->GetCrossHairPosition();
|
wxPoint tmp = m_Parent->GetCrossHairPosition();
|
||||||
|
|
||||||
m_Parent->GetScreen()->SetCrossHairPosition( m_ValueCopy->GetTextPosition() );
|
m_Parent->SetCrossHairPosition( m_ValueCopy->GetTextPosition() );
|
||||||
m_ValueCopy->SetParent( m_CurrentModule );
|
m_ValueCopy->SetParent( m_CurrentModule );
|
||||||
m_Parent->InstallTextModOptionsFrame( m_ValueCopy, NULL );
|
m_Parent->InstallTextModOptionsFrame( m_ValueCopy, NULL );
|
||||||
m_Parent->GetScreen()->SetCrossHairPosition( tmp );
|
m_Parent->SetCrossHairPosition( tmp );
|
||||||
m_ValueCtrl->SetValue( m_ValueCopy->GetText() );
|
m_ValueCtrl->SetValue( m_ValueCopy->GetText() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,9 +84,7 @@ DIALOG_MODULE_MODULE_EDITOR::~DIALOG_MODULE_MODULE_EDITOR()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************/
|
|
||||||
void DIALOG_MODULE_MODULE_EDITOR::initModeditProperties()
|
void DIALOG_MODULE_MODULE_EDITOR::initModeditProperties()
|
||||||
/********************************************************/
|
|
||||||
{
|
{
|
||||||
SetFocus();
|
SetFocus();
|
||||||
|
|
||||||
|
@ -213,8 +211,7 @@ void DIALOG_MODULE_MODULE_EDITOR::initModeditProperties()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Initialize 3D info displayed in dialog box from values in aStruct3DSource
|
// Initialize 3D info displayed in dialog box from values in aStruct3DSource
|
||||||
*/
|
|
||||||
void DIALOG_MODULE_MODULE_EDITOR::Transfert3DValuesToDisplay( S3D_MASTER * aStruct3DSource )
|
void DIALOG_MODULE_MODULE_EDITOR::Transfert3DValuesToDisplay( S3D_MASTER * aStruct3DSource )
|
||||||
{
|
{
|
||||||
if( aStruct3DSource )
|
if( aStruct3DSource )
|
||||||
|
@ -247,9 +244,8 @@ void DIALOG_MODULE_MODULE_EDITOR::TransfertDisplayTo3DValues( int aIndexSelectio
|
||||||
struct3DDest->m_MatPosition = m_3D_Offset->GetValue();
|
struct3DDest->m_MatPosition = m_3D_Offset->GetValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************/
|
|
||||||
void DIALOG_MODULE_MODULE_EDITOR::On3DShapeNameSelected(wxCommandEvent& event)
|
void DIALOG_MODULE_MODULE_EDITOR::On3DShapeNameSelected(wxCommandEvent& event)
|
||||||
/***********************************************************/
|
|
||||||
{
|
{
|
||||||
if( m_lastSelected3DShapeIndex >= 0 )
|
if( m_lastSelected3DShapeIndex >= 0 )
|
||||||
TransfertDisplayTo3DValues( m_lastSelected3DShapeIndex );
|
TransfertDisplayTo3DValues( m_lastSelected3DShapeIndex );
|
||||||
|
@ -268,9 +264,7 @@ void DIALOG_MODULE_MODULE_EDITOR::On3DShapeNameSelected(wxCommandEvent& event)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
|
||||||
void DIALOG_MODULE_MODULE_EDITOR::Remove3DShape(wxCommandEvent& event)
|
void DIALOG_MODULE_MODULE_EDITOR::Remove3DShape(wxCommandEvent& event)
|
||||||
/***********************************************************/
|
|
||||||
{
|
{
|
||||||
if( m_lastSelected3DShapeIndex >= 0 )
|
if( m_lastSelected3DShapeIndex >= 0 )
|
||||||
TransfertDisplayTo3DValues( m_lastSelected3DShapeIndex );
|
TransfertDisplayTo3DValues( m_lastSelected3DShapeIndex );
|
||||||
|
@ -293,9 +287,7 @@ void DIALOG_MODULE_MODULE_EDITOR::Remove3DShape(wxCommandEvent& event)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
|
||||||
void DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DLib( wxCommandEvent& event )
|
void DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DLib( wxCommandEvent& event )
|
||||||
/*********************************************************************/
|
|
||||||
{
|
{
|
||||||
wxString fullfilename, shortfilename;
|
wxString fullfilename, shortfilename;
|
||||||
wxString fullpath;
|
wxString fullpath;
|
||||||
|
@ -364,16 +356,13 @@ void DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DLib( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************/
|
|
||||||
void DIALOG_MODULE_MODULE_EDITOR::OnCancelClick( wxCommandEvent& event )
|
void DIALOG_MODULE_MODULE_EDITOR::OnCancelClick( wxCommandEvent& event )
|
||||||
/**********************************************************************/
|
|
||||||
{
|
{
|
||||||
EndModal( -1 );
|
EndModal( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event )
|
void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event )
|
||||||
/******************************************************************************/
|
|
||||||
{
|
{
|
||||||
// First, test for invalid chars in module name
|
// First, test for invalid chars in module name
|
||||||
wxString footprintName = m_FootprintNameCtrl->GetValue();
|
wxString footprintName = m_FootprintNameCtrl->GetValue();
|
||||||
|
@ -486,25 +475,22 @@ void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
void DIALOG_MODULE_MODULE_EDITOR::OnEditReference(wxCommandEvent& event)
|
void DIALOG_MODULE_MODULE_EDITOR::OnEditReference(wxCommandEvent& event)
|
||||||
/***********************************************************************/
|
|
||||||
{
|
{
|
||||||
wxPoint tmp = m_parent->GetScreen()->GetCrossHairPosition();
|
wxPoint tmp = m_parent->GetCrossHairPosition();
|
||||||
m_parent->GetScreen()->SetCrossHairPosition( m_referenceCopy->GetTextPosition() );
|
m_parent->SetCrossHairPosition( m_referenceCopy->GetTextPosition() );
|
||||||
m_parent->InstallTextModOptionsFrame( m_referenceCopy, NULL );
|
m_parent->InstallTextModOptionsFrame( m_referenceCopy, NULL );
|
||||||
m_parent->GetScreen()->SetCrossHairPosition( tmp );
|
m_parent->SetCrossHairPosition( tmp );
|
||||||
m_ReferenceCtrl->SetValue( m_referenceCopy->GetText() );
|
m_ReferenceCtrl->SetValue( m_referenceCopy->GetText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************/
|
|
||||||
void DIALOG_MODULE_MODULE_EDITOR::OnEditValue(wxCommandEvent& event)
|
void DIALOG_MODULE_MODULE_EDITOR::OnEditValue(wxCommandEvent& event)
|
||||||
/***********************************************************/
|
|
||||||
{
|
{
|
||||||
wxPoint tmp = m_parent->GetScreen()->GetCrossHairPosition();
|
wxPoint tmp = m_parent->GetCrossHairPosition();
|
||||||
m_parent->GetScreen()->SetCrossHairPosition( m_valueCopy->GetTextPosition() );
|
m_parent->SetCrossHairPosition( m_valueCopy->GetTextPosition() );
|
||||||
m_parent->InstallTextModOptionsFrame( m_valueCopy, NULL );
|
m_parent->InstallTextModOptionsFrame( m_valueCopy, NULL );
|
||||||
m_parent->GetScreen()->SetCrossHairPosition( tmp );
|
m_parent->SetCrossHairPosition( tmp );
|
||||||
m_ValueCtrl->SetValue( m_valueCopy->GetText() );
|
m_ValueCtrl->SetValue( m_valueCopy->GetText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -321,7 +321,7 @@ void DIALOG_GENDRILL::SetParams()
|
||||||
if( m_Choice_Drill_Offset->GetSelection() == 0 )
|
if( m_Choice_Drill_Offset->GetSelection() == 0 )
|
||||||
m_FileDrillOffset = wxPoint( 0, 0 );
|
m_FileDrillOffset = wxPoint( 0, 0 );
|
||||||
else
|
else
|
||||||
m_FileDrillOffset = m_parent->GetOriginAxisPosition();
|
m_FileDrillOffset = m_parent->GetAuxOrigin();
|
||||||
|
|
||||||
if( m_UnitDrillIsInch )
|
if( m_UnitDrillIsInch )
|
||||||
m_Precision = precisionListForInches;
|
m_Precision = precisionListForInches;
|
||||||
|
|
|
@ -201,14 +201,21 @@ void DIALOG_SET_GRID::OnOkClick( wxCommandEvent& event )
|
||||||
|
|
||||||
bool PCB_BASE_FRAME::InvokeDialogGrid()
|
bool PCB_BASE_FRAME::InvokeDialogGrid()
|
||||||
{
|
{
|
||||||
|
wxPoint grid_origin = GetGridOrigin();
|
||||||
|
|
||||||
DIALOG_SET_GRID dlg( this, &m_UserGridUnit, g_UserUnit, &m_UserGridSize,
|
DIALOG_SET_GRID dlg( this, &m_UserGridUnit, g_UserUnit, &m_UserGridSize,
|
||||||
&GetScreen()->m_GridOrigin, &m_FastGrid1, &m_FastGrid2,
|
&grid_origin, &m_FastGrid1, &m_FastGrid2,
|
||||||
m_gridSelectBox->GetStrings() );
|
m_gridSelectBox->GetStrings() );
|
||||||
|
|
||||||
int ret = dlg.ShowModal();
|
int ret = dlg.ShowModal();
|
||||||
|
|
||||||
if( ret == wxID_OK )
|
if( ret == wxID_OK )
|
||||||
{
|
{
|
||||||
|
if( GetGridOrigin() != grid_origin && IsType( PCB_FRAME_TYPE ) )
|
||||||
|
OnModify(); // because grid origin is saved in board, show as modified
|
||||||
|
|
||||||
|
SetGridOrigin( grid_origin );
|
||||||
|
|
||||||
GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnit, ID_POPUP_GRID_USER );
|
GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnit, ID_POPUP_GRID_USER );
|
||||||
|
|
||||||
// If the user grid is the current option, recall SetGrid()
|
// If the user grid is the current option, recall SetGrid()
|
||||||
|
|
|
@ -240,7 +240,7 @@ DIMENSION* PCB_EDIT_FRAME::EditDimension( DIMENSION* aDimension, wxDC* aDC )
|
||||||
if( aDimension == NULL )
|
if( aDimension == NULL )
|
||||||
{
|
{
|
||||||
status_dimension = 1;
|
status_dimension = 1;
|
||||||
pos = GetScreen()->GetCrossHairPosition();
|
pos = GetCrossHairPosition();
|
||||||
|
|
||||||
aDimension = new DIMENSION( GetBoard() );
|
aDimension = new DIMENSION( GetBoard() );
|
||||||
aDimension->SetFlags( IS_NEW );
|
aDimension->SetFlags( IS_NEW );
|
||||||
|
@ -302,7 +302,7 @@ static void BuildDimension( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
||||||
{
|
{
|
||||||
PCB_SCREEN* screen = (PCB_SCREEN*) aPanel->GetScreen();
|
PCB_SCREEN* screen = (PCB_SCREEN*) aPanel->GetScreen();
|
||||||
DIMENSION* Dimension = (DIMENSION*) screen->GetCurItem();
|
DIMENSION* Dimension = (DIMENSION*) screen->GetCurItem();
|
||||||
wxPoint pos = screen->GetCrossHairPosition();
|
wxPoint pos = aPanel->GetParent()->GetCrossHairPosition();
|
||||||
|
|
||||||
if( Dimension == NULL )
|
if( Dimension == NULL )
|
||||||
return;
|
return;
|
||||||
|
@ -386,7 +386,7 @@ void PCB_EDIT_FRAME::BeginMoveDimensionText( DIMENSION* aItem, wxDC* DC )
|
||||||
aItem->SetFlags( IS_MOVED );
|
aItem->SetFlags( IS_MOVED );
|
||||||
SetMsgPanel( aItem );
|
SetMsgPanel( aItem );
|
||||||
|
|
||||||
GetScreen()->SetCrossHairPosition( aItem->Text().GetTextPosition() );
|
SetCrossHairPosition( aItem->Text().GetTextPosition() );
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
|
|
||||||
m_canvas->SetMouseCapture( MoveDimensionText, AbortMoveDimensionText );
|
m_canvas->SetMouseCapture( MoveDimensionText, AbortMoveDimensionText );
|
||||||
|
@ -407,7 +407,7 @@ static void MoveDimensionText( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
|
||||||
if( aErase )
|
if( aErase )
|
||||||
dimension->Draw( aPanel, aDC, GR_XOR );
|
dimension->Draw( aPanel, aDC, GR_XOR );
|
||||||
|
|
||||||
dimension->Text().SetTextPosition( aPanel->GetScreen()->GetCrossHairPosition() );
|
dimension->Text().SetTextPosition( aPanel->GetParent()->GetCrossHairPosition() );
|
||||||
|
|
||||||
dimension->Draw( aPanel, aDC, GR_XOR );
|
dimension->Draw( aPanel, aDC, GR_XOR );
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ void FOOTPRINT_EDIT_FRAME::Start_Move_EdgeMod( EDGE_MODULE* aEdge, wxDC* DC )
|
||||||
aEdge->Draw( m_canvas, DC, GR_XOR );
|
aEdge->Draw( m_canvas, DC, GR_XOR );
|
||||||
aEdge->SetFlags( IS_MOVED );
|
aEdge->SetFlags( IS_MOVED );
|
||||||
MoveVector.x = MoveVector.y = 0;
|
MoveVector.x = MoveVector.y = 0;
|
||||||
CursorInitialPosition = GetScreen()->GetCrossHairPosition();
|
CursorInitialPosition = GetCrossHairPosition();
|
||||||
m_canvas->SetMouseCapture( ShowCurrentOutlineWhileMoving, Abort_Move_ModuleOutline );
|
m_canvas->SetMouseCapture( ShowCurrentOutlineWhileMoving, Abort_Move_ModuleOutline );
|
||||||
SetCurItem( aEdge );
|
SetCurItem( aEdge );
|
||||||
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
|
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
|
||||||
|
@ -115,7 +115,7 @@ static void ShowCurrentOutlineWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
||||||
edge->Draw( aPanel, aDC, GR_XOR, MoveVector );
|
edge->Draw( aPanel, aDC, GR_XOR, MoveVector );
|
||||||
}
|
}
|
||||||
|
|
||||||
MoveVector = -(screen->GetCrossHairPosition() - CursorInitialPosition);
|
MoveVector = -(aPanel->GetParent()->GetCrossHairPosition() - CursorInitialPosition);
|
||||||
|
|
||||||
edge->Draw( aPanel, aDC, GR_XOR, MoveVector );
|
edge->Draw( aPanel, aDC, GR_XOR, MoveVector );
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ static void ShowNewEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
|
||||||
edge->Draw( aPanel, aDC, GR_XOR );
|
edge->Draw( aPanel, aDC, GR_XOR );
|
||||||
}
|
}
|
||||||
|
|
||||||
edge->SetEnd( screen->GetCrossHairPosition() );
|
edge->SetEnd( aPanel->GetParent()->GetCrossHairPosition() );
|
||||||
|
|
||||||
// Update relative coordinate.
|
// Update relative coordinate.
|
||||||
edge->SetEnd0( edge->GetEnd() - module->GetPosition() );
|
edge->SetEnd0( edge->GetEnd() - module->GetPosition() );
|
||||||
|
@ -346,7 +346,7 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* aEdge,
|
||||||
aEdge->SetLayer( SILKSCREEN_N_FRONT );
|
aEdge->SetLayer( SILKSCREEN_N_FRONT );
|
||||||
|
|
||||||
// Initialize the starting point of the new segment or arc
|
// Initialize the starting point of the new segment or arc
|
||||||
aEdge->SetStart( GetScreen()->GetCrossHairPosition() );
|
aEdge->SetStart( GetCrossHairPosition() );
|
||||||
|
|
||||||
// Initialize the ending point of the new segment or arc
|
// Initialize the ending point of the new segment or arc
|
||||||
aEdge->SetEnd( aEdge->GetStart() );
|
aEdge->SetEnd( aEdge->GetStart() );
|
||||||
|
@ -383,7 +383,7 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* aEdge,
|
||||||
|
|
||||||
aEdge->SetFlags( IS_NEW );
|
aEdge->SetFlags( IS_NEW );
|
||||||
aEdge->SetWidth( GetDesignSettings().m_ModuleSegmentWidth );
|
aEdge->SetWidth( GetDesignSettings().m_ModuleSegmentWidth );
|
||||||
aEdge->SetStart( GetScreen()->GetCrossHairPosition() );
|
aEdge->SetStart( GetCrossHairPosition() );
|
||||||
aEdge->SetEnd( aEdge->GetStart() );
|
aEdge->SetEnd( aEdge->GetStart() );
|
||||||
|
|
||||||
// Update relative coordinate.
|
// Update relative coordinate.
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
|
|
||||||
#include <dialog_global_edit_tracks_and_vias.h>
|
#include <dialog_global_edit_tracks_and_vias.h>
|
||||||
|
|
||||||
/* Handles the selection of command events. */
|
// Handles the selection of command events.
|
||||||
void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
int id = event.GetId();
|
int id = event.GetId();
|
||||||
|
@ -153,7 +153,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
m_canvas->EndMouseCapture();
|
m_canvas->EndMouseCapture();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Should not be executed, just in case */
|
// Should not be executed, just in case
|
||||||
if( GetScreen()->m_BlockLocate.GetCommand() != BLOCK_IDLE )
|
if( GetScreen()->m_BlockLocate.GetCommand() != BLOCK_IDLE )
|
||||||
{
|
{
|
||||||
GetScreen()->m_BlockLocate.SetCommand( BLOCK_IDLE );
|
GetScreen()->m_BlockLocate.SetCommand( BLOCK_IDLE );
|
||||||
|
@ -544,7 +544,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
|
ZONE_CONTAINER* zone_cont = (ZONE_CONTAINER*) GetCurItem();
|
||||||
wxPoint pos = GetScreen()->GetCrossHairPosition();
|
wxPoint pos = GetCrossHairPosition();
|
||||||
|
|
||||||
/* add corner between zone_cont->m_CornerSelection
|
/* add corner between zone_cont->m_CornerSelection
|
||||||
* and zone_cont->m_CornerSelection+1
|
* and zone_cont->m_CornerSelection+1
|
||||||
|
@ -644,12 +644,12 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessageToEESCHEMA( module );
|
SendMessageToEESCHEMA( module );
|
||||||
GetScreen()->SetCrossHairPosition( module->GetPosition() );
|
SetCrossHairPosition( module->GetPosition() );
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
StartMoveModule( module, &dc, id == ID_POPUP_PCB_DRAG_MODULE_REQUEST );
|
StartMoveModule( module, &dc, id == ID_POPUP_PCB_DRAG_MODULE_REQUEST );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST: /* get module by name and move it */
|
case ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST: // get module by name and move it
|
||||||
SetCurItem( GetModuleByName() );
|
SetCurItem( GetModuleByName() );
|
||||||
module = (MODULE*) GetCurItem();
|
module = (MODULE*) GetCurItem();
|
||||||
|
|
||||||
|
@ -658,9 +658,9 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
|
||||||
if( module->IsLocked() )
|
if( module->IsLocked() )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg = wxString::Format(
|
||||||
msg.Printf( _( "Footprint %s found, but it is locked" ),
|
_( "Footprint %s found, but it is locked" ),
|
||||||
module->GetReference().GetData() );
|
module->GetReference().GetData() );
|
||||||
DisplayInfoMessage( this, msg );
|
DisplayInfoMessage( this, msg );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -719,7 +719,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is a simple rotation, no other editing in progress */
|
// This is a simple rotation, no other editing in progress
|
||||||
if( !GetCurItem()->IsMoving() )
|
if( !GetCurItem()->IsMoving() )
|
||||||
SaveCopyInUndoList( GetCurItem(), UR_ROTATED, ((MODULE*)GetCurItem())->GetPosition() );
|
SaveCopyInUndoList( GetCurItem(), UR_ROTATED, ((MODULE*)GetCurItem())->GetPosition() );
|
||||||
|
|
||||||
|
@ -747,7 +747,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is a simple rotation, no other editing in progress */
|
// This is a simple rotation, no other editing in progress
|
||||||
if( !GetCurItem()->IsMoving() )
|
if( !GetCurItem()->IsMoving() )
|
||||||
SaveCopyInUndoList( GetCurItem(), UR_ROTATED_CLOCKWISE,
|
SaveCopyInUndoList( GetCurItem(), UR_ROTATED_CLOCKWISE,
|
||||||
((MODULE*)GetCurItem())->GetPosition() );
|
((MODULE*)GetCurItem())->GetPosition() );
|
||||||
|
@ -776,7 +776,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is a simple flip, no other editing in progress */
|
// This is a simple flip, no other editing in progress
|
||||||
if( !GetCurItem()->IsMoving() )
|
if( !GetCurItem()->IsMoving() )
|
||||||
SaveCopyInUndoList( GetCurItem(), UR_FLIPPED, ((MODULE*)GetCurItem())->GetPosition() );
|
SaveCopyInUndoList( GetCurItem(), UR_FLIPPED, ((MODULE*)GetCurItem())->GetPosition() );
|
||||||
|
|
||||||
|
@ -1108,14 +1108,18 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
{
|
{
|
||||||
TRACK* track = (TRACK*) GetScreen()->GetCurItem();
|
TRACK* track = (TRACK*) GetScreen()->GetCurItem();
|
||||||
wxPoint pos = GetScreen()->GetCrossHairPosition();
|
wxPoint pos = GetCrossHairPosition();
|
||||||
|
|
||||||
track->Draw( m_canvas, &dc, GR_XOR );
|
track->Draw( m_canvas, &dc, GR_XOR );
|
||||||
PICKED_ITEMS_LIST itemsListPicker;
|
PICKED_ITEMS_LIST itemsListPicker;
|
||||||
|
|
||||||
TRACK* newtrack = GetBoard()->CreateLockPoint( pos, track, &itemsListPicker );
|
TRACK* newtrack = GetBoard()->CreateLockPoint( pos, track, &itemsListPicker );
|
||||||
|
|
||||||
SaveCopyInUndoList( itemsListPicker, UR_UNSPECIFIED );
|
SaveCopyInUndoList( itemsListPicker, UR_UNSPECIFIED );
|
||||||
track->Draw( m_canvas, &dc, GR_XOR );
|
track->Draw( m_canvas, &dc, GR_XOR );
|
||||||
newtrack->Draw( m_canvas, &dc, GR_XOR );
|
newtrack->Draw( m_canvas, &dc, GR_XOR );
|
||||||
/* compute the new ratsnest, because connectivity could change */
|
|
||||||
|
// compute the new ratsnest, because connectivity could change
|
||||||
TestNetConnection( &dc, track->GetNet() );
|
TestNetConnection( &dc, track->GetNet() );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -147,7 +147,7 @@ void PCB_EDIT_FRAME::StartMoveTextePcb( TEXTE_PCB* aTextePcb, wxDC* aDC, bool aE
|
||||||
m_canvas->Refresh();
|
m_canvas->Refresh();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GetScreen()->SetCrossHairPosition( aTextePcb->GetTextPosition() );
|
SetCrossHairPosition( aTextePcb->GetTextPosition() );
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
|
|
||||||
m_canvas->SetMouseCapture( Move_Texte_Pcb, Abort_Edit_Pcb_Text );
|
m_canvas->SetMouseCapture( Move_Texte_Pcb, Abort_Edit_Pcb_Text );
|
||||||
|
@ -156,7 +156,7 @@ void PCB_EDIT_FRAME::StartMoveTextePcb( TEXTE_PCB* aTextePcb, wxDC* aDC, bool aE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Move PCB text following the cursor. */
|
// Move PCB text following the cursor.
|
||||||
static void Move_Texte_Pcb( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
static void Move_Texte_Pcb( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
||||||
bool aErase )
|
bool aErase )
|
||||||
{
|
{
|
||||||
|
@ -168,7 +168,7 @@ static void Move_Texte_Pcb( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aP
|
||||||
if( aErase )
|
if( aErase )
|
||||||
TextePcb->Draw( aPanel, aDC, GR_XOR );
|
TextePcb->Draw( aPanel, aDC, GR_XOR );
|
||||||
|
|
||||||
TextePcb->SetTextPosition( aPanel->GetScreen()->GetCrossHairPosition() );
|
TextePcb->SetTextPosition( aPanel->GetParent()->GetCrossHairPosition() );
|
||||||
|
|
||||||
TextePcb->Draw( aPanel, aDC, GR_XOR );
|
TextePcb->Draw( aPanel, aDC, GR_XOR );
|
||||||
}
|
}
|
||||||
|
@ -214,7 +214,7 @@ TEXTE_PCB* PCB_EDIT_FRAME::CreateTextePcb( wxDC* aDC, TEXTE_PCB* aText )
|
||||||
textePcb->SetMirrored( true );
|
textePcb->SetMirrored( true );
|
||||||
|
|
||||||
textePcb->SetSize( GetBoard()->GetDesignSettings().m_PcbTextSize );
|
textePcb->SetSize( GetBoard()->GetDesignSettings().m_PcbTextSize );
|
||||||
textePcb->SetTextPosition( GetScreen()->GetCrossHairPosition() );
|
textePcb->SetTextPosition( GetCrossHairPosition() );
|
||||||
textePcb->SetThickness( GetBoard()->GetDesignSettings().m_PcbTextWidth );
|
textePcb->SetThickness( GetBoard()->GetDesignSettings().m_PcbTextWidth );
|
||||||
|
|
||||||
InstallTextPCBOptionsFrame( textePcb, aDC );
|
InstallTextPCBOptionsFrame( textePcb, aDC );
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
#include <class_drawsegment.h>
|
#include <class_drawsegment.h>
|
||||||
|
|
||||||
|
|
||||||
static void Abort_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC );
|
static void Abort_EditEdge( EDA_DRAW_PANEL* aPanel, wxDC* DC );
|
||||||
static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase );
|
static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase );
|
||||||
static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
||||||
bool aErase );
|
bool aErase );
|
||||||
|
@ -61,7 +61,7 @@ void PCB_EDIT_FRAME::Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC )
|
||||||
|
|
||||||
drawitem->Draw( m_canvas, DC, GR_XOR );
|
drawitem->Draw( m_canvas, DC, GR_XOR );
|
||||||
drawitem->SetFlags( IS_MOVED );
|
drawitem->SetFlags( IS_MOVED );
|
||||||
s_InitialPosition = s_LastPosition = GetScreen()->GetCrossHairPosition();
|
s_InitialPosition = s_LastPosition = GetCrossHairPosition();
|
||||||
SetMsgPanel( drawitem );
|
SetMsgPanel( drawitem );
|
||||||
m_canvas->SetMouseCapture( Move_Segment, Abort_EditEdge );
|
m_canvas->SetMouseCapture( Move_Segment, Abort_EditEdge );
|
||||||
SetCurItem( drawitem );
|
SetCurItem( drawitem );
|
||||||
|
@ -100,12 +100,12 @@ static void Move_Segment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPos
|
||||||
segment->Draw( aPanel, aDC, GR_XOR );
|
segment->Draw( aPanel, aDC, GR_XOR );
|
||||||
|
|
||||||
wxPoint delta;
|
wxPoint delta;
|
||||||
delta = aPanel->GetScreen()->GetCrossHairPosition() - s_LastPosition;
|
delta = aPanel->GetParent()->GetCrossHairPosition() - s_LastPosition;
|
||||||
|
|
||||||
segment->SetStart( segment->GetStart() + delta );
|
segment->SetStart( segment->GetStart() + delta );
|
||||||
segment->SetEnd( segment->GetEnd() + delta );
|
segment->SetEnd( segment->GetEnd() + delta );
|
||||||
|
|
||||||
s_LastPosition = aPanel->GetScreen()->GetCrossHairPosition();
|
s_LastPosition = aPanel->GetParent()->GetCrossHairPosition();
|
||||||
|
|
||||||
segment->Draw( aPanel, aDC, GR_XOR );
|
segment->Draw( aPanel, aDC, GR_XOR );
|
||||||
}
|
}
|
||||||
|
@ -153,17 +153,17 @@ void PCB_EDIT_FRAME::Delete_Drawings_All_Layer( LAYER_NUM aLayer )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString msg;
|
wxString msg = wxString::Format(
|
||||||
msg.Printf( _( "Delete everything on layer %s?" ),
|
_( "Delete everything on layer %s?" ),
|
||||||
GetChars( GetBoard()->GetLayerName( aLayer ) ) );
|
GetChars( GetBoard()->GetLayerName( aLayer ) ) );
|
||||||
|
|
||||||
if( !IsOK( this, msg ) )
|
if( !IsOK( this, msg ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PICKED_ITEMS_LIST pickList;
|
PICKED_ITEMS_LIST pickList;
|
||||||
ITEM_PICKER picker(NULL, UR_DELETED);
|
ITEM_PICKER picker( NULL, UR_DELETED );
|
||||||
|
BOARD_ITEM* PtNext;
|
||||||
|
|
||||||
BOARD_ITEM* PtNext;
|
|
||||||
for( BOARD_ITEM* item = GetBoard()->m_Drawings; item; item = PtNext )
|
for( BOARD_ITEM* item = GetBoard()->m_Drawings; item; item = PtNext )
|
||||||
{
|
{
|
||||||
PtNext = item->Next();
|
PtNext = item->Next();
|
||||||
|
@ -202,38 +202,38 @@ void PCB_EDIT_FRAME::Delete_Drawings_All_Layer( LAYER_NUM aLayer )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void Abort_EditEdge( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
static void Abort_EditEdge( EDA_DRAW_PANEL* aPanel, wxDC* DC )
|
||||||
{
|
{
|
||||||
DRAWSEGMENT* Segment = (DRAWSEGMENT*) Panel->GetScreen()->GetCurItem();
|
DRAWSEGMENT* Segment = (DRAWSEGMENT*) aPanel->GetScreen()->GetCurItem();
|
||||||
|
|
||||||
if( Segment == NULL )
|
if( Segment == NULL )
|
||||||
{
|
{
|
||||||
Panel->SetMouseCapture( NULL, NULL );
|
aPanel->SetMouseCapture( NULL, NULL );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Segment->IsNew() )
|
if( Segment->IsNew() )
|
||||||
{
|
{
|
||||||
Panel->CallMouseCapture( DC, wxDefaultPosition, false );
|
aPanel->CallMouseCapture( DC, wxDefaultPosition, false );
|
||||||
Segment ->DeleteStructure();
|
Segment ->DeleteStructure();
|
||||||
Segment = NULL;
|
Segment = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxPoint pos = Panel->GetScreen()->GetCrossHairPosition();
|
wxPoint pos = aPanel->GetParent()->GetCrossHairPosition();
|
||||||
Panel->GetScreen()->SetCrossHairPosition( s_InitialPosition );
|
aPanel->GetParent()->SetCrossHairPosition( s_InitialPosition );
|
||||||
Panel->CallMouseCapture( DC, wxDefaultPosition, true );
|
aPanel->CallMouseCapture( DC, wxDefaultPosition, true );
|
||||||
Panel->GetScreen()->SetCrossHairPosition( pos );
|
aPanel->GetParent()->SetCrossHairPosition( pos );
|
||||||
Segment->ClearFlags();
|
Segment->ClearFlags();
|
||||||
Segment->Draw( Panel, DC, GR_OR );
|
Segment->Draw( aPanel, DC, GR_OR );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_WX_OVERLAY
|
#ifdef USE_WX_OVERLAY
|
||||||
Panel->Refresh();
|
aPanel->Refresh();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Panel->SetMouseCapture( NULL, NULL );
|
aPanel->SetMouseCapture( NULL, NULL );
|
||||||
( (PCB_EDIT_FRAME*) Panel->GetParent() )->SetCurItem( NULL );
|
( (PCB_EDIT_FRAME*) aPanel->GetParent() )->SetCurItem( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -259,8 +259,8 @@ DRAWSEGMENT* PCB_EDIT_FRAME::Begin_DrawSegment( DRAWSEGMENT* Segment, STROKE_T s
|
||||||
Segment->SetWidth( s_large );
|
Segment->SetWidth( s_large );
|
||||||
Segment->SetShape( shape );
|
Segment->SetShape( shape );
|
||||||
Segment->SetAngle( 900 );
|
Segment->SetAngle( 900 );
|
||||||
Segment->SetStart( GetScreen()->GetCrossHairPosition() );
|
Segment->SetStart( GetCrossHairPosition() );
|
||||||
Segment->SetEnd( GetScreen()->GetCrossHairPosition() );
|
Segment->SetEnd( GetCrossHairPosition() );
|
||||||
m_canvas->SetMouseCapture( DrawSegment, Abort_EditEdge );
|
m_canvas->SetMouseCapture( DrawSegment, Abort_EditEdge );
|
||||||
}
|
}
|
||||||
else /* The ending point ccordinate Segment->m_End was updated by he function
|
else /* The ending point ccordinate Segment->m_End was updated by he function
|
||||||
|
@ -350,14 +350,14 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
|
||||||
{
|
{
|
||||||
wxPoint pt;
|
wxPoint pt;
|
||||||
|
|
||||||
CalculateSegmentEndPoint( aPanel->GetScreen()->GetCrossHairPosition(),
|
CalculateSegmentEndPoint( aPanel->GetParent()->GetCrossHairPosition(),
|
||||||
Segment->GetStart().x, Segment->GetStart().y,
|
Segment->GetStart().x, Segment->GetStart().y,
|
||||||
&pt.x, &pt.y );
|
&pt.x, &pt.y );
|
||||||
Segment->SetEnd( pt );
|
Segment->SetEnd( pt );
|
||||||
}
|
}
|
||||||
else // here the angle is arbitrary
|
else // here the angle is arbitrary
|
||||||
{
|
{
|
||||||
Segment->SetEnd( aPanel->GetScreen()->GetCrossHairPosition() );
|
Segment->SetEnd( aPanel->GetParent()->GetCrossHairPosition() );
|
||||||
}
|
}
|
||||||
|
|
||||||
Segment->Draw( aPanel, aDC, GR_XOR );
|
Segment->Draw( aPanel, aDC, GR_XOR );
|
||||||
|
|
|
@ -101,7 +101,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
|
||||||
TRACK* TrackOnStartPoint = NULL;
|
TRACK* TrackOnStartPoint = NULL;
|
||||||
LAYER_MSK layerMask = GetLayerMask( GetScreen()->m_Active_Layer );
|
LAYER_MSK layerMask = GetLayerMask( GetScreen()->m_Active_Layer );
|
||||||
BOARD_CONNECTED_ITEM* LockPoint;
|
BOARD_CONNECTED_ITEM* LockPoint;
|
||||||
wxPoint pos = GetScreen()->GetCrossHairPosition();
|
wxPoint pos = GetCrossHairPosition();
|
||||||
|
|
||||||
if( aTrack == NULL ) // Starting a new track segment
|
if( aTrack == NULL ) // Starting a new track segment
|
||||||
{
|
{
|
||||||
|
@ -595,17 +595,17 @@ TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack, LAYER_NUM aLayer, const
|
||||||
*/
|
*/
|
||||||
static void PushTrack( EDA_DRAW_PANEL* panel )
|
static void PushTrack( EDA_DRAW_PANEL* panel )
|
||||||
{
|
{
|
||||||
PCB_SCREEN* screen = ( (PCB_BASE_FRAME*) (panel->GetParent()) )->GetScreen();
|
PCB_SCREEN* screen = (PCB_SCREEN*) panel->GetParent()->GetScreen();
|
||||||
BOARD* pcb = ( (PCB_BASE_FRAME*) (panel->GetParent()) )->GetBoard();
|
BOARD* pcb = ( (PCB_BASE_FRAME*) (panel->GetParent()) )->GetBoard();
|
||||||
wxPoint cursor = screen->GetCrossHairPosition();
|
wxPoint cursor = panel->GetParent()->GetCrossHairPosition();
|
||||||
wxPoint cv, vec, n;
|
wxPoint cv, vec, n;
|
||||||
TRACK* track = g_CurrentTrackSegment;
|
TRACK* track = g_CurrentTrackSegment;
|
||||||
TRACK* other;
|
TRACK* other;
|
||||||
double det;
|
double det;
|
||||||
int dist;
|
int dist;
|
||||||
double f;
|
double f;
|
||||||
|
|
||||||
other = LocateIntrusion( pcb->m_Track, track, screen->m_Active_Layer, screen->RefPos( true ) );
|
other = LocateIntrusion( pcb->m_Track, track, screen->m_Active_Layer, panel->GetParent()->RefPos( true ) );
|
||||||
|
|
||||||
// are we currently pointing into a conflicting trace ?
|
// are we currently pointing into a conflicting trace ?
|
||||||
if( !other )
|
if( !other )
|
||||||
|
@ -735,7 +735,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
|
||||||
{
|
{
|
||||||
if( g_TwoSegmentTrackBuild )
|
if( g_TwoSegmentTrackBuild )
|
||||||
{
|
{
|
||||||
g_CurrentTrackSegment->SetEnd( screen->GetCrossHairPosition() );
|
g_CurrentTrackSegment->SetEnd( frame->GetCrossHairPosition() );
|
||||||
|
|
||||||
if( g_Drc_On )
|
if( g_Drc_On )
|
||||||
PushTrack( aPanel );
|
PushTrack( aPanel );
|
||||||
|
@ -750,7 +750,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
|
||||||
* horizontal, vertical or 45 degrees.
|
* horizontal, vertical or 45 degrees.
|
||||||
*/
|
*/
|
||||||
wxPoint hp = g_CurrentTrackSegment->GetEnd();
|
wxPoint hp = g_CurrentTrackSegment->GetEnd();
|
||||||
CalculateSegmentEndPoint( screen->GetCrossHairPosition(),
|
CalculateSegmentEndPoint( frame->GetCrossHairPosition(),
|
||||||
g_CurrentTrackSegment->GetStart().x,
|
g_CurrentTrackSegment->GetStart().x,
|
||||||
g_CurrentTrackSegment->GetStart().y,
|
g_CurrentTrackSegment->GetStart().y,
|
||||||
&hp.x,
|
&hp.x,
|
||||||
|
@ -760,7 +760,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
|
||||||
}
|
}
|
||||||
else // Here the angle is arbitrary
|
else // Here the angle is arbitrary
|
||||||
{
|
{
|
||||||
g_CurrentTrackSegment->SetEnd( screen->GetCrossHairPosition() );
|
g_CurrentTrackSegment->SetEnd( frame->GetCrossHairPosition() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redraw the new track
|
// Redraw the new track
|
||||||
|
|
|
@ -68,7 +68,7 @@ TEXTE_MODULE* PCB_BASE_FRAME::CreateTextModule( MODULE* Module, wxDC* DC )
|
||||||
|
|
||||||
Text = new TEXTE_MODULE( Module );
|
Text = new TEXTE_MODULE( Module );
|
||||||
|
|
||||||
/* Add the new text object to the beginning of the draw item list. */
|
// Add the new text object to the beginning of the draw item list.
|
||||||
if( Module )
|
if( Module )
|
||||||
Module->GraphicalItems().PushFront( Text );
|
Module->GraphicalItems().PushFront( Text );
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ TEXTE_MODULE* PCB_BASE_FRAME::CreateTextModule( MODULE* Module, wxDC* DC )
|
||||||
std::min( GetDesignSettings().m_ModuleTextSize.x, GetDesignSettings().m_ModuleTextSize.y ), true );
|
std::min( GetDesignSettings().m_ModuleTextSize.x, GetDesignSettings().m_ModuleTextSize.y ), true );
|
||||||
Text->SetSize( GetDesignSettings().m_ModuleTextSize );
|
Text->SetSize( GetDesignSettings().m_ModuleTextSize );
|
||||||
Text->SetThickness( GetDesignSettings().m_ModuleTextWidth );
|
Text->SetThickness( GetDesignSettings().m_ModuleTextWidth );
|
||||||
Text->SetTextPosition( GetScreen()->GetCrossHairPosition() );
|
Text->SetTextPosition( GetCrossHairPosition() );
|
||||||
Text->SetLocalCoord();
|
Text->SetLocalCoord();
|
||||||
|
|
||||||
InstallTextModOptionsFrame( Text, NULL );
|
InstallTextModOptionsFrame( Text, NULL );
|
||||||
|
@ -175,7 +175,7 @@ static void AbortMoveTextModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
||||||
if( Text->IsMoving() )
|
if( Text->IsMoving() )
|
||||||
Text->SetOrientation( TextInitialOrientation );
|
Text->SetOrientation( TextInitialOrientation );
|
||||||
|
|
||||||
/* Redraw the text */
|
// Redraw the text
|
||||||
Panel->RefreshDrawingRect( Text->GetBoundingBox() );
|
Panel->RefreshDrawingRect( Text->GetBoundingBox() );
|
||||||
|
|
||||||
// leave it at (0,0) so we can use it Rotate when not moving.
|
// leave it at (0,0) so we can use it Rotate when not moving.
|
||||||
|
@ -208,7 +208,7 @@ void PCB_BASE_FRAME::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC )
|
||||||
TextInitialOrientation = Text->GetOrientation();
|
TextInitialOrientation = Text->GetOrientation();
|
||||||
|
|
||||||
// Center cursor on initial position of text
|
// Center cursor on initial position of text
|
||||||
GetScreen()->SetCrossHairPosition( TextInitialPosition );
|
SetCrossHairPosition( TextInitialPosition );
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
|
|
||||||
SetMsgPanel( Text );
|
SetMsgPanel( Text );
|
||||||
|
@ -227,7 +227,7 @@ void PCB_BASE_FRAME::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
|
||||||
m_canvas->RefreshDrawingRect( Text->GetBoundingBox() );
|
m_canvas->RefreshDrawingRect( Text->GetBoundingBox() );
|
||||||
Text->DrawUmbilical( m_canvas, DC, GR_XOR, -MoveVector );
|
Text->DrawUmbilical( m_canvas, DC, GR_XOR, -MoveVector );
|
||||||
|
|
||||||
/* Update the coordinates for anchor. */
|
// Update the coordinates for anchor.
|
||||||
MODULE* Module = (MODULE*) Text->GetParent();
|
MODULE* Module = (MODULE*) Text->GetParent();
|
||||||
|
|
||||||
if( Module )
|
if( Module )
|
||||||
|
@ -244,7 +244,7 @@ void PCB_BASE_FRAME::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
|
||||||
Text->SetOrientation( tmp );
|
Text->SetOrientation( tmp );
|
||||||
|
|
||||||
// Set the new position for text.
|
// Set the new position for text.
|
||||||
Text->SetTextPosition( GetScreen()->GetCrossHairPosition() );
|
Text->SetTextPosition( GetCrossHairPosition() );
|
||||||
wxPoint textRelPos = Text->GetTextPosition() - Module->GetPosition();
|
wxPoint textRelPos = Text->GetTextPosition() - Module->GetPosition();
|
||||||
RotatePoint( &textRelPos, -Module->GetOrientation() );
|
RotatePoint( &textRelPos, -Module->GetOrientation() );
|
||||||
Text->SetPos0( textRelPos );
|
Text->SetPos0( textRelPos );
|
||||||
|
@ -253,12 +253,12 @@ void PCB_BASE_FRAME::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
|
||||||
Module->SetLastEditTime();
|
Module->SetLastEditTime();
|
||||||
OnModify();
|
OnModify();
|
||||||
|
|
||||||
/* Redraw text. */
|
// Redraw text.
|
||||||
m_canvas->RefreshDrawingRect( Text->GetBoundingBox() );
|
m_canvas->RefreshDrawingRect( Text->GetBoundingBox() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Text->SetTextPosition( GetScreen()->GetCrossHairPosition() );
|
Text->SetTextPosition( GetCrossHairPosition() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ static void Show_MoveTexte_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
|
||||||
Text->Draw( aPanel, aDC, GR_XOR, MoveVector );
|
Text->Draw( aPanel, aDC, GR_XOR, MoveVector );
|
||||||
}
|
}
|
||||||
|
|
||||||
MoveVector = TextInitialPosition - screen->GetCrossHairPosition();
|
MoveVector = TextInitialPosition - aPanel->GetParent()->GetCrossHairPosition();
|
||||||
|
|
||||||
// Draw umbilical if text moved
|
// Draw umbilical if text moved
|
||||||
if( MoveVector.x || MoveVector.y )
|
if( MoveVector.x || MoveVector.y )
|
||||||
|
|
|
@ -146,8 +146,8 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent )
|
||||||
GetBoard()->ComputeBoundingBox();
|
GetBoard()->ComputeBoundingBox();
|
||||||
|
|
||||||
// Save the auxiliary origin for the rest of the module
|
// Save the auxiliary origin for the rest of the module
|
||||||
GencadOffsetX = GetOriginAxisPosition().x;
|
GencadOffsetX = GetAuxOrigin().x;
|
||||||
GencadOffsetY = GetOriginAxisPosition().y;
|
GencadOffsetY = GetAuxOrigin().y;
|
||||||
|
|
||||||
// No idea on *why* this should be needed... maybe to fix net names?
|
// No idea on *why* this should be needed... maybe to fix net names?
|
||||||
Compile_Ratsnest( NULL, true );
|
Compile_Ratsnest( NULL, true );
|
||||||
|
@ -708,8 +708,8 @@ static bool CreateHeaderInfoData( FILE* aFile, PCB_EDIT_FRAME* aFrame )
|
||||||
fputs( "UNITS INCH\n", aFile );
|
fputs( "UNITS INCH\n", aFile );
|
||||||
|
|
||||||
msg.Printf( wxT( "ORIGIN %g %g\n" ),
|
msg.Printf( wxT( "ORIGIN %g %g\n" ),
|
||||||
MapXTo( aFrame->GetOriginAxisPosition().x ),
|
MapXTo( aFrame->GetAuxOrigin().x ),
|
||||||
MapYTo( aFrame->GetOriginAxisPosition().y ) );
|
MapYTo( aFrame->GetAuxOrigin().y ) );
|
||||||
fputs( TO_UTF8( msg ), aFile );
|
fputs( TO_UTF8( msg ), aFile );
|
||||||
|
|
||||||
fputs( "INTERTRACK 0\n", aFile );
|
fputs( "INTERTRACK 0\n", aFile );
|
||||||
|
|
|
@ -53,16 +53,16 @@
|
||||||
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE( FOOTPRINT_WIZARD_FRAME, EDA_DRAW_FRAME )
|
BEGIN_EVENT_TABLE( FOOTPRINT_WIZARD_FRAME, EDA_DRAW_FRAME )
|
||||||
/* Window events */
|
// Window events
|
||||||
EVT_CLOSE( FOOTPRINT_WIZARD_FRAME::OnCloseWindow )
|
EVT_CLOSE( FOOTPRINT_WIZARD_FRAME::OnCloseWindow )
|
||||||
EVT_SIZE( FOOTPRINT_WIZARD_FRAME::OnSize )
|
EVT_SIZE( FOOTPRINT_WIZARD_FRAME::OnSize )
|
||||||
EVT_ACTIVATE( FOOTPRINT_WIZARD_FRAME::OnActivate )
|
EVT_ACTIVATE( FOOTPRINT_WIZARD_FRAME::OnActivate )
|
||||||
|
|
||||||
/* Sash drag events */
|
// Sash drag events
|
||||||
EVT_SASH_DRAGGED( ID_FOOTPRINT_WIZARD_PAGES, FOOTPRINT_WIZARD_FRAME::OnSashDrag )
|
EVT_SASH_DRAGGED( ID_FOOTPRINT_WIZARD_PAGES, FOOTPRINT_WIZARD_FRAME::OnSashDrag )
|
||||||
EVT_SASH_DRAGGED( ID_FOOTPRINT_WIZARD_PARAMETERS, FOOTPRINT_WIZARD_FRAME::OnSashDrag )
|
EVT_SASH_DRAGGED( ID_FOOTPRINT_WIZARD_PARAMETERS, FOOTPRINT_WIZARD_FRAME::OnSashDrag )
|
||||||
|
|
||||||
/* Toolbar events */
|
// Toolbar events
|
||||||
EVT_TOOL( ID_FOOTPRINT_WIZARD_SELECT_WIZARD,
|
EVT_TOOL( ID_FOOTPRINT_WIZARD_SELECT_WIZARD,
|
||||||
FOOTPRINT_WIZARD_FRAME::SelectCurrentWizard )
|
FOOTPRINT_WIZARD_FRAME::SelectCurrentWizard )
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ EVT_TOOL( ID_FOOTPRINT_WIZARD_DONE,
|
||||||
EVT_TOOL( ID_FOOTPRINT_WIZARD_SHOW_3D_VIEW,
|
EVT_TOOL( ID_FOOTPRINT_WIZARD_SHOW_3D_VIEW,
|
||||||
FOOTPRINT_WIZARD_FRAME::Show3D_Frame )
|
FOOTPRINT_WIZARD_FRAME::Show3D_Frame )
|
||||||
|
|
||||||
/* listbox events */
|
// listbox events
|
||||||
EVT_LISTBOX( ID_FOOTPRINT_WIZARD_PAGE_LIST, FOOTPRINT_WIZARD_FRAME::ClickOnPageList )
|
EVT_LISTBOX( ID_FOOTPRINT_WIZARD_PAGE_LIST, FOOTPRINT_WIZARD_FRAME::ClickOnPageList )
|
||||||
EVT_GRID_CMD_CELL_CHANGE( ID_FOOTPRINT_WIZARD_PARAMETER_LIST,
|
EVT_GRID_CMD_CELL_CHANGE( ID_FOOTPRINT_WIZARD_PARAMETER_LIST,
|
||||||
FOOTPRINT_WIZARD_FRAME::ParametersUpdated )
|
FOOTPRINT_WIZARD_FRAME::ParametersUpdated )
|
||||||
|
@ -374,7 +374,7 @@ void FOOTPRINT_WIZARD_FRAME::OnSize( wxSizeEvent& SizeEv )
|
||||||
*/
|
*/
|
||||||
void FOOTPRINT_WIZARD_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
|
void FOOTPRINT_WIZARD_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
|
GetScreen()->m_O_Curseur = GetCrossHairPosition();
|
||||||
UpdateStatusBar();
|
UpdateStatusBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -587,8 +587,8 @@ void FOOTPRINT_WIZARD_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition
|
||||||
|
|
||||||
cmd.SetEventObject( this );
|
cmd.SetEventObject( this );
|
||||||
|
|
||||||
pos = screen->GetNearestGridPosition( pos );
|
pos = GetNearestGridPosition( pos );
|
||||||
oldpos = screen->GetCrossHairPosition();
|
oldpos = GetCrossHairPosition();
|
||||||
gridSize = screen->GetGridSize();
|
gridSize = screen->GetGridSize();
|
||||||
|
|
||||||
switch( aHotKey )
|
switch( aHotKey )
|
||||||
|
@ -619,42 +619,42 @@ void FOOTPRINT_WIZARD_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ' ':
|
case ' ':
|
||||||
screen->m_O_Curseur = screen->GetCrossHairPosition();
|
screen->m_O_Curseur = GetCrossHairPosition();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD8: /* cursor moved up */
|
case WXK_NUMPAD8: // cursor moved up
|
||||||
case WXK_UP:
|
case WXK_UP:
|
||||||
pos.y -= KiROUND( gridSize.y );
|
pos.y -= KiROUND( gridSize.y );
|
||||||
m_canvas->MoveCursor( pos );
|
m_canvas->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD2: /* cursor moved down */
|
case WXK_NUMPAD2: // cursor moved down
|
||||||
case WXK_DOWN:
|
case WXK_DOWN:
|
||||||
pos.y += KiROUND( gridSize.y );
|
pos.y += KiROUND( gridSize.y );
|
||||||
m_canvas->MoveCursor( pos );
|
m_canvas->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD4: /* cursor moved left */
|
case WXK_NUMPAD4: // cursor moved left
|
||||||
case WXK_LEFT:
|
case WXK_LEFT:
|
||||||
pos.x -= KiROUND( gridSize.x );
|
pos.x -= KiROUND( gridSize.x );
|
||||||
m_canvas->MoveCursor( pos );
|
m_canvas->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD6: /* cursor moved right */
|
case WXK_NUMPAD6: // cursor moved right
|
||||||
case WXK_RIGHT:
|
case WXK_RIGHT:
|
||||||
pos.x += KiROUND( gridSize.x );
|
pos.x += KiROUND( gridSize.x );
|
||||||
m_canvas->MoveCursor( pos );
|
m_canvas->MoveCursor( pos );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
screen->SetCrossHairPosition( pos );
|
SetCrossHairPosition( pos );
|
||||||
|
|
||||||
if( oldpos != screen->GetCrossHairPosition() )
|
if( oldpos != GetCrossHairPosition() )
|
||||||
{
|
{
|
||||||
pos = screen->GetCrossHairPosition();
|
pos = GetCrossHairPosition();
|
||||||
screen->SetCrossHairPosition( oldpos );
|
SetCrossHairPosition( oldpos );
|
||||||
m_canvas->CrossHairOff( aDC );
|
m_canvas->CrossHairOff( aDC );
|
||||||
screen->SetCrossHairPosition( pos );
|
SetCrossHairPosition( pos );
|
||||||
m_canvas->CrossHairOn( aDC );
|
m_canvas->CrossHairOn( aDC );
|
||||||
|
|
||||||
if( m_canvas->IsMouseCaptured() )
|
if( m_canvas->IsMouseCaptured() )
|
||||||
|
@ -663,7 +663,7 @@ void FOOTPRINT_WIZARD_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateStatusBar(); /* Display new cursor coordinates */
|
UpdateStatusBar(); // Display new cursor coordinates
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -359,7 +359,7 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName,
|
||||||
MODULE* module;
|
MODULE* module;
|
||||||
char line[1024];
|
char line[1024];
|
||||||
|
|
||||||
File_Place_Offset = GetOriginAxisPosition();
|
File_Place_Offset = GetAuxOrigin();
|
||||||
|
|
||||||
// Calculating the number of useful modules (CMS attribute, not VIRTUAL)
|
// Calculating the number of useful modules (CMS attribute, not VIRTUAL)
|
||||||
int moduleCount = 0;
|
int moduleCount = 0;
|
||||||
|
|
|
@ -133,7 +133,7 @@ int PCB_EDIT_FRAME::SelectHighLight( wxDC* DC )
|
||||||
// optionally, modify the "guide" here as needed using its member functions
|
// optionally, modify the "guide" here as needed using its member functions
|
||||||
|
|
||||||
m_Collector->Collect( GetBoard(), GENERAL_COLLECTOR::PadsTracksOrZones,
|
m_Collector->Collect( GetBoard(), GENERAL_COLLECTOR::PadsTracksOrZones,
|
||||||
GetScreen()->RefPos( true ), guide );
|
RefPos( true ), guide );
|
||||||
|
|
||||||
BOARD_ITEM* item = (*m_Collector)[0];
|
BOARD_ITEM* item = (*m_Collector)[0];
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
* This can be useful if the new function cannot be executed while an item is currently
|
* This can be useful if the new function cannot be executed while an item is currently
|
||||||
* being edited ( For example, one cannot start a new wire when a component is moving.)
|
* being edited ( For example, one cannot start a new wire when a component is moving.)
|
||||||
*
|
*
|
||||||
* Note: If an hotkey is a special key, be sure the corresponding wxWidget keycode (WXK_XXXX)
|
* Note: If a hotkey is a special key, be sure the corresponding wxWidget keycode (WXK_XXXX)
|
||||||
* is handled in the hotkey_name_descr s_Hotkey_Name_List list (see hotkeys_basic.cpp)
|
* is handled in the hotkey_name_descr s_Hotkey_Name_List list (see hotkeys_basic.cpp)
|
||||||
* and see this list for some ascii keys (space ...)
|
* and see this list for some ascii keys (space ...)
|
||||||
*/
|
*/
|
||||||
|
@ -55,15 +55,14 @@ static EDA_HOTKEY HkSwitch2PreviousCopperLayer( wxT( "Switch to Previous Layer"
|
||||||
|
|
||||||
static EDA_HOTKEY HkSaveModule( wxT( "Save Module" ), HK_SAVE_MODULE, 'S' + GR_KB_CTRL );
|
static EDA_HOTKEY HkSaveModule( wxT( "Save Module" ), HK_SAVE_MODULE, 'S' + GR_KB_CTRL );
|
||||||
static EDA_HOTKEY HkSavefile( wxT( "Save board" ), HK_SAVE_BOARD, 'S' + GR_KB_CTRL );
|
static EDA_HOTKEY HkSavefile( wxT( "Save board" ), HK_SAVE_BOARD, 'S' + GR_KB_CTRL );
|
||||||
|
static EDA_HOTKEY HkSavefileAs( wxT( "Save board as" ), HK_SAVE_BOARD_AS, 'S' + GR_KB_CTRL + GR_KB_SHIFT );
|
||||||
static EDA_HOTKEY HkLoadfile( wxT( "Load board" ), HK_LOAD_BOARD, 'L' + GR_KB_CTRL );
|
static EDA_HOTKEY HkLoadfile( wxT( "Load board" ), HK_LOAD_BOARD, 'L' + GR_KB_CTRL );
|
||||||
static EDA_HOTKEY HkFindItem( wxT( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL );
|
static EDA_HOTKEY HkFindItem( wxT( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL );
|
||||||
static EDA_HOTKEY HkBackspace( wxT( "Delete track segment" ), HK_BACK_SPACE, WXK_BACK );
|
static EDA_HOTKEY HkBackspace( wxT( "Delete track segment" ), HK_BACK_SPACE, WXK_BACK );
|
||||||
static EDA_HOTKEY HkAddNewTrack( wxT( "Add new track" ), HK_ADD_NEW_TRACK, 'X' );
|
static EDA_HOTKEY HkAddNewTrack( wxT( "Add new track" ), HK_ADD_NEW_TRACK, 'X' );
|
||||||
static EDA_HOTKEY HkAddVia( wxT( "Add Via" ), HK_ADD_VIA, 'V' );
|
static EDA_HOTKEY HkAddVia( wxT( "Add Via" ), HK_ADD_VIA, 'V' );
|
||||||
static EDA_HOTKEY HkSwitchTrackPosture( wxT( "Switch Track Posture" ),
|
static EDA_HOTKEY HkSwitchTrackPosture( wxT( "Switch Track Posture" ), HK_SWITCH_TRACK_POSTURE, '/' );
|
||||||
HK_SWITCH_TRACK_POSTURE, '/' );
|
static EDA_HOTKEY HkDragTrackKeepSlope( wxT( "Drag track keep slope" ), HK_DRAG_TRACK_KEEP_SLOPE, 'D' );
|
||||||
static EDA_HOTKEY HkDragTrackKeepSlope( wxT( "Drag track keep slope" ),
|
|
||||||
HK_DRAG_TRACK_KEEP_SLOPE, 'D' );
|
|
||||||
static EDA_HOTKEY HkPlaceItem( wxT( "Place Item" ), HK_PLACE_ITEM, 'P' );
|
static EDA_HOTKEY HkPlaceItem( wxT( "Place Item" ), HK_PLACE_ITEM, 'P' );
|
||||||
static EDA_HOTKEY HkAddMicroVia( wxT( "Add MicroVia" ), HK_ADD_MICROVIA, 'V' + GR_KB_CTRL );
|
static EDA_HOTKEY HkAddMicroVia( wxT( "Add MicroVia" ), HK_ADD_MICROVIA, 'V' + GR_KB_CTRL );
|
||||||
static EDA_HOTKEY HkEndTrack( wxT( "End Track" ), HK_END_TRACK, WXK_END );
|
static EDA_HOTKEY HkEndTrack( wxT( "End Track" ), HK_END_TRACK, WXK_END );
|
||||||
|
@ -73,15 +72,15 @@ static EDA_HOTKEY HkRotateItem( wxT( "Rotate Item" ), HK_ROTATE_ITEM, 'R' );
|
||||||
static EDA_HOTKEY HkMoveItem( wxT( "Move Item" ), HK_MOVE_ITEM, 'M' );
|
static EDA_HOTKEY HkMoveItem( wxT( "Move Item" ), HK_MOVE_ITEM, 'M' );
|
||||||
static EDA_HOTKEY HkCopyItem( wxT( "Copy Item" ), HK_COPY_ITEM, 'C' );
|
static EDA_HOTKEY HkCopyItem( wxT( "Copy Item" ), HK_COPY_ITEM, 'C' );
|
||||||
static EDA_HOTKEY HkDragFootprint( wxT( "Drag Footprint" ), HK_DRAG_ITEM, 'G' );
|
static EDA_HOTKEY HkDragFootprint( wxT( "Drag Footprint" ), HK_DRAG_ITEM, 'G' );
|
||||||
static EDA_HOTKEY HkGetAndMoveFootprint( wxT( "Get and Move Footprint" ),
|
static EDA_HOTKEY HkGetAndMoveFootprint( wxT( "Get and Move Footprint" ), HK_GET_AND_MOVE_FOOTPRINT, 'T' );
|
||||||
HK_GET_AND_MOVE_FOOTPRINT, 'T' );
|
static EDA_HOTKEY HkLock_Unlock_Footprint( wxT( "Lock/Unlock Footprint" ), HK_LOCK_UNLOCK_FOOTPRINT, 'L' );
|
||||||
static EDA_HOTKEY HkLock_Unlock_Footprint( wxT( "Lock/Unlock Footprint" ),
|
|
||||||
HK_LOCK_UNLOCK_FOOTPRINT, 'L' );
|
|
||||||
static EDA_HOTKEY HkDelete( wxT( "Delete Track or Footprint" ), HK_DELETE, WXK_DELETE );
|
static EDA_HOTKEY HkDelete( wxT( "Delete Track or Footprint" ), HK_DELETE, WXK_DELETE );
|
||||||
static EDA_HOTKEY HkResetLocalCoord( wxT( "Reset Local Coordinates" ),
|
static EDA_HOTKEY HkResetLocalCoord( wxT( "Reset Local Coordinates" ), HK_RESET_LOCAL_COORD, ' ' );
|
||||||
HK_RESET_LOCAL_COORD, ' ' );
|
static EDA_HOTKEY HkSwitchHighContrastMode( wxT("Switch Highcontrast mode"), HK_SWITCH_HIGHCONTRAST_MODE,'H');
|
||||||
static EDA_HOTKEY HkSwitchHighContrastMode( wxT("Switch Highcontrast mode"),
|
|
||||||
HK_SWITCH_HIGHCONTRAST_MODE,'H');
|
static EDA_HOTKEY HkSetGridOrigin( wxT("Set Grid Origin"), HK_SET_GRID_ORIGIN, 'S' );
|
||||||
|
static EDA_HOTKEY HkResetGridOrigin( wxT("Reset Grid Origin"), HK_RESET_GRID_ORIGIN, 'Z' );
|
||||||
|
|
||||||
static EDA_HOTKEY HkCanvasDefault( wxT( "Switch to default canvas" ),
|
static EDA_HOTKEY HkCanvasDefault( wxT( "Switch to default canvas" ),
|
||||||
HK_CANVAS_DEFAULT, GR_KB_ALT + WXK_F9 );
|
HK_CANVAS_DEFAULT, GR_KB_ALT + WXK_F9 );
|
||||||
static EDA_HOTKEY HkCanvasOpenGL( wxT( "Switch to OpenGL canvas" ),
|
static EDA_HOTKEY HkCanvasOpenGL( wxT( "Switch to OpenGL canvas" ),
|
||||||
|
@ -205,7 +204,7 @@ EDA_HOTKEY* common_Hotkey_List[] =
|
||||||
{
|
{
|
||||||
&HkHelp, &HkZoomIn, &HkZoomOut,
|
&HkHelp, &HkZoomIn, &HkZoomOut,
|
||||||
&HkZoomRedraw, &HkZoomCenter, &HkZoomAuto,
|
&HkZoomRedraw, &HkZoomCenter, &HkZoomAuto,
|
||||||
&HkSwitchUnits, &HkResetLocalCoord,
|
&HkSwitchUnits, &HkResetLocalCoord, &HkSetGridOrigin, &HkResetGridOrigin,
|
||||||
&HkUndo, &HkRedo,
|
&HkUndo, &HkRedo,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
@ -221,7 +220,7 @@ EDA_HOTKEY* board_edit_Hotkey_List[] =
|
||||||
&HkPlaceItem, &HkCopyItem,
|
&HkPlaceItem, &HkCopyItem,
|
||||||
&HkEndTrack, &HkMoveItem, &HkFlipItem,
|
&HkEndTrack, &HkMoveItem, &HkFlipItem,
|
||||||
&HkRotateItem, &HkDragFootprint,
|
&HkRotateItem, &HkDragFootprint,
|
||||||
&HkGetAndMoveFootprint, &HkLock_Unlock_Footprint, &HkSavefile,
|
&HkGetAndMoveFootprint, &HkLock_Unlock_Footprint, &HkSavefile, &HkSavefileAs,
|
||||||
&HkLoadfile, &HkFindItem, &HkEditBoardItem,
|
&HkLoadfile, &HkFindItem, &HkEditBoardItem,
|
||||||
&HkSwitch2CopperLayer, &HkSwitch2InnerLayer1,
|
&HkSwitch2CopperLayer, &HkSwitch2InnerLayer1,
|
||||||
&HkSwitch2InnerLayer2, &HkSwitch2InnerLayer3, &HkSwitch2InnerLayer4,
|
&HkSwitch2InnerLayer2, &HkSwitch2InnerLayer3, &HkSwitch2InnerLayer4,
|
||||||
|
|
|
@ -26,7 +26,9 @@ enum hotkey_id_commnand {
|
||||||
HK_SWITCH_TRACK_POSTURE,
|
HK_SWITCH_TRACK_POSTURE,
|
||||||
HK_DRAG_TRACK_KEEP_SLOPE,
|
HK_DRAG_TRACK_KEEP_SLOPE,
|
||||||
HK_END_TRACK,
|
HK_END_TRACK,
|
||||||
HK_SAVE_BOARD, HK_LOAD_BOARD,
|
HK_SAVE_BOARD,
|
||||||
|
HK_SAVE_BOARD_AS,
|
||||||
|
HK_LOAD_BOARD,
|
||||||
HK_SAVE_MODULE,
|
HK_SAVE_MODULE,
|
||||||
HK_SWITCH_UNITS,
|
HK_SWITCH_UNITS,
|
||||||
HK_SWITCH_TRACK_DISPLAY_MODE,
|
HK_SWITCH_TRACK_DISPLAY_MODE,
|
||||||
|
|
|
@ -30,7 +30,7 @@ void PCB_EDIT_FRAME::RecordMacros(wxDC* aDC, int aNumber)
|
||||||
if( m_RecordingMacros < 0 )
|
if( m_RecordingMacros < 0 )
|
||||||
{
|
{
|
||||||
m_RecordingMacros = aNumber;
|
m_RecordingMacros = aNumber;
|
||||||
m_Macros[aNumber].m_StartPosition = GetScreen()->GetCrossHairPosition( false );
|
m_Macros[aNumber].m_StartPosition = GetCrossHairPosition( false );
|
||||||
m_Macros[aNumber].m_Record.clear();
|
m_Macros[aNumber].m_Record.clear();
|
||||||
|
|
||||||
msg.Printf( _( "Recording macro %d" ), aNumber );
|
msg.Printf( _( "Recording macro %d" ), aNumber );
|
||||||
|
@ -48,7 +48,6 @@ void PCB_EDIT_FRAME::RecordMacros(wxDC* aDC, int aNumber)
|
||||||
|
|
||||||
void PCB_EDIT_FRAME::CallMacros( wxDC* aDC, const wxPoint& aPosition, int aNumber )
|
void PCB_EDIT_FRAME::CallMacros( wxDC* aDC, const wxPoint& aPosition, int aNumber )
|
||||||
{
|
{
|
||||||
PCB_SCREEN* screen = GetScreen();
|
|
||||||
wxPoint tPosition;
|
wxPoint tPosition;
|
||||||
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
@ -59,19 +58,19 @@ void PCB_EDIT_FRAME::CallMacros( wxDC* aDC, const wxPoint& aPosition, int aNumbe
|
||||||
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
||||||
cmd.SetEventObject( this );
|
cmd.SetEventObject( this );
|
||||||
|
|
||||||
tPosition = screen->GetNearestGridPosition( aPosition );
|
tPosition = GetNearestGridPosition( aPosition );
|
||||||
|
|
||||||
m_canvas->CrossHairOff( aDC );
|
m_canvas->CrossHairOff( aDC );
|
||||||
screen->SetMousePosition( tPosition );
|
SetMousePosition( tPosition );
|
||||||
GeneralControl( aDC, tPosition );
|
GeneralControl( aDC, tPosition );
|
||||||
|
|
||||||
for( std::list<MACROS_RECORD>::iterator i = m_Macros[aNumber].m_Record.begin();
|
for( std::list<MACROS_RECORD>::iterator i = m_Macros[aNumber].m_Record.begin();
|
||||||
i != m_Macros[aNumber].m_Record.end();
|
i != m_Macros[aNumber].m_Record.end();
|
||||||
i++ )
|
i++ )
|
||||||
{
|
{
|
||||||
wxPoint tmpPos = screen->GetNearestGridPosition( tPosition + i->m_Position );
|
wxPoint tmpPos = GetNearestGridPosition( tPosition + i->m_Position );
|
||||||
|
|
||||||
screen->SetMousePosition( tmpPos );
|
SetMousePosition( tmpPos );
|
||||||
|
|
||||||
GeneralControl( aDC, tmpPos, i->m_HotkeyCode );
|
GeneralControl( aDC, tmpPos, i->m_HotkeyCode );
|
||||||
}
|
}
|
||||||
|
@ -117,8 +116,8 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
|
||||||
MACROS_RECORD macros_record;
|
MACROS_RECORD macros_record;
|
||||||
macros_record.m_HotkeyCode = aHotkeyCode;
|
macros_record.m_HotkeyCode = aHotkeyCode;
|
||||||
macros_record.m_Idcommand = HK_Descr->m_Idcommand;
|
macros_record.m_Idcommand = HK_Descr->m_Idcommand;
|
||||||
macros_record.m_Position = screen->GetNearestGridPosition( aPosition ) -
|
macros_record.m_Position = GetNearestGridPosition( aPosition ) -
|
||||||
m_Macros[m_RecordingMacros].m_StartPosition;
|
m_Macros[m_RecordingMacros].m_StartPosition;
|
||||||
m_Macros[m_RecordingMacros].m_Record.push_back( macros_record );
|
m_Macros[m_RecordingMacros].m_Record.push_back( macros_record );
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf( _( "Add key [%c] in macro %d" ), aHotkeyCode, m_RecordingMacros );
|
msg.Printf( _( "Add key [%c] in macro %d" ), aHotkeyCode, m_RecordingMacros );
|
||||||
|
@ -162,8 +161,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
|
||||||
case HK_CALL_MACROS_7:
|
case HK_CALL_MACROS_7:
|
||||||
case HK_CALL_MACROS_8:
|
case HK_CALL_MACROS_8:
|
||||||
case HK_CALL_MACROS_9:
|
case HK_CALL_MACROS_9:
|
||||||
CallMacros( aDC, screen->GetCrossHairPosition( false ),
|
CallMacros( aDC, GetCrossHairPosition( false ), hk_id - HK_CALL_MACROS_0 );
|
||||||
hk_id - HK_CALL_MACROS_0 );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_SWITCH_TRACK_WIDTH_TO_NEXT:
|
case HK_SWITCH_TRACK_WIDTH_TO_NEXT:
|
||||||
|
@ -222,7 +220,6 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
|
||||||
cmd.SetEventType( wxEVT_COMMAND_COMBOBOX_SELECTED );
|
cmd.SetEventType( wxEVT_COMMAND_COMBOBOX_SELECTED );
|
||||||
OnSelectGrid( cmd );
|
OnSelectGrid( cmd );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_SWITCH_GRID_TO_PREVIOUS:
|
case HK_SWITCH_GRID_TO_PREVIOUS:
|
||||||
|
@ -344,8 +341,20 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_RESET_LOCAL_COORD: /*Reset the relative coord */
|
case HK_RESET_LOCAL_COORD: // Set the relative coord
|
||||||
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
|
GetScreen()->m_O_Curseur = GetCrossHairPosition();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HK_SET_GRID_ORIGIN:
|
||||||
|
SetGridOrigin( GetCrossHairPosition() );
|
||||||
|
OnModify(); // because grid origin is saved in board, show as modified
|
||||||
|
m_canvas->Refresh();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HK_RESET_GRID_ORIGIN:
|
||||||
|
SetGridOrigin( wxPoint(0,0) );
|
||||||
|
OnModify(); // because grid origin is saved in board, show as modified
|
||||||
|
m_canvas->Refresh();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_SWITCH_UNITS:
|
case HK_SWITCH_UNITS:
|
||||||
|
@ -498,7 +507,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
|
||||||
// get any module, locked or not locked and toggle its locked status
|
// get any module, locked or not locked and toggle its locked status
|
||||||
if( !itemCurrentlyEdited )
|
if( !itemCurrentlyEdited )
|
||||||
{
|
{
|
||||||
wxPoint pos = screen->RefPos( true );
|
wxPoint pos = RefPos( true );
|
||||||
module = GetBoard()->GetFootprint( pos, screen->m_Active_Layer, true );
|
module = GetBoard()->GetFootprint( pos, screen->m_Active_Layer, true );
|
||||||
}
|
}
|
||||||
else if( GetCurItem()->Type() == PCB_MODULE_T )
|
else if( GetCurItem()->Type() == PCB_MODULE_T )
|
||||||
|
@ -513,7 +522,6 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
|
||||||
OnModify();
|
OnModify();
|
||||||
SetMsgPanel( module );
|
SetMsgPanel( module );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_DRAG_ITEM: // Start drag module or track segment
|
case HK_DRAG_ITEM: // Start drag module or track segment
|
||||||
|
@ -586,7 +594,7 @@ bool PCB_EDIT_FRAME::OnHotkeyDeleteItem( wxDC* aDC )
|
||||||
case ID_PCB_MODULE_BUTT:
|
case ID_PCB_MODULE_BUTT:
|
||||||
if( ItemFree )
|
if( ItemFree )
|
||||||
{
|
{
|
||||||
wxPoint pos = GetScreen()->RefPos( false );
|
wxPoint pos = RefPos( false );
|
||||||
MODULE* module = GetBoard()->GetFootprint( pos, UNDEFINED_LAYER, false );
|
MODULE* module = GetBoard()->GetFootprint( pos, UNDEFINED_LAYER, false );
|
||||||
|
|
||||||
if( module == NULL )
|
if( module == NULL )
|
||||||
|
|
|
@ -51,12 +51,22 @@ void FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPos
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_HELP: // Display Current hotkey list
|
case HK_HELP: // Display Current hotkey list
|
||||||
DisplayHotkeyList( this, g_Module_Editor_Hokeys_Descr );
|
DisplayHotkeyList( this, g_Module_Editor_Hokeys_Descr );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_RESET_LOCAL_COORD: /*Reset the relative coord */
|
case HK_RESET_LOCAL_COORD: // set local (relative) coordinate origin
|
||||||
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
|
GetScreen()->m_O_Curseur = GetCrossHairPosition();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HK_SET_GRID_ORIGIN:
|
||||||
|
SetGridOrigin( GetCrossHairPosition() );
|
||||||
|
m_canvas->Refresh();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HK_RESET_GRID_ORIGIN:
|
||||||
|
SetGridOrigin( wxPoint(0,0) );
|
||||||
|
m_canvas->Refresh();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HK_SWITCH_UNITS:
|
case HK_SWITCH_UNITS:
|
||||||
|
|
|
@ -557,8 +557,13 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
|
||||||
Double2Str( aBoard->GetDesignSettings().m_SolderPasteMarginRatio ).c_str() );
|
Double2Str( aBoard->GetDesignSettings().m_SolderPasteMarginRatio ).c_str() );
|
||||||
|
|
||||||
m_out->Print( aNestLevel+1, "(aux_axis_origin %s %s)\n",
|
m_out->Print( aNestLevel+1, "(aux_axis_origin %s %s)\n",
|
||||||
FMTIU( aBoard->GetOriginAxisPosition().x ).c_str(),
|
FMTIU( aBoard->GetAuxOrigin().x ).c_str(),
|
||||||
FMTIU( aBoard->GetOriginAxisPosition().y ).c_str() );
|
FMTIU( aBoard->GetAuxOrigin().y ).c_str() );
|
||||||
|
|
||||||
|
if( aBoard->GetGridOrigin().x || aBoard->GetGridOrigin().y )
|
||||||
|
m_out->Print( aNestLevel+1, "(grid_origin %s %s)\n",
|
||||||
|
FMTIU( aBoard->GetGridOrigin().x ).c_str(),
|
||||||
|
FMTIU( aBoard->GetGridOrigin().y ).c_str() );
|
||||||
|
|
||||||
m_out->Print( aNestLevel+1, "(visible_elements %X)\n",
|
m_out->Print( aNestLevel+1, "(visible_elements %X)\n",
|
||||||
aBoard->GetDesignSettings().GetVisibleElements() );
|
aBoard->GetDesignSettings().GetVisibleElements() );
|
||||||
|
|
|
@ -649,7 +649,8 @@ void LEGACY_PLUGIN::loadSETUP()
|
||||||
BIU gx = biuParse( line + SZ( "AuxiliaryAxisOrg" ), &data );
|
BIU gx = biuParse( line + SZ( "AuxiliaryAxisOrg" ), &data );
|
||||||
BIU gy = biuParse( data );
|
BIU gy = biuParse( data );
|
||||||
|
|
||||||
m_board->SetOriginAxisPosition( wxPoint( gx, gy ) );
|
// m_board->SetAuxOrigin( wxPoint( gx, gy ) ); gets overwritten by SetDesignSettings() below
|
||||||
|
bds.m_AuxOrigin = wxPoint( gx, gy );
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( TESTLINE( "Layers" ) )
|
else if( TESTLINE( "Layers" ) )
|
||||||
|
@ -851,13 +852,11 @@ void LEGACY_PLUGIN::loadSETUP()
|
||||||
|
|
||||||
else if( TESTLINE( "GridOrigin" ) )
|
else if( TESTLINE( "GridOrigin" ) )
|
||||||
{
|
{
|
||||||
/* @todo
|
BIU x = biuParse( line + SZ( "GridOrigin" ), &data );
|
||||||
BIU gx = biuParse( line + SZ( "GridOrigin" ), &data );
|
BIU y = biuParse( data );
|
||||||
BIU gy = biuParse( data );
|
|
||||||
|
|
||||||
GetScreen()->m_GridOrigin.x = Ox;
|
// m_board->SetGridOrigin( wxPoint( x, y ) ); gets overwritten by SetDesignSettings() below
|
||||||
GetScreen()->m_GridOrigin.y = Oy;
|
bds.m_GridOrigin = wxPoint( x, y );
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( TESTLINE( "VisibleElements" ) )
|
else if( TESTLINE( "VisibleElements" ) )
|
||||||
|
@ -3071,14 +3070,8 @@ void LEGACY_PLUGIN::saveSETUP( const BOARD* aBoard ) const
|
||||||
if( bds.m_SolderPasteMarginRatio != 0 )
|
if( bds.m_SolderPasteMarginRatio != 0 )
|
||||||
fprintf( m_fp, "Pad2PasteClearanceRatio %g\n", bds.m_SolderPasteMarginRatio );
|
fprintf( m_fp, "Pad2PasteClearanceRatio %g\n", bds.m_SolderPasteMarginRatio );
|
||||||
|
|
||||||
/* @todo no aFrame
|
fprintf( m_fp, "GridOrigin %s\n", fmtBIUPoint( aBoard->GetGridOrigin() ).c_str() );
|
||||||
if ( aFrame->GetScreen()->m_GridOrigin != wxPoint( 0, 0 ) )
|
fprintf( m_fp, "AuxiliaryAxisOrg %s\n", fmtBIUPoint( aBoard->GetAuxOrigin() ).c_str() );
|
||||||
{
|
|
||||||
fprintf( m_fp, "GridOrigin %s\n", fmtBIUPoint( aFrame->GetScreen()->m_GridOrigin ).c_str() );
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
fprintf( m_fp, "AuxiliaryAxisOrg %s\n", fmtBIUPoint( aBoard->GetOriginAxisPosition() ).c_str() );
|
|
||||||
|
|
||||||
fprintf( m_fp, "VisibleElements %X\n", bds.GetVisibleElements() );
|
fprintf( m_fp, "VisibleElements %X\n", bds.GetVisibleElements() );
|
||||||
|
|
||||||
|
|
|
@ -725,7 +725,7 @@ MODULE* PCB_BASE_FRAME::Create_1_Module( const wxString& aModuleName )
|
||||||
GetBoard()->Add( module );
|
GetBoard()->Add( module );
|
||||||
|
|
||||||
// Update parameters: position, timestamp ...
|
// Update parameters: position, timestamp ...
|
||||||
newpos = GetScreen()->GetCrossHairPosition();
|
newpos = GetCrossHairPosition();
|
||||||
module->SetPosition( newpos );
|
module->SetPosition( newpos );
|
||||||
module->SetLastEditTime();
|
module->SetLastEditTime();
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule )
|
||||||
|
|
||||||
GetBoard()->BuildListOfNets();
|
GetBoard()->BuildListOfNets();
|
||||||
|
|
||||||
GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
|
SetCrossHairPosition( wxPoint( 0, 0 ) );
|
||||||
PlaceModule( aModule, NULL );
|
PlaceModule( aModule, NULL );
|
||||||
|
|
||||||
// Put it on FRONT layer,
|
// Put it on FRONT layer,
|
||||||
|
@ -155,7 +155,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary,
|
||||||
wxDC* aDC )
|
wxDC* aDC )
|
||||||
{
|
{
|
||||||
MODULE* module;
|
MODULE* module;
|
||||||
wxPoint curspos = GetScreen()->GetCrossHairPosition();
|
wxPoint curspos = GetCrossHairPosition();
|
||||||
wxString moduleName, keys;
|
wxString moduleName, keys;
|
||||||
wxString libName = aLibrary;
|
wxString libName = aLibrary;
|
||||||
bool allowWildSeach = true;
|
bool allowWildSeach = true;
|
||||||
|
@ -277,7 +277,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GetScreen()->SetCrossHairPosition( curspos );
|
SetCrossHairPosition( curspos );
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
|
|
||||||
if( module )
|
if( module )
|
||||||
|
|
|
@ -116,7 +116,7 @@ bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize,
|
||||||
TRACK* currTrack = g_CurrentTrackSegment;
|
TRACK* currTrack = g_CurrentTrackSegment;
|
||||||
BOARD_ITEM* currItem = frame->GetCurItem();
|
BOARD_ITEM* currItem = frame->GetCurItem();
|
||||||
PCB_SCREEN* screen = frame->GetScreen();
|
PCB_SCREEN* screen = frame->GetScreen();
|
||||||
wxPoint pos = screen->RefPos( true );
|
wxPoint pos = frame->RefPos( true );
|
||||||
|
|
||||||
// D( printf( "currTrack=%p currItem=%p currTrack->Type()=%d currItem->Type()=%d\n", currTrack, currItem, currTrack ? currTrack->Type() : 0, currItem ? currItem->Type() : 0 ); )
|
// D( printf( "currTrack=%p currItem=%p currTrack->Type()=%d currItem->Type()=%d\n", currTrack, currItem, currTrack ? currTrack->Type() : 0, currItem ? currItem->Type() : 0 ); )
|
||||||
|
|
||||||
|
@ -133,7 +133,6 @@ bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize,
|
||||||
currTrack = NULL;
|
currTrack = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if( g_MagneticPadOption == capture_always )
|
if( g_MagneticPadOption == capture_always )
|
||||||
doPad = true;
|
doPad = true;
|
||||||
|
|
||||||
|
|
|
@ -105,8 +105,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
KiBitmap( save_xpm ) );
|
KiBitmap( save_xpm ) );
|
||||||
|
|
||||||
// Save As
|
// Save As
|
||||||
AddMenuItem( filesMenu, ID_SAVE_BOARD_AS,
|
text = AddHotkeyName( _( "Sa&ve As..." ), g_Board_Editor_Hokeys_Descr, HK_SAVE_BOARD_AS );
|
||||||
_( "Sa&ve As...\tCtrl+Shift+S" ),
|
AddMenuItem( filesMenu, ID_SAVE_BOARD_AS, text,
|
||||||
_( "Save the current board as..." ),
|
_( "Save the current board as..." ),
|
||||||
KiBitmap( save_as_xpm ) );
|
KiBitmap( save_as_xpm ) );
|
||||||
filesMenu->AppendSeparator();
|
filesMenu->AppendSeparator();
|
||||||
|
|
|
@ -16,14 +16,14 @@
|
||||||
#include <protos.h>
|
#include <protos.h>
|
||||||
|
|
||||||
|
|
||||||
/* Routines Locales */
|
// Routines Locales
|
||||||
static void AbortMoveAndEditTarget( EDA_DRAW_PANEL* Panel, wxDC* DC );
|
static void AbortMoveAndEditTarget( EDA_DRAW_PANEL* Panel, wxDC* DC );
|
||||||
static void ShowTargetShapeWhileMovingMouse( EDA_DRAW_PANEL* aPanel,
|
static void ShowTargetShapeWhileMovingMouse( EDA_DRAW_PANEL* aPanel,
|
||||||
wxDC* aDC,
|
wxDC* aDC,
|
||||||
const wxPoint& aPosition,
|
const wxPoint& aPosition,
|
||||||
bool aErase );
|
bool aErase );
|
||||||
|
|
||||||
/* Local variables : */
|
// Local variables :
|
||||||
static int MireDefaultSize = 5000;
|
static int MireDefaultSize = 5000;
|
||||||
static PCB_TARGET s_TargetCopy( NULL ); /* Used to store "old" values of the
|
static PCB_TARGET s_TargetCopy( NULL ); /* Used to store "old" values of the
|
||||||
* current item parameters before
|
* current item parameters before
|
||||||
|
@ -93,7 +93,7 @@ TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR( PCB_EDIT_FRAME
|
||||||
MainBoxSizer->Add( LeftBoxSizer, 0, wxGROW | wxALL, 5 );
|
MainBoxSizer->Add( LeftBoxSizer, 0, wxGROW | wxALL, 5 );
|
||||||
MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
||||||
|
|
||||||
/* Create of the command buttons. */
|
// Create of the command buttons.
|
||||||
Button = new wxButton( this, wxID_OK, _( "OK" ) );
|
Button = new wxButton( this, wxID_OK, _( "OK" ) );
|
||||||
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
|
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ PCB_TARGET* PCB_EDIT_FRAME::CreateTarget( wxDC* DC )
|
||||||
target->SetLayer( EDGE_N );
|
target->SetLayer( EDGE_N );
|
||||||
target->SetWidth( GetDesignSettings().m_EdgeSegmentWidth );
|
target->SetWidth( GetDesignSettings().m_EdgeSegmentWidth );
|
||||||
target->SetSize( MireDefaultSize );
|
target->SetSize( MireDefaultSize );
|
||||||
target->SetPosition( m_canvas->GetScreen()->GetCrossHairPosition() );
|
target->SetPosition( GetCrossHairPosition() );
|
||||||
|
|
||||||
PlaceTarget( target, DC );
|
PlaceTarget( target, DC );
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ void PCB_EDIT_FRAME::PlaceTarget( PCB_TARGET* aTarget, wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Redraw the contour of the track while moving the mouse */
|
// Redraw the contour of the track while moving the mouse
|
||||||
static void ShowTargetShapeWhileMovingMouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
static void ShowTargetShapeWhileMovingMouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
||||||
const wxPoint& aPosition, bool aErase )
|
const wxPoint& aPosition, bool aErase )
|
||||||
{
|
{
|
||||||
|
@ -286,7 +286,7 @@ static void ShowTargetShapeWhileMovingMouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
||||||
if( aErase )
|
if( aErase )
|
||||||
target->Draw( aPanel, aDC, GR_XOR );
|
target->Draw( aPanel, aDC, GR_XOR );
|
||||||
|
|
||||||
target->SetPosition( screen->GetCrossHairPosition() );
|
target->SetPosition( aPanel->GetParent()->GetCrossHairPosition() );
|
||||||
|
|
||||||
target->Draw( aPanel, aDC, GR_XOR );
|
target->Draw( aPanel, aDC, GR_XOR );
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,9 +87,9 @@ BOARD_ITEM* FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay( int aHotKeyCode )
|
||||||
scanList = GENERAL_COLLECTOR::ModulesAndTheirItems;
|
scanList = GENERAL_COLLECTOR::ModulesAndTheirItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Collector->Collect( GetBoard(), scanList, GetScreen()->RefPos( true ), guide );
|
m_Collector->Collect( GetBoard(), scanList, RefPos( true ), guide );
|
||||||
|
|
||||||
/* Remove redundancies: when an item is found, we can remove the module from list */
|
// Remove redundancies: when an item is found, we can remove the module from list
|
||||||
if( m_Collector->GetCount() > 1 )
|
if( m_Collector->GetCount() > 1 )
|
||||||
{
|
{
|
||||||
for( int ii = 0; ii < m_Collector->GetCount(); ii++ )
|
for( int ii = 0; ii < m_Collector->GetCount(); ii++ )
|
||||||
|
@ -113,7 +113,7 @@ BOARD_ITEM* FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay( int aHotKeyCode )
|
||||||
{
|
{
|
||||||
wxMenu itemMenu;
|
wxMenu itemMenu;
|
||||||
|
|
||||||
/* Give a title to the selection menu. This is also a cancel menu item **/
|
// Give a title to the selection menu. This is also a cancel menu item *
|
||||||
wxMenuItem* item_title = new wxMenuItem( &itemMenu, -1, _( "Selection Clarification" ) );
|
wxMenuItem* item_title = new wxMenuItem( &itemMenu, -1, _( "Selection Clarification" ) );
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
|
@ -255,100 +255,100 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_OPEN_MODULE_VIEWER:
|
case ID_OPEN_MODULE_VIEWER:
|
||||||
{
|
|
||||||
FOOTPRINT_VIEWER_FRAME * viewer = FOOTPRINT_VIEWER_FRAME::GetActiveFootprintViewer();
|
|
||||||
|
|
||||||
if( viewer == NULL )
|
|
||||||
{
|
{
|
||||||
viewer = new FOOTPRINT_VIEWER_FRAME( this, m_footprintLibTable, NULL );
|
FOOTPRINT_VIEWER_FRAME * viewer = FOOTPRINT_VIEWER_FRAME::GetActiveFootprintViewer();
|
||||||
viewer->Show( true );
|
|
||||||
viewer->Zoom_Automatique( false );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( viewer->IsIconized() )
|
|
||||||
viewer->Iconize( false );
|
|
||||||
|
|
||||||
viewer->Raise();
|
if( viewer == NULL )
|
||||||
|
{
|
||||||
|
viewer = new FOOTPRINT_VIEWER_FRAME( this, m_footprintLibTable, NULL );
|
||||||
|
viewer->Show( true );
|
||||||
|
viewer->Zoom_Automatique( false );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( viewer->IsIconized() )
|
||||||
|
viewer->Iconize( false );
|
||||||
|
|
||||||
// Raising the window does not set the focus on Linux. This should work on
|
viewer->Raise();
|
||||||
// any platform.
|
|
||||||
if( wxWindow::FindFocus() != viewer )
|
// Raising the window does not set the focus on Linux. This should work on
|
||||||
viewer->SetFocus();
|
// any platform.
|
||||||
|
if( wxWindow::FindFocus() != viewer )
|
||||||
|
viewer->SetFocus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_MODEDIT_DELETE_PART:
|
case ID_MODEDIT_DELETE_PART:
|
||||||
DeleteModuleFromCurrentLibrary();
|
DeleteModuleFromCurrentLibrary();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_MODEDIT_NEW_MODULE:
|
case ID_MODEDIT_NEW_MODULE:
|
||||||
{
|
|
||||||
Clear_Pcb( true );
|
|
||||||
GetScreen()->ClearUndoRedoList();
|
|
||||||
SetCurItem( NULL );
|
|
||||||
GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
|
|
||||||
|
|
||||||
MODULE* module = Create_1_Module( wxEmptyString );
|
|
||||||
|
|
||||||
if( module ) // i.e. if create module command not aborted
|
|
||||||
{
|
{
|
||||||
// Initialize data relative to nets and netclasses (for a new
|
Clear_Pcb( true );
|
||||||
// module the defaults are used)
|
GetScreen()->ClearUndoRedoList();
|
||||||
// This is mandatory to handle and draw pads
|
SetCurItem( NULL );
|
||||||
GetBoard()->BuildListOfNets();
|
SetCrossHairPosition( wxPoint( 0, 0 ) );
|
||||||
redraw = true;
|
|
||||||
module->SetPosition( wxPoint( 0, 0 ) );
|
|
||||||
|
|
||||||
if( GetBoard()->m_Modules )
|
MODULE* module = Create_1_Module( wxEmptyString );
|
||||||
GetBoard()->m_Modules->ClearFlags();
|
|
||||||
|
|
||||||
Zoom_Automatique( false );
|
if( module ) // i.e. if create module command not aborted
|
||||||
|
{
|
||||||
|
// Initialize data relative to nets and netclasses (for a new
|
||||||
|
// module the defaults are used)
|
||||||
|
// This is mandatory to handle and draw pads
|
||||||
|
GetBoard()->BuildListOfNets();
|
||||||
|
redraw = true;
|
||||||
|
module->SetPosition( wxPoint( 0, 0 ) );
|
||||||
|
|
||||||
|
if( GetBoard()->m_Modules )
|
||||||
|
GetBoard()->m_Modules->ClearFlags();
|
||||||
|
|
||||||
|
Zoom_Automatique( false );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_MODEDIT_NEW_MODULE_FROM_WIZARD:
|
case ID_MODEDIT_NEW_MODULE_FROM_WIZARD:
|
||||||
{
|
|
||||||
Clear_Pcb( true );
|
|
||||||
GetScreen()->ClearUndoRedoList();
|
|
||||||
SetCurItem( NULL );
|
|
||||||
GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
|
|
||||||
|
|
||||||
wxSemaphore semaphore( 0, 1 );
|
|
||||||
FOOTPRINT_WIZARD_FRAME *wizard = new FOOTPRINT_WIZARD_FRAME( this, &semaphore,
|
|
||||||
KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT );
|
|
||||||
wizard->Show( true );
|
|
||||||
wizard->Zoom_Automatique( false );
|
|
||||||
|
|
||||||
while( semaphore.TryWait() == wxSEMA_BUSY ) // Wait for viewer closing event
|
|
||||||
{
|
{
|
||||||
wxYield();
|
Clear_Pcb( true );
|
||||||
wxMilliSleep( 50 );
|
GetScreen()->ClearUndoRedoList();
|
||||||
|
SetCurItem( NULL );
|
||||||
|
SetCrossHairPosition( wxPoint( 0, 0 ) );
|
||||||
|
|
||||||
|
wxSemaphore semaphore( 0, 1 );
|
||||||
|
FOOTPRINT_WIZARD_FRAME *wizard = new FOOTPRINT_WIZARD_FRAME( this, &semaphore,
|
||||||
|
KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT );
|
||||||
|
wizard->Show( true );
|
||||||
|
wizard->Zoom_Automatique( false );
|
||||||
|
|
||||||
|
while( semaphore.TryWait() == wxSEMA_BUSY ) // Wait for viewer closing event
|
||||||
|
{
|
||||||
|
wxYield();
|
||||||
|
wxMilliSleep( 50 );
|
||||||
|
}
|
||||||
|
|
||||||
|
MODULE* module = wizard->GetBuiltFootprint();
|
||||||
|
|
||||||
|
if( module ) // i.e. if create module command not aborted
|
||||||
|
{
|
||||||
|
// Here we should make a copy of the object before adding to board
|
||||||
|
module->SetParent( (EDA_ITEM*)GetBoard() );
|
||||||
|
GetBoard()->m_Modules.Append( module );
|
||||||
|
|
||||||
|
// Initialize data relative to nets and netclasses (for a new
|
||||||
|
// module the defaults are used)
|
||||||
|
// This is mandatory to handle and draw pads
|
||||||
|
GetBoard()->BuildListOfNets();
|
||||||
|
redraw = true;
|
||||||
|
module->SetPosition( wxPoint( 0, 0 ) );
|
||||||
|
|
||||||
|
if( GetBoard()->m_Modules )
|
||||||
|
GetBoard()->m_Modules->ClearFlags();
|
||||||
|
}
|
||||||
|
|
||||||
|
wizard->Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
MODULE* module = wizard->GetBuiltFootprint();
|
|
||||||
|
|
||||||
if( module ) // i.e. if create module command not aborted
|
|
||||||
{
|
|
||||||
/* Here we should make a copy of the object before adding to board*/
|
|
||||||
module->SetParent( (EDA_ITEM*)GetBoard() );
|
|
||||||
GetBoard()->m_Modules.Append( module );
|
|
||||||
|
|
||||||
// Initialize data relative to nets and netclasses (for a new
|
|
||||||
// module the defaults are used)
|
|
||||||
// This is mandatory to handle and draw pads
|
|
||||||
GetBoard()->BuildListOfNets();
|
|
||||||
redraw = true;
|
|
||||||
module->SetPosition( wxPoint( 0, 0 ) );
|
|
||||||
|
|
||||||
if( GetBoard()->m_Modules )
|
|
||||||
GetBoard()->m_Modules->ClearFlags();
|
|
||||||
}
|
|
||||||
|
|
||||||
wizard->Destroy();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_MODEDIT_SAVE_LIBMODULE:
|
case ID_MODEDIT_SAVE_LIBMODULE:
|
||||||
|
@ -361,84 +361,84 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
|
||||||
case ID_MODEDIT_INSERT_MODULE_IN_BOARD:
|
case ID_MODEDIT_INSERT_MODULE_IN_BOARD:
|
||||||
case ID_MODEDIT_UPDATE_MODULE_IN_BOARD:
|
case ID_MODEDIT_UPDATE_MODULE_IN_BOARD:
|
||||||
{
|
|
||||||
// update module in the current board,
|
|
||||||
// not just add it to the board with total disregard for the netlist...
|
|
||||||
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) GetParent();
|
|
||||||
BOARD* mainpcb = pcbframe->GetBoard();
|
|
||||||
MODULE* source_module = NULL;
|
|
||||||
MODULE* module_in_edit = GetBoard()->m_Modules;
|
|
||||||
|
|
||||||
// Search the old module (source) if exists
|
|
||||||
// Because this source could be deleted when editing the main board...
|
|
||||||
if( module_in_edit->GetLink() ) // this is not a new module ...
|
|
||||||
{
|
{
|
||||||
source_module = mainpcb->m_Modules;
|
// update module in the current board,
|
||||||
|
// not just add it to the board with total disregard for the netlist...
|
||||||
|
PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) GetParent();
|
||||||
|
BOARD* mainpcb = pcbframe->GetBoard();
|
||||||
|
MODULE* source_module = NULL;
|
||||||
|
MODULE* module_in_edit = GetBoard()->m_Modules;
|
||||||
|
|
||||||
for( ; source_module != NULL; source_module = (MODULE*) source_module->Next() )
|
// Search the old module (source) if exists
|
||||||
|
// Because this source could be deleted when editing the main board...
|
||||||
|
if( module_in_edit->GetLink() ) // this is not a new module ...
|
||||||
{
|
{
|
||||||
if( module_in_edit->GetLink() == source_module->GetTimeStamp() )
|
source_module = mainpcb->m_Modules;
|
||||||
break;
|
|
||||||
|
for( ; source_module != NULL; source_module = (MODULE*) source_module->Next() )
|
||||||
|
{
|
||||||
|
if( module_in_edit->GetLink() == source_module->GetTimeStamp() )
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( ( source_module == NULL )
|
||||||
|
&& ( id == ID_MODEDIT_UPDATE_MODULE_IN_BOARD ) ) // source not found
|
||||||
|
{
|
||||||
|
wxString msg;
|
||||||
|
msg.Printf( _( "Unable to find the footprint source on the main board" ) );
|
||||||
|
msg << _( "\nCannot update the footprint" );
|
||||||
|
DisplayError( this, msg );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ( source_module != NULL )
|
||||||
|
&& ( id == ID_MODEDIT_INSERT_MODULE_IN_BOARD ) ) // source not found
|
||||||
|
{
|
||||||
|
wxString msg;
|
||||||
|
msg.Printf( _( "A footprint source was found on the main board" ) );
|
||||||
|
msg << _( "\nCannot insert this footprint" );
|
||||||
|
DisplayError( this, msg );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create the "new" module
|
||||||
|
MODULE* newmodule = new MODULE( *module_in_edit );
|
||||||
|
newmodule->SetParent( mainpcb );
|
||||||
|
newmodule->SetLink( 0 );
|
||||||
|
|
||||||
|
// Put the footprint in the main pcb linked list.
|
||||||
|
mainpcb->Add( newmodule );
|
||||||
|
|
||||||
|
if( source_module ) // this is an update command
|
||||||
|
{
|
||||||
|
// In the main board,
|
||||||
|
// the new module replace the old module (pos, orient, ref, value
|
||||||
|
// and connexions are kept)
|
||||||
|
// and the source_module (old module) is deleted
|
||||||
|
PICKED_ITEMS_LIST pickList;
|
||||||
|
pcbframe->Exchange_Module( source_module, newmodule, &pickList );
|
||||||
|
newmodule->SetTimeStamp( module_in_edit->GetLink() );
|
||||||
|
|
||||||
|
if( pickList.GetCount() )
|
||||||
|
pcbframe->SaveCopyInUndoList( pickList, UR_UNSPECIFIED );
|
||||||
|
}
|
||||||
|
else // This is an insert command
|
||||||
|
{
|
||||||
|
wxPoint cursor_pos = pcbframe->GetCrossHairPosition();
|
||||||
|
pcbframe->SetCrossHairPosition( wxPoint( 0, 0 ) );
|
||||||
|
pcbframe->PlaceModule( newmodule, NULL );
|
||||||
|
pcbframe->SetCrossHairPosition( cursor_pos );
|
||||||
|
newmodule->SetTimeStamp( GetNewTimeStamp() );
|
||||||
|
pcbframe->SaveCopyInUndoList( newmodule, UR_NEW );
|
||||||
|
}
|
||||||
|
|
||||||
|
newmodule->ClearFlags();
|
||||||
|
GetScreen()->ClrModify();
|
||||||
|
pcbframe->SetCurItem( NULL );
|
||||||
|
mainpcb->m_Status_Pcb = 0;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
if( ( source_module == NULL )
|
|
||||||
&& ( id == ID_MODEDIT_UPDATE_MODULE_IN_BOARD ) ) // source not found
|
|
||||||
{
|
|
||||||
wxString msg;
|
|
||||||
msg.Printf( _( "Unable to find the footprint source on the main board" ) );
|
|
||||||
msg << _( "\nCannot update the footprint" );
|
|
||||||
DisplayError( this, msg );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ( source_module != NULL )
|
|
||||||
&& ( id == ID_MODEDIT_INSERT_MODULE_IN_BOARD ) ) // source not found
|
|
||||||
{
|
|
||||||
wxString msg;
|
|
||||||
msg.Printf( _( "A footprint source was found on the main board" ) );
|
|
||||||
msg << _( "\nCannot insert this footprint" );
|
|
||||||
DisplayError( this, msg );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the "new" module
|
|
||||||
MODULE* newmodule = new MODULE( *module_in_edit );
|
|
||||||
newmodule->SetParent( mainpcb );
|
|
||||||
newmodule->SetLink( 0 );
|
|
||||||
|
|
||||||
// Put the footprint in the main pcb linked list.
|
|
||||||
mainpcb->Add( newmodule );
|
|
||||||
|
|
||||||
if( source_module ) // this is an update command
|
|
||||||
{
|
|
||||||
// In the main board,
|
|
||||||
// the new module replace the old module (pos, orient, ref, value
|
|
||||||
// and connexions are kept)
|
|
||||||
// and the source_module (old module) is deleted
|
|
||||||
PICKED_ITEMS_LIST pickList;
|
|
||||||
pcbframe->Exchange_Module( source_module, newmodule, &pickList );
|
|
||||||
newmodule->SetTimeStamp( module_in_edit->GetLink() );
|
|
||||||
|
|
||||||
if( pickList.GetCount() )
|
|
||||||
pcbframe->SaveCopyInUndoList( pickList, UR_UNSPECIFIED );
|
|
||||||
}
|
|
||||||
else // This is an insert command
|
|
||||||
{
|
|
||||||
wxPoint cursor_pos = pcbframe->GetScreen()->GetCrossHairPosition();
|
|
||||||
pcbframe->GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
|
|
||||||
pcbframe->PlaceModule( newmodule, NULL );
|
|
||||||
pcbframe->GetScreen()->SetCrossHairPosition( cursor_pos );
|
|
||||||
newmodule->SetTimeStamp( GetNewTimeStamp() );
|
|
||||||
pcbframe->SaveCopyInUndoList( newmodule, UR_NEW );
|
|
||||||
}
|
|
||||||
|
|
||||||
newmodule->ClearFlags();
|
|
||||||
GetScreen()->ClrModify();
|
|
||||||
pcbframe->SetCurItem( NULL );
|
|
||||||
mainpcb->m_Status_Pcb = 0;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_MODEDIT_IMPORT_PART:
|
case ID_MODEDIT_IMPORT_PART:
|
||||||
if( ! Clear_Pcb( true ) )
|
if( ! Clear_Pcb( true ) )
|
||||||
|
@ -446,7 +446,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
|
||||||
GetScreen()->ClearUndoRedoList();
|
GetScreen()->ClearUndoRedoList();
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
|
SetCrossHairPosition( wxPoint( 0, 0 ) );
|
||||||
Import_Module();
|
Import_Module();
|
||||||
redraw = true;
|
redraw = true;
|
||||||
|
|
||||||
|
@ -485,7 +485,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
GetScreen()->ClearUndoRedoList();
|
GetScreen()->ClearUndoRedoList();
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
Clear_Pcb( true );
|
Clear_Pcb( true );
|
||||||
GetScreen()->SetCrossHairPosition( wxPoint( 0, 0 ) );
|
SetCrossHairPosition( wxPoint( 0, 0 ) );
|
||||||
|
|
||||||
#if !defined( USE_FP_LIB_TABLE )
|
#if !defined( USE_FP_LIB_TABLE )
|
||||||
LoadModuleFromLibrary( getLibPath(), m_footprintLibTable, true );
|
LoadModuleFromLibrary( getLibPath(), m_footprintLibTable, true );
|
||||||
|
|
|
@ -132,32 +132,31 @@ void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_MODEDIT_ANCHOR_TOOL:
|
case ID_MODEDIT_ANCHOR_TOOL:
|
||||||
{
|
{
|
||||||
MODULE* module = GetBoard()->m_Modules;
|
MODULE* module = GetBoard()->m_Modules;
|
||||||
|
|
||||||
if( module == NULL // No module loaded
|
if( module == NULL // No module loaded
|
||||||
|| (module->GetFlags() != 0) )
|
|| (module->GetFlags() != 0) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
SaveCopyInUndoList( module, UR_MODEDIT );
|
SaveCopyInUndoList( module, UR_MODEDIT );
|
||||||
|
|
||||||
// set the new relative internal local coordinates of footprint items
|
// set the new relative internal local coordinates of footprint items
|
||||||
wxPoint moveVector = module->GetPosition() -
|
wxPoint moveVector = module->GetPosition() - GetCrossHairPosition();
|
||||||
GetScreen()->GetCrossHairPosition();
|
module->MoveAnchorPosition( moveVector );
|
||||||
module->MoveAnchorPosition( moveVector );
|
|
||||||
|
|
||||||
// Usually, we do not need to change twice the anchor position,
|
// Usually, we do not need to change twice the anchor position,
|
||||||
// so deselect the active tool
|
// so deselect the active tool
|
||||||
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
|
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
m_canvas->Refresh();
|
m_canvas->Refresh();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_MODEDIT_PLACE_GRID_COORD:
|
case ID_MODEDIT_PLACE_GRID_COORD:
|
||||||
m_canvas->DrawGridAxis( DC, GR_XOR );
|
m_canvas->DrawGridAxis( DC, GR_XOR, GetBoard()->GetGridOrigin() );
|
||||||
GetScreen()->m_GridOrigin = GetScreen()->GetCrossHairPosition();
|
SetGridOrigin( GetCrossHairPosition() );
|
||||||
m_canvas->DrawGridAxis( DC, GR_COPY );
|
m_canvas->DrawGridAxis( DC, GR_COPY, GetBoard()->GetGridOrigin() );
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -497,9 +497,9 @@ void FOOTPRINT_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition,
|
||||||
snapToGrid = false;
|
snapToGrid = false;
|
||||||
|
|
||||||
if( snapToGrid )
|
if( snapToGrid )
|
||||||
pos = GetScreen()->GetNearestGridPosition( pos );
|
pos = GetNearestGridPosition( pos );
|
||||||
|
|
||||||
oldpos = GetScreen()->GetCrossHairPosition();
|
oldpos = GetCrossHairPosition();
|
||||||
gridSize = GetScreen()->GetGridSize();
|
gridSize = GetScreen()->GetGridSize();
|
||||||
|
|
||||||
switch( aHotKey )
|
switch( aHotKey )
|
||||||
|
@ -532,14 +532,14 @@ void FOOTPRINT_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetScreen()->SetCrossHairPosition( pos, snapToGrid );
|
SetCrossHairPosition( pos, snapToGrid );
|
||||||
|
|
||||||
if( oldpos != GetScreen()->GetCrossHairPosition() )
|
if( oldpos != GetCrossHairPosition() )
|
||||||
{
|
{
|
||||||
pos = GetScreen()->GetCrossHairPosition();
|
pos = GetCrossHairPosition();
|
||||||
GetScreen()->SetCrossHairPosition( oldpos, false );
|
SetCrossHairPosition( oldpos, false );
|
||||||
m_canvas->CrossHairOff( aDC );
|
m_canvas->CrossHairOff( aDC );
|
||||||
GetScreen()->SetCrossHairPosition( pos, snapToGrid );
|
SetCrossHairPosition( pos, snapToGrid );
|
||||||
m_canvas->CrossHairOn( aDC );
|
m_canvas->CrossHairOn( aDC );
|
||||||
|
|
||||||
if( m_canvas->IsMouseCaptured() )
|
if( m_canvas->IsMouseCaptured() )
|
||||||
|
|
|
@ -244,7 +244,7 @@ void MoveFootprint( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Redraw the module at the new position. */
|
/* Redraw the module at the new position. */
|
||||||
g_Offset_Module = module->GetPosition() - aPanel->GetScreen()->GetCrossHairPosition();
|
g_Offset_Module = module->GetPosition() - aPanel->GetParent()->GetCrossHairPosition();
|
||||||
DrawModuleOutlines( aPanel, aDC, module );
|
DrawModuleOutlines( aPanel, aDC, module );
|
||||||
|
|
||||||
DrawSegmentWhileMovingFootprint( aPanel, aDC );
|
DrawSegmentWhileMovingFootprint( aPanel, aDC );
|
||||||
|
@ -391,7 +391,7 @@ void PCB_BASE_FRAME::PlaceModule( MODULE* aModule, wxDC* aDC, bool aDoNotRecreat
|
||||||
if( g_Show_Module_Ratsnest && ( GetBoard()->m_Status_Pcb & LISTE_PAD_OK ) && aDC )
|
if( g_Show_Module_Ratsnest && ( GetBoard()->m_Status_Pcb & LISTE_PAD_OK ) && aDC )
|
||||||
TraceModuleRatsNest( aDC );
|
TraceModuleRatsNest( aDC );
|
||||||
|
|
||||||
newpos = GetScreen()->GetCrossHairPosition();
|
newpos = GetCrossHairPosition();
|
||||||
aModule->SetPosition( newpos );
|
aModule->SetPosition( newpos );
|
||||||
aModule->ClearFlags();
|
aModule->ClearFlags();
|
||||||
|
|
||||||
|
|
|
@ -369,7 +369,7 @@ void FOOTPRINT_VIEWER_FRAME::OnSize( wxSizeEvent& SizeEv )
|
||||||
|
|
||||||
void FOOTPRINT_VIEWER_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
|
void FOOTPRINT_VIEWER_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
GetScreen()->m_O_Curseur = GetScreen()->GetCrossHairPosition();
|
GetScreen()->m_O_Curseur = GetCrossHairPosition();
|
||||||
UpdateStatusBar();
|
UpdateStatusBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -644,8 +644,8 @@ void FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition
|
||||||
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
||||||
cmd.SetEventObject( this );
|
cmd.SetEventObject( this );
|
||||||
|
|
||||||
pos = screen->GetNearestGridPosition( pos );
|
pos = GetNearestGridPosition( pos );
|
||||||
oldpos = screen->GetCrossHairPosition();
|
oldpos = GetCrossHairPosition();
|
||||||
gridSize = screen->GetGridSize();
|
gridSize = screen->GetGridSize();
|
||||||
|
|
||||||
switch( aHotKey )
|
switch( aHotKey )
|
||||||
|
@ -676,7 +676,7 @@ void FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ' ':
|
case ' ':
|
||||||
screen->m_O_Curseur = screen->GetCrossHairPosition();
|
screen->m_O_Curseur = GetCrossHairPosition();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD8: /* cursor moved up */
|
case WXK_NUMPAD8: /* cursor moved up */
|
||||||
|
@ -704,14 +704,14 @@ void FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
screen->SetCrossHairPosition( pos );
|
SetCrossHairPosition( pos );
|
||||||
|
|
||||||
if( oldpos != screen->GetCrossHairPosition() )
|
if( oldpos != GetCrossHairPosition() )
|
||||||
{
|
{
|
||||||
pos = screen->GetCrossHairPosition();
|
pos = GetCrossHairPosition();
|
||||||
screen->SetCrossHairPosition( oldpos );
|
SetCrossHairPosition( oldpos );
|
||||||
m_canvas->CrossHairOff( aDC );
|
m_canvas->CrossHairOff( aDC );
|
||||||
screen->SetCrossHairPosition( pos );
|
SetCrossHairPosition( pos );
|
||||||
m_canvas->CrossHairOn( aDC );
|
m_canvas->CrossHairOn( aDC );
|
||||||
|
|
||||||
if( m_canvas->IsMouseCaptured() )
|
if( m_canvas->IsMouseCaptured() )
|
||||||
|
|
|
@ -63,7 +63,6 @@ static void Show_Pad_Move( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPo
|
||||||
bool aErase )
|
bool aErase )
|
||||||
{
|
{
|
||||||
TRACK* Track;
|
TRACK* Track;
|
||||||
BASE_SCREEN* screen = aPanel->GetScreen();
|
|
||||||
D_PAD* pad = s_CurrentSelectedPad;
|
D_PAD* pad = s_CurrentSelectedPad;
|
||||||
|
|
||||||
if( pad == NULL ) // Should not occur
|
if( pad == NULL ) // Should not occur
|
||||||
|
@ -72,7 +71,7 @@ static void Show_Pad_Move( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPo
|
||||||
if( aErase )
|
if( aErase )
|
||||||
pad->Draw( aPanel, aDC, GR_XOR );
|
pad->Draw( aPanel, aDC, GR_XOR );
|
||||||
|
|
||||||
pad->SetPosition( screen->GetCrossHairPosition() );
|
pad->SetPosition( aPanel->GetParent()->GetCrossHairPosition() );
|
||||||
pad->Draw( aPanel, aDC, GR_XOR );
|
pad->Draw( aPanel, aDC, GR_XOR );
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
|
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
|
||||||
|
|
|
@ -85,7 +85,7 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
|
||||||
frame->SetCurItem( NULL );
|
frame->SetCurItem( NULL );
|
||||||
aPanel->SetMouseCapture( NULL, NULL );
|
aPanel->SetMouseCapture( NULL, NULL );
|
||||||
|
|
||||||
/* Undo move and redraw trace segments. */
|
// Undo move and redraw trace segments.
|
||||||
for( unsigned jj=0 ; jj < g_DragSegmentList.size(); jj++ )
|
for( unsigned jj=0 ; jj < g_DragSegmentList.size(); jj++ )
|
||||||
{
|
{
|
||||||
TRACK* track = g_DragSegmentList[jj].m_Track;
|
TRACK* track = g_DragSegmentList[jj].m_Track;
|
||||||
|
@ -101,12 +101,11 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Redraw the moved node according to the mouse cursor position */
|
// Redraw the moved node according to the mouse cursor position
|
||||||
static void Show_MoveNode( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
static void Show_MoveNode( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
|
||||||
bool aErase )
|
bool aErase )
|
||||||
{
|
{
|
||||||
wxPoint moveVector;
|
wxPoint moveVector;
|
||||||
BASE_SCREEN* screen = aPanel->GetScreen();
|
|
||||||
int tmp = DisplayOpt.DisplayPcbTrackFill;
|
int tmp = DisplayOpt.DisplayPcbTrackFill;
|
||||||
GR_DRAWMODE draw_mode = GR_XOR | GR_HIGHLIGHT;
|
GR_DRAWMODE draw_mode = GR_XOR | GR_HIGHLIGHT;
|
||||||
|
|
||||||
|
@ -118,8 +117,8 @@ static void Show_MoveNode( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPo
|
||||||
aErase = false;
|
aErase = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* set the new track coordinates */
|
// set the new track coordinates
|
||||||
wxPoint Pos = screen->GetCrossHairPosition();
|
wxPoint Pos = aPanel->GetParent()->GetCrossHairPosition();
|
||||||
|
|
||||||
moveVector = Pos - s_LastPos;
|
moveVector = Pos - s_LastPos;
|
||||||
s_LastPos = Pos;
|
s_LastPos = Pos;
|
||||||
|
@ -202,7 +201,6 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel, wxDC
|
||||||
double xi1 = 0, yi1 = 0, xi2 = 0, yi2 = 0; // calculated intersection points
|
double xi1 = 0, yi1 = 0, xi2 = 0, yi2 = 0; // calculated intersection points
|
||||||
double tx1, tx2, ty1, ty2; // temporary storage of points
|
double tx1, tx2, ty1, ty2; // temporary storage of points
|
||||||
int dx, dy;
|
int dx, dy;
|
||||||
BASE_SCREEN* screen = aPanel->GetScreen();
|
|
||||||
bool update = true;
|
bool update = true;
|
||||||
TRACK* Track;
|
TRACK* Track;
|
||||||
TRACK* tSegmentToStart = NULL, * tSegmentToEnd = NULL;
|
TRACK* tSegmentToStart = NULL, * tSegmentToEnd = NULL;
|
||||||
|
@ -243,7 +241,7 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel, wxDC
|
||||||
|
|
||||||
GR_DRAWMODE draw_mode = GR_XOR | GR_HIGHLIGHT;
|
GR_DRAWMODE draw_mode = GR_XOR | GR_HIGHLIGHT;
|
||||||
|
|
||||||
/* Undraw the current moved track segments before modification*/
|
// Undraw the current moved track segments before modification
|
||||||
|
|
||||||
#ifndef USE_WX_OVERLAY
|
#ifndef USE_WX_OVERLAY
|
||||||
// if( erase )
|
// if( erase )
|
||||||
|
@ -258,13 +256,13 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( EDA_DRAW_PANEL* aPanel, wxDC
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Compute the new track segment position */
|
// Compute the new track segment position
|
||||||
wxPoint Pos = screen->GetCrossHairPosition();
|
wxPoint Pos = aPanel->GetParent()->GetCrossHairPosition();
|
||||||
|
|
||||||
dx = Pos.x - s_LastPos.x;
|
dx = Pos.x - s_LastPos.x;
|
||||||
dy = Pos.y - s_LastPos.y;
|
dy = Pos.y - s_LastPos.y;
|
||||||
|
|
||||||
//move the line by dx and dy
|
// move the line by dx and dy
|
||||||
tx1 = (double) ( Track->GetStart().x + dx );
|
tx1 = (double) ( Track->GetStart().x + dx );
|
||||||
ty1 = (double) ( Track->GetStart().y + dy );
|
ty1 = (double) ( Track->GetStart().y + dy );
|
||||||
tx2 = (double) ( Track->GetEnd().x + dx );
|
tx2 = (double) ( Track->GetEnd().x + dx );
|
||||||
|
@ -613,13 +611,13 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC
|
||||||
|
|
||||||
EraseDragList();
|
EraseDragList();
|
||||||
|
|
||||||
/* Change highlighted net: the new one will be highlighted */
|
// Change highlighted net: the new one will be highlighted
|
||||||
GetBoard()->PushHighLight();
|
GetBoard()->PushHighLight();
|
||||||
|
|
||||||
if( GetBoard()->IsHighLightNetON() )
|
if( GetBoard()->IsHighLightNetON() )
|
||||||
HighLight( aDC );
|
HighLight( aDC );
|
||||||
|
|
||||||
PosInit = GetScreen()->GetCrossHairPosition();
|
PosInit = GetCrossHairPosition();
|
||||||
|
|
||||||
if( aTrack->Type() == PCB_VIA_T )
|
if( aTrack->Type() == PCB_VIA_T )
|
||||||
{
|
{
|
||||||
|
@ -637,7 +635,7 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
STATUS_FLAGS diag = aTrack->IsPointOnEnds( GetScreen()->GetCrossHairPosition(), -1 );
|
STATUS_FLAGS diag = aTrack->IsPointOnEnds( GetCrossHairPosition(), -1 );
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
|
|
||||||
switch( aCommand )
|
switch( aCommand )
|
||||||
|
@ -754,7 +752,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
|
||||||
if( !TrackToEndPoint || ( TrackToEndPoint->Type() != PCB_TRACE_T ) )
|
if( !TrackToEndPoint || ( TrackToEndPoint->Type() != PCB_TRACE_T ) )
|
||||||
s_EndSegmentPresent = false;
|
s_EndSegmentPresent = false;
|
||||||
|
|
||||||
/* Change high light net: the new one will be highlighted */
|
// Change high light net: the new one will be highlighted
|
||||||
GetBoard()->PushHighLight();
|
GetBoard()->PushHighLight();
|
||||||
|
|
||||||
if( GetBoard()->IsHighLightNetON() )
|
if( GetBoard()->IsHighLightNetON() )
|
||||||
|
@ -791,8 +789,8 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
|
||||||
UndrawAndMarkSegmentsToDrag( m_canvas, DC );
|
UndrawAndMarkSegmentsToDrag( m_canvas, DC );
|
||||||
|
|
||||||
|
|
||||||
PosInit = GetScreen()->GetCrossHairPosition();
|
PosInit = GetCrossHairPosition();
|
||||||
s_LastPos = GetScreen()->GetCrossHairPosition();
|
s_LastPos = GetCrossHairPosition();
|
||||||
m_canvas->SetMouseCapture( Show_Drag_Track_Segment_With_Cte_Slope, Abort_MoveTrack );
|
m_canvas->SetMouseCapture( Show_Drag_Track_Segment_With_Cte_Slope, Abort_MoveTrack );
|
||||||
|
|
||||||
GetBoard()->SetHighLightNet( track->GetNet() );
|
GetBoard()->SetHighLightNet( track->GetNet() );
|
||||||
|
@ -823,7 +821,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Place a dragged (or moved) track segment or via */
|
// Place a dragged (or moved) track segment or via
|
||||||
bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
|
bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
|
||||||
{
|
{
|
||||||
int errdrc;
|
int errdrc;
|
||||||
|
@ -841,7 +839,7 @@ bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
|
||||||
if( errdrc == BAD_DRC )
|
if( errdrc == BAD_DRC )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Redraw the dragged segments */
|
// Redraw the dragged segments
|
||||||
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
|
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
|
||||||
{
|
{
|
||||||
errdrc = m_drc->Drc( g_DragSegmentList[ii].m_Track, GetBoard()->m_Track );
|
errdrc = m_drc->Drc( g_DragSegmentList[ii].m_Track, GetBoard()->m_Track );
|
||||||
|
@ -855,7 +853,7 @@ bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
|
||||||
Track->ClearFlags();
|
Track->ClearFlags();
|
||||||
Track->SetState( IN_EDIT, false );
|
Track->SetState( IN_EDIT, false );
|
||||||
|
|
||||||
/* Draw dragged tracks */
|
// Draw dragged tracks
|
||||||
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
|
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
|
||||||
{
|
{
|
||||||
Track = g_DragSegmentList[ii].m_Track;
|
Track = g_DragSegmentList[ii].m_Track;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue