Convert remaining legacy drawing code to print code.

This commit is contained in:
Jeff Young 2019-05-31 13:15:25 +01:00
parent 03bab2f4a9
commit d6e9bdf07b
167 changed files with 896 additions and 3180 deletions

View File

@ -50,7 +50,7 @@
#include <class_text_mod.h>
#include <convert_basic_shapes_to_polygon.h>
#include <trigo.h>
#include <draw_graphic_text.h>
#include <gr_text.h>
#include <utility>
#include <vector>
@ -65,7 +65,7 @@ static float s_biuTo3Dunits;
static const CBBOX2D *s_boardBBox3DU = NULL;
static const BOARD_ITEM *s_boardItem = NULL;
// This is a call back function, used by DrawGraphicText to draw the 3D text shape:
// This is a call back function, used by GRText to draw the 3D text shape:
void addTextSegmToContainer( int x0, int y0, int xf, int yf, void* aData )
{
wxASSERT( s_boardBBox3DU != NULL );
@ -89,52 +89,47 @@ void addTextSegmToContainer( int x0, int y0, int xf, int yf, void* aData )
// Based on
// void TEXTE_PCB::TransformShapeWithClearanceToPolygonSet
// board_items_to_polygon_shape_transform.cpp
void CINFO3D_VISU::AddShapeWithClearanceToContainer( const TEXTE_PCB* aTextPCB,
void CINFO3D_VISU::AddShapeWithClearanceToContainer( const TEXTE_PCB* aText,
CGENERICCONTAINER2D *aDstContainer,
PCB_LAYER_ID aLayerId,
int aClearanceValue )
{
wxSize size = aTextPCB->GetTextSize();
wxSize size = aText->GetTextSize();
if( aTextPCB->IsMirrored() )
if( aText->IsMirrored() )
size.x = -size.x;
s_boardItem = (const BOARD_ITEM *)&aTextPCB;
s_boardItem = (const BOARD_ITEM *) &aText;
s_dstcontainer = aDstContainer;
s_textWidth = aTextPCB->GetThickness() + ( 2 * aClearanceValue );
s_textWidth = aText->GetThickness() + ( 2 * aClearanceValue );
s_biuTo3Dunits = m_biuTo3Dunits;
s_boardBBox3DU = &m_board2dBBox3DU;
// not actually used, but needed by DrawGraphicText
// not actually used, but needed by GRText
const COLOR4D dummy_color = COLOR4D::BLACK;
if( aTextPCB->IsMultilineAllowed() )
if( aText->IsMultilineAllowed() )
{
wxArrayString strings_list;
wxStringSplit( aTextPCB->GetShownText(), strings_list, '\n' );
wxStringSplit( aText->GetShownText(), strings_list, '\n' );
std::vector<wxPoint> positions;
positions.reserve( strings_list.Count() );
aTextPCB->GetPositionsOfLinesOfMultilineText( positions,
strings_list.Count() );
aText->GetPositionsOfLinesOfMultilineText( positions, strings_list.Count() );
for( unsigned ii = 0; ii < strings_list.Count(); ++ii )
{
wxString txt = strings_list.Item( ii );
DrawGraphicText( NULL, NULL, positions[ii], dummy_color,
txt, aTextPCB->GetTextAngle(), size,
aTextPCB->GetHorizJustify(), aTextPCB->GetVertJustify(),
aTextPCB->GetThickness(), aTextPCB->IsItalic(),
true, addTextSegmToContainer );
GRText( NULL, positions[ii], dummy_color, txt, aText->GetTextAngle(), size,
aText->GetHorizJustify(), aText->GetVertJustify(), aText->GetThickness(),
aText->IsItalic(), true, addTextSegmToContainer );
}
}
else
{
DrawGraphicText( NULL, NULL, aTextPCB->GetTextPos(), dummy_color,
aTextPCB->GetShownText(), aTextPCB->GetTextAngle(), size,
aTextPCB->GetHorizJustify(), aTextPCB->GetVertJustify(),
aTextPCB->GetThickness(), aTextPCB->IsItalic(),
true, addTextSegmToContainer );
GRText( NULL, aText->GetTextPos(), dummy_color, aText->GetShownText(),
aText->GetTextAngle(), size, aText->GetHorizJustify(), aText->GetVertJustify(),
aText->GetThickness(), aText->IsItalic(), true, addTextSegmToContainer );
}
}
@ -230,20 +225,17 @@ void CINFO3D_VISU::AddGraphicsShapesWithClearanceToContainer( const MODULE* aMod
s_biuTo3Dunits = m_biuTo3Dunits;
s_boardBBox3DU = &m_board2dBBox3DU;
for( unsigned ii = 0; ii < texts.size(); ++ii )
for( TEXTE_MODULE* text : texts )
{
TEXTE_MODULE *textmod = texts[ii];
s_textWidth = textmod->GetThickness() + ( 2 * aInflateValue );
wxSize size = textmod->GetTextSize();
s_textWidth = text->GetThickness() + ( 2 * aInflateValue );
wxSize size = text->GetTextSize();
if( textmod->IsMirrored() )
if( text->IsMirrored() )
size.x = -size.x;
DrawGraphicText( NULL, NULL, textmod->GetTextPos(), BLACK,
textmod->GetShownText(), textmod->GetDrawRotation(), size,
textmod->GetHorizJustify(), textmod->GetVertJustify(),
textmod->GetThickness(), textmod->IsItalic(),
true, addTextSegmToContainer );
GRText( NULL, text->GetTextPos(), BLACK, text->GetShownText(), text->GetDrawRotation(),
size, text->GetHorizJustify(), text->GetVertJustify(), text->GetThickness(),
text->IsItalic(), true, addTextSegmToContainer );
}
}

View File

@ -72,13 +72,11 @@ set( GAL_SRCS
set( LEGACY_GAL_SRCS
legacy_gal/eda_draw_frame.cpp
legacy_gal/other.cpp
)
set( LEGACY_WX_SRCS
legacy_wx/eda_draw_frame.cpp
legacy_wx/eda_draw_panel.cpp
legacy_wx/other.cpp
)
add_library( gal STATIC ${GAL_SRCS} )
@ -298,7 +296,7 @@ set( COMMON_SRCS
dialog_shim.cpp
displlst.cpp
dpi_scaling.cpp
draw_graphic_text.cpp
gr_text.cpp
dsnlexer.cpp
eagle_parser.cpp
eda_base_frame.cpp
@ -483,7 +481,7 @@ set( PCB_COMMON_SRCS
../pcbnew/legacy_plugin.cpp
../pcbnew/netlist_reader.cpp
../pcbnew/pad_custom_shape_functions.cpp
../pcbnew/pad_draw_functions.cpp
../pcbnew/pad_print_functions.cpp
../pcbnew/pcb_display_options.cpp
../pcbnew/pcb_draw_panel_gal.cpp
../pcbnew/pcb_general_settings.cpp

View File

@ -624,10 +624,8 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample()
WS_DATA_MODEL::SetAltInstance( m_pagelayout );
GRFilledRect( NULL, &memDC, 0, 0, m_layout_size.x, m_layout_size.y, WHITE, WHITE );
DrawPageLayout( &memDC, NULL, pageDUMMY,
emptyString, emptyString,
m_tb, m_screen->m_NumberOfScreens,
m_screen->m_ScreenNumber, 1, 1, DARKGRAY );
PrintPageLayout( &memDC, pageDUMMY, emptyString, emptyString, m_tb,
m_screen->m_NumberOfScreens, m_screen->m_ScreenNumber, 1, 1, DARKGRAY );
memDC.SelectObject( wxNullBitmap );
m_PageLayoutExampleBitmap->SetBitmap( *m_page_bitmap );

View File

@ -28,11 +28,10 @@
*/
#include <eda_text.h>
#include <draw_graphic_text.h>
#include <gr_text.h>
#include <eda_rect.h>
#include <macros.h>
#include <trigo.h> // RotatePoint
#include <class_drawpanel.h> // EDA_DRAW_PANEL
#include <basic_gal.h>
#include <base_units.h>
@ -293,9 +292,7 @@ bool EDA_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy
}
void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
COLOR4D aColor, GR_DRAWMODE aDrawMode,
EDA_DRAW_MODE_T aFillMode, COLOR4D aAnchor_color )
void EDA_TEXT::Print( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor, EDA_DRAW_MODE_T aFillMode )
{
if( IsMultilineAllowed() )
{
@ -310,21 +307,11 @@ void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
for( unsigned ii = 0; ii < strings.Count(); ii++ )
{
wxString& txt = strings.Item( ii );
drawOneLineOfText( aClipBox, aDC, aOffset, aColor,
aDrawMode, aFillMode, txt, positions[ii] );
printOneLineOfText( aDC, aOffset, aColor, aFillMode, txt, positions[ii] );
}
}
else
drawOneLineOfText( aClipBox, aDC, aOffset, aColor,
aDrawMode, aFillMode, GetShownText(), GetTextPos() );
// Draw text anchor, if requested
if( aAnchor_color != COLOR4D::UNSPECIFIED )
{
GRDrawAnchor( aClipBox, aDC,
GetTextPos().x + aOffset.x, GetTextPos().y + aOffset.y,
DIM_ANCRE_TEXTE, aAnchor_color );
}
printOneLineOfText( aDC, aOffset, aColor, aFillMode, GetShownText(), GetTextPos() );
}
@ -370,16 +357,12 @@ void EDA_TEXT::GetPositionsOfLinesOfMultilineText(
}
}
void EDA_TEXT::drawOneLineOfText( EDA_RECT* aClipBox, wxDC* aDC,
const wxPoint& aOffset, COLOR4D aColor,
GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aFillMode,
const wxString& aText, const wxPoint &aPos )
void EDA_TEXT::printOneLineOfText( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor,
EDA_DRAW_MODE_T aFillMode, const wxString& aText,
const wxPoint &aPos )
{
int width = GetThickness();
if( aDrawMode != UNSPECIFIED_DRAWMODE )
GRSetDrawMode( aDC, aDrawMode );
if( aFillMode == SKETCH )
width = -width;
@ -388,9 +371,8 @@ void EDA_TEXT::drawOneLineOfText( EDA_RECT* aClipBox, wxDC* aDC,
if( IsMirrored() )
size.x = -size.x;
DrawGraphicText( aClipBox, aDC, aOffset + aPos, aColor, aText, GetTextAngle(), size,
GetHorizJustify(), GetVertJustify(),
width, IsItalic(), IsBold() );
GRText( aDC, aOffset + aPos, aColor, aText, GetTextAngle(), size, GetHorizJustify(),
GetVertJustify(), width, IsItalic(), IsBold() );
}
@ -482,10 +464,9 @@ void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl
// Convert the text shape to a list of segment
// each segment is stored as 2 wxPoints: its starting point and its ending point
// we are using DrawGraphicText to create the segments.
// and therefore a call-back function is needed
// we are using GRText to create the segments and therefore a call-back function is needed
// This is a call back function, used by DrawGraphicText to put each segment in buffer
// This is a call back function, used by GRText to put each segment in buffer
static void addTextSegmToBuffer( int x0, int y0, int xf, int yf, void* aData )
{
std::vector<wxPoint>* cornerBuffer = static_cast<std::vector<wxPoint>*>( aData );
@ -493,6 +474,7 @@ static void addTextSegmToBuffer( int x0, int y0, int xf, int yf, void* aData )
cornerBuffer->push_back( wxPoint( xf, yf ) );
}
void EDA_TEXT::TransformTextShapeToSegmentList( std::vector<wxPoint>& aCornerBuffer ) const
{
wxSize size = GetTextSize();
@ -500,7 +482,7 @@ void EDA_TEXT::TransformTextShapeToSegmentList( std::vector<wxPoint>& aCornerBuf
if( IsMirrored() )
size.x = -size.x;
COLOR4D color = COLOR4D::BLACK; // not actually used, but needed by DrawGraphicText
COLOR4D color = COLOR4D::BLACK; // not actually used, but needed by GRText
if( IsMultilineAllowed() )
{
@ -513,19 +495,15 @@ void EDA_TEXT::TransformTextShapeToSegmentList( std::vector<wxPoint>& aCornerBuf
for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
{
wxString txt = strings_list.Item( ii );
DrawGraphicText( NULL, NULL, positions[ii], color,
txt, GetTextAngle(), size,
GetHorizJustify(), GetVertJustify(),
GetThickness(), IsItalic(),
true, addTextSegmToBuffer, &aCornerBuffer );
GRText( NULL, positions[ii], color, txt, GetTextAngle(), size, GetHorizJustify(),
GetVertJustify(), GetThickness(), IsItalic(), true, addTextSegmToBuffer,
&aCornerBuffer );
}
}
else
{
DrawGraphicText( NULL, NULL, GetTextPos(), color,
GetText(), GetTextAngle(), size,
GetHorizJustify(), GetVertJustify(),
GetThickness(), IsItalic(),
true, addTextSegmToBuffer, &aCornerBuffer );
GRText( NULL, GetTextPos(), color, GetText(), GetTextAngle(), size, GetHorizJustify(),
GetVertJustify(), GetThickness(), IsItalic(), true, addTextSegmToBuffer,
&aCornerBuffer );
}
}

View File

@ -37,7 +37,7 @@
#include <trigo.h>
#include <macros.h>
#include <base_screen.h>
#include <draw_graphic_text.h>
#include <gr_text.h>
#include <basic_gal.h>
@ -98,9 +98,8 @@ int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool aItalic,
/**
* Function DrawGraphicText
* Function GRText
* Draw a graphic text (like module texts)
* @param aClipBox = the clipping rect, or NULL if no clipping
* @param aDC = the current Device Context. NULL if draw within a 3D GL Canvas
* @param aPos = text position (according to h_justify, v_justify)
* @param aColor (COLOR4D) = text color
@ -122,23 +121,13 @@ int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool aItalic,
* @param aPlotter = a pointer to a PLOTTER instance, when this function is used to plot
* the text. NULL to draw this text.
*/
void DrawGraphicText( EDA_RECT* aClipBox,
wxDC* aDC,
const wxPoint& aPos,
COLOR4D aColor,
const wxString& aText,
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,
void (* aCallback)( int x0, int y0, int xf, int yf, void* aData ),
void* aCallbackData,
PLOTTER* aPlotter )
void GRText( wxDC* aDC, const wxPoint& aPos, COLOR4D aColor, const wxString& aText,
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,
void (* aCallback)( int x0, int y0, int xf, int yf, void* aData ),
void* aCallbackData, PLOTTER* aPlotter )
{
bool fill_mode = true;
bool fill_mode = true;
if( aWidth == 0 && aBold ) // Use default values if aWidth == 0
aWidth = GetPenSizeForBold( std::min( aSize.x, aSize.y ) );
@ -171,26 +160,18 @@ void DrawGraphicText( EDA_RECT* aClipBox,
basic_gal.SetCallback( aCallback, aCallbackData );
basic_gal.m_DC = aDC;
basic_gal.m_Color = aColor;
basic_gal.SetClipBox( aClipBox );
basic_gal.SetClipBox( nullptr );
basic_gal.StrokeText( aText, VECTOR2D( aPos ), aOrient * M_PI/1800 );
}
void DrawGraphicHaloText( EDA_RECT* aClipBox, wxDC * aDC,
const wxPoint &aPos,
const COLOR4D aBgColor,
COLOR4D aColor1,
COLOR4D aColor2,
const wxString &aText,
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,
void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ),
void* aCallbackData,
PLOTTER * aPlotter )
void GRHaloText( wxDC * aDC, const wxPoint &aPos, const COLOR4D aBgColor, COLOR4D aColor1,
COLOR4D aColor2, const wxString &aText, 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,
void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ),
void* aCallbackData, PLOTTER * aPlotter )
{
// Swap color if contrast would be better
// TODO: Maybe calculate contrast some way other than brightness
@ -202,19 +183,17 @@ void DrawGraphicHaloText( EDA_RECT* aClipBox, wxDC * aDC,
}
// Draw the background
DrawGraphicText( aClipBox, aDC, aPos, aColor1, aText, aOrient, aSize,
aH_justify, aV_justify, aWidth, aItalic, aBold,
aCallback, aCallbackData, aPlotter );
GRText( aDC, aPos, aColor1, aText, aOrient, aSize, aH_justify, aV_justify, aWidth, aItalic,
aBold, aCallback, aCallbackData, aPlotter );
// Draw the text
DrawGraphicText( aClipBox, aDC, aPos, aColor2, aText, aOrient, aSize,
aH_justify, aV_justify, aWidth/4, aItalic, aBold,
aCallback, aCallbackData, aPlotter );
GRText( aDC, aPos, aColor2, aText, aOrient, aSize, aH_justify, aV_justify, aWidth/4, aItalic,
aBold, aCallback, aCallbackData, aPlotter );
}
/**
* Function PLOTTER::Text
* same as DrawGraphicText, but plot graphic text insteed of draw it
* same as GRText, but plot graphic text insteed of draw it
* @param aPos = text position (according to aH_justify, aV_justify)
* @param aColor (COLOR4D) = text color
* @param aText = text to draw
@ -258,10 +237,8 @@ void PLOTTER::Text( const wxPoint& aPos,
SetColor( aColor );
DrawGraphicText( NULL, NULL, aPos, aColor, aText,
aOrient, aSize,
aH_justify, aV_justify,
textPensize, aItalic, aBold, nullptr, nullptr, this );
GRText( NULL, aPos, aColor, aText, aOrient, aSize, aH_justify, aV_justify, textPensize,
aItalic, aBold, nullptr, nullptr, this );
if( aWidth != textPensize )
SetCurrentLineWidth( aWidth, aData );

View File

@ -34,7 +34,6 @@
#include <msgpanel.h>
#include <draw_frame.h>
#include <confirm.h>
#include <kicad_device_context.h>
#include <dialog_helpers.h>
#include <lockfile.h>
#include <trace_helpers.h>
@ -86,14 +85,11 @@ BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, KIWAY_PLAYER )
END_EVENT_TABLE()
EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
FRAME_T aFrameType,
const wxString& aTitle,
const wxPoint& aPos, const wxSize& aSize,
EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
long aStyle, const wxString & aFrameName ) :
KIWAY_PLAYER( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName )
{
m_useSingleCanvasPane = false;
m_socketServer = nullptr;
m_mainToolBar = NULL;
m_drawToolBar = NULL;
@ -123,7 +119,6 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
m_showPageLimits = false;
m_drawBgColor = COLOR4D( BLACK ); // the background color of the draw canvas:
// BLACK for Pcbnew, BLACK or WHITE for eeschema
m_snapToGrid = true;
m_MsgFrameHeight = EDA_MSG_PANEL::GetRequiredHeight();
m_movingCursorWithKeyboard = false;
m_zoomLevelCoeff = 1.0;
@ -158,8 +153,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
// units display, Inches is bigger than mm
GetTextSize( _( "Inches" ), stsbar ).x + 10,
// Size for the panel used as "Current tool in play": will take longest string from
// void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent ) in pcbnew/edit.cpp
// Size for the "Current Tool" panel; longest string from SetToolID()
GetTextSize( wxT( "Add layer alignment target" ), stsbar ).x + 10,
};
@ -823,18 +817,10 @@ void EDA_DRAW_FRAME::FocusOnLocation( const wxPoint& aPos, bool aWarpCursor, boo
static const wxString productName = wxT( "KiCad E.D.A. " );
void DrawPageLayout( wxDC* aDC,
EDA_RECT* aClipBox,
const PAGE_INFO& aPageInfo,
const wxString& aFullSheetName,
const wxString& aFileName,
TITLE_BLOCK& aTitleBlock,
int aSheetCount,
int aSheetNumber,
int aPenWidth,
double aScalar,
COLOR4D aColor,
const wxString& aSheetLayer )
void PrintPageLayout( wxDC* aDC, const PAGE_INFO& aPageInfo, const wxString& aFullSheetName,
const wxString& aFileName, const TITLE_BLOCK& aTitleBlock, int aSheetCount,
int aSheetNumber, int aPenWidth, double aScalar, COLOR4D aColor,
const wxString& aSheetLayer )
{
WS_DRAW_ITEM_LIST drawList;
@ -849,44 +835,32 @@ void DrawPageLayout( wxDC* aDC,
drawList.BuildWorkSheetGraphicList( aPageInfo, aTitleBlock );
// Draw item list
drawList.Draw( aClipBox, aDC, aColor );
drawList.Print( aDC, aColor );
}
void EDA_DRAW_FRAME::DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth,
void EDA_DRAW_FRAME::PrintWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth,
double aScalar, const wxString &aFilename,
const wxString &aSheetLayer, COLOR4D aColor )
{
if( !m_showBorderAndTitleBlock )
return;
const PAGE_INFO& pageInfo = GetPageSettings();
wxSize pageSize = pageInfo.GetSizeMils();
// if not printing, draw the page limits:
if( !aScreen->m_IsPrinting && m_showPageLimits )
{
GRSetDrawMode( aDC, GR_COPY );
GRRect( m_canvas->GetClipBox(), aDC, 0, 0, pageSize.x * aScalar, pageSize.y * aScalar,
aLineWidth, m_drawBgColor == WHITE ? LIGHTGRAY : DARKDARKGRAY );
}
TITLE_BLOCK t_block = GetTitleBlock();
COLOR4D color = ( aColor != COLOR4D::UNSPECIFIED ) ? aColor : COLOR4D( RED );
wxPoint origin = aDC->GetDeviceOrigin();
if( aScreen->m_IsPrinting && origin.y > 0 )
if( origin.y > 0 )
{
aDC->SetDeviceOrigin( 0, 0 );
aDC->SetAxisOrientation( true, false );
}
DrawPageLayout( aDC, m_canvas->GetClipBox(), pageInfo, GetScreenDesc(), aFilename, t_block,
aScreen->m_NumberOfScreens, aScreen->m_ScreenNumber, aLineWidth, aScalar,
color, aSheetLayer );
PrintPageLayout( aDC, GetPageSettings(), GetScreenDesc(), aFilename, GetTitleBlock(),
aScreen->m_NumberOfScreens, aScreen->m_ScreenNumber, aLineWidth, aScalar,
color, aSheetLayer );
if( aScreen->m_IsPrinting && origin.y > 0 )
if( origin.y > 0 )
{
aDC->SetDeviceOrigin( origin.x, origin.y );
aDC->SetAxisOrientation( true, true );

View File

@ -1,10 +0,0 @@
#include "fctsys.h"
#include "gr_basic.h"
#include "class_drawpanel.h"
#include "marker_base.h"
void MARKER_BASE::DrawMarker( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset )
{
}

View File

@ -36,7 +36,6 @@
#include <msgpanel.h>
#include <draw_frame.h>
#include <confirm.h>
#include <kicad_device_context.h>
#include <dialog_helpers.h>
#include <base_units.h>
#include <math/box2.h>
@ -141,7 +140,6 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
m_showPageLimits = false;
m_drawBgColor = COLOR4D( BLACK ); // the background color of the draw canvas:
// BLACK for Pcbnew, BLACK or WHITE for eeschema
m_snapToGrid = true;
m_MsgFrameHeight = EDA_MSG_PANEL::GetRequiredHeight();
m_movingCursorWithKeyboard = false;
m_zoomLevelCoeff = 1.0;
@ -174,8 +172,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
// units display, Inches is bigger than mm
GetTextSize( _( "Inches" ), stsbar ).x + 10,
// Size for the panel used as "Current tool in play": will take longest string from
// void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent ) in pcbnew/edit.cpp
// Size for the "Current Tool" panel; longest string from SetToolID()
GetTextSize( wxT( "Add layer alignment target" ), stsbar ).x + 10,
};
@ -471,10 +468,6 @@ void EDA_DRAW_FRAME::SetToolID( int aId, int aCursor, const wxString& aToolMsg )
// Keep default cursor in toolbars
SetCursor( wxNullCursor );
// Change m_canvas cursor if requested.
if( m_canvas && aCursor >= 0 )
m_canvas->SetCurrentCursor( aCursor );
// Change GAL canvas cursor if requested.
if( aCursor >= 0 )
GetGalCanvas()->SetCurrentCursor( aCursor );
@ -915,18 +908,10 @@ void EDA_DRAW_FRAME::FocusOnLocation( const wxPoint& aPos, bool aWarpCursor, boo
}
void DrawPageLayout( wxDC* aDC,
EDA_RECT* aClipBox,
const PAGE_INFO& aPageInfo,
const wxString& aFullSheetName,
const wxString& aFileName,
TITLE_BLOCK& aTitleBlock,
int aSheetCount,
int aSheetNumber,
int aPenWidth,
double aScalar,
COLOR4D aColor,
const wxString& aSheetLayer )
void PrintPageLayout( wxDC* aDC, const PAGE_INFO& aPageInfo, const wxString& aFullSheetName,
const wxString& aFileName, const TITLE_BLOCK& aTitleBlock, int aSheetCount,
int aSheetNumber, int aPenWidth, double aScalar, COLOR4D aColor,
const wxString& aSheetLayer )
{
WS_DRAW_ITEM_LIST drawList;
@ -941,46 +926,32 @@ void DrawPageLayout( wxDC* aDC,
drawList.BuildWorkSheetGraphicList( aPageInfo, aTitleBlock );
// Draw item list
drawList.Draw( aClipBox, aDC, aColor );
drawList.Print( aDC, aColor );
}
void EDA_DRAW_FRAME::DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth,
double aScalar, const wxString &aFilename,
const wxString &aSheetLayer, COLOR4D aColor )
void EDA_DRAW_FRAME::PrintWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth,
double aScalar, const wxString &aFilename,
const wxString &aSheetLayer, COLOR4D aColor )
{
if( !m_showBorderAndTitleBlock )
return;
const PAGE_INFO& pageInfo = GetPageSettings();
wxSize pageSize = pageInfo.GetSizeMils();
// if not printing, draw the page limits:
if( !aScreen->m_IsPrinting && m_showPageLimits )
{
GRSetDrawMode( aDC, GR_COPY );
GRRect( m_canvas->GetClipBox(), aDC, 0, 0,
pageSize.x * aScalar, pageSize.y * aScalar, aLineWidth,
m_drawBgColor == WHITE ? LIGHTGRAY : DARKDARKGRAY );
}
TITLE_BLOCK t_block = GetTitleBlock();
COLOR4D color = ( aColor != COLOR4D::UNSPECIFIED ) ? aColor : COLOR4D( RED );
wxPoint origin = aDC->GetDeviceOrigin();
if( aScreen->m_IsPrinting && origin.y > 0 )
if( origin.y > 0 )
{
aDC->SetDeviceOrigin( 0, 0 );
aDC->SetAxisOrientation( true, false );
}
DrawPageLayout( aDC, m_canvas->GetClipBox(), pageInfo,
GetScreenDesc(), aFilename, t_block,
aScreen->m_NumberOfScreens, aScreen->m_ScreenNumber,
aLineWidth, aScalar, color, aSheetLayer );
PrintPageLayout( aDC, GetPageSettings(), GetScreenDesc(), aFilename, GetTitleBlock(),
aScreen->m_NumberOfScreens, aScreen->m_ScreenNumber, aLineWidth, aScalar,
color, aSheetLayer );
if( aScreen->m_IsPrinting && origin.y > 0 )
if( origin.y > 0 )
{
aDC->SetDeviceOrigin( origin.x, origin.y );
aDC->SetAxisOrientation( true, true );
@ -990,8 +961,7 @@ void EDA_DRAW_FRAME::DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWi
wxString EDA_DRAW_FRAME::GetScreenDesc() const
{
// Virtual function. In basic class, returns
// an empty string.
// Virtual function. In basic class, returns an empty string.
return wxEmptyString;
}

View File

@ -32,9 +32,6 @@
#include <class_drawpanel.h>
#include <base_screen.h>
#include <trace_helpers.h>
#include <kicad_device_context.h>
#define CLIP_BOX_PADDING 2
#ifdef __WXMAC__
@ -52,31 +49,9 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, const wxPoint& p
ShowScrollbars( wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS );
DisableKeyboardScrolling();
m_scrollIncrementX = std::min( size.x / 8, 10 );
m_scrollIncrementY = std::min( size.y / 8, 10 );
SetLayoutDirection( wxLayout_LeftToRight );
SetBackgroundColour( parent->GetDrawBgColor().ToColour() );
#if KICAD_USE_BUFFERED_DC || KICAD_USE_BUFFERED_PAINTDC
SetBackgroundStyle( wxBG_STYLE_CUSTOM );
#endif
m_ClipBox.SetSize( size );
m_ClipBox.SetX( 0 );
m_ClipBox.SetY( 0 );
#ifdef __WXMAC__
m_defaultCursor = m_currentCursor = wxCURSOR_CROSS;
m_showCrossHair = false;
#else
m_defaultCursor = m_currentCursor = wxCURSOR_ARROW;
m_showCrossHair = true;
#endif
m_cursorLevel = 0;
m_PrintIsMirrored = false;
}
@ -92,12 +67,6 @@ EDA_DRAW_FRAME* EDA_DRAW_PANEL::GetParent() const
}
void* EDA_DRAW_PANEL::GetDisplayOptions()
{
return GetParent()->GetDisplayOptions();
}
BASE_SCREEN* EDA_DRAW_PANEL::GetScreen()
{
EDA_DRAW_FRAME* parentFrame = GetParent();
@ -111,84 +80,3 @@ void EDA_DRAW_PANEL::Refresh( bool eraseBackground, const wxRect* rect )
GetParent()->GetGalCanvas()->Refresh();
}
wxPoint EDA_DRAW_PANEL::GetScreenCenterLogicalPosition()
{
wxSize size = GetClientSize() / 2;
INSTALL_UNBUFFERED_DC( dc, this );
return wxPoint( dc.DeviceToLogicalX( size.x ), dc.DeviceToLogicalY( size.y ) );
}
void EDA_DRAW_PANEL::SetClipBox( wxDC& aDC, const wxRect* aRect )
{
wxRect clipBox;
// Use the entire visible device area if no clip area was defined.
if( aRect == NULL )
{
BASE_SCREEN* Screen = GetScreen();
if( !Screen )
return;
Screen->m_StartVisu = CalcUnscrolledPosition( wxPoint( 0, 0 ) );
clipBox.SetSize( GetClientSize() );
int scrollX, scrollY;
double scalar = Screen->GetScalingFactor();
scrollX = KiROUND( Screen->GetGridSize().x * scalar );
scrollY = KiROUND( Screen->GetGridSize().y * scalar );
m_scrollIncrementX = std::max( GetClientSize().x / 8, scrollX );
m_scrollIncrementY = std::max( GetClientSize().y / 8, scrollY );
Screen->m_ScrollbarPos.x = GetScrollPos( wxHORIZONTAL );
Screen->m_ScrollbarPos.y = GetScrollPos( wxVERTICAL );
}
else
{
clipBox = *aRect;
}
// Pad clip box in device units.
clipBox.Inflate( CLIP_BOX_PADDING );
// Convert from device units to drawing units.
m_ClipBox.SetOrigin( wxPoint( aDC.DeviceToLogicalX( clipBox.x ),
aDC.DeviceToLogicalY( clipBox.y ) ) );
m_ClipBox.SetSize( wxSize( aDC.DeviceToLogicalXRel( clipBox.width ),
aDC.DeviceToLogicalYRel( clipBox.height ) ) );
wxLogTrace( kicadTraceCoords,
wxT( "Device clip box=(%d, %d, %d, %d), Logical clip box=(%d, %d, %d, %d)" ),
clipBox.x, clipBox.y, clipBox.width, clipBox.height,
m_ClipBox.GetX(), m_ClipBox.GetY(), m_ClipBox.GetWidth(), m_ClipBox.GetHeight() );
}
void EDA_DRAW_PANEL::DoPrepareDC( wxDC& dc )
{
wxScrolledWindow::DoPrepareDC( dc );
if( GetScreen() != NULL )
{
double scale = GetScreen()->GetScalingFactor();
dc.SetUserScale( scale, scale );
wxPoint pt = GetScreen()->m_DrawOrg;
dc.SetLogicalOrigin( pt.x, pt.y );
}
SetClipBox( dc ); // Reset the clip box to the entire screen.
GRResetPenAndBrush( &dc );
dc.SetBackgroundMode( wxTRANSPARENT );
}
void EDA_DRAW_PANEL::OnCharHook( wxKeyEvent& event )
{
wxLogTrace( kicadTraceKeyEvent, "EDA_DRAW_PANEL::OnCharHook %s", dump( event ) );
event.Skip();
}

View File

@ -1,35 +0,0 @@
#include "fctsys.h"
#include "gr_basic.h"
#include "base_screen.h"
#include "common.h"
#include "macros.h"
#include "class_drawpanel.h"
#include "marker_base.h"
#include "dialog_display_info_HTML_base.h"
void MARKER_BASE::DrawMarker( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset )
{
// Build the marker shape polygon in internal units:
const int ccount = GetShapePolygonCornerCount();
std::vector<wxPoint> shape;
shape.reserve( ccount );
for( int ii = 0; ii < ccount; ii++ )
{
shape.push_back( wxPoint( GetShapePolygonCorner( ii ).x * MarkerScale(),
GetShapePolygonCorner( ii ).y * MarkerScale() ) );
}
for( int ii = 0; ii < ccount; ii++ )
{
shape[ii] += m_Pos + aOffset;
}
GRClosedPoly( aPanel->GetClipBox(), aDC, ccount, &shape[0],
true, // = Filled
0, // outline width
m_Color, // outline color
m_Color // fill collor
);
}

View File

@ -235,3 +235,23 @@ void MARKER_BASE::DisplayMarkerInfo( EDA_DRAW_FRAME* aFrame )
infodisplay.m_htmlWindow->SetPage( msg );
infodisplay.ShowModal();
}
void MARKER_BASE::PrintMarker( wxDC* aDC, const wxPoint& aOffset )
{
// Build the marker shape polygon in internal units:
const int ccount = GetShapePolygonCornerCount();
std::vector<wxPoint> shape;
shape.reserve( ccount );
for( int ii = 0; ii < ccount; ii++ )
{
shape.push_back( wxPoint( GetShapePolygonCorner( ii ).x * MarkerScale(),
GetShapePolygonCorner( ii ).y * MarkerScale() ) );
}
for( int ii = 0; ii < ccount; ii++ )
shape[ii] += m_Pos + aOffset;
GRClosedPoly( nullptr, aDC, ccount, &shape[0], true, 0, m_Color, m_Color );
}

View File

@ -50,7 +50,7 @@
*/
#include <fctsys.h>
#include <draw_graphic_text.h>
#include <gr_text.h>
#include <eda_rect.h>
#include <view/view.h>
#include <ws_painter.h>

View File

@ -46,7 +46,7 @@
#include <fctsys.h>
#include <kiface_i.h>
#include <draw_graphic_text.h>
#include <gr_text.h>
#include <ws_painter.h>
#include <title_block.h>
#include <ws_draw_item.h>

View File

@ -50,7 +50,7 @@
#include <fctsys.h>
#include <eda_rect.h>
#include <draw_graphic_text.h>
#include <gr_text.h>
#include <ws_draw_item.h>
#include <ws_data_model.h>
#include <base_units.h>
@ -145,10 +145,9 @@ void WS_DRAW_ITEM_BASE::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aL
// ============================ TEXT ==============================
void WS_DRAW_ITEM_TEXT::DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
GR_DRAWMODE aDrawMode, COLOR4D aColor )
void WS_DRAW_ITEM_TEXT::PrintWsItem( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor )
{
Draw( aClipBox, aDC, aOffset, aColor, GR_COPY, FILLED, COLOR4D::UNSPECIFIED );
Print( aDC, aOffset, aColor, FILLED );
}
@ -181,8 +180,7 @@ wxString WS_DRAW_ITEM_TEXT::GetSelectMenuText( EDA_UNITS_T aUnits ) const
// ============================ POLYGON ==============================
void WS_DRAW_ITEM_POLYGON::DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
GR_DRAWMODE aDrawMode, COLOR4D aColor )
void WS_DRAW_ITEM_POLYGON::PrintWsItem( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor )
{
std::vector<wxPoint> points_moved;
wxPoint *points;
@ -199,7 +197,7 @@ void WS_DRAW_ITEM_POLYGON::DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPo
points = &m_Corners[0];
}
GRPoly( aClipBox, aDC, m_Corners.size(), points, IsFilled() ? FILLED_SHAPE : NO_FILL,
GRPoly( nullptr, aDC, m_Corners.size(), points, IsFilled() ? FILLED_SHAPE : NO_FILL,
GetPenWidth(), aColor, aColor );
}
@ -268,13 +266,10 @@ wxString WS_DRAW_ITEM_POLYGON::GetSelectMenuText( EDA_UNITS_T aUnits ) const
// ============================ RECT ==============================
void WS_DRAW_ITEM_RECT::DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
GR_DRAWMODE aDrawMode, COLOR4D aColor )
void WS_DRAW_ITEM_RECT::PrintWsItem( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor )
{
GRRect( aClipBox, aDC,
GetStart().x + aOffset.x, GetStart().y + aOffset.y,
GetEnd().x + aOffset.x, GetEnd().y + aOffset.y,
GetPenWidth(), aColor );
GRRect( nullptr, aDC, GetStart().x + aOffset.x, GetStart().y + aOffset.y,
GetEnd().x + aOffset.x, GetEnd().y + aOffset.y, GetPenWidth(), aColor );
}
@ -330,10 +325,9 @@ wxString WS_DRAW_ITEM_RECT::GetSelectMenuText( EDA_UNITS_T aUnits ) const
// ============================ LINE ==============================
void WS_DRAW_ITEM_LINE::DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
GR_DRAWMODE aDrawMode, COLOR4D aColor )
void WS_DRAW_ITEM_LINE::PrintWsItem( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor )
{
GRLine( aClipBox, aDC, GetStart() + aOffset, GetEnd() + aOffset, GetPenWidth(), aColor );
GRLine( nullptr, aDC, GetStart() + aOffset, GetEnd() + aOffset, GetPenWidth(), aColor );
}
@ -362,17 +356,12 @@ wxString WS_DRAW_ITEM_LINE::GetSelectMenuText( EDA_UNITS_T aUnits ) const
// ============== BITMAP ================
void WS_DRAW_ITEM_BITMAP::DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
GR_DRAWMODE aDrawMode, COLOR4D aColor )
void WS_DRAW_ITEM_BITMAP::PrintWsItem( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor )
{
WS_DATA_ITEM_BITMAP* bitmap = (WS_DATA_ITEM_BITMAP*) GetPeer();
if( bitmap->m_ImageBitmap )
{
GRSetDrawMode( aDC, ( aDrawMode == UNSPECIFIED_DRAWMODE ) ? GR_COPY : aDrawMode );
bitmap->m_ImageBitmap->DrawBitmap( aDC, m_pos + aOffset );
GRSetDrawMode( aDC, GR_COPY );
}
}
@ -423,17 +412,16 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList( const PAGE_INFO& aPageInfo,
}
/* Draws the item list created by BuildWorkSheetGraphicList
* aClipBox = the clipping rect, or NULL if no clipping
/* Print the item list created by BuildWorkSheetGraphicList
* aDC = the current Device Context
* The not selected items are drawn first (most of items)
* The selected items are drawn after (usually 0 or 1)
* to be sure they are seen, even for overlapping items
*/
void WS_DRAW_ITEM_LIST::Draw( EDA_RECT* aClipBox, wxDC* aDC, COLOR4D aColor )
void WS_DRAW_ITEM_LIST::Print( wxDC* aDC, COLOR4D aColor )
{
for( WS_DRAW_ITEM_BASE* item = GetFirst(); item; item = GetNext() )
item->DrawWsItem( aClipBox, aDC, aColor );
item->PrintWsItem( aDC, aColor );
}

View File

@ -27,7 +27,7 @@
#include <plotter.h>
#include <ws_painter.h>
#include <base_screen.h>
#include <draw_graphic_text.h>
#include <gr_text.h>
#include <title_block.h>
#include "ws_draw_item.h"
#include "ws_data_item.h"

View File

@ -46,7 +46,7 @@
#include <plotter.h>
#include <macros.h>
#include <base_screen.h>
#include <draw_graphic_text.h>
#include <gr_text.h>
#include <geometry/shape_line_chain.h>
#include <geometry/geometry_utils.h>

View File

@ -167,10 +167,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aPa
auto& galOpts = GetGalDisplayOptions();
galOpts.m_axesEnabled = true;
// Set up viewport
KIGFX::VIEW* view = GetGalCanvas()->GetView();
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetScreen()->GetZoom() );
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
GetGalCanvas()->GetView()->SetScale( GetZoomLevelCoeff() / m_canvas->GetScreen()->GetZoom() );
ActivateGalCanvas();
@ -517,12 +514,9 @@ void DISPLAY_FOOTPRINTS_FRAME::SyncMenusAndToolbars()
/*
* Redraw the BOARD items but not cursors, axis or grid.
*/
void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
GR_DRAWMODE aDrawMode, const wxPoint& aOffset )
void BOARD::Print( PCB_BASE_FRAME* aFrame, wxDC* aDC, const wxPoint& aOffset )
{
if( m_Modules )
{
m_Modules->Draw( aPanel, aDC, GR_COPY );
}
m_Modules->Print( aFrame, aDC );
}

View File

@ -367,14 +367,14 @@ void LIB_PART::SetName( const wxString& aName )
}
void LIB_PART::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOffset,
int aMulti, int aConvert, const PART_DRAW_OPTIONS& aOpts )
void LIB_PART::Print( wxDC* aDc, const wxPoint& aOffset, int aMulti, int aConvert,
const PART_DRAW_OPTIONS& aOpts )
{
/* draw background for filled items using background option
* Solid lines will be drawn after the background
* Note also, background is not drawn when printing in black and white
*/
if( ! GetGRForceBlackPenState() )
if( !GetGRForceBlackPenState() )
{
for( LIB_ITEM& drawItem : m_drawings )
{
@ -393,7 +393,7 @@ void LIB_PART::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOffset,
// Now, draw only the background for items with
// m_Fill == FILLED_WITH_BG_BODYCOLOR:
drawItem.Draw( aPanel, aDc, aOffset, (void*) false, aOpts.transform );
drawItem.Print( aDc, aOffset, (void*) false, aOpts.transform );
}
}
@ -419,16 +419,16 @@ void LIB_PART::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOffset,
if( drawItem.Type() == LIB_PIN_T )
{
drawItem.Draw( aPanel, aDc, aOffset, (void*) aOpts.show_elec_type, aOpts.transform );
drawItem.Print( aDc, aOffset, (void*) aOpts.show_elec_type, aOpts.transform );
}
else if( drawItem.Type() == LIB_FIELD_T )
{
drawItem.Draw( aPanel, aDc, aOffset, (void*) NULL, aOpts.transform );
drawItem.Print( aDc, aOffset, (void*) NULL, aOpts.transform );
}
else
{
bool forceNoFill = drawItem.m_Fill == FILLED_WITH_BG_BODYCOLOR;
drawItem.Draw( aPanel, aDc, aOffset, (void*) forceNoFill, aOpts.transform );
drawItem.Print( aDc, aOffset, (void*) forceNoFill, aOpts.transform );
}
}
}
@ -514,7 +514,7 @@ void LIB_PART::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert,
}
void LIB_PART::RemoveDrawItem( LIB_ITEM* aItem, EDA_DRAW_PANEL* aPanel, wxDC* aDc )
void LIB_PART::RemoveDrawItem( LIB_ITEM* aItem )
{
wxASSERT( aItem != NULL );

View File

@ -436,17 +436,16 @@ public:
LIB_FIELD& GetFootprintField();
/**
* Draw part.
* Print part.
*
* @param aPanel - Window to draw on. Can be NULL if not available.
* @param aDc - Device context to draw on.
* @param aOffset - Position of part.
* @param aMulti - unit if multiple units per part.
* @param aConvert - Component conversion (DeMorgan) if available.
* @param aOpts - Drawing options
*/
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOffset,
int aMulti, int aConvert, const PART_DRAW_OPTIONS& aOpts );
void Print( wxDC* aDc, const wxPoint& aOffset, int aMulti, int aConvert,
const PART_DRAW_OPTIONS& aOpts );
/**
* Plot lib part to plotter.
@ -460,7 +459,7 @@ public:
* @param aTransform - Component plot transform matrix.
*/
void Plot( PLOTTER* aPlotter, int aUnit, int aConvert, const wxPoint& aOffset,
const TRANSFORM& aTransform );
const TRANSFORM& aTransform );
/**
* Plot Lib Fields only of the part to plotter.
@ -472,8 +471,8 @@ public:
* @param aOffset - Distance to shift the plot coordinates.
* @param aTransform - Component plot transform matrix.
*/
void PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert,
const wxPoint& aOffset, const TRANSFORM& aTransform );
void PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, const wxPoint& aOffset,
const TRANSFORM& aTransform );
/**
* Add a new draw \a aItem to the draw object list.
@ -486,10 +485,8 @@ public:
* Remove draw \a aItem from list.
*
* @param aItem - Draw item to remove from list.
* @param aPanel - Panel to remove part from.
* @param aDc - Device context to remove part from.
*/
void RemoveDrawItem( LIB_ITEM* aItem, EDA_DRAW_PANEL* aPanel = NULL, wxDC* aDc = NULL );
void RemoveDrawItem( LIB_ITEM* aItem );
/**
* Return the next draw object pointer.
@ -557,7 +554,7 @@ public:
* @param aTestLength - Whether two pins at the same point must have the same length.
*/
bool PinsConflictWith( LIB_PART& aOtherPart, bool aTestNums, bool aTestNames,
bool aTestType, bool aTestOrientation, bool aTestLength );
bool aTestType, bool aTestOrientation, bool aTestLength );
/**
* Move the part \a aOffset.
@ -604,8 +601,8 @@ public:
* @param aTransform = the transform matrix
* @return The draw object if found. Otherwise NULL.
*/
LIB_ITEM* LocateDrawItem( int aUnit, int aConvert, KICAD_T aType,
const wxPoint& aPoint, const TRANSFORM& aTransform );
LIB_ITEM* LocateDrawItem( int aUnit, int aConvert, KICAD_T aType, const wxPoint& aPoint,
const TRANSFORM& aTransform );
/**
* Return a reference to the draw item list.
@ -630,7 +627,6 @@ public:
* @param count - Number of units per package.
*/
void SetUnitCount( int count );
int GetUnitCount() const { return m_unitCount; }
/**
@ -656,7 +652,6 @@ public:
* only for read/save setting functions
*/
static int* SubpartIdSeparatorPtr() { return &m_subpartIdSeparator; }
static int GetSubpartFirstId() { return m_subpartFirstId; }
/** return a reference to m_subpartFirstId, only for read/save setting functions
@ -696,7 +691,6 @@ public:
* @param aOffset - The offset in mils.
*/
void SetPinNameOffset( int aOffset ) { m_pinNameOffset = aOffset; }
int GetPinNameOffset() { return m_pinNameOffset; }
/**
@ -705,7 +699,6 @@ public:
* @param aShow - True to make the part pin names visible.
*/
void SetShowPinNames( bool aShow ) { m_showPinNames = aShow; }
bool ShowPinNames() { return m_showPinNames; }
/**
@ -714,7 +707,6 @@ public:
* @param aShow - True to make the part pin numbers visible.
*/
void SetShowPinNumbers( bool aShow ) { m_showPinNumbers = aShow; }
bool ShowPinNumbers() { return m_showPinNumbers; }
bool operator==( const LIB_PART* aPart ) const { return this == aPart; }

View File

@ -35,7 +35,7 @@
#include <sch_draw_panel.h>
#include <general.h>
#include <draw_graphic_text.h>
#include <gr_text.h>
#include <confirm.h>
#include <sch_text.h>
#include <typeinfo>

View File

@ -169,7 +169,7 @@ void DIALOG_LIB_EDIT_PIN::OnPaintShowPanel( wxPaintEvent& event )
dc.SetUserScale( scale, scale );
GRResetPenAndBrush( &dc );
m_dummyPin->Draw( nullptr, &dc, -bBox.Centre(), (void*)0, DefaultTransform );
m_dummyPin->Print( &dc, -bBox.Centre(), (void*)0, DefaultTransform );
m_dummyPin->SetParent( nullptr );

View File

@ -88,7 +88,7 @@ public:
bool HasPage( int page ) override;
bool OnBeginDocument( int startPage, int endPage ) override;
void GetPageInfo( int* minPage, int* maxPage, int* selPageFrom, int* selPageTo ) override;
void DrawPage( SCH_SCREEN* aScreen );
void PrintPage( SCH_SCREEN* aScreen );
};
@ -321,7 +321,7 @@ bool SCH_PRINTOUT::OnPrintPage( int page )
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
screen = m_parent->GetCurrentSheet().LastScreen();
DrawPage( screen );
PrintPage( screen );
m_parent->SetCurrentSheet( oldsheetpath );
m_parent->GetCurrentSheet().UpdateAllScreenReferences();
m_parent->SetSheetNumberAndCount();
@ -369,16 +369,14 @@ bool SCH_PRINTOUT::OnBeginDocument( int startPage, int endPage )
/*
* This is the real print function: print the active screen
*/
void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen )
{
int oldZoom;
wxPoint tmp_startvisu;
wxSize pageSizeIU; // Page size in internal units
wxPoint old_org;
EDA_RECT oldClipBox;
wxRect fitRect;
wxDC* dc = GetDC();
auto panel = m_parent->GetCanvas();
wxBusyCursor dummy;
@ -387,13 +385,6 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
oldZoom = aScreen->GetZoom();
old_org = aScreen->m_DrawOrg;
oldClipBox = *panel->GetClipBox();
// Change clip box to print the whole page.
#define MAX_VALUE (INT_MAX/2) // MAX_VALUE is the max we can use in an integer
// and that allows calculations without overflow
panel->SetClipBox( EDA_RECT( wxPoint( 0, 0 ), wxSize( MAX_VALUE, MAX_VALUE ) ) );
// Change scale factor and offset to print the whole page.
bool printReference = m_parent->GetPrintSheetReference();
@ -437,23 +428,23 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
m_parent->SetDrawBgColor( COLOR4D::WHITE );
GRSetDrawMode( dc, GR_COPY );
GRSFilledRect( nullptr, dc, fitRect.GetX(), fitRect.GetY(),
fitRect.GetRight(), fitRect.GetBottom(),
0, COLOR4D::WHITE, COLOR4D::WHITE );
GRSFilledRect( nullptr, dc, fitRect.GetX(), fitRect.GetY(), fitRect.GetRight(),
fitRect.GetBottom(), 0, COLOR4D::WHITE, COLOR4D::WHITE );
if( m_parent->GetPrintMonochrome() )
GRForceBlackPen( true );
aScreen->Draw( panel, dc );
aScreen->Print( dc );
if( printReference )
m_parent->DrawWorkSheet( dc, aScreen, GetDefaultLineThickness(),
IU_PER_MILS, aScreen->GetFileName(), wxEmptyString,
GetLayerColor( ( SCH_LAYER_ID )LAYER_WORKSHEET ) );
{
m_parent->PrintWorkSheet( dc, aScreen, GetDefaultLineThickness(), IU_PER_MILS,
aScreen->GetFileName(), wxEmptyString,
GetLayerColor( ( SCH_LAYER_ID )LAYER_WORKSHEET ) );
}
m_parent->SetDrawBgColor( bgColor );
aScreen->m_IsPrinting = false;
panel->SetClipBox( oldClipBox );
GRForceBlackPen( false );

View File

@ -25,11 +25,10 @@
#include <fctsys.h>
#include <gr_basic.h>
#include <base_struct.h>
#include <draw_graphic_text.h>
#include <gr_text.h>
#include <sch_draw_panel.h>
#include <confirm.h>
#include <sch_edit_frame.h>
#include <kicad_device_context.h>
#include <tool/tool_manager.h>
#include <tools/ee_actions.h>
#include <general.h>

View File

@ -31,7 +31,6 @@
#include <sch_draw_panel.h>
#include <confirm.h>
#include <sch_edit_frame.h>
#include <kicad_device_context.h>
#include <msgpanel.h>
#include <tool/tool_manager.h>
#include <tools/ee_actions.h>

View File

@ -295,14 +295,8 @@ int LIB_ARC::GetPenSize() const
}
void LIB_ARC::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform )
void LIB_ARC::print( wxDC* aDC, const wxPoint& aOffset, void* aData, const TRANSFORM& aTransform )
{
// Don't draw the arc until the end point is selected. Only the edit indicators
// get drawn at this time.
if( IsNew() && m_lastEditState == 1 )
return;
wxPoint pos1, pos2, posc;
COLOR4D color = GetLayerColor( LAYER_DEVICE );
COLOR4D bgColor = GetLayerColor( LAYER_DEVICE_BACKGROUND );
@ -322,15 +316,14 @@ void LIB_ARC::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf
FILL_T fill = aData ? NO_FILL : m_Fill;
EDA_RECT* const clipbox = aPanel? aPanel->GetClipBox() : NULL;
int penSize = GetPenSize();
if( fill == FILLED_WITH_BG_BODYCOLOR )
GRFilledArc( clipbox, aDC, posc.x, posc.y, pt1, pt2, m_Radius, penSize, bgColor, bgColor );
GRFilledArc( nullptr, aDC, posc.x, posc.y, pt1, pt2, m_Radius, penSize, bgColor, bgColor );
else if( fill == FILLED_SHAPE && !aData )
GRFilledArc( clipbox, aDC, posc.x, posc.y, pt1, pt2, m_Radius, color, color );
GRFilledArc( nullptr, aDC, posc.x, posc.y, pt1, pt2, m_Radius, color, color );
else
GRArc1( clipbox, aDC, pos1.x, pos1.y, pos2.x, pos2.y, posc.x, posc.y, penSize, color );
GRArc1( nullptr, aDC, pos1.x, pos1.y, pos2.x, pos2.y, posc.x, posc.y, penSize, color );
}

View File

@ -53,11 +53,8 @@ class LIB_ARC : public LIB_ITEM
int m_editDirection;
int m_lastEditState;
/**
* Draws the arc.
*/
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform ) override;
void print( wxDC* aDC, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform ) override;
public:
LIB_ARC( LIB_PART * aParent );

View File

@ -211,8 +211,8 @@ int LIB_BEZIER::GetPenSize() const
}
void LIB_BEZIER::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
void* aData, const TRANSFORM& aTransform )
void LIB_BEZIER::print( wxDC* aDC, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform )
{
std::vector<wxPoint> PolyPointsTraslated;
@ -228,21 +228,19 @@ void LIB_BEZIER::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
FILL_T fill = aData ? NO_FILL : m_Fill;
EDA_RECT* const clipbox = aPanel? aPanel->GetClipBox() : NULL;
if( fill == FILLED_WITH_BG_BODYCOLOR )
{
GRPoly( clipbox, aDC, m_PolyPoints.size(), &PolyPointsTraslated[0], true, GetPenSize(),
GRPoly( nullptr, aDC, m_PolyPoints.size(), &PolyPointsTraslated[0], true, GetPenSize(),
bgColor, bgColor );
}
else if( fill == FILLED_SHAPE )
{
GRPoly( clipbox, aDC, m_PolyPoints.size(), &PolyPointsTraslated[0], true, GetPenSize(),
GRPoly( nullptr, aDC, m_PolyPoints.size(), &PolyPointsTraslated[0], true, GetPenSize(),
color, color );
}
else
{
GRPoly( clipbox, aDC, m_PolyPoints.size(), &PolyPointsTraslated[0], false, GetPenSize(),
GRPoly( nullptr, aDC, m_PolyPoints.size(), &PolyPointsTraslated[0], false, GetPenSize(),
color, color );
}
}

View File

@ -38,8 +38,8 @@ class LIB_BEZIER : public LIB_ITEM
std::vector<wxPoint> m_BezierPoints; // list of parameter (3|4)
std::vector<wxPoint> m_PolyPoints; // list of points (>= 2)
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform ) override;
void print( wxDC* aDC, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform ) override;
public:
LIB_BEZIER( LIB_PART * aParent );

View File

@ -196,22 +196,20 @@ int LIB_CIRCLE::GetPenSize() const
}
void LIB_CIRCLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
void* aData, const TRANSFORM& aTransform )
void LIB_CIRCLE::print( wxDC* aDC, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform )
{
wxPoint pos1 = aTransform.TransformCoordinate( m_Pos ) + aOffset;
COLOR4D color = GetLayerColor( LAYER_DEVICE );
COLOR4D bgColor = GetLayerColor( LAYER_DEVICE_BACKGROUND );
FILL_T fill = aData ? NO_FILL : m_Fill;
EDA_RECT* const clipbox = aPanel? aPanel->GetClipBox() : NULL;
if( fill == FILLED_WITH_BG_BODYCOLOR )
GRFilledCircle( clipbox, aDC, pos1.x, pos1.y, GetRadius(), GetPenSize(), bgColor, bgColor );
GRFilledCircle( nullptr, aDC, pos1.x, pos1.y, GetRadius(), GetPenSize(), bgColor, bgColor );
else if( fill == FILLED_SHAPE )
GRFilledCircle( clipbox, aDC, pos1.x, pos1.y, GetRadius(), 0, color, color );
GRFilledCircle( nullptr, aDC, pos1.x, pos1.y, GetRadius(), 0, color, color );
else
GRCircle( clipbox, aDC, pos1.x, pos1.y, GetRadius(), GetPenSize(), color );
GRCircle( nullptr, aDC, pos1.x, pos1.y, GetRadius(), GetPenSize(), color );
}

View File

@ -34,8 +34,8 @@ class LIB_CIRCLE : public LIB_ITEM
wxPoint m_EndPos; // A point on the circumference of the circle.
int m_Width; // Line width.
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform ) override;
void print( wxDC* aDC, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform ) override;
public:
LIB_CIRCLE( LIB_PART * aParent );

View File

@ -124,10 +124,9 @@ bool LIB_ITEM::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
}
void LIB_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform )
void LIB_ITEM::Print( wxDC* aDC, const wxPoint& aOffset, void* aData, const TRANSFORM& aTransform )
{
drawGraphic( aPanel, aDC, aOffset, aData, aTransform );
print( aDC, aOffset, aData, aTransform );
}

View File

@ -44,7 +44,6 @@ class PLOTTER;
class LIB_ITEM;
class LIB_PIN;
class MSG_PANEL_ITEM;
class EDA_DRAW_PANEL;
extern const int fill_tab[];
@ -67,17 +66,16 @@ typedef std::vector< LIB_PIN* > LIB_PINS;
class LIB_ITEM : public EDA_ITEM
{
/**
* Draw the item on \a aPanel.
* Print the item to \a aDC.
*
* @param aPanel A pointer to the panel to draw the object upon.
* @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
* from the object's current position.
* @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.
*/
virtual void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
void* aData, const TRANSFORM& aTransform ) = 0;
virtual void print( wxDC* aDC, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform ) = 0;
friend class LIB_PART;
@ -174,7 +172,6 @@ public:
/**
* Draw an item
*
* @param aPanel DrawPanel to use (can be null) mainly used for clipping purposes.
* @param aDC Device Context (can be null)
* @param aOffset Offset to draw
* @param aData Value or pointer used to pass others parameters, depending on body items.
@ -183,8 +180,8 @@ public:
* pass reference to the lib component for pins.
* @param aTransform Transform Matrix (rotation, mirror ..)
*/
virtual void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint &aOffset, void* aData,
const TRANSFORM& aTransform );
virtual void Print( wxDC* aDC, const wxPoint &aOffset, void* aData,
const TRANSFORM& aTransform );
/**
* @return the size of the "pen" that be used to draw or plot this item

View File

@ -27,7 +27,7 @@
#include <gr_basic.h>
#include <macros.h>
#include <base_struct.h>
#include <draw_graphic_text.h>
#include <gr_text.h>
#include <kicad_string.h>
#include <sch_draw_panel.h>
#include <plotter.h>
@ -128,8 +128,8 @@ int LIB_FIELD::GetPenSize() const
}
void LIB_FIELD::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
void* aData, const TRANSFORM& aTransform )
void LIB_FIELD::print( wxDC* aDC, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform )
{
wxPoint text_pos;
COLOR4D color = IsVisible() ? GetDefaultColor() : GetInvisibleItemColor();
@ -144,10 +144,8 @@ void LIB_FIELD::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
else
text = m_Text;
EDA_RECT* clipbox = aPanel? aPanel->GetClipBox() : NULL;
DrawGraphicText( clipbox, aDC, text_pos, color, text, GetTextAngle(), GetTextSize(),
GetHorizJustify(), GetVertJustify(), linewidth, IsItalic(), IsBold() );
GRText( aDC, text_pos, color, text, GetTextAngle(), GetTextSize(), GetHorizJustify(),
GetVertJustify(), linewidth, IsItalic(), IsBold() );
}

View File

@ -62,14 +62,14 @@ class LIB_FIELD : public LIB_ITEM, public EDA_TEXT
wxString m_name; ///< Name (not the field text value itself, that is .m_Text)
/**
* Draw the field.
* Print the field.
* <p>
* If \a aData not NULL, \a aData must point a wxString which is used instead of
* the m_Text
* </p>
*/
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform ) override;
void print( wxDC* aDC, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform ) override;
/**
* Calculate the new circle at \a aPosition when editing.

View File

@ -35,7 +35,7 @@
#include <macros.h>
#include <trigo.h>
#include <sch_draw_panel.h>
#include <draw_graphic_text.h>
#include <gr_text.h>
#include <plotter.h>
#include <sch_edit_frame.h>
#include <base_units.h>
@ -558,8 +558,7 @@ int LIB_PIN::GetPenSize() const
}
void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform )
void LIB_PIN::print( wxDC* aDC, const wxPoint& aOffset, void* aData, const TRANSFORM& aTransform )
{
// aData is used here as a boolean.
bool drawElectricalTypeName = (bool) aData;
@ -572,42 +571,26 @@ void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf
/* Calculate the pin position */
wxPoint pos1 = aTransform.TransformCoordinate( m_position ) + aOffset;
// Invisible pins are only drawn on request.
if( !IsVisible() )
{
bool drawHidden = true;
return;
if( aPanel && aPanel->GetParent() )
{
EDA_DRAW_FRAME* frame = aPanel->GetParent();
PrintPinSymbol( aDC, pos1, orient );
if( frame->IsType( FRAME_SCH ) )
drawHidden = static_cast<SCH_EDIT_FRAME*>( frame )->GetShowAllPins();
}
if( !drawHidden )
return;
}
DrawPinSymbol( aPanel, aDC, pos1, orient );
DrawPinTexts( aPanel, aDC, pos1, orient, Entry->GetPinNameOffset(), Entry->ShowPinNumbers(),
PrintPinTexts( aDC, pos1, orient, Entry->GetPinNameOffset(), Entry->ShowPinNumbers(),
Entry->ShowPinNames() );
if( drawElectricalTypeName )
DrawPinElectricalTypeName( aPanel, aDC, pos1, orient );
PrintPinElectricalTypeName( aDC, pos1, orient );
}
void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPos, int aOrient )
void LIB_PIN::PrintPinSymbol( wxDC* aDC, const wxPoint& aPos, int aOrient )
{
int MapX1, MapY1, x1, y1;
int width = GetPenSize();
int posX = aPos.x, posY = aPos.y, len = m_length;
COLOR4D color = IsVisible() ? GetLayerColor( LAYER_PIN ) : GetInvisibleItemColor();
EDA_RECT* clipbox = aPanel ? aPanel->GetClipBox() : NULL;
MapX1 = MapY1 = 0;
x1 = posX;
y1 = posY;
@ -623,10 +606,10 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
if( m_shape == PINSHAPE_INVERTED || m_shape == PINSHAPE_INVERTED_CLOCK )
{
const int radius = ExternalPinDecoSize( *this );
GRCircle( clipbox, aDC, MapX1 * radius + x1, MapY1 * radius + y1, radius, width, color );
GRCircle( nullptr, aDC, MapX1 * radius + x1, MapY1 * radius + y1, radius, width, color );
GRMoveTo( MapX1 * radius * 2 + x1, MapY1 * radius * 2 + y1 );
GRLineTo( clipbox, aDC, posX, posY, width, color );
GRLineTo( nullptr, aDC, posX, posY, width, color );
}
else if( m_shape == PINSHAPE_FALLING_EDGE_CLOCK ) /* an alternative for Inverted Clock */
{
@ -634,22 +617,22 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
if( MapY1 == 0 ) /* MapX1 = +- 1 */
{
GRMoveTo( x1, y1 + deco_size );
GRLineTo( clipbox, aDC, x1 + MapX1 * deco_size * 2, y1, width, color );
GRLineTo( clipbox, aDC, x1, y1 - deco_size, width, color );
GRLineTo( nullptr, aDC, x1 + MapX1 * deco_size * 2, y1, width, color );
GRLineTo( nullptr, aDC, x1, y1 - deco_size, width, color );
}
else /* MapX1 = 0 */
{
GRMoveTo( x1 + deco_size, y1 );
GRLineTo( clipbox, aDC, x1, y1 + MapY1 * deco_size * 2, width, color );
GRLineTo( clipbox, aDC, x1 - deco_size, y1, width, color );
GRLineTo( nullptr, aDC, x1, y1 + MapY1 * deco_size * 2, width, color );
GRLineTo( nullptr, aDC, x1 - deco_size, y1, width, color );
}
GRMoveTo( MapX1 * deco_size * 2 + x1, MapY1 * deco_size * 2 + y1 );
GRLineTo( clipbox, aDC, posX, posY, width, color );
GRLineTo( nullptr, aDC, posX, posY, width, color );
}
else
{
GRMoveTo( x1, y1 );
GRLineTo( clipbox, aDC, posX, posY, width, color );
GRLineTo( nullptr, aDC, posX, posY, width, color );
}
if( m_shape == PINSHAPE_CLOCK || m_shape == PINSHAPE_INVERTED_CLOCK || m_shape == PINSHAPE_CLOCK_LOW )
@ -658,14 +641,14 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
if( MapY1 == 0 ) /* MapX1 = +- 1 */
{
GRMoveTo( x1, y1 + clock_size );
GRLineTo( clipbox, aDC, x1 - MapX1 * clock_size * 2, y1, width, color );
GRLineTo( clipbox, aDC, x1, y1 - clock_size, width, color );
GRLineTo( nullptr, aDC, x1 - MapX1 * clock_size * 2, y1, width, color );
GRLineTo( nullptr, aDC, x1, y1 - clock_size, width, color );
}
else /* MapX1 = 0 */
{
GRMoveTo( x1 + clock_size, y1 );
GRLineTo( clipbox, aDC, x1, y1 - MapY1 * clock_size * 2, width, color );
GRLineTo( clipbox, aDC, x1 - clock_size, y1, width, color );
GRLineTo( nullptr, aDC, x1, y1 - MapY1 * clock_size * 2, width, color );
GRLineTo( nullptr, aDC, x1 - clock_size, y1, width, color );
}
}
@ -675,14 +658,14 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
if( MapY1 == 0 ) /* MapX1 = +- 1 */
{
GRMoveTo( x1 + MapX1 * deco_size * 2, y1 );
GRLineTo( clipbox, aDC, x1 + MapX1 * deco_size * 2, y1 - deco_size * 2, width, color );
GRLineTo( clipbox, aDC, x1, y1, width, color );
GRLineTo( nullptr, aDC, x1 + MapX1 * deco_size * 2, y1 - deco_size * 2, width, color );
GRLineTo( nullptr, aDC, x1, y1, width, color );
}
else /* MapX1 = 0 */
{
GRMoveTo( x1, y1 + MapY1 * deco_size * 2 );
GRLineTo( clipbox, aDC, x1 - deco_size * 2, y1 + MapY1 * deco_size * 2, width, color );
GRLineTo( clipbox, aDC, x1, y1, width, color );
GRLineTo( nullptr, aDC, x1 - deco_size * 2, y1 + MapY1 * deco_size * 2, width, color );
GRLineTo( nullptr, aDC, x1, y1, width, color );
}
}
@ -693,36 +676,36 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
if( MapY1 == 0 ) /* MapX1 = +- 1 */
{
GRMoveTo( x1, y1 - deco_size * 2 );
GRLineTo( clipbox, aDC, x1 + MapX1 * deco_size * 2, y1, width, color );
GRLineTo( nullptr, aDC, x1 + MapX1 * deco_size * 2, y1, width, color );
}
else /* MapX1 = 0 */
{
GRMoveTo( x1 - deco_size * 2, y1 );
GRLineTo( clipbox, aDC, x1, y1 + MapY1 * deco_size * 2, width, color );
GRLineTo( nullptr, aDC, x1, y1 + MapY1 * deco_size * 2, width, color );
}
}
else if( m_shape == PINSHAPE_NONLOGIC ) /* NonLogic pin symbol */
{
const int deco_size = ExternalPinDecoSize( *this );
GRMoveTo( x1 - (MapX1 + MapY1) * deco_size, y1 - (MapY1 - MapX1) * deco_size );
GRLineTo( clipbox, aDC, x1 + (MapX1 + MapY1) * deco_size, y1 + (MapY1 - MapX1) * deco_size, width,
GRLineTo( nullptr, aDC, x1 + (MapX1 + MapY1) * deco_size, y1 + (MapY1 - MapX1) * deco_size, width,
color );
GRMoveTo( x1 - (MapX1 - MapY1) * deco_size, y1 - (MapY1 + MapX1) * deco_size );
GRLineTo( clipbox, aDC, x1 + (MapX1 - MapY1) * deco_size, y1 + (MapY1 + MapX1) * deco_size, width,
GRLineTo( nullptr, aDC, x1 + (MapX1 - MapY1) * deco_size, y1 + (MapY1 + MapX1) * deco_size, width,
color );
}
if( m_type == PIN_NC ) // Draw a N.C. symbol
{
const int deco_size = TARGET_PIN_RADIUS;
GRLine( clipbox, aDC, posX - deco_size, posY - deco_size, posX + deco_size, posY + deco_size, width, color );
GRLine( clipbox, aDC, posX + deco_size, posY - deco_size, posX - deco_size, posY + deco_size, width, color );
GRLine( nullptr, aDC, posX - deco_size, posY - deco_size, posX + deco_size, posY + deco_size, width, color );
GRLine( nullptr, aDC, posX + deco_size, posY - deco_size, posX - deco_size, posY + deco_size, width, color );
}
}
void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, wxDC* DC, wxPoint& pin_pos, int orient,
int TextInside, bool DrawPinNum, bool DrawPinName )
void LIB_PIN::PrintPinTexts( wxDC* DC, wxPoint& pin_pos, int orient, int TextInside,
bool DrawPinNum, bool DrawPinName )
{
if( !DrawPinName && !DrawPinNum )
return;
@ -736,8 +719,6 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, wxDC* DC, wxPoint& pin_pos, i
int name_offset = PIN_TEXT_MARGIN + ( nameLineWidth + GetDefaultLineThickness() ) / 2;
int num_offset = PIN_TEXT_MARGIN + ( numLineWidth + GetDefaultLineThickness() ) / 2;
EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL;
/* Get the num and name colors */
COLOR4D NameColor = IsVisible() ? GetLayerColor( LAYER_PINNAM ) : GetInvisibleItemColor();
COLOR4D NumColor = IsVisible() ? GetLayerColor( LAYER_PINNUM ) : GetInvisibleItemColor();
@ -766,26 +747,24 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, wxDC* DC, wxPoint& pin_pos, i
if( orient == PIN_RIGHT )
{
x = x1 + TextInside;
DrawGraphicText( clipbox, DC, wxPoint( x, y1 ), NameColor,
m_name, TEXT_ANGLE_HORIZ, PinNameSize,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
nameLineWidth, false, false );
GRText( DC, wxPoint( x, y1 ), NameColor, m_name, TEXT_ANGLE_HORIZ,
PinNameSize, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
nameLineWidth, false, false );
}
else // Orient == PIN_LEFT
{
x = x1 - TextInside;
DrawGraphicText( clipbox, DC, wxPoint( x, y1 ), NameColor, m_name,
TEXT_ANGLE_HORIZ, PinNameSize, GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_CENTER, nameLineWidth, false, false );
GRText( DC, wxPoint( x, y1 ), NameColor, m_name, TEXT_ANGLE_HORIZ,
PinNameSize, GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER,
nameLineWidth, false, false );
}
}
if( DrawPinNum )
{
DrawGraphicText( clipbox, DC, wxPoint( (x1 + pin_pos.x) / 2, y1 - num_offset ),
NumColor, m_number, TEXT_ANGLE_HORIZ, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, numLineWidth,
false, false );
GRText( DC, wxPoint( (x1 + pin_pos.x) / 2, y1 - num_offset ), NumColor, m_number,
TEXT_ANGLE_HORIZ, PinNumSize, GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM, numLineWidth, false, false );
}
}
else /* Its a vertical line. */
@ -796,30 +775,28 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, wxDC* DC, wxPoint& pin_pos, i
y = y1 + TextInside;
if( DrawPinName )
DrawGraphicText( clipbox, DC, wxPoint( x1, y ), NameColor, m_name,
TEXT_ANGLE_VERT, PinNameSize, GR_TEXT_HJUSTIFY_RIGHT,
GR_TEXT_VJUSTIFY_CENTER, nameLineWidth, false, false );
GRText( DC, wxPoint( x1, y ), NameColor, m_name, TEXT_ANGLE_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, nameLineWidth, false,
false );
if( DrawPinNum )
DrawGraphicText( clipbox, DC, wxPoint( x1 - num_offset, (y1 + pin_pos.y) / 2 ),
NumColor, m_number, TEXT_ANGLE_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
numLineWidth, false, false );
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_BOTTOM, numLineWidth, false, false );
}
else /* PIN_UP */
{
y = y1 - TextInside;
if( DrawPinName )
DrawGraphicText( clipbox, DC, wxPoint( x1, y ), NameColor, m_name,
TEXT_ANGLE_VERT, PinNameSize, GR_TEXT_HJUSTIFY_LEFT,
GR_TEXT_VJUSTIFY_CENTER, nameLineWidth, false, false );
GRText( DC, wxPoint( x1, y ), NameColor, m_name, TEXT_ANGLE_VERT, PinNameSize,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, nameLineWidth, false,
false );
if( DrawPinNum )
DrawGraphicText( clipbox, DC, wxPoint( x1 - num_offset, (y1 + pin_pos.y) / 2 ),
NumColor, m_number, TEXT_ANGLE_VERT, PinNumSize,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
numLineWidth, false, false );
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_BOTTOM, numLineWidth, false, false );
}
}
}
@ -831,16 +808,16 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, wxDC* DC, wxPoint& pin_pos, i
if( DrawPinName )
{
x = (x1 + pin_pos.x) / 2;
DrawGraphicText( clipbox, DC, wxPoint( x, y1 - name_offset ), NameColor, m_name,
TEXT_ANGLE_HORIZ, PinNameSize, GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM, nameLineWidth, false, false );
GRText( DC, wxPoint( x, y1 - name_offset ), NameColor, m_name, TEXT_ANGLE_HORIZ,
PinNameSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
nameLineWidth, false, false );
}
if( DrawPinNum )
{
x = (x1 + pin_pos.x) / 2;
DrawGraphicText( clipbox, DC, wxPoint( x, y1 + num_offset ), NumColor, m_number,
TEXT_ANGLE_HORIZ, PinNumSize, GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_TOP, numLineWidth, false, false );
GRText( DC, wxPoint( x, y1 + num_offset ), NumColor, m_number, TEXT_ANGLE_HORIZ,
PinNumSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, numLineWidth,
false, false );
}
}
else /* Its a vertical line. */
@ -848,17 +825,16 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, wxDC* DC, wxPoint& pin_pos, i
if( DrawPinName )
{
y = (y1 + pin_pos.y) / 2;
DrawGraphicText( clipbox, DC, wxPoint( x1 - name_offset, y ), NameColor, m_name,
TEXT_ANGLE_VERT, PinNameSize, GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_BOTTOM, nameLineWidth, false, false );
GRText( DC, wxPoint( x1 - name_offset, y ), NameColor, m_name, TEXT_ANGLE_VERT,
PinNameSize, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
nameLineWidth, false, false );
}
if( DrawPinNum )
{
DrawGraphicText( clipbox, 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, numLineWidth,
false, false );
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,
numLineWidth, false, false );
}
}
}
@ -866,8 +842,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, wxDC* DC, wxPoint& pin_pos, i
void LIB_PIN::DrawPinElectricalTypeName( EDA_DRAW_PANEL* aPanel, wxDC* aDC, wxPoint& aPosition,
int aOrientation )
void LIB_PIN::PrintPinElectricalTypeName( wxDC* aDC, wxPoint& aPosition, int aOrientation )
{
wxString typeName = GetElectricalTypeName();
@ -912,10 +887,8 @@ void LIB_PIN::DrawPinElectricalTypeName( EDA_DRAW_PANEL* aPanel, wxDC* aDC, wxPo
break;
}
EDA_RECT* clipbox = aPanel ? aPanel->GetClipBox() : NULL;
DrawGraphicText( clipbox, aDC, txtpos, color, typeName, orient, wxSize( textSize, textSize ),
hjustify, GR_TEXT_VJUSTIFY_CENTER, pensize, false, false );
GRText( aDC, txtpos, color, typeName, orient, wxSize( textSize, textSize ), hjustify,
GR_TEXT_VJUSTIFY_CENTER, pensize, false, false );
}

View File

@ -77,17 +77,16 @@ class LIB_PIN : public LIB_ITEM
int m_nameTextSize; ///< Pin num and Pin name sizes
/**
* Draw a pin, with or without the pin texts
* Print a pin, with or without the pin texts
*
* @param aPanel DrawPanel to use (can be null) mainly used for clipping purposes.
* @param aDC Device Context (can be null)
* @param aOffset Offset to draw
* @param aData = used here as a boolean indicating whether or not to draw the pin
* electrical types
* @param aTransform Transform Matrix (rotation, mirror ..)
*/
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform ) override;
void print( wxDC* aDC, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform ) override;
public:
LIB_PIN( LIB_PART* aParent );
@ -356,11 +355,10 @@ public:
int GetPenSize() const override;
/**
* Draw 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.
*/
void DrawPinSymbol( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPos,
int aOrientation );
void PrintPinSymbol( wxDC* aDC, const wxPoint& aPos, int aOrientation );
/**
* Put the pin number and pin text info, given the pin line coordinates.
@ -370,14 +368,13 @@ public:
* If TextInside then the text is been put inside,otherwise all is drawn outside.
* Pin Name: substring between '~' is negated
*/
void DrawPinTexts( EDA_DRAW_PANEL* aPanel, wxDC* aDC, wxPoint& aPosition,
int aOrientation, int TextInside, bool DrawPinNum, bool DrawPinName );
void PrintPinTexts( wxDC* aDC, wxPoint& aPosition, int aOrientation, int TextInside,
bool DrawPinNum, bool DrawPinName );
/**
* Draw the electrical type text of the pin (only for the footprint editor)
*/
void DrawPinElectricalTypeName( EDA_DRAW_PANEL* aPanel, wxDC* aDC, wxPoint& aPosition,
int aOrientation );
void PrintPinElectricalTypeName( wxDC* aDC, wxPoint& aPosition, int aOrientation );
/**
* Plot the pin number and pin text info, given the pin line coordinates.

View File

@ -202,8 +202,8 @@ int LIB_POLYLINE::GetPenSize() const
}
void LIB_POLYLINE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
void* aData, const TRANSFORM& aTransform )
void LIB_POLYLINE::print( wxDC* aDC, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform )
{
COLOR4D color = GetLayerColor( LAYER_DEVICE );
COLOR4D bgColor = GetLayerColor( LAYER_DEVICE_BACKGROUND );
@ -215,13 +215,12 @@ void LIB_POLYLINE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint
FILL_T fill = aData ? NO_FILL : m_Fill;
EDA_RECT* const clipbox = aPanel? aPanel->GetClipBox() : NULL;
if( fill == FILLED_WITH_BG_BODYCOLOR )
GRPoly( clipbox, aDC, m_PolyPoints.size(), buffer, 1, GetPenSize(), bgColor, bgColor );
GRPoly( nullptr, aDC, m_PolyPoints.size(), buffer, 1, GetPenSize(), bgColor, bgColor );
else if( fill == FILLED_SHAPE )
GRPoly( clipbox, aDC, m_PolyPoints.size(), buffer, 1, GetPenSize(), color, color );
GRPoly( nullptr, aDC, m_PolyPoints.size(), buffer, 1, GetPenSize(), color, color );
else
GRPoly( clipbox, aDC, m_PolyPoints.size(), buffer, 0, GetPenSize(), color, color );
GRPoly( nullptr, aDC, m_PolyPoints.size(), buffer, 0, GetPenSize(), color, color );
delete[] buffer;
}

View File

@ -33,8 +33,8 @@ class LIB_POLYLINE : public LIB_ITEM
int m_Width; // Line width
std::vector<wxPoint> m_PolyPoints; // list of points (>= 2)
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform ) override;
void print( wxDC* aDC, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform ) override;
public:
LIB_POLYLINE( LIB_PART * aParent );

View File

@ -163,8 +163,8 @@ int LIB_RECTANGLE::GetPenSize() const
}
void LIB_RECTANGLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
void* aData, const TRANSFORM& aTransform )
void LIB_RECTANGLE::print( wxDC* aDC, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform )
{
COLOR4D color = GetLayerColor( LAYER_DEVICE );
COLOR4D bgColor = GetLayerColor( LAYER_DEVICE_BACKGROUND );
@ -173,13 +173,12 @@ void LIB_RECTANGLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoin
FILL_T fill = aData ? NO_FILL : m_Fill;
EDA_RECT* const clipbox = aPanel? aPanel->GetClipBox() : NULL;
if( fill == FILLED_WITH_BG_BODYCOLOR && !aData )
GRFilledRect( clipbox, aDC, pt1.x, pt1.y, pt2.x, pt2.y, GetPenSize( ), bgColor, bgColor );
GRFilledRect( nullptr, aDC, pt1.x, pt1.y, pt2.x, pt2.y, GetPenSize( ), bgColor, bgColor );
else if( m_Fill == FILLED_SHAPE && !aData )
GRFilledRect( clipbox, aDC, pt1.x, pt1.y, pt2.x, pt2.y, GetPenSize(), color, color );
GRFilledRect( nullptr, aDC, pt1.x, pt1.y, pt2.x, pt2.y, GetPenSize(), color, color );
else
GRRect( clipbox, aDC, pt1.x, pt1.y, pt2.x, pt2.y, GetPenSize(), color );
GRRect( nullptr, aDC, pt1.x, pt1.y, pt2.x, pt2.y, GetPenSize(), color );
}

View File

@ -34,8 +34,8 @@ class LIB_RECTANGLE : public LIB_ITEM
wxPoint m_Pos; // Rectangle start point.
int m_Width; // Line width
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform ) override;
void print( wxDC* aDC, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform ) override;
public:
LIB_RECTANGLE( LIB_PART * aParent );

View File

@ -30,7 +30,7 @@
#include <macros.h>
#include <sch_draw_panel.h>
#include <plotter.h>
#include <draw_graphic_text.h>
#include <gr_text.h>
#include <trigo.h>
#include <base_units.h>
#include <msgpanel.h>
@ -192,8 +192,7 @@ void LIB_TEXT::Plot( PLOTTER* plotter, const wxPoint& offset, bool fill,
else
color = COLOR4D::BLACK;
plotter->Text( pos, color, GetShownText(),
t1 ? TEXT_ANGLE_HORIZ : TEXT_ANGLE_VERT,
plotter->Text( pos, color, GetShownText(), t1 ? TEXT_ANGLE_HORIZ : TEXT_ANGLE_VERT,
GetTextSize(), GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
GetPenSize(), IsItalic(), IsBold() );
}
@ -217,8 +216,7 @@ int LIB_TEXT::GetPenSize() const
}
void LIB_TEXT::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
void* aData, const TRANSFORM& aTransform )
void LIB_TEXT::print( wxDC* aDC, const wxPoint& aOffset, void* aData, const TRANSFORM& aTransform )
{
COLOR4D color = GetDefaultColor();
@ -255,21 +253,16 @@ void LIB_TEXT::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aO
// Calculate pos according to mirror/rotation.
txtpos = aTransform.TransformCoordinate( txtpos ) + aOffset;
EDA_RECT* clipbox = aPanel? aPanel->GetClipBox() : NULL;
DrawGraphicText( clipbox, aDC, txtpos, color, GetShownText(), orient, GetTextSize(),
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GetPenSize(),
IsItalic(), IsBold() );
GRText( aDC, txtpos, color, GetShownText(), orient, GetTextSize(), GR_TEXT_HJUSTIFY_CENTER,
GR_TEXT_VJUSTIFY_CENTER, GetPenSize(), IsItalic(), IsBold() );
}
void LIB_TEXT::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList )
{
wxString msg;
LIB_ITEM::GetMsgPanelInfo( aUnits, aList );
msg = MessageTextFromValue( aUnits, GetThickness(), true );
wxString msg = MessageTextFromValue( aUnits, GetThickness(), true );
aList.push_back( MSG_PANEL_ITEM( _( "Line Width" ), msg, BLUE ) );
}

View File

@ -39,8 +39,8 @@
*/
class LIB_TEXT : public LIB_ITEM, public EDA_TEXT
{
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform ) override;
void print( wxDC* aDC, const wxPoint& aOffset, void* aData,
const TRANSFORM& aTransform ) override;
public:
LIB_TEXT( LIB_PART * aParent );
@ -101,16 +101,13 @@ public:
wxPoint GetPosition() const override { return EDA_TEXT::GetTextPos(); }
void MirrorHorizontal( const wxPoint& aCenter ) override;
void MirrorVertical( const wxPoint& aCenter ) override;
void Rotate( const wxPoint& aCenter, bool aRotateCCW = true ) override;
void Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill,
const TRANSFORM& aTransform ) override;
int GetWidth() const override { return GetThickness(); }
void SetWidth( int aWidth ) override { SetThickness( aWidth ); }
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;

View File

@ -45,7 +45,6 @@
#include <widgets/symbol_tree_pane.h>
#include <widgets/lib_tree.h>
#include <symbol_lib_table.h>
#include <kicad_device_context.h>
#include <ee_hotkeys.h>
#include <eeschema_config.h>
#include <wildcards_and_files_ext.h>

View File

@ -301,17 +301,6 @@ public:
void UpdateAfterSymbolProperties( wxString* aOldName, wxArrayString* aOldAliases );
void RebuildSymbolUnitsList();
/**
* Redraw the current component loaded in library editor
* Display reference like in schematic (a reference U is shown U? or U?A)
* accordint to the current selected unit and De Morgan selection
* although it is stored without ? and part id.
* @param aDC = the current device context
* @param aOffset = a draw offset. usually 0,0 to draw on the screen, but
* can be set to page size / 2 to draw or print in SVG format.
*/
void RedrawComponent( wxDC* aDC, wxPoint aOffset );
void OnCloseWindow( wxCloseEvent& Event );
void ReCreateHToolbar() override;
void ReCreateVToolbar() override;

View File

@ -267,28 +267,6 @@ bool LIB_EDIT_FRAME::LoadOneLibraryPartAux( LIB_ALIAS* aEntry, const wxString& a
}
void LIB_EDIT_FRAME::RedrawComponent( wxDC* aDC, wxPoint aOffset )
{
LIB_PART* part = GetCurPart();
if( part )
{
// display reference like in schematic (a reference U is shown U? or U?A)
// although it is stored without ? and part id.
// So temporary change the reference by a schematic like reference
LIB_FIELD* field = part->GetField( REFERENCE );
wxString fieldText = field->GetText();
wxString fieldfullText = field->GetFullText( m_unit );
field->EDA_TEXT::SetText( fieldfullText ); // change the field text string only
auto opts = PART_DRAW_OPTIONS::Default();
opts.show_elec_type = GetShowElectricalType();
part->Draw( m_canvas, aDC, aOffset, m_unit, m_convert, opts );
field->EDA_TEXT::SetText( fieldText ); // restore the field text string
}
}
void LIB_EDIT_FRAME::OnSaveAll()
{
saveAllLibraries( false );

View File

@ -192,5 +192,5 @@ void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMod
plot_offset.x = pagesize.x / 2;
plot_offset.y = pagesize.y / 2;
part->Draw( m_canvas, aDC, plot_offset, m_unit, m_convert, PART_DRAW_OPTIONS::Default() );
part->Print( aDC, plot_offset, m_unit, m_convert, PART_DRAW_OPTIONS::Default() );
}

View File

@ -26,7 +26,6 @@
#include <class_library.h>
#include <confirm.h>
#include <invoke_sch_dialog.h>
#include <kicad_device_context.h>
#include <kiway.h>
#include <project_rescue.h>
#include <sch_component.h>

View File

@ -397,8 +397,6 @@ void SCH_BASE_FRAME::createCanvas()
m_canvas = new SCH_DRAW_PANEL( this, wxID_ANY, wxPoint( 0, 0 ), m_FrameSize,
GetGalDisplayOptions(), m_canvasType );
m_useSingleCanvasPane = true;
SetGalCanvas( static_cast<SCH_DRAW_PANEL*>( m_canvas ) );
ActivateGalCanvas();
}

View File

@ -111,7 +111,7 @@ const EDA_RECT SCH_BITMAP::GetBoundingBox() const
}
void SCH_BITMAP::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset )
void SCH_BITMAP::Print( wxDC* aDC, const wxPoint& aOffset )
{
wxPoint pos = m_pos + aOffset;

View File

@ -111,7 +111,7 @@ public:
void SwapData( SCH_ITEM* aItem ) override;
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset ) override;
void Print( wxDC* aDC, const wxPoint& aOffset ) override;
/// @copydoc VIEW_ITEM::ViewGetLayers()
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;

View File

@ -22,11 +22,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file sch_bus_entry.cpp
*
*/
#include <fctsys.h>
#include <gr_basic.h>
#include <macros.h>
@ -36,7 +31,6 @@
#include <richio.h>
#include <plotter.h>
#include <bitmaps.h>
#include <eeschema_config.h>
#include <general.h>
#include <sch_bus_entry.h>
@ -57,6 +51,7 @@ SCH_BUS_ENTRY_BASE::SCH_BUS_ENTRY_BASE( KICAD_T aType, const wxPoint& pos, char
m_isDanglingStart = m_isDanglingEnd = true;
}
SCH_BUS_WIRE_ENTRY::SCH_BUS_WIRE_ENTRY( const wxPoint& pos, char shape ) :
SCH_BUS_ENTRY_BASE( SCH_BUS_WIRE_ENTRY_T, pos, shape )
{
@ -64,6 +59,7 @@ SCH_BUS_WIRE_ENTRY::SCH_BUS_WIRE_ENTRY( const wxPoint& pos, char shape ) :
m_connected_bus_item = nullptr;
}
SCH_BUS_BUS_ENTRY::SCH_BUS_BUS_ENTRY( const wxPoint& pos, char shape ) :
SCH_BUS_ENTRY_BASE( SCH_BUS_BUS_ENTRY_T, pos, shape )
{
@ -72,11 +68,13 @@ SCH_BUS_BUS_ENTRY::SCH_BUS_BUS_ENTRY( const wxPoint& pos, char shape ) :
m_connected_bus_items[1] = nullptr;
}
EDA_ITEM* SCH_BUS_WIRE_ENTRY::Clone() const
{
return new SCH_BUS_WIRE_ENTRY( *this );
}
EDA_ITEM* SCH_BUS_BUS_ENTRY::Clone() const
{
return new SCH_BUS_BUS_ENTRY( *this );
@ -108,7 +106,6 @@ void SCH_BUS_ENTRY_BASE::SwapData( SCH_ITEM* aItem )
void SCH_BUS_ENTRY_BASE::ViewGetLayers( int aLayers[], int& aCount ) const
{
aCount = 1;
aLayers[0] = Type() == SCH_BUS_BUS_ENTRY_T ? LAYER_BUS : LAYER_WIRE;
}
@ -159,13 +156,12 @@ void SCH_BUS_BUS_ENTRY::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemLis
}
void SCH_BUS_ENTRY_BASE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset )
void SCH_BUS_ENTRY_BASE::Print( wxDC* aDC, const wxPoint& aOffset )
{
COLOR4D color = GetLayerColor( m_Layer );
EDA_RECT* clipbox = aPanel->GetClipBox();
COLOR4D color = GetLayerColor( m_Layer );
GRLine( clipbox, aDC, m_pos.x + aOffset.x, m_pos.y + aOffset.y,
m_End().x + aOffset.x, m_End().y + aOffset.y, GetPenSize(), color );
GRLine( nullptr, aDC, m_pos.x + aOffset.x, m_pos.y + aOffset.y, m_End().x + aOffset.x,
m_End().y + aOffset.y, GetPenSize(), color );
}

View File

@ -85,7 +85,7 @@ public:
void ViewGetLayers( int aLayers[], int& aCount ) const override;
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset ) override;
void Print( wxDC* aDC, const wxPoint& aOffset ) override;
const EDA_RECT GetBoundingBox() const override;

View File

@ -541,7 +541,7 @@ int SCH_COMPONENT::GetUnitCount() const
}
void SCH_COMPONENT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset )
void SCH_COMPONENT::Print( wxDC* aDC, const wxPoint& aOffset )
{
auto opts = PART_DRAW_OPTIONS::Default();
opts.transform = m_transform;
@ -550,29 +550,28 @@ void SCH_COMPONENT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOff
if( PART_SPTR part = m_part.lock() )
{
part->Draw( aPanel, aDC, m_Pos + aOffset, m_unit, m_convert, opts );
part->Print( aDC, m_Pos + aOffset, m_unit, m_convert, opts );
}
else // Use dummy() part if the actual cannot be found.
{
dummy()->Draw( aPanel, aDC, m_Pos + aOffset, 0, 0, opts );
dummy()->Print( aDC, m_Pos + aOffset, 0, 0, opts );
}
SCH_FIELD* field = GetField( REFERENCE );
if( field->IsVisible() )
field->Draw( aPanel, aDC, aOffset );
field->Print(aDC, aOffset );
for( int ii = VALUE; ii < GetFieldCount(); ii++ )
{
field = GetField( ii );
field->Draw( aPanel, aDC, aOffset );
field->Print( aDC, aOffset );
}
}
void SCH_COMPONENT::AddHierarchicalReference( const wxString& aPath,
const wxString& aRef,
int aMulti )
void SCH_COMPONENT::AddHierarchicalReference( const wxString& aPath, const wxString& aRef,
int aMulti )
{
wxString h_path, h_ref;
wxStringTokenizer tokenizer;

View File

@ -466,14 +466,13 @@ public:
SCH_PINS& GetPins() { return m_pins; }
/**
* Draw a component
* Print a component
*
* @param aPanel is the panel to use (can be null) mainly used for clipping purposes.
* @param aDC is the device context (can be null)
* @param aOffset is the drawing offset (usually wxPoint(0,0),
* but can be different when moving an object)
*/
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset ) override;
void Print( wxDC* aDC, const wxPoint& aOffset ) override;
void SwapData( SCH_ITEM* aItem ) override;

View File

@ -44,12 +44,6 @@
using namespace std::placeholders;
// Events used by EDA_DRAW_PANEL
BEGIN_EVENT_TABLE( SCH_DRAW_PANEL, wxScrolledCanvas )
EVT_CHAR_HOOK( SCH_DRAW_PANEL::OnCharHook )
EVT_PAINT( SCH_DRAW_PANEL::onPaint )
END_EVENT_TABLE()
SCH_DRAW_PANEL::SCH_DRAW_PANEL( wxWindow* aParentWindow, wxWindowID aWindowId,
const wxPoint& aPosition, const wxSize& aSize,
KIGFX::GAL_DISPLAY_OPTIONS& aOptions, GAL_TYPE aGalType ) :
@ -57,7 +51,6 @@ SCH_DRAW_PANEL::SCH_DRAW_PANEL( wxWindow* aParentWindow, wxWindowID aWindowId,
m_parent( aParentWindow )
{
m_defaultCursor = m_currentCursor = wxCURSOR_ARROW;
m_showCrossHair = true;
m_view = new KIGFX::SCH_VIEW( true, dynamic_cast<SCH_BASE_FRAME*>( aParentWindow ) );
m_view->SetGAL( m_gal );
@ -83,11 +76,6 @@ SCH_DRAW_PANEL::SCH_DRAW_PANEL( wxWindow* aParentWindow, wxWindowID aWindowId,
// on updated viewport data.
m_viewControls = new KIGFX::WX_VIEW_CONTROLS( m_view, this );
Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( SCH_DRAW_PANEL::OnCharHook ), NULL, this );
m_cursorLevel = 0;
m_PrintIsMirrored = false;
m_viewControls->SetSnapping( true );
SetEvtHandlerEnabled( true );
@ -197,12 +185,6 @@ void SCH_DRAW_PANEL::Refresh( bool aEraseBackground, const wxRect* aRect )
}
void SCH_DRAW_PANEL::OnCharHook( wxKeyEvent& event )
{
event.Skip();
}
void SCH_DRAW_PANEL::onPaint( wxPaintEvent& aEvent )
{
if( !m_gal->IsInitialized() || !m_gal->IsVisible() )

View File

@ -41,7 +41,6 @@ public:
void DisplaySheet( const SCH_SCREEN *aScreen );
bool SwitchBackend( GAL_TYPE aGalType ) override;
void OnCharHook( wxKeyEvent& event );
BASE_SCREEN* GetScreen() override;
virtual EDA_DRAW_FRAME* GetParent() const override;
@ -60,8 +59,6 @@ protected:
void setDefaultLayerOrder(); ///> Reassigns layer order to the initial settings.
void setDefaultLayerDeps(); ///> Sets rendering targets & dependencies for layers.
DECLARE_EVENT_TABLE()
};
#endif

View File

@ -47,7 +47,7 @@
#include <lib_pin.h>
#include <lib_text.h>
#include <sch_text.h>
#include <draw_graphic_text.h>
#include <gr_text.h>
#include <sch_marker.h>
#include <sch_bus_entry.h>
#include <eagle_parser.h>

View File

@ -1083,8 +1083,8 @@ void SCH_EDIT_FRAME::PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMod
wxString fileName = Prj().AbsolutePath( GetScreen()->GetFileName() );
GRSetDrawMode( aDC, GR_DEFAULT_DRAWMODE );
GetScreen()->Draw( m_canvas, aDC );
DrawWorkSheet( aDC, GetScreen(), GetDefaultLineThickness(), IU_PER_MILS, fileName );
GetScreen()->Print( aDC );
PrintWorkSheet( aDC, GetScreen(), GetDefaultLineThickness(), IU_PER_MILS, fileName );
}

View File

@ -22,11 +22,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file sch_field.cpp
* @brief Implementation of the SCH_FIELD class.
*/
/* Fields are texts attached to a component, having a special meaning
* Fields 0 and 1 are very important: reference and value
* Field 2 is used as default footprint name.
@ -39,7 +34,7 @@
#include <sch_draw_panel.h>
#include <base_struct.h>
#include <gr_basic.h>
#include <draw_graphic_text.h>
#include <gr_text.h>
#include <macros.h>
#include <sch_edit_frame.h>
#include <plotter.h>
@ -150,7 +145,7 @@ int SCH_FIELD::GetPenSize() const
}
void SCH_FIELD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset )
void SCH_FIELD::Print( wxDC* aDC, const wxPoint& aOffset )
{
int orient;
COLOR4D color;
@ -206,10 +201,8 @@ void SCH_FIELD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset
else
color = GetLayerColor( LAYER_FIELDS );
EDA_RECT* clipbox = aPanel ? aPanel->GetClipBox() : NULL;
DrawGraphicText( clipbox, aDC, textpos, color, GetFullyQualifiedText(), orient, GetTextSize(),
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, lineWidth, IsItalic(),
IsBold() );
GRText( aDC, textpos, color, GetFullyQualifiedText(), orient, GetTextSize(),
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, lineWidth, IsItalic(), IsBold() );
}
@ -378,8 +371,7 @@ bool SCH_FIELD::Replace( wxFindReplaceData& aSearchData, void* aAuxData )
SCH_COMPONENT* component = (SCH_COMPONENT*) m_Parent;
wxCHECK_MSG( component != NULL, false,
wxT( "No symbol associated with field" ) + text );
wxCHECK_MSG( component != NULL, false, wxT( "No symbol associated with field" ) + text );
text = component->GetRef( (SCH_SHEET_PATH*) aAuxData );
@ -540,8 +532,7 @@ void SCH_FIELD::SetPosition( const wxPoint& aPosition )
wxPoint SCH_FIELD::GetPosition() const
{
SCH_COMPONENT* component = (SCH_COMPONENT*) GetParent();
wxPoint pos = GetTextPos() - component->GetPosition();
wxPoint pos = GetTextPos() - component->GetPosition();
return component->GetTransform().TransformCoordinate( pos ) + component->GetPosition();
}

View File

@ -149,7 +149,7 @@ public:
int GetPenSize() const override;
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset ) override;
void Print( wxDC* aDC, const wxPoint& aOffset ) override;
void Move( const wxPoint& aMoveVector ) override
{

View File

@ -41,7 +41,7 @@ class wxFindReplaceData;
class PLOTTER;
class NETLIST_OBJECT;
class NETLIST_OBJECT_LIST;
class EDA_DRAW_PANEL;
enum DANGLING_END_T {
UNKNOWN = 0,
@ -212,14 +212,13 @@ public:
virtual int GetPenSize() const { return 0; }
/**
* Function Draw
* Draw a schematic item. Each schematic item should have its own method
* @param aPanel DrawPanel to use (can be null) mainly used for clipping purposes.
* Function Print
* Print a schematic item. Each schematic item should have its own method
* @param aDC Device Context (can be null)
* @param aOffset drawing Offset (usually wxPoint(0,0),
* but can be different when moving an object)
*/
virtual void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset ) = 0;
virtual void Print( wxDC* aDC, const wxPoint& aOffset ) = 0;
/**
* Function Move

View File

@ -92,12 +92,12 @@ const EDA_RECT SCH_JUNCTION::GetBoundingBox() const
}
void SCH_JUNCTION::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset )
void SCH_JUNCTION::Print( wxDC* aDC, const wxPoint& aOffset )
{
auto conn = Connection( *g_CurrentSheet );
COLOR4D color = GetLayerColor( ( conn && conn->IsBus() ) ? LAYER_BUS : m_Layer );
GRFilledCircle( aPanel->GetClipBox(), aDC, m_pos.x + aOffset.x, m_pos.y + aOffset.y,
GRFilledCircle( nullptr, aDC, m_pos.x + aOffset.x, m_pos.y + aOffset.y,
( GetEffectiveSymbolSize() / 2 ), 0, color, color );
}

View File

@ -59,7 +59,7 @@ public:
const EDA_RECT GetBoundingBox() const override;
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset ) override;
void Print( wxDC* aDC, const wxPoint& aOffset ) override;
void Move( const wxPoint& aMoveVector ) override
{

View File

@ -28,7 +28,7 @@
#include <wx/filename.h>
#include <wx/tokenzr.h>
#include <pgm_base.h>
#include <draw_graphic_text.h>
#include <gr_text.h>
#include <kiway.h>
#include <kicad_string.h>
#include <richio.h>

View File

@ -319,14 +319,14 @@ int SCH_LINE::GetPenSize() const
}
void SCH_LINE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset )
void SCH_LINE::Print( wxDC* DC, const wxPoint& offset )
{
COLOR4D color = ( m_color != COLOR4D::UNSPECIFIED ) ? m_color : GetLayerColor( m_Layer );
int width = GetPenSize();
wxPoint start = m_start;
wxPoint end = m_end;
GRLine( panel->GetClipBox(), DC, start.x, start.y, end.x, end.y, width, color,
GRLine( nullptr, DC, start.x, start.y, end.x, end.y, width, color,
getwxPenStyle( (PlotDashType) GetLineStyle() ) );
}

View File

@ -128,7 +128,7 @@ public:
*/
double GetLength() const;
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset ) override;
void Print( wxDC* aDC, const wxPoint& aOffset ) override;
int GetPenSize() const override;

View File

@ -72,7 +72,7 @@ void SCH_MARKER::Show( int nestLevel, std::ostream& os ) const
#endif
void SCH_MARKER::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset )
void SCH_MARKER::Print( wxDC* aDC, const wxPoint& aOffset )
{
COLOR4D tmp = m_Color;
@ -82,7 +82,7 @@ void SCH_MARKER::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset
GetLayerColor( LAYER_ERC_ERR ) : GetLayerColor( LAYER_ERC_WARN );
}
DrawMarker( aPanel, aDC, aOffset );
PrintMarker( aDC, aOffset );
m_Color = tmp;
}

View File

@ -47,7 +47,7 @@ public:
void ViewGetLayers( int aLayers[], int& aCount ) const override;
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset ) override;
void Print( wxDC* aDC, const wxPoint& aOffset ) override;
void Plot( PLOTTER* aPlotter ) override
{

View File

@ -99,19 +99,17 @@ int SCH_NO_CONNECT::GetPenSize() const
}
void SCH_NO_CONNECT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset )
void SCH_NO_CONNECT::Print( wxDC* aDC, const wxPoint& aOffset )
{
int pX, pY;
int half = GetSize() / 2;
int width = GetDefaultLineThickness();
pX = m_pos.x + aOffset.x;
pY = m_pos.y + aOffset.y;
int pX = m_pos.x + aOffset.x;
int pY = m_pos.y + aOffset.y;
COLOR4D color = GetLayerColor( LAYER_NOCONNECT );
GRLine( aPanel->GetClipBox(), aDC, pX - half, pY - half, pX + half, pY + half, width, color );
GRLine( aPanel->GetClipBox(), aDC, pX + half, pY - half, pX - half, pY + half, width, 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 );
}

View File

@ -62,7 +62,7 @@ public:
void ViewGetLayers( int aLayers[], int& aCount ) const override;
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset ) override;
void Print( wxDC* aDC, const wxPoint& aOffset ) override;
void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) override;

View File

@ -44,7 +44,7 @@
#include <sch_bus_entry.h>
#include <sch_bitmap.h>
#include <sch_sheet.h>
#include <draw_graphic_text.h>
#include <gr_text.h>
#include <geometry/geometry_utils.h>
#include <lib_edit_frame.h>
#include <plotter.h>

View File

@ -63,7 +63,7 @@ public:
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
void GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList ) override;
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset ) override {}
void Print( wxDC* aDC, const wxPoint& aOffset ) override {}
void Move( const wxPoint& aMoveVector ) override {}

View File

@ -38,7 +38,7 @@
#include <kiway.h>
#include <sch_draw_panel.h>
#include <sch_item.h>
#include <draw_graphic_text.h>
#include <gr_text.h>
#include <sch_edit_frame.h>
#include <plotter.h>
@ -524,12 +524,8 @@ void SCH_SCREEN::UpdateSymbolLinks( bool aForce )
}
void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC )
void SCH_SCREEN::Print( wxDC* aDC )
{
/* note: SCH_SCREEN::Draw is useful only for schematic.
* library editor and library viewer do not use m_drawList, and therefore
* their SCH_SCREEN::Draw() draws nothing
*/
std::vector< SCH_ITEM* > junctions;
// Ensure links are up to date, even if a library was reloaded for some reason:
@ -543,30 +539,11 @@ void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC )
if( item->Type() == SCH_JUNCTION_T )
junctions.push_back( item );
else
// uncomment line below when there is a virtual EDA_ITEM::GetBoundingBox()
// if( panel->GetClipBox().Intersects( item->GetBoundingBox() ) )
item->Draw( aCanvas, aDC, wxPoint( 0, 0 ) );
// TODO(JE) Remove debugging code
#ifdef DEBUG
auto conn = item->Connection( *g_CurrentSheet );
if( conn )
{
auto pos = item->GetBoundingBox().Centre();
int sz = Mils2iu( 15 );
auto label = conn->Name( true );
auto text = SCH_TEXT( pos, label, SCH_TEXT_T );
text.SetTextSize( wxSize( sz, sz ) );
text.Draw( aCanvas, aDC, wxPoint( 10, 10 ) );
}
#endif
item->Print( aDC, wxPoint( 0, 0 ) );
}
for( auto item : junctions )
item->Draw( aCanvas, aDC, wxPoint( 0, 0 ) );
item->Print( aDC, wxPoint( 0, 0 ) );
}

View File

@ -222,15 +222,14 @@ public:
void UpdateSymbolLinks( bool aForce = false );
/**
* Draw all the items in the screen to \a aCanvas.
* Print all the items in the screen to \a aDC.
*
* @note This function is useful only for schematic. The library editor and library viewer
* do not use a draw list and therefore draws nothing.
*
* @param aCanvas The canvas item to draw on.
* @param aDC The device context to draw on.
*/
void Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC );
void Print( wxDC* aDC );
/**
* Plot all the schematic objects to \a aPlotter.

View File

@ -29,7 +29,7 @@
#include <fctsys.h>
#include <sch_draw_panel.h>
#include <draw_graphic_text.h>
#include <gr_text.h>
#include <trigo.h>
#include <richio.h>
#include <sch_edit_frame.h>
@ -433,7 +433,7 @@ void SCH_SHEET::ViewGetLayers( int aLayers[], int& aCount ) const
}
void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset )
void SCH_SHEET::Print( wxDC* aDC, const wxPoint& aOffset )
{
wxString Text;
int name_orientation;
@ -442,10 +442,9 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset
int lineWidth = GetPenSize();
int textWidth;
wxSize textSize;
EDA_RECT* clipbox = aPanel? aPanel->GetClipBox() : NULL;
COLOR4D color = GetLayerColor( m_Layer );
GRRect( clipbox, aDC, pos.x, pos.y, pos.x + m_size.x, pos.y + m_size.y, lineWidth, color );
GRRect( nullptr, aDC, pos.x, pos.y, pos.x + m_size.x, pos.y + m_size.y, lineWidth, color );
pos_sheetname = GetSheetNamePosition() + aOffset;
pos_filename = GetFileNamePosition() + aOffset;
@ -459,21 +458,19 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset
Text = wxT( "Sheet: " ) + m_name;
textSize = wxSize( m_sheetNameSize, m_sheetNameSize );
textWidth = Clamp_Text_PenSize( lineWidth, textSize, false );
DrawGraphicText( clipbox, aDC, pos_sheetname, GetLayerColor( LAYER_SHEETNAME ), Text,
name_orientation, textSize, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM,
textWidth, false, false );
GRText( aDC, pos_sheetname, GetLayerColor( LAYER_SHEETNAME ), Text, name_orientation,
textSize, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, textWidth, false, false );
/* Draw text : FileName */
Text = wxT( "File: " ) + m_fileName;
textSize = wxSize( m_fileNameSize, m_fileNameSize );
textWidth = Clamp_Text_PenSize( lineWidth, textSize, false );
DrawGraphicText( clipbox, aDC, pos_filename, GetLayerColor( LAYER_SHEETFILENAME ), Text,
name_orientation, textSize, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP,
textWidth, false, false );
GRText( aDC, pos_filename, GetLayerColor( LAYER_SHEETFILENAME ), Text, name_orientation,
textSize, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, textWidth, false, false );
/* Draw text : SheetLabel */
for( SCH_SHEET_PIN& sheetPin : m_pins )
sheetPin.Draw( aPanel, aDC, aOffset );
sheetPin.Print( aDC, aOffset );
}

View File

@ -106,7 +106,7 @@ public:
*/
bool IsMovableFromAnchorPoint() override { return true; }
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset ) override;
void Print( wxDC* aDC, const wxPoint& aOffset ) override;
/**
* Calculate the graphic shape (a polygon) associated to the text.
@ -395,7 +395,7 @@ public:
int GetPenSize() const override;
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset ) override;
void Print( wxDC* aDC, const wxPoint& aOffset ) override;
EDA_RECT const GetBoundingBox() const override;

View File

@ -25,7 +25,7 @@
#include <fctsys.h>
#include <gr_basic.h>
#include <sch_draw_panel.h>
#include <draw_graphic_text.h>
#include <gr_text.h>
#include <plotter.h>
#include <trigo.h>
#include <richio.h>
@ -65,11 +65,10 @@ EDA_ITEM* SCH_SHEET_PIN::Clone() const
}
void SCH_SHEET_PIN::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset )
void SCH_SHEET_PIN::Print( wxDC* aDC, const wxPoint& aOffset )
{
// The icon selection is handle by the virtual method CreateGraphicShape
// called by ::Draw
SCH_HIERLABEL::Draw( aPanel, aDC, aOffset );
// The icon selection is handle by the virtual method CreateGraphicShape called by ::Print
SCH_HIERLABEL::Print( aDC, aOffset );
}

View File

@ -33,7 +33,7 @@
#include <macros.h>
#include <trigo.h>
#include <sch_draw_panel.h>
#include <draw_graphic_text.h>
#include <gr_text.h>
#include <sch_edit_frame.h>
#include <plotter.h>
#include <msgpanel.h>
@ -302,11 +302,10 @@ int SCH_TEXT::GetPenSize() const
}
void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset )
void SCH_TEXT::Print( wxDC* DC, const wxPoint& aOffset )
{
COLOR4D color = GetLayerColor( m_Layer );
int linewidth = GetThickness() == 0 ? GetDefaultLineThickness() : GetThickness();
EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL;
linewidth = Clamp_Text_PenSize( linewidth, GetTextSize(), IsBold() );
@ -315,7 +314,7 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset )
int savedWidth = GetThickness();
SetThickness( linewidth ); // Set the minimum width
EDA_TEXT::Draw( clipbox, DC, text_offset, color, GR_DEFAULT_DRAWMODE );
EDA_TEXT::Print( DC, text_offset, color );
SetThickness( savedWidth );
}
@ -484,9 +483,7 @@ void SCH_TEXT::GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
// If a bus connects to label
if( Connection( *aSheetPath )->IsBusLabel( m_Text ) )
{
item->ConvertBusToNetListItems( aNetListItems );
}
}
@ -512,7 +509,7 @@ bool SCH_TEXT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
void SCH_TEXT::Plot( PLOTTER* aPlotter )
{
static std::vector <wxPoint> Poly;
static std::vector<wxPoint> Poly;
COLOR4D color = GetLayerColor( GetLayer() );
int tmp = GetThickness();
int thickness = GetPenSize();
@ -536,9 +533,8 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter )
{
wxPoint textpos = positions[ii] + GetSchematicTextOffset();
wxString& txt = strings_list.Item( ii );
aPlotter->Text( textpos, color, txt, GetTextAngle(), GetTextSize(),
GetHorizJustify(), GetVertJustify(),
thickness, IsItalic(), IsBold() );
aPlotter->Text( textpos, color, txt, GetTextAngle(), GetTextSize(), GetHorizJustify(),
GetVertJustify(), thickness, IsItalic(), IsBold() );
}
}
else
@ -546,8 +542,7 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter )
wxPoint textpos = GetTextPos() + GetSchematicTextOffset();
aPlotter->Text( textpos, color, GetShownText(), GetTextAngle(), GetTextSize(),
GetHorizJustify(), GetVertJustify(),
thickness, IsItalic(), IsBold() );
GetHorizJustify(), GetVertJustify(), thickness, IsItalic(), IsBold() );
}
// Draw graphic symbol for global or hierarchical labels
@ -568,11 +563,11 @@ void SCH_TEXT::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList )
switch( Type() )
{
case SCH_TEXT_T: msg = _( "Graphic Text" ); break;
case SCH_LABEL_T: msg = _( "Label" ); break;
case SCH_GLOBAL_LABEL_T: msg = _( "Global Label" ); break;
case SCH_HIER_LABEL_T: msg = _( "Hierarchical Label" ); break;
case SCH_SHEET_PIN_T: msg = _( "Hierarchical Sheet Pin" ); break;
case SCH_TEXT_T: msg = _( "Graphic Text" ); break;
case SCH_LABEL_T: msg = _( "Label" ); break;
case SCH_GLOBAL_LABEL_T: msg = _( "Global Label" ); break;
case SCH_HIER_LABEL_T: msg = _( "Hierarchical Label" ); break;
case SCH_SHEET_PIN_T: msg = _( "Hierarchical Sheet Pin" ); break;
default: return;
}
@ -600,11 +595,8 @@ void SCH_TEXT::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Style" ), textStyle[style], BROWN ) );
// Display electricat type if it is relevant
if( (Type() == SCH_GLOBAL_LABEL_T) ||
(Type() == SCH_HIER_LABEL_T ) ||
(Type() == SCH_SHEET_PIN_T ) )
// Display electrical type if it is relevant
if( Type() == SCH_GLOBAL_LABEL_T || Type() == SCH_HIER_LABEL_T || Type() == SCH_SHEET_PIN_T )
{
switch( GetShape() )
{
@ -624,11 +616,8 @@ void SCH_TEXT::GetMsgPanelInfo( EDA_UNITS_T aUnits, MSG_PANEL_ITEMS& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Size" ), msg, RED ) );
#if defined(DEBUG)
if( auto conn = Connection( *g_CurrentSheet ) )
{
conn->AppendDebugInfoToMsgPanel( aList );
}
msg.Printf( "%p", this );
aList.push_back( MSG_PANEL_ITEM( "Object Address", msg, RED ) );
@ -796,7 +785,7 @@ void SCH_GLOBALLABEL::SetLabelSpinStyle( int aSpinStyle )
}
void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset )
void SCH_GLOBALLABEL::Print( wxDC* DC, const wxPoint& aOffset )
{
static std::vector <wxPoint> Poly;
COLOR4D color = GetLayerColor( m_Layer );
@ -809,13 +798,12 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOff
int save_width = GetThickness();
SetThickness( linewidth );
EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL;
EDA_TEXT::Draw( clipbox, DC, text_offset, color, GR_DEFAULT_DRAWMODE );
EDA_TEXT::Print( DC, text_offset, color );
SetThickness( save_width ); // restore initial value
CreateGraphicShape( Poly, GetTextPos() + aOffset );
GRPoly( clipbox, DC, Poly.size(), &Poly[0], 0, linewidth, color, color );
GRPoly( nullptr, DC, Poly.size(), &Poly[0], 0, linewidth, color, color );
}
@ -1036,13 +1024,13 @@ void SCH_HIERLABEL::SetLabelSpinStyle( int aSpinStyle )
}
void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset )
void SCH_HIERLABEL::Print( wxDC* DC, const wxPoint& offset )
{
static std::vector <wxPoint> Poly;
auto conn = Connection( *g_CurrentSheet );
COLOR4D color = GetLayerColor( ( conn && conn->IsBus() ) ? LAYER_BUS : m_Layer );
int linewidth = GetThickness() == 0 ? GetDefaultLineThickness() : GetThickness();
EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL;
auto conn = Connection( *g_CurrentSheet );
COLOR4D color = GetLayerColor( ( conn && conn->IsBus() ) ? LAYER_BUS : m_Layer );
int linewidth = GetThickness() == 0 ? GetDefaultLineThickness() : GetThickness();
linewidth = Clamp_Text_PenSize( linewidth, GetTextSize(), IsBold() );
@ -1050,12 +1038,12 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset
SetThickness( linewidth );
wxPoint text_offset = offset + GetSchematicTextOffset();
EDA_TEXT::Draw( clipbox, DC, text_offset, color, GR_DEFAULT_DRAWMODE );
EDA_TEXT::Print( DC, text_offset, color );
SetThickness( save_width ); // restore initial value
CreateGraphicShape( Poly, GetTextPos() + offset );
GRPoly( clipbox, DC, Poly.size(), &Poly[0], 0, linewidth, color, color );
GRPoly( nullptr, DC, Poly.size(), &Poly[0], 0, linewidth, color, color );
}

View File

@ -130,7 +130,7 @@ public:
*/
virtual wxPoint GetSchematicTextOffset() const;
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset ) override;
void Print( wxDC* DC, const wxPoint& offset ) override;
/**
* Calculate the graphic shape (a polygon) associated to the text.
@ -251,7 +251,7 @@ public:
~SCH_GLOBALLABEL() { }
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset ) override;
void Print( wxDC* DC, const wxPoint& offset ) override;
wxString GetClass() const override
{
@ -296,7 +296,7 @@ public:
~SCH_HIERLABEL() { }
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset ) override;
void Print( wxDC* DC, const wxPoint& offset ) override;
wxString GetClass() const override
{

View File

@ -448,19 +448,15 @@ void SCH_EDIT_FRAME::DrawCurrentSheetToClipboard( wxCommandEvent& aEvt )
wxBitmap image( dcsize );
dc.SelectObject( image );
EDA_RECT tmp = *GetCanvas()->GetClipBox();
GRResetPenAndBrush( &dc );
GRForceBlackPen( false );
screen->m_IsPrinting = true;
dc.SetUserScale( scale, scale );
GetCanvas()->SetClipBox( EDA_RECT( wxPoint( 0, 0 ), wxSize( 0x7FFFFF0, 0x7FFFFF0 ) ) );
dc.Clear();
const LSET allLayersMask = LSET().set();
PrintPage( &dc, allLayersMask, false );
screen->m_IsPrinting = false;
GetCanvas()->SetClipBox( tmp );
if( wxTheClipboard->Open() )
{

View File

@ -34,7 +34,6 @@
#include <gerbview.h>
#include <gerbview_frame.h>
#include <kicad_device_context.h>
#include <gerbview_id.h>
#include <gerber_file_image.h>
#include <gerber_file_image_list.h>

View File

@ -29,7 +29,7 @@
#include <fctsys.h>
#include <gr_basic.h>
#include <draw_graphic_text.h>
#include <gr_text.h>
#include <gerbview_frame.h>
#include <class_drawpanel.h>
#include <gbr_layout.h>
@ -84,317 +84,6 @@ EDA_RECT GBR_LAYOUT::ComputeBoundingBox() const
}
// Redraw All GerbView layers, using a buffered mode or not
void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
const wxPoint& aOffset, GBR_DISPLAY_OPTIONS* aDisplayOptions )
{
GERBVIEW_FRAME* gerbFrame = (GERBVIEW_FRAME*) aPanel->GetParent();
// Collect the highlight selections
wxString cmpHighlight;
if( gerbFrame->m_SelComponentBox->GetSelection() > 0 )
cmpHighlight = gerbFrame->m_SelComponentBox->GetStringSelection();
wxString netHighlight;
if( gerbFrame->m_SelNetnameBox->GetSelection() > 0 )
netHighlight = gerbFrame->m_SelNetnameBox->GetStringSelection();
wxString aperAttrHighlight = gerbFrame->m_SelAperAttributesBox->GetStringSelection();
if( gerbFrame->m_SelAperAttributesBox->GetSelection() > 0 )
aperAttrHighlight = gerbFrame->m_SelAperAttributesBox->GetStringSelection();
// Because Images can be negative (i.e with background filled in color) items are drawn
// graphic layer per graphic layer, after the background is filled
// to a temporary bitmap
// at least when aDrawMode = GR_COPY or aDrawMode = GR_OR
// If aDrawMode = UNSPECIFIED_DRAWMODE, items are drawn to the main screen, and therefore
// artifacts can happen with negative items or negative images
int bitmapWidth, bitmapHeight;
wxDC* plotDC = aDC;
aPanel->GetClientSize( &bitmapWidth, &bitmapHeight );
wxBitmap* layerBitmap = NULL;
wxBitmap* screenBitmap = NULL;
wxMemoryDC layerDC; // used sequentially for each gerber layer
wxMemoryDC screenDC;
// When each image must be drawn using GR_OR (transparency mode)
// or GR_COPY (stacked mode) we must use a temporary bitmap
// to draw gerber images.
// this is due to negative objects (drawn using background color) that create artifacts
// on other images when drawn on screen
bool useBufferBitmap = false;
#ifndef __WXMAC__
// Can't work with MAC
// Don't try this with retina display
if( (aDrawMode == GR_COPY) || ( aDrawMode == GR_OR ) )
useBufferBitmap = true;
#endif
// these parameters are saved here, because they are modified
// and restored later
EDA_RECT drawBox = *aPanel->GetClipBox();
double scale;
aDC->GetUserScale(&scale, &scale);
wxPoint dev_org = aDC->GetDeviceOrigin();
wxPoint logical_org = aDC->GetLogicalOrigin( );
COLOR4D bgColor = aDisplayOptions->m_BgDrawColor;
wxBrush bgBrush( bgColor.ToColour(), wxBRUSHSTYLE_SOLID );
if( useBufferBitmap )
{
layerBitmap = new wxBitmap( bitmapWidth, bitmapHeight );
screenBitmap = new wxBitmap( bitmapWidth, bitmapHeight );
layerDC.SelectObject( *layerBitmap );
aPanel->DoPrepareDC( layerDC );
aPanel->SetClipBox( drawBox );
layerDC.SetBackground( bgBrush );
layerDC.SetBackgroundMode( wxSOLID );
layerDC.Clear();
screenDC.SelectObject( *screenBitmap );
screenDC.SetBackground( bgBrush );
screenDC.SetBackgroundMode( wxSOLID );
screenDC.Clear();
plotDC = &layerDC;
}
bool doBlit = false; // this flag requests an image transfer to actual screen when true.
bool end = false;
// Draw graphic layers from bottom to top, and the active layer is on the top of others.
// In non transparent modes, the last layer drawn masks others layers
for( int layer = GERBER_DRAWLAYERS_COUNT-1; !end; --layer )
{
int active_layer = gerbFrame->GetActiveLayer();
if( layer == active_layer ) // active layer will be drawn after other layers
continue;
if( layer < 0 ) // last loop: draw active layer
{
end = true;
layer = active_layer;
}
GERBER_FILE_IMAGE* gerber = GetImagesList()->GetGbrImage( layer );
if( gerber == NULL ) // Graphic layer not yet used
continue;
if( !gerbFrame->IsLayerVisible( layer ) )
continue;
gerber->m_PositiveDrawColor = gerbFrame->GetLayerColor( GERBER_DRAW_LAYER( layer ) );
// Force black and white draw mode on request:
if( aDisplayOptions->m_ForceBlackAndWhite )
gerber->m_PositiveDrawColor = ( aDisplayOptions->m_BgDrawColor == BLACK ) ? WHITE : BLACK;
if( useBufferBitmap )
{
// Draw each layer into a bitmap first. Negative Gerber
// layers are drawn in background color.
if( gerber->HasNegativeItems() && doBlit )
{
// Set Device origin, logical origin and scale to default values
// This is needed by Blit function when using a mask.
// Beside, for Blit call, both layerDC and screenDc must have the same settings
layerDC.SetDeviceOrigin(0,0);
layerDC.SetLogicalOrigin( 0, 0 );
layerDC.SetUserScale( 1, 1 );
if( aDrawMode == GR_COPY )
{
// Use the layer bitmap itself as a mask when blitting. The bitmap
// cannot be referenced by a device context when setting the mask.
layerDC.SelectObject( wxNullBitmap );
layerBitmap->SetMask( new wxMask( *layerBitmap, bgColor.ToColour() ) );
layerDC.SelectObject( *layerBitmap );
screenDC.Blit( 0, 0, bitmapWidth, bitmapHeight, &layerDC, 0, 0, wxCOPY, true );
}
else if( aDrawMode == GR_OR )
{
// On Linux with a large screen, this version is much faster and without
// flicker, but gives a Pcbnew look where layer colors blend together.
// Plus it works only because the background color is black. But it may
// be more usable for some. The difference is due in part because of
// the cpu cycles needed to create the monochromatic bitmap above, and
// the extra time needed to do bit indexing into the monochromatic bitmap
// on the blit above.
screenDC.Blit( 0, 0, bitmapWidth, bitmapHeight, &layerDC, 0, 0, wxOR );
}
// Restore actual values and clear bitmap for next drawing
layerDC.SetDeviceOrigin( dev_org.x, dev_org.y );
layerDC.SetLogicalOrigin( logical_org.x, logical_org.y );
layerDC.SetUserScale( scale, scale );
layerDC.SetBackground( bgBrush );
layerDC.SetBackgroundMode( wxSOLID );
layerDC.Clear();
doBlit = false;
}
}
if( gerber->m_ImageNegative )
{
// Draw background negative (i.e. in graphic layer color) for negative images.
COLOR4D neg_color = gerber->GetPositiveDrawColor();
GRSetDrawMode( &layerDC, GR_COPY );
GRFilledRect( &drawBox, plotDC, drawBox.GetX(), drawBox.GetY(),
drawBox.GetRight(), drawBox.GetBottom(),
0, neg_color, neg_color );
GRSetDrawMode( plotDC, GR_COPY );
doBlit = true;
}
int dcode_highlight = 0;
if( layer == gerbFrame->GetActiveLayer() )
dcode_highlight = gerber->m_Selected_Tool;
GR_DRAWMODE layerdrawMode = GR_COPY;
if( aDrawMode == GR_OR && !gerber->HasNegativeItems() )
layerdrawMode = GR_OR;
// Now we can draw the current layer to the bitmap buffer
// When needed, the previous bitmap is already copied to the screen buffer.
for( GERBER_DRAW_ITEM* item = gerber->GetItemsList(); item; item = item->Next() )
{
if( item->GetLayer() != layer )
continue;
GR_DRAWMODE drawMode = layerdrawMode;
if( dcode_highlight && dcode_highlight == item->m_DCode )
DrawModeAddHighlight( &drawMode);
if( !aperAttrHighlight.IsEmpty() && item->GetDcodeDescr() &&
item->GetDcodeDescr()->m_AperFunction == aperAttrHighlight )
DrawModeAddHighlight( &drawMode);
if( !cmpHighlight.IsEmpty() &&
cmpHighlight == item->GetNetAttributes().m_Cmpref )
DrawModeAddHighlight( &drawMode);
if( !netHighlight.IsEmpty() &&
netHighlight == item->GetNetAttributes().m_Netname )
DrawModeAddHighlight( &drawMode);
item->Draw( aPanel, plotDC, drawMode, wxPoint(0,0), aDisplayOptions );
doBlit = true;
}
}
if( doBlit && useBufferBitmap ) // Blit is used only if aDrawMode >= 0
{
// For this Blit call, layerDC and screenDC must have the same settings
// So we set device origin, logical origin and scale to default values
// in layerDC
layerDC.SetDeviceOrigin(0,0);
layerDC.SetLogicalOrigin( 0, 0 );
layerDC.SetUserScale( 1, 1 );
// this is the last transfer to screenDC. If there are no negative items, this is
// the only one
if( aDrawMode == GR_COPY )
{
layerDC.SelectObject( wxNullBitmap );
layerBitmap->SetMask( new wxMask( *layerBitmap, bgColor.ToColour() ) );
layerDC.SelectObject( *layerBitmap );
screenDC.Blit( 0, 0, bitmapWidth, bitmapHeight, &layerDC, 0, 0, wxCOPY, true );
}
else if( aDrawMode == GR_OR )
{
screenDC.Blit( 0, 0, bitmapWidth, bitmapHeight, &layerDC, 0, 0, wxOR );
}
}
if( useBufferBitmap )
{
// For this Blit call, aDC and screenDC must have the same settings
// So we set device origin, logical origin and scale to default values
// in aDC
aDC->SetDeviceOrigin( 0, 0);
aDC->SetLogicalOrigin( 0, 0 );
aDC->SetUserScale( 1, 1 );
aDC->Blit( 0, 0, bitmapWidth, bitmapHeight, &screenDC, 0, 0, wxCOPY );
// Restore aDC values
aDC->SetDeviceOrigin(dev_org.x, dev_org.y);
aDC->SetLogicalOrigin( logical_org.x, logical_org.y );
aDC->SetUserScale( scale, scale );
layerDC.SelectObject( wxNullBitmap );
screenDC.SelectObject( wxNullBitmap );
delete layerBitmap;
delete screenBitmap;
}
}
void GBR_LAYOUT::DrawItemsDCodeID( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
GR_DRAWMODE aDrawMode, COLOR4D aDrawColor )
{
wxString Line;
GRSetDrawMode( aDC, aDrawMode );
GERBVIEW_FRAME* gerbFrame = static_cast<GERBVIEW_FRAME*>( aPanel->GetParent() );
for( unsigned layer = 0; layer < GetImagesList()->ImagesMaxCount(); ++layer )
{
GERBER_FILE_IMAGE* gerber = GetImagesList()->GetGbrImage( layer );
if( gerber == NULL ) // Graphic layer not yet used
continue;
if( !gerbFrame->IsLayerVisible( layer ) )
continue;
for( GERBER_DRAW_ITEM* item = gerber->GetItemsList(); item != NULL; item = item->Next() )
{
wxPoint pos;
int size;
double orient;
if( ! item->GetTextD_CodePrms( size, pos, orient ) )
continue;
Line.Printf( wxT( "D%d" ), item->m_DCode );
// Avoid to draw text, if it is too small (size in pixel < 5 pixels)
// to be readable:
int size_pixel = aDC->LogicalToDeviceXRel( size );
const int threshold = 5;
if( size_pixel >= threshold )
{
DrawGraphicText( aPanel->GetClipBox(), aDC, pos, aDrawColor, Line,
orient, wxSize( size, size ),
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
0, false, false );
}
}
}
}
SEARCH_RESULT GBR_LAYOUT::Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] )
{
KICAD_T stype;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012-2014 Jean-Pierre Charras jp.charras at wanadoo.fr
* Copyright (C) 1992-2014 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 1992-2019 KiCad Developers, see change_log.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
@ -58,7 +58,6 @@ private:
wxPoint m_originAxisPosition;
public:
GBR_LAYOUT();
~GBR_LAYOUT();
@ -71,25 +70,11 @@ public:
// which handles the list of gerber files (and drill files) images loaded
GERBER_FILE_IMAGE_LIST* GetImagesList() const;
const wxPoint& GetAuxOrigin() const
{
return m_originAxisPosition;
}
const wxPoint& GetAuxOrigin() const { return m_originAxisPosition; }
void SetAuxOrigin( const wxPoint& aPosition ) { m_originAxisPosition = aPosition; }
void SetAuxOrigin( const wxPoint& aPosition )
{
m_originAxisPosition = aPosition;
}
TITLE_BLOCK& GetTitleBlock()
{
return m_titles;
}
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock )
{
m_titles = aTitleBlock;
}
TITLE_BLOCK& GetTitleBlock() { return m_titles; }
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; }
/**
* Function ComputeBoundingBox
@ -108,39 +93,11 @@ public:
void SetBoundingBox( const EDA_RECT& aBox ) { m_BoundingBox = aBox; }
/**
* Function Draw.
* Redraw the CLASS_GBR_LAYOUT items but not cursors, axis or grid.
* @param aPanel = the draw canvas
* @param aDC = the current device context
* @param aDrawMode = GR_COPY, GR_OR ... (not always used)
* @param aOffset = an draw offset value
* @param aDisplayOptions = a GBR_DISPLAY_OPTIONS for draw display opts
*/
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
GR_DRAWMODE aDrawMode, const wxPoint& aOffset,
GBR_DISPLAY_OPTIONS* aDisplayOptions );
/**
* Function DrawItemsDCodeID
* Draw the DCode value (if exists) corresponding to gerber item
* (polygons do not have a DCode)
* @param aPanel = the draw canvas
* @param aDC = the current device context
* @param aDrawMode = GR_COPY, GR_OR ...
* @param aDrawColor = the color of dcode texts
*/
void DrawItemsDCodeID( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
GR_DRAWMODE aDrawMode, COLOR4D aDrawColor );
///> @copydoc EDA_ITEM::Visit()
SEARCH_RESULT Visit( INSPECTOR inspector, void* testData, const KICAD_T scanTypes[] ) override;
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
#endif
};

View File

@ -450,8 +450,7 @@ bool GERBER_DRAW_ITEM::HasNegativeItems()
}
void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
const wxPoint& aOffset, GBR_DISPLAY_OPTIONS* aDrawOptions )
void GERBER_DRAW_ITEM::Print( wxDC* aDC, const wxPoint& aOffset, GBR_DISPLAY_OPTIONS* aOptions )
{
// used when a D_CODE is not found. default D_CODE to draw a flashed item
static D_CODE dummyD_CODE( 0 );
@ -466,9 +465,6 @@ void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDra
COLOR4D color = m_GerberImageFile->GetPositiveDrawColor();
if( ( aDrawMode & GR_HIGHLIGHT ) && !( aDrawMode & GR_AND ) )
color.SetToLegacyHighlightColor();
/* isDark is true if flash is positive and should use a drawing
* color other than the background color, else use the background color
* when drawing so that an erasure happens.
@ -478,22 +474,20 @@ void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDra
if( !isDark )
{
// draw in background color ("negative" color)
color = aDrawOptions->m_NegativeDrawColor;
color = aOptions->m_NegativeDrawColor;
}
GRSetDrawMode( aDC, aDrawMode );
isFilled = aDrawOptions->m_DisplayLinesFill;
isFilled = aOptions->m_DisplayLinesFill;
switch( m_Shape )
{
case GBR_POLYGON:
isFilled = aDrawOptions->m_DisplayPolygonsFill;
isFilled = aOptions->m_DisplayPolygonsFill;
if( !isDark )
isFilled = true;
DrawGbrPoly( aPanel->GetClipBox(), aDC, color, aOffset, isFilled );
PrintGerberPoly( aDC, color, aOffset, isFilled );
break;
case GBR_CIRCLE:
@ -504,40 +498,27 @@ void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDra
if( !isFilled )
{
// draw the border of the pen's path using two circles, each as narrow as possible
GRCircle( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),
radius - halfPenWidth, 0, color );
GRCircle( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),
radius + halfPenWidth, 0, color );
GRCircle( nullptr, aDC, GetABPosition( m_Start ), radius - halfPenWidth, 0, color );
GRCircle( nullptr, aDC, GetABPosition( m_Start ), radius + halfPenWidth, 0, color );
}
else // Filled mode
{
GRCircle( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),
radius, m_Size.x, color );
GRCircle( nullptr, aDC, GetABPosition( m_Start ), radius, m_Size.x, color );
}
break;
case GBR_ARC:
// Currently, arcs plotted with a rectangular aperture are not supported.
// a round pen only is expected.
#if 0 // for arc debug only
GRLine( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),
GetABPosition( m_ArcCentre ), 0, color );
GRLine( aPanel->GetClipBox(), aDC, GetABPosition( m_End ),
GetABPosition( m_ArcCentre ), 0, color );
#endif
if( !isFilled )
{
GRArc1( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),
GetABPosition( m_End ), GetABPosition( m_ArcCentre ),
0, color );
GRArc1( nullptr, aDC, GetABPosition( m_Start ), GetABPosition( m_End ),
GetABPosition( m_ArcCentre ), 0, color );
}
else
{
GRArc1( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),
GetABPosition( m_End ), GetABPosition( m_ArcCentre ),
m_Size.x, color );
GRArc1( nullptr, aDC, GetABPosition( m_Start ), GetABPosition( m_End ),
GetABPosition( m_ArcCentre ), m_Size.x, color );
}
break;
@ -547,9 +528,8 @@ void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDra
case GBR_SPOT_OVAL:
case GBR_SPOT_POLY:
case GBR_SPOT_MACRO:
isFilled = aDrawOptions->m_DisplayFlashedItemsFill;
d_codeDescr->DrawFlashedShape( this, aPanel->GetClipBox(), aDC, color,
m_Start, isFilled );
isFilled = aOptions->m_DisplayFlashedItemsFill;
d_codeDescr->DrawFlashedShape( this, nullptr, aDC, color, m_Start, isFilled );
break;
case GBR_SEGMENT:
@ -563,19 +543,19 @@ void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDra
if( m_Polygon.OutlineCount() == 0 )
ConvertSegmentToPolygon();
DrawGbrPoly( aPanel->GetClipBox(), aDC, color, aOffset, isFilled );
PrintGerberPoly( aDC, color, aOffset, isFilled );
}
else
{
if( !isFilled )
{
GRCSegm( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),
GetABPosition( m_End ), m_Size.x, color );
GRCSegm( nullptr, aDC, GetABPosition( m_Start ), GetABPosition( m_End ),
m_Size.x, color );
}
else
{
GRFilledSegment( aPanel->GetClipBox(), aDC, GetABPosition( m_Start ),
GetABPosition( m_End ), m_Size.x, color );
GRFilledSegment( nullptr, aDC, GetABPosition( m_Start ), GetABPosition( m_End ),
m_Size.x, color );
}
}
@ -660,11 +640,8 @@ void GERBER_DRAW_ITEM::ConvertSegmentToPolygon()
}
void GERBER_DRAW_ITEM::DrawGbrPoly( EDA_RECT* aClipBox,
wxDC* aDC,
COLOR4D aColor,
const wxPoint& aOffset,
bool aFilledShape )
void GERBER_DRAW_ITEM::PrintGerberPoly( wxDC* aDC, COLOR4D aColor, const wxPoint& aOffset,
bool aFilledShape )
{
std::vector<wxPoint> points;
SHAPE_LINE_CHAIN& poly = m_Polygon.Outline( 0 );
@ -679,7 +656,7 @@ void GERBER_DRAW_ITEM::DrawGbrPoly( EDA_RECT* aClipBox,
points[ii] = GetABPosition( points[ii] );
}
GRClosedPoly( aClipBox, aDC, pointCount, &points[0], aFilledShape, aColor, aColor );
GRClosedPoly( nullptr, aDC, pointCount, &points[0], aFilledShape, aColor, aColor );
}

View File

@ -42,6 +42,7 @@ class GBR_LAYOUT;
class D_CODE;
class MSG_PANEL_ITEM;
class GBR_DISPLAY_OPTIONS;
class PCB_BASE_FRAME;
namespace KIGFX
{
@ -75,19 +76,19 @@ private:
public:
bool m_UnitsMetric; /* store here the gerber units (inch/mm). Used
* only to calculate aperture macros shapes sizes */
int m_Shape; // Shape and type of this gerber item
wxPoint m_Start; // Line or arc start point or position of the shape
bool m_UnitsMetric; // store here the gerber units (inch/mm). Used
// only to calculate aperture macros shapes sizes
int m_Shape; // Shape and type of this gerber item
wxPoint m_Start; // Line or arc start point or position of the shape
// for flashed items
wxPoint m_End; // Line or arc end point
wxPoint m_ArcCentre; // for arcs only: Centre of arc
SHAPE_POLY_SET m_Polygon; // Polygon shape data (G36 to G37 coordinates)
wxPoint m_End; // Line or arc end point
wxPoint m_ArcCentre; // for arcs only: Centre of arc
SHAPE_POLY_SET m_Polygon; // Polygon shape data (G36 to G37 coordinates)
// or for complex shapes which are converted to polygon
wxSize m_Size; // Flashed shapes: size of the shape
wxSize m_Size; // Flashed shapes: size of the shape
// Lines : m_Size.x = m_Size.y = line width
bool m_Flashed; // True for flashed items
int m_DCode; // DCode used to draw this item.
bool m_Flashed; // True for flashed items
int m_DCode; // DCode used to draw this item.
// 0 for items that do not use DCodes (polygons)
// or when unknown and normal values are 10 to 999
// values 0 to 9 can be used for special purposes
@ -231,9 +232,7 @@ public:
const EDA_RECT GetBoundingBox() const override;
/* Display on screen: */
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
GR_DRAWMODE aDrawMode, const wxPoint&aOffset, GBR_DISPLAY_OPTIONS* aDrawOptions );
void Print( wxDC* aDC, const wxPoint& aOffset, GBR_DISPLAY_OPTIONS* aOptions );
/**
* Function ConvertSegmentToPolygon
@ -244,11 +243,10 @@ public:
void ConvertSegmentToPolygon();
/**
* Function DrawGbrPoly
* a helper function used to draw the polygon stored in m_PolyCorners
* Function PrintGerberPoly
* a helper function used to print the polygon stored in m_PolyCorners
*/
void DrawGbrPoly( EDA_RECT* aClipBox, wxDC* aDC, COLOR4D aColor,
const wxPoint& aOffset, bool aFilledShape );
void PrintGerberPoly( wxDC* aDC, COLOR4D aColor, const wxPoint& aOffset, bool aFilledShape );
/* divers */
int Shape() const { return m_Shape; }

View File

@ -39,8 +39,9 @@
class BOARD;
class BOARD_ITEM_CONTAINER;
class EDA_DRAW_PANEL;
class SHAPE_POLY_SET;
class PCB_BASE_FRAME;
/**
* Enum STROKE_T
@ -146,11 +147,10 @@ public:
}
/**
* Function Draw
* Function Print
* BOARD_ITEMs have their own color information.
*/
virtual void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
GR_DRAWMODE aDrawMode, const wxPoint& offset = ZeroOffset ) = 0;
virtual void Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset = ZeroOffset ) = 0;
/**
* Swap data between aItem and aImage.

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.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
@ -37,6 +37,7 @@
class wxSingleInstanceChecker;
class EDA_HOTKEY;
class ACTION_TOOLBAR;
class EDA_DRAW_PANEL;
using KIGFX::COLOR4D;
@ -91,16 +92,12 @@ class EDA_DRAW_FRAME : public KIWAY_PLAYER
BASE_SCREEN* m_currentScreen; ///< current used SCREEN
bool m_snapToGrid; ///< Indicates if cursor should be snapped to grid.
EDA_DRAW_PANEL_GAL* m_galCanvas;
///< GAL display options - this is the frame's interface to setting GAL display options
KIGFX::GAL_DISPLAY_OPTIONS m_galDisplayOptions;
protected:
bool m_useSingleCanvasPane;
wxSocketServer* m_socketServer;
std::vector<wxSocketBase*> m_sockets; ///< interprocess communication
@ -601,7 +598,7 @@ public:
double GetZoom();
/**
* Draws on screen the page layout with the frame and the basic inscriptions.
* Prints the page layout with the frame and the basic inscriptions.
*
* @param aDC The device context.
* @param aScreen screen to draw
@ -610,9 +607,8 @@ public:
* @param aFilename The filename to display in basic inscriptions.
* @param aSheetLayer The layer displayed from pcbnew.
*/
void DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth,
double aScale, const wxString &aFilename,
const wxString &aSheetLayer = wxEmptyString,
void PrintWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth, double aScale,
const wxString &aFilename, const wxString &aSheetLayer = wxEmptyString,
COLOR4D aColor = COLOR4D::UNSPECIFIED );
void DisplayToolMsg( const wxString& msg );

View File

@ -63,7 +63,6 @@
class EDA_ITEM;
class EDA_RECT;
class EDA_DRAW_PANEL;
class EDA_DRAW_PANEL_GAL;
class EDA_MSG_PANEL;
class BASE_SCREEN;

View File

@ -248,19 +248,14 @@ public:
void Empty() { m_Text.Empty(); }
/**
* Function Draw
* @param aClipBox = the clipping rect, or NULL if no clipping
* Function Print
* @param aDC = the current Device Context
* @param aOffset = draw offset (usually (0,0))
* @param aColor = text color
* @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode.
* @param aDisplay_mode = FILLED or SKETCH
* @param aAnchor_color = anchor color ( COLOR4D::UNSPECIFIED = do not draw anchor ).
*/
void Draw( EDA_RECT* aClipBox, wxDC* aDC,
const wxPoint& aOffset, COLOR4D aColor,
GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aDisplay_mode = FILLED,
COLOR4D aAnchor_color = COLOR4D::UNSPECIFIED );
void Print( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor,
EDA_DRAW_MODE_T aDisplay_mode = FILLED );
/**
* Convert the text shape to a list of segment
@ -385,22 +380,18 @@ protected:
private:
/**
* Function drawOneLineOfText
* draws a single text line.
* Used to draw each line of this EDA_TEXT, that can be multiline
* @param aClipBox = the clipping rect, or NULL if no clipping
* Function printOneLineOfText
* Used to print each line of this EDA_TEXT, that can be multiline
* @param aDC = the current Device Context
* @param aOffset = draw offset (usually (0,0))
* @param aColor = text color
* @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode.
* @param aFillMode = FILLED or SKETCH
* @param aText = the single line of text to draw.
* @param aPos = the position of this line ).
*/
void drawOneLineOfText( EDA_RECT* aClipBox, wxDC* aDC,
const wxPoint& aOffset, COLOR4D aColor,
GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aFillMode,
const wxString& aText, const wxPoint& aPos );
void printOneLineOfText( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor,
EDA_DRAW_MODE_T aFillMode, const wxString& aText,
const wxPoint& aPos );
// Private text effects data. API above provides accessor funcs.
TEXT_EFFECTS m_e;

View File

@ -87,7 +87,6 @@ typedef enum {
} GRLineStypeType;
class EDA_DRAW_PANEL;
void GRSetDrawMode( wxDC* DC, GR_DRAWMODE mode );
GR_DRAWMODE GRGetDrawMode( wxDC* DC );

View File

@ -48,7 +48,6 @@
*/
#define MIN_DRAWABLE_TEXT_SIZE 3
class EDA_DRAW_PANEL;
class PLOTTER;
/**
@ -81,7 +80,7 @@ int GetPenSizeForBold( int aTextSize );
int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool italic, bool bold );
/**
* Function DrawGraphicText
* Function GRText
* Draw a graphic text (like module texts)
* @param aClipBox = the clipping rect, or NULL if no clipping
* @param aDC = the current Device Context. NULL if draw within a 3D GL Canvas
@ -105,45 +104,24 @@ int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool italic, b
* @param aPlotter = a pointer to a PLOTTER instance, when this function is used to plot
* the text. NULL to draw this text.
*/
void DrawGraphicText( EDA_RECT* aClipBox,
wxDC * aDC,
const wxPoint &aPos,
const COLOR4D aColor,
const wxString &aText,
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,
void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ) = nullptr,
void* aCallbackData = nullptr,
PLOTTER * aPlotter = nullptr );
void GRText( wxDC * aDC, const wxPoint &aPos, const COLOR4D aColor, const wxString &aText,
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,
void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ) = nullptr,
void* aCallbackData = nullptr, PLOTTER * aPlotter = nullptr );
/**
* Draw graphic text with a border, so that it can be read on different
* backgrounds. See DrawGraphicText for most of the parameters.
* backgrounds. See GRText for most of the parameters.
* If aBgColor is a dark color text is drawn in aColor2 with aColor1
* border; otherwise colors are swapped.
*/
void DrawGraphicHaloText( EDA_RECT* aClipBox,
wxDC * aDC,
const wxPoint &aPos,
const COLOR4D aBgColor,
COLOR4D aColor1,
COLOR4D aColor2,
const wxString &aText,
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,
void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ) = nullptr,
void* aCallbackData = nullptr,
PLOTTER * aPlotter = nullptr );
void GRHaloText( wxDC * aDC, const wxPoint &aPos, const COLOR4D aBgColor, COLOR4D aColor1,
COLOR4D aColor2, const wxString &aText, 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,
void (*aCallback)( int x0, int y0, int xf, int yf, void* aData ) = nullptr,
void* aCallbackData = nullptr, PLOTTER * aPlotter = nullptr );
#endif /* __INCLUDE__DRAWTXT_H__ */

View File

@ -1,203 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 jean-pierre.charras@gipsa-lab.inpg.fr
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2007 KiCad Developers, see change_log.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
*/
/**
* a helper to handle the real device context used in KiCad
* @file kicad_device_context.h
*/
#ifndef __KICAD_DEVICE_CONTEXT_H__
#define __KICAD_DEVICE_CONTEXT_H__
#include <wx/dcbuffer.h>
#if defined(KICAD_USE_BUFFERED_PAINTDC)
#undef KICAD_USE_BUFFERED_PAINTDC
#endif
#if defined(KICAD_USE_BUFFERED_DC)
#undef KICAD_USE_BUFFERED_DC
#endif
// wxWidgets defines the platforms where device context buffering is well behaved. These
// definitions take advantage of their experience in this area. See <wx/dcbuffer.h> for
// more information.
#if wxALWAYS_NATIVE_DOUBLE_BUFFER
#define KICAD_USE_BUFFERED_PAINTDC 1
#define KICAD_USE_BUFFERED_DC_HELPER 0
#define KICAD_USE_BUFFERED_DC 0
#else
#define KICAD_USE_BUFFERED_PAINTDC 1
#define KICAD_USE_BUFFERED_DC_HELPER 1
#define KICAD_USE_BUFFERED_DC 1
#endif
/**
* Class BUFFERED_DC_HELPER
* fixes a bug on Windows when using buffered device context.
*
* <p>
* When using buffered device context drawing in Windows, the user scaling must be set to 1
* and the logical offset must be set to zero before the bitmap blit operation occurs in
* the destructor of wxBufferdDC but after the normal drawing takes place.
* </p>
*/
class BUFFERED_DC_HELPER
{
public:
BUFFERED_DC_HELPER( wxBufferedDC* aDC )
: m_dc( aDC ) {}
virtual ~BUFFERED_DC_HELPER()
{
if( m_dc )
{
m_dc->SetLogicalOrigin( 0, 0 );
m_dc->SetUserScale( 1.0, 1.0 );
}
}
private:
wxBufferedDC* m_dc;
};
/**
* Class EDA_BLIT_NORMALIZER
* is a helper class for clearing a device context scale and offset parameters before
* performing a Blit operation.
* <p>
* This class keeps a temporary copy of the scale and offset parameters of a device
* context and then restores them when it goes out of scope.
* </p>
*/
class EDA_BLIT_NORMALIZER
{
public:
EDA_BLIT_NORMALIZER( wxDC* aDC )
: m_dc( aDC )
{
if( aDC )
{
aDC->GetUserScale( &m_userScaleX, &m_userScaleY );
aDC->GetLogicalOrigin( &m_logicalOriginX, &m_logicalOriginY );
aDC->GetDeviceOrigin( &m_deviceOriginX, &m_deviceOriginY );
aDC->SetUserScale( 1.0, 1.0 );
aDC->SetLogicalOrigin( 0, 0 );
aDC->SetDeviceOrigin( 0, 0 );
}
}
~EDA_BLIT_NORMALIZER()
{
if( m_dc )
{
m_dc->SetUserScale( m_userScaleX, m_userScaleY );
m_dc->SetLogicalOrigin( m_logicalOriginX, m_logicalOriginY );
m_dc->SetDeviceOrigin( m_deviceOriginX, m_deviceOriginY );
}
}
private:
wxDC* m_dc;
double m_userScaleX;
double m_userScaleY;
int m_logicalOriginX;
int m_logicalOriginY;
int m_deviceOriginX;
int m_deviceOriginY;
DECLARE_NO_COPY_CLASS( EDA_BLIT_NORMALIZER )
};
#if USE_WX_GRAPHICS_CONTEXT
#include <wx/dcgraph.h>
#endif
// Macro used to declare a device context in KiCad:
#if USE_WX_GRAPHICS_CONTEXT
//#pragma message( "INSTALL_DC is wxClientDC with wxGCDC" )
#define INSTALL_DC( name, parent ) \
wxClientDC _cDC( parent ); \
wxGCDC name( _cDC ); \
parent->DoPrepareDC( name ); \
name.GetGraphicsContext()->Translate( 0.5, 0.5 );
#else
#if KICAD_USE_BUFFERED_DC && !KICAD_USE_BUFFERED_DC_HELPER
//#pragma message( "INSTALL_DC is wxClientDC with wxBufferedDC" )
#define INSTALL_DC( name, parent ) \
wxClientDC _cDC( parent ); \
wxBufferedDC name(&_cDC, _cDC.GetSize() ); \
parent->DoPrepareDC( name );
#elif KICAD_USE_BUFFERED_DC && KICAD_USE_BUFFERED_DC_HELPER
//#pragma message( "INSTALL_DC is wxBufferedDC with BUFFERED_DC_HELPER" )
#define INSTALL_DC( name, parent ) \
wxClientDC _cDC( parent ); \
wxBufferedDC name(&_cDC, _cDC.GetSize() ); \
parent->DoPrepareDC( name ); \
BUFFERED_DC_HELPER helper( &name );
#else
//#pragma message( "INSTALL_DC is wxClientDC" )
#define INSTALL_DC( name, parent ) \
wxClientDC name( parent ); \
parent->DoPrepareDC( name );
#endif
#endif
#if USE_WX_GRAPHICS_CONTEXT
//#pragma message( "INSTALL_PAINTDC is wxPaintDC with wxGCDC" )
#define INSTALL_PAINTDC( name, parent) \
wxPaintDC _pDC( parent ); \
wxGCDC name( _pDC ); \
parent->DoPrepareDC( name ); \
name.GetGraphicsContext()->Translate( 0.5, 0.5 );
#elif KICAD_USE_BUFFERED_PAINTDC && !KICAD_USE_BUFFERED_DC_HELPER
//#pragma message( "INSTALL_PAINTDC is wxAutoBufferedPaintDC" )
#define INSTALL_PAINTDC( name, parent ) \
wxAutoBufferedPaintDC name( parent ); \
parent->DoPrepareDC( name );
#elif KICAD_USE_BUFFERED_PAINTDC && KICAD_USE_BUFFERED_DC_HELPER
//#pragma message( "INSTALL_PAINTDC is wxBufferedPaintDC with BUFFERED_DC_HELPER" )
#define INSTALL_PAINTDC( name, parent ) \
wxBufferedPaintDC name( parent ); \
parent->DoPrepareDC( name ); \
BUFFERED_DC_HELPER help( &name );
#else
//#pragma message( "INSTALL_PAINTDC is wxPaintDC" )
#define INSTALL_PAINTDC(name,parent) \
wxPaintDC name( parent ); \
parent->DoPrepareDC( name );
#endif
// This macro should be used when drawing objects directly without drawing the background.
#define INSTALL_UNBUFFERED_DC( name, parent ) \
wxClientDC name( parent ); \
parent->DoPrepareDC( name );
#endif // __KICAD_DEVICE_CONTEXT_H__

View File

@ -11,106 +11,18 @@ class BASE_SCREEN;
class EDA_DRAW_PANEL
{
protected:
bool m_showCrossHair; ///< Indicate if cross hair is to be shown.
int m_cursorLevel; ///< Index for cursor redraw in XOR mode.
int m_scrollIncrementX; ///< X axis scroll increment in pixels per unit.
int m_scrollIncrementY; ///< Y axis scroll increment in pixels per unit.
/// The drawing area used to redraw the screen which is usually the visible area
/// of the drawing in internal units.
EDA_RECT m_ClipBox;
/// True when drawing in mirror mode. Used by the draw arc function, because arcs
/// are oriented, and in mirror mode, orientations are reversed.
bool m_PrintIsMirrored;
public:
EDA_DRAW_PANEL() :
m_showCrossHair( true ),
m_cursorLevel( 0 ),
m_scrollIncrementX( 1 ),
m_scrollIncrementY( 1 ),
m_PrintIsMirrored( false )
EDA_DRAW_PANEL()
{};
virtual ~EDA_DRAW_PANEL(){};
/**
* Function GetDisplayOptions
* A way to pass info to draw functions.
* this is just an accessor to the GetDisplayOptions() parent frame function.
*/
virtual void* GetDisplayOptions() { printf("EDA_DRAW_PANEL:Unimplemented\n"); wxASSERT(false); return nullptr; };
virtual BASE_SCREEN* GetScreen() = 0;
virtual EDA_DRAW_FRAME* GetParent() const = 0;
//virtual void OnPaint( wxPaintEvent& event );
virtual EDA_RECT* GetClipBox() { return &m_ClipBox; }
void SetClipBox( const EDA_RECT& aRect ) { m_ClipBox = aRect; }
bool GetPrintMirrored() const { return m_PrintIsMirrored; }
void SetPrintMirrored( bool aMirror ) { m_PrintIsMirrored = aMirror; }
/* Mouse and keys events */
/**
* Function OnMouseWheel
* handles mouse wheel events.
* <p>
* The mouse wheel is used to provide support for zooming and panning. This
* is accomplished by converting mouse wheel events in pseudo menu command
* events and sending them to the appropriate parent window event handler.
*</p>
*/
virtual void SetZoom( double mode ) { printf("EDA_DRAW_PANEL:Unimplemented7\n"); };;
virtual double GetZoom() { return 1.0; };;
//virtual void SetGrid( const wxRealPoint& size ) { printf("EDA_DRAW_PANEL:Unimplemented\n"); };;
//virtual wxRealPoint GetGrid() { printf("EDA_DRAW_PANEL:Unimplemented\n"); return wxRealPoint(1.0, 1.0); };;
/**
* Function SetClipBox
* sets the clip box in drawing (logical) units from \a aRect in device units.
* <p>
* If \a aRect is NULL, then the entire visible area of the screen is used as the clip
* area. The clip box is used when drawing to determine which objects are not visible
* and do not need to be drawn. Note that this is not the same as setting the device
* context clipping with wxDC::SetClippingRegion(). This is the rectangle used by the
* drawing functions in gr_basic.cpp used to determine if the item to draw is off screen
* and therefore not drawn.
* </p>
* @param aDC The device context use for drawing with the correct scale and
* offsets already configured. See DoPrepareDC().
* @param aRect The clip rectangle in device units or NULL for the entire visible area
* of the screen.
*/
virtual void SetClipBox( wxDC& aDC, const wxRect* aRect = NULL ) { printf("EDA_DRAW_PANEL:Unimplemented10\n"); };;
/**
* Function RefreshDrawingRect
* redraws the contents of \a aRect in drawing units. \a aRect is converted to
* screen coordinates and wxWindow::RefreshRect() is called to repaint the region.
* @param aRect The rectangle to repaint.
* @param aEraseBackground Erases the background if true.
*/
virtual void RefreshDrawingRect( const EDA_RECT& aRect, bool aEraseBackground = true ) { printf("EDA_DRAW_PANEL:Unimplemented12\n"); };;
/// @copydoc wxWindow::Refresh()
//virtual void Refresh( bool eraseBackground = true, const wxRect* rect = NULL );
/**
* Function GetScreenCenterLogicalPosition
* @return The current screen center position in logical (drawing) units.
*/
virtual wxPoint GetScreenCenterLogicalPosition() { return wxPoint(0, 0); };;
// Only used for printing, so no clipping
virtual EDA_RECT* GetClipBox() { return nullptr; }
virtual void Refresh( bool eraseBackground = true, const wxRect* rect = NULL ) {}

View File

@ -37,124 +37,19 @@ class PCB_SCREEN;
class EDA_DRAW_PANEL : public wxScrolledWindow
{
private:
int m_currentCursor; ///< Current mouse cursor shape id.
int m_defaultCursor; ///< The default mouse cursor shape id.
bool m_showCrossHair; ///< Indicate if cross hair is to be shown.
int m_cursorLevel; ///< Index for cursor redraw in XOR mode.
int m_scrollIncrementX; ///< X axis scroll increment in pixels per unit.
int m_scrollIncrementY; ///< Y axis scroll increment in pixels per unit.
wxPoint m_CursorStartPos; ///< Used for testing the cursor movement.
wxPoint m_PanStartCenter; ///< Initial scroll center position when pan started
wxPoint m_PanStartEventPosition; ///< Initial position of mouse event when pan started
wxPoint m_CursorClickPos; ///< Used for maintaining click position
/// The drawing area used to redraw the screen which is usually the visible area
/// of the drawing in internal units.
EDA_RECT m_ClipBox;
/* Used to inhibit a response to a mouse left button release, after a double click
* (when releasing the left button at the end of the second click. Used in Eeschema
* to inhibit a mouse left release command when switching between hierarchical sheets
* on a double click.
*/
bool m_ignoreNextLeftButtonRelease; ///< Ignore the next mouse left button release when true.
/// True when drawing in mirror mode. Used by the draw arc function, because arcs
/// are oriented, and in mirror mode, orientations are reversed.
bool m_PrintIsMirrored;
public:
EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id, const wxPoint& pos, const wxSize& size );
~EDA_DRAW_PANEL();
/**
* Function GetDisplayOptions
* A way to pass info to draw functions.
* this is just an accessor to the GetDisplayOptions() parent frame function.
*/
void* GetDisplayOptions();
BASE_SCREEN* GetScreen();
EDA_DRAW_FRAME* GetParent() const;
EDA_RECT* GetClipBox() { return &m_ClipBox; }
void SetClipBox( const EDA_RECT& aRect ) { m_ClipBox = aRect; }
bool GetPrintMirrored() const { return m_PrintIsMirrored; }
void SetPrintMirrored( bool aMirror ) { m_PrintIsMirrored = aMirror; }
void OnEraseBackground( wxEraseEvent& event ) { }
/**
* Function DoPrepareDC
* sets up the device context \a aDC for drawing.
* <p>
* This overrides wxScrolledWindow::DoPrepareDC() for setting up the the device context
* used for drawing. The scale factor and drawing logical offset are set and the base
* method is called to set the DC device origin (scroll bar position). This connects
* everything together to achieve the appropriate coordinate manipulation using wxDC
* LogicalToDeviceXXX and DeviceToLogixalXXX methods. This gets called automatically
* for a paint event. If you do any drawing outside the paint event, you must call
* DoPrepareDC manually.
* </p>
* @param aDC The device context to prepare.
*/
virtual void DoPrepareDC( wxDC& aDC ) override;
/* Mouse and keys events */
void OnCharHook( wxKeyEvent& event );
/**
* Function SetClipBox
* sets the clip box in drawing (logical) units from \a aRect in device units.
* <p>
* If \a aRect is NULL, then the entire visible area of the screen is used as the clip
* area. The clip box is used when drawing to determine which objects are not visible
* and do not need to be drawn. Note that this is not the same as setting the device
* context clipping with wxDC::SetClippingRegion(). This is the rectangle used by the
* drawing functions in gr_basic.cpp used to determine if the item to draw is off screen
* and therefore not drawn.
* </p>
* @param aDC The device context use for drawing with the correct scale and
* offsets already configured. See DoPrepareDC().
* @param aRect The clip rectangle in device units or NULL for the entire visible area
* of the screen.
*/
void SetClipBox( wxDC& aDC, const wxRect* aRect = NULL );
// Only used for printing, so no clipping
virtual EDA_RECT* GetClipBox() { return nullptr; }
/// @copydoc wxWindow::Refresh()
virtual void Refresh( bool eraseBackground = true, const wxRect* rect = NULL ) override;
/**
* Function GetScreenCenterLogicalPosition
* @return The current screen center position in logical (drawing) units.
*/
wxPoint GetScreenCenterLogicalPosition();
/* Cursor functions */
/**
* Function SetCurrentCursor
* Set the current cursor shape for drawpanel
*/
void SetCurrentCursor( int aCursor )
{
m_currentCursor = aCursor;
SetCursor( (wxStockCursor) m_currentCursor );
}
/**
* Function GetDefaultCursor
* @return the default cursor shape
*/
int GetDefaultCursor() const { return m_defaultCursor; }
void Refresh( bool eraseBackground = true, const wxRect* rect = NULL ) override;
};

View File

@ -141,10 +141,10 @@ public:
int GetShapePolygonCornerCount() const;
/**
* Function DrawMarker
* draws the shape is the polygon defined in m_Corners (array of wxPoints).
* Function PrintMarker
* Prints the shape is the polygon defined in m_Corners (array of wxPoints).
*/
void DrawMarker( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset );
void PrintMarker( wxDC* aDC, const wxPoint& aOffset );
/**
* Function GetPos

View File

@ -31,6 +31,8 @@
#include <layers_id_colors_and_visibility.h>
#include <gal/color4d.h>
class PCB_BASE_FRAME;
/**
* Class ORIGIN_VIEWITEM
*
@ -56,10 +58,9 @@ public:
void ViewDraw( int aLayer, VIEW* aView ) const override;
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
GR_DRAWMODE aDrawMode, const wxPoint& offset = ZeroOffset ) override
void Print( PCB_BASE_FRAME* aFrame, wxDC* DC, const wxPoint& offset = ZeroOffset ) override
{
wxASSERT( 0 ); // ORIGIN_VIEWITEM never added to BOARD; drawn directly through ViewDraw().
wxASSERT( 0 ); // ORIGIN_VIEWITEM never added to BOARD
}
void ViewGetLayers( int aLayers[], int& aCount ) const override

View File

@ -34,7 +34,7 @@
#include <vector>
#include <math/box2.h>
#include <draw_graphic_text.h>
#include <gr_text.h>
#include <page_info.h>
#include <eda_text.h> // FILL_T

View File

@ -71,16 +71,14 @@ public:
virtual void SetPosition( wxPoint aPos ) = 0;
virtual void SetEnd( wxPoint aPos ) { /* not all types will need this */ }
// The function to draw a WS_DRAW_ITEM
virtual void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, COLOR4D aColor )
// The function to print a WS_DRAW_ITEM
virtual void PrintWsItem( wxDC* aDC, COLOR4D aColor )
{
wxPoint offset( 0, 0 );
DrawWsItem( aClipBox, aDC, offset, UNSPECIFIED_DRAWMODE, aColor );
PrintWsItem( aDC, wxPoint( 0, 0 ), aColor );
}
// More advanced version of DrawWsItem. This is what must be defined in the derived type.
virtual void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
GR_DRAWMODE aDrawMode, COLOR4D aColor ) = 0;
virtual void PrintWsItem( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor ) = 0;
// Derived types must define GetBoundingBox() as a minimum, and can then override the
// two HitTest() functions if they need something more specific.
@ -131,8 +129,7 @@ public:
const EDA_RECT GetBoundingBox() const override;
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset, GR_DRAWMODE aDrawMode,
COLOR4D aColor ) override;
void PrintWsItem( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor ) override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
@ -175,8 +172,7 @@ public:
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
bool HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy = 0 ) const override;
void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset, GR_DRAWMODE aDrawMode,
COLOR4D aColor ) override;
void PrintWsItem( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor ) override;
wxString GetSelectMenuText( EDA_UNITS_T aUnits ) const override;
@ -214,8 +210,7 @@ public:
const wxPoint GetPosition() const override { return GetStart(); }
void SetPosition( wxPoint aPos ) override { SetStart( aPos ); }
void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset, GR_DRAWMODE aDrawMode,
COLOR4D aColor ) override;
void PrintWsItem( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor ) override;
const EDA_RECT GetBoundingBox() const override;
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
@ -247,10 +242,7 @@ public:
virtual wxString GetClass() const override { return wxT( "WS_DRAW_ITEM_TEXT" ); }
/** The function to draw a WS_DRAW_ITEM_TEXT
*/
void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset, GR_DRAWMODE aDrawMode,
COLOR4D aColor ) override;
void PrintWsItem( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor ) override;
// Accessors:
int GetPenWidth() { return GetThickness(); }
@ -293,8 +285,7 @@ public:
const wxPoint GetPosition() const override { return m_pos; }
void SetPosition( wxPoint aPos ) override { m_pos = aPos; }
void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset, GR_DRAWMODE aDrawMode,
COLOR4D aColor ) override;
void PrintWsItem( wxDC* aDC, const wxPoint& aOffset, COLOR4D aColor ) override;
const EDA_RECT GetBoundingBox() const override;
@ -442,10 +433,9 @@ public:
/**
* Draws the item list created by BuildWorkSheetGraphicList
* @param aClipBox = the clipping rect, or NULL if no clipping
* @param aDC = the current Device Context
*/
void Draw( EDA_RECT* aClipBox, wxDC* aDC, COLOR4D aColor );
void Print( wxDC* aDC, COLOR4D aColor );
/**
* Function BuildWorkSheetGraphicList is a core function for drawing or plotting the

View File

@ -31,7 +31,6 @@
#include <page_info.h>
// Forward declarations:
class EDA_DRAW_PANEL;
class EDA_RECT;
class TITLE_BLOCK;
@ -129,10 +128,9 @@ private:
/**
* Function DrawPageLayout is a core function to draw the page layout with
* the frame and the basic inscriptions.
* Function PrintPageLayout is a core function to print the page layout with the frame and the
* basic inscriptions.
* @param aDC The device context.
* @param aClipBox = the clipping rect, or NULL if no clipping.
* @param aPageInfo for margins and page size (in mils).
* @param aFullSheetName The sheetpath (full sheet name), for basic inscriptions.
* @param aFileName The file name, for basic inscriptions.
@ -142,7 +140,6 @@ private:
* @param aPenWidth the pen size The line width for drawing.
* @param aScalar the scale factor to convert from mils to internal units.
* @param aColor The color for drawing.
* @param aAltColor The color for items which need to be "hightlighted".
* @param aSheetLayer The layer from pcbnew.
*
* Parameters used in aPageInfo
@ -150,18 +147,9 @@ private:
* - the LTmargin The left top margin of the page layout.
* - the RBmargin The right bottom margin of the page layout.
*/
void DrawPageLayout( wxDC* aDC,
EDA_RECT* aClipBox,
const PAGE_INFO& aPageInfo,
const wxString& aFullSheetName,
const wxString& aFileName,
TITLE_BLOCK& aTitleBlock,
int aSheetCount,
int aSheetNumber,
int aPenWidth,
double aScalar,
COLOR4D aColor,
const wxString& aSheetLayer = wxEmptyString );
void PrintPageLayout( wxDC* aDC, const PAGE_INFO& aPageInfo, const wxString& aFullSheetName,
const wxString& aFileName, const TITLE_BLOCK& aTitleBlock, int aSheetCount,
int aSheetNumber, int aPenWidth, double aScalar, COLOR4D aColor,
const wxString& aSheetLayer = wxEmptyString );
#endif // WS_PAINTER_H

View File

@ -147,16 +147,14 @@ void PLEDITOR_PRINTOUT::GetPageInfo( int* minPage, int* maxPage,
/*
* This is the real print function: print the active screen
*/
void PLEDITOR_PRINTOUT::DrawPage( int aPageNum )
void PLEDITOR_PRINTOUT::PrintPage( int aPageNum )
{
int oldZoom;
wxPoint tmp_startvisu;
wxSize pageSizeIU; // Page size in internal units
wxPoint old_org;
EDA_RECT oldClipBox;
wxRect fitRect;
wxDC* dc = GetDC();
EDA_DRAW_PANEL* panel = m_parent->GetCanvas();
PL_EDITOR_SCREEN* screen = m_parent->GetScreen();
// Save current scale factor, offsets, and clip box.
@ -164,13 +162,6 @@ void PLEDITOR_PRINTOUT::DrawPage( int aPageNum )
oldZoom = screen->GetZoom();
old_org = screen->m_DrawOrg;
oldClipBox = *panel->GetClipBox();
// Change clip box to print the whole page.
#define MAX_VALUE (INT_MAX/2) // MAX_VALUE is the max we can use in an integer
// and that allows calculations without overflow
panel->SetClipBox( EDA_RECT( wxPoint( 0, 0 ), wxSize( MAX_VALUE, MAX_VALUE ) ) );
// Change scale factor and offset to print the whole page.
pageSizeIU = m_parent->GetPageSettings().GetSizeIU();
@ -190,11 +181,10 @@ void PLEDITOR_PRINTOUT::DrawPage( int aPageNum )
m_parent->SetDrawBgColor( MakeColour( WHITE ) );
screen->m_ScreenNumber = aPageNum;
m_parent->DrawWorkSheet( dc, screen, 0, IU_PER_MILS, wxEmptyString );
m_parent->PrintWorkSheet( dc, screen, 0, IU_PER_MILS, wxEmptyString );
m_parent->SetDrawBgColor( bg_color );
screen->m_IsPrinting = false;
panel->SetClipBox( oldClipBox );
GRForceBlackPen( false );

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