Add support for print-as-per-items-tab.
ADDED a print mode which allows the Layers Manager's Items tab to control the visiblity of various items. Fixes https://gitlab.com/kicad/code/kicad/issues/3894
This commit is contained in:
parent
7f65b31cb6
commit
bc9723340a
|
@ -96,6 +96,7 @@ private:
|
|||
wxCheckBox* m_checkboxMirror;
|
||||
wxChoice* m_drillMarksChoice;
|
||||
wxRadioBox* m_boxPagination;
|
||||
wxCheckBox* m_checkAsItems;
|
||||
wxCheckBox* m_checkBackground;
|
||||
wxCheckBox* m_checkUseTheme;
|
||||
wxStaticText* m_lblTheme;
|
||||
|
@ -103,16 +104,17 @@ private:
|
|||
};
|
||||
|
||||
|
||||
DIALOG_PRINT_PCBNEW::DIALOG_PRINT_PCBNEW( PCB_BASE_EDIT_FRAME* aParent, PCBNEW_PRINTOUT_SETTINGS* aSettings ) :
|
||||
DIALOG_PRINT_GENERIC( aParent, aSettings ), m_parent( aParent )
|
||||
DIALOG_PRINT_PCBNEW::DIALOG_PRINT_PCBNEW( PCB_BASE_EDIT_FRAME* aParent,
|
||||
PCBNEW_PRINTOUT_SETTINGS* aSettings ) :
|
||||
DIALOG_PRINT_GENERIC( aParent, aSettings ),
|
||||
m_parent( aParent )
|
||||
{
|
||||
m_config = Kiface().KifaceSettings();
|
||||
|
||||
createExtraOptions();
|
||||
createLeftPanel();
|
||||
|
||||
m_outputMode->Bind(
|
||||
wxEVT_COMMAND_CHOICE_SELECTED, &DIALOG_PRINT_PCBNEW::onColorModeChanged, this );
|
||||
m_outputMode->Bind( wxEVT_COMMAND_CHOICE_SELECTED, &DIALOG_PRINT_PCBNEW::onColorModeChanged, this );
|
||||
}
|
||||
|
||||
|
||||
|
@ -196,12 +198,19 @@ void DIALOG_PRINT_PCBNEW::createExtraOptions()
|
|||
int rows = optionsSizer->GetEffectiveRowsCount();
|
||||
int cols = optionsSizer->GetEffectiveColsCount();
|
||||
|
||||
m_checkAsItems = new wxCheckBox( sbOptionsSizer->GetStaticBox(), wxID_ANY,
|
||||
_( "Print according to Items tab of Layers Manager" ),
|
||||
wxDefaultPosition, wxDefaultSize, 0 );
|
||||
optionsSizer->Add( m_checkAsItems, wxGBPosition( rows++, 0 ), wxGBSpan( 1, 3 ), wxALL, 5 );
|
||||
|
||||
m_checkBackground = new wxCheckBox( sbOptionsSizer->GetStaticBox(), wxID_ANY,
|
||||
_( "Print background color" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
_( "Print background color" ), wxDefaultPosition,
|
||||
wxDefaultSize, 0 );
|
||||
optionsSizer->Add( m_checkBackground, wxGBPosition( rows++, 0 ), wxGBSpan( 1, 3 ), wxALL, 5 );
|
||||
|
||||
m_checkUseTheme = new wxCheckBox( sbOptionsSizer->GetStaticBox(), wxID_ANY,
|
||||
_( "Use a different color theme for printing" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
_( "Use a different color theme for printing" ),
|
||||
wxDefaultPosition, wxDefaultSize, 0 );
|
||||
optionsSizer->Add( m_checkUseTheme, wxGBPosition( rows++, 0 ), wxGBSpan( 1, 3 ),
|
||||
wxLEFT | wxRIGHT | wxTOP, 5 );
|
||||
|
||||
|
@ -404,6 +413,8 @@ void DIALOG_PRINT_PCBNEW::saveSettings()
|
|||
{
|
||||
setLayerSetFromList();
|
||||
|
||||
settings()->m_asItemCheckboxes = m_checkAsItems->GetValue();
|
||||
|
||||
settings()->m_drillMarks =
|
||||
(PCBNEW_PRINTOUT_SETTINGS::DRILL_MARK_SHAPE_T) m_drillMarksChoice->GetSelection();
|
||||
|
||||
|
@ -418,8 +429,8 @@ void DIALOG_PRINT_PCBNEW::saveSettings()
|
|||
settings()->m_background = cfg->m_Printing.background;
|
||||
cfg->m_Printing.use_theme = m_checkUseTheme->GetValue();
|
||||
|
||||
COLOR_SETTINGS* theme = static_cast<COLOR_SETTINGS*>(
|
||||
m_colorTheme->GetClientData( m_colorTheme->GetSelection() ) );
|
||||
int sel = m_colorTheme->GetSelection();
|
||||
COLOR_SETTINGS* theme = static_cast<COLOR_SETTINGS*>( m_colorTheme->GetClientData( sel ) );
|
||||
|
||||
if( theme && m_checkUseTheme->IsChecked() )
|
||||
{
|
||||
|
@ -429,7 +440,7 @@ void DIALOG_PRINT_PCBNEW::saveSettings()
|
|||
else
|
||||
{
|
||||
// This should always work, but in case it doesn't we fall back on default colors
|
||||
if( auto pcbframe = dynamic_cast<PCB_BASE_EDIT_FRAME*>( m_parent ) )
|
||||
if( PCB_BASE_EDIT_FRAME* pcbframe = dynamic_cast<PCB_BASE_EDIT_FRAME*>( m_parent ) )
|
||||
settings()->m_colorSettings = pcbframe->GetColorSettings();
|
||||
else
|
||||
settings()->m_colorSettings = m_parent->GetColorSettings();
|
||||
|
|
|
@ -131,6 +131,41 @@ void PCBNEW_PRINTOUT::setupViewLayers( KIGFX::VIEW& aView, const LSET& aLayerSet
|
|||
for( LSEQ layerSeq = m_settings.m_layerSet.Seq(); layerSeq; ++layerSeq )
|
||||
aView.SetLayerVisible( PCBNEW_LAYER_ID_START + *layerSeq, true );
|
||||
|
||||
if( m_pcbnewSettings.m_asItemCheckboxes )
|
||||
{
|
||||
auto setVisibility = [&]( GAL_LAYER_ID aLayer )
|
||||
{
|
||||
if( m_board->IsElementVisible( aLayer ) )
|
||||
aView.SetLayerVisible( aLayer );
|
||||
};
|
||||
|
||||
setVisibility( LAYER_MOD_FR );
|
||||
setVisibility( LAYER_MOD_BK );
|
||||
setVisibility( LAYER_MOD_VALUES );
|
||||
setVisibility( LAYER_MOD_REFERENCES );
|
||||
setVisibility( LAYER_MOD_TEXT_FR );
|
||||
setVisibility( LAYER_MOD_TEXT_BK );
|
||||
setVisibility( LAYER_MOD_TEXT_INVISIBLE );
|
||||
setVisibility( LAYER_PAD_FR );
|
||||
setVisibility( LAYER_PAD_BK );
|
||||
setVisibility( LAYER_PADS_TH );
|
||||
|
||||
setVisibility( LAYER_TRACKS );
|
||||
setVisibility( LAYER_VIA_THROUGH );
|
||||
setVisibility( LAYER_VIA_BBLIND );
|
||||
setVisibility( LAYER_VIA_MICROVIA );
|
||||
setVisibility( LAYER_NON_PLATEDHOLES );
|
||||
|
||||
setVisibility( LAYER_NO_CONNECTS );
|
||||
setVisibility( LAYER_DRC_WARNING );
|
||||
setVisibility( LAYER_DRC_ERROR );
|
||||
setVisibility( LAYER_DRC_EXCLUSION );
|
||||
setVisibility( LAYER_ANCHOR );
|
||||
setVisibility( LAYER_WORKSHEET );
|
||||
setVisibility( LAYER_GRID );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Enable pad layers corresponding to the selected copper layers
|
||||
if( aLayerSet.test( F_Cu ) )
|
||||
aView.SetLayerVisible( LAYER_PAD_FR, true );
|
||||
|
@ -158,7 +193,6 @@ void PCBNEW_PRINTOUT::setupViewLayers( KIGFX::VIEW& aView, const LSET& aLayerSet
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Keep certain items always enabled/disabled and just rely on the layer visibility
|
||||
const int alwaysEnabled[] = {
|
||||
LAYER_MOD_TEXT_FR, LAYER_MOD_TEXT_BK, LAYER_MOD_FR, LAYER_MOD_BK,
|
||||
|
@ -169,6 +203,7 @@ void PCBNEW_PRINTOUT::setupViewLayers( KIGFX::VIEW& aView, const LSET& aLayerSet
|
|||
for( int item : alwaysEnabled )
|
||||
aView.SetLayerVisible( item, true );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PCBNEW_PRINTOUT::setupPainter( KIGFX::PAINTER& aPainter )
|
||||
|
|
|
@ -33,14 +33,15 @@ struct PCBNEW_PRINTOUT_SETTINGS : BOARD_PRINTOUT_SETTINGS
|
|||
NO_DRILL_SHAPE,
|
||||
SMALL_DRILL_SHAPE,
|
||||
FULL_DRILL_SHAPE
|
||||
} m_drillMarks; ///< Drill marks shape
|
||||
} m_drillMarks;
|
||||
|
||||
enum PAGINATION_T {
|
||||
LAYER_PER_PAGE,
|
||||
ALL_LAYERS
|
||||
} m_pagination; ///< Pagination
|
||||
} m_pagination;
|
||||
|
||||
bool m_noEdgeLayer; ///< Disable board outline on each page
|
||||
bool m_asItemCheckboxes; ///< Honor checkboxes in the Items tab of the Layers Manager
|
||||
|
||||
void Load( APP_SETTINGS_BASE* aConfig ) override;
|
||||
void Save( APP_SETTINGS_BASE* aConfig ) override;
|
||||
|
|
Loading…
Reference in New Issue