Commit 0b7fd874 authored by Maciej Suminski's avatar Maciej Suminski

Fixed printing issues under Linux.

parent ec8bf0c1
......@@ -207,15 +207,10 @@ void GRResetPenAndBrush( wxDC* DC )
*/
void GRSetColorPen( wxDC* DC, EDA_COLOR_T Color, int width, wxPenStyle style )
{
if( width < 0 )
width = 0;
#ifdef __WXMAC__
// Under OSX when wxPen is set to 0, cocoa follows the request drawing nothing &
// in the bitmap world the minimum is enough to light a pixel, in vectorial one not
// Under OSX and while printing when wxPen is set to 0, renderer follows the request drawing
// nothing & in the bitmap world the minimum is enough to light a pixel, in vectorial one not
if( width <= 1 )
width = DC->DeviceToLogicalXRel( 1 );
#endif
if( s_ForceBlackPen )
{
......@@ -341,7 +336,7 @@ void GRSetDrawMode( wxDC* DC, GR_DRAWMODE draw_mode )
DC->SetLogicalFunction( wxINVERT );
#endif
else
else if( draw_mode & GR_COPY )
DC->SetLogicalFunction( wxCOPY );
#ifdef USE_WX_OVERLAY
......@@ -795,13 +790,17 @@ void GRFilledCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r,
y0 = ClipBox->GetY();
xm = ClipBox->GetRight();
ym = ClipBox->GetBottom();
if( x < (x0 - r) )
if( x < ( x0 - r ) )
return;
if( y < (y0 - r) )
if( y < ( y0 - r ) )
return;
if( x > (r + xm) )
if( x > ( r + xm ) )
return;
if( y > (r + ym) )
if( y > ( r + ym ) )
return;
}
......
......@@ -55,7 +55,6 @@ void DrawPageLayout( wxDC* aDC, EDA_RECT* aClipBox,
int aPenWidth, double aScalar,
EDA_COLOR_T aColor, EDA_COLOR_T aAltColor )
{
GRSetDrawMode( aDC, GR_COPY );
WS_DRAW_ITEM_LIST drawList;
drawList.SetPenSize( aPenWidth );
......
......@@ -37,13 +37,13 @@ class EDA_RECT;
/// Drawmode. Compositing mode plus a flag or two
enum GR_DRAWMODE {
GR_COPY = 0,
GR_OR = 0x01000000,
GR_XOR = 0x02000000,
GR_AND = 0x04000000,
GR_NXOR = 0x08000000,
GR_INVERT = 0x10000000,
GR_ALLOW_HIGHCONTRAST = 0x20000000,
GR_COPY = 0x40000000,
GR_HIGHLIGHT = 0x80000000,
UNSPECIFIED_DRAWMODE = -1
};
......
......@@ -424,11 +424,10 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
GRForceBlackPen( false );
aDrawInfo.m_HoleColor = WHITE;
}
if( aDrawInfo.m_DrawMode != GR_XOR )
GRSetDrawMode( aDC, GR_COPY );
else
GRSetDrawMode( aDC, GR_XOR );
{
GRSetDrawMode( aDC, ( aDrawInfo.m_DrawMode != GR_XOR ) ? GR_COPY : GR_XOR );
}
EDA_COLOR_T hole_color = aDrawInfo.m_HoleColor;
......@@ -477,10 +476,8 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
holepos.x - dx0, holepos.y + dx0, 0, nc_color );
}
if( aDrawInfo.m_DrawMode != GR_XOR )
GRSetDrawMode( aDC, GR_COPY );
else
GRSetDrawMode( aDC, GR_XOR );
if( !aDrawInfo.m_IsPrinting )
GRSetDrawMode( aDC, ( aDrawInfo.m_DrawMode != GR_XOR ) ? GR_COPY : GR_XOR );
// Draw the pad number
if( !aDrawInfo.m_Display_padnum && !aDrawInfo.m_Display_netname )
......
......@@ -308,7 +308,7 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel,
}
// Draw areas:
if( m_FillMode==0 && !outline_mode )
if( m_FillMode == 0 && !outline_mode )
GRPoly( panel->GetClipBox(), DC, CornersBuffer.size(), &CornersBuffer[0],
true, 0, color, color );
}
......
......@@ -50,7 +50,7 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
bool aPrintMirrorMode,
void * aData)
{
GR_DRAWMODE drawmode = GR_COPY;
const GR_DRAWMODE drawmode = (GR_DRAWMODE) 0;
int defaultPenSize = Millimeter2iu( 0.2 );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
......@@ -81,13 +81,6 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
m_canvas->SetPrintMirrored( aPrintMirrorMode );
// The OR mode is used in color mode, but be aware the background *must be
// BLACK. In the print page dialog, we first print in BLACK, and after
// reprint in color, on the black "local" background, in OR mode the black
// print is not made before, only a white page is printed
if( GetGRForceBlackPenState() == false )
drawmode = GR_OR;
// Draw footprints, this is done at last in order to print the pad holes in
// white after the tracks and zones
int tmp = D_PAD::m_PadSketchModePenSize;
......@@ -117,7 +110,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
bool aPrintMirrorMode,
void* aData)
{
GR_DRAWMODE drawmode = GR_COPY;
const GR_DRAWMODE drawmode = (GR_DRAWMODE) 0;
DISPLAY_OPTIONS save_opt;
BOARD* Pcb = GetBoard();
int defaultPenSize = Millimeter2iu( 0.2 );
......@@ -201,16 +194,6 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
m_canvas->SetPrintMirrored( aPrintMirrorMode );
// The OR mode is used in color mode, but be aware the background *must be
// BLACK. In the print page dialog, we first print in BLACK, and after
// reprint in color, on the black "local" background, in OR mode the black
// print is not made before, only a white page is printed
if( GetGRForceBlackPenState() == false )
drawmode = GR_OR;
// Print the pcb graphic items (texts, ...)
GRSetDrawMode( aDC, drawmode );
for( BOARD_ITEM* item = Pcb->m_Drawings; item; item = item->Next() )
{
switch( item->Type() )
......@@ -242,7 +225,6 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
EDA_COLOR_T color = g_ColorsSettings.GetItemColor( VIAS_VISIBLE + via->GetViaType() );
GRSetDrawMode( aDC, drawmode );
GRFilledCircle( m_canvas->GetClipBox(), aDC,
via->GetStart().x,
via->GetStart().y,
......@@ -295,7 +277,6 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
bool blackpenstate = GetGRForceBlackPenState();
GRForceBlackPen( false );
GRSetDrawMode( aDC, GR_COPY );
for( ; track; track = track->Next() )
{
......
......@@ -142,7 +142,7 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage()
wxBusyCursor dummy;
BOARD * brd = ((PCB_BASE_FRAME*) m_Parent)->GetBoard();
BOARD* brd = ((PCB_BASE_FRAME*) m_Parent)->GetBoard();
boardBoundingBox = brd->ComputeBoundingBox();
wxString titleblockFilename = brd->GetFileName();
......@@ -160,7 +160,7 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage()
if( m_PrintParams.m_PrintScale == 0 ) // fit in page option
{
if(boardBoundingBox.GetWidth() && boardBoundingBox.GetHeight())
if( boardBoundingBox.GetWidth() && boardBoundingBox.GetHeight() )
{
int margin = Millimeter2iu( 10.0 ); // add a margin around the drawings
double scaleX = (double)(pageSizeIU.x - (2 * margin)) /
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment