Compare commits
156 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2176a654cd | |||
| 2176788d1c | |||
| 6389fa2d81 | |||
| 8a0b64dd00 | |||
| 79ac207532 | |||
| c33e12b66f | |||
| 5d0dfb80d4 | |||
| 7ebab92f16 | |||
| 1a851f7c33 | |||
| 74ee8bea5d | |||
| dec1748978 | |||
| 4ef47e1040 | |||
| 42f242ce42 | |||
| c4914a64bb | |||
| 4aa05dfcf2 | |||
| 255ff5d789 | |||
| 75f5186dec | |||
| 0cf6d80705 | |||
| 2d96c6ad22 | |||
| ef7ec13861 | |||
| 8008e09918 | |||
| 75ace76c6a | |||
| 9de58a29e3 | |||
| 56aff41b7e | |||
| a8417a7e23 | |||
| 582c9b7f08 | |||
| 2eb6ca75a8 | |||
| 4918ac6307 | |||
| acc03e91f3 | |||
| 8e1466a35a | |||
| 5b73af668f | |||
| deb035c7fe | |||
| 2075a99c9b | |||
| 74b1f603df | |||
| ed1eb1c018 | |||
| 4bed2e57cb | |||
| 0629f502b5 | |||
| fd93873cc1 | |||
| dbd58dbbc6 | |||
| b2edf61588 | |||
| 96b6975deb | |||
| 9449dab0b7 | |||
| 6da9dbcc53 | |||
| d1bdea21b4 | |||
| 5ea0f3253f | |||
| b1e5c02e0c | |||
| f48d97ab04 | |||
| 8f85e04d61 | |||
| 1eab9b34fe | |||
| 13a3c44b61 | |||
| f6b106598c | |||
| f6aed13605 | |||
| 62dd8e67df | |||
| ba7620e0ee | |||
| 931f6a35dd | |||
| d3394733b1 | |||
| 0f5d175b09 | |||
| c93111bf4b | |||
| adb0f0a46f | |||
| 60454c0c39 | |||
| de35de9e00 | |||
| d5d91ae592 | |||
| 9c852af5b7 | |||
| 24fcfd125c | |||
| 1ad42519d6 | |||
| 3052dcc95a | |||
| 17089d8316 | |||
| ce919632be | |||
| f3168c3603 | |||
| a6ca88b5ac | |||
| 8625a59d4c | |||
| cb4289fd19 | |||
| 9ac5f837f7 | |||
| 033ab9ac71 | |||
| 228fe71eb4 | |||
| 80462cf559 | |||
| e5df16ba2b | |||
| b0f4d56de1 | |||
| 7bc0f8731f | |||
| b4b49a4296 | |||
| 507054e9cd | |||
| 342b8b157b | |||
| 74fc8f6db0 | |||
| 04bb3dfe9d | |||
| 7fb15269d1 | |||
| 49772d2539 | |||
| 0f4bd34bce | |||
| 2451cbddec | |||
| b7363225da | |||
| a9c0756da4 | |||
| 2652068933 | |||
| 022105cdba | |||
| 2fa05ed245 | |||
| 124be52411 | |||
| 6f8272718d | |||
| bac1fb18f0 | |||
| 391204ea0d | |||
| 810f3efcbb | |||
| e4a80d887a | |||
| 45d496bd01 | |||
| 20a5b2d4c4 | |||
| cc2637b310 | |||
| 3fc404cd25 | |||
| e016fa913f | |||
| e1c6f4f58f | |||
| c50888fc79 | |||
| 7c0a911e9f | |||
| 0562776b7a | |||
| 9cf79ffb5a | |||
| 63b0ef65e0 | |||
| 62bf6a9d57 | |||
| 4ad6244d8d | |||
| b2f72020bd | |||
| d73f96e3d8 | |||
| f8210e4a2a | |||
| 1ccaf45740 | |||
| d268ccea5b | |||
| 10efb6e55a | |||
| 171c44507a | |||
| 9514f057dc | |||
| e154857aca | |||
| 59c06bcaf1 | |||
| 17f02b2ff0 | |||
| 6316b78a5e | |||
| e53269c37f | |||
| a43adf7d4f | |||
| 16d24d4b43 | |||
| 4a3ae82748 | |||
| 60fe2ce30e | |||
| b294530716 | |||
| 0652267d00 | |||
| b857374aa2 | |||
| 480ce08d39 | |||
| 63f33a42e3 | |||
| f6d1baa50a | |||
| 0df1ec8765 | |||
| 19e128041b | |||
| 76f8b3df22 | |||
| e1e791fc75 | |||
| bbf59a731d | |||
| 803bcbbea0 | |||
| 6f384c8802 | |||
| d6eb66c738 | |||
| 7078381175 | |||
| 0ffef66cb6 | |||
| dfc17244d4 | |||
| ecb9f607ed | |||
| 35126ba22c | |||
| 5cdf03ff6d | |||
| d128b30279 | |||
| cadea90109 | |||
| 90d1695bbc | |||
| 713cb032b5 | |||
| 24ed144200 | |||
| ebc584b2a7 | |||
| dcef21676d |
+4
-2
@@ -23,8 +23,10 @@ test_formatting:
|
||||
allow_failure: true
|
||||
before_script:
|
||||
# We must manually add the KiCad remote to ensure it is named sensibly
|
||||
- git remote add product https://gitlab.com/kicad/code/kicad.git
|
||||
- git remote add source ${CI_MERGE_REQUEST_SOURCE_PROJECT_URL}.git
|
||||
- git remote add product https://gitlab.com/kicad/code/kicad.git ||
|
||||
git remote set-url product https://gitlab.com/kicad/code/kicad.git
|
||||
- git remote add source ${CI_MERGE_REQUEST_SOURCE_PROJECT_URL}.git ||
|
||||
git remote set-url source ${CI_MERGE_REQUEST_SOURCE_PROJECT_URL}.git
|
||||
- git fetch -n product
|
||||
- git fetch -n source
|
||||
# Get the SHAs of the commits
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015-2016 Cirilo Bernardo <cirilo.bernardo@gmail.com>
|
||||
* Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2020-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
|
||||
@@ -294,6 +294,16 @@ void S3D_PLUGIN_MANAGER::checkPluginName( const wxString& aPath,
|
||||
++bl;
|
||||
}
|
||||
|
||||
// prevent loading non-plugin dlls
|
||||
if( wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) )
|
||||
{
|
||||
if( !path.GetName().StartsWith( "s3d_plugin" )
|
||||
&& !path.GetName().StartsWith( "libs3d_plugin" ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
aPluginList.push_back( wxpath );
|
||||
|
||||
wxLogTrace( MASK_3D_PLUGINMGR, wxT( " * [INFO] found 3D plugin '%s'\n" ), wxpath.GetData() );
|
||||
|
||||
@@ -931,10 +931,33 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
|
||||
{
|
||||
float ratio =
|
||||
std::max( 1.0f, m_objectContainer.GetBBox().GetMaxDimension() / RANGE_SCALE_3D );
|
||||
m_camera.SetMaxZoom( CAMERA::DEFAULT_MAX_ZOOM * ratio );
|
||||
|
||||
m_camera.SetMinZoom( static_cast<float>( MIN_DISTANCE_IU * m_boardAdapter.BiuTo3dUnits()
|
||||
/ -m_camera.GetCameraInitPos().z ) );
|
||||
float max_zoom = CAMERA::DEFAULT_MAX_ZOOM * ratio;
|
||||
float min_zoom = static_cast<float>( MIN_DISTANCE_IU * m_boardAdapter.BiuTo3dUnits()
|
||||
/ -m_camera.GetCameraInitPos().z );
|
||||
|
||||
if( min_zoom > max_zoom )
|
||||
std::swap( min_zoom, max_zoom );
|
||||
|
||||
float zoom_ratio = max_zoom / min_zoom;
|
||||
|
||||
// Set the minimum number of zoom 'steps' between max and min.
|
||||
int steps = 3 * 3;
|
||||
steps -= static_cast<int>( ceil( log( zoom_ratio ) / log( 1.26f ) ) );
|
||||
steps = std::max( steps, 0 );
|
||||
|
||||
// Resize max and min zoom to accomplish the number of steps.
|
||||
float increased_zoom = pow( 1.26f, steps / 2 );
|
||||
max_zoom *= increased_zoom;
|
||||
min_zoom /= increased_zoom;
|
||||
|
||||
if( steps & 1 )
|
||||
min_zoom /= 1.26f;
|
||||
|
||||
min_zoom = std::min( min_zoom, 1.0f );
|
||||
|
||||
m_camera.SetMaxZoom( max_zoom );
|
||||
m_camera.SetMinZoom( min_zoom );
|
||||
}
|
||||
|
||||
// Create an accelerator
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
|
||||
#include "panel_preview_3d_model.h"
|
||||
#include <dialogs/dialog_unit_entry.h>
|
||||
#include <3d_canvas/eda_3d_canvas.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tool/tool_dispatcher.h>
|
||||
@@ -46,14 +47,14 @@ PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL( wxWindow* aParent, PCB_BASE_FRAM
|
||||
FOOTPRINT* aFootprint,
|
||||
std::vector<FP_3DMODEL>* aParentModelList ) :
|
||||
PANEL_PREVIEW_3D_MODEL_BASE( aParent, wxID_ANY ),
|
||||
m_parentFrame( aFrame ),
|
||||
m_previewPane( nullptr ),
|
||||
m_infobar( nullptr ),
|
||||
m_boardAdapter(),
|
||||
m_currentCamera( m_trackBallCamera ),
|
||||
m_trackBallCamera( 2 * RANGE_SCALE_3D ),
|
||||
m_boardThickness( aFrame, nullptr, m_boardThicknessCtrl, m_boardThicknessUnits )
|
||||
m_trackBallCamera( 2 * RANGE_SCALE_3D )
|
||||
{
|
||||
m_userUnits = aFrame->GetUserUnits();
|
||||
m_userUnits = m_parentFrame->GetUserUnits();
|
||||
|
||||
m_dummyBoard = new BOARD();
|
||||
|
||||
@@ -83,6 +84,7 @@ PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL( wxWindow* aParent, PCB_BASE_FRAM
|
||||
m_bpvBottom->SetBitmap( KiBitmap( BITMAPS::axis3d_bottom ) );
|
||||
m_bpvISO->SetBitmap( KiBitmap( BITMAPS::ortho ) );
|
||||
m_bpUpdate->SetBitmap( KiBitmap( BITMAPS::reload ) );
|
||||
m_bpSettings->SetBitmap( KiBitmap( BITMAPS::options_3drender ) );
|
||||
|
||||
// Set the min and max values of spin buttons (mandatory on Linux)
|
||||
// They are not used, so they are set to min and max 32 bits int values
|
||||
@@ -103,6 +105,15 @@ PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL( wxWindow* aParent, PCB_BASE_FRAM
|
||||
|
||||
m_dummyFootprint = new FOOTPRINT( *aFootprint );
|
||||
m_dummyFootprint->SetParentGroup( nullptr );
|
||||
|
||||
// Ensure the footprint is shown like in Fp editor: rot 0, not flipped
|
||||
// to avoid mistakes when setting the3D shape position/rotation
|
||||
if( m_dummyFootprint->IsFlipped() )
|
||||
m_dummyFootprint->Flip( m_dummyFootprint->GetPosition(), false );
|
||||
|
||||
m_dummyFootprint->SetOrientation( ANGLE_0 );
|
||||
|
||||
|
||||
m_dummyBoard->Add( m_dummyFootprint );
|
||||
|
||||
// Create the 3D canvas
|
||||
@@ -164,6 +175,7 @@ PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL( wxWindow* aParent, PCB_BASE_FRAM
|
||||
m_bpvBottom->SetMinSize( m_bpvBottom->GetSize() + borderFix );
|
||||
m_bpvISO->SetMinSize( m_bpvISO->GetSize() + borderFix );
|
||||
m_bpUpdate->SetMinSize( m_bpUpdate->GetSize() + borderFix );
|
||||
m_bpSettings->SetMinSize( m_bpSettings->GetSize() + borderFix );
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -327,9 +339,6 @@ void PANEL_PREVIEW_3D_MODEL::SetSelectedModel( int idx )
|
||||
|
||||
m_opacity->SetValue( 100 );
|
||||
}
|
||||
|
||||
BOARD_DESIGN_SETTINGS dummy_bds = m_dummyBoard->GetDesignSettings();
|
||||
m_boardThickness.ChangeValue( dummy_bds.GetBoardThickness() );
|
||||
}
|
||||
|
||||
|
||||
@@ -382,16 +391,27 @@ void PANEL_PREVIEW_3D_MODEL::onOpacitySlider( wxCommandEvent& event )
|
||||
}
|
||||
|
||||
|
||||
void PANEL_PREVIEW_3D_MODEL::updateBoardThickness( wxCommandEvent& event )
|
||||
void PANEL_PREVIEW_3D_MODEL::View3DSettings( wxCommandEvent& event )
|
||||
{
|
||||
BOARD_DESIGN_SETTINGS dummy_bds = m_dummyBoard->GetDesignSettings();
|
||||
dummy_bds.SetBoardThickness( m_boardThickness.GetValue() );
|
||||
BOARD_DESIGN_SETTINGS bds = m_dummyBoard->GetDesignSettings();
|
||||
int thickness = bds.GetBoardThickness();
|
||||
|
||||
BOARD_STACKUP& dummy_board_stackup = m_dummyBoard->GetDesignSettings().GetStackupDescriptor();
|
||||
dummy_board_stackup.RemoveAll();
|
||||
dummy_board_stackup.BuildDefaultStackupList( &dummy_bds, 2 );
|
||||
WX_UNIT_ENTRY_DIALOG dlg( m_parentFrame, _( "Board Thickness: " ),
|
||||
_( "Preview Settings" ), thickness );
|
||||
|
||||
if( dlg.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
||||
bds.SetBoardThickness( (int) dlg.GetValue() );
|
||||
|
||||
BOARD_STACKUP& boardStackup = m_dummyBoard->GetDesignSettings().GetStackupDescriptor();
|
||||
boardStackup.RemoveAll();
|
||||
boardStackup.BuildDefaultStackupList( &bds, 2 );
|
||||
|
||||
UpdateDummyFootprint( true );
|
||||
|
||||
m_previewPane->ReloadRequest();
|
||||
m_previewPane->Refresh();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -135,8 +135,6 @@ private:
|
||||
|
||||
void onOpacitySlider( wxCommandEvent& event ) override;
|
||||
|
||||
void updateBoardThickness( wxCommandEvent& event ) override;
|
||||
|
||||
void doIncrementScale( wxSpinEvent& aEvent, double aSign );
|
||||
void doIncrementRotation( wxSpinEvent& aEvent, double aSign );
|
||||
void doIncrementOffset( wxSpinEvent& aEvent, double aSign );
|
||||
@@ -174,6 +172,8 @@ private:
|
||||
m_previewPane->Refresh();
|
||||
}
|
||||
|
||||
void View3DSettings( wxCommandEvent& event ) override;
|
||||
|
||||
void View3DRight( wxCommandEvent& event ) override
|
||||
{
|
||||
m_previewPane->SetView3D( ID_VIEW3D_RIGHT );
|
||||
@@ -190,6 +190,7 @@ private:
|
||||
}
|
||||
|
||||
private:
|
||||
PCB_BASE_FRAME* m_parentFrame;
|
||||
EDA_3D_CANVAS* m_previewPane;
|
||||
WX_INFOBAR* m_infobar;
|
||||
BOARD_ADAPTER m_boardAdapter;
|
||||
@@ -202,7 +203,6 @@ private:
|
||||
std::vector<FP_3DMODEL>* m_parentModelList;
|
||||
int m_selected; /// Index into m_parentInfoList
|
||||
|
||||
UNIT_BINDER m_boardThickness;
|
||||
EDA_UNITS m_userUnits;
|
||||
};
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ PANEL_PREVIEW_3D_MODEL_BASE::PANEL_PREVIEW_3D_MODEL_BASE( wxWindow* parent, wxWi
|
||||
sbSizerScale = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Scale") ), wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizerScale;
|
||||
fgSizerScale = new wxFlexGridSizer( 0, 3, 3, 3 );
|
||||
fgSizerScale = new wxFlexGridSizer( 0, 3, 2, 3 );
|
||||
fgSizerScale->AddGrowableCol( 1 );
|
||||
fgSizerScale->SetFlexibleDirection( wxBOTH );
|
||||
fgSizerScale->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
@@ -66,7 +66,7 @@ PANEL_PREVIEW_3D_MODEL_BASE::PANEL_PREVIEW_3D_MODEL_BASE( wxWindow* parent, wxWi
|
||||
sbSizerRotation = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Rotation") ), wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizerRotate;
|
||||
fgSizerRotate = new wxFlexGridSizer( 0, 3, 3, 3 );
|
||||
fgSizerRotate = new wxFlexGridSizer( 0, 3, 2, 3 );
|
||||
fgSizerRotate->AddGrowableCol( 1 );
|
||||
fgSizerRotate->SetFlexibleDirection( wxBOTH );
|
||||
fgSizerRotate->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
@@ -111,7 +111,7 @@ PANEL_PREVIEW_3D_MODEL_BASE::PANEL_PREVIEW_3D_MODEL_BASE( wxWindow* parent, wxWi
|
||||
sbSizerOffset = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Offset") ), wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizerOffset;
|
||||
fgSizerOffset = new wxFlexGridSizer( 0, 3, 3, 3 );
|
||||
fgSizerOffset = new wxFlexGridSizer( 0, 3, 2, 3 );
|
||||
fgSizerOffset->AddGrowableCol( 1 );
|
||||
fgSizerOffset->SetFlexibleDirection( wxBOTH );
|
||||
fgSizerOffset->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
@@ -159,20 +159,7 @@ PANEL_PREVIEW_3D_MODEL_BASE::PANEL_PREVIEW_3D_MODEL_BASE( wxWindow* parent, wxWi
|
||||
sbSizer4->Add( m_opacity, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
|
||||
bSizerLeft->Add( sbSizer4, 1, wxEXPAND|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbSizerBoardThickness;
|
||||
sbSizerBoardThickness = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Board Thickness") ), wxHORIZONTAL );
|
||||
|
||||
m_boardThicknessCtrl = new wxTextCtrl( sbSizerBoardThickness->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sbSizerBoardThickness->Add( m_boardThicknessCtrl, 1, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 5 );
|
||||
|
||||
m_boardThicknessUnits = new wxStaticText( sbSizerBoardThickness->GetStaticBox(), wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_boardThicknessUnits->Wrap( -1 );
|
||||
sbSizerBoardThickness->Add( m_boardThicknessUnits, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
bSizerLeft->Add( sbSizerBoardThickness, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
|
||||
bSizerLeft->Add( sbSizer4, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
bSizermain->Add( bSizerLeft, 0, 0, 5 );
|
||||
@@ -195,7 +182,7 @@ PANEL_PREVIEW_3D_MODEL_BASE::PANEL_PREVIEW_3D_MODEL_BASE( wxWindow* parent, wxWi
|
||||
m_SizerPanelView = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
bSizerRight->Add( m_SizerPanelView, 1, wxEXPAND|wxBOTTOM, 8 );
|
||||
bSizerRight->Add( m_SizerPanelView, 1, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
bSizermain->Add( bSizerRight, 1, wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
@@ -212,7 +199,7 @@ PANEL_PREVIEW_3D_MODEL_BASE::PANEL_PREVIEW_3D_MODEL_BASE( wxWindow* parent, wxWi
|
||||
bSizer3DButtons->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_bpvLeft = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
|
||||
bSizer3DButtons->Add( m_bpvLeft, 0, wxALIGN_LEFT|wxALIGN_RIGHT|wxBOTTOM, 5 );
|
||||
bSizer3DButtons->Add( m_bpvLeft, 0, wxBOTTOM, 5 );
|
||||
|
||||
m_bpvRight = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
|
||||
bSizer3DButtons->Add( m_bpvRight, 0, wxBOTTOM, 5 );
|
||||
@@ -237,6 +224,9 @@ PANEL_PREVIEW_3D_MODEL_BASE::PANEL_PREVIEW_3D_MODEL_BASE( wxWindow* parent, wxWi
|
||||
|
||||
bSizer3DButtons->Add( m_bpUpdate, 0, wxBOTTOM, 5 );
|
||||
|
||||
m_bpSettings = new wxBitmapButton( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
|
||||
bSizer3DButtons->Add( m_bpSettings, 0, 0, 5 );
|
||||
|
||||
|
||||
bSizermain->Add( bSizer3DButtons, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxEXPAND, 5 );
|
||||
|
||||
@@ -283,8 +273,6 @@ PANEL_PREVIEW_3D_MODEL_BASE::PANEL_PREVIEW_3D_MODEL_BASE( wxWindow* parent, wxWi
|
||||
m_spinZoffset->Connect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::onDecrementOffset ), NULL, this );
|
||||
m_spinZoffset->Connect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::onIncrementOffset ), NULL, this );
|
||||
m_opacity->Connect( wxEVT_SLIDER, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::onOpacitySlider ), NULL, this );
|
||||
m_boardThicknessCtrl->Connect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::onMouseWheelBoardThickness ), NULL, this );
|
||||
m_boardThicknessCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::updateBoardThickness ), NULL, this );
|
||||
m_bpvISO->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DISO ), NULL, this );
|
||||
m_bpvLeft->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DLeft ), NULL, this );
|
||||
m_bpvRight->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DRight ), NULL, this );
|
||||
@@ -293,6 +281,7 @@ PANEL_PREVIEW_3D_MODEL_BASE::PANEL_PREVIEW_3D_MODEL_BASE( wxWindow* parent, wxWi
|
||||
m_bpvTop->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DTop ), NULL, this );
|
||||
m_bpvBottom->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DBottom ), NULL, this );
|
||||
m_bpUpdate->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DUpdate ), NULL, this );
|
||||
m_bpSettings->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DSettings ), NULL, this );
|
||||
}
|
||||
|
||||
PANEL_PREVIEW_3D_MODEL_BASE::~PANEL_PREVIEW_3D_MODEL_BASE()
|
||||
@@ -335,8 +324,6 @@ PANEL_PREVIEW_3D_MODEL_BASE::~PANEL_PREVIEW_3D_MODEL_BASE()
|
||||
m_spinZoffset->Disconnect( wxEVT_SCROLL_LINEDOWN, wxSpinEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::onDecrementOffset ), NULL, this );
|
||||
m_spinZoffset->Disconnect( wxEVT_SCROLL_LINEUP, wxSpinEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::onIncrementOffset ), NULL, this );
|
||||
m_opacity->Disconnect( wxEVT_SLIDER, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::onOpacitySlider ), NULL, this );
|
||||
m_boardThicknessCtrl->Disconnect( wxEVT_MOUSEWHEEL, wxMouseEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::onMouseWheelBoardThickness ), NULL, this );
|
||||
m_boardThicknessCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::updateBoardThickness ), NULL, this );
|
||||
m_bpvISO->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DISO ), NULL, this );
|
||||
m_bpvLeft->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DLeft ), NULL, this );
|
||||
m_bpvRight->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DRight ), NULL, this );
|
||||
@@ -345,5 +332,6 @@ PANEL_PREVIEW_3D_MODEL_BASE::~PANEL_PREVIEW_3D_MODEL_BASE()
|
||||
m_bpvTop->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DTop ), NULL, this );
|
||||
m_bpvBottom->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DBottom ), NULL, this );
|
||||
m_bpUpdate->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DUpdate ), NULL, this );
|
||||
m_bpSettings->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PREVIEW_3D_MODEL_BASE::View3DSettings ), NULL, this );
|
||||
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
|
||||
<property name="permission">none</property>
|
||||
<property name="rows">0</property>
|
||||
<property name="vgap">3</property>
|
||||
<property name="vgap">2</property>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
|
||||
@@ -686,7 +686,7 @@
|
||||
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
|
||||
<property name="permission">none</property>
|
||||
<property name="rows">0</property>
|
||||
<property name="vgap">3</property>
|
||||
<property name="vgap">2</property>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
|
||||
@@ -1279,7 +1279,7 @@
|
||||
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
|
||||
<property name="permission">none</property>
|
||||
<property name="rows">0</property>
|
||||
<property name="vgap">3</property>
|
||||
<property name="vgap">2</property>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT</property>
|
||||
@@ -1847,7 +1847,7 @@
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxLEFT|wxRIGHT</property>
|
||||
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxStaticBoxSizer" expanded="1">
|
||||
<property name="id">wxID_ANY</property>
|
||||
@@ -1925,147 +1925,6 @@
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticBoxSizer" expanded="1">
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Board Thickness</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">sbSizerBoardThickness</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="parent">1</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxTextCtrl" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="maxlength"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_boardThicknessCtrl</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="value"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnMouseWheel">onMouseWheelBoardThickness</event>
|
||||
<event name="OnText">updateBoardThickness</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">mm</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_boardThicknessUnits</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
@@ -2150,7 +2009,7 @@
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">8</property>
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxBOTTOM</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
@@ -2257,7 +2116,7 @@
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_LEFT|wxALIGN_RIGHT|wxBOTTOM</property>
|
||||
<property name="flag">wxBOTTOM</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBitmapButton" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
@@ -2783,6 +2642,80 @@
|
||||
<event name="OnButtonClick">View3DUpdate</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag"></property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBitmapButton" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="auth_needed">0</property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="bitmap"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="current"></property>
|
||||
<property name="default">0</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="disabled"></property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="focus"></property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">MyButton</property>
|
||||
<property name="margins"></property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_bpSettings</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="position"></property>
|
||||
<property name="pressed"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">View3DSettings</event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
@@ -66,8 +66,6 @@ class PANEL_PREVIEW_3D_MODEL_BASE : public wxPanel
|
||||
wxTextCtrl* zoff;
|
||||
wxSpinButton* m_spinZoffset;
|
||||
wxSlider* m_opacity;
|
||||
wxTextCtrl* m_boardThicknessCtrl;
|
||||
wxStaticText* m_boardThicknessUnits;
|
||||
wxStaticText* m_previewLabel;
|
||||
wxBoxSizer* m_SizerPanelView;
|
||||
wxBitmapButton* m_bpvISO;
|
||||
@@ -78,6 +76,7 @@ class PANEL_PREVIEW_3D_MODEL_BASE : public wxPanel
|
||||
wxBitmapButton* m_bpvTop;
|
||||
wxBitmapButton* m_bpvBottom;
|
||||
wxBitmapButton* m_bpUpdate;
|
||||
wxBitmapButton* m_bpSettings;
|
||||
|
||||
// Virtual event handlers, override them in your derived class
|
||||
virtual void onMouseWheelScale( wxMouseEvent& event ) { event.Skip(); }
|
||||
@@ -91,8 +90,6 @@ class PANEL_PREVIEW_3D_MODEL_BASE : public wxPanel
|
||||
virtual void onDecrementOffset( wxSpinEvent& event ) { event.Skip(); }
|
||||
virtual void onIncrementOffset( wxSpinEvent& event ) { event.Skip(); }
|
||||
virtual void onOpacitySlider( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onMouseWheelBoardThickness( wxMouseEvent& event ) { event.Skip(); }
|
||||
virtual void updateBoardThickness( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DISO( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DLeft( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DRight( wxCommandEvent& event ) { event.Skip(); }
|
||||
@@ -101,6 +98,7 @@ class PANEL_PREVIEW_3D_MODEL_BASE : public wxPanel
|
||||
virtual void View3DTop( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DBottom( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DUpdate( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void View3DSettings( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@@ -53,6 +53,13 @@ set( CMAKE_EXPORT_COMPILE_COMMANDS ON )
|
||||
set( KICAD_CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" )
|
||||
set( CMAKE_MODULE_PATH "${KICAD_CMAKE_MODULE_PATH}" )
|
||||
|
||||
# Create a flag to identify the non-Apple unix systems
|
||||
if( UNIX AND NOT APPLE )
|
||||
set( UNIX_NOT_APPLE ON )
|
||||
else()
|
||||
set( UNIX_NOT_APPLE OFF )
|
||||
endif()
|
||||
|
||||
# On Windows, binaries created by link option -g3 are very large (more than 1Gb for pcbnew,
|
||||
# and more than 3Gb for the full kicad suite)
|
||||
# This option create binaries using link option -g1 that create much smaller files, but
|
||||
@@ -93,6 +100,17 @@ option( KICAD_I18N_UNIX_STRICT_PATH
|
||||
"Use standard Unix locale lookup path (default OFF)."
|
||||
OFF )
|
||||
|
||||
# Options to build with flatpak platform defaults (only on Linux)
|
||||
cmake_dependent_option( KICAD_BUILD_FLATPAK
|
||||
"Build KiCad with metadata, launchers, icons, and MIME info following flatpak conventions"
|
||||
OFF "UNIX_NOT_APPLE"
|
||||
OFF )
|
||||
|
||||
cmake_dependent_option( KICAD_BUILD_NIGHTLY_FLATPAK
|
||||
"Build a Nightly flatpak (requires KICAD_BUILD_FLATPAK=ON)"
|
||||
OFF "UNIX_NOT_APPLE"
|
||||
OFF )
|
||||
|
||||
# Not supported by all platforms (for instance mingw)
|
||||
option( KICAD_SANITIZE_ADDRESS
|
||||
"Build KiCad with sanitizer options. WARNING: Not compatible with gold linker"
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
# KiCad.
|
||||
#
|
||||
# Note: This version string should follow the semantic versioning system
|
||||
set( KICAD_SEMANTIC_VERSION "7.0.6" )
|
||||
set( KICAD_SEMANTIC_VERSION "7.0.7" )
|
||||
|
||||
# Default the version to the semantic version.
|
||||
# This is overridden by the git repository tag though (if using git)
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
|
||||
#include <database/database_connection.h>
|
||||
#include <database/database_cache.h>
|
||||
#include <profile.h>
|
||||
|
||||
|
||||
const char* const traceDatabase = "KICAD_DATABASE";
|
||||
@@ -89,7 +90,7 @@ DATABASE_CONNECTION::DATABASE_CONNECTION( const std::string& aDataSourceName,
|
||||
m_pass = aPassword;
|
||||
m_timeout = aTimeoutSeconds;
|
||||
|
||||
m_cache = std::make_unique<DATABASE_CACHE>( 10, 1 );
|
||||
init();
|
||||
|
||||
if( aConnectNow )
|
||||
Connect();
|
||||
@@ -103,7 +104,7 @@ DATABASE_CONNECTION::DATABASE_CONNECTION( const std::string& aConnectionString,
|
||||
m_connectionString = aConnectionString;
|
||||
m_timeout = aTimeoutSeconds;
|
||||
|
||||
m_cache = std::make_unique<DATABASE_CACHE>( 10, 1 );
|
||||
init();
|
||||
|
||||
if( aConnectNow )
|
||||
Connect();
|
||||
@@ -117,6 +118,12 @@ DATABASE_CONNECTION::~DATABASE_CONNECTION()
|
||||
}
|
||||
|
||||
|
||||
void DATABASE_CONNECTION::init()
|
||||
{
|
||||
m_cache = std::make_unique<DB_CACHE_TYPE>( 10, 1 );
|
||||
}
|
||||
|
||||
|
||||
void DATABASE_CONNECTION::SetCacheParams( int aMaxSize, int aMaxAge )
|
||||
{
|
||||
if( !m_cache )
|
||||
@@ -159,12 +166,10 @@ bool DATABASE_CONNECTION::Connect()
|
||||
return false;
|
||||
}
|
||||
|
||||
m_tables.clear();
|
||||
|
||||
if( IsConnected() )
|
||||
{
|
||||
syncTables();
|
||||
cacheColumns();
|
||||
getQuoteChar();
|
||||
}
|
||||
|
||||
return IsConnected();
|
||||
}
|
||||
@@ -201,54 +206,32 @@ bool DATABASE_CONNECTION::IsConnected() const
|
||||
}
|
||||
|
||||
|
||||
bool DATABASE_CONNECTION::syncTables()
|
||||
bool DATABASE_CONNECTION::CacheTableInfo( const std::string& aTable,
|
||||
const std::set<std::string>& aColumns )
|
||||
{
|
||||
if( !m_conn )
|
||||
return false;
|
||||
|
||||
m_tables.clear();
|
||||
|
||||
try
|
||||
{
|
||||
nanodbc::catalog catalog( *m_conn );
|
||||
nanodbc::catalog::tables tables = catalog.find_tables();
|
||||
nanodbc::catalog::tables tables = catalog.find_tables( fromUTF8( aTable ) );
|
||||
|
||||
while( tables.next() )
|
||||
{
|
||||
std::string key = toUTF8( tables.table_name() );
|
||||
m_tables[key] = toUTF8( tables.table_type() );
|
||||
}
|
||||
}
|
||||
catch( nanodbc::database_error& e )
|
||||
{
|
||||
m_lastError = e.what();
|
||||
wxLogTrace( traceDatabase, wxT( "Exception while syncing tables: %s" ), m_lastError );
|
||||
return false;
|
||||
}
|
||||
tables.next();
|
||||
std::string key = toUTF8( tables.table_name() );
|
||||
m_tables[key] = toUTF8( tables.table_type() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool DATABASE_CONNECTION::cacheColumns()
|
||||
{
|
||||
if( !m_conn )
|
||||
return false;
|
||||
|
||||
m_columnCache.clear();
|
||||
|
||||
for( const auto& tableIter : m_tables )
|
||||
{
|
||||
try
|
||||
{
|
||||
nanodbc::catalog catalog( *m_conn );
|
||||
nanodbc::catalog::columns columns =
|
||||
catalog.find_columns( NANODBC_TEXT( "" ), fromUTF8( tableIter.first ) );
|
||||
catalog.find_columns( NANODBC_TEXT( "" ), tables.table_name() );
|
||||
|
||||
while( columns.next() )
|
||||
{
|
||||
std::string columnKey = toUTF8( columns.column_name() );
|
||||
m_columnCache[tableIter.first][columnKey] = columns.data_type();
|
||||
|
||||
if( aColumns.count( columnKey ) )
|
||||
m_columnCache[key][columnKey] = columns.data_type();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -256,10 +239,16 @@ bool DATABASE_CONNECTION::cacheColumns()
|
||||
{
|
||||
m_lastError = e.what();
|
||||
wxLogTrace( traceDatabase, wxT( "Exception while syncing columns for table %s: %s" ),
|
||||
tableIter.first, m_lastError );
|
||||
key, m_lastError );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch( nanodbc::database_error& e )
|
||||
{
|
||||
m_lastError = e.what();
|
||||
wxLogTrace( traceDatabase, wxT( "Exception while caching table info: %s" ), m_lastError );
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -291,6 +280,35 @@ bool DATABASE_CONNECTION::getQuoteChar()
|
||||
}
|
||||
|
||||
|
||||
std::string DATABASE_CONNECTION::columnsFor( const std::string& aTable )
|
||||
{
|
||||
if( !m_columnCache.count( aTable ) )
|
||||
{
|
||||
wxLogTrace( traceDatabase, wxT( "columnsFor: requested table %s missing from cache!" ),
|
||||
aTable );
|
||||
return "*";
|
||||
}
|
||||
|
||||
if( m_columnCache[aTable].empty() )
|
||||
{
|
||||
wxLogTrace( traceDatabase, wxT( "columnsFor: requested table %s has no columns mapped!" ),
|
||||
aTable );
|
||||
return "*";
|
||||
}
|
||||
|
||||
std::string ret;
|
||||
|
||||
for( const auto& [ columnName, columnType ] : m_columnCache[aTable] )
|
||||
ret += fmt::format( "{}{}{}, ", m_quoteChar, columnName, m_quoteChar );
|
||||
|
||||
// strip tailing ', '
|
||||
ret.resize( ret.length() - 2 );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
//next step, make SelectOne take from the SelectAll cache if the SelectOne cache is missing.
|
||||
//To do this, need to build a map of PK->ROW for the cache result.
|
||||
bool DATABASE_CONNECTION::SelectOne( const std::string& aTable,
|
||||
const std::pair<std::string, std::string>& aWhere,
|
||||
DATABASE_CONNECTION::ROW& aResult )
|
||||
@@ -311,6 +329,18 @@ bool DATABASE_CONNECTION::SelectOne( const std::string& aTable,
|
||||
}
|
||||
|
||||
const std::string& tableName = tableMapIter->first;
|
||||
DB_CACHE_TYPE::CACHE_VALUE cacheEntry;
|
||||
|
||||
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 ) )
|
||||
{
|
||||
@@ -332,19 +362,15 @@ bool DATABASE_CONNECTION::SelectOne( const std::string& aTable,
|
||||
|
||||
std::string cacheKey = fmt::format( "{}{}{}", tableName, columnName, aWhere.second );
|
||||
|
||||
std::string queryStr = fmt::format( "SELECT * FROM {}{}{} WHERE {}{}{} = ?",
|
||||
std::string queryStr = fmt::format( "SELECT {} FROM {}{}{} WHERE {}{}{} = ?",
|
||||
columnsFor( tableName ),
|
||||
m_quoteChar, tableName, m_quoteChar,
|
||||
m_quoteChar, columnName, m_quoteChar );
|
||||
|
||||
nanodbc::statement statement( *m_conn );
|
||||
nanodbc::string query = fromUTF8( queryStr );
|
||||
|
||||
if( m_cache->Get( cacheKey, aResult ) )
|
||||
{
|
||||
wxLogTrace( traceDatabase, wxT( "SelectOne: `%s` with parameter `%s` - cache hit" ),
|
||||
toUTF8( query ), aWhere.second );
|
||||
return true;
|
||||
}
|
||||
PROF_TIMER timer;
|
||||
|
||||
try
|
||||
{
|
||||
@@ -384,14 +410,17 @@ bool DATABASE_CONNECTION::SelectOne( const std::string& aTable,
|
||||
return false;
|
||||
}
|
||||
|
||||
timer.Stop();
|
||||
|
||||
|
||||
if( !results.first() )
|
||||
{
|
||||
wxLogTrace( traceDatabase, wxT( "SelectOne: no results returned from query" ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
wxLogTrace( traceDatabase, wxT( "SelectOne: %ld results returned from query" ),
|
||||
results.rows() );
|
||||
wxLogTrace( traceDatabase, wxT( "SelectOne: %ld results returned from query in %0.1f ms" ),
|
||||
results.rows(), timer.msecs() );
|
||||
|
||||
aResult.clear();
|
||||
|
||||
@@ -411,13 +440,12 @@ bool DATABASE_CONNECTION::SelectOne( const std::string& aTable,
|
||||
return false;
|
||||
}
|
||||
|
||||
m_cache->Put( cacheKey, aResult );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool DATABASE_CONNECTION::SelectAll( const std::string& aTable, std::vector<ROW>& aResults )
|
||||
bool DATABASE_CONNECTION::SelectAll( const std::string& aTable, const std::string& aKey,
|
||||
std::vector<ROW>& aResults )
|
||||
{
|
||||
if( !m_conn )
|
||||
{
|
||||
@@ -434,13 +462,27 @@ bool DATABASE_CONNECTION::SelectAll( const std::string& aTable, std::vector<ROW>
|
||||
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 {}{}{}", m_quoteChar,
|
||||
tableMapIter->first, m_quoteChar ) );
|
||||
nanodbc::string query = fromUTF8( fmt::format( "SELECT {} FROM {}{}{}", columnsFor( aTable ),
|
||||
m_quoteChar, aTable, m_quoteChar ) );
|
||||
|
||||
wxLogTrace( traceDatabase, wxT( "SelectAll: `%s`" ), toUTF8( query ) );
|
||||
|
||||
PROF_TIMER timer;
|
||||
|
||||
try
|
||||
{
|
||||
statement.prepare( query );
|
||||
@@ -475,6 +517,8 @@ bool DATABASE_CONNECTION::SelectAll( const std::string& aTable, std::vector<ROW>
|
||||
return false;
|
||||
}
|
||||
|
||||
timer.Stop();
|
||||
|
||||
try
|
||||
{
|
||||
while( results.next() )
|
||||
@@ -498,5 +542,17 @@ bool DATABASE_CONNECTION::SelectAll( const std::string& aTable, std::vector<ROW>
|
||||
return false;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -74,6 +74,11 @@ DATABASE_LIB_SETTINGS::DATABASE_LIB_SETTINGS( const std::string& aFilename ) :
|
||||
table.symbols_col = entry["symbols"].get<std::string>();
|
||||
table.footprints_col = entry["footprints"].get<std::string>();
|
||||
|
||||
// Sanitize library display names; currently only `/` is removed because we use it
|
||||
// as a separator and allow it in symbol names.
|
||||
table.name.erase( std::remove( table.name.begin(), table.name.end(), '/' ),
|
||||
table.name.end() );
|
||||
|
||||
if( entry.contains( "properties" ) && entry["properties"].is_object() )
|
||||
{
|
||||
const nlohmann::json& pj = entry["properties"];
|
||||
|
||||
@@ -47,9 +47,9 @@ bool PANEL_DATA_COLLECTION::TransferDataToWindow()
|
||||
{
|
||||
applySettingsToPanel();
|
||||
|
||||
KIPLATFORM::POLICY::STATE policyState =
|
||||
KIPLATFORM::POLICY::GetPolicyState( POLICY_KEY_DATACOLLECTION );
|
||||
if( policyState != KIPLATFORM::POLICY::STATE::NOT_CONFIGURED )
|
||||
KIPLATFORM::POLICY::PBOOL policyState =
|
||||
KIPLATFORM::POLICY::GetPolicyBool( POLICY_KEY_DATACOLLECTION );
|
||||
if( policyState != KIPLATFORM::POLICY::PBOOL::NOT_CONFIGURED )
|
||||
{
|
||||
Disable();
|
||||
}
|
||||
|
||||
@@ -110,6 +110,7 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
|
||||
|
||||
EnableScrolling( false, false ); // otherwise Zoom Auto disables GAL canvas
|
||||
KIPLATFORM::UI::SetOverlayScrolling( this, false ); // Prevent excessive repaint on GTK
|
||||
KIPLATFORM::UI::ImmControl( this, false ); // Ensure our panel can't suck in IME events
|
||||
|
||||
Connect( wxEVT_SIZE, wxSizeEventHandler( EDA_DRAW_PANEL_GAL::onSize ), nullptr, this );
|
||||
Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( EDA_DRAW_PANEL_GAL::onEnter ), nullptr,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013-2016 CERN
|
||||
* Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2019-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* @author Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
*
|
||||
@@ -247,13 +247,14 @@ void DS_DATA_MODEL_IO::format( DS_DATA_ITEM_TEXT* aItem, int aNestLevel ) const
|
||||
// Write font info, only if it is not the default setup
|
||||
bool write_size = aItem->m_TextSize.x != 0.0 || aItem->m_TextSize.y != 0.0;
|
||||
bool write_thickness = aItem->m_LineWidth != 0.0;
|
||||
bool write_face = aItem->m_Font && !aItem->m_Font->GetName().IsEmpty();
|
||||
|
||||
if( write_thickness || write_size || aItem->m_Bold
|
||||
|| aItem->m_Italic || aItem->m_TextColor != COLOR4D::UNSPECIFIED )
|
||||
if( write_thickness || write_size || aItem->m_Bold || aItem->m_Italic
|
||||
|| write_face || aItem->m_TextColor != COLOR4D::UNSPECIFIED )
|
||||
{
|
||||
m_out->Print( 0, " (font" );
|
||||
|
||||
if( aItem->m_Font && !aItem->m_Font->GetName().IsEmpty() )
|
||||
if( write_face )
|
||||
m_out->Print( 0, " (face \"%s\")", aItem->m_Font->NameAsToken() );
|
||||
|
||||
if( write_thickness )
|
||||
|
||||
@@ -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-2021 Kicad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2012-2023 Kicad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2017-2018 CERN
|
||||
*
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
@@ -537,17 +537,27 @@ void CAIRO_GAL_BASE::DrawBitmap( const BITMAP_BASE& aBitmap, double alphaBlend )
|
||||
{
|
||||
for( int col = 0; col < w; col++ )
|
||||
{
|
||||
// Build the RGB24 pixel:
|
||||
uint32_t pixel = bm_pix_buffer.GetRed( col, row ) << 16;
|
||||
pixel += bm_pix_buffer.GetGreen( col, row ) << 8;
|
||||
pixel += bm_pix_buffer.GetBlue( col, row );
|
||||
unsigned char r = bm_pix_buffer.GetRed( col, row );
|
||||
unsigned char g = bm_pix_buffer.GetGreen( col, row );
|
||||
unsigned char b = bm_pix_buffer.GetBlue( col, row );
|
||||
unsigned char a = wxALPHA_OPAQUE;
|
||||
|
||||
if( bm_pix_buffer.HasAlpha() )
|
||||
pixel += bm_pix_buffer.GetAlpha( col, row ) << 24;
|
||||
else if( bm_pix_buffer.HasMask() && pixel == mask_color )
|
||||
pixel += ( wxALPHA_TRANSPARENT << 24 );
|
||||
else
|
||||
pixel += ( wxALPHA_OPAQUE << 24 );
|
||||
{
|
||||
a = bm_pix_buffer.GetAlpha( col, row );
|
||||
|
||||
// ARGB32 format needs pre-multiplied alpha
|
||||
r = int32_t( r ) * a / 0xFF;
|
||||
g = int32_t( g ) * a / 0xFF;
|
||||
b = int32_t( b ) * a / 0xFF;
|
||||
}
|
||||
else if( bm_pix_buffer.HasMask() && ( r << 16 | g << 8 | b ) == mask_color )
|
||||
{
|
||||
a = wxALPHA_TRANSPARENT;
|
||||
}
|
||||
|
||||
// Build the ARGB24 pixel:
|
||||
uint32_t pixel = a << 24 | r << 16 | g << 8 | b;
|
||||
|
||||
// Write the pixel to the cairo image buffer:
|
||||
uint32_t* pix_ptr = (uint32_t*) pix_buffer;
|
||||
|
||||
@@ -2257,13 +2257,13 @@ void OPENGL_GAL::drawSegmentChain( const std::function<VECTOR2D( int )>& aPointG
|
||||
auto start = aPointGetter( i - 1 );
|
||||
auto end = aPointGetter( i );
|
||||
|
||||
VECTOR2D startEndVector = start - end;
|
||||
VECTOR2D startEndVector = end - start;
|
||||
double lineLength = startEndVector.EuclideanNorm();
|
||||
|
||||
float startx = start.x;
|
||||
float starty = end.y;
|
||||
float starty = start.y;
|
||||
float endx = start.x + lineLength;
|
||||
float endy = end.y + lineLength;
|
||||
float endy = start.y + lineLength;
|
||||
|
||||
// Be careful about floating point rounding. As we draw segments in larger and larger
|
||||
// coordinates, the shader (which uses floats) will lose precision and stop drawing small
|
||||
|
||||
@@ -41,6 +41,8 @@
|
||||
#include <kiplatform/environment.h>
|
||||
#include <pgm_base.h>
|
||||
|
||||
#include <kiplatform/policy.h>
|
||||
#include <policy_keys.h>
|
||||
|
||||
struct CURL_PROGRESS
|
||||
{
|
||||
@@ -127,11 +129,29 @@ KICAD_CURL_EASY::KICAD_CURL_EASY() :
|
||||
curl_easy_setopt( m_CURL, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS );
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _WIN32
|
||||
// We need this to use the Windows Certificate store
|
||||
curl_easy_setopt( m_CURL, CURLOPT_SSL_OPTIONS, CURLSSLOPT_NATIVE_CA );
|
||||
long sslOpts = CURLSSLOPT_NATIVE_CA;
|
||||
|
||||
POLICY_CURL_SSL_REVOKE policyState = KIPLATFORM::POLICY::GetPolicyEnum<POLICY_CURL_SSL_REVOKE>( POLICY_KEY_REQUESTS_CURL_REVOKE );
|
||||
if( policyState == POLICY_CURL_SSL_REVOKE::BEST_EFFORT )
|
||||
{
|
||||
sslOpts |= CURLSSLOPT_REVOKE_BEST_EFFORT;
|
||||
}
|
||||
else if( policyState == POLICY_CURL_SSL_REVOKE::NONE )
|
||||
{
|
||||
sslOpts |= CURLSSLOPT_NO_REVOKE;
|
||||
}
|
||||
|
||||
curl_easy_setopt( m_CURL, CURLOPT_SSL_OPTIONS, sslOpts );
|
||||
#endif
|
||||
|
||||
if( wxGetEnv( wxT( "KICAD_CURL_VERBOSE" ), nullptr ) )
|
||||
{
|
||||
// note: curl verbose will end up in stderr
|
||||
curl_easy_setopt( m_CURL, CURLOPT_VERBOSE, 1L );
|
||||
}
|
||||
|
||||
wxPlatformInfo platformInfo;
|
||||
wxString application( Pgm().App().GetAppName() );
|
||||
wxString version( GetBuildVersion() );
|
||||
|
||||
@@ -646,7 +646,7 @@ void dumpNode( wxString& buf, TREE_NODE* tok, int depth = 0 )
|
||||
|
||||
case TR_OP_FUNC_CALL:
|
||||
buf += "CALL '";
|
||||
buf += *tok->leaf[0]->value.str;
|
||||
buf += formatNode( tok->leaf[0] );
|
||||
buf += "': ";
|
||||
dumpNode( buf, tok->leaf[1], depth + 1 );
|
||||
break;
|
||||
@@ -786,7 +786,7 @@ static std::vector<TREE_NODE*> squashParamList( TREE_NODE* root )
|
||||
std::reverse( args.begin(), args.end() );
|
||||
|
||||
for( size_t i = 0; i < args.size(); i++ )
|
||||
libeval_dbg( 10, "squash arg%d: %s\n", int( i ), *args[i]->value.str );
|
||||
libeval_dbg( 10, "squash arg%d: %s\n", int( i ), formatNode( args[i] ) );
|
||||
|
||||
return args;
|
||||
}
|
||||
@@ -845,7 +845,7 @@ bool COMPILER::generateUCode( UCODE* aCode, CONTEXT* aPreflightContext )
|
||||
int pos = node->leaf[0]->srcPos;
|
||||
|
||||
if( node->leaf[0]->value.str )
|
||||
pos -= static_cast<int>( node->leaf[0]->value.str->length() );
|
||||
pos -= static_cast<int>( formatNode( node->leaf[0] ).length() );
|
||||
|
||||
reportError( CST_CODEGEN, _( "Unknown parent of property" ), pos );
|
||||
|
||||
@@ -864,8 +864,8 @@ bool COMPILER::generateUCode( UCODE* aCode, CONTEXT* aPreflightContext )
|
||||
// leaf[0]: object
|
||||
// leaf[1]: field
|
||||
|
||||
wxString itemName = *node->leaf[0]->value.str;
|
||||
wxString propName = *node->leaf[1]->value.str;
|
||||
wxString itemName = formatNode( node->leaf[0] );
|
||||
wxString propName = formatNode( node->leaf[1] );
|
||||
std::unique_ptr<VAR_REF> vref = aCode->CreateVarRef( itemName, propName );
|
||||
|
||||
if( !vref )
|
||||
@@ -895,7 +895,7 @@ bool COMPILER::generateUCode( UCODE* aCode, CONTEXT* aPreflightContext )
|
||||
// leaf[0]: function name
|
||||
// leaf[1]: parameter
|
||||
|
||||
wxString itemName = *node->leaf[0]->value.str;
|
||||
wxString itemName = formatNode( node->leaf[0] );
|
||||
std::unique_ptr<VAR_REF> vref = aCode->CreateVarRef( itemName, "" );
|
||||
|
||||
if( !vref )
|
||||
@@ -905,7 +905,7 @@ bool COMPILER::generateUCode( UCODE* aCode, CONTEXT* aPreflightContext )
|
||||
node->leaf[0]->srcPos - (int) itemName.length() );
|
||||
}
|
||||
|
||||
wxString functionName = *node->leaf[1]->leaf[0]->value.str;
|
||||
wxString functionName = formatNode( node->leaf[1]->leaf[0] );
|
||||
auto func = aCode->CreateFuncCall( functionName );
|
||||
std::vector<TREE_NODE*> params = squashParamList( node->leaf[1]->leaf[1] );
|
||||
|
||||
@@ -924,7 +924,7 @@ bool COMPILER::generateUCode( UCODE* aCode, CONTEXT* aPreflightContext )
|
||||
for( TREE_NODE* pnode : params )
|
||||
{
|
||||
VALUE* param = aPreflightContext->AllocValue();
|
||||
param->Set( *pnode->value.str );
|
||||
param->Set( formatNode( pnode ) );
|
||||
aPreflightContext->Push( param );
|
||||
}
|
||||
|
||||
@@ -968,8 +968,8 @@ bool COMPILER::generateUCode( UCODE* aCode, CONTEXT* aPreflightContext )
|
||||
// leaf[0]: object
|
||||
// leaf[1]: malformed syntax
|
||||
|
||||
wxString itemName = *node->leaf[0]->value.str;
|
||||
wxString propName = *node->leaf[1]->value.str;
|
||||
wxString itemName = formatNode( node->leaf[0] );
|
||||
wxString propName = formatNode( node->leaf[1] );
|
||||
std::unique_ptr<VAR_REF> vref = aCode->CreateVarRef( itemName, propName );
|
||||
|
||||
if( !vref )
|
||||
@@ -1006,12 +1006,12 @@ bool COMPILER::generateUCode( UCODE* aCode, CONTEXT* aPreflightContext )
|
||||
{
|
||||
if( m_unitResolver->GetSupportedUnits().empty() )
|
||||
{
|
||||
msg.Printf( _( "Unexpected units for '%s'" ), *node->value.str );
|
||||
msg.Printf( _( "Unexpected units for '%s'" ), formatNode( node ) );
|
||||
reportError( CST_CODEGEN, msg, node->srcPos );
|
||||
}
|
||||
|
||||
int units = son->value.idx;
|
||||
value = m_unitResolver->Convert( *node->value.str, units );
|
||||
value = m_unitResolver->Convert( formatNode( node ), units );
|
||||
son->isVisited = true;
|
||||
}
|
||||
else
|
||||
@@ -1019,12 +1019,12 @@ bool COMPILER::generateUCode( UCODE* aCode, CONTEXT* aPreflightContext )
|
||||
if( !m_unitResolver->GetSupportedUnitsMessage().empty() )
|
||||
{
|
||||
msg.Printf( _( "Missing units for '%s'| (%s)" ),
|
||||
*node->value.str,
|
||||
formatNode( node ),
|
||||
m_unitResolver->GetSupportedUnitsMessage() );
|
||||
reportError( CST_CODEGEN, msg, node->srcPos );
|
||||
}
|
||||
|
||||
value = EDA_UNIT_UTILS::UI::DoubleValueFromString( *node->value.str );
|
||||
value = EDA_UNIT_UTILS::UI::DoubleValueFromString( formatNode( node ) );
|
||||
}
|
||||
|
||||
node->SetUop( TR_UOP_PUSH_VALUE, value );
|
||||
@@ -1034,7 +1034,7 @@ bool COMPILER::generateUCode( UCODE* aCode, CONTEXT* aPreflightContext )
|
||||
|
||||
case TR_STRING:
|
||||
{
|
||||
wxString str = *node->value.str;
|
||||
wxString str = formatNode( node );
|
||||
bool isWildcard = str.Contains("?") || str.Contains("*");
|
||||
node->SetUop( TR_UOP_PUSH_VALUE, str, isWildcard );
|
||||
node->isTerminal = true;
|
||||
@@ -1043,12 +1043,12 @@ bool COMPILER::generateUCode( UCODE* aCode, CONTEXT* aPreflightContext )
|
||||
|
||||
case TR_IDENTIFIER:
|
||||
{
|
||||
std::unique_ptr<VAR_REF> vref = aCode->CreateVarRef( *node->value.str, "" );
|
||||
std::unique_ptr<VAR_REF> vref = aCode->CreateVarRef( formatNode( node ), "" );
|
||||
|
||||
if( !vref )
|
||||
{
|
||||
msg.Printf( _( "Unrecognized item '%s'" ), *node->value.str );
|
||||
reportError( CST_CODEGEN, msg, node->srcPos - (int) node->value.str->length() );
|
||||
msg.Printf( _( "Unrecognized item '%s'" ), formatNode( node ) );
|
||||
reportError( CST_CODEGEN, msg, node->srcPos - (int) formatNode( node ).length() );
|
||||
}
|
||||
|
||||
node->SetUop( TR_UOP_PUSH_VAR, std::move( vref ) );
|
||||
|
||||
+10
-10
@@ -238,11 +238,11 @@ const wxString PGM_BASE::AskUserForPreferredEditor( const wxString& aDefaultEdit
|
||||
#ifdef KICAD_USE_SENTRY
|
||||
bool PGM_BASE::IsSentryOptedIn()
|
||||
{
|
||||
KIPLATFORM::POLICY::STATE policyState =
|
||||
KIPLATFORM::POLICY::GetPolicyState( POLICY_KEY_DATACOLLECTION );
|
||||
if( policyState != KIPLATFORM::POLICY::STATE::NOT_CONFIGURED )
|
||||
KIPLATFORM::POLICY::PBOOL policyState =
|
||||
KIPLATFORM::POLICY::GetPolicyBool( POLICY_KEY_DATACOLLECTION );
|
||||
if( policyState != KIPLATFORM::POLICY::PBOOL::NOT_CONFIGURED )
|
||||
{
|
||||
return policyState == KIPLATFORM::POLICY::STATE::ENABLED;
|
||||
return policyState == KIPLATFORM::POLICY::PBOOL::ENABLED;
|
||||
}
|
||||
|
||||
return m_sentry_optin_fn.Exists();
|
||||
@@ -349,10 +349,10 @@ void PGM_BASE::sentryPrompt()
|
||||
if( !IsGUI() )
|
||||
return;
|
||||
|
||||
KIPLATFORM::POLICY::STATE policyState =
|
||||
KIPLATFORM::POLICY::GetPolicyState( POLICY_KEY_DATACOLLECTION );
|
||||
KIPLATFORM::POLICY::PBOOL policyState =
|
||||
KIPLATFORM::POLICY::GetPolicyBool( POLICY_KEY_DATACOLLECTION );
|
||||
|
||||
if( policyState == KIPLATFORM::POLICY::STATE::NOT_CONFIGURED
|
||||
if( policyState == KIPLATFORM::POLICY::PBOOL::NOT_CONFIGURED
|
||||
&& !m_settings_manager->GetCommonSettings()->m_DoNotShowAgain.data_collection_prompt )
|
||||
{
|
||||
wxMessageDialog optIn = wxMessageDialog(
|
||||
@@ -655,7 +655,7 @@ bool PGM_BASE::SetLanguage( wxString& aErrMsg, bool first_time )
|
||||
|
||||
// don't use wxLOCALE_LOAD_DEFAULT flag so that Init() doesn't return
|
||||
// false just because it failed to load wxstd catalog
|
||||
if( !m_locale->Init( m_language_id, wxLOCALE_DONT_LOAD_DEFAULT ) )
|
||||
if( !m_locale->Init( m_language_id ) )
|
||||
{
|
||||
wxLogTrace( traceLocale, wxT( "This language is not supported by the system." ) );
|
||||
|
||||
@@ -663,7 +663,7 @@ bool PGM_BASE::SetLanguage( wxString& aErrMsg, bool first_time )
|
||||
delete m_locale;
|
||||
|
||||
m_locale = new wxLocale;
|
||||
m_locale->Init( wxLANGUAGE_DEFAULT, wxLOCALE_DONT_LOAD_DEFAULT);
|
||||
m_locale->Init( wxLANGUAGE_DEFAULT );
|
||||
|
||||
aErrMsg = _( "This language is not supported by the operating system." );
|
||||
return false;
|
||||
@@ -714,7 +714,7 @@ bool PGM_BASE::SetLanguage( wxString& aErrMsg, bool first_time )
|
||||
delete m_locale;
|
||||
|
||||
m_locale = new wxLocale;
|
||||
m_locale->Init( wxLANGUAGE_DEFAULT, wxLOCALE_DONT_LOAD_DEFAULT);
|
||||
m_locale->Init( wxLANGUAGE_DEFAULT );
|
||||
|
||||
aErrMsg = _( "The KiCad language file for this language is not installed." );
|
||||
return false;
|
||||
|
||||
@@ -1217,7 +1217,7 @@ bool PDF_PLOTTER::EndPlot()
|
||||
|
||||
js += wxT( "var cChoice = app.popUpMenuEx.apply\\( app, aParams \\); " );
|
||||
js += wxT( "if\\( cChoice != null && cChoice.substring\\( 0, 1 \\) == '#' \\)"
|
||||
" this.pageNum = cChoice.slice\\( 1 \\); " );
|
||||
" this.pageNum = parseInt\\( cChoice.slice\\( 1 \\) \\); " );
|
||||
js += wxT( "else if\\( cChoice != null && cChoice.substring\\( 0, 4 \\) == 'http' \\)"
|
||||
" app.launchURL\\( cChoice \\);" );
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
|
||||
case WSG_POLY_T:
|
||||
{
|
||||
DS_DRAW_ITEM_POLYPOLYGONS* poly = (DS_DRAW_ITEM_POLYPOLYGONS*) item;
|
||||
int penWidth = std::max( poly->GetPenWidth(), defaultPenWidth );
|
||||
int penWidth = poly->GetPenWidth();
|
||||
std::vector<VECTOR2I> points;
|
||||
|
||||
for( int idx = 0; idx < poly->GetPolygons().OutlineCount(); ++idx )
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* 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) 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
|
||||
@@ -88,26 +89,106 @@ ALTIUM_COMPOUND_FILE::ALTIUM_COMPOUND_FILE( const wxString& aFilePath )
|
||||
}
|
||||
|
||||
|
||||
static const CFB::COMPOUND_FILE_ENTRY*
|
||||
FindStreamSingleLevel( const CFB::CompoundFileReader& aReader,
|
||||
const CFB::COMPOUND_FILE_ENTRY* aEntry, const std::string aName,
|
||||
const bool aIsStream )
|
||||
std::map<wxString, wxString> ALTIUM_COMPOUND_FILE::ListLibFootprints() const
|
||||
{
|
||||
std::map<wxString, wxString> patternMap;
|
||||
|
||||
if( !m_reader )
|
||||
return patternMap;
|
||||
|
||||
const CFB::COMPOUND_FILE_ENTRY* root = m_reader->GetRootEntry();
|
||||
|
||||
if( !root )
|
||||
return patternMap;
|
||||
|
||||
m_reader->EnumFiles( root, 2,
|
||||
[&]( const CFB::COMPOUND_FILE_ENTRY* entry, const CFB::utf16string& dir,
|
||||
int level ) -> void
|
||||
{
|
||||
std::wstring dirName = UTF16ToWstring( dir.data(), dir.size() );
|
||||
std::wstring fileName = UTF16ToWstring( entry->name, entry->nameLen );
|
||||
|
||||
if( m_reader->IsStream( entry ) && fileName == L"Parameters" )
|
||||
{
|
||||
ALTIUM_PARSER parametersReader( *this, entry );
|
||||
std::map<wxString, wxString> parameterProperties =
|
||||
parametersReader.ReadProperties();
|
||||
|
||||
wxString key = ALTIUM_PARSER::ReadString(
|
||||
parameterProperties, wxT( "PATTERN" ), wxT( "" ) );
|
||||
|
||||
wxString fpName = ALTIUM_PARSER::ReadUnicodeString(
|
||||
parameterProperties, wxT( "PATTERN" ), wxT( "" ) );
|
||||
|
||||
patternMap.emplace( key, fpName );
|
||||
}
|
||||
} );
|
||||
|
||||
return patternMap;
|
||||
}
|
||||
|
||||
|
||||
wxString ALTIUM_COMPOUND_FILE::FindLibFootprintDirName( const wxString& aFpUnicodeName ) const
|
||||
{
|
||||
if( !m_reader )
|
||||
return wxEmptyString;
|
||||
|
||||
const CFB::COMPOUND_FILE_ENTRY* root = m_reader->GetRootEntry();
|
||||
|
||||
if( !root )
|
||||
return wxEmptyString;
|
||||
|
||||
wxString ret;
|
||||
|
||||
m_reader->EnumFiles( root, 2,
|
||||
[&]( const CFB::COMPOUND_FILE_ENTRY* entry, const CFB::utf16string& dir,
|
||||
int level ) -> void
|
||||
{
|
||||
std::wstring dirName = UTF16ToWstring( dir.data(), dir.size() );
|
||||
std::wstring fileName = UTF16ToWstring( entry->name, entry->nameLen );
|
||||
|
||||
if( m_reader->IsStream( entry ) && fileName == L"Parameters" )
|
||||
{
|
||||
ALTIUM_PARSER parametersReader( *this, entry );
|
||||
std::map<wxString, wxString> parameterProperties =
|
||||
parametersReader.ReadProperties();
|
||||
|
||||
wxString fpName = ALTIUM_PARSER::ReadUnicodeString(
|
||||
parameterProperties, wxT( "PATTERN" ), wxT( "" ) );
|
||||
|
||||
if( fpName == aFpUnicodeName )
|
||||
{
|
||||
ret = dirName;
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
const CFB::COMPOUND_FILE_ENTRY*
|
||||
ALTIUM_COMPOUND_FILE::FindStreamSingleLevel( const CFB::COMPOUND_FILE_ENTRY* aEntry,
|
||||
const std::string aName, const bool aIsStream ) const
|
||||
{
|
||||
if( !m_reader || !aEntry )
|
||||
return nullptr;
|
||||
|
||||
const CFB::COMPOUND_FILE_ENTRY* ret = nullptr;
|
||||
|
||||
aReader.EnumFiles( aEntry, 1,
|
||||
[&]( const CFB::COMPOUND_FILE_ENTRY* entry, const CFB::utf16string& dir,
|
||||
int level ) -> void
|
||||
{
|
||||
if( aReader.IsStream( entry ) == aIsStream )
|
||||
{
|
||||
std::string name = UTF16ToUTF8( entry->name );
|
||||
if( name == aName.c_str() )
|
||||
{
|
||||
ret = entry;
|
||||
}
|
||||
}
|
||||
} );
|
||||
m_reader->EnumFiles( aEntry, 1,
|
||||
[&]( const CFB::COMPOUND_FILE_ENTRY* entry, const CFB::utf16string& dir,
|
||||
int level ) -> void
|
||||
{
|
||||
if( m_reader->IsStream( entry ) == aIsStream )
|
||||
{
|
||||
std::string name = UTF16ToUTF8( entry->name );
|
||||
if( name == aName.c_str() )
|
||||
{
|
||||
ret = entry;
|
||||
}
|
||||
}
|
||||
} );
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -116,9 +197,7 @@ const CFB::COMPOUND_FILE_ENTRY*
|
||||
ALTIUM_COMPOUND_FILE::FindStream( const std::vector<std::string>& aStreamPath ) const
|
||||
{
|
||||
if( !m_reader )
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const CFB::COMPOUND_FILE_ENTRY* currentDirEntry = m_reader->GetRootEntry();
|
||||
|
||||
@@ -129,12 +208,11 @@ ALTIUM_COMPOUND_FILE::FindStream( const std::vector<std::string>& aStreamPath )
|
||||
|
||||
if( ++it == aStreamPath.cend() )
|
||||
{
|
||||
return FindStreamSingleLevel( *m_reader.get(), currentDirEntry, name, true );
|
||||
return FindStreamSingleLevel( currentDirEntry, name, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
currentDirEntry =
|
||||
FindStreamSingleLevel( *m_reader.get(), currentDirEntry, name, false );
|
||||
currentDirEntry = FindStreamSingleLevel( currentDirEntry, name, false );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,9 +310,12 @@ std::map<wxString, wxString> ALTIUM_PARSER::ReadProperties()
|
||||
else
|
||||
value = wxString( valueS.c_str(), wxConvISO8859_1 );
|
||||
|
||||
// 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( " " ) );
|
||||
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( " " ) );
|
||||
}
|
||||
|
||||
if( canonicalKey == wxT( "DESIGNATOR" )
|
||||
|| canonicalKey == wxT( "NAME" )
|
||||
@@ -341,3 +422,28 @@ wxString ALTIUM_PARSER::ReadString( const std::map<wxString, wxString>& aProps,
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* 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 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2020-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
|
||||
@@ -63,8 +63,16 @@ public:
|
||||
|
||||
const CFB::CompoundFileReader& GetCompoundFileReader() const { return *m_reader; }
|
||||
|
||||
std::map<wxString, wxString> ListLibFootprints() const;
|
||||
|
||||
wxString FindLibFootprintDirName( const wxString& aFpUnicodeName ) const;
|
||||
|
||||
const CFB::COMPOUND_FILE_ENTRY* FindStream( const std::vector<std::string>& aStreamPath ) const;
|
||||
|
||||
const CFB::COMPOUND_FILE_ENTRY* FindStreamSingleLevel( const CFB::COMPOUND_FILE_ENTRY* aEntry,
|
||||
const std::string aName,
|
||||
const bool aIsStream ) const;
|
||||
|
||||
private:
|
||||
std::unique_ptr<CFB::CompoundFileReader> m_reader;
|
||||
std::vector<char> m_buffer;
|
||||
@@ -107,24 +115,31 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
wxString ReadWxString()
|
||||
wxScopedCharBuffer ReadCharBuffer()
|
||||
{
|
||||
uint8_t len = Read<uint8_t>();
|
||||
if( GetRemainingBytes() >= len )
|
||||
{
|
||||
// TODO: Identify where the actual code page is stored. For now, this default code page
|
||||
// has limited impact, because recent Altium files come with a UTF16 string table
|
||||
wxString val = wxString( m_pos, wxConvISO8859_1, len );
|
||||
char* buf = new char[len];
|
||||
memcpy( buf, m_pos, len );
|
||||
m_pos += len;
|
||||
return val;
|
||||
|
||||
return wxScopedCharBuffer::CreateOwned( buf, len );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_error = true;
|
||||
return wxString( "" );
|
||||
return wxScopedCharBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
wxString ReadWxString()
|
||||
{
|
||||
// TODO: Identify where the actual code page is stored. For now, this default code page
|
||||
// has limited impact, because recent Altium files come with a UTF16 string table
|
||||
return wxString( ReadCharBuffer(), wxConvISO8859_1 );
|
||||
}
|
||||
|
||||
std::map<uint32_t, wxString> ReadWideStringTable()
|
||||
{
|
||||
std::map<uint32_t, wxString> table;
|
||||
@@ -225,6 +240,9 @@ public:
|
||||
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 )
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017-2022 Kicad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2017-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
|
||||
@@ -117,6 +117,12 @@ bool POLYGON_GEOM_MANAGER::IsPolygonInProgress() const
|
||||
}
|
||||
|
||||
|
||||
int POLYGON_GEOM_MANAGER::PolygonPointCount() const
|
||||
{
|
||||
return m_lockedPoints.PointCount();
|
||||
}
|
||||
|
||||
|
||||
bool POLYGON_GEOM_MANAGER::NewPointClosesOutline( const VECTOR2I& aPt ) const
|
||||
{
|
||||
return m_lockedPoints.PointCount() > 0 && m_lockedPoints.CPoint( 0 ) == aPt;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2019-2021 Kicad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2019-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
|
||||
@@ -154,6 +154,22 @@ void KIGFX::PREVIEW::DrawTextNextToCursor( KIGFX::VIEW* aView, const VECTOR2D& a
|
||||
textPos.x -= 15.0 / gal->GetWorldScale();
|
||||
}
|
||||
|
||||
// text is left (or right) aligned, so a shadow text need a small offset to be draw
|
||||
// around the basic text
|
||||
int shadowXoffset = aDrawingDropShadows ? textDims.ShadowWidth : 0;
|
||||
|
||||
// Due to the fact a shadow text is drawn left or right aligned,
|
||||
// it needs an offset = shadowWidth/2 to be drawn at the same place as normal text
|
||||
// But for some reason we need to slightly modify this offset
|
||||
// for a better look for KiCad font (better alignment of shadow shape)
|
||||
const float adjust = 1.2f; // Value chosen after tests
|
||||
shadowXoffset *= adjust;
|
||||
|
||||
if( ( textAttrs.m_Halign == GR_TEXT_H_ALIGN_LEFT ) != viewFlipped )
|
||||
textPos.x -= shadowXoffset;
|
||||
else
|
||||
textPos.x += shadowXoffset;
|
||||
|
||||
gal->SetStrokeColor( aView->GetPainter()->GetSettings()->GetLayerColor( LAYER_AUX_ITEMS ) );
|
||||
textAttrs.m_Mirrored = viewFlipped; // Prevent text flipping when view is flipped
|
||||
textAttrs.m_Size = textDims.GlyphSize;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017-2022 Kicad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2017-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,25 +167,50 @@ void drawTicksAlongLine( KIGFX::VIEW* aView, const VECTOR2D& aOrigin, const VECT
|
||||
EDA_ANGLE labelAngle = - EDA_ANGLE( tickLine );
|
||||
VECTOR2I labelOffset = tickLine.Resize( majorTickLen );
|
||||
|
||||
// text is left (or right) aligned, so shadow text need a small offset to be draw
|
||||
// around the basic text
|
||||
int shadowXoffset = 0;
|
||||
|
||||
if( aDrawingDropShadows )
|
||||
{
|
||||
labelDims.StrokeWidth += 2 * labelDims.ShadowWidth;
|
||||
shadowXoffset = labelDims.ShadowWidth;
|
||||
// Due to the fact a shadow text is drawn left or right aligned,
|
||||
// it needs an offset = shadowXoffset to be drawn at the same place as normal text
|
||||
// But for some reason we need to slightly modify this offset
|
||||
// for a better look for KiCad font (better alignment of shadow shape)
|
||||
const float adjust = 1.2f; // Value chosen after tests
|
||||
shadowXoffset *= adjust;
|
||||
}
|
||||
|
||||
if( aView->IsMirroredX() )
|
||||
{
|
||||
labelOffset = -labelOffset;
|
||||
shadowXoffset = -shadowXoffset;
|
||||
}
|
||||
|
||||
TEXT_ATTRIBUTES labelAttrs;
|
||||
labelAttrs.m_Size = labelDims.GlyphSize;
|
||||
labelAttrs.m_StrokeWidth = labelDims.StrokeWidth;
|
||||
labelAttrs.m_Mirrored = aView->IsMirroredX(); // Prevent text mirrored when view is mirrored
|
||||
|
||||
if( EDA_ANGLE( aLine ) > ANGLE_0 )
|
||||
{
|
||||
labelAttrs.m_Halign = GR_TEXT_H_ALIGN_LEFT;
|
||||
labelAttrs.m_Angle = labelAngle;
|
||||
|
||||
// Adjust the text position of the shadow shape:
|
||||
labelOffset.x -= shadowXoffset * labelAttrs.m_Angle.Cos();;
|
||||
labelOffset.y += shadowXoffset * labelAttrs.m_Angle.Sin();;
|
||||
}
|
||||
else
|
||||
{
|
||||
labelAttrs.m_Halign = GR_TEXT_H_ALIGN_RIGHT;
|
||||
labelAttrs.m_Angle = labelAngle + ANGLE_180;
|
||||
|
||||
// Adjust the text position of the shadow shape:
|
||||
labelOffset.x += shadowXoffset * labelAttrs.m_Angle.Cos();;
|
||||
labelOffset.y -= shadowXoffset * labelAttrs.m_Angle.Sin();;
|
||||
}
|
||||
|
||||
BOX2D viewportD = aView->GetViewport();
|
||||
@@ -194,6 +219,8 @@ void drawTicksAlongLine( KIGFX::VIEW* aView, const VECTOR2D& aOrigin, const VECT
|
||||
viewport.Inflate( majorTickLen * 2 ); // Doesn't have to be accurate, just big enough not
|
||||
// to exclude anything that should be partially drawn
|
||||
|
||||
int isign = aView->IsMirroredX() ? -1 : 1;
|
||||
|
||||
for( int i = 0; i < numTicks; ++i )
|
||||
{
|
||||
const VECTOR2D tickPos = aOrigin + aLine.Resize( tickSpace * i );
|
||||
@@ -216,7 +243,7 @@ void drawTicksAlongLine( KIGFX::VIEW* aView, const VECTOR2D& aOrigin, const VECT
|
||||
}
|
||||
|
||||
gal->SetLineWidth( labelAttrs.m_StrokeWidth / 2 );
|
||||
gal->DrawLine( tickPos, tickPos + tickLine.Resize( length ) );
|
||||
gal->DrawLine( tickPos, tickPos + tickLine.Resize( length*isign ) );
|
||||
|
||||
if( drawLabel )
|
||||
{
|
||||
@@ -244,9 +271,10 @@ void drawBacksideTicks( KIGFX::VIEW* aView, const VECTOR2D& aOrigin, const VECTO
|
||||
TEXT_DIMS textDims = GetConstantGlyphHeight( gal, -1 );
|
||||
const double backTickSpace = aLine.EuclideanNorm() / aNumDivisions;
|
||||
VECTOR2D backTickVec = aLine;
|
||||
int isign = aView->IsMirroredX() ? -1 : 1;
|
||||
|
||||
RotatePoint( backTickVec, -ANGLE_90 );
|
||||
backTickVec = backTickVec.Resize( aTickLen );
|
||||
backTickVec = backTickVec.Resize( aTickLen * isign );
|
||||
|
||||
BOX2D viewportD = aView->GetViewport();
|
||||
BOX2I viewport( VECTOR2I( viewportD.GetPosition() ), VECTOR2I( viewportD.GetSize() ) );
|
||||
|
||||
+37
-12
@@ -159,6 +159,21 @@ void SCINTILLA_TRICKS::onCharHook( wxKeyEvent& aEvent )
|
||||
{
|
||||
wxString c = aEvent.GetUnicodeKey();
|
||||
|
||||
if( m_te->AutoCompActive() )
|
||||
{
|
||||
if( aEvent.GetKeyCode() == WXK_ESCAPE )
|
||||
{
|
||||
m_te->AutoCompCancel();
|
||||
m_suppressAutocomplete = true; // Don't run autocomplete again on the next char...
|
||||
}
|
||||
else
|
||||
{
|
||||
aEvent.Skip();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if( !isalpha( aEvent.GetKeyCode() ) )
|
||||
m_suppressAutocomplete = false;
|
||||
|
||||
@@ -260,18 +275,6 @@ void SCINTILLA_TRICKS::onCharHook( wxKeyEvent& aEvent )
|
||||
if( m_te->GetSelectionEnd() > m_te->GetSelectionStart() )
|
||||
m_te->DeleteBack();
|
||||
}
|
||||
else if( aEvent.GetKeyCode() == WXK_ESCAPE )
|
||||
{
|
||||
if( m_te->AutoCompActive() )
|
||||
{
|
||||
m_te->AutoCompCancel();
|
||||
m_suppressAutocomplete = true; // Don't run autocomplete again on the next char...
|
||||
}
|
||||
else
|
||||
{
|
||||
aEvent.Skip();
|
||||
}
|
||||
}
|
||||
else if( isCtrlSlash( aEvent ) )
|
||||
{
|
||||
int startLine = m_te->LineFromPosition( m_te->GetSelectionStart() );
|
||||
@@ -303,6 +306,28 @@ void SCINTILLA_TRICKS::onCharHook( wxKeyEvent& aEvent )
|
||||
{
|
||||
m_te->LineEndWrap();
|
||||
}
|
||||
else if( ( aEvent.GetModifiers() & wxMOD_RAW_CONTROL ) && aEvent.GetKeyCode() == 'B' )
|
||||
{
|
||||
if( aEvent.GetModifiers() & wxMOD_ALT )
|
||||
m_te->WordLeft();
|
||||
else
|
||||
m_te->CharLeft();
|
||||
}
|
||||
else if( ( aEvent.GetModifiers() & wxMOD_RAW_CONTROL ) && aEvent.GetKeyCode() == 'F' )
|
||||
{
|
||||
if( aEvent.GetModifiers() & wxMOD_ALT )
|
||||
m_te->WordRight();
|
||||
else
|
||||
m_te->CharRight();
|
||||
}
|
||||
else if( aEvent.GetModifiers() == wxMOD_RAW_CONTROL && aEvent.GetKeyCode() == 'D' )
|
||||
{
|
||||
if( m_te->GetSelectionEnd() == m_te->GetSelectionStart() )
|
||||
m_te->CharRightExtend();
|
||||
|
||||
if( m_te->GetSelectionEnd() > m_te->GetSelectionStart() )
|
||||
m_te->DeleteBack();
|
||||
}
|
||||
#endif
|
||||
else if( aEvent.GetKeyCode() == WXK_SPECIAL20 )
|
||||
{
|
||||
|
||||
@@ -56,11 +56,9 @@ VECTOR2I GRID_HELPER::GetGrid() const
|
||||
}
|
||||
|
||||
|
||||
VECTOR2I GRID_HELPER::GetVisibleGrid() const
|
||||
VECTOR2D GRID_HELPER::GetVisibleGrid() const
|
||||
{
|
||||
VECTOR2D size = m_toolMgr->GetView()->GetGAL()->GetVisibleGridSize();
|
||||
|
||||
return VECTOR2I( KiROUND( size.x ), KiROUND( size.y ) );
|
||||
return m_toolMgr->GetView()->GetGAL()->GetVisibleGridSize();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -276,12 +276,19 @@ void SCH_EDIT_FRAME::AnnotateSymbols( ANNOTATE_SCOPE_T aAnnotateScope,
|
||||
|
||||
case ANNOTATE_CURRENT_SHEET:
|
||||
currentSheet.GetMultiUnitSymbols( lockedSymbols );
|
||||
|
||||
if( aRecursive )
|
||||
subSheets.GetMultiUnitSymbols( lockedSymbols );
|
||||
|
||||
break;
|
||||
|
||||
case ANNOTATE_SELECTION:
|
||||
for( SCH_SYMBOL* symbol : selectedSymbols )
|
||||
currentSheet.AppendMultiUnitSymbol( lockedSymbols, symbol );
|
||||
|
||||
if( aRecursive )
|
||||
selectedSheets.GetMultiUnitSymbols( lockedSymbols );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -2178,7 +2178,7 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph, boo
|
||||
SCH_CONNECTION* conn = aSubgraph->m_driver_connection;
|
||||
std::vector<CONNECTION_SUBGRAPH*> search_list;
|
||||
std::unordered_set<CONNECTION_SUBGRAPH*> visited;
|
||||
std::vector<SCH_CONNECTION*> stale_bus_members;
|
||||
std::unordered_set<SCH_CONNECTION*> stale_bus_members;
|
||||
|
||||
auto visit =
|
||||
[&]( CONNECTION_SUBGRAPH* aParent )
|
||||
@@ -2290,7 +2290,7 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph, boo
|
||||
>= CONNECTION_SUBGRAPH::PRIORITY::POWER_PIN )
|
||||
{
|
||||
member->Clone( *neighbor_conn );
|
||||
stale_bus_members.push_back( member );
|
||||
stale_bus_members.insert( member );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2417,7 +2417,9 @@ void CONNECTION_GRAPH::propagateToNeighbors( CONNECTION_SUBGRAPH* aSubgraph, boo
|
||||
// member to have the correct connection info
|
||||
if( conn->IsBus() && !stale_bus_members.empty() )
|
||||
{
|
||||
for( SCH_CONNECTION* stale_member : stale_bus_members )
|
||||
std::unordered_set<SCH_CONNECTION*> cached_members = stale_bus_members;
|
||||
|
||||
for( SCH_CONNECTION* stale_member : cached_members )
|
||||
{
|
||||
for( CONNECTION_SUBGRAPH* subgraph : visited )
|
||||
{
|
||||
|
||||
@@ -242,7 +242,7 @@ void DIALOG_CHANGE_SYMBOLS::launchMatchIdSymbolBrowser( wxCommandEvent& aEvent )
|
||||
{
|
||||
wxString newName = getLibIdValue( m_specifiedId );
|
||||
|
||||
KIWAY_PLAYER* frame = Kiway().Player( FRAME_SCH_VIEWER_MODAL, true );
|
||||
KIWAY_PLAYER* frame = Kiway().Player( FRAME_SCH_VIEWER_MODAL, true, this );
|
||||
|
||||
if( frame->ShowModal( &newName, this ) )
|
||||
{
|
||||
@@ -258,7 +258,7 @@ void DIALOG_CHANGE_SYMBOLS::launchNewIdSymbolBrowser( wxCommandEvent& aEvent )
|
||||
{
|
||||
wxString newName = getLibIdValue( m_newId );
|
||||
|
||||
KIWAY_PLAYER* frame = Kiway().Player( FRAME_SCH_VIEWER_MODAL, true );
|
||||
KIWAY_PLAYER* frame = Kiway().Player( FRAME_SCH_VIEWER_MODAL, true, this );
|
||||
|
||||
if( frame->ShowModal( &newName, this ) )
|
||||
{
|
||||
|
||||
@@ -438,7 +438,9 @@ void DIALOG_ERC::OnRunERCClick( wxCommandEvent& event )
|
||||
{
|
||||
wxMilliSleep( 500 );
|
||||
m_runningResultsBook->ChangeSelection( 1 );
|
||||
#ifndef __WXGTK__
|
||||
KIPLATFORM::UI::ForceFocus( m_markerDataView );
|
||||
#endif
|
||||
}
|
||||
|
||||
m_ercRun = true;
|
||||
|
||||
@@ -73,8 +73,16 @@ DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES( SCH_BASE_FRAME* aParent, const
|
||||
{
|
||||
wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
|
||||
} );
|
||||
|
||||
m_StyledTextCtrl->SetEOLMode( wxSTC_EOL_LF ); // Normalize EOL across platforms
|
||||
|
||||
#ifdef _WIN32
|
||||
// Without this setting, on Windows, some esoteric unicode chars create display issue
|
||||
// in a wxStyledTextCtrl.
|
||||
// for SetTechnology() info, see https://www.scintilla.org/ScintillaDoc.html#SCI_SETTECHNOLOGY
|
||||
m_StyledTextCtrl->SetTechnology(wxSTC_TECHNOLOGY_DIRECTWRITE);
|
||||
#endif
|
||||
|
||||
m_textColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
|
||||
m_textColorSwatch->SetSwatchBackground( schematicBackground );
|
||||
|
||||
@@ -419,6 +427,7 @@ void DIALOG_FIELD_PROPERTIES::updateText( EDA_TEXT* aText )
|
||||
if( aText->GetTextWidth() != m_size )
|
||||
aText->SetTextSize( wxSize( m_size, m_size ) );
|
||||
|
||||
aText->SetFont( m_font );
|
||||
aText->SetVisible( m_isVisible );
|
||||
aText->SetTextAngle( m_isVertical ? ANGLE_VERTICAL : ANGLE_HORIZONTAL );
|
||||
aText->SetItalic( m_isItalic );
|
||||
@@ -439,6 +448,8 @@ DIALOG_LIB_FIELD_PROPERTIES::DIALOG_LIB_FIELD_PROPERTIES( SCH_BASE_FRAME* aParen
|
||||
if( m_fieldId == VALUE_FIELD )
|
||||
m_text = UnescapeString( aField->GetText() );
|
||||
|
||||
m_font = aField->GetFont();
|
||||
|
||||
m_nameVisible->Show();
|
||||
m_cbAllowAutoPlace->Show();
|
||||
|
||||
@@ -688,8 +699,6 @@ void DIALOG_SCH_FIELD_PROPERTIES::UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH
|
||||
updateText( aField );
|
||||
aField->SetPosition( m_position );
|
||||
|
||||
aField->SetFont( m_font );
|
||||
|
||||
aField->SetNameShown( m_isNameVisible );
|
||||
aField->SetCanAutoplace( m_allowAutoplace );
|
||||
|
||||
|
||||
@@ -422,7 +422,9 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( const SCH_SHEET_PATH& aShe
|
||||
}
|
||||
}
|
||||
|
||||
if( aItem->Type() == SCH_SYMBOL_T )
|
||||
switch( aItem->Type() )
|
||||
{
|
||||
case SCH_SYMBOL_T:
|
||||
{
|
||||
SCH_SYMBOL* symbol = (SCH_SYMBOL*) aItem;
|
||||
|
||||
@@ -446,8 +448,11 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( const SCH_SHEET_PATH& aShe
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
else if( aItem->Type() == SCH_SHEET_T )
|
||||
|
||||
case SCH_SHEET_T:
|
||||
{
|
||||
SCH_SHEET* sheet = static_cast<SCH_SHEET*>( aItem );
|
||||
|
||||
@@ -488,19 +493,30 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( const SCH_SHEET_PATH& aShe
|
||||
for( SCH_SHEET_PIN* pin : sheet->GetPins() )
|
||||
processItem( aSheetPath, pin );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
else if( m_wires->GetValue() && aItem->IsType( { SCH_ITEM_LOCATE_WIRE_T,
|
||||
SCH_LABEL_LOCATE_WIRE_T } ) )
|
||||
{
|
||||
processItem( aSheetPath, aItem );
|
||||
}
|
||||
else if( m_buses->GetValue() && aItem->IsType( { SCH_ITEM_LOCATE_BUS_T,
|
||||
SCH_LABEL_LOCATE_BUS_T } ) )
|
||||
{
|
||||
processItem( aSheetPath, aItem );
|
||||
}
|
||||
else if( aItem->IsType( { SCH_LABEL_LOCATE_ANY_T } ) )
|
||||
{
|
||||
|
||||
case SCH_LINE_T:
|
||||
if( m_schTextAndGraphics->GetValue() && aItem->GetLayer() == LAYER_NOTES )
|
||||
processItem( aSheetPath, aItem );
|
||||
else if( m_wires->GetValue() && aItem->GetLayer() == LAYER_WIRE )
|
||||
processItem( aSheetPath, aItem );
|
||||
else if( m_buses->GetValue() && aItem->GetLayer() == LAYER_BUS )
|
||||
processItem( aSheetPath, aItem );
|
||||
|
||||
break;
|
||||
|
||||
case SCH_LABEL_T:
|
||||
case SCH_GLOBAL_LABEL_T:
|
||||
case SCH_HIER_LABEL_T:
|
||||
case SCH_DIRECTIVE_LABEL_T:
|
||||
if( m_wires->GetValue() && aItem->IsType( { SCH_LABEL_LOCATE_WIRE_T } ) )
|
||||
processItem( aSheetPath, aItem );
|
||||
|
||||
if( m_buses->GetValue() && aItem->IsType( { SCH_LABEL_LOCATE_BUS_T } ) )
|
||||
processItem( aSheetPath, aItem );
|
||||
|
||||
if( m_globalLabels->GetValue() && aItem->Type() == SCH_GLOBAL_LABEL_T )
|
||||
processItem( aSheetPath, aItem );
|
||||
|
||||
@@ -520,8 +536,10 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( const SCH_SHEET_PATH& aShe
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( aItem->Type() == SCH_JUNCTION_T )
|
||||
|
||||
break;
|
||||
|
||||
case SCH_JUNCTION_T:
|
||||
{
|
||||
SCH_JUNCTION* junction = static_cast<SCH_JUNCTION*>( aItem );
|
||||
|
||||
@@ -538,12 +556,20 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::visitItem( const SCH_SHEET_PATH& aShe
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
else if( m_schTextAndGraphics->GetValue() && aItem->IsType( { SCH_TEXT_T, SCH_TEXTBOX_T,
|
||||
SCH_ITEM_LOCATE_GRAPHIC_LINE_T,
|
||||
SCH_SHAPE_T } ) )
|
||||
{
|
||||
processItem( aSheetPath, aItem );
|
||||
|
||||
case SCH_TEXT_T:
|
||||
case SCH_TEXTBOX_T:
|
||||
case SCH_SHAPE_T:
|
||||
if( m_schTextAndGraphics->GetValue() )
|
||||
processItem( aSheetPath, aItem );
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -578,6 +604,7 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow()
|
||||
|
||||
// Reset the view to where we left the user
|
||||
m_parent->SetCurrentSheet( currentSheet );
|
||||
m_parent->Refresh();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataToWindow()
|
||||
}
|
||||
}
|
||||
|
||||
std::set<std::shared_ptr<BUS_ALIAS>> sheetAliases = screen->GetBusAliases();
|
||||
auto& sheetAliases = screen->GetBusAliases();
|
||||
busAliases.insert( busAliases.end(), sheetAliases.begin(), sheetAliases.end() );
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +64,13 @@ DIALOG_LIB_TEXTBOX_PROPERTIES::DIALOG_LIB_TEXTBOX_PROPERTIES( SYMBOL_EDIT_FRAME*
|
||||
|
||||
m_textCtrl->SetEOLMode( wxSTC_EOL_LF );
|
||||
|
||||
#ifdef _WIN32
|
||||
// Without this setting, on Windows, some esoteric unicode chars create display issue
|
||||
// in a wxStyledTextCtrl.
|
||||
// for SetTechnology() info, see https://www.scintilla.org/ScintillaDoc.html#SCI_SETTECHNOLOGY
|
||||
m_textCtrl->SetTechnology(wxSTC_TECHNOLOGY_DIRECTWRITE);
|
||||
#endif
|
||||
|
||||
m_scintillaTricks = new SCINTILLA_TRICKS( m_textCtrl, wxT( "{}" ), false,
|
||||
[this]()
|
||||
{
|
||||
|
||||
@@ -468,11 +468,15 @@ void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen )
|
||||
// All the coordinates will be rotated 90 deg when printing,
|
||||
// so the X,Y offset vector must be rotated -90 deg before printing
|
||||
std::swap( xoffset, yoffset );
|
||||
std::swap( fitRect.width, fitRect.height );
|
||||
yoffset = -yoffset;
|
||||
}
|
||||
|
||||
matrix.Translate( xoffset, yoffset );
|
||||
dc->SetTransformMatrix( matrix );
|
||||
|
||||
fitRect.x -= xoffset;
|
||||
fitRect.y -= yoffset;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -102,6 +102,13 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_ITE
|
||||
|
||||
m_textCtrl->SetEOLMode( wxSTC_EOL_LF );
|
||||
|
||||
#ifdef _WIN32
|
||||
// Without this setting, on Windows, some esoteric unicode chars create display issue
|
||||
// in a wxStyledTextCtrl.
|
||||
// for SetTechnology() info, see https://www.scintilla.org/ScintillaDoc.html#SCI_SETTECHNOLOGY
|
||||
m_textCtrl->SetTechnology(wxSTC_TECHNOLOGY_DIRECTWRITE);
|
||||
#endif
|
||||
|
||||
m_scintillaTricks = new SCINTILLA_TRICKS( m_textCtrl, wxT( "{}" ), false,
|
||||
[this]()
|
||||
{
|
||||
|
||||
+1
-1
@@ -307,7 +307,7 @@ int ERC_TESTER::TestConflictingBusAliases()
|
||||
|
||||
for( SCH_SCREEN* screen = screens.GetFirst(); screen != nullptr; screen = screens.GetNext() )
|
||||
{
|
||||
const std::set< std::shared_ptr<BUS_ALIAS> > screen_aliases = screen->GetBusAliases();
|
||||
const auto& screen_aliases = screen->GetBusAliases();
|
||||
|
||||
for( const std::shared_ptr<BUS_ALIAS>& alias : screen_aliases )
|
||||
{
|
||||
|
||||
@@ -398,7 +398,7 @@ void SCH_EDIT_FRAME::setupUIConditions()
|
||||
{
|
||||
SCH_BASE_FRAME::setupUIConditions();
|
||||
|
||||
ACTION_MANAGER* mgr = m_toolManager->GetActionManager();
|
||||
ACTION_MANAGER* mgr = m_toolManager->GetActionManager();
|
||||
SCH_EDITOR_CONDITIONS cond( this );
|
||||
|
||||
wxASSERT( mgr );
|
||||
@@ -417,11 +417,20 @@ void SCH_EDIT_FRAME::setupUIConditions()
|
||||
};
|
||||
|
||||
|
||||
auto undoCond =
|
||||
[ this ] (const SELECTION& aSel )
|
||||
{
|
||||
if( SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus( aSel ) )
|
||||
return true;
|
||||
|
||||
return GetUndoCommandCount() > 0;
|
||||
};
|
||||
|
||||
#define ENABLE( x ) ACTION_CONDITIONS().Enable( x )
|
||||
#define CHECK( x ) ACTION_CONDITIONS().Check( x )
|
||||
|
||||
mgr->SetConditions( ACTIONS::save, ENABLE( SELECTION_CONDITIONS::ShowAlways ) );
|
||||
mgr->SetConditions( ACTIONS::undo, ENABLE( cond.UndoAvailable() ) );
|
||||
mgr->SetConditions( ACTIONS::undo, ENABLE( undoCond ) );
|
||||
mgr->SetConditions( ACTIONS::redo, ENABLE( cond.RedoAvailable() ) );
|
||||
|
||||
mgr->SetConditions( EE_ACTIONS::showHierarchy, CHECK( hierarchyNavigatorCond ) );
|
||||
|
||||
+35
-10
@@ -1047,25 +1047,38 @@ void SCH_PAINTER::draw( const LIB_TEXT* aText, int aLayer, bool aDimmed )
|
||||
|
||||
attrs.m_StrokeWidth = KiROUND( getTextThickness( aText ) );
|
||||
|
||||
// Due to the fact a shadow text can be drawn left or right aligned,
|
||||
// it needs an offset = shadowWidth/2 to be drawn at the same place as normal text
|
||||
// texts drawn as GR_TEXT_H_ALIGN_CENTER do not need a specific offset.
|
||||
// this offset is shadowWidth/2 but for some reason we need to slightly modify this offset
|
||||
// for a better look (better alignment of shadow shape), for KiCad font only
|
||||
double shadowOffset = 0.0;
|
||||
|
||||
if( drawingShadows )
|
||||
{
|
||||
double shadowWidth = getShadowWidth( !aText->IsSelected() );
|
||||
attrs.m_StrokeWidth += getShadowWidth( !aText->IsSelected() );
|
||||
|
||||
const double adjust = 1.2f; // Value chosen after tests
|
||||
shadowOffset = shadowWidth/2.0f * adjust;
|
||||
}
|
||||
|
||||
if( attrs.m_Angle == ANGLE_VERTICAL )
|
||||
{
|
||||
switch( attrs.m_Halign )
|
||||
{
|
||||
case GR_TEXT_H_ALIGN_LEFT: pos.y = bBox.GetBottom(); break;
|
||||
case GR_TEXT_H_ALIGN_LEFT: pos.y = bBox.GetBottom() + shadowOffset; break;
|
||||
case GR_TEXT_H_ALIGN_CENTER: pos.y = ( bBox.GetTop() + bBox.GetBottom() ) / 2; break;
|
||||
case GR_TEXT_H_ALIGN_RIGHT: pos.y = bBox.GetTop(); break;
|
||||
case GR_TEXT_H_ALIGN_RIGHT: pos.y = bBox.GetTop() - shadowOffset; break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch( attrs.m_Halign )
|
||||
{
|
||||
case GR_TEXT_H_ALIGN_LEFT: pos.x = bBox.GetLeft(); break;
|
||||
case GR_TEXT_H_ALIGN_LEFT: pos.x = bBox.GetLeft() - shadowOffset; break;
|
||||
case GR_TEXT_H_ALIGN_CENTER: pos.x = ( bBox.GetLeft() + bBox.GetRight() ) / 2; break;
|
||||
case GR_TEXT_H_ALIGN_RIGHT: pos.x = bBox.GetRight(); break;
|
||||
case GR_TEXT_H_ALIGN_RIGHT: pos.x = bBox.GetRight() + shadowOffset; break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1512,6 +1525,19 @@ void SCH_PAINTER::draw( const LIB_PIN *aPin, int aLayer, bool aDimmed )
|
||||
|
||||
for( float& t : thickness )
|
||||
t += shadowWidth;
|
||||
|
||||
// Due to the fact a shadow text in position INSIDE or OUTSIDE is drawn left or right aligned,
|
||||
// it needs an offset = shadowWidth/2 to be drawn at the same place as normal text
|
||||
// texts drawn as GR_TEXT_H_ALIGN_CENTER do not need a specific offset.
|
||||
// this offset is shadowWidth/2 but for some reason we need to slightly modify this offset
|
||||
// for a better look (better alignment of shadow shape), for KiCad font only
|
||||
if( !KIFONT::FONT::GetFont( eeconfig()->m_Appearance.default_font )->IsOutline() )
|
||||
{
|
||||
const float adjust = 1.2f; // Value chosen after tests
|
||||
float shadowOffset = shadowWidth/2.0f * adjust;
|
||||
insideOffset -= shadowOffset;
|
||||
outsideOffset -= shadowOffset;
|
||||
}
|
||||
}
|
||||
|
||||
auto drawText =
|
||||
@@ -2324,15 +2350,14 @@ void SCH_PAINTER::draw( const SCH_SYMBOL* aSymbol, int aLayer )
|
||||
|
||||
if( aSymbol->GetDNP() )
|
||||
{
|
||||
COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings();
|
||||
BOX2I bbox = aSymbol->GetBodyAndPinsBoundingBox();
|
||||
VECTOR2I pt1 = bbox.GetOrigin();
|
||||
VECTOR2I pt2 = bbox.GetEnd();
|
||||
BOX2I bbox = aSymbol->GetBodyAndPinsBoundingBox();
|
||||
VECTOR2I pt1 = bbox.GetOrigin();
|
||||
VECTOR2I pt2 = bbox.GetEnd();
|
||||
|
||||
m_gal->SetIsStroke( true );
|
||||
m_gal->SetIsFill( true );
|
||||
m_gal->SetStrokeColor( colors->GetColor( LAYER_ERC_ERR ) );
|
||||
m_gal->SetFillColor( colors->GetColor( LAYER_ERC_ERR ) );
|
||||
m_gal->SetStrokeColor( m_schSettings.GetLayerColor( LAYER_ERC_ERR ) );
|
||||
m_gal->SetFillColor( m_schSettings.GetLayerColor( LAYER_ERC_ERR ) );
|
||||
|
||||
m_gal->DrawSegment( pt1, pt2, 3.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ) );
|
||||
std::swap( pt1.x, pt2.x );
|
||||
|
||||
@@ -667,6 +667,9 @@ ASCH_NET_LABEL::ASCH_NET_LABEL( const std::map<wxString, wxString>& aProps )
|
||||
location = VECTOR2I( ReadKiCadUnitFrac( aProps, "LOCATION.X" ),
|
||||
-ReadKiCadUnitFrac( aProps, "LOCATION.Y" ) );
|
||||
|
||||
justification = ReadEnum<ASCH_LABEL_JUSTIFICATION>( aProps, "JUSTIFICATION", 0, 8,
|
||||
ASCH_LABEL_JUSTIFICATION::BOTTOM_LEFT );
|
||||
|
||||
orientation = ReadEnum<ASCH_RECORD_ORIENTATION>( aProps, "ORIENTATION", 0, 3,
|
||||
ASCH_RECORD_ORIENTATION::RIGHTWARDS );
|
||||
}
|
||||
|
||||
@@ -663,6 +663,7 @@ struct ASCH_NET_LABEL
|
||||
|
||||
VECTOR2I location;
|
||||
|
||||
ASCH_LABEL_JUSTIFICATION justification;
|
||||
ASCH_RECORD_ORIENTATION orientation;
|
||||
|
||||
explicit ASCH_NET_LABEL( const std::map<wxString, wxString>& aProps );
|
||||
|
||||
@@ -2639,27 +2639,7 @@ void SCH_ALTIUM_PLUGIN::ParseNetLabel( const std::map<wxString, wxString>& aProp
|
||||
SCH_SCREEN* screen = getCurrentScreen();
|
||||
wxCHECK( screen, /* void */ );
|
||||
|
||||
switch( elem.orientation )
|
||||
{
|
||||
case ASCH_RECORD_ORIENTATION::RIGHTWARDS:
|
||||
label->SetTextSpinStyle( TEXT_SPIN_STYLE::RIGHT );
|
||||
break;
|
||||
|
||||
case ASCH_RECORD_ORIENTATION::UPWARDS:
|
||||
label->SetTextSpinStyle( TEXT_SPIN_STYLE::UP );
|
||||
break;
|
||||
|
||||
case ASCH_RECORD_ORIENTATION::LEFTWARDS:
|
||||
label->SetTextSpinStyle( TEXT_SPIN_STYLE::LEFT );
|
||||
break;
|
||||
|
||||
case ASCH_RECORD_ORIENTATION::DOWNWARDS:
|
||||
label->SetTextSpinStyle( TEXT_SPIN_STYLE::BOTTOM );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
SetTextPositioning( label, elem.justification, elem.orientation );
|
||||
|
||||
label->SetFlags( IS_NEW );
|
||||
screen->Append( label );
|
||||
|
||||
@@ -73,7 +73,7 @@ void SCH_DATABASE_PLUGIN::EnumerateSymbolLib( std::vector<LIB_SYMBOL*>& aSymbolL
|
||||
{
|
||||
std::vector<DATABASE_CONNECTION::ROW> results;
|
||||
|
||||
if( !m_conn->SelectAll( table.table, results ) )
|
||||
if( !m_conn->SelectAll( table.table, table.key_col, results ) )
|
||||
{
|
||||
if( !m_conn->GetLastError().empty() )
|
||||
{
|
||||
@@ -287,6 +287,26 @@ void SCH_DATABASE_PLUGIN::ensureConnection()
|
||||
THROW_IO_ERROR( msg );
|
||||
}
|
||||
|
||||
for( const DATABASE_LIB_TABLE& tableIter : m_settings->m_Tables )
|
||||
{
|
||||
std::set<std::string> columns;
|
||||
|
||||
columns.insert( tableIter.key_col );
|
||||
columns.insert( tableIter.footprints_col );
|
||||
columns.insert( tableIter.symbols_col );
|
||||
|
||||
columns.insert( tableIter.properties.description );
|
||||
columns.insert( tableIter.properties.footprint_filters );
|
||||
columns.insert( tableIter.properties.keywords );
|
||||
columns.insert( tableIter.properties.exclude_from_bom );
|
||||
columns.insert( tableIter.properties.exclude_from_board );
|
||||
|
||||
for( const DATABASE_FIELD_MAPPING& field : tableIter.fields )
|
||||
columns.insert( field.column );
|
||||
|
||||
m_conn->CacheTableInfo( tableIter.table, columns );
|
||||
}
|
||||
|
||||
m_conn->SetCacheParams( m_settings->m_Cache.max_size, m_settings->m_Cache.max_age );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1397,7 +1397,7 @@ LIB_PIN* SCH_SEXPR_PARSER::parsePin()
|
||||
{
|
||||
// The EDA_TEXT font effects formatting is used so use and EDA_TEXT object
|
||||
// so duplicate parsing is not required.
|
||||
EDA_TEXT text( schIUScale.MilsToIU( DEFAULT_SIZE_TEXT ) );
|
||||
EDA_TEXT text( schIUScale );
|
||||
|
||||
parseEDA_TEXT( &text, true );
|
||||
pin->SetNameTextSize( text.GetTextHeight() );
|
||||
@@ -1431,7 +1431,7 @@ LIB_PIN* SCH_SEXPR_PARSER::parsePin()
|
||||
{
|
||||
// The EDA_TEXT font effects formatting is used so use and EDA_TEXT object
|
||||
// so duplicate parsing is not required.
|
||||
EDA_TEXT text( schIUScale.MilsToIU( DEFAULT_SIZE_TEXT ) );
|
||||
EDA_TEXT text( schIUScale );
|
||||
|
||||
parseEDA_TEXT( &text, false );
|
||||
pin->SetNumberTextSize( text.GetTextHeight() );
|
||||
|
||||
+15
-3
@@ -505,9 +505,9 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of bus aliases defined in this screen
|
||||
* Return a set of bus aliases defined in this screen
|
||||
*/
|
||||
std::set< std::shared_ptr<BUS_ALIAS> > GetBusAliases() const
|
||||
auto& GetBusAliases() const
|
||||
{
|
||||
return m_aliases;
|
||||
}
|
||||
@@ -571,6 +571,18 @@ private:
|
||||
*/
|
||||
size_t getLibSymbolNameMatches( const SCH_SYMBOL& aSymbol, std::vector<wxString>& aMatches );
|
||||
|
||||
|
||||
/**
|
||||
* Compare two #BUS_ALIAS objects by name. For sorting in the set.
|
||||
*/
|
||||
struct BusAliasCmp
|
||||
{
|
||||
bool operator()( const std::shared_ptr<BUS_ALIAS>& a, const std::shared_ptr<BUS_ALIAS>& b ) const
|
||||
{
|
||||
return a->GetName() < b->GetName();
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
/**
|
||||
* last value for the zoom level, useful in Eeschema when changing the current displayed
|
||||
@@ -610,7 +622,7 @@ private:
|
||||
bool m_fileExists;
|
||||
|
||||
/// List of bus aliases stored in this screen.
|
||||
std::set< std::shared_ptr< BUS_ALIAS > > m_aliases;
|
||||
std::set< std::shared_ptr< BUS_ALIAS >, BusAliasCmp > m_aliases;
|
||||
|
||||
/// Library symbols required for this schematic.
|
||||
std::map<wxString, LIB_SYMBOL*> m_libSymbols;
|
||||
|
||||
@@ -113,7 +113,7 @@ bool SCH_FIELD_VALIDATOR::Validate( wxWindow* aParent )
|
||||
else if( excludeChar == ' ' )
|
||||
badCharsFound.Add( _( "space" ) );
|
||||
else
|
||||
badCharsFound.Add( wxString::Format( wxT( "'%s'" ), excludeChar ) );
|
||||
badCharsFound.Add( wxString::Format( wxT( "'%c'" ), excludeChar ) );
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
@@ -301,8 +301,13 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
|
||||
}
|
||||
else if( status == UNDO_REDO::PAGESETTINGS )
|
||||
{
|
||||
SetCurrentSheet( *m_schematic->GetSheets().FindSheetForScreen( screen ) );
|
||||
DisplayCurrentSheet();
|
||||
SCH_SHEET_PATH& undoSheet = *m_schematic->GetSheets().FindSheetForScreen( screen );
|
||||
|
||||
if( GetCurrentSheet() != undoSheet )
|
||||
{
|
||||
SetCurrentSheet( undoSheet );
|
||||
DisplayCurrentSheet();
|
||||
}
|
||||
|
||||
// swap current settings with stored settings
|
||||
DS_PROXY_UNDO_ITEM alt_item( this );
|
||||
|
||||
+3
-3
@@ -597,6 +597,9 @@ void SCH_EDIT_FRAME::DrawCurrentSheetToClipboard()
|
||||
|
||||
PrintPage( cfg );
|
||||
|
||||
// Deselect Bitmap from DC before using the bitmap
|
||||
dc.SelectObject( wxNullBitmap );
|
||||
|
||||
{
|
||||
wxLogNull doNotLog; // disable logging of failed clipboard actions
|
||||
|
||||
@@ -610,9 +613,6 @@ void SCH_EDIT_FRAME::DrawCurrentSheetToClipboard()
|
||||
}
|
||||
}
|
||||
|
||||
// Deselect Bitmap from DC in order to delete the MemoryDC
|
||||
dc.SelectObject( wxNullBitmap );
|
||||
|
||||
GRForceBlackPen( false );
|
||||
|
||||
screen->m_StartVisu = tmp_startvisu;
|
||||
|
||||
@@ -661,9 +661,11 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
}
|
||||
|
||||
if( EDA_ITEM* item = m_frame->GetItem( rolloverItem ) )
|
||||
if( rolloverItem != niluuid )
|
||||
{
|
||||
if( !( item->GetFlags() & IS_ROLLOVER ) )
|
||||
EDA_ITEM* item = m_frame->GetItem( rolloverItem );
|
||||
|
||||
if( item && !( item->GetFlags() & IS_ROLLOVER ) )
|
||||
{
|
||||
item->SetFlags( IS_ROLLOVER );
|
||||
lastRolloverItem = rolloverItem;
|
||||
|
||||
@@ -249,7 +249,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
|
||||
bool isSyntheticClick = symbol && evt->IsActivate() && evt->HasPosition()
|
||||
&& evt->Matches( aEvent );
|
||||
|
||||
if( evt->IsCancelInteractive() )
|
||||
if( evt->IsCancelInteractive() || evt->IsAction( &ACTIONS::undo ) )
|
||||
{
|
||||
m_frame->GetInfoBar()->Dismiss();
|
||||
|
||||
@@ -443,6 +443,10 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
cleanup();
|
||||
}
|
||||
else if( evt->IsAction( &ACTIONS::redo ) )
|
||||
{
|
||||
wxBell();
|
||||
}
|
||||
else
|
||||
{
|
||||
evt->SetPassEvent();
|
||||
@@ -538,7 +542,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
||||
bool isSyntheticClick = image && evt->IsActivate() && evt->HasPosition()
|
||||
&& evt->Matches( aEvent );
|
||||
|
||||
if( evt->IsCancelInteractive() )
|
||||
if( evt->IsCancelInteractive() || evt->IsAction( &ACTIONS::undo ) )
|
||||
{
|
||||
m_frame->GetInfoBar()->Dismiss();
|
||||
|
||||
@@ -674,6 +678,10 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
cleanup();
|
||||
}
|
||||
else if( evt->IsAction( &ACTIONS::redo ) )
|
||||
{
|
||||
wxBell();
|
||||
}
|
||||
else
|
||||
{
|
||||
evt->SetPassEvent();
|
||||
@@ -783,7 +791,7 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
|
||||
cursorPos = grid.BestSnapAnchor( cursorPos, LAYER_CONNECTABLE, nullptr );
|
||||
controls->ForceCursorPosition( true, cursorPos );
|
||||
|
||||
if( evt->IsCancelInteractive() )
|
||||
if( evt->IsCancelInteractive() || evt->IsAction( &ACTIONS::undo ) )
|
||||
{
|
||||
m_frame->PopTool( aEvent );
|
||||
break;
|
||||
@@ -925,6 +933,10 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
|
||||
evt->SetPassEvent();
|
||||
}
|
||||
}
|
||||
else if( evt->IsAction( &ACTIONS::redo ) )
|
||||
{
|
||||
wxBell();
|
||||
}
|
||||
else
|
||||
{
|
||||
evt->SetPassEvent();
|
||||
@@ -1239,7 +1251,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
};
|
||||
|
||||
if( evt->IsCancelInteractive() )
|
||||
if( evt->IsCancelInteractive() || evt->IsAction( &ACTIONS::undo ) )
|
||||
{
|
||||
m_frame->GetInfoBar()->Dismiss();
|
||||
|
||||
@@ -1478,6 +1490,10 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
cleanup();
|
||||
}
|
||||
else if( evt->IsAction( &ACTIONS::redo ) )
|
||||
{
|
||||
wxBell();
|
||||
}
|
||||
else
|
||||
{
|
||||
evt->SetPassEvent();
|
||||
@@ -1554,7 +1570,7 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||
bool isSyntheticClick = item && evt->IsActivate() && evt->HasPosition()
|
||||
&& evt->Matches( aEvent );
|
||||
|
||||
if( evt->IsCancelInteractive() )
|
||||
if( evt->IsCancelInteractive() || evt->IsAction( &ACTIONS::undo ) )
|
||||
{
|
||||
if( item )
|
||||
{
|
||||
@@ -1698,6 +1714,10 @@ int SCH_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||
|
||||
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
|
||||
}
|
||||
else if( evt->IsAction( &ACTIONS::redo ) )
|
||||
{
|
||||
wxBell();
|
||||
}
|
||||
else
|
||||
{
|
||||
evt->SetPassEvent();
|
||||
@@ -1765,7 +1785,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
||||
bool isSyntheticClick = sheet && evt->IsActivate() && evt->HasPosition()
|
||||
&& evt->Matches( aEvent );
|
||||
|
||||
if( evt->IsCancelInteractive() )
|
||||
if( evt->IsCancelInteractive() || evt->IsAction( &ACTIONS::undo ) )
|
||||
{
|
||||
m_frame->GetInfoBar()->Dismiss();
|
||||
|
||||
@@ -1886,6 +1906,10 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
||||
|
||||
m_menu.ShowContextMenu( m_selectionTool->GetSelection() );
|
||||
}
|
||||
else if( evt->IsAction( &ACTIONS::redo ) )
|
||||
{
|
||||
wxBell();
|
||||
}
|
||||
else
|
||||
{
|
||||
evt->SetPassEvent();
|
||||
|
||||
@@ -368,6 +368,9 @@ int SCH_EDITOR_CONTROL::ExportSymbolsToLibrary( const TOOL_EVENT& aEvent )
|
||||
wxFileName fn;
|
||||
SYMBOL_LIB_TABLE* libTable = m_frame->SelectSymLibTable();
|
||||
|
||||
if( !libTable ) // Cancelled by user
|
||||
return 0;
|
||||
|
||||
if( !m_frame->LibraryFileBrowser( false, fn, KiCadSymbolLibFileWildcard(),
|
||||
KiCadSymbolLibFileExtension, false,
|
||||
( libTable == &SYMBOL_LIB_TABLE::GetGlobalLibTable() ),
|
||||
|
||||
@@ -259,8 +259,11 @@ int SCH_FIND_REPLACE_TOOL::FindNext( const TOOL_EVENT& aEvent )
|
||||
|
||||
if( item )
|
||||
{
|
||||
m_frame->Schematic().SetCurrentSheet( *sheet );
|
||||
m_frame->DisplayCurrentSheet();
|
||||
if( m_frame->Schematic().CurrentSheet() != *sheet )
|
||||
{
|
||||
m_frame->Schematic().SetCurrentSheet( *sheet );
|
||||
m_frame->DisplayCurrentSheet();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -896,7 +896,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const TOOL_EVENT& aTool, int aType,
|
||||
m_view->AddToPreview( wire->Clone() );
|
||||
}
|
||||
}
|
||||
else if( evt->IsAction( &EE_ACTIONS::undoLastSegment ) )
|
||||
else if( evt->IsAction( &EE_ACTIONS::undoLastSegment ) || evt->IsAction( &ACTIONS::undo ) )
|
||||
{
|
||||
if( ( currentMode == LINE_MODE::LINE_MODE_FREE && m_wires.size() > 1 )
|
||||
|| ( LINE_MODE::LINE_MODE_90 && m_wires.size() > 2 ) )
|
||||
@@ -1009,6 +1009,10 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const TOOL_EVENT& aTool, int aType,
|
||||
{
|
||||
cleanup();
|
||||
}
|
||||
else if( evt->IsAction( &ACTIONS::redo ) )
|
||||
{
|
||||
wxBell();
|
||||
}
|
||||
else
|
||||
{
|
||||
evt->SetPassEvent();
|
||||
@@ -1030,8 +1034,10 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const TOOL_EVENT& aTool, int aType,
|
||||
SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::startSegments( int aType, const VECTOR2D& aPos,
|
||||
SCH_LINE* aSegment )
|
||||
{
|
||||
// If a segment isn't provided to copy properties from, we need to create one
|
||||
if( aSegment == nullptr )
|
||||
if( !aSegment )
|
||||
aSegment = m_frame->GetScreen()->GetLine( aPos, 0, aType );
|
||||
|
||||
if( !aSegment )
|
||||
{
|
||||
switch( aType )
|
||||
{
|
||||
|
||||
@@ -1165,7 +1165,11 @@ void SCH_MOVE_TOOL::getConnectedDragItems( SCH_ITEM* aSelectedItem, const VECTOR
|
||||
|
||||
newWire->SetFlags( IS_NEW );
|
||||
newWire->SetConnectivityDirty( true );
|
||||
newWire->SetLastResolvedState( selected );
|
||||
|
||||
if( dynamic_cast<const SCH_LINE*>( selected ) )
|
||||
newWire->SetLastResolvedState( selected );
|
||||
else if( dynamic_cast<const SCH_LINE*>( fixed ) )
|
||||
newWire->SetLastResolvedState( fixed );
|
||||
|
||||
newWire->SetEndPoint( end );
|
||||
m_frame->AddToScreen( newWire, m_frame->GetScreen() );
|
||||
|
||||
@@ -29,17 +29,24 @@
|
||||
#include <database/database_connection.h>
|
||||
|
||||
|
||||
template<typename CacheValueType>
|
||||
class DATABASE_CACHE
|
||||
{
|
||||
public:
|
||||
typedef std::pair<std::string, std::pair<time_t, DATABASE_CONNECTION::ROW>> CACHE_ENTRY;
|
||||
typedef std::pair<std::string, std::pair<time_t, CacheValueType>> CACHE_ENTRY;
|
||||
|
||||
typedef std::unordered_map<std::string, typename std::list<CACHE_ENTRY>::iterator> CACHE_TYPE;
|
||||
|
||||
typedef typename CACHE_TYPE::const_iterator CACHE_CITER;
|
||||
|
||||
typedef CacheValueType CACHE_VALUE;
|
||||
|
||||
DATABASE_CACHE( size_t aMaxSize, time_t aMaxAge ) :
|
||||
m_maxSize( aMaxSize ),
|
||||
m_maxAge( aMaxAge )
|
||||
{}
|
||||
|
||||
void Put( const std::string& aQuery, const DATABASE_CONNECTION::ROW& aResult )
|
||||
void Put( const std::string& aQuery, const CacheValueType& aResult )
|
||||
{
|
||||
auto it = m_cache.find( aQuery );
|
||||
|
||||
@@ -65,7 +72,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
bool Get( const std::string& aQuery, DATABASE_CONNECTION::ROW& aResult )
|
||||
bool Get( const std::string& aQuery, CacheValueType& aResult )
|
||||
{
|
||||
auto it = m_cache.find( aQuery );
|
||||
|
||||
@@ -94,7 +101,7 @@ private:
|
||||
size_t m_maxSize;
|
||||
time_t m_maxAge;
|
||||
std::list<CACHE_ENTRY> m_cacheMru;
|
||||
std::unordered_map<std::string, std::list<CACHE_ENTRY>::iterator> m_cache;
|
||||
CACHE_TYPE m_cache;
|
||||
};
|
||||
|
||||
#endif //KICAD_DATABASE_CACHE_H
|
||||
|
||||
@@ -24,8 +24,11 @@
|
||||
#include <any>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#include <database/database_cache.h>
|
||||
|
||||
extern const char* const traceDatabase;
|
||||
|
||||
|
||||
@@ -34,8 +37,6 @@ namespace nanodbc
|
||||
class connection;
|
||||
}
|
||||
|
||||
class DATABASE_CACHE;
|
||||
|
||||
|
||||
class DATABASE_CONNECTION
|
||||
{
|
||||
@@ -62,6 +63,8 @@ public:
|
||||
|
||||
bool IsConnected() const;
|
||||
|
||||
bool CacheTableInfo( const std::string& aTable, const std::set<std::string>& aColumns );
|
||||
|
||||
/**
|
||||
* Retrieves a single row from a database table. Table and column names are cached when the
|
||||
* connection is created, so schema changes to the database won't be recognized unless the
|
||||
@@ -77,20 +80,22 @@ public:
|
||||
/**
|
||||
* Retrieves all rows from a database table.
|
||||
* @param aTable the name of a table in the database
|
||||
* @param aKey holds the column name of the primary key used for caching results
|
||||
* @param aResults will be filled with all rows in the table
|
||||
* @return true if the query succeeded and at least one ROW was found, false otherwise
|
||||
*/
|
||||
bool SelectAll( const std::string& aTable, std::vector<ROW>& aResults );
|
||||
bool SelectAll( const std::string& aTable, const std::string& aKey,
|
||||
std::vector<ROW>& aResults );
|
||||
|
||||
std::string GetLastError() const { return m_lastError; }
|
||||
|
||||
private:
|
||||
bool syncTables();
|
||||
|
||||
bool cacheColumns();
|
||||
void init();
|
||||
|
||||
bool getQuoteChar();
|
||||
|
||||
std::string columnsFor( const std::string& aTable );
|
||||
|
||||
std::unique_ptr<nanodbc::connection> m_conn;
|
||||
|
||||
std::string m_dsn;
|
||||
@@ -109,7 +114,9 @@ private:
|
||||
|
||||
char m_quoteChar;
|
||||
|
||||
std::unique_ptr<DATABASE_CACHE> m_cache;
|
||||
typedef DATABASE_CACHE<std::map<std::string, ROW>> DB_CACHE_TYPE;
|
||||
|
||||
std::unique_ptr<DB_CACHE_TYPE> m_cache;
|
||||
};
|
||||
|
||||
#endif //KICAD_DATABASE_CONNECTION_H
|
||||
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
|
||||
int m_LibWidth;
|
||||
|
||||
wxString m_LastImportExportPath;
|
||||
wxString m_LastExportPath;
|
||||
|
||||
wxString m_FootprintTextShownColumns;
|
||||
|
||||
|
||||
@@ -124,6 +124,12 @@ public:
|
||||
wxFAIL_MSG( wxT( "groups don't support layer SetLayer" ) );
|
||||
}
|
||||
|
||||
bool IsOnCopperLayer() const override
|
||||
{
|
||||
// A group might have members on a copper layer, but isn't itself on any layer.
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Set layer for all items within the group.
|
||||
*
|
||||
* To avoid freezes with circular references, the maximum depth is 20 by default.
|
||||
|
||||
+12
-2
@@ -25,7 +25,17 @@
|
||||
#ifndef POLICY_KEYS_H_
|
||||
#define POLICY_KEYS_H_
|
||||
|
||||
#define POLICY_KEY_DATACOLLECTION wxT( "DataCollection" )
|
||||
#define POLICY_KEY_PCM wxT( "PluginAndContentManager" )
|
||||
#include <cstdint>
|
||||
|
||||
#define POLICY_KEY_DATACOLLECTION wxT( "DataCollection" )
|
||||
#define POLICY_KEY_PCM wxT( "PluginAndContentManager" )
|
||||
#define POLICY_KEY_REQUESTS_CURL_REVOKE wxT( "curl\\SslRevoke" )
|
||||
|
||||
enum class POLICY_CURL_SSL_REVOKE : std::uint32_t
|
||||
{
|
||||
DEFAULT = 0,
|
||||
BEST_EFFORT = 1,
|
||||
NONE = 2
|
||||
};
|
||||
|
||||
#endif // POLICY_KEYS_H_
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017-2022 Kicad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2017-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
|
||||
@@ -141,6 +141,8 @@ public:
|
||||
*/
|
||||
bool IsPolygonInProgress() const;
|
||||
|
||||
int PolygonPointCount() const;
|
||||
|
||||
/**
|
||||
* @return true if locking in the given point would close the current polygon.
|
||||
*/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2017-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
|
||||
@@ -60,13 +60,10 @@ public:
|
||||
void SetEnd( const VECTOR2I& aEnd )
|
||||
{
|
||||
if( m_angleSnap )
|
||||
{
|
||||
m_end = GetVectorSnapped45( aEnd - m_origin ) + m_origin;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_end = aEnd;
|
||||
}
|
||||
|
||||
setGeometryChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 Ian McInerney <ian.s.mcinerney at ieee.org>
|
||||
* Copyright (C) 1992-2020 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
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
*
|
||||
* @return Functor testing if the undo queue has items.
|
||||
*/
|
||||
SELECTION_CONDITION UndoAvailable();
|
||||
virtual SELECTION_CONDITION UndoAvailable();
|
||||
|
||||
/**
|
||||
* Create a functor that tests if there are any items in the redo queue.
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
virtual ~GRID_HELPER();
|
||||
|
||||
VECTOR2I GetGrid() const;
|
||||
VECTOR2I GetVisibleGrid() const;
|
||||
VECTOR2D GetVisibleGrid() const;
|
||||
VECTOR2I GetOrigin() const;
|
||||
|
||||
void SetAuxAxes( bool aEnable, const VECTOR2I& aOrigin = VECTOR2I( 0, 0 ) );
|
||||
|
||||
@@ -162,8 +162,8 @@ void PANEL_KICAD_LAUNCHER::CreateLaunchers()
|
||||
addLauncher( KICAD_MANAGER_ACTIONS::showPluginManager,
|
||||
KiScaledBitmap( BITMAPS::icon_pcm, this, 48, true ),
|
||||
_( "Manage downloadable packages from KiCad and 3rd party repositories" ),
|
||||
( KIPLATFORM::POLICY::GetPolicyState( POLICY_KEY_PCM )
|
||||
!= KIPLATFORM::POLICY::STATE::DISABLED ) );
|
||||
( KIPLATFORM::POLICY::GetPolicyBool( POLICY_KEY_PCM )
|
||||
!= KIPLATFORM::POLICY::PBOOL::DISABLED ) );
|
||||
|
||||
m_frame->SetPcmButton( bb );
|
||||
|
||||
|
||||
@@ -917,7 +917,7 @@ void KICAD_MANAGER_FRAME::OnIdle( wxIdleEvent& aEvent )
|
||||
}
|
||||
}
|
||||
|
||||
if( KIPLATFORM::POLICY::GetPolicyState( POLICY_KEY_PCM ) != KIPLATFORM::POLICY::STATE::DISABLED
|
||||
if( KIPLATFORM::POLICY::GetPolicyBool( POLICY_KEY_PCM ) != KIPLATFORM::POLICY::PBOOL::DISABLED
|
||||
&& settings->m_PcmUpdateCheck )
|
||||
{
|
||||
m_pcm->RunBackgroundUpdate();
|
||||
|
||||
+2
-2
@@ -177,8 +177,8 @@ void KICAD_MANAGER_FRAME::doReCreateMenuBar()
|
||||
|
||||
wxMenuItem* pcmMenuItem = toolsMenu->Add( KICAD_MANAGER_ACTIONS::showPluginManager );
|
||||
|
||||
if( KIPLATFORM::POLICY::GetPolicyState( POLICY_KEY_PCM )
|
||||
== KIPLATFORM::POLICY::STATE::DISABLED )
|
||||
if( KIPLATFORM::POLICY::GetPolicyBool( POLICY_KEY_PCM )
|
||||
== KIPLATFORM::POLICY::PBOOL::DISABLED )
|
||||
{
|
||||
pcmMenuItem->Enable( false );
|
||||
}
|
||||
|
||||
@@ -883,8 +883,8 @@ int KICAD_MANAGER_CONTROL::Execute( const TOOL_EVENT& aEvent )
|
||||
|
||||
int KICAD_MANAGER_CONTROL::ShowPluginManager( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
if( KIPLATFORM::POLICY::GetPolicyState( POLICY_KEY_PCM )
|
||||
== KIPLATFORM::POLICY::STATE::DISABLED )
|
||||
if( KIPLATFORM::POLICY::GetPolicyBool( POLICY_KEY_PCM )
|
||||
== KIPLATFORM::POLICY::PBOOL::DISABLED )
|
||||
{
|
||||
// policy disables the plugin manager
|
||||
return 0;
|
||||
|
||||
@@ -364,6 +364,14 @@ public:
|
||||
return A + ( B - A ) / 2;
|
||||
}
|
||||
|
||||
bool operator<( const SEG& aSeg ) const
|
||||
{
|
||||
if( A == aSeg.A )
|
||||
return B < aSeg.B;
|
||||
|
||||
return A < aSeg.A;
|
||||
}
|
||||
|
||||
private:
|
||||
bool ccw( const VECTOR2I& aA, const VECTOR2I& aB, const VECTOR2I &aC ) const;
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
void AddShape( SHAPE* aShape )
|
||||
{
|
||||
// Don't make clients deal with nested SHAPE_COMPOUNDs
|
||||
if( aShape->HasIndexableSubshapes() )
|
||||
if( dynamic_cast<SHAPE_COMPOUND*>( aShape ) )
|
||||
{
|
||||
std::vector<const SHAPE*> subshapes;
|
||||
aShape->GetIndexableSubshapes( subshapes );
|
||||
@@ -102,7 +102,7 @@ public:
|
||||
void AddShape( std::shared_ptr<SHAPE> aShape )
|
||||
{
|
||||
// Don't make clients deal with nested SHAPE_COMPOUNDs
|
||||
if( aShape->HasIndexableSubshapes() )
|
||||
if( dynamic_cast<SHAPE_COMPOUND*>( aShape.get() ) )
|
||||
{
|
||||
std::vector<const SHAPE*> subshapes;
|
||||
aShape->GetIndexableSubshapes( subshapes );
|
||||
@@ -125,7 +125,7 @@ public:
|
||||
|
||||
int Size() const
|
||||
{
|
||||
return m_shapes.size();
|
||||
return (int) m_shapes.size();
|
||||
}
|
||||
|
||||
void Rotate( const EDA_ANGLE& aAngle, const VECTOR2I& aCenter = { 0, 0 } ) override;
|
||||
|
||||
@@ -836,6 +836,11 @@ public:
|
||||
return ( t1.m_Pos != t2.m_Pos || t1.m_Size != t2.m_Size );
|
||||
}
|
||||
|
||||
bool IsValid() const
|
||||
{
|
||||
return m_init;
|
||||
}
|
||||
|
||||
private:
|
||||
Vec m_Pos; // Rectangle Origin
|
||||
Vec m_Size; // Rectangle Size
|
||||
|
||||
@@ -35,6 +35,7 @@ elseif( WIN32 )
|
||||
"Shlwapi"
|
||||
"winhttp"
|
||||
"wintrust"
|
||||
"Imm32"
|
||||
)
|
||||
elseif( UNIX )
|
||||
set( PLATFORM_SRCS
|
||||
|
||||
@@ -30,7 +30,8 @@ FILE* KIPLATFORM::IO::SeqFOpen( const wxString& aPath, const wxString& aMode )
|
||||
{
|
||||
FILE* fp = wxFopen( aPath, aMode );
|
||||
|
||||
posix_fadvise( fileno( fp ), 0, 0, POSIX_FADV_SEQUENTIAL );
|
||||
if( fp )
|
||||
posix_fadvise( fileno( fp ), 0, 0, POSIX_FADV_SEQUENTIAL );
|
||||
|
||||
return fp;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,14 @@
|
||||
|
||||
#include <wx/string.h>
|
||||
|
||||
KIPLATFORM::POLICY::STATE KIPLATFORM::POLICY::GetPolicyState( const wxString& aKey )
|
||||
|
||||
KIPLATFORM::POLICY::PBOOL KIPLATFORM::POLICY::GetPolicyBool( const wxString& aKey )
|
||||
{
|
||||
return STATE::NOT_CONFIGURED;
|
||||
return PBOOL::NOT_CONFIGURED;
|
||||
}
|
||||
|
||||
|
||||
std::uint32_t KIPLATFORM::POLICY::GetPolicyEnumUInt( const wxString& aKey )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -216,3 +216,8 @@ void KIPLATFORM::UI::WarpPointer( wxWindow* aWindow, int aX, int aY )
|
||||
gdk_window_set_cursor( win, cur_cursor );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void KIPLATFORM::UI::ImmControl( wxWindow* aWindow, bool aEnable )
|
||||
{
|
||||
}
|
||||
@@ -22,20 +22,29 @@
|
||||
#ifndef KIPLATFORM_POLICY_H_
|
||||
#define KIPLATFORM_POLICY_H_
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
class wxString;
|
||||
|
||||
namespace KIPLATFORM
|
||||
{
|
||||
namespace POLICY
|
||||
{
|
||||
enum class STATE
|
||||
enum class PBOOL
|
||||
{
|
||||
ENABLED,
|
||||
DISABLED,
|
||||
NOT_CONFIGURED
|
||||
};
|
||||
|
||||
STATE GetPolicyState( const wxString& aKey );
|
||||
PBOOL GetPolicyBool( const wxString& aKey );
|
||||
std::uint32_t GetPolicyEnumUInt( const wxString& aKey );
|
||||
|
||||
template <typename T>
|
||||
T GetPolicyEnum( const wxString& aKey )
|
||||
{
|
||||
return static_cast<T>( GetPolicyEnumUInt( aKey ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -143,6 +143,11 @@ namespace KIPLATFORM
|
||||
* @param aY destination y position
|
||||
*/
|
||||
void WarpPointer( wxWindow* aWindow, int aX, int aY );
|
||||
|
||||
/**
|
||||
* Configures the IME mode of a given control handle
|
||||
*/
|
||||
void ImmControl( wxWindow* aWindow, bool aEnable );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,41 +21,91 @@
|
||||
#include <kiplatform/policy.h>
|
||||
|
||||
#include <wx/string.h>
|
||||
#include <wx/tokenzr.h>
|
||||
#include <wx/msw/registry.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#define POLICY_KEY_ROOT "Software\\Policies\\KiCad\\KiCad"
|
||||
|
||||
|
||||
KIPLATFORM::POLICY::STATE KIPLATFORM::POLICY::GetPolicyState( const wxString& aKey )
|
||||
static wxRegKey* GetPolicyRegKey( wxString& aKey )
|
||||
{
|
||||
wxString key = aKey;
|
||||
wxRegKey* keyToUse = nullptr;
|
||||
wxRegKey userKey( wxRegKey::HKCU, POLICY_KEY_ROOT );
|
||||
wxRegKey compKey( wxRegKey::HKLM, POLICY_KEY_ROOT );
|
||||
|
||||
wxString keyPath = POLICY_KEY_ROOT;
|
||||
|
||||
wxStringTokenizer tokenizer( aKey, "\\" );
|
||||
while( tokenizer.HasMoreTokens() )
|
||||
{
|
||||
wxString token = tokenizer.GetNextToken();
|
||||
|
||||
if( tokenizer.HasMoreTokens() )
|
||||
{
|
||||
keyPath.Append( "\\" );
|
||||
keyPath.Append( token );
|
||||
}
|
||||
else
|
||||
key = token;
|
||||
}
|
||||
|
||||
std::unique_ptr<wxRegKey> userKey = std::make_unique<wxRegKey>( wxRegKey::HKCU, keyPath );
|
||||
|
||||
// we have user level policies take precedence over computer level policies
|
||||
if( userKey.Exists() && userKey.HasValue( aKey ) )
|
||||
if( userKey->Exists() && userKey->HasValue( key ) )
|
||||
{
|
||||
keyToUse = &userKey;
|
||||
keyToUse = userKey.release();
|
||||
}
|
||||
else
|
||||
{
|
||||
if( compKey.Exists() && compKey.HasValue( aKey ) )
|
||||
std::unique_ptr<wxRegKey> compKey = std::make_unique<wxRegKey>( wxRegKey::HKLM, keyPath );
|
||||
|
||||
if( compKey->Exists() && compKey->HasValue( key ) )
|
||||
{
|
||||
keyToUse = &compKey;
|
||||
keyToUse = compKey.release();
|
||||
}
|
||||
}
|
||||
|
||||
aKey = key;
|
||||
return keyToUse;
|
||||
}
|
||||
|
||||
|
||||
KIPLATFORM::POLICY::PBOOL KIPLATFORM::POLICY::GetPolicyBool( const wxString& aKey )
|
||||
{
|
||||
wxString key = aKey;
|
||||
std::unique_ptr<wxRegKey> keyToUse( GetPolicyRegKey( key ) );
|
||||
|
||||
if( keyToUse != nullptr )
|
||||
{
|
||||
long value;
|
||||
if( keyToUse->QueryValue( aKey, &value ) )
|
||||
if( keyToUse->QueryValue( key, &value ) )
|
||||
{
|
||||
if( value == 1 )
|
||||
return POLICY::STATE::ENABLED;
|
||||
return POLICY::PBOOL::ENABLED;
|
||||
else
|
||||
return POLICY::STATE::DISABLED;
|
||||
return POLICY::PBOOL::DISABLED;
|
||||
}
|
||||
}
|
||||
|
||||
return STATE::NOT_CONFIGURED;
|
||||
return PBOOL::NOT_CONFIGURED;
|
||||
}
|
||||
|
||||
|
||||
std::uint32_t KIPLATFORM::POLICY::GetPolicyEnumUInt( const wxString& aKey )
|
||||
{
|
||||
wxString key = aKey;
|
||||
std::unique_ptr<wxRegKey> keyToUse( GetPolicyRegKey( key ) );
|
||||
|
||||
if( keyToUse != nullptr )
|
||||
{
|
||||
long value;
|
||||
if( keyToUse->QueryValue( key, &value ) )
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -156,3 +156,16 @@ void KIPLATFORM::UI::WarpPointer( wxWindow* aWindow, int aX, int aY )
|
||||
{
|
||||
aWindow->WarpPointer( aX, aY );
|
||||
}
|
||||
|
||||
|
||||
void KIPLATFORM::UI::ImmControl( wxWindow* aWindow, bool aEnable )
|
||||
{
|
||||
if ( !aEnable )
|
||||
{
|
||||
ImmAssociateContext( aWindow->GetHWND(), NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
ImmAssociateContextEx( aWindow->GetHWND(), 0, IACE_DEFAULT );
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,14 @@
|
||||
|
||||
#include <wx/string.h>
|
||||
|
||||
KIPLATFORM::POLICY::STATE KIPLATFORM::POLICY::GetPolicyState( const wxString& aKey )
|
||||
|
||||
KIPLATFORM::POLICY::PBOOL KIPLATFORM::POLICY::GetPolicyBool( const wxString& aKey )
|
||||
{
|
||||
return STATE::NOT_CONFIGURED;
|
||||
return PBOOL::NOT_CONFIGURED;
|
||||
}
|
||||
|
||||
|
||||
std::uint32_t KIPLATFORM::POLICY::GetPolicyEnumUInt( const wxString& aKey )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -157,3 +157,8 @@ void KIPLATFORM::UI::WarpPointer( wxWindow* aWindow, int aX, int aY )
|
||||
{
|
||||
aWindow->WarpPointer( aX, aY );
|
||||
}
|
||||
|
||||
|
||||
void KIPLATFORM::UI::ImmControl( wxWindow* aWindow, bool aEnable )
|
||||
{
|
||||
}
|
||||
@@ -83,6 +83,14 @@ PROPERTIES_FRAME::PROPERTIES_FRAME( PL_EDITOR_FRAME* aParent ) :
|
||||
m_stcText->SetUseVerticalScrollBar( false );
|
||||
m_stcText->SetUseHorizontalScrollBar( false );
|
||||
m_stcText->SetEOLMode( wxSTC_EOL_LF ); // Always use LF as eol char, regardless the platform
|
||||
|
||||
#ifdef _WIN32
|
||||
// Without this setting, on Windows, some esoteric unicode chars create display issue
|
||||
// in a wxStyledTextCtrl.
|
||||
// for SetTechnology() info, see https://www.scintilla.org/ScintillaDoc.html#SCI_SETTECHNOLOGY
|
||||
m_stcText->SetTechnology(wxSTC_TECHNOLOGY_DIRECTWRITE);
|
||||
#endif
|
||||
|
||||
m_scintillaTricks = new SCINTILLA_TRICKS( m_stcText, wxT( "{}" ), false );
|
||||
|
||||
m_staticTextSizeInfo->SetFont( KIUI::GetInfoFont( this ).Italic() );
|
||||
|
||||
+26
-2
@@ -367,8 +367,11 @@ void BOARD::GetContextualTextVars( wxArrayString* aVars ) const
|
||||
|
||||
GetTitleBlock().GetContextualTextVars( aVars );
|
||||
|
||||
for( std::pair<wxString, wxString> entry : GetProject()->GetTextVars() )
|
||||
add( entry.first );
|
||||
if( GetProject() )
|
||||
{
|
||||
for( std::pair<wxString, wxString> entry : GetProject()->GetTextVars() )
|
||||
add( entry.first );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -743,6 +746,27 @@ void BOARD::SetZoneSettings( const ZONE_SETTINGS& aSettings )
|
||||
GetDesignSettings().SetDefaultZoneSettings( aSettings );
|
||||
}
|
||||
|
||||
int BOARD::GetMaxClearanceValue() const
|
||||
{
|
||||
int worstClearance = m_designSettings->GetBiggestClearanceValue();
|
||||
|
||||
for( ZONE* zone : m_zones )
|
||||
worstClearance = std::max( worstClearance, zone->GetLocalClearance() );
|
||||
|
||||
for( FOOTPRINT* footprint : m_footprints )
|
||||
{
|
||||
worstClearance = std::max( worstClearance, footprint->GetLocalClearance() );
|
||||
|
||||
for( PAD* pad : footprint->Pads() )
|
||||
worstClearance = std::max( worstClearance, pad->GetLocalClearance() );
|
||||
|
||||
for( ZONE* zone : footprint->Zones() )
|
||||
worstClearance = std::max( worstClearance, zone->GetLocalClearance() );
|
||||
}
|
||||
|
||||
return worstClearance;
|
||||
}
|
||||
|
||||
|
||||
void BOARD::CacheTriangulation( PROGRESS_REPORTER* aReporter, const std::vector<ZONE*>& aZones )
|
||||
{
|
||||
|
||||
@@ -1086,6 +1086,13 @@ public:
|
||||
FOOTPRINT* GetFootprint( const VECTOR2I& aPosition, PCB_LAYER_ID aActiveLayer,
|
||||
bool aVisibleOnly, bool aIgnoreLocked = false ) const;
|
||||
|
||||
/**
|
||||
* Returns the maximum clearance value for any object on the board. This considers
|
||||
* the clearances from board design settings as well as embedded clearances in footprints,
|
||||
* pads and zones. Includes electrical, physical, hole and edge clearances.
|
||||
*/
|
||||
int GetMaxClearanceValue() const;
|
||||
|
||||
/**
|
||||
* Map all nets in the given board to nets with the same name (if any) in the destination
|
||||
* board. This allows us to share layouts which came from the same hierarchical sheet in
|
||||
|
||||
@@ -1028,9 +1028,12 @@ bool BOARD_DESIGN_SETTINGS::Ignore( int aDRCErrorCode )
|
||||
|
||||
int BOARD_DESIGN_SETTINGS::GetBiggestClearanceValue() const
|
||||
{
|
||||
int biggest = 0;
|
||||
int biggest = std::max( m_MinClearance, m_HoleClearance );
|
||||
DRC_CONSTRAINT constraint;
|
||||
|
||||
biggest = std::max( biggest, m_HoleToHoleMin );
|
||||
biggest = std::max( biggest, m_CopperEdgeClearance );
|
||||
|
||||
if( m_DRCEngine )
|
||||
{
|
||||
m_DRCEngine->QueryWorstConstraint( CLEARANCE_CONSTRAINT, constraint );
|
||||
|
||||
@@ -1243,7 +1243,6 @@ bool PANEL_SETUP_BOARD_STACKUP::TransferDataFromWindow()
|
||||
// on that panel and it doesn't make sense to split it up.
|
||||
|
||||
BOARD_STACKUP& brd_stackup = m_brdSettings->GetStackupDescriptor();
|
||||
|
||||
STRING_FORMATTER old_stackup;
|
||||
|
||||
// FormatBoardStackup() (using FormatInternalUnits()) expects a "C" locale
|
||||
@@ -1251,12 +1250,6 @@ bool PANEL_SETUP_BOARD_STACKUP::TransferDataFromWindow()
|
||||
LOCALE_IO dummy;
|
||||
brd_stackup.FormatBoardStackup( &old_stackup, m_board, 0 );
|
||||
|
||||
brd_stackup.m_FinishType = m_stackup.m_FinishType;
|
||||
brd_stackup.m_HasDielectricConstrains = m_stackup.m_HasDielectricConstrains;
|
||||
brd_stackup.m_EdgeConnectorConstraints = m_stackup.m_EdgeConnectorConstraints;
|
||||
brd_stackup.m_CastellatedPads = m_stackup.m_CastellatedPads;
|
||||
brd_stackup.m_EdgePlating = m_stackup.m_EdgePlating;
|
||||
|
||||
// copy enabled items to the new board stackup
|
||||
brd_stackup.RemoveAll();
|
||||
|
||||
|
||||
@@ -710,7 +710,8 @@ static int getMinDist( BOARD_CONNECTED_ITEM* aItem, const VECTOR2I& aPoint )
|
||||
}
|
||||
|
||||
|
||||
bool CONNECTIVITY_DATA::TestTrackEndpointDangling( PCB_TRACK* aTrack, VECTOR2I* aPos ) const
|
||||
bool CONNECTIVITY_DATA::TestTrackEndpointDangling( PCB_TRACK* aTrack, bool aIgnoreTracksInPads,
|
||||
VECTOR2I* aPos ) const
|
||||
{
|
||||
const std::list<CN_ITEM*>& items = GetConnectivityAlgo()->ItemEntry( aTrack ).GetItems();
|
||||
|
||||
@@ -775,6 +776,12 @@ bool CONNECTIVITY_DATA::TestTrackEndpointDangling( PCB_TRACK* aTrack, VECTOR2I*
|
||||
// Both start and end in a zone: track may be redundant, but it's not dangling
|
||||
return false;
|
||||
}
|
||||
else if( item->Type() == PCB_PAD_T || item->Type() == PCB_VIA_T )
|
||||
{
|
||||
// Both start and end are under a pad: see what the caller wants us to do
|
||||
if( aIgnoreTracksInPads )
|
||||
return false;
|
||||
}
|
||||
|
||||
if( getMinDist( item, aTrack->GetStart() ) < getMinDist( item, aTrack->GetEnd() ) )
|
||||
start_count++;
|
||||
|
||||
@@ -210,7 +210,8 @@ public:
|
||||
|
||||
void RunOnUnconnectedEdges( std::function<bool( CN_EDGE& )> aFunc );
|
||||
|
||||
bool TestTrackEndpointDangling( PCB_TRACK* aTrack, VECTOR2I* aPos = nullptr ) const;
|
||||
bool TestTrackEndpointDangling( PCB_TRACK* aTrack, bool aIgnoreTracksInPads,
|
||||
VECTOR2I* aPos = nullptr ) const;
|
||||
|
||||
/**
|
||||
* Function ClearLocalRatsnest()
|
||||
|
||||
@@ -26,7 +26,7 @@ DIALOG_DIMENSION_PROPERTIES_BASE::DIALOG_DIMENSION_PROPERTIES_BASE( wxWindow* pa
|
||||
gbSizerLeader->SetFlexibleDirection( wxBOTH );
|
||||
gbSizerLeader->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
m_lblLeaderValue = new wxStaticText( m_sizerLeader->GetStaticBox(), wxID_ANY, _("Value:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_lblLeaderValue = new wxStaticText( m_sizerLeader->GetStaticBox(), wxID_ANY, _("Text:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_lblLeaderValue->Wrap( -1 );
|
||||
gbSizerLeader->Add( m_lblLeaderValue, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Value:</property>
|
||||
<property name="label">Text:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
|
||||
@@ -325,7 +325,9 @@ void DIALOG_DRC::OnRunDRCClick( wxCommandEvent& aEvent )
|
||||
{
|
||||
wxMilliSleep( 500 );
|
||||
m_runningResultsBook->ChangeSelection( 1 );
|
||||
#ifndef __WXGTK__
|
||||
KIPLATFORM::UI::ForceFocus( m_markerDataView );
|
||||
#endif
|
||||
}
|
||||
|
||||
refreshEditor();
|
||||
|
||||
@@ -106,7 +106,7 @@ DIALOG_FOOTPRINT_PROPERTIES_BASE::DIALOG_FOOTPRINT_PROPERTIES_BASE( wxWindow* pa
|
||||
sbSizer7 = new wxStaticBoxSizer( new wxStaticBox( m_PanelGeneral, wxID_ANY, _("Position") ), wxVERTICAL );
|
||||
|
||||
wxFlexGridSizer* fgSizerPos;
|
||||
fgSizerPos = new wxFlexGridSizer( 4, 3, 3, 0 );
|
||||
fgSizerPos = new wxFlexGridSizer( 4, 3, 2, 0 );
|
||||
fgSizerPos->AddGrowableCol( 1 );
|
||||
fgSizerPos->AddGrowableRow( 2 );
|
||||
fgSizerPos->SetFlexibleDirection( wxBOTH );
|
||||
@@ -143,7 +143,7 @@ DIALOG_FOOTPRINT_PROPERTIES_BASE::DIALOG_FOOTPRINT_PROPERTIES_BASE( wxWindow* pa
|
||||
m_orientationCtrl->Append( _("90") );
|
||||
m_orientationCtrl->Append( _("-90") );
|
||||
m_orientationCtrl->Append( _("180") );
|
||||
fgSizerPos->Add( m_orientationCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
fgSizerPos->Add( m_orientationCtrl, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 2 );
|
||||
|
||||
|
||||
fgSizerPos->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
@@ -156,7 +156,7 @@ DIALOG_FOOTPRINT_PROPERTIES_BASE::DIALOG_FOOTPRINT_PROPERTIES_BASE( wxWindow* pa
|
||||
int m_BoardSideCtrlNChoices = sizeof( m_BoardSideCtrlChoices ) / sizeof( wxString );
|
||||
m_BoardSideCtrl = new wxChoice( sbSizer7->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_BoardSideCtrlNChoices, m_BoardSideCtrlChoices, 0 );
|
||||
m_BoardSideCtrl->SetSelection( 1 );
|
||||
fgSizerPos->Add( m_BoardSideCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
|
||||
fgSizerPos->Add( m_BoardSideCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 2 );
|
||||
|
||||
|
||||
sbSizer7->Add( fgSizerPos, 0, wxEXPAND|wxBOTTOM, 3 );
|
||||
|
||||
@@ -498,7 +498,7 @@
|
||||
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
|
||||
<property name="permission">none</property>
|
||||
<property name="rows">4</property>
|
||||
<property name="vgap">3</property>
|
||||
<property name="vgap">2</property>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
|
||||
@@ -933,8 +933,8 @@
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="border">2</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxComboBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
@@ -1069,8 +1069,8 @@
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND</property>
|
||||
<property name="border">2</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxChoice" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
||||
@@ -61,6 +61,13 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BO
|
||||
|
||||
m_MultiLineText->SetEOLMode( wxSTC_EOL_LF );
|
||||
|
||||
#ifdef _WIN32
|
||||
// Without this setting, on Windows, some esoteric unicode chars create display issue
|
||||
// in a wxStyledTextCtrl.
|
||||
// for SetTechnology() info, see https://www.scintilla.org/ScintillaDoc.html#SCI_SETTECHNOLOGY
|
||||
m_MultiLineText->SetTechnology(wxSTC_TECHNOLOGY_DIRECTWRITE);
|
||||
#endif
|
||||
|
||||
m_scintillaTricks = new SCINTILLA_TRICKS( m_MultiLineText, wxT( "{}" ), false,
|
||||
[this]()
|
||||
{
|
||||
|
||||
@@ -54,6 +54,13 @@ DIALOG_TEXTBOX_PROPERTIES::DIALOG_TEXTBOX_PROPERTIES( PCB_BASE_EDIT_FRAME* aPare
|
||||
{
|
||||
m_MultiLineText->SetEOLMode( wxSTC_EOL_LF );
|
||||
|
||||
#ifdef _WIN32
|
||||
// Without this setting, on Windows, some esoteric unicode chars create display issue
|
||||
// in a wxStyledTextCtrl.
|
||||
// for SetTechnology() info, see https://www.scintilla.org/ScintillaDoc.html#SCI_SETTECHNOLOGY
|
||||
m_MultiLineText->SetTechnology(wxSTC_TECHNOLOGY_DIRECTWRITE);
|
||||
#endif
|
||||
|
||||
m_scintillaTricks = new SCINTILLA_TRICKS( m_MultiLineText, wxT( "{}" ), false,
|
||||
[this]()
|
||||
{
|
||||
|
||||
@@ -35,22 +35,18 @@ bool DRC_CACHE_GENERATOR::Run()
|
||||
{
|
||||
m_board = m_drcEngine->GetBoard();
|
||||
|
||||
int& m_largestClearance = m_board->m_DRCMaxClearance;
|
||||
int& m_largestPhysicalClearance = m_board->m_DRCMaxPhysicalClearance;
|
||||
int& largestClearance = m_board->m_DRCMaxClearance;
|
||||
int& largestPhysicalClearance = m_board->m_DRCMaxPhysicalClearance;
|
||||
DRC_CONSTRAINT worstConstraint;
|
||||
LSET boardCopperLayers = LSET::AllCuMask( m_board->GetCopperLayerCount() );
|
||||
|
||||
if( m_drcEngine->QueryWorstConstraint( CLEARANCE_CONSTRAINT, worstConstraint ) )
|
||||
m_largestClearance = worstConstraint.GetValue().Min();
|
||||
|
||||
if( m_drcEngine->QueryWorstConstraint( HOLE_CLEARANCE_CONSTRAINT, worstConstraint ) )
|
||||
m_largestClearance = std::max( m_largestClearance, worstConstraint.GetValue().Min() );
|
||||
largestClearance = std::max( largestClearance, m_board->GetMaxClearanceValue() );
|
||||
|
||||
if( m_drcEngine->QueryWorstConstraint( PHYSICAL_CLEARANCE_CONSTRAINT, worstConstraint ) )
|
||||
m_largestPhysicalClearance = worstConstraint.GetValue().Min();
|
||||
largestPhysicalClearance = worstConstraint.GetValue().Min();
|
||||
|
||||
if( m_drcEngine->QueryWorstConstraint( PHYSICAL_HOLE_CLEARANCE_CONSTRAINT, worstConstraint ) )
|
||||
m_largestPhysicalClearance = std::max( m_largestPhysicalClearance, worstConstraint.GetValue().Min() );
|
||||
largestPhysicalClearance = std::max( largestPhysicalClearance, worstConstraint.GetValue().Min() );
|
||||
|
||||
std::set<ZONE*> allZones;
|
||||
|
||||
@@ -65,16 +61,12 @@ bool DRC_CACHE_GENERATOR::Run()
|
||||
if( ( zone->GetLayerSet() & boardCopperLayers ).any() )
|
||||
{
|
||||
m_board->m_DRCCopperZones.push_back( zone );
|
||||
m_largestClearance = std::max( m_largestClearance, zone->GetLocalClearance() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for( FOOTPRINT* footprint : m_board->Footprints() )
|
||||
{
|
||||
for( PAD* pad : footprint->Pads() )
|
||||
m_largestClearance = std::max( m_largestClearance, pad->GetLocalClearance() );
|
||||
|
||||
for( ZONE* zone : footprint->Zones() )
|
||||
{
|
||||
allZones.insert( zone );
|
||||
@@ -84,10 +76,7 @@ bool DRC_CACHE_GENERATOR::Run()
|
||||
m_board->m_DRCZones.push_back( zone );
|
||||
|
||||
if( ( zone->GetLayerSet() & boardCopperLayers ).any() )
|
||||
{
|
||||
m_board->m_DRCCopperZones.push_back( zone );
|
||||
m_largestClearance = std::max( m_largestClearance, zone->GetLocalClearance() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,7 +113,7 @@ bool DRC_CACHE_GENERATOR::Run()
|
||||
for( PCB_LAYER_ID layer : copperLayers.Seq() )
|
||||
{
|
||||
if( IsCopperLayer( layer ) )
|
||||
m_board->m_CopperItemRTreeCache->Insert( item, layer, m_largestClearance );
|
||||
m_board->m_CopperItemRTreeCache->Insert( item, layer, largestClearance );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1807,13 +1807,14 @@ bool DRC_ENGINE::IsNetTieExclusion( int aTrackNetCode, PCB_LAYER_ID aTrackLayer,
|
||||
|
||||
if( parentFootprint && parentFootprint->IsNetTie() )
|
||||
{
|
||||
int epsilon = GetDesignSettings()->GetDRCEpsilon();
|
||||
std::map<wxString, int> padToNetTieGroupMap = parentFootprint->MapPadNumbersToNetTieGroups();
|
||||
|
||||
for( PAD* pad : parentFootprint->Pads() )
|
||||
{
|
||||
if( padToNetTieGroupMap[ pad->GetNumber() ] >= 0 && aTrackNetCode == pad->GetNetCode() )
|
||||
{
|
||||
if( pad->GetEffectiveShape( aTrackLayer )->Collide( aCollisionPos, 0 ) )
|
||||
if( pad->GetEffectiveShape( aTrackLayer )->Collide( aCollisionPos, epsilon ) )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,8 +198,8 @@ public:
|
||||
* Check if the given collision between a track and another item occurs during the track's
|
||||
* entry into a net-tie pad.
|
||||
*/
|
||||
static bool IsNetTieExclusion( int aTrackNetCode, PCB_LAYER_ID aTrackLayer,
|
||||
const VECTOR2I& aCollisionPos, BOARD_ITEM* aCollidingItem );
|
||||
bool IsNetTieExclusion( int aTrackNetCode, PCB_LAYER_ID aTrackLayer,
|
||||
const VECTOR2I& aCollisionPos, BOARD_ITEM* aCollidingItem );
|
||||
|
||||
private:
|
||||
void addRule( std::shared_ptr<DRC_RULE>& rule )
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user