Commit ec5e682e authored by jp's avatar jp

fixed some issues in SVG export.

parent bd381d94
...@@ -262,6 +262,7 @@ set(BITMAP_SRCS ...@@ -262,6 +262,7 @@ set(BITMAP_SRCS
new.xpm new.xpm
noconn.xpm noconn.xpm
Normal.xpm Normal.xpm
online_help.xpm
Open_Library.xpm Open_Library.xpm
Open_Project.xpm Open_Project.xpm
open.xpm open.xpm
......
...@@ -157,8 +157,8 @@ void wxSVGFileDC::Init( wxString f, int Width, int Height, float dpi ) ...@@ -157,8 +157,8 @@ void wxSVGFileDC::Init( wxString f, int Width, int Height, float dpi )
write( s ); write( s );
s.Printf( wxT( " version=\"1.1\"\n" ) ); s.Printf( wxT( " version=\"1.1\"\n" ) );
write( s ); write( s );
s.Printf( wxT( " width=\"%.2gcm\" height=\"%.2gcm\" viewBox=\"0 0 %d %d \"\n" ), s.Printf( wxT( " width=\"%gin\" height=\"%gin\" viewBox=\"0 0 %d %d \"\n" ),
float (Width) / dpi * 2.54, float (Height) / dpi * 2.54, Width, Height ); double (Width) / dpi, double (Height) / dpi, Width, Height );
write( s ); write( s );
s.Printf( wxT( ">\n" ) ); s.Printf( wxT( ">\n" ) );
write( s ); write( s );
......
...@@ -80,7 +80,7 @@ void WinEDA_CvpcbFrame::ReCreateMenuBar() ...@@ -80,7 +80,7 @@ void WinEDA_CvpcbFrame::ReCreateMenuBar()
wxMenu* helpMenu = new wxMenu; wxMenu* helpMenu = new wxMenu;
item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ), item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ),
_( "Open the cvpcb manual" ) ); _( "Open the cvpcb manual" ) );
item->SetBitmap( help_xpm ); item->SetBitmap( online_help_xpm );
helpMenu->Append( item ); helpMenu->Append( item );
/* About on all platforms except WXMAC */ /* About on all platforms except WXMAC */
......
...@@ -230,12 +230,16 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( WinEDA_DrawFrame * frame, ...@@ -230,12 +230,16 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( WinEDA_DrawFrame * frame,
old_org = screen->m_DrawOrg; old_org = screen->m_DrawOrg;
screen->m_DrawOrg.x = screen->m_DrawOrg.y = 0; screen->m_DrawOrg.x = screen->m_DrawOrg.y = 0;
screen->m_StartVisu.x = screen->m_StartVisu.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 ); screen->SetScalingFactor( 1.0 );
WinEDA_DrawPanel* panel = frame->DrawPanel; 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; EDA_Rect tmp = panel->m_ClipBox;
GRResetPenAndBrush( &dc ); GRResetPenAndBrush( &dc );
...@@ -248,8 +252,6 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( WinEDA_DrawFrame * frame, ...@@ -248,8 +252,6 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( WinEDA_DrawFrame * frame,
panel->m_ClipBox.SetHeight( 0x7FFFFF0 ); panel->m_ClipBox.SetHeight( 0x7FFFFF0 );
screen->m_IsPrinting = true; 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 ); frame->PrintPage( &dc, aPrint_Sheet_Ref, 1, false );
SetLocaleTo_Default( ); // revert to the current locale SetLocaleTo_Default( ); // revert to the current locale
screen->m_IsPrinting = false; screen->m_IsPrinting = false;
......
...@@ -429,7 +429,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar() ...@@ -429,7 +429,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
wxMenu* helpMenu = new wxMenu; wxMenu* helpMenu = new wxMenu;
item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ), item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ),
_( "Open the eeschema manual" ) ); _( "Open the eeschema manual" ) );
item->SetBitmap( help_xpm ); item->SetBitmap( online_help_xpm );
helpMenu->Append( item ); helpMenu->Append( item );
/* About on all platforms except WXMAC */ /* About on all platforms except WXMAC */
......
...@@ -251,7 +251,7 @@ void WinEDA_LibeditFrame::ReCreateMenuBar() ...@@ -251,7 +251,7 @@ void WinEDA_LibeditFrame::ReCreateMenuBar()
wxMenu* helpMenu = new wxMenu; wxMenu* helpMenu = new wxMenu;
item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ), item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ),
_( "Open the eeschema manual" ) ); _( "Open the eeschema manual" ) );
item->SetBitmap( help_xpm ); item->SetBitmap( online_help_xpm );
helpMenu->Append( item ); helpMenu->Append( item );
/** /**
......
...@@ -118,7 +118,7 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void ) ...@@ -118,7 +118,7 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void )
_( "Open the gerbview manual" ), help_xpm ); _( "Open the gerbview manual" ), help_xpm );
ADD_MENUITEM_WITH_HELP( helpMenu, ID_KICAD_ABOUT, _( "&About Gerbview" ), ADD_MENUITEM_WITH_HELP( helpMenu, ID_KICAD_ABOUT, _( "&About Gerbview" ),
_( "About gerbview gerber and drill viewer" ), _( "About gerbview gerber and drill viewer" ),
info_xpm ); online_help_xpm );
menuBar->Append( filesMenu, _( "&File" ) ); menuBar->Append( filesMenu, _( "&File" ) );
menuBar->Append( configmenu, _( "&Preferences" ) ); menuBar->Append( configmenu, _( "&Preferences" ) );
......
...@@ -255,6 +255,7 @@ extern const char* new_txt_xpm[]; ...@@ -255,6 +255,7 @@ extern const char* new_txt_xpm[];
extern const char* new_xpm[]; extern const char* new_xpm[];
extern const char* noconn_button[]; extern const char* noconn_button[];
extern const char* normal_xpm[]; extern const char* normal_xpm[];
extern const char* online_help_xpm[];
extern const char* open_library_xpm[]; extern const char* open_library_xpm[];
extern const char* open_project_xpm[]; extern const char* open_project_xpm[];
extern const char* open_xpm[]; extern const char* open_xpm[];
......
...@@ -227,7 +227,7 @@ void WinEDA_MainFrame::ReCreateMenuBar() ...@@ -227,7 +227,7 @@ void WinEDA_MainFrame::ReCreateMenuBar()
/* Contents */ /* Contents */
item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ), item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ),
_( "Open the kicad manual" ) ); _( "Open the kicad manual" ) );
item->SetBitmap( help_xpm ); item->SetBitmap( online_help_xpm );
helpMenu->Append( item ); helpMenu->Append( item );
/* About on all platforms except WXMAC */ /* About on all platforms except WXMAC */
......
...@@ -38,7 +38,6 @@ class DIALOG_SVG_PRINT : public DIALOG_SVG_PRINT_base ...@@ -38,7 +38,6 @@ class DIALOG_SVG_PRINT : public DIALOG_SVG_PRINT_base
{ {
private: private:
WinEDA_BasePcbFrame* m_Parent; WinEDA_BasePcbFrame* m_Parent;
int m_ImageXSize_mm;
wxConfig* m_Config; wxConfig* m_Config;
long m_PrintMaskLayer; long m_PrintMaskLayer;
wxCheckBox* m_BoxSelectLayer[32]; wxCheckBox* m_BoxSelectLayer[32];
...@@ -90,7 +89,6 @@ void DIALOG_SVG_PRINT::initDialog( ) ...@@ -90,7 +89,6 @@ void DIALOG_SVG_PRINT::initDialog( )
{ {
SetFocus(); // Make ESC key working SetFocus(); // Make ESC key working
m_ImageXSize_mm = 270;
if( m_Config ) if( m_Config )
{ {
m_Config->Read( PLOTSVGMODECOLOR_KEY, &s_Parameters.m_Print_Black_and_White ); 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 ) ...@@ -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, bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
BASE_SCREEN* screen, BASE_SCREEN* screen,
...@@ -255,7 +253,6 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, ...@@ -255,7 +253,6 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
wxPoint tmp_startvisu; wxPoint tmp_startvisu;
wxSize SheetSize; // Sheet size in internal units wxSize SheetSize; // Sheet size in internal units
wxPoint old_org; wxPoint old_org;
float dpi;
bool success = true; bool success = true;
/* Change frames and local settings */ /* Change frames and local settings */
...@@ -269,16 +266,16 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, ...@@ -269,16 +266,16 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
SheetSize.y *= m_Parent->m_InternalUnits / 1000; // size in pixels SheetSize.y *= m_Parent->m_InternalUnits / 1000; // size in pixels
screen->SetScalingFactor( 1.0 ); 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; 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 ); wxSVGFileDC dc( FullFileName, SheetSize.x, SheetSize.y, dpi );
EDA_Rect tmp = panel->m_ClipBox; EDA_Rect tmp = panel->m_ClipBox;
GRResetPenAndBrush( &dc ); GRResetPenAndBrush( &dc );
s_Parameters.m_PenDefaultSize = ReturnValueFromTextCtrl( *m_DialogPenWidth,
m_Parent->m_InternalUnits );
GRForceBlackPen( m_ModeColorOption->GetSelection() == 0 ? false : true ); GRForceBlackPen( m_ModeColorOption->GetSelection() == 0 ? false : true );
s_Parameters.m_DrillShapeOpt = PRINT_PARAMETERS::FULL_DRILL_SHAPE; s_Parameters.m_DrillShapeOpt = PRINT_PARAMETERS::FULL_DRILL_SHAPE;
...@@ -288,9 +285,11 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, ...@@ -288,9 +285,11 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName,
0x7FFFFF0 ); 0x7FFFFF0 );
screen->m_IsPrinting = true; 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); m_Parent->PrintPage( &dc, aPrint_Frame_Ref, m_PrintMaskLayer, false, &s_Parameters);
g_DrawBgColor = tmp_cb;
SetLocaleTo_Default(); // revert to the current locale SetLocaleTo_Default(); // revert to the current locale
screen->m_IsPrinting = false; screen->m_IsPrinting = false;
panel->m_ClipBox = tmp; panel->m_ClipBox = tmp;
......
...@@ -53,7 +53,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar() ...@@ -53,7 +53,7 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
ID_GENERAL_HELP, ID_GENERAL_HELP,
_( "&Contents" ), _( "&Contents" ),
_( "Open the pcbnew manual" ) ); _( "Open the pcbnew manual" ) );
item->SetBitmap( help_xpm ); item->SetBitmap( online_help_xpm );
helpMenu->Append( item ); helpMenu->Append( item );
......
...@@ -488,7 +488,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar() ...@@ -488,7 +488,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
wxMenu* helpMenu = new wxMenu; wxMenu* helpMenu = new wxMenu;
item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ), item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ),
_( "Open the PCBnew manual" ) ); _( "Open the PCBnew manual" ) );
item->SetBitmap( help_xpm ); item->SetBitmap( online_help_xpm );
helpMenu->Append( item ); helpMenu->Append( item );
......
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