Refactored and unified board editor and footprint editor print dialogs

This commit is contained in:
Maciej Suminski 2018-10-03 09:50:05 +02:00
parent 562b8d7948
commit e81c3a59a2
15 changed files with 917 additions and 1764 deletions

View File

@ -132,28 +132,27 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa
}
double scale = m_PrintParams.m_PrintScale;
if( m_PrintParams.m_PrintScale == 0.0 )
{
// Fit to page
double scaleX = m_sheetSize.GetWidth() / bBox.GetWidth();
double scaleY = m_sheetSize.GetHeight() / bBox.GetHeight();
scale = std::min( scaleX, scaleY );
}
else if( m_PrintParams.m_PrintScale == 1.0 )
if( m_PrintParams.m_PrintScale <= 0.0 )
{
// TODO "accurate scale" that allows the user to specify custom scale
// I think it should be renamed to "custom scale", and "approx. scale 1" should be replaced with "Scale 1"
// TODO do not separate X and Y scale adjustments
scale = m_PrintParams.m_XScaleAdjust;
if( bBox.GetWidth() == 0 || bBox.GetHeight() == 0 )
{
// Nothing to print
m_PrintParams.m_PrintScale = 1.0;
}
else
{
double scaleX = (double) m_sheetSize.GetWidth() / bBox.GetWidth();
double scaleY = (double) m_sheetSize.GetHeight() / bBox.GetHeight();
m_PrintParams.m_PrintScale = std::min( scaleX, scaleY );
}
}
setupGal( gal );
galPrint->SetNativePaperSize( pageSizeIn, printCtx->HasNativeLandscapeRotation() );
gal->SetFlip( m_PrintParams.m_PrintMirror, false );
gal->SetLookAtPoint( bBox.Centre() );
gal->SetZoomFactor( scale );
gal->SetZoomFactor( m_PrintParams.m_PrintScale );
{
KIGFX::GAL_DRAWING_CONTEXT ctx( gal );

View File

@ -85,6 +85,11 @@ public:
const COLOR4D& GetBackgroundColor() override { return m_layerColors[ LAYER_SCHEMATIC_BACKGROUND ]; }
void SetBackgroundColor( const COLOR4D& aColor ) override
{
m_layerColors[ LAYER_SCHEMATIC_BACKGROUND ] = aColor;
}
const COLOR4D& GetGridColor() override { return m_layerColors[ LAYER_SCHEMATIC_GRID ]; }
const COLOR4D& GetCursorColor() override { return m_layerColors[ LAYER_SCHEMATIC_CURSOR ]; }

View File

@ -89,6 +89,11 @@ public:
const COLOR4D& GetBackgroundColor() override { return m_layerColors[ LAYER_PCB_BACKGROUND ]; }
void SetBackgroundColor( const COLOR4D& aColor ) override
{
m_layerColors[ LAYER_PCB_BACKGROUND ] = aColor;
}
const COLOR4D& GetGridColor() override { return m_layerColors[ LAYER_GRID ]; }
const COLOR4D& GetCursorColor() override { return m_layerColors[ LAYER_CURSOR ]; }

View File

@ -194,6 +194,11 @@ public:
*/
virtual const COLOR4D& GetBackgroundColor() = 0;
/**
* Sets the background color.
*/
virtual void SetBackgroundColor( const COLOR4D& aColor ) = 0;
/**
* Function GetGridColor
* Returns current grid color settings.

View File

@ -129,10 +129,8 @@ set( PCBNEW_DIALOGS
dialogs/dialog_pns_settings_base.cpp
dialogs/dialog_position_relative.cpp
dialogs/dialog_position_relative_base.cpp
dialogs/dialog_print_for_modedit.cpp
dialogs/dialog_print_for_modedit_base.cpp
dialogs/dialog_print_using_printer.cpp
dialogs/dialog_print_using_printer_base.cpp
dialogs/dialog_print_pcbnew.cpp
dialogs/dialog_print_pcbnew_base.cpp
dialogs/dialog_select_net_from_list.cpp
dialogs/dialog_select_net_from_list_base.cpp
dialogs/dialog_set_grid.cpp

View File

@ -1,255 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010-2014 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
* Copyright (C) 1992-2015 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 Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* File: dialog_print_for_modedit.cpp */
#include <fctsys.h>
#include <kiface_i.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <pcbnew.h>
#include <pcb_edit_frame.h>
#include <footprint_edit_frame.h>
#include <pcbplot.h>
#include <dialog_print_for_modedit_base.h>
#include <pcbnew_printout.h>
#include <enabler.h>
static double s_scaleList[] =
{ 0, 0.5, 0.7, 1.0, 1.4, 2.0, 3.0, 4.0, 8.0, 16.0 };
// static print data and page setup data, to remember settings during the session
static PRINT_PARAMETERS s_Parameters;
static wxPrintData* s_PrintData;
static wxPageSetupDialogData* s_pageSetupData = (wxPageSetupDialogData*) NULL;
/**
* Class DIALOG_PRINT_FOR_MODEDIT
* is derived from DIALOG_PRINT_FOR_MODEDIT_BASE which is created by wxFormBuilder.
*/
class DIALOG_PRINT_FOR_MODEDIT : public DIALOG_PRINT_FOR_MODEDIT_BASE
{
public:
DIALOG_PRINT_FOR_MODEDIT( PCB_BASE_FRAME* parent );
private:
PCB_BASE_FRAME* m_parent;
wxConfigBase* m_config;
void OnCloseWindow( wxCloseEvent& event ) override;
/// Open a dialog box for printer setup (printer options, page size ...)
void OnPageSetup( wxCommandEvent& event ) override;
void OnPrintPreview( wxCommandEvent& event ) override;
/// Called on activate Print button
void OnPrintButtonClick( wxCommandEvent& event ) override;
void OnButtonCancelClick( wxCommandEvent& event ) override { Close(); }
void OnInitDlg( wxInitDialogEvent& event )
{
// Call the default wxDialog handler of a wxInitDialogEvent
TransferDataToWindow();
// Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings();
}
void InitValues( );
PCBNEW_PRINTOUT* createPrintout( const wxString& aTitle )
{
return new PCBNEW_PRINTOUT( m_parent->GetBoard(), s_Parameters,
m_parent->GetGalCanvas()->GetView(), m_parent->GetPageSettings().GetSizeIU(), aTitle );
}
};
void FOOTPRINT_EDIT_FRAME::ToPrinter( wxCommandEvent& event )
{
const PAGE_INFO& pageInfo = GetPageSettings();
if( s_PrintData == NULL ) // First print
{
s_PrintData = new wxPrintData();
if( !s_PrintData->Ok() )
{
DisplayError( this, _( "An error occurred initializing the printer information." ) );
}
s_PrintData->SetQuality( wxPRINT_QUALITY_HIGH ); // Default resolution = HIGH;
}
if( s_pageSetupData == NULL )
s_pageSetupData = new wxPageSetupDialogData( *s_PrintData );
s_pageSetupData->SetPaperId( pageInfo.GetPaperId() );
s_pageSetupData->GetPrintData().SetOrientation( pageInfo.GetWxOrientation() );
s_PrintData->SetOrientation( pageInfo.GetWxOrientation() );
*s_PrintData = s_pageSetupData->GetPrintData();
s_Parameters.m_PageSetupData = s_pageSetupData;
DIALOG_PRINT_FOR_MODEDIT dlg( this );
dlg.ShowModal();
}
DIALOG_PRINT_FOR_MODEDIT::DIALOG_PRINT_FOR_MODEDIT( PCB_BASE_FRAME* parent ) :
DIALOG_PRINT_FOR_MODEDIT_BASE( parent )
{
m_parent = parent;
s_Parameters.m_ForceCentered = true;
m_config = Kiface().KifaceSettings();
InitValues();
m_buttonPrint->SetDefault();
GetSizer()->SetSizeHints( this );
GetSizer()->Fit( this ); // Needed on Ubuntu/Unity to display the dialog
}
void DIALOG_PRINT_FOR_MODEDIT::InitValues( )
{
// Read the scale adjust option
int scale_Select = 3; // default selected scale = ScaleList[3] = 1
if( m_config )
{
m_config->Read( OPTKEY_PRINT_MODULE_SCALE, &scale_Select );
m_config->Read( OPTKEY_PRINT_MONOCHROME_MODE, &s_Parameters.m_Print_Black_and_White, 1);
}
s_Parameters.m_PenDefaultSize = g_DrawDefaultLineThickness;
m_ScaleOption->SetSelection( scale_Select );
if( s_Parameters.m_Print_Black_and_White )
m_ModeColorOption->SetSelection( 1 );
}
void DIALOG_PRINT_FOR_MODEDIT::OnCloseWindow( wxCloseEvent& event )
{
if( m_config )
{
m_config->Write( OPTKEY_PRINT_MODULE_SCALE, m_ScaleOption->GetSelection() );
m_config->Write( OPTKEY_PRINT_MONOCHROME_MODE, s_Parameters.m_Print_Black_and_White );
}
EndModal( 0 );
}
void DIALOG_PRINT_FOR_MODEDIT::OnPageSetup( wxCommandEvent& event )
{
wxPageSetupDialog pageSetupDialog( this, s_pageSetupData );
pageSetupDialog.ShowModal();
(*s_PrintData) = pageSetupDialog.GetPageSetupDialogData().GetPrintData();
(*s_pageSetupData) = pageSetupDialog.GetPageSetupDialogData();
}
void DIALOG_PRINT_FOR_MODEDIT::OnPrintPreview( wxCommandEvent& event )
{
s_Parameters.m_Print_Black_and_White = m_ModeColorOption->GetSelection();
s_Parameters.m_PrintScale = s_scaleList[m_ScaleOption->GetSelection()];
// Pass two printout objects: for preview, and possible printing.
wxString title = _( "Print Preview" );
wxPrintPreview* preview =
new wxPrintPreview( createPrintout( title ), createPrintout( title ), s_PrintData );
if( preview == NULL )
{
DisplayError( this, wxT( "OnPrintPreview() problem" ) );
return;
}
// Uses the parent position and size.
// @todo uses last position and size ans store them when exit in m_config
wxPoint WPos = m_parent->GetPosition();
wxSize WSize = m_parent->GetSize();
wxPreviewFrame* frame = new wxPreviewFrame( preview, this, title, WPos, WSize );
frame->SetMinSize( wxSize( 550, 350 ) );
// On wxGTK, set the flag wxTOPLEVEL_EX_DIALOG is mandatory, if we want
// close the frame using the X box in caption, when the preview frame is run
// from a dialog
frame->SetExtraStyle( frame->GetExtraStyle() | wxTOPLEVEL_EX_DIALOG );
// We use here wxPreviewFrame_WindowModal option to make the wxPrintPreview frame
// modal for its caller only.
// An other reason is the fact when closing the frame without this option,
// all top level frames are reenabled.
// With this option, only the parent is reenabled.
// Reenabling all top level frames should be made by the parent dialog.
frame->InitializeWithModality( wxPreviewFrame_WindowModal );
frame->Raise(); // Needed on Ubuntu/Unity to display the frame
frame->Show( true );
}
void DIALOG_PRINT_FOR_MODEDIT::OnPrintButtonClick( wxCommandEvent& event )
{
PCB_PLOT_PARAMS plot_opts = m_parent->GetPlotSettings();
s_Parameters.m_Print_Black_and_White = m_ModeColorOption->GetSelection();
s_Parameters.m_PrintScale = s_scaleList[m_ScaleOption->GetSelection()];
plot_opts.SetFineScaleAdjustX( s_Parameters.m_XScaleAdjust );
plot_opts.SetFineScaleAdjustY( s_Parameters.m_YScaleAdjust );
plot_opts.SetScale( s_Parameters.m_PrintScale );
m_parent->SetPlotSettings( plot_opts );
wxPrintDialogData printDialogData( *s_PrintData );
wxPrinter printer( &printDialogData );
auto printout = std::unique_ptr<PCBNEW_PRINTOUT>( createPrintout( _( "Print Footprint" ) ) );
// Disable 'Print' button to prevent issuing another print
// command before the previous one is finished (causes problems on Windows)
ENABLER printBtnDisable( *m_buttonPrint, false );
if( !printer.Print( this, printout.get(), true ) )
{
if( wxPrinter::GetLastError() == wxPRINTER_ERROR )
DisplayError( this, _( "There was a problem printing." ) );
}
else
{
*s_PrintData = printer.GetPrintDialogData().GetPrintData();
}
}

View File

@ -1,87 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 19 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_print_for_modedit_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_PRINT_FOR_MODEDIT_BASE::DIALOG_PRINT_FOR_MODEDIT_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( wxSize( -1,-1 ), wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bmiddleLeftSizer;
bmiddleLeftSizer = new wxBoxSizer( wxVERTICAL );
wxString m_ScaleOptionChoices[] = { _("Fit to page"), _("Scale 0.5"), _("Scale 0.7"), _("Scale 1"), _("Scale 1.4"), _("Scale 2"), _("Scale 3"), _("Scale 4"), _("Scale 8"), _("Scale 16") };
int m_ScaleOptionNChoices = sizeof( m_ScaleOptionChoices ) / sizeof( wxString );
m_ScaleOption = new wxRadioBox( this, wxID_ANY, _("Approximate Scale:"), wxDefaultPosition, wxDefaultSize, m_ScaleOptionNChoices, m_ScaleOptionChoices, 1, wxRA_SPECIFY_COLS );
m_ScaleOption->SetSelection( 0 );
bmiddleLeftSizer->Add( m_ScaleOption, 0, wxALL, 5 );
bMainSizer->Add( bmiddleLeftSizer, 0, wxEXPAND, 5 );
wxBoxSizer* bmiddleRightSizer;
bmiddleRightSizer = new wxBoxSizer( wxVERTICAL );
wxString m_ModeColorOptionChoices[] = { _("Color"), _("Black and white") };
int m_ModeColorOptionNChoices = sizeof( m_ModeColorOptionChoices ) / sizeof( wxString );
m_ModeColorOption = new wxRadioBox( this, wxID_PRINT_MODE, _("Print Mode:"), wxDefaultPosition, wxDefaultSize, m_ModeColorOptionNChoices, m_ModeColorOptionChoices, 1, wxRA_SPECIFY_COLS );
m_ModeColorOption->SetSelection( 0 );
m_ModeColorOption->SetToolTip( _("Choose if you want to draw the sheet like it appears on screen,\nor in black and white mode, better to print it when using black and white printers") );
bmiddleRightSizer->Add( m_ModeColorOption, 0, wxALL|wxEXPAND, 5 );
bMainSizer->Add( bmiddleRightSizer, 1, 0, 5 );
wxBoxSizer* bbuttonsSizer;
bbuttonsSizer = new wxBoxSizer( wxVERTICAL );
m_buttonOption = new wxButton( this, wxID_PRINT_OPTIONS, _("Page Options"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonOption, 0, wxALL|wxEXPAND, 5 );
m_buttonPreview = new wxButton( this, wxID_PREVIEW, _("Preview"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonPreview, 0, wxALL|wxEXPAND, 5 );
m_buttonPrint = new wxButton( this, wxID_PRINT_ALL, _("Print"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonPrint, 0, wxALL|wxEXPAND, 5 );
m_buttonQuit = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonQuit, 0, wxALL|wxEXPAND, 5 );
bMainSizer->Add( bbuttonsSizer, 0, 0, 5 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
this->Centre( wxBOTH );
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnCloseWindow ) );
m_buttonOption->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnPageSetup ), NULL, this );
m_buttonPreview->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnPrintPreview ), NULL, this );
m_buttonPrint->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnPrintButtonClick ), NULL, this );
m_buttonQuit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnButtonCancelClick ), NULL, this );
}
DIALOG_PRINT_FOR_MODEDIT_BASE::~DIALOG_PRINT_FOR_MODEDIT_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnCloseWindow ) );
m_buttonOption->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnPageSetup ), NULL, this );
m_buttonPreview->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnPrintPreview ), NULL, this );
m_buttonPrint->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnPrintButtonClick ), NULL, this );
m_buttonQuit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnButtonCancelClick ), NULL, this );
}

View File

@ -1,665 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="13" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_php_events">0</property>
<property name="disconnect_python_events">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">dialog_print_for_modedit_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">DialogPrintModedit_base</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="center">wxBOTH</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="extra_style"></property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size">-1,-1</property>
<property name="name">DIALOG_PRINT_FOR_MODEDIT_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Print</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnActivate"></event>
<event name="OnActivateApp"></event>
<event name="OnAuiFindManager"></event>
<event name="OnAuiPaneButton"></event>
<event name="OnAuiPaneClose"></event>
<event name="OnAuiPaneMaximize"></event>
<event name="OnAuiPaneRestore"></event>
<event name="OnAuiRender"></event>
<event name="OnChar"></event>
<event name="OnClose">OnCloseWindow</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnHibernate"></event>
<event name="OnIconize"></event>
<event name="OnIdle"></event>
<event name="OnInitDialog"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bMainSizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bmiddleLeftSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<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">&quot;Fit to page&quot; &quot;Scale 0.5&quot; &quot;Scale 0.7&quot; &quot;Scale 1&quot; &quot;Scale 1.4&quot; &quot;Scale 2&quot; &quot;Scale 3&quot; &quot;Scale 4&quot; &quot;Scale 8&quot; &quot;Scale 16&quot;</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">Approximate Scale:</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_ScaleOption</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"></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>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRadioBox"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag"></property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bmiddleRightSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</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">&quot;Color&quot; &quot;Black and white&quot;</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_PRINT_MODE</property>
<property name="label">Print Mode:</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_ModeColorOption</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"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Choose if you want to draw the sheet like it appears on screen,&#x0A;or in black and white mode, better to print it when using black and white printers</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>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRadioBox"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag"></property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bbuttonsSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" 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">0</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_PRINT_OPTIONS</property>
<property name="label">Page Options</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_buttonOption</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"></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>
<event name="OnButtonClick">OnPageSetup</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" 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">0</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_PREVIEW</property>
<property name="label">Preview</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_buttonPreview</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"></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>
<event name="OnButtonClick">OnPrintPreview</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" 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">0</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_PRINT_ALL</property>
<property name="label">Print</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_buttonPrint</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"></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>
<event name="OnButtonClick">OnPrintButtonClick</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" 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">0</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_CANCEL</property>
<property name="label">Close</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_buttonQuit</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"></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>
<event name="OnButtonClick">OnButtonCancelClick</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>

View File

@ -1,64 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 19 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_PRINT_FOR_MODEDIT_BASE_H__
#define __DIALOG_PRINT_FOR_MODEDIT_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/radiobox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_PRINT_FOR_MODEDIT_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_PRINT_FOR_MODEDIT_BASE : public DIALOG_SHIM
{
private:
protected:
enum
{
wxID_PRINT_MODE = 1000,
wxID_PRINT_OPTIONS,
wxID_PRINT_ALL
};
wxRadioBox* m_ScaleOption;
wxRadioBox* m_ModeColorOption;
wxButton* m_buttonOption;
wxButton* m_buttonPreview;
wxButton* m_buttonPrint;
wxButton* m_buttonQuit;
// Virtual event handlers, overide them in your derived class
virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); }
virtual void OnPageSetup( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPrintPreview( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPrintButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnButtonCancelClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_PRINT_FOR_MODEDIT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Print"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PRINT_FOR_MODEDIT_BASE();
};
#endif //__DIALOG_PRINT_FOR_MODEDIT_BASE_H__

View File

@ -3,6 +3,8 @@
*
* Copyright (C) 2010-2016 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2018 CERN
* Author: Maciej Suminski <maciej.suminski@cern.ch>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -27,18 +29,20 @@
#include <class_drawpanel.h>
#include <confirm.h>
#include <pcb_edit_frame.h>
#include <footprint_edit_frame.h>
#include <base_units.h>
#include <pcbnew_printout.h>
#include <pcbnew.h>
#include <pcbplot.h>
#include <class_board.h>
#include <enabler.h>
#include <wx/valnum.h>
#include <widgets/unit_binder.h>
#include <tool/tool_manager.h>
#include <tools/pcb_actions.h>
#include <dialog_print_using_printer_base.h>
#include <dialog_print_pcbnew_base.h>
#define PEN_WIDTH_MAX_VALUE ( KiROUND( 5 * IU_PER_MM ) )
#define PEN_WIDTH_MIN_VALUE ( KiROUND( 0.005 * IU_PER_MM ) )
@ -46,10 +50,7 @@
extern int g_DrawDefaultLineThickness;
// Local variables
static double s_ScaleList[] = { 0, 0.5, 0.7, 0.999, 1.0, 1.4, 2.0, 3.0, 4.0 };
// Define min et max reasonable values for print scale
// Define min and max reasonable values for print scale
#define MIN_SCALE 0.01
#define MAX_SCALE 100.0
@ -61,30 +62,50 @@ static PRINT_PARAMETERS s_Parameters;
/**
* Dialog to print schematic. Class derived from DIALOG_PRINT_USING_PRINTER_BASE
* Dialog to print schematic. Class derived from DIALOG_PRINT_PCBNEW_BASE
* created by wxFormBuilder
*/
class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_BASE
class DIALOG_PRINT_PCBNEW : public DIALOG_PRINT_PCBNEW_BASE
{
public:
DIALOG_PRINT_USING_PRINTER( PCB_EDIT_FRAME* parent );
~DIALOG_PRINT_USING_PRINTER() override;
DIALOG_PRINT_PCBNEW( PCB_BASE_EDIT_FRAME* parent );
~DIALOG_PRINT_PCBNEW() override;
/**
* Set 'print border and title block' to a requested value and hides the
* corresponding checkbox.
*/
void ForcePrintBorder( bool aValue )
{
m_Print_Sheet_Ref->SetValue( aValue );
m_Print_Sheet_Ref->Hide();
}
private:
PCB_EDIT_FRAME* m_parent;
PCB_BASE_EDIT_FRAME* m_parent;
wxConfigBase* m_config;
// the list of existing board layers in wxCheckListBox, with the board layers id:
std::pair<wxCheckListBox*, int> m_layers[PCB_LAYER_ID_COUNT];
static bool m_ExcludeEdgeLayer;
wxFloatingPointValidator<double> m_scaleValidator;
UNIT_BINDER m_defaultPenWidth;
bool TransferDataToWindow() override;
void OnSelectAllClick( wxCommandEvent& event ) override;
void OnDeselectAllClick( wxCommandEvent& event ) override;
void OnSetCustomScale( wxCommandEvent& event ) override;
void OnPageSetup( wxCommandEvent& event ) override;
void OnPrintPreview( wxCommandEvent& event ) override;
void OnPrintButtonClick( wxCommandEvent& event ) override;
void OnScaleSelectionClick( wxCommandEvent& event ) override;
///> (Un)checks all items in a checklist box
void setListBoxValue( wxCheckListBox* aList, bool aValue )
{
for( int i = 0; i < aList->GetCount(); ++i )
aList->Check( i, aValue );
}
void SetPrintParameters();
int SetLayerSetFromListSelection();
@ -94,55 +115,71 @@ private:
return new PCBNEW_PRINTOUT( m_parent->GetBoard(), s_Parameters,
m_parent->GetGalCanvas()->GetView(), m_parent->GetPageSettings().GetSizeIU(), aTitle );
}
/**
* Select a corresponing scale radio button and update custom scale value if needed.
* @param aValue is the scale value to be selected (0 stands for fit-to-page).
*/
void setScaleValue( double aValue ) const
{
wxASSERT( aValue >= 0.0 );
if( aValue == 0.0 )
{
m_scaleFit->SetValue( true );
}
else if( aValue == 1.0 )
{
m_scale1->SetValue( true );
}
else
{
if( aValue > MAX_SCALE )
{
DisplayInfoMessage( NULL,
_( "Warning: Scale option set to a very large value" ) );
}
if( aValue < MIN_SCALE )
{
DisplayInfoMessage( NULL,
_( "Warning: Scale option set to a very small value" ) );
}
m_scaleCustom->SetValue( true );
m_scaleCustomText->SetValue( wxString::Format( wxT( "%f" ), aValue ) );
}
}
/**
* Return scale value selected in the dialog.
*/
double getScaleValue() const
{
if( m_scale1->GetValue() )
return 1.0;
if( m_scaleFit->GetValue() )
return 0.0;
if( m_scaleCustom->GetValue() )
{
double scale;
wxCHECK( m_scaleCustomText->GetValue().ToDouble( &scale ), 1.0 );
return scale;
}
wxCHECK( false, 1.0 );
}
};
bool DIALOG_PRINT_USING_PRINTER::m_ExcludeEdgeLayer;
bool DIALOG_PRINT_PCBNEW::m_ExcludeEdgeLayer;
void PCB_EDIT_FRAME::ToPrinter( wxCommandEvent& event )
{
// Selection affects the original item visibility
GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true );
const PAGE_INFO& pageInfo = GetPageSettings();
if( s_PrintData == NULL ) // First print
{
s_PrintData = new wxPrintData();
if( !s_PrintData->Ok() )
DisplayError( this, _( "Error Init Printer info" ) );
s_PrintData->SetQuality( wxPRINT_QUALITY_HIGH ); // Default resolution = HIGH;
}
if( s_pageSetupData == NULL )
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( Mils2mm( pageInfo.GetWidthMils() ),
Mils2mm( pageInfo.GetHeightMils() ) ) );
else
s_pageSetupData->SetPaperSize( wxSize( Mils2mm( pageInfo.GetHeightMils() ),
Mils2mm( pageInfo.GetWidthMils() ) ) );
}
*s_PrintData = s_pageSetupData->GetPrintData();
DIALOG_PRINT_USING_PRINTER dlg( this );
dlg.ShowModal();
}
DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( PCB_EDIT_FRAME* parent ) :
DIALOG_PRINT_USING_PRINTER_BASE( parent ),
DIALOG_PRINT_PCBNEW::DIALOG_PRINT_PCBNEW( PCB_BASE_EDIT_FRAME* parent ) :
DIALOG_PRINT_PCBNEW_BASE( parent ),
m_parent( parent ),
m_defaultPenWidth( parent, m_penWidthLabel, m_penWidthCtrl, m_penWidthUnits, true,
PEN_WIDTH_MIN_VALUE, PEN_WIDTH_MAX_VALUE )
@ -150,6 +187,9 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( PCB_EDIT_FRAME* parent )
m_config = Kiface().KifaceSettings();
memset( m_layers, 0, sizeof( m_layers ) );
m_scaleValidator.SetRange( 1e-3, 1e3 );
m_scaleCustomText->SetValidator( m_scaleValidator );
// We use a sdbSizer to get platform-dependent ordering of the action buttons, but
// that requires us to correct the button labels here.
m_sdbSizer1OK->SetLabel( _( "Print" ) );
@ -159,8 +199,9 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( PCB_EDIT_FRAME* parent )
m_sdbSizer1OK->SetDefault();
#ifdef __WXMAC__
/* Problems with modal on wx-2.9 - Anyway preview is standard for OSX */
#if defined(__WXMAC__) or defined(__WXGTK__)
// Preview does not work well on GTK or Mac,
// but these platforms provide native print preview
m_sdbSizer1Apply->Hide();
#endif
@ -168,15 +209,13 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( PCB_EDIT_FRAME* parent )
}
DIALOG_PRINT_USING_PRINTER::~DIALOG_PRINT_USING_PRINTER()
DIALOG_PRINT_PCBNEW::~DIALOG_PRINT_PCBNEW()
{
SetPrintParameters();
if( m_config )
{
ConfigBaseWriteDouble( m_config, OPTKEY_PRINT_X_FINESCALE_ADJ, s_Parameters.m_XScaleAdjust );
ConfigBaseWriteDouble( m_config, OPTKEY_PRINT_Y_FINESCALE_ADJ, s_Parameters.m_YScaleAdjust );
m_config->Write( OPTKEY_PRINT_SCALE, m_ScaleOption->GetSelection() );
m_config->Write( OPTKEY_PRINT_SCALE, getScaleValue() );
m_config->Write( OPTKEY_PRINT_PAGE_FRAME, s_Parameters.m_Print_Sheet_Ref);
m_config->Write( OPTKEY_PRINT_MONOCHROME_MODE, s_Parameters.m_Print_Black_and_White);
m_config->Write( OPTKEY_PRINT_PAGE_PER_LAYER, s_Parameters.m_OptionPrintPage );
@ -195,7 +234,7 @@ DIALOG_PRINT_USING_PRINTER::~DIALOG_PRINT_USING_PRINTER()
}
bool DIALOG_PRINT_USING_PRINTER::TransferDataToWindow()
bool DIALOG_PRINT_PCBNEW::TransferDataToWindow()
{
wxString msg;
BOARD* board = m_parent->GetBoard();
@ -234,29 +273,21 @@ bool DIALOG_PRINT_USING_PRINTER::TransferDataToWindow()
m_Exclude_Edges_Pcb->Show( true );
// Read the scale adjust option
int scale_idx = 4; // default selected scale = ScaleList[4] = 1.000
double scale = 1.0;
if( m_config )
{
m_config->Read( OPTKEY_PRINT_X_FINESCALE_ADJ, &s_Parameters.m_XScaleAdjust );
m_config->Read( OPTKEY_PRINT_Y_FINESCALE_ADJ, &s_Parameters.m_YScaleAdjust );
m_config->Read( OPTKEY_PRINT_SCALE, &scale_idx );
m_config->Read( OPTKEY_PRINT_SCALE, &scale );
m_config->Read( OPTKEY_PRINT_PAGE_FRAME, &s_Parameters.m_Print_Sheet_Ref, 1);
m_config->Read( OPTKEY_PRINT_MONOCHROME_MODE, &s_Parameters.m_Print_Black_and_White, 1);
m_config->Read( OPTKEY_PRINT_PAGE_PER_LAYER, &s_Parameters.m_OptionPrintPage, 0);
int tmp;
m_config->Read( OPTKEY_PRINT_PADS_DRILL, &tmp, PRINT_PARAMETERS::SMALL_DRILL_SHAPE );
s_Parameters.m_DrillShapeOpt = (PRINT_PARAMETERS::DrillShapeOptT) tmp;
// Test for a reasonable scale value. Set to 1 if problem
if( s_Parameters.m_XScaleAdjust < MIN_SCALE || s_Parameters.m_XScaleAdjust > MAX_SCALE ||
s_Parameters.m_YScaleAdjust < MIN_SCALE || s_Parameters.m_YScaleAdjust > MAX_SCALE )
s_Parameters.m_XScaleAdjust = s_Parameters.m_YScaleAdjust = 1.0;
}
m_ScaleOption->SetSelection( scale_idx );
scale_idx = m_ScaleOption->GetSelection();
s_Parameters.m_PrintScale = s_ScaleList[scale_idx];
setScaleValue( scale );
s_Parameters.m_PrintScale = getScaleValue();
m_Print_Mirror->SetValue(s_Parameters.m_PrintMirror);
m_Exclude_Edges_Pcb->SetValue(m_ExcludeEdgeLayer);
m_Print_Sheet_Ref->SetValue( s_Parameters.m_Print_Sheet_Ref );
@ -266,26 +297,18 @@ bool DIALOG_PRINT_USING_PRINTER::TransferDataToWindow()
m_outputMode->SetSelection( s_Parameters.m_Print_Black_and_White ? 1 : 0 );
m_PagesOption->SetSelection(s_Parameters.m_OptionPrintPage);
m_PagesOption->SetSelection( s_Parameters.m_OptionPrintPage );
s_Parameters.m_PenDefaultSize = g_DrawDefaultLineThickness;
m_defaultPenWidth.SetValue( s_Parameters.m_PenDefaultSize );
// Create scale adjust option
msg.Printf( wxT( "%f" ), s_Parameters.m_XScaleAdjust );
m_FineAdjustXscaleOpt->SetValue( msg );
msg.Printf( wxT( "%f" ), s_Parameters.m_YScaleAdjust );
m_FineAdjustYscaleOpt->SetValue( msg );
bool enable = ( s_Parameters.m_PrintScale == 1.0 );
m_FineAdjustXscaleOpt->Enable(enable);
m_FineAdjustYscaleOpt->Enable(enable);
// Update the layout when layers are added
GetSizer()->Fit( this );
return true;
}
int DIALOG_PRINT_USING_PRINTER::SetLayerSetFromListSelection()
int DIALOG_PRINT_PCBNEW::SetLayerSetFromListSelection()
{
int page_count = 0;
@ -313,7 +336,7 @@ int DIALOG_PRINT_USING_PRINTER::SetLayerSetFromListSelection()
}
void DIALOG_PRINT_USING_PRINTER::SetPrintParameters()
void DIALOG_PRINT_PCBNEW::SetPrintParameters()
{
PCB_PLOT_PARAMS plot_opts = m_parent->GetPlotSettings();
@ -328,30 +351,9 @@ void DIALOG_PRINT_USING_PRINTER::SetPrintParameters()
SetLayerSetFromListSelection();
int idx = m_ScaleOption->GetSelection();
s_Parameters.m_PrintScale = s_ScaleList[idx];
s_Parameters.m_PrintScale = getScaleValue();
plot_opts.SetScale( s_Parameters.m_PrintScale );
if( m_FineAdjustXscaleOpt )
{
if( s_Parameters.m_XScaleAdjust > MAX_SCALE || s_Parameters.m_YScaleAdjust > MAX_SCALE )
DisplayInfoMessage( NULL, _( "Warning: Scale option set to a very large value" ) );
m_FineAdjustXscaleOpt->GetValue().ToDouble( &s_Parameters.m_XScaleAdjust );
}
if( m_FineAdjustYscaleOpt )
{
// Test for a reasonable scale value
if( s_Parameters.m_XScaleAdjust < MIN_SCALE || s_Parameters.m_YScaleAdjust < MIN_SCALE )
DisplayInfoMessage( NULL, _( "Warning: Scale option set to a very small value" ) );
m_FineAdjustYscaleOpt->GetValue().ToDouble( &s_Parameters.m_YScaleAdjust );
}
plot_opts.SetFineScaleAdjustX( s_Parameters.m_XScaleAdjust );
plot_opts.SetFineScaleAdjustY( s_Parameters.m_YScaleAdjust );
m_parent->SetPlotSettings( plot_opts );
s_Parameters.m_PenDefaultSize = m_defaultPenWidth.GetValue();
@ -359,19 +361,29 @@ void DIALOG_PRINT_USING_PRINTER::SetPrintParameters()
}
void DIALOG_PRINT_USING_PRINTER::OnScaleSelectionClick( wxCommandEvent& event )
void DIALOG_PRINT_PCBNEW::OnSelectAllClick( wxCommandEvent& event )
{
double scale = s_ScaleList[m_ScaleOption->GetSelection()];
bool enable = (scale == 1.0);
if( m_FineAdjustXscaleOpt )
m_FineAdjustXscaleOpt->Enable(enable);
if( m_FineAdjustYscaleOpt )
m_FineAdjustYscaleOpt->Enable(enable);
setListBoxValue( m_CopperLayersList, true );
setListBoxValue( m_TechnicalLayersList, true );
}
void DIALOG_PRINT_USING_PRINTER::OnPageSetup( wxCommandEvent& event )
void DIALOG_PRINT_PCBNEW::OnDeselectAllClick( wxCommandEvent& event )
{
setListBoxValue( m_CopperLayersList, false );
setListBoxValue( m_TechnicalLayersList, false );
}
void DIALOG_PRINT_PCBNEW::OnSetCustomScale( wxCommandEvent& event )
{
// Select 'custom scale' radio button when user types in a value in the
// custom scale text box
m_scaleCustom->SetValue( true );
}
void DIALOG_PRINT_PCBNEW::OnPageSetup( wxCommandEvent& event )
{
wxPageSetupDialog pageSetupDialog( this, s_pageSetupData );
pageSetupDialog.ShowModal();
@ -381,7 +393,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPageSetup( wxCommandEvent& event )
}
void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
void DIALOG_PRINT_PCBNEW::OnPrintPreview( wxCommandEvent& event )
{
SetPrintParameters();
@ -423,7 +435,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
}
void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event )
void DIALOG_PRINT_PCBNEW::OnPrintButtonClick( wxCommandEvent& event )
{
SetPrintParameters();
@ -455,3 +467,57 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event )
*s_PrintData = printer.GetPrintDialogData().GetPrintData();
}
}
void PCB_BASE_EDIT_FRAME::preparePrintout()
{
// Selection affects the original item visibility
GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true );
const PAGE_INFO& pageInfo = GetPageSettings();
if( s_PrintData == NULL ) // First print
{
s_PrintData = new wxPrintData();
if( !s_PrintData->Ok() )
DisplayError( this, _( "An error occurred initializing the printer information." ) );
s_PrintData->SetQuality( wxPRINT_QUALITY_HIGH ); // Default resolution = HIGH;
}
if( s_pageSetupData == NULL )
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( Mils2mm( pageInfo.GetWidthMils() ),
Mils2mm( pageInfo.GetHeightMils() ) ) );
else
s_pageSetupData->SetPaperSize( wxSize( Mils2mm( pageInfo.GetHeightMils() ),
Mils2mm( pageInfo.GetWidthMils() ) ) );
}
*s_PrintData = s_pageSetupData->GetPrintData();
}
void PCB_EDIT_FRAME::ToPrinter( wxCommandEvent& event )
{
preparePrintout();
DIALOG_PRINT_PCBNEW dlg( this );
dlg.ShowModal();
}
void FOOTPRINT_EDIT_FRAME::ToPrinter( wxCommandEvent& event )
{
preparePrintout();
DIALOG_PRINT_PCBNEW dlg( this );
dlg.ForcePrintBorder( false );
dlg.ShowModal();
}

View File

@ -1,15 +1,15 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// C++ code generated with wxFormBuilder (version Oct 17 2016)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_print_using_printer_base.h"
#include "dialog_print_pcbnew_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_PRINT_USING_PRINTER_BASE::DIALOG_PRINT_USING_PRINTER_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
DIALOG_PRINT_PCBNEW_BASE::DIALOG_PRINT_PCBNEW_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( wxSize( -1,-1 ), wxDefaultSize );
@ -54,7 +54,19 @@ DIALOG_PRINT_USING_PRINTER_BASE::DIALOG_PRINT_USING_PRINTER_BASE( wxWindow* pare
bLayerListsSizer->Add( bSizer7, 1, wxEXPAND, 5 );
sbLayersSizer->Add( bLayerListsSizer, 1, wxEXPAND, 5 );
sbLayersSizer->Add( bLayerListsSizer, 1, wxALL|wxEXPAND, 5 );
wxBoxSizer* bSizer9;
bSizer9 = new wxBoxSizer( wxHORIZONTAL );
m_buttonSelectAll = new wxButton( sbLayersSizer->GetStaticBox(), wxID_ANY, _("Select all"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer9->Add( m_buttonSelectAll, 1, wxALL, 5 );
m_buttonDeselectAll = new wxButton( sbLayersSizer->GetStaticBox(), wxID_ANY, _("Deselect all"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer9->Add( m_buttonDeselectAll, 1, wxALL, 5 );
sbLayersSizer->Add( bSizer9, 0, wxEXPAND, 5 );
m_Exclude_Edges_Pcb = new wxCheckBox( sbLayersSizer->GetStaticBox(), wxID_ANY, _("Exclude PCB edge layer"), wxDefaultPosition, wxDefaultSize, 0 );
m_Exclude_Edges_Pcb->SetToolTip( _("Exclude contents of Edges_Pcb layer from all other layers") );
@ -62,37 +74,7 @@ DIALOG_PRINT_USING_PRINTER_BASE::DIALOG_PRINT_USING_PRINTER_BASE( wxWindow* pare
sbLayersSizer->Add( m_Exclude_Edges_Pcb, 0, wxALL|wxEXPAND, 5 );
bUpperSizer->Add( sbLayersSizer, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bScaleSizer;
bScaleSizer = new wxBoxSizer( wxVERTICAL );
wxString m_ScaleOptionChoices[] = { _("Fit to page"), _("Scale 0.5"), _("Scale 0.7"), _("Approx. scale 1"), _("Accurate scale 1"), _("Scale 1.4"), _("Scale 2"), _("Scale 3"), _("Scale 4") };
int m_ScaleOptionNChoices = sizeof( m_ScaleOptionChoices ) / sizeof( wxString );
m_ScaleOption = new wxRadioBox( this, wxID_ANY, _("Approximate Scale"), wxDefaultPosition, wxDefaultSize, m_ScaleOptionNChoices, m_ScaleOptionChoices, 1, wxRA_SPECIFY_COLS );
m_ScaleOption->SetSelection( 0 );
bScaleSizer->Add( m_ScaleOption, 0, wxALL, 5 );
m_FineAdjustXscaleTitle = new wxStaticText( this, wxID_ANY, _("X scale adjust:"), wxDefaultPosition, wxDefaultSize, 0 );
m_FineAdjustXscaleTitle->Wrap( -1 );
bScaleSizer->Add( m_FineAdjustXscaleTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_FineAdjustXscaleOpt = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_FineAdjustXscaleOpt->SetToolTip( _("Set X scale adjust for exact scale plotting") );
bScaleSizer->Add( m_FineAdjustXscaleOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_FineAdjustYscaleTitle = new wxStaticText( this, wxID_ANY, _("Y scale adjust:"), wxDefaultPosition, wxDefaultSize, 0 );
m_FineAdjustYscaleTitle->Wrap( -1 );
bScaleSizer->Add( m_FineAdjustYscaleTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_FineAdjustYscaleOpt = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_FineAdjustYscaleOpt->SetToolTip( _("Set Y scale adjust for exact scale plotting") );
bScaleSizer->Add( m_FineAdjustYscaleOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bUpperSizer->Add( bScaleSizer, 0, wxEXPAND, 5 );
bUpperSizer->Add( sbLayersSizer, 1, wxALL|wxEXPAND, 5 );
wxBoxSizer* bOptionsSizer;
bOptionsSizer = new wxBoxSizer( wxVERTICAL );
@ -105,7 +87,7 @@ DIALOG_PRINT_USING_PRINTER_BASE::DIALOG_PRINT_USING_PRINTER_BASE( wxWindow* pare
gbSizer1->SetFlexibleDirection( wxBOTH );
gbSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_penWidthLabel = new wxStaticText( sbOptionsSizer->GetStaticBox(), wxID_ANY, _("Default pen size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_penWidthLabel = new wxStaticText( sbOptionsSizer->GetStaticBox(), wxID_ANY, _("Default line width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_penWidthLabel->Wrap( -1 );
m_penWidthLabel->SetToolTip( _("Pen size used to draw items that have no pen size specified.\nUsed mainly to draw items in sketch mode.") );
@ -130,7 +112,7 @@ DIALOG_PRINT_USING_PRINTER_BASE::DIALOG_PRINT_USING_PRINTER_BASE( wxWindow* pare
m_outputModeLabel = new wxStaticText( sbOptionsSizer->GetStaticBox(), wxID_ANY, _("Output mode:"), wxDefaultPosition, wxDefaultSize, 0 );
m_outputModeLabel->Wrap( -1 );
gbSizer1->Add( m_outputModeLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxBOTTOM|wxRIGHT|wxLEFT, 5 );
gbSizer1->Add( m_outputModeLabel, wxGBPosition( 2, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxRIGHT, 5 );
wxString m_outputModeChoices[] = { _("Color"), _("Black and white") };
int m_outputModeNChoices = sizeof( m_outputModeChoices ) / sizeof( wxString );
@ -159,7 +141,33 @@ DIALOG_PRINT_USING_PRINTER_BASE::DIALOG_PRINT_USING_PRINTER_BASE( wxWindow* pare
int m_PagesOptionNChoices = sizeof( m_PagesOptionChoices ) / sizeof( wxString );
m_PagesOption = new wxRadioBox( this, wxID_PAGE_MODE, _("Pagination"), wxDefaultPosition, wxDefaultSize, m_PagesOptionNChoices, m_PagesOptionChoices, 1, wxRA_SPECIFY_COLS );
m_PagesOption->SetSelection( 0 );
bOptionsSizer->Add( m_PagesOption, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
bOptionsSizer->Add( m_PagesOption, 0, wxALL|wxEXPAND|wxLEFT|wxRIGHT, 5 );
wxStaticBoxSizer* bScaleSizer;
bScaleSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Scale") ), wxVERTICAL );
m_scale1 = new wxRadioButton( bScaleSizer->GetStaticBox(), wxID_ANY, _("1:1"), wxDefaultPosition, wxDefaultSize, 0 );
bScaleSizer->Add( m_scale1, 0, 0, 5 );
m_scaleFit = new wxRadioButton( bScaleSizer->GetStaticBox(), wxID_ANY, _("Fit to page"), wxDefaultPosition, wxDefaultSize, 0 );
bScaleSizer->Add( m_scaleFit, 0, wxTOP, 5 );
wxBoxSizer* bSizer10;
bSizer10 = new wxBoxSizer( wxHORIZONTAL );
m_scaleCustom = new wxRadioButton( bScaleSizer->GetStaticBox(), wxID_ANY, _("Custom:"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer10->Add( m_scaleCustom, 0, wxTOP, 5 );
m_scaleCustomText = new wxTextCtrl( bScaleSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_scaleCustomText->SetToolTip( _("Set X scale adjust for exact scale plotting") );
bSizer10->Add( m_scaleCustomText, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bScaleSizer->Add( bSizer10, 1, wxEXPAND, 5 );
bOptionsSizer->Add( bScaleSizer, 0, wxALL|wxEXPAND, 5 );
bUpperSizer->Add( bOptionsSizer, 0, wxEXPAND, 5 );
@ -195,23 +203,26 @@ DIALOG_PRINT_USING_PRINTER_BASE::DIALOG_PRINT_USING_PRINTER_BASE( wxWindow* pare
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
this->Centre( wxBOTH );
// Connect Events
m_ScaleOption->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnScaleSelectionClick ), NULL, this );
m_buttonOption->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPageSetup ), NULL, this );
m_sdbSizer1Apply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintPreview ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintButtonClick ), NULL, this );
m_buttonSelectAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_PCBNEW_BASE::OnSelectAllClick ), NULL, this );
m_buttonDeselectAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_PCBNEW_BASE::OnDeselectAllClick ), NULL, this );
m_scaleCustomText->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PRINT_PCBNEW_BASE::OnSetCustomScale ), NULL, this );
m_buttonOption->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_PCBNEW_BASE::OnPageSetup ), NULL, this );
m_sdbSizer1Apply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_PCBNEW_BASE::OnPrintPreview ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_PCBNEW_BASE::OnPrintButtonClick ), NULL, this );
}
DIALOG_PRINT_USING_PRINTER_BASE::~DIALOG_PRINT_USING_PRINTER_BASE()
DIALOG_PRINT_PCBNEW_BASE::~DIALOG_PRINT_PCBNEW_BASE()
{
// Disconnect Events
m_ScaleOption->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnScaleSelectionClick ), NULL, this );
m_buttonOption->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPageSetup ), NULL, this );
m_sdbSizer1Apply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintPreview ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_USING_PRINTER_BASE::OnPrintButtonClick ), NULL, this );
m_buttonSelectAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_PCBNEW_BASE::OnSelectAllClick ), NULL, this );
m_buttonDeselectAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_PCBNEW_BASE::OnDeselectAllClick ), NULL, this );
m_scaleCustomText->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PRINT_PCBNEW_BASE::OnSetCustomScale ), NULL, this );
m_buttonOption->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_PCBNEW_BASE::OnPageSetup ), NULL, this );
m_sdbSizer1Apply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_PCBNEW_BASE::OnPrintPreview ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PRINT_PCBNEW_BASE::OnPrintButtonClick ), NULL, this );
}

View File

@ -1,16 +1,18 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// C++ code generated with wxFormBuilder (version Oct 17 2016)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_PRINT_USING_PRINTER_BASE_H__
#define __DIALOG_PRINT_USING_PRINTER_BASE_H__
#ifndef __DIALOG_PRINT_PCBNEW_BASE_H__
#define __DIALOG_PRINT_PCBNEW_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
@ -20,22 +22,23 @@
#include <wx/settings.h>
#include <wx/checklst.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/checkbox.h>
#include <wx/statbox.h>
#include <wx/radiobox.h>
#include <wx/textctrl.h>
#include <wx/choice.h>
#include <wx/gbsizer.h>
#include <wx/radiobox.h>
#include <wx/radiobut.h>
#include <wx/statline.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_PRINT_USING_PRINTER_BASE
/// Class DIALOG_PRINT_PCBNEW_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_PRINT_USING_PRINTER_BASE : public DIALOG_SHIM
class DIALOG_PRINT_PCBNEW_BASE : public DIALOG_SHIM
{
private:
@ -51,12 +54,9 @@ class DIALOG_PRINT_USING_PRINTER_BASE : public DIALOG_SHIM
wxCheckListBox* m_CopperLayersList;
wxStaticText* m_staticText5;
wxCheckListBox* m_TechnicalLayersList;
wxButton* m_buttonSelectAll;
wxButton* m_buttonDeselectAll;
wxCheckBox* m_Exclude_Edges_Pcb;
wxRadioBox* m_ScaleOption;
wxStaticText* m_FineAdjustXscaleTitle;
wxTextCtrl* m_FineAdjustXscaleOpt;
wxStaticText* m_FineAdjustYscaleTitle;
wxTextCtrl* m_FineAdjustYscaleOpt;
wxStaticText* m_penWidthLabel;
wxTextCtrl* m_penWidthCtrl;
wxStaticText* m_penWidthUnits;
@ -67,6 +67,10 @@ class DIALOG_PRINT_USING_PRINTER_BASE : public DIALOG_SHIM
wxCheckBox* m_Print_Sheet_Ref;
wxCheckBox* m_Print_Mirror;
wxRadioBox* m_PagesOption;
wxRadioButton* m_scale1;
wxRadioButton* m_scaleFit;
wxRadioButton* m_scaleCustom;
wxTextCtrl* m_scaleCustomText;
wxStaticLine* m_staticline1;
wxButton* m_buttonOption;
wxStdDialogButtonSizer* m_sdbSizer1;
@ -75,7 +79,9 @@ class DIALOG_PRINT_USING_PRINTER_BASE : public DIALOG_SHIM
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class
virtual void OnScaleSelectionClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSelectAllClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDeselectAllClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSetCustomScale( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPageSetup( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPrintPreview( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPrintButtonClick( wxCommandEvent& event ) { event.Skip(); }
@ -83,9 +89,9 @@ class DIALOG_PRINT_USING_PRINTER_BASE : public DIALOG_SHIM
public:
DIALOG_PRINT_USING_PRINTER_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Print"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PRINT_USING_PRINTER_BASE();
DIALOG_PRINT_PCBNEW_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Print"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 700,550 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PRINT_PCBNEW_BASE();
};
#endif //__DIALOG_PRINT_USING_PRINTER_BASE_H__
#endif //__DIALOG_PRINT_PCBNEW_BASE_H__

View File

@ -211,6 +211,11 @@ protected:
virtual void duplicateItems( bool aIncrement ) = 0;
void unitsChangeRefresh() override;
/**
* Set up printing system.
*/
virtual void preparePrintout();
};
#endif

View File

@ -145,6 +145,11 @@ public:
const COLOR4D& GetBackgroundColor() override { return m_layerColors[ LAYER_PCB_BACKGROUND ]; }
void SetBackgroundColor( const COLOR4D& aColor ) override
{
m_layerColors[ LAYER_PCB_BACKGROUND ] = aColor;
}
const COLOR4D& GetGridColor() override { return m_layerColors[ LAYER_GRID ]; }
const COLOR4D& GetCursorColor() override { return m_layerColors[ LAYER_CURSOR ]; }