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
|
2023-01-17 16:34:34 +00:00
|
|
|
* Copyright (C) 1992-2023 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
|
|
|
|
*/
|
|
|
|
|
2021-09-14 18:26:03 +00:00
|
|
|
#include <dialogs/html_message_box.h>
|
2019-09-06 18:57:04 +00:00
|
|
|
|
2023-10-18 13:20:34 +00:00
|
|
|
#include "dialog_import_graphics.h"
|
2023-08-18 12:55:01 +00:00
|
|
|
#include <import_gfx/dxf_import_plugin.h>
|
2022-08-27 17:23:43 +00:00
|
|
|
#include <base_units.h>
|
2021-09-14 22:45:14 +00:00
|
|
|
#include <kiface_base.h>
|
2020-10-24 01:38:50 +00:00
|
|
|
#include <locale_io.h>
|
2018-11-05 16:04:05 +00:00
|
|
|
#include <pcb_layer_box_selector.h>
|
|
|
|
#include <wildcards_and_files_ext.h>
|
2020-11-23 11:44:46 +00:00
|
|
|
#include <bitmaps.h>
|
2022-12-13 20:47:28 +00:00
|
|
|
#include <widgets/std_bitmap_button.h>
|
2020-11-22 03:11:24 +00:00
|
|
|
#include <map>
|
2023-10-18 13:20:34 +00:00
|
|
|
#include <footprint.h>
|
2021-05-01 07:50:29 +00:00
|
|
|
#include <wx/filedlg.h>
|
2021-06-06 12:41:16 +00:00
|
|
|
#include <wx/msgdlg.h>
|
2018-10-13 18:37:28 +00:00
|
|
|
|
2019-12-05 13:43:55 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2023-10-18 13:20:34 +00:00
|
|
|
// Static members of DIALOG_IMPORT_GRAPHICS, to remember the user's choices during the session
|
|
|
|
bool DIALOG_IMPORT_GRAPHICS::s_placementInteractive = true;
|
|
|
|
bool DIALOG_IMPORT_GRAPHICS::s_fixDiscontinuities = true;
|
|
|
|
int DIALOG_IMPORT_GRAPHICS::s_toleranceValue = pcbIUScale.mmToIU( 1 );
|
|
|
|
double DIALOG_IMPORT_GRAPHICS::s_importScale = 1.0; // Do not change the imported items size
|
2022-09-12 23:58:55 +00:00
|
|
|
|
2020-11-22 03:11:24 +00:00
|
|
|
|
|
|
|
const std::map<DXF_IMPORT_UNITS, wxString> dxfUnitsMap = {
|
2022-09-12 23:58:55 +00:00
|
|
|
{ DXF_IMPORT_UNITS::INCHES, _( "Inches" ) },
|
2020-11-22 03:11:24 +00:00
|
|
|
{ DXF_IMPORT_UNITS::MILLIMETERS, _( "Millimeters" ) },
|
2022-09-12 23:58:55 +00:00
|
|
|
{ DXF_IMPORT_UNITS::MILS, _( "Mils" ) },
|
2020-11-22 03:11:24 +00:00
|
|
|
{ DXF_IMPORT_UNITS::CENTIMETERS, _( "Centimeter" ) },
|
2022-09-12 23:58:55 +00:00
|
|
|
{ DXF_IMPORT_UNITS::FEET, _( "Feet" ) },
|
2020-11-22 03:11:24 +00:00
|
|
|
};
|
2019-04-03 13:57:31 +00:00
|
|
|
|
2018-10-13 18:37:28 +00:00
|
|
|
|
2023-10-18 13:20:34 +00:00
|
|
|
DIALOG_IMPORT_GRAPHICS::DIALOG_IMPORT_GRAPHICS( PCB_BASE_FRAME* aParent ) :
|
|
|
|
DIALOG_IMPORT_GRAPHICS_BASE( aParent ),
|
2022-09-12 23:58:55 +00:00
|
|
|
m_parent( aParent ),
|
2023-10-18 13:20:34 +00:00
|
|
|
m_xOrigin( aParent, nullptr, m_xCtrl, nullptr ),
|
2022-09-12 23:58:55 +00:00
|
|
|
m_yOrigin( aParent, m_yLabel, m_yCtrl, m_yUnits ),
|
2023-10-17 07:27:59 +00:00
|
|
|
m_defaultLineWidth( aParent, m_lineWidthLabel, m_lineWidthCtrl, m_lineWidthUnits ),
|
|
|
|
m_tolerance( aParent, m_toleranceLabel, m_toleranceCtrl, m_toleranceUnits )
|
2018-10-13 18:37:28 +00:00
|
|
|
{
|
2023-10-18 13:20:34 +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).
|
2018-10-13 18:37:28 +00:00
|
|
|
|
2023-10-18 13:20:34 +00:00
|
|
|
m_importer = std::make_unique<GRAPHICS_IMPORTER_PCBNEW>( aParent->GetModel() );
|
|
|
|
m_gfxImportMgr = std::make_unique<GRAPHICS_IMPORT_MGR>();
|
2018-12-12 12:26:03 +00:00
|
|
|
|
2022-09-12 23:58:55 +00:00
|
|
|
PCBNEW_SETTINGS* cfg = m_parent->GetPcbNewSettings();
|
2018-10-13 18:37:28 +00:00
|
|
|
|
2023-10-17 07:27:59 +00:00
|
|
|
s_placementInteractive = cfg->m_ImportGraphics.interactive_placement;
|
2018-11-05 16:04:05 +00:00
|
|
|
|
2022-09-17 00:45:14 +00:00
|
|
|
m_xOrigin.SetValue( cfg->m_ImportGraphics.origin_x * pcbIUScale.IU_PER_MM );
|
|
|
|
m_yOrigin.SetValue( cfg->m_ImportGraphics.origin_y * pcbIUScale.IU_PER_MM );
|
|
|
|
m_defaultLineWidth.SetValue( cfg->m_ImportGraphics.dxf_line_width * pcbIUScale.IU_PER_MM );
|
2018-10-13 18:37:28 +00:00
|
|
|
|
2023-10-17 07:27:59 +00:00
|
|
|
m_importScaleCtrl->SetValue( wxString::Format( wxT( "%f" ), s_importScale ) );
|
|
|
|
|
2022-09-12 23:58:55 +00:00
|
|
|
m_textCtrlFileName->SetValue( cfg->m_ImportGraphics.last_file );
|
2023-10-18 13:20:34 +00:00
|
|
|
m_placeAtCheckbox->SetValue( !s_placementInteractive );
|
2018-11-05 16:04:05 +00:00
|
|
|
|
2023-10-17 07:27:59 +00:00
|
|
|
m_tolerance.SetValue( s_toleranceValue );
|
|
|
|
m_rbFixDiscontinuities->SetValue( s_fixDiscontinuities );
|
2018-10-13 18:37:28 +00:00
|
|
|
|
|
|
|
// Configure the layers list selector
|
2022-09-12 23:58:55 +00:00
|
|
|
m_SelLayerBox->SetLayersHotkeys( false ); // Do not display hotkeys
|
2018-10-13 18:37:28 +00:00
|
|
|
m_SelLayerBox->SetBoardFrame( m_parent );
|
|
|
|
m_SelLayerBox->Resync();
|
|
|
|
|
2022-09-12 23:58:55 +00:00
|
|
|
if( m_SelLayerBox->SetLayerSelection( cfg->m_ImportGraphics.layer ) < 0 )
|
|
|
|
m_SelLayerBox->SetLayerSelection( Dwgs_User );
|
2018-10-13 18:37:28 +00:00
|
|
|
|
2022-09-12 23:58:55 +00:00
|
|
|
for( const std::pair<const DXF_IMPORT_UNITS, wxString>& unitEntry : dxfUnitsMap )
|
2023-10-18 13:20:34 +00:00
|
|
|
m_dxfUnitsChoice->Append( unitEntry.second );
|
2020-11-22 03:11:24 +00:00
|
|
|
|
2023-10-18 13:20:34 +00:00
|
|
|
m_dxfUnitsChoice->SetSelection( cfg->m_ImportGraphics.dxf_units );
|
2020-11-22 03:11:24 +00:00
|
|
|
|
2023-10-21 18:56:19 +00:00
|
|
|
m_browseButton->SetBitmap( KiBitmapBundle( BITMAPS::small_folder ) );
|
2020-11-23 11:44:46 +00:00
|
|
|
|
2022-07-18 16:49:50 +00:00
|
|
|
wxCommandEvent dummy;
|
|
|
|
onFilename( dummy );
|
|
|
|
|
2019-04-03 13:57:31 +00:00
|
|
|
SetInitialFocus( m_textCtrlFileName );
|
2021-11-16 19:39:58 +00:00
|
|
|
SetupStandardButtons();
|
|
|
|
|
2018-10-13 18:37:28 +00:00
|
|
|
GetSizer()->Fit( this );
|
|
|
|
GetSizer()->SetSizeHints( this );
|
|
|
|
Centre();
|
2022-07-18 16:49:50 +00:00
|
|
|
|
|
|
|
m_textCtrlFileName->Connect( wxEVT_COMMAND_TEXT_UPDATED,
|
2023-10-18 13:20:34 +00:00
|
|
|
wxCommandEventHandler( DIALOG_IMPORT_GRAPHICS::onFilename ),
|
2022-09-12 23:58:55 +00:00
|
|
|
nullptr, this );
|
2018-10-13 18:37:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-10-18 13:20:34 +00:00
|
|
|
DIALOG_IMPORT_GRAPHICS::~DIALOG_IMPORT_GRAPHICS()
|
2018-10-13 18:37:28 +00:00
|
|
|
{
|
2023-10-18 13:20:34 +00:00
|
|
|
s_placementInteractive = !m_placeAtCheckbox->GetValue();
|
|
|
|
s_fixDiscontinuities = m_rbFixDiscontinuities->GetValue();
|
|
|
|
s_toleranceValue = m_tolerance.GetIntValue();
|
|
|
|
|
2023-10-16 21:04:01 +00:00
|
|
|
PCBNEW_SETTINGS* cfg = nullptr;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
cfg = m_parent->GetPcbNewSettings();
|
|
|
|
}
|
|
|
|
catch( const std::runtime_error& e )
|
|
|
|
{
|
|
|
|
wxFAIL_MSG( e.what() );
|
|
|
|
}
|
2020-01-13 01:44:19 +00:00
|
|
|
|
2023-10-17 07:27:59 +00:00
|
|
|
if( cfg )
|
2023-10-16 21:04:01 +00:00
|
|
|
{
|
2023-10-17 07:27:59 +00:00
|
|
|
cfg->m_ImportGraphics.layer = m_SelLayerBox->GetLayerSelection();
|
|
|
|
cfg->m_ImportGraphics.interactive_placement = s_placementInteractive;
|
|
|
|
cfg->m_ImportGraphics.last_file = m_textCtrlFileName->GetValue();
|
2023-10-18 13:20:34 +00:00
|
|
|
cfg->m_ImportGraphics.dxf_line_width = pcbIUScale.IUTomm( m_defaultLineWidth.GetIntValue() );
|
|
|
|
cfg->m_ImportGraphics.origin_x = pcbIUScale.IUTomm( m_xOrigin.GetIntValue() );
|
|
|
|
cfg->m_ImportGraphics.origin_y = pcbIUScale.IUTomm( m_yOrigin.GetIntValue() );
|
|
|
|
cfg->m_ImportGraphics.dxf_units = m_dxfUnitsChoice->GetSelection();
|
2023-10-16 21:04:01 +00:00
|
|
|
}
|
2022-09-12 23:58:55 +00:00
|
|
|
|
2023-10-17 07:27:59 +00:00
|
|
|
s_importScale = EDA_UNIT_UTILS::UI::DoubleValueFromString( m_importScaleCtrl->GetValue() );
|
|
|
|
s_toleranceValue = m_tolerance.GetIntValue();
|
2022-07-18 16:49:50 +00:00
|
|
|
|
|
|
|
m_textCtrlFileName->Disconnect( wxEVT_COMMAND_TEXT_UPDATED,
|
2023-10-18 13:20:34 +00:00
|
|
|
wxCommandEventHandler( DIALOG_IMPORT_GRAPHICS::onFilename ),
|
2022-09-12 23:58:55 +00:00
|
|
|
nullptr, this );
|
2018-11-05 16:04:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-10-18 13:20:34 +00:00
|
|
|
void DIALOG_IMPORT_GRAPHICS::onFilename( wxCommandEvent& event )
|
2022-07-18 16:49:50 +00:00
|
|
|
{
|
|
|
|
bool enableDXFControls = true;
|
2022-09-12 23:58:55 +00:00
|
|
|
wxString ext = wxFileName( m_textCtrlFileName->GetValue() ).GetExt();
|
2022-07-18 16:49:50 +00:00
|
|
|
|
2022-09-12 23:58:55 +00:00
|
|
|
if( std::unique_ptr<GRAPHICS_IMPORT_PLUGIN> plugin = m_gfxImportMgr->GetPluginByExt( ext ) )
|
2022-07-18 16:49:50 +00:00
|
|
|
enableDXFControls = dynamic_cast<DXF_IMPORT_PLUGIN*>( plugin.get() ) != nullptr;
|
|
|
|
|
2022-09-12 23:58:55 +00:00
|
|
|
m_defaultLineWidth.Enable( enableDXFControls );
|
2022-07-18 16:49:50 +00:00
|
|
|
|
2023-10-18 13:20:34 +00:00
|
|
|
m_dxfUnitsLabel->Enable( enableDXFControls );
|
|
|
|
m_dxfUnitsChoice->Enable( enableDXFControls );
|
2022-07-18 16:49:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-10-18 13:20:34 +00:00
|
|
|
void DIALOG_IMPORT_GRAPHICS::onBrowseFiles( wxCommandEvent& event )
|
2018-10-13 18:37:28 +00:00
|
|
|
{
|
|
|
|
wxString path;
|
2022-09-12 23:58:55 +00:00
|
|
|
wxString filename = m_textCtrlFileName->GetValue();
|
2018-10-13 18:37:28 +00:00
|
|
|
|
2022-09-12 23:58:55 +00:00
|
|
|
if( !filename.IsEmpty() )
|
2018-10-13 18:37:28 +00:00
|
|
|
{
|
2022-09-12 23:58:55 +00:00
|
|
|
wxFileName fn( filename );
|
2018-10-13 18:37:28 +00:00
|
|
|
path = fn.GetPath();
|
|
|
|
filename = fn.GetFullName();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Generate the list of handled file formats
|
|
|
|
wxString wildcardsDesc;
|
|
|
|
wxString allWildcards;
|
|
|
|
|
2022-07-18 16:49:50 +00:00
|
|
|
for( GRAPHICS_IMPORT_MGR::GFX_FILE_T pluginType : m_gfxImportMgr->GetImportableFileTypes() )
|
2018-10-13 18:37:28 +00:00
|
|
|
{
|
2022-07-18 16:49:50 +00:00
|
|
|
std::unique_ptr<GRAPHICS_IMPORT_PLUGIN> plugin = m_gfxImportMgr->GetPlugin( pluginType );
|
|
|
|
const std::vector<std::string> extensions = plugin->GetFileExtensions();
|
2018-10-13 18:37:28 +00:00
|
|
|
|
2022-02-05 13:25:43 +00:00
|
|
|
wildcardsDesc += wxT( "|" ) + plugin->GetName() + AddFileExtListToFilter( extensions );
|
|
|
|
allWildcards += plugin->GetWildcards() + wxT( ";" );
|
2018-10-13 18:37:28 +00:00
|
|
|
}
|
|
|
|
|
2023-01-17 16:34:34 +00:00
|
|
|
wildcardsDesc = _( "All supported formats" ) + wxT( "|" ) + allWildcards + wildcardsDesc;
|
2018-10-13 18:37:28 +00:00
|
|
|
|
2023-10-23 17:01:04 +00:00
|
|
|
wxFileDialog dlg( m_parent, _( "Import Graphics" ), path, filename, wildcardsDesc,
|
2019-07-16 01:31:07 +00:00
|
|
|
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
2018-10-13 18:37:28 +00:00
|
|
|
|
2022-09-12 23:58:55 +00:00
|
|
|
if( dlg.ShowModal() == wxID_OK && !dlg.GetPath().IsEmpty() )
|
|
|
|
m_textCtrlFileName->SetValue( dlg.GetPath() );
|
2018-10-13 18:37:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-10-18 13:20:34 +00:00
|
|
|
bool DIALOG_IMPORT_GRAPHICS::TransferDataFromWindow()
|
2018-10-13 18:37:28 +00:00
|
|
|
{
|
2019-04-03 13:57:31 +00:00
|
|
|
if( !wxDialog::TransferDataFromWindow() )
|
|
|
|
return false;
|
|
|
|
|
2022-09-12 23:58:55 +00:00
|
|
|
if( m_textCtrlFileName->GetValue().IsEmpty() )
|
2018-11-05 16:04:05 +00:00
|
|
|
{
|
2023-10-18 13:20:34 +00:00
|
|
|
wxMessageBox( _( "Please select a file to import." ) );
|
2019-04-03 13:57:31 +00:00
|
|
|
return false;
|
2018-11-05 16:04:05 +00:00
|
|
|
}
|
2018-10-13 18:37:28 +00:00
|
|
|
|
2023-10-18 13:20:34 +00:00
|
|
|
if( m_setLayerCheckbox->GetValue() && m_SelLayerBox->GetLayerSelection() < 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
|
|
|
}
|
|
|
|
|
2022-11-19 16:25:27 +00:00
|
|
|
PCBNEW_SETTINGS* cfg = m_parent->GetPcbNewSettings();
|
2022-09-12 23:58:55 +00:00
|
|
|
wxString ext = wxFileName( m_textCtrlFileName->GetValue() ).GetExt();
|
2022-09-16 04:38:10 +00:00
|
|
|
double scale = EDA_UNIT_UTILS::UI::DoubleValueFromString( m_importScaleCtrl->GetValue() );
|
2022-11-19 16:25:27 +00:00
|
|
|
double xscale = scale;
|
|
|
|
double yscale = scale;
|
|
|
|
|
|
|
|
if( cfg->m_Display.m_DisplayInvertXAxis )
|
|
|
|
xscale *= -1.0;
|
|
|
|
|
|
|
|
if( cfg->m_Display.m_DisplayInvertYAxis )
|
|
|
|
yscale *= -1.0;
|
|
|
|
|
2023-10-18 13:20:34 +00:00
|
|
|
VECTOR2D origin( m_xOrigin.GetIntValue() / xscale, m_yOrigin.GetIntValue() / yscale );
|
2020-11-22 03:11:24 +00:00
|
|
|
|
2022-09-12 23:58:55 +00:00
|
|
|
if( std::unique_ptr<GRAPHICS_IMPORT_PLUGIN> plugin = m_gfxImportMgr->GetPluginByExt( ext ) )
|
2018-10-13 18:37:28 +00:00
|
|
|
{
|
2022-09-12 23:58:55 +00:00
|
|
|
if( DXF_IMPORT_PLUGIN* dxfPlugin = dynamic_cast<DXF_IMPORT_PLUGIN*>( plugin.get() ) )
|
2020-11-22 03:11:24 +00:00
|
|
|
{
|
|
|
|
auto it = dxfUnitsMap.begin();
|
2023-10-18 13:20:34 +00:00
|
|
|
std::advance( it, m_dxfUnitsChoice->GetSelection() );
|
2020-11-22 03:11:24 +00:00
|
|
|
|
|
|
|
if( it == dxfUnitsMap.end() )
|
|
|
|
dxfPlugin->SetUnit( DXF_IMPORT_UNITS::DEFAULT );
|
|
|
|
else
|
|
|
|
dxfPlugin->SetUnit( it->first );
|
2022-07-18 16:49:50 +00:00
|
|
|
|
2023-10-18 13:20:34 +00:00
|
|
|
m_importer->SetLineWidthMM( pcbIUScale.IUTomm( m_defaultLineWidth.GetIntValue() ) );
|
2022-07-18 16:49:50 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_importer->SetLineWidthMM( 0.0 );
|
2020-11-22 03:11:24 +00:00
|
|
|
}
|
|
|
|
|
2018-10-13 18:37:28 +00:00
|
|
|
m_importer->SetPlugin( std::move( plugin ) );
|
2023-10-18 13:20:34 +00:00
|
|
|
|
|
|
|
if( m_setLayerCheckbox->GetValue() )
|
|
|
|
m_importer->SetLayer( PCB_LAYER_ID( m_SelLayerBox->GetLayerSelection() ) );
|
|
|
|
else
|
|
|
|
m_importer->SetLayer( m_parent->GetActiveLayer() );
|
|
|
|
|
2023-10-17 12:07:15 +00:00
|
|
|
m_importer->SetImportOffsetMM( { pcbIUScale.IUTomm( origin.x ),
|
|
|
|
pcbIUScale.IUTomm( origin.y ) } );
|
2018-10-13 18:37:28 +00:00
|
|
|
|
2018-11-05 16:04:05 +00:00
|
|
|
LOCALE_IO dummy; // Ensure floats can be read.
|
|
|
|
|
2022-09-12 23:58:55 +00:00
|
|
|
if( m_importer->Load( m_textCtrlFileName->GetValue() ) )
|
2023-08-18 18:27:48 +00:00
|
|
|
m_importer->Import( VECTOR2D( scale, scale ) );
|
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." ) );
|
2022-02-05 13:25:43 +00:00
|
|
|
warnings.Replace( wxT( "\n" ), wxT( "<br/>" ) );
|
2019-09-06 18:57:04 +00:00
|
|
|
dlg.AddHTML_Text( warnings );
|
|
|
|
dlg.ShowModal();
|
|
|
|
}
|
2022-09-12 23:58:55 +00:00
|
|
|
|
|
|
|
return true;
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-10-18 13:20:34 +00:00
|
|
|
void DIALOG_IMPORT_GRAPHICS::onUpdateUI( wxUpdateUIEvent& event )
|
2019-04-03 13:57:31 +00:00
|
|
|
{
|
2023-10-18 13:20:34 +00:00
|
|
|
m_xOrigin.Enable( m_placeAtCheckbox->GetValue() );
|
|
|
|
m_yOrigin.Enable( m_placeAtCheckbox->GetValue() );
|
2019-04-03 13:57:31 +00:00
|
|
|
|
2023-10-18 13:20:34 +00:00
|
|
|
m_tolerance.Enable( m_rbFixDiscontinuities->GetValue() );
|
2019-04-03 13:57:31 +00:00
|
|
|
|
2023-10-18 13:20:34 +00:00
|
|
|
m_SelLayerBox->Enable( m_setLayerCheckbox->GetValue() );
|
2018-10-13 18:37:28 +00:00
|
|
|
}
|
|
|
|
|
2018-11-05 16:04:05 +00:00
|
|
|
|