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

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 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 198 of file ws_painter.cpp.

200 {
201  // Don't write the title block information if there is nothing to write.
202  bool isempty = true;
203  for( unsigned idx = 0; idx < m_tbTexts.GetCount(); idx++ )
204  {
205  if( ! m_tbTexts[idx].IsEmpty() )
206  {
207  isempty = false;
208  break;
209  }
210  }
211 
212  if( !isempty )
213  {
214  aFormatter->Print( aNestLevel, "(title_block\n" );
215 
216  if( !GetTitle().IsEmpty() )
217  aFormatter->Print( aNestLevel+1, "(title %s)\n",
218  aFormatter->Quotew( GetTitle() ).c_str() );
219 
220  if( !GetDate().IsEmpty() )
221  aFormatter->Print( aNestLevel+1, "(date %s)\n",
222  aFormatter->Quotew( GetDate() ).c_str() );
223 
224  if( !GetRevision().IsEmpty() )
225  aFormatter->Print( aNestLevel+1, "(rev %s)\n",
226  aFormatter->Quotew( GetRevision() ).c_str() );
227 
228  if( !GetCompany().IsEmpty() )
229  aFormatter->Print( aNestLevel+1, "(company %s)\n",
230  aFormatter->Quotew( GetCompany() ).c_str() );
231 
232  for( int ii = 0; ii < 9; ii++ )
233  {
234  if( !GetComment(ii).IsEmpty() )
235  aFormatter->Print( aNestLevel+1, "(comment %d %s)\n", ii+1,
236  aFormatter->Quotew( GetComment(ii) ).c_str() );
237  }
238 
239  aFormatter->Print( aNestLevel, ")\n\n" );
240  }
241 }
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:472
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:404

References OUTPUTFORMATTER::Print(), and OUTPUTFORMATTER::Quotew().

Referenced by PCB_IO::formatGeneral().

◆ GetComment()

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

Definition at line 110 of file title_block.h.

111  {
112  aIdx += m_commentIdx;
113  return getTbText( aIdx );
114  }
const wxString & getTbText(int aIdx) const
Definition: title_block.h:142

References getTbText(), and m_commentIdx.

Referenced by SCH_LEGACY_PLUGIN::Format(), DIALOG_PAGES_SETTINGS::initDialog(), NETLIST_EXPORTER_GENERIC::makeDesignHeader(), and DIALOG_PAGES_SETTINGS::SavePageSettings().

◆ 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 ( void  ) const
inline

◆ SetComment()

◆ SetCompany()

void TITLE_BLOCK::SetCompany ( const wxString &  aCompany)
inline

◆ SetDate()

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 74 of file title_block.h.

75  {
76  setTbText( dateIdx, aDate );
77  }
void setTbText(int aIdx, const wxString &aText)
Definition: title_block.h:135

References dateIdx, and setTbText().

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

◆ 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()

void TITLE_BLOCK::SetTitle ( const wxString &  aTitle)
inline

Member Data Documentation

◆ m_tbTexts

wxArrayString TITLE_BLOCK::m_tbTexts
private

Definition at line 133 of file title_block.h.

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


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