Commit 1ef311cd authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Pl_Editor: title block texts can be multiline (use" \n" : a '\' followed by a...

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.
parents eaea2ea1 71a40b0d
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -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" );
+2 −6
Original line number Diff line number Diff line
@@ -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.
}


+1 −1
Original line number Diff line number Diff line
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -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 )
+45 −60
Original line number Diff line number Diff line
@@ -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)
{
Loading