~cern-kicad/kicad/kicad-pns-tom

« back to all changes in this revision

Viewing changes to common/worksheet.cpp

  • Committer: Maciej Suminski
  • Date: 2013-08-02 13:57:24 UTC
  • mfrom: (4024.1.238 kicad)
  • mto: This revision was merged to the branch mainline in revision 4221.
  • Revision ID: maciej.suminski@cern.ch-20130802135724-gix6orezshkukodv
Upstream merge.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
 
47
47
static const wxString productName = wxT( "KiCad E.D.A.  " );
48
48
 
49
 
/* Draws the item list crated by BuildWorkSheetGraphicList
50
 
 * aClipBox = the clipping rect, or NULL if no clipping
51
 
 * aDC = the current Device Context
52
 
 */
53
 
void WS_DRAW_ITEM_LIST::Draw( EDA_RECT* aClipBox, wxDC* aDC )
54
 
{
55
 
    for( WS_DRAW_ITEM_BASE* item = GetFirst(); item; item = GetNext() )
56
 
    {
57
 
        switch( item->GetType() )
58
 
        {
59
 
        case WS_DRAW_ITEM_BASE::wsg_line:
60
 
            {
61
 
                WS_DRAW_ITEM_LINE* line = (WS_DRAW_ITEM_LINE*) item;
62
 
                GRLine( aClipBox, aDC,
63
 
                        line->GetStart(), line->GetEnd(),
64
 
                        line->GetPenWidth(), line->GetColor() );
65
 
            }
66
 
            break;
67
 
 
68
 
        case WS_DRAW_ITEM_BASE::wsg_rect:
69
 
            {
70
 
                WS_DRAW_ITEM_RECT* rect = (WS_DRAW_ITEM_RECT*) item;
71
 
                GRRect( aClipBox, aDC,
72
 
                        rect->GetStart().x, rect->GetStart().y,
73
 
                        rect->GetEnd().x, rect->GetEnd().y,
74
 
                        rect->GetPenWidth(), rect->GetColor() );
75
 
            }
76
 
            break;
77
 
 
78
 
        case WS_DRAW_ITEM_BASE::wsg_text:
79
 
            {
80
 
                WS_DRAW_ITEM_TEXT* text = (WS_DRAW_ITEM_TEXT*) item;
81
 
                DrawGraphicText( aClipBox, aDC, text->GetTextPosition(),
82
 
                                 text->GetColor(), text->GetText(),
83
 
                                 text->GetOrientation(), text->GetSize(),
84
 
                                 text->GetHorizJustify(), text->GetVertJustify(),
85
 
                                 text->GetPenWidth(), text->IsItalic(), text->IsBold() );
86
 
            }
87
 
            break;
88
 
 
89
 
        case WS_DRAW_ITEM_BASE::wsg_poly:
90
 
            {
91
 
                WS_DRAW_ITEM_POLYGON* poly = (WS_DRAW_ITEM_POLYGON*) item;
92
 
                GRPoly( aClipBox, aDC,
93
 
                        poly->m_Corners.size(), &poly->m_Corners[0],
94
 
                        poly->IsFilled() ? FILLED_SHAPE : NO_FILL,
95
 
                        poly->GetPenWidth(),
96
 
                        poly->GetColor(), poly->GetColor() );
97
 
            }
98
 
            break;
99
 
        }
100
 
    }
101
 
}
102
 
 
103
49
void DrawPageLayout( wxDC* aDC, EDA_RECT* aClipBox,
104
50
                     const PAGE_INFO& aPageInfo,
105
51
                     const wxString &aFullSheetName,
112
58
    GRSetDrawMode( aDC, GR_COPY );
113
59
    WS_DRAW_ITEM_LIST drawList;
114
60
 
115
 
    wxPoint LTmargin( aPageInfo.GetLeftMarginMils(), aPageInfo.GetTopMarginMils() );
116
 
    wxPoint RBmargin( aPageInfo.GetRightMarginMils(), aPageInfo.GetBottomMarginMils() );
117
 
    wxSize pagesize = aPageInfo.GetSizeMils();
118
 
 
119
 
    drawList.SetMargins( LTmargin, RBmargin );
120
61
    drawList.SetPenSize( aPenWidth );
121
62
    drawList.SetMilsToIUfactor( aScalar );
122
 
    drawList.SetPageSize( pagesize );
123
63
    drawList.SetSheetNumber( aSheetNumber );
124
64
    drawList.SetSheetCount( aSheetCount );
 
65
    drawList.SetFileName( aFileName );
 
66
    drawList.SetSheetName( aFullSheetName );
125
67
 
126
 
    drawList.BuildWorkSheetGraphicList(
127
 
                               aPageInfo.GetType(), aFullSheetName, aFileName,
 
68
    drawList.BuildWorkSheetGraphicList( aPageInfo,
128
69
                               aTitleBlock, aColor, aAltColor );
129
70
 
130
71
    // Draw item list
154
95
    EDA_COLOR_T color = RED;
155
96
 
156
97
    DrawPageLayout( aDC, m_canvas->GetClipBox(), pageInfo,
157
 
                    aFilename, GetScreenDesc(), t_block,
 
98
                    GetScreenDesc(), aFilename, t_block,
158
99
                    aScreen->m_NumberOfScreens, aScreen->m_ScreenNumber,
159
100
                    aLineWidth, aScalar, color, color );
160
101
}
162
103
 
163
104
wxString EDA_DRAW_FRAME::GetScreenDesc()
164
105
{
165
 
    // Virtual function, in basic function, returns
 
106
    // Virtual function. In basic class, returns
166
107
    // an empty string.
167
108
    return wxEmptyString;
168
109
}