2018-05-14 17:34:18 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2020-02-13 14:19:40 +00:00
|
|
|
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@gmail.com>
|
2023-09-04 11:46:52 +00:00
|
|
|
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2018-05-14 17:34:18 +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-08-29 23:33:08 +00:00
|
|
|
#include <pgm_base.h>
|
|
|
|
#include <settings/settings_manager.h>
|
|
|
|
#include <eeschema_settings.h>
|
2018-05-14 17:34:18 +00:00
|
|
|
#include <panel_eeschema_display_options.h>
|
2018-09-04 00:00:17 +00:00
|
|
|
#include <widgets/gal_options_panel.h>
|
2021-08-29 23:33:08 +00:00
|
|
|
#include <widgets/ui_common.h>
|
2022-01-07 00:47:23 +00:00
|
|
|
#include <widgets/font_choice.h>
|
|
|
|
|
2022-01-13 13:31:00 +00:00
|
|
|
// The "official" name of the building Kicad stroke font (always existing)
|
|
|
|
#include <font/kicad_font_name.h>
|
|
|
|
|
2018-05-14 17:34:18 +00:00
|
|
|
|
2021-08-29 23:33:08 +00:00
|
|
|
PANEL_EESCHEMA_DISPLAY_OPTIONS::PANEL_EESCHEMA_DISPLAY_OPTIONS( wxWindow* aParent,
|
|
|
|
APP_SETTINGS_BASE* aAppSettings ) :
|
|
|
|
PANEL_EESCHEMA_DISPLAY_OPTIONS_BASE( aParent )
|
2018-05-14 17:34:18 +00:00
|
|
|
{
|
2021-08-29 23:33:08 +00:00
|
|
|
m_galOptsPanel = new GAL_OPTIONS_PANEL( this, aAppSettings );
|
2018-05-14 17:34:18 +00:00
|
|
|
|
2023-09-04 11:46:52 +00:00
|
|
|
m_galOptionsSizer->Add( m_galOptsPanel, 1, wxEXPAND|wxRIGHT, 15 );
|
2019-12-11 20:49:58 +00:00
|
|
|
|
2021-09-16 17:29:29 +00:00
|
|
|
m_highlightColorNote->SetFont( KIUI::GetInfoFont( this ).Italic() );
|
2018-09-04 00:00:17 +00:00
|
|
|
}
|
2018-05-14 17:34:18 +00:00
|
|
|
|
|
|
|
|
2021-11-01 11:20:13 +00:00
|
|
|
void PANEL_EESCHEMA_DISPLAY_OPTIONS::loadEEschemaSettings( EESCHEMA_SETTINGS* cfg )
|
2018-09-04 00:00:17 +00:00
|
|
|
{
|
2022-01-07 00:47:23 +00:00
|
|
|
m_defaultFontCtrl->SetStringSelection( cfg->m_Appearance.default_font );
|
|
|
|
|
|
|
|
if( m_defaultFontCtrl->GetSelection() < 0 )
|
|
|
|
m_defaultFontCtrl->SetSelection( 0 );
|
|
|
|
|
2020-04-12 23:09:17 +00:00
|
|
|
m_checkShowHiddenPins->SetValue( cfg->m_Appearance.show_hidden_pins );
|
2020-04-18 15:36:29 +00:00
|
|
|
m_checkShowHiddenFields->SetValue( cfg->m_Appearance.show_hidden_fields );
|
2021-11-05 21:16:26 +00:00
|
|
|
m_checkShowERCErrors->SetValue( cfg->m_Appearance.show_erc_errors );
|
|
|
|
m_checkShowERCWarnings->SetValue( cfg->m_Appearance.show_erc_warnings );
|
|
|
|
m_checkShowERCExclusions->SetValue( cfg->m_Appearance.show_erc_exclusions );
|
2024-06-03 12:59:40 +00:00
|
|
|
m_cbMarkSimExclusions->SetValue( cfg->m_Appearance.mark_sim_exclusions );
|
2023-02-09 17:18:56 +00:00
|
|
|
m_checkShowOPVoltages->SetValue( cfg->m_Appearance.show_op_voltages );
|
|
|
|
m_checkShowOPCurrents->SetValue( cfg->m_Appearance.show_op_currents );
|
2020-04-12 23:09:17 +00:00
|
|
|
m_checkPageLimits->SetValue( cfg->m_Appearance.show_page_limits );
|
2018-09-04 00:00:17 +00:00
|
|
|
|
2020-04-12 23:09:17 +00:00
|
|
|
m_checkSelDrawChildItems->SetValue( cfg->m_Selection.draw_selected_children );
|
|
|
|
m_checkSelFillShapes->SetValue( cfg->m_Selection.fill_shapes );
|
2021-09-15 20:03:07 +00:00
|
|
|
m_selWidthCtrl->SetValue( cfg->m_Selection.selection_thickness );
|
|
|
|
m_highlightWidthCtrl->SetValue( cfg->m_Selection.highlight_thickness );
|
2019-11-21 15:48:44 +00:00
|
|
|
|
2022-01-16 20:29:03 +00:00
|
|
|
m_checkCrossProbeOnSelection->SetValue( cfg->m_CrossProbing.on_selection );
|
2020-06-28 02:48:48 +00:00
|
|
|
m_checkCrossProbeCenter->SetValue( cfg->m_CrossProbing.center_on_items );
|
|
|
|
m_checkCrossProbeZoom->SetValue( cfg->m_CrossProbing.zoom_to_fit );
|
|
|
|
m_checkCrossProbeAutoHighlight->SetValue( cfg->m_CrossProbing.auto_highlight );
|
2021-11-01 11:20:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataToWindow()
|
|
|
|
{
|
|
|
|
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
|
|
|
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>();
|
|
|
|
|
|
|
|
loadEEschemaSettings( cfg );
|
2020-06-28 02:48:48 +00:00
|
|
|
|
2018-09-04 00:00:17 +00:00
|
|
|
m_galOptsPanel->TransferDataToWindow();
|
2018-05-14 17:34:18 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow()
|
|
|
|
{
|
2021-08-29 23:33:08 +00:00
|
|
|
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
|
|
|
|
EESCHEMA_SETTINGS* cfg = mgr.GetAppSettings<EESCHEMA_SETTINGS>();
|
2018-05-14 17:34:18 +00:00
|
|
|
|
2022-01-13 13:31:00 +00:00
|
|
|
cfg->m_Appearance.default_font = m_defaultFontCtrl->GetSelection() <= 0
|
2023-02-12 21:29:26 +00:00
|
|
|
? wxString( KICAD_FONT_NAME ) // This is a keyword. Do not translate
|
2022-01-13 13:31:00 +00:00
|
|
|
: m_defaultFontCtrl->GetStringSelection();
|
2020-04-12 23:09:17 +00:00
|
|
|
cfg->m_Appearance.show_hidden_pins = m_checkShowHiddenPins->GetValue();
|
2020-04-18 15:36:29 +00:00
|
|
|
cfg->m_Appearance.show_hidden_fields = m_checkShowHiddenFields->GetValue();
|
2021-11-05 21:16:26 +00:00
|
|
|
cfg->m_Appearance.show_erc_warnings = m_checkShowERCWarnings->GetValue();
|
|
|
|
cfg->m_Appearance.show_erc_errors = m_checkShowERCErrors->GetValue();
|
|
|
|
cfg->m_Appearance.show_erc_exclusions = m_checkShowERCExclusions->GetValue();
|
2024-06-03 12:59:40 +00:00
|
|
|
cfg->m_Appearance.mark_sim_exclusions = m_cbMarkSimExclusions->GetValue();
|
2023-02-09 17:18:56 +00:00
|
|
|
cfg->m_Appearance.show_op_voltages = m_checkShowOPVoltages->GetValue();
|
|
|
|
cfg->m_Appearance.show_op_currents = m_checkShowOPCurrents->GetValue();
|
2020-04-12 23:09:17 +00:00
|
|
|
cfg->m_Appearance.show_page_limits = m_checkPageLimits->GetValue();
|
2020-04-12 23:28:33 +00:00
|
|
|
|
2020-04-12 23:09:17 +00:00
|
|
|
cfg->m_Selection.draw_selected_children = m_checkSelDrawChildItems->GetValue();
|
|
|
|
cfg->m_Selection.fill_shapes = m_checkSelFillShapes->GetValue();
|
2021-09-15 20:03:07 +00:00
|
|
|
cfg->m_Selection.selection_thickness = KiROUND( m_selWidthCtrl->GetValue() );
|
|
|
|
cfg->m_Selection.highlight_thickness = KiROUND( m_highlightWidthCtrl->GetValue() );
|
2019-10-21 18:03:54 +00:00
|
|
|
|
2022-01-16 20:29:03 +00:00
|
|
|
cfg->m_CrossProbing.on_selection = m_checkCrossProbeOnSelection->GetValue();
|
2020-06-28 02:48:48 +00:00
|
|
|
cfg->m_CrossProbing.center_on_items = m_checkCrossProbeCenter->GetValue();
|
2022-01-16 20:29:03 +00:00
|
|
|
cfg->m_CrossProbing.zoom_to_fit = m_checkCrossProbeZoom->GetValue();
|
|
|
|
cfg->m_CrossProbing.auto_highlight = m_checkCrossProbeAutoHighlight->GetValue();
|
2020-06-28 02:48:48 +00:00
|
|
|
|
2018-09-04 00:00:17 +00:00
|
|
|
m_galOptsPanel->TransferDataFromWindow();
|
|
|
|
|
2018-05-14 17:34:18 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-11-01 11:20:13 +00:00
|
|
|
void PANEL_EESCHEMA_DISPLAY_OPTIONS::ResetPanel()
|
|
|
|
{
|
|
|
|
EESCHEMA_SETTINGS cfg;
|
|
|
|
cfg.Load(); // Loading without a file will init to defaults
|
|
|
|
|
|
|
|
loadEEschemaSettings( &cfg );
|
|
|
|
|
|
|
|
m_galOptsPanel->ResetPanel( &cfg );
|
|
|
|
}
|
|
|
|
|
|
|
|
|