KiCad PCB EDA Suite
TITLE_BLOCK Class Reference

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

#include <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 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

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

Author
Dick Hollenbeck

Definition at line 40 of file title_block.h.

Member Enumeration Documentation

◆ textsIdx

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

Definition at line 45 of file title_block.h.

Constructor & Destructor Documentation

◆ TITLE_BLOCK()

TITLE_BLOCK::TITLE_BLOCK ( )
inline

Definition at line 56 of file title_block.h.

56 {};

◆ ~TITLE_BLOCK()

virtual TITLE_BLOCK::~TITLE_BLOCK ( )
inlinevirtual

Definition at line 57 of file title_block.h.

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

Member Function Documentation

◆ Clear()

void TITLE_BLOCK::Clear ( )
inline

Definition at line 116 of file title_block.h.

117  {
118  m_tbTexts.Clear();
119  }
wxArrayString m_tbTexts
Definition: title_block.h:133

References m_tbTexts.

Referenced by SCH_SCREEN::Clear().

◆ Format()

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 28 of file title_block.cpp.

29 {
30  // Don't write the title block information if there is nothing to write.
31  bool isempty = true;
32  for( unsigned idx = 0; idx < m_tbTexts.GetCount(); idx++ )
33  {
34  if( ! m_tbTexts[idx].IsEmpty() )
35  {
36  isempty = false;
37  break;
38  }
39  }
40 
41  if( !isempty )
42  {
43  aFormatter->Print( aNestLevel, "(title_block\n" );
44 
45  if( !GetTitle().IsEmpty() )
46  aFormatter->Print( aNestLevel+1, "(title %s)\n",
47  aFormatter->Quotew( GetTitle() ).c_str() );
48 
49  if( !GetDate().IsEmpty() )
50  aFormatter->Print( aNestLevel+1, "(date %s)\n",
51  aFormatter->Quotew( GetDate() ).c_str() );
52 
53  if( !GetRevision().IsEmpty() )
54  aFormatter->Print( aNestLevel+1, "(rev %s)\n",
55  aFormatter->Quotew( GetRevision() ).c_str() );
56 
57  if( !GetCompany().IsEmpty() )
58  aFormatter->Print( aNestLevel+1, "(company %s)\n",
59  aFormatter->Quotew( GetCompany() ).c_str() );
60 
61  for( int ii = 0; ii < 9; ii++ )
62  {
63  if( !GetComment(ii).IsEmpty() )
64  aFormatter->Print( aNestLevel+1, "(comment %d %s)\n", ii+1,
65  aFormatter->Quotew( GetComment(ii) ).c_str() );
66  }
67 
68  aFormatter->Print( aNestLevel, ")\n\n" );
69  }
70 }
const wxString & GetComment(int aIdx) const
Definition: title_block.h:110
wxArrayString m_tbTexts
Definition: title_block.h:133
const wxString & GetRevision() const
Definition: title_block.h:89
const wxString & GetCompany() const
Definition: title_block.h:99
std::string Quotew(const wxString &aWrapee)
Definition: richio.cpp:476
const wxString & GetDate() const
Definition: title_block.h:79
const wxString & GetTitle() const
Definition: title_block.h:65
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Function Print formats and writes text to the output stream.
Definition: richio.cpp:408

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

Referenced by SCH_SEXPR_PLUGIN::Format(), and PCB_IO::formatGeneral().

◆ GetComment()

const wxString& TITLE_BLOCK::GetComment ( int  aIdx) const
inline

◆ GetCompany()

const wxString& TITLE_BLOCK::GetCompany ( ) const
inline

◆ GetDate()

const wxString& TITLE_BLOCK::GetDate ( ) const
inline

◆ GetRevision()

const wxString& TITLE_BLOCK::GetRevision ( ) const
inline

◆ getTbText()

const wxString& TITLE_BLOCK::getTbText ( int  aIdx) const
inlineprivate

Definition at line 142 of file title_block.h.

143  {
144  static const wxString m_emptytext;
145 
146  if( (int)m_tbTexts.GetCount() > aIdx )
147  return m_tbTexts[aIdx];
148  else
149  return m_emptytext;
150  }
wxArrayString m_tbTexts
Definition: title_block.h:133

References m_tbTexts.

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

◆ GetTitle()

const wxString& TITLE_BLOCK::GetTitle ( ) const
inline

◆ SetComment()

◆ SetCompany()

◆ SetDate()

void TITLE_BLOCK::SetDate ( const wxString &  aDate)
inline

◆ SetRevision()

void TITLE_BLOCK::SetRevision ( const wxString &  aRevision)
inline

◆ setTbText()

void TITLE_BLOCK::setTbText ( int  aIdx,
const wxString &  aText 
)
inlineprivate

Definition at line 135 of file title_block.h.

136  {
137  if( (int)m_tbTexts.GetCount() <= aIdx )
138  m_tbTexts.Add( wxEmptyString, aIdx + 1 - m_tbTexts.GetCount() );
139  m_tbTexts[aIdx] = aText;
140  }
wxArrayString m_tbTexts
Definition: title_block.h:133

References m_tbTexts.

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

◆ SetTitle()

Member Data Documentation

◆ m_tbTexts

wxArrayString TITLE_BLOCK::m_tbTexts
private

Definition at line 133 of file title_block.h.

Referenced by Clear(), Format(), getTbText(), and setTbText().


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