From ec5e682ef878cc4c7cce409fbee0977bf167c45f Mon Sep 17 00:00:00 2001 From: jp Date: Tue, 20 Apr 2010 13:23:59 +0200 Subject: [PATCH] fixed some issues in SVG export. --- bitmaps/CMakeLists.txt | 1 + common/dcsvg.cpp | 4 ++-- cvpcb/menucfg.cpp | 2 +- eeschema/dialog_SVG_print.cpp | 10 ++++++---- eeschema/menubar.cpp | 2 +- eeschema/menubar_libedit.cpp | 2 +- gerbview/tool_gerber.cpp | 2 +- include/bitmaps.h | 1 + kicad/menubar.cpp | 2 +- pcbnew/dialog_SVG_print.cpp | 17 ++++++++--------- pcbnew/menubar_modedit.cpp | 2 +- pcbnew/menubar_pcbframe.cpp | 2 +- 12 files changed, 25 insertions(+), 22 deletions(-) diff --git a/bitmaps/CMakeLists.txt b/bitmaps/CMakeLists.txt index b1e5c2be9e..321d3c85e0 100644 --- a/bitmaps/CMakeLists.txt +++ b/bitmaps/CMakeLists.txt @@ -262,6 +262,7 @@ set(BITMAP_SRCS new.xpm noconn.xpm Normal.xpm + online_help.xpm Open_Library.xpm Open_Project.xpm open.xpm diff --git a/common/dcsvg.cpp b/common/dcsvg.cpp index 8004984590..a954be7838 100644 --- a/common/dcsvg.cpp +++ b/common/dcsvg.cpp @@ -157,8 +157,8 @@ void wxSVGFileDC::Init( wxString f, int Width, int Height, float dpi ) write( s ); s.Printf( wxT( " version=\"1.1\"\n" ) ); write( s ); - s.Printf( wxT( " width=\"%.2gcm\" height=\"%.2gcm\" viewBox=\"0 0 %d %d \"\n" ), - float (Width) / dpi * 2.54, float (Height) / dpi * 2.54, Width, Height ); + s.Printf( wxT( " width=\"%gin\" height=\"%gin\" viewBox=\"0 0 %d %d \"\n" ), + double (Width) / dpi, double (Height) / dpi, Width, Height ); write( s ); s.Printf( wxT( ">\n" ) ); write( s ); diff --git a/cvpcb/menucfg.cpp b/cvpcb/menucfg.cpp index b8e6b67cf3..c09e83be3e 100644 --- a/cvpcb/menucfg.cpp +++ b/cvpcb/menucfg.cpp @@ -80,7 +80,7 @@ void WinEDA_CvpcbFrame::ReCreateMenuBar() wxMenu* helpMenu = new wxMenu; item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ), _( "Open the cvpcb manual" ) ); - item->SetBitmap( help_xpm ); + item->SetBitmap( online_help_xpm ); helpMenu->Append( item ); /* About on all platforms except WXMAC */ diff --git a/eeschema/dialog_SVG_print.cpp b/eeschema/dialog_SVG_print.cpp index 5d72ed7625..da2543b3b6 100644 --- a/eeschema/dialog_SVG_print.cpp +++ b/eeschema/dialog_SVG_print.cpp @@ -230,12 +230,16 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( WinEDA_DrawFrame * frame, old_org = screen->m_DrawOrg; screen->m_DrawOrg.x = screen->m_DrawOrg.y = 0; screen->m_StartVisu.x = screen->m_StartVisu.y = 0; - SheetSize = screen->ReturnPageSize( ); + SheetSize = screen->ReturnPageSize( ); // page size in 1/1000 inch, ie in internal units screen->SetScalingFactor( 1.0 ); WinEDA_DrawPanel* panel = frame->DrawPanel; - wxSVGFileDC dc( FullFileName, SheetSize.x, SheetSize.y ); + SetLocaleTo_C_standard( ); // Switch the locale to standard C (needed + // to print floating point numbers like 1.3) + + float dpi = (float)frame->m_InternalUnits; + wxSVGFileDC dc( FullFileName, SheetSize.x, SheetSize.y, dpi ); EDA_Rect tmp = panel->m_ClipBox; GRResetPenAndBrush( &dc ); @@ -248,8 +252,6 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( WinEDA_DrawFrame * frame, panel->m_ClipBox.SetHeight( 0x7FFFFF0 ); screen->m_IsPrinting = true; - SetLocaleTo_C_standard( ); // Switch the locale to standard C (needed - // to print floating point numbers like 1.3) frame->PrintPage( &dc, aPrint_Sheet_Ref, 1, false ); SetLocaleTo_Default( ); // revert to the current locale screen->m_IsPrinting = false; diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index af8988d32c..2979e94714 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -429,7 +429,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar() wxMenu* helpMenu = new wxMenu; item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ), _( "Open the eeschema manual" ) ); - item->SetBitmap( help_xpm ); + item->SetBitmap( online_help_xpm ); helpMenu->Append( item ); /* About on all platforms except WXMAC */ diff --git a/eeschema/menubar_libedit.cpp b/eeschema/menubar_libedit.cpp index ee33c7890b..e1a8b369cc 100644 --- a/eeschema/menubar_libedit.cpp +++ b/eeschema/menubar_libedit.cpp @@ -251,7 +251,7 @@ void WinEDA_LibeditFrame::ReCreateMenuBar() wxMenu* helpMenu = new wxMenu; item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ), _( "Open the eeschema manual" ) ); - item->SetBitmap( help_xpm ); + item->SetBitmap( online_help_xpm ); helpMenu->Append( item ); /** diff --git a/gerbview/tool_gerber.cpp b/gerbview/tool_gerber.cpp index f22f2ac20e..c551e62789 100644 --- a/gerbview/tool_gerber.cpp +++ b/gerbview/tool_gerber.cpp @@ -118,7 +118,7 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void ) _( "Open the gerbview manual" ), help_xpm ); ADD_MENUITEM_WITH_HELP( helpMenu, ID_KICAD_ABOUT, _( "&About Gerbview" ), _( "About gerbview gerber and drill viewer" ), - info_xpm ); + online_help_xpm ); menuBar->Append( filesMenu, _( "&File" ) ); menuBar->Append( configmenu, _( "&Preferences" ) ); diff --git a/include/bitmaps.h b/include/bitmaps.h index bb800b90f9..b014ac0ca5 100644 --- a/include/bitmaps.h +++ b/include/bitmaps.h @@ -255,6 +255,7 @@ extern const char* new_txt_xpm[]; extern const char* new_xpm[]; extern const char* noconn_button[]; extern const char* normal_xpm[]; +extern const char* online_help_xpm[]; extern const char* open_library_xpm[]; extern const char* open_project_xpm[]; extern const char* open_xpm[]; diff --git a/kicad/menubar.cpp b/kicad/menubar.cpp index 8ed6e5e448..1883f6daf5 100644 --- a/kicad/menubar.cpp +++ b/kicad/menubar.cpp @@ -227,7 +227,7 @@ void WinEDA_MainFrame::ReCreateMenuBar() /* Contents */ item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ), _( "Open the kicad manual" ) ); - item->SetBitmap( help_xpm ); + item->SetBitmap( online_help_xpm ); helpMenu->Append( item ); /* About on all platforms except WXMAC */ diff --git a/pcbnew/dialog_SVG_print.cpp b/pcbnew/dialog_SVG_print.cpp index 35f1804d83..5789114174 100644 --- a/pcbnew/dialog_SVG_print.cpp +++ b/pcbnew/dialog_SVG_print.cpp @@ -38,7 +38,6 @@ class DIALOG_SVG_PRINT : public DIALOG_SVG_PRINT_base { private: WinEDA_BasePcbFrame* m_Parent; - int m_ImageXSize_mm; wxConfig* m_Config; long m_PrintMaskLayer; wxCheckBox* m_BoxSelectLayer[32]; @@ -90,7 +89,6 @@ void DIALOG_SVG_PRINT::initDialog( ) { SetFocus(); // Make ESC key working - m_ImageXSize_mm = 270; if( m_Config ) { m_Config->Read( PLOTSVGMODECOLOR_KEY, &s_Parameters.m_Print_Black_and_White ); @@ -245,7 +243,7 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Frame_Ref ) /* - * Routine actual print + * Actual print function. */ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, BASE_SCREEN* screen, @@ -255,7 +253,6 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, wxPoint tmp_startvisu; wxSize SheetSize; // Sheet size in internal units wxPoint old_org; - float dpi; bool success = true; /* Change frames and local settings */ @@ -269,16 +266,16 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, SheetSize.y *= m_Parent->m_InternalUnits / 1000; // size in pixels screen->SetScalingFactor( 1.0 ); - dpi = (float) SheetSize.x * 25.4 / m_ImageXSize_mm; + float dpi = (float)m_Parent->m_InternalUnits; WinEDA_DrawPanel* panel = m_Parent->DrawPanel; + SetLocaleTo_C_standard(); // Switch the locale to standard C (needed + // to print floating point numbers like 1.3) wxSVGFileDC dc( FullFileName, SheetSize.x, SheetSize.y, dpi ); EDA_Rect tmp = panel->m_ClipBox; GRResetPenAndBrush( &dc ); - s_Parameters.m_PenDefaultSize = ReturnValueFromTextCtrl( *m_DialogPenWidth, - m_Parent->m_InternalUnits ); GRForceBlackPen( m_ModeColorOption->GetSelection() == 0 ? false : true ); s_Parameters.m_DrillShapeOpt = PRINT_PARAMETERS::FULL_DRILL_SHAPE; @@ -288,9 +285,11 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, 0x7FFFFF0 ); screen->m_IsPrinting = true; - SetLocaleTo_C_standard(); // Switch the locale to standard C (needed - // to print floating point numbers like 1.3) + + int tmp_cb = g_DrawBgColor; + g_DrawBgColor = WHITE; m_Parent->PrintPage( &dc, aPrint_Frame_Ref, m_PrintMaskLayer, false, &s_Parameters); + g_DrawBgColor = tmp_cb; SetLocaleTo_Default(); // revert to the current locale screen->m_IsPrinting = false; panel->m_ClipBox = tmp; diff --git a/pcbnew/menubar_modedit.cpp b/pcbnew/menubar_modedit.cpp index e133b8e32b..982febbbf1 100644 --- a/pcbnew/menubar_modedit.cpp +++ b/pcbnew/menubar_modedit.cpp @@ -53,7 +53,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar() ID_GENERAL_HELP, _( "&Contents" ), _( "Open the pcbnew manual" ) ); - item->SetBitmap( help_xpm ); + item->SetBitmap( online_help_xpm ); helpMenu->Append( item ); diff --git a/pcbnew/menubar_pcbframe.cpp b/pcbnew/menubar_pcbframe.cpp index 7ca1f1f82f..c3ffa88476 100644 --- a/pcbnew/menubar_pcbframe.cpp +++ b/pcbnew/menubar_pcbframe.cpp @@ -488,7 +488,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar() wxMenu* helpMenu = new wxMenu; item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ), _( "Open the PCBnew manual" ) ); - item->SetBitmap( help_xpm ); + item->SetBitmap( online_help_xpm ); helpMenu->Append( item );