Add optional reporting of non-KiCad design issues
Also add HTML reporter to PCB side to match schematic
This commit is contained in:
parent
09736ebf2c
commit
b8fa10ab2b
|
@ -160,6 +160,9 @@ APP_SETTINGS_BASE::APP_SETTINGS_BASE( const std::string& aFilename, int aSchemaV
|
||||||
m_params.emplace_back( new PARAM<int>( "system.last_imperial_units",
|
m_params.emplace_back( new PARAM<int>( "system.last_imperial_units",
|
||||||
&m_System.last_imperial_units, static_cast<int>( EDA_UNITS::MILS ) ) );
|
&m_System.last_imperial_units, static_cast<int>( EDA_UNITS::MILS ) ) );
|
||||||
|
|
||||||
|
m_params.emplace_back( new PARAM<bool>( "system.show_import_issues",
|
||||||
|
&m_System.show_import_issues, true ) );
|
||||||
|
|
||||||
m_params.emplace_back( new PARAM<wxString>( "appearance.color_theme",
|
m_params.emplace_back( new PARAM<wxString>( "appearance.color_theme",
|
||||||
&m_ColorTheme, COLOR_SETTINGS::COLOR_BUILTIN_DEFAULT ) );
|
&m_ColorTheme, COLOR_SETTINGS::COLOR_BUILTIN_DEFAULT ) );
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@
|
||||||
#include <tools/sch_editor_control.h>
|
#include <tools/sch_editor_control.h>
|
||||||
#include <tools/sch_navigate_tool.h>
|
#include <tools/sch_navigate_tool.h>
|
||||||
#include <trace_helpers.h>
|
#include <trace_helpers.h>
|
||||||
|
#include <widgets/filedlg_import_non_kicad.h>
|
||||||
#include <widgets/wx_infobar.h>
|
#include <widgets/wx_infobar.h>
|
||||||
#include <wildcards_and_files_ext.h>
|
#include <wildcards_and_files_ext.h>
|
||||||
#include <drawing_sheet/ds_data_model.h>
|
#include <drawing_sheet/ds_data_model.h>
|
||||||
|
@ -730,9 +731,14 @@ void SCH_EDIT_FRAME::OnImportProject( wxCommandEvent& aEvent )
|
||||||
wxFileDialog dlg( this, _( "Import Schematic" ), path, wxEmptyString, fileFiltersStr,
|
wxFileDialog dlg( this, _( "Import Schematic" ), path, wxEmptyString, fileFiltersStr,
|
||||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST ); // TODO
|
wxFD_OPEN | wxFD_FILE_MUST_EXIST ); // TODO
|
||||||
|
|
||||||
|
FILEDLG_IMPORT_NON_KICAD importOptions( eeconfig()->m_System.show_import_issues );
|
||||||
|
dlg.SetCustomizeHook( importOptions );
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxID_CANCEL )
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
eeconfig()->m_System.show_import_issues = importOptions.GetShowIssues();
|
||||||
|
|
||||||
// Don't leave dangling pointers to previously-opened document.
|
// Don't leave dangling pointers to previously-opened document.
|
||||||
m_toolManager->GetTool<EE_SELECTION_TOOL>()->ClearSelection();
|
m_toolManager->GetTool<EE_SELECTION_TOOL>()->ClearSelection();
|
||||||
ClearUndoRedoList();
|
ClearUndoRedoList();
|
||||||
|
@ -1383,7 +1389,11 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType,
|
||||||
std::placeholders::_1 ) );
|
std::placeholders::_1 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
pi->SetReporter( errorReporter.m_Reporter );
|
if( eeconfig()->m_System.show_import_issues )
|
||||||
|
pi->SetReporter( errorReporter.m_Reporter );
|
||||||
|
else
|
||||||
|
pi->SetReporter( &NULL_REPORTER::GetInstance() );
|
||||||
|
|
||||||
pi->SetProgressReporter( &progressReporter );
|
pi->SetProgressReporter( &progressReporter );
|
||||||
|
|
||||||
SCH_SHEET* loadedSheet =
|
SCH_SHEET* loadedSheet =
|
||||||
|
|
|
@ -142,6 +142,8 @@ public:
|
||||||
int units;
|
int units;
|
||||||
int last_metric_units;
|
int last_metric_units;
|
||||||
int last_imperial_units;
|
int last_imperial_units;
|
||||||
|
/// Stored value for "show import issues" when importing non-KiCad designs to this application
|
||||||
|
bool show_import_issues;
|
||||||
};
|
};
|
||||||
|
|
||||||
APP_SETTINGS_BASE( const std::string& aFilename, int aSchemaVersion );
|
APP_SETTINGS_BASE( const std::string& aFilename, int aSchemaVersion );
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2024 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef KICAD_FILEDLG_IMPORT_NON_KICAD_H
|
||||||
|
#define KICAD_FILEDLG_IMPORT_NON_KICAD_H
|
||||||
|
|
||||||
|
#include <wx/wx.h>
|
||||||
|
#include <wx/filedlgcustomize.h>
|
||||||
|
|
||||||
|
|
||||||
|
class FILEDLG_IMPORT_NON_KICAD : public wxFileDialogCustomizeHook
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
FILEDLG_IMPORT_NON_KICAD( bool aDefaultShowIssues = true ) :
|
||||||
|
m_showIssues( aDefaultShowIssues )
|
||||||
|
{};
|
||||||
|
|
||||||
|
virtual void AddCustomControls( wxFileDialogCustomize& customizer ) override
|
||||||
|
{
|
||||||
|
m_cb = customizer.AddCheckBox( _( "Show import issues" ) );
|
||||||
|
m_cb->SetValue( m_showIssues );
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void TransferDataFromCustomControls() override
|
||||||
|
{
|
||||||
|
m_showIssues = m_cb->GetValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GetShowIssues() const { return m_showIssues; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_showIssues;
|
||||||
|
|
||||||
|
wxFileDialogCheckBox* m_cb = nullptr;
|
||||||
|
|
||||||
|
wxDECLARE_NO_COPY_CLASS( FILEDLG_IMPORT_NON_KICAD );
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //KICAD_FILEDLG_IMPORT_NON_KICAD_H
|
|
@ -29,6 +29,7 @@
|
||||||
#include <confirm.h>
|
#include <confirm.h>
|
||||||
#include <core/arraydim.h>
|
#include <core/arraydim.h>
|
||||||
#include <core/thread_pool.h>
|
#include <core/thread_pool.h>
|
||||||
|
#include <dialog_HTML_reporter_base.h>
|
||||||
#include <gestfich.h>
|
#include <gestfich.h>
|
||||||
#include <pcb_edit_frame.h>
|
#include <pcb_edit_frame.h>
|
||||||
#include <board_design_settings.h>
|
#include <board_design_settings.h>
|
||||||
|
@ -67,6 +68,8 @@
|
||||||
#include "footprint_info_impl.h"
|
#include "footprint_info_impl.h"
|
||||||
#include <board_commit.h>
|
#include <board_commit.h>
|
||||||
#include <zone_filler.h>
|
#include <zone_filler.h>
|
||||||
|
#include <widgets/filedlg_import_non_kicad.h>
|
||||||
|
#include <widgets/wx_html_report_box.h>
|
||||||
#include <wx_filename.h> // For ::ResolvePossibleSymlinks()
|
#include <wx_filename.h> // For ::ResolvePossibleSymlinks()
|
||||||
|
|
||||||
#include <kiplatform/io.h>
|
#include <kiplatform/io.h>
|
||||||
|
@ -169,15 +172,25 @@ bool AskLoadBoardFileName( PCB_EDIT_FRAME* aParent, wxString* aFileName, int aCt
|
||||||
// leave name empty
|
// leave name empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool kicadFormat = ( aCtl & KICTL_KICAD_ONLY );
|
||||||
|
|
||||||
wxFileDialog dlg( aParent,
|
wxFileDialog dlg( aParent,
|
||||||
( aCtl & KICTL_KICAD_ONLY ) ? _( "Open Board File" )
|
kicadFormat ? _( "Open Board File" ) : _( "Import Non KiCad Board File" ),
|
||||||
: _( "Import Non KiCad Board File" ),
|
|
||||||
path, name, fileFiltersStr, wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
path, name, fileFiltersStr, wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||||
|
|
||||||
|
FILEDLG_IMPORT_NON_KICAD importOptions( aParent->config()->m_System.show_import_issues );
|
||||||
|
|
||||||
|
if( !kicadFormat )
|
||||||
|
dlg.SetCustomizeHook( importOptions );
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxID_OK )
|
if( dlg.ShowModal() == wxID_OK )
|
||||||
{
|
{
|
||||||
*aFileName = dlg.GetPath();
|
*aFileName = dlg.GetPath();
|
||||||
aParent->SetMruPath( wxFileName( dlg.GetPath() ).GetPath() );
|
aParent->SetMruPath( wxFileName( dlg.GetPath() ).GetPath() );
|
||||||
|
|
||||||
|
if( !kicadFormat )
|
||||||
|
aParent->config()->m_System.show_import_issues = importOptions.GetShowIssues();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -645,6 +658,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
||||||
CheckForAutoSaveFile( fullFileName );
|
CheckForAutoSaveFile( fullFileName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DIALOG_HTML_REPORTER errorReporter( this );
|
||||||
bool failedLoad = false;
|
bool failedLoad = false;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -681,6 +695,10 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
||||||
// measure the time to load a BOARD.
|
// measure the time to load a BOARD.
|
||||||
int64_t startTime = GetRunningMicroSecs();
|
int64_t startTime = GetRunningMicroSecs();
|
||||||
#endif
|
#endif
|
||||||
|
if( config()->m_System.show_import_issues )
|
||||||
|
pi->SetReporter( errorReporter.m_Reporter );
|
||||||
|
else
|
||||||
|
pi->SetReporter( &NULL_REPORTER::GetInstance() );
|
||||||
|
|
||||||
pi->SetProgressReporter( &progressReporter );
|
pi->SetProgressReporter( &progressReporter );
|
||||||
loadedBoard = pi->LoadBoard( fullFileName, nullptr, &props, &Prj() );
|
loadedBoard = pi->LoadBoard( fullFileName, nullptr, &props, &Prj() );
|
||||||
|
@ -731,6 +749,12 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
||||||
// compiled.
|
// compiled.
|
||||||
Raise();
|
Raise();
|
||||||
|
|
||||||
|
if( errorReporter.m_Reporter->HasMessage() )
|
||||||
|
{
|
||||||
|
errorReporter.m_Reporter->Flush(); // Build HTML messages
|
||||||
|
errorReporter.ShowModal();
|
||||||
|
}
|
||||||
|
|
||||||
// Skip (possibly expensive) connectivity build here; we build it below after load
|
// Skip (possibly expensive) connectivity build here; we build it below after load
|
||||||
SetBoard( loadedBoard, false, &progressReporter );
|
SetBoard( loadedBoard, false, &progressReporter );
|
||||||
|
|
||||||
|
|
|
@ -253,9 +253,13 @@ std::vector<PCB_LAYER_ID> ALTIUM_PCB::GetKicadLayersToIterate( ALTIUM_LAYER aAlt
|
||||||
|
|
||||||
if( klayer == UNDEFINED_LAYER )
|
if( klayer == UNDEFINED_LAYER )
|
||||||
{
|
{
|
||||||
wxLogWarning( _( "Altium layer (%d) has no KiCad equivalent. It has been moved to KiCad "
|
if( m_reporter )
|
||||||
"layer Eco1_User." ),
|
{
|
||||||
aAltiumLayer );
|
m_reporter->Report( wxString::Format(
|
||||||
|
_( "Altium layer (%d) has no KiCad equivalent. It has been moved to KiCad "
|
||||||
|
"layer Eco1_User." ), aAltiumLayer ), RPT_SEVERITY_INFO );
|
||||||
|
}
|
||||||
|
|
||||||
klayer = Eco1_User;
|
klayer = Eco1_User;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1289,9 +1293,14 @@ void ALTIUM_PCB::HelperParseDimensions6Linear( const ADIMENSION6& aElem )
|
||||||
|
|
||||||
if( klayer == UNDEFINED_LAYER )
|
if( klayer == UNDEFINED_LAYER )
|
||||||
{
|
{
|
||||||
wxLogWarning( _( "Dimension found on an Altium layer (%d) with no KiCad equivalent. "
|
if( m_reporter )
|
||||||
"It has been moved to KiCad layer Eco1_User." ),
|
{
|
||||||
aElem.layer );
|
m_reporter->Report( wxString::Format(
|
||||||
|
_( "Dimension found on an Altium layer (%d) with no KiCad equivalent. "
|
||||||
|
"It has been moved to KiCad layer Eco1_User." ), aElem.layer ),
|
||||||
|
RPT_SEVERITY_INFO );
|
||||||
|
}
|
||||||
|
|
||||||
klayer = Eco1_User;
|
klayer = Eco1_User;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1390,9 +1399,14 @@ void ALTIUM_PCB::HelperParseDimensions6Radial(const ADIMENSION6 &aElem)
|
||||||
|
|
||||||
if( klayer == UNDEFINED_LAYER )
|
if( klayer == UNDEFINED_LAYER )
|
||||||
{
|
{
|
||||||
wxLogWarning( _( "Dimension found on an Altium layer (%d) with no KiCad equivalent. "
|
if( m_reporter )
|
||||||
"It has been moved to KiCad layer Eco1_User." ),
|
{
|
||||||
aElem.layer );
|
m_reporter->Report( wxString::Format(
|
||||||
|
_( "Dimension found on an Altium layer (%d) with no KiCad equivalent. "
|
||||||
|
"It has been moved to KiCad layer Eco1_User." ),
|
||||||
|
aElem.layer ), RPT_SEVERITY_INFO );
|
||||||
|
}
|
||||||
|
|
||||||
klayer = Eco1_User;
|
klayer = Eco1_User;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue