Pl_Editor: title block texts can be multiline (use" \n" : a '\' followed by a 'n' to create a new line inside a text)
Very minor code cleaning.
This commit is contained in:
commit
1ef311cd01
|
@ -509,13 +509,6 @@ void EDA_BASE_FRAME::CopyVersionInfoToClipboard( wxCommandEvent& event )
|
|||
tmp << wxT( "OFF\n" );
|
||||
#endif
|
||||
|
||||
tmp << wxT( " KICAD_GOST=" );
|
||||
#ifdef KICAD_GOST
|
||||
tmp << wxT( "ON\n" );
|
||||
#else
|
||||
tmp << wxT( "OFF\n" );
|
||||
#endif
|
||||
|
||||
tmp << wxT( " USE_WX_GRAPHICS_CONTEXT=" );
|
||||
#ifdef USE_WX_GRAPHICS_CONTEXT
|
||||
tmp << wxT( "ON\n" );
|
||||
|
|
|
@ -63,7 +63,6 @@ const wxString PAGE_INFO::Custom( wxT( "User" ) );
|
|||
#define MMsize( x, y ) wxSize( Mm2mils( x ), Mm2mils( y ) )
|
||||
|
||||
// All MUST be defined as landscape.
|
||||
// If IsGOST() is true, A4 is dynamically rotated later.
|
||||
const PAGE_INFO PAGE_INFO::pageA4( MMsize( 297, 210 ), wxT( "A4" ), wxPAPER_A4 );
|
||||
const PAGE_INFO PAGE_INFO::pageA3( MMsize( 420, 297 ), wxT( "A3" ), wxPAPER_A3 );
|
||||
const PAGE_INFO PAGE_INFO::pageA2( MMsize( 594, 420 ), wxT( "A2" ), wxPAPER_A2 );
|
||||
|
@ -127,16 +126,13 @@ inline void PAGE_INFO::updatePortrait()
|
|||
|
||||
|
||||
PAGE_INFO::PAGE_INFO( const wxSize& aSizeMils, const wxString& aType, wxPaperSize aPaperId ) :
|
||||
m_type( aType ),
|
||||
m_size( aSizeMils ),
|
||||
m_paper_id( aPaperId )
|
||||
m_type( aType ), m_size( aSizeMils ), m_paper_id( aPaperId )
|
||||
{
|
||||
updatePortrait();
|
||||
|
||||
// This constructor is protected, and only used by const PAGE_INFO's known
|
||||
// only to class implementation, so no further changes to "this" object are
|
||||
// expected. Therefore we should also setMargin() again when copying this
|
||||
// object in SetType() so that a runtime IsGOST() change does not break.
|
||||
// expected.
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -259,7 +259,7 @@ void EDA_TEXT::drawOneLineOfText( EDA_RECT* aClipBox, wxDC* aDC,
|
|||
if( aFillMode == LINE )
|
||||
width = 0;
|
||||
|
||||
if( aDrawMode != -1 )
|
||||
if( aDrawMode != UNSPECIFIED_DRAWMODE )
|
||||
GRSetDrawMode( aDC, aDrawMode );
|
||||
|
||||
// Draw text anchor, if requested
|
||||
|
|
|
@ -437,7 +437,7 @@ WORKSHEET_DATAITEM_TEXT::WORKSHEET_DATAITEM_TEXT( const wxChar* aTextBase ) :
|
|||
m_Hjustify = GR_TEXT_HJUSTIFY_LEFT;
|
||||
m_Vjustify = GR_TEXT_VJUSTIFY_CENTER;
|
||||
m_Orient = 0.0;
|
||||
m_LineWidth = 0.0; // 0.0 means use Dd
|
||||
m_LineWidth = 0.0; // 0.0 means use default value
|
||||
}
|
||||
|
||||
void WORKSHEET_DATAITEM_TEXT::TransfertSetupToGraphicText( WS_DRAW_ITEM_TEXT* aGText )
|
||||
|
|
|
@ -96,49 +96,7 @@ void WS_DRAW_ITEM_LIST::Draw( EDA_RECT* aClipBox, wxDC* aDC )
|
|||
if( item->GetParent() && item->GetParent()->IsSelected() )
|
||||
continue;
|
||||
|
||||
switch( item->GetType() )
|
||||
{
|
||||
case WS_DRAW_ITEM_BASE::wsg_line:
|
||||
{
|
||||
WS_DRAW_ITEM_LINE* line = (WS_DRAW_ITEM_LINE*) item;
|
||||
GRLine( aClipBox, aDC,
|
||||
line->GetStart(), line->GetEnd(),
|
||||
line->GetPenWidth(), line->GetColor() );
|
||||
}
|
||||
break;
|
||||
|
||||
case WS_DRAW_ITEM_BASE::wsg_rect:
|
||||
{
|
||||
WS_DRAW_ITEM_RECT* rect = (WS_DRAW_ITEM_RECT*) item;
|
||||
GRRect( aClipBox, aDC,
|
||||
rect->GetStart().x, rect->GetStart().y,
|
||||
rect->GetEnd().x, rect->GetEnd().y,
|
||||
rect->GetPenWidth(), rect->GetColor() );
|
||||
}
|
||||
break;
|
||||
|
||||
case WS_DRAW_ITEM_BASE::wsg_text:
|
||||
{
|
||||
WS_DRAW_ITEM_TEXT* text = (WS_DRAW_ITEM_TEXT*) item;
|
||||
DrawGraphicText( aClipBox, aDC, text->GetTextPosition(),
|
||||
text->GetColor(), text->GetText(),
|
||||
text->GetOrientation(), text->GetSize(),
|
||||
text->GetHorizJustify(), text->GetVertJustify(),
|
||||
text->GetPenWidth(), text->IsItalic(), text->IsBold() );
|
||||
}
|
||||
break;
|
||||
|
||||
case WS_DRAW_ITEM_BASE::wsg_poly:
|
||||
{
|
||||
WS_DRAW_ITEM_POLYGON* poly = (WS_DRAW_ITEM_POLYGON*) item;
|
||||
GRPoly( aClipBox, aDC,
|
||||
poly->m_Corners.size(), &poly->m_Corners[0],
|
||||
poly->IsFilled() ? FILLED_SHAPE : NO_FILL,
|
||||
poly->GetPenWidth(),
|
||||
poly->GetColor(), poly->GetColor() );
|
||||
}
|
||||
break;
|
||||
}
|
||||
item->DrawWsItem( aClipBox, aDC );
|
||||
}
|
||||
|
||||
// The selected items are drawn after (usually 0 or 1)
|
||||
|
@ -149,14 +107,13 @@ void WS_DRAW_ITEM_LIST::Draw( EDA_RECT* aClipBox, wxDC* aDC )
|
|||
if( !item->GetParent() || !item->GetParent()->IsSelected() )
|
||||
continue;
|
||||
|
||||
item->DrawWsItem( aClipBox, aDC );
|
||||
|
||||
switch( item->GetType() )
|
||||
{
|
||||
case WS_DRAW_ITEM_BASE::wsg_line:
|
||||
{
|
||||
WS_DRAW_ITEM_LINE* line = (WS_DRAW_ITEM_LINE*) item;
|
||||
GRLine( aClipBox, aDC,
|
||||
line->GetStart(), line->GetEnd(),
|
||||
line->GetPenWidth(), line->GetColor() );
|
||||
|
||||
if( markerSize )
|
||||
{
|
||||
|
@ -169,10 +126,6 @@ void WS_DRAW_ITEM_LIST::Draw( EDA_RECT* aClipBox, wxDC* aDC )
|
|||
case WS_DRAW_ITEM_BASE::wsg_rect:
|
||||
{
|
||||
WS_DRAW_ITEM_RECT* rect = (WS_DRAW_ITEM_RECT*) item;
|
||||
GRRect( aClipBox, aDC,
|
||||
rect->GetStart().x, rect->GetStart().y,
|
||||
rect->GetEnd().x, rect->GetEnd().y,
|
||||
rect->GetPenWidth(), rect->GetColor() );
|
||||
|
||||
if( markerSize )
|
||||
{
|
||||
|
@ -185,11 +138,6 @@ void WS_DRAW_ITEM_LIST::Draw( EDA_RECT* aClipBox, wxDC* aDC )
|
|||
case WS_DRAW_ITEM_BASE::wsg_text:
|
||||
{
|
||||
WS_DRAW_ITEM_TEXT* text = (WS_DRAW_ITEM_TEXT*) item;
|
||||
DrawGraphicText( aClipBox, aDC, text->GetTextPosition(),
|
||||
text->GetColor(), text->GetText(),
|
||||
text->GetOrientation(), text->GetSize(),
|
||||
text->GetHorizJustify(), text->GetVertJustify(),
|
||||
text->GetPenWidth(), text->IsItalic(), text->IsBold() );
|
||||
|
||||
if( markerSize )
|
||||
drawMarker( aClipBox, aDC, text->GetTextPosition(),
|
||||
|
@ -200,11 +148,6 @@ void WS_DRAW_ITEM_LIST::Draw( EDA_RECT* aClipBox, wxDC* aDC )
|
|||
case WS_DRAW_ITEM_BASE::wsg_poly:
|
||||
{
|
||||
WS_DRAW_ITEM_POLYGON* poly = (WS_DRAW_ITEM_POLYGON*) item;
|
||||
GRPoly( aClipBox, aDC,
|
||||
poly->m_Corners.size(), &poly->m_Corners[0],
|
||||
poly->IsFilled() ? FILLED_SHAPE : NO_FILL,
|
||||
poly->GetPenWidth(),
|
||||
poly->GetColor(), poly->GetColor() );
|
||||
|
||||
if( markerSize )
|
||||
{
|
||||
|
@ -217,6 +160,25 @@ void WS_DRAW_ITEM_LIST::Draw( EDA_RECT* aClipBox, wxDC* aDC )
|
|||
}
|
||||
}
|
||||
|
||||
WS_DRAW_ITEM_TEXT::WS_DRAW_ITEM_TEXT( WORKSHEET_DATAITEM* aParent,
|
||||
wxString& aText, wxPoint aPos, wxSize aSize,
|
||||
int aPenWidth, EDA_COLOR_T aColor,
|
||||
bool aItalic, bool aBold ) :
|
||||
WS_DRAW_ITEM_BASE( aParent, wsg_text, aColor ), EDA_TEXT( aText )
|
||||
{
|
||||
SetTextPosition( aPos );
|
||||
SetSize( aSize );
|
||||
SetThickness( aPenWidth );
|
||||
SetItalic( aItalic );
|
||||
SetBold( aBold );
|
||||
}
|
||||
|
||||
void WS_DRAW_ITEM_TEXT::DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC )
|
||||
{
|
||||
Draw( aClipBox, aDC, wxPoint(0,0),
|
||||
GetColor(), UNSPECIFIED_DRAWMODE, FILLED, UNSPECIFIED_COLOR );
|
||||
}
|
||||
|
||||
// return true if the point aPosition is on the text
|
||||
bool WS_DRAW_ITEM_TEXT::HitTest( const wxPoint& aPosition)
|
||||
{
|
||||
|
@ -236,6 +198,15 @@ bool WS_DRAW_ITEM_TEXT::HitTestStartPoint( const wxPoint& aPosition)
|
|||
return false;
|
||||
}
|
||||
|
||||
void WS_DRAW_ITEM_POLYGON::DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC )
|
||||
{
|
||||
GRPoly( aClipBox, aDC,
|
||||
m_Corners.size(), &m_Corners[0],
|
||||
IsFilled() ? FILLED_SHAPE : NO_FILL,
|
||||
GetPenWidth(),
|
||||
GetColor(), GetColor() );
|
||||
}
|
||||
|
||||
// return true if the point aPosition is inside one of polygons
|
||||
#include <polygon_test_point_inside.h>
|
||||
bool WS_DRAW_ITEM_POLYGON::HitTest( const wxPoint& aPosition)
|
||||
|
@ -257,6 +228,14 @@ bool WS_DRAW_ITEM_POLYGON::HitTestStartPoint( const wxPoint& aPosition)
|
|||
return false;
|
||||
}
|
||||
|
||||
void WS_DRAW_ITEM_RECT::DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC )
|
||||
{
|
||||
GRRect( aClipBox, aDC,
|
||||
GetStart().x, GetStart().y,
|
||||
GetEnd().x, GetEnd().y,
|
||||
GetPenWidth(), GetColor() );
|
||||
}
|
||||
|
||||
// return true if the point aPosition is on the rect outline
|
||||
bool WS_DRAW_ITEM_RECT::HitTest( const wxPoint& aPosition)
|
||||
{
|
||||
|
@ -318,6 +297,12 @@ bool WS_DRAW_ITEM_RECT::HitTestEndPoint( const wxPoint& aPosition)
|
|||
return false;
|
||||
}
|
||||
|
||||
void WS_DRAW_ITEM_LINE::DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC )
|
||||
{
|
||||
GRLine( aClipBox, aDC, GetStart(), GetEnd(),
|
||||
GetPenWidth(), GetColor() );
|
||||
}
|
||||
|
||||
// return true if the point aPosition is on the text
|
||||
bool WS_DRAW_ITEM_LINE::HitTest( const wxPoint& aPosition)
|
||||
{
|
||||
|
|
|
@ -85,7 +85,6 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
|
|||
#endif
|
||||
|
||||
#define milsTomm (25.4/1000)
|
||||
#define mmTomils (1000/25.4)
|
||||
|
||||
m_titleBlock = &aTitleBlock;
|
||||
m_paperFormat = &aPageInfo.GetType();
|
||||
|
@ -146,11 +145,16 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
|
|||
case WORKSHEET_DATAITEM::WS_TEXT:
|
||||
{
|
||||
WORKSHEET_DATAITEM_TEXT * wsText = (WORKSHEET_DATAITEM_TEXT*)wsItem;
|
||||
bool multilines = false;
|
||||
|
||||
if( wsText->m_SpecialMode )
|
||||
wsText->m_FullText = wsText->m_TextBase;
|
||||
else
|
||||
{
|
||||
wsText->m_FullText = BuildFullText( wsText->m_TextBase );
|
||||
if( wsText->m_FullText.Replace( wxT("\\n" ), wxT("\n") ) > 0 )
|
||||
multilines = true;
|
||||
}
|
||||
|
||||
if( wsText->m_FullText.IsEmpty() )
|
||||
break;
|
||||
|
@ -180,10 +184,12 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
|
|||
pensize, color,
|
||||
wsText->IsItalic(),
|
||||
wsText->IsBold() ) );
|
||||
gtext->SetMultilineAllowed( multilines );
|
||||
wsText->TransfertSetupToGraphicText( gtext );
|
||||
|
||||
// Increment label for the next text
|
||||
if( wsText->m_RepeatCount > 1 )
|
||||
// (has no meaning for multiline texts)
|
||||
if( wsText->m_RepeatCount > 1 && !multilines )
|
||||
wsText->IncrementLabel( (jj+1)*wsText->m_IncrementLabel);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -368,6 +368,7 @@ public:
|
|||
DSIZE m_ConstrainedTextSize;// Actual text size, if constrained by
|
||||
// the m_BoundingBoxSize constraint
|
||||
|
||||
|
||||
public:
|
||||
WORKSHEET_DATAITEM_TEXT( const wxChar* aTextBase );
|
||||
|
||||
|
|
|
@ -58,6 +58,10 @@ public:
|
|||
|
||||
WORKSHEET_DATAITEM* GetParent() { return m_parent; }
|
||||
|
||||
/** The function to draw a WS_DRAW_ITEM
|
||||
*/
|
||||
virtual void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC ) = 0;
|
||||
|
||||
/**
|
||||
* Abstract function: should exist for derived items
|
||||
* return true if the point aPosition is on the item
|
||||
|
@ -109,6 +113,10 @@ public:
|
|||
const wxPoint& GetStart() { return m_start; }
|
||||
const wxPoint& GetEnd() { return m_end; }
|
||||
|
||||
/** The function to draw a WS_DRAW_ITEM_LINE
|
||||
*/
|
||||
virtual void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC );
|
||||
|
||||
/**
|
||||
* Virtual function
|
||||
* return true if the point aPosition is on the line
|
||||
|
@ -155,6 +163,10 @@ public:
|
|||
bool IsFilled() { return m_fill; }
|
||||
const wxPoint& GetPosition() { return m_pos; }
|
||||
|
||||
/** The function to draw a WS_DRAW_ITEM_POLYGON
|
||||
*/
|
||||
virtual void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC );
|
||||
|
||||
/**
|
||||
* Virtual function
|
||||
* return true if the point aPosition is inside one polygon
|
||||
|
@ -179,6 +191,10 @@ public:
|
|||
m_type = wsg_rect;
|
||||
}
|
||||
|
||||
/** The function to draw a WS_DRAW_ITEM_RECT
|
||||
*/
|
||||
virtual void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC );
|
||||
|
||||
/**
|
||||
* Virtual function
|
||||
* return true if the point aPosition is on one edge of the rectangle
|
||||
|
@ -207,15 +223,11 @@ public:
|
|||
WS_DRAW_ITEM_TEXT( WORKSHEET_DATAITEM* aParent,
|
||||
wxString& aText, wxPoint aPos, wxSize aSize,
|
||||
int aPenWidth, EDA_COLOR_T aColor,
|
||||
bool aItalic = false, bool aBold = false ) :
|
||||
WS_DRAW_ITEM_BASE( aParent, wsg_text, aColor ), EDA_TEXT( aText )
|
||||
{
|
||||
SetTextPosition( aPos );
|
||||
SetSize( aSize );
|
||||
SetThickness( aPenWidth );
|
||||
SetItalic( aItalic );
|
||||
SetBold( aBold );
|
||||
}
|
||||
bool aItalic = false, bool aBold = false );
|
||||
|
||||
/** The function to draw a WS_DRAW_ITEM_TEXT
|
||||
*/
|
||||
virtual void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC );
|
||||
|
||||
// Accessors:
|
||||
int GetPenWidth() { return GetThickness(); }
|
||||
|
|
Loading…
Reference in New Issue