Eeschema: always stores sheet filename in unix-like notation, and fix a bug when editing sheet file name.

Pcbnew: add PDF format  for drill map generation.
Plotter classes: tweaking code.
This commit is contained in:
jean-pierre charras 2012-10-13 20:54:33 +02:00
parent cedcd2bace
commit 621a43c4ad
29 changed files with 761 additions and 296 deletions

View File

@ -37,6 +37,28 @@ PLOTTER::PLOTTER( )
negativeMode = false;
}
/*
* Open or create the plot file aFullFilename
* return true if success, false if the file connot be created/opened
*
* Virtual because some plotters use ascii files, some others binary files (PDF)
* The base class open the file in text mode
*/
bool PLOTTER::OpenFile( const wxString& aFullFilename )
{
filename = aFullFilename;
wxASSERT( !outputFile );
// Open the file in text mode (not suitable for all plotters
// but only for most of them
outputFile = wxFopen( filename, wxT( "wt" ) );
if( outputFile == NULL )
return false ;
return true;
}
/**
* Modifies coordinates according to the orientation,

View File

@ -51,10 +51,9 @@ void DXF_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
/**
* Opens the DXF plot with a skeleton header
*/
bool DXF_PLOTTER::StartPlot( FILE* fout )
bool DXF_PLOTTER::StartPlot()
{
wxASSERT( !outputFile );
outputFile = fout;
wxASSERT( outputFile );
// DXF HEADER - Boilerplate
// Defines the minimum for drawing i.e. the angle system and the

View File

@ -50,12 +50,12 @@ void GERBER_PLOTTER::emitDcode( const DPOINT& pt, int dcode )
* Function start_plot
* Write GERBER header to file
* initialize global variable g_Plot_PlotOutputFile
* @param aFile: an opened file to write to
*/
bool GERBER_PLOTTER::StartPlot( FILE* aFile )
bool GERBER_PLOTTER::StartPlot()
{
wxASSERT( !outputFile );
finalFile = aFile;
wxASSERT( outputFile );
finalFile = outputFile; // the actual gerber file will be created later
// Create a temporary filename to store gerber file
// note tmpfile() does not work under Vista and W7 in user mode

View File

@ -203,10 +203,9 @@ void HPGL_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
/**
* At the start of the HPGL plot pen speed and number are requested
*/
bool HPGL_PLOTTER::StartPlot( FILE* fout )
bool HPGL_PLOTTER::StartPlot()
{
wxASSERT( !outputFile );
outputFile = fout;
wxASSERT( outputFile );
fprintf( outputFile, "IN;VS%d;PU;PA;SP%d;\n", penSpeed, penNumber );
return true;
}

View File

@ -39,6 +39,28 @@
#include <wx/zstream.h>
#include <wx/mstream.h>
/*
* Open or create the plot file aFullFilename
* return true if success, false if the file cannot be created/opened
*
* Opens the PDF file in binary mode
*/
bool PDF_PLOTTER::OpenFile( const wxString& aFullFilename )
{
filename = aFullFilename;
wxASSERT( !outputFile );
// Open the PDF file in binary mode
outputFile = wxFopen( filename, wxT( "wb" ) );
if( outputFile == NULL )
return false ;
return true;
}
void PDF_PLOTTER::SetPageSettings( const PAGE_INFO& aPageSettings )
{
wxASSERT( !workFile );
@ -555,11 +577,9 @@ void PDF_PLOTTER::ClosePage()
* 'for free' the following are to be closed and reopened. Between
* each page parameters can be set
*/
bool PDF_PLOTTER::StartPlot( FILE* fout )
bool PDF_PLOTTER::StartPlot()
{
wxASSERT( !outputFile );
outputFile = fout;
wxASSERT( outputFile );
// First things first: the customary null object
xrefTable.clear();

View File

@ -636,12 +636,11 @@ void PS_PLOTTER::PenTo( const wxPoint& pos, char plume )
* BBox is the boundary box (position and size of the "client rectangle"
* for drawings (page - margins) in mils (0.001 inch)
*/
bool PS_PLOTTER::StartPlot( FILE* fout )
bool PS_PLOTTER::StartPlot()
{
wxASSERT( !outputFile );
wxASSERT( outputFile );
wxString msg;
outputFile = fout;
static const char* PSMacro[] =
{
"%%BeginProlog\n"

View File

@ -422,12 +422,11 @@ void SVG_PLOTTER::PenTo( const wxPoint& pos, char plume )
* The code within this function
* creates SVG files header
*/
bool SVG_PLOTTER::StartPlot( FILE* fout )
bool SVG_PLOTTER::StartPlot()
{
wxASSERT( !outputFile );
wxASSERT( outputFile );
wxString msg;
outputFile = fout;
static const char* header[] =
{
"<?xml version=\"1.0\" standalone=\"no\"?>\n",

View File

@ -67,8 +67,9 @@ const wxString EaglePcbFileWildcard( _( "Eagle ver. 6.x XML PCB files (*.brd)|*.
const wxString PcbFileWildcard( _( "KiCad s-expr printed circuit board files (*.kicad_pcb)|*.kicad_pcb" ) );
const wxString FootprintLibFileWildcard( _( "KiCad footprint s-expre library file (*.kicad_mod)|*.kicad_mod" ) );
const wxString LegacyFootprintLibFileWildcard( _( "KiCad footprint library file (*.mod)|*.mod" ) );
const wxString PdfFileWildcard( _( "Portable document format files (*.pdf)|*.pdf" ) );
const wxString MacrosFileWildcard( _( "KiCad recorded macros (*.mcr)|*.mcr" ) );
// generic:
const wxString AllFilesWildcard( _( "All files (*)|*" ) );
// Wildcard for cvpcb component to footprint link file
@ -77,6 +78,8 @@ const wxString ComponentFileWildcard( _( "KiCad cmp/footprint link files (*.cmp)
// Wildcard for reports and fabrication documents
const wxString DrillFileWildcard( _( "Drill files (*.drl)|*.drl;*.DRL" ) );
const wxString SVGFileWildcard( _( "SVG files (*.svg)|*.svg;*.SVG" ) );
const wxString PdfFileWildcard( _( "Portable document format files (*.pdf)|*.pdf" ) );
const wxString PSFileWildcard( _( "PostScript files (.ps)|*.ps" ) );
const wxString ReportFileWildcard = _( "Report files (*.rpt)|*.rpt" );
const wxString FootprintPlaceFileWildcard = _( "Footprint place files (*.pos)|*.pos" );
const wxString VrmlFileWildcard( _( "Vrml files (*.wrl)|*.wrl" ) );

View File

@ -1,3 +1,4 @@
#include <wx/string.h>
#include <dialog_sch_sheet_props.h>
DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS( wxWindow* parent ) :
@ -6,3 +7,21 @@ DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS( wxWindow* parent ) :
m_textFileName->SetFocus();
m_sdbSizer1OK->SetDefault();
}
void DIALOG_SCH_SHEET_PROPS::SetFileName( const wxString& aFileName )
{
// Filenames are stored using unix notation
wxString fname = aFileName;
#ifdef __WINDOWS__
fname.Replace( wxT("/"), wxT("\\") );
#endif
m_textFileName->SetValue( fname );
}
const wxString DIALOG_SCH_SHEET_PROPS::GetFileName()
{
// Filenames are stored using unix notation
wxString fname = m_textFileName->GetValue();
fname.Replace( wxT("\\"), wxT("/") );
return fname;
}

View File

@ -1,12 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="10" />
<FileVersion major="1" minor="11" />
<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_php_events">0</property>
<property name="disconnect_python_events">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">table</property>
<property name="file">dialog_sch_sheet_props_base</property>
@ -18,10 +20,13 @@
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="center">wxBOTH</property>
<property name="context_help"></property>
@ -39,18 +44,20 @@
<property name="pos"></property>
<property name="size">453,170</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Schematic Sheet Properties</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="OnAuiFindManager"></event>
<event name="OnAuiPaneButton"></event>
<event name="OnAuiPaneClose"></event>
<event name="OnAuiPaneMaximize"></event>
<event name="OnAuiPaneRestore"></event>
<event name="OnAuiRender"></event>
<event name="OnChar"></event>
<event name="OnClose"></event>
<event name="OnEnterWindow"></event>
@ -105,28 +112,55 @@
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">&amp;File name:</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticText1</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</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>
@ -161,23 +195,54 @@
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">5</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">200,-1</property>
<property name="moveable">1</property>
<property name="name">m_textFileName</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
@ -231,28 +296,55 @@
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Si&amp;ze:</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticText2</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</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>
@ -287,23 +379,54 @@
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_textFileNameSize</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
@ -347,28 +470,55 @@
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">units</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticFileNameSizeUnits</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</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>
@ -403,28 +553,55 @@
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">&amp;Sheet name:</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticText4</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</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>
@ -459,23 +636,54 @@
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">5</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_textSheetName</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
@ -529,28 +737,55 @@
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">&amp;Size:</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticText5</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</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>
@ -585,23 +820,54 @@
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_textSheetNameSize</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
@ -645,28 +911,55 @@
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">units</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticSheetNameSizeUnits</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</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>
@ -708,6 +1001,87 @@
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticLine" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticline1</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLI_HORIZONTAL</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></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="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">12</property>
<property name="flag">wxALL|wxEXPAND</property>

View File

@ -15,11 +15,8 @@ public:
/** Constructor */
DIALOG_SCH_SHEET_PROPS( wxWindow* parent );
void SetFileName( const wxString& aFileName )
{
m_textFileName->SetValue( aFileName );
}
wxString GetFileName() { return m_textFileName->GetValue(); }
void SetFileName( const wxString& aFileName );
const wxString GetFileName();
void SetSheetName( const wxString& aSheetName )
{

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -9,7 +9,7 @@
///////////////////////////////////////////////////////////////////////////
DIALOG_SCH_SHEET_PROPS_BASE::DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
DIALOG_SCH_SHEET_PROPS_BASE::DIALOG_SCH_SHEET_PROPS_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( wxDefaultSize, wxDefaultSize );
@ -66,19 +66,25 @@ DIALOG_SCH_SHEET_PROPS_BASE::DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWi
m_staticSheetNameSizeUnits->Wrap( -1 );
fgSizer1->Add( m_staticSheetNameSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
mainSizer->Add( fgSizer1, 1, wxALL|wxEXPAND, 12 );
mainSizer->Add( 0, 0, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
mainSizer->Add( m_staticline1, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
mainSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 12 );
this->SetSizer( mainSizer );
this->Layout();

View File

@ -1,15 +1,17 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_sch_sheet_props_base__
#define __dialog_sch_sheet_props_base__
#ifndef __DIALOG_SCH_SHEET_PROPS_BASE_H__
#define __DIALOG_SCH_SHEET_PROPS_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/gdicmn.h>
@ -18,6 +20,7 @@
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/button.h>
#include <wx/dialog.h>
@ -26,24 +29,22 @@
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_SCH_SHEET_PROPS_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_SCH_SHEET_PROPS_BASE : public wxDialog
class DIALOG_SCH_SHEET_PROPS_BASE : public DIALOG_SHIM
{
private:
protected:
wxStaticText* m_staticText1;
wxTextCtrl* m_textFileName;
wxStaticText* m_staticText2;
wxTextCtrl* m_textFileNameSize;
wxStaticText* m_staticFileNameSizeUnits;
wxStaticText* m_staticText4;
wxTextCtrl* m_textSheetName;
wxStaticText* m_staticText5;
wxTextCtrl* m_textSheetNameSize;
wxStaticText* m_staticSheetNameSizeUnits;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
@ -55,4 +56,4 @@ class DIALOG_SCH_SHEET_PROPS_BASE : public wxDialog
};
#endif //__dialog_sch_sheet_props_base__
#endif //__DIALOG_SCH_SHEET_PROPS_BASE_H__

View File

@ -35,7 +35,6 @@
#include <richio.h>
#include <general.h>
//#include <protos.h>
#include <sch_bus_entry.h>
#include <sch_marker.h>
#include <sch_junction.h>
@ -78,8 +77,14 @@ bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFi
aScreen->SetFileName( aFullFileName );
FILE* f;
wxString fname = aFullFileName;
#ifdef __WINDOWS__
fname.Replace( wxT("/"), wxT("\\") );
#else
fname.Replace( wxT("\\"), wxT("/") );
#endif
if( ( f = wxFopen( aFullFileName, wxT( "rt" ) ) ) == NULL )
if( ( f = wxFopen( fname, wxT( "rt" ) ) ) == NULL )
{
msgDiag = _( "Failed to open " ) + aFullFileName;
DisplayError( this, msgDiag );

View File

@ -107,13 +107,6 @@ bool DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF( const wxString& aFileName,
double aScale,
bool aPlotFrameRef )
{
FILE* output_file = wxFopen( aFileName, wxT( "wt" ) );
if( output_file == NULL )
return false;
LOCALE_IO toggle;
DXF_PLOTTER* plotter = new DXF_PLOTTER();
const PAGE_INFO& pageInfo = aScreen->GetPageSettings();
@ -123,8 +116,16 @@ bool DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF( const wxString& aFileName,
// Init :
plotter->SetCreator( wxT( "Eeschema-DXF" ) );
plotter->SetFilename( aFileName );
plotter->StartPlot( output_file );
if( ! plotter->OpenFile( aFileName ) )
{
delete plotter;
return false;
}
LOCALE_IO toggle;
plotter->StartPlot();
if( aPlotFrameRef )
{

View File

@ -205,13 +205,6 @@ bool DIALOG_PLOT_SCHEMATIC::Plot_1_Page_HPGL( const wxString& aFileName,
double aScale,
bool aPlotFrameRef )
{
FILE* output_file = wxFopen( aFileName, wxT( "wt" ) );
if( output_file == NULL )
return false;
LOCALE_IO toggle;
HPGL_PLOTTER* plotter = new HPGL_PLOTTER();
plotter->SetPageSettings( aPageInfo );
@ -219,12 +212,20 @@ bool DIALOG_PLOT_SCHEMATIC::Plot_1_Page_HPGL( const wxString& aFileName,
// Init :
plotter->SetCreator( wxT( "Eeschema-HPGL" ) );
plotter->SetFilename( aFileName );
if( ! plotter->OpenFile( aFileName ) )
{
delete plotter;
return false;
}
LOCALE_IO toggle;
// Pen num and pen speed are not initialized here.
// Default HPGL driver values are used
plotter->SetPenDiameter( m_HPGLPenSize );
plotter->SetPenOverlap( m_HPGLPenSize / 4 );
plotter->StartPlot( output_file );
plotter->StartPlot();
plotter->SetColor( BLACK );

View File

@ -88,20 +88,18 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef )
plotFileName = m_parent->GetUniqueFilenameForCurrentSheet() + wxT( "." )
+ PDF_PLOTTER::GetDefaultFileExtension();
FILE* output_file = wxFopen( plotFileName, wxT( "wb" ) );
if( output_file == NULL )
if( ! plotter->OpenFile( plotFileName ) )
{
msg.Printf( _( "** Unable to create %s **\n" ), GetChars( plotFileName ) );
m_MessagesBox->AppendText( msg );
delete plotter;
return;
}
// Open the plotter and do the first page
SetLocaleTo_C_standard();
plotter->SetFilename( plotFileName );
setupPlotPagePDF( plotter, screen );
plotter->StartPlot( output_file );
plotter->StartPlot();
first_page = false;
}
else

View File

@ -137,7 +137,6 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName,
if( output_file == NULL )
return false;
SetLocaleTo_C_standard();
PS_PLOTTER* plotter = new PS_PLOTTER();
plotter->SetPageSettings( aPageInfo );
plotter->SetDefaultLineWidth( GetDefaultLineThickness() );
@ -146,8 +145,15 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName,
// Init :
plotter->SetCreator( wxT( "Eeschema-PS" ) );
plotter->SetFilename( aFileName );
plotter->StartPlot( output_file );
if( ! plotter->OpenFile( aFileName ) )
{
delete plotter;
return false;
}
SetLocaleTo_C_standard();
plotter->StartPlot();
if( aPlotFrameRef )
{

View File

@ -120,13 +120,6 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG( EDA_DRAW_FRAME* aFrame,
bool aPlotBlackAndWhite,
bool aPlotFrameRef )
{
FILE* output_file = wxFopen( aFileName, wxT( "wt" ) );
if( output_file == NULL )
return false;
LOCALE_IO toggle;
SVG_PLOTTER* plotter = new SVG_PLOTTER();
const PAGE_INFO& pageInfo = aScreen->GetPageSettings();
@ -139,8 +132,16 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG( EDA_DRAW_FRAME* aFrame,
// Init :
plotter->SetCreator( wxT( "Eeschema-SVG" ) );
plotter->SetFilename( aFileName );
plotter->StartPlot( output_file );
if( ! plotter->OpenFile( aFileName ) )
{
delete plotter;
return false;
}
LOCALE_IO toggle;
plotter->StartPlot();
if( aPlotFrameRef )
{

View File

@ -469,6 +469,8 @@ public:
void SetFileName( const wxString& aFilename )
{
m_fileName = aFilename;
// Filenames are stored using unix notation
m_fileName.Replace( wxT("\\"), wxT("/") );
}
bool ChangeFileName( SCH_EDIT_FRAME* aFrame, const wxString& aFileName );

View File

@ -93,7 +93,14 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
bool loadFromFile = false;
SCH_SCREEN* useScreen = NULL;
if( !g_RootSheet->SearchHierarchy( fileName.GetFullPath(), &useScreen ) )
wxString newFullFilename = fileName.GetFullPath();
// Inside Eeschema, filenames are stored using unix notation
newFullFilename.Replace( wxT("\\"), wxT("/") );
// Search for a schematic file having the same filename exists,
// already in use in the hierarchy, or on disk,
// in order to reuse it
if( !g_RootSheet->SearchHierarchy( newFullFilename, &useScreen ) )
loadFromFile = fileName.FileExists();
if( aSheet->GetScreen() == NULL ) // New sheet.
@ -101,7 +108,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
if( ( useScreen != NULL ) || loadFromFile ) // Load from existing file.
{
msg.Printf( _( "A file named \"%s\" already exists" ),
GetChars( fileName.GetFullName() ) );
GetChars( newFullFilename ) );
if( useScreen != NULL )
msg += _( " in the current schematic hierarchy" );
@ -114,7 +121,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
else // New file.
{
aSheet->SetScreen( new SCH_SCREEN() );
aSheet->GetScreen()->SetFileName( fileName.GetFullPath() );
aSheet->GetScreen()->SetFileName( newFullFilename );
}
}
else // Existing sheet.
@ -122,7 +129,11 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
bool isUndoable = true;
bool renameFile = false;
if( fileName.GetFullName().CmpNoCase( aSheet->GetFileName() ) != 0 )
// We are always using here a case insensitive comparison
// to avoid issues under Windows, although under Unix
// filenames are case sensitive.
// But many users create schematic under both Unix and Windows
if( newFullFilename.CmpNoCase( aSheet->GetFileName() ) != 0 )
{
// Sheet file name changes cannot be undone.
isUndoable = false;
@ -131,7 +142,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
if( ( useScreen != NULL ) || loadFromFile ) // Load from existing file.
{
tmp.Printf( _( "A file named \"%s\" already exists" ),
GetChars( fileName.GetFullName() ) );
GetChars( newFullFilename ) );
msg += tmp;
if( useScreen != NULL )
@ -168,7 +179,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
if( renameFile )
{
aSheet->GetScreen()->SetFileName( fileName.GetFullName() );
aSheet->GetScreen()->SetFileName( newFullFilename );
SaveEEFile( aSheet->GetScreen() );
// If the the associated screen is shared by more than one sheet, remove the
@ -182,7 +193,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
}
}
aSheet->SetFileName( fileName.GetFullPath() );
aSheet->SetFileName( newFullFilename );
if( useScreen )
aSheet->SetScreen( useScreen );

View File

@ -77,7 +77,7 @@ public:
*/
virtual PlotFormat GetPlotterType() const = 0;
virtual bool StartPlot( FILE* fout ) = 0;
virtual bool StartPlot() = 0;
virtual bool EndPlot() = 0;
virtual void SetNegative( bool _negative )
@ -124,11 +124,6 @@ public:
creator = _creator;
}
virtual void SetFilename( const wxString& _filename )
{
filename = _filename;
}
/**
* Set the plot offset and scaling for the current plot
* @param aOffset is the plot offset
@ -141,6 +136,16 @@ public:
virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
double aScale, bool aMirror ) = 0;
/**
* Open or create the plot file aFullFilename
* @param aFullFilename = the full file name of the file to create
* @return true if success, false if the file cannot be created/opened
*
* Virtual because some plotters use ascii files, some others binary files (PDF)
* The base class open the file in text mode
*/
virtual bool OpenFile( const wxString& aFullFilename );
/**
* The IUs per decimil are an essential scaling factor when
* plotting; they are set and saved when establishing the viewport.
@ -356,7 +361,7 @@ public:
return wxString( wxT( "plt" ) );
}
virtual bool StartPlot( FILE* fout );
virtual bool StartPlot();
virtual bool EndPlot();
/// HPGL doesn't handle line thickness or color
@ -528,7 +533,7 @@ public:
return PLOT_FORMAT_POST;
}
virtual bool StartPlot( FILE* fout );
virtual bool StartPlot();
virtual bool EndPlot();
virtual void SetCurrentLineWidth( int width );
virtual void SetDash( bool dashed );
@ -580,7 +585,17 @@ public:
return wxString( wxT( "pdf" ) );
}
virtual bool StartPlot( FILE* fout );
/**
* Open or create the plot file aFullFilename
* @param aFullFilename = the full file name of the file to create
* @return true if success, false if the file cannot be created/opened
*
* The base class open the file in text mode, so we should have this
* function overlaid for PDF files, which are binary files
*/
virtual bool OpenFile( const wxString& aFullFilename );
virtual bool StartPlot();
virtual bool EndPlot();
virtual void StartPage();
virtual void ClosePage();
@ -652,7 +667,7 @@ public:
}
virtual void SetColor( EDA_COLOR_T color );
virtual bool StartPlot( FILE* fout );
virtual bool StartPlot();
virtual bool EndPlot();
virtual void SetCurrentLineWidth( int width );
virtual void SetDash( bool dashed );
@ -758,7 +773,7 @@ public:
return wxString( wxT( "pho" ) );
}
virtual bool StartPlot( FILE* fout );
virtual bool StartPlot();
virtual bool EndPlot();
virtual void SetCurrentLineWidth( int width );
virtual void SetDefaultLineWidth( int width );
@ -833,7 +848,7 @@ public:
textAsLines = ( mode != PLOTTEXTMODE_NATIVE );
}
virtual bool StartPlot( FILE* fout );
virtual bool StartPlot();
virtual bool EndPlot();
// For now we don't use 'thick' primitives, so no line width

View File

@ -74,6 +74,7 @@ extern const wxString LegacyPcbFileWildcard;
extern const wxString PcbFileWildcard;
extern const wxString EaglePcbFileWildcard;
extern const wxString PdfFileWildcard;
extern const wxString PSFileWildcard;
extern const wxString MacrosFileWildcard;
extern const wxString AllFilesWildcard;
extern const wxString ComponentFileWildcard;

View File

@ -432,14 +432,14 @@ void DIALOG_GENDRILL::GenDrillAndMapFiles(bool aGenDrill, bool aGenMap)
if( aGenMap )
{
const PlotFormat filefmt[5] =
const PlotFormat filefmt[6] =
{ // Keep these format ids in the same order than m_Choice_Drill_Map choices
PLOT_FORMAT_HPGL, PLOT_FORMAT_POST, PLOT_FORMAT_GERBER,
PLOT_FORMAT_DXF, PLOT_FORMAT_SVG
PLOT_FORMAT_DXF, PLOT_FORMAT_SVG, PLOT_FORMAT_PDF
};
unsigned choice = (unsigned) m_Choice_Drill_Map->GetSelection();
if( choice > 4 )
if( choice >= m_Choice_Drill_Map->GetCount() )
choice = 1;
fn.SetExt( wxEmptyString ); // Will be modified by GenDrillMap
@ -548,7 +548,7 @@ void DIALOG_GENDRILL::GenDrillMap( const wxString aFileName,
case PLOT_FORMAT_POST:
ext = PS_PLOTTER::GetDefaultFileExtension();
wildcard = _( "PostScript files (.ps)|*.ps" );
wildcard = PSFileWildcard;
break;
case PLOT_FORMAT_GERBER:
@ -566,8 +566,13 @@ void DIALOG_GENDRILL::GenDrillMap( const wxString aFileName,
wildcard = SVGFileWildcard;
break;
case PLOT_FORMAT_PDF:
ext = PDF_PLOTTER::GetDefaultFileExtension();
wildcard = PdfFileWildcard;
break;
default:
wxMessageBox( wxT( "DIALOG_GENDRILL::GenDrillMap() error" ) );
wxLogMessage( wxT( "DIALOG_GENDRILL::GenDrillMap() error, fmt % unkown" ), format );
return;
}

View File

@ -70,9 +70,9 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con
wxBoxSizer* bMiddleBoxSizer;
bMiddleBoxSizer = new wxBoxSizer( wxVERTICAL );
wxString m_Choice_Drill_MapChoices[] = { _("Drill map (HPGL)"), _("Drill map (PostScript)"), _("Drill map (Gerber)"), _("Drill map (DXF)"), _("Drill map (SVG)") };
wxString m_Choice_Drill_MapChoices[] = { _("HPGL"), _("PostScript"), _("Gerber"), _("DXF"), _("SVG"), _("PDF") };
int m_Choice_Drill_MapNChoices = sizeof( m_Choice_Drill_MapChoices ) / sizeof( wxString );
m_Choice_Drill_Map = new wxRadioBox( this, wxID_ANY, _("Drill Map:"), wxDefaultPosition, wxDefaultSize, m_Choice_Drill_MapNChoices, m_Choice_Drill_MapChoices, 1, wxRA_SPECIFY_COLS );
m_Choice_Drill_Map = new wxRadioBox( this, wxID_ANY, _("Drill Map File Format:"), wxDefaultPosition, wxDefaultSize, m_Choice_Drill_MapNChoices, m_Choice_Drill_MapChoices, 1, wxRA_SPECIFY_COLS );
m_Choice_Drill_Map->SetSelection( 1 );
m_Choice_Drill_Map->SetToolTip( _("Creates a drill map in PS, HPGL or other formats") );

View File

@ -619,7 +619,7 @@
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="choices">&quot;Drill map (HPGL)&quot; &quot;Drill map (PostScript)&quot; &quot;Drill map (Gerber)&quot; &quot;Drill map (DXF)&quot; &quot;Drill map (SVG)&quot;</property>
<property name="choices">&quot;HPGL&quot; &quot;PostScript&quot; &quot;Gerber&quot; &quot;DXF&quot; &quot;SVG&quot; &quot;PDF&quot;</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
@ -634,7 +634,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Drill Map:</property>
<property name="label">Drill Map File Format:</property>
<property name="majorDimension">1</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>

View File

@ -97,6 +97,11 @@ bool EXCELLON_WRITER::GenDrillMapFile( const wxString& aFullFileName,
}
break;
default:
wxASSERT( false );
// fall through
case PLOT_FORMAT_PDF:
case PLOT_FORMAT_POST:
{
PAGE_INFO pageA4( wxT( "A4" ) );
@ -124,9 +129,12 @@ bool EXCELLON_WRITER::GenDrillMapFile( const wxString& aFullFileName,
offset.y = (int) ( (double) bbbox.Centre().y -
( ypagesize_for_board / 2.0 ) / scale );
PS_PLOTTER* ps_plotter = new PS_PLOTTER;
plotter = ps_plotter;
ps_plotter->SetPageSettings( pageA4 );
if( aFormat == PLOT_FORMAT_PDF )
plotter = new PDF_PLOTTER;
else
plotter = new PS_PLOTTER;
plotter->SetPageSettings( pageA4 );
plotter->SetViewport( offset, IU_PER_DECIMILS, scale, false );
}
break;
@ -148,23 +156,19 @@ bool EXCELLON_WRITER::GenDrillMapFile( const wxString& aFullFileName,
plotter->SetViewport( offset, IU_PER_DECIMILS, scale, false );
}
break;
default:
wxASSERT( false );
}
FILE* plotfile = wxFopen( aFullFileName, wxT( "wt" ) );
plotter->SetCreator( wxT( "PCBNEW" ) );
plotter->SetDefaultLineWidth( 5 * IU_PER_MILS );
plotter->SetColorMode( false );
if( plotfile == NULL )
if( ! plotter->OpenFile( aFullFileName ) )
{
delete plotter;
return false;
}
plotter->SetCreator( wxT( "PCBNEW" ) );
plotter->SetFilename( aFullFileName );
plotter->SetDefaultLineWidth( 10 * IU_PER_DECIMILS );
plotter->StartPlot( plotfile );
plotter->StartPlot();
// Draw items on edge layer (not all, only items useful for drill map
BRDITEMS_PLOTTER itemplotter( plotter, m_pcb, plot_opts );

View File

@ -612,13 +612,13 @@ PLOTTER *StartPlotBoard( BOARD *aBoard, PCB_PLOT_PARAMS *aPlotOpts,
wxASSERT( false );
}
the_plotter->SetFilename( aFullFileName );
// Compute the viewport and set the other options
initializePlotter( the_plotter, aBoard, aPlotOpts );
if( the_plotter->StartPlot( output_file ) )
if( the_plotter->OpenFile( aFullFileName ) )
{
the_plotter->StartPlot();
// Plot the frame reference if requested
if( aPlotOpts->GetPlotFrameRef() )
PlotWorkSheet( the_plotter, aBoard->GetTitleBlock(),

View File

@ -1,37 +1,19 @@
update=19/09/2011 08:20:40
update=13/10/2012 17:48:08
version=1
last_client=pcbnew
[general]
version=1
RootSch=
BoardNm=
[cvpcb]
version=1
NetIExt=net
[cvpcb/libraries]
EquName1=devcms
[eeschema]
version=1
LibDir=
NetFmt=1
HPGLSpd=20
HPGLDm=15
HPGLNum=1
offX_A4=0
offY_A4=0
offX_A3=0
offY_A3=0
offX_A2=0
offY_A2=0
offX_A1=0
offY_A1=0
offX_A0=0
offY_A0=0
offX_A=0
offY_A=0
offX_B=0
offY_B=0
offX_C=0
offY_C=0
offX_D=0
offY_D=0
offX_E=0
offY_E=0
NetFmtName=
RptD_X=0
RptD_Y=100
RptLab=1
@ -67,28 +49,23 @@ LibName27=opto
LibName28=atmel
LibName29=contrib
LibName30=valves
[cvpcb]
version=1
NetIExt=net
[cvpcb/libraries]
EquName1=devcms
[pcbnew]
version=1
PadDrlX=320
PadDimH=600
PadDimV=600
BoardThickness=630
TxtPcbV=800
TxtPcbH=600
TxtModV=600
TxtModH=600
TxtModW=120
VEgarde=100
DrawLar=150
EdgeLar=150
TxtLar=120
MSegLar=150
LastNetListRead=
PadDrlX=320
PadDimH=550
PadDimV=550
BoardThickness=620
TxtPcbV=600
TxtPcbH=600
TxtModV=500
TxtModH=500
TxtModW=100
VEgarde=100
DrawLar=120
EdgeLar=80
TxtLar=120
MSegLar=120
[pcbnew/libraries]
LibDir=
LibName1=sockets