From 6b9e44e59cb5b7b38200c9ebc1ba5fee78130407 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 2 May 2021 08:54:16 +0200 Subject: [PATCH] pl_editor: save comment associated to DS_DATA_ITEM graphic items. The editor has an entry to set a comment associated to a graphic item. It is only for the designer, but the code to save it in .wks file when not empty was missing. The code to read it exists since the beginning, so no change in file format --- common/drawing_sheet/ds_data_model_io.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/common/drawing_sheet/ds_data_model_io.cpp b/common/drawing_sheet/ds_data_model_io.cpp index acda9e9fce..b5e9071f0b 100644 --- a/common/drawing_sheet/ds_data_model_io.cpp +++ b/common/drawing_sheet/ds_data_model_io.cpp @@ -305,6 +305,9 @@ void DS_DATA_MODEL_IO::format( DS_DATA_ITEM_TEXT* aItem, int aNestLevel ) const formatRepeatParameters( aItem ); + if( !aItem->m_Info.IsEmpty() ) + m_out->Print( 0, " (comment %s)\n", m_out->Quotew( aItem->m_Info ).c_str() ); + m_out->Print( 0, ")\n" ); } @@ -327,6 +330,9 @@ void DS_DATA_MODEL_IO::format( DS_DATA_MODEL* aModel, DS_DATA_ITEM* aItem, int a formatRepeatParameters( aItem ); + if( !aItem->m_Info.IsEmpty() ) + m_out->Print( 0, " (comment %s)\n", m_out->Quotew( aItem->m_Info ).c_str() ); + m_out->Print( 0, ")\n" ); } @@ -348,6 +354,9 @@ void DS_DATA_MODEL_IO::format( DS_DATA_ITEM_POLYGONS* aItem, int aNestLevel ) co if( aItem->m_LineWidth ) m_out->Print( 0, " (linewidth %s)\n", double2Str( aItem->m_LineWidth ).c_str() ); + if( !aItem->m_Info.IsEmpty() ) + m_out->Print( 0, " (comment %s)\n", m_out->Quotew( aItem->m_Info ).c_str() ); + // Write polygon corners list for( int kk = 0; kk < aItem->GetPolyCount(); kk++ ) { @@ -395,6 +404,9 @@ void DS_DATA_MODEL_IO::format( DS_DATA_ITEM_BITMAP* aItem, int aNestLevel ) cons formatRepeatParameters( aItem ); m_out->Print( 0,"\n"); + if( !aItem->m_Info.IsEmpty() ) + m_out->Print( 0, " (comment %s)\n", m_out->Quotew( aItem->m_Info ).c_str() ); + // Write image in png readable format m_out->Print( aNestLevel, "(%s\n", getTokenName( T_pngdata ) ); wxArrayString pngStrings;