Commit 16064881 authored by jean-pierre charras's avatar jean-pierre charras

Eeschema: Plot dialogs: unify 5 dialogs (which means 5 duplicate code) to only...

Eeschema: Plot dialogs: unify 5 dialogs (which means 5 duplicate code) to only one plot dialog (like in Pcbnew)
clean duplicate code.
Simplify HPGL dialog: plot offet removed and replace by only one option (plot origin to center of sheet or not)
This is surely enought.
parent a9744e3f
......@@ -90,10 +90,10 @@ void HPGL_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_T fill,
}
/**
/**
* HPGL polygon: fill not supported (but closed, at least)
*/
void HPGL_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList,
void HPGL_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList,
FILL_T aFill, int aWidth)
{
if( aCornerList.size() <= 1 )
......@@ -175,13 +175,13 @@ void HPGL_PLOTTER::SetDash( bool dashed )
{
wxASSERT( outputFile );
if( dashed )
fputs( "LI 2;\n", stderr );
fputs( "LI 2;\n", outputFile );
else
fputs( "LI;\n", stderr );
fputs( "LI;\n", outputFile );
}
void HPGL_PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end,
void HPGL_PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end,
int width, EDA_DRAW_MODE_T tracemode )
{
wxASSERT( outputFile );
......@@ -189,7 +189,7 @@ void HPGL_PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end,
wxSize size;
// Suppress overlap if pen is too big or in line mode
if( (penDiameter >= width) || (tracemode == LINE) )
if( (penDiameter >= width) || (tracemode == LINE) )
{
MoveTo( start );
FinishTo( end );
......@@ -302,7 +302,7 @@ void HPGL_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre,
double rsize = userToDeviceSize( radius );
fprintf( outputFile, "PA %.0f,%.0fd;CI %.0f;\n",
fprintf( outputFile, "PA %.0f,%.0fd;CI %.0f;\n",
pos_dev.x, pos_dev.y, rsize );
if( trace_mode == FILLED ) // Plot in filled mode.
......
......@@ -12,14 +12,6 @@ include_directories(
set(EESCHEMA_DLGS
dialogs/dialog_color_config.cpp
dialogs/dialog_plot_schematic_DXF.cpp
dialogs/dialog_plot_schematic_DXF_base.cpp
dialogs/dialog_plot_schematic_HPGL.cpp
dialogs/dialog_plot_schematic_HPGL_base.cpp
dialogs/dialog_plot_schematic_PS.cpp
dialogs/dialog_plot_schematic_PS_base.cpp
dialogs/dialog_plot_schematic_PDF.cpp
dialogs/dialog_plot_schematic_PDF_base.cpp
dialogs/annotate_dialog.cpp
dialogs/dialog_annotate_base.cpp
dialogs/dialog_lib_edit_text.cpp
......@@ -50,6 +42,8 @@ set(EESCHEMA_DLGS
dialogs/dialog_lib_new_component.cpp
dialogs/dialog_lib_new_component_base.cpp
dialogs/dialog_netlist_base.cpp
dialogs/dialog_plot_schematic_base.cpp
dialogs/dialog_plot_schematic.cpp
dialogs/dialog_print_using_printer_base.cpp
dialogs/dialog_print_using_printer.cpp
dialogs/dialog_sch_edit_sheet_pin.cpp
......@@ -58,8 +52,6 @@ set(EESCHEMA_DLGS
dialogs/dialog_sch_sheet_props_base.cpp
dialogs/dialog_schematic_find.cpp
dialogs/dialog_schematic_find_base.cpp
dialogs/dialog_SVG_print.cpp
dialogs/dialog_SVG_print_base.cpp
)
set(EESCHEMA_SRCS
......@@ -125,6 +117,11 @@ set(EESCHEMA_SRCS
onrightclick.cpp
operations_on_items_lists.cpp
pinedit.cpp
plot_schematic_DXF.cpp
plot_schematic_HPGL.cpp
plot_schematic_PS.cpp
plot_schematic_PDF.cpp
plot_schematic_SVG.cpp
sch_base_frame.cpp
sch_bitmap.cpp
sch_bus_entry.cpp
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 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 eeschema/dialogs/dialog_SVG_print.cpp
*/
#include <fctsys.h>
#include <appl_wxstruct.h>
#include <gr_basic.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <gestfich.h>
#include <class_sch_screen.h>
#include <wxEeschemaStruct.h>
#include <dcsvg.h>
#include <base_units.h>
#include <general.h>
#include <libeditframe.h>
#include <sch_sheet_path.h>
#include <dialog_SVG_print.h>
// Keys for configuration
#define PLOTSVGMODECOLOR_KEY wxT( "PlotSVGModeColor" )
#define WIDTH_MAX_VALUE 100
#define WIDTH_MIN_VALUE 1
// Variables locales
static bool s_Print_Frame_Ref = true;
static int s_PlotBlackAndWhite = 0;
/*!
* DIALOG_SVG_PRINT functions
*/
DIALOG_SVG_PRINT::DIALOG_SVG_PRINT( EDA_DRAW_FRAME* parent ) :
DIALOG_SVG_PRINT_base( parent )
{
m_Parent = parent;
m_Config = wxGetApp().GetSettings();
}
void DIALOG_SVG_PRINT::OnInitDialog( wxInitDialogEvent& event )
{
SetFocus(); // Make ESC key working
if( m_Config )
{
m_Config->Read( PLOTSVGMODECOLOR_KEY, &s_PlotBlackAndWhite );
}
m_ModeColorOption->SetSelection( s_PlotBlackAndWhite );
AddUnitSymbol( *m_TextPenWidth, g_UserUnit );
m_DialogPenWidth->SetValue(
ReturnStringFromValue( g_UserUnit, g_DrawDefaultLineThickness ) );
m_Print_Sheet_Ref->SetValue( s_Print_Frame_Ref );
if( GetSizer() )
{
GetSizer()->SetSizeHints( this );
}
}
void DIALOG_SVG_PRINT::SetPenWidth()
{
g_DrawDefaultLineThickness = ReturnValueFromTextCtrl( *m_DialogPenWidth );
if( g_DrawDefaultLineThickness > WIDTH_MAX_VALUE )
{
g_DrawDefaultLineThickness = WIDTH_MAX_VALUE;
}
if( g_DrawDefaultLineThickness < WIDTH_MIN_VALUE )
{
g_DrawDefaultLineThickness = WIDTH_MIN_VALUE;
}
m_DialogPenWidth->SetValue(
ReturnStringFromValue( g_UserUnit, g_DrawDefaultLineThickness ) );
}
void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
{
wxString msg;
wxFileName fn;
SetPenWidth();
g_DrawDefaultLineThickness =
ReturnValueFromTextCtrl( *m_DialogPenWidth );
SCH_SCREEN* screen = (SCH_SCREEN*) m_Parent->GetScreen();
if( aPrintAll && m_Parent->IsType( SCHEMATIC_FRAME_TYPE ) )
{
SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) m_Parent;
SCH_SHEET_PATH* sheetpath;
SCH_SHEET_PATH oldsheetpath = schframe->GetCurrentSheet();
SCH_SCREEN* schscreen = schframe->GetScreen();
SCH_SHEET_LIST SheetList( NULL );
sheetpath = SheetList.GetFirst();
SCH_SHEET_PATH list;
for( ; ; )
{
if( sheetpath == NULL )
break;
list.Clear();
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{
schframe->SetCurrentSheet( list );
schframe->GetCurrentSheet().UpdateAllScreenReferences();
schframe->SetSheetNumberAndCount();
schscreen = schframe->GetCurrentSheet().LastScreen();
}
else // Should not happen
return;
sheetpath = SheetList.GetNext();
fn = schframe->GetUniqueFilenameForCurrentSheet() + wxT( ".svg" );
bool success = DrawSVGPage( m_Parent, fn.GetFullPath(), ( SCH_SCREEN* ) schscreen,
m_ModeColorOption->GetSelection() == 0 ? false : true,
aPrint_Sheet_Ref );
msg = _( "Create file " ) + fn.GetFullPath();
if( !success )
msg += _( " error" );
msg += wxT( "\n" );
m_MessagesBox->AppendText( msg );
}
schframe->SetCurrentSheet( oldsheetpath );
schframe->GetCurrentSheet().UpdateAllScreenReferences();
schframe->SetSheetNumberAndCount();
}
else
{
fn = m_FileNameCtrl->GetValue();
if( !fn.IsOk() )
fn = screen->GetFileName();
fn.SetExt( wxT( "svg" ) );
fn.MakeAbsolute();
bool success = DrawSVGPage( m_Parent, fn.GetFullPath(), ( SCH_SCREEN* ) screen,
m_ModeColorOption->GetSelection() == 0 ? false : true,
aPrint_Sheet_Ref );
msg = _( "Create file " ) + fn.GetFullPath();
if( !success )
msg += _( " error" );
msg += wxT( "\n" );
m_MessagesBox->AppendText( msg );
}
}
bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame,
const wxString& FullFileName,
SCH_SCREEN* screen,
bool aPrintBlackAndWhite,
bool aPrint_Sheet_Ref )
{
int tmpzoom;
wxPoint tmp_startvisu;
wxSize sheetSize; // Sheet size in internal units
wxPoint old_org;
bool success = true;
tmp_startvisu = screen->m_StartVisu;
tmpzoom = screen->GetZoom();
old_org = screen->m_DrawOrg;
screen->m_DrawOrg.x = screen->m_DrawOrg.y = 0;
screen->m_StartVisu.x = screen->m_StartVisu.y = 0;
sheetSize = screen->GetPageSettings().GetSizeIU(); // page size in 1/1000 inch, ie in internal units
screen->SetScalingFactor( 1.0 );
EDA_DRAW_PANEL* panel = frame->GetCanvas();
LOCALE_IO toggle;
double dpi = 1000.0*IU_PER_MILS;
wxPoint origin;
KicadSVGFileDC dc( FullFileName, origin, sheetSize, dpi );
EDA_RECT tmp = *panel->GetClipBox();
GRResetPenAndBrush( &dc );
GRForceBlackPen( aPrintBlackAndWhite );
panel->SetClipBox( EDA_RECT( wxPoint( -0x3FFFFF0, -0x3FFFFF0 ),
wxSize( 0x7FFFFF0, 0x7FFFFF0 ) ) );
screen->m_IsPrinting = true;
if( frame->IsType( SCHEMATIC_FRAME_TYPE ) )
screen->Draw( panel, &dc, GR_COPY );
if( frame->IsType( LIBEDITOR_FRAME_TYPE ) )
((LIB_EDIT_FRAME*)frame)->RedrawComponent( &dc,
wxPoint(sheetSize.x/2,
sheetSize.y/2) );
if( aPrint_Sheet_Ref )
frame->TraceWorkSheet( &dc, screen, g_DrawDefaultLineThickness,
IU_PER_MILS, frame->GetScreenDesc() );
screen->m_IsPrinting = false;
panel->SetClipBox( tmp );
GRForceBlackPen( false );
screen->m_StartVisu = tmp_startvisu;
screen->m_DrawOrg = old_org;
screen->SetZoom( tmpzoom );
return success;
}
void DIALOG_SVG_PRINT::OnButtonPlotAllClick( wxCommandEvent& event )
{
PrintSVGDoc( true, m_Print_Sheet_Ref->GetValue() );
}
void DIALOG_SVG_PRINT::OnButtonPlotCurrentClick( wxCommandEvent& event )
{
PrintSVGDoc( false, m_Print_Sheet_Ref->GetValue() );
}
void DIALOG_SVG_PRINT::OnButtonCancelClick( wxCommandEvent& event )
{
Close();
}
void DIALOG_SVG_PRINT::OnCloseWindow( wxCloseEvent& event )
{
if( m_Config )
{
s_PlotBlackAndWhite = m_ModeColorOption->GetSelection();
m_Config->Write( PLOTSVGMODECOLOR_KEY, s_PlotBlackAndWhite );
}
EndModal( 0 );
}
/* called on radiobox color/black and white selection
*/
void DIALOG_SVG_PRINT::OnSetColorModeSelected( wxCommandEvent& event )
{
s_PlotBlackAndWhite = m_ModeColorOption->GetSelection();
}
#ifndef _DIALOG_SVG_PRINT_H_
#define _DIALOG_SVG_PRINT_H_
class EDA_DRAW_FRAME;
#include <dialog_SVG_print_base.h>
class DIALOG_SVG_PRINT : public DIALOG_SVG_PRINT_base
{
private:
EDA_DRAW_FRAME* m_Parent;
wxConfig* m_Config;
public:
DIALOG_SVG_PRINT( EDA_DRAW_FRAME* parent );
~DIALOG_SVG_PRINT() {}
private:
void OnCloseWindow( wxCloseEvent& event );
void OnInitDialog( wxInitDialogEvent& event );
void OnButtonPlotCurrentClick( wxCommandEvent& event );
void OnButtonPlotAllClick( wxCommandEvent& event );
void OnButtonCancelClick( wxCommandEvent& event );
void OnSetColorModeSelected( wxCommandEvent& event );
void SetPenWidth();
void PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref );
public:
static bool DrawSVGPage( EDA_DRAW_FRAME* frame,
const wxString& FullFileName, SCH_SCREEN* screen,
bool aPrintBlackAndWhite = false,
bool aPrint_Sheet_Ref = false );
};
#endif // _DIALOG_SVG_PRINT_H_
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_SVG_print_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_SVG_PRINT_base::DIALOG_SVG_PRINT_base( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bUpperSizer;
bUpperSizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* sbOptionsSizer;
sbOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Print SVG options:") ), wxVERTICAL );
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 default pen thickness used to draw items, when their thickness is set to 0.") );
sbOptionsSizer->Add( m_DialogPenWidth, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
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( 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_Sheet_Ref = new wxCheckBox( this, wxID_ANY, _("Print Frame Ref"), wxDefaultPosition, wxDefaultSize, 0 );
m_Print_Sheet_Ref->SetToolTip( _("Print (or not) the Frame references.") );
sbOptionsSizer->Add( m_Print_Sheet_Ref, 0, wxALL, 5 );
bUpperSizer->Add( sbOptionsSizer, 1, 0, 5 );
wxBoxSizer* bButtonsSizer;
bButtonsSizer = new wxBoxSizer( wxVERTICAL );
m_buttonPlotCurrent = new wxButton( this, wxID_PRINT_CURRENT, _("Print Current"), wxDefaultPosition, wxDefaultSize, 0 );
bButtonsSizer->Add( m_buttonPlotCurrent, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_buttonPlotAll = new wxButton( this, wxID_PRINT_ALL, _("Print All"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonPlotAll->SetDefault();
bButtonsSizer->Add( m_buttonPlotAll, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
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 );
m_staticText1->Wrap( -1 );
bMainSizer->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_FileNameCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_FileNameCtrl->SetToolTip( _("Enter a filename if you do not want to use default file names\nCan be used only when printing the current sheet") );
m_FileNameCtrl->SetMinSize( wxSize( 450,-1 ) );
bMainSizer->Add( m_FileNameCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticText2 = new wxStaticText( this, wxID_ANY, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText2->Wrap( -1 );
bMainSizer->Add( m_staticText2, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_MessagesBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
m_MessagesBox->SetMinSize( wxSize( -1,80 ) );
bMainSizer->Add( m_MessagesBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
this->SetSizer( bMainSizer );
this->Layout();
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_SVG_PRINT_base::OnCloseWindow ) );
this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_SVG_PRINT_base::OnInitDialog ) );
m_ModeColorOption->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnSetColorModeSelected ), NULL, this );
m_buttonPlotCurrent->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnButtonPlotCurrentClick ), NULL, this );
m_buttonPlotAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnButtonPlotAllClick ), NULL, this );
m_buttonQuit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnButtonCancelClick ), NULL, this );
}
DIALOG_SVG_PRINT_base::~DIALOG_SVG_PRINT_base()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_SVG_PRINT_base::OnCloseWindow ) );
this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_SVG_PRINT_base::OnInitDialog ) );
m_ModeColorOption->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnSetColorModeSelected ), NULL, this );
m_buttonPlotCurrent->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnButtonPlotCurrentClick ), NULL, this );
m_buttonPlotAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnButtonPlotAllClick ), NULL, this );
m_buttonQuit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnButtonCancelClick ), NULL, this );
}
This diff is collapsed.
/** @file dialog_plot_schematic_PDF.cpp
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2012 Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr
* Copyright (C) 1992-2010 Lorenzo Marcantonio
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
*
* Copyright (C) 1992-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 <worksheet.h>
#include <plot_common.h>
#include <class_sch_screen.h>
#include <wxEeschemaStruct.h>
#include <base_units.h>
#include <dialog_plot_schematic.h>
// Keys for configuration
#define PLOT_FORMAT_KEY wxT( "PlotFormat" )
#define PLOT_MODECOLOR_KEY wxT( "PlotModeColor" )
#define PLOT_FRAME_REFERENCE_KEY wxT( "PlotFrameRef" )
#define PLOT_HPGL_ORIGIN_KEY wxT( "PlotHPGLOrg" )
// static members (static to remember last state):
int DIALOG_PLOT_SCHEMATIC::m_pageSizeSelect = PAGE_SIZE_AUTO;
int DIALOG_PLOT_SCHEMATIC::m_HPGLPaperSizeSelect = 0;
void SCH_EDIT_FRAME::PlotSchematic( wxCommandEvent& event )
{
DIALOG_PLOT_SCHEMATIC dlg( this );
dlg.ShowModal();
}
DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC( SCH_EDIT_FRAME* parent ) :
DIALOG_PLOT_SCHEMATIC_BASE( parent )
{
m_parent = parent;
m_config = wxGetApp().GetSettings();
m_select_PlotAll = false;
initDlg();
GetSizer()->SetSizeHints( this );
Centre();
}
// Initialize the dialog options:
void DIALOG_PLOT_SCHEMATIC::initDlg()
{
SetFocus(); // make the ESC work
// Set paper size option
m_PaperSizeOption->SetSelection( m_pageSizeSelect );
// Set color or B&W plot option
bool tmp;
m_config->Read( PLOT_MODECOLOR_KEY, &tmp, true );
setModeColor( tmp );
// Set plot or not frame reference option
m_config->Read( PLOT_FRAME_REFERENCE_KEY, &tmp, true );
setPlotFrameRef( true );
// Set HPGL plot origin to center of paper of left bottom corner
m_config->Read( PLOT_HPGL_ORIGIN_KEY, &tmp, false );
SetPlotOriginCenter( tmp );
// Switch to the last save plot format
long plotfmt;
m_config->Read( PLOT_FORMAT_KEY, &plotfmt, 0 );
switch( plotfmt )
{
default:
case PLOT_FORMAT_POST:
m_plotFormatOpt->SetSelection( 0 );
break;
case PLOT_FORMAT_PDF:
m_plotFormatOpt->SetSelection( 1 );
break;
case PLOT_FORMAT_SVG:
m_plotFormatOpt->SetSelection( 2 );
break;
case PLOT_FORMAT_DXF:
m_plotFormatOpt->SetSelection( 3 );
break;
case PLOT_FORMAT_HPGL:
m_plotFormatOpt->SetSelection( 4 );
break;
}
// Set the default line width (pen width which should be used for
// items that do not have a pen size defined (like frame ref)
AddUnitSymbol( *m_defaultLineWidthTitle, g_UserUnit );
PutValueInLocalUnits( *m_DefaultLineSizeCtrl, g_DrawDefaultLineThickness );
// Initialize HPGL specific widgets
AddUnitSymbol( *m_penHPLGWidthTitle, g_UserUnit );
PutValueInLocalUnits( *m_penHPGLWidthCtrl, g_HPGL_Pen_Descr.m_Pen_Diam );
m_HPGLPaperSizeOption->SetSelection( m_HPGLPaperSizeSelect );
// Hide/show widgets that are not always displayed:
wxCommandEvent cmd_event;
OnPlotFormatSelection( cmd_event );
}
PlotFormat DIALOG_PLOT_SCHEMATIC::GetPlotFileFormat()
{
switch( m_plotFormatOpt->GetSelection() )
{
default:
case 0: return PLOT_FORMAT_POST;
case 1: return PLOT_FORMAT_SVG;
case 2: return PLOT_FORMAT_PDF;
case 3: return PLOT_FORMAT_DXF;
case 4: return PLOT_FORMAT_HPGL;
}
}
void DIALOG_PLOT_SCHEMATIC::OnButtonCancelClick( wxCommandEvent& event )
{
getPlotOptions();
EndModal( 0 );
}
void DIALOG_PLOT_SCHEMATIC::getPlotOptions()
{
m_config->Write( PLOT_MODECOLOR_KEY, getModeColor() );
m_config->Write( PLOT_FRAME_REFERENCE_KEY, getPlotFrameRef() );
m_config->Write( PLOT_FORMAT_KEY, (long) GetPlotFileFormat() );
m_config->Write( PLOT_HPGL_ORIGIN_KEY, GetPlotOriginCenter() );
m_HPGLPaperSizeSelect = m_HPGLPaperSizeOption->GetSelection();
m_pageSizeSelect = m_PaperSizeOption->GetSelection();
g_DrawDefaultLineThickness = ReturnValueFromTextCtrl( *m_DefaultLineSizeCtrl );
if( g_DrawDefaultLineThickness < 1 )
g_DrawDefaultLineThickness = 1;
}
void DIALOG_PLOT_SCHEMATIC::OnPlotFormatSelection( wxCommandEvent& event )
{
switch( m_plotFormatOpt->GetSelection() )
{
case 0: // postscript
m_paperOptionsSizer->Hide( m_paperHPGLSizer );
m_paperOptionsSizer->Show( m_PaperSizeOption );
m_PaperSizeOption->Enable( true );
m_DefaultLineSizeCtrl->Enable( true );
break;
case 1: // PDF
m_paperOptionsSizer->Hide( m_paperHPGLSizer );
m_paperOptionsSizer->Show(m_PaperSizeOption);
m_PaperSizeOption->Enable( true );
m_DefaultLineSizeCtrl->Enable( true );
break;
case 2: // SVG
m_paperOptionsSizer->Hide( m_paperHPGLSizer );
m_paperOptionsSizer->Show(m_PaperSizeOption);
m_PaperSizeOption->Enable( false );
m_DefaultLineSizeCtrl->Enable( true );
break;
case 3: // DXF
m_paperOptionsSizer->Hide( m_paperHPGLSizer );
m_paperOptionsSizer->Show(m_PaperSizeOption);
m_PaperSizeOption->Enable( false );
m_DefaultLineSizeCtrl->Enable( false );
break;
case 4: //HPGL
m_paperOptionsSizer->Show( m_paperHPGLSizer );
m_paperOptionsSizer->Hide(m_PaperSizeOption);
m_DefaultLineSizeCtrl->Enable( false );
break;
}
GetSizer()->SetSizeHints( this );
}
void DIALOG_PLOT_SCHEMATIC::setupPlotPage( PLOTTER * plotter, SCH_SCREEN* screen )
{
PAGE_INFO plotPage; // page size selected to plot
// Considerations on page size and scaling requests
PAGE_INFO actualPage = screen->GetPageSettings(); // page size selected in schematic
switch( m_pageSizeSelect )
{
case PAGE_SIZE_A:
plotPage.SetType( wxT( "A" ) );
plotPage.SetPortrait( actualPage.IsPortrait() );
break;
case PAGE_SIZE_A4:
plotPage.SetType( wxT( "A4" ) );
plotPage.SetPortrait( actualPage.IsPortrait() );
break;
case PAGE_SIZE_AUTO:
default:
plotPage = actualPage;
break;
}
double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils();
double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils();
double scale = MIN( scalex, scaley );
plotter->SetPageSettings( plotPage );
plotter->SetViewport( wxPoint( 0, 0 ), IU_PER_DECIMILS, scale, false );
}
void DIALOG_PLOT_SCHEMATIC::OnButtonPlotCurrentClick( wxCommandEvent& event )
{
m_select_PlotAll = false;
PlotSchematic();
}
void DIALOG_PLOT_SCHEMATIC::OnButtonPlotAllClick( wxCommandEvent& event )
{
m_select_PlotAll = true;
PlotSchematic();
}
void DIALOG_PLOT_SCHEMATIC::PlotSchematic()
{
getPlotOptions();
switch( GetPlotFileFormat() )
{
case PLOT_FORMAT_HPGL:
createHPGLFile( m_select_PlotAll );
break;
default:
case PLOT_FORMAT_POST:
createPSFile();
break;
case PLOT_FORMAT_DXF:
CreateDXFFile();
break;
case PLOT_FORMAT_PDF:
createPDFFile();
break;
case PLOT_FORMAT_SVG:
createSVGFile( m_select_PlotAll, getPlotFrameRef() );
break;
}
m_MessagesBox->AppendText( wxT( "****\n" ) );
}
/** @file dialog_plot_schematic.cpp
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2012 Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr
* Copyright (C) 1992-2010 Lorenzo Marcantonio
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
*
* Copyright (C) 1992-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 <plot_common.h>
#include <class_sch_screen.h>
#include <wxEeschemaStruct.h>
#include <dialog_plot_schematic_base.h>
enum PageFormatReq {
PAGE_SIZE_AUTO,
PAGE_SIZE_A4,
PAGE_SIZE_A
};
class DIALOG_PLOT_SCHEMATIC : public DIALOG_PLOT_SCHEMATIC_BASE
{
private:
SCH_EDIT_FRAME* m_parent;
wxConfig* m_config;
static int m_pageSizeSelect; // Static to keep last option for some format:
// Static to keep last option:
// use default size or force A or A4 size
static int m_HPGLPaperSizeSelect; // for HPGL format only: last selected paper size
bool m_select_PlotAll; // Flaf to plot current page or the full hierarchy
public:
// / Constructors
DIALOG_PLOT_SCHEMATIC( SCH_EDIT_FRAME* parent );
private:
void OnPlotFormatSelection( wxCommandEvent& event );
void OnButtonPlotCurrentClick( wxCommandEvent& event );
void OnButtonPlotAllClick( wxCommandEvent& event );
void OnButtonCancelClick( wxCommandEvent& event );
void initDlg();
// common
void getPlotOptions();
bool getModeColor()
{ return m_ModeColorOption->GetSelection() == 0; }
void setModeColor( bool aColor )
{ m_ModeColorOption->SetSelection( aColor ? 0 : 1 ); }
PlotFormat GetPlotFileFormat();
bool getPlotFrameRef() { return m_PlotFrameRefOpt->GetValue(); }
void setPlotFrameRef( bool aPlot) {m_PlotFrameRefOpt->SetValue( aPlot ); }
void setupPlotPage( PLOTTER* plotter, SCH_SCREEN* screen );
void PlotSchematic();
// PDF
void createPDFFile();
void plotOneSheetPDF( PLOTTER* plotter, SCH_SCREEN* screen);
// DXF
void CreateDXFFile();
void PlotOneSheetDXF( const wxString& FileName, SCH_SCREEN* screen,
wxPoint plot_offset, double scale );
// HPGL
bool GetPlotOriginCenter()
{
return m_plotOriginOpt->GetSelection() == 1;
}
void SetPlotOriginCenter( bool aCenter )
{
m_plotOriginOpt->SetSelection( aCenter ? 1 : 0 );
}
void createHPGLFile( bool aPlotAll );
void SetHPGLPenWidth();
void Plot_1_Page_HPGL( const wxString& FileName, SCH_SCREEN* screen,
const PAGE_INFO& pageInfo,
wxPoint& offset, double plot_scale );
// PS
void createPSFile();
void plotOneSheetPS( const wxString& FileName, SCH_SCREEN* screen,
const PAGE_INFO& pageInfo,
wxPoint plot_offset, double scale );
// SVG
void createSVGFile( bool aPrintAll, bool aPrint_Sheet_Ref );
public:
// This function is static because it is called by libedit
// outside a dialog.
static bool plotOneSheetSVG( EDA_DRAW_FRAME* frame, const wxString& FullFileName,
SCH_SCREEN* screen,
bool aPrintBlackAndWhite, bool aPrint_Sheet_Ref );
};
/** @file dialog_plot_schematic_DXF.cpp
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2010 Lorenzo Marcantonio
* Copyright (C) 1992-2010 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 <gr_basic.h>
#include <macros.h>
#include <plot_common.h>
#include <confirm.h>
#include <worksheet.h>
#include <class_sch_screen.h>
#include <wxEeschemaStruct.h>
#include <general.h>
#include <protos.h>
#include <sch_sheet_path.h>
#include <dialog_plot_schematic_DXF_base.h>
class DIALOG_PLOT_SCHEMATIC_DXF : public DIALOG_PLOT_SCHEMATIC_DXF_BASE
{
private:
SCH_EDIT_FRAME* m_Parent;
public:
/// Constructors
DIALOG_PLOT_SCHEMATIC_DXF( SCH_EDIT_FRAME* parent );
private:
static bool m_plotColorOpt;
static int m_pageSizeSelect;
static bool m_plot_Sheet_Ref;
bool m_select_PlotAll;
private:
void OnPlotCurrent( wxCommandEvent& event );
void OnPlotAll( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
void initDlg();
void initOptVars();
void CreateDXFFile();
void PlotOneSheetDXF( const wxString& FileName, SCH_SCREEN* screen,
wxPoint plot_offset, double scale );
};
// static members (static to remember last state):
bool DIALOG_PLOT_SCHEMATIC_DXF::m_plotColorOpt = false;
bool DIALOG_PLOT_SCHEMATIC_DXF::m_plot_Sheet_Ref = true;
void SCH_EDIT_FRAME::ToPlot_DXF( wxCommandEvent& event )
{
DIALOG_PLOT_SCHEMATIC_DXF DXF_frame( this );
DXF_frame.ShowModal();
}
DIALOG_PLOT_SCHEMATIC_DXF::DIALOG_PLOT_SCHEMATIC_DXF( SCH_EDIT_FRAME* parent )
: DIALOG_PLOT_SCHEMATIC_DXF_BASE( parent )
{
m_Parent = parent;
m_select_PlotAll = false;
initDlg();
GetSizer()->SetSizeHints( this );
Centre();
m_buttonPlotAll->SetDefault();
}
void DIALOG_PLOT_SCHEMATIC_DXF::initDlg()
{
SetFocus(); // make the ESC work
// Set options
m_PlotColorCtrl->SetSelection( m_plotColorOpt ? 1 : 0 );
m_Plot_Sheet_Ref_Ctrl->SetValue( m_plot_Sheet_Ref );
}
/* event handler for Plot Current button
*/
void DIALOG_PLOT_SCHEMATIC_DXF::OnPlotCurrent( wxCommandEvent& event )
{
m_select_PlotAll = false;
initOptVars();
CreateDXFFile( );
m_MsgBox->AppendText( wxT( "*****\n" ) );
}
/* event handler for Plot ALL button
*/
void DIALOG_PLOT_SCHEMATIC_DXF::OnPlotAll( wxCommandEvent& event )
{
m_select_PlotAll = true;
initOptVars();
CreateDXFFile( );
m_MsgBox->AppendText( wxT( "*****\n" ) );
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/
void DIALOG_PLOT_SCHEMATIC_DXF::OnCancelClick( wxCommandEvent& event )
{
initOptVars();
EndModal( 0 );
}
void DIALOG_PLOT_SCHEMATIC_DXF::initOptVars()
{
m_plot_Sheet_Ref = m_Plot_Sheet_Ref_Ctrl->GetValue();
m_plotColorOpt = m_PlotColorCtrl->GetSelection() == 1 ? true : false;
}
void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
{
SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) m_Parent;
SCH_SCREEN* screen = schframe->GetScreen();
SCH_SHEET_PATH* sheetpath;
SCH_SHEET_PATH oldsheetpath = schframe->GetCurrentSheet();
wxString plotFileName;
wxPoint plot_offset;
/* When printing all pages, the printed page is not the current page.
* In complex hierarchies, we must setup references and others parameters
* in the printed SCH_SCREEN
* because in complex hierarchies a SCH_SCREEN (a schematic drawings)
* is shared between many sheets
*/
SCH_SHEET_LIST SheetList( NULL );
sheetpath = SheetList.GetFirst();
SCH_SHEET_PATH list;
while( true )
{
if( m_select_PlotAll )
{
if( sheetpath == NULL )
break;
list.Clear();
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{
schframe->SetCurrentSheet( list );
schframe->GetCurrentSheet().UpdateAllScreenReferences();
schframe->SetSheetNumberAndCount();
screen = schframe->GetCurrentSheet().LastScreen();
}
else // Should not happen
{
return;
}
sheetpath = SheetList.GetNext();
}
plot_offset.x = 0;
plot_offset.y = 0;
plotFileName = schframe->GetUniqueFilenameForCurrentSheet() + wxT(".")
+ DXF_PLOTTER::GetDefaultFileExtension();
PlotOneSheetDXF( plotFileName, screen, plot_offset, 1 );
if( !m_select_PlotAll )
break;
}
schframe->SetCurrentSheet( oldsheetpath );
schframe->GetCurrentSheet().UpdateAllScreenReferences();
schframe->SetSheetNumberAndCount();
}
void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
SCH_SCREEN* screen,
wxPoint plot_offset,
double scale )
{
wxString msg;
FILE* output_file = wxFopen( FileName, wxT( "wt" ) );
if( output_file == NULL )
{
msg = wxT( "\n** " );
msg += _( "Unable to create " ) + FileName + wxT( " **\n" );
m_MsgBox->AppendText( msg );
return;
}
msg.Printf( _( "Plot: %s " ), GetChars( FileName ) );
m_MsgBox->AppendText( msg );
LOCALE_IO toggle;
DXF_PLOTTER* plotter = new DXF_PLOTTER();
const PAGE_INFO& pageInfo = screen->GetPageSettings();
plotter->SetPageSettings( pageInfo );
plotter->SetColorMode( m_plotColorOpt );
plotter->SetViewport( plot_offset, IU_PER_DECIMILS, scale, false );
// Init :
plotter->SetCreator( wxT( "Eeschema-DXF" ) );
plotter->SetFilename( FileName );
plotter->StartPlot( output_file );
if( m_plot_Sheet_Ref )
{
plotter->SetColor( BLACK );
PlotWorkSheet( plotter, m_Parent->GetTitleBlock(),
m_Parent->GetPageSettings(),
screen->m_ScreenNumber, screen->m_NumberOfScreens,
m_Parent->GetScreenDesc(),
screen->GetFileName() );
}
screen->Plot( plotter );
// finish
plotter->EndPlot();
delete plotter;
m_MsgBox->AppendText( wxT( "Ok\n" ) );
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_plot_schematic_DXF_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_PLOT_SCHEMATIC_DXF_BASE::DIALOG_PLOT_SCHEMATIC_DXF_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bmainSizer;
bmainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bupperSizer;
bupperSizer = new wxBoxSizer( wxHORIZONTAL );
bupperSizer->Add( 10, 10, 0, wxEXPAND, 5 );
wxBoxSizer* sbSizerMiddle;
sbSizerMiddle = new wxBoxSizer( wxVERTICAL );
wxString m_PlotColorCtrlChoices[] = { _("B/W"), _("Color") };
int m_PlotColorCtrlNChoices = sizeof( m_PlotColorCtrlChoices ) / sizeof( wxString );
m_PlotColorCtrl = new wxRadioBox( this, wxID_ANY, _("Plot Mode:"), wxDefaultPosition, wxDefaultSize, m_PlotColorCtrlNChoices, m_PlotColorCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_PlotColorCtrl->SetSelection( 0 );
sbSizerMiddle->Add( m_PlotColorCtrl, 0, wxALL|wxEXPAND, 5 );
m_Plot_Sheet_Ref_Ctrl = new wxCheckBox( this, wxID_ANY, _("Print page references"), wxDefaultPosition, wxDefaultSize, 0 );
m_Plot_Sheet_Ref_Ctrl->SetValue(true);
sbSizerMiddle->Add( m_Plot_Sheet_Ref_Ctrl, 0, wxALL|wxEXPAND, 5 );
bupperSizer->Add( sbSizerMiddle, 1, wxEXPAND, 5 );
bupperSizer->Add( 10, 10, 0, wxEXPAND, 5 );
wxBoxSizer* bbuttonsSizer;
bbuttonsSizer = new wxBoxSizer( wxVERTICAL );
m_buttonPlotPage = new wxButton( this, wxID_ANY, _("&Plot Page"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonPlotPage, 0, wxALL|wxEXPAND, 5 );
m_buttonPlotAll = new wxButton( this, wxID_ANY, _("Plot A&LL"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonPlotAll, 0, wxALL|wxEXPAND, 5 );
m_buttonClose = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonClose, 0, wxALL|wxEXPAND, 5 );
bupperSizer->Add( bbuttonsSizer, 1, wxALIGN_CENTER_VERTICAL, 5 );
bmainSizer->Add( bupperSizer, 0, wxEXPAND, 5 );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Messages :"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
bmainSizer->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_MsgBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY );
m_MsgBox->SetMinSize( wxSize( -1,150 ) );
bmainSizer->Add( m_MsgBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
this->SetSizer( bmainSizer );
this->Layout();
this->Centre( wxBOTH );
// Connect Events
m_buttonPlotPage->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_DXF_BASE::OnPlotCurrent ), NULL, this );
m_buttonPlotAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_DXF_BASE::OnPlotAll ), NULL, this );
m_buttonClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_DXF_BASE::OnCancelClick ), NULL, this );
}
DIALOG_PLOT_SCHEMATIC_DXF_BASE::~DIALOG_PLOT_SCHEMATIC_DXF_BASE()
{
// Disconnect Events
m_buttonPlotPage->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_DXF_BASE::OnPlotCurrent ), NULL, this );
m_buttonPlotAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_DXF_BASE::OnPlotAll ), NULL, this );
m_buttonClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_DXF_BASE::OnCancelClick ), NULL, this );
}
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_plot_schematic_DXF_base__
#define __dialog_plot_schematic_DXF_base__
#include <wx/intl.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/checkbox.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_PLOT_SCHEMATIC_DXF_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_PLOT_SCHEMATIC_DXF_BASE : public wxDialog
{
private:
protected:
wxRadioBox* m_PlotColorCtrl;
wxCheckBox* m_Plot_Sheet_Ref_Ctrl;
wxButton* m_buttonPlotPage;
wxButton* m_buttonPlotAll;
wxButton* m_buttonClose;
wxStaticText* m_staticText1;
wxTextCtrl* m_MsgBox;
// Virtual event handlers, overide them in your derived class
virtual void OnPlotCurrent( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPlotAll( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_PLOT_SCHEMATIC_DXF_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plot DXF"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 387,365 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PLOT_SCHEMATIC_DXF_BASE();
};
#endif //__dialog_plot_schematic_DXF_base__
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_plot_schematic_HPGL_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_PLOT_SCHEMATIC_HPGL_BASE::DIALOG_PLOT_SCHEMATIC_HPGL_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bmainSizer;
bmainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bupperSizer;
bupperSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bleftSizer;
bleftSizer = new wxBoxSizer( wxVERTICAL );
wxString m_SizeOptionChoices[] = { _("Schematic size"), _("Page size A4"), _("Page size A3"), _("Page size A2"), _("Page size A1"), _("Page size A0"), _("Page size A"), _("Page size B"), _("Page size C"), _("Page size D"), _("Page size E") };
int m_SizeOptionNChoices = sizeof( m_SizeOptionChoices ) / sizeof( wxString );
m_SizeOption = new wxRadioBox( this, wxID_ANY, _("Plot Page Size:"), wxDefaultPosition, wxDefaultSize, m_SizeOptionNChoices, m_SizeOptionChoices, 1, wxRA_SPECIFY_COLS );
m_SizeOption->SetSelection( 1 );
bleftSizer->Add( m_SizeOption, 0, wxALL|wxEXPAND, 5 );
m_Plot_Sheet_Ref_Ctrl = new wxCheckBox( this, wxID_ANY, _("Print page references"), wxDefaultPosition, wxDefaultSize, 0 );
m_Plot_Sheet_Ref_Ctrl->SetValue(true);
bleftSizer->Add( m_Plot_Sheet_Ref_Ctrl, 0, wxALL|wxEXPAND, 5 );
bupperSizer->Add( bleftSizer, 1, wxEXPAND, 5 );
wxBoxSizer* sbSizerMiddle;
sbSizerMiddle = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizer1;
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pen control:") ), wxVERTICAL );
m_penWidthTitle = new wxStaticText( this, wxID_ANY, _("Pen Width"), wxDefaultPosition, wxDefaultSize, 0 );
m_penWidthTitle->Wrap( -1 );
sbSizer1->Add( m_penWidthTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_penWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbSizer1->Add( m_penWidthCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_penSpeedTitle = new wxStaticText( this, wxID_ANY, _("Pen Speed ( cm/s )"), wxDefaultPosition, wxDefaultSize, 0 );
m_penSpeedTitle->Wrap( -1 );
sbSizer1->Add( m_penSpeedTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_penSpeedCtrl = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 50, 20 );
sbSizer1->Add( m_penSpeedCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_penNumTitle = new wxStaticText( this, wxID_ANY, _("Pen Number"), wxDefaultPosition, wxDefaultSize, 0 );
m_penNumTitle->Wrap( -1 );
sbSizer1->Add( m_penNumTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_penNumCtrl = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 8, 1 );
sbSizer1->Add( m_penNumCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
sbSizerMiddle->Add( sbSizer1, 0, wxEXPAND|wxALL, 5 );
wxStaticBoxSizer* sbSizer2;
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Page offset:") ), wxVERTICAL );
m_offsetXTitle = new wxStaticText( this, wxID_ANY, _("Plot Offset X"), wxDefaultPosition, wxDefaultSize, 0 );
m_offsetXTitle->Wrap( -1 );
sbSizer2->Add( m_offsetXTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_PlotOrgPosition_X = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbSizer2->Add( m_PlotOrgPosition_X, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_offsetYTitle = new wxStaticText( this, wxID_ANY, _("Plot Offset Y"), wxDefaultPosition, wxDefaultSize, 0 );
m_offsetYTitle->Wrap( -1 );
sbSizer2->Add( m_offsetYTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_PlotOrgPosition_Y = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbSizer2->Add( m_PlotOrgPosition_Y, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
sbSizerMiddle->Add( sbSizer2, 1, wxEXPAND|wxALL, 5 );
bupperSizer->Add( sbSizerMiddle, 1, wxEXPAND, 5 );
bupperSizer->Add( 10, 10, 0, 0, 5 );
wxBoxSizer* bbuttonsSizer;
bbuttonsSizer = new wxBoxSizer( wxVERTICAL );
m_buttonPlotPage = new wxButton( this, wxID_ANY, _("&Plot Page"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonPlotPage, 0, wxALL|wxEXPAND, 5 );
m_buttonPlotAll = new wxButton( this, wxID_ANY, _("Plot A&LL"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonPlotAll, 0, wxALL|wxEXPAND, 5 );
m_buttonClose = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonClose, 0, wxALL|wxEXPAND, 5 );
bbuttonsSizer->Add( 10, 10, 1, wxEXPAND, 5 );
m_buttonOffset = new wxButton( this, wxID_ANY, _("&Accept Offset"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonOffset, 0, wxALL, 5 );
bupperSizer->Add( bbuttonsSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
bmainSizer->Add( bupperSizer, 0, wxEXPAND, 5 );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Messages :"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
bmainSizer->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_MsgBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY );
m_MsgBox->SetMinSize( wxSize( -1,150 ) );
bmainSizer->Add( m_MsgBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
this->SetSizer( bmainSizer );
this->Layout();
this->Centre( wxBOTH );
// Connect Events
m_SizeOption->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_HPGL_BASE::OnPageSelected ), NULL, this );
m_buttonPlotPage->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_HPGL_BASE::OnPlotCurrent ), NULL, this );
m_buttonPlotAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_HPGL_BASE::OnPlotAll ), NULL, this );
m_buttonClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_HPGL_BASE::OnCancelClick ), NULL, this );
m_buttonOffset->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_HPGL_BASE::AcceptPlotOffset ), NULL, this );
}
DIALOG_PLOT_SCHEMATIC_HPGL_BASE::~DIALOG_PLOT_SCHEMATIC_HPGL_BASE()
{
// Disconnect Events
m_SizeOption->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_HPGL_BASE::OnPageSelected ), NULL, this );
m_buttonPlotPage->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_HPGL_BASE::OnPlotCurrent ), NULL, this );
m_buttonPlotAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_HPGL_BASE::OnPlotAll ), NULL, this );
m_buttonClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_HPGL_BASE::OnCancelClick ), NULL, this );
m_buttonOffset->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_HPGL_BASE::AcceptPlotOffset ), NULL, this );
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_plot_schematic_HPGL_base__
#define __dialog_plot_schematic_HPGL_base__
#include <wx/intl.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/checkbox.h>
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/spinctrl.h>
#include <wx/statbox.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_PLOT_SCHEMATIC_HPGL_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_PLOT_SCHEMATIC_HPGL_BASE : public wxDialog
{
private:
protected:
wxRadioBox* m_SizeOption;
wxCheckBox* m_Plot_Sheet_Ref_Ctrl;
wxStaticText* m_penWidthTitle;
wxTextCtrl* m_penWidthCtrl;
wxStaticText* m_penSpeedTitle;
wxSpinCtrl* m_penSpeedCtrl;
wxStaticText* m_penNumTitle;
wxSpinCtrl* m_penNumCtrl;
wxStaticText* m_offsetXTitle;
wxTextCtrl* m_PlotOrgPosition_X;
wxStaticText* m_offsetYTitle;
wxTextCtrl* m_PlotOrgPosition_Y;
wxButton* m_buttonPlotPage;
wxButton* m_buttonPlotAll;
wxButton* m_buttonClose;
wxButton* m_buttonOffset;
wxStaticText* m_staticText1;
wxTextCtrl* m_MsgBox;
// Virtual event handlers, overide them in your derived class
virtual void OnPageSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPlotCurrent( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPlotAll( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void AcceptPlotOffset( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_PLOT_SCHEMATIC_HPGL_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plot HPGL"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 387,408 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PLOT_SCHEMATIC_HPGL_BASE();
};
#endif //__dialog_plot_schematic_HPGL_base__
/** @file dialog_plot_schematic_PDF.cpp
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2010 Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr
* Copyright (C) 1992-2010 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 <gr_basic.h>
#include <confirm.h>
#include <worksheet.h>
#include <plot_common.h>
#include <class_sch_screen.h>
#include <wxEeschemaStruct.h>
#include <base_units.h>
#include <general.h>
#include <protos.h>
#include <sch_sheet_path.h>
enum PageFormatReq {
PAGE_SIZE_AUTO,
PAGE_SIZE_A4,
PAGE_SIZE_A
};
#include <dialog_plot_schematic_PDF_base.h>
class DIALOG_PLOT_SCHEMATIC_PDF : public DIALOG_PLOT_SCHEMATIC_PDF_BASE
{
private:
SCH_EDIT_FRAME* m_Parent;
public:
/// Constructors
DIALOG_PLOT_SCHEMATIC_PDF( SCH_EDIT_FRAME* parent );
private:
static bool m_plotColorOpt;
static int m_pageSizeSelect;
static bool m_plot_Sheet_Ref;
bool m_select_PlotAll;
private:
void OnPlotCurrent( wxCommandEvent& event );
void OnPlotAll( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
void initDlg();
void initOptVars();
void createPDFFile();
void plotOneSheet( PDF_PLOTTER *plotter, SCH_SCREEN* screen );
void plotSetupPage( PDF_PLOTTER *plotter, SCH_SCREEN* screen );
};
// static members (static to remember last state):
bool DIALOG_PLOT_SCHEMATIC_PDF::m_plotColorOpt = false;
int DIALOG_PLOT_SCHEMATIC_PDF::m_pageSizeSelect = PAGE_SIZE_AUTO;
bool DIALOG_PLOT_SCHEMATIC_PDF::m_plot_Sheet_Ref = true;
void SCH_EDIT_FRAME::ToPlot_PDF( wxCommandEvent& event )
{
DIALOG_PLOT_SCHEMATIC_PDF dlg( this );
dlg.ShowModal();
}
DIALOG_PLOT_SCHEMATIC_PDF::DIALOG_PLOT_SCHEMATIC_PDF( SCH_EDIT_FRAME* parent ) :
DIALOG_PLOT_SCHEMATIC_PDF_BASE( parent )
{
m_Parent = parent;
m_select_PlotAll = false;
initDlg();
GetSizer()->SetSizeHints( this );
Centre();
m_buttonPlotAll->SetDefault();
}
/*!
* Control creation for DIALOG_PLOT_SCHEMATIC_PDF
*/
void DIALOG_PLOT_SCHEMATIC_PDF::initDlg()
{
SetFocus(); // make the ESC work
// Set options
m_SizeOption->SetSelection( m_pageSizeSelect );
m_PlotPDFColorOption->SetSelection( m_plotColorOpt ? 1 : 0 );
m_Plot_Sheet_Ref_Ctrl->SetValue( m_plot_Sheet_Ref );
AddUnitSymbol( *m_defaultLineWidthTitle, g_UserUnit );
PutValueInLocalUnits( *m_DefaultLineSizeCtrl, g_DrawDefaultLineThickness );
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON
*/
void DIALOG_PLOT_SCHEMATIC_PDF::OnPlotCurrent( wxCommandEvent& event )
{
m_select_PlotAll = false;
initOptVars();
createPDFFile();
m_MsgBox->AppendText( wxT( "*\n" ) );
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON1
*/
void DIALOG_PLOT_SCHEMATIC_PDF::OnPlotAll( wxCommandEvent& event )
{
m_select_PlotAll = true;
initOptVars();
createPDFFile();
m_MsgBox->AppendText( wxT( "*\n" ) );
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/
void DIALOG_PLOT_SCHEMATIC_PDF::OnCancelClick( wxCommandEvent& event )
{
initOptVars();
EndModal( 0 );
}
void DIALOG_PLOT_SCHEMATIC_PDF::initOptVars()
{
m_plot_Sheet_Ref = m_Plot_Sheet_Ref_Ctrl->GetValue();
m_plotColorOpt = m_PlotPDFColorOption->GetSelection();
m_pageSizeSelect = m_SizeOption->GetSelection();
g_DrawDefaultLineThickness = ReturnValueFromTextCtrl( *m_DefaultLineSizeCtrl );
if( g_DrawDefaultLineThickness < 1 )
g_DrawDefaultLineThickness = 1;
}
void DIALOG_PLOT_SCHEMATIC_PDF::createPDFFile()
{
SCH_SCREEN* screen = m_Parent->GetScreen();
SCH_SHEET_PATH* sheetpath;
SCH_SHEET_PATH oldsheetpath = m_Parent->GetCurrentSheet(); // sheetpath is saved here
wxPoint plot_offset;
/* When printing all pages, the printed page is not the current page. In
* complex hierarchies, we must update component references and others
* parameters in the given printed SCH_SCREEN, accordint to the sheet path
* because in complex hierarchies a SCH_SCREEN (a drawing ) is shared
* between many sheets and component references depend on the actual sheet
* path used
*/
SCH_SHEET_LIST SheetList( NULL );
sheetpath = SheetList.GetFirst();
// Allocate the plotter and set the job level parameter
PDF_PLOTTER* plotter = new PDF_PLOTTER();
plotter->SetDefaultLineWidth( g_DrawDefaultLineThickness );
plotter->SetColorMode( m_plotColorOpt );
plotter->SetCreator( wxT( "Eeschema-PDF" ) );
// First page handling is different
bool first_page = true;
do
{
// Step over the schematic hierarchy
if( m_select_PlotAll )
{
SCH_SHEET_PATH list;
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{
m_Parent->SetCurrentSheet( list );
m_Parent->GetCurrentSheet().UpdateAllScreenReferences();
m_Parent->SetSheetNumberAndCount();
screen = m_Parent->GetCurrentSheet().LastScreen();
}
else // Should not happen
wxASSERT( 0 );
sheetpath = SheetList.GetNext();
}
if( first_page ) {
wxString msg;
wxString plotFileName = m_Parent->GetUniqueFilenameForCurrentSheet() + wxT(".")
+ PDF_PLOTTER::GetDefaultFileExtension();
msg.Printf( _( "Plot: %s " ), GetChars( plotFileName ) );
m_MsgBox->AppendText( msg );
FILE* output_file = wxFopen( plotFileName, wxT( "wb" ) );
if( output_file == NULL )
{
msg = wxT( "\n** " );
msg += _( "Unable to create " ) + plotFileName + wxT( " **\n" );
m_MsgBox->AppendText( msg );
wxBell();
return;
}
// Open the plotter and do the first page
SetLocaleTo_C_standard();
plotter->SetFilename( plotFileName );
plotSetupPage( plotter, screen );
plotter->StartPlot( output_file );
first_page = false;
}
else
{
/* For the following pages you need to close the (finished) page,
reconfigure, and then start a new one */
plotter->ClosePage();
plotSetupPage( plotter, screen );
plotter->StartPage();
}
plotOneSheet( plotter, screen );
} while (m_select_PlotAll && sheetpath );
// Everything done, close the plot and restore the environment
plotter->EndPlot();
delete plotter;
SetLocaleTo_Default();
// Restore the previous sheet
m_Parent->SetCurrentSheet( oldsheetpath );
m_Parent->GetCurrentSheet().UpdateAllScreenReferences();
m_Parent->SetSheetNumberAndCount();
}
void DIALOG_PLOT_SCHEMATIC_PDF::plotSetupPage( PDF_PLOTTER* plotter,
SCH_SCREEN* screen)
{
PAGE_INFO plotPage; // page size selected to plot
// Considerations on page size and scaling requests
PAGE_INFO actualPage = screen->GetPageSettings(); // page size selected in schematic
switch( m_pageSizeSelect )
{
case PAGE_SIZE_A:
plotPage.SetType( wxT( "A" ) );
plotPage.SetPortrait( actualPage.IsPortrait() );
break;
case PAGE_SIZE_A4:
plotPage.SetType( wxT( "A4" ) );
plotPage.SetPortrait( actualPage.IsPortrait() );
break;
case PAGE_SIZE_AUTO:
default:
plotPage = actualPage;
break;
}
double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils();
double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils();
double scale = MIN( scalex, scaley );
plotter->SetPageSettings( plotPage );
plotter->SetViewport( wxPoint( 0, 0 ), IU_PER_DECIMILS, scale, false );
}
void DIALOG_PLOT_SCHEMATIC_PDF::plotOneSheet( PDF_PLOTTER* plotter,
SCH_SCREEN* screen )
{
if( m_plot_Sheet_Ref )
{
plotter->SetColor( BLACK );
PlotWorkSheet( plotter, m_Parent->GetTitleBlock(),
m_Parent->GetPageSettings(),
screen->m_ScreenNumber, screen->m_NumberOfScreens,
m_Parent->GetScreenDesc(),
screen->GetFileName() );
}
screen->Plot( plotter );
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 17 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_plot_schematic_PDF_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_PLOT_SCHEMATIC_PDF_BASE::DIALOG_PLOT_SCHEMATIC_PDF_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bmainSizer;
bmainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bupperSizer;
bupperSizer = new wxBoxSizer( wxHORIZONTAL );
wxString m_SizeOptionChoices[] = { _("Schematic size"), _("Force size A4"), _("Force size A") };
int m_SizeOptionNChoices = sizeof( m_SizeOptionChoices ) / sizeof( wxString );
m_SizeOption = new wxRadioBox( this, wxID_ANY, _("Plot Page Size:"), wxDefaultPosition, wxDefaultSize, m_SizeOptionNChoices, m_SizeOptionChoices, 1, wxRA_SPECIFY_COLS );
m_SizeOption->SetSelection( 0 );
bupperSizer->Add( m_SizeOption, 1, wxALL, 5 );
bupperSizer->Add( 10, 10, 0, wxEXPAND, 5 );
wxBoxSizer* sbSizerMiddle;
sbSizerMiddle = new wxBoxSizer( wxVERTICAL );
wxString m_PlotPDFColorOptionChoices[] = { _("B/W"), _("Color") };
int m_PlotPDFColorOptionNChoices = sizeof( m_PlotPDFColorOptionChoices ) / sizeof( wxString );
m_PlotPDFColorOption = new wxRadioBox( this, wxID_ANY, _("Plot Mode:"), wxDefaultPosition, wxDefaultSize, m_PlotPDFColorOptionNChoices, m_PlotPDFColorOptionChoices, 1, wxRA_SPECIFY_COLS );
m_PlotPDFColorOption->SetSelection( 0 );
sbSizerMiddle->Add( m_PlotPDFColorOption, 0, wxALL|wxEXPAND, 5 );
m_Plot_Sheet_Ref_Ctrl = new wxCheckBox( this, wxID_ANY, _("Print page references"), wxDefaultPosition, wxDefaultSize, 0 );
m_Plot_Sheet_Ref_Ctrl->SetValue(true);
sbSizerMiddle->Add( m_Plot_Sheet_Ref_Ctrl, 0, wxALL|wxEXPAND, 5 );
bupperSizer->Add( sbSizerMiddle, 1, wxEXPAND, 5 );
bupperSizer->Add( 10, 10, 0, wxEXPAND, 5 );
wxBoxSizer* bbuttonsSizer;
bbuttonsSizer = new wxBoxSizer( wxVERTICAL );
m_buttonPlotPage = new wxButton( this, wxID_ANY, _("&Plot Page"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonPlotPage, 0, wxALL|wxEXPAND, 5 );
m_buttonPlotAll = new wxButton( this, wxID_ANY, _("Plot A&LL"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonPlotAll, 0, wxALL|wxEXPAND, 5 );
m_buttonClose = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonClose, 0, wxALL|wxEXPAND, 5 );
bupperSizer->Add( bbuttonsSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
bmainSizer->Add( bupperSizer, 0, wxEXPAND, 5 );
wxBoxSizer* bSizerLineWidth;
bSizerLineWidth = new wxBoxSizer( wxHORIZONTAL );
m_defaultLineWidthTitle = new wxStaticText( this, wxID_ANY, _("Default line width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_defaultLineWidthTitle->Wrap( -1 );
bSizerLineWidth->Add( m_defaultLineWidthTitle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_DefaultLineSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizerLineWidth->Add( m_DefaultLineSizeCtrl, 1, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
bmainSizer->Add( bSizerLineWidth, 0, wxEXPAND, 5 );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Messages :"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
bmainSizer->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_MsgBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY );
m_MsgBox->SetMinSize( wxSize( -1,150 ) );
bmainSizer->Add( m_MsgBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
this->SetSizer( bmainSizer );
this->Layout();
this->Centre( wxBOTH );
// Connect Events
m_buttonPlotPage->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PDF_BASE::OnPlotCurrent ), NULL, this );
m_buttonPlotAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PDF_BASE::OnPlotAll ), NULL, this );
m_buttonClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PDF_BASE::OnCancelClick ), NULL, this );
}
DIALOG_PLOT_SCHEMATIC_PDF_BASE::~DIALOG_PLOT_SCHEMATIC_PDF_BASE()
{
// Disconnect Events
m_buttonPlotPage->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PDF_BASE::OnPlotCurrent ), NULL, this );
m_buttonPlotAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PDF_BASE::OnPlotAll ), NULL, this );
m_buttonClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PDF_BASE::OnCancelClick ), NULL, this );
}
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 17 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_plot_schematic_PDF_base__
#define __dialog_plot_schematic_PDF_base__
#include <wx/intl.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/checkbox.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_PLOT_SCHEMATIC_PDF_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_PLOT_SCHEMATIC_PDF_BASE : public wxDialog
{
private:
protected:
wxRadioBox* m_SizeOption;
wxRadioBox* m_PlotPDFColorOption;
wxCheckBox* m_Plot_Sheet_Ref_Ctrl;
wxButton* m_buttonPlotPage;
wxButton* m_buttonPlotAll;
wxButton* m_buttonClose;
wxStaticText* m_defaultLineWidthTitle;
wxTextCtrl* m_DefaultLineSizeCtrl;
wxStaticText* m_staticText1;
wxTextCtrl* m_MsgBox;
// Virtual event handlers, overide them in your derived class
virtual void OnPlotCurrent( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPlotAll( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_PLOT_SCHEMATIC_PDF_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plot PDF"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 387,365 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PLOT_SCHEMATIC_PDF_BASE();
};
#endif //__dialog_plot_schematic_PDF_base__
/** @file dialog_plot_schematic_PS.cpp
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2010 Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr
* Copyright (C) 1992-2010 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 <gr_basic.h>
#include <confirm.h>
#include <worksheet.h>
#include <plot_common.h>
#include <class_sch_screen.h>
#include <wxEeschemaStruct.h>
#include <base_units.h>
#include <general.h>
#include <protos.h>
#include <sch_sheet_path.h>
enum PageFormatReq {
PAGE_SIZE_AUTO,
PAGE_SIZE_A4,
PAGE_SIZE_A
};
#include <dialog_plot_schematic_PS_base.h>
class DIALOG_PLOT_SCHEMATIC_PS : public DIALOG_PLOT_SCHEMATIC_PS_BASE
{
private:
SCH_EDIT_FRAME* m_Parent;
public:
/// Constructors
DIALOG_PLOT_SCHEMATIC_PS( SCH_EDIT_FRAME* parent );
private:
static bool m_plotColorOpt;
static int m_pageSizeSelect;
static bool m_plot_Sheet_Ref;
bool m_select_PlotAll;
private:
void OnPlotCurrent( wxCommandEvent& event );
void OnPlotAll( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
void initDlg();
void initOptVars();
void createPSFile();
void plotOneSheetPS( const wxString& FileName,
SCH_SCREEN* screen, const PAGE_INFO& pageInfo,
wxPoint plot_offset, double scale );
};
// static members (static to remember last state):
bool DIALOG_PLOT_SCHEMATIC_PS::m_plotColorOpt = false;
int DIALOG_PLOT_SCHEMATIC_PS::m_pageSizeSelect = PAGE_SIZE_AUTO;
bool DIALOG_PLOT_SCHEMATIC_PS::m_plot_Sheet_Ref = true;
void SCH_EDIT_FRAME::ToPlot_PS( wxCommandEvent& event )
{
DIALOG_PLOT_SCHEMATIC_PS dlg( this );
dlg.ShowModal();
}
DIALOG_PLOT_SCHEMATIC_PS::DIALOG_PLOT_SCHEMATIC_PS( SCH_EDIT_FRAME* parent ) :
DIALOG_PLOT_SCHEMATIC_PS_BASE( parent )
{
m_Parent = parent;
m_select_PlotAll = false;
initDlg();
GetSizer()->SetSizeHints( this );
Centre();
m_buttonPlotAll->SetDefault();
}
/*!
* Control creation for DIALOG_PLOT_SCHEMATIC_PS
*/
void DIALOG_PLOT_SCHEMATIC_PS::initDlg()
{
SetFocus(); // make the ESC work
// Set options
m_SizeOption->SetSelection( m_pageSizeSelect );
m_PlotPSColorOption->SetSelection( m_plotColorOpt ? 1 : 0 );
m_Plot_Sheet_Ref_Ctrl->SetValue( m_plot_Sheet_Ref );
AddUnitSymbol( *m_defaultLineWidthTitle, g_UserUnit );
PutValueInLocalUnits( *m_DefaultLineSizeCtrl, g_DrawDefaultLineThickness );
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON
*/
void DIALOG_PLOT_SCHEMATIC_PS::OnPlotCurrent( wxCommandEvent& event )
{
m_select_PlotAll = false;
initOptVars();
createPSFile();
m_MsgBox->AppendText( wxT( "*****\n" ) );
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON1
*/
void DIALOG_PLOT_SCHEMATIC_PS::OnPlotAll( wxCommandEvent& event )
{
m_select_PlotAll = true;
initOptVars();
createPSFile();
m_MsgBox->AppendText( wxT( "*****\n" ) );
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/
void DIALOG_PLOT_SCHEMATIC_PS::OnCancelClick( wxCommandEvent& event )
{
initOptVars();
EndModal( 0 );
}
void DIALOG_PLOT_SCHEMATIC_PS::initOptVars()
{
m_plot_Sheet_Ref = m_Plot_Sheet_Ref_Ctrl->GetValue();
m_plotColorOpt = m_PlotPSColorOption->GetSelection();
m_pageSizeSelect = m_SizeOption->GetSelection();
g_DrawDefaultLineThickness = ReturnValueFromTextCtrl( *m_DefaultLineSizeCtrl );
if( g_DrawDefaultLineThickness < 1 )
g_DrawDefaultLineThickness = 1;
}
void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
{
SCH_SCREEN* screen = m_Parent->GetScreen();
SCH_SHEET_PATH* sheetpath;
SCH_SHEET_PATH oldsheetpath = m_Parent->GetCurrentSheet(); // sheetpath is saved here
wxString plotFileName;
PAGE_INFO actualPage; // page size selected in schematic
PAGE_INFO plotPage; // page size selected to plot
wxPoint plot_offset;
/* When printing all pages, the printed page is not the current page.
* In complex hierarchies, we must update component references
* and others parameters in the given printed SCH_SCREEN, accordint to the sheet path
* because in complex hierarchies a SCH_SCREEN (a drawing )
* is shared between many sheets and component references depend on the actual sheet path used
*/
SCH_SHEET_LIST SheetList( NULL );
sheetpath = SheetList.GetFirst();
SCH_SHEET_PATH list;
while( true )
{
if( m_select_PlotAll )
{
if( sheetpath == NULL )
break;
list.Clear();
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{
m_Parent->SetCurrentSheet( list );
m_Parent->GetCurrentSheet().UpdateAllScreenReferences();
m_Parent->SetSheetNumberAndCount();
screen = m_Parent->GetCurrentSheet().LastScreen();
}
else // Should not happen
return;
sheetpath = SheetList.GetNext();
}
actualPage = screen->GetPageSettings();
switch( m_pageSizeSelect )
{
case PAGE_SIZE_A:
plotPage.SetType( wxT( "A" ) );
plotPage.SetPortrait( actualPage.IsPortrait() );
break;
case PAGE_SIZE_A4:
plotPage.SetType( wxT( "A4" ) );
plotPage.SetPortrait( actualPage.IsPortrait() );
break;
case PAGE_SIZE_AUTO:
default:
plotPage = actualPage;
break;
}
double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils();
double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils();
double scale = MIN( scalex, scaley );
plot_offset.x = 0;
plot_offset.y = 0;
plotFileName = m_Parent->GetUniqueFilenameForCurrentSheet() + wxT(".")
+ PS_PLOTTER::GetDefaultFileExtension();
plotOneSheetPS( plotFileName, screen, plotPage, plot_offset, scale );
if( !m_select_PlotAll )
break;
}
m_Parent->SetCurrentSheet( oldsheetpath );
m_Parent->GetCurrentSheet().UpdateAllScreenReferences();
m_Parent->SetSheetNumberAndCount();
}
void DIALOG_PLOT_SCHEMATIC_PS::plotOneSheetPS( const wxString& FileName,
SCH_SCREEN* screen,
const PAGE_INFO& pageInfo,
wxPoint plot_offset,
double scale )
{
wxString msg;
FILE* output_file = wxFopen( FileName, wxT( "wt" ) );
if( output_file == NULL )
{
msg = wxT( "\n** " );
msg += _( "Unable to create " ) + FileName + wxT( " **\n" );
m_MsgBox->AppendText( msg );
wxBell();
return;
}
SetLocaleTo_C_standard();
msg.Printf( _( "Plot: %s " ), GetChars( FileName ) );
m_MsgBox->AppendText( msg );
PS_PLOTTER* plotter = new PS_PLOTTER();
plotter->SetPageSettings( pageInfo );
plotter->SetDefaultLineWidth( g_DrawDefaultLineThickness );
plotter->SetColorMode( m_plotColorOpt );
plotter->SetViewport( plot_offset, IU_PER_DECIMILS, scale, false );
// Init :
plotter->SetCreator( wxT( "Eeschema-PS" ) );
plotter->SetFilename( FileName );
plotter->StartPlot( output_file );
if( m_plot_Sheet_Ref )
{
plotter->SetColor( BLACK );
PlotWorkSheet( plotter, m_Parent->GetTitleBlock(),
m_Parent->GetPageSettings(),
screen->m_ScreenNumber, screen->m_NumberOfScreens,
m_Parent->GetScreenDesc(),
screen->GetFileName() );
}
screen->Plot( plotter );
plotter->EndPlot();
delete plotter;
SetLocaleTo_Default();
m_MsgBox->AppendText( wxT( "Ok\n" ) );
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 17 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_plot_schematic_PS_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_PLOT_SCHEMATIC_PS_BASE::DIALOG_PLOT_SCHEMATIC_PS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bmainSizer;
bmainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bupperSizer;
bupperSizer = new wxBoxSizer( wxHORIZONTAL );
wxString m_SizeOptionChoices[] = { _("Schematic size"), _("Force size A4"), _("Force size A") };
int m_SizeOptionNChoices = sizeof( m_SizeOptionChoices ) / sizeof( wxString );
m_SizeOption = new wxRadioBox( this, wxID_ANY, _("Plot Page Size:"), wxDefaultPosition, wxDefaultSize, m_SizeOptionNChoices, m_SizeOptionChoices, 1, wxRA_SPECIFY_COLS );
m_SizeOption->SetSelection( 0 );
bupperSizer->Add( m_SizeOption, 1, wxALL, 5 );
bupperSizer->Add( 10, 10, 0, wxEXPAND, 5 );
wxBoxSizer* sbSizerMiddle;
sbSizerMiddle = new wxBoxSizer( wxVERTICAL );
wxString m_PlotPSColorOptionChoices[] = { _("B/W"), _("Color") };
int m_PlotPSColorOptionNChoices = sizeof( m_PlotPSColorOptionChoices ) / sizeof( wxString );
m_PlotPSColorOption = new wxRadioBox( this, wxID_ANY, _("Plot Mode:"), wxDefaultPosition, wxDefaultSize, m_PlotPSColorOptionNChoices, m_PlotPSColorOptionChoices, 1, wxRA_SPECIFY_COLS );
m_PlotPSColorOption->SetSelection( 0 );
sbSizerMiddle->Add( m_PlotPSColorOption, 0, wxALL|wxEXPAND, 5 );
m_Plot_Sheet_Ref_Ctrl = new wxCheckBox( this, wxID_ANY, _("Print page references"), wxDefaultPosition, wxDefaultSize, 0 );
m_Plot_Sheet_Ref_Ctrl->SetValue(true);
sbSizerMiddle->Add( m_Plot_Sheet_Ref_Ctrl, 0, wxALL|wxEXPAND, 5 );
bupperSizer->Add( sbSizerMiddle, 1, wxEXPAND, 5 );
bupperSizer->Add( 10, 10, 0, wxEXPAND, 5 );
wxBoxSizer* bbuttonsSizer;
bbuttonsSizer = new wxBoxSizer( wxVERTICAL );
m_buttonPlotPage = new wxButton( this, wxID_ANY, _("&Plot Page"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonPlotPage, 0, wxALL|wxEXPAND, 5 );
m_buttonPlotAll = new wxButton( this, wxID_ANY, _("Plot A&LL"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonPlotAll, 0, wxALL|wxEXPAND, 5 );
m_buttonClose = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonClose, 0, wxALL|wxEXPAND, 5 );
bupperSizer->Add( bbuttonsSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
bmainSizer->Add( bupperSizer, 0, wxEXPAND, 5 );
wxBoxSizer* bSizerLineWidth;
bSizerLineWidth = new wxBoxSizer( wxHORIZONTAL );
m_defaultLineWidthTitle = new wxStaticText( this, wxID_ANY, _("Default line width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_defaultLineWidthTitle->Wrap( -1 );
bSizerLineWidth->Add( m_defaultLineWidthTitle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_DefaultLineSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizerLineWidth->Add( m_DefaultLineSizeCtrl, 1, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
bmainSizer->Add( bSizerLineWidth, 0, wxEXPAND, 5 );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Messages :"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
bmainSizer->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_MsgBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY );
m_MsgBox->SetMinSize( wxSize( -1,150 ) );
bmainSizer->Add( m_MsgBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
this->SetSizer( bmainSizer );
this->Layout();
this->Centre( wxBOTH );
// Connect Events
m_buttonPlotPage->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PS_BASE::OnPlotCurrent ), NULL, this );
m_buttonPlotAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PS_BASE::OnPlotAll ), NULL, this );
m_buttonClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PS_BASE::OnCancelClick ), NULL, this );
}
DIALOG_PLOT_SCHEMATIC_PS_BASE::~DIALOG_PLOT_SCHEMATIC_PS_BASE()
{
// Disconnect Events
m_buttonPlotPage->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PS_BASE::OnPlotCurrent ), NULL, this );
m_buttonPlotAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PS_BASE::OnPlotAll ), NULL, this );
m_buttonClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PS_BASE::OnCancelClick ), NULL, this );
}
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 17 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_plot_schematic_PS_base__
#define __dialog_plot_schematic_PS_base__
#include <wx/intl.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/checkbox.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_PLOT_SCHEMATIC_PS_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_PLOT_SCHEMATIC_PS_BASE : public wxDialog
{
private:
protected:
wxRadioBox* m_SizeOption;
wxRadioBox* m_PlotPSColorOption;
wxCheckBox* m_Plot_Sheet_Ref_Ctrl;
wxButton* m_buttonPlotPage;
wxButton* m_buttonPlotAll;
wxButton* m_buttonClose;
wxStaticText* m_defaultLineWidthTitle;
wxTextCtrl* m_DefaultLineSizeCtrl;
wxStaticText* m_staticText1;
wxTextCtrl* m_MsgBox;
// Virtual event handlers, overide them in your derived class
virtual void OnPlotCurrent( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPlotAll( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_PLOT_SCHEMATIC_PS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plot PostScript"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 387,365 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PLOT_SCHEMATIC_PS_BASE();
};
#endif //__dialog_plot_schematic_PS_base__
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_plot_schematic_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_PLOT_SCHEMATIC_BASE::DIALOG_PLOT_SCHEMATIC_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( wxVERTICAL );
m_optionsSizer = new wxBoxSizer( wxHORIZONTAL );
m_paperOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Paper Options") ), wxVERTICAL );
wxString m_PaperSizeOptionChoices[] = { _("Schematic size"), _("Force size A4"), _("Force size A") };
int m_PaperSizeOptionNChoices = sizeof( m_PaperSizeOptionChoices ) / sizeof( wxString );
m_PaperSizeOption = new wxRadioBox( this, wxID_ANY, _("Plot Page Size:"), wxDefaultPosition, wxDefaultSize, m_PaperSizeOptionNChoices, m_PaperSizeOptionChoices, 1, wxRA_SPECIFY_COLS );
m_PaperSizeOption->SetSelection( 0 );
m_paperOptionsSizer->Add( m_PaperSizeOption, 0, wxALL|wxEXPAND, 5 );
m_paperHPGLSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("HPGL Options:") ), wxVERTICAL );
m_staticText4 = new wxStaticText( this, wxID_ANY, _("Plot Page Size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText4->Wrap( -1 );
m_paperHPGLSizer->Add( m_staticText4, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
wxString m_HPGLPaperSizeOptionChoices[] = { _("Schematic size"), _("Page size A4"), _("Page size A3"), _("Page size A2"), _("Page size A1"), _("Page size A0"), _("Page size A"), _("Page size B"), _("Page size C"), _("Page size D"), _("Page size E") };
int m_HPGLPaperSizeOptionNChoices = sizeof( m_HPGLPaperSizeOptionChoices ) / sizeof( wxString );
m_HPGLPaperSizeOption = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_HPGLPaperSizeOptionNChoices, m_HPGLPaperSizeOptionChoices, 0 );
m_HPGLPaperSizeOption->SetSelection( 0 );
m_paperHPGLSizer->Add( m_HPGLPaperSizeOption, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxString m_plotOriginOptChoices[] = { _("Bottom left corner"), _("Center of the page") };
int m_plotOriginOptNChoices = sizeof( m_plotOriginOptChoices ) / sizeof( wxString );
m_plotOriginOpt = new wxRadioBox( this, wxID_ANY, _("Plot Origin:"), wxDefaultPosition, wxDefaultSize, m_plotOriginOptNChoices, m_plotOriginOptChoices, 1, wxRA_SPECIFY_COLS );
m_plotOriginOpt->SetSelection( 0 );
m_paperHPGLSizer->Add( m_plotOriginOpt, 0, wxALL, 5 );
m_penHPLGWidthTitle = new wxStaticText( this, wxID_ANY, _("Pen Width"), wxDefaultPosition, wxDefaultSize, 0 );
m_penHPLGWidthTitle->Wrap( -1 );
m_paperHPGLSizer->Add( m_penHPLGWidthTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_penHPGLWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_paperHPGLSizer->Add( m_penHPGLWidthCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
m_paperOptionsSizer->Add( m_paperHPGLSizer, 1, wxEXPAND, 5 );
m_optionsSizer->Add( m_paperOptionsSizer, 1, wxEXPAND, 5 );
wxStaticBoxSizer* sbSizerPlotFormat;
sbSizerPlotFormat = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("General options") ), wxVERTICAL );
wxString m_plotFormatOptChoices[] = { _("Postscript"), _("PDF"), _("SVG"), _("DXF"), _("HPGL") };
int m_plotFormatOptNChoices = sizeof( m_plotFormatOptChoices ) / sizeof( wxString );
m_plotFormatOpt = new wxRadioBox( this, wxID_ANY, _("Plot format:"), wxDefaultPosition, wxDefaultSize, m_plotFormatOptNChoices, m_plotFormatOptChoices, 1, wxRA_SPECIFY_COLS );
m_plotFormatOpt->SetSelection( 0 );
sbSizerPlotFormat->Add( m_plotFormatOpt, 0, wxALL|wxEXPAND, 5 );
m_optionsSizer->Add( sbSizerPlotFormat, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
wxStaticBoxSizer* sbOptionsSizer;
sbOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Plot options:") ), wxVERTICAL );
m_defaultLineWidthTitle = new wxStaticText( this, wxID_ANY, _("Default Thickness"), wxDefaultPosition, wxDefaultSize, 0 );
m_defaultLineWidthTitle->Wrap( -1 );
sbOptionsSizer->Add( m_defaultLineWidthTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_DefaultLineSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_DefaultLineSizeCtrl->SetToolTip( _("Selection of the default pen thickness used to draw items, when their thickness is set to 0.") );
sbOptionsSizer->Add( m_DefaultLineSizeCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxString m_ModeColorOptionChoices[] = { _("Color"), _("Black and white") };
int m_ModeColorOptionNChoices = sizeof( m_ModeColorOptionChoices ) / sizeof( wxString );
m_ModeColorOption = new wxRadioBox( this, wxID_ANY, _("Plot mode"), wxDefaultPosition, wxDefaultSize, m_ModeColorOptionNChoices, m_ModeColorOptionChoices, 1, wxRA_SPECIFY_COLS );
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_PlotFrameRefOpt = new wxCheckBox( this, wxID_ANY, _("Plot frame ref"), wxDefaultPosition, wxDefaultSize, 0 );
m_PlotFrameRefOpt->SetValue(true);
m_PlotFrameRefOpt->SetToolTip( _("Print (or not) the Frame references.") );
sbOptionsSizer->Add( m_PlotFrameRefOpt, 0, wxALL, 5 );
m_optionsSizer->Add( sbOptionsSizer, 1, 0, 5 );
m_ButtonsSizer = new wxBoxSizer( wxVERTICAL );
m_buttonPlotCurrent = new wxButton( this, wxID_PRINT_CURRENT, _("Plot Current"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonPlotCurrent->SetDefault();
m_ButtonsSizer->Add( m_buttonPlotCurrent, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_buttonPlotAll = new wxButton( this, wxID_PRINT_ALL, _("Plot All"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonPlotAll->SetDefault();
m_ButtonsSizer->Add( m_buttonPlotAll, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_buttonQuit = new wxButton( this, wxID_CANCEL, _("Quit"), wxDefaultPosition, wxDefaultSize, 0 );
m_ButtonsSizer->Add( m_buttonQuit, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_optionsSizer->Add( m_ButtonsSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
bMainSizer->Add( m_optionsSizer, 0, wxEXPAND, 5 );
m_staticText2 = new wxStaticText( this, wxID_ANY, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText2->Wrap( -1 );
bMainSizer->Add( m_staticText2, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_MessagesBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE );
m_MessagesBox->SetMinSize( wxSize( -1,80 ) );
bMainSizer->Add( m_MessagesBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
this->SetSizer( bMainSizer );
this->Layout();
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnCloseWindow ) );
m_HPGLPaperSizeOption->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnHPGLPageSelected ), NULL, this );
m_plotFormatOpt->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnPlotFormatSelection ), NULL, this );
m_buttonPlotCurrent->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnButtonPlotCurrentClick ), NULL, this );
m_buttonPlotAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnButtonPlotAllClick ), NULL, this );
m_buttonQuit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnButtonCancelClick ), NULL, this );
}
DIALOG_PLOT_SCHEMATIC_BASE::~DIALOG_PLOT_SCHEMATIC_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnCloseWindow ) );
m_HPGLPaperSizeOption->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnHPGLPageSelected ), NULL, this );
m_plotFormatOpt->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnPlotFormatSelection ), NULL, this );
m_buttonPlotCurrent->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnButtonPlotCurrentClick ), NULL, this );
m_buttonPlotAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnButtonPlotAllClick ), NULL, this );
m_buttonQuit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnButtonCancelClick ), NULL, this );
}
///////////////////////////////////////////////////////////////////////////
// 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!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_SVG_PRINT_BASE_H__
#define __DIALOG_SVG_PRINT_BASE_H__
#ifndef __DIALOG_PLOT_SCHEMATIC_BASE_H__
#define __DIALOG_PLOT_SCHEMATIC_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/stattext.h>
#include <wx/radiobox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/stattext.h>
#include <wx/choice.h>
#include <wx/textctrl.h>
#include <wx/radiobox.h>
#include <wx/checkbox.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/checkbox.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_SVG_PRINT_base
/// Class DIALOG_PLOT_SCHEMATIC_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_SVG_PRINT_base : public wxDialog
class DIALOG_PLOT_SCHEMATIC_BASE : public DIALOG_SHIM
{
private:
......@@ -38,25 +40,34 @@ class DIALOG_SVG_PRINT_base : public wxDialog
enum
{
wxID_PRINT_CURRENT = 1000,
wxID_PRINT_ALL,
wxID_PRINT_ALL
};
wxStaticText* m_TextPenWidth;
wxTextCtrl* m_DialogPenWidth;
wxBoxSizer* m_optionsSizer;
wxStaticBoxSizer* m_paperOptionsSizer;
wxRadioBox* m_PaperSizeOption;
wxStaticBoxSizer* m_paperHPGLSizer;
wxStaticText* m_staticText4;
wxChoice* m_HPGLPaperSizeOption;
wxRadioBox* m_plotOriginOpt;
wxStaticText* m_penHPLGWidthTitle;
wxTextCtrl* m_penHPGLWidthCtrl;
wxRadioBox* m_plotFormatOpt;
wxStaticText* m_defaultLineWidthTitle;
wxTextCtrl* m_DefaultLineSizeCtrl;
wxRadioBox* m_ModeColorOption;
wxCheckBox* m_Print_Sheet_Ref;
wxCheckBox* m_PlotFrameRefOpt;
wxBoxSizer* m_ButtonsSizer;
wxButton* m_buttonPlotCurrent;
wxButton* m_buttonPlotAll;
wxButton* m_buttonQuit;
wxStaticText* m_staticText1;
wxTextCtrl* m_FileNameCtrl;
wxStaticText* m_staticText2;
wxTextCtrl* m_MessagesBox;
// Virtual event handlers, overide them in your derived class
virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); }
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
virtual void OnSetColorModeSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnHPGLPageSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPlotFormatSelection( wxCommandEvent& event ) { event.Skip(); }
virtual void OnButtonPlotCurrentClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnButtonPlotAllClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnButtonCancelClick( wxCommandEvent& event ) { event.Skip(); }
......@@ -64,9 +75,9 @@ class DIALOG_SVG_PRINT_base : public wxDialog
public:
DIALOG_SVG_PRINT_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Create SVG file"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 550,446 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_SVG_PRINT_base();
DIALOG_PLOT_SCHEMATIC_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Create Plot File"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,431 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PLOT_SCHEMATIC_BASE();
};
#endif //__DIALOG_SVG_PRINT_BASE_H__
#endif //__DIALOG_PLOT_SCHEMATIC_BASE_H__
......@@ -57,6 +57,7 @@ enum id_eeschema_frm
ID_GET_ANNOTATE,
ID_GET_ERC,
ID_BACKANNO_ITEMS,
ID_GEN_PLOT_SCHEMATIC,
/* Schematic editor veritcal toolbar IDs */
ID_SCHEMATIC_VERTICAL_TOOLBAR_START,
......
......@@ -2,6 +2,30 @@
* @file libedit_plot_component.cpp
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2012 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
*/
#include <fctsys.h>
#include <gr_basic.h>
......@@ -15,7 +39,7 @@
#include <general.h>
#include <libeditframe.h>
#include <class_library.h>
#include <dialogs/dialog_SVG_print.h>
#include <dialogs/dialog_plot_schematic.h>
void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
......@@ -69,22 +93,6 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
if( FullFileName.IsEmpty() )
return;
#if 0 // would the PAGE_INFO margins work for this old code:
// Give a size to the SVG draw area = component size + margin
// the margin is 10% the size of the component size
wxSize pagesize = GetScreen()->ReturnPageSize( );
wxSize componentSize = m_component->GetBoundingBox( m_unit, m_convert ).GetSize();
// Add a small margin to the plot bounding box
componentSize.x = (int)(componentSize.x * 1.2);
componentSize.y = (int)(componentSize.y * 1.2);
GetScreen()->SetPageSize( componentSize );
SVG_Print_Component( FullFileName );
GetScreen()->SetPageSize( pagesize );
#else
PAGE_INFO pageSave = GetScreen()->GetPageSettings();
PAGE_INFO pageTemp = pageSave;
......@@ -97,7 +105,6 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
GetScreen()->SetPageSettings( pageTemp );
SVG_Print_Component( FullFileName );
GetScreen()->SetPageSettings( pageSave );
#endif
}
break;
}
......@@ -131,7 +138,10 @@ void LIB_EDIT_FRAME::CreatePNGorJPEGFile( const wxString& aFileName, bool aFmt_j
void LIB_EDIT_FRAME::SVG_Print_Component( const wxString& FullFileName )
{
DIALOG_SVG_PRINT::DrawSVGPage( this, FullFileName, GetScreen() );
bool plotBW = false;
bool plotFrameRef = false;
DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG( this, FullFileName, GetScreen(),
plotBW, plotFrameRef );
}
void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode, void* aData)
......
This diff is collapsed.
......@@ -56,7 +56,6 @@
#include <dialogs/dialog_erc.h>
#include <dialogs/dialog_print_using_printer.h>
#include <dialogs/dialog_schematic_find.h>
#include <dialogs/dialog_SVG_print.h>
#include <wx/display.h>
#include <build_version.h>
......@@ -82,11 +81,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_MENU( ID_SAVE_PROJECT, SCH_EDIT_FRAME::OnSaveProject )
EVT_MENU( ID_SAVE_ONE_SHEET, SCH_EDIT_FRAME::Save_File )
EVT_MENU( ID_SAVE_ONE_SHEET_AS, SCH_EDIT_FRAME::Save_File )
EVT_MENU( ID_GEN_PLOT_PS, SCH_EDIT_FRAME::ToPlot_PS )
EVT_MENU( ID_GEN_PLOT_HPGL, SCH_EDIT_FRAME::ToPlot_HPGL )
EVT_MENU( ID_GEN_PLOT_SVG, SCH_EDIT_FRAME::SVG_Print )
EVT_MENU( ID_GEN_PLOT_DXF, SCH_EDIT_FRAME::ToPlot_DXF )
EVT_MENU( ID_GEN_PLOT_PDF, SCH_EDIT_FRAME::ToPlot_PDF )
EVT_MENU( ID_GEN_PLOT_SCHEMATIC, SCH_EDIT_FRAME::PlotSchematic )
EVT_MENU( ID_GEN_COPY_SHEET_TO_CLIPBOARD, EDA_DRAW_FRAME::CopyToClipboard )
EVT_MENU( wxID_EXIT, SCH_EDIT_FRAME::OnExit )
......@@ -853,15 +848,6 @@ void SCH_EDIT_FRAME::OnPrint( wxCommandEvent& event )
}
}
void SCH_EDIT_FRAME::SVG_Print( wxCommandEvent& event )
{
DIALOG_SVG_PRINT frame( this );
frame.ShowModal();
}
void SCH_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode, void* aData )
{
GetScreen()->Draw( m_canvas, aDC, GR_DEFAULT_DRAWMODE );
......
This diff is collapsed.
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