Allow text variable resolution through properties in drawing sheet text.
Fixes https://gitlab.com/kicad/code/kicad/issues/12473
This commit is contained in:
parent
bbaf5a21c2
commit
7f34586c7e
|
@ -674,8 +674,8 @@ void DIALOG_PAGES_SETTINGS::UpdateDrawingSheetExample()
|
|||
GRFilledRect( &memDC, VECTOR2I( 0, 0 ), m_layout_size, 0, bgColor, bgColor );
|
||||
|
||||
PrintDrawingSheet( &renderSettings, pageDUMMY, emptyString, emptyString, m_tb,
|
||||
m_screen->GetPageCount(), m_screen->GetPageNumber(), 1, &Prj(),
|
||||
wxEmptyString, m_screen->GetVirtualPageNumber() == 1 );
|
||||
nullptr, m_screen->GetPageCount(), m_screen->GetPageNumber(), 1,
|
||||
&Prj(), wxEmptyString, m_screen->GetVirtualPageNumber() == 1 );
|
||||
|
||||
memDC.SelectObject( wxNullBitmap );
|
||||
m_PageLayoutExampleBitmap->SetBitmap( *m_pageBitmap );
|
||||
|
|
|
@ -108,8 +108,8 @@ void DS_DRAW_ITEM_LIST::GetTextVars( wxArrayString* aVars )
|
|||
}
|
||||
|
||||
|
||||
// returns the full text corresponding to the aTextbase,
|
||||
// after replacing format symbols by the corresponding value
|
||||
// Returns the full text corresponding to the aTextbase, after replacing any text variable
|
||||
// references.
|
||||
wxString DS_DRAW_ITEM_LIST::BuildFullText( const wxString& aTextbase )
|
||||
{
|
||||
std::function<bool( wxString* )> wsResolver =
|
||||
|
@ -166,9 +166,15 @@ wxString DS_DRAW_ITEM_LIST::BuildFullText( const wxString& aTextbase )
|
|||
}
|
||||
else if( m_titleBlock )
|
||||
{
|
||||
// no need for tokenUpdated; TextVarResolver() did a full resolve
|
||||
// no need for tokenUpdated; TITLE_BLOCK::TextVarResolver() does a full
|
||||
// resolve
|
||||
return m_titleBlock->TextVarResolver( token, m_project );
|
||||
}
|
||||
else if( m_properties && m_properties->count( *token ) )
|
||||
{
|
||||
*token = m_properties->at( *token );
|
||||
tokenUpdated = true;
|
||||
}
|
||||
|
||||
if( tokenUpdated )
|
||||
{
|
||||
|
|
|
@ -35,7 +35,8 @@
|
|||
using namespace KIGFX;
|
||||
|
||||
DS_PROXY_VIEW_ITEM::DS_PROXY_VIEW_ITEM( int aMils2IUscalefactor, const PAGE_INFO* aPageInfo,
|
||||
const PROJECT* aProject, const TITLE_BLOCK* aTitleBlock ) :
|
||||
const PROJECT* aProject, const TITLE_BLOCK* aTitleBlock,
|
||||
const std::map<wxString, wxString>* aProperties ) :
|
||||
EDA_ITEM( NOT_USED ), // this item is never added to a BOARD so it needs no type
|
||||
m_mils2IUscalefactor( aMils2IUscalefactor ),
|
||||
m_titleBlock( aTitleBlock ),
|
||||
|
@ -44,6 +45,7 @@ DS_PROXY_VIEW_ITEM::DS_PROXY_VIEW_ITEM( int aMils2IUscalefactor, const PAGE_INFO
|
|||
m_sheetCount( 1 ),
|
||||
m_isFirstPage( false ),
|
||||
m_project( aProject ),
|
||||
m_properties( aProperties ),
|
||||
m_colorLayer( LAYER_DRAWINGSHEET ),
|
||||
m_pageBorderColorLayer( LAYER_PAGE_LIMITS )
|
||||
{
|
||||
|
@ -69,7 +71,9 @@ const BOX2I DS_PROXY_VIEW_ITEM::ViewBBox() const
|
|||
}
|
||||
|
||||
|
||||
void DS_PROXY_VIEW_ITEM::buildDrawList( VIEW* aView, DS_DRAW_ITEM_LIST* aDrawList ) const
|
||||
void DS_PROXY_VIEW_ITEM::buildDrawList( VIEW* aView,
|
||||
const std::map<wxString, wxString>* aProperties,
|
||||
DS_DRAW_ITEM_LIST* aDrawList ) const
|
||||
{
|
||||
RENDER_SETTINGS* settings = aView->GetPainter()->GetSettings();
|
||||
wxString fileName( m_fileName.c_str(), wxConvUTF8 );
|
||||
|
@ -88,6 +92,7 @@ void DS_PROXY_VIEW_ITEM::buildDrawList( VIEW* aView, DS_DRAW_ITEM_LIST* aDrawLis
|
|||
aDrawList->SetSheetPath( sheetPath );
|
||||
aDrawList->SetSheetLayer( settings->GetLayerName() );
|
||||
aDrawList->SetProject( m_project );
|
||||
aDrawList->SetProperties( aProperties );
|
||||
|
||||
aDrawList->BuildDrawItemsList( *m_pageInfo, *m_titleBlock );
|
||||
}
|
||||
|
@ -99,7 +104,7 @@ void DS_PROXY_VIEW_ITEM::ViewDraw( int aLayer, VIEW* aView ) const
|
|||
RENDER_SETTINGS* settings = aView->GetPainter()->GetSettings();
|
||||
DS_DRAW_ITEM_LIST drawList;
|
||||
|
||||
buildDrawList( aView, &drawList );
|
||||
buildDrawList( aView, m_properties, &drawList );
|
||||
|
||||
// Draw the title block normally even if the view is flipped
|
||||
bool flipped = gal->IsFlippedX();
|
||||
|
@ -144,7 +149,7 @@ bool DS_PROXY_VIEW_ITEM::HitTestDrawingSheetItems( VIEW* aView, const VECTOR2I&
|
|||
int accuracy = (int) aView->ToWorld( 5.0 ); // five pixels at current zoom
|
||||
DS_DRAW_ITEM_LIST drawList;
|
||||
|
||||
buildDrawList( aView, &drawList );
|
||||
buildDrawList( aView, m_properties, &drawList );
|
||||
|
||||
for( DS_DRAW_ITEM_BASE* item = drawList.GetFirst(); item; item = drawList.GetNext() )
|
||||
{
|
||||
|
|
|
@ -957,7 +957,8 @@ static const wxString productName = wxT( "KiCad E.D.A. " );
|
|||
|
||||
void PrintDrawingSheet( const RENDER_SETTINGS* aSettings, const PAGE_INFO& aPageInfo,
|
||||
const wxString& aFullSheetName, const wxString& aFileName,
|
||||
const TITLE_BLOCK& aTitleBlock, int aSheetCount,
|
||||
const TITLE_BLOCK& aTitleBlock,
|
||||
const std::map<wxString, wxString>* aProperties, int aSheetCount,
|
||||
const wxString& aPageNumber, double aMils2Iu, const PROJECT* aProject,
|
||||
const wxString& aSheetLayer, bool aIsFirstPage )
|
||||
{
|
||||
|
@ -972,6 +973,7 @@ void PrintDrawingSheet( const RENDER_SETTINGS* aSettings, const PAGE_INFO& aPage
|
|||
drawList.SetSheetLayer( aSheetLayer );
|
||||
drawList.SetProject( aProject );
|
||||
drawList.SetIsFirstPage( aIsFirstPage );
|
||||
drawList.SetProperties( aProperties );
|
||||
|
||||
drawList.BuildDrawItemsList( aPageInfo, aTitleBlock );
|
||||
|
||||
|
@ -981,6 +983,7 @@ void PrintDrawingSheet( const RENDER_SETTINGS* aSettings, const PAGE_INFO& aPage
|
|||
|
||||
|
||||
void EDA_DRAW_FRAME::PrintDrawingSheet( const RENDER_SETTINGS* aSettings, BASE_SCREEN* aScreen,
|
||||
const std::map<wxString, wxString>* aProperties,
|
||||
double aMils2Iu, const wxString &aFilename,
|
||||
const wxString &aSheetLayer )
|
||||
{
|
||||
|
@ -997,8 +1000,8 @@ void EDA_DRAW_FRAME::PrintDrawingSheet( const RENDER_SETTINGS* aSettings, BASE_S
|
|||
}
|
||||
|
||||
::PrintDrawingSheet( aSettings, GetPageSettings(), GetScreenDesc(), aFilename, GetTitleBlock(),
|
||||
aScreen->GetPageCount(), aScreen->GetPageNumber(), aMils2Iu, &Prj(),
|
||||
aSheetLayer, aScreen->GetVirtualPageNumber() == 1 );
|
||||
aProperties, aScreen->GetPageCount(), aScreen->GetPageNumber(), aMils2Iu,
|
||||
&Prj(), aSheetLayer, aScreen->GetVirtualPageNumber() == 1 );
|
||||
|
||||
if( origin.y > 0 )
|
||||
{
|
||||
|
|
|
@ -58,9 +58,9 @@ 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& aSheetName, const wxString& aSheetPath,
|
||||
const wxString& aFilename, COLOR4D aColor,
|
||||
const PAGE_INFO& aPageInfo, const std::map<wxString, wxString>* aProperties,
|
||||
const wxString& aSheetNumber, int aSheetCount, const wxString& aSheetName,
|
||||
const wxString& aSheetPath, const wxString& aFilename, COLOR4D aColor,
|
||||
bool aIsFirstPage )
|
||||
{
|
||||
/* Note: Page sizes values are given in mils
|
||||
|
@ -89,6 +89,7 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
|
|||
drawList.SetSheetLayer( plotter->RenderSettings()->GetLayerName() );
|
||||
drawList.SetProject( aProject );
|
||||
drawList.SetIsFirstPage( aIsFirstPage );
|
||||
drawList.SetProperties( aProperties );
|
||||
|
||||
drawList.BuildDrawItemsList( aPageInfo, aTitleBlock );
|
||||
|
||||
|
|
|
@ -576,13 +576,13 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetDXF( const wxString& aFileName,
|
|||
{
|
||||
wxString sheetName = m_parent->GetCurrentSheet().Last()->GetName();
|
||||
wxString sheetPath = m_parent->GetCurrentSheet().PathHumanReadable();
|
||||
COLOR4D color = plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_DRAWINGSHEET );
|
||||
|
||||
PlotDrawingSheet( plotter, &m_parent->Prj(), m_parent->GetTitleBlock(), pageInfo,
|
||||
aScreen->GetPageNumber(), aScreen->GetPageCount(),
|
||||
sheetName, sheetPath, aScreen->GetFileName(),
|
||||
plotter->GetColorMode() ?
|
||||
plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_DRAWINGSHEET ) :
|
||||
COLOR4D::BLACK, aScreen->GetVirtualPageNumber() == 1 );
|
||||
aScreen->Schematic()->GetProperties(), aScreen->GetPageNumber(),
|
||||
aScreen->GetPageCount(), sheetName, sheetPath, aScreen->GetFileName(),
|
||||
plotter->GetColorMode() ? color : COLOR4D::BLACK,
|
||||
aScreen->GetVirtualPageNumber() == 1 );
|
||||
}
|
||||
|
||||
aScreen->Plot( plotter );
|
||||
|
@ -769,9 +769,9 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetHpgl( const wxString& aFileName,
|
|||
wxString sheetPath = m_parent->GetCurrentSheet().PathHumanReadable();
|
||||
|
||||
PlotDrawingSheet( plotter, &m_parent->Prj(), m_parent->GetTitleBlock(), aPageInfo,
|
||||
aScreen->GetPageNumber(), aScreen->GetPageCount(), sheetName, sheetPath,
|
||||
aScreen->GetFileName(), COLOR4D::BLACK,
|
||||
aScreen->GetVirtualPageNumber() == 1 );
|
||||
aScreen->Schematic()->GetProperties(), aScreen->GetPageNumber(),
|
||||
aScreen->GetPageCount(), sheetName, sheetPath, aScreen->GetFileName(),
|
||||
COLOR4D::BLACK, aScreen->GetVirtualPageNumber() == 1 );
|
||||
}
|
||||
|
||||
aScreen->Plot( plotter );
|
||||
|
@ -923,8 +923,8 @@ void DIALOG_PLOT_SCHEMATIC::plotOneSheetPDF( PLOTTER* aPlotter, SCH_SCREEN* aScr
|
|||
wxString sheetPath = m_parent->GetCurrentSheet().PathHumanReadable();
|
||||
|
||||
PlotDrawingSheet( aPlotter, &aScreen->Schematic()->Prj(), m_parent->GetTitleBlock(),
|
||||
m_parent->GetPageSettings(), aScreen->GetPageNumber(),
|
||||
aScreen->GetPageCount(), sheetName, sheetPath,
|
||||
m_parent->GetPageSettings(), aScreen->Schematic()->GetProperties(),
|
||||
aScreen->GetPageNumber(), aScreen->GetPageCount(), sheetName, sheetPath,
|
||||
aScreen->GetFileName(), color, aScreen->GetVirtualPageNumber() == 1 );
|
||||
}
|
||||
|
||||
|
@ -1110,13 +1110,13 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName,
|
|||
{
|
||||
wxString sheetName = m_parent->GetCurrentSheet().Last()->GetName();
|
||||
wxString sheetPath = m_parent->GetCurrentSheet().PathHumanReadable();
|
||||
COLOR4D color = plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_DRAWINGSHEET );
|
||||
|
||||
PlotDrawingSheet( plotter, &aScreen->Schematic()->Prj(), m_parent->GetTitleBlock(),
|
||||
aPageInfo, aScreen->GetPageNumber(), aScreen->GetPageCount(),
|
||||
sheetName, sheetPath, aScreen->GetFileName(),
|
||||
plotter->GetColorMode() ?
|
||||
plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_DRAWINGSHEET ) :
|
||||
COLOR4D::BLACK, aScreen->GetVirtualPageNumber() == 1 );
|
||||
aPageInfo, aScreen->Schematic()->GetProperties(), aScreen->GetPageNumber(),
|
||||
aScreen->GetPageCount(), sheetName, sheetPath, aScreen->GetFileName(),
|
||||
plotter->GetColorMode() ? color : COLOR4D::BLACK,
|
||||
aScreen->GetVirtualPageNumber() == 1 );
|
||||
}
|
||||
|
||||
aScreen->Plot( plotter );
|
||||
|
@ -1243,13 +1243,13 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG( const wxString& aFileName,
|
|||
{
|
||||
wxString sheetName = m_parent->GetCurrentSheet().Last()->GetName();
|
||||
wxString sheetPath = m_parent->GetCurrentSheet().PathHumanReadable();
|
||||
COLOR4D color = plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_DRAWINGSHEET );
|
||||
|
||||
PlotDrawingSheet( plotter, &aScreen->Schematic()->Prj(), m_parent->GetTitleBlock(),
|
||||
pageInfo, aScreen->GetPageNumber(), aScreen->GetPageCount(),
|
||||
sheetName, sheetPath, aScreen->GetFileName(),
|
||||
plotter->GetColorMode() ?
|
||||
plotter->RenderSettings()->GetLayerColor( LAYER_SCHEMATIC_DRAWINGSHEET ) :
|
||||
COLOR4D::BLACK, aScreen->GetVirtualPageNumber() == 1 );
|
||||
pageInfo, aScreen->Schematic()->GetProperties(), aScreen->GetPageNumber(),
|
||||
aScreen->GetPageCount(), sheetName, sheetPath, aScreen->GetFileName(),
|
||||
plotter->GetColorMode() ? color : COLOR4D::BLACK,
|
||||
aScreen->GetVirtualPageNumber() == 1 );
|
||||
}
|
||||
|
||||
aScreen->Plot( plotter );
|
||||
|
|
|
@ -501,8 +501,8 @@ void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen )
|
|||
|
||||
if( printReference )
|
||||
{
|
||||
m_parent->PrintDrawingSheet( &renderSettings, aScreen, schIUScale.IU_PER_MILS, aScreen->GetFileName(),
|
||||
wxEmptyString );
|
||||
m_parent->PrintDrawingSheet( &renderSettings, aScreen, aScreen->Schematic()->GetProperties(),
|
||||
schIUScale.IU_PER_MILS, aScreen->GetFileName(), wxEmptyString );
|
||||
}
|
||||
|
||||
renderSettings.SetIsPrinting( true );
|
||||
|
|
|
@ -250,7 +250,8 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
|
|||
m_page->SetHeightMils( 5000 );
|
||||
m_page->SetWidthMils( 6000 );
|
||||
|
||||
m_drawingSheet = new DS_PROXY_VIEW_ITEM( (int) schIUScale.IU_PER_MILS, m_page, nullptr, m_titleBlock );
|
||||
m_drawingSheet = new DS_PROXY_VIEW_ITEM( (int) schIUScale.IU_PER_MILS, m_page, nullptr,
|
||||
m_titleBlock, nullptr );
|
||||
m_drawingSheet->SetColorLayer( LAYER_SCHEMATIC_DRAWINGSHEET );
|
||||
m_drawingSheet->SetPageBorderColorLayer( LAYER_SCHEMATIC_PAGE_LIMITS );
|
||||
view->Add( m_drawingSheet );
|
||||
|
|
|
@ -1276,7 +1276,8 @@ void SCH_EDIT_FRAME::PrintPage( const RENDER_SETTINGS* aSettings )
|
|||
|
||||
aSettings->GetPrintDC()->SetLogicalFunction( wxCOPY );
|
||||
GetScreen()->Print( aSettings );
|
||||
PrintDrawingSheet( aSettings, GetScreen(), schIUScale.IU_PER_MILS, fileName );
|
||||
PrintDrawingSheet( aSettings, GetScreen(), Schematic().GetProperties(), schIUScale.IU_PER_MILS,
|
||||
fileName );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -97,7 +97,8 @@ void SCH_VIEW::DisplaySheet( const SCH_SCREEN *aScreen )
|
|||
m_drawingSheet.reset( new DS_PROXY_VIEW_ITEM( static_cast<int>( schIUScale.IU_PER_MILS ),
|
||||
&aScreen->GetPageSettings(),
|
||||
&aScreen->Schematic()->Prj(),
|
||||
&aScreen->GetTitleBlock() ) );
|
||||
&aScreen->GetTitleBlock(),
|
||||
aScreen->Schematic()->GetProperties() ) );
|
||||
m_drawingSheet->SetPageNumber( TO_UTF8( aScreen->GetPageNumber() ) );
|
||||
m_drawingSheet->SetSheetCount( aScreen->GetPageCount() );
|
||||
m_drawingSheet->SetFileName( TO_UTF8( aScreen->GetFileName() ) );
|
||||
|
|
|
@ -72,13 +72,11 @@ public:
|
|||
void Reset();
|
||||
|
||||
/// Return a reference to the project this schematic is part of
|
||||
PROJECT& Prj() const override
|
||||
{
|
||||
return *m_project;
|
||||
}
|
||||
|
||||
PROJECT& Prj() const override { return *m_project; }
|
||||
void SetProject( PROJECT* aPrj );
|
||||
|
||||
const std::map<wxString, wxString>* GetProperties() { return &m_properties; }
|
||||
|
||||
/**
|
||||
* Builds and returns an updated schematic hierarchy
|
||||
* TODO: can this be cached?
|
||||
|
@ -209,6 +207,11 @@ private:
|
|||
* used for updating global label intersheet references.
|
||||
*/
|
||||
std::map<wxString, std::set<int>> m_labelToPageRefsMap;
|
||||
|
||||
/**
|
||||
* Properties for text variable substitution (and perhaps other uses in future).
|
||||
*/
|
||||
std::map<wxString, wxString> m_properties;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -825,8 +825,9 @@ void GERBVIEW_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
|
|||
GERBVIEW_DRAW_PANEL_GAL* drawPanel = static_cast<GERBVIEW_DRAW_PANEL_GAL*>( GetCanvas() );
|
||||
|
||||
// Prepare drawing-sheet template
|
||||
DS_PROXY_VIEW_ITEM* drawingSheet = new DS_PROXY_VIEW_ITEM( gerbIUScale.IU_PER_MILS, &GetPageSettings(),
|
||||
&Prj(), &GetTitleBlock() );
|
||||
DS_PROXY_VIEW_ITEM* drawingSheet = new DS_PROXY_VIEW_ITEM( gerbIUScale.IU_PER_MILS,
|
||||
&GetPageSettings(), &Prj(),
|
||||
&GetTitleBlock(), nullptr );
|
||||
|
||||
if( GetScreen() )
|
||||
{
|
||||
|
|
|
@ -394,6 +394,7 @@ public:
|
|||
m_paperFormat = nullptr;
|
||||
m_project = nullptr;
|
||||
m_isFirstPage = true;
|
||||
m_properties = nullptr;
|
||||
}
|
||||
|
||||
~DS_DRAW_ITEM_LIST()
|
||||
|
@ -410,6 +411,11 @@ public:
|
|||
*/
|
||||
void SetTitleBlock( const TITLE_BLOCK* aTblock ) { m_titleBlock = aTblock; }
|
||||
|
||||
/**
|
||||
* Set properties used for text variable resolution.
|
||||
*/
|
||||
void SetProperties( const std::map<wxString, wxString>* aProps ) { m_properties = aProps; }
|
||||
|
||||
/**
|
||||
* Set the paper format name (mainly for drawing sheet editor)
|
||||
*/
|
||||
|
@ -547,31 +553,8 @@ public:
|
|||
static void GetTextVars( wxArrayString* aVars );
|
||||
|
||||
/**
|
||||
* Return the full text corresponding to the aTextbase,
|
||||
* after replacing format symbols by the corresponding value
|
||||
*
|
||||
* Basic texts in Ki_WorkSheetData struct use format notation
|
||||
* like "Title %T" to identify at run time the full text
|
||||
* to display.
|
||||
* Currently format identifier is % followed by a letter or 2 letters
|
||||
*
|
||||
* %% = replaced by %
|
||||
* %K = Kicad version
|
||||
* %Z = paper format name (A4, USLetter)
|
||||
* %Y = company name
|
||||
* %D = date
|
||||
* %R = revision
|
||||
* %S = sheet number
|
||||
* %N = number of sheets
|
||||
* %Cx = comment (x = 0 to 9 to identify the comment)
|
||||
* %F = filename
|
||||
* %P = sheet path or sheet full name
|
||||
* %T = title
|
||||
* Other fields like Developer, Verifier, Approver could use %Cx
|
||||
* and are seen as comments for format
|
||||
*
|
||||
* @param aTextbase = the text with format symbols
|
||||
* @return the text, after replacing the format symbols by the actual value
|
||||
* @return the full text corresponding to the aTextbase, after replacing any text variable
|
||||
* references.
|
||||
*/
|
||||
wxString BuildFullText( const wxString& aTextbase );
|
||||
|
||||
|
@ -584,15 +567,17 @@ protected:
|
|||
// used when an item has a pen size = 0
|
||||
bool m_isFirstPage; ///< Is this the first page or not.
|
||||
int m_sheetCount; ///< The number of sheets
|
||||
// for basic inscriptions, in schematic
|
||||
const TITLE_BLOCK* m_titleBlock; // for basic inscriptions
|
||||
const wxString* m_paperFormat; // for basic inscriptions
|
||||
wxString m_fileName; // for basic inscriptions
|
||||
wxString m_sheetName; // for basic inscriptions
|
||||
wxString m_sheetPath; // for basic inscriptions
|
||||
// for text variable references, in schematic
|
||||
const TITLE_BLOCK* m_titleBlock; // for text variable references
|
||||
const wxString* m_paperFormat; // for text variable references
|
||||
wxString m_fileName; // for text variable references
|
||||
wxString m_sheetName; // for text variable references
|
||||
wxString m_sheetPath; // for text variable references
|
||||
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
|
||||
const wxString* m_sheetLayer; // for text variable references
|
||||
const PROJECT* m_project; // for project-based text variable references
|
||||
|
||||
const std::map<wxString, wxString>* m_properties; // for text variable references
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -131,8 +131,9 @@ private:
|
|||
* @param aPageInfo for margins and page size (in mils).
|
||||
* @param aFullSheetName The sheetpath (full sheet name), for basic inscriptions.
|
||||
* @param aFileName The file name, for basic inscriptions.
|
||||
* @param aTitleBlock The sheet title block, for basic inscriptions.
|
||||
* @param aSheetCount The number of sheets (for basic inscriptions).
|
||||
* @param aTitleBlock The sheet title block, for text variable resolution.
|
||||
* @param aProperties Optional properties for text variable resolution.
|
||||
* @param aSheetCount The number of sheets (for text variable resolution).
|
||||
* @param aPageNumber The page number.
|
||||
* @param aScalar the scale factor to convert from mils to internal units.
|
||||
* @param aSheetLayer The layer from Pcbnew.
|
||||
|
@ -145,7 +146,8 @@ private:
|
|||
*/
|
||||
void PrintDrawingSheet( const RENDER_SETTINGS* aSettings, const PAGE_INFO& aPageInfo,
|
||||
const wxString& aFullSheetName, const wxString& aFileName,
|
||||
const TITLE_BLOCK& aTitleBlock, int aSheetCount,
|
||||
const TITLE_BLOCK& aTitleBlock,
|
||||
const std::map<wxString, wxString>* aProperties, int aSheetCount,
|
||||
const wxString& aPageNumber, double aScalar, const PROJECT* aProject,
|
||||
const wxString& aSheetLayer = wxEmptyString, bool aIsFirstPage = true );
|
||||
|
||||
|
|
|
@ -48,7 +48,8 @@ class DS_PROXY_VIEW_ITEM : public EDA_ITEM
|
|||
{
|
||||
public:
|
||||
DS_PROXY_VIEW_ITEM( int aScaleFactor, const PAGE_INFO* aPageInfo, const PROJECT* aProject,
|
||||
const TITLE_BLOCK* aTitleBlock );
|
||||
const TITLE_BLOCK* aTitleBlock,
|
||||
const std::map<wxString, wxString>* aProperties );
|
||||
|
||||
/**
|
||||
* Set the file name displayed in the title block.
|
||||
|
@ -129,7 +130,8 @@ public:
|
|||
bool HitTestDrawingSheetItems( KIGFX::VIEW* aView, const VECTOR2I& aPosition );
|
||||
|
||||
protected:
|
||||
void buildDrawList( KIGFX::VIEW* aView, DS_DRAW_ITEM_LIST* aDrawList ) const;
|
||||
void buildDrawList( KIGFX::VIEW* aView, const std::map<wxString, wxString>* aProperties,
|
||||
DS_DRAW_ITEM_LIST* aDrawList ) const;
|
||||
|
||||
/// the factor between mils (units used in drawing sheet and internal units)
|
||||
/// it is the value IU_PER_MILS used in the caller
|
||||
|
@ -145,6 +147,8 @@ protected:
|
|||
bool m_isFirstPage;
|
||||
const PROJECT* m_project;
|
||||
|
||||
const std::map<wxString, wxString>* m_properties;
|
||||
|
||||
/// Layer that is used for drawing sheet color (LAYER_DRAWINGSHEET is always used for visibility)
|
||||
int m_colorLayer;
|
||||
|
||||
|
|
|
@ -304,13 +304,14 @@ public:
|
|||
* Prints the drawing-sheet (frame and title block).
|
||||
*
|
||||
* @param aScreen screen to draw.
|
||||
* @param aProperties Optional properties for text variable resolution.
|
||||
* @param aMils2Iu The mils to Iu conversion factor.
|
||||
* @param aFilename The filename to display in basic inscriptions.
|
||||
* @param aSheetLayer The layer displayed from PcbNew.
|
||||
*/
|
||||
void PrintDrawingSheet( const RENDER_SETTINGS* aSettings, BASE_SCREEN* aScreen,
|
||||
double aMils2Iu, const wxString& aFilename,
|
||||
const wxString& aSheetLayer = wxEmptyString );
|
||||
const std::map<wxString, wxString>* aProperties, double aMils2Iu,
|
||||
const wxString& aFilename, const wxString& aSheetLayer = wxEmptyString );
|
||||
|
||||
void DisplayToolMsg( const wxString& msg ) override;
|
||||
|
||||
|
|
|
@ -641,10 +641,10 @@ protected: // variables used in most of plotters:
|
|||
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& aSheetName, const wxString& aSheetPath,
|
||||
const wxString& aFilename, COLOR4D aColor = COLOR4D::UNSPECIFIED,
|
||||
bool aIsFirstPage = true );
|
||||
const PAGE_INFO& aPageInfo, const std::map<wxString, wxString>*aProperties,
|
||||
const wxString& aSheetNumber, int aSheetCount, const wxString& aSheetName,
|
||||
const wxString& aSheetPath, const wxString& aFilename,
|
||||
COLOR4D aColor = COLOR4D::UNSPECIFIED, bool aIsFirstPage = true );
|
||||
|
||||
/** Returns the default plot extension for a format
|
||||
*/
|
||||
|
|
|
@ -203,7 +203,8 @@ void PLEDITOR_PRINTOUT::PrintPage( int aPageNum )
|
|||
}
|
||||
}
|
||||
|
||||
m_parent->PrintDrawingSheet( &renderSettings, screen, drawSheetIUScale.IU_PER_MILS, wxEmptyString );
|
||||
m_parent->PrintDrawingSheet( &renderSettings, screen, nullptr, drawSheetIUScale.IU_PER_MILS,
|
||||
wxEmptyString );
|
||||
|
||||
m_parent->SetDrawBgColor( bg_color );
|
||||
|
||||
|
|
|
@ -777,7 +777,8 @@ void PL_EDITOR_FRAME::PrintPage( const RENDER_SETTINGS* aSettings )
|
|||
}
|
||||
}
|
||||
|
||||
PrintDrawingSheet( aSettings, GetScreen(), drawSheetIUScale.IU_PER_MILS, wxEmptyString );
|
||||
PrintDrawingSheet( aSettings, GetScreen(), nullptr, drawSheetIUScale.IU_PER_MILS,
|
||||
wxEmptyString );
|
||||
|
||||
GetCanvas()->DisplayDrawingSheet();
|
||||
GetCanvas()->Refresh();
|
||||
|
|
|
@ -502,8 +502,8 @@ void PANEL_PCBNEW_COLOR_SETTINGS::createPreviewItems()
|
|||
m_preview->UpdateColors();
|
||||
m_preview->DisplayBoard( m_preview->GetBoard() );
|
||||
|
||||
DS_PROXY_VIEW_ITEM* drawingSheet = new DS_PROXY_VIEW_ITEM( (int) pcbIUScale.IU_PER_MILS, m_page, nullptr,
|
||||
m_titleBlock );
|
||||
DS_PROXY_VIEW_ITEM* drawingSheet = new DS_PROXY_VIEW_ITEM( (int) pcbIUScale.IU_PER_MILS, m_page,
|
||||
nullptr, m_titleBlock, nullptr );
|
||||
drawingSheet->SetIsFirstPage( true );
|
||||
drawingSheet->SetColorLayer( LAYER_DRAWINGSHEET );
|
||||
drawingSheet->SetPageBorderColorLayer( LAYER_PAGE_LIMITS );
|
||||
|
|
|
@ -532,8 +532,11 @@ void PCB_EDIT_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
|
|||
DS_PROXY_VIEW_ITEM* drawingSheet = new DS_PROXY_VIEW_ITEM( pcbIUScale.IU_PER_MILS,
|
||||
&m_pcb->GetPageSettings(),
|
||||
m_pcb->GetProject(),
|
||||
&m_pcb->GetTitleBlock() );
|
||||
&m_pcb->GetTitleBlock(),
|
||||
&m_pcb->GetProperties() );
|
||||
|
||||
drawingSheet->SetSheetName( std::string( GetScreenDesc().mb_str() ) );
|
||||
|
||||
// A board is not like a schematic having a main page and sub sheets.
|
||||
// So for the drawing sheet, use only the first page option to display items
|
||||
drawingSheet->SetIsFirstPage( true );
|
||||
|
|
|
@ -1215,8 +1215,8 @@ 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, aSheetName, aSheetPath,
|
||||
aBoard->GetFileName() );
|
||||
aBoard->GetPageSettings(), &aBoard->GetProperties(), wxT( "1" ), 1,
|
||||
aSheetName, aSheetPath, aBoard->GetFileName() );
|
||||
|
||||
if( aPlotOpts->GetMirror() )
|
||||
initializePlotter( plotter, aBoard, aPlotOpts );
|
||||
|
|
Loading…
Reference in New Issue