From 791aa64950d2fdc5d061ca87dc12c58f732d5c0f Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 23 Oct 2023 18:23:24 +0100 Subject: [PATCH] Functionally it's a "reference image". The implementation happens to be a "bitmap". Fixes https://gitlab.com/kicad/code/kicad/-/issues/15932 --- common/CMakeLists.txt | 2 +- common/dialogs/panel_image_editor.cpp | 1 - common/dialogs/panel_image_editor_base.cpp | 38 +- common/dialogs/panel_image_editor_base.fbp | 459 +++++----- common/dialogs/panel_image_editor_base.h | 11 +- common/eda_item.cpp | 2 +- include/core/typeinfo.h | 4 +- pcbnew/CMakeLists.txt | 4 +- pcbnew/array_creator.cpp | 2 +- pcbnew/board.cpp | 7 +- pcbnew/board_commit.cpp | 2 +- pcbnew/collectors.cpp | 8 +- .../dialogs/dialog_footprint_properties.cpp | 2 +- .../dialogs/dialog_image_properties_base.cpp | 103 --- .../dialogs/dialog_image_properties_base.fbp | 823 ------------------ ... => dialog_reference_image_properties.cpp} | 29 +- ....h => dialog_reference_image_properties.h} | 28 +- ...dialog_reference_image_properties_base.cpp | 97 +++ ...dialog_reference_image_properties_base.fbp | 813 +++++++++++++++++ ... dialog_reference_image_properties_base.h} | 14 +- .../drc_test_provider_copper_clearance.cpp | 3 + pcbnew/edit.cpp | 4 +- pcbnew/footprint.cpp | 12 +- pcbnew/footprint_edit_frame.cpp | 2 +- pcbnew/footprint_editor_utils.cpp | 4 +- pcbnew/menubar_footprint_editor.cpp | 2 +- pcbnew/menubar_pcb_editor.cpp | 2 +- pcbnew/pcb_base_edit_frame.h | 2 +- pcbnew/pcb_edit_frame.cpp | 2 +- pcbnew/pcb_group.cpp | 2 +- pcbnew/pcb_painter.cpp | 27 +- pcbnew/pcb_painter.h | 4 +- ...pcb_bitmap.cpp => pcb_reference_image.cpp} | 99 ++- .../{pcb_bitmap.h => pcb_reference_image.h} | 32 +- pcbnew/plugins/kicad/pcb_parser.cpp | 16 +- pcbnew/plugins/kicad/pcb_parser.h | 40 +- pcbnew/plugins/kicad/pcb_plugin.cpp | 10 +- pcbnew/plugins/kicad/pcb_plugin.h | 4 +- pcbnew/python/swig/board.i | 2 +- pcbnew/python/swig/board_item.i | 12 +- pcbnew/python/swig/pcb_bitmap.i | 7 - pcbnew/python/swig/pcb_reference_image.i | 7 + pcbnew/toolbars_footprint_editor.cpp | 34 +- pcbnew/toolbars_pcb_editor.cpp | 2 +- pcbnew/tools/drawing_tool.cpp | 30 +- pcbnew/tools/drawing_tool.h | 6 +- pcbnew/tools/edit_tool.cpp | 6 +- pcbnew/tools/pcb_actions.cpp | 14 +- pcbnew/tools/pcb_actions.h | 2 +- pcbnew/tools/pcb_grid_helper.cpp | 2 +- pcbnew/tools/pcb_point_editor.cpp | 30 +- pcbnew/tools/pcb_selection_tool.cpp | 10 +- qa/tests/pcbnew/test_board_item.cpp | 4 +- 53 files changed, 1431 insertions(+), 1453 deletions(-) delete mode 100644 pcbnew/dialogs/dialog_image_properties_base.cpp delete mode 100644 pcbnew/dialogs/dialog_image_properties_base.fbp rename pcbnew/dialogs/{dialog_image_properties.cpp => dialog_reference_image_properties.cpp} (74%) rename pcbnew/dialogs/{dialog_image_properties.h => dialog_reference_image_properties.h} (63%) create mode 100644 pcbnew/dialogs/dialog_reference_image_properties_base.cpp create mode 100644 pcbnew/dialogs/dialog_reference_image_properties_base.fbp rename pcbnew/dialogs/{dialog_image_properties_base.h => dialog_reference_image_properties_base.h} (73%) rename pcbnew/{pcb_bitmap.cpp => pcb_reference_image.cpp} (67%) rename pcbnew/{pcb_bitmap.h => pcb_reference_image.h} (84%) delete mode 100644 pcbnew/python/swig/pcb_bitmap.i create mode 100644 pcbnew/python/swig/pcb_reference_image.i diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 062c62d0ef..22e6ddce2d 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -676,7 +676,7 @@ set( PCB_COMMON_SRCS ${CMAKE_SOURCE_DIR}/pcbnew/netinfo_list.cpp ${CMAKE_SOURCE_DIR}/pcbnew/pad.cpp ${CMAKE_SOURCE_DIR}/pcbnew/pcb_target.cpp - ${CMAKE_SOURCE_DIR}/pcbnew/pcb_bitmap.cpp + ${CMAKE_SOURCE_DIR}/pcbnew/pcb_reference_image.cpp ${CMAKE_SOURCE_DIR}/pcbnew/pcb_field.cpp ${CMAKE_SOURCE_DIR}/pcbnew/pcb_text.cpp ${CMAKE_SOURCE_DIR}/pcbnew/pcb_textbox.cpp diff --git a/common/dialogs/panel_image_editor.cpp b/common/dialogs/panel_image_editor.cpp index 89a57289d8..4cf85db255 100644 --- a/common/dialogs/panel_image_editor.cpp +++ b/common/dialogs/panel_image_editor.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #include #include diff --git a/common/dialogs/panel_image_editor_base.cpp b/common/dialogs/panel_image_editor_base.cpp index 5f23aa1162..f6af50e090 100644 --- a/common/dialogs/panel_image_editor_base.cpp +++ b/common/dialogs/panel_image_editor_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1-282-g1fa54006) +// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -21,42 +21,37 @@ PANEL_IMAGE_EDITOR_BASE::PANEL_IMAGE_EDITOR_BASE( wxWindow* parent, wxWindowID i bSizerLeft = new wxBoxSizer( wxHORIZONTAL ); m_panelDraw = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL|wxBORDER_SIMPLE ); - m_panelDraw->SetMinSize( wxSize( 256,256 ) ); + m_panelDraw->SetMinSize( wxSize( 300,300 ) ); bSizerLeft->Add( m_panelDraw, 1, wxEXPAND | wxALL, 5 ); - wxBoxSizer* bSizerRight; - bSizerRight = new wxBoxSizer( wxVERTICAL ); + wxGridBagSizer* gbSizer1; + gbSizer1 = new wxGridBagSizer( 5, 5 ); + gbSizer1->SetFlexibleDirection( wxBOTH ); + gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - m_buttonGrey = new wxButton( this, wxID_ANY, _("Grey"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizerRight->Add( m_buttonGrey, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - - - bSizerRight->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 10 ); - - m_staticTextScale = new wxStaticText( this, wxID_ANY, _("Image Scale:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextScale = new wxStaticText( this, wxID_ANY, _("Scale:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextScale->Wrap( -1 ); - bSizerRight->Add( m_staticTextScale, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + gbSizer1->Add( m_staticTextScale, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 ); m_textCtrlScale = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bSizerRight->Add( m_textCtrlScale, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - - wxBoxSizer* bSizerPPI; - bSizerPPI = new wxBoxSizer( wxHORIZONTAL ); + gbSizer1->Add( m_textCtrlScale, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); m_staticTextPPI = new wxStaticText( this, wxID_ANY, _("PPI:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextPPI->Wrap( -1 ); - bSizerPPI->Add( m_staticTextPPI, 0, wxALL, 5 ); + gbSizer1->Add( m_staticTextPPI, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 ); m_stPPI_Value = new wxStaticText( this, wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_stPPI_Value->Wrap( -1 ); - bSizerPPI->Add( m_stPPI_Value, 1, wxALL|wxEXPAND, 5 ); + gbSizer1->Add( m_stPPI_Value, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + m_buttonGrey = new wxButton( this, wxID_ANY, _("Convert to Greyscale"), wxDefaultPosition, wxDefaultSize, 0 ); + gbSizer1->Add( m_buttonGrey, wxGBPosition( 4, 0 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 ); - bSizerRight->Add( bSizerPPI, 0, wxEXPAND, 5 ); + gbSizer1->AddGrowableCol( 1 ); - - bSizerLeft->Add( bSizerRight, 0, wxEXPAND|wxALL, 5 ); + bSizerLeft->Add( gbSizer1, 0, wxEXPAND|wxALL, 10 ); bUpperSizer->Add( bSizerLeft, 1, wxEXPAND, 5 ); @@ -67,6 +62,7 @@ PANEL_IMAGE_EDITOR_BASE::PANEL_IMAGE_EDITOR_BASE( wxWindow* parent, wxWindowID i this->SetSizer( bSizerMain ); this->Layout(); + bSizerMain->Fit( this ); // Connect Events m_panelDraw->Connect( wxEVT_PAINT, wxPaintEventHandler( PANEL_IMAGE_EDITOR_BASE::OnRedrawPanel ), NULL, this ); diff --git a/common/dialogs/panel_image_editor_base.fbp b/common/dialogs/panel_image_editor_base.fbp index 0ab8997cad..81f17db0a9 100644 --- a/common/dialogs/panel_image_editor_base.fbp +++ b/common/dialogs/panel_image_editor_base.fbp @@ -35,7 +35,6 @@ 1 - 0 1 impl_virtual @@ -46,7 +45,7 @@ PANEL_IMAGE_EDITOR_BASE - 500,300 + -1,-1 ; ; forward_declare 0 @@ -101,7 +100,6 @@ Dock 0 Left - 0 1 1 @@ -114,7 +112,7 @@ 0 - 256,256 + 300,300 1 m_panelDraw 1 @@ -136,103 +134,27 @@ - 5 + 10 wxEXPAND|wxALL 0 - + + + wxBOTH + 1 + + 5 - bSizerRight - wxVERTICAL + gbSizer1 + wxFLEX_GROWMODE_SPECIFIED none - + 5 + 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - 0 - - - - - 1 - 0 - 1 - - 1 - - 0 - 0 - - Dock - 0 - Left - 0 - 1 - - 1 - - - 0 - 0 - wxID_ANY - Grey - - 0 - - 0 - - - 0 - - 1 - m_buttonGrey - 1 - - - protected - 1 - - - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnGreyScaleConvert - - - - 10 - wxEXPAND|wxTOP|wxBOTTOM - 0 - - 0 - protected - 0 - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 + 1 + 0 + wxALIGN_CENTER_VERTICAL + 0 + 1 1 1 @@ -254,7 +176,6 @@ Dock 0 Left - 0 1 1 @@ -262,7 +183,7 @@ 0 0 wxID_ANY - Image Scale: + Scale: 0 0 @@ -291,10 +212,13 @@ -1 - + 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND - 0 + 1 + 1 + wxALIGN_CENTER_VERTICAL|wxEXPAND + 0 + 1 1 1 @@ -316,7 +240,6 @@ Dock 0 Left - 0 1 1 @@ -356,139 +279,209 @@ - + 5 - wxEXPAND - 0 - + 1 + 0 + wxALIGN_CENTER_VERTICAL + 1 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + PPI: + 0 + + 0 + + + 0 - bSizerPPI - wxHORIZONTAL - none - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - PPI: - 0 - - 0 - - - 0 - - 1 - m_staticTextPPI - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 - - - - 5 - wxALL|wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - dummy - 0 - - 0 - - - 0 - - 1 - m_stPPI_Value - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 - - + 1 + m_staticTextPPI + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + 1 + 1 + wxALIGN_CENTER_VERTICAL|wxEXPAND + 1 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + dummy + 0 + + 0 + + + 0 + + 1 + m_stPPI_Value + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + 2 + 0 + wxEXPAND + 4 + 1 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 1 + + 1 + + + 0 + 0 + wxID_ANY + Convert to Greyscale + + 0 + + 0 + + + 0 + + 1 + m_buttonGrey + 1 + + + protected + 1 + + + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnGreyScaleConvert diff --git a/common/dialogs/panel_image_editor_base.h b/common/dialogs/panel_image_editor_base.h index e6bc11294f..22453440ab 100644 --- a/common/dialogs/panel_image_editor_base.h +++ b/common/dialogs/panel_image_editor_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1-282-g1fa54006) +// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -16,12 +16,13 @@ #include #include #include +#include +#include #include #include #include #include -#include -#include +#include #include /////////////////////////////////////////////////////////////////////////// @@ -36,11 +37,11 @@ class PANEL_IMAGE_EDITOR_BASE : public wxPanel protected: wxPanel* m_panelDraw; - wxButton* m_buttonGrey; wxStaticText* m_staticTextScale; wxTextCtrl* m_textCtrlScale; wxStaticText* m_staticTextPPI; wxStaticText* m_stPPI_Value; + wxButton* m_buttonGrey; // Virtual event handlers, override them in your derived class virtual void OnRedrawPanel( wxPaintEvent& event ) { event.Skip(); } @@ -49,7 +50,7 @@ class PANEL_IMAGE_EDITOR_BASE : public wxPanel public: - PANEL_IMAGE_EDITOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,300 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); + PANEL_IMAGE_EDITOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); ~PANEL_IMAGE_EDITOR_BASE(); diff --git a/common/eda_item.cpp b/common/eda_item.cpp index b06c99d538..cbf2c6db3f 100644 --- a/common/eda_item.cpp +++ b/common/eda_item.cpp @@ -344,7 +344,7 @@ static struct EDA_ITEM_DESC .Map( PCB_FOOTPRINT_T, _HKI( "Footprint" ) ) .Map( PCB_PAD_T, _HKI( "Pad" ) ) .Map( PCB_SHAPE_T, _HKI( "Graphic" ) ) - .Map( PCB_BITMAP_T, _HKI( "Bitmap" ) ) + .Map( PCB_REFERENCE_IMAGE_T, _HKI( "Reference Image" ) ) .Map( PCB_GENERATOR_T, _HKI( "Generator" ) ) .Map( PCB_FIELD_T, _HKI( "Field" ) ) .Map( PCB_TEXT_T, _HKI( "Text" ) ) diff --git a/include/core/typeinfo.h b/include/core/typeinfo.h index 337c6144fd..2cf2f5718b 100644 --- a/include/core/typeinfo.h +++ b/include/core/typeinfo.h @@ -86,7 +86,7 @@ enum KICAD_T PCB_FOOTPRINT_T, ///< class FOOTPRINT, a footprint PCB_PAD_T, ///< class PAD, a pad in a footprint PCB_SHAPE_T, ///< class PCB_SHAPE, a segment not on copper layers - PCB_BITMAP_T, ///< class PCB_BITMAP, bitmap on a layer + PCB_REFERENCE_IMAGE_T, ///< class PCB_REFERENCE_IMAGE, bitmap on a layer PCB_FIELD_T, ///< class PCB_FIELD, text associated with a footprint property PCB_GENERATOR_T, ///< class PCB_GENERATOR, generator on a layer PCB_TEXT_T, ///< class PCB_TEXT, text on a layer @@ -434,7 +434,7 @@ constexpr bool IsPcbnewType( const KICAD_T aType ) case PCB_FOOTPRINT_T: case PCB_PAD_T: case PCB_SHAPE_T: - case PCB_BITMAP_T: + case PCB_REFERENCE_IMAGE_T: case PCB_FIELD_T: case PCB_TEXT_T: case PCB_TEXTBOX_T: diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index e120fc3064..61cf698b23 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -100,8 +100,8 @@ set( PCBNEW_DIALOGS dialogs/dialog_push_pad_properties_base.cpp dialogs/dialog_shape_properties.cpp dialogs/dialog_shape_properties_base.cpp - dialogs/dialog_image_properties.cpp - dialogs/dialog_image_properties_base.cpp + dialogs/dialog_reference_image_properties.cpp + dialogs/dialog_reference_image_properties_base.cpp dialogs/dialog_import_settings.cpp dialogs/dialog_import_settings_base.cpp dialogs/dialog_imported_layers_base.cpp diff --git a/pcbnew/array_creator.cpp b/pcbnew/array_creator.cpp index 810c2a91a9..d76774601e 100644 --- a/pcbnew/array_creator.cpp +++ b/pcbnew/array_creator.cpp @@ -118,7 +118,7 @@ void ARRAY_CREATOR::Invoke() { case PCB_FOOTPRINT_T: case PCB_SHAPE_T: - case PCB_BITMAP_T: + case PCB_REFERENCE_IMAGE_T: case PCB_GENERATOR_T: case PCB_TEXT_T: case PCB_TEXTBOX_T: diff --git a/pcbnew/board.cpp b/pcbnew/board.cpp index c8374a0a1d..1487acef72 100644 --- a/pcbnew/board.cpp +++ b/pcbnew/board.cpp @@ -45,7 +45,6 @@ #include #include #include -#include #include #include #include @@ -898,7 +897,7 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode, bool aSkipConnectivity case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_LEADER_T: case PCB_SHAPE_T: - case PCB_BITMAP_T: + case PCB_REFERENCE_IMAGE_T: case PCB_FIELD_T: case PCB_TEXT_T: case PCB_TEXTBOX_T: @@ -1016,7 +1015,7 @@ void BOARD::Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aRemoveMode ) case PCB_DIM_ORTHOGONAL_T: case PCB_DIM_LEADER_T: case PCB_SHAPE_T: - case PCB_BITMAP_T: + case PCB_REFERENCE_IMAGE_T: case PCB_FIELD_T: case PCB_TEXT_T: case PCB_TEXTBOX_T: @@ -1502,7 +1501,7 @@ INSPECT_RESULT BOARD::Visit( INSPECTOR inspector, void* testData, case PCB_FOOTPRINT_T: case PCB_PAD_T: case PCB_SHAPE_T: - case PCB_BITMAP_T: + case PCB_REFERENCE_IMAGE_T: case PCB_FIELD_T: case PCB_TEXT_T: case PCB_TEXTBOX_T: diff --git a/pcbnew/board_commit.cpp b/pcbnew/board_commit.cpp index 9b1eee5fe3..0d4b750d09 100644 --- a/pcbnew/board_commit.cpp +++ b/pcbnew/board_commit.cpp @@ -308,7 +308,7 @@ void BOARD_COMMIT::Push( const wxString& aMessage, int aCommitFlags ) case PCB_TEXT_T: case PCB_PAD_T: case PCB_SHAPE_T: // a shape (normally not on copper layers) - case PCB_BITMAP_T: // a bitmap on a user layer + case PCB_REFERENCE_IMAGE_T: // a bitmap on an associated layer case PCB_GENERATOR_T: // a generator on a layer case PCB_TEXTBOX_T: // a wrapped text on a layer case PCB_TRACE_T: // a track segment (segment on a copper layer) diff --git a/pcbnew/collectors.cpp b/pcbnew/collectors.cpp index d2a404e170..3d7b3d5af6 100644 --- a/pcbnew/collectors.cpp +++ b/pcbnew/collectors.cpp @@ -40,7 +40,7 @@ const std::vector GENERAL_COLLECTOR::AllBoardItems = { PCB_MARKER_T, // in m_markers PCB_TEXT_T, // in m_drawings - PCB_BITMAP_T, // in m_drawings + PCB_REFERENCE_IMAGE_T, // in m_drawings PCB_TEXTBOX_T, // in m_drawings PCB_SHAPE_T, // in m_drawings PCB_DIM_ALIGNED_T, // in m_drawings @@ -63,7 +63,7 @@ const std::vector GENERAL_COLLECTOR::AllBoardItems = { const std::vector GENERAL_COLLECTOR::BoardLevelItems = { PCB_MARKER_T, - PCB_BITMAP_T, + PCB_REFERENCE_IMAGE_T, PCB_TEXT_T, PCB_TEXTBOX_T, PCB_SHAPE_T, @@ -110,8 +110,8 @@ const std::vector GENERAL_COLLECTOR::FootprintItems = { PCB_PAD_T, PCB_ZONE_T, PCB_GROUP_T, - PCB_BITMAP_T - }; + PCB_REFERENCE_IMAGE_T +}; const std::vector GENERAL_COLLECTOR::Tracks = { diff --git a/pcbnew/dialogs/dialog_footprint_properties.cpp b/pcbnew/dialogs/dialog_footprint_properties.cpp index d646a5d834..f9f8b41a1d 100644 --- a/pcbnew/dialogs/dialog_footprint_properties.cpp +++ b/pcbnew/dialogs/dialog_footprint_properties.cpp @@ -282,7 +282,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow() m_cbLocked->SetValue( m_footprint->IsLocked() ); m_cbLocked->SetToolTip( _( "Locked footprints cannot be freely moved and oriented on the " "canvas and can only be selected when the 'Locked items' checkbox " - "is enabled in the selection filter." ) ); + "is checked in the selection filter." ) ); if( m_footprint->GetAttributes() & FP_THROUGH_HOLE ) m_componentType->SetSelection( 0 ); diff --git a/pcbnew/dialogs/dialog_image_properties_base.cpp b/pcbnew/dialogs/dialog_image_properties_base.cpp deleted file mode 100644 index e04da7c018..0000000000 --- a/pcbnew/dialogs/dialog_image_properties_base.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1-282-g1fa54006) -// http://www.wxformbuilder.org/ -// -// PLEASE DO *NOT* EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#include "pcb_layer_box_selector.h" - -#include "dialog_image_properties_base.h" - -/////////////////////////////////////////////////////////////////////////// - -DIALOG_IMAGE_PROPERTIES_BASE::DIALOG_IMAGE_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) -{ - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* m_GeneralBoxSizer; - m_GeneralBoxSizer = new wxBoxSizer( wxVERTICAL ); - - m_Notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); - m_PanelGeneral = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizerProperties; - bSizerProperties = new wxBoxSizer( wxVERTICAL ); - - wxStaticBoxSizer* sbSizerProperties; - sbSizerProperties = new wxStaticBoxSizer( new wxStaticBox( m_PanelGeneral, wxID_ANY, wxT("Position") ), wxVERTICAL ); - - wxFlexGridSizer* fgSizerPos; - fgSizerPos = new wxFlexGridSizer( 3, 3, 1, 0 ); - fgSizerPos->AddGrowableCol( 1 ); - fgSizerPos->AddGrowableRow( 2 ); - fgSizerPos->SetFlexibleDirection( wxBOTH ); - fgSizerPos->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - - m_XPosLabel = new wxStaticText( sbSizerProperties->GetStaticBox(), wxID_ANY, wxT("X:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_XPosLabel->Wrap( -1 ); - fgSizerPos->Add( m_XPosLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - - m_ModPositionX = new wxTextCtrl( sbSizerProperties->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizerPos->Add( m_ModPositionX, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - m_XPosUnit = new wxStaticText( sbSizerProperties->GetStaticBox(), wxID_ANY, wxT("unit"), wxDefaultPosition, wxDefaultSize, 0 ); - m_XPosUnit->Wrap( -1 ); - fgSizerPos->Add( m_XPosUnit, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); - - m_YPosLabel = new wxStaticText( sbSizerProperties->GetStaticBox(), wxID_ANY, wxT("Y:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_YPosLabel->Wrap( -1 ); - fgSizerPos->Add( m_YPosLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - - m_ModPositionY = new wxTextCtrl( sbSizerProperties->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fgSizerPos->Add( m_ModPositionY, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP, 1 ); - - m_YPosUnit = new wxStaticText( sbSizerProperties->GetStaticBox(), wxID_ANY, wxT("unit"), wxDefaultPosition, wxDefaultSize, 0 ); - m_YPosUnit->Wrap( -1 ); - fgSizerPos->Add( m_YPosUnit, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - - m_LayerLabel = new wxStaticText( sbSizerProperties->GetStaticBox(), wxID_ANY, wxT("Layer:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_LayerLabel->Wrap( -1 ); - fgSizerPos->Add( m_LayerLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - - m_LayerSelectionCtrl = new PCB_LAYER_BOX_SELECTOR( sbSizerProperties->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - fgSizerPos->Add( m_LayerSelectionCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - - fgSizerPos->Add( 0, 0, 1, wxEXPAND, 5 ); - - - sbSizerProperties->Add( fgSizerPos, 0, wxBOTTOM|wxEXPAND, 3 ); - - m_cbLocked = new wxCheckBox( sbSizerProperties->GetStaticBox(), wxID_ANY, wxT("Locked"), wxDefaultPosition, wxDefaultSize, 0 ); - sbSizerProperties->Add( m_cbLocked, 0, wxALL, 5 ); - - - bSizerProperties->Add( sbSizerProperties, 1, wxALL|wxEXPAND, 5 ); - - - m_PanelGeneral->SetSizer( bSizerProperties ); - m_PanelGeneral->Layout(); - bSizerProperties->Fit( m_PanelGeneral ); - m_Notebook->AddPage( m_PanelGeneral, wxT("General"), false ); - - m_GeneralBoxSizer->Add( m_Notebook, 1, wxEXPAND | wxALL, 5 ); - - m_sdbSizerStdButtons = new wxStdDialogButtonSizer(); - m_sdbSizerStdButtonsOK = new wxButton( this, wxID_OK ); - m_sdbSizerStdButtons->AddButton( m_sdbSizerStdButtonsOK ); - m_sdbSizerStdButtonsCancel = new wxButton( this, wxID_CANCEL ); - m_sdbSizerStdButtons->AddButton( m_sdbSizerStdButtonsCancel ); - m_sdbSizerStdButtons->Realize(); - - m_GeneralBoxSizer->Add( m_sdbSizerStdButtons, 0, wxBOTTOM|wxEXPAND|wxTOP, 5 ); - - - this->SetSizer( m_GeneralBoxSizer ); - this->Layout(); - - this->Centre( wxBOTH ); -} - -DIALOG_IMAGE_PROPERTIES_BASE::~DIALOG_IMAGE_PROPERTIES_BASE() -{ -} diff --git a/pcbnew/dialogs/dialog_image_properties_base.fbp b/pcbnew/dialogs/dialog_image_properties_base.fbp deleted file mode 100644 index efd4eed924..0000000000 --- a/pcbnew/dialogs/dialog_image_properties_base.fbp +++ /dev/null @@ -1,823 +0,0 @@ - - - - - ; - C++ - 1 - source_name - 0 - 0 - res - UTF-8 - connect - dialog_image_properties_base - 1000 - none - - - 0 - DIALOG_IMAGE_PROPERTIES_BASE - - . - - 1 - 1 - 1 - 1 - UI - 0 - 0 - 0 - - 0 - wxAUI_MGR_DEFAULT - - wxBOTH - - 1 - 0 - 1 - impl_virtual - - - - 0 - wxID_ANY - - - DIALOG_IMAGE_PROPERTIES_BASE - - 353,260 - wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - DIALOG_SHIM; dialog_shim.h; forward_declare - Image Properties - - 0 - - - - - - m_GeneralBoxSizer - wxVERTICAL - none - - 5 - wxEXPAND | wxALL - 1 - - 1 - 1 - 1 - 1 - - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_Notebook - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - - - General - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_PanelGeneral - 1 - - - protected - 1 - - Resizable - 1 - - ; ; forward_declare - 0 - - - - wxTAB_TRAVERSAL - - - bSizerProperties - wxVERTICAL - none - - 5 - wxALL|wxEXPAND - 1 - - wxID_ANY - Position - - sbSizerProperties - wxVERTICAL - 1 - none - - 3 - wxBOTTOM|wxEXPAND - 0 - - 3 - wxBOTH - 1 - 2 - 0 - - fgSizerPos - wxFLEX_GROWMODE_SPECIFIED - none - 3 - 1 - - 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - X: - 0 - - 0 - - - 0 - - 1 - m_XPosLabel - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - 0 - - 1 - m_ModPositionX - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - unit - 0 - - 0 - - - 0 - - 1 - m_XPosUnit - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - Y: - 0 - - 0 - - - 0 - - 1 - m_YPosLabel - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 1 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - 0 - - 1 - m_ModPositionY - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - unit - 0 - - 0 - - - 0 - - 1 - m_YPosUnit - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - Layer: - 0 - - 0 - - - 0 - - 1 - m_LayerLabel - 1 - - - protected - 1 - - Resizable - 1 - - - ; forward_declare - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_LayerSelectionCtrl - 1 - - - protected - 1 - - Resizable - -1 - 1 - - - PCB_LAYER_BOX_SELECTOR; pcb_layer_box_selector.h; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - Locked - - 0 - - - 0 - - 1 - m_cbLocked - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxEXPAND|wxTOP - 0 - - 0 - 1 - 0 - 0 - 0 - 1 - 0 - 0 - - m_sdbSizerStdButtons - protected - - - - - - diff --git a/pcbnew/dialogs/dialog_image_properties.cpp b/pcbnew/dialogs/dialog_reference_image_properties.cpp similarity index 74% rename from pcbnew/dialogs/dialog_image_properties.cpp rename to pcbnew/dialogs/dialog_reference_image_properties.cpp index 5a5a4b75a7..f1b017db33 100644 --- a/pcbnew/dialogs/dialog_image_properties.cpp +++ b/pcbnew/dialogs/dialog_reference_image_properties.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2018-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2018-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 @@ -21,18 +21,21 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include #include #include -#include +#include #include #include #include -DIALOG_IMAGE_PROPERTIES::DIALOG_IMAGE_PROPERTIES( PCB_BASE_FRAME* aParent, PCB_BITMAP* aBitmap ) : - DIALOG_IMAGE_PROPERTIES_BASE( aParent ), m_frame( aParent ), m_bitmap( aBitmap ), +DIALOG_REFERENCE_IMAGE_PROPERTIES::DIALOG_REFERENCE_IMAGE_PROPERTIES( PCB_BASE_FRAME* aParent, + PCB_REFERENCE_IMAGE* aBitmap ) : + DIALOG_REFERENCE_IMAGE_PROPERTIES_BASE( aParent ), + m_frame( aParent ), + m_bitmap( aBitmap ), m_posX( aParent, m_XPosLabel, m_ModPositionX, m_XPosUnit ), m_posY( aParent, m_YPosLabel, m_ModPositionY, m_YPosUnit ) { @@ -57,10 +60,10 @@ DIALOG_IMAGE_PROPERTIES::DIALOG_IMAGE_PROPERTIES( PCB_BASE_FRAME* aParent, PCB_B } -void PCB_BASE_EDIT_FRAME::ShowBitmapPropertiesDialog( BOARD_ITEM* aBitmap ) +void PCB_BASE_EDIT_FRAME::ShowReferenceImagePropertiesDialog( BOARD_ITEM* aBitmap ) { - PCB_BITMAP* bitmap = static_cast( aBitmap ); - DIALOG_IMAGE_PROPERTIES dlg( this, bitmap ); + PCB_REFERENCE_IMAGE* bitmap = static_cast( aBitmap ); + DIALOG_REFERENCE_IMAGE_PROPERTIES dlg( this, bitmap ); if( dlg.ShowModal() == wxID_OK ) { @@ -72,7 +75,7 @@ void PCB_BASE_EDIT_FRAME::ShowBitmapPropertiesDialog( BOARD_ITEM* aBitmap ) } -bool DIALOG_IMAGE_PROPERTIES::TransferDataToWindow() +bool DIALOG_REFERENCE_IMAGE_PROPERTIES::TransferDataToWindow() { m_posX.SetValue( m_bitmap->GetPosition().x ); m_posY.SetValue( m_bitmap->GetPosition().y ); @@ -80,15 +83,15 @@ bool DIALOG_IMAGE_PROPERTIES::TransferDataToWindow() m_LayerSelectionCtrl->SetLayerSelection( m_bitmap->GetLayer() ); m_cbLocked->SetValue( m_bitmap->IsLocked() ); - m_cbLocked->SetToolTip( _( "Locked footprints cannot be freely moved and oriented on the " - "canvas and can only be selected when the 'Locked items' checkbox " - "is enabled in the selection filter." ) ); + m_cbLocked->SetToolTip( _( "Locked items cannot be freely moved and oriented on the canvas " + "and can only be selected when the 'Locked items' checkbox is " + "checked in the selection filter." ) ); return true; } -bool DIALOG_IMAGE_PROPERTIES::TransferDataFromWindow() +bool DIALOG_REFERENCE_IMAGE_PROPERTIES::TransferDataFromWindow() { if( m_imageEditor->TransferDataFromWindow() ) { diff --git a/pcbnew/dialogs/dialog_image_properties.h b/pcbnew/dialogs/dialog_reference_image_properties.h similarity index 63% rename from pcbnew/dialogs/dialog_image_properties.h rename to pcbnew/dialogs/dialog_reference_image_properties.h index f21d090104..a7f482ef54 100644 --- a/pcbnew/dialogs/dialog_image_properties.h +++ b/pcbnew/dialogs/dialog_reference_image_properties.h @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2018-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2018-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 @@ -21,35 +21,35 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef DIALOG_IMAGE_PROPERTIES_H -#define DIALOG_IMAGE_PROPERTIES_H +#ifndef DIALOG_REFERENCE_IMAGE_PROPERTIES_H +#define DIALOG_REFERENCE_IMAGE_PROPERTIES_H -#include +#include #include class PCB_BASE_FRAME; -class PCB_BITMAP; +class PCB_REFERENCE_IMAGE; class PANEL_IMAGE_EDITOR; -class DIALOG_IMAGE_PROPERTIES : public DIALOG_IMAGE_PROPERTIES_BASE +class DIALOG_REFERENCE_IMAGE_PROPERTIES : public DIALOG_REFERENCE_IMAGE_PROPERTIES_BASE { public: - DIALOG_IMAGE_PROPERTIES( PCB_BASE_FRAME* aParent, PCB_BITMAP* aBitmap ); - ~DIALOG_IMAGE_PROPERTIES() override {} + DIALOG_REFERENCE_IMAGE_PROPERTIES( PCB_BASE_FRAME* aParent, PCB_REFERENCE_IMAGE* aBitmap ); + ~DIALOG_REFERENCE_IMAGE_PROPERTIES() override {} private: bool TransferDataToWindow() override; bool TransferDataFromWindow() override; private: - PCB_BASE_FRAME* m_frame; - PCB_BITMAP* m_bitmap; - PANEL_IMAGE_EDITOR* m_imageEditor; + PCB_BASE_FRAME* m_frame; + PCB_REFERENCE_IMAGE* m_bitmap; + PANEL_IMAGE_EDITOR* m_imageEditor; - UNIT_BINDER m_posX; - UNIT_BINDER m_posY; + UNIT_BINDER m_posX; + UNIT_BINDER m_posY; }; -#endif +#endif // DIALOG_REFERENCE_IMAGE_PROPERTIES_H diff --git a/pcbnew/dialogs/dialog_reference_image_properties_base.cpp b/pcbnew/dialogs/dialog_reference_image_properties_base.cpp new file mode 100644 index 0000000000..8c7934856f --- /dev/null +++ b/pcbnew/dialogs/dialog_reference_image_properties_base.cpp @@ -0,0 +1,97 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) +// http://www.wxformbuilder.org/ +// +// PLEASE DO *NOT* EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "pcb_layer_box_selector.h" + +#include "dialog_reference_image_properties_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_REFERENCE_IMAGE_PROPERTIES_BASE::DIALOG_REFERENCE_IMAGE_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* m_GeneralBoxSizer; + m_GeneralBoxSizer = new wxBoxSizer( wxVERTICAL ); + + m_Notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + m_PanelGeneral = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* bSizerProperties; + bSizerProperties = new wxBoxSizer( wxVERTICAL ); + + wxGridBagSizer* gbSizer1; + gbSizer1 = new wxGridBagSizer( 3, 5 ); + gbSizer1->SetFlexibleDirection( wxBOTH ); + gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_ALL ); + gbSizer1->SetEmptyCellSize( wxSize( -1,5 ) ); + + m_XPosLabel = new wxStaticText( m_PanelGeneral, wxID_ANY, wxT("Position X:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_XPosLabel->Wrap( -1 ); + gbSizer1->Add( m_XPosLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 ); + + m_ModPositionX = new wxTextCtrl( m_PanelGeneral, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + gbSizer1->Add( m_ModPositionX, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + m_XPosUnit = new wxStaticText( m_PanelGeneral, wxID_ANY, wxT("unit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_XPosUnit->Wrap( -1 ); + gbSizer1->Add( m_XPosUnit, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 ); + + m_YPosLabel = new wxStaticText( m_PanelGeneral, wxID_ANY, wxT("Position Y:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_YPosLabel->Wrap( -1 ); + gbSizer1->Add( m_YPosLabel, wxGBPosition( 1, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 ); + + m_ModPositionY = new wxTextCtrl( m_PanelGeneral, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + gbSizer1->Add( m_ModPositionY, wxGBPosition( 1, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + m_YPosUnit = new wxStaticText( m_PanelGeneral, wxID_ANY, wxT("unit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_YPosUnit->Wrap( -1 ); + gbSizer1->Add( m_YPosUnit, wxGBPosition( 1, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 ); + + m_LayerLabel = new wxStaticText( m_PanelGeneral, wxID_ANY, wxT("Associated layer:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_LayerLabel->Wrap( -1 ); + gbSizer1->Add( m_LayerLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 ); + + m_LayerSelectionCtrl = new PCB_LAYER_BOX_SELECTOR( m_PanelGeneral, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + gbSizer1->Add( m_LayerSelectionCtrl, wxGBPosition( 2, 1 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + + m_cbLocked = new wxCheckBox( m_PanelGeneral, wxID_ANY, wxT("Locked"), wxDefaultPosition, wxDefaultSize, 0 ); + gbSizer1->Add( m_cbLocked, wxGBPosition( 4, 0 ), wxGBSpan( 1, 3 ), wxALIGN_CENTER_VERTICAL, 5 ); + + + gbSizer1->AddGrowableCol( 1 ); + gbSizer1->AddGrowableRow( 0 ); + + bSizerProperties->Add( gbSizer1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 ); + + + m_PanelGeneral->SetSizer( bSizerProperties ); + m_PanelGeneral->Layout(); + bSizerProperties->Fit( m_PanelGeneral ); + m_Notebook->AddPage( m_PanelGeneral, wxT("General"), false ); + + m_GeneralBoxSizer->Add( m_Notebook, 1, wxEXPAND|wxALL, 10 ); + + m_sdbSizerStdButtons = new wxStdDialogButtonSizer(); + m_sdbSizerStdButtonsOK = new wxButton( this, wxID_OK ); + m_sdbSizerStdButtons->AddButton( m_sdbSizerStdButtonsOK ); + m_sdbSizerStdButtonsCancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizerStdButtons->AddButton( m_sdbSizerStdButtonsCancel ); + m_sdbSizerStdButtons->Realize(); + + m_GeneralBoxSizer->Add( m_sdbSizerStdButtons, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + + this->SetSizer( m_GeneralBoxSizer ); + this->Layout(); + m_GeneralBoxSizer->Fit( this ); + + this->Centre( wxBOTH ); +} + +DIALOG_REFERENCE_IMAGE_PROPERTIES_BASE::~DIALOG_REFERENCE_IMAGE_PROPERTIES_BASE() +{ +} diff --git a/pcbnew/dialogs/dialog_reference_image_properties_base.fbp b/pcbnew/dialogs/dialog_reference_image_properties_base.fbp new file mode 100644 index 0000000000..8d387bafdd --- /dev/null +++ b/pcbnew/dialogs/dialog_reference_image_properties_base.fbp @@ -0,0 +1,813 @@ + + + + + ; + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + dialog_reference_image_properties_base + 1000 + none + + + 0 + DIALOG_REFERENCE_IMAGE_PROPERTIES_BASE + + . + + 1 + 1 + 1 + 1 + UI + 0 + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + DIALOG_REFERENCE_IMAGE_PROPERTIES_BASE + + -1,-1 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + DIALOG_SHIM; dialog_shim.h; forward_declare + Reference Image Properties + + 0 + + + + + + m_GeneralBoxSizer + wxVERTICAL + none + + 10 + wxEXPAND|wxALL + 1 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_Notebook + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + + + General + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_PanelGeneral + 1 + + + protected + 1 + + Resizable + 1 + + ; ; forward_declare + 0 + + + + wxTAB_TRAVERSAL + + + bSizerProperties + wxVERTICAL + none + + 10 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 0 + + -1,5 + wxBOTH + 1 + 0 + 5 + + gbSizer1 + wxFLEX_GROWMODE_ALL + none + 3 + + 5 + 1 + 0 + wxALIGN_CENTER_VERTICAL + 0 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Position X: + 0 + + 0 + + + 0 + + 1 + m_XPosLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + 1 + 1 + wxALIGN_CENTER_VERTICAL|wxEXPAND + 0 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_ModPositionX + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + 1 + 2 + wxALIGN_CENTER_VERTICAL + 0 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + unit + 0 + + 0 + + + 0 + + 1 + m_XPosUnit + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + 1 + 0 + wxALIGN_CENTER_VERTICAL + 1 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Position Y: + 0 + + 0 + + + 0 + + 1 + m_YPosLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + 1 + 1 + wxALIGN_CENTER_VERTICAL|wxEXPAND + 1 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_ModPositionY + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + 1 + 2 + wxALIGN_CENTER_VERTICAL + 1 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + unit + 0 + + 0 + + + 0 + + 1 + m_YPosUnit + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + 1 + 0 + wxALIGN_CENTER_VERTICAL + 2 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Associated layer: + 0 + + 0 + + + 0 + + 1 + m_LayerLabel + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + + + -1 + + + + 5 + 1 + 1 + wxALIGN_CENTER_VERTICAL|wxEXPAND + 2 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_LayerSelectionCtrl + 1 + + + protected + 1 + + Resizable + -1 + 1 + + + PCB_LAYER_BOX_SELECTOR; pcb_layer_box_selector.h; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + 5 + 3 + 0 + wxALIGN_CENTER_VERTICAL + 4 + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Locked + + 0 + + + 0 + + 1 + m_cbLocked + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizerStdButtons + protected + + + + + + diff --git a/pcbnew/dialogs/dialog_image_properties_base.h b/pcbnew/dialogs/dialog_reference_image_properties_base.h similarity index 73% rename from pcbnew/dialogs/dialog_image_properties_base.h rename to pcbnew/dialogs/dialog_reference_image_properties_base.h index a055350a55..cde6f8579d 100644 --- a/pcbnew/dialogs/dialog_image_properties_base.h +++ b/pcbnew/dialogs/dialog_reference_image_properties_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1-282-g1fa54006) +// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -20,9 +20,9 @@ class PCB_LAYER_BOX_SELECTOR; #include #include #include -#include #include -#include +#include +#include #include #include #include @@ -35,9 +35,9 @@ class PCB_LAYER_BOX_SELECTOR; /////////////////////////////////////////////////////////////////////////////// -/// Class DIALOG_IMAGE_PROPERTIES_BASE +/// Class DIALOG_REFERENCE_IMAGE_PROPERTIES_BASE /////////////////////////////////////////////////////////////////////////////// -class DIALOG_IMAGE_PROPERTIES_BASE : public DIALOG_SHIM +class DIALOG_REFERENCE_IMAGE_PROPERTIES_BASE : public DIALOG_SHIM { private: @@ -59,9 +59,9 @@ class DIALOG_IMAGE_PROPERTIES_BASE : public DIALOG_SHIM public: - DIALOG_IMAGE_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Image Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 353,260 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_REFERENCE_IMAGE_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Reference Image Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); - ~DIALOG_IMAGE_PROPERTIES_BASE(); + ~DIALOG_REFERENCE_IMAGE_PROPERTIES_BASE(); }; diff --git a/pcbnew/drc/drc_test_provider_copper_clearance.cpp b/pcbnew/drc/drc_test_provider_copper_clearance.cpp index 621276a99c..22b1f013ef 100644 --- a/pcbnew/drc/drc_test_provider_copper_clearance.cpp +++ b/pcbnew/drc/drc_test_provider_copper_clearance.cpp @@ -1018,6 +1018,9 @@ void DRC_TEST_PROVIDER_COPPER_CLEARANCE::testGraphicClearances( ) auto testGraphicAgainstZone = [&]( BOARD_ITEM* item ) { + if( item->Type() == PCB_REFERENCE_IMAGE_T ) + return; + if( !IsCopperLayer( item->GetLayer() ) ) return; diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index d74a18210b..4deff50baa 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -123,8 +123,8 @@ void PCB_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem ) { switch( aItem->Type() ) { - case PCB_BITMAP_T: - ShowBitmapPropertiesDialog( aItem); + case PCB_REFERENCE_IMAGE_T: + ShowReferenceImagePropertiesDialog( aItem ); break; case PCB_FIELD_T: diff --git a/pcbnew/footprint.cpp b/pcbnew/footprint.cpp index 621ad05de5..ee30735778 100644 --- a/pcbnew/footprint.cpp +++ b/pcbnew/footprint.cpp @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include #include @@ -736,7 +736,7 @@ void FOOTPRINT::Add( BOARD_ITEM* aBoardItem, ADD_MODE aMode, bool aSkipConnectiv case PCB_DIM_ORTHOGONAL_T: case PCB_SHAPE_T: case PCB_TEXTBOX_T: - case PCB_BITMAP_T: + case PCB_REFERENCE_IMAGE_T: if( aMode == ADD_MODE::APPEND ) m_drawings.push_back( aBoardItem ); else @@ -810,7 +810,7 @@ void FOOTPRINT::Remove( BOARD_ITEM* aBoardItem, REMOVE_MODE aMode ) case PCB_DIM_LEADER_T: case PCB_SHAPE_T: case PCB_TEXTBOX_T: - case PCB_BITMAP_T: + case PCB_REFERENCE_IMAGE_T: for( auto it = m_drawings.begin(); it != m_drawings.end(); ++it ) { if( *it == aBoardItem ) @@ -1016,7 +1016,7 @@ const BOX2I FOOTPRINT::GetBoundingBox( bool aIncludeText, bool aIncludeInvisible // We want the bitmap bounding box just in the footprint editor // so it will start with the correct initial zoom - if( item->Type() == PCB_BITMAP_T && !isFPEdit ) + if( item->Type() == PCB_REFERENCE_IMAGE_T && !isFPEdit ) continue; // Handle text separately @@ -1145,7 +1145,7 @@ const BOX2I FOOTPRINT::GetLayerBoundingBox( LSET aLayers ) const // We want the bitmap bounding box just in the footprint editor // so it will start with the correct initial zoom - if( item->Type() == PCB_BITMAP_T && !isFPEdit ) + if( item->Type() == PCB_REFERENCE_IMAGE_T && !isFPEdit ) continue; bbox.Merge( item->GetBoundingBox() ); @@ -1190,7 +1190,7 @@ SHAPE_POLY_SET FOOTPRINT::GetBoundingHull() const if( !isFPEdit && m_privateLayers.test( item->GetLayer() ) ) continue; - if( item->Type() != PCB_TEXT_T && item->Type() != PCB_BITMAP_T ) + if( item->Type() != PCB_TEXT_T && item->Type() != PCB_REFERENCE_IMAGE_T ) { item->TransformShapeToPolygon( rawPolys, UNDEFINED_LAYER, 0, ARC_LOW_DEF, ERROR_OUTSIDE ); diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index 8c7bb85337..ed04a064f2 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -1281,7 +1281,7 @@ void FOOTPRINT_EDIT_FRAME::setupUIConditions() CURRENT_EDIT_TOOL( PCB_ACTIONS::drawArc ); CURRENT_EDIT_TOOL( PCB_ACTIONS::drawPolygon ); CURRENT_EDIT_TOOL( PCB_ACTIONS::drawRuleArea ); - CURRENT_EDIT_TOOL( PCB_ACTIONS::placeImage ); + CURRENT_EDIT_TOOL( PCB_ACTIONS::placeReferenceImage ); CURRENT_EDIT_TOOL( PCB_ACTIONS::placeText ); CURRENT_EDIT_TOOL( PCB_ACTIONS::drawTextBox ); CURRENT_EDIT_TOOL( PCB_ACTIONS::drawAlignedDimension ); diff --git a/pcbnew/footprint_editor_utils.cpp b/pcbnew/footprint_editor_utils.cpp index 061a2fa626..78697d1d0a 100644 --- a/pcbnew/footprint_editor_utils.cpp +++ b/pcbnew/footprint_editor_utils.cpp @@ -182,8 +182,8 @@ void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem ) { switch( aItem->Type() ) { - case PCB_BITMAP_T: - ShowBitmapPropertiesDialog( aItem ); + case PCB_REFERENCE_IMAGE_T: + ShowReferenceImagePropertiesDialog( aItem ); break; case PCB_PAD_T: diff --git a/pcbnew/menubar_footprint_editor.cpp b/pcbnew/menubar_footprint_editor.cpp index 2a7d60fe52..9b7ebb2bbf 100644 --- a/pcbnew/menubar_footprint_editor.cpp +++ b/pcbnew/menubar_footprint_editor.cpp @@ -169,7 +169,7 @@ void FOOTPRINT_EDIT_FRAME::doReCreateMenuBar() placeMenu->Add( PCB_ACTIONS::drawRectangle ); placeMenu->Add( PCB_ACTIONS::drawCircle ); placeMenu->Add( PCB_ACTIONS::drawPolygon ); - placeMenu->Add( PCB_ACTIONS::placeImage ); + placeMenu->Add( PCB_ACTIONS::placeReferenceImage ); placeMenu->Add( PCB_ACTIONS::placeText ); placeMenu->Add( PCB_ACTIONS::drawTextBox ); diff --git a/pcbnew/menubar_pcb_editor.cpp b/pcbnew/menubar_pcb_editor.cpp index ff951b67e2..3afc918069 100644 --- a/pcbnew/menubar_pcb_editor.cpp +++ b/pcbnew/menubar_pcb_editor.cpp @@ -308,7 +308,7 @@ void PCB_EDIT_FRAME::doReCreateMenuBar() placeMenu->Add( PCB_ACTIONS::drawRectangle ); placeMenu->Add( PCB_ACTIONS::drawCircle ); placeMenu->Add( PCB_ACTIONS::drawPolygon ); - placeMenu->Add( PCB_ACTIONS::placeImage ); + placeMenu->Add( PCB_ACTIONS::placeReferenceImage ); placeMenu->Add( PCB_ACTIONS::placeText ); placeMenu->Add( PCB_ACTIONS::drawTextBox ); diff --git a/pcbnew/pcb_base_edit_frame.h b/pcbnew/pcb_base_edit_frame.h index 6a6aeee2fd..c0db4cad9f 100644 --- a/pcbnew/pcb_base_edit_frame.h +++ b/pcbnew/pcb_base_edit_frame.h @@ -175,7 +175,7 @@ public: */ //void SetRotationAngle( EDA_ANGLE aRotationAngle ); - void ShowBitmapPropertiesDialog( BOARD_ITEM* aBitmap ); + void ShowReferenceImagePropertiesDialog( BOARD_ITEM* aBitmap ); void ShowTextPropertiesDialog( PCB_TEXT* aText ); int ShowTextBoxPropertiesDialog( PCB_TEXTBOX* aTextBox ); void ShowGraphicItemPropertiesDialog( PCB_SHAPE* aShape ); diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 33e2140a4e..a8018e7214 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -951,7 +951,7 @@ void PCB_EDIT_FRAME::setupUIConditions() CURRENT_EDIT_TOOL( PCB_ACTIONS::drawCircle ); CURRENT_EDIT_TOOL( PCB_ACTIONS::drawArc ); CURRENT_EDIT_TOOL( PCB_ACTIONS::drawPolygon ); - CURRENT_EDIT_TOOL( PCB_ACTIONS::placeImage ); + CURRENT_EDIT_TOOL( PCB_ACTIONS::placeReferenceImage ); CURRENT_EDIT_TOOL( PCB_ACTIONS::placeText ); CURRENT_EDIT_TOOL( PCB_ACTIONS::drawTextBox ); CURRENT_EDIT_TOOL( PCB_ACTIONS::drawAlignedDimension ); diff --git a/pcbnew/pcb_group.cpp b/pcbnew/pcb_group.cpp index 155f35c04b..a260cab672 100644 --- a/pcbnew/pcb_group.cpp +++ b/pcbnew/pcb_group.cpp @@ -53,7 +53,7 @@ bool PCB_GROUP::IsGroupableType( KICAD_T aType ) case PCB_FOOTPRINT_T: case PCB_PAD_T: case PCB_SHAPE_T: - case PCB_BITMAP_T: + case PCB_REFERENCE_IMAGE_T: case PCB_FIELD_T: case PCB_TEXT_T: case PCB_TEXTBOX_T: diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 3da4e56d74..da9af3c4c4 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include @@ -439,9 +439,9 @@ COLOR4D PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) cons { color = color.Mix( m_layerColors[LAYER_PCB_BACKGROUND], m_hiContrastFactor ); - // Bitmaps can't have their color mixed so just reduce the opacity a bit so they - // show through less - if( item->Type() == PCB_BITMAP_T ) + // Reference images can't have their color mixed so just reduce the opacity a bit + // so they show through less + if( item->Type() == PCB_REFERENCE_IMAGE_T ) color.a *= m_hiContrastFactor; } } @@ -468,7 +468,7 @@ COLOR4D PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) cons color.a *= m_trackOpacity; else if( item->Type() == PCB_ZONE_T ) color.a *= m_zoneOpacity; - else if( item->Type() == PCB_BITMAP_T ) + else if( item->Type() == PCB_REFERENCE_IMAGE_T ) color.a *= m_imageOpacity; else if( item->Type() == PCB_SHAPE_T && item->IsOnCopperLayer() ) color.a *= m_trackOpacity; @@ -546,8 +546,8 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer ) { FOOTPRINT* parentFP = item->GetParentFootprint(); - // Never draw footprint bitmaps on board - if( item->Type() == PCB_BITMAP_T ) + // Never draw footprint reference images on board + if( item->Type() == PCB_REFERENCE_IMAGE_T ) { return false; } @@ -597,8 +597,8 @@ bool PCB_PAINTER::Draw( const VIEW_ITEM* aItem, int aLayer ) draw( static_cast( item ), aLayer ); break; - case PCB_BITMAP_T: - draw( static_cast( item ), aLayer ); + case PCB_REFERENCE_IMAGE_T: + draw( static_cast( item ), aLayer ); break; case PCB_FIELD_T: @@ -1990,7 +1990,7 @@ void PCB_PAINTER::strokeText( const wxString& aText, const VECTOR2I& aPosition, } -void PCB_PAINTER::draw( const PCB_BITMAP* aBitmap, int aLayer ) +void PCB_PAINTER::draw( const PCB_REFERENCE_IMAGE* aBitmap, int aLayer ) { m_gal->Save(); m_gal->Translate( aBitmap->GetPosition() ); @@ -2022,10 +2022,9 @@ void PCB_PAINTER::draw( const PCB_BITMAP* aBitmap, int aLayer ) m_gal->DrawRectangle( origin, end ); - // Hard code bitmaps as opaque when selected. Otherwise cached layers - // will not be rendered under the selected bitmap because cached layers - // are rendered after non-cached layers (e.g. bitmaps), which will have - // a closer Z order. + // Hard code reference images as opaque when selected. Otherwise cached layers will + // not be rendered under the selected image because cached layers are rendered after + // non-cached layers (e.g. bitmaps), which will have a closer Z order. m_gal->DrawBitmap( *aBitmap->GetImage(), 1.0 ); } else diff --git a/pcbnew/pcb_painter.h b/pcbnew/pcb_painter.h index fcee512654..1f9f7699ec 100644 --- a/pcbnew/pcb_painter.h +++ b/pcbnew/pcb_painter.h @@ -49,7 +49,7 @@ class PCB_SHAPE; class PCB_GROUP; class FOOTPRINT; class ZONE; -class PCB_BITMAP; +class PCB_REFERENCE_IMAGE; class PCB_TEXT; class PCB_TEXTBOX; class PCB_DIMENSION_BASE; @@ -182,7 +182,7 @@ protected: void draw( const PCB_VIA* aVia, int aLayer ); void draw( const PAD* aPad, int aLayer ); void draw( const PCB_SHAPE* aSegment, int aLayer ); - void draw( const PCB_BITMAP* aBitmap, int aLayer ); + void draw( const PCB_REFERENCE_IMAGE* aBitmap, int aLayer ); void draw( const PCB_TEXT* aText, int aLayer ); void draw( const PCB_TEXTBOX* aText, int aLayer ); void draw( const FOOTPRINT* aFootprint, int aLayer ); diff --git a/pcbnew/pcb_bitmap.cpp b/pcbnew/pcb_reference_image.cpp similarity index 67% rename from pcbnew/pcb_bitmap.cpp rename to pcbnew/pcb_reference_image.cpp index 40d246b3a3..eda9813a26 100644 --- a/pcbnew/pcb_bitmap.cpp +++ b/pcbnew/pcb_reference_image.cpp @@ -23,10 +23,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -/** - * @file pcb_bitmap.cpp - */ - #include #include #include @@ -37,7 +33,7 @@ #include #include #include -#include +#include #include #include @@ -47,8 +43,10 @@ using KIGFX::PCB_PAINTER; using KIGFX::PCB_RENDER_SETTINGS; -PCB_BITMAP::PCB_BITMAP( BOARD_ITEM* aParent, const VECTOR2I& pos, PCB_LAYER_ID aLayer ) : - BOARD_ITEM( aParent, PCB_BITMAP_T, aLayer ) + +PCB_REFERENCE_IMAGE::PCB_REFERENCE_IMAGE( BOARD_ITEM* aParent, const VECTOR2I& pos, + PCB_LAYER_ID aLayer ) : + BOARD_ITEM( aParent, PCB_REFERENCE_IMAGE_T, aLayer ) { m_pos = pos; m_bitmapBase = new BITMAP_BASE(); @@ -56,7 +54,8 @@ PCB_BITMAP::PCB_BITMAP( BOARD_ITEM* aParent, const VECTOR2I& pos, PCB_LAYER_ID a } -PCB_BITMAP::PCB_BITMAP( const PCB_BITMAP& aPCBBitmap ) : BOARD_ITEM( aPCBBitmap ) +PCB_REFERENCE_IMAGE::PCB_REFERENCE_IMAGE( const PCB_REFERENCE_IMAGE& aPCBBitmap ) : + BOARD_ITEM( aPCBBitmap ) { m_pos = aPCBBitmap.m_pos; m_bitmapBase = new BITMAP_BASE( *aPCBBitmap.m_bitmapBase ); @@ -64,7 +63,7 @@ PCB_BITMAP::PCB_BITMAP( const PCB_BITMAP& aPCBBitmap ) : BOARD_ITEM( aPCBBitmap } -PCB_BITMAP& PCB_BITMAP::operator=( const BOARD_ITEM& aItem ) +PCB_REFERENCE_IMAGE& PCB_REFERENCE_IMAGE::operator=( const BOARD_ITEM& aItem ) { wxCHECK_MSG( Type() == aItem.Type(), *this, wxT( "Cannot assign object type " ) + aItem.GetClass() + wxT( " to type " ) @@ -74,7 +73,7 @@ PCB_BITMAP& PCB_BITMAP::operator=( const BOARD_ITEM& aItem ) { BOARD_ITEM::operator=( aItem ); - PCB_BITMAP* bitmap = (PCB_BITMAP*) &aItem; + PCB_REFERENCE_IMAGE* bitmap = (PCB_REFERENCE_IMAGE*) &aItem; delete m_bitmapBase; m_bitmapBase = new BITMAP_BASE( *bitmap->m_bitmapBase ); @@ -86,7 +85,7 @@ PCB_BITMAP& PCB_BITMAP::operator=( const BOARD_ITEM& aItem ) } -bool PCB_BITMAP::ReadImageFile( const wxString& aFullFilename ) +bool PCB_REFERENCE_IMAGE::ReadImageFile( const wxString& aFullFilename ) { if( m_bitmapBase->ReadImageFile( aFullFilename ) ) { @@ -98,7 +97,7 @@ bool PCB_BITMAP::ReadImageFile( const wxString& aFullFilename ) } -bool PCB_BITMAP::ReadImageFile( wxMemoryBuffer& aBuffer ) +bool PCB_REFERENCE_IMAGE::ReadImageFile( wxMemoryBuffer& aBuffer ) { if( m_bitmapBase->ReadImageFile( aBuffer ) ) { @@ -110,19 +109,19 @@ bool PCB_BITMAP::ReadImageFile( wxMemoryBuffer& aBuffer ) } -EDA_ITEM* PCB_BITMAP::Clone() const +EDA_ITEM* PCB_REFERENCE_IMAGE::Clone() const { - return new PCB_BITMAP( *this ); + return new PCB_REFERENCE_IMAGE( *this ); } -void PCB_BITMAP::swapData( BOARD_ITEM* aItem ) +void PCB_REFERENCE_IMAGE::swapData( BOARD_ITEM* aItem ) { - wxCHECK_RET( aItem->Type() == PCB_BITMAP_T, - wxString::Format( wxT( "PCB_BITMAP object cannot swap data with %s object." ), - aItem->GetClass() ) ); + wxCHECK_RET( aItem->Type() == PCB_REFERENCE_IMAGE_T, + wxString::Format( wxT( "% object cannot swap data with %s object." ), + GetClass(), aItem->GetClass() ) ); - PCB_BITMAP* item = (PCB_BITMAP*) aItem; + PCB_REFERENCE_IMAGE* item = (PCB_REFERENCE_IMAGE*) aItem; std::swap( m_layer, item->m_layer ); std::swap( m_isKnockout, item->m_isKnockout ); std::swap( m_isLocked, item->m_isLocked ); @@ -134,7 +133,7 @@ void PCB_BITMAP::swapData( BOARD_ITEM* aItem ) } -double PCB_BITMAP::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const +double PCB_REFERENCE_IMAGE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const { constexpr double HIDE = std::numeric_limits::max(); @@ -157,7 +156,7 @@ double PCB_BITMAP::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const } -const BOX2I PCB_BITMAP::GetBoundingBox() const +const BOX2I PCB_REFERENCE_IMAGE::GetBoundingBox() const { // Bitmaps are center origin, BOX2Is need top-left origin VECTOR2I size = m_bitmapBase->GetSize(); @@ -167,21 +166,21 @@ const BOX2I PCB_BITMAP::GetBoundingBox() const } -std::shared_ptr PCB_BITMAP::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING aFlash ) const +std::shared_ptr PCB_REFERENCE_IMAGE::GetEffectiveShape( PCB_LAYER_ID aLayer, + FLASHING aFlash ) const { BOX2I box = GetBoundingBox(); - return std::shared_ptr( new SHAPE_RECT( box.GetPosition(), box.GetWidth(), - box.GetHeight() ) ); + return std::make_shared( box.GetPosition(), box.GetWidth(), box.GetHeight() ); } -const VECTOR2I PCB_BITMAP::GetSize() const +const VECTOR2I PCB_REFERENCE_IMAGE::GetSize() const { return m_bitmapBase->GetSize(); } -void PCB_BITMAP::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) +void PCB_REFERENCE_IMAGE::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) { if( aFlipLeftRight ) { @@ -195,7 +194,7 @@ void PCB_BITMAP::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) } } -void PCB_BITMAP::Rotate( const VECTOR2I& aCenter, const EDA_ANGLE& aAngle ) +void PCB_REFERENCE_IMAGE::Rotate( const VECTOR2I& aCenter, const EDA_ANGLE& aAngle ) { EDA_ANGLE norm( aAngle.AsDegrees(), DEGREES_T ); @@ -210,7 +209,7 @@ void PCB_BITMAP::Rotate( const VECTOR2I& aCenter, const EDA_ANGLE& aAngle ) #if defined( DEBUG ) -void PCB_BITMAP::Show( int nestLevel, std::ostream& os ) const +void PCB_REFERENCE_IMAGE::Show( int nestLevel, std::ostream& os ) const { // XML output: wxString s = GetClass(); @@ -220,7 +219,7 @@ void PCB_BITMAP::Show( int nestLevel, std::ostream& os ) const #endif -bool PCB_BITMAP::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const +bool PCB_REFERENCE_IMAGE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const { BOX2I rect = GetBoundingBox(); @@ -230,7 +229,7 @@ bool PCB_BITMAP::HitTest( const VECTOR2I& aPosition, int aAccuracy ) const } -bool PCB_BITMAP::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const +bool PCB_REFERENCE_IMAGE::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) const { BOX2I rect = aRect; @@ -243,15 +242,16 @@ bool PCB_BITMAP::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) c } -BITMAPS PCB_BITMAP::GetMenuImage() const +BITMAPS PCB_REFERENCE_IMAGE::GetMenuImage() const { return BITMAPS::image; } -void PCB_BITMAP::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) +void PCB_REFERENCE_IMAGE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, + std::vector& aList ) { - aList.emplace_back( _( "Bitmap" ), wxEmptyString ); + aList.emplace_back( _( "Reference Image" ), wxEmptyString ); aList.emplace_back( _( "PPI" ), wxString::Format( wxT( "%d "), GetImage()->GetPPI() ) ); aList.emplace_back( _( "Scale" ), wxString::Format( wxT( "%f "), GetImageScale() ) ); @@ -262,19 +262,19 @@ void PCB_BITMAP::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector( aOther ); + const PCB_REFERENCE_IMAGE& other = static_cast( aOther ); if( m_layer != other.m_layer ) return false; @@ -301,12 +301,12 @@ bool PCB_BITMAP::operator==( const BOARD_ITEM& aOther ) const } -double PCB_BITMAP::Similarity( const BOARD_ITEM& aOther ) const +double PCB_REFERENCE_IMAGE::Similarity( const BOARD_ITEM& aOther ) const { if( aOther.Type() != Type() ) return 0.0; - const PCB_BITMAP& other = static_cast( aOther ); + const PCB_REFERENCE_IMAGE& other = static_cast( aOther ); double similarity = 1.0; @@ -335,21 +335,26 @@ double PCB_BITMAP::Similarity( const BOARD_ITEM& aOther ) const } -static struct PCB_BITMAP_DESC +static struct PCB_REFERENCE_IMAGE_DESC { - PCB_BITMAP_DESC() + PCB_REFERENCE_IMAGE_DESC() { PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance(); - REGISTER_TYPE( PCB_BITMAP ); - propMgr.InheritsAfter( TYPE_HASH( PCB_BITMAP ), TYPE_HASH( BOARD_ITEM ) ); + REGISTER_TYPE( PCB_REFERENCE_IMAGE ); + propMgr.InheritsAfter( TYPE_HASH( PCB_REFERENCE_IMAGE ), TYPE_HASH( BOARD_ITEM ) ); - const wxString groupBitmap = _HKI( "Bitmap Properties" ); + propMgr.ReplaceProperty( TYPE_HASH( BOARD_ITEM ), _HKI( "Layer" ), + new PROPERTY_ENUM( _HKI( "Associated Layer" ), + &PCB_REFERENCE_IMAGE::SetLayer, &PCB_REFERENCE_IMAGE::GetLayer ) ); - propMgr.AddProperty( new PROPERTY( _HKI( "Scale" ), - &PCB_BITMAP::SetImageScale, &PCB_BITMAP::GetImageScale ), - groupBitmap ); + const wxString groupImage = _HKI( "Image Properties" ); + + propMgr.AddProperty( new PROPERTY( _HKI( "Scale" ), + &PCB_REFERENCE_IMAGE::SetImageScale, + &PCB_REFERENCE_IMAGE::GetImageScale ), + groupImage ); // For future use const wxString greyscale = _HKI( "Greyscale" ); } -} _PCB_BITMAP_DESC; +} _PCB_REFERENCE_IMAGE_DESC; diff --git a/pcbnew/pcb_bitmap.h b/pcbnew/pcb_reference_image.h similarity index 84% rename from pcbnew/pcb_bitmap.h rename to pcbnew/pcb_reference_image.h index fe3e15d16b..8272b61e67 100644 --- a/pcbnew/pcb_bitmap.h +++ b/pcbnew/pcb_reference_image.h @@ -3,7 +3,7 @@ * * Copyright (C) 2011 jean-pierre.charras * Copyright (C) 2022 Mike Williams - * Copyright (C) 2011-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2011-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 @@ -23,12 +23,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -/** - * @file pcb_bitmap.h - */ - -#ifndef _PCB_BITMAP_H_ -#define _PCB_BITMAP_H_ +#ifndef PCB_REFERENCE_IMAGE_H +#define PCB_REFERENCE_IMAGE_H #include @@ -38,22 +34,22 @@ /** * Object to handle a bitmap image that can be inserted in a PCB. */ -class PCB_BITMAP : public BOARD_ITEM +class PCB_REFERENCE_IMAGE : public BOARD_ITEM { public: - PCB_BITMAP( BOARD_ITEM* aParent, const VECTOR2I& pos = VECTOR2I( 0, 0 ), - PCB_LAYER_ID aLayer = F_Cu ); + PCB_REFERENCE_IMAGE( BOARD_ITEM* aParent, const VECTOR2I& pos = VECTOR2I( 0, 0 ), + PCB_LAYER_ID aLayer = F_Cu ); - PCB_BITMAP( const PCB_BITMAP& aPcbBitmap ); + PCB_REFERENCE_IMAGE( const PCB_REFERENCE_IMAGE& aPcbBitmap ); - ~PCB_BITMAP() { delete m_bitmapBase; } + ~PCB_REFERENCE_IMAGE() { delete m_bitmapBase; } - PCB_BITMAP& operator=( const BOARD_ITEM& aItem ); + PCB_REFERENCE_IMAGE& operator=( const BOARD_ITEM& aItem ); const BITMAP_BASE* GetImage() const { wxCHECK_MSG( m_bitmapBase != nullptr, nullptr, - "Invalid PCB_BITMAP init, m_bitmapBase is NULL." ); + wxS( "Invalid PCB_REFERENCE_IMAGE init, m_bitmapBase is NULL." ) ); return m_bitmapBase; } @@ -77,10 +73,10 @@ public: static inline bool ClassOf( const EDA_ITEM* aItem ) { - return aItem && PCB_BITMAP_T == aItem->Type(); + return aItem && PCB_REFERENCE_IMAGE_T == aItem->Type(); } - wxString GetClass() const override { return wxT( "PCB_BITMAP" ); } + wxString GetClass() const override { return wxT( "PCB_REFERENCE_IMAGE" ); } /** * @return the actual size (in user units, not in pixels) of the image. @@ -126,7 +122,7 @@ public: wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override { - return wxString( _( "Image" ) ); + return wxString( _( "Reference Image" ) ); } BITMAPS GetMenuImage() const override; @@ -157,4 +153,4 @@ private: BITMAP_BASE* m_bitmapBase; // the BITMAP_BASE item }; -#endif // _PCB_BITMAP_H_ +#endif // PCB_REFERENCE_IMAGE_H diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index caee6b7de8..245c87b6f2 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include #include @@ -67,7 +67,7 @@ #include // For some reason wxWidgets is built with wxUSE_BASE64 unset so expose the wxWidgets -// base64 code. Needed for PCB_BITMAP +// base64 code. Needed for PCB_REFERENCE_IMAGE #define wxUSE_BASE64 1 #include #include @@ -916,7 +916,7 @@ BOARD* PCB_PARSER::parseBOARD_unchecked() break; case T_image: - item = parsePCB_BITMAP( m_board ); + item = parsePCB_REFERENCE_IMAGE( m_board ); m_board->Add( item, ADD_MODE::BULK_APPEND, true ); bulkAddedItems.push_back( item ); break; @@ -2958,13 +2958,13 @@ PCB_SHAPE* PCB_PARSER::parsePCB_SHAPE( BOARD_ITEM* aParent ) } -PCB_BITMAP* PCB_PARSER::parsePCB_BITMAP( BOARD_ITEM* aParent ) +PCB_REFERENCE_IMAGE* PCB_PARSER::parsePCB_REFERENCE_IMAGE( BOARD_ITEM* aParent ) { wxCHECK_MSG( CurTok() == T_image, nullptr, - wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as an image." ) ); + wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a reference image." ) ); - T token; - std::unique_ptr bitmap = std::make_unique( aParent ); + T token; + std::unique_ptr bitmap = std::make_unique( aParent ); for( token = NextTok(); token != T_RIGHT; token = NextTok() ) { @@ -4143,7 +4143,7 @@ FOOTPRINT* PCB_PARSER::parseFOOTPRINT_unchecked( wxArrayString* aInitialComments case T_image: { - PCB_BITMAP* image = parsePCB_BITMAP( footprint.get() ); + PCB_REFERENCE_IMAGE* image = parsePCB_REFERENCE_IMAGE( footprint.get() ); footprint->Add( image, ADD_MODE::APPEND, true ); break; } diff --git a/pcbnew/plugins/kicad/pcb_parser.h b/pcbnew/plugins/kicad/pcb_parser.h index 2d8147966c..28cf15548c 100644 --- a/pcbnew/plugins/kicad/pcb_parser.h +++ b/pcbnew/plugins/kicad/pcb_parser.h @@ -50,7 +50,7 @@ class PAD; class BOARD_DESIGN_SETTINGS; class PCB_DIMENSION_BASE; class PCB_SHAPE; -class PCB_BITMAP; +class PCB_REFERENCE_IMAGE; class EDA_TEXT; class FP_SHAPE; class PCB_TEXT; @@ -207,33 +207,33 @@ private: void parseTEARDROP_PARAMETERS( TEARDROP_PARAMETERS* tdParams ); - PCB_SHAPE* parsePCB_SHAPE( BOARD_ITEM* aParent ); - PCB_TEXT* parsePCB_TEXT( BOARD_ITEM* aParent ); - void parsePCB_TEXT_effects( PCB_TEXT* aText ); - PCB_BITMAP* parsePCB_BITMAP( BOARD_ITEM* aParent ); - PCB_TEXTBOX* parsePCB_TEXTBOX( BOARD_ITEM* aParent ); - PCB_DIMENSION_BASE* parseDIMENSION( BOARD_ITEM* aParent ); + PCB_SHAPE* parsePCB_SHAPE( BOARD_ITEM* aParent ); + PCB_TEXT* parsePCB_TEXT( BOARD_ITEM* aParent ); + void parsePCB_TEXT_effects( PCB_TEXT* aText ); + PCB_REFERENCE_IMAGE* parsePCB_REFERENCE_IMAGE( BOARD_ITEM* aParent ); + PCB_TEXTBOX* parsePCB_TEXTBOX( BOARD_ITEM* aParent ); + PCB_DIMENSION_BASE* parseDIMENSION( BOARD_ITEM* aParent ); // Parse a footprint, but do not replace PARSE_ERROR with FUTURE_FORMAT_ERROR automatically. - FOOTPRINT* parseFOOTPRINT_unchecked( wxArrayString* aInitialComments = nullptr ); + FOOTPRINT* parseFOOTPRINT_unchecked( wxArrayString* aInitialComments = nullptr ); - PAD* parsePAD( FOOTPRINT* aParent = nullptr ); + PAD* parsePAD( FOOTPRINT* aParent = nullptr ); // Parse only the (option ...) inside a pad description - bool parsePAD_option( PAD* aPad ); + bool parsePAD_option( PAD* aPad ); - PCB_ARC* parseARC(); - PCB_TRACK* parsePCB_TRACK(); - PCB_VIA* parsePCB_VIA(); - ZONE* parseZONE( BOARD_ITEM_CONTAINER* aParent ); - PCB_TARGET* parsePCB_TARGET(); - BOARD* parseBOARD(); - void parseGROUP_members( GROUP_INFO& aGroupInfo ); - void parseGROUP( BOARD_ITEM* aParent ); - void parseGENERATOR( BOARD_ITEM* aParent ); + PCB_ARC* parseARC(); + PCB_TRACK* parsePCB_TRACK(); + PCB_VIA* parsePCB_VIA(); + ZONE* parseZONE( BOARD_ITEM_CONTAINER* aParent ); + PCB_TARGET* parsePCB_TARGET(); + BOARD* parseBOARD(); + void parseGROUP_members( GROUP_INFO& aGroupInfo ); + void parseGROUP( BOARD_ITEM* aParent ); + void parseGENERATOR( BOARD_ITEM* aParent ); // Parse a board, but do not replace PARSE_ERROR with FUTURE_FORMAT_ERROR automatically. - BOARD* parseBOARD_unchecked(); + BOARD* parseBOARD_unchecked(); /** * Parse the current token for the layer definition of a #BOARD_ITEM object. diff --git a/pcbnew/plugins/kicad/pcb_plugin.cpp b/pcbnew/plugins/kicad/pcb_plugin.cpp index c1fc3828ea..36c7cdbb54 100644 --- a/pcbnew/plugins/kicad/pcb_plugin.cpp +++ b/pcbnew/plugins/kicad/pcb_plugin.cpp @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include #include @@ -57,7 +57,7 @@ #include // For some reason wxWidgets is built with wxUSE_BASE64 unset so expose the wxWidgets -// base64 code. Needed for PCB_BITMAP +// base64 code. Needed for PCB_REFERENCE_IMAGE #define wxUSE_BASE64 1 #include #include @@ -374,8 +374,8 @@ void PCB_PLUGIN::Format( const BOARD_ITEM* aItem, int aNestLevel ) const format( static_cast( aItem ), aNestLevel ); break; - case PCB_BITMAP_T: - format( static_cast( aItem ), aNestLevel ); + case PCB_REFERENCE_IMAGE_T: + format( static_cast( aItem ), aNestLevel ); break; case PCB_TARGET_T: @@ -1030,7 +1030,7 @@ void PCB_PLUGIN::format( const PCB_SHAPE* aShape, int aNestLevel ) const } -void PCB_PLUGIN::format( const PCB_BITMAP* aBitmap, int aNestLevel ) const +void PCB_PLUGIN::format( const PCB_REFERENCE_IMAGE* aBitmap, int aNestLevel ) const { wxCHECK_RET( aBitmap != nullptr && m_out != nullptr, "" ); diff --git a/pcbnew/plugins/kicad/pcb_plugin.h b/pcbnew/plugins/kicad/pcb_plugin.h index 27cc2b0acc..51a3b71b57 100644 --- a/pcbnew/plugins/kicad/pcb_plugin.h +++ b/pcbnew/plugins/kicad/pcb_plugin.h @@ -41,7 +41,7 @@ class NETINFO_MAPPING; class BOARD_DESIGN_SETTINGS; class PCB_DIMENSION_BASE; class PCB_SHAPE; -class PCB_BITMAP; +class PCB_REFERENCE_IMAGE; class PCB_TARGET; class PAD; class PCB_GROUP; @@ -407,7 +407,7 @@ private: void format( const PCB_DIMENSION_BASE* aDimension, int aNestLevel = 0 ) const; - void format( const PCB_BITMAP* aBitmap, int aNestLevel = 0 ) const; + void format( const PCB_REFERENCE_IMAGE* aBitmap, int aNestLevel = 0 ) const; void format( const PCB_GROUP* aGroup, int aNestLevel = 0 ) const; diff --git a/pcbnew/python/swig/board.i b/pcbnew/python/swig/board.i index d6ca20d4e0..b22bbcd83a 100644 --- a/pcbnew/python/swig/board.i +++ b/pcbnew/python/swig/board.i @@ -63,7 +63,7 @@ HANDLE_EXCEPTIONS(BOARD::TracksInNetBetweenPoints) %include netclass.i %include pcb_plot_params.i %include pcb_group.i -%include pcb_bitmap.i +%include pcb_reference_image.i // std::vector templates %template(VIA_DIMENSION_Vector) std::vector; diff --git a/pcbnew/python/swig/board_item.i b/pcbnew/python/swig/board_item.i index b8a94b26ed..d1fe8b1eb6 100644 --- a/pcbnew/python/swig/board_item.i +++ b/pcbnew/python/swig/board_item.i @@ -64,7 +64,7 @@ class PCB_VIA; class PCB_ARC; class ZONE; class PCB_TARGET; -class PCB_BITMAP; +class PCB_REFERENCE_IMAGE; // Anything targeted to the %wrapper section is extern "C" whereas code targeted // to %header section is C++. @@ -90,7 +90,7 @@ static PCB_VIA* Cast_to_PCB_VIA( BOARD_ITEM* ); static PCB_ARC* Cast_to_PCB_ARC( BOARD_ITEM* ); static ZONE* Cast_to_ZONE( BOARD_ITEM* ); static PCB_TARGET* Cast_to_PCB_TARGET( BOARD_ITEM* ); -static PCB_BITMAP* Cast_to_PCB_BITMAP( BOARD_ITEM* ); +static PCB_REFERENCE_IMAGE* Cast_to_PCB_REFERENCE_IMAGE( BOARD_ITEM* ); #ifdef __cplusplus } // extern "C" @@ -116,7 +116,7 @@ static PCB_VIA* Cast_to_PCB_VIA( BOARD_ITEM* ); static PCB_ARC* Cast_to_PCB_ARC( BOARD_ITEM* ); static ZONE* Cast_to_ZONE( BOARD_ITEM* ); static PCB_TARGET* Cast_to_PCB_TARGET( BOARD_ITEM* ); -static PCB_BITMAP* Cast_to_PCB_BITMAP( BOARD_ITEM* ); +static PCB_REFERENCE_IMAGE* Cast_to_PCB_REFERENCE_IMAGE( BOARD_ITEM* ); %extend BOARD_ITEM @@ -159,8 +159,8 @@ static PCB_BITMAP* Cast_to_PCB_BITMAP( BOARD_ITEM* ); return Cast_to_PCB_ARC(self) elif ct=="PCB_TARGET": return Cast_to_PCB_TARGET(self) - elif ct=="PCB_BITMAP": - return Cast_to_PCB_BITMAP(self) + elif ct=="PCB_REFERENCE_IMAGE": + return Cast_to_PCB_REFERENCE_IMAGE(self) elif ct=="ZONE": return Cast_to_ZONE(self) else: @@ -212,5 +212,5 @@ static PCB_VIA* Cast_to_PCB_VIA( BOARD_ITEM* self ) { static PCB_ARC* Cast_to_PCB_ARC( BOARD_ITEM* self ) { return dynamic_cast(self); } static ZONE* Cast_to_ZONE( BOARD_ITEM* self ) { return dynamic_cast(self); } static PCB_TARGET* Cast_to_PCB_TARGET( BOARD_ITEM* self ) { return dynamic_cast(self); } -static PCB_BITMAP* Cast_to_PCB_BITMAP( BOARD_ITEM* self ) { return dynamic_cast(self); } +static PCB_REFERENCE_IMAGE* Cast_to_PCB_REFERENCE_IMAGE( BOARD_ITEM* self ) { return dynamic_cast(self); } %} diff --git a/pcbnew/python/swig/pcb_bitmap.i b/pcbnew/python/swig/pcb_bitmap.i deleted file mode 100644 index fb068ec8ea..0000000000 --- a/pcbnew/python/swig/pcb_bitmap.i +++ /dev/null @@ -1,7 +0,0 @@ - - -%include pcb_bitmap.h -%{ -#include -%} - diff --git a/pcbnew/python/swig/pcb_reference_image.i b/pcbnew/python/swig/pcb_reference_image.i new file mode 100644 index 0000000000..adbd6eb935 --- /dev/null +++ b/pcbnew/python/swig/pcb_reference_image.i @@ -0,0 +1,7 @@ + + +%include pcb_reference_image.h +%{ +#include +%} + diff --git a/pcbnew/toolbars_footprint_editor.cpp b/pcbnew/toolbars_footprint_editor.cpp index b5bd873d8a..375c7e98ae 100644 --- a/pcbnew/toolbars_footprint_editor.cpp +++ b/pcbnew/toolbars_footprint_editor.cpp @@ -4,7 +4,7 @@ * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2012 Wayne Stambaugh - * Copyright (C) 1992-2022 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 as published by the @@ -172,28 +172,28 @@ void FOOTPRINT_EDIT_FRAME::ReCreateVToolbar() &PCB_ACTIONS::drawLeader } ); } - m_drawToolBar->Add( ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE ); + m_drawToolBar->Add( ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->AddScaledSeparator( this ); - m_drawToolBar->Add( PCB_ACTIONS::placePad, ACTION_TOOLBAR::TOGGLE ); - m_drawToolBar->Add( PCB_ACTIONS::drawRuleArea, ACTION_TOOLBAR::TOGGLE ); + m_drawToolBar->Add( PCB_ACTIONS::placePad, ACTION_TOOLBAR::TOGGLE ); + m_drawToolBar->Add( PCB_ACTIONS::drawRuleArea, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->AddScaledSeparator( this ); - m_drawToolBar->Add( PCB_ACTIONS::drawLine, ACTION_TOOLBAR::TOGGLE ); - m_drawToolBar->Add( PCB_ACTIONS::drawArc, ACTION_TOOLBAR::TOGGLE ); - m_drawToolBar->Add( PCB_ACTIONS::drawRectangle, ACTION_TOOLBAR::TOGGLE ); - m_drawToolBar->Add( PCB_ACTIONS::drawCircle, ACTION_TOOLBAR::TOGGLE ); - m_drawToolBar->Add( PCB_ACTIONS::drawPolygon, ACTION_TOOLBAR::TOGGLE ); - m_drawToolBar->Add( PCB_ACTIONS::placeImage, ACTION_TOOLBAR::TOGGLE ); - m_drawToolBar->Add( PCB_ACTIONS::placeText, ACTION_TOOLBAR::TOGGLE ); - m_drawToolBar->Add( PCB_ACTIONS::drawTextBox, ACTION_TOOLBAR::TOGGLE ); - m_drawToolBar->AddGroup( dimensionGroup, ACTION_TOOLBAR::TOGGLE ); - m_drawToolBar->Add( ACTIONS::deleteTool, ACTION_TOOLBAR::TOGGLE ); + m_drawToolBar->Add( PCB_ACTIONS::drawLine, ACTION_TOOLBAR::TOGGLE ); + m_drawToolBar->Add( PCB_ACTIONS::drawArc, ACTION_TOOLBAR::TOGGLE ); + m_drawToolBar->Add( PCB_ACTIONS::drawRectangle, ACTION_TOOLBAR::TOGGLE ); + m_drawToolBar->Add( PCB_ACTIONS::drawCircle, ACTION_TOOLBAR::TOGGLE ); + m_drawToolBar->Add( PCB_ACTIONS::drawPolygon, ACTION_TOOLBAR::TOGGLE ); + m_drawToolBar->Add( PCB_ACTIONS::placeReferenceImage, ACTION_TOOLBAR::TOGGLE ); + m_drawToolBar->Add( PCB_ACTIONS::placeText, ACTION_TOOLBAR::TOGGLE ); + m_drawToolBar->Add( PCB_ACTIONS::drawTextBox, ACTION_TOOLBAR::TOGGLE ); + m_drawToolBar->AddGroup( dimensionGroup, ACTION_TOOLBAR::TOGGLE ); + m_drawToolBar->Add( ACTIONS::deleteTool, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->AddScaledSeparator( this ); - m_drawToolBar->Add( PCB_ACTIONS::setAnchor, ACTION_TOOLBAR::TOGGLE ); - m_drawToolBar->Add( PCB_ACTIONS::gridSetOrigin, ACTION_TOOLBAR::TOGGLE ); - m_drawToolBar->Add( ACTIONS::measureTool, ACTION_TOOLBAR::TOGGLE ); + m_drawToolBar->Add( PCB_ACTIONS::setAnchor, ACTION_TOOLBAR::TOGGLE ); + m_drawToolBar->Add( PCB_ACTIONS::gridSetOrigin, ACTION_TOOLBAR::TOGGLE ); + m_drawToolBar->Add( ACTIONS::measureTool, ACTION_TOOLBAR::TOGGLE ); PCB_SELECTION_TOOL* selTool = m_toolManager->GetTool(); diff --git a/pcbnew/toolbars_pcb_editor.cpp b/pcbnew/toolbars_pcb_editor.cpp index 62bb566f91..419038180c 100644 --- a/pcbnew/toolbars_pcb_editor.cpp +++ b/pcbnew/toolbars_pcb_editor.cpp @@ -437,7 +437,7 @@ void PCB_EDIT_FRAME::ReCreateVToolbar() m_drawToolBar->Add( PCB_ACTIONS::drawRectangle, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( PCB_ACTIONS::drawCircle, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( PCB_ACTIONS::drawPolygon, ACTION_TOOLBAR::TOGGLE ); - m_drawToolBar->Add( PCB_ACTIONS::placeImage, ACTION_TOOLBAR::TOGGLE ); + m_drawToolBar->Add( PCB_ACTIONS::placeReferenceImage, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( PCB_ACTIONS::placeText, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->Add( PCB_ACTIONS::drawTextBox, ACTION_TOOLBAR::TOGGLE ); m_drawToolBar->AddGroup( dimensionGroup, ACTION_TOOLBAR::TOGGLE ); diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index 19bb2b525b..0ce0fe744f 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -63,7 +63,7 @@ #include #include #include -#include +#include #include #include #include @@ -536,22 +536,22 @@ int DRAWING_TOOL::DrawArc( const TOOL_EVENT& aEvent ) } -int DRAWING_TOOL::PlaceImage( const TOOL_EVENT& aEvent ) +int DRAWING_TOOL::PlaceReferenceImage( const TOOL_EVENT& aEvent ) { if( m_inDrawingTool ) return 0; - REENTRANCY_GUARD guard( &m_inDrawingTool ); + REENTRANCY_GUARD guard( &m_inDrawingTool ); - PCB_BITMAP* image = aEvent.Parameter(); - bool immediateMode = image != nullptr; - PCB_GRID_HELPER grid( m_toolMgr, m_frame->GetMagneticItemsSettings() ); - bool ignorePrimePosition = false; - COMMON_SETTINGS* common_settings = Pgm().GetCommonSettings(); + PCB_REFERENCE_IMAGE* image = aEvent.Parameter(); + bool immediateMode = image != nullptr; + PCB_GRID_HELPER grid( m_toolMgr, m_frame->GetMagneticItemsSettings() ); + bool ignorePrimePosition = false; + COMMON_SETTINGS* common_settings = Pgm().GetCommonSettings(); - VECTOR2I cursorPos = getViewControls()->GetCursorPosition(); - PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool(); - BOARD_COMMIT commit( m_frame ); + VECTOR2I cursorPos = getViewControls()->GetCursorPosition(); + PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool(); + BOARD_COMMIT commit( m_frame ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear ); @@ -696,7 +696,7 @@ int DRAWING_TOOL::PlaceImage( const TOOL_EVENT& aEvent ) wxString fullFilename = dlg.GetPath(); if( wxFileExists( fullFilename ) ) - image = new PCB_BITMAP( m_frame->GetModel(), cursorPos ); + image = new PCB_REFERENCE_IMAGE( m_frame->GetModel(), cursorPos ); if( !image || !image->ReadImageFile( fullFilename ) ) { @@ -2871,8 +2871,8 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent ) for( PCB_LAYER_ID layer : aOther->GetLayerSet().Seq() ) { - // Bitmaps are "on" a copper layer but are not actually part of it - if( !IsCopperLayer( layer ) || aOther->Type() == PCB_BITMAP_T ) + // Reference images are "on" a copper layer but are not actually part of it + if( !IsCopperLayer( layer ) || aOther->Type() == PCB_REFERENCE_IMAGE_T ) continue; constraint = m_drcEngine->EvalRules( CLEARANCE_CONSTRAINT, aVia, aOther, layer ); @@ -3419,7 +3419,7 @@ void DRAWING_TOOL::setTransitions() Go( &DRAWING_TOOL::DrawZone, PCB_ACTIONS::drawZoneCutout.MakeEvent() ); Go( &DRAWING_TOOL::DrawZone, PCB_ACTIONS::drawSimilarZone.MakeEvent() ); Go( &DRAWING_TOOL::DrawVia, PCB_ACTIONS::drawVia.MakeEvent() ); - Go( &DRAWING_TOOL::PlaceImage, PCB_ACTIONS::placeImage.MakeEvent() ); + Go( &DRAWING_TOOL::PlaceReferenceImage, PCB_ACTIONS::placeReferenceImage.MakeEvent() ); Go( &DRAWING_TOOL::PlaceText, PCB_ACTIONS::placeText.MakeEvent() ); Go( &DRAWING_TOOL::DrawRectangle, PCB_ACTIONS::drawTextBox.MakeEvent() ); Go( &DRAWING_TOOL::PlaceImportedGraphics, PCB_ACTIONS::placeImportedGraphics.MakeEvent() ); diff --git a/pcbnew/tools/drawing_tool.h b/pcbnew/tools/drawing_tool.h index 2629375bdf..01af35820c 100644 --- a/pcbnew/tools/drawing_tool.h +++ b/pcbnew/tools/drawing_tool.h @@ -146,10 +146,10 @@ public: int DrawArc( const TOOL_EVENT& aEvent ); /** - * Display a dialog that allows one to select and image then decide where to place the - * image in the editor. + * Display a dialog that allows one to select a reference image and then decide where to + * place the image in the editor. */ - int PlaceImage( const TOOL_EVENT& aEvent ); + int PlaceReferenceImage( const TOOL_EVENT& aEvent ); /** * Display a dialog that allows one to input text and its settings and then lets the user diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 7bb3e83bcf..191bb76a54 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -70,7 +70,7 @@ using namespace std::placeholders; #include #include #include -#include +#include const unsigned int EDIT_TOOL::COORDS_PADDING = pcbIUScale.mmToIU( 20 ); @@ -2111,7 +2111,7 @@ void EDIT_TOOL::DeleteItems( const PCB_SELECTION& aItems, bool aIsCut ) case PCB_TEXT_T: case PCB_SHAPE_T: case PCB_TEXTBOX_T: - case PCB_BITMAP_T: + case PCB_REFERENCE_IMAGE_T: case PCB_DIMENSION_T: case PCB_DIM_ALIGNED_T: case PCB_DIM_LEADER_T: @@ -2518,7 +2518,7 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent ) case PCB_FOOTPRINT_T: case PCB_TEXT_T: case PCB_TEXTBOX_T: - case PCB_BITMAP_T: + case PCB_REFERENCE_IMAGE_T: case PCB_GENERATOR_T: case PCB_SHAPE_T: case PCB_TRACE_T: diff --git a/pcbnew/tools/pcb_actions.cpp b/pcbnew/tools/pcb_actions.cpp index edbe605d26..76af26318e 100644 --- a/pcbnew/tools/pcb_actions.cpp +++ b/pcbnew/tools/pcb_actions.cpp @@ -36,7 +36,7 @@ #include // Forward declarations for types needed in the parameters -class PCB_BITMAP; +class PCB_REFERENCE_IMAGE; // Actions, being statically-defined, require specialized I18N handling. We continue to // use the _() macro so that string harvesting by the I18N framework doesn't have to be @@ -159,14 +159,14 @@ TOOL_ACTION PCB_ACTIONS::placeStackup( TOOL_ACTION_ARGS() .Tooltip( _( "Add a board stackup table on a graphic layer" ) ) .Flags( AF_ACTIVATE ) ); -TOOL_ACTION PCB_ACTIONS::placeImage( TOOL_ACTION_ARGS() - .Name( "pcbnew.InteractiveDrawing.placeImage" ) +TOOL_ACTION PCB_ACTIONS::placeReferenceImage( TOOL_ACTION_ARGS() + .Name( "pcbnew.InteractiveDrawing.placeReferenceImage" ) .Scope( AS_GLOBAL ) - .MenuText( _( "Add Image" ) ) - .Tooltip( _( "Add bitmap image" ) ) + .MenuText( _( "Add Reference Image" ) ) + .Tooltip( _( "Add a bitmap image to be used as a reference (image will not be included in any output)" ) ) .Icon( BITMAPS::image ) .Flags( AF_ACTIVATE ) - .Parameter( nullptr ) ); + .Parameter( nullptr ) ); TOOL_ACTION PCB_ACTIONS::placeText( TOOL_ACTION_ARGS() .Name( "pcbnew.InteractiveDrawing.text" ) @@ -437,7 +437,7 @@ TOOL_ACTION PCB_ACTIONS::getAndPlace( TOOL_ACTION_ARGS() .DefaultHotkey( 'T' ) .LegacyHotkeyName( "Get and Move Footprint" ) .MenuText( _( "Get and Move Footprint" ) ) - .Tooltip( _( "Selects a footprint by reference designator and places it under the cursor for moving") ) + .Tooltip( _( "Selects a footprint by reference designator and places it under the cursor for moving" ) ) .Icon( BITMAPS::move ) .Flags( AF_ACTIVATE ) ); diff --git a/pcbnew/tools/pcb_actions.h b/pcbnew/tools/pcb_actions.h index 08de720025..df30b31aa5 100644 --- a/pcbnew/tools/pcb_actions.h +++ b/pcbnew/tools/pcb_actions.h @@ -197,7 +197,7 @@ public: static TOOL_ACTION drawRectangle; static TOOL_ACTION drawCircle; static TOOL_ACTION drawArc; - static TOOL_ACTION placeImage; + static TOOL_ACTION placeReferenceImage; static TOOL_ACTION placeText; static TOOL_ACTION drawTextBox; static TOOL_ACTION spacingIncrease; diff --git a/pcbnew/tools/pcb_grid_helper.cpp b/pcbnew/tools/pcb_grid_helper.cpp index 0c1d4404d5..9d4dfcbcba 100644 --- a/pcbnew/tools/pcb_grid_helper.cpp +++ b/pcbnew/tools/pcb_grid_helper.cpp @@ -408,7 +408,7 @@ GRID_HELPER_GRIDS PCB_GRID_HELPER::GetItemGrid( const EDA_ITEM* aItem ) const case PCB_SHAPE_T: case PCB_DIMENSION_T: - case PCB_BITMAP_T: + case PCB_REFERENCE_IMAGE_T: case PCB_TEXTBOX_T: return GRID_GRAPHICS; diff --git a/pcbnew/tools/pcb_point_editor.cpp b/pcbnew/tools/pcb_point_editor.cpp index cac72f1840..3e1e25c774 100644 --- a/pcbnew/tools/pcb_point_editor.cpp +++ b/pcbnew/tools/pcb_point_editor.cpp @@ -42,7 +42,7 @@ using namespace std::placeholders; #include #include #include -#include +#include #include #include #include @@ -198,11 +198,11 @@ std::shared_ptr PCB_POINT_EDITOR::makePoints( EDA_ITEM* aItem ) // Generate list of edit points basing on the item type switch( aItem->Type() ) { - case PCB_BITMAP_T: + case PCB_REFERENCE_IMAGE_T: { - PCB_BITMAP* bitmap = (PCB_BITMAP*) aItem; - VECTOR2I topLeft = bitmap->GetPosition() - bitmap->GetSize() / 2; - VECTOR2I botRight = bitmap->GetPosition() + bitmap->GetSize() / 2; + PCB_REFERENCE_IMAGE* bitmap = (PCB_REFERENCE_IMAGE*) aItem; + VECTOR2I topLeft = bitmap->GetPosition() - bitmap->GetSize() / 2; + VECTOR2I botRight = bitmap->GetPosition() + bitmap->GetSize() / 2; points->AddPoint( topLeft ); points->AddPoint( VECTOR2I( botRight.x, topLeft.y ) ); @@ -1163,13 +1163,13 @@ void PCB_POINT_EDITOR::updateItem( BOARD_COMMIT* aCommit ) switch( item->Type() ) { - case PCB_BITMAP_T: + case PCB_REFERENCE_IMAGE_T: { - PCB_BITMAP* bitmap = (PCB_BITMAP*) item; - VECTOR2I topLeft = m_editPoints->Point( RECT_TOP_LEFT ).GetPosition(); - VECTOR2I topRight = m_editPoints->Point( RECT_TOP_RIGHT ).GetPosition(); - VECTOR2I botLeft = m_editPoints->Point( RECT_BOT_LEFT ).GetPosition(); - VECTOR2I botRight = m_editPoints->Point( RECT_BOT_RIGHT ).GetPosition(); + PCB_REFERENCE_IMAGE* bitmap = (PCB_REFERENCE_IMAGE*) item; + VECTOR2I topLeft = m_editPoints->Point( RECT_TOP_LEFT ).GetPosition(); + VECTOR2I topRight = m_editPoints->Point( RECT_TOP_RIGHT ).GetPosition(); + VECTOR2I botLeft = m_editPoints->Point( RECT_BOT_LEFT ).GetPosition(); + VECTOR2I botRight = m_editPoints->Point( RECT_BOT_RIGHT ).GetPosition(); pinEditedCorner( topLeft, topRight, botLeft, botRight ); @@ -1750,11 +1750,11 @@ void PCB_POINT_EDITOR::updatePoints() switch( item->Type() ) { - case PCB_BITMAP_T: + case PCB_REFERENCE_IMAGE_T: { - PCB_BITMAP* bitmap = (PCB_BITMAP*) item; - VECTOR2I topLeft = bitmap->GetPosition() - bitmap->GetSize() / 2; - VECTOR2I botRight = bitmap->GetPosition() + bitmap->GetSize() / 2; + PCB_REFERENCE_IMAGE* bitmap = (PCB_REFERENCE_IMAGE*) item; + VECTOR2I topLeft = bitmap->GetPosition() - bitmap->GetSize() / 2; + VECTOR2I botRight = bitmap->GetPosition() + bitmap->GetSize() / 2; m_editPoints->Point( RECT_TOP_LEFT ).SetPosition( topLeft ); m_editPoints->Point( RECT_TOP_RIGHT ).SetPosition( botRight.x, topLeft.y ); diff --git a/pcbnew/tools/pcb_selection_tool.cpp b/pcbnew/tools/pcb_selection_tool.cpp index bdb6ddeac4..d0ae01545a 100644 --- a/pcbnew/tools/pcb_selection_tool.cpp +++ b/pcbnew/tools/pcb_selection_tool.cpp @@ -37,7 +37,7 @@ using namespace std::placeholders; #include #include #include -#include +#include #include #include #include @@ -2416,11 +2416,11 @@ bool PCB_SELECTION_TOOL::itemPassesFilter( BOARD_ITEM* aItem, bool aMultiSelect break; - case PCB_BITMAP_T: + case PCB_REFERENCE_IMAGE_T: if( !m_filter.graphics ) return false; - // a bitmap living in a footprint must not be selected inside the board editor + // a reference image living in a footprint must not be selected inside the board editor if( !m_isFootprintEditor && aItem->GetParentFootprint() ) return false; @@ -3157,9 +3157,9 @@ void PCB_SELECTION_TOOL::GuessSelectionCandidates( GENERAL_COLLECTOR& aCollector // segments underneath them -- so artificially reduce their size from πr² to 1.5r². area = (double) SEG::Square( static_cast( item )->GetDrill() / 2 ) * 1.5; } - else if( item->Type() == PCB_BITMAP_T ) + else if( item->Type() == PCB_REFERENCE_IMAGE_T ) { - VECTOR2D size = static_cast( item )->GetSize(); + VECTOR2D size = static_cast( item )->GetSize(); area = size.x * size.y; } else diff --git a/qa/tests/pcbnew/test_board_item.cpp b/qa/tests/pcbnew/test_board_item.cpp index cf9084ba08..a02157b07c 100644 --- a/qa/tests/pcbnew/test_board_item.cpp +++ b/qa/tests/pcbnew/test_board_item.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include @@ -79,7 +79,7 @@ public: case PCB_SHAPE_T: return new PCB_SHAPE( &m_board ); case PCB_TEXT_T: return new PCB_TEXT( &m_board ); case PCB_TEXTBOX_T: return new PCB_TEXTBOX( &m_board ); - case PCB_BITMAP_T: return new PCB_BITMAP( &m_board ); + case PCB_REFERENCE_IMAGE_T: return new PCB_REFERENCE_IMAGE( &m_board ); case PCB_TRACE_T: return new PCB_TRACK( &m_board ); case PCB_VIA_T: return new PCB_VIA( &m_board ); case PCB_ARC_T: return new PCB_ARC( &m_board );