Beautification
This commit is contained in:
parent
3d73eb6823
commit
1da6b3a407
|
@ -1,4 +1,5 @@
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Name: svg_print.cpp
|
// Name: svg_print.cpp
|
||||||
// Purpose:
|
// Purpose:
|
||||||
// Author: jean-pierre Charras
|
// Author: jean-pierre Charras
|
||||||
|
@ -11,7 +12,7 @@
|
||||||
|
|
||||||
// Generated by DialogBlocks (unregistered), 05/02/2006 11:05:19
|
// Generated by DialogBlocks (unregistered), 05/02/2006 11:05:19
|
||||||
|
|
||||||
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
#if defined (__GNUG__) && !defined (NO_GCC_PRAGMA)
|
||||||
#pragma implementation "svg_print.h"
|
#pragma implementation "svg_print.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -49,7 +50,7 @@
|
||||||
////@begin XPM images
|
////@begin XPM images
|
||||||
////@end XPM images
|
////@end XPM images
|
||||||
|
|
||||||
extern BASE_SCREEN * ActiveScreen;
|
extern BASE_SCREEN* ActiveScreen;
|
||||||
#ifdef EESCHEMA
|
#ifdef EESCHEMA
|
||||||
#define WIDTH_MAX_VALUE 100
|
#define WIDTH_MAX_VALUE 100
|
||||||
#else
|
#else
|
||||||
|
@ -65,24 +66,26 @@ static bool Print_Sheet_Ref = TRUE;
|
||||||
static int s_PlotBlackAndWhite = 0;
|
static int s_PlotBlackAndWhite = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************/
|
||||||
|
void WinEDA_DrawFrame::SVG_Print( wxCommandEvent& event )
|
||||||
|
/*******************************************************/
|
||||||
|
|
||||||
/*******************************************************/
|
|
||||||
void WinEDA_DrawFrame::SVG_Print(wxCommandEvent& event)
|
|
||||||
/*******************************************************/
|
|
||||||
/* Prepare les structures de donnees de gestion de l'impression
|
/* Prepare les structures de donnees de gestion de l'impression
|
||||||
et affiche la fenetre de dialogue de gestion de l'impression des feuilles
|
* et affiche la fenetre de dialogue de gestion de l'impression des feuilles
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
// Arret des commandes en cours
|
// Arret des commandes en cours
|
||||||
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
|
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
|
||||||
{
|
{
|
||||||
wxClientDC dc(DrawPanel);
|
wxClientDC dc( DrawPanel );
|
||||||
DrawPanel->PrepareDC(dc);
|
|
||||||
DrawPanel->ForceCloseManageCurseur(DrawPanel, &dc);
|
DrawPanel->PrepareDC( dc );
|
||||||
}
|
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
||||||
SetToolID(0, wxCURSOR_ARROW,wxEmptyString);
|
}
|
||||||
|
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||||
|
|
||||||
|
WinEDA_PrintSVGFrame frame( this );
|
||||||
|
|
||||||
WinEDA_PrintSVGFrame frame(this);
|
|
||||||
frame.ShowModal();
|
frame.ShowModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,13 +103,13 @@ IMPLEMENT_DYNAMIC_CLASS( WinEDA_PrintSVGFrame, wxDialog )
|
||||||
BEGIN_EVENT_TABLE( WinEDA_PrintSVGFrame, wxDialog )
|
BEGIN_EVENT_TABLE( WinEDA_PrintSVGFrame, wxDialog )
|
||||||
|
|
||||||
////@begin WinEDA_PrintSVGFrame event table entries
|
////@begin WinEDA_PrintSVGFrame event table entries
|
||||||
EVT_CLOSE( WinEDA_PrintSVGFrame::OnCloseWindow )
|
EVT_CLOSE( WinEDA_PrintSVGFrame::OnCloseWindow )
|
||||||
|
|
||||||
EVT_RADIOBOX( ID_RADIOBOX_SETPRINTMODE, WinEDA_PrintSVGFrame::OnRadioboxSetprintmodeSelected )
|
EVT_RADIOBOX( ID_RADIOBOX_SETPRINTMODE, WinEDA_PrintSVGFrame::OnRadioboxSetprintmodeSelected )
|
||||||
|
|
||||||
EVT_BUTTON( ID_PRINT_EXECUTE, WinEDA_PrintSVGFrame::OnPrintExecuteClick )
|
EVT_BUTTON( ID_PRINT_EXECUTE, WinEDA_PrintSVGFrame::OnPrintExecuteClick )
|
||||||
|
|
||||||
EVT_BUTTON( wxID_CLOSE, WinEDA_PrintSVGFrame::OnCloseClick )
|
EVT_BUTTON( wxID_CLOSE, WinEDA_PrintSVGFrame::OnCloseClick )
|
||||||
|
|
||||||
////@end WinEDA_PrintSVGFrame event table entries
|
////@end WinEDA_PrintSVGFrame event table entries
|
||||||
|
|
||||||
|
@ -116,31 +119,41 @@ END_EVENT_TABLE()
|
||||||
* WinEDA_PrintSVGFrame constructors
|
* WinEDA_PrintSVGFrame constructors
|
||||||
*/
|
*/
|
||||||
|
|
||||||
WinEDA_PrintSVGFrame::WinEDA_PrintSVGFrame( )
|
WinEDA_PrintSVGFrame::WinEDA_PrintSVGFrame()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WinEDA_PrintSVGFrame::WinEDA_PrintSVGFrame( WinEDA_DrawFrame* parent,
|
WinEDA_PrintSVGFrame::WinEDA_PrintSVGFrame( WinEDA_DrawFrame* parent,
|
||||||
wxWindowID id, const wxString& caption, const wxPoint& pos,
|
wxWindowID id,
|
||||||
const wxSize& size, long style )
|
const wxString& caption,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
|
long style )
|
||||||
{
|
{
|
||||||
m_Parent = parent;
|
m_Parent = parent;
|
||||||
m_ImageXSize_mm = 270;
|
m_ImageXSize_mm = 270;
|
||||||
wxConfig * Config = m_Parent->m_Parent->m_EDA_Config;
|
wxConfig* Config = m_Parent->m_Parent->m_EDA_Config;
|
||||||
if ( Config )
|
if( Config )
|
||||||
{
|
{
|
||||||
Config->Read(wxT("PlotSVGPenWidth"), &s_SVGPenMinWidth);
|
Config->Read( wxT( "PlotSVGPenWidth" ), &s_SVGPenMinWidth );
|
||||||
Config->Read(wxT("PlotSVGModeColor"), &s_PlotBlackAndWhite);
|
Config->Read( wxT( "PlotSVGModeColor" ), &s_PlotBlackAndWhite );
|
||||||
}
|
}
|
||||||
|
|
||||||
Create(parent, id, caption, pos, size, style);
|
Create( parent, id, caption, pos, size, style );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* WinEDA_PrintSVGFrame creator
|
* WinEDA_PrintSVGFrame creator
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool WinEDA_PrintSVGFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
|
bool WinEDA_PrintSVGFrame::Create( wxWindow* parent,
|
||||||
|
wxWindowID id,
|
||||||
|
const wxString& caption,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
|
long style )
|
||||||
{
|
{
|
||||||
////@begin WinEDA_PrintSVGFrame member initialisation
|
////@begin WinEDA_PrintSVGFrame member initialisation
|
||||||
m_DialogPenWidthSizer = NULL;
|
m_DialogPenWidthSizer = NULL;
|
||||||
|
@ -149,103 +162,149 @@ bool WinEDA_PrintSVGFrame::Create( wxWindow* parent, wxWindowID id, const wxStri
|
||||||
m_PagesOption = NULL;
|
m_PagesOption = NULL;
|
||||||
m_FileNameCtrl = NULL;
|
m_FileNameCtrl = NULL;
|
||||||
m_MessagesBox = NULL;
|
m_MessagesBox = NULL;
|
||||||
|
|
||||||
////@end WinEDA_PrintSVGFrame member initialisation
|
////@end WinEDA_PrintSVGFrame member initialisation
|
||||||
|
|
||||||
////@begin WinEDA_PrintSVGFrame creation
|
////@begin WinEDA_PrintSVGFrame creation
|
||||||
SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS);
|
SetExtraStyle( GetExtraStyle() | wxWS_EX_BLOCK_EVENTS );
|
||||||
wxDialog::Create( parent, id, caption, pos, size, style );
|
wxDialog::Create( parent, id, caption, pos, size, style );
|
||||||
|
|
||||||
CreateControls();
|
CreateControls();
|
||||||
if (GetSizer())
|
if( GetSizer() )
|
||||||
{
|
{
|
||||||
GetSizer()->SetSizeHints(this);
|
GetSizer()->SetSizeHints( this );
|
||||||
}
|
}
|
||||||
Centre();
|
Centre();
|
||||||
|
|
||||||
////@end WinEDA_PrintSVGFrame creation
|
////@end WinEDA_PrintSVGFrame creation
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Control creation for WinEDA_PrintSVGFrame
|
* Control creation for WinEDA_PrintSVGFrame
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void WinEDA_PrintSVGFrame::CreateControls()
|
void WinEDA_PrintSVGFrame::CreateControls()
|
||||||
{
|
{
|
||||||
SetFont(*g_DialogFont);
|
SetFont( *g_DialogFont );
|
||||||
|
|
||||||
////@begin WinEDA_PrintSVGFrame content construction
|
////@begin WinEDA_PrintSVGFrame content construction
|
||||||
// Generated by DialogBlocks, 24/01/2007 19:00:23 (unregistered)
|
// Generated by DialogBlocks, 24/01/2007 19:00:23 (unregistered)
|
||||||
|
|
||||||
WinEDA_PrintSVGFrame* itemDialog1 = this;
|
WinEDA_PrintSVGFrame* itemDialog1 = this;
|
||||||
|
|
||||||
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxVERTICAL );
|
||||||
itemDialog1->SetSizer(itemBoxSizer2);
|
|
||||||
|
|
||||||
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
|
itemDialog1->SetSizer( itemBoxSizer2 );
|
||||||
itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
|
|
||||||
|
|
||||||
wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer( wxHORIZONTAL );
|
||||||
itemBoxSizer3->Add(itemBoxSizer4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
|
||||||
|
|
||||||
m_DialogPenWidthSizer = new wxBoxSizer(wxVERTICAL);
|
itemBoxSizer2->Add( itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
|
||||||
itemBoxSizer4->Add(m_DialogPenWidthSizer, 0, wxGROW|wxALL, 5);
|
|
||||||
|
wxBoxSizer* itemBoxSizer4 = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
|
itemBoxSizer3->Add( itemBoxSizer4, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
||||||
|
|
||||||
|
m_DialogPenWidthSizer = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
|
itemBoxSizer4->Add( m_DialogPenWidthSizer, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
wxString m_ModeColorOptionStrings[] = {
|
wxString m_ModeColorOptionStrings[] = {
|
||||||
_("Color"),
|
_( "Color" ),
|
||||||
_("Black and White")
|
_( "Black and White" )
|
||||||
};
|
};
|
||||||
m_ModeColorOption = new wxRadioBox( itemDialog1, ID_RADIOBOX_SETPRINTMODE, _("Print mode"), wxDefaultPosition, wxDefaultSize, 2, m_ModeColorOptionStrings, 1, wxRA_SPECIFY_COLS );
|
m_ModeColorOption = new wxRadioBox( itemDialog1, ID_RADIOBOX_SETPRINTMODE, _(
|
||||||
m_ModeColorOption->SetSelection(0);
|
"Print mode" ), wxDefaultPosition, wxDefaultSize, 2,
|
||||||
itemBoxSizer4->Add(m_ModeColorOption, 0, wxALIGN_LEFT|wxALL, 5);
|
m_ModeColorOptionStrings, 1,
|
||||||
|
wxRA_SPECIFY_COLS );
|
||||||
|
|
||||||
m_Print_Sheet_Ref = new wxCheckBox( itemDialog1, ID_CHECKBOX, _("Print Sheet Ref"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
|
m_ModeColorOption->SetSelection( 0 );
|
||||||
m_Print_Sheet_Ref->SetValue(false);
|
itemBoxSizer4->Add( m_ModeColorOption, 0, wxALIGN_LEFT | wxALL, 5 );
|
||||||
itemBoxSizer4->Add(m_Print_Sheet_Ref, 0, wxALIGN_LEFT|wxALL, 5);
|
|
||||||
|
|
||||||
itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 15);
|
m_Print_Sheet_Ref = new wxCheckBox( itemDialog1, ID_CHECKBOX, _(
|
||||||
|
"Print Sheet Ref" ), wxDefaultPosition, wxDefaultSize,
|
||||||
|
wxCHK_2STATE );
|
||||||
|
|
||||||
wxBoxSizer* itemBoxSizer9 = new wxBoxSizer(wxVERTICAL);
|
m_Print_Sheet_Ref->SetValue( false );
|
||||||
itemBoxSizer3->Add(itemBoxSizer9, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
itemBoxSizer4->Add( m_Print_Sheet_Ref, 0, wxALIGN_LEFT | wxALL, 5 );
|
||||||
|
|
||||||
|
itemBoxSizer3->Add( 5, 5, 0, wxALIGN_CENTER_VERTICAL | wxALL, 15 );
|
||||||
|
|
||||||
|
wxBoxSizer* itemBoxSizer9 = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
|
itemBoxSizer3->Add( itemBoxSizer9, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
||||||
|
|
||||||
wxString m_PagesOptionStrings[] = {
|
wxString m_PagesOptionStrings[] = {
|
||||||
_("Current"),
|
_( "Current" ),
|
||||||
_("All")
|
_( "All" )
|
||||||
};
|
};
|
||||||
m_PagesOption = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _("Page Print:"), wxDefaultPosition, wxDefaultSize, 2, m_PagesOptionStrings, 1, wxRA_SPECIFY_COLS );
|
m_PagesOption = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _(
|
||||||
m_PagesOption->SetSelection(0);
|
"Page Print:" ), wxDefaultPosition,
|
||||||
itemBoxSizer9->Add(m_PagesOption, 0, wxALIGN_LEFT|wxALL, 5);
|
wxDefaultSize, 2, m_PagesOptionStrings, 1,
|
||||||
|
wxRA_SPECIFY_COLS );
|
||||||
|
|
||||||
|
m_PagesOption->SetSelection( 0 );
|
||||||
|
itemBoxSizer9->Add( m_PagesOption, 0, wxALIGN_LEFT | wxALL, 5 );
|
||||||
|
|
||||||
|
wxButton* itemButton11 = new wxButton( itemDialog1, ID_PRINT_EXECUTE, _(
|
||||||
|
"Create &File" ), wxDefaultPosition,
|
||||||
|
wxDefaultSize, 0 );
|
||||||
|
|
||||||
wxButton* itemButton11 = new wxButton( itemDialog1, ID_PRINT_EXECUTE, _("Create &File"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
itemButton11->SetDefault();
|
itemButton11->SetDefault();
|
||||||
itemButton11->SetForegroundColour(wxColour(0, 128, 0));
|
itemButton11->SetForegroundColour( wxColour( 0, 128, 0 ) );
|
||||||
itemBoxSizer9->Add(itemButton11, 0, wxGROW|wxALL, 5);
|
itemBoxSizer9->Add( itemButton11, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
wxButton* itemButton12 = new wxButton( itemDialog1, wxID_CLOSE, _("&Close"), wxDefaultPosition, wxDefaultSize, 0 );
|
wxButton* itemButton12 = new wxButton( itemDialog1, wxID_CLOSE, _(
|
||||||
itemButton12->SetForegroundColour(wxColour(0, 0, 198));
|
"&Close" ), wxDefaultPosition,
|
||||||
itemBoxSizer9->Add(itemButton12, 0, wxGROW|wxALL, 5);
|
wxDefaultSize, 0 );
|
||||||
|
|
||||||
wxStaticText* itemStaticText13 = new wxStaticText( itemDialog1, wxID_STATIC, _("Filename:"), wxDefaultPosition, wxDefaultSize, 0 );
|
itemButton12->SetForegroundColour( wxColour( 0, 0, 198 ) );
|
||||||
itemBoxSizer2->Add(itemStaticText13, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
|
itemBoxSizer9->Add( itemButton12, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
m_FileNameCtrl = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
|
wxStaticText* itemStaticText13 = new wxStaticText( itemDialog1, wxID_STATIC, _(
|
||||||
itemBoxSizer2->Add(m_FileNameCtrl, 0, wxGROW|wxALL, 5);
|
"Filename:" ), wxDefaultPosition,
|
||||||
|
wxDefaultSize, 0 );
|
||||||
|
|
||||||
wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1, wxID_STATIC, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 );
|
itemBoxSizer2->Add( itemStaticText13,
|
||||||
itemBoxSizer2->Add(itemStaticText15, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
|
0,
|
||||||
|
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
|
||||||
|
5 );
|
||||||
|
|
||||||
m_MessagesBox = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxSize(-1, 100), wxTE_MULTILINE|wxTE_READONLY );
|
m_FileNameCtrl = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(
|
||||||
itemBoxSizer2->Add(m_MessagesBox, 0, wxGROW|wxALL, 5);
|
"" ), wxDefaultPosition, wxDefaultSize,
|
||||||
|
0 );
|
||||||
|
|
||||||
|
itemBoxSizer2->Add( m_FileNameCtrl, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
|
wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1, wxID_STATIC, _(
|
||||||
|
"Messages:" ), wxDefaultPosition,
|
||||||
|
wxDefaultSize, 0 );
|
||||||
|
|
||||||
|
itemBoxSizer2->Add( itemStaticText15,
|
||||||
|
0,
|
||||||
|
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
|
||||||
|
5 );
|
||||||
|
|
||||||
|
m_MessagesBox = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(
|
||||||
|
"" ), wxDefaultPosition, wxSize( -1,
|
||||||
|
100 ), wxTE_MULTILINE | wxTE_READONLY );
|
||||||
|
|
||||||
|
itemBoxSizer2->Add( m_MessagesBox, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
// Set validators
|
// Set validators
|
||||||
m_ModeColorOption->SetValidator( wxGenericValidator(& s_PlotBlackAndWhite) );
|
m_ModeColorOption->SetValidator( wxGenericValidator( &s_PlotBlackAndWhite ) );
|
||||||
m_Print_Sheet_Ref->SetValidator( wxGenericValidator(& Print_Sheet_Ref) );
|
m_Print_Sheet_Ref->SetValidator( wxGenericValidator( &Print_Sheet_Ref ) );
|
||||||
|
|
||||||
////@end WinEDA_PrintSVGFrame content construction
|
////@end WinEDA_PrintSVGFrame content construction
|
||||||
|
|
||||||
m_DialogPenWidth = new WinEDA_ValueCtrl(this, _("Pen width mini"), s_SVGPenMinWidth,
|
m_DialogPenWidth = new WinEDA_ValueCtrl( this, _(
|
||||||
g_UnitMetric, m_DialogPenWidthSizer, m_Parent->m_InternalUnits);
|
"Pen width mini" ), s_SVGPenMinWidth,
|
||||||
|
g_UnitMetric, m_DialogPenWidthSizer,
|
||||||
|
m_Parent->m_InternalUnits );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Should we show tooltips?
|
* Should we show tooltips?
|
||||||
*/
|
*/
|
||||||
|
@ -255,6 +314,7 @@ bool WinEDA_PrintSVGFrame::ShowToolTips()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Get bitmap resources
|
* Get bitmap resources
|
||||||
*/
|
*/
|
||||||
|
@ -263,11 +323,13 @@ wxBitmap WinEDA_PrintSVGFrame::GetBitmapResource( const wxString& name )
|
||||||
{
|
{
|
||||||
// Bitmap retrieval
|
// Bitmap retrieval
|
||||||
////@begin WinEDA_PrintSVGFrame bitmap retrieval
|
////@begin WinEDA_PrintSVGFrame bitmap retrieval
|
||||||
wxUnusedVar(name);
|
wxUnusedVar( name );
|
||||||
return wxNullBitmap;
|
return wxNullBitmap;
|
||||||
|
|
||||||
////@end WinEDA_PrintSVGFrame bitmap retrieval
|
////@end WinEDA_PrintSVGFrame bitmap retrieval
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Get icon resources
|
* Get icon resources
|
||||||
*/
|
*/
|
||||||
|
@ -276,8 +338,9 @@ wxIcon WinEDA_PrintSVGFrame::GetIconResource( const wxString& name )
|
||||||
{
|
{
|
||||||
// Icon retrieval
|
// Icon retrieval
|
||||||
////@begin WinEDA_PrintSVGFrame icon retrieval
|
////@begin WinEDA_PrintSVGFrame icon retrieval
|
||||||
wxUnusedVar(name);
|
wxUnusedVar( name );
|
||||||
return wxNullIcon;
|
return wxNullIcon;
|
||||||
|
|
||||||
////@end WinEDA_PrintSVGFrame icon retrieval
|
////@end WinEDA_PrintSVGFrame icon retrieval
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,10 +349,10 @@ wxIcon WinEDA_PrintSVGFrame::GetIconResource( const wxString& name )
|
||||||
wxString WinEDA_PrintSVGFrame::ReturnFullFileName()
|
wxString WinEDA_PrintSVGFrame::ReturnFullFileName()
|
||||||
/******************************************************/
|
/******************************************************/
|
||||||
{
|
{
|
||||||
wxString name, ext;
|
wxString name, ext;
|
||||||
|
|
||||||
name = m_Parent->GetScreen()->m_FileName;
|
name = m_Parent->GetScreen()->m_FileName;
|
||||||
ChangeFileNameExt(name, wxT(".svg"));
|
ChangeFileNameExt( name, wxT( ".svg" ) );
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,104 +362,116 @@ void WinEDA_PrintSVGFrame::SetPenWidth()
|
||||||
/********************************************/
|
/********************************************/
|
||||||
{
|
{
|
||||||
s_SVGPenMinWidth = m_DialogPenWidth->GetValue();
|
s_SVGPenMinWidth = m_DialogPenWidth->GetValue();
|
||||||
if ( s_SVGPenMinWidth > WIDTH_MAX_VALUE )
|
|
||||||
|
if( s_SVGPenMinWidth > WIDTH_MAX_VALUE )
|
||||||
{
|
{
|
||||||
s_SVGPenMinWidth = WIDTH_MAX_VALUE;
|
s_SVGPenMinWidth = WIDTH_MAX_VALUE;
|
||||||
}
|
}
|
||||||
if ( s_SVGPenMinWidth < WIDTH_MIN_VALUE )
|
|
||||||
|
if( s_SVGPenMinWidth < WIDTH_MIN_VALUE )
|
||||||
{
|
{
|
||||||
s_SVGPenMinWidth = WIDTH_MIN_VALUE;
|
s_SVGPenMinWidth = WIDTH_MIN_VALUE;
|
||||||
}
|
}
|
||||||
m_DialogPenWidth->SetValue(s_SVGPenMinWidth);
|
|
||||||
|
m_DialogPenWidth->SetValue( s_SVGPenMinWidth );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**************************************************************/
|
||||||
|
void WinEDA_PrintSVGFrame::PrintSVGDoc( wxCommandEvent& event )
|
||||||
|
/**************************************************************/
|
||||||
|
|
||||||
/**************************************************************/
|
|
||||||
void WinEDA_PrintSVGFrame::PrintSVGDoc(wxCommandEvent& event)
|
|
||||||
/**************************************************************/
|
|
||||||
/* Called on activate "Print CURRENT" button
|
/* Called on activate "Print CURRENT" button
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
bool print_ref = TRUE;
|
bool print_ref = TRUE;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
Select_PrintAll = FALSE;
|
Select_PrintAll = FALSE;
|
||||||
if ( m_PagesOption && (m_PagesOption->GetSelection() == 1) )
|
if( m_PagesOption && (m_PagesOption->GetSelection() == 1) )
|
||||||
Select_PrintAll = TRUE;
|
Select_PrintAll = TRUE;
|
||||||
|
|
||||||
if ( (m_Print_Sheet_Ref == NULL) || (m_Print_Sheet_Ref->GetValue() == FALSE) )
|
if( (m_Print_Sheet_Ref == NULL) || (m_Print_Sheet_Ref->GetValue() == FALSE) )
|
||||||
print_ref = FALSE;
|
print_ref = FALSE;
|
||||||
|
|
||||||
SetPenWidth();
|
SetPenWidth();
|
||||||
|
|
||||||
|
|
||||||
BASE_SCREEN * screen = m_Parent->GetScreen();
|
BASE_SCREEN* screen = m_Parent->GetScreen();
|
||||||
BASE_SCREEN *oldscreen = screen;
|
BASE_SCREEN* oldscreen = screen;
|
||||||
#ifndef EESCHEMA
|
#ifndef EESCHEMA
|
||||||
if( Select_PrintAll )
|
if( Select_PrintAll )
|
||||||
while ( screen->Pback ) screen = (BASE_SCREEN *) screen->Pback;
|
while( screen->Pback )
|
||||||
|
screen = (BASE_SCREEN*) screen->Pback;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( (m_Parent->m_Ident == PCB_FRAME) || (m_Parent->m_Ident == GERBER_FRAME) )
|
if( (m_Parent->m_Ident == PCB_FRAME) || (m_Parent->m_Ident == GERBER_FRAME) )
|
||||||
{
|
{
|
||||||
if( Select_PrintAll )
|
if( Select_PrintAll )
|
||||||
{
|
{
|
||||||
m_PrintMaskLayer = 0xFFFFFFFF;
|
m_PrintMaskLayer = 0xFFFFFFFF;
|
||||||
}
|
}
|
||||||
else m_PrintMaskLayer = 1;
|
else
|
||||||
|
m_PrintMaskLayer = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (screen == NULL) return;
|
if( screen == NULL )
|
||||||
|
return;
|
||||||
|
|
||||||
#ifdef EESCHEMA
|
#ifdef EESCHEMA
|
||||||
if ( Select_PrintAll && m_Parent->m_Ident == SCHEMATIC_FRAME )
|
if( Select_PrintAll && m_Parent->m_Ident == SCHEMATIC_FRAME )
|
||||||
{
|
{
|
||||||
EDA_ScreenList ScreenList;
|
EDA_ScreenList ScreenList;
|
||||||
for ( SCH_SCREEN * schscreen = ScreenList.GetFirst(); schscreen != NULL;
|
for( SCH_SCREEN* schscreen = ScreenList.GetFirst(); schscreen != NULL;
|
||||||
schscreen = ScreenList.GetNext() )
|
schscreen = ScreenList.GetNext() )
|
||||||
{
|
{
|
||||||
/* Create all files *.svg */
|
/* Create all files *.svg */
|
||||||
((WinEDA_SchematicFrame*)m_Parent)->SetScreen(schscreen);
|
( (WinEDA_SchematicFrame*) m_Parent )->SetScreen( schscreen );
|
||||||
wxString FullFileName = schscreen->m_FileName;
|
wxString FullFileName = schscreen->m_FileName;
|
||||||
ChangeFileNameExt(FullFileName, wxT(".svg"));
|
ChangeFileNameExt( FullFileName, wxT( ".svg" ) );
|
||||||
bool success = DrawPage(FullFileName, schscreen);
|
bool success = DrawPage( FullFileName, schscreen );
|
||||||
msg = _("Create file ") + FullFileName;
|
msg = _( "Create file " ) + FullFileName;
|
||||||
if ( ! success ) msg += _(" error");
|
if( !success )
|
||||||
msg += wxT("\n");
|
msg += _( " error" );
|
||||||
m_MessagesBox->AppendText(msg);
|
msg += wxT( "\n" );
|
||||||
|
m_MessagesBox->AppendText( msg );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
wxString FullFileName = m_FileNameCtrl->GetValue();
|
wxString FullFileName = m_FileNameCtrl->GetValue();
|
||||||
if ( FullFileName.IsEmpty() ){
|
if( FullFileName.IsEmpty() )
|
||||||
|
{
|
||||||
FullFileName = screen->m_FileName;
|
FullFileName = screen->m_FileName;
|
||||||
ChangeFileNameExt(FullFileName, wxT(".svg"));
|
ChangeFileNameExt( FullFileName, wxT( ".svg" ) );
|
||||||
}
|
}
|
||||||
bool success = DrawPage(FullFileName, screen);
|
bool success = DrawPage( FullFileName, screen );
|
||||||
msg = _("Create file ") + FullFileName;
|
msg = _( "Create file " ) + FullFileName;
|
||||||
if ( ! success ) msg += _(" error");
|
if( !success )
|
||||||
msg += wxT("\n");
|
msg += _( " error" );
|
||||||
m_MessagesBox->AppendText(msg);
|
msg += wxT( "\n" );
|
||||||
|
m_MessagesBox->AppendText( msg );
|
||||||
}
|
}
|
||||||
ActiveScreen = oldscreen;
|
ActiveScreen = oldscreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
bool WinEDA_PrintSVGFrame::DrawPage(const wxString & FullFileName, BASE_SCREEN* screen)
|
bool WinEDA_PrintSVGFrame::DrawPage( const wxString& FullFileName, BASE_SCREEN* screen )
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Routine effective d'impression
|
* Routine effective d'impression
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int tmpzoom;
|
int tmpzoom;
|
||||||
wxPoint tmp_startvisu;
|
wxPoint tmp_startvisu;
|
||||||
wxSize SheetSize; // Sheet size in internal units
|
wxSize SheetSize; // Sheet size in internal units
|
||||||
wxPoint old_org;
|
wxPoint old_org;
|
||||||
float dpi;
|
float dpi;
|
||||||
bool success = TRUE;
|
bool success = TRUE;
|
||||||
|
|
||||||
/* modification des cadrages et reglages locaux */
|
/* modification des cadrages et reglages locaux */
|
||||||
tmp_startvisu = screen->m_StartVisu;
|
tmp_startvisu = screen->m_StartVisu;
|
||||||
|
@ -408,66 +483,67 @@ bool success = TRUE;
|
||||||
SheetSize.x *= m_Parent->m_InternalUnits / 1000;
|
SheetSize.x *= m_Parent->m_InternalUnits / 1000;
|
||||||
SheetSize.y *= m_Parent->m_InternalUnits / 1000; // size in pixels
|
SheetSize.y *= m_Parent->m_InternalUnits / 1000; // size in pixels
|
||||||
|
|
||||||
screen->SetZoom(1);
|
screen->SetZoom( 1 );
|
||||||
dpi = (float)SheetSize.x * 25.4 /m_ImageXSize_mm;
|
dpi = (float) SheetSize.x * 25.4 / m_ImageXSize_mm;
|
||||||
|
|
||||||
WinEDA_DrawPanel * panel = m_Parent->DrawPanel;
|
WinEDA_DrawPanel* panel = m_Parent->DrawPanel;
|
||||||
|
|
||||||
wxSVGFileDC dc(FullFileName, SheetSize.x, SheetSize.y, dpi) ;
|
wxSVGFileDC dc( FullFileName, SheetSize.x, SheetSize.y, dpi );
|
||||||
|
|
||||||
if ( ! dc.Ok() )
|
if( !dc.Ok() )
|
||||||
{
|
{
|
||||||
DisplayError(this, wxT("SVGprint error: wxSVGFileDC not OK"));
|
DisplayError( this, wxT( "SVGprint error: wxSVGFileDC not OK" ) );
|
||||||
success = FALSE;
|
success = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EDA_Rect tmp = panel->m_ClipBox;
|
EDA_Rect tmp = panel->m_ClipBox;
|
||||||
GRResetPenAndBrush(&dc);
|
GRResetPenAndBrush( &dc );
|
||||||
s_SVGPenMinWidth = m_DialogPenWidth->GetValue();
|
s_SVGPenMinWidth = m_DialogPenWidth->GetValue();
|
||||||
SetPenMinWidth(s_SVGPenMinWidth);
|
SetPenMinWidth( s_SVGPenMinWidth );
|
||||||
GRForceBlackPen( m_ModeColorOption->GetSelection() == 0 ? FALSE : TRUE );
|
GRForceBlackPen( m_ModeColorOption->GetSelection() == 0 ? FALSE : TRUE );
|
||||||
|
|
||||||
|
|
||||||
panel->m_ClipBox.SetX(0);panel->m_ClipBox.SetY(0);
|
panel->m_ClipBox.SetX( 0 ); panel->m_ClipBox.SetY( 0 );
|
||||||
panel->m_ClipBox.SetWidth(0x7FFFFF0); panel->m_ClipBox.SetHeight(0x7FFFFF0);
|
panel->m_ClipBox.SetWidth( 0x7FFFFF0 ); panel->m_ClipBox.SetHeight( 0x7FFFFF0 );
|
||||||
|
|
||||||
g_IsPrinting = TRUE;
|
g_IsPrinting = TRUE;
|
||||||
setlocale(LC_NUMERIC, "C"); // Switch the locale to standard C (needed to print floating point numbers like 1.3)
|
setlocale( LC_NUMERIC, "C" ); // Switch the locale to standard C (needed to print floating point numbers like 1.3)
|
||||||
panel->PrintPage(&dc, m_Print_Sheet_Ref, m_PrintMaskLayer);
|
panel->PrintPage( &dc, m_Print_Sheet_Ref, m_PrintMaskLayer );
|
||||||
setlocale(LC_NUMERIC, ""); // revert to the current locale
|
setlocale( LC_NUMERIC, "" ); // revert to the current locale
|
||||||
g_IsPrinting = FALSE;
|
g_IsPrinting = FALSE;
|
||||||
panel->m_ClipBox = tmp;
|
panel->m_ClipBox = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GRForceBlackPen(FALSE);
|
GRForceBlackPen( FALSE );
|
||||||
SetPenMinWidth(1);
|
SetPenMinWidth( 1 );
|
||||||
|
|
||||||
screen->m_StartVisu = tmp_startvisu;
|
screen->m_StartVisu = tmp_startvisu;
|
||||||
screen->m_DrawOrg = old_org;
|
screen->m_DrawOrg = old_org;
|
||||||
screen->SetZoom(tmpzoom);
|
screen->SetZoom( tmpzoom );
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PRINT_EXECUTE
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PRINT_EXECUTE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void WinEDA_PrintSVGFrame::OnPrintExecuteClick( wxCommandEvent& event )
|
void WinEDA_PrintSVGFrame::OnPrintExecuteClick( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
PrintSVGDoc(event);
|
PrintSVGDoc( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CLOSE
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CLOSE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void WinEDA_PrintSVGFrame::OnCloseClick( wxCommandEvent& event )
|
void WinEDA_PrintSVGFrame::OnCloseClick( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
Close(TRUE);
|
Close( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -477,19 +553,18 @@ void WinEDA_PrintSVGFrame::OnCloseClick( wxCommandEvent& event )
|
||||||
|
|
||||||
void WinEDA_PrintSVGFrame::OnCloseWindow( wxCloseEvent& event )
|
void WinEDA_PrintSVGFrame::OnCloseWindow( wxCloseEvent& event )
|
||||||
{
|
{
|
||||||
wxConfig * Config = m_Parent->m_Parent->m_EDA_Config;
|
wxConfig* Config = m_Parent->m_Parent->m_EDA_Config;
|
||||||
if ( Config )
|
|
||||||
|
if( Config )
|
||||||
{
|
{
|
||||||
s_PlotBlackAndWhite = m_ModeColorOption->GetSelection();
|
s_PlotBlackAndWhite = m_ModeColorOption->GetSelection();
|
||||||
Config->Write(wxT("PlotSVGPenWidth"), s_SVGPenMinWidth);
|
Config->Write( wxT( "PlotSVGPenWidth" ), s_SVGPenMinWidth );
|
||||||
Config->Write(wxT("PlotSVGModeColor"), s_PlotBlackAndWhite);
|
Config->Write( wxT( "PlotSVGModeColor" ), s_PlotBlackAndWhite );
|
||||||
}
|
}
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_RADIOBOX_SETPRINTMODE
|
* wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_RADIOBOX_SETPRINTMODE
|
||||||
*/
|
*/
|
||||||
|
@ -499,5 +574,3 @@ void WinEDA_PrintSVGFrame::OnRadioboxSetprintmodeSelected( wxCommandEvent& event
|
||||||
s_PlotBlackAndWhite = m_ModeColorOption->GetSelection();
|
s_PlotBlackAndWhite = m_ModeColorOption->GetSelection();
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue