7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-20 00:21:31 +00:00

Improve text alignment in grids and one-line Scintilla controls.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16685
This commit is contained in:
Jeff Young 2025-03-17 13:55:44 +00:00
parent 6c97a40b8c
commit 17712ba321
2 changed files with 23 additions and 4 deletions

View File

@ -47,8 +47,8 @@ void GRID_CELL_TEXT_EDITOR::StartingKey( wxKeyEvent& event )
{
if( m_validator )
{
m_validator.get()->SetWindow( Text() );
m_validator.get()->ProcessEvent( event );
m_validator->SetWindow( Text() );
m_validator->ProcessEvent( event );
}
if( event.GetSkipped() )
@ -66,9 +66,12 @@ void GRID_CELL_TEXT_EDITOR::SetSize( const wxRect& aRect )
#if defined( __WXMSW__ )
rect.Offset( 0, 1 );
#elif defined( __WXMAC__ )
rect.Offset( 0, 2 );
rect.SetHeight( rect.GetHeight() - 4 );
#endif
wxGridCellEditor::SetSize( rect );
wxGridCellEditor::SetSize( rect ); // NOLINT(*-parent-virtual-call)
}
@ -125,7 +128,10 @@ void GRID_CELL_STC_EDITOR::SetSize( const wxRect& aRect )
#if defined( __WXMSW__ )
rect.Offset( -1, 1 );
#elif defined( __WXGTK__ )
rect.Offset( -1, 3 );
rect.Offset( -1, 1 );
#else
rect.Offset( 1, 3 );
rect.SetHeight( rect.GetHeight() - 6 );
#endif
wxGridCellEditor::SetSize( rect );
@ -137,6 +143,11 @@ void GRID_CELL_STC_EDITOR::Create( wxWindow* aParent, wxWindowID aId, wxEvtHandl
m_control = new wxStyledTextCtrl( aParent, wxID_ANY, wxDefaultPosition, wxSize( 0, 0 ),
wxBORDER_NONE );
#ifdef __WXGTK__
stc_ctrl()->SetExtraAscent( 6 );
stc_ctrl()->SetExtraDescent( 2 );
#endif
stc_ctrl()->SetTabIndents( false );
stc_ctrl()->SetBackSpaceUnIndents( false );
stc_ctrl()->SetViewEOL( false );

View File

@ -76,6 +76,14 @@ DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES( SCH_BASE_FRAME* aParent, const
m_StyledTextCtrl->SetEOLMode( wxSTC_EOL_LF ); // Normalize EOL across platforms
#ifdef __WXGTK__
m_StyledTextCtrl->SetExtraAscent( 6 );
m_StyledTextCtrl->SetExtraDescent( 2 );
#else
m_StyledTextCtrl->SetExtraAscent( 1 );
m_StyledTextCtrl->SetExtraDescent( 2 );
#endif
#ifdef _WIN32
// Without this setting, on Windows, some esoteric unicode chars create display issue
// in a wxStyledTextCtrl.