diff --git a/common/common_plotHPGL_functions.cpp b/common/common_plotHPGL_functions.cpp index 7c0b0ef380..4f2b4e03f2 100644 --- a/common/common_plotHPGL_functions.cpp +++ b/common/common_plotHPGL_functions.cpp @@ -90,10 +90,10 @@ void HPGL_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_T fill, } -/** +/** * HPGL polygon: fill not supported (but closed, at least) */ -void HPGL_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList, +void HPGL_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList, FILL_T aFill, int aWidth) { if( aCornerList.size() <= 1 ) @@ -175,13 +175,13 @@ void HPGL_PLOTTER::SetDash( bool dashed ) { wxASSERT( outputFile ); if( dashed ) - fputs( "LI 2;\n", stderr ); + fputs( "LI 2;\n", outputFile ); else - fputs( "LI;\n", stderr ); + fputs( "LI;\n", outputFile ); } -void HPGL_PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end, +void HPGL_PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end, int width, EDA_DRAW_MODE_T tracemode ) { wxASSERT( outputFile ); @@ -189,7 +189,7 @@ void HPGL_PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end, wxSize size; // Suppress overlap if pen is too big or in line mode - if( (penDiameter >= width) || (tracemode == LINE) ) + if( (penDiameter >= width) || (tracemode == LINE) ) { MoveTo( start ); FinishTo( end ); @@ -302,7 +302,7 @@ void HPGL_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre, double rsize = userToDeviceSize( radius ); - fprintf( outputFile, "PA %.0f,%.0fd;CI %.0f;\n", + fprintf( outputFile, "PA %.0f,%.0fd;CI %.0f;\n", pos_dev.x, pos_dev.y, rsize ); if( trace_mode == FILLED ) // Plot in filled mode. diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index e3f9341207..aa0e4dc40e 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -12,14 +12,6 @@ include_directories( set(EESCHEMA_DLGS dialogs/dialog_color_config.cpp - dialogs/dialog_plot_schematic_DXF.cpp - dialogs/dialog_plot_schematic_DXF_base.cpp - dialogs/dialog_plot_schematic_HPGL.cpp - dialogs/dialog_plot_schematic_HPGL_base.cpp - dialogs/dialog_plot_schematic_PS.cpp - dialogs/dialog_plot_schematic_PS_base.cpp - dialogs/dialog_plot_schematic_PDF.cpp - dialogs/dialog_plot_schematic_PDF_base.cpp dialogs/annotate_dialog.cpp dialogs/dialog_annotate_base.cpp dialogs/dialog_lib_edit_text.cpp @@ -50,6 +42,8 @@ set(EESCHEMA_DLGS dialogs/dialog_lib_new_component.cpp dialogs/dialog_lib_new_component_base.cpp dialogs/dialog_netlist_base.cpp + dialogs/dialog_plot_schematic_base.cpp + dialogs/dialog_plot_schematic.cpp dialogs/dialog_print_using_printer_base.cpp dialogs/dialog_print_using_printer.cpp dialogs/dialog_sch_edit_sheet_pin.cpp @@ -58,8 +52,6 @@ set(EESCHEMA_DLGS dialogs/dialog_sch_sheet_props_base.cpp dialogs/dialog_schematic_find.cpp dialogs/dialog_schematic_find_base.cpp - dialogs/dialog_SVG_print.cpp - dialogs/dialog_SVG_print_base.cpp ) set(EESCHEMA_SRCS @@ -125,6 +117,11 @@ set(EESCHEMA_SRCS onrightclick.cpp operations_on_items_lists.cpp pinedit.cpp + plot_schematic_DXF.cpp + plot_schematic_HPGL.cpp + plot_schematic_PS.cpp + plot_schematic_PDF.cpp + plot_schematic_SVG.cpp sch_base_frame.cpp sch_bitmap.cpp sch_bus_entry.cpp diff --git a/eeschema/dialogs/dialog_SVG_print.cpp b/eeschema/dialogs/dialog_SVG_print.cpp deleted file mode 100644 index 6409abc18a..0000000000 --- a/eeschema/dialogs/dialog_SVG_print.cpp +++ /dev/null @@ -1,291 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 2011 Wayne Stambaugh - * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, you may find one here: - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * or you may search the http://www.gnu.org website for the version 2 license, - * or you may write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -/** - * @file eeschema/dialogs/dialog_SVG_print.cpp - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - - -// Keys for configuration -#define PLOTSVGMODECOLOR_KEY wxT( "PlotSVGModeColor" ) - -#define WIDTH_MAX_VALUE 100 -#define WIDTH_MIN_VALUE 1 - -// Variables locales -static bool s_Print_Frame_Ref = true; -static int s_PlotBlackAndWhite = 0; - - -/*! - * DIALOG_SVG_PRINT functions - */ -DIALOG_SVG_PRINT::DIALOG_SVG_PRINT( EDA_DRAW_FRAME* parent ) : - DIALOG_SVG_PRINT_base( parent ) -{ - m_Parent = parent; - m_Config = wxGetApp().GetSettings(); -} - - -void DIALOG_SVG_PRINT::OnInitDialog( wxInitDialogEvent& event ) -{ - SetFocus(); // Make ESC key working - - if( m_Config ) - { - m_Config->Read( PLOTSVGMODECOLOR_KEY, &s_PlotBlackAndWhite ); - } - - m_ModeColorOption->SetSelection( s_PlotBlackAndWhite ); - - AddUnitSymbol( *m_TextPenWidth, g_UserUnit ); - m_DialogPenWidth->SetValue( - ReturnStringFromValue( g_UserUnit, g_DrawDefaultLineThickness ) ); - m_Print_Sheet_Ref->SetValue( s_Print_Frame_Ref ); - - if( GetSizer() ) - { - GetSizer()->SetSizeHints( this ); - } -} - - -void DIALOG_SVG_PRINT::SetPenWidth() -{ - g_DrawDefaultLineThickness = ReturnValueFromTextCtrl( *m_DialogPenWidth ); - - if( g_DrawDefaultLineThickness > WIDTH_MAX_VALUE ) - { - g_DrawDefaultLineThickness = WIDTH_MAX_VALUE; - } - - if( g_DrawDefaultLineThickness < WIDTH_MIN_VALUE ) - { - g_DrawDefaultLineThickness = WIDTH_MIN_VALUE; - } - - m_DialogPenWidth->SetValue( - ReturnStringFromValue( g_UserUnit, g_DrawDefaultLineThickness ) ); -} - - -void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref ) -{ - wxString msg; - wxFileName fn; - - SetPenWidth(); - - g_DrawDefaultLineThickness = - ReturnValueFromTextCtrl( *m_DialogPenWidth ); - - SCH_SCREEN* screen = (SCH_SCREEN*) m_Parent->GetScreen(); - - if( aPrintAll && m_Parent->IsType( SCHEMATIC_FRAME_TYPE ) ) - { - SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) m_Parent; - SCH_SHEET_PATH* sheetpath; - SCH_SHEET_PATH oldsheetpath = schframe->GetCurrentSheet(); - SCH_SCREEN* schscreen = schframe->GetScreen(); - SCH_SHEET_LIST SheetList( NULL ); - sheetpath = SheetList.GetFirst(); - SCH_SHEET_PATH list; - - for( ; ; ) - { - if( sheetpath == NULL ) - break; - - list.Clear(); - - if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) ) - { - schframe->SetCurrentSheet( list ); - schframe->GetCurrentSheet().UpdateAllScreenReferences(); - schframe->SetSheetNumberAndCount(); - schscreen = schframe->GetCurrentSheet().LastScreen(); - } - else // Should not happen - return; - - sheetpath = SheetList.GetNext(); - - fn = schframe->GetUniqueFilenameForCurrentSheet() + wxT( ".svg" ); - - bool success = DrawSVGPage( m_Parent, fn.GetFullPath(), ( SCH_SCREEN* ) schscreen, - m_ModeColorOption->GetSelection() == 0 ? false : true, - aPrint_Sheet_Ref ); - msg = _( "Create file " ) + fn.GetFullPath(); - if( !success ) - msg += _( " error" ); - msg += wxT( "\n" ); - m_MessagesBox->AppendText( msg ); - } - - schframe->SetCurrentSheet( oldsheetpath ); - schframe->GetCurrentSheet().UpdateAllScreenReferences(); - schframe->SetSheetNumberAndCount(); - } - else - { - fn = m_FileNameCtrl->GetValue(); - - if( !fn.IsOk() ) - fn = screen->GetFileName(); - - fn.SetExt( wxT( "svg" ) ); - fn.MakeAbsolute(); - - bool success = DrawSVGPage( m_Parent, fn.GetFullPath(), ( SCH_SCREEN* ) screen, - m_ModeColorOption->GetSelection() == 0 ? false : true, - aPrint_Sheet_Ref ); - msg = _( "Create file " ) + fn.GetFullPath(); - - if( !success ) - msg += _( " error" ); - - msg += wxT( "\n" ); - m_MessagesBox->AppendText( msg ); - } -} - - -bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame, - const wxString& FullFileName, - SCH_SCREEN* screen, - bool aPrintBlackAndWhite, - bool aPrint_Sheet_Ref ) -{ - int tmpzoom; - wxPoint tmp_startvisu; - wxSize sheetSize; // Sheet size in internal units - wxPoint old_org; - bool success = true; - - tmp_startvisu = screen->m_StartVisu; - tmpzoom = screen->GetZoom(); - old_org = screen->m_DrawOrg; - screen->m_DrawOrg.x = screen->m_DrawOrg.y = 0; - screen->m_StartVisu.x = screen->m_StartVisu.y = 0; - - sheetSize = screen->GetPageSettings().GetSizeIU(); // page size in 1/1000 inch, ie in internal units - - screen->SetScalingFactor( 1.0 ); - EDA_DRAW_PANEL* panel = frame->GetCanvas(); - - LOCALE_IO toggle; - - double dpi = 1000.0*IU_PER_MILS; - wxPoint origin; - KicadSVGFileDC dc( FullFileName, origin, sheetSize, dpi ); - - EDA_RECT tmp = *panel->GetClipBox(); - GRResetPenAndBrush( &dc ); - GRForceBlackPen( aPrintBlackAndWhite ); - - - panel->SetClipBox( EDA_RECT( wxPoint( -0x3FFFFF0, -0x3FFFFF0 ), - wxSize( 0x7FFFFF0, 0x7FFFFF0 ) ) ); - - screen->m_IsPrinting = true; - - if( frame->IsType( SCHEMATIC_FRAME_TYPE ) ) - screen->Draw( panel, &dc, GR_COPY ); - - if( frame->IsType( LIBEDITOR_FRAME_TYPE ) ) - ((LIB_EDIT_FRAME*)frame)->RedrawComponent( &dc, - wxPoint(sheetSize.x/2, - sheetSize.y/2) ); - - if( aPrint_Sheet_Ref ) - frame->TraceWorkSheet( &dc, screen, g_DrawDefaultLineThickness, - IU_PER_MILS, frame->GetScreenDesc() ); - - screen->m_IsPrinting = false; - panel->SetClipBox( tmp ); - - GRForceBlackPen( false ); - - screen->m_StartVisu = tmp_startvisu; - screen->m_DrawOrg = old_org; - screen->SetZoom( tmpzoom ); - - return success; -} - - -void DIALOG_SVG_PRINT::OnButtonPlotAllClick( wxCommandEvent& event ) -{ - PrintSVGDoc( true, m_Print_Sheet_Ref->GetValue() ); -} - - -void DIALOG_SVG_PRINT::OnButtonPlotCurrentClick( wxCommandEvent& event ) -{ - PrintSVGDoc( false, m_Print_Sheet_Ref->GetValue() ); -} - - -void DIALOG_SVG_PRINT::OnButtonCancelClick( wxCommandEvent& event ) -{ - Close(); -} - - -void DIALOG_SVG_PRINT::OnCloseWindow( wxCloseEvent& event ) -{ - if( m_Config ) - { - s_PlotBlackAndWhite = m_ModeColorOption->GetSelection(); - m_Config->Write( PLOTSVGMODECOLOR_KEY, s_PlotBlackAndWhite ); - } - EndModal( 0 ); -} - - -/* called on radiobox color/black and white selection - */ -void DIALOG_SVG_PRINT::OnSetColorModeSelected( wxCommandEvent& event ) -{ - s_PlotBlackAndWhite = m_ModeColorOption->GetSelection(); -} diff --git a/eeschema/dialogs/dialog_SVG_print.h b/eeschema/dialogs/dialog_SVG_print.h deleted file mode 100644 index 365dc42121..0000000000 --- a/eeschema/dialogs/dialog_SVG_print.h +++ /dev/null @@ -1,40 +0,0 @@ - -#ifndef _DIALOG_SVG_PRINT_H_ -#define _DIALOG_SVG_PRINT_H_ - - -class EDA_DRAW_FRAME; - - -#include - - -class DIALOG_SVG_PRINT : public DIALOG_SVG_PRINT_base -{ -private: - EDA_DRAW_FRAME* m_Parent; - wxConfig* m_Config; - -public: - DIALOG_SVG_PRINT( EDA_DRAW_FRAME* parent ); - ~DIALOG_SVG_PRINT() {} - -private: - void OnCloseWindow( wxCloseEvent& event ); - void OnInitDialog( wxInitDialogEvent& event ); - void OnButtonPlotCurrentClick( wxCommandEvent& event ); - void OnButtonPlotAllClick( wxCommandEvent& event ); - void OnButtonCancelClick( wxCommandEvent& event ); - void OnSetColorModeSelected( wxCommandEvent& event ); - void SetPenWidth(); - void PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref ); - -public: - static bool DrawSVGPage( EDA_DRAW_FRAME* frame, - const wxString& FullFileName, SCH_SCREEN* screen, - bool aPrintBlackAndWhite = false, - bool aPrint_Sheet_Ref = false ); -}; - - -#endif // _DIALOG_SVG_PRINT_H_ diff --git a/eeschema/dialogs/dialog_SVG_print_base.cpp b/eeschema/dialogs/dialog_SVG_print_base.cpp deleted file mode 100644 index 9cdc62d51f..0000000000 --- a/eeschema/dialogs/dialog_SVG_print_base.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 30 2011) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#include "dialog_SVG_print_base.h" - -/////////////////////////////////////////////////////////////////////////// - -DIALOG_SVG_PRINT_base::DIALOG_SVG_PRINT_base( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) -{ - this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize ); - - wxBoxSizer* bMainSizer; - bMainSizer = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bUpperSizer; - bUpperSizer = new wxBoxSizer( wxHORIZONTAL ); - - wxStaticBoxSizer* sbOptionsSizer; - sbOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Print SVG options:") ), wxVERTICAL ); - - m_TextPenWidth = new wxStaticText( this, wxID_ANY, _("Default Pen Size"), wxDefaultPosition, wxDefaultSize, 0 ); - m_TextPenWidth->Wrap( -1 ); - sbOptionsSizer->Add( m_TextPenWidth, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_DialogPenWidth = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_DialogPenWidth->SetToolTip( _("Selection of the default pen thickness used to draw items, when their thickness is set to 0.") ); - - sbOptionsSizer->Add( m_DialogPenWidth, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - - wxString m_ModeColorOptionChoices[] = { _("Color"), _("Black and White") }; - int m_ModeColorOptionNChoices = sizeof( m_ModeColorOptionChoices ) / sizeof( wxString ); - m_ModeColorOption = new wxRadioBox( this, wxID_ANY, _("Print mode"), wxDefaultPosition, wxDefaultSize, m_ModeColorOptionNChoices, m_ModeColorOptionChoices, 1, wxRA_SPECIFY_COLS ); - m_ModeColorOption->SetSelection( 1 ); - m_ModeColorOption->SetToolTip( _("Choose if you want to draw the sheet like it appears on screen,\nor in black and white mode, better to print it when using black and white printers") ); - - sbOptionsSizer->Add( m_ModeColorOption, 0, wxALL|wxEXPAND, 5 ); - - m_Print_Sheet_Ref = new wxCheckBox( this, wxID_ANY, _("Print Frame Ref"), wxDefaultPosition, wxDefaultSize, 0 ); - m_Print_Sheet_Ref->SetToolTip( _("Print (or not) the Frame references.") ); - - sbOptionsSizer->Add( m_Print_Sheet_Ref, 0, wxALL, 5 ); - - bUpperSizer->Add( sbOptionsSizer, 1, 0, 5 ); - - wxBoxSizer* bButtonsSizer; - bButtonsSizer = new wxBoxSizer( wxVERTICAL ); - - m_buttonPlotCurrent = new wxButton( this, wxID_PRINT_CURRENT, _("Print Current"), wxDefaultPosition, wxDefaultSize, 0 ); - bButtonsSizer->Add( m_buttonPlotCurrent, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - - m_buttonPlotAll = new wxButton( this, wxID_PRINT_ALL, _("Print All"), wxDefaultPosition, wxDefaultSize, 0 ); - m_buttonPlotAll->SetDefault(); - bButtonsSizer->Add( m_buttonPlotAll, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - - m_buttonQuit = new wxButton( this, wxID_CANCEL, _("Quit"), wxDefaultPosition, wxDefaultSize, 0 ); - bButtonsSizer->Add( m_buttonQuit, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - - bUpperSizer->Add( bButtonsSizer, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bMainSizer->Add( bUpperSizer, 0, wxEXPAND, 5 ); - - m_staticText1 = new wxStaticText( this, wxID_ANY, _("Filename:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText1->Wrap( -1 ); - bMainSizer->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_FileNameCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_FileNameCtrl->SetToolTip( _("Enter a filename if you do not want to use default file names\nCan be used only when printing the current sheet") ); - m_FileNameCtrl->SetMinSize( wxSize( 450,-1 ) ); - - bMainSizer->Add( m_FileNameCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - m_staticText2 = new wxStaticText( this, wxID_ANY, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText2->Wrap( -1 ); - bMainSizer->Add( m_staticText2, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_MessagesBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE ); - m_MessagesBox->SetMinSize( wxSize( -1,80 ) ); - - bMainSizer->Add( m_MessagesBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - this->SetSizer( bMainSizer ); - this->Layout(); - - // Connect Events - this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_SVG_PRINT_base::OnCloseWindow ) ); - this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_SVG_PRINT_base::OnInitDialog ) ); - m_ModeColorOption->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnSetColorModeSelected ), NULL, this ); - m_buttonPlotCurrent->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnButtonPlotCurrentClick ), NULL, this ); - m_buttonPlotAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnButtonPlotAllClick ), NULL, this ); - m_buttonQuit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnButtonCancelClick ), NULL, this ); -} - -DIALOG_SVG_PRINT_base::~DIALOG_SVG_PRINT_base() -{ - // Disconnect Events - this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_SVG_PRINT_base::OnCloseWindow ) ); - this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_SVG_PRINT_base::OnInitDialog ) ); - m_ModeColorOption->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnSetColorModeSelected ), NULL, this ); - m_buttonPlotCurrent->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnButtonPlotCurrentClick ), NULL, this ); - m_buttonPlotAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnButtonPlotAllClick ), NULL, this ); - m_buttonQuit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SVG_PRINT_base::OnButtonCancelClick ), NULL, this ); - -} diff --git a/eeschema/dialogs/dialog_SVG_print_base.fbp b/eeschema/dialogs/dialog_SVG_print_base.fbp deleted file mode 100644 index 64dd9d5f4b..0000000000 --- a/eeschema/dialogs/dialog_SVG_print_base.fbp +++ /dev/null @@ -1,1141 +0,0 @@ - - - - - - C++ - 1 - source_name - 0 - res - UTF-8 - connect - dialog_SVG_print_base - 1000 - none - 1 - DialogSVGPrint_base - - . - - 1 - 1 - 1 - 0 - - 1 - 1 - 1 - 1 - 0 - - - - - 1 - - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - impl_virtual - - - 1 - - 0 - 0 - wxID_ANY - - - 0 - - - 0 - -1,-1 - 1 - DIALOG_SVG_PRINT_base - 1 - - - 1 - - - Resizable - - 1 - 550,446 - wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - - Create SVG file - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - OnCloseWindow - - - - - - OnInitDialog - - - - - - - - - - - - - - - - - - - - - - - bMainSizer - wxVERTICAL - none - - 5 - wxEXPAND - 0 - - - bUpperSizer - wxHORIZONTAL - none - - 5 - - 1 - - wxID_ANY - Print SVG options: - - sbOptionsSizer - wxVERTICAL - none - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Default Pen Size - - - 0 - - - 0 - - 1 - m_TextPenWidth - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - - 0 - - 0 - - 0 - - 1 - m_DialogPenWidth - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - Selection of the default pen thickness used to draw items, when their thickness is set to 0. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - "Color" "Black and White" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Print mode - - 1 - - 0 - - - 0 - - 1 - m_ModeColorOption - 1 - - - protected - 1 - - - Resizable - - 1 - 1 - - wxRA_SPECIFY_COLS - - 0 - Choose if you want to draw the sheet like it appears on screen, or in black and white mode, better to print it when using black and white printers - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - OnSetColorModeSelected - - - - - - - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Print Frame Ref - - - 0 - - - 0 - - 1 - m_Print_Sheet_Ref - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - Print (or not) the Frame references. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL - 0 - - - bButtonsSizer - wxVERTICAL - none - - 5 - wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_PRINT_CURRENT - Print Current - - - 0 - - - 0 - - 1 - m_buttonPlotCurrent - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnButtonPlotCurrentClick - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_PRINT_ALL - Print All - - - 0 - - - 0 - - 1 - m_buttonPlotAll - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnButtonPlotAllClick - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_CANCEL - Quit - - - 0 - - - 0 - - 1 - m_buttonQuit - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnButtonCancelClick - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Filename: - - - 0 - - - 0 - - 1 - m_staticText1 - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - - 0 - - 0 - - 0 - 450,-1 - 1 - m_FileNameCtrl - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - Enter a filename if you do not want to use default file names Can be used only when printing the current sheet - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Messages: - - - 0 - - - 0 - - 1 - m_staticText2 - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 1 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - - 0 - - 0 - - 0 - -1,80 - 1 - m_MessagesBox - 1 - - - protected - 1 - - - Resizable - - 1 - - wxTE_MULTILINE - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eeschema/dialogs/dialog_plot_schematic.cpp b/eeschema/dialogs/dialog_plot_schematic.cpp new file mode 100644 index 0000000000..2979fa2eab --- /dev/null +++ b/eeschema/dialogs/dialog_plot_schematic.cpp @@ -0,0 +1,293 @@ +/** @file dialog_plot_schematic_PDF.cpp + */ + +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 1992-2012 Jean-Pierre Charras + * + * Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +// Keys for configuration +#define PLOT_FORMAT_KEY wxT( "PlotFormat" ) +#define PLOT_MODECOLOR_KEY wxT( "PlotModeColor" ) +#define PLOT_FRAME_REFERENCE_KEY wxT( "PlotFrameRef" ) +#define PLOT_HPGL_ORIGIN_KEY wxT( "PlotHPGLOrg" ) + + + +// static members (static to remember last state): +int DIALOG_PLOT_SCHEMATIC::m_pageSizeSelect = PAGE_SIZE_AUTO; +int DIALOG_PLOT_SCHEMATIC::m_HPGLPaperSizeSelect = 0; + + +void SCH_EDIT_FRAME::PlotSchematic( wxCommandEvent& event ) +{ + DIALOG_PLOT_SCHEMATIC dlg( this ); + + dlg.ShowModal(); +} + + +DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC( SCH_EDIT_FRAME* parent ) : + DIALOG_PLOT_SCHEMATIC_BASE( parent ) +{ + m_parent = parent; + m_config = wxGetApp().GetSettings(); + + m_select_PlotAll = false; + initDlg(); + + GetSizer()->SetSizeHints( this ); + + Centre(); +} + + +// Initialize the dialog options: +void DIALOG_PLOT_SCHEMATIC::initDlg() +{ + SetFocus(); // make the ESC work + + // Set paper size option + m_PaperSizeOption->SetSelection( m_pageSizeSelect ); + + // Set color or B&W plot option + bool tmp; + m_config->Read( PLOT_MODECOLOR_KEY, &tmp, true ); + setModeColor( tmp ); + + // Set plot or not frame reference option + m_config->Read( PLOT_FRAME_REFERENCE_KEY, &tmp, true ); + setPlotFrameRef( true ); + + // Set HPGL plot origin to center of paper of left bottom corner + m_config->Read( PLOT_HPGL_ORIGIN_KEY, &tmp, false ); + SetPlotOriginCenter( tmp ); + + // Switch to the last save plot format + long plotfmt; + m_config->Read( PLOT_FORMAT_KEY, &plotfmt, 0 ); + switch( plotfmt ) + { + default: + case PLOT_FORMAT_POST: + m_plotFormatOpt->SetSelection( 0 ); + break; + + case PLOT_FORMAT_PDF: + m_plotFormatOpt->SetSelection( 1 ); + break; + + case PLOT_FORMAT_SVG: + m_plotFormatOpt->SetSelection( 2 ); + break; + + case PLOT_FORMAT_DXF: + m_plotFormatOpt->SetSelection( 3 ); + break; + + case PLOT_FORMAT_HPGL: + m_plotFormatOpt->SetSelection( 4 ); + break; + } + + // Set the default line width (pen width which should be used for + // items that do not have a pen size defined (like frame ref) + AddUnitSymbol( *m_defaultLineWidthTitle, g_UserUnit ); + PutValueInLocalUnits( *m_DefaultLineSizeCtrl, g_DrawDefaultLineThickness ); + + // Initialize HPGL specific widgets + AddUnitSymbol( *m_penHPLGWidthTitle, g_UserUnit ); + PutValueInLocalUnits( *m_penHPGLWidthCtrl, g_HPGL_Pen_Descr.m_Pen_Diam ); + m_HPGLPaperSizeOption->SetSelection( m_HPGLPaperSizeSelect ); + + // Hide/show widgets that are not always displayed: + wxCommandEvent cmd_event; + OnPlotFormatSelection( cmd_event ); +} + +PlotFormat DIALOG_PLOT_SCHEMATIC::GetPlotFileFormat() +{ + switch( m_plotFormatOpt->GetSelection() ) + { + default: + case 0: return PLOT_FORMAT_POST; + case 1: return PLOT_FORMAT_SVG; + case 2: return PLOT_FORMAT_PDF; + case 3: return PLOT_FORMAT_DXF; + case 4: return PLOT_FORMAT_HPGL; + } +} + + +void DIALOG_PLOT_SCHEMATIC::OnButtonCancelClick( wxCommandEvent& event ) +{ + getPlotOptions(); + EndModal( 0 ); +} + + +void DIALOG_PLOT_SCHEMATIC::getPlotOptions() +{ + m_config->Write( PLOT_MODECOLOR_KEY, getModeColor() ); + m_config->Write( PLOT_FRAME_REFERENCE_KEY, getPlotFrameRef() ); + m_config->Write( PLOT_FORMAT_KEY, (long) GetPlotFileFormat() ); + m_config->Write( PLOT_HPGL_ORIGIN_KEY, GetPlotOriginCenter() ); + m_HPGLPaperSizeSelect = m_HPGLPaperSizeOption->GetSelection(); + + m_pageSizeSelect = m_PaperSizeOption->GetSelection(); + g_DrawDefaultLineThickness = ReturnValueFromTextCtrl( *m_DefaultLineSizeCtrl ); + + if( g_DrawDefaultLineThickness < 1 ) + g_DrawDefaultLineThickness = 1; +} + +void DIALOG_PLOT_SCHEMATIC::OnPlotFormatSelection( wxCommandEvent& event ) +{ + + switch( m_plotFormatOpt->GetSelection() ) + { + case 0: // postscript + m_paperOptionsSizer->Hide( m_paperHPGLSizer ); + m_paperOptionsSizer->Show( m_PaperSizeOption ); + m_PaperSizeOption->Enable( true ); + m_DefaultLineSizeCtrl->Enable( true ); + break; + + case 1: // PDF + m_paperOptionsSizer->Hide( m_paperHPGLSizer ); + m_paperOptionsSizer->Show(m_PaperSizeOption); + m_PaperSizeOption->Enable( true ); + m_DefaultLineSizeCtrl->Enable( true ); + break; + + case 2: // SVG + m_paperOptionsSizer->Hide( m_paperHPGLSizer ); + m_paperOptionsSizer->Show(m_PaperSizeOption); + m_PaperSizeOption->Enable( false ); + m_DefaultLineSizeCtrl->Enable( true ); + break; + + case 3: // DXF + m_paperOptionsSizer->Hide( m_paperHPGLSizer ); + m_paperOptionsSizer->Show(m_PaperSizeOption); + m_PaperSizeOption->Enable( false ); + m_DefaultLineSizeCtrl->Enable( false ); + break; + + case 4: //HPGL + m_paperOptionsSizer->Show( m_paperHPGLSizer ); + m_paperOptionsSizer->Hide(m_PaperSizeOption); + m_DefaultLineSizeCtrl->Enable( false ); + break; + + } + + GetSizer()->SetSizeHints( this ); +} + + +void DIALOG_PLOT_SCHEMATIC::setupPlotPage( PLOTTER * plotter, SCH_SCREEN* screen ) +{ + PAGE_INFO plotPage; // page size selected to plot + // Considerations on page size and scaling requests + PAGE_INFO actualPage = screen->GetPageSettings(); // page size selected in schematic + + switch( m_pageSizeSelect ) + { + case PAGE_SIZE_A: + plotPage.SetType( wxT( "A" ) ); + plotPage.SetPortrait( actualPage.IsPortrait() ); + break; + + case PAGE_SIZE_A4: + plotPage.SetType( wxT( "A4" ) ); + plotPage.SetPortrait( actualPage.IsPortrait() ); + break; + + case PAGE_SIZE_AUTO: + default: + plotPage = actualPage; + break; + } + + double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils(); + double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils(); + double scale = MIN( scalex, scaley ); + plotter->SetPageSettings( plotPage ); + plotter->SetViewport( wxPoint( 0, 0 ), IU_PER_DECIMILS, scale, false ); +} + + +void DIALOG_PLOT_SCHEMATIC::OnButtonPlotCurrentClick( wxCommandEvent& event ) +{ + m_select_PlotAll = false; + PlotSchematic(); +} + + +void DIALOG_PLOT_SCHEMATIC::OnButtonPlotAllClick( wxCommandEvent& event ) +{ + m_select_PlotAll = true; + PlotSchematic(); +} + +void DIALOG_PLOT_SCHEMATIC::PlotSchematic() +{ + getPlotOptions(); + switch( GetPlotFileFormat() ) + { + case PLOT_FORMAT_HPGL: + createHPGLFile( m_select_PlotAll ); + break; + + default: + case PLOT_FORMAT_POST: + createPSFile(); + break; + + case PLOT_FORMAT_DXF: + CreateDXFFile(); + break; + + case PLOT_FORMAT_PDF: + createPDFFile(); + break; + + case PLOT_FORMAT_SVG: + createSVGFile( m_select_PlotAll, getPlotFrameRef() ); + break; + } + m_MessagesBox->AppendText( wxT( "****\n" ) ); +} + diff --git a/eeschema/dialogs/dialog_plot_schematic.h b/eeschema/dialogs/dialog_plot_schematic.h new file mode 100644 index 0000000000..3a20dcdbcd --- /dev/null +++ b/eeschema/dialogs/dialog_plot_schematic.h @@ -0,0 +1,123 @@ +/** @file dialog_plot_schematic.cpp + */ + +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 1992-2012 Jean-Pierre Charras + * + * Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include +#include +#include +#include +#include + + +enum PageFormatReq { + PAGE_SIZE_AUTO, + PAGE_SIZE_A4, + PAGE_SIZE_A +}; + + +class DIALOG_PLOT_SCHEMATIC : public DIALOG_PLOT_SCHEMATIC_BASE +{ +private: + SCH_EDIT_FRAME* m_parent; + wxConfig* m_config; + static int m_pageSizeSelect; // Static to keep last option for some format: + // Static to keep last option: + // use default size or force A or A4 size + static int m_HPGLPaperSizeSelect; // for HPGL format only: last selected paper size + bool m_select_PlotAll; // Flaf to plot current page or the full hierarchy + +public: + // / Constructors + DIALOG_PLOT_SCHEMATIC( SCH_EDIT_FRAME* parent ); + +private: + void OnPlotFormatSelection( wxCommandEvent& event ); + void OnButtonPlotCurrentClick( wxCommandEvent& event ); + void OnButtonPlotAllClick( wxCommandEvent& event ); + void OnButtonCancelClick( wxCommandEvent& event ); + + void initDlg(); + + // common + void getPlotOptions(); + bool getModeColor() + { return m_ModeColorOption->GetSelection() == 0; } + + void setModeColor( bool aColor ) + { m_ModeColorOption->SetSelection( aColor ? 0 : 1 ); } + + PlotFormat GetPlotFileFormat(); + + bool getPlotFrameRef() { return m_PlotFrameRefOpt->GetValue(); } + void setPlotFrameRef( bool aPlot) {m_PlotFrameRefOpt->SetValue( aPlot ); } + + void setupPlotPage( PLOTTER* plotter, SCH_SCREEN* screen ); + + void PlotSchematic(); + + // PDF + void createPDFFile(); + void plotOneSheetPDF( PLOTTER* plotter, SCH_SCREEN* screen); + + // DXF + void CreateDXFFile(); + void PlotOneSheetDXF( const wxString& FileName, SCH_SCREEN* screen, + wxPoint plot_offset, double scale ); + + // HPGL + bool GetPlotOriginCenter() + { + return m_plotOriginOpt->GetSelection() == 1; + } + void SetPlotOriginCenter( bool aCenter ) + { + m_plotOriginOpt->SetSelection( aCenter ? 1 : 0 ); + } + void createHPGLFile( bool aPlotAll ); + void SetHPGLPenWidth(); + void Plot_1_Page_HPGL( const wxString& FileName, SCH_SCREEN* screen, + const PAGE_INFO& pageInfo, + wxPoint& offset, double plot_scale ); + + // PS + void createPSFile(); + void plotOneSheetPS( const wxString& FileName, SCH_SCREEN* screen, + const PAGE_INFO& pageInfo, + wxPoint plot_offset, double scale ); + + // SVG + void createSVGFile( bool aPrintAll, bool aPrint_Sheet_Ref ); +public: + // This function is static because it is called by libedit + // outside a dialog. + static bool plotOneSheetSVG( EDA_DRAW_FRAME* frame, const wxString& FullFileName, + SCH_SCREEN* screen, + bool aPrintBlackAndWhite, bool aPrint_Sheet_Ref ); +}; diff --git a/eeschema/dialogs/dialog_plot_schematic_DXF.cpp b/eeschema/dialogs/dialog_plot_schematic_DXF.cpp deleted file mode 100644 index 34fd693fbc..0000000000 --- a/eeschema/dialogs/dialog_plot_schematic_DXF.cpp +++ /dev/null @@ -1,258 +0,0 @@ -/** @file dialog_plot_schematic_DXF.cpp - */ - -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 1992-2010 Lorenzo Marcantonio - * Copyright (C) 1992-2010 KiCad Developers, see change_log.txt for contributors. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, you may find one here: - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * or you may search the http://www.gnu.org website for the version 2 license, - * or you may write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -class DIALOG_PLOT_SCHEMATIC_DXF : public DIALOG_PLOT_SCHEMATIC_DXF_BASE -{ -private: - SCH_EDIT_FRAME* m_Parent; - -public: - - /// Constructors - DIALOG_PLOT_SCHEMATIC_DXF( SCH_EDIT_FRAME* parent ); - -private: - static bool m_plotColorOpt; - static int m_pageSizeSelect; - static bool m_plot_Sheet_Ref; - bool m_select_PlotAll; -private: - void OnPlotCurrent( wxCommandEvent& event ); - void OnPlotAll( wxCommandEvent& event ); - void OnCancelClick( wxCommandEvent& event ); - - void initDlg(); - void initOptVars(); - void CreateDXFFile(); - void PlotOneSheetDXF( const wxString& FileName, SCH_SCREEN* screen, - wxPoint plot_offset, double scale ); -}; - -// static members (static to remember last state): -bool DIALOG_PLOT_SCHEMATIC_DXF::m_plotColorOpt = false; -bool DIALOG_PLOT_SCHEMATIC_DXF::m_plot_Sheet_Ref = true; - - - -void SCH_EDIT_FRAME::ToPlot_DXF( wxCommandEvent& event ) -{ - DIALOG_PLOT_SCHEMATIC_DXF DXF_frame( this ); - DXF_frame.ShowModal(); -} - - -DIALOG_PLOT_SCHEMATIC_DXF::DIALOG_PLOT_SCHEMATIC_DXF( SCH_EDIT_FRAME* parent ) - : DIALOG_PLOT_SCHEMATIC_DXF_BASE( parent ) -{ - m_Parent = parent; - m_select_PlotAll = false; - initDlg(); - - GetSizer()->SetSizeHints( this ); - Centre(); - m_buttonPlotAll->SetDefault(); -} - -void DIALOG_PLOT_SCHEMATIC_DXF::initDlg() -{ - SetFocus(); // make the ESC work - // Set options - m_PlotColorCtrl->SetSelection( m_plotColorOpt ? 1 : 0 ); - m_Plot_Sheet_Ref_Ctrl->SetValue( m_plot_Sheet_Ref ); -} - - -/* event handler for Plot Current button - */ -void DIALOG_PLOT_SCHEMATIC_DXF::OnPlotCurrent( wxCommandEvent& event ) -{ - m_select_PlotAll = false; - - initOptVars(); - CreateDXFFile( ); - m_MsgBox->AppendText( wxT( "*****\n" ) ); -} - -/* event handler for Plot ALL button - */ -void DIALOG_PLOT_SCHEMATIC_DXF::OnPlotAll( wxCommandEvent& event ) -{ - m_select_PlotAll = true; - - initOptVars(); - CreateDXFFile( ); - m_MsgBox->AppendText( wxT( "*****\n" ) ); -} - - -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL - */ -void DIALOG_PLOT_SCHEMATIC_DXF::OnCancelClick( wxCommandEvent& event ) -{ - initOptVars(); - EndModal( 0 ); -} - - -void DIALOG_PLOT_SCHEMATIC_DXF::initOptVars() -{ - m_plot_Sheet_Ref = m_Plot_Sheet_Ref_Ctrl->GetValue(); - m_plotColorOpt = m_PlotColorCtrl->GetSelection() == 1 ? true : false; -} - - -void DIALOG_PLOT_SCHEMATIC_DXF::CreateDXFFile( ) -{ - SCH_EDIT_FRAME* schframe = (SCH_EDIT_FRAME*) m_Parent; - SCH_SCREEN* screen = schframe->GetScreen(); - SCH_SHEET_PATH* sheetpath; - SCH_SHEET_PATH oldsheetpath = schframe->GetCurrentSheet(); - wxString plotFileName; - wxPoint plot_offset; - - /* When printing all pages, the printed page is not the current page. - * In complex hierarchies, we must setup references and others parameters - * in the printed SCH_SCREEN - * because in complex hierarchies a SCH_SCREEN (a schematic drawings) - * is shared between many sheets - */ - SCH_SHEET_LIST SheetList( NULL ); - - sheetpath = SheetList.GetFirst(); - SCH_SHEET_PATH list; - - while( true ) - { - if( m_select_PlotAll ) - { - if( sheetpath == NULL ) - break; - - list.Clear(); - - if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) ) - { - schframe->SetCurrentSheet( list ); - schframe->GetCurrentSheet().UpdateAllScreenReferences(); - schframe->SetSheetNumberAndCount(); - screen = schframe->GetCurrentSheet().LastScreen(); - } - else // Should not happen - { - return; - } - - sheetpath = SheetList.GetNext(); - } - - plot_offset.x = 0; - plot_offset.y = 0; - - plotFileName = schframe->GetUniqueFilenameForCurrentSheet() + wxT(".") - + DXF_PLOTTER::GetDefaultFileExtension(); - - PlotOneSheetDXF( plotFileName, screen, plot_offset, 1 ); - - if( !m_select_PlotAll ) - break; - } - - schframe->SetCurrentSheet( oldsheetpath ); - schframe->GetCurrentSheet().UpdateAllScreenReferences(); - schframe->SetSheetNumberAndCount(); -} - - -void DIALOG_PLOT_SCHEMATIC_DXF::PlotOneSheetDXF( const wxString& FileName, - SCH_SCREEN* screen, - wxPoint plot_offset, - double scale ) -{ - - - wxString msg; - FILE* output_file = wxFopen( FileName, wxT( "wt" ) ); - - if( output_file == NULL ) - { - msg = wxT( "\n** " ); - msg += _( "Unable to create " ) + FileName + wxT( " **\n" ); - m_MsgBox->AppendText( msg ); - return; - } - - msg.Printf( _( "Plot: %s " ), GetChars( FileName ) ); - m_MsgBox->AppendText( msg ); - - LOCALE_IO toggle; - - DXF_PLOTTER* plotter = new DXF_PLOTTER(); - - const PAGE_INFO& pageInfo = screen->GetPageSettings(); - plotter->SetPageSettings( pageInfo ); - plotter->SetColorMode( m_plotColorOpt ); - plotter->SetViewport( plot_offset, IU_PER_DECIMILS, scale, false ); - - // Init : - plotter->SetCreator( wxT( "Eeschema-DXF" ) ); - plotter->SetFilename( FileName ); - plotter->StartPlot( output_file ); - - if( m_plot_Sheet_Ref ) - { - plotter->SetColor( BLACK ); - PlotWorkSheet( plotter, m_Parent->GetTitleBlock(), - m_Parent->GetPageSettings(), - screen->m_ScreenNumber, screen->m_NumberOfScreens, - m_Parent->GetScreenDesc(), - screen->GetFileName() ); - } - - screen->Plot( plotter ); - - // finish - plotter->EndPlot(); - delete plotter; - - m_MsgBox->AppendText( wxT( "Ok\n" ) ); -} diff --git a/eeschema/dialogs/dialog_plot_schematic_DXF_base.cpp b/eeschema/dialogs/dialog_plot_schematic_DXF_base.cpp deleted file mode 100644 index c2d1ecb8bd..0000000000 --- a/eeschema/dialogs/dialog_plot_schematic_DXF_base.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Sep 8 2010) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#include "dialog_plot_schematic_DXF_base.h" - -/////////////////////////////////////////////////////////////////////////// - -DIALOG_PLOT_SCHEMATIC_DXF_BASE::DIALOG_PLOT_SCHEMATIC_DXF_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) -{ - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bmainSizer; - bmainSizer = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bupperSizer; - bupperSizer = new wxBoxSizer( wxHORIZONTAL ); - - - bupperSizer->Add( 10, 10, 0, wxEXPAND, 5 ); - - wxBoxSizer* sbSizerMiddle; - sbSizerMiddle = new wxBoxSizer( wxVERTICAL ); - - wxString m_PlotColorCtrlChoices[] = { _("B/W"), _("Color") }; - int m_PlotColorCtrlNChoices = sizeof( m_PlotColorCtrlChoices ) / sizeof( wxString ); - m_PlotColorCtrl = new wxRadioBox( this, wxID_ANY, _("Plot Mode:"), wxDefaultPosition, wxDefaultSize, m_PlotColorCtrlNChoices, m_PlotColorCtrlChoices, 1, wxRA_SPECIFY_COLS ); - m_PlotColorCtrl->SetSelection( 0 ); - sbSizerMiddle->Add( m_PlotColorCtrl, 0, wxALL|wxEXPAND, 5 ); - - m_Plot_Sheet_Ref_Ctrl = new wxCheckBox( this, wxID_ANY, _("Print page references"), wxDefaultPosition, wxDefaultSize, 0 ); - m_Plot_Sheet_Ref_Ctrl->SetValue(true); - sbSizerMiddle->Add( m_Plot_Sheet_Ref_Ctrl, 0, wxALL|wxEXPAND, 5 ); - - bupperSizer->Add( sbSizerMiddle, 1, wxEXPAND, 5 ); - - - bupperSizer->Add( 10, 10, 0, wxEXPAND, 5 ); - - wxBoxSizer* bbuttonsSizer; - bbuttonsSizer = new wxBoxSizer( wxVERTICAL ); - - m_buttonPlotPage = new wxButton( this, wxID_ANY, _("&Plot Page"), wxDefaultPosition, wxDefaultSize, 0 ); - bbuttonsSizer->Add( m_buttonPlotPage, 0, wxALL|wxEXPAND, 5 ); - - m_buttonPlotAll = new wxButton( this, wxID_ANY, _("Plot A&LL"), wxDefaultPosition, wxDefaultSize, 0 ); - bbuttonsSizer->Add( m_buttonPlotAll, 0, wxALL|wxEXPAND, 5 ); - - m_buttonClose = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); - bbuttonsSizer->Add( m_buttonClose, 0, wxALL|wxEXPAND, 5 ); - - bupperSizer->Add( bbuttonsSizer, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - bmainSizer->Add( bupperSizer, 0, wxEXPAND, 5 ); - - m_staticText1 = new wxStaticText( this, wxID_ANY, _("Messages :"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText1->Wrap( -1 ); - bmainSizer->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_MsgBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY ); - m_MsgBox->SetMinSize( wxSize( -1,150 ) ); - - bmainSizer->Add( m_MsgBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - this->SetSizer( bmainSizer ); - this->Layout(); - - this->Centre( wxBOTH ); - - // Connect Events - m_buttonPlotPage->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_DXF_BASE::OnPlotCurrent ), NULL, this ); - m_buttonPlotAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_DXF_BASE::OnPlotAll ), NULL, this ); - m_buttonClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_DXF_BASE::OnCancelClick ), NULL, this ); -} - -DIALOG_PLOT_SCHEMATIC_DXF_BASE::~DIALOG_PLOT_SCHEMATIC_DXF_BASE() -{ - // Disconnect Events - m_buttonPlotPage->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_DXF_BASE::OnPlotCurrent ), NULL, this ); - m_buttonPlotAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_DXF_BASE::OnPlotAll ), NULL, this ); - m_buttonClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_DXF_BASE::OnCancelClick ), NULL, this ); - -} diff --git a/eeschema/dialogs/dialog_plot_schematic_DXF_base.fbp b/eeschema/dialogs/dialog_plot_schematic_DXF_base.fbp deleted file mode 100644 index 3ffa900ca3..0000000000 --- a/eeschema/dialogs/dialog_plot_schematic_DXF_base.fbp +++ /dev/null @@ -1,546 +0,0 @@ - - - - - - C++ - 1 - source_name - 0 - UTF-8 - connect - dialog_plot_schematic_DXF_base - 1000 - none - 1 - dialog_plot_schematic_DXF - - . - - 1 - 1 - 0 - 0 - - - wxBOTH - - 1 - 1 - impl_virtual - - - - 0 - wxID_ANY - - - DIALOG_PLOT_SCHEMATIC_DXF_BASE - - 387,365 - wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - - Plot DXF - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bmainSizer - wxVERTICAL - none - - 5 - wxEXPAND - 0 - - - bupperSizer - wxHORIZONTAL - none - - 5 - wxEXPAND - 0 - - 10 - protected - 10 - - - - 5 - wxEXPAND - 1 - - - sbSizerMiddle - wxVERTICAL - none - - 5 - wxALL|wxEXPAND - 0 - - - "B/W" "Color" - - 1 - 1 - - - 0 - wxID_ANY - Plot Mode: - 1 - - - m_PlotColorCtrl - protected - - 0 - - wxRA_SPECIFY_COLS - - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - - 1 - - 1 - 1 - - - 0 - wxID_ANY - Print page references - - - m_Plot_Sheet_Ref_Ctrl - protected - - - - - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 0 - - 10 - protected - 10 - - - - 5 - wxALIGN_CENTER_VERTICAL - 1 - - - bbuttonsSizer - wxVERTICAL - none - - 5 - wxALL|wxEXPAND - 0 - - - - 1 - 0 - 1 - - - 0 - wxID_ANY - &Plot Page - - - m_buttonPlotPage - protected - - - - - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnPlotCurrent - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - - - 1 - 0 - 1 - - - 0 - wxID_ANY - Plot A&LL - - - m_buttonPlotAll - protected - - - - - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnPlotAll - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - - - 1 - 0 - 1 - - - 0 - wxID_CANCEL - Close - - - m_buttonClose - protected - - - - - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnCancelClick - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - - - 1 - 1 - - - 0 - wxID_ANY - Messages : - - - m_staticText1 - protected - - - - - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 1 - - - - 1 - 1 - - - 0 - wxID_ANY - - 0 - -1,150 - m_MsgBox - protected - - - wxTE_MULTILINE|wxTE_READONLY - - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eeschema/dialogs/dialog_plot_schematic_DXF_base.h b/eeschema/dialogs/dialog_plot_schematic_DXF_base.h deleted file mode 100644 index b842a88e83..0000000000 --- a/eeschema/dialogs/dialog_plot_schematic_DXF_base.h +++ /dev/null @@ -1,60 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Sep 8 2010) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#ifndef __dialog_plot_schematic_DXF_base__ -#define __dialog_plot_schematic_DXF_base__ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -/// Class DIALOG_PLOT_SCHEMATIC_DXF_BASE -/////////////////////////////////////////////////////////////////////////////// -class DIALOG_PLOT_SCHEMATIC_DXF_BASE : public wxDialog -{ - private: - - protected: - - wxRadioBox* m_PlotColorCtrl; - wxCheckBox* m_Plot_Sheet_Ref_Ctrl; - - wxButton* m_buttonPlotPage; - wxButton* m_buttonPlotAll; - wxButton* m_buttonClose; - wxStaticText* m_staticText1; - wxTextCtrl* m_MsgBox; - - // Virtual event handlers, overide them in your derived class - virtual void OnPlotCurrent( wxCommandEvent& event ) { event.Skip(); } - virtual void OnPlotAll( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } - - - public: - - DIALOG_PLOT_SCHEMATIC_DXF_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plot DXF"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 387,365 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); - ~DIALOG_PLOT_SCHEMATIC_DXF_BASE(); - -}; - -#endif //__dialog_plot_schematic_DXF_base__ diff --git a/eeschema/dialogs/dialog_plot_schematic_HPGL.cpp b/eeschema/dialogs/dialog_plot_schematic_HPGL.cpp deleted file mode 100644 index 630c55f300..0000000000 --- a/eeschema/dialogs/dialog_plot_schematic_HPGL.cpp +++ /dev/null @@ -1,420 +0,0 @@ -/** @file dialog_plot_schematic_HPGL.cpp - */ - -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 1992-2010 Jean-Pierre Charras -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - - -enum HPGL_PAGEZ_T -{ - PAGE_DEFAULT = 0, - PAGE_SIZE_A4, - PAGE_SIZE_A3, - PAGE_SIZE_A2, - PAGE_SIZE_A1, - PAGE_SIZE_A0, - PAGE_SIZE_A, - PAGE_SIZE_B, - PAGE_SIZE_C, - PAGE_SIZE_D, - PAGE_SIZE_E, -}; - - -static const wxChar* plot_sheet_list( HPGL_PAGEZ_T aSize ) -{ - const wxChar* ret; - - switch( aSize ) - { - default: - case PAGE_DEFAULT: ret = NULL; break; - case PAGE_SIZE_A4: ret = wxT( "A4" ); break; - case PAGE_SIZE_A3: ret = wxT( "A3" ); break; - case PAGE_SIZE_A2: ret = wxT( "A2" ); break; - case PAGE_SIZE_A1: ret = wxT( "A1" ); break; - case PAGE_SIZE_A0: ret = wxT( "A0" ); break; - case PAGE_SIZE_A: ret = wxT( "A" ); break; - case PAGE_SIZE_B: ret = wxT( "B" ); break; - case PAGE_SIZE_C: ret = wxT( "C" ); break; - case PAGE_SIZE_D: ret = wxT( "D" ); break; - case PAGE_SIZE_E: ret = wxT( "E" ); break; - } - - return ret; -}; - - -class DIALOG_PLOT_SCHEMATIC_HPGL : public DIALOG_PLOT_SCHEMATIC_HPGL_BASE -{ -private: - SCH_EDIT_FRAME* m_Parent; - -public: - DIALOG_PLOT_SCHEMATIC_HPGL( SCH_EDIT_FRAME* parent ); - -private: - static HPGL_PAGEZ_T s_pageSizeSelect; - static bool s_plot_Sheet_Ref; - static wxSize s_Offset; - - bool m_select_PlotAll; - -private: - void OnPageSelected( wxCommandEvent& event ); - void OnPlotCurrent( wxCommandEvent& event ); - void OnPlotAll( wxCommandEvent& event ); - void OnCancelClick( wxCommandEvent& event ); - void AcceptPlotOffset( wxCommandEvent& event ); - - void initDlg(); - void SetPenSpeed(); - void SetPenNum(); - void SetPenWidth(); - void SetPageOffsetValue(); - void HPGL_Plot( bool aPlotAll ); - void Plot_Schematic_HPGL( bool aPlotAll ); - - void Plot_1_Page_HPGL( const wxString& FileName, - SCH_SCREEN* screen, const PAGE_INFO& aPageInfo, - wxPoint& offset, double plot_scale ); -}; - - -// static members (static to remember last state): -HPGL_PAGEZ_T DIALOG_PLOT_SCHEMATIC_HPGL:: s_pageSizeSelect = PAGE_DEFAULT; -bool DIALOG_PLOT_SCHEMATIC_HPGL::s_plot_Sheet_Ref = true; -wxSize DIALOG_PLOT_SCHEMATIC_HPGL::s_Offset; - -void SCH_EDIT_FRAME::ToPlot_HPGL( wxCommandEvent& event ) -{ - DIALOG_PLOT_SCHEMATIC_HPGL dlg( this ); - dlg.ShowModal(); -} - - -DIALOG_PLOT_SCHEMATIC_HPGL::DIALOG_PLOT_SCHEMATIC_HPGL( SCH_EDIT_FRAME* parent ) : - DIALOG_PLOT_SCHEMATIC_HPGL_BASE( parent ) -{ - m_Parent = parent; - initDlg(); - SetPageOffsetValue(); - - GetSizer()->SetSizeHints( this ); - Centre(); - m_buttonPlotAll->SetDefault(); -} - - -void DIALOG_PLOT_SCHEMATIC_HPGL::initDlg() -{ - SetFocus(); // Make ESC key work - - // Set validators - m_SizeOption->SetSelection( s_pageSizeSelect ); - AddUnitSymbol( *m_penWidthTitle, g_UserUnit ); - PutValueInLocalUnits( *m_penWidthCtrl, g_HPGL_Pen_Descr. m_Pen_Diam ); - m_penSpeedCtrl->SetValue( g_HPGL_Pen_Descr. m_Pen_Speed ); - m_penNumCtrl->SetValue( g_HPGL_Pen_Descr. m_Pen_Num ); -} - - -void DIALOG_PLOT_SCHEMATIC_HPGL::OnPlotCurrent( wxCommandEvent& event ) -{ - HPGL_Plot( false ); -} - -void DIALOG_PLOT_SCHEMATIC_HPGL::OnPlotAll( wxCommandEvent& event ) -{ - HPGL_Plot( true ); -} - - -void DIALOG_PLOT_SCHEMATIC_HPGL::OnCancelClick( wxCommandEvent& event ) -{ - EndModal( 0 ); -} - - -void DIALOG_PLOT_SCHEMATIC_HPGL::SetPageOffsetValue() -{ - wxString msg; - - s_pageSizeSelect = (HPGL_PAGEZ_T) m_SizeOption->GetSelection(); - - if( s_pageSizeSelect != PAGE_DEFAULT ) - { - msg = ReturnStringFromValue( g_UserUnit, s_Offset.x ); - - m_PlotOrgPosition_X->SetValue( msg ); - - msg = ReturnStringFromValue( g_UserUnit, s_Offset.y ); - - m_PlotOrgPosition_Y->SetValue( msg ); - - m_PlotOrgPosition_X->Enable( true ); - m_PlotOrgPosition_Y->Enable( true ); - } - else - { - m_PlotOrgPosition_X->Enable( false ); - m_PlotOrgPosition_Y->Enable( false ); - } -} - - -void DIALOG_PLOT_SCHEMATIC_HPGL::AcceptPlotOffset( wxCommandEvent& event ) -{ - s_pageSizeSelect = (HPGL_PAGEZ_T) m_SizeOption->GetSelection(); - - if( s_pageSizeSelect != PAGE_DEFAULT ) - { - wxString msg = m_PlotOrgPosition_X->GetValue(); - - s_Offset.x = ReturnValueFromString( g_UserUnit, msg ); - - msg = m_PlotOrgPosition_Y->GetValue(); - - s_Offset.y = ReturnValueFromString( g_UserUnit, msg ); - } -} - - -void DIALOG_PLOT_SCHEMATIC_HPGL::SetPenWidth( ) -{ - g_HPGL_Pen_Descr.m_Pen_Diam = ReturnValueFromTextCtrl( *m_penWidthCtrl ); - - if( g_HPGL_Pen_Descr.m_Pen_Diam > 100 ) - g_HPGL_Pen_Descr.m_Pen_Diam = 100; - - if( g_HPGL_Pen_Descr.m_Pen_Diam < 1 ) - g_HPGL_Pen_Descr.m_Pen_Diam = 1; -} - - -void DIALOG_PLOT_SCHEMATIC_HPGL::SetPenSpeed( ) -{ - g_HPGL_Pen_Descr.m_Pen_Speed = m_penSpeedCtrl->GetValue(); - - if( g_HPGL_Pen_Descr.m_Pen_Speed > 40 ) - g_HPGL_Pen_Descr.m_Pen_Speed = 40; - - if( g_HPGL_Pen_Descr.m_Pen_Speed < 1 ) - g_HPGL_Pen_Descr.m_Pen_Speed = 1; -} - - -void DIALOG_PLOT_SCHEMATIC_HPGL::SetPenNum( ) -{ - g_HPGL_Pen_Descr.m_Pen_Num = m_penNumCtrl->GetValue(); - - if( g_HPGL_Pen_Descr.m_Pen_Num > 8 ) - g_HPGL_Pen_Descr.m_Pen_Num = 8; - - if( g_HPGL_Pen_Descr.m_Pen_Num < 1 ) - g_HPGL_Pen_Descr.m_Pen_Num = 1; -} - - -void DIALOG_PLOT_SCHEMATIC_HPGL::HPGL_Plot( bool aPlotAll ) -{ - SetPenWidth( ); - SetPenNum( ); - SetPenSpeed( ); - - if( s_pageSizeSelect != PAGE_DEFAULT ) - { - wxString msg = m_PlotOrgPosition_X->GetValue(); - - s_Offset.x = ReturnValueFromString( g_UserUnit, msg ); - - msg = m_PlotOrgPosition_Y->GetValue(); - - s_Offset.y = ReturnValueFromString( g_UserUnit, msg ); - } - - Plot_Schematic_HPGL( aPlotAll ); -} - - -void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_Schematic_HPGL( bool aPlotAll ) -{ - wxString plotFileName; - SCH_SCREEN* screen = m_Parent->GetScreen(); - SCH_SHEET_PATH* sheetpath; - SCH_SHEET_PATH oldsheetpath = m_Parent->GetCurrentSheet(); - - wxPoint plotOffset; - - /* When printing all pages, the printed page is not the current page. - * In complex hierarchies, we must setup references and other parameters - * in the printed SCH_SCREEN - * because in complex hierarchies a SCH_SCREEN (a schematic drawings) - * is shared between many sheets - */ - SCH_SHEET_LIST SheetList( NULL ); - - sheetpath = SheetList.GetFirst(); - SCH_SHEET_PATH list; - - while( true ) - { - if( aPlotAll ) - { - if( sheetpath == NULL ) - break; - - list.Clear(); - - if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) ) - { - m_Parent->SetCurrentSheet( list ); - m_Parent->GetCurrentSheet().UpdateAllScreenReferences(); - m_Parent->SetSheetNumberAndCount(); - - screen = m_Parent->GetCurrentSheet().LastScreen(); - - if( !screen ) // LastScreen() may return NULL - screen = m_Parent->GetScreen(); - } - else // Should not happen - return; - - sheetpath = SheetList.GetNext(); - } - - const PAGE_INFO& curPage = screen->GetPageSettings(); - - PAGE_INFO plotPage = curPage; - - // if plotting on a page size other than curPage - if( s_pageSizeSelect != PAGE_DEFAULT ) - plotPage.SetType( plot_sheet_list( s_pageSizeSelect ) ); - - // Calculation of conversion scales. - - // 10x because Eeschema works in mils, not deci-mils - double plot_scale = (double) plotPage.GetWidthMils() / curPage.GetWidthMils(); - - // Calculate offsets - plotOffset.x = -s_Offset.x; - plotOffset.y = -s_Offset.y; - - plotFileName = m_Parent->GetUniqueFilenameForCurrentSheet() + wxT(".") - + HPGL_PLOTTER::GetDefaultFileExtension(); - - LOCALE_IO toggle; - - Plot_1_Page_HPGL( plotFileName, screen, plotPage, plotOffset, plot_scale ); - - if( !aPlotAll ) - break; - } - - m_Parent->SetCurrentSheet( oldsheetpath ); - m_Parent->GetCurrentSheet().UpdateAllScreenReferences(); - m_Parent->SetSheetNumberAndCount(); -} - - -void DIALOG_PLOT_SCHEMATIC_HPGL::Plot_1_Page_HPGL( const wxString& FileName, - SCH_SCREEN* screen, - const PAGE_INFO& pageInfo, - wxPoint& offset, - double plot_scale ) -{ - wxString msg; - - FILE* output_file = wxFopen( FileName, wxT( "wt" ) ); - - if( output_file == NULL ) - { - msg = wxT( "\n** " ); - msg += _( "Unable to create " ) + FileName + wxT( " **\n" ); - m_MsgBox->AppendText( msg ); - wxBell(); - return; - } - - LOCALE_IO toggle; - - msg.Printf( _( "Plot: %s " ), FileName.GetData() ); - m_MsgBox->AppendText( msg ); - - HPGL_PLOTTER* plotter = new HPGL_PLOTTER(); - - plotter->SetPageSettings( pageInfo ); - plotter->SetViewport( offset, IU_PER_DECIMILS, plot_scale, false ); - - // Init : - plotter->SetCreator( wxT( "Eeschema-HPGL" ) ); - plotter->SetFilename( FileName ); - plotter->SetPenSpeed( g_HPGL_Pen_Descr.m_Pen_Speed ); - plotter->SetPenNumber( g_HPGL_Pen_Descr.m_Pen_Num ); - plotter->SetPenDiameter( g_HPGL_Pen_Descr.m_Pen_Diam ); - plotter->SetPenOverlap( g_HPGL_Pen_Descr.m_Pen_Diam / 2 ); - plotter->StartPlot( output_file ); - - plotter->SetColor( BLACK ); - - if( s_plot_Sheet_Ref ) - PlotWorkSheet( plotter, m_Parent->GetTitleBlock(), - m_Parent->GetPageSettings(), - screen->m_ScreenNumber, screen->m_NumberOfScreens, - m_Parent->GetScreenDesc(), - screen->GetFileName() ); - - screen->Plot( plotter ); - - plotter->EndPlot(); - delete plotter; - - m_MsgBox->AppendText( wxT( "Ok\n" ) ); -} - - -/* Event handler for page size option - */ -void DIALOG_PLOT_SCHEMATIC_HPGL::OnPageSelected( wxCommandEvent& event ) -{ - s_pageSizeSelect = (HPGL_PAGEZ_T) m_SizeOption->GetSelection(); - SetPageOffsetValue(); -} - - diff --git a/eeschema/dialogs/dialog_plot_schematic_HPGL_base.cpp b/eeschema/dialogs/dialog_plot_schematic_HPGL_base.cpp deleted file mode 100644 index b6eefa625b..0000000000 --- a/eeschema/dialogs/dialog_plot_schematic_HPGL_base.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Sep 8 2010) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#include "dialog_plot_schematic_HPGL_base.h" - -/////////////////////////////////////////////////////////////////////////// - -DIALOG_PLOT_SCHEMATIC_HPGL_BASE::DIALOG_PLOT_SCHEMATIC_HPGL_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) -{ - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bmainSizer; - bmainSizer = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bupperSizer; - bupperSizer = new wxBoxSizer( wxHORIZONTAL ); - - wxBoxSizer* bleftSizer; - bleftSizer = new wxBoxSizer( wxVERTICAL ); - - wxString m_SizeOptionChoices[] = { _("Schematic size"), _("Page size A4"), _("Page size A3"), _("Page size A2"), _("Page size A1"), _("Page size A0"), _("Page size A"), _("Page size B"), _("Page size C"), _("Page size D"), _("Page size E") }; - int m_SizeOptionNChoices = sizeof( m_SizeOptionChoices ) / sizeof( wxString ); - m_SizeOption = new wxRadioBox( this, wxID_ANY, _("Plot Page Size:"), wxDefaultPosition, wxDefaultSize, m_SizeOptionNChoices, m_SizeOptionChoices, 1, wxRA_SPECIFY_COLS ); - m_SizeOption->SetSelection( 1 ); - bleftSizer->Add( m_SizeOption, 0, wxALL|wxEXPAND, 5 ); - - m_Plot_Sheet_Ref_Ctrl = new wxCheckBox( this, wxID_ANY, _("Print page references"), wxDefaultPosition, wxDefaultSize, 0 ); - m_Plot_Sheet_Ref_Ctrl->SetValue(true); - bleftSizer->Add( m_Plot_Sheet_Ref_Ctrl, 0, wxALL|wxEXPAND, 5 ); - - bupperSizer->Add( bleftSizer, 1, wxEXPAND, 5 ); - - wxBoxSizer* sbSizerMiddle; - sbSizerMiddle = new wxBoxSizer( wxVERTICAL ); - - wxStaticBoxSizer* sbSizer1; - sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pen control:") ), wxVERTICAL ); - - m_penWidthTitle = new wxStaticText( this, wxID_ANY, _("Pen Width"), wxDefaultPosition, wxDefaultSize, 0 ); - m_penWidthTitle->Wrap( -1 ); - sbSizer1->Add( m_penWidthTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_penWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - sbSizer1->Add( m_penWidthCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - - m_penSpeedTitle = new wxStaticText( this, wxID_ANY, _("Pen Speed ( cm/s )"), wxDefaultPosition, wxDefaultSize, 0 ); - m_penSpeedTitle->Wrap( -1 ); - sbSizer1->Add( m_penSpeedTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_penSpeedCtrl = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 50, 20 ); - sbSizer1->Add( m_penSpeedCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - m_penNumTitle = new wxStaticText( this, wxID_ANY, _("Pen Number"), wxDefaultPosition, wxDefaultSize, 0 ); - m_penNumTitle->Wrap( -1 ); - sbSizer1->Add( m_penNumTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_penNumCtrl = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 8, 1 ); - sbSizer1->Add( m_penNumCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - sbSizerMiddle->Add( sbSizer1, 0, wxEXPAND|wxALL, 5 ); - - wxStaticBoxSizer* sbSizer2; - sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Page offset:") ), wxVERTICAL ); - - m_offsetXTitle = new wxStaticText( this, wxID_ANY, _("Plot Offset X"), wxDefaultPosition, wxDefaultSize, 0 ); - m_offsetXTitle->Wrap( -1 ); - sbSizer2->Add( m_offsetXTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_PlotOrgPosition_X = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - sbSizer2->Add( m_PlotOrgPosition_X, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - - m_offsetYTitle = new wxStaticText( this, wxID_ANY, _("Plot Offset Y"), wxDefaultPosition, wxDefaultSize, 0 ); - m_offsetYTitle->Wrap( -1 ); - sbSizer2->Add( m_offsetYTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_PlotOrgPosition_Y = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - sbSizer2->Add( m_PlotOrgPosition_Y, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - sbSizerMiddle->Add( sbSizer2, 1, wxEXPAND|wxALL, 5 ); - - bupperSizer->Add( sbSizerMiddle, 1, wxEXPAND, 5 ); - - - bupperSizer->Add( 10, 10, 0, 0, 5 ); - - wxBoxSizer* bbuttonsSizer; - bbuttonsSizer = new wxBoxSizer( wxVERTICAL ); - - m_buttonPlotPage = new wxButton( this, wxID_ANY, _("&Plot Page"), wxDefaultPosition, wxDefaultSize, 0 ); - bbuttonsSizer->Add( m_buttonPlotPage, 0, wxALL|wxEXPAND, 5 ); - - m_buttonPlotAll = new wxButton( this, wxID_ANY, _("Plot A&LL"), wxDefaultPosition, wxDefaultSize, 0 ); - bbuttonsSizer->Add( m_buttonPlotAll, 0, wxALL|wxEXPAND, 5 ); - - m_buttonClose = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); - bbuttonsSizer->Add( m_buttonClose, 0, wxALL|wxEXPAND, 5 ); - - - bbuttonsSizer->Add( 10, 10, 1, wxEXPAND, 5 ); - - m_buttonOffset = new wxButton( this, wxID_ANY, _("&Accept Offset"), wxDefaultPosition, wxDefaultSize, 0 ); - bbuttonsSizer->Add( m_buttonOffset, 0, wxALL, 5 ); - - bupperSizer->Add( bbuttonsSizer, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bmainSizer->Add( bupperSizer, 0, wxEXPAND, 5 ); - - m_staticText1 = new wxStaticText( this, wxID_ANY, _("Messages :"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText1->Wrap( -1 ); - bmainSizer->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_MsgBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY ); - m_MsgBox->SetMinSize( wxSize( -1,150 ) ); - - bmainSizer->Add( m_MsgBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - this->SetSizer( bmainSizer ); - this->Layout(); - - this->Centre( wxBOTH ); - - // Connect Events - m_SizeOption->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_HPGL_BASE::OnPageSelected ), NULL, this ); - m_buttonPlotPage->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_HPGL_BASE::OnPlotCurrent ), NULL, this ); - m_buttonPlotAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_HPGL_BASE::OnPlotAll ), NULL, this ); - m_buttonClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_HPGL_BASE::OnCancelClick ), NULL, this ); - m_buttonOffset->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_HPGL_BASE::AcceptPlotOffset ), NULL, this ); -} - -DIALOG_PLOT_SCHEMATIC_HPGL_BASE::~DIALOG_PLOT_SCHEMATIC_HPGL_BASE() -{ - // Disconnect Events - m_SizeOption->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_HPGL_BASE::OnPageSelected ), NULL, this ); - m_buttonPlotPage->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_HPGL_BASE::OnPlotCurrent ), NULL, this ); - m_buttonPlotAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_HPGL_BASE::OnPlotAll ), NULL, this ); - m_buttonClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_HPGL_BASE::OnCancelClick ), NULL, this ); - m_buttonOffset->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_HPGL_BASE::AcceptPlotOffset ), NULL, this ); - -} diff --git a/eeschema/dialogs/dialog_plot_schematic_HPGL_base.h b/eeschema/dialogs/dialog_plot_schematic_HPGL_base.h deleted file mode 100644 index a8e2dccb72..0000000000 --- a/eeschema/dialogs/dialog_plot_schematic_HPGL_base.h +++ /dev/null @@ -1,75 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Sep 8 2010) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#ifndef __dialog_plot_schematic_HPGL_base__ -#define __dialog_plot_schematic_HPGL_base__ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -/// Class DIALOG_PLOT_SCHEMATIC_HPGL_BASE -/////////////////////////////////////////////////////////////////////////////// -class DIALOG_PLOT_SCHEMATIC_HPGL_BASE : public wxDialog -{ - private: - - protected: - wxRadioBox* m_SizeOption; - wxCheckBox* m_Plot_Sheet_Ref_Ctrl; - wxStaticText* m_penWidthTitle; - wxTextCtrl* m_penWidthCtrl; - wxStaticText* m_penSpeedTitle; - wxSpinCtrl* m_penSpeedCtrl; - wxStaticText* m_penNumTitle; - wxSpinCtrl* m_penNumCtrl; - wxStaticText* m_offsetXTitle; - wxTextCtrl* m_PlotOrgPosition_X; - wxStaticText* m_offsetYTitle; - wxTextCtrl* m_PlotOrgPosition_Y; - - wxButton* m_buttonPlotPage; - wxButton* m_buttonPlotAll; - wxButton* m_buttonClose; - - wxButton* m_buttonOffset; - wxStaticText* m_staticText1; - wxTextCtrl* m_MsgBox; - - // Virtual event handlers, overide them in your derived class - virtual void OnPageSelected( wxCommandEvent& event ) { event.Skip(); } - virtual void OnPlotCurrent( wxCommandEvent& event ) { event.Skip(); } - virtual void OnPlotAll( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } - virtual void AcceptPlotOffset( wxCommandEvent& event ) { event.Skip(); } - - - public: - - DIALOG_PLOT_SCHEMATIC_HPGL_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plot HPGL"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 387,408 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); - ~DIALOG_PLOT_SCHEMATIC_HPGL_BASE(); - -}; - -#endif //__dialog_plot_schematic_HPGL_base__ diff --git a/eeschema/dialogs/dialog_plot_schematic_PDF.cpp b/eeschema/dialogs/dialog_plot_schematic_PDF.cpp deleted file mode 100644 index 831e3df641..0000000000 --- a/eeschema/dialogs/dialog_plot_schematic_PDF.cpp +++ /dev/null @@ -1,311 +0,0 @@ -/** @file dialog_plot_schematic_PDF.cpp - */ - -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 1992-2010 Jean-Pierre Charras -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - - -enum PageFormatReq { - PAGE_SIZE_AUTO, - PAGE_SIZE_A4, - PAGE_SIZE_A -}; - -#include - -class DIALOG_PLOT_SCHEMATIC_PDF : public DIALOG_PLOT_SCHEMATIC_PDF_BASE -{ -private: - SCH_EDIT_FRAME* m_Parent; - -public: - - /// Constructors - DIALOG_PLOT_SCHEMATIC_PDF( SCH_EDIT_FRAME* parent ); - -private: - static bool m_plotColorOpt; - static int m_pageSizeSelect; - static bool m_plot_Sheet_Ref; - bool m_select_PlotAll; -private: - void OnPlotCurrent( wxCommandEvent& event ); - void OnPlotAll( wxCommandEvent& event ); - void OnCancelClick( wxCommandEvent& event ); - - void initDlg(); - void initOptVars(); - void createPDFFile(); - void plotOneSheet( PDF_PLOTTER *plotter, SCH_SCREEN* screen ); - void plotSetupPage( PDF_PLOTTER *plotter, SCH_SCREEN* screen ); -}; - -// static members (static to remember last state): -bool DIALOG_PLOT_SCHEMATIC_PDF::m_plotColorOpt = false; -int DIALOG_PLOT_SCHEMATIC_PDF::m_pageSizeSelect = PAGE_SIZE_AUTO; -bool DIALOG_PLOT_SCHEMATIC_PDF::m_plot_Sheet_Ref = true; - - -void SCH_EDIT_FRAME::ToPlot_PDF( wxCommandEvent& event ) -{ - DIALOG_PLOT_SCHEMATIC_PDF dlg( this ); - - dlg.ShowModal(); -} - - -DIALOG_PLOT_SCHEMATIC_PDF::DIALOG_PLOT_SCHEMATIC_PDF( SCH_EDIT_FRAME* parent ) : - DIALOG_PLOT_SCHEMATIC_PDF_BASE( parent ) -{ - m_Parent = parent; - m_select_PlotAll = false; - initDlg(); - - GetSizer()->SetSizeHints( this ); - Centre(); - m_buttonPlotAll->SetDefault(); -} - - -/*! - * Control creation for DIALOG_PLOT_SCHEMATIC_PDF - */ - -void DIALOG_PLOT_SCHEMATIC_PDF::initDlg() -{ - SetFocus(); // make the ESC work - - // Set options - m_SizeOption->SetSelection( m_pageSizeSelect ); - m_PlotPDFColorOption->SetSelection( m_plotColorOpt ? 1 : 0 ); - m_Plot_Sheet_Ref_Ctrl->SetValue( m_plot_Sheet_Ref ); - - AddUnitSymbol( *m_defaultLineWidthTitle, g_UserUnit ); - PutValueInLocalUnits( *m_DefaultLineSizeCtrl, g_DrawDefaultLineThickness ); -} - - -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON - */ - -void DIALOG_PLOT_SCHEMATIC_PDF::OnPlotCurrent( wxCommandEvent& event ) -{ - m_select_PlotAll = false; - - initOptVars(); - createPDFFile(); - m_MsgBox->AppendText( wxT( "*\n" ) ); -} - - -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON1 - */ - -void DIALOG_PLOT_SCHEMATIC_PDF::OnPlotAll( wxCommandEvent& event ) -{ - m_select_PlotAll = true; - - initOptVars(); - createPDFFile(); - m_MsgBox->AppendText( wxT( "*\n" ) ); -} - - -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL - */ - -void DIALOG_PLOT_SCHEMATIC_PDF::OnCancelClick( wxCommandEvent& event ) -{ - initOptVars(); - EndModal( 0 ); -} - - -void DIALOG_PLOT_SCHEMATIC_PDF::initOptVars() -{ - m_plot_Sheet_Ref = m_Plot_Sheet_Ref_Ctrl->GetValue(); - m_plotColorOpt = m_PlotPDFColorOption->GetSelection(); - m_pageSizeSelect = m_SizeOption->GetSelection(); - g_DrawDefaultLineThickness = ReturnValueFromTextCtrl( *m_DefaultLineSizeCtrl ); - - if( g_DrawDefaultLineThickness < 1 ) - g_DrawDefaultLineThickness = 1; -} - - -void DIALOG_PLOT_SCHEMATIC_PDF::createPDFFile() -{ - SCH_SCREEN* screen = m_Parent->GetScreen(); - SCH_SHEET_PATH* sheetpath; - SCH_SHEET_PATH oldsheetpath = m_Parent->GetCurrentSheet(); // sheetpath is saved here - wxPoint plot_offset; - - /* When printing all pages, the printed page is not the current page. In - * complex hierarchies, we must update component references and others - * parameters in the given printed SCH_SCREEN, accordint to the sheet path - * because in complex hierarchies a SCH_SCREEN (a drawing ) is shared - * between many sheets and component references depend on the actual sheet - * path used - */ - SCH_SHEET_LIST SheetList( NULL ); - - sheetpath = SheetList.GetFirst(); - - // Allocate the plotter and set the job level parameter - PDF_PLOTTER* plotter = new PDF_PLOTTER(); - plotter->SetDefaultLineWidth( g_DrawDefaultLineThickness ); - plotter->SetColorMode( m_plotColorOpt ); - plotter->SetCreator( wxT( "Eeschema-PDF" ) ); - - // First page handling is different - bool first_page = true; - - do - { - // Step over the schematic hierarchy - if( m_select_PlotAll ) - { - SCH_SHEET_PATH list; - if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) ) - { - m_Parent->SetCurrentSheet( list ); - m_Parent->GetCurrentSheet().UpdateAllScreenReferences(); - m_Parent->SetSheetNumberAndCount(); - screen = m_Parent->GetCurrentSheet().LastScreen(); - } - else // Should not happen - wxASSERT( 0 ); - - sheetpath = SheetList.GetNext(); - } - - if( first_page ) { - wxString msg; - wxString plotFileName = m_Parent->GetUniqueFilenameForCurrentSheet() + wxT(".") - + PDF_PLOTTER::GetDefaultFileExtension(); - msg.Printf( _( "Plot: %s " ), GetChars( plotFileName ) ); - m_MsgBox->AppendText( msg ); - - FILE* output_file = wxFopen( plotFileName, wxT( "wb" ) ); - - if( output_file == NULL ) - { - msg = wxT( "\n** " ); - msg += _( "Unable to create " ) + plotFileName + wxT( " **\n" ); - m_MsgBox->AppendText( msg ); - wxBell(); - return; - } - // Open the plotter and do the first page - SetLocaleTo_C_standard(); - plotter->SetFilename( plotFileName ); - plotSetupPage( plotter, screen ); - plotter->StartPlot( output_file ); - first_page = false; - } - else - { - /* For the following pages you need to close the (finished) page, - reconfigure, and then start a new one */ - plotter->ClosePage(); - plotSetupPage( plotter, screen ); - plotter->StartPage(); - } - plotOneSheet( plotter, screen ); - } while (m_select_PlotAll && sheetpath ); - - // Everything done, close the plot and restore the environment - plotter->EndPlot(); - delete plotter; - SetLocaleTo_Default(); - - // Restore the previous sheet - m_Parent->SetCurrentSheet( oldsheetpath ); - m_Parent->GetCurrentSheet().UpdateAllScreenReferences(); - m_Parent->SetSheetNumberAndCount(); -} - -void DIALOG_PLOT_SCHEMATIC_PDF::plotSetupPage( PDF_PLOTTER* plotter, - SCH_SCREEN* screen) -{ - PAGE_INFO plotPage; // page size selected to plot - // Considerations on page size and scaling requests - PAGE_INFO actualPage = screen->GetPageSettings(); // page size selected in schematic - switch( m_pageSizeSelect ) - { - case PAGE_SIZE_A: - plotPage.SetType( wxT( "A" ) ); - plotPage.SetPortrait( actualPage.IsPortrait() ); - break; - - case PAGE_SIZE_A4: - plotPage.SetType( wxT( "A4" ) ); - plotPage.SetPortrait( actualPage.IsPortrait() ); - break; - - case PAGE_SIZE_AUTO: - default: - plotPage = actualPage; - break; - } - - double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils(); - double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils(); - double scale = MIN( scalex, scaley ); - plotter->SetPageSettings( plotPage ); - plotter->SetViewport( wxPoint( 0, 0 ), IU_PER_DECIMILS, scale, false ); -} - -void DIALOG_PLOT_SCHEMATIC_PDF::plotOneSheet( PDF_PLOTTER* plotter, - SCH_SCREEN* screen ) -{ - if( m_plot_Sheet_Ref ) - { - plotter->SetColor( BLACK ); - PlotWorkSheet( plotter, m_Parent->GetTitleBlock(), - m_Parent->GetPageSettings(), - screen->m_ScreenNumber, screen->m_NumberOfScreens, - m_Parent->GetScreenDesc(), - screen->GetFileName() ); - } - - screen->Plot( plotter ); -} - diff --git a/eeschema/dialogs/dialog_plot_schematic_PDF_base.cpp b/eeschema/dialogs/dialog_plot_schematic_PDF_base.cpp deleted file mode 100644 index 2a4d39d6f5..0000000000 --- a/eeschema/dialogs/dialog_plot_schematic_PDF_base.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 17 2010) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#include "dialog_plot_schematic_PDF_base.h" - -/////////////////////////////////////////////////////////////////////////// - -DIALOG_PLOT_SCHEMATIC_PDF_BASE::DIALOG_PLOT_SCHEMATIC_PDF_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) -{ - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bmainSizer; - bmainSizer = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bupperSizer; - bupperSizer = new wxBoxSizer( wxHORIZONTAL ); - - wxString m_SizeOptionChoices[] = { _("Schematic size"), _("Force size A4"), _("Force size A") }; - int m_SizeOptionNChoices = sizeof( m_SizeOptionChoices ) / sizeof( wxString ); - m_SizeOption = new wxRadioBox( this, wxID_ANY, _("Plot Page Size:"), wxDefaultPosition, wxDefaultSize, m_SizeOptionNChoices, m_SizeOptionChoices, 1, wxRA_SPECIFY_COLS ); - m_SizeOption->SetSelection( 0 ); - bupperSizer->Add( m_SizeOption, 1, wxALL, 5 ); - - - bupperSizer->Add( 10, 10, 0, wxEXPAND, 5 ); - - wxBoxSizer* sbSizerMiddle; - sbSizerMiddle = new wxBoxSizer( wxVERTICAL ); - - wxString m_PlotPDFColorOptionChoices[] = { _("B/W"), _("Color") }; - int m_PlotPDFColorOptionNChoices = sizeof( m_PlotPDFColorOptionChoices ) / sizeof( wxString ); - m_PlotPDFColorOption = new wxRadioBox( this, wxID_ANY, _("Plot Mode:"), wxDefaultPosition, wxDefaultSize, m_PlotPDFColorOptionNChoices, m_PlotPDFColorOptionChoices, 1, wxRA_SPECIFY_COLS ); - m_PlotPDFColorOption->SetSelection( 0 ); - sbSizerMiddle->Add( m_PlotPDFColorOption, 0, wxALL|wxEXPAND, 5 ); - - m_Plot_Sheet_Ref_Ctrl = new wxCheckBox( this, wxID_ANY, _("Print page references"), wxDefaultPosition, wxDefaultSize, 0 ); - m_Plot_Sheet_Ref_Ctrl->SetValue(true); - sbSizerMiddle->Add( m_Plot_Sheet_Ref_Ctrl, 0, wxALL|wxEXPAND, 5 ); - - bupperSizer->Add( sbSizerMiddle, 1, wxEXPAND, 5 ); - - - bupperSizer->Add( 10, 10, 0, wxEXPAND, 5 ); - - wxBoxSizer* bbuttonsSizer; - bbuttonsSizer = new wxBoxSizer( wxVERTICAL ); - - m_buttonPlotPage = new wxButton( this, wxID_ANY, _("&Plot Page"), wxDefaultPosition, wxDefaultSize, 0 ); - bbuttonsSizer->Add( m_buttonPlotPage, 0, wxALL|wxEXPAND, 5 ); - - m_buttonPlotAll = new wxButton( this, wxID_ANY, _("Plot A&LL"), wxDefaultPosition, wxDefaultSize, 0 ); - bbuttonsSizer->Add( m_buttonPlotAll, 0, wxALL|wxEXPAND, 5 ); - - m_buttonClose = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); - bbuttonsSizer->Add( m_buttonClose, 0, wxALL|wxEXPAND, 5 ); - - bupperSizer->Add( bbuttonsSizer, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bmainSizer->Add( bupperSizer, 0, wxEXPAND, 5 ); - - wxBoxSizer* bSizerLineWidth; - bSizerLineWidth = new wxBoxSizer( wxHORIZONTAL ); - - m_defaultLineWidthTitle = new wxStaticText( this, wxID_ANY, _("Default line width:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_defaultLineWidthTitle->Wrap( -1 ); - bSizerLineWidth->Add( m_defaultLineWidthTitle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - m_DefaultLineSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bSizerLineWidth->Add( m_DefaultLineSizeCtrl, 1, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 ); - - bmainSizer->Add( bSizerLineWidth, 0, wxEXPAND, 5 ); - - m_staticText1 = new wxStaticText( this, wxID_ANY, _("Messages :"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText1->Wrap( -1 ); - bmainSizer->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_MsgBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY ); - m_MsgBox->SetMinSize( wxSize( -1,150 ) ); - - bmainSizer->Add( m_MsgBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - this->SetSizer( bmainSizer ); - this->Layout(); - - this->Centre( wxBOTH ); - - // Connect Events - m_buttonPlotPage->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PDF_BASE::OnPlotCurrent ), NULL, this ); - m_buttonPlotAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PDF_BASE::OnPlotAll ), NULL, this ); - m_buttonClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PDF_BASE::OnCancelClick ), NULL, this ); -} - -DIALOG_PLOT_SCHEMATIC_PDF_BASE::~DIALOG_PLOT_SCHEMATIC_PDF_BASE() -{ - // Disconnect Events - m_buttonPlotPage->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PDF_BASE::OnPlotCurrent ), NULL, this ); - m_buttonPlotAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PDF_BASE::OnPlotAll ), NULL, this ); - m_buttonClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PDF_BASE::OnCancelClick ), NULL, this ); - -} diff --git a/eeschema/dialogs/dialog_plot_schematic_PDF_base.fbp b/eeschema/dialogs/dialog_plot_schematic_PDF_base.fbp deleted file mode 100644 index 2136619e1d..0000000000 --- a/eeschema/dialogs/dialog_plot_schematic_PDF_base.fbp +++ /dev/null @@ -1,1041 +0,0 @@ - - - - - - C++ - 1 - source_name - 0 - UTF-8 - connect - dialog_plot_schematic_PDF_base - 1000 - none - 1 - dialog_plot_schematic_PDF - - . - - 1 - 1 - 0 - 0 - - 1 - 1 - 1 - 1 - 0 - - - - 1 - wxBOTH - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - impl_virtual - - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - 1 - DIALOG_PLOT_SCHEMATIC_PDF_BASE - 1 - - - 1 - - - Resizable - - 1 - 387,365 - wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - - Plot PDF - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bmainSizer - wxVERTICAL - none - - 5 - wxEXPAND - 0 - - - bupperSizer - wxHORIZONTAL - none - - 5 - wxALL - 1 - - 1 - 1 - 1 - 1 - - - - 1 - 0 - "Schematic size" "Force size A4" "Force size A" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Plot Page Size: - - 1 - 0 - - 0 - - 1 - m_SizeOption - 1 - - - protected - 1 - - - Resizable - - 0 - 1 - - wxRA_SPECIFY_COLS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 0 - - 10 - protected - 10 - - - - 5 - wxEXPAND - 1 - - - sbSizerMiddle - wxVERTICAL - none - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - 1 - 0 - "B/W" "Color" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Plot Mode: - - 1 - 0 - - 0 - - 1 - m_PlotPDFColorOption - 1 - - - protected - 1 - - - Resizable - - 0 - 1 - - wxRA_SPECIFY_COLS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - 1 - 0 - 1 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Print page references - - 0 - - 0 - - 1 - m_Plot_Sheet_Ref_Ctrl - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 0 - - 10 - protected - 10 - - - - 5 - wxALIGN_CENTER_VERTICAL - 0 - - - bbuttonsSizer - wxVERTICAL - none - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - &Plot Page - - 0 - - 0 - - 1 - m_buttonPlotPage - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnPlotCurrent - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Plot A&LL - - 0 - - 0 - - 1 - m_buttonPlotAll - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnPlotAll - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_CANCEL - Close - - 0 - - 0 - - 1 - m_buttonClose - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnCancelClick - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 0 - - - bSizerLineWidth - wxHORIZONTAL - none - - 5 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Default line width: - - 0 - - 0 - - 1 - m_defaultLineWidthTitle - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL - 1 - - 1 - 1 - 1 - 1 - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - 0 - - 1 - m_DefaultLineSizeCtrl - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Messages : - - 0 - - 0 - - 1 - m_staticText1 - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 1 - - 1 - 1 - 1 - 1 - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - 0 - -1,150 - 1 - m_MsgBox - 1 - - - protected - 1 - - - Resizable - - 1 - - wxTE_MULTILINE|wxTE_READONLY - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eeschema/dialogs/dialog_plot_schematic_PDF_base.h b/eeschema/dialogs/dialog_plot_schematic_PDF_base.h deleted file mode 100644 index dc015e42d0..0000000000 --- a/eeschema/dialogs/dialog_plot_schematic_PDF_base.h +++ /dev/null @@ -1,63 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 17 2010) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#ifndef __dialog_plot_schematic_PDF_base__ -#define __dialog_plot_schematic_PDF_base__ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -/// 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__ diff --git a/eeschema/dialogs/dialog_plot_schematic_PS.cpp b/eeschema/dialogs/dialog_plot_schematic_PS.cpp deleted file mode 100644 index 902e30d5d7..0000000000 --- a/eeschema/dialogs/dialog_plot_schematic_PS.cpp +++ /dev/null @@ -1,311 +0,0 @@ -/** @file dialog_plot_schematic_PS.cpp - */ - -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 1992-2010 Jean-Pierre Charras -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - - -enum PageFormatReq { - PAGE_SIZE_AUTO, - PAGE_SIZE_A4, - PAGE_SIZE_A -}; - -#include - -class DIALOG_PLOT_SCHEMATIC_PS : public DIALOG_PLOT_SCHEMATIC_PS_BASE -{ -private: - SCH_EDIT_FRAME* m_Parent; - -public: - - /// Constructors - DIALOG_PLOT_SCHEMATIC_PS( SCH_EDIT_FRAME* parent ); - -private: - static bool m_plotColorOpt; - static int m_pageSizeSelect; - static bool m_plot_Sheet_Ref; - bool m_select_PlotAll; -private: - void OnPlotCurrent( wxCommandEvent& event ); - void OnPlotAll( wxCommandEvent& event ); - void OnCancelClick( wxCommandEvent& event ); - - void initDlg(); - void initOptVars(); - void createPSFile(); - void plotOneSheetPS( const wxString& FileName, - SCH_SCREEN* screen, const PAGE_INFO& pageInfo, - wxPoint plot_offset, double scale ); -}; - -// static members (static to remember last state): -bool DIALOG_PLOT_SCHEMATIC_PS::m_plotColorOpt = false; -int DIALOG_PLOT_SCHEMATIC_PS::m_pageSizeSelect = PAGE_SIZE_AUTO; -bool DIALOG_PLOT_SCHEMATIC_PS::m_plot_Sheet_Ref = true; - - -void SCH_EDIT_FRAME::ToPlot_PS( wxCommandEvent& event ) -{ - DIALOG_PLOT_SCHEMATIC_PS dlg( this ); - - dlg.ShowModal(); -} - - -DIALOG_PLOT_SCHEMATIC_PS::DIALOG_PLOT_SCHEMATIC_PS( SCH_EDIT_FRAME* parent ) : - DIALOG_PLOT_SCHEMATIC_PS_BASE( parent ) -{ - m_Parent = parent; - m_select_PlotAll = false; - initDlg(); - - GetSizer()->SetSizeHints( this ); - Centre(); - m_buttonPlotAll->SetDefault(); -} - - -/*! - * Control creation for DIALOG_PLOT_SCHEMATIC_PS - */ - -void DIALOG_PLOT_SCHEMATIC_PS::initDlg() -{ - SetFocus(); // make the ESC work - - // Set options - m_SizeOption->SetSelection( m_pageSizeSelect ); - m_PlotPSColorOption->SetSelection( m_plotColorOpt ? 1 : 0 ); - m_Plot_Sheet_Ref_Ctrl->SetValue( m_plot_Sheet_Ref ); - - AddUnitSymbol( *m_defaultLineWidthTitle, g_UserUnit ); - PutValueInLocalUnits( *m_DefaultLineSizeCtrl, g_DrawDefaultLineThickness ); -} - - -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON - */ - -void DIALOG_PLOT_SCHEMATIC_PS::OnPlotCurrent( wxCommandEvent& event ) -{ - m_select_PlotAll = false; - - initOptVars(); - createPSFile(); - m_MsgBox->AppendText( wxT( "*****\n" ) ); -} - - -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON1 - */ - -void DIALOG_PLOT_SCHEMATIC_PS::OnPlotAll( wxCommandEvent& event ) -{ - m_select_PlotAll = true; - - initOptVars(); - createPSFile(); - m_MsgBox->AppendText( wxT( "*****\n" ) ); -} - - -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL - */ - -void DIALOG_PLOT_SCHEMATIC_PS::OnCancelClick( wxCommandEvent& event ) -{ - initOptVars(); - EndModal( 0 ); -} - - -void DIALOG_PLOT_SCHEMATIC_PS::initOptVars() -{ - m_plot_Sheet_Ref = m_Plot_Sheet_Ref_Ctrl->GetValue(); - m_plotColorOpt = m_PlotPSColorOption->GetSelection(); - m_pageSizeSelect = m_SizeOption->GetSelection(); - g_DrawDefaultLineThickness = ReturnValueFromTextCtrl( *m_DefaultLineSizeCtrl ); - - if( g_DrawDefaultLineThickness < 1 ) - g_DrawDefaultLineThickness = 1; -} - - -void DIALOG_PLOT_SCHEMATIC_PS::createPSFile() -{ - SCH_SCREEN* screen = m_Parent->GetScreen(); - SCH_SHEET_PATH* sheetpath; - SCH_SHEET_PATH oldsheetpath = m_Parent->GetCurrentSheet(); // sheetpath is saved here - wxString plotFileName; - PAGE_INFO actualPage; // page size selected in schematic - PAGE_INFO plotPage; // page size selected to plot - wxPoint plot_offset; - - /* When printing all pages, the printed page is not the current page. - * In complex hierarchies, we must update component references - * and others parameters in the given printed SCH_SCREEN, accordint to the sheet path - * because in complex hierarchies a SCH_SCREEN (a drawing ) - * is shared between many sheets and component references depend on the actual sheet path used - */ - SCH_SHEET_LIST SheetList( NULL ); - - sheetpath = SheetList.GetFirst(); - SCH_SHEET_PATH list; - - while( true ) - { - if( m_select_PlotAll ) - { - if( sheetpath == NULL ) - break; - - list.Clear(); - - if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) ) - { - m_Parent->SetCurrentSheet( list ); - m_Parent->GetCurrentSheet().UpdateAllScreenReferences(); - m_Parent->SetSheetNumberAndCount(); - screen = m_Parent->GetCurrentSheet().LastScreen(); - } - else // Should not happen - return; - - sheetpath = SheetList.GetNext(); - } - - actualPage = screen->GetPageSettings(); - - switch( m_pageSizeSelect ) - { - case PAGE_SIZE_A: - plotPage.SetType( wxT( "A" ) ); - plotPage.SetPortrait( actualPage.IsPortrait() ); - break; - - case PAGE_SIZE_A4: - plotPage.SetType( wxT( "A4" ) ); - plotPage.SetPortrait( actualPage.IsPortrait() ); - break; - - case PAGE_SIZE_AUTO: - default: - plotPage = actualPage; - break; - } - - double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils(); - double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils(); - - double scale = MIN( scalex, scaley ); - - plot_offset.x = 0; - plot_offset.y = 0; - - plotFileName = m_Parent->GetUniqueFilenameForCurrentSheet() + wxT(".") - + PS_PLOTTER::GetDefaultFileExtension(); - - plotOneSheetPS( plotFileName, screen, plotPage, plot_offset, scale ); - - if( !m_select_PlotAll ) - break; - } - - m_Parent->SetCurrentSheet( oldsheetpath ); - m_Parent->GetCurrentSheet().UpdateAllScreenReferences(); - m_Parent->SetSheetNumberAndCount(); -} - - -void DIALOG_PLOT_SCHEMATIC_PS::plotOneSheetPS( const wxString& FileName, - SCH_SCREEN* screen, - const PAGE_INFO& pageInfo, - wxPoint plot_offset, - double scale ) -{ - wxString msg; - - FILE* output_file = wxFopen( FileName, wxT( "wt" ) ); - - if( output_file == NULL ) - { - msg = wxT( "\n** " ); - msg += _( "Unable to create " ) + FileName + wxT( " **\n" ); - m_MsgBox->AppendText( msg ); - wxBell(); - return; - } - - SetLocaleTo_C_standard(); - msg.Printf( _( "Plot: %s " ), GetChars( FileName ) ); - m_MsgBox->AppendText( msg ); - - PS_PLOTTER* plotter = new PS_PLOTTER(); - plotter->SetPageSettings( pageInfo ); - plotter->SetDefaultLineWidth( g_DrawDefaultLineThickness ); - plotter->SetColorMode( m_plotColorOpt ); - plotter->SetViewport( plot_offset, IU_PER_DECIMILS, scale, false ); - - // Init : - plotter->SetCreator( wxT( "Eeschema-PS" ) ); - plotter->SetFilename( FileName ); - plotter->StartPlot( output_file ); - - if( m_plot_Sheet_Ref ) - { - plotter->SetColor( BLACK ); - PlotWorkSheet( plotter, m_Parent->GetTitleBlock(), - m_Parent->GetPageSettings(), - screen->m_ScreenNumber, screen->m_NumberOfScreens, - m_Parent->GetScreenDesc(), - screen->GetFileName() ); - } - - screen->Plot( plotter ); - - plotter->EndPlot(); - delete plotter; - SetLocaleTo_Default(); - - m_MsgBox->AppendText( wxT( "Ok\n" ) ); -} diff --git a/eeschema/dialogs/dialog_plot_schematic_PS_base.cpp b/eeschema/dialogs/dialog_plot_schematic_PS_base.cpp deleted file mode 100644 index f00e8b19cf..0000000000 --- a/eeschema/dialogs/dialog_plot_schematic_PS_base.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 17 2010) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#include "dialog_plot_schematic_PS_base.h" - -/////////////////////////////////////////////////////////////////////////// - -DIALOG_PLOT_SCHEMATIC_PS_BASE::DIALOG_PLOT_SCHEMATIC_PS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) -{ - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bmainSizer; - bmainSizer = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* bupperSizer; - bupperSizer = new wxBoxSizer( wxHORIZONTAL ); - - wxString m_SizeOptionChoices[] = { _("Schematic size"), _("Force size A4"), _("Force size A") }; - int m_SizeOptionNChoices = sizeof( m_SizeOptionChoices ) / sizeof( wxString ); - m_SizeOption = new wxRadioBox( this, wxID_ANY, _("Plot Page Size:"), wxDefaultPosition, wxDefaultSize, m_SizeOptionNChoices, m_SizeOptionChoices, 1, wxRA_SPECIFY_COLS ); - m_SizeOption->SetSelection( 0 ); - bupperSizer->Add( m_SizeOption, 1, wxALL, 5 ); - - - bupperSizer->Add( 10, 10, 0, wxEXPAND, 5 ); - - wxBoxSizer* sbSizerMiddle; - sbSizerMiddle = new wxBoxSizer( wxVERTICAL ); - - wxString m_PlotPSColorOptionChoices[] = { _("B/W"), _("Color") }; - int m_PlotPSColorOptionNChoices = sizeof( m_PlotPSColorOptionChoices ) / sizeof( wxString ); - m_PlotPSColorOption = new wxRadioBox( this, wxID_ANY, _("Plot Mode:"), wxDefaultPosition, wxDefaultSize, m_PlotPSColorOptionNChoices, m_PlotPSColorOptionChoices, 1, wxRA_SPECIFY_COLS ); - m_PlotPSColorOption->SetSelection( 0 ); - sbSizerMiddle->Add( m_PlotPSColorOption, 0, wxALL|wxEXPAND, 5 ); - - m_Plot_Sheet_Ref_Ctrl = new wxCheckBox( this, wxID_ANY, _("Print page references"), wxDefaultPosition, wxDefaultSize, 0 ); - m_Plot_Sheet_Ref_Ctrl->SetValue(true); - sbSizerMiddle->Add( m_Plot_Sheet_Ref_Ctrl, 0, wxALL|wxEXPAND, 5 ); - - bupperSizer->Add( sbSizerMiddle, 1, wxEXPAND, 5 ); - - - bupperSizer->Add( 10, 10, 0, wxEXPAND, 5 ); - - wxBoxSizer* bbuttonsSizer; - bbuttonsSizer = new wxBoxSizer( wxVERTICAL ); - - m_buttonPlotPage = new wxButton( this, wxID_ANY, _("&Plot Page"), wxDefaultPosition, wxDefaultSize, 0 ); - bbuttonsSizer->Add( m_buttonPlotPage, 0, wxALL|wxEXPAND, 5 ); - - m_buttonPlotAll = new wxButton( this, wxID_ANY, _("Plot A&LL"), wxDefaultPosition, wxDefaultSize, 0 ); - bbuttonsSizer->Add( m_buttonPlotAll, 0, wxALL|wxEXPAND, 5 ); - - m_buttonClose = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); - bbuttonsSizer->Add( m_buttonClose, 0, wxALL|wxEXPAND, 5 ); - - bupperSizer->Add( bbuttonsSizer, 0, wxALIGN_CENTER_VERTICAL, 5 ); - - bmainSizer->Add( bupperSizer, 0, wxEXPAND, 5 ); - - wxBoxSizer* bSizerLineWidth; - bSizerLineWidth = new wxBoxSizer( wxHORIZONTAL ); - - m_defaultLineWidthTitle = new wxStaticText( this, wxID_ANY, _("Default line width:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_defaultLineWidthTitle->Wrap( -1 ); - bSizerLineWidth->Add( m_defaultLineWidthTitle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - - m_DefaultLineSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bSizerLineWidth->Add( m_DefaultLineSizeCtrl, 1, wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 ); - - bmainSizer->Add( bSizerLineWidth, 0, wxEXPAND, 5 ); - - m_staticText1 = new wxStaticText( this, wxID_ANY, _("Messages :"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText1->Wrap( -1 ); - bmainSizer->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_MsgBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY ); - m_MsgBox->SetMinSize( wxSize( -1,150 ) ); - - bmainSizer->Add( m_MsgBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - this->SetSizer( bmainSizer ); - this->Layout(); - - this->Centre( wxBOTH ); - - // Connect Events - m_buttonPlotPage->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PS_BASE::OnPlotCurrent ), NULL, this ); - m_buttonPlotAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PS_BASE::OnPlotAll ), NULL, this ); - m_buttonClose->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PS_BASE::OnCancelClick ), NULL, this ); -} - -DIALOG_PLOT_SCHEMATIC_PS_BASE::~DIALOG_PLOT_SCHEMATIC_PS_BASE() -{ - // Disconnect Events - m_buttonPlotPage->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PS_BASE::OnPlotCurrent ), NULL, this ); - m_buttonPlotAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PS_BASE::OnPlotAll ), NULL, this ); - m_buttonClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_PS_BASE::OnCancelClick ), NULL, this ); - -} diff --git a/eeschema/dialogs/dialog_plot_schematic_PS_base.fbp b/eeschema/dialogs/dialog_plot_schematic_PS_base.fbp deleted file mode 100644 index c44b79a900..0000000000 --- a/eeschema/dialogs/dialog_plot_schematic_PS_base.fbp +++ /dev/null @@ -1,1041 +0,0 @@ - - - - - - C++ - 1 - source_name - 0 - UTF-8 - connect - dialog_plot_schematic_PS_base - 1000 - none - 1 - dialog_plot_schematic_PS - - . - - 1 - 1 - 0 - 0 - - 1 - 1 - 1 - 1 - 0 - - - - 1 - wxBOTH - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - impl_virtual - - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - - 1 - DIALOG_PLOT_SCHEMATIC_PS_BASE - 1 - - - 1 - - - Resizable - - 1 - 387,365 - wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - - Plot PostScript - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bmainSizer - wxVERTICAL - none - - 5 - wxEXPAND - 0 - - - bupperSizer - wxHORIZONTAL - none - - 5 - wxALL - 1 - - 1 - 1 - 1 - 1 - - - - 1 - 0 - "Schematic size" "Force size A4" "Force size A" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Plot Page Size: - - 1 - 0 - - 0 - - 1 - m_SizeOption - 1 - - - protected - 1 - - - Resizable - - 0 - 1 - - wxRA_SPECIFY_COLS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 0 - - 10 - protected - 10 - - - - 5 - wxEXPAND - 1 - - - sbSizerMiddle - wxVERTICAL - none - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - 1 - 0 - "B/W" "Color" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Plot Mode: - - 1 - 0 - - 0 - - 1 - m_PlotPSColorOption - 1 - - - protected - 1 - - - Resizable - - 0 - 1 - - wxRA_SPECIFY_COLS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - 1 - 0 - 1 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Print page references - - 0 - - 0 - - 1 - m_Plot_Sheet_Ref_Ctrl - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 0 - - 10 - protected - 10 - - - - 5 - wxALIGN_CENTER_VERTICAL - 0 - - - bbuttonsSizer - wxVERTICAL - none - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - &Plot Page - - 0 - - 0 - - 1 - m_buttonPlotPage - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnPlotCurrent - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Plot A&LL - - 0 - - 0 - - 1 - m_buttonPlotAll - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnPlotAll - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_CANCEL - Close - - 0 - - 0 - - 1 - m_buttonClose - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnCancelClick - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 0 - - - bSizerLineWidth - wxHORIZONTAL - none - - 5 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Default line width: - - 0 - - 0 - - 1 - m_defaultLineWidthTitle - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL - 1 - - 1 - 1 - 1 - 1 - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - 0 - - 1 - m_DefaultLineSizeCtrl - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Messages : - - 0 - - 0 - - 1 - m_staticText1 - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 1 - - 1 - 1 - 1 - 1 - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 0 - 0 - -1,150 - 1 - m_MsgBox - 1 - - - protected - 1 - - - Resizable - - 1 - - wxTE_MULTILINE|wxTE_READONLY - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/eeschema/dialogs/dialog_plot_schematic_PS_base.h b/eeschema/dialogs/dialog_plot_schematic_PS_base.h deleted file mode 100644 index f612da5eff..0000000000 --- a/eeschema/dialogs/dialog_plot_schematic_PS_base.h +++ /dev/null @@ -1,63 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 17 2010) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#ifndef __dialog_plot_schematic_PS_base__ -#define __dialog_plot_schematic_PS_base__ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -/// Class DIALOG_PLOT_SCHEMATIC_PS_BASE -/////////////////////////////////////////////////////////////////////////////// -class DIALOG_PLOT_SCHEMATIC_PS_BASE : public wxDialog -{ - private: - - protected: - wxRadioBox* m_SizeOption; - - wxRadioBox* m_PlotPSColorOption; - wxCheckBox* m_Plot_Sheet_Ref_Ctrl; - - wxButton* m_buttonPlotPage; - wxButton* m_buttonPlotAll; - wxButton* m_buttonClose; - wxStaticText* m_defaultLineWidthTitle; - wxTextCtrl* m_DefaultLineSizeCtrl; - wxStaticText* m_staticText1; - wxTextCtrl* m_MsgBox; - - // Virtual event handlers, overide them in your derived class - virtual void OnPlotCurrent( wxCommandEvent& event ) { event.Skip(); } - virtual void OnPlotAll( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } - - - public: - - DIALOG_PLOT_SCHEMATIC_PS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plot PostScript"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 387,365 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); - ~DIALOG_PLOT_SCHEMATIC_PS_BASE(); - -}; - -#endif //__dialog_plot_schematic_PS_base__ diff --git a/eeschema/dialogs/dialog_plot_schematic_base.cpp b/eeschema/dialogs/dialog_plot_schematic_base.cpp new file mode 100644 index 0000000000..bdb7b94b50 --- /dev/null +++ b/eeschema/dialogs/dialog_plot_schematic_base.cpp @@ -0,0 +1,152 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Apr 10 2012) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_plot_schematic_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_PLOT_SCHEMATIC_BASE::DIALOG_PLOT_SCHEMATIC_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize ); + + wxBoxSizer* bMainSizer; + bMainSizer = new wxBoxSizer( wxVERTICAL ); + + m_optionsSizer = new wxBoxSizer( wxHORIZONTAL ); + + m_paperOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Paper Options") ), wxVERTICAL ); + + wxString m_PaperSizeOptionChoices[] = { _("Schematic size"), _("Force size A4"), _("Force size A") }; + int m_PaperSizeOptionNChoices = sizeof( m_PaperSizeOptionChoices ) / sizeof( wxString ); + m_PaperSizeOption = new wxRadioBox( this, wxID_ANY, _("Plot Page Size:"), wxDefaultPosition, wxDefaultSize, m_PaperSizeOptionNChoices, m_PaperSizeOptionChoices, 1, wxRA_SPECIFY_COLS ); + m_PaperSizeOption->SetSelection( 0 ); + m_paperOptionsSizer->Add( m_PaperSizeOption, 0, wxALL|wxEXPAND, 5 ); + + m_paperHPGLSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("HPGL Options:") ), wxVERTICAL ); + + m_staticText4 = new wxStaticText( this, wxID_ANY, _("Plot Page Size:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText4->Wrap( -1 ); + m_paperHPGLSizer->Add( m_staticText4, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + wxString m_HPGLPaperSizeOptionChoices[] = { _("Schematic size"), _("Page size A4"), _("Page size A3"), _("Page size A2"), _("Page size A1"), _("Page size A0"), _("Page size A"), _("Page size B"), _("Page size C"), _("Page size D"), _("Page size E") }; + int m_HPGLPaperSizeOptionNChoices = sizeof( m_HPGLPaperSizeOptionChoices ) / sizeof( wxString ); + m_HPGLPaperSizeOption = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_HPGLPaperSizeOptionNChoices, m_HPGLPaperSizeOptionChoices, 0 ); + m_HPGLPaperSizeOption->SetSelection( 0 ); + m_paperHPGLSizer->Add( m_HPGLPaperSizeOption, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + + wxString m_plotOriginOptChoices[] = { _("Bottom left corner"), _("Center of the page") }; + int m_plotOriginOptNChoices = sizeof( m_plotOriginOptChoices ) / sizeof( wxString ); + m_plotOriginOpt = new wxRadioBox( this, wxID_ANY, _("Plot Origin:"), wxDefaultPosition, wxDefaultSize, m_plotOriginOptNChoices, m_plotOriginOptChoices, 1, wxRA_SPECIFY_COLS ); + m_plotOriginOpt->SetSelection( 0 ); + m_paperHPGLSizer->Add( m_plotOriginOpt, 0, wxALL, 5 ); + + m_penHPLGWidthTitle = new wxStaticText( this, wxID_ANY, _("Pen Width"), wxDefaultPosition, wxDefaultSize, 0 ); + m_penHPLGWidthTitle->Wrap( -1 ); + m_paperHPGLSizer->Add( m_penHPLGWidthTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_penHPGLWidthCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_paperHPGLSizer->Add( m_penHPGLWidthCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + + + m_paperOptionsSizer->Add( m_paperHPGLSizer, 1, wxEXPAND, 5 ); + + + m_optionsSizer->Add( m_paperOptionsSizer, 1, wxEXPAND, 5 ); + + wxStaticBoxSizer* sbSizerPlotFormat; + sbSizerPlotFormat = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("General options") ), wxVERTICAL ); + + wxString m_plotFormatOptChoices[] = { _("Postscript"), _("PDF"), _("SVG"), _("DXF"), _("HPGL") }; + int m_plotFormatOptNChoices = sizeof( m_plotFormatOptChoices ) / sizeof( wxString ); + m_plotFormatOpt = new wxRadioBox( this, wxID_ANY, _("Plot format:"), wxDefaultPosition, wxDefaultSize, m_plotFormatOptNChoices, m_plotFormatOptChoices, 1, wxRA_SPECIFY_COLS ); + m_plotFormatOpt->SetSelection( 0 ); + sbSizerPlotFormat->Add( m_plotFormatOpt, 0, wxALL|wxEXPAND, 5 ); + + + m_optionsSizer->Add( sbSizerPlotFormat, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); + + wxStaticBoxSizer* sbOptionsSizer; + sbOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Plot options:") ), wxVERTICAL ); + + m_defaultLineWidthTitle = new wxStaticText( this, wxID_ANY, _("Default Thickness"), wxDefaultPosition, wxDefaultSize, 0 ); + m_defaultLineWidthTitle->Wrap( -1 ); + sbOptionsSizer->Add( m_defaultLineWidthTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_DefaultLineSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_DefaultLineSizeCtrl->SetToolTip( _("Selection of the default pen thickness used to draw items, when their thickness is set to 0.") ); + + sbOptionsSizer->Add( m_DefaultLineSizeCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + + wxString m_ModeColorOptionChoices[] = { _("Color"), _("Black and white") }; + int m_ModeColorOptionNChoices = sizeof( m_ModeColorOptionChoices ) / sizeof( wxString ); + m_ModeColorOption = new wxRadioBox( this, wxID_ANY, _("Plot mode"), wxDefaultPosition, wxDefaultSize, m_ModeColorOptionNChoices, m_ModeColorOptionChoices, 1, wxRA_SPECIFY_COLS ); + m_ModeColorOption->SetSelection( 1 ); + m_ModeColorOption->SetToolTip( _("Choose if you want to draw the sheet like it appears on screen,\nor in black and white mode, better to print it when using black and white printers") ); + + sbOptionsSizer->Add( m_ModeColorOption, 0, wxALL|wxEXPAND, 5 ); + + m_PlotFrameRefOpt = new wxCheckBox( this, wxID_ANY, _("Plot frame ref"), wxDefaultPosition, wxDefaultSize, 0 ); + m_PlotFrameRefOpt->SetValue(true); + m_PlotFrameRefOpt->SetToolTip( _("Print (or not) the Frame references.") ); + + sbOptionsSizer->Add( m_PlotFrameRefOpt, 0, wxALL, 5 ); + + + m_optionsSizer->Add( sbOptionsSizer, 1, 0, 5 ); + + m_ButtonsSizer = new wxBoxSizer( wxVERTICAL ); + + m_buttonPlotCurrent = new wxButton( this, wxID_PRINT_CURRENT, _("Plot Current"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonPlotCurrent->SetDefault(); + m_ButtonsSizer->Add( m_buttonPlotCurrent, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + m_buttonPlotAll = new wxButton( this, wxID_PRINT_ALL, _("Plot All"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonPlotAll->SetDefault(); + m_ButtonsSizer->Add( m_buttonPlotAll, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + m_buttonQuit = new wxButton( this, wxID_CANCEL, _("Quit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_ButtonsSizer->Add( m_buttonQuit, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); + + + m_optionsSizer->Add( m_ButtonsSizer, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + + bMainSizer->Add( m_optionsSizer, 0, wxEXPAND, 5 ); + + m_staticText2 = new wxStaticText( this, wxID_ANY, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText2->Wrap( -1 ); + bMainSizer->Add( m_staticText2, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_MessagesBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE ); + m_MessagesBox->SetMinSize( wxSize( -1,80 ) ); + + bMainSizer->Add( m_MessagesBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + + this->SetSizer( bMainSizer ); + this->Layout(); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnCloseWindow ) ); + m_HPGLPaperSizeOption->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnHPGLPageSelected ), NULL, this ); + m_plotFormatOpt->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnPlotFormatSelection ), NULL, this ); + m_buttonPlotCurrent->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnButtonPlotCurrentClick ), NULL, this ); + m_buttonPlotAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnButtonPlotAllClick ), NULL, this ); + m_buttonQuit->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnButtonCancelClick ), NULL, this ); +} + +DIALOG_PLOT_SCHEMATIC_BASE::~DIALOG_PLOT_SCHEMATIC_BASE() +{ + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnCloseWindow ) ); + m_HPGLPaperSizeOption->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnHPGLPageSelected ), NULL, this ); + m_plotFormatOpt->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnPlotFormatSelection ), NULL, this ); + m_buttonPlotCurrent->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnButtonPlotCurrentClick ), NULL, this ); + m_buttonPlotAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnButtonPlotAllClick ), NULL, this ); + m_buttonQuit->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PLOT_SCHEMATIC_BASE::OnButtonCancelClick ), NULL, this ); + +} diff --git a/eeschema/dialogs/dialog_plot_schematic_HPGL_base.fbp b/eeschema/dialogs/dialog_plot_schematic_base.fbp similarity index 58% rename from eeschema/dialogs/dialog_plot_schematic_HPGL_base.fbp rename to eeschema/dialogs/dialog_plot_schematic_base.fbp index 729e9bc5ec..fd8035082e 100644 --- a/eeschema/dialogs/dialog_plot_schematic_HPGL_base.fbp +++ b/eeschema/dialogs/dialog_plot_schematic_base.fbp @@ -1,29 +1,34 @@ - + C++ 1 source_name + 0 0 + res UTF-8 connect - dialog_plot_schematic_HPGL_base + dialog_plot_schematic_base 1000 none 1 - dialog_plot_schematic_HPGL + Dialog_plot_schematic_base . 1 + 1 1 - 0 + 1 0 + 0 + wxAUI_MGR_DEFAULT - wxBOTH + 1 1 @@ -34,25 +39,27 @@ 0 wxID_ANY - - DIALOG_PLOT_SCHEMATIC_HPGL_BASE + -1,-1 + DIALOG_PLOT_SCHEMATIC_BASE - 387,408 + 500,431 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - - Plot HPGL + DIALOG_SHIM; dialog_shim.h + Create Plot File - - wxFILTER_NONE - wxDefaultValidator - + + + + + + - + OnCloseWindow @@ -81,7 +88,7 @@ - bmainSizer + bMainSizer wxVERTICAL none @@ -90,43 +97,77 @@ 0 - bupperSizer + m_optionsSizer wxHORIZONTAL - none + protected 5 wxEXPAND 1 - + + wxID_ANY + Paper Options - bleftSizer + m_paperOptionsSizer wxVERTICAL - none + protected + 5 wxALL|wxEXPAND 0 + 1 + 1 + 1 + 1 + + + + + - "Schematic size" "Page size A4" "Page size A3" "Page size A2" "Page size A1" "Page size A0" "Page size A" "Page size B" "Page size C" "Page size D" "Page size E" + + 1 + 0 + "Schematic size" "Force size A4" "Force size A" + 1 1 + 0 + Dock + 0 + Left 1 + 1 + 0 0 wxID_ANY Plot Page Size: 1 + + 0 + + 0 - m_SizeOption + 1 + m_PaperSizeOption + 1 + + protected + 1 - 1 + Resizable + 0 + 1 wxRA_SPECIFY_COLS + 0 wxFILTER_NONE @@ -152,7 +193,7 @@ - OnPageSelected + @@ -161,30 +202,892 @@ + + 5 + wxEXPAND + 1 + + wxID_ANY + HPGL Options: + + m_paperHPGLSizer + wxVERTICAL + protected + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Plot Page Size: + + 0 + + + 0 + + 1 + m_staticText4 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Schematic size" "Page size A4" "Page size A3" "Page size A2" "Page size A1" "Page size A0" "Page size A" "Page size B" "Page size C" "Page size D" "Page size E" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_HPGLPaperSizeOption + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + OnHPGLPageSelected + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Bottom left corner" "Center of the page" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Plot Origin: + 1 + + 0 + + + 0 + + 1 + m_plotOriginOpt + 1 + + + protected + 1 + + Resizable + 0 + 1 + + wxRA_SPECIFY_COLS + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Pen Width + + 0 + + + 0 + + 1 + m_penHPLGWidthTitle + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_penHPGLWidthCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT + 0 + + wxID_ANY + General options + + sbSizerPlotFormat + wxVERTICAL + none + 5 wxALL|wxEXPAND 0 - + + 1 + 1 + 1 + 1 + + + + + - 1 + + 1 + 0 + "Postscript" "PDF" "SVG" "DXF" "HPGL" + 1 1 + 0 + Dock + 0 + Left 1 + 1 + 0 0 wxID_ANY - Print page references + Plot format: + 1 + + 0 + + 0 - m_Plot_Sheet_Ref_Ctrl + 1 + m_plotFormatOpt + 1 + + protected + 1 + Resizable + 0 + 1 + + wxRA_SPECIFY_COLS + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + OnPlotFormatSelection + + + + + + + + + + + + 5 + + 1 + + wxID_ANY + Plot options: + + sbOptionsSizer + wxVERTICAL + none + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Default Thickness + + 0 + + + 0 + + 1 + m_defaultLineWidthTitle + 1 + + + protected + 1 + + Resizable + 1 + 0 + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_DefaultLineSizeCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Selection of the default pen thickness used to draw items, when their thickness is set to 0. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Color" "Black and white" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Plot mode + 1 + + 0 + + + 0 + + 1 + m_ModeColorOption + 1 + + + protected + 1 + + Resizable + 1 + 1 + + wxRA_SPECIFY_COLS + + 0 + Choose if you want to draw the sheet like it appears on screen, or in black and white mode, better to print it when using black and white printers + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Plot frame ref + + 0 + + + 0 + + 1 + m_PlotFrameRefOpt + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Print (or not) the Frame references. wxFILTER_NONE wxDefaultValidator @@ -220,667 +1123,69 @@ - - 5 - wxEXPAND - 1 - - - sbSizerMiddle - wxVERTICAL - none - - 5 - wxEXPAND|wxALL - 0 - - wxID_ANY - Pen control: - - sbSizer1 - wxVERTICAL - none - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - - - 1 - 1 - - - 0 - wxID_ANY - Pen Width - - - m_penWidthTitle - protected - - - - - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND - 0 - - - - 1 - 1 - - - 0 - wxID_ANY - - 0 - - m_penWidthCtrl - protected - - - - - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - - - 1 - 1 - - - 0 - wxID_ANY - Pen Speed ( cm/s ) - - - m_penSpeedTitle - protected - - - - - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - - - 1 - 1 - - - 0 - wxID_ANY - 20 - 50 - - 1 - - m_penSpeedCtrl - protected - - - wxSP_ARROW_KEYS - - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - - - 1 - 1 - - - 0 - wxID_ANY - Pen Number - - - m_penNumTitle - protected - - - - - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - - - 1 - 1 - - - 0 - wxID_ANY - 1 - 8 - - 1 - - m_penNumCtrl - protected - - - wxSP_ARROW_KEYS - - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxALL - 1 - - wxID_ANY - Page offset: - - sbSizer2 - wxVERTICAL - none - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - - - 1 - 1 - - - 0 - wxID_ANY - Plot Offset X - - - m_offsetXTitle - protected - - - - - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND - 0 - - - - 1 - 1 - - - 0 - wxID_ANY - - 0 - - m_PlotOrgPosition_X - protected - - - - - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - - - 1 - 1 - - - 0 - wxID_ANY - Plot Offset Y - - - m_offsetYTitle - protected - - - - - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 0 - - - - 1 - 1 - - - 0 - wxID_ANY - - 0 - - m_PlotOrgPosition_Y - protected - - - - - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - - 0 - - 10 - protected - 10 - - 5 wxALIGN_CENTER_VERTICAL 0 - bbuttonsSizer + m_ButtonsSizer wxVERTICAL - none + protected 5 - wxALL|wxEXPAND + wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND 0 + 1 + 1 + 1 + 1 + + + + + + + 1 + 0 + 1 1 - 0 + 1 + 0 + Dock + 0 + Left 1 + 1 + 0 0 - wxID_ANY - &Plot Page + wxID_PRINT_CURRENT + Plot Current + + 0 + + 0 - m_buttonPlotPage + 1 + m_buttonPlotCurrent + 1 + + protected + 1 + Resizable + 1 + 0 wxFILTER_NONE @@ -889,7 +1194,7 @@ - OnPlotCurrent + OnButtonPlotCurrentClick @@ -917,27 +1222,58 @@ 5 - wxALL|wxEXPAND + wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND 0 + 1 + 1 + 1 + 1 + + + + + + + 1 + 0 + 1 1 - 0 + 1 + 0 + Dock + 0 + Left 1 + 1 + 0 0 - wxID_ANY - Plot A&LL + wxID_PRINT_ALL + Plot All + + 0 + + 0 + 1 m_buttonPlotAll + 1 + + protected + 1 + Resizable + 1 + 0 wxFILTER_NONE @@ -946,7 +1282,7 @@ - OnPlotAll + OnButtonPlotAllClick @@ -974,27 +1310,58 @@ 5 - wxALL|wxEXPAND + wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND 0 + 1 + 1 + 1 + 1 + + + + + + + 1 + 0 + 1 1 0 + 0 + Dock + 0 + Left 1 + 1 + 0 0 wxID_CANCEL - Close + Quit + + 0 + + 0 - m_buttonClose + 1 + m_buttonQuit + 1 + + protected + 1 + Resizable + 1 + 0 wxFILTER_NONE @@ -1003,74 +1370,7 @@ - OnCancelClick - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - 10 - protected - 10 - - - - 5 - wxALL - 0 - - - - 1 - 0 - 1 - - - 0 - wxID_ANY - &Accept Offset - - - m_buttonOffset - protected - - - - - - - wxFILTER_NONE - wxDefaultValidator - - - - - AcceptPlotOffset + OnButtonCancelClick @@ -1105,28 +1405,55 @@ wxTOP|wxRIGHT|wxLEFT 0 + 1 + 1 + 1 + 1 + + + + + + + 1 + 0 + 1 1 + 0 + Dock + 0 + Left 1 + 1 + 0 0 wxID_ANY - Messages : + Messages: + + 0 + + 0 - m_staticText1 + 1 + m_staticText2 + 1 + + protected + 1 + Resizable + 1 + 0 - - wxFILTER_NONE - wxDefaultValidator - @@ -1161,23 +1488,54 @@ wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 1 + 1 + 1 + 1 + 1 + + + + + + + 1 + 0 + 1 1 + 0 + Dock + 0 + Left 1 + 1 + 0 0 wxID_ANY + + 0 0 - -1,150 - m_MsgBox + + 0 + -1,80 + 1 + m_MessagesBox + 1 + + protected + 1 + Resizable + 1 - wxTE_MULTILINE|wxTE_READONLY + wxTE_MULTILINE + 0 wxFILTER_NONE diff --git a/eeschema/dialogs/dialog_SVG_print_base.h b/eeschema/dialogs/dialog_plot_schematic_base.h similarity index 52% rename from eeschema/dialogs/dialog_SVG_print_base.h rename to eeschema/dialogs/dialog_plot_schematic_base.h index 7e37697500..bd32837b61 100644 --- a/eeschema/dialogs/dialog_SVG_print_base.h +++ b/eeschema/dialogs/dialog_plot_schematic_base.h @@ -1,36 +1,38 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 30 2011) +// C++ code generated with wxFormBuilder (version Apr 10 2012) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// -#ifndef __DIALOG_SVG_PRINT_BASE_H__ -#define __DIALOG_SVG_PRINT_BASE_H__ +#ifndef __DIALOG_PLOT_SCHEMATIC_BASE_H__ +#define __DIALOG_PLOT_SCHEMATIC_BASE_H__ #include #include #include +#include "dialog_shim.h" #include -#include +#include #include #include #include #include +#include +#include #include -#include -#include #include #include +#include #include #include /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// -/// Class DIALOG_SVG_PRINT_base +/// Class DIALOG_PLOT_SCHEMATIC_BASE /////////////////////////////////////////////////////////////////////////////// -class DIALOG_SVG_PRINT_base : public wxDialog +class DIALOG_PLOT_SCHEMATIC_BASE : public DIALOG_SHIM { private: @@ -38,25 +40,34 @@ class DIALOG_SVG_PRINT_base : public wxDialog enum { wxID_PRINT_CURRENT = 1000, - wxID_PRINT_ALL, + wxID_PRINT_ALL }; - wxStaticText* m_TextPenWidth; - wxTextCtrl* m_DialogPenWidth; + wxBoxSizer* m_optionsSizer; + wxStaticBoxSizer* m_paperOptionsSizer; + wxRadioBox* m_PaperSizeOption; + wxStaticBoxSizer* m_paperHPGLSizer; + wxStaticText* m_staticText4; + wxChoice* m_HPGLPaperSizeOption; + wxRadioBox* m_plotOriginOpt; + wxStaticText* m_penHPLGWidthTitle; + wxTextCtrl* m_penHPGLWidthCtrl; + wxRadioBox* m_plotFormatOpt; + wxStaticText* m_defaultLineWidthTitle; + wxTextCtrl* m_DefaultLineSizeCtrl; wxRadioBox* m_ModeColorOption; - wxCheckBox* m_Print_Sheet_Ref; + wxCheckBox* m_PlotFrameRefOpt; + wxBoxSizer* m_ButtonsSizer; wxButton* m_buttonPlotCurrent; wxButton* m_buttonPlotAll; wxButton* m_buttonQuit; - wxStaticText* m_staticText1; - wxTextCtrl* m_FileNameCtrl; wxStaticText* m_staticText2; wxTextCtrl* m_MessagesBox; // Virtual event handlers, overide them in your derived class virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); } - virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); } - virtual void OnSetColorModeSelected( wxCommandEvent& event ) { event.Skip(); } + virtual void OnHPGLPageSelected( wxCommandEvent& event ) { event.Skip(); } + virtual void OnPlotFormatSelection( wxCommandEvent& event ) { event.Skip(); } virtual void OnButtonPlotCurrentClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnButtonPlotAllClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnButtonCancelClick( wxCommandEvent& event ) { event.Skip(); } @@ -64,9 +75,9 @@ class DIALOG_SVG_PRINT_base : public wxDialog public: - DIALOG_SVG_PRINT_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Create SVG file"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 550,446 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); - ~DIALOG_SVG_PRINT_base(); + DIALOG_PLOT_SCHEMATIC_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Create Plot File"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,431 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_PLOT_SCHEMATIC_BASE(); }; -#endif //__DIALOG_SVG_PRINT_BASE_H__ +#endif //__DIALOG_PLOT_SCHEMATIC_BASE_H__ diff --git a/eeschema/eeschema_id.h b/eeschema/eeschema_id.h index cf93b1c235..bb0020e3ed 100644 --- a/eeschema/eeschema_id.h +++ b/eeschema/eeschema_id.h @@ -57,6 +57,7 @@ enum id_eeschema_frm ID_GET_ANNOTATE, ID_GET_ERC, ID_BACKANNO_ITEMS, + ID_GEN_PLOT_SCHEMATIC, /* Schematic editor veritcal toolbar IDs */ ID_SCHEMATIC_VERTICAL_TOOLBAR_START, diff --git a/eeschema/libedit_plot_component.cpp b/eeschema/libedit_plot_component.cpp index 41974bfc96..3f0d4e1ad5 100644 --- a/eeschema/libedit_plot_component.cpp +++ b/eeschema/libedit_plot_component.cpp @@ -2,6 +2,30 @@ * @file libedit_plot_component.cpp */ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + + #include #include @@ -15,7 +39,7 @@ #include #include #include -#include +#include void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event ) @@ -69,22 +93,6 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event ) if( FullFileName.IsEmpty() ) return; -#if 0 // would the PAGE_INFO margins work for this old code: - - // Give a size to the SVG draw area = component size + margin - // the margin is 10% the size of the component size - wxSize pagesize = GetScreen()->ReturnPageSize( ); - wxSize componentSize = m_component->GetBoundingBox( m_unit, m_convert ).GetSize(); - - // Add a small margin to the plot bounding box - componentSize.x = (int)(componentSize.x * 1.2); - componentSize.y = (int)(componentSize.y * 1.2); - - GetScreen()->SetPageSize( componentSize ); - SVG_Print_Component( FullFileName ); - GetScreen()->SetPageSize( pagesize ); - -#else PAGE_INFO pageSave = GetScreen()->GetPageSettings(); PAGE_INFO pageTemp = pageSave; @@ -97,7 +105,6 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event ) GetScreen()->SetPageSettings( pageTemp ); SVG_Print_Component( FullFileName ); GetScreen()->SetPageSettings( pageSave ); -#endif } break; } @@ -131,7 +138,10 @@ void LIB_EDIT_FRAME::CreatePNGorJPEGFile( const wxString& aFileName, bool aFmt_j void LIB_EDIT_FRAME::SVG_Print_Component( const wxString& FullFileName ) { - DIALOG_SVG_PRINT::DrawSVGPage( this, FullFileName, GetScreen() ); + bool plotBW = false; + bool plotFrameRef = false; + DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG( this, FullFileName, GetScreen(), + plotBW, plotFrameRef ); } void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode, void* aData) diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index ece3e7ed85..858e84443e 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -141,39 +141,10 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() // Plot submenu wxMenu* choice_plot_fmt = new wxMenu; - - // Plot PostScript - AddMenuItem( choice_plot_fmt, ID_GEN_PLOT_PS, - _( "Plot &PostScript" ), - _( "Plot schematic sheet in PostScript format" ), - KiBitmap( plot_ps_xpm ) ); - - // Plot PDF - AddMenuItem( choice_plot_fmt, ID_GEN_PLOT_PDF, - _( "Plot PDF" ), - _( "Plot schematic sheet in PDF format" ), - KiBitmap( plot_pdf_xpm ) ); - - // Plot HPGL - AddMenuItem( choice_plot_fmt, - ID_GEN_PLOT_HPGL, - _( "Plot &HPGL" ), - _( "Plot schematic sheet in HPGL format" ), - KiBitmap( plot_hpg_xpm ) ); - - // Plot SVG - AddMenuItem( choice_plot_fmt, - ID_GEN_PLOT_SVG, - _( "Plot &SVG" ), - _( "Plot schematic sheet in SVG format" ), - KiBitmap( plot_svg_xpm ) ); - - // Plot DXF - AddMenuItem( choice_plot_fmt, - ID_GEN_PLOT_DXF, - _( "Plot &DXF" ), - _( "Plot schematic sheet in DXF format" ), - KiBitmap( plot_dxf_xpm ) ); + AddMenuItem( choice_plot_fmt, ID_GEN_PLOT_SCHEMATIC, + _( "&Plot" ), + _( "Plot schematic sheet in PostScript, PDF, SVG, DXF or HPGL format" ), + KiBitmap( plot_xpm ) ); // Plot to Clipboard (Windows only) #ifdef __WINDOWS__ diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index 6aa73f6ae3..8de5113a58 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -56,7 +56,6 @@ #include #include #include -#include #include #include @@ -82,11 +81,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME ) EVT_MENU( ID_SAVE_PROJECT, SCH_EDIT_FRAME::OnSaveProject ) EVT_MENU( ID_SAVE_ONE_SHEET, SCH_EDIT_FRAME::Save_File ) EVT_MENU( ID_SAVE_ONE_SHEET_AS, SCH_EDIT_FRAME::Save_File ) - EVT_MENU( ID_GEN_PLOT_PS, SCH_EDIT_FRAME::ToPlot_PS ) - EVT_MENU( ID_GEN_PLOT_HPGL, SCH_EDIT_FRAME::ToPlot_HPGL ) - EVT_MENU( ID_GEN_PLOT_SVG, SCH_EDIT_FRAME::SVG_Print ) - EVT_MENU( ID_GEN_PLOT_DXF, SCH_EDIT_FRAME::ToPlot_DXF ) - EVT_MENU( ID_GEN_PLOT_PDF, SCH_EDIT_FRAME::ToPlot_PDF ) + EVT_MENU( ID_GEN_PLOT_SCHEMATIC, SCH_EDIT_FRAME::PlotSchematic ) EVT_MENU( ID_GEN_COPY_SHEET_TO_CLIPBOARD, EDA_DRAW_FRAME::CopyToClipboard ) EVT_MENU( wxID_EXIT, SCH_EDIT_FRAME::OnExit ) @@ -853,15 +848,6 @@ void SCH_EDIT_FRAME::OnPrint( wxCommandEvent& event ) } } - -void SCH_EDIT_FRAME::SVG_Print( wxCommandEvent& event ) -{ - DIALOG_SVG_PRINT frame( this ); - - frame.ShowModal(); -} - - void SCH_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode, void* aData ) { GetScreen()->Draw( m_canvas, aDC, GR_DEFAULT_DRAWMODE ); diff --git a/include/wxEeschemaStruct.h b/include/wxEeschemaStruct.h index b2a31cf72e..7a8cc1cc94 100644 --- a/include/wxEeschemaStruct.h +++ b/include/wxEeschemaStruct.h @@ -589,14 +589,10 @@ public: void SetPrintMonochrome( bool aMonochrome ) { m_printMonochrome = aMonochrome; } bool GetPrintSheetReference() { return m_printSheetReference; } void SetPrintSheetReference( bool aShow ) { m_printSheetReference = aShow; } - void SVG_Print( wxCommandEvent& event ); // Plot functions: - void ToPlot_PS( wxCommandEvent& event ); - void ToPlot_PDF( wxCommandEvent& event ); - void ToPlot_HPGL( wxCommandEvent& event ); - void ToPlot_DXF( wxCommandEvent& event ); - void ToPostProcess( wxCommandEvent& event ); +// void ToPostProcess( wxCommandEvent& event ); + void PlotSchematic( wxCommandEvent& event ); // read and save files void Save_File( wxCommandEvent& event );