2010-10-26 08:22:38 +00:00
|
|
|
/** @file dialog_plot_schematic_HPGL.cpp
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2011-09-30 18:15:37 +00:00
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
2010-10-26 08:22:38 +00:00
|
|
|
*
|
2010-10-26 09:24:31 +00:00
|
|
|
* Copyright (C) 1992-2010 Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr
|
2011-09-30 18:15:37 +00:00
|
|
|
* Copyright (C) 1992-2010 KiCad Developers, see change_log.txt for contributors.
|
2010-10-26 08:22:38 +00:00
|
|
|
*
|
|
|
|
* 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"
|
2010-11-10 15:30:12 +00:00
|
|
|
#include "class_sch_screen.h"
|
|
|
|
#include "wxEeschemaStruct.h"
|
2010-10-26 08:22:38 +00:00
|
|
|
|
|
|
|
#include "general.h"
|
|
|
|
#include "protos.h"
|
2010-11-11 21:10:27 +00:00
|
|
|
#include "sch_sheet_path.h"
|
2010-11-10 15:30:12 +00:00
|
|
|
|
2010-10-26 08:22:38 +00:00
|
|
|
#include "dialog_plot_schematic_HPGL_base.h"
|
|
|
|
|
2012-01-04 06:18:38 +00:00
|
|
|
|
|
|
|
enum HPGL_PAGEZ_T
|
2010-10-26 08:22:38 +00:00
|
|
|
{
|
|
|
|
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,
|
2012-01-04 06:18:38 +00:00
|
|
|
PAGE_SIZE_E,
|
2010-10-26 08:22:38 +00:00
|
|
|
};
|
|
|
|
|
2012-01-04 06:18:38 +00:00
|
|
|
|
|
|
|
static const wxChar* plot_sheet_list( HPGL_PAGEZ_T aSize )
|
2010-10-26 08:22:38 +00:00
|
|
|
{
|
2012-01-04 06:18:38 +00:00
|
|
|
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;
|
2010-10-26 08:22:38 +00:00
|
|
|
};
|
|
|
|
|
2012-01-04 06:18:38 +00:00
|
|
|
|
2010-10-26 08:22:38 +00:00
|
|
|
class DIALOG_PLOT_SCHEMATIC_HPGL : public DIALOG_PLOT_SCHEMATIC_HPGL_BASE
|
|
|
|
{
|
|
|
|
private:
|
2010-12-08 20:12:46 +00:00
|
|
|
SCH_EDIT_FRAME* m_Parent;
|
2010-10-26 08:22:38 +00:00
|
|
|
|
|
|
|
public:
|
2012-01-04 06:18:38 +00:00
|
|
|
DIALOG_PLOT_SCHEMATIC_HPGL( SCH_EDIT_FRAME* parent );
|
2010-10-26 08:22:38 +00:00
|
|
|
|
|
|
|
private:
|
2012-01-04 06:18:38 +00:00
|
|
|
static HPGL_PAGEZ_T s_pageSizeSelect;
|
|
|
|
static bool s_plot_Sheet_Ref;
|
|
|
|
static wxSize s_Offset;
|
|
|
|
|
2010-10-26 08:22:38 +00:00
|
|
|
bool m_select_PlotAll;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void OnPageSelected( wxCommandEvent& event );
|
|
|
|
void OnPlotCurrent( wxCommandEvent& event );
|
|
|
|
void OnPlotAll( wxCommandEvent& event );
|
|
|
|
void OnCancelClick( wxCommandEvent& event );
|
2012-01-05 08:07:11 +00:00
|
|
|
void AcceptPlotOffset( wxCommandEvent& event );
|
2010-10-26 08:22:38 +00:00
|
|
|
|
|
|
|
void initDlg();
|
|
|
|
void SetPenSpeed();
|
|
|
|
void SetPenNum();
|
|
|
|
void SetPenWidth();
|
|
|
|
void SetPageOffsetValue();
|
|
|
|
void HPGL_Plot( bool aPlotAll );
|
2012-01-04 06:18:38 +00:00
|
|
|
void Plot_Schematic_HPGL( bool aPlotAll );
|
|
|
|
|
2010-10-26 08:22:38 +00:00
|
|
|
void Plot_1_Page_HPGL( const wxString& FileName,
|
2012-01-04 06:18:38 +00:00
|
|
|
SCH_SCREEN* screen, const PAGE_INFO& aPageInfo,
|
2010-10-26 08:22:38 +00:00
|
|
|
wxPoint& offset, double plot_scale );
|
|
|
|
};
|
2012-01-04 06:18:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
// 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;
|
2012-01-05 08:07:11 +00:00
|
|
|
wxSize DIALOG_PLOT_SCHEMATIC_HPGL::s_Offset;
|
2010-10-26 08:22:38 +00:00
|
|
|
|
2010-12-08 20:12:46 +00:00
|
|
|
void SCH_EDIT_FRAME::ToPlot_HPGL( wxCommandEvent& event )
|
2010-10-26 08:22:38 +00:00
|
|
|
{
|
|
|
|
DIALOG_PLOT_SCHEMATIC_HPGL dlg( this );
|
|
|
|
dlg.ShowModal();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-01-04 06:18:38 +00:00
|
|
|
DIALOG_PLOT_SCHEMATIC_HPGL::DIALOG_PLOT_SCHEMATIC_HPGL( SCH_EDIT_FRAME* parent ) :
|
|
|
|
DIALOG_PLOT_SCHEMATIC_HPGL_BASE( parent )
|
2010-10-26 08:22:38 +00:00
|
|
|
{
|
|
|
|
m_Parent = parent;
|
|
|
|
initDlg();
|
|
|
|
SetPageOffsetValue();
|
|
|
|
|
|
|
|
GetSizer()->SetSizeHints( this );
|
|
|
|
Centre();
|
2011-03-14 15:17:18 +00:00
|
|
|
m_buttonPlotAll->SetDefault();
|
2010-10-26 08:22:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_PLOT_SCHEMATIC_HPGL::initDlg()
|
|
|
|
{
|
2012-01-04 06:18:38 +00:00
|
|
|
SetFocus(); // Make ESC key work
|
2010-10-26 08:22:38 +00:00
|
|
|
|
|
|
|
// Set validators
|
2012-01-04 06:18:38 +00:00
|
|
|
m_SizeOption->SetSelection( s_pageSizeSelect );
|
2010-10-26 08:22:38 +00:00
|
|
|
AddUnitSymbol( *m_penWidthTitle, g_UserUnit );
|
|
|
|
PutValueInLocalUnits( *m_penWidthCtrl, g_HPGL_Pen_Descr. m_Pen_Diam, EESCHEMA_INTERNAL_UNIT );
|
|
|
|
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 );
|
|
|
|
}
|
|
|
|
|
2012-01-04 06:18:38 +00:00
|
|
|
|
2010-10-26 08:22:38 +00:00
|
|
|
void DIALOG_PLOT_SCHEMATIC_HPGL::OnCancelClick( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
EndModal( 0 );
|
|
|
|
}
|
|
|
|
|
2012-01-04 06:18:38 +00:00
|
|
|
|
2010-10-26 08:22:38 +00:00
|
|
|
void DIALOG_PLOT_SCHEMATIC_HPGL::SetPageOffsetValue()
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
|
2012-01-04 06:18:38 +00:00
|
|
|
s_pageSizeSelect = (HPGL_PAGEZ_T) m_SizeOption->GetSelection();
|
|
|
|
|
|
|
|
if( s_pageSizeSelect != PAGE_DEFAULT )
|
2010-10-26 08:22:38 +00:00
|
|
|
{
|
|
|
|
msg = ReturnStringFromValue( g_UserUnit,
|
2012-01-04 06:18:38 +00:00
|
|
|
s_Offset.x,
|
2010-10-26 08:22:38 +00:00
|
|
|
EESCHEMA_INTERNAL_UNIT );
|
2012-01-04 06:18:38 +00:00
|
|
|
|
2010-10-26 08:22:38 +00:00
|
|
|
m_PlotOrgPosition_X->SetValue( msg );
|
2012-01-04 06:18:38 +00:00
|
|
|
|
2010-10-26 08:22:38 +00:00
|
|
|
msg = ReturnStringFromValue( g_UserUnit,
|
2012-01-04 06:18:38 +00:00
|
|
|
s_Offset.y,
|
2010-10-26 08:22:38 +00:00
|
|
|
EESCHEMA_INTERNAL_UNIT );
|
2012-01-04 06:18:38 +00:00
|
|
|
|
2010-10-26 08:22:38 +00:00
|
|
|
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 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-01-05 08:07:11 +00:00
|
|
|
void DIALOG_PLOT_SCHEMATIC_HPGL::AcceptPlotOffset( wxCommandEvent& event )
|
2010-10-26 08:22:38 +00:00
|
|
|
{
|
2012-01-04 06:18:38 +00:00
|
|
|
s_pageSizeSelect = (HPGL_PAGEZ_T) m_SizeOption->GetSelection();
|
2010-10-26 08:22:38 +00:00
|
|
|
|
2012-01-04 06:18:38 +00:00
|
|
|
if( s_pageSizeSelect != PAGE_DEFAULT )
|
2010-10-26 08:22:38 +00:00
|
|
|
{
|
|
|
|
wxString msg = m_PlotOrgPosition_X->GetValue();
|
2012-01-04 06:18:38 +00:00
|
|
|
|
|
|
|
s_Offset.x = ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT );
|
|
|
|
|
2010-10-26 08:22:38 +00:00
|
|
|
msg = m_PlotOrgPosition_Y->GetValue();
|
2012-01-04 06:18:38 +00:00
|
|
|
|
|
|
|
s_Offset.y = ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT );
|
2010-10-26 08:22:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_PLOT_SCHEMATIC_HPGL::SetPenWidth( )
|
|
|
|
{
|
|
|
|
g_HPGL_Pen_Descr.m_Pen_Diam = ReturnValueFromTextCtrl( *m_penWidthCtrl,
|
|
|
|
EESCHEMA_INTERNAL_UNIT);
|
|
|
|
if( g_HPGL_Pen_Descr.m_Pen_Diam > 100 )
|
|
|
|
g_HPGL_Pen_Descr.m_Pen_Diam = 100;
|
2011-01-30 22:22:38 +00:00
|
|
|
|
2010-10-26 08:22:38 +00:00
|
|
|
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();
|
2011-01-30 22:22:38 +00:00
|
|
|
|
2010-10-26 08:22:38 +00:00
|
|
|
if( g_HPGL_Pen_Descr.m_Pen_Speed > 40 )
|
|
|
|
g_HPGL_Pen_Descr.m_Pen_Speed = 40;
|
2011-01-30 22:22:38 +00:00
|
|
|
|
2010-10-26 08:22:38 +00:00
|
|
|
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();
|
2011-01-30 22:22:38 +00:00
|
|
|
|
2010-10-26 08:22:38 +00:00
|
|
|
if( g_HPGL_Pen_Descr.m_Pen_Num > 8 )
|
|
|
|
g_HPGL_Pen_Descr.m_Pen_Num = 8;
|
2011-01-30 22:22:38 +00:00
|
|
|
|
2010-10-26 08:22:38 +00:00
|
|
|
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( );
|
|
|
|
|
2012-01-04 06:18:38 +00:00
|
|
|
if( s_pageSizeSelect != PAGE_DEFAULT )
|
2010-10-26 08:22:38 +00:00
|
|
|
{
|
|
|
|
wxString msg = m_PlotOrgPosition_X->GetValue();
|
|
|
|
|
2012-01-04 06:18:38 +00:00
|
|
|
s_Offset.x = ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT );
|
2010-10-26 08:22:38 +00:00
|
|
|
|
2012-01-04 06:18:38 +00:00
|
|
|
msg = m_PlotOrgPosition_Y->GetValue();
|
2010-10-26 08:22:38 +00:00
|
|
|
|
2012-01-04 06:18:38 +00:00
|
|
|
s_Offset.y = ReturnValueFromString( g_UserUnit, msg, EESCHEMA_INTERNAL_UNIT );
|
|
|
|
}
|
2010-10-26 08:22:38 +00:00
|
|
|
|
2012-01-04 06:18:38 +00:00
|
|
|
Plot_Schematic_HPGL( aPlotAll );
|
2010-10-26 08:22:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-01-04 06:18:38 +00:00
|
|
|
void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll )
|
2010-10-26 08:22:38 +00:00
|
|
|
{
|
2012-01-04 06:18:38 +00:00
|
|
|
wxString plotFileName;
|
|
|
|
SCH_SCREEN* screen = m_Parent->GetScreen();
|
|
|
|
SCH_SHEET_PATH* sheetpath;
|
|
|
|
SCH_SHEET_PATH oldsheetpath = m_Parent->GetCurrentSheet();
|
|
|
|
|
|
|
|
wxPoint plotOffset;
|
2010-10-26 08:22:38 +00:00
|
|
|
|
|
|
|
/* When printing all pages, the printed page is not the current page.
|
2012-01-04 06:18:38 +00:00
|
|
|
* In complex hierarchies, we must setup references and other parameters
|
2010-10-26 08:22:38 +00:00
|
|
|
* 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;
|
2011-01-30 22:22:38 +00:00
|
|
|
|
2010-10-26 08:22:38 +00:00
|
|
|
list.Clear();
|
2011-01-30 22:22:38 +00:00
|
|
|
|
2010-10-26 08:22:38 +00:00
|
|
|
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
|
|
|
|
{
|
2011-12-08 21:05:43 +00:00
|
|
|
m_Parent->SetCurrentSheet( list );
|
|
|
|
m_Parent->GetCurrentSheet().UpdateAllScreenReferences();
|
2010-10-26 08:22:38 +00:00
|
|
|
m_Parent->SetSheetNumberAndCount();
|
2012-01-04 06:18:38 +00:00
|
|
|
|
2011-12-08 21:05:43 +00:00
|
|
|
screen = m_Parent->GetCurrentSheet().LastScreen();
|
2012-01-04 06:18:38 +00:00
|
|
|
|
|
|
|
if( !screen ) // LastScreen() may return NULL
|
|
|
|
screen = m_Parent->GetScreen();
|
2010-10-26 08:22:38 +00:00
|
|
|
}
|
|
|
|
else // Should not happen
|
|
|
|
return;
|
2011-01-30 22:22:38 +00:00
|
|
|
|
2010-10-26 08:22:38 +00:00
|
|
|
sheetpath = SheetList.GetNext();
|
|
|
|
}
|
2011-01-30 22:22:38 +00:00
|
|
|
|
2012-01-04 06:18:38 +00:00
|
|
|
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 ) );
|
2011-01-30 22:22:38 +00:00
|
|
|
|
2012-01-04 06:18:38 +00:00
|
|
|
// Calculation of conversion scales.
|
2011-01-30 22:22:38 +00:00
|
|
|
|
2012-01-04 06:18:38 +00:00
|
|
|
// 10x because Eeschema works in mils, not deci-mils
|
|
|
|
double plot_scale = 10 * (double) plotPage.GetWidthMils() / curPage.GetWidthMils();
|
2010-10-26 08:22:38 +00:00
|
|
|
|
2012-01-04 06:18:38 +00:00
|
|
|
// Calculate offsets
|
|
|
|
plotOffset.x = -s_Offset.x;
|
|
|
|
plotOffset.y = -s_Offset.y;
|
2010-10-26 08:22:38 +00:00
|
|
|
|
2012-01-04 06:18:38 +00:00
|
|
|
plotFileName = m_Parent->GetUniqueFilenameForCurrentSheet() + wxT( ".plt" );
|
2010-10-26 08:22:38 +00:00
|
|
|
|
2012-01-04 06:18:38 +00:00
|
|
|
LOCALE_IO toggle;
|
|
|
|
|
|
|
|
Plot_1_Page_HPGL( plotFileName, screen, plotPage, plotOffset, plot_scale );
|
2010-10-26 08:22:38 +00:00
|
|
|
|
|
|
|
if( !aPlotAll )
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-12-08 21:05:43 +00:00
|
|
|
m_Parent->SetCurrentSheet( oldsheetpath );
|
|
|
|
m_Parent->GetCurrentSheet().UpdateAllScreenReferences();
|
2010-10-26 08:22:38 +00:00
|
|
|
m_Parent->SetSheetNumberAndCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-01-04 06:18:38 +00:00
|
|
|
void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName,
|
|
|
|
SCH_SCREEN* screen,
|
|
|
|
const PAGE_INFO& pageInfo,
|
|
|
|
wxPoint& offset,
|
|
|
|
double plot_scale )
|
2010-10-26 08:22:38 +00:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2012-01-04 06:18:38 +00:00
|
|
|
LOCALE_IO toggle;
|
|
|
|
|
2010-10-26 08:22:38 +00:00
|
|
|
msg.Printf( _( "Plot: %s " ), FileName.GetData() );
|
|
|
|
m_MsgBox->AppendText( msg );
|
|
|
|
|
|
|
|
HPGL_PLOTTER* plotter = new HPGL_PLOTTER();
|
2012-01-04 06:18:38 +00:00
|
|
|
|
|
|
|
plotter->SetPageSettings( pageInfo );
|
|
|
|
|
2010-10-26 08:22:38 +00:00
|
|
|
plotter->set_viewport( offset, plot_scale, 0 );
|
|
|
|
plotter->set_default_line_width( g_DrawDefaultLineThickness );
|
2012-01-04 06:18:38 +00:00
|
|
|
|
|
|
|
// Init :
|
2011-10-16 08:02:36 +00:00
|
|
|
plotter->set_creator( wxT( "Eeschema-HPGL" ) );
|
2010-10-26 08:22:38 +00:00
|
|
|
plotter->set_filename( FileName );
|
|
|
|
plotter->set_pen_speed( g_HPGL_Pen_Descr.m_Pen_Speed );
|
|
|
|
plotter->set_pen_number( g_HPGL_Pen_Descr.m_Pen_Num );
|
|
|
|
plotter->set_pen_diameter( g_HPGL_Pen_Descr.m_Pen_Diam );
|
|
|
|
plotter->set_pen_overlap( g_HPGL_Pen_Descr.m_Pen_Diam / 2 );
|
|
|
|
plotter->start_plot( output_file );
|
|
|
|
|
|
|
|
plotter->set_color( BLACK );
|
2011-01-30 22:22:38 +00:00
|
|
|
|
2012-01-04 06:18:38 +00:00
|
|
|
if( s_plot_Sheet_Ref )
|
2010-10-26 08:22:38 +00:00
|
|
|
m_Parent->PlotWorkSheet( plotter, screen );
|
|
|
|
|
2011-06-17 13:24:22 +00:00
|
|
|
screen->Plot( plotter );
|
2010-10-26 08:22:38 +00:00
|
|
|
|
|
|
|
plotter->end_plot();
|
|
|
|
delete plotter;
|
|
|
|
|
|
|
|
m_MsgBox->AppendText( wxT( "Ok\n" ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Event handler for page size option
|
|
|
|
*/
|
|
|
|
void DIALOG_PLOT_SCHEMATIC_HPGL::OnPageSelected( wxCommandEvent& event )
|
|
|
|
{
|
2012-01-04 06:18:38 +00:00
|
|
|
s_pageSizeSelect = (HPGL_PAGEZ_T) m_SizeOption->GetSelection();
|
2010-10-26 08:22:38 +00:00
|
|
|
SetPageOffsetValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
|