353 lines
12 KiB
C++
353 lines
12 KiB
C++
/////////////////////////////////////////////////////////////////////////////
|
|
// Name: dialog_print.cpp
|
|
// Purpose:
|
|
// Author: jean-pierre Charras
|
|
// Modified by:
|
|
// Created: 28/02/2006 18:30:16
|
|
// RCS-ID:
|
|
// Copyright: License GNU
|
|
// Licence:
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Generated by DialogBlocks (unregistered), 28/02/2006 18:30:16
|
|
|
|
////@begin includes
|
|
////@end includes
|
|
|
|
#include "dialog_print.h"
|
|
|
|
////@begin XPM images
|
|
////@end XPM images
|
|
|
|
/*!
|
|
* WinEDA_PrintFrame type definition
|
|
*/
|
|
|
|
IMPLEMENT_DYNAMIC_CLASS( WinEDA_PrintFrame, wxDialog )
|
|
|
|
/*!
|
|
* WinEDA_PrintFrame event table definition
|
|
*/
|
|
|
|
BEGIN_EVENT_TABLE( WinEDA_PrintFrame, wxDialog )
|
|
|
|
////@begin WinEDA_PrintFrame event table entries
|
|
EVT_RADIOBOX( ID_SET_PRINT_SCALE, WinEDA_PrintFrame::OnSetPrintScaleSelected )
|
|
|
|
EVT_RADIOBOX( ID_SET_BW, WinEDA_PrintFrame::OnSetBwSelected )
|
|
|
|
EVT_BUTTON( ID_PRINT_SETUP, WinEDA_PrintFrame::OnPrintSetupClick )
|
|
|
|
EVT_BUTTON( ID_PRINT_PREVIEW, WinEDA_PrintFrame::OnPrintPreviewClick )
|
|
|
|
EVT_BUTTON( ID_PRINT_EXECUTE, WinEDA_PrintFrame::OnPrintExecuteClick )
|
|
|
|
EVT_BUTTON( wxID_CANCEL, WinEDA_PrintFrame::OnCancelClick )
|
|
|
|
////@end WinEDA_PrintFrame event table entries
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
/*!
|
|
* WinEDA_PrintFrame constructors
|
|
*/
|
|
|
|
WinEDA_PrintFrame::WinEDA_PrintFrame( )
|
|
{
|
|
}
|
|
|
|
WinEDA_PrintFrame::WinEDA_PrintFrame( WinEDA_DrawFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
|
|
{
|
|
m_Parent = parent;
|
|
m_XScaleAdjust = m_YScaleAdjust = 1.0;
|
|
m_PagesOption = NULL;
|
|
wxConfig * Config = m_Parent->m_Parent->m_EDA_Config;
|
|
if ( Config )
|
|
{
|
|
Config->Read(wxT("PrintPenWidth"), &s_PrintPenMinWidth);
|
|
}
|
|
|
|
|
|
Create(parent, id, caption, pos, size, style);
|
|
}
|
|
|
|
/*!
|
|
* WinEDA_PrintFrame creator
|
|
*/
|
|
|
|
bool WinEDA_PrintFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
|
|
{
|
|
////@begin WinEDA_PrintFrame member initialisation
|
|
m_FullDialogBowSizer = NULL;
|
|
m_LeftBoxSizer = NULL;
|
|
m_LayersSelectionsBoxSizer = NULL;
|
|
m_CopperLayersBoxSizer = NULL;
|
|
m_TechLayersBoxSizer = NULL;
|
|
m_Exclude_Edges_Pcb = NULL;
|
|
m_ScaleBoxSizer = NULL;
|
|
m_ScaleOption = NULL;
|
|
m_FineAdjustXscaleTitle = NULL;
|
|
m_FineAdjustXscaleOpt = NULL;
|
|
m_FineAdjustYscaleTitle = NULL;
|
|
m_FineAdjustYscaleOpt = NULL;
|
|
m_OptionsBoxSizer = NULL;
|
|
m_DialogPenWidthSizer = NULL;
|
|
m_Print_Sheet_Ref = NULL;
|
|
m_Print_Mirror = NULL;
|
|
m_ColorOption = NULL;
|
|
m_PagesOptionPcb = NULL;
|
|
m_PagesOptionEeschema = NULL;
|
|
m_ButtonsBoxSizer = NULL;
|
|
m_CloseButton = NULL;
|
|
////@end WinEDA_PrintFrame member initialisation
|
|
|
|
////@begin WinEDA_PrintFrame creation
|
|
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
|
|
wxDialog::Create( parent, id, caption, pos, size, style );
|
|
|
|
CreateControls();
|
|
if (GetSizer())
|
|
{
|
|
GetSizer()->SetSizeHints(this);
|
|
}
|
|
Centre();
|
|
////@end WinEDA_PrintFrame creation
|
|
return true;
|
|
}
|
|
|
|
/*!
|
|
* Control creation for WinEDA_PrintFrame
|
|
*/
|
|
|
|
void WinEDA_PrintFrame::CreateControls()
|
|
{
|
|
SetFont(*g_DialogFont);
|
|
|
|
////@begin WinEDA_PrintFrame content construction
|
|
// Generated by DialogBlocks, 25/08/2008 12:59:33 (unregistered)
|
|
|
|
WinEDA_PrintFrame* itemDialog1 = this;
|
|
|
|
m_FullDialogBowSizer = new wxBoxSizer(wxHORIZONTAL);
|
|
itemDialog1->SetSizer(m_FullDialogBowSizer);
|
|
|
|
m_LeftBoxSizer = new wxBoxSizer(wxVERTICAL);
|
|
m_FullDialogBowSizer->Add(m_LeftBoxSizer, 0, wxGROW|wxTOP|wxBOTTOM, 5);
|
|
|
|
m_LayersSelectionsBoxSizer = new wxBoxSizer(wxHORIZONTAL);
|
|
m_LeftBoxSizer->Add(m_LayersSelectionsBoxSizer, 0, wxGROW|wxALL, 5);
|
|
|
|
m_CopperLayersBoxSizer = new wxBoxSizer(wxVERTICAL);
|
|
m_LayersSelectionsBoxSizer->Add(m_CopperLayersBoxSizer, 0, wxALIGN_TOP|wxRIGHT|wxTOP|wxBOTTOM, 5);
|
|
|
|
m_TechLayersBoxSizer = new wxBoxSizer(wxVERTICAL);
|
|
m_LayersSelectionsBoxSizer->Add(m_TechLayersBoxSizer, 0, wxALIGN_TOP|wxALL, 5);
|
|
|
|
m_Exclude_Edges_Pcb = new wxCheckBox( itemDialog1, ID_EXCLUDE_EDGES_PCB, _("Exclude Edges_Pcb Layer"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
m_Exclude_Edges_Pcb->SetValue(false);
|
|
if (WinEDA_PrintFrame::ShowToolTips())
|
|
m_Exclude_Edges_Pcb->SetToolTip(_("Exclude contents of Edges_Pcb layer from all other layers"));
|
|
m_Exclude_Edges_Pcb->Show(false);
|
|
m_LeftBoxSizer->Add(m_Exclude_Edges_Pcb, 0, wxGROW|wxALL, 5);
|
|
|
|
m_ScaleBoxSizer = new wxBoxSizer(wxVERTICAL);
|
|
m_FullDialogBowSizer->Add(m_ScaleBoxSizer, 0, wxGROW|wxALL, 5);
|
|
|
|
wxArrayString m_ScaleOptionStrings;
|
|
m_ScaleOptionStrings.Add(_("fit in page"));
|
|
m_ScaleOptionStrings.Add(_("Scale 0.5"));
|
|
m_ScaleOptionStrings.Add(_("Scale 0.7"));
|
|
m_ScaleOptionStrings.Add(_("Approx. Scale 1"));
|
|
m_ScaleOptionStrings.Add(_("Accurate Scale 1"));
|
|
m_ScaleOptionStrings.Add(_("Scale 1.4"));
|
|
m_ScaleOptionStrings.Add(_("Scale 2"));
|
|
m_ScaleOptionStrings.Add(_("Scale 3"));
|
|
m_ScaleOptionStrings.Add(_("Scale 4"));
|
|
m_ScaleOption = new wxRadioBox( itemDialog1, ID_SET_PRINT_SCALE, _("Approx. Scale:"), wxDefaultPosition, wxDefaultSize, m_ScaleOptionStrings, 1, wxRA_SPECIFY_COLS );
|
|
m_ScaleOption->SetSelection(0);
|
|
m_ScaleBoxSizer->Add(m_ScaleOption, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
|
|
|
|
m_FineAdjustXscaleTitle = new wxStaticText( itemDialog1, wxID_STATIC, _("X Scale Adjust"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
m_ScaleBoxSizer->Add(m_FineAdjustXscaleTitle, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
|
|
|
|
m_FineAdjustXscaleOpt = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
|
|
m_ScaleBoxSizer->Add(m_FineAdjustXscaleOpt, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
|
|
|
|
m_FineAdjustYscaleTitle = new wxStaticText( itemDialog1, wxID_STATIC, _("Y Scale Adjust"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
m_ScaleBoxSizer->Add(m_FineAdjustYscaleTitle, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
|
|
|
|
m_FineAdjustYscaleOpt = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
|
|
m_ScaleBoxSizer->Add(m_FineAdjustYscaleOpt, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
|
|
|
|
m_FullDialogBowSizer->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
|
|
|
wxBoxSizer* itemBoxSizer15 = new wxBoxSizer(wxVERTICAL);
|
|
m_FullDialogBowSizer->Add(itemBoxSizer15, 0, wxGROW|wxALL, 5);
|
|
|
|
m_OptionsBoxSizer = new wxStaticBox(itemDialog1, wxID_ANY, _("Options:"));
|
|
wxStaticBoxSizer* itemStaticBoxSizer16 = new wxStaticBoxSizer(m_OptionsBoxSizer, wxVERTICAL);
|
|
itemBoxSizer15->Add(itemStaticBoxSizer16, 0, wxGROW|wxALL, 5);
|
|
|
|
m_DialogPenWidthSizer = new wxBoxSizer(wxVERTICAL);
|
|
itemStaticBoxSizer16->Add(m_DialogPenWidthSizer, 0, wxGROW|wxALL, 5);
|
|
|
|
m_Print_Sheet_Ref = new wxCheckBox( itemDialog1, ID_PRINT_REF, _("Print Sheet Ref"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
|
|
m_Print_Sheet_Ref->SetValue(false);
|
|
itemStaticBoxSizer16->Add(m_Print_Sheet_Ref, 0, wxGROW|wxALL, 5);
|
|
|
|
m_Print_Mirror = new wxCheckBox( itemDialog1, ID_CHECK_PRINT_MIROR, _("Mirror"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
|
|
m_Print_Mirror->SetValue(false);
|
|
itemStaticBoxSizer16->Add(m_Print_Mirror, 0, wxGROW|wxALL, 5);
|
|
|
|
wxArrayString m_ColorOptionStrings;
|
|
m_ColorOptionStrings.Add(_("Color"));
|
|
m_ColorOptionStrings.Add(_("Black"));
|
|
m_ColorOption = new wxRadioBox( itemDialog1, ID_SET_BW, _("Color Print:"), wxDefaultPosition, wxDefaultSize, m_ColorOptionStrings, 1, wxRA_SPECIFY_COLS );
|
|
m_ColorOption->SetSelection(0);
|
|
itemBoxSizer15->Add(m_ColorOption, 0, wxGROW|wxALL, 5);
|
|
|
|
wxArrayString m_PagesOptionPcbStrings;
|
|
m_PagesOptionPcbStrings.Add(_("1 Page per Layer"));
|
|
m_PagesOptionPcbStrings.Add(_("Single Page"));
|
|
m_PagesOptionPcb = new wxRadioBox( itemDialog1, ID_PRINT_ALL_IN_ONE, _("Page Print:"), wxDefaultPosition, wxDefaultSize, m_PagesOptionPcbStrings, 1, wxRA_SPECIFY_COLS );
|
|
m_PagesOptionPcb->SetSelection(0);
|
|
itemBoxSizer15->Add(m_PagesOptionPcb, 0, wxGROW|wxALL, 5);
|
|
|
|
wxArrayString m_PagesOptionEeschemaStrings;
|
|
m_PagesOptionEeschemaStrings.Add(_("Current"));
|
|
m_PagesOptionEeschemaStrings.Add(_("All"));
|
|
m_PagesOptionEeschema = new wxRadioBox( itemDialog1, ID_PRINT_ALL, _("Page Print:"), wxDefaultPosition, wxDefaultSize, m_PagesOptionEeschemaStrings, 1, wxRA_SPECIFY_COLS );
|
|
m_PagesOptionEeschema->SetSelection(0);
|
|
itemBoxSizer15->Add(m_PagesOptionEeschema, 0, wxGROW|wxALL, 5);
|
|
|
|
m_FullDialogBowSizer->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
|
|
|
m_ButtonsBoxSizer = new wxBoxSizer(wxVERTICAL);
|
|
m_FullDialogBowSizer->Add(m_ButtonsBoxSizer, 0, wxALIGN_TOP|wxALL, 5);
|
|
|
|
m_ButtonsBoxSizer->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
|
|
|
|
wxButton* itemButton26 = new wxButton( itemDialog1, ID_PRINT_SETUP, _("Print S&etup"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
itemButton26->SetForegroundColour(wxColour(121, 118, 0));
|
|
m_ButtonsBoxSizer->Add(itemButton26, 0, wxGROW|wxALL, 5);
|
|
|
|
wxButton* itemButton27 = new wxButton( itemDialog1, ID_PRINT_PREVIEW, _("Pre&view"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
itemButton27->SetForegroundColour(wxColour(0, 0, 196));
|
|
m_ButtonsBoxSizer->Add(itemButton27, 0, wxGROW|wxALL, 5);
|
|
|
|
wxButton* itemButton28 = new wxButton( itemDialog1, ID_PRINT_EXECUTE, _("&Print"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
itemButton28->SetForegroundColour(wxColour(0, 128, 64));
|
|
m_ButtonsBoxSizer->Add(itemButton28, 0, wxGROW|wxALL, 5);
|
|
|
|
m_CloseButton = new wxButton( itemDialog1, wxID_CANCEL, _("&Close"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
m_CloseButton->SetDefault();
|
|
m_ButtonsBoxSizer->Add(m_CloseButton, 0, wxGROW|wxALL, 5);
|
|
|
|
// Set validators
|
|
m_ScaleOption->SetValidator( wxGenericValidator(& s_Scale_Select) );
|
|
m_Print_Sheet_Ref->SetValidator( wxGenericValidator(& s_Print_Sheet_Ref) );
|
|
m_Print_Mirror->SetValidator( wxGenericValidator(& s_PrintMirror) );
|
|
m_PagesOptionPcb->SetValidator( wxGenericValidator(& s_OptionPrintPage) );
|
|
m_PagesOptionEeschema->SetValidator( wxGenericValidator(& s_OptionPrintPage) );
|
|
////@end WinEDA_PrintFrame content construction
|
|
|
|
SetFocus( ); // add this line to close dialog by the escape key
|
|
|
|
m_DialogPenWidth = new WinEDA_ValueCtrl(this, _("Pen width mini"), s_PrintPenMinWidth,
|
|
g_UnitMetric, m_DialogPenWidthSizer, m_Parent->m_InternalUnits);
|
|
|
|
SetOthersDatas();
|
|
}
|
|
|
|
/*!
|
|
* Should we show tooltips?
|
|
*/
|
|
|
|
bool WinEDA_PrintFrame::ShowToolTips()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/*!
|
|
* Get bitmap resources
|
|
*/
|
|
|
|
wxBitmap WinEDA_PrintFrame::GetBitmapResource( const wxString& name )
|
|
{
|
|
// Bitmap retrieval
|
|
////@begin WinEDA_PrintFrame bitmap retrieval
|
|
wxUnusedVar(name);
|
|
return wxNullBitmap;
|
|
////@end WinEDA_PrintFrame bitmap retrieval
|
|
}
|
|
|
|
/*!
|
|
* Get icon resources
|
|
*/
|
|
|
|
wxIcon WinEDA_PrintFrame::GetIconResource( const wxString& name )
|
|
{
|
|
// Icon retrieval
|
|
////@begin WinEDA_PrintFrame icon retrieval
|
|
wxUnusedVar(name);
|
|
return wxNullIcon;
|
|
////@end WinEDA_PrintFrame icon retrieval
|
|
}
|
|
/*!
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PRINT_SETUP
|
|
*/
|
|
|
|
void WinEDA_PrintFrame::OnPrintSetupClick( wxCommandEvent& event )
|
|
{
|
|
OnPrintSetup(event);
|
|
}
|
|
|
|
/*!
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PRINT_PREVIEW
|
|
*/
|
|
|
|
void WinEDA_PrintFrame::OnPrintPreviewClick( wxCommandEvent& event )
|
|
{
|
|
OnPrintPreview(event);
|
|
}
|
|
|
|
/*!
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PRINT_EXECUTE
|
|
*/
|
|
|
|
void WinEDA_PrintFrame::OnPrintExecuteClick( wxCommandEvent& event )
|
|
{
|
|
EDA_PrintPage(event);
|
|
}
|
|
|
|
/*!
|
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CLOSE
|
|
*/
|
|
|
|
void WinEDA_PrintFrame::OnCancelClick( wxCommandEvent& event )
|
|
{
|
|
OnClosePrintDialog();
|
|
}
|
|
|
|
|
|
/*!
|
|
* wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_SET_PRINT_SCALE
|
|
*/
|
|
|
|
void WinEDA_PrintFrame::OnSetPrintScaleSelected( wxCommandEvent& event )
|
|
{
|
|
SetScale(event);
|
|
}
|
|
|
|
|
|
/*!
|
|
* wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_SET_BW
|
|
*/
|
|
|
|
void WinEDA_PrintFrame::OnSetBwSelected( wxCommandEvent& event )
|
|
{
|
|
SetColorOrBlack(event);
|
|
}
|
|
|
|
|