Bring pcbnew print dialog in line with plot.
Fixes https://gitlab.com/kicad/code/kicad/issues/2171
This commit is contained in:
parent
54c9e36556
commit
dc39703d0e
|
@ -90,8 +90,20 @@ DIALOG_PRINT_GENERIC_BASE::DIALOG_PRINT_GENERIC_BASE( wxWindow* parent, wxWindow
|
||||||
|
|
||||||
bMainSizer->Add( m_bUpperSizer, 1, wxEXPAND|wxALL, 5 );
|
bMainSizer->Add( m_bUpperSizer, 1, wxEXPAND|wxALL, 5 );
|
||||||
|
|
||||||
|
wxBoxSizer* bSizer6;
|
||||||
|
bSizer6 = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
|
m_infoText = new wxStaticText( this, wxID_ANY, _("Info text"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_infoText->Wrap( -1 );
|
||||||
|
m_infoText->Hide();
|
||||||
|
|
||||||
|
bSizer6->Add( m_infoText, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
bMainSizer->Add( bSizer6, 0, wxEXPAND|wxLEFT, 10 );
|
||||||
|
|
||||||
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||||
bMainSizer->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
|
bMainSizer->Add( m_staticline1, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 );
|
||||||
|
|
||||||
wxBoxSizer* bButtonsSizer;
|
wxBoxSizer* bButtonsSizer;
|
||||||
bButtonsSizer = new wxBoxSizer( wxHORIZONTAL );
|
bButtonsSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
|
@ -614,7 +614,79 @@
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="1">
|
||||||
<property name="border">10</property>
|
<property name="border">10</property>
|
||||||
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
|
<property name="flag">wxEXPAND|wxLEFT</property>
|
||||||
|
<property name="proportion">0</property>
|
||||||
|
<object class="wxBoxSizer" expanded="1">
|
||||||
|
<property name="minimum_size"></property>
|
||||||
|
<property name="name">bSizer6</property>
|
||||||
|
<property name="orient">wxVERTICAL</property>
|
||||||
|
<property name="permission">none</property>
|
||||||
|
<object class="sizeritem" expanded="1">
|
||||||
|
<property name="border">5</property>
|
||||||
|
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
|
||||||
|
<property name="proportion">0</property>
|
||||||
|
<object class="wxStaticText" expanded="1">
|
||||||
|
<property name="BottomDockable">1</property>
|
||||||
|
<property name="LeftDockable">1</property>
|
||||||
|
<property name="RightDockable">1</property>
|
||||||
|
<property name="TopDockable">1</property>
|
||||||
|
<property name="aui_layer"></property>
|
||||||
|
<property name="aui_name"></property>
|
||||||
|
<property name="aui_position"></property>
|
||||||
|
<property name="aui_row"></property>
|
||||||
|
<property name="best_size"></property>
|
||||||
|
<property name="bg"></property>
|
||||||
|
<property name="caption"></property>
|
||||||
|
<property name="caption_visible">1</property>
|
||||||
|
<property name="center_pane">0</property>
|
||||||
|
<property name="close_button">1</property>
|
||||||
|
<property name="context_help"></property>
|
||||||
|
<property name="context_menu">1</property>
|
||||||
|
<property name="default_pane">0</property>
|
||||||
|
<property name="dock">Dock</property>
|
||||||
|
<property name="dock_fixed">0</property>
|
||||||
|
<property name="docking">Left</property>
|
||||||
|
<property name="enabled">1</property>
|
||||||
|
<property name="fg"></property>
|
||||||
|
<property name="floatable">1</property>
|
||||||
|
<property name="font"></property>
|
||||||
|
<property name="gripper">0</property>
|
||||||
|
<property name="hidden">1</property>
|
||||||
|
<property name="id">wxID_ANY</property>
|
||||||
|
<property name="label">Info text</property>
|
||||||
|
<property name="markup">0</property>
|
||||||
|
<property name="max_size"></property>
|
||||||
|
<property name="maximize_button">0</property>
|
||||||
|
<property name="maximum_size"></property>
|
||||||
|
<property name="min_size"></property>
|
||||||
|
<property name="minimize_button">0</property>
|
||||||
|
<property name="minimum_size"></property>
|
||||||
|
<property name="moveable">1</property>
|
||||||
|
<property name="name">m_infoText</property>
|
||||||
|
<property name="pane_border">1</property>
|
||||||
|
<property name="pane_position"></property>
|
||||||
|
<property name="pane_size"></property>
|
||||||
|
<property name="permission">protected</property>
|
||||||
|
<property name="pin_button">1</property>
|
||||||
|
<property name="pos"></property>
|
||||||
|
<property name="resize">Resizable</property>
|
||||||
|
<property name="show">1</property>
|
||||||
|
<property name="size"></property>
|
||||||
|
<property name="style"></property>
|
||||||
|
<property name="subclass">; ; forward_declare</property>
|
||||||
|
<property name="toolbar_pane">0</property>
|
||||||
|
<property name="tooltip"></property>
|
||||||
|
<property name="window_extra_style"></property>
|
||||||
|
<property name="window_name"></property>
|
||||||
|
<property name="window_style"></property>
|
||||||
|
<property name="wrap">-1</property>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="sizeritem" expanded="1">
|
||||||
|
<property name="border">10</property>
|
||||||
|
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxStaticLine" expanded="1">
|
<object class="wxStaticLine" expanded="1">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
|
|
|
@ -57,6 +57,7 @@ class DIALOG_PRINT_GENERIC_BASE : public DIALOG_SHIM
|
||||||
wxRadioButton* m_scaleFit;
|
wxRadioButton* m_scaleFit;
|
||||||
wxRadioButton* m_scaleCustom;
|
wxRadioButton* m_scaleCustom;
|
||||||
wxTextCtrl* m_scaleCustomText;
|
wxTextCtrl* m_scaleCustomText;
|
||||||
|
wxStaticText* m_infoText;
|
||||||
wxStaticLine* m_staticline1;
|
wxStaticLine* m_staticline1;
|
||||||
wxButton* m_buttonOption;
|
wxButton* m_buttonOption;
|
||||||
wxStdDialogButtonSizer* m_sdbSizer1;
|
wxStdDialogButtonSizer* m_sdbSizer1;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb)
|
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||||
|
@ -57,7 +57,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
|
||||||
m_layerCheckListBox = new wxCheckListBox( m_LayersSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_layerCheckListBoxChoices, 0 );
|
m_layerCheckListBox = new wxCheckListBox( m_LayersSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_layerCheckListBoxChoices, 0 );
|
||||||
m_layerCheckListBox->SetMinSize( wxSize( 150,-1 ) );
|
m_layerCheckListBox->SetMinSize( wxSize( 150,-1 ) );
|
||||||
|
|
||||||
m_LayersSizer->Add( m_layerCheckListBox, 1, wxALL|wxEXPAND, 5 );
|
m_LayersSizer->Add( m_layerCheckListBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT, 5 );
|
||||||
|
|
||||||
|
|
||||||
bmiddleSizer->Add( m_LayersSizer, 1, wxALL|wxEXPAND, 3 );
|
bmiddleSizer->Add( m_LayersSizer, 1, wxALL|wxEXPAND, 3 );
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||||
<wxFormBuilder_Project>
|
<wxFormBuilder_Project>
|
||||||
<FileVersion major="1" minor="16" />
|
<FileVersion major="1" minor="15" />
|
||||||
<object class="Project" expanded="1">
|
<object class="Project" expanded="1">
|
||||||
<property name="class_decoration"></property>
|
<property name="class_decoration"></property>
|
||||||
<property name="code_generation">C++</property>
|
<property name="code_generation">C++</property>
|
||||||
|
@ -14,7 +14,6 @@
|
||||||
<property name="file">dialog_plot_base</property>
|
<property name="file">dialog_plot_base</property>
|
||||||
<property name="first_id">1000</property>
|
<property name="first_id">1000</property>
|
||||||
<property name="help_provider">none</property>
|
<property name="help_provider">none</property>
|
||||||
<property name="image_path_wrapper_function_name"></property>
|
|
||||||
<property name="indent_with_spaces"></property>
|
<property name="indent_with_spaces"></property>
|
||||||
<property name="internationalize">1</property>
|
<property name="internationalize">1</property>
|
||||||
<property name="name">Dialog_Plot_base</property>
|
<property name="name">Dialog_Plot_base</property>
|
||||||
|
@ -26,7 +25,6 @@
|
||||||
<property name="skip_php_events">1</property>
|
<property name="skip_php_events">1</property>
|
||||||
<property name="skip_python_events">1</property>
|
<property name="skip_python_events">1</property>
|
||||||
<property name="ui_table">UI</property>
|
<property name="ui_table">UI</property>
|
||||||
<property name="use_array_enum">0</property>
|
|
||||||
<property name="use_enum">1</property>
|
<property name="use_enum">1</property>
|
||||||
<property name="use_microsoft_bom">0</property>
|
<property name="use_microsoft_bom">0</property>
|
||||||
<object class="Dialog" expanded="1">
|
<object class="Dialog" expanded="1">
|
||||||
|
@ -52,7 +50,6 @@
|
||||||
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
|
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
|
||||||
<property name="title">Plot</property>
|
<property name="title">Plot</property>
|
||||||
<property name="tooltip"></property>
|
<property name="tooltip"></property>
|
||||||
<property name="two_step_creation">0</property>
|
|
||||||
<property name="window_extra_style"></property>
|
<property name="window_extra_style"></property>
|
||||||
<property name="window_name"></property>
|
<property name="window_name"></property>
|
||||||
<property name="window_style"></property>
|
<property name="window_style"></property>
|
||||||
|
@ -346,7 +343,6 @@
|
||||||
<property name="aui_name"></property>
|
<property name="aui_name"></property>
|
||||||
<property name="aui_position"></property>
|
<property name="aui_position"></property>
|
||||||
<property name="aui_row"></property>
|
<property name="aui_row"></property>
|
||||||
<property name="auth_needed">0</property>
|
|
||||||
<property name="best_size"></property>
|
<property name="best_size"></property>
|
||||||
<property name="bg"></property>
|
<property name="bg"></property>
|
||||||
<property name="bitmap"></property>
|
<property name="bitmap"></property>
|
||||||
|
@ -432,7 +428,7 @@
|
||||||
<property name="permission">protected</property>
|
<property name="permission">protected</property>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="1">
|
||||||
<property name="border">5</property>
|
<property name="border">5</property>
|
||||||
<property name="flag">wxALL|wxEXPAND</property>
|
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT</property>
|
||||||
<property name="proportion">1</property>
|
<property name="proportion">1</property>
|
||||||
<object class="wxCheckListBox" expanded="1">
|
<object class="wxCheckListBox" expanded="1">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
|
@ -3812,7 +3808,6 @@
|
||||||
<property name="aui_name"></property>
|
<property name="aui_name"></property>
|
||||||
<property name="aui_position"></property>
|
<property name="aui_position"></property>
|
||||||
<property name="aui_row"></property>
|
<property name="aui_row"></property>
|
||||||
<property name="auth_needed">0</property>
|
|
||||||
<property name="best_size"></property>
|
<property name="best_size"></property>
|
||||||
<property name="bg"></property>
|
<property name="bg"></property>
|
||||||
<property name="bitmap"></property>
|
<property name="bitmap"></property>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version 3.10.0-39-g3487c3cb)
|
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||||
|
@ -131,7 +131,7 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM
|
||||||
wxButton* m_sdbSizer1Cancel;
|
wxButton* m_sdbSizer1Cancel;
|
||||||
wxMenu* m_popMenu;
|
wxMenu* m_popMenu;
|
||||||
|
|
||||||
// Virtual event handlers, override them in your derived class
|
// Virtual event handlers, overide them in your derived class
|
||||||
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
|
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
|
||||||
virtual void OnRightClick( wxMouseEvent& event ) { event.Skip(); }
|
virtual void OnRightClick( wxMouseEvent& event ) { event.Skip(); }
|
||||||
virtual void SetPlotFormat( wxCommandEvent& event ) { event.Skip(); }
|
virtual void SetPlotFormat( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
@ -149,7 +149,6 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plot"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plot"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||||
|
|
||||||
~DIALOG_PLOT_BASE();
|
~DIALOG_PLOT_BASE();
|
||||||
|
|
||||||
void DIALOG_PLOT_BASEOnContextMenu( wxMouseEvent &event )
|
void DIALOG_PLOT_BASEOnContextMenu( wxMouseEvent &event )
|
||||||
|
|
|
@ -48,6 +48,17 @@ public:
|
||||||
~DIALOG_PRINT_PCBNEW() {}
|
~DIALOG_PRINT_PCBNEW() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
ID_SELECT_FIRST = 4100,
|
||||||
|
ID_SELECT_FAB_LAYERS = ID_SELECT_FIRST,
|
||||||
|
ID_SELECT_COPPER_LAYERS,
|
||||||
|
ID_DESELECT_COPPER_LAYERS,
|
||||||
|
ID_SELECT_ALL_LAYERS,
|
||||||
|
ID_DESELECT_ALL_LAYERS,
|
||||||
|
ID_SELECT_LAST
|
||||||
|
};
|
||||||
|
|
||||||
PCBNEW_PRINTOUT_SETTINGS* settings() const
|
PCBNEW_PRINTOUT_SETTINGS* settings() const
|
||||||
{
|
{
|
||||||
wxASSERT( dynamic_cast<PCBNEW_PRINTOUT_SETTINGS*>( m_settings ) );
|
wxASSERT( dynamic_cast<PCBNEW_PRINTOUT_SETTINGS*>( m_settings ) );
|
||||||
|
@ -59,21 +70,10 @@ private:
|
||||||
void createExtraOptions();
|
void createExtraOptions();
|
||||||
void createLeftPanel();
|
void createLeftPanel();
|
||||||
|
|
||||||
void onSelectAllClick( wxCommandEvent& event );
|
|
||||||
void onDeselectAllClick( wxCommandEvent& event );
|
|
||||||
|
|
||||||
void onUseThemeClicked( wxCommandEvent& event );
|
void onUseThemeClicked( wxCommandEvent& event );
|
||||||
void onPagePerLayerClicked( wxCommandEvent& event );
|
void onPagePerLayerClicked( wxCommandEvent& event );
|
||||||
void onColorModeClicked( wxCommandEvent& event );
|
void onColorModeClicked( wxCommandEvent& event );
|
||||||
|
void onPopUpLayers( wxCommandEvent& event );
|
||||||
///< (Un)check all items in a checklist box.
|
|
||||||
void setListBoxValue( wxCheckListBox* aList, bool aValue );
|
|
||||||
|
|
||||||
///< Check whether a layer is enabled in a listbox.
|
|
||||||
bool isLayerEnabled( unsigned int aLayer ) const;
|
|
||||||
|
|
||||||
///< Enable/disable layer in a listbox.
|
|
||||||
void enableLayer( unsigned int aLayer, bool aValue );
|
|
||||||
|
|
||||||
///< Update layerset basing on the selected layers.
|
///< Update layerset basing on the selected layers.
|
||||||
int setLayerSetFromList();
|
int setLayerSetFromList();
|
||||||
|
@ -87,23 +87,18 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
PCB_BASE_EDIT_FRAME* m_parent;
|
PCB_BASE_EDIT_FRAME* m_parent;
|
||||||
|
LSEQ m_layerList; // List to hold CheckListBox layer numbers
|
||||||
|
wxMenu* m_popMenu;
|
||||||
|
|
||||||
// List of existing board layers in wxCheckListBox, with the board layers id:
|
wxCheckListBox* m_layerCheckListBox;
|
||||||
std::pair<wxCheckListBox*, int> m_layers[PCB_LAYER_ID_COUNT];
|
wxCheckBox* m_checkboxMirror;
|
||||||
|
wxChoice* m_drillMarksChoice;
|
||||||
// Extra widgets
|
wxCheckBox* m_checkboxPagePerLayer;
|
||||||
wxCheckListBox* m_listTechLayers;
|
wxCheckBox* m_checkboxEdgesOnAllPages;
|
||||||
wxCheckListBox* m_listCopperLayers;
|
wxCheckBox* m_checkAsItems;
|
||||||
wxButton* m_buttonSelectAll;
|
wxCheckBox* m_checkBackground;
|
||||||
wxButton* m_buttonDeselectAll;
|
wxCheckBox* m_checkUseTheme;
|
||||||
wxCheckBox* m_checkboxMirror;
|
wxChoice* m_colorTheme;
|
||||||
wxChoice* m_drillMarksChoice;
|
|
||||||
wxCheckBox* m_checkboxPagePerLayer;
|
|
||||||
wxCheckBox* m_checkboxEdgesOnAllPages;
|
|
||||||
wxCheckBox* m_checkAsItems;
|
|
||||||
wxCheckBox* m_checkBackground;
|
|
||||||
wxCheckBox* m_checkUseTheme;
|
|
||||||
wxChoice* m_colorTheme;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -117,6 +112,14 @@ DIALOG_PRINT_PCBNEW::DIALOG_PRINT_PCBNEW( PCB_BASE_EDIT_FRAME* aParent,
|
||||||
createExtraOptions();
|
createExtraOptions();
|
||||||
createLeftPanel();
|
createLeftPanel();
|
||||||
|
|
||||||
|
m_infoText->SetFont( KIUI::GetInfoFont( this ) );
|
||||||
|
m_infoText->SetLabel( _( "Right-click for layer selection commands." ) );
|
||||||
|
m_infoText->Show( true );
|
||||||
|
|
||||||
|
m_popMenu->Bind( wxEVT_COMMAND_MENU_SELECTED,
|
||||||
|
wxCommandEventHandler( DIALOG_PRINT_PCBNEW::onPopUpLayers ), this,
|
||||||
|
ID_SELECT_FIRST, ID_SELECT_LAST );
|
||||||
|
|
||||||
m_outputMode->Bind( wxEVT_COMMAND_CHOICE_SELECTED, &DIALOG_PRINT_PCBNEW::onColorModeClicked,
|
m_outputMode->Bind( wxEVT_COMMAND_CHOICE_SELECTED, &DIALOG_PRINT_PCBNEW::onColorModeClicked,
|
||||||
this );
|
this );
|
||||||
}
|
}
|
||||||
|
@ -130,23 +133,18 @@ bool DIALOG_PRINT_PCBNEW::TransferDataToWindow()
|
||||||
BOARD* board = m_parent->GetBoard();
|
BOARD* board = m_parent->GetBoard();
|
||||||
|
|
||||||
// Create layer list
|
// Create layer list
|
||||||
for( LSEQ seq = board->GetEnabledLayers().UIOrder(); seq; ++seq )
|
// Could devote a PlotOrder() function in place of UIOrder().
|
||||||
|
m_layerList = board->GetEnabledLayers().UIOrder();
|
||||||
|
|
||||||
|
// Populate the check list box by all enabled layers names
|
||||||
|
for( LSEQ seq = m_layerList; seq; ++seq )
|
||||||
{
|
{
|
||||||
PCB_LAYER_ID layer = *seq;
|
PCB_LAYER_ID layer = *seq;
|
||||||
int checkIndex;
|
|
||||||
|
|
||||||
if( IsCopperLayer( layer ) )
|
int checkIndex = m_layerCheckListBox->Append( board->GetLayerName( layer ) );
|
||||||
{
|
|
||||||
checkIndex = m_listCopperLayers->Append( board->GetLayerName( layer ) );
|
|
||||||
m_layers[layer] = std::make_pair( m_listCopperLayers, checkIndex );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
checkIndex = m_listTechLayers->Append( board->GetLayerName( layer ) );
|
|
||||||
m_layers[layer] = std::make_pair( m_listTechLayers, checkIndex );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_layers[layer].first->Check( checkIndex, settings()->m_LayerSet.test( layer ) );
|
if( settings()->m_LayerSet.test( layer ) )
|
||||||
|
m_layerCheckListBox->Check( checkIndex );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_checkboxMirror->SetValue( settings()->m_Mirror );
|
m_checkboxMirror->SetValue( settings()->m_Mirror );
|
||||||
|
@ -268,67 +266,37 @@ void DIALOG_PRINT_PCBNEW::createExtraOptions()
|
||||||
|
|
||||||
void DIALOG_PRINT_PCBNEW::createLeftPanel()
|
void DIALOG_PRINT_PCBNEW::createLeftPanel()
|
||||||
{
|
{
|
||||||
wxStaticBox* box = new wxStaticBox( this, wxID_ANY, _( "Included Layers" ) );
|
wxStaticBox* box = new wxStaticBox( this, wxID_ANY, _( "Include Layers" ) );
|
||||||
wxStaticBoxSizer* sbLayersSizer = new wxStaticBoxSizer( box, wxVERTICAL );
|
wxStaticBoxSizer* sbLayersSizer = new wxStaticBoxSizer( box, wxVERTICAL );
|
||||||
|
|
||||||
// Copper layer list
|
m_layerCheckListBox = new wxCheckListBox( sbLayersSizer->GetStaticBox(), wxID_ANY );
|
||||||
auto copperLabel = new wxStaticText( sbLayersSizer->GetStaticBox(), wxID_ANY,
|
m_layerCheckListBox->SetMinSize( wxSize( 180, -1 ) );
|
||||||
_( "Copper layers:" ) );
|
|
||||||
m_listCopperLayers = new wxCheckListBox( sbLayersSizer->GetStaticBox(), wxID_ANY );
|
|
||||||
|
|
||||||
wxBoxSizer* sizerLeft = new wxBoxSizer( wxVERTICAL );
|
sbLayersSizer->Add( m_layerCheckListBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT, 5 );
|
||||||
sizerLeft->Add( copperLabel, 0, wxRIGHT, 5 );
|
|
||||||
sizerLeft->Add( m_listCopperLayers, 1, wxEXPAND | wxBOTTOM | wxRIGHT, 5 );
|
|
||||||
|
|
||||||
// Technical layer list
|
|
||||||
auto technicalLabel = new wxStaticText( sbLayersSizer->GetStaticBox(), wxID_ANY,
|
|
||||||
_( "Technical layers:" ) );
|
|
||||||
m_listTechLayers = new wxCheckListBox( sbLayersSizer->GetStaticBox(), wxID_ANY );
|
|
||||||
|
|
||||||
wxBoxSizer* sizerRight = new wxBoxSizer( wxVERTICAL );
|
|
||||||
sizerRight->Add( technicalLabel, 0, wxLEFT, 5 );
|
|
||||||
sizerRight->Add( m_listTechLayers, 1, wxEXPAND | wxBOTTOM | wxLEFT, 5 );
|
|
||||||
|
|
||||||
// Layer list layout
|
|
||||||
wxBoxSizer* bLayerListsSizer = new wxBoxSizer( wxHORIZONTAL );
|
|
||||||
bLayerListsSizer->Add( sizerLeft, 1, wxEXPAND, 5 );
|
|
||||||
bLayerListsSizer->Add( sizerRight, 1, wxEXPAND, 5 );
|
|
||||||
|
|
||||||
// Select/Unselect all buttons
|
|
||||||
m_buttonSelectAll = new wxButton( sbLayersSizer->GetStaticBox(), wxID_ANY, _( "Select all" ) );
|
|
||||||
m_buttonDeselectAll = new wxButton( sbLayersSizer->GetStaticBox(), wxID_ANY,
|
|
||||||
_( "Deselect all" ) );
|
|
||||||
|
|
||||||
m_buttonSelectAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED,
|
|
||||||
wxCommandEventHandler( DIALOG_PRINT_PCBNEW::onSelectAllClick ),
|
|
||||||
nullptr, this );
|
|
||||||
m_buttonDeselectAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED,
|
|
||||||
wxCommandEventHandler( DIALOG_PRINT_PCBNEW::onDeselectAllClick ),
|
|
||||||
nullptr, this );
|
|
||||||
|
|
||||||
wxBoxSizer* buttonSizer = new wxBoxSizer( wxHORIZONTAL );
|
|
||||||
buttonSizer->Add( m_buttonSelectAll, 1, wxRIGHT | wxTOP | wxBOTTOM, 5 );
|
|
||||||
buttonSizer->Add( m_buttonDeselectAll, 1, wxLEFT | wxTOP | wxBOTTOM, 5 );
|
|
||||||
|
|
||||||
// Static box sizer layout
|
|
||||||
sbLayersSizer->Add( bLayerListsSizer, 1, wxRIGHT | wxEXPAND, 5 );
|
|
||||||
sbLayersSizer->Add( buttonSizer, 0, wxRIGHT | wxEXPAND, 5 );
|
|
||||||
|
|
||||||
getMainSizer()->Insert( 0, sbLayersSizer, 1, wxEXPAND | wxALL, 5 );
|
getMainSizer()->Insert( 0, sbLayersSizer, 1, wxEXPAND | wxALL, 5 );
|
||||||
}
|
|
||||||
|
|
||||||
|
m_popMenu = new wxMenu();
|
||||||
|
m_popMenu->Append( new wxMenuItem( m_popMenu, ID_SELECT_FAB_LAYERS,
|
||||||
|
_( "Select Fab Layers" ), wxEmptyString ) );
|
||||||
|
|
||||||
void DIALOG_PRINT_PCBNEW::onSelectAllClick( wxCommandEvent& event )
|
m_popMenu->Append( new wxMenuItem( m_popMenu, ID_SELECT_COPPER_LAYERS,
|
||||||
{
|
_( "Select all Copper Layers" ), wxEmptyString ) );
|
||||||
setListBoxValue( m_listCopperLayers, true );
|
|
||||||
setListBoxValue( m_listTechLayers, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
m_popMenu->Append( new wxMenuItem( m_popMenu, ID_DESELECT_COPPER_LAYERS,
|
||||||
|
_( "Deselect all Copper Layers" ), wxEmptyString ) );
|
||||||
|
|
||||||
void DIALOG_PRINT_PCBNEW::onDeselectAllClick( wxCommandEvent& event )
|
m_popMenu->Append( new wxMenuItem( m_popMenu, ID_SELECT_ALL_LAYERS,
|
||||||
{
|
_( "Select all Layers" ), wxEmptyString ) );
|
||||||
setListBoxValue( m_listCopperLayers, false );
|
|
||||||
setListBoxValue( m_listTechLayers, false );
|
m_popMenu->Append( new wxMenuItem( m_popMenu, ID_DESELECT_ALL_LAYERS,
|
||||||
|
_( "Deselect all Layers" ), wxEmptyString ) );
|
||||||
|
|
||||||
|
this->Bind( wxEVT_RIGHT_DOWN,
|
||||||
|
[&]( wxMouseEvent& aEvent )
|
||||||
|
{
|
||||||
|
this->PopupMenu( m_popMenu, aEvent.GetPosition() );
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -365,30 +333,55 @@ void DIALOG_PRINT_PCBNEW::onColorModeClicked( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DIALOG_PRINT_PCBNEW::setListBoxValue( wxCheckListBox* aList, bool aValue )
|
// Select or deselect groups of layers in the layers list:
|
||||||
|
void DIALOG_PRINT_PCBNEW::onPopUpLayers( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
for( unsigned int i = 0; i < aList->GetCount(); ++i )
|
// Build a list of layers for usual fabrication: copper layers + tech layers without courtyard
|
||||||
aList->Check( i, aValue );
|
LSET fab_layer_set = ( LSET::AllCuMask() | LSET::AllTechMask() ) & ~LSET( 2, B_CrtYd, F_CrtYd );
|
||||||
}
|
|
||||||
|
|
||||||
|
switch( event.GetId() )
|
||||||
|
{
|
||||||
|
case ID_SELECT_FAB_LAYERS: // Select layers usually needed to build a board
|
||||||
|
for( unsigned i = 0; i < m_layerList.size(); i++ )
|
||||||
|
{
|
||||||
|
LSET layermask( m_layerList[ i ] );
|
||||||
|
|
||||||
bool DIALOG_PRINT_PCBNEW::isLayerEnabled( unsigned int aLayer ) const
|
if( ( layermask & fab_layer_set ).any() )
|
||||||
{
|
m_layerCheckListBox->Check( i, true );
|
||||||
wxCHECK( aLayer < arrayDim( m_layers ), false );
|
else
|
||||||
const auto& layerInfo = m_layers[aLayer];
|
m_layerCheckListBox->Check( i, false );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
if( layerInfo.first )
|
case ID_SELECT_COPPER_LAYERS:
|
||||||
return layerInfo.first->IsChecked( layerInfo.second );
|
for( unsigned i = 0; i < m_layerList.size(); i++ )
|
||||||
|
{
|
||||||
|
if( IsCopperLayer( m_layerList[i] ) )
|
||||||
|
m_layerCheckListBox->Check( i, true );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
return false;
|
case ID_DESELECT_COPPER_LAYERS:
|
||||||
}
|
for( unsigned i = 0; i < m_layerList.size(); i++ )
|
||||||
|
{
|
||||||
|
if( IsCopperLayer( m_layerList[i] ) )
|
||||||
|
m_layerCheckListBox->Check( i, false );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ID_SELECT_ALL_LAYERS:
|
||||||
|
for( unsigned i = 0; i < m_layerList.size(); i++ )
|
||||||
|
m_layerCheckListBox->Check( i, true );
|
||||||
|
break;
|
||||||
|
|
||||||
void DIALOG_PRINT_PCBNEW::enableLayer( unsigned int aLayer, bool aValue )
|
case ID_DESELECT_ALL_LAYERS:
|
||||||
{
|
for( unsigned i = 0; i < m_layerList.size(); i++ )
|
||||||
wxCHECK( aLayer < arrayDim( m_layers ), /* void */ );
|
m_layerCheckListBox->Check( i, false );
|
||||||
const auto& layerInfo = m_layers[aLayer];
|
break;
|
||||||
layerInfo.first->Check( layerInfo.second, aValue );
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -398,12 +391,12 @@ int DIALOG_PRINT_PCBNEW::setLayerSetFromList()
|
||||||
int& pageCount = settings()->m_pageCount;
|
int& pageCount = settings()->m_pageCount;
|
||||||
pageCount = 0;
|
pageCount = 0;
|
||||||
|
|
||||||
for( unsigned int layer = 0; layer < arrayDim( m_layers ); ++layer )
|
for( unsigned i = 0; i < m_layerList.size(); i++ )
|
||||||
{
|
{
|
||||||
if( isLayerEnabled( layer ) )
|
if( m_layerCheckListBox->IsChecked( i ) )
|
||||||
{
|
{
|
||||||
++pageCount;
|
++pageCount;
|
||||||
settings()->m_LayerSet.set( layer );
|
settings()->m_LayerSet.set( m_layerList[i] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue