Apply Scintilla hack to get auto-sizing canvas.

Fixes https://gitlab.com/kicad/code/kicad/issues/4207
This commit is contained in:
Jeff Young 2020-04-19 20:09:26 +01:00
parent c08a6adb2a
commit 7e4d255cdd
4 changed files with 16 additions and 6 deletions

View File

@ -117,7 +117,11 @@ DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR( SCH_EDIT_FRAME* aParent, SCH_TEXT* aTe
} }
m_valueMultiLine->SetEOLMode( wxSTC_EOL_LF ); m_valueMultiLine->SetEOLMode( wxSTC_EOL_LF );
m_valueMultiLine->SetUseHorizontalScrollBar( false );
// A hack which causes Scintilla to auto-size the text editor canvas
// See: https://github.com/jacobslusser/ScintillaNET/issues/216
m_valueMultiLine->SetScrollWidth( 1 );
m_valueMultiLine->SetScrollWidthTracking( true );
if( m_CurrentText->IsMultilineAllowed() ) if( m_CurrentText->IsMultilineAllowed() )
{ {
@ -146,8 +150,10 @@ DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR( SCH_EDIT_FRAME* aParent, SCH_TEXT* aTe
m_activeTextCtrl = m_valueSingleLine; m_activeTextCtrl = m_valueSingleLine;
m_activeTextEntry = m_valueSingleLine; m_activeTextEntry = m_valueSingleLine;
m_labelCombo->Show( false ); m_valueCombo->Show( false ); m_labelCombo->Show( false );
m_labelMultiLine->Show( false ); m_valueMultiLine->Show( false ); m_valueCombo->Show( false );
m_labelMultiLine->Show( false );
m_valueMultiLine->Show( false );
if( m_CurrentText->Type() != SCH_TEXT_T ) if( m_CurrentText->Type() != SCH_TEXT_T )
m_valueSingleLine->SetValidator( m_netNameValidator ); m_valueSingleLine->SetValidator( m_netNameValidator );

View File

@ -445,7 +445,7 @@ DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::DIALOG_FOOTPRINT_BOARD_EDITOR_BASE( wxWindow
// Cell Defaults // Cell Defaults
m_modelsGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); m_modelsGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP );
m_modelsGrid->SetMinSize( wxSize( -1,86 ) ); m_modelsGrid->SetMinSize( wxSize( -1,56 ) );
sbSizer3->Add( m_modelsGrid, 1, wxEXPAND|wxRIGHT, 5 ); sbSizer3->Add( m_modelsGrid, 1, wxEXPAND|wxRIGHT, 5 );

View File

@ -3653,7 +3653,7 @@
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min_size"></property> <property name="min_size"></property>
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size">-1,86</property> <property name="minimum_size">-1,56</property>
<property name="moveable">1</property> <property name="moveable">1</property>
<property name="name">m_modelsGrid</property> <property name="name">m_modelsGrid</property>
<property name="pane_border">1</property> <property name="pane_border">1</property>

View File

@ -60,7 +60,11 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BO
wxString title; wxString title;
m_MultiLineText->SetEOLMode( wxSTC_EOL_LF ); m_MultiLineText->SetEOLMode( wxSTC_EOL_LF );
m_MultiLineText->SetUseHorizontalScrollBar( false );
// A hack which causes Scintilla to auto-size the text editor canvas
// See: https://github.com/jacobslusser/ScintillaNET/issues/216
m_MultiLineText->SetScrollWidth( 1 );
m_MultiLineText->SetScrollWidthTracking( true );
m_linesThickness.Show( m_item->Type() == PCB_DIMENSION_T ); m_linesThickness.Show( m_item->Type() == PCB_DIMENSION_T );