mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Symbol editor: focus the pin number input if mouse over on 'E'
This commit is contained in:
parent
8b6e82c6e2
commit
1511f9a43c
@ -123,7 +123,7 @@ public:
|
||||
};
|
||||
|
||||
|
||||
DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES( SYMBOL_EDIT_FRAME* parent, SCH_PIN* aPin ) :
|
||||
DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES( SYMBOL_EDIT_FRAME* parent, SCH_PIN* aPin, bool aFocusPinNumber ) :
|
||||
DIALOG_PIN_PROPERTIES_BASE( parent ),
|
||||
m_frame( parent ),
|
||||
m_pin( aPin ),
|
||||
@ -223,7 +223,8 @@ DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES( SYMBOL_EDIT_FRAME* parent, SCH_PIN
|
||||
m_addAlternate->GetParent()->Layout();
|
||||
|
||||
SetupStandardButtons();
|
||||
SetInitialFocus( m_textPinName );
|
||||
|
||||
SetInitialFocus( aFocusPinNumber ? m_textPinNumber : m_textPinName );
|
||||
|
||||
// Now all widgets have the size fixed, call FinishDialogSettings
|
||||
finishDialogSettings();
|
||||
|
@ -53,7 +53,7 @@ class ALT_PIN_DATA_MODEL;
|
||||
class DIALOG_PIN_PROPERTIES : public DIALOG_PIN_PROPERTIES_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_PIN_PROPERTIES( SYMBOL_EDIT_FRAME* parent, SCH_PIN* aPin );
|
||||
DIALOG_PIN_PROPERTIES( SYMBOL_EDIT_FRAME* parent, SCH_PIN* aPin, bool aFocusPinNumber );
|
||||
~DIALOG_PIN_PROPERTIES() override;
|
||||
|
||||
bool TransferDataToWindow() override;
|
||||
|
@ -578,11 +578,24 @@ int SYMBOL_EDITOR_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
||||
switch( item->Type() )
|
||||
{
|
||||
case SCH_PIN_T:
|
||||
{
|
||||
SCH_PIN& pin = static_cast<SCH_PIN&>( *item );
|
||||
|
||||
// Mouse, not cursor, as grid points may well not be under any text
|
||||
const VECTOR2I& mousePos = m_toolMgr->GetMousePosition();
|
||||
PIN_LAYOUT_CACHE& layout = pin.GetLayoutCache();
|
||||
|
||||
bool mouseOverNumber = false;
|
||||
if( OPT_BOX2I numberBox = layout.GetPinNumberBBox() )
|
||||
{
|
||||
mouseOverNumber = numberBox->Contains( mousePos );
|
||||
}
|
||||
|
||||
if( SYMBOL_EDITOR_PIN_TOOL* pinTool = m_toolMgr->GetTool<SYMBOL_EDITOR_PIN_TOOL>() )
|
||||
pinTool->EditPinProperties( static_cast<SCH_PIN*>( item ) );
|
||||
pinTool->EditPinProperties( &pin, mouseOverNumber );
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
case SCH_SHAPE_T:
|
||||
editShapeProperties( static_cast<SCH_SHAPE*>( item ) );
|
||||
break;
|
||||
|
@ -117,10 +117,10 @@ bool SYMBOL_EDITOR_PIN_TOOL::Init()
|
||||
}
|
||||
|
||||
|
||||
bool SYMBOL_EDITOR_PIN_TOOL::EditPinProperties( SCH_PIN* aPin )
|
||||
bool SYMBOL_EDITOR_PIN_TOOL::EditPinProperties( SCH_PIN* aPin, bool aFocusPinNumber )
|
||||
{
|
||||
SCH_PIN original_pin( *aPin );
|
||||
DIALOG_PIN_PROPERTIES dlg( m_frame, aPin );
|
||||
DIALOG_PIN_PROPERTIES dlg( m_frame, aPin, aFocusPinNumber );
|
||||
SCH_COMMIT commit( m_frame );
|
||||
LIB_SYMBOL* parentSymbol = static_cast<LIB_SYMBOL*>( aPin->GetParentSymbol() );
|
||||
|
||||
@ -305,7 +305,7 @@ SCH_PIN* SYMBOL_EDITOR_PIN_TOOL::CreatePin( const VECTOR2I& aPosition, LIB_SYMBO
|
||||
pin->SetUnit( g_LastPinCommonUnit ? 0 : m_frame->GetUnit() );
|
||||
pin->SetVisible( g_LastPinVisible );
|
||||
|
||||
if( !EditPinProperties( pin ) )
|
||||
if( !EditPinProperties( pin, false ) )
|
||||
{
|
||||
delete pin;
|
||||
pin = nullptr;
|
||||
|
@ -47,7 +47,7 @@ public:
|
||||
bool PlacePin( SCH_PIN* aPin );
|
||||
void CreateImagePins( SCH_PIN* aPin );
|
||||
|
||||
bool EditPinProperties( SCH_PIN* aPin );
|
||||
bool EditPinProperties( SCH_PIN* aPin, bool aFocusPinNumber );
|
||||
int PushPinProperties( const TOOL_EVENT& aEvent );
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user