diff --git a/gerbview/dialogs/dialog_draw_layers_settings.cpp b/gerbview/dialogs/dialog_draw_layers_settings.cpp index cbba1faf5f..0868d5e9f8 100644 --- a/gerbview/dialogs/dialog_draw_layers_settings.cpp +++ b/gerbview/dialogs/dialog_draw_layers_settings.cpp @@ -63,17 +63,52 @@ bool DIALOG_DRAW_LAYERS_SETTINGS::TransferDataToWindow() bool DIALOG_DRAW_LAYERS_SETTINGS::TransferDataFromWindow() { - GERBER_FILE_IMAGE* gbrImage = m_parent->GetGbrImage( m_parent->GetActiveLayer() ); + std::vector <GERBER_FILE_IMAGE*> gbrCandidates; + GERBER_FILE_IMAGE* gbrImage; + GERBER_FILE_IMAGE_LIST* images = m_parent->GetGerberLayout()->GetImagesList(); - if( !gbrImage ) - return true; + switch( m_rbScope->GetSelection() ) + { + case 0: // candidate = active layer + gbrImage = m_parent->GetGbrImage( m_parent->GetActiveLayer() ); - double offsetX = m_offsetX.GetValue(); - double offsetY = m_offsetY.GetValue(); - EDA_ANGLE rot = m_rotation.GetAngleValue(); + if( gbrImage ) + gbrCandidates.push_back( gbrImage ); - gbrImage->SetDrawOffetAndRotation( VECTOR2D( offsetX/gerbIUScale.IU_PER_MM, - offsetY/gerbIUScale.IU_PER_MM ), rot ); + break; + + case 1: // All layers + for( unsigned layer = 0; layer < images->ImagesMaxCount(); ++layer ) + { + gbrImage = images->GetGbrImage( layer ); + + if( gbrImage ) + gbrCandidates.push_back( gbrImage ); + } + break; + + case 2: // All active layers + for( unsigned layer = 0; layer < images->ImagesMaxCount(); ++layer ) + { + gbrImage = images->GetGbrImage( layer ); + + if( gbrImage && m_parent->IsLayerVisible( layer ) ) + gbrCandidates.push_back( gbrImage ); + } + break; + } + + // Now update all candidates + for( unsigned ii = 0; ii < gbrCandidates.size(); ++ii ) + { + gbrImage = gbrCandidates[ii]; + double offsetX = m_offsetX.GetValue(); + double offsetY = m_offsetY.GetValue(); + EDA_ANGLE rot = m_rotation.GetAngleValue(); + + gbrImage->SetDrawOffetAndRotation( VECTOR2D( offsetX/gerbIUScale.IU_PER_MM, + offsetY/gerbIUScale.IU_PER_MM ), rot ); + } return true; } \ No newline at end of file diff --git a/gerbview/dialogs/dialog_draw_layers_settings_base.cpp b/gerbview/dialogs/dialog_draw_layers_settings_base.cpp index 7a32858c33..32737b7782 100644 --- a/gerbview/dialogs/dialog_draw_layers_settings_base.cpp +++ b/gerbview/dialogs/dialog_draw_layers_settings_base.cpp @@ -18,7 +18,7 @@ DIALOG_DRAW_LAYERS_SETTINGS_BASE::DIALOG_DRAW_LAYERS_SETTINGS_BASE( wxWindow* pa wxBoxSizer* bSizer3; bSizer3 = new wxBoxSizer( wxHORIZONTAL ); - m_stLayerNameTitle = new wxStaticText( this, wxID_ANY, _("Layer name:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_stLayerNameTitle = new wxStaticText( this, wxID_ANY, _("Active layer name:"), wxDefaultPosition, wxDefaultSize, 0 ); m_stLayerNameTitle->Wrap( -1 ); bSizer3->Add( m_stLayerNameTitle, 0, wxALL, 5 ); @@ -37,7 +37,7 @@ DIALOG_DRAW_LAYERS_SETTINGS_BASE::DIALOG_DRAW_LAYERS_SETTINGS_BASE( wxWindow* pa m_stOffsetX = new wxStaticText( this, wxID_ANY, _("Offset X"), wxDefaultPosition, wxDefaultSize, 0 ); m_stOffsetX->Wrap( -1 ); - fgSizer->Add( m_stOffsetX, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizer->Add( m_stOffsetX, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); m_tcOffsetX = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); fgSizer->Add( m_tcOffsetX, 0, wxALL|wxEXPAND, 5 ); @@ -48,7 +48,7 @@ DIALOG_DRAW_LAYERS_SETTINGS_BASE::DIALOG_DRAW_LAYERS_SETTINGS_BASE( wxWindow* pa m_stOffsetY = new wxStaticText( this, wxID_ANY, _("Offset Y"), wxDefaultPosition, wxDefaultSize, 0 ); m_stOffsetY->Wrap( -1 ); - fgSizer->Add( m_stOffsetY, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizer->Add( m_stOffsetY, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); m_tcOffsetY = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); fgSizer->Add( m_tcOffsetY, 0, wxALL|wxEXPAND, 5 ); @@ -57,9 +57,9 @@ DIALOG_DRAW_LAYERS_SETTINGS_BASE::DIALOG_DRAW_LAYERS_SETTINGS_BASE( wxWindow* pa m_stUnitY->Wrap( -1 ); fgSizer->Add( m_stUnitY, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - m_stLayerRot = new wxStaticText( this, wxID_ANY, _("Rotation"), wxDefaultPosition, wxDefaultSize, 0 ); + m_stLayerRot = new wxStaticText( this, wxID_ANY, _("Rotation CCW"), wxDefaultPosition, wxDefaultSize, 0 ); m_stLayerRot->Wrap( -1 ); - fgSizer->Add( m_stLayerRot, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizer->Add( m_stLayerRot, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); m_tcRotation = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); fgSizer->Add( m_tcRotation, 0, wxALL|wxEXPAND, 5 ); @@ -69,7 +69,19 @@ DIALOG_DRAW_LAYERS_SETTINGS_BASE::DIALOG_DRAW_LAYERS_SETTINGS_BASE( wxWindow* pa fgSizer->Add( m_stUnitRot, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); - m_namiSizer->Add( fgSizer, 1, wxEXPAND, 5 ); + m_namiSizer->Add( fgSizer, 0, wxEXPAND, 5 ); + + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + m_namiSizer->Add( m_staticline1, 0, wxALL|wxEXPAND, 5 ); + + wxString m_rbScopeChoices[] = { _("Active layer"), _("All layers"), _("All visible layers") }; + int m_rbScopeNChoices = sizeof( m_rbScopeChoices ) / sizeof( wxString ); + m_rbScope = new wxRadioBox( this, wxID_ANY, _("Scope"), wxDefaultPosition, wxDefaultSize, m_rbScopeNChoices, m_rbScopeChoices, 1, wxRA_SPECIFY_COLS ); + m_rbScope->SetSelection( 0 ); + m_namiSizer->Add( m_rbScope, 0, wxALL, 5 ); + + m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + m_namiSizer->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 ); wxBoxSizer* bottomButtonsSizer; bottomButtonsSizer = new wxBoxSizer( wxHORIZONTAL ); @@ -81,10 +93,10 @@ DIALOG_DRAW_LAYERS_SETTINGS_BASE::DIALOG_DRAW_LAYERS_SETTINGS_BASE( wxWindow* pa m_sdbSizerStdButtons->AddButton( m_sdbSizerStdButtonsCancel ); m_sdbSizerStdButtons->Realize(); - bottomButtonsSizer->Add( m_sdbSizerStdButtons, 1, wxEXPAND|wxALL, 5 ); + bottomButtonsSizer->Add( m_sdbSizerStdButtons, 1, wxALL|wxEXPAND, 5 ); - m_namiSizer->Add( bottomButtonsSizer, 0, wxEXPAND|wxLEFT, 5 ); + m_namiSizer->Add( bottomButtonsSizer, 0, wxLEFT|wxEXPAND, 5 ); this->SetSizer( m_namiSizer ); diff --git a/gerbview/dialogs/dialog_draw_layers_settings_base.fbp b/gerbview/dialogs/dialog_draw_layers_settings_base.fbp index 03cce550a6..537889efcf 100644 --- a/gerbview/dialogs/dialog_draw_layers_settings_base.fbp +++ b/gerbview/dialogs/dialog_draw_layers_settings_base.fbp @@ -47,10 +47,10 @@ <property name="minimum_size"></property> <property name="name">DIALOG_DRAW_LAYERS_SETTINGS_BASE</property> <property name="pos"></property> - <property name="size">311,203</property> + <property name="size">317,332</property> <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property> <property name="subclass">DIALOG_SHIM; dialog_shim.h</property> - <property name="title">Footprint Properties</property> + <property name="title">Layers Settings</property> <property name="tooltip"></property> <property name="two_step_creation">0</property> <property name="window_extra_style"></property> @@ -104,7 +104,7 @@ <property name="gripper">0</property> <property name="hidden">0</property> <property name="id">wxID_ANY</property> - <property name="label">Layer name:</property> + <property name="label">Active layer name:</property> <property name="markup">0</property> <property name="max_size"></property> <property name="maximize_button">0</property> @@ -199,7 +199,7 @@ <object class="sizeritem" expanded="1"> <property name="border">5</property> <property name="flag">wxEXPAND</property> - <property name="proportion">1</property> + <property name="proportion">0</property> <object class="wxFlexGridSizer" expanded="1"> <property name="cols">3</property> <property name="flexible_direction">wxBOTH</property> @@ -214,7 +214,7 @@ <property name="vgap">0</property> <object class="sizeritem" expanded="1"> <property name="border">5</property> - <property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL</property> + <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property> <property name="proportion">0</property> <object class="wxStaticText" expanded="1"> <property name="BottomDockable">1</property> @@ -400,7 +400,7 @@ </object> <object class="sizeritem" expanded="1"> <property name="border">5</property> - <property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL</property> + <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property> <property name="proportion">0</property> <object class="wxStaticText" expanded="1"> <property name="BottomDockable">1</property> @@ -586,7 +586,7 @@ </object> <object class="sizeritem" expanded="1"> <property name="border">5</property> - <property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL</property> + <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property> <property name="proportion">0</property> <object class="wxStaticText" expanded="1"> <property name="BottomDockable">1</property> @@ -616,7 +616,7 @@ <property name="gripper">0</property> <property name="hidden">0</property> <property name="id">wxID_ANY</property> - <property name="label">Rotation</property> + <property name="label">Rotation CCW</property> <property name="markup">0</property> <property name="max_size"></property> <property name="maximize_button">0</property> @@ -774,7 +774,189 @@ </object> <object class="sizeritem" expanded="1"> <property name="border">5</property> - <property name="flag">wxEXPAND|wxLEFT</property> + <property name="flag">wxALL|wxEXPAND</property> + <property name="proportion">0</property> + <object class="wxStaticLine" expanded="1"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer"></property> + <property name="aui_name"></property> + <property name="aui_position"></property> + <property name="aui_row"></property> + <property name="best_size"></property> + <property name="bg"></property> + <property name="caption"></property> + <property name="caption_visible">1</property> + <property name="center_pane">0</property> + <property name="close_button">1</property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="default_pane">0</property> + <property name="dock">Dock</property> + <property name="dock_fixed">0</property> + <property name="docking">Left</property> + <property name="enabled">1</property> + <property name="fg"></property> + <property name="floatable">1</property> + <property name="font"></property> + <property name="gripper">0</property> + <property name="hidden">0</property> + <property name="id">wxID_ANY</property> + <property name="max_size"></property> + <property name="maximize_button">0</property> + <property name="maximum_size"></property> + <property name="min_size"></property> + <property name="minimize_button">0</property> + <property name="minimum_size"></property> + <property name="moveable">1</property> + <property name="name">m_staticline1</property> + <property name="pane_border">1</property> + <property name="pane_position"></property> + <property name="pane_size"></property> + <property name="permission">protected</property> + <property name="pin_button">1</property> + <property name="pos"></property> + <property name="resize">Resizable</property> + <property name="show">1</property> + <property name="size"></property> + <property name="style">wxLI_HORIZONTAL</property> + <property name="subclass">; ; 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> + </object> + </object> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxALL</property> + <property name="proportion">0</property> + <object class="wxRadioBox" 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="choices">"Active layer" "All layers" "All visible layers"</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">Scope</property> + <property name="majorDimension">1</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_rbScope</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="selection">0</property> + <property name="show">1</property> + <property name="size"></property> + <property name="style">wxRA_SPECIFY_COLS</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> + </object> + </object> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxEXPAND | wxALL</property> + <property name="proportion">0</property> + <object class="wxStaticLine" expanded="1"> + <property name="BottomDockable">1</property> + <property name="LeftDockable">1</property> + <property name="RightDockable">1</property> + <property name="TopDockable">1</property> + <property name="aui_layer"></property> + <property name="aui_name"></property> + <property name="aui_position"></property> + <property name="aui_row"></property> + <property name="best_size"></property> + <property name="bg"></property> + <property name="caption"></property> + <property name="caption_visible">1</property> + <property name="center_pane">0</property> + <property name="close_button">1</property> + <property name="context_help"></property> + <property name="context_menu">1</property> + <property name="default_pane">0</property> + <property name="dock">Dock</property> + <property name="dock_fixed">0</property> + <property name="docking">Left</property> + <property name="enabled">1</property> + <property name="fg"></property> + <property name="floatable">1</property> + <property name="font"></property> + <property name="gripper">0</property> + <property name="hidden">0</property> + <property name="id">wxID_ANY</property> + <property name="max_size"></property> + <property name="maximize_button">0</property> + <property name="maximum_size"></property> + <property name="min_size"></property> + <property name="minimize_button">0</property> + <property name="minimum_size"></property> + <property name="moveable">1</property> + <property name="name">m_staticline2</property> + <property name="pane_border">1</property> + <property name="pane_position"></property> + <property name="pane_size"></property> + <property name="permission">protected</property> + <property name="pin_button">1</property> + <property name="pos"></property> + <property name="resize">Resizable</property> + <property name="show">1</property> + <property name="size"></property> + <property name="style">wxLI_HORIZONTAL</property> + <property name="subclass">; ; 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> + </object> + </object> + <object class="sizeritem" expanded="1"> + <property name="border">5</property> + <property name="flag">wxLEFT|wxEXPAND</property> <property name="proportion">0</property> <object class="wxBoxSizer" expanded="1"> <property name="minimum_size"></property> @@ -783,7 +965,7 @@ <property name="permission">none</property> <object class="sizeritem" expanded="0"> <property name="border">5</property> - <property name="flag">wxEXPAND|wxALL</property> + <property name="flag">wxALL|wxEXPAND</property> <property name="proportion">1</property> <object class="wxStdDialogButtonSizer" expanded="0"> <property name="Apply">0</property> diff --git a/gerbview/dialogs/dialog_draw_layers_settings_base.h b/gerbview/dialogs/dialog_draw_layers_settings_base.h index 3c6135ae5b..234f2effff 100644 --- a/gerbview/dialogs/dialog_draw_layers_settings_base.h +++ b/gerbview/dialogs/dialog_draw_layers_settings_base.h @@ -19,6 +19,8 @@ #include <wx/settings.h> #include <wx/sizer.h> #include <wx/textctrl.h> +#include <wx/statline.h> +#include <wx/radiobox.h> #include <wx/button.h> #include <wx/dialog.h> @@ -45,6 +47,9 @@ class DIALOG_DRAW_LAYERS_SETTINGS_BASE : public DIALOG_SHIM wxStaticText* m_stLayerRot; wxTextCtrl* m_tcRotation; wxStaticText* m_stUnitRot; + wxStaticLine* m_staticline1; + wxRadioBox* m_rbScope; + wxStaticLine* m_staticline2; wxStdDialogButtonSizer* m_sdbSizerStdButtons; wxButton* m_sdbSizerStdButtonsOK; wxButton* m_sdbSizerStdButtonsCancel; @@ -56,7 +61,7 @@ class DIALOG_DRAW_LAYERS_SETTINGS_BASE : public DIALOG_SHIM public: - DIALOG_DRAW_LAYERS_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Footprint Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 311,203 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_DRAW_LAYERS_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Layers Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 317,332 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_DRAW_LAYERS_SETTINGS_BASE(); diff --git a/gerbview/widgets/gerbview_layer_widget.cpp b/gerbview/widgets/gerbview_layer_widget.cpp index 0bd04d0939..380ca954dd 100644 --- a/gerbview/widgets/gerbview_layer_widget.cpp +++ b/gerbview/widgets/gerbview_layer_widget.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2004-2010 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> - * 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 @@ -182,7 +182,7 @@ void GERBER_LAYER_WIDGET::AddRightClickMenuItems( wxMenu* aMenu ) aMenu->AppendSeparator(); - AddMenuItem( aMenu, ID_SET_GBR_LAYERS_DRAW_PRMS, _( "Active Layer Draw Params: Set Offset and Rotation" ), + AddMenuItem( aMenu, ID_SET_GBR_LAYERS_DRAW_PRMS, _( "Layers Display Parameters: Offset and Rotation" ), KiBitmap( BITMAPS::tools ) ); aMenu->AppendSeparator();