Rework on hint to user when pin scope control has no effect or unexpected result.

A info banner is now shown (in synchronized mode) to inform an user when extra
pins are added to other units when a new pin is added.
A good info about the synchronized mode is not easy to create.
This commit is contained in:
jean-pierre charras 2021-08-14 10:15:18 +02:00
parent 3d61c8b0c4
commit 08d7899f7e
5 changed files with 274 additions and 11 deletions

View File

@ -136,6 +136,24 @@ DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES( SYMBOL_EDIT_FRAME* parent, LIB_PIN
// Creates a dummy pin to show on a panel, inside this dialog:
m_dummyPin = new LIB_PIN( *m_pin );
m_bSizerInfo->Show( m_frame->m_SyncPinEdit );
if( m_frame->m_SyncPinEdit )
{
if( aPin->IsNew() )
{
m_textInfoUpper->SetLabel( _( "Synchronized pins edit mode, and this pin is new" ) );
m_textInfoLower->SetLabel( _( "Similar pins will be automatically added to other units, "
"if this pin is not common to all units" ) );
}
else
{
m_textInfoUpper->SetLabel( _( "Synchronized pins edit mode" ) );
m_textInfoLower->SetLabel( _( "Similar pins at the same location will be edited. "
"Pin number of other pins will be not modified" ) );
}
}
COLOR4D bgColor = parent->GetRenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND );
m_panelShowPin->SetBackgroundColour( bgColor.ToColour() );
@ -255,18 +273,18 @@ bool DIALOG_PIN_PROPERTIES::TransferDataToWindow()
m_dummyPin->SetVisible( m_pin->IsVisible() );
bool hasMultiUnit = m_pin->GetParent()->GetUnitCount() > 1;
bool enableUnitScope = m_pin->GetParent()->UnitsLocked();
m_checkApplyToAllParts->Enable( !m_frame->m_SyncPinEdit && enableUnitScope && hasMultiUnit );
m_checkApplyToAllParts->Enable( hasMultiUnit );
wxString toolTip;
if( !hasMultiUnit )
toolTip = _( "This symbol only has one unit. This control has no effect." );
else if( m_frame->m_SyncPinEdit )
toolTip = _( "Synchronized pin edit mode is enabled. This control has no effect." );
else if( !enableUnitScope )
toolTip = _( "All units in this symbol are interchangeable. This control has no effect." );
toolTip = _( "Synchronized pin edit mode is enabled.\n"
"Similar pins will be edited, regardless this option." );
else
toolTip = _( "If checked, this pin will exist in all units." );
m_checkApplyToAllParts->SetToolTip( toolTip );
@ -485,3 +503,8 @@ void DIALOG_PIN_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& event )
}
void DIALOG_PIN_PROPERTIES::onUpdateUIInfo( wxUpdateUIEvent& event )
{
// Disable Info texts for pins common to all units
event.Enable( m_checkApplyToAllParts->GetValue() == 0 );
}

View File

@ -65,6 +65,7 @@ public:
void OnDeleteAlternate( wxCommandEvent& event ) override;
void OnSize( wxSizeEvent& event ) override;
void OnUpdateUI( wxUpdateUIEvent& event ) override;
void onUpdateUIInfo( wxUpdateUIEvent& event ) override;
protected:
void adjustGridColumns( int aWidth );

View File

@ -21,6 +21,28 @@ DIALOG_PIN_PROPERTIES_BASE::DIALOG_PIN_PROPERTIES_BASE( wxWindow* parent, wxWind
wxBoxSizer* mainSizer;
mainSizer = new wxBoxSizer( wxVERTICAL );
m_bSizerInfo = new wxBoxSizer( wxHORIZONTAL );
m_bitmapInfo = new wxStaticBitmap( this, wxID_ANY, wxArtProvider::GetBitmap( wxART_INFORMATION, wxART_CMN_DIALOG ), wxDefaultPosition, wxDefaultSize, 0 );
m_bSizerInfo->Add( m_bitmapInfo, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* bSizerTexts;
bSizerTexts = new wxBoxSizer( wxVERTICAL );
m_textInfoUpper = new wxStaticText( this, wxID_ANY, _("info"), wxDefaultPosition, wxDefaultSize, 0 );
m_textInfoUpper->Wrap( -1 );
bSizerTexts->Add( m_textInfoUpper, 0, wxRIGHT|wxLEFT, 5 );
m_textInfoLower = new wxStaticText( this, wxID_ANY, _("info"), wxDefaultPosition, wxDefaultSize, 0 );
m_textInfoLower->Wrap( -1 );
bSizerTexts->Add( m_textInfoLower, 0, wxRIGHT|wxLEFT, 5 );
m_bSizerInfo->Add( bSizerTexts, 1, wxALIGN_CENTER_VERTICAL, 5 );
mainSizer->Add( m_bSizerInfo, 0, wxEXPAND, 5 );
wxBoxSizer* bUpperSizer;
bUpperSizer = new wxBoxSizer( wxHORIZONTAL );
@ -262,6 +284,9 @@ DIALOG_PIN_PROPERTIES_BASE::DIALOG_PIN_PROPERTIES_BASE( wxWindow* parent, wxWind
// Connect Events
this->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnSize ) );
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnUpdateUI ) );
m_bitmapInfo->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_PIN_PROPERTIES_BASE::onUpdateUIInfo ), NULL, this );
m_textInfoUpper->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_PIN_PROPERTIES_BASE::onUpdateUIInfo ), NULL, this );
m_textInfoLower->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_PIN_PROPERTIES_BASE::onUpdateUIInfo ), NULL, this );
m_textPinName->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
m_textPinNumber->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
m_pinLengthCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
@ -283,6 +308,9 @@ DIALOG_PIN_PROPERTIES_BASE::~DIALOG_PIN_PROPERTIES_BASE()
// Disconnect Events
this->Disconnect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnSize ) );
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnUpdateUI ) );
m_bitmapInfo->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_PIN_PROPERTIES_BASE::onUpdateUIInfo ), NULL, this );
m_textInfoUpper->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_PIN_PROPERTIES_BASE::onUpdateUIInfo ), NULL, this );
m_textInfoLower->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_PIN_PROPERTIES_BASE::onUpdateUIInfo ), NULL, this );
m_textPinName->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
m_textPinNumber->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
m_pinLengthCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );

View File

@ -60,6 +60,211 @@
<property name="name">mainSizer</property>
<property name="orient">wxVERTICAL</property>
<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">m_bSizerInfo</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">protected</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxStaticBitmap" 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="bitmap">Load From Art Provider; wxART_INFORMATION; wxART_CMN_DIALOG</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="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_bitmapInfo</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="subclass">; ; forward_declare</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>
<event name="OnUpdateUI">onUpdateUIInfo</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerTexts</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxRIGHT|wxLEFT</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">info</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_textInfoUpper</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">; ; forward_declare</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>
<event name="OnUpdateUI">onUpdateUIInfo</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxRIGHT|wxLEFT</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">info</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_textInfoLower</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">; ; forward_declare</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>
<event name="OnUpdateUI">onUpdateUIInfo</event>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT</property>

View File

@ -16,23 +16,24 @@ class WX_GRID;
class wxBitmapComboBox;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/statbmp.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/sizer.h>
#include <wx/textctrl.h>
#include <wx/combobox.h>
#include <wx/gbsizer.h>
#include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/panel.h>
#include <wx/grid.h>
#include <wx/bmpbuttn.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/button.h>
#include <wx/collpane.h>
#include <wx/statline.h>
@ -48,6 +49,10 @@ class DIALOG_PIN_PROPERTIES_BASE : public DIALOG_SHIM
private:
protected:
wxBoxSizer* m_bSizerInfo;
wxStaticBitmap* m_bitmapInfo;
wxStaticText* m_textInfoUpper;
wxStaticText* m_textInfoLower;
wxStaticText* m_pinNameLabel;
wxTextCtrl* m_textPinName;
wxStaticText* m_pinNumberLabel;
@ -90,6 +95,7 @@ class DIALOG_PIN_PROPERTIES_BASE : public DIALOG_SHIM
// Virtual event handlers, overide them in your derived class
virtual void OnSize( wxSizeEvent& event ) { event.Skip(); }
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void onUpdateUIInfo( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void OnPropertiesChange( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPaintShowPanel( wxPaintEvent& event ) { event.Skip(); }
virtual void OnAddAlternate( wxCommandEvent& event ) { event.Skip(); }