Attempt to untangle junction dot preferences.
This commit is contained in:
parent
e03257b55f
commit
bc8245ca7b
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include <sch_edit_frame.h>
|
||||
#include <sch_painter.h>
|
||||
#include <eeschema_settings.h>
|
||||
#include <kiface_i.h>
|
||||
#include <panel_setup_formatting.h>
|
||||
#include <sch_junction.h>
|
||||
|
@ -137,6 +136,8 @@ bool PANEL_SETUP_FORMATTING::TransferDataFromWindow()
|
|||
if( m_choiceJunctionDotSize->GetSelection() != wxNOT_FOUND )
|
||||
settings.m_JunctionSizeChoice = m_choiceJunctionDotSize->GetSelection();
|
||||
|
||||
settings.m_JunctionSize = m_frame->GetSchematicJunctionSize();
|
||||
|
||||
settings.m_IntersheetRefsShow = m_showIntersheetsReferences->GetValue();
|
||||
settings.m_IntersheetRefsFormatShort = !m_radioFormatStandard->GetValue();
|
||||
settings.m_IntersheetRefsPrefix = m_prefixCtrl->GetValue();
|
||||
|
|
|
@ -77,13 +77,16 @@ void SCH_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
|
|||
|
||||
bool SCH_EDIT_FRAME::LoadProjectSettings()
|
||||
{
|
||||
GetRenderSettings()->SetDefaultPenWidth( m_defaults->m_DefaultLineWidth );
|
||||
GetRenderSettings()->m_DefaultWireThickness = m_defaults->m_DefaultWireThickness;
|
||||
GetRenderSettings()->m_DefaultBusThickness = m_defaults->m_DefaultBusThickness;
|
||||
GetRenderSettings()->m_LabelSizeRatio = m_defaults->m_LabelSizeRatio;
|
||||
GetRenderSettings()->m_TextOffsetRatio = m_defaults->m_TextOffsetRatio;
|
||||
GetRenderSettings()->m_PinSymbolSize = m_defaults->m_PinSymbolSize;
|
||||
GetRenderSettings()->m_JunctionSize = m_defaults->m_JunctionSize;
|
||||
SCHEMATIC_SETTINGS& settings = Schematic().Settings();
|
||||
settings.m_JunctionSize = GetSchematicJunctionSize();
|
||||
|
||||
GetRenderSettings()->SetDefaultPenWidth( settings.m_DefaultLineWidth );
|
||||
GetRenderSettings()->m_DefaultWireThickness = settings.m_DefaultWireThickness;
|
||||
GetRenderSettings()->m_DefaultBusThickness = settings.m_DefaultBusThickness;
|
||||
GetRenderSettings()->m_LabelSizeRatio = settings.m_LabelSizeRatio;
|
||||
GetRenderSettings()->m_TextOffsetRatio = settings.m_TextOffsetRatio;
|
||||
GetRenderSettings()->m_PinSymbolSize = settings.m_PinSymbolSize;
|
||||
GetRenderSettings()->m_JunctionSize = settings.m_JunctionSize;
|
||||
|
||||
// Verify some values, because the config file can be edited by hand,
|
||||
// and have bad values:
|
||||
|
@ -97,9 +100,7 @@ bool SCH_EDIT_FRAME::LoadProjectSettings()
|
|||
Prj().GetProjectPath() );
|
||||
|
||||
if( !DS_DATA_MODEL::GetTheInstance().LoadDrawingSheet( filename ) )
|
||||
{
|
||||
ShowInfoBarError( _( "Error loading drawing sheet." ), true );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -116,16 +117,6 @@ void SCH_EDIT_FRAME::ShowSchematicSetupDialog( const wxString& aInitialPage )
|
|||
{
|
||||
Prj().GetProjectFile().NetSettings().ResolveNetClassAssignments( true );
|
||||
|
||||
EESCHEMA_SETTINGS* cfg = static_cast<EESCHEMA_SETTINGS*>( config() );
|
||||
SCHEMATIC_SETTINGS& settings = Schematic().Settings();
|
||||
|
||||
settings.m_JunctionSize =
|
||||
Prj().GetProjectFile().NetSettings().m_NetClasses.GetDefaultPtr()->GetWireWidth()
|
||||
* cfg->m_Drawing.junction_size_mult_list[ settings.m_JunctionSizeChoice ];
|
||||
|
||||
if( Schematic().Settings().m_JunctionSize < 1 )
|
||||
Schematic().Settings().m_JunctionSize = 1;
|
||||
|
||||
SaveProjectSettings();
|
||||
|
||||
Kiway().CommonSettingsChanged( false, true );
|
||||
|
@ -134,6 +125,18 @@ void SCH_EDIT_FRAME::ShowSchematicSetupDialog( const wxString& aInitialPage )
|
|||
}
|
||||
|
||||
|
||||
int SCH_EDIT_FRAME::GetSchematicJunctionSize()
|
||||
{
|
||||
std::vector<double>& sizeMultipliers = eeconfig()->m_Drawing.junction_size_mult_list;
|
||||
|
||||
NETCLASSPTR defaultNetclass = Prj().GetProjectFile().NetSettings().m_NetClasses.GetDefault();
|
||||
int sizeChoice = Schematic().Settings().m_JunctionSizeChoice;
|
||||
int junctionSize = defaultNetclass->GetWireWidth() * sizeMultipliers[ sizeChoice ];
|
||||
|
||||
return std::max( junctionSize, 1 );
|
||||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::SaveProjectSettings()
|
||||
{
|
||||
wxFileName fn = Schematic().RootScreen()->GetFileName(); //ConfigFileName
|
||||
|
|
|
@ -82,8 +82,7 @@ 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_base_frame_defaults( nullptr, "base_Frame_defaults" ),
|
||||
m_defaults( &m_base_frame_defaults )
|
||||
m_base_frame_defaults( nullptr, "base_Frame_defaults" )
|
||||
{
|
||||
createCanvas();
|
||||
|
||||
|
|
|
@ -110,11 +110,6 @@ public:
|
|||
|
||||
KIGFX::SCH_RENDER_SETTINGS* GetRenderSettings();
|
||||
|
||||
SCHEMATIC_SETTINGS& GetDefaults()
|
||||
{
|
||||
return *m_defaults;
|
||||
}
|
||||
|
||||
COLOR4D GetDrawBgColor() const override;
|
||||
|
||||
/**
|
||||
|
@ -258,9 +253,6 @@ protected:
|
|||
/// These are only used by symbol_editor. Eeschema should be using the one inside
|
||||
/// the SCHEMATIC.
|
||||
SCHEMATIC_SETTINGS m_base_frame_defaults;
|
||||
|
||||
SCHEMATIC_SETTINGS* m_defaults;
|
||||
|
||||
};
|
||||
|
||||
#endif // SCH_BASE_FRAME_H_
|
||||
|
|
|
@ -238,12 +238,9 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
|
||||
LoadSettings( eeconfig() );
|
||||
|
||||
// Also links the schematic to the loaded project
|
||||
// NB: also links the schematic to the loaded project
|
||||
CreateScreens();
|
||||
|
||||
// After schematic has been linked to project, SCHEMATIC_SETTINGS works
|
||||
m_defaults = &m_schematic->Settings();
|
||||
|
||||
setupTools();
|
||||
setupUIConditions();
|
||||
ReCreateMenuBar();
|
||||
|
@ -555,8 +552,6 @@ void SCH_EDIT_FRAME::CreateScreens()
|
|||
|
||||
m_schematic->SetRoot( new SCH_SHEET( m_schematic ) );
|
||||
|
||||
m_defaults = &m_schematic->Settings();
|
||||
|
||||
SCH_SCREEN* rootScreen = new SCH_SCREEN( m_schematic );
|
||||
m_schematic->Root().SetScreen( rootScreen );
|
||||
SetScreen( Schematic().RootScreen() );
|
||||
|
|
|
@ -801,6 +801,8 @@ public:
|
|||
|
||||
void FixupJunctions();
|
||||
|
||||
int GetSchematicJunctionSize();
|
||||
|
||||
void FocusOnItem( SCH_ITEM* aItem );
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#include <lib_symbol.h>
|
||||
#include <convert_to_biu.h>
|
||||
#include <default_values.h>
|
||||
#include <eda_text.h>
|
||||
#include <eeschema_settings.h>
|
||||
#include <kiface_i.h>
|
||||
#include <macros.h>
|
||||
|
@ -45,8 +44,8 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin
|
|||
m_LabelSizeRatio( DEFAULT_LABEL_SIZE_RATIO ),
|
||||
m_TextOffsetRatio( DEFAULT_TEXT_OFFSET_RATIO ),
|
||||
m_PinSymbolSize( DEFAULT_TEXT_SIZE * IU_PER_MILS / 2 ),
|
||||
m_JunctionSize( DEFAULT_JUNCTION_DIAM * IU_PER_MILS ),
|
||||
m_JunctionSizeChoice( 3 ),
|
||||
m_JunctionSize( DEFAULT_JUNCTION_DIAM * IU_PER_MILS ),
|
||||
m_AnnotateStartNum( 0 ),
|
||||
m_IntersheetRefsShow( false ),
|
||||
m_IntersheetRefsListOwnPage( true ),
|
||||
|
@ -124,9 +123,7 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin
|
|||
&m_PinSymbolSize, Mils2iu( defaultPinSymbolSize ), Mils2iu( 5 ), Mils2iu( 1000 ),
|
||||
1 / IU_PER_MILS ) );
|
||||
|
||||
m_params.emplace_back( new PARAM_SCALED<int>( "drawing.default_junction_size",
|
||||
&m_JunctionSize, Mils2iu( defaultJunctionSize ), Mils2iu( 5 ), Mils2iu( 1000 ),
|
||||
1 / IU_PER_MILS ) );
|
||||
// m_JunctionSize is only a run-time cache of the calculated size. Do not save it.
|
||||
|
||||
// User choice for junction dot size ( e.g. none = 0, smallest = 1, small = 2, etc )
|
||||
m_params.emplace_back( new PARAM<int>( "drawing.junction_size_choice",
|
||||
|
|
|
@ -51,9 +51,10 @@ public:
|
|||
double m_LabelSizeRatio;
|
||||
double m_TextOffsetRatio;
|
||||
int m_PinSymbolSize;
|
||||
int m_JunctionSize; // Size of junction dot in mils
|
||||
// User choice for junction dot size ( e.g. none = 0, smallest = 1, small = 2, etc )
|
||||
int m_JunctionSizeChoice;
|
||||
|
||||
int m_JunctionSizeChoice; // none = 0, smallest = 1, small = 2, etc.
|
||||
int m_JunctionSize; // a runtime cache of the calculated size
|
||||
|
||||
int m_AnnotateStartNum; // Starting value for annotation
|
||||
|
||||
bool m_IntersheetRefsShow;
|
||||
|
|
Loading…
Reference in New Issue