Resync with main branch r6449

This commit is contained in:
Cirilo Bernardo 2016-01-12 10:36:31 +11:00
commit 217a5f39e1
77 changed files with 1364 additions and 1540 deletions

View File

@ -203,7 +203,7 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
endif()
# quiet GCC while in boost
if( GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8 )
if( GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8 OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs" )
endif()
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-strict-aliasing" )
@ -481,8 +481,7 @@ find_package( Cairo 1.8.8 REQUIRED )
#
# Note: Prior to Boost 1.59, the Boost context library is not built when compiling on windows
# with GCC. You must patch the Boost sources.
find_package( Boost 1.54.0 REQUIRED COMPONENTS context date_time filesystem iostreams locale
program_options regex system thread )
find_package( Boost 1.54.0 REQUIRED COMPONENTS context system thread )
# Include MinGW resource compiler.
include( MinGWResourceCompiler )

View File

@ -1,342 +0,0 @@
#.rst:
# FindOpenSSL
# -----------
#
# Try to find the OpenSSL encryption library
#
# Once done this will define
#
# ::
#
# OPENSSL_ROOT_DIR - Set this variable to the root installation of OpenSSL
#
#
#
# Read-Only variables:
#
# ::
#
# OPENSSL_FOUND - system has the OpenSSL library
# OPENSSL_INCLUDE_DIR - the OpenSSL include directory
# OPENSSL_LIBRARIES - The libraries needed to use OpenSSL
# OPENSSL_VERSION - This is set to $major.$minor.$revision$path (eg. 0.9.8s)
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
# Copyright 2009-2011 Mathieu Malaterre <mathieu.malaterre@gmail.com>
#
# 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 (UNIX)
find_package(PkgConfig QUIET)
pkg_check_modules(_OPENSSL QUIET openssl)
endif ()
if (WIN32)
# http://www.slproweb.com/products/Win32OpenSSL.html
set(_OPENSSL_ROOT_HINTS
${OPENSSL_ROOT_DIR}
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;Inno Setup: App Path]"
ENV OPENSSL_ROOT_DIR
)
file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles)
set(_OPENSSL_ROOT_PATHS
"${_programfiles}/OpenSSL"
"${_programfiles}/OpenSSL-Win32"
"${_programfiles}/OpenSSL-Win64"
"C:/OpenSSL/"
"C:/OpenSSL-Win32/"
"C:/OpenSSL-Win64/"
)
unset(_programfiles)
else ()
set(_OPENSSL_ROOT_HINTS
${OPENSSL_ROOT_DIR}
ENV OPENSSL_ROOT_DIR
)
endif ()
set(_OPENSSL_ROOT_HINTS_AND_PATHS
HINTS ${_OPENSSL_ROOT_HINTS}
PATHS ${_OPENSSL_ROOT_PATHS}
)
find_path(OPENSSL_INCLUDE_DIR
NAMES
openssl/ssl.h
${_OPENSSL_ROOT_HINTS_AND_PATHS}
HINTS
${_OPENSSL_INCLUDEDIR}
PATH_SUFFIXES
include
)
if(WIN32 AND NOT CYGWIN)
if(MSVC)
# /MD and /MDd are the standard values - if someone wants to use
# others, the libnames have to change here too
# use also ssl and ssleay32 in debug as fallback for openssl < 0.9.8b
# TODO: handle /MT and static lib
# In Visual C++ naming convention each of these four kinds of Windows libraries has it's standard suffix:
# * MD for dynamic-release
# * MDd for dynamic-debug
# * MT for static-release
# * MTd for static-debug
# Implementation details:
# We are using the libraries located in the VC subdir instead of the parent directory eventhough :
# libeay32MD.lib is identical to ../libeay32.lib, and
# ssleay32MD.lib is identical to ../ssleay32.lib
find_library(LIB_EAY_DEBUG
NAMES
libeay32MDd
libeay32d
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
"lib"
"VC"
"lib/VC"
)
find_library(LIB_EAY_RELEASE
NAMES
libeay32MD
libeay32
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
"lib"
"VC"
"lib/VC"
)
find_library(SSL_EAY_DEBUG
NAMES
ssleay32MDd
ssleay32d
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
"lib"
"VC"
"lib/VC"
)
find_library(SSL_EAY_RELEASE
NAMES
ssleay32MD
ssleay32
ssl
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
"lib"
"VC"
"lib/VC"
)
set(LIB_EAY_LIBRARY_DEBUG "${LIB_EAY_DEBUG}")
set(LIB_EAY_LIBRARY_RELEASE "${LIB_EAY_RELEASE}")
set(SSL_EAY_LIBRARY_DEBUG "${SSL_EAY_DEBUG}")
set(SSL_EAY_LIBRARY_RELEASE "${SSL_EAY_RELEASE}")
include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
select_library_configurations(LIB_EAY)
select_library_configurations(SSL_EAY)
mark_as_advanced(LIB_EAY_LIBRARY_DEBUG LIB_EAY_LIBRARY_RELEASE
SSL_EAY_LIBRARY_DEBUG SSL_EAY_LIBRARY_RELEASE)
set( OPENSSL_LIBRARIES ${SSL_EAY_LIBRARY} ${LIB_EAY_LIBRARY} )
elseif(MINGW)
message( STATUS "Searching for OpenSSL in MinGW." )
# same player, for MinGW
set(LIB_EAY_NAMES libeay32)
set(SSL_EAY_NAMES ssleay32)
list(APPEND LIB_EAY_NAMES crypto)
list(APPEND SSL_EAY_NAMES ssl)
find_library(LIB_EAY
NAMES
${LIB_EAY_NAMES}
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
"lib"
"lib/MinGW"
# Do not search system path. Otherwise the DLL will be found rather than the link library.
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH
)
find_library(SSL_EAY
NAMES
${SSL_EAY_NAMES}
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
"lib"
"lib/MinGW"
# Do not search system path. Otherwise the DLL will be found rather than the link library.
NO_SYSTEM_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH
)
mark_as_advanced(SSL_EAY LIB_EAY)
set( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} )
unset(LIB_EAY_NAMES)
unset(SSL_EAY_NAMES)
else()
# Not sure what to pick for -say- intel, let's use the toplevel ones and hope someone report issues:
find_library(LIB_EAY
NAMES
libeay32
${_OPENSSL_ROOT_HINTS_AND_PATHS}
HINTS
${_OPENSSL_LIBDIR}
PATH_SUFFIXES
lib
)
find_library(SSL_EAY
NAMES
ssleay32
${_OPENSSL_ROOT_HINTS_AND_PATHS}
HINTS
${_OPENSSL_LIBDIR}
PATH_SUFFIXES
lib
)
mark_as_advanced(SSL_EAY LIB_EAY)
set( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} )
endif()
else()
find_library(OPENSSL_SSL_LIBRARY
NAMES
ssl
ssleay32
ssleay32MD
${_OPENSSL_ROOT_HINTS_AND_PATHS}
HINTS
${_OPENSSL_LIBDIR}
PATH_SUFFIXES
lib
)
find_library(OPENSSL_CRYPTO_LIBRARY
NAMES
crypto
${_OPENSSL_ROOT_HINTS_AND_PATHS}
HINTS
${_OPENSSL_LIBDIR}
PATH_SUFFIXES
lib
)
mark_as_advanced(OPENSSL_CRYPTO_LIBRARY OPENSSL_SSL_LIBRARY)
# compat defines
set(OPENSSL_SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY})
set(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY})
endif()
function(from_hex HEX DEC)
string(TOUPPER "${HEX}" HEX)
set(_res 0)
string(LENGTH "${HEX}" _strlen)
while (_strlen GREATER 0)
math(EXPR _res "${_res} * 16")
string(SUBSTRING "${HEX}" 0 1 NIBBLE)
string(SUBSTRING "${HEX}" 1 -1 HEX)
if (NIBBLE STREQUAL "A")
math(EXPR _res "${_res} + 10")
elseif (NIBBLE STREQUAL "B")
math(EXPR _res "${_res} + 11")
elseif (NIBBLE STREQUAL "C")
math(EXPR _res "${_res} + 12")
elseif (NIBBLE STREQUAL "D")
math(EXPR _res "${_res} + 13")
elseif (NIBBLE STREQUAL "E")
math(EXPR _res "${_res} + 14")
elseif (NIBBLE STREQUAL "F")
math(EXPR _res "${_res} + 15")
else()
math(EXPR _res "${_res} + ${NIBBLE}")
endif()
string(LENGTH "${HEX}" _strlen)
endwhile()
set(${DEC} ${_res} PARENT_SCOPE)
endfunction()
if (OPENSSL_INCLUDE_DIR)
if (_OPENSSL_VERSION)
set(OPENSSL_VERSION "${_OPENSSL_VERSION}")
elseif(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str
REGEX "^#[\t ]*define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*")
# The version number is encoded as 0xMNNFFPPS: major minor fix patch status
# The status gives if this is a developer or prerelease and is ignored here.
# Major, minor, and fix directly translate into the version numbers shown in
# the string. The patch field translates to the single character suffix that
# indicates the bug fix state, which 00 -> nothing, 01 -> a, 02 -> b and so
# on.
message(STATUS "OPENSSL_VERSION_STR=${openssl_version_str}")
string(REGEX REPLACE "^.*OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F]).*$"
"\\1;\\2;\\3;\\4;\\5" OPENSSL_VERSION_LIST "${openssl_version_str}")
list(GET OPENSSL_VERSION_LIST 0 OPENSSL_VERSION_MAJOR)
list(GET OPENSSL_VERSION_LIST 1 OPENSSL_VERSION_MINOR)
from_hex("${OPENSSL_VERSION_MINOR}" OPENSSL_VERSION_MINOR)
list(GET OPENSSL_VERSION_LIST 2 OPENSSL_VERSION_FIX)
from_hex("${OPENSSL_VERSION_FIX}" OPENSSL_VERSION_FIX)
list(GET OPENSSL_VERSION_LIST 3 OPENSSL_VERSION_PATCH)
if (NOT OPENSSL_VERSION_PATCH STREQUAL "00")
from_hex("${OPENSSL_VERSION_PATCH}" _tmp)
# 96 is the ASCII code of 'a' minus 1
math(EXPR OPENSSL_VERSION_PATCH_ASCII "${_tmp} + 96")
unset(_tmp)
# Once anyone knows how OpenSSL would call the patch versions beyond 'z'
# this should be updated to handle that, too. This has not happened yet
# so it is simply ignored here for now.
string(ASCII "${OPENSSL_VERSION_PATCH_ASCII}" OPENSSL_VERSION_PATCH_STRING)
endif ()
set(OPENSSL_VERSION "${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_FIX}${OPENSSL_VERSION_PATCH_STRING}")
endif ()
endif ()
include(FindPackageHandleStandardArgs)
if (OPENSSL_VERSION)
find_package_handle_standard_args(OpenSSL
REQUIRED_VARS
OPENSSL_LIBRARIES
OPENSSL_INCLUDE_DIR
VERSION_VAR
OPENSSL_VERSION
FAIL_MESSAGE
"Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR"
)
else ()
find_package_handle_standard_args(OpenSSL "Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR"
OPENSSL_LIBRARIES
OPENSSL_INCLUDE_DIR
)
endif ()
mark_as_advanced(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES)

View File

@ -163,18 +163,6 @@ set(wxWidgets_LIBRARIES "")
set(wxWidgets_LIBRARY_DIRS "")
set(wxWidgets_CXX_FLAGS "")
# Using SYSTEM with INCLUDE_DIRECTORIES in conjunction with wxWidgets on
# the Mac produces compiler errors. Set wxWidgets_INCLUDE_DIRS_NO_SYSTEM
# to prevent UsewxWidgets.cmake from using SYSTEM.
#
# See cmake mailing list discussions for more info:
# http://www.cmake.org/pipermail/cmake/2008-April/021115.html
# http://www.cmake.org/pipermail/cmake/2008-April/021146.html
#
if(APPLE)
set(wxWidgets_INCLUDE_DIRS_NO_SYSTEM 1)
endif(APPLE)
# DEPRECATED: This is a patch to support the DEPRECATED use of
# wxWidgets_USE_LIBS.
#

View File

@ -283,7 +283,10 @@ set( COMMON_SRCS
add_library( common STATIC ${COMMON_SRCS} )
add_dependencies( common lib-dependencies )
add_dependencies( common version_header )
target_link_libraries( common ${Boost_LIBRARIES} ${CURL_LIBRARIES} )
target_link_libraries( common
${Boost_LIBRARIES}
# ${CURL_LIBRARIES} we dynamically link to this ON DEMAND, not at load time
)
set( PCB_COMMON_SRCS

View File

@ -1,11 +1,7 @@
/**
* @file dialog_hotkeys_editor.cpp
*/
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 1992-2014 Kicad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 1992-2016 Kicad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -35,121 +31,52 @@
#include <dialog_hotkeys_editor.h>
HOTKEY_LIST_CTRL::HOTKEY_LIST_CTRL( wxWindow *aParent, struct EDA_HOTKEY_CONFIG* aSection ) :
wxListCtrl( aParent, wxID_ANY, wxDefaultPosition,
wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VIRTUAL )
class DIALOG_HOTKEY_CLIENT_DATA : public wxClientData
{
m_sectionTag = aSection->m_SectionTag;
m_curEditingRow = -1;
EDA_HOTKEY m_hotkey;
wxString m_section_tag;
InsertColumn( 0, _( "Command" ) );
InsertColumn( 1, _( "Hotkey" ) );
public:
DIALOG_HOTKEY_CLIENT_DATA( const EDA_HOTKEY& aHotkey, const wxString& aSectionTag )
: m_hotkey( aHotkey ), m_section_tag( aSectionTag ) {}
// Add a dummy hotkey_spec which is a header before each hotkey list
EDA_HOTKEY** hotkey_descr_list;
EDA_HOTKEY& GetHotkey() { return m_hotkey; }
wxString GetSectionTag() const { return m_section_tag; }
};
// Add a copy of hotkeys to our list
for( hotkey_descr_list = aSection->m_HK_InfoList; *hotkey_descr_list; hotkey_descr_list++ )
{
EDA_HOTKEY* hotkey_descr = *hotkey_descr_list;
m_hotkeys.push_back( new EDA_HOTKEY( hotkey_descr ) );
}
// Set item count to hotkey size, this gets it to autoload the entries
SetItemCount( m_hotkeys.size() );
HOTKEY_LIST_CTRL::HOTKEY_LIST_CTRL( wxWindow *aParent, const HOTKEYS_SECTIONS& aSections ) :
wxTreeListCtrl( aParent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTL_SINGLE ),
m_sections( aSections )
{
AppendColumn( _( "Command" ) );
AppendColumn( _( "Hotkey" ) );
SetColumnWidth( 0, wxLIST_AUTOSIZE );
SetColumnWidth( 1, wxLIST_AUTOSIZE );
SetColumnWidth( 1, 100 );
Bind( wxEVT_CHAR, &HOTKEY_LIST_CTRL::OnChar, this );
Bind( wxEVT_LIST_ITEM_SELECTED, &HOTKEY_LIST_CTRL::OnListItemSelected, this );
Bind( wxEVT_SIZE, &HOTKEY_LIST_CTRL::OnSize, this );
}
void HOTKEY_LIST_CTRL::OnSize( wxSizeEvent& aEvent )
{
recalculateColumns();
aEvent.Skip();
}
void HOTKEY_LIST_CTRL::recalculateColumns()
{
float totalLength = 0;
float scale = 0;
// Find max character length of first column
int maxInfoMsgLength = 0;
for( int i = 0; i < GetItemCount(); i++ )
{
int length = GetItemText( i, 0 ).Length();
if( length > maxInfoMsgLength )
maxInfoMsgLength = length;
}
// Find max character length of second column
int maxKeyCodeLength = 0;
for( int i = 0; i < GetItemCount(); i++ )
{
int length = GetItemText( i, 1 ).Length();
if( length > maxKeyCodeLength )
maxKeyCodeLength = length;
}
// Use the lengths of column texts to create a scale of the max list width
// to set the column widths
totalLength = maxInfoMsgLength + maxKeyCodeLength;
scale = (double) GetClientSize().x / totalLength;
SetColumnWidth( 0, int( maxInfoMsgLength*scale ) - 2 );
SetColumnWidth( 1, int( maxKeyCodeLength*scale ) );
}
void HOTKEY_LIST_CTRL::OnListItemSelected( wxListEvent& aEvent )
{
m_curEditingRow = aEvent.GetIndex();
}
void HOTKEY_LIST_CTRL::DeselectRow( int aRow )
{
SetItemState( aRow, 0, wxLIST_STATE_SELECTED );
}
wxString HOTKEY_LIST_CTRL::OnGetItemText( long aRow, long aColumn ) const
{
EDA_HOTKEY* hotkey_descr = m_hotkeys[aRow];
if( aColumn == 0 )
{
return wxGetTranslation( hotkey_descr->m_InfoMsg );
}
else
{
return KeyNameFromKeyCode( hotkey_descr->m_KeyCode );
}
wxASSERT( aRow >= 0 && aRow < (int)m_items.size() );
Unselect( m_items[aRow] );
}
void HOTKEY_LIST_CTRL::OnChar( wxKeyEvent& aEvent )
{
if( m_curEditingRow != -1 )
DIALOG_HOTKEY_CLIENT_DATA* data = GetSelHKClientData();
if( data )
{
long key = aEvent.GetKeyCode();
switch( key )
{
case WXK_ESCAPE:
// Remove selection
DeselectRow( m_curEditingRow );
m_curEditingRow = -1;
UnselectAll();
break;
default:
@ -182,72 +109,224 @@ void HOTKEY_LIST_CTRL::OnChar( wxKeyEvent& aEvent )
bool exists;
KeyNameFromKeyCode( key, &exists );
if( exists && m_hotkeys[m_curEditingRow]->m_KeyCode != key )
if( exists && data->GetHotkey().m_KeyCode != key )
{
bool canUpdate = ((HOTKEY_SECTION_PAGE *)m_parent)->GetDialog()->CanSetKey( key, m_sectionTag );
wxString tag = data->GetSectionTag();
bool canUpdate = ResolveKeyConflicts( key, tag );
if( canUpdate )
{
m_hotkeys[m_curEditingRow]->m_KeyCode = key;
recalculateColumns();
data->GetHotkey().m_KeyCode = key;
}
// Remove selection
DeselectRow( m_curEditingRow );
m_curEditingRow = -1;
UnselectAll();
}
}
}
RefreshItems(0,m_hotkeys.size()-1);
UpdateFromClientData();
}
void HOTKEY_LIST_CTRL::RestoreFrom( struct EDA_HOTKEY_CONFIG* aSection )
DIALOG_HOTKEY_CLIENT_DATA* HOTKEY_LIST_CTRL::GetSelHKClientData()
{
int row = 0;
return GetHKClientData( GetSelection() );
}
DIALOG_HOTKEY_CLIENT_DATA* HOTKEY_LIST_CTRL::GetHKClientData( wxTreeListItem aItem )
{
if( aItem.IsOk() )
{
wxClientData* data = GetItemData( aItem );
if( !data )
return NULL;
DIALOG_HOTKEY_CLIENT_DATA* hkdata = static_cast<DIALOG_HOTKEY_CLIENT_DATA*>( data );
return hkdata;
}
else
{
return NULL;
}
}
void HOTKEY_LIST_CTRL::LoadSection( struct EDA_HOTKEY_CONFIG* aSection )
{
HOTKEY_LIST list;
EDA_HOTKEY** info_ptr;
for( info_ptr = aSection->m_HK_InfoList; *info_ptr; info_ptr++ )
{
EDA_HOTKEY* info = *info_ptr;
m_hotkeys[row++]->m_KeyCode = info->m_KeyCode;
EDA_HOTKEY info = **info_ptr;
list.push_back( info );
}
// Remove selection
DeselectRow( m_curEditingRow );
m_curEditingRow = -1;
RefreshItems( 0, m_hotkeys.size()-1 );
m_hotkeys.push_back( list );
}
HOTKEY_SECTION_PAGE::HOTKEY_SECTION_PAGE( HOTKEYS_EDITOR_DIALOG* aDialog,
wxNotebook* aParent,
const wxString& aTitle,
EDA_HOTKEY_CONFIG* aSection ) :
wxPanel( aParent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxNO_BORDER ),
m_hotkeySection( aSection ),
m_dialog( aDialog )
void HOTKEY_LIST_CTRL::UpdateFromClientData()
{
aParent->AddPage( this, aTitle );
for( wxTreeListItem i = GetFirstItem(); i.IsOk(); i = GetNextItem( i ) )
{
DIALOG_HOTKEY_CLIENT_DATA* hkdata = GetHKClientData( i );
if( !hkdata )
continue;
wxBoxSizer* bMainSizer = new wxBoxSizer( wxVERTICAL );
EDA_HOTKEY& hk = hkdata->GetHotkey();
SetSizer( bMainSizer );
Layout();
bMainSizer->Fit( this );
wxString name = wxGetTranslation( hk.m_InfoMsg );
wxString key = KeyNameFromKeyCode( hk.m_KeyCode );
m_hotkeyList = new HOTKEY_LIST_CTRL( this, aSection );
bMainSizer->Add( m_hotkeyList, 1, wxALL|wxEXPAND, 5 );
SetItemText( i, 0, name );
SetItemText( i, 1, key );
}
}
void HOTKEY_SECTION_PAGE::Restore()
bool HOTKEY_LIST_CTRL::TransferDataToControl()
{
m_hotkeyList->RestoreFrom( m_hotkeySection );
Freeze();
DeleteAllItems();
m_items.clear();
m_hotkeys.clear();
Update();
HOTKEYS_SECTIONS::iterator sec_it;
size_t sec_index = 0;
for( sec_it = m_sections.begin(); sec_it != m_sections.end(); ++sec_it, ++sec_index )
{
LoadSection( sec_it->second );
wxString section_tag = *( sec_it->second->m_SectionTag );
// Create parent item
wxTreeListItem parent = AppendItem( GetRootItem(), sec_it->first );
HOTKEY_LIST& each_list = m_hotkeys[sec_index];
HOTKEY_LIST::iterator hk_it;
for( hk_it = each_list.begin(); hk_it != each_list.end(); ++hk_it )
{
wxTreeListItem item = AppendItem( parent, wxEmptyString );
SetItemData( item, new DIALOG_HOTKEY_CLIENT_DATA( &*hk_it, section_tag ) );
m_items.push_back( item );
}
Expand( parent );
}
UpdateFromClientData();
Thaw();
return true;
}
bool HOTKEY_LIST_CTRL::TransferDataFromControl()
{
for( size_t i_sec = 0; i_sec < m_sections.size(); ++i_sec )
{
struct EDA_HOTKEY_CONFIG* section = m_sections[i_sec].second;
for( EDA_HOTKEY** info_ptr = section->m_HK_InfoList; *info_ptr; ++info_ptr )
{
EDA_HOTKEY* info = *info_ptr;
for( wxTreeListItem item = GetFirstItem(); item.IsOk(); item = GetNextItem( item ) )
{
DIALOG_HOTKEY_CLIENT_DATA* hkdata = GetHKClientData( item );
if( !hkdata )
continue;
EDA_HOTKEY& hk = hkdata->GetHotkey();
if( hk.m_Idcommand == info->m_Idcommand )
{
info->m_KeyCode = hk.m_KeyCode;
break;
}
}
}
}
return true;
}
bool HOTKEY_LIST_CTRL::ResolveKeyConflicts( long aKey, const wxString& aSectionTag )
{
EDA_HOTKEY* conflictingKey = NULL;
EDA_HOTKEY_CONFIG* conflictingSection = NULL;
CheckKeyConflicts( aKey, aSectionTag, &conflictingKey, &conflictingSection );
if( conflictingKey != NULL )
{
wxString info = wxGetTranslation( conflictingKey->m_InfoMsg );
wxString msg = wxString::Format(
_( "<%s> is already assigned to \"%s\" in section \"%s\". Are you sure you want "
"to change its assignment?" ),
KeyNameFromKeyCode( aKey ), GetChars( info ),
*(conflictingSection->m_Title) );
wxMessageDialog dlg( m_parent, msg, _( "Confirm change" ), wxYES_NO | wxNO_DEFAULT );
if( dlg.ShowModal() == wxID_YES )
{
conflictingKey->m_KeyCode = 0;
UpdateFromClientData();
return true;
}
else
{
return false;
}
}
return true;
}
bool HOTKEY_LIST_CTRL::CheckKeyConflicts( long aKey, const wxString& aSectionTag,
EDA_HOTKEY** aConfKey, EDA_HOTKEY_CONFIG** aConfSect )
{
EDA_HOTKEY* conflictingKey = NULL;
struct EDA_HOTKEY_CONFIG* conflictingSection = NULL;
for( wxTreeListItem item = GetFirstItem(); item.IsOk(); item = GetNextItem( item ) )
{
DIALOG_HOTKEY_CLIENT_DATA* hkdata = GetHKClientData( item );
if( !hkdata )
continue;
EDA_HOTKEY& hk = hkdata->GetHotkey();
wxString tag = hkdata->GetSectionTag();
if( aSectionTag != g_CommonSectionTag
&& tag != g_CommonSectionTag
&& tag != aSectionTag )
continue;
if( aKey == hk.m_KeyCode )
{
conflictingKey = &hk;
// Find the section
HOTKEYS_SECTIONS::iterator it;
for( it = m_sections.begin(); it != m_sections.end(); ++it )
{
if( *it->second->m_SectionTag == tag )
{
conflictingSection = it->second;
break;
}
}
}
}
if( aConfKey )
*aConfKey = conflictingKey;
if( aConfSect )
*aConfSect = conflictingSection;
return conflictingKey == NULL;
}
@ -272,118 +351,51 @@ HOTKEYS_EDITOR_DIALOG::HOTKEYS_EDITOR_DIALOG( EDA_BASE_FRAME* aParent,
{
EDA_HOTKEY_CONFIG* section;
HOTKEYS_SECTIONS sections;
for( section = m_hotkeys; section->m_HK_InfoList; section++ )
{
m_hotkeySectionPages.push_back( new HOTKEY_SECTION_PAGE( this, m_hotkeySections,
wxGetTranslation( *section->m_Title ),
section ) );
HOTKEYS_SECTION sec( wxGetTranslation( *section->m_Title ), section );
sections.push_back( sec );
}
m_hotkeyListCtrl = new HOTKEY_LIST_CTRL( this, sections );
m_mainSizer->Insert( 1, m_hotkeyListCtrl, wxSizerFlags( 1 ).Expand().Border( wxALL, 5 ) );
Layout();
m_sdbSizerOK->SetDefault();
Center();
}
void HOTKEYS_EDITOR_DIALOG::OnOKClicked( wxCommandEvent& event )
bool HOTKEYS_EDITOR_DIALOG::TransferDataToWindow()
{
std::vector<HOTKEY_SECTION_PAGE*>::iterator i;
if( !wxDialog::TransferDataToWindow() )
return false;
for( i = m_hotkeySectionPages.begin(); i != m_hotkeySectionPages.end(); ++i )
{
std::vector<EDA_HOTKEY*>& hotkey_vec = (*i)->GetHotkeys();
EDA_HOTKEY_CONFIG* section = (*i)->GetHotkeySection();
EDA_HOTKEY** info_ptr;
for( info_ptr = section->m_HK_InfoList; *info_ptr; info_ptr++ )
{
EDA_HOTKEY* info = *info_ptr;
/* find the corresponding hotkey */
std::vector<EDA_HOTKEY*>::iterator j;
for( j = hotkey_vec.begin(); j != hotkey_vec.end(); ++j )
{
if( (*j) && (*j)->m_Idcommand == info->m_Idcommand )
{
info->m_KeyCode = (*j)->m_KeyCode;
break;
}
}
}
}
/* save the hotkeys */
m_parent->WriteHotkeyConfig( m_hotkeys );
EndModal( wxID_OK );
}
void HOTKEYS_EDITOR_DIALOG::UndoClicked( wxCommandEvent& aEvent )
{
std::vector<HOTKEY_SECTION_PAGE*>::iterator i;
for( i = m_hotkeySectionPages.begin(); i != m_hotkeySectionPages.end(); ++i )
{
(*i)->Restore();
}
}
bool HOTKEYS_EDITOR_DIALOG::CanSetKey( long aKey, const wxString* sectionTag )
{
std::vector<HOTKEY_SECTION_PAGE*>::iterator i;
EDA_HOTKEY* conflictingKey = NULL;
HOTKEY_SECTION_PAGE* conflictingSection = NULL;
for( i = m_hotkeySectionPages.begin(); i != m_hotkeySectionPages.end(); ++i )
{
// Any non Common section can only conflict with itself and Common
if( *sectionTag != g_CommonSectionTag
&& *((*i)->GetHotkeySection()->m_SectionTag) != g_CommonSectionTag
&& *((*i)->GetHotkeySection()->m_SectionTag) != *sectionTag )
continue;
std::vector<EDA_HOTKEY*>& hotkey_vec = (*i)->GetHotkeys();
/* find the corresponding hotkey */
std::vector<EDA_HOTKEY*>::iterator j;
for( j = hotkey_vec.begin(); j != hotkey_vec.end(); ++j )
{
if( aKey == (*j)->m_KeyCode )
{
conflictingKey = (*j);
conflictingSection = (*i);
break;
}
}
}
if( conflictingKey != NULL )
{
wxString info = wxGetTranslation( conflictingKey->m_InfoMsg );
wxString msg = wxString::Format(
_( "<%s> is already assigned to \"%s\" in section \"%s\". Are you sure you want "
"to change its assignment?" ),
KeyNameFromKeyCode( aKey ), GetChars( info ),
*(conflictingSection->GetHotkeySection()->m_Title) );
wxMessageDialog dlg( this, msg, _( "Confirm change" ), wxYES_NO | wxNO_DEFAULT );
if( dlg.ShowModal() == wxID_YES )
{
conflictingKey->m_KeyCode = 0;
return true;
}
else
{
return false;
}
}
if( !m_hotkeyListCtrl->TransferDataToControl() )
return false;
return true;
}
bool HOTKEYS_EDITOR_DIALOG::TransferDataFromWindow()
{
if( !wxDialog::TransferDataToWindow() )
return false;
if( !m_hotkeyListCtrl->TransferDataFromControl() )
return false;
// save the hotkeys
m_parent->WriteHotkeyConfig( m_hotkeys );
return true;
}
void HOTKEYS_EDITOR_DIALOG::ResetClicked( wxCommandEvent& aEvent )
{
m_hotkeyListCtrl->TransferDataToControl();
}

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 17 2015)
// C++ code generated with wxFormBuilder (version Dec 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -13,20 +13,21 @@ HOTKEYS_EDITOR_DIALOG_BASE::HOTKEYS_EDITOR_DIALOG_BASE( wxWindow* parent, wxWind
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
m_mainSizer = new wxBoxSizer( wxVERTICAL );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Select a row and press a new key combination to alter the binding."), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( 400 );
bMainSizer->Add( m_staticText1, 0, wxALL|wxEXPAND, 5 );
m_hotkeySections = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
bMainSizer->Add( m_hotkeySections, 1, wxEXPAND | wxALL, 5 );
m_mainSizer->Add( m_staticText1, 0, wxALL|wxEXPAND, 5 );
wxBoxSizer* b_buttonsSizer;
b_buttonsSizer = new wxBoxSizer( wxHORIZONTAL );
m_resetButton = new wxButton( this, wxID_RESET, _("Reset"), wxDefaultPosition, wxDefaultSize, 0 );
b_buttonsSizer->Add( m_resetButton, 0, wxALL|wxEXPAND, 5 );
b_buttonsSizer->Add( 0, 0, 1, wxEXPAND, 5 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
@ -36,25 +37,20 @@ HOTKEYS_EDITOR_DIALOG_BASE::HOTKEYS_EDITOR_DIALOG_BASE( wxWindow* parent, wxWind
b_buttonsSizer->Add( m_sdbSizer, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_undoButton = new wxButton( this, wxID_UNDO, _("Undo"), wxDefaultPosition, wxDefaultSize, 0 );
b_buttonsSizer->Add( m_undoButton, 0, wxALL|wxEXPAND, 5 );
m_mainSizer->Add( b_buttonsSizer, 0, wxALIGN_RIGHT|wxEXPAND, 5 );
bMainSizer->Add( b_buttonsSizer, 0, wxALIGN_RIGHT, 5 );
this->SetSizer( bMainSizer );
this->SetSizer( m_mainSizer );
this->Layout();
// Connect Events
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::OnOKClicked ), NULL, this );
m_undoButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::UndoClicked ), NULL, this );
m_resetButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::ResetClicked ), NULL, this );
}
HOTKEYS_EDITOR_DIALOG_BASE::~HOTKEYS_EDITOR_DIALOG_BASE()
{
// Disconnect Events
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::OnOKClicked ), NULL, this );
m_undoButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::UndoClicked ), NULL, this );
m_resetButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::ResetClicked ), NULL, this );
}

View File

@ -90,9 +90,9 @@
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bMainSizer</property>
<property name="name">m_mainSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<property name="permission">protected</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
@ -178,123 +178,13 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND | wxALL</property>
<property name="proportion">1</property>
<object class="wxNotebook" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmapsize"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_hotkeySections</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnNotebookPageChanged"></event>
<event name="OnNotebookPageChanging"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_RIGHT</property>
<property name="flag">wxALIGN_RIGHT|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">b_buttonsSizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="1">
<property name="Apply">0</property>
<property name="Cancel">1</property>
<property name="ContextHelp">0</property>
<property name="Help">0</property>
<property name="No">0</property>
<property name="OK">1</property>
<property name="Save">0</property>
<property name="Yes">0</property>
<property name="minimum_size"></property>
<property name="name">m_sdbSizer</property>
<property name="permission">protected</property>
<event name="OnApplyButtonClick"></event>
<event name="OnCancelButtonClick"></event>
<event name="OnContextHelpButtonClick"></event>
<event name="OnHelpButtonClick"></event>
<event name="OnNoButtonClick"></event>
<event name="OnOKButtonClick">OnOKClicked</event>
<event name="OnSaveButtonClick"></event>
<event name="OnYesButtonClick"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
@ -327,8 +217,8 @@
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_UNDO</property>
<property name="label">Undo</property>
<property name="id">wxID_RESET</property>
<property name="label">Reset</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -336,7 +226,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_undoButton</property>
<property name="name">m_resetButton</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -357,7 +247,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">UndoClicked</event>
<event name="OnButtonClick">ResetClicked</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
@ -383,6 +273,42 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="1">
<property name="Apply">0</property>
<property name="Cancel">1</property>
<property name="ContextHelp">0</property>
<property name="Help">0</property>
<property name="No">0</property>
<property name="OK">1</property>
<property name="Save">0</property>
<property name="Yes">0</property>
<property name="minimum_size"></property>
<property name="name">m_sdbSizer</property>
<property name="permission">protected</property>
<event name="OnApplyButtonClick"></event>
<event name="OnCancelButtonClick"></event>
<event name="OnContextHelpButtonClick"></event>
<event name="OnHelpButtonClick"></event>
<event name="OnNoButtonClick"></event>
<event name="OnOKButtonClick"></event>
<event name="OnSaveButtonClick"></event>
<event name="OnYesButtonClick"></event>
</object>
</object>
</object>
</object>
</object>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 17 2015)
// C++ code generated with wxFormBuilder (version Dec 28 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -20,9 +20,8 @@ class DIALOG_SHIM;
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/notebook.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
@ -36,16 +35,15 @@ class HOTKEYS_EDITOR_DIALOG_BASE : public DIALOG_SHIM
private:
protected:
wxBoxSizer* m_mainSizer;
wxStaticText* m_staticText1;
wxNotebook* m_hotkeySections;
wxButton* m_resetButton;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
wxButton* m_undoButton;
// Virtual event handlers, overide them in your derived class
virtual void OnOKClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void UndoClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void ResetClicked( wxCommandEvent& event ) { event.Skip(); }
public:

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2011 Jean-Pierre Charras, <jp.charras@wanadoo.fr>
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2013-2016 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
@ -28,7 +28,12 @@
*/
#define USE_WORKER_THREADS 1 // 1:yes, 0:no. use worker thread to load libraries
/**
No. concurrent threads doing "http(s) GET". More than 6 is not significantly
faster, less than 6 is likely slower. Main thread is in this count, so if
set to 1 then no temp threads are created.
*/
#define READER_THREADS 6
/*
* Functions to read footprint libraries and fill m_footprints by available footprints names
@ -119,20 +124,13 @@ void FOOTPRINT_INFO::load()
}
#define JOBZ 6 // no. libraries per worker thread. It takes about
// a second to load a GITHUB library, so assigning
// this no. libraries to each thread should give a little
// over this no. seconds total time if the original delay
// were caused by latencies alone.
// (If https://github.com does not mind.)
#define NTOLERABLE_ERRORS 4 // max errors before aborting, although threads
// in progress will still pile on for a bit. e.g. if 9 threads
// expect 9 greater than this.
void FOOTPRINT_LIST::loader_job( const wxString* aNicknameList, int aJobZ )
{
//DBG(printf( "%s: first:'%s' count:%d\n", __func__, (char*) TO_UTF8( *aNicknameList ), aJobZ );)
DBG(printf( "%s: first:'%s' aJobZ:%d\n", __func__, TO_UTF8( *aNicknameList ), aJobZ );)
for( int i=0; i<aJobZ; ++i )
{
@ -212,8 +210,6 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE* aTable, const wxString* a
// do all of them
nicknames = aTable->GetLogicalLibs();
#if USE_WORKER_THREADS
// Even though the PLUGIN API implementation is the place for the
// locale toggling, in order to keep LOCAL_IO::C_count at 1 or greater
// for the duration of all helper threads, we increment by one here via instantiation.
@ -229,6 +225,8 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE* aTable, const wxString* a
MYTHREADS threads;
unsigned jobz = (nicknames.size() + READER_THREADS - 1) / READER_THREADS;
// Give each thread JOBZ nicknames to process. The last portion of, or if the entire
// size() is small, I'll do myself.
for( unsigned i=0; i<nicknames.size(); )
@ -240,18 +238,17 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE* aTable, const wxString* a
break;
}
int jobz = JOBZ;
if( i + jobz >= nicknames.size() )
if( i + jobz >= nicknames.size() ) // on the last iteration of this for(;;)
{
jobz = nicknames.size() - i;
// Only a little bit to do, I'll do it myself, on current thread.
// Only a little bit to do, I'll do it myself on current thread.
// I am part of the READER_THREADS count.
loader_job( &nicknames[i], jobz );
}
else
{
// Delegate the job to a worker thread created here.
// Delegate the job to a temporary thread created here.
threads.push_back( new boost::thread( &FOOTPRINT_LIST::loader_job,
this, &nicknames[i], jobz ) );
}
@ -266,9 +263,6 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE* aTable, const wxString* a
{
threads[i].join();
}
#else
loader_job( &nicknames[0], nicknames.size() );
#endif
m_list.sort();
}

View File

@ -22,51 +22,188 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <kicad_curl/kicad_curl.h>
#include <wx/log.h>
#include <wx/dynlib.h>
bool KICAD_CURL::Init()
#include <macros.h>
#include <kicad_curl/kicad_curl.h>
#include <ki_mutex.h> // MUTEX and MUTLOCK
#include <richio.h>
// These are even more private than class members, and since there is only
// one instance of KICAD_CURL ever, these statics are hidden here to simplify the
// client (API) header file.
static volatile bool s_initialized;
static MUTEX s_lock;
void (CURL_EXTERN * KICAD_CURL::easy_cleanup) ( CURL* curl );
CURL* (CURL_EXTERN * KICAD_CURL::easy_init) ( void );
CURLcode (CURL_EXTERN * KICAD_CURL::easy_perform) ( CURL* curl );
CURLcode (CURL_EXTERN * KICAD_CURL::easy_setopt) ( CURL* curl, CURLoption option, ... );
const char* (CURL_EXTERN * KICAD_CURL::easy_strerror) ( CURLcode );
CURLcode (CURL_EXTERN * KICAD_CURL::global_init) ( long flags );
void (CURL_EXTERN * KICAD_CURL::global_cleanup) ( void );
curl_slist* (CURL_EXTERN * KICAD_CURL::slist_append) ( curl_slist*, const char* );
void (CURL_EXTERN * KICAD_CURL::slist_free_all) ( curl_slist* );
char* (CURL_EXTERN * KICAD_CURL::version) ( void );
curl_version_info_data* (CURL_EXTERN * KICAD_CURL::version_info) (CURLversion);
struct DYN_LOOKUP
{
if ( curl_global_init( CURL_GLOBAL_ALL ) != CURLE_OK )
const char* name;
void** address;
};
// May need to modify "name" for each platform according to how libcurl is built on
// that platform and the spelling or partial mangling of C function names. On linux
// there is no mangling.
#define DYN_PAIR( basename ) { "curl_" #basename, (void**) &KICAD_CURL::basename }
const DYN_LOOKUP KICAD_CURL::dyn_funcs[] = {
DYN_PAIR( easy_cleanup ),
DYN_PAIR( easy_init ),
DYN_PAIR( easy_perform ),
DYN_PAIR( easy_setopt ),
DYN_PAIR( easy_strerror ),
DYN_PAIR( global_init ),
DYN_PAIR( global_cleanup ),
DYN_PAIR( slist_append ),
DYN_PAIR( slist_free_all ),
DYN_PAIR( version ),
DYN_PAIR( version_info ),
};
void KICAD_CURL::Init()
{
// We test s_initialized twice in an effort to avoid
// unnecessarily locking s_lock. This understands that the common case
// will not need to lock.
if( !s_initialized )
{
return false;
}
else
{
m_initialized = true;
return true;
MUTLOCK lock( s_lock );
if( !s_initialized )
{
// dynamically load the library.
wxDynamicLibrary dso;
wxString canonicalName = dso.CanonicalizeName( wxT( "curl" ) );
// This is an ugly hack for MinGW builds. We should probably use something
// like objdump to get the actual library file name from the link file.
#if defined( __MINGW32__ )
canonicalName = dso.CanonicalizeName( wxT( "curl-4" ) );
canonicalName = wxT( "lib" ) + canonicalName;
#endif
if( !dso.Load( canonicalName, wxDL_NOW | wxDL_GLOBAL ) )
{
// Failure: error reporting UI was done via wxLogSysError().
std::string msg = StrPrintf( "%s not wxDynamicLibrary::Load()ed",
static_cast< const char *>( canonicalName.mb_str() ) );
THROW_IO_ERROR( msg );
}
// get addresses.
for( unsigned i=0; i < DIM(dyn_funcs); ++i )
{
*dyn_funcs[i].address = dso.GetSymbol( dyn_funcs[i].name );
if( *dyn_funcs[i].address == NULL )
{
// Failure: error reporting UI was done via wxLogSysError().
// No further reporting required here.
std::string msg = StrPrintf( "%s has no function %s",
static_cast<const char*>( canonicalName.mb_str() ),
dyn_funcs[i].name );
THROW_IO_ERROR( msg );
}
}
if( KICAD_CURL::global_init( CURL_GLOBAL_ALL ) != CURLE_OK )
{
THROW_IO_ERROR( "curl_global_init() failed." );
}
wxLogDebug( "Using %s", GetVersion() );
// Tell dso's wxDynamicLibrary destructor not to Unload() the program image,
// since everything is fine before this. In those cases where THROW_IO_ERROR
// is called, dso is destroyed and the DSO/DLL is unloaded before returning in
// those error cases.
(void) dso.Detach();
s_initialized = true;
}
}
}
void KICAD_CURL::Cleanup()
{
if( m_initialized )
curl_global_cleanup();
}
/*
Calling MUTLOCK() from a static destructor will typically be bad, since the
s_lock may already have been statically destroyed itself leading to a boost
exception. (Remember C++ does not provide certain sequencing of static
destructor invocation.)
std::string KICAD_CURL::GetVersion()
{
return std::string( curl_version() );
To prevent this we test s_initialized twice, which ensures that the MUTLOCK
is only instantiated on the first call, which should be from
PGM_BASE::destroy() which is first called earlier than static destruction.
Then when called again from the actual PGM_BASE::~PGM_BASE() function,
MUTLOCK will not be instantiated because s_initialized will be false.
*/
if( s_initialized )
{
MUTLOCK lock( s_lock );
if( s_initialized )
{
KICAD_CURL::global_cleanup();
// dyn_funcs are not good for anything now, assuming process is ending soon here.
for( unsigned i=0; i < DIM(dyn_funcs); ++i )
{
*dyn_funcs[i].address = 0;
}
s_initialized = false;
}
}
}
std::string KICAD_CURL::GetSimpleVersion()
{
curl_version_info_data *info = curl_version_info(CURLVERSION_NOW);
if( !s_initialized )
Init();
curl_version_info_data *info = KICAD_CURL::version_info( CURLVERSION_NOW );
std::string res;
if( info->version )
{
res += "libcurl version: " + std::string(info->version);
res += "libcurl version: " + std::string( info->version );
}
res += " (";
if( info->features & CURL_VERSION_SSL )
{
res += "with SSL - ";
res += std::string(info->ssl_version);
res += std::string( info->ssl_version );
}
else
{
@ -76,5 +213,3 @@ std::string KICAD_CURL::GetSimpleVersion()
return res;
}
bool KICAD_CURL::m_initialized = false;

View File

@ -30,134 +30,70 @@
#include <sstream>
#include <richio.h>
static size_t write_callback (void *contents, size_t size, size_t nmemb, void *userp);
KICAD_CURL_EASY::KICAD_CURL_EASY()
: m_headers( NULL )
static size_t write_callback( void* contents, size_t size, size_t nmemb, void* userp )
{
m_CURL = curl_easy_init();
size_t realsize = size * nmemb;
if( m_CURL == NULL )
std::string* p = (std::string*) userp;
p->append( (const char*) contents, realsize );
return realsize;
}
KICAD_CURL_EASY::KICAD_CURL_EASY() :
m_headers( NULL )
{
// Call KICAD_CURL::Init() from in here everytime, but only the first time
// will incur any overhead. This strategy ensures that libcurl is never loaded
// unless it is needed.
KICAD_CURL::Init();
// Do not catch exception from KICAD_CURL::Init() at this level.
// Instantiation of this instance will fail if Init() throws, thus ensuring
// that this instance cannot be subsequently used.
// Caller needs a try catch around KICAD_CURL_EASY instantiation.
m_CURL = KICAD_CURL::easy_init();
if( !m_CURL )
{
THROW_IO_ERROR( "Unable to initialize CURL session" );
}
m_Buffer.Payload = (char*)malloc( 1 );
m_Buffer.Size = 0;
curl_easy_setopt( m_CURL, CURLOPT_WRITEFUNCTION, write_callback );
curl_easy_setopt( m_CURL, CURLOPT_WRITEDATA, (void *)&m_Buffer );
KICAD_CURL::easy_setopt( m_CURL, CURLOPT_WRITEFUNCTION, write_callback );
KICAD_CURL::easy_setopt( m_CURL, CURLOPT_WRITEDATA, (void*) &m_buffer );
}
KICAD_CURL_EASY::~KICAD_CURL_EASY()
{
free(m_Buffer.Payload);
curl_easy_cleanup(m_CURL);
}
if( m_headers )
KICAD_CURL::slist_free_all( m_headers );
bool KICAD_CURL_EASY::SetURL( const std::string& aURL )
{
if( SetOption<const char *>( CURLOPT_URL, aURL.c_str() ) == CURLE_OK )
{
return true;
}
return false;
}
bool KICAD_CURL_EASY::SetUserAgent( const std::string& aAgent )
{
if( SetOption<const char *>( CURLOPT_USERAGENT, aAgent.c_str() ) == CURLE_OK )
{
return true;
}
return false;
}
bool KICAD_CURL_EASY::SetFollowRedirects( bool aFollow )
{
if( SetOption<long>( CURLOPT_FOLLOWLOCATION , (aFollow ? 1 : 0) ) == CURLE_OK )
{
return true;
}
return false;
}
void KICAD_CURL_EASY::SetHeader( const std::string& aName, const std::string& aValue )
{
std::string header = aName + ':' + aValue;
m_headers = curl_slist_append( m_headers, header.c_str() );
}
std::string KICAD_CURL_EASY::GetErrorText(CURLcode code)
{
return curl_easy_strerror(code);
}
static size_t write_callback( void *contents, size_t size, size_t nmemb, void *userp )
{
/* calculate buffer size */
size_t realsize = size * nmemb;
/* cast pointer to fetch struct */
struct KICAD_EASY_CURL_BUFFER *p = ( struct KICAD_EASY_CURL_BUFFER * ) userp;
/* expand buffer */
p->Payload = (char *) realloc( p->Payload, p->Size + realsize + 1 );
/* check buffer */
if ( p->Payload == NULL )
{
wxLogError( wxT( "Failed to expand buffer in curl_callback" ) );
/* free buffer */
free( p->Payload );
return -1;
}
/* copy contents to buffer */
memcpy( &(p->Payload[p->Size]), contents, realsize );
/* set new buffer size */
p->Size += realsize;
/* ensure null termination */
p->Payload[p->Size] = 0;
/* return size */
return realsize;
KICAD_CURL::easy_cleanup( m_CURL );
}
void KICAD_CURL_EASY::Perform()
{
if( m_headers != NULL )
if( m_headers )
{
curl_easy_setopt( m_CURL, CURLOPT_HTTPHEADER, m_headers );
KICAD_CURL::easy_setopt( m_CURL, CURLOPT_HTTPHEADER, m_headers );
}
if( m_Buffer.Size > 0 )
{
free( m_Buffer.Payload );
m_Buffer.Payload = (char*)malloc( 1 );
m_Buffer.Size = 0;
}
// bonus: retain worst case memory allocation, should re-use occur
m_buffer.clear();
CURLcode res = KICAD_CURL::easy_perform( m_CURL );
CURLcode res = curl_easy_perform( m_CURL );
if( res != CURLE_OK )
{
wxString msg = wxString::Format(
_( "CURL Request Failed: %s" ),
GetErrorText( res ) );
std::string msg = StrPrintf( "curl_easy_perform()=%d: %s",
res, GetErrorText( res ).c_str() );
THROW_IO_ERROR( msg );
}
}
}

View File

@ -269,6 +269,15 @@ KIWAY::FACE_T KIWAY::KifaceType( FRAME_T aFrameType )
}
KIWAY_PLAYER* KIWAY::GetPlayerFrame( FRAME_T aFrameType )
{
if( unsigned( aFrameType ) >= KIWAY_PLAYER_COUNT )
return NULL;
return m_player[aFrameType];
}
KIWAY_PLAYER* KIWAY::Player( FRAME_T aFrameType, bool doCreate )
{
// Since this will be called from python, cannot assume that code will
@ -283,8 +292,10 @@ KIWAY_PLAYER* KIWAY::Player( FRAME_T aFrameType, bool doCreate )
}
// return the previously opened window
if( m_player[aFrameType] )
return m_player[aFrameType];
KIWAY_PLAYER* frame = GetPlayerFrame( aFrameType );
if( frame )
return frame;
if( doCreate )
{
@ -296,7 +307,7 @@ KIWAY_PLAYER* KIWAY::Player( FRAME_T aFrameType, bool doCreate )
if( kiface )
{
KIWAY_PLAYER* frame = (KIWAY_PLAYER*) kiface->CreateWindow(
frame = (KIWAY_PLAYER*) kiface->CreateWindow(
m_top,
aFrameType,
this,
@ -325,18 +336,18 @@ bool KIWAY::PlayerClose( FRAME_T aFrameType, bool doForce )
return false;
}
if( m_player[aFrameType] )
{
if( m_player[aFrameType]->Close( doForce ) )
{
m_player[aFrameType] = 0;
return true;
}
KIWAY_PLAYER* frame = GetPlayerFrame( aFrameType );
return false;
if( frame == NULL ) // Already closed
return true;
if( frame->Close( doForce ) )
{
m_player[aFrameType] = 0;
return true;
}
return true; // window is closed already.
return false;
}
@ -377,7 +388,11 @@ void KIWAY::SetLanguage( int aLanguage )
// the array below.
if( m_ctl & KFCTL_CPP_PROJECT_SUITE )
{
EDA_BASE_FRAME* top = (EDA_BASE_FRAME*) m_top;
// A dynamic_cast could be better, but creates link issues
// (some basic_frame functions not found) on some platforms,
// so a static_cast is used.
EDA_BASE_FRAME* top = static_cast<EDA_BASE_FRAME*>( m_top );
if( top )
top->ShowChangedLanguage();
}
@ -385,7 +400,7 @@ void KIWAY::SetLanguage( int aLanguage )
for( unsigned i=0; i < KIWAY_PLAYER_COUNT; ++i )
{
KIWAY_PLAYER* frame = m_player[i];
KIWAY_PLAYER* frame = GetPlayerFrame( ( FRAME_T )i );
if( frame )
{

View File

@ -283,7 +283,6 @@ PGM_BASE::PGM_BASE()
PGM_BASE::~PGM_BASE()
{
destroy();
KICAD_CURL::Cleanup();
}
@ -291,6 +290,8 @@ void PGM_BASE::destroy()
{
// unlike a normal destructor, this is designed to be called more than once safely:
KICAD_CURL::Cleanup();
delete m_common_settings;
m_common_settings = 0;
@ -495,13 +496,6 @@ bool PGM_BASE::initPgm()
wxSystemOptions::SetOption( wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES, 1 );
#endif
// Initialize CURL
wxLogDebug( wxT( "Using %s" ), KICAD_CURL::GetVersion() );
if( !KICAD_CURL::Init() )
{
wxLogDebug( wxT( "Error initializing libcurl" ) );
}
return true;
}

View File

@ -46,7 +46,7 @@ set( CVPCB_SRCS
class_DisplayFootprintsFrame.cpp
class_footprints_listbox.cpp
class_library_listbox.cpp
cvframe.cpp
cvpcb_mainframe.cpp
listboxes.cpp
menubar.cpp
readwrite_dlgs.cpp

View File

@ -1,8 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -200,7 +200,7 @@ void FOOTPRINTS_LISTBOX::OnLeftClick( wxListEvent& event )
return;
// If the footprint view window is displayed, update the footprint.
if( GetParent()->GetFpViewerFrame() )
if( GetParent()->GetFootprintViewerFrame() )
GetParent()->CreateScreenCmp();
GetParent()->DisplayStatus();

View File

@ -1,9 +1,9 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Jean-Pierre Charras, jean-pierre.charras
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -262,8 +262,8 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
}
// Close module display frame
if( GetFpViewerFrame() )
GetFpViewerFrame()->Close( true );
if( GetFootprintViewerFrame() )
GetFootprintViewerFrame()->Close( true );
m_modified = false;
@ -495,7 +495,7 @@ void CVPCB_MAINFRAME::OnKeepOpenOnSave( wxCommandEvent& event )
void CVPCB_MAINFRAME::DisplayModule( wxCommandEvent& event )
{
CreateScreenCmp();
GetFpViewerFrame()->RedrawScreen( wxPoint( 0, 0 ), false );
GetFootprintViewerFrame()->RedrawScreen( wxPoint( 0, 0 ), false );
}
@ -569,7 +569,7 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
if ( ii >= 0 )
m_footprintListBox->SetSelection( ii, false );
if( GetFpViewerFrame() )
if( GetFootprintViewerFrame() )
{
CreateScreenCmp();
}
@ -781,7 +781,7 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist( const std::string& aNetlist )
void CVPCB_MAINFRAME::CreateScreenCmp()
{
DISPLAY_FOOTPRINTS_FRAME* fpframe = GetFpViewerFrame();
DISPLAY_FOOTPRINTS_FRAME* fpframe = GetFootprintViewerFrame();
if( !fpframe )
{
@ -907,7 +907,7 @@ COMPONENT* CVPCB_MAINFRAME::GetSelectedComponent()
}
DISPLAY_FOOTPRINTS_FRAME* CVPCB_MAINFRAME::GetFpViewerFrame()
DISPLAY_FOOTPRINTS_FRAME* CVPCB_MAINFRAME::GetFootprintViewerFrame()
{
// returns the Footprint Viewer frame, if exists, or NULL
return dynamic_cast<DISPLAY_FOOTPRINTS_FRAME*>

View File

@ -1,8 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2011 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -92,7 +92,7 @@ public:
/**
* @return a pointer on the Footprint Viewer frame, if exists, or NULL
*/
DISPLAY_FOOTPRINTS_FRAME* GetFpViewerFrame();
DISPLAY_FOOTPRINTS_FRAME* GetFootprintViewerFrame();
/**
* Function OnSelectComponent

View File

@ -50,7 +50,7 @@ void SCH_EDIT_FRAME::DeleteAnnotation( bool aCurrentSheetOnly )
}
// Update the references for the sheet that is currently being displayed.
m_CurrentSheet->UpdateAllScreenReferences();
m_CurrentSheet->Last()->UpdateAllScreenReferences();
GetCanvas()->Refresh();
OnModify();
}
@ -176,7 +176,7 @@ void SCH_EDIT_FRAME::AnnotateComponents( bool aAnnotateSchematic,
OnModify();
// Update on screen references, that can be modified by previous calculations:
m_CurrentSheet->UpdateAllScreenReferences();
m_CurrentSheet->Last()->UpdateAllScreenReferences();
SetSheetNumberAndCount();
m_canvas->Refresh( true );

View File

@ -643,10 +643,6 @@ protected:
if( aDynamic )
{
if( m_component->GetTransform().y1 )
field_height = aField->GetBoundingBox().GetWidth();
else
field_height = aField->GetBoundingBox().GetHeight();
field_height = aField->GetBoundingBox().GetHeight();
padding = get_field_padding();

View File

@ -357,7 +357,7 @@ wxString NETLIST_OBJECT::GetShortNetName() const
if( link ) // Should be always true
{
netName = wxT("Net-(");
netName << link->GetRef( &m_netNameCandidate->m_SheetPath );
netName << link->GetRef( m_netNameCandidate->m_SheetPath.Last() );
netName << wxT("-Pad")
<< LIB_PIN::PinStringNum( m_netNameCandidate->m_PinNum )
<< wxT(")");

View File

@ -7,8 +7,8 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2011 jean-pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
* Copyright (C) 1992-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 1992-2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -701,7 +701,7 @@ SCH_REFERENCE::SCH_REFERENCE( SCH_COMPONENT* aComponent, LIB_PART* aLibComponent
m_RootCmp = aComponent;
m_Entry = aLibComponent;
m_Unit = aComponent->GetUnitSelection( &aSheetPath );
m_Unit = aComponent->GetUnitSelection( aSheetPath.Last() );
m_SheetPath = aSheetPath;
m_IsNew = false;
m_Flag = 0;
@ -709,10 +709,10 @@ SCH_REFERENCE::SCH_REFERENCE( SCH_COMPONENT* aComponent, LIB_PART* aLibComponent
m_CmpPos = aComponent->GetPosition();
m_SheetNum = 0;
if( aComponent->GetRef( &aSheetPath ).IsEmpty() )
if( aComponent->GetRef( aSheetPath.Last() ).IsEmpty() )
aComponent->SetRef( aSheetPath.Last(), wxT( "DefRef?" ) );
SetRef( aComponent->GetRef( &aSheetPath ) );
SetRef( aComponent->GetRef( aSheetPath.Last() ) );
m_NumRef = -1;

View File

@ -108,7 +108,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateAndShowItem( const wxPoint& aPosition, const KIC
Pin->GetMsgPanelInfo( items );
if( LibItem )
items.push_back( MSG_PANEL_ITEM( LibItem->GetRef( m_CurrentSheet ),
items.push_back( MSG_PANEL_ITEM( LibItem->GetRef( m_CurrentSheet->Last() ),
LibItem->GetField( VALUE )->GetShownText(), DARKCYAN ) );
SetMsgPanel( items );

View File

@ -727,7 +727,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent
}
#endif
m_FieldsBuf[REFERENCE].SetText( m_cmp->GetRef( &m_parent->GetCurrentSheet() ) );
m_FieldsBuf[REFERENCE].SetText( m_cmp->GetRef( m_parent->GetCurrentSheet().Last() ) );
for( unsigned i = 0; i<m_FieldsBuf.size(); ++i )
{

View File

@ -235,7 +235,7 @@ void DIALOG_ERC::OnLeftClickMarkersList( wxHtmlLinkEvent& event )
{
sheet->LastScreen()->SetZoom( m_parent->GetScreen()->GetZoom() );
m_parent->SetCurrentSheet( *sheet );
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences();
}
m_lastMarkerFound = marker;

View File

@ -327,7 +327,7 @@ bool SCH_PRINTOUT::OnPrintPage( int page )
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{
m_parent->SetCurrentSheet( list );
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
screen = m_parent->GetCurrentSheet().LastScreen();
}
@ -341,7 +341,7 @@ bool SCH_PRINTOUT::OnPrintPage( int page )
DrawPage( screen );
m_parent->SetCurrentSheet( oldsheetpath );
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
return true;

View File

@ -34,6 +34,8 @@
#include <boost/foreach.hpp>
#include <project_rescue.h>
#include <eeschema_config.h>
#include <sch_sheet_path.h>
class DIALOG_RESCUE_EACH: public DIALOG_RESCUE_EACH_BASE
{
@ -156,7 +158,7 @@ void DIALOG_RESCUE_EACH::PopulateInstanceList()
SCH_FIELD* valueField = each_component->GetField( 1 );
data.clear();
data.push_back( each_component->GetRef( & m_Parent->GetCurrentSheet() ) );
data.push_back( each_component->GetRef( m_Parent->GetCurrentSheet().Last() ) );
data.push_back( valueField ? valueField->GetText() : wxT( "" ) );
m_ListOfInstances->AppendItem( data );

View File

@ -290,7 +290,7 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
cmp_ref = wxT( "?" );
if( aNetItemRef->m_Type == NET_PIN && aNetItemRef->m_Link )
cmp_ref = aNetItemRef->GetComponentParent()->GetRef( &aNetItemRef->m_SheetPath );
cmp_ref = aNetItemRef->GetComponentParent()->GetRef( aNetItemRef->m_SheetPath.Last() );
if( aNetItemTst == NULL )
{
@ -311,7 +311,7 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
{
if( aNetItemRef->m_Type == NET_PIN && aNetItemRef->m_Link )
cmp_ref = aNetItemRef->GetComponentParent()->GetRef(
&aNetItemRef->m_SheetPath );
aNetItemRef->m_SheetPath.Last() );
msg.Printf( _( "Pin %s (%s) of component %s is not driven (Net %d)." ),
GetChars( string_pinnum ),
@ -353,7 +353,7 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
alt_cmp = wxT( "?" );
if( aNetItemTst->m_Type == NET_PIN && aNetItemTst->m_Link )
alt_cmp = aNetItemTst->GetComponentParent()->GetRef( &aNetItemTst->m_SheetPath );
alt_cmp = aNetItemTst->GetComponentParent()->GetRef( aNetItemTst->m_SheetPath.Last() );
msg.Printf( _( "Pin %s (%s) of component %s is connected to " ),
GetChars( string_pinnum ),
@ -426,9 +426,9 @@ void TestOthersItems( NETLIST_OBJECT_LIST* aList,
continue;
if( ( (SCH_COMPONENT*) aList->GetItem( aNetItemRef )->
m_Link )->GetRef( &aList->GetItem( aNetItemRef )-> m_SheetPath ) !=
m_Link )->GetRef( aList->GetItem( aNetItemRef )->m_SheetPath.Last() ) !=
( (SCH_COMPONENT*) aList->GetItem( duplicate )->m_Link )
->GetRef( &aList->GetItem( duplicate )->m_SheetPath ) )
->GetRef( aList->GetItem( duplicate )->m_SheetPath.Last() ) )
continue;
// Same component and same pin. Do dot create error for this pin

View File

@ -85,7 +85,7 @@ void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event )
{
sheetFoundIn->LastScreen()->SetZoom( GetScreen()->GetZoom() );
*m_CurrentSheet = *sheetFoundIn;
m_CurrentSheet->UpdateAllScreenReferences();
m_CurrentSheet->Last()->UpdateAllScreenReferences();
}
SetCrossHairPosition( lastMarker->GetPosition() );
@ -139,7 +139,7 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference,
SCH_COMPONENT* pSch = (SCH_COMPONENT*) item;
if( aReference.CmpNoCase( pSch->GetRef( sheet ) ) == 0 )
if( aReference.CmpNoCase( pSch->GetRef( sheet->Last() ) ) == 0 )
{
Component = pSch;
sheetWithComponentFound = sheet;
@ -193,7 +193,7 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference,
{
sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
*m_CurrentSheet = *sheet;
m_CurrentSheet->UpdateAllScreenReferences();
m_CurrentSheet->Last()->UpdateAllScreenReferences();
centerAndRedraw = true;
}
@ -489,7 +489,7 @@ void SCH_EDIT_FRAME::updateFindReplaceView( wxFindDialogEvent& aEvent )
{
sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
*m_CurrentSheet = *sheet;
m_CurrentSheet->UpdateAllScreenReferences();
m_CurrentSheet->Last()->UpdateAllScreenReferences();
SetScreen( sheet->LastScreen() );
}

View File

@ -285,7 +285,7 @@ void SCH_EDIT_FRAME::DisplayCurrentSheet()
GetScreen()->SetGrid( m_LastGridSizeId + ID_POPUP_GRID_LEVEL_1000 );
// update the References
m_CurrentSheet->UpdateAllScreenReferences();
m_CurrentSheet->Last()->UpdateAllScreenReferences();
SetSheetNumberAndCount();
m_canvas->SetCanStartBlock( -1 );

View File

@ -115,7 +115,8 @@ SCH_COMPONENT* NETLIST_EXPORTER::findNextComponent( EDA_ITEM* aItem, SCH_SHEET_P
// Power symbols and other components which have the reference starting
// with "#" are not included in netlist (pseudo or virtual components)
ref = comp->GetRef( aSheetPath );
ref = comp->GetRef( aSheetPath->Last() );
if( ref[0] == wxChar( '#' ) )
continue;
@ -173,7 +174,7 @@ SCH_COMPONENT* NETLIST_EXPORTER::findNextComponentAndCreatePinList( EDA_ITEM*
// Power symbols and other components which have the reference starting
// with "#" are not included in netlist (pseudo or virtual components)
ref = comp->GetRef( aSheetPath );
ref = comp->GetRef( aSheetPath->Last() );
if( ref[0] == wxChar( '#' ) )
continue;
@ -206,7 +207,7 @@ SCH_COMPONENT* NETLIST_EXPORTER::findNextComponentAndCreatePinList( EDA_ITEM*
{
LIB_PINS pins; // constructed once here
part->GetPins( pins, comp->GetUnitSelection( aSheetPath ), comp->GetConvert() );
part->GetPins( pins, comp->GetUnitSelection( aSheetPath->Last() ), comp->GetConvert() );
for( size_t i = 0; i < pins.size(); i++ )
{
@ -322,10 +323,10 @@ void NETLIST_EXPORTER::eraseDuplicatePins()
void NETLIST_EXPORTER::findAllInstancesOfComponent( SCH_COMPONENT* aComponent,
LIB_PART* aEntry,
SCH_SHEET_PATH* aSheetPath )
LIB_PART* aEntry,
SCH_SHEET_PATH* aSheetPath )
{
wxString ref = aComponent->GetRef( aSheetPath );
wxString ref = aComponent->GetRef( aSheetPath->Last() );
wxString ref2;
SCH_SHEET_LIST sheetList;
@ -339,11 +340,11 @@ void NETLIST_EXPORTER::findAllInstancesOfComponent( SCH_COMPONENT* aComponent,
SCH_COMPONENT* comp2 = (SCH_COMPONENT*) item;
ref2 = comp2->GetRef( sheet );
ref2 = comp2->GetRef( sheet->Last() );
if( ref2.CmpNoCase( ref ) != 0 )
continue;
int unit2 = comp2->GetUnitSelection( sheet ); // slow
int unit2 = comp2->GetUnitSelection( sheet->Last() ); // slow
for( LIB_PIN* pin = aEntry->GetNextPin(); pin; pin = aEntry->GetNextPin( pin ) )
{

View File

@ -93,7 +93,7 @@ bool NETLIST_EXPORTER_CADSTAR::WriteNetlist( const wxString& aOutFileName, unsig
footprint = wxT( "$noname" );
*/
msg = component->GetRef( sheet );
msg = component->GetRef( sheet->Last() );
ret |= fprintf( f, "%s ", TO_UTF8( StartCmpDesc ) );
ret |= fprintf( f, "%s", TO_UTF8( msg ) );
@ -159,7 +159,8 @@ bool NETLIST_EXPORTER_CADSTAR::writeListOfNets( FILE* f )
continue;
Cmp = nitem->GetComponentParent();
wxString refstr = Cmp->GetRef( &nitem->m_SheetPath );
wxString refstr = Cmp->GetRef( nitem->m_SheetPath.Last() );
if( refstr[0] == '#' )
continue; // Power supply symbols.

View File

@ -131,7 +131,7 @@ XNODE* NETLIST_EXPORTER_GENERIC::makeComponents()
// an element.
xcomps->AddChild( xcomp = node( sComponent ) );
xcomp->AddAttribute( sRef, comp->GetRef( path ) );
xcomp->AddAttribute( sRef, comp->GetRef( path->Last() ) );
xcomp->AddChild( node( sValue, comp->GetField( VALUE )->GetText() ) );
@ -467,7 +467,8 @@ XNODE* NETLIST_EXPORTER_GENERIC::makeListOfNets()
comp = nitem->GetComponentParent();
// Get the reference for the net name and the main parent component
ref = comp->GetRef( &nitem->m_SheetPath );
ref = comp->GetRef( nitem->m_SheetPath.Last() );
if( ref[0] == wxChar( '#' ) )
continue;
@ -529,7 +530,8 @@ bool NETLIST_EXPORTER_GENERIC::writeListOfNets( FILE* f, NETLIST_OBJECT_LIST& aO
comp = nitem->GetComponentParent();
// Get the reference for the net name and the main parent component
ref = comp->GetRef( &nitem->m_SheetPath );
ref = comp->GetRef( nitem->m_SheetPath.Last() );
if( ref[0] == wxChar( '#' ) )
continue; // Pseudo component (Like Power symbol)

View File

@ -99,7 +99,7 @@ bool NETLIST_EXPORTER_ORCADPCB2::WriteNetlist( const wxString& aOutFileName, uns
else
footprint = wxT( "$noname" );
field = comp->GetRef( path );
field = comp->GetRef( path->Last() );
ret |= fprintf( f, " ( %s %s",
TO_UTF8( comp->GetPath( path->Last() ) ),

View File

@ -235,7 +235,7 @@ bool NETLIST_EXPORTER_PSPICE::WriteNetlist( const wxString& aOutFileName, unsign
}
//Get Standard Reference Designator:
wxString RefName = comp->GetRef( sheet );
wxString RefName = comp->GetRef( sheet->Last() );
//Conditionally add Prefix only for devices that begin with U or IC:
if( aUsePrefix )

View File

@ -30,6 +30,7 @@
#include <class_sch_screen.h>
#include <schframe.h>
#include <sch_sheet_path.h>
#include <sch_sheet.h>
#include <project.h>
#include <dialog_plot_schematic.h>
@ -67,7 +68,7 @@ void DIALOG_PLOT_SCHEMATIC::CreateDXFFile( bool aPlotAll, bool aPlotFrameRef )
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{
schframe->SetCurrentSheet( list );
schframe->GetCurrentSheet().UpdateAllScreenReferences();
schframe->GetCurrentSheet().Last()->UpdateAllScreenReferences();
schframe->SetSheetNumberAndCount();
screen = schframe->GetCurrentSheet().LastScreen();
}
@ -105,7 +106,7 @@ void DIALOG_PLOT_SCHEMATIC::CreateDXFFile( bool aPlotAll, bool aPlotFrameRef )
msg.Printf( wxT( "DXF Plotter exception: %s"), GetChars( e.errorText ) );
reporter.Report( msg, REPORTER::RPT_ERROR );
schframe->SetCurrentSheet( oldsheetpath );
schframe->GetCurrentSheet().UpdateAllScreenReferences();
schframe->GetCurrentSheet().Last()->UpdateAllScreenReferences();
schframe->SetSheetNumberAndCount();
return;
}
@ -116,7 +117,7 @@ void DIALOG_PLOT_SCHEMATIC::CreateDXFFile( bool aPlotAll, bool aPlotFrameRef )
}
schframe->SetCurrentSheet( oldsheetpath );
schframe->GetCurrentSheet().UpdateAllScreenReferences();
schframe->GetCurrentSheet().Last()->UpdateAllScreenReferences();
schframe->SetSheetNumberAndCount();
}
@ -125,7 +126,7 @@ bool DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF( const wxString& aFileName,
SCH_SCREEN* aScreen,
wxPoint aPlotOffset,
double aScale,
bool aPlotFrameRef )
bool aPlotFrameRef )
{
DXF_PLOTTER* plotter = new DXF_PLOTTER();

View File

@ -30,6 +30,7 @@
#include <class_sch_screen.h>
#include <schframe.h>
#include <base_units.h>
#include <sch_sheet.h>
#include <sch_sheet_path.h>
#include <project.h>
@ -140,7 +141,7 @@ void DIALOG_PLOT_SCHEMATIC::createHPGLFile( bool aPlotAll, bool aPlotFrameRef )
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{
m_parent->SetCurrentSheet( list );
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
screen = m_parent->GetCurrentSheet().LastScreen();
@ -208,7 +209,7 @@ void DIALOG_PLOT_SCHEMATIC::createHPGLFile( bool aPlotAll, bool aPlotFrameRef )
}
m_parent->SetCurrentSheet( oldsheetpath );
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
}

View File

@ -28,6 +28,7 @@
#include <fctsys.h>
#include <plot_common.h>
#include <class_sch_screen.h>
#include <sch_sheet.h>
#include <schframe.h>
#include <base_units.h>
#include <sch_sheet_path.h>
@ -77,7 +78,7 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef )
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{
m_parent->SetCurrentSheet( list );
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
screen = m_parent->GetCurrentSheet().LastScreen();
}
@ -154,7 +155,7 @@ void DIALOG_PLOT_SCHEMATIC::restoreEnvironment( PDF_PLOTTER* aPlotter,
// Restore the previous sheet
m_parent->SetCurrentSheet( aOldsheetpath );
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
}

View File

@ -29,6 +29,7 @@
#include <class_sch_screen.h>
#include <schframe.h>
#include <base_units.h>
#include <sch_sheet.h>
#include <sch_sheet_path.h>
#include <project.h>
#include <reporter.h>
@ -67,7 +68,7 @@ void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef )
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{
m_parent->SetCurrentSheet( list );
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
screen = m_parent->GetCurrentSheet().LastScreen();
}
@ -141,7 +142,7 @@ void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef )
}
m_parent->SetCurrentSheet( oldsheetpath );
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
}

View File

@ -34,6 +34,7 @@
#include <schframe.h>
#include <base_units.h>
#include <libeditframe.h>
#include <sch_sheet.h>
#include <sch_sheet_path.h>
#include <project.h>
#include <reporter.h>
@ -67,7 +68,7 @@ void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef )
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{
m_parent->SetCurrentSheet( list );
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
screen = m_parent->GetCurrentSheet().LastScreen();
}
@ -109,14 +110,14 @@ void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef )
reporter.Report( msg, REPORTER::RPT_ERROR );
m_parent->SetCurrentSheet( oldsheetpath );
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
return;
}
}
m_parent->SetCurrentSheet( oldsheetpath );
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->GetCurrentSheet().Last()->UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
}
else // Print current sheet

View File

@ -119,6 +119,7 @@ SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos, SCH_ITEM* aParent ) :
{
Init( aPos );
m_currentSheetPath = NULL;
m_fieldsAutoplaced = AUTOPLACED_NO;
}
@ -133,6 +134,7 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_PART& aPart, SCH_SHEET_PATH* sheet, int unit,
m_part_name = aPart.GetName();
m_part = aPart.SharedPtr();
m_currentSheetPath = NULL;
m_fieldsAutoplaced = AUTOPLACED_NO;
SetTimeStamp( GetNewTimeStamp() );
@ -442,9 +444,9 @@ wxString SCH_COMPONENT::GetPath( const SCH_SHEET* aSheet ) const
}
const wxString SCH_COMPONENT::GetRef( const SCH_SHEET_PATH* sheet )
const wxString SCH_COMPONENT::GetRef( const SCH_SHEET* aSheet )
{
wxString path = GetPath( sheet->Last() );
wxString path = GetPath( aSheet );
wxString h_path, h_ref;
wxStringTokenizer tokenizer;
wxString separators( wxT( " " ) );
@ -471,7 +473,7 @@ const wxString SCH_COMPONENT::GetRef( const SCH_SHEET_PATH* sheet )
// all have the same component references, but perhaps this is best.
if( !GetField( REFERENCE )->GetText().IsEmpty() )
{
SetRef( sheet->Last(), GetField( REFERENCE )->GetText() );
SetRef( aSheet, GetField( REFERENCE )->GetText() );
return GetField( REFERENCE )->GetText();
}
@ -479,12 +481,6 @@ const wxString SCH_COMPONENT::GetRef( const SCH_SHEET_PATH* sheet )
}
/* Function IsReferenceStringValid (static function)
* Tests for an acceptable reference string
* An acceptable reference string must support unannotation
* i.e starts by letter
* returns true if OK
*/
bool SCH_COMPONENT::IsReferenceStringValid( const wxString& aReferenceString )
{
wxString text = aReferenceString;
@ -582,9 +578,9 @@ void SCH_COMPONENT::SetTimeStamp( time_t aNewTimeStamp )
}
int SCH_COMPONENT::GetUnitSelection( SCH_SHEET_PATH* aSheet )
int SCH_COMPONENT::GetUnitSelection( SCH_SHEET* aSheet )
{
wxString path = GetPath( aSheet->Last() );
wxString path = GetPath( aSheet );
wxString h_path, h_multi;
wxStringTokenizer tokenizer;
wxString separators( wxT( " " ) );
@ -1534,7 +1530,7 @@ void SCH_COMPONENT::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
if( m_currentSheetPath )
aList.push_back( MSG_PANEL_ITEM( _( "Reference" ),
GetRef( m_currentSheetPath ),
GetRef( m_currentSheetPath->Last() ),
DARKCYAN ) );
wxString msg = part->IsPower() ? _( "Power symbol" ) : _( "Value" );
@ -1884,7 +1880,7 @@ void SCH_COMPONENT::GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
{
wxASSERT( pin->Type() == LIB_PIN_T );
if( pin->GetUnit() && ( pin->GetUnit() != GetUnitSelection( aSheetPath ) ) )
if( pin->GetUnit() && ( pin->GetUnit() != GetUnitSelection( aSheetPath->Last() ) ) )
continue;
if( pin->GetConvert() && ( pin->GetConvert() != GetConvert() ) )

View File

@ -413,7 +413,7 @@ public:
* Function GetRef
* returns the reference, for the given sheet path.
*/
const wxString GetRef( const SCH_SHEET_PATH* sheet );
const wxString GetRef( const SCH_SHEET* sheet );
/**
* Set the reference, for the given sheet path.
@ -433,7 +433,7 @@ public:
int aMulti );
// returns the unit selection, for the given sheet path.
int GetUnitSelection( SCH_SHEET_PATH* aSheet );
int GetUnitSelection( SCH_SHEET* aSheet );
// Set the unit selection, for the given sheet path.
void SetUnitSelection( SCH_SHEET_PATH* aSheet, int aUnitSelection );

View File

@ -402,7 +402,7 @@ bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint
wxCHECK_MSG( component != NULL, false,
wxT( "No component associated with field" ) + text );
text = component->GetRef( (SCH_SHEET_PATH*) aAuxData );
text = component->GetRef( ((SCH_SHEET_PATH*) aAuxData)->Last() );
if( component->GetUnitCount() > 1 )
text << LIB_PART::SubReference( component->GetUnit() );
@ -440,7 +440,7 @@ bool SCH_FIELD::Replace( wxFindReplaceData& aSearchData, void* aAuxData )
wxCHECK_MSG( component != NULL, false,
wxT( "No component associated with field" ) + text );
text = component->GetRef( (SCH_SHEET_PATH*) aAuxData );
text = component->GetRef( ((SCH_SHEET_PATH*) aAuxData)->Last() );
// if( component->GetUnitCount() > 1 )
// text << LIB_PART::SubReference( component->GetUnit() );

View File

@ -1116,7 +1116,7 @@ bool SCH_SCREEN::SetComponentFootprint( SCH_SHEET_PATH* aSheetPath, const wxStri
component = (SCH_COMPONENT*) item;
if( aReference.CmpNoCase( component->GetRef( aSheetPath ) ) == 0 )
if( aReference.CmpNoCase( component->GetRef( aSheetPath->Last() ) ) == 0 )
{
// Found: Init Footprint Field

View File

@ -1332,6 +1332,24 @@ void SCH_SHEET::AnnotatePowerSymbols( PART_LIBS* aLibs, int* aReference )
}
void SCH_SHEET::UpdateAllScreenReferences()
{
EDA_ITEM* t = m_screen->GetDrawItems();
while( t )
{
if( t->Type() == SCH_COMPONENT_T )
{
SCH_COMPONENT* component = (SCH_COMPONENT*) t;
component->GetField( REFERENCE )->SetText( component->GetRef( this ) );
component->UpdateUnit( component->GetUnitSelection( this ) );
}
t = t->Next();
}
}
SCH_ITEM& SCH_SHEET::operator=( const SCH_ITEM& aItem )
{
wxLogDebug( wxT( "Sheet assignment operator." ) );

View File

@ -668,6 +668,17 @@ public:
*/
void AnnotatePowerSymbols( PART_LIBS* aLibs, int* aReference );
/**
* Function UpdateAllScreenReferences
* updates the reference and the m_Multi parameter (part selection) for all
* components on a screen depending on the actual sheet.
* Mandatory in complex hierarchies because sheets use the same screen
* (basic schematic)
* but with different references and part selections according to the
* displayed sheet
*/
void UpdateAllScreenReferences();
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // override
#endif

View File

@ -227,24 +227,6 @@ wxString SCH_SHEET_PATH::PathHumanReadable() const
}
void SCH_SHEET_PATH::UpdateAllScreenReferences()
{
EDA_ITEM* t = LastDrawList();
while( t )
{
if( t->Type() == SCH_COMPONENT_T )
{
SCH_COMPONENT* component = (SCH_COMPONENT*) t;
component->GetField( REFERENCE )->SetText( component->GetRef( this ) );
component->UpdateUnit( component->GetUnitSelection( this ) );
}
t = t->Next();
}
}
void SCH_SHEET_PATH::GetComponents( PART_LIBS* aLibs, SCH_REFERENCE_LIST& aReferences, bool aIncludePowerSymbols )
{
// Search to sheet path number:
@ -266,7 +248,7 @@ void SCH_SHEET_PATH::GetComponents( PART_LIBS* aLibs, SCH_REFERENCE_LIST& aRefer
// Skip pseudo components, which have a reference starting with #. This mainly
// affects power symbols.
if( !aIncludePowerSymbols && component->GetRef( this )[0] == wxT( '#' ) )
if( !aIncludePowerSymbols && component->GetRef( Last() )[0] == wxT( '#' ) )
continue;
LIB_PART* part = aLibs->FindLibPart( component->GetPartName() );
@ -301,7 +283,7 @@ void SCH_SHEET_PATH::GetMultiUnitComponents( PART_LIBS* aLibs, SCH_MULTI_UNIT_RE
// Skip pseudo components, which have a reference starting with #. This mainly
// affects power symbols.
if( !aIncludePowerSymbols && component->GetRef( this )[0] == wxT( '#' ) )
if( !aIncludePowerSymbols && component->GetRef( Last() )[0] == wxT( '#' ) )
continue;
LIB_PART* part = aLibs->FindLibPart( component->GetPartName() );

View File

@ -215,17 +215,6 @@ public:
*/
bool BuildSheetPathInfoFromSheetPathValue( const wxString& aPath, bool aFound = false );
/**
* Function UpdateAllScreenReferences
* updates the reference and the m_Multi parameter (part selection) for all
* components on a screen depending on the actual sheet path.
* Mandatory in complex hierarchies because sheets use the same screen
* (basic schematic)
* but with different references and part selections according to the
* displayed sheet
*/
void UpdateAllScreenReferences();
/**
* Function GetComponents
* adds a SCH_REFERENCE() object to \a aReferences for each component in the sheet.

View File

@ -768,7 +768,7 @@ void SCH_EDIT_FRAME::PrepareMoveItem( SCH_ITEM* aItem, wxDC* aDC )
if( aItem->Type() == SCH_FIELD_T && aItem->GetParent()->Type() == SCH_COMPONENT_T )
{
// Now that we're moving a field, they're no longer autoplaced.
SCH_COMPONENT *parent = dynamic_cast<SCH_COMPONENT*>( aItem->GetParent() );
SCH_COMPONENT *parent = static_cast<SCH_COMPONENT*>( aItem->GetParent() );
parent->ClearFieldsAutoplaced();
}
@ -834,7 +834,7 @@ void SCH_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent )
{
case SCH_COMPONENT_T:
{
SCH_COMPONENT* component = dynamic_cast<SCH_COMPONENT*>( item );
SCH_COMPONENT* component = static_cast<SCH_COMPONENT*>( item );
if( aEvent.GetId() == ID_SCH_ROTATE_CLOCKWISE )
OrientComponent( CMP_ROTATE_CLOCKWISE );
else if( aEvent.GetId() == ID_SCH_ROTATE_COUNTERCLOCKWISE )
@ -864,7 +864,7 @@ void SCH_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent )
if( item->GetParent()->Type() == SCH_COMPONENT_T )
{
// Now that we're moving a field, they're no longer autoplaced.
SCH_COMPONENT *parent = dynamic_cast<SCH_COMPONENT*>( item->GetParent() );
SCH_COMPONENT *parent = static_cast<SCH_COMPONENT*>( item->GetParent() );
parent->ClearFieldsAutoplaced();
}
break;
@ -1148,7 +1148,7 @@ void SCH_EDIT_FRAME::OnOrient( wxCommandEvent& aEvent )
{
case SCH_COMPONENT_T:
{
SCH_COMPONENT *component = dynamic_cast<SCH_COMPONENT*>( item );
SCH_COMPONENT *component = static_cast<SCH_COMPONENT*>( item );
if( aEvent.GetId() == ID_SCH_MIRROR_X )
OrientComponent( CMP_MIRROR_X );
else if( aEvent.GetId() == ID_SCH_MIRROR_Y )

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2014 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2004-2016 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -38,24 +38,33 @@
#include <wx/textctrl.h>
#include <wx/stattext.h>
#include <wx/button.h>
#include <wx/listctrl.h>
#include <wx/treelist.h>
#include <wx/dialog.h>
#include <wx/grid.h>
#include <vector>
#include <utility>
#include <hotkeys_basic.h>
#include <draw_frame.h>
#include <../common/dialogs/dialog_hotkeys_editor_base.h>
typedef std::pair<wxString, struct EDA_HOTKEY_CONFIG*> HOTKEYS_SECTION;
typedef std::vector<HOTKEYS_SECTION> HOTKEYS_SECTIONS;
typedef std::vector<EDA_HOTKEY> HOTKEY_LIST;
class HOTKEYS_EDITOR_DIALOG;
class DIALOG_HOTKEY_CLIENT_DATA;
/**
* Class HOTKEY_LIST_CTRL
* is a class to contain the contents of a hotkey editor tab page.
*/
class HOTKEY_LIST_CTRL : public wxListCtrl
class HOTKEY_LIST_CTRL : public wxTreeListCtrl
{
public:
HOTKEY_LIST_CTRL( wxWindow* aParent, struct EDA_HOTKEY_CONFIG* aSection );
HOTKEY_LIST_CTRL( wxWindow* aParent, const HOTKEYS_SECTIONS& aSections );
~HOTKEY_LIST_CTRL() {};
/**
@ -67,35 +76,83 @@ public:
void DeselectRow( int aRow );
/**
* Function GetHotkeys
* Access to return the vector used for the list control data. This will contain the
* "live" state of the user's configuration.
*
* @return Pointer to vector of hotkey settings
* Function TransferDataToControl
* Load the hotkey data into the control.
* @return true iff the operation was successful
*/
std::vector< EDA_HOTKEY* >& GetHotkeys() { return m_hotkeys; }
bool TransferDataToControl();
/**
* Function RestoreFrom
* Restores list control hotkey keycodes to the keycodes present in the
* given hotkey configuration array.
* Function TransferDataFromControl
* Save the hotkey data from the control.
* @return true iff the operation was successful
*/
bool TransferDataFromControl();
/**
* Function ResolveKeyConflicts
* Check if we can set a hotkey, this will prompt the user if there
* is a conflict between keys. The key code should have already been
* checked that it's not for the same entry as its currently in or else
* it'll prompt the change on itself.
* The function will do conflict detection depending on aSectionTag.
* g_CommonSectionTag means the key code must be checked with all sections.
* While other tags means the key code only must be checked with the aSectionTag
* section and g_CommonSectionTag section.
*
* @param aKey is the key code that wants to be set
* @param aSectionTag is the section tag that the key code came from
*
* @return True if the user accepted the overwrite or no conflict existed
*/
bool ResolveKeyConflicts( long aKey, const wxString& aSectionTag );
/**
* Function CheckKeyConflicts
* Check whether the given key conflicts with anything in this HOTKEY_LIST_CTRL.
*
* @param aKey - key to check
* @param aSectionTag - section tag of the key
* @param aConfKey - if not NULL, outparam holding the key this one conflicts with
* @param aConfSect - if not NULL, outparam holding the section this one conflicts with
*/
bool CheckKeyConflicts( long aKey, const wxString& aSectionTag,
EDA_HOTKEY** aConfKey, EDA_HOTKEY_CONFIG** aConfSect );
/**
* Function UpdateFromClientData
* Update all visible items from the data stored in their client data objects.
*/
void UpdateFromClientData();
private:
HOTKEYS_SECTIONS m_sections;
std::vector< HOTKEY_LIST > m_hotkeys;
std::vector< wxTreeListItem > m_items;
/**
* Function GetSelHKClientData
* Return the DIALOG_HOTKEY_CLIENT_DATA for the item being edited, or NULL if none is selected.
*/
DIALOG_HOTKEY_CLIENT_DATA* GetSelHKClientData();
/**
* Function GetHKClientData
* Return the DIALOG_HOTKEY_CLIENT_DATA for the given item, or NULL if invalid.
*/
DIALOG_HOTKEY_CLIENT_DATA* GetHKClientData( wxTreeListItem aItem );
protected:
/**
* Function LoadSection
* Generates a HOTKEY_LIST from the given hotkey configuration array and
* pushes it to m_hotkeys.
*
* @param aSection is a pointer to the hotkey configuration array
*/
void RestoreFrom( struct EDA_HOTKEY_CONFIG* aSection );
void LoadSection( struct EDA_HOTKEY_CONFIG* aSection );
private:
int m_curEditingRow;
wxString* m_sectionTag;
std::vector< EDA_HOTKEY* > m_hotkeys;
/**
* Function recalculateColumns
* Adjusts the width of grid columns in proportion of the max text length of both
*/
void recalculateColumns();
protected:
/**
* Function OnGetItemText
* Returns the requested row, column data to the list control.
@ -114,81 +171,8 @@ protected:
* @param aEvent is the key press event, the keycode is retrieved from it
*/
void OnChar( wxKeyEvent& aEvent );
/**
* Function OnListItemSelected
* Item selection handler which is used to record what index is selected to alter
* update with the key press
*
* @param aEvent is the button press event, unused
*/
void OnListItemSelected( wxListEvent& aEvent );
/**
* Function OnSize
* Sizing update handler to recompute the column widths dynamically and maximize them.
* Due to wxWidget's broken autosizing support (it's completely inconsistent across
* platforms), we just do it based on a scale of
*
* @param aEvent is the button press event, unused
*/
void OnSize( wxSizeEvent& aEvent );
};
/**
* Class HOTKEY_SECTION_PAGE
* is a class to contain the contents of a hotkey editor tab page.
*/
class HOTKEY_SECTION_PAGE : public wxPanel
{
public:
private:
EDA_HOTKEY_CONFIG* m_hotkeySection;
HOTKEY_LIST_CTRL *m_hotkeyList;
HOTKEYS_EDITOR_DIALOG* m_dialog;
public:
/** Constructor to create a setup page for one netlist format.
* Used in Netlist format Dialog box creation
* @param parent = wxNotebook * parent
* @param title = title (name) of the notebook page
* @param id_NetType = netlist type id
*/
HOTKEY_SECTION_PAGE( HOTKEYS_EDITOR_DIALOG* aDialog, wxNotebook* aParent,
const wxString& aTitle,
EDA_HOTKEY_CONFIG* aSection );
~HOTKEY_SECTION_PAGE() {};
/**
* Function Restore
* Resets the hotkeys back to their original unedited state
*/
void Restore();
/**
* Function GetHotkeys
* Accessor to retrieve hotkeys list from list control
*
* @return Pointer to vector used for list control data
*/
std::vector< EDA_HOTKEY* >& GetHotkeys() { return m_hotkeyList->GetHotkeys(); }
/**
* Function GetHotkeySection
* Accessor to retrieve hotkey configuration array assigned to a tab control page
*
* @return Pointer to hotkey configuration array
*/
EDA_HOTKEY_CONFIG* GetHotkeySection() { return m_hotkeySection; }
/**
* Function GetDialog
* Returns pointer to parent dialog window
*
* @return Pointer to parent dialog window
*/
HOTKEYS_EDITOR_DIALOG* GetDialog() { return m_dialog; }
};
/**
* Class HOTKEYS_EDITOR_DIALOG
@ -201,47 +185,25 @@ protected:
EDA_BASE_FRAME* m_parent;
struct EDA_HOTKEY_CONFIG* m_hotkeys;
std::vector<HOTKEY_SECTION_PAGE*> m_hotkeySectionPages;
HOTKEY_LIST_CTRL* m_hotkeyListCtrl;
bool TransferDataToWindow();
bool TransferDataFromWindow();
public:
HOTKEYS_EDITOR_DIALOG( EDA_BASE_FRAME* aParent, EDA_HOTKEY_CONFIG* aHotkeys );
~HOTKEYS_EDITOR_DIALOG() {};
/**
* Function CanSetKey
* Check if we can set a hotkey, this will prompt the user if there
* is a conflict between keys. The key code should have already been
* checked that it's not for the same entry as its currently in or else
* it'll prompt the change on itself.
* The function will do conflict detection depending on aSectionTag.
* g_CommonSectionTag means the key code must be checked with all sections.
* While other tags means the key code only must be checked with the aSectionTag
* section and g_CommonSectionTag section.
*
* @param aKey is the key code that wants to be set
* @param aSectionTag is the section tag that the key code came from
*
* @return True if the user accepted the overwrite or no conflict existed
*/
bool CanSetKey( long aKey, const wxString* aSectionTag );
private:
/**
* Function OnOKClicked
* Close the dialog and make save all changes to hotkeys
*
* @param aEvent is the button press event, unused
*/
void OnOKClicked( wxCommandEvent& aEvent );
/**
* Function UndoClicked
* Function ResetClicked
* Reinit the hotkeys to the initial state (removes all pending changes)
*
* @param aEvent is the button press event, unused
*/
void UndoClicked( wxCommandEvent& aEvent );
void ResetClicked( wxCommandEvent& aEvent );
};
/**

View File

@ -44,12 +44,27 @@
#include <curl/curl.h>
#include <string>
// CURL_EXTERN expands to dllimport on MinGW which causes gcc warnings. This really should
// expand to nothing on MinGW.
#if defined( __MINGW32__)
# if defined( CURL_EXTERN )
# undef CURL_EXTERN
# define CURL_EXTERN
# endif
#endif
struct DYN_LOOKUP;
/**
* Class KICAD_CURL
* simple wrapper class to call curl_global_init and curl_global_cleanup for KiCad.
*/
class KICAD_CURL
{
friend class KICAD_CURL_EASY;
public:
/**
* Function Init
@ -57,8 +72,9 @@ public:
* and before any curl functions that perform requests.
*
* @return bool - True if successful, false if CURL returned an error
* @throw IO_ERROR on failure, hopefully with helpful text in it.
*/
static bool Init();
static void Init();
/**
* Function Cleanup
@ -71,9 +87,14 @@ public:
* Function GetVersion
* wrapper for curl_version(). Reports back a short string of loaded libraries.
*
* @return std::string - String reported by libcurl
* @return const char* - String reported by libcurl and owned by it.
* @throw IO_ERROR on failure, hopefully with helpful text in it.
*/
static std::string GetVersion();
static const char* GetVersion()
{
return KICAD_CURL::version();
}
/**
* Function GetSimpleVersion
@ -83,7 +104,25 @@ public:
*/
static std::string GetSimpleVersion();
private:
static bool m_initialized;
// Alphabetically:
// dynamically looked up libcurl function pointers whose prototypes were
// taken from the system's libcurl headers.
static void (CURL_EXTERN * easy_cleanup) ( CURL* curl );
static CURL* (CURL_EXTERN * easy_init) ( void );
static CURLcode (CURL_EXTERN * easy_perform) ( CURL* curl );
static CURLcode (CURL_EXTERN * easy_setopt) ( CURL* curl, CURLoption option, ... );
static const char* (CURL_EXTERN * easy_strerror) ( CURLcode );
static CURLcode (CURL_EXTERN * global_init) ( long flags );
static void (CURL_EXTERN * global_cleanup) ( void );
static curl_slist* (CURL_EXTERN * slist_append) ( curl_slist*, const char* );
static void (CURL_EXTERN * slist_free_all) ( curl_slist* );
static char* (CURL_EXTERN * version) ( void );
static curl_version_info_data* (CURL_EXTERN * version_info) (CURLversion);
/// A tuple of ASCII function names and pointers to pointers to functions
static const DYN_LOOKUP dyn_funcs[];
};
#endif // KICAD_CURL_H_
#endif // KICAD_CURL_H_

View File

@ -27,7 +27,7 @@
/*
* KICAD_CURL_EASY.h must included before wxWidgets because on Windows,
* wxWidgets ends up including windows.h before winsocks2.h inside curl
* this causes build warnings
* this causes build warnings
* Because we are before wx, we must explicitly define we are building with unicode
* wxWidgets defaults to supporting unicode now, so this should be safe.
*/
@ -42,19 +42,9 @@
#endif
#include <curl/curl.h>
#include <string>
/**
* Struct KICAD_EASY_CURL_BUFFER
* is a struct used for storing the libcurl received data in its callbacks.
* Do not use directly, KICAD_CURL_EASY uses it.
*/
struct KICAD_EASY_CURL_BUFFER
{
char* Payload;
size_t Size;
};
#include <curl/curl.h>
#include <kicad_curl/kicad_curl.h>
/**
@ -67,9 +57,10 @@ struct KICAD_EASY_CURL_BUFFER
* Here is a small example usage:
* @code
* KICAD_CURL_EASY curl;
* curl.SetURL("http://github.com");
* curl.SetUserAgent("KiCad-EDA");
* curl.SetHeader("Accept", "application/json");
*
* curl.SetURL( "http://github.com" );
* curl.SetUserAgent( <http-client-indentifier> );
* curl.SetHeader( "Accept", "application/json" );
* curl.Perform();
* @endcode
*/
@ -95,7 +86,11 @@ public:
* @param aName is the left hand side of the header, i.e. Accept without the colon
* @param aValue is the right hand side of the header, i.e. application/json
*/
void SetHeader( const std::string& aName, const std::string& aValue );
void SetHeader( const std::string& aName, const std::string& aValue )
{
std::string header = aName + ':' + aValue;
m_headers = KICAD_CURL::slist_append( m_headers, header.c_str() );
}
/**
* Function SetUserAgent
@ -104,7 +99,14 @@ public:
* @param aAgent is the string to set for the user agent
* @return bool - True if successful, false if not
*/
bool SetUserAgent( const std::string& aAgent );
bool SetUserAgent( const std::string& aAgent )
{
if( SetOption<const char*>( CURLOPT_USERAGENT, aAgent.c_str() ) == CURLE_OK )
{
return true;
}
return false;
}
/**
* Function SetURL
@ -113,7 +115,14 @@ public:
* @param aURL is the URL
* @return bool - True if successful, false if not
*/
bool SetURL( const std::string& aURL );
bool SetURL( const std::string& aURL )
{
if( SetOption<const char *>( CURLOPT_URL, aURL.c_str() ) == CURLE_OK )
{
return true;
}
return false;
}
/**
* Function SetFollowRedirects
@ -123,16 +132,26 @@ public:
* @param aFollow is a boolean where true will enable following redirects
* @return bool - True if successful, false if not
*/
bool SetFollowRedirects( bool aFollow );
bool SetFollowRedirects( bool aFollow )
{
if( SetOption<long>( CURLOPT_FOLLOWLOCATION , (aFollow ? 1 : 0) ) == CURLE_OK )
{
return true;
}
return false;
}
/**
* Function GetErrorText
* fetches CURL's "friendly" error string for a given error code
*
* @param aCode is CURL error code
* @return std::string - the corresponding error string for the given code
* @return const std::string - the corresponding error string for the given code
*/
std::string GetErrorText( CURLcode aCode );
const std::string GetErrorText( CURLcode aCode )
{
return KICAD_CURL::easy_strerror( aCode );
}
/**
* Function SetOption
@ -143,24 +162,23 @@ public:
* @return CURLcode - CURL error code, will return CURLE_OK unless a problem was encountered
*/
template <typename T> CURLcode SetOption( CURLoption aOption, T aArg )
{
return curl_easy_setopt( m_CURL, aOption, aArg );
{
return KICAD_CURL::easy_setopt( m_CURL, aOption, aArg );
}
/**
* Function GetBuffer
* returns a const pointer to the data buffer
*
* @return KICAD_EASY_CURL_BUFFER* - pointer to buffer
* returns a const reference to the recevied data buffer
*/
const KICAD_EASY_CURL_BUFFER* GetBuffer()
const std::string& GetBuffer()
{
return &m_Buffer;
return m_buffer;
}
private:
CURL *m_CURL;
struct curl_slist *m_headers;
struct KICAD_EASY_CURL_BUFFER m_Buffer;
CURL* m_CURL;
curl_slist* m_headers;
std::string m_buffer;
};
#endif // KICAD_CURL_EASY_H_
#endif // KICAD_CURL_EASY_H_

View File

@ -4,7 +4,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2016 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -380,12 +380,19 @@ private:
return false;
}
/**
* @return the reference of the KIWAY_PLAYER having the type aFrameType
* if exists, or NULL if this KIWAY_PLAYER was not yet created, or was closed
*/
KIWAY_PLAYER* GetPlayerFrame( FRAME_T aFrameType );
static KIFACE* m_kiface[KIWAY_FACE_COUNT];
static int m_kiface_version[KIWAY_FACE_COUNT];
PGM_BASE* m_program;
int m_ctl;
wxFrame* m_top;
wxFrame* m_top; // Usually m_top is the Project manager
KIWAY_PLAYER* m_player[KIWAY_PLAYER_COUNT]; // from frame_type.h

View File

@ -54,9 +54,6 @@ typedef int LAYER_NUM;
* One of these cannot be "incremented".
*/
enum LAYER_ID
#if __cplusplus >= 201103L
: unsigned char
#endif
{
F_Cu, // 0
In1_Cu,
@ -116,13 +113,13 @@ enum LAYER_ID
B_Fab,
F_Fab,
LAYER_ID_COUNT
LAYER_ID_COUNT,
UNDEFINED_LAYER = -1,
UNSELECTED_LAYER = -2,
};
#define UNDEFINED_LAYER LAYER_ID(-1)
#define UNSELECTED_LAYER LAYER_ID(-2)
#define MAX_CU_LAYERS (B_Cu - F_Cu + 1)
/// A sequence of layers, a sequence provides a certain order.

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010 Jean-Pierre Charras, jp.charras@wanadoo.fr
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -1587,12 +1587,17 @@ public:
* Function SpreadFootprints
* Footprints (after loaded by reading a netlist for instance) are moved
* to be in a small free area (outside the current board) without overlapping.
* @param aFootprintsOutsideBoardOnly: true to move only
* footprints outside the board outlines
* (they are outside if the position of a footprint is outside
* the board outlines bounding box
* @param aFootprints: a list of footprints to be spread out.
* @param aMoveFootprintsOutsideBoardOnly: true to move only
* footprints outside the board outlines
* (they are outside if the position of a footprint is outside
* the board outlines bounding box).
* @param aCheckForBoardEdges: true to try to place footprints outside of
* board edges.
*/
void SpreadFootprints( bool aFootprintsOutsideBoardOnly );
void SpreadFootprints( std::vector<MODULE*>* aFootprints,
bool aMoveFootprintsOutsideBoardOnly,
bool aCheckForBoardEdges );
/**
* Function AutoPlaceModule

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2011-2014 Jean-Pierre Charras
* Copyright (C) 2004-2014 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2016 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -46,7 +46,7 @@ UNIT_SELECTOR_LEN::UNIT_SELECTOR_LEN( wxWindow *parent, wxWindowID id,
/*
* Function GetUnitScale
* return the scaling factor to convert users units
* to normalized units (meter )
* to normalized units (meter)
*/
double UNIT_SELECTOR_LEN::GetUnitScale()
{
@ -62,6 +62,40 @@ double UNIT_SELECTOR_LEN::GetUnitScale()
}
UNIT_SELECTOR_THICKNESS::UNIT_SELECTOR_THICKNESS( wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
const wxArrayString& choices, long style )
: UNIT_SELECTOR( parent, id, pos, size, choices, style )
{
Append( _( "mm" ) );
Append( _( "um" ) );
Append( _( "cm" ) );
Append( _( "mil" ) );
Append( _( "inch" ) );
Append( _( "oz/ft^2" ) );
};
/*
* Function GetUnitScale
* return the scaling factor to convert users units
* to normalized units (meter) including copper oz/ft^2
*/
double UNIT_SELECTOR_THICKNESS::GetUnitScale()
{
switch( GetCurrentSelection() )
{
case 0: return UNIT_MM; break;
case 1: return UNIT_MICRON; break;
case 2: return UNIT_CM; break;
case 3: return UNIT_MIL; break;
case 4: return UNIT_INCH; break;
case 5: return UNIT_OZSQFT; break;
}
return 1.0;
}
UNIT_SELECTOR_FREQUENCY::UNIT_SELECTOR_FREQUENCY( wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
const wxArrayString& choices, long style ):

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2011-2014 Jean-Pierre Charras
* Copyright (C) 2004-2014 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2016 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -73,6 +73,21 @@ public:
virtual double GetUnitScale();
};
class UNIT_SELECTOR_THICKNESS: public UNIT_SELECTOR
{
public:
UNIT_SELECTOR_THICKNESS( wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
const wxArrayString& choices, long style = 0 );
/**
* Function GetUnitScale
* @return the scaling factor to convert users units
* to normalized units (meter) including oz/ft^2
*/
virtual double GetUnitScale();
};
class UNIT_SELECTOR_FREQUENCY: public UNIT_SELECTOR
{
public:

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 17 2015)
// C++ code generated with wxFormBuilder (version Jan 1 2016)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -91,7 +91,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerRegParams->Add( m_labelRegultR1, 0, wxALL, 5 );
m_RegulR1Value = new wxTextCtrl( m_panelRegulators, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_RegulR1Value->SetMaxLength( 0 );
fgSizerRegParams->Add( m_RegulR1Value, 0, wxALL|wxEXPAND, 5 );
m_UnitRegultR11 = new wxStaticText( m_panelRegulators, wxID_ANY, _("KOhm"), wxDefaultPosition, wxDefaultSize, 0 );
@ -106,7 +105,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerRegParams->Add( m_labelRegultR2, 0, wxALL, 5 );
m_RegulR2Value = new wxTextCtrl( m_panelRegulators, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_RegulR2Value->SetMaxLength( 0 );
fgSizerRegParams->Add( m_RegulR2Value, 0, wxALL|wxEXPAND, 5 );
m_UnitRegultR1 = new wxStaticText( m_panelRegulators, wxID_ANY, _("KOhm"), wxDefaultPosition, wxDefaultSize, 0 );
@ -121,7 +119,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerRegParams->Add( m_labelVout, 0, wxALL, 5 );
m_RegulVoutValue = new wxTextCtrl( m_panelRegulators, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_RegulVoutValue->SetMaxLength( 0 );
fgSizerRegParams->Add( m_RegulVoutValue, 0, wxALL|wxEXPAND, 5 );
m_unitsVout = new wxStaticText( m_panelRegulators, wxID_ANY, _("V"), wxDefaultPosition, wxDefaultSize, 0 );
@ -138,7 +135,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerRegParams->Add( m_labelVRef, 0, wxALL, 5 );
m_RegulVrefValue = new wxTextCtrl( m_panelRegulators, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_RegulVrefValue->SetMaxLength( 0 );
fgSizerRegParams->Add( m_RegulVrefValue, 0, wxALL|wxEXPAND, 5 );
m_unitsVref = new wxStaticText( m_panelRegulators, wxID_ANY, _("V"), wxDefaultPosition, wxDefaultSize, 0 );
@ -155,7 +151,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerRegParams->Add( m_RegulIadjTitle, 0, wxALL, 5 );
m_RegulIadjValue = new wxTextCtrl( m_panelRegulators, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_RegulIadjValue->SetMaxLength( 0 );
fgSizerRegParams->Add( m_RegulIadjValue, 0, wxALL|wxEXPAND, 5 );
m_IadjUnitLabel = new wxStaticText( m_panelRegulators, wxID_ANY, _("uA"), wxDefaultPosition, wxDefaultSize, 0 );
@ -204,7 +199,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
bSizerDataFile = new wxBoxSizer( wxHORIZONTAL );
m_regulators_fileNameCtrl = new wxTextCtrl( sbSizerRegulatorsChooser->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_regulators_fileNameCtrl->SetMaxLength( 0 );
bSizerDataFile->Add( m_regulators_fileNameCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_buttonDataFile = new wxButton( sbSizerRegulatorsChooser->GetStaticBox(), wxID_ANY, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 );
@ -267,10 +261,11 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
m_staticTextCurrent = new wxStaticText( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, _("Current"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextCurrent->Wrap( -1 );
fgSizerTWprms->Add( m_staticTextCurrent, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
m_staticTextCurrent->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxEmptyString ) );
fgSizerTWprms->Add( m_staticTextCurrent, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxALIGN_RIGHT, 5 );
m_TrackCurrentValue = new wxTextCtrl( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_TrackCurrentValue->SetMaxLength( 0 );
fgSizerTWprms->Add( m_TrackCurrentValue, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 );
m_staticText62 = new wxStaticText( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, _("A"), wxDefaultPosition, wxDefaultSize, 0 );
@ -282,7 +277,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerTWprms->Add( m_staticText63, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_TrackDeltaTValue = new wxTextCtrl( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_TrackDeltaTValue->SetMaxLength( 0 );
fgSizerTWprms->Add( m_TrackDeltaTValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, 5 );
m_staticText64 = new wxStaticText( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, _("deg C"), wxDefaultPosition, wxDefaultSize, 0 );
@ -294,7 +288,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerTWprms->Add( m_staticText66, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT|wxLEFT, 5 );
m_TrackLengthValue = new wxTextCtrl( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_TrackLengthValue->SetMaxLength( 0 );
fgSizerTWprms->Add( m_TrackLengthValue, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 );
wxArrayString m_TW_CuLength_choiceUnitChoices;
@ -335,17 +328,18 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
sbSizerTW_Result = new wxStaticBoxSizer( new wxStaticBox( m_panelTrackWidth, wxID_ANY, _("External layer traces") ), wxVERTICAL );
wxFlexGridSizer* fgSizerTW_Results;
fgSizerTW_Results = new wxFlexGridSizer( 6, 3, 0, 0 );
fgSizerTW_Results = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizerTW_Results->AddGrowableCol( 1 );
fgSizerTW_Results->SetFlexibleDirection( wxBOTH );
fgSizerTW_Results->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextExtWidth = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("Trace width"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextExtWidth->Wrap( -1 );
m_staticTextExtWidth->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxEmptyString ) );
fgSizerTW_Results->Add( m_staticTextExtWidth, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT|wxRIGHT, 5 );
m_ExtTrackWidthValue = new wxTextCtrl( sbSizerTW_Result->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_ExtTrackWidthValue->SetMaxLength( 0 );
fgSizerTW_Results->Add( m_ExtTrackWidthValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
wxArrayString m_TW_ExtTrackWidth_choiceUnitChoices;
@ -358,13 +352,21 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerTW_Results->Add( m_staticText65, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT|wxLEFT, 5 );
m_ExtTrackThicknessValue = new wxTextCtrl( sbSizerTW_Result->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_ExtTrackThicknessValue->SetMaxLength( 0 );
fgSizerTW_Results->Add( m_ExtTrackThicknessValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
fgSizerTW_Results->Add( m_ExtTrackThicknessValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
wxArrayString m_ExtTrackThicknessUnitChoices;
m_ExtTrackThicknessUnit = new UNIT_SELECTOR_LEN( sbSizerTW_Result->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_ExtTrackThicknessUnitChoices, 0 );
m_ExtTrackThicknessUnit = new UNIT_SELECTOR_THICKNESS( sbSizerTW_Result->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_ExtTrackThicknessUnitChoices, 0 );
m_ExtTrackThicknessUnit->SetSelection( 0 );
fgSizerTW_Results->Add( m_ExtTrackThicknessUnit, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
fgSizerTW_Results->Add( m_ExtTrackThicknessUnit, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_staticline3 = new wxStaticLine( sbSizerTW_Result->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
fgSizerTW_Results->Add( m_staticline3, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_staticline4 = new wxStaticLine( sbSizerTW_Result->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
fgSizerTW_Results->Add( m_staticline4, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_staticline5 = new wxStaticLine( sbSizerTW_Result->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
fgSizerTW_Results->Add( m_staticline5, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_staticTextArea = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("Cross-section area"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextArea->Wrap( -1 );
@ -431,10 +433,11 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
m_staticTextIntWidth = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("Trace width"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextIntWidth->Wrap( -1 );
m_staticTextIntWidth->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 90, false, wxEmptyString ) );
fgSizerTW_Results1->Add( m_staticTextIntWidth, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
m_IntTrackWidthValue = new wxTextCtrl( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_IntTrackWidthValue->SetMaxLength( 0 );
fgSizerTW_Results1->Add( m_IntTrackWidthValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
wxArrayString m_TW_IntTrackWidth_choiceUnitChoices;
@ -447,11 +450,10 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerTW_Results1->Add( m_staticText652, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 );
m_IntTrackThicknessValue = new wxTextCtrl( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_IntTrackThicknessValue->SetMaxLength( 0 );
fgSizerTW_Results1->Add( m_IntTrackThicknessValue, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 );
wxArrayString m_IntTrackThicknessUnitChoices;
m_IntTrackThicknessUnit = new UNIT_SELECTOR_LEN( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_IntTrackThicknessUnitChoices, 0 );
m_IntTrackThicknessUnit = new UNIT_SELECTOR_THICKNESS( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_IntTrackThicknessUnitChoices, 0 );
m_IntTrackThicknessUnit->SetSelection( 0 );
fgSizerTW_Results1->Add( m_IntTrackThicknessUnit, 0, wxALL, 5 );
@ -537,7 +539,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
bLeftSizerElectricalClearance->Add( m_staticText891, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_ElectricalSpacingVoltage = new wxTextCtrl( m_panelElectricalSpacing, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_ElectricalSpacingVoltage->SetMaxLength( 0 );
bLeftSizerElectricalClearance->Add( m_ElectricalSpacingVoltage, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_buttonElectSpacingRefresh = new wxButton( m_panelElectricalSpacing, wxID_ANY, _("Update Values"), wxDefaultPosition, wxDefaultSize, 0 );
@ -650,7 +651,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerSubstPrms->Add( m_EpsilonR_label, 0, wxRIGHT|wxLEFT|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 );
m_Value_EpsilonR = new wxTextCtrl( sbSubstrateBoxSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_Value_EpsilonR->SetMaxLength( 0 );
fgSizerSubstPrms->Add( m_Value_EpsilonR, 0, wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_button_EpsilonR = new wxButton( sbSubstrateBoxSizer->GetStaticBox(), wxID_ANY, _("..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
@ -661,7 +661,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerSubstPrms->Add( m_TanD_label, 0, wxRIGHT|wxLEFT|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 );
m_Value_TanD = new wxTextCtrl( sbSubstrateBoxSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_Value_TanD->SetMaxLength( 0 );
fgSizerSubstPrms->Add( m_Value_TanD, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_button_TanD = new wxButton( sbSubstrateBoxSizer->GetStaticBox(), wxID_ANY, _("..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
@ -674,7 +673,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerSubstPrms->Add( m_Rho_label, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_Value_Rho = new wxTextCtrl( sbSubstrateBoxSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_Value_Rho->SetMaxLength( 0 );
fgSizerSubstPrms->Add( m_Value_Rho, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_button_Rho = new wxButton( sbSubstrateBoxSizer->GetStaticBox(), wxID_ANY, _("..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
@ -685,7 +683,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerSubstPrms->Add( m_substrate_prm4_label, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_Substrate_prm4_Value = new wxTextCtrl( sbSubstrateBoxSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_Substrate_prm4_Value->SetMaxLength( 0 );
fgSizerSubstPrms->Add( m_Substrate_prm4_Value, 0, wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxArrayString m_SubsPrm4_choiceUnitChoices;
@ -698,7 +695,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerSubstPrms->Add( m_substrate_prm5_label, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_Substrate_prm5_Value = new wxTextCtrl( sbSubstrateBoxSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_Substrate_prm5_Value->SetMaxLength( 0 );
fgSizerSubstPrms->Add( m_Substrate_prm5_Value, 0, wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxArrayString m_SubsPrm5_choiceUnitChoices;
@ -711,7 +707,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerSubstPrms->Add( m_substrate_prm6_label, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_Substrate_prm6_Value = new wxTextCtrl( sbSubstrateBoxSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_Substrate_prm6_Value->SetMaxLength( 0 );
fgSizerSubstPrms->Add( m_Substrate_prm6_Value, 0, wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxArrayString m_SubsPrm6_choiceUnitChoices;
@ -724,7 +719,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerSubstPrms->Add( m_substrate_prm7_label, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT|wxLEFT, 5 );
m_Substrate_prm7_Value = new wxTextCtrl( sbSubstrateBoxSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_Substrate_prm7_Value->SetMaxLength( 0 );
fgSizerSubstPrms->Add( m_Substrate_prm7_Value, 0, wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxArrayString m_SubsPrm7_choiceUnitChoices;
@ -737,7 +731,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerSubstPrms->Add( m_substrate_prm8_label, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT|wxLEFT, 5 );
m_Substrate_prm8_Value = new wxTextCtrl( sbSubstrateBoxSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_Substrate_prm8_Value->SetMaxLength( 0 );
fgSizerSubstPrms->Add( m_Substrate_prm8_Value, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
wxArrayString m_SubsPrm8_choiceUnitChoices;
@ -750,7 +743,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerSubstPrms->Add( m_substrate_prm9_label, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_Substrate_prm9_Value = new wxTextCtrl( sbSubstrateBoxSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_Substrate_prm9_Value->SetMaxLength( 0 );
fgSizerSubstPrms->Add( m_Substrate_prm9_Value, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
wxArrayString m_SubsPrm9_choiceUnitChoices;
@ -778,7 +770,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizeCmpPrms->Add( m_Frequency_label, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_Value_Frequency_Ctrl = new wxTextCtrl( sbCmpPrmsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_Value_Frequency_Ctrl->SetMaxLength( 0 );
fgSizeCmpPrms->Add( m_Value_Frequency_Ctrl, 0, wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxArrayString m_choiceUnit_FrequencyChoices;
@ -824,7 +815,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerPhysPrms->Add( m_phys_prm1_label, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_Phys_prm1_Value = new wxTextCtrl( btranslineRightSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_Phys_prm1_Value->SetMaxLength( 0 );
fgSizerPhysPrms->Add( m_Phys_prm1_Value, 0, wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxArrayString m_choiceUnit_Param1Choices;
@ -840,7 +830,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerPhysPrms->Add( m_phys_prm2_label, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_Phys_prm2_Value = new wxTextCtrl( btranslineRightSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_Phys_prm2_Value->SetMaxLength( 0 );
fgSizerPhysPrms->Add( m_Phys_prm2_Value, 0, wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxArrayString m_choiceUnit_Param2Choices;
@ -856,7 +845,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerPhysPrms->Add( m_phys_prm3_label, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_Phys_prm3_Value = new wxTextCtrl( btranslineRightSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_Phys_prm3_Value->SetMaxLength( 0 );
fgSizerPhysPrms->Add( m_Phys_prm3_Value, 0, wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxArrayString m_choiceUnit_Param3Choices;
@ -914,7 +902,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerResults->Add( m_elec_prm1_label, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_Elec_prm1_Value = new wxTextCtrl( sbElectricalResultsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_Elec_prm1_Value->SetMaxLength( 0 );
fgSizerResults->Add( m_Elec_prm1_Value, 0, wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxArrayString m_choiceUnit_ElecPrm1Choices;
@ -927,7 +914,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerResults->Add( m_elec_prm2_label, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_Elec_prm2_Value = new wxTextCtrl( sbElectricalResultsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_Elec_prm2_Value->SetMaxLength( 0 );
fgSizerResults->Add( m_Elec_prm2_Value, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
wxArrayString m_choiceUnit_ElecPrm2Choices;
@ -940,7 +926,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerResults->Add( m_elec_prm3_label, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_Elec_prm3_Value = new wxTextCtrl( sbElectricalResultsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_Elec_prm3_Value->SetMaxLength( 0 );
fgSizerResults->Add( m_Elec_prm3_Value, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
wxArrayString m_choiceUnit_ElecPrm3Choices;
@ -1069,7 +1054,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerAttPrms->Add( m_attenuationLabel, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_AttValueCtrl = new wxTextCtrl( sbSizerAttPrms->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_AttValueCtrl->SetMaxLength( 0 );
fgSizerAttPrms->Add( m_AttValueCtrl, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_attUnit = new wxStaticText( sbSizerAttPrms->GetStaticBox(), wxID_ANY, _("dB"), wxDefaultPosition, wxDefaultSize, 0 );
@ -1081,7 +1065,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerAttPrms->Add( m_attenuationZinLabel, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_ZinValueCtrl = new wxTextCtrl( sbSizerAttPrms->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_ZinValueCtrl->SetMaxLength( 0 );
fgSizerAttPrms->Add( m_ZinValueCtrl, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_attZinUnit = new wxStaticText( sbSizerAttPrms->GetStaticBox(), wxID_ANY, _("Ohms"), wxDefaultPosition, wxDefaultSize, 0 );
@ -1093,7 +1076,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerAttPrms->Add( m_ZoutLabel, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_ZoutValueCtrl = new wxTextCtrl( sbSizerAttPrms->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_ZoutValueCtrl->SetMaxLength( 0 );
fgSizerAttPrms->Add( m_ZoutValueCtrl, 0, wxALL, 5 );
m_attZoutUnit = new wxStaticText( sbSizerAttPrms->GetStaticBox(), wxID_ANY, _("Ohms"), wxDefaultPosition, wxDefaultSize, 0 );
@ -1132,7 +1114,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerAttResults->Add( m_attenuatorR1Label, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_Att_R1_Value = new wxTextCtrl( sbSizerAttValues->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_Att_R1_Value->SetMaxLength( 0 );
fgSizerAttResults->Add( m_Att_R1_Value, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_attR1Unit = new wxStaticText( sbSizerAttValues->GetStaticBox(), wxID_ANY, _("Ohms"), wxDefaultPosition, wxDefaultSize, 0 );
@ -1144,7 +1125,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerAttResults->Add( m_attenuatorR2Label, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_Att_R2_Value = new wxTextCtrl( sbSizerAttValues->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_Att_R2_Value->SetMaxLength( 0 );
fgSizerAttResults->Add( m_Att_R2_Value, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_attR2Unit1 = new wxStaticText( sbSizerAttValues->GetStaticBox(), wxID_ANY, _("Ohms"), wxDefaultPosition, wxDefaultSize, 0 );
@ -1156,7 +1136,6 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow
fgSizerAttResults->Add( m_attenuatorR3Label, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_Att_R3_Value = new wxTextCtrl( sbSizerAttValues->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_Att_R3_Value->SetMaxLength( 0 );
fgSizerAttResults->Add( m_Att_R3_Value, 0, wxALL, 5 );
m_attR3Unit = new wxStaticText( sbSizerAttValues->GetStaticBox(), wxID_ANY, _("Ohms"), wxDefaultPosition, wxDefaultSize, 0 );

View File

@ -562,6 +562,7 @@
<property name="minimum_size"></property>
<property name="name">sbSizerRegFormula</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
@ -2536,6 +2537,7 @@
<property name="minimum_size"></property>
<property name="name">sbSizerRegulatorsChooser</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
@ -3366,6 +3368,7 @@
<property name="minimum_size"></property>
<property name="name">sbSizerTW_Prms</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
@ -3386,7 +3389,7 @@
<property name="vgap">0</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL|wxALIGN_RIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
@ -3412,7 +3415,7 @@
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="font">,90,90,-1,70,0</property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
@ -4278,7 +4281,7 @@
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
@ -4526,6 +4529,7 @@
<property name="minimum_size"></property>
<property name="name">sbSizerTW_Result</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
@ -4542,7 +4546,7 @@
<property name="name">fgSizerTW_Results</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">6</property>
<property name="rows">0</property>
<property name="vgap">0</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
@ -4572,7 +4576,7 @@
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="font">,90,90,-1,70,0</property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
@ -4891,7 +4895,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="0">
<property name="BottomDockable">1</property>
@ -4982,7 +4986,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxChoice" expanded="0">
<property name="BottomDockable">1</property>
@ -5032,7 +5036,7 @@
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">UNIT_SELECTOR_LEN; UnitSelector.h</property>
<property name="subclass">UNIT_SELECTOR_THICKNESS; UnitSelector.h</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
@ -5068,6 +5072,249 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxStaticLine" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticline3</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLI_HORIZONTAL</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxStaticLine" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticline4</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLI_HORIZONTAL</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxStaticLine" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticline5</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLI_HORIZONTAL</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL</property>
@ -6078,6 +6325,7 @@
<property name="minimum_size"></property>
<property name="name">sbSizerTW_Result1</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
@ -6124,7 +6372,7 @@
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="font">,90,90,-1,70,0</property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
@ -6584,7 +6832,7 @@
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">UNIT_SELECTOR_LEN; UnitSelector.h</property>
<property name="subclass">UNIT_SELECTOR_THICKNESS; UnitSelector.h</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
@ -8837,6 +9085,7 @@
<property name="minimum_size"></property>
<property name="name">sbSubstrateBoxSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
@ -11227,6 +11476,7 @@
<property name="minimum_size"></property>
<property name="name">sbCmpPrmsSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
@ -11624,6 +11874,7 @@
<property name="minimum_size"></property>
<property name="name">btranslineRightSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
@ -12999,6 +13250,7 @@
<property name="minimum_size"></property>
<property name="name">sbElectricalResultsSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
@ -13817,6 +14069,7 @@
<property name="minimum_size"></property>
<property name="name">sbMessagesSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
@ -15090,6 +15343,7 @@
<property name="minimum_size"></property>
<property name="name">sbSizerAtt</property>
<property name="orient">wxHORIZONTAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
@ -15292,6 +15546,7 @@
<property name="minimum_size"></property>
<property name="name">sbSizerAttPrms</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
@ -16275,6 +16530,7 @@
<property name="minimum_size"></property>
<property name="name">sbSizerAttValues</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
@ -17247,6 +17503,7 @@
<property name="minimum_size"></property>
<property name="name">sbRightSizerFormula</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 17 2015)
// C++ code generated with wxFormBuilder (version Jan 1 2016)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -16,6 +16,7 @@ class UNIT_SELECTOR_ANGLE;
class UNIT_SELECTOR_FREQUENCY;
class UNIT_SELECTOR_LEN;
class UNIT_SELECTOR_RESISTOR;
class UNIT_SELECTOR_THICKNESS;
#include "kiway_player.h"
#include <wx/string.h>
@ -110,7 +111,10 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER
UNIT_SELECTOR_LEN* m_TW_ExtTrackWidth_choiceUnit;
wxStaticText* m_staticText65;
wxTextCtrl* m_ExtTrackThicknessValue;
UNIT_SELECTOR_LEN* m_ExtTrackThicknessUnit;
UNIT_SELECTOR_THICKNESS* m_ExtTrackThicknessUnit;
wxStaticLine* m_staticline3;
wxStaticLine* m_staticline4;
wxStaticLine* m_staticline5;
wxStaticText* m_staticTextArea;
wxStaticText* m_ExtTrackAreaValue;
wxStaticText* m_ExtTrackAreaUnitLabel;
@ -128,7 +132,7 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER
UNIT_SELECTOR_LEN* m_TW_IntTrackWidth_choiceUnit;
wxStaticText* m_staticText652;
wxTextCtrl* m_IntTrackThicknessValue;
UNIT_SELECTOR_LEN* m_IntTrackThicknessUnit;
UNIT_SELECTOR_THICKNESS* m_IntTrackThicknessUnit;
wxStaticText* m_staticTextArea1;
wxStaticText* m_IntTrackAreaValue;
wxStaticText* m_IntTrackAreaUnitLabel;

View File

@ -115,16 +115,14 @@ void PCB_CALCULATOR_FRAME::OnTWCalculateFromCurrent( wxCommandEvent& event )
double extThickness = std::abs( DoubleFromString( m_ExtTrackThicknessValue->GetValue() ) );
double intThickness = std::abs( DoubleFromString( m_IntTrackThicknessValue->GetValue() ) );
double deltaT_C = std::abs( DoubleFromString( m_TrackDeltaTValue->GetValue() ) );
double extTrackWidth;
double intTrackWidth;
// Normalize units.
// Normalize by units.
extThickness *= m_ExtTrackThicknessUnit->GetUnitScale();
intThickness *= m_IntTrackThicknessUnit->GetUnitScale();
// Calculate the widths.
extTrackWidth = TWCalculateWidth( current, extThickness, deltaT_C, false );
intTrackWidth = TWCalculateWidth( current, intThickness, deltaT_C, true );
double extTrackWidth = TWCalculateWidth( current, extThickness, deltaT_C, false );
double intTrackWidth = TWCalculateWidth( current, intThickness, deltaT_C, true );
// Update the display.
TWDisplayValues( current, extTrackWidth, intTrackWidth, extThickness, intThickness );
@ -355,6 +353,11 @@ void PCB_CALCULATOR_FRAME::TWUpdateModeDisplay()
m_staticTextIntWidth->SetFont( labelfont );
m_IntTrackWidthValue->SetFont( controlfont );
// Text sizes have changed when the font weight was changes
// So, run the page layout to reflect the changes
wxWindow* page = m_Notebook->GetPage ( 1 );
page->GetSizer()->Layout();
}
/* calculate track width for external or internal layers

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2011-2014 Jean-Pierre Charras
* Copyright (C) 2004-2014 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2016 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -37,6 +37,7 @@
#define UNIT_MICRON 1e-6 // um to meter
#define UNIT_INCH (1e-2*2.54) // inch to meter
#define UNIT_MIL (1e-5*2.54) // mil (or thou) to meter
#define UNIT_OZSQFT (34.40*UNIT_MICRON) // 1 oz/ft^2 is 34.30 microns nominal, 30.90 minimum
#define UNIT_GHZ 1e9
#define UNIT_MHZ 1e6

View File

@ -426,11 +426,11 @@ if( KICAD_SCRIPTING_MODULES )
pcad2kicadpcb
lib_dxf
idf3
${GITHUB_PLUGIN_LIBRARIES}
polygon
bitmaps
gal
${wxWidgets_LIBRARIES}
${GITHUB_PLUGIN_LIBRARIES}
${GDI_PLUS_LIBRARIES}
${PYTHON_LIBRARIES}
${PCBNEW_EXTRA_LIBS}
@ -594,8 +594,8 @@ target_link_libraries( pcbnew_kiface
gal
lib_dxf
idf3
${GITHUB_PLUGIN_LIBRARIES}
${wxWidgets_LIBRARIES}
${GITHUB_PLUGIN_LIBRARIES}
${GDI_PLUS_LIBRARIES}
${PYTHON_LIBRARIES}
${Boost_LIBRARIES} # must follow GITHUB

View File

@ -5,7 +5,7 @@
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
*
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -139,8 +139,15 @@ void PCB_EDIT_FRAME::OnPlaceOrRouteFootprints( wxCommandEvent& event )
DisplayError( this, _( "No footprint found!" ) );
return;
}
else
{
MODULE* footprint = GetBoard()->m_Modules;
std::vector<MODULE*> footprintList;
for( ; footprint != NULL; footprint = footprint->Next() )
footprintList.push_back( footprint );
SpreadFootprints( id == ID_POPUP_PCB_SPREAD_NEW_MODULES );
SpreadFootprints( &footprintList, id == ID_POPUP_PCB_SPREAD_NEW_MODULES, true );
}
break;
case ID_POPUP_PCB_AUTOROUTE_ALL_MODULES:

View File

@ -5,7 +5,7 @@
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>
*
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -35,6 +35,7 @@
*/
#include <algorithm>
#include <boost/foreach.hpp>
#include <fctsys.h>
#include <convert_to_biu.h>
@ -95,8 +96,8 @@ void fillRectList( CSubRectArray& vecSubRects, std::vector <EDA_RECT>& aRectList
// Spread a list of rectangles inside a placement area
void spreadRectangles( CRectPlacement& aPlacementArea,
CSubRectArray& vecSubRects,
int areaSizeX, int areaSizeY )
CSubRectArray& vecSubRects,
int areaSizeX, int areaSizeY )
{
areaSizeX/= scale;
areaSizeY/= scale;
@ -135,8 +136,9 @@ void spreadRectangles( CRectPlacement& aPlacementArea,
void moveFootprintsInArea( CRectPlacement& aPlacementArea,
std::vector <MODULE*>& aModuleList, EDA_RECT& aFreeArea,
bool aFindAreaOnly )
std::vector <MODULE*>& aModuleList,
EDA_RECT& aFreeArea,
bool aFindAreaOnly )
{
CSubRectArray vecSubRects;
@ -163,83 +165,82 @@ void moveFootprintsInArea( CRectPlacement& aPlacementArea,
}
}
static bool sortModulesbySheetPath( MODULE* ref, MODULE* compare );
static bool sortFootprintsbySheetPath( MODULE* ref, MODULE* compare );
/* Function to move components in a rectangular area format 4 / 3,
* starting from the mouse cursor
* The components with the FIXED status set are not moved
*/
void PCB_EDIT_FRAME::SpreadFootprints( bool aFootprintsOutsideBoardOnly )
void PCB_EDIT_FRAME::SpreadFootprints( std::vector<MODULE*>* aFootprints,
bool aMoveFootprintsOutsideBoardOnly,
bool aCheckForBoardEdges )
{
EDA_RECT bbox = GetBoard()->ComputeBoundingBox( true );
bool edgesExist = ( bbox.GetWidth() || bbox.GetHeight() );
// if aFootprintsOutsideBoardOnly is true, and if board outline exists,
// wue have to filter footprints to move:
bool outsideBrdFilter = aMoveFootprintsOutsideBoardOnly && edgesExist;
// no edges exist
if( aFootprintsOutsideBoardOnly && !edgesExist )
if( aMoveFootprintsOutsideBoardOnly && !edgesExist )
{
DisplayError( this,
_( "Could not automatically place footprints. No board outlines detected." ) );
return;
}
// if aFootprintsOutsideBoardOnly is true, and if board outline exists,
// wue have to filter footprints to move:
bool outsideBrdFilter = aFootprintsOutsideBoardOnly && edgesExist;
// Build candidate list
// calculate also the area needed by these footprints
MODULE* module = GetBoard()->m_Modules;
std::vector <MODULE*> moduleList;
std::vector <MODULE*> footprintList;
for( ; module != NULL; module = module->Next() )
BOOST_FOREACH( MODULE* footprint, *aFootprints )
{
module->CalculateBoundingBox();
footprint->CalculateBoundingBox();
if( outsideBrdFilter )
{
if( bbox.Contains( module->GetPosition() ) )
if( bbox.Contains( footprint->GetPosition() ) )
continue;
}
if( module->IsLocked() )
if( footprint->IsLocked() )
continue;
moduleList.push_back(module);
footprintList.push_back( footprint );
}
if( moduleList.size() == 0 ) // Nothing to do
if( footprintList.empty() )
return;
// sort footprints by sheet path. we group them later by sheet
sort( moduleList.begin(), moduleList.end(), sortModulesbySheetPath );
sort( footprintList.begin(), footprintList.end(), sortFootprintsbySheetPath );
// Undo command: init undo list
PICKED_ITEMS_LIST undoList;
undoList.m_Status = UR_CHANGED;
ITEM_PICKER picker( NULL, UR_CHANGED );
for( unsigned ii = 0; ii < moduleList.size(); ii++ )
BOOST_FOREACH( MODULE* footprint, footprintList )
{
module = moduleList[ii];
// Undo: add copy of module to undo list
picker.SetItem( module );
picker.SetLink( module->Clone() );
// Undo: add copy of the footprint to undo list
picker.SetItem( footprint );
picker.SetLink( footprint->Clone() );
undoList.PushItem( picker );
}
// Extract and place footprints by sheet
std::vector <MODULE*> moduleListBySheet;
std::vector <MODULE*> footprintListBySheet;
std::vector <EDA_RECT> placementSheetAreas;
double subsurface;
double placementsurface = 0.0;
wxPoint placementAreaPosition = GetCrossHairPosition();
// We do not want to move footprints inside an existing board.
// We sometimes do not want to move footprints inside an existing board.
// move the placement area position outside the board bounding box
// to the left of the board
if( edgesExist )
if( edgesExist && aCheckForBoardEdges )
{
if( placementAreaPosition.x < bbox.GetEnd().x &&
placementAreaPosition.y < bbox.GetEnd().y )
@ -253,24 +254,25 @@ void PCB_EDIT_FRAME::SpreadFootprints( bool aFootprintsOutsideBoardOnly )
// the first pass creates the rectangular areas to place footprints
// each sheet in schematic creates one rectangular area.
// the second pass moves footprints inside these areas
MODULE* footprint;
for( int pass = 0; pass < 2; pass++ )
{
int subareaIdx = 0;
moduleListBySheet.clear();
footprintListBySheet.clear();
subsurface = 0.0;
for( unsigned ii = 0; ii < moduleList.size(); ii++ )
for( unsigned ii = 0; ii < footprintList.size(); ii++ )
{
module = moduleList[ii];
footprint = footprintList[ii];
bool islastItem = false;
if( ii == moduleList.size() - 1 ||
( moduleList[ii]->GetPath().BeforeLast( '/' ) !=
moduleList[ii+1]->GetPath().BeforeLast( '/' ) ) )
if( ii == footprintList.size() - 1 ||
( footprintList[ii]->GetPath().BeforeLast( '/' ) !=
footprintList[ii+1]->GetPath().BeforeLast( '/' ) ) )
islastItem = true;
moduleListBySheet.push_back( module );
subsurface += module->GetArea();
footprintListBySheet.push_back( footprint );
subsurface += footprint->GetArea();
if( islastItem )
{
@ -292,7 +294,7 @@ void PCB_EDIT_FRAME::SpreadFootprints( bool aFootprintsOutsideBoardOnly )
}
bool findAreaOnly = pass == 0;
moveFootprintsInArea( placementArea, moduleListBySheet,
moveFootprintsInArea( placementArea, footprintListBySheet,
freeArea, findAreaOnly );
if( pass == 0 )
@ -312,7 +314,7 @@ void PCB_EDIT_FRAME::SpreadFootprints( bool aFootprintsOutsideBoardOnly )
// Prepare buffers for next sheet
subsurface = 0.0;
moduleListBySheet.clear();
footprintListBySheet.clear();
subareaIdx++;
}
}
@ -353,7 +355,7 @@ void PCB_EDIT_FRAME::SpreadFootprints( bool aFootprintsOutsideBoardOnly )
// Footprints are sorted by their sheet path.
// (the full sheet path restricted to the time stamp of the sheet itself,
// without the time stamp of the footprint ).
static bool sortModulesbySheetPath( MODULE* ref, MODULE* compare )
static bool sortFootprintsbySheetPath( MODULE* ref, MODULE* compare )
{
if( ref->GetPath().Length() == compare->GetPath().Length() )
return ref->GetPath().BeforeLast( '/' ).Cmp( compare->GetPath().BeforeLast( '/' ) ) < 0;

View File

@ -10,7 +10,7 @@
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
*
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -2259,13 +2259,14 @@ bool BOARD::NormalizeAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList, ZONE_CONTAI
void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
REPORTER* aReporter )
std::vector<MODULE*>* aNewFootprints, REPORTER* aReporter )
{
unsigned i;
wxPoint bestPosition;
wxString msg;
D_PAD* pad;
MODULE* footprint;
std::vector<MODULE*> newFootprints;
if( !IsEmpty() )
{
@ -2340,6 +2341,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
footprint->SetParent( this );
footprint->SetPosition( bestPosition );
footprint->SetTimeStamp( GetNewTimeStamp() );
newFootprints.push_back( footprint );
Add( footprint, ADD_APPEND );
}
}
@ -2666,6 +2668,8 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
}
}
}
std::swap( newFootprints, *aNewFootprints );
}

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -962,7 +962,7 @@ public:
* the #BOARD. If NULL, no change reporting occurs.
*/
void ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
REPORTER* aReporter = NULL );
std::vector<MODULE*>* aNewFootprints, REPORTER* aReporter = NULL );
/**
* Function SortedNetnamesList
@ -1216,10 +1216,10 @@ public:
* of the via.
* </p>
* @param aPosition The wxPoint to HitTest() against.
* @param aLayer The layer to search. Use -1 for a don't care.
* @param aLayer The layer to search. Use -1 (LAYER_ID::UNDEFINED_LAYER) for a don't care.
* @return VIA* A point a to the VIA object if found, else NULL.
*/
VIA* GetViaByPosition( const wxPoint& aPosition, LAYER_ID aLayer = UNDEFINED_LAYER ) const;
VIA* GetViaByPosition( const wxPoint& aPosition, LAYER_ID aLayer = LAYER_ID( -1 ) ) const;
/**
* Function GetPad

View File

@ -584,8 +584,6 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
{
int dist;
double pad_angle;
// Get the clearance between the 2 pads. this is the min distance between aRefPad and aPad
int dist_min = aRefPad->GetClearance( aPad );
@ -662,80 +660,6 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
diag = checkClearanceSegmToPad( aPad, aRefPad->GetSize().x, dist_min );
break;
case PAD_SHAPE_RECT:
// pad_angle = pad orient relative to the aRefPad orient
pad_angle = aRefPad->GetOrientation() + aPad->GetOrientation();
NORMALIZE_ANGLE_POS( pad_angle );
if( aPad->GetShape() == PAD_SHAPE_RECT )
{
wxSize size = aPad->GetSize();
// The trivial case is if both rects are rotated by multiple of 90 deg
// Most of time this is the case, and the test is fast
if( ( (aRefPad->GetOrientation() == 0) || (aRefPad->GetOrientation() == 900)
|| (aRefPad->GetOrientation() == 1800) || (aRefPad->GetOrientation() == 2700) )
&& ( (aPad->GetOrientation() == 0) || (aPad->GetOrientation() == 900) || (aPad->GetOrientation() == 1800)
|| (aPad->GetOrientation() == 2700) ) )
{
if( (pad_angle == 900) || (pad_angle == 2700) )
{
std::swap( size.x, size.y );
}
// Test DRC:
diag = false;
RotatePoint( &relativePadPos, aRefPad->GetOrientation() );
relativePadPos.x = std::abs( relativePadPos.x );
relativePadPos.y = std::abs( relativePadPos.y );
if( ( relativePadPos.x - ( (size.x + aRefPad->GetSize().x) / 2 ) ) >= dist_min )
diag = true;
if( ( relativePadPos.y - ( (size.y + aRefPad->GetSize().y) / 2 ) ) >= dist_min )
diag = true;
}
else // at least one pad has any other orient. Test is more tricky
{ // Use the trapezoid2trapezoidDRC which also compare 2 rectangles with any orientation
wxPoint polyref[4]; // Shape of aRefPad
wxPoint polycompare[4]; // Shape of aPad
aRefPad->BuildPadPolygon( polyref, wxSize( 0, 0 ), aRefPad->GetOrientation() );
aPad->BuildPadPolygon( polycompare, wxSize( 0, 0 ), aPad->GetOrientation() );
// Move aPad shape to relativePadPos
for( int ii = 0; ii < 4; ii++ )
polycompare[ii] += relativePadPos;
// And now test polygons:
if( !trapezoid2trapezoidDRC( polyref, polycompare, dist_min ) )
diag = false;
}
}
else if( aPad->GetShape() == PAD_SHAPE_TRAPEZOID )
{
wxPoint polyref[4]; // Shape of aRefPad
wxPoint polycompare[4]; // Shape of aPad
aRefPad->BuildPadPolygon( polyref, wxSize( 0, 0 ), aRefPad->GetOrientation() );
aPad->BuildPadPolygon( polycompare, wxSize( 0, 0 ), aPad->GetOrientation() );
// Move aPad shape to relativePadPos
for( int ii = 0; ii < 4; ii++ )
polycompare[ii] += relativePadPos;
// And now test polygons:
if( !trapezoid2trapezoidDRC( polyref, polycompare, dist_min ) )
diag = false;
}
else
{
// Should not occur, because aPad and aRefPad are swapped
// to have only aPad shape RECT or TRAP and aRefPad shape TRAP or RECT.
wxLogDebug( wxT( "DRC::checkClearancePadToPad: unexpected pad ref RECT @ %d, %d to pad shape %d @ %d, %d"),
aRefPad->GetPosition().x, aRefPad->GetPosition().y,
aPad->GetShape(), aPad->GetPosition().x, aPad->GetPosition().y );
}
break;
case PAD_SHAPE_OVAL: /* an oval pad is like a track segment */
{
/* Create a track segment with same dimensions as the oval aRefPad
@ -779,10 +703,7 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
}
case PAD_SHAPE_TRAPEZOID:
// at this point, aPad is also a trapezoid, because all other shapes
// have priority, and are already tested
wxASSERT( aPad->GetShape() == PAD_SHAPE_TRAPEZOID );
case PAD_SHAPE_RECT:
{
wxPoint polyref[4]; // Shape of aRefPad
wxPoint polycompare[4]; // Shape of aPad

View File

@ -41,7 +41,7 @@
* JP Charras.
*/
#include <kicad_curl/kicad_curl_easy.h> /* Include before any wx file */
#include <kicad_curl/kicad_curl_easy.h> // Include before any wx file
#include <wx/uri.h>
#include <github_getliblist.h>
@ -62,6 +62,7 @@ bool GITHUB_GETLIBLIST::Get3DshapesLibsList( wxArrayString* aList,
bool (*aFilter)( const wxString& aData ) )
{
std::string fullURLCommand;
strcpy( m_option_string, "text/html" );
wxString repoURL = m_repoURL;
@ -95,6 +96,7 @@ bool GITHUB_GETLIBLIST::GetFootprintLibraryList( wxArrayString& aList )
std::string fullURLCommand;
int page = 1;
int itemCountMax = 99; // Do not use a valu > 100, it does not work
strcpy( m_option_string, "application/json" );
// Github max items returned is 100 per page
@ -212,16 +214,15 @@ bool GITHUB_GETLIBLIST::remoteGetJSON( const std::string& aFullURLCommand, wxStr
wxLogDebug( wxT( "Attempting to download: " ) + aFullURLCommand );
kcurl.SetURL(aFullURLCommand);
kcurl.SetUserAgent("KiCad-EDA");
kcurl.SetHeader("Accept", m_option_string);
kcurl.SetFollowRedirects(true);
kcurl.SetURL( aFullURLCommand );
kcurl.SetUserAgent( "http://kicad-pcb.org" );
kcurl.SetHeader( "Accept", m_option_string );
kcurl.SetFollowRedirects( true );
try
{
kcurl.Perform();
m_image.reserve( kcurl.GetBuffer()->Size );
m_image.assign( kcurl.GetBuffer()->Payload, kcurl.GetBuffer()->Size );
m_image = kcurl.GetBuffer();
return true;
}
catch( const IO_ERROR& ioe )
@ -229,8 +230,8 @@ bool GITHUB_GETLIBLIST::remoteGetJSON( const std::string& aFullURLCommand, wxStr
if( aMsgError )
{
UTF8 fmt( _( "Error fetching JSON data from URL '%s'.\nReason: '%s'" ) );
std::string msg = StrPrintf( fmt.c_str(),
std::string msg = StrPrintf( fmt.c_str(),
aFullURLCommand.c_str(),
TO_UTF8( ioe.errorText ) );
@ -238,4 +239,4 @@ bool GITHUB_GETLIBLIST::remoteGetJSON( const std::string& aFullURLCommand, wxStr
}
return false;
}
}
}

View File

@ -61,10 +61,9 @@ Access-Control-Expose-Headers: ETag, Link, X-RateLimit-Limit, X-RateLimit-Remain
Access-Control-Allow-Origin: *
X-GitHub-Request-Id: 411087C2:659E:50FD6E6:52E67F66
Vary: Accept-Encoding
*/
#include <kicad_curl/kicad_curl_easy.h> /* Include before any wx file */
#include <kicad_curl/kicad_curl_easy.h> // Include before any wx file
#include <sstream>
#include <boost/ptr_container/ptr_map.hpp>
#include <set>
@ -122,7 +121,7 @@ GITHUB_PLUGIN::~GITHUB_PLUGIN()
const wxString GITHUB_PLUGIN::PluginName() const
{
return wxT( "Github" );
return "Github";
}
@ -391,7 +390,7 @@ void GITHUB_PLUGIN::cacheLib( const wxString& aLibraryPath, const PROPERTIES* aP
if( !wx_pretty_fn.IsOk() ||
!wx_pretty_fn.IsDirWritable() ||
wx_pretty_fn.GetExt() != wxT( "pretty" )
wx_pretty_fn.GetExt() != "pretty"
)
{
wxString msg = wxString::Format(
@ -408,7 +407,7 @@ void GITHUB_PLUGIN::cacheLib( const wxString& aLibraryPath, const PROPERTIES* aP
}
// operator==( wxString, wxChar* ) does not exist, construct wxString once here.
const wxString kicad_mod( wxT( "kicad_mod" ) );
const wxString kicad_mod( "kicad_mod" );
//D(printf("%s: this:%p m_lib_path:'%s' aLibraryPath:'%s'\n", __func__, this, TO_UTF8( m_lib_path), TO_UTF8(aLibraryPath) );)
m_gh_cache = new GH_CACHE();
@ -443,7 +442,7 @@ void GITHUB_PLUGIN::cacheLib( const wxString& aLibraryPath, const PROPERTIES* aP
}
bool GITHUB_PLUGIN::repoURL_zipURL( const wxString& aRepoURL, std::string& aZipURL )
bool GITHUB_PLUGIN::repoURL_zipURL( const wxString& aRepoURL, std::string* aZipURL )
{
// e.g. "https://github.com/liftoff-sr/pretty_footprints"
//D(printf("aRepoURL:%s\n", TO_UTF8( aRepoURL ) );)
@ -509,7 +508,7 @@ bool GITHUB_PLUGIN::repoURL_zipURL( const wxString& aRepoURL, std::string& aZipU
// this code path with the needs of one particular inflexible server.
}
aZipURL = zip_url.utf8_str();
*aZipURL = zip_url.utf8_str();
return true;
}
return false;
@ -520,7 +519,7 @@ void GITHUB_PLUGIN::remoteGetZip( const wxString& aRepoURL ) throw( IO_ERROR )
{
std::string zip_url;
if( !repoURL_zipURL( aRepoURL, zip_url ) )
if( !repoURL_zipURL( aRepoURL, &zip_url ) )
{
wxString msg = wxString::Format( _( "Unable to parse URL:\n'%s'" ), GetChars( aRepoURL ) );
THROW_IO_ERROR( msg );
@ -528,27 +527,30 @@ void GITHUB_PLUGIN::remoteGetZip( const wxString& aRepoURL ) throw( IO_ERROR )
wxLogDebug( wxT( "Attempting to download: " ) + zip_url );
KICAD_CURL_EASY kcurl;
KICAD_CURL_EASY kcurl; // this can THROW_IO_ERROR
kcurl.SetURL(zip_url.c_str());
kcurl.SetUserAgent("KiCad-EDA");
kcurl.SetHeader("Accept", "application/zip");
kcurl.SetFollowRedirects(true);
kcurl.SetURL( zip_url.c_str() );
kcurl.SetUserAgent( "http://kicad-pcb.org" );
kcurl.SetHeader( "Accept", "application/zip" );
kcurl.SetFollowRedirects( true );
try
{
kcurl.Perform();
m_zip_image.reserve( kcurl.GetBuffer()->Size );
m_zip_image.assign( kcurl.GetBuffer()->Payload, kcurl.GetBuffer()->Size );
m_zip_image = kcurl.GetBuffer();
}
catch( const IO_ERROR& ioe )
{
// https "GET" has faild, report this to API caller.
static const char errorcmd[] = "http GET command failed"; // Do not translate this message
UTF8 fmt( _( "%s\nCannot get/download Zip archive: '%s'\nfor library path: '%s'.\nReason: '%s'" ) );
std::string msg = StrPrintf( fmt.c_str(),
zip_url.c_str(),
TO_UTF8( aRepoURL ),
TO_UTF8( ioe.errorText ) );
TO_UTF8( ioe.errorText )
);
THROW_IO_ERROR( msg );
}
@ -575,7 +577,7 @@ int main( int argc, char** argv )
try
{
wxArrayString fps = gh.FootprintEnumerate(
wxT( "https://github.com/liftoff-sr/pretty_footprints" ),
"https://github.com/liftoff-sr/pretty_footprints",
NULL
);

View File

@ -210,7 +210,7 @@ protected:
* @param aZipURL is where to put the zip file URL.
* @return bool - true if @a aRepoULR was parseable, else false
*/
static bool repoURL_zipURL( const wxString& aRepoURL, std::string& aZipURL );
static bool repoURL_zipURL( const wxString& aRepoURL, std::string* aZipURL );
/**
* Function remoteGetZip

View File

@ -7,7 +7,7 @@
* Copyright (C) 1992-2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2013 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 1992-2016 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -66,6 +66,7 @@ void PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFileName,
NETLIST netlist;
KIGFX::VIEW* view = GetGalCanvas()->GetView();
BOARD* board = GetBoard();
std::vector<MODULE*> newFootprints;
netlist.SetIsDryRun( aIsDryRun );
netlist.SetFindByTimeStamp( aSelectByTimeStamp );
@ -113,12 +114,24 @@ void PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFileName,
m_toolManager->RunAction( COMMON_ACTIONS::selectionClear, true );
netlist.SortByReference();
board->ReplaceNetlist( netlist, aDeleteSinglePadNets, aReporter );
board->ReplaceNetlist( netlist, aDeleteSinglePadNets, &newFootprints, aReporter );
// If it was a dry run, nothing has changed so we're done.
if( netlist.IsDryRun() )
return;
if( IsGalCanvasActive() )
{
SpreadFootprints( &newFootprints, false, false );
BOOST_FOREACH( MODULE* footprint, newFootprints )
{
m_toolManager->RunAction( COMMON_ACTIONS::selectItem, true, footprint );
}
m_toolManager->InvokeTool( "pcbnew.InteractiveEdit" );
}
OnModify();
SetCurItem( NULL );

View File

@ -885,6 +885,9 @@ int PNS_NODE::FindLinesBetweenJoints( PNS_JOINT& aA, PNS_JOINT& aB, std::vector<
PNS_SEGMENT* seg = static_cast<PNS_SEGMENT*>( item );
PNS_LINE line = AssembleLine( seg );
if ( !line.Layers().Overlaps( aB.Layers() ) )
continue;
PNS_JOINT j_start, j_end;
FindLineEnds( line, j_start, j_end );

View File

@ -1,105 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2004-2014 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file python_console_frame.h
*/
#ifndef PYTHON_CONSOLE_FRAME_H_
#define PYTHON_CONSOLE_FRAME_H_
#if defined(KICAD_SCRIPTING) || defined(KICAD_SCRIPTING_WXPYTHON)
#include <python_scripting.h>
#endif
/**
* Class PYTHON_CONSOLE_FRAME is a simple derived class from wxMiniFrame
* to handle the scripting python console
*/
#define PC_STYLE wxCAPTION|wxCLOSE_BOX|wxRESIZE_BORDER
class PYTHON_CONSOLE_FRAME : public wxMiniFrame
{
private:
static wxSize m_frameSize; ///< The size of the frame, stored during a session
static wxPoint m_framePos; ///< The position of the frame, stored during a session
wxWindow * m_pythonPanel; ///< the window managed by the python shell
public:
PYTHON_CONSOLE_FRAME( wxWindow* aParent, const wxString& aFramenameId )
: wxMiniFrame( aParent, wxID_ANY, wxT("Python console"), wxDefaultPosition, wxDefaultSize,
PC_STYLE | wxFRAME_FLOAT_ON_PARENT, aFramenameId )
{
wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
SetSizer( sizer );
SetMinSize( wxSize( 500, 200 ) );
#if defined(KICAD_SCRIPTING_WXPYTHON)
m_pythonPanel = CreatePythonShellWindow( this );
sizer->Add( m_pythonPanel, 1, wxEXPAND, 0 );
#else
m_pythonPanel = NULL;
#endif
if( m_frameSize.x <= 0 || m_frameSize.y <= 0 )
SetSize( wxSize( 600, 300 ) );
else
SetSize( m_frameSize );
if( m_framePos.x == 0 && m_framePos.y == 0 )
Centre();
else
SetPosition( m_framePos );
Layout();
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW,
wxCloseEventHandler( PYTHON_CONSOLE_FRAME::OnClose ) );
}
~PYTHON_CONSOLE_FRAME()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW,
wxCloseEventHandler( PYTHON_CONSOLE_FRAME::OnClose ) );
}
private:
void OnClose( wxCloseEvent& event )
{
if( !IsIconized() )
{
m_frameSize = GetSize();
m_framePos = GetPosition();
}
event.Skip();
}
};
#endif // PYTHON_CONSOLE_FRAME_H_

View File

@ -1159,6 +1159,7 @@ int DRAWING_TOOL::drawZone( bool aKeepout )
// Get the current default settings for zones
ZONE_SETTINGS zoneInfo = m_frame->GetZoneSettings();
zoneInfo.m_CurrentZone_Layer = m_frame->GetScreen()->m_Active_Layer;
zoneInfo.SetIsKeepout( aKeepout );
m_controls->SetAutoPan( true );
m_controls->CaptureCursor( true );

View File

@ -313,7 +313,7 @@ int EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
lockOverride = false;
}
} while( evt = Wait() );
} while( ( evt = Wait() ) ); //Should be assignment not equality test
if( m_dragging )
decUndoInhibit();
@ -429,7 +429,7 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
// Shall the selection be cleared at the end?
bool unselect = selection.Empty();
if( !hoverSelection( selection ) )
if( !hoverSelection( selection ) || m_selectionTool->CheckLock() == SELECTION_LOCKED )
return 0;
wxPoint rotatePoint = getModificationPoint( selection );
@ -479,7 +479,7 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
// Shall the selection be cleared at the end?
bool unselect = selection.Empty();
if( !hoverSelection( selection ) )
if( !hoverSelection( selection ) || m_selectionTool->CheckLock() == SELECTION_LOCKED )
return 0;
wxPoint flipPoint = getModificationPoint( selection );
@ -524,7 +524,7 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
if( !hoverSelection( selection ) )
if( !hoverSelection( selection ) || m_selectionTool->CheckLock() == SELECTION_LOCKED )
return 0;
// Get a copy of the selected items set
@ -649,7 +649,7 @@ int EDIT_TOOL::MoveExact( const TOOL_EVENT& aEvent )
// Shall the selection be cleared at the end?
bool unselect = selection.Empty();
if( !hoverSelection( selection ) )
if( !hoverSelection( selection ) || m_selectionTool->CheckLock() == SELECTION_LOCKED )
return 0;
wxPoint translation;

View File

@ -116,9 +116,6 @@ VECTOR2I GRID_HELPER::AlignToSegment ( const VECTOR2I& aPoint, const SEG& aSeg )
{
OPT_VECTOR2I pts[6];
VECTOR2I origin( GetOrigin() );
VECTOR2I grid( GetGrid() );
const VECTOR2D gridOffset( GetOrigin() );
const VECTOR2D gridSize( GetGrid() );

View File

@ -479,7 +479,7 @@ int PCBNEW_CONTROL::CursorControl( const TOOL_EVENT& aEvent )
case COMMON_ACTIONS::CURSOR_CLICK: // fall through
case COMMON_ACTIONS::CURSOR_DBL_CLICK:
{
TOOL_ACTIONS action;
TOOL_ACTIONS action = TA_NONE;
int modifiers = 0;
modifiers |= wxGetKeyState( WXK_SHIFT ) ? MD_SHIFT : 0;