pl_editor:make the option "show formatted texts" working.

This commit is contained in:
jean-pierre charras 2019-06-15 18:15:29 +02:00
parent 77643fe9b6
commit 12a4a38507
4 changed files with 33 additions and 7 deletions

View File

@ -111,11 +111,13 @@ wxString WS_DRAW_ITEM_LIST::BuildFullText( const wxString& aTextbase )
break;
case 'D':
msg += m_titleBlock->GetDate();
if( m_titleBlock )
msg += m_titleBlock->GetDate();
break;
case 'R':
msg += m_titleBlock->GetRevision();
if( m_titleBlock )
msg += m_titleBlock->GetRevision();
break;
case 'K':
@ -153,11 +155,13 @@ wxString WS_DRAW_ITEM_LIST::BuildFullText( const wxString& aTextbase )
break;
case 'Y':
msg += m_titleBlock->GetCompany();
if( m_titleBlock )
msg += m_titleBlock->GetCompany();
break;
case 'T':
msg += m_titleBlock->GetTitle();
if( m_titleBlock )
msg += m_titleBlock->GetTitle();
break;
case 'C':
@ -174,7 +178,8 @@ wxString WS_DRAW_ITEM_LIST::BuildFullText( const wxString& aTextbase )
case '7':
case '8':
case '9':
msg += m_titleBlock->GetComment( format - '0');
if( m_titleBlock )
msg += m_titleBlock->GetComment( format - '0');
break;
default:

View File

@ -55,7 +55,11 @@ public:
double m_DefaultLineWidth; // Used when object line width is 0
DSIZE m_DefaultTextSize; // Used when object text size is 0
double m_DefaultTextThickness; // Used when object text stroke width is 0
bool m_EditMode; // Used in page layout editor to toggle variable substition
bool m_EditMode; // Used in page layout editor to toggle variable substution
// In normal mode (m_EditMode = false) the %format is
// replaced by the corresponding text.
// In edit mode (m_EditMode = true) the %format is
// displayed "as this"
public:
WS_DATA_MODEL();

View File

@ -388,6 +388,16 @@ public:
// delete item;
}
/**
* Set the title block (mainly for page layout editor)
*/
void SetTitleBlock( const TITLE_BLOCK* aTblock ) { m_titleBlock = aTblock; }
/**
* Set the paper format name (mainly for page layout editor)
*/
void SetPaperFormat( const wxString* aFormatName ) { m_paperFormat = aFormatName; }
/**
* Set the filename to draw/plot
*/

View File

@ -85,11 +85,18 @@ void PL_DRAW_PANEL_GAL::DisplayWorksheet()
model.SetupDrawEnvironment( m_edaFrame->GetPageSettings(), Mils2iu( 1 ) );
// To show the formatted texts instead of raw texts in page layout editor, we need
// a dummy WS_DRAW_ITEM_LIST.
WS_DRAW_ITEM_LIST dummy;
dummy.SetPaperFormat( &m_edaFrame->GetPageSettings().GetType() );
dummy.SetTitleBlock( &m_edaFrame->GetTitleBlock() );
for( WS_DATA_ITEM* dataItem : model.GetItems() )
dataItem->SyncDrawItems( nullptr, m_view );
dataItem->SyncDrawItems( &dummy, m_view );
// Build and add a WS_DRAW_ITEM_PAGE to show the page limits and the corner position
// of the selected corner for coord origin of new items
// Not also this item has no peer in WS_DATA_MODEL list.
const int penWidth = 0; // This value is to use the default thickness line
constexpr double markerSize = Millimeter2iu( 5 );
WS_DRAW_ITEM_PAGE* pageDrawing = new WS_DRAW_ITEM_PAGE( penWidth, markerSize );