7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-03-30 05:46:55 +00:00

Finish eradication of visibility flag on text items.

Import/read previously-hidden symbol/footprint
text items as hidden fields.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19875
This commit is contained in:
Jeff Young 2025-02-11 12:55:33 +00:00
parent 40daacbeeb
commit 5edae8250d
59 changed files with 336 additions and 378 deletions
3d-viewer/3d_canvas
api/proto
common
eeschema
include
pcbnew
qa/tests/common

View File

@ -215,7 +215,7 @@ void BOARD_ADAPTER::addFootprintShapes( const FOOTPRINT* aFootprint, CONTAINER_2
{
PCB_TEXT* text = static_cast<PCB_TEXT*>( item );
if( text->GetLayer() == aLayerId && text->IsVisible() )
if( text->GetLayer() == aLayerId )
{
if( !aVisibilityFlags.test( LAYER_FP_TEXT ) )
continue;

View File

@ -768,6 +768,7 @@ message Field
FieldId id = 1;
string name = 2;
BoardText text = 3;
bool visible = 4;
}
enum FootprintMountingStyle

View File

@ -291,7 +291,8 @@ message TextAttributes
bool italic = 7;
bool bold = 8;
bool underlined = 9;
bool visible = 10;
// Visible now exposed only at the field level
// bool visible = 10;
bool mirrored = 11;
bool multiline = 12;
bool keep_upright = 13;
@ -305,7 +306,7 @@ message Text
kiapi.common.types.Vector2 position = 2;
kiapi.common.types.TextAttributes attributes = 3;
// Reserved for future use; base objects don't support locking right nos
// Reserved for future use; base objects don't support locking right now
//kiapi.common.types.LockedState locked = 4;
string text = 5;
@ -318,7 +319,7 @@ message TextBox
kiapi.common.types.Vector2 bottom_right = 3;
kiapi.common.types.TextAttributes attributes = 4;
// Reserved for future use; base objects don't support locking right nos
// Reserved for future use; base objects don't support locking right now
//kiapi.common.types.LockedState locked = 5;
string text = 6;

View File

@ -48,7 +48,7 @@
#include <font/outline_font.h>
#include <geometry/shape_poly_set.h>
#include <properties/property_validators.h>
#include <ctl_flags.h> // for CTL_OMIT_HIDE definition
#include <ctl_flags.h>
#include <api/api_enums.h>
#include <api/api_utils.h>
#include <api/common/types/base_types.pb.h>
@ -95,7 +95,8 @@ GR_TEXT_V_ALIGN_T EDA_TEXT::MapVertJustify( int aVertJustify )
EDA_TEXT::EDA_TEXT( const EDA_IU_SCALE& aIuScale, const wxString& aText ) :
m_text( aText ),
m_IuScale( aIuScale ),
m_render_cache_font( nullptr )
m_render_cache_font( nullptr ),
m_visible( true )
{
SetTextSize( VECTOR2I( EDA_UNIT_UTILS::Mils2IU( m_IuScale, DEFAULT_SIZE_TEXT ),
EDA_UNIT_UTILS::Mils2IU( m_IuScale, DEFAULT_SIZE_TEXT ) ) );
@ -122,6 +123,7 @@ EDA_TEXT::EDA_TEXT( const EDA_TEXT& aText ) :
m_attributes = aText.m_attributes;
m_pos = aText.m_pos;
m_visible = aText.m_visible;
m_render_cache_font = aText.m_render_cache_font;
m_render_cache_text = aText.m_render_cache_text;
@ -157,6 +159,7 @@ EDA_TEXT& EDA_TEXT::operator=( const EDA_TEXT& aText )
m_attributes = aText.m_attributes;
m_pos = aText.m_pos;
m_visible = aText.m_visible;
m_render_cache_font = aText.m_render_cache_font;
m_render_cache_text = aText.m_render_cache_text;
@ -207,7 +210,6 @@ void EDA_TEXT::Serialize( google::protobuf::Any &aContainer ) const
attrs->set_italic( IsItalic() );
attrs->set_bold( IsBold() );
attrs->set_underlined( GetAttributes().m_Underlined );
attrs->set_visible( IsVisible() );
attrs->set_mirrored( IsMirrored() );
attrs->set_multiline( IsMultilineAllowed() );
attrs->set_keep_upright( IsKeepUpright() );
@ -236,7 +238,6 @@ bool EDA_TEXT::Deserialize( const google::protobuf::Any &aContainer )
attrs.m_Bold = text.attributes().bold();
attrs.m_Italic = text.attributes().italic();
attrs.m_Underlined = text.attributes().underlined();
attrs.m_Visible = text.attributes().visible();
attrs.m_Mirrored = text.attributes().mirrored();
attrs.m_Multiline = text.attributes().multiline();
attrs.m_KeepUpright = text.attributes().keep_upright();
@ -376,7 +377,7 @@ void EDA_TEXT::SetBoldFlag( bool aBold )
void EDA_TEXT::SetVisible( bool aVisible )
{
m_attributes.m_Visible = aVisible;
m_visible = aVisible;
ClearRenderCache();
}
@ -1036,8 +1037,7 @@ void EDA_TEXT::SetFontIndex( int aIdx )
bool EDA_TEXT::IsDefaultFormatting() const
{
return ( IsVisible()
&& !IsMirrored()
return ( !IsMirrored()
&& GetHorizJustify() == GR_TEXT_H_ALIGN_CENTER
&& GetVertJustify() == GR_TEXT_V_ALIGN_CENTER
&& GetTextThickness() == 0
@ -1109,13 +1109,8 @@ void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aControlBits ) const
aFormatter->Print( ")" ); // (justify
}
if( !( aControlBits & CTL_OMIT_HIDE ) && !IsVisible() )
KICAD_FORMAT::FormatBool( aFormatter, "hide", true );
if( !( aControlBits & CTL_OMIT_HYPERLINK ) && HasHyperlink() )
{
aFormatter->Print( "(href %s)", aFormatter->Quotew( GetHyperlink() ).c_str() );
}
aFormatter->Print( ")" ); // (effects
}
@ -1375,9 +1370,6 @@ static struct EDA_TEXT_DESC
propMgr.AddProperty( new PROPERTY<EDA_TEXT, bool>( _HKI( "Mirrored" ),
&EDA_TEXT::SetMirrored, &EDA_TEXT::IsMirrored ),
textProps );
propMgr.AddProperty( new PROPERTY<EDA_TEXT, bool>( _HKI( "Visible" ),
&EDA_TEXT::SetVisible, &EDA_TEXT::IsVisible ),
textProps );
propMgr.AddProperty( new PROPERTY<EDA_TEXT, int>( _HKI( "Width" ),
&EDA_TEXT::SetTextWidth, &EDA_TEXT::GetTextWidth,
PROPERTY_DISPLAY::PT_SIZE ),

View File

@ -32,7 +32,6 @@ TEXT_ATTRIBUTES::TEXT_ATTRIBUTES( KIFONT::FONT* aFont ) :
m_Bold( false ),
m_Underlined( false ),
m_Color( KIGFX::COLOR4D::UNSPECIFIED ),
m_Visible( true ),
m_Mirrored( false ),
m_Multiline( true ),
m_KeepUpright( false ),
@ -93,9 +92,6 @@ int TEXT_ATTRIBUTES::Compare( const TEXT_ATTRIBUTES& aRhs ) const
if( retv )
return retv;
if( m_Visible != aRhs.m_Visible )
return m_Visible - aRhs.m_Visible;
if( m_Mirrored != aRhs.m_Mirrored )
return m_Mirrored - aRhs.m_Mirrored;
@ -125,7 +121,6 @@ std::ostream& operator<<( std::ostream& aStream, const TEXT_ATTRIBUTES& aAttribu
<< "Bold: " << aAttributes.m_Bold << std::endl
<< "Underline: " << aAttributes.m_Underlined << std::endl
<< "Color: " << aAttributes.m_Color << std::endl
<< "Visible " << aAttributes.m_Visible << std::endl
<< "Mirrored " << aAttributes.m_Mirrored << std::endl
<< "Multilined: " << aAttributes.m_Multiline << std::endl
<< "Size: " << aAttributes.m_Size << std::endl

View File

@ -543,17 +543,17 @@ bool DIALOG_FIELD_PROPERTIES::TransferDataFromWindow()
}
void DIALOG_FIELD_PROPERTIES::updateText( EDA_TEXT* aText )
void DIALOG_FIELD_PROPERTIES::updateText( SCH_FIELD* aField )
{
if( aText->GetTextWidth() != m_size )
aText->SetTextSize( VECTOR2I( m_size, m_size ) );
if( aField->GetTextWidth() != m_size )
aField->SetTextSize( VECTOR2I( m_size, m_size ) );
aText->SetFont( m_font );
aText->SetVisible( m_isVisible );
aText->SetTextAngle( m_isVertical ? ANGLE_VERTICAL : ANGLE_HORIZONTAL );
aText->SetItalic( m_isItalic );
aText->SetBold( m_isBold );
aText->SetTextColor( m_color );
aField->SetFont( m_font );
aField->SetVisible( m_isVisible );
aField->SetTextAngle( m_isVertical ? ANGLE_VERTICAL : ANGLE_HORIZONTAL );
aField->SetItalic( m_isItalic );
aField->SetBold( m_isBold );
aField->SetTextColor( m_color );
}

View File

@ -62,7 +62,7 @@ public:
protected:
void init();
void updateText( EDA_TEXT* aText );
void updateText( SCH_FIELD* aField );
void onScintillaCharAdded( wxStyledTextEvent &aEvent );

View File

@ -284,9 +284,6 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( SCH_COMMIT* aCommit,
eda_text->SetVertJustify( vAlign );
}
if( m_visible->Get3StateValue() != wxCHK_UNDETERMINED )
eda_text->SetVisible( m_visible->GetValue() );
if( m_italic->Get3StateValue() != wxCHK_UNDETERMINED )
eda_text->SetItalic( m_italic->GetValue() );
@ -320,6 +317,9 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( SCH_COMMIT* aCommit,
if( SCH_FIELD* sch_field = dynamic_cast<SCH_FIELD*>( aItem ) )
{
if( m_visible->Get3StateValue() != wxCHK_UNDETERMINED )
sch_field->SetVisible( m_visible->GetValue() );
if( m_showFieldNames->Get3StateValue() != wxCHK_UNDETERMINED )
sch_field->SetNameShown( m_showFieldNames->GetValue() );
}

View File

@ -22,14 +22,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/*
* Fields are texts attached to a symbol, some of which have a special meaning.
* Fields 0 and 1 are very important: reference and value.
* Field 2 is used as default footprint name.
* Field 3 is used to point to a datasheet (usually a URL).
* Fields 4+ are user fields. They can be renamed and can appear in reports.
*/
#include <wx/log.h>
#include <wx/menu.h>
@ -39,13 +31,8 @@
#include <sch_edit_frame.h>
#include <plotters/plotter.h>
#include <bitmaps.h>
#include <core/mirror.h>
#include <kiway.h>
#include <symbol_library.h>
#include <sch_symbol.h>
#include <sch_field.h>
#include <sch_label.h>
#include <schematic.h>
#include <settings/color_settings.h>
#include <string_utils.h>
#include <trace_helpers.h>
@ -83,12 +70,20 @@ SCH_FIELD::SCH_FIELD( const VECTOR2I& aPos, int aFieldId, SCH_ITEM* aParent,
}
SCH_FIELD::SCH_FIELD( SCH_ITEM* aParent, int aFieldId, const wxString& aName) :
SCH_FIELD::SCH_FIELD( SCH_ITEM* aParent, int aFieldId, const wxString& aName ) :
SCH_FIELD( VECTOR2I(), aFieldId, aParent, aName )
{
}
SCH_FIELD::SCH_FIELD( SCH_TEXT* aText ) :
SCH_FIELD( VECTOR2I(), INVALID_FIELD, nullptr, wxEmptyString )
{
SCH_ITEM::operator=( *aText );
EDA_TEXT::operator=( *aText );
}
SCH_FIELD::SCH_FIELD( const SCH_FIELD& aField ) :
SCH_ITEM( aField ),
EDA_TEXT( aField )
@ -515,6 +510,7 @@ void SCH_FIELD::Print( const SCH_RENDER_SETTINGS* aSettings, int aUnit, int aBod
void SCH_FIELD::ImportValues( const SCH_FIELD& aSource )
{
SetAttributes( aSource );
SetVisible( aSource.IsVisible() );
SetNameShown( aSource.IsNameShown() );
SetCanAutoplace( aSource.CanAutoplace() );
}

View File

@ -34,6 +34,7 @@
#include "scintilla_tricks.h"
class SCH_EDIT_FRAME;
class SCH_TEXT;
/**
@ -56,6 +57,8 @@ public:
SCH_FIELD( SCH_ITEM* aParent, int aFieldId = INVALID_FIELD,
const wxString& aName = wxEmptyString );
SCH_FIELD( SCH_TEXT* aText );
SCH_FIELD( const SCH_FIELD& aText );
~SCH_FIELD() override

View File

@ -957,7 +957,7 @@ SCH_SHAPE* SCH_IO_KICAD_LEGACY_LIB_CACHE::loadCircle( LINE_READER& aReader )
}
SCH_TEXT* SCH_IO_KICAD_LEGACY_LIB_CACHE::loadText( LINE_READER& aReader,
SCH_ITEM* SCH_IO_KICAD_LEGACY_LIB_CACHE::loadText( LINE_READER& aReader,
int aMajorVersion, int aMinorVersion )
{
const char* line = aReader.Line();
@ -1002,12 +1002,27 @@ SCH_TEXT* SCH_IO_KICAD_LEGACY_LIB_CACHE::loadText( LINE_READER& aReader,
str.Replace( "''", "\"" );
}
SCH_TEXT* text = new SCH_TEXT( center, str, LAYER_DEVICE );
text->SetTextAngle( EDA_ANGLE( angleInTenths, TENTHS_OF_A_DEGREE_T ) );
text->SetTextSize( size );
text->SetVisible( visible );
text->SetUnit( unit );
text->SetBodyStyle( bodyStyle );
SCH_ITEM* sch_item = nullptr;
EDA_TEXT* eda_text = nullptr;
if( !visible )
{
SCH_FIELD* field = new SCH_FIELD( center, -1, nullptr );
sch_item = field;
eda_text = field;
}
else
{
SCH_TEXT* sch_text = new SCH_TEXT( center, str, LAYER_DEVICE );
sch_item = sch_text;
eda_text = sch_text;
}
eda_text->SetTextAngle( EDA_ANGLE( angleInTenths, TENTHS_OF_A_DEGREE_T ) );
eda_text->SetTextSize( size );
eda_text->SetVisible( visible );
sch_item->SetUnit( unit );
sch_item->SetBodyStyle( bodyStyle );
// Here things are murky and not well defined. At some point it appears the format
// was changed to add text properties. However rather than add the token to the end of
@ -1021,37 +1036,37 @@ SCH_TEXT* SCH_IO_KICAD_LEGACY_LIB_CACHE::loadText( LINE_READER& aReader,
&& !is_eol( *line ) )
{
if( strCompare( "Italic", line, &line ) )
text->SetItalicFlag( true );
eda_text->SetItalicFlag( true );
else if( !strCompare( "Normal", line, &line ) )
SCH_PARSE_ERROR( "invalid text stype, expected 'Normal' or 'Italic'", aReader, line );
SCH_PARSE_ERROR( "invalid eda_text stype, expected 'Normal' or 'Italic'", aReader, line );
if( parseInt( aReader, line, &line ) > 0 )
text->SetBoldFlag( true );
eda_text->SetBoldFlag( true );
// Some old libaries version > 2.0 do not have these options for text justification:
// Some old libaries version > 2.0 do not have these options for eda_text justification:
if( !is_eol( *line ) )
{
switch( parseChar( aReader, line, &line ) )
{
case 'L': text->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); break;
case 'C': text->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER ); break;
case 'R': text->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT ); break;
default: SCH_PARSE_ERROR( "invalid horizontal text justication; expected L, C, or R",
case 'L': eda_text->SetHorizJustify( GR_TEXT_H_ALIGN_LEFT ); break;
case 'C': eda_text->SetHorizJustify( GR_TEXT_H_ALIGN_CENTER ); break;
case 'R': eda_text->SetHorizJustify( GR_TEXT_H_ALIGN_RIGHT ); break;
default: SCH_PARSE_ERROR( "invalid horizontal eda_text justication; expected L, C, or R",
aReader, line );
}
switch( parseChar( aReader, line, &line ) )
{
case 'T': text->SetVertJustify( GR_TEXT_V_ALIGN_TOP ); break;
case 'C': text->SetVertJustify( GR_TEXT_V_ALIGN_CENTER ); break;
case 'B': text->SetVertJustify( GR_TEXT_V_ALIGN_BOTTOM ); break;
default: SCH_PARSE_ERROR( "invalid vertical text justication; expected T, C, or B",
case 'T': eda_text->SetVertJustify( GR_TEXT_V_ALIGN_TOP ); break;
case 'C': eda_text->SetVertJustify( GR_TEXT_V_ALIGN_CENTER ); break;
case 'B': eda_text->SetVertJustify( GR_TEXT_V_ALIGN_BOTTOM ); break;
default: SCH_PARSE_ERROR( "invalid vertical eda_text justication; expected T, C, or B",
aReader, line );
}
}
}
return text;
return sch_item;
}

View File

@ -76,7 +76,7 @@ private:
void loadDocs();
static SCH_SHAPE* loadArc( LINE_READER& aReader );
static SCH_SHAPE* loadCircle( LINE_READER& aReader );
static SCH_TEXT* loadText( LINE_READER& aReader, int aMajorVersion, int aMinorVersion );
static SCH_ITEM* loadText( LINE_READER& aReader, int aMajorVersion, int aMinorVersion );
static SCH_SHAPE* loadRect( LINE_READER& aReader );
static SCH_PIN* loadPin( std::unique_ptr<LIB_SYMBOL>& aSymbol, LINE_READER& aReader );
static SCH_SHAPE* loadPolyLine( LINE_READER& aReader );

View File

@ -911,6 +911,9 @@ void SCH_IO_KICAD_SEXPR::saveField( SCH_FIELD* aField )
aField->GetPosition().y ).c_str(),
EDA_UNIT_UTILS::FormatAngle( aField->GetTextAngle() ).c_str() );
if( !aField->IsVisible() )
KICAD_FORMAT::FormatBool( m_out, "hide", true );
if( aField->IsNameShown() )
KICAD_FORMAT::FormatBool( m_out, "show_name", true );

View File

@ -427,6 +427,9 @@ void SCH_IO_KICAD_SEXPR_LIB_CACHE::saveField( SCH_FIELD* aField, OUTPUTFORMATTER
if( !aField->CanAutoplace() )
aFormatter.Print( "(do_not_autoplace)" );
if( !aField->IsVisible() )
KICAD_FORMAT::FormatBool( &aFormatter, "hide", true );
aField->Format( &aFormatter, 0 );
aFormatter.Print( ")" );
}

View File

@ -825,7 +825,7 @@ void SCH_IO_KICAD_SEXPR_PARSER::parseEDA_TEXT( EDA_TEXT* aText, bool aConvertOve
case T_hide:
{
bool hide = parseMaybeAbsentBool( true );
bool hide = parseMaybeAbsentBool( false );
aText->SetVisible( !hide );
break;
}
@ -1039,6 +1039,11 @@ SCH_FIELD* SCH_IO_KICAD_SEXPR_PARSER::parseProperty( std::unique_ptr<LIB_SYMBOL>
NeedRIGHT();
break;
case T_hide:
field->SetVisible( !parseBool() );
NeedRIGHT();
break;
case T_effects:
parseEDA_TEXT( static_cast<EDA_TEXT*>( field.get() ), field->GetId() == VALUE_FIELD );
break;
@ -1058,7 +1063,7 @@ SCH_FIELD* SCH_IO_KICAD_SEXPR_PARSER::parseProperty( std::unique_ptr<LIB_SYMBOL>
}
default:
Expecting( "id, at, show_name, do_not_autoplace, or effects" );
Expecting( "id, at, hide, show_name, do_not_autoplace, or effects" );
}
}
@ -1845,7 +1850,7 @@ SCH_SHAPE* SCH_IO_KICAD_SEXPR_PARSER::parseSymbolRectangle()
}
SCH_TEXT* SCH_IO_KICAD_SEXPR_PARSER::parseSymbolText()
SCH_ITEM* SCH_IO_KICAD_SEXPR_PARSER::parseSymbolText()
{
wxCHECK_MSG( CurTok() == T_text, nullptr,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a text token." ) );
@ -1897,6 +1902,10 @@ SCH_TEXT* SCH_IO_KICAD_SEXPR_PARSER::parseSymbolText()
}
}
// Convert hidden symbol text (which is no longer supported) into a hidden field
if( !text->IsVisible() )
return new SCH_FIELD( text.get(), -1 );
return text.release();
}
@ -2294,6 +2303,11 @@ SCH_FIELD* SCH_IO_KICAD_SEXPR_PARSER::parseSchField( SCH_ITEM* aParent )
NeedRIGHT();
break;
case T_hide:
field->SetVisible( !parseBool() );
NeedRIGHT();
break;
case T_effects:
parseEDA_TEXT( static_cast<EDA_TEXT*>( field.get() ), field->GetId() == VALUE_FIELD );
break;
@ -2313,7 +2327,7 @@ SCH_FIELD* SCH_IO_KICAD_SEXPR_PARSER::parseSchField( SCH_ITEM* aParent )
}
default:
Expecting( "id, at, show_name, do_not_autoplace or effects" );
Expecting( "id, at, hide, show_name, do_not_autoplace or effects" );
}
}
@ -4341,6 +4355,9 @@ SCH_TEXT* SCH_IO_KICAD_SEXPR_PARSER::parseSchText()
case T_effects:
parseEDA_TEXT( static_cast<EDA_TEXT*>( text.get() ), true );
// Hidden schematic text is no longer supported
text->SetVisible( true );
break;
case T_iref: // legacy format; current is a T_property (aka SCH_FIELD)

View File

@ -202,7 +202,7 @@ private:
SCH_PIN* parseSymbolPin();
SCH_SHAPE* parseSymbolPolyLine();
SCH_SHAPE* parseSymbolRectangle();
SCH_TEXT* parseSymbolText();
SCH_ITEM* parseSymbolText();
SCH_TEXTBOX* parseSymbolTextBox();
void parsePAGE_INFO( PAGE_INFO& aPageInfo );

View File

@ -771,7 +771,6 @@ static struct SCH_TEXT_DESC
propMgr.InheritsAfter( TYPE_HASH( SCH_TEXT ), TYPE_HASH( EDA_TEXT ) );
propMgr.Mask( TYPE_HASH( SCH_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Mirrored" ) );
propMgr.Mask( TYPE_HASH( SCH_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Visible" ) );
propMgr.Mask( TYPE_HASH( SCH_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Width" ) );
propMgr.Mask( TYPE_HASH( SCH_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Height" ) );
propMgr.Mask( TYPE_HASH( SCH_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Thickness" ) );

View File

@ -682,7 +682,6 @@ static struct SCH_TEXTBOX_DESC
propMgr.Mask( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "Shape" ) );
propMgr.Mask( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_TEXT ), _HKI( "Visible" ) );
propMgr.Mask( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_TEXT ), _HKI( "Width" ) );
propMgr.Mask( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_TEXT ), _HKI( "Height" ) );
propMgr.Mask( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_TEXT ), _HKI( "Thickness" ) );

View File

@ -1420,13 +1420,14 @@ void SIM_MODEL::MigrateSimModel( T& aSymbol, const PROJECT* aProject )
public:
FIELD_INFO()
{
m_Attributes.m_Visible = false;
m_Visible = false;
m_Attributes.m_Size = VECTOR2I( DEFAULT_SIZE_TEXT * schIUScale.IU_PER_MILS,
DEFAULT_SIZE_TEXT * schIUScale.IU_PER_MILS );
};
FIELD_INFO( const wxString& aText, SCH_FIELD* aField ) :
m_Text( aText ),
m_Visible( aField->IsVisible() ),
m_Attributes( aField->GetAttributes() ),
m_Pos( aField->GetPosition() )
{}
@ -1438,6 +1439,7 @@ void SIM_MODEL::MigrateSimModel( T& aSymbol, const PROJECT* aProject )
SCH_FIELD field( aSymbol, -1, aFieldName );
field.SetText( m_Text );
field.SetVisible( m_Visible );
field.SetAttributes( m_Attributes );
field.SetPosition( m_Pos );
@ -1446,6 +1448,7 @@ void SIM_MODEL::MigrateSimModel( T& aSymbol, const PROJECT* aProject )
public:
wxString m_Text;
bool m_Visible;
TEXT_ATTRIBUTES m_Attributes;
VECTOR2I m_Pos;
};

View File

@ -34,10 +34,6 @@
///< library).
#define CTL_OMIT_AT (1 << 5) ///< Omit position and rotation. (always saved
///< with position 0,0 and rotation = 0 in library).
// If set, when calling EDA_TEXT::Format, disable writing the "hide" keyword in save file.
#define CTL_OMIT_HIDE (1 << 6) ///< Omit the hide attribute in .kicad_xxx files.
#define CTL_OMIT_LIBNAME (1 << 7) ///< Omit lib alias when saving (used for
///< board/not library)..
#define CTL_OMIT_FOOTPRINT_VERSION (1 << 8) ///< Omit the version string from the (footprint)

View File

@ -163,7 +163,7 @@ public:
void SetBold( bool aBold );
/**
* Set only the italic flag, without changing the font.
* Set only the bold flag, without changing the font.
*
* Used when bulk-changing text attributes (e.g. from a dialog or import).
*/
@ -171,7 +171,7 @@ public:
bool IsBold() const { return m_attributes.m_Bold; }
virtual void SetVisible( bool aVisible );
virtual bool IsVisible() const { return m_attributes.m_Visible; }
virtual bool IsVisible() const { return m_visible; }
void SetMirrored( bool isMirrored );
bool IsMirrored() const { return m_attributes.m_Mirrored; }
@ -464,6 +464,7 @@ private:
TEXT_ATTRIBUTES m_attributes;
wxString m_unresolvedFontName;
VECTOR2I m_pos;
bool m_visible; // For SCH_FIELDs and PCB_FIELDs
};

View File

@ -136,7 +136,6 @@ public:
bool m_Bold;
bool m_Underlined;
KIGFX::COLOR4D m_Color;
bool m_Visible;
bool m_Mirrored;
bool m_Multiline;
VECTOR2I m_Size;
@ -159,9 +158,8 @@ struct std::hash<TEXT_ATTRIBUTES>
return hash_val( aAttributes.m_Font, aAttributes.m_Halign, aAttributes.m_Valign,
aAttributes.m_Angle.AsDegrees(), aAttributes.m_LineSpacing,
aAttributes.m_StrokeWidth, aAttributes.m_Italic, aAttributes.m_Bold,
aAttributes.m_Underlined, aAttributes.m_Color, aAttributes.m_Visible,
aAttributes.m_Mirrored, aAttributes.m_Multiline, aAttributes.m_Size.x,
aAttributes.m_Size.y );
aAttributes.m_Underlined, aAttributes.m_Color, aAttributes.m_Mirrored,
aAttributes.m_Multiline, aAttributes.m_Size.x, aAttributes.m_Size.y );
}
};

View File

@ -220,6 +220,9 @@ INSPECT_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* aTestItem, void* aTestData
case PCB_FIELD_T:
field = static_cast<PCB_FIELD*>( aTestItem );
if( !field->IsVisible() )
return INSPECT_RESULT::CONTINUE;
if( field->IsReference() && m_Guide->IgnoreFPReferences() )
return INSPECT_RESULT::CONTINUE;
@ -236,9 +239,6 @@ INSPECT_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* aTestItem, void* aTestData
{
PCB_LAYER_ID layer = text->GetLayer();
if( !text->IsVisible() )
return INSPECT_RESULT::CONTINUE;
if( m_Guide->IgnoreFPTextOnBack() && IsBackLayer( layer ) )
return INSPECT_RESULT::CONTINUE;

View File

@ -364,6 +364,7 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( BOARD_COMMIT& aCommit, B
{
aCommit.Modify( aItem );
PCB_FIELD* field = dynamic_cast<PCB_FIELD*>( aItem );
PCB_TEXT* text = dynamic_cast<PCB_TEXT*>( aItem );
PCB_SHAPE* shape = dynamic_cast<PCB_SHAPE*>( aItem );
PCB_DIMENSION_BASE* dimension = dynamic_cast<PCB_DIMENSION_BASE*>( aItem );
@ -412,9 +413,6 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( BOARD_COMMIT& aCommit, B
if( parentFP )
{
if( m_visible->Get3StateValue() != wxCHK_UNDETERMINED )
text->SetVisible( m_visible->GetValue() );
if( m_keepUpright->Get3StateValue() != wxCHK_UNDETERMINED )
text->SetKeepUpright( m_keepUpright->GetValue() );
@ -423,6 +421,12 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( BOARD_COMMIT& aCommit, B
}
}
if( field )
{
if( m_visible->Get3StateValue() != wxCHK_UNDETERMINED )
field->SetVisible( m_visible->GetValue() );
}
if( !m_lineWidth.IsIndeterminate() )
{
if( shape )

View File

@ -144,7 +144,7 @@ DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_BASE::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS_
fgSizer1->Add( 0, 0, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
m_visible = new wxCheckBox( m_specifiedValues, wxID_ANY, _("Visible (text only)"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER );
m_visible = new wxCheckBox( m_specifiedValues, wxID_ANY, _("Visible (fields only)"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER );
m_visible->SetValue(true);
fgSizer1->Add( m_visible, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 120 );

Some files were not shown because too many files have changed in this diff Show More