Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2194f99341 |
+1
-1
@@ -6,7 +6,7 @@ build_doxygen_docker:
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "schedule" && $SCHEDULED_JOB_NAME == "doxygen"
|
||||
tags:
|
||||
- gitlab-org-docker
|
||||
- docker
|
||||
before_script:
|
||||
- docker info
|
||||
- docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" "$CI_REGISTRY"
|
||||
|
||||
+19
-1
@@ -15,7 +15,25 @@ macos_build:
|
||||
- cd build/macos
|
||||
- cmake
|
||||
-G Ninja
|
||||
-DCMAKE_TOOLCHAIN_FILE=/Users/ci/kicad-mac-builder/toolchain/kicad-mac-builder.cmake
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||
-DDEFAULT_INSTALL_PATH=/Library/Application\ Support /kicad
|
||||
-DOCC_INCLUDE_DIR=/opt/homebrew/Cellar/opencascade/7.7.2_2/include/opencascade
|
||||
-DOCC_LIBRARY_DIR=/opt/homebrew/Cellar/opencascade/7.7.2_2/Lib
|
||||
-DCMAKE_INSTALL_PREFIX=/Users/ci/kicad-mac-builder/build/kicad-dest
|
||||
-DCMAKE_C_COMPILER=/usr/bin/clang
|
||||
-DCMAKE_CXX_COMPILER=/usr/bin/clang++
|
||||
-DwxWidgets_CONFIG_EXECUTABLE=/Users/ci/kicad-mac-builder/build/wxwidgets-dest/bin/wx-config
|
||||
-DKICAD_BUILD_I18N=ON
|
||||
-DKICAD_SCRIPTING_WXPYTHON=ON
|
||||
-DKICAD_BUILD_PNS_DEBUG_TOOL=ON
|
||||
-DPYTHON_EXECUTABLE=/Users/ci/kicad-mac-builder/build/python-dest/Library/Frameworks/Python.framework/Versions/Current/bin/python3
|
||||
-DPYTHON_INCLUDE_DIR=/Users/ci/kicad-mac-builder/build/python-dest/Library/Frameworks/Python.framework/Versions/Current/include/python3.9/
|
||||
-DPYTHON_LIBRARY=/Users/ci/kicad-mac-builder/build/python-dest/Library/Frameworks/Python.framework/Versions/Current/lib/libpython3.9.dylib
|
||||
-DPYTHON_SITE_PACKAGE_PATH=/Users/ci/kicad-mac-builder/build/python-dest/Library/Frameworks/Python.framework/Versions/Current/lib/python3.9/site-packages
|
||||
-DPYTHON_FRAMEWORK=/Users/ci/kicad-mac-builder/build/python-dest/Library/Frameworks/Python.framework
|
||||
-DNGSPICE_INCLUDE_DIR=/Users/ci/kicad-mac-builder/build/ngspice-dest/include
|
||||
-DNGSPICE_LIBRARY=/Users/ci/kicad-mac-builder/build/ngspice-dest/lib/libngspice.dylib
|
||||
-DKICAD_USE_3DCONNEXION=ON
|
||||
../../
|
||||
- cmake --build . 2>&1 | tee compilation_log.txt
|
||||
- cd ../../
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 2015-2023 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2023 CERN
|
||||
* Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2023 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
|
||||
@@ -142,8 +142,8 @@ BOARD_ADAPTER::BOARD_ADAPTER() :
|
||||
m_offboardPadsFront = nullptr;
|
||||
m_offboardPadsBack = nullptr;
|
||||
|
||||
m_frontPlatedPadAndGraphicPolys = nullptr;
|
||||
m_backPlatedPadAndGraphicPolys = nullptr;
|
||||
m_frontPlatedPadPolys = nullptr;
|
||||
m_backPlatedPadPolys = nullptr;
|
||||
m_frontPlatedCopperPolys = nullptr;
|
||||
m_backPlatedCopperPolys = nullptr;
|
||||
|
||||
@@ -397,18 +397,13 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
||||
break;
|
||||
|
||||
case BS_ITEM_TYPE_COPPER:
|
||||
{
|
||||
// The copper thickness must be > 0 to avoid draw issues (divide by 0 for instance)
|
||||
// We use a minimal arbitrary value = 1 micrometer here:
|
||||
int copper_thickness = std::max( item->GetThickness(), pcbIUScale.mmToIU( 0.001 ) );
|
||||
|
||||
if( item->GetBrdLayerId() == F_Cu )
|
||||
m_frontCopperThickness3DU = copper_thickness * m_biuTo3Dunits;
|
||||
m_frontCopperThickness3DU = item->GetThickness() * m_biuTo3Dunits;
|
||||
else if( item->GetBrdLayerId() == B_Cu )
|
||||
m_backCopperThickness3DU = copper_thickness * m_biuTo3Dunits;
|
||||
m_backCopperThickness3DU = item->GetThickness() * m_biuTo3Dunits;
|
||||
else if( item->IsEnabled() )
|
||||
thickness += copper_thickness;
|
||||
}
|
||||
thickness += item->GetThickness();
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -454,7 +449,7 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
||||
for( ; layer < MAX_CU_LAYERS; layer++ )
|
||||
{
|
||||
m_layerZcoordBottom[layer] = -( m_boardBodyThickness3DU / 2.0f );
|
||||
m_layerZcoordTop[layer] = m_layerZcoordBottom[layer] - m_backCopperThickness3DU;
|
||||
m_layerZcoordTop[layer] = -( m_boardBodyThickness3DU / 2.0f ) - m_backCopperThickness3DU;
|
||||
}
|
||||
|
||||
// This is the top of the copper layer thickness.
|
||||
@@ -535,7 +530,7 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
|
||||
m_boardBoundingBox = BBOX_3D( boardMin, boardMax );
|
||||
|
||||
#ifdef PRINT_STATISTICS_3D_VIEWER
|
||||
int64_t stats_startCreateBoardPolyTime = GetRunningMicroSecs();
|
||||
unsigned stats_startCreateBoardPolyTime = GetRunningMicroSecs();
|
||||
#endif
|
||||
|
||||
if( aStatusReporter )
|
||||
@@ -594,20 +589,13 @@ std::map<int, COLOR4D> BOARD_ADAPTER::GetLayerColors() const
|
||||
{
|
||||
std::map<int, COLOR4D> colors;
|
||||
|
||||
if( LAYER_PRESET_3D* preset = m_Cfg->FindPreset( m_Cfg->m_CurrentPreset ) )
|
||||
if( m_Cfg->m_CurrentPreset == FOLLOW_PCB || m_Cfg->m_CurrentPreset == FOLLOW_PLOT_SETTINGS )
|
||||
{
|
||||
colors = preset->colors;
|
||||
}
|
||||
else
|
||||
{
|
||||
COLOR_SETTINGS* settings = Pgm().GetSettingsManager().GetColorSettings();
|
||||
colors = GetDefaultColors();
|
||||
|
||||
for( const auto& [ layer, defaultColor /* unused */ ] : GetDefaultColors() )
|
||||
colors[ layer ] = settings->GetColor( layer );
|
||||
}
|
||||
if( !m_board )
|
||||
return colors;
|
||||
|
||||
if( m_Cfg->m_UseStackupColors && m_board )
|
||||
{
|
||||
const BOARD_STACKUP& stackup = m_board->GetDesignSettings().GetStackupDescriptor();
|
||||
KIGFX::COLOR4D bodyColor( 0, 0, 0, 0 );
|
||||
|
||||
@@ -695,6 +683,26 @@ std::map<int, COLOR4D> BOARD_ADAPTER::GetLayerColors() const
|
||||
{
|
||||
colors[ LAYER_3D_COPPER_TOP ] = findColor( wxT( "Silver" ), g_FinishColors );
|
||||
}
|
||||
|
||||
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
||||
PCBNEW_SETTINGS* pcbnewSettings = mgr.GetAppSettings<PCBNEW_SETTINGS>();
|
||||
COLOR_SETTINGS* pcbnewColors = mgr.GetColorSettings( pcbnewSettings->m_ColorTheme );
|
||||
|
||||
colors[ LAYER_3D_USER_DRAWINGS ] = pcbnewColors->GetColor( Dwgs_User );
|
||||
colors[ LAYER_3D_USER_COMMENTS ] = pcbnewColors->GetColor( Cmts_User );
|
||||
colors[ LAYER_3D_USER_ECO1 ] = pcbnewColors->GetColor( Eco1_User );
|
||||
colors[ LAYER_3D_USER_ECO2 ] = pcbnewColors->GetColor( Eco2_User );
|
||||
}
|
||||
else if( LAYER_PRESET_3D* preset = m_Cfg->FindPreset( m_Cfg->m_CurrentPreset ) )
|
||||
{
|
||||
return preset->colors;
|
||||
}
|
||||
else
|
||||
{
|
||||
COLOR_SETTINGS* settings = Pgm().GetSettingsManager().GetColorSettings();
|
||||
|
||||
for( const auto& [ layer, color ] : GetDefaultColors() )
|
||||
colors[ layer ] = settings->GetColor( layer );
|
||||
}
|
||||
|
||||
colors[ LAYER_3D_COPPER_BOTTOM ] = colors[ LAYER_3D_COPPER_TOP ];
|
||||
@@ -708,8 +716,6 @@ void BOARD_ADAPTER::SetLayerColors( const std::map<int, COLOR4D>& aColors )
|
||||
|
||||
for( const auto& [ layer, color ] : aColors )
|
||||
settings->SetColor( layer, color );
|
||||
|
||||
Pgm().GetSettingsManager().SaveColorSettings( settings, "3d_viewer" );
|
||||
}
|
||||
|
||||
|
||||
@@ -854,42 +860,6 @@ std::bitset<LAYER_3D_END> BOARD_ADAPTER::GetVisibleLayers() const
|
||||
}
|
||||
|
||||
|
||||
std::bitset<LAYER_3D_END> BOARD_ADAPTER::GetDefaultVisibleLayers() const
|
||||
{
|
||||
std::bitset<LAYER_3D_END> ret;
|
||||
|
||||
ret.set( LAYER_3D_BOARD, true );
|
||||
ret.set( LAYER_3D_COPPER_TOP, true );
|
||||
ret.set( LAYER_3D_COPPER_BOTTOM, true );
|
||||
ret.set( LAYER_3D_SILKSCREEN_TOP, true );
|
||||
ret.set( LAYER_3D_SILKSCREEN_BOTTOM, true );
|
||||
ret.set( LAYER_3D_SOLDERMASK_TOP, true );
|
||||
ret.set( LAYER_3D_SOLDERMASK_BOTTOM, true );
|
||||
ret.set( LAYER_3D_SOLDERPASTE, true );
|
||||
ret.set( LAYER_3D_ADHESIVE, true );
|
||||
ret.set( LAYER_3D_USER_COMMENTS, false );
|
||||
ret.set( LAYER_3D_USER_DRAWINGS, false );
|
||||
ret.set( LAYER_3D_USER_ECO1, false );
|
||||
ret.set( LAYER_3D_USER_ECO2, false );
|
||||
|
||||
ret.set( LAYER_FP_REFERENCES, true );
|
||||
ret.set( LAYER_FP_VALUES, true );
|
||||
ret.set( LAYER_FP_TEXT, true );
|
||||
|
||||
ret.set( LAYER_3D_TH_MODELS, true );
|
||||
ret.set( LAYER_3D_SMD_MODELS, true );
|
||||
ret.set( LAYER_3D_VIRTUAL_MODELS, true );
|
||||
ret.set( LAYER_3D_MODELS_NOT_IN_POS, false );
|
||||
ret.set( LAYER_3D_MODELS_MARKED_DNP, false );
|
||||
|
||||
ret.set( LAYER_3D_BOUNDING_BOXES, false );
|
||||
ret.set( LAYER_3D_OFF_BOARD_SILK, false );
|
||||
ret.set( LAYER_3D_AXES, true );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
bool BOARD_ADAPTER::createBoardPolygon( wxString* aErrorMsg )
|
||||
{
|
||||
m_board_poly.RemoveAllContours();
|
||||
|
||||
@@ -110,7 +110,6 @@ public:
|
||||
void SetLayerColors( const std::map<int, COLOR4D>& aColors );
|
||||
|
||||
std::bitset<LAYER_3D_END> GetVisibleLayers() const;
|
||||
std::bitset<LAYER_3D_END> GetDefaultVisibleLayers() const;
|
||||
void SetVisibleLayers( const std::bitset<LAYER_3D_END>& aLayers );
|
||||
|
||||
/**
|
||||
@@ -331,8 +330,8 @@ public:
|
||||
*/
|
||||
const MAP_POLY& GetPolyMap() const noexcept { return m_layers_poly; }
|
||||
|
||||
const SHAPE_POLY_SET* GetFrontPlatedPadAndGraphicPolys() { return m_frontPlatedPadAndGraphicPolys; }
|
||||
const SHAPE_POLY_SET* GetBackPlatedPadAndGraphicPolys() { return m_backPlatedPadAndGraphicPolys; }
|
||||
const SHAPE_POLY_SET* GetFrontPlatedPadPolys() { return m_frontPlatedPadPolys; }
|
||||
const SHAPE_POLY_SET* GetBackPlatedPadPolys() { return m_backPlatedPadPolys; }
|
||||
const MAP_POLY& GetHoleIdPolysMap() const noexcept { return m_layerHoleIdPolys; }
|
||||
const MAP_POLY& GetHoleOdPolysMap() const noexcept { return m_layerHoleOdPolys; }
|
||||
|
||||
@@ -438,8 +437,8 @@ private:
|
||||
MAP_POLY m_layers_poly; ///< Amalgamated polygon contours for various types
|
||||
///< of items
|
||||
|
||||
SHAPE_POLY_SET* m_frontPlatedPadAndGraphicPolys;
|
||||
SHAPE_POLY_SET* m_backPlatedPadAndGraphicPolys;
|
||||
SHAPE_POLY_SET* m_frontPlatedPadPolys;
|
||||
SHAPE_POLY_SET* m_backPlatedPadPolys;
|
||||
SHAPE_POLY_SET* m_frontPlatedCopperPolys;
|
||||
SHAPE_POLY_SET* m_backPlatedCopperPolys;
|
||||
|
||||
|
||||
@@ -117,8 +117,8 @@ void BOARD_ADAPTER::destroyLayers()
|
||||
|
||||
DELETE_AND_FREE_MAP( m_layers_poly );
|
||||
|
||||
DELETE_AND_FREE( m_frontPlatedPadAndGraphicPolys )
|
||||
DELETE_AND_FREE( m_backPlatedPadAndGraphicPolys )
|
||||
DELETE_AND_FREE( m_frontPlatedPadPolys )
|
||||
DELETE_AND_FREE( m_backPlatedPadPolys )
|
||||
DELETE_AND_FREE( m_frontPlatedCopperPolys )
|
||||
DELETE_AND_FREE( m_backPlatedCopperPolys )
|
||||
|
||||
@@ -154,9 +154,9 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
// https://github.com/KiCad/kicad-source-mirror/blob/master/3d-viewer/3d_draw.cpp#L692
|
||||
|
||||
#ifdef PRINT_STATISTICS_3D_VIEWER
|
||||
int64_t stats_startCopperLayersTime = GetRunningMicroSecs();
|
||||
unsigned stats_startCopperLayersTime = GetRunningMicroSecs();
|
||||
|
||||
int64_t start_Time = stats_startCopperLayersTime;
|
||||
unsigned start_Time = stats_startCopperLayersTime;
|
||||
#endif
|
||||
|
||||
PCB_LAYER_ID cu_seq[MAX_CU_LAYERS];
|
||||
@@ -241,8 +241,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
|
||||
if( cfg.differentiate_plated_copper )
|
||||
{
|
||||
m_frontPlatedPadAndGraphicPolys = new SHAPE_POLY_SET;
|
||||
m_backPlatedPadAndGraphicPolys = new SHAPE_POLY_SET;
|
||||
m_frontPlatedPadPolys = new SHAPE_POLY_SET;
|
||||
m_backPlatedPadPolys = new SHAPE_POLY_SET;
|
||||
m_frontPlatedCopperPolys = new SHAPE_POLY_SET;
|
||||
m_backPlatedCopperPolys = new SHAPE_POLY_SET;
|
||||
|
||||
@@ -586,10 +586,10 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
// ADD PLATED PADS contours
|
||||
for( FOOTPRINT* footprint : m_board->Footprints() )
|
||||
{
|
||||
footprint->TransformPadsToPolySet( *m_frontPlatedPadAndGraphicPolys, F_Cu, 0, maxError,
|
||||
footprint->TransformPadsToPolySet( *m_frontPlatedPadPolys, F_Cu, 0, maxError,
|
||||
ERROR_INSIDE, true, false, true );
|
||||
|
||||
footprint->TransformPadsToPolySet( *m_backPlatedPadAndGraphicPolys, B_Cu, 0, maxError,
|
||||
footprint->TransformPadsToPolySet( *m_backPlatedPadPolys, B_Cu, 0, maxError,
|
||||
ERROR_INSIDE, true, false, true );
|
||||
}
|
||||
}
|
||||
@@ -1050,33 +1050,21 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
SHAPE_POLY_SET::PM_FAST );
|
||||
}
|
||||
|
||||
// Subtract plated copper from unplated copper
|
||||
bool hasF_Cu = false;
|
||||
bool hasB_Cu = false;
|
||||
|
||||
// SUBTRACT PLATED COPPER FROM (UNPLATED) COPPER
|
||||
if( m_layers_poly.find( F_Cu ) != m_layers_poly.end() )
|
||||
{
|
||||
m_layers_poly[F_Cu]->BooleanSubtract( *m_frontPlatedPadAndGraphicPolys, SHAPE_POLY_SET::PM_FAST );
|
||||
m_layers_poly[F_Cu]->BooleanSubtract( *m_frontPlatedPadPolys, SHAPE_POLY_SET::PM_FAST );
|
||||
m_layers_poly[F_Cu]->BooleanSubtract( *m_frontPlatedCopperPolys, SHAPE_POLY_SET::PM_FAST );
|
||||
hasF_Cu = true;
|
||||
}
|
||||
|
||||
if( m_layers_poly.find( B_Cu ) != m_layers_poly.end() )
|
||||
{
|
||||
m_layers_poly[B_Cu]->BooleanSubtract( *m_backPlatedPadAndGraphicPolys, SHAPE_POLY_SET::PM_FAST );
|
||||
m_layers_poly[B_Cu]->BooleanSubtract( *m_backPlatedPadPolys, SHAPE_POLY_SET::PM_FAST );
|
||||
m_layers_poly[B_Cu]->BooleanSubtract( *m_backPlatedCopperPolys, SHAPE_POLY_SET::PM_FAST );
|
||||
hasB_Cu = true;
|
||||
}
|
||||
|
||||
// Add plated graphic items to build vertical walls
|
||||
if( hasF_Cu && m_frontPlatedCopperPolys->OutlineCount() )
|
||||
m_frontPlatedPadAndGraphicPolys->Append( *m_frontPlatedCopperPolys );
|
||||
|
||||
if( hasB_Cu && m_backPlatedCopperPolys->OutlineCount() )
|
||||
m_backPlatedPadAndGraphicPolys->Append( *m_backPlatedCopperPolys );
|
||||
|
||||
m_frontPlatedPadAndGraphicPolys->Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||
m_backPlatedPadAndGraphicPolys->Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||
m_frontPlatedPadPolys->Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||
m_backPlatedPadPolys->Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||
m_frontPlatedCopperPolys->Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||
m_backPlatedCopperPolys->Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||
|
||||
@@ -1146,7 +1134,6 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
|
||||
if( layerPoly != m_layers_poly.end() )
|
||||
{
|
||||
// This will make a union of all added contours
|
||||
layerPoly->second->ClearArcs();
|
||||
layerPoly->second->Simplify( SHAPE_POLY_SET::PM_FAST );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include <3d_rendering/opengl/render_3d_opengl.h>
|
||||
#include <3d_viewer_id.h>
|
||||
#include <advanced_config.h>
|
||||
#include <build_version.h>
|
||||
#include <board.h>
|
||||
#include <reporter.h>
|
||||
#include <gal/opengl/gl_context_mgr.h>
|
||||
@@ -230,9 +229,6 @@ bool EDA_3D_CANVAS::initializeOpenGL()
|
||||
From_UTF8( (char*) glewGetString( GLEW_VERSION ) ) );
|
||||
}
|
||||
|
||||
SetOpenGLInfo( (const char*) glGetString( GL_VENDOR ), (const char*) glGetString( GL_RENDERER ),
|
||||
(const char*) glGetString( GL_VERSION ) );
|
||||
|
||||
wxString version = From_UTF8( (char *) glGetString( GL_VERSION ) );
|
||||
|
||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_CANVAS::%s OpenGL version string %s." ),
|
||||
@@ -373,7 +369,7 @@ void EDA_3D_CANVAS::DoRePaint()
|
||||
wxString err_messages;
|
||||
INFOBAR_REPORTER warningReporter( m_parentInfoBar );
|
||||
STATUSBAR_REPORTER activityReporter( m_parentStatusBar, EDA_3D_VIEWER_STATUSBAR::ACTIVITY );
|
||||
int64_t start_time = GetRunningMicroSecs();
|
||||
unsigned start_time = GetRunningMicroSecs();
|
||||
|
||||
// "Makes the OpenGL state that is represented by the OpenGL rendering
|
||||
// context context current, i.e. it will be used by all subsequent OpenGL calls.
|
||||
@@ -465,7 +461,7 @@ void EDA_3D_CANVAS::DoRePaint()
|
||||
|
||||
if( m_camera_is_moving )
|
||||
{
|
||||
const int64_t curtime_delta = GetRunningMicroSecs() - m_strtime_camera_movement;
|
||||
const unsigned curtime_delta = GetRunningMicroSecs() - m_strtime_camera_movement;
|
||||
curtime_delta_s = (curtime_delta / 1e6) * m_camera_moving_speed;
|
||||
m_camera.Interpolate( curtime_delta_s );
|
||||
|
||||
|
||||
@@ -305,7 +305,7 @@ private:
|
||||
|
||||
bool m_render_pivot; // Render the pivot while camera moving
|
||||
float m_camera_moving_speed; // 1.0f will be 1:1
|
||||
int64_t m_strtime_camera_movement; // Ticktime of camera movement start
|
||||
unsigned m_strtime_camera_movement; // Ticktime of camera movement start
|
||||
bool m_animation_enabled; // Camera animation enabled
|
||||
int m_moving_speed_multiplier; // Camera animation speed multiplier option
|
||||
|
||||
|
||||
@@ -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-2024 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
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "../3d_cache/3d_cache.h"
|
||||
#include <wx/dcclient.h>
|
||||
#include <base_units.h>
|
||||
#include <build_version.h>
|
||||
#include <gal/opengl/gl_context_mgr.h>
|
||||
#include <settings/common_settings.h>
|
||||
#include <pgm_base.h>
|
||||
@@ -103,6 +102,11 @@ EDA_3D_MODEL_VIEWER::EDA_3D_MODEL_VIEWER( wxWindow* aParent, const int* aAttribL
|
||||
m_BiuTo3dUnits = 1.0;
|
||||
|
||||
m_glRC = nullptr;
|
||||
|
||||
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
|
||||
|
||||
const DPI_SCALING_COMMON dpi{ settings, this };
|
||||
SetScaleFactor( dpi.GetScaleFactor() );
|
||||
}
|
||||
|
||||
|
||||
@@ -196,9 +200,6 @@ void EDA_3D_MODEL_VIEWER::ogl_initialize()
|
||||
From_UTF8( (char*) glewGetString( GLEW_VERSION ) ) );
|
||||
}
|
||||
|
||||
SetOpenGLInfo( (const char*) glGetString( GL_VENDOR ), (const char*) glGetString( GL_RENDERER ),
|
||||
(const char*) glGetString( GL_VERSION ) );
|
||||
|
||||
glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST );
|
||||
glHint( GL_LINE_SMOOTH_HINT, GL_NICEST );
|
||||
glHint( GL_POLYGON_SMOOTH_HINT, GL_NICEST );
|
||||
|
||||
@@ -454,7 +454,7 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
|
||||
|
||||
OBJECT_2D_STATS::Instance().ResetStats();
|
||||
|
||||
int64_t stats_startReloadTime = GetRunningMicroSecs();
|
||||
unsigned stats_startReloadTime = GetRunningMicroSecs();
|
||||
|
||||
m_boardAdapter.InitSettings( aStatusReporter, aWarningReporter );
|
||||
|
||||
@@ -613,12 +613,12 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
|
||||
|
||||
if( m_boardAdapter.m_Cfg->m_Render.differentiate_plated_copper )
|
||||
{
|
||||
const SHAPE_POLY_SET* frontPlatedPadAndGraphicPolys = m_boardAdapter.GetFrontPlatedPadAndGraphicPolys();
|
||||
const SHAPE_POLY_SET* backPlatedPadAndGraphicPolys = m_boardAdapter.GetBackPlatedPadAndGraphicPolys();
|
||||
const SHAPE_POLY_SET* frontPlatedPadPolys = m_boardAdapter.GetFrontPlatedPadPolys();
|
||||
const SHAPE_POLY_SET* backPlatedPadPolys = m_boardAdapter.GetBackPlatedPadPolys();
|
||||
|
||||
if( frontPlatedPadAndGraphicPolys )
|
||||
if( frontPlatedPadPolys )
|
||||
{
|
||||
SHAPE_POLY_SET poly = frontPlatedPadAndGraphicPolys->CloneDropTriangulation();
|
||||
SHAPE_POLY_SET poly = frontPlatedPadPolys->CloneDropTriangulation();
|
||||
poly.BooleanIntersection( m_boardAdapter.GetBoardPoly(), SHAPE_POLY_SET::PM_FAST );
|
||||
poly.BooleanSubtract( m_boardAdapter.GetTH_ODPolys(), SHAPE_POLY_SET::PM_FAST );
|
||||
poly.BooleanSubtract( m_boardAdapter.GetNPTH_ODPolys(), SHAPE_POLY_SET::PM_FAST );
|
||||
@@ -630,9 +630,9 @@ void RENDER_3D_OPENGL::reload( REPORTER* aStatusReporter, REPORTER* aWarningRepo
|
||||
m_layers[F_Cu] = generateEmptyLayerList( F_Cu );
|
||||
}
|
||||
|
||||
if( backPlatedPadAndGraphicPolys )
|
||||
if( backPlatedPadPolys )
|
||||
{
|
||||
SHAPE_POLY_SET poly = backPlatedPadAndGraphicPolys->CloneDropTriangulation();
|
||||
SHAPE_POLY_SET poly = backPlatedPadPolys->CloneDropTriangulation();
|
||||
poly.BooleanIntersection( m_boardAdapter.GetBoardPoly(), SHAPE_POLY_SET::PM_FAST );
|
||||
poly.BooleanSubtract( m_boardAdapter.GetTH_ODPolys(), SHAPE_POLY_SET::PM_FAST );
|
||||
poly.BooleanSubtract( m_boardAdapter.GetNPTH_ODPolys(), SHAPE_POLY_SET::PM_FAST );
|
||||
@@ -917,10 +917,6 @@ void RENDER_3D_OPENGL::load3dModels( REPORTER* aStatusReporter )
|
||||
if( !m_boardAdapter.GetBoard() )
|
||||
return;
|
||||
|
||||
// Building the 3D models late crashes on recent versions of macOS
|
||||
// Unclear the exact mechanism, but as a workaround, just build them
|
||||
// all the time. See https://gitlab.com/kicad/code/kicad/-/issues/17198
|
||||
#ifndef __WXMAC__
|
||||
if( !m_boardAdapter.m_IsPreviewer
|
||||
&& !m_boardAdapter.m_Cfg->m_Render.show_footprints_normal
|
||||
&& !m_boardAdapter.m_Cfg->m_Render.show_footprints_insert
|
||||
@@ -928,7 +924,6 @@ void RENDER_3D_OPENGL::load3dModels( REPORTER* aStatusReporter )
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Go for all footprints
|
||||
for( const FOOTPRINT* footprint : m_boardAdapter.GetBoard()->Footprints() )
|
||||
|
||||
@@ -368,7 +368,7 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
|
||||
OBJECT_2D_STATS::Instance().ResetStats();
|
||||
OBJECT_3D_STATS::Instance().ResetStats();
|
||||
|
||||
int64_t stats_startReloadTime = GetRunningMicroSecs();
|
||||
unsigned stats_startReloadTime = GetRunningMicroSecs();
|
||||
|
||||
if( !aOnlyLoadCopperAndShapes )
|
||||
{
|
||||
@@ -771,8 +771,8 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
|
||||
}
|
||||
|
||||
#ifdef PRINT_STATISTICS_3D_VIEWER
|
||||
int64_t stats_endConvertTime = GetRunningMicroSecs();
|
||||
int64_t stats_startLoad3DmodelsTime = stats_endConvertTime;
|
||||
unsigned stats_endConvertTime = GetRunningMicroSecs();
|
||||
unsigned stats_startLoad3DmodelsTime = stats_endConvertTime;
|
||||
#endif
|
||||
|
||||
if( aStatusReporter )
|
||||
@@ -781,7 +781,7 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
|
||||
load3DModels( m_objectContainer, aOnlyLoadCopperAndShapes );
|
||||
|
||||
#ifdef PRINT_STATISTICS_3D_VIEWER
|
||||
int64_t stats_endLoad3DmodelsTime = GetRunningMicroSecs();
|
||||
unsigned stats_endLoad3DmodelsTime = GetRunningMicroSecs();
|
||||
#endif
|
||||
|
||||
if( !aOnlyLoadCopperAndShapes )
|
||||
@@ -955,7 +955,7 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
|
||||
if( aStatusReporter )
|
||||
{
|
||||
// Calculation time in seconds
|
||||
double calculation_time = (double) ( GetRunningMicroSecs() - stats_startReloadTime ) / 1e6;
|
||||
double calculation_time = (double) GetRunningMicroSecs() - stats_startReloadTime / 1e6;
|
||||
|
||||
aStatusReporter->Report( wxString::Format( _( "Reload time %.3f s" ), calculation_time ) );
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ private:
|
||||
RT_RENDER_STATE m_renderState;
|
||||
|
||||
/// Time that the render starts
|
||||
int64_t m_renderStartTime;
|
||||
unsigned long int m_renderStartTime;
|
||||
|
||||
/// Save the number of blocks progress of the render
|
||||
size_t m_blockRenderProgressCount;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
||||
* Copyright (C) 2023 CERN
|
||||
* Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2023 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
|
||||
@@ -568,8 +568,7 @@ void EDA_3D_VIEWER_FRAME::LoadSettings( APP_SETTINGS_BASE *aCfg )
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
applySettings( cfg );
|
||||
|
||||
m_boardAdapter.m_Cfg = cfg;
|
||||
m_boardAdapter.SetBoard( GetBoard() );
|
||||
|
||||
// When opening the 3D viewer, we use the OpenGL mode, never the ray tracing engine
|
||||
@@ -577,20 +576,28 @@ void EDA_3D_VIEWER_FRAME::LoadSettings( APP_SETTINGS_BASE *aCfg )
|
||||
// (freeze window) with large boards.
|
||||
m_boardAdapter.m_Cfg->m_Render.engine = RENDER_ENGINE::OPENGL;
|
||||
|
||||
m_canvas->SetAnimationEnabled( cfg->m_Camera.animation_enabled );
|
||||
m_canvas->SetMovingSpeedMultiplier( cfg->m_Camera.moving_speed_multiplier );
|
||||
m_canvas->SetProjectionMode( cfg->m_Camera.projection_mode );
|
||||
|
||||
|
||||
m_canvas->SetVcSettings( EDA_DRAW_PANEL_GAL::GetVcSettings() );
|
||||
|
||||
if( cfg->m_CurrentPreset == LEGACY_PRESET_FLAG )
|
||||
{
|
||||
wxString legacyColorsPresetName = _( "legacy colors" );
|
||||
|
||||
cfg->m_UseStackupColors = false;
|
||||
|
||||
if( !cfg->FindPreset( legacyColorsPresetName ) )
|
||||
{
|
||||
cfg->m_LayerPresets.emplace_back( legacyColorsPresetName,
|
||||
GetAdapter().GetDefaultVisibleLayers(),
|
||||
GetAdapter().GetDefaultColors() );
|
||||
GetAdapter().GetVisibleLayers(),
|
||||
GetAdapter().GetLayerColors() );
|
||||
}
|
||||
|
||||
cfg->m_CurrentPreset = wxEmptyString;
|
||||
if( Pgm().GetSettingsManager().GetColorSettings()->GetUseBoardStackupColors() )
|
||||
cfg->m_CurrentPreset = FOLLOW_PCB;
|
||||
else
|
||||
cfg->m_CurrentPreset = legacyColorsPresetName;
|
||||
}
|
||||
|
||||
m_boardAdapter.InitSettings( nullptr, nullptr );
|
||||
@@ -639,7 +646,7 @@ void EDA_3D_VIEWER_FRAME::CommonSettingsChanged( bool aEnvVarsChanged, bool aTex
|
||||
ReCreateMainToolbar();
|
||||
|
||||
loadCommonSettings();
|
||||
applySettings( Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>() );
|
||||
LoadSettings( Pgm().GetSettingsManager().GetAppSettings<EDA_3D_VIEWER_SETTINGS>() );
|
||||
|
||||
m_appearancePanel->CommonSettingsChanged();
|
||||
|
||||
@@ -812,18 +819,9 @@ void EDA_3D_VIEWER_FRAME::loadCommonSettings()
|
||||
|
||||
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
|
||||
|
||||
const DPI_SCALING_COMMON dpi{ settings, this };
|
||||
m_canvas->SetScaleFactor( dpi.GetScaleFactor() );
|
||||
|
||||
// TODO(JE) use all control options
|
||||
m_boardAdapter.m_MousewheelPanning = settings->m_Input.scroll_modifier_zoom != 0;
|
||||
}
|
||||
|
||||
|
||||
void EDA_3D_VIEWER_FRAME::applySettings( EDA_3D_VIEWER_SETTINGS* cfg )
|
||||
{
|
||||
m_boardAdapter.m_Cfg = cfg;
|
||||
|
||||
m_canvas->SetAnimationEnabled( cfg->m_Camera.animation_enabled );
|
||||
m_canvas->SetMovingSpeedMultiplier( cfg->m_Camera.moving_speed_multiplier );
|
||||
m_canvas->SetProjectionMode( cfg->m_Camera.projection_mode );
|
||||
|
||||
m_canvas->SetVcSettings( EDA_DRAW_PANEL_GAL::GetVcSettings() );
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2023 CERN
|
||||
* Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2023 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
|
||||
@@ -167,8 +167,6 @@ private:
|
||||
*/
|
||||
void loadCommonSettings();
|
||||
|
||||
void applySettings( EDA_3D_VIEWER_SETTINGS* aSettings );
|
||||
|
||||
private:
|
||||
wxFileName m_defaultSaveScreenshotFileName;
|
||||
|
||||
|
||||
@@ -377,8 +377,6 @@ EDA_3D_VIEWER_SETTINGS::EDA_3D_VIEWER_SETTINGS() :
|
||||
m_params.emplace_back( new PARAM<int>( "camera.projection_mode",
|
||||
&m_Camera.projection_mode, 1 ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "use_stackup_colors",
|
||||
&m_UseStackupColors, true ) );
|
||||
m_params.emplace_back( new PARAM_LAYER_PRESET_3D( "layer_presets",
|
||||
&m_LayerPresets ) );
|
||||
m_params.emplace_back( new PARAM<wxString>( "current_layer_preset",
|
||||
|
||||
@@ -169,7 +169,6 @@ public:
|
||||
RENDER_SETTINGS m_Render;
|
||||
CAMERA_SETTINGS m_Camera;
|
||||
|
||||
bool m_UseStackupColors;
|
||||
std::vector<LAYER_PRESET_3D> m_LayerPresets;
|
||||
wxString m_CurrentPreset;
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ TOOL_ACTION EDA_3D_ACTIONS::rotateXCW( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.rotateXclockwise" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Rotate X Clockwise" ) )
|
||||
.Tooltip( _( "Rotate X Clockwise" ) )
|
||||
.Icon( BITMAPS::rotate_cw_x )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( ROTATION_DIR::X_CW ) );
|
||||
@@ -61,6 +62,7 @@ TOOL_ACTION EDA_3D_ACTIONS::rotateXCCW( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.rotateXcounterclockwise" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Rotate X Counterclockwise" ) )
|
||||
.Tooltip( _( "Rotate X Counterclockwise" ) )
|
||||
.Icon( BITMAPS::rotate_ccw_x )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( ROTATION_DIR::X_CCW ) );
|
||||
@@ -69,6 +71,7 @@ TOOL_ACTION EDA_3D_ACTIONS::rotateYCW( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.rotateYclockwise" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Rotate Y Clockwise" ) )
|
||||
.Tooltip( _( "Rotate Y Clockwise" ) )
|
||||
.Icon( BITMAPS::rotate_cw_y )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( ROTATION_DIR::Y_CW ) );
|
||||
@@ -77,6 +80,7 @@ TOOL_ACTION EDA_3D_ACTIONS::rotateYCCW( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.rotateYcounterclockwise" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Rotate Y Counterclockwise" ) )
|
||||
.Tooltip( _( "Rotate Y Counterclockwise" ) )
|
||||
.Icon( BITMAPS::rotate_ccw_y )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( ROTATION_DIR::Y_CCW ) );
|
||||
@@ -85,6 +89,7 @@ TOOL_ACTION EDA_3D_ACTIONS::rotateZCW( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.rotateZclockwise" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Rotate Z Clockwise" ) )
|
||||
.Tooltip( _( "Rotate Z Clockwise" ) )
|
||||
.Icon( BITMAPS::rotate_cw_z )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( ROTATION_DIR::Z_CW ) );
|
||||
@@ -93,6 +98,7 @@ TOOL_ACTION EDA_3D_ACTIONS::rotateZCCW( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.rotateZcounterclockwise" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Rotate Z Counterclockwise" ) )
|
||||
.Tooltip( _( "Rotate Z Counterclockwise" ) )
|
||||
.Icon( BITMAPS::rotate_ccw_z )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( ROTATION_DIR::Z_CCW ) );
|
||||
@@ -102,6 +108,7 @@ TOOL_ACTION EDA_3D_ACTIONS::moveLeft( TOOL_ACTION_ARGS()
|
||||
.Scope( AS_ACTIVE )
|
||||
.DefaultHotkey( WXK_LEFT )
|
||||
.FriendlyName( _( "Move Board Left" ) )
|
||||
.Tooltip( _( "Move board Left" ) )
|
||||
.Icon( BITMAPS::left )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( CURSOR_LEFT ) );
|
||||
@@ -111,6 +118,7 @@ TOOL_ACTION EDA_3D_ACTIONS::moveRight( TOOL_ACTION_ARGS()
|
||||
.Scope( AS_ACTIVE )
|
||||
.DefaultHotkey( WXK_RIGHT )
|
||||
.FriendlyName( _( "Move Board Right" ) )
|
||||
.Tooltip( _( "Move board Right" ) )
|
||||
.Icon( BITMAPS::right )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( CURSOR_RIGHT ) );
|
||||
@@ -120,6 +128,7 @@ TOOL_ACTION EDA_3D_ACTIONS::moveUp( TOOL_ACTION_ARGS()
|
||||
.Scope( AS_ACTIVE )
|
||||
.DefaultHotkey( WXK_UP )
|
||||
.FriendlyName( _( "Move Board Up" ) )
|
||||
.Tooltip( _( "Move board Up" ) )
|
||||
.Icon( BITMAPS::up )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( CURSOR_UP ) );
|
||||
@@ -129,6 +138,7 @@ TOOL_ACTION EDA_3D_ACTIONS::moveDown( TOOL_ACTION_ARGS()
|
||||
.Scope( AS_ACTIVE )
|
||||
.DefaultHotkey( WXK_DOWN )
|
||||
.FriendlyName( _( "Move Board Down" ) )
|
||||
.Tooltip( _( "Move board Down" ) )
|
||||
.Icon( BITMAPS::down )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( CURSOR_DOWN ) );
|
||||
@@ -138,7 +148,7 @@ TOOL_ACTION EDA_3D_ACTIONS::homeView( TOOL_ACTION_ARGS()
|
||||
.Scope( AS_ACTIVE )
|
||||
.DefaultHotkey( WXK_HOME )
|
||||
.FriendlyName ( _( "Home View" ) )
|
||||
.Tooltip( _( "Redraw at the home position and zoom" ) )
|
||||
.Tooltip( _( "Home view" ) )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( VIEW3D_TYPE::VIEW3D_FIT_SCREEN ) );
|
||||
|
||||
@@ -164,6 +174,7 @@ TOOL_ACTION EDA_3D_ACTIONS::viewFront( TOOL_ACTION_ARGS()
|
||||
.Scope( AS_ACTIVE )
|
||||
.DefaultHotkey( 'Y' )
|
||||
.FriendlyName( _( "View Front" ) )
|
||||
.Tooltip( _( "View Front" ) )
|
||||
.Icon( BITMAPS::axis3d_front )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( VIEW3D_TYPE::VIEW3D_FRONT ) );
|
||||
@@ -173,6 +184,7 @@ TOOL_ACTION EDA_3D_ACTIONS::viewBack( TOOL_ACTION_ARGS()
|
||||
.Scope( AS_ACTIVE )
|
||||
.DefaultHotkey( MD_SHIFT + 'Y' )
|
||||
.FriendlyName( _( "View Back" ) )
|
||||
.Tooltip( _( "View Back" ) )
|
||||
.Icon( BITMAPS::axis3d_back )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( VIEW3D_TYPE::VIEW3D_BACK ) );
|
||||
@@ -182,6 +194,7 @@ TOOL_ACTION EDA_3D_ACTIONS::viewLeft( TOOL_ACTION_ARGS()
|
||||
.Scope( AS_ACTIVE )
|
||||
.DefaultHotkey( MD_SHIFT + 'X' )
|
||||
.FriendlyName( _( "View Left" ) )
|
||||
.Tooltip( _( "View Left" ) )
|
||||
.Icon( BITMAPS::axis3d_left )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( VIEW3D_TYPE::VIEW3D_LEFT ) );
|
||||
@@ -191,6 +204,7 @@ TOOL_ACTION EDA_3D_ACTIONS::viewRight( TOOL_ACTION_ARGS()
|
||||
.Scope( AS_ACTIVE )
|
||||
.DefaultHotkey( 'X' )
|
||||
.FriendlyName( _( "View Right" ) )
|
||||
.Tooltip( _( "View Right" ) )
|
||||
.Icon( BITMAPS::axis3d_right )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( VIEW3D_TYPE::VIEW3D_RIGHT ) );
|
||||
@@ -200,6 +214,7 @@ TOOL_ACTION EDA_3D_ACTIONS::viewTop( TOOL_ACTION_ARGS()
|
||||
.Scope( AS_ACTIVE )
|
||||
.DefaultHotkey( 'Z' )
|
||||
.FriendlyName( _( "View Top" ) )
|
||||
.Tooltip( _( "View Top" ) )
|
||||
.Icon( BITMAPS::axis3d_top )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( VIEW3D_TYPE::VIEW3D_TOP ) );
|
||||
@@ -209,6 +224,7 @@ TOOL_ACTION EDA_3D_ACTIONS::viewBottom( TOOL_ACTION_ARGS()
|
||||
.Scope( AS_ACTIVE )
|
||||
.DefaultHotkey( MD_SHIFT + 'Z' )
|
||||
.FriendlyName( _( "View Bottom" ) )
|
||||
.Tooltip( _( "View Bottom" ) )
|
||||
.Icon( BITMAPS::axis3d_bottom )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( VIEW3D_TYPE::VIEW3D_BOTTOM ) );
|
||||
@@ -217,6 +233,7 @@ TOOL_ACTION EDA_3D_ACTIONS::noGrid( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.noGrid" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "No 3D Grid" ) )
|
||||
.Tooltip( _( "No 3D Grid" ) )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( GRID3D_TYPE::NONE ) );
|
||||
|
||||
@@ -224,6 +241,7 @@ TOOL_ACTION EDA_3D_ACTIONS::show10mmGrid( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.show10mmGrid" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "3D Grid 10mm" ) )
|
||||
.Tooltip( _( "3D Grid 10mm" ) )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( GRID3D_TYPE::GRID_10MM ) );
|
||||
|
||||
@@ -231,6 +249,7 @@ TOOL_ACTION EDA_3D_ACTIONS::show5mmGrid( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.show5mmGrid" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "3D Grid 5mm" ) )
|
||||
.Tooltip( _( "3D Grid 5mm" ) )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( GRID3D_TYPE::GRID_5MM ) );
|
||||
|
||||
@@ -238,6 +257,7 @@ TOOL_ACTION EDA_3D_ACTIONS::show2_5mmGrid( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.show2_5mmGrid" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "3D Grid 2.5mm" ) )
|
||||
.Tooltip( _( "3D Grid 2.5mm" ) )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( GRID3D_TYPE::GRID_2P5MM ) );
|
||||
|
||||
@@ -245,6 +265,7 @@ TOOL_ACTION EDA_3D_ACTIONS::show1mmGrid( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.show1mmGrid" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "3D Grid 1mm" ) )
|
||||
.Tooltip( _( "3D Grid 1mm" ) )
|
||||
.Flags( AF_NONE )
|
||||
.Parameter( GRID3D_TYPE::GRID_1MM ) );
|
||||
|
||||
@@ -329,6 +350,7 @@ TOOL_ACTION EDA_3D_ACTIONS::showAxis( TOOL_ACTION_ARGS()
|
||||
.Name( "3DViewer.Control.showAxis" )
|
||||
.Scope( AS_GLOBAL )
|
||||
.FriendlyName( _( "Show 3D Axis" ) )
|
||||
.Tooltip( _( "Show 3D Axis" ) )
|
||||
.Icon( BITMAPS::axis3d_front )
|
||||
.Flags( AF_NONE ) );
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@
|
||||
#include <wx/bmpbuttn.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/textdlg.h>
|
||||
#include <wx/checkbox.h>
|
||||
|
||||
#include <../3d_rendering/opengl/render_3d_opengl.h>
|
||||
|
||||
@@ -83,13 +82,6 @@ const APPEARANCE_CONTROLS_3D::APPEARANCE_SETTING_3D APPEARANCE_CONTROLS_3D::s_la
|
||||
RR( _HKI( "Background End" ), LAYER_3D_BACKGROUND_BOTTOM, _HKI( "Background gradient end color" ) ),
|
||||
};
|
||||
|
||||
// The list of IDs that can have colors coming from the board stackup, and cannot be
|
||||
// modified if use colors from stackup is activated
|
||||
static std::vector<int> inStackupColors{ LAYER_3D_BOARD, LAYER_3D_COPPER_TOP,
|
||||
LAYER_3D_COPPER_BOTTOM, LAYER_3D_SOLDERPASTE,
|
||||
LAYER_3D_SILKSCREEN_TOP, LAYER_3D_SILKSCREEN_BOTTOM,
|
||||
LAYER_3D_SOLDERMASK_TOP, LAYER_3D_SOLDERMASK_BOTTOM
|
||||
};
|
||||
|
||||
APPEARANCE_CONTROLS_3D::APPEARANCE_CONTROLS_3D( EDA_3D_VIEWER_FRAME* aParent,
|
||||
wxWindow* aFocusOwner ) :
|
||||
@@ -120,24 +112,6 @@ APPEARANCE_CONTROLS_3D::APPEARANCE_CONTROLS_3D( EDA_3D_VIEWER_FRAME* aParent,
|
||||
m_presetsLabel->SetFont( infoFont );
|
||||
m_viewportsLabel->SetFont( infoFont );
|
||||
|
||||
// Create display options
|
||||
m_cbUseBoardStackupColors = new wxCheckBox( m_panelLayers, wxID_ANY,
|
||||
_( "Use board stackup colors" ) );
|
||||
m_cbUseBoardStackupColors->SetFont( infoFont );
|
||||
|
||||
m_cbUseBoardStackupColors->Bind( wxEVT_CHECKBOX,
|
||||
[this]( wxCommandEvent& aEvent )
|
||||
{
|
||||
EDA_3D_VIEWER_SETTINGS* cfg = m_frame->GetAdapter().m_Cfg;
|
||||
cfg->m_UseStackupColors = aEvent.IsChecked();
|
||||
|
||||
UpdateLayerCtls();
|
||||
syncLayerPresetSelection();
|
||||
m_frame->NewDisplay( true );
|
||||
} );
|
||||
|
||||
m_panelLayersSizer->Add( m_cbUseBoardStackupColors, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, 7 );
|
||||
|
||||
m_cbLayerPresets->SetToolTip( wxString::Format( _( "Save and restore color and visibility "
|
||||
"combinations.\n"
|
||||
"Use %s+Tab to activate selector.\n"
|
||||
@@ -202,9 +176,7 @@ void APPEARANCE_CONTROLS_3D::OnSize( wxSizeEvent& aEvent )
|
||||
void APPEARANCE_CONTROLS_3D::OnLanguageChanged()
|
||||
{
|
||||
Freeze();
|
||||
|
||||
rebuildLayers();
|
||||
m_cbUseBoardStackupColors->SetLabel( _( "Use board stackup colors" ) );
|
||||
rebuildLayerPresetsWidget();
|
||||
rebuildViewportsWidget();
|
||||
|
||||
@@ -237,9 +209,6 @@ void APPEARANCE_CONTROLS_3D::OnDarkModeToggle()
|
||||
void APPEARANCE_CONTROLS_3D::CommonSettingsChanged()
|
||||
{
|
||||
OnLanguageChanged();
|
||||
|
||||
UpdateLayerCtls();
|
||||
syncLayerPresetSelection();
|
||||
}
|
||||
|
||||
|
||||
@@ -468,19 +437,6 @@ void APPEARANCE_CONTROLS_3D::rebuildLayers()
|
||||
SWATCH_SMALL );
|
||||
swatch->SetToolTip( _( "Left double click or middle click to change color" ) );
|
||||
|
||||
swatch->SetReadOnlyCallback(
|
||||
[this]()
|
||||
{
|
||||
WX_INFOBAR* infobar = m_frame->GetInfoBar();
|
||||
|
||||
infobar->RemoveAllButtons();
|
||||
infobar->AddCloseButton();
|
||||
|
||||
infobar->ShowMessageFor( _( "Uncheck 'Use board stackup colors' to "
|
||||
"allow color editing." ),
|
||||
10000, wxICON_INFORMATION );
|
||||
} );
|
||||
|
||||
sizer->Add( swatch, 0, wxALIGN_CENTER_VERTICAL, 0 );
|
||||
aSetting->m_Ctl_color = swatch;
|
||||
|
||||
@@ -559,7 +515,6 @@ void APPEARANCE_CONTROLS_3D::rebuildLayers()
|
||||
|
||||
void APPEARANCE_CONTROLS_3D::UpdateLayerCtls()
|
||||
{
|
||||
EDA_3D_VIEWER_SETTINGS* cfg = m_frame->GetAdapter().m_Cfg;
|
||||
std::bitset<LAYER_3D_END> visibleLayers = m_frame->GetAdapter().GetVisibleLayers();
|
||||
std::map<int, COLOR4D> colors = m_frame->GetAdapter().GetLayerColors();
|
||||
|
||||
@@ -572,22 +527,8 @@ void APPEARANCE_CONTROLS_3D::UpdateLayerCtls()
|
||||
setting->m_Ctl_visibility->SetValue( visibleLayers.test( setting->m_Id ) );
|
||||
|
||||
if( setting->m_Ctl_color )
|
||||
{
|
||||
setting->m_Ctl_color->SetSwatchColor( colors[ setting->m_Id ], false );
|
||||
|
||||
// if cfg->m_UseStackupColors is set, board colors cannot be modified locally, but
|
||||
// other colors can be
|
||||
if( std::find( inStackupColors.begin(), inStackupColors.end(), setting->m_Id )
|
||||
!= inStackupColors.end() )
|
||||
{
|
||||
if( cfg )
|
||||
setting->m_Ctl_color->SetReadOnly( cfg->m_UseStackupColors );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( cfg )
|
||||
m_cbUseBoardStackupColors->SetValue( cfg->m_UseStackupColors );
|
||||
}
|
||||
|
||||
|
||||
@@ -622,16 +563,9 @@ void APPEARANCE_CONTROLS_3D::syncLayerPresetSelection()
|
||||
std::bitset<LAYER_3D_END> visibleLayers = m_frame->GetAdapter().GetVisibleLayers();
|
||||
std::map<int, COLOR4D> colors = m_frame->GetAdapter().GetLayerColors();
|
||||
|
||||
auto it = std::find_if(
|
||||
presets.begin(), presets.end(),
|
||||
auto it = std::find_if( presets.begin(), presets.end(),
|
||||
[&]( const LAYER_PRESET_3D& aPreset )
|
||||
{
|
||||
if( aPreset.name.Lower() == _( "legacy colors" )
|
||||
&& m_cbUseBoardStackupColors->GetValue() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for( int layer = LAYER_3D_BOARD; layer < LAYER_3D_END; ++layer )
|
||||
{
|
||||
if( aPreset.layers.test( layer ) != visibleLayers.test( layer ) )
|
||||
@@ -644,12 +578,9 @@ void APPEARANCE_CONTROLS_3D::syncLayerPresetSelection()
|
||||
return false;
|
||||
}
|
||||
|
||||
for( int layer = LAYER_3D_START + 1; layer < LAYER_3D_END; ++layer )
|
||||
for( int layer = LAYER_3D_BOARD; layer < LAYER_3D_ADHESIVE; ++layer )
|
||||
{
|
||||
auto it1 = aPreset.colors.find( layer );
|
||||
auto it2 = colors.find( layer );
|
||||
|
||||
if( it1 != aPreset.colors.end() && it2 != colors.end() && *it1 != *it2 )
|
||||
if( aPreset.colors.at( layer ) != colors.at( layer ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -814,9 +745,6 @@ void APPEARANCE_CONTROLS_3D::doApplyLayerPreset( const LAYER_PRESET_3D& aPreset
|
||||
adapter.SetVisibleLayers( aPreset.layers );
|
||||
adapter.SetLayerColors( aPreset.colors );
|
||||
|
||||
if( aPreset.name.Lower() == _( "legacy colors" ) )
|
||||
adapter.m_Cfg->m_UseStackupColors = false;
|
||||
|
||||
UpdateLayerCtls();
|
||||
m_frame->NewDisplay( true );
|
||||
}
|
||||
|
||||
@@ -166,26 +166,26 @@ private:
|
||||
void passOnFocus();
|
||||
|
||||
private:
|
||||
EDA_3D_VIEWER_FRAME* m_frame;
|
||||
wxWindow* m_focusOwner;
|
||||
|
||||
static const APPEARANCE_SETTING_3D s_layerSettings[];
|
||||
|
||||
EDA_3D_VIEWER_FRAME* m_frame;
|
||||
wxWindow* m_focusOwner;
|
||||
GRID_BITMAP_TOGGLE_RENDERER* m_toggleGridRenderer;
|
||||
|
||||
std::vector<std::unique_ptr<APPEARANCE_SETTING_3D>> m_layerSettings;
|
||||
std::map<int, APPEARANCE_SETTING_3D*> m_layerSettingsMap;
|
||||
|
||||
wxArrayString m_presetMRU;
|
||||
wxArrayString m_presetMRU;
|
||||
|
||||
std::map<wxString, VIEWPORT3D> m_viewports;
|
||||
VIEWPORT3D* m_lastSelectedViewport;
|
||||
wxArrayString m_viewportMRU;
|
||||
std::map<wxString, VIEWPORT3D> m_viewports;
|
||||
VIEWPORT3D* m_lastSelectedViewport;
|
||||
wxArrayString m_viewportMRU;
|
||||
|
||||
wxBoxSizer* m_layersOuterSizer;
|
||||
wxBoxSizer* m_envOuterSizer;
|
||||
int m_pointSize;
|
||||
wxColour m_layerPanelColour;
|
||||
GRID_BITMAP_TOGGLE_RENDERER* m_toggleGridRenderer;
|
||||
wxCheckBox* m_cbUseBoardStackupColors;
|
||||
wxBoxSizer* m_layersOuterSizer;
|
||||
wxBoxSizer* m_envOuterSizer;
|
||||
int m_pointSize;
|
||||
wxColour m_layerPanelColour;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
@@ -25,14 +25,11 @@ APPEARANCE_CONTROLS_3D_BASE::APPEARANCE_CONTROLS_3D_BASE( wxWindow* parent, wxWi
|
||||
m_panelLayers->SetSizer( m_panelLayersSizer );
|
||||
m_panelLayers->Layout();
|
||||
m_panelLayersSizer->Fit( m_panelLayers );
|
||||
m_sizerOuter->Add( m_panelLayers, 1, wxEXPAND, 5 );
|
||||
m_sizerOuter->Add( m_panelLayers, 1, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
wxBoxSizer* bBottomMargin;
|
||||
bBottomMargin = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||
bBottomMargin->Add( m_staticline1, 0, wxEXPAND|wxBOTTOM, 3 );
|
||||
|
||||
wxBoxSizer* bPresets;
|
||||
bPresets = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
@@ -47,7 +44,7 @@ APPEARANCE_CONTROLS_3D_BASE::APPEARANCE_CONTROLS_3D_BASE( wxWindow* parent, wxWi
|
||||
bPresets->Add( m_cbLayerPresets, 0, wxALL|wxEXPAND, 2 );
|
||||
|
||||
|
||||
bBottomMargin->Add( bPresets, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
bBottomMargin->Add( bPresets, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
bBottomMargin->Add( 0, 2, 0, wxEXPAND, 5 );
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <wx/string.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/statline.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/choice.h>
|
||||
|
||||
@@ -39,7 +38,6 @@ class APPEARANCE_CONTROLS_3D_BASE : public WX_PANEL
|
||||
wxPanel* m_panelLayers;
|
||||
wxBoxSizer* m_panelLayersSizer;
|
||||
wxScrolledCanvas* m_windowLayers;
|
||||
wxStaticLine* m_staticline1;
|
||||
wxStaticText* m_presetsLabel;
|
||||
wxChoice* m_cbLayerPresets;
|
||||
wxStaticText* m_viewportsLabel;
|
||||
|
||||
@@ -210,6 +210,9 @@ void PANEL_PREVIEW_3D_MODEL::loadSettings()
|
||||
|
||||
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
|
||||
|
||||
const DPI_SCALING_COMMON dpi{ settings, this };
|
||||
m_previewPane->SetScaleFactor( dpi.GetScaleFactor() );
|
||||
|
||||
// TODO(JE) use all control options
|
||||
m_boardAdapter.m_MousewheelPanning = settings->m_Input.scroll_modifier_zoom != 0;
|
||||
|
||||
@@ -441,15 +444,10 @@ void PANEL_PREVIEW_3D_MODEL::doIncrementScale( wxSpinEvent& event, double aSign
|
||||
else if( spinCtrl == m_spinZscale )
|
||||
textCtrl = zscale;
|
||||
|
||||
double step = SCALE_INCREMENT;
|
||||
|
||||
if( wxGetMouseState().ShiftDown( ) )
|
||||
step = SCALE_INCREMENT_FINE;
|
||||
|
||||
double curr_value = EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, EDA_UNITS::UNSCALED,
|
||||
textCtrl->GetValue() );
|
||||
|
||||
curr_value += ( step * aSign );
|
||||
curr_value += ( SCALE_INCREMENT * aSign );
|
||||
curr_value = std::max( 1/MAX_SCALE, curr_value );
|
||||
curr_value = std::min( curr_value, MAX_SCALE );
|
||||
|
||||
@@ -467,15 +465,10 @@ void PANEL_PREVIEW_3D_MODEL::doIncrementRotation( wxSpinEvent& aEvent, double aS
|
||||
else if( spinCtrl == m_spinZrot )
|
||||
textCtrl = zrot;
|
||||
|
||||
double step = ROTATION_INCREMENT;
|
||||
|
||||
if( wxGetMouseState().ShiftDown( ) )
|
||||
step = ROTATION_INCREMENT_FINE;
|
||||
|
||||
double curr_value = EDA_UNIT_UTILS::UI::DoubleValueFromString( unityScale, EDA_UNITS::DEGREES,
|
||||
textCtrl->GetValue() );
|
||||
|
||||
curr_value += ( step * aSign );
|
||||
curr_value += ( ROTATION_INCREMENT * aSign );
|
||||
curr_value = std::max( -MAX_ROTATION, curr_value );
|
||||
curr_value = std::min( curr_value, MAX_ROTATION );
|
||||
|
||||
@@ -495,22 +488,16 @@ void PANEL_PREVIEW_3D_MODEL::doIncrementOffset( wxSpinEvent& event, double aSign
|
||||
textCtrl = zoff;
|
||||
|
||||
double step_mm = OFFSET_INCREMENT_MM;
|
||||
|
||||
if( wxGetMouseState().ShiftDown( ) )
|
||||
step_mm = OFFSET_INCREMENT_MM_FINE;
|
||||
double curr_value_mm =
|
||||
EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, m_userUnits,
|
||||
textCtrl->GetValue() )
|
||||
/ pcbIUScale.IU_PER_MM;
|
||||
|
||||
if( m_userUnits == EDA_UNITS::MILS || m_userUnits == EDA_UNITS::INCHES )
|
||||
{
|
||||
step_mm = 25.4*OFFSET_INCREMENT_MIL/1000;
|
||||
|
||||
if( wxGetMouseState().ShiftDown( ) )
|
||||
step_mm = 25.4*OFFSET_INCREMENT_MIL_FINE/1000;;
|
||||
}
|
||||
|
||||
double curr_value_mm = EDA_UNIT_UTILS::UI::DoubleValueFromString( pcbIUScale, m_userUnits,
|
||||
textCtrl->GetValue() )
|
||||
/ pcbIUScale.IU_PER_MM;
|
||||
|
||||
curr_value_mm += ( step_mm * aSign );
|
||||
curr_value_mm = std::max( -MAX_OFFSET, curr_value_mm );
|
||||
curr_value_mm = std::min( curr_value_mm, MAX_OFFSET );
|
||||
@@ -546,10 +533,10 @@ void PANEL_PREVIEW_3D_MODEL::onMouseWheelRot( wxMouseEvent& event )
|
||||
{
|
||||
wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject();
|
||||
|
||||
double step = ROTATION_INCREMENT;
|
||||
double step = ROTATION_INCREMENT_WHEEL;
|
||||
|
||||
if( event.ShiftDown( ) )
|
||||
step = ROTATION_INCREMENT_FINE;
|
||||
step = ROTATION_INCREMENT_WHEEL_FINE;
|
||||
|
||||
if( event.GetWheelRotation() >= 0 )
|
||||
step = -step;
|
||||
|
||||
@@ -43,8 +43,9 @@
|
||||
#define SCALE_INCREMENT_FINE 0.02
|
||||
#define SCALE_INCREMENT 0.1
|
||||
|
||||
#define ROTATION_INCREMENT 90 // in degrees
|
||||
#define ROTATION_INCREMENT_FINE 1 // in degrees
|
||||
#define ROTATION_INCREMENT 90 // in degrees, for spin button command
|
||||
#define ROTATION_INCREMENT_WHEEL 90 // in degrees, for mouse wheel command
|
||||
#define ROTATION_INCREMENT_WHEEL_FINE 1 // in degrees, for mouse wheel command
|
||||
|
||||
#define OFFSET_INCREMENT_MM 0.5
|
||||
#define OFFSET_INCREMENT_MM_FINE 0.1
|
||||
|
||||
+4
-12
@@ -106,9 +106,10 @@ option( KICAD_SCRIPTING_WXPYTHON
|
||||
ON )
|
||||
mark_as_advanced( KICAD_SCRIPTING_WXPYTHON )
|
||||
|
||||
option( KICAD_UPDATE_CHECK
|
||||
cmake_dependent_option( KICAD_UPDATE_CHECK
|
||||
"Build in update check"
|
||||
ON )
|
||||
ON "APPLE_OR_WIN32"
|
||||
OFF )
|
||||
|
||||
# EGL is only needed on Linux with Wayland
|
||||
cmake_dependent_option( KICAD_USE_EGL
|
||||
@@ -514,8 +515,6 @@ if( MSVC )
|
||||
string( APPEND CMAKE_CXX_FLAGS " /wd4800" )
|
||||
# /Zi: create PDB
|
||||
string( APPEND CMAKE_CXX_FLAGS " /Zi" )
|
||||
# /Zc:__cplusplus: define this macro according to C++ standard version
|
||||
string( APPEND CMAKE_CXX_FLAGS " /Zc:__cplusplus" )
|
||||
# /GF: enable string pooling
|
||||
string( APPEND CMAKE_CXX_FLAGS_RELEASE " /GF" )
|
||||
string( APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " /GF" )
|
||||
@@ -878,14 +877,7 @@ check_find_package_result( PYTHONINTERP_FOUND "Python Interpreter" )
|
||||
# Get the correct Python site package install path from the Python interpreter found by
|
||||
# FindPythonInterp unless the user specifically defined a custom path.
|
||||
if( NOT PYTHON_SITE_PACKAGE_PATH )
|
||||
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import sys, sysconfig
|
||||
if 'deb_system' in sysconfig.get_scheme_names():
|
||||
scheme = 'deb_system'
|
||||
elif sys.version_info > (3, 10):
|
||||
scheme = sysconfig.get_default_scheme()
|
||||
else:
|
||||
scheme = sysconfig._get_default_scheme()
|
||||
print(\"%s\"%sysconfig.get_path('platlib', vars={'platbase': '.'}, scheme=scheme))"
|
||||
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import sysconfig;print(\"%s\"%sysconfig.get_path('platlib', vars={'platbase': '.'}))"
|
||||
OUTPUT_VARIABLE PYTHON_SITE_PACKAGE_PATH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
@@ -138,7 +138,7 @@ void IMAGE_SIZE::SetUnit( EDA_UNITS aUnit )
|
||||
}
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE( BITMAP2CMP_FRAME, KIWAY_PLAYER )
|
||||
BEGIN_EVENT_TABLE( BITMAP2CMP_FRAME, EDA_BASE_FRAME )
|
||||
EVT_MENU( wxID_CLOSE, BITMAP2CMP_FRAME::OnExit )
|
||||
EVT_MENU( wxID_EXIT, BITMAP2CMP_FRAME::OnExit )
|
||||
|
||||
@@ -193,7 +193,6 @@ BITMAP2CMP_FRAME::BITMAP2CMP_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||
m_toolManager->InitTools();
|
||||
|
||||
ReCreateMenuBar();
|
||||
setupUIConditions();
|
||||
|
||||
GetSizer()->SetSizeHints( this );
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# This program source code file is part of KICAD, a free EDA CAD application.
|
||||
#
|
||||
# Copyright (C) 2015 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
# Copyright (C) 2015-2024 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
|
||||
@@ -72,7 +72,6 @@ set( _wvh_new_version_text
|
||||
#endif
|
||||
|
||||
#define KICAD_COMMIT_HASH \"${KICAD_COMMIT_HASH}\"
|
||||
#define KICAD_VERSION \"${KICAD_VERSION}\"
|
||||
#define KICAD_VERSION_FULL \"${KICAD_VERSION_FULL}\"
|
||||
#define KICAD_SEMANTIC_VERSION \"${KICAD_SEMANTIC_VERSION}\"
|
||||
#define KICAD_MAJOR_VERSION \"${KICAD_MAJOR_VERSION}\"
|
||||
|
||||
+19
-39
@@ -27,7 +27,7 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
# Set the needed libraries
|
||||
set( OCC_LIBS_COMMON
|
||||
set( OCC_LIBS
|
||||
TKBinL
|
||||
TKBin
|
||||
TKBinTObj
|
||||
@@ -45,6 +45,7 @@ set( OCC_LIBS_COMMON
|
||||
TKGeomAlgo
|
||||
TKGeomBase
|
||||
TKHLR
|
||||
TKIGES
|
||||
TKLCAF
|
||||
TKMath
|
||||
TKMesh
|
||||
@@ -55,10 +56,18 @@ set( OCC_LIBS_COMMON
|
||||
TKRWMesh
|
||||
TKService
|
||||
TKShHealing
|
||||
TKSTEP209
|
||||
TKSTEPAttr
|
||||
TKSTEPBase
|
||||
TKSTEP
|
||||
TKSTL
|
||||
TKTObj
|
||||
TKTopAlgo
|
||||
TKV3d
|
||||
TKVRML
|
||||
TKXCAF
|
||||
TKXDEIGES
|
||||
TKXDESTEP
|
||||
TKXMesh
|
||||
TKXmlL
|
||||
TKXml
|
||||
@@ -67,27 +76,6 @@ set( OCC_LIBS_COMMON
|
||||
TKXSBase
|
||||
)
|
||||
|
||||
# Libraries valid pre-7.8.0
|
||||
set( OCC_LIBS_PRE_78
|
||||
TKIGES
|
||||
TKSTEP209
|
||||
TKSTEPAttr
|
||||
TKSTEPBase
|
||||
TKSTEP
|
||||
TKSTL
|
||||
TKVRML
|
||||
TKXDEIGES
|
||||
TKXDESTEP
|
||||
)
|
||||
|
||||
# Libraries for versions >= 7.8.0
|
||||
set( OCC_LIBS_POST_78
|
||||
TKDEIGES
|
||||
TKDEGLTF
|
||||
TKDESTEP
|
||||
TKDESTL
|
||||
)
|
||||
|
||||
set(OCC_TYPE "OpenCASCADE Standard Edition")
|
||||
if(WIN32)
|
||||
if(CYGWIN OR MINGW)
|
||||
@@ -190,8 +178,9 @@ endif(OCC_INCLUDE_DIR AND NOT ${OCC_INCLUDE_DIR} STREQUAL "OCC_INCLUDE_DIR-NOTFO
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(OCC REQUIRED_VARS OCC_INCLUDE_DIR VERSION_VAR OCC_VERSION_STRING)
|
||||
|
||||
macro(occ_lib_search SEARCH_LIST)
|
||||
foreach(lib IN LISTS ${SEARCH_LIST})
|
||||
if(OCC_FOUND)
|
||||
foreach(lib IN LISTS OCC_LIBS)
|
||||
|
||||
#Use the specified library location if given
|
||||
find_library(OCC_TEMP_LIB ${lib} HINTS ${OCC_LIBRARY_DIR} NO_DEFAULT_PATH)
|
||||
if(${OCC_TEMP_LIB} STREQUAL "OCC_TEMP_LIB-NOTFOUND")
|
||||
@@ -208,20 +197,11 @@ macro(occ_lib_search SEARCH_LIST)
|
||||
|
||||
unset(OCC_TEMP_LIB CACHE)
|
||||
endforeach(lib)
|
||||
endmacro()
|
||||
|
||||
if(OCC_FOUND)
|
||||
occ_lib_search( OCC_LIBS_COMMON )
|
||||
if(OCC_VERSION_STRING VERSION_LESS "7.8.0")
|
||||
occ_lib_search( OCC_LIBS_PRE_78 )
|
||||
else()
|
||||
occ_lib_search( OCC_LIBS_POST_78 )
|
||||
endif()
|
||||
|
||||
#Convert path names to absolute for cleaner display
|
||||
get_filename_component(OCC_INCLUDE_DIR "${OCC_INCLUDE_DIR}" ABSOLUTE)
|
||||
get_filename_component(OCC_LIBRARY_DIR "${OCC_LIBRARY_DIR}" ABSOLUTE)
|
||||
message(STATUS "Found ${OCC_TYPE} version: ${OCC_VERSION_STRING}")
|
||||
message(STATUS " ++ ${OCC_TYPE} include directory: ${OCC_INCLUDE_DIR}")
|
||||
message(STATUS " ++ ${OCC_TYPE} shared libraries directory: ${OCC_LIBRARY_DIR}")
|
||||
#Convert path names to absolute for cleaner display
|
||||
get_filename_component(OCC_INCLUDE_DIR "${OCC_INCLUDE_DIR}" ABSOLUTE)
|
||||
get_filename_component(OCC_LIBRARY_DIR "${OCC_LIBRARY_DIR}" ABSOLUTE)
|
||||
message(STATUS "Found ${OCC_TYPE} version: ${OCC_VERSION_STRING}")
|
||||
message(STATUS " ++ ${OCC_TYPE} include directory: ${OCC_INCLUDE_DIR}")
|
||||
message(STATUS " ++ ${OCC_TYPE} shared libraries directory: ${OCC_LIBRARY_DIR}")
|
||||
endif(OCC_FOUND)
|
||||
|
||||
@@ -37,7 +37,7 @@ unset(_Python_NAMES)
|
||||
|
||||
set(_PYTHON1_VERSIONS 1.6 1.5)
|
||||
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
|
||||
set(_PYTHON3_VERSIONS 3.13 3.12 3.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
|
||||
set(_PYTHON3_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
|
||||
|
||||
# Disabling the "search every possible place" code for now
|
||||
# see https://gitlab.com/kicad/code/kicad/-/issues/8553
|
||||
|
||||
@@ -44,7 +44,7 @@ cmake_find_frameworks(Python)
|
||||
|
||||
set(_PYTHON1_VERSIONS 1.6 1.5)
|
||||
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
|
||||
set(_PYTHON3_VERSIONS 3.13 3.12 3.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
|
||||
set(_PYTHON3_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
|
||||
|
||||
if(PythonLibs_FIND_VERSION)
|
||||
if(PythonLibs_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
|
||||
|
||||
@@ -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-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
# Copyright (C) 2016-2023 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 "8.0.4" )
|
||||
set( KICAD_SEMANTIC_VERSION "8.99.0-unknown" )
|
||||
|
||||
# Default the version to the semantic version.
|
||||
# This is overridden by the git repository tag though (if using git)
|
||||
|
||||
@@ -388,10 +388,8 @@ set( COMMON_IO_SRCS
|
||||
io/io_utils.cpp
|
||||
|
||||
# Altium
|
||||
io/altium/altium_binary_parser.cpp
|
||||
io/altium/altium_ascii_parser.cpp
|
||||
io/altium/altium_parser.cpp
|
||||
io/altium/altium_parser_utils.cpp
|
||||
io/altium/altium_props_utils.cpp
|
||||
|
||||
# Cadstar
|
||||
io/cadstar/cadstar_archive_parser.cpp
|
||||
|
||||
@@ -104,11 +104,6 @@ static const wxChar EnableEeschemaPrintCairo[] = wxT( "EnableEeschemaPrintCairo"
|
||||
static const wxChar DisambiguationTime[] = wxT( "DisambiguationTime" );
|
||||
static const wxChar PcbSelectionVisibilityRatio[] = wxT( "PcbSelectionVisibilityRatio" );
|
||||
static const wxChar MinimumSegmentLength[] = wxT( "MinimumSegmentLength" );
|
||||
static const wxChar OcePluginLinearDeflection[] = wxT( "OcePluginLinearDeflection" );
|
||||
static const wxChar OcePluginAngularDeflection[] = wxT( "OcePluginAngularDeflection" );
|
||||
static const wxChar TriangulateSimplificationLevel[] = wxT( "TriangulateSimplificationLevel" );
|
||||
static const wxChar TriangulateMinimumArea[] = wxT( "TriangulateMinimumArea" );
|
||||
static const wxChar EnableCacheFriendlyFracture[] = wxT( "EnableCacheFriendlyFracture" );
|
||||
} // namespace KEYS
|
||||
|
||||
|
||||
@@ -253,14 +248,6 @@ ADVANCED_CFG::ADVANCED_CFG()
|
||||
|
||||
m_MinimumSegmentLength = 50;
|
||||
|
||||
m_OcePluginLinearDeflection = 0.14;
|
||||
m_OcePluginAngularDeflection = 30;
|
||||
|
||||
m_TriangulateSimplificationLevel = 50;
|
||||
m_TriangulateMinimumArea = 1000;
|
||||
|
||||
m_EnableCacheFriendlyFracture = true;
|
||||
|
||||
loadFromConfigFile();
|
||||
}
|
||||
|
||||
@@ -457,26 +444,6 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
|
||||
&m_MinimumSegmentLength,
|
||||
m_MinimumSegmentLength, 10, 1000 ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::OcePluginLinearDeflection,
|
||||
&m_OcePluginLinearDeflection,
|
||||
m_OcePluginLinearDeflection, 0.01, 1.0 ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::OcePluginAngularDeflection,
|
||||
&m_OcePluginAngularDeflection,
|
||||
m_OcePluginAngularDeflection, 0.01, 360.0 ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::TriangulateSimplificationLevel,
|
||||
&m_TriangulateSimplificationLevel,
|
||||
m_TriangulateSimplificationLevel, 0, 1000 ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_INT( true, AC_KEYS::TriangulateMinimumArea,
|
||||
&m_TriangulateMinimumArea,
|
||||
m_TriangulateMinimumArea, 0, 100000 ) );
|
||||
|
||||
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::EnableCacheFriendlyFracture,
|
||||
&m_EnableCacheFriendlyFracture,
|
||||
m_EnableCacheFriendlyFracture ) );
|
||||
|
||||
// Special case for trace mask setting...we just grab them and set them immediately
|
||||
// Because we even use wxLogTrace inside of advanced config
|
||||
wxString traceMasks;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2015-2024 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
|
||||
@@ -51,19 +51,6 @@ extern std::string GetCurlLibVersion();
|
||||
#include <kicad_build_version.h>
|
||||
#undef INCLUDE_KICAD_VERSION
|
||||
|
||||
// Remember OpenGL info
|
||||
static wxString s_glVendor;
|
||||
static wxString s_glRenderer;
|
||||
static wxString s_glVersion;
|
||||
|
||||
void SetOpenGLInfo( const char* aVendor, const char* aRenderer, const char* aVersion )
|
||||
{
|
||||
s_glVendor = wxString::FromUTF8( aVendor );
|
||||
s_glRenderer = wxString::FromUTF8( aRenderer );
|
||||
s_glVersion = wxString::FromUTF8( aVersion );
|
||||
}
|
||||
|
||||
|
||||
wxString GetPlatformGetBitnessName()
|
||||
{
|
||||
wxPlatformInfo platform;
|
||||
@@ -84,13 +71,6 @@ wxString GetBuildVersion()
|
||||
}
|
||||
|
||||
|
||||
wxString GetBaseVersion()
|
||||
{
|
||||
wxString msg = wxString::Format( wxT( "%s" ), wxT( KICAD_VERSION ) );
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
wxString GetBuildDate()
|
||||
{
|
||||
wxString msg = wxString::Format( wxT( "%s %s" ), wxT( __DATE__ ), wxT( __TIME__ ) );
|
||||
@@ -213,12 +193,6 @@ wxString GetVersionInfoData( const wxString& aTitle, bool aHtml, bool aBrief )
|
||||
<< ", " << wxGetenv( "XDG_SESSION_TYPE" );
|
||||
#endif
|
||||
|
||||
if( !s_glVendor.empty() || !s_glRenderer.empty() || !s_glVersion.empty() )
|
||||
{
|
||||
aMsg << eol;
|
||||
aMsg << "OpenGL: " << s_glVendor << ", " << s_glRenderer << ", " << s_glVersion;
|
||||
}
|
||||
|
||||
aMsg << eol << eol;
|
||||
|
||||
if( !aBrief )
|
||||
|
||||
@@ -347,24 +347,6 @@ bool DATABASE_CONNECTION::SelectOne( const std::string& aTable,
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogTrace( traceDatabase, wxT( "SelectOne: table `%s` not in row cache; will SelectAll" ),
|
||||
tableName, aWhere.second );
|
||||
|
||||
selectAllAndCache( tableName, aWhere.first );
|
||||
|
||||
if( m_cache->Get( tableName, cacheEntry ) )
|
||||
{
|
||||
if( cacheEntry.count( aWhere.second ) )
|
||||
{
|
||||
wxLogTrace( traceDatabase, wxT( "SelectOne: `%s` with parameter `%s` - cache hit" ),
|
||||
tableName, aWhere.second );
|
||||
aResult = cacheEntry.at( aWhere.second );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( !m_columnCache.count( tableName ) )
|
||||
{
|
||||
@@ -390,14 +372,15 @@ bool DATABASE_CONNECTION::SelectOne( const std::string& aTable,
|
||||
columnsFor( tableName ),
|
||||
m_quoteChar, tableName, m_quoteChar,
|
||||
m_quoteChar, columnName, m_quoteChar );
|
||||
|
||||
nanodbc::statement statement( *m_conn );
|
||||
nanodbc::string query = fromUTF8( queryStr );
|
||||
|
||||
PROF_TIMER timer;
|
||||
nanodbc::statement statement;
|
||||
|
||||
try
|
||||
{
|
||||
statement.prepare( *m_conn, query );
|
||||
statement.prepare( query );
|
||||
statement.bind( 0, aWhere.second.c_str() );
|
||||
}
|
||||
catch( nanodbc::database_error& e )
|
||||
@@ -465,7 +448,7 @@ bool DATABASE_CONNECTION::SelectOne( const std::string& aTable,
|
||||
{
|
||||
aResult[column] = fmt::format( "{:G}", results.get<double>( i ) );
|
||||
}
|
||||
catch( nanodbc::null_access_error& )
|
||||
catch( nanodbc::null_access_error& e )
|
||||
{
|
||||
// Column was empty (null)
|
||||
aResult[column] = std::string();
|
||||
@@ -491,14 +474,42 @@ bool DATABASE_CONNECTION::SelectOne( const std::string& aTable,
|
||||
}
|
||||
|
||||
|
||||
bool DATABASE_CONNECTION::selectAllAndCache( const std::string& aTable, const std::string& aKey )
|
||||
bool DATABASE_CONNECTION::SelectAll( const std::string& aTable, const std::string& aKey,
|
||||
std::vector<ROW>& aResults )
|
||||
{
|
||||
if( !m_conn )
|
||||
{
|
||||
wxLogTrace( traceDatabase, wxT( "Called SelectAll without valid connection!" ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
auto tableMapIter = m_tables.find( aTable );
|
||||
|
||||
if( tableMapIter == m_tables.end() )
|
||||
{
|
||||
wxLogTrace( traceDatabase, wxT( "SelectAll: requested table %s not found in cache" ),
|
||||
aTable );
|
||||
return false;
|
||||
}
|
||||
|
||||
DB_CACHE_TYPE::CACHE_VALUE cacheEntry;
|
||||
|
||||
if( m_cache->Get( aTable, cacheEntry ) )
|
||||
{
|
||||
wxLogTrace( traceDatabase, wxT( "SelectAll: `%s` - cache hit" ), aTable );
|
||||
|
||||
for( auto &[ key, row ] : cacheEntry )
|
||||
aResults.emplace_back( row );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
nanodbc::statement statement( *m_conn );
|
||||
|
||||
nanodbc::string query = fromUTF8( fmt::format( "SELECT {} FROM {}{}{}", columnsFor( aTable ),
|
||||
m_quoteChar, aTable, m_quoteChar ) );
|
||||
|
||||
wxLogTrace( traceDatabase, wxT( "selectAllAndCache: `%s`" ), toUTF8( query ) );
|
||||
wxLogTrace( traceDatabase, wxT( "SelectAll: `%s`" ), toUTF8( query ) );
|
||||
|
||||
PROF_TIMER timer;
|
||||
|
||||
@@ -509,8 +520,7 @@ bool DATABASE_CONNECTION::selectAllAndCache( const std::string& aTable, const st
|
||||
catch( nanodbc::database_error& e )
|
||||
{
|
||||
m_lastError = e.what();
|
||||
wxLogTrace( traceDatabase,
|
||||
wxT( "Exception while preparing query for selectAllAndCache: %s" ),
|
||||
wxLogTrace( traceDatabase, wxT( "Exception while preparing query for SelectAll: %s" ),
|
||||
m_lastError );
|
||||
|
||||
// Exception may be due to a connection error; nanodbc won't auto-reconnect
|
||||
@@ -528,8 +538,7 @@ bool DATABASE_CONNECTION::selectAllAndCache( const std::string& aTable, const st
|
||||
catch( nanodbc::database_error& e )
|
||||
{
|
||||
m_lastError = e.what();
|
||||
wxLogTrace( traceDatabase,
|
||||
wxT( "Exception while executing query for selectAllAndCache: %s" ),
|
||||
wxLogTrace( traceDatabase, wxT( "Exception while executing query for SelectAll: %s" ),
|
||||
m_lastError );
|
||||
|
||||
// Exception may be due to a connection error; nanodbc won't auto-reconnect
|
||||
@@ -540,17 +549,15 @@ bool DATABASE_CONNECTION::selectAllAndCache( const std::string& aTable, const st
|
||||
|
||||
timer.Stop();
|
||||
|
||||
DB_CACHE_TYPE::CACHE_VALUE cacheEntry;
|
||||
|
||||
auto handleException =
|
||||
[&]( std::runtime_error& aException, const std::string& aExtraContext = "" )
|
||||
{
|
||||
m_lastError = aException.what();
|
||||
std::string extra = aExtraContext.empty() ? "" : ": " + aExtraContext;
|
||||
wxLogTrace( traceDatabase,
|
||||
wxT( "Exception while parsing result %d from selectAllAndCache: %s%s" ),
|
||||
cacheEntry.size(), m_lastError, extra );
|
||||
};
|
||||
{
|
||||
m_lastError = aException.what();
|
||||
std::string extra = aExtraContext.empty() ? "" : ": " + aExtraContext;
|
||||
wxLogTrace( traceDatabase,
|
||||
wxT( "Exception while parsing result %d from SelectAll: %s%s" ),
|
||||
aResults.size(), m_lastError, extra );
|
||||
};
|
||||
|
||||
while( results.next() )
|
||||
{
|
||||
@@ -598,7 +605,7 @@ bool DATABASE_CONNECTION::selectAllAndCache( const std::string& aTable, const st
|
||||
{
|
||||
result[column] = fmt::format( "{:G}", results.get<double>( j ) );
|
||||
}
|
||||
catch( nanodbc::null_access_error& )
|
||||
catch( nanodbc::null_access_error& e )
|
||||
{
|
||||
// Column was empty (null)
|
||||
result[column] = std::string();
|
||||
@@ -627,64 +634,20 @@ bool DATABASE_CONNECTION::selectAllAndCache( const std::string& aTable, const st
|
||||
}
|
||||
}
|
||||
|
||||
wxASSERT( result.count( aKey ) );
|
||||
std::string keyStr = std::any_cast<std::string>( result.at( aKey ) );
|
||||
cacheEntry[keyStr] = result;
|
||||
aResults.emplace_back( std::move( result ) );
|
||||
}
|
||||
|
||||
wxLogTrace( traceDatabase, wxT( "selectAllAndCache from %s completed in %0.1f ms" ), aTable,
|
||||
wxLogTrace( traceDatabase, wxT( "SelectAll from %s completed in %0.1f ms" ), aTable,
|
||||
timer.msecs() );
|
||||
|
||||
for( const ROW& row : aResults )
|
||||
{
|
||||
wxASSERT( row.count( aKey ) );
|
||||
std::string keyStr = std::any_cast<std::string>( row.at( aKey ) );
|
||||
cacheEntry[keyStr] = row;
|
||||
}
|
||||
|
||||
m_cache->Put( aTable, cacheEntry );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool DATABASE_CONNECTION::SelectAll( const std::string& aTable, const std::string& aKey,
|
||||
std::vector<ROW>& aResults )
|
||||
{
|
||||
if( !m_conn )
|
||||
{
|
||||
wxLogTrace( traceDatabase, wxT( "Called SelectAll without valid connection!" ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
auto tableMapIter = m_tables.find( aTable );
|
||||
|
||||
if( tableMapIter == m_tables.end() )
|
||||
{
|
||||
wxLogTrace( traceDatabase, wxT( "SelectAll: requested table %s not found in cache" ),
|
||||
aTable );
|
||||
return false;
|
||||
}
|
||||
|
||||
DB_CACHE_TYPE::CACHE_VALUE cacheEntry;
|
||||
|
||||
if( !m_cache->Get( aTable, cacheEntry ) )
|
||||
{
|
||||
if( !selectAllAndCache( aTable, aKey ) )
|
||||
{
|
||||
wxLogTrace( traceDatabase, wxT( "SelectAll: `%s` cache fill failed" ), aTable );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Now it should be filled
|
||||
m_cache->Get( aTable, cacheEntry );
|
||||
}
|
||||
|
||||
if( !m_cache->Get( aTable, cacheEntry ) )
|
||||
{
|
||||
wxLogTrace( traceDatabase, wxT( "SelectAll: `%s` failed to get results from cache!" ),
|
||||
aTable );
|
||||
return false;
|
||||
}
|
||||
|
||||
wxLogTrace( traceDatabase, wxT( "SelectAll: `%s` - returning cached results" ), aTable );
|
||||
|
||||
aResults.reserve( cacheEntry.size() );
|
||||
|
||||
for( auto &[ key, row ] : cacheEntry )
|
||||
aResults.emplace_back( row );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -32,17 +32,6 @@
|
||||
const int dblibSchemaVersion = 1;
|
||||
|
||||
|
||||
DATABASE_FIELD_MAPPING::DATABASE_FIELD_MAPPING( std::string aColumn, std::string aName,
|
||||
bool aVisibleOnAdd, bool aVisibleInChooser,
|
||||
bool aShowName, bool aInheritProperties ) :
|
||||
column( aColumn ),
|
||||
name( aName ), name_wx( aName.c_str(), wxConvUTF8 ), visible_on_add( aVisibleOnAdd ),
|
||||
visible_in_chooser( aVisibleInChooser ), show_name( aShowName ),
|
||||
inherit_properties( aInheritProperties )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
DATABASE_LIB_SETTINGS::DATABASE_LIB_SETTINGS( const std::string& aFilename ) :
|
||||
JSON_SETTINGS( aFilename, SETTINGS_LOC::NONE, dblibSchemaVersion )
|
||||
{
|
||||
@@ -124,8 +113,11 @@ DATABASE_LIB_SETTINGS::DATABASE_LIB_SETTINGS( const std::string& aFilename ) :
|
||||
bool inherit = fetchOrDefault<bool>( fieldJson, "inherit_properties" );
|
||||
|
||||
table.fields.emplace_back(
|
||||
DATABASE_FIELD_MAPPING( column, name, visible_on_add,
|
||||
visible_in_chooser, show_name, inherit ) );
|
||||
DATABASE_FIELD_MAPPING(
|
||||
{
|
||||
column, name, visible_on_add, visible_in_chooser, show_name,
|
||||
inherit
|
||||
} ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -217,7 +217,6 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Tomasz Wlostowski" ), LEAD_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Jeff Young" ), LEAD_DEV, nullptr ) );
|
||||
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Fabien Corona" ), FORMER_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Dick Hollenbeck" ), FORMER_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Alexis Lockwood" ), FORMER_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Brian Sidebotham" ), FORMER_DEV, nullptr ) );
|
||||
@@ -225,16 +224,13 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Mikolaj Wielgus" ), FORMER_DEV, nullptr ) );
|
||||
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Martin Aberg" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Yüksel Açikgöz" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Rohan Agrawal" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Johannes Agricola" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Erik Agsjö" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Nabeel Ahmad" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Werner Almesberger" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Shawn Anastasio" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Collin Anderson" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Tom Andrews" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Subaru Arai" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Mikael Arguedas" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Lachlan Audas" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Jean-Noel Avila" ), CONTRIB_DEV, nullptr ) );
|
||||
@@ -250,19 +246,16 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Frank Bennett" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Roman Beranek" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Francois Berder" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Martin Berglund" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Gustav Bergquist" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Cirilo Bernardo" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Joël Bertrand" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Andreas Beutling" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Brian F. G. Bidulock" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Anton Blanchard" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Steve Bollinger" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Blair Bonnett" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Markus Bonk" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Franck Bourdonnec" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Carlo Bramini" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Matthias Breithaupt" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Stefan Brüns" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Andreas Buhr" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Ryan Bunch" ), CONTRIB_DEV, nullptr ) );
|
||||
@@ -278,9 +271,8 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Marcus Comstedt" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Diogo Condeco" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Colin Cooper" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Emile Cormier" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Fabien Corona" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Garth Corral" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Sergio Costas" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Kevin Cozens" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Dan Cross" ), CONTRIB_DEV, nullptr ) );
|
||||
|
||||
@@ -291,13 +283,11 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Albin Dennevi" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Ruben De Smet" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Alexander Dewing" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Okan Demir" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Jonas Diemer" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Ben Dooks" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Pavel Dovgalyuk" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Andrew Downing" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Jan Dubiec" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Lucas Dumont" ), CONTRIB_DEV, nullptr ) );
|
||||
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Gerd Egidy" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Jean Philippe Eimer" ), CONTRIB_DEV, nullptr ) );
|
||||
@@ -311,7 +301,6 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Joe Ferner" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Brian Fiete" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Thomas Figueroa" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Gilbert J.M. Forkel" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Vincenzo Fortunato" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Drew Fustini" ), CONTRIB_DEV, nullptr ) );
|
||||
|
||||
@@ -327,7 +316,6 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Jeff Glass" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Alexander Golubev" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Angus Gratton" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Andrea Greco" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Element Green" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Mathias Grimmberger" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Johan Grip" ), CONTRIB_DEV, nullptr ) );
|
||||
@@ -340,7 +328,6 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Jonathan Haas" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Mark Hämmerling" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Stefan Hamminga" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Ma Han" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Scott Hanson" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Ben Harris" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Lukas F. Hartmann" ), CONTRIB_DEV, nullptr ) );
|
||||
@@ -353,11 +340,7 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Hans Henry von Tresckow" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Diego Herranz" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Marco Hess" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "David Holdeman" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Laurens Holst" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Yang Hongbo" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Mario Hros" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Josue Huaroto" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Matt Huszagh" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Torsten Hüter" ), CONTRIB_DEV, nullptr ) );
|
||||
|
||||
@@ -368,14 +351,13 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Vlad Ivanov" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Andre Iwers" ), CONTRIB_DEV, nullptr ) );
|
||||
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Hasan Jaafar" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "James Jackson" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Jerry Jacobs" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Christian Jacobsen" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Michal Jahelka" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Martin Janitschke" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Jonathan Jara-Almonte" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Zhuang Jiezhi" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Gilbert J.M. Forkel" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "José Jorge Enríquez" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Franck Jullien" ), CONTRIB_DEV, nullptr ) );
|
||||
|
||||
@@ -389,7 +371,6 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Graham Keeth" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Yury Khalyavin" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Eldar Khayrullin" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Georges Khaznadar" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Gary Kim" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Ingo Kletti" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Kliment" ), CONTRIB_DEV, nullptr ) );
|
||||
@@ -459,18 +440,15 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Jason Oster" ), CONTRIB_DEV, nullptr ) );
|
||||
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Frank Palazzolo" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Matus Pavelek" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "luz paz" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Miguel Angel Ajo Pelayo" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Patrick Pereira" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Jacobo Aragunde Perez" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Matthew Petroff" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Johannes Pfister" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Fabian Pflug" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Christian Pfluger" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Brian Piccioni" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Nicolas Planel" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Paweł Płóciennik" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Carl Poirier" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Reece Pollack" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Alain Portal" ), CONTRIB_DEV, nullptr ) );
|
||||
@@ -483,7 +461,6 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Barabas Raffai" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Urja Rannikko" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Hendrik v. Raven" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Joshua Redstone" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Michele Renda" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Jean-Samuel Reynaud" ), CONTRIB_DEV, nullptr ) );
|
||||
@@ -501,7 +478,6 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Fabio Rossi" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Ian Roth" ), CONTRIB_DEV, nullptr ) );
|
||||
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Clément Saccoccio" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "J. Morio Sakaguchi" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Simon Schaak" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Ross Schlaikjer" ), CONTRIB_DEV, nullptr ) );
|
||||
@@ -519,7 +495,6 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Yang Sheng" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Chetan Shinde" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Alexander Shuklin" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Adam Simpkins" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Slawomir Siudym" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Marco Serantoni" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Guillaume Simard" ), CONTRIB_DEV, nullptr ) );
|
||||
@@ -540,15 +515,11 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Alexander Stock" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Martin Stoilov" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Hiroki Suenaga" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Kuba Sunderland-Ober" ), CONTRIB_DEV, nullptr ) );
|
||||
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Nimish Telang" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Martin Thierer" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Karl Thorén" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Hiroshi Tokita" ), CONTRIB_DEV, nullptr ) );
|
||||
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Vladimir Ur" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Yon Uriarte" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Matthias Urlichs" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Vladimir Uryvaev" ), CONTRIB_DEV, nullptr ) );
|
||||
|
||||
@@ -556,25 +527,20 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Dave Vandenbout" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Edwin van den Oetelaar" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Mark van Doesburg" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Nils van Zuijlen" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Fabio Varesano" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Benjamin Vernoux" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Frank Villaro-Dixon" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Mark Visser" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Forrest Voight" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Tormod Volden" ), CONTRIB_DEV, nullptr ) );
|
||||
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Bartek Wacławik" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Johannes Wågen" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Oliver Walters" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Jonathan Warner" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Dan Weatherill" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Stefan Weber" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Christian Weickhmann" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Bevan Weiss" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Simon Wells" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Dominik Wernberger" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Jan Wichmann" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Nick Winters" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Adam Wolf" ), CONTRIB_DEV, nullptr ) );
|
||||
aInfo.AddDeveloper( new CONTRIBUTOR( wxT( "Andrzej Wolski" ), CONTRIB_DEV, nullptr ) );
|
||||
@@ -651,18 +617,10 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
wxEmptyString,
|
||||
wxS( "Danish (DA)" ) ) );
|
||||
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxS( "Ettore Atalan" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "German (DE)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxS( "Ivan Chuba" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "German (DE)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxS( "Julian Daube" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "German (DE)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxS( "Benedikt Freisen" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
@@ -675,10 +633,6 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "German (DE)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Johannes Maibaum" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "German (DE)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Henrik Kauhanen" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
@@ -687,14 +641,6 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "German (DE)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Ken Ovo" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "German (DE)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Karl Schuh" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "German (DE)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Dominik Wernberger" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
@@ -741,10 +687,6 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Spanish (ES)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxS( "Gabriel Martinez" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Spanish (ES)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Jose Perez" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
@@ -779,10 +721,6 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Finnish (FI)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Toni Laiho" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Finnish (FI)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "J. Lavoie" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
@@ -818,10 +756,6 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
wxEmptyString,
|
||||
wxS( "Italian (IT)" ) ) );
|
||||
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Subaru Arai" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Japanese (JA)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Ji Yoon Choi" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
@@ -931,10 +865,6 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Korean (KO)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "김랑기" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Korean (KO)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "KwonHyeokbeom" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
@@ -943,10 +873,6 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Korean (KO)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "pedrolinharesmoreira" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Korean (KO)" ) ) );
|
||||
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Henrik Kauhanen" ),
|
||||
wxEmptyString,
|
||||
@@ -965,10 +891,6 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Dutch (NL)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Laurens Holst" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Dutch (NL)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Pim Jansen" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
@@ -977,6 +899,10 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Dutch (NL)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Bas Wijnen" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Dutch (NL)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Tom Niesse" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
@@ -985,14 +911,6 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Dutch (NL)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Arend-Jan van Hilten" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Dutch (NL)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Bas Wijnen" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Dutch (NL)" ) ) );
|
||||
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Jarl Gjessing" ),
|
||||
wxEmptyString,
|
||||
@@ -1027,14 +945,6 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Polish (PL)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Eryk Michalak" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Polish (PL)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Filip Piękoś" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Polish (PL)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Mark Roszko" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
@@ -1043,10 +953,6 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Polish (PL)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Jan Sobków" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Polish (PL)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Grzegorz Szymaszek" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
@@ -1123,10 +1029,6 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Swedish (SV)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Elias Sjögreen" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Swedish (SV)" ) ) );
|
||||
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Boonchai Kingrungped" ),
|
||||
wxEmptyString,
|
||||
@@ -1154,14 +1056,6 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
wxEmptyString,
|
||||
wxS( "Ukrainian (UK)" ) ) );
|
||||
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "向阳阳" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Simplified Chinese (zh_CN)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "欠陥電気" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Simplified Chinese (zh_CN)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Liu Guang" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
@@ -1182,14 +1076,6 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Simplified Chinese (zh_CN)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Hubert Hu" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Simplified Chinese (zh_CN)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Pinpang Liao" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Simplified Chinese (zh_CN)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Rigo Ligo" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
@@ -1198,35 +1084,15 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Simplified Chinese (zh_CN)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Zhen Sun" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Simplified Chinese (zh_CN)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Jason Tan" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Simplified Chinese (zh_CN)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "yangyangdaji" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Simplified Chinese (zh_CN)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Li Yidong" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Simplified Chinese (zh_CN)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Tian Yunhao" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Simplified Chinese (zh_CN)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Lao Zhu" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Simplified Chinese (zh_CN)" ) ) );
|
||||
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "撒景賢" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Traditional Chinese (zh_TW)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "David Chen" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
@@ -1239,15 +1105,11 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Traditional Chinese (zh_TW)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "William Lin" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Traditional Chinese (zh_TW)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Taotieren" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Traditional Chinese (zh_TW)" ) ) );
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "Li Yidong" ),
|
||||
aInfo.AddTranslator( new CONTRIBUTOR( wxT( "william" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
wxS( "Traditional Chinese (zh_TW)" ) ) );
|
||||
@@ -1387,10 +1249,6 @@ static void buildKicadAboutBanner( EDA_BASE_FRAME* aParent, ABOUT_APP_INFO& aInf
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
ICON_CONTRIBUTION ) );
|
||||
aInfo.AddArtist( new CONTRIBUTOR( wxT( "Anda Subero" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
ICON_CONTRIBUTION ) );
|
||||
aInfo.AddArtist( new CONTRIBUTOR( wxT( "Iñigo Zuluaga" ),
|
||||
wxEmptyString,
|
||||
wxEmptyString,
|
||||
|
||||
@@ -51,30 +51,11 @@
|
||||
|
||||
|
||||
DIALOG_ABOUT::DIALOG_ABOUT( EDA_BASE_FRAME *aParent, ABOUT_APP_INFO& aAppInfo )
|
||||
: DIALOG_ABOUT_BASE( aParent ),
|
||||
m_images( nullptr ),
|
||||
m_info( aAppInfo )
|
||||
: DIALOG_ABOUT_BASE( aParent ), m_info( aAppInfo )
|
||||
{
|
||||
wxASSERT( aParent != nullptr );
|
||||
|
||||
SetEvtHandlerEnabled( false );
|
||||
|
||||
#ifdef __WXMAC__
|
||||
// HiDPI-aware API; will be generally available in wxWidgets 3.4
|
||||
wxVector<wxBitmapBundle> images;
|
||||
|
||||
images.push_back( KiBitmapBundle( BITMAPS::info ) ); // INFORMATION
|
||||
images.push_back( KiBitmapBundle( BITMAPS::recent ) ); // VERSION
|
||||
images.push_back( KiBitmapBundle( BITMAPS::preference ) ); // DEVELOPERS
|
||||
images.push_back( KiBitmapBundle( BITMAPS::editor ) ); // DOCWRITERS
|
||||
images.push_back( KiBitmapBundle( BITMAPS::library ) ); // LIBRARIANS
|
||||
images.push_back( KiBitmapBundle( BITMAPS::color_materials ) ); // ARTISTS
|
||||
images.push_back( KiBitmapBundle( BITMAPS::language ) ); // TRANSLATORS
|
||||
images.push_back( KiBitmapBundle( BITMAPS::zip ) ); // PACKAGERS
|
||||
images.push_back( KiBitmapBundle( BITMAPS::tools ) ); // LICENSE
|
||||
|
||||
m_notebook->SetImages( images );
|
||||
#else
|
||||
// TODO: Change these to 16x16 versions when available
|
||||
m_images = new wxImageList( 24, 24, false, 9 );
|
||||
|
||||
@@ -89,7 +70,6 @@ DIALOG_ABOUT::DIALOG_ABOUT( EDA_BASE_FRAME *aParent, ABOUT_APP_INFO& aAppInfo )
|
||||
m_images->Add( KiBitmap( BITMAPS::tools ) ); // LICENSE
|
||||
|
||||
m_notebook->SetImageList( m_images );
|
||||
#endif
|
||||
|
||||
if( m_info.GetAppIcon().IsOk() )
|
||||
{
|
||||
@@ -128,9 +108,7 @@ DIALOG_ABOUT::DIALOG_ABOUT( EDA_BASE_FRAME *aParent, ABOUT_APP_INFO& aAppInfo )
|
||||
|
||||
DIALOG_ABOUT::~DIALOG_ABOUT()
|
||||
{
|
||||
#ifndef __WXMAC__
|
||||
delete m_images;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -70,11 +70,7 @@ DIALOG_CONFIGURE_PATHS::DIALOG_CONFIGURE_PATHS( wxWindow* aParent ) :
|
||||
m_EnvVars->ClearRows();
|
||||
m_EnvVars->AppendCols( 1 ); // for the isExternal flags
|
||||
m_EnvVars->HideCol( TV_FLAG_COL );
|
||||
#ifndef __WXMAC__
|
||||
// macos crashes on languages at least using non-ascii characters for the column header here of all places
|
||||
// if we use native column headers, so guard it for windows to still look nice
|
||||
m_EnvVars->UseNativeColHeader( true );
|
||||
#endif
|
||||
|
||||
wxGridCellAttr* attr = new wxGridCellAttr;
|
||||
attr->SetEditor( new GRID_CELL_PATH_EDITOR( this, m_EnvVars, &m_curdir, wxEmptyString ) );
|
||||
|
||||
@@ -43,9 +43,6 @@ void DIALOG_EDIT_LIBRARY_TABLES::InstallPanel( wxPanel* aPanel )
|
||||
auto mainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
SetSizer( mainSizer );
|
||||
|
||||
m_infoBar = new WX_INFOBAR( this );
|
||||
mainSizer->Add( m_infoBar, 0, wxEXPAND, 0 );
|
||||
|
||||
mainSizer->Add( m_contentPanel, 1, wxEXPAND|wxLEFT|wxTOP|wxRIGHT, 5 );
|
||||
m_contentPanel->SetMinSize( FromDIP( wxSize( 1000, 600 ) ) );
|
||||
|
||||
|
||||
@@ -57,21 +57,6 @@ DIALOG_GIT_COMMIT::DIALOG_GIT_COMMIT( wxWindow* parent, git_repository* repo,
|
||||
m_listCtrl->SetColumnWidth( 1, 200 );
|
||||
|
||||
// Set up image list for icons
|
||||
#ifdef __WXMAC__
|
||||
// HiDPI-aware API; will be generally available in wxWidgets 3.4
|
||||
wxVector<wxBitmapBundle> stateImages;
|
||||
stateImages.push_back( wxBitmapBundle() ); // GIT_STATUS_UNTRACKED
|
||||
stateImages.push_back( KiBitmapBundle( BITMAPS::git_good_check ) ); // GIT_STATUS_CURRENT
|
||||
stateImages.push_back( KiBitmapBundle( BITMAPS::git_modified ) ); // GIT_STATUS_MODIFIED
|
||||
stateImages.push_back( KiBitmapBundle( BITMAPS::git_add ) ); // GIT_STATUS_ADDED
|
||||
stateImages.push_back( KiBitmapBundle( BITMAPS::git_delete ) ); // GIT_STATUS_DELETED
|
||||
stateImages.push_back( KiBitmapBundle( BITMAPS::git_out_of_date ) ); // GIT_STATUS_BEHIND
|
||||
stateImages.push_back( KiBitmapBundle( BITMAPS::git_changed_ahead ) ); // GIT_STATUS_AHEAD
|
||||
stateImages.push_back( KiBitmapBundle( BITMAPS::git_conflict ) ); // GIT_STATUS_CONFLICTED
|
||||
|
||||
m_listCtrl->SetNormalImages( stateImages );
|
||||
m_listCtrl->SetSmallImages( stateImages );
|
||||
#else
|
||||
wxImageList* imageList = new wxImageList(
|
||||
16, 16, true, static_cast<int>( KIGIT_COMMON::GIT_STATUS::GIT_STATUS_LAST ) );
|
||||
|
||||
@@ -86,7 +71,6 @@ DIALOG_GIT_COMMIT::DIALOG_GIT_COMMIT( wxWindow* parent, git_repository* repo,
|
||||
|
||||
// Assign the image list to the list control
|
||||
m_listCtrl->SetImageList( imageList, wxIMAGE_LIST_SMALL );
|
||||
#endif
|
||||
|
||||
// Populate list control with items
|
||||
for( auto& [filename, status] : filesToCommit )
|
||||
|
||||
@@ -37,15 +37,9 @@
|
||||
#include <wx/stdpaths.h>
|
||||
|
||||
|
||||
DIALOG_GIT_REPOSITORY::DIALOG_GIT_REPOSITORY( wxWindow* aParent, git_repository* aRepository,
|
||||
wxString aURL ) :
|
||||
DIALOG_GIT_REPOSITORY_BASE( aParent ),
|
||||
m_repository( aRepository ),
|
||||
m_prevFile( wxEmptyString ),
|
||||
m_tested( 0 ),
|
||||
m_failedTest( false ),
|
||||
m_testError( wxEmptyString ),
|
||||
m_tempRepo( false ),
|
||||
DIALOG_GIT_REPOSITORY::DIALOG_GIT_REPOSITORY( wxWindow* aParent, git_repository* aRepository, wxString aURL ) :
|
||||
DIALOG_GIT_REPOSITORY_BASE( aParent ), m_repository( aRepository ), m_prevFile( wxEmptyString ),
|
||||
m_tested( 0 ), m_failedTest( false ), m_testError( wxEmptyString ), m_tempRepo( false ),
|
||||
m_repoType( KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_LOCAL )
|
||||
{
|
||||
m_txtURL->SetFocus();
|
||||
@@ -96,9 +90,7 @@ bool DIALOG_GIT_REPOSITORY::extractClipboardData()
|
||||
{
|
||||
if( std::get<0>( isValidHTTPS( clipboardText ) )
|
||||
|| std::get<0>( isValidSSH( clipboardText ) ) )
|
||||
{
|
||||
m_txtURL->SetValue( clipboardText );
|
||||
}
|
||||
}
|
||||
|
||||
wxTheClipboard->Close();
|
||||
@@ -370,8 +362,7 @@ void DIALOG_GIT_REPOSITORY::OnFileUpdated( wxFileDirPickerEvent& aEvent )
|
||||
|
||||
if( !isValid )
|
||||
{
|
||||
DisplayErrorMessage( this, _( "Invalid SSH Key" ),
|
||||
_( "The selected file is not a valid SSH private key" ) );
|
||||
DisplayErrorMessage( this, _( "Invalid SSH Key" ), _( "The selected file is not a valid SSH private key" ) );
|
||||
CallAfter( [this] { SetRepoSSHPath( m_prevFile ); } );
|
||||
return;
|
||||
}
|
||||
@@ -395,8 +386,7 @@ void DIALOG_GIT_REPOSITORY::OnFileUpdated( wxFileDirPickerEvent& aEvent )
|
||||
|
||||
if( !pubIfs.good() || !pubIfs.is_open() )
|
||||
{
|
||||
DisplayErrorMessage( this, wxString::Format( _( "Could not open public key '%s'" ),
|
||||
file + ".pub" ),
|
||||
DisplayErrorMessage( this, wxString::Format( _( "Could not open public key '%s'" ), file + ".pub" ),
|
||||
wxString::Format( "%s: %d", std::strerror( errno ), errno ) );
|
||||
aEvent.SetPath( wxEmptyString );
|
||||
CallAfter( [this] { SetRepoSSHPath( m_prevFile ); } );
|
||||
@@ -414,22 +404,19 @@ void DIALOG_GIT_REPOSITORY::OnOKClick( wxCommandEvent& event )
|
||||
|
||||
if( m_txtName->GetValue().IsEmpty() )
|
||||
{
|
||||
DisplayErrorMessage( this, _( "Missing information" ),
|
||||
_( "Please enter a name for the repository" ) );
|
||||
DisplayErrorMessage( this, _( "Missing information" ), _( "Please enter a name for the repository" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
if( m_txtURL->GetValue().IsEmpty() )
|
||||
{
|
||||
DisplayErrorMessage( this, _( "Missing information" ),
|
||||
_( "Please enter a URL for the repository" ) );
|
||||
DisplayErrorMessage( this, _( "Missing information" ), _( "Please enter a URL for the repository" ) );
|
||||
return;
|
||||
}
|
||||
|
||||
EndModal( wxID_OK );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_GIT_REPOSITORY::updateAuthControls()
|
||||
{
|
||||
if( m_ConnType->GetSelection() == static_cast<int>( KIGIT_COMMON::GIT_CONN_TYPE::GIT_CONN_LOCAL ) )
|
||||
|
||||
@@ -32,8 +32,7 @@
|
||||
class DIALOG_GIT_REPOSITORY : public DIALOG_GIT_REPOSITORY_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_GIT_REPOSITORY( wxWindow* aParent, git_repository* aRepository,
|
||||
wxString aURL = wxEmptyString );
|
||||
DIALOG_GIT_REPOSITORY( wxWindow* aParent, git_repository* aRepository, wxString aURL = wxEmptyString );
|
||||
~DIALOG_GIT_REPOSITORY() override;
|
||||
|
||||
void SetTestResult( bool aFailed, const wxString& aError )
|
||||
@@ -48,10 +47,7 @@ public:
|
||||
updateAuthControls();
|
||||
}
|
||||
|
||||
KIGIT_COMMON::GIT_CONN_TYPE GetRepoType() const
|
||||
{
|
||||
return static_cast<KIGIT_COMMON::GIT_CONN_TYPE>( m_ConnType->GetSelection() );
|
||||
}
|
||||
KIGIT_COMMON::GIT_CONN_TYPE GetRepoType() const { return static_cast<KIGIT_COMMON::GIT_CONN_TYPE>( m_ConnType->GetSelection() ); }
|
||||
|
||||
void SetRepoName( const wxString& aName ) { m_txtName->SetValue( aName ); }
|
||||
wxString GetRepoName() const { return m_txtName->GetValue(); }
|
||||
@@ -110,19 +106,19 @@ private:
|
||||
std::tuple<bool,wxString,wxString,wxString> isValidHTTPS( const wxString& url );
|
||||
std::tuple<bool,wxString, wxString> isValidSSH( const wxString& url );
|
||||
|
||||
private:
|
||||
git_repository* m_repository;
|
||||
|
||||
wxString m_prevFile;
|
||||
wxString m_prevFile;
|
||||
|
||||
unsigned m_tested;
|
||||
bool m_failedTest;
|
||||
wxString m_testError;
|
||||
unsigned m_tested;
|
||||
bool m_failedTest;
|
||||
wxString m_testError;
|
||||
|
||||
bool m_tempRepo;
|
||||
wxString m_tempPath;
|
||||
bool m_tempRepo;
|
||||
wxString m_tempPath;
|
||||
|
||||
KIGIT_COMMON::GIT_CONN_TYPE m_repoType;
|
||||
|
||||
};
|
||||
|
||||
#endif /* DIALOG_GIT_REPOSITORY_H_ */
|
||||
@@ -55,7 +55,7 @@ void PANEL_GIT_REPOS::ResetPanel()
|
||||
m_authorEmail->SetValue( wxEmptyString );
|
||||
}
|
||||
|
||||
static std::pair<wxString, wxString> getDefaultAuthorAndEmail()
|
||||
static std::pair<wxString, wxString> getDefaultAuthorEmail()
|
||||
{
|
||||
wxString name;
|
||||
wxString email;
|
||||
@@ -94,8 +94,8 @@ static std::pair<wxString, wxString> getDefaultAuthorAndEmail()
|
||||
|
||||
bool PANEL_GIT_REPOS::TransferDataFromWindow()
|
||||
{
|
||||
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
|
||||
std::vector<COMMON_SETTINGS::GIT_REPOSITORY>& repos = settings->m_Git.repositories;
|
||||
COMMON_SETTINGS* settings = Pgm().GetCommonSettings();
|
||||
auto& repos = settings->m_Git.repositories;
|
||||
|
||||
repos.clear();
|
||||
|
||||
@@ -109,8 +109,7 @@ bool PANEL_GIT_REPOS::TransferDataFromWindow()
|
||||
repo.authType = m_grid->GetCellValue( row, COL_AUTH_TYPE );
|
||||
repo.username = m_grid->GetCellValue( row, COL_USERNAME );
|
||||
|
||||
KIPLATFORM::SECRETS::StoreSecret( repo.path, repo.username,
|
||||
m_grid->GetCellValue( row, COL_PASSWORD ) );
|
||||
KIPLATFORM::SECRETS::StoreSecret( repo.path, repo.username, m_grid->GetCellValue( row, COL_PASSWORD ) );
|
||||
repo.ssh_path = m_grid->GetCellValue( row, COL_SSH_PATH );
|
||||
repo.checkValid = m_grid->GetCellValue( row, COL_STATUS ) == "1";
|
||||
repos.push_back( repo );
|
||||
@@ -127,8 +126,7 @@ static bool testRepositoryConnection( COMMON_SETTINGS::GIT_REPOSITORY& repositor
|
||||
{
|
||||
git_libgit2_init();
|
||||
|
||||
git_remote_callbacks callbacks;
|
||||
callbacks.version = GIT_REMOTE_CALLBACKS_VERSION;
|
||||
git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -136,39 +134,35 @@ static bool testRepositoryConnection( COMMON_SETTINGS::GIT_REPOSITORY& repositor
|
||||
bool success;
|
||||
} callbacksPayload;
|
||||
|
||||
callbacksPayload cb_data( { &repository, true } ); // If we don't need authentication, then,
|
||||
// we are successful
|
||||
callbacksPayload cb_data( { &repository, true } ); // If we don't need authentication, then, we are successful
|
||||
callbacks.payload = &cb_data;
|
||||
callbacks.credentials =
|
||||
[](git_cred** out, const char* url, const char* username, unsigned int allowed_types,
|
||||
void* payload) -> int
|
||||
{
|
||||
callbacks.credentials = [](git_cred** out, const char* url, const char* username, unsigned int allowed_types, void* payload) -> int {
|
||||
|
||||
// If we are asking for credentials, then, we need authentication
|
||||
// If we are asking for credentials, then, we need authentication
|
||||
|
||||
callbacksPayload* data = static_cast<callbacksPayload*>(payload);
|
||||
callbacksPayload* data = static_cast<callbacksPayload*>(payload);
|
||||
|
||||
data->success = false;
|
||||
data->success = false;
|
||||
|
||||
if( allowed_types & GIT_CREDTYPE_USERNAME )
|
||||
{
|
||||
data->success = true;
|
||||
}
|
||||
else if( data->repo->authType == "ssh" && ( allowed_types & GIT_CREDTYPE_SSH_KEY ) )
|
||||
{
|
||||
wxString sshKeyPath = data->repo->ssh_path;
|
||||
if( allowed_types & GIT_CREDTYPE_USERNAME )
|
||||
{
|
||||
data->success = true;
|
||||
}
|
||||
else if( data->repo->authType == "ssh" && ( allowed_types & GIT_CREDTYPE_SSH_KEY ) )
|
||||
{
|
||||
wxString sshKeyPath = data->repo->ssh_path;
|
||||
|
||||
// Check if the SSH key exists and is readable
|
||||
if( wxFileExists( sshKeyPath ) && wxFile::Access( sshKeyPath, wxFile::read ) )
|
||||
data->success = true;
|
||||
}
|
||||
else if( data->repo->authType == "password" )
|
||||
{
|
||||
data->success = ( allowed_types & GIT_CREDTYPE_USERPASS_PLAINTEXT );
|
||||
}
|
||||
// Check if the SSH key exists and is readable
|
||||
if( wxFileExists( sshKeyPath ) && wxFile::Access( sshKeyPath, wxFile::read ) )
|
||||
data->success = true;
|
||||
}
|
||||
else if( data->repo->authType == "password" )
|
||||
{
|
||||
data->success = ( allowed_types & GIT_CREDTYPE_USERPASS_PLAINTEXT );
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
return 0;
|
||||
};
|
||||
|
||||
// Create a temporary directory to initialize the Git repository
|
||||
wxString tempDirPath = wxFileName::CreateTempFileName(wxT("kigit_temp"));
|
||||
@@ -183,10 +177,9 @@ static bool testRepositoryConnection( COMMON_SETTINGS::GIT_REPOSITORY& repositor
|
||||
|
||||
// Initialize the Git repository
|
||||
git_repository* repo = nullptr;
|
||||
int result = git_repository_init( &repo, tempDirPath.mb_str( wxConvUTF8 ), 0 );
|
||||
int result = git_repository_init(&repo, tempDirPath.mb_str(wxConvUTF8), 0);
|
||||
|
||||
if (result != 0)
|
||||
{
|
||||
if (result != 0) {
|
||||
git_repository_free(repo);
|
||||
git_libgit2_shutdown();
|
||||
wxRmdir(tempDirPath);
|
||||
@@ -194,10 +187,8 @@ static bool testRepositoryConnection( COMMON_SETTINGS::GIT_REPOSITORY& repositor
|
||||
}
|
||||
|
||||
git_remote* remote = nullptr;
|
||||
result = git_remote_create_anonymous( &remote, repo, tempDirPath.mb_str( wxConvUTF8 ) );
|
||||
|
||||
if (result != 0)
|
||||
{
|
||||
result = git_remote_create_anonymous(&remote, repo, tempDirPath.mb_str(wxConvUTF8));
|
||||
if (result != 0) {
|
||||
git_remote_free(remote);
|
||||
git_repository_free(repo);
|
||||
git_libgit2_shutdown();
|
||||
@@ -258,7 +249,7 @@ bool PANEL_GIT_REPOS::TransferDataToWindow()
|
||||
|
||||
if( settings->m_Git.useDefaultAuthor )
|
||||
{
|
||||
std::pair<wxString, wxString> defaultAuthor = getDefaultAuthorAndEmail();
|
||||
auto defaultAuthor = getDefaultAuthorEmail();
|
||||
m_author->SetValue( defaultAuthor.first );
|
||||
m_authorEmail->SetValue( defaultAuthor.second );
|
||||
m_author->Disable();
|
||||
|
||||
@@ -71,18 +71,6 @@ PANEL_GRID_SETTINGS::PANEL_GRID_SETTINGS( wxWindow* aParent, UNITS_PROVIDER* aUn
|
||||
m_checkGridOverrideWires->Show( false );
|
||||
m_gridOverrideWiresChoice->Show( false );
|
||||
}
|
||||
|
||||
if( m_frameType == FRAME_GERBER )
|
||||
{
|
||||
m_overridesLabel->Show( false );
|
||||
m_staticline3->Show( false );
|
||||
|
||||
m_checkGridOverrideText->Show( false );
|
||||
m_gridOverrideTextChoice->Show( false );
|
||||
|
||||
m_checkGridOverrideGraphics->Show( false );
|
||||
m_gridOverrideGraphicsChoice->Show( false );
|
||||
}
|
||||
}
|
||||
|
||||
int hk1 = ACTIONS::gridFast1.GetHotKey();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
@@ -111,7 +111,7 @@ PANEL_GRID_SETTINGS_BASE::PANEL_GRID_SETTINGS_BASE( wxWindow* parent, wxWindowID
|
||||
bSizerRightCol->Add( m_staticline3, 0, wxEXPAND|wxTOP|wxBOTTOM, 2 );
|
||||
|
||||
wxFlexGridSizer* fgGridOverrides;
|
||||
fgGridOverrides = new wxFlexGridSizer( 0, 2, 5, 0 );
|
||||
fgGridOverrides = new wxFlexGridSizer( 0, 2, 4, 0 );
|
||||
fgGridOverrides->AddGrowableCol( 1 );
|
||||
fgGridOverrides->SetFlexibleDirection( wxBOTH );
|
||||
fgGridOverrides->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
@@ -122,7 +122,7 @@ PANEL_GRID_SETTINGS_BASE::PANEL_GRID_SETTINGS_BASE( wxWindow* parent, wxWindowID
|
||||
wxArrayString m_gridOverrideConnectedChoiceChoices;
|
||||
m_gridOverrideConnectedChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_gridOverrideConnectedChoiceChoices, 0 );
|
||||
m_gridOverrideConnectedChoice->SetSelection( 0 );
|
||||
fgGridOverrides->Add( m_gridOverrideConnectedChoice, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
fgGridOverrides->Add( m_gridOverrideConnectedChoice, 0, wxALL, 5 );
|
||||
|
||||
m_checkGridOverrideWires = new wxCheckBox( this, wxID_ANY, _("Wires:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgGridOverrides->Add( m_checkGridOverrideWires, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxLEFT, 8 );
|
||||
@@ -130,7 +130,7 @@ PANEL_GRID_SETTINGS_BASE::PANEL_GRID_SETTINGS_BASE( wxWindow* parent, wxWindowID
|
||||
wxArrayString m_gridOverrideWiresChoiceChoices;
|
||||
m_gridOverrideWiresChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_gridOverrideWiresChoiceChoices, 0 );
|
||||
m_gridOverrideWiresChoice->SetSelection( 0 );
|
||||
fgGridOverrides->Add( m_gridOverrideWiresChoice, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
fgGridOverrides->Add( m_gridOverrideWiresChoice, 0, wxALL, 5 );
|
||||
|
||||
m_checkGridOverrideVias = new wxCheckBox( this, wxID_ANY, _("Vias:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgGridOverrides->Add( m_checkGridOverrideVias, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxLEFT, 8 );
|
||||
@@ -138,7 +138,7 @@ PANEL_GRID_SETTINGS_BASE::PANEL_GRID_SETTINGS_BASE( wxWindow* parent, wxWindowID
|
||||
wxArrayString m_gridOverrideViasChoiceChoices;
|
||||
m_gridOverrideViasChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_gridOverrideViasChoiceChoices, 0 );
|
||||
m_gridOverrideViasChoice->SetSelection( 0 );
|
||||
fgGridOverrides->Add( m_gridOverrideViasChoice, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
fgGridOverrides->Add( m_gridOverrideViasChoice, 0, wxALL, 5 );
|
||||
|
||||
m_checkGridOverrideText = new wxCheckBox( this, wxID_ANY, _("Text:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgGridOverrides->Add( m_checkGridOverrideText, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxLEFT, 8 );
|
||||
@@ -146,7 +146,7 @@ PANEL_GRID_SETTINGS_BASE::PANEL_GRID_SETTINGS_BASE( wxWindow* parent, wxWindowID
|
||||
wxArrayString m_gridOverrideTextChoiceChoices;
|
||||
m_gridOverrideTextChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_gridOverrideTextChoiceChoices, 0 );
|
||||
m_gridOverrideTextChoice->SetSelection( 0 );
|
||||
fgGridOverrides->Add( m_gridOverrideTextChoice, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
fgGridOverrides->Add( m_gridOverrideTextChoice, 0, wxALL, 5 );
|
||||
|
||||
m_checkGridOverrideGraphics = new wxCheckBox( this, wxID_ANY, _("Graphics:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
fgGridOverrides->Add( m_checkGridOverrideGraphics, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxLEFT, 8 );
|
||||
@@ -154,7 +154,7 @@ PANEL_GRID_SETTINGS_BASE::PANEL_GRID_SETTINGS_BASE( wxWindow* parent, wxWindowID
|
||||
wxArrayString m_gridOverrideGraphicsChoiceChoices;
|
||||
m_gridOverrideGraphicsChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_gridOverrideGraphicsChoiceChoices, 0 );
|
||||
m_gridOverrideGraphicsChoice->SetSelection( 0 );
|
||||
fgGridOverrides->Add( m_gridOverrideGraphicsChoice, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
fgGridOverrides->Add( m_gridOverrideGraphicsChoice, 0, wxALL, 5 );
|
||||
|
||||
|
||||
bSizerRightCol->Add( fgGridOverrides, 0, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 10 );
|
||||
|
||||
+1823
-1850
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
||||
@@ -442,10 +442,13 @@ bool PANEL_SETUP_NETCLASSES::TransferDataFromWindow()
|
||||
wxString netclass = m_assignmentGrid->GetCellValue( row, 1 );
|
||||
|
||||
m_netSettings->m_NetClassPatternAssignments.push_back(
|
||||
{ std::make_unique<EDA_COMBINED_MATCHER>( pattern, CTX_NETCLASS ), netclass } );
|
||||
}
|
||||
{
|
||||
std::make_unique<EDA_COMBINED_MATCHER>( pattern, CTX_NETCLASS ),
|
||||
netclass
|
||||
} );
|
||||
|
||||
m_netSettings->m_NetClassPatternAssignmentCache.clear();
|
||||
m_netSettings->m_NetClassPatternAssignmentCache.clear();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -648,21 +648,8 @@ void EDA_DRAW_PANEL_GAL::onShowTimer( wxTimerEvent& aEvent )
|
||||
|
||||
void EDA_DRAW_PANEL_GAL::SetCurrentCursor( KICURSOR aCursor )
|
||||
{
|
||||
if( !m_gal )
|
||||
return;
|
||||
|
||||
DPI_SCALING_COMMON dpi( nullptr, m_parent );
|
||||
|
||||
bool hidpi = false;
|
||||
|
||||
// Cursor scaling factor cannot be set for a wxCursor on GTK and OSX (at least before wx 3.3),
|
||||
// resulting in 4x rendered size on 2x window scale.
|
||||
// MSW renders the bitmap as-is, without scaling, so this works here.
|
||||
#ifdef __WXMSW__
|
||||
hidpi = dpi.GetContentScaleFactor() >= 2.0;
|
||||
#endif
|
||||
|
||||
m_gal->SetNativeCursorStyle( aCursor, hidpi );
|
||||
if( m_gal )
|
||||
m_gal->SetNativeCursorStyle( aCursor );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -681,35 +681,6 @@ void DS_DATA_ITEM_TEXT::SetConstrainedTextSize()
|
||||
|
||||
if( m_ConstrainedTextSize.y == 0 )
|
||||
m_ConstrainedTextSize.y = DS_DATA_MODEL::GetTheInstance().m_DefaultTextSize.y;
|
||||
|
||||
if( m_BoundingBoxSize.x > 0 || m_BoundingBoxSize.y > 0 )
|
||||
{
|
||||
// to know the X and Y size of the line, we should use EDA_TEXT::GetTextBox()
|
||||
// but this function uses integers
|
||||
// So, to avoid truncations with our unit in mm, use microns.
|
||||
VECTOR2I size_micron;
|
||||
#define FSCALE 1000.0
|
||||
int linewidth = 0;
|
||||
size_micron.x = KiROUND( m_ConstrainedTextSize.x * FSCALE );
|
||||
size_micron.y = KiROUND( m_ConstrainedTextSize.y * FSCALE );
|
||||
DS_DRAW_ITEM_TEXT dummy( unityScale, this, 0, m_FullText, VECTOR2I( 0, 0 ), size_micron,
|
||||
linewidth, m_Font, m_Italic, m_Bold, m_TextColor );
|
||||
dummy.SetMultilineAllowed( true );
|
||||
dummy.SetHorizJustify( m_Hjustify ) ;
|
||||
dummy.SetVertJustify( m_Vjustify );
|
||||
dummy.SetTextAngle( EDA_ANGLE( m_Orient, DEGREES_T ) );
|
||||
|
||||
BOX2I rect = dummy.GetTextBox();
|
||||
VECTOR2D size;
|
||||
size.x = KiROUND( (int) rect.GetWidth() / FSCALE );
|
||||
size.y = KiROUND( (int) rect.GetHeight() / FSCALE );
|
||||
|
||||
if( m_BoundingBoxSize.x > 0 && size.x > m_BoundingBoxSize.x )
|
||||
m_ConstrainedTextSize.x *= m_BoundingBoxSize.x / size.x;
|
||||
|
||||
if( m_BoundingBoxSize.y > 0 && size.y > m_BoundingBoxSize.y )
|
||||
m_ConstrainedTextSize.y *= m_BoundingBoxSize.y / size.y;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -121,7 +121,7 @@ wxString DS_DRAW_ITEM_LIST::BuildFullText( const wxString& aTextbase )
|
||||
|
||||
if( token->IsSameAs( wxT( "KICAD_VERSION" ) ) && PgmOrNull() )
|
||||
{
|
||||
*token = wxString::Format( wxT( "%s %s" ), productName, GetBaseVersion() );
|
||||
*token = wxString::Format( wxT( "%s %s" ), productName, GetSemanticVersion() );
|
||||
tokenUpdated = true;
|
||||
}
|
||||
else if( token->IsSameAs( wxT( "#" ) ) )
|
||||
|
||||
@@ -483,7 +483,7 @@ void EDA_BASE_FRAME::ReCreateMenuBar()
|
||||
* ensure that they do not occur within the same event handling call stack.
|
||||
*/
|
||||
|
||||
CallAfter( [this]()
|
||||
CallAfter( [&]()
|
||||
{
|
||||
if( !m_isClosing )
|
||||
doReCreateMenuBar();
|
||||
@@ -1202,7 +1202,6 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent
|
||||
book->AddPage( new wxPanel( book ), _( "Gerber Viewer" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_DISPLAY_OPTIONS ), _( "Display Options" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_COLORS ), _( "Colors" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_GRIDS ), _( "Grids" ) );
|
||||
book->AddLazySubPage( LAZY_CTOR( PANEL_GBR_EXCELLON_OPTIONS ), _( "Excellon Options" ) );
|
||||
}
|
||||
catch( ... )
|
||||
|
||||
+27
-31
@@ -1955,6 +1955,16 @@ static struct EDA_SHAPE_DESC
|
||||
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
|
||||
REGISTER_TYPE( EDA_SHAPE );
|
||||
|
||||
auto isNotPolygon =
|
||||
[]( INSPECTABLE* aItem ) -> bool
|
||||
{
|
||||
// Polygons, unlike other shapes, have no meaningful start or end coordinates
|
||||
if( EDA_SHAPE* shape = dynamic_cast<EDA_SHAPE*>( aItem ) )
|
||||
return shape->GetShape() != SHAPE_T::POLY;
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
auto isNotPolygonOrCircle = []( INSPECTABLE* aItem ) -> bool
|
||||
{
|
||||
// Polygons, unlike other shapes, have no meaningful start or end coordinates
|
||||
@@ -1973,65 +1983,53 @@ static struct EDA_SHAPE_DESC
|
||||
return false;
|
||||
};
|
||||
|
||||
const wxString shapeProps = _HKI( "Shape Properties" );
|
||||
|
||||
auto shape = new PROPERTY_ENUM<EDA_SHAPE, SHAPE_T>( _HKI( "Shape" ),
|
||||
NO_SETTER( EDA_SHAPE, SHAPE_T ), &EDA_SHAPE::GetShape );
|
||||
propMgr.AddProperty( shape, shapeProps );
|
||||
propMgr.AddProperty( shape );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, int>( _HKI( "Start X" ),
|
||||
&EDA_SHAPE::SetStartX, &EDA_SHAPE::GetStartX, PROPERTY_DISPLAY::PT_COORD,
|
||||
ORIGIN_TRANSFORMS::ABS_X_COORD ),
|
||||
shapeProps )
|
||||
ORIGIN_TRANSFORMS::ABS_X_COORD ) )
|
||||
.SetAvailableFunc( isNotPolygonOrCircle );
|
||||
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, int>( _HKI( "Start Y" ),
|
||||
&EDA_SHAPE::SetStartY, &EDA_SHAPE::GetStartY, PROPERTY_DISPLAY::PT_COORD,
|
||||
ORIGIN_TRANSFORMS::ABS_Y_COORD ),
|
||||
shapeProps )
|
||||
ORIGIN_TRANSFORMS::ABS_Y_COORD ) )
|
||||
.SetAvailableFunc( isNotPolygonOrCircle );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, int>( _HKI( "Center X" ),
|
||||
&EDA_SHAPE::SetCenterX, &EDA_SHAPE::GetStartX, PROPERTY_DISPLAY::PT_COORD,
|
||||
ORIGIN_TRANSFORMS::ABS_X_COORD ),
|
||||
shapeProps )
|
||||
&EDA_SHAPE::SetStartX, &EDA_SHAPE::GetStartX, PROPERTY_DISPLAY::PT_COORD,
|
||||
ORIGIN_TRANSFORMS::ABS_X_COORD ) )
|
||||
.SetAvailableFunc( isCircle );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, int>( _HKI( "Center Y" ),
|
||||
&EDA_SHAPE::SetCenterY, &EDA_SHAPE::GetStartY, PROPERTY_DISPLAY::PT_COORD,
|
||||
ORIGIN_TRANSFORMS::ABS_Y_COORD ),
|
||||
shapeProps )
|
||||
&EDA_SHAPE::SetStartY, &EDA_SHAPE::GetStartY, PROPERTY_DISPLAY::PT_COORD,
|
||||
ORIGIN_TRANSFORMS::ABS_Y_COORD ) )
|
||||
.SetAvailableFunc( isCircle );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, int>( _HKI( "Radius" ),
|
||||
&EDA_SHAPE::SetRadius, &EDA_SHAPE::GetRadius, PROPERTY_DISPLAY::PT_SIZE,
|
||||
ORIGIN_TRANSFORMS::NOT_A_COORD ),
|
||||
shapeProps )
|
||||
ORIGIN_TRANSFORMS::NOT_A_COORD ) )
|
||||
.SetAvailableFunc( isCircle );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, int>( _HKI( "End X" ),
|
||||
&EDA_SHAPE::SetEndX, &EDA_SHAPE::GetEndX, PROPERTY_DISPLAY::PT_COORD,
|
||||
ORIGIN_TRANSFORMS::ABS_X_COORD ),
|
||||
shapeProps )
|
||||
ORIGIN_TRANSFORMS::ABS_X_COORD ) )
|
||||
.SetAvailableFunc( isNotPolygonOrCircle );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, int>( _HKI( "End Y" ),
|
||||
&EDA_SHAPE::SetEndY, &EDA_SHAPE::GetEndY, PROPERTY_DISPLAY::PT_COORD,
|
||||
ORIGIN_TRANSFORMS::ABS_Y_COORD ),
|
||||
shapeProps )
|
||||
ORIGIN_TRANSFORMS::ABS_Y_COORD ) )
|
||||
.SetAvailableFunc( isNotPolygonOrCircle );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, int>( _HKI( "Line Width" ),
|
||||
&EDA_SHAPE::SetWidth, &EDA_SHAPE::GetWidth, PROPERTY_DISPLAY::PT_SIZE ),
|
||||
shapeProps );
|
||||
&EDA_SHAPE::SetWidth, &EDA_SHAPE::GetWidth, PROPERTY_DISPLAY::PT_SIZE ) );
|
||||
|
||||
void ( EDA_SHAPE::*lineStyleSetter )( LINE_STYLE ) = &EDA_SHAPE::SetLineStyle;
|
||||
propMgr.AddProperty( new PROPERTY_ENUM<EDA_SHAPE, LINE_STYLE>( _HKI( "Line Style" ),
|
||||
lineStyleSetter, &EDA_SHAPE::GetLineStyle ),
|
||||
shapeProps );
|
||||
propMgr.AddProperty( new PROPERTY_ENUM<EDA_SHAPE, LINE_STYLE>(
|
||||
_HKI( "Line Style" ), lineStyleSetter, &EDA_SHAPE::GetLineStyle ) );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, COLOR4D>( _HKI( "Line Color" ),
|
||||
&EDA_SHAPE::SetLineColor, &EDA_SHAPE::GetLineColor ),
|
||||
shapeProps )
|
||||
&EDA_SHAPE::SetLineColor, &EDA_SHAPE::GetLineColor ) )
|
||||
.SetIsHiddenFromRulesEditor();
|
||||
|
||||
auto angle = new PROPERTY<EDA_SHAPE, EDA_ANGLE>( _HKI( "Angle" ),
|
||||
@@ -2045,7 +2043,7 @@ static struct EDA_SHAPE_DESC
|
||||
|
||||
return false;
|
||||
} );
|
||||
propMgr.AddProperty( angle, shapeProps );
|
||||
propMgr.AddProperty( angle );
|
||||
|
||||
auto fillAvailable =
|
||||
[=]( INSPECTABLE* aItem ) -> bool
|
||||
@@ -2068,13 +2066,11 @@ static struct EDA_SHAPE_DESC
|
||||
};
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, bool>( _HKI( "Filled" ),
|
||||
&EDA_SHAPE::SetFilled, &EDA_SHAPE::IsFilled ),
|
||||
shapeProps )
|
||||
&EDA_SHAPE::SetFilled, &EDA_SHAPE::IsFilled ) )
|
||||
.SetAvailableFunc( fillAvailable );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, COLOR4D>( _HKI( "Fill Color" ),
|
||||
&EDA_SHAPE::SetFillColor, &EDA_SHAPE::GetFillColor ),
|
||||
shapeProps )
|
||||
&EDA_SHAPE::SetFillColor, &EDA_SHAPE::GetFillColor ) )
|
||||
.SetAvailableFunc( fillAvailable )
|
||||
.SetIsHiddenFromRulesEditor();
|
||||
}
|
||||
|
||||
+8
-12
@@ -364,8 +364,8 @@ void EDA_TEXT::SetTextSize( VECTOR2I aNewSize, bool aEnforceMinTextSize )
|
||||
|
||||
if( aEnforceMinTextSize )
|
||||
{
|
||||
int min = m_IuScale.get().mmToIU( TEXT_MIN_SIZE_MM );
|
||||
int max = m_IuScale.get().mmToIU( TEXT_MAX_SIZE_MM );
|
||||
int min = m_IuScale.get().MilsToIU( TEXT_MIN_SIZE_MILS );
|
||||
int max = m_IuScale.get().MilsToIU( TEXT_MAX_SIZE_MILS );
|
||||
|
||||
aNewSize = VECTOR2I( alg::clamp( min, aNewSize.x, max ),
|
||||
alg::clamp( min, aNewSize.y, max ) );
|
||||
@@ -380,8 +380,8 @@ void EDA_TEXT::SetTextSize( VECTOR2I aNewSize, bool aEnforceMinTextSize )
|
||||
|
||||
void EDA_TEXT::SetTextWidth( int aWidth )
|
||||
{
|
||||
int min = m_IuScale.get().mmToIU( TEXT_MIN_SIZE_MM );
|
||||
int max = m_IuScale.get().mmToIU( TEXT_MAX_SIZE_MM );
|
||||
int min = m_IuScale.get().MilsToIU( TEXT_MIN_SIZE_MILS );
|
||||
int max = m_IuScale.get().MilsToIU( TEXT_MAX_SIZE_MILS );
|
||||
|
||||
m_attributes.m_Size.x = alg::clamp( min, aWidth, max );
|
||||
ClearRenderCache();
|
||||
@@ -391,8 +391,8 @@ void EDA_TEXT::SetTextWidth( int aWidth )
|
||||
|
||||
void EDA_TEXT::SetTextHeight( int aHeight )
|
||||
{
|
||||
int min = m_IuScale.get().mmToIU( TEXT_MIN_SIZE_MM );
|
||||
int max = m_IuScale.get().mmToIU( TEXT_MAX_SIZE_MM );
|
||||
int min = m_IuScale.get().MilsToIU( TEXT_MIN_SIZE_MILS );
|
||||
int max = m_IuScale.get().MilsToIU( TEXT_MAX_SIZE_MILS );
|
||||
|
||||
m_attributes.m_Size.y = alg::clamp( min, aHeight, max );
|
||||
ClearRenderCache();
|
||||
@@ -528,13 +528,10 @@ EDA_TEXT::GetRenderCache( const KIFONT::FONT* aFont, const wxString& forResolved
|
||||
}
|
||||
|
||||
|
||||
void EDA_TEXT::SetupRenderCache( const wxString& aResolvedText, const KIFONT::FONT* aFont,
|
||||
const EDA_ANGLE& aAngle, const VECTOR2I& aOffset )
|
||||
void EDA_TEXT::SetupRenderCache( const wxString& aResolvedText, const EDA_ANGLE& aAngle )
|
||||
{
|
||||
m_render_cache_text = aResolvedText;
|
||||
m_render_cache_font = aFont;
|
||||
m_render_cache_angle = aAngle;
|
||||
m_render_cache_offset = aOffset;
|
||||
m_render_cache.clear();
|
||||
}
|
||||
|
||||
@@ -542,7 +539,6 @@ void EDA_TEXT::SetupRenderCache( const wxString& aResolvedText, const KIFONT::FO
|
||||
void EDA_TEXT::AddRenderCacheGlyph( const SHAPE_POLY_SET& aPoly )
|
||||
{
|
||||
m_render_cache.emplace_back( std::make_unique<KIFONT::OUTLINE_GLYPH>( aPoly ) );
|
||||
static_cast<KIFONT::OUTLINE_GLYPH*>( m_render_cache.back().get() )->CacheTriangulation();
|
||||
}
|
||||
|
||||
|
||||
@@ -1180,7 +1176,7 @@ static struct EDA_TEXT_DESC
|
||||
&EDA_TEXT::SetTextAngleDegrees, &EDA_TEXT::GetTextAngleDegrees,
|
||||
PROPERTY_DISPLAY::PT_DEGREE ) );
|
||||
|
||||
const wxString textProps = _HKI( "Text Properties" );
|
||||
const wxString textProps = _( "Text Properties" );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<EDA_TEXT, wxString>( _HKI( "Text" ),
|
||||
&EDA_TEXT::SetText, &EDA_TEXT::GetText ),
|
||||
|
||||
+15
-48
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
@@ -28,22 +28,6 @@
|
||||
#include <charconv>
|
||||
#include <wx/translation.h>
|
||||
|
||||
|
||||
static void removeTrailingZeros( wxString& aText )
|
||||
{
|
||||
int len = aText.length();
|
||||
int removeLast = 0;
|
||||
|
||||
while( --len > 0 && aText[len] == '0' )
|
||||
removeLast++;
|
||||
|
||||
if( len >= 0 && ( aText[len] == '.' || aText[len] == ',' ) )
|
||||
removeLast++;
|
||||
|
||||
aText = aText.RemoveLast( removeLast );
|
||||
}
|
||||
|
||||
|
||||
bool EDA_UNIT_UTILS::IsImperialUnit( EDA_UNITS aUnit )
|
||||
{
|
||||
switch( aUnit )
|
||||
@@ -321,46 +305,29 @@ wxString EDA_UNIT_UTILS::UI::StringFromValue( const EDA_IU_SCALE& aIuScale, EDA_
|
||||
break;
|
||||
}
|
||||
|
||||
const wxChar* format = nullptr;
|
||||
char buf[50];
|
||||
|
||||
switch( aUnits )
|
||||
if( value_to_print != 0.0 && fabs( value_to_print ) <= 0.0001 )
|
||||
{
|
||||
int len = snprintf( buf, sizeof( buf ) - 1, "%.10f", value_to_print );
|
||||
|
||||
case EDA_UNITS::MILS:
|
||||
#if defined( EESCHEMA )
|
||||
format = wxT( "%.3f" );
|
||||
#else
|
||||
format = wxT( "%.5f" );
|
||||
#endif
|
||||
break;
|
||||
while( --len > 0 && buf[len] == '0' )
|
||||
buf[len] = '\0';
|
||||
|
||||
case EDA_UNITS::INCHES:
|
||||
#if defined( EESCHEMA )
|
||||
format = wxT( "%.6f" );
|
||||
#else
|
||||
format = wxT( "%.8f" );
|
||||
#endif
|
||||
break;
|
||||
|
||||
default:
|
||||
format = wxT( "%.10f" );
|
||||
break;
|
||||
if( len >= 0 && ( buf[len] == '.' || buf[len] == ',' ) )
|
||||
buf[len] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf( buf, sizeof( buf ) - 1, "%.10g", value_to_print );
|
||||
}
|
||||
|
||||
wxString text;
|
||||
text.Printf( format, value_to_print );
|
||||
removeTrailingZeros( text );
|
||||
|
||||
if( value_to_print != 0.0 && ( text == wxS( "0" ) || text == wxS( "-0" ) ) )
|
||||
{
|
||||
text.Printf( wxS( "%.10f" ), value_to_print );
|
||||
removeTrailingZeros( text );
|
||||
}
|
||||
wxString stringValue( buf, wxConvUTF8 );
|
||||
|
||||
if( aAddUnitsText )
|
||||
text << EDA_UNIT_UTILS::GetText( aUnits, aType );
|
||||
stringValue += EDA_UNIT_UTILS::GetText( aUnits, aType );
|
||||
|
||||
return text;
|
||||
return stringValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -59,9 +59,7 @@ void IO_ERROR::init( const wxString& aProblem, const char* aThrowersFile,
|
||||
// a short filename will be printed (it is better for user, the full filename has no meaning).
|
||||
wxString srcname = aThrowersFile;
|
||||
|
||||
// No need for translations of source code file/line messages (and wxWidget's translation
|
||||
// stuff has bitten us before. May be related to KICAD-YP.
|
||||
where.Printf( wxS( "from %s : %s() line %d" ),
|
||||
where.Printf( _( "from %s : %s() line %d" ),
|
||||
srcname.AfterLast( '/' ),
|
||||
wxString( aThrowersFunction ),
|
||||
aThrowersLineNumber );
|
||||
@@ -89,9 +87,7 @@ void PARSE_ERROR::init( const wxString& aProblem, const char* aThrowersFile,
|
||||
// a short filename will be printed (it is better for user, the full filename has no meaning).
|
||||
wxString srcname = aThrowersFile;
|
||||
|
||||
// No need for translations of source code file/line messages (and wxWidget's translation
|
||||
// stuff has bitten us before. May be related to KICAD-YP.
|
||||
where.Printf( wxS( "from %s : %s() line %d" ),
|
||||
where.Printf( _( "from %s : %s() line:%d" ),
|
||||
srcname.AfterLast( '/' ),
|
||||
wxString( aThrowersFunction ),
|
||||
aThrowersLineNumber );
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include <string_utils.h>
|
||||
#include <macros.h>
|
||||
#include <cstdint>
|
||||
#include <reporter.h>
|
||||
|
||||
#ifdef __WIN32__
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
@@ -38,8 +37,6 @@ using namespace fontconfig;
|
||||
static FONTCONFIG* g_config = nullptr;
|
||||
static bool g_fcInitSuccess = false;
|
||||
|
||||
REPORTER* FONTCONFIG::s_reporter = nullptr;
|
||||
|
||||
/**
|
||||
* A simple wrapper to avoid exporing fontconfig in the header
|
||||
*/
|
||||
@@ -60,12 +57,6 @@ FONTCONFIG::FONTCONFIG()
|
||||
};
|
||||
|
||||
|
||||
void fontconfig::FONTCONFIG::SetReporter( REPORTER* aReporter )
|
||||
{
|
||||
s_reporter = aReporter;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This is simply a wrapper to call FcInit() with SEH for Windows
|
||||
* SEH on Windows can only be used in functions without objects that might be unwinded
|
||||
@@ -326,15 +317,12 @@ FONTCONFIG::FF_RESULT FONTCONFIG::FindFont( const wxString &aFontName, wxString
|
||||
|
||||
if( retval == FF_RESULT::FF_ERROR )
|
||||
{
|
||||
if( s_reporter )
|
||||
s_reporter->Report( wxString::Format( _( "Error loading font '%s'." ), qualifiedFontName ) );
|
||||
wxLogWarning( _( "Error loading font '%s'." ), qualifiedFontName );
|
||||
}
|
||||
else if( retval == FF_RESULT::FF_SUBSTITUTE )
|
||||
{
|
||||
fontName.Replace( ':', ' ' );
|
||||
|
||||
if( s_reporter )
|
||||
s_reporter->Report( wxString::Format( _( "Font '%s' not found; substituting '%s'." ), qualifiedFontName, fontName ) );
|
||||
wxLogWarning( _( "Font '%s' not found; substituting '%s'." ), qualifiedFontName, fontName );
|
||||
}
|
||||
|
||||
FcPatternDestroy( pat );
|
||||
|
||||
+8
-44
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2021 Ola Rinta-Koski <gitlab@rinta-koski.net>
|
||||
* Copyright (C) 2021-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2021-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 as published by the
|
||||
@@ -82,19 +82,19 @@ std::unique_ptr<GLYPH> STROKE_GLYPH::Transform( const VECTOR2D& aGlyphSize, cons
|
||||
end.x *= aGlyphSize.x;
|
||||
end.y *= aGlyphSize.y;
|
||||
|
||||
if( aTilt != 0.0 )
|
||||
if( aTilt )
|
||||
end.x -= end.y * aTilt;
|
||||
|
||||
glyph->m_boundingBox.SetEnd( end );
|
||||
glyph->m_boundingBox.Offset( aOffset );
|
||||
|
||||
for( std::vector<VECTOR2D>& pointList : *glyph )
|
||||
for( std::vector<VECTOR2D>& pointList : *glyph.get() )
|
||||
{
|
||||
for( VECTOR2D& point : pointList )
|
||||
{
|
||||
point *= aGlyphSize;
|
||||
|
||||
if( aTilt != 0.0 )
|
||||
if( aTilt )
|
||||
point.x -= point.y * aTilt;
|
||||
|
||||
point += aOffset;
|
||||
@@ -111,18 +111,6 @@ std::unique_ptr<GLYPH> STROKE_GLYPH::Transform( const VECTOR2D& aGlyphSize, cons
|
||||
}
|
||||
|
||||
|
||||
void STROKE_GLYPH::Move( const VECTOR2I& aOffset )
|
||||
{
|
||||
m_boundingBox.Offset( aOffset );
|
||||
|
||||
for( std::vector<VECTOR2D>& pointList : *this )
|
||||
{
|
||||
for( VECTOR2D& point : pointList )
|
||||
point += aOffset;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOX2D OUTLINE_GLYPH::BoundingBox()
|
||||
{
|
||||
BOX2I bbox = BBox();
|
||||
@@ -134,7 +122,10 @@ void OUTLINE_GLYPH::Triangulate( std::function<void( const VECTOR2I& aPt1,
|
||||
const VECTOR2I& aPt2,
|
||||
const VECTOR2I& aPt3 )> aCallback ) const
|
||||
{
|
||||
const_cast<OUTLINE_GLYPH*>( this )->CacheTriangulation( false );
|
||||
// Only call CacheTriangulation if it has never been done before. Otherwise we'll hash
|
||||
// the triangulation to see if it has been edited, and glyphs after creation are read-only.
|
||||
if( TriangulatedPolyCount() == 0 )
|
||||
const_cast<OUTLINE_GLYPH*>( this )->CacheTriangulation( false );
|
||||
|
||||
for( unsigned int i = 0; i < TriangulatedPolyCount(); i++ )
|
||||
{
|
||||
@@ -150,30 +141,3 @@ void OUTLINE_GLYPH::Triangulate( std::function<void( const VECTOR2I& aPt1,
|
||||
}
|
||||
|
||||
|
||||
void OUTLINE_GLYPH::CacheTriangulation( bool aPartition, bool aSimplify )
|
||||
{
|
||||
// Only call CacheTriangulation if it has never been done before. Otherwise we'll hash
|
||||
// the triangulation to see if it has been edited, and glyphs are invariant after creation.
|
||||
//
|
||||
// Also forces "partition" to false as we never want to partition a glyph.
|
||||
|
||||
if( TriangulatedPolyCount() == 0 )
|
||||
SHAPE_POLY_SET::CacheTriangulation( false, aSimplify );
|
||||
}
|
||||
|
||||
|
||||
std::vector<std::unique_ptr<SHAPE_POLY_SET::TRIANGULATED_POLYGON>> OUTLINE_GLYPH::GetTriangulationData() const
|
||||
{
|
||||
std::vector<std::unique_ptr<SHAPE_POLY_SET::TRIANGULATED_POLYGON>> data;
|
||||
|
||||
for( const std::unique_ptr<SHAPE_POLY_SET::TRIANGULATED_POLYGON>& poly : m_triangulatedPolys )
|
||||
data.push_back( std::make_unique<SHAPE_POLY_SET::TRIANGULATED_POLYGON>( *poly ) );
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
void OUTLINE_GLYPH::CacheTriangulation( std::vector<std::unique_ptr<SHAPE_POLY_SET::TRIANGULATED_POLYGON>>& aHintData )
|
||||
{
|
||||
cacheTriangulation( false, false, &aHintData );
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2021 Ola Rinta-Koski <gitlab@rinta-koski.net>
|
||||
* Copyright (C) 2021-2024 Kicad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2021 Kicad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* Outline font class
|
||||
*
|
||||
@@ -39,8 +39,8 @@ OUTLINE_DECOMPOSER::OUTLINE_DECOMPOSER( FT_Outline& aOutline ) :
|
||||
|
||||
static VECTOR2D toVector2D( const FT_Vector* aFreeTypeVector )
|
||||
{
|
||||
return VECTOR2D( (double) aFreeTypeVector->x * GLYPH_SIZE_SCALER,
|
||||
(double) aFreeTypeVector->y * GLYPH_SIZE_SCALER );
|
||||
return VECTOR2D( aFreeTypeVector->x * GLYPH_SIZE_SCALER,
|
||||
aFreeTypeVector->y * GLYPH_SIZE_SCALER );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2021 Ola Rinta-Koski <gitlab@rinta-koski.net>
|
||||
* Copyright (C) 2021-2024 Kicad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2021-2023 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
|
||||
@@ -255,40 +255,6 @@ VECTOR2I OUTLINE_FONT::getTextAsGlyphs( BOX2I* aBBox, std::vector<std::unique_pt
|
||||
aOrigin, aTextStyle );
|
||||
}
|
||||
|
||||
|
||||
struct GLYPH_CACHE_KEY {
|
||||
FT_Face face;
|
||||
hb_codepoint_t codepoint;
|
||||
double scaler;
|
||||
bool fakeItalic;
|
||||
bool fakeBold;
|
||||
bool mirror;
|
||||
EDA_ANGLE angle;
|
||||
|
||||
bool operator==(const GLYPH_CACHE_KEY& rhs ) const
|
||||
{
|
||||
return face == rhs.face && codepoint == rhs.codepoint && scaler == rhs.scaler
|
||||
&& fakeItalic == rhs.fakeItalic && fakeBold == rhs.fakeBold
|
||||
&& mirror == rhs.mirror && angle == rhs.angle;
|
||||
}
|
||||
};
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <>
|
||||
struct hash<GLYPH_CACHE_KEY>
|
||||
{
|
||||
std::size_t operator()( const GLYPH_CACHE_KEY& k ) const
|
||||
{
|
||||
return hash<const void*>()( k.face ) ^ hash<unsigned>()( k.codepoint )
|
||||
^ hash<double>()( k.scaler )
|
||||
^ hash<int>()( k.fakeItalic ) ^ hash<int>()( k.fakeBold )
|
||||
^ hash<int>()( k.mirror ) ^ hash<int>()( k.angle.AsTenthsOfADegree() );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
VECTOR2I OUTLINE_FONT::getTextAsGlyphsUnlocked( BOX2I* aBBox,
|
||||
std::vector<std::unique_ptr<GLYPH>>* aGlyphs,
|
||||
const wxString& aText, const VECTOR2I& aSize,
|
||||
@@ -329,10 +295,6 @@ VECTOR2I OUTLINE_FONT::getTextAsGlyphsUnlocked( BOX2I* aBBox,
|
||||
if( aGlyphs )
|
||||
aGlyphs->reserve( glyphCount );
|
||||
|
||||
// GLYPH_DATA is a collection of all outlines in the glyph; for example the 'o' glyph
|
||||
// generally contains 2 contours, one for the glyph outline and one for the hole
|
||||
static std::unordered_map<GLYPH_CACHE_KEY, GLYPH_DATA> s_glyphCache;
|
||||
|
||||
for( unsigned int i = 0; i < glyphCount; i++ )
|
||||
{
|
||||
// Don't process glyphs that were already included in a previous cluster
|
||||
@@ -341,67 +303,64 @@ VECTOR2I OUTLINE_FONT::getTextAsGlyphsUnlocked( BOX2I* aBBox,
|
||||
|
||||
if( aGlyphs )
|
||||
{
|
||||
GLYPH_CACHE_KEY key = { face, glyphInfo[i].codepoint, scaler, m_fakeItal, m_fakeBold,
|
||||
aMirror, aAngle };
|
||||
GLYPH_DATA& glyphData = s_glyphCache[ key ];
|
||||
|
||||
if( glyphData.m_Contours.empty() )
|
||||
if( m_fakeItal )
|
||||
{
|
||||
if( m_fakeItal )
|
||||
{
|
||||
FT_Matrix matrix;
|
||||
// Create a 12 degree slant
|
||||
const float angle = (float)( -M_PI * 12.0f ) / 180.0f;
|
||||
matrix.xx = (FT_Fixed) ( cos( angle ) * 0x10000L );
|
||||
matrix.xy = (FT_Fixed) ( -sin( angle ) * 0x10000L );
|
||||
matrix.yx = (FT_Fixed) ( 0 * 0x10000L ); // Don't rotate in the y direction
|
||||
matrix.yy = (FT_Fixed) ( 1 * 0x10000L );
|
||||
FT_Matrix matrix;
|
||||
// Create a 12 degree slant
|
||||
const float angle = (float)( -M_PI * 12.0f ) / 180.0f;
|
||||
matrix.xx = (FT_Fixed) ( cos( angle ) * 0x10000L );
|
||||
matrix.xy = (FT_Fixed) ( -sin( angle ) * 0x10000L );
|
||||
matrix.yx = (FT_Fixed) ( 0 * 0x10000L ); // Don't rotate in the y direction
|
||||
matrix.yy = (FT_Fixed) ( 1 * 0x10000L );
|
||||
|
||||
FT_Set_Transform( face, &matrix, nullptr );
|
||||
}
|
||||
FT_Set_Transform( face, &matrix, 0 );
|
||||
}
|
||||
|
||||
FT_Load_Glyph( face, glyphInfo[i].codepoint, FT_LOAD_NO_BITMAP );
|
||||
FT_Load_Glyph( face, glyphInfo[i].codepoint, FT_LOAD_NO_BITMAP );
|
||||
|
||||
if( m_fakeBold )
|
||||
FT_Outline_Embolden( &face->glyph->outline, 1 << 6 );
|
||||
if( m_fakeBold )
|
||||
FT_Outline_Embolden( &face->glyph->outline, 1 << 6 );
|
||||
|
||||
OUTLINE_DECOMPOSER decomposer( face->glyph->outline );
|
||||
// contours is a collection of all outlines in the glyph; for example the 'o' glyph
|
||||
// generally contains 2 contours, one for the glyph outline and one for the hole
|
||||
std::vector<CONTOUR> contours;
|
||||
|
||||
if( !decomposer.OutlineToSegments( &glyphData.m_Contours ) )
|
||||
{
|
||||
double hb_advance = glyphPos[i].x_advance * GLYPH_SIZE_SCALER;
|
||||
BOX2D tofuBox( { scaler * 0.03, 0.0 },
|
||||
{ hb_advance - scaler * 0.02, scaler * 0.72 } );
|
||||
OUTLINE_DECOMPOSER decomposer( face->glyph->outline );
|
||||
|
||||
glyphData.m_Contours.clear();
|
||||
if( !decomposer.OutlineToSegments( &contours ) )
|
||||
{
|
||||
double hb_advance = glyphPos[i].x_advance * GLYPH_SIZE_SCALER;
|
||||
BOX2D tofuBox( { scaler * 0.03, 0.0 },
|
||||
{ hb_advance - scaler * 0.02, scaler * 0.72 } );
|
||||
|
||||
CONTOUR outline;
|
||||
outline.m_Winding = 1;
|
||||
outline.m_Orientation = FT_ORIENTATION_TRUETYPE;
|
||||
outline.m_Points.push_back( tofuBox.GetPosition() );
|
||||
outline.m_Points.push_back( { tofuBox.GetSize().x, tofuBox.GetPosition().y } );
|
||||
outline.m_Points.push_back( tofuBox.GetSize() );
|
||||
outline.m_Points.push_back( { tofuBox.GetPosition().x, tofuBox.GetSize().y } );
|
||||
glyphData.m_Contours.push_back( outline );
|
||||
contours.clear();
|
||||
|
||||
CONTOUR hole;
|
||||
tofuBox.Move( { scaler * 0.06, scaler * 0.06 } );
|
||||
tofuBox.SetSize( { tofuBox.GetWidth() - scaler * 0.06,
|
||||
tofuBox.GetHeight() - scaler * 0.06 } );
|
||||
hole.m_Winding = 1;
|
||||
hole.m_Orientation = FT_ORIENTATION_NONE;
|
||||
hole.m_Points.push_back( tofuBox.GetPosition() );
|
||||
hole.m_Points.push_back( { tofuBox.GetSize().x, tofuBox.GetPosition().y } );
|
||||
hole.m_Points.push_back( tofuBox.GetSize() );
|
||||
hole.m_Points.push_back( { tofuBox.GetPosition().x, tofuBox.GetSize().y } );
|
||||
glyphData.m_Contours.push_back( hole );
|
||||
}
|
||||
CONTOUR outline;
|
||||
outline.m_Winding = 1;
|
||||
outline.m_Orientation = FT_ORIENTATION_TRUETYPE;
|
||||
outline.m_Points.push_back( tofuBox.GetPosition() );
|
||||
outline.m_Points.push_back( { tofuBox.GetSize().x, tofuBox.GetPosition().y } );
|
||||
outline.m_Points.push_back( tofuBox.GetSize() );
|
||||
outline.m_Points.push_back( { tofuBox.GetPosition().x, tofuBox.GetSize().y } );
|
||||
contours.push_back( outline );
|
||||
|
||||
CONTOUR hole;
|
||||
tofuBox.Move( { scaler * 0.06, scaler * 0.06 } );
|
||||
tofuBox.SetSize( { tofuBox.GetWidth() - scaler * 0.06,
|
||||
tofuBox.GetHeight() - scaler * 0.06 } );
|
||||
hole.m_Winding = 1;
|
||||
hole.m_Orientation = FT_ORIENTATION_NONE;
|
||||
hole.m_Points.push_back( tofuBox.GetPosition() );
|
||||
hole.m_Points.push_back( { tofuBox.GetSize().x, tofuBox.GetPosition().y } );
|
||||
hole.m_Points.push_back( tofuBox.GetSize() );
|
||||
hole.m_Points.push_back( { tofuBox.GetPosition().x, tofuBox.GetSize().y } );
|
||||
contours.push_back( hole );
|
||||
}
|
||||
|
||||
std::unique_ptr<OUTLINE_GLYPH> glyph = std::make_unique<OUTLINE_GLYPH>();
|
||||
std::vector<SHAPE_LINE_CHAIN> holes;
|
||||
|
||||
for( CONTOUR& c : glyphData.m_Contours )
|
||||
for( CONTOUR& c : contours )
|
||||
{
|
||||
std::vector<VECTOR2D> points = c.m_Points;
|
||||
SHAPE_LINE_CHAIN shape;
|
||||
@@ -452,16 +411,6 @@ VECTOR2I OUTLINE_FONT::getTextAsGlyphsUnlocked( BOX2I* aBBox,
|
||||
}
|
||||
}
|
||||
|
||||
if( glyphData.m_TriangulationData.empty() )
|
||||
{
|
||||
glyph->CacheTriangulation( false, false );
|
||||
glyphData.m_TriangulationData = glyph->GetTriangulationData();
|
||||
}
|
||||
else
|
||||
{
|
||||
glyph->CacheTriangulation( glyphData.m_TriangulationData );
|
||||
}
|
||||
|
||||
aGlyphs->push_back( std::move( glyph ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -327,9 +327,8 @@ const FP_LIB_TABLE_ROW* FP_LIB_TABLE::FindRow( const wxString& aNickname, bool a
|
||||
|
||||
if( !row )
|
||||
{
|
||||
// We don't generally show this string to the user (who is unlikely to know what
|
||||
// "fp-lib-table" means), and translating it may produce Sentry KICAD-YP.
|
||||
wxString msg = wxString::Format( wxS( "'%s' not found in fp-lib-table." ), aNickname );
|
||||
wxString msg = wxString::Format( _( "fp-lib-table files contain no library named '%s'." ),
|
||||
aNickname );
|
||||
THROW_IO_ERROR( msg );
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ void CAIRO_COMPOSITOR::Resize( unsigned int aWidth, unsigned int aHeight )
|
||||
unsigned int CAIRO_COMPOSITOR::CreateBuffer()
|
||||
{
|
||||
// Pixel storage
|
||||
BitmapPtr bitmap = new uint8_t[m_bufferSize]();
|
||||
BitmapPtr bitmap = new uint32_t[m_bufferSize]();
|
||||
|
||||
// Create the Cairo surface
|
||||
cairo_surface_t* surface = cairo_image_surface_create_for_data(
|
||||
@@ -138,7 +138,7 @@ void CAIRO_COMPOSITOR::Begin()
|
||||
void CAIRO_COMPOSITOR::ClearBuffer( const COLOR4D& aColor )
|
||||
{
|
||||
// Clear the pixel storage
|
||||
memset( m_buffers[m_current].bitmap, 0x00, m_bufferSize );
|
||||
memset( m_buffers[m_current].bitmap, 0x00, m_bufferSize * sizeof( int ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ static double roundp( double x )
|
||||
|
||||
const VECTOR2D CAIRO_GAL_BASE::roundp( const VECTOR2D& v )
|
||||
{
|
||||
if( m_lineWidthIsOdd )
|
||||
if( m_lineWidthIsOdd && m_isStrokeEnabled )
|
||||
return VECTOR2D( ::roundp( v.x ), ::roundp( v.y ) );
|
||||
else
|
||||
return VECTOR2D( floor( v.x + 0.5 ), floor( v.y + 0.5 ) );
|
||||
@@ -352,18 +352,13 @@ void CAIRO_GAL_BASE::DrawArc( const VECTOR2D& aCenterPoint, double aRadius,
|
||||
|
||||
double r = xform( aRadius );
|
||||
|
||||
// Adjust center and radius slightly to better match the rounding of endpoints.
|
||||
VECTOR2D mid = roundp( xform( aCenterPoint ) );
|
||||
// N.B. This is backwards. We set this because we want to adjust the center
|
||||
// point that changes both endpoints. In the worst case, this is twice as far.
|
||||
// We cannot adjust radius or center based on the other because this causes the
|
||||
// whole arc to change position/size
|
||||
m_lineWidthIsOdd = !( static_cast<int>( aRadius ) % 2 );
|
||||
|
||||
VECTOR2D startPointS = VECTOR2D( r, 0.0 );
|
||||
VECTOR2D endPointS = VECTOR2D( r, 0.0 );
|
||||
RotatePoint( startPointS, -EDA_ANGLE( startAngle, RADIANS_T ) );
|
||||
RotatePoint( endPointS, -EDA_ANGLE( endAngle, RADIANS_T ) );
|
||||
|
||||
VECTOR2D refStart = roundp( xform( aCenterPoint ) + startPointS );
|
||||
VECTOR2D refEnd = roundp( xform( aCenterPoint ) + endPointS );
|
||||
|
||||
r = ( ( refStart - mid ).EuclideanNorm() + ( refEnd - mid ).EuclideanNorm() ) / 2.0;
|
||||
auto mid = roundp( xform( aCenterPoint ) );
|
||||
|
||||
cairo_set_line_width( m_currentContext, m_lineWidthInPixels );
|
||||
cairo_new_sub_path( m_currentContext );
|
||||
@@ -408,7 +403,13 @@ void CAIRO_GAL_BASE::DrawArcSegment( const VECTOR2D& aCenterPoint, double aRadiu
|
||||
|
||||
double r = xform( aRadius );
|
||||
|
||||
VECTOR2D mid = xform( aCenterPoint );
|
||||
// N.B. This is backwards. We set this because we want to adjust the center
|
||||
// point that changes both endpoints. In the worst case, this is twice as far.
|
||||
// We cannot adjust radius or center based on the other because this causes the
|
||||
// whole arc to change position/size
|
||||
m_lineWidthIsOdd = !( static_cast<int>( aRadius ) % 2 );
|
||||
|
||||
VECTOR2D mid = roundp( xform( aCenterPoint ) );
|
||||
double width = xform( aWidth / 2.0 );
|
||||
VECTOR2D startPointS = VECTOR2D( r, 0.0 );
|
||||
VECTOR2D endPointS = VECTOR2D( r, 0.0 );
|
||||
@@ -1412,34 +1413,20 @@ void CAIRO_GAL::EndDrawing()
|
||||
|
||||
// Now translate the raw context data from the format stored
|
||||
// by cairo into a format understood by wxImage.
|
||||
int height = m_screenSize.y;
|
||||
int stride = m_stride;
|
||||
pixman_image_t* dstImg = pixman_image_create_bits(
|
||||
wxPlatformInfo::Get().GetEndianness() == wxENDIAN_LITTLE ? PIXMAN_b8g8r8
|
||||
: PIXMAN_r8g8b8,
|
||||
m_screenSize.x, m_screenSize.y, (uint32_t*) m_wxOutput, m_wxBufferWidth * 3 );
|
||||
pixman_image_t* srcImg =
|
||||
pixman_image_create_bits( PIXMAN_a8r8g8b8, m_screenSize.x, m_screenSize.y,
|
||||
(uint32_t*) m_bitmapBuffer, m_wxBufferWidth * 4 );
|
||||
|
||||
unsigned char* srcRow = m_bitmapBuffer;
|
||||
unsigned char* dst = m_wxOutput;
|
||||
pixman_image_composite( PIXMAN_OP_SRC, srcImg, nullptr, dstImg, 0, 0, 0, 0, 0, 0,
|
||||
m_screenSize.x, m_screenSize.y );
|
||||
|
||||
for( int y = 0; y < height; y++ )
|
||||
{
|
||||
for( int x = 0; x < stride; x += 4 )
|
||||
{
|
||||
const unsigned char* src = srcRow + x;
|
||||
|
||||
#if defined( __BYTE_ORDER__ ) && ( __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ )
|
||||
// XRGB
|
||||
dst[0] = src[1];
|
||||
dst[1] = src[2];
|
||||
dst[2] = src[3];
|
||||
#else
|
||||
// BGRX
|
||||
dst[0] = src[2];
|
||||
dst[1] = src[1];
|
||||
dst[2] = src[0];
|
||||
#endif
|
||||
dst += 3;
|
||||
}
|
||||
|
||||
srcRow += stride;
|
||||
}
|
||||
// Free allocated memory
|
||||
pixman_image_unref( srcImg );
|
||||
pixman_image_unref( dstImg );
|
||||
|
||||
wxImage img( m_wxBufferWidth, m_screenSize.y, m_wxOutput, true );
|
||||
wxBitmap bmp( img );
|
||||
@@ -1595,12 +1582,15 @@ void CAIRO_GAL::allocateBitmaps()
|
||||
{
|
||||
m_wxBufferWidth = m_screenSize.x;
|
||||
|
||||
while( ( ( m_wxBufferWidth * 3 ) % 4 ) != 0 )
|
||||
m_wxBufferWidth++;
|
||||
|
||||
// Create buffer, use the system independent Cairo context backend
|
||||
m_stride = cairo_format_stride_for_width( GAL_FORMAT, m_wxBufferWidth );
|
||||
m_bufferSize = m_stride * m_screenSize.y;
|
||||
|
||||
wxASSERT( m_bitmapBuffer == nullptr );
|
||||
m_bitmapBuffer = new unsigned char[m_bufferSize];
|
||||
m_bitmapBuffer = new unsigned char[m_bufferSize * 4];
|
||||
|
||||
wxASSERT( m_wxOutput == nullptr );
|
||||
m_wxOutput = new unsigned char[m_wxBufferWidth * 3 * m_screenSize.y];
|
||||
@@ -1671,16 +1661,13 @@ bool CAIRO_GAL::updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions )
|
||||
}
|
||||
|
||||
|
||||
bool CAIRO_GAL::SetNativeCursorStyle( KICURSOR aCursor, bool aHiDPI )
|
||||
bool CAIRO_GAL::SetNativeCursorStyle( KICURSOR aCursor )
|
||||
{
|
||||
// Store the current cursor type and get the wxCursor for it
|
||||
if( !GAL::SetNativeCursorStyle( aCursor, aHiDPI ) )
|
||||
if( !GAL::SetNativeCursorStyle( aCursor ) )
|
||||
return false;
|
||||
|
||||
if( aHiDPI )
|
||||
m_currentwxCursor = CURSOR_STORE::GetHiDPICursor( m_currentNativeCursor );
|
||||
else
|
||||
m_currentwxCursor = CURSOR_STORE::GetCursor( m_currentNativeCursor );
|
||||
m_currentwxCursor = CURSOR_STORE::GetCursor( m_currentNativeCursor );
|
||||
|
||||
// Update the cursor in the wx control
|
||||
wxWindow::SetCursor( m_currentwxCursor );
|
||||
|
||||
+51
-259
@@ -44,76 +44,85 @@
|
||||
#include <cursors/cursor-subtract.xpm>
|
||||
#include <cursors/cursor-text.xpm>
|
||||
#include <cursors/cursor-xor.xpm>
|
||||
#include <cursors/cursor-zoom-in.xpm>
|
||||
#include <cursors/cursor-zoom.xpm>
|
||||
#include <cursors/cursor-zoom-out.xpm>
|
||||
#include <cursors/cursor_tune.xpm>
|
||||
#include <cursors/voltage_probe.xpm>
|
||||
#include <cursors/current_probe.xpm>
|
||||
|
||||
// HiDPI cursor files
|
||||
#include <cursors/cursor-add64.xpm>
|
||||
#include <cursors/cursor-component64.xpm>
|
||||
#include <cursors/cursor-eraser64.xpm>
|
||||
#include <cursors/cursor-label-global64.xpm>
|
||||
#include <cursors/cursor-label-hier64.xpm>
|
||||
#include <cursors/cursor-label-net64.xpm>
|
||||
#include <cursors/cursor-line-bus64.xpm>
|
||||
#include <cursors/cursor-line-graphic64.xpm>
|
||||
#include <cursors/cursor-line-wire64.xpm>
|
||||
#include <cursors/cursor-line-wire-add64.xpm>
|
||||
#include <cursors/cursor-measure64.xpm>
|
||||
#include <cursors/cursor-pencil64.xpm>
|
||||
#include <cursors/cursor-select-lasso64.xpm>
|
||||
#include <cursors/cursor-select-window64.xpm>
|
||||
#include <cursors/cursor-subtract64.xpm>
|
||||
#include <cursors/cursor-text64.xpm>
|
||||
#include <cursors/cursor-xor64.xpm>
|
||||
#include <cursors/cursor-zoom-in64.xpm>
|
||||
#include <cursors/cursor-zoom-out64.xpm>
|
||||
#include <cursors/cursor_tune64.xpm>
|
||||
#include <cursors/voltage_probe64.xpm>
|
||||
#include <cursors/current_probe64.xpm>
|
||||
|
||||
|
||||
// Under MSW, the standard cursor is white on black. Elsewhere it is black on white
|
||||
#ifdef __WINDOWS__
|
||||
#include <cursors/cursor-place.xpm>
|
||||
#include <cursors/cursor-place64.xpm>
|
||||
#include <cursors/cursor-select-m.xpm>
|
||||
#include <cursors/cursor-select-m64.xpm>
|
||||
#else
|
||||
#include <cursors/cursor-place-black.xpm>
|
||||
#include <cursors/cursor-place-black64.xpm>
|
||||
#include <cursors/cursor-select-m-black.xpm>
|
||||
#include <cursors/cursor-select-m-black64.xpm>
|
||||
#endif
|
||||
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/debug.h>
|
||||
|
||||
|
||||
static const unsigned char voltage_probe[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00,
|
||||
0x00, 0x30, 0x06, 0x00, 0x00, 0x18, 0x0c, 0x00, 0x00, 0x0e, 0x08, 0x00, 0x80, 0x07, 0x08, 0x00,
|
||||
0xc0, 0x07, 0x18, 0x00, 0xe0, 0x07, 0x30, 0x00, 0xf0, 0x03, 0x60, 0x00, 0xf8, 0x01, 0x00, 0x00,
|
||||
0xfc, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x80, 0x1f, 0x00, 0x00, 0xc0,
|
||||
0x0f, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0xf0, 0x03, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00, 0xf0,
|
||||
0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x02,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
|
||||
static const unsigned char current_probe[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x60, 0x06, 0x00,
|
||||
0x00, 0x30, 0x0c, 0x00, 0x00, 0x1c, 0x08, 0x00, 0x00, 0x0f, 0x08, 0x00, 0x80, 0x0f, 0x18, 0x00,
|
||||
0xc0, 0x0f, 0x30, 0x80, 0xe1, 0x07, 0x60, 0x80, 0xf1, 0x03, 0x00, 0x80, 0xf9, 0x01, 0x00, 0x80,
|
||||
0xfd, 0x00, 0x00, 0x80, 0x7f, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x80, 0x1f, 0x00, 0x00, 0xc0,
|
||||
0x0f, 0x00, 0x00, 0xf8, 0x07, 0x00, 0x00, 0xfe, 0x03, 0x00, 0x00, 0xc6, 0x01, 0x00, 0x00, 0x83,
|
||||
0x01, 0x00, 0x00, 0x83, 0x01, 0x00, 0x00, 0x83, 0x01, 0x00, 0x00, 0xc2, 0x00, 0x00, 0x00, 0xfc,
|
||||
0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00 };
|
||||
|
||||
static const unsigned char cursor_tune[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0xc0, 0x0f, 0x00,
|
||||
0x00, 0xe0, 0x1f, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xfc, 0x07, 0x00,
|
||||
0x00, 0xfe, 0x03, 0x00, 0x00, 0xff, 0x01, 0x00, 0x80, 0xff, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x00,
|
||||
0xe0, 0x3f, 0x00, 0x00, 0xe0, 0x1f, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0xfc, 0x07, 0x00, 0x00,
|
||||
0xfc, 0x03, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, 0x00, 0xea, 0x00, 0x00, 0x00,
|
||||
0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x50,
|
||||
0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x0a,
|
||||
0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00 };
|
||||
|
||||
static const unsigned char cursor_tune_mask[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0xc0, 0x0f,
|
||||
0x00, 0x00, 0xe0, 0x1f, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, 0xf8, 0x0f, 0x00, 0x00, 0xfc, 0x07,
|
||||
0x00, 0x00, 0xfe, 0x03, 0x00, 0x00, 0xff, 0x01, 0x00, 0x80, 0xff, 0x00, 0x00, 0xc0, 0x7f, 0x00,
|
||||
0x00, 0xe0, 0x3f, 0x00, 0x00, 0xe0, 0x1f, 0x00, 0x00, 0xfc, 0x0f, 0x00, 0x00, 0xfc, 0x07, 0x00,
|
||||
0x00, 0xfc, 0x03, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xee, 0x00, 0x00,
|
||||
0x00, 0x07, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00,
|
||||
0x70, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00,
|
||||
0x0e, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00 };
|
||||
|
||||
|
||||
static const std::vector<CURSOR_STORE::CURSOR_DEF> standard_cursors = {
|
||||
{
|
||||
KICURSOR::VOLTAGE_PROBE,
|
||||
voltage_probe,
|
||||
voltage_probe,
|
||||
nullptr,
|
||||
nullptr,
|
||||
voltage_probe_xpm,
|
||||
{ 32, 32 },
|
||||
{ 1, 31 },
|
||||
},
|
||||
{
|
||||
KICURSOR::CURRENT_PROBE,
|
||||
current_probe,
|
||||
current_probe,
|
||||
nullptr,
|
||||
nullptr,
|
||||
current_probe_xpm,
|
||||
{ 32, 32 },
|
||||
{ 4, 27 },
|
||||
},
|
||||
{
|
||||
KICURSOR::TUNE,
|
||||
cursor_tune,
|
||||
cursor_tune_mask,
|
||||
nullptr,
|
||||
nullptr,
|
||||
cursor_tune_xpm,
|
||||
{ 32, 32 },
|
||||
{ 1, 30 },
|
||||
},
|
||||
@@ -189,7 +198,7 @@ static const std::vector<CURSOR_STORE::CURSOR_DEF> standard_cursors = {
|
||||
KICURSOR::ZOOM_IN,
|
||||
nullptr,
|
||||
nullptr,
|
||||
cursor_zoom_in_xpm,
|
||||
cursor_zoom_xpm,
|
||||
{ 32, 32 },
|
||||
{ 6, 6 },
|
||||
},
|
||||
@@ -296,209 +305,6 @@ static const std::vector<CURSOR_STORE::CURSOR_DEF> standard_cursors = {
|
||||
};
|
||||
|
||||
|
||||
static const std::vector<CURSOR_STORE::CURSOR_DEF> hidpi_cursors = {
|
||||
{
|
||||
KICURSOR::VOLTAGE_PROBE,
|
||||
nullptr,
|
||||
nullptr,
|
||||
voltage_probe64_xpm,
|
||||
{ 64, 64 },
|
||||
{ 1, 62 },
|
||||
},
|
||||
{
|
||||
KICURSOR::CURRENT_PROBE,
|
||||
nullptr,
|
||||
nullptr,
|
||||
current_probe64_xpm,
|
||||
{ 64, 64 },
|
||||
{ 8, 54 },
|
||||
},
|
||||
{
|
||||
KICURSOR::TUNE,
|
||||
nullptr,
|
||||
nullptr,
|
||||
cursor_tune64_xpm,
|
||||
{ 64, 64 },
|
||||
{ 2, 60 },
|
||||
},
|
||||
{
|
||||
KICURSOR::PENCIL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
cursor_pencil64_xpm,
|
||||
{ 64, 64 },
|
||||
{ 8, 54 },
|
||||
},
|
||||
{
|
||||
KICURSOR::MOVING,
|
||||
nullptr,
|
||||
nullptr,
|
||||
#ifdef __WINDOWS__
|
||||
cursor_select_m64_xpm,
|
||||
#else
|
||||
cursor_select_m_black64_xpm,
|
||||
#endif
|
||||
{ 64, 64 },
|
||||
{ 2, 2 },
|
||||
},
|
||||
{
|
||||
KICURSOR::REMOVE,
|
||||
nullptr,
|
||||
nullptr,
|
||||
cursor_eraser64_xpm,
|
||||
{ 64, 64 },
|
||||
{ 8, 8 },
|
||||
},
|
||||
{
|
||||
KICURSOR::TEXT,
|
||||
nullptr,
|
||||
nullptr,
|
||||
cursor_text64_xpm,
|
||||
{ 64, 64 },
|
||||
{ 14, 14 },
|
||||
},
|
||||
{
|
||||
KICURSOR::MEASURE,
|
||||
nullptr,
|
||||
nullptr,
|
||||
cursor_measure64_xpm,
|
||||
{ 64, 64 },
|
||||
{ 8, 8 },
|
||||
},
|
||||
{
|
||||
KICURSOR::ADD,
|
||||
nullptr,
|
||||
nullptr,
|
||||
cursor_add64_xpm,
|
||||
{ 64, 64 },
|
||||
{ 14, 14 },
|
||||
},
|
||||
{
|
||||
KICURSOR::SUBTRACT,
|
||||
nullptr,
|
||||
nullptr,
|
||||
cursor_subtract64_xpm,
|
||||
{ 64, 64 },
|
||||
{ 14, 14 },
|
||||
},
|
||||
{
|
||||
KICURSOR::XOR,
|
||||
nullptr,
|
||||
nullptr,
|
||||
cursor_xor64_xpm,
|
||||
{ 64, 64 },
|
||||
{ 14, 14 },
|
||||
},
|
||||
{
|
||||
KICURSOR::ZOOM_IN,
|
||||
nullptr,
|
||||
nullptr,
|
||||
cursor_zoom_in64_xpm,
|
||||
{ 64, 64 },
|
||||
{ 12, 12 },
|
||||
},
|
||||
{
|
||||
KICURSOR::ZOOM_OUT,
|
||||
nullptr,
|
||||
nullptr,
|
||||
cursor_zoom_out64_xpm,
|
||||
{ 64, 64 },
|
||||
{ 12, 12 },
|
||||
},
|
||||
{
|
||||
KICURSOR::LABEL_NET,
|
||||
nullptr,
|
||||
nullptr,
|
||||
cursor_label_net64_xpm,
|
||||
{ 64, 64 },
|
||||
{ 14, 14 },
|
||||
},
|
||||
{
|
||||
KICURSOR::LABEL_GLOBAL,
|
||||
nullptr,
|
||||
nullptr,
|
||||
cursor_label_global64_xpm,
|
||||
{ 64, 64 },
|
||||
{ 14, 14 },
|
||||
},
|
||||
{
|
||||
KICURSOR::COMPONENT,
|
||||
nullptr,
|
||||
nullptr,
|
||||
cursor_component64_xpm,
|
||||
{ 64, 64 },
|
||||
{ 14, 14 },
|
||||
},
|
||||
{
|
||||
KICURSOR::SELECT_LASSO,
|
||||
nullptr,
|
||||
nullptr,
|
||||
cursor_select_lasso64_xpm,
|
||||
{ 64, 64 },
|
||||
{ 14, 14 },
|
||||
},
|
||||
{
|
||||
KICURSOR::SELECT_WINDOW,
|
||||
nullptr,
|
||||
nullptr,
|
||||
cursor_select_window64_xpm,
|
||||
{ 64, 64 },
|
||||
{ 14, 20 },
|
||||
},
|
||||
{
|
||||
KICURSOR::LINE_BUS,
|
||||
nullptr,
|
||||
nullptr,
|
||||
cursor_line_bus64_xpm,
|
||||
{ 64, 64 },
|
||||
{ 10, 52 },
|
||||
},
|
||||
{
|
||||
KICURSOR::LINE_WIRE,
|
||||
nullptr,
|
||||
nullptr,
|
||||
cursor_line_wire64_xpm,
|
||||
{ 64, 64 },
|
||||
{ 10, 52 },
|
||||
},
|
||||
{
|
||||
KICURSOR::LINE_WIRE_ADD,
|
||||
nullptr,
|
||||
nullptr,
|
||||
cursor_line_wire_add64_xpm,
|
||||
{ 64, 64 },
|
||||
{ 10, 52 },
|
||||
},
|
||||
{
|
||||
KICURSOR::LINE_GRAPHIC,
|
||||
nullptr,
|
||||
nullptr,
|
||||
cursor_line_graphic64_xpm,
|
||||
{ 64, 64 },
|
||||
{ 10, 52 },
|
||||
},
|
||||
{
|
||||
KICURSOR::LABEL_HIER,
|
||||
nullptr,
|
||||
nullptr,
|
||||
cursor_label_hier64_xpm,
|
||||
{ 64, 64 },
|
||||
{ 14, 14 },
|
||||
},
|
||||
{
|
||||
KICURSOR::PLACE,
|
||||
nullptr,
|
||||
nullptr,
|
||||
#ifdef __WINDOWS__
|
||||
cursor_place64_xpm,
|
||||
#else
|
||||
cursor_place_black64_xpm,
|
||||
#endif
|
||||
{ 64, 64 },
|
||||
{ 2, 2 },
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Construct a cursor for the given definition.
|
||||
*
|
||||
@@ -587,8 +393,8 @@ const wxCursor& CURSOR_STORE::Get( KICURSOR aIdKey ) const
|
||||
|
||||
const wxCursor CURSOR_STORE::GetCursor( KICURSOR aCursorType )
|
||||
{
|
||||
wxStockCursor stock = GetStockCursor( aCursorType );
|
||||
|
||||
wxStockCursor stock =
|
||||
GetStockCursor( aCursorType );
|
||||
if( stock != wxCURSOR_MAX )
|
||||
{
|
||||
return wxCursor( stock );
|
||||
@@ -599,20 +405,6 @@ const wxCursor CURSOR_STORE::GetCursor( KICURSOR aCursorType )
|
||||
}
|
||||
|
||||
|
||||
const wxCursor CURSOR_STORE::GetHiDPICursor( KICURSOR aCursorType )
|
||||
{
|
||||
wxStockCursor stock = GetStockCursor( aCursorType );
|
||||
|
||||
if( stock != wxCURSOR_MAX )
|
||||
{
|
||||
return wxCursor( stock );
|
||||
}
|
||||
|
||||
static CURSOR_STORE store( hidpi_cursors );
|
||||
return store.Get( aCursorType );
|
||||
}
|
||||
|
||||
|
||||
wxStockCursor CURSOR_STORE::GetStockCursor( KICURSOR aCursorType )
|
||||
{
|
||||
wxStockCursor stockCursor;
|
||||
|
||||
@@ -81,7 +81,7 @@ GAL::GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions ) :
|
||||
SetCursorEnabled( false );
|
||||
|
||||
// Initialize the native widget to an arrow cursor
|
||||
SetNativeCursorStyle( KICURSOR::ARROW, false );
|
||||
SetNativeCursorStyle( KICURSOR::ARROW );
|
||||
|
||||
// Initialize text properties
|
||||
ResetTextAttributes();
|
||||
@@ -277,7 +277,7 @@ void GAL::BitmapText( const wxString& aText, const VECTOR2I& aPosition, const ED
|
||||
}
|
||||
|
||||
|
||||
bool GAL::SetNativeCursorStyle( KICURSOR aCursor, bool aHiDPI )
|
||||
bool GAL::SetNativeCursorStyle( KICURSOR aCursor )
|
||||
{
|
||||
if( m_currentNativeCursor == aCursor )
|
||||
return false;
|
||||
|
||||
@@ -34,7 +34,8 @@ HIDPI_GL_CANVAS::HIDPI_GL_CANVAS( const KIGFX::VC_SETTINGS& aSettings, wxWindow*
|
||||
const wxPoint& aPos, const wxSize& aSize, long aStyle,
|
||||
const wxString& aName, const wxPalette& aPalette ) :
|
||||
wxGLCanvas( aParent, aId, aAttribList, aPos, aSize, aStyle, aName, aPalette ),
|
||||
m_settings( aSettings )
|
||||
m_settings( aSettings ),
|
||||
m_scale_factor( DPI_SCALING::GetDefaultScaleFactor() )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -63,7 +64,13 @@ wxPoint HIDPI_GL_CANVAS::GetNativePosition( const wxPoint& aPoint ) const
|
||||
}
|
||||
|
||||
|
||||
void HIDPI_GL_CANVAS::SetScaleFactor( double aNewScaleFactor )
|
||||
{
|
||||
m_scale_factor = aNewScaleFactor;
|
||||
}
|
||||
|
||||
|
||||
double HIDPI_GL_CANVAS::GetScaleFactor() const
|
||||
{
|
||||
return GetContentScaleFactor();
|
||||
return m_scale_factor;
|
||||
}
|
||||
@@ -185,11 +185,7 @@ void ANTIALIASING_SUPERSAMPLING::Present()
|
||||
glBindTexture( GL_TEXTURE_2D, compositor->GetBufferTexture( ssaaMainBuffer ) );
|
||||
compositor->SetBuffer( OPENGL_COMPOSITOR::DIRECT_RENDERING );
|
||||
|
||||
glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE );
|
||||
|
||||
draw_fullscreen_primitive();
|
||||
|
||||
glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
|
||||
}
|
||||
|
||||
|
||||
@@ -551,11 +547,7 @@ void ANTIALIASING_SMAA::Present()
|
||||
glActiveTexture( GL_TEXTURE1 );
|
||||
glBindTexture( GL_TEXTURE_2D, blendTex );
|
||||
|
||||
glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE );
|
||||
|
||||
pass_3_shader->Use();
|
||||
draw_fullscreen_triangle();
|
||||
pass_3_shader->Deactivate();
|
||||
|
||||
glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ void OPENGL_COMPOSITOR::ClearBuffer( const COLOR4D& aColor )
|
||||
{
|
||||
wxASSERT( m_initialized );
|
||||
|
||||
glClearColor( aColor.r, aColor.g, aColor.b, m_curFbo == DIRECT_RENDERING ? 1.0f : 0.0f );
|
||||
glClearColor( aColor.r, aColor.g, aColor.b, 0.0f );
|
||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 Torsten Hueter, torstenhtr <at> gmx.de
|
||||
* Copyright (C) 2012-2024 Kicad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2012-2023 Kicad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2013-2017 CERN
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
@@ -33,7 +33,6 @@
|
||||
#endif
|
||||
|
||||
#include <advanced_config.h>
|
||||
#include <build_version.h>
|
||||
#include <gal/opengl/opengl_gal.h>
|
||||
#include <gal/opengl/utils.h>
|
||||
#include <gal/definitions.h>
|
||||
@@ -255,8 +254,7 @@ GLuint GL_BITMAP_CACHE::cacheBitmap( const BITMAP_BASE* aBitmap )
|
||||
bmp.accessTime = currentTime;
|
||||
|
||||
#ifndef DISABLE_BITMAP_CACHE
|
||||
if( ( m_cacheLru.size() + 1 > m_cacheMaxElements || m_cacheSize + bmp.size > m_cacheMaxSize )
|
||||
&& !m_cacheLru.empty() )
|
||||
if( m_cacheLru.size() + 1 > m_cacheMaxElements || m_cacheSize + bmp.size > m_cacheMaxSize )
|
||||
{
|
||||
KIID toRemove( 0 );
|
||||
auto toRemoveLru = m_cacheLru.end();
|
||||
@@ -508,6 +506,13 @@ bool OPENGL_GAL::updatedGalDisplayOptions( const GAL_DISPLAY_OPTIONS& aOptions )
|
||||
refresh = true;
|
||||
}
|
||||
|
||||
if( m_options.m_scaleFactor != GetScaleFactor() )
|
||||
{
|
||||
SetScaleFactor( m_options.m_scaleFactor );
|
||||
m_gridLineWidth = m_options.m_scaleFactor * ( m_options.m_gridLineWidth + 0.25 );
|
||||
refresh = true;
|
||||
}
|
||||
|
||||
if( super::updatedGalDisplayOptions( aOptions ) || refresh )
|
||||
{
|
||||
Refresh();
|
||||
@@ -1000,20 +1005,11 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius,
|
||||
|
||||
VECTOR2D p( cos( startAngle ) * aRadius, sin( startAngle ) * aRadius );
|
||||
double alpha;
|
||||
unsigned int lineCount = 0;
|
||||
|
||||
for( alpha = startAngle + alphaIncrement; alpha <= endAngle; alpha += alphaIncrement )
|
||||
lineCount++;
|
||||
|
||||
if( alpha != endAngle )
|
||||
lineCount++;
|
||||
|
||||
reserveLineQuads( lineCount );
|
||||
|
||||
for( alpha = startAngle + alphaIncrement; alpha <= endAngle; alpha += alphaIncrement )
|
||||
{
|
||||
VECTOR2D p_next( cos( alpha ) * aRadius, sin( alpha ) * aRadius );
|
||||
drawLineQuad( p, p_next, false );
|
||||
DrawLine( p, p_next );
|
||||
|
||||
p = p_next;
|
||||
}
|
||||
@@ -1022,7 +1018,7 @@ void OPENGL_GAL::DrawArc( const VECTOR2D& aCenterPoint, double aRadius,
|
||||
if( alpha != endAngle )
|
||||
{
|
||||
VECTOR2D p_last( cos( endAngle ) * aRadius, sin( endAngle ) * aRadius );
|
||||
drawLineQuad( p, p_last, false );
|
||||
DrawLine( p, p_last );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1062,21 +1058,9 @@ void OPENGL_GAL::DrawArcSegment( const VECTOR2D& aCenterPoint, double aRadius,
|
||||
if( seg_count % 2 != 0 )
|
||||
seg_count += 1;
|
||||
|
||||
// Our shaders have trouble rendering null line quads, so delegate this task to DrawSegment.
|
||||
if( seg_count == 0 )
|
||||
{
|
||||
VECTOR2D p_start( aCenterPoint.x + cos( startAngle ) * aRadius,
|
||||
aCenterPoint.y + sin( startAngle ) * aRadius );
|
||||
|
||||
VECTOR2D p_end( aCenterPoint.x + cos( endAngle ) * aRadius,
|
||||
aCenterPoint.y + sin( endAngle ) * aRadius );
|
||||
|
||||
DrawSegment( p_start, p_end, aWidth );
|
||||
return;
|
||||
}
|
||||
|
||||
// Recalculate alphaIncrement with a even integer number of segment
|
||||
alphaIncrement = ( endAngle - startAngle ) / seg_count;
|
||||
if( seg_count )
|
||||
alphaIncrement = ( endAngle - startAngle ) / seg_count;
|
||||
|
||||
Save();
|
||||
m_currentManager->Translate( aCenterPoint.x, aCenterPoint.y, 0.0 );
|
||||
@@ -2128,16 +2112,13 @@ void OPENGL_GAL::EndDiffLayer()
|
||||
}
|
||||
|
||||
|
||||
bool OPENGL_GAL::SetNativeCursorStyle( KICURSOR aCursor, bool aHiDPI )
|
||||
bool OPENGL_GAL::SetNativeCursorStyle( KICURSOR aCursor )
|
||||
{
|
||||
// Store the current cursor type and get the wxCursor for it
|
||||
if( !GAL::SetNativeCursorStyle( aCursor, aHiDPI ) )
|
||||
if( !GAL::SetNativeCursorStyle( aCursor ) )
|
||||
return false;
|
||||
|
||||
if( aHiDPI )
|
||||
m_currentwxCursor = CURSOR_STORE::GetHiDPICursor( m_currentNativeCursor );
|
||||
else
|
||||
m_currentwxCursor = CURSOR_STORE::GetCursor( m_currentNativeCursor );
|
||||
m_currentwxCursor = CURSOR_STORE::GetCursor( m_currentNativeCursor );
|
||||
|
||||
// Update the cursor in the wx control
|
||||
HIDPI_GL_CANVAS::SetCursor( m_currentwxCursor );
|
||||
@@ -2676,9 +2657,6 @@ void OPENGL_GAL::init()
|
||||
|
||||
#endif // KICAD_USE_EGL
|
||||
|
||||
SetOpenGLInfo( (const char*) glGetString( GL_VENDOR ), (const char*) glGetString( GL_RENDERER ),
|
||||
(const char*) glGetString( GL_VERSION ) );
|
||||
|
||||
if( GLEW_OK != err )
|
||||
throw std::runtime_error( (const char*) glewGetErrorString( err ) );
|
||||
|
||||
@@ -2913,9 +2891,30 @@ void OPENGL_GAL::DrawGlyphs( const std::vector<std::unique_ptr<KIFONT::GLYPH>>&
|
||||
}
|
||||
else if( allGlyphsAreOutline )
|
||||
{
|
||||
// Optimized path for outline fonts that pre-reserves glyph triangles.
|
||||
// Optimized path for stroke fonts that pre-reserves glyph triangles.
|
||||
int triangleCount = 0;
|
||||
|
||||
if( aGlyphs.size() > 0 )
|
||||
{
|
||||
thread_pool& tp = GetKiCadThreadPool();
|
||||
|
||||
tp.push_loop( aGlyphs.size(),
|
||||
[&]( const int a, const int b)
|
||||
{
|
||||
for( int ii = a; ii < b; ++ii )
|
||||
{
|
||||
auto glyph = static_cast<KIFONT::OUTLINE_GLYPH*>( aGlyphs.at( ii ).get() );
|
||||
|
||||
// Only call CacheTriangulation() if it has never been done before.
|
||||
// Otherwise we'll hash the triangulation to see if it has been edited,
|
||||
// and all our glpyh editing ops update the triangulation anyway.
|
||||
if( glyph->TriangulatedPolyCount() == 0 )
|
||||
glyph->CacheTriangulation( false );
|
||||
}
|
||||
} );
|
||||
tp.wait_for_tasks();
|
||||
}
|
||||
|
||||
for( const std::unique_ptr<KIFONT::GLYPH>& glyph : aGlyphs )
|
||||
{
|
||||
const auto& outlineGlyph = static_cast<const KIFONT::OUTLINE_GLYPH&>( *glyph );
|
||||
|
||||
@@ -444,7 +444,7 @@ void GRID_TRICKS::doPopupSelection( wxCommandEvent& event )
|
||||
break;
|
||||
|
||||
default:
|
||||
if( menu_id >= GRIDTRICKS_FIRST_SHOWHIDE && m_grid->CommitPendingChanges( false ) )
|
||||
if( menu_id >= GRIDTRICKS_FIRST_SHOWHIDE )
|
||||
{
|
||||
int col = menu_id - GRIDTRICKS_FIRST_SHOWHIDE;
|
||||
|
||||
|
||||
@@ -32,18 +32,14 @@
|
||||
class PSEUDO_ACTION : public TOOL_ACTION
|
||||
{
|
||||
public:
|
||||
PSEUDO_ACTION( const wxString& aLabel, int aHotKey, int aHotKeyAlt = 0 )
|
||||
PSEUDO_ACTION( const wxString& aLabel, int aHotKey )
|
||||
{
|
||||
m_friendlyName = aLabel;
|
||||
m_hotKey = aHotKey;
|
||||
m_hotKeyAlt = aHotKeyAlt;
|
||||
}
|
||||
};
|
||||
|
||||
static PSEUDO_ACTION* g_gesturePseudoActions[] = {
|
||||
new PSEUDO_ACTION( _( "Accept Autocomplete" ), WXK_RETURN, WXK_NUMPAD_ENTER ),
|
||||
new PSEUDO_ACTION( _( "Cancel Autocomplete" ), WXK_ESCAPE ),
|
||||
new PSEUDO_ACTION( _( "Toggle Checkbox" ), WXK_SPACE ),
|
||||
new PSEUDO_ACTION( _( "Pan Left/Right" ), MD_CTRL + PSEUDO_WXK_WHEEL ),
|
||||
new PSEUDO_ACTION( _( "Pan Up/Down" ), MD_SHIFT + PSEUDO_WXK_WHEEL ),
|
||||
new PSEUDO_ACTION( _( "Finish Drawing" ), PSEUDO_WXK_DBLCLICK ),
|
||||
|
||||
+63
-64
@@ -63,80 +63,79 @@ struct hotkey_name_descr
|
||||
#define KEY_NON_FOUND -1
|
||||
static struct hotkey_name_descr hotkeyNameList[] =
|
||||
{
|
||||
{ wxT( "F1" ), WXK_F1 },
|
||||
{ wxT( "F2" ), WXK_F2 },
|
||||
{ wxT( "F3" ), WXK_F3 },
|
||||
{ wxT( "F4" ), WXK_F4 },
|
||||
{ wxT( "F5" ), WXK_F5 },
|
||||
{ wxT( "F6" ), WXK_F6 },
|
||||
{ wxT( "F7" ), WXK_F7 },
|
||||
{ wxT( "F8" ), WXK_F8 },
|
||||
{ wxT( "F9" ), WXK_F9 },
|
||||
{ wxT( "F10" ), WXK_F10 },
|
||||
{ wxT( "F11" ), WXK_F11 },
|
||||
{ wxT( "F12" ), WXK_F12 },
|
||||
{ wxT( "F13" ), WXK_F13 },
|
||||
{ wxT( "F14" ), WXK_F14 },
|
||||
{ wxT( "F15" ), WXK_F15 },
|
||||
{ wxT( "F16" ), WXK_F16 },
|
||||
{ wxT( "F17" ), WXK_F17 },
|
||||
{ wxT( "F18" ), WXK_F18 },
|
||||
{ wxT( "F19" ), WXK_F19 },
|
||||
{ wxT( "F20" ), WXK_F20 },
|
||||
{ wxT( "F21" ), WXK_F21 },
|
||||
{ wxT( "F22" ), WXK_F22 },
|
||||
{ wxT( "F23" ), WXK_F23 },
|
||||
{ wxT( "F24" ), WXK_F24 },
|
||||
{ wxT( "F1" ), WXK_F1 },
|
||||
{ wxT( "F2" ), WXK_F2 },
|
||||
{ wxT( "F3" ), WXK_F3 },
|
||||
{ wxT( "F4" ), WXK_F4 },
|
||||
{ wxT( "F5" ), WXK_F5 },
|
||||
{ wxT( "F6" ), WXK_F6 },
|
||||
{ wxT( "F7" ), WXK_F7 },
|
||||
{ wxT( "F8" ), WXK_F8 },
|
||||
{ wxT( "F9" ), WXK_F9 },
|
||||
{ wxT( "F10" ), WXK_F10 },
|
||||
{ wxT( "F11" ), WXK_F11 },
|
||||
{ wxT( "F12" ), WXK_F12 },
|
||||
{ wxT( "F13" ), WXK_F13 },
|
||||
{ wxT( "F14" ), WXK_F14 },
|
||||
{ wxT( "F15" ), WXK_F15 },
|
||||
{ wxT( "F16" ), WXK_F16 },
|
||||
{ wxT( "F17" ), WXK_F17 },
|
||||
{ wxT( "F18" ), WXK_F18 },
|
||||
{ wxT( "F19" ), WXK_F19 },
|
||||
{ wxT( "F20" ), WXK_F20 },
|
||||
{ wxT( "F21" ), WXK_F21 },
|
||||
{ wxT( "F22" ), WXK_F22 },
|
||||
{ wxT( "F23" ), WXK_F23 },
|
||||
{ wxT( "F24" ), WXK_F24 },
|
||||
|
||||
{ wxT( "Esc" ), WXK_ESCAPE },
|
||||
{ wxT( "Del" ), WXK_DELETE },
|
||||
{ wxT( "Tab" ), WXK_TAB },
|
||||
{ wxT( "Back" ), WXK_BACK },
|
||||
{ wxT( "Ins" ), WXK_INSERT },
|
||||
{ wxT( "Esc" ), WXK_ESCAPE },
|
||||
{ wxT( "Del" ), WXK_DELETE },
|
||||
{ wxT( "Tab" ), WXK_TAB },
|
||||
{ wxT( "Back" ), WXK_BACK },
|
||||
{ wxT( "Ins" ), WXK_INSERT },
|
||||
|
||||
{ wxT( "Home" ), WXK_HOME },
|
||||
{ wxT( "End" ), WXK_END },
|
||||
{ wxT( "PgUp" ), WXK_PAGEUP },
|
||||
{ wxT( "PgDn" ), WXK_PAGEDOWN },
|
||||
{ wxT( "Home" ), WXK_HOME },
|
||||
{ wxT( "End" ), WXK_END },
|
||||
{ wxT( "PgUp" ), WXK_PAGEUP },
|
||||
{ wxT( "PgDn" ), WXK_PAGEDOWN },
|
||||
|
||||
{ wxT( "Up" ), WXK_UP },
|
||||
{ wxT( "Down" ), WXK_DOWN },
|
||||
{ wxT( "Left" ), WXK_LEFT },
|
||||
{ wxT( "Right" ), WXK_RIGHT },
|
||||
{ wxT( "Up" ), WXK_UP },
|
||||
{ wxT( "Down" ), WXK_DOWN },
|
||||
{ wxT( "Left" ), WXK_LEFT },
|
||||
{ wxT( "Right" ), WXK_RIGHT },
|
||||
|
||||
{ wxT( "Return" ), WXK_RETURN },
|
||||
{ wxT( "Return" ), WXK_RETURN },
|
||||
|
||||
{ wxT( "Space" ), WXK_SPACE },
|
||||
{ wxT( "Space" ), WXK_SPACE },
|
||||
|
||||
{ wxT( "Num Pad 0" ), WXK_NUMPAD0 },
|
||||
{ wxT( "Num Pad 1" ), WXK_NUMPAD1 },
|
||||
{ wxT( "Num Pad 2" ), WXK_NUMPAD2 },
|
||||
{ wxT( "Num Pad 3" ), WXK_NUMPAD3 },
|
||||
{ wxT( "Num Pad 4" ), WXK_NUMPAD4 },
|
||||
{ wxT( "Num Pad 5" ), WXK_NUMPAD5 },
|
||||
{ wxT( "Num Pad 6" ), WXK_NUMPAD6 },
|
||||
{ wxT( "Num Pad 7" ), WXK_NUMPAD7 },
|
||||
{ wxT( "Num Pad 8" ), WXK_NUMPAD8 },
|
||||
{ wxT( "Num Pad 9" ), WXK_NUMPAD9 },
|
||||
{ wxT( "Num Pad +" ), WXK_NUMPAD_ADD },
|
||||
{ wxT( "Num Pad -" ), WXK_NUMPAD_SUBTRACT },
|
||||
{ wxT( "Num Pad *" ), WXK_NUMPAD_MULTIPLY },
|
||||
{ wxT( "Num Pad /" ), WXK_NUMPAD_DIVIDE },
|
||||
{ wxT( "Num Pad ." ), WXK_NUMPAD_SEPARATOR },
|
||||
{ wxT( "Num Pad Enter" ), WXK_NUMPAD_ENTER },
|
||||
{ wxT( "Num Pad F1"), WXK_NUMPAD_F1 },
|
||||
{ wxT( "Num Pad F2"), WXK_NUMPAD_F2 },
|
||||
{ wxT( "Num Pad F3"), WXK_NUMPAD_F3 },
|
||||
{ wxT( "Num Pad F4"), WXK_NUMPAD_F4 },
|
||||
{ wxT( "Num Pad 0" ), WXK_NUMPAD0 },
|
||||
{ wxT( "Num Pad 1" ), WXK_NUMPAD1 },
|
||||
{ wxT( "Num Pad 2" ), WXK_NUMPAD2 },
|
||||
{ wxT( "Num Pad 3" ), WXK_NUMPAD3 },
|
||||
{ wxT( "Num Pad 4" ), WXK_NUMPAD4 },
|
||||
{ wxT( "Num Pad 5" ), WXK_NUMPAD5 },
|
||||
{ wxT( "Num Pad 6" ), WXK_NUMPAD6 },
|
||||
{ wxT( "Num Pad 7" ), WXK_NUMPAD7 },
|
||||
{ wxT( "Num Pad 8" ), WXK_NUMPAD8 },
|
||||
{ wxT( "Num Pad 9" ), WXK_NUMPAD9 },
|
||||
{ wxT( "Num Pad +" ), WXK_NUMPAD_ADD },
|
||||
{ wxT( "Num Pad -" ), WXK_NUMPAD_SUBTRACT },
|
||||
{ wxT( "Num Pad *" ), WXK_NUMPAD_MULTIPLY },
|
||||
{ wxT( "Num Pad /" ), WXK_NUMPAD_DIVIDE },
|
||||
{ wxT( "Num Pad ." ), WXK_NUMPAD_SEPARATOR },
|
||||
{ wxT( "Num Pad F1"), WXK_NUMPAD_F1 },
|
||||
{ wxT( "Num Pad F2"), WXK_NUMPAD_F2 },
|
||||
{ wxT( "Num Pad F3"), WXK_NUMPAD_F3 },
|
||||
{ wxT( "Num Pad F4"), WXK_NUMPAD_F4 },
|
||||
|
||||
{ wxT( "" ), 0 },
|
||||
{ wxT( "" ), 0 },
|
||||
|
||||
{ wxT( "Click" ), PSEUDO_WXK_CLICK },
|
||||
{ wxT( "DblClick" ), PSEUDO_WXK_DBLCLICK },
|
||||
{ wxT( "Wheel" ), PSEUDO_WXK_WHEEL },
|
||||
{ wxT( "Click" ), PSEUDO_WXK_CLICK },
|
||||
{ wxT( "DblClick" ), PSEUDO_WXK_DBLCLICK },
|
||||
{ wxT( "Wheel" ), PSEUDO_WXK_WHEEL },
|
||||
|
||||
// Do not change this line: end of list
|
||||
{ wxT( "" ), KEY_NON_FOUND }
|
||||
{ wxT( "" ), KEY_NON_FOUND }
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -642,6 +642,10 @@ void DXF_IMPORT_PLUGIN::addEllipse( const DL_EllipseData& aData )
|
||||
if( startAngle > endAngle )
|
||||
endAngle += ANGLE_360;
|
||||
|
||||
// Angles are relative to major axis
|
||||
startAngle -= EDA_ANGLE( major );
|
||||
endAngle -= EDA_ANGLE( major );
|
||||
|
||||
if( aData.ratio == 1.0 )
|
||||
{
|
||||
double radius = major.EuclideanNorm();
|
||||
@@ -654,10 +658,6 @@ void DXF_IMPORT_PLUGIN::addEllipse( const DL_EllipseData& aData )
|
||||
}
|
||||
else
|
||||
{
|
||||
// Angles are relative to major axis
|
||||
startAngle -= EDA_ANGLE( major );
|
||||
endAngle -= EDA_ANGLE( major );
|
||||
|
||||
DL_ArcData arc( aData.cx, aData.cy, aData.cz, radius, startAngle.AsDegrees(),
|
||||
endAngle.AsDegrees() );
|
||||
addArc( arc );
|
||||
|
||||
@@ -261,7 +261,7 @@ void SVG_IMPORT_PLUGIN::DrawPath( const float* aPoints, int aNumPoints, bool aCl
|
||||
if( aNumPoints > 0 )
|
||||
DrawCubicBezierPath( aPoints, aNumPoints, collectedPathPoints );
|
||||
|
||||
if( aClosedPath && collectedPathPoints.size() > 2 )
|
||||
if( aClosedPath )
|
||||
DrawPolygon( collectedPathPoints, aStroke, aFilled, aFillColor );
|
||||
else
|
||||
DrawLineSegments( collectedPathPoints, aStroke );
|
||||
|
||||
@@ -1,134 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2019-2020 Thomas Pointhuber <thomas.pointhuber@gmx.at>
|
||||
* Copyright (C) 2020-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "altium_ascii_parser.h"
|
||||
#include "altium_parser_utils.h"
|
||||
|
||||
|
||||
ALTIUM_ASCII_PARSER::ALTIUM_ASCII_PARSER( const wxString& aInputFile ) :
|
||||
m_fileInput( aInputFile.fn_str() )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
std::map<wxString, wxString> ALTIUM_ASCII_PARSER::ReadProperties()
|
||||
{
|
||||
std::map<wxString, wxString> kv;
|
||||
std::string str;
|
||||
std::string line;
|
||||
|
||||
// Lines ending with |> continue on the next line
|
||||
do
|
||||
{
|
||||
if( !std::getline( m_fileInput, line ) )
|
||||
{
|
||||
m_error = true;
|
||||
return kv;
|
||||
}
|
||||
|
||||
if( ( line.size() > 2 && line[line.size() - 2] == '|' && line[line.size() - 1] == '>' ) )
|
||||
{
|
||||
str.append( line, 0, line.size() - 2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
str.append( line );
|
||||
break;
|
||||
}
|
||||
} while( true );
|
||||
|
||||
std::size_t token_end = 0;
|
||||
|
||||
while( token_end < str.size() && token_end != std::string::npos )
|
||||
{
|
||||
std::size_t token_start = str.find( '|', token_end );
|
||||
std::size_t token_equal = str.find( '=', token_end );
|
||||
std::size_t key_start;
|
||||
|
||||
if( token_start <= token_equal )
|
||||
{
|
||||
key_start = token_start + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Leading "|" before "RECORD=28" may be missing in older schematic versions.
|
||||
key_start = token_end;
|
||||
}
|
||||
|
||||
token_end = str.find( '|', key_start );
|
||||
|
||||
if( token_equal >= token_end )
|
||||
{
|
||||
continue; // this looks like an error: skip the entry. Also matches on std::string::npos
|
||||
}
|
||||
|
||||
if( token_end == std::string::npos )
|
||||
{
|
||||
token_end = str.size() + 1; // this is the correct offset
|
||||
}
|
||||
|
||||
std::string keyS = str.substr( key_start, token_equal - key_start );
|
||||
std::string valueS = str.substr( token_equal + 1, token_end - token_equal - 1 );
|
||||
|
||||
// convert the strings to wxStrings, since we use them everywhere
|
||||
// value can have non-ASCII characters, so we convert them from LATIN1/ISO8859-1
|
||||
wxString key( keyS.c_str(), wxConvISO8859_1 );
|
||||
// Altium stores keys either in Upper, or in CamelCase. Lets unify it.
|
||||
wxString canonicalKey = key.Trim( false ).Trim( true ).MakeUpper();
|
||||
// If the key starts with '%UTF8%' we have to parse the value using UTF8
|
||||
wxString value;
|
||||
|
||||
if( canonicalKey.StartsWith( "%UTF8%" ) )
|
||||
value = wxString( valueS.c_str(), wxConvUTF8 );
|
||||
else
|
||||
value = wxString( valueS.c_str(), wxConvISO8859_1 );
|
||||
|
||||
if( canonicalKey != wxS( "PATTERN" ) && canonicalKey != wxS( "SOURCEFOOTPRINTLIBRARY" ) )
|
||||
{
|
||||
// Breathless hack because I haven't a clue what the story is here (but this character
|
||||
// appears in a lot of radial dimensions and is rendered by Altium as a space).
|
||||
value.Replace( wxT( "ÿ" ), wxT( " " ) );
|
||||
}
|
||||
|
||||
// Storage binary data do not need conversion.
|
||||
if( str.rfind( "|BINARY", 0 ) != 0 )
|
||||
{
|
||||
if( canonicalKey == wxT( "DESIGNATOR" ) || canonicalKey == wxT( "NAME" )
|
||||
|| canonicalKey == wxT( "TEXT" ) )
|
||||
{
|
||||
value = AltiumPropertyToKiCadString( value );
|
||||
}
|
||||
}
|
||||
|
||||
kv.insert( { canonicalKey, value.Trim() } );
|
||||
}
|
||||
|
||||
return kv;
|
||||
}
|
||||
|
||||
|
||||
bool ALTIUM_ASCII_PARSER::CanRead()
|
||||
{
|
||||
return m_fileInput && m_fileInput.peek() != std::ifstream::traits_type::eof();
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2019-2020 Thomas Pointhuber <thomas.pointhuber@gmx.at>
|
||||
* Copyright (C) 2020-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef _ALTIUM_PARSER_H
|
||||
#define _ALTIUM_PARSER_H
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
|
||||
#include <wx/string.h>
|
||||
|
||||
|
||||
class ALTIUM_ASCII_PARSER
|
||||
{
|
||||
public:
|
||||
ALTIUM_ASCII_PARSER( const wxString& aInputFile );
|
||||
|
||||
std::map<wxString, wxString> ReadProperties();
|
||||
|
||||
bool CanRead();
|
||||
|
||||
bool HasParsingError()
|
||||
{
|
||||
return m_error;
|
||||
}
|
||||
|
||||
private:
|
||||
std::ifstream m_fileInput;
|
||||
bool m_error = false;
|
||||
};
|
||||
|
||||
#endif //_ALTIUM_PARSER_H
|
||||
@@ -22,7 +22,7 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "altium_binary_parser.h"
|
||||
#include "altium_parser.h"
|
||||
#include "altium_parser_utils.h"
|
||||
|
||||
#include <compoundfilereader.h>
|
||||
@@ -350,13 +350,13 @@ void ALTIUM_COMPOUND_FILE::cacheLibFootprintNames()
|
||||
|
||||
if( m_reader->IsStream( entry ) && fileName == L"Parameters" )
|
||||
{
|
||||
ALTIUM_BINARY_PARSER parametersReader( *this, entry );
|
||||
ALTIUM_PARSER parametersReader( *this, entry );
|
||||
std::map<wxString, wxString> parameterProperties =
|
||||
parametersReader.ReadProperties();
|
||||
|
||||
wxString key = ALTIUM_PROPS_UTILS::ReadString(
|
||||
wxString key = ALTIUM_PARSER::ReadString(
|
||||
parameterProperties, wxT( "PATTERN" ), wxT( "" ) );
|
||||
wxString fpName = ALTIUM_PROPS_UTILS::ReadUnicodeString(
|
||||
wxString fpName = ALTIUM_PARSER::ReadUnicodeString(
|
||||
parameterProperties, wxT( "PATTERN" ), wxT( "" ) );
|
||||
|
||||
m_libFootprintDirNameCache[key] = fpName;
|
||||
@@ -370,7 +370,7 @@ void ALTIUM_COMPOUND_FILE::cacheLibFootprintNames()
|
||||
}
|
||||
|
||||
|
||||
ALTIUM_BINARY_PARSER::ALTIUM_BINARY_PARSER( const ALTIUM_COMPOUND_FILE& aFile,
|
||||
ALTIUM_PARSER::ALTIUM_PARSER( const ALTIUM_COMPOUND_FILE& aFile,
|
||||
const CFB::COMPOUND_FILE_ENTRY* aEntry )
|
||||
{
|
||||
m_subrecord_end = nullptr;
|
||||
@@ -384,7 +384,7 @@ ALTIUM_BINARY_PARSER::ALTIUM_BINARY_PARSER( const ALTIUM_COMPOUND_FILE& aFil
|
||||
}
|
||||
|
||||
|
||||
ALTIUM_BINARY_PARSER::ALTIUM_BINARY_PARSER( std::unique_ptr<char[]>& aContent, size_t aSize )
|
||||
ALTIUM_PARSER::ALTIUM_PARSER( std::unique_ptr<char[]>& aContent, size_t aSize )
|
||||
{
|
||||
m_subrecord_end = nullptr;
|
||||
m_size = aSize;
|
||||
@@ -394,7 +394,7 @@ ALTIUM_BINARY_PARSER::ALTIUM_BINARY_PARSER( std::unique_ptr<char[]>& aContent, s
|
||||
}
|
||||
|
||||
|
||||
std::map<wxString, wxString> ALTIUM_BINARY_PARSER::ReadProperties(
|
||||
std::map<wxString, wxString> ALTIUM_PARSER::ReadProperties(
|
||||
std::function<std::map<wxString, wxString>( const std::string& )> handleBinaryData )
|
||||
{
|
||||
|
||||
@@ -502,3 +502,123 @@ std::map<wxString, wxString> ALTIUM_BINARY_PARSER::ReadProperties(
|
||||
return kv;
|
||||
}
|
||||
|
||||
|
||||
int32_t ALTIUM_PARSER::ConvertToKicadUnit( const double aValue )
|
||||
{
|
||||
constexpr double int_limit = ( std::numeric_limits<int>::max() - 10 ) / 2.54;
|
||||
|
||||
int32_t iu = KiROUND( Clamp<double>( -int_limit, aValue, int_limit ) * 2.54 );
|
||||
|
||||
// Altium's internal precision is 0.1uinch. KiCad's is 1nm. Round to nearest 10nm to clean
|
||||
// up most rounding errors. This allows lossless conversion of increments of 0.05mils and
|
||||
// 0.01um.
|
||||
return KiROUND( (double) iu / 10.0 ) * 10;
|
||||
}
|
||||
|
||||
|
||||
int ALTIUM_PARSER::ReadInt( const std::map<wxString, wxString>& aProps, const wxString& aKey,
|
||||
int aDefault )
|
||||
{
|
||||
const std::map<wxString, wxString>::const_iterator& value = aProps.find( aKey );
|
||||
return value == aProps.end() ? aDefault : wxAtoi( value->second );
|
||||
}
|
||||
|
||||
|
||||
double ALTIUM_PARSER::ReadDouble( const std::map<wxString, wxString>& aProps, const wxString& aKey,
|
||||
double aDefault )
|
||||
{
|
||||
const std::map<wxString, wxString>::const_iterator& value = aProps.find( aKey );
|
||||
|
||||
if( value == aProps.end() )
|
||||
return aDefault;
|
||||
|
||||
// Locale independent str -> double conversation
|
||||
std::istringstream istr( (const char*) value->second.mb_str() );
|
||||
istr.imbue( std::locale::classic() );
|
||||
|
||||
double doubleValue;
|
||||
istr >> doubleValue;
|
||||
return doubleValue;
|
||||
}
|
||||
|
||||
|
||||
bool ALTIUM_PARSER::ReadBool( const std::map<wxString, wxString>& aProps, const wxString& aKey,
|
||||
bool aDefault )
|
||||
{
|
||||
const std::map<wxString, wxString>::const_iterator& value = aProps.find( aKey );
|
||||
|
||||
if( value == aProps.end() )
|
||||
return aDefault;
|
||||
else
|
||||
return value->second == "T" || value->second == "TRUE";
|
||||
}
|
||||
|
||||
|
||||
int32_t ALTIUM_PARSER::ReadKicadUnit( const std::map<wxString, wxString>& aProps,
|
||||
const wxString& aKey, const wxString& aDefault )
|
||||
{
|
||||
const wxString& value = ReadString( aProps, aKey, aDefault );
|
||||
|
||||
wxString prefix;
|
||||
|
||||
if( !value.EndsWith( "mil", &prefix ) )
|
||||
{
|
||||
wxLogError( _( "Unit '%s' does not end with 'mil'." ), value );
|
||||
return 0;
|
||||
}
|
||||
|
||||
prefix.StartsWith( "+", &prefix );
|
||||
|
||||
double mils;
|
||||
|
||||
if( !prefix.ToCDouble( &mils ) )
|
||||
{
|
||||
wxLogError( _( "Cannot convert '%s' to double." ), prefix );
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ConvertToKicadUnit( mils * 10000 );
|
||||
}
|
||||
|
||||
|
||||
wxString ALTIUM_PARSER::ReadString( const std::map<wxString, wxString>& aProps,
|
||||
const wxString& aKey, const wxString& aDefault )
|
||||
{
|
||||
const auto& utf8Value = aProps.find( wxString( "%UTF8%" ) + aKey );
|
||||
|
||||
if( utf8Value != aProps.end() )
|
||||
return utf8Value->second;
|
||||
|
||||
const auto& value = aProps.find( aKey );
|
||||
|
||||
if( value != aProps.end() )
|
||||
return value->second;
|
||||
|
||||
return aDefault;
|
||||
}
|
||||
|
||||
|
||||
wxString ALTIUM_PARSER::ReadUnicodeString( const std::map<wxString, wxString>& aProps,
|
||||
const wxString& aKey, const wxString& aDefault )
|
||||
{
|
||||
const auto& unicodeFlag = aProps.find( wxS( "UNICODE" ) );
|
||||
|
||||
if( unicodeFlag != aProps.end() && unicodeFlag->second.Contains( wxS( "EXISTS" ) ) )
|
||||
{
|
||||
const auto& unicodeValue = aProps.find( wxString( "UNICODE__" ) + aKey );
|
||||
|
||||
if( unicodeValue != aProps.end() )
|
||||
{
|
||||
wxArrayString arr = wxSplit( unicodeValue->second, ',', '\0' );
|
||||
wxString out;
|
||||
|
||||
for( wxString part : arr )
|
||||
out += wxString( wchar_t( wxAtoi( part ) ) );
|
||||
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
return ReadString( aProps, aKey, aDefault );
|
||||
}
|
||||
|
||||
@@ -22,10 +22,8 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef _ALTIUM_BINARY_PARSER_H
|
||||
#define _ALTIUM_BINARY_PARSER_H
|
||||
|
||||
#include "altium_props_utils.h"
|
||||
#ifndef ALTIUM_PARSER_H
|
||||
#define ALTIUM_PARSER_H
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
@@ -108,12 +106,12 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class ALTIUM_BINARY_PARSER
|
||||
class ALTIUM_PARSER
|
||||
{
|
||||
public:
|
||||
ALTIUM_BINARY_PARSER( const ALTIUM_COMPOUND_FILE& aFile, const CFB::COMPOUND_FILE_ENTRY* aEntry );
|
||||
ALTIUM_BINARY_PARSER( std::unique_ptr<char[]>& aContent, size_t aSize );
|
||||
~ALTIUM_BINARY_PARSER() = default;
|
||||
ALTIUM_PARSER( const ALTIUM_COMPOUND_FILE& aFile, const CFB::COMPOUND_FILE_ENTRY* aEntry );
|
||||
ALTIUM_PARSER( std::unique_ptr<char[]>& aContent, size_t aSize );
|
||||
~ALTIUM_PARSER() = default;
|
||||
|
||||
template <typename Type>
|
||||
Type Read()
|
||||
@@ -231,7 +229,7 @@ public:
|
||||
|
||||
int32_t ReadKicadUnit()
|
||||
{
|
||||
return ALTIUM_PROPS_UTILS::ConvertToKicadUnit( Read<int32_t>() );
|
||||
return ConvertToKicadUnit( Read<int32_t>() );
|
||||
}
|
||||
|
||||
int32_t ReadKicadUnitX()
|
||||
@@ -272,6 +270,26 @@ public:
|
||||
return std::map<wxString, wxString>();
|
||||
} );
|
||||
|
||||
static int32_t ConvertToKicadUnit( const double aValue );
|
||||
|
||||
static int ReadInt( const std::map<wxString, wxString>& aProps,
|
||||
const wxString& aKey, int aDefault );
|
||||
|
||||
static double ReadDouble( const std::map<wxString, wxString>& aProps,
|
||||
const wxString& aKey, double aDefault );
|
||||
|
||||
static bool ReadBool( const std::map<wxString, wxString>& aProps,
|
||||
const wxString& aKey, bool aDefault );
|
||||
|
||||
static int32_t ReadKicadUnit( const std::map<wxString, wxString>& aProps,
|
||||
const wxString& aKey, const wxString& aDefault );
|
||||
|
||||
static wxString ReadString( const std::map<wxString, wxString>& aProps,
|
||||
const wxString& aKey, const wxString& aDefault );
|
||||
|
||||
static wxString ReadUnicodeString( const std::map<wxString, wxString>& aProps,
|
||||
const wxString& aKey, const wxString& aDefault );
|
||||
|
||||
void Skip( size_t aLength )
|
||||
{
|
||||
if( GetRemainingBytes() >= aLength )
|
||||
@@ -429,4 +447,4 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
#endif //_ALTIUM_BINARY_PARSER_H
|
||||
#endif //ALTIUM_PARSER_H
|
||||
@@ -1,153 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2019-2020 Thomas Pointhuber <thomas.pointhuber@gmx.at>
|
||||
* Copyright (C) 2020-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "altium_props_utils.h"
|
||||
|
||||
#include <limits>
|
||||
#include <sstream>
|
||||
#include <math/util.h>
|
||||
|
||||
#include <wx/crt.h>
|
||||
#include <wx/log.h>
|
||||
#include <wx/translation.h>
|
||||
|
||||
|
||||
int32_t ALTIUM_PROPS_UTILS::ConvertToKicadUnit( const double aValue )
|
||||
{
|
||||
constexpr double int_limit = ( std::numeric_limits<int>::max() - 10 ) / 2.54;
|
||||
|
||||
int32_t iu = KiROUND( Clamp<double>( -int_limit, aValue, int_limit ) * 2.54 );
|
||||
|
||||
// Altium's internal precision is 0.1uinch. KiCad's is 1nm. Round to nearest 10nm to clean
|
||||
// up most rounding errors. This allows lossless conversion of increments of 0.05mils and
|
||||
// 0.01um.
|
||||
return KiROUND( (double) iu / 10.0 ) * 10;
|
||||
}
|
||||
|
||||
|
||||
int ALTIUM_PROPS_UTILS::ReadInt( const std::map<wxString, wxString>& aProps, const wxString& aKey,
|
||||
int aDefault )
|
||||
{
|
||||
const std::map<wxString, wxString>::const_iterator& value = aProps.find( aKey );
|
||||
return value == aProps.end() ? aDefault : wxAtoi( value->second );
|
||||
}
|
||||
|
||||
|
||||
double ALTIUM_PROPS_UTILS::ReadDouble( const std::map<wxString, wxString>& aProps, const wxString& aKey,
|
||||
double aDefault )
|
||||
{
|
||||
const std::map<wxString, wxString>::const_iterator& value = aProps.find( aKey );
|
||||
|
||||
if( value == aProps.end() )
|
||||
return aDefault;
|
||||
|
||||
// Locale independent str -> double conversation
|
||||
std::istringstream istr( (const char*) value->second.mb_str() );
|
||||
istr.imbue( std::locale::classic() );
|
||||
|
||||
double doubleValue;
|
||||
istr >> doubleValue;
|
||||
return doubleValue;
|
||||
}
|
||||
|
||||
|
||||
bool ALTIUM_PROPS_UTILS::ReadBool( const std::map<wxString, wxString>& aProps, const wxString& aKey,
|
||||
bool aDefault )
|
||||
{
|
||||
const std::map<wxString, wxString>::const_iterator& value = aProps.find( aKey );
|
||||
|
||||
if( value == aProps.end() )
|
||||
return aDefault;
|
||||
else
|
||||
return value->second == "T" || value->second == "TRUE";
|
||||
}
|
||||
|
||||
|
||||
int32_t ALTIUM_PROPS_UTILS::ReadKicadUnit( const std::map<wxString, wxString>& aProps,
|
||||
const wxString& aKey, const wxString& aDefault )
|
||||
{
|
||||
const wxString& value = ReadString( aProps, aKey, aDefault );
|
||||
|
||||
wxString prefix;
|
||||
|
||||
if( !value.EndsWith( "mil", &prefix ) )
|
||||
{
|
||||
wxLogError( _( "Unit '%s' does not end with 'mil'." ), value );
|
||||
return 0;
|
||||
}
|
||||
|
||||
prefix.StartsWith( "+", &prefix );
|
||||
|
||||
double mils;
|
||||
|
||||
if( !prefix.ToCDouble( &mils ) )
|
||||
{
|
||||
wxLogError( _( "Cannot convert '%s' to double." ), prefix );
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ConvertToKicadUnit( mils * 10000 );
|
||||
}
|
||||
|
||||
|
||||
wxString ALTIUM_PROPS_UTILS::ReadString( const std::map<wxString, wxString>& aProps,
|
||||
const wxString& aKey, const wxString& aDefault )
|
||||
{
|
||||
const auto& utf8Value = aProps.find( wxString( "%UTF8%" ) + aKey );
|
||||
|
||||
if( utf8Value != aProps.end() )
|
||||
return utf8Value->second;
|
||||
|
||||
const auto& value = aProps.find( aKey );
|
||||
|
||||
if( value != aProps.end() )
|
||||
return value->second;
|
||||
|
||||
return aDefault;
|
||||
}
|
||||
|
||||
|
||||
wxString ALTIUM_PROPS_UTILS::ReadUnicodeString( const std::map<wxString, wxString>& aProps,
|
||||
const wxString& aKey, const wxString& aDefault )
|
||||
{
|
||||
const auto& unicodeFlag = aProps.find( wxS( "UNICODE" ) );
|
||||
|
||||
if( unicodeFlag != aProps.end() && unicodeFlag->second.Contains( wxS( "EXISTS" ) ) )
|
||||
{
|
||||
const auto& unicodeValue = aProps.find( wxString( "UNICODE__" ) + aKey );
|
||||
|
||||
if( unicodeValue != aProps.end() )
|
||||
{
|
||||
wxArrayString arr = wxSplit( unicodeValue->second, ',', '\0' );
|
||||
wxString out;
|
||||
|
||||
for( wxString part : arr )
|
||||
out += wxString( wchar_t( wxAtoi( part ) ) );
|
||||
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
return ReadString( aProps, aKey, aDefault );
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2019-2020 Thomas Pointhuber <thomas.pointhuber@gmx.at>
|
||||
* Copyright (C) 2020-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef _ALTIUM_PROPS_UTILS_H
|
||||
#define _ALTIUM_PROPS_UTILS_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <map>
|
||||
|
||||
#include <wx/string.h>
|
||||
|
||||
|
||||
class ALTIUM_PROPS_UTILS
|
||||
{
|
||||
public:
|
||||
static int32_t ConvertToKicadUnit( const double aValue );
|
||||
|
||||
static int ReadInt( const std::map<wxString, wxString>& aProps, const wxString& aKey,
|
||||
int aDefault );
|
||||
|
||||
static double ReadDouble( const std::map<wxString, wxString>& aProps, const wxString& aKey,
|
||||
double aDefault );
|
||||
|
||||
static bool ReadBool( const std::map<wxString, wxString>& aProps, const wxString& aKey,
|
||||
bool aDefault );
|
||||
|
||||
static int32_t ReadKicadUnit( const std::map<wxString, wxString>& aProps, const wxString& aKey,
|
||||
const wxString& aDefault );
|
||||
|
||||
static wxString ReadString( const std::map<wxString, wxString>& aProps, const wxString& aKey,
|
||||
const wxString& aDefault );
|
||||
|
||||
static wxString ReadUnicodeString( const std::map<wxString, wxString>& aProps,
|
||||
const wxString& aKey, const wxString& aDefault );
|
||||
};
|
||||
|
||||
#endif //_ALTIUM_PROPS_UTILS_H
|
||||
@@ -979,20 +979,13 @@ EELEMENT::EELEMENT( wxXmlNode* aElement )
|
||||
<!ATTLIST element
|
||||
name %String; #REQUIRED
|
||||
library %String; #REQUIRED
|
||||
library_urn %Urn; ""
|
||||
package %String; #REQUIRED
|
||||
package3d_urn %Urn; ""
|
||||
override_package3d_urn %Urn; ""
|
||||
override_package_urn %Urn; ""
|
||||
override_locally_modified %Bool; "no"
|
||||
value %String; #REQUIRED
|
||||
x %Coord; #REQUIRED
|
||||
y %Coord; #REQUIRED
|
||||
locked %Bool; "no"
|
||||
populate %Bool; "yes"
|
||||
smashed %Bool; "no"
|
||||
rot %Rotation; "R0"
|
||||
grouprefs IDREFS #IMPLIED
|
||||
>
|
||||
*/
|
||||
|
||||
@@ -1008,7 +1001,6 @@ EELEMENT::EELEMENT( wxXmlNode* aElement )
|
||||
y = parseRequiredAttribute<ECOORD>( aElement, "y" );
|
||||
|
||||
// optional
|
||||
library_urn = parseOptionalAttribute<wxString>( aElement, "library_urn" );
|
||||
locked = parseOptionalAttribute<bool>( aElement, "locked" );
|
||||
smashed = parseOptionalAttribute<bool>( aElement, "smashed" );
|
||||
rot = parseOptionalAttribute<EROT>( aElement, "rot" );
|
||||
|
||||
@@ -817,7 +817,6 @@ struct EELEMENT
|
||||
{
|
||||
wxString name;
|
||||
wxString library;
|
||||
opt_wxString library_urn;
|
||||
wxString package;
|
||||
wxString value;
|
||||
ECOORD x;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2023 Alex Shvartzkop <dudesuchamazing@gmail.com>
|
||||
* Copyright (C) 2023-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2023 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
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <bezier_curves.h>
|
||||
#include <ki_exception.h>
|
||||
#include <wx/translation.h>
|
||||
#include <eda_text.h>
|
||||
|
||||
|
||||
double EASYEDA_PARSER_BASE::Convert( const wxString& aValue )
|
||||
@@ -67,49 +66,6 @@ double EASYEDA_PARSER_BASE::RelPosY( const wxString& aValue )
|
||||
}
|
||||
|
||||
|
||||
void EASYEDA_PARSER_BASE::TransformTextToBaseline( EDA_TEXT* textItem,
|
||||
const wxString& baselineAlign, bool invertY )
|
||||
{
|
||||
int upOffset = 0;
|
||||
|
||||
if( baselineAlign == wxS( "" ) || baselineAlign == wxS( "auto" )
|
||||
|| baselineAlign == wxS( "use-script" ) || baselineAlign == wxS( "no-change" )
|
||||
|| baselineAlign == wxS( "reset-size" ) || baselineAlign == wxS( "alphabetic" )
|
||||
|| baselineAlign == wxS( "inherit" ) )
|
||||
{
|
||||
upOffset = textItem->GetTextSize().y;
|
||||
}
|
||||
else if( baselineAlign == wxS( "ideographic" ) || baselineAlign == wxS( "text-after-edge" ) )
|
||||
{
|
||||
upOffset = textItem->GetTextSize().y * 1.2;
|
||||
}
|
||||
else if( baselineAlign == wxS( "central" ) )
|
||||
{
|
||||
upOffset = textItem->GetTextSize().y * 0.5;
|
||||
}
|
||||
else if( baselineAlign == wxS( "middle" ) )
|
||||
{
|
||||
upOffset = textItem->GetTextSize().y * 0.6;
|
||||
}
|
||||
else if( baselineAlign == wxS( "mathematical" ) )
|
||||
{
|
||||
upOffset = textItem->GetTextSize().y * 0.1;
|
||||
}
|
||||
else if( baselineAlign == wxS( "hanging" ) || baselineAlign == wxS( "text-before-edge" ) )
|
||||
{
|
||||
upOffset = 0;
|
||||
}
|
||||
|
||||
VECTOR2I offset( 0, -upOffset );
|
||||
RotatePoint( offset, textItem->GetTextAngle() );
|
||||
|
||||
if( invertY )
|
||||
offset.y = -offset.y;
|
||||
|
||||
textItem->SetTextPos( textItem->GetTextPos() + offset );
|
||||
}
|
||||
|
||||
|
||||
std::vector<SHAPE_LINE_CHAIN>
|
||||
EASYEDA_PARSER_BASE::ParseLineChains( const wxString& data, int aArcMinSegLen, bool aForceClosed )
|
||||
{
|
||||
@@ -246,7 +202,7 @@ EASYEDA_PARSER_BASE::ParseLineChains( const wxString& data, int aArcMinSegLen, b
|
||||
arc.ConstructFromStartEndCenter( RelPos( start ), RelPos( end ), RelPos( arcCenter ),
|
||||
!cw );
|
||||
|
||||
chain.Append( arc, aArcMinSegLen );
|
||||
chain.Append( arc );
|
||||
|
||||
prevPt = end;
|
||||
}
|
||||
|
||||
@@ -29,8 +29,6 @@
|
||||
#include <math/vector2d.h>
|
||||
#include <wx/string.h>
|
||||
|
||||
class EDA_TEXT;
|
||||
|
||||
class EASYEDA_PARSER_BASE
|
||||
{
|
||||
public:
|
||||
@@ -60,9 +58,7 @@ public:
|
||||
return ScalePos( aVec - m_relOrigin );
|
||||
}
|
||||
|
||||
void TransformTextToBaseline( EDA_TEXT* textItem, const wxString& baselineAlign, bool invertY );
|
||||
|
||||
std::vector<SHAPE_LINE_CHAIN> ParseLineChains( const wxString& aData, int aArcMinSegLen,
|
||||
std::vector<SHAPE_LINE_CHAIN> ParseLineChains( const wxString& aData, int aArcMinSegLen,
|
||||
bool aForceClosed );
|
||||
|
||||
protected:
|
||||
|
||||
@@ -87,7 +87,6 @@ void EASYEDA::from_json( const nlohmann::json& j, EASYEDA::DOCUMENT& d )
|
||||
PARSE_VALUE( head );
|
||||
|
||||
PARSE_VALUE( canvas );
|
||||
PARSE_VALUE( title );
|
||||
PARSE_VALUE( shape );
|
||||
PARSE_VALUE( dataStr );
|
||||
}
|
||||
|
||||
@@ -73,10 +73,9 @@ struct DOCUMENT
|
||||
|
||||
// BBox
|
||||
// colors
|
||||
wxString canvas;
|
||||
wxString title;
|
||||
wxArrayString shape;
|
||||
std::optional<nlohmann::json> dataStr;
|
||||
wxString canvas;
|
||||
wxArrayString shape;
|
||||
std::optional<nlohmann::json> dataStr;
|
||||
};
|
||||
|
||||
struct C_PARA
|
||||
|
||||
@@ -150,28 +150,14 @@ nlohmann::json EASYEDAPRO::ReadProjectOrDeviceFile( const wxString& aZipFileName
|
||||
{
|
||||
wxString name = entry->GetName();
|
||||
|
||||
try
|
||||
if( name == wxS( "project.json" ) || name == wxS( "device.json" ) )
|
||||
{
|
||||
if( name == wxS( "project.json" ) || name == wxS( "device.json" ) )
|
||||
{
|
||||
wxMemoryOutputStream memos;
|
||||
memos << zip;
|
||||
wxStreamBuffer* buf = memos.GetOutputStreamBuffer();
|
||||
wxMemoryOutputStream memos;
|
||||
memos << zip;
|
||||
wxStreamBuffer* buf = memos.GetOutputStreamBuffer();
|
||||
wxString str( (char*) buf->GetBufferStart(), buf->GetBufferSize() );
|
||||
|
||||
wxString str =
|
||||
wxString::FromUTF8( (char*) buf->GetBufferStart(), buf->GetBufferSize() );
|
||||
|
||||
return nlohmann::json::parse( str );
|
||||
}
|
||||
}
|
||||
catch( nlohmann::json::exception& e )
|
||||
{
|
||||
THROW_IO_ERROR(
|
||||
wxString::Format( _( "JSON error reading '%s': %s" ), name, e.what() ) );
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
THROW_IO_ERROR( wxString::Format( _( "Error reading '%s': %s" ), name, e.what() ) );
|
||||
return nlohmann::json::parse( str );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -229,9 +229,6 @@ void Prettify( std::string& aSource, char aQuoteChar )
|
||||
++cursor;
|
||||
}
|
||||
|
||||
// newline required at end of line / file for POSIX compliance. Keeps git diffs clean.
|
||||
formatted += '\n';
|
||||
|
||||
aSource = std::move( formatted );
|
||||
}
|
||||
|
||||
|
||||
+1
-14
@@ -57,6 +57,7 @@ KIWAY_PLAYER::KIWAY_PLAYER( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType
|
||||
|
||||
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
|
||||
@@ -68,20 +69,6 @@ KIWAY_PLAYER::~KIWAY_PLAYER() throw()
|
||||
delete m_socketServer;
|
||||
m_socketServer = nullptr;
|
||||
}
|
||||
|
||||
// remove active sockets as well
|
||||
for( wxSocketBase* socket : m_sockets )
|
||||
{
|
||||
if( !socket )
|
||||
continue;
|
||||
|
||||
// ensure any event handling stops
|
||||
socket->Notify( false );
|
||||
|
||||
delete socket;
|
||||
}
|
||||
|
||||
m_sockets.clear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <wx/debug.h>
|
||||
#include <wx/filename.h>
|
||||
#include <set>
|
||||
#include <common.h>
|
||||
@@ -199,16 +198,7 @@ LIB_TABLE_ROW* LIB_TABLE::findRow( const wxString& aNickName, bool aCheckIfEnabl
|
||||
|
||||
do
|
||||
{
|
||||
try
|
||||
{
|
||||
std::shared_lock<std::shared_mutex> lock( cur->m_mutex );
|
||||
}
|
||||
catch( std::system_error& e )
|
||||
{
|
||||
wxASSERT_MSG( false, wxString::Format( wxS( "Failed to lock lib table mutex: %s" ),
|
||||
e.what() ) );
|
||||
continue;
|
||||
}
|
||||
std::shared_lock<std::shared_mutex> lock( cur->m_mutex );
|
||||
|
||||
if( cur->m_rowsMap.count( aNickName ) )
|
||||
row = &*cur->m_rowsMap.at( aNickName );
|
||||
|
||||
@@ -21,8 +21,7 @@
|
||||
#include "lib_table_grid.h"
|
||||
|
||||
|
||||
LIB_TABLE_GRID_TRICKS::LIB_TABLE_GRID_TRICKS( WX_GRID* aGrid ) :
|
||||
GRID_TRICKS( aGrid )
|
||||
LIB_TABLE_GRID_TRICKS::LIB_TABLE_GRID_TRICKS( WX_GRID* aGrid ) : GRID_TRICKS( aGrid )
|
||||
{
|
||||
}
|
||||
|
||||
@@ -66,14 +65,11 @@ void LIB_TABLE_GRID_TRICKS::showPopupMenu( wxMenu& menu, wxGridEvent& aEvent )
|
||||
if( showDeactivate )
|
||||
menu.Append( LIB_TABLE_GRID_TRICKS_DEACTIVATE_SELECTED, _( "Deactivate selected" ) );
|
||||
|
||||
if( supportsVisibilityColumn() )
|
||||
{
|
||||
if( showSetVisible )
|
||||
menu.Append( LIB_TABLE_GRID_TRICKS_SET_VISIBLE, _( "Set visible flag" ) );
|
||||
if( showSetVisible )
|
||||
menu.Append( LIB_TABLE_GRID_TRICKS_SET_VISIBLE, _( "Set visible flag" ) );
|
||||
|
||||
if( showUnsetVisible )
|
||||
menu.Append( LIB_TABLE_GRID_TRICKS_UNSET_VISIBLE, _( "Unset visible flag" ) );
|
||||
}
|
||||
if( showUnsetVisible )
|
||||
menu.Append( LIB_TABLE_GRID_TRICKS_UNSET_VISIBLE, _( "Unset visible flag" ) );
|
||||
|
||||
bool showSettings = false;
|
||||
|
||||
|
||||
@@ -242,21 +242,13 @@ void LIB_TREE_NODE_ITEM::Update( LIB_TREE_ITEM* aItem )
|
||||
void LIB_TREE_NODE_ITEM::UpdateScore( EDA_COMBINED_MATCHER* aMatcher, const wxString& aLib,
|
||||
std::function<bool( LIB_TREE_NODE& aNode )>* aFilter )
|
||||
{
|
||||
// aMatcher test is additive, but if we don't match the given term at all, it nulls out
|
||||
// aMatcher test is additive
|
||||
if( aMatcher )
|
||||
{
|
||||
int currentScore = aMatcher->ScoreTerms( m_SearchTerms );
|
||||
m_Score += aMatcher->ScoreTerms( m_SearchTerms );
|
||||
|
||||
// This is a hack: the second phase of search in the adapter will look for a tokenized
|
||||
// LIB_ID and send the lib part down here. While we generally want to prune ourselves
|
||||
// out here (by setting score to -1) the first time we fail to match a search term,
|
||||
// we want to give the same search term a second chance if it has been split from a library
|
||||
// name.
|
||||
if( ( m_Score >= 0 || !aLib.IsEmpty() ) && currentScore > 0 )
|
||||
m_Score += currentScore;
|
||||
else
|
||||
m_Score = -1; // Item has failed to match this term, rule it out
|
||||
}
|
||||
// aLib test is additive
|
||||
if( !aLib.IsEmpty() && m_Parent->m_Name.Lower().Matches( aLib ) )
|
||||
m_Score += 1;
|
||||
|
||||
// aFilter test is subtractive
|
||||
if( aFilter && !(*aFilter)(*this) )
|
||||
@@ -295,42 +287,19 @@ LIB_TREE_NODE_ITEM& LIB_TREE_NODE_LIBRARY::AddItem( LIB_TREE_ITEM* aItem )
|
||||
void LIB_TREE_NODE_LIBRARY::UpdateScore( EDA_COMBINED_MATCHER* aMatcher, const wxString& aLib,
|
||||
std::function<bool( LIB_TREE_NODE& aNode )>* aFilter )
|
||||
{
|
||||
int maxChildScore = 0;
|
||||
|
||||
for( std::unique_ptr<LIB_TREE_NODE>& child: m_Children )
|
||||
{
|
||||
child->UpdateScore( aMatcher, aLib, aFilter );
|
||||
maxChildScore = std::max( maxChildScore, child->m_Score );
|
||||
m_Score = std::max( m_Score, child->m_Score );
|
||||
}
|
||||
|
||||
// Each time UpdateScore is called for a library, child (item) scores may go up or down.
|
||||
// If the all go down to zero, we need to make sure to drop the library from the list.
|
||||
if( maxChildScore > 0 )
|
||||
m_Score = std::max( m_Score, maxChildScore );
|
||||
else
|
||||
m_Score = 0;
|
||||
|
||||
// aLib test is additive, but only when we've already accumulated some score from children
|
||||
if( !aLib.IsEmpty()
|
||||
&& m_Name.Lower().Matches( aLib )
|
||||
&& ( m_Score > 0 || m_Children.empty() ) )
|
||||
{
|
||||
// aLib test is additive
|
||||
if( !aLib.IsEmpty() && m_Name.Lower().Matches( aLib ) )
|
||||
m_Score += 1;
|
||||
}
|
||||
|
||||
// aMatcher test is additive
|
||||
if( aMatcher )
|
||||
{
|
||||
int ownScore = aMatcher->ScoreTerms( m_SearchTerms );
|
||||
m_Score += ownScore;
|
||||
|
||||
// If we have a hit on a library, show all children in that library
|
||||
if( maxChildScore <= 0 && ownScore > 0 )
|
||||
{
|
||||
for( std::unique_ptr<LIB_TREE_NODE>& child: m_Children )
|
||||
child->ForceScore( 1 );
|
||||
}
|
||||
}
|
||||
m_Score += aMatcher->ScoreTerms( m_SearchTerms );
|
||||
|
||||
// show all nodes if no search/filter/etc. criteria are given
|
||||
if( m_Children.empty() && !aMatcher && aLib.IsEmpty() && ( !aFilter || (*aFilter)(*this) ) )
|
||||
|
||||
@@ -91,19 +91,14 @@ public:
|
||||
dc->DrawLines( 6, points );
|
||||
}
|
||||
|
||||
aRect.Deflate( 1 );
|
||||
|
||||
#ifdef __WXOSX__
|
||||
// We should be able to pass wxDATAVIEW_CELL_SELECTED into RenderText() and have it do
|
||||
// the right thing -- but it picks wxSYS_COLOUR_HIGHLIGHTTEXT on MacOS (instead
|
||||
// the right thing -- but it picks wxSYS_COLOUR_HIGHLIGHTTEXT on MacOS and GTK (instead
|
||||
// of wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT).
|
||||
if( aState & wxDATAVIEW_CELL_SELECTED )
|
||||
dc->SetTextForeground( wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOXHIGHLIGHTTEXT ) );
|
||||
|
||||
aRect.Deflate( 1 );
|
||||
RenderText( m_text, 0, aRect, dc, 0 );
|
||||
#else
|
||||
RenderText( m_text, 0, aRect, dc, aState );
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -302,6 +297,11 @@ void LIB_TREE_MODEL_ADAPTER::UpdateSearchString( const wxString& aSearch, bool a
|
||||
|
||||
m_tree.UpdateScore( &itemNameMatcher, lib, nullptr );
|
||||
}
|
||||
else
|
||||
{
|
||||
// In case the full token happens to match a library name
|
||||
m_tree.UpdateScore( nullptr, '*' + term + '*', nullptr );
|
||||
}
|
||||
}
|
||||
|
||||
if( firstTerm )
|
||||
@@ -416,7 +416,7 @@ wxDataViewColumn* LIB_TREE_MODEL_ADAPTER::doAddColumn( const wxString& aHeader,
|
||||
|
||||
wxDataViewColumn* col = new wxDataViewColumn(
|
||||
translatedHeader, new LIB_TREE_RENDERER(), index, m_colWidths[aHeader], wxALIGN_NOT,
|
||||
wxDATAVIEW_CELL_INERT | static_cast<int>( wxDATAVIEW_COL_RESIZABLE ) );
|
||||
wxDATAVIEW_CELL_INERT | wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE );
|
||||
m_widget->AppendColumn( col );
|
||||
|
||||
col->SetMinWidth( headerMinWidth.x );
|
||||
@@ -674,10 +674,10 @@ void LIB_TREE_MODEL_ADAPTER::GetValue( wxVariant& aVariant,
|
||||
{
|
||||
const wxString& key = m_colIdxMap.at( aCol );
|
||||
|
||||
if( key == wxT( "Description" ) )
|
||||
valueStr = UnescapeString( node->m_Desc );
|
||||
else if( node->m_Fields.count( key ) )
|
||||
if( node->m_Fields.count( key ) )
|
||||
valueStr = UnescapeString( node->m_Fields.at( key ) );
|
||||
else if( key == wxT( "Description" ) )
|
||||
valueStr = UnescapeString( node->m_Desc );
|
||||
else
|
||||
valueStr = wxEmptyString;
|
||||
}
|
||||
|
||||
+15
-19
@@ -169,10 +169,6 @@ wxString PATHS::GetStockDataPath( bool aRespectRunFromBuildDir )
|
||||
path = GetExecutablePath() + wxT( ".." );
|
||||
#endif
|
||||
}
|
||||
else if( wxGetEnv( wxT( "KICAD_STOCK_DATA_HOME" ), &path ) && !path.IsEmpty() )
|
||||
{
|
||||
return path;
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined( __WXMAC__ )
|
||||
@@ -295,16 +291,12 @@ wxString PATHS::GetStockPlugins3DPath()
|
||||
{
|
||||
wxFileName fn;
|
||||
|
||||
#if defined( __WXMSW__ )
|
||||
if( wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) )
|
||||
{
|
||||
fn.AssignDir( getWindowsKiCadRoot() );
|
||||
}
|
||||
else
|
||||
{
|
||||
fn.AssignDir( GetExecutablePath() );
|
||||
}
|
||||
|
||||
#ifdef __WXGTK__
|
||||
// KICAD_PLUGINDIR = CMAKE_INSTALL_FULL_LIBDIR path is the absolute path
|
||||
// corresponding to the install path used for constructing KICAD_USER_PLUGIN
|
||||
wxString tfname = wxString::FromUTF8Unchecked( KICAD_PLUGINDIR );
|
||||
fn.Assign( tfname, "" );
|
||||
fn.AppendDir( wxT( "kicad" ) );
|
||||
fn.AppendDir( wxT( "plugins" ) );
|
||||
#elif defined( __WXMAC__ )
|
||||
fn.Assign( wxStandardPaths::Get().GetPluginsDir(), wxEmptyString );
|
||||
@@ -327,11 +319,15 @@ wxString PATHS::GetStockPlugins3DPath()
|
||||
fn.AppendDir( wxT( "PlugIns" ) );
|
||||
}
|
||||
#else
|
||||
// KICAD_PLUGINDIR = CMAKE_INSTALL_FULL_LIBDIR path is the absolute path
|
||||
// corresponding to the install path used for constructing KICAD_USER_PLUGIN
|
||||
wxString tfname = wxString::FromUTF8Unchecked( KICAD_PLUGINDIR );
|
||||
fn.Assign( tfname, "" );
|
||||
fn.AppendDir( wxT( "kicad" ) );
|
||||
if( wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) )
|
||||
{
|
||||
fn.AssignDir( getWindowsKiCadRoot() );
|
||||
}
|
||||
else
|
||||
{
|
||||
fn.AssignDir( GetExecutablePath() );
|
||||
}
|
||||
|
||||
fn.AppendDir( wxT( "plugins" ) );
|
||||
#endif
|
||||
|
||||
|
||||
+5
-5
@@ -134,7 +134,6 @@ PGM_BASE::PGM_BASE()
|
||||
m_argcUtf8 = 0;
|
||||
m_argvUtf8 = nullptr;
|
||||
m_splash = nullptr;
|
||||
m_PropertyGridInitialized = false;
|
||||
|
||||
setLanguageId( wxLANGUAGE_DEFAULT );
|
||||
|
||||
@@ -153,9 +152,6 @@ PGM_BASE::~PGM_BASE()
|
||||
}
|
||||
|
||||
delete[] m_argvUtf8;
|
||||
|
||||
delete m_locale;
|
||||
m_locale = nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -167,6 +163,10 @@ void PGM_BASE::Destroy()
|
||||
sentry_close();
|
||||
#endif
|
||||
|
||||
// unlike a normal destructor, this is designed to be called more than once safely:
|
||||
delete m_locale;
|
||||
m_locale = nullptr;
|
||||
|
||||
m_pgm_checker.reset();
|
||||
}
|
||||
|
||||
@@ -989,7 +989,7 @@ void PGM_BASE::HandleAssert( const wxString& aFile, int aLine, const wxString& a
|
||||
{
|
||||
static std::set<SENTRY_ASSERT_CACHE_KEY> assertCache;
|
||||
|
||||
SENTRY_ASSERT_CACHE_KEY key = { aFile, aLine, aFunc, aCond };
|
||||
SENTRY_ASSERT_CACHE_KEY key = { aFile, aLine, aFunc, aCond, aMsg };
|
||||
|
||||
if( assertCache.find( key ) == assertCache.end() )
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2022-2024 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2022-2023 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
|
||||
@@ -647,16 +647,6 @@ void GERBER_PLOTTER::writeApertureList()
|
||||
std::vector<VECTOR2I> corners;
|
||||
VECTOR2I half_size( tool.m_Size.x/2-tool.m_Radius, tool.m_Size.y/2-tool.m_Radius );
|
||||
|
||||
// Ensure half_size.x and half_size.y > minimal value to avoid shapes
|
||||
// with null size (especially the rectangle with coordinates corners)
|
||||
// Because the minimal value for a non nul Gerber coord in 10nm
|
||||
// in format 4.5, use 10 nm as minimal value.
|
||||
// (Even in 4.6 format, use 10 nm, because gerber viewers can have
|
||||
// a internal unit bigger than 1 nm)
|
||||
const int min_size_value = 10;
|
||||
half_size.x = std::max( half_size.x, min_size_value );
|
||||
half_size.y = std::max( half_size.y, min_size_value );
|
||||
|
||||
corners.emplace_back( -half_size.x, -half_size.y );
|
||||
corners.emplace_back( half_size.x, -half_size.y );
|
||||
corners.emplace_back( half_size.x, half_size.y );
|
||||
@@ -833,21 +823,10 @@ void GERBER_PLOTTER::Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
|
||||
{
|
||||
SetCurrentLineWidth( aWidth );
|
||||
|
||||
double arcLength = std::abs( aRadius * aAngle.AsRadians() );
|
||||
EDA_ANGLE endAngle = aStartAngle + aAngle;
|
||||
|
||||
if( arcLength < 100 || std::abs( aAngle.AsDegrees() ) < 0.1 )
|
||||
{
|
||||
// Prevent plotting very short arcs as full circles, especially with 4.5 mm precision.
|
||||
// Also reduce the risk of integer overflow issues.
|
||||
polyArc( aCenter, aStartAngle, aAngle, aRadius, aFill, aWidth );
|
||||
}
|
||||
else
|
||||
{
|
||||
EDA_ANGLE endAngle = aStartAngle + aAngle;
|
||||
|
||||
// aFill is not used here.
|
||||
plotArc( aCenter, aStartAngle, endAngle, aRadius, false );
|
||||
}
|
||||
// aFill is not used here.
|
||||
plotArc( aCenter, aStartAngle, endAngle, aRadius, false );
|
||||
}
|
||||
|
||||
|
||||
@@ -890,19 +869,19 @@ void GERBER_PLOTTER::plotArc( const SHAPE_ARC& aArc, bool aPlotInRegion )
|
||||
|
||||
|
||||
void GERBER_PLOTTER::plotArc( const VECTOR2I& aCenter, const EDA_ANGLE& aStartAngle,
|
||||
const EDA_ANGLE& aEndAngle, double aRadius, bool aPlotInRegion )
|
||||
const EDA_ANGLE& aEndAngle, int aRadius, bool aPlotInRegion )
|
||||
{
|
||||
VECTOR2I start, end;
|
||||
start.x = KiROUND( aCenter.x + aRadius * aStartAngle.Cos() );
|
||||
start.y = KiROUND( aCenter.y + aRadius * aStartAngle.Sin() );
|
||||
start.x = aCenter.x + KiROUND( aRadius * aStartAngle.Cos() );
|
||||
start.y = aCenter.y + KiROUND( aRadius * aStartAngle.Sin() );
|
||||
|
||||
if( !aPlotInRegion )
|
||||
MoveTo( start );
|
||||
else
|
||||
LineTo( start );
|
||||
|
||||
end.x = KiROUND( aCenter.x + aRadius * aEndAngle.Cos() );
|
||||
end.y = KiROUND( aCenter.y + aRadius * aEndAngle.Sin() );
|
||||
end.x = aCenter.x + KiROUND( aRadius * aEndAngle.Cos() );
|
||||
end.y = aCenter.y + KiROUND( aRadius * aEndAngle.Sin() );
|
||||
VECTOR2D devEnd = userToDeviceCoordinates( end );
|
||||
// devRelCenter is the position on arc center relative to the arc start, in Gerber coord.
|
||||
VECTOR2D devRelCenter = userToDeviceCoordinates( aCenter ) - userToDeviceCoordinates( start );
|
||||
|
||||
@@ -565,13 +565,6 @@ void HPGL_PLOTTER::Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
|
||||
if( aRadius <= 0 )
|
||||
return;
|
||||
|
||||
// Avoid integer overflow when calculating the center point
|
||||
if( std::abs( aAngle.AsDegrees() ) < 5 )
|
||||
{
|
||||
polyArc( aCenter, aStartAngle, aAngle, aRadius, aFill, aWidth );
|
||||
return;
|
||||
}
|
||||
|
||||
double const radius_device = userToDeviceSize( aRadius );
|
||||
double const circumf_device = 2.0 * M_PI * radius_device;
|
||||
double const target_chord_length = m_arcTargetChordLength;
|
||||
@@ -588,11 +581,11 @@ void HPGL_PLOTTER::Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
|
||||
EDA_ANGLE startAngle = -aStartAngle;
|
||||
|
||||
// Calculate arc start point:
|
||||
VECTOR2I cmap( KiROUND( aCenter.x + aRadius * startAngle.Cos() ),
|
||||
KiROUND( aCenter.y - aRadius * startAngle.Sin() ) );
|
||||
VECTOR2I cmap( aCenter.x + KiROUND( aRadius * startAngle.Cos() ),
|
||||
aCenter.y - KiROUND( aRadius * startAngle.Sin() ) );
|
||||
VECTOR2D cmap_dev = userToDeviceCoordinates( cmap );
|
||||
|
||||
startOrAppendItem( cmap_dev, wxString::Format( "AA %.0f,%.0f,%g,%g",
|
||||
startOrAppendItem( cmap_dev, wxString::Format( "AA %.0f,%.0f,%.0f,%g",
|
||||
centre_device.x,
|
||||
centre_device.y,
|
||||
angle.AsDegrees(),
|
||||
|
||||
@@ -354,21 +354,21 @@ void PDF_PLOTTER::Arc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
|
||||
SetCurrentLineWidth( aWidth );
|
||||
|
||||
// Usual trig arc plotting routine...
|
||||
start.x = KiROUND( aCenter.x + aRadius * ( -startAngle ).Cos() );
|
||||
start.y = KiROUND( aCenter.y + aRadius * ( -startAngle ).Sin() );
|
||||
start.x = aCenter.x + KiROUND( aRadius * (-startAngle).Cos() );
|
||||
start.y = aCenter.y + KiROUND( aRadius * (-startAngle).Sin() );
|
||||
VECTOR2D pos_dev = userToDeviceCoordinates( start );
|
||||
fprintf( m_workFile, "%g %g m ", pos_dev.x, pos_dev.y );
|
||||
|
||||
for( EDA_ANGLE ii = startAngle + delta; ii < endAngle; ii += delta )
|
||||
{
|
||||
end.x = KiROUND( aCenter.x + aRadius * ( -ii ).Cos() );
|
||||
end.y = KiROUND( aCenter.y + aRadius * ( -ii ).Sin() );
|
||||
end.x = aCenter.x + KiROUND( aRadius * (-ii).Cos() );
|
||||
end.y = aCenter.y + KiROUND( aRadius * (-ii).Sin() );
|
||||
pos_dev = userToDeviceCoordinates( end );
|
||||
fprintf( m_workFile, "%g %g l ", pos_dev.x, pos_dev.y );
|
||||
}
|
||||
|
||||
end.x = KiROUND( aCenter.x + aRadius * ( -endAngle ).Cos() );
|
||||
end.y = KiROUND( aCenter.y + aRadius * ( -endAngle ).Sin() );
|
||||
end.x = aCenter.x + KiROUND( aRadius * (-endAngle).Cos() );
|
||||
end.y = aCenter.y + KiROUND( aRadius * (-endAngle).Sin() );
|
||||
pos_dev = userToDeviceCoordinates( end );
|
||||
fprintf( m_workFile, "%g %g l ", pos_dev.x, pos_dev.y );
|
||||
|
||||
|
||||
@@ -851,7 +851,7 @@ void SVG_PLOTTER::Text( const VECTOR2I& aPos,
|
||||
|
||||
fprintf( m_outputFile,
|
||||
"textLength=\"%.*f\" font-size=\"%.*f\" lengthAdjust=\"spacingAndGlyphs\"\n"
|
||||
"text-anchor=\"%s\" opacity=\"0\" stroke-opacity=\"0\">%s</text>\n",
|
||||
"text-anchor=\"%s\" opacity=\"0\">%s</text>\n",
|
||||
m_precision, sz_dev.x, m_precision, sz_dev.y, hjust, TO_UTF8( XmlEsc( aText ) ) );
|
||||
|
||||
if( !aOrient.IsZero() )
|
||||
|
||||
@@ -191,8 +191,8 @@ void PLOTTER::polyArc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
|
||||
|
||||
SetCurrentLineWidth( aWidth );
|
||||
|
||||
start.x = KiROUND( aCenter.x + aRadius * startAngle.Cos() );
|
||||
start.y = KiROUND( aCenter.y + sign * aRadius * startAngle.Sin() );
|
||||
start.x = aCenter.x + KiROUND( aRadius * startAngle.Cos() );
|
||||
start.y = aCenter.y + sign * KiROUND( aRadius * startAngle.Sin() );
|
||||
|
||||
if( aFill != FILL_T::NO_FILL )
|
||||
{
|
||||
@@ -206,13 +206,13 @@ void PLOTTER::polyArc( const VECTOR2D& aCenter, const EDA_ANGLE& aStartAngle,
|
||||
|
||||
for( EDA_ANGLE ii = startAngle + delta; ii < endAngle; ii += delta )
|
||||
{
|
||||
end.x = KiROUND( aCenter.x + aRadius * ii.Cos() );
|
||||
end.y = KiROUND( aCenter.y + sign * aRadius * ii.Sin() );
|
||||
end.x = aCenter.x + KiROUND( aRadius * ii.Cos() );
|
||||
end.y = aCenter.y + sign * KiROUND( aRadius * ii.Sin() );
|
||||
LineTo( end );
|
||||
}
|
||||
|
||||
end.x = KiROUND( aCenter.x + aRadius * endAngle.Cos() );
|
||||
end.y = KiROUND( aCenter.y + sign * aRadius * endAngle.Sin() );
|
||||
end.x = aCenter.x + KiROUND( aRadius * endAngle.Cos() );
|
||||
end.y = aCenter.y + sign * KiROUND( aRadius * endAngle.Sin() );
|
||||
|
||||
if( aFill != FILL_T::NO_FILL )
|
||||
{
|
||||
@@ -706,6 +706,7 @@ void PLOTTER::Text( const VECTOR2I& aPos,
|
||||
KIGFX::GAL_DISPLAY_OPTIONS empty_opts;
|
||||
|
||||
SetColor( aColor );
|
||||
SetCurrentLineWidth( aPenWidth, aData );
|
||||
|
||||
if( aPenWidth == 0 && aBold ) // Use default values if aPenWidth == 0
|
||||
aPenWidth = GetPenSizeForBold( std::min( aSize.x, aSize.y ) );
|
||||
@@ -717,7 +718,6 @@ void PLOTTER::Text( const VECTOR2I& aPos,
|
||||
// Stroke callback
|
||||
[&]( const VECTOR2I& aPt1, const VECTOR2I& aPt2 )
|
||||
{
|
||||
SetCurrentLineWidth( aPenWidth );
|
||||
MoveTo( aPt1 );
|
||||
LineTo( aPt2 );
|
||||
PenFinish();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user