Commit 0037e153 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)
remove duplicate code and clean it.
Simplify HPGL dialog: plot offet removed and replaced by only one option:
plot origin to center of sheet or not (some HPGL  plotters have the plot origin to center of the paper area,
and others have this origin at the bottom left corner)
This is surely enough.
parents 3ed33e39 996bf80d
...@@ -90,10 +90,10 @@ void HPGL_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_T fill, ...@@ -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) * 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) FILL_T aFill, int aWidth)
{ {
if( aCornerList.size() <= 1 ) if( aCornerList.size() <= 1 )
...@@ -175,13 +175,13 @@ void HPGL_PLOTTER::SetDash( bool dashed ) ...@@ -175,13 +175,13 @@ void HPGL_PLOTTER::SetDash( bool dashed )
{ {
wxASSERT( outputFile ); wxASSERT( outputFile );
if( dashed ) if( dashed )
fputs( "LI 2;\n", stderr ); fputs( "LI 2;\n", outputFile );
else 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 ) int width, EDA_DRAW_MODE_T tracemode )
{ {
wxASSERT( outputFile ); wxASSERT( outputFile );
...@@ -189,7 +189,7 @@ void HPGL_PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end, ...@@ -189,7 +189,7 @@ void HPGL_PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end,
wxSize size; wxSize size;
// Suppress overlap if pen is too big or in line mode // Suppress overlap if pen is too big or in line mode
if( (penDiameter >= width) || (tracemode == LINE) ) if( (penDiameter >= width) || (tracemode == LINE) )
{ {
MoveTo( start ); MoveTo( start );
FinishTo( end ); FinishTo( end );
...@@ -302,7 +302,7 @@ void HPGL_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre, ...@@ -302,7 +302,7 @@ void HPGL_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre,
double rsize = userToDeviceSize( radius ); 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 ); pos_dev.x, pos_dev.y, rsize );
if( trace_mode == FILLED ) // Plot in filled mode. if( trace_mode == FILLED ) // Plot in filled mode.
......
...@@ -12,14 +12,6 @@ include_directories( ...@@ -12,14 +12,6 @@ include_directories(
set(EESCHEMA_DLGS set(EESCHEMA_DLGS
dialogs/dialog_color_config.cpp 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/annotate_dialog.cpp
dialogs/dialog_annotate_base.cpp dialogs/dialog_annotate_base.cpp
dialogs/dialog_lib_edit_text.cpp dialogs/dialog_lib_edit_text.cpp
...@@ -50,6 +42,8 @@ set(EESCHEMA_DLGS ...@@ -50,6 +42,8 @@ set(EESCHEMA_DLGS
dialogs/dialog_lib_new_component.cpp dialogs/dialog_lib_new_component.cpp
dialogs/dialog_lib_new_component_base.cpp dialogs/dialog_lib_new_component_base.cpp
dialogs/dialog_netlist_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_base.cpp
dialogs/dialog_print_using_printer.cpp dialogs/dialog_print_using_printer.cpp
dialogs/dialog_sch_edit_sheet_pin.cpp dialogs/dialog_sch_edit_sheet_pin.cpp
...@@ -58,8 +52,6 @@ set(EESCHEMA_DLGS ...@@ -58,8 +52,6 @@ set(EESCHEMA_DLGS
dialogs/dialog_sch_sheet_props_base.cpp dialogs/dialog_sch_sheet_props_base.cpp
dialogs/dialog_schematic_find.cpp dialogs/dialog_schematic_find.cpp
dialogs/dialog_schematic_find_base.cpp dialogs/dialog_schematic_find_base.cpp
dialogs/dialog_SVG_print.cpp
dialogs/dialog_SVG_print_base.cpp
) )
set(EESCHEMA_SRCS set(EESCHEMA_SRCS
...@@ -125,6 +117,11 @@ set(EESCHEMA_SRCS ...@@ -125,6 +117,11 @@ set(EESCHEMA_SRCS
onrightclick.cpp onrightclick.cpp
operations_on_items_lists.cpp operations_on_items_lists.cpp
pinedit.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_base_frame.cpp
sch_bitmap.cpp sch_bitmap.cpp
sch_bus_entry.cpp sch_bus_entry.cpp
......
#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 );
};
///////////////////////////////////////////////////////////////////////////
// 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__
///////////////////////////////////////////////////////////////////////////
// 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__
///////////////////////////////////////////////////////////////////////////
// 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__
///////////////////////////////////////////////////////////////////////////
// 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/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_SVG_PRINT_BASE_H__ #ifndef __DIALOG_PLOT_SCHEMATIC_BASE_H__
#define __DIALOG_SVG_PRINT_BASE_H__ #define __DIALOG_PLOT_SCHEMATIC_BASE_H__
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h> #include <wx/string.h>
#include <wx/stattext.h> #include <wx/radiobox.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/font.h> #include <wx/font.h>
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/stattext.h>
#include <wx/choice.h>
#include <wx/textctrl.h> #include <wx/textctrl.h>
#include <wx/radiobox.h>
#include <wx/checkbox.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/statbox.h> #include <wx/statbox.h>
#include <wx/checkbox.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/dialog.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: private:
...@@ -38,25 +40,34 @@ class DIALOG_SVG_PRINT_base : public wxDialog ...@@ -38,25 +40,34 @@ class DIALOG_SVG_PRINT_base : public wxDialog
enum enum
{ {
wxID_PRINT_CURRENT = 1000, wxID_PRINT_CURRENT = 1000,
wxID_PRINT_ALL, wxID_PRINT_ALL
}; };
wxStaticText* m_TextPenWidth; wxBoxSizer* m_optionsSizer;
wxTextCtrl* m_DialogPenWidth; 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; wxRadioBox* m_ModeColorOption;
wxCheckBox* m_Print_Sheet_Ref; wxCheckBox* m_PlotFrameRefOpt;
wxBoxSizer* m_ButtonsSizer;
wxButton* m_buttonPlotCurrent; wxButton* m_buttonPlotCurrent;
wxButton* m_buttonPlotAll; wxButton* m_buttonPlotAll;
wxButton* m_buttonQuit; wxButton* m_buttonQuit;
wxStaticText* m_staticText1;
wxTextCtrl* m_FileNameCtrl;
wxStaticText* m_staticText2; wxStaticText* m_staticText2;
wxTextCtrl* m_MessagesBox; wxTextCtrl* m_MessagesBox;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); } virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); }
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); } virtual void OnHPGLPageSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSetColorModeSelected( wxCommandEvent& event ) { event.Skip(); } virtual void OnPlotFormatSelection( wxCommandEvent& event ) { event.Skip(); }
virtual void OnButtonPlotCurrentClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnButtonPlotCurrentClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnButtonPlotAllClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnButtonPlotAllClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnButtonCancelClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnButtonCancelClick( wxCommandEvent& event ) { event.Skip(); }
...@@ -64,9 +75,9 @@ class DIALOG_SVG_PRINT_base : public wxDialog ...@@ -64,9 +75,9 @@ class DIALOG_SVG_PRINT_base : public wxDialog
public: 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_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_SVG_PRINT_base(); ~DIALOG_PLOT_SCHEMATIC_BASE();
}; };
#endif //__DIALOG_SVG_PRINT_BASE_H__ #endif //__DIALOG_PLOT_SCHEMATIC_BASE_H__
...@@ -57,6 +57,7 @@ enum id_eeschema_frm ...@@ -57,6 +57,7 @@ enum id_eeschema_frm
ID_GET_ANNOTATE, ID_GET_ANNOTATE,
ID_GET_ERC, ID_GET_ERC,
ID_BACKANNO_ITEMS, ID_BACKANNO_ITEMS,
ID_GEN_PLOT_SCHEMATIC,
/* Schematic editor veritcal toolbar IDs */ /* Schematic editor veritcal toolbar IDs */
ID_SCHEMATIC_VERTICAL_TOOLBAR_START, ID_SCHEMATIC_VERTICAL_TOOLBAR_START,
......
...@@ -2,6 +2,30 @@ ...@@ -2,6 +2,30 @@
* @file libedit_plot_component.cpp * @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 <fctsys.h>
#include <gr_basic.h> #include <gr_basic.h>
...@@ -15,7 +39,7 @@ ...@@ -15,7 +39,7 @@
#include <general.h> #include <general.h>
#include <libeditframe.h> #include <libeditframe.h>
#include <class_library.h> #include <class_library.h>
#include <dialogs/dialog_SVG_print.h> #include <dialogs/dialog_plot_schematic.h>
void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event ) void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
...@@ -69,22 +93,6 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event ) ...@@ -69,22 +93,6 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
if( FullFileName.IsEmpty() ) if( FullFileName.IsEmpty() )
return; 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 pageSave = GetScreen()->GetPageSettings();
PAGE_INFO pageTemp = pageSave; PAGE_INFO pageTemp = pageSave;
...@@ -97,7 +105,6 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event ) ...@@ -97,7 +105,6 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
GetScreen()->SetPageSettings( pageTemp ); GetScreen()->SetPageSettings( pageTemp );
SVG_Print_Component( FullFileName ); SVG_Print_Component( FullFileName );
GetScreen()->SetPageSettings( pageSave ); GetScreen()->SetPageSettings( pageSave );
#endif
} }
break; break;
} }
...@@ -131,7 +138,10 @@ void LIB_EDIT_FRAME::CreatePNGorJPEGFile( const wxString& aFileName, bool aFmt_j ...@@ -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 ) 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) void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode, void* aData)
......
...@@ -141,39 +141,10 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() ...@@ -141,39 +141,10 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
// Plot submenu // Plot submenu
wxMenu* choice_plot_fmt = new wxMenu; wxMenu* choice_plot_fmt = new wxMenu;
AddMenuItem( choice_plot_fmt, ID_GEN_PLOT_SCHEMATIC,
// Plot PostScript _( "&Plot" ),
AddMenuItem( choice_plot_fmt, ID_GEN_PLOT_PS, _( "Plot schematic sheet in PostScript, PDF, SVG, DXF or HPGL format" ),
_( "Plot &PostScript" ), KiBitmap( plot_xpm ) );
_( "Plot schematic sheet in PostScript format" ),
KiBitmap( plot_ps_xpm ) );
// Plot PDF
AddMenuItem( choice_plot_fmt, ID_GEN_PLOT_PDF,
_( "Plot PDF" ),
_( "Plot schematic sheet in PDF format" ),
KiBitmap( plot_pdf_xpm ) );
// Plot HPGL
AddMenuItem( choice_plot_fmt,
ID_GEN_PLOT_HPGL,
_( "Plot &HPGL" ),
_( "Plot schematic sheet in HPGL format" ),
KiBitmap( plot_hpg_xpm ) );
// Plot SVG
AddMenuItem( choice_plot_fmt,
ID_GEN_PLOT_SVG,
_( "Plot &SVG" ),
_( "Plot schematic sheet in SVG format" ),
KiBitmap( plot_svg_xpm ) );
// Plot DXF
AddMenuItem( choice_plot_fmt,
ID_GEN_PLOT_DXF,
_( "Plot &DXF" ),
_( "Plot schematic sheet in DXF format" ),
KiBitmap( plot_dxf_xpm ) );
// Plot to Clipboard (Windows only) // Plot to Clipboard (Windows only)
#ifdef __WINDOWS__ #ifdef __WINDOWS__
......
/** @file dialog_plot_schematic_DXF.cpp /** @file plot_schematic_DXF.cpp
*/ */
/* /*
...@@ -26,124 +26,17 @@ ...@@ -26,124 +26,17 @@
*/ */
#include <fctsys.h> #include <fctsys.h>
#include <gr_basic.h>
#include <macros.h>
#include <plot_common.h> #include <plot_common.h>
#include <confirm.h>
#include <worksheet.h> #include <worksheet.h>
#include <class_sch_screen.h> #include <class_sch_screen.h>
#include <wxEeschemaStruct.h> #include <wxEeschemaStruct.h>
#include <general.h>
#include <protos.h>
#include <sch_sheet_path.h> #include <sch_sheet_path.h>
#include <dialog_plot_schematic.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( ) void DIALOG_PLOT_SCHEMATIC::CreateDXFFile( )
{ {
SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) m_Parent; SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) m_parent;
SCH_SCREEN* screen = schframe->GetScreen(); SCH_SCREEN* screen = schframe->GetScreen();
SCH_SHEET_PATH* sheetpath; SCH_SHEET_PATH* sheetpath;
SCH_SHEET_PATH oldsheetpath = schframe->GetCurrentSheet(); SCH_SHEET_PATH oldsheetpath = schframe->GetCurrentSheet();
...@@ -203,7 +96,7 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( ) ...@@ -203,7 +96,7 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
} }
void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName, void DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF( const wxString& FileName,
SCH_SCREEN* screen, SCH_SCREEN* screen,
wxPoint plot_offset, wxPoint plot_offset,
double scale ) double scale )
...@@ -217,12 +110,12 @@ void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName, ...@@ -217,12 +110,12 @@ void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
{ {
msg = wxT( "\n** " ); msg = wxT( "\n** " );
msg += _( "Unable to create " ) + FileName + wxT( " **\n" ); msg += _( "Unable to create " ) + FileName + wxT( " **\n" );
m_MsgBox->AppendText( msg ); m_MessagesBox->AppendText( msg );
return; return;
} }
msg.Printf( _( "Plot: %s " ), GetChars( FileName ) ); msg.Printf( _( "Plot: %s " ), GetChars( FileName ) );
m_MsgBox->AppendText( msg ); m_MessagesBox->AppendText( msg );
LOCALE_IO toggle; LOCALE_IO toggle;
...@@ -230,7 +123,7 @@ void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName, ...@@ -230,7 +123,7 @@ void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
const PAGE_INFO& pageInfo = screen->GetPageSettings(); const PAGE_INFO& pageInfo = screen->GetPageSettings();
plotter->SetPageSettings( pageInfo ); plotter->SetPageSettings( pageInfo );
plotter->SetColorMode( m_plotColorOpt ); plotter->SetColorMode( getModeColor() );
plotter->SetViewport( plot_offset, IU_PER_DECIMILS, scale, false ); plotter->SetViewport( plot_offset, IU_PER_DECIMILS, scale, false );
// Init : // Init :
...@@ -238,13 +131,13 @@ void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName, ...@@ -238,13 +131,13 @@ void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
plotter->SetFilename( FileName ); plotter->SetFilename( FileName );
plotter->StartPlot( output_file ); plotter->StartPlot( output_file );
if( m_plot_Sheet_Ref ) if( getPlotFrameRef() )
{ {
plotter->SetColor( BLACK ); plotter->SetColor( BLACK );
PlotWorkSheet( plotter, m_Parent->GetTitleBlock(), PlotWorkSheet( plotter, m_parent->GetTitleBlock(),
m_Parent->GetPageSettings(), m_parent->GetPageSettings(),
screen->m_ScreenNumber, screen->m_NumberOfScreens, screen->m_ScreenNumber, screen->m_NumberOfScreens,
m_Parent->GetScreenDesc(), m_parent->GetScreenDesc(),
screen->GetFileName() ); screen->GetFileName() );
} }
...@@ -254,5 +147,5 @@ void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName, ...@@ -254,5 +147,5 @@ void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
plotter->EndPlot(); plotter->EndPlot();
delete plotter; delete plotter;
m_MsgBox->AppendText( wxT( "Ok\n" ) ); m_MessagesBox->AppendText( wxT( "Ok\n" ) );
} }
This diff is collapsed.
...@@ -589,14 +589,10 @@ public: ...@@ -589,14 +589,10 @@ public:
void SetPrintMonochrome( bool aMonochrome ) { m_printMonochrome = aMonochrome; } void SetPrintMonochrome( bool aMonochrome ) { m_printMonochrome = aMonochrome; }
bool GetPrintSheetReference() { return m_printSheetReference; } bool GetPrintSheetReference() { return m_printSheetReference; }
void SetPrintSheetReference( bool aShow ) { m_printSheetReference = aShow; } void SetPrintSheetReference( bool aShow ) { m_printSheetReference = aShow; }
void SVG_Print( wxCommandEvent& event );
// Plot functions: // Plot functions:
void ToPlot_PS( wxCommandEvent& event ); // void ToPostProcess( wxCommandEvent& event );
void ToPlot_PDF( wxCommandEvent& event ); void PlotSchematic( wxCommandEvent& event );
void ToPlot_HPGL( wxCommandEvent& event );
void ToPlot_DXF( wxCommandEvent& event );
void ToPostProcess( wxCommandEvent& event );
// read and save files // read and save files
void Save_File( wxCommandEvent& event ); void Save_File( wxCommandEvent& event );
......
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