mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-21 21:43:43 +00:00
CHANGED: Eliminate the independent SVG plot dialog that only duplicated and half-implemented the functions of the full Plot dialog
This commit is contained in:
parent
0f70c7747c
commit
d8d84f300f
@ -74,8 +74,6 @@ set( PCBNEW_DIALOGS
|
||||
dialogs/dialog_export_step_base.cpp
|
||||
dialogs/dialog_export_step_process.cpp
|
||||
dialogs/dialog_export_step_process_base.cpp
|
||||
dialogs/dialog_export_svg.cpp
|
||||
dialogs/dialog_export_svg_base.cpp
|
||||
dialogs/dialog_export_vrml.cpp
|
||||
dialogs/dialog_export_vrml_base.cpp
|
||||
dialogs/dialog_find.cpp
|
||||
|
@ -1,370 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2022-2023 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 <pcb_edit_frame.h>
|
||||
#include <pcbnew_settings.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <reporter.h>
|
||||
#include <confirm.h>
|
||||
#include <core/arraydim.h>
|
||||
#include <pcbplot.h>
|
||||
#include <locale_io.h>
|
||||
#include <dialog_export_svg.h>
|
||||
#include <bitmaps.h>
|
||||
#include <widgets/std_bitmap_button.h>
|
||||
#include <widgets/wx_html_report_panel.h>
|
||||
#include <plotters/plotters_pslike.h>
|
||||
#include <wx/dirdlg.h>
|
||||
#include <wx/msgdlg.h>
|
||||
#include <pgm_base.h>
|
||||
#include <project/project_file.h>
|
||||
#include <exporters/export_svg.h>
|
||||
#include <jobs/job_export_pcb_svg.h>
|
||||
|
||||
|
||||
DIALOG_EXPORT_SVG::DIALOG_EXPORT_SVG( PCB_EDIT_FRAME* aEditFrame, BOARD* aBoard, wxWindow* aParent ) :
|
||||
DIALOG_EXPORT_SVG_BASE( aParent ),
|
||||
m_board( aBoard ),
|
||||
m_editFrame( aEditFrame ),
|
||||
m_printBW( false ),
|
||||
m_printMirror( false ),
|
||||
m_oneFileOnly( false )
|
||||
{
|
||||
m_browseButton->SetBitmap( KiBitmapBundle( BITMAPS::small_folder ) );
|
||||
|
||||
m_messagesPanel->SetFileName( Prj().GetProjectPath() + wxT( "report.txt" ) );
|
||||
|
||||
initDialog();
|
||||
|
||||
SetupStandardButtons( { { wxID_OK, _( "Export" ) },
|
||||
{ wxID_CANCEL, _( "Close" ) } } );
|
||||
|
||||
PCBNEW_SETTINGS* cfg = m_editFrame->GetPcbNewSettings();
|
||||
m_cbUsedBoardTheme->SetValue( !cfg->m_ExportSvg.use_selected_theme );
|
||||
|
||||
// Build color theme list, and select the previoulsy selected theme
|
||||
wxString theme_old_selection = cfg->m_ExportSvg.color_theme;
|
||||
|
||||
for( COLOR_SETTINGS* settings : m_editFrame->GetSettingsManager()->GetColorSettingsList() )
|
||||
{
|
||||
int pos = m_colorTheme->Append( settings->GetName(), static_cast<void*>( settings ) );
|
||||
|
||||
if( settings->GetName() == theme_old_selection )
|
||||
m_colorTheme->SetSelection( pos );
|
||||
}
|
||||
|
||||
finishDialogSettings();
|
||||
}
|
||||
|
||||
|
||||
DIALOG_EXPORT_SVG::DIALOG_EXPORT_SVG( JOB_EXPORT_PCB_SVG* aJob, PCB_EDIT_FRAME* aEditFrame,
|
||||
wxWindow* aParent ) :
|
||||
DIALOG_EXPORT_SVG( aEditFrame, aEditFrame->GetBoard(), aParent )
|
||||
{
|
||||
m_job = aJob;
|
||||
|
||||
SetupStandardButtons( { { wxID_OK, _( "Save" ) },
|
||||
{ wxID_CANCEL, _( "Close" ) } } );
|
||||
}
|
||||
|
||||
|
||||
DIALOG_EXPORT_SVG::~DIALOG_EXPORT_SVG()
|
||||
{
|
||||
m_printBW = m_ModeColorOption->GetSelection();
|
||||
m_oneFileOnly = !m_checkboxPagePerLayer->GetValue();
|
||||
m_outputDirectory = m_outputDirectoryName->GetValue();
|
||||
m_outputDirectory.Replace( wxT( "\\" ), wxT( "/" ) );
|
||||
|
||||
m_editFrame->Prj().GetProjectFile().m_PcbLastPath[LAST_PATH_SVG] = m_outputDirectory;
|
||||
|
||||
PCBNEW_SETTINGS* cfg = nullptr;
|
||||
|
||||
try
|
||||
{
|
||||
cfg = m_editFrame->GetPcbNewSettings();
|
||||
}
|
||||
catch( const std::runtime_error& e )
|
||||
{
|
||||
wxFAIL_MSG( e.what() );
|
||||
}
|
||||
|
||||
if( cfg )
|
||||
{
|
||||
cfg->m_ExportSvg.black_and_white = m_printBW;
|
||||
cfg->m_ExportSvg.mirror = m_printMirror;
|
||||
cfg->m_ExportSvg.one_file = m_oneFileOnly;
|
||||
cfg->m_ExportSvg.page_size = m_rbSvgPageSizeOpt->GetSelection();
|
||||
cfg->m_ExportSvg.output_dir = m_outputDirectory.ToStdString();
|
||||
cfg->m_ExportSvg.use_selected_theme = !m_cbUsedBoardTheme->GetValue();
|
||||
cfg->m_ExportSvg.color_theme = m_colorTheme->GetStringSelection();
|
||||
}
|
||||
|
||||
if( m_checkboxPagePerLayer->GetValue() )
|
||||
{
|
||||
m_oneFileOnly = false;
|
||||
|
||||
if( cfg )
|
||||
cfg->m_ExportSvg.plot_board_edges = m_checkboxEdgesOnAllPages->GetValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_oneFileOnly = true;
|
||||
}
|
||||
|
||||
if( cfg )
|
||||
cfg->m_ExportSvg.layers.clear();
|
||||
|
||||
for( auto& [ layer_idx, layer] : m_boxSelectLayer )
|
||||
{
|
||||
if( !layer.first )
|
||||
continue;
|
||||
|
||||
if( layer.first->IsChecked( layer.second ) )
|
||||
{
|
||||
if( cfg )
|
||||
cfg->m_ExportSvg.layers.push_back( layer_idx );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_EXPORT_SVG::initDialog()
|
||||
{
|
||||
PROJECT_FILE& projectFile = m_editFrame->Prj().GetProjectFile();
|
||||
PCBNEW_SETTINGS* cfg = m_editFrame->GetPcbNewSettings();
|
||||
|
||||
m_printBW = cfg->m_ExportSvg.black_and_white;
|
||||
m_printMirror = cfg->m_ExportSvg.mirror;
|
||||
m_oneFileOnly = cfg->m_ExportSvg.one_file;
|
||||
|
||||
if( !projectFile.m_PcbLastPath[ LAST_PATH_SVG ].IsEmpty() )
|
||||
m_outputDirectory = projectFile.m_PcbLastPath[ LAST_PATH_SVG ];
|
||||
else
|
||||
m_outputDirectory = cfg->m_ExportSvg.output_dir;
|
||||
|
||||
m_rbSvgPageSizeOpt->SetSelection( cfg->m_ExportSvg.page_size );
|
||||
m_checkboxPagePerLayer->SetValue( !m_oneFileOnly );
|
||||
|
||||
wxCommandEvent dummy;
|
||||
onPagePerLayerClicked( dummy );
|
||||
|
||||
m_outputDirectoryName->SetValue( m_outputDirectory );
|
||||
|
||||
m_ModeColorOption->SetSelection( m_printBW ? 1 : 0 );
|
||||
m_printMirrorOpt->SetValue( m_printMirror );
|
||||
|
||||
for( PCB_LAYER_ID layer : m_board->GetEnabledLayers().UIOrder() )
|
||||
{
|
||||
int checkIndex;
|
||||
|
||||
if( IsCopperLayer( layer ) )
|
||||
{
|
||||
checkIndex = m_CopperLayersList->Append( m_board->GetLayerName( layer ) );
|
||||
m_boxSelectLayer[layer] = std::make_pair( m_CopperLayersList, checkIndex );
|
||||
}
|
||||
else
|
||||
{
|
||||
checkIndex = m_TechnicalLayersList->Append( m_board->GetLayerName( layer ) );
|
||||
m_boxSelectLayer[layer] = std::make_pair( m_TechnicalLayersList, checkIndex );
|
||||
}
|
||||
|
||||
if( alg::contains( cfg->m_ExportSvg.layers, layer ) )
|
||||
m_boxSelectLayer[layer].first->Check( checkIndex, true );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LSET DIALOG_EXPORT_SVG::getCheckBoxSelectedLayers() const
|
||||
{
|
||||
LSET ret;
|
||||
|
||||
for( auto& [layer_idx, layer] : m_boxSelectLayer )
|
||||
{
|
||||
if( !layer.first )
|
||||
continue;
|
||||
|
||||
if( layer.first->IsChecked( layer.second ) )
|
||||
ret.set( layer_idx );
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_EXPORT_SVG::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
|
||||
{
|
||||
// Build the absolute path of current output directory to preselect it in the file browser.
|
||||
wxString path = ExpandEnvVarSubstitutions( m_outputDirectoryName->GetValue(), &Prj() );
|
||||
path = Prj().AbsolutePath( path );
|
||||
|
||||
wxDirDialog dirDialog( this, _( "Select Output Directory" ), path );
|
||||
|
||||
if( dirDialog.ShowModal() == wxID_CANCEL )
|
||||
return;
|
||||
|
||||
wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
|
||||
|
||||
wxMessageDialog dialog( this, _( "Use a relative path?" ), _( "Plot Output Directory" ),
|
||||
wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );
|
||||
|
||||
if( dialog.ShowModal() == wxID_YES )
|
||||
{
|
||||
wxString boardFilePath = Prj().AbsolutePath( m_board->GetFileName() );
|
||||
|
||||
boardFilePath = wxPathOnly( boardFilePath );
|
||||
|
||||
if( !dirName.MakeRelativeTo( boardFilePath ) )
|
||||
wxMessageBox( _( "Cannot make path relative (target volume different from board "
|
||||
"file volume)!" ),
|
||||
_( "Plot Output Directory" ), wxOK | wxICON_ERROR );
|
||||
}
|
||||
|
||||
m_outputDirectoryName->SetValue( dirName.GetFullPath() );
|
||||
m_outputDirectory = m_outputDirectoryName->GetValue();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_EXPORT_SVG::onPagePerLayerClicked( wxCommandEvent& event )
|
||||
{
|
||||
PCBNEW_SETTINGS* cfg = m_editFrame->GetPcbNewSettings();
|
||||
|
||||
if( m_checkboxPagePerLayer->GetValue() )
|
||||
{
|
||||
m_checkboxEdgesOnAllPages->Enable( true );
|
||||
m_checkboxEdgesOnAllPages->SetValue( cfg->m_ExportSvg.plot_board_edges );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_checkboxEdgesOnAllPages->Enable( false );
|
||||
m_checkboxEdgesOnAllPages->SetValue( false );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_EXPORT_SVG::ExportSVGFile( bool aOnlyOneFile )
|
||||
{
|
||||
m_outputDirectory = m_outputDirectoryName->GetValue();
|
||||
|
||||
// Create output directory if it does not exist (also transform it in absolute form).
|
||||
// Bail if it fails.
|
||||
|
||||
std::function<bool( wxString* )> textResolver =
|
||||
[&]( wxString* token ) -> bool
|
||||
{
|
||||
// Handles m_board->GetTitleBlock() *and* m_board->GetProject()
|
||||
return m_board->ResolveTextVar( token, 0 );
|
||||
};
|
||||
|
||||
wxString path = m_outputDirectory;
|
||||
path = ExpandTextVars( path, &textResolver );
|
||||
path = ExpandEnvVarSubstitutions( path, nullptr );
|
||||
|
||||
wxFileName outputDir = wxFileName::DirName( path );
|
||||
wxString boardFilename = m_board->GetFileName();
|
||||
|
||||
REPORTER& reporter = m_messagesPanel->Reporter();
|
||||
|
||||
if( !EnsureFileDirectoryExists( &outputDir, boardFilename, &reporter ) )
|
||||
{
|
||||
wxString msg = wxString::Format( _( "Could not write plot files to folder '%s'." ),
|
||||
outputDir.GetPath() );
|
||||
DisplayError( this, msg );
|
||||
return;
|
||||
}
|
||||
|
||||
m_printMirror = m_printMirrorOpt->GetValue();
|
||||
m_printBW = m_ModeColorOption->GetSelection();
|
||||
|
||||
LSET all_selected = getCheckBoxSelectedLayers();
|
||||
|
||||
PCB_PLOT_SVG_OPTIONS svgPlotOptions;
|
||||
svgPlotOptions.m_negative = false;
|
||||
svgPlotOptions.m_blackAndWhite = m_printBW;
|
||||
svgPlotOptions.m_printMaskLayer = m_printMaskLayer;
|
||||
svgPlotOptions.m_sketchPadsOnFabLayers = false;
|
||||
svgPlotOptions.m_hideDNPFPsOnFabLayers = false;
|
||||
svgPlotOptions.m_sketchDNPFPsOnFabLayers = true;
|
||||
svgPlotOptions.m_crossoutDNPFPsOnFabLayers = true;
|
||||
svgPlotOptions.m_pageSizeMode = m_rbSvgPageSizeOpt->GetSelection();
|
||||
|
||||
PCBNEW_SETTINGS* cfg = m_editFrame->GetPcbNewSettings();
|
||||
wxString export_theme = m_cbUsedBoardTheme->GetValue()
|
||||
? cfg->m_ColorTheme
|
||||
: m_colorTheme->GetStringSelection();
|
||||
|
||||
svgPlotOptions.m_colorTheme = export_theme;
|
||||
|
||||
svgPlotOptions.m_mirror = m_printMirror;
|
||||
svgPlotOptions.m_plotFrame = svgPlotOptions.m_pageSizeMode == 0;
|
||||
svgPlotOptions.m_drillShapeOption = 2; // actual size hole.
|
||||
|
||||
for( PCB_LAYER_ID layer : all_selected.Seq() )
|
||||
{
|
||||
wxFileName fn( boardFilename );
|
||||
wxString suffix = aOnlyOneFile ? wxString( wxT( "brd" ) ) : m_board->GetStandardLayerName( layer );
|
||||
|
||||
BuildPlotFileName( &fn, outputDir.GetPath(), suffix, FILEEXT::SVGFileExtension );
|
||||
wxString svgPath = fn.GetFullPath();
|
||||
|
||||
m_printMaskLayer = aOnlyOneFile ? all_selected.SeqStackupForPlotting() : LSEQ( { layer } );
|
||||
|
||||
if( m_checkboxEdgesOnAllPages->GetValue() )
|
||||
m_printMaskLayer.push_back( Edge_Cuts );
|
||||
|
||||
svgPlotOptions.m_outputFile = svgPath;
|
||||
svgPlotOptions.m_printMaskLayer = m_printMaskLayer;
|
||||
|
||||
if( EXPORT_SVG::Plot(m_board, svgPlotOptions ) )
|
||||
{
|
||||
reporter.Report( wxString::Format( _( "Exported '%s'." ), svgPath ),
|
||||
RPT_SEVERITY_ACTION );
|
||||
}
|
||||
else // Error
|
||||
{
|
||||
reporter.Report( wxString::Format( _( "Failed to create file '%s'." ), svgPath ),
|
||||
RPT_SEVERITY_ERROR );
|
||||
}
|
||||
|
||||
if( aOnlyOneFile )
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_EXPORT_SVG::OnButtonPlot( wxCommandEvent& event )
|
||||
{
|
||||
m_oneFileOnly = !m_checkboxPagePerLayer->GetValue();
|
||||
ExportSVGFile( m_oneFileOnly );
|
||||
}
|
||||
|
||||
|
||||
bool InvokeExportSVG( PCB_EDIT_FRAME* aCaller, BOARD* aBoard )
|
||||
{
|
||||
DIALOG_EXPORT_SVG dlg( aCaller, aBoard, aCaller );
|
||||
|
||||
dlg.ShowModal();
|
||||
|
||||
return true;
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2022-2023 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
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <dialog_export_svg_base.h>
|
||||
#include <lseq.h>
|
||||
|
||||
class BOARD;
|
||||
class PCB_EDIT_FRAME;
|
||||
class JOB_EXPORT_PCB_SVG;
|
||||
|
||||
class DIALOG_EXPORT_SVG : public DIALOG_EXPORT_SVG_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_EXPORT_SVG( JOB_EXPORT_PCB_SVG* aJob, PCB_EDIT_FRAME* aEditFrame, wxWindow* aParent );
|
||||
DIALOG_EXPORT_SVG( PCB_EDIT_FRAME* aEditFrame, BOARD* aBoard, wxWindow* aParent );
|
||||
~DIALOG_EXPORT_SVG() override;
|
||||
|
||||
private:
|
||||
BOARD* m_board;
|
||||
JOB_EXPORT_PCB_SVG* m_job;
|
||||
PCB_EDIT_FRAME* m_editFrame;
|
||||
LSEQ m_printMaskLayer;
|
||||
// the list of existing board layers in wxCheckListBox, with the
|
||||
// board layers id:
|
||||
std::map<int, std::pair<wxCheckListBox*, int>> m_boxSelectLayer;
|
||||
bool m_printBW;
|
||||
wxString m_outputDirectory;
|
||||
bool m_printMirror;
|
||||
bool m_oneFileOnly;
|
||||
|
||||
void initDialog();
|
||||
|
||||
void OnButtonPlot( wxCommandEvent& event ) override;
|
||||
|
||||
void onPagePerLayerClicked( wxCommandEvent& event ) override;
|
||||
void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) override;
|
||||
void ExportSVGFile( bool aOnlyOneFile );
|
||||
|
||||
LSET getCheckBoxSelectedLayers() const;
|
||||
};
|
@ -1,184 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "widgets/std_bitmap_button.h"
|
||||
#include "widgets/wx_html_report_panel.h"
|
||||
|
||||
#include "dialog_export_svg_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DIALOG_EXPORT_SVG_BASE::DIALOG_EXPORT_SVG_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 );
|
||||
|
||||
wxBoxSizer* bSizer4;
|
||||
bSizer4 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_staticTextDir = new wxStaticText( this, wxID_ANY, _("Output directory:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextDir->Wrap( -1 );
|
||||
bSizer4->Add( m_staticTextDir, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_outputDirectoryName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_outputDirectoryName->SetToolTip( _("Enter a filename if you do not want to use default file names\nCan be used only when printing the current sheet") );
|
||||
m_outputDirectoryName->SetMinSize( wxSize( 450,-1 ) );
|
||||
|
||||
bSizer4->Add( m_outputDirectoryName, 1, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
|
||||
|
||||
m_browseButton = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 );
|
||||
bSizer4->Add( m_browseButton, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
bMainSizer->Add( bSizer4, 0, wxEXPAND|wxALL, 10 );
|
||||
|
||||
wxBoxSizer* bUpperSizer;
|
||||
bUpperSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxStaticBoxSizer* sbLayersSizer;
|
||||
sbLayersSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Layers") ), wxHORIZONTAL );
|
||||
|
||||
wxBoxSizer* bSizerCopper;
|
||||
bSizerCopper = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_staticTextCopperLayers = new wxStaticText( sbLayersSizer->GetStaticBox(), wxID_ANY, _("Copper layers:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextCopperLayers->Wrap( -1 );
|
||||
bSizerCopper->Add( m_staticTextCopperLayers, 0, wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxArrayString m_CopperLayersListChoices;
|
||||
m_CopperLayersList = new wxCheckListBox( sbLayersSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_CopperLayersListChoices, 0 );
|
||||
bSizerCopper->Add( m_CopperLayersList, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
|
||||
sbLayersSizer->Add( bSizerCopper, 1, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizerTech;
|
||||
bSizerTech = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_staticTextTechLayers = new wxStaticText( sbLayersSizer->GetStaticBox(), wxID_ANY, _("Technical layers:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextTechLayers->Wrap( -1 );
|
||||
bSizerTech->Add( m_staticTextTechLayers, 0, wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxArrayString m_TechnicalLayersListChoices;
|
||||
m_TechnicalLayersList = new wxCheckListBox( sbLayersSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_TechnicalLayersListChoices, 0 );
|
||||
bSizerTech->Add( m_TechnicalLayersList, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
|
||||
|
||||
|
||||
sbLayersSizer->Add( bSizerTech, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bUpperSizer->Add( sbLayersSizer, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbOptionsSizer;
|
||||
sbOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options") ), wxVERTICAL );
|
||||
|
||||
wxString m_ModeColorOptionChoices[] = { _("Color"), _("Black and white") };
|
||||
int m_ModeColorOptionNChoices = sizeof( m_ModeColorOptionChoices ) / sizeof( wxString );
|
||||
m_ModeColorOption = new wxRadioBox( sbOptionsSizer->GetStaticBox(), wxID_ANY, _("Print Mode"), wxDefaultPosition, wxDefaultSize, m_ModeColorOptionNChoices, m_ModeColorOptionChoices, 1, wxRA_SPECIFY_COLS );
|
||||
m_ModeColorOption->SetSelection( 1 );
|
||||
m_ModeColorOption->SetToolTip( _("Export as black elements on a white background") );
|
||||
|
||||
sbOptionsSizer->Add( m_ModeColorOption, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
m_cbUsedBoardTheme = new wxCheckBox( sbOptionsSizer->GetStaticBox(), wxID_ANY, _("Use current board theme"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_cbUsedBoardTheme->SetValue(true);
|
||||
sbOptionsSizer->Add( m_cbUsedBoardTheme, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxBoxSizer* bSizerTheme;
|
||||
bSizerTheme = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_stColorTheme = new wxStaticText( sbOptionsSizer->GetStaticBox(), wxID_ANY, _("Color theme:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_stColorTheme->Wrap( -1 );
|
||||
bSizerTheme->Add( m_stColorTheme, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
wxArrayString m_colorThemeChoices;
|
||||
m_colorTheme = new wxChoice( sbOptionsSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_colorThemeChoices, 0 );
|
||||
m_colorTheme->SetSelection( 0 );
|
||||
bSizerTheme->Add( m_colorTheme, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
sbOptionsSizer->Add( bSizerTheme, 0, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizer8;
|
||||
bSizer8 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
||||
sbOptionsSizer->Add( bSizer8, 1, wxEXPAND, 5 );
|
||||
|
||||
wxString m_rbSvgPageSizeOptChoices[] = { _("Page with frame and title block"), _("Current page size"), _("Board area only") };
|
||||
int m_rbSvgPageSizeOptNChoices = sizeof( m_rbSvgPageSizeOptChoices ) / sizeof( wxString );
|
||||
m_rbSvgPageSizeOpt = new wxRadioBox( sbOptionsSizer->GetStaticBox(), wxID_ANY, _("SVG Page Size"), wxDefaultPosition, wxDefaultSize, m_rbSvgPageSizeOptNChoices, m_rbSvgPageSizeOptChoices, 1, wxRA_SPECIFY_COLS );
|
||||
m_rbSvgPageSizeOpt->SetSelection( 0 );
|
||||
sbOptionsSizer->Add( m_rbSvgPageSizeOpt, 0, wxEXPAND|wxALL, 5 );
|
||||
|
||||
m_printMirrorOpt = new wxCheckBox( sbOptionsSizer->GetStaticBox(), wxID_ANY, _("Print mirrored"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_printMirrorOpt->SetToolTip( _("Print the layer(s) horizontally mirrored") );
|
||||
|
||||
sbOptionsSizer->Add( m_printMirrorOpt, 0, wxALL, 5 );
|
||||
|
||||
m_checkboxPagePerLayer = new wxCheckBox( sbOptionsSizer->GetStaticBox(), wxID_ANY, _("Print one page per layer"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sbOptionsSizer->Add( m_checkboxPagePerLayer, 0, wxALL, 5 );
|
||||
|
||||
wxBoxSizer* bSizerBrdEdges;
|
||||
bSizerBrdEdges = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
|
||||
bSizerBrdEdges->Add( 20, 0, 0, wxEXPAND, 5 );
|
||||
|
||||
m_checkboxEdgesOnAllPages = new wxCheckBox( sbOptionsSizer->GetStaticBox(), wxID_ANY, _("Print board edges on all pages"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bSizerBrdEdges->Add( m_checkboxEdgesOnAllPages, 0, wxBOTTOM|wxLEFT, 5 );
|
||||
|
||||
|
||||
sbOptionsSizer->Add( bSizerBrdEdges, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bUpperSizer->Add( sbOptionsSizer, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
bMainSizer->Add( bUpperSizer, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
wxBoxSizer* bSizer5;
|
||||
bSizer5 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_messagesPanel = new WX_HTML_REPORT_PANEL( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
m_messagesPanel->SetMinSize( wxSize( 300,150 ) );
|
||||
|
||||
bSizer5->Add( m_messagesPanel, 1, wxEXPAND | wxALL, 5 );
|
||||
|
||||
|
||||
bMainSizer->Add( bSizer5, 1, wxEXPAND, 5 );
|
||||
|
||||
m_sdbSizer1 = new wxStdDialogButtonSizer();
|
||||
m_sdbSizer1OK = new wxButton( this, wxID_OK );
|
||||
m_sdbSizer1->AddButton( m_sdbSizer1OK );
|
||||
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
|
||||
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
|
||||
m_sdbSizer1->Realize();
|
||||
|
||||
bMainSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bMainSizer );
|
||||
this->Layout();
|
||||
bMainSizer->Fit( this );
|
||||
|
||||
// Connect Events
|
||||
m_browseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXPORT_SVG_BASE::OnOutputDirectoryBrowseClicked ), NULL, this );
|
||||
m_checkboxPagePerLayer->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_EXPORT_SVG_BASE::onPagePerLayerClicked ), NULL, this );
|
||||
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXPORT_SVG_BASE::OnButtonPlot ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_EXPORT_SVG_BASE::~DIALOG_EXPORT_SVG_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_browseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXPORT_SVG_BASE::OnOutputDirectoryBrowseClicked ), NULL, this );
|
||||
m_checkboxPagePerLayer->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_EXPORT_SVG_BASE::onPagePerLayerClicked ), NULL, this );
|
||||
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXPORT_SVG_BASE::OnButtonPlot ), NULL, this );
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,81 +0,0 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
class STD_BITMAP_BUTTON;
|
||||
class WX_HTML_REPORT_PANEL;
|
||||
|
||||
#include "dialog_shim.h"
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <wx/bmpbuttn.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/checklst.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/radiobox.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DIALOG_EXPORT_SVG_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DIALOG_EXPORT_SVG_BASE : public DIALOG_SHIM
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxStaticText* m_staticTextDir;
|
||||
wxTextCtrl* m_outputDirectoryName;
|
||||
STD_BITMAP_BUTTON* m_browseButton;
|
||||
wxStaticText* m_staticTextCopperLayers;
|
||||
wxCheckListBox* m_CopperLayersList;
|
||||
wxStaticText* m_staticTextTechLayers;
|
||||
wxCheckListBox* m_TechnicalLayersList;
|
||||
wxRadioBox* m_ModeColorOption;
|
||||
wxCheckBox* m_cbUsedBoardTheme;
|
||||
wxStaticText* m_stColorTheme;
|
||||
wxChoice* m_colorTheme;
|
||||
wxRadioBox* m_rbSvgPageSizeOpt;
|
||||
wxCheckBox* m_printMirrorOpt;
|
||||
wxCheckBox* m_checkboxPagePerLayer;
|
||||
wxCheckBox* m_checkboxEdgesOnAllPages;
|
||||
WX_HTML_REPORT_PANEL* m_messagesPanel;
|
||||
wxStdDialogButtonSizer* m_sdbSizer1;
|
||||
wxButton* m_sdbSizer1OK;
|
||||
wxButton* m_sdbSizer1Cancel;
|
||||
|
||||
// Virtual event handlers, override them in your derived class
|
||||
virtual void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onPagePerLayerClicked( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnButtonPlot( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_EXPORT_SVG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Export SVG File"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
|
||||
~DIALOG_EXPORT_SVG_BASE();
|
||||
|
||||
};
|
||||
|
@ -72,13 +72,4 @@ class KIWAY;
|
||||
*/
|
||||
void InvokePcbLibTableEditor( KIWAY* aKiway, wxWindow* aCaller );
|
||||
|
||||
/**
|
||||
* Function InvokeExportSVG
|
||||
* shows the Export SVG dialog
|
||||
* @param aCaller is the PCB_EDIT_FRAME which is invoking the dialog.
|
||||
* @param aBoard is the currently edited board.
|
||||
* @return bool - true if user pressed OK (did not abort), else false.
|
||||
*/
|
||||
bool InvokeExportSVG( PCB_EDIT_FRAME* aCaller, BOARD* aBoard );
|
||||
|
||||
#endif // INVOKE_A_DIALOG_H_
|
||||
|
@ -136,8 +136,6 @@ void PCB_EDIT_FRAME::doReCreateMenuBar()
|
||||
submenuExport->Add( _( "STEP / GLB / BREP / XAO / PLY / STL..." ),
|
||||
_( "Export STEP / GLB / BREP / XAO / PLY / STL 3D board representation" ),
|
||||
ID_GEN_EXPORT_FILE_STEP, BITMAPS::export_step );
|
||||
submenuExport->Add( _( "SVG..." ), _( "Export SVG board representation" ),
|
||||
ID_GEN_PLOT_SVG, BITMAPS::export_svg );
|
||||
submenuExport->Add( _( "Footprint Association (.cmp) File..." ),
|
||||
_( "Export footprint association file (*.cmp) for schematic back annotation" ),
|
||||
ID_PCB_GEN_CMP_FILE, BITMAPS::export_cmp );
|
||||
|
@ -174,7 +174,6 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
|
||||
EVT_MENU( ID_PCB_GEN_CMP_FILE, PCB_EDIT_FRAME::RecreateCmpFileFromBoard )
|
||||
|
||||
// Horizontal toolbar
|
||||
EVT_TOOL( ID_GEN_PLOT_SVG, PCB_EDIT_FRAME::ExportSVG )
|
||||
EVT_TOOL( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH, PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event )
|
||||
EVT_COMBOBOX( ID_TOOLBARH_PCB_SELECT_LAYER, PCB_EDIT_FRAME::Process_Special_Functions )
|
||||
EVT_CHOICE( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event )
|
||||
@ -1761,12 +1760,6 @@ void PCB_EDIT_FRAME::HardRedraw()
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::ExportSVG( wxCommandEvent& event )
|
||||
{
|
||||
InvokeExportSVG( this, GetBoard() );
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::UpdateTitle()
|
||||
{
|
||||
wxFileName fn = GetBoard()->GetFileName();
|
||||
@ -1919,6 +1912,9 @@ void PCB_EDIT_FRAME::ToPlotter( int aID )
|
||||
case ID_GEN_PLOT_PS:
|
||||
plotSettings.SetFormat( PLOT_FORMAT::POST );
|
||||
break;
|
||||
case ID_GEN_PLOT_SVG:
|
||||
plotSettings.SetFormat( PLOT_FORMAT::SVG );
|
||||
break;
|
||||
case ID_GEN_PLOT:
|
||||
/* keep the previous setup */
|
||||
break;
|
||||
|
@ -159,11 +159,6 @@ public:
|
||||
*/
|
||||
void ToPlotter( int aID );
|
||||
|
||||
/**
|
||||
* Show the Export to SVG file dialog.
|
||||
*/
|
||||
void ExportSVG( wxCommandEvent& event );
|
||||
|
||||
// User interface update command event handlers.
|
||||
void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent );
|
||||
|
||||
|
@ -78,7 +78,6 @@
|
||||
#include <wx/wfstream.h>
|
||||
#include <wx/zipstrm.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <dialogs/dialog_export_svg.h>
|
||||
#include <dialogs/dialog_gendrill.h>
|
||||
#include <dialogs/dialog_gen_footprint_position.h>
|
||||
#include <dialogs/dialog_export_2581.h>
|
||||
|
Loading…
Reference in New Issue
Block a user