Fix reference text smart selection for Windows and Linux.
Fixes: lp:1782382 * https://bugs.launchpad.net/kicad/+bug/1782382
This commit is contained in:
parent
eaf5b913b6
commit
3a67300001
|
@ -151,10 +151,8 @@ void DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick( wxCommandEvent& aEvent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool DIALOG_EDIT_ONE_FIELD::TransferDataToWindow()
|
void DIALOG_EDIT_ONE_FIELD::OnSetFocusText( wxFocusEvent& event )
|
||||||
{
|
{
|
||||||
m_TextValue->SetValue( m_text );
|
|
||||||
|
|
||||||
if( m_fieldId == REFERENCE )
|
if( m_fieldId == REFERENCE )
|
||||||
{
|
{
|
||||||
if( m_text.find_first_of( '?' ) != m_text.npos )
|
if( m_text.find_first_of( '?' ) != m_text.npos )
|
||||||
|
@ -183,6 +181,12 @@ bool DIALOG_EDIT_ONE_FIELD::TransferDataToWindow()
|
||||||
{
|
{
|
||||||
m_TextValue->SetSelection( -1, -1 );
|
m_TextValue->SetSelection( -1, -1 );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool DIALOG_EDIT_ONE_FIELD::TransferDataToWindow()
|
||||||
|
{
|
||||||
|
m_TextValue->SetValue( m_text );
|
||||||
|
|
||||||
m_posX.SetValue( m_position.x );
|
m_posX.SetValue( m_position.x );
|
||||||
m_posY.SetValue( m_position.y );
|
m_posY.SetValue( m_position.y );
|
||||||
|
|
|
@ -77,6 +77,13 @@ protected:
|
||||||
*/
|
*/
|
||||||
void OnTextValueSelectButtonClick( wxCommandEvent& aEvent ) override;
|
void OnTextValueSelectButtonClick( wxCommandEvent& aEvent ) override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to select the variant part of some text fields (for instance, the question mark
|
||||||
|
* or number in a reference).
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
|
virtual void OnSetFocusText( wxFocusEvent& event ) override;
|
||||||
|
|
||||||
UNIT_BINDER m_posX;
|
UNIT_BINDER m_posX;
|
||||||
UNIT_BINDER m_posY;
|
UNIT_BINDER m_posY;
|
||||||
UNIT_BINDER m_textSize;
|
UNIT_BINDER m_textSize;
|
||||||
|
|
|
@ -190,6 +190,7 @@ DIALOG_LIB_EDIT_TEXT_BASE::DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindow
|
||||||
|
|
||||||
// Connect Events
|
// Connect Events
|
||||||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnCloseDialog ) );
|
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnCloseDialog ) );
|
||||||
|
m_TextValue->Connect( wxEVT_SET_FOCUS, wxFocusEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnSetFocusText ), NULL, this );
|
||||||
m_TextValueSelectButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnTextValueSelectButtonClick ), NULL, this );
|
m_TextValueSelectButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnTextValueSelectButtonClick ), NULL, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,6 +198,7 @@ DIALOG_LIB_EDIT_TEXT_BASE::~DIALOG_LIB_EDIT_TEXT_BASE()
|
||||||
{
|
{
|
||||||
// Disconnect Events
|
// Disconnect Events
|
||||||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnCloseDialog ) );
|
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnCloseDialog ) );
|
||||||
|
m_TextValue->Disconnect( wxEVT_SET_FOCUS, wxFocusEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnSetFocusText ), NULL, this );
|
||||||
m_TextValueSelectButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnTextValueSelectButtonClick ), NULL, this );
|
m_TextValueSelectButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnTextValueSelectButtonClick ), NULL, this );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,7 +285,7 @@
|
||||||
<event name="OnRightDClick"></event>
|
<event name="OnRightDClick"></event>
|
||||||
<event name="OnRightDown"></event>
|
<event name="OnRightDown"></event>
|
||||||
<event name="OnRightUp"></event>
|
<event name="OnRightUp"></event>
|
||||||
<event name="OnSetFocus"></event>
|
<event name="OnSetFocus">OnSetFocusText</event>
|
||||||
<event name="OnSize"></event>
|
<event name="OnSize"></event>
|
||||||
<event name="OnText"></event>
|
<event name="OnText"></event>
|
||||||
<event name="OnTextEnter"></event>
|
<event name="OnTextEnter"></event>
|
||||||
|
|
|
@ -67,6 +67,7 @@ class DIALOG_LIB_EDIT_TEXT_BASE : public DIALOG_SHIM
|
||||||
|
|
||||||
// Virtual event handlers, overide them in your derived class
|
// Virtual event handlers, overide them in your derived class
|
||||||
virtual void OnCloseDialog( wxCloseEvent& event ) { event.Skip(); }
|
virtual void OnCloseDialog( wxCloseEvent& event ) { event.Skip(); }
|
||||||
|
virtual void OnSetFocusText( wxFocusEvent& event ) { event.Skip(); }
|
||||||
virtual void OnTextValueSelectButtonClick( wxCommandEvent& event ) { event.Skip(); }
|
virtual void OnTextValueSelectButtonClick( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue