${SHEETNAME} represents the sheet name + introduce ${SHEETPATH}
CHANGED: The text variable ${SHEETNAME} now always represents the name of the sheet when used anywhere in the schematic editor, including the title block ADDED: A new text variable ${SHEETPATH} which is replaced with the path to the current sheet - e.g. "/Sheet 1/Sheet 2". To ensure backward compatibility, the default drawing sheet now uses ${SHEETPATH}. Custom drawing sheets will need to be manually edited.
This commit is contained in:
parent
5e52539939
commit
0015574a60
|
@ -144,7 +144,7 @@ extern const char defaultDrawingSheet[] =
|
|||
"(tbtext \"Title: ${TITLE}\" (name \"\") (pos 109 10.7) (font (size 2 2) bold italic))\n"
|
||||
"(tbtext \"File: ${FILENAME}\" (name \"\") (pos 109 14.3))\n"
|
||||
"(line (name \"\") (start 110 18.5) (end 2 18.5))\n"
|
||||
"(tbtext \"Sheet: ${SHEETNAME}\" (name \"\") (pos 109 17))\n"
|
||||
"(tbtext \"Sheet: ${SHEETPATH}\" (name \"\") (pos 109 17))\n"
|
||||
"(tbtext \"${COMPANY}\" (name \"\") (pos 109 20) (font bold) (comment \"Company name\"))\n"
|
||||
"(tbtext \"${COMMENT1}\" (name \"\") (pos 109 23) (comment \"Comment 0\"))\n"
|
||||
"(tbtext \"${COMMENT2}\" (name \"\") (pos 109 26) (comment \"Comment 1\"))\n"
|
||||
|
|
|
@ -167,7 +167,7 @@ wxString convertLegacyVariableRefs( const wxString& aTextbase )
|
|||
case 'N': msg += wxT( "${##}" ); break;
|
||||
case 'F': msg += wxT( "${FILENAME}" ); break;
|
||||
case 'L': msg += wxT( "${LAYER}" ); break;
|
||||
case 'P': msg += wxT( "${SHEETNAME}" ); break;
|
||||
case 'P': msg += wxT( "${SHEETPATH}" ); break;
|
||||
case 'Y': msg += wxT( "${COMPANY}" ); break;
|
||||
case 'T': msg += wxT( "${TITLE}" ); break;
|
||||
case 'C':
|
||||
|
|
|
@ -100,6 +100,7 @@ void DS_DRAW_ITEM_LIST::GetTextVars( wxArrayString* aVars )
|
|||
aVars->push_back( wxT( "#" ) );
|
||||
aVars->push_back( wxT( "##" ) );
|
||||
aVars->push_back( wxT( "SHEETNAME" ) );
|
||||
aVars->push_back( wxT( "SHEETPATH" ) );
|
||||
aVars->push_back( wxT( "FILENAME" ) );
|
||||
aVars->push_back( wxT( "PAPER" ) );
|
||||
aVars->push_back( wxT( "LAYER" ) );
|
||||
|
@ -139,7 +140,12 @@ wxString DS_DRAW_ITEM_LIST::BuildFullText( const wxString& aTextbase )
|
|||
}
|
||||
else if( token->IsSameAs( wxT( "SHEETNAME" ) ) )
|
||||
{
|
||||
*token = m_sheetFullName;
|
||||
*token = m_sheetName;
|
||||
tokenUpdated = true;
|
||||
}
|
||||
else if( token->IsSameAs( wxT( "SHEETPATH" ) ) )
|
||||
{
|
||||
*token = m_sheetPath;
|
||||
tokenUpdated = true;
|
||||
}
|
||||
else if( token->IsSameAs( wxT( "FILENAME" ) ) )
|
||||
|
|
|
@ -74,6 +74,7 @@ void DS_PROXY_VIEW_ITEM::buildDrawList( VIEW* aView, DS_DRAW_ITEM_LIST* aDrawLis
|
|||
RENDER_SETTINGS* settings = aView->GetPainter()->GetSettings();
|
||||
wxString fileName( m_fileName.c_str(), wxConvUTF8 );
|
||||
wxString sheetName( m_sheetName.c_str(), wxConvUTF8 );
|
||||
wxString sheetPath( m_sheetPath.c_str(), wxConvUTF8 );
|
||||
|
||||
aDrawList->SetDefaultPenSize( (int) settings->GetDrawingSheetLineWidth() );
|
||||
// Adjust the scaling factor: drawing sheet item coordinates and sizes are stored in mils,
|
||||
|
@ -84,6 +85,7 @@ void DS_PROXY_VIEW_ITEM::buildDrawList( VIEW* aView, DS_DRAW_ITEM_LIST* aDrawLis
|
|||
aDrawList->SetSheetCount( m_sheetCount );
|
||||
aDrawList->SetFileName( fileName );
|
||||
aDrawList->SetSheetName( sheetName );
|
||||
aDrawList->SetSheetPath( sheetPath );
|
||||
aDrawList->SetProject( m_project );
|
||||
|
||||
aDrawList->BuildDrawItemsList( *m_pageInfo, *m_titleBlock );
|
||||
|
|
|
@ -59,7 +59,8 @@ wxString GetDefaultPlotExtension( PLOT_FORMAT aFormat )
|
|||
|
||||
void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BLOCK& aTitleBlock,
|
||||
const PAGE_INFO& aPageInfo, const wxString& aSheetNumber, int aSheetCount,
|
||||
const wxString& aSheetDesc, const wxString& aFilename, COLOR4D aColor,
|
||||
const wxString& aSheetName, const wxString& aSheetPath,
|
||||
const wxString& aFilename, COLOR4D aColor,
|
||||
bool aIsFirstPage )
|
||||
{
|
||||
/* Note: Page sizes values are given in mils
|
||||
|
@ -83,7 +84,8 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
|
|||
drawList.SetPageNumber( aSheetNumber );
|
||||
drawList.SetSheetCount( aSheetCount );
|
||||
drawList.SetFileName( fn.GetFullName() ); // Print only the short filename
|
||||
drawList.SetSheetName( aSheetDesc );
|
||||
drawList.SetSheetName( aSheetName );
|
||||
drawList.SetSheetPath( aSheetPath );
|
||||
drawList.SetProject( aProject );
|
||||
drawList.SetIsFirstPage( aIsFirstPage );
|
||||
|
||||
|
|
|
@ -568,9 +568,12 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetDXF( const wxString& aFileName,
|
|||
|
||||
if( aPlotFrameRef )
|
||||
{
|
||||
wxString sheetName = m_parent->GetCurrentSheet().Last()->GetName();
|
||||
wxString sheetPath = m_parent->GetCurrentSheet().PathHumanReadable();
|
||||
|
||||
PlotDrawingSheet( plotter, &m_parent->Prj(), m_parent->GetTitleBlock(), pageInfo,
|
||||
aScreen->GetPageNumber(), aScreen->GetPageCount(),
|
||||
m_parent->GetScreenDesc(), aScreen->GetFileName(),
|
||||
sheetName, sheetPath, aScreen->GetFileName(),
|
||||
plotter->GetColorMode() ?
|
||||
plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_DRAWINGSHEET ) :
|
||||
COLOR4D::BLACK, aScreen->GetVirtualPageNumber() == 1 );
|
||||
|
@ -756,9 +759,12 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetHpgl( const wxString& aFileName,
|
|||
|
||||
if( aPlotFrameRef )
|
||||
{
|
||||
wxString sheetName = m_parent->GetCurrentSheet().Last()->GetName();
|
||||
wxString sheetPath = m_parent->GetCurrentSheet().PathHumanReadable();
|
||||
|
||||
PlotDrawingSheet( plotter, &m_parent->Prj(), m_parent->GetTitleBlock(), aPageInfo,
|
||||
aScreen->GetPageNumber(), aScreen->GetPageCount(),
|
||||
m_parent->GetScreenDesc(), aScreen->GetFileName(), COLOR4D::BLACK,
|
||||
aScreen->GetPageNumber(), aScreen->GetPageCount(), sheetName, sheetPath,
|
||||
aScreen->GetFileName(), COLOR4D::BLACK,
|
||||
aScreen->GetVirtualPageNumber() == 1 );
|
||||
}
|
||||
|
||||
|
@ -904,9 +910,12 @@ void DIALOG_PLOT_SCHEMATIC::plotOneSheetPDF( PLOTTER* aPlotter, SCH_SCREEN* aScr
|
|||
if( aPlotter->GetColorMode() )
|
||||
color = aPlotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_DRAWINGSHEET );
|
||||
|
||||
wxString sheetName = m_parent->GetCurrentSheet().Last()->GetName();
|
||||
wxString sheetPath = m_parent->GetCurrentSheet().PathHumanReadable();
|
||||
|
||||
PlotDrawingSheet( aPlotter, &aScreen->Schematic()->Prj(), m_parent->GetTitleBlock(),
|
||||
m_parent->GetPageSettings(), aScreen->GetPageNumber(),
|
||||
aScreen->GetPageCount(), m_parent->GetScreenDesc(),
|
||||
aScreen->GetPageCount(), sheetName, sheetPath,
|
||||
aScreen->GetFileName(), color, aScreen->GetVirtualPageNumber() == 1 );
|
||||
}
|
||||
|
||||
|
@ -1089,9 +1098,12 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName,
|
|||
|
||||
if( aPlotFrameRef )
|
||||
{
|
||||
wxString sheetName = m_parent->GetCurrentSheet().Last()->GetName();
|
||||
wxString sheetPath = m_parent->GetCurrentSheet().PathHumanReadable();
|
||||
|
||||
PlotDrawingSheet( plotter, &aScreen->Schematic()->Prj(), m_parent->GetTitleBlock(),
|
||||
aPageInfo, aScreen->GetPageNumber(), aScreen->GetPageCount(),
|
||||
m_parent->GetScreenDesc(), aScreen->GetFileName(),
|
||||
sheetName, sheetPath, aScreen->GetFileName(),
|
||||
plotter->GetColorMode() ?
|
||||
plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_DRAWINGSHEET ) :
|
||||
COLOR4D::BLACK, aScreen->GetVirtualPageNumber() == 1 );
|
||||
|
@ -1219,9 +1231,12 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG( const wxString& aFileName,
|
|||
|
||||
if( aPlotFrameRef )
|
||||
{
|
||||
wxString sheetName = m_parent->GetCurrentSheet().Last()->GetName();
|
||||
wxString sheetPath = m_parent->GetCurrentSheet().PathHumanReadable();
|
||||
|
||||
PlotDrawingSheet( plotter, &aScreen->Schematic()->Prj(), m_parent->GetTitleBlock(),
|
||||
pageInfo, aScreen->GetPageNumber(), aScreen->GetPageCount(),
|
||||
m_parent->GetScreenDesc(), aScreen->GetFileName(),
|
||||
sheetName, sheetPath, aScreen->GetFileName(),
|
||||
plotter->GetColorMode() ?
|
||||
plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_DRAWINGSHEET ) :
|
||||
COLOR4D::BLACK, aScreen->GetVirtualPageNumber() == 1 );
|
||||
|
|
|
@ -222,6 +222,7 @@ void SCH_SHEET::GetContextualTextVars( wxArrayString* aVars ) const
|
|||
|
||||
aVars->push_back( wxT( "#" ) );
|
||||
aVars->push_back( wxT( "##" ) );
|
||||
aVars->push_back( wxT( "SHEETPATH" ) );
|
||||
m_screen->GetTitleBlock().GetContextualTextVars( aVars );
|
||||
}
|
||||
|
||||
|
@ -272,6 +273,11 @@ bool SCH_SHEET::ResolveTextVar( wxString* token, int aDepth ) const
|
|||
*token = wxString::Format( wxT( "%d" ), (int) sheetList.size() );
|
||||
return true;
|
||||
}
|
||||
else if( token->IsSameAs( wxT( "SHEETPATH" ) ) )
|
||||
{
|
||||
*token = Schematic()->CurrentSheet().PathHumanReadable();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <sch_screen.h>
|
||||
#include <schematic.h>
|
||||
#include <sch_base_frame.h>
|
||||
#include <sch_edit_frame.h>
|
||||
|
||||
#include "sch_view.h"
|
||||
|
||||
|
@ -106,9 +107,18 @@ void SCH_VIEW::DisplaySheet( const SCH_SCREEN *aScreen )
|
|||
m_drawingSheet->SetIsFirstPage( aScreen->GetVirtualPageNumber() == 1 );
|
||||
|
||||
if( m_frame && m_frame->IsType( FRAME_SCH ) )
|
||||
m_drawingSheet->SetSheetName( TO_UTF8( m_frame->GetScreenDesc() ) );
|
||||
{
|
||||
SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
|
||||
wxString sheetName = editFrame->GetCurrentSheet().Last()->GetName();
|
||||
wxString sheetPath = editFrame->GetCurrentSheet().PathHumanReadable();
|
||||
m_drawingSheet->SetSheetName( TO_UTF8( sheetName ) );
|
||||
m_drawingSheet->SetSheetPath( TO_UTF8( sheetPath ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_drawingSheet->SetSheetName( "" );
|
||||
m_drawingSheet->SetSheetPath( "" );
|
||||
}
|
||||
|
||||
ResizeSheetWorkingArea( aScreen );
|
||||
|
||||
|
|
|
@ -134,11 +134,16 @@ bool SCHEMATIC::ResolveTextVar( wxString* token, int aDepth ) const
|
|||
*token = wxString::Format( "%i", Root().CountSheets() );
|
||||
return true;
|
||||
}
|
||||
else if( token->IsSameAs( wxT( "SHEETNAME" ) ) )
|
||||
else if( token->IsSameAs( wxT( "SHEETPATH" ) ) )
|
||||
{
|
||||
*token = CurrentSheet().PathHumanReadable();
|
||||
return true;
|
||||
}
|
||||
else if( token->IsSameAs( wxT( "SHEETNAME" ) ) )
|
||||
{
|
||||
*token = CurrentSheet().Last()->GetName();
|
||||
return true;
|
||||
}
|
||||
else if( token->IsSameAs( wxT( "FILENAME" ) ) )
|
||||
{
|
||||
wxFileName fn( GetFileName() );
|
||||
|
|
|
@ -428,7 +428,15 @@ public:
|
|||
*/
|
||||
void SetSheetName( const wxString& aSheetName )
|
||||
{
|
||||
m_sheetFullName = aSheetName;
|
||||
m_sheetName = aSheetName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the sheet path to draw/plot
|
||||
*/
|
||||
void SetSheetPath( const wxString& aSheetPath )
|
||||
{
|
||||
m_sheetPath = aSheetPath;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -526,7 +534,8 @@ public:
|
|||
* SetSheetNumber( aSheetNumber );
|
||||
* SetSheetCount( aSheetCount );
|
||||
* SetFileName( aFileName );
|
||||
* SetSheetName( aFullSheetName );
|
||||
* SetSheetName( aSheetName );
|
||||
* SetSheetPath( aSheetPath );
|
||||
*
|
||||
* @param aPageInfo The PAGE_INFO, for page size, margins...
|
||||
* @param aTitleBlock The sheet title block, for basic inscriptions.
|
||||
|
@ -579,7 +588,8 @@ protected:
|
|||
const TITLE_BLOCK* m_titleBlock; // for basic inscriptions
|
||||
const wxString* m_paperFormat; // for basic inscriptions
|
||||
wxString m_fileName; // for basic inscriptions
|
||||
wxString m_sheetFullName; // for basic inscriptions
|
||||
wxString m_sheetName; // for basic inscriptions
|
||||
wxString m_sheetPath; // for basic inscriptions
|
||||
wxString m_pageNumber; ///< The actual page number displayed in the title block.
|
||||
const wxString* m_sheetLayer; // for basic inscriptions
|
||||
const PROJECT* m_project; // for project-based variable substitutions
|
||||
|
|
|
@ -60,6 +60,11 @@ public:
|
|||
*/
|
||||
void SetSheetName( const std::string& aSheetName ) { m_sheetName = aSheetName; }
|
||||
|
||||
/**
|
||||
* Set the sheet path displayed in the title block.
|
||||
*/
|
||||
void SetSheetPath( const std::string& aSheetPath ) { m_sheetPath = aSheetPath; }
|
||||
|
||||
/**
|
||||
* Changes the page number displayed in the title block.
|
||||
*/
|
||||
|
@ -132,6 +137,7 @@ protected:
|
|||
|
||||
std::string m_fileName;
|
||||
std::string m_sheetName;
|
||||
std::string m_sheetPath;
|
||||
const TITLE_BLOCK* m_titleBlock;
|
||||
const PAGE_INFO* m_pageInfo;
|
||||
std::string m_pageNumber;
|
||||
|
|
|
@ -620,8 +620,9 @@ class TITLE_BLOCK;
|
|||
|
||||
void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BLOCK& aTitleBlock,
|
||||
const PAGE_INFO& aPageInfo, const wxString& aSheetNumber, int aSheetCount,
|
||||
const wxString& aSheetDesc, const wxString& aFilename,
|
||||
COLOR4D aColor = COLOR4D::UNSPECIFIED, bool aIsFirstPage = true );
|
||||
const wxString& aSheetName, const wxString& aSheetPath,
|
||||
const wxString& aFilename, COLOR4D aColor = COLOR4D::UNSPECIFIED,
|
||||
bool aIsFirstPage = true );
|
||||
|
||||
/** Returns the default plot extension for a format
|
||||
*/
|
||||
|
|
|
@ -593,6 +593,7 @@ void PROPERTIES_FRAME::onHelp( wxCommandEvent& aEvent )
|
|||
message << "PAPER " << _( "(paper size)" ) << "\n";
|
||||
message << "REVISION\n";
|
||||
message << "SHEETNAME\n";
|
||||
message << "SHEETPATH\n";
|
||||
message << "TITLE\n";
|
||||
|
||||
dlg.ListSet( message );
|
||||
|
|
|
@ -355,8 +355,11 @@ bool DIALOG_EXPORT_SVG::CreateSVGFile( const wxString& aFullFileName )
|
|||
|
||||
LOCALE_IO toggle;
|
||||
|
||||
//@todo allow controlling the sheet name and path that will be displayed in the title block
|
||||
// Leave blank for now
|
||||
SVG_PLOTTER* plotter = (SVG_PLOTTER*) StartPlotBoard( m_board, &plot_opts, UNDEFINED_LAYER,
|
||||
aFullFileName, wxEmptyString );
|
||||
aFullFileName, wxEmptyString,
|
||||
wxEmptyString );
|
||||
|
||||
if( plotter )
|
||||
{
|
||||
|
|
|
@ -1031,8 +1031,10 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
|
|||
|
||||
LOCALE_IO toggle;
|
||||
|
||||
//@todo allow controlling the sheet name and path that will be displayed in the title block
|
||||
// Leave blank for now
|
||||
PLOTTER* plotter = StartPlotBoard( board, &m_plotOpts, layer, fn.GetFullPath(),
|
||||
wxEmptyString );
|
||||
wxEmptyString, wxEmptyString );
|
||||
|
||||
// Print diags in messages box:
|
||||
wxString msg;
|
||||
|
|
|
@ -425,7 +425,7 @@ void PLOT_CONTROLLER::ClosePlot()
|
|||
|
||||
|
||||
bool PLOT_CONTROLLER::OpenPlotfile( const wxString& aSuffix, PLOT_FORMAT aFormat,
|
||||
const wxString& aSheetDesc )
|
||||
const wxString& aSheetName, const wxString& aSheetPath )
|
||||
{
|
||||
LOCALE_IO toggle;
|
||||
|
||||
|
@ -472,7 +472,7 @@ bool PLOT_CONTROLLER::OpenPlotfile( const wxString& aSuffix, PLOT_FORMAT aFormat
|
|||
BuildPlotFileName( &m_plotFile, outputDir.GetPath(), aSuffix, fileExt );
|
||||
|
||||
m_plotter = StartPlotBoard( m_board, &GetPlotOptions(), ToLAYER_ID( GetLayer() ),
|
||||
m_plotFile.GetFullPath(), aSheetDesc );
|
||||
m_plotFile.GetFullPath(), aSheetName, aSheetPath );
|
||||
}
|
||||
|
||||
return ( m_plotter != nullptr );
|
||||
|
|
|
@ -142,8 +142,10 @@ private:
|
|||
LSET m_layerMask;
|
||||
};
|
||||
|
||||
|
||||
PLOTTER* StartPlotBoard( BOARD* aBoard, const PCB_PLOT_PARAMS* aPlotOpts, int aLayer,
|
||||
const wxString& aFullFileName, const wxString& aSheetDesc );
|
||||
const wxString& aFullFileName, const wxString& aSheetName,
|
||||
const wxString& aSheetPath );
|
||||
|
||||
/**
|
||||
* Plot a sequence of board layer IDs.
|
||||
|
|
|
@ -1088,7 +1088,8 @@ static void ConfigureHPGLPenSizes( HPGL_PLOTTER *aPlotter, const PCB_PLOT_PARAMS
|
|||
* @return the plotter object if OK, NULL if the file is not created (or has a problem).
|
||||
*/
|
||||
PLOTTER* StartPlotBoard( BOARD *aBoard, const PCB_PLOT_PARAMS *aPlotOpts, int aLayer,
|
||||
const wxString& aFullFileName, const wxString& aSheetDesc )
|
||||
const wxString& aFullFileName, const wxString& aSheetName,
|
||||
const wxString& aSheetPath )
|
||||
{
|
||||
// Create the plotter driver and set the few plotter specific options
|
||||
PLOTTER* plotter = nullptr;
|
||||
|
@ -1176,7 +1177,7 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, const PCB_PLOT_PARAMS *aPlotOpts, int aL
|
|||
if( aPlotOpts->GetPlotFrameRef() )
|
||||
{
|
||||
PlotDrawingSheet( plotter, aBoard->GetProject(), aBoard->GetTitleBlock(),
|
||||
aBoard->GetPageSettings(), wxT( "1" ), 1, aSheetDesc,
|
||||
aBoard->GetPageSettings(), wxT( "1" ), 1, aSheetName, aSheetPath,
|
||||
aBoard->GetFileName() );
|
||||
|
||||
if( aPlotOpts->GetMirror() )
|
||||
|
|
|
@ -76,8 +76,12 @@ public:
|
|||
* @param aSuffix is a string added to the base filename (derived from
|
||||
* the board filename) to identify the plot file.
|
||||
* @param aFormat is the plot file format identifier.
|
||||
* @param aSheetName is the text to be displayed in the title block that replaces ${SHEETNAME}
|
||||
* @param aSheetPath is the text to be displayed in the title block that replaces ${SHEETPATH}
|
||||
*/
|
||||
bool OpenPlotfile( const wxString& aSuffix, PLOT_FORMAT aFormat, const wxString& aSheetDesc );
|
||||
bool OpenPlotfile( const wxString& aSuffix, PLOT_FORMAT aFormat,
|
||||
const wxString& aSheetName = wxEmptyString,
|
||||
const wxString& aSheetPath = wxEmptyString );
|
||||
|
||||
/**
|
||||
* Plot a single layer on the current plotfile m_plotLayer is the layer to plot.
|
||||
|
|
Loading…
Reference in New Issue