Flatten one level of showElectricalTypes settings.

This commit is contained in:
Jeff Young 2020-05-23 00:11:04 +01:00
parent 17fad3a9a4
commit 70fb5cac96
11 changed files with 21 additions and 37 deletions

View File

@ -59,7 +59,7 @@ bool PANEL_LIBEDIT_SETTINGS::TransferDataToWindow()
m_choicePinDisplacement->SetSelection( settings->m_Repeat.pin_step == 50 ? 1 : 0 );
m_spinRepeatLabel->SetValue( settings->m_Repeat.label_delta );
m_checkShowPinElectricalType->SetValue( m_frame->GetShowElectricalType() );
m_cbShowPinElectricalType->SetValue( m_frame->GetRenderSettings()->m_ShowPinsElectricalType );
return true;
}
@ -79,9 +79,7 @@ bool PANEL_LIBEDIT_SETTINGS::TransferDataFromWindow()
settings->m_Repeat.label_delta = m_spinRepeatLabel->GetValue();
settings->m_Repeat.pin_step = m_choicePinDisplacement->GetSelection() == 1 ? 50 : 100;
m_frame->SetShowElectricalType( m_checkShowPinElectricalType->GetValue() );
m_frame->GetRenderSettings()->m_ShowPinsElectricalType = m_frame->GetShowElectricalType();
m_frame->GetRenderSettings()->m_ShowPinsElectricalType = m_cbShowPinElectricalType->GetValue();
m_frame->GetCanvas()->Refresh();
return true;

View File

@ -93,8 +93,8 @@ PANEL_LIBEDIT_SETTINGS_BASE::PANEL_LIBEDIT_SETTINGS_BASE( wxWindow* parent, wxWi
defaults->Add( fgSizer, 0, wxBOTTOM|wxEXPAND, 5 );
m_checkShowPinElectricalType = new wxCheckBox( defaults->GetStaticBox(), wxID_ANY, _("Show pin &electrical type"), wxDefaultPosition, wxDefaultSize, 0 );
defaults->Add( m_checkShowPinElectricalType, 0, wxBOTTOM, 5 );
m_cbShowPinElectricalType = new wxCheckBox( defaults->GetStaticBox(), wxID_ANY, _( "Show pin &electrical type"), wxDefaultPosition, wxDefaultSize, 0 );
defaults->Add( m_cbShowPinElectricalType, 0, wxBOTTOM, 5 );
leftColumn->Add( defaults, 0, wxEXPAND|wxALL, 5 );

View File

@ -1094,7 +1094,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_checkShowPinElectricalType</property>
<property name="name">m_cbShowPinElectricalType</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>

View File

@ -50,7 +50,7 @@ class PANEL_LIBEDIT_SETTINGS_BASE : public wxPanel
wxStaticText* m_pinNameSizeLabel;
wxTextCtrl* m_pinNameSizeCtrl;
wxStaticText* m_pinNameSizeUnits;
wxCheckBox* m_checkShowPinElectricalType;
wxCheckBox* m_cbShowPinElectricalType;
wxStaticText* m_hPitchLabel;
wxTextCtrl* m_hPitchCtrl;
wxStaticText* m_hPitchUnits;

View File

@ -29,7 +29,6 @@
#include <confirm.h>
#include <dialog_helpers.h>
#include <dialog_choose_component.h>
#include <eda_doc.h>
#include <eeschema_id.h>
#include <eeschema_settings.h>
#include <fctsys.h>
@ -37,7 +36,6 @@
#include <kiway.h>
#include <lib_view_frame.h>
#include <msgpanel.h>
#include <sch_draw_panel.h>
#include <sch_view.h>
#include <sch_painter.h>
#include <symbol_lib_table.h>
@ -134,15 +132,12 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
GetScreen()->m_Center = true; // Axis origin centered on screen.
LoadSettings( config() );
// Synchronize some draw options
SetShowElectricalType( true );
// Ensure axis are always drawn (initial default display was not drawn)
KIGFX::GAL_DISPLAY_OPTIONS& gal_opts = GetGalDisplayOptions();
gal_opts.m_axesEnabled = true;
GetCanvas()->GetGAL()->SetAxesEnabled( true );
GetCanvas()->GetGAL()->SetGridVisibility( IsGridVisible() );
GetRenderSettings()->m_ShowPinsElectricalType = GetShowElectricalType();
GetRenderSettings()->m_ShowHiddenText = true;
GetRenderSettings()->m_ShowHiddenPins = true;
GetRenderSettings()->SetDefaultPenWidth( DEFAULT_LINE_THICKNESS * IU_PER_MILS );
@ -629,7 +624,8 @@ void LIB_VIEW_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
m_libListWidth = cfg->m_LibViewPanel.lib_list_width;
m_cmpListWidth = cfg->m_LibViewPanel.cmp_list_width;
m_showPinElectricalTypeName = cfg->m_LibViewPanel.show_pin_electrical_type;
GetRenderSettings()->m_ShowPinsElectricalType = cfg->m_LibViewPanel.show_pin_electrical_type;
// Set parameters to a reasonable value.
if( m_libListWidth > m_FrameSize.x/2 )
@ -642,7 +638,7 @@ void LIB_VIEW_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
void LIB_VIEW_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg)
{
auto cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
EDA_DRAW_FRAME::SaveSettings( cfg );
@ -653,7 +649,7 @@ void LIB_VIEW_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg)
cfg->m_LibViewPanel.lib_list_width = m_libListWidth;
cfg->m_LibViewPanel.cmp_list_width = m_cmpListWidth;
cfg->m_LibViewPanel.show_pin_electrical_type = m_showPinElectricalTypeName;
cfg->m_LibViewPanel.show_pin_electrical_type = GetRenderSettings()->m_ShowPinsElectricalType;
}

View File

@ -101,7 +101,6 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_DrawSpecificConvert = true;
m_DrawSpecificUnit = false;
m_SyncPinEdit = false;
SetShowElectricalType( true );
m_my_part = nullptr;
m_treePane = nullptr;
@ -228,9 +227,8 @@ void LIB_EDIT_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
SetDefaultLineWidth( Mils2iu( m_settings->m_Defaults.line_width ) );
SetDefaultTextSize( Mils2iu( m_settings->m_Defaults.text_size ) );
m_showPinElectricalTypeName = m_settings->m_ShowPinElectricalType;
GetRenderSettings()->m_ShowPinsElectricalType = GetShowElectricalType();
GetRenderSettings()->m_ShowPinsElectricalType = m_settings->m_ShowPinElectricalType;
// Hidden elements must be editable
GetRenderSettings()->m_ShowHiddenText = true;
@ -247,7 +245,7 @@ void LIB_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
m_settings->m_Defaults.line_width = Iu2Mils( GetDefaultLineWidth() );
m_settings->m_Defaults.text_size = Iu2Mils( GetDefaultTextSize() );
m_settings->m_ShowPinElectricalType = GetShowElectricalType();
m_settings->m_ShowPinElectricalType = GetRenderSettings()->m_ShowPinsElectricalType;
m_settings->m_LibWidth = m_treePane->GetSize().x;
}

View File

@ -27,6 +27,7 @@
#include <eeschema_id.h>
#include <general.h>
#include <lib_edit_frame.h>
#include <sch_painter.h>
#include <dialog_helpers.h>
#include <bitmaps.h>
#include <lib_manager.h>
@ -151,6 +152,7 @@ void LIB_EDIT_FRAME::ReCreateOptToolbar()
void LIB_EDIT_FRAME::SyncToolbars()
{
KIGFX::SCH_RENDER_SETTINGS* settings = GetRenderSettings();
KIGFX::GAL_DISPLAY_OPTIONS& galOpts = GetGalDisplayOptions();
bool isEditable = m_my_part && m_my_part->IsRoot();
@ -176,7 +178,7 @@ void LIB_EDIT_FRAME::SyncToolbars()
m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != EDA_UNITS::INCHES );
m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == EDA_UNITS::INCHES );
m_optionsToolBar->Toggle( ACTIONS::toggleCursorStyle, galOpts.m_fullscreenCursor );
m_optionsToolBar->Toggle( EE_ACTIONS::showElectricalTypes, GetShowElectricalType() );
m_optionsToolBar->Toggle( EE_ACTIONS::showElectricalTypes, settings->m_ShowPinsElectricalType );
m_optionsToolBar->Toggle( EE_ACTIONS::showComponentTree, IsSearchTreeShown() );
m_optionsToolBar->Refresh();

View File

@ -84,7 +84,6 @@ SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aWindo
const wxString& aTitle, const wxPoint& aPosition,
const wxSize& aSize, long aStyle, const wxString& aFrameName ) :
EDA_DRAW_FRAME( aKiway, aParent, aWindowType, aTitle, aPosition, aSize, aStyle, aFrameName ),
m_showPinElectricalTypeName( false ),
m_defaults( &m_base_frame_defaults )
{
createCanvas();

View File

@ -92,8 +92,6 @@ class SCH_BASE_FRAME : public EDA_DRAW_FRAME
protected:
TEMPLATES m_templateFieldNames;
bool m_showPinElectricalTypeName;
/// These are only used by libedit. Eeschema should be using the one inside the SCHEMATIC.
SCHEMATIC_SETTINGS m_base_frame_defaults;
@ -133,12 +131,6 @@ public:
*/
virtual bool GetShowAllPins() const { return true; }
/**
* Allow some frames to show/hide pin electrical type names.
*/
bool GetShowElectricalType() { return m_showPinElectricalTypeName; }
void SetShowElectricalType( bool aShow ) { m_showPinElectricalTypeName = aShow; }
virtual int GetDefaultLineWidth() const { return m_defaults->m_DefaultLineWidth; }
virtual void SetDefaultLineWidth( int aWidth );

View File

@ -24,8 +24,8 @@
#include <macros.h>
#include "class_library.h"
#include "eeschema_id.h"
#include "general.h"
#include "lib_view_frame.h"
#include "sch_painter.h"
#include <symbol_lib_table.h>
#include <tool/action_toolbar.h>
#include <tool/conditional_menu.h>
@ -116,7 +116,7 @@ void LIB_VIEW_FRAME::ReCreateMenuBar()
return IsGridVisible();
};
auto electricalTypesShownCondition = [ this ] ( const SELECTION& aSel ) {
return GetShowElectricalType();
return GetRenderSettings()->m_ShowPinsElectricalType;
};
viewMenu->AddItem( ACTIONS::zoomInCenter, EE_CONDITIONS::ShowAlways );

View File

@ -33,7 +33,6 @@
#include <symbol_tree_model_adapter.h>
#include <wildcards_and_files_ext.h>
#include <gestfich.h>
#include <project.h>
#include <confirm.h>
@ -283,10 +282,10 @@ int LIB_CONTROL::ShowComponentTree( const TOOL_EVENT& aEvent )
int LIB_CONTROL::ShowElectricalTypes( const TOOL_EVENT& aEvent )
{
m_frame->SetShowElectricalType( !m_frame->GetShowElectricalType() );
KIGFX::SCH_RENDER_SETTINGS* renderSettings = m_frame->GetRenderSettings();
renderSettings->m_ShowPinsElectricalType = !renderSettings->m_ShowPinsElectricalType;
// Update canvas
m_frame->GetRenderSettings()->m_ShowPinsElectricalType = m_frame->GetShowElectricalType();
m_frame->GetCanvas()->GetView()->UpdateAllItems( KIGFX::REPAINT );
m_frame->GetCanvas()->Refresh();