Unwrap an unnecessary layer now that we have new config stuff.

This commit is contained in:
Jeff Young 2020-04-13 00:09:17 +01:00
parent 35b647d134
commit 122b1ddaae
34 changed files with 292 additions and 531 deletions

View File

@ -448,12 +448,10 @@ WINDOW_SETTINGS* EDA_BASE_FRAME::GetWindowSettings( APP_SETTINGS_BASE* aCfg )
}
APP_SETTINGS_BASE* EDA_BASE_FRAME::config()
APP_SETTINGS_BASE* EDA_BASE_FRAME::config() const
{
// KICAD_MANAGER_FRAME overrides this
APP_SETTINGS_BASE* ret = Kiface().KifaceSettings();
//wxASSERT( ret );
return ret;
return Kiface().KifaceSettings();
}

View File

@ -36,7 +36,8 @@
#include <widgets/grid_icon_text_helpers.h>
#include <widgets/wx_grid.h>
#include <wx/bmpcbox.h>
#include <pgm_base.h>
#include <settings/settings_manager.h>
static std::vector<BITMAP_DEF> g_typeIcons;
static wxArrayString g_typeNames;
@ -569,10 +570,12 @@ void DIALOG_LIB_EDIT_PIN_TABLE::OnAddRow( wxCommandEvent& event )
wxPoint pos = last->GetPosition();
LIBEDIT_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
if( last->GetOrientation() == PIN_LEFT || last->GetOrientation() == PIN_RIGHT )
pos.y -= m_editFrame->GetRepeatPinStep();
pos.y -= cfg->m_Repeat.pin_step;
else
pos.x += m_editFrame->GetRepeatPinStep();
pos.x += cfg->m_Repeat.pin_step;
newPin->SetPosition( pos );
}

View File

@ -49,18 +49,20 @@ PANEL_EESCHEMA_DISPLAY_OPTIONS::PANEL_EESCHEMA_DISPLAY_OPTIONS( SCH_EDIT_FRAME*
bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataToWindow()
{
m_checkShowHiddenPins->SetValue( m_frame->GetShowAllPins() );
EESCHEMA_SETTINGS* cfg = m_frame->eeconfig();
m_checkShowHiddenPins->SetValue( cfg->m_Appearance.show_hidden_pins );
int superSubFlags = ENABLE_SUBSCRIPT_MARKUP | ENABLE_SUPERSCRIPT_MARKUP;
m_checkSuperSub->SetValue( GetTextMarkupFlags() & superSubFlags );
m_checkPageLimits->SetValue( m_frame->ShowPageLimits() );
m_checkPageLimits->SetValue( cfg->m_Appearance.show_page_limits );
m_checkSelTextBox->SetValue( GetSelectionTextAsBox() );
m_checkSelDrawChildItems->SetValue( GetSelectionDrawChildItems() );
m_checkSelFillShapes->SetValue( GetSelectionFillShapes() );
m_selWidthCtrl->SetValue( Iu2Mils( GetSelectionThickness() ) );
m_checkSelTextBox->SetValue( cfg->m_Selection.text_as_box );
m_checkSelDrawChildItems->SetValue( cfg->m_Selection.draw_selected_children );
m_checkSelFillShapes->SetValue( cfg->m_Selection.fill_shapes );
m_selWidthCtrl->SetValue( cfg->m_Selection.thickness );
m_galOptsPanel->TransferDataToWindow();
@ -70,15 +72,14 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataToWindow()
bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow()
{
m_frame->SetShowAllPins( m_checkShowHiddenPins->GetValue() );
m_frame->SetShowPageLimits( m_checkPageLimits->GetValue() );
SetSelectionTextAsBox( m_checkSelTextBox->GetValue() );
SetSelectionDrawChildItems( m_checkSelDrawChildItems->GetValue() );
SetSelectionFillShapes( m_checkSelFillShapes->GetValue() );
SetSelectionThickness( Mils2iu( m_selWidthCtrl->GetValue() ) );
EESCHEMA_SETTINGS* cfg = m_frame->eeconfig();
// Update canvas
m_frame->GetRenderSettings()->m_ShowHiddenPins = m_checkShowHiddenPins->GetValue();
cfg->m_Appearance.show_hidden_pins = m_checkShowHiddenPins->GetValue();
cfg->m_Appearance.show_page_limits = m_checkPageLimits->GetValue();
cfg->m_Selection.text_as_box = m_checkSelTextBox->GetValue();
cfg->m_Selection.draw_selected_children = m_checkSelDrawChildItems->GetValue();
cfg->m_Selection.fill_shapes = m_checkSelFillShapes->GetValue();
cfg->m_Selection.thickness = KiROUND( m_selWidthCtrl->GetValue() );
int superSubFlags = ENABLE_SUBSCRIPT_MARKUP | ENABLE_SUPERSCRIPT_MARKUP;
@ -87,7 +88,9 @@ bool PANEL_EESCHEMA_DISPLAY_OPTIONS::TransferDataFromWindow()
else
SetTextMarkupFlags( GetTextMarkupFlags() & ~superSubFlags );
m_frame->GetRenderSettings()->SetShowPageLimits( m_checkPageLimits->GetValue() );
// Update canvas
m_frame->GetRenderSettings()->m_ShowHiddenPins = m_checkShowHiddenPins->GetValue();
m_frame->GetRenderSettings()->SetShowPageLimits( cfg->m_Appearance.show_page_limits );
m_frame->GetCanvas()->GetView()->MarkDirty();
m_frame->GetCanvas()->GetView()->UpdateAllItems( KIGFX::REPAINT );
m_frame->GetCanvas()->Refresh();

View File

@ -28,6 +28,7 @@
#include <settings/color_settings.h>
#include <painter.h>
#include <pgm_base.h>
#include <eeschema_settings.h>
#include "panel_eeschema_settings.h"
@ -42,33 +43,34 @@ PANEL_EESCHEMA_SETTINGS::PANEL_EESCHEMA_SETTINGS( SCH_EDIT_FRAME* aFrame, wxWind
bool PANEL_EESCHEMA_SETTINGS::TransferDataToWindow()
{
EESCHEMA_SETTINGS* cfg = m_frame->eeconfig();
m_choiceUnits->SetSelection( m_frame->GetUserUnits() == EDA_UNITS::INCHES ? 0 : 1 );
m_defaultTextSize.SetValue( m_frame->GetDefaultTextSize() );
m_hPitch.SetValue( m_frame->GetRepeatStep().x );
m_vPitch.SetValue( m_frame->GetRepeatStep().y );
m_spinLabelRepeatStep->SetValue( m_frame->GetRepeatDeltaLabel() );
m_hPitch.SetValue( Mils2iu( cfg->m_Drawing.default_repeat_offset_x ) );
m_vPitch.SetValue( Mils2iu( cfg->m_Drawing.default_repeat_offset_y ) );
m_spinLabelRepeatStep->SetValue( cfg->m_Drawing.repeat_label_increment );
COLOR_SETTINGS* settings = m_frame->GetColorSettings();
COLOR4D schematicBackground = settings->GetColor( LAYER_SCHEMATIC_BACKGROUND );
m_borderColorSwatch->SetSwatchBackground( schematicBackground );
m_borderColorSwatch->SetSwatchColor( m_frame->GetDefaultSheetBorderColor(), false );
m_borderColorSwatch->SetSwatchColor( cfg->m_Drawing.default_sheet_border_color, false );
m_backgroundColorSwatch->SetSwatchBackground( schematicBackground );
m_backgroundColorSwatch->SetSwatchColor( m_frame->GetDefaultSheetBackgroundColor(), false );
m_backgroundColorSwatch->SetSwatchColor( cfg->m_Drawing.default_sheet_background_color, false );
m_checkHVOrientation->SetValue( m_frame->GetForceHVLines() );
m_footprintPreview->SetValue( m_frame->GetShowFootprintPreviews() );
m_navigatorStaysOpen->SetValue( m_frame->GetNavigatorStaysOpen() );
m_checkHVOrientation->SetValue( cfg->m_Drawing.hv_lines_only );
m_footprintPreview->SetValue( cfg->m_Appearance.footprint_preview );
m_navigatorStaysOpen->SetValue( cfg->m_Appearance.navigator_stays_open );
m_checkAutoplaceFields->SetValue( m_frame->GetAutoplaceFields() );
m_checkAutoplaceJustify->SetValue( m_frame->GetAutoplaceJustify() );
m_checkAutoplaceAlign->SetValue( m_frame->GetAutoplaceAlign() );
m_checkAutoplaceFields->SetValue( cfg->m_AutoplaceFields.enable );
m_checkAutoplaceJustify->SetValue( cfg->m_AutoplaceFields.allow_rejustify );
m_checkAutoplaceAlign->SetValue( cfg->m_AutoplaceFields.align_to_grid );
m_mouseDragIsDrag->SetValue( !m_frame->GetDragActionIsMove() );
m_cbPinSelectionOpt->SetValue( m_frame->GetSelectPinSelectSymbol() );
m_mouseDragIsDrag->SetValue( !cfg->m_Input.drag_is_move );
m_cbPinSelectionOpt->SetValue( cfg->m_Selection.select_pin_selects_symbol );
return true;
}
@ -76,28 +78,30 @@ bool PANEL_EESCHEMA_SETTINGS::TransferDataToWindow()
bool PANEL_EESCHEMA_SETTINGS::TransferDataFromWindow()
{
EESCHEMA_SETTINGS* cfg = m_frame->eeconfig();
m_frame->SetUserUnits( m_choiceUnits->GetSelection() == 0 ? EDA_UNITS::INCHES
: EDA_UNITS::MILLIMETRES );
m_frame->SetDefaultTextSize( (int) m_defaultTextSize.GetValue() );
m_frame->SetDefaultSheetBorderColor( m_borderColorSwatch->GetSwatchColor() );
m_frame->SetDefaultSheetBackgroundColor( m_backgroundColorSwatch->GetSwatchColor() );
cfg->m_Drawing.default_sheet_border_color = m_borderColorSwatch->GetSwatchColor();
cfg->m_Drawing.default_sheet_background_color = m_backgroundColorSwatch->GetSwatchColor();
m_frame->SetRepeatStep( wxPoint( (int) m_hPitch.GetValue(), (int) m_vPitch.GetValue() ) );
m_frame->SetRepeatDeltaLabel( m_spinLabelRepeatStep->GetValue() );
cfg->m_Drawing.default_repeat_offset_x = Iu2Mils( (int) m_hPitch.GetValue() );
cfg->m_Drawing.default_repeat_offset_y = Iu2Mils( (int) m_vPitch.GetValue() );
cfg->m_Drawing.repeat_label_increment = m_spinLabelRepeatStep->GetValue();
m_frame->SetForceHVLines( m_checkHVOrientation->GetValue() );
m_frame->SetShowFootprintPreviews( m_footprintPreview->GetValue() );
m_frame->SetNavigatorStaysOpen( m_navigatorStaysOpen->GetValue() );
cfg->m_Drawing.hv_lines_only = m_checkHVOrientation->GetValue();
cfg->m_Appearance.footprint_preview = m_footprintPreview->GetValue();
cfg->m_Appearance.navigator_stays_open = m_navigatorStaysOpen->GetValue();
m_frame->SetAutoplaceFields( m_checkAutoplaceFields->GetValue() );
m_frame->SetAutoplaceJustify( m_checkAutoplaceJustify->GetValue() );
m_frame->SetAutoplaceAlign( m_checkAutoplaceAlign->GetValue() );
cfg->m_AutoplaceFields.enable = m_checkAutoplaceFields->GetValue();
cfg->m_AutoplaceFields.allow_rejustify = m_checkAutoplaceJustify->GetValue();
cfg->m_AutoplaceFields.align_to_grid = m_checkAutoplaceAlign->GetValue();
m_frame->SetDragActionIsMove( !m_mouseDragIsDrag->GetValue() );
m_frame->SetSelectPinSelectSymbol( m_cbPinSelectionOpt->GetValue() );
cfg->m_Input.drag_is_move = !m_mouseDragIsDrag->GetValue();
cfg->m_Selection.select_pin_selects_symbol = m_cbPinSelectionOpt->GetValue();
m_frame->SaveProjectSettings();

View File

@ -25,6 +25,9 @@
#include <fctsys.h>
#include <lib_edit_frame.h>
#include <sch_painter.h>
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <libedit/libedit_settings.h>
#include "panel_libedit_settings.h"
@ -44,15 +47,17 @@ PANEL_LIBEDIT_SETTINGS::PANEL_LIBEDIT_SETTINGS( LIB_EDIT_FRAME* aFrame, wxWindow
bool PANEL_LIBEDIT_SETTINGS::TransferDataToWindow()
{
LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
m_lineWidth.SetValue( m_frame->GetDefaultLineWidth() );
m_textSize.SetValue( m_frame->GetDefaultTextSize() );
m_pinLength.SetValue( m_frame->GetDefaultPinLength() );
m_pinNumberSize.SetValue( m_frame->GetPinNumDefaultSize() );
m_pinNameSize.SetValue( m_frame->GetPinNameDefaultSize() );
m_hPitch.SetValue( m_frame->GetRepeatStep().x );
m_vPitch.SetValue( m_frame->GetRepeatStep().y );
m_choicePinDisplacement->SetSelection( m_frame->GetRepeatPinStep() == Iu2Mils( 50 ) ? 1 : 0 );
m_spinRepeatLabel->SetValue( m_frame->GetRepeatDeltaLabel() );
m_pinLength.SetValue( Mils2iu( settings->m_Defaults.pin_length ) );
m_pinNumberSize.SetValue( Mils2iu( settings->m_Defaults.pin_num_size ) );
m_pinNameSize.SetValue( Mils2iu( settings->m_Defaults.pin_name_size ) );
m_hPitch.SetValue( Mils2iu( settings->m_Repeat.x_step ) );
m_vPitch.SetValue( Mils2iu( settings->m_Repeat.y_step ) );
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() );
@ -62,15 +67,17 @@ bool PANEL_LIBEDIT_SETTINGS::TransferDataToWindow()
bool PANEL_LIBEDIT_SETTINGS::TransferDataFromWindow()
{
LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
m_frame->SetDefaultLineWidth( (int) m_lineWidth.GetValue() );
m_frame->SetDefaultTextSize( (int) m_textSize.GetValue() );
m_frame->SetDefaultPinLength( (int) m_pinLength.GetValue() );
m_frame->SetPinNumDefaultSize( (int) m_pinNumberSize.GetValue() );
m_frame->SetPinNameDefaultSize( (int) m_pinNameSize.GetValue() );
m_frame->SetRepeatStep( wxPoint( (int) m_hPitch.GetValue(), (int) m_vPitch.GetValue() ) );
m_frame->SetRepeatPinStep( m_choicePinDisplacement->GetSelection() == 1 ? Mils2iu( 50 )
: Mils2iu( 100 ) );
m_frame->SetRepeatDeltaLabel( m_spinRepeatLabel->GetValue() );
settings->m_Defaults.pin_length = Iu2Mils( (int) m_pinLength.GetValue() );
settings->m_Defaults.pin_num_size = Iu2Mils( (int) m_pinNumberSize.GetValue() );
settings->m_Defaults.pin_name_size = Iu2Mils( (int) m_pinNameSize.GetValue() );
settings->m_Repeat.x_step = Iu2Mils( (int) m_hPitch.GetValue() );
settings->m_Repeat.y_step = Iu2Mils( (int) m_vPitch.GetValue() );
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() );

View File

@ -192,8 +192,6 @@ void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* aText, KICAD_T aNewType )
KICAD_T oldType = aText->Type();
bool selected = aText->IsSelected();
wxCHECK_RET( aText->CanIncrementLabel(), "Cannot convert text type." );
if( oldType == aNewType )
return;

View File

@ -55,10 +55,6 @@
static double s_textOffsetRatio = 0.08;
static bool s_selectTextAsBox = false;
static bool s_selectDrawChildren = true;
static bool s_selectFillShapes = false;
static int s_selectThickness = Mils2iu( DEFAULTSELECTIONTHICKNESS );
#define FieldNameTemplatesKey wxT( "FieldNameTemplates" )
@ -235,54 +231,6 @@ void SetTextOffsetRatio( double aOffsetRatio )
}
bool GetSelectionTextAsBox()
{
return s_selectTextAsBox;
}
void SetSelectionTextAsBox( bool aBool )
{
s_selectTextAsBox = aBool;
}
bool GetSelectionDrawChildItems()
{
return s_selectDrawChildren;
}
void SetSelectionDrawChildItems( bool aBool )
{
s_selectDrawChildren = aBool;
}
bool GetSelectionFillShapes()
{
return s_selectFillShapes;
}
void SetSelectionFillShapes( bool aBool )
{
s_selectFillShapes = aBool;
}
int GetSelectionThickness()
{
return s_selectThickness;
}
void SetSelectionThickness( int aThickness )
{
s_selectThickness = aThickness;
}
/// Helper for all the old plotting/printing code while it still exists
COLOR4D GetLayerColor( SCH_LAYER_ID aLayer )
{
@ -391,9 +339,9 @@ bool SCH_EDIT_FRAME::LoadProjectFile()
bool ret = Prj().ConfigLoad( Kiface().KifaceSearch(), GROUP_SCH_EDIT,
GetProjectFileParameters() );
GetRenderSettings()->m_DefaultLineWidth = m_defaultLineWidth;
GetRenderSettings()->m_DefaultWireThickness = m_defaultWireThickness;
GetRenderSettings()->m_DefaultBusThickness = m_defaultBusThickness;
GetRenderSettings()->m_DefaultLineWidth = GetDefaultLineWidth();
GetRenderSettings()->m_DefaultWireThickness = GetDefaultWireThickness();
GetRenderSettings()->m_DefaultBusThickness = GetDefaultBusThickness();
// Verify some values, because the config file can be edited by hand,
// and have bad values:
@ -449,36 +397,45 @@ void SCH_EDIT_FRAME::SaveProjectSettings()
void SCH_EDIT_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
{
EDA_DRAW_FRAME::LoadSettings( aCfg );
SCH_BASE_FRAME::LoadSettings( eeconfig() );
EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg );
wxASSERT( cfg );
if( cfg )
if( eeconfig() )
{
m_repeatStep.x = Mils2iu( cfg->m_Drawing.default_repeat_offset_x );
m_repeatStep.y = Mils2iu( cfg->m_Drawing.default_repeat_offset_y );
GetRenderSettings()->m_ShowPinsElectricalType = false;
GetRenderSettings()->m_ShowHiddenText = false;
GetRenderSettings()->m_ShowHiddenPins = eeconfig()->m_Appearance.show_hidden_pins;
GetRenderSettings()->SetShowPageLimits( eeconfig()->m_Appearance.show_page_limits );
GetRenderSettings()->m_ShowUmbilicals = true;
}
}
SetSelectionTextAsBox( cfg->m_Selection.text_as_box );
SetSelectionDrawChildItems( cfg->m_Selection.draw_selected_children );
SetSelectionFillShapes( cfg->m_Selection.fill_shapes );
SetSelectionThickness( Mils2iu( cfg->m_Selection.thickness ) );
m_footprintPreview = cfg->m_Appearance.footprint_preview;
m_navigatorStaysOpen = cfg->m_Appearance.navigator_stays_open;
m_showAllPins = cfg->m_Appearance.show_hidden_pins;
m_autoplaceFields = cfg->m_AutoplaceFields.enable;
m_autoplaceAlign = cfg->m_AutoplaceFields.align_to_grid;
m_autoplaceJustify = cfg->m_AutoplaceFields.allow_rejustify;
m_forceHVLines = cfg->m_Drawing.hv_lines_only;
m_dragActionIsMove = cfg->m_Input.drag_is_move;
m_selectPinSelectSymbol = cfg->m_Selection.select_pin_selects_symbol;
m_repeatDeltaLabel = cfg->m_Drawing.repeat_label_increment;
void SCH_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
{
SCH_BASE_FRAME::SaveSettings( eeconfig() );
SetDefaultSheetBorderColor( cfg->m_Drawing.default_sheet_border_color );
SetDefaultSheetBackgroundColor( cfg->m_Drawing.default_sheet_background_color );
// TODO(JE) do most of these need to live as class members here, or can the sites that need
// the setting just grab a pointer to the EESCHEMA_SETTINGS and look them up directly?
if( eeconfig() )
{
eeconfig()->m_Appearance.print_sheet_reference = m_printSheetReference;
wxString templateFieldNames = cfg->m_Drawing.field_names;
eeconfig()->m_Drawing.text_markup_flags = GetTextMarkupFlags();
eeconfig()->m_Printing.monochrome = m_printMonochrome;
eeconfig()->m_System.units = static_cast<int>( m_userUnits );
}
}
void SCH_BASE_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
{
EDA_DRAW_FRAME::LoadSettings( config() );
if( eeconfig() )
{
wxString templateFieldNames = eeconfig()->m_Drawing.field_names;
if( !templateFieldNames.IsEmpty() )
{
@ -495,64 +452,15 @@ void SCH_EDIT_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
}
}
}
KIGFX::SCH_RENDER_SETTINGS* settings = GetRenderSettings();
settings->m_ShowPinsElectricalType = false;
settings->m_ShowHiddenText = false;
settings->m_ShowHiddenPins = m_showAllPins;
settings->SetShowPageLimits( m_showPageLimits );
settings->m_ShowUmbilicals = true;
COLOR_SETTINGS* colorSettings = GetColorSettings();
SetDefaultSheetBorderColor( colorSettings->GetColor( LAYER_SHEET ) );
SetDefaultSheetBackgroundColor( colorSettings->GetColor( LAYER_SHEET_BACKGROUND ) );
}
void SCH_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
void SCH_BASE_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
{
EDA_DRAW_FRAME::SaveSettings( aCfg );
EDA_DRAW_FRAME::SaveSettings( config() );
EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( aCfg );
wxASSERT( cfg );
// TODO(JE) do most of these need to live as class members here, or can the sites that need
// the setting just grab a pointer to the EESCHEMA_SETTINGS and look them up directly?
if( cfg )
if( eeconfig() )
{
cfg->m_Appearance.footprint_preview = m_footprintPreview;
cfg->m_Appearance.navigator_stays_open = m_navigatorStaysOpen;
cfg->m_Appearance.print_sheet_reference = m_printSheetReference;
cfg->m_Appearance.show_hidden_pins = m_showAllPins;
cfg->m_Appearance.show_illegal_symbol_lib_dialog = m_showIllegalSymbolLibDialog;
cfg->m_Appearance.show_page_limits = m_showPageLimits;
cfg->m_Appearance.show_sheet_filename_case_sensitivity_dialog =
m_showSheetFileNameCaseSensitivityDlg;
cfg->m_AutoplaceFields.enable = m_autoplaceFields;
cfg->m_AutoplaceFields.allow_rejustify = m_autoplaceJustify;
cfg->m_AutoplaceFields.align_to_grid = m_autoplaceAlign;
cfg->m_Drawing.default_repeat_offset_x = Iu2Mils( m_repeatStep.x );
cfg->m_Drawing.default_repeat_offset_y = Iu2Mils( m_repeatStep.y );
cfg->m_Drawing.hv_lines_only = GetForceHVLines();
cfg->m_Drawing.repeat_label_increment = m_repeatDeltaLabel;
cfg->m_Drawing.text_markup_flags = GetTextMarkupFlags();
cfg->m_Drawing.default_sheet_border_color = GetDefaultSheetBorderColor();
cfg->m_Drawing.default_sheet_background_color = GetDefaultSheetBackgroundColor();
cfg->m_Input.drag_is_move = m_dragActionIsMove;
cfg->m_Printing.monochrome = m_printMonochrome;
cfg->m_Selection.thickness = Iu2Mils( GetSelectionThickness() );
cfg->m_Selection.draw_selected_children = GetSelectionDrawChildItems();
cfg->m_Selection.fill_shapes = GetSelectionFillShapes();
cfg->m_Selection.select_pin_selects_symbol = GetSelectPinSelectSymbol();
cfg->m_Selection.text_as_box = GetSelectionTextAsBox();
cfg->m_System.units = static_cast<int>( m_userUnits );
// Save template fieldnames
STRING_FORMATTER sf;
m_templateFieldNames.Format( &sf, 0, true );
@ -561,7 +469,7 @@ void SCH_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
record.Replace( wxT("\n"), wxT(""), true ); // strip all newlines
record.Replace( wxT(" "), wxT(" "), true ); // double space to single
cfg->m_Drawing.field_names = record.ToStdString();
eeconfig()->m_Drawing.field_names = record.ToStdString();
}
}

View File

@ -375,7 +375,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
if( !libNames.IsEmpty() )
{
if( m_showIllegalSymbolLibDialog )
if( eeconfig()->m_Appearance.show_illegal_symbol_lib_dialog )
{
wxRichMessageDialog invalidLibDlg(
this,
@ -388,7 +388,9 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
"broken symbol library links under certain conditions." ) );
invalidLibDlg.ShowCheckBox( _( "Do not show this dialog again." ) );
invalidLibDlg.ShowModal();
m_showIllegalSymbolLibDialog = !invalidLibDlg.IsCheckBoxChecked();
eeconfig()->m_Appearance.show_illegal_symbol_lib_dialog =
!invalidLibDlg.IsCheckBoxChecked();
}
libNames.Clear();

View File

@ -106,30 +106,6 @@ void SetSeverity( int aErrorCode, int aSeverity );
double GetTextOffsetRatio();
void SetTextOffsetRatio( double aOffsetRatio );
/**
* Draw selected text items as box
*/
bool GetSelectionTextAsBox();
void SetSelectionTextAsBox( bool aBool );
/**
* Draw selected child items or not
*/
bool GetSelectionDrawChildItems();
void SetSelectionDrawChildItems( bool aBool );
/**
* Draw selected shapes as filled or not
*/
bool GetSelectionFillShapes();
void SetSelectionFillShapes( bool aBool );
/**
* Selection highlight thickness
*/
int GetSelectionThickness();
void SetSelectionThickness( int aThickness );
// Color to draw items flagged invisible, in libedit (they are invisible in Eeschema
COLOR4D GetInvisibleItemColor();

View File

@ -29,15 +29,11 @@
#include <eeschema_id.h>
#include <fctsys.h>
#include <general.h>
#include <gr_basic.h>
#include <kiway.h>
#include <lib_edit_frame.h>
#include <lib_view_frame.h>
#include <msgpanel.h>
#include <pgm_base.h>
#include <project.h>
#include <sch_component.h>
#include <sch_draw_panel.h>
#include <sch_edit_frame.h>
#include <symbol_lib_table.h>
#include <tool/tool_manager.h>
@ -46,7 +42,6 @@
#include <dialog_choose_component.h>
#include <symbol_tree_model_adapter.h>
COMPONENT_SELECTION SCH_BASE_FRAME::SelectComponentFromLibBrowser( wxTopLevelWindow* aParent,
const SCHLIB_FILTER* aFilter, const LIB_ID& aPreselectedLibId, int aUnit, int aConvert )
{
@ -176,9 +171,6 @@ COMPONENT_SELECTION SCH_BASE_FRAME::SelectCompFromLibTree( const SCHLIB_FILTER*
// but no symbol selected
return COMPONENT_SELECTION();
SetUseAllUnits( dlg.GetUseAllUnits() );
SetRepeatComponent( dlg.GetKeepSymbol() );
if( sel.Unit == 0 )
sel.Unit = 1;
@ -187,12 +179,12 @@ COMPONENT_SELECTION SCH_BASE_FRAME::SelectCompFromLibTree( const SCHLIB_FILTER*
if( sel.LibId.IsValid() )
{
aHistoryList.erase(
std::remove_if(
aHistoryList.begin(),
aHistoryList.end(),
[ &sel ]( COMPONENT_SELECTION const& i ){ return i.LibId == sel.LibId; } ),
aHistoryList.end() );
aHistoryList.erase( std::remove_if( aHistoryList.begin(), aHistoryList.end(),
[ &sel ]( COMPONENT_SELECTION const& i )
{
return i.LibId == sel.LibId;
} ),
aHistoryList.end() );
aHistoryList.insert( aHistoryList.begin(), sel );
}
@ -229,7 +221,7 @@ void SCH_EDIT_FRAME::SelectUnit( SCH_COMPONENT* aComponent, int aUnit )
if( !aComponent->GetEditFlags() ) // No command in progress: update schematic
{
if( m_autoplaceFields )
if( eeconfig()->m_AutoplaceFields.enable )
aComponent->AutoAutoplaceFields( GetScreen() );
TestDanglingEnds();

View File

@ -43,6 +43,8 @@
#include <hierarch.h>
#include <view/view.h>
#include <kiface_i.h>
#include "eeschema_settings.h"
class HIERARCHY_NAVIG_DLG;
@ -200,11 +202,15 @@ void HIERARCHY_NAVIG_DLG::onSelectSheetPath( wxTreeEvent& event )
m_SchFrameEditor->GetToolManager()->RunAction( ACTIONS::cancelInteractive, true );
m_SchFrameEditor->GetToolManager()->RunAction( EE_ACTIONS::clearSelection, true );
wxTreeItemId ItemSel = m_Tree->GetSelection();
m_SchFrameEditor->SetCurrentSheet(( (TreeItemData*) m_Tree->GetItemData( ItemSel ) )->m_SheetPath );
wxTreeItemId itemSel = m_Tree->GetSelection();
TreeItemData* itemData = static_cast<TreeItemData*>( m_Tree->GetItemData( itemSel ) );
m_SchFrameEditor->SetCurrentSheet( itemData->m_SheetPath );
m_SchFrameEditor->DisplayCurrentSheet();
if( m_SchFrameEditor->GetNavigatorStaysOpen() == false )
EESCHEMA_SETTINGS* appSettings = static_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
if( !appSettings->m_Appearance.navigator_stays_open )
Close( true );
}

View File

@ -49,9 +49,10 @@
#include <transform.h>
#include <sch_component.h>
#include <sch_sheet_path.h>
#include <settings/settings_manager.h>
#include <settings/color_settings.h>
#include <trace_helpers.h>
#include <libedit/libedit_settings.h>
static const int pin_orientation_codes[] =
{
@ -147,13 +148,15 @@ static int ExternalPinDecoSize( const LIB_PIN &aPin )
LIB_PIN::LIB_PIN( LIB_PART* aParent )
: LIB_ITEM( LIB_PIN_T, aParent ), m_shape( GRAPHIC_PINSHAPE::LINE )
{
m_length = LIB_EDIT_FRAME::GetDefaultPinLength();
m_orientation = PIN_RIGHT; // Pin orient: Up, Down, Left, Right
m_type = ELECTRICAL_PINTYPE::PT_UNSPECIFIED; // electrical type of pin
m_attributes = 0; // bit 0 != 0: pin invisible
m_numTextSize = LIB_EDIT_FRAME::GetPinNumDefaultSize();
m_nameTextSize = LIB_EDIT_FRAME::GetPinNameDefaultSize();
m_width = 0;
LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
m_length = Mils2iu( settings->m_Defaults.pin_length );
m_numTextSize = Mils2iu( settings->m_Defaults.pin_num_size );
m_nameTextSize = Mils2iu( settings->m_Defaults.pin_name_size );
}

View File

@ -66,11 +66,6 @@
bool LIB_EDIT_FRAME:: m_showDeMorgan = false;
double LIB_EDIT_FRAME:: g_LastTextAngle = TEXT_ANGLE_HORIZ;
// these values are overridden when reading the config
int LIB_EDIT_FRAME:: m_textPinNumDefaultSize = Mils2iu( DEFAULTPINNUMSIZE );
int LIB_EDIT_FRAME:: m_textPinNameDefaultSize = Mils2iu( DEFAULTPINNAMESIZE );
int LIB_EDIT_FRAME:: m_defaultPinLength = Mils2iu( DEFAULTPINLENGTH );
FILL_T LIB_EDIT_FRAME:: g_LastFillStyle = NO_FILL;
@ -95,14 +90,15 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
END_EVENT_TABLE()
LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_LIB_EDITOR, _( "Library Editor" ),
wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, LIB_EDIT_FRAME_NAME )
SCH_BASE_FRAME( aKiway, aParent, FRAME_SCH_LIB_EDITOR, _( "Library Editor" ),
wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE,
LIB_EDIT_FRAME_NAME ),
m_unitSelectBox( nullptr )
{
SetShowDeMorgan( false );
m_DrawSpecificConvert = true;
m_DrawSpecificUnit = false;
m_SyncPinEdit = false;
m_repeatPinStep = 0;
SetShowElectricalType( true );
m_FrameSize = ConvertDialogToPixels( wxSize( 500, 350 ) ); // default in case of no prefs
@ -135,8 +131,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
GetCanvas()->GetViewControls()->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false );
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
auto settings = GetCanvas()->GetView()->GetPainter()->GetSettings();
settings->LoadColors( GetColorSettings() );
GetRenderSettings()->LoadColors( GetColorSettings() );
setupTools();
@ -162,7 +157,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) );
m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "ComponentTree" ).Left().Layer(1)
.Caption( _( "Libraries" ) ).MinSize( 250, -1 )
.BestSize( m_defaultLibWidth, -1 ).Resizable() );
.BestSize( m_settings->m_LibWidth, -1 ).Resizable() );
m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(1) );
m_auimgr.AddPane( GetCanvas(), wxAuiPaneInfo().Name( "DrawFrame" ).CentrePane() );
@ -213,75 +208,32 @@ LIB_EDIT_FRAME::~LIB_EDIT_FRAME()
void LIB_EDIT_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
{
EDA_DRAW_FRAME::LoadSettings( aCfg );
SCH_BASE_FRAME::LoadSettings( eeconfig() );
auto cfg = dynamic_cast<LIBEDIT_SETTINGS*>( aCfg );
wxASSERT( cfg );
if( cfg )
if( m_settings )
{
SetDefaultLineWidth( Mils2iu( cfg->m_Defaults.line_width ) );
SetDefaultPinLength( Mils2iu( cfg->m_Defaults.pin_length ) );
SetDefaultTextSize( Mils2iu( cfg->m_Defaults.text_size ) );
m_textPinNameDefaultSize = Mils2iu( cfg->m_Defaults.pin_name_size );
m_textPinNumDefaultSize = Mils2iu( cfg->m_Defaults.pin_num_size );
SetRepeatDeltaLabel( cfg->m_Repeat.label_delta );
SetRepeatPinStep( Mils2iu( cfg->m_Repeat.pin_step ) );
SetRepeatStep( wxPoint( cfg->m_Repeat.x_step, cfg->m_Repeat.y_step ) );
m_showPinElectricalTypeName = cfg->m_ShowPinElectricalType;
m_defaultLibWidth = cfg->m_LibWidth;
SetDefaultLineWidth( Mils2iu( m_settings->m_Defaults.line_width ) );
SetDefaultTextSize( Mils2iu( m_settings->m_Defaults.text_size ) );
m_showPinElectricalTypeName = m_settings->m_ShowPinElectricalType;
}
// TODO(JE) does libedit need its own TemplateFieldNames?
auto ee_settings = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
wxASSERT( ee_settings );
wxString templateFieldNames = ee_settings->m_Drawing.field_names;
if( !templateFieldNames.IsEmpty() )
{
TEMPLATE_FIELDNAMES_LEXER lexer( TO_UTF8( templateFieldNames ) );
try
{
m_templateFieldNames.Parse( &lexer, true );
}
catch( const IO_ERROR& DBG( e ) )
{
// @todo show error msg
DBG( printf( "templatefieldnames parsing error: '%s'\n", TO_UTF8( e.What() ) ); )
}
}
auto painter = static_cast<KIGFX::SCH_PAINTER*>( GetCanvas()->GetView()->GetPainter() );
KIGFX::SCH_RENDER_SETTINGS* settings = painter->GetSettings();
settings->m_ShowPinsElectricalType = m_showPinElectricalTypeName;
GetRenderSettings()->m_ShowPinsElectricalType = GetShowElectricalType();
// Hidden elements must be editable
settings->m_ShowHiddenText = true;
settings->m_ShowHiddenPins = true;
settings->m_ShowUmbilicals = false;
GetRenderSettings()->m_ShowHiddenText = true;
GetRenderSettings()->m_ShowHiddenPins = true;
GetRenderSettings()->m_ShowUmbilicals = false;
}
void LIB_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg)
{
// aCfg will be EESCHEMA_SETTINGS because that's the parent FACE
// so we throw it away here and get our own settings
SCH_BASE_FRAME::SaveSettings( eeconfig() );
auto cfg = Pgm().GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
EDA_DRAW_FRAME::SaveSettings( cfg );
cfg->m_Defaults.line_width = Iu2Mils( GetDefaultLineWidth() );
cfg->m_Defaults.text_size = Iu2Mils( GetDefaultTextSize() );
cfg->m_Defaults.pin_length = Iu2Mils( GetDefaultPinLength() );
cfg->m_Defaults.pin_name_size = Iu2Mils( GetPinNameDefaultSize() );
cfg->m_Defaults.pin_num_size = Iu2Mils( GetPinNumDefaultSize() );
cfg->m_Repeat.label_delta = GetRepeatDeltaLabel();
cfg->m_Repeat.pin_step = Iu2Mils( GetRepeatPinStep() );
cfg->m_Repeat.x_step = Iu2Mils( GetRepeatStep().x );
cfg->m_Repeat.y_step = Iu2Mils( GetRepeatStep().y );
cfg->m_ShowPinElectricalType = GetShowElectricalType();
cfg->m_LibWidth = m_treePane->GetSize().x;
m_settings->m_Defaults.line_width = Iu2Mils( GetDefaultLineWidth() );
m_settings->m_Defaults.text_size = Iu2Mils( GetDefaultTextSize() );
m_settings->m_ShowPinElectricalType = GetShowElectricalType();
m_settings->m_LibWidth = m_treePane->GetSize().x;
}

View File

@ -70,15 +70,6 @@ class LIB_EDIT_FRAME : public SCH_BASE_FRAME
// But under some circumstances (New component created) these tools must left enabled
static bool m_showDeMorgan;
static int m_textPinNumDefaultSize; // The default pin num text size setting.
static int m_textPinNameDefaultSize; // The default pin name text size setting.
static int m_defaultPinLength; // Default pin length
/// Default repeat offset for pins in repeat place pin
int m_repeatPinStep;
int m_defaultLibWidth;
public:
/**
* Set to true to synchronize pins at the same position when editing symbols with multiple
@ -168,21 +159,6 @@ public:
LIB_MANAGER& GetLibManager();
static int GetPinNumDefaultSize() { return m_textPinNumDefaultSize; }
static void SetPinNumDefaultSize( int aSize ) { m_textPinNumDefaultSize = aSize; }
static int GetPinNameDefaultSize() { return m_textPinNameDefaultSize; }
static void SetPinNameDefaultSize( int aSize ) { m_textPinNameDefaultSize = aSize; }
static int GetDefaultPinLength() { return m_defaultPinLength; }
static void SetDefaultPinLength( int aLength ) { m_defaultPinLength = aLength; }
/**
* @return the increment value of the position of a pin for the pin repeat command
*/
int GetRepeatPinStep() const { return m_repeatPinStep; }
void SetRepeatPinStep( int aStep) { m_repeatPinStep = aStep; }
void ReCreateMenuBar() override;
// See comments for m_SyncPinEdit.

View File

@ -86,11 +86,7 @@ SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aWindo
m_defaultWireThickness( DEFAULT_WIRE_THICKNESS * IU_PER_MILS ),
m_defaultBusThickness( DEFAULT_BUS_THICKNESS * IU_PER_MILS ),
m_defaultTextSize( 50.0 * IU_PER_MILS ),
m_repeatDeltaLabel( 1 ),
m_showPinElectricalTypeName( false ),
m_dragActionIsMove( false ),
m_repeatComponent( false ),
m_useAllUnits( false )
m_showPinElectricalTypeName( false )
{
createCanvas();

View File

@ -31,6 +31,7 @@
#include <page_info.h>
#include <sch_draw_panel.h>
#include <sch_screen.h>
#include <eeschema_settings.h>
#include <stddef.h>
#include <utility>
@ -91,19 +92,10 @@ protected:
int m_defaultWireThickness;
int m_defaultBusThickness;
int m_defaultTextSize;
COLOR4D m_defaultSheetBorderColor;
COLOR4D m_defaultSheetBackgroundColor;
TEMPLATES m_templateFieldNames;
wxPoint m_repeatStep; // the increment value of the position of an item
// when it is repeated
int m_repeatDeltaLabel; // the increment value of labels like bus members
// when they are repeated
bool m_showPinElectricalTypeName;
bool m_dragActionIsMove; // drag action defaults to move, otherwise it's drag
bool m_repeatComponent; // After placing one component, reload a sequential
bool m_useAllUnits; // After placing unit A, place unit B of the same
bool m_showPinElectricalTypeName;
public:
SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent,
@ -120,6 +112,11 @@ public:
SCH_SCREEN* GetScreen() const override;
void SetScreen( BASE_SCREEN* aScreen ) override;
EESCHEMA_SETTINGS* eeconfig() const { return static_cast<EESCHEMA_SETTINGS*>( config() ); }
void LoadSettings( APP_SETTINGS_BASE* aCfg ) override;
void SaveSettings( APP_SETTINGS_BASE* aCfg ) override;
KIGFX::SCH_RENDER_SETTINGS* GetRenderSettings();
/**
@ -127,12 +124,6 @@ public:
*/
virtual bool GetShowAllPins() const { return true; }
/**
* Allow some frames to select the parent symbol when trying to select a pin.
* The default impl select the pin.
*/
virtual bool GetSelectPinSelectSymbol() const { return false; }
/**
* Allow some frames to show/hide pin electrical type names.
*/
@ -151,61 +142,6 @@ public:
int GetDefaultTextSize() const { return m_defaultTextSize; }
void SetDefaultTextSize( int aSize ) { m_defaultTextSize = aSize; }
COLOR4D GetDefaultSheetBorderColor() { return m_defaultSheetBorderColor; }
void SetDefaultSheetBorderColor( COLOR4D aColor ) { m_defaultSheetBorderColor = aColor; }
COLOR4D GetDefaultSheetBackgroundColor() { return m_defaultSheetBackgroundColor; }
void SetDefaultSheetBackgroundColor( COLOR4D aColor ) { m_defaultSheetBackgroundColor = aColor; }
/**
* @return the increment value of the position of an item
* for the repeat command
*/
const wxPoint GetRepeatStep() const { return m_repeatStep; }
/**
* Sets the repeat step value for repeat command
* @param aStep the increment value of the position of an item
* for the repeat command
*/
void SetRepeatStep( const wxPoint& aStep) { m_repeatStep = aStep; }
/**
* @return the increment value of labels like bus members
* for the repeat command
*/
int GetRepeatDeltaLabel() const { return m_repeatDeltaLabel; }
/**
* Sets the repeat delta label value for repeat command
* @param aDelta the increment value of labels like bus members
* for the repeat command
*/
void SetRepeatDeltaLabel( int aDelta ) { m_repeatDeltaLabel = aDelta; }
/**
* @return the current setting of placing copies of the same symbol for each click
*/
const bool GetRepeatComponent() { return m_repeatComponent; }
/**
* If true, keep placing new copies of the same symbol on each click
* @param aRepeat True to repeat the same symbol, False to only set one
*/
void SetRepeatComponent( bool aRepeat ) { m_repeatComponent = aRepeat; }
/**
* @return the current setting to use all units when placing a component
*/
const bool GetUseAllUnits() { return m_useAllUnits; }
/**
* Sets whether to utilize all units of a component when placing
* @param aUseAll True to iterate through Units A, B, ...
*/
void SetUseAllUnits( bool aUseAll ) { m_useAllUnits = aUseAll; }
/**
* Function GetZoomLevelIndicator
* returns a human readable value which can be displayed as zoom
@ -214,9 +150,6 @@ public:
*/
const wxString GetZoomLevelIndicator() const override;
void SetDragActionIsMove( bool aValue ) { m_dragActionIsMove = aValue; }
bool GetDragActionIsMove() const { return m_dragActionIsMove; }
void SetPageSettings( const PAGE_INFO& aPageSettings ) override;
const PAGE_INFO& GetPageSettings () const override;
const wxSize GetPageSizeIU() const override;

View File

@ -217,21 +217,15 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
g_ErcSettings = new ERC_SETTINGS();
m_showBorderAndTitleBlock = true; // true to show sheet references
m_showAllPins = false;
m_selectPinSelectSymbol = true;
m_printMonochrome = true;
m_printSheetReference = true;
SetShowPageLimits( true );
m_hasAutoSave = true;
m_showIllegalSymbolLibDialog = true;
m_showSheetFileNameCaseSensitivityDlg = true;
m_FrameSize = ConvertDialogToPixels( wxSize( 500, 350 ) ); // default in case of no prefs
m_AboutTitle = "Eeschema";
m_findReplaceDialog = nullptr;
m_findReplaceStatusPopup = nullptr;
SetForceHVLines( true );
SetSpiceAdjustPassiveValues( false );
// Give an icon

View File

@ -59,7 +59,6 @@ class SCH_COMPONENT;
class SCH_FIELD;
class SCH_JUNCTION;
class DIALOG_SCH_FIND;
class wxFindDialogEvent;
class wxFindReplaceData;
class RESCUER;
class HIERARCHY_NAVIG_DLG;
@ -129,28 +128,14 @@ private:
bool m_printMonochrome; ///< Print monochrome instead of grey scale.
bool m_printSheetReference;
SCH_ITEM* m_item_to_repeat; ///< Last item to insert by the repeat command.
int m_repeatLabelDelta; ///< Repeat label number increment step.
wxString m_netListerCommand; ///< Command line to call a custom net list
///< generator.
int m_exec_flags; ///< Flags of the wxExecute() function
///< to call a custom net list generator.
bool m_forceHVLines; ///< force H or V directions for wires, bus, line
bool m_autoplaceFields; ///< automatically place component fields
bool m_autoplaceJustify; ///< allow autoplace to change justification
bool m_autoplaceAlign; ///< align autoplaced fields to the grid
bool m_footprintPreview; ///< whether to show footprint previews
bool m_navigatorStaysOpen; ///< whether to keep Navigator open
bool m_showIllegalSymbolLibDialog;
bool m_showSheetFileNameCaseSensitivityDlg;
DIALOG_SCH_FIND* m_findReplaceDialog;
STATUS_TEXT_POPUP* m_findReplaceStatusPopup;
bool m_showAllPins; // show hidden pins
bool m_selectPinSelectSymbol; // select parent when clicking on pin
wxString m_plotDirectoryName;
wxString m_netListFormat;
@ -198,36 +183,6 @@ public:
void OnCloseWindow( wxCloseEvent& Event );
bool GetForceHVLines() const { return m_forceHVLines; }
void SetForceHVLines( bool aForceHVdirection ) { m_forceHVLines = aForceHVdirection; }
bool GetShowAllPins() const override { return m_showAllPins; }
void SetShowAllPins( bool aEnable ) { m_showAllPins = aEnable; }
bool GetSelectPinSelectSymbol() const override { return m_selectPinSelectSymbol; }
void SetSelectPinSelectSymbol( bool aEnable ) { m_selectPinSelectSymbol = aEnable; }
bool GetShowFootprintPreviews() const { return m_footprintPreview; }
void SetShowFootprintPreviews( bool aEnable ) { m_footprintPreview = aEnable; }
bool GetNavigatorStaysOpen() const
{
return m_navigatorStaysOpen;
}
void SetNavigatorStaysOpen( bool aEnable )
{
m_navigatorStaysOpen = aEnable;
}
bool GetAutoplaceFields() const { return m_autoplaceFields; }
void SetAutoplaceFields( bool aEnable ) { m_autoplaceFields = aEnable; }
bool GetAutoplaceAlign() const { return m_autoplaceAlign; }
void SetAutoplaceAlign( bool aEnable ) { m_autoplaceAlign = aEnable; }
bool GetAutoplaceJustify() const { return m_autoplaceJustify; }
void SetAutoplaceJustify( bool aEnable ) { m_autoplaceJustify = aEnable; }
const wxString& GetNetListFormatName() const { return m_netListFormat; }
void SetNetListFormatName( const wxString& aFormat ) { m_netListFormat = aFormat; }
@ -876,8 +831,6 @@ public:
*/
void DeleteJunction( SCH_ITEM* aItem, bool aAppend = false );
int GetLabelIncrement() const { return m_repeatLabelDelta; }
void ConvertPart( SCH_COMPONENT* aComponent );
void SelectUnit( SCH_COMPONENT* aComponent, int aUnit );

View File

@ -396,8 +396,6 @@ public:
void SetConnectivityDirty( bool aDirty = true ) { m_connectivity_dirty = aDirty; }
virtual bool CanIncrementLabel() const { return false; }
/**
* Return whether the fields have been automatically placed.
*/

View File

@ -59,6 +59,7 @@
#include <sch_text.h>
#include <settings/color_settings.h>
#include <view/view.h>
#include <kiface_i.h>
#include "sch_painter.h"
@ -100,6 +101,12 @@ const COLOR4D& SCH_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer
}
EESCHEMA_SETTINGS* eeconfig()
{
return dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
}
/**
* Used when a LIB_PART is not found in library to draw a dummy shape.
* This component is a 400 mils square with the text "??"
@ -233,7 +240,7 @@ float SCH_PAINTER::getShadowWidth()
// For best visuals the selection width must be a cross between the zoom level and the
// default line width.
return static_cast<float>( fabs( matrix.GetScale().x * 2.75 ) + GetSelectionThickness() );
return (float) fabs( matrix.GetScale().x * 2.75 ) + Mils2iu( eeconfig()->m_Selection.thickness );
}
@ -439,7 +446,7 @@ bool SCH_PAINTER::setDeviceColors( const LIB_ITEM* aItem, int aLayer )
void SCH_PAINTER::fillIfSelection( int aLayer )
{
if( aLayer == LAYER_SELECTION_SHADOWS && GetSelectionFillShapes() )
if( aLayer == LAYER_SELECTION_SHADOWS && eeconfig()->m_Selection.fill_shapes )
m_gal->SetIsFill( true );
}
@ -575,7 +582,7 @@ void SCH_PAINTER::draw( LIB_FIELD *aField, int aLayer )
auto pos = mapCoords( aField->GetPosition() );
if( drawingShadows && GetSelectionTextAsBox() )
if( drawingShadows && eeconfig()->m_Selection.text_as_box )
{
EDA_RECT boundaryBox = aField->GetBoundingBox();
@ -584,8 +591,8 @@ void SCH_PAINTER::draw( LIB_FIELD *aField, int aLayer )
m_gal->SetLineWidth( m_gal->GetLineWidth() * 0.5 );
boundaryBox.RevertYAxis();
m_gal->DrawRectangle(
mapCoords( boundaryBox.GetPosition() ), mapCoords( boundaryBox.GetEnd() ) );
m_gal->DrawRectangle( mapCoords( boundaryBox.GetPosition() ),
mapCoords( boundaryBox.GetEnd() ) );
}
else
{
@ -864,7 +871,7 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
// Draw the labels
if( drawingShadows && ( libEntry->Type() == LIB_PART_T || libEntry->IsSelected() )
&& !GetSelectionDrawChildItems() )
&& !eeconfig()->m_Selection.draw_selected_children )
return;
int textOffset = libEntry->GetPinNameOffset();
@ -1248,7 +1255,7 @@ void SCH_PAINTER::draw( SCH_TEXT *aText, int aLayer )
if( drawingShadows )
{
if( GetSelectionTextAsBox() )
if( eeconfig()->m_Selection.text_as_box )
{
EDA_RECT bBox = aText->GetBoundingBox();
@ -1401,8 +1408,11 @@ void SCH_PAINTER::draw( SCH_FIELD *aField, int aLayer )
if( aField->IsVoid() )
return;
if( drawingShadows && aField->GetParent()->IsSelected() && !GetSelectionDrawChildItems() )
if( drawingShadows && aField->GetParent()->IsSelected()
&& !eeconfig()->m_Selection.draw_selected_children )
{
return;
}
// Calculate the text orientation according to the parent orientation.
int orient = (int) aField->GetTextAngle();
@ -1436,7 +1446,7 @@ void SCH_PAINTER::draw( SCH_FIELD *aField, int aLayer )
m_gal->SetIsStroke( true );
m_gal->SetLineWidth( getLineWidth( aField, drawingShadows ) );
if( drawingShadows && GetSelectionTextAsBox() )
if( drawingShadows && eeconfig()->m_Selection.text_as_box )
{
m_gal->SetIsFill( true );
m_gal->SetFillColor( color );
@ -1550,8 +1560,11 @@ void SCH_PAINTER::draw( SCH_SHEET *aSheet, int aLayer )
if( drawingShadows && !aSheet->IsSelected() && !sheetPin->IsSelected() )
continue;
if( drawingShadows && !GetSelectionDrawChildItems() && aSheet->IsSelected() )
if( drawingShadows && aSheet->IsSelected()
&& !eeconfig()->m_Selection.draw_selected_children )
{
break;
}
int width = aSheet->GetPenSize();
wxPoint initial_pos = sheetPin->GetTextPos();
@ -1595,7 +1608,7 @@ void SCH_PAINTER::draw( SCH_SHEET *aSheet, int aLayer )
m_gal->DrawRectangle( pos, pos + size );
if( drawingShadows && !GetSelectionDrawChildItems() && aSheet->IsSelected() )
if( drawingShadows && !eeconfig()->m_Selection.draw_selected_children && aSheet->IsSelected() )
return;
for( SCH_FIELD& field : aSheet->GetFields() )

View File

@ -295,8 +295,6 @@ public:
void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const override;
bool CanIncrementLabel() const override { return true; }
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
BITMAP_DEF GetMenuImage() const override;

View File

@ -628,7 +628,7 @@ bool SCH_EDIT_FRAME::AllowCaseSensitiveFileNameClashes( const wxString& aSchemat
wxCHECK( fn.IsAbsolute(), false );
if( m_showSheetFileNameCaseSensitivityDlg
if( eeconfig()->m_Appearance.show_sheet_filename_case_sensitivity_dialog
&& screens.CanCauseCaseSensitivityIssue( aSchematicFileName ) )
{
msg.Printf( _( "The file name \"%s\" can cause issues with an existing file name\n"
@ -647,7 +647,8 @@ bool SCH_EDIT_FRAME::AllowCaseSensitiveFileNameClashes( const wxString& aSchemat
if( dlg.ShowModal() == wxID_NO )
return false;
m_showSheetFileNameCaseSensitivityDlg = !dlg.IsCheckBoxChecked();
eeconfig()->m_Appearance.show_sheet_filename_case_sensitivity_dialog =
!dlg.IsCheckBoxChecked();
}
return true;

View File

@ -169,18 +169,19 @@ void SCH_EDIT_FRAME::SyncToolbars()
KIGFX::GAL_DISPLAY_OPTIONS& galOpts = GetGalDisplayOptions();
m_mainToolBar->Toggle( ACTIONS::save, IsContentModified() );
m_mainToolBar->Toggle( ACTIONS::undo, GetScreen() && GetScreen()->GetUndoCommandCount() > 0 );
m_mainToolBar->Toggle( ACTIONS::redo, GetScreen() && GetScreen()->GetRedoCommandCount() > 0 );
TOGGLE_TOOL( m_mainToolBar, ACTIONS::zoomTool );
m_mainToolBar->Refresh();
m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() );
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::toggleHiddenPins, GetShowAllPins() );
m_optionsToolBar->Toggle( EE_ACTIONS::toggleForceHV, GetForceHVLines() );
m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() );
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::toggleHiddenPins, GetShowAllPins() );
m_optionsToolBar->Toggle( EE_ACTIONS::toggleForceHV, eeconfig()->m_Drawing.hv_lines_only );
m_optionsToolBar->Refresh();
TOGGLE_TOOL( m_drawToolBar, ACTIONS::selectionTool );

View File

@ -566,7 +566,7 @@ void EE_SELECTION_TOOL::GuessSelectionCandidates( EE_COLLECTOR& collector, const
if( item->Type() == SCH_COMPONENT_T && other->Type() == SCH_PIN_T )
{
if( m_frame->GetSelectPinSelectSymbol() )
if( !m_isLibEdit && m_frame->eeconfig()->m_Selection.select_pin_selects_symbol )
collector.Remove( other );
else
collector.Remove( item );

View File

@ -445,7 +445,7 @@ int LIB_CONTROL::AddSymbolToSchematic( const TOOL_EVENT& aEvent )
// Be sure the link to the corresponding LIB_PART is OK:
comp->Resolve( *m_frame->Prj().SchSymbolLibTable() );
if( schframe->GetAutoplaceFields() )
if( schframe->eeconfig()->m_AutoplaceFields.enable )
comp->AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false );
schframe->Raise();

View File

@ -27,9 +27,10 @@
#include <lib_edit_frame.h>
#include <confirm.h>
#include <ee_actions.h>
#include <sch_view.h>
#include <dialogs/dialog_display_info_HTML_base.h>
#include <dialogs/dialog_lib_edit_pin.h>
#include <settings/settings_manager.h>
#include <libedit/libedit_settings.h>
#include <pgm_base.h>
#include "lib_pin_tool.h"
@ -48,7 +49,10 @@ static int g_LastPinNumSize = -1;
static int GetLastPinLength()
{
if( g_LastPinLength == -1 )
g_LastPinLength = LIB_EDIT_FRAME::GetDefaultPinLength();
{
LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
g_LastPinLength = Mils2iu( settings->m_Defaults.pin_length );
}
return g_LastPinLength;
}
@ -56,7 +60,10 @@ static int GetLastPinLength()
static int GetLastPinNameSize()
{
if( g_LastPinNameSize == -1 )
g_LastPinNameSize = LIB_EDIT_FRAME::GetPinNameDefaultSize();
{
LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
g_LastPinNameSize = Mils2iu( settings->m_Defaults.pin_name_size );
}
return g_LastPinNameSize;
}
@ -64,7 +71,10 @@ static int GetLastPinNameSize()
static int GetLastPinNumSize()
{
if( g_LastPinNumSize == -1 )
g_LastPinNumSize = LIB_EDIT_FRAME::GetPinNumDefaultSize();
{
LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
g_LastPinNumSize = Mils2iu( settings->m_Defaults.pin_num_size );
}
return g_LastPinNumSize;
}
@ -318,22 +328,24 @@ LIB_PIN* LIB_PIN_TOOL::RepeatPin( const LIB_PIN* aSourcePin )
pin->ClearFlags();
pin->SetFlags( IS_NEW );
LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
switch( pin->GetOrientation() )
{
case PIN_UP: step.x = m_frame->GetRepeatPinStep(); break;
case PIN_DOWN: step.x = m_frame->GetRepeatPinStep(); break;
case PIN_LEFT: step.y = -m_frame->GetRepeatPinStep(); break;
case PIN_RIGHT: step.y = -m_frame->GetRepeatPinStep(); break;
case PIN_UP: step.x = settings->m_Repeat.pin_step; break;
case PIN_DOWN: step.x = settings->m_Repeat.pin_step; break;
case PIN_LEFT: step.y = -settings->m_Repeat.pin_step; break;
case PIN_RIGHT: step.y = -settings->m_Repeat.pin_step; break;
}
pin->Offset( step );
wxString nextName = pin->GetName();
IncrementLabelMember( nextName, m_frame->GetRepeatDeltaLabel() );
IncrementLabelMember( nextName, settings->m_Repeat.label_delta );
pin->SetName( nextName );
wxString nextNumber = pin->GetNumber();
IncrementLabelMember( nextNumber, m_frame->GetRepeatDeltaLabel() );
IncrementLabelMember( nextNumber, settings->m_Repeat.label_delta );
pin->SetNumber( nextNumber );
if( m_frame->SynchronizePins() )

View File

@ -44,7 +44,7 @@
#include <sch_sheet.h>
#include <sch_bitmap.h>
#include <class_library.h>
#include <eeschema_settings.h>
SCH_DRAWING_TOOLS::SCH_DRAWING_TOOLS() :
EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.InteractiveDrawing" )
@ -158,8 +158,10 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
// Pick the module to be placed
auto sel = m_frame->SelectCompFromLibTree( &filter, *historyList, true, 1, 1,
m_frame->GetShowFootprintPreviews());
bool footprintPreviews = m_frame->eeconfig()->m_Appearance.footprint_preview;
COMPONENT_SELECTION sel = m_frame->SelectCompFromLibTree( &filter, *historyList,
true, 1, 1,
footprintPreviews );
// Restore cursor after dialog
getViewControls()->WarpCursor( getViewControls()->GetCursorPosition(), true );
@ -175,7 +177,7 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent )
// Be sure the link to the corresponding LIB_PART is OK:
component->Resolve( *m_frame->Prj().SchSymbolLibTable() );
if( m_frame->GetAutoplaceFields() )
if( m_frame->eeconfig()->m_AutoplaceFields.enable )
component->AutoplaceFields( /* aScreen */ NULL, /* aManual */ false );
m_frame->SaveCopyForRepeatItem( component );
@ -197,18 +199,19 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( EE_ACTIONS::addNeededJunctions, true, &new_sel );
m_frame->OnModify();
if( m_frame->GetUseAllUnits() || m_frame->GetRepeatComponent() )
if( m_frame->eeconfig()->m_SymChooserPanel.place_all_units
|| m_frame->eeconfig()->m_SymChooserPanel.keep_symbol )
{
int new_unit = component->GetUnit();
if( m_frame->GetUseAllUnits()
if( m_frame->eeconfig()->m_SymChooserPanel.place_all_units
&& component->GetUnit() < component->GetUnitCount() )
new_unit++;
else
new_unit = 1;
// We are either stepping to the next unit or next component
if( m_frame->GetRepeatComponent() || new_unit > 1 )
if( m_frame->eeconfig()->m_SymChooserPanel.keep_symbol || new_unit > 1 )
{
// Deselect the last placed symbol: obviously we do not want to
// apply some changes (like rotation, mirror...) to previously placed
@ -220,7 +223,7 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent )
next_comp->SetUnit( new_unit );
next_comp->SetUnitSelection( g_CurrentSheet, new_unit );
if( m_frame->GetAutoplaceFields() )
if( m_frame->eeconfig()->m_AutoplaceFields.enable )
component->AutoplaceFields( /* aScreen */ NULL, /* aManual */ false );
m_frame->SaveCopyForRepeatItem( next_comp );
@ -834,6 +837,8 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
else if( evt->IsClick( BUT_LEFT ) && !sheet )
{
EESCHEMA_SETTINGS* cfg = m_frame->eeconfig();
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
sheet = new SCH_SHEET( (wxPoint) cursorPos );
@ -841,8 +846,8 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
sheet->SetParent( m_frame->GetScreen() );
sheet->SetScreen( NULL );
sheet->SetBorderWidth( m_frame->GetDefaultLineWidth() );
sheet->SetBorderColor( m_frame->GetDefaultSheetBorderColor() );
sheet->SetBackgroundColor( m_frame->GetDefaultSheetBackgroundColor() );
sheet->SetBorderColor( cfg->m_Drawing.default_sheet_border_color );
sheet->SetBackgroundColor( cfg->m_Drawing.default_sheet_background_color );
sizeSheet( sheet, cursorPos );
m_view->ClearPreview();

View File

@ -51,7 +51,9 @@
#include <dialogs/dialog_edit_one_field.h>
#include "sch_drawing_tools.h"
#include <math/util.h> // for KiROUND
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include <libedit_settings.h>
char g_lastBusEntryShape = '/';
@ -396,7 +398,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
else
component->SetOrientation( CMP_ROTATE_COUNTERCLOCKWISE );
if( m_frame->GetAutoplaceFields() )
if( m_frame->eeconfig()->m_AutoplaceFields.enable )
component->AutoAutoplaceFields( m_frame->GetScreen() );
break;
@ -580,7 +582,7 @@ int SCH_EDIT_TOOL::Mirror( const TOOL_EVENT& aEvent )
else
component->SetOrientation( CMP_MIRROR_Y );
if( m_frame->GetAutoplaceFields() )
if( m_frame->eeconfig()->m_AutoplaceFields.enable )
component->AutoAutoplaceFields( m_frame->GetScreen() );
break;
@ -859,10 +861,33 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent )
}
else
{
if( newItem->CanIncrementLabel() )
( (SCH_TEXT*) newItem )->IncrementLabel( m_frame->GetRepeatDeltaLabel() );
if( m_isLibEdit )
{
LIBEDIT_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
if( dynamic_cast<SCH_TEXT*>( newItem ) )
{
SCH_TEXT* text = static_cast<SCH_TEXT*>( newItem );
text->IncrementLabel( cfg->m_Repeat.label_delta );
}
newItem->Move( wxPoint( Mils2iu( cfg->m_Repeat.x_step ),
Mils2iu( cfg->m_Repeat.y_step ) ) );
}
else
{
EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
if( dynamic_cast<SCH_TEXT*>( newItem ) )
{
SCH_TEXT* text = static_cast<SCH_TEXT*>( newItem );
text->IncrementLabel( cfg->m_Drawing.repeat_label_increment );
}
newItem->Move( wxPoint( Mils2iu( cfg->m_Drawing.default_repeat_offset_x ),
Mils2iu( cfg->m_Drawing.default_repeat_offset_y ) ) );
}
newItem->Move( m_frame->GetRepeatStep() );
}
newItem->SetFlags( IS_NEW );
@ -1083,7 +1108,7 @@ void SCH_EDIT_TOOL::editFieldText( SCH_FIELD* aField )
dlg.UpdateField( aField, g_CurrentSheet );
if( m_frame->GetAutoplaceFields() || aField->GetParent()->Type() == SCH_SHEET_T )
if( m_frame->eeconfig()->m_AutoplaceFields.enable || aField->GetParent()->Type() == SCH_SHEET_T )
static_cast<SCH_ITEM*>( aField->GetParent() )->AutoAutoplaceFields( m_frame->GetScreen() );
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
@ -1223,7 +1248,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
// the QUASIMODAL macros here.
if( dlg.ShowQuasiModal() == wxID_OK )
{
if( m_frame->GetAutoplaceFields() )
if( m_frame->eeconfig()->m_AutoplaceFields.enable )
component->AutoAutoplaceFields( m_frame->GetScreen() );
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );

View File

@ -1410,7 +1410,8 @@ int SCH_EDITOR_CONTROL::LeaveSheet( const TOOL_EVENT& aEvent )
int SCH_EDITOR_CONTROL::ToggleHiddenPins( const TOOL_EVENT& aEvent )
{
m_frame->SetShowAllPins( !m_frame->GetShowAllPins() );
EESCHEMA_SETTINGS* cfg = m_frame->eeconfig();
cfg->m_Appearance.show_hidden_pins = !cfg->m_Appearance.show_hidden_pins;
KIGFX::SCH_PAINTER* painter = static_cast<KIGFX::SCH_PAINTER*>( getView()->GetPainter() );
painter->GetSettings()->m_ShowHiddenPins = m_frame->GetShowAllPins();
@ -1424,7 +1425,7 @@ int SCH_EDITOR_CONTROL::ToggleHiddenPins( const TOOL_EVENT& aEvent )
int SCH_EDITOR_CONTROL::ToggleForceHV( const TOOL_EVENT& aEvent )
{
m_frame->SetForceHVLines( !m_frame->GetForceHVLines() );
m_frame->eeconfig()->m_Drawing.hv_lines_only = !m_frame->eeconfig()->m_Drawing.hv_lines_only;
return 0;
}

View File

@ -493,7 +493,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
wxPoint cursorPos = (wxPoint) getViewControls()->GetCursorPosition( !evt->Modifier( MD_ALT ) );
bool forceHV = m_frame->GetForceHVLines();
bool forceHV = m_frame->eeconfig()->m_Drawing.hv_lines_only;
//------------------------------------------------------------------------
// Handle cancel:
@ -735,7 +735,7 @@ SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::startSegments( int aType, const VECTOR2D& aPos
// We need 2 segments to go from a given start pin to an end point when the
// horizontal and vertical lines only switch is on.
if( m_frame->GetForceHVLines() )
if( m_frame->eeconfig()->m_Drawing.hv_lines_only )
{
segment = new SCH_LINE( *segment );
segment->SetFlags( IS_NEW | IS_MOVED );

View File

@ -35,6 +35,8 @@
#include <sch_line.h>
#include <sch_edit_frame.h>
#include <eeschema_id.h>
#include <pgm_base.h>
#include <settings/settings_manager.h>
#include "sch_move_tool.h"
@ -105,6 +107,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
EOT
};
EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<EESCHEMA_SETTINGS>();
KIGFX::VIEW_CONTROLS* controls = getViewControls();
controls->SetSnapping( true );
@ -115,7 +118,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
else if( aEvent.IsAction( &EE_ACTIONS::drag ) )
m_isDragOperation = true;
else if( aEvent.IsAction( &EE_ACTIONS::moveActivate ) )
m_isDragOperation = !m_frame->GetDragActionIsMove();
m_isDragOperation = !cfg->m_Input.drag_is_move;
else
return 0;

View File

@ -271,7 +271,7 @@ public:
* Returns the settings object used in SaveSettings(), and is overloaded in
* KICAD_MANAGER_FRAME
*/
virtual APP_SETTINGS_BASE* config();
virtual APP_SETTINGS_BASE* config() const;
/**
* Function InstallPreferences

View File

@ -185,7 +185,7 @@ wxWindow* KICAD_MANAGER_FRAME::GetToolCanvas() const
}
APP_SETTINGS_BASE* KICAD_MANAGER_FRAME::config()
APP_SETTINGS_BASE* KICAD_MANAGER_FRAME::config() const
{
APP_SETTINGS_BASE* ret = PgmTop().PgmSettings();
wxASSERT( ret );

View File

@ -166,7 +166,7 @@ public:
DECLARE_EVENT_TABLE()
private:
APP_SETTINGS_BASE* config() override;
APP_SETTINGS_BASE* config() const override;
const SEARCH_STACK& sys_search() override;