Fix wxGrid column dragging bugs.
Close an open editor when dragging (as wxWidgets won't move it). Make sure native column headers aren't in use where we need dragging: their interaction with wxWidgets' dragging is buggy. Fixes: lp:1796398 * https://bugs.launchpad.net/kicad/+bug/1796398 Fixes: lp:1796396 * https://bugs.launchpad.net/kicad/+bug/1796396
This commit is contained in:
parent
5f0ffe8490
commit
779ef044b7
|
@ -68,6 +68,8 @@ void WX_GRID::SetTable( wxGridTableBase* aTable, bool aTakeOwnership )
|
||||||
|
|
||||||
delete[] formBuilderColWidths;
|
delete[] formBuilderColWidths;
|
||||||
|
|
||||||
|
Connect( wxEVT_GRID_COL_MOVE, wxGridEventHandler( WX_GRID::onGridColMove ), NULL, this );
|
||||||
|
|
||||||
m_weOwnTable = aTakeOwnership;
|
m_weOwnTable = aTakeOwnership;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,6 +80,8 @@ void WX_GRID::DestroyTable( wxGridTableBase* aTable )
|
||||||
// is left open. Normally it's closed in Validate(), but not if the user hit Cancel.
|
// is left open. Normally it's closed in Validate(), but not if the user hit Cancel.
|
||||||
CommitPendingChanges( true /* quiet mode */ );
|
CommitPendingChanges( true /* quiet mode */ );
|
||||||
|
|
||||||
|
Disconnect( wxEVT_GRID_COL_MOVE, wxGridEventHandler( WX_GRID::onGridColMove ), NULL, this );
|
||||||
|
|
||||||
wxGrid::SetTable( nullptr );
|
wxGrid::SetTable( nullptr );
|
||||||
delete aTable;
|
delete aTable;
|
||||||
}
|
}
|
||||||
|
@ -196,3 +200,10 @@ bool WX_GRID::CommitPendingChanges( bool aQuietMode )
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WX_GRID::onGridColMove( wxGridEvent& aEvent )
|
||||||
|
{
|
||||||
|
// wxWidgets won't move an open editor, so better just to close it
|
||||||
|
CommitPendingChanges( true );
|
||||||
|
}
|
||||||
|
|
|
@ -70,6 +70,8 @@ public:
|
||||||
protected:
|
protected:
|
||||||
void DrawColLabel( wxDC& dc, int col ) override;
|
void DrawColLabel( wxDC& dc, int col ) override;
|
||||||
|
|
||||||
|
void onGridColMove( wxGridEvent& aEvent );
|
||||||
|
|
||||||
bool m_weOwnTable;
|
bool m_weOwnTable;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -689,7 +689,9 @@ DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL( SCH_EDIT_FRAME* parent
|
||||||
m_dataModel->RebuildRows( m_groupComponentsBox, m_fieldsCtrl );
|
m_dataModel->RebuildRows( m_groupComponentsBox, m_fieldsCtrl );
|
||||||
m_dataModel->Sort( 0, true );
|
m_dataModel->Sort( 0, true );
|
||||||
|
|
||||||
m_grid->UseNativeColHeader( true );
|
// wxGrid's column moving is buggy with native headers and this is one dialog where you'd
|
||||||
|
// really like to be able to rearrange columns.
|
||||||
|
m_grid->UseNativeColHeader( false );
|
||||||
m_grid->SetTable( m_dataModel, true );
|
m_grid->SetTable( m_dataModel, true );
|
||||||
|
|
||||||
// sync m_grid's column visiblities to Show checkboxes in m_fieldsCtrl
|
// sync m_grid's column visiblities to Show checkboxes in m_fieldsCtrl
|
||||||
|
|
|
@ -71,7 +71,7 @@ DIALOG_FIELDS_EDITOR_GLOBAL_BASE::DIALOG_FIELDS_EDITOR_GLOBAL_BASE( wxWindow* pa
|
||||||
m_grid->SetMargins( 0, 0 );
|
m_grid->SetMargins( 0, 0 );
|
||||||
|
|
||||||
// Columns
|
// Columns
|
||||||
m_grid->EnableDragColMove( false );
|
m_grid->EnableDragColMove( true );
|
||||||
m_grid->EnableDragColSize( true );
|
m_grid->EnableDragColSize( true );
|
||||||
m_grid->SetColLabelSize( 20 );
|
m_grid->SetColLabelSize( 20 );
|
||||||
m_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
|
m_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
|
||||||
|
|
|
@ -740,7 +740,7 @@
|
||||||
<property name="dock">Dock</property>
|
<property name="dock">Dock</property>
|
||||||
<property name="dock_fixed">0</property>
|
<property name="dock_fixed">0</property>
|
||||||
<property name="docking">Left</property>
|
<property name="docking">Left</property>
|
||||||
<property name="drag_col_move">0</property>
|
<property name="drag_col_move">1</property>
|
||||||
<property name="drag_col_size">1</property>
|
<property name="drag_col_size">1</property>
|
||||||
<property name="drag_grid_size">0</property>
|
<property name="drag_grid_size">0</property>
|
||||||
<property name="drag_row_size">0</property>
|
<property name="drag_row_size">0</property>
|
||||||
|
|
Loading…
Reference in New Issue