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.
This commit is contained in:
parent
a9744e3f84
commit
16064881be
|
@ -175,9 +175,9 @@ 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 );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,291 +0,0 @@
|
|||
/*
|
||||
* 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();
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
|
||||
#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_
|
|
@ -1,107 +0,0 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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 );
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,293 @@
|
|||
/** @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" ) );
|
||||
}
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
/** @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 );
|
||||
};
|
|
@ -1,258 +0,0 @@
|
|||
/** @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" ) );
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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 );
|
||||
|
||||
}
|
|
@ -1,546 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<wxFormBuilder_Project>
|
||||
<FileVersion major="1" minor="10" />
|
||||
<object class="Project" expanded="1">
|
||||
<property name="class_decoration"></property>
|
||||
<property name="code_generation">C++</property>
|
||||
<property name="disconnect_events">1</property>
|
||||
<property name="disconnect_mode">source_name</property>
|
||||
<property name="disconnect_python_events">0</property>
|
||||
<property name="encoding">UTF-8</property>
|
||||
<property name="event_generation">connect</property>
|
||||
<property name="file">dialog_plot_schematic_DXF_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">dialog_plot_schematic_DXF</property>
|
||||
<property name="namespace"></property>
|
||||
<property name="path">.</property>
|
||||
<property name="precompiled_header"></property>
|
||||
<property name="relative_path">1</property>
|
||||
<property name="skip_python_events">1</property>
|
||||
<property name="use_enum">0</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Dialog" expanded="1">
|
||||
<property name="bg"></property>
|
||||
<property name="center">wxBOTH</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="event_handler">impl_virtual</property>
|
||||
<property name="extra_style"></property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">DIALOG_PLOT_SCHEMATIC_DXF_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">387,365</property>
|
||||
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
||||
<property name="subclass"></property>
|
||||
<property name="title">Plot DXF</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnActivate"></event>
|
||||
<event name="OnActivateApp"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnClose"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnHibernate"></event>
|
||||
<event name="OnIconize"></event>
|
||||
<event name="OnIdle"></event>
|
||||
<event name="OnInitDialog"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bmainSizer</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bupperSizer</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="spacer" expanded="1">
|
||||
<property name="height">10</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">10</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">sbSizerMiddle</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxRadioBox" expanded="1">
|
||||
<property name="bg"></property>
|
||||
<property name="choices">"B/W" "Color"</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Plot Mode:</property>
|
||||
<property name="majorDimension">1</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_PlotColorCtrl</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pos"></property>
|
||||
<property name="selection">0</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxRA_SPECIFY_COLS</property>
|
||||
<property name="subclass"></property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRadioBox"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="1">
|
||||
<property name="bg"></property>
|
||||
<property name="checked">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Print page references</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_Plot_Sheet_Ref_Ctrl</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnCheckBox"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="spacer" expanded="1">
|
||||
<property name="height">10</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">10</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bbuttonsSizer</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxButton" expanded="1">
|
||||
<property name="bg"></property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">&Plot Page</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_buttonPlotPage</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">OnPlotCurrent</event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxButton" expanded="1">
|
||||
<property name="bg"></property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Plot A&LL</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_buttonPlotAll</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">OnPlotAll</event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxButton" expanded="1">
|
||||
<property name="bg"></property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_CANCEL</property>
|
||||
<property name="label">Close</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_buttonClose</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">OnCancelClick</event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="bg"></property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Messages :</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_staticText1</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxTextCtrl" expanded="1">
|
||||
<property name="bg"></property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="maxlength">0</property>
|
||||
<property name="minimum_size">-1,150</property>
|
||||
<property name="name">m_MsgBox</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxTE_MULTILINE|wxTE_READONLY</property>
|
||||
<property name="subclass"></property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="value"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnText"></event>
|
||||
<event name="OnTextEnter"></event>
|
||||
<event name="OnTextMaxLen"></event>
|
||||
<event name="OnTextURL"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</wxFormBuilder_Project>
|
|
@ -1,60 +0,0 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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__
|
|
@ -1,420 +0,0 @@
|
|||
/** @file dialog_plot_schematic_HPGL.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 <plot_common.h>
|
||||
#include <worksheet.h>
|
||||
#include <class_sch_screen.h>
|
||||
#include <wxEeschemaStruct.h>
|
||||
#include <base_units.h>
|
||||
|
||||
#include <general.h>
|
||||
#include <protos.h>
|
||||
#include <sch_sheet_path.h>
|
||||
|
||||
#include <dialog_plot_schematic_HPGL_base.h>
|
||||
|
||||
|
||||
enum HPGL_PAGEZ_T
|
||||
{
|
||||
PAGE_DEFAULT = 0,
|
||||
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,
|
||||
};
|
||||
|
||||
|
||||
static const wxChar* plot_sheet_list( HPGL_PAGEZ_T aSize )
|
||||
{
|
||||
const wxChar* ret;
|
||||
|
||||
switch( aSize )
|
||||
{
|
||||
default:
|
||||
case PAGE_DEFAULT: ret = NULL; break;
|
||||
case PAGE_SIZE_A4: ret = wxT( "A4" ); break;
|
||||
case PAGE_SIZE_A3: ret = wxT( "A3" ); break;
|
||||
case PAGE_SIZE_A2: ret = wxT( "A2" ); break;
|
||||
case PAGE_SIZE_A1: ret = wxT( "A1" ); break;
|
||||
case PAGE_SIZE_A0: ret = wxT( "A0" ); break;
|
||||
case PAGE_SIZE_A: ret = wxT( "A" ); break;
|
||||
case PAGE_SIZE_B: ret = wxT( "B" ); break;
|
||||
case PAGE_SIZE_C: ret = wxT( "C" ); break;
|
||||
case PAGE_SIZE_D: ret = wxT( "D" ); break;
|
||||
case PAGE_SIZE_E: ret = wxT( "E" ); break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
|
||||
class DIALOG_PLOT_SCHEMATIC_HPGL : public DIALOG_PLOT_SCHEMATIC_HPGL_BASE
|
||||
{
|
||||
private:
|
||||
SCH_EDIT_FRAME* m_Parent;
|
||||
|
||||
public:
|
||||
DIALOG_PLOT_SCHEMATIC_HPGL( SCH_EDIT_FRAME* parent );
|
||||
|
||||
private:
|
||||
static HPGL_PAGEZ_T s_pageSizeSelect;
|
||||
static bool s_plot_Sheet_Ref;
|
||||
static wxSize s_Offset;
|
||||
|
||||
bool m_select_PlotAll;
|
||||
|
||||
private:
|
||||
void OnPageSelected( wxCommandEvent& event );
|
||||
void OnPlotCurrent( wxCommandEvent& event );
|
||||
void OnPlotAll( wxCommandEvent& event );
|
||||
void OnCancelClick( wxCommandEvent& event );
|
||||
void AcceptPlotOffset( wxCommandEvent& event );
|
||||
|
||||
void initDlg();
|
||||
void SetPenSpeed();
|
||||
void SetPenNum();
|
||||
void SetPenWidth();
|
||||
void SetPageOffsetValue();
|
||||
void HPGL_Plot( bool aPlotAll );
|
||||
void Plot_Schematic_HPGL( bool aPlotAll );
|
||||
|
||||
void Plot_1_Page_HPGL( const wxString& FileName,
|
||||
SCH_SCREEN* screen, const PAGE_INFO& aPageInfo,
|
||||
wxPoint& offset, double plot_scale );
|
||||
};
|
||||
|
||||
|
||||
// static members (static to remember last state):
|
||||
HPGL_PAGEZ_T DIALOG_PLOT_SCHEMATIC_HPGL:: s_pageSizeSelect = PAGE_DEFAULT;
|
||||
bool DIALOG_PLOT_SCHEMATIC_HPGL::s_plot_Sheet_Ref = true;
|
||||
wxSize DIALOG_PLOT_SCHEMATIC_HPGL::s_Offset;
|
||||
|
||||
void SCH_EDIT_FRAME::ToPlot_HPGL( wxCommandEvent& event )
|
||||
{
|
||||
DIALOG_PLOT_SCHEMATIC_HPGL dlg( this );
|
||||
dlg.ShowModal();
|
||||
}
|
||||
|
||||
|
||||
DIALOG_PLOT_SCHEMATIC_HPGL::DIALOG_PLOT_SCHEMATIC_HPGL( SCH_EDIT_FRAME* parent ) :
|
||||
DIALOG_PLOT_SCHEMATIC_HPGL_BASE( parent )
|
||||
{
|
||||
m_Parent = parent;
|
||||
initDlg();
|
||||
SetPageOffsetValue();
|
||||
|
||||
GetSizer()->SetSizeHints( this );
|
||||
Centre();
|
||||
m_buttonPlotAll->SetDefault();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PLOT_SCHEMATIC_HPGL::initDlg()
|
||||
{
|
||||
SetFocus(); // Make ESC key work
|
||||
|
||||
// Set validators
|
||||
m_SizeOption->SetSelection( s_pageSizeSelect );
|
||||
AddUnitSymbol( *m_penWidthTitle, g_UserUnit );
|
||||
PutValueInLocalUnits( *m_penWidthCtrl, g_HPGL_Pen_Descr. m_Pen_Diam );
|
||||
m_penSpeedCtrl->SetValue( g_HPGL_Pen_Descr. m_Pen_Speed );
|
||||
m_penNumCtrl->SetValue( g_HPGL_Pen_Descr. m_Pen_Num );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PLOT_SCHEMATIC_HPGL::OnPlotCurrent( wxCommandEvent& event )
|
||||
{
|
||||
HPGL_Plot( false );
|
||||
}
|
||||
|
||||
void DIALOG_PLOT_SCHEMATIC_HPGL::OnPlotAll( wxCommandEvent& event )
|
||||
{
|
||||
HPGL_Plot( true );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PLOT_SCHEMATIC_HPGL::OnCancelClick( wxCommandEvent& event )
|
||||
{
|
||||
EndModal( 0 );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PLOT_SCHEMATIC_HPGL::SetPageOffsetValue()
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
s_pageSizeSelect = (HPGL_PAGEZ_T) m_SizeOption->GetSelection();
|
||||
|
||||
if( s_pageSizeSelect != PAGE_DEFAULT )
|
||||
{
|
||||
msg = ReturnStringFromValue( g_UserUnit, s_Offset.x );
|
||||
|
||||
m_PlotOrgPosition_X->SetValue( msg );
|
||||
|
||||
msg = ReturnStringFromValue( g_UserUnit, s_Offset.y );
|
||||
|
||||
m_PlotOrgPosition_Y->SetValue( msg );
|
||||
|
||||
m_PlotOrgPosition_X->Enable( true );
|
||||
m_PlotOrgPosition_Y->Enable( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_PlotOrgPosition_X->Enable( false );
|
||||
m_PlotOrgPosition_Y->Enable( false );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PLOT_SCHEMATIC_HPGL::AcceptPlotOffset( wxCommandEvent& event )
|
||||
{
|
||||
s_pageSizeSelect = (HPGL_PAGEZ_T) m_SizeOption->GetSelection();
|
||||
|
||||
if( s_pageSizeSelect != PAGE_DEFAULT )
|
||||
{
|
||||
wxString msg = m_PlotOrgPosition_X->GetValue();
|
||||
|
||||
s_Offset.x = ReturnValueFromString( g_UserUnit, msg );
|
||||
|
||||
msg = m_PlotOrgPosition_Y->GetValue();
|
||||
|
||||
s_Offset.y = ReturnValueFromString( g_UserUnit, msg );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PLOT_SCHEMATIC_HPGL::SetPenWidth( )
|
||||
{
|
||||
g_HPGL_Pen_Descr.m_Pen_Diam = ReturnValueFromTextCtrl( *m_penWidthCtrl );
|
||||
|
||||
if( g_HPGL_Pen_Descr.m_Pen_Diam > 100 )
|
||||
g_HPGL_Pen_Descr.m_Pen_Diam = 100;
|
||||
|
||||
if( g_HPGL_Pen_Descr.m_Pen_Diam < 1 )
|
||||
g_HPGL_Pen_Descr.m_Pen_Diam = 1;
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PLOT_SCHEMATIC_HPGL::SetPenSpeed( )
|
||||
{
|
||||
g_HPGL_Pen_Descr.m_Pen_Speed = m_penSpeedCtrl->GetValue();
|
||||
|
||||
if( g_HPGL_Pen_Descr.m_Pen_Speed > 40 )
|
||||
g_HPGL_Pen_Descr.m_Pen_Speed = 40;
|
||||
|
||||
if( g_HPGL_Pen_Descr.m_Pen_Speed < 1 )
|
||||
g_HPGL_Pen_Descr.m_Pen_Speed = 1;
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PLOT_SCHEMATIC_HPGL::SetPenNum( )
|
||||
{
|
||||
g_HPGL_Pen_Descr.m_Pen_Num = m_penNumCtrl->GetValue();
|
||||
|
||||
if( g_HPGL_Pen_Descr.m_Pen_Num > 8 )
|
||||
g_HPGL_Pen_Descr.m_Pen_Num = 8;
|
||||
|
||||
if( g_HPGL_Pen_Descr.m_Pen_Num < 1 )
|
||||
g_HPGL_Pen_Descr.m_Pen_Num = 1;
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PLOT_SCHEMATIC_HPGL::HPGL_Plot( bool aPlotAll )
|
||||
{
|
||||
SetPenWidth( );
|
||||
SetPenNum( );
|
||||
SetPenSpeed( );
|
||||
|
||||
if( s_pageSizeSelect != PAGE_DEFAULT )
|
||||
{
|
||||
wxString msg = m_PlotOrgPosition_X->GetValue();
|
||||
|
||||
s_Offset.x = ReturnValueFromString( g_UserUnit, msg );
|
||||
|
||||
msg = m_PlotOrgPosition_Y->GetValue();
|
||||
|
||||
s_Offset.y = ReturnValueFromString( g_UserUnit, msg );
|
||||
}
|
||||
|
||||
Plot_Schematic_HPGL( aPlotAll );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll )
|
||||
{
|
||||
wxString plotFileName;
|
||||
SCH_SCREEN* screen = m_Parent->GetScreen();
|
||||
SCH_SHEET_PATH* sheetpath;
|
||||
SCH_SHEET_PATH oldsheetpath = m_Parent->GetCurrentSheet();
|
||||
|
||||
wxPoint plotOffset;
|
||||
|
||||
/* When printing all pages, the printed page is not the current page.
|
||||
* In complex hierarchies, we must setup references and other 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( aPlotAll )
|
||||
{
|
||||
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();
|
||||
|
||||
if( !screen ) // LastScreen() may return NULL
|
||||
screen = m_Parent->GetScreen();
|
||||
}
|
||||
else // Should not happen
|
||||
return;
|
||||
|
||||
sheetpath = SheetList.GetNext();
|
||||
}
|
||||
|
||||
const PAGE_INFO& curPage = screen->GetPageSettings();
|
||||
|
||||
PAGE_INFO plotPage = curPage;
|
||||
|
||||
// if plotting on a page size other than curPage
|
||||
if( s_pageSizeSelect != PAGE_DEFAULT )
|
||||
plotPage.SetType( plot_sheet_list( s_pageSizeSelect ) );
|
||||
|
||||
// Calculation of conversion scales.
|
||||
|
||||
// 10x because Eeschema works in mils, not deci-mils
|
||||
double plot_scale = (double) plotPage.GetWidthMils() / curPage.GetWidthMils();
|
||||
|
||||
// Calculate offsets
|
||||
plotOffset.x = -s_Offset.x;
|
||||
plotOffset.y = -s_Offset.y;
|
||||
|
||||
plotFileName = m_Parent->GetUniqueFilenameForCurrentSheet() + wxT(".")
|
||||
+ HPGL_PLOTTER::GetDefaultFileExtension();
|
||||
|
||||
LOCALE_IO toggle;
|
||||
|
||||
Plot_1_Page_HPGL( plotFileName, screen, plotPage, plotOffset, plot_scale );
|
||||
|
||||
if( !aPlotAll )
|
||||
break;
|
||||
}
|
||||
|
||||
m_Parent->SetCurrentSheet( oldsheetpath );
|
||||
m_Parent->GetCurrentSheet().UpdateAllScreenReferences();
|
||||
m_Parent->SetSheetNumberAndCount();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName,
|
||||
SCH_SCREEN* screen,
|
||||
const PAGE_INFO& pageInfo,
|
||||
wxPoint& offset,
|
||||
double plot_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;
|
||||
}
|
||||
|
||||
LOCALE_IO toggle;
|
||||
|
||||
msg.Printf( _( "Plot: %s " ), FileName.GetData() );
|
||||
m_MsgBox->AppendText( msg );
|
||||
|
||||
HPGL_PLOTTER* plotter = new HPGL_PLOTTER();
|
||||
|
||||
plotter->SetPageSettings( pageInfo );
|
||||
plotter->SetViewport( offset, IU_PER_DECIMILS, plot_scale, false );
|
||||
|
||||
// Init :
|
||||
plotter->SetCreator( wxT( "Eeschema-HPGL" ) );
|
||||
plotter->SetFilename( FileName );
|
||||
plotter->SetPenSpeed( g_HPGL_Pen_Descr.m_Pen_Speed );
|
||||
plotter->SetPenNumber( g_HPGL_Pen_Descr.m_Pen_Num );
|
||||
plotter->SetPenDiameter( g_HPGL_Pen_Descr.m_Pen_Diam );
|
||||
plotter->SetPenOverlap( g_HPGL_Pen_Descr.m_Pen_Diam / 2 );
|
||||
plotter->StartPlot( output_file );
|
||||
|
||||
plotter->SetColor( BLACK );
|
||||
|
||||
if( s_plot_Sheet_Ref )
|
||||
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;
|
||||
|
||||
m_MsgBox->AppendText( wxT( "Ok\n" ) );
|
||||
}
|
||||
|
||||
|
||||
/* Event handler for page size option
|
||||
*/
|
||||
void DIALOG_PLOT_SCHEMATIC_HPGL::OnPageSelected( wxCommandEvent& event )
|
||||
{
|
||||
s_pageSizeSelect = (HPGL_PAGEZ_T) m_SizeOption->GetSelection();
|
||||
SetPageOffsetValue();
|
||||
}
|
||||
|
||||
|
|
@ -1,143 +0,0 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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 );
|
||||
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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__
|
|
@ -1,311 +0,0 @@
|
|||
/** @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 );
|
||||
}
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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 );
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,63 +0,0 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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__
|
|
@ -1,311 +0,0 @@
|
|||
/** @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" ) );
|
||||
}
|
|
@ -1,104 +0,0 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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 );
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,63 +0,0 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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__
|
|
@ -0,0 +1,152 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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 );
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,36 +1,38 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// 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)
|
||||
|
|
|
@ -141,39 +141,10 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
|||
|
||||
// Plot submenu
|
||||
wxMenu* choice_plot_fmt = new wxMenu;
|
||||
|
||||
// Plot PostScript
|
||||
AddMenuItem( choice_plot_fmt, ID_GEN_PLOT_PS,
|
||||
_( "Plot &PostScript" ),
|
||||
_( "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 ) );
|
||||
AddMenuItem( choice_plot_fmt, ID_GEN_PLOT_SCHEMATIC,
|
||||
_( "&Plot" ),
|
||||
_( "Plot schematic sheet in PostScript, PDF, SVG, DXF or HPGL format" ),
|
||||
KiBitmap( plot_xpm ) );
|
||||
|
||||
// Plot to Clipboard (Windows only)
|
||||
#ifdef __WINDOWS__
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -589,14 +589,10 @@ public:
|
|||
void SetPrintMonochrome( bool aMonochrome ) { m_printMonochrome = aMonochrome; }
|
||||
bool GetPrintSheetReference() { return m_printSheetReference; }
|
||||
void SetPrintSheetReference( bool aShow ) { m_printSheetReference = aShow; }
|
||||
void SVG_Print( wxCommandEvent& event );
|
||||
|
||||
// Plot functions:
|
||||
void ToPlot_PS( wxCommandEvent& event );
|
||||
void ToPlot_PDF( wxCommandEvent& event );
|
||||
void ToPlot_HPGL( wxCommandEvent& event );
|
||||
void ToPlot_DXF( wxCommandEvent& event );
|
||||
void ToPostProcess( wxCommandEvent& event );
|
||||
// void ToPostProcess( wxCommandEvent& event );
|
||||
void PlotSchematic( wxCommandEvent& event );
|
||||
|
||||
// read and save files
|
||||
void Save_File( wxCommandEvent& event );
|
||||
|
|
Loading…
Reference in New Issue