Compare commits

..

1 Commits

Author SHA1 Message Date
Wayne Stambaugh f9a2dced07 Tag release version 6.0.7. 2022-07-25 18:57:34 -04:00
379 changed files with 48300 additions and 56676 deletions
-9
View File
@@ -54,15 +54,6 @@ common/pcb_keywords.cpp
include/pcb_lexer.h
fp-info-cache
# .md generated files
eeschema/dialogs/dialog_bom_help_md.h
pcb_calculator/attenuators/bridget_tee_formula.h
pcb_calculator/attenuators/pi_formula.h
pcb_calculator/attenuators/splitter_formula.h
pcb_calculator/attenuators/tee_formula.h
pcb_calculator/eserie_help.h
pcb_calculator/tracks_width_versus_current_formula.h
# demo project auxiliary files
demos/**/*-bak
demos/**/_autosave-*
+1 -2
View File
@@ -40,7 +40,6 @@ include:
- local: '/.gitlab/templates.yml'
- local: '/.gitlab/Fedora-Linux-CI.yml'
- local: '/.gitlab/Ubuntu-20.04-CI.yml'
- local: '/.gitlab/Windows-CI.yml'
# - local: '/.gitlab/Windows-CI.yml'
- local: '/.gitlab/coverity.yml'
- local: '/.gitlab/linux-metadata-validate.yml'
- local: '/.gitlab/doxygen.yml'
+2 -13
View File
@@ -7,27 +7,16 @@ win64_build:
- kicad-windows-1809
extends: .only_code
interruptible: false
image: registry.gitlab.com/kicad/kicad-ci/windows-build-image/win1809-msvc:latest
variables:
VCPKG_BINARY_SOURCES: 'nuget,kicad,readwrite'
cache:
key: win64-vcpkg-"$CI_COMMIT_REF_SLUG"
paths:
- build\windows\vcpkg_installed
- .vcpkgCache
image: registry.gitlab.com/kicad/kicad-ci/source_containers/win64:msvc1809
only:
- branches@kicad/code/kicad
- tags@kicad/code/kicad
script:
- C:\builder\build.ps1 -Env -Arch x64
- $vcpkgCache=Join-Path -Path (Get-Location) -ChildPath ".vcpkgCache";$env:VCPKG_DEFAULT_BINARY_CACHE=$vcpkgCache;New-Item -ItemType Directory -Force -Path $vcpkgCache
- nuget.exe sources add -Name kicad -Source "https://nuget.kicad.org:443/v3/index.json"
- nuget.exe setapikey $env:KICAD_NUGET_KEY -Source "https://nuget.kicad.org:443/v3/index.json"
- mkdir -p build/windows -Force
- cd build/windows
- cmake `
-G "Ninja" `
-DCMAKE_TOOLCHAIN_FILE=C:\builder\vcpkg\scripts\buildsystems\vcpkg.cmake `
-DCMAKE_TOOLCHAIN_FILE=C:\build\vcpkg\scripts\buildsystems\vcpkg.cmake `
-DCMAKE_BUILD_TYPE=Debug `
-DKICAD_SCRIPTING_WXPYTHON=OFF `
-DKICAD_USE_OCC=ON `
-18
View File
@@ -1,18 +0,0 @@
build_doxygen_docker:
image: docker:stable
services:
- docker:dind
stage: build
tags:
- docker
before_script:
- docker info
- docker login -u gitlab-ci-token -p "$CI_BUILD_TOKEN" "$CI_REGISTRY"
script:
- docker build -t "${CI_REGISTRY_IMAGE}/doxygen:$CI_COMMIT_BRANCH" -f ./Documentation/doxygen.Dockerfile .
- docker push "${CI_REGISTRY_IMAGE}/doxygen:$CI_COMMIT_BRANCH"
only:
refs:
- schedules
variables:
- $SCHEDULED_JOB_NAME == "doxygen"
+3 -3
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
* Copyright (C) 2018-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2018-2020 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
@@ -29,6 +29,7 @@
#include <wx/datetime.h>
#include <wx/dir.h>
#include <wx/filename.h>
#include <wx/log.h>
#include <wx/stdpaths.h>
@@ -54,7 +55,6 @@
#include <project.h>
#include <settings/common_settings.h>
#include <settings/settings_manager.h>
#include <wx_filename.h>
#define MASK_3D_CACHE "3D_CACHE"
@@ -514,7 +514,7 @@ bool S3D_CACHE::Set3DConfigDir( const wxString& aConfigDir )
wxFileName cfgdir( ExpandEnvVarSubstitutions( aConfigDir, m_project ), wxEmptyString );
cfgdir.Normalize( FN_NORMALIZE_FLAGS );
cfgdir.Normalize();
if( !cfgdir.DirExists() )
{
+16 -6
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
* Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020 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
@@ -29,13 +29,13 @@
#include <wx/dir.h>
#include <wx/dynlib.h>
#include <wx/filename.h>
#include <wx/log.h>
#include <wx/stdpaths.h>
#include <wx/string.h>
#include <common.h>
#include <paths.h>
#include <wx_filename.h>
#include "3d_plugin_manager.h"
#include "plugins/3d/3d_plugin.h"
#include "3d_cache/sg/scenegraph.h"
@@ -153,14 +153,24 @@ void S3D_PLUGIN_MANAGER::loadPlugins( void )
fn.AssignDir( PATHS::GetStockPlugins3DPath() );
checkPluginPath( std::string( fn.GetPathWithSep().ToUTF8() ), searchpaths );
// check for per-user third party plugins
// note: GetUserDataDir() gives '.pcbnew' rather than '.kicad' since it uses the exe name;
fn.AssignDir( PATHS::GetUserPlugins3DPath() );
checkPluginPath( fn.GetPathWithSep(), searchpaths );
#else
// Search path on OS X is
// (1) Machine /Library/Application Support/kicad/PlugIns/3d
// (1) User ~/Library/Application Support/kicad/PlugIns/3d
checkPluginPath( PATHS::GetOSXKicadUserDataDir() + wxT( "/PlugIns/3d" ), searchpaths );
// (2) Machine /Library/Application Support/kicad/PlugIns/3d
checkPluginPath( PATHS::GetOSXKicadMachineDataDir() + wxT( "/PlugIns/3d" ), searchpaths );
// (2) Bundle kicad.app/Contents/PlugIns/3d
// (3) Bundle kicad.app/Contents/PlugIns/3d
fn.AssignDir( PATHS::GetStockPlugins3DPath() );
checkPluginPath( fn.GetPathWithSep(), searchpaths );
#endif
std::list< wxString >::iterator sPL = searchpaths.begin();
@@ -278,7 +288,7 @@ void S3D_PLUGIN_MANAGER::checkPluginName( const wxString& aPath,
wxFileName path( ExpandEnvVarSubstitutions( aPath, nullptr ) );
path.Normalize( FN_NORMALIZE_FLAGS );
path.Normalize();
// determine if the path is already in the list
wxString wxpath = path.GetFullPath();
@@ -316,7 +326,7 @@ void S3D_PLUGIN_MANAGER::checkPluginPath( const wxString& aPath,
else
path.Assign( aPath, wxEmptyString );
path.Normalize( FN_NORMALIZE_FLAGS );
path.Normalize();
if( !wxFileName::DirExists( path.GetFullPath() ) )
return;
-1
View File
@@ -119,7 +119,6 @@ BOARD_ADAPTER::BOARD_ADAPTER() :
SetFlag( FL_ZONE, true );
SetFlag( FL_SILKSCREEN, true );
SetFlag( FL_SOLDERMASK, true );
SetFlag( FL_SOLDERPASTE, true );
SetFlag( FL_SUBTRACT_MASK_FROM_SILK, false );
SetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS, true );
+26 -40
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2021 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
@@ -89,32 +89,30 @@ END_EVENT_TABLE()
EDA_3D_CANVAS::EDA_3D_CANVAS( wxWindow* aParent, const int* aAttribList,
BOARD_ADAPTER& aBoardAdapter, CAMERA& aCamera,
S3D_CACHE* a3DCachePointer ) :
HIDPI_GL_CANVAS( aParent, wxID_ANY, aAttribList, wxDefaultPosition, wxDefaultSize,
S3D_CACHE* a3DCachePointer )
: HIDPI_GL_CANVAS( aParent, wxID_ANY, aAttribList, wxDefaultPosition, wxDefaultSize,
wxFULL_REPAINT_ON_RESIZE ),
m_eventDispatcher( nullptr ),
m_parentStatusBar( nullptr ),
m_parentInfoBar( nullptr ),
m_glRC( nullptr ),
m_is_opengl_initialized( false ),
m_is_opengl_version_supported( true ),
m_editing_timeout_timer( this, wxID_HIGHEST + 1 ),
m_redraw_trigger_timer( this, wxID_HIGHEST + 2 ),
m_mouse_is_moving( false ),
m_mouse_was_moved( false ),
m_camera_is_moving( false ),
m_render_pivot( false ),
m_camera_moving_speed( 1.0f ),
m_strtime_camera_movement( 0 ),
m_animation_enabled( true ),
m_moving_speed_multiplier( 3 ),
m_boardAdapter( aBoardAdapter ),
m_camera( aCamera ),
m_3d_render( nullptr ),
m_opengl_supports_raytracing( true ),
m_render_raytracing_was_requested( false ),
m_accelerator3DShapes( nullptr ),
m_currentRollOverItem( nullptr )
m_eventDispatcher( nullptr ),
m_parentStatusBar( nullptr ),
m_parentInfoBar( nullptr ),
m_glRC( nullptr ),
m_is_opengl_initialized( false ),
m_is_opengl_version_supported( true ),
m_mouse_is_moving( false ),
m_mouse_was_moved( false ),
m_camera_is_moving( false ),
m_render_pivot( false ),
m_camera_moving_speed( 1.0f ),
m_strtime_camera_movement( 0 ),
m_animation_enabled( true ),
m_moving_speed_multiplier( 3 ),
m_boardAdapter( aBoardAdapter ),
m_camera( aCamera ),
m_3d_render( nullptr ),
m_opengl_supports_raytracing( true ),
m_render_raytracing_was_requested( false ),
m_accelerator3DShapes( nullptr ),
m_currentRollOverItem( nullptr )
{
wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::EDA_3D_CANVAS" ) );
@@ -847,14 +845,8 @@ void EDA_3D_CANVAS::OnMiddleUp( wxMouseEvent& event )
}
void EDA_3D_CANVAS::OnTimerTimeout_Editing( wxTimerEvent& aEvent )
void EDA_3D_CANVAS::OnTimerTimeout_Editing( wxTimerEvent& /* event */ )
{
if( aEvent.GetId() != m_editing_timeout_timer.GetId() )
{
aEvent.Skip();
return;
}
m_mouse_is_moving = false;
m_mouse_was_moved = false;
@@ -875,14 +867,8 @@ void EDA_3D_CANVAS::restart_editingTimeOut_Timer()
}
void EDA_3D_CANVAS::OnTimerTimeout_Redraw( wxTimerEvent& aEvent )
void EDA_3D_CANVAS::OnTimerTimeout_Redraw( wxTimerEvent& event )
{
if( aEvent.GetId() != m_redraw_trigger_timer.GetId() )
{
aEvent.Skip();
return;
}
Request_refresh( true );
}
@@ -27,7 +27,6 @@
* 3d models that come in the original data from the files without any transformations.
*/
#include <gal/opengl/kiglew.h> // Must be included first
#include <iostream>
#include "3d_rendering/opengl/3d_model.h"
#include "eda_3d_model_viewer.h"
@@ -39,7 +38,6 @@
#include <settings/common_settings.h>
#include <pgm_base.h>
#include <gal/dpi_scaling.h>
#include <macros.h>
/**
* Scale conversion from 3d model units to pcb units
@@ -184,20 +182,6 @@ void EDA_3D_MODEL_VIEWER::Clear3DModel()
void EDA_3D_MODEL_VIEWER::ogl_initialize()
{
const GLenum err = glewInit();
if( GLEW_OK != err )
{
const wxString msgError = (const char*) glewGetErrorString( err );
wxLogMessage( msgError );
}
else
{
wxLogTrace( m_logTrace, wxT( "EDA_3D_MODEL_VIEWER::ogl_initialize Using GLEW version %s" ),
FROM_UTF8( (char*) glewGetString( GLEW_VERSION ) ) );
}
glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );
glHint( GL_LINE_SMOOTH_HINT, GL_NICEST );
glHint( GL_POLYGON_SMOOTH_HINT, GL_NICEST );
+1 -1
View File
@@ -111,7 +111,7 @@ TOOL_ACTION EDA_3D_ACTIONS::resetView( "3DViewer.Control.resetView",
TOOL_ACTION EDA_3D_ACTIONS::flipView( "3DViewer.Control.flipView",
AS_ACTIVE,
'F', "",
0, "",
_( "Flip Board" ), _( "Flip the board view" ),
BITMAPS::flip_board, AF_NONE, (void*) ID_VIEW3D_FLIP );
+2 -3
View File
@@ -3,7 +3,7 @@
*
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
* Copyright (C) 2017-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017-2021 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
@@ -34,7 +34,6 @@
#include <common_ogl/ogl_attr_list.h>
#include <filename_resolver.h>
#include <pcbnew/footprint.h>
#include <wx_filename.h>
#include <wx/filedlg.h>
@@ -165,7 +164,7 @@ bool DIALOG_SELECT_3DMODEL::TransferDataFromWindow()
// file selection mode: retrieve the filename and specify a
// path relative to one of the config paths
wxFileName fname = m_FileTree->GetFilePath();
fname.Normalize( FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS );
fname.Normalize();
m_model->m_Filename = m_resolver->ShortenPath( fname.GetFullPath() );
return true;
+6 -6
View File
@@ -38,8 +38,8 @@ macro( create_git_version_header _git_src_path )
${GIT_EXECUTABLE} describe --dirty
WORKING_DIRECTORY ${_git_src_path}
OUTPUT_VARIABLE _git_DESCRIBE
ERROR_VARIABLE _git_describe_error
RESULT_VARIABLE _git_describe_result
ERROR_VARIABLE _git_log_error
RESULT_VARIABLE _git_log_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
@@ -47,8 +47,8 @@ macro( create_git_version_header _git_src_path )
${GIT_EXECUTABLE} rev-list --count --first-parent HEAD
WORKING_DIRECTORY ${_git_src_path}
OUTPUT_VARIABLE _git_REV_COUNT
ERROR_VARIABLE _git_rev_count_error
RESULT_VARIABLE _git_rev_count_result
ERROR_VARIABLE _git_log_error
RESULT_VARIABLE _git_log_result
OUTPUT_STRIP_TRAILING_WHITESPACE)
set( ENV{LC_ALL} ${_Git_SAVED_LC_ALL} )
@@ -56,11 +56,11 @@ macro( create_git_version_header _git_src_path )
# Check to make sure 'git' command did not fail. Otherwise fallback
# to KiCadVersion.cmake as the revision level.
if( _git_describe_result EQUAL 0 )
if( _git_DESCRIBE )
set( KICAD_VERSION "(${_git_DESCRIBE})" )
endif()
if( _git_rev_count_result EQUAL 0 )
if( _git_REV_COUNT )
set( KICAD_GIT_REV "${_git_REV_COUNT}" )
# Sanity check
+2 -2
View File
@@ -2,7 +2,7 @@
# This program source code file is part of KICAD, a free EDA CAD application.
#
# Copyright (C) 2016 Wayne Stambaugh <stambaughw@gmail.com>
# Copyright (C) 2016-2023 KiCad Developers, see AUTHORS.txt for contributors.
# Copyright (C) 2016-2022 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
@@ -37,7 +37,7 @@
# KiCad.
#
# Note: This version string should follow the semantic versioning system
set( KICAD_SEMANTIC_VERSION "6.0.11" )
set( KICAD_SEMANTIC_VERSION "6.0.7" )
# Default the version to the semantic version.
# This is overridden by the git repository tag though (if using git)
-23
View File
@@ -1,23 +0,0 @@
FROM registry.gitlab.com/kicad/kicad-ci/source_containers/master/ubuntu:22.04 as build-doxygen-env
USER root
WORKDIR /src
COPY . ./
RUN ls
RUN mkdir build && cd build
WORKDIR /src/build
RUN cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DKICAD_USE_OCC=ON \
-DKICAD_SCRIPTING_WXPYTHON=ON \
-DKICAD_SPICE=ON
RUN make doxygen-docs
RUN make doxygen-python
FROM scratch as output-image
COPY --from=build-doxygen-env /src/Documentation/doxygen/html /doxygen-docs_html
COPY --from=build-doxygen-env /src/build/pcbnew/doxygen-python/html /doxygen-python_html
@@ -1,6 +0,0 @@
doxygen.Dockerfile.dockerignore.git
.gitlab
.github
.idea
.vs
build
+13 -14
View File
@@ -503,22 +503,21 @@ void BITMAPCONV_INFO::createOutputData( BMP2CMP_MOD_LAYER aModLayer )
polyset_areas.BooleanSubtract( polyset_holes, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
// Ensure there are no self intersecting polygons
if( polyset_areas.NormalizeAreaOutlines() )
polyset_areas.NormalizeAreaOutlines();
// Convert polygon with holes to a unique polygon
polyset_areas.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
// Output current resulting polygon(s)
for( int ii = 0; ii < polyset_areas.OutlineCount(); ii++ )
{
// Convert polygon with holes to a unique polygon
polyset_areas.Fracture( SHAPE_POLY_SET::PM_STRICTLY_SIMPLE );
// Output current resulting polygon(s)
for( int ii = 0; ii < polyset_areas.OutlineCount(); ii++ )
{
SHAPE_LINE_CHAIN& poly = polyset_areas.Outline( ii );
outputOnePolygon( poly, getBoardLayerName( aModLayer ));
}
polyset_areas.RemoveAllContours();
polyset_holes.RemoveAllContours();
main_outline = true;
SHAPE_LINE_CHAIN& poly = polyset_areas.Outline( ii );
outputOnePolygon( poly, getBoardLayerName( aModLayer ));
}
polyset_areas.RemoveAllContours();
polyset_holes.RemoveAllContours();
main_outline = true;
}
paths = paths->next;
+11
View File
@@ -82,6 +82,13 @@ static const wxChar DRCEpsilon[] = wxT( "DRCEpsilon" );
*/
static const wxChar HoleWallThickness[] = wxT( "HoleWallPlatingThickness" );
/**
* Testing mode for new connectivity algorithm. Setting this to on will cause all modifications
* to the netlist to be recalculated on the fly. This may be slower than the standard process
* at the moment
*/
static const wxChar RealtimeConnectivity[] = wxT( "RealtimeConnectivity" );
/**
* Configure the coroutine stack size in bytes. This should be allocated in multiples of
* the system page size (n*4096 is generally safe)
@@ -253,6 +260,7 @@ ADVANCED_CFG::ADVANCED_CFG()
// Init defaults - this is done in case the config doesn't exist,
// then the values will remain as set here.
m_RealTimeConnectivity = true;
m_CoroutineStackSize = AC_STACK::default_stack;
m_ShowRouterDebugGraphics = false;
m_DrawArcAccuracy = 10.0;
@@ -325,6 +333,9 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
{
std::vector<PARAM_CFG*> configParams;
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::RealtimeConnectivity,
&m_RealTimeConnectivity, m_RealTimeConnectivity ) );
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::ExtraFillMargin,
&m_ExtraClearance, m_ExtraClearance, 0.0, 1.0 ) );
-8
View File
@@ -121,13 +121,6 @@ wxBitmap KiBitmap( const BITMAP_OPAQUE* aBitmap )
int KiIconScale( wxWindow* aWindow )
{
#if defined( __WXMSW__) && wxCHECK_VERSION( 3, 1, 6 )
// Basically don't try and scale within kicad and let wx do its thing
// with wx introducing bitmap bundles, it will auto scale automatically with dpi
// the issue is, none of the scaling factors have any tie to system scaling
// this means wx is actually going to scale again causing even more distorted icons
return 4;
#else
const int vert_size = aWindow->ConvertDialogToPixels( wxSize( 0, 8 ) ).y;
// Autoscale won't exceed unity until the system has quite high resolution,
@@ -138,7 +131,6 @@ int KiIconScale( wxWindow* aWindow )
else if( vert_size > 29 ) return 7;
else if( vert_size > 24 ) return 6;
else return 4;
#endif
}
-14
View File
@@ -251,16 +251,6 @@ void BITMAP_BASE::DrawBitmap( wxDC* aDC, const wxPoint& aPos )
aDC->GetLogicalOrigin( &logicalOriginX, &logicalOriginY );
bool useTransform = aDC->CanUseTransformMatrix();
// We already have issues to draw a bitmap on the wxDC, depending on wxWidgets version.
// Now we have an issue on wxWidgets 3.1.6 and later to fix the clipboard
// and the bitmap position when using TransformMatrix
// So for version >= 3.1.6 do not use it
// Be carefull before changing the code.
#if wxCHECK_VERSION( 3, 1, 6 )
useTransform = false;
#endif
wxAffineMatrix2D init_matrix = aDC->GetTransformMatrix();
wxPoint clipAreaPos;
@@ -271,12 +261,8 @@ void BITMAP_BASE::DrawBitmap( wxDC* aDC, const wxPoint& aPos )
matrix.Translate( pos.x, pos.y );
matrix.Scale( GetScalingFactor(), GetScalingFactor() );
aDC->SetTransformMatrix( matrix );
// Needed on wx <= 3.1.5, and this is strange...
// Nevertheless, this code has problem (the bitmap is not seen)
// with wx version > 3.1.5
clipAreaPos.x = pos.x;
clipAreaPos.y = pos.y;
pos.x = pos.y = 0;
}
else
-3
View File
@@ -136,9 +136,6 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa
setupPainter( *painter );
setupViewLayers( *view, m_settings.m_LayerSet );
dstSettings->SetPrintLayers( m_settings.m_LayerSet );
dstSettings->SetLayerName( aLayerName );
wxSize sheetSizeMils = m_settings.m_pageInfo.GetSizeMils();
VECTOR2I sheetSizeIU( milsToIU( sheetSizeMils.GetWidth() ),
+3 -13
View File
@@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2018-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -396,18 +396,13 @@ void DIALOG_COLOR_PICKER::drawRGBPalette()
// Use Y axis from bottom to top and origin to center
bitmapDC.SetAxisOrientation( true, true );
#if wxCHECK_VERSION( 3, 1, 7 )
// For some reason, SetDeviceOrigin has changed in wxWidgets 3.1.6 or 3.1.7
bitmapDC.SetDeviceOrigin( half_size, -half_size );
#else
bitmapDC.SetDeviceOrigin( half_size, half_size );
#endif
// Reserve room to draw cursors inside the bitmap
half_size -= m_cursorsSize/2;
// Draw the 3 RGB cursors, using white color to make them always visible:
wxPen pen( wxColor( 255, 255, 255 ), 2 ); // use 2 pixels for pen size
wxPen pen( wxColor( 255, 255, 255 ) );
wxBrush brush( wxColor( 0, 0, 0 ), wxBRUSHSTYLE_TRANSPARENT );
bitmapDC.SetPen( pen );
bitmapDC.SetBrush( brush );
@@ -466,12 +461,7 @@ void DIALOG_COLOR_PICKER::drawHSVPalette()
// Use Y axis from bottom to top and origin to center
bitmapDC.SetAxisOrientation( true, true );
#if wxCHECK_VERSION( 3, 1, 7 )
// For some reason, SetDeviceOrigin has changed in wxWidgets 3.1.6 or 3.1.7
bitmapDC.SetDeviceOrigin( half_size, -half_size );
#else
bitmapDC.SetDeviceOrigin( half_size, half_size );
#endif
// Reserve room to draw cursors inside the bitmap
half_size -= m_cursorsSize / 2;
@@ -480,7 +470,7 @@ void DIALOG_COLOR_PICKER::drawHSVPalette()
m_cursorBitmapHSV.x = cos( m_hue * M_PI / 180.0 ) * half_size * m_sat;
m_cursorBitmapHSV.y = sin( m_hue * M_PI / 180.0 ) * half_size * m_sat;
wxPen pen( wxColor( 0, 0, 0 ), 2 ); // Use 2 pixels as pensize
wxPen pen( wxColor( 0, 0, 0 ) );
wxBrush brush( wxColor( 0, 0, 0 ), wxBRUSHSTYLE_TRANSPARENT );
bitmapDC.SetPen( pen );
bitmapDC.SetBrush( brush );
-2
View File
@@ -45,8 +45,6 @@ DIALOG_PASTE_SPECIAL::DIALOG_PASTE_SPECIAL( wxWindow* aParent,
"with '%s'." ),
aReplacement ) );
m_sdbSizerOK->SetFocus();
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();
}
+2 -4
View File
@@ -40,11 +40,10 @@ static int DEFAULT_COL_WIDTHS[] = { 200, 600 };
EDA_LIST_DIALOG::EDA_LIST_DIALOG( wxWindow* aParent, const wxString& aTitle,
const wxArrayString& aItemHeaders,
const std::vector<wxArrayString>& aItemList,
const wxString& aPreselectText, bool aSortList ) :
const wxString& aPreselectText ) :
EDA_LIST_DIALOG_BASE( aParent, wxID_ANY, aTitle )
{
m_itemsList = &aItemList;
m_sortList = aSortList;
m_filterBox->SetHint( _( "Filter" ) );
@@ -235,6 +234,5 @@ static int wxCALLBACK myCompareFunction( wxIntPtr aItem1, wxIntPtr aItem2,
void EDA_LIST_DIALOG::sortList()
{
if( m_sortList )
m_listBox->SortItems( myCompareFunction, 0 );
m_listBox->SortItems( myCompareFunction, 0 );
}
+1 -1
View File
@@ -250,7 +250,7 @@ static void netclassToGridRow( EDA_UNITS aUnits, wxGrid* aGrid, int aRow, const
SET_MILS_CELL( GRID_WIREWIDTH, nc->GetWireWidth() );
SET_MILS_CELL( GRID_BUSWIDTH, nc->GetBusWidth() );
wxString colorAsString = nc->GetSchematicColor().ToCSSString();
wxString colorAsString = nc->GetSchematicColor().ToWxString( wxC2S_CSS_SYNTAX );
aGrid->SetCellValue( aRow, GRID_SCHEMATIC_COLOR, colorAsString );
int lineStyleIdx = std::max( 0, nc->GetLineStyle() );
-5
View File
@@ -174,11 +174,6 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
void EDA_DRAW_PANEL_GAL::DoRePaint()
{
if( !m_refreshMutex.try_lock() )
return;
std::lock_guard<std::mutex> lock( m_refreshMutex, std::adopt_lock );
// Repaint the canvas, and fix scrollbar cursors
// Usually called by a OnPaint event, but because it does not use a wxPaintDC,
// it can be called outside a wxPaintEvent.
@@ -83,7 +83,6 @@ void DS_PROXY_VIEW_ITEM::buildDrawList( VIEW* aView, DS_DRAW_ITEM_LIST* aDrawLis
aDrawList->SetSheetCount( m_sheetCount );
aDrawList->SetFileName( fileName );
aDrawList->SetSheetName( sheetName );
aDrawList->SetSheetLayer( settings->GetLayerName() );
aDrawList->SetProject( m_project );
aDrawList->BuildDrawItemsList( *m_pageInfo, *m_titleBlock );
+17 -17
View File
@@ -969,27 +969,22 @@ bool EDA_DRAW_FRAME::LibraryFileBrowser( bool doOpen, wxFileName& aFilename,
wxString prompt = doOpen ? _( "Select Library" ) : _( "New Library" );
aFilename.SetExt( ext );
wxString projectDir = Prj().IsNullProject() ? aFilename.GetPath() : Prj().GetProjectPath();
wxString defaultDir;
wxString dir;
if( aIsGlobal )
{
if( !GetMruPath().IsEmpty() && !GetMruPath().StartsWith( projectDir ) )
defaultDir = GetMruPath();
else
defaultDir = aGlobalPath;
}
if( GetMruPath().IsEmpty() )
dir = aGlobalPath;
else
{
if( !GetMruPath().IsEmpty() && GetMruPath().StartsWith( projectDir ) )
defaultDir = GetMruPath();
else
defaultDir = projectDir;
}
dir = GetMruPath();
if( isDirectory && doOpen )
{
wxDirDialog dlg( this, prompt, defaultDir, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
if( !aIsGlobal && GetMruPath().IsEmpty() )
{
dir = Prj().GetProjectPath();
}
wxDirDialog dlg( this, prompt, dir, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL )
return false;
@@ -1003,7 +998,12 @@ bool EDA_DRAW_FRAME::LibraryFileBrowser( bool doOpen, wxFileName& aFilename,
if( aFilename.GetName().empty() )
aFilename.SetName( wxT( "Library" ) );
wxFileDialog dlg( this, prompt, defaultDir, aFilename.GetFullName(),
if( !aIsGlobal && GetMruPath().IsEmpty() )
{
dir = Prj().IsNullProject() ? aFilename.GetFullPath() : Prj().GetProjectPath();
}
wxFileDialog dlg( this, prompt, dir, aFilename.GetFullName(),
wildcard, doOpen ? wxFD_OPEN | wxFD_FILE_MUST_EXIST
: wxFD_SAVE | wxFD_CHANGE_DIR | wxFD_OVERWRITE_PROMPT );
+1 -1
View File
@@ -365,7 +365,7 @@ void EDA_SHAPE::flip( const wxPoint& aCentre, bool aFlipLeftRight )
void EDA_SHAPE::RebuildBezierToSegmentsPointsList( int aMinSegLen )
{
// Has meaning only for SHAPE_T::BEZIER
// Has meaning only for S_CURVE DRAW_SEGMENT shape
if( m_shape != SHAPE_T::BEZIER )
{
m_bezierPoints.clear();
+11 -15
View File
@@ -26,6 +26,7 @@
#include <mutex>
#include <sstream>
#include <wx/filename.h>
#include <wx/log.h>
#include <wx/msgdlg.h>
#include <pgm_base.h>
@@ -33,7 +34,6 @@
#include "common.h"
#include "filename_resolver.h"
#include <wx_filename.h>
// configuration file version
#define CFGFILE_VERSION 1
@@ -66,7 +66,7 @@ bool FILENAME_RESOLVER::Set3DConfigDir( const wxString& aConfigDir )
wxFileName cfgdir( ExpandEnvVarSubstitutions( aConfigDir, m_project ), wxEmptyString );
cfgdir.Normalize( FN_NORMALIZE_FLAGS );
cfgdir.Normalize();
if( !cfgdir.DirExists() )
return false;
@@ -87,7 +87,7 @@ bool FILENAME_RESOLVER::SetProject( PROJECT* aProject, bool* flgChanged )
wxFileName projdir( ExpandEnvVarSubstitutions( aProject->GetProjectPath(), aProject ), wxEmptyString );
projdir.Normalize( FN_NORMALIZE_FLAGS );
projdir.Normalize();
if( !projdir.DirExists() )
return false;
@@ -189,7 +189,7 @@ bool FILENAME_RESOLVER::createPathList()
else
{
fndummy.Assign( pathVal, wxEmptyString );
fndummy.Normalize( FN_NORMALIZE_FLAGS );
fndummy.Normalize();
lpath.m_Pathexp = fndummy.GetFullPath();
}
@@ -269,7 +269,7 @@ wxString FILENAME_RESOLVER::ResolvePath( const wxString& aFileName )
// working directory (which is not necessarily the current project directory)
if( tmpFN.FileExists() )
{
tmpFN.Normalize( FN_NORMALIZE_FLAGS );
tmpFN.Normalize();
tname = tmpFN.GetFullPath();
// special case: if a path begins with ${ENV_VAR} but is not in the resolver's path list
@@ -316,7 +316,7 @@ wxString FILENAME_RESOLVER::ResolvePath( const wxString& aFileName )
if( wxFileName::FileExists( fullPath ) )
{
tmpFN.Assign( fullPath );
tmpFN.Normalize( FN_NORMALIZE_FLAGS );
tmpFN.Normalize();
tname = tmpFN.GetFullPath();
return tname;
}
@@ -333,7 +333,7 @@ wxString FILENAME_RESOLVER::ResolvePath( const wxString& aFileName )
fullPath = ExpandEnvVarSubstitutions( fullPath, m_project );
fpath.Assign( fullPath );
if( fpath.Normalize( FN_NORMALIZE_FLAGS ) && fpath.FileExists() )
if( fpath.Normalize() && fpath.FileExists() )
{
tname = fpath.GetFullPath();
return tname;
@@ -381,7 +381,7 @@ wxString FILENAME_RESOLVER::ResolvePath( const wxString& aFileName )
wxFileName tmp( fullPath );
if( tmp.Normalize( FN_NORMALIZE_FLAGS ) )
if( tmp.Normalize() )
tname = tmp.GetFullPath();
return tname;
@@ -422,7 +422,7 @@ bool FILENAME_RESOLVER::addPath( const SEARCH_PATH& aPath )
wxFileName path( ExpandEnvVarSubstitutions( tpath.m_Pathvar, m_project ), wxEmptyString );
path.Normalize( FN_NORMALIZE_FLAGS );
path.Normalize();
if( !path.DirExists() )
{
@@ -496,11 +496,7 @@ bool FILENAME_RESOLVER::readPathList()
}
wxFileName cfgpath( m_configDir, RESOLVER_CONFIG );
// This should be the same as wxWidgets 3.0 wxPATH_NORM_ALL which is deprecated in 3.1.
// There are known issues with environment variable expansion so maybe we should be using
// our own ExpandEnvVarSubstitutions() here instead.
cfgpath.Normalize( FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS );
cfgpath.Normalize();
wxString cfgname = cfgpath.GetFullPath();
size_t nitems = m_paths.size();
@@ -720,7 +716,7 @@ void FILENAME_RESOLVER::checkEnvVarPath( const wxString& aPath )
wxFileName tmpFN( ExpandEnvVarSubstitutions( lpath.m_Alias, m_project ), wxEmptyString );
wxUniChar psep = tmpFN.GetPathSeparator();
tmpFN.Normalize( FN_NORMALIZE_FLAGS );
tmpFN.Normalize();
if( !tmpFN.DirExists() )
return;
+4 -27
View File
@@ -144,33 +144,10 @@ bool COLOR4D::SetFromWxString( const wxString& aColorString )
}
wxString COLOR4D::ToCSSString() const
wxString COLOR4D::ToWxString( long flags ) const
{
wxColour c = ToColour();
wxString str;
const int red = c.Red();
const int green = c.Green();
const int blue = c.Blue();
const int alpha = c.Alpha();
if ( alpha == wxALPHA_OPAQUE )
{
str.Printf( wxT( "rgb(%d, %d, %d)" ), red, green, blue );
}
else // use rgba() form
{
wxString alpha_str = wxString::FromCDouble( alpha / 255.0, 3 );
// The wxC2S_CSS_SYNTAX is particularly sensitive to ','s (as it uses them for value
// delimiters), and wxWidgets is known to be buggy in this respect when dealing with
// Serbian and Russian locales (at least), so we enforce an extra level of safety.
alpha_str.Replace( wxT( "," ), wxT( "." ) );
str.Printf( wxT( "rgba(%d, %d, %d, %s)" ), red, green, blue, alpha_str );
}
return str;
return c.GetAsString( flags );
}
@@ -294,13 +271,13 @@ const bool operator<( const COLOR4D& lhs, const COLOR4D& rhs )
std::ostream &operator<<( std::ostream &aStream, COLOR4D const &aColor )
{
return aStream << aColor.ToCSSString();
return aStream << aColor.ToWxString( wxC2S_CSS_SYNTAX );
}
void to_json( nlohmann::json& aJson, const COLOR4D& aColor )
{
aJson = nlohmann::json( aColor.ToCSSString().ToStdString() );
aJson = nlohmann::json( aColor.ToWxString( wxC2S_CSS_SYNTAX ).ToStdString() );
}
+8 -6
View File
@@ -41,11 +41,14 @@
static std::mutex rng_mutex;
// Static rng and generators are used because the overhead of constant seeding is expensive
// We rely on the default non-arg constructor of basic_random_generator to provide a random seed.
// We use a separate rng object for cases where we want to control the basic_random_generator
// initial seed by calling SeedGenerator from unit tests and other special cases.
static boost::mt19937 rng;
static boost::uuids::basic_random_generator<boost::mt19937> randomGenerator;
// We break out the rng separately from the generator because we want to control seeding in cases like unit tests
#if BOOST_VERSION >= 106700
static boost::uuids::detail::random_provider seeder; // required to ensure the rng has a random initial seed
#else
static boost::uuids::detail::seed_rng seeder; // required to ensure the rng has a random initial seed
#endif
static boost::mt19937 rng( seeder );
static boost::uuids::basic_random_generator<boost::mt19937> randomGenerator( rng );
// These don't have the same performance penalty, but we might as well be consistent
static boost::uuids::string_generator stringGenerator;
@@ -276,7 +279,6 @@ void KIID::CreateNilUuids( bool aNil )
void KIID::SeedGenerator( unsigned int aSeed )
{
rng.seed( aSeed );
randomGenerator = boost::uuids::basic_random_generator<boost::mt19937>( rng );
}
-3
View File
@@ -465,10 +465,7 @@ bool KIWAY::PlayerClose( FRAME_T aFrameType, bool doForce )
return true;
if( frame->NonUserClose( doForce ) )
{
m_playerFrameId[aFrameType] = wxID_NONE;
return true;
}
return false;
}
+1 -14
View File
@@ -31,7 +31,6 @@
#include <typeinfo>
#include <wx/utils.h>
#include <wx/evtloop.h>
#include <wx/socket.h>
BEGIN_EVENT_TABLE( KIWAY_PLAYER, EDA_BASE_FRAME )
@@ -66,19 +65,7 @@ KIWAY_PLAYER::KIWAY_PLAYER( wxWindow* aParent, wxWindowID aId, const wxString& a
}
KIWAY_PLAYER::~KIWAY_PLAYER() throw() {
// socket server must be destructed before we complete
// destructing the frame or else we could crash
// as the socket server holds a reference to this frame
if( m_socketServer )
{
// ensure any event handling stops
m_socketServer->Notify( false );
delete m_socketServer;
}
}
KIWAY_PLAYER::~KIWAY_PLAYER() throw() {}
void KIWAY_PLAYER::KiwayMailIn( KIWAY_EXPRESS& aEvent )
+6 -6
View File
@@ -77,7 +77,7 @@ NUMERIC_EVALUATOR::~NUMERIC_EVALUATOR()
void NUMERIC_EVALUATOR::Clear()
{
delete[] m_token.token;
free( m_token.token );
m_token.token = nullptr;
m_token.input = nullptr;
m_parseError = true;
@@ -103,7 +103,7 @@ void NUMERIC_EVALUATOR::parseSetResult( double val )
{
// Naively printing this with %g produces "nan" on some platforms
// and "-nan(ind)" on others (e.g. MSVC). So force a "standard" string.
snprintf( m_token.token, m_token.outputLen, "%s", "NaN" );
snprintf( m_token.token, m_token.OutLen, "%s", "NaN" );
}
else
{
@@ -111,7 +111,7 @@ void NUMERIC_EVALUATOR::parseSetResult( double val )
// Warning: DO NOT use a format like %f or %g, because they can create issues.
// especially %g can generate an exponent, incompatible with UNIT_BINDER
// Use the optimized Double2Str
snprintf( m_token.token, m_token.outputLen, "%s", Double2Str( val ).c_str() );
snprintf( m_token.token, m_token.OutLen, "%s", Double2Str( val ).c_str() );
}
}
@@ -159,12 +159,12 @@ void NUMERIC_EVALUATOR::newString( const wxString& aString )
Clear();
m_originalText = aString;
m_token.token = reinterpret_cast<decltype( m_token.token )>( malloc( TokenStat::OutLen + 1 ) );
strcpy( m_token.token, "0" );
m_token.inputLen = aString.length();
m_token.outputLen = std::max<std::size_t>( 64, m_token.inputLen + 1 );
m_token.pos = 0;
m_token.input = aString.mb_str();
m_token.token = new char[m_token.outputLen]();
m_token.token[0] = '0';
m_parseFinished = false;
}
+9 -26
View File
@@ -249,7 +249,6 @@ COMPILER::~COMPILER()
if( m_tree )
{
freeTree( m_tree );
m_tree = nullptr;
}
// Allow explicit call to destructor
@@ -694,7 +693,6 @@ void COMPILER::freeTree( LIBEVAL::TREE_NODE *tree )
freeTree( tree->leaf[1] );
delete tree->uop;
tree->uop = nullptr;
}
@@ -1008,13 +1006,10 @@ bool COMPILER::generateUCode( UCODE* aCode, CONTEXT* aPreflightContext )
}
else
{
if( !m_unitResolver->GetSupportedUnitsMessage().empty() )
{
msg.Printf( _( "Missing units for '%s'| (%s)" ),
*node->value.str,
m_unitResolver->GetSupportedUnitsMessage() );
reportError( CST_CODEGEN, msg, node->srcPos );
}
msg.Printf( _( "Missing units for '%s'| (%s)" ),
*node->value.str,
m_unitResolver->GetSupportedUnitsMessage() );
reportError( CST_CODEGEN, msg, node->srcPos );
value = DoubleValueFromString( EDA_UNITS::UNSCALED, *node->value.str );
}
@@ -1043,7 +1038,7 @@ bool COMPILER::generateUCode( UCODE* aCode, CONTEXT* aPreflightContext )
reportError( CST_CODEGEN, msg, node->srcPos - (int) node->value.str->length() );
}
node->SetUop( TR_UOP_PUSH_VAR, std::move( vref ) );
node->SetUop( TR_UOP_PUSH_VALUE, std::move( vref ) );
node->isTerminal = true;
break;
}
@@ -1095,12 +1090,10 @@ void UOP::Exec( CONTEXT* ctx )
{
case TR_UOP_PUSH_VAR:
{
VALUE* value = nullptr;
VALUE* value = ctx->AllocValue();
if( m_ref )
value = ctx->StoreValue( m_ref->GetValue( ctx ) );
else
value = ctx->AllocValue();
value->Set( m_ref->GetValue( ctx ) );
ctx->Push( value );
}
@@ -1169,20 +1162,10 @@ void UOP::Exec( CONTEXT* ctx )
result = arg1Value > arg2Value ? 1 : 0;
break;
case TR_OP_EQUAL:
if( !arg1 || !arg2 )
result = arg1 == arg2 ? 1 : 0;
else if( arg2->GetType() == VT_UNDEFINED )
result = arg2->EqualTo( ctx, arg1 ) ? 1 : 0;
else
result = arg1->EqualTo( ctx, arg2 ) ? 1 : 0;
result = arg1 && arg2 && arg1->EqualTo( ctx, arg2 ) ? 1 : 0;
break;
case TR_OP_NOT_EQUAL:
if( !arg1 || !arg2 )
result = arg1 != arg2 ? 1 : 0;
else if( arg2->GetType() == VT_UNDEFINED )
result = arg2->NotEqualTo( ctx, arg1 ) ? 1 : 0;
else
result = arg1->NotEqualTo( ctx, arg2 ) ? 1 : 0;
result = arg1 && arg2 && arg1->NotEqualTo( ctx, arg2 ) ? 1 : 0;
break;
case TR_OP_BOOL_AND:
result = arg1Value != 0.0 && arg2Value != 0.0 ? 1 : 0;
+2 -3
View File
@@ -8635,7 +8635,7 @@ const char* const newstroke_font[] =
"F^K[KFYFY[K[",
"F^K[KFYFY[K[",
"F^K[KFYFY[K[",
/* // Letterlike Symbols (2100-2125) */
/* // Letterlike Symbols (2100-214F) */
"F^K[KFYFY[K[", /* U+2100 */
"F^K[KFYFY[K[",
"F^K[KFYFY[K[",
@@ -8674,8 +8674,7 @@ const char* const newstroke_font[] =
"F^K[KFYFY[K[",
"F^K[KFYFY[K[",
"F^K[KFYFY[K[",
"F^J[O[OWMVKTJQJLKIMGPFTFWGYIZLZQYTWVUWU[Z[",
/* // Letterlike Symbols (2127-214F) */
"F^K[KFYFY[K[",
"F^K[KFYFY[K[",
"F^K[KFYFY[K[",
"F^K[KFYFY[K[",
+17 -55
View File
@@ -38,7 +38,6 @@
#include <macros.h>
#include <trigo.h>
#include <basic_gal.h>
#include <plotters/plotters_pslike.h>
@@ -838,7 +837,6 @@ void PDF_PLOTTER::Text( const wxPoint& aPos,
// be pixel-accurate, but it doesn't matter for searching.
int render_mode = 3; // invisible
wxPoint pos( aPos );
const char *fontname = aItalic ? ( aBold ? "/KicadFontBI" : "/KicadFontI" )
: ( aBold ? "/KicadFontB" : "/KicadFont" );
@@ -846,64 +844,28 @@ void PDF_PLOTTER::Text( const wxPoint& aPos,
double ctm_a, ctm_b, ctm_c, ctm_d, ctm_e, ctm_f;
double wideningFactor, heightFactor;
computeTextParameters( aPos, aText, aOrient, aSize, m_plotMirror, aH_justify,
aV_justify, aWidth, aItalic, aBold,
&wideningFactor, &ctm_a, &ctm_b, &ctm_c,
&ctm_d, &ctm_e, &ctm_f, &heightFactor );
SetColor( aColor );
SetCurrentLineWidth( aWidth, aData );
const auto& font = basic_gal.GetStrokeFont();
VECTOR2D fontSize( aSize.x, aSize.y );
double penWidth( aWidth );
VECTOR2D extents = font.ComputeStringBoundaryLimits( aText, fontSize, penWidth );
/* We use the full CTM instead of the text matrix because the same
coordinate system will be used for the overlining. Also the %f
for the trig part of the matrix to avoid %g going in exponential
format (which is not supported) */
fprintf( workFile, "q %f %f %f %f %g %g cm BT %s %g Tf %d Tr %g Tz ",
ctm_a, ctm_b, ctm_c, ctm_d, ctm_e, ctm_f,
fontname, heightFactor, render_mode, wideningFactor * 100 );
wxPoint box_x( KiROUND( extents.x ), 0 );
wxPoint box_y( 0, KiROUND( extents.y ) );
// The text must be escaped correctly
std:: string txt_pdf = encodeStringForPlotter( aText );
fprintf( workFile, "%s Tj ET\n", txt_pdf.c_str() );
RotatePoint( &box_x, aOrient );
RotatePoint( &box_y, aOrient );
if( aH_justify == GR_TEXT_HJUSTIFY_CENTER )
pos -= box_x / 2;
else if( aH_justify == GR_TEXT_HJUSTIFY_RIGHT )
pos -= box_x;
if( aV_justify == GR_TEXT_VJUSTIFY_CENTER )
pos += box_y / 2;
else if( aV_justify == GR_TEXT_VJUSTIFY_TOP )
pos += box_y;
wxStringTokenizer str_tok( aText, " ", wxTOKEN_RET_DELIMS );
while( str_tok.HasMoreTokens() )
{
wxString word = str_tok.GetNextToken();
computeTextParameters( pos, word, aOrient, aSize, m_plotMirror, GR_TEXT_HJUSTIFY_LEFT,
GR_TEXT_VJUSTIFY_BOTTOM, aWidth, aItalic, aBold, &wideningFactor, &ctm_a,
&ctm_b, &ctm_c, &ctm_d, &ctm_e, &ctm_f, &heightFactor );
// Extract the changed width and rotate by the orientation to get the offset for the
// next word
extents = font.ComputeStringBoundaryLimits( word, fontSize, penWidth );
wxPoint bbox( KiROUND( extents.x ), 0 );
RotatePoint( &bbox, aOrient );
pos += bbox;
// Don't try to output a blank string
if( word.Trim( false ).Trim( true ).empty() )
continue;
/* We use the full CTM instead of the text matrix because the same
coordinate system will be used for the overlining. Also the %f
for the trig part of the matrix to avoid %g going in exponential
format (which is not supported) */
fprintf( workFile, "q %f %f %f %f %g %g cm BT %s %g Tf %d Tr %g Tz ",
ctm_a, ctm_b, ctm_c, ctm_d, ctm_e, ctm_f,
fontname, heightFactor, render_mode, wideningFactor * 100 );
std::string txt_pdf = encodeStringForPlotter( word );
fprintf( workFile, "%s Tj ET\n", txt_pdf.c_str() );
// Restore the CTM
fputs( "Q\n", workFile );
}
// Restore the CTM
fputs( "Q\n", workFile );
// Plot the stroked text (if requested)
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth,
@@ -84,7 +84,6 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
drawList.SetSheetCount( aSheetCount );
drawList.SetFileName( fn.GetFullName() ); // Print only the short filename
drawList.SetSheetName( aSheetDesc );
drawList.SetSheetLayer( plotter->RenderSettings()->GetLayerName() );
drawList.SetProject( aProject );
drawList.SetIsFirstPage( aIsFirstPage );
+2 -2
View File
@@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2014-2021 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
@@ -273,7 +273,7 @@ const wxString PROJECT::AbsolutePath( const wxString& aFileName ) const
if( !fn.IsAbsolute() )
{
wxString pro_dir = wxPathOnly( GetProjectFullName() );
fn.Normalize( FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS, pro_dir );
fn.Normalize( wxPATH_NORM_ALL, pro_dir );
}
return fn.GetFullPath();
+1 -1
View File
@@ -466,7 +466,7 @@ void RC_TREE_MODEL::DeleteCurrentItem( bool aDeep )
void RC_TREE_MODEL::DeleteItems( bool aCurrentOnly, bool aIncludeExclusions, bool aDeep )
{
RC_TREE_NODE* current_node = m_view ? ToNode( m_view->GetCurrentItem() ) : nullptr;
RC_TREE_NODE* current_node = ToNode( m_view->GetCurrentItem() );
const std::shared_ptr<RC_ITEM> current_item = current_node ? current_node->m_RcItem : nullptr;
/// Keep a vector of elements to free after wxWidgets is definitely done accessing them
+15 -21
View File
@@ -79,23 +79,18 @@ void SCINTILLA_TRICKS::onThemeChanged( wxSysColourChangedEvent &aEvent )
void SCINTILLA_TRICKS::setupStyles()
{
wxTextCtrl dummy( m_te->GetParent(), wxID_ANY );
wxColour foreground = dummy.GetForegroundColour();
wxColour background = dummy.GetBackgroundColour();
KIGFX::COLOR4D highlight = wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT );
KIGFX::COLOR4D highlightText = wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHTTEXT );
wxTextCtrl dummy( m_te->GetParent(), wxID_ANY );
wxColour foreground = dummy.GetForegroundColour();
wxColour background = dummy.GetBackgroundColour();
wxColour highlight = wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT );
wxColour highlightText = wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHTTEXT );
m_te->StyleSetForeground( wxSTC_STYLE_DEFAULT, foreground );
m_te->StyleSetBackground( wxSTC_STYLE_DEFAULT, background );
m_te->StyleClearAll();
// Scintilla doesn't handle alpha channel, which at least OSX uses in some highlight colours,
// such as "graphite".
highlight = highlight.Mix( background, highlight.a ).WithAlpha( 1.0 );
highlightText = highlightText.Mix( background, highlightText.a ).WithAlpha( 1.0 );
m_te->SetSelForeground( true, highlightText.ToColour() );
m_te->SetSelBackground( true, highlight.ToColour() );
m_te->SetSelForeground( true, highlightText );
m_te->SetSelBackground( true, highlight );
m_te->SetCaretForeground( foreground );
if( !m_singleLine )
@@ -110,13 +105,14 @@ void SCINTILLA_TRICKS::setupStyles()
m_te->SetTabWidth( 4 );
}
// Set up the brace highlighting. Scintilla doesn't handle alpha, so we construct our own
// 20% wash by blending with the background.
KIGFX::COLOR4D braceText = foreground;
KIGFX::COLOR4D braceHighlight = braceText.Mix( background, 0.2 );
m_te->StyleSetForeground( wxSTC_STYLE_BRACELIGHT, highlightText.ToColour() );
m_te->StyleSetBackground( wxSTC_STYLE_BRACELIGHT, braceHighlight.ToColour() );
// Set up the brace highlighting
unsigned char r = highlight.Red();
unsigned char g = highlight.Green();
unsigned char b = highlight.Blue();
wxColour::MakeGrey( &r, &g, &b );
highlight.Set( r, g, b );
m_te->StyleSetForeground( wxSTC_STYLE_BRACELIGHT, highlightText );
m_te->StyleSetBackground( wxSTC_STYLE_BRACELIGHT, highlight );
m_te->StyleSetForeground( wxSTC_STYLE_BRACEBAD, *wxRED );
}
@@ -232,9 +228,7 @@ void SCINTILLA_TRICKS::onCharHook( wxKeyEvent& aEvent )
str = data.GetText();
ConvertSmartQuotesAndDashes( &str );
m_te->BeginUndoAction();
m_te->AddText( str );
m_te->EndUndoAction();
}
wxTheClipboard->Close();
+1 -1
View File
@@ -230,7 +230,7 @@ COLOR_SETTINGS::COLOR_SETTINGS( const wxString& aFilename, bool aAbsolutePath )
// Fix LAYER_VIA_HOLES color - before version 2, this setting had no effect
nlohmann::json::json_pointer ptr( "/board/via_hole");
( *m_internals )[ptr] = COLOR4D( 0.5, 0.4, 0, 0.8 ).ToCSSString();
( *m_internals )[ptr] = COLOR4D( 0.5, 0.4, 0, 0.8 ).ToWxString( wxC2S_CSS_SYNTAX );
return true;
} );
-3
View File
@@ -22,7 +22,6 @@
#include <settings/json_settings_internals.h>
#include <settings/nested_settings.h>
#include <locale_io.h>
NESTED_SETTINGS::NESTED_SETTINGS( const std::string& aName, int aVersion, JSON_SETTINGS* aParent,
const std::string& aPath ) :
@@ -117,8 +116,6 @@ bool NESTED_SETTINGS::SaveToFile( const wxString& aDirectory, bool aForce )
if( !m_parent )
return false;
LOCALE_IO dummy;
try
{
bool modified = Store();
+15 -2
View File
@@ -145,6 +145,13 @@ wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext )
wxString converted;
std::vector<bool> braceStack; // true == formatting construct
auto hasFormattingPrefix =
[&]()
{
static wxString prefixes = wxT( "~_^" );
return !converted.IsEmpty() && prefixes.Find( converted.Last() ) >= 0;
};
converted.reserve( aSource.length() );
for( wxUniChar c: aSource )
@@ -160,7 +167,9 @@ wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext )
}
else if( aContext == CTX_LIBID )
{
if( c == '/' )
if( c == '{' && !hasFormattingPrefix() )
converted += wxT( "{brace}" );
else if( c == '/' )
converted += wxT( "{slash}" );
else if( c == '\\' )
converted += wxT( "{backslash}" );
@@ -193,7 +202,9 @@ wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext )
}
else if( aContext == CTX_FILENAME )
{
if( c == '/' )
if( c == '{' )
converted += wxT( "{brace}" );
else if( c == '/' )
converted += wxT( "{slash}" );
else if( c == '\\' )
converted += wxT( "{backslash}" );
@@ -218,6 +229,8 @@ wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext )
{
if( c == ' ' )
converted += wxT( "{space}" );
else if( c == '{' )
converted += wxT( "{brace}" );
else
converted += c;
}
+40 -9
View File
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2015-2022 KiCad Developers, see AUTHORS.TXT for contributors.
* Copyright (C) 2015-2020 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,9 +35,18 @@ using namespace TFIELD_T;
#define FOOTPRINT_CANONICAL "Footprint"
#define DATASHEET_CANONICAL "Datasheet"
const wxString TEMPLATE_FIELDNAME::GetDefaultFieldName( int aFieldNdx, bool aTranslateForHI )
static std::mutex s_defaultFieldMutex;
const wxString TEMPLATE_FIELDNAME::GetDefaultFieldName( int aFieldNdx, bool aTranslate )
{
if( !aTranslateForHI )
static void* locale = nullptr;
static wxString referenceDefault;
static wxString valueDefault;
static wxString footprintDefault;
static wxString datasheetDefault;
static wxString fieldDefault;
if( !aTranslate )
{
switch( aFieldNdx )
{
@@ -45,20 +54,42 @@ const wxString TEMPLATE_FIELDNAME::GetDefaultFieldName( int aFieldNdx, bool aTra
case VALUE_FIELD: return VALUE_CANONICAL; // The symbol value
case FOOTPRINT_FIELD: return FOOTPRINT_CANONICAL; // The footprint for use with Pcbnew
case DATASHEET_FIELD: return DATASHEET_CANONICAL; // Link to a datasheet for symbol
default: return wxString::Format( wxT( "Field%d" ), aFieldNdx );
}
}
// Mutex protection is needed so that multiple loader threads don't write to the static
// variables at once
std::lock_guard<std::mutex> lock( s_defaultFieldMutex );
// Fetching translations can take a surprising amount of time when loading libraries,
// so only do it when necessary.
if( Pgm().GetLocale() != locale )
{
referenceDefault = _( REFERENCE_CANONICAL );
valueDefault = _( VALUE_CANONICAL );
footprintDefault = _( FOOTPRINT_CANONICAL );
datasheetDefault = _( DATASHEET_CANONICAL );
fieldDefault = _( "Field%d" );
locale = Pgm().GetLocale();
}
// Fixed values for the mandatory fields
switch( aFieldNdx )
{
case REFERENCE_FIELD: return _( REFERENCE_CANONICAL ); // The symbol reference, R1, C1, etc.
case VALUE_FIELD: return _( VALUE_CANONICAL ); // The symbol value
case FOOTPRINT_FIELD: return _( FOOTPRINT_CANONICAL ); // The footprint for use with Pcbnew
case DATASHEET_FIELD: return _( DATASHEET_CANONICAL ); // Link to a datasheet for symbol
default: return wxString::Format( _( "Field%d" ), aFieldNdx );
case REFERENCE_FIELD: return referenceDefault; // The symbol reference, R1, C1, etc.
case VALUE_FIELD: return valueDefault; // The symbol value
case FOOTPRINT_FIELD: return footprintDefault; // The footprint for use with Pcbnew
case DATASHEET_FIELD: return datasheetDefault; // Link to a datasheet for symbol
default: return wxString::Format( fieldDefault, aFieldNdx );
}
}
#undef REFERENCE_CANONICAL
#undef VALUE_CANONICAL
#undef FOOTPRINT_CANONICAL
#undef DATASHEET_CANONICAL
void TEMPLATE_FIELDNAME::Format( OUTPUTFORMATTER* out, int nestLevel ) const
{
+1 -7
View File
@@ -91,7 +91,6 @@ void TITLE_BLOCK::GetContextualTextVars( wxArrayString* aVars )
bool TITLE_BLOCK::TextVarResolver( wxString* aToken, const PROJECT* aProject ) const
{
bool tokenUpdated = false;
wxString originalToken = *aToken;
if( aToken->IsSameAs( wxT( "ISSUE_DATE" ) ) )
{
@@ -147,12 +146,7 @@ bool TITLE_BLOCK::TextVarResolver( wxString* aToken, const PROJECT* aProject ) c
if( tokenUpdated )
{
*aToken = ExpandTextVars( *aToken, aProject );
// This is the default fallback, so don't claim we resolved it
if( *aToken == wxT( "${" ) + originalToken + wxT( "}" ) )
return false;
*aToken = ExpandTextVars( *aToken, aProject );
return true;
}
-7
View File
@@ -242,13 +242,6 @@ bool TOOL_EVENT::IsMoveTool() const
}
bool TOOL_EVENT::IsEditorTool() const
{
return ( m_commandStr
&& m_commandStr.value().find( "InteractiveEdit" ) != GetCommandStr()->npos );
}
bool TOOL_EVENT::IsSimulator() const
{
return( m_commandStr.is_initialized()
+2 -5
View File
@@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2020-2021 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
@@ -117,11 +117,8 @@ bool TOOLS_HOLDER::IsCurrentTool( const TOOL_ACTION& aAction ) const
void TOOLS_HOLDER::ShowChangedLanguage()
{
if( !GetToolManager() )
return;
std::string actionName = CurrentToolName();
TOOL_ACTION* action = GetToolManager()->GetActionManager()->FindAction( actionName );
TOOL_ACTION* action = m_toolManager->GetActionManager()->FindAction( actionName );
if( action )
DisplayToolMsg( action->GetLabel() );
-1
View File
@@ -39,7 +39,6 @@ const wxChar* const kicadTraceCoroutineStack = wxT( "KICAD_COROUTINE_STACK" );
const wxChar* const traceSchLibMem = wxT( "KICAD_SCH_LIB_MEM" );
const wxChar* const traceFindItem = wxT( "KICAD_FIND_ITEM" );
const wxChar* const traceSchLegacyPlugin = wxT( "KICAD_SCH_LEGACY_PLUGIN" );
const wxChar* const traceSchPlugin = wxT( "KICAD_SCH_PLUGIN" );
const wxChar* const traceGedaPcbPlugin = wxT( "KICAD_GEDA_PLUGIN" );
const wxChar* const traceKicadPcbPlugin = wxT( "KICAD_PCB_PLUGIN" );
const wxChar* const tracePrinting = wxT( "KICAD_PRINT" );
+1 -1
View File
@@ -148,7 +148,7 @@ void VIEW_GROUP::ViewDraw( int aLayer, VIEW* aView ) const
{
int layer = layers[i];
if( IsZoneFillLayer( layer ) )
if( IsZoneLayer( layer ) )
layer = layer - LAYER_ZONE_START;
bool draw = aView->IsLayerVisible( layer );
+17 -34
View File
@@ -248,7 +248,7 @@ void WX_VIEW_CONTROLS::onMotion( wxMouseEvent& aEvent )
{
if( !justWarped )
{
KIPLATFORM::UI::WarpPointer( m_parentPanel, x + warpX, y + warpY );
m_parentPanel->WarpPointer( x + warpX, y + warpY );
m_dragStartPoint += VECTOR2D( warpX, warpY );
justWarped = true;
}
@@ -288,7 +288,7 @@ void WX_VIEW_CONTROLS::onMotion( wxMouseEvent& aEvent )
{
if( !justWarped )
{
KIPLATFORM::UI::WarpPointer( m_parentPanel, x, y + warpY );
m_parentPanel->WarpPointer( x, y + warpY );
m_dragStartPoint += VECTOR2D( 0, warpY );
justWarped = true;
}
@@ -353,7 +353,7 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent )
// Refresh the zoom level and mouse position on message panel
// (mouse position has not changed, only the zoom level has changed):
refreshMouse( true );
refreshMouse();
}
else
{
@@ -371,7 +371,7 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent )
VECTOR2D delta( scrollX, scrollY );
m_view->SetCenter( m_view->GetCenter() + delta );
refreshMouse( true );
refreshMouse();
}
// Do not skip this event, otherwise wxWidgets will fire
@@ -507,18 +507,6 @@ void WX_VIEW_CONTROLS::onTimer( wxTimerEvent& aEvent )
return;
}
#ifdef __WXMSW__
// Hackfix: It's possible for the mouse to leave the canvas
// without triggering any leave events on windows
// Use a MSW only wx function
if( !m_parentPanel->IsMouseInWindow() )
{
m_panTimer.Stop();
m_state = IDLE;
return;
}
#endif
if( !m_parentPanel->HasFocus() )
break;
@@ -545,7 +533,7 @@ void WX_VIEW_CONTROLS::onTimer( wxTimerEvent& aEvent )
dir = m_view->ToWorld( dir, false );
m_view->SetCenter( m_view->GetCenter() + dir );
refreshMouse( true );
refreshMouse();
}
break;
@@ -753,22 +741,20 @@ void WX_VIEW_CONTROLS::WarpCursor( const VECTOR2D& aPosition, bool aWorldCoordin
if( aWarpView )
{
m_view->SetCenter( clampedPosition );
KIPLATFORM::UI::WarpPointer( m_parentPanel, screenSize.x / 2, screenSize.y / 2 );
m_parentPanel->WarpPointer( screenSize.x / 2, screenSize.y / 2 );
}
}
else
{
KIPLATFORM::UI::WarpPointer( m_parentPanel, screenPos.x, screenPos.y );
m_parentPanel->WarpPointer( screenPos.x, screenPos.y );
}
}
else
{
KIPLATFORM::UI::WarpPointer( m_parentPanel, aPosition.x, aPosition.y );
m_parentPanel->WarpPointer( aPosition.x, aPosition.y );
}
// If we are not refreshing because of mouse movement, don't set the modifiers
// because we are refreshing for keyboard movement, which uses the same modifiers for other actions
refreshMouse( m_updateCursor );
refreshMouse();
}
@@ -780,7 +766,7 @@ void WX_VIEW_CONTROLS::CenterOnCursor() const
if( GetMousePosition( false ) != screenCenter )
{
m_view->SetCenter( GetCursorPosition() );
KIPLATFORM::UI::WarpPointer( m_parentPanel, KiROUND( screenSize.x / 2 ), KiROUND( screenSize.y / 2 ) );
m_parentPanel->WarpPointer( KiROUND( screenSize.x / 2 ), KiROUND( screenSize.y / 2 ) );
}
}
@@ -891,12 +877,12 @@ void WX_VIEW_CONTROLS::handleCursorCapture( int x, int y )
}
if( warp )
KIPLATFORM::UI::WarpPointer( m_parentPanel, x, y );
m_parentPanel->WarpPointer( x, y );
}
}
void WX_VIEW_CONTROLS::refreshMouse( bool aSetModifiers )
void WX_VIEW_CONTROLS::refreshMouse()
{
// Notify tools that the cursor position has changed in the world coordinates
wxMouseEvent moveEvent( EVT_REFRESH_MOUSE );
@@ -904,13 +890,10 @@ void WX_VIEW_CONTROLS::refreshMouse( bool aSetModifiers )
moveEvent.SetX( msp.x );
moveEvent.SetY( msp.y );
if( aSetModifiers )
{
// Set the modifiers state
moveEvent.SetControlDown( wxGetKeyState( WXK_CONTROL ) );
moveEvent.SetShiftDown( wxGetKeyState( WXK_SHIFT ) );
moveEvent.SetAltDown( wxGetKeyState( WXK_ALT ) );
}
// Set the modifiers state
moveEvent.SetControlDown( wxGetKeyState( WXK_CONTROL ) );
moveEvent.SetShiftDown( wxGetKeyState( WXK_SHIFT ) );
moveEvent.SetAltDown( wxGetKeyState( WXK_ALT ) );
m_cursorPos = GetClampedCoords( m_view->ToWorld( VECTOR2D( msp.x, msp.y ) ) );
wxPostEvent( m_parentPanel, moveEvent );
@@ -959,7 +942,7 @@ void WX_VIEW_CONTROLS::UpdateScrollbars()
// Trigger a mouse refresh to get the canvas update in GTK (re-draws the scrollbars).
// Note that this causes an infinite loop on OSX and Windows (in certain cases) as it
// generates a paint event.
refreshMouse( false );
refreshMouse();
#endif
}
}
+1 -1
View File
@@ -44,7 +44,7 @@ BITMAP_TOGGLE::BITMAP_TOGGLE( wxWindow *aParent, wxWindowID aId, const wxBitmap&
const wxBitmap& bitmap = aChecked ? m_checked_bitmap : m_unchecked_bitmap;
m_bitmap = new wxStaticBitmap( this, aId, bitmap, wxDefaultPosition );
m_bitmap = new wxStaticBitmap( this, aId, bitmap, wxDefaultPosition, bitmap.GetSize() );
sizer->Add( m_bitmap, 0, 0 );
+1 -1
View File
@@ -146,7 +146,7 @@ void GRID_CELL_COLOR_SELECTOR::Create( wxWindow* aParent, wxWindowID aId,
wxString GRID_CELL_COLOR_SELECTOR::GetValue() const
{
return m_value.ToCSSString();
return m_value.ToWxString( wxC2S_CSS_SYNTAX );
}
+17 -25
View File
@@ -237,9 +237,7 @@ bool PAGED_DIALOG::TransferDataToWindow()
}
}
lastPageIndex = std::max( 0, lastPageIndex );
m_treebook->ChangeSelection( lastPageIndex );
UpdateResetButton( lastPageIndex );
m_treebook->SetSelection( (unsigned) std::max( 0, lastPageIndex ) );
return true;
}
@@ -362,17 +360,18 @@ void PAGED_DIALOG::OnUpdateUI( wxUpdateUIEvent& event )
}
void PAGED_DIALOG::UpdateResetButton( int aPage )
void PAGED_DIALOG::OnPageChange( wxBookCtrlEvent& event )
{
size_t page = event.GetSelection();
// Enable the reset button only if the page is re-settable
if( m_resetButton )
{
if( auto panel = dynamic_cast<RESETTABLE_PANEL*>( m_treebook->GetPage( aPage ) ) )
if( auto panel = dynamic_cast<RESETTABLE_PANEL*>( m_treebook->GetPage( page ) ) )
{
m_resetButton->SetLabel( wxString::Format( _( "Reset %s to Defaults" ),
m_treebook->GetPageText( aPage ) ) );
m_resetButton->SetToolTip( panel->GetHelpTextAtPoint( wxPoint( -INT_MAX, INT_MAX ),
wxHelpEvent::Origin_Unknown ) );
m_treebook->GetPageText( page ) ) );
m_resetButton->SetToolTip( panel->GetResetTooltip() );
m_resetButton->Enable( true );
}
else
@@ -383,27 +382,20 @@ void PAGED_DIALOG::UpdateResetButton( int aPage )
}
}
}
void PAGED_DIALOG::OnPageChange( wxBookCtrlEvent& event )
{
int page = event.GetSelection();
// Use the first sub-page when a tree level node is selected.
if( m_treebook->GetCurrentPage()->GetChildren().IsEmpty() )
// Work around an OSX bug where the wxGrid children don't get placed correctly until
// the first resize event
#ifdef __WXMAC__
if( page + 1 <= m_macHack.size() && m_macHack[ page ] )
{
unsigned next = page + 1;
wxSize pageSize = m_treebook->GetPage( page )->GetSize();
pageSize.x -= 5;
pageSize.y += 2;
if( next < m_treebook->GetPageCount() )
m_treebook->ChangeSelection( next );
m_treebook->GetPage( page )->SetSize( pageSize );
m_macHack[ page ] = false;
}
UpdateResetButton( page );
wxSizeEvent evt( wxDefaultSize );
wxQueueEvent( m_treebook, evt.Clone() );
#endif
}
+12 -80
View File
@@ -60,9 +60,8 @@
#define CVPCB_MAINFRAME_NAME wxT( "CvpcbFrame" )
CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, _( "Assign Footprints" ), wxDefaultPosition,
wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, CVPCB_MAINFRAME_NAME ),
m_viewerPendingUpdate( false )
KIWAY_PLAYER( aKiway, aParent, FRAME_CVPCB, _( "Assign Footprints" ), wxDefaultPosition,
wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, CVPCB_MAINFRAME_NAME )
{
m_symbolsListBox = nullptr;
m_footprintListBox = nullptr;
@@ -210,17 +209,12 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( KIWAY* aKiway, wxWindow* aParent ) :
// Start the main processing loop
m_toolManager->InvokeTool( "cvpcb.Control" );
m_filterTimer->StartOnce( 100 );
KIPLATFORM::APP::SetShutdownBlockReason( this, _( "Symbol to footprint changes are unsaved" ) );
}
CVPCB_MAINFRAME::~CVPCB_MAINFRAME()
{
// Stop the timer during destruction early to avoid potential race conditions (that do happen)
m_filterTimer->Stop();
// Shutdown all running tools
if( m_toolManager )
m_toolManager->ShutdownAllTools();
@@ -376,9 +370,6 @@ void CVPCB_MAINFRAME::setupEventHandlers()
// Attach the events to the tool dispatcher
Bind( wxEVT_CHAR, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
Bind( wxEVT_CHAR_HOOK, &TOOL_DISPATCHER::DispatchWxEvent, m_toolDispatcher );
m_filterTimer = new wxTimer( this );
Bind( wxEVT_TIMER, &CVPCB_MAINFRAME::onTextFilterChangedTimer, this, m_filterTimer->GetId() );
}
@@ -429,37 +420,11 @@ void CVPCB_MAINFRAME::OnEnterFilteringText( wxCommandEvent& aEvent )
// If the option FOOTPRINTS_LISTBOX::FILTERING_BY_TEXT_PATTERN is set, update the list
// of available footprints which match the filter
m_filterTimer->StartOnce( 200 );
}
void CVPCB_MAINFRAME::onTextFilterChangedTimer( wxTimerEvent& aEvent )
{
// GTK loses the search-control's focus on a Refresh event, so we record the focus and
// insertion point here and then restore them at the end.
bool searchCtrlHasFocus = m_tcFilterString->HasFocus();
long pos = m_tcFilterString->GetInsertionPoint();
COMPONENT* symbol = GetSelectedComponent();
wxString libraryName = m_librariesListBox->GetSelectedLibrary();
m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, symbol,
m_tcFilterString->GetValue(), m_filteringOptions );
if( symbol && symbol->GetFPID().IsValid() )
m_footprintListBox->SetSelectedFootprint( symbol->GetFPID() );
else if( m_footprintListBox->GetSelection() >= 0 )
m_footprintListBox->SetSelection( m_footprintListBox->GetSelection(), false );
RefreshFootprintViewer();
DisplayStatus();
if( searchCtrlHasFocus )
{
m_tcFilterString->SetFocus();
m_tcFilterString->SetInsertionPoint( pos );
}
wxListEvent l_event;
OnSelectComponent( l_event );
m_tcFilterString->SetFocus();
m_tcFilterString->SetInsertionPoint( pos );
}
@@ -468,58 +433,22 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
if( m_skipComponentSelect )
return;
wxString libraryName;
COMPONENT* symbol = GetSelectedComponent();
wxString libraryName = m_librariesListBox->GetSelectedLibrary();
libraryName = m_librariesListBox->GetSelectedLibrary();
m_footprintListBox->SetFootprints( *m_FootprintsList, libraryName, symbol,
m_tcFilterString->GetValue(), m_filteringOptions );
if( symbol && symbol->GetFPID().IsValid() )
m_footprintListBox->SetSelectedFootprint( symbol->GetFPID() );
else if( m_footprintListBox->GetSelection() >= 0 )
else
m_footprintListBox->SetSelection( m_footprintListBox->GetSelection(), false );
RefreshFootprintViewer();
refreshAfterSymbolSearch( symbol );
}
void CVPCB_MAINFRAME::RefreshFootprintViewer()
{
if( GetFootprintViewerFrame() && !m_viewerPendingUpdate )
{
Bind( wxEVT_IDLE, &CVPCB_MAINFRAME::updateFootprintViewerOnIdle, this );
m_viewerPendingUpdate = true;
}
}
void CVPCB_MAINFRAME::updateFootprintViewerOnIdle( wxIdleEvent& aEvent )
{
Unbind( wxEVT_IDLE, &CVPCB_MAINFRAME::updateFootprintViewerOnIdle, this );
m_viewerPendingUpdate = false;
// On some plateforms (OSX) the focus is lost when the viewers (fp and 3D viewers)
// are opened and refreshed when a new footprint is selected.
// If the listbox has the focus before selecting a new footprint, it will be forced
// after selection.
bool footprintListHasFocus = m_footprintListBox->HasFocus();
bool symbolListHasFocus = m_symbolsListBox->HasFocus();
// If the footprint view window is displayed, update the footprint.
if( GetFootprintViewerFrame() )
GetToolManager()->RunAction( CVPCB_ACTIONS::showFootprintViewer, true );
DisplayStatus();
if( footprintListHasFocus )
m_footprintListBox->SetFocus();
else if( symbolListHasFocus )
m_symbolsListBox->SetFocus();
}
void CVPCB_MAINFRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
{
EDA_BASE_FRAME::LoadSettings( aCfg );
@@ -723,6 +652,9 @@ void CVPCB_MAINFRAME::refreshAfterSymbolSearch( COMPONENT* aSymbol )
break;
}
}
if( GetFootprintViewerFrame() )
m_toolManager->RunAction( CVPCB_ACTIONS::showFootprintViewer, true );
}
SendMessageToEESCHEMA();
+3 -14
View File
@@ -330,8 +330,6 @@ public:
*/
wxString GetSelectedFootprint();
void RefreshFootprintViewer();
void SetStatusText( const wxString& aText, int aNumber = 0 ) override;
protected:
@@ -353,12 +351,6 @@ private:
*/
void setupEventHandlers();
void onTextFilterChanged( wxCommandEvent& event );
void updateFootprintViewerOnIdle( wxIdleEvent& aEvent );
void onTextFilterChangedTimer( wxTimerEvent& aEvent );
/**
* Read the .equ files and populate the list of equivalents.
*
@@ -406,12 +398,9 @@ private:
ACTION_MENU* m_footprintContextMenu;
ACTION_MENU* m_symbolsContextMenu;
CVPCB_UNDO_REDO_LIST m_undoList;
CVPCB_UNDO_REDO_LIST m_redoList;
wxTimer* m_filterTimer;
bool m_viewerPendingUpdate;
// Undo/Redo item lists
CVPCB_UNDO_REDO_LIST m_undoList;
CVPCB_UNDO_REDO_LIST m_redoList;
};
#endif //#ifndef _CVPCB_MAINFRAME_H_
+13 -18
View File
@@ -62,15 +62,13 @@ BEGIN_EVENT_TABLE( DISPLAY_FOOTPRINTS_FRAME, PCB_BASE_FRAME )
EVT_CLOSE( DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow )
EVT_CHOICE( ID_ON_ZOOM_SELECT, DISPLAY_FOOTPRINTS_FRAME::OnSelectZoom )
EVT_CHOICE( ID_ON_GRID_SELECT, DISPLAY_FOOTPRINTS_FRAME::OnSelectGrid )
EVT_MENU( ID_GRID_SETTINGS, DISPLAY_FOOTPRINTS_FRAME::OnGridSettings )
END_EVENT_TABLE()
DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
PCB_BASE_FRAME( aKiway, aParent, FRAME_CVPCB_DISPLAY, _( "Footprint Viewer" ),
wxDefaultPosition, wxDefaultSize,
KICAD_DEFAULT_DRAWFRAME_STYLE, FOOTPRINTVIEWER_FRAME_NAME ),
m_currentComp( nullptr )
PCB_BASE_FRAME( aKiway, aParent, FRAME_CVPCB_DISPLAY, _( "Footprint Viewer" ),
wxDefaultPosition, wxDefaultSize,
KICAD_DEFAULT_DRAWFRAME_STYLE, FOOTPRINTVIEWER_FRAME_NAME )
{
// Give an icon
wxIcon icon;
@@ -453,21 +451,22 @@ FOOTPRINT* DISPLAY_FOOTPRINTS_FRAME::GetFootprint( const wxString& aFootprintNam
void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()
{
CVPCB_MAINFRAME* parentframe = (CVPCB_MAINFRAME *) GetParent();
COMPONENT* comp = parentframe->GetSelectedComponent();
FOOTPRINT* footprint = nullptr;
const FOOTPRINT_INFO* fpInfo = nullptr;
wxString footprintName = parentframe->GetSelectedFootprint();
if( footprintName.IsEmpty() && comp )
footprintName = comp->GetFPID().Format();
if( m_currentFootprint == footprintName && m_currentComp == comp )
return;
GetBoard()->DeleteAllFootprints();
GetCanvas()->GetView()->Clear();
wxString footprintName = parentframe->GetSelectedFootprint();
if( footprintName.IsEmpty() )
{
COMPONENT* comp = parentframe->GetSelectedComponent();
if( comp )
footprintName = comp->GetFPID().GetUniStringLibId();
}
INFOBAR_REPORTER infoReporter( m_infoBar );
m_infoBar->Dismiss();
@@ -481,11 +480,7 @@ void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()
}
if( footprint )
{
GetBoard()->Add( footprint );
m_currentFootprint = footprintName;
m_currentComp = comp;
}
if( fpInfo )
SetStatusText( wxString::Format( _( "Lib: %s" ), fpInfo->GetLibNickname() ), 0 );
-4
View File
@@ -114,10 +114,6 @@ public:
protected:
void setupUIConditions() override;
private:
wxString m_currentFootprint;
COMPONENT* m_currentComp;
};
#endif // DISPLAY_FOOTPRINTS_FRAME_H
+24 -8
View File
@@ -99,15 +99,15 @@ wxString FOOTPRINTS_LISTBOX::OnGetItemText( long item, long column ) const
}
void FOOTPRINTS_LISTBOX::SetSelection( int aIndex, bool aState )
void FOOTPRINTS_LISTBOX::SetSelection( int index, bool State )
{
if( aIndex >= GetCount() )
aIndex = GetCount() - 1;
if( index >= GetCount() )
index = GetCount() - 1;
if(( aIndex >= 0) && ( GetCount() > 0) )
if( (index >= 0) && (GetCount() > 0) )
{
Select( aIndex, aState );
EnsureVisible( aIndex );
Select( index, State );
EnsureVisible( index );
Refresh();
}
}
@@ -156,7 +156,7 @@ void FOOTPRINTS_LISTBOX::SetFootprints( FOOTPRINT_LIST& aList, const wxString& a
if( GetSelection() >= 0 && GetSelection() < (int)m_footprintList.GetCount() )
oldSelection = m_footprintList[ GetSelection() ];
for( const FOOTPRINT_INFO& i : filter )
for( auto& i: filter )
{
msg.Printf( wxT( "%3d %s:%s" ),
int( newList.GetCount() + 1 ),
@@ -199,7 +199,23 @@ END_EVENT_TABLE()
void FOOTPRINTS_LISTBOX::OnLeftClick( wxListEvent& event )
{
GetParent()->RefreshFootprintViewer();
if( m_footprintList.IsEmpty() )
return;
// On some plateforms (OSX) the focus is lost when the viewers (fp and 3D viewers)
// are opened and refreshed when a new footprint is selected.
// If the listbox has the focus before selecting a new footprint, it will be forced
// after selection.
bool hasFocus = HasFocus();
// If the footprint view window is displayed, update the footprint.
if( GetParent()->GetFootprintViewerFrame() )
GetParent()->GetToolManager()->RunAction( CVPCB_ACTIONS::showFootprintViewer, true );
GetParent()->DisplayStatus();
if( hasFocus )
SetFocus();
}
+1 -1
View File
@@ -100,7 +100,7 @@ public:
~FOOTPRINTS_LISTBOX();
int GetCount();
void SetSelection( int aIndex, bool aState = true );
void SetSelection( int index, bool State = true );
void SetSelectedFootprint( const LIB_ID& aFPID );
void SetString( unsigned linecount, const wxString& text );
void AppendLine( const wxString& text );
+2 -2
View File
@@ -161,8 +161,8 @@ int CVPCB_CONTROL::ShowFootprintViewer( const TOOL_EVENT& aEvent )
if( !fpframe )
{
fpframe = (DISPLAY_FOOTPRINTS_FRAME*) m_frame->Kiway().Player( FRAME_CVPCB_DISPLAY, true,
m_frame );
fpframe = (DISPLAY_FOOTPRINTS_FRAME*) m_frame->Kiway().Player(
FRAME_CVPCB_DISPLAY, true, m_frame );
fpframe->Show( true );
}
else
File diff suppressed because it is too large Load Diff
+5 -7
View File
@@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2004-2021 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
@@ -182,6 +182,10 @@ void SCH_EDIT_FRAME::AnnotateSymbols( ANNOTATE_SCOPE_T aAnnotateScope,
// Store previous annotations for building info messages
mapExistingAnnotation( previousAnnotation );
// If it is an annotation for all the symbols, reset previous annotation.
if( aResetAnnotation )
DeleteAnnotation( aAnnotateScope, &appendUndo );
// Set sheet number and number of sheets.
SetSheetNumberAndCount();
@@ -201,12 +205,6 @@ void SCH_EDIT_FRAME::AnnotateSymbols( ANNOTATE_SCOPE_T aAnnotateScope,
break;
}
// Remove annotation only updates the "new" flag to indicate to the algorithm
// that these references must be reannotated, but keeps the original reference
// so that we can reannotate multi-unit symbols together.
if( aResetAnnotation )
references.RemoveAnnotation();
// Build additional list of references to be used during reannotation
// to avoid duplicate designators (no additional references when annotating
// the full schematic)
+99 -124
View File
@@ -3,7 +3,7 @@
*
* Copyright (C) 1992-2018 jean-pierre Charras <jp.charras at wanadoo.fr>
* Copyright (C) 1992-2011 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2021 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
@@ -29,7 +29,6 @@
*/
#include <sch_reference_list.h>
#include <core/kicad_algo.h>
#include <wx/regex.h>
#include <algorithm>
@@ -49,7 +48,7 @@ void SCH_REFERENCE_LIST::RemoveItem( unsigned int aIndex )
}
bool SCH_REFERENCE_LIST::Contains( const SCH_REFERENCE& aItem ) const
bool SCH_REFERENCE_LIST::Contains( const SCH_REFERENCE& aItem )
{
for( unsigned ii = 0; ii < GetCount(); ii++ )
{
@@ -155,14 +154,14 @@ bool SCH_REFERENCE_LIST::sortByTimeStamp( const SCH_REFERENCE& item1,
}
int SCH_REFERENCE_LIST::FindUnit( size_t aIndex, int aUnit, bool aIncludeNew ) const
int SCH_REFERENCE_LIST::FindUnit( size_t aIndex, int aUnit ) const
{
int NumRef = flatList[aIndex].m_numRef;
for( size_t ii = 0; ii < flatList.size(); ii++ )
{
if( ( aIndex == ii )
|| ( flatList[ii].m_isNew && !aIncludeNew )
|| ( flatList[ii].m_isNew )
|| ( flatList[ii].m_numRef != NumRef )
|| ( flatList[aIndex].CompareRef( flatList[ii] ) != 0 ) )
continue;
@@ -211,98 +210,34 @@ void SCH_REFERENCE_LIST::GetRefsInUse( int aIndex, std::vector< int >& aIdList,
aIdList.push_back( ref.m_numRef );
}
std::sort( aIdList.begin(), aIdList.end() );
sort( aIdList.begin(), aIdList.end() );
// Ensure each reference number appears only once. If there are symbols with
// multiple parts per package the same number will be stored for each part.
alg::remove_duplicates( aIdList );
std::vector< int >::iterator it = unique( aIdList.begin(), aIdList.end() );
// Using the C++ unique algorithm only moves the duplicate entries to the end of
// of the array. This removes the duplicate entries from the array.
aIdList.resize( it - aIdList.begin() );
}
std::vector<int> SCH_REFERENCE_LIST::GetUnitsMatchingRef( const SCH_REFERENCE& aRef ) const
int SCH_REFERENCE_LIST::GetLastReference( int aIndex, int aMinValue ) const
{
std::vector<int> unitsList;
// Always add this reference to the list
unitsList.push_back( aRef.m_unit );
for( SCH_REFERENCE ref : flatList )
{
if( ref.CompareValue( aRef ) != 0 )
continue;
if( ref.CompareLibName( aRef ) != 0 )
continue;
// Split if needed before comparing ref and number
if( ref.IsSplitNeeded() )
ref.Split();
if( ref.CompareRef( aRef ) != 0 )
continue;
if( ref.m_numRef != aRef.m_numRef )
continue;
unitsList.push_back( ref.m_unit );
}
std::sort( unitsList.begin(), unitsList.end() );
// Ensure each reference number appears only once. If there are symbols with
// multiple parts per package the same number will be stored for each part.
alg::remove_duplicates( unitsList );
return unitsList;
}
int SCH_REFERENCE_LIST::FindFirstUnusedReference( const SCH_REFERENCE& aRef, int aMinValue,
const std::vector<int>& aRequiredUnits ) const
{
// Create a map of references indexed by reference number, only including those with the same
// reference prefix as aRef
std::map<int, std::vector<SCH_REFERENCE>> refNumberMap;
int lastNumber = aMinValue;
for( const SCH_REFERENCE& ref : flatList )
{
// search only for the current reference prefix:
if( ref.CompareRef( aRef ) != 0 )
if( flatList[aIndex].CompareRef( ref ) != 0 )
continue;
if( ref.m_isNew )
continue; // It will be reannotated
refNumberMap[ref.m_numRef].push_back( ref );
// update max value for the current reference prefix
if( lastNumber < ref.m_numRef )
lastNumber = ref.m_numRef;
}
// Start at the given minimum value
int minFreeNumber = aMinValue;
for( ; refNumberMap[minFreeNumber].size() > 0; ++minFreeNumber )
{
auto isNumberInUse = [&]() -> bool
{
for( const int& unit : aRequiredUnits )
{
for( const SCH_REFERENCE& ref : refNumberMap[minFreeNumber] )
{
if( ref.CompareLibName( aRef ) || ref.CompareValue( aRef )
|| ref.GetUnit() == unit )
{
return true;
}
}
}
return false;
};
if( !isNumberInUse() )
return minFreeNumber;
}
return minFreeNumber;
return lastNumber;
}
@@ -326,7 +261,7 @@ std::vector<SYMBOL_INSTANCE_REFERENCE> SCH_REFERENCE_LIST::GetSymbolInstances()
}
int SCH_REFERENCE_LIST::createFirstFreeRefId( std::vector<int>& aIdList, int aFirstValue )
int SCH_REFERENCE_LIST::CreateFirstFreeRefId( std::vector<int>& aIdList, int aFirstValue )
{
int expectedId = aFirstValue;
@@ -392,9 +327,9 @@ void SCH_REFERENCE_LIST::ReannotateDuplicates( const SCH_REFERENCE_LIST& aAdditi
if( refstr[refstr.Len() - 1] == '?' )
continue;
ref.m_isNew = true; // We want to reannotate all references
lockedSymbols[refstr].AddItem( ref );
ref.m_isNew = true; // We want to reannotate all references
}
Annotate( false, 0, 0, lockedSymbols, aAdditionalReferences, true );
@@ -437,6 +372,7 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
}
int LastReferenceNumber = 0;
int NumberOfUnits, Unit;
/* calculate index of the first symbol with the same reference prefix
* than the current symbol. All symbols having the same reference
@@ -454,6 +390,10 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
else
minRefId = aStartNumber + 1;
// This is the list of all Id already in use for a given reference prefix.
// Will be refilled for each new reference prefix.
std::vector<int>idList;
GetRefsInUse( first, idList, minRefId );
for( unsigned ii = 0; ii < flatList.size(); ii++ )
{
@@ -495,20 +435,23 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
minRefId = ref_unit.m_sheetNum * aSheetIntervalId + 1;
else
minRefId = aStartNumber + 1;
GetRefsInUse( first, idList, minRefId );
}
// Find references greater than current reference (unless not annotated)
if( aStartAtCurrent && ref_unit.m_numRef > 0 )
{
minRefId = ref_unit.m_numRef;
GetRefsInUse( first, idList, minRefId );
}
// Annotation of one part per package symbols (trivial case).
if( ref_unit.GetLibPart()->GetUnitCount() <= 1 )
{
if( ref_unit.m_isNew )
{
std::vector<int> idList;
GetRefsInUse( first, idList, minRefId );
LastReferenceNumber = createFirstFreeRefId( idList, minRefId );
LastReferenceNumber = CreateFirstFreeRefId( idList, minRefId );
ref_unit.m_numRef = LastReferenceNumber;
}
@@ -517,46 +460,48 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
continue;
}
// Annotation of multi-unit parts ( n units per part ) (complex case)
NumberOfUnits = ref_unit.GetLibPart()->GetUnitCount();
if( ref_unit.m_isNew )
{
LastReferenceNumber = CreateFirstFreeRefId( idList, minRefId );
ref_unit.m_numRef = LastReferenceNumber;
ref_unit.m_flag = 1;
}
// If this symbol is in aLockedUnitMap, copy the annotation to all
// symbols that are not it
if( lockedList != nullptr )
{
unsigned n_refs = lockedList->GetCount();
std::vector<int> units = lockedList->GetUnitsMatchingRef( ref_unit );
if( ref_unit.m_isNew )
for( unsigned thisRefI = 0; thisRefI < n_refs; ++thisRefI )
{
LastReferenceNumber = FindFirstUnusedReference( ref_unit, minRefId, units );
ref_unit.m_numRef = LastReferenceNumber;
ref_unit.m_isNew = false;
ref_unit.m_flag = 1;
}
SCH_REFERENCE &thisRef = (*lockedList)[thisRefI];
for( unsigned lockedRefI = 0; lockedRefI < n_refs; ++lockedRefI )
{
SCH_REFERENCE& lockedRef = ( *lockedList )[lockedRefI];
if( lockedRef.IsSameInstance( ref_unit ) )
if( thisRef.IsSameInstance( ref_unit ) )
{
// This is the symbol we're currently annotating. Hold the unit!
ref_unit.m_unit = lockedRef.m_unit;
ref_unit.m_unit = thisRef.m_unit;
// lock this new full reference
inUseRefs.insert( buildFullReference( ref_unit ) );
}
if( lockedRef.CompareValue( ref_unit ) != 0 )
if( thisRef.CompareValue( ref_unit ) != 0 )
continue;
if( lockedRef.CompareLibName( ref_unit ) != 0 )
if( thisRef.CompareLibName( ref_unit ) != 0 )
continue;
// Find the matching symbol
for( unsigned jj = ii + 1; jj < flatList.size(); jj++ )
{
if( !lockedRef.IsSameInstance( flatList[jj] ) )
if( ! thisRef.IsSameInstance( flatList[jj] ) )
continue;
wxString ref_candidate = buildFullReference( ref_unit, lockedRef.m_unit );
wxString ref_candidate = buildFullReference( ref_unit, thisRef.m_unit );
// propagate the new reference and unit selection to the "old" symbol,
// if this new full reference is not already used (can happens when initial
@@ -573,16 +518,56 @@ void SCH_REFERENCE_LIST::Annotate( bool aUseSheetNum, int aSheetIntervalId, int
}
}
}
else if( ref_unit.m_isNew )
else
{
// Reference belonging to multi-unit symbol that has not yet been annotated. We don't
// know what group this might belong to, so just find the first unused reference for
// this specific unit. The other units will be annotated in the following passes.
std::vector<int> units = { ref_unit.GetUnit() };
LastReferenceNumber = FindFirstUnusedReference( ref_unit, minRefId, units );
ref_unit.m_numRef = LastReferenceNumber;
ref_unit.m_isNew = false;
ref_unit.m_flag = 1;
/* search for others units of this symbol.
* we search for others parts that have the same value and the same
* reference prefix (ref without ref number)
*/
for( Unit = 1; Unit <= NumberOfUnits; Unit++ )
{
if( ref_unit.m_unit == Unit )
continue;
int found = FindUnit( ii, Unit );
if( found >= 0 )
continue; // this unit exists for this reference (unit already annotated)
// Search a symbol to annotate ( same prefix, same value, not annotated)
for( unsigned jj = ii + 1; jj < flatList.size(); jj++ )
{
auto& cmp_unit = flatList[jj];
if( cmp_unit.m_flag ) // already tested
continue;
if( cmp_unit.CompareRef( ref_unit ) != 0 )
continue;
if( cmp_unit.CompareValue( ref_unit ) != 0 )
continue;
if( cmp_unit.CompareLibName( ref_unit ) != 0 )
continue;
if( aUseSheetNum &&
cmp_unit.GetSheetPath().Cmp( ref_unit.GetSheetPath() ) != 0 )
continue;
if( !cmp_unit.m_isNew )
continue;
// Symbol without reference number found, annotate it if possible.
if( cmp_unit.m_unit == Unit )
{
cmp_unit.m_numRef = ref_unit.m_numRef;
cmp_unit.m_flag = 1;
cmp_unit.m_isNew = false;
break;
}
}
}
}
}
@@ -839,16 +824,6 @@ void SCH_REFERENCE::Split()
}
bool SCH_REFERENCE::IsSplitNeeded()
{
std::string refText = GetRefStr();
int ll = refText.length() - 1;
return ( refText[ll] == '?' ) || isdigit( refText[ll] );
}
wxString SCH_REFERENCE_LIST::Shorthand( std::vector<SCH_REFERENCE> aList )
{
wxString retVal;
+139 -182
View File
@@ -410,6 +410,9 @@ CONNECTION_SUBGRAPH::PRIORITY CONNECTION_SUBGRAPH::GetDriverPriority( SCH_ITEM*
}
bool CONNECTION_GRAPH::m_allowRealTime = true;
void CONNECTION_GRAPH::Reset()
{
for( auto& subgraph : m_subgraphs )
@@ -478,6 +481,17 @@ void CONNECTION_GRAPH::Recalculate( const SCH_SHEET_LIST& aSheetList, bool aUnco
if( wxLog::IsAllowedTraceMask( ConnProfileMask ) )
recalc_time.Show();
#ifndef DEBUG
// Pressure relief valve for release builds
const double max_recalc_time_msecs = 250.;
if( m_allowRealTime && ADVANCED_CFG::GetCfg().m_RealTimeConnectivity &&
recalc_time.msecs() > max_recalc_time_msecs )
{
m_allowRealTime = false;
}
#endif
}
@@ -2191,31 +2205,6 @@ CONNECTION_SUBGRAPH* CONNECTION_GRAPH::FindSubgraphByName( const wxString& aNetN
}
wxString CONNECTION_GRAPH::GetResolvedSubgraphName( const CONNECTION_SUBGRAPH* aSubGraph ) const
{
wxString retval = aSubGraph->GetNetName();
bool found = false;
// This is a hacky way to find the true subgraph net name (why do we not store it?)
// TODO: Remove once the actual netname of the subgraph is stored with the subgraph
for( auto it = m_net_name_to_subgraphs_map.begin(); it != m_net_name_to_subgraphs_map.end() && !found; ++it )
{
for( CONNECTION_SUBGRAPH* graph : it->second )
{
if( graph == aSubGraph )
{
retval = it->first;
found = true;
break;
}
}
}
return retval;
}
CONNECTION_SUBGRAPH* CONNECTION_GRAPH::FindFirstSubgraphByName( const wxString& aNetName )
{
auto it = m_net_name_to_subgraphs_map.find( aNetName );
@@ -2383,9 +2372,7 @@ bool CONNECTION_GRAPH::ercCheckMultipleDrivers( const CONNECTION_SUBGRAPH* aSubg
if( driver->Type() == SCH_GLOBAL_LABEL_T
|| driver->Type() == SCH_HIER_LABEL_T
|| driver->Type() == SCH_LABEL_T
|| ( driver->Type() == SCH_PIN_T
&& static_cast<SCH_PIN*>( driver )->IsPowerConnection() ) )
|| driver->Type() == SCH_LABEL_T )
{
wxString primaryName = aSubgraph->GetNameForDriver( aSubgraph->m_driver );
wxString secondaryName = aSubgraph->GetNameForDriver( driver );
@@ -2641,96 +2628,68 @@ bool CONNECTION_GRAPH::ercCheckBusToBusEntryConflicts( const CONNECTION_SUBGRAPH
bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph )
{
ERC_SETTINGS& settings = m_schematic->ErcSettings();
wxString msg;
const SCH_SHEET_PATH& sheet = aSubgraph->m_sheet;
SCH_SCREEN* screen = sheet.LastScreen();
bool ok = true;
SCH_PIN* pin = nullptr;
std::set<SCH_PIN*> unique_pins;
std::set<SCH_TEXT*> unique_labels;
wxString netName = GetResolvedSubgraphName( aSubgraph );
auto process_subgraph = [&]( const CONNECTION_SUBGRAPH* aProcessGraph )
if( aSubgraph->m_no_connect != nullptr )
{
// Any subgraph that contains a no-connect should not
// more than one pin (which would indicate it is connected
bool has_invalid_items = false;
bool has_other_items = false;
SCH_PIN* pin = nullptr;
std::vector<SCH_ITEM*> invalid_items;
wxPoint noConnectPos = aSubgraph->m_no_connect->GetPosition();
double minDist = 0;
for( SCH_ITEM* item : aProcessGraph->m_items )
// Any subgraph that contains both a pin and a no-connect should not
// contain any other driving items.
for( SCH_ITEM* item : aSubgraph->m_items )
{
switch( item->Type() )
{
case SCH_PIN_T:
{
SCH_PIN* test_pin = static_cast<SCH_PIN*>( item );
SCH_PIN* candidate = static_cast<SCH_PIN*>( item );
double dist = VECTOR2I( candidate->GetTransformedPosition() - noConnectPos )
.SquaredEuclideanNorm();
// Only link NC to pin on the current subgraph being checked
if( aProcessGraph == aSubgraph )
pin = test_pin;
if( std::none_of( unique_pins.begin(), unique_pins.end(),
[test_pin]( SCH_PIN* aPin )
{
return test_pin->IsStacked( aPin );
}
) )
if( !pin || dist < minDist )
{
unique_pins.insert( test_pin );
pin = candidate;
minDist = dist;
}
has_invalid_items |= has_other_items;
has_other_items = true;
break;
}
case SCH_LABEL_T:
case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T:
unique_labels.insert( static_cast<SCH_TEXT*>( item ) );
KI_FALLTHROUGH;
case SCH_LINE_T:
case SCH_JUNCTION_T:
case SCH_NO_CONNECT_T:
break;
default:
break;
has_invalid_items = true;
has_other_items = true;
invalid_items.push_back( item );
}
}
};
auto it = m_net_name_to_subgraphs_map.find( netName );
if( it != m_net_name_to_subgraphs_map.end() )
{
for( const CONNECTION_SUBGRAPH* subgraph : it->second )
{
process_subgraph( subgraph );
}
}
else
{
process_subgraph( aSubgraph );
}
if( aSubgraph->m_no_connect != nullptr )
{
if( unique_pins.size() > 1 && settings.IsTestEnabled( ERCE_NOCONNECT_CONNECTED ) )
if( pin && has_invalid_items && settings.IsTestEnabled( ERCE_NOCONNECT_CONNECTED ) )
{
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_NOCONNECT_CONNECTED );
wxPoint pos;
ercItem->SetItems( pin );
if( pin )
{
ercItem->SetItems( pin, aSubgraph->m_no_connect );
pos = pin->GetTransformedPosition();
}
else
{
ercItem->SetItems( aSubgraph->m_no_connect );
pos = aSubgraph->m_no_connect->GetPosition();
}
SCH_MARKER* marker = new SCH_MARKER( ercItem, pos );
SCH_MARKER* marker = new SCH_MARKER( ercItem, pin->GetTransformedPosition() );
screen->Append( marker );
ok = false;
}
if( unique_pins.empty() && unique_labels.empty() && settings.IsTestEnabled( ERCE_NOCONNECT_NOT_CONNECTED ) )
if( !has_other_items && settings.IsTestEnabled( ERCE_NOCONNECT_NOT_CONNECTED ) )
{
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_NOCONNECT_NOT_CONNECTED );
ercItem->SetItems( aSubgraph->m_no_connect );
@@ -2758,11 +2717,12 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
// Stacked pins do not count as other connections but non-stacked pins do
if( !has_other_connections && !pins.empty() )
{
SCH_PIN* test_pin = static_cast<SCH_PIN*>( item );
SCH_PIN* pin = static_cast<SCH_PIN*>( item );
for( SCH_PIN* other_pin : pins )
{
if( !test_pin->IsStacked( other_pin ) )
if( other_pin->GetParent() != pin->GetParent()
|| other_pin->GetPosition() != pin->GetPosition() )
{
has_other_connections = true;
break;
@@ -2784,17 +2744,7 @@ bool CONNECTION_GRAPH::ercCheckNoConnects( const CONNECTION_SUBGRAPH* aSubgraph
}
// For many checks, we can just use the first pin
pin = pins.empty() ? nullptr : pins[0];
// But if there is a power pin, it might be connected elsewhere
for( SCH_PIN* test_pin : pins )
{
if( test_pin->GetType() == ELECTRICAL_PINTYPE::PT_POWER_IN )
{
pin = test_pin;
break;
}
}
SCH_PIN* pin = pins.empty() ? nullptr : pins[0];
// Check if invisible power input pins connect to anything else via net name,
// but not for power symbols as the ones in the standard library all have invisible pins
@@ -2902,11 +2852,13 @@ bool CONNECTION_GRAPH::ercCheckFloatingWires( const CONNECTION_SUBGRAPH* aSubgra
bool CONNECTION_GRAPH::ercCheckLabels( const CONNECTION_SUBGRAPH* aSubgraph )
{
// Label connection rules:
// Any label without a no-connect needs to have at least 2 pins, otherwise it is invalid
// Local labels are flagged if they don't connect to any pins and don't have a no-connect
// Global labels are flagged if they appear only once, don't connect to any local labels,
// and don't have a no-connect marker
// So, if there is a no-connect, we will never generate a warning here
if( aSubgraph->m_no_connect )
return true;
if( !aSubgraph->m_driver_connection )
return true;
@@ -2916,36 +2868,30 @@ bool CONNECTION_GRAPH::ercCheckLabels( const CONNECTION_SUBGRAPH* aSubgraph )
if( aSubgraph->m_driver_connection->IsBus() )
return true;
ERC_SETTINGS& settings = m_schematic->ErcSettings();
bool ok = true;
int pinCount = 0;
bool has_nc = !!aSubgraph->m_no_connect;
std::map<KICAD_T, std::vector<SCH_TEXT*>> label_map;
ERC_SETTINGS& settings = m_schematic->ErcSettings();
bool ok = true;
SCH_TEXT* text = nullptr;
bool hasOtherConnections = false;
int pinCount = 0;
auto hasPins =
[]( const CONNECTION_SUBGRAPH* aLocSubgraph ) -> int
[]( const CONNECTION_SUBGRAPH* aLocSubgraph )
{
return
std::count_if( aLocSubgraph->m_items.begin(), aLocSubgraph->m_items.end(), []( const SCH_ITEM* item )
{ return item->Type() == SCH_PIN_T; } );
for( const SCH_ITEM* item : aLocSubgraph->m_items )
{
switch( item->Type() )
{
case SCH_PIN_T:
case SCH_SHEET_PIN_T:
return true;
default: break;
}
}
return false;
};
auto reportError = [&]( SCH_TEXT* aText, int errCode )
{
if( settings.IsTestEnabled( errCode ) )
{
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( errCode );
ercItem->SetItems( aText );
SCH_MARKER* marker = new SCH_MARKER( ercItem, aText->GetPosition() );
aSubgraph->m_sheet.LastScreen()->Append( marker );
}
};
pinCount = hasPins( aSubgraph );
for( SCH_ITEM* item : aSubgraph->m_items )
{
switch( item->Type() )
@@ -2954,94 +2900,105 @@ bool CONNECTION_GRAPH::ercCheckLabels( const CONNECTION_SUBGRAPH* aSubgraph )
case SCH_GLOBAL_LABEL_T:
case SCH_HIER_LABEL_T:
{
SCH_TEXT* text = static_cast<SCH_TEXT*>( item );
label_map[item->Type()].push_back( text );
text = static_cast<SCH_TEXT*>( item );
// Below, we'll create an ERC if the whole subgraph is unconnected. But, additionally,
// we want to error if an individual label in the subgraph is floating, even if it's
// connected to other valid things by way of another label on the same sheet.
if( text->IsDangling() )
if( text->IsDangling() && settings.IsTestEnabled( ERCE_LABEL_NOT_CONNECTED ) )
{
reportError( text, ERCE_LABEL_NOT_CONNECTED );
return false;
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( ERCE_LABEL_NOT_CONNECTED );
ercItem->SetItems( text );
SCH_MARKER* marker = new SCH_MARKER( ercItem, text->GetPosition() );
aSubgraph->m_sheet.LastScreen()->Append( marker );
ok = false;
}
break;
}
case SCH_PIN_T:
case SCH_SHEET_PIN_T:
hasOtherConnections = true;
pinCount++;
break;
default:
break;
}
}
if( label_map.empty() )
if( !text )
return true;
wxString netName = GetResolvedSubgraphName( aSubgraph );
bool isGlobal = text->Type() == SCH_GLOBAL_LABEL_T;
int errCode = isGlobal ? ERCE_GLOBLABEL : ERCE_LABEL_NOT_CONNECTED;
wxCHECK_MSG( m_schematic, true, "Null m_schematic in CONNECTION_GRAPH::ercCheckLabels" );
wxCHECK_MSG( m_schematic, true, wxT( "Null m_schematic in CONNECTION_GRAPH::ercCheckLabels" ) );
// Labels that have multiple pins connected are not dangling (may be used for naming segments)
// so leave them without errors here
if( pinCount > 1 )
return true;
wxString name = EscapeString( text->GetShownText(), CTX_NETNAME );
for( auto label_el : label_map )
if( isGlobal )
{
KICAD_T type = label_el.first;
std::vector<SCH_TEXT*>& label_vec = label_el.second;
// This will be set to true if the global is connected to a pin above, but we want to
// reset this to false so that globals get flagged if they only have a single instance
// connected to a single pin
hasOtherConnections = ( pinCount > 1 );
switch( type )
auto it = m_net_name_to_subgraphs_map.find( name );
if( it != m_net_name_to_subgraphs_map.end() )
{
case SCH_GLOBAL_LABEL_T:
if( !settings.IsTestEnabled( ERCE_GLOBLABEL ) )
continue;
break;
default:
if( !settings.IsTestEnabled( ERCE_LABEL_NOT_CONNECTED ) )
continue;
break;
if( it->second.size() > 1 || aSubgraph->m_multiple_drivers )
hasOtherConnections = true;
}
for( SCH_TEXT* text : label_vec )
}
else if( text->Type() == SCH_HIER_LABEL_T )
{
// For a hier label, check if the parent pin is connected
if( aSubgraph->m_hier_parent
&& ( aSubgraph->m_hier_parent->m_strong_driver
|| aSubgraph->m_hier_parent->m_drivers.size() > 1) )
{
int allPins = pinCount;
// For now, a simple check: if there is more than one driver, the parent is probably
// connected elsewhere (because at least one driver will be the hier pin itself)
hasOtherConnections = true;
}
}
else
{
auto pair = std::make_pair( aSubgraph->m_sheet, name );
auto it = m_local_label_cache.find( pair );
auto net_it = m_net_name_to_subgraphs_map.find( netName );
if( net_it != m_net_name_to_subgraphs_map.end() )
if( it != m_local_label_cache.end() && it->second.size() > 1 )
{
for( const CONNECTION_SUBGRAPH* neighbor : it->second )
{
for( const CONNECTION_SUBGRAPH* neighbor : net_it->second )
if( neighbor == aSubgraph )
continue;
if( hasPins( neighbor ) )
{
if( neighbor == aSubgraph )
continue;
if( neighbor->m_no_connect )
has_nc = true;
allPins += hasPins( neighbor );
hasOtherConnections = true;
break;
}
}
if( allPins == 1 && !has_nc )
{
reportError( text,
type == SCH_GLOBAL_LABEL_T ? ERCE_GLOBLABEL : ERCE_LABEL_NOT_CONNECTED );
ok = false;
}
if( allPins == 0 )
{
reportError( text,
type == SCH_GLOBAL_LABEL_T ? ERCE_GLOBLABEL : ERCE_LABEL_NOT_CONNECTED );
ok = false;
}
}
}
if( !hasOtherConnections && settings.IsTestEnabled( errCode ) )
{
std::shared_ptr<ERC_ITEM> ercItem = ERC_ITEM::Create( errCode );
ercItem->SetItems( text );
SCH_MARKER* marker = new SCH_MARKER( ercItem, text->GetPosition() );
aSubgraph->m_sheet.LastScreen()->Append( marker );
return false;
}
return ok;
}
+4 -7
View File
@@ -324,13 +324,6 @@ public:
CONNECTION_SUBGRAPH* GetSubgraphForItem( SCH_ITEM* aItem );
/**
* Returns the fully-resolved netname for a given subgraph
* @param aSubGraph Reference to the subgraph
* @return Netname string usable with m_net_name_to_subgraphs_map
*/
wxString GetResolvedSubgraphName( const CONNECTION_SUBGRAPH* aSubGraph ) const;
private:
/**
* Updates the graphical connectivity between items (i.e. where they touch)
@@ -537,6 +530,10 @@ private:
*/
int ercCheckHierSheets();
public:
// TODO(JE) Remove this when pressure valve is removed
static bool m_allowRealTime;
private:
// All the sheets in the schematic (as long as we don't have partial updates)
SCH_SHEET_LIST m_sheetList;
+5
View File
@@ -578,6 +578,11 @@ void SCH_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
NETLIST_EXPORTER_KICAD exporter( &Schematic() );
STRING_FORMATTER formatter;
// TODO remove once real-time connectivity is a given
if( !ADVANCED_CFG::GetCfg().m_RealTimeConnectivity || !CONNECTION_GRAPH::m_allowRealTime )
// Ensure the netlist data is up to date:
RecalculateConnections( NO_CLEANUP );
exporter.Format( &formatter, GNL_ALL | GNL_OPT_KICAD );
payload = formatter.GetString();
+145
View File
@@ -0,0 +1,145 @@
// Do not edit this file, it is autogenerated by CMake from the .md file
_HKI( "# 1 - Full documentation\n"
"\n"
"The Eeschema documentation (*eeschema.html*) describes this intermediate netlist and gives examples(chapter ***creating customized netlists and bom files***).\n"
"\n"
"# 2 - The intermediate Netlist File\n"
"\n"
"BOM files (and netlist files) can be created from an *Intermediate netlist file* created by Eeschema.\n"
"\n"
"This file uses XML syntax and is called the intermediate netlist. The intermediate netlist includes a large amount of data about your board and because of this, it can be used with post-processing to create a BOM or other reports.\n"
"\n"
"Depending on the output (BOM or netlist), different subsets of the complete Intermediate Netlist file will be used in the post-processing.\n"
"\n"
"# 3 - Conversion to a new format\n"
"\n"
"By applying a post-processing filter to the Intermediate netlist file you can generate foreign netlist files as well as BOM files. Because this conversion is a text to text transformation, this post-processing filter can be written using *Python*, *XSLT*, or any other tool capable of taking XML as input.\n"
"\n"
"XSLT itself is a XML language suitable for XML transformations. There is a free program called `xsltproc` that you can download and install. The `xsltproc` program can be used to read the Intermediate XML netlist input file, apply a style-sheet to transform the input, and save the results in an output file. Use of `xsltproc` requires a style-sheet file using XSLT conventions. The full conversion process is handled by Eeschema, after it is configured once to run `xsltproc` in a specific way.\n"
"\n"
"A Python script is somewhat more easy to create.\n"
"\n"
"# 4 - Initialization of the dialog window\n"
"\n"
"You should add a new plugin (a script) in the plugin list by clicking on the Add Plugin button.\n"
"\n"
"## 4.1 - Plugin Configuration Parameters\n"
"\n"
"The Eeschema plug-in configuration dialog requires the following information:\n"
"\n"
" * The title: for instance, the name of the netlist format.\n"
" * The command line to launch the converter (usually a script).\n"
"\n"
"***Note (Windows only):***\n"
"*By default, the command line runs with hidden console window and output is redirected to \"Plugin info\" field. To show the window of the running command, set the checkbox \"Show console window\".*\n"
"\n"
"Once you click on the generate button the following will happen:\n"
"\n"
"1. Eeschema creates an intermediate netlist file \\*.xml, for instance `test.xml`.\n"
"2. Eeschema runs the script from the command line to create the final output file.\n"
"\n"
"## 4.2 - Generate netlist files with the command line\n"
"\n"
"Assuming we are using the program `xsltproc.exe` to apply the sheet style to the intermediate file, `xsltproc.exe` is executed with the following command.\n"
"\n"
"```\n"
"xsltproc.exe -o <output filename> <style-sheet filename> <input XML file to convert>\n"
"```\n"
"\n"
"On Windows the command line is the following.\n"
"\n"
"```\n"
"f:/kicad/bin/xsltproc.exe -o \"%O\" f:/kicad/bin/plugins/myconverter.xsl \"%I\"\n"
"```\n"
"\n"
"On Linux the command becomes as following.\n"
"\n"
"```\n"
"xsltproc -o \"%O\" /usr/local/kicad/bin/plugins/myconverter .xsl \"%I\"\n"
"```\n"
"where `myconverter.xsl` is the style-sheet that you are applying.\n"
"\n"
"Do not forget the double quotes around the file names, this allows them to have spaces after the substitution by Eeschema.\n"
"\n"
"If a Python script is used, the command line is something like (depending on the Python script):\n"
"\n"
"```\n"
"python f:/kicad/bin/plugins/bom-in-python/myconverter.py \"%I\" \"%O\"\n"
"```\n"
"\n"
"or\n"
"\n"
"```\n"
"python /usr/local/kicad/bin/plugins/bom-in-python/myconverter .xsl \"%I\" \"%O\"\n"
"```\n"
"\n"
"The command line format accepts parameters for filenames. The supported formatting parameters are:\n"
"\n"
" * `%B`: base filename of selected output file, minus path and extension.\n"
" * `%P`: project directory, without name and without trailing '/'.\n"
" * `%I`: complete filename and path of the temporary input file\n"
"(the intermediate net file).\n"
" * `%O`: complete filename and path (but without extension) of the user\n"
"chosen output file.\n"
"\n"
"`%I` will be replaced by the actual intermediate file name (usually the full root sheet filename with extension \".xml\").\n"
"`%O` will be replaced by the actual output file name (the full root sheet filename minus extension).\n"
"`%B` will be replaced by the actual output short file name (the short root sheet filename minus extension).\n"
"`%P` will be replaced by the actual current project path.\n"
"\n"
"## 4.3 - Command line format:\n"
"\n"
"### 4.3.1 - Remark:\n"
"\n"
"Most of time, the created file must have an extension, depending on its type.\n"
"Therefore you have to add to the option ***%O*** the right file extension.\n"
"\n"
"For instance:\n"
"\n"
" * **%O.csv** to create a .csv file (comma separated value file).\n"
" * **%O.htm** to create a .html file.\n"
" * **%O.bom** to create a .bom file.\n"
"\n"
"### 4.3.2 Example for xsltproc:\n"
"\n"
"The command line format for xsltproc is the following:\n"
"\n"
"```\n"
"<path of xsltproc> xsltproc <xsltproc parameters>\n"
"```\n"
"\n"
"On Windows:\n"
"```\n"
"f:/kicad/bin/xsltproc.exe -o \"%O.bom\" f:/kicad/bin/plugins/netlist_form_pads-pcb.xsl \"%I\"\n"
"```\n"
"\n"
"On Linux:\n"
"```\n"
"xsltproc -o \"%O.bom\" /usr/local/kicad/bin/plugins/netlist_form_pads-pcb.xsl \"%I\"\n"
"```\n"
"\n"
"The above examples assume `xsltproc` is installed on your PC under Windows and xsl files located in `<path_to_kicad>/kicad/bin/plugins/`.\n"
"\n"
"\n"
"### 4.3.3 Example for Python scripts:\n"
"\n"
"Assuming python is installed on your PC, and python scripts are located in\n"
"\n"
" `<path_to_kicad>/kicad/bin/plugins/bom-in-python/`,\n"
"\n"
"the command line format for python is something like:\n"
"\n"
"```\n"
"python <script file name> <input filename> <output filename>\n"
"```\n"
"\n"
"On Windows:\n"
"```\n"
"python.exe f:/kicad/bin/plugins/bom-in-python/my_python_script.py \"%I\" \"%O.html\"\n"
"```\n"
"\n"
"On Linux:\n"
"```\n"
"python /usr/local/kicad/bin/plugins/bom-in-python/my_python_script.py \"%I\" \"%O.csv\"\n"
"```\n"
"" );
+1 -1
View File
@@ -100,7 +100,7 @@ DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS( SCH_EDIT_FRAME* aParent, SCH_SYMBO
for( int i = 0; i < MANDATORY_FIELDS; ++i )
{
m_fieldsBox->Append( TEMPLATE_FIELDNAME::GetDefaultFieldName( i, DO_TRANSLATE ) );
m_fieldsBox->Append( TEMPLATE_FIELDNAME::GetDefaultFieldName( i ) );
if( i == REFERENCE_FIELD )
m_fieldsBox->Check( i, g_selectRefDes );
+6 -51
View File
@@ -49,10 +49,6 @@
#include <string_utils.h>
#include <kiplatform/ui.h>
static SCHEMATIC* g_lastERCSchematic = nullptr;
static bool g_lastERCRun = false;
DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) :
DIALOG_ERC_BASE( parent ),
PROGRESS_REPORTER_BASE( 1 ),
@@ -61,8 +57,6 @@ DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) :
m_ercRun( false ),
m_severities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING )
{
m_currentSchematic = &parent->Schematic();
SetName( DIALOG_ERC_WINDOW_NAME ); // Set a window name to be able to find it
EESCHEMA_SETTINGS* settings = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
@@ -76,9 +70,8 @@ DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) :
m_markerTreeModel->SetSeverities( m_severities );
m_markerTreeModel->SetProvider( m_markerProvider );
if( m_currentSchematic == g_lastERCSchematic )
m_ercRun = g_lastERCRun;
syncCheckboxes();
updateDisplayedCounts();
// We use a sdbSizer to get platform-dependent ordering of the action buttons, but
// that requires us to correct the button labels here.
@@ -88,24 +81,12 @@ DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) :
m_sdbSizer1OK->SetDefault();
m_violationsTitleTemplate = m_notebook->GetPageText( 1 );
// Hack to keep from changing translated string in 6.0.x
m_violationsTitleTemplate.Append( wxT( " (%s)" ) );
m_errorsBadge->SetMaximumNumber( 999 );
m_warningsBadge->SetMaximumNumber( 999 );
m_exclusionsBadge->SetMaximumNumber( 999 );
UpdateAnnotationWarning();
Layout();
SetFocus();
syncCheckboxes();
updateDisplayedCounts();
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();
}
@@ -113,9 +94,6 @@ DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) :
DIALOG_ERC::~DIALOG_ERC()
{
g_lastERCSchematic = m_currentSchematic;
g_lastERCRun = m_ercRun;
EESCHEMA_SETTINGS* settings = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
wxASSERT( settings );
@@ -198,41 +176,18 @@ void DIALOG_ERC::updateDisplayedCounts()
int numWarnings = 0;
int numExcluded = 0;
int numMarkers = 0;
if( m_markerProvider )
{
numMarkers += m_markerProvider->GetCount();
numErrors += m_markerProvider->GetCount( RPT_SEVERITY_ERROR );
numWarnings += m_markerProvider->GetCount( RPT_SEVERITY_WARNING );
numExcluded += m_markerProvider->GetCount( RPT_SEVERITY_EXCLUSION );
}
bool markersOverflowed = false;
// We don't currently have a limit on ERC violations, so the above is always false.
wxString num;
wxString msg;
if( m_ercRun )
if( !m_ercRun )
{
num.Printf( markersOverflowed ? wxT( "%d+" ) : wxT( "%d" ), numMarkers );
msg.Printf( m_violationsTitleTemplate, num );
}
else
{
msg = m_violationsTitleTemplate;
msg.Replace( wxT( "(%s)" ), wxEmptyString );
}
m_notebook->SetPageText( 1, msg );
if( !m_ercRun && numErrors == 0 )
numErrors = -1;
if( !m_ercRun && numWarnings == 0 )
numWarnings = -1;
}
m_errorsBadge->UpdateNumber( numErrors, RPT_SEVERITY_ERROR );
m_warningsBadge->UpdateNumber( numWarnings, RPT_SEVERITY_WARNING );
@@ -266,9 +221,9 @@ void DIALOG_ERC::OnEraseDrcMarkersClick( wxCommandEvent& event )
deleteAllMarkers( includeExclusions );
// redraw the schematic
redrawDrawPanel();
m_ercRun = false;
updateDisplayedCounts();
m_parent->GetCanvas()->Refresh();
}
-3
View File
@@ -91,9 +91,6 @@ private:
private:
SCH_EDIT_FRAME* m_parent;
SCHEMATIC* m_currentSchematic;
wxString m_violationsTitleTemplate;
RC_ITEMS_PROVIDER* m_markerProvider;
RC_TREE_MODEL* m_markerTreeModel;
+1 -1
View File
@@ -309,7 +309,7 @@
</object>
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
<property name="label">Violations (%d)</property>
<property name="label">Violations</property>
<property name="select">0</property>
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
+3 -8
View File
@@ -53,6 +53,8 @@ DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES( SCH_BASE_FRAME* aParent, const
{
wxASSERT( aTextItem );
SetTitle( aTitle );
m_note->SetFont( KIUI::GetInfoFont( this ).Italic() );
m_note->Show( false );
@@ -346,14 +348,7 @@ DIALOG_SCH_FIELD_PROPERTIES::DIALOG_SCH_FIELD_PROPERTIES( SCH_BASE_FRAME* aParen
m_isPower = false;
wxString translated_fieldname;
if( m_field->GetId() < MANDATORY_FIELDS )
translated_fieldname = TEMPLATE_FIELDNAME::GetDefaultFieldName( m_field->GetId(), DO_TRANSLATE );
else
translated_fieldname = m_field->GetName();
m_textLabel->SetLabel( translated_fieldname + ":" );
m_textLabel->SetLabel( m_field->GetName() + wxT( ":" ) );
m_position = m_field->GetPosition();
@@ -109,6 +109,10 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS( SCH_
m_parent = parent;
m_appendUndo = false;
// TODO(JE) remove once real-time connectivity is a given
if( !ADVANCED_CFG::GetCfg().m_RealTimeConnectivity || !CONNECTION_GRAPH::m_allowRealTime )
m_parent->RecalculateConnections( NO_CLEANUP );
m_lineStyle->Append( DEFAULT_STYLE );
m_lineStyle->Append( INDETERMINATE_ACTION );
@@ -132,7 +132,7 @@ public:
val = StringFromValue( aUserUnits, pin->GetPosition().x, true );
break;
case COL_POSY:
val = StringFromValue( aUserUnits, -pin->GetPosition().y, true );
val = StringFromValue( aUserUnits, pin->GetPosition().y, true );
break;
case COL_VISIBLE:
val = StringFromBool( pin->IsVisible() );
@@ -216,7 +216,7 @@ public:
case COL_POSY:
pin->SetPosition( wxPoint( pin->GetPosition().x,
-ValueFromString( m_frame->GetUserUnits(), aValue ) ) );
ValueFromString( m_frame->GetUserUnits(), aValue ) ) );
break;
case COL_VISIBLE:
@@ -556,9 +556,7 @@ DIALOG_LIB_EDIT_PIN_TABLE::~DIALOG_LIB_EDIT_PIN_TABLE()
bool DIALOG_LIB_EDIT_PIN_TABLE::TransferDataToWindow()
{
// Make a copy of the pins for editing
std::vector<LIB_PIN*> pins = m_part->GetAllLibPins();
for( LIB_PIN* pin : pins )
for( LIB_PIN* pin = m_part->GetNextPin( nullptr ); pin; pin = m_part->GetNextPin( pin ) )
m_pins.push_back( new LIB_PIN( *pin ) );
m_dataModel->RebuildRows( m_pins, m_cbGroup->GetValue() );
@@ -575,9 +573,7 @@ bool DIALOG_LIB_EDIT_PIN_TABLE::TransferDataFromWindow()
return false;
// Delete the part's pins
std::vector<LIB_PIN*> pins = m_part->GetAllLibPins();
for( LIB_PIN* pin : pins )
while( LIB_PIN* pin = m_part->GetNextPin( nullptr ) )
m_part->RemoveDrawItem( pin );
// Transfer our pins to the part
@@ -28,7 +28,7 @@
#include <dialog_lib_text_properties.h>
#include <symbol_editor/symbol_editor_settings.h>
#include <tools/symbol_editor_drawing_tools.h>
#include "confirm.h"
DIALOG_LIB_TEXT_PROPERTIES::DIALOG_LIB_TEXT_PROPERTIES( SYMBOL_EDIT_FRAME* aParent,
LIB_TEXT* aText ) :
@@ -116,15 +116,9 @@ bool DIALOG_LIB_TEXT_PROPERTIES::TransferDataFromWindow()
if( m_graphicText )
{
if( m_TextCtrl->GetValue().IsEmpty() )
{
// Other text items do not have defined extents, and so will disappear if empty
DisplayError( this, _( "Value may not be empty." ) );
return false;
}
m_graphicText->SetText( wxT( "[null]" ) );
else
{
m_graphicText->SetText( m_TextCtrl->GetValue() );
}
m_graphicText->SetPosition( wxPoint( m_posX.GetValue(), m_posY.GetValue() ) );
+22 -40
View File
@@ -83,8 +83,8 @@ public:
* @param title is the title of the notebook page.
* @param id_NetType is the netlist ID type.
*/
NETLIST_PAGE_DIALOG( wxNotebook* aParent, const wxString& aTitle,
NETLIST_TYPE_ID aIdNetType, bool aCustom );
NETLIST_PAGE_DIALOG( wxNotebook* parent, const wxString& title,
NETLIST_TYPE_ID id_NetType );
~NETLIST_PAGE_DIALOG() { };
/**
@@ -102,12 +102,8 @@ public:
wxBoxSizer* m_RightOptionsBoxSizer;
wxBoxSizer* m_LowBoxSizer;
bool IsCustom() const { return m_custom; }
private:
wxString m_pageNetFmtName;
bool m_custom;
};
@@ -129,8 +125,6 @@ private:
bool TransferDataFromWindow() override;
void NetlistUpdateOpt();
void updateGeneratorButtons();
// Called when changing the notebook page (and therefore the current netlist format)
void OnNetlistTypeSelection( wxNotebookEvent& event ) override;
@@ -212,18 +206,17 @@ BEGIN_EVENT_TABLE( NETLIST_DIALOG, NETLIST_DIALOG_BASE )
END_EVENT_TABLE()
NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* aParent, const wxString& aTitle,
NETLIST_TYPE_ID aIdNetType, bool aCustom ) :
wxPanel( aParent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL )
NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent, const wxString& title,
NETLIST_TYPE_ID id_NetType ) :
wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL )
{
m_IdNetType = aIdNetType;
m_pageNetFmtName = aTitle;
m_IdNetType = id_NetType;
m_pageNetFmtName = title;
m_CommandStringCtrl = nullptr;
m_TitleStringCtrl = nullptr;
m_AdjustPassiveValues = nullptr;
m_custom = aCustom;
aParent->AddPage( this, aTitle, false );
parent->AddPage( this, title, false );
wxBoxSizer* MainBoxSizer = new wxBoxSizer( wxVERTICAL );
SetSizer( MainBoxSizer );
@@ -252,14 +245,14 @@ NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) :
page = nullptr;
// Add notebook pages:
m_PanelNetType[PANELPCBNEW] =
new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "KiCad" ), NET_TYPE_PCBNEW, false );
m_PanelNetType[PANELPCBNEW] = new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "KiCad" ),
NET_TYPE_PCBNEW );
m_PanelNetType[PANELORCADPCB2] =
new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "OrcadPCB2" ), NET_TYPE_ORCADPCB2, false );
m_PanelNetType[PANELORCADPCB2] = new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "OrcadPCB2" ),
NET_TYPE_ORCADPCB2 );
m_PanelNetType[PANELCADSTAR] =
new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "CadStar" ), NET_TYPE_CADSTAR, false );
m_PanelNetType[PANELCADSTAR] = new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "CadStar" ),
NET_TYPE_CADSTAR );
InstallPageSpice();
InstallCustomPages();
@@ -282,8 +275,6 @@ NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) :
// Now all widgets have the size fixed, call FinishDialogSettings
finishDialogSettings();
updateGeneratorButtons();
}
@@ -329,7 +320,7 @@ void NETLIST_DIALOG::OnRunSpiceButtUI( wxUpdateUIEvent& aEvent )
void NETLIST_DIALOG::InstallPageSpice()
{
NETLIST_PAGE_DIALOG* page = m_PanelNetType[PANELSPICE] =
new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "Spice" ), NET_TYPE_SPICE, false );
new NETLIST_PAGE_DIALOG( m_NoteBook, wxT( "Spice" ), NET_TYPE_SPICE );
SCHEMATIC_SETTINGS& settings = m_Parent->Schematic().Settings();
@@ -394,7 +385,7 @@ NETLIST_PAGE_DIALOG* NETLIST_DIALOG::AddOneCustomPage( const wxString& aTitle,
const wxString& aCommandString,
NETLIST_TYPE_ID aNetTypeId )
{
NETLIST_PAGE_DIALOG* currPage = new NETLIST_PAGE_DIALOG( m_NoteBook, aTitle, aNetTypeId, true );
NETLIST_PAGE_DIALOG* currPage = new NETLIST_PAGE_DIALOG( m_NoteBook, aTitle, aNetTypeId );
currPage->m_LowBoxSizer->Add( new wxStaticText( currPage, -1, _( "Title:" ) ), 0,
wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
@@ -422,7 +413,12 @@ NETLIST_PAGE_DIALOG* NETLIST_DIALOG::AddOneCustomPage( const wxString& aTitle,
void NETLIST_DIALOG::OnNetlistTypeSelection( wxNotebookEvent& event )
{
updateGeneratorButtons();
NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
if( currPage == nullptr )
return;
m_buttonDelGenerator->Enable( currPage->m_IdNetType >= NET_TYPE_CUSTOM1 );
}
@@ -592,9 +588,6 @@ void NETLIST_DIALOG::OnDelGenerator( wxCommandEvent& event )
{
NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
if( !currPage->IsCustom() )
return;
currPage->m_CommandStringCtrl->SetValue( wxEmptyString );
currPage->m_TitleStringCtrl->SetValue( wxEmptyString );
@@ -719,17 +712,6 @@ void NETLIST_DIALOG_ADD_GENERATOR::OnBrowseGenerators( wxCommandEvent& event )
}
void NETLIST_DIALOG::updateGeneratorButtons()
{
NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
if( currPage == nullptr )
return;
m_buttonDelGenerator->Enable( currPage->IsCustom() );
}
int InvokeDialogNetList( SCH_EDIT_FRAME* aCaller )
{
NETLIST_DIALOG dlg( aCaller );
+3 -4
View File
@@ -4,7 +4,7 @@
* Copyright (C) 1992-2018 Jean-Pierre Charras jp.charras at wanadoo.fr
* Copyright (C) 1992-2010 Lorenzo Marcantonio
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -38,7 +38,6 @@
#include <trace_helpers.h>
#include <settings/settings_manager.h>
#include <drawing_sheet/ds_painter.h>
#include <wx_filename.h>
#include <sch_edit_frame.h>
#include <sch_painter.h>
@@ -1284,7 +1283,7 @@ wxString DIALOG_PLOT_SCHEMATIC::getOutputPath()
fn.SetName( wxEmptyString );
fn.SetExt( wxEmptyString );
if( fn.Normalize( FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS ) )
if( fn.Normalize() )
{
path = fn.GetPath();
}
@@ -1319,7 +1318,7 @@ wxString DIALOG_PLOT_SCHEMATIC::getOutputPath()
// Build the absolute path of current output directory and the project path.
fn.SetPath( Prj().GetProjectPath() + path );
if( fn.Normalize( FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS ) )
if( fn.Normalize() )
{
path = fn.GetPath();
}
@@ -409,11 +409,6 @@ bool SCH_PRINTOUT::OnBeginDocument( int startPage, int endPage )
*/
void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen )
{
// Warning:
// When printing many pages, changes in the current wxDC will affect all next printings
// because all prints are using the same wxPrinterDC after creation
// So be careful and reinit parameters, especially when using offsets.
wxPoint tmp_startvisu;
wxSize pageSizeIU; // Page size in internal units
wxPoint old_org;
@@ -444,31 +439,16 @@ void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen )
int xoffset = ( fitRect.width - pageSizeIU.x ) / 2;
int yoffset = ( fitRect.height - pageSizeIU.y ) / 2;
// Using a wxAffineMatrix2D has a big advantage: it handles different pages orientations
//(PORTRAIT/LANDSCAPE), but the affine matrix is not always supported
if( dc->CanUseTransformMatrix() )
{
wxAffineMatrix2D matrix; // starts from a unity matrix (the current wxDC default)
wxAffineMatrix2D matrix = dc->GetTransformMatrix();
// Check for portrait/landscape mismatch:
if( ( fitRect.width > fitRect.height ) != ( pageSizeIU.x > pageSizeIU.y ) )
{
// Rotate the coordinates, and keep the draw coordinates inside the page
matrix.Rotate( M_PI_2 );
matrix.Translate( 0, -pageSizeIU.y );
// Recalculate the offsets and page sizes according to the page rotation
std::swap( pageSizeIU.x, pageSizeIU.y );
FitThisSizeToPaper( pageSizeIU );
fitRect = GetLogicalPaperRect();
xoffset = ( fitRect.width - pageSizeIU.x ) / 2;
yoffset = ( fitRect.height - pageSizeIU.y ) / 2;
// All the coordinates will be rotated 90 deg when printing,
// so the X,Y offset vector must be rotated -90 deg before printing
std::swap( xoffset, yoffset );
yoffset = -yoffset;
xoffset = ( fitRect.height - pageSizeIU.x ) / 2;
yoffset = ( fitRect.width - pageSizeIU.y ) / 2;
}
matrix.Translate( xoffset, yoffset );
@@ -476,8 +456,12 @@ void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen )
}
else
{
SetLogicalOrigin( 0, 0 ); // Reset all offset settings made previously.
// When printing previous pages (all prints are using the same wxDC)
// wxWidgets appears to have a bug when OffsetLogicalOrigin()'s yoffset changes from
// page to page.
// NB: this is a workaround, not a fix. The Y centering will be off, but this is less
// annoying than a blank page. See https://bugs.launchpad.net/kicad/+bug/1464773.
yoffset = 0;
OffsetLogicalOrigin( xoffset, yoffset );
}
+1 -3
View File
@@ -29,7 +29,6 @@
#include <wx/tooltip.h>
#include <confirm.h>
#include <validators.h>
#include <wx_filename.h>
#include <wildcards_and_files_ext.h>
#include <widgets/tab_traversal.h>
#include <sch_edit_frame.h>
@@ -426,8 +425,7 @@ bool DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged( const wxString& aNewFilena
// SCH_SCREEN file names are always absolute.
wxFileName currentScreenFileName = currentScreen->GetFileName();
if( !screenFileName.Normalize( FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS,
currentScreenFileName.GetPath() ) )
if( !screenFileName.Normalize( wxPATH_NORM_ALL, currentScreenFileName.GetPath() ) )
{
msg = wxString::Format( _( "Cannot normalize new sheet schematic file path:\n"
"'%s'\n"
@@ -233,10 +233,6 @@ public:
if( aCol == QUANTITY_COLUMN )
return _( "Qty" );
else if( aCol < MANDATORY_FIELDS )
// FIX ME: the column label should be displayed translated.
// but when translated, and the DATASHEET column is shown, a new field
// with the translated DATASHEET field name is added when saving fields
// return TEMPLATE_FIELDNAME::GetDefaultFieldName( aCol, DO_TRANSLATE );
return TEMPLATE_FIELDNAME::GetDefaultFieldName( aCol );
else
return m_fieldNames[ aCol ];
@@ -619,21 +615,19 @@ public:
const wxString& srcValue = srcData.second;
SCH_FIELD* destField = symbol.FindField( srcName );
// Add a not existing field if it has a value for this symbol
bool createField = !destField && !srcValue.IsEmpty();
if( createField )
if( !destField && !srcValue.IsEmpty() )
{
const wxPoint symbolPos = symbol.GetPosition();
destField = symbol.AddField( SCH_FIELD( symbolPos, -1, &symbol, srcName ) );
}
if( !destField )
continue;
if( destField->GetId() == REFERENCE_FIELD )
{
// Reference is not editable from this dialog
symbol.RemoveField( srcName );
}
else if( destField->GetId() == REFERENCE_FIELD )
{
// Reference is not editable
}
else if( destField->GetId() == VALUE_FIELD )
{
@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 Oliver Walters
* Copyright (C) 2017-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017-2021 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
@@ -74,8 +74,6 @@ private:
SCH_REFERENCE_LIST m_symbolsList;
FIELDS_EDITOR_GRID_DATA_MODEL* m_dataModel;
static int m_newFieldsOption; // Store the option choice for new fields
// during a session:
};
#endif /* DIALOG_SYMBOL_FIELDS_TABLE_H */
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c5)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -32,7 +32,7 @@ DIALOG_SYMBOL_FIELDS_TABLE_BASE::DIALOG_SYMBOL_FIELDS_TABLE_BASE( wxWindow* pare
m_groupSymbolsBox->SetValue(true);
m_groupSymbolsBox->SetToolTip( _("Group symbols together based on common properties") );
bGroupSizer->Add( m_groupSymbolsBox, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
bGroupSizer->Add( m_groupSymbolsBox, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT, 5 );
bGroupSizer->Add( 0, 0, 1, wxEXPAND|wxRIGHT|wxLEFT, 10 );
@@ -103,7 +103,7 @@ DIALOG_SYMBOL_FIELDS_TABLE_BASE::DIALOG_SYMBOL_FIELDS_TABLE_BASE( wxWindow* pare
bButtonsSizer->Add( 0, 0, 1, wxEXPAND, 5 );
m_buttonApply = new wxButton( this, wxID_ANY, _("Apply, Save Schematic && Continue"), wxDefaultPosition, wxDefaultSize, 0 );
bButtonsSizer->Add( m_buttonApply, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
bButtonsSizer->Add( m_buttonApply, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT, 5 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
@@ -112,10 +112,10 @@ DIALOG_SYMBOL_FIELDS_TABLE_BASE::DIALOG_SYMBOL_FIELDS_TABLE_BASE( wxWindow* pare
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
bButtonsSizer->Add( m_sdbSizer, 0, wxEXPAND|wxLEFT, 5 );
bButtonsSizer->Add( m_sdbSizer, 0, wxBOTTOM|wxEXPAND|wxLEFT, 5 );
bMainSizer->Add( bButtonsSizer, 0, wxBOTTOM|wxEXPAND|wxTOP, 5 );
bMainSizer->Add( bButtonsSizer, 0, wxEXPAND, 5 );
this->SetSizer( bMainSizer );
@@ -191,7 +191,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
@@ -603,7 +603,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxTOP</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
@@ -622,7 +622,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
@@ -696,7 +696,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxLEFT</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="1">
<property name="Apply">0</property>
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c5)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
+4 -38
View File
@@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2004-2021 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
@@ -89,14 +89,6 @@ public:
void BuildAttrs()
{
for( wxGridCellAttr* attr : m_nameAttrs )
attr->DecRef();
m_nameAttrs.clear();
if( m_readOnlyAttr )
m_readOnlyAttr->DecRef();
m_readOnlyAttr = new wxGridCellAttr;
m_readOnlyAttr->SetReadOnly( true );
@@ -125,17 +117,11 @@ public:
m_nameAttrs.push_back( attr );
}
if( m_typeAttr )
m_typeAttr->DecRef();
m_typeAttr = new wxGridCellAttr;
m_typeAttr->SetRenderer( new GRID_CELL_ICON_TEXT_RENDERER( PinTypeIcons(),
PinTypeNames() ) );
m_typeAttr->SetReadOnly( true );
if( m_shapeAttr )
m_shapeAttr->DecRef();
m_shapeAttr = new wxGridCellAttr;
m_shapeAttr->SetRenderer( new GRID_CELL_ICON_TEXT_RENDERER( PinShapeIcons(),
PinShapeNames() ) );
@@ -758,14 +744,8 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
}
else
{
SCH_FIELD newField( m_fields->at( ii ) );
const_cast<KIID&>( newField.m_Uuid ) = KIID();
newField.Offset( -m_symbol->GetPosition() );
newField.Offset( otherUnit->GetPosition() );
newField.SetParent( otherUnit );
otherUnit->AddField( newField );
SCH_FIELD* newField = otherUnit->AddField( m_fields->at( ii ) );
const_cast<KIID&>( newField->m_Uuid ) = KIID();
}
}
@@ -867,7 +847,7 @@ void DIALOG_SYMBOL_PROPERTIES::OnAddField( wxCommandEvent& event )
SCHEMATIC_SETTINGS& settings = m_symbol->Schematic()->Settings();
int fieldID = m_fields->size();
SCH_FIELD newField( wxPoint( 0, 0 ), fieldID, m_symbol,
TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldID, DO_TRANSLATE ) );
TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldID ) );
newField.SetTextAngle( m_fields->at( REFERENCE_FIELD ).GetTextAngle() );
newField.SetTextSize( wxSize( settings.m_DefaultTextSize, settings.m_DefaultTextSize ) );
@@ -1044,7 +1024,6 @@ void DIALOG_SYMBOL_PROPERTIES::OnPinTableColSort( wxGridEvent& aEvent )
ascending = true;
m_dataModel->SortRows( sortCol, ascending );
m_dataModel->BuildAttrs();
}
@@ -1160,16 +1139,3 @@ void DIALOG_SYMBOL_PROPERTIES::OnChoice( wxCommandEvent& event )
{
OnModify();
}
void DIALOG_SYMBOL_PROPERTIES::onUpdateEditSymbol( wxUpdateUIEvent& event )
{
event.Enable( m_symbol && m_symbol->GetLibSymbolRef() );
}
void DIALOG_SYMBOL_PROPERTIES::onUpdateEditLibrarySymbol( wxUpdateUIEvent& event )
{
event.Enable( m_symbol && m_symbol->GetLibSymbolRef() );
}
+1 -4
View File
@@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2021 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
@@ -88,9 +88,6 @@ private:
void OnUpdateSymbol( wxCommandEvent& ) override;
void OnExchangeSymbol( wxCommandEvent& ) override;
virtual void onUpdateEditSymbol( wxUpdateUIEvent& event ) override;
virtual void onUpdateEditLibrarySymbol( wxUpdateUIEvent& event ) override;
void AdjustGridColumns( int aWidth );
private:
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c5)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -49,6 +49,7 @@ DIALOG_SYMBOL_PROPERTIES_BASE::DIALOG_SYMBOL_PROPERTIES_BASE( wxWindow* parent,
m_fieldsGrid->SetColSize( 10, 84 );
m_fieldsGrid->EnableDragColMove( false );
m_fieldsGrid->EnableDragColSize( true );
m_fieldsGrid->SetColLabelSize( 22 );
m_fieldsGrid->SetColLabelValue( 0, _("Name") );
m_fieldsGrid->SetColLabelValue( 1, _("Value") );
m_fieldsGrid->SetColLabelValue( 2, _("Show") );
@@ -60,7 +61,6 @@ DIALOG_SYMBOL_PROPERTIES_BASE::DIALOG_SYMBOL_PROPERTIES_BASE( wxWindow* parent,
m_fieldsGrid->SetColLabelValue( 8, _("Orientation") );
m_fieldsGrid->SetColLabelValue( 9, _("X Position") );
m_fieldsGrid->SetColLabelValue( 10, _("Y Position") );
m_fieldsGrid->SetColLabelSize( 22 );
m_fieldsGrid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
@@ -260,12 +260,12 @@ DIALOG_SYMBOL_PROPERTIES_BASE::DIALOG_SYMBOL_PROPERTIES_BASE( wxWindow* parent,
m_pinGrid->SetColSize( 4, 140 );
m_pinGrid->EnableDragColMove( false );
m_pinGrid->EnableDragColSize( true );
m_pinGrid->SetColLabelSize( 24 );
m_pinGrid->SetColLabelValue( 0, _("Pin Number") );
m_pinGrid->SetColLabelValue( 1, _("Base Pin Name") );
m_pinGrid->SetColLabelValue( 2, _("Alternate Assignment") );
m_pinGrid->SetColLabelValue( 3, _("Electrical Type") );
m_pinGrid->SetColLabelValue( 4, _("Graphic Style") );
m_pinGrid->SetColLabelSize( 24 );
m_pinGrid->SetColLabelAlignment( wxALIGN_CENTER, wxALIGN_CENTER );
// Rows
@@ -353,9 +353,7 @@ DIALOG_SYMBOL_PROPERTIES_BASE::DIALOG_SYMBOL_PROPERTIES_BASE( wxWindow* parent,
m_updateSymbolBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnUpdateSymbol ), NULL, this );
m_changeSymbolBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnExchangeSymbol ), NULL, this );
m_editSchematicSymbolBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnEditSymbol ), NULL, this );
m_editSchematicSymbolBtn->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::onUpdateEditSymbol ), NULL, this );
m_editLibrarySymbolBtn->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnEditLibrarySymbol ), NULL, this );
m_editLibrarySymbolBtn->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::onUpdateEditLibrarySymbol ), NULL, this );
m_pinGrid->Connect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnPinTableCellEdited ), NULL, this );
m_spiceFieldsButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnEditSpiceModel ), NULL, this );
m_stdDialogButtonSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnCancelButtonClick ), NULL, this );
@@ -383,9 +381,7 @@ DIALOG_SYMBOL_PROPERTIES_BASE::~DIALOG_SYMBOL_PROPERTIES_BASE()
m_updateSymbolBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnUpdateSymbol ), NULL, this );
m_changeSymbolBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnExchangeSymbol ), NULL, this );
m_editSchematicSymbolBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnEditSymbol ), NULL, this );
m_editSchematicSymbolBtn->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::onUpdateEditSymbol ), NULL, this );
m_editLibrarySymbolBtn->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnEditLibrarySymbol ), NULL, this );
m_editLibrarySymbolBtn->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::onUpdateEditLibrarySymbol ), NULL, this );
m_pinGrid->Disconnect( wxEVT_GRID_CELL_CHANGED, wxGridEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnPinTableCellEdited ), NULL, this );
m_spiceFieldsButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnEditSpiceModel ), NULL, this );
m_stdDialogButtonSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SYMBOL_PROPERTIES_BASE::OnCancelButtonClick ), NULL, this );
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="16" />
<FileVersion major="1" minor="15" />
<object class="Project" expanded="1">
<property name="class_decoration">; </property>
<property name="code_generation">C++</property>
@@ -14,7 +14,6 @@
<property name="file">dialog_symbol_properties_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">dialog_edit_component_in_schematic_base</property>
@@ -26,7 +25,6 @@
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
@@ -52,7 +50,6 @@
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Symbol Properties</property>
<property name="tooltip"></property>
<property name="two_step_creation">0</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
@@ -304,7 +301,6 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@@ -378,7 +374,6 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@@ -452,7 +447,6 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@@ -536,7 +530,6 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@@ -1436,7 +1429,6 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@@ -1510,7 +1502,6 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@@ -1584,7 +1575,6 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@@ -1643,7 +1633,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnEditSymbol</event>
<event name="OnUpdateUI">onUpdateEditSymbol</event>
</object>
</object>
<object class="sizeritem" expanded="1">
@@ -1669,7 +1658,6 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@@ -1728,7 +1716,6 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnEditLibrarySymbol</event>
<event name="OnUpdateUI">onUpdateEditLibrarySymbol</event>
</object>
</object>
</object>
@@ -2071,7 +2058,6 @@
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="auth_needed">0</property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.0-4761b0c5)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@@ -77,7 +77,7 @@ class DIALOG_SYMBOL_PROPERTIES_BASE : public DIALOG_SHIM
wxButton* m_stdDialogButtonSizerOK;
wxButton* m_stdDialogButtonSizerCancel;
// Virtual event handlers, override them in your derived class
// Virtual event handlers, overide them in your derived class
virtual void OnInitDlg( wxInitDialogEvent& event ) { event.Skip(); }
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnGridEditorShown( wxGridEvent& event ) { event.Skip(); }
@@ -91,9 +91,7 @@ class DIALOG_SYMBOL_PROPERTIES_BASE : public DIALOG_SHIM
virtual void OnUpdateSymbol( wxCommandEvent& event ) { event.Skip(); }
virtual void OnExchangeSymbol( wxCommandEvent& event ) { event.Skip(); }
virtual void OnEditSymbol( wxCommandEvent& event ) { event.Skip(); }
virtual void onUpdateEditSymbol( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnEditLibrarySymbol( wxCommandEvent& event ) { event.Skip(); }
virtual void onUpdateEditLibrarySymbol( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnPinTableCellEdited( wxGridEvent& event ) { event.Skip(); }
virtual void OnEditSpiceModel( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); }
@@ -102,7 +100,6 @@ class DIALOG_SYMBOL_PROPERTIES_BASE : public DIALOG_SHIM
public:
DIALOG_SYMBOL_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Symbol Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
~DIALOG_SYMBOL_PROPERTIES_BASE();
};
+2 -3
View File
@@ -6,7 +6,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2017 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2017-2022 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -29,7 +29,6 @@
#include <confirm.h>
#include <reporter.h>
#include <wildcards_and_files_ext.h>
#include <wx_filename.h>
#include <wx_html_report_panel.h>
#include <symbol_library.h>
@@ -202,7 +201,7 @@ void DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable( REPORTER& aReporter )
wxFileName tmpFn = fullFileName;
// Don't add symbol libraries that do not exist.
if( tmpFn.Normalize( FN_NORMALIZE_FLAGS | wxPATH_NORM_ENV_VARS ) && tmpFn.FileExists() )
if( tmpFn.Normalize() && tmpFn.FileExists() )
{
msg.Printf( _( "Adding library '%s', file '%s' to project symbol library table." ),
libName,
@@ -47,7 +47,7 @@ DIALOG_UPDATE_SYMBOL_FIELDS::DIALOG_UPDATE_SYMBOL_FIELDS( SYMBOL_EDIT_FRAME* aPa
for( int i = 0; i < MANDATORY_FIELDS; ++i )
{
m_fieldsBox->Append( TEMPLATE_FIELDNAME::GetDefaultFieldName( i, DO_TRANSLATE ) );
m_fieldsBox->Append( TEMPLATE_FIELDNAME::GetDefaultFieldName( i ) );
m_fieldsBox->Check( i, true );
}
+1 -17
View File
@@ -321,20 +321,7 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProje
ext == KiCadSchematicFileExtension + BackupFileSuffix )
{
if( destFile.GetName() == aProjectName )
{
destFile.SetName( aNewProjectName );
}
else if( destFile.GetName() == aNewProjectName )
{
wxString msg;
if( !aErrors.empty() )
aErrors += "\n";
msg.Printf( _( "Cannot copy file '%s'." ), destFile.GetFullPath() );
aErrors += msg;
return;
}
// Sheet paths when auto-generated are relative to the root, so those will stay
// pointing to whatever they were pointing at.
@@ -356,10 +343,7 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProje
ext == KiCadSymbolLibFileExtension )
{
if( destFile.GetName() == aProjectName + wxT( "-cache" ) )
destFile.SetName( aNewProjectName + wxT( "-cache" ) );
if( destFile.GetName() == aProjectName + wxT( "-rescue" ) )
destFile.SetName( aNewProjectName + wxT( "-rescue" ) );
destFile.SetName( aNewProjectName + wxT( "-cache" ) );
KiCopyFile( aSrcFilePath, destFile.GetFullPath(), aErrors );
}
+1 -1
View File
@@ -389,7 +389,7 @@ wxString FIELDS_GRID_TABLE<T>::GetValue( int aRow, int aCol )
if( aRow < m_mandatoryFieldCount )
{
if( m_parentType == SCH_SYMBOL_T )
return TEMPLATE_FIELDNAME::GetDefaultFieldName( aRow, DO_TRANSLATE );
return TEMPLATE_FIELDNAME::GetDefaultFieldName( aRow );
else if( m_parentType == SCH_SHEET_T )
return SCH_SHEET::GetDefaultFieldName( aRow );
}
+7 -12
View File
@@ -4,7 +4,7 @@
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2013 CERN (www.cern.ch)
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2021 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
@@ -489,6 +489,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
{
DIALOG_MIGRATE_BUSES dlg( this );
dlg.ShowQuasiModal();
RecalculateConnections( NO_CLEANUP );
OnModify();
}
@@ -515,8 +516,6 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
SyncView();
GetScreen()->ClearDrawingState();
TestDanglingEnds();
UpdateHierarchyNavigator();
UpdateTitle();
@@ -625,8 +624,7 @@ void SCH_EDIT_FRAME::OnImportProject( wxCommandEvent& aEvent )
allWildcards += "*." + formatWildcardExt( plugin->GetFileExtension() ) + ";";
}
fileFilters = _( "All supported formats" ) + wxS( "|" ) + allWildcards + wxS( "|" ) +
fileFilters;
fileFilters = _( "All supported formats|" ) + allWildcards + "|" + fileFilters;
wxFileDialog dlg( this, _( "Import Schematic" ), path, wxEmptyString, fileFilters,
wxFD_OPEN | wxFD_FILE_MUST_EXIST ); // TODO
@@ -1421,17 +1419,12 @@ void SCH_EDIT_FRAME::CheckForAutoSaveFile( const wxFileName& aFileName )
" Auto save file: '%s'" ),
recoveredFn.GetFullPath(), backupFn.GetFullPath(), fn );
if( !wxFileExists( fn ) )
{
unrecoveredFiles.Add( recoveredFn.GetFullPath() );
}
// Attempt to back up the last schematic file before overwriting it with the auto
// save file.
else if( !wxCopyFile( recoveredFn.GetFullPath(), backupFn.GetFullPath() ) )
if( !wxCopyFile( recoveredFn.GetFullPath(), backupFn.GetFullPath() ) )
{
unrecoveredFiles.Add( recoveredFn.GetFullPath() );
}
// Attempt to replace last saved file with auto save file
else if( !wxRenameFile( fn, recoveredFn.GetFullPath() ) )
{
unrecoveredFiles.Add( recoveredFn.GetFullPath() );
@@ -1459,8 +1452,10 @@ void SCH_EDIT_FRAME::CheckForAutoSaveFile( const wxFileName& aFileName )
{
wxLogTrace( traceAutoSave, wxT( "Removing auto save file " ) + fn );
if( wxFileExists( fn ) && !wxRemoveFile( fn ) )
if( !wxRemoveFile( fn ) )
{
unremovedFiles.Add( fn );
}
}
if( !unremovedFiles.IsEmpty() )
+4 -5
View File
@@ -403,11 +403,10 @@ wxString LIB_FIELD::GetCanonicalName() const
{
switch( m_id )
{
case REFERENCE_FIELD:
case VALUE_FIELD:
case FOOTPRINT_FIELD:
case DATASHEET_FIELD:
return TEMPLATE_FIELDNAME::GetDefaultFieldName( m_id );
case REFERENCE_FIELD: return wxT( "Reference" );
case VALUE_FIELD: return wxT( "Value" );
case FOOTPRINT_FIELD: return wxT( "Footprint" );
case DATASHEET_FIELD: return wxT( "Datasheet" );
}
return m_name;
+1 -1
View File
@@ -85,7 +85,7 @@ public:
void Init( int aId );
/**
* Return the field name (not translated).
* Return the field name.
*
* The first four field IDs are reserved and therefore always return their respective
* names.
+2 -2
View File
@@ -3,7 +3,7 @@
*
* Copyright (C) 2015 Jean-Pierre Charras, jaen-pierre.charras at wanadoo.fr
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2004-2022 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2021 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
@@ -49,7 +49,7 @@ void LIB_ITEM::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
if( m_unit == 0 )
msg = _( "All" );
else
msg = LIB_SYMBOL::SubReference( m_unit, false );
msg.Printf( wxT( "%d" ), m_unit );
aList.emplace_back( _( "Unit" ), msg );
+1 -1
View File
@@ -886,7 +886,7 @@ int LIB_PIN::compare( const LIB_ITEM& aOther, int aCompareFlags ) const
if( !( aCompareFlags & COMPARE_FLAGS::UNIT ) && m_number != tmp->m_number )
return m_number.Cmp( tmp->m_number );
int result = m_name.Cmp( tmp->m_name );
int result = m_name.CmpNoCase( tmp->m_name );
if( result )
return result;
+36 -27
View File
@@ -500,9 +500,7 @@ wxString LIB_SYMBOL::SubReference( int aUnit, bool aAddSeparator )
subRef << wxChar( m_subpartIdSeparator );
if( m_subpartFirstId >= '0' && m_subpartFirstId <= '9' )
{
subRef << aUnit;
}
else
{
// use letters as notation. To allow more than 26 units, the sub ref
@@ -526,7 +524,7 @@ wxString LIB_SYMBOL::SubReference( int aUnit, bool aAddSeparator )
}
void LIB_SYMBOL::PrintBackground( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
void LIB_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
int aUnit, int aConvert, const LIB_SYMBOL_OPTIONS& aOpts )
{
/* draw background for filled items using background option
@@ -553,12 +551,6 @@ void LIB_SYMBOL::PrintBackground( const RENDER_SETTINGS* aSettings, const wxPoin
}
}
}
}
void LIB_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const wxPoint& aOffset, int aUnit,
int aConvert, const LIB_SYMBOL_OPTIONS& aOpts )
{
for( LIB_ITEM& item : m_drawings )
{
@@ -732,6 +724,35 @@ void LIB_SYMBOL::AddDrawItem( LIB_ITEM* aItem, bool aSort )
}
LIB_ITEM* LIB_SYMBOL::GetNextDrawItem( const LIB_ITEM* aItem, KICAD_T aType )
{
if( aItem == nullptr )
{
LIB_ITEMS_CONTAINER::ITERATOR it1 = m_drawings.begin( aType );
return (it1 != m_drawings.end( aType ) ) ? &( *( m_drawings.begin( aType ) ) ) : nullptr;
}
// Search for the last item, assume aItem is of type aType
wxASSERT( ( aType == TYPE_NOT_INIT ) || ( aType == aItem->Type() ) );
LIB_ITEMS_CONTAINER::ITERATOR it = m_drawings.begin( aType );
while( ( it != m_drawings.end( aType ) ) && ( aItem != &( *it ) ) )
++it;
// Search the next item
if( it != m_drawings.end( aType ) )
{
++it;
if( it != m_drawings.end( aType ) )
return &( *it );
}
return nullptr;
}
void LIB_SYMBOL::GetPins( LIB_PINS& aList, int aUnit, int aConvert ) const
{
/* Notes:
@@ -759,15 +780,6 @@ void LIB_SYMBOL::GetPins( LIB_PINS& aList, int aUnit, int aConvert ) const
}
std::vector<LIB_PIN*> LIB_SYMBOL::GetAllLibPins() const
{
std::vector<LIB_PIN*> pinList;
GetPins( pinList, 0, 0 );
return pinList;
}
LIB_PIN* LIB_SYMBOL::GetPin( const wxString& aNumber, int aUnit, int aConvert ) const
{
LIB_PINS pinList;
@@ -920,16 +932,13 @@ const EDA_RECT LIB_SYMBOL::GetBodyBoundingBox( int aUnit, int aConvert, bool aIn
{
const LIB_PIN& pin = static_cast<const LIB_PIN&>( item );
if( pin.IsVisible() )
{
// Note: the roots of the pins are always included for symbols that don't have
// a well-defined body.
// Note: the roots of the pins are always included for symbols that don't have a
// well-defined body.
if( aIncludePins )
bbox.Merge( pin.GetBoundingBox( false, true ) );
else
bbox.Merge( pin.GetPinRoot() );
}
if( aIncludePins && pin.IsVisible() )
bbox.Merge( pin.GetBoundingBox( false, true ) );
else
bbox.Merge( pin.GetPinRoot() );
}
else
{

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