2007-06-05 12:10:51 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// 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 )
|
|
|
|
|
2008-03-22 18:08:44 +00:00
|
|
|
EVT_BUTTON( wxID_CANCEL, WinEDA_PrintFrame::OnCancelClick )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
////@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_CopperLayersBoxSizer = NULL;
|
|
|
|
m_TechLayersBoxSizer = NULL;
|
|
|
|
m_ScaleOption = NULL;
|
|
|
|
m_FineAdjustXscaleTitle = NULL;
|
|
|
|
m_FineAdjustXscaleOpt = NULL;
|
|
|
|
m_FineAdjustYscaleTitle = NULL;
|
|
|
|
m_FineAdjustYscaleOpt = NULL;
|
|
|
|
m_DialogPenWidthSizer = NULL;
|
|
|
|
m_Print_Sheet_Ref = NULL;
|
|
|
|
m_Print_Mirror = NULL;
|
|
|
|
m_ColorOption = NULL;
|
|
|
|
m_PagesOptionPcb = NULL;
|
|
|
|
m_PagesOptionEeschema = NULL;
|
2008-03-22 18:08:44 +00:00
|
|
|
m_CloseButton = NULL;
|
2007-06-05 12:10:51 +00:00
|
|
|
////@end WinEDA_PrintFrame member initialisation
|
|
|
|
|
|
|
|
////@begin WinEDA_PrintFrame creation
|
2008-03-22 18:08:44 +00:00
|
|
|
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
|
2007-06-05 12:10:51 +00:00
|
|
|
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
|
2008-03-22 18:08:44 +00:00
|
|
|
// Generated by DialogBlocks, 22/03/2008 08:33:38 (unregistered)
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
WinEDA_PrintFrame* itemDialog1 = this;
|
|
|
|
|
|
|
|
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
itemDialog1->SetSizer(itemBoxSizer2);
|
|
|
|
|
|
|
|
m_CopperLayersBoxSizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
itemBoxSizer2->Add(m_CopperLayersBoxSizer, 0, wxALIGN_TOP|wxALL, 5);
|
|
|
|
|
|
|
|
m_TechLayersBoxSizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
itemBoxSizer2->Add(m_TechLayersBoxSizer, 0, wxALIGN_TOP|wxALL, 5);
|
|
|
|
|
|
|
|
wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL);
|
|
|
|
itemBoxSizer2->Add(itemBoxSizer5, 0, wxGROW|wxALL, 5);
|
|
|
|
|
2008-03-22 18:08:44 +00:00
|
|
|
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 );
|
2007-06-05 12:10:51 +00:00
|
|
|
m_ScaleOption->SetSelection(0);
|
|
|
|
itemBoxSizer5->Add(m_ScaleOption, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
|
|
|
|
|
|
|
|
m_FineAdjustXscaleTitle = new wxStaticText( itemDialog1, wxID_STATIC, _("X Scale Adjust"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
|
|
itemBoxSizer5->Add(m_FineAdjustXscaleTitle, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
|
|
|
|
|
|
|
|
m_FineAdjustXscaleOpt = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
|
|
|
|
itemBoxSizer5->Add(m_FineAdjustXscaleOpt, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
|
|
|
|
|
|
|
|
m_FineAdjustYscaleTitle = new wxStaticText( itemDialog1, wxID_STATIC, _("Y Scale Adjust"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
|
|
itemBoxSizer5->Add(m_FineAdjustYscaleTitle, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
|
|
|
|
|
|
|
|
m_FineAdjustYscaleOpt = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
|
|
|
|
itemBoxSizer5->Add(m_FineAdjustYscaleOpt, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
|
|
|
|
|
|
|
|
itemBoxSizer2->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
|
|
|
|
|
|
|
wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxVERTICAL);
|
|
|
|
itemBoxSizer2->Add(itemBoxSizer12, 0, wxGROW|wxALL, 5);
|
|
|
|
|
|
|
|
wxStaticBox* itemStaticBoxSizer13Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Options:"));
|
|
|
|
wxStaticBoxSizer* itemStaticBoxSizer13 = new wxStaticBoxSizer(itemStaticBoxSizer13Static, wxVERTICAL);
|
|
|
|
itemBoxSizer12->Add(itemStaticBoxSizer13, 0, wxGROW|wxALL, 5);
|
|
|
|
|
|
|
|
m_DialogPenWidthSizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
itemStaticBoxSizer13->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);
|
|
|
|
itemStaticBoxSizer13->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);
|
|
|
|
itemStaticBoxSizer13->Add(m_Print_Mirror, 0, wxGROW|wxALL, 5);
|
|
|
|
|
2008-03-22 18:08:44 +00:00
|
|
|
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 );
|
2007-06-05 12:10:51 +00:00
|
|
|
m_ColorOption->SetSelection(0);
|
|
|
|
itemBoxSizer12->Add(m_ColorOption, 0, wxGROW|wxALL, 5);
|
|
|
|
|
2008-03-22 18:08:44 +00:00
|
|
|
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 );
|
2007-06-05 12:10:51 +00:00
|
|
|
m_PagesOptionPcb->SetSelection(0);
|
|
|
|
itemBoxSizer12->Add(m_PagesOptionPcb, 0, wxGROW|wxALL, 5);
|
|
|
|
|
2008-03-22 18:08:44 +00:00
|
|
|
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 );
|
2007-06-05 12:10:51 +00:00
|
|
|
m_PagesOptionEeschema->SetSelection(0);
|
|
|
|
itemBoxSizer12->Add(m_PagesOptionEeschema, 0, wxGROW|wxALL, 5);
|
|
|
|
|
|
|
|
itemBoxSizer2->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
|
|
|
|
|
|
|
wxBoxSizer* itemBoxSizer21 = new wxBoxSizer(wxVERTICAL);
|
|
|
|
itemBoxSizer2->Add(itemBoxSizer21, 0, wxALIGN_TOP|wxALL, 5);
|
|
|
|
|
|
|
|
itemBoxSizer21->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
|
|
|
|
|
|
|
|
wxButton* itemButton23 = new wxButton( itemDialog1, ID_PRINT_SETUP, _("Print S&etup"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
|
|
itemButton23->SetForegroundColour(wxColour(121, 118, 0));
|
|
|
|
itemBoxSizer21->Add(itemButton23, 0, wxGROW|wxALL, 5);
|
|
|
|
|
|
|
|
wxButton* itemButton24 = new wxButton( itemDialog1, ID_PRINT_PREVIEW, _("Pre&view"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
|
|
itemButton24->SetForegroundColour(wxColour(0, 0, 196));
|
|
|
|
itemBoxSizer21->Add(itemButton24, 0, wxGROW|wxALL, 5);
|
|
|
|
|
|
|
|
wxButton* itemButton25 = new wxButton( itemDialog1, ID_PRINT_EXECUTE, _("&Print"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
|
|
itemButton25->SetForegroundColour(wxColour(0, 128, 64));
|
|
|
|
itemBoxSizer21->Add(itemButton25, 0, wxGROW|wxALL, 5);
|
|
|
|
|
2008-03-22 18:08:44 +00:00
|
|
|
m_CloseButton = new wxButton( itemDialog1, wxID_CANCEL, _("&Close"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
|
|
m_CloseButton->SetDefault();
|
|
|
|
itemBoxSizer21->Add(m_CloseButton, 0, wxGROW|wxALL, 5);
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
// 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
|
|
|
|
|
2008-03-22 18:08:44 +00:00
|
|
|
m_CloseButton->SetFocus( ); // add this line to close dialog by the escape key
|
2007-06-05 12:10:51 +00:00
|
|
|
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
|
|
|
|
*/
|
|
|
|
|
2008-03-22 18:08:44 +00:00
|
|
|
void WinEDA_PrintFrame::OnCancelClick( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
|