2018-10-13 18:37:28 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2018-11-05 16:04:05 +00:00
|
|
|
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2019-01-13 21:20:29 +00:00
|
|
|
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
2018-10-13 18:37:28 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2019-09-06 18:57:04 +00:00
|
|
|
#include <html_messagebox.h>
|
|
|
|
|
2018-12-12 12:26:03 +00:00
|
|
|
#include "dialog_import_gfx.h"
|
|
|
|
#include <kiface_i.h>
|
2018-11-05 16:04:05 +00:00
|
|
|
#include <pcb_layer_box_selector.h>
|
|
|
|
#include <wildcards_and_files_ext.h>
|
2018-10-13 18:37:28 +00:00
|
|
|
#include <class_board.h>
|
|
|
|
#include <class_edge_mod.h>
|
|
|
|
#include <class_text_mod.h>
|
|
|
|
|
2019-12-05 13:43:55 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2019-04-03 13:57:31 +00:00
|
|
|
// Configuration path (group) to store entry keys below.
|
|
|
|
#define IMPORT_GFX_GROUP "ImportGraphics"
|
|
|
|
|
|
|
|
// Entry keys to store setup in config
|
|
|
|
#define IMPORT_GFX_LAYER_OPTION_KEY "BoardLayer"
|
|
|
|
#define IMPORT_GFX_PLACEMENT_INTERACTIVE_KEY "InteractivePlacement"
|
|
|
|
#define IMPORT_GFX_LAST_FILE_KEY "LastFile"
|
|
|
|
#define IMPORT_GFX_POSITION_UNITS_KEY "PositionUnits"
|
|
|
|
#define IMPORT_GFX_POSITION_X_KEY "PositionX"
|
|
|
|
#define IMPORT_GFX_POSITION_Y_KEY "PositionY"
|
|
|
|
#define IMPORT_GFX_LINEWIDTH_UNITS_KEY "LineWidthUnits"
|
|
|
|
#define IMPORT_GFX_LINEWIDTH_KEY "LineWidth"
|
|
|
|
|
|
|
|
|
|
|
|
// Static members of DIALOG_IMPORT_GFX, to remember the user's choices during the session
|
2018-10-13 18:37:28 +00:00
|
|
|
wxString DIALOG_IMPORT_GFX::m_filename;
|
2018-11-05 16:04:05 +00:00
|
|
|
bool DIALOG_IMPORT_GFX::m_placementInteractive = true;
|
2018-10-13 18:37:28 +00:00
|
|
|
LAYER_NUM DIALOG_IMPORT_GFX::m_layer = Dwgs_User;
|
2019-04-03 13:57:31 +00:00
|
|
|
double DIALOG_IMPORT_GFX::m_scaleImport = 1.0; // Do not change the imported items size
|
|
|
|
int DIALOG_IMPORT_GFX::m_originUnits = 0; // millimeter
|
|
|
|
int DIALOG_IMPORT_GFX::m_lineWidthUnits = 0; // millimeter
|
|
|
|
|
2018-10-13 18:37:28 +00:00
|
|
|
|
2018-11-05 16:04:05 +00:00
|
|
|
DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX( PCB_BASE_FRAME* aParent, bool aImportAsFootprintGraphic )
|
2018-10-13 18:37:28 +00:00
|
|
|
: DIALOG_IMPORT_GFX_BASE( aParent )
|
|
|
|
{
|
|
|
|
m_parent = aParent;
|
|
|
|
|
2018-11-05 16:04:05 +00:00
|
|
|
if( aImportAsFootprintGraphic )
|
2019-12-05 13:43:55 +00:00
|
|
|
m_importer = std::make_unique<GRAPHICS_IMPORTER_MODULE>( m_parent->GetBoard()->GetFirstModule() );
|
2018-10-13 18:37:28 +00:00
|
|
|
else
|
2019-12-05 13:43:55 +00:00
|
|
|
m_importer = std::make_unique<GRAPHICS_IMPORTER_BOARD>( m_parent->GetBoard() );
|
2018-10-13 18:37:28 +00:00
|
|
|
|
2018-12-12 12:26:03 +00:00
|
|
|
// construct an import manager with options from config
|
|
|
|
{
|
|
|
|
GRAPHICS_IMPORT_MGR::TYPE_LIST blacklist;
|
2019-03-11 17:30:59 +00:00
|
|
|
// Currently: all types are allowed, so the blacklist is empty
|
|
|
|
// (no GFX_FILE_T in the blacklist)
|
2019-03-11 18:25:52 +00:00
|
|
|
// To disable SVG import, enable these 2 lines
|
|
|
|
// if( !ADVANCED_CFG::GetCfg().m_enableSvgImport )
|
|
|
|
// blacklist.push_back( GRAPHICS_IMPORT_MGR::SVG );
|
2019-07-16 01:31:07 +00:00
|
|
|
// 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).
|
2019-03-11 18:25:52 +00:00
|
|
|
|
2018-12-12 12:26:03 +00:00
|
|
|
m_gfxImportMgr = std::make_unique<GRAPHICS_IMPORT_MGR>( blacklist );
|
|
|
|
}
|
|
|
|
|
2018-10-13 18:37:28 +00:00
|
|
|
m_config = Kiface().KifaceSettings();
|
2019-04-03 13:57:31 +00:00
|
|
|
m_originUnits = 0;
|
|
|
|
m_origin.x = 0.0; // always in mm
|
|
|
|
m_origin.y = 0.0; // always in mm
|
|
|
|
m_lineWidth = 0.2; // always in mm
|
|
|
|
m_lineWidthUnits = 0;
|
2018-10-13 18:37:28 +00:00
|
|
|
|
|
|
|
if( m_config )
|
|
|
|
{
|
2019-04-03 13:57:31 +00:00
|
|
|
wxString tmp = m_config->GetPath();
|
|
|
|
m_config->SetPath( IMPORT_GFX_GROUP );
|
2018-10-13 18:37:28 +00:00
|
|
|
m_layer = m_config->Read( IMPORT_GFX_LAYER_OPTION_KEY, (long)Dwgs_User );
|
2018-11-05 16:04:05 +00:00
|
|
|
m_placementInteractive = m_config->Read( IMPORT_GFX_PLACEMENT_INTERACTIVE_KEY, true );
|
2018-10-13 18:37:28 +00:00
|
|
|
m_filename = m_config->Read( IMPORT_GFX_LAST_FILE_KEY, wxEmptyString );
|
2019-04-03 13:57:31 +00:00
|
|
|
m_config->Read( IMPORT_GFX_LINEWIDTH_KEY, &m_lineWidth, 0.2 );
|
|
|
|
m_config->Read( IMPORT_GFX_LINEWIDTH_UNITS_KEY, &m_lineWidthUnits, 0 );
|
|
|
|
m_config->Read( IMPORT_GFX_POSITION_UNITS_KEY, &m_originUnits, 0 );
|
|
|
|
m_config->Read( IMPORT_GFX_POSITION_X_KEY, &m_origin.x, 0.0 );
|
|
|
|
m_config->Read( IMPORT_GFX_POSITION_Y_KEY, &m_origin.y, 0.0 );
|
|
|
|
m_config->SetPath( tmp );
|
2018-10-13 18:37:28 +00:00
|
|
|
}
|
|
|
|
|
2019-04-03 13:57:31 +00:00
|
|
|
m_choiceUnitLineWidth->SetSelection( m_lineWidthUnits );
|
2018-11-05 16:04:05 +00:00
|
|
|
showPCBdefaultLineWidth();
|
|
|
|
|
2019-04-03 13:57:31 +00:00
|
|
|
m_DxfPcbPositionUnits->SetSelection( m_originUnits );
|
2018-11-05 16:04:05 +00:00
|
|
|
showPcbImportOffsets();
|
2018-10-13 18:37:28 +00:00
|
|
|
|
|
|
|
m_textCtrlFileName->SetValue( m_filename );
|
2018-11-05 16:04:05 +00:00
|
|
|
m_rbInteractivePlacement->SetValue( m_placementInteractive );
|
|
|
|
m_rbAbsolutePlacement->SetValue( not m_placementInteractive );
|
|
|
|
|
|
|
|
m_textCtrlImportScale->SetValue( wxString::Format( "%f", m_scaleImport ) );
|
2018-10-13 18:37:28 +00:00
|
|
|
|
|
|
|
// Configure the layers list selector
|
2019-04-03 13:57:31 +00:00
|
|
|
m_SelLayerBox->SetLayersHotkeys( false ); // Do not display hotkeys
|
|
|
|
m_SelLayerBox->SetNotAllowedLayerSet( LSET::AllCuMask() ); // Do not use copper layers
|
2018-10-13 18:37:28 +00:00
|
|
|
m_SelLayerBox->SetBoardFrame( m_parent );
|
|
|
|
m_SelLayerBox->Resync();
|
|
|
|
|
|
|
|
if( m_SelLayerBox->SetLayerSelection( m_layer ) < 0 )
|
|
|
|
{
|
|
|
|
m_layer = Dwgs_User;
|
|
|
|
m_SelLayerBox->SetLayerSelection( m_layer );
|
|
|
|
}
|
|
|
|
|
2019-04-03 13:57:31 +00:00
|
|
|
SetInitialFocus( m_textCtrlFileName );
|
2018-11-01 09:47:41 +00:00
|
|
|
m_sdbSizerOK->SetDefault();
|
2018-10-13 18:37:28 +00:00
|
|
|
GetSizer()->Fit( this );
|
|
|
|
GetSizer()->SetSizeHints( this );
|
|
|
|
Centre();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DIALOG_IMPORT_GFX::~DIALOG_IMPORT_GFX()
|
|
|
|
{
|
|
|
|
if( m_config )
|
|
|
|
{
|
2019-04-03 13:57:31 +00:00
|
|
|
wxString tmp = m_config->GetPath();
|
|
|
|
m_config->SetPath( IMPORT_GFX_GROUP );
|
2018-10-13 18:37:28 +00:00
|
|
|
m_config->Write( IMPORT_GFX_LAYER_OPTION_KEY, (long)m_layer );
|
2018-11-05 16:04:05 +00:00
|
|
|
m_config->Write( IMPORT_GFX_PLACEMENT_INTERACTIVE_KEY, m_placementInteractive );
|
2018-10-13 18:37:28 +00:00
|
|
|
m_config->Write( IMPORT_GFX_LAST_FILE_KEY, m_filename );
|
|
|
|
|
2019-04-03 13:57:31 +00:00
|
|
|
m_config->Write( IMPORT_GFX_POSITION_UNITS_KEY, m_originUnits );
|
|
|
|
m_config->Write( IMPORT_GFX_POSITION_X_KEY, m_origin.x );
|
|
|
|
m_config->Write( IMPORT_GFX_POSITION_Y_KEY, m_origin.y );
|
2018-11-05 16:04:05 +00:00
|
|
|
|
2019-04-03 13:57:31 +00:00
|
|
|
m_config->Write( IMPORT_GFX_LINEWIDTH_KEY, m_lineWidth );
|
|
|
|
m_config->Write( IMPORT_GFX_LINEWIDTH_UNITS_KEY, m_lineWidthUnits );
|
|
|
|
m_config->SetPath( tmp );
|
2018-11-05 16:04:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX::onUnitPositionSelection( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
// Collect last entered values:
|
|
|
|
updatePcbImportOffsets_mm();
|
|
|
|
|
2019-04-03 13:57:31 +00:00
|
|
|
m_originUnits = m_DxfPcbPositionUnits->GetSelection();;
|
2018-11-05 16:04:05 +00:00
|
|
|
showPcbImportOffsets();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
double DIALOG_IMPORT_GFX::getPCBdefaultLineWidthMM()
|
|
|
|
{
|
2019-12-20 14:11:39 +00:00
|
|
|
double value = DoubleValueFromString( EDA_UNITS::UNSCALED, m_textCtrlLineWidth->GetValue() );
|
2018-11-05 16:04:05 +00:00
|
|
|
|
2019-04-03 13:57:31 +00:00
|
|
|
switch( m_lineWidthUnits )
|
2018-11-05 16:04:05 +00:00
|
|
|
{
|
2019-04-03 13:57:31 +00:00
|
|
|
default:
|
2019-07-16 01:31:07 +00:00
|
|
|
case 0: break; // display units = mm
|
|
|
|
case 1: value *= 25.4 / 1000; break; // display units = mil
|
|
|
|
case 2: value *= 25.4; break; // display units = inch
|
2018-11-05 16:04:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return value; // value is in mm
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_IMPORT_GFX::onUnitWidthSelection( wxCommandEvent& event )
|
|
|
|
{
|
2019-04-03 13:57:31 +00:00
|
|
|
m_lineWidth = getPCBdefaultLineWidthMM();
|
2018-11-05 16:04:05 +00:00
|
|
|
|
|
|
|
// Switch to new units
|
2019-04-03 13:57:31 +00:00
|
|
|
m_lineWidthUnits = m_choiceUnitLineWidth->GetSelection();
|
2018-11-05 16:04:05 +00:00
|
|
|
showPCBdefaultLineWidth();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_IMPORT_GFX::showPcbImportOffsets()
|
|
|
|
{
|
2019-04-03 13:57:31 +00:00
|
|
|
// Display m_origin value according to the unit selection:
|
|
|
|
VECTOR2D offset = m_origin;
|
2018-11-05 16:04:05 +00:00
|
|
|
|
2019-04-03 13:57:31 +00:00
|
|
|
if( m_originUnits ) // Units are inches
|
|
|
|
offset = m_origin / 25.4;
|
2018-11-05 16:04:05 +00:00
|
|
|
|
|
|
|
m_DxfPcbXCoord->SetValue( wxString::Format( "%f", offset.x ) );
|
|
|
|
m_DxfPcbYCoord->SetValue( wxString::Format( "%f", offset.y ) );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_IMPORT_GFX::showPCBdefaultLineWidth()
|
|
|
|
{
|
|
|
|
double value;
|
|
|
|
|
2019-04-03 13:57:31 +00:00
|
|
|
switch( m_lineWidthUnits )
|
2018-11-05 16:04:05 +00:00
|
|
|
{
|
2019-04-03 13:57:31 +00:00
|
|
|
default:
|
2019-07-16 01:31:07 +00:00
|
|
|
case 0: value = m_lineWidth; break; // display units = mm
|
|
|
|
case 1: value = m_lineWidth / 25.4 * 1000; break; // display units = mil
|
|
|
|
case 2: value = m_lineWidth / 25.4; break; // display units = inch
|
2018-10-13 18:37:28 +00:00
|
|
|
}
|
2018-11-05 16:04:05 +00:00
|
|
|
|
|
|
|
m_textCtrlLineWidth->SetValue( wxString::Format( "%f", value ) );
|
2018-10-13 18:37:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-11-05 16:04:05 +00:00
|
|
|
void DIALOG_IMPORT_GFX::onBrowseFiles( wxCommandEvent& event )
|
2018-10-13 18:37:28 +00:00
|
|
|
{
|
|
|
|
wxString path;
|
|
|
|
wxString filename;
|
|
|
|
|
|
|
|
if( !m_filename.IsEmpty() )
|
|
|
|
{
|
|
|
|
wxFileName fn( m_filename );
|
|
|
|
path = fn.GetPath();
|
|
|
|
filename = fn.GetFullName();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Generate the list of handled file formats
|
|
|
|
wxString wildcardsDesc;
|
|
|
|
wxString allWildcards;
|
|
|
|
|
2018-12-12 12:26:03 +00:00
|
|
|
for( auto pluginType : m_gfxImportMgr->GetImportableFileTypes() )
|
2018-10-13 18:37:28 +00:00
|
|
|
{
|
2018-12-12 12:26:03 +00:00
|
|
|
auto plugin = m_gfxImportMgr->GetPlugin( pluginType );
|
2019-09-26 20:09:09 +00:00
|
|
|
const auto extensions = plugin->GetFileExtensions();
|
2018-10-13 18:37:28 +00:00
|
|
|
|
2019-09-26 20:09:09 +00:00
|
|
|
wildcardsDesc += "|" + plugin->GetName() + AddFileExtListToFilter( extensions );
|
|
|
|
allWildcards += plugin->GetWildcards() + ";";
|
2018-10-13 18:37:28 +00:00
|
|
|
}
|
|
|
|
|
2019-04-03 13:57:31 +00:00
|
|
|
wildcardsDesc = _( "All supported formats|" ) + allWildcards + wildcardsDesc;
|
2018-10-13 18:37:28 +00:00
|
|
|
|
2019-07-16 01:31:07 +00:00
|
|
|
wxFileDialog dlg( m_parent, _( "Open File" ), path, filename, wildcardsDesc,
|
|
|
|
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
2018-10-13 18:37:28 +00:00
|
|
|
|
|
|
|
if( dlg.ShowModal() != wxID_OK )
|
|
|
|
return;
|
|
|
|
|
|
|
|
wxString fileName = dlg.GetPath();
|
|
|
|
|
|
|
|
if( fileName.IsEmpty() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
m_filename = fileName;
|
|
|
|
m_textCtrlFileName->SetValue( fileName );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-04-03 13:57:31 +00:00
|
|
|
bool DIALOG_IMPORT_GFX::TransferDataFromWindow()
|
2018-10-13 18:37:28 +00:00
|
|
|
{
|
2019-04-03 13:57:31 +00:00
|
|
|
if( !wxDialog::TransferDataFromWindow() )
|
|
|
|
return false;
|
|
|
|
|
2018-10-13 18:37:28 +00:00
|
|
|
m_filename = m_textCtrlFileName->GetValue();
|
|
|
|
|
|
|
|
if( m_filename.IsEmpty() )
|
2018-11-05 16:04:05 +00:00
|
|
|
{
|
2019-04-03 13:57:31 +00:00
|
|
|
wxMessageBox( _( "No file selected!" ) );
|
|
|
|
return false;
|
2018-11-05 16:04:05 +00:00
|
|
|
}
|
2018-10-13 18:37:28 +00:00
|
|
|
|
2019-04-03 13:57:31 +00:00
|
|
|
m_originUnits = m_DxfPcbPositionUnits->GetSelection();
|
|
|
|
updatePcbImportOffsets_mm(); // Update m_originX and m_originY;
|
2018-10-13 18:37:28 +00:00
|
|
|
|
2018-11-05 16:04:05 +00:00
|
|
|
m_layer = m_SelLayerBox->GetLayerSelection();
|
2018-10-13 18:37:28 +00:00
|
|
|
|
2018-11-05 16:04:05 +00:00
|
|
|
if( m_layer < 0 )
|
2018-10-13 18:37:28 +00:00
|
|
|
{
|
2019-04-03 13:57:31 +00:00
|
|
|
wxMessageBox( _( "Please select a valid layer." ) );
|
|
|
|
return false;
|
2018-10-13 18:37:28 +00:00
|
|
|
}
|
|
|
|
|
2019-04-03 13:57:31 +00:00
|
|
|
m_lineWidthUnits = m_choiceUnitLineWidth->GetSelection();
|
|
|
|
m_lineWidth = getPCBdefaultLineWidthMM();
|
2018-11-05 16:04:05 +00:00
|
|
|
|
2018-10-13 18:37:28 +00:00
|
|
|
m_importer->SetLayer( PCB_LAYER_ID( m_layer ) );
|
2018-12-12 12:26:03 +00:00
|
|
|
|
|
|
|
auto plugin = m_gfxImportMgr->GetPluginByExt( wxFileName( m_filename ).GetExt() );
|
2018-10-13 18:37:28 +00:00
|
|
|
|
|
|
|
if( plugin )
|
|
|
|
{
|
2018-11-05 16:04:05 +00:00
|
|
|
// Set coordinates offset for import (offset is given in mm)
|
2019-04-03 13:57:31 +00:00
|
|
|
m_importer->SetImportOffsetMM( m_origin );
|
2019-12-20 14:11:39 +00:00
|
|
|
m_scaleImport =
|
|
|
|
DoubleValueFromString( EDA_UNITS::UNSCALED, m_textCtrlImportScale->GetValue() );
|
2018-11-05 16:04:05 +00:00
|
|
|
|
2019-09-06 18:57:04 +00:00
|
|
|
// The line width is meant to be in pcbnew units, so we scale the import width before
|
|
|
|
// applying
|
2019-08-21 12:13:18 +00:00
|
|
|
m_importer->SetLineWidthMM( m_lineWidth * m_scaleImport );
|
2018-10-13 18:37:28 +00:00
|
|
|
m_importer->SetPlugin( std::move( plugin ) );
|
|
|
|
|
2018-11-05 16:04:05 +00:00
|
|
|
LOCALE_IO dummy; // Ensure floats can be read.
|
|
|
|
|
2018-10-13 18:37:28 +00:00
|
|
|
if( m_importer->Load( m_filename ) )
|
2018-11-05 16:04:05 +00:00
|
|
|
m_importer->Import( m_scaleImport );
|
2018-10-13 18:37:28 +00:00
|
|
|
|
2018-11-05 16:04:05 +00:00
|
|
|
// Get warning messages:
|
2019-09-06 18:57:04 +00:00
|
|
|
wxString warnings = m_importer->GetMessages();
|
2018-11-05 16:04:05 +00:00
|
|
|
|
2019-04-03 13:57:31 +00:00
|
|
|
// This isn't a fatal error so allow the dialog to close with wxID_OK.
|
2018-11-05 16:04:05 +00:00
|
|
|
if( !warnings.empty() )
|
2019-09-06 18:57:04 +00:00
|
|
|
{
|
|
|
|
HTML_MESSAGE_BOX dlg( this, _( "Warning" ) );
|
|
|
|
dlg.MessageSet( _( "Items in the imported file could not be handled properly." ) );
|
|
|
|
warnings.Replace( "\n", "<br/>" );
|
|
|
|
dlg.AddHTML_Text( warnings );
|
|
|
|
dlg.ShowModal();
|
|
|
|
}
|
2018-10-13 18:37:28 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-04-03 13:57:31 +00:00
|
|
|
wxMessageBox( _( "There is no plugin to handle this file type." ) );
|
|
|
|
return false;
|
2018-10-13 18:37:28 +00:00
|
|
|
}
|
2019-04-03 13:57:31 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_IMPORT_GFX::originOptionOnUpdateUI( wxUpdateUIEvent& event )
|
|
|
|
{
|
|
|
|
if( m_rbInteractivePlacement->GetValue() != m_placementInteractive )
|
|
|
|
m_rbInteractivePlacement->SetValue( m_placementInteractive );
|
|
|
|
|
|
|
|
if( m_rbAbsolutePlacement->GetValue() == m_placementInteractive )
|
|
|
|
m_rbAbsolutePlacement->SetValue( not m_placementInteractive );
|
|
|
|
|
|
|
|
m_DxfPcbPositionUnits->Enable( not m_placementInteractive );
|
|
|
|
m_DxfPcbXCoord->Enable( not m_placementInteractive );
|
|
|
|
m_DxfPcbYCoord->Enable( not m_placementInteractive );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_IMPORT_GFX::updatePcbImportOffsets_mm()
|
|
|
|
{
|
2019-12-20 14:11:39 +00:00
|
|
|
m_origin.x = DoubleValueFromString( EDA_UNITS::UNSCALED, m_DxfPcbXCoord->GetValue() );
|
|
|
|
m_origin.y = DoubleValueFromString( EDA_UNITS::UNSCALED, m_DxfPcbYCoord->GetValue() );
|
2019-04-03 13:57:31 +00:00
|
|
|
|
|
|
|
if( m_originUnits ) // Units are inches
|
|
|
|
m_origin = m_origin * 25.4;
|
2018-10-13 18:37:28 +00:00
|
|
|
}
|
|
|
|
|
2018-11-05 16:04:05 +00:00
|
|
|
|