Clear annotations by default on copy/paste.

Folks didn't seem to like the "only clear when there are collisions"
behaviour.  Paste Special remains available to "force keep".

Fixes https://gitlab.com/kicad/code/kicad/issues/4933

Fixes https://gitlab.com/kicad/code/kicad/issues/4744
This commit is contained in:
Jeff Young 2020-07-26 19:41:31 +01:00
parent 1d8c71c617
commit 8a9fa53cd7
6 changed files with 1 additions and 97 deletions

View File

@ -25,7 +25,6 @@
static bool g_keepAnnotations = true; static bool g_keepAnnotations = true;
static bool g_dropAnnotations = false;
DIALOG_PASTE_SPECIAL::DIALOG_PASTE_SPECIAL( wxWindow* parent, bool* aKeep, bool* aDrop ) : DIALOG_PASTE_SPECIAL::DIALOG_PASTE_SPECIAL( wxWindow* parent, bool* aKeep, bool* aDrop ) :
@ -41,28 +40,12 @@ DIALOG_PASTE_SPECIAL::DIALOG_PASTE_SPECIAL( wxWindow* parent, bool* aKeep, bool*
bool DIALOG_PASTE_SPECIAL::TransferDataToWindow() bool DIALOG_PASTE_SPECIAL::TransferDataToWindow()
{ {
m_keepAnnotations->SetValue( g_keepAnnotations ); m_keepAnnotations->SetValue( g_keepAnnotations );
m_dropAnnotations->SetValue( g_dropAnnotations );
return true; return true;
} }
void DIALOG_PASTE_SPECIAL::OnKeepAnnotations( wxCommandEvent& event )
{
if( m_keepAnnotations->GetValue() )
m_dropAnnotations->SetValue( false );
}
void DIALOG_PASTE_SPECIAL::OnDropAnnotations( wxCommandEvent& event )
{
if( m_dropAnnotations->GetValue() )
m_keepAnnotations->SetValue( false );
}
bool DIALOG_PASTE_SPECIAL::TransferDataFromWindow() bool DIALOG_PASTE_SPECIAL::TransferDataFromWindow()
{ {
g_keepAnnotations = *m_keep = m_keepAnnotations->GetValue(); g_keepAnnotations = *m_keep = m_keepAnnotations->GetValue();
g_dropAnnotations = *m_drop = m_dropAnnotations->GetValue();
return true; return true;
} }

View File

@ -38,9 +38,6 @@ class DIALOG_PASTE_SPECIAL : public DIALOG_PASTE_SPECIAL_BASE
public: public:
DIALOG_PASTE_SPECIAL( wxWindow* parent, bool* aKeepAnnotations, bool* aDropAnnotations ); DIALOG_PASTE_SPECIAL( wxWindow* parent, bool* aKeepAnnotations, bool* aDropAnnotations );
void OnKeepAnnotations( wxCommandEvent& event ) override;
void OnDropAnnotations( wxCommandEvent& event ) override;
bool TransferDataToWindow() override; bool TransferDataToWindow() override;
bool TransferDataFromWindow() override; bool TransferDataFromWindow() override;

View File

@ -26,9 +26,6 @@ DIALOG_PASTE_SPECIAL_BASE::DIALOG_PASTE_SPECIAL_BASE( wxWindow* parent, wxWindow
m_keepAnnotations = new wxCheckBox( this, wxID_ANY, _("Keep existing annotations, even if they are duplicated"), wxDefaultPosition, wxDefaultSize, 0 ); m_keepAnnotations = new wxCheckBox( this, wxID_ANY, _("Keep existing annotations, even if they are duplicated"), wxDefaultPosition, wxDefaultSize, 0 );
optionsSizer->Add( m_keepAnnotations, 0, wxALL, 5 ); optionsSizer->Add( m_keepAnnotations, 0, wxALL, 5 );
m_dropAnnotations = new wxCheckBox( this, wxID_ANY, _("Clear annotations on pasted items"), wxDefaultPosition, wxDefaultSize, 0 );
optionsSizer->Add( m_dropAnnotations, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_mainSizer->Add( optionsSizer, 1, wxALL|wxEXPAND, 10 ); m_mainSizer->Add( optionsSizer, 1, wxALL|wxEXPAND, 10 );
@ -52,16 +49,12 @@ DIALOG_PASTE_SPECIAL_BASE::DIALOG_PASTE_SPECIAL_BASE( wxWindow* parent, wxWindow
this->Centre( wxBOTH ); this->Centre( wxBOTH );
// Connect Events // Connect Events
m_keepAnnotations->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PASTE_SPECIAL_BASE::OnKeepAnnotations ), NULL, this );
m_dropAnnotations->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PASTE_SPECIAL_BASE::OnDropAnnotations ), NULL, this );
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PASTE_SPECIAL_BASE::onOKButton ), NULL, this ); m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PASTE_SPECIAL_BASE::onOKButton ), NULL, this );
} }
DIALOG_PASTE_SPECIAL_BASE::~DIALOG_PASTE_SPECIAL_BASE() DIALOG_PASTE_SPECIAL_BASE::~DIALOG_PASTE_SPECIAL_BASE()
{ {
// Disconnect Events // Disconnect Events
m_keepAnnotations->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PASTE_SPECIAL_BASE::OnKeepAnnotations ), NULL, this );
m_dropAnnotations->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PASTE_SPECIAL_BASE::OnDropAnnotations ), NULL, this );
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PASTE_SPECIAL_BASE::onOKButton ), NULL, this ); m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PASTE_SPECIAL_BASE::onOKButton ), NULL, this );
} }

View File

@ -190,72 +190,6 @@
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
<event name="OnCheckBox">OnKeepAnnotations</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" 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="checked">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">Clear annotations on pasted items</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_dropAnnotations</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="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnCheckBox">OnDropAnnotations</event>
</object> </object>
</object> </object>
</object> </object>

View File

@ -36,15 +36,12 @@ class DIALOG_PASTE_SPECIAL_BASE : public DIALOG_SHIM
protected: protected:
wxStaticText* m_staticText7; wxStaticText* m_staticText7;
wxCheckBox* m_keepAnnotations; wxCheckBox* m_keepAnnotations;
wxCheckBox* m_dropAnnotations;
wxStaticLine* m_staticline1; wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizer; wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK; wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel; wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnKeepAnnotations( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDropAnnotations( wxCommandEvent& event ) { event.Skip(); }
virtual void onOKButton( wxCommandEvent& event ) { event.Skip(); } virtual void onOKButton( wxCommandEvent& event ) { event.Skip(); }

View File

@ -1333,7 +1333,7 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
} }
bool forceKeepAnnotations = false; bool forceKeepAnnotations = false;
bool forceDropAnnotations = false; bool forceDropAnnotations = true;
bool dropAnnotations = false; bool dropAnnotations = false;
if( aEvent.IsAction( &ACTIONS::pasteSpecial ) ) if( aEvent.IsAction( &ACTIONS::pasteSpecial ) )