fixed somes issues in SVG export

This commit is contained in:
jean-pierre charras 2010-04-20 18:01:14 +02:00
commit c7374713c6
12 changed files with 29 additions and 25 deletions

View File

@ -262,6 +262,7 @@ set(BITMAP_SRCS
new.xpm
noconn.xpm
Normal.xpm
online_help.xpm
Open_Library.xpm
Open_Project.xpm
open.xpm

View File

@ -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 );

View File

@ -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 */

View File

@ -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;

View File

@ -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 */

View File

@ -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 );
/**

View File

@ -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" ) );

View File

@ -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[];

View File

@ -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 */

View File

@ -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,28 +266,31 @@ 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;
panel->m_ClipBox.SetX( 0 ); panel->m_ClipBox.SetY( 0 );
panel->m_ClipBox.SetWidth( 0x7FFFFF0 ); panel->m_ClipBox.SetHeight(
0x7FFFFF0 );
panel->m_ClipBox.SetX( 0 );
panel->m_ClipBox.SetY( 0 );
panel->m_ClipBox.SetWidth( 0x7FFFFF0 );
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)
int bg_color = g_DrawBgColor;
g_DrawBgColor = WHITE;
m_Parent->PrintPage( &dc, aPrint_Frame_Ref, m_PrintMaskLayer, false, &s_Parameters);
g_DrawBgColor = bg_color;
SetLocaleTo_Default(); // revert to the current locale
screen->m_IsPrinting = false;
panel->m_ClipBox = tmp;

View File

@ -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 );

View File

@ -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 );