34#include <drawing_sheet/drawing_sheet_lexer.h>
41#include <wx/mstream.h>
43using namespace DRAWINGSHEET_T;
49 return DRAWING_SHEET_LEXER::TokenName( aTok );
102 wxMessageBox( ioe.
What(),
_(
"Error writing drawing sheet file" ) );
133 wxMessageBox( ioe.
What(),
_(
"Error writing drawing sheet file" ) );
166 writer.
Format(
this, aItemsList );
174 m_out->Print(
"(kicad_wks (version %d) (generator \"pl_editor\") (generator_version %s)",
207 wxFAIL_MSG( wxT(
"Cannot format item" ) );
216 m_out->Print(
"(kicad_wks (version %d) (generator \"pl_editor\") (generator_version %s)",
223 m_out->Print(
"(setup" );
224 m_out->Print(
"(textsize %s %s)",
228 m_out->Print(
"(textlinewidth %s)",
240 for(
unsigned ii = 0; ii < aSheet->
GetCount(); ii++ )
266 if( write_thickness || write_size || aItem->
m_Bold || aItem->
m_Italic
269 m_out->Print(
"(font" );
274 if( write_thickness )
279 m_out->Print(
"(size %s %s)",
285 m_out->Print(
" bold" );
288 m_out->Print(
" italic" );
292 m_out->Print(
"(color %d %d %d %s)",
305 m_out->Print(
"(justify" );
310 m_out->Print(
" center" );
312 m_out->Print(
" right" );
315 m_out->Print(
" top" );
317 m_out->Print(
" bottom" );
331 if( !aItem->
m_Info.IsEmpty() )
341 m_out->Print(
"(rect" );
343 m_out->Print(
"(line" );
356 if( !aItem->
m_Info.IsEmpty() )
365 m_out->Print(
"(polygon" );
378 if( !aItem->
m_Info.IsEmpty() )
384 m_out->Print(
"(pts" );
393 m_out->Print(
"(xy %s %s)",
411 m_out->Print(
"(bitmap" );
420 if( !aItem->
m_Info.IsEmpty() )
424 wxMemoryOutputStream stream;
435 m_out->Print(
"(%s %s %s", aToken,
472 m_out->Print(
"(option page1only)" );
474 m_out->Print(
"(option notonpage1)" );
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
wxString GetMajorMinorVersion()
Get only the major and minor version in a string major.minor.
const wxImage * GetOriginalImageData() const
bool SaveImageData(wxOutputStream &aOutStream) const
Write the bitmap data to aOutStream.
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
BITMAP_BASE * m_ImageBitmap
unsigned GetPolyIndexStart(unsigned aContour) const
unsigned GetPolyIndexEnd(unsigned aContour) const
std::vector< VECTOR2D > m_Corners
GR_TEXT_H_ALIGN_T m_Hjustify
KIGFX::COLOR4D m_TextColor
VECTOR2D m_BoundingBoxSize
GR_TEXT_V_ALIGN_T m_Vjustify
Drawing sheet structure type definitions.
PAGE_OPTION GetPage1Option() const
DS_ITEM_TYPE GetType() const
VECTOR2D m_IncrementVector
A helper class to write a drawing sheet to a file.
DS_DATA_MODEL_FILEIO(const wxString &aFilename)
PRETTIFIED_FILE_OUTPUTFORMATTER * m_fileout
void Format(DS_DATA_MODEL *aSheet) const
virtual ~DS_DATA_MODEL_IO()
void formatRepeatParameters(DS_DATA_ITEM *aItem) const
void formatOptions(DS_DATA_ITEM *aItem) const
void format(DS_DATA_ITEM_TEXT *aItem) const
void formatCoordinate(const char *aToken, POINT_COORD &aCoord) const
A helper class to write a drawing sheet to a string.
~DS_DATA_MODEL_STRINGIO()
STRING_FORMATTER * m_writer
DS_DATA_MODEL_STRINGIO(wxString *aOutputString)
Handle the graphic items list to draw/plot the frame and title block.
VECTOR2D m_DefaultTextSize
unsigned GetCount() const
double m_DefaultLineWidth
DS_DATA_ITEM * GetItem(unsigned aIdx) const
double m_DefaultTextThickness
void SaveInString(wxString *aOutputString)
Save the description in a buffer.
void Save(const wxString &aFullFileName)
Save the description in a file.
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
virtual const wxString What() const
A composite of Problem() and Where()
const char * NameAsToken() const
const wxString & GetName() const
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
static const char * getTokenName(T aTok)
#define SEXPR_WORKSHEET_FILE_VERSION
This file contains the file format version information for the s-expression drawing sheet file format...
wxString From_UTF8(const char *cstring)
std::string FormatDouble2Str(double aValue)
Print a float number without using scientific notation and no trailing 0 This function is intended in...
VECTOR2< double > VECTOR2D