Commit 2fe9a99b authored by Lorenzo Marcantonio's avatar Lorenzo Marcantonio Committed by jean-pierre charras

Commit patch from Lorenzo Marcantonio about plot functions enhancement.

Fix some warning compil issues.
Add zlib sources to avoid build issues under Windows (zlib not installed with mingw).
parents ebcb6d3b 684d98ec
......@@ -257,6 +257,7 @@ set(INC_AFTER
add_subdirectory(bitmaps_png)
add_subdirectory(common)
add_subdirectory(zlib)
add_subdirectory(3d-viewer)
add_subdirectory(cvpcb)
add_subdirectory(eeschema)
......
......@@ -7,6 +7,7 @@ include_directories(
../3d-viewer
../pcbnew
../polygon
../zlib
${INC_AFTER}
)
......@@ -42,6 +43,7 @@ set(COMMON_SRCS
common_plot_functions.cpp
common_plotHPGL_functions.cpp
common_plotPS_functions.cpp
common_plotPDF_functions.cpp
common_plotGERBER_functions.cpp
common_plotDXF_functions.cpp
confirm.cpp
......
......@@ -251,18 +251,18 @@ void BITMAP_BASE::Rotate( bool aRotateCCW )
}
void BITMAP_BASE::PlotImage( PLOTTER* aPlotter,
wxPoint aPos,
int aDefaultColor,
int aDefaultPensize )
void BITMAP_BASE::PlotImage( PLOTTER* aPlotter,
const wxPoint& aPos,
EDA_COLOR_T aDefaultColor,
int aDefaultPensize )
{
if( m_image == NULL )
return;
// These 2 lines are useful only fot plotters that cannot plot a bitmap
// and plot arectangle instead of.
aPlotter->set_color( aDefaultColor );
aPlotter->set_current_line_width( aDefaultPensize );
aPlotter->SetColor( aDefaultColor );
aPlotter->SetCurrentLineWidth( aDefaultPensize );
aPlotter->PlotImage( *m_image, aPos, GetScalingFactor() );
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -164,13 +164,13 @@ static void DrawGraphicTextPline(
{
if( aPlotter )
{
aPlotter->move_to( coord[0] );
aPlotter->MoveTo( coord[0] );
for( int ik = 1; ik < point_count; ik++ )
{
aPlotter->line_to( coord[ik] );
aPlotter->LineTo( coord[ik] );
}
aPlotter->pen_finish();
aPlotter->PenFinish();
}
else if( aCallback )
{
......@@ -357,8 +357,8 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
if( aPlotter )
{
aPlotter->move_to( current_char_pos );
aPlotter->finish_to( end );
aPlotter->MoveTo( current_char_pos );
aPlotter->FinishTo( end );
}
else if( aCallback )
{
......@@ -515,7 +515,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
* @param aItalic = true to simulate an italic font
* @param aBold = true to use a bold font Useful only with default width value (aWidth = 0)
*/
void PLOTTER::text( const wxPoint& aPos,
void PLOTTER::Text( const wxPoint& aPos,
enum EDA_COLOR_T aColor,
const wxString& aText,
int aOrient,
......@@ -534,11 +534,11 @@ void PLOTTER::text( const wxPoint& aPos,
else
aWidth = -Clamp_Text_PenSize( -aWidth, aSize, aBold );
set_current_line_width( aWidth );
SetCurrentLineWidth( aWidth );
if( aColor >= 0 )
set_color( aColor );
SetColor( aColor );
DrawGraphicText( NULL, NULL, aPos, aColor, aText,
aOrient, aSize,
......
......@@ -36,6 +36,8 @@ set(EESCHEMA_SRCS
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
......@@ -218,6 +220,7 @@ target_link_libraries(eeschema
kbool
${wxWidgets_LIBRARIES}
${GDI_PLUS_LIBRARIES}
zlib
)
install(TARGETS eeschema
......
......@@ -391,8 +391,8 @@ void LIB_COMPONENT::Plot( PLOTTER* aPlotter, int aUnit, int aConvert,
if( aConvert && item.m_Convert && ( item.m_Convert != aConvert ) )
continue;
aPlotter->set_color( ReturnLayerColor( LAYER_DEVICE ) );
bool fill = aPlotter->get_color_mode();
aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE ) );
bool fill = aPlotter->GetColorMode();
item.Plot( aPlotter, aOffset, fill, aTransform );
}
......
......@@ -185,14 +185,12 @@ void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( )
sheetpath = SheetList.GetNext();
}
double scale = 10;
plot_offset.x = 0;
plot_offset.y = 0;
plotFileName = schframe->GetUniqueFilenameForCurrentSheet() + wxT( ".dxf" );
PlotOneSheetDXF( plotFileName, screen, plot_offset, scale );
PlotOneSheetDXF( plotFileName, screen, plot_offset, 1 );
if( !m_select_PlotAll )
break;
......@@ -232,24 +230,24 @@ void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName,
const PAGE_INFO& pageInfo = screen->GetPageSettings();
plotter->SetPageSettings( pageInfo );
plotter->set_viewport( plot_offset, scale, 0 );
plotter->set_color_mode( m_plotColorOpt );
plotter->SetViewport( plot_offset, IU_PER_DECIMILS, scale, 0 );
plotter->SetColorMode( m_plotColorOpt );
// Init :
plotter->set_creator( wxT( "Eeschema-DXF" ) );
plotter->set_filename( FileName );
plotter->start_plot( output_file );
plotter->SetCreator( wxT( "Eeschema-DXF" ) );
plotter->SetFilename( FileName );
plotter->StartPlot( output_file );
if( m_plot_Sheet_Ref )
{
plotter->set_color( BLACK );
plotter->SetColor( BLACK );
m_Parent->PlotWorkSheet( plotter, screen );
}
screen->Plot( plotter );
// finish
plotter->end_plot();
plotter->EndPlot();
delete plotter;
m_MsgBox->AppendText( wxT( "Ok\n" ) );
......
......@@ -330,7 +330,7 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll )
// Calculation of conversion scales.
// 10x because Eeschema works in mils, not deci-mils
double plot_scale = 10 * (double) plotPage.GetWidthMils() / curPage.GetWidthMils();
double plot_scale = (double) plotPage.GetWidthMils() / curPage.GetWidthMils();
// Calculate offsets
plotOffset.x = -s_Offset.x;
......@@ -380,26 +380,26 @@ void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName,
plotter->SetPageSettings( pageInfo );
plotter->set_viewport( offset, plot_scale, 0 );
plotter->set_default_line_width( g_DrawDefaultLineThickness );
plotter->SetViewport( offset, IU_PER_DECIMILS, plot_scale, 0 );
plotter->SetDefaultLineWidth( g_DrawDefaultLineThickness );
// Init :
plotter->set_creator( wxT( "Eeschema-HPGL" ) );
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->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->set_color( BLACK );
plotter->SetColor( BLACK );
if( s_plot_Sheet_Ref )
m_Parent->PlotWorkSheet( plotter, screen );
screen->Plot( plotter );
plotter->end_plot();
plotter->EndPlot();
delete plotter;
m_MsgBox->AppendText( wxT( "Ok\n" ) );
......
/** @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" ) );
plotter->SetPsTextMode( PSTEXTMODE_PHANTOM );
// 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" );
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->SetViewport( wxPoint( 0, 0 ), IU_PER_DECIMILS, scale, 0 );
plotter->SetPageSettings( plotPage );
}
void DIALOG_PLOT_SCHEMATIC_PDF::plotOneSheet( PDF_PLOTTER* plotter,
SCH_SCREEN* screen )
{
if( m_plot_Sheet_Ref )
{
plotter->SetColor( BLACK );
m_Parent->PlotWorkSheet( plotter, screen );
}
screen->Plot( plotter );
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 17 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_plot_schematic_PDF_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_PLOT_SCHEMATIC_PDF_BASE::DIALOG_PLOT_SCHEMATIC_PDF_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bmainSizer;
bmainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bupperSizer;
bupperSizer = new wxBoxSizer( wxHORIZONTAL );
wxString m_SizeOptionChoices[] = { _("Schematic size"), _("Force size A4"), _("Force size A") };
int m_SizeOptionNChoices = sizeof( m_SizeOptionChoices ) / sizeof( wxString );
m_SizeOption = new wxRadioBox( this, wxID_ANY, _("Plot Page Size:"), wxDefaultPosition, wxDefaultSize, m_SizeOptionNChoices, m_SizeOptionChoices, 1, wxRA_SPECIFY_COLS );
m_SizeOption->SetSelection( 0 );
bupperSizer->Add( m_SizeOption, 1, wxALL, 5 );
bupperSizer->Add( 10, 10, 0, wxEXPAND, 5 );
wxBoxSizer* sbSizerMiddle;
sbSizerMiddle = new wxBoxSizer( wxVERTICAL );
wxString m_PlotPDFColorOptionChoices[] = { _("B/W"), _("Color") };
int m_PlotPDFColorOptionNChoices = sizeof( m_PlotPDFColorOptionChoices ) / sizeof( wxString );
m_PlotPDFColorOption = new wxRadioBox( this, wxID_ANY, _("Plot Mode:"), wxDefaultPosition, wxDefaultSize, m_PlotPDFColorOptionNChoices, m_PlotPDFColorOptionChoices, 1, wxRA_SPECIFY_COLS );
m_PlotPDFColorOption->SetSelection( 0 );
sbSizerMiddle->Add( m_PlotPDFColorOption, 0, wxALL|wxEXPAND, 5 );
m_Plot_Sheet_Ref_Ctrl = new wxCheckBox( this, wxID_ANY, _("Print page references"), wxDefaultPosition, wxDefaultSize, 0 );
m_Plot_Sheet_Ref_Ctrl->SetValue(true);
sbSizerMiddle->Add( m_Plot_Sheet_Ref_Ctrl, 0, wxALL|wxEXPAND, 5 );
bupperSizer->Add( sbSizerMiddle, 1, wxEXPAND, 5 );
bupperSizer->Add( 10, 10, 0, wxEXPAND, 5 );
wxBoxSizer* bbuttonsSizer;
bbuttonsSizer = new wxBoxSizer( wxVERTICAL );
m_buttonPlotPage = new wxButton( this, wxID_ANY, _("&Plot Page"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonPlotPage, 0, wxALL|wxEXPAND, 5 );
m_buttonPlotAll = new wxButton( this, wxID_ANY, _("Plot A&LL"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonPlotAll, 0, wxALL|wxEXPAND, 5 );
m_buttonClose = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonClose, 0, wxALL|wxEXPAND, 5 );
bupperSizer->Add( bbuttonsSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
bmainSizer->Add( bupperSizer, 0, wxEXPAND, 5 );
wxBoxSizer* bSizerLineWidth;
bSizerLineWidth = new wxBoxSizer( wxHORIZONTAL );
m_defaultLineWidthTitle = new wxStaticText( this, wxID_ANY, _("Default line width:"), wxDefaultPosition, wxDefaultSize, 0 );
m_defaultLineWidthTitle->Wrap( -1 );
bSizerLineWidth->Add( m_defaultLineWidthTitle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_DefaultLineSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizerLineWidth->Add( m_DefaultLineSizeCtrl, 1, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 );
bmainSizer->Add( bSizerLineWidth, 0, wxEXPAND, 5 );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Messages :"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
bmainSizer->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_MsgBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY );
m_MsgBox->SetMinSize( wxSize( -1,150 ) );
bmainSizer->Add( m_MsgBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
this->SetSizer( bmainSizer );
this->Layout();
this->Centre( wxBOTH );
// Connect Events
m_buttonPlotPage->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PDF_BASE::OnPlotCurrent ), NULL, this );
m_buttonPlotAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PDF_BASE::OnPlotAll ), NULL, this );
m_buttonClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PDF_BASE::OnCancelClick ), NULL, this );
}
DIALOG_PLOT_SCHEMATIC_PDF_BASE::~DIALOG_PLOT_SCHEMATIC_PDF_BASE()
{
// Disconnect Events
m_buttonPlotPage->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PDF_BASE::OnPlotCurrent ), NULL, this );
m_buttonPlotAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PDF_BASE::OnPlotAll ), NULL, this );
m_buttonClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PDF_BASE::OnCancelClick ), NULL, this );
}
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 17 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_plot_schematic_PDF_base__
#define __dialog_plot_schematic_PDF_base__
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/radiobox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/checkbox.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_PLOT_SCHEMATIC_PDF_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_PLOT_SCHEMATIC_PDF_BASE : public wxDialog
{
private:
protected:
wxRadioBox* m_SizeOption;
wxRadioBox* m_PlotPDFColorOption;
wxCheckBox* m_Plot_Sheet_Ref_Ctrl;
wxButton* m_buttonPlotPage;
wxButton* m_buttonPlotAll;
wxButton* m_buttonClose;
wxStaticText* m_defaultLineWidthTitle;
wxTextCtrl* m_DefaultLineSizeCtrl;
wxStaticText* m_staticText1;
wxTextCtrl* m_MsgBox;
// Virtual event handlers, overide them in your derived class
virtual void OnPlotCurrent( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPlotAll( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_PLOT_SCHEMATIC_PDF_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plot PDF"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 387,365 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PLOT_SCHEMATIC_PDF_BASE();
};
#endif //__dialog_plot_schematic_PDF_base__
......@@ -237,7 +237,7 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils();
double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils();
double scale = 10 * MIN( scalex, scaley );
double scale = MIN( scalex, scaley );
plot_offset.x = 0;
plot_offset.y = 0;
......@@ -281,24 +281,25 @@ void DIALOG_PLOT_SCHEMATIC_PS::plotOneSheetPS( const wxString& FileName,
PS_PLOTTER* plotter = new PS_PLOTTER();
plotter->SetPageSettings( pageInfo );
plotter->set_viewport( plot_offset, scale, 0 );
plotter->set_default_line_width( g_DrawDefaultLineThickness );
plotter->set_color_mode( m_plotColorOpt );
plotter->SetViewport( plot_offset, IU_PER_DECIMILS, scale, 0 );
plotter->SetDefaultLineWidth( g_DrawDefaultLineThickness );
plotter->SetColorMode( m_plotColorOpt );
plotter->SetPsTextMode( PSTEXTMODE_STROKE );
// Init :
plotter->set_creator( wxT( "Eeschema-PS" ) );
plotter->set_filename( FileName );
plotter->start_plot( output_file );
plotter->SetCreator( wxT( "Eeschema-PS" ) );
plotter->SetFilename( FileName );
plotter->StartPlot( output_file );
if( m_plot_Sheet_Ref )
{
plotter->set_color( BLACK );
plotter->SetColor( BLACK );
m_Parent->PlotWorkSheet( plotter, screen );
}
screen->Plot( plotter );
plotter->end_plot();
plotter->EndPlot();
delete plotter;
SetLocaleTo_Default();
......
This diff is collapsed.
......@@ -270,12 +270,12 @@ void LIB_BEZIER::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR )
{
aPlotter->set_color( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->PlotPoly( cornerList, FILLED_WITH_BG_BODYCOLOR, 0 );
}
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR;
aPlotter->set_color( ReturnLayerColor( LAYER_DEVICE ) );
aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE ) );
aPlotter->PlotPoly( cornerList, already_filled ? NO_FILL : m_Fill, GetPenSize() );
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -241,13 +241,13 @@ void LIB_POLYLINE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR )
{
aPlotter->set_color( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->PlotPoly( cornerList, FILLED_WITH_BG_BODYCOLOR, 0 );
aFill = false; // body is now filled, do not fill it later.
}
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR;
aPlotter->set_color( ReturnLayerColor( LAYER_DEVICE ) );
aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE ) );
aPlotter->PlotPoly( cornerList, already_filled ? NO_FILL : m_Fill, GetPenSize() );
}
......
......@@ -178,13 +178,13 @@ void LIB_RECTANGLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR )
{
aPlotter->set_color( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->rect( pos, end, FILLED_WITH_BG_BODYCOLOR, 0 );
aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
aPlotter->Rect( pos, end, FILLED_WITH_BG_BODYCOLOR, 0 );
}
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR;
aPlotter->set_color( ReturnLayerColor( LAYER_DEVICE ) );
aPlotter->rect( pos, end, already_filled ? NO_FILL : m_Fill, GetPenSize() );
aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE ) );
aPlotter->Rect( pos, end, already_filled ? NO_FILL : m_Fill, GetPenSize() );
}
......
......@@ -318,7 +318,7 @@ void LIB_TEXT::Plot( PLOTTER* plotter, const wxPoint& offset, bool fill,
int t1 = ( aTransform.x1 != 0 ) ^ ( m_Orient != 0 );
wxPoint pos = aTransform.TransformCoordinate( m_Pos ) + offset;
plotter->text( pos, UNSPECIFIED, m_Text,
plotter->Text( pos, UNSPECIFIED, m_Text,
t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT,
m_Size, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
GetPenSize(), m_Italic, m_Bold );
......
......@@ -147,6 +147,12 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
_( "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_ps_xpm ) );
// Plot HPGL
AddMenuItem( choice_plot_fmt,
ID_GEN_PLOT_HPGL,
......
......@@ -281,10 +281,10 @@ bool SCH_BUS_ENTRY::HitTest( const EDA_RECT& aRect, bool aContained, int aAccura
void SCH_BUS_ENTRY::Plot( PLOTTER* aPlotter )
{
aPlotter->set_current_line_width( GetPenSize() );
aPlotter->set_color( ReturnLayerColor( GetLayer() ) );
aPlotter->move_to( m_pos );
aPlotter->finish_to( m_End() );
aPlotter->SetCurrentLineWidth( GetPenSize() );
aPlotter->SetColor( ReturnLayerColor( GetLayer() ) );
aPlotter->MoveTo( m_pos );
aPlotter->FinishTo( m_End() );
}
/* SetBusEntryShape:
......
......@@ -579,7 +579,7 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter )
if( (parent->GetPartCount() <= 1) || (m_id != REFERENCE) )
{
aPlotter->text( textpos, color, m_Text, orient, m_Size, hjustify, vjustify,
aPlotter->Text( textpos, color, m_Text, orient, m_Size, hjustify, vjustify,
thickness, m_Italic, m_Bold );
}
else /* We plot the reference, for a multiple parts per package */
......@@ -587,7 +587,7 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter )
/* Adding A, B ... to the reference */
wxString Text = m_Text + LIB_COMPONENT::ReturnSubReference( parent->GetUnit() );
aPlotter->text( textpos, color, Text, orient, m_Size, hjustify, vjustify,
aPlotter->Text( textpos, color, Text, orient, m_Size, hjustify, vjustify,
thickness, m_Italic, m_Bold );
}
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment