From d61b6f965e56668d7063348f004d4d17b2954b0f Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 23 May 2020 16:50:08 +0100 Subject: [PATCH] Flatten some settings and remove some more globals. --- .../dialogs/dialog_edit_component_in_lib.cpp | 9 +- .../dialog_edit_component_in_schematic.cpp | 16 +- eeschema/dialogs/dialog_edit_label.cpp | 60 +----- eeschema/dialogs/dialog_edit_label.h | 86 ++++++++ eeschema/dialogs/dialog_lib_edit_text.cpp | 35 +-- eeschema/dialogs/dialog_plot_schematic.cpp | 8 +- eeschema/dialogs/panel_eeschema_settings.cpp | 4 - eeschema/dialogs/panel_eeschema_settings.h | 1 - .../dialogs/panel_eeschema_settings_base.cpp | 23 +- .../dialogs/panel_eeschema_settings_base.fbp | 203 +----------------- .../dialogs/panel_eeschema_settings_base.h | 5 +- eeschema/dialogs/panel_libedit_settings.cpp | 8 +- eeschema/dialogs/panel_setup_formatting.cpp | 46 ++-- eeschema/edit_label.cpp | 148 ------------- eeschema/eeschema_config.cpp | 6 +- eeschema/invoke_sch_dialog.h | 5 - eeschema/libedit/lib_edit_frame.cpp | 13 +- eeschema/libedit/lib_edit_frame.h | 14 -- eeschema/libedit/libedit.cpp | 4 +- eeschema/sch_base_frame.cpp | 40 ---- eeschema/sch_base_frame.h | 21 -- eeschema/sch_edit_frame.cpp | 2 +- eeschema/sch_edit_frame.h | 8 - eeschema/sheet.cpp | 7 +- eeschema/tools/ee_actions.h | 2 - eeschema/tools/lib_drawing_tools.cpp | 38 ++-- eeschema/tools/lib_drawing_tools.h | 16 +- eeschema/tools/lib_edit_tool.cpp | 10 +- eeschema/tools/sch_drawing_tools.cpp | 194 ++++++++++++++--- eeschema/tools/sch_drawing_tools.h | 24 ++- eeschema/tools/sch_edit_tool.cpp | 14 +- eeschema/tools/sch_line_wire_bus_tool.cpp | 8 +- 32 files changed, 424 insertions(+), 654 deletions(-) create mode 100644 eeschema/dialogs/dialog_edit_label.h diff --git a/eeschema/dialogs/dialog_edit_component_in_lib.cpp b/eeschema/dialogs/dialog_edit_component_in_lib.cpp index ed44681ba3..b887031da7 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_lib.cpp @@ -405,11 +405,12 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnAddField( wxCommandEvent& event ) if( !m_grid->CommitPendingChanges() ) return; - int fieldID = m_fields->size(); - LIB_FIELD newField( m_libEntry, fieldID ); + LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings(); + 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 ); diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp index e11d61f20c..a6c6cde656 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp @@ -31,7 +31,7 @@ #include #include - +#include #include #include #include @@ -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 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; - int fieldID = m_fields->size(); - SCH_FIELD newField( wxPoint( 0, 0 ), fieldID, m_cmp, - TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldID ) ); + 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 ); diff --git a/eeschema/dialogs/dialog_edit_label.cpp b/eeschema/dialogs/dialog_edit_label.cpp index 29ad36367d..2ff90d58d6 100644 --- a/eeschema/dialogs/dialog_edit_label.cpp +++ b/eeschema/dialogs/dialog_edit_label.cpp @@ -31,76 +31,18 @@ #include #include #include -#include #include #include #include #include -#include +#include #include #include -#include 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; diff --git a/eeschema/dialogs/dialog_edit_label.h b/eeschema/dialogs/dialog_edit_label.h new file mode 100644 index 0000000000..18d183dfc7 --- /dev/null +++ b/eeschema/dialogs/dialog_edit_label.h @@ -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 +#include +#include +#include + + +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_ diff --git a/eeschema/dialogs/dialog_lib_edit_text.cpp b/eeschema/dialogs/dialog_lib_edit_text.cpp index d4b98875e1..9cc7fada7d 100644 --- a/eeschema/dialogs/dialog_lib_edit_text.cpp +++ b/eeschema/dialogs/dialog_lib_edit_text.cpp @@ -27,8 +27,11 @@ #include #include #include - +#include #include +#include +#include +#include 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(); + LIB_DRAWING_TOOLS* tools = m_parent->GetToolManager()->GetTool(); - 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(); + tools->SetLastTextAngle( m_graphicText->GetTextAngle() ); + tools->SetDrawSpecificConvert( !m_CommonConvert->GetValue() ); + tools->SetDrawSpecificUnit( !m_CommonUnit->GetValue() ); } m_parent->SetMsgPanel( m_graphicText ); diff --git a/eeschema/dialogs/dialog_plot_schematic.cpp b/eeschema/dialogs/dialog_plot_schematic.cpp index f98bde6d91..83f1003d71 100644 --- a/eeschema/dialogs/dialog_plot_schematic.cpp +++ b/eeschema/dialogs/dialog_plot_schematic.cpp @@ -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() ); + // 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( cfg->m_Drawing.default_line_thickness ); + } // Initialize HPGL specific widgets m_penWidth.SetValue( m_HPGLPenSize ); diff --git a/eeschema/dialogs/panel_eeschema_settings.cpp b/eeschema/dialogs/panel_eeschema_settings.cpp index 6ab90af781..d29af18f02 100644 --- a/eeschema/dialogs/panel_eeschema_settings.cpp +++ b/eeschema/dialogs/panel_eeschema_settings.cpp @@ -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(); diff --git a/eeschema/dialogs/panel_eeschema_settings.h b/eeschema/dialogs/panel_eeschema_settings.h index 7593287e2f..bf0e160256 100644 --- a/eeschema/dialogs/panel_eeschema_settings.h +++ b/eeschema/dialogs/panel_eeschema_settings.h @@ -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; diff --git a/eeschema/dialogs/panel_eeschema_settings_base.cpp b/eeschema/dialogs/panel_eeschema_settings_base.cpp index 3ccaa0153b..976fc6c904 100644 --- a/eeschema/dialogs/panel_eeschema_settings_base.cpp +++ b/eeschema/dialogs/panel_eeschema_settings_base.cpp @@ -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 ); diff --git a/eeschema/dialogs/panel_eeschema_settings_base.fbp b/eeschema/dialogs/panel_eeschema_settings_base.fbp index 1ed440205e..885d26ba74 100644 --- a/eeschema/dialogs/panel_eeschema_settings_base.fbp +++ b/eeschema/dialogs/panel_eeschema_settings_base.fbp @@ -14,7 +14,6 @@ panel_eeschema_settings_base 1000 none - 1 PanelEeschemaSettingsBase @@ -26,7 +25,6 @@ 1 1 UI - 0 1 0 @@ -361,204 +359,7 @@ none 5 - wxEXPAND - 0 - - - bSizer5 - wxHORIZONTAL - none - - 5 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Schematic text size: - 0 - - 0 - - - 0 - - 1 - m_textSizeLabel - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxALL - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - - 1 - m_textSizeCtrl - 1 - - - protected - 1 - - Resizable - 1 - - wxSP_ARROW_KEYS|wxSP_WRAP - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - mils - 0 - - 0 - - - 0 - - 1 - m_textSizeUnits - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - 5 - wxEXPAND|wxTOP|wxBOTTOM + wxEXPAND|wxBOTTOM 0 @@ -860,7 +661,7 @@ 0 0 wxID_ANY - Select a pin select the symbol + Clicking on a pin selects the symbol 0 diff --git a/eeschema/dialogs/panel_eeschema_settings_base.h b/eeschema/dialogs/panel_eeschema_settings_base.h index 7f5e0a3968..9d758d3054 100644 --- a/eeschema/dialogs/panel_eeschema_settings_base.h +++ b/eeschema/dialogs/panel_eeschema_settings_base.h @@ -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; diff --git a/eeschema/dialogs/panel_libedit_settings.cpp b/eeschema/dialogs/panel_libedit_settings.cpp index 2e771c8a85..d9860b5121 100644 --- a/eeschema/dialogs/panel_libedit_settings.cpp +++ b/eeschema/dialogs/panel_libedit_settings.cpp @@ -49,8 +49,8 @@ bool PANEL_LIBEDIT_SETTINGS::TransferDataToWindow() { LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings(); - 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(); - 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() ); diff --git a/eeschema/dialogs/panel_setup_formatting.cpp b/eeschema/dialogs/panel_setup_formatting.cpp index f64ef64d9c..322c334d3e 100644 --- a/eeschema/dialogs/panel_setup_formatting.cpp +++ b/eeschema/dialogs/panel_setup_formatting.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -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 ); diff --git a/eeschema/edit_label.cpp b/eeschema/edit_label.cpp index 343321d5dc..81505b350e 100644 --- a/eeschema/edit_label.cpp +++ b/eeschema/edit_label.cpp @@ -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> 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 nextitem( static_cast( 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 nextitem( static_cast( 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(); diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index 6422741f61..325e87af92 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -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; diff --git a/eeschema/invoke_sch_dialog.h b/eeschema/invoke_sch_dialog.h index 5b34c4d82c..2113f1a157 100644 --- a/eeschema/invoke_sch_dialog.h +++ b/eeschema/invoke_sch_dialog.h @@ -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_ diff --git a/eeschema/libedit/lib_edit_frame.cpp b/eeschema/libedit/lib_edit_frame.cpp index e0fcf86042..2290e4d0b8 100644 --- a/eeschema/libedit/lib_edit_frame.cpp +++ b/eeschema/libedit/lib_edit_frame.cpp @@ -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,9 +94,7 @@ 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_SyncPinEdit = false; m_my_part = nullptr; m_treePane = 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; } diff --git a/eeschema/libedit/lib_edit_frame.h b/eeschema/libedit/lib_edit_frame.h index 7d9ef57a52..8b4c568378 100644 --- a/eeschema/libedit/lib_edit_frame.h +++ b/eeschema/libedit/lib_edit_frame.h @@ -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 ); diff --git a/eeschema/libedit/libedit.cpp b/eeschema/libedit/libedit.cpp index 50bb012723..bac9973c66 100644 --- a/eeschema/libedit/libedit.cpp +++ b/eeschema/libedit/libedit.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -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(); + tools->SetDrawSpecificUnit( part->UnitsLocked() ); LoadOneLibraryPartAux( part, aLibrary, aUnit, 0 ); } diff --git a/eeschema/sch_base_frame.cpp b/eeschema/sch_base_frame.cpp index e0639652d5..1756cf2348 100644 --- a/eeschema/sch_base_frame.cpp +++ b/eeschema/sch_base_frame.cpp @@ -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( 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 ); diff --git a/eeschema/sch_base_frame.h b/eeschema/sch_base_frame.h index a1ae3f2b4f..5edf3ced8c 100644 --- a/eeschema/sch_base_frame.h +++ b/eeschema/sch_base_frame.h @@ -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 HISTORY_LIST; - /** * Function SelectComponentFromLib * Calls the library viewer to select component to import into schematic. diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 3ed7f3574a..69027fad46 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -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 ); diff --git a/eeschema/sch_edit_frame.h b/eeschema/sch_edit_frame.h index 0a8c81b986..969c32a752 100644 --- a/eeschema/sch_edit_frame.h +++ b/eeschema/sch_edit_frame.h @@ -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. diff --git a/eeschema/sheet.cpp b/eeschema/sheet.cpp index 967f84e6e3..a594b8a576 100644 --- a/eeschema/sheet.cpp +++ b/eeschema/sheet.cpp @@ -500,8 +500,9 @@ PINSHEETLABEL_SHAPE SCH_EDIT_FRAME::m_lastSheetPinType = PINSHEETLABEL_SHAPE::PS SCH_SHEET_PIN* SCH_EDIT_FRAME::CreateSheetPin( SCH_SHEET* aSheet, SCH_HIERLABEL* aLabel ) { - wxString text; - SCH_SHEET_PIN* sheetPin; + SCHEMATIC_SETTINGS& settings = aSheet->Schematic()->Settings(); + wxString text; + SCH_SHEET_PIN* sheetPin; if( aLabel ) { @@ -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 ) diff --git a/eeschema/tools/ee_actions.h b/eeschema/tools/ee_actions.h index 38ec8ab1c9..2777c54b05 100644 --- a/eeschema/tools/ee_actions.h +++ b/eeschema/tools/ee_actions.h @@ -32,8 +32,6 @@ class TOOL_EVENT; class TOOL_MANAGER; -extern char g_lastBusEntryShape; - /** * EESCHEMA_ACTIONS * diff --git a/eeschema/tools/lib_drawing_tools.cpp b/eeschema/tools/lib_drawing_tools.cpp index 44aca72e06..c55efc7f2a 100644 --- a/eeschema/tools/lib_drawing_tools.cpp +++ b/eeschema/tools/lib_drawing_tools.cpp @@ -37,13 +37,20 @@ #include #include #include +#include +#include +#include #include "ee_point_editor.h" static void* g_lastPinWeakPtr; LIB_DRAWING_TOOLS::LIB_DRAWING_TOOLS() : - EE_TOOL_BASE( "eeschema.SymbolDrawing" ) + EE_TOOL_BASE( "eeschema.SymbolDrawing" ), + m_lastTextAngle( 0.0 ), + m_lastFillStyle( NO_FILL ), + m_drawSpecificConvert( true ), + m_drawSpecificUnit( false ) { } @@ -65,10 +72,11 @@ bool LIB_DRAWING_TOOLS::Init() int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent ) { - KICAD_T type = aEvent.Parameter(); - LIB_PIN_TOOL* pinTool = type == LIB_PIN_T ? m_toolMgr->GetTool() : nullptr; - VECTOR2I cursorPos; - EDA_ITEM* item = nullptr; + KICAD_T type = aEvent.Parameter(); + LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings(); + LIB_PIN_TOOL* pinTool = type == LIB_PIN_T ? m_toolMgr->GetTool() : nullptr; + VECTOR2I cursorPos; + EDA_ITEM* item = nullptr; m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); getViewControls()->ShowCursor( true ); @@ -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,8 +240,9 @@ int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent ) int LIB_DRAWING_TOOLS::DrawShape( const TOOL_EVENT& aEvent ) { - KICAD_T type = aEvent.Parameter(); - EE_POINT_EDITOR* pointEditor = m_toolMgr->GetTool(); + LIBEDIT_SETTINGS* settings = Pgm().GetSettingsManager().GetAppSettings(); + KICAD_T type = aEvent.Parameter(); + EE_POINT_EDITOR* pointEditor = m_toolMgr->GetTool(); // We might be running as the same shape in another co-routine. Make sure that one // gets whacked. @@ -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 ); diff --git a/eeschema/tools/lib_drawing_tools.h b/eeschema/tools/lib_drawing_tools.h index e4dd3600b6..9aed22dfc2 100644 --- a/eeschema/tools/lib_drawing_tools.h +++ b/eeschema/tools/lib_drawing_tools.h @@ -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 */ diff --git a/eeschema/tools/lib_edit_tool.cpp b/eeschema/tools/lib_edit_tool.cpp index 5fa713cfdd..61e158f3c2 100644 --- a/eeschema/tools/lib_edit_tool.cpp +++ b/eeschema/tools/lib_edit_tool.cpp @@ -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(); + 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(); + // 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() ); } } diff --git a/eeschema/tools/sch_drawing_tools.cpp b/eeschema/tools/sch_drawing_tools.cpp index bee502134c..3ecec91d78 100644 --- a/eeschema/tools/sch_drawing_tools.cpp +++ b/eeschema/tools/sch_drawing_tools.cpp @@ -27,8 +27,6 @@ #include "ee_point_editor.h" #include #include -#include -#include #include #include #include @@ -46,9 +44,15 @@ #include #include #include +#include SCH_DRAWING_TOOLS::SCH_DRAWING_TOOLS() : - EE_TOOL_BASE( "eeschema.InteractiveDrawing" ) + EE_TOOL_BASE( "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(); - SCHLIB_FILTER filter; - SCH_BASE_FRAME::HISTORY_LIST* historyList = nullptr; + SCH_COMPONENT* component = aEvent.Parameter(); + SCHLIB_FILTER filter; + std::vector* 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( 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_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 nextitem( static_cast( 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 nextitem( static_cast( 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( 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 ); diff --git a/eeschema/tools/sch_drawing_tools.h b/eeschema/tools/sch_drawing_tools.h index b6a32d2c88..3325361a65 100644 --- a/eeschema/tools/sch_drawing_tools.h +++ b/eeschema/tools/sch_drawing_tools.h @@ -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,7 +75,20 @@ private: void setTransitions() override; private: - std::unique_ptr m_statusPopup; +// History lists for PlaceComponent() + std::vector m_symbolHistoryList; + std::vector m_powerHistoryList; + + char m_lastBusEntryShape; + + PINSHEETLABEL_SHAPE m_lastGlobalLabelShape; + LABEL_SPIN_STYLE m_lastTextOrientation; + bool m_lastTextBold; + bool m_lastTextItalic; + + std::deque> m_queuedTexts; + + std::unique_ptr m_statusPopup; }; #endif /* SCH_DRAWING_TOOLS_H */ diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index 8e8b57710a..d2e94b6279 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -56,9 +56,7 @@ #include #include #include - -char g_lastBusEntryShape = '/'; - +#include 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(); + drawingTool->SetLastBusEntryShape( shape ); return 0; } diff --git a/eeschema/tools/sch_line_wire_bus_tool.cpp b/eeschema/tools/sch_line_wire_bus_tool.cpp index 593876db2d..2dd6cec8a3 100644 --- a/eeschema/tools/sch_line_wire_bus_tool.cpp +++ b/eeschema/tools/sch_line_wire_bus_tool.cpp @@ -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()->Settings(); + wxPoint pos = (wxPoint) getViewControls()->GetCursorPosition(); - 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 );