Commit 31e3e985 authored by charras's avatar charras

Print and plot functions now properly prints all sheets in a complex hierarchy

parent 1fd73dff
......@@ -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:
......
......@@ -117,21 +117,21 @@ IMPLEMENT_DYNAMIC_CLASS( WinEDA_PlotHPGLFrame, wxDialog )
BEGIN_EVENT_TABLE( WinEDA_PlotHPGLFrame, wxDialog )
////@begin WinEDA_PlotHPGLFrame event table entries
EVT_RADIOBOX( ID_RADIOBOX, WinEDA_PlotHPGLFrame::OnRadioboxSelected )
EVT_RADIOBOX( ID_RADIOBOX, WinEDA_PlotHPGLFrame::OnRadioboxSelected )
EVT_SPINCTRL( ID_PEN_WIDTH_UPDATED, WinEDA_PlotHPGLFrame::OnPenWidthUpdatedUpdated )
EVT_SPINCTRL( ID_PEN_WIDTH_UPDATED, WinEDA_PlotHPGLFrame::OnPenWidthUpdatedUpdated )
EVT_SPINCTRL( ID_PEN_SPEED_UPDATED, WinEDA_PlotHPGLFrame::OnPenSpeedUpdatedUpdated )
EVT_SPINCTRL( ID_PEN_SPEED_UPDATED, WinEDA_PlotHPGLFrame::OnPenSpeedUpdatedUpdated )
EVT_SPINCTRL( ID_PEN_NUMBER_UPDATED, WinEDA_PlotHPGLFrame::OnPenNumberUpdatedUpdated )
EVT_SPINCTRL( ID_PEN_NUMBER_UPDATED, WinEDA_PlotHPGLFrame::OnPenNumberUpdatedUpdated )
EVT_BUTTON( ID_PLOT_HPGL_CURRENT_EXECUTE, WinEDA_PlotHPGLFrame::OnPlotHpglCurrentExecuteClick )
EVT_BUTTON( ID_PLOT_HPGL_CURRENT_EXECUTE, WinEDA_PlotHPGLFrame::OnPlotHpglCurrentExecuteClick )
EVT_BUTTON( ID_PLOT_HPGL_ALL_EXECUTE, WinEDA_PlotHPGLFrame::OnPlotHpglAllExecuteClick )
EVT_BUTTON( ID_PLOT_HPGL_ALL_EXECUTE, WinEDA_PlotHPGLFrame::OnPlotHpglAllExecuteClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_PlotHPGLFrame::OnCancelClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_PlotHPGLFrame::OnCancelClick )
EVT_BUTTON( ID_PLOT_ACCEPT_OFFSET, WinEDA_PlotHPGLFrame::OnPlotAcceptOffsetClick )
EVT_BUTTON( ID_PLOT_ACCEPT_OFFSET, WinEDA_PlotHPGLFrame::OnPlotAcceptOffsetClick )
////@end WinEDA_PlotHPGLFrame event table entries
......@@ -179,18 +179,20 @@ 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
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
SetExtraStyle( wxWS_EX_BLOCK_EVENTS );
wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls();
if (GetSizer())
if( GetSizer() )
{
GetSizer()->SetSizeHints(this);
GetSizer()->SetSizeHints( this );
}
Centre();
////@end WinEDA_PlotHPGLFrame creation
return true;
}
......@@ -209,104 +211,166 @@ void WinEDA_PlotHPGLFrame::CreateControls()
WinEDA_PlotHPGLFrame* itemDialog1 = this;
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
itemDialog1->SetSizer(itemBoxSizer2);
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxVERTICAL );
itemDialog1->SetSizer( itemBoxSizer2 );
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer( wxHORIZONTAL );
itemBoxSizer2->Add( itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer3->Add(itemBoxSizer4, 0, wxGROW|wxALL, 5);
wxBoxSizer* itemBoxSizer4 = new wxBoxSizer( wxVERTICAL );
itemBoxSizer3->Add( itemBoxSizer4, 0, wxGROW | wxALL, 5 );
wxArrayString m_SizeOptionStrings;
m_SizeOptionStrings.Add(_("Sheet Size"));
m_SizeOptionStrings.Add(_("Page Size A4"));
m_SizeOptionStrings.Add(_("Page Size A3"));
m_SizeOptionStrings.Add(_("Page Size A2"));
m_SizeOptionStrings.Add(_("Page Size A1"));
m_SizeOptionStrings.Add(_("Page Size A0"));
m_SizeOptionStrings.Add(_("Page Size A"));
m_SizeOptionStrings.Add(_("Page Size B"));
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->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);
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 );
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);
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);
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 );
m_SizeOptionStrings.Add( _( "Sheet Size" ) );
m_SizeOptionStrings.Add( _( "Page Size A4" ) );
m_SizeOptionStrings.Add( _( "Page Size A3" ) );
m_SizeOptionStrings.Add( _( "Page Size A2" ) );
m_SizeOptionStrings.Add( _( "Page Size A1" ) );
m_SizeOptionStrings.Add( _( "Page Size A0" ) );
m_SizeOptionStrings.Add( _( "Page Size A" ) );
m_SizeOptionStrings.Add( _( "Page Size B" ) );
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->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 );
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 );
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 );
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 );
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 );
itemButton21->SetDefault();
itemButton21->SetForegroundColour(wxColour(0, 128, 0));
itemBoxSizer20->Add(itemButton21, 0, wxGROW|wxALL, 5);
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 );
itemButton22->SetForegroundColour(wxColour(0, 0, 255));
itemBoxSizer20->Add(itemButton22, 0, wxGROW|wxALL, 5);
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->SetForegroundColour(wxColour(128, 0, 0));
itemBoxSizer20->Add(m_btClose, 0, wxGROW|wxALL, 5);
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);
itemBoxSizer20->Add( 5, 5, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
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);
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 );
itemBoxSizer2->Add(m_MsgBox, 0, wxGROW|wxALL, 5);
m_MsgBox =
new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T( "" ), wxDefaultPosition, wxSize( -1,
110 ),
wxTE_MULTILINE );
itemBoxSizer2->Add( m_MsgBox, 0, wxGROW | wxALL, 5 );
// Set validators
m_SizeOption->SetValidator( wxGenericValidator(& HPGL_SizeSelect) );
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) );
m_SizeOption->SetValidator( wxGenericValidator( &HPGL_SizeSelect ) );
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
}
......@@ -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.
}
......@@ -373,8 +438,9 @@ wxBitmap WinEDA_PlotHPGLFrame::GetBitmapResource( const wxString& name )
{
// Bitmap retrieval
////@begin WinEDA_PlotHPGLFrame bitmap retrieval
wxUnusedVar(name);
wxUnusedVar( name );
return wxNullBitmap;
////@end WinEDA_PlotHPGLFrame bitmap retrieval
}
......@@ -387,8 +453,9 @@ wxIcon WinEDA_PlotHPGLFrame::GetIconResource( const wxString& name )
{
// Icon retrieval
////@begin WinEDA_PlotHPGLFrame icon retrieval
wxUnusedVar(name);
wxUnusedVar( name );
return wxNullIcon;
////@end WinEDA_PlotHPGLFrame icon retrieval
}
......@@ -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 );
......@@ -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;
......@@ -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;
......@@ -555,29 +646,26 @@ void WinEDA_PlotHPGLFrame::Plot_Schematic_HPGL( int Select_PlotAll, int HPGL_She
g_PlotScaleY = g_PlotScaleY * (SheetSize.y - 2 * margin) / PlotSheet->m_Size.y;
/* calcul des offsets */
PlotOffset.x = -(int) (SheetOffset.x * SCALE_HPGL);
PlotOffset.x = -(int) ( SheetOffset.x * SCALE_HPGL );
PlotOffset.y = (int) ( (SheetOffset.y + SheetSize.y) * SCALE_HPGL );
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" ) );
PlotOffset.x -= (int) ( margin * SCALE_HPGL );
PlotOffset.y += (int) ( margin * SCALE_HPGL );
SetLocaleTo_C_standard( );
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 )
SetLocaleTo_Default();
if( !Select_PlotAll )
break;
}
m_MsgBox->AppendText( _( "** Plot End **\n" ) );
ActiveScreen = oldscreen;
schframe->m_CurrentSheet = oldsheetpath;
schframe->m_CurrentSheet->UpdateAllScreenReferences();
schframe->SetSheetNumberAndCount();
}
......@@ -653,7 +741,7 @@ void WinEDA_PlotHPGLFrame::Plot_1_Page_HPGL( const wxString& FullFileName,
deltaY = 8;
else
{
angle = atan2( (double) (x2 - x1), (double) (y1 - y2) );
angle = atan2( (double) ( x2 - x1 ), (double) ( y1 - y2 ) );
deltaX = (int) ( 8 * sin( angle ) );
deltaY = (int) ( 8 * cos( angle ) );
}
......
......@@ -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;
......@@ -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 );
......
......@@ -450,7 +450,9 @@ void WinEDA_SchematicFrame::SetToolbars()
}
/************************************/
int WinEDA_SchematicFrame::BestZoom()
/************************************/
{
int dx, dy, ii, jj;
int bestzoom;
......@@ -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 )
......
......@@ -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
......
......@@ -192,7 +192,7 @@ void WinEDA_PrintSVGFrame::CreateControls()
SetFont( *g_DialogFont );
////@begin WinEDA_PrintSVGFrame content construction
// Generated by DialogBlocks, 27/08/2008 08:07:11 (unregistered)
// Generated by DialogBlocks, 08/01/2009 12:58:57 (unregistered)
WinEDA_PrintSVGFrame* itemDialog1 = this;
......@@ -227,7 +227,7 @@ void WinEDA_PrintSVGFrame::CreateControls()
wxArrayString m_PagesOptionStrings;
m_PagesOptionStrings.Add(_("Current"));
m_PagesOptionStrings.Add(_("All"));
m_PagesOption = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _("Page Print:"), wxDefaultPosition, wxDefaultSize, m_PagesOptionStrings, 1, wxRA_SPECIFY_COLS );
m_PagesOption = new wxRadioBox( itemDialog1, ID_RADIOBOX_SELPAGE, _("Page Print:"), wxDefaultPosition, wxDefaultSize, m_PagesOptionStrings, 1, wxRA_SPECIFY_COLS );
m_PagesOption->SetSelection(0);
itemBoxSizer9->Add(m_PagesOption, 0, wxALIGN_LEFT|wxALL, 5);
......@@ -240,22 +240,14 @@ void WinEDA_PrintSVGFrame::CreateControls()
itemButton12->SetForegroundColour(wxColour(0, 0, 198));
itemBoxSizer9->Add(itemButton12, 0, wxGROW|wxALL, 5);
wxGrid* itemGrid13 = new wxGrid( itemDialog1, ID_GRID1, wxDefaultPosition, wxSize(200, 150), wxSUNKEN_BORDER|wxHSCROLL|wxVSCROLL );
itemGrid13->SetDefaultColSize(50);
itemGrid13->SetDefaultRowSize(25);
itemGrid13->SetColLabelSize(25);
itemGrid13->SetRowLabelSize(50);
itemGrid13->CreateGrid(5, 5, wxGrid::wxGridSelectCells);
itemBoxSizer3->Add(itemGrid13, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
wxStaticText* itemStaticText14 = new wxStaticText( itemDialog1, wxID_STATIC, _("Filename:"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer2->Add(itemStaticText14, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
wxStaticText* itemStaticText13 = new wxStaticText( itemDialog1, wxID_STATIC, _("Filename:"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer2->Add(itemStaticText13, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
m_FileNameCtrl = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer2->Add(m_FileNameCtrl, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
wxStaticText* itemStaticText16 = new wxStaticText( itemDialog1, wxID_STATIC, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer2->Add(itemStaticText16, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1, wxID_STATIC, _("Messages:"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer2->Add(itemStaticText15, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
m_MessagesBox = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxSize(-1, 100), wxTE_MULTILINE|wxTE_READONLY );
itemBoxSizer2->Add(m_MessagesBox, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
......@@ -311,18 +303,6 @@ wxIcon WinEDA_PrintSVGFrame::GetIconResource( const wxString& name )
}
/******************************************************/
wxString WinEDA_PrintSVGFrame::ReturnFullFileName()
/******************************************************/
{
wxString name, ext;
name = m_Parent->GetBaseScreen()->m_FileName;
ChangeFileNameExt( name, wxT( ".svg" ) );
return name;
}
/********************************************/
void WinEDA_PrintSVGFrame::SetPenWidth()
/********************************************/
......@@ -362,7 +342,7 @@ void WinEDA_PrintSVGFrame::PrintSVGDoc( wxCommandEvent& event )
SetPenWidth();
wxString FullFileName;
BASE_SCREEN* screen = m_Parent->GetBaseScreen();
BASE_SCREEN* oldscreen = screen;
#ifndef EESCHEMA
......@@ -388,14 +368,33 @@ void WinEDA_PrintSVGFrame::PrintSVGDoc( wxCommandEvent& event )
#ifdef EESCHEMA
if( Select_PrintAll && m_Parent->m_Ident == SCHEMATIC_FRAME )
{
EDA_ScreenList ScreenList;
for( SCH_SCREEN* schscreen = ScreenList.GetFirst(); schscreen != NULL;
schscreen = ScreenList.GetNext() )
WinEDA_SchematicFrame* schframe = (WinEDA_SchematicFrame*) m_Parent;
DrawSheetPath* sheetpath, *oldsheetpath = schframe->GetSheet();
SCH_SCREEN* schscreen = schframe->GetScreen();
oldscreen = schscreen;
EDA_SheetList SheetList( NULL );
sheetpath = SheetList.GetFirst();
DrawSheetPath list;
for( ; ; )
{
/* Create all files *.svg */
( (WinEDA_SchematicFrame*) m_Parent )->SetScreen( schscreen );
wxString FullFileName = schscreen->m_FileName;
ChangeFileNameExt( FullFileName, wxT( ".svg" ) );
if( sheetpath == NULL )
break;
list.Clear();
if( list.BuildSheetPathInfoFromSheetPathValue( sheetpath->Path() ) )
{
schframe->m_CurrentSheet = &list;
schframe->m_CurrentSheet->UpdateAllScreenReferences();
schframe->SetSheetNumberAndCount();
schscreen = schframe->m_CurrentSheet->LastScreen();
ActiveScreen = schscreen;
}
else // Should not happen
return;
sheetpath = SheetList.GetNext();
FullFileName = schframe->GetUniqueFilenameForCurrentSheet( ) + wxT( ".svg" );
bool success = DrawPage( FullFileName, schscreen );
msg = _( "Create file " ) + FullFileName;
if( !success )
......@@ -403,11 +402,14 @@ void WinEDA_PrintSVGFrame::PrintSVGDoc( wxCommandEvent& event )
msg += wxT( "\n" );
m_MessagesBox->AppendText( msg );
}
schframe->m_CurrentSheet = oldsheetpath;
schframe->m_CurrentSheet->UpdateAllScreenReferences();
schframe->SetSheetNumberAndCount();
}
else
#endif
{
wxString FullFileName = m_FileNameCtrl->GetValue();
FullFileName = m_FileNameCtrl->GetValue();
if( FullFileName.IsEmpty() )
{
FullFileName = screen->m_FileName;
......
......@@ -24,7 +24,6 @@
////@begin includes
#include "wx/valgen.h"
#include "wx/grid.h"
////@end includes
/*!
......@@ -43,9 +42,8 @@ class wxBoxSizer;
#define ID_DIALOG 10000
#define ID_RADIOBOX_SETPRINTMODE 10007
#define ID_CHECKBOX 10004
#define ID_RADIOBOX1 10008
#define ID_RADIOBOX_SELPAGE 10008
#define ID_PRINT_EXECUTE 10002
#define ID_GRID1 10003
#define ID_TEXTCTRL 10001
#define ID_TEXTCTRL1 10006
#define SYMBOL_WINEDA_PRINTSVGFRAME_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|wxFRAME_FLOAT_ON_PARENT|MAYBE_RESIZE_BORDER
......@@ -118,7 +116,6 @@ public:
void PrintSVGDoc(wxCommandEvent& event);
bool DrawPage(const wxString & FullFileName, BASE_SCREEN* screen);
wxString ReturnFullFileName();
////@begin WinEDA_PrintSVGFrame member variables
wxBoxSizer* m_DialogPenWidthSizer;
......
......@@ -556,7 +556,7 @@
<bool name="proxy-wxFIXED_MINSIZE">0</bool>
<string name="proxy-Platform">"&lt;Any platform&gt;"</string>
<document>
<string name="title">"wxRadioBox: ID_RADIOBOX1"</string>
<string name="title">"wxRadioBox: ID_RADIOBOX_SELPAGE"</string>
<string name="type">"dialog-control-document"</string>
<string name="filename">""</string>
<string name="icon-name">"radiobox"</string>
......@@ -566,7 +566,7 @@
<long name="locked">0</long>
<string name="created">"23/12/2006"</string>
<string name="proxy-type">"wbRadioBoxProxy"</string>
<string name="proxy-Id name">"ID_RADIOBOX1"</string>
<string name="proxy-Id name">"ID_RADIOBOX_SELPAGE"</string>
<long name="proxy-Id value">10008</long>
<string name="proxy-Name">""</string>
<string name="proxy-Class">"wxRadioBox"</string>
......
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