2020-01-13 01:44:19 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2023-05-20 17:47:12 +00:00
|
|
|
* Copyright (C) 2020-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2020-01-13 01:44:19 +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-02-25 03:37:30 +00:00
|
|
|
#include <functional>
|
|
|
|
|
|
|
|
#include <dialogs/dialog_bom_cfg_lexer.h>
|
2023-06-25 00:09:07 +00:00
|
|
|
#include <eda_draw_frame.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <eeschema_settings.h>
|
2021-07-29 09:47:43 +00:00
|
|
|
#include <layer_ids.h>
|
2020-10-31 01:27:16 +00:00
|
|
|
#include <symbol_editor_settings.h>
|
2023-09-09 04:10:57 +00:00
|
|
|
#include <string_utils.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <pgm_base.h>
|
|
|
|
#include <settings/common_settings.h>
|
2021-06-04 03:52:50 +00:00
|
|
|
#include <settings/json_settings_internals.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <settings/parameters.h>
|
|
|
|
#include <settings/settings_manager.h>
|
2023-05-20 17:47:12 +00:00
|
|
|
#include <settings/aui_settings.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <wx/config.h>
|
2020-03-16 11:05:01 +00:00
|
|
|
#include <widgets/ui_common.h>
|
2020-04-14 18:11:50 +00:00
|
|
|
#include <default_values.h> // For some default values
|
2020-01-13 01:44:19 +00:00
|
|
|
|
2021-02-25 03:37:30 +00:00
|
|
|
using namespace T_BOMCFG_T; // for the BOM_CFG_PARSER parser and its keywords
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
///! Update the schema version whenever a migration is required
|
2022-08-28 23:02:12 +00:00
|
|
|
const int eeschemaSchemaVersion = 3;
|
2021-02-25 03:37:30 +00:00
|
|
|
|
|
|
|
/// Default value for bom.plugins
|
2022-08-15 22:43:30 +00:00
|
|
|
const nlohmann::json defaultBomPlugins =
|
2021-02-25 03:37:30 +00:00
|
|
|
{
|
2022-09-30 11:51:25 +00:00
|
|
|
{
|
|
|
|
{ "name", "bom_csv_grouped_extra" },
|
|
|
|
{ "path", "bom_csv_grouped_extra.py" }
|
|
|
|
},
|
2022-08-15 22:43:30 +00:00
|
|
|
{
|
|
|
|
{ "name", "bom_csv_grouped_by_value" },
|
|
|
|
{ "path", "bom_csv_grouped_by_value.py" }
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{ "name", "bom_csv_grouped_by_value_with_fp" },
|
|
|
|
{ "path", "bom_csv_grouped_by_value_with_fp.py" }
|
|
|
|
},
|
|
|
|
};
|
2020-01-13 01:44:19 +00:00
|
|
|
|
|
|
|
|
2023-05-20 17:47:12 +00:00
|
|
|
const wxAuiPaneInfo& defaultNetNavigatorPaneInfo()
|
|
|
|
{
|
|
|
|
static wxAuiPaneInfo paneInfo;
|
|
|
|
|
|
|
|
paneInfo.Name( wxS( "NetNavigator" ) )
|
|
|
|
.Caption( _( "Net Navigator" ) )
|
|
|
|
.CaptionVisible( true )
|
|
|
|
.PaneBorder( true )
|
|
|
|
.Left().Layer( 3 )
|
|
|
|
.TopDockable( false )
|
|
|
|
.BottomDockable( false )
|
|
|
|
.CloseButton( true )
|
|
|
|
.MinSize( 120, 60 )
|
|
|
|
.BestSize( 200, 200 )
|
|
|
|
.FloatingSize( 200, 200 )
|
|
|
|
.FloatingPosition( 50, 200 )
|
|
|
|
.Show( false );
|
|
|
|
|
|
|
|
return paneInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-06-25 00:09:07 +00:00
|
|
|
const wxAuiPaneInfo& defaultPropertiesPaneInfo()
|
|
|
|
{
|
|
|
|
static wxAuiPaneInfo paneInfo;
|
|
|
|
|
|
|
|
paneInfo.Name( EDA_DRAW_FRAME::PropertiesPaneName() )
|
|
|
|
.Caption( _( "Properties" ) )
|
|
|
|
.CaptionVisible( true )
|
|
|
|
.PaneBorder( true )
|
|
|
|
.Left().Layer( 3 )
|
|
|
|
.TopDockable( false )
|
|
|
|
.BottomDockable( false )
|
|
|
|
.CloseButton( true )
|
|
|
|
.MinSize( 240, 60 )
|
|
|
|
.BestSize( 200, 200 )
|
|
|
|
.FloatingSize( 200, 400 )
|
|
|
|
.FloatingPosition( 50, 200 )
|
|
|
|
.Show( true );
|
|
|
|
|
|
|
|
return paneInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-07-18 22:56:39 +00:00
|
|
|
EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() :
|
|
|
|
APP_SETTINGS_BASE( "eeschema", eeschemaSchemaVersion ),
|
|
|
|
m_Appearance(),
|
|
|
|
m_AutoplaceFields(),
|
|
|
|
m_Drawing(),
|
2022-08-05 02:40:38 +00:00
|
|
|
m_FindReplaceExtra(),
|
2020-07-18 22:56:39 +00:00
|
|
|
m_Input(),
|
|
|
|
m_PageSettings(),
|
|
|
|
m_AnnotatePanel(),
|
|
|
|
m_BomPanel(),
|
|
|
|
m_FieldEditorPanel(),
|
|
|
|
m_LibViewPanel(),
|
|
|
|
m_NetlistPanel(),
|
2021-01-31 16:45:17 +00:00
|
|
|
m_PlotPanel(),
|
2020-07-18 22:56:39 +00:00
|
|
|
m_SymChooserPanel(),
|
2023-10-09 00:54:34 +00:00
|
|
|
m_ImportGraphics(),
|
2020-07-18 22:56:39 +00:00
|
|
|
m_Selection(),
|
|
|
|
m_Simulator(),
|
|
|
|
m_RescueNeverShow( false )
|
2020-01-13 01:44:19 +00:00
|
|
|
{
|
2021-10-12 20:05:37 +00:00
|
|
|
m_params.emplace_back( new PARAM<wxString>( "appearance.edit_symbol_visible_columns",
|
|
|
|
&m_Appearance.edit_symbol_visible_columns, "0 1 2 3 4 5 6 7" ) );
|
2020-03-06 20:02:58 +00:00
|
|
|
|
2022-12-24 22:18:05 +00:00
|
|
|
m_params.emplace_back( new PARAM<int>( "appearance.edit_symbol_width",
|
|
|
|
&m_Appearance.edit_symbol_width, -1 ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "appearance.edit_symbol_height",
|
|
|
|
&m_Appearance.edit_symbol_height, -1 ) );
|
|
|
|
|
2020-03-06 20:02:58 +00:00
|
|
|
m_params.emplace_back( new PARAM<wxString>( "appearance.edit_sheet_visible_columns",
|
|
|
|
&m_Appearance.edit_sheet_visible_columns, "0 1 2 3 4 5 6 7" ) );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
2022-12-24 22:18:05 +00:00
|
|
|
m_params.emplace_back( new PARAM<int>( "appearance.edit_sheet_width",
|
|
|
|
&m_Appearance.edit_sheet_width, -1 ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "appearance.edit_sheet_height",
|
|
|
|
&m_Appearance.edit_sheet_height, -1 ) );
|
|
|
|
|
2021-10-12 20:05:37 +00:00
|
|
|
m_params.emplace_back( new PARAM<wxString>( "appearance.edit_label_visible_columns",
|
|
|
|
&m_Appearance.edit_label_visible_columns, "0 1 2 3 4 5 6 7" ) );
|
|
|
|
|
2022-12-24 22:18:05 +00:00
|
|
|
m_params.emplace_back( new PARAM<int>( "appearance.edit_label_width",
|
|
|
|
&m_Appearance.edit_label_width, -1 ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "appearance.edit_label_height",
|
|
|
|
&m_Appearance.edit_label_height, -1 ) );
|
|
|
|
|
2020-03-16 11:05:01 +00:00
|
|
|
m_params.emplace_back( new PARAM<int>( "appearance.erc_severities",
|
|
|
|
&m_Appearance.erc_severities, RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING ) );
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "appearance.footprint_preview",
|
|
|
|
&m_Appearance.footprint_preview, true ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "appearance.print_sheet_reference",
|
|
|
|
&m_Appearance.print_sheet_reference, true ) );
|
|
|
|
|
2022-01-07 00:47:23 +00:00
|
|
|
m_params.emplace_back( new PARAM<wxString>( "appearance.default_font",
|
|
|
|
&m_Appearance.default_font, "KiCad Font" ) );
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "appearance.show_hidden_pins",
|
|
|
|
&m_Appearance.show_hidden_pins, false ) );
|
|
|
|
|
2020-04-18 15:36:29 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "appearance.show_hidden_fields",
|
|
|
|
&m_Appearance.show_hidden_fields, false ) );
|
|
|
|
|
2023-04-27 16:59:53 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "appearance.show_directive_labels",
|
|
|
|
&m_Appearance.show_directive_labels, true ) );
|
|
|
|
|
2021-11-05 21:16:26 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "appearance.show_erc_warnings",
|
|
|
|
&m_Appearance.show_erc_warnings, true ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "appearance.show_erc_errors",
|
|
|
|
&m_Appearance.show_erc_errors, true ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "appearance.show_erc_exclusions",
|
|
|
|
&m_Appearance.show_erc_exclusions, false ) );
|
|
|
|
|
2023-02-09 17:18:56 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "appearance.show_op_voltages",
|
|
|
|
&m_Appearance.show_op_voltages, true ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "appearance.show_op_currents",
|
|
|
|
&m_Appearance.show_op_currents, true ) );
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "appearance.show_illegal_symbol_lib_dialog",
|
|
|
|
&m_Appearance.show_illegal_symbol_lib_dialog, true ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "appearance.show_page_limits",
|
|
|
|
&m_Appearance.show_page_limits, true ) );
|
|
|
|
|
2020-04-16 16:43:50 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "appearance.show_sexpr_file_convert_warning",
|
|
|
|
&m_Appearance.show_sexpr_file_convert_warning, true ) );
|
|
|
|
|
|
|
|
m_params.emplace_back(
|
|
|
|
new PARAM<bool>( "appearance.show_sheet_filename_case_sensitivity_dialog",
|
2020-01-13 01:44:19 +00:00
|
|
|
&m_Appearance.show_sheet_filename_case_sensitivity_dialog, true ) );
|
|
|
|
|
2022-06-02 21:56:17 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "aui.show_schematic_hierarchy",
|
|
|
|
&m_AuiPanels.show_schematic_hierarchy, true ) );
|
|
|
|
|
2022-06-08 16:09:25 +00:00
|
|
|
m_params.emplace_back( new PARAM<int>( "aui.hierarchy_panel_docked_width",
|
|
|
|
&m_AuiPanels.hierarchy_panel_docked_width, -1 ) );
|
|
|
|
|
2023-05-20 17:47:12 +00:00
|
|
|
m_params.emplace_back( new PARAM<int>( "aui.hierarchy_panel_docked_height",
|
|
|
|
&m_AuiPanels.hierarchy_panel_docked_height, -1 ) );
|
|
|
|
|
2022-06-08 16:09:25 +00:00
|
|
|
m_params.emplace_back( new PARAM<int>( "aui.hierarchy_panel_float_width",
|
|
|
|
&m_AuiPanels.hierarchy_panel_float_width, -1 ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "aui.hierarchy_panel_float_height",
|
|
|
|
&m_AuiPanels.hierarchy_panel_float_height, -1 ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "aui.schematic_hierarchy_float",
|
|
|
|
&m_AuiPanels.schematic_hierarchy_float, false ) );
|
2022-06-02 21:56:17 +00:00
|
|
|
|
2023-05-15 01:35:39 +00:00
|
|
|
m_params.emplace_back( new PARAM<int>( "aui.search_panel_height",
|
|
|
|
&m_AuiPanels.search_panel_height, -1 ) );
|
|
|
|
|
2023-05-19 20:51:57 +00:00
|
|
|
m_params.emplace_back( new PARAM<int>( "aui.search_panel_width",
|
|
|
|
&m_AuiPanels.search_panel_width, -1 ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "aui.search_panel_dock_direction",
|
|
|
|
&m_AuiPanels.search_panel_dock_direction, 0 ) );
|
|
|
|
|
2023-05-15 01:35:39 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "aui.show_search",
|
|
|
|
&m_AuiPanels.show_search, false ) );
|
|
|
|
|
2023-05-20 17:47:12 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "aui.show_net_nav_panel",
|
|
|
|
&m_AuiPanels.show_net_nav_panel, false ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "aui.float_net_nav_panel",
|
|
|
|
&m_AuiPanels.float_net_nav_panel, false ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<wxSize>( "aui.net_nav_panel_docked_size",
|
|
|
|
&m_AuiPanels.net_nav_panel_docked_size, wxSize( 120, -1 ) ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "aui.float_net_nav_panel",
|
|
|
|
&m_AuiPanels.float_net_nav_panel, false ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<wxPoint>( "aui.net_nav_panel_float_pos",
|
|
|
|
&m_AuiPanels.net_nav_panel_float_pos, wxPoint( 50, 200 ), false ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<wxSize>( "aui.net_nav_panel_float_size",
|
|
|
|
&m_AuiPanels.net_nav_panel_float_size, wxSize( 200, 200 ) ) );
|
|
|
|
|
2023-06-21 01:57:20 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "aui.show_properties",
|
|
|
|
&m_AuiPanels.show_properties, true ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "aui.properties_panel_width",
|
|
|
|
&m_AuiPanels.properties_panel_width, -1 ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<float>( "aui.properties_splitter_proportion",
|
2023-09-25 11:35:31 +00:00
|
|
|
&m_AuiPanels.properties_splitter, 0.5f ) );
|
2023-06-21 01:57:20 +00:00
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "autoplace_fields.enable",
|
|
|
|
&m_AutoplaceFields.enable, true ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "autoplace_fields.allow_rejustify",
|
|
|
|
&m_AutoplaceFields.allow_rejustify, true ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "autoplace_fields.align_to_grid",
|
|
|
|
&m_AutoplaceFields.align_to_grid, true ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "drawing.default_bus_thickness",
|
2021-08-25 18:36:37 +00:00
|
|
|
&m_Drawing.default_bus_thickness, DEFAULT_BUS_WIDTH_MILS ) );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "drawing.default_junction_size",
|
2020-04-12 17:50:33 +00:00
|
|
|
&m_Drawing.default_junction_size, DEFAULT_JUNCTION_DIAM ) );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
2020-05-03 23:55:31 +00:00
|
|
|
m_params.emplace_back( new PARAM<int>( "drawing.pin_symbol_size",
|
|
|
|
&m_Drawing.pin_symbol_size, DEFAULT_TEXT_SIZE / 2 ) );
|
|
|
|
|
2021-08-25 18:36:37 +00:00
|
|
|
m_params.emplace_back( new PARAM<double>( "drawing.text_offset_ratio",
|
|
|
|
&m_Drawing.text_offset_ratio, 0.08 ) );
|
2020-05-20 03:34:55 +00:00
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
m_params.emplace_back( new PARAM<int>( "drawing.default_line_thickness",
|
2021-08-25 18:36:37 +00:00
|
|
|
&m_Drawing.default_line_thickness, DEFAULT_LINE_WIDTH_MILS ) );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "drawing.default_repeat_offset_x",
|
|
|
|
&m_Drawing.default_repeat_offset_x, 0 ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "drawing.default_repeat_offset_y",
|
|
|
|
&m_Drawing.default_repeat_offset_y, 100 ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "drawing.default_wire_thickness",
|
2021-08-25 18:36:37 +00:00
|
|
|
&m_Drawing.default_wire_thickness, DEFAULT_WIRE_WIDTH_MILS ) );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
2021-08-25 18:36:37 +00:00
|
|
|
m_params.emplace_back( new PARAM<int>( "drawing.default_text_size",
|
|
|
|
&m_Drawing.default_text_size, DEFAULT_TEXT_SIZE ) );
|
2020-05-20 03:34:55 +00:00
|
|
|
|
2020-04-12 23:28:33 +00:00
|
|
|
m_params.emplace_back( new PARAM<wxString>( "drawing.field_names",
|
|
|
|
&m_Drawing.field_names, "" ) );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
2022-03-22 16:49:38 +00:00
|
|
|
m_params.emplace_back( new PARAM<int>( "drawing.line_mode", &m_Drawing.line_mode,
|
|
|
|
LINE_MODE::LINE_MODE_90 ) );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
2020-10-01 23:53:47 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "drawing.auto_start_wires",
|
|
|
|
&m_Drawing.auto_start_wires, true ) );
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
m_params.emplace_back( new PARAM<int>( "drawing.repeat_label_increment",
|
2021-10-22 21:19:53 +00:00
|
|
|
&m_Drawing.repeat_label_increment, 1 ) );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
2020-04-09 23:34:38 +00:00
|
|
|
m_params.emplace_back( new PARAM<COLOR4D>( "drawing.default_sheet_border_color",
|
2021-01-15 19:39:06 +00:00
|
|
|
&m_Drawing.default_sheet_border_color, COLOR4D::UNSPECIFIED ) );
|
2020-04-09 23:34:38 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<COLOR4D>( "drawing.default_sheet_background_color",
|
2021-01-15 19:39:06 +00:00
|
|
|
&m_Drawing.default_sheet_background_color, COLOR4D::UNSPECIFIED ) );
|
2020-04-09 23:34:38 +00:00
|
|
|
|
2020-10-08 17:04:53 +00:00
|
|
|
m_params.emplace_back( new PARAM_LIST<double>( "drawing.junction_size_mult_list",
|
|
|
|
&m_Drawing.junction_size_mult_list, { 0.0, 1.7, 4.0, 6.0, 9.0, 12.0 } ) );
|
|
|
|
|
|
|
|
m_params.emplace_back(new PARAM <int>( "drawing.junction_size_choice",
|
|
|
|
&m_Drawing.junction_size_choice, 3 ) );
|
|
|
|
|
2022-08-05 02:40:38 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "find_replace.search_all_fields",
|
|
|
|
&m_FindReplaceExtra.search_all_fields, false ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "find_replace.search_all_pins",
|
|
|
|
&m_FindReplaceExtra.search_all_pins, false ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "find_replace.search_current_sheet_only",
|
|
|
|
&m_FindReplaceExtra.search_current_sheet_only,
|
|
|
|
false ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "find_replace.replace_references",
|
|
|
|
&m_FindReplaceExtra.replace_references, false ) );
|
|
|
|
|
2020-04-12 23:28:33 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "input.drag_is_move",
|
2021-11-03 16:57:47 +00:00
|
|
|
&m_Input.drag_is_move, false ) );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
2022-07-23 09:32:21 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "input.esc_clears_net_highlight",
|
|
|
|
&m_Input.esc_clears_net_highlight, true ) );
|
|
|
|
|
2020-04-12 23:28:33 +00:00
|
|
|
m_params.emplace_back( new PARAM<int>( "selection.thickness",
|
2021-09-15 20:03:07 +00:00
|
|
|
&m_Selection.selection_thickness, 3 ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "selection.highlight_thickness",
|
|
|
|
&m_Selection.highlight_thickness, 2 ) );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "selection.draw_selected_children",
|
|
|
|
&m_Selection.draw_selected_children, true ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "selection.fill_shapes",
|
|
|
|
&m_Selection.fill_shapes, false ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "selection.select_pin_selects_symbol",
|
2023-02-11 13:51:55 +00:00
|
|
|
&m_Selection.select_pin_selects_symbol, false ) );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
2022-03-30 17:41:40 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "annotation.automatic",
|
|
|
|
&m_AnnotatePanel.automatic, true ) );
|
|
|
|
|
2022-04-22 11:55:00 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "annotation.recursive",
|
|
|
|
&m_AnnotatePanel.recursive, true ) );
|
|
|
|
|
2020-04-12 23:28:33 +00:00
|
|
|
m_params.emplace_back( new PARAM<int>( "annotation.method",
|
|
|
|
&m_AnnotatePanel.method, 0, 0, 2 ) );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
2021-04-26 14:19:11 +00:00
|
|
|
m_params.emplace_back( new PARAM<int>( "annotation.scope",
|
|
|
|
&m_AnnotatePanel.scope, 0, 0, 2 ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "annotation.options",
|
|
|
|
&m_AnnotatePanel.options, 0, 0, 2 ) );
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
m_params.emplace_back( new PARAM<int>( "annotation.messages_filter",
|
|
|
|
&m_AnnotatePanel.messages_filter, -1 ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "annotation.sort_order",
|
|
|
|
&m_AnnotatePanel.sort_order, 0, 0, 1 ) );
|
|
|
|
|
2020-04-12 23:28:33 +00:00
|
|
|
m_params.emplace_back( new PARAM<wxString>( "bom.selected_plugin",
|
|
|
|
&m_BomPanel.selected_plugin, "" ) );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
2021-02-25 03:37:30 +00:00
|
|
|
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "bom.plugins",
|
|
|
|
std::bind( &EESCHEMA_SETTINGS::bomSettingsToJson, this ),
|
|
|
|
[&]( const nlohmann::json& aObj )
|
|
|
|
{
|
|
|
|
if( !aObj.is_array() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
const nlohmann::json& list = aObj.empty() ? defaultBomPlugins : aObj;
|
|
|
|
|
|
|
|
m_BomPanel.plugins = bomSettingsFromJson( list );
|
|
|
|
},
|
|
|
|
defaultBomPlugins ) );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
2021-09-05 14:13:52 +00:00
|
|
|
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "netlist.plugins",
|
|
|
|
std::bind( &EESCHEMA_SETTINGS::netlistSettingsToJson, this ),
|
|
|
|
[&]( const nlohmann::json& aObj )
|
|
|
|
{
|
|
|
|
if( !aObj.is_array() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if( aObj.empty() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
const nlohmann::json& list = aObj;
|
|
|
|
|
|
|
|
m_NetlistPanel.plugins = netlistSettingsFromJson( list );
|
|
|
|
},
|
|
|
|
nullptr ) );
|
|
|
|
|
2020-04-19 11:34:01 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "page_settings.export_paper",
|
|
|
|
&m_PageSettings.export_paper, false ) );
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "page_settings.export_revision",
|
|
|
|
&m_PageSettings.export_revision, false ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "page_settings.export_date",
|
|
|
|
&m_PageSettings.export_date, false ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "page_settings.export_title",
|
|
|
|
&m_PageSettings.export_title, false ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "page_settings.export_company",
|
|
|
|
&m_PageSettings.export_company, false ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment1",
|
|
|
|
&m_PageSettings.export_comment1, false ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment2",
|
|
|
|
&m_PageSettings.export_comment2, false ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment3",
|
|
|
|
&m_PageSettings.export_comment3, false ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment4",
|
|
|
|
&m_PageSettings.export_comment4, false ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment5",
|
|
|
|
&m_PageSettings.export_comment5, false ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment6",
|
|
|
|
&m_PageSettings.export_comment6, false ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment7",
|
|
|
|
&m_PageSettings.export_comment7, false ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment8",
|
|
|
|
&m_PageSettings.export_comment8, false ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "page_settings.export_comment9",
|
|
|
|
&m_PageSettings.export_comment9, false ) );
|
|
|
|
|
2023-04-01 12:57:59 +00:00
|
|
|
m_params.emplace_back( new PARAM_MAP<int>( "field_editor.field_widths",
|
|
|
|
&m_FieldEditorPanel.field_widths, {} ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "field_editor.width", &m_FieldEditorPanel.width, 0 ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "field_editor.height", &m_FieldEditorPanel.height, 0 ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "field_editor.page", &m_FieldEditorPanel.page, 0 ) );
|
|
|
|
|
2023-06-04 17:45:07 +00:00
|
|
|
m_params.emplace_back( new PARAM<wxString>( "field_editor.export_filename",
|
|
|
|
&m_FieldEditorPanel.export_filename, wxT( "" ) ) );
|
|
|
|
|
2023-08-07 17:49:27 +00:00
|
|
|
m_params.emplace_back( new PARAM<int>( "field_editor.selection_mode",
|
|
|
|
&m_FieldEditorPanel.selection_mode, 0 ) );
|
|
|
|
|
2023-08-07 19:04:46 +00:00
|
|
|
m_params.emplace_back( new PARAM<int>( "field_editor.scope", &m_FieldEditorPanel.scope, 0 ) );
|
|
|
|
|
2020-04-12 23:28:33 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "plot.background_color",
|
|
|
|
&m_PlotPanel.background_color, false ) );
|
2020-03-06 03:00:30 +00:00
|
|
|
|
2020-04-12 23:28:33 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "plot.color",
|
|
|
|
&m_PlotPanel.color, true ) );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
2020-04-12 23:28:33 +00:00
|
|
|
m_params.emplace_back( new PARAM<wxString>( "plot.color_theme",
|
|
|
|
&m_PlotPanel.color_theme, wxT( "user" ) ) );
|
2020-03-06 03:00:30 +00:00
|
|
|
|
2020-04-12 23:28:33 +00:00
|
|
|
m_params.emplace_back( new PARAM<int>( "plot.format",
|
|
|
|
&m_PlotPanel.format, 0 ) );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "plot.frame_reference",
|
|
|
|
&m_PlotPanel.frame_reference, true ) );
|
|
|
|
|
2023-10-21 20:52:51 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "plot.pdf_property_popups",
|
|
|
|
&m_PlotPanel.pdf_property_popups, true ) );
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
m_params.emplace_back( new PARAM<int>( "plot.hpgl_paper_size",
|
|
|
|
&m_PlotPanel.hpgl_paper_size, 0 ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<double>( "plot.hpgl_pen_size",
|
|
|
|
&m_PlotPanel.hpgl_pen_size, 0.5 ) );
|
|
|
|
|
2020-12-21 23:27:31 +00:00
|
|
|
m_params.emplace_back( new PARAM<int>( "plot.hpgl_origin",
|
|
|
|
&m_PlotPanel.hpgl_origin, 0 ) );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
2022-08-21 15:21:09 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "plot.other_open_file_after_plot",
|
|
|
|
&m_PlotPanel.open_file_after_plot, false ) );
|
|
|
|
|
2020-04-12 23:28:33 +00:00
|
|
|
m_params.emplace_back( new PARAM<int>( "simulator.window.pos_x",
|
2020-08-24 02:01:14 +00:00
|
|
|
&m_Simulator.window.state.pos_x, 0 ) );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
2020-04-12 23:28:33 +00:00
|
|
|
m_params.emplace_back( new PARAM<int>( "simulator.window.pos_y",
|
2020-08-24 02:01:14 +00:00
|
|
|
&m_Simulator.window.state.pos_y, 0 ) );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "simulator.window.size_x",
|
2020-08-24 02:01:14 +00:00
|
|
|
&m_Simulator.window.state.size_x, 500 ) );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "simulator.window.size_y",
|
2020-08-24 02:01:14 +00:00
|
|
|
&m_Simulator.window.state.size_y, 400 ) );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
2020-07-27 02:53:56 +00:00
|
|
|
m_params.emplace_back( new PARAM<unsigned int>( "simulator.window.display",
|
2020-08-24 02:01:14 +00:00
|
|
|
&m_Simulator.window.state.display, 0 ) );
|
2020-07-27 02:53:56 +00:00
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "simulator.window.maximized",
|
2020-08-24 02:01:14 +00:00
|
|
|
&m_Simulator.window.state.maximized, false ) );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<wxString>( "simulator.window.perspective",
|
|
|
|
&m_Simulator.window.perspective, "" ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "simulator.plot_panel_width",
|
|
|
|
&m_Simulator.plot_panel_width, 0 ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "simulator.plot_panel_height",
|
|
|
|
&m_Simulator.plot_panel_height, 0 ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "simulator.signal_panel_height",
|
|
|
|
&m_Simulator.signal_panel_height, 0 ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "simulator.cursors_panel_height",
|
|
|
|
&m_Simulator.cursors_panel_height, 0 ) );
|
|
|
|
|
2023-02-11 20:39:50 +00:00
|
|
|
m_params.emplace_back( new PARAM<int>( "simulator.measurements_panel_height",
|
|
|
|
&m_Simulator.measurements_panel_height, 0 ) );
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "simulator.white_background",
|
|
|
|
&m_Simulator.white_background, false ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "symbol_chooser.sash_pos_h",
|
|
|
|
&m_SymChooserPanel.sash_pos_h, -1 ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "symbol_chooser.sash_pos_v",
|
|
|
|
&m_SymChooserPanel.sash_pos_v, -1 ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "symbol_chooser.width",
|
|
|
|
&m_SymChooserPanel.width, -1 ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "symbol_chooser.height",
|
|
|
|
&m_SymChooserPanel.height, -1 ) );
|
|
|
|
|
2023-05-01 20:26:29 +00:00
|
|
|
m_params.emplace_back( new PARAM<int>( "symbol_chooser.sort_mode",
|
|
|
|
&m_SymChooserPanel.sort_mode, 0 ) );
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "symbol_chooser.keep_symbol",
|
|
|
|
&m_SymChooserPanel.keep_symbol, false ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "symbol_chooser.place_all_units",
|
|
|
|
&m_SymChooserPanel.place_all_units, true ) );
|
|
|
|
|
2023-10-09 00:54:34 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "import_graphics.interactive_placement",
|
|
|
|
&m_ImportGraphics.interactive_placement, true ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "import_graphics.line_width_units",
|
|
|
|
&m_ImportGraphics.dxf_line_width_units, 0 ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<double>( "import_graphics.line_width",
|
|
|
|
&m_ImportGraphics.dxf_line_width, 0.2 ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "import_graphics.origin_units",
|
|
|
|
&m_ImportGraphics.origin_units, 0 ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<double>( "import_graphics.origin_x",
|
|
|
|
&m_ImportGraphics.origin_x, 0 ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<double>( "import_graphics.origin_y",
|
|
|
|
&m_ImportGraphics.origin_y, 0 ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "import_graphics.dxf_units",
|
|
|
|
&m_ImportGraphics.dxf_units, 0 ) );
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "system.never_show_rescue_dialog",
|
|
|
|
&m_RescueNeverShow, false ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "lib_view.window.pos_x",
|
2020-08-24 02:01:14 +00:00
|
|
|
&m_LibViewPanel.window.state.pos_x, 0 ) );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "lib_view.window.pos_y",
|
2020-08-24 02:01:14 +00:00
|
|
|
&m_LibViewPanel.window.state.pos_y, 0 ) );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "lib_view.window.size_x",
|
2020-08-24 02:01:14 +00:00
|
|
|
&m_LibViewPanel.window.state.size_x, 500 ) );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "lib_view.window.size_y",
|
2020-08-24 02:01:14 +00:00
|
|
|
&m_LibViewPanel.window.state.size_y, 400 ) );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
2020-07-27 02:53:56 +00:00
|
|
|
m_params.emplace_back( new PARAM<unsigned int>( "lib_view.window.display",
|
2020-08-24 02:01:14 +00:00
|
|
|
&m_LibViewPanel.window.state.display, 0 ) );
|
2020-07-27 02:53:56 +00:00
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
m_params.emplace_back( new PARAM<bool>( "lib_view.window.maximized",
|
2020-08-24 02:01:14 +00:00
|
|
|
&m_LibViewPanel.window.state.maximized, false ) );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<wxString>( "lib_view.window.perspective",
|
|
|
|
&m_LibViewPanel.window.perspective, "" ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "lib_view.lib_list_width",
|
|
|
|
&m_LibViewPanel.lib_list_width, 150 ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<int>( "lib_view.cmp_list_width",
|
|
|
|
&m_LibViewPanel.cmp_list_width, 150 ) );
|
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<bool>( "lib_view.show_pin_electrical_type",
|
|
|
|
&m_LibViewPanel.show_pin_electrical_type, true ) );
|
2020-09-01 02:00:38 +00:00
|
|
|
|
|
|
|
m_params.emplace_back( new PARAM<wxString>( "system.last_symbol_lib_dir",
|
2021-12-07 00:14:36 +00:00
|
|
|
&m_lastSymbolLibDir, "" ) );
|
2020-08-31 14:11:54 +00:00
|
|
|
|
2021-02-25 03:37:30 +00:00
|
|
|
|
|
|
|
// Migrations
|
|
|
|
|
|
|
|
registerMigration( 0, 1,
|
|
|
|
[&]() -> bool
|
|
|
|
{
|
|
|
|
// Version 0 to 1: BOM plugin settings moved from sexpr to JSON
|
|
|
|
return migrateBomSettings();
|
|
|
|
} );
|
2022-08-15 22:43:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
registerMigration( 1, 2,
|
|
|
|
[&]() -> bool
|
|
|
|
{
|
|
|
|
// We used to have a bug on GTK which would set the lib tree column width way
|
|
|
|
// too narrow.
|
2022-08-25 22:50:47 +00:00
|
|
|
if( std::optional<int> optval = Get<int>( "lib_tree.column_width" ) )
|
2022-08-15 22:43:42 +00:00
|
|
|
{
|
|
|
|
if( optval < 150 )
|
|
|
|
Set( "lib_tree.column_width", 300 );
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} );
|
2022-08-28 23:02:12 +00:00
|
|
|
|
|
|
|
registerMigration( 2, 3,
|
|
|
|
[&]() -> bool
|
|
|
|
{
|
|
|
|
// This is actually a migration for APP_SETTINGS_BASE::m_LibTree
|
|
|
|
return migrateLibTreeWidth();
|
|
|
|
} );
|
2020-01-13 01:44:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool EESCHEMA_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg )
|
|
|
|
{
|
|
|
|
bool ret = APP_SETTINGS_BASE::MigrateFromLegacy( aCfg );
|
|
|
|
|
2020-12-27 17:12:24 +00:00
|
|
|
// Now modify the loaded grid selection, because in earlier versions the grids index was shared
|
|
|
|
// between all applications and started at 1000 mils. There is a 4-position offset between
|
|
|
|
// this index and the possible eeschema grids list that we have to subtract.
|
2021-06-04 03:52:50 +00:00
|
|
|
std::string gridSizePtr = "window.grid.last_size";
|
2020-12-27 17:12:24 +00:00
|
|
|
|
2022-08-25 22:50:47 +00:00
|
|
|
if( std::optional<int> currentSize = Get<int>( gridSizePtr ) )
|
2020-12-27 17:12:24 +00:00
|
|
|
{
|
2021-06-04 03:52:50 +00:00
|
|
|
Set( gridSizePtr, *currentSize - 4 );
|
2020-12-27 17:12:24 +00:00
|
|
|
}
|
2021-06-04 03:52:50 +00:00
|
|
|
else
|
2020-12-27 17:12:24 +00:00
|
|
|
{
|
|
|
|
// Otherwise, default grid size should be 50 mils; index 1
|
2021-06-04 03:52:50 +00:00
|
|
|
Set( gridSizePtr, 1 );
|
2020-12-27 17:12:24 +00:00
|
|
|
}
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
ret &= fromLegacy<bool>( aCfg, "FootprintPreview", "appearance.footprint_preview" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "NavigatorStaysOpen", "appearance.navigator_stays_open" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "PrintSheetReferenceAndTitleBlock",
|
|
|
|
"appearance.print_sheet_reference" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "ShowHiddenPins", "appearance.show_hidden_pins" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "ShowIllegalSymbolLibDialog",
|
|
|
|
"appearance.show_illegal_symbol_lib_dialog" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "ShowPageLimits", "appearance.show_page_limits" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "ShowSheetFileNameCaseSensitivityDlg",
|
|
|
|
"appearance.show_sheet_filename_case_sensitivity_dialog" );
|
|
|
|
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "AutoplaceFields", "autoplace_fields.enable" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "AutoplaceJustify", "autoplace_fields.allow_rejustify" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "AutoplaceAlign", "autoplace_fields.align_to_grid" );
|
|
|
|
|
|
|
|
ret &= fromLegacy<int>( aCfg, "DefaultBusWidth", "drawing.default_bus_thickness" );
|
|
|
|
ret &= fromLegacy<int>( aCfg, "DefaultJunctionSize", "drawing.default_junction_size" );
|
|
|
|
ret &= fromLegacy<int>( aCfg, "DefaultDrawLineWidth", "drawing.default_line_thickness" );
|
|
|
|
ret &= fromLegacy<int>( aCfg, "RepeatStepX", "drawing.default_repeat_offset_x" );
|
|
|
|
ret &= fromLegacy<int>( aCfg, "RepeatStepY", "drawing.default_repeat_offset_y" );
|
|
|
|
ret &= fromLegacy<int>( aCfg, "DefaultWireWidth", "drawing.default_wire_thickness" );
|
|
|
|
ret &= fromLegacyString( aCfg, "FieldNames", "drawing.field_names" );
|
2022-03-22 16:49:38 +00:00
|
|
|
ret &= fromLegacy<bool>( aCfg, "HorizVertLinesOnly", "drawing.line_mode" );
|
2020-01-13 01:44:19 +00:00
|
|
|
ret &= fromLegacy<int>( aCfg, "RepeatLabelIncrement", "drawing.repeat_label_increment" );
|
|
|
|
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "DragActionIsMove", "input.drag_is_move" );
|
|
|
|
|
|
|
|
ret &= fromLegacy<int>( aCfg, "SelectionThickness", "selection.thickness" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "SelectionDrawChildItems", "selection.draw_selected_children" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "SelectionFillShapes", "selection.fill_shapes" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "SelectPinSelectSymbolOpt",
|
|
|
|
"selection.select_pin_selects_symbol" );
|
|
|
|
|
|
|
|
ret &= fromLegacy<int>( aCfg, "AnnotateAlgoOption", "annotation.method" );
|
|
|
|
ret &= fromLegacy<int>( aCfg, "AnnotateFilterMsg", "annotation.messages_filter" );
|
|
|
|
ret &= fromLegacy<int>( aCfg, "AnnotateSortOption", "annotation.sort_order" );
|
|
|
|
|
|
|
|
ret &= fromLegacyString( aCfg, "bom_plugin_selected", "bom.selected_plugin" );
|
|
|
|
ret &= fromLegacyString( aCfg, "bom_plugins", "bom.plugins" );
|
|
|
|
|
2021-02-25 03:37:30 +00:00
|
|
|
migrateBomSettings();
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
ret &= fromLegacyString( aCfg, "SymbolFieldsShownColumns",
|
|
|
|
"edit_sch_component.visible_columns" );
|
|
|
|
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "PageSettingsExportRevision", "page_settings.export_revision" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "PageSettingsExportDate", "page_settings.export_date" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "PageSettingsExportTitle", "page_settings.export_title" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "PageSettingsExportCompany", "page_settings.export_company" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment1", "page_settings.export_comment1" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment2", "page_settings.export_comment2" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment3", "page_settings.export_comment3" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment4", "page_settings.export_comment4" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment5", "page_settings.export_comment5" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment6", "page_settings.export_comment6" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment7", "page_settings.export_comment7" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment8", "page_settings.export_comment8" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "PageSettingsExportComment9", "page_settings.export_comment9" );
|
|
|
|
|
2021-09-05 14:13:52 +00:00
|
|
|
#if 0 // To do: move this code to the new netlist plugin management in settings
|
2020-01-13 01:44:19 +00:00
|
|
|
{
|
|
|
|
constexpr int max_custom_commands = 8; // from DIALOG_NETLIST
|
|
|
|
nlohmann::json js_cmd = nlohmann::json::array();
|
|
|
|
nlohmann::json js_title = nlohmann::json::array();
|
|
|
|
wxString cmd_key, title_key, cmd, title;
|
|
|
|
|
|
|
|
for( int i = 1; i <= max_custom_commands; ++i )
|
|
|
|
{
|
|
|
|
// Only migrate if both title and command are specified
|
|
|
|
cmd_key.Printf( "CustomNetlistCommand%d", i );
|
|
|
|
title_key.Printf( "CustomNetlistTitle%d", i );
|
|
|
|
|
|
|
|
if( aCfg->Read( cmd_key, &cmd ) && aCfg->Read( title_key, &title )
|
|
|
|
&& !cmd.IsEmpty() && !title.IsEmpty() )
|
|
|
|
{
|
|
|
|
js_cmd.push_back( cmd.ToUTF8() );
|
|
|
|
js_title.push_back( title.ToUTF8() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-04 03:52:50 +00:00
|
|
|
Set( "netlist.custom_command_titles", js_title );
|
|
|
|
Set( "netlist.custom_command_paths", js_cmd );
|
2020-01-13 01:44:19 +00:00
|
|
|
}
|
2021-09-05 14:13:52 +00:00
|
|
|
#endif
|
2020-01-13 01:44:19 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
// NOTE(JE) These parameters should move to project-local storage before V6, but we are
|
|
|
|
// migrating them here in order to preserve data. There is a bug here that is preserved:
|
|
|
|
// keys are taken directly from the (translated) UI and stored in the config, so if the user
|
|
|
|
// changes languages the keys will no longer work.
|
|
|
|
aCfg->SetPath( "SymbolFieldEditor/Show/" );
|
|
|
|
|
|
|
|
nlohmann::json js = nlohmann::json( {} );
|
|
|
|
wxString key;
|
|
|
|
bool value = false;
|
|
|
|
long index = 0;
|
|
|
|
|
|
|
|
while( aCfg->GetNextEntry( key, index ) )
|
|
|
|
{
|
|
|
|
if( aCfg->Read( key, &value ) )
|
|
|
|
{
|
|
|
|
std::string key_utf( key.ToUTF8() );
|
2022-01-03 18:05:45 +00:00
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
js[key_utf] = value;
|
|
|
|
}
|
|
|
|
catch(...)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2020-01-13 01:44:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-04 03:52:50 +00:00
|
|
|
Set( "field_editor.fields_show", js );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
|
|
|
aCfg->SetPath( "../GroupBy" );
|
|
|
|
|
|
|
|
while( aCfg->GetNextEntry( key, index ) )
|
|
|
|
{
|
|
|
|
if( aCfg->Read( key, &value ) )
|
|
|
|
{
|
|
|
|
std::string key_utf( key.ToUTF8() );
|
2022-01-03 18:05:45 +00:00
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
js[key_utf] = value;
|
|
|
|
}
|
|
|
|
catch(...)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2020-01-13 01:44:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-04 03:52:50 +00:00
|
|
|
Set( "field_editor.fields_group_by", js );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
|
|
|
aCfg->SetPath( "../.." );
|
|
|
|
}
|
|
|
|
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "PlotModeColor", "plot.color" );
|
|
|
|
ret &= fromLegacy<int>( aCfg, "PlotFormat", "plot.format" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "PlotFrameRef", "plot.frame_reference" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "PlotHPGLOrg", "plot.hpgl_origin" );
|
|
|
|
ret &= fromLegacy<int>( aCfg, "PlotHPGLPaperSize", "plot.hpgl_paper_size" );
|
|
|
|
ret &= fromLegacy<double>( aCfg, "PlotHPGLPenSize", "plot.hpgl_pen_size" );
|
|
|
|
|
|
|
|
ret &= fromLegacy<int>( aCfg, "SIM_PLOT_FRAMEPos_x", "simulator.window.pos_x" );
|
|
|
|
ret &= fromLegacy<int>( aCfg, "SIM_PLOT_FRAMEPos_y", "simulator.window.pos_y" );
|
|
|
|
ret &= fromLegacy<int>( aCfg, "SIM_PLOT_FRAMESize_x", "simulator.window.size_x" );
|
|
|
|
ret &= fromLegacy<int>( aCfg, "SIM_PLOT_FRAMESize_y", "simulator.window.size_y" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "SIM_PLOT_FRAMEMaximized", "simulator.window.maximized" );
|
|
|
|
ret &= fromLegacyString( aCfg, "SIM_PLOT_FRAMEPerspective", "simulator.window.perspective" );
|
|
|
|
ret &= fromLegacyString( aCfg, "SIM_PLOT_FRAMEMostRecentlyUsedPath", "simulator.mru_path" );
|
|
|
|
ret &= fromLegacy<int>( aCfg, "SimPlotPanelWidth", "simulator.plot_panel_width" );
|
|
|
|
ret &= fromLegacy<int>( aCfg, "SimPlotPanelHeight", "simulator.plot_panel_height" );
|
|
|
|
ret &= fromLegacy<int>( aCfg, "SimSignalPanelHeight", "simulator.signal_panel_height" );
|
|
|
|
ret &= fromLegacy<int>( aCfg, "SimCursorsPanelHeight", "simulator.cursors_panel_height" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "SimPlotWhiteBg", "simulator.white_background" );
|
|
|
|
|
|
|
|
ret &= fromLegacy<int>( aCfg, "SymbolChooserHSashPosition", "symbol_chooser.sash_pos_h" );
|
|
|
|
ret &= fromLegacy<int>( aCfg, "SymbolChooserVSashPosition", "symbol_chooser.sash_pos_v" );
|
|
|
|
ret &= fromLegacy<int>( aCfg, "SymbolChooserWidth", "symbol_chooser.width" );
|
|
|
|
ret &= fromLegacy<int>( aCfg, "SymbolChooserHeight", "symbol_chooser.height" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "SymbolChooserKeepSymbol", "symbol_chooser.keep_symbol" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "SymbolChooserUseUnits", "symbol_chooser.place_all_units" );
|
|
|
|
|
|
|
|
const std::string vlf = "ViewlibFrame";
|
|
|
|
ret &= fromLegacy<bool>( aCfg, vlf + "Maximized", "lib_view.window.maximized" );
|
|
|
|
ret &= fromLegacyString( aCfg, vlf + "MostRecentlyUsedPath", "lib_view.window.mru_path" );
|
|
|
|
ret &= fromLegacy<int>( aCfg, vlf + "Size_x", "lib_view.window.size_x" );
|
|
|
|
ret &= fromLegacy<int>( aCfg, vlf + "Size_y", "lib_view.window.size_y" );
|
|
|
|
ret &= fromLegacyString( aCfg, vlf + "Perspective", "lib_view.window.perspective" );
|
|
|
|
ret &= fromLegacy<int>( aCfg, vlf + "Pos_x", "lib_view.window.pos_x" );
|
|
|
|
ret &= fromLegacy<int>( aCfg, vlf + "Pos_y", "lib_view.window.pos_y" );
|
|
|
|
ret &= fromLegacy<int>( aCfg, "ViewLiblistWidth", "lib_view.lib_list_width" );
|
|
|
|
ret &= fromLegacy<int>( aCfg, "ViewCmplistWidth", "lib_view.cmp_list_width" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg,
|
|
|
|
"ViewCmpShowPinElectricalType", "lib_view.show_pin_electrical_type" );
|
|
|
|
ret &= fromLegacy<bool>( aCfg, vlf + "ShowGrid", "lib_view.grid.show" );
|
|
|
|
ret &= fromLegacy<int>( aCfg, vlf + "_LastGridSize", "lib_view.grid.last_size" );
|
|
|
|
|
|
|
|
ret &= fromLegacy<bool>( aCfg, "RescueNeverShow", "system.never_show_rescue_dialog" );
|
|
|
|
|
|
|
|
// Legacy version stored this setting in eeschema, so move it to common if it exists
|
2021-07-08 12:33:08 +00:00
|
|
|
bool tmp;
|
|
|
|
|
|
|
|
if( aCfg->Read( "MoveWarpsCursor", &tmp ) )
|
|
|
|
Pgm().GetCommonSettings()->m_Input.warp_mouse_on_move = tmp;
|
2020-01-13 01:44:19 +00:00
|
|
|
|
2020-10-15 01:57:36 +00:00
|
|
|
COLOR_SETTINGS* cs = Pgm().GetSettingsManager().GetMigratedColorSettings();
|
2020-01-13 01:44:19 +00:00
|
|
|
|
|
|
|
auto migrateLegacyColor = [&] ( const std::string& aKey, int aLayerId ) {
|
|
|
|
wxString str;
|
|
|
|
|
|
|
|
if( aCfg->Read( aKey, &str ) )
|
|
|
|
cs->SetColor( aLayerId, COLOR4D( str ) );
|
|
|
|
};
|
|
|
|
|
|
|
|
migrateLegacyColor( "Color4DBgCanvasEx", LAYER_SCHEMATIC_BACKGROUND );
|
|
|
|
migrateLegacyColor( "Color4DBodyBgEx", LAYER_DEVICE_BACKGROUND );
|
|
|
|
migrateLegacyColor( "Color4DBodyEx", LAYER_DEVICE );
|
|
|
|
migrateLegacyColor( "Color4DBrightenedEx", LAYER_BRIGHTENED );
|
|
|
|
migrateLegacyColor( "Color4DBusEx", LAYER_BUS );
|
|
|
|
migrateLegacyColor( "Color4DConnEx", LAYER_JUNCTION );
|
|
|
|
migrateLegacyColor( "Color4DCursorEx", LAYER_SCHEMATIC_CURSOR );
|
|
|
|
migrateLegacyColor( "Color4DErcEEx", LAYER_ERC_ERR );
|
|
|
|
migrateLegacyColor( "Color4DErcWEx", LAYER_ERC_WARN );
|
|
|
|
migrateLegacyColor( "Color4DFieldEx", LAYER_FIELDS );
|
|
|
|
migrateLegacyColor( "Color4DGLabelEx", LAYER_GLOBLABEL );
|
|
|
|
migrateLegacyColor( "Color4DGridEx", LAYER_SCHEMATIC_GRID );
|
|
|
|
migrateLegacyColor( "Color4DHLabelEx", LAYER_HIERLABEL );
|
|
|
|
migrateLegacyColor( "Color4DHiddenEx", LAYER_HIDDEN );
|
|
|
|
migrateLegacyColor( "Color4DLLabelEx", LAYER_LOCLABEL );
|
|
|
|
migrateLegacyColor( "Color4DNoConnectEx", LAYER_NOCONNECT );
|
|
|
|
migrateLegacyColor( "Color4DNoteEx", LAYER_NOTES );
|
|
|
|
migrateLegacyColor( "Color4DPinEx", LAYER_PIN );
|
|
|
|
migrateLegacyColor( "Color4DPinNameEx", LAYER_PINNAM );
|
|
|
|
migrateLegacyColor( "Color4DPinNumEx", LAYER_PINNUM );
|
|
|
|
migrateLegacyColor( "Color4DReferenceEx", LAYER_REFERENCEPART );
|
|
|
|
migrateLegacyColor( "Color4DShadowEx", LAYER_SELECTION_SHADOWS );
|
|
|
|
migrateLegacyColor( "Color4DSheetEx", LAYER_SHEET );
|
|
|
|
migrateLegacyColor( "Color4DSheetFileNameEx", LAYER_SHEETFILENAME );
|
|
|
|
migrateLegacyColor( "Color4DSheetLabelEx", LAYER_SHEETLABEL );
|
|
|
|
migrateLegacyColor( "Color4DSheetNameEx", LAYER_SHEETNAME );
|
|
|
|
migrateLegacyColor( "Color4DValueEx", LAYER_VALUEPART );
|
|
|
|
migrateLegacyColor( "Color4DWireEx", LAYER_WIRE );
|
2021-02-22 16:37:43 +00:00
|
|
|
migrateLegacyColor( "Color4DWorksheetEx", LAYER_SCHEMATIC_DRAWINGSHEET );
|
2020-01-13 01:44:19 +00:00
|
|
|
|
2020-03-01 02:49:35 +00:00
|
|
|
Pgm().GetSettingsManager().SaveColorSettings( cs, "schematic" );
|
|
|
|
|
2021-06-04 03:52:50 +00:00
|
|
|
Set( "appearance.color_theme", cs->GetFilename() );
|
2020-10-15 01:57:36 +00:00
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
// LibEdit settings were stored with eeschema. If eeschema is the first app to run,
|
|
|
|
// we need to migrate the LibEdit settings here
|
|
|
|
|
2023-04-18 20:40:25 +00:00
|
|
|
auto libedit = Pgm().GetSettingsManager().GetAppSettings<SYMBOL_EDITOR_SETTINGS>();
|
2020-01-13 01:44:19 +00:00
|
|
|
libedit->MigrateFromLegacy( aCfg );
|
|
|
|
libedit->Load();
|
|
|
|
|
|
|
|
return ret;
|
2020-04-16 16:43:50 +00:00
|
|
|
}
|
2021-02-25 03:37:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Used for parsing legacy-format bom plugin configurations. Only used for migrating into
|
|
|
|
* EESCHEMA_SETTINGS JSON format.
|
|
|
|
*/
|
|
|
|
class BOM_CFG_PARSER : public DIALOG_BOM_CFG_LEXER
|
|
|
|
{
|
|
|
|
std::vector<EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS>* m_pluginList;
|
|
|
|
|
|
|
|
public:
|
|
|
|
BOM_CFG_PARSER( std::vector<EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS>* aPluginList,
|
|
|
|
const char* aData, const wxString& aSource );
|
|
|
|
|
|
|
|
void Parse();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void parseGenerator();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS> EESCHEMA_SETTINGS::DefaultBomPlugins()
|
|
|
|
{
|
|
|
|
return bomSettingsFromJson( defaultBomPlugins );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool EESCHEMA_SETTINGS::migrateBomSettings()
|
|
|
|
{
|
2021-06-04 03:52:50 +00:00
|
|
|
if( !Contains( "bom.plugins" ) )
|
2021-02-25 03:37:30 +00:00
|
|
|
return false;
|
|
|
|
|
2022-08-30 20:58:43 +00:00
|
|
|
wxString list = *Get<wxString>( "bom.plugins" );
|
2021-02-25 03:37:30 +00:00
|
|
|
|
|
|
|
BOM_CFG_PARSER cfg_parser( &m_BomPanel.plugins, TO_UTF8( list ), wxT( "plugins" ) );
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
cfg_parser.Parse();
|
|
|
|
}
|
|
|
|
catch( const IO_ERROR& )
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Parser will have loaded up our array, let's dump it out to JSON
|
2021-06-04 03:52:50 +00:00
|
|
|
At( "bom.plugins" ) = bomSettingsToJson();
|
2021-02-25 03:37:30 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nlohmann::json EESCHEMA_SETTINGS::bomSettingsToJson() const
|
|
|
|
{
|
|
|
|
nlohmann::json js = nlohmann::json::array();
|
|
|
|
|
|
|
|
for( const BOM_PLUGIN_SETTINGS& plugin : m_BomPanel.plugins )
|
|
|
|
{
|
|
|
|
nlohmann::json pluginJson;
|
|
|
|
|
|
|
|
pluginJson["name"] = plugin.name.ToUTF8();
|
|
|
|
pluginJson["path"] = plugin.path.ToUTF8();
|
|
|
|
pluginJson["command"] = plugin.command.ToUTF8();
|
|
|
|
|
|
|
|
js.push_back( pluginJson );
|
|
|
|
}
|
|
|
|
|
|
|
|
return js;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS> EESCHEMA_SETTINGS::bomSettingsFromJson(
|
|
|
|
const nlohmann::json& aObj )
|
|
|
|
{
|
|
|
|
std::vector<EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS> ret;
|
|
|
|
|
|
|
|
wxASSERT( aObj.is_array() );
|
|
|
|
|
|
|
|
for( const nlohmann::json& entry : aObj )
|
|
|
|
{
|
|
|
|
if( entry.empty() || !entry.is_object() )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if( !entry.contains( "name" ) || !entry.contains( "path" ) )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
BOM_PLUGIN_SETTINGS plugin( entry.at( "name" ).get<wxString>(),
|
|
|
|
entry.at( "path" ).get<wxString>() );
|
|
|
|
|
|
|
|
if( entry.contains( "command" ) )
|
|
|
|
plugin.command = entry.at( "command" ).get<wxString>();
|
|
|
|
|
|
|
|
ret.emplace_back( plugin );
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-09-05 14:13:52 +00:00
|
|
|
nlohmann::json EESCHEMA_SETTINGS::netlistSettingsToJson() const
|
|
|
|
{
|
|
|
|
nlohmann::json js = nlohmann::json::array();
|
|
|
|
|
|
|
|
for( const NETLIST_PLUGIN_SETTINGS& plugin : m_NetlistPanel.plugins )
|
|
|
|
{
|
|
|
|
nlohmann::json pluginJson;
|
|
|
|
|
|
|
|
pluginJson["name"] = plugin.name.ToUTF8();
|
|
|
|
pluginJson["path"] = plugin.path.ToUTF8();
|
|
|
|
pluginJson["command"] = plugin.command.ToUTF8();
|
|
|
|
|
|
|
|
js.push_back( pluginJson );
|
|
|
|
}
|
|
|
|
|
|
|
|
return js;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::vector<EESCHEMA_SETTINGS::NETLIST_PLUGIN_SETTINGS> EESCHEMA_SETTINGS::netlistSettingsFromJson(
|
|
|
|
const nlohmann::json& aObj )
|
|
|
|
{
|
|
|
|
std::vector<EESCHEMA_SETTINGS::NETLIST_PLUGIN_SETTINGS> ret;
|
|
|
|
|
|
|
|
wxASSERT( aObj.is_array() );
|
|
|
|
|
|
|
|
for( const nlohmann::json& entry : aObj )
|
|
|
|
{
|
|
|
|
if( entry.empty() || !entry.is_object() )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if( !entry.contains( "name" ) || !entry.contains( "path" ) )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
NETLIST_PLUGIN_SETTINGS plugin( entry.at( "name" ).get<wxString>(),
|
|
|
|
entry.at( "path" ).get<wxString>() );
|
|
|
|
|
|
|
|
if( entry.contains( "command" ) )
|
|
|
|
plugin.command = entry.at( "command" ).get<wxString>();
|
|
|
|
|
|
|
|
ret.emplace_back( plugin );
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-02-25 03:37:30 +00:00
|
|
|
BOM_CFG_PARSER::BOM_CFG_PARSER( std::vector<EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS>* aPluginList,
|
|
|
|
const char* aLine, const wxString& aSource ) :
|
|
|
|
DIALOG_BOM_CFG_LEXER( aLine, aSource )
|
|
|
|
{
|
|
|
|
wxASSERT( aPluginList );
|
|
|
|
m_pluginList = aPluginList;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void BOM_CFG_PARSER::Parse()
|
|
|
|
{
|
|
|
|
T token;
|
|
|
|
|
|
|
|
while( ( token = NextTok() ) != T_RIGHT )
|
|
|
|
{
|
|
|
|
if( token == T_EOF)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if( token == T_LEFT )
|
|
|
|
token = NextTok();
|
|
|
|
|
|
|
|
if( token == T_plugins )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
switch( token )
|
|
|
|
{
|
|
|
|
case T_plugin: // Defines a new plugin
|
|
|
|
parseGenerator();
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
// Unexpected( CurText() );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void BOM_CFG_PARSER::parseGenerator()
|
|
|
|
{
|
|
|
|
wxString str;
|
|
|
|
EESCHEMA_SETTINGS::BOM_PLUGIN_SETTINGS settings;
|
|
|
|
|
|
|
|
NeedSYMBOLorNUMBER();
|
|
|
|
settings.path = FromUTF8();
|
|
|
|
|
|
|
|
T token;
|
|
|
|
|
|
|
|
while( ( token = NextTok() ) != T_RIGHT )
|
|
|
|
{
|
|
|
|
if( token == T_EOF)
|
|
|
|
break;
|
|
|
|
|
|
|
|
switch( token )
|
|
|
|
{
|
|
|
|
case T_LEFT:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case T_cmd:
|
|
|
|
NeedSYMBOLorNUMBER();
|
|
|
|
|
|
|
|
settings.command = FromUTF8();
|
|
|
|
|
|
|
|
NeedRIGHT();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case T_opts:
|
|
|
|
{
|
|
|
|
NeedSYMBOLorNUMBER();
|
|
|
|
|
|
|
|
wxString option = FromUTF8();
|
|
|
|
|
2023-01-17 04:14:38 +00:00
|
|
|
if( option.StartsWith( wxS( "nickname=" ), &str ) )
|
2021-02-25 03:37:30 +00:00
|
|
|
settings.name = str;
|
|
|
|
|
|
|
|
NeedRIGHT();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
Unexpected( CurText() );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_pluginList->emplace_back( settings );
|
|
|
|
}
|