Commit 0cad6e79 authored by Dick Hollenbeck's avatar Dick Hollenbeck

carve out TITLE_BLOCK class from BASE_SCREEN, add hashtables.h for PROPERTIES

parent 6d3fd3a0
......@@ -14,7 +14,7 @@
#include "macros.h"
#include "class_base_screen.h"
#include "drawtxt.h"
#include "class_title_block.h"
/* Plot sheet references
* margin is in mils (1/1000 inch)
......@@ -479,12 +479,12 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
switch( WsItem->m_Type )
{
case WS_DATE:
msg += screen->m_Date;
msg += GetTitleBlock().GetDate();
bold = true;
break;
case WS_REV:
msg += screen->m_Revision;
msg += GetTitleBlock().GetRevision();
bold = true;
break;
......@@ -517,37 +517,37 @@ void EDA_DRAW_FRAME::PlotWorkSheet( PLOTTER* plotter, BASE_SCREEN* screen )
break;
case WS_COMPANY_NAME:
msg += screen->m_Company;
msg += GetTitleBlock().GetCompany();
if( !msg.IsEmpty() )
UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT );
bold = true;
break;
case WS_TITLE:
msg += screen->m_Title;
msg += GetTitleBlock().GetTitle();
bold = true;
break;
case WS_COMMENT1:
msg += screen->m_Commentaire1;
msg += GetTitleBlock().GetComment1();
if( !msg.IsEmpty() )
UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT );
break;
case WS_COMMENT2:
msg += screen->m_Commentaire2;
msg += GetTitleBlock().GetComment2();
if( !msg.IsEmpty() )
UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT );
break;
case WS_COMMENT3:
msg += screen->m_Commentaire3;
msg += GetTitleBlock().GetComment3();
if( !msg.IsEmpty() )
UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT );
break;
case WS_COMMENT4:
msg += screen->m_Commentaire4;
msg += GetTitleBlock().GetComment4();
if( !msg.IsEmpty() )
UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT );
break;
......
......@@ -72,9 +72,9 @@ void DIALOG_PAGES_SETTINGS::initDialog()
msg.Printf( format, m_Screen->m_ScreenNumber );
m_TextSheetNumber->SetLabel( msg );
m_page = m_Parent->GetPageSettings();
PAGE_INFO pageInfo = m_Parent->GetPageSettings();
setCurrentPageSizeSelection();
setCurrentPageSizeSelection( pageInfo.GetType() );
switch( g_UserUnit )
{
......@@ -113,8 +113,7 @@ void DIALOG_PAGES_SETTINGS::initDialog()
*/
}
// Set validators
// m_PageSizeBox->SetValidator( wxGenericValidator( &m_CurrentSelection ) );
#if 0
m_TextRevision->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Revision ) );
m_TextTitle->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Title ) );
m_TextCompany->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Company ) );
......@@ -122,6 +121,18 @@ void DIALOG_PAGES_SETTINGS::initDialog()
m_TextComment2->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Commentaire2 ) );
m_TextComment3->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Commentaire3 ) );
m_TextComment4->SetValidator( wxTextValidator( wxFILTER_NONE, &m_Screen->m_Commentaire4 ) );
#else
TITLE_BLOCK tb = m_Parent->GetTitleBlock();
m_TextRevision->SetValue( tb.GetRevision() );
m_TextTitle->SetValue( tb.GetTitle() );
m_TextCompany->SetValue( tb.GetCompany() );
m_TextComment1->SetValue( tb.GetComment1() );
m_TextComment2->SetValue( tb.GetComment2() );
m_TextComment3->SetValue( tb.GetComment3() );
m_TextComment4->SetValue( tb.GetComment4() );
#endif
#ifndef EESCHEMA
m_RevisionExport->Show( false );
......@@ -175,14 +186,15 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
wxString msg;
double userSizeX;
double userSizeY;
TITLE_BLOCK tb;
m_Screen->m_Revision = m_TextRevision->GetValue();
m_Screen->m_Company = m_TextCompany->GetValue();
m_Screen->m_Title = m_TextTitle->GetValue();
m_Screen->m_Commentaire1 = m_TextComment1->GetValue();
m_Screen->m_Commentaire2 = m_TextComment2->GetValue();
m_Screen->m_Commentaire3 = m_TextComment3->GetValue();
m_Screen->m_Commentaire4 = m_TextComment4->GetValue();
tb.SetRevision( m_TextRevision->GetValue() );
tb.SetCompany( m_TextCompany->GetValue() );
tb.SetTitle( m_TextTitle->GetValue() );
tb.SetComment1( m_TextComment1->GetValue() );
tb.SetComment2( m_TextComment2->GetValue() );
tb.SetComment3( m_TextComment3->GetValue() );
tb.SetComment4( m_TextComment4->GetValue() );
msg = m_TextUserSizeX->GetValue();
msg.ToDouble( &userSizeX );
......@@ -195,11 +207,11 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
radioSelection = 0;
// wxFormBuilder must use "A4", "A3", etc for choices, in all languages/translations
wxString paperType = m_PageSizeBox->GetString( radioSelection );
m_page.SetType( paperType );
wxString paperType = m_PageSizeBox->GetString( radioSelection );
PAGE_INFO pageInfo( paperType );
m_Parent->SetPageSettings( m_page );
m_Parent->SetPageSettings( pageInfo );
m_Parent->SetTitleBlock( tb );
switch( g_UserUnit )
{
......@@ -229,32 +241,36 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
// Build the screen list
SCH_SCREENS ScreenList;
// Update the datas
// Update title blocks for all screens
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
{
if( screen == m_Screen )
continue;
TITLE_BLOCK tb2 = screen->GetTitleBlock();
if( m_RevisionExport->IsChecked() )
screen->m_Revision = m_Screen->m_Revision;
tb2.SetRevision( tb.GetRevision() );
if( m_TitleExport->IsChecked() )
screen->m_Title = m_Screen->m_Title;
tb2.SetTitle( tb.GetTitle() );
if( m_CompanyExport->IsChecked() )
screen->m_Company = m_Screen->m_Company;
tb2.SetCompany( tb.GetCompany() );
if( m_Comment1Export->IsChecked() )
screen->m_Commentaire1 = m_Screen->m_Commentaire1;
tb2.SetComment1( tb.GetComment1() );
if( m_Comment2Export->IsChecked() )
screen->m_Commentaire2 = m_Screen->m_Commentaire2;
tb2.SetComment2( tb.GetComment2() );
if( m_Comment3Export->IsChecked() )
screen->m_Commentaire3 = m_Screen->m_Commentaire3;
tb2.SetComment3( tb.GetComment3() );
if( m_Comment4Export->IsChecked() )
screen->m_Commentaire4 = m_Screen->m_Commentaire4;
tb2.SetComment4( tb.GetComment4() );
screen->SetTitleBlock( tb2 );
}
#endif
......@@ -264,10 +280,8 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
}
void DIALOG_PAGES_SETTINGS::setCurrentPageSizeSelection()
void DIALOG_PAGES_SETTINGS::setCurrentPageSizeSelection( const wxString& aPaperSize )
{
wxString curPaperType = m_page.GetType();
// use wxFormBuilder to store the sheet type in the wxRadioButton's label
// i.e. "A4", "A3", etc, anywhere within the text of the label.
......@@ -276,12 +290,12 @@ void DIALOG_PAGES_SETTINGS::setCurrentPageSizeSelection()
// search all the child wxRadioButtons for a label containing our paper type
for( unsigned i = 0; i < m_PageSizeBox->GetCount(); ++i )
{
// parse each label looking for curPaperType within it
// parse each label looking for aPaperSize within it
wxStringTokenizer st( m_PageSizeBox->GetString( i ) );
while( st.HasMoreTokens() )
{
if( st.GetNextToken() == curPaperType )
if( st.GetNextToken() == aPaperSize )
{
m_PageSizeBox->SetSelection( i );
return;
......
......@@ -17,7 +17,6 @@ private:
EDA_DRAW_FRAME* m_Parent;
BASE_SCREEN* m_Screen;
bool m_modified;
PAGE_INFO m_page; ///< the one being edited
PAGE_INFO m_user_size; ///< instantiated just to get the size
public:
......@@ -37,7 +36,7 @@ private:
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
void OnCancelClick( wxCommandEvent& event );
void setCurrentPageSizeSelection();
void setCurrentPageSizeSelection( const wxString& aPaperSize );
void SavePageSettings(wxCommandEvent& event);
void ReturnSizeSelected(wxCommandEvent& event);
......
......@@ -13,6 +13,7 @@
#include "wxstruct.h"
#include "appl_wxstruct.h"
#include "worksheet.h"
#include "class_title_block.h"
#include "build_version.h"
......@@ -1423,7 +1424,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
case WS_DATE:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += screen->m_Date;
msg += GetTitleBlock().GetDate();
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
......@@ -1433,7 +1434,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
case WS_REV:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += screen->m_Revision;
msg += GetTitleBlock().GetRevision();
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
......@@ -1503,7 +1504,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
case WS_COMPANY_NAME:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += screen->m_Company;
msg += GetTitleBlock().GetCompany();
if( !msg.IsEmpty() )
{
DrawGraphicText( m_canvas, DC, pos, Color,
......@@ -1518,7 +1519,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
case WS_TITLE:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += screen->m_Title;
msg += GetTitleBlock().GetTitle();
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
......@@ -1529,7 +1530,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
case WS_COMMENT1:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += screen->m_Commentaire1;
msg += GetTitleBlock().GetComment1();
if( !msg.IsEmpty() )
{
DrawGraphicText( m_canvas, DC, pos, Color,
......@@ -1543,7 +1544,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
case WS_COMMENT2:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += screen->m_Commentaire2;
msg += GetTitleBlock().GetComment2();
if( !msg.IsEmpty() )
{
DrawGraphicText( m_canvas, DC, pos, Color,
......@@ -1557,7 +1558,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
case WS_COMMENT3:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += screen->m_Commentaire3;
msg += GetTitleBlock().GetComment3();
if( !msg.IsEmpty() )
{
DrawGraphicText( m_canvas, DC, pos, Color,
......@@ -1571,7 +1572,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
case WS_COMMENT4:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += screen->m_Commentaire4;
msg += GetTitleBlock().GetComment4();
if( !msg.IsEmpty() )
{
DrawGraphicText( m_canvas, DC, pos, Color,
......
......@@ -250,14 +250,17 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& aFileName, bool aIsNew )
screen->SetZoom( 32 );
screen->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
screen->m_Title = NAMELESS_PROJECT;
screen->m_Title += wxT( ".sch" );
GetScreen()->SetFileName( screen->m_Title );
screen->m_Company.Empty();
screen->m_Commentaire1.Empty();
screen->m_Commentaire2.Empty();
screen->m_Commentaire3.Empty();
screen->m_Commentaire4.Empty();
TITLE_BLOCK tb;
wxString title;
title += NAMELESS_PROJECT;
title += wxT( ".sch" );
tb.SetTitle( title );
screen->SetTitleBlock( tb );
GetScreen()->SetFileName( title );
LoadProjectFile( wxEmptyString, true );
Zoom_Automatique( false );
SetSheetNumberAndCount();
......
......@@ -312,6 +312,7 @@ bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, SCH_SCREEN* aScree
wxString pagename = FROM_UTF8( text );
PAGE_INFO pageInfo;
TITLE_BLOCK tb;
if( !pageInfo.SetType( pagename ) )
{
......@@ -337,7 +338,10 @@ line %d, \aAbort reading file.\n" ),
line = aLine->Line();
if( strnicmp( line, "$End", 4 ) == 0 )
{
aScreen->SetTitleBlock( tb );
break;
}
if( strnicmp( line, "Sheet", 2 ) == 0 )
sscanf( line + 5, " %d %d",
......@@ -346,56 +350,56 @@ line %d, \aAbort reading file.\n" ),
if( strnicmp( line, "Title", 2 ) == 0 )
{
ReadDelimitedText( buf, line, 256 );
aScreen->m_Title = FROM_UTF8( buf );
tb.SetTitle( FROM_UTF8( buf ) );
continue;
}
if( strnicmp( line, "Date", 2 ) == 0 )
{
ReadDelimitedText( buf, line, 256 );
aScreen->m_Date = FROM_UTF8( buf );
tb.SetDate( FROM_UTF8( buf ) );
continue;
}
if( strnicmp( line, "Rev", 2 ) == 0 )
{
ReadDelimitedText( buf, line, 256 );
aScreen->m_Revision = FROM_UTF8( buf );
tb.SetRevision( FROM_UTF8( buf ) );
continue;
}
if( strnicmp( line, "Comp", 4 ) == 0 )
{
ReadDelimitedText( buf, line, 256 );
aScreen->m_Company = FROM_UTF8( buf );
tb.SetCompany( FROM_UTF8( buf ) );
continue;
}
if( strnicmp( line, "Comment1", 8 ) == 0 )
{
ReadDelimitedText( buf, line, 256 );
aScreen->m_Commentaire1 = FROM_UTF8( buf );
tb.SetComment1( FROM_UTF8( buf ) );
continue;
}
if( strnicmp( line, "Comment2", 8 ) == 0 )
{
ReadDelimitedText( buf, line, 256 );
aScreen->m_Commentaire2 = FROM_UTF8( buf );
tb.SetComment2( FROM_UTF8( buf ) );
continue;
}
if( strnicmp( line, "Comment3", 8 ) == 0 )
{
ReadDelimitedText( buf, line, 256 );
aScreen->m_Commentaire3 = FROM_UTF8( buf );
tb.SetComment3( FROM_UTF8( buf ) );
continue;
}
if( strnicmp( line, "Comment4", 8 ) == 0 )
{
ReadDelimitedText( buf, line, 256 );
aScreen->m_Commentaire4 = FROM_UTF8( buf );
tb.SetComment4( FROM_UTF8( buf ) );
continue;
}
}
......
......@@ -150,14 +150,9 @@ void SCH_SCREEN::Clear()
/* Clear the project settings. */
m_ScreenNumber = m_NumberOfScreen = 1;
m_Title.Empty();
m_Revision.Empty();
m_Company.Empty();
m_Commentaire1.Empty();
m_Commentaire2.Empty();
m_Commentaire3.Empty();
m_Commentaire4.Empty();
m_Date = GenDate();
m_titles.Clear();
m_titles.SetDate();
}
......@@ -574,19 +569,20 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
* simple hierarchy and flat hierarchy. Used also to search the root
* sheet ( ScreenNumber = 1 ) within the files
*/
const TITLE_BLOCK& tb = GetTitleBlock();
if( fprintf( aFile, "$Descr %s %d %d\n", TO_UTF8( m_paper.GetType() ),
m_paper.GetWidthMils(), m_paper.GetHeightMils() ) < 0
|| fprintf( aFile, "encoding utf-8\n") < 0
|| fprintf( aFile, "Sheet %d %d\n", m_ScreenNumber, m_NumberOfScreen ) < 0
|| fprintf( aFile, "Title %s\n", EscapedUTF8( m_Title ).c_str() ) < 0
|| fprintf( aFile, "Date %s\n", EscapedUTF8( m_Date ).c_str() ) < 0
|| fprintf( aFile, "Rev %s\n", EscapedUTF8( m_Revision ).c_str() ) < 0
|| fprintf( aFile, "Comp %s\n", EscapedUTF8( m_Company ).c_str() ) < 0
|| fprintf( aFile, "Comment1 %s\n", EscapedUTF8( m_Commentaire1 ).c_str() ) < 0
|| fprintf( aFile, "Comment2 %s\n", EscapedUTF8( m_Commentaire2 ).c_str() ) < 0
|| fprintf( aFile, "Comment3 %s\n", EscapedUTF8( m_Commentaire3 ).c_str() ) < 0
|| fprintf( aFile, "Comment4 %s\n", EscapedUTF8( m_Commentaire4 ).c_str() ) < 0
|| fprintf( aFile, "Title %s\n", EscapedUTF8( tb.GetTitle() ).c_str() ) < 0
|| fprintf( aFile, "Date %s\n", EscapedUTF8( tb.GetDate() ).c_str() ) < 0
|| fprintf( aFile, "Rev %s\n", EscapedUTF8( tb.GetRevision() ).c_str() ) < 0
|| fprintf( aFile, "Comp %s\n", EscapedUTF8( tb.GetCompany() ).c_str() ) < 0
|| fprintf( aFile, "Comment1 %s\n", EscapedUTF8( tb.GetComment1() ).c_str() ) < 0
|| fprintf( aFile, "Comment2 %s\n", EscapedUTF8( tb.GetComment2() ).c_str() ) < 0
|| fprintf( aFile, "Comment3 %s\n", EscapedUTF8( tb.GetComment3() ).c_str() ) < 0
|| fprintf( aFile, "Comment4 %s\n", EscapedUTF8( tb.GetComment4() ).c_str() ) < 0
|| fprintf( aFile, "$EndDescr\n" ) < 0 )
return false;
......@@ -1492,7 +1488,11 @@ int SCH_SCREENS::ReplaceDuplicateTimeStamps()
void SCH_SCREENS::SetDate( const wxString& aDate )
{
for( size_t i = 0; i < m_screens.size(); i++ )
m_screens[i]->m_Date = aDate;
{
TITLE_BLOCK tb = m_screens[i]->GetTitleBlock();
tb.SetDate( aDate );
m_screens[i]->SetTitleBlock( tb );
}
}
......
......@@ -383,7 +383,11 @@ void SCH_EDIT_FRAME::CreateScreens()
}
g_RootSheet->GetScreen()->SetFileName( m_DefaultSchematicFileName );
g_RootSheet->GetScreen()->m_Date = GenDate();
TITLE_BLOCK tb = g_RootSheet->GetScreen()->GetTitleBlock();
tb.SetDate();
g_RootSheet->GetScreen()->SetTitleBlock( tb );
m_CurrentSheet->Clear();
m_CurrentSheet->Push( g_RootSheet );
......@@ -581,7 +585,6 @@ void SCH_EDIT_FRAME::OnModify()
if( m_dlgFindReplace == NULL )
m_foundItems.SetForceSearch();
wxString date = GenDate();
SCH_SCREENS s_list;
// Set the date for each sheet
......@@ -589,10 +592,7 @@ void SCH_EDIT_FRAME::OnModify()
// >> change only the current sheet
// >> change all sheets.
// I believe all sheets in a project must have the same date
SCH_SCREEN* screen = s_list.GetFirst();
for( ; screen != NULL; screen = s_list.GetNext() )
screen->m_Date = date;
s_list.SetDate();
}
......
......@@ -74,15 +74,16 @@ typedef std::vector< GRID_TYPE > GRIDS;
*/
class BASE_SCREEN : public EDA_ITEM
{
GRIDS m_grids; ///< List of valid grid sizes.
wxString m_fileName; ///< File used to load the screen.
char m_FlagRefreshReq; ///< Indicates that the screen should be redrawn.
bool m_FlagModified; ///< Indicates current drawing has been modified.
bool m_FlagSave; ///< Indicates automatic file save.
EDA_ITEM* m_CurrentItem; ///< Currently selected object
GRID_TYPE m_Grid; ///< Current grid selection.
wxPoint m_scrollCenter; ///< Current scroll center point in logical units.
wxPoint m_MousePosition; ///< Mouse cursor coordinate in logical units.
GRIDS m_grids; ///< List of valid grid sizes.
wxString m_fileName; ///< File used to load the screen.
char m_FlagRefreshReq; ///< Indicates that the screen should be redrawn.
bool m_FlagModified; ///< Indicates current drawing has been modified.
bool m_FlagSave; ///< Indicates automatic file save.
EDA_ITEM* m_CurrentItem; ///< Currently selected object
GRID_TYPE m_Grid; ///< Current grid selection.
wxPoint m_scrollCenter; ///< Current scroll center point in logical units.
wxPoint m_MousePosition; ///< Mouse cursor coordinate in logical units.
/**
* The cross hair position in logical (drawing) units. The cross hair is not the cursor
......@@ -132,15 +133,6 @@ public:
int m_ScreenNumber;
int m_NumberOfScreen;
wxString m_Title;
wxString m_Date;
wxString m_Revision;
wxString m_Company;
wxString m_Commentaire1;
wxString m_Commentaire2;
wxString m_Commentaire3;
wxString m_Commentaire4;
wxPoint m_GridOrigin;
wxArrayDouble m_ZoomList; ///< Array of standard zoom (i.e. scale) coefficients.
......
......@@ -34,6 +34,7 @@
#include "macros.h"
#include "sch_item_struct.h"
#include "class_base_screen.h"
#include "class_title_block.h"
#include "../eeschema/general.h"
......@@ -67,6 +68,8 @@ class SCH_SCREEN : public BASE_SCREEN
/// The size of the paper to print or plot on
PAGE_INFO m_paper; // keep with the MVC 'model' if this class gets split
TITLE_BLOCK m_titles;
/// Position of the origin axis, which is used in exports mostly, but not yet in EESCHEMA
wxPoint m_originAxisPosition;
......@@ -105,6 +108,10 @@ public:
const wxPoint& GetOriginAxisPosition() const { return m_originAxisPosition; }
void SetOriginAxisPosition( const wxPoint& aPosition ) { m_originAxisPosition = aPosition; }
const TITLE_BLOCK& GetTitleBlock() const { return m_titles; }
//TITLE_BLOCK& GetTitleBlock() const { return (TITLE_BLOCK&) m_titles; }
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; }
void DecRefCount();
void IncRefCount();
......@@ -521,7 +528,7 @@ public:
* @see GetDate()
* @param aDate The date string to set for each screen.
*/
void SetDate( const wxString& aDate );
void SetDate( const wxString& aDate = GenDate() );
/**
* Function DeleteAllMarkers
......
#ifndef TITLE_BLOCK_H_
#define TITLE_BLOCK_H_
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <wx/string.h>
extern wxString GenDate();
/**
* Class TITLE_BLOCK
* holds the information shown in the lower right corner of a plot, printout, or
* editing view.
*
* @author Dick Hollenbeck
*/
class TITLE_BLOCK
{
public:
// TITLE_BLOCK();
void SetTitle( const wxString& aTitle ) { m_title = aTitle; }
const wxString& GetTitle() const { return m_title; }
/**
* Function SetDate
* sets the date field, and defaults to the current time and date.
*/
void SetDate( const wxString& aDate = GenDate() ) { m_date = aDate; }
const wxString& GetDate() const { return m_date; }
void SetRevision( const wxString& aRevision ) { m_revision = aRevision; }
const wxString& GetRevision() const { return m_revision; }
void SetCompany( const wxString& aCompany ) { m_company = aCompany; }
const wxString& GetCompany() const { return m_company; }
void SetComment1( const wxString& aComment ) { m_comment1 = aComment; }
const wxString& GetComment1() const { return m_comment1; }
void SetComment2( const wxString& aComment ) { m_comment2 = aComment; }
const wxString& GetComment2() const { return m_comment2; }
void SetComment3( const wxString& aComment ) { m_comment3 = aComment; }
const wxString& GetComment3() const { return m_comment3; }
void SetComment4( const wxString& aComment ) { m_comment4 = aComment; }
const wxString& GetComment4() const { return m_comment4; }
void Clear()
{
m_title.clear();
m_date.clear();
m_revision.clear();
m_company.clear();
m_comment1.clear();
m_comment2.clear();
m_comment3.clear();
m_comment4.clear();
}
private:
wxString m_title;
wxString m_date;
wxString m_revision;
wxString m_company;
wxString m_comment1;
wxString m_comment2;
wxString m_comment3;
wxString m_comment4;
};
#endif // TITLE_BLOCK_H_
#ifndef HASHTABLES_H_
#define HASHTABLES_H_
// Declare some hashtables using a MACRO techique from here:
// http://docs.wxwidgets.org/trunk/classwx_hash_map.html
// This simplifies finding the correct hashtable header file.
// Ideally, std::unordered_map is what we are trying to use here,
// but its header file has been a moving target for some time.
// Let wx figure it out.
#include <wx/hashmap.h>
/**
* Class PROPERTIES
* is an associative array consisting of a key and value tuple.
*/
#if 1
// key: const char*
// value: wxString
WX_DECLARE_HASH_MAP( char*, wxString, wxStringHash, wxStringEqual, PROPERTIES );
#else
// key: wxString
// value: wxString
WX_DECLARE_STRING_HASH_MAP( wxString, PROPERTIES );
#endif
/**
* Class KEYWORD_MAP
* is a hashtable consisting of a key and a value tuple.
* Key is a C string and value is an integer.
*/
//WX_DECLARE_HASH_MAP( char*, int, wxStringHash, wxStringEqual, KEYWORD_MAP );
#endif // HASHTABLES_H_
#ifndef RICHIO_H_
#define RICHIO_H_
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
......@@ -23,9 +24,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef RICHIO_H_
#define RICHIO_H_
// This file defines 3 classes useful for working with DSN text files and is named
// "richio" after its author, Richard Hollenbeck, aka Dick Hollenbeck.
......
......@@ -119,6 +119,9 @@ public:
const wxPoint& GetOriginAxisPosition() const; // overload
void SetOriginAxisPosition( const wxPoint& aPosition ); // overload
const TITLE_BLOCK& GetTitleBlock() const; // overload
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ); // overload
/**
* Function SetBoard
* sets the m_Pcb member in such as way as to ensure deleting any previous
......
......@@ -74,6 +74,7 @@ class BASE_SCREEN;
class PARAM_CFG_BASE;
class PAGE_INFO;
class PLOTTER;
class TITLE_BLOCK;
enum id_librarytype {
LIBRARY_TYPE_EESCHEMA,
......@@ -462,6 +463,9 @@ public:
virtual const wxPoint& GetOriginAxisPosition() const = 0;
virtual void SetOriginAxisPosition( const wxPoint& aPosition ) = 0;
virtual const TITLE_BLOCK& GetTitleBlock() const = 0;
virtual void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) = 0;
int GetCursorShape() const { return m_cursorShape; }
void SetCursorShape( int aCursorShape ) { m_cursorShape = aCursorShape; }
......
......@@ -168,6 +168,20 @@ void PCB_BASE_FRAME::SetOriginAxisPosition( const wxPoint& aPosition )
}
const TITLE_BLOCK& PCB_BASE_FRAME::GetTitleBlock() const
{
wxASSERT( m_Pcb );
return m_Pcb->GetTitleBlock();
}
void PCB_BASE_FRAME::SetTitleBlock( const TITLE_BLOCK& aTitleBlock )
{
wxASSERT( m_Pcb );
m_Pcb->SetTitleBlock( aTitleBlock );
}
EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
{
wxASSERT( m_Pcb );
......@@ -618,11 +632,13 @@ void PCB_BASE_FRAME::SaveSettings()
}
void PCB_BASE_FRAME::OnModify( )
void PCB_BASE_FRAME::OnModify()
{
GetScreen()->SetModify();
GetScreen()->SetSave();
GetScreen()->m_Date = GenDate();
wxASSERT( m_Pcb );
m_Pcb->GetTitleBlock().SetDate();
}
......
......@@ -15,6 +15,7 @@
#include "class_colors_design_settings.h"
#include "class_board_design_settings.h"
#include "common.h" // PAGE_INFO
#include "class_title_block.h"
class PCB_BASE_FRAME;
class PCB_EDIT_FRAME;
......@@ -173,8 +174,9 @@ private:
NETINFO_LIST m_NetInfo; ///< net info list (name, design constraints ..
BOARD_DESIGN_SETTINGS m_designSettings;
COLORS_DESIGN_SETTINGS* m_colorsSettings; // Link to current colors settings
COLORS_DESIGN_SETTINGS* m_colorsSettings;
PAGE_INFO m_paper;
TITLE_BLOCK m_titles; ///< text in lower right of screen and plots
/// Position of the origin axis, which is used in exports mostly
wxPoint m_originAxisPosition;
......@@ -544,6 +546,9 @@ public:
const wxPoint& GetOriginAxisPosition() const { return m_originAxisPosition; }
void SetOriginAxisPosition( const wxPoint& aPosition ) { m_originAxisPosition = aPosition; }
TITLE_BLOCK& GetTitleBlock() { return m_titles; }
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; }
/**
* Function SetBoardSettings
* @return the current COLORS_DESIGN_SETTINGS in use
......
......@@ -683,12 +683,11 @@ static void CreateSignalsSection( FILE* aFile, BOARD* aPcb )
}
/* Creates the header section; some of the data come from the frame
* (actually the screen), not from the pcb */
// Creates the header section
static bool CreateHeaderInfoData( FILE* aFile, PCB_EDIT_FRAME* aFrame )
{
wxString msg;
PCB_SCREEN* screen = (PCB_SCREEN*) ( aFrame->GetScreen() );
PCB_SCREEN* screen = (PCB_SCREEN*) aFrame->GetScreen();
fputs( "$HEADER\n", aFile );
fputs( "GENCAD 1.4\n", aFile );
......@@ -698,16 +697,22 @@ static bool CreateHeaderInfoData( FILE* aFile, PCB_EDIT_FRAME* aFrame )
GetChars( wxGetApp().GetAppName() ),
GetChars( GetBuildVersion() ) );
fputs( TO_UTF8( msg ), aFile );
msg = wxT( "DRAWING \"" ) + screen->GetFileName() + wxT( "\"\n" );
fputs( TO_UTF8( msg ), aFile );
msg = wxT( "REVISION \"" ) + screen->m_Revision + wxT( " " ) +
screen->m_Date + wxT( "\"\n" );
const TITLE_BLOCK& tb = aFrame->GetTitleBlock();
msg = wxT( "REVISION \"" ) + tb.GetRevision() + wxT( " " ) + tb.GetDate() + wxT( "\"\n" );
fputs( TO_UTF8( msg ), aFile );
fputs( "UNITS INCH\n", aFile );
msg.Printf( wxT( "ORIGIN %g %g\n" ),
MapXTo( aFrame->GetOriginAxisPosition().x ),
MapYTo( aFrame->GetOriginAxisPosition().y ) );
fputs( TO_UTF8( msg ), aFile );
fputs( "INTERTRACK 0\n", aFile );
fputs( "$ENDHEADER\n\n", aFile );
......
......@@ -420,10 +420,13 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
GetScreen()->SetFileName( aFileName );
}
/* If changes are made, update the board date */
// If changes are made, update the board date
if( GetScreen()->IsModify() )
{
GetScreen()->m_Date = GenDate();
TITLE_BLOCK tb = GetTitleBlock();
tb.SetDate();
SetTitleBlock( tb );
}
pcbFileName = GetScreen()->GetFileName();
......@@ -480,9 +483,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
PROPERTIES props;
// wanting wxWidgets 2.9.x which can actually create a wxString() from
// a const char*, so don't have to use wxT()
props[ wxT("header") ] = header;
props["header"] = header;
IO_MGR::Save( IO_MGR::KICAD, pcbFileName.GetFullPath(), GetBoard(), &props );
}
......
......@@ -25,13 +25,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <wx/string.h>
#include <wx/hashmap.h>
#include <richio.h>
// http://docs.wxwidgets.org/trunk/classwx_hash_map.html
WX_DECLARE_STRING_HASH_MAP( wxString, PROPERTIES );
#include <hashtables.h>
class BOARD;
class PLUGIN;
......
......@@ -838,7 +838,7 @@ bool PCB_EDIT_FRAME::WriteGeneralDescrPcb( FILE* File )
* @param screen BASE_SCREEN to save
* @param File = an open FILE to write info
*/
static bool WriteSheetDescr( const PAGE_INFO& aPageSettings, BASE_SCREEN* screen, FILE* File )
static bool WriteSheetDescr( const PAGE_INFO& aPageSettings, const TITLE_BLOCK& aTitleBlock, FILE* File )
{
fprintf( File, "$SHEETDESCR\n" );
fprintf( File, "Sheet %s %d %d\n",
......@@ -846,14 +846,14 @@ static bool WriteSheetDescr( const PAGE_INFO& aPageSettings, BASE_SCREEN* screen
aPageSettings.GetSizeMils().x,
aPageSettings.GetSizeMils().y );
fprintf( File, "Title %s\n", EscapedUTF8( screen->m_Title ).c_str() );
fprintf( File, "Date %s\n", EscapedUTF8( screen->m_Date ).c_str() );
fprintf( File, "Rev %s\n", EscapedUTF8( screen->m_Revision ).c_str() );
fprintf( File, "Comp %s\n", EscapedUTF8( screen->m_Company ).c_str() );
fprintf( File, "Comment1 %s\n", EscapedUTF8( screen->m_Commentaire1 ).c_str() );
fprintf( File, "Comment2 %s\n", EscapedUTF8( screen->m_Commentaire2 ).c_str() );
fprintf( File, "Comment3 %s\n", EscapedUTF8( screen->m_Commentaire3 ).c_str() );
fprintf( File, "Comment4 %s\n", EscapedUTF8( screen->m_Commentaire4 ).c_str() );
fprintf( File, "Title %s\n", EscapedUTF8( aTitleBlock.GetTitle() ).c_str() );
fprintf( File, "Date %s\n", EscapedUTF8( aTitleBlock.GetDate() ).c_str() );
fprintf( File, "Rev %s\n", EscapedUTF8( aTitleBlock.GetRevision() ).c_str() );
fprintf( File, "Comp %s\n", EscapedUTF8( aTitleBlock.GetCompany() ).c_str() );
fprintf( File, "Comment1 %s\n", EscapedUTF8( aTitleBlock.GetComment1() ).c_str() );
fprintf( File, "Comment2 %s\n", EscapedUTF8( aTitleBlock.GetComment2() ).c_str() );
fprintf( File, "Comment3 %s\n", EscapedUTF8( aTitleBlock.GetComment3() ).c_str() );
fprintf( File, "Comment4 %s\n", EscapedUTF8( aTitleBlock.GetComment4() ).c_str() );
fprintf( File, "$EndSHEETDESCR\n\n" );
return true;
......@@ -862,16 +862,20 @@ static bool WriteSheetDescr( const PAGE_INFO& aPageSettings, BASE_SCREEN* screen
#if !defined( USE_NEW_PCBNEW_LOAD )
static bool ReadSheetDescr( BOARD* aBoard, BASE_SCREEN* screen, LINE_READER* aReader )
static bool ReadSheetDescr( BOARD* aBoard, LINE_READER* aReader )
{
char buf[1024];
char buf[1024];
TITLE_BLOCK tb;
while( aReader->ReadLine() )
{
char* line = aReader->Line();
if( strnicmp( line, "$End", 4 ) == 0 )
{
aBoard->SetTitleBlock( tb );
return true;
}
if( strnicmp( line, "Sheet", 4 ) == 0 )
{
......@@ -920,56 +924,56 @@ static bool ReadSheetDescr( BOARD* aBoard, BASE_SCREEN* screen, LINE_READER* aRe
if( strnicmp( line, "Title", 2 ) == 0 )
{
ReadDelimitedText( buf, line, 256 );
screen->m_Title = FROM_UTF8( buf );
tb.SetTitle( FROM_UTF8( buf ) );
continue;
}
if( strnicmp( line, "Date", 2 ) == 0 )
{
ReadDelimitedText( buf, line, 256 );
screen->m_Date = FROM_UTF8( buf );
tb.SetDate( FROM_UTF8( buf ) );
continue;
}
if( strnicmp( line, "Rev", 2 ) == 0 )
{
ReadDelimitedText( buf, line, 256 );
screen->m_Revision = FROM_UTF8( buf );
tb.SetRevision( FROM_UTF8( buf ) );
continue;
}
if( strnicmp( line, "Comp", 4 ) == 0 )
{
ReadDelimitedText( buf, line, 256 );
screen->m_Company = FROM_UTF8( buf );
tb.SetCompany( FROM_UTF8( buf ) );
continue;
}
if( strnicmp( line, "Comment1", 8 ) == 0 )
{
ReadDelimitedText( buf, line, 256 );
screen->m_Commentaire1 = FROM_UTF8( buf );
tb.SetComment1( FROM_UTF8( buf ) );
continue;
}
if( strnicmp( line, "Comment2", 8 ) == 0 )
{
ReadDelimitedText( buf, line, 256 );
screen->m_Commentaire2 = FROM_UTF8( buf );
tb.SetComment2( FROM_UTF8( buf ) );
continue;
}
if( strnicmp( line, "Comment3", 8 ) == 0 )
{
ReadDelimitedText( buf, line, 256 );
screen->m_Commentaire3 = FROM_UTF8( buf );
tb.SetComment3( FROM_UTF8( buf ) );
continue;
}
if( strnicmp( line, "Comment4", 8 ) == 0 )
{
ReadDelimitedText( buf, line, 256 );
screen->m_Commentaire4 = FROM_UTF8( buf );
tb.SetComment4( FROM_UTF8( buf ) );
continue;
}
}
......@@ -1111,7 +1115,7 @@ int PCB_EDIT_FRAME::ReadPcbFile( LINE_READER* aReader, bool Append )
if( TESTLINE( "SHEETDESCR" ) )
{
ReadSheetDescr( board, GetScreen(), aReader );
ReadSheetDescr( board, aReader );
continue;
}
......@@ -1187,7 +1191,7 @@ int PCB_EDIT_FRAME::SavePcbFormatAscii( FILE* aFile )
GetBoard()->SetCurrentNetClass( GetBoard()->m_NetClasses.GetDefault()->GetName() );
WriteGeneralDescrPcb( aFile );
WriteSheetDescr( GetBoard()->GetPageSettings(), GetScreen(), aFile );
WriteSheetDescr( GetBoard()->GetPageSettings(), GetBoard()->GetTitleBlock(), aFile );
WriteSetup( aFile, this, GetBoard() );
rc = GetBoard()->Save( aFile );
......
......@@ -439,7 +439,8 @@ void KICAD_PLUGIN::loadGENERAL()
void KICAD_PLUGIN::loadSHEET()
{
char buf[260];
char buf[260];
TITLE_BLOCK tb;
while( READLINE() )
{
......@@ -488,56 +489,56 @@ void KICAD_PLUGIN::loadSHEET()
else if( TESTLINE( "Title" ) )
{
ReadDelimitedText( buf, line, sizeof(buf) );
#if 0 // @todo "screen" not available here
screen->m_Title = FROM_UTF8( buf );
tb.SetTitle( FROM_UTF8( buf ) );
}
else if( TESTLINE( "Date" ) )
{
ReadDelimitedText( buf, line, sizeof(buf) );
screen->m_Date = FROM_UTF8( buf );
tb.SetDate( FROM_UTF8( buf ) );
}
else if( TESTLINE( "Rev" ) )
{
ReadDelimitedText( buf, line, sizeof(buf) );
screen->m_Revision = FROM_UTF8( buf );
tb.SetRevision( FROM_UTF8( buf ) );
}
else if( TESTLINE( "Comp" ) )
{
ReadDelimitedText( buf, line, sizeof(buf) );
screen->m_Company = FROM_UTF8( buf );
tb.SetCompany( FROM_UTF8( buf ) );
}
else if( TESTLINE( "Comment1" ) )
{
ReadDelimitedText( buf, line, sizeof(buf) );
screen->m_Commentaire1 = FROM_UTF8( buf );
tb.SetComment1( FROM_UTF8( buf ) );
}
else if( TESTLINE( "Comment2" ) )
{
ReadDelimitedText( buf, line, sizeof(buf) );
screen->m_Commentaire2 = FROM_UTF8( buf );
tb.SetComment2( FROM_UTF8( buf ) );
}
else if( TESTLINE( "Comment3" ) )
{
ReadDelimitedText( buf, line, sizeof(buf) );
screen->m_Commentaire3 = FROM_UTF8( buf );
tb.SetComment3( FROM_UTF8( buf ) );
}
else if( TESTLINE( "Comment4" ) )
{
ReadDelimitedText( buf, line, sizeof(buf) );
screen->m_Commentaire4 = FROM_UTF8( buf );
#endif
tb.SetComment4( FROM_UTF8( buf ) );
}
else if( TESTLINE( "$EndSHEETDESCR" ) )
{
m_board->SetTitleBlock( tb );
return; // preferred exit
}
}
THROW_IO_ERROR( "Missing '$EndSHEETDESCR'" );
......@@ -2654,7 +2655,7 @@ void KICAD_PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, PROPERTIES* a
if( m_props )
{
// save a file header, if caller provided one (with trailing \n hopefully).
fprintf( m_fp, "%s", TO_UTF8( (*m_props)[ wxT("header") ] ) );
fprintf( m_fp, "%s", TO_UTF8( (*m_props)["header"] ) );
}
saveAllSections();
......@@ -2733,7 +2734,8 @@ void KICAD_PLUGIN::saveGENERAL() const
void KICAD_PLUGIN::saveSHEET() const
{
const PAGE_INFO& pageInfo = m_board->GetPageSettings();
const PAGE_INFO& pageInfo = m_board->GetPageSettings();
const TITLE_BLOCK& tb = m_board->GetTitleBlock();
fprintf( m_fp, "$SHEETDESCR\n" );
......@@ -2743,18 +2745,14 @@ void KICAD_PLUGIN::saveSHEET() const
pageInfo.GetSizeMils().x,
pageInfo.GetSizeMils().y );
#if 0 // @todo sheet not available here. The sheet needs to go into the board if it is important enough to be saved with the board
fprintf( m_fp, "Title %s\n", EscapedUTF8( screen->m_Title ).c_str() );
fprintf( m_fp, "Date %s\n", EscapedUTF8( screen->m_Date ).c_str() );
fprintf( m_fp, "Rev %s\n", EscapedUTF8( screen->m_Revision ).c_str() );
fprintf( m_fp, "Comp %s\n", EscapedUTF8( screen->m_Company ).c_str() );
fprintf( m_fp, "Comment1 %s\n", EscapedUTF8( screen->m_Commentaire1 ).c_str() );
fprintf( m_fp, "Comment2 %s\n", EscapedUTF8( screen->m_Commentaire2 ).c_str() );
fprintf( m_fp, "Comment3 %s\n", EscapedUTF8( screen->m_Commentaire3 ).c_str() );
fprintf( m_fp, "Comment4 %s\n", EscapedUTF8( screen->m_Commentaire4 ).c_str() );
#endif
fprintf( m_fp, "Title %s\n", EscapedUTF8( tb.GetTitle() ).c_str() );
fprintf( m_fp, "Date %s\n", EscapedUTF8( tb.GetDate() ).c_str() );
fprintf( m_fp, "Rev %s\n", EscapedUTF8( tb.GetRevision() ).c_str() );
fprintf( m_fp, "Comp %s\n", EscapedUTF8( tb.GetCompany() ).c_str() );
fprintf( m_fp, "Comment1 %s\n", EscapedUTF8( tb.GetComment1() ).c_str() );
fprintf( m_fp, "Comment2 %s\n", EscapedUTF8( tb.GetComment2() ).c_str() );
fprintf( m_fp, "Comment3 %s\n", EscapedUTF8( tb.GetComment3() ).c_str() );
fprintf( m_fp, "Comment4 %s\n", EscapedUTF8( tb.GetComment4() ).c_str() );
fprintf( m_fp, "$EndSHEETDESCR\n\n" );
}
......
......@@ -29,6 +29,7 @@
#include "plot_common.h"
#include "macros.h"
#define PLOT_LINEWIDTH_MIN 0
#define PLOT_LINEWIDTH_MAX 200
#define HPGL_PEN_DIAMETER_MIN 0
......@@ -392,27 +393,28 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) throw( IO_
bool PCB_PLOT_PARAMS_PARSER::ParseBool() throw( IO_ERROR )
{
T token;
token = NeedSYMBOL();
T token = NeedSYMBOL();
if( token != T_false && token != T_true )
Expecting( "true|false" );
return (token == T_true);
return token == T_true;
}
int PCB_PLOT_PARAMS_PARSER::ParseInt( int aMin, int aMax ) throw( IO_ERROR )
{
T token;
int i;
token = NextTok();
T token = NextTok();
if( token != T_NUMBER )
Expecting( T_NUMBER );
i = atoi( CurText() );
if( i < aMin )
i = aMin;
else if( i > aMax )
i = aMax;
int val = atoi( CurText() );
if( val < aMin )
val = aMin;
else if( val > aMax )
val = aMax;
return i;
return val;
}
#ifndef PCB_PLOT_PARAMS_H_
#define PCB_PLOT_PARAMS_H_
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
......@@ -22,19 +23,12 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef PCB_PLOT_PARAMS_H_
#define PCB_PLOT_PARAMS_H_
#include <wx/wx.h>
#include "base_struct.h"
#include "pcb_plot_params_lexer.h"
#include "base_struct.h"
class PCB_PLOT_PARAMS;
class PCB_PLOT_PARAMS_PARSER;
extern PCB_PLOT_PARAMS g_PcbPlotOptions;
/**
* Class PCB_PLOT_PARAMS
* handles plot parameters and options when plotting/printing a board.
......@@ -43,31 +37,32 @@ class PCB_PLOT_PARAMS
{
friend class PCB_PLOT_PARAMS_PARSER;
public:
bool m_ExcludeEdgeLayer; // True: do not plot edge layer when plotting other layers
// False: Edge layer always plotted (merged) when plotting other layers
bool m_ExcludeEdgeLayer; ///< True: do not plot edge layer when plotting other layers
///< False: Edge layer always plotted (merged) when plotting other layers
int m_PlotLineWidth;
bool m_PlotFrameRef; // True to plot/print frame references
bool m_PlotViaOnMaskLayer; // True if vias are drawn on Mask layer
// (ie protected by mask)
EDA_DRAW_MODE_T m_PlotMode; // LINE, FILLED or SKETCH: select how to plot filled objects.
// depending on plot format or layers, all options are not always allowed
bool m_PlotFrameRef; ///< True to plot/print frame references
bool m_PlotViaOnMaskLayer; ///< True if vias are drawn on Mask layer
///< (ie protected by mask)
EDA_DRAW_MODE_T m_PlotMode; ///< LINE, FILLED or SKETCH: select how to plot filled objects.
///< depending on plot format or layers, all options are not always allowed
int m_HPGLPenNum;
int m_HPGLPenSpeed;
int m_HPGLPenDiam;
int m_HPGLPenOvr;
int m_PlotPSColorOpt; // True for color Postscript output
bool m_PlotPSNegative; // True to create a negative board ps plot
int m_PlotPSColorOpt; ///< True for color Postscript output
bool m_PlotPSNegative; ///< True to create a negative board ps plot
// Flags to enable or disable ploting of various PCB elements.
bool m_SkipNPTH_Pads; // true to disable plot NPTH pads if hole and size have same value
// GERBER only
// Flags to enable or disable ploting of various PCB elements.
bool m_SkipNPTH_Pads; ///< true to disable plot NPTH pads if hole and size have same value
///< GERBER only
bool m_PlotReference;
bool m_PlotValue;
bool m_PlotTextOther;
bool m_PlotInvisibleTexts;
bool m_PlotPadsOnSilkLayer; // allows pads outlines on silkscreen layer (when pads are also o, silk screen
bool m_PlotPadsOnSilkLayer; ///< allows pads outlines on silkscreen layer (when pads are also o, silk screen
int m_PlotFormat; // id for plot format (see enum PlotFormat in plot_common.h) */
int m_PlotFormat; ///< id for plot format (see enum PlotFormat in plot_common.h) */
bool m_PlotMirror;
enum DrillShapeOptT {
......@@ -75,18 +70,21 @@ public:
SMALL_DRILL_SHAPE = 1,
FULL_DRILL_SHAPE = 2
};
DrillShapeOptT m_DrillShapeOpt; // For postscript output: holes can be not plotted,
// or have a small size or plotted with their actual size
bool m_AutoScale; // If true, use the better scale to fit in page
double m_PlotScale; // The global scale factor. a 1.0 scale factor plot a board
// with its actual size.
DrillShapeOptT m_DrillShapeOpt; ///< For postscript output: holes can be not plotted,
///< or have a small size or plotted with their actual size
bool m_AutoScale; ///< If true, use the better scale to fit in page
double m_PlotScale; ///< The global scale factor. a 1.0 scale factor plot a board
///< with its actual size.
// These next two scale factors are intended to compensable plotters (and mainly printers) X and Y scale error.
// Therefore they are expected very near 1.0
// Only X and Y dimensions are adjusted: circles are plotted as circle, even if X and Y fine scale differ.
double m_FineScaleAdjustX; // fine scale adjust X axis
double m_FineScaleAdjustY; // dine scale adjust Y axis
// These width factor is intended to compensate plotters (and mainly printers) line width error.
double m_FineScaleAdjustX; ///< fine scale adjust X axis
double m_FineScaleAdjustY; ///< dine scale adjust Y axis
/// This width factor is intended to compensate printers and plotters that do
/// not strictly obey line width settings.
double m_FineWidthAdjust;
private:
......@@ -158,4 +156,7 @@ public:
int ParseInt( int aMin, int aMax ) throw( IO_ERROR );
};
extern PCB_PLOT_PARAMS g_PcbPlotOptions;
#endif // PCB_PLOT_PARAMS_H_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment