Commit 37ee2394 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: in SVG export, add option to export only the board area, not the full page.

dialog plot functions: fix compil warnings with wxWidgets 2.8
parent ba6da604
......@@ -119,24 +119,25 @@ wxString wxBrushString(wxColour c, int style = wxBRUSHSTYLE_SOLID)
IMPLEMENT_ABSTRACT_CLASS(KicadSVGFileDCImpl, wxDC)
KicadSVGFileDCImpl::KicadSVGFileDCImpl( KicadSVGFileDC *owner, const wxString &filename,
int width, int height, double dpi ) :
KicadSVGFileDCImpl::KicadSVGFileDCImpl( KicadSVGFileDC *owner, const wxString &aFilename,
wxPoint aOrigin, wxSize aSize, double aDpi ) :
wxDCImpl( owner )
{
Init( filename, width, height, dpi );
Init( aFilename, aOrigin, aSize, aDpi );
}
void KicadSVGFileDCImpl::Init (const wxString &filename, int Width, int Height, double dpi)
void KicadSVGFileDCImpl::Init ( const wxString &aFilename,
wxPoint aOrigin, wxSize aSize, double aDpi)
{
m_width = Width;
m_height = Height;
m_width = aSize.x;
m_height = aSize.y;
m_dpi = dpi;
m_dpi = aDpi;
m_OK = true;
m_mm_to_pix_x = dpi/25.4;
m_mm_to_pix_y = dpi/25.4;
m_mm_to_pix_x = m_dpi/25.4;
m_mm_to_pix_y = m_dpi/25.4;
m_backgroundBrush = *wxTRANSPARENT_BRUSH;
m_textForegroundColour = *wxBLACK;
......@@ -151,11 +152,11 @@ void KicadSVGFileDCImpl::Init (const wxString &filename, int Width, int Height,
////////////////////code here
m_outfile = new wxFileOutputStream(filename);
m_outfile = new wxFileOutputStream(aFilename);
m_OK = m_outfile->IsOk();
if (m_OK)
{
m_filename = filename;
m_filename = aFilename;
m_sub_images = 0;
wxString s;
s = wxT("<?xml version=\"1.0\" standalone=\"no\"?>") + wxString(wxT("\n"));
......@@ -166,9 +167,11 @@ void KicadSVGFileDCImpl::Init (const wxString &filename, int Width, int Height,
write(s);
s = wxT("<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" ") + wxString(wxT("\n"));
write(s);
s.Printf( wxT(" width=\"%scm\" height=\"%scm\" viewBox=\"0 0 %d %d \"> \n"), NumStr(float(Width)/dpi*2.54), NumStr(float(Height)/dpi*2.54), Width, Height );
s.Printf( wxT(" width=\"%scm\" height=\"%scm\" viewBox=\"%d %d %d %d \"> \n"),
NumStr(float(m_width)/m_dpi*2.54), NumStr(float(m_height)/m_dpi*2.54),
aOrigin.x, aOrigin.y, m_width, m_height );
write(s);
s = wxT("<title>SVG Picture created as ") + wxFileName(filename).GetFullName() + wxT(" </title>") + wxT("\n");
s = wxT("<title>SVG Picture created as ") + wxFileName(m_filename).GetFullName() + wxT(" </title>") + wxT("\n");
write(s);
s = wxString (wxT("<desc>Picture generated by wxSVG ")) + wxSVGVersion + wxT(" </desc>")+ wxT("\n");
write(s);
......@@ -738,27 +741,28 @@ wxString wxBrushString( wxColour c, int style )
/***********************************************************************/
void wxSVGFileDC::Init( wxString f, int Width, int Height, float dpi )
void wxSVGFileDC::Init( const wxString& aFilename,
wxPoint aOrigin, wxSize aSize, double aDpi )
/***********************************************************************/
/* set up things first wxDCBase does all this?
*/
{
m_width = Width;
m_height = Height;
m_width = aSize.x;
m_height = aSize.y;
m_clipping = false;
m_OK = true;
m_mm_to_pix_x = dpi / 25.4;
m_mm_to_pix_y = dpi / 25.4;
m_mm_to_pix_x = aDpi / 25.4;
m_mm_to_pix_y = aDpi / 25.4;
m_signX = m_signY = 1;
m_userScaleX = m_userScaleY =
m_deviceOriginX = m_deviceOriginY = 0;
m_OriginX = m_OriginY = 0;
m_OriginX = m_OriginY = 0;
m_logicalOriginX = m_logicalOriginY = 0;
m_logicalScaleX = m_logicalScaleY = 0;
m_scaleX = m_scaleY = 1.0;
......@@ -780,11 +784,11 @@ void wxSVGFileDC::Init( wxString f, int Width, int Height, float dpi )
////////////////////code here
m_outfile = new wxFileOutputStream( f );
m_outfile = new wxFileOutputStream( aFilename );
m_OK = m_outfile->Ok();
if( m_OK )
{
m_filename = f;
m_filename = aFilename;
m_sub_images = 0;
wxString s;
s = wxT( "<?xml version=\"1.0\" standalone=\"no\"?>" ); s = s + newline;
......@@ -800,13 +804,14 @@ void wxSVGFileDC::Init( wxString f, int Width, int Height, float dpi )
write( s );
s.Printf( wxT( " version=\"1.1\"\n" ) );
write( s );
s.Printf( wxT( " width=\"%gin\" height=\"%gin\" viewBox=\"0 0 %d %d \"\n" ),
double (Width) / dpi, double (Height) / dpi, Width, Height );
s.Printf( wxT( " width=\"%gin\" height=\"%gin\" viewBox=\"%d %d %d %d \"\n" ),
double (m_width) / aDpi, double (m_height) / aDpi,
aOrigin.x, aOrigin.y, aSize.x, aSize.y );
write( s );
s.Printf( wxT( ">\n" ) );
write( s );
s = wxT( " <title>SVG Picture created as " ) + wxFileNameFromPath( f ) +
s = wxT( " <title>SVG Picture created as " ) + wxFileNameFromPath( aFilename ) +
wxT( " </title>" ) + newline;
write( s );
s = wxString( wxT( " <desc>Picture generated by wxSVG " ) ) + wxSVGVersion + wxT(
......@@ -818,21 +823,11 @@ void wxSVGFileDC::Init( wxString f, int Width, int Height, float dpi )
}
// constructors
wxSVGFileDC::wxSVGFileDC( wxString f )
// constructor
wxSVGFileDC::wxSVGFileDC( const wxString &aFilename,
wxPoint aOrigin, wxSize aSize, double aDpi )
{
// quarter 640x480 screen display at 72 dpi
Init( f, 320, 240, 72.0 );
}
wxSVGFileDC::wxSVGFileDC( wxString f, int Width, int Height )
{
Init( f, Width, Height, 72.0 );
}
wxSVGFileDC::wxSVGFileDC( wxString f, int Width, int Height, float dpi )
{
Init( f, Width, Height, dpi );
Init( aFilename, aOrigin, aSize, aDpi);
}
wxSVGFileDC::~wxSVGFileDC()
......
This diff is collapsed.
......@@ -188,8 +188,8 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
plot_offset.x = 0;
plot_offset.y = 0;
plotFileName = schframe->GetUniqueFilenameForCurrentSheet() + '.'
+ DXF_PLOTTER::GetDefaultFileExtension();
plotFileName = schframe->GetUniqueFilenameForCurrentSheet() + wxT(".")
+ DXF_PLOTTER::GetDefaultFileExtension();
PlotOneSheetDXF( plotFileName, screen, plot_offset, 1 );
......
......@@ -336,8 +336,8 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll )
plotOffset.x = -s_Offset.x;
plotOffset.y = -s_Offset.y;
plotFileName = m_Parent->GetUniqueFilenameForCurrentSheet() + '.'
+ HPGL_PLOTTER::GetDefaultFileExtension();
plotFileName = m_Parent->GetUniqueFilenameForCurrentSheet() + wxT(".")
+ HPGL_PLOTTER::GetDefaultFileExtension();
LOCALE_IO toggle;
......
......@@ -218,8 +218,8 @@ void DIALOG_PLOT_SCHEMATIC_PDF::createPDFFile()
if( first_page ) {
wxString msg;
wxString plotFileName = m_Parent->GetUniqueFilenameForCurrentSheet() + '.'
+ PDF_PLOTTER::GetDefaultFileExtension();
wxString plotFileName = m_Parent->GetUniqueFilenameForCurrentSheet() + wxT(".")
+ PDF_PLOTTER::GetDefaultFileExtension();
msg.Printf( _( "Plot: %s " ), GetChars( plotFileName ) );
m_MsgBox->AppendText( msg );
......
......@@ -242,7 +242,7 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
plot_offset.x = 0;
plot_offset.y = 0;
plotFileName = m_Parent->GetUniqueFilenameForCurrentSheet() + '.'
plotFileName = m_Parent->GetUniqueFilenameForCurrentSheet() + wxT(".")
+ PS_PLOTTER::GetDefaultFileExtension();
plotOneSheetPS( plotFileName, screen, plotPage, plot_offset, scale );
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2012 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2012 KiCad Developers, see change_log.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
......@@ -25,7 +25,7 @@
/**
* @file getpart.cpp
* @brief Cod to handle get & place library component.
* @brief functions to get and place library components.
*/
#include <fctsys.h>
......@@ -69,11 +69,15 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibBrowser( void )
m_ViewlibFrame = new LIB_VIEW_FRAME( this, NULL, &semaphore );
// Show the library viewer frame until it is closed
while( semaphore.TryWait() == wxSEMA_BUSY ) // Wait for viewer closing event
// and disable the current frame, until the library viewer is closed
Enable(false);
// Wait for viewer closing event:
while( semaphore.TryWait() == wxSEMA_BUSY )
{
wxYield();
wxMilliSleep( 50 );
}
Enable(true);
cmpname = m_ViewlibFrame->GetSelectedComponent();
m_ViewlibFrame->Destroy();
......
......@@ -122,9 +122,6 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, wxSemaph
m_Semaphore = semaphore;
m_exportToEeschemaCmpName.Empty();
if( m_Semaphore )
MakeModal(true);
SetScreen( new SCH_SCREEN() );
GetScreen()->m_Center = true; // Center coordinate origins on screen.
LoadSettings();
......@@ -270,9 +267,8 @@ void LIB_VIEW_FRAME::OnCloseWindow( wxCloseEvent& Event )
if( m_Semaphore )
{
m_Semaphore->Post();
MakeModal(false);
// This window will be destroyed by the calling function,
// to avoid side effects
// if needed
}
else
{
......
......@@ -26,8 +26,8 @@ class WXDLLIMPEXP_FWD_CORE KicadSVGFileDC;
class WXDLLIMPEXP_CORE KicadSVGFileDCImpl : public wxDCImpl
{
public:
KicadSVGFileDCImpl( KicadSVGFileDC *owner, const wxString &filename,
int width=320, int height=240, double dpi=72.0 );
KicadSVGFileDCImpl( KicadSVGFileDC *owner, const wxString &aFilename,
wxPoint aOrigin, wxSize aSize, double aDpi );
virtual ~KicadSVGFileDCImpl();
......@@ -175,7 +175,7 @@ private:
virtual wxSize GetPPI() const;
void Init (const wxString &filename, int width, int height, double dpi);
void Init (const wxString &aFilename, wxPoint aOrigin, wxSize aSize, double aDpi);
void NewGraphics();
......@@ -198,11 +198,9 @@ private:
class WXDLLIMPEXP_CORE KicadSVGFileDC : public wxDC
{
public:
KicadSVGFileDC(const wxString& filename,
int width = 320,
int height = 240,
double dpi = 72.0)
: wxDC(new KicadSVGFileDCImpl(this, filename, width, height, dpi))
KicadSVGFileDC(const wxString& aFilename,
wxPoint aOrigin, wxSize aSize, double aDpi = 300.0)
: wxDC(new KicadSVGFileDCImpl(this, aFilename, aOrigin, aSize, aDpi))
{
}
};
......@@ -309,7 +307,8 @@ private:
wxT( "wxSVGFILEDC::DoSetClippingRegionAsRegion Call not yet implemented" ) ); return;
};
void Init( wxString f, int Width, int Height, float dpi );
void Init( const wxString& aFilename,
wxPoint aOrigin, wxSize aSize, double aDpi );
void NewGraphics();
......@@ -421,9 +420,8 @@ private:
public:
wxSVGFileDC( wxString f );
wxSVGFileDC( wxString f, int Width, int Height );
wxSVGFileDC( wxString f, int Width, int Height, float dpi );
wxSVGFileDC( const wxString& aFilename,
wxPoint aOrigin, wxSize aSize, double aDpi );
~wxSVGFileDC();
......
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_svg_print.cpp
// Author: jean-pierre Charras
// Modified by:
// Licence: GPL
/////////////////////////////////////////////////////////////////////////////
/**
* @file dialog_svg_print.cpp
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 KiCad Developers, see change_log.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
*/
#include <fctsys.h>
#include <appl_wxstruct.h>
#include <common.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <gestfich.h>
#include <dcsvg.h>
#include <wxBasePcbFrame.h>
#include <class_pcb_screen.h>
#include <macros.h>
#include <base_units.h>
#include <pcbnew.h>
......@@ -22,26 +41,23 @@
#include <printout_controler.h>
#include <class_board.h>
#include <class_edge_mod.h>
#include <class_mire.h>
#include <class_pcb_text.h>
#include <class_dimension.h>
#include <class_zone.h>
#include <dialog_SVG_print.h>
// Keys for configuration
#define PLOTSVGMODECOLOR_KEY wxT( "PlotSVGModeColor" )
#define PLOTSVGPAGESIZEOPT_KEY wxT( "PlotSVGPageOpt" )
#define PLOTSVGPLOT_BRD_EDGE_KEY wxT( "PlotSVGBrdEdge" )
// reasonnable values for default pen width (in 1/10000 inch)
#define WIDTH_MAX_VALUE 500
#define WIDTH_MIN_VALUE 1
// reasonnable values for default pen width
#define WIDTH_MAX_VALUE (2 *IU_PER_MM)
#define WIDTH_MIN_VALUE (0.05 *IU_PER_MM)
// Local variables:
static PRINT_PARAMETERS s_Parameters;
static long s_SelectedLayers = LAYER_BACK | LAYER_FRONT |
SILKSCREEN_LAYER_FRONT | SILKSCREEN_LAYER_BACK;
static long s_SelectedLayers = LAYER_BACK | LAYER_FRONT |
SILKSCREEN_LAYER_FRONT | SILKSCREEN_LAYER_BACK;
/*!
......@@ -66,15 +82,23 @@ void DIALOG_SVG_PRINT::initDialog( )
if( m_Config )
{
m_Config->Read( PLOTSVGMODECOLOR_KEY, &s_Parameters.m_Print_Black_and_White );
long ltmp;
m_Config->Read( PLOTSVGPAGESIZEOPT_KEY, &ltmp, 0 );
m_rbSvgPageSizeOpt->SetSelection( ltmp );
m_Config->Read( PLOTSVGPLOT_BRD_EDGE_KEY, &ltmp, 1 );
m_PrintBoardEdgesCtrl->SetValue(ltmp );
}
if( s_Parameters.m_Print_Black_and_White )
m_ModeColorOption->SetSelection( 1 );
else
m_ModeColorOption->SetSelection( 0 );
s_Parameters.m_PenDefaultSize = g_DrawDefaultLineThickness;
AddUnitSymbol( *m_TextPenWidth, g_UserUnit );
m_DialogPenWidth->SetValue(
m_DialogDefaultPenSize->SetValue(
ReturnStringFromValue( g_UserUnit, s_Parameters.m_PenDefaultSize ) );
m_Print_Frame_Ref_Ctrl->SetValue( s_Parameters.m_Print_Sheet_Ref );
// Create layers list
BOARD* board = m_Parent->GetBoard();
int layer;
......@@ -135,7 +159,7 @@ void DIALOG_SVG_PRINT::initDialog( )
void DIALOG_SVG_PRINT::SetPenWidth()
{
s_Parameters.m_PenDefaultSize = ReturnValueFromTextCtrl( *m_DialogPenWidth );
s_Parameters.m_PenDefaultSize = ReturnValueFromTextCtrl( *m_DialogDefaultPenSize );
if( s_Parameters.m_PenDefaultSize > WIDTH_MAX_VALUE )
{
......@@ -148,16 +172,17 @@ void DIALOG_SVG_PRINT::SetPenWidth()
}
g_DrawDefaultLineThickness = s_Parameters.m_PenDefaultSize;
m_DialogPenWidth->SetValue(
m_DialogDefaultPenSize->SetValue(
ReturnStringFromValue( g_UserUnit, s_Parameters.m_PenDefaultSize ) );
}
void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Frame_Ref )
void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll )
{
wxFileName fn;
wxString msg;
s_Parameters.m_Print_Black_and_White = m_ModeColorOption->GetSelection();
SetPenWidth();
PCB_SCREEN* screen = m_Parent->GetScreen();
......@@ -202,7 +227,7 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Frame_Ref )
fn.SetExt( wxT( "svg" ) );
bool success = DrawPage( fn.GetFullPath(), screen, aPrint_Frame_Ref );
bool success = DrawPage( fn.GetFullPath(), screen );
msg = _( "Create file " ) + fn.GetFullPath();
if( !success )
msg += _( " error" );
......@@ -219,11 +244,8 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Frame_Ref )
* Actual print function.
*/
bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
BASE_SCREEN* screen,
bool aPrint_Frame_Ref )
BASE_SCREEN* screen )
{
// const PAGE_INFO& pageInfo = m_Parent->GetPageSettings();
LOCALE_IO toggle;
int tmpzoom;
wxPoint tmp_startvisu;
......@@ -240,24 +262,23 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
screen->SetScalingFactor( 1.0 );
float dpi;
#if defined( USE_PCBNEW_NANOMETRES )
dpi = 25.4e6;
#else
dpi = 10000.0;
#endif
double dpi = IU_PER_MILS * 1000.0;
EDA_DRAW_PANEL* panel = m_Parent->GetCanvas();
// paper pageSize is in internal units, either nanometers or deci-mils
wxSize pageSize = m_Parent->GetPageSizeIU();
EDA_RECT rect;
rect.SetSize( m_Parent->GetPageSizeIU() );
if( PageIsBoardBoundarySize() )
{
rect = m_Parent->GetBoard()->ComputeBoundingBox();
}
KicadSVGFileDC dc( FullFileName, pageSize.x, pageSize.y, dpi );
KicadSVGFileDC dc( FullFileName, rect.GetOrigin(), rect.GetSize(), dpi );
EDA_RECT tmp = *panel->GetClipBox();
EDA_RECT tmp = *panel->GetClipBox();
GRResetPenAndBrush( &dc );
GRForceBlackPen( m_ModeColorOption->GetSelection() == 0 ? false : true );
GRForceBlackPen( s_Parameters.m_Print_Black_and_White );
s_Parameters.m_DrillShapeOpt = PRINT_PARAMETERS::FULL_DRILL_SHAPE;
// Set clip box to the max size
......@@ -270,7 +291,7 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
int bg_color = g_DrawBgColor;
g_DrawBgColor = WHITE;
if( aPrint_Frame_Ref )
if( PrintPageRef() )
m_Parent->TraceWorkSheet( &dc, screen, s_Parameters.m_PenDefaultSize,
IU_PER_MILS, wxT( "" ) );
......@@ -292,15 +313,13 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
void DIALOG_SVG_PRINT::OnButtonPrintBoardClick( wxCommandEvent& event )
{
s_Parameters.m_Print_Sheet_Ref = m_Print_Frame_Ref_Ctrl->IsChecked();
PrintSVGDoc( true, s_Parameters.m_Print_Sheet_Ref );
PrintSVGDoc( true );
}
void DIALOG_SVG_PRINT::OnButtonPrintSelectedClick( wxCommandEvent& event )
{
s_Parameters.m_Print_Sheet_Ref = m_Print_Frame_Ref_Ctrl->IsChecked();
PrintSVGDoc( false, s_Parameters.m_Print_Sheet_Ref );
PrintSVGDoc( false );
}
......@@ -317,6 +336,9 @@ void DIALOG_SVG_PRINT::OnCloseWindow( wxCloseEvent& event )
if( m_Config )
{
m_Config->Write( PLOTSVGMODECOLOR_KEY, s_Parameters.m_Print_Black_and_White );
m_Config->Write( PLOTSVGPAGESIZEOPT_KEY, m_rbSvgPageSizeOpt->GetSelection() );
m_Config->Write( PLOTSVGPLOT_BRD_EDGE_KEY, m_PrintBoardEdgesCtrl->GetValue() );
wxString layerKey;
for( int layer = 0; layer<NB_LAYERS; ++layer )
{
......@@ -328,11 +350,3 @@ void DIALOG_SVG_PRINT::OnCloseWindow( wxCloseEvent& event )
}
EndModal( 0 );
}
/* called on radiobox color/black and white selection
*/
void DIALOG_SVG_PRINT::OnSetColorModeSelected( wxCommandEvent& event )
{
s_Parameters.m_Print_Black_and_White = m_ModeColorOption->GetSelection();
}
#ifndef _DIALOG_SVG_PRINT_H_
#define _DIALOG_SVG_PRINT_H_
#include <dialog_SVG_print_base.h>
class BASE_SCREEN;
class PCB_BASE_FRAME;
class wxConfig;
class DIALOG_SVG_PRINT : public DIALOG_SVG_PRINT_base
{
private:
PCB_BASE_FRAME* m_Parent;
wxConfig* m_Config;
long m_PrintMaskLayer;
wxCheckBox* m_BoxSelectLayer[32];
public:
DIALOG_SVG_PRINT( EDA_DRAW_FRAME* parent );
~DIALOG_SVG_PRINT() {}
private:
void OnCloseWindow( wxCloseEvent& event );
void initDialog( );
void OnButtonPrintSelectedClick( wxCommandEvent& event );
void OnButtonPrintBoardClick( wxCommandEvent& event );
void OnButtonCancelClick( wxCommandEvent& event );
void OnSetColorModeSelected( wxCommandEvent& event );
void SetPenWidth();
void PrintSVGDoc( bool aPrintAll, bool aPrint_Frame_Ref );
bool DrawPage( const wxString& FullFileName, BASE_SCREEN* screen, bool aPrint_Frame_Ref );
};
#endif // _DIALOG_SVG_PRINT_H_
#ifndef _DIALOG_SVG_PRINT_H_
#define _DIALOG_SVG_PRINT_H_
#include <dialog_SVG_print_base.h>
class BASE_SCREEN;
class PCB_BASE_FRAME;
class wxConfig;
class DIALOG_SVG_PRINT : public DIALOG_SVG_PRINT_base
{
private:
PCB_BASE_FRAME* m_Parent;
wxConfig* m_Config;
long m_PrintMaskLayer;
wxCheckBox* m_BoxSelectLayer[32];
public:
DIALOG_SVG_PRINT( EDA_DRAW_FRAME* parent );
~DIALOG_SVG_PRINT() {}
private:
void OnCloseWindow( wxCloseEvent& event );
void initDialog( );
void OnButtonPrintSelectedClick( wxCommandEvent& event );
void OnButtonPrintBoardClick( wxCommandEvent& event );
void OnButtonCancelClick( wxCommandEvent& event );
void SetPenWidth();
void PrintSVGDoc( bool aPrintAll );
bool PageIsBoardBoundarySize()
{
return m_rbSvgPageSizeOpt->GetSelection() == 2;
}
bool PrintPageRef()
{
return m_rbSvgPageSizeOpt->GetSelection() == 0;
}
bool DrawPage( const wxString& FullFileName, BASE_SCREEN* screen );
};
#endif // _DIALOG_SVG_PRINT_H_
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -24,52 +24,56 @@ DIALOG_SVG_PRINT_base::DIALOG_SVG_PRINT_base( wxWindow* parent, wxWindowID id, c
m_CopperLayersBoxSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Copper Layers:") ), wxVERTICAL );
sbLayersSizer->Add( m_CopperLayersBoxSizer, 1, wxEXPAND, 5 );
m_TechnicalBoxSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Technical Layers:") ), wxVERTICAL );
sbLayersSizer->Add( m_TechnicalBoxSizer, 1, wxEXPAND, 5 );
bUpperSizer->Add( sbLayersSizer, 1, wxEXPAND, 5 );
wxStaticBoxSizer* sbOptionsSizer;
sbOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Print SVG options:") ), wxVERTICAL );
m_TextPenWidth = new wxStaticText( this, wxID_ANY, _("Pen width mini"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextPenWidth = new wxStaticText( this, wxID_ANY, _("Default pen size"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextPenWidth->Wrap( -1 );
sbOptionsSizer->Add( m_TextPenWidth, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_DialogPenWidth = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_DialogPenWidth->SetToolTip( _("Selection of the minimum pen thickness used to draw items.") );
m_DialogDefaultPenSize = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_DialogDefaultPenSize->SetToolTip( _("Selection of the pen size used to draw items which have no pen size speicfied.") );
sbOptionsSizer->Add( m_DialogPenWidth, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
sbOptionsSizer->Add( m_DialogDefaultPenSize, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxString m_ModeColorOptionChoices[] = { _("Color"), _("Black and White") };
wxString m_ModeColorOptionChoices[] = { _("Color"), _("Black and white") };
int m_ModeColorOptionNChoices = sizeof( m_ModeColorOptionChoices ) / sizeof( wxString );
m_ModeColorOption = new wxRadioBox( this, wxID_ANY, _("Print mode"), wxDefaultPosition, wxDefaultSize, m_ModeColorOptionNChoices, m_ModeColorOptionChoices, 1, wxRA_SPECIFY_COLS );
m_ModeColorOption->SetSelection( 0 );
m_ModeColorOption->SetSelection( 1 );
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") );
sbOptionsSizer->Add( m_ModeColorOption, 0, wxALL|wxEXPAND, 5 );
m_Print_Frame_Ref_Ctrl = new wxCheckBox( this, wxID_ANY, _("Print Frame Ref"), wxDefaultPosition, wxDefaultSize, 0 );
m_Print_Frame_Ref_Ctrl->SetValue(true);
m_Print_Frame_Ref_Ctrl->SetToolTip( _("Print (or not) the Frame references.") );
sbOptionsSizer->Add( m_Print_Frame_Ref_Ctrl, 0, wxALL, 5 );
wxString m_rbSvgPageSizeOptChoices[] = { _("Full page with frame ref"), _("Current page size"), _("Board area only") };
int m_rbSvgPageSizeOptNChoices = sizeof( m_rbSvgPageSizeOptChoices ) / sizeof( wxString );
m_rbSvgPageSizeOpt = new wxRadioBox( this, wxID_ANY, _("SVG Page Size"), wxDefaultPosition, wxDefaultSize, m_rbSvgPageSizeOptNChoices, m_rbSvgPageSizeOptChoices, 1, wxRA_SPECIFY_COLS );
m_rbSvgPageSizeOpt->SetSelection( 0 );
sbOptionsSizer->Add( m_rbSvgPageSizeOpt, 0, wxALL|wxEXPAND, 5 );
m_PrintBoardEdgesCtrl = new wxCheckBox( this, wxID_ANY, _("Print Board Edges"), wxDefaultPosition, wxDefaultSize, 0 );
m_PrintBoardEdgesCtrl->SetValue(true);
m_PrintBoardEdgesCtrl->SetToolTip( _("Print (or not) the edges layer with others layers") );
m_PrintBoardEdgesCtrl = new wxCheckBox( this, wxID_ANY, _("Print board edges"), wxDefaultPosition, wxDefaultSize, 0 );
m_PrintBoardEdgesCtrl->SetToolTip( _("Print (or not) the edges layer on others layers") );
sbOptionsSizer->Add( m_PrintBoardEdgesCtrl, 0, wxALL, 5 );
bUpperSizer->Add( sbOptionsSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bButtonsSizer;
bButtonsSizer = new wxBoxSizer( wxVERTICAL );
m_buttonPrintSelected = new wxButton( this, wxID_PRINT_CURRENT, _("Print Selected"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonPrintSelected->SetDefault();
bButtonsSizer->Add( m_buttonPrintSelected, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_buttonBoard = new wxButton( this, wxID_PRINT_BOARD, _("Print Board"), wxDefaultPosition, wxDefaultSize, 0 );
......@@ -78,8 +82,10 @@ DIALOG_SVG_PRINT_base::DIALOG_SVG_PRINT_base( wxWindow* parent, wxWindowID id, c
m_buttonQuit = new wxButton( this, wxID_CANCEL, _("Quit"), wxDefaultPosition, wxDefaultSize, 0 );
bButtonsSizer->Add( m_buttonQuit, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
bUpperSizer->Add( bButtonsSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
bMainSizer->Add( bUpperSizer, 0, wxEXPAND, 5 );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Filename:"), wxDefaultPosition, wxDefaultSize, 0 );
......@@ -101,12 +107,12 @@ DIALOG_SVG_PRINT_base::DIALOG_SVG_PRINT_base( wxWindow* parent, wxWindowID id, c
bMainSizer->Add( m_MessagesBox, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
this->SetSizer( bMainSizer );
this->Layout();
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_SVG_PRINT_base::OnCloseWindow ) );
m_ModeColorOption->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnSetColorModeSelected ), NULL, this );
m_buttonPrintSelected->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnButtonPrintSelectedClick ), NULL, this );
m_buttonBoard->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnButtonPrintBoardClick ), NULL, this );
m_buttonQuit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnButtonCancelClick ), NULL, this );
......@@ -116,7 +122,6 @@ DIALOG_SVG_PRINT_base::~DIALOG_SVG_PRINT_base()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_SVG_PRINT_base::OnCloseWindow ) );
m_ModeColorOption->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnSetColorModeSelected ), NULL, this );
m_buttonPrintSelected->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnButtonPrintSelectedClick ), NULL, this );
m_buttonBoard->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnButtonPrintBoardClick ), NULL, this );
m_buttonQuit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnButtonCancelClick ), NULL, this );
......
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -38,15 +38,15 @@ class DIALOG_SVG_PRINT_base : public wxDialog
enum
{
wxID_PRINT_CURRENT = 1000,
wxID_PRINT_BOARD,
wxID_PRINT_BOARD
};
wxStaticBoxSizer* m_CopperLayersBoxSizer;
wxStaticBoxSizer* m_TechnicalBoxSizer;
wxStaticText* m_TextPenWidth;
wxTextCtrl* m_DialogPenWidth;
wxTextCtrl* m_DialogDefaultPenSize;
wxRadioBox* m_ModeColorOption;
wxCheckBox* m_Print_Frame_Ref_Ctrl;
wxRadioBox* m_rbSvgPageSizeOpt;
wxCheckBox* m_PrintBoardEdgesCtrl;
wxButton* m_buttonPrintSelected;
wxButton* m_buttonBoard;
......@@ -58,7 +58,6 @@ class DIALOG_SVG_PRINT_base : public wxDialog
// Virtual event handlers, overide them in your derived class
virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); }
virtual void OnSetColorModeSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnButtonPrintSelectedClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnButtonPrintBoardClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnButtonCancelClick( wxCommandEvent& event ) { event.Skip(); }
......
......@@ -180,6 +180,8 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( PCB_EDIT_FRAME* aParent,
GetScreen()->SetCurItem( NULL );
LoadSettings();
GetBoard()->SetVisibleAlls();
GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnit, ID_POPUP_GRID_USER );
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment