Flatten some settings and remove some more globals.
This commit is contained in:
parent
70fb5cac96
commit
d61b6f965e
|
@ -405,11 +405,12 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnAddField( wxCommandEvent& event )
|
|||
if( !m_grid->CommitPendingChanges() )
|
||||
return;
|
||||
|
||||
LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
|
||||
int fieldID = m_fields->size();
|
||||
LIB_FIELD newField( m_libEntry, fieldID );
|
||||
|
||||
newField.SetTextSize( wxSize( m_Parent->GetDefaultTextSize(),
|
||||
m_Parent->GetDefaultTextSize() ) );
|
||||
newField.SetTextSize( wxSize( Mils2iu( settings->m_Defaults.text_size ),
|
||||
Mils2iu( settings->m_Defaults.text_size ) ) );
|
||||
|
||||
m_fields->push_back( newField );
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include <pgm_base.h>
|
||||
|
||||
#include <widgets/wx_grid.h>
|
||||
|
||||
#include <settings/settings_manager.h>
|
||||
#include <ee_collectors.h>
|
||||
#include <class_library.h>
|
||||
#include <eeschema_settings.h>
|
||||
|
@ -230,7 +230,7 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataToWindow()
|
|||
|
||||
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnBrowseLibrary( wxCommandEvent& event )
|
||||
{
|
||||
SCH_BASE_FRAME::HISTORY_LIST dummy;
|
||||
std::vector<COMPONENT_SELECTION> dummy;
|
||||
|
||||
LIB_ID id;
|
||||
id.Parse( m_libraryNameTextCtrl->GetValue(), LIB_ID::ID_SCH );
|
||||
|
@ -562,14 +562,14 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnAddField( wxCommandEvent& event )
|
|||
if( !m_grid->CommitPendingChanges() )
|
||||
return;
|
||||
|
||||
SCHEMATIC_SETTINGS& settings = m_cmp->Schematic()->Settings();
|
||||
int fieldID = m_fields->size();
|
||||
SCH_FIELD newField( wxPoint( 0, 0 ), fieldID, m_cmp,
|
||||
TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldID ) );
|
||||
|
||||
newField.SetParent( m_cmp->GetParent() );
|
||||
newField.SetTextAngle( m_fields->at( REFERENCE ).GetTextAngle() );
|
||||
|
||||
newField.SetTextSize( wxSize( GetParent()->GetDefaultTextSize(),
|
||||
GetParent()->GetDefaultTextSize() ) );
|
||||
newField.SetTextSize( wxSize( settings.m_DefaultTextSize, settings.m_DefaultTextSize ) );
|
||||
|
||||
m_fields->push_back( newField );
|
||||
|
||||
|
|
|
@ -31,76 +31,18 @@
|
|||
#include <general.h>
|
||||
#include <gr_text.h>
|
||||
#include <confirm.h>
|
||||
#include <sch_text.h>
|
||||
#include <sch_component.h>
|
||||
#include <sch_reference_list.h>
|
||||
#include <schematic.h>
|
||||
#include <widgets/unit_binder.h>
|
||||
#include <dialog_edit_label_base.h>
|
||||
#include <dialog_edit_label.h>
|
||||
#include <kicad_string.h>
|
||||
#include <tool/actions.h>
|
||||
#include <html_messagebox.h>
|
||||
|
||||
class SCH_EDIT_FRAME;
|
||||
class SCH_TEXT;
|
||||
|
||||
|
||||
class DIALOG_LABEL_EDITOR : public DIALOG_LABEL_EDITOR_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_LABEL_EDITOR( SCH_EDIT_FRAME* parent, SCH_TEXT* aTextItem );
|
||||
~DIALOG_LABEL_EDITOR();
|
||||
|
||||
void SetTitle( const wxString& aTitle ) override
|
||||
{
|
||||
// This class is shared for numerous tasks: a couple of single line labels and
|
||||
// multi-line text fields. Since the desired size of the multi-line text field editor
|
||||
// is often larger, we retain separate sizes based on the dialog titles.
|
||||
switch( m_CurrentText->Type() )
|
||||
{
|
||||
case SCH_GLOBAL_LABEL_T:
|
||||
case SCH_HIER_LABEL_T:
|
||||
case SCH_LABEL_T:
|
||||
// labels can share retained settings probably.
|
||||
break;
|
||||
|
||||
default:
|
||||
m_hash_key = TO_UTF8( aTitle );
|
||||
m_hash_key += typeid(*this).name();
|
||||
}
|
||||
|
||||
DIALOG_LABEL_EDITOR_BASE::SetTitle( aTitle );
|
||||
}
|
||||
|
||||
private:
|
||||
void OnEnterKey( wxCommandEvent& aEvent ) override;
|
||||
void OnCharHook( wxKeyEvent& aEvent );
|
||||
void OnFormattingHelp( wxHyperlinkEvent& aEvent ) override;
|
||||
|
||||
bool TransferDataToWindow() override;
|
||||
bool TransferDataFromWindow() override;
|
||||
|
||||
wxString convertKIIDsToReferences( const wxString& aSource ) const;
|
||||
|
||||
wxString convertReferencesToKIIDs( const wxString& aSource ) const;
|
||||
|
||||
SCH_EDIT_FRAME* m_Parent;
|
||||
SCH_TEXT* m_CurrentText;
|
||||
wxWindow* m_activeTextCtrl;
|
||||
wxTextEntry* m_activeTextEntry;
|
||||
UNIT_BINDER m_textSize;
|
||||
SCH_NETNAME_VALIDATOR m_netNameValidator;
|
||||
};
|
||||
|
||||
|
||||
int InvokeDialogLabelEditor( SCH_EDIT_FRAME* aCaller, SCH_TEXT* aTextItem )
|
||||
{
|
||||
DIALOG_LABEL_EDITOR dialog( aCaller, aTextItem );
|
||||
|
||||
return dialog.ShowModal();
|
||||
}
|
||||
|
||||
|
||||
// Don't allow text to disappear; it can be difficult to correct if you can't select it
|
||||
const int MIN_TEXTSIZE = (int)( 0.01 * IU_PER_MM );
|
||||
const int MAX_TEXTSIZE = INT_MAX;
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#ifndef DIALOG_LABEL_EDITOR_H_
|
||||
#define DIALOG_LABEL_EDITOR_H_
|
||||
|
||||
#include <widgets/unit_binder.h>
|
||||
#include <sch_text.h>
|
||||
#include <sch_validators.h>
|
||||
#include <dialog_edit_label_base.h>
|
||||
|
||||
|
||||
class SCH_EDIT_FRAME;
|
||||
class SCH_TEXT;
|
||||
|
||||
|
||||
class DIALOG_LABEL_EDITOR : public DIALOG_LABEL_EDITOR_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_LABEL_EDITOR( SCH_EDIT_FRAME* parent, SCH_TEXT* aTextItem );
|
||||
~DIALOG_LABEL_EDITOR();
|
||||
|
||||
void SetTitle( const wxString& aTitle ) override
|
||||
{
|
||||
// This class is shared for numerous tasks: a couple of single line labels and
|
||||
// multi-line text fields. Since the desired size of the multi-line text field editor
|
||||
// is often larger, we retain separate sizes based on the dialog titles.
|
||||
switch( m_CurrentText->Type() )
|
||||
{
|
||||
case SCH_GLOBAL_LABEL_T:
|
||||
case SCH_HIER_LABEL_T:
|
||||
case SCH_LABEL_T:
|
||||
// labels can share retained settings probably.
|
||||
break;
|
||||
|
||||
default:
|
||||
m_hash_key = TO_UTF8( aTitle );
|
||||
m_hash_key += typeid(*this).name();
|
||||
}
|
||||
|
||||
DIALOG_LABEL_EDITOR_BASE::SetTitle( aTitle );
|
||||
}
|
||||
|
||||
private:
|
||||
void OnEnterKey( wxCommandEvent& aEvent ) override;
|
||||
void OnCharHook( wxKeyEvent& aEvent );
|
||||
void OnFormattingHelp( wxHyperlinkEvent& aEvent ) override;
|
||||
|
||||
bool TransferDataToWindow() override;
|
||||
bool TransferDataFromWindow() override;
|
||||
|
||||
wxString convertKIIDsToReferences( const wxString& aSource ) const;
|
||||
|
||||
wxString convertReferencesToKIIDs( const wxString& aSource ) const;
|
||||
|
||||
SCH_EDIT_FRAME* m_Parent;
|
||||
SCH_TEXT* m_CurrentText;
|
||||
wxWindow* m_activeTextCtrl;
|
||||
wxTextEntry* m_activeTextEntry;
|
||||
UNIT_BINDER m_textSize;
|
||||
SCH_NETNAME_VALIDATOR m_netNameValidator;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // DIALOG_LABEL_EDITOR_H_
|
|
@ -27,8 +27,11 @@
|
|||
#include <lib_edit_frame.h>
|
||||
#include <class_libentry.h>
|
||||
#include <lib_text.h>
|
||||
|
||||
#include <settings/settings_manager.h>
|
||||
#include <dialog_lib_edit_text.h>
|
||||
#include <libedit/libedit_settings.h>
|
||||
#include <pgm_base.h>
|
||||
#include <tools/lib_drawing_tools.h>
|
||||
|
||||
|
||||
DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT( LIB_EDIT_FRAME* aParent, LIB_TEXT* aText ) :
|
||||
|
@ -89,11 +92,14 @@ bool DIALOG_LIB_EDIT_TEXT::TransferDataToWindow()
|
|||
}
|
||||
else
|
||||
{
|
||||
m_textSize.SetValue( m_parent->GetDefaultTextSize() );
|
||||
LIBEDIT_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
|
||||
LIB_DRAWING_TOOLS* tools = m_parent->GetToolManager()->GetTool<LIB_DRAWING_TOOLS>();
|
||||
|
||||
m_CommonUnit->SetValue( !m_parent->m_DrawSpecificUnit );
|
||||
m_CommonConvert->SetValue( !m_parent->m_DrawSpecificConvert );
|
||||
m_orientChoice->SetSelection( m_parent->g_LastTextAngle == TEXT_ANGLE_HORIZ ? 0 : 1 );
|
||||
m_textSize.SetValue( Mils2iu( cfg->m_Defaults.text_size ) );
|
||||
|
||||
m_CommonUnit->SetValue( !tools->GetDrawSpecificUnit() );
|
||||
m_CommonConvert->SetValue( !tools->GetDrawSpecificConvert() );
|
||||
m_orientChoice->SetSelection( tools->GetLastTextAngle() == TEXT_ANGLE_HORIZ ? 0 : 1 );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -102,11 +108,6 @@ bool DIALOG_LIB_EDIT_TEXT::TransferDataToWindow()
|
|||
|
||||
bool DIALOG_LIB_EDIT_TEXT::TransferDataFromWindow()
|
||||
{
|
||||
m_parent->g_LastTextAngle = m_orientChoice->GetSelection() ? TEXT_ANGLE_VERT
|
||||
: TEXT_ANGLE_HORIZ;
|
||||
m_parent->m_DrawSpecificConvert = !m_CommonConvert->GetValue();
|
||||
m_parent->m_DrawSpecificUnit = !m_CommonUnit->GetValue();
|
||||
|
||||
if( m_graphicText )
|
||||
{
|
||||
if( m_TextValue->GetValue().IsEmpty() )
|
||||
|
@ -116,14 +117,16 @@ bool DIALOG_LIB_EDIT_TEXT::TransferDataFromWindow()
|
|||
|
||||
m_graphicText->SetPosition( wxPoint( m_posX.GetValue(), m_posY.GetValue() ) );
|
||||
m_graphicText->SetTextSize( wxSize( m_textSize.GetValue(), m_textSize.GetValue() ) );
|
||||
m_graphicText->SetTextAngle( m_parent->g_LastTextAngle );
|
||||
|
||||
if( m_parent->m_DrawSpecificUnit )
|
||||
m_graphicText->SetTextAngle( m_orientChoice->GetSelection() ? TEXT_ANGLE_VERT
|
||||
: TEXT_ANGLE_HORIZ );
|
||||
|
||||
if( !m_CommonUnit->GetValue() )
|
||||
m_graphicText->SetUnit( m_parent->GetUnit() );
|
||||
else
|
||||
m_graphicText->SetUnit( 0 );
|
||||
|
||||
if( m_parent->m_DrawSpecificConvert )
|
||||
if( !m_CommonConvert->GetValue() )
|
||||
m_graphicText->SetConvert( m_parent->GetConvert() );
|
||||
else
|
||||
m_graphicText->SetConvert( 0 );
|
||||
|
@ -144,6 +147,12 @@ bool DIALOG_LIB_EDIT_TEXT::TransferDataFromWindow()
|
|||
case 1: m_graphicText->SetVertJustify( GR_TEXT_VJUSTIFY_CENTER ); break;
|
||||
case 2: m_graphicText->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM ); break;
|
||||
}
|
||||
|
||||
// Record settings used for next time:
|
||||
LIB_DRAWING_TOOLS* tools = m_parent->GetToolManager()->GetTool<LIB_DRAWING_TOOLS>();
|
||||
tools->SetLastTextAngle( m_graphicText->GetTextAngle() );
|
||||
tools->SetDrawSpecificConvert( !m_CommonConvert->GetValue() );
|
||||
tools->SetDrawSpecificUnit( !m_CommonUnit->GetValue() );
|
||||
}
|
||||
|
||||
m_parent->SetMsgPanel( m_graphicText );
|
||||
|
|
|
@ -116,11 +116,11 @@ void DIALOG_PLOT_SCHEMATIC::initDlg()
|
|||
|
||||
if( fmt == PLOT_FORMAT::DXF || fmt == PLOT_FORMAT::HPGL )
|
||||
m_plotBackgroundColor->Disable();
|
||||
}
|
||||
|
||||
// Set the default line width (pen width which should be used for
|
||||
// items that do not have a pen size defined (like frame ref)
|
||||
m_defaultLineWidth.SetValue( m_parent->GetDefaultLineWidth() );
|
||||
m_defaultLineWidth.SetValue( cfg->m_Drawing.default_line_thickness );
|
||||
}
|
||||
|
||||
// Initialize HPGL specific widgets
|
||||
m_penWidth.SetValue( m_HPGLPenSize );
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
PANEL_EESCHEMA_SETTINGS::PANEL_EESCHEMA_SETTINGS( SCH_EDIT_FRAME* aFrame, wxWindow* aWindow ) :
|
||||
PANEL_EESCHEMA_SETTINGS_BASE( aWindow ),
|
||||
m_frame( aFrame ),
|
||||
m_defaultTextSize( aFrame, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits, true ),
|
||||
m_hPitch( aFrame, m_hPitchLabel, m_hPitchCtrl, m_hPitchUnits, true ),
|
||||
m_vPitch( aFrame, m_vPitchLabel, m_vPitchCtrl, m_vPitchUnits, true )
|
||||
{}
|
||||
|
@ -47,7 +46,6 @@ bool PANEL_EESCHEMA_SETTINGS::TransferDataToWindow()
|
|||
|
||||
m_choiceUnits->SetSelection( m_frame->GetUserUnits() == EDA_UNITS::INCHES ? 0 : 1 );
|
||||
|
||||
m_defaultTextSize.SetValue( m_frame->GetDefaultTextSize() );
|
||||
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 );
|
||||
|
@ -83,8 +81,6 @@ bool PANEL_EESCHEMA_SETTINGS::TransferDataFromWindow()
|
|||
m_frame->SetUserUnits( m_choiceUnits->GetSelection() == 0 ? EDA_UNITS::INCHES
|
||||
: EDA_UNITS::MILLIMETRES );
|
||||
|
||||
m_frame->SetDefaultTextSize( (int) m_defaultTextSize.GetValue() );
|
||||
|
||||
cfg->m_Drawing.default_sheet_border_color = m_borderColorSwatch->GetSwatchColor();
|
||||
cfg->m_Drawing.default_sheet_background_color = m_backgroundColorSwatch->GetSwatchColor();
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ class PANEL_EESCHEMA_SETTINGS : public PANEL_EESCHEMA_SETTINGS_BASE
|
|||
{
|
||||
SCH_EDIT_FRAME* m_frame;
|
||||
|
||||
UNIT_BINDER m_defaultTextSize;
|
||||
UNIT_BINDER m_hPitch;
|
||||
UNIT_BINDER m_vPitch;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jul 10 2019)
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -55,23 +55,6 @@ PANEL_EESCHEMA_SETTINGS_BASE::PANEL_EESCHEMA_SETTINGS_BASE( wxWindow* parent, wx
|
|||
wxStaticBoxSizer* sbSizer5;
|
||||
sbSizer5 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Defaults for New Objects") ), wxVERTICAL );
|
||||
|
||||
wxBoxSizer* bSizer5;
|
||||
bSizer5 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_textSizeLabel = new wxStaticText( sbSizer5->GetStaticBox(), wxID_ANY, _("Schematic text size:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_textSizeLabel->Wrap( -1 );
|
||||
bSizer5->Add( m_textSizeLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_textSizeCtrl = new wxTextCtrl( sbSizer5->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP );
|
||||
bSizer5->Add( m_textSizeCtrl, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_textSizeUnits = new wxStaticText( sbSizer5->GetStaticBox(), wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_textSizeUnits->Wrap( -1 );
|
||||
bSizer5->Add( m_textSizeUnits, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
sbSizer5->Add( bSizer5, 0, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSizer6;
|
||||
bSizer6 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
|
@ -96,7 +79,7 @@ PANEL_EESCHEMA_SETTINGS_BASE::PANEL_EESCHEMA_SETTINGS_BASE( wxWindow* parent, wx
|
|||
bSizer6->Add( m_backgroundColorSwatch, 1, wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
|
||||
|
||||
|
||||
sbSizer5->Add( bSizer6, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||
sbSizer5->Add( bSizer6, 0, wxEXPAND|wxBOTTOM, 5 );
|
||||
|
||||
|
||||
bLeftColumn->Add( sbSizer5, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||
|
@ -104,7 +87,7 @@ PANEL_EESCHEMA_SETTINGS_BASE::PANEL_EESCHEMA_SETTINGS_BASE( wxWindow* parent, wx
|
|||
wxStaticBoxSizer* sbSizerPinSel;
|
||||
sbSizerPinSel = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Selection") ), wxVERTICAL );
|
||||
|
||||
m_cbPinSelectionOpt = new wxCheckBox( sbSizerPinSel->GetStaticBox(), wxID_ANY, _("Select a pin select the symbol"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_cbPinSelectionOpt = new wxCheckBox( sbSizerPinSel->GetStaticBox(), wxID_ANY, _("Clicking on a pin selects the symbol"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_cbPinSelectionOpt->SetToolTip( _("In schematic editor:\nIf enabled, clicking on a pin select the parent symbol.\nIf disabled, clicking on a pin select only the pin.") );
|
||||
|
||||
sbSizerPinSel->Add( m_cbPinSelectionOpt, 0, wxALL, 5 );
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
<property name="file">panel_eeschema_settings_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="image_path_wrapper_function_name"></property>
|
||||
<property name="indent_with_spaces"></property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">PanelEeschemaSettingsBase</property>
|
||||
|
@ -26,7 +25,6 @@
|
|||
<property name="skip_php_events">1</property>
|
||||
<property name="skip_python_events">1</property>
|
||||
<property name="ui_table">UI</property>
|
||||
<property name="use_array_enum">0</property>
|
||||
<property name="use_enum">1</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Panel" expanded="1">
|
||||
|
@ -361,204 +359,7 @@
|
|||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizer5</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Schematic text size:</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_textSizeLabel</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxTextCtrl" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="maxlength"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_textSizeCtrl</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style">wxSP_ARROW_KEYS|wxSP_WRAP</property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="value"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">mils</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_textSizeUnits</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
|
||||
<property name="flag">wxEXPAND|wxBOTTOM</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
|
@ -860,7 +661,7 @@
|
|||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Select a pin select the symbol</property>
|
||||
<property name="label">Clicking on a pin selects the symbol</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jul 10 2019)
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -44,9 +44,6 @@ class PANEL_EESCHEMA_SETTINGS_BASE : public wxPanel
|
|||
wxChoice* m_choiceUnits;
|
||||
wxCheckBox* m_checkHVOrientation;
|
||||
wxCheckBox* m_mouseDragIsDrag;
|
||||
wxStaticText* m_textSizeLabel;
|
||||
wxTextCtrl* m_textSizeCtrl;
|
||||
wxStaticText* m_textSizeUnits;
|
||||
wxStaticText* m_borderColorLabel;
|
||||
COLOR_SWATCH* m_borderColorSwatch;
|
||||
wxStaticText* m_backgroundColorLabel;
|
||||
|
|
|
@ -49,8 +49,8 @@ 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_lineWidth.SetValue( Mils2iu( settings->m_Defaults.line_width ) );
|
||||
m_textSize.SetValue( Mils2iu( settings->m_Defaults.text_size ) );
|
||||
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 ) );
|
||||
|
@ -69,8 +69,8 @@ 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() );
|
||||
settings->m_Defaults.line_width = Iu2Mils( (int) m_lineWidth.GetValue() );
|
||||
settings->m_Defaults.text_size = Iu2Mils( (int) m_textSize.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() );
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <panel_setup_formatting.h>
|
||||
#include <sch_junction.h>
|
||||
#include <gr_text.h>
|
||||
#include <schematic.h>
|
||||
#include <schematic_settings.h>
|
||||
|
||||
|
||||
|
@ -46,6 +47,8 @@ PANEL_SETUP_FORMATTING::PANEL_SETUP_FORMATTING( wxWindow* aWindow, SCH_EDIT_FRAM
|
|||
|
||||
bool PANEL_SETUP_FORMATTING::TransferDataToWindow()
|
||||
{
|
||||
SCHEMATIC_SETTINGS& settings = m_frame->Schematic().Settings();
|
||||
|
||||
// Reference style one of: "A" ".A" "-A" "_A" ".1" "-1" "_1"
|
||||
int refStyleSelection;
|
||||
|
||||
|
@ -67,14 +70,14 @@ bool PANEL_SETUP_FORMATTING::TransferDataToWindow()
|
|||
m_pinSymbolSize.SetUnits( EDA_UNITS::INCHES, true );
|
||||
m_junctionSize.SetUnits( EDA_UNITS::INCHES, true );
|
||||
|
||||
m_textSize.SetValue( m_frame->GetDefaultTextSize() );
|
||||
m_lineWidth.SetValue( m_frame->GetDefaultLineWidth() );
|
||||
m_busWidth.SetValue( m_frame->GetDefaultBusThickness() );
|
||||
m_wireWidth.SetValue( m_frame->GetDefaultWireThickness() );
|
||||
m_pinSymbolSize.SetValue( m_frame->GetPinSymbolSize() );
|
||||
m_junctionSize.SetValue( m_frame->GetDefaults().m_JunctionSize );
|
||||
m_textSize.SetValue( settings.m_DefaultTextSize );
|
||||
m_lineWidth.SetValue( settings.m_DefaultLineWidth );
|
||||
m_busWidth.SetValue( settings.m_DefaultBusThickness );
|
||||
m_wireWidth.SetValue( settings.m_DefaultWireThickness );
|
||||
m_pinSymbolSize.SetValue( settings.m_PinSymbolSize );
|
||||
m_junctionSize.SetValue( settings.m_JunctionSize );
|
||||
|
||||
wxString offsetRatio = wxString::Format( "%f", m_frame->GetTextOffsetRatio() * 100.0 );
|
||||
wxString offsetRatio = wxString::Format( "%f", settings.m_TextOffsetRatio * 100.0 );
|
||||
m_textOffsetRatioCtrl->SetValue( offsetRatio );
|
||||
|
||||
return true;
|
||||
|
@ -83,6 +86,8 @@ bool PANEL_SETUP_FORMATTING::TransferDataToWindow()
|
|||
|
||||
bool PANEL_SETUP_FORMATTING::TransferDataFromWindow()
|
||||
{
|
||||
SCHEMATIC_SETTINGS& settings = m_frame->Schematic().Settings();
|
||||
|
||||
// Reference style one of: "A" ".A" "-A" "_A" ".1" "-1" "_1"
|
||||
int firstRefId, refSeparator;
|
||||
|
||||
|
@ -104,27 +109,26 @@ bool PANEL_SETUP_FORMATTING::TransferDataFromWindow()
|
|||
LIB_PART::SetSubpartIdNotation( refSeparator, firstRefId );
|
||||
}
|
||||
|
||||
m_frame->SetDefaultTextSize( (int) m_textSize.GetValue() );
|
||||
m_frame->SetDefaultLineWidth( (int) m_lineWidth.GetValue() );
|
||||
m_frame->SetDefaultWireThickness( (int) m_wireWidth.GetValue() );
|
||||
m_frame->SetDefaultBusThickness( (int) m_busWidth.GetValue() );
|
||||
m_frame->SetPinSymbolSize( (int) m_pinSymbolSize.GetValue() );
|
||||
|
||||
m_frame->GetDefaults().m_JunctionSize = (int) m_junctionSize.GetValue();
|
||||
settings.m_DefaultTextSize = (int) m_textSize.GetValue();
|
||||
settings.m_DefaultLineWidth = (int) m_lineWidth.GetValue();
|
||||
settings.m_DefaultWireThickness = (int) m_wireWidth.GetValue();
|
||||
settings.m_DefaultBusThickness = (int) m_busWidth.GetValue();
|
||||
settings.m_PinSymbolSize = (int) m_pinSymbolSize.GetValue();
|
||||
settings.m_JunctionSize = (int) m_junctionSize.GetValue();
|
||||
|
||||
m_frame->SaveProjectSettings();
|
||||
|
||||
double dtmp = 0.0;
|
||||
wxString msg = m_textOffsetRatioCtrl->GetValue();
|
||||
msg.ToDouble( &dtmp );
|
||||
m_frame->SetTextOffsetRatio( dtmp / 100.0 );
|
||||
settings.m_TextOffsetRatio = dtmp / 100.0;
|
||||
|
||||
m_frame->GetRenderSettings()->SetDefaultPenWidth( m_frame->GetDefaultLineWidth() );
|
||||
m_frame->GetRenderSettings()->m_DefaultWireThickness = m_frame->GetDefaultWireThickness();
|
||||
m_frame->GetRenderSettings()->m_DefaultBusThickness = m_frame->GetDefaultBusThickness();
|
||||
m_frame->GetRenderSettings()->m_TextOffsetRatio = m_frame->GetTextOffsetRatio();
|
||||
m_frame->GetRenderSettings()->m_PinSymbolSize = m_frame->GetPinSymbolSize();
|
||||
m_frame->GetRenderSettings()->m_JunctionSize = m_frame->GetDefaults().m_JunctionSize;
|
||||
m_frame->GetRenderSettings()->SetDefaultPenWidth( settings.m_DefaultLineWidth );
|
||||
m_frame->GetRenderSettings()->m_DefaultWireThickness = settings.m_DefaultWireThickness;
|
||||
m_frame->GetRenderSettings()->m_DefaultBusThickness = settings.m_DefaultBusThickness;
|
||||
m_frame->GetRenderSettings()->m_TextOffsetRatio = settings.m_TextOffsetRatio;
|
||||
m_frame->GetRenderSettings()->m_PinSymbolSize = settings.m_PinSymbolSize;
|
||||
m_frame->GetRenderSettings()->m_JunctionSize = settings.m_JunctionSize;
|
||||
|
||||
m_frame->GetCanvas()->GetView()->MarkDirty();
|
||||
m_frame->GetCanvas()->GetView()->UpdateAllItems( KIGFX::REPAINT );
|
||||
|
|
|
@ -39,154 +39,6 @@
|
|||
|
||||
#include "invoke_sch_dialog.h"
|
||||
|
||||
static PINSHEETLABEL_SHAPE lastGlobalLabelShape = PINSHEETLABEL_SHAPE::PS_INPUT;
|
||||
static LABEL_SPIN_STYLE lastTextOrientation = LABEL_SPIN_STYLE::LEFT;
|
||||
static bool lastTextBold = false;
|
||||
static bool lastTextItalic = false;
|
||||
|
||||
static std::deque<std::unique_ptr<SCH_TEXT>> s_queuedTexts;
|
||||
|
||||
SCH_TEXT* SCH_EDIT_FRAME::GetNextNewText()
|
||||
{
|
||||
if( s_queuedTexts.empty() )
|
||||
return nullptr;
|
||||
|
||||
auto next_text = std::move( s_queuedTexts.front() );
|
||||
s_queuedTexts.pop_front();
|
||||
|
||||
return next_text.release();
|
||||
}
|
||||
|
||||
|
||||
SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( int aType )
|
||||
{
|
||||
wxPoint cursorPos = (wxPoint) GetCanvas()->GetViewControls()->GetCursorPosition();
|
||||
SCH_TEXT* textItem = nullptr;
|
||||
|
||||
s_queuedTexts.clear();
|
||||
|
||||
switch( aType )
|
||||
{
|
||||
case LAYER_NOTES:
|
||||
textItem = new SCH_TEXT( cursorPos );
|
||||
break;
|
||||
|
||||
case LAYER_LOCLABEL:
|
||||
textItem = new SCH_LABEL( cursorPos );
|
||||
break;
|
||||
|
||||
case LAYER_HIERLABEL:
|
||||
textItem = new SCH_HIERLABEL( cursorPos );
|
||||
textItem->SetShape( lastGlobalLabelShape );
|
||||
break;
|
||||
|
||||
case LAYER_GLOBLABEL:
|
||||
textItem = new SCH_GLOBALLABEL( cursorPos );
|
||||
textItem->SetShape( lastGlobalLabelShape );
|
||||
break;
|
||||
|
||||
default:
|
||||
DisplayError( this, wxT( "SCH_EDIT_FRAME::CreateNewText() Internal error" ) );
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
textItem->SetBold( lastTextBold );
|
||||
textItem->SetItalic( lastTextItalic );
|
||||
textItem->SetLabelSpinStyle( lastTextOrientation );
|
||||
textItem->SetTextSize( wxSize( GetDefaultTextSize(), GetDefaultTextSize() ) );
|
||||
textItem->SetFlags( IS_NEW | IS_MOVED );
|
||||
|
||||
if( InvokeDialogLabelEditor( this, textItem ) != wxID_OK || textItem->GetText().IsEmpty() )
|
||||
{
|
||||
delete textItem;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if( aType != LAYER_NOTES )
|
||||
{
|
||||
UTF8 text( textItem->GetText() );
|
||||
int brace_count = 0;
|
||||
int bracket_count = 0;
|
||||
bool last_space = false;
|
||||
UTF8 token;
|
||||
|
||||
for( auto chIt = text.ubegin(); chIt != text.uend(); chIt++ )
|
||||
{
|
||||
switch( *chIt )
|
||||
{
|
||||
case '{':
|
||||
brace_count++;
|
||||
last_space = false;
|
||||
break;
|
||||
|
||||
case '[':
|
||||
bracket_count++;
|
||||
last_space = false;
|
||||
break;
|
||||
|
||||
case '}':
|
||||
brace_count = std::max( 0, brace_count - 1 );
|
||||
last_space = false;
|
||||
break;
|
||||
|
||||
case ']':
|
||||
bracket_count = std::max( 0, bracket_count - 1 );
|
||||
last_space = false;
|
||||
break;
|
||||
|
||||
case ' ':
|
||||
case '\n':
|
||||
case '\r':
|
||||
case '\t':
|
||||
if( !token.empty() && bracket_count == 0 && brace_count == 0 )
|
||||
{
|
||||
std::unique_ptr<SCH_TEXT> nextitem( static_cast<SCH_TEXT*>( textItem->Clone() ) );
|
||||
nextitem->SetText( token.wx_str() );
|
||||
s_queuedTexts.push_back( std::move( nextitem ) );
|
||||
token.clear();
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip leading whitespace
|
||||
if( token.empty() || last_space )
|
||||
continue;
|
||||
|
||||
last_space = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
last_space = false;
|
||||
break;
|
||||
}
|
||||
|
||||
token += *chIt;
|
||||
}
|
||||
|
||||
if( !token.empty() )
|
||||
{
|
||||
std::unique_ptr<SCH_TEXT> nextitem( static_cast<SCH_TEXT*>( textItem->Clone() ) );
|
||||
nextitem->SetText( token.wx_str() );
|
||||
s_queuedTexts.push_back( std::move( nextitem ) );
|
||||
}
|
||||
|
||||
delete textItem;
|
||||
textItem = GetNextNewText();
|
||||
|
||||
if( !textItem )
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
lastTextBold = textItem->IsBold();
|
||||
lastTextItalic = textItem->IsItalic();
|
||||
lastTextOrientation = textItem->GetLabelSpinStyle();
|
||||
|
||||
if( textItem->Type() == SCH_GLOBAL_LABEL_T || textItem->Type() == SCH_HIER_LABEL_T )
|
||||
lastGlobalLabelShape = textItem->GetShape();
|
||||
|
||||
return textItem;
|
||||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* aText, KICAD_T aNewType )
|
||||
{
|
||||
KICAD_T oldType = aText->Type();
|
||||
|
|
|
@ -322,9 +322,9 @@ bool SCH_EDIT_FRAME::LoadProjectFile()
|
|||
bool ret = Prj().ConfigLoad( Kiface().KifaceSearch(), GROUP_SCH_EDIT,
|
||||
GetProjectFileParameters() );
|
||||
|
||||
GetRenderSettings()->SetDefaultPenWidth( GetDefaultLineWidth() );
|
||||
GetRenderSettings()->m_DefaultWireThickness = GetDefaultWireThickness();
|
||||
GetRenderSettings()->m_DefaultBusThickness = GetDefaultBusThickness();
|
||||
GetRenderSettings()->SetDefaultPenWidth( m_defaults->m_DefaultLineWidth );
|
||||
GetRenderSettings()->m_DefaultWireThickness = m_defaults->m_DefaultWireThickness;
|
||||
GetRenderSettings()->m_DefaultBusThickness = m_defaults->m_DefaultBusThickness;
|
||||
GetRenderSettings()->m_TextOffsetRatio = m_defaults->m_TextOffsetRatio;
|
||||
GetRenderSettings()->m_PinSymbolSize = m_defaults->m_PinSymbolSize;
|
||||
GetRenderSettings()->m_JunctionSize = m_defaults->m_JunctionSize;
|
||||
|
|
|
@ -106,11 +106,6 @@ int InvokeDialogNetList( SCH_EDIT_FRAME* aCaller );
|
|||
*/
|
||||
bool InvokeDialogEditComponentsLibId( SCH_EDIT_FRAME* aCaller );
|
||||
|
||||
/**
|
||||
* Launches the "Edit Text/Label" dialog
|
||||
* @return the ShowModal() result (wxID_OK, wxID_CANCEL, etc.)
|
||||
*/
|
||||
int InvokeDialogLabelEditor( SCH_EDIT_FRAME* aCaller, SCH_TEXT* aText );
|
||||
|
||||
|
||||
#endif // INVOKE_SCH_DIALOG_H_
|
||||
|
|
|
@ -66,10 +66,6 @@
|
|||
|
||||
|
||||
bool LIB_EDIT_FRAME:: m_showDeMorgan = false;
|
||||
double LIB_EDIT_FRAME:: g_LastTextAngle = TEXT_ANGLE_HORIZ;
|
||||
|
||||
FILL_T LIB_EDIT_FRAME:: g_LastFillStyle = NO_FILL;
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
|
||||
EVT_CLOSE( LIB_EDIT_FRAME::OnCloseWindow )
|
||||
|
@ -98,8 +94,6 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
m_unitSelectBox( nullptr )
|
||||
{
|
||||
SetShowDeMorgan( false );
|
||||
m_DrawSpecificConvert = true;
|
||||
m_DrawSpecificUnit = false;
|
||||
m_SyncPinEdit = false;
|
||||
|
||||
m_my_part = nullptr;
|
||||
|
@ -225,9 +219,6 @@ void LIB_EDIT_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
|||
|
||||
SCH_BASE_FRAME::LoadSettings( GetSettings() );
|
||||
|
||||
SetDefaultLineWidth( Mils2iu( m_settings->m_Defaults.line_width ) );
|
||||
SetDefaultTextSize( Mils2iu( m_settings->m_Defaults.text_size ) );
|
||||
|
||||
GetRenderSettings()->m_ShowPinsElectricalType = m_settings->m_ShowPinElectricalType;
|
||||
|
||||
// Hidden elements must be editable
|
||||
|
@ -243,8 +234,6 @@ void LIB_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
|||
|
||||
SCH_BASE_FRAME::SaveSettings( GetSettings() );
|
||||
|
||||
m_settings->m_Defaults.line_width = Iu2Mils( GetDefaultLineWidth() );
|
||||
m_settings->m_Defaults.text_size = Iu2Mils( GetDefaultTextSize() );
|
||||
m_settings->m_ShowPinElectricalType = GetRenderSettings()->m_ShowPinsElectricalType;
|
||||
m_settings->m_LibWidth = m_treePane->GetSize().x;
|
||||
}
|
||||
|
|
|
@ -91,20 +91,6 @@ public:
|
|||
*/
|
||||
bool m_SyncPinEdit;
|
||||
|
||||
/** Convert of the item currently being drawn. */
|
||||
bool m_DrawSpecificConvert;
|
||||
|
||||
/**
|
||||
* Specify which component parts the current draw item applies to.
|
||||
*
|
||||
* If true, the item being drawn or edited applies only to the selected part. Otherwise
|
||||
* it applies to all parts in the component.
|
||||
*/
|
||||
bool m_DrawSpecificUnit;
|
||||
|
||||
static double g_LastTextAngle;
|
||||
static FILL_T g_LastFillStyle;
|
||||
|
||||
public:
|
||||
LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <confirm.h>
|
||||
#include <gestfich.h>
|
||||
#include <tools/ee_actions.h>
|
||||
#include <tools/lib_drawing_tools.h>
|
||||
#include <lib_edit_frame.h>
|
||||
#include <class_libentry.h>
|
||||
#include <class_library.h>
|
||||
|
@ -776,7 +777,8 @@ void LIB_EDIT_FRAME::LoadPart( const wxString& aAlias, const wxString& aLibrary,
|
|||
// Optimize default edit options for this symbol
|
||||
// Usually if units are locked, graphic items are specific to each unit
|
||||
// and if units are interchangeable, graphic items are common to units
|
||||
m_DrawSpecificUnit = part->UnitsLocked();
|
||||
LIB_DRAWING_TOOLS* tools = GetToolManager()->GetTool<LIB_DRAWING_TOOLS>();
|
||||
tools->SetDrawSpecificUnit( part->UnitsLocked() );
|
||||
|
||||
LoadOneLibraryPartAux( part, aLibrary, aUnit, 0 );
|
||||
}
|
||||
|
|
|
@ -105,18 +105,6 @@ SCH_SCREEN* SCH_BASE_FRAME::GetScreen() const
|
|||
}
|
||||
|
||||
|
||||
void SCH_BASE_FRAME::SetScreen( BASE_SCREEN* aScreen )
|
||||
{
|
||||
EDA_DRAW_FRAME::SetScreen( aScreen );
|
||||
|
||||
if( m_toolManager )
|
||||
{
|
||||
m_toolManager->SetEnvironment( aScreen, GetCanvas()->GetView(),
|
||||
GetCanvas()->GetViewControls(), this );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
EESCHEMA_SETTINGS* SCH_BASE_FRAME::eeconfig() const
|
||||
{
|
||||
return dynamic_cast<EESCHEMA_SETTINGS*>( config() );
|
||||
|
@ -135,34 +123,6 @@ const wxString SCH_BASE_FRAME::GetZoomLevelIndicator() const
|
|||
}
|
||||
|
||||
|
||||
void SCH_BASE_FRAME::SetDefaultLineWidth( int aWidth )
|
||||
{
|
||||
m_defaults->m_DefaultLineWidth = aWidth;
|
||||
GetRenderSettings()->SetDefaultPenWidth( aWidth );
|
||||
}
|
||||
|
||||
|
||||
void SCH_BASE_FRAME::SetDefaultWireThickness( int aThickness )
|
||||
{
|
||||
m_defaults->m_DefaultWireThickness = aThickness;
|
||||
GetRenderSettings()->m_DefaultWireThickness = aThickness;
|
||||
}
|
||||
|
||||
|
||||
void SCH_BASE_FRAME::SetDefaultBusThickness( int aThickness )
|
||||
{
|
||||
m_defaults->m_DefaultBusThickness = aThickness;
|
||||
GetRenderSettings()->m_DefaultBusThickness = aThickness;
|
||||
}
|
||||
|
||||
|
||||
void SCH_BASE_FRAME::SetPinSymbolSize( int aSize )
|
||||
{
|
||||
m_defaults->m_PinSymbolSize = aSize;
|
||||
GetRenderSettings()->m_PinSymbolSize = aSize;
|
||||
}
|
||||
|
||||
|
||||
void SCH_BASE_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
|
||||
{
|
||||
GetScreen()->SetPageSettings( aPageSettings );
|
||||
|
|
|
@ -110,7 +110,6 @@ public:
|
|||
|
||||
SCH_DRAW_PANEL* GetCanvas() const override;
|
||||
SCH_SCREEN* GetScreen() const override;
|
||||
void SetScreen( BASE_SCREEN* aScreen ) override;
|
||||
|
||||
EESCHEMA_SETTINGS* eeconfig() const;
|
||||
|
||||
|
@ -131,24 +130,6 @@ public:
|
|||
*/
|
||||
virtual bool GetShowAllPins() const { return true; }
|
||||
|
||||
virtual int GetDefaultLineWidth() const { return m_defaults->m_DefaultLineWidth; }
|
||||
virtual void SetDefaultLineWidth( int aWidth );
|
||||
|
||||
virtual int GetDefaultWireThickness() const { return m_defaults->m_DefaultWireThickness; }
|
||||
virtual void SetDefaultWireThickness( int aThickness );
|
||||
|
||||
virtual int GetDefaultBusThickness() const { return m_defaults->m_DefaultBusThickness; }
|
||||
virtual void SetDefaultBusThickness( int aThickness );
|
||||
|
||||
virtual int GetPinSymbolSize() const { return m_defaults->m_PinSymbolSize; }
|
||||
virtual void SetPinSymbolSize( int aSize );
|
||||
|
||||
virtual int GetDefaultTextSize() const { return m_defaults->m_DefaultTextSize; }
|
||||
virtual void SetDefaultTextSize( int aSize ) { m_defaults->m_DefaultTextSize = aSize; }
|
||||
|
||||
virtual double GetTextOffsetRatio() const { return m_defaults->m_TextOffsetRatio; }
|
||||
virtual void SetTextOffsetRatio( double aRatio ) { m_defaults->m_TextOffsetRatio = aRatio; }
|
||||
|
||||
/**
|
||||
* Function GetZoomLevelIndicator
|
||||
* returns a human readable value which can be displayed as zoom
|
||||
|
@ -178,8 +159,6 @@ public:
|
|||
|
||||
void UpdateStatusBar() override;
|
||||
|
||||
typedef std::vector<COMPONENT_SELECTION> HISTORY_LIST;
|
||||
|
||||
/**
|
||||
* Function SelectComponentFromLib
|
||||
* Calls the library viewer to select component to import into schematic.
|
||||
|
|
|
@ -320,7 +320,7 @@ void SCH_EDIT_FRAME::setupTools()
|
|||
{
|
||||
// Create the manager and dispatcher & route draw panel events to the dispatcher
|
||||
m_toolManager = new TOOL_MANAGER;
|
||||
m_toolManager->SetEnvironment( GetScreen(), GetCanvas()->GetView(),
|
||||
m_toolManager->SetEnvironment( &Schematic(), GetCanvas()->GetView(),
|
||||
GetCanvas()->GetViewControls(), this );
|
||||
m_actions = new EE_ACTIONS();
|
||||
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
|
||||
|
|
|
@ -608,14 +608,6 @@ public:
|
|||
SCH_JUNCTION* AddJunction( const wxPoint& aPos, bool aAppendToUndo = false,
|
||||
bool aFinal = true );
|
||||
|
||||
/**
|
||||
* Gets the next queued text item
|
||||
* @return next SCH_TEXT* or nullptr if empty
|
||||
*/
|
||||
SCH_TEXT* GetNextNewText();
|
||||
|
||||
SCH_TEXT* CreateNewText( int aType );
|
||||
|
||||
/**
|
||||
* Performs routine schematic cleaning including breaking wire and buses and deleting
|
||||
* identical objects superimposed on top of each other.
|
||||
|
|
|
@ -500,6 +500,7 @@ PINSHEETLABEL_SHAPE SCH_EDIT_FRAME::m_lastSheetPinType = PINSHEETLABEL_SHAPE::PS
|
|||
|
||||
SCH_SHEET_PIN* SCH_EDIT_FRAME::CreateSheetPin( SCH_SHEET* aSheet, SCH_HIERLABEL* aLabel )
|
||||
{
|
||||
SCHEMATIC_SETTINGS& settings = aSheet->Schematic()->Settings();
|
||||
wxString text;
|
||||
SCH_SHEET_PIN* sheetPin;
|
||||
|
||||
|
@ -511,7 +512,7 @@ SCH_SHEET_PIN* SCH_EDIT_FRAME::CreateSheetPin( SCH_SHEET* aSheet, SCH_HIERLABEL*
|
|||
|
||||
sheetPin = new SCH_SHEET_PIN( aSheet, wxPoint( 0, 0 ), text );
|
||||
sheetPin->SetFlags( IS_NEW );
|
||||
sheetPin->SetTextSize( wxSize( GetDefaultTextSize(), GetDefaultTextSize() ) );
|
||||
sheetPin->SetTextSize( wxSize( settings.m_DefaultTextSize, settings.m_DefaultTextSize ) );
|
||||
sheetPin->SetShape( m_lastSheetPinType );
|
||||
|
||||
if( !aLabel )
|
||||
|
|
|
@ -32,8 +32,6 @@
|
|||
class TOOL_EVENT;
|
||||
class TOOL_MANAGER;
|
||||
|
||||
extern char g_lastBusEntryShape;
|
||||
|
||||
/**
|
||||
* EESCHEMA_ACTIONS
|
||||
*
|
||||
|
|
|
@ -37,13 +37,20 @@
|
|||
#include <lib_circle.h>
|
||||
#include <lib_polyline.h>
|
||||
#include <lib_rectangle.h>
|
||||
#include <pgm_base.h>
|
||||
#include <libedit/libedit_settings.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include "ee_point_editor.h"
|
||||
|
||||
static void* g_lastPinWeakPtr;
|
||||
|
||||
|
||||
LIB_DRAWING_TOOLS::LIB_DRAWING_TOOLS() :
|
||||
EE_TOOL_BASE<LIB_EDIT_FRAME>( "eeschema.SymbolDrawing" )
|
||||
EE_TOOL_BASE<LIB_EDIT_FRAME>( "eeschema.SymbolDrawing" ),
|
||||
m_lastTextAngle( 0.0 ),
|
||||
m_lastFillStyle( NO_FILL ),
|
||||
m_drawSpecificConvert( true ),
|
||||
m_drawSpecificUnit( false )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -66,6 +73,7 @@ bool LIB_DRAWING_TOOLS::Init()
|
|||
int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
KICAD_T type = aEvent.Parameter<KICAD_T>();
|
||||
LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
|
||||
LIB_PIN_TOOL* pinTool = type == LIB_PIN_T ? m_toolMgr->GetTool<LIB_PIN_TOOL>() : nullptr;
|
||||
VECTOR2I cursorPos;
|
||||
EDA_ITEM* item = nullptr;
|
||||
|
@ -144,10 +152,11 @@ int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
case LIB_TEXT_T:
|
||||
{
|
||||
LIB_TEXT* text = new LIB_TEXT( part );
|
||||
|
||||
text->SetPosition( wxPoint( cursorPos.x, -cursorPos.y ) );
|
||||
text->SetTextSize( wxSize( m_frame->GetDefaultTextSize(),
|
||||
m_frame->GetDefaultTextSize() ) );
|
||||
text->SetTextAngle( m_frame->g_LastTextAngle );
|
||||
text->SetTextSize( wxSize( Mils2iu( settings->m_Defaults.text_size ),
|
||||
Mils2iu( settings->m_Defaults.text_size ) ) );
|
||||
text->SetTextAngle( m_lastTextAngle );
|
||||
|
||||
DIALOG_LIB_EDIT_TEXT dlg( m_frame, text );
|
||||
|
||||
|
@ -231,6 +240,7 @@ int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
|
||||
int LIB_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings<LIBEDIT_SETTINGS>();
|
||||
KICAD_T type = aEvent.Parameter<KICAD_T>();
|
||||
EE_POINT_EDITOR* pointEditor = m_toolMgr->GetTool<EE_POINT_EDITOR>();
|
||||
|
||||
|
@ -317,15 +327,15 @@ int LIB_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent )
|
|||
|
||||
wxASSERT( item );
|
||||
|
||||
item->SetWidth( m_frame->GetDefaultLineWidth() );
|
||||
item->SetFillMode( LIB_EDIT_FRAME::g_LastFillStyle );
|
||||
item->SetWidth( settings->m_Defaults.line_width );
|
||||
item->SetFillMode( m_lastFillStyle );
|
||||
item->SetFlags( IS_NEW );
|
||||
item->BeginEdit( wxPoint( cursorPos.x, -cursorPos.y ) );
|
||||
|
||||
if( m_frame->m_DrawSpecificUnit )
|
||||
if( m_drawSpecificUnit )
|
||||
item->SetUnit( m_frame->GetUnit() );
|
||||
|
||||
if( m_frame->m_DrawSpecificConvert )
|
||||
if( m_drawSpecificConvert )
|
||||
item->SetConvert( m_frame->GetConvert() );
|
||||
|
||||
m_selectionTool->AddItemToSel( item );
|
||||
|
|
|
@ -52,12 +52,26 @@ public:
|
|||
|
||||
int RepeatDrawItem( const TOOL_EVENT& aEvent );
|
||||
|
||||
private:
|
||||
void SetLastTextAngle( double aAngle ) { m_lastTextAngle = aAngle; }
|
||||
double GetLastTextAngle() const { return m_lastTextAngle; }
|
||||
|
||||
void SetDrawSpecificConvert( bool aSpecific ) { m_drawSpecificConvert = aSpecific; }
|
||||
bool GetDrawSpecificConvert() const { return m_drawSpecificConvert; }
|
||||
|
||||
void SetDrawSpecificUnit( bool aSpecific ) { m_drawSpecificUnit = aSpecific; }
|
||||
bool GetDrawSpecificUnit() const { return m_drawSpecificUnit; }
|
||||
|
||||
private:
|
||||
int doTwoClickPlace( KICAD_T aType, bool aImmediateMode );
|
||||
|
||||
///> Sets up handlers for various events.
|
||||
void setTransitions() override;
|
||||
|
||||
private:
|
||||
double m_lastTextAngle;
|
||||
FILL_T m_lastFillStyle;
|
||||
bool m_drawSpecificConvert;
|
||||
bool m_drawSpecificUnit;
|
||||
};
|
||||
|
||||
#endif /* LIB_DRAWING_TOOLS_H */
|
||||
|
|
|
@ -442,8 +442,9 @@ void LIB_EDIT_TOOL::editGraphicProperties( LIB_ITEM* aItem )
|
|||
m_frame->GetCanvas()->Refresh();
|
||||
m_frame->OnModify( );
|
||||
|
||||
m_frame->m_DrawSpecificConvert = !dialog.GetApplyToAllConversions();
|
||||
m_frame->m_DrawSpecificUnit = !dialog.GetApplyToAllUnits();
|
||||
LIB_DRAWING_TOOLS* drawingTools = m_toolMgr->GetTool<LIB_DRAWING_TOOLS>();
|
||||
drawingTools->SetDrawSpecificConvert( !dialog.GetApplyToAllConversions() );
|
||||
drawingTools->SetDrawSpecificUnit( !dialog.GetApplyToAllUnits() );
|
||||
|
||||
MSG_PANEL_ITEMS items;
|
||||
aItem->GetMsgPanelInfo( m_frame, items );
|
||||
|
@ -539,12 +540,15 @@ void LIB_EDIT_TOOL::editSymbolProperties()
|
|||
// to the best value
|
||||
if( partLocked != part->UnitsLocked() )
|
||||
{
|
||||
LIB_DRAWING_TOOLS* tools = m_toolMgr->GetTool<LIB_DRAWING_TOOLS>();
|
||||
|
||||
// Enable synchronized pin edit mode for symbols with interchangeable units
|
||||
m_frame->m_SyncPinEdit = !part->UnitsLocked();
|
||||
|
||||
// also set default edit options to the better value
|
||||
// Usually if units are locked, graphic items are specific to each unit
|
||||
// and if units are interchangeable, graphic items are common to units
|
||||
m_frame->m_DrawSpecificUnit = part->UnitsLocked();
|
||||
tools->SetDrawSpecificUnit( part->UnitsLocked() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,6 @@
|
|||
#include "ee_point_editor.h"
|
||||
#include <ee_actions.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include <sch_view.h>
|
||||
#include <class_draw_panel_gal.h>
|
||||
#include <project.h>
|
||||
#include <id.h>
|
||||
#include <eeschema_id.h>
|
||||
|
@ -46,9 +44,15 @@
|
|||
#include <schematic.h>
|
||||
#include <class_library.h>
|
||||
#include <eeschema_settings.h>
|
||||
#include <dialogs/dialog_edit_label.h>
|
||||
|
||||
SCH_DRAWING_TOOLS::SCH_DRAWING_TOOLS() :
|
||||
EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.InteractiveDrawing" )
|
||||
EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.InteractiveDrawing" ),
|
||||
m_lastBusEntryShape( '/' ),
|
||||
m_lastGlobalLabelShape( PINSHEETLABEL_SHAPE::PS_INPUT ),
|
||||
m_lastTextOrientation( LABEL_SPIN_STYLE::LEFT ),
|
||||
m_lastTextBold( false ),
|
||||
m_lastTextItalic( false )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -70,22 +74,17 @@ bool SCH_DRAWING_TOOLS::Init()
|
|||
}
|
||||
|
||||
|
||||
// History lists for PlaceComponent()
|
||||
static SCH_BASE_FRAME::HISTORY_LIST s_SymbolHistoryList;
|
||||
static SCH_BASE_FRAME::HISTORY_LIST s_PowerHistoryList;
|
||||
|
||||
|
||||
int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
SCH_COMPONENT* component = aEvent.Parameter<SCH_COMPONENT*>();
|
||||
SCHLIB_FILTER filter;
|
||||
SCH_BASE_FRAME::HISTORY_LIST* historyList = nullptr;
|
||||
std::vector<COMPONENT_SELECTION>* historyList = nullptr;
|
||||
|
||||
if( aEvent.IsAction( &EE_ACTIONS::placeSymbol ) )
|
||||
historyList = &s_SymbolHistoryList;
|
||||
historyList = &m_symbolHistoryList;
|
||||
else if (aEvent.IsAction( &EE_ACTIONS::placePower ) )
|
||||
{
|
||||
historyList = &s_PowerHistoryList;
|
||||
historyList = &m_powerHistoryList;
|
||||
filter.FilterPowerParts( true );
|
||||
}
|
||||
else
|
||||
|
@ -463,10 +462,10 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
|
|||
previewItem = new SCH_JUNCTION( cursorPos );
|
||||
break;
|
||||
case SCH_BUS_WIRE_ENTRY_T:
|
||||
previewItem = new SCH_BUS_WIRE_ENTRY( cursorPos, g_lastBusEntryShape );
|
||||
previewItem = new SCH_BUS_WIRE_ENTRY( cursorPos, m_lastBusEntryShape );
|
||||
break;
|
||||
case SCH_BUS_BUS_ENTRY_T:
|
||||
previewItem = new SCH_BUS_BUS_ENTRY( cursorPos, g_lastBusEntryShape );
|
||||
previewItem = new SCH_BUS_BUS_ENTRY( cursorPos, m_lastBusEntryShape );
|
||||
break;
|
||||
default:
|
||||
wxASSERT_MSG( false, "Unknown item type in SCH_DRAWING_TOOLS::SingleClickPlace" );
|
||||
|
@ -553,9 +552,9 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
// Update the shape of the bus entry
|
||||
if( evt->IsAction( &EE_ACTIONS::toShapeSlash ) )
|
||||
g_lastBusEntryShape = '/';
|
||||
m_lastBusEntryShape = '/';
|
||||
else if( evt->IsAction( &EE_ACTIONS::toShapeBackslash ) )
|
||||
g_lastBusEntryShape = '\\';
|
||||
m_lastBusEntryShape = '\\';
|
||||
|
||||
SCH_BUS_ENTRY_BASE* busItem = static_cast<SCH_BUS_ENTRY_BASE*>( previewItem );
|
||||
|
||||
|
@ -569,7 +568,7 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
|
|||
busItem->MirrorY( busItem->GetPosition().y );
|
||||
else if( evt->IsAction( &EE_ACTIONS::toShapeBackslash )
|
||||
|| evt->IsAction( &EE_ACTIONS::toShapeSlash ) )
|
||||
busItem->SetBusEntryShape( g_lastBusEntryShape );
|
||||
busItem->SetBusEntryShape( m_lastBusEntryShape );
|
||||
|
||||
m_view->ClearPreview();
|
||||
m_view->AddToPreview( previewItem->Clone() );
|
||||
|
@ -586,6 +585,153 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
// History lists for placing labels and text
|
||||
|
||||
SCH_TEXT* SCH_DRAWING_TOOLS::getNextNewText()
|
||||
{
|
||||
if( m_queuedTexts.empty() )
|
||||
return nullptr;
|
||||
|
||||
auto next_text = std::move( m_queuedTexts.front() );
|
||||
m_queuedTexts.pop_front();
|
||||
|
||||
return next_text.release();
|
||||
}
|
||||
|
||||
|
||||
SCH_TEXT* SCH_DRAWING_TOOLS::createNewText( const VECTOR2I& aPosition, int aType )
|
||||
{
|
||||
SCHEMATIC* schematic = getModel<SCHEMATIC>();
|
||||
SCHEMATIC_SETTINGS& settings = schematic->Settings();
|
||||
SCH_TEXT* textItem = nullptr;
|
||||
|
||||
m_queuedTexts.clear();
|
||||
|
||||
switch( aType )
|
||||
{
|
||||
case LAYER_NOTES:
|
||||
textItem = new SCH_TEXT( (wxPoint) aPosition );
|
||||
break;
|
||||
|
||||
case LAYER_LOCLABEL:
|
||||
textItem = new SCH_LABEL( (wxPoint) aPosition );
|
||||
break;
|
||||
|
||||
case LAYER_HIERLABEL:
|
||||
textItem = new SCH_HIERLABEL( (wxPoint) aPosition );
|
||||
textItem->SetShape( m_lastGlobalLabelShape );
|
||||
break;
|
||||
|
||||
case LAYER_GLOBLABEL:
|
||||
textItem = new SCH_GLOBALLABEL( (wxPoint) aPosition );
|
||||
textItem->SetShape( m_lastGlobalLabelShape );
|
||||
break;
|
||||
|
||||
default:
|
||||
DisplayError( m_frame, wxT( "SCH_EDIT_FRAME::CreateNewText() Internal error" ) );
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
textItem->SetParent( schematic );
|
||||
textItem->SetBold( m_lastTextBold );
|
||||
textItem->SetItalic( m_lastTextItalic );
|
||||
textItem->SetLabelSpinStyle( m_lastTextOrientation );
|
||||
textItem->SetTextSize( wxSize( settings.m_DefaultTextSize, settings.m_DefaultTextSize ) );
|
||||
textItem->SetFlags( IS_NEW | IS_MOVED );
|
||||
|
||||
DIALOG_LABEL_EDITOR dlg( m_frame, textItem );
|
||||
|
||||
if( dlg.ShowModal() != wxID_OK || textItem->GetText().IsEmpty() )
|
||||
{
|
||||
delete textItem;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if( aType != LAYER_NOTES )
|
||||
{
|
||||
UTF8 text( textItem->GetText() );
|
||||
int brace_count = 0;
|
||||
int bracket_count = 0;
|
||||
bool last_space = false;
|
||||
UTF8 token;
|
||||
|
||||
for( auto chIt = text.ubegin(); chIt != text.uend(); chIt++ )
|
||||
{
|
||||
switch( *chIt )
|
||||
{
|
||||
case '{':
|
||||
brace_count++;
|
||||
last_space = false;
|
||||
break;
|
||||
|
||||
case '[':
|
||||
bracket_count++;
|
||||
last_space = false;
|
||||
break;
|
||||
|
||||
case '}':
|
||||
brace_count = std::max( 0, brace_count - 1 );
|
||||
last_space = false;
|
||||
break;
|
||||
|
||||
case ']':
|
||||
bracket_count = std::max( 0, bracket_count - 1 );
|
||||
last_space = false;
|
||||
break;
|
||||
|
||||
case ' ':
|
||||
case '\n':
|
||||
case '\r':
|
||||
case '\t':
|
||||
if( !token.empty() && bracket_count == 0 && brace_count == 0 )
|
||||
{
|
||||
std::unique_ptr<SCH_TEXT> nextitem( static_cast<SCH_TEXT*>( textItem->Clone() ) );
|
||||
nextitem->SetText( token.wx_str() );
|
||||
m_queuedTexts.push_back( std::move( nextitem ) );
|
||||
token.clear();
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip leading whitespace
|
||||
if( token.empty() || last_space )
|
||||
continue;
|
||||
|
||||
last_space = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
last_space = false;
|
||||
break;
|
||||
}
|
||||
|
||||
token += *chIt;
|
||||
}
|
||||
|
||||
if( !token.empty() )
|
||||
{
|
||||
std::unique_ptr<SCH_TEXT> nextitem( static_cast<SCH_TEXT*>( textItem->Clone() ) );
|
||||
nextitem->SetText( token.wx_str() );
|
||||
m_queuedTexts.push_back( std::move( nextitem ) );
|
||||
}
|
||||
|
||||
delete textItem;
|
||||
textItem = getNextNewText();
|
||||
|
||||
if( !textItem )
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
m_lastTextBold = textItem->IsBold();
|
||||
m_lastTextItalic = textItem->IsItalic();
|
||||
m_lastTextOrientation = textItem->GetLabelSpinStyle();
|
||||
|
||||
if( textItem->Type() == SCH_GLOBAL_LABEL_T || textItem->Type() == SCH_HIER_LABEL_T )
|
||||
m_lastGlobalLabelShape = textItem->GetShape();
|
||||
|
||||
return textItem;
|
||||
}
|
||||
|
||||
|
||||
int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
EDA_ITEM* item = nullptr;
|
||||
|
@ -656,16 +802,16 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
switch( type )
|
||||
{
|
||||
case SCH_LABEL_T:
|
||||
item = m_frame->CreateNewText( LAYER_LOCLABEL );
|
||||
item = createNewText( cursorPos, LAYER_LOCLABEL );
|
||||
break;
|
||||
case SCH_HIER_LABEL_T:
|
||||
item = m_frame->CreateNewText( LAYER_HIERLABEL );
|
||||
item = createNewText( cursorPos, LAYER_HIERLABEL );
|
||||
break;
|
||||
case SCH_GLOBAL_LABEL_T:
|
||||
item = m_frame->CreateNewText( LAYER_GLOBLABEL );
|
||||
item = createNewText( cursorPos, LAYER_GLOBLABEL );
|
||||
break;
|
||||
case SCH_TEXT_T:
|
||||
item = m_frame->CreateNewText( LAYER_NOTES );
|
||||
item = createNewText( cursorPos, LAYER_NOTES );
|
||||
break;
|
||||
case SCH_SHEET_PIN_T:
|
||||
{
|
||||
|
@ -721,7 +867,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
item->ClearFlags( IS_MOVED );
|
||||
m_frame->AddItemToScreenAndUndoList( (SCH_ITEM*) item );
|
||||
item = m_frame->GetNextNewText();
|
||||
item = getNextNewText();
|
||||
|
||||
if( item )
|
||||
{
|
||||
|
@ -849,7 +995,7 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
|
|||
m_frame->GetCurrentSheet().Last(), static_cast<wxPoint>( cursorPos ) );
|
||||
sheet->SetFlags( IS_NEW | IS_RESIZED );
|
||||
sheet->SetScreen( NULL );
|
||||
sheet->SetBorderWidth( m_frame->GetDefaultLineWidth() );
|
||||
sheet->SetBorderWidth( cfg->m_Drawing.default_line_thickness );
|
||||
sheet->SetBorderColor( cfg->m_Drawing.default_sheet_border_color );
|
||||
sheet->SetBackgroundColor( cfg->m_Drawing.default_sheet_background_color );
|
||||
sizeSheet( sheet, cursorPos );
|
||||
|
|
|
@ -58,7 +58,16 @@ public:
|
|||
int DrawSheet( const TOOL_EVENT& aEvent );
|
||||
int PlaceImage( const TOOL_EVENT& aEvent );
|
||||
|
||||
void SetLastBusEntryShape( char aShape ) { m_lastBusEntryShape = aShape; }
|
||||
|
||||
private:
|
||||
/**
|
||||
* Gets the next queued text item
|
||||
* @return next SCH_TEXT* or nullptr if empty
|
||||
*/
|
||||
SCH_TEXT* getNextNewText();
|
||||
|
||||
SCH_TEXT* createNewText( const VECTOR2I& aPosition, int aType );
|
||||
|
||||
void sizeSheet( SCH_SHEET* aSheet, VECTOR2I aPos );
|
||||
|
||||
|
@ -66,6 +75,19 @@ private:
|
|||
void setTransitions() override;
|
||||
|
||||
private:
|
||||
// History lists for PlaceComponent()
|
||||
std::vector<COMPONENT_SELECTION> m_symbolHistoryList;
|
||||
std::vector<COMPONENT_SELECTION> m_powerHistoryList;
|
||||
|
||||
char m_lastBusEntryShape;
|
||||
|
||||
PINSHEETLABEL_SHAPE m_lastGlobalLabelShape;
|
||||
LABEL_SPIN_STYLE m_lastTextOrientation;
|
||||
bool m_lastTextBold;
|
||||
bool m_lastTextItalic;
|
||||
|
||||
std::deque<std::unique_ptr<SCH_TEXT>> m_queuedTexts;
|
||||
|
||||
std::unique_ptr<STATUS_TEXT_POPUP> m_statusPopup;
|
||||
};
|
||||
|
||||
|
|
|
@ -56,9 +56,7 @@
|
|||
#include <pgm_base.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <libedit_settings.h>
|
||||
|
||||
char g_lastBusEntryShape = '/';
|
||||
|
||||
#include <dialogs/dialog_edit_label.h>
|
||||
|
||||
class SYMBOL_UNIT_MENU : public ACTION_MENU
|
||||
{
|
||||
|
@ -1351,12 +1349,15 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
|||
case SCH_LABEL_T:
|
||||
case SCH_GLOBAL_LABEL_T:
|
||||
case SCH_HIER_LABEL_T:
|
||||
if( InvokeDialogLabelEditor( m_frame, (SCH_TEXT*) item ) == wxID_OK )
|
||||
{
|
||||
DIALOG_LABEL_EDITOR dlg( m_frame, (SCH_TEXT*) item );
|
||||
|
||||
if( dlg.ShowModal() == wxID_OK )
|
||||
{
|
||||
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
|
||||
m_frame->OnModify();
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case SCH_FIELD_T:
|
||||
|
@ -1450,7 +1451,8 @@ int SCH_EDIT_TOOL::ChangeShape( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
}
|
||||
|
||||
g_lastBusEntryShape = shape;
|
||||
SCH_DRAWING_TOOLS* drawingTool = m_toolMgr->GetTool<SCH_DRAWING_TOOLS>();
|
||||
drawingTool->SetLastBusEntryShape( shape );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -369,17 +369,17 @@ int SCH_LINE_WIRE_BUS_TOOL::UnfoldBus( const TOOL_EVENT& aEvent )
|
|||
|
||||
SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet )
|
||||
{
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
SCHEMATIC_SETTINGS& cfg = getModel<SCHEMATIC>()->Settings();
|
||||
wxPoint pos = (wxPoint) getViewControls()->GetCursorPosition();
|
||||
|
||||
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
|
||||
|
||||
m_busUnfold.entry = new SCH_BUS_WIRE_ENTRY( pos, '\\' );
|
||||
m_busUnfold.entry->SetParent( m_frame->GetScreen() );
|
||||
m_frame->AddToScreen( m_busUnfold.entry );
|
||||
|
||||
m_busUnfold.label = new SCH_LABEL( m_busUnfold.entry->m_End(), aNet );
|
||||
m_busUnfold.label->SetTextSize( wxSize( m_frame->GetDefaultTextSize(),
|
||||
m_frame->GetDefaultTextSize() ) );
|
||||
m_busUnfold.label->SetTextSize( wxSize( cfg.m_DefaultTextSize, cfg.m_DefaultTextSize ) );
|
||||
m_busUnfold.label->SetLabelSpinStyle( LABEL_SPIN_STYLE::RIGHT );
|
||||
m_busUnfold.label->SetParent( m_frame->GetScreen() );
|
||||
m_busUnfold.label->SetFlags( IS_NEW | IS_MOVED );
|
||||
|
|
Loading…
Reference in New Issue