25 changed files with 2668 additions and 212 deletions
-
39common/import_gfx/graphics_importer.h
-
65common/import_gfx/graphics_importer_buffer.cpp
-
110common/import_gfx/graphics_importer_buffer.h
-
90common/import_gfx/svg_import_plugin.cpp
-
11common/import_gfx/svg_import_plugin.h
-
2eeschema/CMakeLists.txt
-
22eeschema/eeschema_settings.cpp
-
14eeschema/eeschema_settings.h
-
311eeschema/import_gfx/dialog_import_gfx_sch.cpp
-
90eeschema/import_gfx/dialog_import_gfx_sch.h
-
223eeschema/import_gfx/dialog_import_gfx_sch_base.cpp
-
1388eeschema/import_gfx/dialog_import_gfx_sch_base.fbp
-
82eeschema/import_gfx/dialog_import_gfx_sch_base.h
-
103eeschema/import_gfx/graphics_importer_lib_symbol.cpp
-
23eeschema/import_gfx/graphics_importer_lib_symbol.h
-
10eeschema/symbol_editor/menubar_symbol_editor.cpp
-
1eeschema/symbol_editor/symbol_edit_frame.cpp
-
22eeschema/symbol_editor/symbol_editor_settings.cpp
-
14eeschema/symbol_editor/symbol_editor_settings.h
-
10eeschema/tools/ee_actions.cpp
-
1eeschema/tools/ee_actions.h
-
171eeschema/tools/symbol_editor_drawing_tools.cpp
-
1eeschema/tools/symbol_editor_drawing_tools.h
-
54pcbnew/import_gfx/graphics_importer_pcbnew.cpp
-
23pcbnew/import_gfx/graphics_importer_pcbnew.h
@ -0,0 +1,311 @@ |
|||
/*
|
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr |
|||
* Copyright (C) 1992-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 "dialog_import_gfx_sch.h"
|
|||
|
|||
#include <map>
|
|||
|
|||
#include <import_gfx/graphics_importer_lib_symbol.h>
|
|||
#include <import_gfx/dxf_import_plugin.h>
|
|||
|
|||
#include <base_units.h>
|
|||
#include <kiface_base.h>
|
|||
#include <locale_io.h>
|
|||
#include <bitmaps.h>
|
|||
#include <wildcards_and_files_ext.h>
|
|||
|
|||
#include <eeschema_settings.h>
|
|||
#include <sch_edit_frame.h>
|
|||
#include <symbol_editor_settings.h>
|
|||
#include <symbol_edit_frame.h>
|
|||
|
|||
#include <wx/filedlg.h>
|
|||
#include <wx/msgdlg.h>
|
|||
|
|||
#include <dialogs/html_message_box.h>
|
|||
#include <widgets/std_bitmap_button.h>
|
|||
|
|||
#include <memory>
|
|||
|
|||
// Static members of DIALOG_IMPORT_GFX_SCH, to remember the user's choices during the session
|
|||
bool DIALOG_IMPORT_GFX_SCH::m_placementInteractive = true; |
|||
double DIALOG_IMPORT_GFX_SCH::m_importScale = 1.0; // Do not change the imported items size
|
|||
|
|||
|
|||
const std::map<DXF_IMPORT_UNITS, wxString> dxfUnitsMap = { |
|||
{ DXF_IMPORT_UNITS::INCHES, _( "Inches" ) }, |
|||
{ DXF_IMPORT_UNITS::MILLIMETERS, _( "Millimeters" ) }, |
|||
{ DXF_IMPORT_UNITS::MILS, _( "Mils" ) }, |
|||
{ DXF_IMPORT_UNITS::CENTIMETERS, _( "Centimeter" ) }, |
|||
{ DXF_IMPORT_UNITS::FEET, _( "Feet" ) }, |
|||
}; |
|||
|
|||
|
|||
DIALOG_IMPORT_GFX_SCH::DIALOG_IMPORT_GFX_SCH( SCH_BASE_FRAME* aParent ) : |
|||
DIALOG_IMPORT_GFX_SCH_BASE( aParent ), |
|||
m_parent( aParent ), |
|||
m_xOrigin( aParent, m_xLabel, m_xCtrl, m_xUnits ), |
|||
m_yOrigin( aParent, m_yLabel, m_yCtrl, m_yUnits ), |
|||
m_defaultLineWidth( aParent, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits ) |
|||
{ |
|||
auto initWidgetsFromSettings = [&]( const auto& aCfg ) |
|||
{ |
|||
m_placementInteractive = aCfg->m_ImportGraphics.interactive_placement; |
|||
|
|||
m_xOrigin.SetValue( aCfg->m_ImportGraphics.origin_x * schIUScale.IU_PER_MM ); |
|||
m_yOrigin.SetValue( aCfg->m_ImportGraphics.origin_y * schIUScale.IU_PER_MM ); |
|||
m_defaultLineWidth.SetValue( aCfg->m_ImportGraphics.dxf_line_width * schIUScale.IU_PER_MM ); |
|||
|
|||
m_textCtrlFileName->SetValue( aCfg->m_ImportGraphics.last_file ); |
|||
m_rbInteractivePlacement->SetValue( m_placementInteractive ); |
|||
m_rbAbsolutePlacement->SetValue( !m_placementInteractive ); |
|||
|
|||
m_importScaleCtrl->SetValue( wxString::Format( wxT( "%f" ), m_importScale ) ); |
|||
|
|||
for( const std::pair<const DXF_IMPORT_UNITS, wxString>& unitEntry : dxfUnitsMap ) |
|||
m_choiceDxfUnits->Append( unitEntry.second ); |
|||
|
|||
m_choiceDxfUnits->SetSelection( aCfg->m_ImportGraphics.dxf_units ); |
|||
|
|||
m_browseButton->SetBitmap( KiBitmap( BITMAPS::small_folder ) ); |
|||
}; |
|||
|
|||
if( SYMBOL_EDIT_FRAME* symFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( aParent ) ) |
|||
{ |
|||
m_importer = std::make_unique<GRAPHICS_IMPORTER_LIB_SYMBOL>( symFrame->GetCurSymbol(), |
|||
symFrame->GetUnit() ); |
|||
|
|||
SYMBOL_EDITOR_SETTINGS* cfg = m_parent->libeditconfig(); |
|||
initWidgetsFromSettings( cfg ); |
|||
} |
|||
else if( SCH_EDIT_FRAME* schFrame = dynamic_cast<SCH_EDIT_FRAME*>( aParent ) ) |
|||
{ |
|||
/*m_importer = std::make_unique<GRAPHICS_IMPORTER_SCH>( symFrame );
|
|||
|
|||
EESCHEMA_SETTINGS* cfg = m_parent->eeconfig(); |
|||
initWidgetsFromSettings( cfg );*/ |
|||
} |
|||
|
|||
// construct an import manager with options from config
|
|||
{ |
|||
GRAPHICS_IMPORT_MGR::TYPE_LIST blacklist; |
|||
// Currently: all types are allowed, so the blacklist is empty
|
|||
// (no GFX_FILE_T in the blacklist)
|
|||
// To disable SVG import, enable these 2 lines
|
|||
// if( !ADVANCED_CFG::GetCfg().m_enableSvgImport )
|
|||
// blacklist.push_back( GRAPHICS_IMPORT_MGR::SVG );
|
|||
// The SVG import has currently a flaw: all SVG shapes are imported as curves and
|
|||
// converted to a lot of segments. A better approach is to convert to polylines
|
|||
// (not yet existing in Pcbnew) and keep arcs and circles as primitives (not yet
|
|||
// possible with tinysvg library).
|
|||
|
|||
m_gfxImportMgr = std::make_unique<GRAPHICS_IMPORT_MGR>( blacklist ); |
|||
} |
|||
|
|||
wxCommandEvent dummy; |
|||
onFilename( dummy ); |
|||
|
|||
SetInitialFocus( m_textCtrlFileName ); |
|||
SetupStandardButtons(); |
|||
|
|||
GetSizer()->Fit( this ); |
|||
GetSizer()->SetSizeHints( this ); |
|||
Centre(); |
|||
|
|||
m_textCtrlFileName->Connect( wxEVT_COMMAND_TEXT_UPDATED, |
|||
wxCommandEventHandler( DIALOG_IMPORT_GFX_SCH::onFilename ), |
|||
nullptr, this ); |
|||
} |
|||
|
|||
|
|||
DIALOG_IMPORT_GFX_SCH::~DIALOG_IMPORT_GFX_SCH() |
|||
{ |
|||
auto saveToSettings = [&]( const auto& aCfg ) |
|||
{ |
|||
aCfg->m_ImportGraphics.interactive_placement = m_placementInteractive; |
|||
aCfg->m_ImportGraphics.last_file = m_textCtrlFileName->GetValue(); |
|||
aCfg->m_ImportGraphics.dxf_line_width = schIUScale.IUTomm( m_defaultLineWidth.GetValue() ); |
|||
aCfg->m_ImportGraphics.origin_x = schIUScale.IUTomm( m_xOrigin.GetValue() ); |
|||
aCfg->m_ImportGraphics.origin_y = schIUScale.IUTomm( m_yOrigin.GetValue() ); |
|||
aCfg->m_ImportGraphics.dxf_units = m_choiceDxfUnits->GetSelection(); |
|||
|
|||
m_importScale = EDA_UNIT_UTILS::UI::DoubleValueFromString( m_importScaleCtrl->GetValue() ); |
|||
}; |
|||
|
|||
if( SYMBOL_EDIT_FRAME* symFrame = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_parent ) ) |
|||
{ |
|||
m_importer = std::make_unique<GRAPHICS_IMPORTER_LIB_SYMBOL>( symFrame->GetCurSymbol(), |
|||
symFrame->GetUnit() ); |
|||
|
|||
SYMBOL_EDITOR_SETTINGS* cfg = m_parent->libeditconfig(); |
|||
saveToSettings( cfg ); |
|||
} |
|||
else if( SCH_EDIT_FRAME* schFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_parent ) ) |
|||
{ |
|||
/*m_importer = std::make_unique<GRAPHICS_IMPORTER_SCH>( symFrame );
|
|||
|
|||
EESCHEMA_SETTINGS* cfg = m_parent->eeconfig(); |
|||
saveToSettings( cfg );*/ |
|||
} |
|||
|
|||
m_textCtrlFileName->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, |
|||
wxCommandEventHandler( DIALOG_IMPORT_GFX_SCH::onFilename ), |
|||
nullptr, this ); |
|||
} |
|||
|
|||
|
|||
void DIALOG_IMPORT_GFX_SCH::onFilename( wxCommandEvent& event ) |
|||
{ |
|||
bool enableDXFControls = true; |
|||
wxString ext = wxFileName( m_textCtrlFileName->GetValue() ).GetExt(); |
|||
|
|||
if( std::unique_ptr<GRAPHICS_IMPORT_PLUGIN> plugin = m_gfxImportMgr->GetPluginByExt( ext ) ) |
|||
enableDXFControls = dynamic_cast<DXF_IMPORT_PLUGIN*>( plugin.get() ) != nullptr; |
|||
|
|||
m_defaultLineWidth.Enable( enableDXFControls ); |
|||
|
|||
m_staticTextLineWidth1->Enable( enableDXFControls ); |
|||
m_choiceDxfUnits->Enable( enableDXFControls ); |
|||
} |
|||
|
|||
|
|||
void DIALOG_IMPORT_GFX_SCH::onBrowseFiles( wxCommandEvent& event ) |
|||
{ |
|||
wxString path; |
|||
wxString filename = m_textCtrlFileName->GetValue(); |
|||
|
|||
if( !filename.IsEmpty() ) |
|||
{ |
|||
wxFileName fn( filename ); |
|||
path = fn.GetPath(); |
|||
filename = fn.GetFullName(); |
|||
} |
|||
|
|||
// Generate the list of handled file formats
|
|||
wxString wildcardsDesc; |
|||
wxString allWildcards; |
|||
|
|||
for( GRAPHICS_IMPORT_MGR::GFX_FILE_T pluginType : m_gfxImportMgr->GetImportableFileTypes() ) |
|||
{ |
|||
std::unique_ptr<GRAPHICS_IMPORT_PLUGIN> plugin = m_gfxImportMgr->GetPlugin( pluginType ); |
|||
const std::vector<std::string> extensions = plugin->GetFileExtensions(); |
|||
|
|||
wildcardsDesc += wxT( "|" ) + plugin->GetName() + AddFileExtListToFilter( extensions ); |
|||
allWildcards += plugin->GetWildcards() + wxT( ";" ); |
|||
} |
|||
|
|||
wildcardsDesc = _( "All supported formats" ) + wxT( "|" ) + allWildcards + wildcardsDesc; |
|||
|
|||
wxFileDialog dlg( m_parent, _( "Open File" ), path, filename, wildcardsDesc, |
|||
wxFD_OPEN | wxFD_FILE_MUST_EXIST ); |
|||
|
|||
if( dlg.ShowModal() == wxID_OK && !dlg.GetPath().IsEmpty() ) |
|||
m_textCtrlFileName->SetValue( dlg.GetPath() ); |
|||
} |
|||
|
|||
|
|||
bool DIALOG_IMPORT_GFX_SCH::TransferDataFromWindow() |
|||
{ |
|||
if( !wxDialog::TransferDataFromWindow() ) |
|||
return false; |
|||
|
|||
if( m_textCtrlFileName->GetValue().IsEmpty() ) |
|||
{ |
|||
wxMessageBox( _( "No file selected!" ) ); |
|||
return false; |
|||
} |
|||
|
|||
wxString ext = wxFileName( m_textCtrlFileName->GetValue() ).GetExt(); |
|||
double scale = EDA_UNIT_UTILS::UI::DoubleValueFromString( m_importScaleCtrl->GetValue() ); |
|||
double xscale = scale; |
|||
double yscale = scale; |
|||
|
|||
if( dynamic_cast<SYMBOL_EDIT_FRAME*>( m_parent ) ) |
|||
yscale *= -1; |
|||
|
|||
VECTOR2D origin( m_xOrigin.GetValue() / xscale, m_yOrigin.GetValue() / yscale ); |
|||
|
|||
if( std::unique_ptr<GRAPHICS_IMPORT_PLUGIN> plugin = m_gfxImportMgr->GetPluginByExt( ext ) ) |
|||
{ |
|||
if( DXF_IMPORT_PLUGIN* dxfPlugin = dynamic_cast<DXF_IMPORT_PLUGIN*>( plugin.get() ) ) |
|||
{ |
|||
auto it = dxfUnitsMap.begin(); |
|||
std::advance( it, m_choiceDxfUnits->GetSelection() ); |
|||
|
|||
if( it == dxfUnitsMap.end() ) |
|||
dxfPlugin->SetUnit( DXF_IMPORT_UNITS::DEFAULT ); |
|||
else |
|||
dxfPlugin->SetUnit( it->first ); |
|||
|
|||
m_importer->SetLineWidthMM( schIUScale.IUTomm( m_defaultLineWidth.GetValue() ) ); |
|||
} |
|||
else |
|||
{ |
|||
m_importer->SetLineWidthMM( 0.0 ); |
|||
} |
|||
|
|||
m_importer->SetPlugin( std::move( plugin ) ); |
|||
m_importer->SetImportOffsetMM( { schIUScale.IUTomm( origin.x ), schIUScale.IUTomm( origin.y ) } ); |
|||
|
|||
LOCALE_IO dummy; // Ensure floats can be read.
|
|||
|
|||
if( m_importer->Load( m_textCtrlFileName->GetValue() ) ) |
|||
m_importer->Import( VECTOR2D( xscale, yscale ) ); |
|||
|
|||
// Get warning messages:
|
|||
wxString warnings = m_importer->GetMessages(); |
|||
|
|||
// This isn't a fatal error so allow the dialog to close with wxID_OK.
|
|||
if( !warnings.empty() ) |
|||
{ |
|||
HTML_MESSAGE_BOX dlg( this, _( "Warning" ) ); |
|||
dlg.MessageSet( _( "Items in the imported file could not be handled properly." ) ); |
|||
warnings.Replace( wxT( "\n" ), wxT( "<br/>" ) ); |
|||
dlg.AddHTML_Text( warnings ); |
|||
dlg.ShowModal(); |
|||
} |
|||
|
|||
return true; |
|||
} |
|||
else |
|||
{ |
|||
wxMessageBox( _( "There is no plugin to handle this file type." ) ); |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
|
|||
void DIALOG_IMPORT_GFX_SCH::originOptionOnUpdateUI( wxUpdateUIEvent& event ) |
|||
{ |
|||
if( m_rbInteractivePlacement->GetValue() != m_placementInteractive ) |
|||
m_rbInteractivePlacement->SetValue( m_placementInteractive ); |
|||
|
|||
if( m_rbAbsolutePlacement->GetValue() == m_placementInteractive ) |
|||
m_rbAbsolutePlacement->SetValue( !m_placementInteractive ); |
|||
|
|||
m_xOrigin.Enable( !m_placementInteractive ); |
|||
m_yOrigin.Enable( !m_placementInteractive ); |
|||
} |
|||
|
|||
|
@ -0,0 +1,90 @@ |
|||
/* |
|||
* This program source code file is part of KiCad, a free EDA CAD application. |
|||
* |
|||
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr |
|||
* Copyright (C) 1992-2022 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 |
|||
*/ |
|||
|
|||
#ifndef __DIALOG_IMPORT_GFX_SCH_H__ |
|||
#define __DIALOG_IMPORT_GFX_SCH_H__ |
|||
|
|||
#include "dialog_import_gfx_sch_base.h" |
|||
|
|||
#include <import_gfx/graphics_importer.h> |
|||
#include <widgets/unit_binder.h> |
|||
|
|||
class SCH_BASE_FRAME; |
|||
class GRAPHICS_IMPORT_MGR; |
|||
|
|||
|
|||
class DIALOG_IMPORT_GFX_SCH : public DIALOG_IMPORT_GFX_SCH_BASE |
|||
{ |
|||
public: |
|||
DIALOG_IMPORT_GFX_SCH( SCH_BASE_FRAME* aParent ); |
|||
~DIALOG_IMPORT_GFX_SCH(); |
|||
|
|||
/** |
|||
* @return a list of items imported from a vector graphics file. |
|||
*/ |
|||
std::list<std::unique_ptr<EDA_ITEM>>& GetImportedItems() |
|||
{ |
|||
return m_importer->GetItems(); |
|||
} |
|||
|
|||
/** |
|||
* @return true if the placement is interactive, i.e. all imported |
|||
* items must be moved by the mouse cursor to the final position |
|||
* false means the imported items are placed to the final position after import. |
|||
*/ |
|||
bool IsPlacementInteractive() { return m_placementInteractive; } |
|||
|
|||
bool TransferDataFromWindow() override; |
|||
|
|||
private: |
|||
// Virtual event handlers |
|||
void onBrowseFiles( wxCommandEvent& event ) override; |
|||
void onFilename( wxCommandEvent& event ); |
|||
void originOptionOnUpdateUI( wxUpdateUIEvent& event ) override; |
|||
|
|||
void onInteractivePlacement( wxCommandEvent& event ) override |
|||
{ |
|||
m_placementInteractive = true; |
|||
} |
|||
|
|||
void onAbsolutePlacement( wxCommandEvent& event ) override |
|||
{ |
|||
m_placementInteractive = false; |
|||
} |
|||
|
|||
private: |
|||
SCH_BASE_FRAME* m_parent; |
|||
std::unique_ptr<GRAPHICS_IMPORTER> m_importer; |
|||
std::unique_ptr<GRAPHICS_IMPORT_MGR> m_gfxImportMgr; |
|||
|
|||
UNIT_BINDER m_xOrigin; |
|||
UNIT_BINDER m_yOrigin; |
|||
UNIT_BINDER m_defaultLineWidth; |
|||
|
|||
static bool m_placementInteractive; |
|||
static double m_importScale; // a scale factor to change the size of imported |
|||
// items m_importScale =1.0 means keep original size |
|||
}; |
|||
|
|||
#endif // __DIALOG_IMPORT_GFX_SCH_H__ |
@ -0,0 +1,223 @@ |
|||
///////////////////////////////////////////////////////////////////////////
|
|||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
|
|||
// http://www.wxformbuilder.org/
|
|||
//
|
|||
// PLEASE DO *NOT* EDIT THIS FILE!
|
|||
///////////////////////////////////////////////////////////////////////////
|
|||
|
|||
#include "widgets/std_bitmap_button.h"
|
|||
|
|||
#include "dialog_import_gfx_sch_base.h"
|
|||
|
|||
///////////////////////////////////////////////////////////////////////////
|
|||
|
|||
DIALOG_IMPORT_GFX_SCH_BASE::DIALOG_IMPORT_GFX_SCH_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) |
|||
{ |
|||
this->SetSizeHints( wxDefaultSize, wxDefaultSize ); |
|||
|
|||
wxBoxSizer* bSizerMain; |
|||
bSizerMain = new wxBoxSizer( wxVERTICAL ); |
|||
|
|||
wxBoxSizer* bSizerFile; |
|||
bSizerFile = new wxBoxSizer( wxHORIZONTAL ); |
|||
|
|||
m_staticTextFile = new wxStaticText( this, wxID_ANY, _("File:"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticTextFile->Wrap( -1 ); |
|||
m_staticTextFile->SetToolTip( _("Only vectors will be imported. Bitmaps and fonts will be ignored.") ); |
|||
|
|||
bSizerFile->Add( m_staticTextFile, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); |
|||
|
|||
m_textCtrlFileName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_textCtrlFileName->SetToolTip( _("Only vectors will be imported. Bitmaps and fonts will be ignored.") ); |
|||
m_textCtrlFileName->SetMinSize( wxSize( 300,-1 ) ); |
|||
|
|||
bSizerFile->Add( m_textCtrlFileName, 1, wxALIGN_CENTER_VERTICAL, 5 ); |
|||
|
|||
m_browseButton = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxBU_AUTODRAW|0 ); |
|||
bSizerFile->Add( m_browseButton, 0, wxTOP|wxBOTTOM, 5 ); |
|||
|
|||
|
|||
bSizerMain->Add( bSizerFile, 0, wxALL|wxEXPAND, 10 ); |
|||
|
|||
wxStaticBoxSizer* sbSizer2; |
|||
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Placement") ), wxVERTICAL ); |
|||
|
|||
wxBoxSizer* bSizerOptions; |
|||
bSizerOptions = new wxBoxSizer( wxVERTICAL ); |
|||
|
|||
m_rbInteractivePlacement = new wxRadioButton( sbSizer2->GetStaticBox(), wxID_ANY, _("Interactive placement"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_rbInteractivePlacement->SetValue( true ); |
|||
bSizerOptions->Add( m_rbInteractivePlacement, 0, wxEXPAND|wxBOTTOM, 5 ); |
|||
|
|||
wxBoxSizer* bSizerUserPos; |
|||
bSizerUserPos = new wxBoxSizer( wxHORIZONTAL ); |
|||
|
|||
m_rbAbsolutePlacement = new wxRadioButton( sbSizer2->GetStaticBox(), wxID_ANY, _("At"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
bSizerUserPos->Add( m_rbAbsolutePlacement, 0, wxALIGN_CENTER_VERTICAL, 5 ); |
|||
|
|||
wxBoxSizer* bSizerPosSettings; |
|||
bSizerPosSettings = new wxBoxSizer( wxHORIZONTAL ); |
|||
|
|||
m_xLabel = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("X:"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_xLabel->Wrap( -1 ); |
|||
bSizerPosSettings->Add( m_xLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); |
|||
|
|||
m_xCtrl = new wxTextCtrl( sbSizer2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); |
|||
#ifdef __WXGTK__
|
|||
if ( !m_xCtrl->HasFlag( wxTE_MULTILINE ) ) |
|||
{ |
|||
m_xCtrl->SetMaxLength( 10 ); |
|||
} |
|||
#else
|
|||
m_xCtrl->SetMaxLength( 10 ); |
|||
#endif
|
|||
m_xCtrl->SetToolTip( _("DXF origin on PCB Grid, X Coordinate") ); |
|||
|
|||
bSizerPosSettings->Add( m_xCtrl, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); |
|||
|
|||
m_xUnits = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_xUnits->Wrap( -1 ); |
|||
bSizerPosSettings->Add( m_xUnits, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxTOP, 5 ); |
|||
|
|||
m_yLabel = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Y:"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_yLabel->Wrap( -1 ); |
|||
bSizerPosSettings->Add( m_yLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); |
|||
|
|||
m_yCtrl = new wxTextCtrl( sbSizer2->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); |
|||
#ifdef __WXGTK__
|
|||
if ( !m_yCtrl->HasFlag( wxTE_MULTILINE ) ) |
|||
{ |
|||
m_yCtrl->SetMaxLength( 10 ); |
|||
} |
|||
#else
|
|||
m_yCtrl->SetMaxLength( 10 ); |
|||
#endif
|
|||
m_yCtrl->SetToolTip( _("DXF origin on PCB Grid, Y Coordinate") ); |
|||
|
|||
bSizerPosSettings->Add( m_yCtrl, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); |
|||
|
|||
m_yUnits = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_yUnits->Wrap( -1 ); |
|||
bSizerPosSettings->Add( m_yUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); |
|||
|
|||
|
|||
bSizerUserPos->Add( bSizerPosSettings, 1, wxBOTTOM|wxEXPAND|wxRIGHT|wxTOP, 5 ); |
|||
|
|||
|
|||
bSizerOptions->Add( bSizerUserPos, 0, wxEXPAND, 5 ); |
|||
|
|||
|
|||
sbSizer2->Add( bSizerOptions, 0, wxEXPAND|wxTOP|wxLEFT, 5 ); |
|||
|
|||
|
|||
bSizerMain->Add( sbSizer2, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 ); |
|||
|
|||
wxStaticBoxSizer* sbSizer1; |
|||
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Import Parameters") ), wxVERTICAL ); |
|||
|
|||
wxBoxSizer* bSizer7; |
|||
bSizer7 = new wxBoxSizer( wxHORIZONTAL ); |
|||
|
|||
wxFlexGridSizer* fgSizerImportSettings; |
|||
fgSizerImportSettings = new wxFlexGridSizer( 0, 3, 5, 5 ); |
|||
fgSizerImportSettings->AddGrowableCol( 1 ); |
|||
fgSizerImportSettings->SetFlexibleDirection( wxBOTH ); |
|||
fgSizerImportSettings->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); |
|||
|
|||
m_importScaleLabel = new wxStaticText( sbSizer1->GetStaticBox(), wxID_ANY, _("Import scale:"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_importScaleLabel->Wrap( -1 ); |
|||
fgSizerImportSettings->Add( m_importScaleLabel, 0, wxALIGN_CENTER_VERTICAL, 5 ); |
|||
|
|||
m_importScaleCtrl = new wxTextCtrl( sbSizer1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); |
|||
fgSizerImportSettings->Add( m_importScaleCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); |
|||
|
|||
|
|||
fgSizerImportSettings->Add( 0, 0, 0, 0, 5 ); |
|||
|
|||
|
|||
bSizer7->Add( fgSizerImportSettings, 1, wxEXPAND|wxALL, 5 ); |
|||
|
|||
|
|||
sbSizer1->Add( bSizer7, 1, wxEXPAND, 5 ); |
|||
|
|||
|
|||
bSizerMain->Add( sbSizer1, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 10 ); |
|||
|
|||
wxStaticBoxSizer* sbSizer3; |
|||
sbSizer3 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("DXF Parameters") ), wxVERTICAL ); |
|||
|
|||
wxBoxSizer* bSizer81; |
|||
bSizer81 = new wxBoxSizer( wxHORIZONTAL ); |
|||
|
|||
wxFlexGridSizer* fgDxfImportSettings; |
|||
fgDxfImportSettings = new wxFlexGridSizer( 0, 3, 5, 5 ); |
|||
fgDxfImportSettings->AddGrowableCol( 1 ); |
|||
fgDxfImportSettings->SetFlexibleDirection( wxBOTH ); |
|||
fgDxfImportSettings->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); |
|||
|
|||
m_lineWidthLabel = new wxStaticText( sbSizer3->GetStaticBox(), wxID_ANY, _("Default line width:"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_lineWidthLabel->Wrap( -1 ); |
|||
fgDxfImportSettings->Add( m_lineWidthLabel, 0, wxALIGN_CENTER_VERTICAL, 5 ); |
|||
|
|||
m_lineWidthCtrl = new wxTextCtrl( sbSizer3->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); |
|||
fgDxfImportSettings->Add( m_lineWidthCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); |
|||
|
|||
m_lineWidthUnits = new wxStaticText( sbSizer3->GetStaticBox(), wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_lineWidthUnits->Wrap( -1 ); |
|||
fgDxfImportSettings->Add( m_lineWidthUnits, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxTOP, 5 ); |
|||
|
|||
m_staticTextLineWidth1 = new wxStaticText( sbSizer3->GetStaticBox(), wxID_ANY, _("Default units:"), wxDefaultPosition, wxDefaultSize, 0 ); |
|||
m_staticTextLineWidth1->Wrap( -1 ); |
|||
fgDxfImportSettings->Add( m_staticTextLineWidth1, 0, wxALIGN_CENTER_VERTICAL, 5 ); |
|||
|
|||
wxArrayString m_choiceDxfUnitsChoices; |
|||
m_choiceDxfUnits = new wxChoice( sbSizer3->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceDxfUnitsChoices, 0 ); |
|||
m_choiceDxfUnits->SetSelection( 0 ); |
|||
fgDxfImportSettings->Add( m_choiceDxfUnits, 0, wxEXPAND, 5 ); |
|||
|
|||
|
|||
fgDxfImportSettings->Add( 0, 0, 1, wxEXPAND, 5 ); |
|||
|
|||
|
|||
bSizer81->Add( fgDxfImportSettings, 1, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); |
|||
|
|||
|
|||
sbSizer3->Add( bSizer81, 1, wxEXPAND, 5 ); |
|||
|
|||
|
|||
bSizerMain->Add( sbSizer3, 1, wxEXPAND|wxRIGHT|wxLEFT, 10 ); |
|||
|
|||
m_sdbSizer = new wxStdDialogButtonSizer(); |
|||
m_sdbSizerOK = new wxButton( this, wxID_OK ); |
|||
m_sdbSizer->AddButton( m_sdbSizerOK ); |
|||
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL ); |
|||
m_sdbSizer->AddButton( m_sdbSizerCancel ); |
|||
m_sdbSizer->Realize(); |
|||
|
|||
bSizerMain->Add( m_sdbSizer, 0, wxEXPAND|wxALL, 5 ); |
|||
|
|||
|
|||
this->SetSizer( bSizerMain ); |
|||
this->Layout(); |
|||
bSizerMain->Fit( this ); |
|||
|
|||
this->Centre( wxBOTH ); |
|||
|
|||
// Connect Events
|
|||
m_browseButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_GFX_SCH_BASE::onBrowseFiles ), NULL, this ); |
|||
m_rbInteractivePlacement->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_IMPORT_GFX_SCH_BASE::onInteractivePlacement ), NULL, this ); |
|||
m_rbInteractivePlacement->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_IMPORT_GFX_SCH_BASE::originOptionOnUpdateUI ), NULL, this ); |
|||
m_rbAbsolutePlacement->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_IMPORT_GFX_SCH_BASE::onAbsolutePlacement ), NULL, this ); |
|||
m_rbAbsolutePlacement->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_IMPORT_GFX_SCH_BASE::originOptionOnUpdateUI ), NULL, this ); |
|||
} |
|||
|
|||
DIALOG_IMPORT_GFX_SCH_BASE::~DIALOG_IMPORT_GFX_SCH_BASE() |
|||
{ |
|||
// Disconnect Events
|
|||
m_browseButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_IMPORT_GFX_SCH_BASE::onBrowseFiles ), NULL, this ); |
|||
m_rbInteractivePlacement->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_IMPORT_GFX_SCH_BASE::onInteractivePlacement ), NULL, this ); |
|||
m_rbInteractivePlacement->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_IMPORT_GFX_SCH_BASE::originOptionOnUpdateUI ), NULL, this ); |
|||
m_rbAbsolutePlacement->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_IMPORT_GFX_SCH_BASE::onAbsolutePlacement ), NULL, this ); |
|||
m_rbAbsolutePlacement->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_IMPORT_GFX_SCH_BASE::originOptionOnUpdateUI ), NULL, this ); |
|||
|
|||
} |
1388
eeschema/import_gfx/dialog_import_gfx_sch_base.fbp
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,82 @@ |
|||
/////////////////////////////////////////////////////////////////////////// |
|||
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3) |
|||
// 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; |
|||
|
|||
#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/radiobut.h> |
|||
#include <wx/valtext.h> |
|||
#include <wx/statbox.h> |
|||
#include <wx/choice.h> |
|||
#include <wx/dialog.h> |
|||
|
|||
/////////////////////////////////////////////////////////////////////////// |
|||
|
|||
|
|||
/////////////////////////////////////////////////////////////////////////////// |
|||
/// Class DIALOG_IMPORT_GFX_SCH_BASE |
|||
/////////////////////////////////////////////////////////////////////////////// |
|||
class DIALOG_IMPORT_GFX_SCH_BASE : public DIALOG_SHIM |
|||
{ |
|||
private: |
|||
|
|||
protected: |
|||
wxStaticText* m_staticTextFile; |
|||
wxTextCtrl* m_textCtrlFileName; |
|||
STD_BITMAP_BUTTON* m_browseButton; |
|||
wxRadioButton* m_rbInteractivePlacement; |
|||
wxRadioButton* m_rbAbsolutePlacement; |
|||
wxStaticText* m_xLabel; |
|||
wxTextCtrl* m_xCtrl; |
|||
wxStaticText* m_xUnits; |
|||
wxStaticText* m_yLabel; |
|||
wxTextCtrl* m_yCtrl; |
|||
wxStaticText* m_yUnits; |
|||
wxStaticText* m_importScaleLabel; |
|||
wxTextCtrl* m_importScaleCtrl; |
|||
wxStaticText* m_lineWidthLabel; |
|||
wxTextCtrl* m_lineWidthCtrl; |
|||
wxStaticText* m_lineWidthUnits; |
|||
wxStaticText* m_staticTextLineWidth1; |
|||
wxChoice* m_choiceDxfUnits; |
|||
wxStdDialogButtonSizer* m_sdbSizer; |
|||
wxButton* m_sdbSizerOK; |
|||
wxButton* m_sdbSizerCancel; |
|||
|
|||
// Virtual event handlers, override them in your derived class |
|||
virtual void onBrowseFiles( wxCommandEvent& event ) { event.Skip(); } |
|||
virtual void onInteractivePlacement( wxCommandEvent& event ) { event.Skip(); } |
|||
virtual void originOptionOnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); } |
|||
virtual void onAbsolutePlacement( wxCommandEvent& event ) { event.Skip(); } |
|||
|
|||
|
|||
public: |
|||
|
|||
DIALOG_IMPORT_GFX_SCH_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Import Vector Graphics File"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); |
|||
|
|||
~DIALOG_IMPORT_GFX_SCH_BASE(); |
|||
|
|||
}; |
|||
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue