Commit a0c413a6 authored by charras's avatar charras

solved a minor bug (pcbnew): arcs incorrectly printed in mirror mode

parent c88f9b1c
...@@ -121,7 +121,7 @@ bool DrawPage( WinEDA_DrawPanel* panel ) ...@@ -121,7 +121,7 @@ bool DrawPage( WinEDA_DrawPanel* panel )
{ {
dc.SetClippingRegion( DrawArea ); dc.SetClippingRegion( DrawArea );
} }
panel->PrintPage( &dc, Print_Sheet_Ref, -1 ); panel->PrintPage( &dc, Print_Sheet_Ref, -1, false );
g_IsPrinting = FALSE; g_IsPrinting = FALSE;
panel->m_ClipBox = tmp; panel->m_ClipBox = tmp;
wxMetafile* mf = dc.Close(); wxMetafile* mf = dc.Close();
......
...@@ -134,15 +134,16 @@ void WinEDA_SchematicFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) ...@@ -134,15 +134,16 @@ void WinEDA_SchematicFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
} }
/*******************************************************************************/ /******************************************************************************************************/
void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int PrintMask ) void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int PrintMask, bool aPrintMirrorMode )
/*******************************************************************************/ /******************************************************************************************************/
/** PrintPage /** PrintPage
* used to print a page. * used to print a page.
* Print the page pointed by ActiveScreen, set by the calling print function * Print the page pointed by ActiveScreen, set by the calling print function
* @param DC = wxDC given by the calling print function * @param DC = wxDC given by the calling print function
* @param Print_Sheet_Ref = true to print page references * @param Print_Sheet_Ref = true to print page references
* @param PrintMask = not used here * @param PrintMask = not used here
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
*/ */
{ {
wxBeginBusyCursor(); wxBeginBusyCursor();
......
...@@ -22,9 +22,9 @@ ...@@ -22,9 +22,9 @@
/* Variables Locales */ /* Variables Locales */
/**********************************************************************************/ /************************************************************************************************************/
void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmasklayer ) void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmasklayer, bool aPrintMirrorMode )
/**********************************************************************************/ /*************************************************************************************************************/
/* routine de trace du pcb, avec selection des couches */ /* routine de trace du pcb, avec selection des couches */
{ {
DISPLAY_OPTIONS save_opt; DISPLAY_OPTIONS save_opt;
...@@ -47,11 +47,15 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl ...@@ -47,11 +47,15 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl
DisplayPolygonsModeImg = g_DisplayPolygonsModeSketch; DisplayPolygonsModeImg = g_DisplayPolygonsModeSketch;
g_DisplayPolygonsModeSketch = 0; g_DisplayPolygonsModeSketch = 0;
m_PrintIsMirrored = aPrintMirrorMode;
( (WinEDA_GerberFrame*) m_Parent )->Trace_Gerber( DC, GR_COPY, printmasklayer ); ( (WinEDA_GerberFrame*) m_Parent )->Trace_Gerber( DC, GR_COPY, printmasklayer );
if( Print_Sheet_Ref ) if( Print_Sheet_Ref )
m_Parent->TraceWorkSheet( DC, GetScreen(), 0 ); m_Parent->TraceWorkSheet( DC, GetScreen(), 0 );
m_PrintIsMirrored = false;
DisplayOpt = save_opt; DisplayOpt = save_opt;
g_DisplayPolygonsModeSketch = DisplayPolygonsModeImg; g_DisplayPolygonsModeSketch = DisplayPolygonsModeImg;
} }
......
...@@ -43,6 +43,8 @@ public: ...@@ -43,6 +43,8 @@ public:
bool m_Block_Enable; // TRUE to accept Block Commands bool m_Block_Enable; // TRUE to accept Block Commands
int m_CanStartBlock; // >= 0 (or >= n) if a block can start int m_CanStartBlock; // >= 0 (or >= n) if a block can start
bool m_PrintIsMirrored; // True when drawing in mirror mode. Used in draw arc function,
// because arcs are oriented, and in mirror mode, orientations are reversed
// usefull to avoid false start block in certain cases (like switch from a sheet to an other scheet // usefull to avoid false start block in certain cases (like switch from a sheet to an other scheet
int m_PanelDefaultCursor; // Current mouse cursor default shape id for this window int m_PanelDefaultCursor; // Current mouse cursor default shape id for this window
int m_PanelCursor; // Current mouse cursor shape id for this window int m_PanelCursor; // Current mouse cursor shape id for this window
...@@ -71,7 +73,7 @@ public: ...@@ -71,7 +73,7 @@ public:
void OnSize( wxSizeEvent& event ); void OnSize( wxSizeEvent& event );
void SetBoundaryBox(); void SetBoundaryBox();
void ReDraw( wxDC* DC, bool erasebg = TRUE ); void ReDraw( wxDC* DC, bool erasebg = TRUE );
void PrintPage( wxDC* DC, bool Print_Sheet_Ref, int PrintMask ); void PrintPage( wxDC* DC, bool Print_Sheet_Ref, int PrintMask, bool aPrintMirrorMode );
void DrawBackGround( wxDC* DC ); void DrawBackGround( wxDC* DC );
void m_Draw_Auxiliary_Axis( wxDC* DC, int drawmode ); void m_Draw_Auxiliary_Axis( wxDC* DC, int drawmode );
void OnEraseBackground( wxEraseEvent& event ); void OnEraseBackground( wxEraseEvent& event );
......
...@@ -244,8 +244,17 @@ void DRAWSEGMENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -244,8 +244,17 @@ void DRAWSEGMENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
StAngle = (int) ArcTangente( dy - uy0, dx - ux0 ); StAngle = (int) ArcTangente( dy - uy0, dx - ux0 );
EndAngle = StAngle + m_Angle; EndAngle = StAngle + m_Angle;
if( StAngle > EndAngle ) if ( ! panel->m_PrintIsMirrored)
EXCHG( StAngle, EndAngle ); {
if( StAngle > EndAngle )
EXCHG( StAngle, EndAngle );
}
else //Mirrored mode: arc orientation is reversed
{
if( StAngle < EndAngle )
EXCHG( StAngle, EndAngle );
}
if( mode == FILAIRE ) if( mode == FILAIRE )
GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, rayon, color ); GRArc( &panel->m_ClipBox, DC, ux0, uy0, StAngle, EndAngle, rayon, color );
......
...@@ -19,9 +19,9 @@ static void Plot_Module( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* Module, ...@@ -19,9 +19,9 @@ static void Plot_Module( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* Module,
int draw_mode, int masklayer ); int draw_mode, int masklayer );
/**********************************************************************************/ /************************************************************************************************************/
void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmasklayer ) void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmasklayer, bool aPrintMirrorMode )
/**********************************************************************************/ /************************************************************************************************************/
/* Used to print the board. /* Used to print the board.
* Draw the board, but only layers allowed by printmasklayer * Draw the board, but only layers allowed by printmasklayer
...@@ -51,6 +51,8 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl ...@@ -51,6 +51,8 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl
DisplayOpt.DisplayDrawItems = FILLED; DisplayOpt.DisplayDrawItems = FILLED;
DisplayOpt.DisplayZones = TRUE; DisplayOpt.DisplayZones = TRUE;
m_PrintIsMirrored = aPrintMirrorMode;
/* Draw the pcb graphic items (texts, ...) */ /* Draw the pcb graphic items (texts, ...) */
for( BOARD_ITEM* item = Pcb->m_Drawings; item; item = item->Next() ) for( BOARD_ITEM* item = Pcb->m_Drawings; item; item = item->Next() )
{ {
...@@ -138,6 +140,8 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl ...@@ -138,6 +140,8 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int printmaskl
if( Print_Sheet_Ref ) if( Print_Sheet_Ref )
m_Parent->TraceWorkSheet( DC, ActiveScreen, 0 ); m_Parent->TraceWorkSheet( DC, ActiveScreen, 0 );
m_PrintIsMirrored = false;
DisplayOpt = save_opt; DisplayOpt = save_opt;
frame->m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill; frame->m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill;
frame->m_DisplayPadFill = DisplayOpt.DisplayPadFill; frame->m_DisplayPadFill = DisplayOpt.DisplayPadFill;
......
...@@ -36,9 +36,9 @@ void AddTextBoxWithClearancePolygon( Bool_Engine* aBooleng, ...@@ -36,9 +36,9 @@ void AddTextBoxWithClearancePolygon( Bool_Engine* aBooleng,
static int s_CircleToSegmentsCount = 16; /* default value. the real value will be changed to 32 static int s_CircleToSegmentsCount = 16; /* default value. the real value will be changed to 32
* if g_Zone_Arc_Approximation == 1 * if g_Zone_Arc_Approximation == 1
*/ */
double s_Correction; /* mult coeff used to enlarge rouded and oval pads double s_Correction; /* mult coeff used to enlarge rounded and oval pads (and vias)
* because the segment approximation for arcs and circles * because the segment approximation for arcs and circles
* create a smaler gap than a trur circle * create a smaller gap than a true circle
*/ */
/** function AddClearanceAreasPolygonsToPolysList /** function AddClearanceAreasPolygonsToPolysList
* Add non copper areas polygons (pads and tracks with clearence) * Add non copper areas polygons (pads and tracks with clearence)
......
...@@ -87,6 +87,7 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id, ...@@ -87,6 +87,7 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id,
m_Block_Enable = FALSE; m_Block_Enable = FALSE;
m_PanelDefaultCursor = m_PanelCursor = wxCURSOR_ARROW; m_PanelDefaultCursor = m_PanelCursor = wxCURSOR_ARROW;
m_CursorLevel = 0; m_CursorLevel = 0;
m_PrintIsMirrored = false;
} }
......
...@@ -475,7 +475,7 @@ bool WinEDA_PrintSVGFrame::DrawPage( const wxString& FullFileName, BASE_SCREEN* ...@@ -475,7 +475,7 @@ bool WinEDA_PrintSVGFrame::DrawPage( const wxString& FullFileName, BASE_SCREEN*
g_IsPrinting = TRUE; g_IsPrinting = TRUE;
SetLocaleTo_C_standard( ); // Switch the locale to standard C (needed to print floating point numbers like 1.3) SetLocaleTo_C_standard( ); // Switch the locale to standard C (needed to print floating point numbers like 1.3)
panel->PrintPage( &dc, m_Print_Sheet_Ref, m_PrintMaskLayer ); panel->PrintPage( &dc, m_Print_Sheet_Ref, m_PrintMaskLayer, false );
SetLocaleTo_Default( ); // revert to the current locale SetLocaleTo_Default( ); // revert to the current locale
g_IsPrinting = FALSE; g_IsPrinting = FALSE;
panel->m_ClipBox = tmp; panel->m_ClipBox = tmp;
......
...@@ -830,10 +830,10 @@ void EDA_Printout::DrawPage() ...@@ -830,10 +830,10 @@ void EDA_Printout::DrawPage()
s_PrintMaskLayer |= EDGE_LAYER; s_PrintMaskLayer |= EDGE_LAYER;
#endif #endif
panel->PrintPage( dc, 0, s_PrintMaskLayer ); panel->PrintPage( dc, 0, s_PrintMaskLayer, s_PrintMirror );
#else #else
panel->PrintPage( dc, m_Print_Sheet_Ref, s_PrintMaskLayer ); panel->PrintPage( dc, m_Print_Sheet_Ref, s_PrintMaskLayer, s_PrintMirror );
#endif #endif
g_IsPrinting = FALSE; g_IsPrinting = FALSE;
......
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