mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Even more open-coded dialog state-saving cleanup.
This commit is contained in:
parent
cd325198c1
commit
6947b3b233
@ -78,9 +78,8 @@ static const wxString pageFmts[] =
|
||||
// to be recognized in code
|
||||
};
|
||||
|
||||
DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* aParent,
|
||||
EMBEDDED_FILES* aEmbeddedFiles, double aIuPerMils,
|
||||
const VECTOR2D& aMaxUserSizeMils ) :
|
||||
DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* aParent, EMBEDDED_FILES* aEmbeddedFiles,
|
||||
double aIuPerMils, const VECTOR2D& aMaxUserSizeMils ) :
|
||||
DIALOG_PAGES_SETTINGS_BASE( aParent ),
|
||||
m_parent( aParent ),
|
||||
m_screen( m_parent->GetScreen() ),
|
||||
@ -479,9 +478,7 @@ bool DIALOG_PAGES_SETTINGS::SavePageSettings()
|
||||
BASE_SCREEN::m_DrawingSheetFileName = fileName;
|
||||
|
||||
if( !DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( fullFileName, &msg ) )
|
||||
{
|
||||
DisplayErrorMessage( this, wxString::Format( _( "Error loading drawing sheet '%s'." ), fullFileName ), msg );
|
||||
}
|
||||
|
||||
m_localPrjConfigChanged = true;
|
||||
|
||||
@ -506,36 +503,21 @@ bool DIALOG_PAGES_SETTINGS::SavePageSettings()
|
||||
else
|
||||
{
|
||||
// search for longest common string first, e.g. A4 before A
|
||||
if( paperType.Contains( PAGE_INFO::USLetter ) )
|
||||
success = m_pageInfo.SetType( PAGE_INFO::USLetter );
|
||||
else if( paperType.Contains( PAGE_INFO::USLegal ) )
|
||||
success = m_pageInfo.SetType( PAGE_INFO::USLegal );
|
||||
else if( paperType.Contains( PAGE_INFO::USLedger ) )
|
||||
success = m_pageInfo.SetType( PAGE_INFO::USLedger );
|
||||
else if( paperType.Contains( PAGE_INFO::GERBER ) )
|
||||
success = m_pageInfo.SetType( PAGE_INFO::GERBER );
|
||||
else if( paperType.Contains( PAGE_INFO::A5 ) )
|
||||
success = m_pageInfo.SetType( PAGE_INFO::A5 );
|
||||
else if( paperType.Contains( PAGE_INFO::A4 ) )
|
||||
success = m_pageInfo.SetType( PAGE_INFO::A4 );
|
||||
else if( paperType.Contains( PAGE_INFO::A3 ) )
|
||||
success = m_pageInfo.SetType( PAGE_INFO::A3 );
|
||||
else if( paperType.Contains( PAGE_INFO::A2 ) )
|
||||
success = m_pageInfo.SetType( PAGE_INFO::A2 );
|
||||
else if( paperType.Contains( PAGE_INFO::A1 ) )
|
||||
success = m_pageInfo.SetType( PAGE_INFO::A1 );
|
||||
else if( paperType.Contains( PAGE_INFO::A0 ) )
|
||||
success = m_pageInfo.SetType( PAGE_INFO::A0 );
|
||||
else if( paperType.Contains( PAGE_INFO::A ) )
|
||||
success = m_pageInfo.SetType( PAGE_INFO::A );
|
||||
else if( paperType.Contains( PAGE_INFO::B ) )
|
||||
success = m_pageInfo.SetType( PAGE_INFO::B );
|
||||
else if( paperType.Contains( PAGE_INFO::C ) )
|
||||
success = m_pageInfo.SetType( PAGE_INFO::C );
|
||||
else if( paperType.Contains( PAGE_INFO::D ) )
|
||||
success = m_pageInfo.SetType( PAGE_INFO::D );
|
||||
else if( paperType.Contains( PAGE_INFO::E ) )
|
||||
success = m_pageInfo.SetType( PAGE_INFO::E );
|
||||
if( paperType.Contains( PAGE_INFO::USLetter ) ) success = m_pageInfo.SetType( PAGE_INFO::USLetter );
|
||||
else if( paperType.Contains( PAGE_INFO::USLegal ) ) success = m_pageInfo.SetType( PAGE_INFO::USLegal );
|
||||
else if( paperType.Contains( PAGE_INFO::USLedger ) ) success = m_pageInfo.SetType( PAGE_INFO::USLedger );
|
||||
else if( paperType.Contains( PAGE_INFO::GERBER ) ) success = m_pageInfo.SetType( PAGE_INFO::GERBER );
|
||||
else if( paperType.Contains( PAGE_INFO::A5 ) ) success = m_pageInfo.SetType( PAGE_INFO::A5 );
|
||||
else if( paperType.Contains( PAGE_INFO::A4 ) ) success = m_pageInfo.SetType( PAGE_INFO::A4 );
|
||||
else if( paperType.Contains( PAGE_INFO::A3 ) ) success = m_pageInfo.SetType( PAGE_INFO::A3 );
|
||||
else if( paperType.Contains( PAGE_INFO::A2 ) ) success = m_pageInfo.SetType( PAGE_INFO::A2 );
|
||||
else if( paperType.Contains( PAGE_INFO::A1 ) ) success = m_pageInfo.SetType( PAGE_INFO::A1 );
|
||||
else if( paperType.Contains( PAGE_INFO::A0 ) ) success = m_pageInfo.SetType( PAGE_INFO::A0 );
|
||||
else if( paperType.Contains( PAGE_INFO::A ) ) success = m_pageInfo.SetType( PAGE_INFO::A );
|
||||
else if( paperType.Contains( PAGE_INFO::B ) ) success = m_pageInfo.SetType( PAGE_INFO::B );
|
||||
else if( paperType.Contains( PAGE_INFO::C ) ) success = m_pageInfo.SetType( PAGE_INFO::C );
|
||||
else if( paperType.Contains( PAGE_INFO::D ) ) success = m_pageInfo.SetType( PAGE_INFO::D );
|
||||
else if( paperType.Contains( PAGE_INFO::E ) ) success = m_pageInfo.SetType( PAGE_INFO::E );
|
||||
|
||||
if( success )
|
||||
{
|
||||
@ -800,8 +782,7 @@ void DIALOG_PAGES_SETTINGS::OnWksFileSelection( wxCommandEvent& event )
|
||||
|
||||
// Display a file picker dialog
|
||||
FILEDLG_HOOK_EMBED_FILE customize;
|
||||
wxFileDialog fileDialog( this, _( "Drawing Sheet File" ), path, name,
|
||||
FILEEXT::DrawingSheetFileWildcard(),
|
||||
wxFileDialog fileDialog( this, _( "Drawing Sheet File" ), path, name, FILEEXT::DrawingSheetFileWildcard(),
|
||||
wxFD_DEFAULT_STYLE | wxFD_FILE_MUST_EXIST );
|
||||
|
||||
if( m_embeddedFiles )
|
||||
|
@ -33,6 +33,8 @@
|
||||
static constexpr double MIN_SCALE = 0.01;
|
||||
static constexpr double MAX_SCALE = 100.0;
|
||||
|
||||
wxPrintData* DIALOG_PRINT_GENERIC::s_printData = nullptr;
|
||||
wxPageSetupDialogData* DIALOG_PRINT_GENERIC::s_pageSetupData = nullptr;
|
||||
|
||||
|
||||
/**
|
||||
@ -43,9 +45,8 @@ static constexpr double MAX_SCALE = 100.0;
|
||||
class KI_PREVIEW_FRAME : public wxPreviewFrame
|
||||
{
|
||||
public:
|
||||
KI_PREVIEW_FRAME( wxPrintPreview* aPreview, wxWindow* aParent,
|
||||
const wxString& aTitle, const wxPoint& aPos = wxDefaultPosition,
|
||||
const wxSize& aSize = wxDefaultSize ) :
|
||||
KI_PREVIEW_FRAME( wxPrintPreview* aPreview, wxWindow* aParent, const wxString& aTitle,
|
||||
const wxPoint& aPos = wxDefaultPosition, const wxSize& aSize = wxDefaultSize ) :
|
||||
wxPreviewFrame( aPreview, aParent, aTitle, aPos, aSize )
|
||||
{
|
||||
}
|
||||
@ -85,16 +86,10 @@ wxPoint KI_PREVIEW_FRAME::s_pos;
|
||||
wxSize KI_PREVIEW_FRAME::s_size;
|
||||
|
||||
|
||||
DIALOG_PRINT_GENERIC::DIALOG_PRINT_GENERIC( EDA_DRAW_FRAME* aParent, PRINTOUT_SETTINGS* aSettings )
|
||||
: DIALOG_PRINT_GENERIC_BASE( aParent ),
|
||||
m_config( nullptr ),
|
||||
DIALOG_PRINT_GENERIC::DIALOG_PRINT_GENERIC( EDA_DRAW_FRAME* aParent, PRINTOUT_SETTINGS* aSettings ) :
|
||||
DIALOG_PRINT_GENERIC_BASE( aParent ),
|
||||
m_settings( aSettings )
|
||||
{
|
||||
// Note: for the validator, min value is 0.0, to allow typing values like 0.5
|
||||
// that start by 0
|
||||
m_scaleValidator.SetRange( 0.0, MAX_SCALE );
|
||||
m_scaleCustomText->SetValidator( m_scaleValidator );
|
||||
|
||||
// Show m_panelPrinters only if there are printers to list:
|
||||
m_panelPrinters->Show( m_panelPrinters->AsPrintersAvailable() );
|
||||
|
||||
@ -114,22 +109,10 @@ DIALOG_PRINT_GENERIC::DIALOG_PRINT_GENERIC( EDA_DRAW_FRAME* aParent, PRINTOUT_SE
|
||||
}
|
||||
|
||||
|
||||
DIALOG_PRINT_GENERIC::~DIALOG_PRINT_GENERIC()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PRINT_GENERIC::ForcePrintBorder( bool aValue )
|
||||
{
|
||||
m_titleBlock->SetValue( aValue );
|
||||
m_titleBlock->Hide();
|
||||
|
||||
if( m_config )
|
||||
{
|
||||
m_settings->Load( m_config );
|
||||
m_settings->m_titleBlock = aValue;
|
||||
m_settings->Save( m_config );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -138,27 +121,27 @@ void DIALOG_PRINT_GENERIC::saveSettings()
|
||||
m_settings->m_scale = getScaleValue();
|
||||
m_settings->m_titleBlock = m_titleBlock->GetValue();
|
||||
m_settings->m_blackWhite = m_outputMode->GetSelection();
|
||||
|
||||
if( m_config )
|
||||
m_settings->Save( m_config );
|
||||
}
|
||||
|
||||
|
||||
double DIALOG_PRINT_GENERIC::getScaleValue()
|
||||
{
|
||||
if( m_scale1->GetValue() )
|
||||
{
|
||||
return 1.0;
|
||||
|
||||
if( m_scaleFit->GetValue() )
|
||||
}
|
||||
else if( m_scaleFit->GetValue() )
|
||||
{
|
||||
return 0.0;
|
||||
|
||||
if( m_scaleCustom->GetValue() )
|
||||
}
|
||||
else if( m_scaleCustom->GetValue() )
|
||||
{
|
||||
double scale = 1.0;;
|
||||
|
||||
if( !m_scaleCustomText->GetValue().ToDouble( &scale ) )
|
||||
{
|
||||
DisplayInfoMessage( nullptr, _( "Warning: scale is not a number." ) );
|
||||
DisplayInfoMessage( nullptr, _( "Warning: custom scale is not a number." ) );
|
||||
setScaleValue( 1.0 );
|
||||
scale = 1.0;
|
||||
}
|
||||
|
||||
@ -166,17 +149,15 @@ double DIALOG_PRINT_GENERIC::getScaleValue()
|
||||
{
|
||||
scale = MAX_SCALE;
|
||||
setScaleValue( scale );
|
||||
DisplayInfoMessage( nullptr, wxString::Format( _( "Warning: scale set to a very large "
|
||||
"value.\nIt will be clamped to %f." ),
|
||||
scale ) );
|
||||
DisplayInfoMessage( nullptr, wxString::Format( _( "Warning: custom scale is too large.\n"
|
||||
"It will be clamped to %f." ), scale ) );
|
||||
}
|
||||
else if( scale < MIN_SCALE )
|
||||
{
|
||||
scale = MIN_SCALE;
|
||||
setScaleValue( scale );
|
||||
DisplayInfoMessage( nullptr, wxString::Format( _( "Warning: scale set to a very small "
|
||||
"value.\nIt will be clamped to %f." ),
|
||||
scale ) );
|
||||
DisplayInfoMessage( nullptr, wxString::Format( _( "Warning: custom scale is too small.\n"
|
||||
"It will be clamped to %f." ), scale ) );
|
||||
}
|
||||
|
||||
return scale;
|
||||
@ -218,9 +199,6 @@ bool DIALOG_PRINT_GENERIC::TransferDataToWindow()
|
||||
if( !wxDialog::TransferDataToWindow() )
|
||||
return false;
|
||||
|
||||
if( m_config )
|
||||
m_settings->Load( m_config );
|
||||
|
||||
setScaleValue( m_settings->m_scale );
|
||||
m_titleBlock->SetValue( m_settings->m_titleBlock );
|
||||
m_outputMode->SetSelection( m_settings->m_blackWhite ? 1 : 0 );
|
||||
@ -234,7 +212,7 @@ void DIALOG_PRINT_GENERIC::onPageSetup( wxCommandEvent& event )
|
||||
wxPageSetupDialog pageSetupDialog( this, s_pageSetupData );
|
||||
pageSetupDialog.ShowModal();
|
||||
|
||||
(*s_PrintData) = pageSetupDialog.GetPageSetupDialogData().GetPrintData();
|
||||
(*s_printData ) = pageSetupDialog.GetPageSetupDialogData().GetPrintData();
|
||||
(*s_pageSetupData) = pageSetupDialog.GetPageSetupDialogData();
|
||||
}
|
||||
|
||||
@ -255,12 +233,11 @@ void DIALOG_PRINT_GENERIC::onPrintPreview( wxCommandEvent& event )
|
||||
if( m_panelPrinters )
|
||||
selectedPrinterName = m_panelPrinters->GetSelectedPrinterName();
|
||||
|
||||
s_PrintData->SetPrinterName( selectedPrinterName );
|
||||
s_printData->SetPrinterName( selectedPrinterName );
|
||||
|
||||
// Pass two printout objects: for preview, and possible printing.
|
||||
wxString title = _( "Print Preview" );
|
||||
wxPrintPreview* preview =
|
||||
new wxPrintPreview( createPrintout( title ), createPrintout( title ), s_PrintData );
|
||||
wxPrintPreview* preview = new wxPrintPreview( createPrintout( title ), createPrintout( title ), s_printData );
|
||||
|
||||
preview->SetZoom( 100 );
|
||||
|
||||
@ -313,9 +290,9 @@ void DIALOG_PRINT_GENERIC::onPrintButtonClick( wxCommandEvent& event )
|
||||
if( m_panelPrinters )
|
||||
selectedPrinterName = m_panelPrinters->GetSelectedPrinterName();
|
||||
|
||||
s_PrintData->SetPrinterName( selectedPrinterName );
|
||||
s_printData->SetPrinterName( selectedPrinterName );
|
||||
|
||||
wxPrintDialogData printDialogData( *s_PrintData );
|
||||
wxPrintDialogData printDialogData( *s_printData );
|
||||
printDialogData.SetMaxPage( m_settings->m_pageCount );
|
||||
|
||||
wxPrinter printer( &printDialogData );
|
||||
@ -331,7 +308,7 @@ void DIALOG_PRINT_GENERIC::onPrintButtonClick( wxCommandEvent& event )
|
||||
}
|
||||
else
|
||||
{
|
||||
*s_PrintData = printer.GetPrintDialogData().GetPrintData();
|
||||
*s_printData = printer.GetPrintDialogData().GetPrintData();
|
||||
}
|
||||
}
|
||||
|
||||
@ -364,38 +341,39 @@ void DIALOG_PRINT_GENERIC::onSetCustomScale( wxCommandEvent& event )
|
||||
|
||||
void DIALOG_PRINT_GENERIC::initPrintData()
|
||||
{
|
||||
if( !s_PrintData ) // First print
|
||||
if( !s_printData ) // First print
|
||||
{
|
||||
s_PrintData = new wxPrintData();
|
||||
s_printData = new wxPrintData();
|
||||
|
||||
if( !s_PrintData->Ok() )
|
||||
if( !s_printData->Ok() )
|
||||
DisplayError( this, _( "An error occurred initializing the printer information." ) );
|
||||
|
||||
s_PrintData->SetQuality( wxPRINT_QUALITY_HIGH ); // Default resolution = HIGH;
|
||||
s_printData->SetQuality( wxPRINT_QUALITY_HIGH ); // Default resolution = HIGH;
|
||||
}
|
||||
|
||||
if( !s_pageSetupData )
|
||||
{
|
||||
const PAGE_INFO& pageInfo = m_settings->m_pageInfo;
|
||||
|
||||
s_pageSetupData = new wxPageSetupDialogData( *s_PrintData );
|
||||
s_pageSetupData = new wxPageSetupDialogData( *s_printData );
|
||||
s_pageSetupData->SetPaperId( pageInfo.GetPaperId() );
|
||||
s_pageSetupData->GetPrintData().SetOrientation( pageInfo.GetWxOrientation() );
|
||||
|
||||
if( pageInfo.IsCustom() )
|
||||
{
|
||||
if( pageInfo.IsPortrait() )
|
||||
{
|
||||
s_pageSetupData->SetPaperSize( wxSize( EDA_UNIT_UTILS::Mils2mm( pageInfo.GetWidthMils() ),
|
||||
EDA_UNIT_UTILS::Mils2mm( pageInfo.GetHeightMils() ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
s_pageSetupData->SetPaperSize( wxSize( EDA_UNIT_UTILS::Mils2mm( pageInfo.GetHeightMils() ),
|
||||
EDA_UNIT_UTILS::Mils2mm( pageInfo.GetWidthMils() ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
*s_PrintData = s_pageSetupData->GetPrintData();
|
||||
*s_printData = s_pageSetupData->GetPrintData();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
wxPrintData* DIALOG_PRINT_GENERIC::s_PrintData = nullptr;
|
||||
wxPageSetupDialogData* DIALOG_PRINT_GENERIC::s_pageSetupData = nullptr;
|
||||
|
@ -85,8 +85,6 @@ DIALOG_PRINT_GENERIC_BASE::DIALOG_PRINT_GENERIC_BASE( wxWindow* parent, wxWindow
|
||||
bSizerScaleCustom->Add( m_scaleCustom, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
m_scaleCustomText = new wxTextCtrl( bScaleSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_scaleCustomText->SetToolTip( _("Set X scale adjust for exact scale plotting") );
|
||||
|
||||
bSizerScaleCustom->Add( m_scaleCustomText, 1, wxEXPAND|wxRIGHT, 5 );
|
||||
|
||||
|
||||
|
@ -674,7 +674,7 @@
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip">Set X scale adjust for exact scale plotting</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style"></property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
|
@ -140,7 +140,7 @@ void DIALOG_MAP_GERBER_LAYERS_TO_PCB::initDialog()
|
||||
flexColumnBoxSizer = m_flexRightColumnBoxSizer;
|
||||
|
||||
// Provide a text string to identify the Gerber layer
|
||||
msg.Printf( _( "Layer %d" ), m_buttonTable[ii] + 1 );
|
||||
msg.Printf( _( "Layer %d:" ), m_buttonTable[ii] + 1 );
|
||||
|
||||
label = new wxStaticText( this, wxID_STATIC, msg );
|
||||
flexColumnBoxSizer->Add( label, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
||||
@ -152,8 +152,8 @@ void DIALOG_MAP_GERBER_LAYERS_TO_PCB::initDialog()
|
||||
|
||||
// Provide a button for this layer (which will invoke a child dialog box)
|
||||
item_ID = ID_BUTTON_0 + ii;
|
||||
wxButton * Button = new wxButton( this, item_ID, wxT( "..." ), wxDefaultPosition,
|
||||
wxDefaultSize, wxBU_EXACTFIT );
|
||||
wxButton * Button = new wxButton( this, item_ID, wxT( "..." ), wxDefaultPosition, wxDefaultSize,
|
||||
wxBU_EXACTFIT );
|
||||
|
||||
flexColumnBoxSizer->Add( Button, 0, wxALIGN_CENTER_VERTICAL | wxALL );
|
||||
|
||||
|
@ -31,11 +31,8 @@ DIALOG_MAP_GERBER_LAYERS_TO_PCB_BASE::DIALOG_MAP_GERBER_LAYERS_TO_PCB_BASE( wxWi
|
||||
|
||||
m_bSizerLayerList->Add( 0, 0, 0, wxRIGHT|wxLEFT, 10 );
|
||||
|
||||
m_flexLeftColumnBoxSizer = new wxFlexGridSizer( 4, 0, 0 );
|
||||
m_flexLeftColumnBoxSizer->AddGrowableCol( 0 );
|
||||
m_flexLeftColumnBoxSizer = new wxFlexGridSizer( 16, 4, 0, 0 );
|
||||
m_flexLeftColumnBoxSizer->AddGrowableCol( 1 );
|
||||
m_flexLeftColumnBoxSizer->AddGrowableCol( 2 );
|
||||
m_flexLeftColumnBoxSizer->AddGrowableCol( 3 );
|
||||
m_flexLeftColumnBoxSizer->SetFlexibleDirection( wxBOTH );
|
||||
m_flexLeftColumnBoxSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
@ -45,11 +42,8 @@ DIALOG_MAP_GERBER_LAYERS_TO_PCB_BASE::DIALOG_MAP_GERBER_LAYERS_TO_PCB_BASE( wxWi
|
||||
m_staticlineSep = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
|
||||
m_bSizerLayerList->Add( m_staticlineSep, 0, wxEXPAND | wxALL, 5 );
|
||||
|
||||
m_flexRightColumnBoxSizer = new wxFlexGridSizer( 4, 0, 0 );
|
||||
m_flexRightColumnBoxSizer->AddGrowableCol( 0 );
|
||||
m_flexRightColumnBoxSizer = new wxFlexGridSizer( 16, 4, 0, 0 );
|
||||
m_flexRightColumnBoxSizer->AddGrowableCol( 1 );
|
||||
m_flexRightColumnBoxSizer->AddGrowableCol( 2 );
|
||||
m_flexRightColumnBoxSizer->AddGrowableCol( 3 );
|
||||
m_flexRightColumnBoxSizer->SetFlexibleDirection( wxBOTH );
|
||||
m_flexRightColumnBoxSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
@ -60,7 +54,7 @@ DIALOG_MAP_GERBER_LAYERS_TO_PCB_BASE::DIALOG_MAP_GERBER_LAYERS_TO_PCB_BASE( wxWi
|
||||
bSizerLayerSelection->Add( m_bSizerLayerList, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
sbUpperSizer->Add( bSizerLayerSelection, 1, wxEXPAND, 5 );
|
||||
sbUpperSizer->Add( bSizerLayerSelection, 1, wxEXPAND|wxRIGHT, 5 );
|
||||
|
||||
wxBoxSizer* bRightSizer;
|
||||
bRightSizer = new wxBoxSizer( wxVERTICAL );
|
||||
@ -113,7 +107,7 @@ DIALOG_MAP_GERBER_LAYERS_TO_PCB_BASE::DIALOG_MAP_GERBER_LAYERS_TO_PCB_BASE( wxWi
|
||||
bRightSizer->Add( bSizerButtons, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
sbUpperSizer->Add( bRightSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
sbUpperSizer->Add( bRightSizer, 0, wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizerMain->Add( sbUpperSizer, 1, wxEXPAND|wxALL, 5 );
|
||||
|
@ -75,7 +75,7 @@
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="flag">wxEXPAND|wxRIGHT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="true">
|
||||
<property name="minimum_size"></property>
|
||||
@ -170,7 +170,7 @@
|
||||
<object class="wxFlexGridSizer" expanded="true">
|
||||
<property name="cols">4</property>
|
||||
<property name="flexible_direction">wxBOTH</property>
|
||||
<property name="growablecols">0,1,2,3</property>
|
||||
<property name="growablecols">1</property>
|
||||
<property name="growablerows"></property>
|
||||
<property name="hgap">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
@ -247,7 +247,7 @@
|
||||
<object class="wxFlexGridSizer" expanded="true">
|
||||
<property name="cols">4</property>
|
||||
<property name="flexible_direction">wxBOTH</property>
|
||||
<property name="growablecols">0,1,2,3</property>
|
||||
<property name="growablecols">1</property>
|
||||
<property name="growablerows"></property>
|
||||
<property name="hgap">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
@ -264,7 +264,7 @@
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="flag">wxRIGHT|wxLEFT|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="true">
|
||||
<property name="minimum_size"></property>
|
||||
|
@ -45,7 +45,7 @@ class DIALOG_PRINT_GERBVIEW : public DIALOG_PRINT_GENERIC
|
||||
{
|
||||
public:
|
||||
DIALOG_PRINT_GERBVIEW( GERBVIEW_FRAME* aParent, BOARD_PRINTOUT_SETTINGS* aSettings );
|
||||
~DIALOG_PRINT_GERBVIEW() {};
|
||||
~DIALOG_PRINT_GERBVIEW() = default;
|
||||
|
||||
private:
|
||||
BOARD_PRINTOUT_SETTINGS* settings() const
|
||||
@ -68,9 +68,6 @@ private:
|
||||
///< 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
|
||||
int setLayerSetFromList();
|
||||
|
||||
@ -78,8 +75,8 @@ private:
|
||||
|
||||
wxPrintout* createPrintout( const wxString& aTitle ) override
|
||||
{
|
||||
return new GERBVIEW_PRINTOUT( m_parent->GetGerberLayout(), *settings(),
|
||||
m_parent->GetCanvas()->GetView(), aTitle );
|
||||
return new GERBVIEW_PRINTOUT( m_parent->GetGerberLayout(), *settings(), m_parent->GetCanvas()->GetView(),
|
||||
aTitle );
|
||||
}
|
||||
|
||||
GERBVIEW_FRAME* m_parent;
|
||||
@ -101,13 +98,10 @@ private:
|
||||
};
|
||||
|
||||
|
||||
DIALOG_PRINT_GERBVIEW::DIALOG_PRINT_GERBVIEW( GERBVIEW_FRAME* aParent,
|
||||
BOARD_PRINTOUT_SETTINGS* aSettings ) :
|
||||
DIALOG_PRINT_GERBVIEW::DIALOG_PRINT_GERBVIEW( GERBVIEW_FRAME* aParent, BOARD_PRINTOUT_SETTINGS* aSettings ) :
|
||||
DIALOG_PRINT_GENERIC( aParent, aSettings ),
|
||||
m_parent( aParent )
|
||||
{
|
||||
m_config = Kiface().KifaceSettings();
|
||||
|
||||
createExtraOptions();
|
||||
createLeftPanel();
|
||||
}
|
||||
@ -168,8 +162,7 @@ void DIALOG_PRINT_GERBVIEW::createExtraOptions()
|
||||
|
||||
// Print mirrored
|
||||
m_checkboxMirror = new wxCheckBox( box, wxID_ANY, _( "Print mirrored" ) );
|
||||
optionsSizer->Add( m_checkboxMirror, wxGBPosition( rows, 0 ), wxGBSpan( 1, cols ),
|
||||
wxBOTTOM | wxRIGHT | wxLEFT, 5 );
|
||||
optionsSizer->Add( m_checkboxMirror, wxGBPosition( rows, 0 ), wxGBSpan( 1, cols ), wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
}
|
||||
|
||||
|
||||
@ -188,17 +181,13 @@ void DIALOG_PRINT_GERBVIEW::createLeftPanel()
|
||||
}
|
||||
|
||||
// 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 = 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_GERBVIEW::onSelectAllClick ),
|
||||
nullptr, this );
|
||||
wxCommandEventHandler( DIALOG_PRINT_GERBVIEW::onSelectAllClick ), nullptr, this );
|
||||
m_buttonDeselectAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED,
|
||||
wxCommandEventHandler( DIALOG_PRINT_GERBVIEW::onDeselectAllClick ),
|
||||
nullptr, this );
|
||||
wxCommandEventHandler( DIALOG_PRINT_GERBVIEW::onDeselectAllClick ), nullptr, this );
|
||||
|
||||
wxBoxSizer* buttonSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
buttonSizer->Add( m_buttonSelectAll, 1, wxALL, 5 );
|
||||
@ -214,15 +203,15 @@ void DIALOG_PRINT_GERBVIEW::createLeftPanel()
|
||||
|
||||
void DIALOG_PRINT_GERBVIEW::onSelectAllClick( wxCommandEvent& event )
|
||||
{
|
||||
for( unsigned int i = 0; i < LAYER_LIST_COUNT; ++i )
|
||||
setListBoxValue( m_layerLists[i], true );
|
||||
for( wxCheckListBox* checkbox : m_layerLists )
|
||||
setListBoxValue( checkbox, true );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PRINT_GERBVIEW::onDeselectAllClick( wxCommandEvent& event )
|
||||
{
|
||||
for( unsigned int i = 0; i < LAYER_LIST_COUNT; ++i )
|
||||
setListBoxValue( m_layerLists[i], false );
|
||||
for( wxCheckListBox* checkbox : m_layerLists )
|
||||
setListBoxValue( checkbox, false );
|
||||
}
|
||||
|
||||
|
||||
@ -250,24 +239,6 @@ bool DIALOG_PRINT_GERBVIEW::isLayerEnabled( unsigned int aLayer ) const
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PRINT_GERBVIEW::enableLayer( unsigned int aLayer, bool aValue )
|
||||
{
|
||||
auto layerMapIt = m_layerToItemMap.find( aLayer );
|
||||
|
||||
if( layerMapIt == m_layerToItemMap.end() )
|
||||
return;
|
||||
|
||||
unsigned int itemNr = layerMapIt->second;
|
||||
unsigned int listIdx = itemNr / LAYER_PER_LIST;
|
||||
unsigned int itemIdx = itemNr % LAYER_PER_LIST;
|
||||
wxCHECK( listIdx < LAYER_LIST_COUNT, /* void */ );
|
||||
wxCheckListBox* listBox = m_layerLists[listIdx];
|
||||
|
||||
if( itemIdx < listBox->GetCount() )
|
||||
listBox->Check( itemIdx, aValue );
|
||||
}
|
||||
|
||||
|
||||
int DIALOG_PRINT_GERBVIEW::setLayerSetFromList()
|
||||
{
|
||||
settings()->m_LayerSet = LSET();
|
||||
|
@ -35,7 +35,7 @@ class DIALOG_PRINT_GENERIC : public DIALOG_PRINT_GENERIC_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_PRINT_GENERIC( EDA_DRAW_FRAME* aParent, PRINTOUT_SETTINGS* aSettings );
|
||||
virtual ~DIALOG_PRINT_GENERIC();
|
||||
virtual ~DIALOG_PRINT_GENERIC() = default;
|
||||
|
||||
/**
|
||||
* Set 'print border and title block' to a requested value and hides the
|
||||
@ -99,14 +99,10 @@ private:
|
||||
void initPrintData();
|
||||
|
||||
protected:
|
||||
APP_SETTINGS_BASE* m_config;
|
||||
|
||||
PRINTOUT_SETTINGS* m_settings;
|
||||
|
||||
private:
|
||||
wxFloatingPointValidator<double> m_scaleValidator;
|
||||
|
||||
static wxPrintData* s_PrintData;
|
||||
static wxPrintData* s_printData;
|
||||
static wxPageSetupDialogData* s_pageSetupData;
|
||||
};
|
||||
|
||||
|
@ -98,13 +98,10 @@ private:
|
||||
};
|
||||
|
||||
|
||||
DIALOG_PRINT_PCBNEW::DIALOG_PRINT_PCBNEW( PCB_BASE_EDIT_FRAME* aParent,
|
||||
PCBNEW_PRINTOUT_SETTINGS* aSettings ) :
|
||||
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();
|
||||
|
||||
@ -198,8 +195,7 @@ bool DIALOG_PRINT_PCBNEW::TransferDataToWindow()
|
||||
m_drillMarksChoice->SetSelection( (int)settings()->m_DrillMarks );
|
||||
|
||||
// Print all layers one one page or separately
|
||||
m_checkboxPagePerLayer->SetValue( settings()->m_Pagination
|
||||
== PCBNEW_PRINTOUT_SETTINGS::LAYER_PER_PAGE );
|
||||
m_checkboxPagePerLayer->SetValue( settings()->m_Pagination == PCBNEW_PRINTOUT_SETTINGS::LAYER_PER_PAGE );
|
||||
onPagePerLayerClicked( dummy );
|
||||
|
||||
// Update the dialog layout when layers are added
|
||||
@ -215,22 +211,16 @@ void DIALOG_PRINT_PCBNEW::createExtraOptions()
|
||||
wxStaticBox* box = getOptionsBox();
|
||||
int rows = optionsSizer->GetEffectiveRowsCount();
|
||||
|
||||
m_checkAsItems = new wxCheckBox( box, wxID_ANY, _( "Print according to objects tab of "
|
||||
"appearance manager" ) );
|
||||
optionsSizer->Add( m_checkAsItems, wxGBPosition( rows++, 0 ), wxGBSpan( 1, 2 ),
|
||||
wxLEFT|wxRIGHT|wxBOTTOM, 5 );
|
||||
m_checkAsItems = new wxCheckBox( box, wxID_ANY, _( "Print according to objects tab of appearance manager" ) );
|
||||
optionsSizer->Add( m_checkAsItems, wxGBPosition( rows++, 0 ), wxGBSpan( 1, 2 ), wxLEFT|wxRIGHT|wxBOTTOM, 5 );
|
||||
|
||||
m_checkBackground = new wxCheckBox( box, wxID_ANY, _( "Print background color" ) );
|
||||
optionsSizer->Add( m_checkBackground, wxGBPosition( rows++, 0 ), wxGBSpan( 1, 2 ),
|
||||
wxLEFT|wxRIGHT|wxBOTTOM, 5 );
|
||||
optionsSizer->Add( m_checkBackground, wxGBPosition( rows++, 0 ), wxGBSpan( 1, 2 ), wxLEFT|wxRIGHT|wxBOTTOM, 5 );
|
||||
|
||||
m_checkUseTheme = new wxCheckBox( box, wxID_ANY, _( "Use a different color theme for "
|
||||
"printing:" ) );
|
||||
optionsSizer->Add( m_checkUseTheme, wxGBPosition( rows++, 0 ), wxGBSpan( 1, 2 ),
|
||||
wxLEFT|wxRIGHT, 5 );
|
||||
m_checkUseTheme = new wxCheckBox( box, wxID_ANY, _( "Use a different color theme for printing:" ) );
|
||||
optionsSizer->Add( m_checkUseTheme, wxGBPosition( rows++, 0 ), wxGBSpan( 1, 2 ), wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_checkUseTheme->Bind( wxEVT_COMMAND_CHECKBOX_CLICKED,
|
||||
&DIALOG_PRINT_PCBNEW::onUseThemeClicked, this );
|
||||
m_checkUseTheme->Bind( wxEVT_COMMAND_CHECKBOX_CLICKED, &DIALOG_PRINT_PCBNEW::onUseThemeClicked, this );
|
||||
|
||||
wxArrayString choices;
|
||||
m_colorTheme = new wxChoice( box, wxID_ANY, wxDefaultPosition, wxDefaultSize, choices, 0 );
|
||||
@ -263,16 +253,12 @@ void DIALOG_PRINT_PCBNEW::createExtraOptions()
|
||||
// Pagination
|
||||
m_checkboxPagePerLayer = new wxCheckBox( box, wxID_ANY, _( "Print one page per layer" ) );
|
||||
|
||||
m_checkboxPagePerLayer->Bind( wxEVT_COMMAND_CHECKBOX_CLICKED,
|
||||
&DIALOG_PRINT_PCBNEW::onPagePerLayerClicked, this );
|
||||
m_checkboxPagePerLayer->Bind( wxEVT_COMMAND_CHECKBOX_CLICKED, &DIALOG_PRINT_PCBNEW::onPagePerLayerClicked, this );
|
||||
|
||||
m_checkboxEdgesOnAllPages = new wxCheckBox( box, wxID_ANY,
|
||||
_( "Print board edges on all pages" ) );
|
||||
m_checkboxEdgesOnAllPages = new wxCheckBox( box, wxID_ANY, _( "Print board edges on all pages" ) );
|
||||
|
||||
optionsSizer->Add( m_checkboxPagePerLayer, wxGBPosition( rows++, 0 ), wxGBSpan( 1, 2 ),
|
||||
wxLEFT|wxRIGHT, 5 );
|
||||
optionsSizer->Add( m_checkboxEdgesOnAllPages, wxGBPosition( rows++, 0 ), wxGBSpan( 1, 2 ),
|
||||
wxLEFT, 28 );
|
||||
optionsSizer->Add( m_checkboxPagePerLayer, wxGBPosition( rows++, 0 ), wxGBSpan( 1, 2 ), wxLEFT|wxRIGHT, 5 );
|
||||
optionsSizer->Add( m_checkboxEdgesOnAllPages, wxGBPosition( rows++, 0 ), wxGBSpan( 1, 2 ), wxLEFT, 28 );
|
||||
}
|
||||
|
||||
|
||||
@ -289,20 +275,11 @@ void DIALOG_PRINT_PCBNEW::createLeftPanel()
|
||||
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 ) );
|
||||
|
||||
m_popMenu->Append( new wxMenuItem( m_popMenu, ID_SELECT_COPPER_LAYERS,
|
||||
_( "Select all Copper Layers" ), wxEmptyString ) );
|
||||
|
||||
m_popMenu->Append( new wxMenuItem( m_popMenu, ID_DESELECT_COPPER_LAYERS,
|
||||
_( "Deselect all Copper Layers" ), wxEmptyString ) );
|
||||
|
||||
m_popMenu->Append( new wxMenuItem( m_popMenu, ID_SELECT_ALL_LAYERS,
|
||||
_( "Select all Layers" ), wxEmptyString ) );
|
||||
|
||||
m_popMenu->Append( new wxMenuItem( m_popMenu, ID_DESELECT_ALL_LAYERS,
|
||||
_( "Deselect all Layers" ), wxEmptyString ) );
|
||||
m_popMenu->Append( new wxMenuItem( m_popMenu, ID_SELECT_FAB_LAYERS, _( "Select Fab Layers" ) ) );
|
||||
m_popMenu->Append( new wxMenuItem( m_popMenu, ID_SELECT_COPPER_LAYERS, _( "Select all Copper Layers" ) ) );
|
||||
m_popMenu->Append( new wxMenuItem( m_popMenu, ID_DESELECT_COPPER_LAYERS, _( "Deselect all Copper Layers" ) ) );
|
||||
m_popMenu->Append( new wxMenuItem( m_popMenu, ID_SELECT_ALL_LAYERS, _( "Select all Layers" ) ) );
|
||||
m_popMenu->Append( new wxMenuItem( m_popMenu, ID_DESELECT_ALL_LAYERS, _( "Deselect all Layers" ) ) );
|
||||
|
||||
this->Bind( wxEVT_RIGHT_DOWN,
|
||||
[&]( wxMouseEvent& aEvent )
|
||||
|
Loading…
x
Reference in New Issue
Block a user