Loading CHANGELOG.txt +7 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,13 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. 2009-Jan-08 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ ++Eeschema: Print and plot functions now properly prints all sheets in a complex hierarchy plot files created have now a new filename in order to be compatible with complex hierarchies 2009-Jan-07 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ ++Eeschema: Loading eeschema/plothpgl.cpp +240 −152 Original line number Diff line number Diff line Loading @@ -179,6 +179,7 @@ bool WinEDA_PlotHPGLFrame::Create( wxWindow* parent, m_PlotOrgPosition_Y = NULL; m_btClose = NULL; m_MsgBox = NULL; ////@end WinEDA_PlotHPGLFrame member initialisation ////@begin WinEDA_PlotHPGLFrame creation Loading @@ -191,6 +192,7 @@ bool WinEDA_PlotHPGLFrame::Create( wxWindow* parent, GetSizer()->SetSizeHints( this ); } Centre(); ////@end WinEDA_PlotHPGLFrame creation return true; } Loading Loading @@ -230,76 +232,137 @@ void WinEDA_PlotHPGLFrame::CreateControls() m_SizeOptionStrings.Add( _( "Page Size C" ) ); m_SizeOptionStrings.Add( _( "Page Size D" ) ); m_SizeOptionStrings.Add( _( "Page Size E" ) ); m_SizeOption = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Plot page size:"), wxDefaultPosition, wxDefaultSize, m_SizeOptionStrings, 1, wxRA_SPECIFY_COLS ); m_SizeOption = new wxRadioBox( itemDialog1, ID_RADIOBOX, _( "Plot page size:" ), wxDefaultPosition, wxDefaultSize, m_SizeOptionStrings, 1, wxRA_SPECIFY_COLS ); m_SizeOption->SetSelection( 0 ); itemBoxSizer4->Add( m_SizeOption, 0, wxALIGN_LEFT | wxALL, 5 ); wxBoxSizer* itemBoxSizer6 = new wxBoxSizer( wxVERTICAL ); itemBoxSizer3->Add( itemBoxSizer6, 0, wxALIGN_TOP | wxALL, 5 ); wxStaticBox* itemStaticBoxSizer7Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Pen control:")); wxStaticBoxSizer* itemStaticBoxSizer7 = new wxStaticBoxSizer(itemStaticBoxSizer7Static, wxVERTICAL); wxStaticBox* itemStaticBoxSizer7Static = new wxStaticBox( itemDialog1, wxID_ANY, _( "Pen control:" ) ); wxStaticBoxSizer* itemStaticBoxSizer7 = new wxStaticBoxSizer( itemStaticBoxSizer7Static, wxVERTICAL ); itemBoxSizer6->Add( itemStaticBoxSizer7, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); wxStaticText* itemStaticText8 = new wxStaticText( itemDialog1, wxID_STATIC, _("Pen Width ( mils )"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer7->Add(itemStaticText8, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); m_ButtPenWidth = new wxSpinCtrl( itemDialog1, ID_PEN_WIDTH_UPDATED, _T("1"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 1, 100, 1 ); wxStaticText* itemStaticText8 = new wxStaticText( itemDialog1, wxID_STATIC, _( "Pen Width ( mils )" ), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer7->Add( itemStaticText8, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 ); m_ButtPenWidth = new wxSpinCtrl( itemDialog1, ID_PEN_WIDTH_UPDATED, _T( "1" ), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS | wxSP_WRAP, 1, 100, 1 ); itemStaticBoxSizer7->Add( m_ButtPenWidth, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); wxStaticText* itemStaticText10 = new wxStaticText( itemDialog1, wxID_STATIC, _("Pen Speed ( cm/s )"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer7->Add(itemStaticText10, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); m_ButtPenSpeed = new wxSpinCtrl( itemDialog1, ID_PEN_SPEED_UPDATED, _T("1"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 100, 1 ); itemStaticBoxSizer7->Add(m_ButtPenSpeed, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxBOTTOM, 5); wxStaticText* itemStaticText12 = new wxStaticText( itemDialog1, wxID_STATIC, _("Pen Number"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer7->Add(itemStaticText12, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); m_ButtPenNum = new wxSpinCtrl( itemDialog1, ID_PEN_NUMBER_UPDATED, _T("1"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 8, 1 ); itemStaticBoxSizer7->Add(m_ButtPenNum, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxBOTTOM, 5); wxStaticBox* itemStaticBoxSizer14Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Page offset:")); wxStaticBoxSizer* itemStaticBoxSizer14 = new wxStaticBoxSizer(itemStaticBoxSizer14Static, wxVERTICAL); wxStaticText* itemStaticText10 = new wxStaticText( itemDialog1, wxID_STATIC, _( "Pen Speed ( cm/s )" ), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer7->Add( itemStaticText10, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 ); m_ButtPenSpeed = new wxSpinCtrl( itemDialog1, ID_PEN_SPEED_UPDATED, _T( "1" ), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 100, 1 ); itemStaticBoxSizer7->Add( m_ButtPenSpeed, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); wxStaticText* itemStaticText12 = new wxStaticText( itemDialog1, wxID_STATIC, _( "Pen Number" ), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer7->Add( itemStaticText12, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 ); m_ButtPenNum = new wxSpinCtrl( itemDialog1, ID_PEN_NUMBER_UPDATED, _T( "1" ), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 8, 1 ); itemStaticBoxSizer7->Add( m_ButtPenNum, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); wxStaticBox* itemStaticBoxSizer14Static = new wxStaticBox( itemDialog1, wxID_ANY, _( "Page offset:" ) ); wxStaticBoxSizer* itemStaticBoxSizer14 = new wxStaticBoxSizer( itemStaticBoxSizer14Static, wxVERTICAL ); itemBoxSizer6->Add( itemStaticBoxSizer14, 0, wxALIGN_LEFT | wxALL, 5 ); wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1, wxID_STATIC, _("Plot Offset X"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer14->Add(itemStaticText15, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); m_PlotOrgPosition_X = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer14->Add(m_PlotOrgPosition_X, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5); wxStaticText* itemStaticText17 = new wxStaticText( itemDialog1, wxID_STATIC, _("Plot Offset Y"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer14->Add(itemStaticText17, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); m_PlotOrgPosition_Y = new wxTextCtrl( itemDialog1, ID_TEXTCTRL2, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer14->Add(m_PlotOrgPosition_Y, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5); wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1, wxID_STATIC, _( "Plot Offset X" ), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer14->Add( itemStaticText15, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 ); m_PlotOrgPosition_X = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T( "" ), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer14->Add( m_PlotOrgPosition_X, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); wxStaticText* itemStaticText17 = new wxStaticText( itemDialog1, wxID_STATIC, _( "Plot Offset Y" ), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer14->Add( itemStaticText17, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 ); m_PlotOrgPosition_Y = new wxTextCtrl( itemDialog1, ID_TEXTCTRL2, _T( "" ), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer14->Add( m_PlotOrgPosition_Y, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); itemBoxSizer3->Add( 5, 5, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); wxBoxSizer* itemBoxSizer20 = new wxBoxSizer( wxVERTICAL ); itemBoxSizer3->Add( itemBoxSizer20, 0, wxALIGN_TOP | wxLEFT | wxTOP | wxBOTTOM, 5 ); wxButton* itemButton21 = new wxButton( itemDialog1, ID_PLOT_HPGL_CURRENT_EXECUTE, _("&Plot page"), wxDefaultPosition, wxDefaultSize, 0 ); wxButton* itemButton21 = new wxButton( itemDialog1, ID_PLOT_HPGL_CURRENT_EXECUTE, _( "&Plot page" ), wxDefaultPosition, wxDefaultSize, 0 ); itemButton21->SetDefault(); itemButton21->SetForegroundColour( wxColour( 0, 128, 0 ) ); itemBoxSizer20->Add( itemButton21, 0, wxGROW | wxALL, 5 ); wxButton* itemButton22 = new wxButton( itemDialog1, ID_PLOT_HPGL_ALL_EXECUTE, _("Plot a&ll"), wxDefaultPosition, wxDefaultSize, 0 ); wxButton* itemButton22 = new wxButton( itemDialog1, ID_PLOT_HPGL_ALL_EXECUTE, _( "Plot a&ll" ), wxDefaultPosition, wxDefaultSize, 0 ); itemButton22->SetForegroundColour( wxColour( 0, 0, 255 ) ); itemBoxSizer20->Add( itemButton22, 0, wxGROW | wxALL, 5 ); m_btClose = new wxButton( itemDialog1, wxID_CANCEL, _("&Close"), wxDefaultPosition, wxDefaultSize, 0 ); m_btClose = new wxButton( itemDialog1, wxID_CANCEL, _( "&Close" ), wxDefaultPosition, wxDefaultSize, 0 ); m_btClose->SetForegroundColour( wxColour( 128, 0, 0 ) ); itemBoxSizer20->Add( m_btClose, 0, wxGROW | wxALL, 5 ); itemBoxSizer20->Add( 5, 5, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); wxButton* itemButton25 = new wxButton( itemDialog1, ID_PLOT_ACCEPT_OFFSET, _("&Accept Offset"), wxDefaultPosition, wxDefaultSize, 0 ); wxButton* itemButton25 = new wxButton( itemDialog1, ID_PLOT_ACCEPT_OFFSET, _( "&Accept Offset" ), wxDefaultPosition, wxDefaultSize, 0 ); itemButton25->SetForegroundColour( wxColour( 101, 123, 68 ) ); itemBoxSizer20->Add( itemButton25, 0, wxGROW | wxALL, 5 ); m_MsgBox = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxSize(-1, 110), wxTE_MULTILINE ); m_MsgBox = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T( "" ), wxDefaultPosition, wxSize( -1, 110 ), wxTE_MULTILINE ); itemBoxSizer2->Add( m_MsgBox, 0, wxGROW | wxALL, 5 ); // Set validators Loading @@ -307,6 +370,7 @@ void WinEDA_PlotHPGLFrame::CreateControls() m_ButtPenWidth->SetValidator( wxGenericValidator( &g_HPGL_Pen_Descr.m_Pen_Diam ) ); m_ButtPenSpeed->SetValidator( wxGenericValidator( &g_HPGL_Pen_Descr.m_Pen_Speed ) ); m_ButtPenNum->SetValidator( wxGenericValidator( &g_HPGL_Pen_Descr.m_Pen_Num ) ); ////@end WinEDA_PlotHPGLFrame content construction SetFocus(); // Make ESC key working } Loading Loading @@ -341,6 +405,7 @@ void WinEDA_PlotHPGLFrame::OnCancelClick( wxCommandEvent& event ) ////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_PlotHPGLFrame. // Before editing this code, remove the block markers. event.Skip(); ////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_PlotHPGLFrame. } Loading Loading @@ -375,6 +440,7 @@ wxBitmap WinEDA_PlotHPGLFrame::GetBitmapResource( const wxString& name ) ////@begin WinEDA_PlotHPGLFrame bitmap retrieval wxUnusedVar( name ); return wxNullBitmap; ////@end WinEDA_PlotHPGLFrame bitmap retrieval } Loading @@ -389,6 +455,7 @@ wxIcon WinEDA_PlotHPGLFrame::GetIconResource( const wxString& name ) ////@begin WinEDA_PlotHPGLFrame icon retrieval wxUnusedVar( name ); return wxNullIcon; ////@end WinEDA_PlotHPGLFrame icon retrieval } Loading @@ -402,10 +469,12 @@ void WinEDA_PlotHPGLFrame::SetPageOffsetValue() if( HPGL_SizeSelect != PAGE_DEFAULT ) { msg = ReturnStringFromValue( g_UnitMetric, Plot_sheet_list[HPGL_SizeSelect]->m_Offset.x, EESCHEMA_INTERNAL_UNIT ); Plot_sheet_list[HPGL_SizeSelect]->m_Offset.x, EESCHEMA_INTERNAL_UNIT ); m_PlotOrgPosition_X->SetValue( msg ); msg = ReturnStringFromValue( g_UnitMetric, Plot_sheet_list[HPGL_SizeSelect]->m_Offset.y, EESCHEMA_INTERNAL_UNIT ); Plot_sheet_list[HPGL_SizeSelect]->m_Offset.y, EESCHEMA_INTERNAL_UNIT ); m_PlotOrgPosition_Y->SetValue( msg ); m_PlotOrgPosition_X->Enable( TRUE ); Loading Loading @@ -526,8 +595,11 @@ void WinEDA_PlotHPGLFrame::ReturnSheetDims( BASE_SCREEN* screen, void WinEDA_PlotHPGLFrame::Plot_Schematic_HPGL( int Select_PlotAll, int HPGL_SheetSize ) /***********************************************************************************/ { wxString PlotFileName, ShortFileName; BASE_SCREEN* screen; WinEDA_SchematicFrame* schframe = (WinEDA_SchematicFrame*) m_Parent; wxString PlotFileName; SCH_SCREEN* screen = schframe->GetScreen(); SCH_SCREEN* oldscreen = screen; DrawSheetPath* sheetpath, * oldsheetpath = schframe->GetSheet(); Ki_PageDescr* PlotSheet; wxSize SheetSize; wxPoint SheetOffset, PlotOffset; Loading @@ -535,15 +607,34 @@ void WinEDA_PlotHPGLFrame::Plot_Schematic_HPGL( int Select_PlotAll, int HPGL_She g_PlotFormat = PLOT_FORMAT_HPGL; /* Build the screen list */ EDA_ScreenList ScreenList; /* When printing all pages, the printed page is not the current page. * In complex hierarchies, we must setup references and others parameters in the printed SCH_SCREEN * because in complex hierarchies a SCH_SCREEN (a schematic drawings) * is shared between many sheets */ EDA_SheetList SheetList( NULL ); sheetpath = SheetList.GetFirst(); DrawSheetPath list; if( Select_PlotAll == TRUE ) screen = ScreenList.GetFirst(); else screen = m_Parent->GetBaseScreen(); for( ; screen != NULL; screen = ScreenList.GetNext() ) for( ; ; ) { if( Select_PlotAll ) { if( sheetpath == NULL ) break; list.Clear(); if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) ) { schframe->m_CurrentSheet = &list; schframe->m_CurrentSheet->UpdateAllScreenReferences(); schframe->SetSheetNumberAndCount(); screen = schframe->m_CurrentSheet->LastScreen(); ActiveScreen = screen; } else // Should not occur return; sheetpath = SheetList.GetNext(); } ReturnSheetDims( screen, SheetSize, SheetOffset ); /* Calcul des echelles de conversion */ g_PlotScaleX = Scale_X * SCALE_HPGL; Loading @@ -560,24 +651,21 @@ void WinEDA_PlotHPGLFrame::Plot_Schematic_HPGL( int Select_PlotAll, int HPGL_She PlotOffset.x -= (int) ( margin * SCALE_HPGL ); PlotOffset.y += (int) ( margin * SCALE_HPGL ); wxSplitPath( screen->m_FileName.GetData(), (wxString*) NULL, &ShortFileName, (wxString*) NULL ); wxString dirbuf = wxGetCwd() + STRING_DIR_SEP; if( !ShortFileName.IsEmpty() ) PlotFileName = MakeFileName( dirbuf, ShortFileName, wxT( ".plt" ) ); else PlotFileName = MakeFileName( dirbuf, g_DefaultSchematicFileName, wxT( ".plt" ) ); PlotFileName = schframe->GetUniqueFilenameForCurrentSheet() + wxT( ".plt" ); SetLocaleTo_C_standard(); InitPlotParametresHPGL( PlotOffset, g_PlotScaleX, g_PlotScaleY ); Plot_1_Page_HPGL( PlotFileName, screen ); SetLocaleTo_Default(); screen = screen->Next(); if( Select_PlotAll == FALSE ) if( !Select_PlotAll ) break; } m_MsgBox->AppendText( _( "** Plot End **\n" ) ); ActiveScreen = oldscreen; schframe->m_CurrentSheet = oldsheetpath; schframe->m_CurrentSheet->UpdateAllScreenReferences(); schframe->SetSheetNumberAndCount(); } Loading eeschema/plotps.cpp +3 −29 Original line number Diff line number Diff line Loading @@ -376,12 +376,11 @@ void WinEDA_PlotPSFrame::CreatePSFile( int AllPages, int pagesize ) WinEDA_SchematicFrame* schframe = (WinEDA_SchematicFrame*) m_Parent; SCH_SCREEN* screen = schframe->GetScreen(); SCH_SCREEN* oldscreen = screen; DrawSheetPath* oldsheetpath = schframe->GetSheet(); wxString PlotFileName, ShortFileName; DrawSheetPath* sheetpath, *oldsheetpath = schframe->GetSheet(); wxString PlotFileName; Ki_PageDescr* PlotSheet, * RealSheet; int BBox[4]; wxPoint plot_offset; DrawSheetPath* sheetpath; g_PlotFormat = PLOT_FORMAT_POST; Loading Loading @@ -433,32 +432,7 @@ void WinEDA_PlotPSFrame::CreatePSFile( int AllPages, int pagesize ) plot_offset.x = 0; plot_offset.y = PlotSheet->m_Size.y; /* If a screen is used more than once (complex hierarchy) we create more than once file * with the same basic filename * To avoid that, we use the root filename and and the sheet path * Or, if filename too long, sheet_name + sheet number */ wxSplitPath( g_RootSheet->GetFileName().GetData(), (wxString*) NULL, &ShortFileName, (wxString*) NULL ); if ( (ShortFileName.Len() + schframe->m_CurrentSheet->PathHumanReadable().Len() ) < 50 ) { ShortFileName += schframe->m_CurrentSheet->PathHumanReadable(); ShortFileName.Replace( wxT( "/" ), wxT( "-" ) ); ShortFileName.RemoveLast(); } else { wxSplitPath( g_RootSheet->GetFileName().GetData(), (wxString*) NULL, &ShortFileName, (wxString*) NULL ); ShortFileName << wxT("-") << screen->m_ScreenNumber; } wxString dirbuf = wxGetCwd() + STRING_DIR_SEP; if( !ShortFileName.IsEmpty() ) PlotFileName = MakeFileName( dirbuf, ShortFileName, wxT( ".ps" ) ); else PlotFileName = MakeFileName( dirbuf, g_DefaultSchematicFileName, wxT( ".ps" ) ); PlotFileName = schframe->GetUniqueFilenameForCurrentSheet( ) + wxT( ".ps" ); PlotOneSheetPS( PlotFileName, screen, RealSheet, BBox, plot_offset ); Loading eeschema/schframe.cpp +36 −0 Original line number Diff line number Diff line Loading @@ -450,7 +450,9 @@ void WinEDA_SchematicFrame::SetToolbars() } /************************************/ int WinEDA_SchematicFrame::BestZoom() /************************************/ { int dx, dy, ii, jj; int bestzoom; Loading @@ -471,6 +473,40 @@ int WinEDA_SchematicFrame::BestZoom() return bestzoom; } /*******************************************************************/ wxString WinEDA_SchematicFrame::GetUniqueFilenameForCurrentSheet( ) /*******************************************************************/ /** Function GetUniqueFilenameForCurrentSheet * @return a filename that can be used in plot and print functions * for the current screen anad sheet path. * This filename is unique and must be used insteed of the sreen filename * (or scheen filename) when one must creates file for each sheet in the heierarchy. * because in complex hierarchies a sheet and a SCH_SCREEN is used more than once * Name is <root sheet filename>-<sheet path> * and has no extension. * However if filename is too long name is <sheet filename>-<sheet number> */ { wxString filename; wxSplitPath( g_RootSheet->GetFileName().GetData(), (wxString*) NULL, &filename, (wxString*) NULL ); if ( (filename.Len() + m_CurrentSheet->PathHumanReadable().Len() ) < 50 ) { filename += m_CurrentSheet->PathHumanReadable(); filename.Replace( wxT( "/" ), wxT( "-" ) ); filename.RemoveLast(); } else { wxSplitPath( g_RootSheet->GetFileName().GetData(), (wxString*) NULL, &filename, (wxString*) NULL ); filename << wxT("-") << GetScreen()->m_ScreenNumber; } return filename; } /**************************************************************/ void WinEDA_SchematicFrame::OnAnnotate( wxCommandEvent& event ) Loading include/wxEeschemaStruct.h +12 −1 Original line number Diff line number Diff line Loading @@ -159,9 +159,20 @@ public: */ void DeleteAnnotation( bool aCurrentSheetOnly, bool aRedraw ); // FUnctions used for hierarchy handling // Functions used for hierarchy handling void InstallPreviousSheet(); void InstallNextScreen( DrawSheetStruct* Sheet ); /** Function GetUniqueFilenameForCurrentSheet * @return a filename that can be used in plot and print functions * for the current screen anad sheet path. * This filename is unique and must be used insteed of the sreen filename * (or scheen filename) when one must creates file for each sheet in the heierarchy. * because in complex hierarchies a sheet and a SCH_SCREEN is used more than once * Name is <root sheet filename>-<sheet path> * and has no extension. * However if filename is too long name is <sheet filename>-<sheet number> */ wxString GetUniqueFilenameForCurrentSheet( ); /** * Function SetSheetNumberAndCount Loading Loading
CHANGELOG.txt +7 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,13 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. 2009-Jan-08 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ ++Eeschema: Print and plot functions now properly prints all sheets in a complex hierarchy plot files created have now a new filename in order to be compatible with complex hierarchies 2009-Jan-07 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ ++Eeschema: Loading
eeschema/plothpgl.cpp +240 −152 Original line number Diff line number Diff line Loading @@ -179,6 +179,7 @@ bool WinEDA_PlotHPGLFrame::Create( wxWindow* parent, m_PlotOrgPosition_Y = NULL; m_btClose = NULL; m_MsgBox = NULL; ////@end WinEDA_PlotHPGLFrame member initialisation ////@begin WinEDA_PlotHPGLFrame creation Loading @@ -191,6 +192,7 @@ bool WinEDA_PlotHPGLFrame::Create( wxWindow* parent, GetSizer()->SetSizeHints( this ); } Centre(); ////@end WinEDA_PlotHPGLFrame creation return true; } Loading Loading @@ -230,76 +232,137 @@ void WinEDA_PlotHPGLFrame::CreateControls() m_SizeOptionStrings.Add( _( "Page Size C" ) ); m_SizeOptionStrings.Add( _( "Page Size D" ) ); m_SizeOptionStrings.Add( _( "Page Size E" ) ); m_SizeOption = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Plot page size:"), wxDefaultPosition, wxDefaultSize, m_SizeOptionStrings, 1, wxRA_SPECIFY_COLS ); m_SizeOption = new wxRadioBox( itemDialog1, ID_RADIOBOX, _( "Plot page size:" ), wxDefaultPosition, wxDefaultSize, m_SizeOptionStrings, 1, wxRA_SPECIFY_COLS ); m_SizeOption->SetSelection( 0 ); itemBoxSizer4->Add( m_SizeOption, 0, wxALIGN_LEFT | wxALL, 5 ); wxBoxSizer* itemBoxSizer6 = new wxBoxSizer( wxVERTICAL ); itemBoxSizer3->Add( itemBoxSizer6, 0, wxALIGN_TOP | wxALL, 5 ); wxStaticBox* itemStaticBoxSizer7Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Pen control:")); wxStaticBoxSizer* itemStaticBoxSizer7 = new wxStaticBoxSizer(itemStaticBoxSizer7Static, wxVERTICAL); wxStaticBox* itemStaticBoxSizer7Static = new wxStaticBox( itemDialog1, wxID_ANY, _( "Pen control:" ) ); wxStaticBoxSizer* itemStaticBoxSizer7 = new wxStaticBoxSizer( itemStaticBoxSizer7Static, wxVERTICAL ); itemBoxSizer6->Add( itemStaticBoxSizer7, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); wxStaticText* itemStaticText8 = new wxStaticText( itemDialog1, wxID_STATIC, _("Pen Width ( mils )"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer7->Add(itemStaticText8, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); m_ButtPenWidth = new wxSpinCtrl( itemDialog1, ID_PEN_WIDTH_UPDATED, _T("1"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 1, 100, 1 ); wxStaticText* itemStaticText8 = new wxStaticText( itemDialog1, wxID_STATIC, _( "Pen Width ( mils )" ), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer7->Add( itemStaticText8, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 ); m_ButtPenWidth = new wxSpinCtrl( itemDialog1, ID_PEN_WIDTH_UPDATED, _T( "1" ), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS | wxSP_WRAP, 1, 100, 1 ); itemStaticBoxSizer7->Add( m_ButtPenWidth, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); wxStaticText* itemStaticText10 = new wxStaticText( itemDialog1, wxID_STATIC, _("Pen Speed ( cm/s )"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer7->Add(itemStaticText10, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); m_ButtPenSpeed = new wxSpinCtrl( itemDialog1, ID_PEN_SPEED_UPDATED, _T("1"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 100, 1 ); itemStaticBoxSizer7->Add(m_ButtPenSpeed, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxBOTTOM, 5); wxStaticText* itemStaticText12 = new wxStaticText( itemDialog1, wxID_STATIC, _("Pen Number"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer7->Add(itemStaticText12, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); m_ButtPenNum = new wxSpinCtrl( itemDialog1, ID_PEN_NUMBER_UPDATED, _T("1"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 8, 1 ); itemStaticBoxSizer7->Add(m_ButtPenNum, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxBOTTOM, 5); wxStaticBox* itemStaticBoxSizer14Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Page offset:")); wxStaticBoxSizer* itemStaticBoxSizer14 = new wxStaticBoxSizer(itemStaticBoxSizer14Static, wxVERTICAL); wxStaticText* itemStaticText10 = new wxStaticText( itemDialog1, wxID_STATIC, _( "Pen Speed ( cm/s )" ), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer7->Add( itemStaticText10, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 ); m_ButtPenSpeed = new wxSpinCtrl( itemDialog1, ID_PEN_SPEED_UPDATED, _T( "1" ), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 100, 1 ); itemStaticBoxSizer7->Add( m_ButtPenSpeed, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); wxStaticText* itemStaticText12 = new wxStaticText( itemDialog1, wxID_STATIC, _( "Pen Number" ), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer7->Add( itemStaticText12, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 ); m_ButtPenNum = new wxSpinCtrl( itemDialog1, ID_PEN_NUMBER_UPDATED, _T( "1" ), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 8, 1 ); itemStaticBoxSizer7->Add( m_ButtPenNum, 0, wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); wxStaticBox* itemStaticBoxSizer14Static = new wxStaticBox( itemDialog1, wxID_ANY, _( "Page offset:" ) ); wxStaticBoxSizer* itemStaticBoxSizer14 = new wxStaticBoxSizer( itemStaticBoxSizer14Static, wxVERTICAL ); itemBoxSizer6->Add( itemStaticBoxSizer14, 0, wxALIGN_LEFT | wxALL, 5 ); wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1, wxID_STATIC, _("Plot Offset X"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer14->Add(itemStaticText15, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); m_PlotOrgPosition_X = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer14->Add(m_PlotOrgPosition_X, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5); wxStaticText* itemStaticText17 = new wxStaticText( itemDialog1, wxID_STATIC, _("Plot Offset Y"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer14->Add(itemStaticText17, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); m_PlotOrgPosition_Y = new wxTextCtrl( itemDialog1, ID_TEXTCTRL2, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer14->Add(m_PlotOrgPosition_Y, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5); wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1, wxID_STATIC, _( "Plot Offset X" ), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer14->Add( itemStaticText15, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 ); m_PlotOrgPosition_X = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T( "" ), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer14->Add( m_PlotOrgPosition_X, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); wxStaticText* itemStaticText17 = new wxStaticText( itemDialog1, wxID_STATIC, _( "Plot Offset Y" ), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer14->Add( itemStaticText17, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE, 5 ); m_PlotOrgPosition_Y = new wxTextCtrl( itemDialog1, ID_TEXTCTRL2, _T( "" ), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticBoxSizer14->Add( m_PlotOrgPosition_Y, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); itemBoxSizer3->Add( 5, 5, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); wxBoxSizer* itemBoxSizer20 = new wxBoxSizer( wxVERTICAL ); itemBoxSizer3->Add( itemBoxSizer20, 0, wxALIGN_TOP | wxLEFT | wxTOP | wxBOTTOM, 5 ); wxButton* itemButton21 = new wxButton( itemDialog1, ID_PLOT_HPGL_CURRENT_EXECUTE, _("&Plot page"), wxDefaultPosition, wxDefaultSize, 0 ); wxButton* itemButton21 = new wxButton( itemDialog1, ID_PLOT_HPGL_CURRENT_EXECUTE, _( "&Plot page" ), wxDefaultPosition, wxDefaultSize, 0 ); itemButton21->SetDefault(); itemButton21->SetForegroundColour( wxColour( 0, 128, 0 ) ); itemBoxSizer20->Add( itemButton21, 0, wxGROW | wxALL, 5 ); wxButton* itemButton22 = new wxButton( itemDialog1, ID_PLOT_HPGL_ALL_EXECUTE, _("Plot a&ll"), wxDefaultPosition, wxDefaultSize, 0 ); wxButton* itemButton22 = new wxButton( itemDialog1, ID_PLOT_HPGL_ALL_EXECUTE, _( "Plot a&ll" ), wxDefaultPosition, wxDefaultSize, 0 ); itemButton22->SetForegroundColour( wxColour( 0, 0, 255 ) ); itemBoxSizer20->Add( itemButton22, 0, wxGROW | wxALL, 5 ); m_btClose = new wxButton( itemDialog1, wxID_CANCEL, _("&Close"), wxDefaultPosition, wxDefaultSize, 0 ); m_btClose = new wxButton( itemDialog1, wxID_CANCEL, _( "&Close" ), wxDefaultPosition, wxDefaultSize, 0 ); m_btClose->SetForegroundColour( wxColour( 128, 0, 0 ) ); itemBoxSizer20->Add( m_btClose, 0, wxGROW | wxALL, 5 ); itemBoxSizer20->Add( 5, 5, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 ); wxButton* itemButton25 = new wxButton( itemDialog1, ID_PLOT_ACCEPT_OFFSET, _("&Accept Offset"), wxDefaultPosition, wxDefaultSize, 0 ); wxButton* itemButton25 = new wxButton( itemDialog1, ID_PLOT_ACCEPT_OFFSET, _( "&Accept Offset" ), wxDefaultPosition, wxDefaultSize, 0 ); itemButton25->SetForegroundColour( wxColour( 101, 123, 68 ) ); itemBoxSizer20->Add( itemButton25, 0, wxGROW | wxALL, 5 ); m_MsgBox = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxSize(-1, 110), wxTE_MULTILINE ); m_MsgBox = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T( "" ), wxDefaultPosition, wxSize( -1, 110 ), wxTE_MULTILINE ); itemBoxSizer2->Add( m_MsgBox, 0, wxGROW | wxALL, 5 ); // Set validators Loading @@ -307,6 +370,7 @@ void WinEDA_PlotHPGLFrame::CreateControls() m_ButtPenWidth->SetValidator( wxGenericValidator( &g_HPGL_Pen_Descr.m_Pen_Diam ) ); m_ButtPenSpeed->SetValidator( wxGenericValidator( &g_HPGL_Pen_Descr.m_Pen_Speed ) ); m_ButtPenNum->SetValidator( wxGenericValidator( &g_HPGL_Pen_Descr.m_Pen_Num ) ); ////@end WinEDA_PlotHPGLFrame content construction SetFocus(); // Make ESC key working } Loading Loading @@ -341,6 +405,7 @@ void WinEDA_PlotHPGLFrame::OnCancelClick( wxCommandEvent& event ) ////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_PlotHPGLFrame. // Before editing this code, remove the block markers. event.Skip(); ////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_PlotHPGLFrame. } Loading Loading @@ -375,6 +440,7 @@ wxBitmap WinEDA_PlotHPGLFrame::GetBitmapResource( const wxString& name ) ////@begin WinEDA_PlotHPGLFrame bitmap retrieval wxUnusedVar( name ); return wxNullBitmap; ////@end WinEDA_PlotHPGLFrame bitmap retrieval } Loading @@ -389,6 +455,7 @@ wxIcon WinEDA_PlotHPGLFrame::GetIconResource( const wxString& name ) ////@begin WinEDA_PlotHPGLFrame icon retrieval wxUnusedVar( name ); return wxNullIcon; ////@end WinEDA_PlotHPGLFrame icon retrieval } Loading @@ -402,10 +469,12 @@ void WinEDA_PlotHPGLFrame::SetPageOffsetValue() if( HPGL_SizeSelect != PAGE_DEFAULT ) { msg = ReturnStringFromValue( g_UnitMetric, Plot_sheet_list[HPGL_SizeSelect]->m_Offset.x, EESCHEMA_INTERNAL_UNIT ); Plot_sheet_list[HPGL_SizeSelect]->m_Offset.x, EESCHEMA_INTERNAL_UNIT ); m_PlotOrgPosition_X->SetValue( msg ); msg = ReturnStringFromValue( g_UnitMetric, Plot_sheet_list[HPGL_SizeSelect]->m_Offset.y, EESCHEMA_INTERNAL_UNIT ); Plot_sheet_list[HPGL_SizeSelect]->m_Offset.y, EESCHEMA_INTERNAL_UNIT ); m_PlotOrgPosition_Y->SetValue( msg ); m_PlotOrgPosition_X->Enable( TRUE ); Loading Loading @@ -526,8 +595,11 @@ void WinEDA_PlotHPGLFrame::ReturnSheetDims( BASE_SCREEN* screen, void WinEDA_PlotHPGLFrame::Plot_Schematic_HPGL( int Select_PlotAll, int HPGL_SheetSize ) /***********************************************************************************/ { wxString PlotFileName, ShortFileName; BASE_SCREEN* screen; WinEDA_SchematicFrame* schframe = (WinEDA_SchematicFrame*) m_Parent; wxString PlotFileName; SCH_SCREEN* screen = schframe->GetScreen(); SCH_SCREEN* oldscreen = screen; DrawSheetPath* sheetpath, * oldsheetpath = schframe->GetSheet(); Ki_PageDescr* PlotSheet; wxSize SheetSize; wxPoint SheetOffset, PlotOffset; Loading @@ -535,15 +607,34 @@ void WinEDA_PlotHPGLFrame::Plot_Schematic_HPGL( int Select_PlotAll, int HPGL_She g_PlotFormat = PLOT_FORMAT_HPGL; /* Build the screen list */ EDA_ScreenList ScreenList; /* When printing all pages, the printed page is not the current page. * In complex hierarchies, we must setup references and others parameters in the printed SCH_SCREEN * because in complex hierarchies a SCH_SCREEN (a schematic drawings) * is shared between many sheets */ EDA_SheetList SheetList( NULL ); sheetpath = SheetList.GetFirst(); DrawSheetPath list; if( Select_PlotAll == TRUE ) screen = ScreenList.GetFirst(); else screen = m_Parent->GetBaseScreen(); for( ; screen != NULL; screen = ScreenList.GetNext() ) for( ; ; ) { if( Select_PlotAll ) { if( sheetpath == NULL ) break; list.Clear(); if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) ) { schframe->m_CurrentSheet = &list; schframe->m_CurrentSheet->UpdateAllScreenReferences(); schframe->SetSheetNumberAndCount(); screen = schframe->m_CurrentSheet->LastScreen(); ActiveScreen = screen; } else // Should not occur return; sheetpath = SheetList.GetNext(); } ReturnSheetDims( screen, SheetSize, SheetOffset ); /* Calcul des echelles de conversion */ g_PlotScaleX = Scale_X * SCALE_HPGL; Loading @@ -560,24 +651,21 @@ void WinEDA_PlotHPGLFrame::Plot_Schematic_HPGL( int Select_PlotAll, int HPGL_She PlotOffset.x -= (int) ( margin * SCALE_HPGL ); PlotOffset.y += (int) ( margin * SCALE_HPGL ); wxSplitPath( screen->m_FileName.GetData(), (wxString*) NULL, &ShortFileName, (wxString*) NULL ); wxString dirbuf = wxGetCwd() + STRING_DIR_SEP; if( !ShortFileName.IsEmpty() ) PlotFileName = MakeFileName( dirbuf, ShortFileName, wxT( ".plt" ) ); else PlotFileName = MakeFileName( dirbuf, g_DefaultSchematicFileName, wxT( ".plt" ) ); PlotFileName = schframe->GetUniqueFilenameForCurrentSheet() + wxT( ".plt" ); SetLocaleTo_C_standard(); InitPlotParametresHPGL( PlotOffset, g_PlotScaleX, g_PlotScaleY ); Plot_1_Page_HPGL( PlotFileName, screen ); SetLocaleTo_Default(); screen = screen->Next(); if( Select_PlotAll == FALSE ) if( !Select_PlotAll ) break; } m_MsgBox->AppendText( _( "** Plot End **\n" ) ); ActiveScreen = oldscreen; schframe->m_CurrentSheet = oldsheetpath; schframe->m_CurrentSheet->UpdateAllScreenReferences(); schframe->SetSheetNumberAndCount(); } Loading
eeschema/plotps.cpp +3 −29 Original line number Diff line number Diff line Loading @@ -376,12 +376,11 @@ void WinEDA_PlotPSFrame::CreatePSFile( int AllPages, int pagesize ) WinEDA_SchematicFrame* schframe = (WinEDA_SchematicFrame*) m_Parent; SCH_SCREEN* screen = schframe->GetScreen(); SCH_SCREEN* oldscreen = screen; DrawSheetPath* oldsheetpath = schframe->GetSheet(); wxString PlotFileName, ShortFileName; DrawSheetPath* sheetpath, *oldsheetpath = schframe->GetSheet(); wxString PlotFileName; Ki_PageDescr* PlotSheet, * RealSheet; int BBox[4]; wxPoint plot_offset; DrawSheetPath* sheetpath; g_PlotFormat = PLOT_FORMAT_POST; Loading Loading @@ -433,32 +432,7 @@ void WinEDA_PlotPSFrame::CreatePSFile( int AllPages, int pagesize ) plot_offset.x = 0; plot_offset.y = PlotSheet->m_Size.y; /* If a screen is used more than once (complex hierarchy) we create more than once file * with the same basic filename * To avoid that, we use the root filename and and the sheet path * Or, if filename too long, sheet_name + sheet number */ wxSplitPath( g_RootSheet->GetFileName().GetData(), (wxString*) NULL, &ShortFileName, (wxString*) NULL ); if ( (ShortFileName.Len() + schframe->m_CurrentSheet->PathHumanReadable().Len() ) < 50 ) { ShortFileName += schframe->m_CurrentSheet->PathHumanReadable(); ShortFileName.Replace( wxT( "/" ), wxT( "-" ) ); ShortFileName.RemoveLast(); } else { wxSplitPath( g_RootSheet->GetFileName().GetData(), (wxString*) NULL, &ShortFileName, (wxString*) NULL ); ShortFileName << wxT("-") << screen->m_ScreenNumber; } wxString dirbuf = wxGetCwd() + STRING_DIR_SEP; if( !ShortFileName.IsEmpty() ) PlotFileName = MakeFileName( dirbuf, ShortFileName, wxT( ".ps" ) ); else PlotFileName = MakeFileName( dirbuf, g_DefaultSchematicFileName, wxT( ".ps" ) ); PlotFileName = schframe->GetUniqueFilenameForCurrentSheet( ) + wxT( ".ps" ); PlotOneSheetPS( PlotFileName, screen, RealSheet, BBox, plot_offset ); Loading
eeschema/schframe.cpp +36 −0 Original line number Diff line number Diff line Loading @@ -450,7 +450,9 @@ void WinEDA_SchematicFrame::SetToolbars() } /************************************/ int WinEDA_SchematicFrame::BestZoom() /************************************/ { int dx, dy, ii, jj; int bestzoom; Loading @@ -471,6 +473,40 @@ int WinEDA_SchematicFrame::BestZoom() return bestzoom; } /*******************************************************************/ wxString WinEDA_SchematicFrame::GetUniqueFilenameForCurrentSheet( ) /*******************************************************************/ /** Function GetUniqueFilenameForCurrentSheet * @return a filename that can be used in plot and print functions * for the current screen anad sheet path. * This filename is unique and must be used insteed of the sreen filename * (or scheen filename) when one must creates file for each sheet in the heierarchy. * because in complex hierarchies a sheet and a SCH_SCREEN is used more than once * Name is <root sheet filename>-<sheet path> * and has no extension. * However if filename is too long name is <sheet filename>-<sheet number> */ { wxString filename; wxSplitPath( g_RootSheet->GetFileName().GetData(), (wxString*) NULL, &filename, (wxString*) NULL ); if ( (filename.Len() + m_CurrentSheet->PathHumanReadable().Len() ) < 50 ) { filename += m_CurrentSheet->PathHumanReadable(); filename.Replace( wxT( "/" ), wxT( "-" ) ); filename.RemoveLast(); } else { wxSplitPath( g_RootSheet->GetFileName().GetData(), (wxString*) NULL, &filename, (wxString*) NULL ); filename << wxT("-") << GetScreen()->m_ScreenNumber; } return filename; } /**************************************************************/ void WinEDA_SchematicFrame::OnAnnotate( wxCommandEvent& event ) Loading
include/wxEeschemaStruct.h +12 −1 Original line number Diff line number Diff line Loading @@ -159,9 +159,20 @@ public: */ void DeleteAnnotation( bool aCurrentSheetOnly, bool aRedraw ); // FUnctions used for hierarchy handling // Functions used for hierarchy handling void InstallPreviousSheet(); void InstallNextScreen( DrawSheetStruct* Sheet ); /** Function GetUniqueFilenameForCurrentSheet * @return a filename that can be used in plot and print functions * for the current screen anad sheet path. * This filename is unique and must be used insteed of the sreen filename * (or scheen filename) when one must creates file for each sheet in the heierarchy. * because in complex hierarchies a sheet and a SCH_SCREEN is used more than once * Name is <root sheet filename>-<sheet path> * and has no extension. * However if filename is too long name is <sheet filename>-<sheet number> */ wxString GetUniqueFilenameForCurrentSheet( ); /** * Function SetSheetNumberAndCount Loading