Naming conventions.
This commit is contained in:
parent
436ad0ede7
commit
f6287053e5
|
@ -253,7 +253,7 @@ set( COMMON_DRAWING_SHEET_SRCS
|
|||
drawing_sheet/ds_draw_item.cpp
|
||||
drawing_sheet/ds_proxy_undo_item.cpp
|
||||
drawing_sheet/ds_proxy_view_item.cpp
|
||||
drawing_sheet/drawing_sheet_reader.cpp
|
||||
drawing_sheet/drawing_sheet_parser.cpp
|
||||
)
|
||||
|
||||
set( COMMON_PREVIEW_ITEMS_SRCS
|
||||
|
@ -669,10 +669,10 @@ make_lexer(
|
|||
# and title_block_reader_keywords.cpp.
|
||||
make_lexer(
|
||||
common
|
||||
drawing_sheet/drawing_sheet_reader.keywords
|
||||
drawing_sheet/drawing_sheet_reader_lexer.h
|
||||
drawing_sheet/drawing_sheet_reader_keywords.cpp
|
||||
TB_READER_T
|
||||
drawing_sheet/drawing_sheet.keywords
|
||||
drawing_sheet/drawing_sheet_lexer.h
|
||||
drawing_sheet/drawing_sheet_keywords.cpp
|
||||
DRAWINGSHEET_T
|
||||
)
|
||||
|
||||
# This one gets made only when testing.
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* keyword used in drawing sheet are listed in drawing_sheet_reader.keywords file
|
||||
* keyword used in drawing sheet are listed in drawing_sheet.keywords file
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
|
@ -23,32 +23,28 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <wx/ffile.h>
|
||||
#include <wx/log.h>
|
||||
#include <eda_item.h>
|
||||
#include <locale_io.h>
|
||||
#include <string_utils.h>
|
||||
#include <drawing_sheet/ds_data_item.h>
|
||||
#include <drawing_sheet/ds_data_model.h>
|
||||
#include <drawing_sheet/ds_draw_item.h>
|
||||
#include <drawing_sheet/ds_painter.h>
|
||||
#include <drawing_sheet/drawing_sheet_reader_lexer.h>
|
||||
#include <wx/ffile.h>
|
||||
#include <wx/log.h>
|
||||
#include <drawing_sheet/drawing_sheet_lexer.h>
|
||||
#include <drawing_sheet/ds_file_versions.h>
|
||||
|
||||
#include <wx/file.h>
|
||||
#include <wx/mstream.h>
|
||||
|
||||
|
||||
using namespace TB_READER_T;
|
||||
using namespace DRAWINGSHEET_T;
|
||||
|
||||
/**
|
||||
* DRAWING_SHEET_READER_PARSER
|
||||
* DRAWING_SHEET_PARSER
|
||||
* holds data and functions pertinent to parsing a S-expression file
|
||||
* for a DS_DATA_MODEL.
|
||||
*/
|
||||
class DRAWING_SHEET_READER_PARSER : public DRAWING_SHEET_READER_LEXER
|
||||
class DRAWING_SHEET_PARSER : public DRAWING_SHEET_LEXER
|
||||
{
|
||||
public:
|
||||
DRAWING_SHEET_READER_PARSER( const char* aLine, const wxString& aSource );
|
||||
DRAWING_SHEET_PARSER( const char* aLine, const wxString& aSource );
|
||||
void Parse( DS_DATA_MODEL* aLayout );
|
||||
|
||||
private:
|
||||
|
@ -117,9 +113,9 @@ private:
|
|||
|
||||
// PCB_PLOT_PARAMS_PARSER
|
||||
|
||||
DRAWING_SHEET_READER_PARSER::DRAWING_SHEET_READER_PARSER( const char* aLine,
|
||||
const wxString& aSource ) :
|
||||
DRAWING_SHEET_READER_LEXER( aLine, aSource ),
|
||||
DRAWING_SHEET_PARSER::DRAWING_SHEET_PARSER( const char* aLine,
|
||||
const wxString& aSource ) :
|
||||
DRAWING_SHEET_LEXER( aLine, aSource ),
|
||||
m_requiredVersion( 0 )
|
||||
{
|
||||
}
|
||||
|
@ -199,7 +195,7 @@ wxString convertLegacyVariableRefs( const wxString& aTextbase )
|
|||
}
|
||||
|
||||
|
||||
void DRAWING_SHEET_READER_PARSER::Parse( DS_DATA_MODEL* aLayout )
|
||||
void DRAWING_SHEET_PARSER::Parse( DS_DATA_MODEL* aLayout )
|
||||
{
|
||||
DS_DATA_ITEM* item;
|
||||
LOCALE_IO toggle;
|
||||
|
@ -259,13 +255,13 @@ void DRAWING_SHEET_READER_PARSER::Parse( DS_DATA_MODEL* aLayout )
|
|||
}
|
||||
}
|
||||
|
||||
void DRAWING_SHEET_READER_PARSER::parseHeader( T aHeaderType )
|
||||
void DRAWING_SHEET_PARSER::parseHeader( T aHeaderType )
|
||||
{
|
||||
// The older files had no versioning and their first token after the initial left parenthesis
|
||||
// was a `page_layout` or `drawing_sheet` token. The newer files have versions and have a
|
||||
// `kicad_wks` token instead.
|
||||
|
||||
if( aHeaderType == T_kicad_wks )
|
||||
if( aHeaderType == T_kicad_wks || aHeaderType == T_drawing_sheet )
|
||||
{
|
||||
NeedLEFT();
|
||||
|
||||
|
@ -274,6 +270,10 @@ void DRAWING_SHEET_READER_PARSER::parseHeader( T aHeaderType )
|
|||
if( tok == T_version )
|
||||
{
|
||||
m_requiredVersion = parseInt();
|
||||
|
||||
if( m_requiredVersion > SEXPR_WORKSHEET_FILE_VERSION )
|
||||
throw FUTURE_FORMAT_ERROR( FromUTF8() );
|
||||
|
||||
NeedRIGHT();
|
||||
}
|
||||
else
|
||||
|
@ -296,7 +296,7 @@ void DRAWING_SHEET_READER_PARSER::parseHeader( T aHeaderType )
|
|||
}
|
||||
}
|
||||
|
||||
void DRAWING_SHEET_READER_PARSER::parseSetup( DS_DATA_MODEL* aLayout )
|
||||
void DRAWING_SHEET_PARSER::parseSetup( DS_DATA_MODEL* aLayout )
|
||||
{
|
||||
for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
|
||||
{
|
||||
|
@ -353,7 +353,7 @@ void DRAWING_SHEET_READER_PARSER::parseSetup( DS_DATA_MODEL* aLayout )
|
|||
}
|
||||
|
||||
|
||||
void DRAWING_SHEET_READER_PARSER::parsePolygon( DS_DATA_ITEM_POLYGONS * aItem )
|
||||
void DRAWING_SHEET_PARSER::parsePolygon( DS_DATA_ITEM_POLYGONS * aItem )
|
||||
{
|
||||
for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
|
||||
{
|
||||
|
@ -421,7 +421,7 @@ void DRAWING_SHEET_READER_PARSER::parsePolygon( DS_DATA_ITEM_POLYGONS * aItem )
|
|||
aItem->SetBoundingBox();
|
||||
}
|
||||
|
||||
void DRAWING_SHEET_READER_PARSER::parsePolyOutline( DS_DATA_ITEM_POLYGONS * aItem )
|
||||
void DRAWING_SHEET_PARSER::parsePolyOutline( DS_DATA_ITEM_POLYGONS * aItem )
|
||||
{
|
||||
DPOINT corner;
|
||||
|
||||
|
@ -447,7 +447,7 @@ void DRAWING_SHEET_READER_PARSER::parsePolyOutline( DS_DATA_ITEM_POLYGONS * aIte
|
|||
}
|
||||
|
||||
|
||||
void DRAWING_SHEET_READER_PARSER::parseBitmap( DS_DATA_ITEM_BITMAP * aItem )
|
||||
void DRAWING_SHEET_PARSER::parseBitmap( DS_DATA_ITEM_BITMAP * aItem )
|
||||
{
|
||||
BITMAP_BASE* image = new BITMAP_BASE;
|
||||
aItem->m_ImageBitmap = image;
|
||||
|
@ -509,7 +509,7 @@ void DRAWING_SHEET_READER_PARSER::parseBitmap( DS_DATA_ITEM_BITMAP * aItem )
|
|||
}
|
||||
}
|
||||
|
||||
void DRAWING_SHEET_READER_PARSER::readPngdata( DS_DATA_ITEM_BITMAP * aItem )
|
||||
void DRAWING_SHEET_PARSER::readPngdata( DS_DATA_ITEM_BITMAP * aItem )
|
||||
{
|
||||
std::string tmp;
|
||||
|
||||
|
@ -543,7 +543,7 @@ void DRAWING_SHEET_READER_PARSER::readPngdata( DS_DATA_ITEM_BITMAP * aItem )
|
|||
}
|
||||
|
||||
|
||||
void DRAWING_SHEET_READER_PARSER::readOption( DS_DATA_ITEM * aItem )
|
||||
void DRAWING_SHEET_PARSER::readOption( DS_DATA_ITEM * aItem )
|
||||
{
|
||||
for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
|
||||
{
|
||||
|
@ -557,7 +557,7 @@ void DRAWING_SHEET_READER_PARSER::readOption( DS_DATA_ITEM * aItem )
|
|||
}
|
||||
|
||||
|
||||
void DRAWING_SHEET_READER_PARSER::parseGraphic( DS_DATA_ITEM * aItem )
|
||||
void DRAWING_SHEET_PARSER::parseGraphic( DS_DATA_ITEM * aItem )
|
||||
{
|
||||
for( T token = NextTok(); token != T_RIGHT && token != EOF; token = NextTok() )
|
||||
{
|
||||
|
@ -627,7 +627,7 @@ void DRAWING_SHEET_READER_PARSER::parseGraphic( DS_DATA_ITEM * aItem )
|
|||
}
|
||||
|
||||
|
||||
void DRAWING_SHEET_READER_PARSER::parseText( DS_DATA_ITEM_TEXT* aItem )
|
||||
void DRAWING_SHEET_PARSER::parseText( DS_DATA_ITEM_TEXT* aItem )
|
||||
{
|
||||
if( m_requiredVersion < 20210606 )
|
||||
aItem->m_TextBase = ConvertToNewOverbarNotation( aItem->m_TextBase );
|
||||
|
@ -769,7 +769,7 @@ void DRAWING_SHEET_READER_PARSER::parseText( DS_DATA_ITEM_TEXT* aItem )
|
|||
}
|
||||
|
||||
// parse an expression like " 25 1 ltcorner)"
|
||||
void DRAWING_SHEET_READER_PARSER::parseCoordinate( POINT_COORD& aCoord)
|
||||
void DRAWING_SHEET_PARSER::parseCoordinate( POINT_COORD& aCoord)
|
||||
{
|
||||
aCoord.m_Pos.x = parseDouble();
|
||||
aCoord.m_Pos.y = parseDouble();
|
||||
|
@ -787,7 +787,7 @@ void DRAWING_SHEET_READER_PARSER::parseCoordinate( POINT_COORD& aCoord)
|
|||
}
|
||||
}
|
||||
|
||||
int DRAWING_SHEET_READER_PARSER::parseInt()
|
||||
int DRAWING_SHEET_PARSER::parseInt()
|
||||
{
|
||||
T token = NextTok();
|
||||
|
||||
|
@ -797,7 +797,7 @@ int DRAWING_SHEET_READER_PARSER::parseInt()
|
|||
return atoi( CurText() );
|
||||
}
|
||||
|
||||
int DRAWING_SHEET_READER_PARSER::parseInt( int aMin, int aMax )
|
||||
int DRAWING_SHEET_PARSER::parseInt( int aMin, int aMax )
|
||||
{
|
||||
int val = parseInt();
|
||||
|
||||
|
@ -810,7 +810,7 @@ int DRAWING_SHEET_READER_PARSER::parseInt( int aMin, int aMax )
|
|||
}
|
||||
|
||||
|
||||
double DRAWING_SHEET_READER_PARSER::parseDouble()
|
||||
double DRAWING_SHEET_PARSER::parseDouble()
|
||||
{
|
||||
T token = NextTok();
|
||||
|
||||
|
@ -857,7 +857,7 @@ void DS_DATA_MODEL::SetPageLayout( const char* aPageLayout, bool Append, const w
|
|||
if( ! Append )
|
||||
ClearList();
|
||||
|
||||
DRAWING_SHEET_READER_PARSER lp_parser( aPageLayout, wxT( "Sexpr_string" ) );
|
||||
DRAWING_SHEET_PARSER lp_parser( aPageLayout, wxT( "Sexpr_string" ) );
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -920,7 +920,7 @@ bool DS_DATA_MODEL::LoadDrawingSheet( const wxString& aFullFileName, bool Append
|
|||
if( ! Append )
|
||||
ClearList();
|
||||
|
||||
DRAWING_SHEET_READER_PARSER pl_parser( buffer.get(), fullFileName );
|
||||
DRAWING_SHEET_PARSER pl_parser( buffer.get(), fullFileName );
|
||||
|
||||
try
|
||||
{
|
|
@ -29,22 +29,21 @@
|
|||
#include <macros.h>
|
||||
#include <math/vector2d.h>
|
||||
#include <drawing_sheet/ds_painter.h>
|
||||
#include <drawing_sheet/ds_draw_item.h>
|
||||
#include <drawing_sheet/ds_data_item.h>
|
||||
#include <drawing_sheet/ds_data_model.h>
|
||||
#include <drawing_sheet/drawing_sheet_reader_lexer.h>
|
||||
#include <drawing_sheet/drawing_sheet_lexer.h>
|
||||
#include <drawing_sheet/ds_file_versions.h>
|
||||
|
||||
#include <wx/msgdlg.h>
|
||||
|
||||
using namespace TB_READER_T;
|
||||
using namespace DRAWINGSHEET_T;
|
||||
|
||||
#define double2Str Double2Str
|
||||
|
||||
// A helper function to write tokens:
|
||||
static const char* getTokenName( T aTok )
|
||||
{
|
||||
return DRAWING_SHEET_READER_LEXER::TokenName( aTok );
|
||||
return DRAWING_SHEET_LEXER::TokenName( aTok );
|
||||
}
|
||||
|
||||
// A basic helper class to write a drawing sheet file
|
||||
|
@ -53,7 +52,7 @@ static const char* getTokenName( T aTok )
|
|||
class DS_DATA_MODEL_IO
|
||||
{
|
||||
public:
|
||||
void Format( DS_DATA_MODEL* aDrawingSheet ) const;
|
||||
void Format( DS_DATA_MODEL* aSheet ) const;
|
||||
|
||||
void Format( DS_DATA_MODEL* aModel, DS_DATA_ITEM* aItem, int aNestLevel ) const;
|
||||
|
||||
|
@ -186,7 +185,7 @@ void DS_DATA_MODEL_IO::Format( DS_DATA_MODEL* aModel, DS_DATA_ITEM* aItem, int a
|
|||
}
|
||||
|
||||
|
||||
void DS_DATA_MODEL_IO::Format( DS_DATA_MODEL* aDrawingSheet ) const
|
||||
void DS_DATA_MODEL_IO::Format( DS_DATA_MODEL* aSheet ) const
|
||||
{
|
||||
LOCALE_IO toggle; // switch on/off the locale "C" notation
|
||||
|
||||
|
@ -196,32 +195,26 @@ void DS_DATA_MODEL_IO::Format( DS_DATA_MODEL* aDrawingSheet ) const
|
|||
// Setup
|
||||
int nestLevel = 1;
|
||||
// Write default values:
|
||||
m_out->Print( nestLevel, "(%s ", getTokenName( T_setup ) );
|
||||
m_out->Print( nestLevel, "(setup " );
|
||||
m_out->Print( 0, "(textsize %s %s)",
|
||||
double2Str( aDrawingSheet->m_DefaultTextSize.x ).c_str(),
|
||||
double2Str( aDrawingSheet->m_DefaultTextSize.y ).c_str() );
|
||||
m_out->Print( 0, "(linewidth %s)",
|
||||
double2Str( aDrawingSheet->m_DefaultLineWidth ).c_str() );
|
||||
m_out->Print( 0, "(textlinewidth %s)",
|
||||
double2Str( aDrawingSheet->m_DefaultTextThickness ).c_str() );
|
||||
double2Str( aSheet->m_DefaultTextSize.x ).c_str(),
|
||||
double2Str( aSheet->m_DefaultTextSize.y ).c_str() );
|
||||
m_out->Print( 0, "(linewidth %s)", double2Str( aSheet->m_DefaultLineWidth ).c_str() );
|
||||
m_out->Print( 0, "(textlinewidth %s)", double2Str( aSheet->m_DefaultTextThickness ).c_str() );
|
||||
m_out->Print( 0, "\n" );
|
||||
|
||||
// Write margin values
|
||||
m_out->Print( nestLevel, "(%s %s)", getTokenName( T_left_margin ),
|
||||
double2Str( aDrawingSheet->GetLeftMargin() ).c_str() );
|
||||
m_out->Print( 0, "(%s %s)", getTokenName( T_right_margin ),
|
||||
double2Str( aDrawingSheet->GetRightMargin() ).c_str() );
|
||||
m_out->Print( 0, "(%s %s)", getTokenName( T_top_margin ),
|
||||
double2Str( aDrawingSheet->GetTopMargin() ).c_str() );
|
||||
m_out->Print( 0, "(%s %s)", getTokenName( T_bottom_margin ),
|
||||
double2Str( aDrawingSheet->GetBottomMargin() ).c_str() );
|
||||
m_out->Print( nestLevel, "(left_margin %s)", double2Str( aSheet->GetLeftMargin() ).c_str() );
|
||||
m_out->Print( 0, "(right_margin %s)", double2Str( aSheet->GetRightMargin() ).c_str() );
|
||||
m_out->Print( 0, "(top_margin %s)", double2Str( aSheet->GetTopMargin() ).c_str() );
|
||||
m_out->Print( 0, "(bottom_margin %s)", double2Str( aSheet->GetBottomMargin() ).c_str() );
|
||||
m_out->Print( 0, ")\n" );
|
||||
|
||||
// Save the graphical items on the drawing sheet
|
||||
for( unsigned ii = 0; ii < aDrawingSheet->GetCount(); ii++ )
|
||||
for( unsigned ii = 0; ii < aSheet->GetCount(); ii++ )
|
||||
{
|
||||
DS_DATA_ITEM* item = aDrawingSheet->GetItem( ii );
|
||||
Format( aDrawingSheet, item, nestLevel );
|
||||
DS_DATA_ITEM* item = aSheet->GetItem( ii );
|
||||
Format( aSheet, item, nestLevel );
|
||||
}
|
||||
|
||||
m_out->Print( 0, ")\n" );
|
||||
|
@ -230,17 +223,15 @@ void DS_DATA_MODEL_IO::Format( DS_DATA_MODEL* aDrawingSheet ) const
|
|||
|
||||
void DS_DATA_MODEL_IO::format( DS_DATA_ITEM_TEXT* aItem, int aNestLevel ) const
|
||||
{
|
||||
m_out->Print( aNestLevel, "(%s", getTokenName( T_tbtext ) );
|
||||
m_out->Print( aNestLevel, "(tbtext" );
|
||||
m_out->Print( 0, " %s", m_out->Quotew( aItem->m_TextBase ).c_str() );
|
||||
m_out->Print( 0, " (%s %s)", getTokenName( T_name ),
|
||||
m_out->Quotew( aItem->m_Name ).c_str() );
|
||||
m_out->Print( 0, " (name %s)", m_out->Quotew( aItem->m_Name ).c_str() );
|
||||
|
||||
formatCoordinate( getTokenName( T_pos ), aItem->m_Pos );
|
||||
formatOptions( aItem );
|
||||
|
||||
if( aItem->m_Orient )
|
||||
m_out->Print( 0, " (%s %s)", getTokenName( T_rotate ),
|
||||
double2Str(aItem->m_Orient ).c_str() );
|
||||
m_out->Print( 0, " (rotate %s)", double2Str(aItem->m_Orient ).c_str() );
|
||||
|
||||
// Write font info, only if it is not the default setup
|
||||
bool write_size = aItem->m_TextSize.x != 0.0 || aItem->m_TextSize.y != 0.0;
|
||||
|
@ -248,60 +239,53 @@ void DS_DATA_MODEL_IO::format( DS_DATA_ITEM_TEXT* aItem, int aNestLevel ) const
|
|||
|
||||
if( write_thickness || write_size || aItem->m_Bold || aItem->m_Italic )
|
||||
{
|
||||
m_out->Print( 0, " (%s", getTokenName( T_font ) );
|
||||
m_out->Print( 0, " (font" );
|
||||
|
||||
if( write_thickness )
|
||||
{
|
||||
m_out->Print( 0, " (%s %s)", getTokenName( T_linewidth ),
|
||||
double2Str(aItem->m_LineWidth ).c_str() );
|
||||
}
|
||||
m_out->Print( 0, " (linewidth %s)", double2Str( aItem->m_LineWidth ).c_str() );
|
||||
|
||||
if( write_size )
|
||||
{
|
||||
m_out->Print( 0, " (%s %s %s)", getTokenName( T_size ),
|
||||
double2Str(aItem->m_TextSize.x ).c_str(),
|
||||
double2Str(aItem->m_TextSize.y ).c_str() );
|
||||
m_out->Print( 0, " (size %s %s)",
|
||||
double2Str( aItem->m_TextSize.x ).c_str(),
|
||||
double2Str( aItem->m_TextSize.y ).c_str() );
|
||||
}
|
||||
|
||||
if( aItem->m_Bold )
|
||||
m_out->Print( 0, " %s", getTokenName( T_bold ) );
|
||||
m_out->Print( 0, " bold" );
|
||||
|
||||
if( aItem->m_Italic )
|
||||
m_out->Print( 0, " %s", getTokenName( T_italic ) );
|
||||
m_out->Print( 0, " italic" );
|
||||
|
||||
m_out->Print( 0, ")" );
|
||||
}
|
||||
|
||||
// Write text justification
|
||||
if( aItem->m_Hjustify != GR_TEXT_HJUSTIFY_LEFT ||
|
||||
aItem->m_Vjustify != GR_TEXT_VJUSTIFY_CENTER )
|
||||
if( aItem->m_Hjustify != GR_TEXT_HJUSTIFY_LEFT || aItem->m_Vjustify != GR_TEXT_VJUSTIFY_CENTER )
|
||||
{
|
||||
m_out->Print( 0, " (%s", getTokenName( T_justify ) );
|
||||
m_out->Print( 0, " (justify" );
|
||||
|
||||
// Write T_center opt first, because it is
|
||||
// also a center for both m_Hjustify and m_Vjustify
|
||||
if( aItem->m_Hjustify == GR_TEXT_HJUSTIFY_CENTER )
|
||||
m_out->Print( 0, " %s", getTokenName( T_center ) );
|
||||
|
||||
if( aItem->m_Hjustify == GR_TEXT_HJUSTIFY_RIGHT )
|
||||
m_out->Print( 0, " %s", getTokenName( T_right ) );
|
||||
m_out->Print( 0, " center" );
|
||||
else if( aItem->m_Hjustify == GR_TEXT_HJUSTIFY_RIGHT )
|
||||
m_out->Print( 0, " right" );
|
||||
|
||||
if( aItem->m_Vjustify == GR_TEXT_VJUSTIFY_TOP )
|
||||
m_out->Print( 0, " %s", getTokenName( T_top ) );
|
||||
|
||||
if( aItem->m_Vjustify == GR_TEXT_VJUSTIFY_BOTTOM )
|
||||
m_out->Print( 0, " %s", getTokenName( T_bottom ) );
|
||||
m_out->Print( 0, " top" );
|
||||
else if( aItem->m_Vjustify == GR_TEXT_VJUSTIFY_BOTTOM )
|
||||
m_out->Print( 0, " bottom" );
|
||||
|
||||
m_out->Print( 0, ")" );
|
||||
}
|
||||
|
||||
// write constraints
|
||||
if( aItem->m_BoundingBoxSize.x )
|
||||
m_out->Print( 0, " (%s %s)", getTokenName( T_maxlen ),
|
||||
double2Str(aItem->m_BoundingBoxSize.x ).c_str() );
|
||||
m_out->Print( 0, " (maxlen %s)", double2Str(aItem->m_BoundingBoxSize.x ).c_str() );
|
||||
|
||||
if( aItem->m_BoundingBoxSize.y )
|
||||
m_out->Print( 0, " (%s %s)", getTokenName( T_maxheight ),
|
||||
double2Str(aItem->m_BoundingBoxSize.y ).c_str() );
|
||||
m_out->Print( 0, " (maxheight %s)", double2Str(aItem->m_BoundingBoxSize.y ).c_str() );
|
||||
|
||||
formatRepeatParameters( aItem );
|
||||
|
||||
|
@ -315,12 +299,11 @@ void DS_DATA_MODEL_IO::format( DS_DATA_ITEM_TEXT* aItem, int aNestLevel ) const
|
|||
void DS_DATA_MODEL_IO::format( DS_DATA_MODEL* aModel, DS_DATA_ITEM* aItem, int aNestLevel ) const
|
||||
{
|
||||
if( aItem->GetType() == DS_DATA_ITEM::DS_RECT )
|
||||
m_out->Print( aNestLevel, "(%s", getTokenName( T_rect ) );
|
||||
m_out->Print( aNestLevel, "(rect" );
|
||||
else
|
||||
m_out->Print( aNestLevel, "(%s", getTokenName( T_line ) );
|
||||
m_out->Print( aNestLevel, "(line" );
|
||||
|
||||
m_out->Print( 0, " (%s %s)", getTokenName( T_name ),
|
||||
m_out->Quotew( aItem->m_Name ).c_str() );
|
||||
m_out->Print( 0, " (name %s)", m_out->Quotew( aItem->m_Name ).c_str() );
|
||||
|
||||
formatCoordinate( getTokenName( T_start ), aItem->m_Pos );
|
||||
formatCoordinate( getTokenName( T_end ), aItem->m_End );
|
||||
|
@ -340,17 +323,15 @@ void DS_DATA_MODEL_IO::format( DS_DATA_MODEL* aModel, DS_DATA_ITEM* aItem, int a
|
|||
|
||||
void DS_DATA_MODEL_IO::format( DS_DATA_ITEM_POLYGONS* aItem, int aNestLevel ) const
|
||||
{
|
||||
m_out->Print( aNestLevel, "(%s", getTokenName( T_polygon ) );
|
||||
m_out->Print( 0, " (%s %s)", getTokenName( T_name ),
|
||||
m_out->Quotew( aItem->m_Name ).c_str() );
|
||||
formatCoordinate( getTokenName( T_pos ), aItem->m_Pos );
|
||||
m_out->Print( aNestLevel, "(polygon" );
|
||||
m_out->Print( 0, " (name %s)", m_out->Quotew( aItem->m_Name ).c_str() );
|
||||
formatCoordinate( "pos", aItem->m_Pos );
|
||||
formatOptions( aItem );
|
||||
|
||||
formatRepeatParameters( aItem );
|
||||
|
||||
if( aItem->m_Orient )
|
||||
m_out->Print( 0, " (%s %s)", getTokenName( T_rotate ),
|
||||
double2Str(aItem->m_Orient ).c_str() );
|
||||
m_out->Print( 0, " (rotate %s)", double2Str(aItem->m_Orient ).c_str() );
|
||||
|
||||
if( aItem->m_LineWidth )
|
||||
m_out->Print( 0, " (linewidth %s)\n", double2Str( aItem->m_LineWidth ).c_str() );
|
||||
|
@ -361,7 +342,7 @@ void DS_DATA_MODEL_IO::format( DS_DATA_ITEM_POLYGONS* aItem, int aNestLevel ) co
|
|||
// Write polygon corners list
|
||||
for( int kk = 0; kk < aItem->GetPolyCount(); kk++ )
|
||||
{
|
||||
m_out->Print( aNestLevel+1, "(%s", getTokenName( T_pts ) );
|
||||
m_out->Print( aNestLevel+1, "(pts" );
|
||||
// Create current polygon corners list
|
||||
unsigned ist = aItem->GetPolyIndexStart( kk );
|
||||
unsigned iend = aItem->GetPolyIndexEnd( kk );
|
||||
|
@ -379,7 +360,7 @@ void DS_DATA_MODEL_IO::format( DS_DATA_ITEM_POLYGONS* aItem, int aNestLevel ) co
|
|||
ii = 0;
|
||||
}
|
||||
|
||||
m_out->Print( nestLevel, " (%s %s %s)", getTokenName( T_xy ),
|
||||
m_out->Print( nestLevel, " (xy %s %s)",
|
||||
double2Str( pos.x ).c_str(),
|
||||
double2Str( pos.y ).c_str() );
|
||||
}
|
||||
|
@ -393,14 +374,12 @@ void DS_DATA_MODEL_IO::format( DS_DATA_ITEM_POLYGONS* aItem, int aNestLevel ) co
|
|||
|
||||
void DS_DATA_MODEL_IO::format( DS_DATA_ITEM_BITMAP* aItem, int aNestLevel ) const
|
||||
{
|
||||
m_out->Print( aNestLevel, "(%s", getTokenName( T_bitmap ) );
|
||||
m_out->Print( 0, " (%s %s)", getTokenName( T_name ),
|
||||
m_out->Quotew( aItem->m_Name ).c_str() );
|
||||
formatCoordinate( getTokenName( T_pos ), aItem->m_Pos );
|
||||
m_out->Print( aNestLevel, "(bitmap" );
|
||||
m_out->Print( 0, " (name %s)", m_out->Quotew( aItem->m_Name ).c_str() );
|
||||
formatCoordinate( "pos", aItem->m_Pos );
|
||||
formatOptions( aItem );
|
||||
|
||||
m_out->Print( 0, " (%s %s)", getTokenName( T_scale ),
|
||||
double2Str( aItem->m_ImageBitmap->GetScale() ).c_str() );
|
||||
m_out->Print( 0, " (scale %s)", double2Str( aItem->m_ImageBitmap->GetScale() ).c_str() );
|
||||
|
||||
formatRepeatParameters( aItem );
|
||||
m_out->Print( 0,"\n");
|
||||
|
@ -409,7 +388,7 @@ void DS_DATA_MODEL_IO::format( DS_DATA_ITEM_BITMAP* aItem, int aNestLevel ) cons
|
|||
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 ) );
|
||||
m_out->Print( aNestLevel, "(pngdata\n" );
|
||||
wxArrayString pngStrings;
|
||||
aItem->m_ImageBitmap->SaveData( pngStrings );
|
||||
|
||||
|
@ -431,9 +410,9 @@ void DS_DATA_MODEL_IO::formatCoordinate( const char * aToken, POINT_COORD & aCoo
|
|||
switch( aCoord.m_Anchor )
|
||||
{
|
||||
case RB_CORNER: break;
|
||||
case LT_CORNER: m_out->Print( 0, " %s", getTokenName( T_ltcorner ) ); break;
|
||||
case LB_CORNER: m_out->Print( 0, " %s", getTokenName( T_lbcorner ) ); break;
|
||||
case RT_CORNER: m_out->Print( 0, " %s", getTokenName( T_rtcorner ) ); break;
|
||||
case LT_CORNER: m_out->Print( 0, " ltcorner" ); break;
|
||||
case LB_CORNER: m_out->Print( 0, " lbcorner" ); break;
|
||||
case RT_CORNER: m_out->Print( 0, " rtcorner" ); break;
|
||||
}
|
||||
|
||||
m_out->Print( 0, ")" );
|
||||
|
@ -461,7 +440,7 @@ void DS_DATA_MODEL_IO::formatRepeatParameters( DS_DATA_ITEM* aItem ) const
|
|||
void DS_DATA_MODEL_IO::formatOptions( DS_DATA_ITEM* aItem ) const
|
||||
{
|
||||
if( aItem->GetPage1Option() == FIRST_PAGE_ONLY )
|
||||
m_out->Print( 0, " (%s %s)", getTokenName( T_option ), getTokenName(T_page1only ) );
|
||||
m_out->Print( 0, " (option page1only)", getTokenName(T_page1only ) );
|
||||
else if( aItem->GetPage1Option() == SUBSEQUENT_PAGES )
|
||||
m_out->Print( 0, " (%s %s)", getTokenName( T_option ), getTokenName( T_notonpage1 ) );
|
||||
m_out->Print( 0, " (option notonpage1)" );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue