Thread Previous • Date Previous • Date Next • Thread Next |
Sorry, mistype again. Fixed. On 11.03.2013 23:36, Sergey Borshch wrote:
On 11.03.2013 21:41, jp charras wrote:Le 11/03/2013 15:17, Sergey A. Borshch a écrit :This patch makes scale option "fit to page" do the same as in all other programs worldwide - produce biggest image that still fits to page. Pcbnew generates 1:1-scaled centered image instead.Sorry, your patch does not work: - scale is evaluated as int, not double. - page margins are not taken in account. - crashes with void boards.Yes, you're right, my fault. reworked patch attached. Thanks for quick response and commiting other my patches. Sergey
=== modified file 'pcbnew/printout_controler.cpp' --- pcbnew/printout_controler.cpp 2013-03-11 19:30:58 +0000 +++ pcbnew/printout_controler.cpp 2013-03-11 21:33:48 +0000 @@ -191,8 +191,14 @@ if( m_PrintParams.m_PrintScale == 0 ) // fit in page option { - // TODO: a better way to calculate the userscale - userscale = 1.0; + if(boardBoundingBox.GetWidth() && boardBoundingBox.GetHeight()) + { + double scaleX = double(m_Parent->GetPageSizeIU().x) / boardBoundingBox.GetWidth(); + double scaleY = double(m_Parent->GetPageSizeIU().y) / boardBoundingBox.GetHeight(); + userscale = (scaleX < scaleY) ? scaleX : scaleY; + } + else + userscale = 1.0; } wxSize scaledPageSize = m_Parent->GetPageSizeIU();
Thread Previous • Date Previous • Date Next • Thread Next |