Remove a bunch of globals.
This commit is contained in:
parent
99c1d7cf96
commit
9c8941e040
|
@ -93,7 +93,7 @@ void BOARD_ADAPTER::AddShapeWithClearanceToContainer( const TEXTE_PCB* aText,
|
||||||
|
|
||||||
s_boardItem = (const BOARD_ITEM *) &aText;
|
s_boardItem = (const BOARD_ITEM *) &aText;
|
||||||
s_dstcontainer = aDstContainer;
|
s_dstcontainer = aDstContainer;
|
||||||
s_textWidth = aText->GetEffectiveTextPenWidth( nullptr ) + ( 2 * aClearanceValue );
|
s_textWidth = aText->GetEffectiveTextPenWidth() + ( 2 * aClearanceValue );
|
||||||
s_biuTo3Dunits = m_biuTo3Dunits;
|
s_biuTo3Dunits = m_biuTo3Dunits;
|
||||||
|
|
||||||
// not actually used, but needed by GRText
|
// not actually used, but needed by GRText
|
||||||
|
@ -107,22 +107,22 @@ void BOARD_ADAPTER::AddShapeWithClearanceToContainer( const TEXTE_PCB* aText,
|
||||||
wxStringSplit( aText->GetShownText(), strings_list, '\n' );
|
wxStringSplit( aText->GetShownText(), strings_list, '\n' );
|
||||||
std::vector<wxPoint> positions;
|
std::vector<wxPoint> positions;
|
||||||
positions.reserve( strings_list.Count() );
|
positions.reserve( strings_list.Count() );
|
||||||
aText->GetPositionsOfLinesOfMultilineText( positions, strings_list.Count() );
|
aText->GetLinePositions( positions, strings_list.Count());
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < strings_list.Count(); ++ii )
|
for( unsigned ii = 0; ii < strings_list.Count(); ++ii )
|
||||||
{
|
{
|
||||||
wxString txt = strings_list.Item( ii );
|
wxString txt = strings_list.Item( ii );
|
||||||
|
|
||||||
GRText( nullptr, positions[ii], dummy_color, txt, aText->GetTextAngle(), size,
|
GRText( nullptr, positions[ii], dummy_color, txt, aText->GetTextAngle(), size,
|
||||||
aText->GetHorizJustify(), aText->GetVertJustify(), penWidth, aText->IsItalic(),
|
aText->GetHorizJustify(), aText->GetVertJustify(), penWidth,
|
||||||
penWidth, addTextSegmToContainer );
|
aText->IsItalic(), forceBold, 0, addTextSegmToContainer );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GRText( nullptr, aText->GetTextPos(), dummy_color, aText->GetShownText(),
|
GRText( nullptr, aText->GetTextPos(), dummy_color, aText->GetShownText(),
|
||||||
aText->GetTextAngle(), size, aText->GetHorizJustify(), aText->GetVertJustify(),
|
aText->GetTextAngle(), size, aText->GetHorizJustify(), aText->GetVertJustify(),
|
||||||
penWidth, aText->IsItalic(), penWidth, addTextSegmToContainer );
|
penWidth, aText->IsItalic(), forceBold, 0, addTextSegmToContainer );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ void BOARD_ADAPTER::AddGraphicsShapesWithClearanceToContainer( const MODULE* aMo
|
||||||
|
|
||||||
for( TEXTE_MODULE* text : texts )
|
for( TEXTE_MODULE* text : texts )
|
||||||
{
|
{
|
||||||
s_textWidth = text->GetEffectiveTextPenWidth( nullptr ) + ( 2 * aInflateValue );
|
s_textWidth = text->GetEffectiveTextPenWidth() + ( 2 * aInflateValue );
|
||||||
wxSize size = text->GetTextSize();
|
wxSize size = text->GetTextSize();
|
||||||
bool forceBold = true;
|
bool forceBold = true;
|
||||||
int penWidth = 0; // force max width for bold
|
int penWidth = 0; // force max width for bold
|
||||||
|
@ -227,7 +227,7 @@ void BOARD_ADAPTER::AddGraphicsShapesWithClearanceToContainer( const MODULE* aMo
|
||||||
|
|
||||||
GRText( NULL, text->GetTextPos(), BLACK, text->GetShownText(), text->GetDrawRotation(),
|
GRText( NULL, text->GetTextPos(), BLACK, text->GetShownText(), text->GetDrawRotation(),
|
||||||
size, text->GetHorizJustify(), text->GetVertJustify(), penWidth, text->IsItalic(),
|
size, text->GetHorizJustify(), text->GetVertJustify(), penWidth, text->IsItalic(),
|
||||||
forceBold, addTextSegmToContainer );
|
forceBold, 0, addTextSegmToContainer );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -330,6 +330,7 @@ set( COMMON_SRCS
|
||||||
ptree.cpp
|
ptree.cpp
|
||||||
rc_item.cpp
|
rc_item.cpp
|
||||||
refdes_utils.cpp
|
refdes_utils.cpp
|
||||||
|
render_settings.cpp
|
||||||
reporter.cpp
|
reporter.cpp
|
||||||
richio.cpp
|
richio.cpp
|
||||||
search_stack.cpp
|
search_stack.cpp
|
||||||
|
|
|
@ -756,10 +756,15 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample()
|
||||||
GRResetPenAndBrush( &memDC );
|
GRResetPenAndBrush( &memDC );
|
||||||
|
|
||||||
WS_DATA_MODEL::SetAltInstance( m_pagelayout );
|
WS_DATA_MODEL::SetAltInstance( m_pagelayout );
|
||||||
|
KIGFX::WS_RENDER_SETTINGS renderSettings;
|
||||||
|
renderSettings.SetDefaultPenWidth( 1 );
|
||||||
|
renderSettings.SetLayerColor( LAYER_WORKSHEET, COLOR4D( RED ) );
|
||||||
|
renderSettings.SetPrintDC( &memDC );
|
||||||
|
|
||||||
GRFilledRect( NULL, &memDC, 0, 0, m_layout_size.x, m_layout_size.y, WHITE, WHITE );
|
GRFilledRect( NULL, &memDC, 0, 0, m_layout_size.x, m_layout_size.y, WHITE, WHITE );
|
||||||
PrintPageLayout( &memDC, pageDUMMY, emptyString, emptyString, m_tb,
|
|
||||||
m_screen->m_NumberOfScreens, m_screen->m_ScreenNumber, 1, 1, RED,
|
PrintPageLayout( &renderSettings, pageDUMMY, emptyString, emptyString, m_tb,
|
||||||
&Prj() );
|
m_screen->m_NumberOfScreens, m_screen->m_ScreenNumber, 1, &Prj() );
|
||||||
|
|
||||||
memDC.SelectObject( wxNullBitmap );
|
memDC.SelectObject( wxNullBitmap );
|
||||||
m_PageLayoutExampleBitmap->SetBitmap( *m_page_bitmap );
|
m_PageLayoutExampleBitmap->SetBitmap( *m_page_bitmap );
|
||||||
|
|
|
@ -243,7 +243,7 @@ void EDA_DRAW_FRAME::OnUpdateSelectGrid( wxUpdateUIEvent& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::PrintPage( wxDC* aDC )
|
void EDA_DRAW_FRAME::PrintPage( RENDER_SETTINGS* aSettings )
|
||||||
{
|
{
|
||||||
wxMessageBox( wxT("EDA_DRAW_FRAME::PrintPage() error") );
|
wxMessageBox( wxT("EDA_DRAW_FRAME::PrintPage() error") );
|
||||||
}
|
}
|
||||||
|
@ -728,14 +728,14 @@ void EDA_DRAW_FRAME::FocusOnLocation( const wxPoint& aPos )
|
||||||
|
|
||||||
static const wxString productName = wxT( "KiCad E.D.A. " );
|
static const wxString productName = wxT( "KiCad E.D.A. " );
|
||||||
|
|
||||||
void PrintPageLayout( wxDC* aDC, const PAGE_INFO& aPageInfo, const wxString& aFullSheetName,
|
void PrintPageLayout( RENDER_SETTINGS* aSettings, const PAGE_INFO& aPageInfo,
|
||||||
const wxString& aFileName, const TITLE_BLOCK& aTitleBlock, int aSheetCount,
|
const wxString& aFullSheetName, const wxString& aFileName,
|
||||||
int aSheetNumber, int aPenWidth, double aScalar, COLOR4D aColor,
|
const TITLE_BLOCK& aTitleBlock, int aSheetCount, int aSheetNumber,
|
||||||
const PROJECT* aProject, const wxString& aSheetLayer )
|
double aScalar, const PROJECT* aProject, const wxString& aSheetLayer )
|
||||||
{
|
{
|
||||||
WS_DRAW_ITEM_LIST drawList;
|
WS_DRAW_ITEM_LIST drawList;
|
||||||
|
|
||||||
drawList.SetDefaultPenSize( aPenWidth );
|
drawList.SetDefaultPenSize( aSettings->GetDefaultPenWidth() );
|
||||||
drawList.SetMilsToIUfactor( aScalar );
|
drawList.SetMilsToIUfactor( aScalar );
|
||||||
drawList.SetSheetNumber( aSheetNumber );
|
drawList.SetSheetNumber( aSheetNumber );
|
||||||
drawList.SetSheetCount( aSheetCount );
|
drawList.SetSheetCount( aSheetCount );
|
||||||
|
@ -747,35 +747,34 @@ void PrintPageLayout( wxDC* aDC, const PAGE_INFO& aPageInfo, const wxString& aFu
|
||||||
drawList.BuildWorkSheetGraphicList( aPageInfo, aTitleBlock );
|
drawList.BuildWorkSheetGraphicList( aPageInfo, aTitleBlock );
|
||||||
|
|
||||||
// Draw item list
|
// Draw item list
|
||||||
drawList.Print( aDC, aColor );
|
drawList.Print( aSettings );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::PrintWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth,
|
void EDA_DRAW_FRAME::PrintWorkSheet( RENDER_SETTINGS* aSettings, BASE_SCREEN* aScreen,
|
||||||
double aScalar, const wxString &aFilename,
|
double aScalar, const wxString &aFilename,
|
||||||
const wxString &aSheetLayer, COLOR4D aColor )
|
const wxString &aSheetLayer )
|
||||||
{
|
{
|
||||||
if( !m_showBorderAndTitleBlock )
|
if( !m_showBorderAndTitleBlock )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
COLOR4D color = ( aColor != COLOR4D::UNSPECIFIED ) ? aColor : COLOR4D( RED );
|
wxDC* DC = aSettings->GetPrintDC();
|
||||||
|
wxPoint origin = DC->GetDeviceOrigin();
|
||||||
wxPoint origin = aDC->GetDeviceOrigin();
|
|
||||||
|
|
||||||
if( origin.y > 0 )
|
if( origin.y > 0 )
|
||||||
{
|
{
|
||||||
aDC->SetDeviceOrigin( 0, 0 );
|
DC->SetDeviceOrigin( 0, 0 );
|
||||||
aDC->SetAxisOrientation( true, false );
|
DC->SetAxisOrientation( true, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintPageLayout( aDC, GetPageSettings(), GetScreenDesc(), aFilename, GetTitleBlock(),
|
PrintPageLayout( aSettings, GetPageSettings(), GetScreenDesc(), aFilename, GetTitleBlock(),
|
||||||
aScreen->m_NumberOfScreens, aScreen->m_ScreenNumber, aLineWidth, aScalar,
|
aScreen->m_NumberOfScreens, aScreen->m_ScreenNumber, aScalar, &Prj(),
|
||||||
color, &Prj(), aSheetLayer );
|
aSheetLayer );
|
||||||
|
|
||||||
if( origin.y > 0 )
|
if( origin.y > 0 )
|
||||||
{
|
{
|
||||||
aDC->SetDeviceOrigin( origin.x, origin.y );
|
DC->SetDeviceOrigin( origin.x, origin.y );
|
||||||
aDC->SetAxisOrientation( true, true );
|
DC->SetAxisOrientation( true, true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,8 @@ EDA_TEXT_VJUSTIFY_T EDA_TEXT::MapVertJustify( int aVertJustify )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EDA_TEXT::EDA_TEXT( const wxString& text ) :
|
EDA_TEXT::EDA_TEXT( const wxString& text, int aTextMarkupFlags ) :
|
||||||
|
m_textMarkupFlags( aTextMarkupFlags ),
|
||||||
m_text( text ),
|
m_text( text ),
|
||||||
m_e( 1<<TE_VISIBLE )
|
m_e( 1<<TE_VISIBLE )
|
||||||
{
|
{
|
||||||
|
@ -96,6 +97,7 @@ EDA_TEXT::EDA_TEXT( const wxString& text ) :
|
||||||
|
|
||||||
|
|
||||||
EDA_TEXT::EDA_TEXT( const EDA_TEXT& aText ) :
|
EDA_TEXT::EDA_TEXT( const EDA_TEXT& aText ) :
|
||||||
|
m_textMarkupFlags( aText.m_textMarkupFlags ),
|
||||||
m_text( aText.m_text ),
|
m_text( aText.m_text ),
|
||||||
m_e( aText.m_e )
|
m_e( aText.m_e )
|
||||||
{
|
{
|
||||||
|
@ -141,15 +143,17 @@ void EDA_TEXT::SwapEffects( EDA_TEXT& aTradingPartner )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDA_TEXT::GetEffectiveTextPenWidth( RENDER_SETTINGS* aSettings ) const
|
int EDA_TEXT::GetEffectiveTextPenWidth() const
|
||||||
{
|
{
|
||||||
int width = GetTextPenWidth();
|
int width = GetTextThickness();
|
||||||
|
|
||||||
if( width == 0 && IsBold() )
|
if( width <= 0 )
|
||||||
width = GetPenSizeForBold( GetTextWidth() );
|
{
|
||||||
|
if( IsBold() )
|
||||||
if( width <= 0 && aSettings )
|
width = GetPenSizeForBold( GetTextWidth() );
|
||||||
width = aSettings->GetDefaultTextThickness();
|
else
|
||||||
|
width = 1;
|
||||||
|
}
|
||||||
|
|
||||||
// Clip pen size for small texts:
|
// Clip pen size for small texts:
|
||||||
width = Clamp_Text_PenSize( width, GetTextSize(), IsBold() );
|
width = Clamp_Text_PenSize( width, GetTextSize(), IsBold() );
|
||||||
|
@ -198,15 +202,14 @@ int EDA_TEXT::GetInterline() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EDA_RECT EDA_TEXT::GetTextBox( RENDER_SETTINGS* aSettings, int aLine, bool aInvertY ) const
|
EDA_RECT EDA_TEXT::GetTextBox( int aLine, bool aInvertY ) const
|
||||||
{
|
{
|
||||||
EDA_RECT rect;
|
EDA_RECT rect;
|
||||||
wxArrayString strings;
|
wxArrayString strings;
|
||||||
wxString text = GetShownText();
|
wxString text = GetShownText();
|
||||||
int thickness = GetEffectiveTextPenWidth( aSettings );
|
int thickness = GetEffectiveTextPenWidth();
|
||||||
int linecount = 1;
|
int linecount = 1;
|
||||||
bool hasOverBar = false; // true if the first line of text as an overbar
|
bool hasOverBar = false; // true if the first line of text as an overbar
|
||||||
int markupFlags = aSettings ? aSettings->GetTextMarkupFlags() : 0;
|
|
||||||
|
|
||||||
if( IsMultilineAllowed() )
|
if( IsMultilineAllowed() )
|
||||||
{
|
{
|
||||||
|
@ -236,14 +239,14 @@ EDA_RECT EDA_TEXT::GetTextBox( RENDER_SETTINGS* aSettings, int aLine, bool aInve
|
||||||
|
|
||||||
// calculate the H and V size
|
// calculate the H and V size
|
||||||
const auto& font = basic_gal.GetStrokeFont();
|
const auto& font = basic_gal.GetStrokeFont();
|
||||||
VECTOR2D size( GetTextSize() );
|
VECTOR2D fontSize( GetTextSize() );
|
||||||
double penWidth( thickness );
|
double penWidth( thickness );
|
||||||
int dx = KiROUND( font.ComputeStringBoundaryLimits( text, size, penWidth, markupFlags ).x );
|
int dx = KiROUND( font.ComputeStringBoundaryLimits( text, fontSize, penWidth,
|
||||||
int dy = GetInterline();
|
m_textMarkupFlags ).x );
|
||||||
|
int dy = GetInterline();
|
||||||
|
|
||||||
// Creates bounding box (rectangle) for an horizontal
|
// Creates bounding box (rectangle) for horizontal, left and top justified text. The
|
||||||
// and left and top justified text. the bounding box will be moved later
|
// bounding box will be moved later according to the actual text options
|
||||||
// according to the actual text options
|
|
||||||
wxSize textsize = wxSize( dx, dy );
|
wxSize textsize = wxSize( dx, dy );
|
||||||
wxPoint pos = GetTextPos();
|
wxPoint pos = GetTextPos();
|
||||||
|
|
||||||
|
@ -263,7 +266,9 @@ EDA_RECT EDA_TEXT::GetTextBox( RENDER_SETTINGS* aSettings, int aLine, bool aInve
|
||||||
{ // A overbar adds an extra size to the text
|
{ // A overbar adds an extra size to the text
|
||||||
// Height from the base line text of chars like [ or {
|
// Height from the base line text of chars like [ or {
|
||||||
double curr_height = GetTextHeight() * 1.15;
|
double curr_height = GetTextHeight() * 1.15;
|
||||||
int extra_height = KiROUND( font.ComputeOverbarVerticalPosition( size.y, penWidth ) - curr_height );
|
double overbarPosition = font.ComputeOverbarVerticalPosition( fontSize.y, penWidth );
|
||||||
|
int extra_height = KiROUND( overbarPosition - curr_height );
|
||||||
|
|
||||||
extra_height += thickness / 2;
|
extra_height += thickness / 2;
|
||||||
textsize.y += extra_height;
|
textsize.y += extra_height;
|
||||||
rect.Move( wxPoint( 0, -extra_height ) );
|
rect.Move( wxPoint( 0, -extra_height ) );
|
||||||
|
@ -276,7 +281,8 @@ EDA_RECT EDA_TEXT::GetTextBox( RENDER_SETTINGS* aSettings, int aLine, bool aInve
|
||||||
for( unsigned ii = 1; ii < strings.GetCount(); ii++ )
|
for( unsigned ii = 1; ii < strings.GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
text = strings.Item( ii );
|
text = strings.Item( ii );
|
||||||
dx = KiROUND( font.ComputeStringBoundaryLimits( text, size, penWidth, markupFlags ).x );
|
dx = KiROUND( font.ComputeStringBoundaryLimits( text, fontSize, penWidth,
|
||||||
|
m_textMarkupFlags ).x );
|
||||||
textsize.x = std::max( textsize.x, dx );
|
textsize.x = std::max( textsize.x, dx );
|
||||||
textsize.y += dy;
|
textsize.y += dy;
|
||||||
}
|
}
|
||||||
|
@ -353,7 +359,7 @@ EDA_RECT EDA_TEXT::GetTextBox( RENDER_SETTINGS* aSettings, int aLine, bool aInve
|
||||||
|
|
||||||
bool EDA_TEXT::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const
|
bool EDA_TEXT::TextHitTest( const wxPoint& aPoint, int aAccuracy ) const
|
||||||
{
|
{
|
||||||
EDA_RECT rect = GetTextBox( nullptr ); // JEY TODO: requires RENDER_SETTINGS
|
EDA_RECT rect = GetTextBox();
|
||||||
wxPoint location = aPoint;
|
wxPoint location = aPoint;
|
||||||
|
|
||||||
rect.Inflate( aAccuracy );
|
rect.Inflate( aAccuracy );
|
||||||
|
@ -370,13 +376,14 @@ bool EDA_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy
|
||||||
rect.Inflate( aAccuracy );
|
rect.Inflate( aAccuracy );
|
||||||
|
|
||||||
if( aContains )
|
if( aContains )
|
||||||
return rect.Contains( GetTextBox( nullptr ) ); // JEY TODO: requires RENDER_SETTINGS
|
return rect.Contains( GetTextBox() );
|
||||||
|
|
||||||
return rect.Intersects( GetTextBox( nullptr ), GetTextAngle() ); // JEY TODO: requires RENDER_SETTINGS
|
return rect.Intersects( GetTextBox(), GetTextAngle() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_TEXT::Print( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor, EDA_DRAW_MODE_T aFillMode )
|
void EDA_TEXT::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, COLOR4D aColor,
|
||||||
|
EDA_DRAW_MODE_T aFillMode )
|
||||||
{
|
{
|
||||||
if( IsMultilineAllowed() )
|
if( IsMultilineAllowed() )
|
||||||
{
|
{
|
||||||
|
@ -386,21 +393,19 @@ void EDA_TEXT::Print( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor, EDA_DRA
|
||||||
|
|
||||||
positions.reserve( strings.Count() );
|
positions.reserve( strings.Count() );
|
||||||
|
|
||||||
GetPositionsOfLinesOfMultilineText( positions, strings.Count() );
|
GetLinePositions( positions, strings.Count());
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < strings.Count(); ii++ )
|
for( unsigned ii = 0; ii < strings.Count(); ii++ )
|
||||||
{
|
printOneLineOfText( aSettings, aOffset, aColor, aFillMode, strings[ii], positions[ii] );
|
||||||
wxString& txt = strings.Item( ii );
|
|
||||||
printOneLineOfText( aDC, aOffset, aColor, aFillMode, txt, positions[ii] );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
printOneLineOfText( aDC, aOffset, aColor, aFillMode, GetShownText(), GetTextPos() );
|
{
|
||||||
|
printOneLineOfText( aSettings, aOffset, aColor, aFillMode, GetShownText(), GetTextPos() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_TEXT::GetPositionsOfLinesOfMultilineText(
|
void EDA_TEXT::GetLinePositions( std::vector<wxPoint>& aPositions, int aLineCount ) const
|
||||||
std::vector<wxPoint>& aPositions, int aLineCount ) const
|
|
||||||
{
|
{
|
||||||
wxPoint pos = GetTextPos(); // Position of first line of the
|
wxPoint pos = GetTextPos(); // Position of first line of the
|
||||||
// multiline text according to
|
// multiline text according to
|
||||||
|
@ -441,22 +446,23 @@ void EDA_TEXT::GetPositionsOfLinesOfMultilineText(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EDA_TEXT::printOneLineOfText( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor,
|
void EDA_TEXT::printOneLineOfText( RENDER_SETTINGS* aSettings, const wxPoint& aOffset,
|
||||||
EDA_DRAW_MODE_T aFillMode, const wxString& aText,
|
COLOR4D aColor, EDA_DRAW_MODE_T aFillMode,
|
||||||
const wxPoint &aPos )
|
const wxString& aText, const wxPoint &aPos )
|
||||||
{
|
{
|
||||||
int width = GetEffectiveTextPenWidth( nullptr );
|
wxDC* DC = aSettings->GetPrintDC();
|
||||||
|
int penWidth = std::max( GetEffectiveTextPenWidth(), aSettings->GetDefaultPenWidth() );
|
||||||
|
|
||||||
if( aFillMode == SKETCH )
|
if( aFillMode == SKETCH )
|
||||||
width = -width;
|
penWidth = -penWidth;
|
||||||
|
|
||||||
wxSize size = GetTextSize();
|
wxSize size = GetTextSize();
|
||||||
|
|
||||||
if( IsMirrored() )
|
if( IsMirrored() )
|
||||||
size.x = -size.x;
|
size.x = -size.x;
|
||||||
|
|
||||||
GRText( aDC, aOffset + aPos, aColor, aText, GetTextAngle(), size, GetHorizJustify(),
|
GRText( DC, aOffset + aPos, aColor, aText, GetTextAngle(), size, GetHorizJustify(),
|
||||||
GetVertJustify(), width, IsItalic(), IsBold() );
|
GetVertJustify(), penWidth, IsItalic(), IsBold(), m_textMarkupFlags );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -483,11 +489,11 @@ wxString EDA_TEXT::GetTextStyleName()
|
||||||
|
|
||||||
bool EDA_TEXT::IsDefaultFormatting() const
|
bool EDA_TEXT::IsDefaultFormatting() const
|
||||||
{
|
{
|
||||||
return ( IsVisible()
|
return ( IsVisible()
|
||||||
&& !IsMirrored()
|
&& !IsMirrored()
|
||||||
&& GetHorizJustify() == GR_TEXT_HJUSTIFY_CENTER
|
&& GetHorizJustify() == GR_TEXT_HJUSTIFY_CENTER
|
||||||
&& GetVertJustify() == GR_TEXT_VJUSTIFY_CENTER
|
&& GetVertJustify() == GR_TEXT_VJUSTIFY_CENTER
|
||||||
&& GetTextPenWidth() == 0
|
&& GetTextThickness() == 0
|
||||||
&& !IsItalic()
|
&& !IsItalic()
|
||||||
&& !IsBold()
|
&& !IsBold()
|
||||||
&& !IsMultilineAllowed()
|
&& !IsMultilineAllowed()
|
||||||
|
@ -510,8 +516,8 @@ void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl
|
||||||
FormatInternalUnits( GetTextHeight() ).c_str(),
|
FormatInternalUnits( GetTextHeight() ).c_str(),
|
||||||
FormatInternalUnits( GetTextWidth() ).c_str() );
|
FormatInternalUnits( GetTextWidth() ).c_str() );
|
||||||
|
|
||||||
if( GetTextPenWidth() )
|
if( GetTextThickness() )
|
||||||
aFormatter->Print( 0, " (thickness %s)", FormatInternalUnits( GetTextPenWidth() ).c_str() );
|
aFormatter->Print( 0, " (thickness %s)", FormatInternalUnits( GetTextThickness() ).c_str() );
|
||||||
|
|
||||||
if( IsBold() )
|
if( IsBold() )
|
||||||
aFormatter->Print( 0, " bold" );
|
aFormatter->Print( 0, " bold" );
|
||||||
|
@ -577,20 +583,20 @@ void EDA_TEXT::TransformTextShapeToSegmentList( std::vector<wxPoint>& aCornerBuf
|
||||||
wxStringSplit( GetShownText(), strings_list, wxChar('\n') );
|
wxStringSplit( GetShownText(), strings_list, wxChar('\n') );
|
||||||
std::vector<wxPoint> positions;
|
std::vector<wxPoint> positions;
|
||||||
positions.reserve( strings_list.Count() );
|
positions.reserve( strings_list.Count() );
|
||||||
GetPositionsOfLinesOfMultilineText( positions,strings_list.Count() );
|
GetLinePositions( positions, strings_list.Count());
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
|
for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
|
||||||
{
|
{
|
||||||
wxString txt = strings_list.Item( ii );
|
wxString txt = strings_list.Item( ii );
|
||||||
GRText( NULL, positions[ii], color, txt, GetTextAngle(), size, GetHorizJustify(),
|
GRText( NULL, positions[ii], color, txt, GetTextAngle(), size, GetHorizJustify(),
|
||||||
GetVertJustify(), penWidth, IsItalic(), forceBold, addTextSegmToBuffer,
|
GetVertJustify(), penWidth, IsItalic(), forceBold, 0, addTextSegmToBuffer,
|
||||||
&aCornerBuffer );
|
&aCornerBuffer );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GRText( NULL, GetTextPos(), color, GetText(), GetTextAngle(), size, GetHorizJustify(),
|
GRText( NULL, GetTextPos(), color, GetText(), GetTextAngle(), size, GetHorizJustify(),
|
||||||
GetVertJustify(), penWidth, IsItalic(), forceBold, addTextSegmToBuffer,
|
GetVertJustify(), penWidth, IsItalic(), forceBold, 0, addTextSegmToBuffer,
|
||||||
&aCornerBuffer );
|
&aCornerBuffer );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,21 +43,6 @@
|
||||||
#include <basic_gal.h>
|
#include <basic_gal.h>
|
||||||
|
|
||||||
|
|
||||||
static int s_textMarkupFlags = 0;
|
|
||||||
|
|
||||||
|
|
||||||
void SetTextMarkupFlags( int aMarkupFlags )
|
|
||||||
{
|
|
||||||
s_textMarkupFlags = aMarkupFlags;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int GetTextMarkupFlags()
|
|
||||||
{
|
|
||||||
return s_textMarkupFlags;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetPensizeForBold
|
* Function GetPensizeForBold
|
||||||
* @return the "best" value for a pen size to draw/plot a bold text
|
* @return the "best" value for a pen size to draw/plot a bold text
|
||||||
|
@ -143,7 +128,7 @@ int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool aItalic,
|
||||||
void GRText( wxDC* aDC, const wxPoint& aPos, COLOR4D aColor, const wxString& aText,
|
void GRText( wxDC* aDC, const wxPoint& aPos, COLOR4D aColor, const wxString& aText,
|
||||||
double aOrient, const wxSize& aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify,
|
double aOrient, const wxSize& aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify,
|
||||||
enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold,
|
enum EDA_TEXT_VJUSTIFY_T aV_justify, int aWidth, bool aItalic, bool aBold,
|
||||||
void (* aCallback)( int x0, int y0, int xf, int yf, void* aData ),
|
int aMarkupFlags, void (* aCallback)( int x0, int y0, int xf, int yf, void* aData ),
|
||||||
void* aCallbackData, PLOTTER* aPlotter )
|
void* aCallbackData, PLOTTER* aPlotter )
|
||||||
{
|
{
|
||||||
bool fill_mode = true;
|
bool fill_mode = true;
|
||||||
|
@ -181,14 +166,14 @@ void GRText( wxDC* aDC, const wxPoint& aPos, COLOR4D aColor, const wxString& aTe
|
||||||
basic_gal.m_Color = aColor;
|
basic_gal.m_Color = aColor;
|
||||||
basic_gal.SetClipBox( nullptr );
|
basic_gal.SetClipBox( nullptr );
|
||||||
|
|
||||||
basic_gal.StrokeText( aText, VECTOR2D( aPos ), aOrient * M_PI/1800, GetTextMarkupFlags() );
|
basic_gal.StrokeText( aText, VECTOR2D( aPos ), aOrient * M_PI/1800, aMarkupFlags );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GRHaloText( wxDC * aDC, const wxPoint &aPos, const COLOR4D aBgColor, COLOR4D aColor1,
|
void GRHaloText( wxDC * aDC, const wxPoint &aPos, COLOR4D aBgColor, COLOR4D aColor1,
|
||||||
COLOR4D aColor2, const wxString &aText, double aOrient, const wxSize &aSize,
|
COLOR4D aColor2, const wxString &aText, double aOrient, const wxSize &aSize,
|
||||||
enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||||
int aWidth, bool aItalic, bool aBold,
|
int aWidth, bool aItalic, bool aBold, int aMarkupFlags,
|
||||||
void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ),
|
void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ),
|
||||||
void* aCallbackData, PLOTTER * aPlotter )
|
void* aCallbackData, PLOTTER * aPlotter )
|
||||||
{
|
{
|
||||||
|
@ -203,13 +188,14 @@ void GRHaloText( wxDC * aDC, const wxPoint &aPos, const COLOR4D aBgColor, COLOR4
|
||||||
|
|
||||||
// Draw the background
|
// Draw the background
|
||||||
GRText( aDC, aPos, aColor1, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, aItalic,
|
GRText( aDC, aPos, aColor1, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, aItalic,
|
||||||
aBold, aCallback, aCallbackData, aPlotter );
|
aBold, aMarkupFlags, aCallback, aCallbackData, aPlotter );
|
||||||
|
|
||||||
// Draw the text
|
// Draw the text
|
||||||
GRText( aDC, aPos, aColor2, aText, aOrient, aSize, aH_justify, aV_justify, aWidth/4, aItalic,
|
GRText( aDC, aPos, aColor2, aText, aOrient, aSize, aH_justify, aV_justify, aWidth/4, aItalic,
|
||||||
aBold, aCallback, aCallbackData, aPlotter );
|
aBold, aMarkupFlags, aCallback, aCallbackData, aPlotter );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function PLOTTER::Text
|
* Function PLOTTER::Text
|
||||||
* same as GRText, but plot graphic text insteed of draw it
|
* same as GRText, but plot graphic text insteed of draw it
|
||||||
|
@ -237,11 +223,12 @@ void PLOTTER::Text( const wxPoint& aPos,
|
||||||
int aPenWidth,
|
int aPenWidth,
|
||||||
bool aItalic,
|
bool aItalic,
|
||||||
bool aBold,
|
bool aBold,
|
||||||
|
int aTextMarkupFlags,
|
||||||
bool aMultilineAllowed,
|
bool aMultilineAllowed,
|
||||||
void* aData )
|
void* aData )
|
||||||
{
|
{
|
||||||
SetColor( aColor );
|
SetColor( aColor );
|
||||||
|
|
||||||
GRText( NULL, aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aPenWidth,
|
GRText( NULL, aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aPenWidth,
|
||||||
aItalic, aBold, nullptr, nullptr, this );
|
aItalic, aBold, aTextMarkupFlags, nullptr, nullptr, this );
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
#include "marker_base.h"
|
#include "marker_base.h"
|
||||||
#include <geometry/shape_line_chain.h>
|
#include <geometry/shape_line_chain.h>
|
||||||
|
#include <render_settings.h>
|
||||||
#include "dialog_display_info_HTML_base.h"
|
#include "dialog_display_info_HTML_base.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -182,8 +183,10 @@ EDA_RECT MARKER_BASE::GetBoundingBoxMarker() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MARKER_BASE::PrintMarker( wxDC* aDC, const wxPoint& aOffset )
|
void MARKER_BASE::PrintMarker( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
|
||||||
{
|
{
|
||||||
|
wxDC* DC = aSettings->GetPrintDC();
|
||||||
|
|
||||||
// Build the marker shape polygon in internal units:
|
// Build the marker shape polygon in internal units:
|
||||||
std::vector<wxPoint> shape;
|
std::vector<wxPoint> shape;
|
||||||
shape.reserve( CORNERS_COUNT );
|
shape.reserve( CORNERS_COUNT );
|
||||||
|
@ -191,5 +194,5 @@ void MARKER_BASE::PrintMarker( wxDC* aDC, const wxPoint& aOffset )
|
||||||
for( const VECTOR2I& corner : MarkerShapeCorners )
|
for( const VECTOR2I& corner : MarkerShapeCorners )
|
||||||
shape.emplace_back( corner * MarkerScale() + m_Pos + aOffset );
|
shape.emplace_back( corner * MarkerScale() + m_Pos + aOffset );
|
||||||
|
|
||||||
GRClosedPoly( nullptr, aDC, CORNERS_COUNT, &shape[0], true, 0, getColor(), getColor() );
|
GRClosedPoly( nullptr, DC, CORNERS_COUNT, &shape[0], true, 0, getColor(), getColor() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -714,7 +714,7 @@ void WS_DATA_ITEM_TEXT::SetConstrainedTextSize()
|
||||||
dummy.SetVertJustify( m_Vjustify );
|
dummy.SetVertJustify( m_Vjustify );
|
||||||
dummy.SetTextAngle( m_Orient * 10 );
|
dummy.SetTextAngle( m_Orient * 10 );
|
||||||
|
|
||||||
EDA_RECT rect = dummy.GetTextBox( nullptr ); // JEY TODO: requires RENDER_SETTINGS
|
EDA_RECT rect = dummy.GetTextBox();
|
||||||
DSIZE size;
|
DSIZE size;
|
||||||
size.x = rect.GetWidth() / FSCALE;
|
size.x = rect.GetWidth() / FSCALE;
|
||||||
size.y = rect.GetHeight() / FSCALE;
|
size.y = rect.GetHeight() / FSCALE;
|
||||||
|
|
|
@ -155,15 +155,15 @@ void WS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aLis
|
||||||
|
|
||||||
// ============================ TEXT ==============================
|
// ============================ TEXT ==============================
|
||||||
|
|
||||||
void WS_DRAW_ITEM_TEXT::PrintWsItem( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor )
|
void WS_DRAW_ITEM_TEXT::PrintWsItem( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
|
||||||
{
|
{
|
||||||
Print( aDC, aOffset, aColor, FILLED );
|
Print( aSettings, aOffset, aSettings->GetLayerColor( LAYER_WORKSHEET ), FILLED );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const EDA_RECT WS_DRAW_ITEM_TEXT::GetBoundingBox() const
|
const EDA_RECT WS_DRAW_ITEM_TEXT::GetBoundingBox() const
|
||||||
{
|
{
|
||||||
return EDA_TEXT::GetTextBox( nullptr ); // JEY TODO: requires RENDER_SETTINGS
|
return EDA_TEXT::GetTextBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -190,8 +190,12 @@ wxString WS_DRAW_ITEM_TEXT::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||||
|
|
||||||
// ============================ POLYGON =================================
|
// ============================ POLYGON =================================
|
||||||
|
|
||||||
void WS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor )
|
void WS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
|
||||||
{
|
{
|
||||||
|
wxDC* DC = aSettings->GetPrintDC();
|
||||||
|
COLOR4D color = aSettings->GetLayerColor( LAYER_WORKSHEET );
|
||||||
|
int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
|
||||||
|
|
||||||
std::vector<wxPoint> points_moved;
|
std::vector<wxPoint> points_moved;
|
||||||
|
|
||||||
for( int idx = 0; idx < m_Polygons.OutlineCount(); ++idx )
|
for( int idx = 0; idx < m_Polygons.OutlineCount(); ++idx )
|
||||||
|
@ -200,11 +204,13 @@ void WS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem( wxDC* aDC, const wxPoint& aOffset,
|
||||||
SHAPE_LINE_CHAIN& outline = m_Polygons.Outline( idx );
|
SHAPE_LINE_CHAIN& outline = m_Polygons.Outline( idx );
|
||||||
|
|
||||||
for( int ii = 0; ii < outline.PointCount(); ii++ )
|
for( int ii = 0; ii < outline.PointCount(); ii++ )
|
||||||
points_moved.emplace_back(
|
{
|
||||||
outline.CPoint( ii ).x + aOffset.x, outline.CPoint( ii ).y + aOffset.y );
|
points_moved.emplace_back( outline.CPoint( ii ).x + aOffset.x,
|
||||||
|
outline.CPoint( ii ).y + aOffset.y );
|
||||||
|
}
|
||||||
|
|
||||||
GRPoly( nullptr, aDC, points_moved.size(), &points_moved[0], FILLED_SHAPE,
|
GRPoly( nullptr, DC, points_moved.size(), &points_moved[0], FILLED_SHAPE, penWidth,
|
||||||
GetPenWidth(), aColor, aColor );
|
color, color );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,10 +295,14 @@ wxString WS_DRAW_ITEM_POLYPOLYGONS::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||||
|
|
||||||
// ============================ RECT ==============================
|
// ============================ RECT ==============================
|
||||||
|
|
||||||
void WS_DRAW_ITEM_RECT::PrintWsItem( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor )
|
void WS_DRAW_ITEM_RECT::PrintWsItem( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
|
||||||
{
|
{
|
||||||
GRRect( nullptr, aDC, GetStart().x + aOffset.x, GetStart().y + aOffset.y,
|
wxDC* DC = aSettings->GetPrintDC();
|
||||||
GetEnd().x + aOffset.x, GetEnd().y + aOffset.y, GetPenWidth(), aColor );
|
COLOR4D color = aSettings->GetLayerColor( LAYER_WORKSHEET );
|
||||||
|
int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
|
||||||
|
|
||||||
|
GRRect( nullptr, DC, GetStart().x + aOffset.x, GetStart().y + aOffset.y,
|
||||||
|
GetEnd().x + aOffset.x, GetEnd().y + aOffset.y, penWidth, color );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -348,9 +358,13 @@ wxString WS_DRAW_ITEM_RECT::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||||
|
|
||||||
// ============================ LINE ==============================
|
// ============================ LINE ==============================
|
||||||
|
|
||||||
void WS_DRAW_ITEM_LINE::PrintWsItem( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor )
|
void WS_DRAW_ITEM_LINE::PrintWsItem( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
|
||||||
{
|
{
|
||||||
GRLine( nullptr, aDC, GetStart() + aOffset, GetEnd() + aOffset, GetPenWidth(), aColor );
|
wxDC* DC = aSettings->GetPrintDC();
|
||||||
|
COLOR4D color = aSettings->GetLayerColor( LAYER_WORKSHEET );
|
||||||
|
int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
|
||||||
|
|
||||||
|
GRLine( nullptr, DC, GetStart() + aOffset, GetEnd() + aOffset, penWidth, color );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -362,7 +376,7 @@ const EDA_RECT WS_DRAW_ITEM_LINE::GetBoundingBox() const
|
||||||
|
|
||||||
bool WS_DRAW_ITEM_LINE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
bool WS_DRAW_ITEM_LINE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
||||||
{
|
{
|
||||||
int mindist = aAccuracy + ( GetPenWidth() / 2 );
|
int mindist = aAccuracy + ( GetPenWidth() / 2 ) + 1;
|
||||||
return TestSegmentHit( aPosition, GetStart(), GetEnd(), mindist );
|
return TestSegmentHit( aPosition, GetStart(), GetEnd(), mindist );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,12 +393,12 @@ wxString WS_DRAW_ITEM_LINE::GetSelectMenuText( EDA_UNITS aUnits ) const
|
||||||
|
|
||||||
// ============== BITMAP ================
|
// ============== BITMAP ================
|
||||||
|
|
||||||
void WS_DRAW_ITEM_BITMAP::PrintWsItem( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor )
|
void WS_DRAW_ITEM_BITMAP::PrintWsItem( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
|
||||||
{
|
{
|
||||||
WS_DATA_ITEM_BITMAP* bitmap = (WS_DATA_ITEM_BITMAP*) GetPeer();
|
WS_DATA_ITEM_BITMAP* bitmap = (WS_DATA_ITEM_BITMAP*) GetPeer();
|
||||||
|
|
||||||
if( bitmap->m_ImageBitmap )
|
if( bitmap->m_ImageBitmap )
|
||||||
bitmap->m_ImageBitmap->DrawBitmap( aDC, m_pos + aOffset );
|
bitmap->m_ImageBitmap->DrawBitmap( aSettings->GetPrintDC(), m_pos + aOffset );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -480,20 +494,20 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList( const PAGE_INFO& aPageInfo,
|
||||||
* The selected items are drawn after (usually 0 or 1)
|
* The selected items are drawn after (usually 0 or 1)
|
||||||
* to be sure they are seen, even for overlapping items
|
* to be sure they are seen, even for overlapping items
|
||||||
*/
|
*/
|
||||||
void WS_DRAW_ITEM_LIST::Print( wxDC* aDC, COLOR4D aColor )
|
void WS_DRAW_ITEM_LIST::Print( RENDER_SETTINGS* aSettings )
|
||||||
{
|
{
|
||||||
std::vector<WS_DRAW_ITEM_BASE*> second_items;
|
std::vector<WS_DRAW_ITEM_BASE*> second_items;
|
||||||
|
|
||||||
for( WS_DRAW_ITEM_BASE* item = GetFirst(); item; item = GetNext() )
|
for( WS_DRAW_ITEM_BASE* item = GetFirst(); item; item = GetNext() )
|
||||||
{
|
{
|
||||||
if( item->Type() == WSG_BITMAP_T )
|
if( item->Type() == WSG_BITMAP_T )
|
||||||
item->PrintWsItem( aDC, aColor );
|
item->PrintWsItem( aSettings );
|
||||||
else
|
else
|
||||||
second_items.push_back( item );
|
second_items.push_back( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( auto item : second_items )
|
for( auto item : second_items )
|
||||||
item->PrintWsItem( aDC, aColor );
|
item->PrintWsItem( aSettings );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -250,7 +250,7 @@ void KIGFX::WS_PAINTER::draw( const WS_DRAW_ITEM_LINE* aItem, int aLayer ) const
|
||||||
m_gal->SetIsStroke( true );
|
m_gal->SetIsStroke( true );
|
||||||
m_gal->SetIsFill( false );
|
m_gal->SetIsFill( false );
|
||||||
m_gal->SetStrokeColor( m_renderSettings.GetColor( aItem, aLayer ) );
|
m_gal->SetStrokeColor( m_renderSettings.GetColor( aItem, aLayer ) );
|
||||||
m_gal->SetLineWidth( aItem->GetPenWidth() );
|
m_gal->SetLineWidth( std::max( aItem->GetPenWidth(), m_renderSettings.GetDefaultPenWidth() ) );
|
||||||
m_gal->DrawLine( VECTOR2D( aItem->GetStart() ), VECTOR2D( aItem->GetEnd() ) );
|
m_gal->DrawLine( VECTOR2D( aItem->GetStart() ), VECTOR2D( aItem->GetEnd() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ void KIGFX::WS_PAINTER::draw( const WS_DRAW_ITEM_RECT* aItem, int aLayer ) const
|
||||||
m_gal->SetIsStroke( true );
|
m_gal->SetIsStroke( true );
|
||||||
m_gal->SetIsFill( false );
|
m_gal->SetIsFill( false );
|
||||||
m_gal->SetStrokeColor( m_renderSettings.GetColor( aItem, aLayer ) );
|
m_gal->SetStrokeColor( m_renderSettings.GetColor( aItem, aLayer ) );
|
||||||
m_gal->SetLineWidth( aItem->GetPenWidth() );
|
m_gal->SetLineWidth( std::max( aItem->GetPenWidth(), m_renderSettings.GetDefaultPenWidth() ) );
|
||||||
m_gal->DrawRectangle( VECTOR2D( aItem->GetStart() ), VECTOR2D( aItem->GetEnd() ) );
|
m_gal->DrawRectangle( VECTOR2D( aItem->GetStart() ), VECTOR2D( aItem->GetEnd() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,12 +284,14 @@ void KIGFX::WS_PAINTER::draw( const WS_DRAW_ITEM_POLYPOLYGONS* aItem, int aLayer
|
||||||
void KIGFX::WS_PAINTER::draw( const WS_DRAW_ITEM_TEXT* aItem, int aLayer ) const
|
void KIGFX::WS_PAINTER::draw( const WS_DRAW_ITEM_TEXT* aItem, int aLayer ) const
|
||||||
{
|
{
|
||||||
VECTOR2D position( aItem->GetTextPos().x, aItem->GetTextPos().y );
|
VECTOR2D position( aItem->GetTextPos().x, aItem->GetTextPos().y );
|
||||||
|
int penWidth = std::max( aItem->GetEffectiveTextPenWidth(),
|
||||||
|
m_renderSettings.GetDefaultPenWidth() );
|
||||||
|
|
||||||
m_gal->Save();
|
m_gal->Save();
|
||||||
m_gal->Translate( position );
|
m_gal->Translate( position );
|
||||||
m_gal->Rotate( -aItem->GetTextAngle() * M_PI / 1800.0 );
|
m_gal->Rotate( -aItem->GetTextAngle() * M_PI / 1800.0 );
|
||||||
m_gal->SetStrokeColor( m_renderSettings.GetColor( aItem, aLayer ) );
|
m_gal->SetStrokeColor( m_renderSettings.GetColor( aItem, aLayer ) );
|
||||||
m_gal->SetLineWidth( aItem->GetEffectiveTextPenWidth( nullptr ) ); // JEY TODO: requires RENDER_SETTINGS
|
m_gal->SetLineWidth( penWidth );
|
||||||
m_gal->SetTextAttributes( aItem );
|
m_gal->SetTextAttributes( aItem );
|
||||||
m_gal->SetIsFill( false );
|
m_gal->SetIsFill( false );
|
||||||
m_gal->SetIsStroke( true );
|
m_gal->SetIsStroke( true );
|
||||||
|
|
|
@ -29,43 +29,6 @@
|
||||||
|
|
||||||
using namespace KIGFX;
|
using namespace KIGFX;
|
||||||
|
|
||||||
RENDER_SETTINGS::RENDER_SETTINGS()
|
|
||||||
{
|
|
||||||
// Set the default initial values
|
|
||||||
m_highlightFactor = 0.5f;
|
|
||||||
m_selectFactor = 0.5f;
|
|
||||||
m_highlightItems = false;
|
|
||||||
m_highlightEnabled = false;
|
|
||||||
m_hiContrastEnabled = false;
|
|
||||||
m_hiContrastFactor = 0.2f; //TODO: Make this user-configurable
|
|
||||||
m_highlightNetcode = -1;
|
|
||||||
m_outlineWidth = 1;
|
|
||||||
m_worksheetLineWidth = 100000;
|
|
||||||
m_defaultPenWidth = 0;
|
|
||||||
m_textMarkupFlags = 0;
|
|
||||||
m_showPageLimits = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
RENDER_SETTINGS::~RENDER_SETTINGS()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void RENDER_SETTINGS::update()
|
|
||||||
{
|
|
||||||
// Calculate darkened/highlighted variants of layer colors
|
|
||||||
for( int i = 0; i < LAYER_ID_COUNT; i++ )
|
|
||||||
{
|
|
||||||
m_hiContrastColor[i] = m_layerColors[i].Mix( m_layerColors[LAYER_PCB_BACKGROUND],
|
|
||||||
m_hiContrastFactor );
|
|
||||||
m_layerColorsHi[i] = m_layerColors[i].Brightened( m_highlightFactor );
|
|
||||||
m_layerColorsDark[i] = m_layerColors[i].Darkened( 1.0 - m_highlightFactor );
|
|
||||||
m_layerColorsSel[i] = m_layerColors[i].Brightened( m_selectFactor );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
PAINTER::PAINTER( GAL* aGal ) :
|
PAINTER::PAINTER( GAL* aGal ) :
|
||||||
m_gal( aGal ),
|
m_gal( aGal ),
|
||||||
m_brightenedColor( 0.0, 1.0, 0.0, 0.9 )
|
m_brightenedColor( 0.0, 1.0, 0.0, 0.9 )
|
||||||
|
|
|
@ -169,7 +169,6 @@ void DXF_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
|
||||||
iuPerDeviceUnit = 1.0 / aIusPerDecimil; // Gives a DXF in decimils
|
iuPerDeviceUnit = 1.0 / aIusPerDecimil; // Gives a DXF in decimils
|
||||||
iuPerDeviceUnit *= GetUnitScaling(); // Get the scaling factor for the current units
|
iuPerDeviceUnit *= GetUnitScaling(); // Get the scaling factor for the current units
|
||||||
|
|
||||||
SetDefaultLineWidth( 0 ); // No line width on DXF
|
|
||||||
m_plotMirror = false; // No mirroring on DXF
|
m_plotMirror = false; // No mirroring on DXF
|
||||||
m_currentColor = COLOR4D::BLACK;
|
m_currentColor = COLOR4D::BLACK;
|
||||||
}
|
}
|
||||||
|
@ -871,6 +870,7 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
|
||||||
int aWidth,
|
int aWidth,
|
||||||
bool aItalic,
|
bool aItalic,
|
||||||
bool aBold,
|
bool aBold,
|
||||||
|
int aTextMarkupFlags,
|
||||||
bool aMultilineAllowed,
|
bool aMultilineAllowed,
|
||||||
void* aData )
|
void* aData )
|
||||||
{
|
{
|
||||||
|
@ -880,10 +880,10 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
|
||||||
|
|
||||||
bool processSuperSub = false;
|
bool processSuperSub = false;
|
||||||
|
|
||||||
if( ( GetTextMarkupFlags() & ENABLE_SUBSCRIPT_MARKUP ) && aText.Contains( wxT( "#" ) ) )
|
if( ( aTextMarkupFlags & ENABLE_SUBSCRIPT_MARKUP ) && aText.Contains( wxT( "#" ) ) )
|
||||||
processSuperSub = true;
|
processSuperSub = true;
|
||||||
|
|
||||||
if( ( GetTextMarkupFlags() & ENABLE_SUPERSCRIPT_MARKUP ) && aText.Contains( wxT( "^" ) ) )
|
if( ( aTextMarkupFlags & ENABLE_SUPERSCRIPT_MARKUP ) && aText.Contains( wxT( "^" ) ) )
|
||||||
processSuperSub = true;
|
processSuperSub = true;
|
||||||
|
|
||||||
if( m_textAsLines || containsNonAsciiChars( aText ) || aMultilineAllowed || processSuperSub )
|
if( m_textAsLines || containsNonAsciiChars( aText ) || aMultilineAllowed || processSuperSub )
|
||||||
|
@ -892,7 +892,7 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
|
||||||
// Perhaps multiline texts could be handled as DXF text entity
|
// Perhaps multiline texts could be handled as DXF text entity
|
||||||
// but I do not want spend time about this (JPC)
|
// but I do not want spend time about this (JPC)
|
||||||
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
|
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
|
||||||
aWidth, aItalic, aBold, aMultilineAllowed );
|
aWidth, aItalic, aBold, aTextMarkupFlags, aMultilineAllowed );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -83,7 +83,6 @@ void GERBER_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
|
||||||
// origin at the origin
|
// origin at the origin
|
||||||
paperSize.x = 0;
|
paperSize.x = 0;
|
||||||
paperSize.y = 0;
|
paperSize.y = 0;
|
||||||
SetDefaultLineWidth( 100 * aIusPerDecimil ); // Arbitrary default
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -283,30 +282,13 @@ bool GERBER_PLOTTER::EndPlot()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GERBER_PLOTTER::SetDefaultLineWidth( int width )
|
void GERBER_PLOTTER::SetCurrentLineWidth( int aWidth, void* aData )
|
||||||
{
|
{
|
||||||
defaultPenWidth = width;
|
|
||||||
m_currentApertureIdx = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GERBER_PLOTTER::SetCurrentLineWidth( int width, void* aData )
|
|
||||||
{
|
|
||||||
if( width == DO_NOT_SET_LINE_WIDTH )
|
|
||||||
return;
|
|
||||||
|
|
||||||
int pen_width;
|
|
||||||
|
|
||||||
if( width > 0 )
|
|
||||||
pen_width = width;
|
|
||||||
else
|
|
||||||
pen_width = defaultPenWidth;
|
|
||||||
|
|
||||||
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
|
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
|
||||||
int aperture_attribute = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
|
int aperture_attribute = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0;
|
||||||
|
|
||||||
selectAperture( wxSize( pen_width, pen_width ), APERTURE::AT_PLOTTING, aperture_attribute );
|
selectAperture( wxSize( aWidth, aWidth ), APERTURE::AT_PLOTTING, aperture_attribute );
|
||||||
currentPenWidth = pen_width;
|
currentPenWidth = aWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1183,16 +1165,16 @@ void GERBER_PLOTTER::FlashRegularPolygon( const wxPoint& aShapePos,
|
||||||
void GERBER_PLOTTER::Text( const wxPoint& aPos, const COLOR4D aColor,
|
void GERBER_PLOTTER::Text( const wxPoint& aPos, const COLOR4D aColor,
|
||||||
const wxString& aText, double aOrient, const wxSize& aSize,
|
const wxString& aText, double aOrient, const wxSize& aSize,
|
||||||
enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||||
int aWidth, bool aItalic, bool aBold, bool aMultilineAllowed,
|
int aWidth, bool aItalic, bool aBold, int aTextMarkupFlags,
|
||||||
void* aData )
|
bool aMultilineAllowed, void* aData )
|
||||||
{
|
{
|
||||||
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
|
GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData );
|
||||||
|
|
||||||
if( gbr_metadata )
|
if( gbr_metadata )
|
||||||
formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
|
formatNetAttribute( &gbr_metadata->m_NetlistMetadata );
|
||||||
|
|
||||||
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize,
|
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, aItalic,
|
||||||
aH_justify, aV_justify, aWidth, aItalic, aBold, aMultilineAllowed, aData );
|
aBold, aTextMarkupFlags, aMultilineAllowed, aData );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -234,7 +234,6 @@ void HPGL_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
|
||||||
paperSize = pageInfo.GetSizeMils();
|
paperSize = pageInfo.GetSizeMils();
|
||||||
paperSize.x *= 10.0 * aIusPerDecimil;
|
paperSize.x *= 10.0 * aIusPerDecimil;
|
||||||
paperSize.y *= 10.0 * aIusPerDecimil;
|
paperSize.y *= 10.0 * aIusPerDecimil;
|
||||||
SetDefaultLineWidth( 0 ); // HPGL has pen sizes instead
|
|
||||||
m_plotMirror = aMirror;
|
m_plotMirror = aMirror;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,8 +74,6 @@ void PDF_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
|
||||||
// The CTM is set to 1 user unit per decimil
|
// The CTM is set to 1 user unit per decimil
|
||||||
iuPerDeviceUnit = 1.0 / aIusPerDecimil;
|
iuPerDeviceUnit = 1.0 / aIusPerDecimil;
|
||||||
|
|
||||||
SetDefaultLineWidth( 100 / iuPerDeviceUnit ); // arbitrary default
|
|
||||||
|
|
||||||
/* The paper size in this engined is handled page by page
|
/* The paper size in this engined is handled page by page
|
||||||
Look in the StartPage function */
|
Look in the StartPage function */
|
||||||
}
|
}
|
||||||
|
@ -89,23 +87,17 @@ void PDF_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
|
||||||
* no outline thickness
|
* no outline thickness
|
||||||
* use in this case pen width = 1 does not actally change the polygon
|
* use in this case pen width = 1 does not actally change the polygon
|
||||||
*/
|
*/
|
||||||
void PDF_PLOTTER::SetCurrentLineWidth( int width, void* aData )
|
void PDF_PLOTTER::SetCurrentLineWidth( int aWidth, void* aData )
|
||||||
{
|
{
|
||||||
wxASSERT( workFile );
|
wxASSERT( workFile );
|
||||||
int pen_width;
|
|
||||||
|
|
||||||
if( width > 0 )
|
if( aWidth == 0 )
|
||||||
pen_width = width;
|
aWidth = 1;
|
||||||
else if( width == 0 )
|
|
||||||
pen_width = 1;
|
|
||||||
else
|
|
||||||
pen_width = defaultPenWidth;
|
|
||||||
|
|
||||||
if( pen_width != currentPenWidth )
|
if( aWidth != currentPenWidth )
|
||||||
fprintf( workFile, "%g w\n",
|
fprintf( workFile, "%g w\n", userToDeviceSize( aWidth ) );
|
||||||
userToDeviceSize( pen_width ) );
|
|
||||||
|
|
||||||
currentPenWidth = pen_width;
|
currentPenWidth = aWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -585,7 +577,7 @@ void PDF_PLOTTER::StartPage()
|
||||||
fprintf( workFile,
|
fprintf( workFile,
|
||||||
"%g 0 0 %g 0 0 cm 1 J 1 j 0 0 0 rg 0 0 0 RG %g w\n",
|
"%g 0 0 %g 0 0 cm 1 J 1 j 0 0 0 rg 0 0 0 RG %g w\n",
|
||||||
0.0072 * plotScaleAdjX, 0.0072 * plotScaleAdjY,
|
0.0072 * plotScaleAdjX, 0.0072 * plotScaleAdjY,
|
||||||
userToDeviceSize( defaultPenWidth ) );
|
userToDeviceSize( m_renderSettings->GetDefaultPenWidth() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -812,6 +804,7 @@ void PDF_PLOTTER::Text( const wxPoint& aPos,
|
||||||
int aWidth,
|
int aWidth,
|
||||||
bool aItalic,
|
bool aItalic,
|
||||||
bool aBold,
|
bool aBold,
|
||||||
|
int aTextMarkupFlags,
|
||||||
bool aMultilineAllowed,
|
bool aMultilineAllowed,
|
||||||
void* aData )
|
void* aData )
|
||||||
{
|
{
|
||||||
|
@ -840,9 +833,9 @@ void PDF_PLOTTER::Text( const wxPoint& aPos,
|
||||||
double wideningFactor, heightFactor;
|
double wideningFactor, heightFactor;
|
||||||
|
|
||||||
computeTextParameters( aPos, aText, aOrient, aSize, m_plotMirror, aH_justify,
|
computeTextParameters( aPos, aText, aOrient, aSize, m_plotMirror, aH_justify,
|
||||||
aV_justify, aWidth, aItalic, aBold,
|
aV_justify, aWidth, aItalic, aBold,
|
||||||
&wideningFactor, &ctm_a, &ctm_b, &ctm_c,
|
&wideningFactor, &ctm_a, &ctm_b, &ctm_c,
|
||||||
&ctm_d, &ctm_e, &ctm_f, &heightFactor );
|
&ctm_d, &ctm_e, &ctm_f, &heightFactor );
|
||||||
|
|
||||||
SetColor( aColor );
|
SetColor( aColor );
|
||||||
SetCurrentLineWidth( aWidth, aData );
|
SetCurrentLineWidth( aWidth, aData );
|
||||||
|
@ -886,8 +879,8 @@ void PDF_PLOTTER::Text( const wxPoint& aPos,
|
||||||
// Plot the stroked text (if requested)
|
// Plot the stroked text (if requested)
|
||||||
if( !use_native_font )
|
if( !use_native_font )
|
||||||
{
|
{
|
||||||
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
|
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, aWidth,
|
||||||
aWidth, aItalic, aBold, aMultilineAllowed );
|
aItalic, aBold, aTextMarkupFlags, aMultilineAllowed );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,13 +50,6 @@ const double PSLIKE_PLOTTER::postscriptTextAscent = 0.718;
|
||||||
|
|
||||||
// Common routines for Postscript-like plotting engines
|
// Common routines for Postscript-like plotting engines
|
||||||
|
|
||||||
void PSLIKE_PLOTTER::SetDefaultLineWidth( int width )
|
|
||||||
{
|
|
||||||
defaultPenWidth = width;
|
|
||||||
currentPenWidth = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PSLIKE_PLOTTER::SetColor( COLOR4D color )
|
void PSLIKE_PLOTTER::SetColor( COLOR4D color )
|
||||||
{
|
{
|
||||||
if( colorMode )
|
if( colorMode )
|
||||||
|
@ -422,7 +415,6 @@ void PS_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
|
||||||
paperSize = pageInfo.GetSizeMils();
|
paperSize = pageInfo.GetSizeMils();
|
||||||
paperSize.x *= 10.0 * aIusPerDecimil;
|
paperSize.x *= 10.0 * aIusPerDecimil;
|
||||||
paperSize.y *= 10.0 * aIusPerDecimil;
|
paperSize.y *= 10.0 * aIusPerDecimil;
|
||||||
SetDefaultLineWidth( 100 * aIusPerDecimil ); // arbitrary default
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -525,20 +517,14 @@ void PSLIKE_PLOTTER::computeTextParameters( const wxPoint& aPos,
|
||||||
|
|
||||||
/* Set the current line width (in IUs) for the next plot
|
/* Set the current line width (in IUs) for the next plot
|
||||||
*/
|
*/
|
||||||
void PS_PLOTTER::SetCurrentLineWidth( int width, void* aData )
|
void PS_PLOTTER::SetCurrentLineWidth( int aWidth, void* aData )
|
||||||
{
|
{
|
||||||
wxASSERT( outputFile );
|
wxASSERT( outputFile );
|
||||||
int pen_width;
|
|
||||||
|
|
||||||
if( width >= 0 )
|
if( aWidth != GetCurrentLineWidth() )
|
||||||
pen_width = width;
|
fprintf( outputFile, "%g setlinewidth\n", userToDeviceSize( aWidth ) );
|
||||||
else
|
|
||||||
pen_width = defaultPenWidth;
|
|
||||||
|
|
||||||
if( pen_width != GetCurrentLineWidth() )
|
currentPenWidth = aWidth;
|
||||||
fprintf( outputFile, "%g setlinewidth\n", userToDeviceSize( pen_width ) );
|
|
||||||
|
|
||||||
currentPenWidth = pen_width;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -942,9 +928,9 @@ bool PS_PLOTTER::StartPlot()
|
||||||
// within the Document Structuring Convention.
|
// within the Document Structuring Convention.
|
||||||
fputs( "%%Page: 1 1\n"
|
fputs( "%%Page: 1 1\n"
|
||||||
"%%BeginPageSetup\n"
|
"%%BeginPageSetup\n"
|
||||||
"gsave\n"
|
"gsave\n"
|
||||||
"0.0072 0.0072 scale\n" // Configure postscript for decimils coordinates
|
"0.0072 0.0072 scale\n" // Configure postscript for decimils coordinates
|
||||||
"linemode1\n", outputFile );
|
"linemode1\n", outputFile );
|
||||||
|
|
||||||
|
|
||||||
// Rototranslate the coordinate to achieve the landscape layout
|
// Rototranslate the coordinate to achieve the landscape layout
|
||||||
|
@ -953,11 +939,11 @@ bool PS_PLOTTER::StartPlot()
|
||||||
|
|
||||||
// Apply the user fine scale adjustments
|
// Apply the user fine scale adjustments
|
||||||
if( plotScaleAdjX != 1.0 || plotScaleAdjY != 1.0 )
|
if( plotScaleAdjX != 1.0 || plotScaleAdjY != 1.0 )
|
||||||
fprintf( outputFile, "%g %g scale\n",
|
fprintf( outputFile, "%g %g scale\n", plotScaleAdjX, plotScaleAdjY );
|
||||||
plotScaleAdjX, plotScaleAdjY );
|
|
||||||
|
|
||||||
// Set default line width
|
// Set default line width
|
||||||
fprintf( outputFile, "%g setlinewidth\n", userToDeviceSize( defaultPenWidth ) );
|
fprintf( outputFile, "%g setlinewidth\n",
|
||||||
|
userToDeviceSize( m_renderSettings->GetDefaultPenWidth() ) );
|
||||||
fputs( "%%EndPageSetup\n", outputFile );
|
fputs( "%%EndPageSetup\n", outputFile );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -988,6 +974,7 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
|
||||||
int aWidth,
|
int aWidth,
|
||||||
bool aItalic,
|
bool aItalic,
|
||||||
bool aBold,
|
bool aBold,
|
||||||
|
int aTextMarkupFlags,
|
||||||
bool aMultilineAllowed,
|
bool aMultilineAllowed,
|
||||||
void* aData )
|
void* aData )
|
||||||
{
|
{
|
||||||
|
@ -1000,10 +987,10 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
|
||||||
|
|
||||||
bool processSuperSub = false;
|
bool processSuperSub = false;
|
||||||
|
|
||||||
if( ( GetTextMarkupFlags() & ENABLE_SUBSCRIPT_MARKUP ) && aText.Contains( wxT( "#" ) ) )
|
if( ( aTextMarkupFlags & ENABLE_SUBSCRIPT_MARKUP ) && aText.Contains( wxT( "#" ) ) )
|
||||||
processSuperSub = true;
|
processSuperSub = true;
|
||||||
|
|
||||||
if( ( GetTextMarkupFlags() & ENABLE_SUPERSCRIPT_MARKUP ) && aText.Contains( wxT( "^" ) ) )
|
if( ( aTextMarkupFlags & ENABLE_SUPERSCRIPT_MARKUP ) && aText.Contains( wxT( "^" ) ) )
|
||||||
processSuperSub = true;
|
processSuperSub = true;
|
||||||
|
|
||||||
// Draw the native postscript text (if requested)
|
// Draw the native postscript text (if requested)
|
||||||
|
@ -1067,7 +1054,7 @@ void PS_PLOTTER::Text( const wxPoint& aPos,
|
||||||
if( !use_native )
|
if( !use_native )
|
||||||
{
|
{
|
||||||
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
|
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
|
||||||
aWidth, aItalic, aBold, aMultilineAllowed );
|
aWidth, aItalic, aBold, aTextMarkupFlags, aMultilineAllowed );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -187,7 +187,6 @@ void SVG_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
|
||||||
paperSize = pageInfo.GetSizeMils();
|
paperSize = pageInfo.GetSizeMils();
|
||||||
paperSize.x *= 10.0 * aIusPerDecimil;
|
paperSize.x *= 10.0 * aIusPerDecimil;
|
||||||
paperSize.y *= 10.0 * aIusPerDecimil;
|
paperSize.y *= 10.0 * aIusPerDecimil;
|
||||||
SetDefaultLineWidth( 100 * aIusPerDecimil ); // arbitrary default
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -276,19 +275,12 @@ void SVG_PLOTTER::setSVGPlotStyle( bool aIsGroup, const std::string& aExtraStyle
|
||||||
|
|
||||||
/* Set the current line width (in IUs) for the next plot
|
/* Set the current line width (in IUs) for the next plot
|
||||||
*/
|
*/
|
||||||
void SVG_PLOTTER::SetCurrentLineWidth( int width, void* aData )
|
void SVG_PLOTTER::SetCurrentLineWidth( int aWidth, void* aData )
|
||||||
{
|
{
|
||||||
int pen_width;
|
if( aWidth != currentPenWidth )
|
||||||
|
|
||||||
if( width >= 0 )
|
|
||||||
pen_width = width;
|
|
||||||
else
|
|
||||||
pen_width = defaultPenWidth;
|
|
||||||
|
|
||||||
if( pen_width != currentPenWidth )
|
|
||||||
{
|
{
|
||||||
m_graphics_changed = true;
|
m_graphics_changed = true;
|
||||||
currentPenWidth = pen_width;
|
currentPenWidth = aWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_graphics_changed )
|
if( m_graphics_changed )
|
||||||
|
@ -756,6 +748,7 @@ void SVG_PLOTTER::Text( const wxPoint& aPos,
|
||||||
int aWidth,
|
int aWidth,
|
||||||
bool aItalic,
|
bool aItalic,
|
||||||
bool aBold,
|
bool aBold,
|
||||||
|
int aTextMarkupFlags,
|
||||||
bool aMultilineAllowed,
|
bool aMultilineAllowed,
|
||||||
void* aData )
|
void* aData )
|
||||||
{
|
{
|
||||||
|
@ -763,14 +756,6 @@ void SVG_PLOTTER::Text( const wxPoint& aPos,
|
||||||
SetColor( aColor );
|
SetColor( aColor );
|
||||||
SetCurrentLineWidth( aWidth );
|
SetCurrentLineWidth( aWidth );
|
||||||
|
|
||||||
int width = currentPenWidth;
|
|
||||||
|
|
||||||
if( aWidth <= 0 && aBold )
|
|
||||||
width = GetPenSizeForBold( std::min( aSize.x, aSize.y ) );
|
|
||||||
|
|
||||||
if( aWidth <= 0 )
|
|
||||||
width = currentPenWidth;
|
|
||||||
|
|
||||||
wxPoint text_pos = aPos;
|
wxPoint text_pos = aPos;
|
||||||
const char *hjust = "start";
|
const char *hjust = "start";
|
||||||
|
|
||||||
|
@ -806,7 +791,7 @@ void SVG_PLOTTER::Text( const wxPoint& aPos,
|
||||||
wxSize text_size;
|
wxSize text_size;
|
||||||
// aSize.x or aSize.y is < 0 for mirrored texts.
|
// aSize.x or aSize.y is < 0 for mirrored texts.
|
||||||
// The actual text size value is the absolue value
|
// The actual text size value is the absolue value
|
||||||
text_size.x = std::abs( GraphicTextWidth( aText, aSize, aItalic, width ) );
|
text_size.x = std::abs( GraphicTextWidth( aText, aSize, aItalic, aWidth ) );
|
||||||
text_size.y = std::abs( aSize.x * 4/3 ); // Hershey font height to em size conversion
|
text_size.y = std::abs( aSize.x * 4/3 ); // Hershey font height to em size conversion
|
||||||
DPOINT anchor_pos_dev = userToDeviceCoordinates( aPos );
|
DPOINT anchor_pos_dev = userToDeviceCoordinates( aPos );
|
||||||
DPOINT text_pos_dev = userToDeviceCoordinates( text_pos );
|
DPOINT text_pos_dev = userToDeviceCoordinates( text_pos );
|
||||||
|
@ -833,6 +818,6 @@ void SVG_PLOTTER::Text( const wxPoint& aPos,
|
||||||
"<g class=\"stroked-text\"><desc>%s</desc>\n",
|
"<g class=\"stroked-text\"><desc>%s</desc>\n",
|
||||||
TO_UTF8( XmlEsc( aText ) ) );
|
TO_UTF8( XmlEsc( aText ) ) );
|
||||||
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
|
PLOTTER::Text( aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify,
|
||||||
aWidth, aItalic, aBold, aMultilineAllowed );
|
aWidth, aItalic, aBold, aTextMarkupFlags, aMultilineAllowed );
|
||||||
fputs( "</g>", outputFile );
|
fputs( "</g>", outputFile );
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,8 +64,8 @@ void PlotWorkSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BLOCK
|
||||||
/* Note: Page sizes values are given in mils
|
/* Note: Page sizes values are given in mils
|
||||||
*/
|
*/
|
||||||
double iusPerMil = plotter->GetIUsPerDecimil() * 10.0;
|
double iusPerMil = plotter->GetIUsPerDecimil() * 10.0;
|
||||||
|
COLOR4D plotColor = plotter->GetColorMode() ? aColor : COLOR4D::BLACK;
|
||||||
COLOR4D plotColor = plotter->GetColorMode() ? aColor : COLOR4D::BLACK;
|
int defaultPenWidth = plotter->RenderSettings()->GetDefaultPenWidth();
|
||||||
|
|
||||||
if( plotColor == COLOR4D::UNSPECIFIED )
|
if( plotColor == COLOR4D::UNSPECIFIED )
|
||||||
plotColor = COLOR4D( RED );
|
plotColor = COLOR4D( RED );
|
||||||
|
@ -97,7 +97,7 @@ void PlotWorkSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BLOCK
|
||||||
case WSG_LINE_T:
|
case WSG_LINE_T:
|
||||||
{
|
{
|
||||||
WS_DRAW_ITEM_LINE* line = (WS_DRAW_ITEM_LINE*) item;
|
WS_DRAW_ITEM_LINE* line = (WS_DRAW_ITEM_LINE*) item;
|
||||||
plotter->SetCurrentLineWidth( line->GetPenWidth() );
|
plotter->SetCurrentLineWidth( std::max( line->GetPenWidth(), defaultPenWidth ) );
|
||||||
plotter->MoveTo( line->GetStart() );
|
plotter->MoveTo( line->GetStart() );
|
||||||
plotter->FinishTo( line->GetEnd() );
|
plotter->FinishTo( line->GetEnd() );
|
||||||
}
|
}
|
||||||
|
@ -106,24 +106,26 @@ void PlotWorkSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BLOCK
|
||||||
case WSG_RECT_T:
|
case WSG_RECT_T:
|
||||||
{
|
{
|
||||||
WS_DRAW_ITEM_RECT* rect = (WS_DRAW_ITEM_RECT*) item;
|
WS_DRAW_ITEM_RECT* rect = (WS_DRAW_ITEM_RECT*) item;
|
||||||
plotter->Rect( rect->GetStart(), rect->GetEnd(), NO_FILL, rect->GetPenWidth() );
|
int penWidth = std::max( rect->GetPenWidth(), defaultPenWidth );
|
||||||
|
plotter->Rect( rect->GetStart(), rect->GetEnd(), NO_FILL, penWidth );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WSG_TEXT_T:
|
case WSG_TEXT_T:
|
||||||
{
|
{
|
||||||
WS_DRAW_ITEM_TEXT* text = (WS_DRAW_ITEM_TEXT*) item;
|
WS_DRAW_ITEM_TEXT* text = (WS_DRAW_ITEM_TEXT*) item;
|
||||||
|
int penWidth = std::max( text->GetEffectiveTextPenWidth(), defaultPenWidth );
|
||||||
plotter->Text( text->GetTextPos(), plotColor, text->GetShownText(),
|
plotter->Text( text->GetTextPos(), plotColor, text->GetShownText(),
|
||||||
text->GetTextAngle(), text->GetTextSize(),
|
text->GetTextAngle(), text->GetTextSize(), text->GetHorizJustify(),
|
||||||
text->GetHorizJustify(), text->GetVertJustify(),
|
text->GetVertJustify(), penWidth, text->IsItalic(), text->IsBold(),
|
||||||
text->GetEffectiveTextPenWidth( nullptr ),
|
text->GetTextMarkupFlags(), text->IsMultilineAllowed() );
|
||||||
text->IsItalic(), text->IsBold(), text->IsMultilineAllowed() );
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WSG_POLY_T:
|
case WSG_POLY_T:
|
||||||
{
|
{
|
||||||
WS_DRAW_ITEM_POLYPOLYGONS* poly = (WS_DRAW_ITEM_POLYPOLYGONS*) item;
|
WS_DRAW_ITEM_POLYPOLYGONS* poly = (WS_DRAW_ITEM_POLYPOLYGONS*) item;
|
||||||
|
int penWidth = std::max( poly->GetPenWidth(), defaultPenWidth );
|
||||||
std::vector<wxPoint> points;
|
std::vector<wxPoint> points;
|
||||||
|
|
||||||
for( int idx = 0; idx < poly->GetPolygons().OutlineCount(); ++idx )
|
for( int idx = 0; idx < poly->GetPolygons().OutlineCount(); ++idx )
|
||||||
|
@ -134,7 +136,7 @@ void PlotWorkSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BLOCK
|
||||||
for( int ii = 0; ii < outline.PointCount(); ii++ )
|
for( int ii = 0; ii < outline.PointCount(); ii++ )
|
||||||
points.emplace_back( outline.CPoint( ii ).x, outline.CPoint( ii ).y );
|
points.emplace_back( outline.CPoint( ii ).x, outline.CPoint( ii ).y );
|
||||||
|
|
||||||
plotter->PlotPoly( points, FILLED_SHAPE, poly->GetPenWidth() );
|
plotter->PlotPoly( points, FILLED_SHAPE, penWidth );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -39,14 +39,9 @@
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <trigo.h>
|
#include <trigo.h>
|
||||||
#include <eda_base_frame.h>
|
|
||||||
#include <base_struct.h>
|
#include <base_struct.h>
|
||||||
#include <common.h>
|
|
||||||
#include <plotter.h>
|
#include <plotter.h>
|
||||||
#include <macros.h>
|
|
||||||
#include <base_screen.h>
|
|
||||||
#include <gr_text.h>
|
#include <gr_text.h>
|
||||||
#include <geometry/shape_line_chain.h>
|
#include <geometry/shape_line_chain.h>
|
||||||
#include <geometry/geometry_utils.h>
|
#include <geometry/geometry_utils.h>
|
||||||
|
@ -56,19 +51,18 @@
|
||||||
PLOTTER::PLOTTER( )
|
PLOTTER::PLOTTER( )
|
||||||
{
|
{
|
||||||
plotScale = 1;
|
plotScale = 1;
|
||||||
defaultPenWidth = 0;
|
|
||||||
currentPenWidth = -1; // To-be-set marker
|
currentPenWidth = -1; // To-be-set marker
|
||||||
penState = 'Z'; // End-of-path idle
|
penState = 'Z'; // End-of-path idle
|
||||||
m_plotMirror = false; // Plot mirror option flag
|
m_plotMirror = false; // Plot mirror option flag
|
||||||
m_mirrorIsHorizontal = true;
|
m_mirrorIsHorizontal = true;
|
||||||
m_yaxisReversed = false;
|
m_yaxisReversed = false;
|
||||||
outputFile = 0;
|
outputFile = 0;
|
||||||
m_colors = nullptr;
|
|
||||||
colorMode = false; // Starts as a BW plot
|
colorMode = false; // Starts as a BW plot
|
||||||
negativeMode = false;
|
negativeMode = false;
|
||||||
// Temporary init to avoid not initialized vars, will be set later
|
// Temporary init to avoid not initialized vars, will be set later
|
||||||
m_IUsPerDecimil = 1; // will be set later to the actual value
|
m_IUsPerDecimil = 1; // will be set later to the actual value
|
||||||
iuPerDeviceUnit = 1; // will be set later to the actual value
|
iuPerDeviceUnit = 1; // will be set later to the actual value
|
||||||
|
m_renderSettings = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
PLOTTER::~PLOTTER()
|
PLOTTER::~PLOTTER()
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2020 KiCad Developers, see CHANGELOG.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 2
|
||||||
|
* 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 <render_settings.h>
|
||||||
|
|
||||||
|
using namespace KIGFX;
|
||||||
|
|
||||||
|
|
||||||
|
RENDER_SETTINGS::RENDER_SETTINGS() :
|
||||||
|
m_printDC( nullptr )
|
||||||
|
{
|
||||||
|
// Set the default initial values
|
||||||
|
m_highlightFactor = 0.5f;
|
||||||
|
m_selectFactor = 0.5f;
|
||||||
|
m_highlightItems = false;
|
||||||
|
m_highlightEnabled = false;
|
||||||
|
m_hiContrastEnabled = false;
|
||||||
|
m_hiContrastFactor = 0.2f; //TODO: Make this user-configurable
|
||||||
|
m_highlightNetcode = -1;
|
||||||
|
m_outlineWidth = 1;
|
||||||
|
m_worksheetLineWidth = 100000;
|
||||||
|
m_defaultPenWidth = 0;
|
||||||
|
m_showPageLimits = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
RENDER_SETTINGS::~RENDER_SETTINGS()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RENDER_SETTINGS::update()
|
||||||
|
{
|
||||||
|
// Calculate darkened/highlighted variants of layer colors
|
||||||
|
for( int i = 0; i < LAYER_ID_COUNT; i++ )
|
||||||
|
{
|
||||||
|
m_hiContrastColor[i] = m_layerColors[i].Mix( m_layerColors[LAYER_PCB_BACKGROUND],
|
||||||
|
m_hiContrastFactor );
|
||||||
|
m_layerColorsHi[i] = m_layerColors[i].Brightened( m_highlightFactor );
|
||||||
|
m_layerColorsDark[i] = m_layerColors[i].Darkened( 1.0 - m_highlightFactor );
|
||||||
|
m_layerColorsSel[i] = m_layerColors[i].Brightened( m_selectFactor );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -426,8 +426,8 @@ wxString LIB_PART::SubReference( int aUnit, bool aAddSeparator )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PART::Print( wxDC* aDc, const wxPoint& aOffset, int aMulti, int aConvert,
|
void LIB_PART::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, int aMulti,
|
||||||
const PART_DRAW_OPTIONS& aOpts )
|
int aConvert, const PART_DRAW_OPTIONS& aOpts )
|
||||||
{
|
{
|
||||||
/* draw background for filled items using background option
|
/* draw background for filled items using background option
|
||||||
* Solid lines will be drawn after the background
|
* Solid lines will be drawn after the background
|
||||||
|
@ -452,7 +452,7 @@ void LIB_PART::Print( wxDC* aDc, const wxPoint& aOffset, int aMulti, int aConver
|
||||||
|
|
||||||
// Now, draw only the background for items with
|
// Now, draw only the background for items with
|
||||||
// m_Fill == FILLED_WITH_BG_BODYCOLOR:
|
// m_Fill == FILLED_WITH_BG_BODYCOLOR:
|
||||||
drawItem.Print( aDc, aOffset, (void*) false, aOpts.transform );
|
drawItem.Print( aSettings, aOffset, (void*) false, aOpts.transform );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -478,16 +478,16 @@ void LIB_PART::Print( wxDC* aDc, const wxPoint& aOffset, int aMulti, int aConver
|
||||||
|
|
||||||
if( drawItem.Type() == LIB_PIN_T )
|
if( drawItem.Type() == LIB_PIN_T )
|
||||||
{
|
{
|
||||||
drawItem.Print( aDc, aOffset, (void*) &aOpts, aOpts.transform );
|
drawItem.Print( aSettings, aOffset, (void*) &aOpts, aOpts.transform );
|
||||||
}
|
}
|
||||||
else if( drawItem.Type() == LIB_FIELD_T )
|
else if( drawItem.Type() == LIB_FIELD_T )
|
||||||
{
|
{
|
||||||
drawItem.Print( aDc, aOffset, (void*) NULL, aOpts.transform );
|
drawItem.Print( aSettings, aOffset, (void*) NULL, aOpts.transform );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool forceNoFill = drawItem.m_Fill == FILLED_WITH_BG_BODYCOLOR;
|
bool forceNoFill = drawItem.m_Fill == FILLED_WITH_BG_BODYCOLOR;
|
||||||
drawItem.Print( aDc, aOffset, (void*) forceNoFill, aOpts.transform );
|
drawItem.Print( aSettings, aOffset, (void*) forceNoFill, aOpts.transform );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -498,7 +498,7 @@ void LIB_PART::Plot( PLOTTER* aPlotter, int aUnit, int aConvert,
|
||||||
{
|
{
|
||||||
wxASSERT( aPlotter != NULL );
|
wxASSERT( aPlotter != NULL );
|
||||||
|
|
||||||
aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_DEVICE ) );
|
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
|
||||||
bool fill = aPlotter->GetColorMode();
|
bool fill = aPlotter->GetColorMode();
|
||||||
|
|
||||||
// draw background for filled items using background option
|
// draw background for filled items using background option
|
||||||
|
@ -544,7 +544,7 @@ void LIB_PART::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert,
|
||||||
{
|
{
|
||||||
wxASSERT( aPlotter != NULL );
|
wxASSERT( aPlotter != NULL );
|
||||||
|
|
||||||
aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_FIELDS ) );
|
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_FIELDS ) );
|
||||||
bool fill = aPlotter->GetColorMode();
|
bool fill = aPlotter->GetColorMode();
|
||||||
|
|
||||||
for( LIB_ITEM& item : m_drawings )
|
for( LIB_ITEM& item : m_drawings )
|
||||||
|
|
|
@ -65,19 +65,19 @@ extern bool operator<( const LIB_PART& aItem1, const LIB_PART& aItem2 );
|
||||||
|
|
||||||
struct PART_DRAW_OPTIONS
|
struct PART_DRAW_OPTIONS
|
||||||
{
|
{
|
||||||
TRANSFORM transform; ///< Coordinate adjustment settings
|
TRANSFORM transform; // Coordinate adjustment settings
|
||||||
bool draw_visible_fields; ///< Whether to draw "visible" fields
|
bool draw_visible_fields; // Whether to draw "visible" fields
|
||||||
bool draw_hidden_fields; ///< Whether to draw "hidden" fields
|
bool draw_hidden_fields; // Whether to draw "hidden" fields
|
||||||
bool show_elec_type; ///< Whether to show the pin electrical type
|
bool show_elec_type; // Whether to show the pin electrical type
|
||||||
|
int text_markup_flags; // Whether to process various text markups
|
||||||
|
|
||||||
static PART_DRAW_OPTIONS Default()
|
PART_DRAW_OPTIONS()
|
||||||
{
|
{
|
||||||
PART_DRAW_OPTIONS def;
|
transform = DefaultTransform;
|
||||||
def.transform = DefaultTransform;
|
draw_visible_fields = true;
|
||||||
def.draw_visible_fields = true;
|
draw_hidden_fields = true;
|
||||||
def.draw_hidden_fields = true;
|
show_elec_type = false;
|
||||||
def.show_elec_type = false;
|
text_markup_flags = 0;
|
||||||
return def;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -294,13 +294,12 @@ public:
|
||||||
/**
|
/**
|
||||||
* Print part.
|
* Print part.
|
||||||
*
|
*
|
||||||
* @param aDc - Device context to draw on.
|
|
||||||
* @param aOffset - Position of part.
|
* @param aOffset - Position of part.
|
||||||
* @param aMulti - unit if multiple units per part.
|
* @param aMulti - unit if multiple units per part.
|
||||||
* @param aConvert - Component conversion (DeMorgan) if available.
|
* @param aConvert - Component conversion (DeMorgan) if available.
|
||||||
* @param aOpts - Drawing options
|
* @param aOpts - Drawing options
|
||||||
*/
|
*/
|
||||||
void Print( wxDC* aDc, const wxPoint& aOffset, int aMulti, int aConvert,
|
void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, int aMulti, int aConvert,
|
||||||
const PART_DRAW_OPTIONS& aOpts );
|
const PART_DRAW_OPTIONS& aOpts );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -160,7 +160,8 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataToWindow()
|
||||||
{
|
{
|
||||||
if( defined.count( templateFieldname.m_Name ) <= 0 )
|
if( defined.count( templateFieldname.m_Name ) <= 0 )
|
||||||
{
|
{
|
||||||
SCH_FIELD field( wxPoint( 0, 0 ), -1, m_cmp, templateFieldname.m_Name );
|
SCH_FIELD field( wxPoint( 0, 0 ), -1, m_cmp, templateFieldname.m_Name,
|
||||||
|
GetParent()->GetTextMarkupFlags() );
|
||||||
field.SetVisible( templateFieldname.m_Visible );
|
field.SetVisible( templateFieldname.m_Visible );
|
||||||
m_fields->push_back( field );
|
m_fields->push_back( field );
|
||||||
}
|
}
|
||||||
|
@ -530,9 +531,10 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnAddField( wxCommandEvent& event )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int fieldID = m_fields->size();
|
int fieldID = m_fields->size();
|
||||||
SCH_FIELD newField( wxPoint( 0, 0 ), fieldID, m_cmp );
|
SCH_FIELD newField( wxPoint( 0, 0 ), fieldID, m_cmp,
|
||||||
|
TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldID ),
|
||||||
|
GetParent()->GetTextMarkupFlags() );
|
||||||
|
|
||||||
newField.SetName( TEMPLATE_FIELDNAME::GetDefaultFieldName( fieldID ) );
|
|
||||||
newField.SetTextAngle( m_fields->at( REFERENCE ).GetTextAngle() );
|
newField.SetTextAngle( m_fields->at( REFERENCE ).GetTextAngle() );
|
||||||
|
|
||||||
newField.SetTextSize( wxSize( GetParent()->GetDefaultTextSize(),
|
newField.SetTextSize( wxSize( GetParent()->GetDefaultTextSize(),
|
||||||
|
@ -662,7 +664,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::UpdateFieldsFromLibrary( wxCommandEvent
|
||||||
{
|
{
|
||||||
if( defined.count( templateFieldname.m_Name ) <= 0 )
|
if( defined.count( templateFieldname.m_Name ) <= 0 )
|
||||||
{
|
{
|
||||||
SCH_FIELD field( wxPoint( 0, 0 ), -1, m_cmp, templateFieldname.m_Name );
|
SCH_FIELD field( wxPoint( 0, 0 ), -1, m_cmp, templateFieldname.m_Name,
|
||||||
|
GetParent()->GetTextMarkupFlags() );
|
||||||
field.SetVisible( templateFieldname.m_Visible );
|
field.SetVisible( templateFieldname.m_Visible );
|
||||||
m_fields->push_back( field );
|
m_fields->push_back( field );
|
||||||
}
|
}
|
||||||
|
|
|
@ -460,12 +460,12 @@ bool DIALOG_LABEL_EDITOR::TransferDataFromWindow()
|
||||||
if( ( style & 2 ) )
|
if( ( style & 2 ) )
|
||||||
{
|
{
|
||||||
m_CurrentText->SetBold( true );
|
m_CurrentText->SetBold( true );
|
||||||
m_CurrentText->SetTextPenWidth( GetPenSizeForBold( m_CurrentText->GetTextWidth() ) );
|
m_CurrentText->SetTextThickness( GetPenSizeForBold( m_CurrentText->GetTextWidth() ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_CurrentText->SetBold( false );
|
m_CurrentText->SetBold( false );
|
||||||
m_CurrentText->SetTextPenWidth( 0 ); // Use default pen width
|
m_CurrentText->SetTextThickness( 0 ); // Use default pen width
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Parent->RefreshItem( m_CurrentText );
|
m_Parent->RefreshItem( m_CurrentText );
|
||||||
|
|
|
@ -82,10 +82,10 @@ bool DIALOG_EDIT_LINE_STYLE::TransferDataToWindow()
|
||||||
if( std::all_of( m_lines.begin() + 1, m_lines.end(),
|
if( std::all_of( m_lines.begin() + 1, m_lines.end(),
|
||||||
[&]( const SCH_LINE* r )
|
[&]( const SCH_LINE* r )
|
||||||
{
|
{
|
||||||
return r->GetPenSize() == first_line->GetPenSize();
|
return r->GetPenWidth() == first_line->GetPenWidth();
|
||||||
} ) )
|
} ) )
|
||||||
{
|
{
|
||||||
m_width.SetValue( first_line->GetPenSize() );
|
m_width.SetValue( first_line->GetPenWidth() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -608,7 +608,8 @@ public:
|
||||||
if( !destField && !srcValue.IsEmpty() )
|
if( !destField && !srcValue.IsEmpty() )
|
||||||
{
|
{
|
||||||
const auto compOrigin = comp.GetPosition();
|
const auto compOrigin = comp.GetPosition();
|
||||||
destField = comp.AddField( SCH_FIELD( compOrigin, -1, &comp, srcName ) );
|
destField = comp.AddField( SCH_FIELD( compOrigin, -1, &comp, srcName,
|
||||||
|
m_frame->GetTextMarkupFlags() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !destField )
|
if( !destField )
|
||||||
|
|
|
@ -186,10 +186,14 @@ void DIALOG_LIB_EDIT_PIN::OnPaintShowPanel( wxPaintEvent& event )
|
||||||
dc.SetUserScale( scale, scale );
|
dc.SetUserScale( scale, scale );
|
||||||
GRResetPenAndBrush( &dc );
|
GRResetPenAndBrush( &dc );
|
||||||
|
|
||||||
PART_DRAW_OPTIONS opts = PART_DRAW_OPTIONS::Default();
|
PART_DRAW_OPTIONS opts;
|
||||||
opts.draw_hidden_fields = true;
|
opts.draw_hidden_fields = true;
|
||||||
|
opts.text_markup_flags = libframe->GetTextMarkupFlags();
|
||||||
|
|
||||||
m_dummyPin->Print( &dc, -bBox.Centre(), (void*) &opts, DefaultTransform );
|
RENDER_SETTINGS* renderSettings = libframe->GetRenderSettings();
|
||||||
|
renderSettings->SetPrintDC( &dc );
|
||||||
|
|
||||||
|
m_dummyPin->Print( renderSettings, -bBox.Centre(), (void*) &opts, DefaultTransform );
|
||||||
|
|
||||||
m_dummyPin->SetParent( nullptr );
|
m_dummyPin->SetParent( nullptr );
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#include <sch_sheet.h>
|
#include <sch_sheet.h>
|
||||||
#include <settings/settings_manager.h>
|
#include <settings/settings_manager.h>
|
||||||
#include <ws_painter.h>
|
#include <ws_painter.h>
|
||||||
|
#include <sch_painter.h>
|
||||||
|
|
||||||
// static members (static to remember last state):
|
// static members (static to remember last state):
|
||||||
int DIALOG_PLOT_SCHEMATIC::m_pageSizeSelect = PAGE_SIZE_AUTO;
|
int DIALOG_PLOT_SCHEMATIC::m_pageSizeSelect = PAGE_SIZE_AUTO;
|
||||||
|
@ -268,19 +268,18 @@ void DIALOG_PLOT_SCHEMATIC::OnUpdateUI( wxUpdateUIEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DIALOG_PLOT_SCHEMATIC::getPlotOptions( int* aDefaultLineWidth )
|
void DIALOG_PLOT_SCHEMATIC::getPlotOptions( RENDER_SETTINGS* aSettings )
|
||||||
{
|
{
|
||||||
m_HPGLPenSize = m_penWidth.GetValue();
|
m_HPGLPenSize = m_penWidth.GetValue();
|
||||||
|
|
||||||
auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
|
EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
|
||||||
wxASSERT( cfg );
|
wxASSERT( cfg );
|
||||||
|
|
||||||
if( cfg )
|
if( cfg )
|
||||||
{
|
{
|
||||||
cfg->m_PlotPanel.background_color = m_plotBackgroundColor->GetValue();
|
cfg->m_PlotPanel.background_color = m_plotBackgroundColor->GetValue();
|
||||||
cfg->m_PlotPanel.color = getModeColor();
|
cfg->m_PlotPanel.color = getModeColor();
|
||||||
cfg->m_PlotPanel.color_theme = static_cast<COLOR_SETTINGS*>(
|
cfg->m_PlotPanel.color_theme = getColorSettings()->GetFilename();
|
||||||
m_colorTheme->GetClientData( m_colorTheme->GetSelection() ) )->GetFilename();
|
|
||||||
cfg->m_PlotPanel.frame_reference = getPlotFrameRef();
|
cfg->m_PlotPanel.frame_reference = getPlotFrameRef();
|
||||||
cfg->m_PlotPanel.format = static_cast<int>( GetPlotFileFormat() );
|
cfg->m_PlotPanel.format = static_cast<int>( GetPlotFileFormat() );
|
||||||
cfg->m_PlotPanel.hpgl_origin = GetPlotOriginCenter();
|
cfg->m_PlotPanel.hpgl_origin = GetPlotOriginCenter();
|
||||||
|
@ -290,7 +289,8 @@ void DIALOG_PLOT_SCHEMATIC::getPlotOptions( int* aDefaultLineWidth )
|
||||||
cfg->m_PlotPanel.hpgl_pen_size = m_HPGLPenSize / IU_PER_MM;
|
cfg->m_PlotPanel.hpgl_pen_size = m_HPGLPenSize / IU_PER_MM;
|
||||||
}
|
}
|
||||||
|
|
||||||
*aDefaultLineWidth = (int) m_defaultLineWidth.GetValue();
|
aSettings->LoadColors( getColorSettings() );
|
||||||
|
aSettings->SetDefaultPenWidth( (int) m_defaultLineWidth.GetValue() );
|
||||||
|
|
||||||
// Plot directory
|
// Plot directory
|
||||||
wxString path = m_outputDirectoryName->GetValue();
|
wxString path = m_outputDirectoryName->GetValue();
|
||||||
|
@ -324,24 +324,24 @@ void DIALOG_PLOT_SCHEMATIC::OnPlotAll( wxCommandEvent& event )
|
||||||
|
|
||||||
void DIALOG_PLOT_SCHEMATIC::PlotSchematic( bool aPlotAll )
|
void DIALOG_PLOT_SCHEMATIC::PlotSchematic( bool aPlotAll )
|
||||||
{
|
{
|
||||||
int defaultLineWidth;
|
KIGFX::SCH_RENDER_SETTINGS renderSettings( *m_parent->GetRenderSettings() );
|
||||||
|
|
||||||
getPlotOptions( &defaultLineWidth );
|
getPlotOptions( &renderSettings );
|
||||||
|
|
||||||
switch( GetPlotFileFormat() )
|
switch( GetPlotFileFormat() )
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case PLOT_FORMAT::POST:
|
case PLOT_FORMAT::POST:
|
||||||
createPSFile( aPlotAll, getPlotFrameRef(), defaultLineWidth );
|
createPSFile( aPlotAll, getPlotFrameRef(), &renderSettings );
|
||||||
break;
|
break;
|
||||||
case PLOT_FORMAT::DXF:
|
case PLOT_FORMAT::DXF:
|
||||||
CreateDXFFile( aPlotAll, getPlotFrameRef() );
|
CreateDXFFile( aPlotAll, getPlotFrameRef() );
|
||||||
break;
|
break;
|
||||||
case PLOT_FORMAT::PDF:
|
case PLOT_FORMAT::PDF:
|
||||||
createPDFFile( aPlotAll, getPlotFrameRef(), defaultLineWidth );
|
createPDFFile( aPlotAll, getPlotFrameRef(), &renderSettings );
|
||||||
break;
|
break;
|
||||||
case PLOT_FORMAT::SVG:
|
case PLOT_FORMAT::SVG:
|
||||||
createSVGFile( aPlotAll, getPlotFrameRef(), defaultLineWidth );
|
createSVGFile( aPlotAll, getPlotFrameRef(), &renderSettings );
|
||||||
break;
|
break;
|
||||||
case PLOT_FORMAT::HPGL:
|
case PLOT_FORMAT::HPGL:
|
||||||
createHPGLFile( aPlotAll, getPlotFrameRef() );
|
createHPGLFile( aPlotAll, getPlotFrameRef() );
|
||||||
|
|
|
@ -71,7 +71,7 @@ private:
|
||||||
void initDlg();
|
void initDlg();
|
||||||
|
|
||||||
// common
|
// common
|
||||||
void getPlotOptions( int* aDefaultLineWidth );
|
void getPlotOptions( RENDER_SETTINGS* aSettings );
|
||||||
|
|
||||||
bool getModeColor()
|
bool getModeColor()
|
||||||
{ return m_ModeColorOption->GetSelection() == 0; }
|
{ return m_ModeColorOption->GetSelection() == 0; }
|
||||||
|
@ -94,7 +94,7 @@ private:
|
||||||
void PlotSchematic( bool aPlotAll );
|
void PlotSchematic( bool aPlotAll );
|
||||||
|
|
||||||
// PDF
|
// PDF
|
||||||
void createPDFFile( bool aPlotAll, bool aPlotFrameRef, int aDefaultLineWidth );
|
void createPDFFile( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aRenderSettings );
|
||||||
void plotOneSheetPDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen, bool aPlotFrameRef);
|
void plotOneSheetPDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen, bool aPlotFrameRef);
|
||||||
void setupPlotPagePDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen );
|
void setupPlotPagePDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen );
|
||||||
|
|
||||||
|
@ -128,15 +128,16 @@ private:
|
||||||
wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef );
|
wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef );
|
||||||
|
|
||||||
// PS
|
// PS
|
||||||
void createPSFile( bool aPlotAll, bool aPlotFrameRef, int aDefaultLineWidth );
|
void createPSFile( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aSettings );
|
||||||
bool plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen, int aDefaultLineWidth,
|
bool plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen,
|
||||||
const PAGE_INFO& aPageInfo, wxPoint aPlot0ffset, double aScale,
|
RENDER_SETTINGS* aRenderSettings, const PAGE_INFO& aPageInfo,
|
||||||
bool aPlotFrameRef );
|
wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef );
|
||||||
|
|
||||||
// SVG
|
// SVG
|
||||||
void createSVGFile( bool aPlotAll, bool aPlotFrameRef, int aDefaultLineWidth );
|
void createSVGFile( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aSettings );
|
||||||
bool plotOneSheetSVG( const wxString& aFileName, SCH_SCREEN* aScreen, int aDefaultLineWidth,
|
bool plotOneSheetSVG( const wxString& aFileName, SCH_SCREEN* aScreen,
|
||||||
bool aPlotBlackAndWhite, bool aPlotFrameRef );
|
RENDER_SETTINGS* aRenderSettings, bool aPlotBlackAndWhite,
|
||||||
|
bool aPlotFrameRef );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a file name with an absolute path name
|
* Create a file name with an absolute path name
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#include <sch_sheet.h>
|
#include <sch_sheet.h>
|
||||||
#include <sch_sheet_path.h>
|
#include <sch_sheet_path.h>
|
||||||
#include <dialog_print_using_printer_base.h>
|
#include <dialog_print_using_printer_base.h>
|
||||||
|
#include <sch_painter.h>
|
||||||
|
|
||||||
class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_BASE
|
class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_BASE
|
||||||
{
|
{
|
||||||
|
@ -424,14 +424,20 @@ void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen )
|
||||||
if( m_parent->GetPrintMonochrome() )
|
if( m_parent->GetPrintMonochrome() )
|
||||||
GRForceBlackPen( true );
|
GRForceBlackPen( true );
|
||||||
|
|
||||||
|
KIGFX::SCH_RENDER_SETTINGS renderSettings( *m_parent->GetRenderSettings() );
|
||||||
|
renderSettings.SetPrintDC( dc );
|
||||||
|
// The worksheet item print code is shared between PCBNew and EESchema, so it's easier
|
||||||
|
// if they just use the PCB layer.
|
||||||
|
renderSettings.SetLayerColor( LAYER_WORKSHEET,
|
||||||
|
renderSettings.GetLayerColor( LAYER_SCHEMATIC_WORKSHEET ) );
|
||||||
|
|
||||||
if( printReference )
|
if( printReference )
|
||||||
{
|
{
|
||||||
m_parent->PrintWorkSheet( dc, aScreen, m_parent->GetDefaultLineWidth(), IU_PER_MILS,
|
m_parent->PrintWorkSheet( &renderSettings, aScreen, IU_PER_MILS, aScreen->GetFileName(),
|
||||||
aScreen->GetFileName(), wxEmptyString,
|
wxEmptyString );
|
||||||
m_parent->GetLayerColor( LAYER_SCHEMATIC_WORKSHEET ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
aScreen->Print( dc );
|
aScreen->Print( &renderSettings );
|
||||||
|
|
||||||
m_parent->SetDrawBgColor( bgColor );
|
m_parent->SetDrawBgColor( bgColor );
|
||||||
aScreen->m_IsPrinting = false;
|
aScreen->m_IsPrinting = false;
|
||||||
|
|
|
@ -561,9 +561,10 @@ void DIALOG_SCH_SHEET_PROPS::OnAddField( wxCommandEvent& event )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int fieldID = m_fields->size();
|
int fieldID = m_fields->size();
|
||||||
SCH_FIELD newField( wxPoint( 0, 0 ), fieldID, m_sheet );
|
SCH_FIELD newField( wxPoint( 0, 0 ), fieldID, m_sheet,
|
||||||
|
SCH_SHEET::GetDefaultFieldName( fieldID ),
|
||||||
|
m_frame->GetTextMarkupFlags() );
|
||||||
|
|
||||||
newField.SetName( SCH_SHEET::GetDefaultFieldName( fieldID ) );
|
|
||||||
newField.SetTextAngle( m_fields->at( SHEETNAME ).GetTextAngle() );
|
newField.SetTextAngle( m_fields->at( SHEETNAME ).GetTextAngle() );
|
||||||
|
|
||||||
m_fields->push_back( newField );
|
m_fields->push_back( newField );
|
||||||
|
|
|
@ -233,7 +233,8 @@ void DIALOG_UPDATE_FIELDS::updateFields( SCH_COMPONENT* aComponent )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Missing field, it has to be added to the component
|
// Missing field, it has to be added to the component
|
||||||
SCH_FIELD newField( wxPoint( 0, 0 ), newFields.size(), aComponent, fieldName );
|
SCH_FIELD newField( wxPoint( 0, 0 ), newFields.size(), aComponent, fieldName,
|
||||||
|
m_frame->GetTextMarkupFlags() );
|
||||||
|
|
||||||
newField.ImportValues( *libField );
|
newField.ImportValues( *libField );
|
||||||
newField.SetText( libField->GetText() );
|
newField.SetText( libField->GetText() );
|
||||||
|
|
|
@ -364,8 +364,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
|
||||||
t3->SetIsDangling( false );
|
t3->SetIsDangling( false );
|
||||||
addItem( t3 );
|
addItem( t3 );
|
||||||
|
|
||||||
auto t4 = new SCH_GLOBALLABEL(
|
auto t4 = new SCH_GLOBALLABEL( wxPoint( Mils2iu( 1750 ), Mils2iu( 1400 ) ), wxT( "GLOBAL[3..0]" ) );
|
||||||
wxPoint( Mils2iu( 1750 ), Mils2iu( 1400 ) ), wxT( "GLOBAL[3..0]" ) );
|
|
||||||
t4->SetLabelSpinStyle( LABEL_SPIN_STYLE::SPIN::LEFT );
|
t4->SetLabelSpinStyle( LABEL_SPIN_STYLE::SPIN::LEFT );
|
||||||
t4->SetIsDangling( false );
|
t4->SetIsDangling( false );
|
||||||
addItem( t4 );
|
addItem( t4 );
|
||||||
|
|
|
@ -72,10 +72,11 @@ bool PANEL_SETUP_FORMATTING::TransferDataToWindow()
|
||||||
m_wireWidth.SetValue( m_frame->GetDefaultWireThickness() );
|
m_wireWidth.SetValue( m_frame->GetDefaultWireThickness() );
|
||||||
m_junctionSize.SetValue( SCH_JUNCTION::g_SymbolSize );
|
m_junctionSize.SetValue( SCH_JUNCTION::g_SymbolSize );
|
||||||
|
|
||||||
m_textOffsetRatioCtrl->SetValue( wxString::Format( "%f", GetTextOffsetRatio() * 100.0 ) );
|
wxString offsetRatio = wxString::Format( "%f", m_frame->GetTextOffsetRatio() * 100.0 );
|
||||||
|
m_textOffsetRatioCtrl->SetValue( offsetRatio );
|
||||||
|
|
||||||
int superSubFlags = ENABLE_SUBSCRIPT_MARKUP | ENABLE_SUPERSCRIPT_MARKUP;
|
int superSubFlags = ENABLE_SUBSCRIPT_MARKUP | ENABLE_SUPERSCRIPT_MARKUP;
|
||||||
m_checkSuperSub->SetValue( GetTextMarkupFlags() & superSubFlags );
|
m_checkSuperSub->SetValue( m_frame->GetTextMarkupFlags() & superSubFlags );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -111,18 +112,25 @@ bool PANEL_SETUP_FORMATTING::TransferDataFromWindow()
|
||||||
m_frame->SetDefaultBusThickness( (int) m_busWidth.GetValue() );
|
m_frame->SetDefaultBusThickness( (int) m_busWidth.GetValue() );
|
||||||
SCH_JUNCTION::g_SymbolSize = (int) m_junctionSize.GetValue();
|
SCH_JUNCTION::g_SymbolSize = (int) m_junctionSize.GetValue();
|
||||||
|
|
||||||
|
|
||||||
double dtmp = 0.0;
|
double dtmp = 0.0;
|
||||||
wxString msg = m_textOffsetRatioCtrl->GetValue();
|
wxString msg = m_textOffsetRatioCtrl->GetValue();
|
||||||
msg.ToDouble( &dtmp );
|
msg.ToDouble( &dtmp );
|
||||||
SetTextOffsetRatio( dtmp / 100.0 );
|
m_frame->SetTextOffsetRatio( dtmp / 100.0 );
|
||||||
|
|
||||||
int superSubFlags = ENABLE_SUBSCRIPT_MARKUP | ENABLE_SUPERSCRIPT_MARKUP;
|
int superSubFlags = ENABLE_SUBSCRIPT_MARKUP | ENABLE_SUPERSCRIPT_MARKUP;
|
||||||
|
|
||||||
if( m_checkSuperSub->GetValue() )
|
if( m_checkSuperSub->GetValue() )
|
||||||
SetTextMarkupFlags( GetTextMarkupFlags() | superSubFlags );
|
m_frame->SetTextMarkupFlags( m_frame->GetTextMarkupFlags() | superSubFlags );
|
||||||
else
|
else
|
||||||
SetTextMarkupFlags( GetTextMarkupFlags() & ~superSubFlags );
|
m_frame->SetTextMarkupFlags( m_frame->GetTextMarkupFlags() & ~superSubFlags );
|
||||||
|
|
||||||
|
m_frame->GetRenderSettings()->SetDefaultPenWidth( m_frame->GetDefaultLineWidth() );
|
||||||
|
m_frame->GetRenderSettings()->m_DefaultWireThickness = m_frame->GetDefaultWireThickness();
|
||||||
|
m_frame->GetRenderSettings()->m_DefaultBusThickness = m_frame->GetDefaultBusThickness();
|
||||||
|
m_frame->GetRenderSettings()->m_TextOffsetRatio = m_frame->GetTextOffsetRatio();
|
||||||
|
|
||||||
|
SCH_SCREENS schematic;
|
||||||
|
schematic.UpdateTextMarkupFlags( m_frame->GetTextMarkupFlags() );
|
||||||
|
|
||||||
m_frame->GetCanvas()->GetView()->MarkDirty();
|
m_frame->GetCanvas()->GetView()->MarkDirty();
|
||||||
m_frame->GetCanvas()->GetView()->UpdateAllItems( KIGFX::REPAINT );
|
m_frame->GetCanvas()->GetView()->UpdateAllItems( KIGFX::REPAINT );
|
||||||
|
|
|
@ -60,28 +60,29 @@ SCH_TEXT* SCH_EDIT_FRAME::GetNextNewText()
|
||||||
|
|
||||||
SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( int aType )
|
SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( int aType )
|
||||||
{
|
{
|
||||||
wxPoint cursorPos = (wxPoint) GetCanvas()->GetViewControls()->GetCursorPosition();
|
wxPoint cursorPos = (wxPoint) GetCanvas()->GetViewControls()->GetCursorPosition();
|
||||||
SCH_TEXT* textItem = nullptr;
|
SCH_TEXT* textItem = nullptr;
|
||||||
|
int markupFlags = GetTextMarkupFlags();
|
||||||
|
|
||||||
s_queuedTexts.clear();
|
s_queuedTexts.clear();
|
||||||
|
|
||||||
switch( aType )
|
switch( aType )
|
||||||
{
|
{
|
||||||
case LAYER_NOTES:
|
case LAYER_NOTES:
|
||||||
textItem = new SCH_TEXT( cursorPos );
|
textItem = new SCH_TEXT( cursorPos, wxEmptyString, SCH_TEXT_T, markupFlags );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LAYER_LOCLABEL:
|
case LAYER_LOCLABEL:
|
||||||
textItem = new SCH_LABEL( cursorPos );
|
textItem = new SCH_LABEL( cursorPos, wxEmptyString, markupFlags );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LAYER_HIERLABEL:
|
case LAYER_HIERLABEL:
|
||||||
textItem = new SCH_HIERLABEL( cursorPos );
|
textItem = new SCH_HIERLABEL( cursorPos, wxEmptyString, SCH_HIER_LABEL_T, markupFlags );
|
||||||
textItem->SetShape( lastGlobalLabelShape );
|
textItem->SetShape( lastGlobalLabelShape );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LAYER_GLOBLABEL:
|
case LAYER_GLOBLABEL:
|
||||||
textItem = new SCH_GLOBALLABEL( cursorPos );
|
textItem = new SCH_GLOBALLABEL( cursorPos, wxEmptyString, markupFlags );
|
||||||
textItem->SetShape( lastGlobalLabelShape );
|
textItem->SetShape( lastGlobalLabelShape );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -199,6 +200,7 @@ void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* aText, KICAD_T aNewType )
|
||||||
const wxPoint& position = aText->GetPosition();
|
const wxPoint& position = aText->GetPosition();
|
||||||
LABEL_SPIN_STYLE orientation = aText->GetLabelSpinStyle();
|
LABEL_SPIN_STYLE orientation = aText->GetLabelSpinStyle();
|
||||||
wxString txt = UnescapeString( aText->GetText() );
|
wxString txt = UnescapeString( aText->GetText() );
|
||||||
|
int markupFlags = GetTextMarkupFlags();
|
||||||
|
|
||||||
// There can be characters in a SCH_TEXT object that can break labels so we have to
|
// There can be characters in a SCH_TEXT object that can break labels so we have to
|
||||||
// fix them here.
|
// fix them here.
|
||||||
|
@ -216,11 +218,18 @@ void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* aText, KICAD_T aNewType )
|
||||||
|
|
||||||
switch( aNewType )
|
switch( aNewType )
|
||||||
{
|
{
|
||||||
case SCH_LABEL_T: newtext = new SCH_LABEL( position, txt ); break;
|
case SCH_LABEL_T:
|
||||||
case SCH_GLOBAL_LABEL_T: newtext = new SCH_GLOBALLABEL( position, txt ); break;
|
newtext = new SCH_LABEL( position, txt, markupFlags );
|
||||||
case SCH_HIER_LABEL_T: newtext = new SCH_HIERLABEL( position, txt ); break;
|
break;
|
||||||
case SCH_TEXT_T: newtext = new SCH_TEXT( position, txt ); break;
|
case SCH_GLOBAL_LABEL_T:
|
||||||
|
newtext = new SCH_GLOBALLABEL( position, txt, markupFlags );
|
||||||
|
break;
|
||||||
|
case SCH_HIER_LABEL_T:
|
||||||
|
newtext = new SCH_HIERLABEL( position, txt, SCH_HIER_LABEL_T, markupFlags );
|
||||||
|
break;
|
||||||
|
case SCH_TEXT_T:
|
||||||
|
newtext = new SCH_TEXT( position, txt, SCH_TEXT_T, markupFlags );
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
wxFAIL_MSG( wxString::Format( "Invalid text type: %d.", aNewType ) );
|
wxFAIL_MSG( wxString::Format( "Invalid text type: %d.", aNewType ) );
|
||||||
return;
|
return;
|
||||||
|
@ -234,7 +243,7 @@ void SCH_EDIT_FRAME::ConvertTextType( SCH_TEXT* aText, KICAD_T aNewType )
|
||||||
newtext->SetShape( aText->GetShape() );
|
newtext->SetShape( aText->GetShape() );
|
||||||
newtext->SetLabelSpinStyle( orientation );
|
newtext->SetLabelSpinStyle( orientation );
|
||||||
newtext->SetTextSize( aText->GetTextSize() );
|
newtext->SetTextSize( aText->GetTextSize() );
|
||||||
newtext->SetTextPenWidth( aText->GetTextPenWidth() );
|
newtext->SetTextThickness( aText->GetTextThickness() );
|
||||||
newtext->SetItalic( aText->IsItalic() );
|
newtext->SetItalic( aText->IsItalic() );
|
||||||
newtext->SetBold( aText->IsBold() );
|
newtext->SetBold( aText->IsBold() );
|
||||||
newtext->SetIsDangling( aText->IsDangling() );
|
newtext->SetIsDangling( aText->IsDangling() );
|
||||||
|
|
|
@ -218,13 +218,6 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
|
||||||
|
|
||||||
void IFACE::OnKifaceEnd()
|
void IFACE::OnKifaceEnd()
|
||||||
{
|
{
|
||||||
COLOR_SETTINGS* cs = Pgm().GetSettingsManager().GetColorSettings();
|
|
||||||
|
|
||||||
for( SCH_LAYER_ID layer = SCH_LAYER_ID_START; layer < SCH_LAYER_ID_END; ++layer )
|
|
||||||
{
|
|
||||||
cs->SetColor( layer, GetLayerColor( layer ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
end_common();
|
end_common();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,9 +55,6 @@
|
||||||
#include <default_values.h> // For some default values
|
#include <default_values.h> // For some default values
|
||||||
|
|
||||||
|
|
||||||
static double s_textOffsetRatio = 0.08;
|
|
||||||
static int s_textMarkupFlags = 0;
|
|
||||||
|
|
||||||
#define FieldNameTemplatesKey wxT( "FieldNameTemplates" )
|
#define FieldNameTemplatesKey wxT( "FieldNameTemplates" )
|
||||||
|
|
||||||
|
|
||||||
|
@ -221,18 +218,6 @@ void SetSeverity( int aErrorCode, int aSeverity )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double GetTextOffsetRatio()
|
|
||||||
{
|
|
||||||
return s_textOffsetRatio;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void SetTextOffsetRatio( double aOffsetRatio )
|
|
||||||
{
|
|
||||||
s_textOffsetRatio = aOffsetRatio;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// Helper for all the old plotting/printing code while it still exists
|
/// Helper for all the old plotting/printing code while it still exists
|
||||||
COLOR4D GetLayerColor( SCH_LAYER_ID aLayer )
|
COLOR4D GetLayerColor( SCH_LAYER_ID aLayer )
|
||||||
{
|
{
|
||||||
|
@ -279,11 +264,11 @@ void SCH_EDIT_FRAME::AddFormattingParameters( std::vector<PARAM_CFG*>& params )
|
||||||
Mils2iu( DEFAULT_SIZE_TEXT ),
|
Mils2iu( DEFAULT_SIZE_TEXT ),
|
||||||
5, 1000, nullptr, 1 / IU_PER_MILS ) );
|
5, 1000, nullptr, 1 / IU_PER_MILS ) );
|
||||||
params.push_back( new PARAM_CFG_DOUBLE( wxT( "TextOffsetRatio" ),
|
params.push_back( new PARAM_CFG_DOUBLE( wxT( "TextOffsetRatio" ),
|
||||||
&s_textOffsetRatio,
|
&m_textOffsetRatio,
|
||||||
(double) TXT_MARGIN / DEFAULT_SIZE_TEXT,
|
(double) TXT_MARGIN / DEFAULT_SIZE_TEXT,
|
||||||
-200.0, 200.0 ) );
|
-200.0, 200.0 ) );
|
||||||
params.push_back( new PARAM_CFG_INT( wxT( "TextMarkupFlags" ),
|
params.push_back( new PARAM_CFG_INT( wxT( "TextMarkupFlags" ),
|
||||||
&s_textMarkupFlags, 0 ) );
|
&m_textMarkupFlags, 0 ) );
|
||||||
params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "LineThickness" ),
|
params.push_back( new PARAM_CFG_INT_WITH_SCALE( wxT( "LineThickness" ),
|
||||||
&m_defaultLineWidth,
|
&m_defaultLineWidth,
|
||||||
Mils2iu( appSettings->m_Drawing.default_line_thickness ),
|
Mils2iu( appSettings->m_Drawing.default_line_thickness ),
|
||||||
|
@ -343,11 +328,10 @@ bool SCH_EDIT_FRAME::LoadProjectFile()
|
||||||
bool ret = Prj().ConfigLoad( Kiface().KifaceSearch(), GROUP_SCH_EDIT,
|
bool ret = Prj().ConfigLoad( Kiface().KifaceSearch(), GROUP_SCH_EDIT,
|
||||||
GetProjectFileParameters() );
|
GetProjectFileParameters() );
|
||||||
|
|
||||||
SetTextMarkupFlags( s_textMarkupFlags );
|
GetRenderSettings()->SetDefaultPenWidth( GetDefaultLineWidth() );
|
||||||
|
|
||||||
GetRenderSettings()->m_DefaultLineWidth = GetDefaultLineWidth();
|
|
||||||
GetRenderSettings()->m_DefaultWireThickness = GetDefaultWireThickness();
|
GetRenderSettings()->m_DefaultWireThickness = GetDefaultWireThickness();
|
||||||
GetRenderSettings()->m_DefaultBusThickness = GetDefaultBusThickness();
|
GetRenderSettings()->m_DefaultBusThickness = GetDefaultBusThickness();
|
||||||
|
GetRenderSettings()->m_TextOffsetRatio = m_textOffsetRatio;
|
||||||
|
|
||||||
// Verify some values, because the config file can be edited by hand,
|
// Verify some values, because the config file can be edited by hand,
|
||||||
// and have bad values:
|
// and have bad values:
|
||||||
|
@ -397,8 +381,6 @@ void SCH_EDIT_FRAME::SaveProjectSettings()
|
||||||
|
|
||||||
wxString path = fn.GetFullPath();
|
wxString path = fn.GetFullPath();
|
||||||
|
|
||||||
s_textMarkupFlags = GetTextMarkupFlags();
|
|
||||||
|
|
||||||
prj.ConfigSave( Kiface().KifaceSearch(), GROUP_SCH_EDIT, GetProjectFileParameters(), path );
|
prj.ConfigSave( Kiface().KifaceSearch(), GROUP_SCH_EDIT, GetProjectFileParameters(), path );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -407,6 +407,8 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
||||||
}
|
}
|
||||||
|
|
||||||
schematic.UpdateSymbolLinks( true ); // Update all symbol library links for all sheets.
|
schematic.UpdateSymbolLinks( true ); // Update all symbol library links for all sheets.
|
||||||
|
schematic.UpdateTextMarkupFlags( GetTextMarkupFlags() );
|
||||||
|
|
||||||
g_ConnectionGraph->Reset();
|
g_ConnectionGraph->Reset();
|
||||||
RecalculateConnections( GLOBAL_CLEANUP );
|
RecalculateConnections( GLOBAL_CLEANUP );
|
||||||
SetScreen( g_CurrentSheet->LastScreen() );
|
SetScreen( g_CurrentSheet->LastScreen() );
|
||||||
|
@ -682,6 +684,7 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
|
||||||
UpdateFileHistory( aFileName );
|
UpdateFileHistory( aFileName );
|
||||||
SCH_SCREENS schematic;
|
SCH_SCREENS schematic;
|
||||||
schematic.UpdateSymbolLinks(); // Update all symbol library links for all sheets.
|
schematic.UpdateSymbolLinks(); // Update all symbol library links for all sheets.
|
||||||
|
schematic.UpdateTextMarkupFlags( GetTextMarkupFlags() );
|
||||||
|
|
||||||
GetScreen()->m_Initialized = true;
|
GetScreen()->m_Initialized = true;
|
||||||
SCH_SCREENS allScreens;
|
SCH_SCREENS allScreens;
|
||||||
|
|
|
@ -71,16 +71,4 @@ extern ERC_SETTINGS* g_ErcSettings;
|
||||||
int GetSeverity( int aErrorCode );
|
int GetSeverity( int aErrorCode );
|
||||||
void SetSeverity( int aErrorCode, int aSeverity );
|
void SetSeverity( int aErrorCode, int aSeverity );
|
||||||
|
|
||||||
/**
|
|
||||||
* Amount to offset text above/below wires & buses. Expressed as a ratio of the text size.
|
|
||||||
*/
|
|
||||||
double GetTextOffsetRatio();
|
|
||||||
void SetTextOffsetRatio( double aOffsetRatio );
|
|
||||||
|
|
||||||
// Color to draw items flagged invisible, in libedit (they are invisible in Eeschema
|
|
||||||
COLOR4D GetInvisibleItemColor();
|
|
||||||
|
|
||||||
// TODO(JE) Remove this once wxDC printing is gone
|
|
||||||
COLOR4D GetLayerColor( SCH_LAYER_ID aLayer );
|
|
||||||
|
|
||||||
#endif // _GENERAL_H_
|
#endif // _GENERAL_H_
|
||||||
|
|
|
@ -61,7 +61,7 @@ LIB_ARC::LIB_ARC( LIB_PART* aParent ) : LIB_ITEM( LIB_ARC_T, aParent )
|
||||||
|
|
||||||
bool LIB_ARC::HitTest( const wxPoint& aRefPoint, int aAccuracy ) const
|
bool LIB_ARC::HitTest( const wxPoint& aRefPoint, int aAccuracy ) const
|
||||||
{
|
{
|
||||||
int mindist = std::max( aAccuracy + GetPenSize() / 2,
|
int mindist = std::max( aAccuracy + GetPenWidth() / 2,
|
||||||
Mils2iu( MINIMUM_SELECTION_DISTANCE ) );
|
Mils2iu( MINIMUM_SELECTION_DISTANCE ) );
|
||||||
wxPoint relativePosition = aRefPoint;
|
wxPoint relativePosition = aRefPoint;
|
||||||
|
|
||||||
|
@ -168,13 +168,6 @@ void LIB_ARC::Offset( const wxPoint& aOffset )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LIB_ARC::Inside( EDA_RECT& aRect ) const
|
|
||||||
{
|
|
||||||
return aRect.Contains( m_ArcStart.x, -m_ArcStart.y )
|
|
||||||
|| aRect.Contains( m_ArcEnd.x, -m_ArcEnd.y );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LIB_ARC::MoveTo( const wxPoint& aPosition )
|
void LIB_ARC::MoveTo( const wxPoint& aPosition )
|
||||||
{
|
{
|
||||||
wxPoint offset = aPosition - m_Pos;
|
wxPoint offset = aPosition - m_Pos;
|
||||||
|
@ -273,33 +266,35 @@ void LIB_ARC::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
||||||
|
|
||||||
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
||||||
{
|
{
|
||||||
aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_DEVICE_BACKGROUND ) );
|
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
||||||
aPlotter->Arc( pos, -t2, -t1, m_Radius, FILLED_WITH_BG_BODYCOLOR, 0 );
|
aPlotter->Arc( pos, -t2, -t1, m_Radius, FILLED_WITH_BG_BODYCOLOR, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR;
|
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR;
|
||||||
auto pen_size = GetPenSize();
|
auto pen_size = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetDefaultPenWidth() );
|
||||||
|
|
||||||
if( !already_filled || pen_size > 0 )
|
if( !already_filled || pen_size > 0 )
|
||||||
{
|
{
|
||||||
pen_size = std::max( 0, pen_size );
|
pen_size = std::max( 0, pen_size );
|
||||||
aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_DEVICE ) );
|
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
|
||||||
aPlotter->Arc( pos, -t2, -t1, m_Radius, already_filled ? NO_FILL : m_Fill, pen_size );
|
aPlotter->Arc( pos, -t2, -t1, m_Radius, already_filled ? NO_FILL : m_Fill, pen_size );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int LIB_ARC::GetPenSize() const
|
int LIB_ARC::GetPenWidth() const
|
||||||
{
|
{
|
||||||
return m_Width;
|
return std::max( m_Width, 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_ARC::print( wxDC* aDC, const wxPoint& aOffset, void* aData, const TRANSFORM& aTransform )
|
void LIB_ARC::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
|
||||||
|
const TRANSFORM& aTransform )
|
||||||
{
|
{
|
||||||
|
wxDC* DC = aSettings->GetPrintDC();
|
||||||
wxPoint pos1, pos2, posc;
|
wxPoint pos1, pos2, posc;
|
||||||
COLOR4D color = GetLayerColor( LAYER_DEVICE );
|
COLOR4D color = aSettings->GetLayerColor( LAYER_DEVICE );
|
||||||
COLOR4D bgColor = GetLayerColor( LAYER_DEVICE_BACKGROUND );
|
COLOR4D bgColor = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND );
|
||||||
|
|
||||||
pos1 = aTransform.TransformCoordinate( m_ArcEnd ) + aOffset;
|
pos1 = aTransform.TransformCoordinate( m_ArcEnd ) + aOffset;
|
||||||
pos2 = aTransform.TransformCoordinate( m_ArcStart ) + aOffset;
|
pos2 = aTransform.TransformCoordinate( m_ArcStart ) + aOffset;
|
||||||
|
@ -315,15 +310,14 @@ void LIB_ARC::print( wxDC* aDC, const wxPoint& aOffset, void* aData, const TRANS
|
||||||
}
|
}
|
||||||
|
|
||||||
FILL_T fill = aData ? NO_FILL : m_Fill;
|
FILL_T fill = aData ? NO_FILL : m_Fill;
|
||||||
|
int penSize = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
|
||||||
int penSize = GetPenSize();
|
|
||||||
|
|
||||||
if( fill == FILLED_WITH_BG_BODYCOLOR )
|
if( fill == FILLED_WITH_BG_BODYCOLOR )
|
||||||
GRFilledArc( nullptr, aDC, posc.x, posc.y, pt1, pt2, m_Radius, penSize, bgColor, bgColor );
|
GRFilledArc( nullptr, DC, posc.x, posc.y, pt1, pt2, m_Radius, penSize, bgColor, bgColor );
|
||||||
else if( fill == FILLED_SHAPE && !aData )
|
else if( fill == FILLED_SHAPE && !aData )
|
||||||
GRFilledArc( nullptr, aDC, posc.x, posc.y, pt1, pt2, m_Radius, color, color );
|
GRFilledArc( nullptr, DC, posc.x, posc.y, pt1, pt2, m_Radius, color, color );
|
||||||
else
|
else
|
||||||
GRArc1( nullptr, aDC, pos1.x, pos1.y, pos2.x, pos2.y, posc.x, posc.y, penSize, color );
|
GRArc1( nullptr, DC, pos1.x, pos1.y, pos2.x, pos2.y, posc.x, posc.y, penSize, color );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -384,7 +378,7 @@ const EDA_RECT LIB_ARC::GetBoundingBox() const
|
||||||
|
|
||||||
rect.SetOrigin( minX, minY );
|
rect.SetOrigin( minX, minY );
|
||||||
rect.SetEnd( maxX, maxY );
|
rect.SetEnd( maxX, maxY );
|
||||||
rect.Inflate( ( GetPenSize()+1 ) / 2 );
|
rect.Inflate( ( GetPenWidth() / 2 ) + 1 );
|
||||||
|
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ class LIB_ARC : public LIB_ITEM
|
||||||
int m_Width; /* Line width */
|
int m_Width; /* Line width */
|
||||||
int m_editState;
|
int m_editState;
|
||||||
|
|
||||||
void print( wxDC* aDC, const wxPoint& aOffset, void* aData,
|
void print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
|
||||||
const TRANSFORM& aTransform ) override;
|
const TRANSFORM& aTransform ) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -77,7 +77,7 @@ public:
|
||||||
|
|
||||||
void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||||
|
|
||||||
int GetPenSize() const override;
|
int GetPenWidth() const override;
|
||||||
|
|
||||||
void BeginEdit( const wxPoint aStartPoint ) override;
|
void BeginEdit( const wxPoint aStartPoint ) override;
|
||||||
void CalcEdit( const wxPoint& aPosition ) override;
|
void CalcEdit( const wxPoint& aPosition ) override;
|
||||||
|
@ -85,8 +85,6 @@ public:
|
||||||
|
|
||||||
void Offset( const wxPoint& aOffset ) override;
|
void Offset( const wxPoint& aOffset ) override;
|
||||||
|
|
||||||
bool Inside( EDA_RECT& aRect ) const override;
|
|
||||||
|
|
||||||
void MoveTo( const wxPoint& aPosition ) override;
|
void MoveTo( const wxPoint& aPosition ) override;
|
||||||
|
|
||||||
wxPoint GetPosition() const override { return m_Pos; }
|
wxPoint GetPosition() const override { return m_Pos; }
|
||||||
|
|
|
@ -35,7 +35,6 @@
|
||||||
#include <lib_bezier.h>
|
#include <lib_bezier.h>
|
||||||
#include <transform.h>
|
#include <transform.h>
|
||||||
#include <settings/color_settings.h>
|
#include <settings/color_settings.h>
|
||||||
#include <default_values.h> // For some default values
|
|
||||||
|
|
||||||
|
|
||||||
LIB_BEZIER::LIB_BEZIER( LIB_PART* aParent ) :
|
LIB_BEZIER::LIB_BEZIER( LIB_PART* aParent ) :
|
||||||
|
@ -92,18 +91,6 @@ void LIB_BEZIER::Offset( const wxPoint& aOffset )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LIB_BEZIER::Inside( EDA_RECT& aRect ) const
|
|
||||||
{
|
|
||||||
for( size_t i = 0; i < m_PolyPoints.size(); i++ )
|
|
||||||
{
|
|
||||||
if( aRect.Contains( m_PolyPoints[i].x, -m_PolyPoints[i].y ) )
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LIB_BEZIER::MoveTo( const wxPoint& aPosition )
|
void LIB_BEZIER::MoveTo( const wxPoint& aPosition )
|
||||||
{
|
{
|
||||||
if ( !m_PolyPoints.size() )
|
if ( !m_PolyPoints.size() )
|
||||||
|
@ -190,43 +177,35 @@ void LIB_BEZIER::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
||||||
|
|
||||||
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
||||||
{
|
{
|
||||||
aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_DEVICE_BACKGROUND ) );
|
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
||||||
aPlotter->PlotPoly( cornerList, FILLED_WITH_BG_BODYCOLOR, 0 );
|
aPlotter->PlotPoly( cornerList, FILLED_WITH_BG_BODYCOLOR, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR;
|
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR;
|
||||||
auto pen_size = GetPenSize();
|
auto pen_size = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetDefaultPenWidth() );
|
||||||
|
|
||||||
if( !already_filled || pen_size > 0 )
|
if( !already_filled || pen_size > 0 )
|
||||||
{
|
{
|
||||||
pen_size = std::max( 0, pen_size );
|
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
|
||||||
aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_DEVICE ) );
|
|
||||||
aPlotter->PlotPoly( cornerList, already_filled ? NO_FILL : m_Fill, pen_size );
|
aPlotter->PlotPoly( cornerList, already_filled ? NO_FILL : m_Fill, pen_size );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int LIB_BEZIER::GetPenSize() const
|
int LIB_BEZIER::GetPenWidth() const
|
||||||
{
|
{
|
||||||
if( m_Width )
|
return std::max( m_Width, 1 );
|
||||||
return m_Width;
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
// Temporary code not using RENDER_SETTINGS
|
|
||||||
return DEFAULT_LINE_THICKNESS * IU_PER_MILS;
|
|
||||||
#else
|
|
||||||
// JEY TODO: requires RENDER_SETTINGS
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_BEZIER::print( wxDC* aDC, const wxPoint& aOffset, void* aData,
|
void LIB_BEZIER::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
|
||||||
const TRANSFORM& aTransform )
|
const TRANSFORM& aTransform )
|
||||||
{
|
{
|
||||||
std::vector<wxPoint> PolyPointsTraslated;
|
std::vector<wxPoint> PolyPointsTraslated;
|
||||||
|
|
||||||
COLOR4D color = GetLayerColor( LAYER_DEVICE );
|
wxDC* DC = aSettings->GetPrintDC();
|
||||||
COLOR4D bgColor = GetLayerColor( LAYER_DEVICE_BACKGROUND );
|
COLOR4D color = aSettings->GetLayerColor( LAYER_DEVICE );
|
||||||
|
COLOR4D bgColor = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND );
|
||||||
BEZIER_POLY converter( m_BezierPoints );
|
BEZIER_POLY converter( m_BezierPoints );
|
||||||
converter.GetPoly( m_PolyPoints );
|
converter.GetPoly( m_PolyPoints );
|
||||||
|
|
||||||
|
@ -236,20 +215,21 @@ void LIB_BEZIER::print( wxDC* aDC, const wxPoint& aOffset, void* aData,
|
||||||
PolyPointsTraslated.push_back( aTransform.TransformCoordinate( point ) + aOffset );
|
PolyPointsTraslated.push_back( aTransform.TransformCoordinate( point ) + aOffset );
|
||||||
|
|
||||||
FILL_T fill = aData ? NO_FILL : m_Fill;
|
FILL_T fill = aData ? NO_FILL : m_Fill;
|
||||||
|
int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
|
||||||
|
|
||||||
if( fill == FILLED_WITH_BG_BODYCOLOR )
|
if( fill == FILLED_WITH_BG_BODYCOLOR )
|
||||||
{
|
{
|
||||||
GRPoly( nullptr, aDC, m_PolyPoints.size(), &PolyPointsTraslated[0], true, GetPenSize(),
|
GRPoly( nullptr, DC, m_PolyPoints.size(), &PolyPointsTraslated[0], true, penWidth,
|
||||||
bgColor, bgColor );
|
bgColor, bgColor );
|
||||||
}
|
}
|
||||||
else if( fill == FILLED_SHAPE )
|
else if( fill == FILLED_SHAPE )
|
||||||
{
|
{
|
||||||
GRPoly( nullptr, aDC, m_PolyPoints.size(), &PolyPointsTraslated[0], true, GetPenSize(),
|
GRPoly( nullptr, DC, m_PolyPoints.size(), &PolyPointsTraslated[0], true, penWidth,
|
||||||
color, color );
|
color, color );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GRPoly( nullptr, aDC, m_PolyPoints.size(), &PolyPointsTraslated[0], false, GetPenSize(),
|
GRPoly( nullptr, DC, m_PolyPoints.size(), &PolyPointsTraslated[0], false, penWidth,
|
||||||
color, color );
|
color, color );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -257,7 +237,7 @@ void LIB_BEZIER::print( wxDC* aDC, const wxPoint& aOffset, void* aData,
|
||||||
|
|
||||||
bool LIB_BEZIER::HitTest( const wxPoint& aRefPos, int aAccuracy ) const
|
bool LIB_BEZIER::HitTest( const wxPoint& aRefPos, int aAccuracy ) const
|
||||||
{
|
{
|
||||||
int mindist = std::max( aAccuracy + GetPenSize() / 2,
|
int mindist = std::max( aAccuracy + GetPenWidth() / 2,
|
||||||
Mils2iu( MINIMUM_SELECTION_DISTANCE ) );
|
Mils2iu( MINIMUM_SELECTION_DISTANCE ) );
|
||||||
wxPoint start, end;
|
wxPoint start, end;
|
||||||
|
|
||||||
|
@ -334,7 +314,7 @@ const EDA_RECT LIB_BEZIER::GetBoundingBox() const
|
||||||
|
|
||||||
rect.SetOrigin( xmin, ymin );
|
rect.SetOrigin( xmin, ymin );
|
||||||
rect.SetEnd( xmax, ymax );
|
rect.SetEnd( xmax, ymax );
|
||||||
rect.Inflate( ( GetPenSize()+1 ) / 2 );
|
rect.Inflate( ( GetPenWidth() / 2 ) + 1 );
|
||||||
|
|
||||||
rect.RevertYAxis();
|
rect.RevertYAxis();
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,6 @@ class LIB_BEZIER : public LIB_ITEM
|
||||||
std::vector<wxPoint> m_BezierPoints; // list of parameter (3|4)
|
std::vector<wxPoint> m_BezierPoints; // list of parameter (3|4)
|
||||||
std::vector<wxPoint> m_PolyPoints; // list of points (>= 2)
|
std::vector<wxPoint> m_PolyPoints; // list of points (>= 2)
|
||||||
|
|
||||||
void print( wxDC* aDC, const wxPoint& aOffset, void* aData,
|
|
||||||
const TRANSFORM& aTransform ) override;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LIB_BEZIER( LIB_PART * aParent );
|
LIB_BEZIER( LIB_PART * aParent );
|
||||||
|
|
||||||
|
@ -75,8 +72,6 @@ public:
|
||||||
|
|
||||||
const EDA_RECT GetBoundingBox() const override;
|
const EDA_RECT GetBoundingBox() const override;
|
||||||
|
|
||||||
bool Inside( EDA_RECT& aRect ) const override;
|
|
||||||
|
|
||||||
void MoveTo( const wxPoint& aPosition ) override;
|
void MoveTo( const wxPoint& aPosition ) override;
|
||||||
|
|
||||||
wxPoint GetPosition() const override;
|
wxPoint GetPosition() const override;
|
||||||
|
@ -91,14 +86,13 @@ public:
|
||||||
int GetWidth() const override { return m_Width; }
|
int GetWidth() const override { return m_Width; }
|
||||||
void SetWidth( int aWidth ) override { m_Width = aWidth; }
|
void SetWidth( int aWidth ) override { m_Width = aWidth; }
|
||||||
|
|
||||||
int GetPenSize( ) const override;
|
int GetPenWidth() const override;
|
||||||
|
|
||||||
void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||||
|
|
||||||
EDA_ITEM* Clone() const override;
|
EDA_ITEM* Clone() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @copydoc LIB_ITEM::compare()
|
* @copydoc LIB_ITEM::compare()
|
||||||
*
|
*
|
||||||
|
@ -108,6 +102,9 @@ private:
|
||||||
*/
|
*/
|
||||||
int compare( const LIB_ITEM& aOther,
|
int compare( const LIB_ITEM& aOther,
|
||||||
LIB_ITEM::COMPARE_FLAGS aCompareFlags = LIB_ITEM::COMPARE_FLAGS::NORMAL ) const override;
|
LIB_ITEM::COMPARE_FLAGS aCompareFlags = LIB_ITEM::COMPARE_FLAGS::NORMAL ) const override;
|
||||||
|
|
||||||
|
void print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
|
||||||
|
const TRANSFORM& aTransform ) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
#include <lib_circle.h>
|
#include <lib_circle.h>
|
||||||
#include <settings/color_settings.h>
|
#include <settings/color_settings.h>
|
||||||
#include <transform.h>
|
#include <transform.h>
|
||||||
#include <default_values.h> // For some default values
|
|
||||||
|
|
||||||
|
|
||||||
LIB_CIRCLE::LIB_CIRCLE( LIB_PART* aParent ) :
|
LIB_CIRCLE::LIB_CIRCLE( LIB_PART* aParent ) :
|
||||||
|
@ -51,7 +50,7 @@ LIB_CIRCLE::LIB_CIRCLE( LIB_PART* aParent ) :
|
||||||
|
|
||||||
bool LIB_CIRCLE::HitTest( const wxPoint& aPosRef, int aAccuracy ) const
|
bool LIB_CIRCLE::HitTest( const wxPoint& aPosRef, int aAccuracy ) const
|
||||||
{
|
{
|
||||||
int mindist = std::max( aAccuracy + GetPenSize() / 2,
|
int mindist = std::max( aAccuracy + GetPenWidth() / 2,
|
||||||
Mils2iu( MINIMUM_SELECTION_DISTANCE ) );
|
Mils2iu( MINIMUM_SELECTION_DISTANCE ) );
|
||||||
int dist = KiROUND( GetLineLength( aPosRef, DefaultTransform.TransformCoordinate( m_Pos ) ) );
|
int dist = KiROUND( GetLineLength( aPosRef, DefaultTransform.TransformCoordinate( m_Pos ) ) );
|
||||||
|
|
||||||
|
@ -126,13 +125,6 @@ void LIB_CIRCLE::Offset( const wxPoint& aOffset )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LIB_CIRCLE::Inside( EDA_RECT& aRect ) const
|
|
||||||
{
|
|
||||||
wxPoint center(m_Pos.x, -m_Pos.y);
|
|
||||||
return aRect.IntersectsCircle( center, GetRadius() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LIB_CIRCLE::MoveTo( const wxPoint& aPosition )
|
void LIB_CIRCLE::MoveTo( const wxPoint& aPosition )
|
||||||
{
|
{
|
||||||
Offset( aPosition - m_Pos );
|
Offset( aPosition - m_Pos );
|
||||||
|
@ -177,50 +169,44 @@ void LIB_CIRCLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
||||||
|
|
||||||
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
||||||
{
|
{
|
||||||
aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_DEVICE_BACKGROUND ) );
|
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
||||||
aPlotter->Circle( pos, GetRadius() * 2, FILLED_WITH_BG_BODYCOLOR, 0 );
|
aPlotter->Circle( pos, GetRadius() * 2, FILLED_WITH_BG_BODYCOLOR, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR;
|
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR;
|
||||||
auto pen_size = GetPenSize();
|
auto pen_size = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetDefaultPenWidth() );
|
||||||
|
|
||||||
if( !already_filled || pen_size > 0 )
|
if( !already_filled || pen_size > 0 )
|
||||||
{
|
{
|
||||||
pen_size = std::max( 0, pen_size );
|
pen_size = std::max( 0, pen_size );
|
||||||
aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_DEVICE ) );
|
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
|
||||||
aPlotter->Circle( pos, GetRadius() * 2, already_filled ? NO_FILL : m_Fill, pen_size );
|
aPlotter->Circle( pos, GetRadius() * 2, already_filled ? NO_FILL : m_Fill, pen_size );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int LIB_CIRCLE::GetPenSize() const
|
int LIB_CIRCLE::GetPenWidth() const
|
||||||
{
|
{
|
||||||
if( m_Width )
|
return std::max( m_Width, 1 );
|
||||||
return m_Width;
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
// Temporary code not using RENDER_SETTINGS
|
|
||||||
return DEFAULT_LINE_THICKNESS * IU_PER_MILS;
|
|
||||||
#else
|
|
||||||
// JEY TODO: requires RENDER_SETTINGS
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_CIRCLE::print( wxDC* aDC, const wxPoint& aOffset, void* aData,
|
void LIB_CIRCLE::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
|
||||||
const TRANSFORM& aTransform )
|
const TRANSFORM& aTransform )
|
||||||
{
|
{
|
||||||
wxPoint pos1 = aTransform.TransformCoordinate( m_Pos ) + aOffset;
|
wxDC* DC = aSettings->GetPrintDC();
|
||||||
COLOR4D color = GetLayerColor( LAYER_DEVICE );
|
wxPoint pos1 = aTransform.TransformCoordinate( m_Pos ) + aOffset;
|
||||||
COLOR4D bgColor = GetLayerColor( LAYER_DEVICE_BACKGROUND );
|
COLOR4D color = aSettings->GetLayerColor( LAYER_DEVICE );
|
||||||
FILL_T fill = aData ? NO_FILL : m_Fill;
|
COLOR4D bgColor = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND );
|
||||||
|
FILL_T fill = aData ? NO_FILL : m_Fill;
|
||||||
|
int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
|
||||||
|
|
||||||
if( fill == FILLED_WITH_BG_BODYCOLOR )
|
if( fill == FILLED_WITH_BG_BODYCOLOR )
|
||||||
GRFilledCircle( nullptr, aDC, pos1.x, pos1.y, GetRadius(), GetPenSize(), bgColor, bgColor );
|
GRFilledCircle( nullptr, DC, pos1.x, pos1.y, GetRadius(), penWidth, bgColor, bgColor );
|
||||||
else if( fill == FILLED_SHAPE )
|
else if( fill == FILLED_SHAPE )
|
||||||
GRFilledCircle( nullptr, aDC, pos1.x, pos1.y, GetRadius(), 0, color, color );
|
GRFilledCircle( nullptr, DC, pos1.x, pos1.y, GetRadius(), 0, color, color );
|
||||||
else
|
else
|
||||||
GRCircle( nullptr, aDC, pos1.x, pos1.y, GetRadius(), GetPenSize(), color );
|
GRCircle( nullptr, DC, pos1.x, pos1.y, GetRadius(), penWidth, color );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -231,7 +217,7 @@ const EDA_RECT LIB_CIRCLE::GetBoundingBox() const
|
||||||
|
|
||||||
rect.SetOrigin( m_Pos.x - radius, m_Pos.y - radius );
|
rect.SetOrigin( m_Pos.x - radius, m_Pos.y - radius );
|
||||||
rect.SetEnd( m_Pos.x + radius, m_Pos.y + radius );
|
rect.SetEnd( m_Pos.x + radius, m_Pos.y + radius );
|
||||||
rect.Inflate( ( GetPenSize()+1 ) / 2 );
|
rect.Inflate( ( GetPenWidth() / 2 ) + 1 );
|
||||||
|
|
||||||
rect.RevertYAxis();
|
rect.RevertYAxis();
|
||||||
|
|
||||||
|
|
|
@ -35,9 +35,6 @@ class LIB_CIRCLE : public LIB_ITEM
|
||||||
wxPoint m_EndPos; // A point on the circumference of the circle.
|
wxPoint m_EndPos; // A point on the circumference of the circle.
|
||||||
int m_Width; // Line width.
|
int m_Width; // Line width.
|
||||||
|
|
||||||
void print( wxDC* aDC, const wxPoint& aOffset, void* aData,
|
|
||||||
const TRANSFORM& aTransform ) override;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LIB_CIRCLE( LIB_PART * aParent );
|
LIB_CIRCLE( LIB_PART * aParent );
|
||||||
|
|
||||||
|
@ -58,7 +55,7 @@ public:
|
||||||
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
|
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
|
||||||
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
|
||||||
|
|
||||||
int GetPenSize( ) const override;
|
int GetPenWidth() const override;
|
||||||
|
|
||||||
const EDA_RECT GetBoundingBox() const override;
|
const EDA_RECT GetBoundingBox() const override;
|
||||||
|
|
||||||
|
@ -69,8 +66,6 @@ public:
|
||||||
|
|
||||||
void Offset( const wxPoint& aOffset ) override;
|
void Offset( const wxPoint& aOffset ) override;
|
||||||
|
|
||||||
bool Inside( EDA_RECT& aRect ) const override;
|
|
||||||
|
|
||||||
void MoveTo( const wxPoint& aPosition ) override;
|
void MoveTo( const wxPoint& aPosition ) override;
|
||||||
|
|
||||||
wxPoint GetPosition() const override { return m_Pos; }
|
wxPoint GetPosition() const override { return m_Pos; }
|
||||||
|
@ -98,7 +93,6 @@ public:
|
||||||
EDA_ITEM* Clone() const override;
|
EDA_ITEM* Clone() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @copydoc LIB_ITEM::compare()
|
* @copydoc LIB_ITEM::compare()
|
||||||
*
|
*
|
||||||
|
@ -109,6 +103,9 @@ private:
|
||||||
*/
|
*/
|
||||||
int compare( const LIB_ITEM& aOther,
|
int compare( const LIB_ITEM& aOther,
|
||||||
LIB_ITEM::COMPARE_FLAGS aCompareFlags = LIB_ITEM::COMPARE_FLAGS::NORMAL ) const override;
|
LIB_ITEM::COMPARE_FLAGS aCompareFlags = LIB_ITEM::COMPARE_FLAGS::NORMAL ) const override;
|
||||||
|
|
||||||
|
void print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
|
||||||
|
const TRANSFORM& aTransform ) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,12 +34,12 @@
|
||||||
#include <base_units.h>
|
#include <base_units.h>
|
||||||
#include <msgpanel.h>
|
#include <msgpanel.h>
|
||||||
#include <bitmaps.h>
|
#include <bitmaps.h>
|
||||||
|
#include <general.h>
|
||||||
#include <class_libentry.h>
|
#include <class_libentry.h>
|
||||||
#include <transform.h>
|
#include <transform.h>
|
||||||
#include <lib_field.h>
|
#include <lib_field.h>
|
||||||
#include <template_fieldnames.h>
|
#include <template_fieldnames.h>
|
||||||
#include <settings/color_settings.h>
|
#include <settings/color_settings.h>
|
||||||
#include <default_values.h> // For some default values
|
|
||||||
|
|
||||||
|
|
||||||
LIB_FIELD::LIB_FIELD(LIB_PART * aParent, int idfield ) :
|
LIB_FIELD::LIB_FIELD(LIB_PART * aParent, int idfield ) :
|
||||||
|
@ -99,29 +99,23 @@ void LIB_FIELD::Init( int id )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int LIB_FIELD::GetPenSize() const
|
int LIB_FIELD::GetPenWidth() const
|
||||||
{
|
{
|
||||||
#if 1
|
return GetEffectiveTextPenWidth();
|
||||||
// Temporary code not using RENDER_SETTINGS
|
|
||||||
int textThickness = DEFAULT_LINE_THICKNESS * IU_PER_MILS;
|
|
||||||
textThickness = Clamp_Text_PenSize( textThickness, GetTextSize(), IsBold() );
|
|
||||||
return textThickness;
|
|
||||||
#else
|
|
||||||
return GetEffectiveTextPenWidth( nullptr ); // JEY TODO: requires RENDER_SETTINGS
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_FIELD::print( wxDC* aDC, const wxPoint& aOffset, void* aData,
|
void LIB_FIELD::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
|
||||||
const TRANSFORM& aTransform )
|
const TRANSFORM& aTransform )
|
||||||
{
|
{
|
||||||
COLOR4D color = IsVisible() ? GetDefaultColor() : GetInvisibleItemColor();
|
wxDC* DC = aSettings->GetPrintDC();
|
||||||
int linewidth = GetPenSize();
|
COLOR4D color = aSettings->GetLayerColor( IsVisible() ? GetDefaultLayer() : LAYER_HIDDEN );
|
||||||
|
int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
|
||||||
wxPoint text_pos = aTransform.TransformCoordinate( GetTextPos() ) + aOffset;
|
wxPoint text_pos = aTransform.TransformCoordinate( GetTextPos() ) + aOffset;
|
||||||
wxString text = aData ? *static_cast<wxString*>( aData ) : GetText();
|
wxString text = aData ? *static_cast<wxString*>( aData ) : GetText();
|
||||||
|
|
||||||
GRText( aDC, text_pos, color, text, GetTextAngle(), GetTextSize(), GetHorizJustify(),
|
GRText( DC, text_pos, color, text, GetTextAngle(), GetTextSize(), GetHorizJustify(),
|
||||||
GetVertJustify(), linewidth, IsItalic(), IsBold() );
|
GetVertJustify(), penWidth, IsItalic(), IsBold(), m_textMarkupFlags );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -220,12 +214,6 @@ void LIB_FIELD::Offset( const wxPoint& aOffset )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LIB_FIELD::Inside( EDA_RECT& rect ) const
|
|
||||||
{
|
|
||||||
return rect.Intersects( GetBoundingBox() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LIB_FIELD::MoveTo( const wxPoint& newPosition )
|
void LIB_FIELD::MoveTo( const wxPoint& newPosition )
|
||||||
{
|
{
|
||||||
EDA_TEXT::SetTextPos( newPosition );
|
EDA_TEXT::SetTextPos( newPosition );
|
||||||
|
@ -295,12 +283,16 @@ void LIB_FIELD::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
||||||
COLOR4D color;
|
COLOR4D color;
|
||||||
|
|
||||||
if( aPlotter->GetColorMode() )
|
if( aPlotter->GetColorMode() )
|
||||||
color = aPlotter->ColorSettings()->GetColor( GetDefaultLayer() );
|
color = aPlotter->RenderSettings()->GetLayerColor( GetDefaultLayer() );
|
||||||
else
|
else
|
||||||
color = COLOR4D::BLACK;
|
color = COLOR4D::BLACK;
|
||||||
|
|
||||||
aPlotter->Text( textpos, color, GetShownText(), orient, GetTextSize(),
|
int penWidth = std::max( GetPenWidth(),aPlotter->RenderSettings()->GetDefaultPenWidth() );
|
||||||
hjustify, vjustify, GetPenSize(), IsItalic(), IsBold() );
|
|
||||||
|
// NOTE: do NOT use m_textMarkupFlags; those are from the library, not the schematic
|
||||||
|
|
||||||
|
aPlotter->Text( textpos, color, GetShownText(), orient, GetTextSize(), hjustify, vjustify,
|
||||||
|
penWidth, IsItalic(), IsBold(), aPlotter->GetTextMarkupFlags() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -324,7 +316,7 @@ const EDA_RECT LIB_FIELD::GetBoundingBox() const
|
||||||
/* Y coordinates for LIB_ITEMS are bottom to top, so we must invert the Y position when
|
/* Y coordinates for LIB_ITEMS are bottom to top, so we must invert the Y position when
|
||||||
* calling GetTextBox() that works using top to bottom Y axis orientation.
|
* calling GetTextBox() that works using top to bottom Y axis orientation.
|
||||||
*/
|
*/
|
||||||
EDA_RECT rect = GetTextBox( nullptr, -1, true ); // JEY TODO: requires RENDER_SETTINGS
|
EDA_RECT rect = GetTextBox( -1, true );
|
||||||
rect.RevertYAxis();
|
rect.RevertYAxis();
|
||||||
|
|
||||||
// We are using now a bottom to top Y axis.
|
// We are using now a bottom to top Y axis.
|
||||||
|
@ -370,12 +362,6 @@ SCH_LAYER_ID LIB_FIELD::GetDefaultLayer()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
COLOR4D LIB_FIELD::GetDefaultColor()
|
|
||||||
{
|
|
||||||
return GetLayerColor( GetDefaultLayer() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wxString LIB_FIELD::GetName( bool aUseDefaultName ) const
|
wxString LIB_FIELD::GetName( bool aUseDefaultName ) const
|
||||||
{
|
{
|
||||||
if( m_name.IsEmpty() && aUseDefaultName )
|
if( m_name.IsEmpty() && aUseDefaultName )
|
||||||
|
|
|
@ -68,7 +68,7 @@ class LIB_FIELD : public LIB_ITEM, public EDA_TEXT
|
||||||
* the m_Text
|
* the m_Text
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
void print( wxDC* aDC, const wxPoint& aOffset, void* aData,
|
void print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
|
||||||
const TRANSFORM& aTransform ) override;
|
const TRANSFORM& aTransform ) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -138,7 +138,7 @@ public:
|
||||||
int GetId() const { return m_id; }
|
int GetId() const { return m_id; }
|
||||||
void SetId( int aId ) { m_id = aId; }
|
void SetId( int aId ) { m_id = aId; }
|
||||||
|
|
||||||
int GetPenSize( ) const override;
|
int GetPenWidth() const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy parameters of this field to another field. Pointers are not copied.
|
* Copy parameters of this field to another field. Pointers are not copied.
|
||||||
|
@ -169,16 +169,12 @@ public:
|
||||||
*/
|
*/
|
||||||
wxString GetFullText( int unit = 1 ) const;
|
wxString GetFullText( int unit = 1 ) const;
|
||||||
|
|
||||||
COLOR4D GetDefaultColor() override;
|
|
||||||
|
|
||||||
SCH_LAYER_ID GetDefaultLayer();
|
SCH_LAYER_ID GetDefaultLayer();
|
||||||
|
|
||||||
void BeginEdit( const wxPoint aStartPoint ) override;
|
void BeginEdit( const wxPoint aStartPoint ) override;
|
||||||
|
|
||||||
void Offset( const wxPoint& aOffset ) override;
|
void Offset( const wxPoint& aOffset ) override;
|
||||||
|
|
||||||
bool Inside( EDA_RECT& aRect ) const override;
|
|
||||||
|
|
||||||
void MoveTo( const wxPoint& aPosition ) override;
|
void MoveTo( const wxPoint& aPosition ) override;
|
||||||
|
|
||||||
wxPoint GetPosition() const override { return EDA_TEXT::GetTextPos(); }
|
wxPoint GetPosition() const override { return EDA_TEXT::GetTextPos(); }
|
||||||
|
@ -190,8 +186,8 @@ public:
|
||||||
void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
||||||
const TRANSFORM& aTransform ) override;
|
const TRANSFORM& aTransform ) override;
|
||||||
|
|
||||||
int GetWidth() const override { return GetTextPenWidth(); }
|
int GetWidth() const override { return GetTextThickness(); }
|
||||||
void SetWidth( int aWidth ) override { SetTextPenWidth( aWidth ); }
|
void SetWidth( int aWidth ) override { SetTextThickness( aWidth ); }
|
||||||
|
|
||||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||||
|
|
||||||
|
|
|
@ -133,9 +133,10 @@ bool LIB_ITEM::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_ITEM::Print( wxDC* aDC, const wxPoint& aOffset, void* aData, const TRANSFORM& aTransform )
|
void LIB_ITEM::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
|
||||||
|
const TRANSFORM& aTransform )
|
||||||
{
|
{
|
||||||
print( aDC, aOffset, aData, aTransform );
|
print( aSettings, aOffset, aData, aTransform );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -149,7 +150,3 @@ void LIB_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
COLOR4D LIB_ITEM::GetDefaultColor()
|
|
||||||
{
|
|
||||||
return GetLayerColor( LAYER_DEVICE );
|
|
||||||
}
|
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include <eda_rect.h>
|
#include <eda_rect.h>
|
||||||
#include <transform.h>
|
#include <transform.h>
|
||||||
#include <gr_basic.h>
|
#include <gr_basic.h>
|
||||||
|
#include <render_settings.h>
|
||||||
|
|
||||||
class LINE_READER;
|
class LINE_READER;
|
||||||
class OUTPUTFORMATTER;
|
class OUTPUTFORMATTER;
|
||||||
|
@ -39,6 +39,7 @@ class PLOTTER;
|
||||||
class LIB_PIN;
|
class LIB_PIN;
|
||||||
class MSG_PANEL_ITEM;
|
class MSG_PANEL_ITEM;
|
||||||
|
|
||||||
|
using KIGFX::RENDER_SETTINGS;
|
||||||
|
|
||||||
extern const int fill_tab[];
|
extern const int fill_tab[];
|
||||||
|
|
||||||
|
@ -62,13 +63,12 @@ class LIB_ITEM : public EDA_ITEM
|
||||||
/**
|
/**
|
||||||
* Print the item to \a aDC.
|
* Print the item to \a aDC.
|
||||||
*
|
*
|
||||||
* @param aDC A pointer to the device context used to draw the object.
|
|
||||||
* @param aOffset A reference to a wxPoint object containing the offset where to draw
|
* @param aOffset A reference to a wxPoint object containing the offset where to draw
|
||||||
* from the object's current position.
|
* from the object's current position.
|
||||||
* @param aData A pointer to any object specific data required to perform the draw.
|
* @param aData A pointer to any object specific data required to perform the draw.
|
||||||
* @param aTransform A reference to a #TRANSFORM object containing drawing transform.
|
* @param aTransform A reference to a #TRANSFORM object containing drawing transform.
|
||||||
*/
|
*/
|
||||||
virtual void print( wxDC* aDC, const wxPoint& aOffset, void* aData,
|
virtual void print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
|
||||||
const TRANSFORM& aTransform ) = 0;
|
const TRANSFORM& aTransform ) = 0;
|
||||||
|
|
||||||
friend class LIB_PART;
|
friend class LIB_PART;
|
||||||
|
@ -174,13 +174,10 @@ public:
|
||||||
* pass reference to the lib component for pins.
|
* pass reference to the lib component for pins.
|
||||||
* @param aTransform Transform Matrix (rotation, mirror ..)
|
* @param aTransform Transform Matrix (rotation, mirror ..)
|
||||||
*/
|
*/
|
||||||
virtual void Print( wxDC* aDC, const wxPoint &aOffset, void* aData,
|
virtual void Print( RENDER_SETTINGS* aSettings, const wxPoint &aOffset, void* aData,
|
||||||
const TRANSFORM& aTransform );
|
const TRANSFORM& aTransform );
|
||||||
|
|
||||||
/**
|
virtual int GetPenWidth() const = 0;
|
||||||
* @return the size of the "pen" that be used to draw or plot this item
|
|
||||||
*/
|
|
||||||
virtual int GetPenSize() const = 0;
|
|
||||||
|
|
||||||
LIB_PART* GetParent() const
|
LIB_PART* GetParent() const
|
||||||
{
|
{
|
||||||
|
@ -241,14 +238,6 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void Offset( const wxPoint& aOffset ) = 0;
|
virtual void Offset( const wxPoint& aOffset ) = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* Test if any part of the draw object is inside rectangle bounds of \a aRect.
|
|
||||||
*
|
|
||||||
* @param aRect Rectangle to check against.
|
|
||||||
* @return True if object is inside rectangle.
|
|
||||||
*/
|
|
||||||
virtual bool Inside( EDA_RECT& aRect ) const = 0;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Move a draw object to \a aPosition.
|
* Move a draw object to \a aPosition.
|
||||||
*
|
*
|
||||||
|
@ -303,8 +292,6 @@ public:
|
||||||
*/
|
*/
|
||||||
bool IsFillable() const { return m_isFillable; }
|
bool IsFillable() const { return m_isFillable; }
|
||||||
|
|
||||||
virtual COLOR4D GetDefaultColor();
|
|
||||||
|
|
||||||
void SetUnit( int aUnit ) { m_Unit = aUnit; }
|
void SetUnit( int aUnit ) { m_Unit = aUnit; }
|
||||||
int GetUnit() const { return m_Unit; }
|
int GetUnit() const { return m_Unit; }
|
||||||
|
|
||||||
|
|
|
@ -551,21 +551,14 @@ bool LIB_PIN::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int LIB_PIN::GetPenSize() const
|
int LIB_PIN::GetPenWidth() const
|
||||||
{
|
{
|
||||||
if( m_width )
|
return std::max( m_width, 1 );
|
||||||
return m_width;
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
// Temporary code not using RENDER_SETTINGS
|
|
||||||
return DEFAULT_LINE_THICKNESS * IU_PER_MILS;
|
|
||||||
#else
|
|
||||||
// JEY TODO: requires RENDER_SETTINGS
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PIN::print( wxDC* aDC, const wxPoint& aOffset, void* aData, const TRANSFORM& aTransform )
|
void LIB_PIN::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
|
||||||
|
const TRANSFORM& aTransform )
|
||||||
{
|
{
|
||||||
PART_DRAW_OPTIONS* opts = (PART_DRAW_OPTIONS*) aData;
|
PART_DRAW_OPTIONS* opts = (PART_DRAW_OPTIONS*) aData;
|
||||||
LIB_PART* part = GetParent();
|
LIB_PART* part = GetParent();
|
||||||
|
@ -578,23 +571,24 @@ void LIB_PIN::print( wxDC* aDC, const wxPoint& aOffset, void* aData, const TRANS
|
||||||
|
|
||||||
if( IsVisible() || ( opts && opts->draw_hidden_fields ) )
|
if( IsVisible() || ( opts && opts->draw_hidden_fields ) )
|
||||||
{
|
{
|
||||||
PrintPinSymbol( aDC, pos1, orient );
|
PrintPinSymbol( aSettings, pos1, orient );
|
||||||
|
|
||||||
PrintPinTexts( aDC, pos1, orient, part->GetPinNameOffset(), part->ShowPinNumbers(),
|
PrintPinTexts( aSettings, pos1, orient, part->GetPinNameOffset(), part->ShowPinNumbers(),
|
||||||
part->ShowPinNames() );
|
part->ShowPinNames(), opts->text_markup_flags );
|
||||||
|
|
||||||
if( opts && opts->show_elec_type )
|
if( opts && opts->show_elec_type )
|
||||||
PrintPinElectricalTypeName( aDC, pos1, orient );
|
PrintPinElectricalTypeName( aSettings, pos1, orient );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PIN::PrintPinSymbol( wxDC* aDC, const wxPoint& aPos, int aOrient )
|
void LIB_PIN::PrintPinSymbol( RENDER_SETTINGS* aSettings, const wxPoint& aPos, int aOrient )
|
||||||
{
|
{
|
||||||
|
wxDC* DC = aSettings->GetPrintDC();
|
||||||
int MapX1, MapY1, x1, y1;
|
int MapX1, MapY1, x1, y1;
|
||||||
int width = GetPenSize();
|
int width = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
|
||||||
int posX = aPos.x, posY = aPos.y, len = m_length;
|
int posX = aPos.x, posY = aPos.y, len = m_length;
|
||||||
COLOR4D color = IsVisible() ? GetLayerColor( LAYER_PIN ) : GetInvisibleItemColor();
|
COLOR4D color = aSettings->GetLayerColor( IsVisible() ? LAYER_PIN : LAYER_HIDDEN );
|
||||||
|
|
||||||
MapX1 = MapY1 = 0;
|
MapX1 = MapY1 = 0;
|
||||||
x1 = posX;
|
x1 = posX;
|
||||||
|
@ -611,15 +605,15 @@ void LIB_PIN::PrintPinSymbol( wxDC* aDC, const wxPoint& aPos, int aOrient )
|
||||||
if( m_shape == GRAPHIC_PINSHAPE::INVERTED || m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK )
|
if( m_shape == GRAPHIC_PINSHAPE::INVERTED || m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK )
|
||||||
{
|
{
|
||||||
const int radius = ExternalPinDecoSize( *this );
|
const int radius = ExternalPinDecoSize( *this );
|
||||||
GRCircle( nullptr, aDC, MapX1 * radius + x1, MapY1 * radius + y1, radius, width, color );
|
GRCircle( nullptr, DC, MapX1 * radius + x1, MapY1 * radius + y1, radius, width, color );
|
||||||
|
|
||||||
GRMoveTo( MapX1 * radius * 2 + x1, MapY1 * radius * 2 + y1 );
|
GRMoveTo( MapX1 * radius * 2 + x1, MapY1 * radius * 2 + y1 );
|
||||||
GRLineTo( nullptr, aDC, posX, posY, width, color );
|
GRLineTo( nullptr, DC, posX, posY, width, color );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GRMoveTo( x1, y1 );
|
GRMoveTo( x1, y1 );
|
||||||
GRLineTo( nullptr, aDC, posX, posY, width, color );
|
GRLineTo( nullptr, DC, posX, posY, width, color );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the clock shape (>)inside the symbol
|
// Draw the clock shape (>)inside the symbol
|
||||||
|
@ -631,14 +625,14 @@ void LIB_PIN::PrintPinSymbol( wxDC* aDC, const wxPoint& aPos, int aOrient )
|
||||||
if( MapY1 == 0 ) /* MapX1 = +- 1 */
|
if( MapY1 == 0 ) /* MapX1 = +- 1 */
|
||||||
{
|
{
|
||||||
GRMoveTo( x1, y1 + clock_size );
|
GRMoveTo( x1, y1 + clock_size );
|
||||||
GRLineTo( nullptr, aDC, x1 - MapX1 * clock_size * 2, y1, width, color );
|
GRLineTo( nullptr, DC, x1 - MapX1 * clock_size * 2, y1, width, color );
|
||||||
GRLineTo( nullptr, aDC, x1, y1 - clock_size, width, color );
|
GRLineTo( nullptr, DC, x1, y1 - clock_size, width, color );
|
||||||
}
|
}
|
||||||
else /* MapX1 = 0 */
|
else /* MapX1 = 0 */
|
||||||
{
|
{
|
||||||
GRMoveTo( x1 + clock_size, y1 );
|
GRMoveTo( x1 + clock_size, y1 );
|
||||||
GRLineTo( nullptr, aDC, x1, y1 - MapY1 * clock_size * 2, width, color );
|
GRLineTo( nullptr, DC, x1, y1 - MapY1 * clock_size * 2, width, color );
|
||||||
GRLineTo( nullptr, aDC, x1 - clock_size, y1, width, color );
|
GRLineTo( nullptr, DC, x1 - clock_size, y1, width, color );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -650,14 +644,14 @@ void LIB_PIN::PrintPinSymbol( wxDC* aDC, const wxPoint& aPos, int aOrient )
|
||||||
if( MapY1 == 0 ) /* MapX1 = +- 1 */
|
if( MapY1 == 0 ) /* MapX1 = +- 1 */
|
||||||
{
|
{
|
||||||
GRMoveTo( x1 + MapX1 * deco_size * 2, y1 );
|
GRMoveTo( x1 + MapX1 * deco_size * 2, y1 );
|
||||||
GRLineTo( nullptr, aDC, x1 + MapX1 * deco_size * 2, y1 - deco_size * 2, width, color );
|
GRLineTo( nullptr, DC, x1 + MapX1 * deco_size * 2, y1 - deco_size * 2, width, color );
|
||||||
GRLineTo( nullptr, aDC, x1, y1, width, color );
|
GRLineTo( nullptr, DC, x1, y1, width, color );
|
||||||
}
|
}
|
||||||
else /* MapX1 = 0 */
|
else /* MapX1 = 0 */
|
||||||
{
|
{
|
||||||
GRMoveTo( x1, y1 + MapY1 * deco_size * 2 );
|
GRMoveTo( x1, y1 + MapY1 * deco_size * 2 );
|
||||||
GRLineTo( nullptr, aDC, x1 - deco_size * 2, y1 + MapY1 * deco_size * 2, width, color );
|
GRLineTo( nullptr, DC, x1 - deco_size * 2, y1 + MapY1 * deco_size * 2, width, color );
|
||||||
GRLineTo( nullptr, aDC, x1, y1, width, color );
|
GRLineTo( nullptr, DC, x1, y1, width, color );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -667,52 +661,58 @@ void LIB_PIN::PrintPinSymbol( wxDC* aDC, const wxPoint& aPos, int aOrient )
|
||||||
if( MapY1 == 0 ) /* MapX1 = +- 1 */
|
if( MapY1 == 0 ) /* MapX1 = +- 1 */
|
||||||
{
|
{
|
||||||
GRMoveTo( x1, y1 - deco_size * 2 );
|
GRMoveTo( x1, y1 - deco_size * 2 );
|
||||||
GRLineTo( nullptr, aDC, x1 + MapX1 * deco_size * 2, y1, width, color );
|
GRLineTo( nullptr, DC, x1 + MapX1 * deco_size * 2, y1, width, color );
|
||||||
}
|
}
|
||||||
else /* MapX1 = 0 */
|
else /* MapX1 = 0 */
|
||||||
{
|
{
|
||||||
GRMoveTo( x1 - deco_size * 2, y1 );
|
GRMoveTo( x1 - deco_size * 2, y1 );
|
||||||
GRLineTo( nullptr, aDC, x1, y1 + MapY1 * deco_size * 2, width, color );
|
GRLineTo( nullptr, DC, x1, y1 + MapY1 * deco_size * 2, width, color );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( m_shape == GRAPHIC_PINSHAPE::NONLOGIC ) /* NonLogic pin symbol */
|
else if( m_shape == GRAPHIC_PINSHAPE::NONLOGIC ) /* NonLogic pin symbol */
|
||||||
{
|
{
|
||||||
const int deco_size = ExternalPinDecoSize( *this );
|
const int deco_size = ExternalPinDecoSize( *this );
|
||||||
GRMoveTo( x1 - (MapX1 + MapY1) * deco_size, y1 - (MapY1 - MapX1) * deco_size );
|
GRMoveTo( x1 - (MapX1 + MapY1) * deco_size, y1 - (MapY1 - MapX1) * deco_size );
|
||||||
GRLineTo( nullptr, aDC, x1 + (MapX1 + MapY1) * deco_size, y1 + (MapY1 - MapX1) * deco_size, width,
|
GRLineTo( nullptr, DC, x1 + (MapX1 + MapY1) * deco_size,
|
||||||
color );
|
y1 + ( MapY1 - MapX1 ) * deco_size, width, color );
|
||||||
GRMoveTo( x1 - (MapX1 - MapY1) * deco_size, y1 - (MapY1 + MapX1) * deco_size );
|
GRMoveTo( x1 - (MapX1 - MapY1) * deco_size, y1 - (MapY1 + MapX1) * deco_size );
|
||||||
GRLineTo( nullptr, aDC, x1 + (MapX1 - MapY1) * deco_size, y1 + (MapY1 + MapX1) * deco_size, width,
|
GRLineTo( nullptr, DC, x1 + (MapX1 - MapY1) * deco_size,
|
||||||
color );
|
y1 + ( MapY1 + MapX1 ) * deco_size, width, color );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_type == ELECTRICAL_PINTYPE::PT_NC ) // Draw a N.C. symbol
|
if( m_type == ELECTRICAL_PINTYPE::PT_NC ) // Draw a N.C. symbol
|
||||||
{
|
{
|
||||||
const int deco_size = TARGET_PIN_RADIUS;
|
const int deco_size = TARGET_PIN_RADIUS;
|
||||||
GRLine( nullptr, aDC, posX - deco_size, posY - deco_size, posX + deco_size, posY + deco_size, width, color );
|
GRLine( nullptr, DC, posX - deco_size, posY - deco_size, posX + deco_size,
|
||||||
GRLine( nullptr, aDC, posX + deco_size, posY - deco_size, posX - deco_size, posY + deco_size, width, color );
|
posY + deco_size, width, color );
|
||||||
|
GRLine( nullptr, DC, posX + deco_size, posY - deco_size, posX - deco_size,
|
||||||
|
posY + deco_size, width, color );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PIN::PrintPinTexts( wxDC* DC, wxPoint& pin_pos, int orient, int TextInside,
|
void LIB_PIN::PrintPinTexts( RENDER_SETTINGS* aSettings, wxPoint& pin_pos, int orient,
|
||||||
bool DrawPinNum, bool DrawPinName )
|
int TextInside, bool DrawPinNum, bool DrawPinName, int aMarkupFlags )
|
||||||
{
|
{
|
||||||
if( !DrawPinName && !DrawPinNum )
|
if( !DrawPinName && !DrawPinNum )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int x, y;
|
int x, y;
|
||||||
|
wxDC* DC = aSettings->GetPrintDC();
|
||||||
wxSize PinNameSize( m_nameTextSize, m_nameTextSize );
|
wxSize PinNameSize( m_nameTextSize, m_nameTextSize );
|
||||||
wxSize PinNumSize( m_numTextSize, m_numTextSize );
|
wxSize PinNumSize( m_numTextSize, m_numTextSize );
|
||||||
int nameLineWidth = Clamp_Text_PenSize( GetPenSize(), m_nameTextSize, false );
|
|
||||||
int numLineWidth = Clamp_Text_PenSize( GetPenSize(), m_numTextSize, false );
|
int namePenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_nameTextSize, false ),
|
||||||
int name_offset = Mils2iu( PIN_TEXT_MARGIN ) + nameLineWidth;
|
aSettings->GetDefaultPenWidth() );
|
||||||
int num_offset = Mils2iu( PIN_TEXT_MARGIN ) + numLineWidth;
|
int numPenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_numTextSize, false ),
|
||||||
|
aSettings->GetDefaultPenWidth() );
|
||||||
|
|
||||||
|
int name_offset = Mils2iu( PIN_TEXT_MARGIN ) + namePenWidth;
|
||||||
|
int num_offset = Mils2iu( PIN_TEXT_MARGIN ) + numPenWidth;
|
||||||
|
|
||||||
/* Get the num and name colors */
|
/* Get the num and name colors */
|
||||||
COLOR4D NameColor = IsVisible() ? GetLayerColor( LAYER_PINNAM ) : GetInvisibleItemColor();
|
COLOR4D NameColor = aSettings->GetLayerColor( IsVisible() ? LAYER_PINNAM : LAYER_HIDDEN );
|
||||||
COLOR4D NumColor = IsVisible() ? GetLayerColor( LAYER_PINNUM ) : GetInvisibleItemColor();
|
COLOR4D NumColor = aSettings->GetLayerColor( IsVisible() ? LAYER_PINNUM : LAYER_HIDDEN );
|
||||||
|
|
||||||
int x1 = pin_pos.x;
|
int x1 = pin_pos.x;
|
||||||
int y1 = pin_pos.y;
|
int y1 = pin_pos.y;
|
||||||
|
@ -740,14 +740,14 @@ void LIB_PIN::PrintPinTexts( wxDC* DC, wxPoint& pin_pos, int orient, int TextIns
|
||||||
x = x1 + TextInside;
|
x = x1 + TextInside;
|
||||||
GRText( DC, wxPoint( x, y1 ), NameColor, m_name, TEXT_ANGLE_HORIZ,
|
GRText( DC, wxPoint( x, y1 ), NameColor, m_name, TEXT_ANGLE_HORIZ,
|
||||||
PinNameSize, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
|
PinNameSize, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
|
||||||
nameLineWidth, false, false );
|
namePenWidth, false, false, aMarkupFlags );
|
||||||
}
|
}
|
||||||
else // Orient == PIN_LEFT
|
else // Orient == PIN_LEFT
|
||||||
{
|
{
|
||||||
x = x1 - TextInside;
|
x = x1 - TextInside;
|
||||||
GRText( DC, wxPoint( x, y1 ), NameColor, m_name, TEXT_ANGLE_HORIZ,
|
GRText( DC, wxPoint( x, y1 ), NameColor, m_name, TEXT_ANGLE_HORIZ,
|
||||||
PinNameSize, GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER,
|
PinNameSize, GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER,
|
||||||
nameLineWidth, false, false );
|
namePenWidth, false, false, aMarkupFlags );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -755,7 +755,7 @@ void LIB_PIN::PrintPinTexts( wxDC* DC, wxPoint& pin_pos, int orient, int TextIns
|
||||||
{
|
{
|
||||||
GRText( DC, wxPoint( (x1 + pin_pos.x) / 2, y1 - num_offset ), NumColor, m_number,
|
GRText( DC, wxPoint( (x1 + pin_pos.x) / 2, y1 - num_offset ), NumColor, m_number,
|
||||||
TEXT_ANGLE_HORIZ, PinNumSize, GR_TEXT_HJUSTIFY_CENTER,
|
TEXT_ANGLE_HORIZ, PinNumSize, GR_TEXT_HJUSTIFY_CENTER,
|
||||||
GR_TEXT_VJUSTIFY_BOTTOM, numLineWidth, false, false );
|
GR_TEXT_VJUSTIFY_BOTTOM, numPenWidth, false, false, aMarkupFlags );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /* Its a vertical line. */
|
else /* Its a vertical line. */
|
||||||
|
@ -767,13 +767,13 @@ void LIB_PIN::PrintPinTexts( wxDC* DC, wxPoint& pin_pos, int orient, int TextIns
|
||||||
|
|
||||||
if( DrawPinName )
|
if( DrawPinName )
|
||||||
GRText( DC, wxPoint( x1, y ), NameColor, m_name, TEXT_ANGLE_VERT, PinNameSize,
|
GRText( DC, wxPoint( x1, y ), NameColor, m_name, TEXT_ANGLE_VERT, PinNameSize,
|
||||||
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, nameLineWidth, false,
|
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, namePenWidth, false,
|
||||||
false );
|
false, aMarkupFlags );
|
||||||
|
|
||||||
if( DrawPinNum )
|
if( DrawPinNum )
|
||||||
GRText( DC, wxPoint( x1 - num_offset, (y1 + pin_pos.y) / 2 ), NumColor,
|
GRText( DC, wxPoint( x1 - num_offset, (y1 + pin_pos.y) / 2 ), NumColor,
|
||||||
m_number, TEXT_ANGLE_VERT, PinNumSize, GR_TEXT_HJUSTIFY_CENTER,
|
m_number, TEXT_ANGLE_VERT, PinNumSize, GR_TEXT_HJUSTIFY_CENTER,
|
||||||
GR_TEXT_VJUSTIFY_BOTTOM, numLineWidth, false, false );
|
GR_TEXT_VJUSTIFY_BOTTOM, numPenWidth, false, false, aMarkupFlags );
|
||||||
}
|
}
|
||||||
else /* PIN_UP */
|
else /* PIN_UP */
|
||||||
{
|
{
|
||||||
|
@ -781,13 +781,13 @@ void LIB_PIN::PrintPinTexts( wxDC* DC, wxPoint& pin_pos, int orient, int TextIns
|
||||||
|
|
||||||
if( DrawPinName )
|
if( DrawPinName )
|
||||||
GRText( DC, wxPoint( x1, y ), NameColor, m_name, TEXT_ANGLE_VERT, PinNameSize,
|
GRText( DC, wxPoint( x1, y ), NameColor, m_name, TEXT_ANGLE_VERT, PinNameSize,
|
||||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, nameLineWidth, false,
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, namePenWidth, false,
|
||||||
false );
|
false, aMarkupFlags );
|
||||||
|
|
||||||
if( DrawPinNum )
|
if( DrawPinNum )
|
||||||
GRText( DC, wxPoint( x1 - num_offset, (y1 + pin_pos.y) / 2 ), NumColor,
|
GRText( DC, wxPoint( x1 - num_offset, (y1 + pin_pos.y) / 2 ), NumColor,
|
||||||
m_number, TEXT_ANGLE_VERT, PinNumSize, GR_TEXT_HJUSTIFY_CENTER,
|
m_number, TEXT_ANGLE_VERT, PinNumSize, GR_TEXT_HJUSTIFY_CENTER,
|
||||||
GR_TEXT_VJUSTIFY_BOTTOM, numLineWidth, false, false );
|
GR_TEXT_VJUSTIFY_BOTTOM, numPenWidth, false, false, aMarkupFlags );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -801,14 +801,14 @@ void LIB_PIN::PrintPinTexts( wxDC* DC, wxPoint& pin_pos, int orient, int TextIns
|
||||||
x = (x1 + pin_pos.x) / 2;
|
x = (x1 + pin_pos.x) / 2;
|
||||||
GRText( DC, wxPoint( x, y1 - name_offset ), NameColor, m_name, TEXT_ANGLE_HORIZ,
|
GRText( DC, wxPoint( x, y1 - name_offset ), NameColor, m_name, TEXT_ANGLE_HORIZ,
|
||||||
PinNameSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
|
PinNameSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
|
||||||
nameLineWidth, false, false );
|
namePenWidth, false, false, aMarkupFlags );
|
||||||
}
|
}
|
||||||
if( DrawPinNum )
|
if( DrawPinNum )
|
||||||
{
|
{
|
||||||
x = (x1 + pin_pos.x) / 2;
|
x = (x1 + pin_pos.x) / 2;
|
||||||
GRText( DC, wxPoint( x, y1 + num_offset ), NumColor, m_number, TEXT_ANGLE_HORIZ,
|
GRText( DC, wxPoint( x, y1 + num_offset ), NumColor, m_number, TEXT_ANGLE_HORIZ,
|
||||||
PinNumSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, numLineWidth,
|
PinNumSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, numPenWidth,
|
||||||
false, false );
|
false, false, aMarkupFlags );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /* Its a vertical line. */
|
else /* Its a vertical line. */
|
||||||
|
@ -818,14 +818,14 @@ void LIB_PIN::PrintPinTexts( wxDC* DC, wxPoint& pin_pos, int orient, int TextIns
|
||||||
y = (y1 + pin_pos.y) / 2;
|
y = (y1 + pin_pos.y) / 2;
|
||||||
GRText( DC, wxPoint( x1 - name_offset, y ), NameColor, m_name, TEXT_ANGLE_VERT,
|
GRText( DC, wxPoint( x1 - name_offset, y ), NameColor, m_name, TEXT_ANGLE_VERT,
|
||||||
PinNameSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
|
PinNameSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
|
||||||
nameLineWidth, false, false );
|
namePenWidth, false, false, aMarkupFlags );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( DrawPinNum )
|
if( DrawPinNum )
|
||||||
{
|
{
|
||||||
GRText( DC, wxPoint( x1 + num_offset, (y1 + pin_pos.y) / 2 ), NumColor, m_number,
|
GRText( DC, wxPoint( x1 + num_offset, (y1 + pin_pos.y) / 2 ), NumColor, m_number,
|
||||||
TEXT_ANGLE_VERT, PinNumSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP,
|
TEXT_ANGLE_VERT, PinNumSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP,
|
||||||
numLineWidth, false, false );
|
numPenWidth, false, false, aMarkupFlags );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -833,14 +833,16 @@ void LIB_PIN::PrintPinTexts( wxDC* DC, wxPoint& pin_pos, int orient, int TextIns
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void LIB_PIN::PrintPinElectricalTypeName( wxDC* aDC, wxPoint& aPosition, int aOrientation )
|
void LIB_PIN::PrintPinElectricalTypeName( RENDER_SETTINGS* aSettings, wxPoint& aPosition,
|
||||||
|
int aOrientation )
|
||||||
{
|
{
|
||||||
|
wxDC* DC = aSettings->GetPrintDC();
|
||||||
wxString typeName = GetElectricalTypeName();
|
wxString typeName = GetElectricalTypeName();
|
||||||
|
|
||||||
// Use a reasonable (small) size to draw the text
|
// Use a reasonable (small) size to draw the text
|
||||||
int textSize = (m_nameTextSize*3)/4;
|
int textSize = ( m_nameTextSize * 3 ) / 4;
|
||||||
|
|
||||||
#define ETXT_MAX_SIZE Millimeter2iu(0.7 )
|
#define ETXT_MAX_SIZE Millimeter2iu( 0.7 )
|
||||||
if( textSize > ETXT_MAX_SIZE )
|
if( textSize > ETXT_MAX_SIZE )
|
||||||
textSize = ETXT_MAX_SIZE;
|
textSize = ETXT_MAX_SIZE;
|
||||||
|
|
||||||
|
@ -848,7 +850,7 @@ void LIB_PIN::PrintPinElectricalTypeName( wxDC* aDC, wxPoint& aPosition, int aOr
|
||||||
int pensize = textSize/6;
|
int pensize = textSize/6;
|
||||||
|
|
||||||
// Get a suitable color
|
// Get a suitable color
|
||||||
COLOR4D color = IsVisible() ? GetLayerColor( LAYER_NOTES ) : GetInvisibleItemColor();
|
COLOR4D color = aSettings->GetLayerColor( IsVisible() ? LAYER_NOTES : LAYER_HIDDEN );
|
||||||
|
|
||||||
wxPoint txtpos = aPosition;
|
wxPoint txtpos = aPosition;
|
||||||
int offset = Millimeter2iu( 0.4 );
|
int offset = Millimeter2iu( 0.4 );
|
||||||
|
@ -878,18 +880,19 @@ void LIB_PIN::PrintPinElectricalTypeName( wxDC* aDC, wxPoint& aPosition, int aOr
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
GRText( aDC, txtpos, color, typeName, orient, wxSize( textSize, textSize ), hjustify,
|
GRText( DC, txtpos, color, typeName, orient, wxSize( textSize, textSize ), hjustify,
|
||||||
GR_TEXT_VJUSTIFY_CENTER, pensize, false, false );
|
GR_TEXT_VJUSTIFY_CENTER, pensize, false, false, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrientation )
|
void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrientation )
|
||||||
{
|
{
|
||||||
int MapX1, MapY1, x1, y1;
|
int MapX1, MapY1, x1, y1;
|
||||||
COLOR4D color = aPlotter->ColorSettings()->GetColor( LAYER_PIN );
|
COLOR4D color = aPlotter->RenderSettings()->GetLayerColor( LAYER_PIN );
|
||||||
|
int penWidth = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetDefaultPenWidth() );
|
||||||
|
|
||||||
aPlotter->SetColor( color );
|
aPlotter->SetColor( color );
|
||||||
aPlotter->SetCurrentLineWidth( GetPenSize() );
|
aPlotter->SetCurrentLineWidth( penWidth );
|
||||||
|
|
||||||
MapX1 = MapY1 = 0;
|
MapX1 = MapY1 = 0;
|
||||||
x1 = aPosition.x; y1 = aPosition.y;
|
x1 = aPosition.x; y1 = aPosition.y;
|
||||||
|
@ -905,8 +908,8 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
|
||||||
if( m_shape == GRAPHIC_PINSHAPE::INVERTED || m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK )
|
if( m_shape == GRAPHIC_PINSHAPE::INVERTED || m_shape == GRAPHIC_PINSHAPE::INVERTED_CLOCK )
|
||||||
{
|
{
|
||||||
const int radius = ExternalPinDecoSize( *this );
|
const int radius = ExternalPinDecoSize( *this );
|
||||||
aPlotter->Circle( wxPoint( MapX1 * radius + x1, MapY1 * radius + y1 ),
|
aPlotter->Circle( wxPoint( MapX1 * radius + x1, MapY1 * radius + y1 ), radius * 2,
|
||||||
radius * 2, NO_FILL, GetPenSize() );
|
NO_FILL, penWidth );
|
||||||
|
|
||||||
aPlotter->MoveTo( wxPoint( MapX1 * radius * 2 + x1, MapY1 * radius * 2 + y1 ) );
|
aPlotter->MoveTo( wxPoint( MapX1 * radius * 2 + x1, MapY1 * radius * 2 + y1 ) );
|
||||||
aPlotter->FinishTo( aPosition );
|
aPlotter->FinishTo( aPosition );
|
||||||
|
@ -1010,9 +1013,8 @@ void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrie
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
|
void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient, int TextInside,
|
||||||
int TextInside, bool DrawPinNum,
|
bool DrawPinNum, bool DrawPinName, int aMarkupFlags )
|
||||||
bool DrawPinName, int aWidth )
|
|
||||||
{
|
{
|
||||||
if( m_name.IsEmpty() || m_name == wxT( "~" ) )
|
if( m_name.IsEmpty() || m_name == wxT( "~" ) )
|
||||||
DrawPinName = false;
|
DrawPinName = false;
|
||||||
|
@ -1027,17 +1029,17 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
|
||||||
wxSize PinNameSize = wxSize( m_nameTextSize, m_nameTextSize );
|
wxSize PinNameSize = wxSize( m_nameTextSize, m_nameTextSize );
|
||||||
wxSize PinNumSize = wxSize( m_numTextSize, m_numTextSize );
|
wxSize PinNumSize = wxSize( m_numTextSize, m_numTextSize );
|
||||||
|
|
||||||
int nameLineWidth = GetPenSize();
|
int namePenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_nameTextSize, false ),
|
||||||
nameLineWidth = Clamp_Text_PenSize( nameLineWidth, m_nameTextSize, false );
|
plotter->RenderSettings()->GetDefaultPenWidth() );
|
||||||
int numLineWidth = GetPenSize();
|
int numPenWidth = std::max( Clamp_Text_PenSize( GetPenWidth(), m_numTextSize, false ),
|
||||||
numLineWidth = Clamp_Text_PenSize( numLineWidth, m_numTextSize, false );
|
plotter->RenderSettings()->GetDefaultPenWidth() );
|
||||||
|
|
||||||
int name_offset = Mils2iu( PIN_TEXT_MARGIN ) + nameLineWidth;
|
int name_offset = Mils2iu( PIN_TEXT_MARGIN ) + namePenWidth;
|
||||||
int num_offset = Mils2iu( PIN_TEXT_MARGIN ) + numLineWidth;
|
int num_offset = Mils2iu( PIN_TEXT_MARGIN ) + numPenWidth;
|
||||||
|
|
||||||
/* Get the num and name colors */
|
/* Get the num and name colors */
|
||||||
COLOR4D NameColor = GetLayerColor( LAYER_PINNAM );
|
COLOR4D NameColor = plotter->RenderSettings()->GetLayerColor( LAYER_PINNAM );
|
||||||
COLOR4D NumColor = GetLayerColor( LAYER_PINNUM );
|
COLOR4D NumColor = plotter->RenderSettings()->GetLayerColor( LAYER_PINNUM );
|
||||||
|
|
||||||
int x1 = pin_pos.x;
|
int x1 = pin_pos.x;
|
||||||
int y1 = pin_pos.y;
|
int y1 = pin_pos.y;
|
||||||
|
@ -1066,7 +1068,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
|
||||||
PinNameSize,
|
PinNameSize,
|
||||||
GR_TEXT_HJUSTIFY_LEFT,
|
GR_TEXT_HJUSTIFY_LEFT,
|
||||||
GR_TEXT_VJUSTIFY_CENTER,
|
GR_TEXT_VJUSTIFY_CENTER,
|
||||||
aWidth, false, false );
|
namePenWidth, false, false, aMarkupFlags );
|
||||||
}
|
}
|
||||||
else // orient == PIN_LEFT
|
else // orient == PIN_LEFT
|
||||||
{
|
{
|
||||||
|
@ -1078,7 +1080,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
|
||||||
PinNameSize,
|
PinNameSize,
|
||||||
GR_TEXT_HJUSTIFY_RIGHT,
|
GR_TEXT_HJUSTIFY_RIGHT,
|
||||||
GR_TEXT_VJUSTIFY_CENTER,
|
GR_TEXT_VJUSTIFY_CENTER,
|
||||||
aWidth, false, false );
|
namePenWidth, false, false, aMarkupFlags );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( DrawPinNum )
|
if( DrawPinNum )
|
||||||
|
@ -1089,7 +1091,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
|
||||||
TEXT_ANGLE_HORIZ, PinNumSize,
|
TEXT_ANGLE_HORIZ, PinNumSize,
|
||||||
GR_TEXT_HJUSTIFY_CENTER,
|
GR_TEXT_HJUSTIFY_CENTER,
|
||||||
GR_TEXT_VJUSTIFY_BOTTOM,
|
GR_TEXT_VJUSTIFY_BOTTOM,
|
||||||
aWidth, false, false );
|
numPenWidth, false, false, aMarkupFlags );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /* Its a vertical line. */
|
else /* Its a vertical line. */
|
||||||
|
@ -1104,7 +1106,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
|
||||||
TEXT_ANGLE_VERT, PinNameSize,
|
TEXT_ANGLE_VERT, PinNameSize,
|
||||||
GR_TEXT_HJUSTIFY_RIGHT,
|
GR_TEXT_HJUSTIFY_RIGHT,
|
||||||
GR_TEXT_VJUSTIFY_CENTER,
|
GR_TEXT_VJUSTIFY_CENTER,
|
||||||
aWidth, false, false );
|
namePenWidth, false, false, aMarkupFlags );
|
||||||
|
|
||||||
if( DrawPinNum )
|
if( DrawPinNum )
|
||||||
{
|
{
|
||||||
|
@ -1114,7 +1116,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
|
||||||
TEXT_ANGLE_VERT, PinNumSize,
|
TEXT_ANGLE_VERT, PinNumSize,
|
||||||
GR_TEXT_HJUSTIFY_CENTER,
|
GR_TEXT_HJUSTIFY_CENTER,
|
||||||
GR_TEXT_VJUSTIFY_BOTTOM,
|
GR_TEXT_VJUSTIFY_BOTTOM,
|
||||||
aWidth, false, false );
|
numPenWidth, false, false, aMarkupFlags );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /* PIN_UP */
|
else /* PIN_UP */
|
||||||
|
@ -1127,7 +1129,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
|
||||||
TEXT_ANGLE_VERT, PinNameSize,
|
TEXT_ANGLE_VERT, PinNameSize,
|
||||||
GR_TEXT_HJUSTIFY_LEFT,
|
GR_TEXT_HJUSTIFY_LEFT,
|
||||||
GR_TEXT_VJUSTIFY_CENTER,
|
GR_TEXT_VJUSTIFY_CENTER,
|
||||||
aWidth, false, false );
|
namePenWidth, false, false, aMarkupFlags );
|
||||||
|
|
||||||
if( DrawPinNum )
|
if( DrawPinNum )
|
||||||
{
|
{
|
||||||
|
@ -1137,7 +1139,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
|
||||||
TEXT_ANGLE_VERT, PinNumSize,
|
TEXT_ANGLE_VERT, PinNumSize,
|
||||||
GR_TEXT_HJUSTIFY_CENTER,
|
GR_TEXT_HJUSTIFY_CENTER,
|
||||||
GR_TEXT_VJUSTIFY_BOTTOM,
|
GR_TEXT_VJUSTIFY_BOTTOM,
|
||||||
aWidth, false, false );
|
numPenWidth, false, false, aMarkupFlags );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1155,7 +1157,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
|
||||||
TEXT_ANGLE_HORIZ, PinNameSize,
|
TEXT_ANGLE_HORIZ, PinNameSize,
|
||||||
GR_TEXT_HJUSTIFY_CENTER,
|
GR_TEXT_HJUSTIFY_CENTER,
|
||||||
GR_TEXT_VJUSTIFY_BOTTOM,
|
GR_TEXT_VJUSTIFY_BOTTOM,
|
||||||
aWidth, false, false );
|
namePenWidth, false, false, aMarkupFlags );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( DrawPinNum )
|
if( DrawPinNum )
|
||||||
|
@ -1166,7 +1168,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
|
||||||
TEXT_ANGLE_HORIZ, PinNumSize,
|
TEXT_ANGLE_HORIZ, PinNumSize,
|
||||||
GR_TEXT_HJUSTIFY_CENTER,
|
GR_TEXT_HJUSTIFY_CENTER,
|
||||||
GR_TEXT_VJUSTIFY_TOP,
|
GR_TEXT_VJUSTIFY_TOP,
|
||||||
aWidth, false, false );
|
numPenWidth, false, false, aMarkupFlags );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /* Its a vertical line. */
|
else /* Its a vertical line. */
|
||||||
|
@ -1179,7 +1181,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
|
||||||
TEXT_ANGLE_VERT, PinNameSize,
|
TEXT_ANGLE_VERT, PinNameSize,
|
||||||
GR_TEXT_HJUSTIFY_CENTER,
|
GR_TEXT_HJUSTIFY_CENTER,
|
||||||
GR_TEXT_VJUSTIFY_BOTTOM,
|
GR_TEXT_VJUSTIFY_BOTTOM,
|
||||||
aWidth, false, false );
|
namePenWidth, false, false, aMarkupFlags );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( DrawPinNum )
|
if( DrawPinNum )
|
||||||
|
@ -1190,7 +1192,7 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
|
||||||
TEXT_ANGLE_VERT, PinNumSize,
|
TEXT_ANGLE_VERT, PinNumSize,
|
||||||
GR_TEXT_HJUSTIFY_CENTER,
|
GR_TEXT_HJUSTIFY_CENTER,
|
||||||
GR_TEXT_VJUSTIFY_TOP,
|
GR_TEXT_VJUSTIFY_TOP,
|
||||||
aWidth, false, false );
|
numPenWidth, false, false, aMarkupFlags );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1314,14 +1316,6 @@ void LIB_PIN::Offset( const wxPoint& aOffset )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LIB_PIN::Inside( EDA_RECT& rect ) const
|
|
||||||
{
|
|
||||||
wxPoint end = PinEndPoint();
|
|
||||||
|
|
||||||
return rect.Contains( m_position.x, -m_position.y ) || rect.Contains( end.x, -end.y );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LIB_PIN::MoveTo( const wxPoint& newPosition )
|
void LIB_PIN::MoveTo( const wxPoint& newPosition )
|
||||||
{
|
{
|
||||||
if( m_position != newPosition )
|
if( m_position != newPosition )
|
||||||
|
@ -1392,12 +1386,12 @@ void LIB_PIN::Plot( PLOTTER* plotter, const wxPoint& offset, bool fill,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int orient = PinDrawOrient( aTransform );
|
int orient = PinDrawOrient( aTransform );
|
||||||
|
|
||||||
wxPoint pos = aTransform.TransformCoordinate( m_position ) + offset;
|
wxPoint pos = aTransform.TransformCoordinate( m_position ) + offset;
|
||||||
|
|
||||||
PlotSymbol( plotter, pos, orient );
|
PlotSymbol( plotter, pos, orient );
|
||||||
PlotPinTexts( plotter, pos, orient, GetParent()->GetPinNameOffset(),
|
PlotPinTexts( plotter, pos, orient, GetParent()->GetPinNameOffset(),
|
||||||
GetParent()->ShowPinNumbers(), GetParent()->ShowPinNames(), GetPenSize() );
|
GetParent()->ShowPinNumbers(), GetParent()->ShowPinNames(),
|
||||||
|
plotter->GetTextMarkupFlags() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1451,8 +1445,8 @@ void LIB_PIN::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "Pos Y" ), text, DARKMAGENTA ) );
|
aList.push_back( MSG_PANEL_ITEM( _( "Pos Y" ), text, DARKMAGENTA ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void LIB_PIN::GetMsgPanelInfo(
|
void LIB_PIN::GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList,
|
||||||
EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList, SCH_COMPONENT* aComponent )
|
SCH_COMPONENT* aComponent )
|
||||||
{
|
{
|
||||||
getMsgPanelInfoBase( aUnits, aList );
|
getMsgPanelInfoBase( aUnits, aList );
|
||||||
|
|
||||||
|
@ -1586,7 +1580,7 @@ const EDA_RECT LIB_PIN::GetBoundingBox( bool aIncludeInvisibles ) const
|
||||||
bbox.SetOrigin( begin );
|
bbox.SetOrigin( begin );
|
||||||
bbox.SetEnd( end );
|
bbox.SetEnd( end );
|
||||||
bbox.Normalize();
|
bbox.Normalize();
|
||||||
bbox.Inflate( ( GetPenSize() / 2 ) + 1 );
|
bbox.Inflate( ( GetPenWidth() / 2 ) + 1 );
|
||||||
|
|
||||||
// Draw Y axis is reversed in schematic:
|
// Draw Y axis is reversed in schematic:
|
||||||
bbox.RevertYAxis();
|
bbox.RevertYAxis();
|
||||||
|
@ -1595,7 +1589,7 @@ const EDA_RECT LIB_PIN::GetBoundingBox( bool aIncludeInvisibles ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxArrayString LIB_PIN::GetOrientationNames( void )
|
wxArrayString LIB_PIN::GetOrientationNames()
|
||||||
{
|
{
|
||||||
wxArrayString tmp;
|
wxArrayString tmp;
|
||||||
|
|
||||||
|
|
|
@ -67,28 +67,29 @@ class LIB_PIN : public LIB_ITEM
|
||||||
// flag. So the LEGACY_PLUGIN_CACHE needs direct access to the member variables.
|
// flag. So the LEGACY_PLUGIN_CACHE needs direct access to the member variables.
|
||||||
friend class SCH_LEGACY_PLUGIN_CACHE;
|
friend class SCH_LEGACY_PLUGIN_CACHE;
|
||||||
|
|
||||||
wxPoint m_position; ///< Position of the pin.
|
wxPoint m_position; // Position of the pin.
|
||||||
int m_length; ///< Length of the pin.
|
int m_length; // Length of the pin.
|
||||||
int m_orientation; ///< Pin orientation (Up, Down, Left, Right)
|
int m_orientation; // Pin orientation (Up, Down, Left, Right)
|
||||||
GRAPHIC_PINSHAPE m_shape; ///< Shape drawn around pin
|
GRAPHIC_PINSHAPE m_shape; // Shape drawn around pin
|
||||||
int m_width; ///< Line width of the pin.
|
int m_width; // Line width of the pin.
|
||||||
ELECTRICAL_PINTYPE m_type; ///< Electrical type of the pin. See enum ELECTRICAL_PINTYPE.
|
ELECTRICAL_PINTYPE m_type; // Electrical type of the pin.
|
||||||
int m_attributes; ///< Set bit 0 to indicate pin is invisible.
|
int m_attributes; // Set bit 0 to indicate pin is invisible.
|
||||||
wxString m_name;
|
wxString m_name;
|
||||||
wxString m_number;
|
wxString m_number;
|
||||||
int m_numTextSize;
|
int m_numTextSize; // Pin num and Pin name sizes
|
||||||
int m_nameTextSize; ///< Pin num and Pin name sizes
|
int m_nameTextSize;
|
||||||
|
int m_textMarkupFlags; // Set of TEXT_MARKUP_FLAGS indicating which markup
|
||||||
|
// features are to be processed within the pin name
|
||||||
|
// and number.
|
||||||
/**
|
/**
|
||||||
* Print a pin, with or without the pin texts
|
* Print a pin, with or without the pin texts
|
||||||
*
|
*
|
||||||
* @param aDC Device Context (can be null)
|
|
||||||
* @param aOffset Offset to draw
|
* @param aOffset Offset to draw
|
||||||
* @param aData = used here as a boolean indicating whether or not to draw the pin
|
* @param aData = used here as a boolean indicating whether or not to draw the pin
|
||||||
* electrical types
|
* electrical types
|
||||||
* @param aTransform Transform Matrix (rotation, mirror ..)
|
* @param aTransform Transform Matrix (rotation, mirror ..)
|
||||||
*/
|
*/
|
||||||
void print( wxDC* aDC, const wxPoint& aOffset, void* aData,
|
void print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
|
||||||
const TRANSFORM& aTransform ) override;
|
const TRANSFORM& aTransform ) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -355,13 +356,13 @@ public:
|
||||||
&& ( !IsVisible() || (LIB_PART*) GetParent()->IsPower() );
|
&& ( !IsVisible() || (LIB_PART*) GetParent()->IsPower() );
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetPenSize() const override;
|
int GetPenWidth() const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print the pin symbol without text.
|
* Print the pin symbol without text.
|
||||||
* If \a aColor != 0, draw with \a aColor, else with the normal pin color.
|
* If \a aColor != 0, draw with \a aColor, else with the normal pin color.
|
||||||
*/
|
*/
|
||||||
void PrintPinSymbol( wxDC* aDC, const wxPoint& aPos, int aOrientation );
|
void PrintPinSymbol( RENDER_SETTINGS* aSettings, const wxPoint& aPos, int aOrientation );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Put the pin number and pin text info, given the pin line coordinates.
|
* Put the pin number and pin text info, given the pin line coordinates.
|
||||||
|
@ -371,13 +372,14 @@ public:
|
||||||
* If TextInside then the text is been put inside,otherwise all is drawn outside.
|
* If TextInside then the text is been put inside,otherwise all is drawn outside.
|
||||||
* Pin Name: substring between '~' is negated
|
* Pin Name: substring between '~' is negated
|
||||||
*/
|
*/
|
||||||
void PrintPinTexts( wxDC* aDC, wxPoint& aPosition, int aOrientation, int TextInside,
|
void PrintPinTexts( RENDER_SETTINGS* aSettings, wxPoint& aPosition, int aOrientation,
|
||||||
bool DrawPinNum, bool DrawPinName );
|
int TextInside, bool DrawPinNum, bool DrawPinName, int aMarkupFlags );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw the electrical type text of the pin (only for the footprint editor)
|
* Draw the electrical type text of the pin (only for the footprint editor)
|
||||||
*/
|
*/
|
||||||
void PrintPinElectricalTypeName( wxDC* aDC, wxPoint& aPosition, int aOrientation );
|
void PrintPinElectricalTypeName( RENDER_SETTINGS* aSettings, wxPoint& aPosition,
|
||||||
|
int aOrientation );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plot the pin number and pin text info, given the pin line coordinates.
|
* Plot the pin number and pin text info, given the pin line coordinates.
|
||||||
|
@ -387,7 +389,7 @@ public:
|
||||||
* the opposite direction to x2,y2), otherwise all is drawn outside.
|
* the opposite direction to x2,y2), otherwise all is drawn outside.
|
||||||
*/
|
*/
|
||||||
void PlotPinTexts( PLOTTER *aPlotter, wxPoint& aPosition, int aOrientation,
|
void PlotPinTexts( PLOTTER *aPlotter, wxPoint& aPosition, int aOrientation,
|
||||||
int aTextInside, bool aDrawPinNum, bool aDrawPinName, int aWidth );
|
int aTextInside, bool aDrawPinNum, bool aDrawPinName, int aMarkupFlags );
|
||||||
|
|
||||||
void PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrientation );
|
void PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrientation );
|
||||||
|
|
||||||
|
@ -425,8 +427,6 @@ public:
|
||||||
|
|
||||||
void Offset( const wxPoint& aOffset ) override;
|
void Offset( const wxPoint& aOffset ) override;
|
||||||
|
|
||||||
bool Inside( EDA_RECT& aRect ) const override;
|
|
||||||
|
|
||||||
void MoveTo( const wxPoint& aPosition ) override;
|
void MoveTo( const wxPoint& aPosition ) override;
|
||||||
|
|
||||||
wxPoint GetPosition() const override { return m_position; }
|
wxPoint GetPosition() const override { return m_position; }
|
||||||
|
@ -449,6 +449,9 @@ public:
|
||||||
int GetWidth() const override { return m_width; }
|
int GetWidth() const override { return m_width; }
|
||||||
void SetWidth( int aWidth ) override;
|
void SetWidth( int aWidth ) override;
|
||||||
|
|
||||||
|
int GetTextMarkupFlags() const { return m_textMarkupFlags; }
|
||||||
|
void SetTextMarkupFlags( int aFlags ) { m_textMarkupFlags = aFlags; }
|
||||||
|
|
||||||
BITMAP_DEF GetMenuImage() const override;
|
BITMAP_DEF GetMenuImage() const override;
|
||||||
|
|
||||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
#include <lib_polyline.h>
|
#include <lib_polyline.h>
|
||||||
#include <settings/color_settings.h>
|
#include <settings/color_settings.h>
|
||||||
#include <transform.h>
|
#include <transform.h>
|
||||||
#include <default_values.h> // For some default values
|
|
||||||
|
|
||||||
|
|
||||||
LIB_POLYLINE::LIB_POLYLINE( LIB_PART* aParent ) :
|
LIB_POLYLINE::LIB_POLYLINE( LIB_PART* aParent ) :
|
||||||
|
@ -88,18 +87,6 @@ void LIB_POLYLINE::Offset( const wxPoint& aOffset )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LIB_POLYLINE::Inside( EDA_RECT& aRect ) const
|
|
||||||
{
|
|
||||||
for( const wxPoint& point : m_PolyPoints )
|
|
||||||
{
|
|
||||||
if( aRect.Contains( point.x, -point.y ) )
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LIB_POLYLINE::MoveTo( const wxPoint& aPosition )
|
void LIB_POLYLINE::MoveTo( const wxPoint& aPosition )
|
||||||
{
|
{
|
||||||
Offset( aPosition - m_PolyPoints[ 0 ] );
|
Offset( aPosition - m_PolyPoints[ 0 ] );
|
||||||
|
@ -149,17 +136,16 @@ void LIB_POLYLINE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
||||||
|
|
||||||
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
||||||
{
|
{
|
||||||
aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_DEVICE_BACKGROUND ) );
|
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
||||||
aPlotter->PlotPoly( cornerList, FILLED_WITH_BG_BODYCOLOR, 0 );
|
aPlotter->PlotPoly( cornerList, FILLED_WITH_BG_BODYCOLOR, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR;
|
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR;
|
||||||
auto pen_size = GetPenSize();
|
auto pen_size = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetDefaultPenWidth() );
|
||||||
|
|
||||||
if( !already_filled || pen_size > 0 )
|
if( !already_filled || pen_size > 0 )
|
||||||
{
|
{
|
||||||
pen_size = std::max( 0, pen_size );
|
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
|
||||||
aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_DEVICE ) );
|
|
||||||
aPlotter->PlotPoly( cornerList, already_filled ? NO_FILL : m_Fill, pen_size );
|
aPlotter->PlotPoly( cornerList, already_filled ? NO_FILL : m_Fill, pen_size );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,39 +183,32 @@ void LIB_POLYLINE::RemoveCorner( int aIdx )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int LIB_POLYLINE::GetPenSize() const
|
int LIB_POLYLINE::GetPenWidth() const
|
||||||
{
|
{
|
||||||
if( m_Width )
|
return std::max( m_Width, 1 );
|
||||||
return m_Width;
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
// Temporary code not using RENDER_SETTINGS
|
|
||||||
return DEFAULT_LINE_THICKNESS * IU_PER_MILS;
|
|
||||||
#else
|
|
||||||
// JEY TODO: requires RENDER_SETTINGS
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_POLYLINE::print( wxDC* aDC, const wxPoint& aOffset, void* aData,
|
void LIB_POLYLINE::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
|
||||||
const TRANSFORM& aTransform )
|
const TRANSFORM& aTransform )
|
||||||
{
|
{
|
||||||
COLOR4D color = GetLayerColor( LAYER_DEVICE );
|
wxDC* DC = aSettings->GetPrintDC();
|
||||||
COLOR4D bgColor = GetLayerColor( LAYER_DEVICE_BACKGROUND );
|
COLOR4D color = aSettings->GetLayerColor( LAYER_DEVICE );
|
||||||
|
COLOR4D bgColor = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND );
|
||||||
wxPoint* buffer = new wxPoint[ m_PolyPoints.size() ];
|
wxPoint* buffer = new wxPoint[ m_PolyPoints.size() ];
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < m_PolyPoints.size(); ii++ )
|
for( unsigned ii = 0; ii < m_PolyPoints.size(); ii++ )
|
||||||
buffer[ii] = aTransform.TransformCoordinate( m_PolyPoints[ii] ) + aOffset;
|
buffer[ii] = aTransform.TransformCoordinate( m_PolyPoints[ii] ) + aOffset;
|
||||||
|
|
||||||
FILL_T fill = aData ? NO_FILL : m_Fill;
|
FILL_T fill = aData ? NO_FILL : m_Fill;
|
||||||
|
int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
|
||||||
|
|
||||||
if( fill == FILLED_WITH_BG_BODYCOLOR )
|
if( fill == FILLED_WITH_BG_BODYCOLOR )
|
||||||
GRPoly( nullptr, aDC, m_PolyPoints.size(), buffer, 1, GetPenSize(), bgColor, bgColor );
|
GRPoly( nullptr, DC, m_PolyPoints.size(), buffer, true, penWidth, bgColor, bgColor );
|
||||||
else if( fill == FILLED_SHAPE )
|
else if( fill == FILLED_SHAPE )
|
||||||
GRPoly( nullptr, aDC, m_PolyPoints.size(), buffer, 1, GetPenSize(), color, color );
|
GRPoly( nullptr, DC, m_PolyPoints.size(), buffer, true, penWidth, color, color );
|
||||||
else
|
else
|
||||||
GRPoly( nullptr, aDC, m_PolyPoints.size(), buffer, 0, GetPenSize(), color, color );
|
GRPoly( nullptr, DC, m_PolyPoints.size(), buffer, false, penWidth, color, color );
|
||||||
|
|
||||||
delete[] buffer;
|
delete[] buffer;
|
||||||
}
|
}
|
||||||
|
@ -237,8 +216,7 @@ void LIB_POLYLINE::print( wxDC* aDC, const wxPoint& aOffset, void* aData,
|
||||||
|
|
||||||
bool LIB_POLYLINE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
bool LIB_POLYLINE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
||||||
{
|
{
|
||||||
int delta = std::max( aAccuracy + GetPenSize() / 2,
|
int delta = std::max( aAccuracy + GetPenWidth() / 2, Mils2iu( MINIMUM_SELECTION_DISTANCE ) );
|
||||||
Mils2iu( MINIMUM_SELECTION_DISTANCE ) );
|
|
||||||
SHAPE_LINE_CHAIN shape;
|
SHAPE_LINE_CHAIN shape;
|
||||||
|
|
||||||
for( wxPoint pt : m_PolyPoints )
|
for( wxPoint pt : m_PolyPoints )
|
||||||
|
@ -272,7 +250,7 @@ bool LIB_POLYLINE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccurac
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Account for the width of the line
|
// Account for the width of the line
|
||||||
sel.Inflate( GetPenSize() / 2 );
|
sel.Inflate( ( GetPenWidth() / 2 ) + 1 );
|
||||||
|
|
||||||
// Only test closing segment if the polyline is filled
|
// Only test closing segment if the polyline is filled
|
||||||
int count = m_Fill == NO_FILL ? m_PolyPoints.size() - 1 : m_PolyPoints.size();
|
int count = m_Fill == NO_FILL ? m_PolyPoints.size() - 1 : m_PolyPoints.size();
|
||||||
|
@ -313,7 +291,7 @@ const EDA_RECT LIB_POLYLINE::GetBoundingBox() const
|
||||||
|
|
||||||
rect.SetOrigin( xmin, ymin );
|
rect.SetOrigin( xmin, ymin );
|
||||||
rect.SetEnd( xmax, ymax );
|
rect.SetEnd( xmax, ymax );
|
||||||
rect.Inflate( ( GetPenSize()+1 ) / 2 );
|
rect.Inflate( ( GetPenWidth() / 2 ) + 1 );
|
||||||
|
|
||||||
rect.RevertYAxis();
|
rect.RevertYAxis();
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ class LIB_POLYLINE : public LIB_ITEM
|
||||||
int m_Width; // Line width
|
int m_Width; // Line width
|
||||||
std::vector<wxPoint> m_PolyPoints; // list of points (>= 2)
|
std::vector<wxPoint> m_PolyPoints; // list of points (>= 2)
|
||||||
|
|
||||||
void print( wxDC* aDC, const wxPoint& aOffset, void* aData,
|
void print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
|
||||||
const TRANSFORM& aTransform ) override;
|
const TRANSFORM& aTransform ) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -77,7 +77,7 @@ public:
|
||||||
|
|
||||||
const EDA_RECT GetBoundingBox() const override;
|
const EDA_RECT GetBoundingBox() const override;
|
||||||
|
|
||||||
int GetPenSize( ) const override;
|
int GetPenWidth() const override;
|
||||||
|
|
||||||
void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||||
|
|
||||||
|
@ -88,8 +88,6 @@ public:
|
||||||
|
|
||||||
void Offset( const wxPoint& aOffset ) override;
|
void Offset( const wxPoint& aOffset ) override;
|
||||||
|
|
||||||
bool Inside( EDA_RECT& aRect ) const override;
|
|
||||||
|
|
||||||
void MoveTo( const wxPoint& aPosition ) override;
|
void MoveTo( const wxPoint& aPosition ) override;
|
||||||
|
|
||||||
wxPoint GetPosition() const override { return m_PolyPoints[0]; }
|
wxPoint GetPosition() const override { return m_PolyPoints[0]; }
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
#include <lib_rectangle.h>
|
#include <lib_rectangle.h>
|
||||||
#include <settings/color_settings.h>
|
#include <settings/color_settings.h>
|
||||||
#include <transform.h>
|
#include <transform.h>
|
||||||
#include <default_values.h> // For some default values
|
|
||||||
|
|
||||||
|
|
||||||
LIB_RECTANGLE::LIB_RECTANGLE( LIB_PART* aParent ) :
|
LIB_RECTANGLE::LIB_RECTANGLE( LIB_PART* aParent ) :
|
||||||
|
@ -88,12 +87,6 @@ void LIB_RECTANGLE::Offset( const wxPoint& aOffset )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LIB_RECTANGLE::Inside( EDA_RECT& aRect ) const
|
|
||||||
{
|
|
||||||
return aRect.Contains( m_Pos.x, -m_Pos.y ) || aRect.Contains( m_End.x, -m_End.y );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LIB_RECTANGLE::MoveTo( const wxPoint& aPosition )
|
void LIB_RECTANGLE::MoveTo( const wxPoint& aPosition )
|
||||||
{
|
{
|
||||||
wxPoint size = m_End - m_Pos;
|
wxPoint size = m_End - m_Pos;
|
||||||
|
@ -142,52 +135,45 @@ void LIB_RECTANGLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
||||||
|
|
||||||
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
||||||
{
|
{
|
||||||
aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_DEVICE_BACKGROUND ) );
|
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
||||||
aPlotter->Rect( pos, end, FILLED_WITH_BG_BODYCOLOR, 0 );
|
aPlotter->Rect( pos, end, FILLED_WITH_BG_BODYCOLOR, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR;
|
bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR;
|
||||||
auto pen_size = GetPenSize();
|
auto pen_size = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetDefaultPenWidth() );
|
||||||
|
|
||||||
if( !already_filled || pen_size > 0 )
|
if( !already_filled || pen_size > 0 )
|
||||||
{
|
{
|
||||||
pen_size = std::max( 0, pen_size );
|
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE ) );
|
||||||
aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_DEVICE ) );
|
|
||||||
aPlotter->Rect( pos, end, already_filled ? NO_FILL : m_Fill, pen_size );
|
aPlotter->Rect( pos, end, already_filled ? NO_FILL : m_Fill, pen_size );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int LIB_RECTANGLE::GetPenSize() const
|
int LIB_RECTANGLE::GetPenWidth() const
|
||||||
{
|
{
|
||||||
if( m_Width )
|
return std::max( m_Width, 1 );
|
||||||
return m_Width;
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
// Temporary code not using RENDER_SETTINGS
|
|
||||||
return DEFAULT_LINE_THICKNESS * IU_PER_MILS;
|
|
||||||
#else
|
|
||||||
// JEY TODO: requires RENDER_SETTINGS
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_RECTANGLE::print( wxDC* aDC, const wxPoint& aOffset, void* aData,
|
void LIB_RECTANGLE::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
|
||||||
const TRANSFORM& aTransform )
|
const TRANSFORM& aTransform )
|
||||||
{
|
{
|
||||||
COLOR4D color = GetLayerColor( LAYER_DEVICE );
|
wxDC* DC = aSettings->GetPrintDC();
|
||||||
COLOR4D bgColor = GetLayerColor( LAYER_DEVICE_BACKGROUND );
|
COLOR4D color = aSettings->GetLayerColor( LAYER_DEVICE );
|
||||||
|
COLOR4D bgColor = aSettings->GetLayerColor( LAYER_DEVICE_BACKGROUND );
|
||||||
wxPoint pt1 = aTransform.TransformCoordinate( m_Pos ) + aOffset;
|
wxPoint pt1 = aTransform.TransformCoordinate( m_Pos ) + aOffset;
|
||||||
wxPoint pt2 = aTransform.TransformCoordinate( m_End ) + aOffset;
|
wxPoint pt2 = aTransform.TransformCoordinate( m_End ) + aOffset;
|
||||||
|
|
||||||
FILL_T fill = aData ? NO_FILL : m_Fill;
|
FILL_T fill = aData ? NO_FILL : m_Fill;
|
||||||
|
int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
|
||||||
|
|
||||||
if( fill == FILLED_WITH_BG_BODYCOLOR && !aData )
|
if( fill == FILLED_WITH_BG_BODYCOLOR && !aData )
|
||||||
GRFilledRect( nullptr, aDC, pt1.x, pt1.y, pt2.x, pt2.y, GetPenSize( ), bgColor, bgColor );
|
GRFilledRect( nullptr, DC, pt1.x, pt1.y, pt2.x, pt2.y, penWidth, bgColor, bgColor );
|
||||||
else if( m_Fill == FILLED_SHAPE && !aData )
|
else if( m_Fill == FILLED_SHAPE && !aData )
|
||||||
GRFilledRect( nullptr, aDC, pt1.x, pt1.y, pt2.x, pt2.y, GetPenSize(), color, color );
|
GRFilledRect( nullptr, DC, pt1.x, pt1.y, pt2.x, pt2.y, penWidth, color, color );
|
||||||
else
|
else
|
||||||
GRRect( nullptr, aDC, pt1.x, pt1.y, pt2.x, pt2.y, GetPenSize(), color );
|
GRRect( nullptr, DC, pt1.x, pt1.y, pt2.x, pt2.y, penWidth, color );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -207,7 +193,7 @@ const EDA_RECT LIB_RECTANGLE::GetBoundingBox() const
|
||||||
|
|
||||||
rect.SetOrigin( m_Pos );
|
rect.SetOrigin( m_Pos );
|
||||||
rect.SetEnd( m_End );
|
rect.SetEnd( m_End );
|
||||||
rect.Inflate( ( GetPenSize()+1 ) / 2 );
|
rect.Inflate( ( GetPenWidth() / 2 ) + 1 );
|
||||||
|
|
||||||
rect.RevertYAxis();
|
rect.RevertYAxis();
|
||||||
|
|
||||||
|
@ -217,7 +203,7 @@ const EDA_RECT LIB_RECTANGLE::GetBoundingBox() const
|
||||||
|
|
||||||
bool LIB_RECTANGLE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
bool LIB_RECTANGLE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
||||||
{
|
{
|
||||||
int mindist = std::max( aAccuracy + GetPenSize() / 2,
|
int mindist = std::max( aAccuracy + GetPenWidth() / 2,
|
||||||
Mils2iu( MINIMUM_SELECTION_DISTANCE ) );
|
Mils2iu( MINIMUM_SELECTION_DISTANCE ) );
|
||||||
wxPoint actualStart = DefaultTransform.TransformCoordinate( m_Pos );
|
wxPoint actualStart = DefaultTransform.TransformCoordinate( m_Pos );
|
||||||
wxPoint actualEnd = DefaultTransform.TransformCoordinate( m_End );
|
wxPoint actualEnd = DefaultTransform.TransformCoordinate( m_End );
|
||||||
|
|
|
@ -34,7 +34,7 @@ class LIB_RECTANGLE : public LIB_ITEM
|
||||||
wxPoint m_Pos; // Rectangle start point.
|
wxPoint m_Pos; // Rectangle start point.
|
||||||
int m_Width; // Line width
|
int m_Width; // Line width
|
||||||
|
|
||||||
void print( wxDC* aDC, const wxPoint& aOffset, void* aData,
|
void print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
|
||||||
const TRANSFORM& aTransform ) override;
|
const TRANSFORM& aTransform ) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -58,7 +58,7 @@ public:
|
||||||
|
|
||||||
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
|
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
|
||||||
|
|
||||||
int GetPenSize( ) const override;
|
int GetPenWidth() const override;
|
||||||
|
|
||||||
const EDA_RECT GetBoundingBox() const override;
|
const EDA_RECT GetBoundingBox() const override;
|
||||||
|
|
||||||
|
@ -69,8 +69,6 @@ public:
|
||||||
|
|
||||||
void Offset( const wxPoint& aOffset ) override;
|
void Offset( const wxPoint& aOffset ) override;
|
||||||
|
|
||||||
bool Inside( EDA_RECT& aRect ) const override;
|
|
||||||
|
|
||||||
void MoveTo( const wxPoint& aPosition ) override;
|
void MoveTo( const wxPoint& aPosition ) override;
|
||||||
|
|
||||||
wxPoint GetPosition() const override { return m_Pos; }
|
wxPoint GetPosition() const override { return m_Pos; }
|
||||||
|
|
|
@ -44,9 +44,9 @@
|
||||||
#include <default_values.h> // For some default values
|
#include <default_values.h> // For some default values
|
||||||
|
|
||||||
|
|
||||||
LIB_TEXT::LIB_TEXT( LIB_PART * aParent ) :
|
LIB_TEXT::LIB_TEXT( LIB_PART* aParent, int aMarkupFlags ) :
|
||||||
LIB_ITEM( LIB_TEXT_T, aParent ),
|
LIB_ITEM( LIB_TEXT_T, aParent ),
|
||||||
EDA_TEXT()
|
EDA_TEXT( wxEmptyString, aMarkupFlags )
|
||||||
{
|
{
|
||||||
SetTextSize( wxSize( Mils2iu( DEFAULT_TEXT_SIZE ), Mils2iu( DEFAULT_TEXT_SIZE ) ) );
|
SetTextSize( wxSize( Mils2iu( DEFAULT_TEXT_SIZE ), Mils2iu( DEFAULT_TEXT_SIZE ) ) );
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ bool LIB_TEXT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
||||||
|
|
||||||
EDA_ITEM* LIB_TEXT::Clone() const
|
EDA_ITEM* LIB_TEXT::Clone() const
|
||||||
{
|
{
|
||||||
LIB_TEXT* newitem = new LIB_TEXT( nullptr );
|
LIB_TEXT* newitem = new LIB_TEXT( nullptr, GetTextMarkupFlags() );
|
||||||
|
|
||||||
newitem->m_Unit = m_Unit;
|
newitem->m_Unit = m_Unit;
|
||||||
newitem->m_Convert = m_Convert;
|
newitem->m_Convert = m_Convert;
|
||||||
|
@ -129,12 +129,6 @@ void LIB_TEXT::Offset( const wxPoint& aOffset )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LIB_TEXT::Inside( EDA_RECT& rect ) const
|
|
||||||
{
|
|
||||||
return rect.Intersects( GetBoundingBox() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LIB_TEXT::MoveTo( const wxPoint& newPosition )
|
void LIB_TEXT::MoveTo( const wxPoint& newPosition )
|
||||||
{
|
{
|
||||||
SetTextPos( newPosition );
|
SetTextPos( newPosition );
|
||||||
|
@ -144,7 +138,7 @@ void LIB_TEXT::MoveTo( const wxPoint& newPosition )
|
||||||
void LIB_TEXT::NormalizeJustification( bool inverse )
|
void LIB_TEXT::NormalizeJustification( bool inverse )
|
||||||
{
|
{
|
||||||
wxPoint delta( 0, 0 );
|
wxPoint delta( 0, 0 );
|
||||||
EDA_RECT bbox = GetTextBox( nullptr ); // JEY TODO: requires RENDER_SETTINGS
|
EDA_RECT bbox = GetTextBox();
|
||||||
|
|
||||||
if( GetTextAngle() == 0.0 )
|
if( GetTextAngle() == 0.0 )
|
||||||
{
|
{
|
||||||
|
@ -289,32 +283,33 @@ void LIB_TEXT::Plot( PLOTTER* plotter, const wxPoint& offset, bool fill,
|
||||||
COLOR4D color;
|
COLOR4D color;
|
||||||
|
|
||||||
if( plotter->GetColorMode() ) // Used normal color or selected color
|
if( plotter->GetColorMode() ) // Used normal color or selected color
|
||||||
color = plotter->ColorSettings()->GetColor( LAYER_DEVICE );
|
color = plotter->RenderSettings()->GetLayerColor( LAYER_DEVICE );
|
||||||
else
|
else
|
||||||
color = COLOR4D::BLACK;
|
color = COLOR4D::BLACK;
|
||||||
|
|
||||||
plotter->Text( pos, color, GetText(), t1 ? TEXT_ANGLE_HORIZ : TEXT_ANGLE_VERT,
|
int penWidth = std::max( GetEffectiveTextPenWidth(),
|
||||||
GetTextSize(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
plotter->RenderSettings()->GetDefaultPenWidth() );
|
||||||
GetPenSize(), IsItalic(), IsBold() );
|
|
||||||
|
// NOTE: do NOT use m_textMarkupFlags; those are from the library, not the schematic
|
||||||
|
|
||||||
|
plotter->Text( pos, color, GetText(), t1 ? TEXT_ANGLE_HORIZ : TEXT_ANGLE_VERT, GetTextSize(),
|
||||||
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, penWidth, IsItalic(),
|
||||||
|
IsBold(), plotter->GetTextMarkupFlags() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int LIB_TEXT::GetPenSize() const
|
int LIB_TEXT::GetPenWidth() const
|
||||||
{
|
{
|
||||||
#if 1
|
return GetEffectiveTextPenWidth();
|
||||||
// Temporary code not using RENDER_SETTINGS
|
|
||||||
int textThickness = DEFAULT_LINE_THICKNESS * IU_PER_MILS;
|
|
||||||
textThickness = Clamp_Text_PenSize( textThickness, GetTextSize(), IsBold() );
|
|
||||||
return textThickness;
|
|
||||||
#else
|
|
||||||
return GetEffectiveTextPenWidth( nullptr ); // JEY TODO: requires RENDER_SETTINGS
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_TEXT::print( wxDC* aDC, const wxPoint& aOffset, void* aData, const TRANSFORM& aTransform )
|
void LIB_TEXT::print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
|
||||||
|
const TRANSFORM& aTransform )
|
||||||
{
|
{
|
||||||
COLOR4D color = GetDefaultColor();
|
wxDC* DC = aSettings->GetPrintDC();
|
||||||
|
COLOR4D color = aSettings->GetLayerColor( LAYER_DEVICE );
|
||||||
|
int penWidth = std::max( GetEffectiveTextPenWidth(), aSettings->GetDefaultPenWidth() );
|
||||||
|
|
||||||
/* Calculate the text orientation, according to the component
|
/* Calculate the text orientation, according to the component
|
||||||
* orientation/mirror (needed when draw text in schematic)
|
* orientation/mirror (needed when draw text in schematic)
|
||||||
|
@ -349,8 +344,8 @@ void LIB_TEXT::print( wxDC* aDC, const wxPoint& aOffset, void* aData, const TRAN
|
||||||
// Calculate pos according to mirror/rotation.
|
// Calculate pos according to mirror/rotation.
|
||||||
txtpos = aTransform.TransformCoordinate( txtpos ) + aOffset;
|
txtpos = aTransform.TransformCoordinate( txtpos ) + aOffset;
|
||||||
|
|
||||||
GRText( aDC, txtpos, color, GetShownText(), orient, GetTextSize(), GR_TEXT_HJUSTIFY_CENTER,
|
GRText( DC, txtpos, color, GetShownText(), orient, GetTextSize(), GR_TEXT_HJUSTIFY_CENTER,
|
||||||
GR_TEXT_VJUSTIFY_CENTER, GetEffectiveTextPenWidth( nullptr ), IsItalic(), IsBold() );
|
GR_TEXT_VJUSTIFY_CENTER, penWidth, IsItalic(), IsBold(), m_textMarkupFlags );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -358,7 +353,7 @@ void LIB_TEXT::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
|
||||||
{
|
{
|
||||||
LIB_ITEM::GetMsgPanelInfo( aUnits, aList );
|
LIB_ITEM::GetMsgPanelInfo( aUnits, aList );
|
||||||
|
|
||||||
wxString msg = MessageTextFromValue( aUnits, GetTextPenWidth(), true );
|
wxString msg = MessageTextFromValue( aUnits, GetTextThickness(), true );
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
|
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,7 +363,7 @@ const EDA_RECT LIB_TEXT::GetBoundingBox() const
|
||||||
/* Y coordinates for LIB_ITEMS are bottom to top, so we must invert the Y position when
|
/* Y coordinates for LIB_ITEMS are bottom to top, so we must invert the Y position when
|
||||||
* calling GetTextBox() that works using top to bottom Y axis orientation.
|
* calling GetTextBox() that works using top to bottom Y axis orientation.
|
||||||
*/
|
*/
|
||||||
EDA_RECT rect = GetTextBox( nullptr, -1, true ); // JEY TODO: requires RENDER_SETTINGS
|
EDA_RECT rect = GetTextBox( -1, true );
|
||||||
rect.RevertYAxis();
|
rect.RevertYAxis();
|
||||||
|
|
||||||
// We are using now a bottom to top Y axis.
|
// We are using now a bottom to top Y axis.
|
||||||
|
|
|
@ -39,11 +39,11 @@
|
||||||
*/
|
*/
|
||||||
class LIB_TEXT : public LIB_ITEM, public EDA_TEXT
|
class LIB_TEXT : public LIB_ITEM, public EDA_TEXT
|
||||||
{
|
{
|
||||||
void print( wxDC* aDC, const wxPoint& aOffset, void* aData,
|
void print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset, void* aData,
|
||||||
const TRANSFORM& aTransform ) override;
|
const TRANSFORM& aTransform ) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LIB_TEXT( LIB_PART * aParent );
|
LIB_TEXT( LIB_PART* aParent, int aMarkupFlags = 0 );
|
||||||
|
|
||||||
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ public:
|
||||||
return TextHitTest( aRect, aContained, aAccuracy );
|
return TextHitTest( aRect, aContained, aAccuracy );
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetPenSize( ) const override;
|
int GetPenWidth() const override;
|
||||||
|
|
||||||
void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
void GetMsgPanelInfo( EDA_UNITS aUnits, std::vector<MSG_PANEL_ITEM>& aList ) override;
|
||||||
|
|
||||||
|
@ -79,8 +79,6 @@ public:
|
||||||
|
|
||||||
void Offset( const wxPoint& aOffset ) override;
|
void Offset( const wxPoint& aOffset ) override;
|
||||||
|
|
||||||
bool Inside( EDA_RECT& aRect ) const override;
|
|
||||||
|
|
||||||
void MoveTo( const wxPoint& aPosition ) override;
|
void MoveTo( const wxPoint& aPosition ) override;
|
||||||
|
|
||||||
wxPoint GetPosition() const override { return EDA_TEXT::GetTextPos(); }
|
wxPoint GetPosition() const override { return EDA_TEXT::GetTextPos(); }
|
||||||
|
@ -94,8 +92,8 @@ public:
|
||||||
void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
|
||||||
const TRANSFORM& aTransform ) override;
|
const TRANSFORM& aTransform ) override;
|
||||||
|
|
||||||
int GetWidth() const override { return GetTextPenWidth(); }
|
int GetWidth() const override { return GetTextThickness(); }
|
||||||
void SetWidth( int aWidth ) override { SetTextPenWidth( aWidth ); }
|
void SetWidth( int aWidth ) override { SetTextThickness( aWidth ); }
|
||||||
|
|
||||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include <kiway_express.h>
|
#include <kiway_express.h>
|
||||||
#include <lib_edit_frame.h>
|
#include <lib_edit_frame.h>
|
||||||
#include <lib_manager.h>
|
#include <lib_manager.h>
|
||||||
|
#include <lib_text.h>
|
||||||
#include <libedit_settings.h>
|
#include <libedit_settings.h>
|
||||||
#include <pgm_base.h>
|
#include <pgm_base.h>
|
||||||
#include <sch_draw_panel.h>
|
#include <sch_draw_panel.h>
|
||||||
|
@ -774,6 +775,30 @@ void LIB_EDIT_FRAME::SetScreen( BASE_SCREEN* aScreen )
|
||||||
|
|
||||||
void LIB_EDIT_FRAME::RebuildView()
|
void LIB_EDIT_FRAME::RebuildView()
|
||||||
{
|
{
|
||||||
|
if( m_my_part )
|
||||||
|
{
|
||||||
|
for( LIB_ITEM& item : m_my_part->GetDrawItems() )
|
||||||
|
{
|
||||||
|
switch( item.Type() )
|
||||||
|
{
|
||||||
|
case LIB_FIELD_T:
|
||||||
|
static_cast<LIB_FIELD*>( &item )->SetTextMarkupFlags( m_textMarkupFlags );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LIB_TEXT_T:
|
||||||
|
static_cast<LIB_TEXT*>( &item )->SetTextMarkupFlags( m_textMarkupFlags );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LIB_PIN_T:
|
||||||
|
static_cast<LIB_PIN*>( &item )->SetTextMarkupFlags( m_textMarkupFlags );
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GetRenderSettings()->m_ShowUnit = m_unit;
|
GetRenderSettings()->m_ShowUnit = m_unit;
|
||||||
GetRenderSettings()->m_ShowConvert = m_convert;
|
GetRenderSettings()->m_ShowConvert = m_convert;
|
||||||
GetRenderSettings()->m_ShowDisabled = m_my_part && m_my_part->IsAlias();
|
GetRenderSettings()->m_ShowDisabled = m_my_part && m_my_part->IsAlias();
|
||||||
|
|
|
@ -390,7 +390,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param aDC = wxDC given by the calling print function
|
* @param aDC = wxDC given by the calling print function
|
||||||
*/
|
*/
|
||||||
void PrintPage( wxDC* aDC ) override;
|
void PrintPage( RENDER_SETTINGS* aSettings ) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the SVG print file for the current edited component.
|
* Creates the SVG print file for the current edited component.
|
||||||
|
|
|
@ -23,10 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <gr_basic.h>
|
#include <sch_painter.h>
|
||||||
#include <sch_draw_panel.h>
|
|
||||||
#include <sch_screen.h>
|
|
||||||
#include <general.h>
|
|
||||||
#include <lib_edit_frame.h>
|
#include <lib_edit_frame.h>
|
||||||
#include <class_libentry.h>
|
#include <class_libentry.h>
|
||||||
#include <class_library.h>
|
#include <class_library.h>
|
||||||
|
@ -34,13 +31,17 @@
|
||||||
|
|
||||||
void LIB_EDIT_FRAME::SVG_PlotComponent( const wxString& aFullFileName )
|
void LIB_EDIT_FRAME::SVG_PlotComponent( const wxString& aFullFileName )
|
||||||
{
|
{
|
||||||
const bool plotColor = true;
|
KIGFX::SCH_RENDER_SETTINGS renderSettings;
|
||||||
|
renderSettings.LoadColors( GetColorSettings() );
|
||||||
|
renderSettings.SetDefaultPenWidth( GetRenderSettings()->GetDefaultPenWidth() );
|
||||||
|
|
||||||
const PAGE_INFO& pageInfo = GetScreen()->GetPageSettings();
|
const PAGE_INFO& pageInfo = GetScreen()->GetPageSettings();
|
||||||
|
|
||||||
SVG_PLOTTER* plotter = new SVG_PLOTTER();
|
SVG_PLOTTER* plotter = new SVG_PLOTTER();
|
||||||
|
plotter->SetRenderSettings( &renderSettings );
|
||||||
plotter->SetPageSettings( pageInfo );
|
plotter->SetPageSettings( pageInfo );
|
||||||
plotter->SetDefaultLineWidth( GetDefaultLineWidth() );
|
plotter->SetColorMode( true );
|
||||||
plotter->SetColorMode( plotColor );
|
plotter->SetTextMarkupFlags( GetTextMarkupFlags() );
|
||||||
|
|
||||||
wxPoint plot_offset;
|
wxPoint plot_offset;
|
||||||
const double scale = 1.0;
|
const double scale = 1.0;
|
||||||
|
@ -80,7 +81,7 @@ void LIB_EDIT_FRAME::SVG_PlotComponent( const wxString& aFullFileName )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LIB_EDIT_FRAME::PrintPage( wxDC* aDC )
|
void LIB_EDIT_FRAME::PrintPage( RENDER_SETTINGS* aSettings )
|
||||||
{
|
{
|
||||||
if( !m_my_part )
|
if( !m_my_part )
|
||||||
return;
|
return;
|
||||||
|
@ -95,5 +96,5 @@ void LIB_EDIT_FRAME::PrintPage( wxDC* aDC )
|
||||||
plot_offset.x = pagesize.x / 2;
|
plot_offset.x = pagesize.x / 2;
|
||||||
plot_offset.y = pagesize.y / 2;
|
plot_offset.y = pagesize.y / 2;
|
||||||
|
|
||||||
m_my_part->Print( aDC, plot_offset, m_unit, m_convert, PART_DRAW_OPTIONS::Default() );
|
m_my_part->Print( aSettings, plot_offset, m_unit, m_convert, PART_DRAW_OPTIONS() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include <project.h>
|
#include <project.h>
|
||||||
#include <pgm_base.h>
|
#include <pgm_base.h>
|
||||||
#include <settings/settings_manager.h>
|
#include <settings/settings_manager.h>
|
||||||
|
#include <sch_painter.h>
|
||||||
#include <dialog_plot_schematic.h>
|
#include <dialog_plot_schematic.h>
|
||||||
#include <wx_html_report_panel.h>
|
#include <wx_html_report_panel.h>
|
||||||
|
|
||||||
|
@ -109,12 +109,16 @@ bool DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF( const wxString& aFileName,
|
||||||
double aScale,
|
double aScale,
|
||||||
bool aPlotFrameRef )
|
bool aPlotFrameRef )
|
||||||
{
|
{
|
||||||
DXF_PLOTTER* plotter = new DXF_PLOTTER();
|
KIGFX::SCH_RENDER_SETTINGS renderSettings;
|
||||||
|
renderSettings.LoadColors( getColorSettings() );
|
||||||
|
renderSettings.SetDefaultPenWidth( 0 );
|
||||||
|
|
||||||
const PAGE_INFO& pageInfo = aScreen->GetPageSettings();
|
const PAGE_INFO& pageInfo = aScreen->GetPageSettings();
|
||||||
|
DXF_PLOTTER* plotter = new DXF_PLOTTER();
|
||||||
|
|
||||||
|
plotter->SetRenderSettings( &renderSettings );
|
||||||
plotter->SetPageSettings( pageInfo );
|
plotter->SetPageSettings( pageInfo );
|
||||||
plotter->SetColorMode( getModeColor() );
|
plotter->SetColorMode( getModeColor() );
|
||||||
plotter->SetColorSettings( getColorSettings() );
|
|
||||||
// Currently, plot units are in decimil
|
// Currently, plot units are in decimil
|
||||||
plotter->SetViewport( aPlotOffset, IU_PER_MILS/10, aScale, false );
|
plotter->SetViewport( aPlotOffset, IU_PER_MILS/10, aScale, false );
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,7 @@ bool DIALOG_PLOT_SCHEMATIC::Plot_1_Page_HPGL( const wxString& aFileName,
|
||||||
// Currently, plot units are in decimil
|
// Currently, plot units are in decimil
|
||||||
|
|
||||||
plotter->SetPageSettings( aPageInfo );
|
plotter->SetPageSettings( aPageInfo );
|
||||||
plotter->SetColorSettings( getColorSettings() );
|
plotter->RenderSettings()->LoadColors( getColorSettings() );
|
||||||
plotter->SetColorMode( getModeColor() );
|
plotter->SetColorMode( getModeColor() );
|
||||||
plotter->SetViewport( aPlot0ffset, IU_PER_MILS/10, aScale, false );
|
plotter->SetViewport( aPlot0ffset, IU_PER_MILS/10, aScale, false );
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include <sch_edit_frame.h>
|
#include <sch_edit_frame.h>
|
||||||
#include <base_units.h>
|
#include <base_units.h>
|
||||||
#include <sch_sheet_path.h>
|
#include <sch_sheet_path.h>
|
||||||
|
#include <sch_painter.h>
|
||||||
#include <pgm_base.h>
|
#include <pgm_base.h>
|
||||||
#include <project.h>
|
#include <project.h>
|
||||||
#include <general.h>
|
#include <general.h>
|
||||||
|
@ -41,9 +42,8 @@
|
||||||
#include <wx_html_report_panel.h>
|
#include <wx_html_report_panel.h>
|
||||||
|
|
||||||
void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef,
|
void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef,
|
||||||
int aDefaultLineWidth )
|
RENDER_SETTINGS* aRenderSettings )
|
||||||
{
|
{
|
||||||
SCH_SCREEN* screen = m_parent->GetScreen();
|
|
||||||
SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet(); // sheetpath is saved here
|
SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet(); // sheetpath is saved here
|
||||||
|
|
||||||
/* When printing all pages, the printed page is not the current page. In
|
/* When printing all pages, the printed page is not the current page. In
|
||||||
|
@ -62,9 +62,8 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef,
|
||||||
|
|
||||||
// Allocate the plotter and set the job level parameter
|
// Allocate the plotter and set the job level parameter
|
||||||
PDF_PLOTTER* plotter = new PDF_PLOTTER();
|
PDF_PLOTTER* plotter = new PDF_PLOTTER();
|
||||||
plotter->SetDefaultLineWidth( aDefaultLineWidth );
|
plotter->SetRenderSettings( aRenderSettings );
|
||||||
plotter->SetColorMode( getModeColor() );
|
plotter->SetColorMode( getModeColor() );
|
||||||
plotter->SetColorSettings( getColorSettings() );
|
|
||||||
plotter->SetCreator( wxT( "Eeschema-PDF" ) );
|
plotter->SetCreator( wxT( "Eeschema-PDF" ) );
|
||||||
plotter->SetTitle( m_parent->GetTitleBlock().GetTitle() );
|
plotter->SetTitle( m_parent->GetTitleBlock().GetTitle() );
|
||||||
|
|
||||||
|
@ -78,7 +77,7 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef,
|
||||||
m_parent->SetCurrentSheet( sheetList[i] );
|
m_parent->SetCurrentSheet( sheetList[i] );
|
||||||
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
|
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
|
||||||
m_parent->SetSheetNumberAndCount();
|
m_parent->SetSheetNumberAndCount();
|
||||||
screen = m_parent->GetCurrentSheet().LastScreen();
|
SCH_SCREEN* screen = m_parent->GetCurrentSheet().LastScreen();
|
||||||
|
|
||||||
if( i == 0 )
|
if( i == 0 )
|
||||||
{
|
{
|
||||||
|
@ -151,7 +150,7 @@ void DIALOG_PLOT_SCHEMATIC::plotOneSheetPDF( PLOTTER* aPlotter,
|
||||||
{
|
{
|
||||||
if( m_plotBackgroundColor->GetValue() )
|
if( m_plotBackgroundColor->GetValue() )
|
||||||
{
|
{
|
||||||
aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_SCHEMATIC_BACKGROUND ) );
|
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
|
||||||
wxPoint end( aPlotter->PageSettings().GetWidthIU(),
|
wxPoint end( aPlotter->PageSettings().GetWidthIU(),
|
||||||
aPlotter->PageSettings().GetHeightIU() );
|
aPlotter->PageSettings().GetHeightIU() );
|
||||||
aPlotter->Rect( wxPoint( 0, 0 ), end, FILLED_SHAPE, 1.0 );
|
aPlotter->Rect( wxPoint( 0, 0 ), end, FILLED_SHAPE, 1.0 );
|
||||||
|
@ -170,7 +169,7 @@ void DIALOG_PLOT_SCHEMATIC::plotOneSheetPDF( PLOTTER* aPlotter,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DIALOG_PLOT_SCHEMATIC::setupPlotPagePDF( PLOTTER * aPlotter, SCH_SCREEN* aScreen )
|
void DIALOG_PLOT_SCHEMATIC::setupPlotPagePDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen )
|
||||||
{
|
{
|
||||||
PAGE_INFO plotPage; // page size selected to plot
|
PAGE_INFO plotPage; // page size selected to plot
|
||||||
// Considerations on page size and scaling requests
|
// Considerations on page size and scaling requests
|
||||||
|
|
|
@ -33,16 +33,14 @@
|
||||||
#include <project.h>
|
#include <project.h>
|
||||||
#include <reporter.h>
|
#include <reporter.h>
|
||||||
#include <settings/settings_manager.h>
|
#include <settings/settings_manager.h>
|
||||||
|
#include <sch_painter.h>
|
||||||
#include <dialog_plot_schematic.h>
|
#include <dialog_plot_schematic.h>
|
||||||
#include <wx_html_report_panel.h>
|
#include <wx_html_report_panel.h>
|
||||||
|
|
||||||
void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef,
|
void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef,
|
||||||
int aDefaultLineWidth )
|
RENDER_SETTINGS* aRenderSettings )
|
||||||
{
|
{
|
||||||
SCH_SCREEN* screen = m_parent->GetScreen();
|
|
||||||
SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet(); // sheetpath is saved here
|
SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet(); // sheetpath is saved here
|
||||||
PAGE_INFO actualPage; // page size selected in schematic
|
|
||||||
PAGE_INFO plotPage; // page size selected to plot
|
PAGE_INFO plotPage; // page size selected to plot
|
||||||
|
|
||||||
/* When printing all pages, the printed page is not the current page.
|
/* When printing all pages, the printed page is not the current page.
|
||||||
|
@ -63,8 +61,9 @@ void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef,
|
||||||
m_parent->SetCurrentSheet( sheetList[i] );
|
m_parent->SetCurrentSheet( sheetList[i] );
|
||||||
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
|
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
|
||||||
m_parent->SetSheetNumberAndCount();
|
m_parent->SetSheetNumberAndCount();
|
||||||
screen = m_parent->GetCurrentSheet().LastScreen();
|
|
||||||
actualPage = screen->GetPageSettings();
|
SCH_SCREEN* screen = m_parent->GetCurrentSheet().LastScreen();
|
||||||
|
PAGE_INFO actualPage = screen->GetPageSettings();
|
||||||
|
|
||||||
switch( m_pageSizeSelect )
|
switch( m_pageSizeSelect )
|
||||||
{
|
{
|
||||||
|
@ -100,7 +99,7 @@ void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef,
|
||||||
wxString ext = PS_PLOTTER::GetDefaultFileExtension();
|
wxString ext = PS_PLOTTER::GetDefaultFileExtension();
|
||||||
wxFileName plotFileName = createPlotFileName( fname, ext, &reporter );
|
wxFileName plotFileName = createPlotFileName( fname, ext, &reporter );
|
||||||
|
|
||||||
if( plotOneSheetPS( plotFileName.GetFullPath(), screen, aDefaultLineWidth, plotPage,
|
if( plotOneSheetPS( plotFileName.GetFullPath(), screen, aRenderSettings, plotPage,
|
||||||
plot_offset, scale, aPlotFrameRef ) )
|
plot_offset, scale, aPlotFrameRef ) )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Plot: \"%s\" OK.\n" ), plotFileName.GetFullPath() );
|
msg.Printf( _( "Plot: \"%s\" OK.\n" ), plotFileName.GetFullPath() );
|
||||||
|
@ -129,17 +128,16 @@ void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef,
|
||||||
|
|
||||||
bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName,
|
bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName,
|
||||||
SCH_SCREEN* aScreen,
|
SCH_SCREEN* aScreen,
|
||||||
int aDefaultLineWidth,
|
RENDER_SETTINGS* aRenderSettings,
|
||||||
const PAGE_INFO& aPageInfo,
|
const PAGE_INFO& aPageInfo,
|
||||||
wxPoint aPlot0ffset,
|
wxPoint aPlot0ffset,
|
||||||
double aScale,
|
double aScale,
|
||||||
bool aPlotFrameRef )
|
bool aPlotFrameRef )
|
||||||
{
|
{
|
||||||
PS_PLOTTER* plotter = new PS_PLOTTER();
|
PS_PLOTTER* plotter = new PS_PLOTTER();
|
||||||
|
plotter->SetRenderSettings( aRenderSettings );
|
||||||
plotter->SetPageSettings( aPageInfo );
|
plotter->SetPageSettings( aPageInfo );
|
||||||
plotter->SetDefaultLineWidth( aDefaultLineWidth );
|
|
||||||
plotter->SetColorMode( getModeColor() );
|
plotter->SetColorMode( getModeColor() );
|
||||||
plotter->SetColorSettings( getColorSettings() );
|
|
||||||
// Currently, plot units are in decimil
|
// Currently, plot units are in decimil
|
||||||
plotter->SetViewport( aPlot0ffset, IU_PER_MILS/10, aScale, false );
|
plotter->SetViewport( aPlot0ffset, IU_PER_MILS/10, aScale, false );
|
||||||
|
|
||||||
|
@ -158,7 +156,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName,
|
||||||
|
|
||||||
if( m_plotBackgroundColor->GetValue() )
|
if( m_plotBackgroundColor->GetValue() )
|
||||||
{
|
{
|
||||||
plotter->SetColor( plotter->ColorSettings()->GetColor( LAYER_SCHEMATIC_BACKGROUND ) );
|
plotter->SetColor( plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
|
||||||
wxPoint end( plotter->PageSettings().GetWidthIU(),
|
wxPoint end( plotter->PageSettings().GetWidthIU(),
|
||||||
plotter->PageSettings().GetHeightIU() );
|
plotter->PageSettings().GetHeightIU() );
|
||||||
plotter->Rect( wxPoint( 0, 0 ), end, FILLED_SHAPE, 1.0 );
|
plotter->Rect( wxPoint( 0, 0 ), end, FILLED_SHAPE, 1.0 );
|
||||||
|
|
|
@ -40,9 +40,10 @@
|
||||||
|
|
||||||
#include <dialog_plot_schematic.h>
|
#include <dialog_plot_schematic.h>
|
||||||
#include <wx_html_report_panel.h>
|
#include <wx_html_report_panel.h>
|
||||||
|
#include "sch_painter.h"
|
||||||
|
|
||||||
void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef,
|
void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef,
|
||||||
int aDefaultLineWidth )
|
RENDER_SETTINGS* aRenderSettings )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
REPORTER& reporter = m_MessagesBox->Reporter();
|
REPORTER& reporter = m_MessagesBox->Reporter();
|
||||||
|
@ -68,7 +69,7 @@ void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef,
|
||||||
wxString ext = SVG_PLOTTER::GetDefaultFileExtension();
|
wxString ext = SVG_PLOTTER::GetDefaultFileExtension();
|
||||||
wxFileName plotFileName = createPlotFileName( fname, ext, &reporter );
|
wxFileName plotFileName = createPlotFileName( fname, ext, &reporter );
|
||||||
|
|
||||||
bool success = plotOneSheetSVG( plotFileName.GetFullPath(), screen, aDefaultLineWidth,
|
bool success = plotOneSheetSVG( plotFileName.GetFullPath(), screen, aRenderSettings,
|
||||||
getModeColor() ? false : true, aPrintFrameRef );
|
getModeColor() ? false : true, aPrintFrameRef );
|
||||||
|
|
||||||
if( !success )
|
if( !success )
|
||||||
|
@ -97,18 +98,18 @@ void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG( const wxString& aFileName,
|
bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG( const wxString& aFileName,
|
||||||
SCH_SCREEN* aScreen,
|
SCH_SCREEN* aScreen,
|
||||||
int aDefaultLineWidth,
|
RENDER_SETTINGS* aRenderSettings,
|
||||||
bool aPlotBlackAndWhite,
|
bool aPlotBlackAndWhite,
|
||||||
bool aPlotFrameRef )
|
bool aPlotFrameRef )
|
||||||
{
|
{
|
||||||
|
const PAGE_INFO& pageInfo = aScreen->GetPageSettings();
|
||||||
|
|
||||||
SVG_PLOTTER* plotter = new SVG_PLOTTER();
|
SVG_PLOTTER* plotter = new SVG_PLOTTER();
|
||||||
const PAGE_INFO& pageInfo = aScreen->GetPageSettings();
|
plotter->SetRenderSettings( aRenderSettings );
|
||||||
plotter->SetPageSettings( pageInfo );
|
plotter->SetPageSettings( pageInfo );
|
||||||
plotter->SetDefaultLineWidth( aDefaultLineWidth );
|
|
||||||
plotter->SetColorMode( aPlotBlackAndWhite ? false : true );
|
plotter->SetColorMode( aPlotBlackAndWhite ? false : true );
|
||||||
plotter->SetColorSettings( getColorSettings() );
|
|
||||||
wxPoint plot_offset;
|
wxPoint plot_offset;
|
||||||
double scale = 1.0;
|
double scale = 1.0;
|
||||||
// Currently, plot units are in decimil
|
// Currently, plot units are in decimil
|
||||||
|
@ -129,7 +130,7 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG( const wxString& aFileName,
|
||||||
|
|
||||||
if( m_plotBackgroundColor->GetValue() )
|
if( m_plotBackgroundColor->GetValue() )
|
||||||
{
|
{
|
||||||
plotter->SetColor( plotter->ColorSettings()->GetColor( LAYER_SCHEMATIC_BACKGROUND ) );
|
plotter->SetColor( plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_BACKGROUND ) );
|
||||||
wxPoint end( plotter->PageSettings().GetWidthIU(),
|
wxPoint end( plotter->PageSettings().GetWidthIU(),
|
||||||
plotter->PageSettings().GetHeightIU() );
|
plotter->PageSettings().GetHeightIU() );
|
||||||
plotter->Rect( wxPoint( 0, 0 ), end, FILLED_SHAPE, 1.0 );
|
plotter->Rect( wxPoint( 0, 0 ), end, FILLED_SHAPE, 1.0 );
|
||||||
|
|
|
@ -574,6 +574,8 @@ bool SCH_EDIT_FRAME::rescueProject( RESCUER& aRescuer, bool aRunningOnDemand )
|
||||||
SCH_SCREENS schematic;
|
SCH_SCREENS schematic;
|
||||||
|
|
||||||
schematic.UpdateSymbolLinks( true );
|
schematic.UpdateSymbolLinks( true );
|
||||||
|
schematic.UpdateTextMarkupFlags( GetTextMarkupFlags() );
|
||||||
|
|
||||||
g_ConnectionGraph->Reset();
|
g_ConnectionGraph->Reset();
|
||||||
RecalculateConnections( GLOBAL_CLEANUP );
|
RecalculateConnections( GLOBAL_CLEANUP );
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,8 @@ SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aWindo
|
||||||
m_defaultWireThickness( DEFAULT_WIRE_THICKNESS * IU_PER_MILS ),
|
m_defaultWireThickness( DEFAULT_WIRE_THICKNESS * IU_PER_MILS ),
|
||||||
m_defaultBusThickness( DEFAULT_BUS_THICKNESS * IU_PER_MILS ),
|
m_defaultBusThickness( DEFAULT_BUS_THICKNESS * IU_PER_MILS ),
|
||||||
m_defaultTextSize( DEFAULT_TEXT_SIZE * IU_PER_MILS ),
|
m_defaultTextSize( DEFAULT_TEXT_SIZE * IU_PER_MILS ),
|
||||||
|
m_textOffsetRatio( 0.08 ),
|
||||||
|
m_textMarkupFlags( 0 ),
|
||||||
m_showPinElectricalTypeName( false )
|
m_showPinElectricalTypeName( false )
|
||||||
{
|
{
|
||||||
createCanvas();
|
createCanvas();
|
||||||
|
@ -129,7 +131,7 @@ const wxString SCH_BASE_FRAME::GetZoomLevelIndicator() const
|
||||||
void SCH_BASE_FRAME::SetDefaultLineWidth( int aWidth )
|
void SCH_BASE_FRAME::SetDefaultLineWidth( int aWidth )
|
||||||
{
|
{
|
||||||
m_defaultLineWidth = aWidth;
|
m_defaultLineWidth = aWidth;
|
||||||
GetRenderSettings()->m_DefaultLineWidth = aWidth;
|
GetRenderSettings()->SetDefaultPenWidth( aWidth );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -92,6 +92,8 @@ protected:
|
||||||
int m_defaultWireThickness;
|
int m_defaultWireThickness;
|
||||||
int m_defaultBusThickness;
|
int m_defaultBusThickness;
|
||||||
int m_defaultTextSize;
|
int m_defaultTextSize;
|
||||||
|
double m_textOffsetRatio;
|
||||||
|
int m_textMarkupFlags;
|
||||||
|
|
||||||
TEMPLATES m_templateFieldNames;
|
TEMPLATES m_templateFieldNames;
|
||||||
|
|
||||||
|
@ -142,6 +144,12 @@ public:
|
||||||
int GetDefaultTextSize() const { return m_defaultTextSize; }
|
int GetDefaultTextSize() const { return m_defaultTextSize; }
|
||||||
void SetDefaultTextSize( int aSize ) { m_defaultTextSize = aSize; }
|
void SetDefaultTextSize( int aSize ) { m_defaultTextSize = aSize; }
|
||||||
|
|
||||||
|
double GetTextOffsetRatio() const { return m_textOffsetRatio; }
|
||||||
|
void SetTextOffsetRatio( double aRatio ) { m_textOffsetRatio = aRatio; }
|
||||||
|
|
||||||
|
int GetTextMarkupFlags() const { return m_textMarkupFlags; }
|
||||||
|
void SetTextMarkupFlags( int aFlags ) { m_textMarkupFlags = aFlags; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetZoomLevelIndicator
|
* Function GetZoomLevelIndicator
|
||||||
* returns a human readable value which can be displayed as zoom
|
* returns a human readable value which can be displayed as zoom
|
||||||
|
|
|
@ -59,7 +59,7 @@ SCH_BITMAP::SCH_BITMAP( const SCH_BITMAP& aSchBitmap ) :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SCH_ITEM& SCH_BITMAP::operator=( const SCH_ITEM& aItem )
|
SCH_BITMAP& SCH_BITMAP::operator=( const SCH_ITEM& aItem )
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( Type() == aItem.Type(), *this,
|
wxCHECK_MSG( Type() == aItem.Type(), *this,
|
||||||
wxT( "Cannot assign object type " ) + aItem.GetClass() + wxT( " to type " ) +
|
wxT( "Cannot assign object type " ) + aItem.GetClass() + wxT( " to type " ) +
|
||||||
|
@ -114,11 +114,11 @@ const EDA_RECT SCH_BITMAP::GetBoundingBox() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_BITMAP::Print( wxDC* aDC, const wxPoint& aOffset )
|
void SCH_BITMAP::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
|
||||||
{
|
{
|
||||||
wxPoint pos = m_pos + aOffset;
|
wxPoint pos = m_pos + aOffset;
|
||||||
|
|
||||||
m_image->DrawBitmap( aDC, pos );
|
m_image->DrawBitmap( aSettings->GetPrintDC(), pos );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -185,8 +185,8 @@ bool SCH_BITMAP::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy
|
||||||
|
|
||||||
void SCH_BITMAP::Plot( PLOTTER* aPlotter )
|
void SCH_BITMAP::Plot( PLOTTER* aPlotter )
|
||||||
{
|
{
|
||||||
m_image->PlotImage(
|
m_image->PlotImage( aPlotter, m_pos, aPlotter->RenderSettings()->GetLayerColor( GetLayer() ),
|
||||||
aPlotter, m_pos, aPlotter->ColorSettings()->GetColor( GetLayer() ), GetPenSize() );
|
aPlotter->RenderSettings()->GetDefaultPenWidth() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ public:
|
||||||
delete m_image;
|
delete m_image;
|
||||||
}
|
}
|
||||||
|
|
||||||
SCH_ITEM& operator=( const SCH_ITEM& aItem );
|
SCH_BITMAP& operator=( const SCH_ITEM& aItem );
|
||||||
|
|
||||||
BITMAP_BASE* GetImage()
|
BITMAP_BASE* GetImage()
|
||||||
{
|
{
|
||||||
|
@ -97,7 +97,7 @@ public:
|
||||||
|
|
||||||
void SwapData( SCH_ITEM* aItem ) override;
|
void SwapData( SCH_ITEM* aItem ) override;
|
||||||
|
|
||||||
void Print( wxDC* aDC, const wxPoint& aOffset ) override;
|
void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
|
||||||
|
|
||||||
/// @copydoc VIEW_ITEM::ViewGetLayers()
|
/// @copydoc VIEW_ITEM::ViewGetLayers()
|
||||||
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include <sch_line.h>
|
#include <sch_line.h>
|
||||||
#include <sch_text.h>
|
#include <sch_text.h>
|
||||||
#include <settings/color_settings.h>
|
#include <settings/color_settings.h>
|
||||||
|
#include "sch_painter.h"
|
||||||
#include <default_values.h> // For some default values
|
#include <default_values.h> // For some default values
|
||||||
|
|
||||||
|
|
||||||
|
@ -121,31 +122,21 @@ const EDA_RECT SCH_BUS_ENTRY_BASE::GetBoundingBox() const
|
||||||
box.SetEnd( m_End() );
|
box.SetEnd( m_End() );
|
||||||
|
|
||||||
box.Normalize();
|
box.Normalize();
|
||||||
box.Inflate( GetPenSize() / 2 );
|
box.Inflate( ( GetPenWidth() / 2 ) + 1 );
|
||||||
|
|
||||||
return box;
|
return box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int SCH_BUS_WIRE_ENTRY::GetPenSize() const
|
int SCH_BUS_WIRE_ENTRY::GetPenWidth() const
|
||||||
{
|
{
|
||||||
#if 1
|
return 1;
|
||||||
// Temporary code not using RENDER_SETTINGS
|
|
||||||
return DEFAULT_WIRE_THICKNESS * IU_PER_MILS;
|
|
||||||
#else
|
|
||||||
// JEY TODO: requires RENDER_SETTINGS
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int SCH_BUS_BUS_ENTRY::GetPenSize() const
|
int SCH_BUS_BUS_ENTRY::GetPenWidth() const
|
||||||
{
|
{
|
||||||
#if 1
|
return 1;
|
||||||
// Temporary code not using RENDER_SETTINGS
|
|
||||||
return DEFAULT_BUS_THICKNESS * IU_PER_MILS;
|
|
||||||
#else
|
|
||||||
// JEY TODO: requires RENDER_SETTINGS
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -169,12 +160,14 @@ void SCH_BUS_BUS_ENTRY::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemLis
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_BUS_ENTRY_BASE::Print( wxDC* aDC, const wxPoint& aOffset )
|
void SCH_BUS_ENTRY_BASE::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
|
||||||
{
|
{
|
||||||
COLOR4D color = GetLayerColor( m_Layer );
|
wxDC* DC = aSettings->GetPrintDC();
|
||||||
|
COLOR4D color = aSettings->GetLayerColor( m_Layer );
|
||||||
|
int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
|
||||||
|
|
||||||
GRLine( nullptr, aDC, m_pos.x + aOffset.x, m_pos.y + aOffset.y, m_End().x + aOffset.x,
|
GRLine( nullptr, DC, m_pos.x + aOffset.x, m_pos.y + aOffset.y, m_End().x + aOffset.x,
|
||||||
m_End().y + aOffset.y, GetPenSize(), color );
|
m_End().y + aOffset.y, penWidth, color );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -341,7 +334,7 @@ bool SCH_BUS_ENTRY_BASE::HitTest( const wxPoint& aPosition, int aAccuracy ) cons
|
||||||
{
|
{
|
||||||
// Insure minimum accuracy
|
// Insure minimum accuracy
|
||||||
if( aAccuracy == 0 )
|
if( aAccuracy == 0 )
|
||||||
aAccuracy = ( GetPenSize() / 2 ) + 4;
|
aAccuracy = ( GetPenWidth() / 2 ) + 4;
|
||||||
|
|
||||||
return TestSegmentHit( aPosition, m_pos, m_End(), aAccuracy );
|
return TestSegmentHit( aPosition, m_pos, m_End(), aAccuracy );
|
||||||
}
|
}
|
||||||
|
@ -362,8 +355,10 @@ bool SCH_BUS_ENTRY_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aA
|
||||||
|
|
||||||
void SCH_BUS_ENTRY_BASE::Plot( PLOTTER* aPlotter )
|
void SCH_BUS_ENTRY_BASE::Plot( PLOTTER* aPlotter )
|
||||||
{
|
{
|
||||||
aPlotter->SetCurrentLineWidth( GetPenSize() );
|
int penWidth = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetDefaultPenWidth() );
|
||||||
aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( GetLayer() ) );
|
|
||||||
|
aPlotter->SetCurrentLineWidth( penWidth );
|
||||||
|
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( GetLayer() ) );
|
||||||
aPlotter->MoveTo( m_pos );
|
aPlotter->MoveTo( m_pos );
|
||||||
aPlotter->FinishTo( m_End() );
|
aPlotter->FinishTo( m_End() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ public:
|
||||||
|
|
||||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||||
|
|
||||||
void Print( wxDC* aDC, const wxPoint& aOffset ) override;
|
void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
|
||||||
|
|
||||||
const EDA_RECT GetBoundingBox() const override;
|
const EDA_RECT GetBoundingBox() const override;
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ public:
|
||||||
return wxT( "SCH_BUS_WIRE_ENTRY" );
|
return wxT( "SCH_BUS_WIRE_ENTRY" );
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetPenSize() const override;
|
int GetPenWidth() const override;
|
||||||
|
|
||||||
void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override;
|
void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override;
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ public:
|
||||||
return wxT( "SCH_BUS_BUS_ENTRY" );
|
return wxT( "SCH_BUS_BUS_ENTRY" );
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetPenSize() const override;
|
int GetPenWidth() const override;
|
||||||
|
|
||||||
void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override;
|
void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override;
|
||||||
|
|
||||||
|
|
|
@ -529,24 +529,25 @@ int SCH_COMPONENT::GetUnitCount() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_COMPONENT::Print( wxDC* aDC, const wxPoint& aOffset )
|
void SCH_COMPONENT::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
|
||||||
{
|
{
|
||||||
auto opts = PART_DRAW_OPTIONS::Default();
|
PART_DRAW_OPTIONS opts;
|
||||||
opts.transform = m_transform;
|
opts.transform = m_transform;
|
||||||
opts.draw_visible_fields = false;
|
opts.draw_visible_fields = false;
|
||||||
opts.draw_hidden_fields = false;
|
opts.draw_hidden_fields = false;
|
||||||
|
opts.text_markup_flags = m_Fields[0].GetTextMarkupFlags();
|
||||||
|
|
||||||
if( m_part )
|
if( m_part )
|
||||||
{
|
{
|
||||||
m_part->Print( aDC, m_Pos + aOffset, m_unit, m_convert, opts );
|
m_part->Print( aSettings, m_Pos + aOffset, m_unit, m_convert, opts );
|
||||||
}
|
}
|
||||||
else // Use dummy() part if the actual cannot be found.
|
else // Use dummy() part if the actual cannot be found.
|
||||||
{
|
{
|
||||||
dummy()->Print( aDC, m_Pos + aOffset, 0, 0, opts );
|
dummy()->Print( aSettings, m_Pos + aOffset, 0, 0, opts );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( SCH_FIELD& field : m_Fields )
|
for( SCH_FIELD& field : m_Fields )
|
||||||
field.Print( aDC, aOffset );
|
field.Print( aSettings, aOffset );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -821,7 +822,8 @@ void SCH_COMPONENT::UpdateFields( bool aResetStyle, bool aResetRef )
|
||||||
if( !schField )
|
if( !schField )
|
||||||
{
|
{
|
||||||
wxString fieldName = libField.GetCanonicalName();
|
wxString fieldName = libField.GetCanonicalName();
|
||||||
SCH_FIELD newField( wxPoint( 0, 0), GetFieldCount(), this, fieldName );
|
SCH_FIELD newField( wxPoint( 0, 0), GetFieldCount(), this, fieldName,
|
||||||
|
GetField( REFERENCE )->GetTextMarkupFlags() );
|
||||||
schField = AddField( newField );
|
schField = AddField( newField );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1821,13 +1823,14 @@ bool SCH_COMPONENT::IsInNetlist() const
|
||||||
|
|
||||||
void SCH_COMPONENT::Plot( PLOTTER* aPlotter )
|
void SCH_COMPONENT::Plot( PLOTTER* aPlotter )
|
||||||
{
|
{
|
||||||
TRANSFORM temp;
|
|
||||||
|
|
||||||
if( m_part )
|
if( m_part )
|
||||||
{
|
{
|
||||||
temp = GetTransform();
|
TRANSFORM temp = GetTransform();
|
||||||
aPlotter->StartBlock( nullptr );
|
aPlotter->StartBlock( nullptr );
|
||||||
|
|
||||||
|
// A cheater since we don't want to modify the various LIB_ITEMs' m_textMarkupFlags
|
||||||
|
aPlotter->SetTextMarkupFlags( m_Fields[0].GetTextMarkupFlags() );
|
||||||
|
|
||||||
m_part->Plot( aPlotter, GetUnit(), GetConvert(), m_Pos, temp );
|
m_part->Plot( aPlotter, GetUnit(), GetConvert(), m_Pos, temp );
|
||||||
|
|
||||||
for( SCH_FIELD field : m_Fields )
|
for( SCH_FIELD field : m_Fields )
|
||||||
|
|
|
@ -474,7 +474,7 @@ public:
|
||||||
* @param aOffset is the drawing offset (usually wxPoint(0,0),
|
* @param aOffset is the drawing offset (usually wxPoint(0,0),
|
||||||
* but can be different when moving an object)
|
* but can be different when moving an object)
|
||||||
*/
|
*/
|
||||||
void Print( wxDC* aDC, const wxPoint& aOffset ) override;
|
void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
|
||||||
|
|
||||||
void SwapData( SCH_ITEM* aItem ) override;
|
void SwapData( SCH_ITEM* aItem ) override;
|
||||||
|
|
||||||
|
|
|
@ -1839,7 +1839,7 @@ void SCH_EAGLE_PLUGIN::loadTextAttributes( EDA_TEXT* aText, const ETEXT& aAttrib
|
||||||
if( aAttribs.ratio.CGet() > 12 )
|
if( aAttribs.ratio.CGet() > 12 )
|
||||||
{
|
{
|
||||||
aText->SetBold( true );
|
aText->SetBold( true );
|
||||||
aText->SetTextPenWidth( GetPenSizeForBold( aText->GetTextWidth() ) );
|
aText->SetTextThickness( GetPenSizeForBold( aText->GetTextWidth() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -906,13 +906,13 @@ void SCH_EDIT_FRAME::Print()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::PrintPage( wxDC* aDC )
|
void SCH_EDIT_FRAME::PrintPage( RENDER_SETTINGS* aSettings )
|
||||||
{
|
{
|
||||||
wxString fileName = Prj().AbsolutePath( GetScreen()->GetFileName() );
|
wxString fileName = Prj().AbsolutePath( GetScreen()->GetFileName() );
|
||||||
|
|
||||||
aDC->SetLogicalFunction( wxCOPY );
|
aSettings->GetPrintDC()->SetLogicalFunction( wxCOPY );
|
||||||
GetScreen()->Print( aDC );
|
GetScreen()->Print( aSettings );
|
||||||
PrintWorkSheet( aDC, GetScreen(), GetDefaultLineWidth(), IU_PER_MILS, fileName );
|
PrintWorkSheet( aSettings, GetScreen(), IU_PER_MILS, fileName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -950,7 +950,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param aDC = wxDC given by the calling print function
|
* @param aDC = wxDC given by the calling print function
|
||||||
*/
|
*/
|
||||||
virtual void PrintPage( wxDC* aDC ) override;
|
virtual void PrintPage( RENDER_SETTINGS* aSettings ) override;
|
||||||
|
|
||||||
void SetNetListerCommand( const wxString& aCommand ) { m_netListerCommand = aCommand; }
|
void SetNetListerCommand( const wxString& aCommand ) { m_netListerCommand = aCommand; }
|
||||||
|
|
||||||
|
|
|
@ -46,12 +46,12 @@
|
||||||
#include <settings/color_settings.h>
|
#include <settings/color_settings.h>
|
||||||
#include <kicad_string.h>
|
#include <kicad_string.h>
|
||||||
#include <trace_helpers.h>
|
#include <trace_helpers.h>
|
||||||
#include <default_values.h> // For some default values
|
|
||||||
|
|
||||||
|
|
||||||
SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_ITEM* aParent, const wxString& aName ) :
|
SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_ITEM* aParent, const wxString& aName,
|
||||||
|
int aMarkupFlags ) :
|
||||||
SCH_ITEM( aParent, SCH_FIELD_T ),
|
SCH_ITEM( aParent, SCH_FIELD_T ),
|
||||||
EDA_TEXT()
|
EDA_TEXT( wxEmptyString, aMarkupFlags )
|
||||||
{
|
{
|
||||||
SetTextPos( aPos );
|
SetTextPos( aPos );
|
||||||
m_id = aFieldId;
|
m_id = aFieldId;
|
||||||
|
@ -130,25 +130,19 @@ wxString SCH_FIELD::GetShownText( int aDepth ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int SCH_FIELD::GetPenSize() const
|
int SCH_FIELD::GetPenWidth() const
|
||||||
{
|
{
|
||||||
#if 1
|
return GetEffectiveTextPenWidth();
|
||||||
// Temporary code not using RENDER_SETTINGS
|
|
||||||
int textThickness = DEFAULT_LINE_THICKNESS * IU_PER_MILS;
|
|
||||||
textThickness = Clamp_Text_PenSize( textThickness, GetTextSize(), IsBold() );
|
|
||||||
return textThickness;
|
|
||||||
#else
|
|
||||||
return GetEffectiveTextPenWidth( nullptr ); // JEY TODO: requires RENDER_SETTINGS
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_FIELD::Print( wxDC* aDC, const wxPoint& aOffset )
|
void SCH_FIELD::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
|
||||||
{
|
{
|
||||||
|
wxDC* DC = aSettings->GetPrintDC();
|
||||||
|
COLOR4D color = aSettings->GetLayerColor( m_forceVisible ? LAYER_HIDDEN : m_Layer );
|
||||||
int orient;
|
int orient;
|
||||||
COLOR4D color;
|
|
||||||
wxPoint textpos;
|
wxPoint textpos;
|
||||||
int lineWidth = GetPenSize();
|
int penWidth = std::max( GetEffectiveTextPenWidth(), aSettings->GetDefaultPenWidth() );
|
||||||
|
|
||||||
if( ( !IsVisible() && !m_forceVisible) || IsVoid() )
|
if( ( !IsVisible() && !m_forceVisible) || IsVoid() )
|
||||||
return;
|
return;
|
||||||
|
@ -183,13 +177,8 @@ void SCH_FIELD::Print( wxDC* aDC, const wxPoint& aOffset )
|
||||||
EDA_RECT boundaryBox = GetBoundingBox();
|
EDA_RECT boundaryBox = GetBoundingBox();
|
||||||
textpos = boundaryBox.Centre() + aOffset;
|
textpos = boundaryBox.Centre() + aOffset;
|
||||||
|
|
||||||
if( m_forceVisible )
|
GRText( DC, textpos, color, GetShownText(), orient, GetTextSize(), GR_TEXT_HJUSTIFY_CENTER,
|
||||||
color = COLOR4D( DARKGRAY );
|
GR_TEXT_VJUSTIFY_CENTER, penWidth, IsItalic(), IsBold(), m_textMarkupFlags );
|
||||||
else
|
|
||||||
color = GetLayerColor( m_Layer );
|
|
||||||
|
|
||||||
GRText( aDC, textpos, color, GetShownText(), orient, GetTextSize(),
|
|
||||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, lineWidth, IsItalic(), IsBold() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -219,7 +208,7 @@ const EDA_RECT SCH_FIELD::GetBoundingBox() const
|
||||||
SCH_FIELD text( *this ); // Make a local copy to change text
|
SCH_FIELD text( *this ); // Make a local copy to change text
|
||||||
// because GetBoundingBox() is const
|
// because GetBoundingBox() is const
|
||||||
text.SetText( GetShownText() );
|
text.SetText( GetShownText() );
|
||||||
rect = text.GetTextBox( nullptr ); // JEY TODO: requires RENDER_SETTINGS
|
rect = text.GetTextBox();
|
||||||
|
|
||||||
// Calculate the bounding box position relative to the parent:
|
// Calculate the bounding box position relative to the parent:
|
||||||
wxPoint origin = GetParentPosition();
|
wxPoint origin = GetParentPosition();
|
||||||
|
@ -498,7 +487,9 @@ bool SCH_FIELD::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
|
||||||
|
|
||||||
void SCH_FIELD::Plot( PLOTTER* aPlotter )
|
void SCH_FIELD::Plot( PLOTTER* aPlotter )
|
||||||
{
|
{
|
||||||
COLOR4D color = aPlotter->ColorSettings()->GetColor( GetLayer() );
|
COLOR4D color = aPlotter->RenderSettings()->GetLayerColor( GetLayer() );
|
||||||
|
int penWidth = std::max( GetEffectiveTextPenWidth(),
|
||||||
|
aPlotter->RenderSettings()->GetDefaultPenWidth() );
|
||||||
|
|
||||||
if( !IsVisible() )
|
if( !IsVisible() )
|
||||||
return;
|
return;
|
||||||
|
@ -538,10 +529,8 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter )
|
||||||
EDA_TEXT_VJUSTIFY_T vjustify = GR_TEXT_VJUSTIFY_CENTER;
|
EDA_TEXT_VJUSTIFY_T vjustify = GR_TEXT_VJUSTIFY_CENTER;
|
||||||
wxPoint textpos = BoundaryBox.Centre();
|
wxPoint textpos = BoundaryBox.Centre();
|
||||||
|
|
||||||
int thickness = GetPenSize();
|
|
||||||
|
|
||||||
aPlotter->Text( textpos, color, GetShownText(), orient, GetTextSize(), hjustify, vjustify,
|
aPlotter->Text( textpos, color, GetShownText(), orient, GetTextSize(), hjustify, vjustify,
|
||||||
thickness, IsItalic(), IsBold() );
|
penWidth, IsItalic(), IsBold(), m_textMarkupFlags );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ class SCH_FIELD : public SCH_ITEM, public EDA_TEXT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_ITEM* aParent,
|
SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_ITEM* aParent,
|
||||||
const wxString& aName = wxEmptyString );
|
const wxString& aName = wxEmptyString, int aMarkupFlags = 0 );
|
||||||
|
|
||||||
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
// Do not create a copy constructor. The one generated by the compiler is adequate.
|
||||||
|
|
||||||
|
@ -142,9 +142,9 @@ public:
|
||||||
*/
|
*/
|
||||||
void ImportValues( const LIB_FIELD& aSource );
|
void ImportValues( const LIB_FIELD& aSource );
|
||||||
|
|
||||||
int GetPenSize() const override;
|
int GetPenWidth() const override;
|
||||||
|
|
||||||
void Print( wxDC* aDC, const wxPoint& aOffset ) override;
|
void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
|
||||||
|
|
||||||
void Move( const wxPoint& aMoveVector ) override
|
void Move( const wxPoint& aMoveVector ) override
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include <base_struct.h>
|
#include <base_struct.h>
|
||||||
#include <general.h>
|
#include <general.h>
|
||||||
#include <sch_sheet_path.h>
|
#include <sch_sheet_path.h>
|
||||||
|
#include <render_settings.h>
|
||||||
|
|
||||||
class SCH_CONNECTION;
|
class SCH_CONNECTION;
|
||||||
class SCH_SHEET_PATH;
|
class SCH_SHEET_PATH;
|
||||||
|
@ -42,6 +43,8 @@ class PLOTTER;
|
||||||
class NETLIST_OBJECT;
|
class NETLIST_OBJECT;
|
||||||
class NETLIST_OBJECT_LIST;
|
class NETLIST_OBJECT_LIST;
|
||||||
|
|
||||||
|
using KIGFX::RENDER_SETTINGS;
|
||||||
|
|
||||||
|
|
||||||
enum FIELDS_AUTOPLACED
|
enum FIELDS_AUTOPLACED
|
||||||
{
|
{
|
||||||
|
@ -240,16 +243,14 @@ public:
|
||||||
* Function GetPenSize virtual pure
|
* Function GetPenSize virtual pure
|
||||||
* @return the size of the "pen" that be used to draw or plot this item
|
* @return the size of the "pen" that be used to draw or plot this item
|
||||||
*/
|
*/
|
||||||
virtual int GetPenSize() const { return 0; }
|
virtual int GetPenWidth() const { return 0; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Print
|
* Function Print
|
||||||
* Print a schematic item. Each schematic item should have its own method
|
* Print a schematic item. Each schematic item should have its own method
|
||||||
* @param aDC Device Context (can be null)
|
* @param aOffset drawing offset (usually {0,0} but can be different when moving an object)
|
||||||
* @param aOffset drawing Offset (usually wxPoint(0,0),
|
|
||||||
* but can be different when moving an object)
|
|
||||||
*/
|
*/
|
||||||
virtual void Print( wxDC* aDC, const wxPoint& aOffset ) = 0;
|
virtual void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Move
|
* Function Move
|
||||||
|
|
|
@ -87,18 +87,20 @@ const EDA_RECT SCH_JUNCTION::GetBoundingBox() const
|
||||||
EDA_RECT rect;
|
EDA_RECT rect;
|
||||||
|
|
||||||
rect.SetOrigin( m_pos );
|
rect.SetOrigin( m_pos );
|
||||||
rect.Inflate( ( GetPenSize() + GetSymbolSize() ) / 2 );
|
rect.Inflate( ( GetPenWidth() + GetSymbolSize() ) / 2 );
|
||||||
|
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_JUNCTION::Print( wxDC* aDC, const wxPoint& aOffset )
|
void SCH_JUNCTION::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
|
||||||
{
|
{
|
||||||
auto conn = Connection( *g_CurrentSheet );
|
wxDC* DC = aSettings->GetPrintDC();
|
||||||
COLOR4D color = GetLayerColor( ( conn && conn->IsBus() ) ? LAYER_BUS : m_Layer );
|
SCH_CONNECTION* conn = Connection( *g_CurrentSheet );
|
||||||
|
bool isBus = conn && conn->IsBus();
|
||||||
|
COLOR4D color = aSettings->GetLayerColor( isBus ? LAYER_BUS : m_Layer );
|
||||||
|
|
||||||
GRFilledCircle( nullptr, aDC, m_pos.x + aOffset.x, m_pos.y + aOffset.y, GetSymbolSize() / 2,
|
GRFilledCircle( nullptr, DC, m_pos.x + aOffset.x, m_pos.y + aOffset.y, GetSymbolSize() / 2,
|
||||||
0, color, color );
|
0, color, color );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +196,7 @@ bool SCH_JUNCTION::doIsConnected( const wxPoint& aPosition ) const
|
||||||
|
|
||||||
void SCH_JUNCTION::Plot( PLOTTER* aPlotter )
|
void SCH_JUNCTION::Plot( PLOTTER* aPlotter )
|
||||||
{
|
{
|
||||||
aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( GetLayer() ) );
|
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( GetLayer() ) );
|
||||||
aPlotter->Circle( m_pos, GetSymbolSize(), FILLED_SHAPE );
|
aPlotter->Circle( m_pos, GetSymbolSize(), FILLED_SHAPE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ public:
|
||||||
|
|
||||||
const EDA_RECT GetBoundingBox() const override;
|
const EDA_RECT GetBoundingBox() const override;
|
||||||
|
|
||||||
void Print( wxDC* aDC, const wxPoint& aOffset ) override;
|
void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
|
||||||
|
|
||||||
void Move( const wxPoint& aMoveVector ) override
|
void Move( const wxPoint& aMoveVector ) override
|
||||||
{
|
{
|
||||||
|
|
|
@ -1449,7 +1449,7 @@ SCH_TEXT* SCH_LEGACY_PLUGIN::loadText( LINE_READER& aReader )
|
||||||
}
|
}
|
||||||
|
|
||||||
text->SetBold( penWidth != 0 );
|
text->SetBold( penWidth != 0 );
|
||||||
text->SetTextPenWidth( penWidth != 0 ? GetPenSizeForBold( size ) : 0 );
|
text->SetTextThickness( penWidth != 0 ? GetPenSizeForBold( size ) : 0 );
|
||||||
|
|
||||||
// Read the text string for the text.
|
// Read the text string for the text.
|
||||||
char* tmp = aReader.ReadLine();
|
char* tmp = aReader.ReadLine();
|
||||||
|
@ -2283,7 +2283,7 @@ void SCH_LEGACY_PLUGIN::saveLine( SCH_LINE* aLine )
|
||||||
// Write line style (width, type, color) only for non default values
|
// Write line style (width, type, color) only for non default values
|
||||||
if( aLine->IsGraphicLine() )
|
if( aLine->IsGraphicLine() )
|
||||||
{
|
{
|
||||||
if( aLine->GetPenSize() != 0 )
|
if( aLine->GetLineSize() != 0 )
|
||||||
m_out->Print( 0, " %s %d", T_WIDTH, Iu2Mils( aLine->GetLineSize() ) );
|
m_out->Print( 0, " %s %d", T_WIDTH, Iu2Mils( aLine->GetLineSize() ) );
|
||||||
|
|
||||||
if( aLine->GetLineStyle() != aLine->GetDefaultStyle() )
|
if( aLine->GetLineStyle() != aLine->GetDefaultStyle() )
|
||||||
|
@ -2358,7 +2358,7 @@ void SCH_LEGACY_PLUGIN::saveText( SCH_TEXT* aText )
|
||||||
Iu2Mils( aText->GetPosition().x ), Iu2Mils( aText->GetPosition().y ),
|
Iu2Mils( aText->GetPosition().x ), Iu2Mils( aText->GetPosition().y ),
|
||||||
spinStyle,
|
spinStyle,
|
||||||
Iu2Mils( aText->GetTextWidth() ),
|
Iu2Mils( aText->GetTextWidth() ),
|
||||||
italics, Iu2Mils( aText->GetTextPenWidth() ), TO_UTF8( text ) );
|
italics, Iu2Mils( aText->GetTextThickness() ), TO_UTF8( text ) );
|
||||||
}
|
}
|
||||||
else if( layer == LAYER_GLOBLABEL || layer == LAYER_HIERLABEL )
|
else if( layer == LAYER_GLOBLABEL || layer == LAYER_HIERLABEL )
|
||||||
{
|
{
|
||||||
|
@ -2373,7 +2373,7 @@ void SCH_LEGACY_PLUGIN::saveText( SCH_TEXT* aText )
|
||||||
Iu2Mils( aText->GetTextWidth() ),
|
Iu2Mils( aText->GetTextWidth() ),
|
||||||
shapeLabelIt->second,
|
shapeLabelIt->second,
|
||||||
italics,
|
italics,
|
||||||
Iu2Mils( aText->GetTextPenWidth() ), TO_UTF8( text ) );
|
Iu2Mils( aText->GetTextThickness() ), TO_UTF8( text ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
#include <settings/color_settings.h>
|
#include <settings/color_settings.h>
|
||||||
#include <netlist_object.h>
|
#include <netlist_object.h>
|
||||||
#include <sch_view.h>
|
#include <sch_view.h>
|
||||||
#include <default_values.h> // For some default values
|
|
||||||
|
|
||||||
|
|
||||||
static wxPenStyle getwxPenStyle( PLOT_DASH_TYPE aType )
|
static wxPenStyle getwxPenStyle( PLOT_DASH_TYPE aType )
|
||||||
|
@ -290,35 +289,24 @@ void SCH_LINE::SetLineWidth( const int aSize )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int SCH_LINE::GetPenSize() const
|
int SCH_LINE::GetPenWidth() const
|
||||||
{
|
{
|
||||||
if( m_size )
|
return std::max( m_size, 1 );
|
||||||
return m_size;
|
|
||||||
|
|
||||||
#if 1
|
|
||||||
// Temporary code not using RENDER_SETTINGS
|
|
||||||
int thickness = DEFAULT_LINE_THICKNESS * IU_PER_MILS;
|
|
||||||
|
|
||||||
if( GetLayer() == LAYER_BUS )
|
|
||||||
thickness = DEFAULT_BUS_THICKNESS * IU_PER_MILS;
|
|
||||||
else if( GetLayer() == LAYER_WIRE )
|
|
||||||
thickness = DEFAULT_WIRE_THICKNESS * IU_PER_MILS;
|
|
||||||
|
|
||||||
return thickness;
|
|
||||||
#else
|
|
||||||
// JEY TODO: requires RENDER_SETTINGS
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_LINE::Print( wxDC* DC, const wxPoint& offset )
|
void SCH_LINE::Print( RENDER_SETTINGS* aSettings, const wxPoint& offset )
|
||||||
{
|
{
|
||||||
COLOR4D color = ( m_color != COLOR4D::UNSPECIFIED ) ? m_color : GetLayerColor( m_Layer );
|
wxDC* DC = aSettings->GetPrintDC();
|
||||||
int width = GetPenSize();
|
COLOR4D color = m_color;
|
||||||
wxPoint start = m_start;
|
wxPoint start = m_start;
|
||||||
wxPoint end = m_end;
|
wxPoint end = m_end;
|
||||||
|
int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
|
||||||
|
|
||||||
GRLine( nullptr, DC, start.x, start.y, end.x, end.y, width, color,
|
if( color == COLOR4D::UNSPECIFIED )
|
||||||
|
color = aSettings->GetLayerColor( m_Layer );
|
||||||
|
|
||||||
|
GRLine( nullptr, DC, start.x, start.y, end.x, end.y, penWidth, color,
|
||||||
getwxPenStyle( (PLOT_DASH_TYPE) GetLineStyle() ) );
|
getwxPenStyle( (PLOT_DASH_TYPE) GetLineStyle() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -705,7 +693,7 @@ bool SCH_LINE::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
||||||
|
|
||||||
// Insure minimum accuracy
|
// Insure minimum accuracy
|
||||||
if( aAccuracy == 0 )
|
if( aAccuracy == 0 )
|
||||||
aAccuracy = ( GetPenSize() / 2 ) + 4;
|
aAccuracy = ( GetPenWidth() / 2 ) + 4;
|
||||||
|
|
||||||
return TestSegmentHit( aPosition, m_start, m_end, aAccuracy );
|
return TestSegmentHit( aPosition, m_start, m_end, aAccuracy );
|
||||||
}
|
}
|
||||||
|
@ -758,10 +746,11 @@ void SCH_LINE::Plot( PLOTTER* aPlotter )
|
||||||
if( m_color != COLOR4D::UNSPECIFIED )
|
if( m_color != COLOR4D::UNSPECIFIED )
|
||||||
aPlotter->SetColor( m_color );
|
aPlotter->SetColor( m_color );
|
||||||
else
|
else
|
||||||
aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( GetLayer() ) );
|
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( GetLayer() ) );
|
||||||
|
|
||||||
aPlotter->SetCurrentLineWidth( GetPenSize() );
|
int penWidth = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetDefaultPenWidth() );
|
||||||
|
|
||||||
|
aPlotter->SetCurrentLineWidth( penWidth );
|
||||||
aPlotter->SetDash( GetLineStyle() );
|
aPlotter->SetDash( GetLineStyle() );
|
||||||
|
|
||||||
aPlotter->MoveTo( m_start );
|
aPlotter->MoveTo( m_start );
|
||||||
|
|
|
@ -143,9 +143,9 @@ public:
|
||||||
*/
|
*/
|
||||||
double GetLength() const;
|
double GetLength() const;
|
||||||
|
|
||||||
void Print( wxDC* aDC, const wxPoint& aOffset ) override;
|
void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
|
||||||
|
|
||||||
int GetPenSize() const override;
|
int GetPenWidth() const override;
|
||||||
|
|
||||||
void Move( const wxPoint& aMoveVector ) override;
|
void Move( const wxPoint& aMoveVector ) override;
|
||||||
void MoveStart( const wxPoint& aMoveVector );
|
void MoveStart( const wxPoint& aMoveVector );
|
||||||
|
|
|
@ -105,9 +105,9 @@ KIGFX::COLOR4D SCH_MARKER::getColor() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_MARKER::Print( wxDC* aDC, const wxPoint& aOffset )
|
void SCH_MARKER::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
|
||||||
{
|
{
|
||||||
PrintMarker( aDC, aOffset );
|
PrintMarker( aSettings, aOffset );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ public:
|
||||||
|
|
||||||
SCH_LAYER_ID GetColorLayer() const;
|
SCH_LAYER_ID GetColorLayer() const;
|
||||||
|
|
||||||
void Print( wxDC* aDC, const wxPoint& aOffset ) override;
|
void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
|
||||||
|
|
||||||
void Plot( PLOTTER* aPlotter ) override
|
void Plot( PLOTTER* aPlotter ) override
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,7 +70,7 @@ void SCH_NO_CONNECT::SwapData( SCH_ITEM* aItem )
|
||||||
|
|
||||||
const EDA_RECT SCH_NO_CONNECT::GetBoundingBox() const
|
const EDA_RECT SCH_NO_CONNECT::GetBoundingBox() const
|
||||||
{
|
{
|
||||||
int delta = ( GetPenSize() + GetSize() ) / 2;
|
int delta = ( GetPenWidth() + GetSize() ) / 2;
|
||||||
EDA_RECT box;
|
EDA_RECT box;
|
||||||
|
|
||||||
box.SetOrigin( m_pos );
|
box.SetOrigin( m_pos );
|
||||||
|
@ -95,29 +95,23 @@ void SCH_NO_CONNECT::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int SCH_NO_CONNECT::GetPenSize() const
|
int SCH_NO_CONNECT::GetPenWidth() const
|
||||||
{
|
{
|
||||||
#if 1
|
return 1;
|
||||||
// Temporary code not using RENDER_SETTINGS
|
|
||||||
int thickness = DEFAULT_LINE_THICKNESS * IU_PER_MILS;
|
|
||||||
return thickness;
|
|
||||||
#else
|
|
||||||
// JEY TODO: requires RENDER_SETTINGS
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_NO_CONNECT::Print( wxDC* aDC, const wxPoint& aOffset )
|
void SCH_NO_CONNECT::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
|
||||||
{
|
{
|
||||||
int half = GetSize() / 2;
|
wxDC* DC = aSettings->GetPrintDC();
|
||||||
int width = GetPenSize();
|
int half = GetSize() / 2;
|
||||||
int pX = m_pos.x + aOffset.x;
|
int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
|
||||||
int pY = m_pos.y + aOffset.y;
|
int pX = m_pos.x + aOffset.x;
|
||||||
|
int pY = m_pos.y + aOffset.y;
|
||||||
|
COLOR4D color = aSettings->GetLayerColor( LAYER_NOCONNECT );
|
||||||
|
|
||||||
COLOR4D color = GetLayerColor( LAYER_NOCONNECT );
|
GRLine( nullptr, DC, pX - half, pY - half, pX + half, pY + half, penWidth, color );
|
||||||
|
GRLine( nullptr, DC, pX + half, pY - half, pX - half, pY + half, penWidth, color );
|
||||||
GRLine( nullptr, aDC, pX - half, pY - half, pX + half, pY + half, width, color );
|
|
||||||
GRLine( nullptr, aDC, pX + half, pY - half, pX - half, pY + half, width, color );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -167,7 +161,7 @@ bool SCH_NO_CONNECT::doIsConnected( const wxPoint& aPosition ) const
|
||||||
|
|
||||||
bool SCH_NO_CONNECT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
bool SCH_NO_CONNECT::HitTest( const wxPoint& aPosition, int aAccuracy ) const
|
||||||
{
|
{
|
||||||
int delta = ( GetPenSize() + GetSize() ) / 2 + aAccuracy;
|
int delta = ( GetPenWidth() + GetSize() ) / 2 + aAccuracy;
|
||||||
|
|
||||||
wxPoint dist = aPosition - m_pos;
|
wxPoint dist = aPosition - m_pos;
|
||||||
|
|
||||||
|
@ -194,13 +188,12 @@ bool SCH_NO_CONNECT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccur
|
||||||
void SCH_NO_CONNECT::Plot( PLOTTER* aPlotter )
|
void SCH_NO_CONNECT::Plot( PLOTTER* aPlotter )
|
||||||
{
|
{
|
||||||
int delta = GetSize() / 2;
|
int delta = GetSize() / 2;
|
||||||
int pX, pY;
|
int pX = m_pos.x;
|
||||||
|
int pY = m_pos.y;
|
||||||
|
int penWidth = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetDefaultPenWidth() );
|
||||||
|
|
||||||
pX = m_pos.x;
|
aPlotter->SetCurrentLineWidth( penWidth );
|
||||||
pY = m_pos.y;
|
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( LAYER_NOCONNECT ) );
|
||||||
|
|
||||||
aPlotter->SetCurrentLineWidth( GetPenSize() );
|
|
||||||
aPlotter->SetColor( aPlotter->ColorSettings()->GetColor( LAYER_NOCONNECT ) );
|
|
||||||
aPlotter->MoveTo( wxPoint( pX - delta, pY - delta ) );
|
aPlotter->MoveTo( wxPoint( pX - delta, pY - delta ) );
|
||||||
aPlotter->FinishTo( wxPoint( pX + delta, pY + delta ) );
|
aPlotter->FinishTo( wxPoint( pX + delta, pY + delta ) );
|
||||||
aPlotter->MoveTo( wxPoint( pX + delta, pY - delta ) );
|
aPlotter->MoveTo( wxPoint( pX + delta, pY - delta ) );
|
||||||
|
|
|
@ -63,13 +63,13 @@ public:
|
||||||
return m_size;
|
return m_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int GetPenSize() const override;
|
int GetPenWidth() const override;
|
||||||
|
|
||||||
void SwapData( SCH_ITEM* aItem ) override;
|
void SwapData( SCH_ITEM* aItem ) override;
|
||||||
|
|
||||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||||
|
|
||||||
void Print( wxDC* aDC, const wxPoint& aOffset ) override;
|
void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
|
||||||
|
|
||||||
void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override;
|
void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override;
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,6 @@
|
||||||
#include <view/view.h>
|
#include <view/view.h>
|
||||||
#include <kiface_i.h>
|
#include <kiface_i.h>
|
||||||
#include <default_values.h>
|
#include <default_values.h>
|
||||||
|
|
||||||
#include "sch_painter.h"
|
#include "sch_painter.h"
|
||||||
|
|
||||||
namespace KIGFX
|
namespace KIGFX
|
||||||
|
@ -76,12 +75,9 @@ SCH_RENDER_SETTINGS::SCH_RENDER_SETTINGS() :
|
||||||
m_ShowDisabled( false ),
|
m_ShowDisabled( false ),
|
||||||
m_ShowUmbilicals( true ),
|
m_ShowUmbilicals( true ),
|
||||||
m_OverrideItemColors( false ),
|
m_OverrideItemColors( false ),
|
||||||
m_DefaultLineWidth( DEFAULT_LINE_THICKNESS * IU_PER_MILS ),
|
|
||||||
m_DefaultWireThickness( DEFAULT_WIRE_THICKNESS * IU_PER_MILS ),
|
m_DefaultWireThickness( DEFAULT_WIRE_THICKNESS * IU_PER_MILS ),
|
||||||
m_DefaultBusThickness( DEFAULT_BUS_THICKNESS * IU_PER_MILS )
|
m_DefaultBusThickness( DEFAULT_BUS_THICKNESS * IU_PER_MILS )
|
||||||
{
|
{ }
|
||||||
m_defaultPenWidth = m_DefaultLineWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void SCH_RENDER_SETTINGS::LoadColors( const COLOR_SETTINGS* aSettings )
|
void SCH_RENDER_SETTINGS::LoadColors( const COLOR_SETTINGS* aSettings )
|
||||||
|
@ -178,7 +174,7 @@ bool SCH_PAINTER::Draw( const VIEW_ITEM *aItem, int aLayer )
|
||||||
m_gal->SetStrokeColor( COLOR4D( LIGHTRED ) );
|
m_gal->SetStrokeColor( COLOR4D( LIGHTRED ) );
|
||||||
m_gal->SetLineWidth( Mils2ui( 2 ) );
|
m_gal->SetLineWidth( Mils2ui( 2 ) );
|
||||||
m_gal->SetGlyphSize( VECTOR2D( Mils2ui( 20 ), Mils2ui( 20 ) ) );
|
m_gal->SetGlyphSize( VECTOR2D( Mils2ui( 20 ), Mils2ui( 20 ) ) );
|
||||||
m_gal->StrokeText( conn->Name( true ), pos, 0.0 );
|
m_gal->StrokeText( conn->Name( true ), pos, 0.0, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -299,10 +295,7 @@ COLOR4D SCH_PAINTER::getRenderColor( const EDA_ITEM* aItem, int aLayer, bool aDr
|
||||||
|
|
||||||
float SCH_PAINTER::getLineWidth( const LIB_ITEM* aItem, bool aDrawingShadows )
|
float SCH_PAINTER::getLineWidth( const LIB_ITEM* aItem, bool aDrawingShadows )
|
||||||
{
|
{
|
||||||
float width = (float) aItem->GetPenSize();
|
float width = (float) std::max( aItem->GetPenWidth(), m_schSettings.GetDefaultPenWidth() );
|
||||||
|
|
||||||
if( width == 0 )
|
|
||||||
width = (float) m_schSettings.m_DefaultLineWidth;
|
|
||||||
|
|
||||||
if( aItem->IsSelected() && aDrawingShadows )
|
if( aItem->IsSelected() && aDrawingShadows )
|
||||||
width += getShadowWidth();
|
width += getShadowWidth();
|
||||||
|
@ -313,17 +306,14 @@ float SCH_PAINTER::getLineWidth( const LIB_ITEM* aItem, bool aDrawingShadows )
|
||||||
|
|
||||||
float SCH_PAINTER::getLineWidth( const SCH_ITEM* aItem, bool aDrawingShadows )
|
float SCH_PAINTER::getLineWidth( const SCH_ITEM* aItem, bool aDrawingShadows )
|
||||||
{
|
{
|
||||||
float width = (float) aItem->GetPenSize();
|
float width;
|
||||||
|
|
||||||
if( width == 0 )
|
if( aItem->GetLayer() == LAYER_WIRE )
|
||||||
{
|
width = (float) m_schSettings.m_DefaultWireThickness;
|
||||||
if( aItem->GetLayer() == LAYER_WIRE )
|
else if( aItem->GetLayer() == LAYER_BUS )
|
||||||
width = (float) m_schSettings.m_DefaultWireThickness;
|
width = (float) m_schSettings.m_DefaultBusThickness;
|
||||||
else if( aItem->GetLayer() == LAYER_BUS )
|
else
|
||||||
width = (float) m_schSettings.m_DefaultBusThickness;
|
width = (float) std::max( aItem->GetPenWidth(), m_schSettings.GetDefaultPenWidth() );
|
||||||
else
|
|
||||||
width = (float) m_schSettings.m_DefaultLineWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( aItem->IsSelected() && aDrawingShadows )
|
if( aItem->IsSelected() && aDrawingShadows )
|
||||||
width += getShadowWidth();
|
width += getShadowWidth();
|
||||||
|
@ -334,7 +324,8 @@ float SCH_PAINTER::getLineWidth( const SCH_ITEM* aItem, bool aDrawingShadows )
|
||||||
|
|
||||||
float SCH_PAINTER::getTextThickness( const SCH_TEXT* aItem, bool aDrawingShadows )
|
float SCH_PAINTER::getTextThickness( const SCH_TEXT* aItem, bool aDrawingShadows )
|
||||||
{
|
{
|
||||||
float width = (float) aItem->GetEffectiveTextPenWidth( &m_schSettings );
|
float width = (float) std::max( aItem->GetEffectiveTextPenWidth(),
|
||||||
|
m_schSettings.GetDefaultPenWidth() );
|
||||||
|
|
||||||
if( aItem->IsSelected() && aDrawingShadows )
|
if( aItem->IsSelected() && aDrawingShadows )
|
||||||
width += getShadowWidth();
|
width += getShadowWidth();
|
||||||
|
@ -345,7 +336,8 @@ float SCH_PAINTER::getTextThickness( const SCH_TEXT* aItem, bool aDrawingShadows
|
||||||
|
|
||||||
float SCH_PAINTER::getTextThickness( const SCH_FIELD* aItem, bool aDrawingShadows )
|
float SCH_PAINTER::getTextThickness( const SCH_FIELD* aItem, bool aDrawingShadows )
|
||||||
{
|
{
|
||||||
float width = (float) aItem->GetEffectiveTextPenWidth( &m_schSettings );
|
float width = (float) std::max( aItem->GetEffectiveTextPenWidth(),
|
||||||
|
m_schSettings.GetDefaultPenWidth() );
|
||||||
|
|
||||||
if( aItem->IsSelected() && aDrawingShadows )
|
if( aItem->IsSelected() && aDrawingShadows )
|
||||||
width += getShadowWidth();
|
width += getShadowWidth();
|
||||||
|
@ -356,7 +348,8 @@ float SCH_PAINTER::getTextThickness( const SCH_FIELD* aItem, bool aDrawingShadow
|
||||||
|
|
||||||
float SCH_PAINTER::getTextThickness( const LIB_FIELD* aItem, bool aDrawingShadows )
|
float SCH_PAINTER::getTextThickness( const LIB_FIELD* aItem, bool aDrawingShadows )
|
||||||
{
|
{
|
||||||
float width = (float) aItem->GetEffectiveTextPenWidth( &m_schSettings );
|
float width = (float) std::max( aItem->GetEffectiveTextPenWidth(),
|
||||||
|
m_schSettings.GetDefaultPenWidth() );
|
||||||
|
|
||||||
if( aItem->IsSelected() && aDrawingShadows )
|
if( aItem->IsSelected() && aDrawingShadows )
|
||||||
width += getShadowWidth();
|
width += getShadowWidth();
|
||||||
|
@ -367,7 +360,8 @@ float SCH_PAINTER::getTextThickness( const LIB_FIELD* aItem, bool aDrawingShadow
|
||||||
|
|
||||||
float SCH_PAINTER::getTextThickness( const LIB_TEXT* aItem, bool aDrawingShadows )
|
float SCH_PAINTER::getTextThickness( const LIB_TEXT* aItem, bool aDrawingShadows )
|
||||||
{
|
{
|
||||||
float width = (float) aItem->GetEffectiveTextPenWidth( &m_schSettings );
|
float width = (float) std::max( aItem->GetEffectiveTextPenWidth(),
|
||||||
|
m_schSettings.GetDefaultPenWidth() );
|
||||||
|
|
||||||
if( aItem->IsSelected() && aDrawingShadows )
|
if( aItem->IsSelected() && aDrawingShadows )
|
||||||
width += getShadowWidth();
|
width += getShadowWidth();
|
||||||
|
@ -376,9 +370,10 @@ float SCH_PAINTER::getTextThickness( const LIB_TEXT* aItem, bool aDrawingShadows
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_PAINTER::strokeText( const wxString& aText, const VECTOR2D& aPosition, double aAngle )
|
void SCH_PAINTER::strokeText( const wxString& aText, const VECTOR2D& aPosition, double aAngle,
|
||||||
|
int aTextMarkupFlags )
|
||||||
{
|
{
|
||||||
m_gal->StrokeText( aText, aPosition, aAngle, GetTextMarkupFlags() );
|
m_gal->StrokeText( aText, aPosition, aAngle, aTextMarkupFlags );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -637,7 +632,7 @@ void SCH_PAINTER::draw( LIB_FIELD *aField, int aLayer )
|
||||||
|
|
||||||
double orient = aField->GetTextAngleRadians();
|
double orient = aField->GetTextAngleRadians();
|
||||||
|
|
||||||
strokeText( aField->GetText(), pos, orient );
|
strokeText( aField->GetText(), pos, orient, aField->GetTextMarkupFlags() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the umbilical line
|
// Draw the umbilical line
|
||||||
|
@ -684,7 +679,7 @@ void SCH_PAINTER::draw( LIB_TEXT *aText, int aLayer )
|
||||||
m_gal->SetGlyphSize( VECTOR2D( aText->GetTextSize() ) );
|
m_gal->SetGlyphSize( VECTOR2D( aText->GetTextSize() ) );
|
||||||
m_gal->SetFontBold( aText->IsBold() );
|
m_gal->SetFontBold( aText->IsBold() );
|
||||||
m_gal->SetFontItalic( aText->IsItalic() );
|
m_gal->SetFontItalic( aText->IsItalic() );
|
||||||
strokeText( aText->GetText(), pos, orient );
|
strokeText( aText->GetText(), pos, orient, aText->GetTextMarkupFlags() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -719,6 +714,7 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
|
bool drawingShadows = aLayer == LAYER_SELECTION_SHADOWS;
|
||||||
|
int flags = aPin->GetTextMarkupFlags();
|
||||||
|
|
||||||
if( drawingShadows && !aPin->IsSelected() )
|
if( drawingShadows && !aPin->IsSelected() )
|
||||||
return;
|
return;
|
||||||
|
@ -966,7 +962,7 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
|
||||||
|
|
||||||
int insideOffset = textOffset;
|
int insideOffset = textOffset;
|
||||||
int outsideOffset = 10;
|
int outsideOffset = 10;
|
||||||
float lineThickness = (float) m_schSettings.m_DefaultLineWidth;
|
float lineThickness = (float) m_schSettings.GetDefaultPenWidth();
|
||||||
float aboveOffset = Mils2iu( PIN_TEXT_MARGIN ) + ( thickness[ABOVE] + lineThickness ) / 2.0;
|
float aboveOffset = Mils2iu( PIN_TEXT_MARGIN ) + ( thickness[ABOVE] + lineThickness ) / 2.0;
|
||||||
float belowOffset = Mils2iu( PIN_TEXT_MARGIN ) + ( thickness[BELOW] + lineThickness ) / 2.0;
|
float belowOffset = Mils2iu( PIN_TEXT_MARGIN ) + ( thickness[BELOW] + lineThickness ) / 2.0;
|
||||||
|
|
||||||
|
@ -992,28 +988,28 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
|
||||||
SET_DC( INSIDE );
|
SET_DC( INSIDE );
|
||||||
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT );
|
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT );
|
||||||
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
|
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
|
||||||
strokeText( text[INSIDE], pos + VECTOR2D( -insideOffset - len, 0 ), 0 );
|
strokeText( text[INSIDE], pos + VECTOR2D( -insideOffset - len, 0 ), 0, flags );
|
||||||
}
|
}
|
||||||
if( size[OUTSIDE] )
|
if( size[OUTSIDE] )
|
||||||
{
|
{
|
||||||
SET_DC( OUTSIDE );
|
SET_DC( OUTSIDE );
|
||||||
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT );
|
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT );
|
||||||
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
|
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
|
||||||
strokeText( text[OUTSIDE], pos + VECTOR2D( outsideOffset, 0 ), 0 );
|
strokeText( text[OUTSIDE], pos + VECTOR2D( outsideOffset, 0 ), 0, flags );
|
||||||
}
|
}
|
||||||
if( size[ABOVE] )
|
if( size[ABOVE] )
|
||||||
{
|
{
|
||||||
SET_DC( ABOVE );
|
SET_DC( ABOVE );
|
||||||
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
|
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
|
||||||
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM );
|
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM );
|
||||||
strokeText( text[ABOVE], pos + VECTOR2D( -len / 2.0, -aboveOffset ), 0 );
|
strokeText( text[ABOVE], pos + VECTOR2D( -len / 2.0, -aboveOffset ), 0, flags );
|
||||||
}
|
}
|
||||||
if( size[BELOW] )
|
if( size[BELOW] )
|
||||||
{
|
{
|
||||||
SET_DC( BELOW );
|
SET_DC( BELOW );
|
||||||
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
|
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
|
||||||
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP );
|
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP );
|
||||||
strokeText( text[BELOW], pos + VECTOR2D( -len / 2.0, belowOffset ), 0 );
|
strokeText( text[BELOW], pos + VECTOR2D( -len / 2.0, belowOffset ), 0, flags );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1024,28 +1020,28 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
|
||||||
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT );
|
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT );
|
||||||
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
|
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
|
||||||
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT );
|
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT );
|
||||||
strokeText( text[INSIDE], pos + VECTOR2D( insideOffset + len, 0 ), 0 );
|
strokeText( text[INSIDE], pos + VECTOR2D( insideOffset + len, 0 ), 0, flags );
|
||||||
}
|
}
|
||||||
if( size[OUTSIDE] )
|
if( size[OUTSIDE] )
|
||||||
{
|
{
|
||||||
SET_DC( OUTSIDE );
|
SET_DC( OUTSIDE );
|
||||||
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT );
|
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT );
|
||||||
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
|
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
|
||||||
strokeText( text[OUTSIDE], pos + VECTOR2D( -outsideOffset, 0 ), 0 );
|
strokeText( text[OUTSIDE], pos + VECTOR2D( -outsideOffset, 0 ), 0, flags );
|
||||||
}
|
}
|
||||||
if( size[ABOVE] )
|
if( size[ABOVE] )
|
||||||
{
|
{
|
||||||
SET_DC( ABOVE );
|
SET_DC( ABOVE );
|
||||||
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
|
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
|
||||||
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM );
|
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM );
|
||||||
strokeText( text[ABOVE], pos + VECTOR2D( len / 2.0, -aboveOffset ), 0 );
|
strokeText( text[ABOVE], pos + VECTOR2D( len / 2.0, -aboveOffset ), 0, flags );
|
||||||
}
|
}
|
||||||
if( size[BELOW] )
|
if( size[BELOW] )
|
||||||
{
|
{
|
||||||
SET_DC( BELOW );
|
SET_DC( BELOW );
|
||||||
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
|
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
|
||||||
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP );
|
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP );
|
||||||
strokeText( text[BELOW], pos + VECTOR2D( len / 2.0, belowOffset ), 0 );
|
strokeText( text[BELOW], pos + VECTOR2D( len / 2.0, belowOffset ), 0, flags );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1055,28 +1051,28 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
|
||||||
SET_DC( INSIDE );
|
SET_DC( INSIDE );
|
||||||
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT );
|
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT );
|
||||||
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
|
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
|
||||||
strokeText( text[INSIDE], pos + VECTOR2D( 0, insideOffset + len ), M_PI / 2 );
|
strokeText( text[INSIDE], pos + VECTOR2D( 0, insideOffset + len ), M_PI / 2, flags );
|
||||||
}
|
}
|
||||||
if( size[OUTSIDE] )
|
if( size[OUTSIDE] )
|
||||||
{
|
{
|
||||||
SET_DC( OUTSIDE );
|
SET_DC( OUTSIDE );
|
||||||
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT );
|
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT );
|
||||||
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
|
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
|
||||||
strokeText( text[OUTSIDE], pos + VECTOR2D( 0, -outsideOffset ), M_PI / 2 );
|
strokeText( text[OUTSIDE], pos + VECTOR2D( 0, -outsideOffset ), M_PI / 2, flags );
|
||||||
}
|
}
|
||||||
if( size[ABOVE] )
|
if( size[ABOVE] )
|
||||||
{
|
{
|
||||||
SET_DC( ABOVE );
|
SET_DC( ABOVE );
|
||||||
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
|
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
|
||||||
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM );
|
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM );
|
||||||
strokeText( text[ABOVE], pos + VECTOR2D( -aboveOffset, len / 2.0 ), M_PI / 2 );
|
strokeText( text[ABOVE], pos + VECTOR2D( -aboveOffset, len / 2.0 ), M_PI / 2, flags );
|
||||||
}
|
}
|
||||||
if( size[BELOW] )
|
if( size[BELOW] )
|
||||||
{
|
{
|
||||||
SET_DC( BELOW );
|
SET_DC( BELOW );
|
||||||
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
|
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
|
||||||
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP );
|
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP );
|
||||||
strokeText( text[BELOW], pos + VECTOR2D( belowOffset, len / 2.0 ), M_PI / 2 );
|
strokeText( text[BELOW], pos + VECTOR2D( belowOffset, len / 2.0 ), M_PI / 2, flags );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1086,28 +1082,28 @@ void SCH_PAINTER::draw( LIB_PIN *aPin, int aLayer )
|
||||||
SET_DC( INSIDE );
|
SET_DC( INSIDE );
|
||||||
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT );
|
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT );
|
||||||
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
|
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
|
||||||
strokeText( text[INSIDE], pos + VECTOR2D( 0, -insideOffset - len ), M_PI / 2 );
|
strokeText( text[INSIDE], pos + VECTOR2D( 0, -insideOffset - len ), M_PI / 2, flags );
|
||||||
}
|
}
|
||||||
if( size[OUTSIDE] )
|
if( size[OUTSIDE] )
|
||||||
{
|
{
|
||||||
SET_DC( OUTSIDE );
|
SET_DC( OUTSIDE );
|
||||||
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT );
|
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_RIGHT );
|
||||||
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
|
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_CENTER );
|
||||||
strokeText( text[OUTSIDE], pos + VECTOR2D( 0, outsideOffset ), M_PI / 2 );
|
strokeText( text[OUTSIDE], pos + VECTOR2D( 0, outsideOffset ), M_PI / 2, flags );
|
||||||
}
|
}
|
||||||
if( size[ABOVE] )
|
if( size[ABOVE] )
|
||||||
{
|
{
|
||||||
SET_DC( ABOVE );
|
SET_DC( ABOVE );
|
||||||
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
|
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
|
||||||
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM );
|
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM );
|
||||||
strokeText( text[ABOVE], pos + VECTOR2D( -aboveOffset, -len / 2.0 ), M_PI / 2 );
|
strokeText( text[ABOVE], pos + VECTOR2D( -aboveOffset, -len / 2.0 ), M_PI / 2, flags );
|
||||||
}
|
}
|
||||||
if( size[BELOW] )
|
if( size[BELOW] )
|
||||||
{
|
{
|
||||||
SET_DC( BELOW );
|
SET_DC( BELOW );
|
||||||
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
|
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_CENTER );
|
||||||
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP );
|
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP );
|
||||||
strokeText( text[BELOW], pos + VECTOR2D( belowOffset, -len / 2.0 ), M_PI / 2 );
|
strokeText( text[BELOW], pos + VECTOR2D( belowOffset, -len / 2.0 ), M_PI / 2, flags );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1283,7 +1279,7 @@ void SCH_PAINTER::draw( SCH_TEXT *aText, int aLayer )
|
||||||
m_gal->SetStrokeColor( color );
|
m_gal->SetStrokeColor( color );
|
||||||
m_gal->SetTextAttributes( aText );
|
m_gal->SetTextAttributes( aText );
|
||||||
|
|
||||||
VECTOR2D text_offset = aText->GetTextPos() + aText->GetSchematicTextOffset();
|
VECTOR2D text_offset = aText->GetTextPos() + aText->GetSchematicTextOffset( &m_schSettings );
|
||||||
wxString shownText( aText->GetShownText() );
|
wxString shownText( aText->GetShownText() );
|
||||||
|
|
||||||
if( drawingShadows )
|
if( drawingShadows )
|
||||||
|
@ -1319,7 +1315,10 @@ void SCH_PAINTER::draw( SCH_TEXT *aText, int aLayer )
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !shownText.IsEmpty() )
|
if( !shownText.IsEmpty() )
|
||||||
strokeText( shownText, text_offset, aText->GetTextAngleRadians() );
|
{
|
||||||
|
strokeText( shownText, text_offset, aText->GetTextAngleRadians(),
|
||||||
|
aText->GetTextMarkupFlags() );
|
||||||
|
}
|
||||||
|
|
||||||
if( aText->IsDangling() )
|
if( aText->IsDangling() )
|
||||||
drawDanglingSymbol( aText->GetTextPos(), drawingShadows );
|
drawDanglingSymbol( aText->GetTextPos(), drawingShadows );
|
||||||
|
@ -1406,6 +1405,7 @@ void SCH_PAINTER::draw( SCH_COMPONENT *aComp, int aLayer )
|
||||||
|
|
||||||
tempPin->ClearFlags();
|
tempPin->ClearFlags();
|
||||||
tempPin->SetFlags( compPin->GetFlags() ); // SELECTED, HIGHLIGHTED, BRIGHTENED
|
tempPin->SetFlags( compPin->GetFlags() ); // SELECTED, HIGHLIGHTED, BRIGHTENED
|
||||||
|
tempPin->SetTextMarkupFlags( compPin->GetTextMarkupFlags() );
|
||||||
|
|
||||||
if( compPin->IsDangling() )
|
if( compPin->IsDangling() )
|
||||||
tempPin->SetFlags( IS_DANGLING );
|
tempPin->SetFlags( IS_DANGLING );
|
||||||
|
@ -1499,7 +1499,8 @@ void SCH_PAINTER::draw( SCH_FIELD *aField, int aLayer )
|
||||||
m_gal->SetTextMirrored( aField->IsMirrored() );
|
m_gal->SetTextMirrored( aField->IsMirrored() );
|
||||||
m_gal->SetLineWidth( getTextThickness( aField, drawingShadows ) );
|
m_gal->SetLineWidth( getTextThickness( aField, drawingShadows ) );
|
||||||
|
|
||||||
strokeText( aField->GetShownText(), textpos, orient == TEXT_ANGLE_VERT ? M_PI / 2 : 0 );
|
strokeText( aField->GetShownText(), textpos, orient == TEXT_ANGLE_VERT ? M_PI / 2 : 0,
|
||||||
|
aField->GetTextMarkupFlags() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the umbilical line
|
// Draw the umbilical line
|
||||||
|
@ -1599,7 +1600,7 @@ void SCH_PAINTER::draw( SCH_SHEET *aSheet, int aLayer )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
int width = aSheet->GetPenSize();
|
int width = std::max( aSheet->GetPenWidth(), m_schSettings.GetDefaultPenWidth() );
|
||||||
wxPoint initial_pos = sheetPin->GetTextPos();
|
wxPoint initial_pos = sheetPin->GetTextPos();
|
||||||
wxPoint offset_pos = initial_pos;
|
wxPoint offset_pos = initial_pos;
|
||||||
|
|
||||||
|
@ -1663,7 +1664,7 @@ void SCH_PAINTER::draw( SCH_NO_CONNECT *aNC, int aLayer )
|
||||||
m_gal->SetIsFill( false );
|
m_gal->SetIsFill( false );
|
||||||
|
|
||||||
VECTOR2D p = aNC->GetPosition();
|
VECTOR2D p = aNC->GetPosition();
|
||||||
int delta = std::max( aNC->GetSize(), m_schSettings.m_DefaultLineWidth * 3 ) / 2;
|
int delta = std::max( aNC->GetSize(), m_schSettings.GetDefaultPenWidth() * 3 ) / 2;
|
||||||
|
|
||||||
m_gal->DrawLine( p + VECTOR2D( -delta, -delta ), p + VECTOR2D( delta, delta ) );
|
m_gal->DrawLine( p + VECTOR2D( -delta, -delta ), p + VECTOR2D( delta, delta ) );
|
||||||
m_gal->DrawLine( p + VECTOR2D( -delta, delta ), p + VECTOR2D( delta, -delta ) );
|
m_gal->DrawLine( p + VECTOR2D( -delta, delta ), p + VECTOR2D( delta, -delta ) );
|
||||||
|
|
|
@ -99,26 +99,22 @@ public:
|
||||||
|
|
||||||
const COLOR4D& GetCursorColor() override { return m_layerColors[ LAYER_SCHEMATIC_CURSOR ]; }
|
const COLOR4D& GetCursorColor() override { return m_layerColors[ LAYER_SCHEMATIC_CURSOR ]; }
|
||||||
|
|
||||||
int GetDefaultTextThickness() const override
|
int m_ShowUnit; // Show all units if 0
|
||||||
{
|
int m_ShowConvert; // Show all conversions if 0
|
||||||
return m_DefaultLineWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
bool m_ShowHiddenText;
|
||||||
|
bool m_ShowHiddenPins;
|
||||||
|
bool m_ShowPinsElectricalType;
|
||||||
|
bool m_ShowDisabled;
|
||||||
|
bool m_ShowUmbilicals;
|
||||||
|
|
||||||
int m_ShowUnit; // Show all units if 0
|
bool m_OverrideItemColors;
|
||||||
int m_ShowConvert; // Show all conversions if 0
|
|
||||||
|
|
||||||
bool m_ShowHiddenText;
|
double m_TextOffsetRatio; // Proportion of font size to offset text above/below
|
||||||
bool m_ShowHiddenPins;
|
// wires, buses, etc.
|
||||||
bool m_ShowPinsElectricalType;
|
|
||||||
bool m_ShowDisabled;
|
|
||||||
bool m_ShowUmbilicals;
|
|
||||||
|
|
||||||
bool m_OverrideItemColors;
|
int m_DefaultWireThickness;
|
||||||
|
int m_DefaultBusThickness;
|
||||||
int m_DefaultLineWidth;
|
|
||||||
int m_DefaultWireThickness;
|
|
||||||
int m_DefaultBusThickness;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -187,7 +183,8 @@ private:
|
||||||
void fillIfSelection( int aLayer );
|
void fillIfSelection( int aLayer );
|
||||||
|
|
||||||
void triLine ( const VECTOR2D &a, const VECTOR2D &b, const VECTOR2D &c );
|
void triLine ( const VECTOR2D &a, const VECTOR2D &b, const VECTOR2D &c );
|
||||||
void strokeText( const wxString& aText, const VECTOR2D& aPosition, double aRotationAngle );
|
void strokeText( const wxString& aText, const VECTOR2D& aPosition, double aRotationAngle,
|
||||||
|
int aTextMarkupFlags );
|
||||||
|
|
||||||
SCH_RENDER_SETTINGS m_schSettings;
|
SCH_RENDER_SETTINGS m_schSettings;
|
||||||
};
|
};
|
||||||
|
|
|
@ -39,6 +39,10 @@ class SCH_PIN : public SCH_ITEM
|
||||||
wxPoint m_position;
|
wxPoint m_position;
|
||||||
bool m_isDangling;
|
bool m_isDangling;
|
||||||
|
|
||||||
|
int m_textMarkupFlags; // Set of TEXT_MARKUP_FLAGS indicating which markup
|
||||||
|
// features are to be processed within the pin name
|
||||||
|
// and number.
|
||||||
|
|
||||||
/// The name that this pin connection will drive onto a net
|
/// The name that this pin connection will drive onto a net
|
||||||
std::mutex m_netmap_mutex;
|
std::mutex m_netmap_mutex;
|
||||||
std::map<const SCH_SHEET_PATH, wxString> m_net_name_map;
|
std::map<const SCH_SHEET_PATH, wxString> m_net_name_map;
|
||||||
|
@ -70,7 +74,7 @@ public:
|
||||||
void GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList ) override;
|
void GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList ) override;
|
||||||
wxString GetDescription( const SCH_SHEET_PATH* aSheet );
|
wxString GetDescription( const SCH_SHEET_PATH* aSheet );
|
||||||
|
|
||||||
void Print( wxDC* aDC, const wxPoint& aOffset ) override {}
|
void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override {}
|
||||||
|
|
||||||
void Move( const wxPoint& aMoveVector ) override {}
|
void Move( const wxPoint& aMoveVector ) override {}
|
||||||
|
|
||||||
|
@ -85,6 +89,9 @@ public:
|
||||||
const EDA_RECT GetBoundingBox() const override;
|
const EDA_RECT GetBoundingBox() const override;
|
||||||
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
|
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
|
||||||
|
|
||||||
|
int GetTextMarkupFlags() const { return m_textMarkupFlags; }
|
||||||
|
void SetTextMarkupFlags( int aFlags ) { m_textMarkupFlags = aFlags; }
|
||||||
|
|
||||||
bool IsDangling() const override { return m_isDangling; }
|
bool IsDangling() const override { return m_isDangling; }
|
||||||
void SetIsDangling( bool isDangling ) { m_isDangling = isDangling; }
|
void SetIsDangling( bool isDangling ) { m_isDangling = isDangling; }
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ SCH_PREVIEW_PANEL::SCH_PREVIEW_PANEL( wxWindow* aParentWindow, wxWindowID aWindo
|
||||||
// on updated viewport data.
|
// on updated viewport data.
|
||||||
m_viewControls = new KIGFX::WX_VIEW_CONTROLS( m_view, this );
|
m_viewControls = new KIGFX::WX_VIEW_CONTROLS( m_view, this );
|
||||||
|
|
||||||
m_gal->SetGridColor( GetLayerColor( LAYER_SCHEMATIC_GRID ) );
|
m_gal->SetGridColor( m_painter->GetSettings()->GetLayerColor( LAYER_SCHEMATIC_GRID ) );
|
||||||
m_gal->SetCursorEnabled( false );
|
m_gal->SetCursorEnabled( false );
|
||||||
m_gal->SetGridSize( VECTOR2D( Mils2iu( 50.0 ), Mils2iu( 50.0 ) ) );
|
m_gal->SetGridSize( VECTOR2D( Mils2iu( 50.0 ), Mils2iu( 50.0 ) ) );
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,7 @@
|
||||||
|
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <eda_rect.h>
|
#include <eda_rect.h>
|
||||||
#include <eeschema_id.h>
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <gr_basic.h>
|
|
||||||
#include <gr_text.h>
|
#include <gr_text.h>
|
||||||
#include <id.h>
|
#include <id.h>
|
||||||
#include <kicad_string.h>
|
#include <kicad_string.h>
|
||||||
|
@ -48,15 +46,11 @@
|
||||||
#include <class_library.h>
|
#include <class_library.h>
|
||||||
#include <connection_graph.h>
|
#include <connection_graph.h>
|
||||||
#include <lib_pin.h>
|
#include <lib_pin.h>
|
||||||
#include <netlist.h>
|
|
||||||
#include <netlist_object.h>
|
#include <netlist_object.h>
|
||||||
#include <sch_bus_entry.h>
|
|
||||||
#include <sch_component.h>
|
#include <sch_component.h>
|
||||||
#include <sch_junction.h>
|
#include <sch_junction.h>
|
||||||
#include <sch_line.h>
|
#include <sch_line.h>
|
||||||
#include <sch_marker.h>
|
#include <sch_marker.h>
|
||||||
#include <sch_no_connect.h>
|
|
||||||
#include <sch_rtree.h>
|
|
||||||
#include <sch_sheet.h>
|
#include <sch_sheet.h>
|
||||||
#include <sch_text.h>
|
#include <sch_text.h>
|
||||||
#include <symbol_lib_table.h>
|
#include <symbol_lib_table.h>
|
||||||
|
@ -65,7 +59,6 @@
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <future>
|
#include <future>
|
||||||
#include <array>
|
|
||||||
|
|
||||||
// TODO(JE) Debugging only
|
// TODO(JE) Debugging only
|
||||||
#include <profile.h>
|
#include <profile.h>
|
||||||
|
@ -499,10 +492,10 @@ void SCH_SCREEN::UpdateSymbolLinks( bool aForce )
|
||||||
SYMBOL_LIB_TABLE* libs = Prj().SchSymbolLibTable();
|
SYMBOL_LIB_TABLE* libs = Prj().SchSymbolLibTable();
|
||||||
int mod_hash = libs->GetModifyHash();
|
int mod_hash = libs->GetModifyHash();
|
||||||
|
|
||||||
for( auto aItem : Items().OfType( SCH_COMPONENT_T ) )
|
for( SCH_ITEM* aItem : Items().OfType( SCH_COMPONENT_T ) )
|
||||||
cmps.push_back( static_cast<SCH_COMPONENT*>( aItem ) );
|
cmps.push_back( static_cast<SCH_COMPONENT*>( aItem ) );
|
||||||
|
|
||||||
for( auto cmp : cmps )
|
for( SCH_COMPONENT* cmp : cmps )
|
||||||
Remove( cmp );
|
Remove( cmp );
|
||||||
|
|
||||||
// Must we resolve?
|
// Must we resolve?
|
||||||
|
@ -516,19 +509,56 @@ void SCH_SCREEN::UpdateSymbolLinks( bool aForce )
|
||||||
// even if the libraries don't change.
|
// even if the libraries don't change.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for( auto cmp : cmps )
|
for( SCH_COMPONENT* cmp : cmps )
|
||||||
cmp->UpdatePins();
|
cmp->UpdatePins();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Changing the symbol may adjust the bbox of the symbol. This re-inserts the
|
// Changing the symbol may adjust the bbox of the symbol. This re-inserts the
|
||||||
// item with the new bbox
|
// item with the new bbox
|
||||||
for( auto cmp : cmps )
|
for( SCH_COMPONENT* cmp : cmps )
|
||||||
Append( cmp );
|
Append( cmp );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_SCREEN::Print( wxDC* aDC )
|
void SCH_SCREEN::UpdateTextMarkupFlags( int aMarkupFlags )
|
||||||
|
{
|
||||||
|
for( SCH_ITEM* aItem : Items() )
|
||||||
|
{
|
||||||
|
switch( aItem->Type() )
|
||||||
|
{
|
||||||
|
case SCH_TEXT_T:
|
||||||
|
case SCH_LABEL_T:
|
||||||
|
case SCH_HIER_LABEL_T:
|
||||||
|
case SCH_GLOBAL_LABEL_T:
|
||||||
|
case SCH_SHEET_PIN_T:
|
||||||
|
static_cast<SCH_TEXT*>( aItem )->SetTextMarkupFlags( aMarkupFlags );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SCH_COMPONENT_T:
|
||||||
|
for( SCH_FIELD& field : static_cast<SCH_COMPONENT*>( aItem )->GetFields() )
|
||||||
|
field.SetTextMarkupFlags( aMarkupFlags );
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SCH_PIN_T:
|
||||||
|
static_cast<SCH_PIN*>( aItem )->SetTextMarkupFlags( aMarkupFlags );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SCH_SHEET_T:
|
||||||
|
for( SCH_FIELD& field : static_cast<SCH_SHEET*>( aItem )->GetFields() )
|
||||||
|
field.SetTextMarkupFlags( aMarkupFlags );
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SCH_SCREEN::Print( RENDER_SETTINGS* aSettings )
|
||||||
{
|
{
|
||||||
// Ensure links are up to date, even if a library was reloaded for some reason:
|
// Ensure links are up to date, even if a library was reloaded for some reason:
|
||||||
std::vector< SCH_ITEM* > junctions;
|
std::vector< SCH_ITEM* > junctions;
|
||||||
|
@ -552,21 +582,23 @@ void SCH_SCREEN::Print( wxDC* aDC )
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sort to ensure plot-order consistency with screen drawing
|
/// Sort to ensure plot-order consistency with screen drawing
|
||||||
std::sort( other.begin(), other.end(), []( const SCH_ITEM* a, const SCH_ITEM* b ) {
|
std::sort( other.begin(), other.end(),
|
||||||
if( a->Type() == b->Type() )
|
[]( const SCH_ITEM* a, const SCH_ITEM* b )
|
||||||
return a->GetLayer() > b->GetLayer();
|
{
|
||||||
|
if( a->Type() == b->Type() )
|
||||||
|
return a->GetLayer() > b->GetLayer();
|
||||||
|
|
||||||
return a->Type() > b->Type();
|
return a->Type() > b->Type();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
for( auto item : bitmaps )
|
for( auto item : bitmaps )
|
||||||
item->Print( aDC, wxPoint( 0, 0 ) );
|
item->Print( aSettings, wxPoint( 0, 0 ) );
|
||||||
|
|
||||||
for( auto item : other )
|
for( auto item : other )
|
||||||
item->Print( aDC, wxPoint( 0, 0 ) );
|
item->Print( aSettings, wxPoint( 0, 0 ) );
|
||||||
|
|
||||||
for( auto item : junctions )
|
for( auto item : junctions )
|
||||||
item->Print( aDC, wxPoint( 0, 0 ) );
|
item->Print( aSettings, wxPoint( 0, 0 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -601,24 +633,26 @@ void SCH_SCREEN::Plot( PLOTTER* aPlotter )
|
||||||
return a->Type() > b->Type();
|
return a->Type() > b->Type();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
int defaultPenWidth = aPlotter->RenderSettings()->GetDefaultPenWidth();
|
||||||
|
|
||||||
// Bitmaps are drawn first to ensure they are in the background
|
// Bitmaps are drawn first to ensure they are in the background
|
||||||
// This is particularly important for the wxPostscriptDC (used in *nix printers) as
|
// This is particularly important for the wxPostscriptDC (used in *nix printers) as
|
||||||
// the bitmap PS command clears the screen
|
// the bitmap PS command clears the screen
|
||||||
for( auto item : bitmaps )
|
for( auto item : bitmaps )
|
||||||
{
|
{
|
||||||
aPlotter->SetCurrentLineWidth( item->GetPenSize() );
|
aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) );
|
||||||
item->Plot( aPlotter );
|
item->Plot( aPlotter );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( auto item : other )
|
for( auto item : other )
|
||||||
{
|
{
|
||||||
aPlotter->SetCurrentLineWidth( item->GetPenSize() );
|
aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) );
|
||||||
item->Plot( aPlotter );
|
item->Plot( aPlotter );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( auto item : junctions )
|
for( auto item : junctions )
|
||||||
{
|
{
|
||||||
aPlotter->SetCurrentLineWidth( item->GetPenSize() );
|
aPlotter->SetCurrentLineWidth( std::max( item->GetPenWidth(), defaultPenWidth ) );
|
||||||
item->Plot( aPlotter );
|
item->Plot( aPlotter );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1155,6 +1189,13 @@ void SCH_SCREENS::UpdateSymbolLinks( bool aForce )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SCH_SCREENS::UpdateTextMarkupFlags( int aMarkupFlags )
|
||||||
|
{
|
||||||
|
for( SCH_SCREEN* screen = GetFirst(); screen; screen = GetNext() )
|
||||||
|
screen->UpdateTextMarkupFlags( aMarkupFlags );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_SCREENS::TestDanglingEnds()
|
void SCH_SCREENS::TestDanglingEnds()
|
||||||
{
|
{
|
||||||
std::vector<SCH_SCREEN*> screens;
|
std::vector<SCH_SCREEN*> screens;
|
||||||
|
|
|
@ -235,15 +235,15 @@ public:
|
||||||
*/
|
*/
|
||||||
void UpdateSymbolLinks( bool aForce = false );
|
void UpdateSymbolLinks( bool aForce = false );
|
||||||
|
|
||||||
|
void UpdateTextMarkupFlags( int aMarkupFlags );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print all the items in the screen to \a aDC.
|
* Print all the items in the screen to \a aDC.
|
||||||
*
|
*
|
||||||
* @note This function is useful only for schematic. The library editor and library viewer
|
* @note This function is useful only for schematic. The library editor and library viewer
|
||||||
* do not use a draw list and therefore draws nothing.
|
* do not use a draw list and therefore draws nothing.
|
||||||
*
|
|
||||||
* @param aDC The device context to draw on.
|
|
||||||
*/
|
*/
|
||||||
void Print( wxDC* aDC );
|
void Print( RENDER_SETTINGS* aSettings );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plot all the schematic objects to \a aPlotter.
|
* Plot all the schematic objects to \a aPlotter.
|
||||||
|
@ -556,6 +556,8 @@ public:
|
||||||
*/
|
*/
|
||||||
void UpdateSymbolLinks( bool aForce = false );
|
void UpdateSymbolLinks( bool aForce = false );
|
||||||
|
|
||||||
|
void UpdateTextMarkupFlags( int aMarkupFlags );
|
||||||
|
|
||||||
void TestDanglingEnds();
|
void TestDanglingEnds();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -535,7 +535,7 @@ void SCH_SEXPR_PARSER::parseEDA_TEXT( EDA_TEXT* aText )
|
||||||
}
|
}
|
||||||
|
|
||||||
case T_thickness:
|
case T_thickness:
|
||||||
aText->SetTextPenWidth( parseInternalUnits( "text thickness" ) );
|
aText->SetTextThickness( parseInternalUnits( "text thickness" ) );
|
||||||
NeedRIGHT();
|
NeedRIGHT();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -463,9 +463,9 @@ SCH_SHEET_PIN* SCH_SHEET::GetPin( const wxPoint& aPosition )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int SCH_SHEET::GetPenSize() const
|
int SCH_SHEET::GetPenWidth() const
|
||||||
{
|
{
|
||||||
return GetBorderWidth();
|
return std::max( GetBorderWidth(), 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -473,8 +473,9 @@ void SCH_SHEET::AutoplaceFields( SCH_SCREEN* aScreen, bool aManual )
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( !aManual, "manual autoplacement not currently supported for sheets" );
|
wxASSERT_MSG( !aManual, "manual autoplacement not currently supported for sheets" );
|
||||||
|
|
||||||
wxSize textSize = m_fields[ SHEETNAME ].GetTextSize();
|
wxSize textSize = m_fields[ SHEETNAME ].GetTextSize();
|
||||||
int margin = KiROUND( GetPenSize() / 2.0 + 4 + std::max( textSize.x, textSize.y ) * 0.5 );
|
int borderMargin = KiROUND( GetPenWidth() / 2.0 ) + 4;
|
||||||
|
int margin = borderMargin + KiROUND( std::max( textSize.x, textSize.y ) * 0.5 );
|
||||||
|
|
||||||
if( IsVerticalOrientation() )
|
if( IsVerticalOrientation() )
|
||||||
{
|
{
|
||||||
|
@ -492,7 +493,7 @@ void SCH_SHEET::AutoplaceFields( SCH_SCREEN* aScreen, bool aManual )
|
||||||
}
|
}
|
||||||
|
|
||||||
textSize = m_fields[ SHEETFILENAME ].GetTextSize();
|
textSize = m_fields[ SHEETFILENAME ].GetTextSize();
|
||||||
margin = KiROUND( GetPenSize() / 2.0 + 4 + std::max( textSize.x, textSize.y ) * 0.4 );
|
margin = borderMargin + KiROUND( std::max( textSize.x, textSize.y ) * 0.4 );
|
||||||
|
|
||||||
if( IsVerticalOrientation() )
|
if( IsVerticalOrientation() )
|
||||||
{
|
{
|
||||||
|
@ -523,21 +524,21 @@ void SCH_SHEET::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_SHEET::Print( wxDC* aDC, const wxPoint& aOffset )
|
void SCH_SHEET::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
|
||||||
{
|
{
|
||||||
wxString Text;
|
wxDC* DC = aSettings->GetPrintDC();
|
||||||
wxPoint pos = m_pos + aOffset;
|
wxPoint pos = m_pos + aOffset;
|
||||||
int lineWidth = GetPenSize();
|
int lineWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
|
||||||
COLOR4D color = GetBorderColor();
|
COLOR4D color = GetBorderColor();
|
||||||
|
|
||||||
GRRect( nullptr, aDC, pos.x, pos.y, pos.x + m_size.x, pos.y + m_size.y, lineWidth, color );
|
GRRect( nullptr, DC, pos.x, pos.y, pos.x + m_size.x, pos.y + m_size.y, lineWidth, color );
|
||||||
|
|
||||||
for( SCH_FIELD& field : m_fields )
|
for( SCH_FIELD& field : m_fields )
|
||||||
field.Print( aDC, aOffset );
|
field.Print( aSettings, aOffset );
|
||||||
|
|
||||||
/* Draw text : SheetLabel */
|
/* Draw text : SheetLabel */
|
||||||
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
for( SCH_SHEET_PIN* sheetPin : m_pins )
|
||||||
sheetPin->Print( aDC, aOffset );
|
sheetPin->Print( aSettings, aOffset );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -545,7 +546,7 @@ const EDA_RECT SCH_SHEET::GetBodyBoundingBox() const
|
||||||
{
|
{
|
||||||
wxPoint end;
|
wxPoint end;
|
||||||
EDA_RECT box( m_pos, m_size );
|
EDA_RECT box( m_pos, m_size );
|
||||||
int lineWidth = GetPenSize();
|
int lineWidth = GetPenWidth();
|
||||||
int textLength = 0;
|
int textLength = 0;
|
||||||
|
|
||||||
// Calculate bounding box X size:
|
// Calculate bounding box X size:
|
||||||
|
@ -937,12 +938,12 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter )
|
||||||
COLOR4D borderColor = GetBorderColor();
|
COLOR4D borderColor = GetBorderColor();
|
||||||
|
|
||||||
if( borderColor == COLOR4D::UNSPECIFIED )
|
if( borderColor == COLOR4D::UNSPECIFIED )
|
||||||
borderColor = aPlotter->ColorSettings()->GetColor( LAYER_SHEET );
|
borderColor = aPlotter->RenderSettings()->GetLayerColor( LAYER_SHEET );
|
||||||
|
|
||||||
aPlotter->SetColor( GetBorderColor() );
|
aPlotter->SetColor( borderColor );
|
||||||
|
|
||||||
int thickness = GetPenSize();
|
int penWidth = std::max( GetPenWidth(), aPlotter->RenderSettings()->GetDefaultPenWidth() );
|
||||||
aPlotter->SetCurrentLineWidth( thickness );
|
aPlotter->SetCurrentLineWidth( penWidth );
|
||||||
|
|
||||||
aPlotter->MoveTo( m_pos );
|
aPlotter->MoveTo( m_pos );
|
||||||
pos = m_pos;
|
pos = m_pos;
|
||||||
|
|
|
@ -120,7 +120,7 @@ public:
|
||||||
*/
|
*/
|
||||||
bool IsMovableFromAnchorPoint() override { return true; }
|
bool IsMovableFromAnchorPoint() override { return true; }
|
||||||
|
|
||||||
void Print( wxDC* aDC, const wxPoint& aOffset ) override;
|
void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the graphic shape (a polygon) associated to the text.
|
* Calculate the graphic shape (a polygon) associated to the text.
|
||||||
|
@ -132,7 +132,7 @@ public:
|
||||||
|
|
||||||
void SwapData( SCH_ITEM* aItem ) override;
|
void SwapData( SCH_ITEM* aItem ) override;
|
||||||
|
|
||||||
int GetPenSize() const override;
|
int GetPenWidth() const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the sheet label number.
|
* Get the sheet label number.
|
||||||
|
@ -216,18 +216,17 @@ class SCH_SHEET : public SCH_ITEM
|
||||||
{
|
{
|
||||||
friend class SCH_SHEET_PIN;
|
friend class SCH_SHEET_PIN;
|
||||||
|
|
||||||
/// Screen that contains the physical data for the sheet. In complex hierarchies
|
|
||||||
/// multiple sheets can share a common screen.
|
|
||||||
SCH_SCREEN* m_screen;
|
|
||||||
|
|
||||||
/// The list of sheet connection points.
|
SCH_SCREEN* m_screen; // Screen that contains the physical data for the sheet. In
|
||||||
std::vector<SCH_SHEET_PIN*> m_pins;
|
// complex hierarchies multiple sheets can share a common screen.
|
||||||
|
|
||||||
|
std::vector<SCH_SHEET_PIN*> m_pins; // The list of sheet connection points.
|
||||||
|
|
||||||
std::vector<SCH_FIELD> m_fields;
|
std::vector<SCH_FIELD> m_fields;
|
||||||
FIELDS_AUTOPLACED m_fieldsAutoplaced; // indicates status of field autoplacement
|
FIELDS_AUTOPLACED m_fieldsAutoplaced; // Indicates status of field autoplacement.
|
||||||
|
|
||||||
wxPoint m_pos; // The position of the sheet.
|
wxPoint m_pos; // The position of the sheet.
|
||||||
wxSize m_size; // The size of the sheet.
|
wxSize m_size; // The size of the sheet.
|
||||||
|
|
||||||
int m_borderWidth;
|
int m_borderWidth;
|
||||||
KIGFX::COLOR4D m_borderColor;
|
KIGFX::COLOR4D m_borderColor;
|
||||||
|
@ -434,9 +433,9 @@ public:
|
||||||
*/
|
*/
|
||||||
int GetMinHeight() const;
|
int GetMinHeight() const;
|
||||||
|
|
||||||
int GetPenSize() const override;
|
int GetPenWidth() const override;
|
||||||
|
|
||||||
void Print( wxDC* aDC, const wxPoint& aOffset ) override;
|
void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a bounding box for the sheet body but not the fields.
|
* Return a bounding box for the sheet body but not the fields.
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include <sch_draw_panel.h>
|
#include <sch_draw_panel.h>
|
||||||
#include <sch_edit_frame.h>
|
#include <sch_edit_frame.h>
|
||||||
#include <sch_sheet.h>
|
#include <sch_sheet.h>
|
||||||
|
#include <sch_painter.h>
|
||||||
#include <trigo.h>
|
#include <trigo.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -65,10 +66,10 @@ EDA_ITEM* SCH_SHEET_PIN::Clone() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_SHEET_PIN::Print( wxDC* aDC, const wxPoint& aOffset )
|
void SCH_SHEET_PIN::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
|
||||||
{
|
{
|
||||||
// The icon selection is handle by the virtual method CreateGraphicShape called by ::Print
|
// The icon selection is handle by the virtual method CreateGraphicShape called by ::Print
|
||||||
SCH_HIERLABEL::Print( aDC, aOffset );
|
SCH_HIERLABEL::Print( aSettings, aOffset );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,9 +96,9 @@ bool SCH_SHEET_PIN::operator==( const SCH_SHEET_PIN* aPin ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int SCH_SHEET_PIN::GetPenSize() const
|
int SCH_SHEET_PIN::GetPenWidth() const
|
||||||
{
|
{
|
||||||
return 0; // use default pen size
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -252,7 +253,7 @@ void SCH_SHEET_PIN::Rotate( wxPoint aPosition )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_SHEET_PIN::CreateGraphicShape( std::vector <wxPoint>& aPoints, const wxPoint& aPos )
|
void SCH_SHEET_PIN::CreateGraphicShape( std::vector<wxPoint>& aPoints, const wxPoint& aPos )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* These are the same icon shapes as SCH_HIERLABEL but the graphic icon is slightly
|
* These are the same icon shapes as SCH_HIERLABEL but the graphic icon is slightly
|
||||||
|
|
|
@ -46,11 +46,14 @@
|
||||||
#include <netlist_object.h>
|
#include <netlist_object.h>
|
||||||
#include <settings/color_settings.h>
|
#include <settings/color_settings.h>
|
||||||
#include <trace_helpers.h>
|
#include <trace_helpers.h>
|
||||||
#include <default_values.h> // For some default values
|
#include <sch_painter.h>
|
||||||
|
#include <default_values.h>
|
||||||
#include <wx/debug.h>
|
#include <wx/debug.h>
|
||||||
|
|
||||||
|
|
||||||
|
using KIGFX::SCH_RENDER_SETTINGS;
|
||||||
|
|
||||||
|
|
||||||
extern void IncrementLabelMember( wxString& name, int aIncrement );
|
extern void IncrementLabelMember( wxString& name, int aIncrement );
|
||||||
|
|
||||||
/* Coding polygons for global symbol graphic shapes.
|
/* Coding polygons for global symbol graphic shapes.
|
||||||
|
@ -93,8 +96,10 @@ static int* TemplateShape[5][4] =
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType )
|
SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType, int aMarkupFlags ) :
|
||||||
: SCH_ITEM( NULL, aType ), EDA_TEXT( text ), m_shape( PINSHEETLABEL_SHAPE::PS_INPUT )
|
SCH_ITEM( NULL, aType ),
|
||||||
|
EDA_TEXT( text, aMarkupFlags ),
|
||||||
|
m_shape( PINSHEETLABEL_SHAPE::PS_INPUT )
|
||||||
{
|
{
|
||||||
m_Layer = LAYER_NOTES;
|
m_Layer = LAYER_NOTES;
|
||||||
m_isDangling = false;
|
m_isDangling = false;
|
||||||
|
@ -131,24 +136,23 @@ void SCH_TEXT::IncrementLabel( int aIncrement )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxPoint SCH_TEXT::GetSchematicTextOffset() const
|
wxPoint SCH_TEXT::GetSchematicTextOffset( RENDER_SETTINGS* aSettings ) const
|
||||||
{
|
{
|
||||||
wxPoint text_offset;
|
wxPoint text_offset;
|
||||||
|
|
||||||
// add an offset to x (or y) position to aid readability of text on a wire or line
|
// add an offset to x (or y) position to aid readability of text on a wire or line
|
||||||
int thick_offset = KiROUND( GetTextOffsetRatio() * GetTextSize().y );
|
int dist = GetTextOffset( aSettings ) + GetPenWidth();
|
||||||
thick_offset += GetPenSize() / 2;
|
|
||||||
|
|
||||||
switch( GetLabelSpinStyle() )
|
switch( GetLabelSpinStyle() )
|
||||||
{
|
{
|
||||||
case LABEL_SPIN_STYLE::UP:
|
case LABEL_SPIN_STYLE::UP:
|
||||||
case LABEL_SPIN_STYLE::BOTTOM:
|
case LABEL_SPIN_STYLE::BOTTOM:
|
||||||
text_offset.x = -thick_offset;
|
text_offset.x = -dist;
|
||||||
break; // Vert Orientation
|
break; // Vert Orientation
|
||||||
default:
|
default:
|
||||||
case LABEL_SPIN_STYLE::LEFT:
|
case LABEL_SPIN_STYLE::LEFT:
|
||||||
case LABEL_SPIN_STYLE::RIGHT:
|
case LABEL_SPIN_STYLE::RIGHT:
|
||||||
text_offset.y = -thick_offset;
|
text_offset.y = -dist;
|
||||||
break; // Horiz Orientation
|
break; // Horiz Orientation
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,25 +285,29 @@ bool SCH_TEXT::operator<( const SCH_ITEM& aItem ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int SCH_TEXT::GetPenSize() const
|
int SCH_TEXT::GetTextOffset( RENDER_SETTINGS* aSettings ) const
|
||||||
{
|
{
|
||||||
#if 1
|
SCH_RENDER_SETTINGS* renderSettings = static_cast<SCH_RENDER_SETTINGS*>( aSettings );
|
||||||
// Temporary code not using RENDER_SETTINGS
|
|
||||||
int textThickness = DEFAULT_LINE_THICKNESS * IU_PER_MILS;
|
if( renderSettings )
|
||||||
textThickness = Clamp_Text_PenSize( textThickness, GetTextSize(), IsBold() );
|
return KiROUND( renderSettings->m_TextOffsetRatio * GetTextSize().y );
|
||||||
return textThickness;
|
|
||||||
#else
|
return 0;
|
||||||
return GetEffectiveTextPenWidth( nullptr ); // JEY TODO: requires RENDER_SETTINGS
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_TEXT::Print( wxDC* DC, const wxPoint& aOffset )
|
int SCH_TEXT::GetPenWidth() const
|
||||||
{
|
{
|
||||||
COLOR4D color = GetLayerColor( m_Layer );
|
return GetEffectiveTextPenWidth();
|
||||||
wxPoint text_offset = aOffset + GetSchematicTextOffset();
|
}
|
||||||
|
|
||||||
EDA_TEXT::Print( DC, text_offset, color );
|
|
||||||
|
void SCH_TEXT::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
|
||||||
|
{
|
||||||
|
COLOR4D color = aSettings->GetLayerColor( m_Layer );
|
||||||
|
wxPoint text_offset = aOffset + GetSchematicTextOffset( aSettings );
|
||||||
|
|
||||||
|
EDA_TEXT::Print( aSettings, text_offset, color );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -409,7 +417,7 @@ void SCH_TEXT::GetConnectionPoints( std::vector< wxPoint >& aPoints ) const
|
||||||
|
|
||||||
const EDA_RECT SCH_TEXT::GetBoundingBox() const
|
const EDA_RECT SCH_TEXT::GetBoundingBox() const
|
||||||
{
|
{
|
||||||
EDA_RECT rect = GetTextBox( nullptr ); // JEY TODO: requires RENDER_SETTINGS
|
EDA_RECT rect = GetTextBox();
|
||||||
|
|
||||||
if( GetTextAngle() != 0 ) // Rotate rect
|
if( GetTextAngle() != 0 ) // Rotate rect
|
||||||
{
|
{
|
||||||
|
@ -577,8 +585,9 @@ bool SCH_TEXT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
|
||||||
void SCH_TEXT::Plot( PLOTTER* aPlotter )
|
void SCH_TEXT::Plot( PLOTTER* aPlotter )
|
||||||
{
|
{
|
||||||
static std::vector<wxPoint> Poly;
|
static std::vector<wxPoint> Poly;
|
||||||
COLOR4D color = aPlotter->ColorSettings()->GetColor( GetLayer() );
|
COLOR4D color = aPlotter->RenderSettings()->GetLayerColor( GetLayer() );
|
||||||
int penWidth = GetPenSize();
|
int penWidth = std::max( GetEffectiveTextPenWidth(),
|
||||||
|
aPlotter->RenderSettings()->GetDefaultPenWidth() );
|
||||||
|
|
||||||
aPlotter->SetCurrentLineWidth( penWidth );
|
aPlotter->SetCurrentLineWidth( penWidth );
|
||||||
|
|
||||||
|
@ -589,28 +598,29 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter )
|
||||||
wxStringSplit( GetShownText(), strings_list, '\n' );
|
wxStringSplit( GetShownText(), strings_list, '\n' );
|
||||||
positions.reserve( strings_list.Count() );
|
positions.reserve( strings_list.Count() );
|
||||||
|
|
||||||
GetPositionsOfLinesOfMultilineText(positions, (int) strings_list.Count() );
|
GetLinePositions( positions, (int) strings_list.Count() );
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
|
for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
|
||||||
{
|
{
|
||||||
wxPoint textpos = positions[ii] + GetSchematicTextOffset();
|
wxPoint textpos = positions[ii] + GetSchematicTextOffset( aPlotter->RenderSettings() );
|
||||||
wxString& txt = strings_list.Item( ii );
|
wxString& txt = strings_list.Item( ii );
|
||||||
aPlotter->Text( textpos, color, txt, GetTextAngle(), GetTextSize(), GetHorizJustify(),
|
aPlotter->Text( textpos, color, txt, GetTextAngle(), GetTextSize(), GetHorizJustify(),
|
||||||
GetVertJustify(), penWidth, IsItalic(), IsBold() );
|
GetVertJustify(), penWidth, IsItalic(), IsBold(), m_textMarkupFlags );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxPoint textpos = GetTextPos() + GetSchematicTextOffset();
|
wxPoint textpos = GetTextPos() + GetSchematicTextOffset( aPlotter->RenderSettings() );
|
||||||
|
|
||||||
aPlotter->Text( textpos, color, GetShownText(), GetTextAngle(), GetTextSize(),
|
aPlotter->Text( textpos, color, GetShownText(), GetTextAngle(), GetTextSize(),
|
||||||
GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), IsBold() );
|
GetHorizJustify(), GetVertJustify(), penWidth, IsItalic(), IsBold(),
|
||||||
|
m_textMarkupFlags );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw graphic symbol for global or hierarchical labels
|
// Draw graphic symbol for global or hierarchical labels
|
||||||
CreateGraphicShape( Poly, GetTextPos() );
|
CreateGraphicShape( Poly, GetTextPos() );
|
||||||
|
|
||||||
aPlotter->SetCurrentLineWidth( GetPenSize() );
|
aPlotter->SetCurrentLineWidth( penWidth );
|
||||||
|
|
||||||
if( Poly.size() )
|
if( Poly.size() )
|
||||||
aPlotter->PlotPoly( Poly, NO_FILL );
|
aPlotter->PlotPoly( Poly, NO_FILL );
|
||||||
|
@ -695,8 +705,8 @@ void SCH_TEXT::Show( int nestLevel, std::ostream& os ) const
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
SCH_LABEL::SCH_LABEL( const wxPoint& pos, const wxString& text )
|
SCH_LABEL::SCH_LABEL( const wxPoint& pos, const wxString& text, int aMarkupFlags )
|
||||||
: SCH_TEXT( pos, text, SCH_LABEL_T )
|
: SCH_TEXT( pos, text, SCH_LABEL_T, aMarkupFlags )
|
||||||
{
|
{
|
||||||
m_Layer = LAYER_LOCLABEL;
|
m_Layer = LAYER_LOCLABEL;
|
||||||
m_shape = PINSHEETLABEL_SHAPE::PS_INPUT;
|
m_shape = PINSHEETLABEL_SHAPE::PS_INPUT;
|
||||||
|
@ -749,7 +759,7 @@ bool SCH_LABEL::IsType( const KICAD_T aScanTypes[] ) const
|
||||||
|
|
||||||
const EDA_RECT SCH_LABEL::GetBoundingBox() const
|
const EDA_RECT SCH_LABEL::GetBoundingBox() const
|
||||||
{
|
{
|
||||||
EDA_RECT rect = GetTextBox( nullptr ); // JEY TODO: requires RENDER_SETTINGS
|
EDA_RECT rect = GetTextBox();
|
||||||
|
|
||||||
if( GetTextAngle() != 0.0 )
|
if( GetTextAngle() != 0.0 )
|
||||||
{
|
{
|
||||||
|
@ -782,8 +792,8 @@ BITMAP_DEF SCH_LABEL::GetMenuImage() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text )
|
SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text, int aMarkupFlags )
|
||||||
: SCH_TEXT( pos, text, SCH_GLOBAL_LABEL_T )
|
: SCH_TEXT( pos, text, SCH_GLOBAL_LABEL_T, aMarkupFlags )
|
||||||
{
|
{
|
||||||
m_Layer = LAYER_GLOBLABEL;
|
m_Layer = LAYER_GLOBLABEL;
|
||||||
m_shape = PINSHEETLABEL_SHAPE::PS_BIDI;
|
m_shape = PINSHEETLABEL_SHAPE::PS_BIDI;
|
||||||
|
@ -798,25 +808,22 @@ EDA_ITEM* SCH_GLOBALLABEL::Clone() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset() const
|
wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset( RENDER_SETTINGS* aSettings ) const
|
||||||
{
|
{
|
||||||
wxPoint text_offset;
|
wxPoint text_offset;
|
||||||
int width = GetPenSize();
|
int dist = GetEffectiveTextPenWidth();
|
||||||
int halfSize = GetTextWidth() / 2;
|
|
||||||
int offset = width;
|
|
||||||
|
|
||||||
switch( m_shape )
|
switch( m_shape )
|
||||||
{
|
{
|
||||||
case PINSHEETLABEL_SHAPE::PS_INPUT:
|
case PINSHEETLABEL_SHAPE::PS_INPUT:
|
||||||
case PINSHEETLABEL_SHAPE::PS_BIDI:
|
case PINSHEETLABEL_SHAPE::PS_BIDI:
|
||||||
case PINSHEETLABEL_SHAPE::PS_TRISTATE:
|
case PINSHEETLABEL_SHAPE::PS_TRISTATE:
|
||||||
offset += halfSize;
|
dist += GetTextWidth() / 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PINSHEETLABEL_SHAPE::PS_OUTPUT:
|
case PINSHEETLABEL_SHAPE::PS_OUTPUT:
|
||||||
case PINSHEETLABEL_SHAPE::PS_UNSPECIFIED:
|
case PINSHEETLABEL_SHAPE::PS_UNSPECIFIED:
|
||||||
offset += KiROUND( GetTextOffsetRatio() * GetTextSize().y );
|
dist += GetTextOffset( aSettings );
|
||||||
;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -826,18 +833,10 @@ wxPoint SCH_GLOBALLABEL::GetSchematicTextOffset() const
|
||||||
switch( GetLabelSpinStyle() )
|
switch( GetLabelSpinStyle() )
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case LABEL_SPIN_STYLE::LEFT:
|
case LABEL_SPIN_STYLE::LEFT: text_offset.x -= dist; break;
|
||||||
text_offset.x -= offset;
|
case LABEL_SPIN_STYLE::UP: text_offset.y -= dist; break;
|
||||||
break; // Orientation horiz normal
|
case LABEL_SPIN_STYLE::RIGHT: text_offset.x += dist; break;
|
||||||
case LABEL_SPIN_STYLE::UP:
|
case LABEL_SPIN_STYLE::BOTTOM: text_offset.y += dist; break;
|
||||||
text_offset.y -= offset;
|
|
||||||
break; // Orientation vert UP
|
|
||||||
case LABEL_SPIN_STYLE::RIGHT:
|
|
||||||
text_offset.x += offset;
|
|
||||||
break; // Orientation horiz inverse
|
|
||||||
case LABEL_SPIN_STYLE::BOTTOM:
|
|
||||||
text_offset.y += offset;
|
|
||||||
break; // Orientation vert BOTTOM
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return text_offset;
|
return text_offset;
|
||||||
|
@ -883,31 +882,30 @@ void SCH_GLOBALLABEL::SetLabelSpinStyle( LABEL_SPIN_STYLE aSpinStyle )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_GLOBALLABEL::Print( wxDC* DC, const wxPoint& aOffset )
|
void SCH_GLOBALLABEL::Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset )
|
||||||
{
|
{
|
||||||
static std::vector <wxPoint> Poly;
|
static std::vector <wxPoint> Poly;
|
||||||
|
|
||||||
COLOR4D color = GetLayerColor( m_Layer );
|
wxDC* DC = aSettings->GetPrintDC();
|
||||||
wxPoint text_offset = aOffset + GetSchematicTextOffset();
|
COLOR4D color = aSettings->GetLayerColor( m_Layer );
|
||||||
|
int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
|
||||||
|
wxPoint text_offset = aOffset + GetSchematicTextOffset( aSettings );
|
||||||
|
|
||||||
EDA_TEXT::Print( DC, text_offset, color );
|
EDA_TEXT::Print( aSettings, text_offset, color );
|
||||||
|
|
||||||
CreateGraphicShape( Poly, GetTextPos() + aOffset );
|
CreateGraphicShape( Poly, GetTextPos() + aOffset );
|
||||||
GRPoly( nullptr, DC, Poly.size(), &Poly[0], false, GetTextPenWidth(), color, color );
|
GRPoly( nullptr, DC, Poly.size(), &Poly[0], false, penWidth, color, color );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aPoints, const wxPoint& Pos )
|
void SCH_GLOBALLABEL::CreateGraphicShape( std::vector<wxPoint>& aPoints, const wxPoint& Pos )
|
||||||
{
|
{
|
||||||
int halfSize = GetTextHeight() / 2;
|
int halfSize = GetTextHeight() / 2;
|
||||||
|
int linewidth = GetPenWidth();
|
||||||
// Use the maximum clamped pen width to give us a bit of wiggle room
|
int symb_len = LenSize( GetShownText(), linewidth, m_textMarkupFlags ) + ( TXT_MARGIN * 2 );
|
||||||
int linewidth = Clamp_Text_PenSize( GetTextSize().x, GetTextSize(), IsBold() );
|
|
||||||
|
|
||||||
aPoints.clear();
|
aPoints.clear();
|
||||||
|
|
||||||
int symb_len = LenSize( GetShownText(), linewidth, GetTextMarkupFlags() ) + ( TXT_MARGIN * 2 );
|
|
||||||
|
|
||||||
// Create outline shape : 6 points
|
// Create outline shape : 6 points
|
||||||
int x = symb_len + linewidth + 3;
|
int x = symb_len + linewidth + 3;
|
||||||
|
|
||||||
|
@ -969,17 +967,10 @@ void SCH_GLOBALLABEL::CreateGraphicShape( std::vector <wxPoint>& aPoints, const
|
||||||
switch( GetLabelSpinStyle() )
|
switch( GetLabelSpinStyle() )
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case LABEL_SPIN_STYLE::LEFT:
|
case LABEL_SPIN_STYLE::LEFT: break;
|
||||||
break; // Orientation horiz normal
|
case LABEL_SPIN_STYLE::UP: angle = -900; break;
|
||||||
case LABEL_SPIN_STYLE::UP:
|
case LABEL_SPIN_STYLE::RIGHT: angle = 1800; break;
|
||||||
angle = -900;
|
case LABEL_SPIN_STYLE::BOTTOM: angle = 900; break;
|
||||||
break; // Orientation vert UP
|
|
||||||
case LABEL_SPIN_STYLE::RIGHT:
|
|
||||||
angle = 1800;
|
|
||||||
break; // Orientation horiz inverse
|
|
||||||
case LABEL_SPIN_STYLE::BOTTOM:
|
|
||||||
angle = 900;
|
|
||||||
break; // Orientation vert BOTTOM
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rotate outlines and move corners in real position
|
// Rotate outlines and move corners in real position
|
||||||
|
@ -1011,7 +1002,7 @@ const EDA_RECT SCH_GLOBALLABEL::GetBoundingBox() const
|
||||||
height = ( (GetTextHeight() * 15) / 10 ) + width + 2 * TXT_MARGIN;
|
height = ( (GetTextHeight() * 15) / 10 ) + width + 2 * TXT_MARGIN;
|
||||||
|
|
||||||
// text X size add height for triangular shapes(bidirectional)
|
// text X size add height for triangular shapes(bidirectional)
|
||||||
length = LenSize( GetShownText(), width, GetTextMarkupFlags() ) + height +
|
length = LenSize( GetShownText(), width, m_textMarkupFlags ) + height +
|
||||||
Mils2iu( DANGLING_SYMBOL_SIZE );
|
Mils2iu( DANGLING_SYMBOL_SIZE );
|
||||||
|
|
||||||
switch( GetLabelSpinStyle() ) // respect orientation
|
switch( GetLabelSpinStyle() ) // respect orientation
|
||||||
|
@ -1064,8 +1055,9 @@ BITMAP_DEF SCH_GLOBALLABEL::GetMenuImage() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SCH_HIERLABEL::SCH_HIERLABEL( const wxPoint& pos, const wxString& text, KICAD_T aType )
|
SCH_HIERLABEL::SCH_HIERLABEL( const wxPoint& pos, const wxString& text, KICAD_T aType,
|
||||||
: SCH_TEXT( pos, text, aType )
|
int aMarkupFlags )
|
||||||
|
: SCH_TEXT( pos, text, aType, aMarkupFlags )
|
||||||
{
|
{
|
||||||
m_Layer = LAYER_HIERLABEL;
|
m_Layer = LAYER_HIERLABEL;
|
||||||
m_shape = PINSHEETLABEL_SHAPE::PS_INPUT;
|
m_shape = PINSHEETLABEL_SHAPE::PS_INPUT;
|
||||||
|
@ -1121,22 +1113,25 @@ void SCH_HIERLABEL::SetLabelSpinStyle( LABEL_SPIN_STYLE aSpinStyle )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_HIERLABEL::Print( wxDC* DC, const wxPoint& offset )
|
void SCH_HIERLABEL::Print( RENDER_SETTINGS* aSettings, const wxPoint& offset )
|
||||||
{
|
{
|
||||||
static std::vector <wxPoint> Poly;
|
static std::vector <wxPoint> Poly;
|
||||||
|
|
||||||
auto conn = Connection( *g_CurrentSheet );
|
wxDC* DC = aSettings->GetPrintDC();
|
||||||
COLOR4D color = GetLayerColor( ( conn && conn->IsBus() ) ? LAYER_BUS : m_Layer );
|
SCH_CONNECTION* conn = Connection( *g_CurrentSheet );
|
||||||
wxPoint text_offset = offset + GetSchematicTextOffset();
|
bool isBus = conn && conn->IsBus();
|
||||||
|
COLOR4D color = aSettings->GetLayerColor( isBus ? LAYER_BUS : m_Layer );
|
||||||
|
int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
|
||||||
|
wxPoint textOffset = offset + GetSchematicTextOffset( aSettings );
|
||||||
|
|
||||||
EDA_TEXT::Print( DC, text_offset, color );
|
EDA_TEXT::Print( aSettings, textOffset, color );
|
||||||
|
|
||||||
CreateGraphicShape( Poly, GetTextPos() + offset );
|
CreateGraphicShape( Poly, GetTextPos() + offset );
|
||||||
GRPoly( nullptr, DC, Poly.size(), &Poly[0], false, GetTextPenWidth(), color, color );
|
GRPoly( nullptr, DC, Poly.size(), &Poly[0], false, penWidth, color, color );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_HIERLABEL::CreateGraphicShape( std::vector <wxPoint>& aPoints, const wxPoint& Pos )
|
void SCH_HIERLABEL::CreateGraphicShape( std::vector<wxPoint>& aPoints, const wxPoint& Pos )
|
||||||
{
|
{
|
||||||
int* Template = TemplateShape[static_cast<int>( m_shape )][static_cast<int>( m_spin_style )];
|
int* Template = TemplateShape[static_cast<int>( m_shape )][static_cast<int>( m_spin_style )];
|
||||||
int halfSize = GetTextWidth() / 2;
|
int halfSize = GetTextWidth() / 2;
|
||||||
|
@ -1160,19 +1155,17 @@ void SCH_HIERLABEL::CreateGraphicShape( std::vector <wxPoint>& aPoints, const wx
|
||||||
|
|
||||||
const EDA_RECT SCH_HIERLABEL::GetBoundingBox() const
|
const EDA_RECT SCH_HIERLABEL::GetBoundingBox() const
|
||||||
{
|
{
|
||||||
int x, y, dx, dy, length, height;
|
int penWidth = GetEffectiveTextPenWidth();
|
||||||
|
|
||||||
x = GetTextPos().x;
|
int x = GetTextPos().x;
|
||||||
y = GetTextPos().y;
|
int y = GetTextPos().y;
|
||||||
dx = dy = 0;
|
|
||||||
|
|
||||||
// Use the maximum clamped pen width to give us a bit of wiggle room
|
int height = GetTextHeight() + penWidth + 2 * TXT_MARGIN;
|
||||||
int width = Clamp_Text_PenSize( GetTextSize().x, GetTextSize(), IsBold() );
|
int length = LenSize( GetShownText(), penWidth, m_textMarkupFlags )
|
||||||
|
+ height // add height for triangular shapes
|
||||||
|
+ 2 * Mils2iu( DANGLING_SYMBOL_SIZE );
|
||||||
|
|
||||||
height = GetTextHeight() + width + 2 * TXT_MARGIN;
|
int dx, dy;
|
||||||
length = LenSize( GetShownText(), width, GetTextMarkupFlags() )
|
|
||||||
+ height // add height for triangular shapes
|
|
||||||
+ 2 * Mils2iu( DANGLING_SYMBOL_SIZE );
|
|
||||||
|
|
||||||
switch( GetLabelSpinStyle() )
|
switch( GetLabelSpinStyle() )
|
||||||
{
|
{
|
||||||
|
@ -1212,27 +1205,27 @@ const EDA_RECT SCH_HIERLABEL::GetBoundingBox() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxPoint SCH_HIERLABEL::GetSchematicTextOffset() const
|
wxPoint SCH_HIERLABEL::GetSchematicTextOffset( RENDER_SETTINGS* aSettings ) const
|
||||||
{
|
{
|
||||||
wxPoint text_offset;
|
wxPoint text_offset;
|
||||||
int thickness = GetPenSize();
|
int dist = GetTextOffset( aSettings ) + GetPenWidth();
|
||||||
int offset = KiROUND( GetTextOffsetRatio() * GetTextSize().y );
|
|
||||||
int total_offset = GetTextWidth() + offset + thickness;
|
dist += GetTextWidth();
|
||||||
|
|
||||||
switch( GetLabelSpinStyle() )
|
switch( GetLabelSpinStyle() )
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case LABEL_SPIN_STYLE::LEFT:
|
case LABEL_SPIN_STYLE::LEFT:
|
||||||
text_offset.x = -total_offset;
|
text_offset.x = -dist;
|
||||||
break; // Orientation horiz normale
|
break; // Orientation horiz normale
|
||||||
case LABEL_SPIN_STYLE::UP:
|
case LABEL_SPIN_STYLE::UP:
|
||||||
text_offset.y = -total_offset;
|
text_offset.y = -dist;
|
||||||
break; // Orientation vert UP
|
break; // Orientation vert UP
|
||||||
case LABEL_SPIN_STYLE::RIGHT:
|
case LABEL_SPIN_STYLE::RIGHT:
|
||||||
text_offset.x = total_offset;
|
text_offset.x = dist;
|
||||||
break; // Orientation horiz inverse
|
break; // Orientation horiz inverse
|
||||||
case LABEL_SPIN_STYLE::BOTTOM:
|
case LABEL_SPIN_STYLE::BOTTOM:
|
||||||
text_offset.y = total_offset;
|
text_offset.y = dist;
|
||||||
break; // Orientation vert BOTTOM
|
break; // Orientation vert BOTTOM
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue