← Back to team overview

kicad-developers team mailing list archive

PATCH: frame and title block mirrored

 

Here is a patch which fixes one of the issues in Bug 1255937.

In the bug report, the frame and title block are mirrored when the PCB is mirrored. This patch ensures that the frame and title block appear as they should.

While investigating the reported bug I found that there are a number of related issues in the rendering of arcs in particular, so it will take some time before I fix all the other issues.

Testing: I tested print functions (and mirrored prints) within eeschema, pcbnew, and gerbview to make sure that eeschema and gerbview are not accidentally affected.

Caveats: The test for a flipped Y axis is very simple -- I check the device origin. In principle if we support printouts across multiple pages then the scheme in this patch will probably break, but there is no general solution which is guaranteed to not break.

Question: I see that when the scaling changes, *everything* is scaled including the frame and title block. Should I fix the scaling issue?

- Cirilo
=== modified file 'common/worksheet.cpp'
--- common/worksheet.cpp	2013-09-20 13:48:27 +0000
+++ common/worksheet.cpp	2014-01-07 08:58:42 +0000
@@ -94,10 +94,24 @@
     TITLE_BLOCK t_block = GetTitleBlock();
     EDA_COLOR_T color = RED;
 
+    wxPoint origin = aDC->GetDeviceOrigin();
+
+    if( aScreen->m_IsPrinting && 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, color );
+
+    if( aScreen->m_IsPrinting && origin.y > 0 )
+    {
+        aDC->SetDeviceOrigin( origin.x, origin.y );
+        aDC->SetAxisOrientation( true, true );
+    }
 }
 
 


Follow ups