Move all the grid workarounds into our own WX_GRID class.

(cherry picked from commit 08b4463)
This commit is contained in:
Jeff Young 2018-05-30 11:52:19 +01:00
parent 68e23c9271
commit 3e062867de
32 changed files with 298 additions and 229 deletions

View File

@ -186,11 +186,12 @@ set( COMMON_WIDGET_SRCS
widgets/mathplot.cpp
widgets/paged_dialog.cpp
widgets/progress_reporter.cpp
widgets/stepped_slider.cpp
widgets/text_ctrl_eval.cpp
widgets/two_column_tree_list.cpp
widgets/unit_binder.cpp
widgets/widget_hotkey_list.cpp
widgets/stepped_slider.cpp
widgets/wx_grid.cpp
)
set( COMMON_PAGE_LAYOUT_SRCS

View File

@ -387,69 +387,3 @@ void GRID_TRICKS::cutcopy( bool doCut )
m_grid->ForceRefresh();
}
}
// --------------- Static Helper Methods ----------------------------------------------
void GRID_TRICKS::ShowHideGridColumns( wxGrid* aGrid, const wxString& shownColumns )
{
for( int i = 0; i < aGrid->GetNumberCols(); ++i )
aGrid->HideCol( i );
wxStringTokenizer shownTokens( shownColumns );
while( shownTokens.HasMoreTokens() )
{
long colNumber;
shownTokens.GetNextToken().ToLong( &colNumber );
if( colNumber >= 0 && colNumber < aGrid->GetNumberCols() )
aGrid->ShowCol( colNumber );
}
}
wxString GRID_TRICKS::GetShownColumns( wxGrid* aGrid )
{
wxString shownColumns;
for( int i = 0; i < aGrid->GetNumberCols(); ++i )
{
if( aGrid->IsColShown( i ) )
{
if( shownColumns.Length() )
shownColumns << wxT( " " );
shownColumns << i;
}
}
return shownColumns;
}
void GRID_TRICKS::SetGridTable( wxGrid* aGrid, wxGridTableBase* aTable )
{
// SetTable() messes up the column widths from wxFormBuilder so we have to save and
// restore them.
int formBuilderColWidths[ aGrid->GetNumberCols() ];
for( int i = 0; i < aGrid->GetNumberCols(); ++i )
formBuilderColWidths[ i ] = aGrid->GetColSize( i );
aGrid->SetTable( aTable );
for( int i = 0; i < aGrid->GetNumberCols(); ++i )
aGrid->SetColSize( i, formBuilderColWidths[ i ] );
}
void GRID_TRICKS::DestroyGridTable( wxGrid* aGrid, wxGridTableBase* aTable )
{
// wxGrid's destructor will crash trying to look up the cell attr if the edit control
// is left open. Normally it's closed in Validate(), but not if the user hit Cancel.
aGrid->DisableCellEditControl();
aGrid->SetTable( nullptr );
delete aTable;
}

118
common/widgets/wx_grid.cpp Normal file
View File

@ -0,0 +1,118 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <wx/tokenzr.h>
#include <wx/dc.h>
#include "wx_grid.h"
void WX_GRID::SetTable( wxGridTableBase* aTable )
{
// wxGrid::SetTable() messes up the column widths from wxFormBuilder so we have to save
// and restore them.
int formBuilderColWidths[ GetNumberCols() ];
for( int i = 0; i < GetNumberCols(); ++i )
formBuilderColWidths[ i ] = GetColSize( i );
wxGrid::SetTable( aTable );
for( int i = 0; i < GetNumberCols(); ++i )
SetColSize( i, formBuilderColWidths[ i ] );
}
void WX_GRID::DestroyTable( wxGridTableBase* aTable )
{
// wxGrid's destructor will crash trying to look up the cell attr if the edit control
// is left open. Normally it's closed in Validate(), but not if the user hit Cancel.
DisableCellEditControl();
wxGrid::SetTable( nullptr );
delete aTable;
}
wxString WX_GRID::GetShownColumns()
{
wxString shownColumns;
for( int i = 0; i < GetNumberCols(); ++i )
{
if( IsColShown( i ) )
{
if( shownColumns.Length() )
shownColumns << wxT( " " );
shownColumns << i;
}
}
return shownColumns;
}
void WX_GRID::ShowHideColumns( const wxString& shownColumns )
{
for( int i = 0; i < GetNumberCols(); ++i )
HideCol( i );
wxStringTokenizer shownTokens( shownColumns );
while( shownTokens.HasMoreTokens() )
{
long colNumber;
shownTokens.GetNextToken().ToLong( &colNumber );
if( colNumber >= 0 && colNumber < GetNumberCols() )
ShowCol( colNumber );
}
}
// An re-implementation of wxGrid::DrawColLabel which left-aligns the first column.
void WX_GRID::DrawColLabel( wxDC& dc, int col )
{
if( GetColWidth( col ) <= 0 || m_colLabelHeight <= 0 )
return;
int colLeft = GetColLeft( col );
wxRect rect( colLeft, 0, GetColWidth( col ), m_colLabelHeight );
static wxGridColumnHeaderRendererDefault rend;
// It is reported that we need to erase the background to avoid display
// artefacts, see #12055.
wxDCBrushChanger setBrush( dc, m_colWindow->GetBackgroundColour() );
dc.DrawRectangle(rect);
rend.DrawBorder( *this, dc, rect );
int hAlign, vAlign;
GetColLabelAlignment( &hAlign, &vAlign );
const int orient = GetColLabelTextOrientation();
if( col == 0 )
hAlign = wxALIGN_LEFT;
rend.DrawLabel( *this, dc, GetColLabelValue( col ), rect, hAlign, vAlign, orient );
}

67
common/widgets/wx_grid.h Normal file
View File

@ -0,0 +1,67 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef KICAD_WX_GRID_H
#define KICAD_WX_GRID_H
#include <wx/grid.h>
#include <grid_tricks.h>
class WX_GRID : public wxGrid
{
public:
// Constructor has to be wxFormBuilder-compatible
WX_GRID( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxWANTS_CHARS, const wxString& name = wxGridNameStr ) :
wxGrid( parent, id, pos, size, style, name )
{}
/**
* Get a tokenized string containing the shown column indexes.
* Tokens are separated by spaces.
*/
wxString GetShownColumns();
/**
* Show/hide the grid columns based on a tokenized string of shown column indexes.
*/
void ShowHideColumns( const wxString& shownColumns );
/**
* Hide wxGrid's SetTable() method with one which doesn't mess up the grid column
* widths when setting the table.
*/
void SetTable( wxGridTableBase* table );
/**
* Work-around for a bug in wxGrid which crashes when deleting the table if the
* cell edit control was not closed.
*/
void DestroyTable( wxGridTableBase* aTable );
protected:
void DrawColLabel( wxDC& dc, int col ) override;
};
#endif //KICAD_WX_GRID_H

View File

@ -23,8 +23,6 @@
#include <wx/tooltip.h>
#include <wx/grid.h>
#include <pgm_base.h>
#include <kiface_i.h>
#include <class_drawpanel.h>
@ -32,7 +30,7 @@
#include <sch_edit_frame.h>
#include <grid_tricks.h>
#include <menus_helpers.h>
#include <widgets/wx_grid.h>
#include <sch_reference_list.h>
#include <class_library.h>
#include <symbol_lib_table.h>
@ -162,14 +160,12 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( SCH_EDIT
// Give a bit more room for combobox editors
m_grid->SetDefaultRowSize( m_grid->GetDefaultRowSize() + 4 );
// wxGrid::SetTable() messes up the column widths; use GRID_TRICKS version instead
GRID_TRICKS::SetGridTable( m_grid, m_fields );
m_grid->SetTable( m_fields );
m_grid->PushEventHandler( new FIELDS_GRID_TRICKS( m_grid, this ) );
// Show/hide columns according to user's preference
m_config->Read( SymbolFieldsShownColumnsKey, &m_shownColumns, wxT( "0 1 2 3 4 5 6 7" ) );
GRID_TRICKS::ShowHideGridColumns( m_grid, m_shownColumns );
m_grid->ShowHideColumns( m_shownColumns );
wxToolTip::Enable( true );
m_stdDialogButtonSizerOK->SetDefault();
@ -190,10 +186,10 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( SCH_EDIT
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC()
{
m_config->Write( SymbolFieldsShownColumnsKey, GRID_TRICKS::GetShownColumns( m_grid ) );
m_config->Write( SymbolFieldsShownColumnsKey, m_grid->GetShownColumns() );
// Prevents crash bug in wxGrid's d'tor
GRID_TRICKS::DestroyGridTable( m_grid, m_fields );
m_grid->DestroyTable( m_fields );
m_grid->Disconnect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnGridCellChanging ), NULL, this );
@ -709,7 +705,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::AdjustGridColumns( int aWidth )
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnUpdateUI( wxUpdateUIEvent& event )
{
wxString shownColumns = GRID_TRICKS::GetShownColumns( m_grid );
wxString shownColumns = m_grid->GetShownColumns();
if( shownColumns != m_shownColumns )
{

View File

@ -5,6 +5,8 @@
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "widgets/wx_grid.h"
#include "dialog_edit_component_in_schematic_base.h"
///////////////////////////////////////////////////////////////////////////
@ -19,7 +21,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE
wxStaticBoxSizer* sbFields;
sbFields = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Fields") ), wxVERTICAL );
m_grid = new wxGrid( sbFields->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_grid = new WX_GRID( sbFields->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_grid->CreateGrid( 4, 11 );

View File

@ -186,7 +186,7 @@
<property name="rows">4</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass">; forward_declare</property>
<property name="subclass">WX_GRID; widgets/wx_grid.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>

View File

@ -11,6 +11,8 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class WX_GRID;
#include "dialog_shim.h"
#include <wx/colour.h>
#include <wx/settings.h>
@ -44,7 +46,7 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_BASE : public DIALOG_SHIM
private:
protected:
wxGrid* m_grid;
WX_GRID* m_grid;
wxBitmapButton* m_bpAdd;
wxBitmapButton* m_bpDelete;
wxBitmapButton* m_bpMoveUp;

View File

@ -32,6 +32,7 @@
#include <class_drawpanel.h>
#include <sch_edit_frame.h>
#include <kiface_i.h>
#include <widgets/wx_grid.h>
#include <lib_edit_frame.h>
#include <class_library.h>
#include <sch_component.h>
@ -134,9 +135,7 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB( LIB_EDIT
// Give a bit more room for combobox editors
m_grid->SetDefaultRowSize( m_grid->GetDefaultRowSize() + 2 );
// wxGrid::SetTable() messes up the column widths; use GRID_TRICKS version instead
GRID_TRICKS::SetGridTable( m_grid, m_fields );
m_grid->SetTable( m_fields );
m_grid->PushEventHandler( new FIELDS_GRID_TRICKS( m_grid, this ) );
stdDialogButtonSizerOK->SetDefault();
@ -156,10 +155,10 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB( LIB_EDIT
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB()
{
m_config->Write( LibEditFieldsShownColumnsKey, GRID_TRICKS::GetShownColumns( m_grid ) );
m_config->Write( LibEditFieldsShownColumnsKey, m_grid->GetShownColumns() );
// Prevents crash bug in wxGrid's d'tor
GRID_TRICKS::DestroyGridTable( m_grid, m_fields );
m_grid->DestroyTable( m_fields );
m_grid->Disconnect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnGridCellChanging ), NULL, this );
@ -191,7 +190,7 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::TransferDataToWindow()
// Show/hide columns according to the user's preference
m_config->Read( LibEditFieldsShownColumnsKey, &m_shownColumns, wxT( "0 1 2 3 4 5 6 7" ) );
GRID_TRICKS::ShowHideGridColumns( m_grid, m_shownColumns );
m_grid->ShowHideColumns( m_shownColumns );
Layout();
@ -453,7 +452,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::AdjustGridColumns( int aWidth )
void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnUpdateUI( wxUpdateUIEvent& event )
{
wxString shownColumns = GRID_TRICKS::GetShownColumns( m_grid );
wxString shownColumns = m_grid->GetShownColumns();
if( shownColumns != m_shownColumns )
{

View File

@ -5,6 +5,8 @@
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "widgets/wx_grid.h"
#include "dialog_edit_libentry_fields_in_lib_base.h"
///////////////////////////////////////////////////////////////////////////
@ -19,7 +21,7 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
wxBoxSizer* bSizerFieldsSetup;
bSizerFieldsSetup = new wxBoxSizer( wxVERTICAL );
m_grid = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_grid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_grid->CreateGrid( 4, 11 );

View File

@ -182,7 +182,7 @@
<property name="rows">4</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass">; forward_declare</property>
<property name="subclass">WX_GRID; widgets/wx_grid.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>

View File

@ -11,6 +11,8 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class WX_GRID;
#include "dialog_shim.h"
#include <wx/colour.h>
#include <wx/settings.h>
@ -38,7 +40,7 @@ class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE : public DIALOG_SHIM
private:
protected:
wxGrid* m_grid;
WX_GRID* m_grid;
wxBitmapButton* m_bpAdd;
wxBitmapButton* m_bpDelete;
wxBitmapButton* m_bpMoveUp;

View File

@ -26,7 +26,7 @@
#include "pin_number.h"
#include "grid_tricks.h"
#include <widgets/grid_icon_text_helpers.h>
#include <widgets/wx_grid.h>
#include <queue>
#include <base_units.h>
#include <bitmaps.h>
@ -360,14 +360,12 @@ DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE( wxWindow* parent, LIB_PART
// Give a bit more room for combobox editors
m_grid->SetDefaultRowSize( m_grid->GetDefaultRowSize() + 4 );
// wxGrid::SetTable() messes up the column widths; use GRID_TRICKS version instead
GRID_TRICKS::SetGridTable( m_grid, m_dataModel );
m_grid->SetTable( m_dataModel );
m_grid->PushEventHandler( new GRID_TRICKS( m_grid ) );
// Show/hide columns according to the user's preference
m_config->Read( PinTableShownColumnsKey, &m_columnsShown, wxT( "0 1 2 3 4 8 9" ) );
GRID_TRICKS::ShowHideGridColumns( m_grid, m_columnsShown );
m_grid->ShowHideColumns( m_columnsShown );
// Set special attributes
wxGridCellAttr* attr;
@ -416,13 +414,13 @@ DIALOG_LIB_EDIT_PIN_TABLE::DIALOG_LIB_EDIT_PIN_TABLE( wxWindow* parent, LIB_PART
DIALOG_LIB_EDIT_PIN_TABLE::~DIALOG_LIB_EDIT_PIN_TABLE()
{
m_config->Write( PinTableShownColumnsKey, GRID_TRICKS::GetShownColumns( m_grid ) );
m_config->Write( PinTableShownColumnsKey, m_grid->GetShownColumns() );
// Disconnect Events
m_grid->Disconnect( wxEVT_GRID_COL_SORT, wxGridEventHandler( DIALOG_LIB_EDIT_PIN_TABLE::OnColSort ), nullptr, this );
// Prevents crash bug in wxGrid's d'tor
GRID_TRICKS::DestroyGridTable( m_grid, m_dataModel );
m_grid->DestroyTable( m_dataModel );
// Delete the GRID_TRICKS.
m_grid->PopEventHandler( true );
@ -583,7 +581,7 @@ void DIALOG_LIB_EDIT_PIN_TABLE::OnSize( wxSizeEvent& event )
void DIALOG_LIB_EDIT_PIN_TABLE::OnUpdateUI( wxUpdateUIEvent& event )
{
wxString columnsShown = GRID_TRICKS::GetShownColumns( m_grid );
wxString columnsShown = m_grid->GetShownColumns();
if( columnsShown != m_columnsShown )
{

View File

@ -5,6 +5,8 @@
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "widgets/wx_grid.h"
#include "dialog_lib_edit_pin_table_base.h"
///////////////////////////////////////////////////////////////////////////
@ -16,7 +18,7 @@ DIALOG_LIB_EDIT_PIN_TABLE_BASE::DIALOG_LIB_EDIT_PIN_TABLE_BASE( wxWindow* parent
wxBoxSizer* top_sizer;
top_sizer = new wxBoxSizer( wxVERTICAL );
m_grid = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_grid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_grid->CreateGrid( 5, 10 );

View File

@ -173,7 +173,7 @@
<property name="rows">5</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass">; forward_declare</property>
<property name="subclass">WX_GRID; widgets/wx_grid.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>

View File

@ -11,6 +11,8 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class WX_GRID;
#include "dialog_shim.h"
#include <wx/colour.h>
#include <wx/settings.h>
@ -40,7 +42,7 @@ class DIALOG_LIB_EDIT_PIN_TABLE_BASE : public DIALOG_SHIM
private:
protected:
wxGrid* m_grid;
WX_GRID* m_grid;
wxBitmapButton* m_addButton;
wxBitmapButton* m_deleteButton;
wxStaticLine* m_staticline1;

View File

@ -24,6 +24,7 @@
#include <fctsys.h>
#include <base_screen.h>
#include <widgets/wx_grid.h>
#include <template_fieldnames.h>
#include <grid_tricks.h>
#include <sch_edit_frame.h>
@ -39,7 +40,7 @@ PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::PANEL_EESCHEMA_TEMPLATE_FIELDNAMES( SCH_EDIT
m_addFieldButton->SetBitmap( KiBitmap( small_plus_xpm ) );
m_deleteFieldButton->SetBitmap( KiBitmap( trash_xpm ) );
m_checkboxWidth = m_grid->GetColSize( 1 );
m_checkboxColWidth = m_grid->GetColSize( 1 );
m_grid->PushEventHandler( new GRID_TRICKS( m_grid ) );
}
@ -157,8 +158,8 @@ void PANEL_EESCHEMA_TEMPLATE_FIELDNAMES::AdjustGridColumns( int aWidth )
// Account for scroll bars
aWidth -= ( m_grid->GetSize().x - m_grid->GetClientSize().x );
m_grid->SetColSize( 0, aWidth - m_checkboxWidth );
m_grid->SetColSize( 1, m_checkboxWidth );
m_grid->SetColSize( 0, aWidth - m_checkboxColWidth );
m_grid->SetColSize( 1, m_checkboxColWidth );
}

View File

@ -32,7 +32,7 @@ protected:
SCH_EDIT_FRAME* m_frame;
TEMPLATE_FIELDNAMES m_fields;
int m_checkboxWidth;
int m_checkboxColWidth;
/**
* Function OnAddButtonClick

View File

@ -5,6 +5,8 @@
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "widgets/wx_grid.h"
#include "panel_eeschema_template_fieldnames_base.h"
///////////////////////////////////////////////////////////////////////////
@ -17,7 +19,7 @@ PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE::PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE
wxBoxSizer* bMargins;
bMargins = new wxBoxSizer( wxVERTICAL );
m_grid = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_grid = new WX_GRID( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_grid->CreateGrid( 0, 2 );

View File

@ -172,7 +172,7 @@
<property name="rows">0</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass"></property>
<property name="subclass">WX_GRID; widgets/wx_grid.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>

View File

@ -11,6 +11,8 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class WX_GRID;
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
@ -35,7 +37,7 @@ class PANEL_EESCHEMA_TEMPLATE_FIELDNAMES_BASE : public wxPanel
private:
protected:
wxGrid* m_grid;
WX_GRID* m_grid;
wxBitmapButton* m_addFieldButton;
wxBitmapButton* m_deleteFieldButton;

View File

@ -54,18 +54,6 @@ public:
explicit GRID_TRICKS( wxGrid* aGrid );
/// Helper routines for column visibility preferences
static void ShowHideGridColumns( wxGrid* aGrid, const wxString& shownColumns );
static wxString GetShownColumns( wxGrid* aGrid );
/// Workaround for wxGrid::SetTable(), which messes up the column widths that were set
/// in wxFormBuilder.)
static void SetGridTable( wxGrid* aGrid, wxGridTableBase* aTable );
/// Workaround for crash bug in wxGrid where it tries to call the table in the d'tor
/// in order to hide the cell editor
static void DestroyGridTable( wxGrid* aGrid, wxGridTableBase* aTable );
protected:
wxGrid* m_grid; ///< I don't own the grid, but he owns me

View File

@ -37,20 +37,20 @@
#include <board_commit.h>
#include <board_design_settings.h>
#include <dialog_text_entry.h>
#include <class_module.h>
#include <validators.h>
#include <widgets/wx_grid.h>
#include <widgets/text_ctrl_eval.h>
#include <filename_resolver.h>
#include <dialog_edit_footprint_for_BoardEditor.h>
#include "3d_cache/dialogs/panel_prev_model.h"
#include "3d_cache/dialogs/3d_cache_dialogs.h"
#include <dialog_edit_footprint_text.h>
#include <bitmaps.h>
#include <3d_viewer.h>
#include <dialog_edit_footprint_for_BoardEditor.h>
#define FootprintTextShownColumnsKey wxT( "FootprintTextShownColumns" )
int DIALOG_FOOTPRINT_BOARD_EDITOR::m_page = 0; // remember the last open page during session
@ -88,16 +88,14 @@ DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR( PCB_EDIT_FRAME* aP
m_itemsGrid->SetDefaultRowSize( m_itemsGrid->GetDefaultRowSize() + 4 );
m_modelsGrid->SetDefaultRowSize( m_modelsGrid->GetDefaultRowSize() + 4 );
// wxGrid::SetTable() messes up the column widths; use GRID_TRICKS version instead
GRID_TRICKS::SetGridTable( m_itemsGrid, m_texts );
m_itemsGrid->SetTable( m_texts );
m_itemsGrid->PushEventHandler( new GRID_TRICKS( m_itemsGrid ) );
m_modelsGrid->PushEventHandler( new GRID_TRICKS( m_modelsGrid ) );
// Show/hide text item columns according to the user's preference
wxString shownColumns;
m_config->Read( FootprintTextShownColumnsKey, &shownColumns, wxT( "0 1 2 3 4 5 6" ) );
GRID_TRICKS::ShowHideGridColumns( m_itemsGrid, shownColumns );
m_itemsGrid->ShowHideColumns( shownColumns );
// Set up the 3D models grid
wxGridCellAttr* attr = new wxGridCellAttr;
@ -156,10 +154,10 @@ DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR( PCB_EDIT_FRAME* aP
DIALOG_FOOTPRINT_BOARD_EDITOR::~DIALOG_FOOTPRINT_BOARD_EDITOR()
{
m_config->Write( FootprintTextShownColumnsKey, GRID_TRICKS::GetShownColumns( m_itemsGrid ) );
m_config->Write( FootprintTextShownColumnsKey, m_itemsGrid->GetShownColumns() );
// Prevents crash bug in wxGrid's d'tor
GRID_TRICKS::DestroyGridTable( m_itemsGrid, m_texts );
m_itemsGrid->DestroyTable( m_texts );
// Delete the GRID_TRICKS.
m_itemsGrid->PopEventHandler( true );

View File

@ -5,8 +5,8 @@
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "text_mod_grid_table.h"
#include "widgets/text_ctrl_eval.h"
#include "widgets/wx_grid.h"
#include "dialog_edit_footprint_for_BoardEditor_base.h"
@ -26,7 +26,7 @@ DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::DIALOG_FOOTPRINT_BOARD_EDITOR_BASE( wxWindow
wxStaticBoxSizer* sbSizerTexts;
sbSizerTexts = new wxStaticBoxSizer( new wxStaticBox( m_PanelGeneral, wxID_ANY, wxEmptyString ), wxVERTICAL );
m_itemsGrid = new TEXT_MOD_GRID( sbSizerTexts->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), 0 );
m_itemsGrid = new WX_GRID( sbSizerTexts->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), 0 );
// Grid
m_itemsGrid->CreateGrid( 2, 11 );
@ -117,7 +117,7 @@ DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::DIALOG_FOOTPRINT_BOARD_EDITOR_BASE( wxWindow
m_XPosLabel->Wrap( -1 );
fgSizerPos->Add( m_XPosLabel, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 );
m_ModPositionX = new TEXT_CTRL_EVAL( m_PanelGeneral, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_ModPositionX = new wxTextCtrl( m_PanelGeneral, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerPos->Add( m_ModPositionX, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP, 5 );
m_XPosUnit = new wxStaticText( m_PanelGeneral, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
@ -128,7 +128,7 @@ DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::DIALOG_FOOTPRINT_BOARD_EDITOR_BASE( wxWindow
m_YPosLabel->Wrap( -1 );
fgSizerPos->Add( m_YPosLabel, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_ModPositionY = new TEXT_CTRL_EVAL( m_PanelGeneral, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_ModPositionY = new wxTextCtrl( m_PanelGeneral, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerPos->Add( m_ModPositionY, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM, 5 );
m_YPosUnit = new wxStaticText( m_PanelGeneral, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
@ -307,7 +307,7 @@ DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::DIALOG_FOOTPRINT_BOARD_EDITOR_BASE( wxWindow
fgSizerClearances->Add( m_NetClearanceLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_NetClearanceCtrl = new TEXT_CTRL_EVAL( sbSizerLocalProperties->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_NetClearanceCtrl = new wxTextCtrl( sbSizerLocalProperties->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerClearances->Add( m_NetClearanceCtrl, 1, wxEXPAND|wxALL, 5 );
m_NetClearanceUnits = new wxStaticText( sbSizerLocalProperties->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
@ -320,7 +320,7 @@ DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::DIALOG_FOOTPRINT_BOARD_EDITOR_BASE( wxWindow
fgSizerClearances->Add( m_SolderMaskMarginLabel, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_SolderMaskMarginCtrl = new TEXT_CTRL_EVAL( sbSizerLocalProperties->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SolderMaskMarginCtrl = new wxTextCtrl( sbSizerLocalProperties->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerClearances->Add( m_SolderMaskMarginCtrl, 1, wxALL|wxEXPAND, 5 );
m_SolderMaskMarginUnits = new wxStaticText( sbSizerLocalProperties->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
@ -333,7 +333,7 @@ DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::DIALOG_FOOTPRINT_BOARD_EDITOR_BASE( wxWindow
fgSizerClearances->Add( m_SolderPasteMarginLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_SolderPasteMarginCtrl = new TEXT_CTRL_EVAL( sbSizerLocalProperties->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SolderPasteMarginCtrl = new wxTextCtrl( sbSizerLocalProperties->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerClearances->Add( m_SolderPasteMarginCtrl, 1, wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_SolderPasteMarginUnits = new wxStaticText( sbSizerLocalProperties->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );

View File

@ -351,7 +351,7 @@
<property name="rows">2</property>
<property name="show">1</property>
<property name="size">-1,-1</property>
<property name="subclass">TEXT_MOD_GRID; text_mod_grid_table.h; forward_declare</property>
<property name="subclass">WX_GRID; widgets/wx_grid.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
@ -641,11 +641,11 @@
<property name="name">bSizerLeft</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">private</property>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxFlexGridSizer" expanded="0">
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">3</property>
<property name="flexible_direction">wxHORIZONTAL</property>
<property name="growablecols">1</property>
@ -791,7 +791,7 @@
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">TEXT_CTRL_EVAL; widgets/text_ctrl_eval.h</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
@ -1048,7 +1048,7 @@
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">TEXT_CTRL_EVAL; widgets/text_ctrl_eval.h</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
@ -2376,20 +2376,20 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">8</property>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerRight</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bButtonsSizer</property>
<property name="orient">wxVERTICAL</property>
@ -2850,11 +2850,11 @@
<property name="name">bSizerPanelClearances</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">10</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="0">
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Clearances</property>
<property name="minimum_size"></property>
@ -3112,11 +3112,11 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxFlexGridSizer" expanded="0">
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">3</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">1</property>
@ -3262,7 +3262,7 @@
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">TEXT_CTRL_EVAL; widgets/text_ctrl_eval.h</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
@ -3519,7 +3519,7 @@
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">TEXT_CTRL_EVAL; widgets/text_ctrl_eval.h</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
@ -3776,7 +3776,7 @@
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">TEXT_CTRL_EVAL; widgets/text_ctrl_eval.h</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
@ -4243,11 +4243,11 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">10</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxStaticBoxSizer" expanded="0">
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Connection to Copper Zones</property>
<property name="minimum_size"></property>

View File

@ -12,7 +12,7 @@
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class TEXT_CTRL_EVAL;
class TEXT_MOD_GRID;
class WX_GRID;
#include "dialog_shim.h"
#include <wx/colour.h>
@ -60,14 +60,14 @@ class DIALOG_FOOTPRINT_BOARD_EDITOR_BASE : public DIALOG_SHIM
protected:
wxNotebook* m_NoteBook;
wxPanel* m_PanelGeneral;
TEXT_MOD_GRID* m_itemsGrid;
WX_GRID* m_itemsGrid;
wxBitmapButton* m_bpAdd;
wxBitmapButton* m_bpDelete;
wxStaticText* m_XPosLabel;
TEXT_CTRL_EVAL* m_ModPositionX;
wxTextCtrl* m_ModPositionX;
wxStaticText* m_XPosUnit;
wxStaticText* m_YPosLabel;
TEXT_CTRL_EVAL* m_ModPositionY;
wxTextCtrl* m_ModPositionY;
wxStaticText* m_YPosUnit;
wxRadioButton* m_Orient0;
wxRadioButton* m_Orient90;
@ -90,13 +90,13 @@ class DIALOG_FOOTPRINT_BOARD_EDITOR_BASE : public DIALOG_SHIM
wxStaticText* m_staticTextInfoValPos;
wxStaticText* m_staticTextInfoValNeg;
wxStaticText* m_NetClearanceLabel;
TEXT_CTRL_EVAL* m_NetClearanceCtrl;
wxTextCtrl* m_NetClearanceCtrl;
wxStaticText* m_NetClearanceUnits;
wxStaticText* m_SolderMaskMarginLabel;
TEXT_CTRL_EVAL* m_SolderMaskMarginCtrl;
wxTextCtrl* m_SolderMaskMarginCtrl;
wxStaticText* m_SolderMaskMarginUnits;
wxStaticText* m_SolderPasteMarginLabel;
TEXT_CTRL_EVAL* m_SolderPasteMarginCtrl;
wxTextCtrl* m_SolderPasteMarginCtrl;
wxStaticText* m_SolderPasteMarginUnits;
wxStaticText* m_staticTextRatio;
TEXT_CTRL_EVAL* m_SolderPasteMarginRatioCtrl;

View File

@ -39,8 +39,8 @@
#include <board_design_settings.h>
#include <board_commit.h>
#include <bitmaps.h>
#include <widgets/wx_grid.h>
#include <widgets/text_ctrl_eval.h>
#include <class_module.h>
#include <footprint_edit_frame.h>
#include <dialog_edit_footprint_for_fp_editor.h>
@ -60,8 +60,7 @@ int DIALOG_FOOTPRINT_FP_EDITOR::m_page = 0; // remember the last open page d
DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR( FOOTPRINT_EDIT_FRAME* aParent,
MODULE* aModule ) :
DIALOG_FOOTPRINT_FP_EDITOR_BASE( aParent ),
m_netClearance( aParent, m_NetClearanceLabel, m_NetClearanceCtrl, m_NetClearanceUnits,
false, 0 ),
m_netClearance( aParent, m_NetClearanceLabel, m_NetClearanceCtrl, m_NetClearanceUnits, false, 0 ),
m_solderMask( aParent, m_SolderMaskMarginLabel, m_SolderMaskMarginCtrl, m_SolderMaskMarginUnits ),
m_solderPaste( aParent, m_SolderPasteMarginLabel, m_SolderPasteMarginCtrl, m_SolderPasteMarginUnits )
{
@ -86,16 +85,14 @@ DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR( FOOTPRINT_EDIT_FRAME* aP
m_itemsGrid->SetDefaultRowSize( m_itemsGrid->GetDefaultRowSize() + 4 );
m_modelsGrid->SetDefaultRowSize( m_modelsGrid->GetDefaultRowSize() + 4 );
// wxGrid::SetTable() messes up the column widths; use GRID_TRICKS version instead
GRID_TRICKS::SetGridTable( m_itemsGrid, m_texts );
m_itemsGrid->SetTable( m_texts );
m_itemsGrid->PushEventHandler( new GRID_TRICKS( m_itemsGrid ) );
m_modelsGrid->PushEventHandler( new GRID_TRICKS( m_modelsGrid ) );
// Show/hide columns according to the user's preference
wxString shownColumns;
m_config->Read( LibFootprintTextShownColumnsKey, &shownColumns, wxT( "0 1 2 3 4 5 6" ) );
GRID_TRICKS::ShowHideGridColumns( m_itemsGrid, shownColumns );
m_itemsGrid->ShowHideColumns( shownColumns );
wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
infoFont.SetSymbolicSize( wxFONTSIZE_SMALL );
@ -150,10 +147,10 @@ DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR( FOOTPRINT_EDIT_FRAME* aP
DIALOG_FOOTPRINT_FP_EDITOR::~DIALOG_FOOTPRINT_FP_EDITOR()
{
m_config->Write( LibFootprintTextShownColumnsKey, GRID_TRICKS::GetShownColumns( m_itemsGrid ) );
m_config->Write( LibFootprintTextShownColumnsKey, m_itemsGrid->GetShownColumns() );
// Prevents crash bug in wxGrid's d'tor
GRID_TRICKS::DestroyGridTable( m_itemsGrid, m_texts );
m_itemsGrid->DestroyTable( m_texts );
// Delete the GRID_TRICKS.
m_itemsGrid->PopEventHandler( true );

View File

@ -5,8 +5,8 @@
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "text_mod_grid_table.h"
#include "widgets/text_ctrl_eval.h"
#include "widgets/wx_grid.h"
#include "dialog_edit_footprint_for_fp_editor_base.h"
@ -26,7 +26,7 @@ DIALOG_FOOTPRINT_FP_EDITOR_BASE::DIALOG_FOOTPRINT_FP_EDITOR_BASE( wxWindow* pare
wxStaticBoxSizer* sbSizerTexts;
sbSizerTexts = new wxStaticBoxSizer( new wxStaticBox( m_PanelGeneral, wxID_ANY, wxEmptyString ), wxVERTICAL );
m_itemsGrid = new TEXT_MOD_GRID( sbSizerTexts->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), 0 );
m_itemsGrid = new WX_GRID( sbSizerTexts->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), 0 );
// Grid
m_itemsGrid->CreateGrid( 2, 11 );
@ -237,7 +237,7 @@ DIALOG_FOOTPRINT_FP_EDITOR_BASE::DIALOG_FOOTPRINT_FP_EDITOR_BASE( wxWindow* pare
fgSizerClearances->Add( m_NetClearanceLabel, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_NetClearanceCtrl = new TEXT_CTRL_EVAL( sbSizerLocalProperties->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_NetClearanceCtrl = new wxTextCtrl( sbSizerLocalProperties->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerClearances->Add( m_NetClearanceCtrl, 1, wxEXPAND|wxALL, 5 );
m_NetClearanceUnits = new wxStaticText( sbSizerLocalProperties->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
@ -250,7 +250,7 @@ DIALOG_FOOTPRINT_FP_EDITOR_BASE::DIALOG_FOOTPRINT_FP_EDITOR_BASE( wxWindow* pare
fgSizerClearances->Add( m_SolderMaskMarginLabel, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
m_SolderMaskMarginCtrl = new TEXT_CTRL_EVAL( sbSizerLocalProperties->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SolderMaskMarginCtrl = new wxTextCtrl( sbSizerLocalProperties->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerClearances->Add( m_SolderMaskMarginCtrl, 1, wxALL|wxEXPAND, 5 );
m_SolderMaskMarginUnits = new wxStaticText( sbSizerLocalProperties->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
@ -263,7 +263,7 @@ DIALOG_FOOTPRINT_FP_EDITOR_BASE::DIALOG_FOOTPRINT_FP_EDITOR_BASE( wxWindow* pare
fgSizerClearances->Add( m_SolderPasteMarginLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_SolderPasteMarginCtrl = new TEXT_CTRL_EVAL( sbSizerLocalProperties->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_SolderPasteMarginCtrl = new wxTextCtrl( sbSizerLocalProperties->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerClearances->Add( m_SolderPasteMarginCtrl, 1, wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_SolderPasteMarginUnits = new wxStaticText( sbSizerLocalProperties->GetStaticBox(), wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );

View File

@ -351,7 +351,7 @@
<property name="rows">2</property>
<property name="show">1</property>
<property name="size">-1,-1</property>
<property name="subclass">TEXT_MOD_GRID; text_mod_grid_table.h; forward_declare</property>
<property name="subclass">WX_GRID; widgets/wx_grid.h; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
@ -2437,7 +2437,7 @@
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">TEXT_CTRL_EVAL; widgets/text_ctrl_eval.h</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
@ -2694,7 +2694,7 @@
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">TEXT_CTRL_EVAL; widgets/text_ctrl_eval.h</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
@ -2951,7 +2951,7 @@
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">TEXT_CTRL_EVAL; widgets/text_ctrl_eval.h</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>

View File

@ -12,7 +12,7 @@
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class TEXT_CTRL_EVAL;
class TEXT_MOD_GRID;
class WX_GRID;
#include "dialog_shim.h"
#include <wx/colour.h>
@ -52,7 +52,7 @@ class DIALOG_FOOTPRINT_FP_EDITOR_BASE : public DIALOG_SHIM
protected:
wxNotebook* m_NoteBook;
wxPanel* m_PanelGeneral;
TEXT_MOD_GRID* m_itemsGrid;
WX_GRID* m_itemsGrid;
wxBitmapButton* m_bpAdd;
wxBitmapButton* m_bpDelete;
wxStaticText* m_libraryName;
@ -71,13 +71,13 @@ class DIALOG_FOOTPRINT_FP_EDITOR_BASE : public DIALOG_SHIM
wxStaticText* m_staticTextInfoValPos;
wxStaticText* m_staticTextInfoValNeg;
wxStaticText* m_NetClearanceLabel;
TEXT_CTRL_EVAL* m_NetClearanceCtrl;
wxTextCtrl* m_NetClearanceCtrl;
wxStaticText* m_NetClearanceUnits;
wxStaticText* m_SolderMaskMarginLabel;
TEXT_CTRL_EVAL* m_SolderMaskMarginCtrl;
wxTextCtrl* m_SolderMaskMarginCtrl;
wxStaticText* m_SolderMaskMarginUnits;
wxStaticText* m_SolderPasteMarginLabel;
TEXT_CTRL_EVAL* m_SolderPasteMarginCtrl;
wxTextCtrl* m_SolderPasteMarginCtrl;
wxStaticText* m_SolderPasteMarginUnits;
wxStaticText* m_staticTextRatio;
TEXT_CTRL_EVAL* m_SolderPasteMarginRatioCtrl;

View File

@ -336,31 +336,3 @@ void TEXT_MOD_GRID_TABLE::SetValueAsLong( int aRow, int aCol, long aValue )
}
}
// An override of wxGrid::DrawColLabel which left-aligns the first column.
void TEXT_MOD_GRID::DrawColLabel( wxDC& dc, int col )
{
if( GetColWidth( col ) <= 0 || m_colLabelHeight <= 0 )
return;
int colLeft = GetColLeft( col );
wxRect rect( colLeft, 0, GetColWidth( col ), m_colLabelHeight );
static wxGridColumnHeaderRendererDefault rend;
// It is reported that we need to erase the background to avoid display
// artefacts, see #12055.
wxDCBrushChanger setBrush( dc, m_colWindow->GetBackgroundColour() );
dc.DrawRectangle(rect);
rend.DrawBorder( *this, dc, rect );
int hAlign, vAlign;
GetColLabelAlignment( &hAlign, &vAlign );
const int orient = GetColLabelTextOrientation();
if( col == 0 )
hAlign = wxALIGN_LEFT;
rend.DrawLabel( *this, dc, GetColLabelValue( col ), rect, hAlign, vAlign, orient );
}

View File

@ -91,20 +91,4 @@ private:
};
// A sub-class of wxGrid which draws the first column label left-aligned.
class TEXT_MOD_GRID : public wxGrid
{
public:
TEXT_MOD_GRID( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxWANTS_CHARS, const wxString& name = wxGridNameStr ) :
wxGrid( parent, id, pos, size, style, name )
{
}
void DrawColLabel( wxDC& dc, int col ) override;
};
#endif // TEXT_MOD_GRID_TABLE_H