KiCad PCB EDA Suite
TITLE_BLOCK Class Reference

Class TITLE_BLOCK holds the information shown in the lower right corner of a plot, printout, or editing view. More...

#include <class_title_block.h>

Public Member Functions

 TITLE_BLOCK ()
 
virtual ~TITLE_BLOCK ()
 
void SetTitle (const wxString &aTitle)
 
const wxString & GetTitle () const
 
void SetDate (const wxString &aDate)
 Function SetDate sets the date field, and defaults to the current time and date. More...
 
const wxString & GetDate () const
 
void SetRevision (const wxString &aRevision)
 
const wxString & GetRevision () const
 
void SetCompany (const wxString &aCompany)
 
const wxString & GetCompany () const
 
void SetComment (int aIdx, const wxString &aComment)
 
const wxString & GetComment (int aIdx) const
 
void SetComment1 (const wxString &aComment)
 
void SetComment2 (const wxString &aComment)
 
void SetComment3 (const wxString &aComment)
 
void SetComment4 (const wxString &aComment)
 
const wxString & GetComment1 () const
 
const wxString & GetComment2 () const
 
const wxString & GetComment3 () const
 
const wxString & GetComment4 () const
 
void Clear ()
 
virtual void Format (OUTPUTFORMATTER *aFormatter, int aNestLevel, int aControlBits) const
 Function Format outputs the object to aFormatter in s-expression form. More...
 

Private Types

enum  textsIdx {
  titleIdx = 0, dateIdx, revisionIdx, companyIdx,
  m_commentIdx
}
 

Private Member Functions

void setTbText (int aIdx, const wxString &aText)
 
const wxString & getTbText (int aIdx) const
 

Private Attributes

wxArrayString m_tbTexts
 

Detailed Description

Class TITLE_BLOCK holds the information shown in the lower right corner of a plot, printout, or editing view.

Author
Dick Hollenbeck

Definition at line 39 of file class_title_block.h.

Member Enumeration Documentation

enum TITLE_BLOCK::textsIdx
private
Enumerator
titleIdx 
dateIdx 
revisionIdx 
companyIdx 
m_commentIdx 

Definition at line 44 of file class_title_block.h.

Constructor & Destructor Documentation

TITLE_BLOCK::TITLE_BLOCK ( )
inline

Definition at line 55 of file class_title_block.h.

55 {};
virtual TITLE_BLOCK::~TITLE_BLOCK ( )
inlinevirtual

Definition at line 56 of file class_title_block.h.

56 {}; // a virtual dtor seems needed to build

Member Function Documentation

void TITLE_BLOCK::Clear ( )
inline

Definition at line 126 of file class_title_block.h.

References m_tbTexts.

Referenced by SCH_SCREEN::Clear().

127  {
128  m_tbTexts.Clear();
129  }
wxArrayString m_tbTexts
void TITLE_BLOCK::Format ( OUTPUTFORMATTER aFormatter,
int  aNestLevel,
int  aControlBits 
) const
virtual

Function Format outputs the object to aFormatter in s-expression form.

Parameters
aFormatterThe OUTPUTFORMATTER object to write to.
aNestLevelThe indentation next level.
aControlBitsThe control bit definition for object specific formatting.
Exceptions
IO_ERRORon write error.

Definition at line 245 of file worksheet.cpp.

References GetComment(), GetCompany(), GetDate(), GetRevision(), GetTitle(), m_tbTexts, OUTPUTFORMATTER::Print(), and OUTPUTFORMATTER::Quotew().

Referenced by PCB_IO::format().

247 {
248  // Don't write the title block information if there is nothing to write.
249  bool isempty = true;
250  for( unsigned idx = 0; idx < m_tbTexts.GetCount(); idx++ )
251  {
252  if( ! m_tbTexts[idx].IsEmpty() )
253  {
254  isempty = false;
255  break;
256  }
257  }
258 
259  if( !isempty )
260  {
261  aFormatter->Print( aNestLevel, "(title_block\n" );
262 
263  if( !GetTitle().IsEmpty() )
264  aFormatter->Print( aNestLevel+1, "(title %s)\n",
265  aFormatter->Quotew( GetTitle() ).c_str() );
266 
267  if( !GetDate().IsEmpty() )
268  aFormatter->Print( aNestLevel+1, "(date %s)\n",
269  aFormatter->Quotew( GetDate() ).c_str() );
270 
271  if( !GetRevision().IsEmpty() )
272  aFormatter->Print( aNestLevel+1, "(rev %s)\n",
273  aFormatter->Quotew( GetRevision() ).c_str() );
274 
275  if( !GetCompany().IsEmpty() )
276  aFormatter->Print( aNestLevel+1, "(company %s)\n",
277  aFormatter->Quotew( GetCompany() ).c_str() );
278 
279  for( int ii = 0; ii < 4; ii++ )
280  {
281  if( !GetComment(ii).IsEmpty() )
282  aFormatter->Print( aNestLevel+1, "(comment %d %s)\n", ii+1,
283  aFormatter->Quotew( GetComment(ii) ).c_str() );
284  }
285 
286  aFormatter->Print( aNestLevel, ")\n\n" );
287  }
288 }
const wxString & GetCompany() const
const wxString & GetComment(int aIdx) const
const wxString & GetDate() const
wxArrayString m_tbTexts
const wxString & GetTitle() const
const wxString & GetRevision() const
std::string Quotew(const wxString &aWrapee)
Definition: richio.cpp:486
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Function Print formats and writes text to the output stream.
Definition: richio.cpp:408
const wxString& TITLE_BLOCK::GetComment ( int  aIdx) const
inline

Definition at line 109 of file class_title_block.h.

References getTbText(), and m_commentIdx.

Referenced by WS_DRAW_ITEM_LIST::BuildFullText(), Format(), GetComment1(), GetComment2(), GetComment3(), and GetComment4().

110  {
111  aIdx += m_commentIdx;
112  return getTbText( aIdx );
113  }
const wxString & getTbText(int aIdx) const
const wxString& TITLE_BLOCK::GetComment1 ( ) const
inline
const wxString& TITLE_BLOCK::GetComment2 ( ) const
inline
const wxString& TITLE_BLOCK::GetComment3 ( ) const
inline
const wxString& TITLE_BLOCK::GetComment4 ( ) const
inline
const wxString& TITLE_BLOCK::GetCompany ( ) const
inline
const wxString& TITLE_BLOCK::getTbText ( int  aIdx) const
inlineprivate

Definition at line 152 of file class_title_block.h.

Referenced by GetComment(), GetCompany(), GetDate(), GetRevision(), and GetTitle().

153  {
154  static const wxString m_emptytext;
155 
156  if( (int)m_tbTexts.GetCount() > aIdx )
157  return m_tbTexts[aIdx];
158  else
159  return m_emptytext;
160  }
wxArrayString m_tbTexts
void TITLE_BLOCK::SetComment ( int  aIdx,
const wxString &  aComment 
)
inline

Definition at line 103 of file class_title_block.h.

References m_commentIdx, and setTbText().

Referenced by SetComment1(), SetComment2(), SetComment3(), and SetComment4().

104  {
105  aIdx += m_commentIdx;
106  return setTbText( aIdx, aComment );
107  }
void setTbText(int aIdx, const wxString &aText)
void TITLE_BLOCK::SetComment1 ( const wxString &  aComment)
inline
void TITLE_BLOCK::SetComment2 ( const wxString &  aComment)
inline
void TITLE_BLOCK::SetComment3 ( const wxString &  aComment)
inline
void TITLE_BLOCK::SetComment4 ( const wxString &  aComment)
inline
void TITLE_BLOCK::SetCompany ( const wxString &  aCompany)
inline
void TITLE_BLOCK::SetDate ( const wxString &  aDate)
inline

Function SetDate sets the date field, and defaults to the current time and date.

Definition at line 73 of file class_title_block.h.

References dateIdx, and setTbText().

Referenced by SCH_LEGACY_PLUGIN::loadPageSettings(), LEGACY_PLUGIN::loadSHEET(), DIALOG_PAGES_SETTINGS::OnDateTextUpdated(), PCB_PARSER::parseTITLE_BLOCK(), ReadSchemaDescr(), and DIALOG_PAGES_SETTINGS::SavePageSettings().

74  {
75  setTbText( dateIdx, aDate );
76  }
void setTbText(int aIdx, const wxString &aText)
void TITLE_BLOCK::SetRevision ( const wxString &  aRevision)
inline
void TITLE_BLOCK::setTbText ( int  aIdx,
const wxString &  aText 
)
inlineprivate

Definition at line 145 of file class_title_block.h.

Referenced by SetComment(), SetCompany(), SetDate(), SetRevision(), and SetTitle().

146  {
147  if( (int)m_tbTexts.GetCount() <= aIdx )
148  m_tbTexts.Add( wxEmptyString, aIdx + 1 - m_tbTexts.GetCount() );
149  m_tbTexts[aIdx] = aText;
150  }
wxArrayString m_tbTexts
void TITLE_BLOCK::SetTitle ( const wxString &  aTitle)
inline

Member Data Documentation

wxArrayString TITLE_BLOCK::m_tbTexts
private

Definition at line 143 of file class_title_block.h.

Referenced by Clear(), and Format().


The documentation for this class was generated from the following files: