diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index d851279c60..486251c341 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -312,7 +312,7 @@ set( PCBNEW_CLASS_SRCS specctra_import_export/specctra.cpp specctra_import_export/specctra_export.cpp specctra_import_export/specctra_import.cpp - text_mod_grid_table.cpp + fp_text_grid_table.cpp toolbars_footprint_editor.cpp toolbars_footprint_viewer.cpp toolbars_pcb_editor.cpp diff --git a/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor.cpp b/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor.cpp index 654b2efd69..27d7dc9849 100644 --- a/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor.cpp +++ b/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor.cpp @@ -64,7 +64,7 @@ DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR( FOOTPRINT_EDIT_FRAME* aP m_frame = aParent; m_footprint = aFootprint; - m_texts = new TEXT_MOD_GRID_TABLE( m_units, m_frame ); + m_texts = new FP_TEXT_GRID_TABLE( m_units, m_frame ); m_delayedErrorMessage = wxEmptyString; m_delayedFocusCtrl = nullptr; @@ -573,7 +573,7 @@ bool DIALOG_FOOTPRINT_FP_EDITOR::Validate() m_delayedErrorMessage = _( "Text items must have some content." ); m_delayedFocusGrid = m_itemsGrid; - m_delayedFocusColumn = TMC_TEXT; + m_delayedFocusColumn = FPT_TEXT; m_delayedFocusRow = i; return false; diff --git a/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor.h b/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor.h index 8fcb452f63..0f77345a2c 100644 --- a/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor.h +++ b/pcbnew/dialogs/dialog_edit_footprint_for_fp_editor.h @@ -26,7 +26,7 @@ #define DIALOG_EDIT_FOOTPRINT_FOR_FP_EDITOR_H #include -#include +#include #include #include #include @@ -44,7 +44,7 @@ private: static int m_page; // remember the last open page during session - TEXT_MOD_GRID_TABLE* m_texts; + FP_TEXT_GRID_TABLE* m_texts; UNIT_BINDER m_netClearance; UNIT_BINDER m_solderMask; diff --git a/pcbnew/dialogs/dialog_footprint_properties.cpp b/pcbnew/dialogs/dialog_footprint_properties.cpp index 041622362a..9c066ebc81 100644 --- a/pcbnew/dialogs/dialog_footprint_properties.cpp +++ b/pcbnew/dialogs/dialog_footprint_properties.cpp @@ -73,7 +73,7 @@ DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParen for( size_t i = 0; i < m_NoteBook->GetPageCount(); ++i ) m_macHack.push_back( true ); - m_texts = new TEXT_MOD_GRID_TABLE( m_units, m_frame ); + m_texts = new FP_TEXT_GRID_TABLE( m_units, m_frame ); m_delayedErrorMessage = wxEmptyString; m_delayedFocusGrid = nullptr; @@ -628,7 +628,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES::Validate() m_delayedFocusGrid = m_itemsGrid; m_delayedErrorMessage = _( "Text items must have some content." ); - m_delayedFocusColumn = TMC_TEXT; + m_delayedFocusColumn = FPT_TEXT; m_delayedFocusRow = i; return false; diff --git a/pcbnew/dialogs/dialog_footprint_properties.h b/pcbnew/dialogs/dialog_footprint_properties.h index 8e383db96b..8c9eea4012 100644 --- a/pcbnew/dialogs/dialog_footprint_properties.h +++ b/pcbnew/dialogs/dialog_footprint_properties.h @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include @@ -58,7 +58,7 @@ private: static int m_page; // remember the last open page during session - TEXT_MOD_GRID_TABLE* m_texts; + FP_TEXT_GRID_TABLE* m_texts; UNIT_BINDER m_posX; UNIT_BINDER m_posY; wxFloatingPointValidator m_OrientValidator; diff --git a/pcbnew/text_mod_grid_table.cpp b/pcbnew/fp_text_grid_table.cpp similarity index 70% rename from pcbnew/text_mod_grid_table.cpp rename to pcbnew/fp_text_grid_table.cpp index 899c174969..882f8b9b6a 100644 --- a/pcbnew/text_mod_grid_table.cpp +++ b/pcbnew/fp_text_grid_table.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include #include @@ -39,7 +39,7 @@ enum wxArrayString g_menuOrientations; -TEXT_MOD_GRID_TABLE::TEXT_MOD_GRID_TABLE( EDA_UNITS aUserUnits, PCB_BASE_FRAME* aFrame ) +FP_TEXT_GRID_TABLE::FP_TEXT_GRID_TABLE( EDA_UNITS aUserUnits, PCB_BASE_FRAME* aFrame ) : m_userUnits( aUserUnits ), m_frame( aFrame ) { // Build the column attributes. @@ -73,7 +73,7 @@ TEXT_MOD_GRID_TABLE::TEXT_MOD_GRID_TABLE( EDA_UNITS aUserUnits, PCB_BASE_FRAME* } -TEXT_MOD_GRID_TABLE::~TEXT_MOD_GRID_TABLE() +FP_TEXT_GRID_TABLE::~FP_TEXT_GRID_TABLE() { m_readOnlyAttr->DecRef(); m_boolColAttr->DecRef(); @@ -82,27 +82,27 @@ TEXT_MOD_GRID_TABLE::~TEXT_MOD_GRID_TABLE() } -wxString TEXT_MOD_GRID_TABLE::GetColLabelValue( int aCol ) +wxString FP_TEXT_GRID_TABLE::GetColLabelValue( int aCol ) { switch( aCol ) { - case TMC_TEXT: return _( "Text Items" ); - case TMC_SHOWN: return _( "Show" ); - case TMC_WIDTH: return _( "Width" ); - case TMC_HEIGHT: return _( "Height" ); - case TMC_THICKNESS: return _( "Thickness" ); - case TMC_ITALIC: return _( "Italic" ); - case TMC_LAYER: return _( "Layer" ); - case TMC_ORIENTATION: return _( "Orientation" ); - case TMC_UPRIGHT: return _( "Keep Upright" ); - case TMC_XOFFSET: return _( "X Offset" ); - case TMC_YOFFSET: return _( "Y Offset" ); + case FPT_TEXT: return _( "Text Items" ); + case FPT_SHOWN: return _( "Show" ); + case FPT_WIDTH: return _( "Width" ); + case FPT_HEIGHT: return _( "Height" ); + case FPT_THICKNESS: return _( "Thickness" ); + case FPT_ITALIC: return _( "Italic" ); + case FPT_LAYER: return _( "Layer" ); + case FPT_ORIENTATION: return _( "Orientation" ); + case FPT_UPRIGHT: return _( "Keep Upright" ); + case FPT_XOFFSET: return _( "X Offset" ); + case FPT_YOFFSET: return _( "Y Offset" ); default: wxFAIL; return wxEmptyString; } } -wxString TEXT_MOD_GRID_TABLE::GetRowLabelValue( int aRow ) +wxString FP_TEXT_GRID_TABLE::GetRowLabelValue( int aRow ) { switch( aRow ) { @@ -113,25 +113,25 @@ wxString TEXT_MOD_GRID_TABLE::GetRowLabelValue( int aRow ) } -bool TEXT_MOD_GRID_TABLE::CanGetValueAs( int aRow, int aCol, const wxString& aTypeName ) +bool FP_TEXT_GRID_TABLE::CanGetValueAs( int aRow, int aCol, const wxString& aTypeName ) { switch( aCol ) { - case TMC_TEXT: - case TMC_WIDTH: - case TMC_HEIGHT: - case TMC_THICKNESS: - case TMC_ORIENTATION: - case TMC_XOFFSET: - case TMC_YOFFSET: + case FPT_TEXT: + case FPT_WIDTH: + case FPT_HEIGHT: + case FPT_THICKNESS: + case FPT_ORIENTATION: + case FPT_XOFFSET: + case FPT_YOFFSET: return aTypeName == wxGRID_VALUE_STRING; - case TMC_SHOWN: - case TMC_ITALIC: - case TMC_UPRIGHT: + case FPT_SHOWN: + case FPT_ITALIC: + case FPT_UPRIGHT: return aTypeName == wxGRID_VALUE_BOOL; - case TMC_LAYER: + case FPT_LAYER: return aTypeName == wxGRID_VALUE_NUMBER; default: @@ -141,35 +141,35 @@ bool TEXT_MOD_GRID_TABLE::CanGetValueAs( int aRow, int aCol, const wxString& aTy } -bool TEXT_MOD_GRID_TABLE::CanSetValueAs( int aRow, int aCol, const wxString& aTypeName ) +bool FP_TEXT_GRID_TABLE::CanSetValueAs( int aRow, int aCol, const wxString& aTypeName ) { return CanGetValueAs( aRow, aCol, aTypeName ); } -wxGridCellAttr* TEXT_MOD_GRID_TABLE::GetAttr( int aRow, int aCol, wxGridCellAttr::wxAttrKind ) +wxGridCellAttr* FP_TEXT_GRID_TABLE::GetAttr( int aRow, int aCol, wxGridCellAttr::wxAttrKind ) { switch( aCol ) { - case TMC_TEXT: - case TMC_WIDTH: - case TMC_HEIGHT: - case TMC_THICKNESS: - case TMC_XOFFSET: - case TMC_YOFFSET: + case FPT_TEXT: + case FPT_WIDTH: + case FPT_HEIGHT: + case FPT_THICKNESS: + case FPT_XOFFSET: + case FPT_YOFFSET: return nullptr; - case TMC_SHOWN: - case TMC_ITALIC: - case TMC_UPRIGHT: + case FPT_SHOWN: + case FPT_ITALIC: + case FPT_UPRIGHT: m_boolColAttr->IncRef(); return m_boolColAttr; - case TMC_LAYER: + case FPT_LAYER: m_layerColAttr->IncRef(); return m_layerColAttr; - case TMC_ORIENTATION: + case FPT_ORIENTATION: m_orientationColAttr->IncRef(); return m_orientationColAttr; @@ -180,35 +180,35 @@ wxGridCellAttr* TEXT_MOD_GRID_TABLE::GetAttr( int aRow, int aCol, wxGridCellAttr } -wxString TEXT_MOD_GRID_TABLE::GetValue( int aRow, int aCol ) +wxString FP_TEXT_GRID_TABLE::GetValue( int aRow, int aCol ) { const FP_TEXT& text = this->at((size_t) aRow ); switch( aCol ) { - case TMC_TEXT: + case FPT_TEXT: return text.GetText(); - case TMC_WIDTH: + case FPT_WIDTH: return StringFromValue( m_userUnits, text.GetTextWidth() ); - case TMC_HEIGHT: + case FPT_HEIGHT: return StringFromValue( m_userUnits, text.GetTextHeight() ); - case TMC_THICKNESS: + case FPT_THICKNESS: return StringFromValue( m_userUnits, text.GetTextThickness() ); - case TMC_LAYER: + case FPT_LAYER: return text.GetLayerName(); - case TMC_ORIENTATION: + case FPT_ORIENTATION: return StringFromValue( EDA_UNITS::DEGREES, (int) NormalizeAnglePos( text.GetTextAngle() ), true ); - case TMC_XOFFSET: + case FPT_XOFFSET: return StringFromValue( m_userUnits, text.GetPos0().x ); - case TMC_YOFFSET: + case FPT_YOFFSET: return StringFromValue( m_userUnits, text.GetPos0().y ); default: @@ -219,15 +219,15 @@ wxString TEXT_MOD_GRID_TABLE::GetValue( int aRow, int aCol ) } -bool TEXT_MOD_GRID_TABLE::GetValueAsBool( int aRow, int aCol ) +bool FP_TEXT_GRID_TABLE::GetValueAsBool( int aRow, int aCol ) { FP_TEXT& text = this->at((size_t) aRow ); switch( aCol ) { - case TMC_SHOWN: return text.IsVisible(); - case TMC_ITALIC: return text.IsItalic(); - case TMC_UPRIGHT: return text.IsKeepUpright(); + case FPT_SHOWN: return text.IsVisible(); + case FPT_ITALIC: return text.IsItalic(); + case FPT_UPRIGHT: return text.IsKeepUpright(); default: wxFAIL_MSG( wxString::Format( wxT( "column %d doesn't hold a bool value" ), aCol ) ); return false; @@ -235,13 +235,13 @@ bool TEXT_MOD_GRID_TABLE::GetValueAsBool( int aRow, int aCol ) } -long TEXT_MOD_GRID_TABLE::GetValueAsLong( int aRow, int aCol ) +long FP_TEXT_GRID_TABLE::GetValueAsLong( int aRow, int aCol ) { FP_TEXT& text = this->at((size_t) aRow ); switch( aCol ) { - case TMC_LAYER: return text.GetLayer(); + case FPT_LAYER: return text.GetLayer(); default: wxFAIL_MSG( wxString::Format( wxT( "column %d doesn't hold a long value" ), aCol ) ); return 0; @@ -249,38 +249,38 @@ long TEXT_MOD_GRID_TABLE::GetValueAsLong( int aRow, int aCol ) } -void TEXT_MOD_GRID_TABLE::SetValue( int aRow, int aCol, const wxString &aValue ) +void FP_TEXT_GRID_TABLE::SetValue( int aRow, int aCol, const wxString &aValue ) { FP_TEXT& text = this->at((size_t) aRow ); wxPoint pos; switch( aCol ) { - case TMC_TEXT: + case FPT_TEXT: text.SetText( aValue ); break; - case TMC_WIDTH: + case FPT_WIDTH: text.SetTextWidth( ValueFromString( m_userUnits, aValue ) ); break; - case TMC_HEIGHT: + case FPT_HEIGHT: text.SetTextHeight( ValueFromString( m_userUnits, aValue ) ); break; - case TMC_THICKNESS:text.SetTextThickness( ValueFromString( m_userUnits, aValue ) ); + case FPT_THICKNESS:text.SetTextThickness( ValueFromString( m_userUnits, aValue ) ); break; - case TMC_ORIENTATION: + case FPT_ORIENTATION: text.SetTextAngle( DoubleValueFromString( EDA_UNITS::DEGREES, aValue ) ); text.SetDrawCoord(); break; - case TMC_XOFFSET: - case TMC_YOFFSET: + case FPT_XOFFSET: + case FPT_YOFFSET: pos = text.GetPos0(); - if( aCol == TMC_XOFFSET ) + if( aCol == FPT_XOFFSET ) pos.x = ValueFromString( m_userUnits, aValue ); else pos.y = ValueFromString( m_userUnits, aValue ); @@ -298,21 +298,21 @@ void TEXT_MOD_GRID_TABLE::SetValue( int aRow, int aCol, const wxString &aValue ) } -void TEXT_MOD_GRID_TABLE::SetValueAsBool( int aRow, int aCol, bool aValue ) +void FP_TEXT_GRID_TABLE::SetValueAsBool( int aRow, int aCol, bool aValue ) { FP_TEXT& text = this->at((size_t) aRow ); switch( aCol ) { - case TMC_SHOWN: + case FPT_SHOWN: text.SetVisible( aValue ); break; - case TMC_ITALIC: + case FPT_ITALIC: text.SetItalic( aValue ); break; - case TMC_UPRIGHT:text.SetKeepUpright( aValue ); + case FPT_UPRIGHT:text.SetKeepUpright( aValue ); break; default: @@ -322,13 +322,13 @@ void TEXT_MOD_GRID_TABLE::SetValueAsBool( int aRow, int aCol, bool aValue ) } -void TEXT_MOD_GRID_TABLE::SetValueAsLong( int aRow, int aCol, long aValue ) +void FP_TEXT_GRID_TABLE::SetValueAsLong( int aRow, int aCol, long aValue ) { FP_TEXT& text = this->at((size_t) aRow ); switch( aCol ) { - case TMC_LAYER: + case FPT_LAYER: text.SetLayer( ToLAYER_ID( (int) aValue ) ); text.SetMirrored( IsBackLayer( text.GetLayer() ) ); break; diff --git a/pcbnew/text_mod_grid_table.h b/pcbnew/fp_text_grid_table.h similarity index 79% rename from pcbnew/text_mod_grid_table.h rename to pcbnew/fp_text_grid_table.h index 406c85846f..bdea262307 100644 --- a/pcbnew/text_mod_grid_table.h +++ b/pcbnew/fp_text_grid_table.h @@ -21,8 +21,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef TEXT_MOD_GRID_TABLE_H -#define TEXT_MOD_GRID_TABLE_H +#ifndef FP_TEXT_GRID_TABLE_H +#define FP_TEXT_GRID_TABLE_H #include #include @@ -33,32 +33,32 @@ class FOOTPRINT; class PCB_BASE_FRAME; -enum TEXT_MOD_COL_ORDER +enum FP_TEXT_COL_ORDER { - TMC_TEXT, - TMC_SHOWN, - TMC_WIDTH, - TMC_HEIGHT, - TMC_THICKNESS, - TMC_ITALIC, - TMC_LAYER, - TMC_ORIENTATION, - TMC_UPRIGHT, // keep text upright when viewed from bottom or right of board - TMC_XOFFSET, - TMC_YOFFSET, + FPT_TEXT, + FPT_SHOWN, + FPT_WIDTH, + FPT_HEIGHT, + FPT_THICKNESS, + FPT_ITALIC, + FPT_LAYER, + FPT_ORIENTATION, + FPT_UPRIGHT, // keep text upright when viewed from bottom or right of board + FPT_XOFFSET, + FPT_YOFFSET, - TMC_COUNT // keep as last + FPT_COUNT // keep as last }; -class TEXT_MOD_GRID_TABLE : public wxGridTableBase, public std::vector +class FP_TEXT_GRID_TABLE : public wxGridTableBase, public std::vector { public: - TEXT_MOD_GRID_TABLE( EDA_UNITS userUnits, PCB_BASE_FRAME* aFrame ); - ~TEXT_MOD_GRID_TABLE(); + FP_TEXT_GRID_TABLE( EDA_UNITS userUnits, PCB_BASE_FRAME* aFrame ); + ~FP_TEXT_GRID_TABLE(); int GetNumberRows() override { return (int) size(); } - int GetNumberCols() override { return TMC_COUNT; } + int GetNumberCols() override { return FPT_COUNT; } wxString GetColLabelValue( int aCol ) override; wxString GetRowLabelValue( int aRow ) override; @@ -91,4 +91,4 @@ private: }; -#endif // TEXT_MOD_GRID_TABLE_H +#endif // FP_TEXT_GRID_TABLE_H