Commit 005a13fe authored by Alexander Zakamaldin's avatar Alexander Zakamaldin Committed by Dick Hollenbeck

Alexander's patches, with refinements from Dick

parents acc07c33 625e964c
......@@ -17,6 +17,7 @@ Marco Serantoni <marco.serantoni[at]gmail-dot-com> (OSX maintener)
Rok Markovic <rok[at]kanardia.eu>
Tim Hanson <sideskate[at]gmail-dot-com>
Vesa Solonen <vesa.solonen[at]hut-dot-fi>
Alexander Zakamaldin <zaka62[at]mail.ru>
See also CHANGELOG.txt for contributors.
......
......@@ -25,34 +25,60 @@
#include <common.h>
// late arriving wxPAPER_A0, wxPAPER_A1
#if wxABI_VERSION >= 20999
#define PAPER_A0 wxPAPER_A0
#define PAPER_A1 wxPAPER_A1
#else
#define PAPER_A0 wxPAPER_A2
#define PAPER_A1 wxPAPER_A2
#endif
// Standard paper sizes nicknames.
const wxString PAGE_INFO::A4( wxT( "A4" ) );
const wxString PAGE_INFO::A3( wxT( "A3" ) );
const wxString PAGE_INFO::A2( wxT( "A2" ) );
const wxString PAGE_INFO::A1( wxT( "A1" ) );
const wxString PAGE_INFO::A0( wxT( "A0" ) );
const wxString PAGE_INFO::A( wxT( "A" ) );
const wxString PAGE_INFO::B( wxT( "B" ) );
const wxString PAGE_INFO::C( wxT( "C" ) );
const wxString PAGE_INFO::D( wxT( "D" ) );
const wxString PAGE_INFO::E( wxT( "E" ) );
const wxString PAGE_INFO::GERBER( wxT( "GERBER" ) );
const wxString PAGE_INFO::USLetter( wxT( "USLetter" ) );
const wxString PAGE_INFO::USLegal( wxT( "USLegal" ) );
const wxString PAGE_INFO::USLedger( wxT( "USLedger" ) );
const wxString PAGE_INFO::Custom( wxT( "User" ) );
// Standard page sizes in mils, all constants
// see: https://lists.launchpad.net/kicad-developers/msg07389.html
// also see: wx/defs.h
// A4 see: https://lists.launchpad.net/kicad-developers/msg07389.html
#if defined(KICAD_GOST)
const PAGE_INFO PAGE_INFO::pageA4( wxSize( 8268, 11693 ), wxT( "A4" ) );
#else
const PAGE_INFO PAGE_INFO::pageA4( wxSize( 11693, 8268 ), wxT( "A4" ) );
#endif
// local readability macro for millimeter wxSize
#define MMsize( x, y ) wxSize( Mm2mils( x ), Mm2mils( y ) )
const PAGE_INFO PAGE_INFO::pageA3( wxSize( 16535, 11700 ), wxT( "A3" ) );
const PAGE_INFO PAGE_INFO::pageA2( wxSize( 23400, 16535 ), wxT( "A2" ) );
const PAGE_INFO PAGE_INFO::pageA1( wxSize( 33070, 23400 ), wxT( "A1" ) );
const PAGE_INFO PAGE_INFO::pageA0( wxSize( 46800, 33070 ), wxT( "A0" ) );
const PAGE_INFO PAGE_INFO::pageA( wxSize( 11000, 8500 ), wxT( "A" ) );
const PAGE_INFO PAGE_INFO::pageB( wxSize( 17000, 11000 ), wxT( "B" ) );
const PAGE_INFO PAGE_INFO::pageC( wxSize( 22000, 17000 ), wxT( "C" ) );
const PAGE_INFO PAGE_INFO::pageD( wxSize( 34000, 22000 ), wxT( "D" ) );
const PAGE_INFO PAGE_INFO::pageE( wxSize( 44000, 34000 ), wxT( "E" ) );
const PAGE_INFO PAGE_INFO::pageGERBER( wxSize( 32000, 32000 ), wxT( "GERBER" ) );
const PAGE_INFO PAGE_INFO::pageUser( wxSize( 17000, 11000 ), Custom );
// All MUST be defined as landscape. If IsGOST() is true, A4 is dynamically rotated later.
const PAGE_INFO PAGE_INFO::pageA4( MMsize( 297, 210 ), wxT( "A4" ), wxPAPER_A4 );
const PAGE_INFO PAGE_INFO::pageA3( MMsize( 420, 297 ), wxT( "A3" ), wxPAPER_A3 );
const PAGE_INFO PAGE_INFO::pageA2( MMsize( 594, 420 ), wxT( "A2" ), wxPAPER_A2 );
const PAGE_INFO PAGE_INFO::pageA1( MMsize( 841, 594 ), wxT( "A1" ), PAPER_A1 );
const PAGE_INFO PAGE_INFO::pageA0( MMsize( 1189, 841 ), wxT( "A0" ), PAPER_A0 );
const PAGE_INFO PAGE_INFO::pageA( wxSize( 11000, 8500 ), wxT( "A" ), wxPAPER_LETTER );
const PAGE_INFO PAGE_INFO::pageB( wxSize( 17000, 11000 ), wxT( "B" ), wxPAPER_TABLOID );
const PAGE_INFO PAGE_INFO::pageC( wxSize( 22000, 17000 ), wxT( "C" ), wxPAPER_CSHEET );
const PAGE_INFO PAGE_INFO::pageD( wxSize( 34000, 22000 ), wxT( "D" ), wxPAPER_DSHEET );
const PAGE_INFO PAGE_INFO::pageE( wxSize( 44000, 34000 ), wxT( "E" ), wxPAPER_ESHEET );
const PAGE_INFO PAGE_INFO::pageGERBER( wxSize( 32000, 32000 ), wxT( "GERBER" ), wxPAPER_NONE );
const PAGE_INFO PAGE_INFO::pageUser( wxSize( 17000, 11000 ), Custom, wxPAPER_NONE );
// US paper sizes
const PAGE_INFO PAGE_INFO::pageUSLetter( wxSize( 11000, 8500 ), wxT( "USLetter" ) );
const PAGE_INFO PAGE_INFO::pageUSLegal( wxSize( 14000, 8500 ), wxT( "USLegal" ) );
const PAGE_INFO PAGE_INFO::pageUSLedger( wxSize( 17000, 11000 ), wxT( "USLedger" ) );
const PAGE_INFO PAGE_INFO::pageUSLetter( wxSize( 11000, 8500 ), wxT( "USLetter" ), wxPAPER_LETTER );
const PAGE_INFO PAGE_INFO::pageUSLegal( wxSize( 14000, 8500 ), wxT( "USLegal" ), wxPAPER_LEGAL );
const PAGE_INFO PAGE_INFO::pageUSLedger( wxSize( 17000, 11000 ), wxT( "USLedger" ), wxPAPER_TABLOID );
// Custom paper size for next instantiation of type "User"
int PAGE_INFO::s_user_width = 17000;
......@@ -96,45 +122,52 @@ inline void PAGE_INFO::updatePortrait()
}
void PAGE_INFO::setMargins()
{
if( IsGOST() )
{
m_left_margin = Mm2mils( 20 ); // 20mm
m_right_margin = // 5mm
m_top_margin = // 5mm
m_bottom_margin = Mm2mils( 5 ); // 5mm
}
else
{
m_left_margin =
m_right_margin =
m_top_margin =
m_bottom_margin = 400;
}
}
PAGE_INFO::PAGE_INFO( const wxSize& aSizeMils, const wxString& aType ) :
PAGE_INFO::PAGE_INFO( const wxSize& aSizeMils, const wxString& aType, wxPaperSize aPaperId ) :
m_type( aType ),
m_size( aSizeMils )
m_size( aSizeMils ),
m_paper_id( aPaperId )
{
updatePortrait();
#if defined(KICAD_GOST)
/*
#define GOST_LEFTMARGIN 800 // 20mm
#define GOST_RIGHTMARGIN 200 // 5mm
#define GOST_TOPMARGIN 200 // 5mm
#define GOST_BOTTOMMARGIN 200 // 5mm
*/
m_left_margin = 800; // 20mm
m_right_margin = 200; // 5mm
m_top_margin = 200; // 5mm
m_bottom_margin = 200; // 5mm
#else
m_left_margin =
m_right_margin =
m_top_margin =
m_bottom_margin = 400;
#endif
setMargins();
updatePortrait();
// This constructor is protected, and only used by const PAGE_INFO's known
// only to class implementation, so no further changes to "this" object are
// expected. Therefore we should also setMargin() again when copying this
// object in SetType() so that a runtime IsGOST() change does not break.
}
PAGE_INFO::PAGE_INFO( const wxString& aType )
PAGE_INFO::PAGE_INFO( const wxString& aType, bool IsPortrait )
{
SetType( aType );
SetType( aType, IsPortrait );
}
bool PAGE_INFO::SetType( const wxString& aType )
bool PAGE_INFO::SetType( const wxString& aType, bool IsPortrait )
{
bool rc = true;
// all are landscape initially
if( aType == pageA4.GetType() )
*this = pageA4;
else if( aType == pageA3.GetType() )
......@@ -178,6 +211,15 @@ bool PAGE_INFO::SetType( const wxString& aType )
else
rc = false;
if( IsPortrait )
{
// all private PAGE_INFOs are landscape, must swap x and y
m_size = wxSize( m_size.y, m_size.x );
updatePortrait();
}
setMargins();
return rc;
}
......@@ -218,6 +260,7 @@ static int clampWidth( int aWidthInMils )
static int clampHeight( int aHeightInMils )
{
/* was giving EESCHEMA single component SVG plotter grief
clamping is best done at the UI, i.e. dialog, levels
if( aHeightInMils < 4000 )
aHeightInMils = 4000;
else if( aHeightInMils > 44000 )
......@@ -227,13 +270,13 @@ static int clampHeight( int aHeightInMils )
}
void PAGE_INFO::SetUserWidthMils( int aWidthInMils )
void PAGE_INFO::SetCustomWidthMils( int aWidthInMils )
{
s_user_width = clampWidth( aWidthInMils );
}
void PAGE_INFO::SetUserHeightMils( int aHeightInMils )
void PAGE_INFO::SetCustomHeightMils( int aHeightInMils )
{
s_user_height = clampHeight( aHeightInMils );
}
......@@ -241,14 +284,28 @@ void PAGE_INFO::SetUserHeightMils( int aHeightInMils )
void PAGE_INFO::SetWidthMils( int aWidthInMils )
{
m_size.x = clampWidth( aWidthInMils );
updatePortrait();
if( m_size.x != aWidthInMils )
{
m_size.x = clampWidth( aWidthInMils );
m_type = Custom;
m_paper_id = wxPAPER_NONE;
updatePortrait();
}
}
void PAGE_INFO::SetHeightMils( int aHeightInMils )
{
m_size.y = clampHeight( aHeightInMils );
updatePortrait();
if( m_size.y != aHeightInMils )
{
m_size.y = clampHeight( aHeightInMils );
m_type = Custom;
m_paper_id = wxPAPER_NONE;
updatePortrait();
}
}
......@@ -57,6 +57,19 @@ EDA_UNITS_T g_UserUnit;
int g_GhostColor;
#if defined(KICAD_GOST)
static bool s_gost = true;
#else
static bool s_gost = false;
#endif
bool IsGOST()
{
return s_gost;
}
/**
* The predefined colors used in KiCad.
* Please: if you change a value, remember these values are carefully chosen
......
......@@ -604,3 +604,22 @@ void PS_PLOTTER::flash_pad_trapez( wxPoint aPadPos, wxPoint aCorners[4],
cornerList.push_back( cornerList[0] );
PlotPoly( cornerList, ( aTrace_Mode == FILLED ) ? FILLED_SHAPE : NO_FILL );
}
void PS_PLOTTER::user_to_device_coordinates( wxPoint& pos )
{
if( pageInfo.IsPortrait() )
{
pos.y = (int) ( ( paper_size.y - ( pos.y - plot_offset.y )
* plot_scale ) * device_scale );
if( plotMirror )
pos.x = (int) ( ( paper_size.x - ( pos.x - plot_offset.x )
* plot_scale ) * device_scale );
else
pos.x = (int) ( (pos.x - plot_offset.x) * plot_scale * device_scale );
}
else
PLOTTER::user_to_device_coordinates( pos );
}
/**
* @file dialog_page_settings.cpp
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 1992-2010 Kicad Developers, see AUTHORS.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
*/
/* The "Page Settings" dialog box created by this file (and setpage.h)
* contains seven checkboxes which *are* shown when that dialog box is
* invoked in Eeschema, but which are *not* shown when that dialog box is
* invoked in Pcbnew instead.
/**
* @file dialog_page_settings.cpp
*/
#include <fctsys.h>
#include <macros.h> // DIM()
#include <common.h>
#include <gr_basic.h>
#include <base_struct.h>
#include <class_drawpanel.h>
#include <class_title_block.h>
......@@ -43,11 +62,13 @@ void EDA_DRAW_FRAME::Process_PageSettings( wxCommandEvent& event )
DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* parent ) :
DIALOG_PAGES_SETTINGS_BASE( parent ),
m_user_size( PAGE_INFO::Custom )
m_initialized( false )
{
m_Parent = parent;
m_Screen = m_Parent->GetScreen();
m_modified = false;
m_page_bitmap = NULL;
m_tb = m_Parent->GetTitleBlock();
initDialog();
......@@ -58,14 +79,16 @@ DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS( EDA_DRAW_FRAME* parent ) :
DIALOG_PAGES_SETTINGS::~DIALOG_PAGES_SETTINGS()
{
if( m_page_bitmap )
delete m_page_bitmap;
}
void DIALOG_PAGES_SETTINGS::initDialog()
{
wxString msg;
double userSizeX;
double userSizeY;
double customSizeX;
double customSizeY;
SetFocus();
......@@ -83,52 +106,38 @@ void DIALOG_PAGES_SETTINGS::initDialog()
m_TextSheetNumber->Show(false);
#endif
const PAGE_INFO& pageInfo = m_Parent->GetPageSettings();
if( !pageInfo.IsCustom() )
m_orientationComboBox->SetSelection( pageInfo.IsPortrait() );
setCurrentPageSizeSelection( pageInfo.GetType() );
m_pageInfo = m_Parent->GetPageSettings();
SetCurrentPageSizeSelection( m_pageInfo.GetType() );
m_orientationComboBox->SetSelection( m_pageInfo.IsPortrait() );
// only a click fires the "selection changed" event, so have to fabricate this check
wxCommandEvent dummy;
onPaperSizeChoice( dummy );
OnPaperSizeChoice( dummy );
switch( g_UserUnit )
{
case MILLIMETRES:
userSizeX = m_user_size.GetWidthMils() * 25.4e-3;
userSizeY = m_user_size.GetHeightMils() * 25.4e-3;
customSizeX = m_pageInfo.GetCustomWidthMils() * 25.4e-3;
customSizeY = m_pageInfo.GetCustomHeightMils()* 25.4e-3;
msg.Printf( wxT( "%.2f" ), userSizeX );
msg.Printf( wxT( "%.2f" ), customSizeX );
m_TextUserSizeX->SetValue( msg );
msg.Printf( wxT( "%.2f" ), userSizeY );
msg.Printf( wxT( "%.2f" ), customSizeY );
m_TextUserSizeY->SetValue( msg );
break;
default:
case INCHES:
userSizeX = m_user_size.GetWidthMils() / 1000.0;
userSizeY = m_user_size.GetHeightMils() / 1000.0;
customSizeX = m_pageInfo.GetCustomWidthMils() / 1000.0;
customSizeY = m_pageInfo.GetCustomHeightMils() / 1000.0;
msg.Printf( wxT( "%.3f" ), userSizeX );
msg.Printf( wxT( "%.3f" ), customSizeX );
m_TextUserSizeX->SetValue( msg );
msg.Printf( wxT( "%.3f" ), userSizeY );
m_TextUserSizeY->SetValue( msg );
break;
/* // you want it in mils, why?
case UNSCALED_UNITS:
userSizeX = m_user_size.GetWidthMils();
userSizeY = m_user_size.GetHeightMils();
msg.Printf( wxT( "%f" ), m_userSizeX );
m_TextUserSizeX->SetValue( msg );
msg.Printf( wxT( "%f" ), m_userSizeY );
msg.Printf( wxT( "%.3f" ), customSizeY );
m_TextUserSizeY->SetValue( msg );
break;
*/
}
#if 0
......@@ -140,16 +149,13 @@ void DIALOG_PAGES_SETTINGS::initDialog()
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() );
m_TextRevision->SetValue( m_tb.GetRevision() );
m_TextTitle->SetValue( m_tb.GetTitle() );
m_TextCompany->SetValue( m_tb.GetCompany() );
m_TextComment1->SetValue( m_tb.GetComment1() );
m_TextComment2->SetValue( m_tb.GetComment2() );
m_TextComment3->SetValue( m_tb.GetComment3() );
m_TextComment4->SetValue( m_tb.GetComment4() );
#endif
#ifndef EESCHEMA
......@@ -162,8 +168,12 @@ void DIALOG_PAGES_SETTINGS::initDialog()
m_Comment4Export->Show( false );
#endif
GetPageLayoutInfoFromDialog();
UpdatePageLayoutExample();
// Make the OK button the default.
m_sdbSizer1OK->SetDefault();
m_initialized = true;
}
......@@ -204,9 +214,13 @@ void DIALOG_PAGES_SETTINGS::OnCloseWindow( wxCloseEvent& event )
void DIALOG_PAGES_SETTINGS::OnOkClick( wxCommandEvent& event )
{
m_save_flag = false;
SavePageSettings( event );
if( m_save_flag )
{
m_modified = true;
Close( true );
}
}
......@@ -216,88 +230,233 @@ void DIALOG_PAGES_SETTINGS::OnCancelClick( wxCommandEvent& event )
}
void DIALOG_PAGES_SETTINGS::onPaperSizeChoice( wxCommandEvent& event )
void DIALOG_PAGES_SETTINGS::OnPaperSizeChoice( wxCommandEvent& event )
{
if( m_paperSizeComboBox->GetStringSelection().Contains( PAGE_INFO::Custom ) )
wxString paperType = m_paperSizeComboBox->GetStringSelection();
if( paperType.Contains( PAGE_INFO::Custom ) )
{
m_orientationComboBox->Enable( false );
m_TextUserSizeX->Enable( true );
m_TextUserSizeY->Enable( true );
}
else
{
m_orientationComboBox->Enable( true );
if( paperType.Contains( wxT( "A4" ) ) && IsGOST() )
{
m_orientationComboBox->SetStringSelection( _( "Portrait" ) );
m_orientationComboBox->Enable( false );
}
m_TextUserSizeX->Enable( false );
m_TextUserSizeY->Enable( false );
}
GetPageLayoutInfoFromDialog();
UpdatePageLayoutExample();
}
void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
void DIALOG_PAGES_SETTINGS::OnUserPageSizeXTextUpdated( wxCommandEvent& event )
{
wxString msg;
double userSizeX;
double userSizeY;
TITLE_BLOCK tb;
if( m_initialized && m_TextUserSizeX->IsModified() )
{
GetPageLayoutInfoFromDialog();
UpdatePageLayoutExample();
}
}
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() );
m_Parent->SetTitleBlock( tb );
void DIALOG_PAGES_SETTINGS::OnUserPageSizeYTextUpdated( wxCommandEvent& event )
{
if( m_initialized && m_TextUserSizeY->IsModified() )
{
GetPageLayoutInfoFromDialog();
UpdatePageLayoutExample();
}
}
msg = m_TextUserSizeX->GetValue();
msg.ToDouble( &userSizeX );
msg = m_TextUserSizeY->GetValue();
msg.ToDouble( &userSizeY );
void DIALOG_PAGES_SETTINGS::OnPageOrientationChoice( wxCommandEvent& event )
{
if( m_initialized )
{
GetPageLayoutInfoFromDialog();
UpdatePageLayoutExample();
}
}
switch( g_UserUnit )
void DIALOG_PAGES_SETTINGS::OnRevisionTextUpdated( wxCommandEvent& event )
{
if( m_initialized && m_TextRevision->IsModified() )
{
case MILLIMETRES:
PAGE_INFO::SetUserWidthMils( int( userSizeX * 1000.0 / 25.4 ) );
PAGE_INFO::SetUserHeightMils( int( userSizeY * 1000.0 / 25.4 ) );
break;
GetPageLayoutInfoFromDialog();
m_tb.SetRevision( m_TextRevision->GetValue() );
UpdatePageLayoutExample();
}
}
default:
case INCHES:
PAGE_INFO::SetUserWidthMils( int( 1000 * userSizeX ) );
PAGE_INFO::SetUserHeightMils( int( 1000 * userSizeY ) );
break;
/* // set in 1/1000ths of an inch, but why?
case UNSCALED_UNITS:
PAGE_INFO::SetUserWidthMils( (int) userSizeX );
PAGE_INFO::SetUserHeightMils( (int) userSizeY );
break;
*/
void DIALOG_PAGES_SETTINGS::OnTitleTextUpdated( wxCommandEvent& event )
{
if( m_initialized && m_TextTitle->IsModified() )
{
GetPageLayoutInfoFromDialog();
m_tb.SetTitle( m_TextTitle->GetValue() );
UpdatePageLayoutExample();
}
}
// wxFormBuilder must use "A4", "A3", etc for choices, in all languages/translations
wxString paperType = m_paperSizeComboBox->GetStringSelection();
// construct pageInfo _after_ user settings have been established in case the
// paperType is custom, otherwise User width and height will not go into effect right away.
PAGE_INFO pageInfo;
void DIALOG_PAGES_SETTINGS::OnCompanyTextUpdated( wxCommandEvent& event )
{
if( m_initialized && m_TextCompany->IsModified() )
{
GetPageLayoutInfoFromDialog();
m_tb.SetCompany( m_TextCompany->GetValue() );
UpdatePageLayoutExample();
}
}
void DIALOG_PAGES_SETTINGS::OnComment1TextUpdated( wxCommandEvent& event )
{
if( m_initialized && m_TextComment1->IsModified() )
{
GetPageLayoutInfoFromDialog();
m_tb.SetComment1( m_TextComment1->GetValue() );
UpdatePageLayoutExample();
}
}
void DIALOG_PAGES_SETTINGS::OnComment2TextUpdated( wxCommandEvent& event )
{
if( m_initialized && m_TextComment2->IsModified() )
{
GetPageLayoutInfoFromDialog();
m_tb.SetComment2( m_TextComment2->GetValue() );
UpdatePageLayoutExample();
}
}
void DIALOG_PAGES_SETTINGS::OnComment3TextUpdated( wxCommandEvent& event )
{
if( m_initialized && m_TextComment3->IsModified() )
{
GetPageLayoutInfoFromDialog();
m_tb.SetComment3( m_TextComment3->GetValue() );
UpdatePageLayoutExample();
}
}
void DIALOG_PAGES_SETTINGS::OnComment4TextUpdated( wxCommandEvent& event )
{
if( m_initialized && m_TextComment4->IsModified() )
{
GetPageLayoutInfoFromDialog();
m_tb.SetComment4( m_TextComment4->GetValue() );
UpdatePageLayoutExample();
}
}
void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
{
bool retSuccess;
m_save_flag = true;
// wxFormBuilder must use "A4", "A3", etc for choices, in all languages/translations
const wxString paperType = m_paperSizeComboBox->GetStringSelection();
// here we assume translators will keep original paper size spellings
if( paperType.Contains( PAGE_INFO::Custom ) )
{
pageInfo.SetType( PAGE_INFO::Custom );
GetCustomSizeMilsFromDialog();
retSuccess = m_pageInfo.SetType( PAGE_INFO::Custom );
if( retSuccess )
{
if( m_layout_size.x < MIN_PAGE_SIZE || m_layout_size.y < MIN_PAGE_SIZE ||
m_layout_size.x > MAX_PAGE_SIZE || m_layout_size.y > MAX_PAGE_SIZE )
{
wxString msg = wxString::Format( _( "Selected custom paper size\nis out of the permissible \
limits\n%.1f - %.1f %s!\nSelect another custom paper size?" ),
g_UserUnit == INCHES ? MIN_PAGE_SIZE / 1000. : MIN_PAGE_SIZE * 25.4 / 1000,
g_UserUnit == INCHES ? MAX_PAGE_SIZE / 1000. : MAX_PAGE_SIZE * 25.4 / 1000,
g_UserUnit == INCHES ? _( "inches" ) : _( "mm" ) );
if( wxMessageBox( msg, _( "Warning!" ), wxYES_NO | wxICON_EXCLAMATION, this ) == wxYES )
{
m_save_flag = false;
return;
}
m_layout_size.x = Clamp( MIN_PAGE_SIZE, m_layout_size.x, MAX_PAGE_SIZE );
m_layout_size.y = Clamp( MIN_PAGE_SIZE, m_layout_size.y, MAX_PAGE_SIZE );
}
PAGE_INFO::SetCustomWidthMils( m_layout_size.x );
PAGE_INFO::SetCustomHeightMils( m_layout_size.y );
}
}
else
{
// here we assume translators will keep original paper size spellings
if( !pageInfo.SetType( paperType ) )
// search for longest common string first, e.g. A4 before A
if( paperType.Contains( PAGE_INFO::USLetter ) )
retSuccess = m_pageInfo.SetType( PAGE_INFO::USLetter );
else if( paperType.Contains( PAGE_INFO::USLegal ) )
retSuccess = m_pageInfo.SetType( PAGE_INFO::USLegal );
else if( paperType.Contains( PAGE_INFO::USLedger ) )
retSuccess = m_pageInfo.SetType( PAGE_INFO::USLedger );
else if( paperType.Contains( PAGE_INFO::GERBER ) )
retSuccess = m_pageInfo.SetType( PAGE_INFO::GERBER );
else if( paperType.Contains( PAGE_INFO::A4 ) )
retSuccess = m_pageInfo.SetType( PAGE_INFO::A4 );
else if( paperType.Contains( PAGE_INFO::A3 ) )
retSuccess = m_pageInfo.SetType( PAGE_INFO::A3 );
else if( paperType.Contains( PAGE_INFO::A2 ) )
retSuccess = m_pageInfo.SetType( PAGE_INFO::A2 );
else if( paperType.Contains( PAGE_INFO::A1 ) )
retSuccess = m_pageInfo.SetType( PAGE_INFO::A1 );
else if( paperType.Contains( PAGE_INFO::A0 ) )
retSuccess = m_pageInfo.SetType( PAGE_INFO::A0 );
else if( paperType.Contains( PAGE_INFO::A ) )
retSuccess = m_pageInfo.SetType( PAGE_INFO::A );
else if( paperType.Contains( PAGE_INFO::B ) )
retSuccess = m_pageInfo.SetType( PAGE_INFO::B );
else if( paperType.Contains( PAGE_INFO::C ) )
retSuccess = m_pageInfo.SetType( PAGE_INFO::C );
else if( paperType.Contains( PAGE_INFO::D ) )
retSuccess = m_pageInfo.SetType( PAGE_INFO::D );
else if( paperType.Contains( PAGE_INFO::E ) )
retSuccess = m_pageInfo.SetType( PAGE_INFO::E );
if( retSuccess )
{
wxASSERT_MSG( false, wxT( "the translation for paper size must preserve original spellings" ) );
int choice = m_orientationComboBox->GetSelection();
m_pageInfo.SetPortrait( choice != 0 );
}
}
// set portrait _after_ setting size/type above
int choice = m_orientationComboBox->GetSelection();
pageInfo.SetPortrait( choice );
if( !retSuccess )
{
wxASSERT_MSG( false, wxT( "the translation for paper size must preserve original spellings" ) );
m_pageInfo.SetType( PAGE_INFO::A4 );
}
m_Parent->SetPageSettings( pageInfo );
m_Parent->SetPageSettings( m_pageInfo );
m_tb.SetRevision( m_TextRevision->GetValue() );
m_tb.SetCompany( m_TextCompany->GetValue() );
m_tb.SetTitle( m_TextTitle->GetValue() );
m_tb.SetComment1( m_TextComment1->GetValue() );
m_tb.SetComment2( m_TextComment2->GetValue() );
m_tb.SetComment3( m_TextComment3->GetValue() );
m_tb.SetComment4( m_TextComment4->GetValue() );
m_Parent->SetTitleBlock( m_tb );
#ifdef EESCHEMA
// Exports settings to other sheets if requested:
......@@ -315,25 +474,25 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
TITLE_BLOCK tb2 = screen->GetTitleBlock();
if( m_RevisionExport->IsChecked() )
tb2.SetRevision( tb.GetRevision() );
tb2.SetRevision( m_tb.GetRevision() );
if( m_TitleExport->IsChecked() )
tb2.SetTitle( tb.GetTitle() );
tb2.SetTitle( m_tb.GetTitle() );
if( m_CompanyExport->IsChecked() )
tb2.SetCompany( tb.GetCompany() );
tb2.SetCompany( m_tb.GetCompany() );
if( m_Comment1Export->IsChecked() )
tb2.SetComment1( tb.GetComment1() );
tb2.SetComment1( m_tb.GetComment1() );
if( m_Comment2Export->IsChecked() )
tb2.SetComment2( tb.GetComment2() );
tb2.SetComment2( m_tb.GetComment2() );
if( m_Comment3Export->IsChecked() )
tb2.SetComment3( tb.GetComment3() );
tb2.SetComment3( m_tb.GetComment3() );
if( m_Comment4Export->IsChecked() )
tb2.SetComment4( tb.GetComment4() );
tb2.SetComment4( m_tb.GetComment4() );
screen->SetTitleBlock( tb2 );
}
......@@ -345,12 +504,11 @@ void DIALOG_PAGES_SETTINGS::SavePageSettings( wxCommandEvent& event )
}
void DIALOG_PAGES_SETTINGS::setCurrentPageSizeSelection( const wxString& aPaperSize )
void DIALOG_PAGES_SETTINGS::SetCurrentPageSizeSelection( const wxString& aPaperSize )
{
// use wxFormBuilder to store the sheet type in the wxRadioButton's label
// use wxChoice to store the sheet type in the wxChoice's choice
// i.e. "A4", "A3", etc, anywhere within the text of the label.
D(printf("m_paperSizeComboBox->GetCount() = %d\n", (int) m_paperSizeComboBox->GetCount() );)
// D(printf("m_paperSizeComboBox->GetCount() = %d\n", (int) m_paperSizeComboBox->GetCount() );)
// search all the child wxRadioButtons for a label containing our paper type
for( unsigned i = 0; i < m_paperSizeComboBox->GetCount(); ++i )
......@@ -369,3 +527,178 @@ void DIALOG_PAGES_SETTINGS::setCurrentPageSizeSelection( const wxString& aPaperS
}
}
void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample()
{
int lyWidth, lyHeight;
wxSize clamped_layout_size( Clamp( MIN_PAGE_SIZE, m_layout_size.x, MAX_PAGE_SIZE ),
Clamp( MIN_PAGE_SIZE, m_layout_size.y, MAX_PAGE_SIZE ) );
double lyRatio = clamped_layout_size.x < clamped_layout_size.y ?
(double) clamped_layout_size.y / clamped_layout_size.x :
(double) clamped_layout_size.x / clamped_layout_size.y;
if( clamped_layout_size.x < clamped_layout_size.y )
{
lyHeight = MAX_PAGE_EXAMPLE_SIZE;
lyWidth = wxRound( (double) lyHeight / lyRatio );
}
else
{
lyWidth = MAX_PAGE_EXAMPLE_SIZE;
lyHeight = wxRound( (double) lyWidth / lyRatio );
}
if( m_page_bitmap )
{
m_PageLayoutExampleBitmap->SetBitmap( wxNullBitmap );
delete m_page_bitmap;
}
m_page_bitmap = new wxBitmap( lyWidth + 1, lyHeight + 1 );
if( m_page_bitmap->IsOk() )
{
// Save current clip box and temporary expand it.
EDA_RECT save_clip_box = *m_Parent->GetCanvas()->GetClipBox();
m_Parent->GetCanvas()->SetClipBox( EDA_RECT( wxPoint( 0, 0 ),
wxSize( INT_MAX / 2, INT_MAX / 2 ) ) );
// Calculate layout preview scale.
int appScale = m_Parent->GetInternalUnits() / 1000;
double scaleW = (double) lyWidth / clamped_layout_size.x / appScale;
double scaleH = (double) lyHeight / clamped_layout_size.y / appScale;
// Prepare DC.
wxSize example_size( lyWidth, lyHeight );
wxMemoryDC memDC;
memDC.SetClippingRegion( wxPoint( 0, 0 ), example_size );
memDC.SelectObject( *m_page_bitmap );
memDC.Clear();
memDC.SetUserScale( scaleW, scaleH );
// Get logical page size and margins.
PAGE_INFO pageDUMMY;
pageDUMMY.SetWidthMils( clamped_layout_size.x );
pageDUMMY.SetHeightMils( clamped_layout_size.y );
wxSize dummySize = pageDUMMY.GetSizeMils();
wxPoint pointLeftTop( pageDUMMY.GetLeftMarginMils(), pageDUMMY.GetTopMarginMils() );
wxPoint pointRightBottom( pageDUMMY.GetRightMarginMils(), pageDUMMY.GetBottomMarginMils() );
// Draw layout preview.
wxString emptyString;
GRResetPenAndBrush( ( wxDC* ) &memDC );
m_Parent->TraceWorkSheet( (wxDC*) &memDC, dummySize, pointLeftTop, pointRightBottom,
emptyString, emptyString, m_tb, m_Screen->m_NumberOfScreen,
m_Screen->m_ScreenNumber, 1, LIGHTGRAY, RED );
memDC.SelectObject( wxNullBitmap );
m_PageLayoutExampleBitmap->SetBitmap( *m_page_bitmap );
// Restore current clip box.
m_Parent->GetCanvas()->SetClipBox( save_clip_box );
// Refresh the dialog.
Layout();
Refresh();
}
}
void DIALOG_PAGES_SETTINGS::GetPageLayoutInfoFromDialog()
{
// wxFormBuilder must use "A4", "A3", etc for choices, in all languages/translations
const wxString paperType = m_paperSizeComboBox->GetStringSelection();
// here we assume translators will keep original paper size spellings
if( paperType.Contains( PAGE_INFO::Custom ) )
{
GetCustomSizeMilsFromDialog();
if( m_layout_size.x && m_layout_size.y )
{
if( m_layout_size.x < m_layout_size.y )
m_orientationComboBox->SetStringSelection( _( "Portrait" ) );
else
m_orientationComboBox->SetStringSelection( _( "Landscape" ) );
}
}
else
{
PAGE_INFO pageInfo; // SetType() later to lookup size
static const wxString* papers[] = {
// longest common string first, since sequential search below
&PAGE_INFO::A4,
&PAGE_INFO::A3,
&PAGE_INFO::A2,
&PAGE_INFO::A1,
&PAGE_INFO::A0,
&PAGE_INFO::A,
&PAGE_INFO::B,
&PAGE_INFO::C,
&PAGE_INFO::D,
&PAGE_INFO::E,
//&PAGE_INFO::GERBER,
&PAGE_INFO::USLetter,
&PAGE_INFO::USLegal,
&PAGE_INFO::USLedger,
};
unsigned i;
for( i=0; i < DIM( papers ); ++i )
{
if( paperType.Contains( *papers[i] ) )
{
pageInfo.SetType( *papers[i] );
break;
}
}
wxASSERT( i != DIM(papers) ); // dialog UI match the above list?
m_layout_size = pageInfo.GetSizeMils();
// swap sizes to match orientation
bool isPortrait = (bool) m_orientationComboBox->GetSelection();
if( ( isPortrait && m_layout_size.x >= m_layout_size.y ) ||
( !isPortrait && m_layout_size.x < m_layout_size.y ) )
{
m_layout_size.Set( m_layout_size.y, m_layout_size.x );
}
}
}
void DIALOG_PAGES_SETTINGS::GetCustomSizeMilsFromDialog()
{
double customSizeX;
double customSizeY;
wxString msg;
msg = m_TextUserSizeX->GetValue();
msg.ToDouble( &customSizeX );
msg = m_TextUserSizeY->GetValue();
msg.ToDouble( &customSizeY );
switch( g_UserUnit )
{
case MILLIMETRES:
customSizeX *= 1000. / 25.4;
customSizeY *= 1000. / 25.4;
break;
default:
case INCHES:
customSizeX *= 1000.;
customSizeY *= 1000.;
}
// Prepare to painless double -> int conversion.
customSizeX = Clamp( double( INT_MIN ), customSizeX, double( INT_MAX ) );
customSizeY = Clamp( double( INT_MIN ), customSizeY, double( INT_MAX ) );
m_layout_size = wxSize( wxRound( customSizeX ), wxRound( customSizeY ) );
}
/////////////////////////////////////////////////////////////////////////////
// Name: setpage.h
/////////////////////////////////////////////////////////////////////////////
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 1992-2010 <Creator>
* Copyright (C) 1992-2010 Kicad Developers, see AUTHORS.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
*/
#ifndef _DIALOG_PAGES_SETTINGS_H_
#define _DIALOG_PAGES_SETTINGS_H_
#include <dialog_page_settings_base.h>
#define MAX_PAGE_EXAMPLE_SIZE 200
/*!
* DIALOG_PAGES_SETTINGS class declaration
*/
......@@ -16,10 +38,15 @@ class DIALOG_PAGES_SETTINGS: public DIALOG_PAGES_SETTINGS_BASE
private:
EDA_DRAW_FRAME* m_Parent;
BASE_SCREEN* m_Screen;
bool m_initialized;
bool m_modified;
PAGE_INFO m_user_size; ///< instantiated just to get the size
bool m_save_flag;
wxBitmap* m_page_bitmap; /// Temporary bitmap for the page layout example.
wxSize m_layout_size; /// Logical page layout size.
PAGE_INFO m_pageInfo; /// Temporary page info.
TITLE_BLOCK m_tb; /// Temporary title block (basic inscriptions).
static wxSize s_LastSize; ///< last position and size
static wxSize s_LastSize; /// Last position and size.
static wxPoint s_LastPos;
public:
......@@ -47,11 +74,51 @@ private:
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
void OnCancelClick( wxCommandEvent& event );
void setCurrentPageSizeSelection( const wxString& aPaperSize );
void SavePageSettings(wxCommandEvent& event);
void ReturnSizeSelected(wxCommandEvent& event);
/// exEVT_COMMAND_CHOICE_SELECTED event handler for ID_CHICE_PAGE_SIZE
void OnPaperSizeChoice( wxCommandEvent& event );
/// exEVT_COMMAND_TEXT_UPDATED event handler for ID_TEXTCTRL_USER_PAGE_SIZE_X
void OnUserPageSizeXTextUpdated( wxCommandEvent& event );
/// exEVT_COMMAND_TEXT_UPDATED event handler for ID_TEXTCTRL_USER_PAGE_SIZE_Y
void OnUserPageSizeYTextUpdated( wxCommandEvent& event );
/// exEVT_COMMAND_CHOICE_SELECTED event handler for ID_CHOICE_PAGE_ORIENTATION
void OnPageOrientationChoice( wxCommandEvent& event );
/// exEVT_COMMAND_TEXT_UPDATED event handler for ID_TEXTCTRL_REVISION
void OnRevisionTextUpdated( wxCommandEvent& event );
/// exEVT_COMMAND_TEXT_UPDATED event handler for ID_TEXTCTRL_TITLE
void OnTitleTextUpdated( wxCommandEvent& event );
/// exEVT_COMMAND_TEXT_UPDATED event handler for ID_TEXTCTRL_COMPANY
void OnCompanyTextUpdated( wxCommandEvent& event );
/// exEVT_COMMAND_TEXT_UPDATED event handler for ID_TEXTCTRL_COMMENT1
void OnComment1TextUpdated( wxCommandEvent& event );
/// exEVT_COMMAND_TEXT_UPDATED event handler for ID_TEXTCTRL_COMMENT2
void OnComment2TextUpdated( wxCommandEvent& event );
/// exEVT_COMMAND_TEXT_UPDATED event handler for ID_TEXTCTRL_COMMENT3
void OnComment3TextUpdated( wxCommandEvent& event );
/// exEVT_COMMAND_TEXT_UPDATED event handler for ID_TEXTCTRL_COMMENT4
void OnComment4TextUpdated( wxCommandEvent& event );
void SetCurrentPageSizeSelection( const wxString& aPaperSize );
void SavePageSettings( wxCommandEvent& event );
/// Update page layout example
void UpdatePageLayoutExample();
/// Get page layout info from selected dialog items
void GetPageLayoutInfoFromDialog();
void onPaperSizeChoice( wxCommandEvent& event );
/// Get custom page size in mils from dialog
void GetCustomSizeMilsFromDialog();
};
#endif // _DIALOG_PAGES_SETTINGS_H_
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 6 2011)
// C++ code generated with wxFormBuilder (version Feb 9 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -20,65 +20,99 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
bUpperSizerH = new wxBoxSizer( wxHORIZONTAL );
wxFlexGridSizer* LeftColumnSizer;
LeftColumnSizer = new wxFlexGridSizer( 6, 1, 0, 0 );
LeftColumnSizer = new wxFlexGridSizer( 3, 1, 0, 0 );
LeftColumnSizer->AddGrowableRow( 0 );
LeftColumnSizer->AddGrowableRow( 1 );
LeftColumnSizer->AddGrowableRow( 2 );
LeftColumnSizer->SetFlexibleDirection( wxBOTH );
LeftColumnSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
wxStaticBoxSizer* sbSizer9;
sbSizer9 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Paper Size:") ), wxVERTICAL );
wxStaticBoxSizer* PaperSizer;
PaperSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Paper") ), wxVERTICAL );
wxString m_paperSizeComboBoxChoices[] = { _("A4"), _("A3"), _("A2"), _("A1"), _("A0"), _("A"), _("B"), _("C"), _("D"), _("E"), _("USLetter"), _("USLegal"), _("USLedger"), _("User (Custom)") };
m_staticText5 = new wxStaticText( this, wxID_ANY, _("Size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText5->Wrap( -1 );
PaperSizer->Add( m_staticText5, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
wxString m_paperSizeComboBoxChoices[] = { _("A4 210x297mm"), _("A3 297x420mm"), _("A2 420x594mm"), _("A1 594x841mm"), _("A0 841x1189mm"), _("A 8.5x11in"), _("B 11x17in"), _("C 17x22in"), _("D 22x34in"), _("E 34x44in"), _("USLetter 8.5x11in"), _("USLegal 8.5x14in"), _("USLedger 11x17in"), _("User (Custom)") };
int m_paperSizeComboBoxNChoices = sizeof( m_paperSizeComboBoxChoices ) / sizeof( wxString );
m_paperSizeComboBox = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_paperSizeComboBoxNChoices, m_paperSizeComboBoxChoices, 0 );
m_paperSizeComboBox = new wxChoice( this, ID_CHICE_PAGE_SIZE, wxDefaultPosition, wxDefaultSize, m_paperSizeComboBoxNChoices, m_paperSizeComboBoxChoices, 0 );
m_paperSizeComboBox->SetSelection( 0 );
sbSizer9->Add( m_paperSizeComboBox, 0, wxALL|wxEXPAND, 5 );
PaperSizer->Add( m_paperSizeComboBox, 0, wxALL|wxEXPAND, 5 );
LeftColumnSizer->Add( sbSizer9, 0, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* sbSizer8;
sbSizer8 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Orientation:") ), wxVERTICAL );
m_staticText6 = new wxStaticText( this, wxID_ANY, _("Orientation:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText6->Wrap( -1 );
PaperSizer->Add( m_staticText6, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
wxString m_orientationComboBoxChoices[] = { _("Landscape"), _("Portrait") };
int m_orientationComboBoxNChoices = sizeof( m_orientationComboBoxChoices ) / sizeof( wxString );
m_orientationComboBox = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_orientationComboBoxNChoices, m_orientationComboBoxChoices, 0 );
m_orientationComboBox = new wxChoice( this, ID_CHOICE_PAGE_ORIENTATION, wxDefaultPosition, wxDefaultSize, m_orientationComboBoxNChoices, m_orientationComboBoxChoices, 0 );
m_orientationComboBox->SetSelection( 0 );
sbSizer8->Add( m_orientationComboBox, 0, wxALL|wxEXPAND, 5 );
LeftColumnSizer->Add( sbSizer8, 0, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* sbSizer10;
sbSizer10 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Custom Page Size:") ), wxVERTICAL );
wxBoxSizer* bSizerXsize;
bSizerXsize = new wxBoxSizer( wxVERTICAL );
UserPageSizeX = new wxStaticText( this, wxID_ANY, _("Width:"), wxDefaultPosition, wxDefaultSize, 0 );
UserPageSizeX->Wrap( -1 );
bSizerXsize->Add( UserPageSizeX, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_TextUserSizeX = new wxTextCtrl( this, ID_TEXTCTRL_USER_PAGE_SIZE_X, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizerXsize->Add( m_TextUserSizeX, 0, wxALIGN_LEFT|wxALIGN_TOP|wxALL|wxEXPAND, 5 );
sbSizer10->Add( bSizerXsize, 1, wxALIGN_TOP|wxALL|wxEXPAND, 5 );
wxBoxSizer* bSizerYsize;
bSizerYsize = new wxBoxSizer( wxVERTICAL );
UserPageSizeY = new wxStaticText( this, wxID_ANY, _("Height:"), wxDefaultPosition, wxDefaultSize, 0 );
UserPageSizeY->Wrap( -1 );
bSizerYsize->Add( UserPageSizeY, 0, wxALIGN_TOP|wxALL, 5 );
m_TextUserSizeY = new wxTextCtrl( this, ID_TEXTCTRL_USER_PAGE_SIZE_Y, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
bSizerYsize->Add( m_TextUserSizeY, 0, wxALIGN_TOP|wxALL|wxEXPAND, 5 );
sbSizer10->Add( bSizerYsize, 1, wxALIGN_TOP|wxALL|wxEXPAND, 5 );
LeftColumnSizer->Add( sbSizer10, 1, wxALL|wxEXPAND, 5 );
bUpperSizerH->Add( LeftColumnSizer, 0, wxEXPAND, 5 );
PaperSizer->Add( m_orientationComboBox, 0, wxEXPAND|wxALL, 5 );
PaperSizer->Add( 0, 10, 0, 0, 5 );
wxStaticBoxSizer* CustomPaperSizer;
CustomPaperSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Custom Size") ), wxHORIZONTAL );
CustomPaperSizer->Add( 5, 0, 1, wxEXPAND, 5 );
wxStaticBoxSizer* CustomPaperWidth;
CustomPaperWidth = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Width:") ), wxVERTICAL );
m_TextUserSizeX = new wxTextCtrl( this, ID_TEXTCTRL_USER_PAGE_SIZE_X, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_LEFT );
m_TextUserSizeX->SetMaxLength( 6 );
m_TextUserSizeX->SetToolTip( _("Custom paper width.") );
CustomPaperWidth->Add( m_TextUserSizeX, 0, wxALIGN_LEFT|wxALIGN_TOP|wxALL|wxEXPAND, 5 );
CustomPaperSizer->Add( CustomPaperWidth, 0, wxEXPAND, 5 );
CustomPaperSizer->Add( 10, 0, 1, wxEXPAND, 5 );
wxStaticBoxSizer* CustomPaperHeight;
CustomPaperHeight = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Height:") ), wxVERTICAL );
m_TextUserSizeY = new wxTextCtrl( this, ID_TEXTCTRL_USER_PAGE_SIZE_Y, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_LEFT );
m_TextUserSizeY->SetMaxLength( 6 );
m_TextUserSizeY->SetToolTip( _("Custom paper height.") );
CustomPaperHeight->Add( m_TextUserSizeY, 0, wxALIGN_TOP|wxALL|wxEXPAND, 5 );
CustomPaperSizer->Add( CustomPaperHeight, 0, wxEXPAND, 5 );
CustomPaperSizer->Add( 5, 50, 0, 0, 5 );
PaperSizer->Add( CustomPaperSizer, 1, wxEXPAND, 5 );
LeftColumnSizer->Add( PaperSizer, 1, wxALL, 5 );
wxStaticBoxSizer* PageLayoutExampleSizer;
PageLayoutExampleSizer = new wxStaticBoxSizer( new wxStaticBox( this, ID_PAGE_LAYOUT_EXAMPLE_SIZER, _("Layout Preview") ), wxVERTICAL );
PageLayoutExampleSizer->SetMinSize( wxSize( 240,-1 ) );
m_PageLayoutExampleBitmap = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( -1,-1 ), wxFULL_REPAINT_ON_RESIZE|wxSIMPLE_BORDER );
m_PageLayoutExampleBitmap->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
m_PageLayoutExampleBitmap->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) );
PageLayoutExampleSizer->Add( m_PageLayoutExampleBitmap, 0, wxALIGN_CENTER|wxALL, 5 );
LeftColumnSizer->Add( PageLayoutExampleSizer, 0, wxALIGN_CENTER|wxALL|wxEXPAND, 5 );
LeftColumnSizer->Add( 0, 1, 1, wxEXPAND, 5 );
bUpperSizerH->Add( LeftColumnSizer, 0, wxALL|wxEXPAND, 5 );
wxFlexGridSizer* RightColumnSizer;
RightColumnSizer = new wxFlexGridSizer( 8, 1, 0, 0 );
......@@ -94,6 +128,10 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
RightColumnSizer->SetFlexibleDirection( wxBOTH );
RightColumnSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
wxStaticBoxSizer* BasicInscriptionsSizer;
BasicInscriptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Basic Inscriptions") ), wxVERTICAL );
BasicInscriptionsSizer->SetMinSize( wxSize( -1,452 ) );
wxBoxSizer* SheetInfoSizer;
SheetInfoSizer = new wxBoxSizer( wxHORIZONTAL );
......@@ -108,10 +146,11 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
m_TextSheetNumber->Wrap( -1 );
SheetInfoSizer->Add( m_TextSheetNumber, 0, wxALL, 5 );
RightColumnSizer->Add( SheetInfoSizer, 1, 0, 5 );
BasicInscriptionsSizer->Add( SheetInfoSizer, 0, 0, 5 );
wxStaticBoxSizer* RevisionSizer;
RevisionSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Revision:") ), wxHORIZONTAL );
RevisionSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Revision") ), wxHORIZONTAL );
m_TextRevision = new wxTextCtrl( this, ID_TEXTCTRL_REVISION, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_TextRevision->SetMinSize( wxSize( 100,-1 ) );
......@@ -119,87 +158,98 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
RevisionSizer->Add( m_TextRevision, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_RevisionExport = new wxCheckBox( this, ID_CHECKBOX_REVISION, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
RevisionSizer->Add( m_RevisionExport, 0, wxALL, 5 );
RevisionSizer->Add( m_RevisionExport, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
RightColumnSizer->Add( RevisionSizer, 1, wxEXPAND, 5 );
BasicInscriptionsSizer->Add( RevisionSizer, 1, wxEXPAND, 5 );
wxStaticBoxSizer* TitleSizer;
TitleSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Title:") ), wxHORIZONTAL );
TitleSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Title") ), wxHORIZONTAL );
m_TextTitle = new wxTextCtrl( this, ID_TEXTCTRL_TITLE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_TextTitle->SetMinSize( wxSize( 400,-1 ) );
m_TextTitle->SetMinSize( wxSize( 360,-1 ) );
TitleSizer->Add( m_TextTitle, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_TitleExport = new wxCheckBox( this, wxID_ANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
TitleSizer->Add( m_TitleExport, 0, wxALL, 5 );
RightColumnSizer->Add( TitleSizer, 1, wxEXPAND, 5 );
BasicInscriptionsSizer->Add( TitleSizer, 1, wxEXPAND, 5 );
wxStaticBoxSizer* CompanySizer;
CompanySizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Company:") ), wxHORIZONTAL );
CompanySizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Company") ), wxHORIZONTAL );
m_TextCompany = new wxTextCtrl( this, ID_TEXTCTRL_COMPANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_TextCompany->SetMinSize( wxSize( 400,-1 ) );
m_TextCompany->SetMinSize( wxSize( 360,-1 ) );
CompanySizer->Add( m_TextCompany, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_CompanyExport = new wxCheckBox( this, ID_CHECKBOX_COMPANY, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
CompanySizer->Add( m_CompanyExport, 0, wxALL, 5 );
RightColumnSizer->Add( CompanySizer, 1, wxEXPAND, 5 );
BasicInscriptionsSizer->Add( CompanySizer, 1, wxEXPAND, 5 );
wxStaticBoxSizer* Comment1Sizer;
Comment1Sizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Comment1:") ), wxHORIZONTAL );
Comment1Sizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Comment1") ), wxHORIZONTAL );
m_TextComment1 = new wxTextCtrl( this, ID_TEXTCTRL_COMMENT1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_TextComment1->SetMinSize( wxSize( 400,-1 ) );
m_TextComment1->SetMinSize( wxSize( 360,-1 ) );
Comment1Sizer->Add( m_TextComment1, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_Comment1Export = new wxCheckBox( this, ID_CHECKBOX_COMMENT1, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
Comment1Sizer->Add( m_Comment1Export, 0, wxALL, 5 );
RightColumnSizer->Add( Comment1Sizer, 1, wxEXPAND, 5 );
BasicInscriptionsSizer->Add( Comment1Sizer, 1, wxEXPAND, 5 );
wxStaticBoxSizer* Comment2Sizer;
Comment2Sizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Comment2:") ), wxHORIZONTAL );
Comment2Sizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Comment2") ), wxHORIZONTAL );
m_TextComment2 = new wxTextCtrl( this, ID_TEXTCTRL_COMMENT2, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_TextComment2->SetMinSize( wxSize( 400,-1 ) );
m_TextComment2->SetMinSize( wxSize( 360,-1 ) );
Comment2Sizer->Add( m_TextComment2, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_Comment2Export = new wxCheckBox( this, ID_CHECKBOX_COMMENT2, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
Comment2Sizer->Add( m_Comment2Export, 0, wxALL, 5 );
RightColumnSizer->Add( Comment2Sizer, 1, wxEXPAND, 5 );
BasicInscriptionsSizer->Add( Comment2Sizer, 1, wxEXPAND, 5 );
wxStaticBoxSizer* Comment3Sizer;
Comment3Sizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Comment3:") ), wxHORIZONTAL );
Comment3Sizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Comment3") ), wxHORIZONTAL );
m_TextComment3 = new wxTextCtrl( this, ID_TEXTCTRL_COMMENT3, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_TextComment3->SetMinSize( wxSize( 400,-1 ) );
m_TextComment3->SetMinSize( wxSize( 360,-1 ) );
Comment3Sizer->Add( m_TextComment3, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_Comment3Export = new wxCheckBox( this, ID_CHECKBOX_COMMENT3, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
Comment3Sizer->Add( m_Comment3Export, 0, wxALL, 5 );
RightColumnSizer->Add( Comment3Sizer, 1, wxEXPAND, 5 );
BasicInscriptionsSizer->Add( Comment3Sizer, 1, wxEXPAND, 5 );
wxStaticBoxSizer* Comment4Sizer;
Comment4Sizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Comment4:") ), wxHORIZONTAL );
Comment4Sizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Comment4") ), wxHORIZONTAL );
m_TextComment4 = new wxTextCtrl( this, ID_TEXTCTRL_COMMENT4, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_TextComment4->SetMinSize( wxSize( 400,-1 ) );
m_TextComment4->SetMinSize( wxSize( 360,-1 ) );
Comment4Sizer->Add( m_TextComment4, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_Comment4Export = new wxCheckBox( this, ID_CHECKBOX_COMMENT4, _("Export to other sheets"), wxDefaultPosition, wxDefaultSize, 0 );
Comment4Sizer->Add( m_Comment4Export, 0, wxALL, 5 );
RightColumnSizer->Add( Comment4Sizer, 1, wxEXPAND, 5 );
BasicInscriptionsSizer->Add( Comment4Sizer, 1, wxEXPAND, 5 );
RightColumnSizer->Add( BasicInscriptionsSizer, 1, wxALL|wxEXPAND, 5 );
bUpperSizerH->Add( RightColumnSizer, 1, wxALL|wxEXPAND, 5 );
......@@ -211,18 +261,27 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
bMainSizer->Add( m_sdbSizer1, 0, wxEXPAND|wxALIGN_RIGHT|wxALL, 5 );
bMainSizer->Add( m_sdbSizer1, 0, wxALIGN_RIGHT|wxALL, 5 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnCloseWindow ) );
m_paperSizeComboBox->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::onPaperSizeChoice ), NULL, this );
m_TextUserSizeX->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnTextctrlUserPageSizeXTextUpdated ), NULL, this );
m_TextUserSizeY->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnTextctrlUserPageSizeYTextUpdated ), NULL, this );
m_paperSizeComboBox->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnPaperSizeChoice ), NULL, this );
m_orientationComboBox->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnPageOrientationChoice ), NULL, this );
m_TextUserSizeX->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnUserPageSizeXTextUpdated ), NULL, this );
m_TextUserSizeY->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnUserPageSizeYTextUpdated ), NULL, this );
m_TextRevision->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnRevisionTextUpdated ), NULL, this );
m_TextTitle->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnTitleTextUpdated ), NULL, this );
m_TitleExport->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnCheckboxTitleClick ), NULL, this );
m_TextCompany->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnCompanyTextUpdated ), NULL, this );
m_TextComment1->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment1TextUpdated ), NULL, this );
m_TextComment2->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment2TextUpdated ), NULL, this );
m_TextComment3->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment3TextUpdated ), NULL, this );
m_TextComment4->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment4TextUpdated ), NULL, this );
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnOkClick ), NULL, this );
}
......@@ -231,10 +290,18 @@ DIALOG_PAGES_SETTINGS_BASE::~DIALOG_PAGES_SETTINGS_BASE()
{
// Disconnect Events
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnCloseWindow ) );
m_paperSizeComboBox->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::onPaperSizeChoice ), NULL, this );
m_TextUserSizeX->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnTextctrlUserPageSizeXTextUpdated ), NULL, this );
m_TextUserSizeY->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnTextctrlUserPageSizeYTextUpdated ), NULL, this );
m_paperSizeComboBox->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnPaperSizeChoice ), NULL, this );
m_orientationComboBox->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnPageOrientationChoice ), NULL, this );
m_TextUserSizeX->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnUserPageSizeXTextUpdated ), NULL, this );
m_TextUserSizeY->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnUserPageSizeYTextUpdated ), NULL, this );
m_TextRevision->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnRevisionTextUpdated ), NULL, this );
m_TextTitle->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnTitleTextUpdated ), NULL, this );
m_TitleExport->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnCheckboxTitleClick ), NULL, this );
m_TextCompany->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnCompanyTextUpdated ), NULL, this );
m_TextComment1->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment1TextUpdated ), NULL, this );
m_TextComment2->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment2TextUpdated ), NULL, this );
m_TextComment3->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment3TextUpdated ), NULL, this );
m_TextComment4->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnComment4TextUpdated ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAGES_SETTINGS_BASE::OnOkClick ), NULL, this );
......
This source diff could not be displayed because it is too large. You can view the blob instead.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 6 2011)
// C++ code generated with wxFormBuilder (version Feb 9 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_page_settings_base__
#define __dialog_page_settings_base__
#ifndef __DIALOG_PAGE_SETTINGS_BASE_H__
#define __DIALOG_PAGE_SETTINGS_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/choice.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/choice.h>
#include <wx/textctrl.h>
#include <wx/valtext.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/statbmp.h>
#include <wx/checkbox.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
#define ID_TEXTCTRL_USER_PAGE_SIZE_X 1000
#define ID_TEXTCTRL_USER_PAGE_SIZE_Y 1001
#define ID_TEXTCTRL_REVISION 1002
#define ID_CHECKBOX_REVISION 1003
#define ID_TEXTCTRL_TITLE 1004
#define ID_TEXTCTRL_COMPANY 1005
#define ID_CHECKBOX_COMPANY 1006
#define ID_TEXTCTRL_COMMENT1 1007
#define ID_CHECKBOX_COMMENT1 1008
#define ID_TEXTCTRL_COMMENT2 1009
#define ID_CHECKBOX_COMMENT2 1010
#define ID_TEXTCTRL_COMMENT3 1011
#define ID_CHECKBOX_COMMENT3 1012
#define ID_TEXTCTRL_COMMENT4 1013
#define ID_CHECKBOX_COMMENT4 1014
#define ID_CHICE_PAGE_SIZE 1000
#define ID_CHOICE_PAGE_ORIENTATION 1001
#define ID_TEXTCTRL_USER_PAGE_SIZE_X 1002
#define ID_TEXTCTRL_USER_PAGE_SIZE_Y 1003
#define ID_PAGE_LAYOUT_EXAMPLE_SIZER 1004
#define ID_TEXTCTRL_REVISION 1005
#define ID_CHECKBOX_REVISION 1006
#define ID_TEXTCTRL_TITLE 1007
#define ID_TEXTCTRL_COMPANY 1008
#define ID_CHECKBOX_COMPANY 1009
#define ID_TEXTCTRL_COMMENT1 1010
#define ID_CHECKBOX_COMMENT1 1011
#define ID_TEXTCTRL_COMMENT2 1012
#define ID_CHECKBOX_COMMENT2 1013
#define ID_TEXTCTRL_COMMENT3 1014
#define ID_CHECKBOX_COMMENT3 1015
#define ID_TEXTCTRL_COMMENT4 1016
#define ID_CHECKBOX_COMMENT4 1017
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_PAGES_SETTINGS_BASE
......@@ -50,14 +59,14 @@ class DIALOG_PAGES_SETTINGS_BASE : public wxDialog
private:
protected:
wxStaticText* m_staticText5;
wxChoice* m_paperSizeComboBox;
wxStaticText* m_staticText6;
wxChoice* m_orientationComboBox;
wxStaticText* UserPageSizeX;
wxTextCtrl* m_TextUserSizeX;
wxStaticText* UserPageSizeY;
wxTextCtrl* m_TextUserSizeY;
wxStaticBitmap* m_PageLayoutExampleBitmap;
wxStaticText* m_TextSheetCount;
wxStaticText* m_TextSheetNumber;
wxTextCtrl* m_TextRevision;
wxCheckBox* m_RevisionExport;
......@@ -79,19 +88,27 @@ class DIALOG_PAGES_SETTINGS_BASE : public wxDialog
// Virtual event handlers, overide them in your derived class
virtual void OnCloseWindow( wxCloseEvent& event ) { event.Skip(); }
virtual void onPaperSizeChoice( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTextctrlUserPageSizeXTextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTextctrlUserPageSizeYTextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPaperSizeChoice( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPageOrientationChoice( wxCommandEvent& event ) { event.Skip(); }
virtual void OnUserPageSizeXTextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnUserPageSizeYTextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnRevisionTextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnTitleTextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCheckboxTitleClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCompanyTextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnComment1TextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnComment2TextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnComment3TextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnComment4TextUpdated( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Page Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Page Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 748,495 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PAGES_SETTINGS_BASE();
};
#endif //__dialog_page_settings_base__
#endif //__DIALOG_PAGE_SETTINGS_BASE_H__
......@@ -1010,69 +1010,62 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
const PAGE_INFO& pageInfo = GetPageSettings();
wxSize pageSize = pageInfo.GetSizeMils();
int ii, jj, xg, yg, ipas, gxpas, gypas;
wxPoint pos;
int refx, refy;
EDA_Colors Color;
wxString Line;
Ki_WorkSheetData* WsItem;
int scale = m_internalUnits / 1000;
wxSize size( SIZETEXT * scale, SIZETEXT * scale );
#if defined(KICAD_GOST)
wxSize size2( SIZETEXT * scale * 2, SIZETEXT * scale * 2);
wxSize size3( SIZETEXT * scale * 3, SIZETEXT * scale * 3);
wxSize size1_5( SIZETEXT * scale * 1.5, SIZETEXT * scale * 1.5);
#endif
wxSize size_ref( SIZETEXT_REF * scale, SIZETEXT_REF * scale );
wxString msg;
int UpperLimit = VARIABLE_BLOCK_START_POSITION;
int width = line_width;
Color = RED;
// if not printing, draw the page limits:
if( !screen->m_IsPrinting && g_ShowPageLimits )
{
int scale = m_internalUnits / 1000;
GRSetDrawMode( DC, GR_COPY );
GRRect( m_canvas->GetClipBox(), DC, 0, 0,
pageSize.x * scale, pageSize.y * scale, width,
pageSize.x * scale, pageSize.y * scale, line_width,
g_DrawBgColor == WHITE ? LIGHTGRAY : DARKDARKGRAY );
}
GRSetDrawMode( DC, GR_COPY );
wxPoint margin_left_top( pageInfo.GetLeftMarginMils(), pageInfo.GetTopMarginMils() );
wxPoint margin_right_bottom( pageInfo.GetRightMarginMils(), pageInfo.GetBottomMarginMils() );
wxString paper = pageInfo.GetType();
wxString file = screen->GetFileName();
TITLE_BLOCK t_block = GetTitleBlock();
int number_of_screens = screen->m_NumberOfScreen;
int screen_to_draw = screen->m_ScreenNumber;
TraceWorkSheet( ( wxDC* )DC, pageSize, margin_left_top, margin_right_bottom,
paper, file, t_block, number_of_screens, screen_to_draw,
( int )line_width );
}
// Draw the border.
void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoint& aRB,
wxString& aType, wxString& aFlNm, TITLE_BLOCK& aTb,
int aNScr, int aScr, int aLnW, EDA_Colors aClr1,
EDA_Colors aClr2 )
{
wxPoint pos;
int refx, refy;
wxString Line;
Ki_WorkSheetData* WsItem;
int scale = m_internalUnits / 1000;
wxSize size( SIZETEXT * scale, SIZETEXT * scale );
wxSize size_ref( SIZETEXT_REF * scale, SIZETEXT_REF * scale );
wxString msg;
GRSetDrawMode( aDC, GR_COPY );
// Upper left corner
refx = pageInfo.GetLeftMarginMils();
refy = pageInfo.GetTopMarginMils();
refx = aLT.x;
refy = aLT.y;
// lower right corner
xg = pageSize.x - pageInfo.GetRightMarginMils();
yg = pageSize.y - pageInfo.GetBottomMarginMils();
int xg, yg;
xg = aSz.x - aRB.x;
yg = aSz.y - aRB.y;
#if defined(KICAD_GOST)
GRRect( m_canvas->GetClipBox(), DC, refx * scale, refy * scale,
xg * scale, yg * scale, width, Color );
#else
for( ii = 0; ii < 2; ii++ )
{
GRRect( m_canvas->GetClipBox(), DC, refx * scale, refy * scale,
xg * scale, yg * scale, width, Color );
refx += GRID_REF_W; refy += GRID_REF_W;
xg -= GRID_REF_W; yg -= GRID_REF_W;
}
#endif
// Draw the reference legends.
refx = pageInfo.GetLeftMarginMils();
// Draw the border.
GRRect( m_canvas->GetClipBox(), aDC, refx * scale, refy * scale,
xg * scale, yg * scale, aLnW, aClr1 );
#if defined(KICAD_GOST)
refy = pageSize.y - pageInfo.GetBottomMarginMils(); // Lower left corner
refx = aLT.x;
refy = aSz.y - aRB.y; // Lower left corner
for( WsItem = &WS_Segm1_LU; WsItem != NULL; WsItem = WsItem->Pnext )
{
pos.x = ( refx - WsItem->m_Posx ) * scale;
......@@ -1086,22 +1079,22 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
case WS_PODPIS_LU:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
DrawGraphicText( m_canvas, DC, pos, Color,
DrawGraphicText( m_canvas, aDC, pos, aClr1,
msg, TEXT_ORIENT_VERT, size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM,
width, false, false );
aLnW, false, false );
break;
case WS_SEGMENT_LU:
xg = pageInfo.GetLeftMarginMils() - WsItem->m_Endx;
yg = pageSize.y - pageInfo.GetBottomMarginMils() - WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), DC, pos.x, pos.y,
xg * scale, yg * scale, width, Color );
xg = aLT.x - WsItem->m_Endx;
yg = aSz.y - aRB.y - WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y,
xg * scale, yg * scale, aLnW, aClr1 );
break;
}
}
refy = pageInfo.GetBottomMarginMils(); // Left Top corner
refy = aRB.y; // Left Top corner
for( WsItem = &WS_Segm1_LT; WsItem != NULL; WsItem = WsItem->Pnext )
{
pos.x = ( refx + WsItem->m_Posx ) * scale;
......@@ -1110,98 +1103,22 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
switch( WsItem->m_Type )
{
case WS_SEGMENT_LT:
xg = pageInfo.GetLeftMarginMils() + WsItem->m_Endx;
yg = pageInfo.GetBottomMarginMils() + WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), DC, pos.x, pos.y,
xg * scale, yg * scale, width, Color );
xg = aLT.x + WsItem->m_Endx;
yg = aRB.y + WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y,
xg * scale, yg * scale, aLnW, aClr1 );
break;
}
}
#else
// Upper left corner
refy = pageInfo.GetTopMarginMils();
// lower right corner
xg = pageSize.x - pageInfo.GetRightMarginMils();
yg = pageSize.y - pageInfo.GetBottomMarginMils();
ipas = ( xg - refx ) / PAS_REF;
gxpas = ( xg - refx ) / ipas;
for( ii = refx + gxpas, jj = 1; ipas > 0; ii += gxpas, jj++, ipas-- )
{
Line.Printf( wxT( "%d" ), jj );
if( ii < xg - PAS_REF / 2 )
{
GRLine( m_canvas->GetClipBox(), DC, ii * scale, refy * scale,
ii * scale, ( refy + GRID_REF_W ) * scale, width, Color );
}
DrawGraphicText( m_canvas, DC,
wxPoint( ( ii - gxpas / 2 ) * scale,
( refy + GRID_REF_W / 2 ) * scale ),
Color, Line, TEXT_ORIENT_HORIZ, size_ref,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
if( ii < xg - PAS_REF / 2 )
{
GRLine( m_canvas->GetClipBox(), DC, ii * scale, yg * scale,
ii * scale, ( yg - GRID_REF_W ) * scale, width, Color );
}
DrawGraphicText( m_canvas, DC,
wxPoint( ( ii - gxpas / 2 ) * scale,
( yg - GRID_REF_W / 2) * scale ),
Color, Line, TEXT_ORIENT_HORIZ, size_ref,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
}
ipas = ( yg - refy ) / PAS_REF;
gypas = ( yg - refy ) / ipas;
for( ii = refy + gypas, jj = 0; ipas > 0; ii += gypas, jj++, ipas-- )
{
if( jj < 26 )
Line.Printf( wxT( "%c" ), jj + 'A' );
else // I hope 52 identifiers are enought...
Line.Printf( wxT( "%c" ), 'a' + jj - 26 );
if( ii < yg - PAS_REF / 2 )
{
GRLine( m_canvas->GetClipBox(), DC, refx * scale, ii * scale,
( refx + GRID_REF_W ) * scale, ii * scale, width, Color );
}
DrawGraphicText( m_canvas, DC,
wxPoint( ( refx + GRID_REF_W / 2 ) * scale,
( ii - gypas / 2 ) * scale ),
Color, Line, TEXT_ORIENT_HORIZ, size_ref,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
if( ii < yg - PAS_REF / 2 )
{
GRLine( m_canvas->GetClipBox(), DC, xg * scale, ii * scale,
( xg - GRID_REF_W ) * scale, ii * scale, width, Color );
}
DrawGraphicText( m_canvas, DC,
wxPoint( ( xg - GRID_REF_W / 2 ) * scale,
( ii - gxpas / 2 ) * scale ),
Color, Line, TEXT_ORIENT_HORIZ, size_ref,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
}
#endif
#if defined(KICAD_GOST)
wxSize size2( SIZETEXT * scale * 2, SIZETEXT * scale * 2);
wxSize size3( SIZETEXT * scale * 3, SIZETEXT * scale * 3);
wxSize size1_5( SIZETEXT * scale * 1.5, SIZETEXT * scale * 1.5);
// lower right corner
refx = pageSize.x - pageInfo.GetRightMarginMils();
refy = pageSize.y - pageInfo.GetBottomMarginMils();
refx = aSz.x - aRB.x;
refy = aSz.y - aRB.y;
if( screen->m_ScreenNumber == 1 )
if( aScr == 1 )
{
for( WsItem = &WS_Date; WsItem != NULL; WsItem = WsItem->Pnext )
{
......@@ -1222,10 +1139,10 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
case WS_PODPIS:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
DrawGraphicText( m_canvas, DC, pos, Color,
DrawGraphicText( m_canvas, aDC, pos, aClr1,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
aLnW, false, false );
break;
case WS_SIZESHEET:
......@@ -1234,95 +1151,91 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
case WS_IDENTSHEET:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
if( screen->m_NumberOfScreen > 1 )
msg << screen->m_ScreenNumber;
DrawGraphicText( m_canvas, DC, pos, Color, msg,
if( aNScr > 1 )
msg << aScr;
DrawGraphicText( m_canvas, aDC, pos, aClr1, msg,
TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT,
GR_TEXT_VJUSTIFY_CENTER, width, false, false );
GR_TEXT_VJUSTIFY_CENTER, aLnW, false, false );
break;
case WS_SHEETS:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg << screen->m_NumberOfScreen;
DrawGraphicText( m_canvas, DC, pos, Color, msg,
msg << aNScr;
DrawGraphicText( m_canvas, aDC, pos, aClr1, msg,
TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT,
GR_TEXT_VJUSTIFY_CENTER, width, false, false );
GR_TEXT_VJUSTIFY_CENTER, aLnW, false, false );
break;
case WS_COMPANY_NAME:
msg = GetTitleBlock().GetCompany();
msg = aTb.GetCompany();
if( !msg.IsEmpty() )
{
DrawGraphicText( m_canvas, DC, pos, Color,
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, TEXT_ORIENT_HORIZ, size1_5,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
width,
false, false );
aLnW, false, false );
}
break;
case WS_TITLE:
msg = GetTitleBlock().GetTitle();
msg = aTb.GetTitle();
if( !msg.IsEmpty() )
{
DrawGraphicText( m_canvas, DC, pos, Color,
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, TEXT_ORIENT_HORIZ, size1_5,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
width,
false, false );
aLnW, false, false );
}
break;
case WS_COMMENT1:
msg = GetTitleBlock().GetComment1();
msg = aTb.GetComment1();
if( !msg.IsEmpty() )
{
DrawGraphicText( m_canvas, DC, pos, Color,
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, TEXT_ORIENT_HORIZ, size3,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
width,
false, false );
pos.x = (pageInfo.GetLeftMarginMils() + 1260) * scale;
pos.y = (pageInfo.GetTopMarginMils() + 270) * scale;
DrawGraphicText( m_canvas, DC, pos, Color,
aLnW, false, false );
pos.x = (aLT.x + 1260) * scale;
pos.y = (aLT.y + 270) * scale;
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, 1800, size2,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
width,
false, false );
aLnW, false, false );
}
break;
case WS_COMMENT2:
msg = GetTitleBlock().GetComment2();
msg = aTb.GetComment2();
if( !msg.IsEmpty() )
{
DrawGraphicText( m_canvas, DC, pos, Color,
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
aLnW, false, false );
}
break;
case WS_COMMENT3:
msg = GetTitleBlock().GetComment3();
msg = aTb.GetComment3();
if( !msg.IsEmpty() )
{
DrawGraphicText( m_canvas, DC, pos, Color,
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
aLnW, false, false );
}
break;
case WS_COMMENT4:
msg = GetTitleBlock().GetComment4();
msg = aTb.GetComment4();
if( !msg.IsEmpty() )
{
DrawGraphicText( m_canvas, DC, pos, Color,
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
aLnW, false, false );
}
break;
......@@ -1333,12 +1246,10 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
pos.y = ( refy - WsItem->m_Posy ) * scale;
case WS_SEGMENT:
xg = pageSize.x -
pageInfo.GetRightMarginMils() - WsItem->m_Endx;
yg = pageSize.y -
pageInfo.GetBottomMarginMils() - WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), DC, pos.x, pos.y,
xg * scale, yg * scale, width, Color );
xg = aSz.x - aRB.x - WsItem->m_Endx;
yg = aSz.y - aRB.y - WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y,
xg * scale, yg * scale, aLnW, aClr1 );
break;
}
}
......@@ -1355,63 +1266,144 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
{
case WS_CADRE:
// Begin list number > 1
msg = GetTitleBlock().GetComment1();
msg = aTb.GetComment1();
if( !msg.IsEmpty() )
{
DrawGraphicText( m_canvas, DC, pos, Color,
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, TEXT_ORIENT_HORIZ, size3,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
width,
false, false );
pos.x = (pageInfo.GetLeftMarginMils() + 1260) * scale;
pos.y = (pageInfo.GetTopMarginMils() + 270) * scale;
DrawGraphicText( m_canvas, DC, pos, Color,
aLnW, false, false );
pos.x = (aLT.x + 1260) * scale;
pos.y = (aLT.y + 270) * scale;
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, 1800, size2,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
width,
false, false );
aLnW, false, false );
}
break;
case WS_PODPIS_D:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
DrawGraphicText( m_canvas, DC, pos, Color,
DrawGraphicText( m_canvas, aDC, pos, aClr1,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width,
false, false );
aLnW, false, false );
break;
case WS_IDENTSHEET_D:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg << screen->m_ScreenNumber;
DrawGraphicText( m_canvas, DC, pos, Color,
msg << aScr;
DrawGraphicText( m_canvas, aDC, pos, aClr1,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
aLnW, false, false );
break;
case WS_LEFT_SEGMENT_D:
pos.y = ( refy - WsItem->m_Posy ) * scale;
case WS_SEGMENT_D:
xg = pageSize.x -
pageInfo.GetRightMarginMils() - WsItem->m_Endx;
yg = pageSize.y -
pageInfo.GetBottomMarginMils() - WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), DC, pos.x, pos.y,
xg * scale, yg * scale, width, Color );
xg = aSz.x - aRB.x - WsItem->m_Endx;
yg = aSz.y - aRB.y - WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y,
xg * scale, yg * scale, aLnW, aClr1 );
break;
}
}
}
#else
// Draw the border.
int ii, jj, ipas, gxpas, gypas;
for( ii = 0; ii < 2; ii++ )
{
GRRect( m_canvas->GetClipBox(), aDC, refx * scale, refy * scale,
xg * scale, yg * scale, aLnW, aClr1 );
refx += GRID_REF_W; refy += GRID_REF_W;
xg -= GRID_REF_W; yg -= GRID_REF_W;
}
// Upper left corner
refx = aLT.x;
refy = aLT.y;
// lower right corner
xg = aSz.x - aRB.x;
yg = aSz.y - aRB.y;
ipas = ( xg - refx ) / PAS_REF;
gxpas = ( xg - refx ) / ipas;
for( ii = refx + gxpas, jj = 1; ipas > 0; ii += gxpas, jj++, ipas-- )
{
Line.Printf( wxT( "%d" ), jj );
if( ii < xg - PAS_REF / 2 )
{
GRLine( m_canvas->GetClipBox(), aDC, ii * scale, refy * scale,
ii * scale, ( refy + GRID_REF_W ) * scale, aLnW, aClr1 );
}
DrawGraphicText( m_canvas, aDC,
wxPoint( ( ii - gxpas / 2 ) * scale,
( refy + GRID_REF_W / 2 ) * scale ),
aClr1, Line, TEXT_ORIENT_HORIZ, size_ref,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
if( ii < xg - PAS_REF / 2 )
{
GRLine( m_canvas->GetClipBox(), aDC, ii * scale, yg * scale,
ii * scale, ( yg - GRID_REF_W ) * scale, aLnW, aClr1 );
}
DrawGraphicText( m_canvas, aDC,
wxPoint( ( ii - gxpas / 2 ) * scale,
( yg - GRID_REF_W / 2) * scale ),
aClr1, Line, TEXT_ORIENT_HORIZ, size_ref,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
}
ipas = ( yg - refy ) / PAS_REF;
gypas = ( yg - refy ) / ipas;
for( ii = refy + gypas, jj = 0; ipas > 0; ii += gypas, jj++, ipas-- )
{
if( jj < 26 )
Line.Printf( wxT( "%c" ), jj + 'A' );
else // I hope 52 identifiers are enought...
Line.Printf( wxT( "%c" ), 'a' + jj - 26 );
if( ii < yg - PAS_REF / 2 )
{
GRLine( m_canvas->GetClipBox(), aDC, refx * scale, ii * scale,
( refx + GRID_REF_W ) * scale, ii * scale, aLnW, aClr1 );
}
DrawGraphicText( m_canvas, aDC,
wxPoint( ( refx + GRID_REF_W / 2 ) * scale,
( ii - gypas / 2 ) * scale ),
aClr1, Line, TEXT_ORIENT_HORIZ, size_ref,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
if( ii < yg - PAS_REF / 2 )
{
GRLine( m_canvas->GetClipBox(), aDC, xg * scale, ii * scale,
( xg - GRID_REF_W ) * scale, ii * scale, aLnW, aClr1 );
}
DrawGraphicText( m_canvas, aDC,
wxPoint( ( xg - GRID_REF_W / 2 ) * scale,
( ii - gxpas / 2 ) * scale ),
aClr1, Line, TEXT_ORIENT_HORIZ, size_ref,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
}
refx = pageSize.x - pageInfo.GetRightMarginMils() - GRID_REF_W;
refy = pageSize.y - pageInfo.GetBottomMarginMils() - GRID_REF_W;
int UpperLimit = VARIABLE_BLOCK_START_POSITION;
refx = aSz.x - aRB.x - GRID_REF_W;
refy = aSz.y - aRB.y - GRID_REF_W;
for( WsItem = &WS_Date; WsItem != NULL; WsItem = WsItem->Pnext )
{
......@@ -1424,22 +1416,26 @@ 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 += GetTitleBlock().GetDate();
DrawGraphicText( m_canvas, DC, pos, Color,
msg += aTb.GetDate();
DrawGraphicText( m_canvas, aDC, pos, aClr1,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, true );
aLnW, false, true );
break;
case WS_REV:
if( WsItem->m_Legende )
{
msg = WsItem->m_Legende;
msg += GetTitleBlock().GetRevision();
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size,
DrawGraphicText( m_canvas, aDC, pos, aClr1, msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
GetPenSizeForBold( MIN( size.x, size.y ) ), false, true );
pos.x += ReturnGraphicTextWidth( msg, size.x, false, false );
}
msg = aTb.GetRevision();
DrawGraphicText( m_canvas, aDC, pos, aClr2, msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
GetPenSizeForBold( MIN( size.x, size.y ) ),
false, true );
GetPenSizeForBold( MIN( size.x, size.y ) ), false, true );
break;
case WS_KICAD_VERSION:
......@@ -1447,67 +1443,67 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
msg = WsItem->m_Legende;
msg += g_ProductName + wxGetApp().GetAppName();
msg += wxT( " " ) + GetBuildVersion();
DrawGraphicText( m_canvas, DC, pos, Color,
DrawGraphicText( m_canvas, aDC, pos, aClr1,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
aLnW, false, false );
break;
case WS_SIZESHEET:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += pageInfo.GetType();
DrawGraphicText( m_canvas, DC, pos, Color,
msg += aType;
DrawGraphicText( m_canvas, aDC, pos, aClr1,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
aLnW, false, false );
break;
case WS_IDENTSHEET:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg << screen->m_ScreenNumber << wxT( "/" ) << screen->m_NumberOfScreen;
DrawGraphicText( m_canvas, DC, pos, Color,
msg << aScr << wxT( "/" ) << aNScr;
DrawGraphicText( m_canvas, aDC, pos, aClr1,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
aLnW, false, false );
break;
case WS_FILENAME:
{
wxString fname, fext;
wxFileName::SplitPath( screen->GetFileName(), (wxString*) NULL, &fname, &fext );
{
wxString fname, fext;
wxFileName::SplitPath( aFlNm, (wxString*) NULL, &fname, &fext );
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg << fname << wxT( "." ) << fext;
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
}
break;
msg << fname << wxT( "." ) << fext;
DrawGraphicText( m_canvas, aDC, pos, aClr1,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
aLnW, false, false );
}
break;
case WS_FULLSHEETNAME:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += GetScreenDesc();
DrawGraphicText( m_canvas, DC, pos, Color,
DrawGraphicText( m_canvas, aDC, pos, aClr1,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
aLnW, false, false );
break;
case WS_COMPANY_NAME:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += GetTitleBlock().GetCompany();
msg += aTb.GetCompany();
if( !msg.IsEmpty() )
{
DrawGraphicText( m_canvas, DC, pos, Color,
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
GetPenSizeForBold( MIN( size.x, size.y ) ),
......@@ -1518,25 +1514,29 @@ 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 += GetTitleBlock().GetTitle();
DrawGraphicText( m_canvas, DC, pos, Color,
msg, TEXT_ORIENT_HORIZ, size,
DrawGraphicText( m_canvas, aDC, pos, aClr1, msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
GetPenSizeForBold( MIN( size.x, size.y ) ), false, true );
pos.x += ReturnGraphicTextWidth( msg, size.x, false, false );
}
msg = aTb.GetTitle();
DrawGraphicText( m_canvas, aDC, pos, aClr2, msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
GetPenSizeForBold( MIN( size.x, size.y ) ),
false, true );
GetPenSizeForBold( MIN( size.x, size.y ) ), false, true );
break;
case WS_COMMENT1:
if( WsItem->m_Legende )
msg = WsItem->m_Legende;
msg += GetTitleBlock().GetComment1();
msg += aTb.GetComment1();
if( !msg.IsEmpty() )
{
DrawGraphicText( m_canvas, DC, pos, Color,
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
aLnW, false, false );
UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT );
}
break;
......@@ -1544,13 +1544,13 @@ 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 += GetTitleBlock().GetComment2();
msg += aTb.GetComment2();
if( !msg.IsEmpty() )
{
DrawGraphicText( m_canvas, DC, pos, Color,
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
aLnW, false, false );
UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT );
}
break;
......@@ -1558,13 +1558,13 @@ 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 += GetTitleBlock().GetComment3();
msg += aTb.GetComment3();
if( !msg.IsEmpty() )
{
DrawGraphicText( m_canvas, DC, pos, Color,
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
aLnW, false, false );
UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT );
}
break;
......@@ -1572,13 +1572,13 @@ 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 += GetTitleBlock().GetComment4();
msg += aTb.GetComment4();
if( !msg.IsEmpty() )
{
DrawGraphicText( m_canvas, DC, pos, Color,
DrawGraphicText( m_canvas, aDC, pos, aClr2,
msg, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
width, false, false );
aLnW, false, false );
UpperLimit = MAX( UpperLimit, WsItem->m_Posy + SIZETEXT );
}
break;
......@@ -1594,12 +1594,10 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
pos.y = (refy - WsItem->m_Posy) * scale;
case WS_SEGMENT:
xg = pageSize.x -
GRID_REF_W - pageInfo.GetRightMarginMils() - WsItem->m_Endx;
yg = pageSize.y -
GRID_REF_W - pageInfo.GetBottomMarginMils() - WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), DC, pos.x, pos.y,
xg * scale, yg * scale, width, Color );
xg = aSz.x - GRID_REF_W - aRB.x - WsItem->m_Endx;
yg = aSz.y - GRID_REF_W - aRB.y - WsItem->m_Endy;
GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y,
xg * scale, yg * scale, aLnW, aClr1 );
break;
}
}
......
......@@ -220,10 +220,12 @@ void DIALOG_PLOT_SCHEMATIC_PS::createPSFile()
{
case PAGE_SIZE_A:
plotPage.SetType( wxT( "A" ) );
plotPage.SetPortrait( actualPage.IsPortrait() );
break;
case PAGE_SIZE_A4:
plotPage.SetType( wxT( "A4" ) );
plotPage.SetPortrait( actualPage.IsPortrait() );
break;
case PAGE_SIZE_AUTO:
......
......@@ -111,6 +111,24 @@ void DIALOG_PRINT_USING_PRINTER::OnInitDialog( wxInitDialogEvent& event )
{
SCH_EDIT_FRAME* parent = GetParent();
// Initialize page specific print setup dialog settings.
const PAGE_INFO& pageInfo = parent->GetScreen()->GetPageSettings();
wxPageSetupDialogData& pageSetupDialogData = parent->GetPageSetupData();
pageSetupDialogData.SetPaperId( pageInfo.GetPaperId() );
if( pageInfo.IsCustom() )
{
if( pageInfo.IsPortrait() )
pageSetupDialogData.SetPaperSize( wxSize( Mils2mm( pageInfo.GetWidthMils() ),
Mils2mm( pageInfo.GetHeightMils() ) ) );
else
pageSetupDialogData.SetPaperSize( wxSize( Mils2mm( pageInfo.GetHeightMils() ),
Mils2mm( pageInfo.GetWidthMils() ) ) );
}
pageSetupDialogData.GetPrintData().SetOrientation( pageInfo.GetWxOrientation() );
if ( GetSizer() )
GetSizer()->SetSizeHints( this );
......@@ -342,6 +360,11 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
wxLogDebug( wxT( "Fit rectangle: %d, %d, %d, %d" ),
fitRect.x, fitRect.y, fitRect.width, fitRect.height );
int xoffset = ( fitRect.width - pageSizeIU.x ) / 2;
int yoffset = ( fitRect.height - pageSizeIU.y ) / 2;
OffsetLogicalOrigin( xoffset, yoffset );
GRResetPenAndBrush( dc );
if( parent->GetPrintMonochrome() )
......
......@@ -447,8 +447,8 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetConfigurationSettings( void )
if( !m_configSettings.empty() )
return m_configSettings;
m_configSettings.push_back( new PARAM_CFG_INT( wxT( "Unite" ),
(int*)&g_UserUnit, 0 ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Units" ),
(int*)&g_UserUnit, MILLIMETRES ) );
m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColWire" ),
&g_LayerDescr.LayerColor[LAYER_WIRE],
GREEN ) );
......
......@@ -195,7 +195,7 @@ again." );
case 'T': // It is a text item.
if( sscanf( sline, "%s", Name1 ) != 1 )
{
MsgDiag.Printf( wxT( "Eeschema file text load error at line %d" ),
MsgDiag.Printf( _( "Eeschema file text load error at line %d" ),
reader.LineNumber() );
itemLoaded = false;
}
......@@ -211,7 +211,7 @@ again." );
default:
itemLoaded = false;
MsgDiag.Printf( wxT( "Eeschema file undefined object at line %d, aborted" ),
MsgDiag.Printf( _( "Eeschema file undefined object at line %d, aborted" ),
reader.LineNumber() );
MsgDiag << wxT( "\n" ) << FROM_UTF8( line );
}
......@@ -304,7 +304,7 @@ bool ReadSchemaDescr( LINE_READER* aLine, wxString& aMsgDiag, SCH_SCREEN* aScree
if( !pageInfo.SetType( pagename ) )
{
aMsgDiag.Printf( wxT( "Eeschema file dimension definition error \
aMsgDiag.Printf( _( "Eeschema file dimension definition error \
line %d, \aAbort reading file.\n" ),
aLine->LineNumber() );
aMsgDiag << FROM_UTF8( line );
......@@ -322,7 +322,7 @@ line %d, \aAbort reading file.\n" ),
}
}
// portrait only supported in non custom sizes
// non custom size, set portrait if its present
else if( orient && !strcmp( orient, "portrait" ) )
{
pageInfo.SetPortrait( true );
......
......@@ -98,7 +98,7 @@ static GRID_TYPE SchematicGridList[] = {
SCH_SCREEN::SCH_SCREEN() :
BASE_SCREEN( SCH_SCREEN_T ),
m_paper( wxT( "A4" ) )
m_paper( wxT( "A4" ), IsGOST() )
{
size_t i;
......
......@@ -229,9 +229,11 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father,
ReCreateVToolbar();
ReCreateOptToolbar();
/* Initialize print and page setup dialog settings. */
m_pageSetupData.GetPrintData().SetQuality( wxPRINT_QUALITY_HIGH );
m_pageSetupData.GetPrintData().SetOrientation( wxLANDSCAPE );
// Initialize common print setup dialog settings.
m_pageSetupData.GetPrintData().SetPrintMode( wxPRINT_MODE_PRINTER );
m_pageSetupData.GetPrintData().SetQuality( wxPRINT_QUALITY_MEDIUM );
m_pageSetupData.GetPrintData().SetBin( wxPRINTBIN_AUTO );
m_pageSetupData.GetPrintData().SetNoCopies( 1 );
m_auimgr.SetManagedWindow( this );
......@@ -529,7 +531,9 @@ wxString SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet()
filename.RemoveLast();
#if defined(KICAD_GOST)
#ifndef __WINDOWS__
filename.Remove( 0, 1 );
wxString newfn;
if( filename.StartsWith( wxT( "-" ), &newfn ) )
filename = newfn;
#endif
#endif
}
......
......@@ -39,6 +39,17 @@
#include <wx/fileconf.h>
#if !wxUSE_PRINTING_ARCHITECTURE
# error "You must use '--enable-printarch' in your wx library configuration."
#endif
#if defined( __WXGTK__ )
# if !wxUSE_LIBGNOMEPRINT && !wxUSE_GTKPRINT
# error "You must use '--with-gnomeprint' or '--with-gtkprint' in your wx library configuration."
# endif
#endif
class wxAboutDialogInfo;
// Flag for special keys
......@@ -106,6 +117,16 @@ enum pseudokeys {
#define OFF 0
/// Convert mm to mils.
inline int Mm2mils( double x ) { return wxRound( x * 1000./25.4 ); }
/// Convert mils to mm.
inline int Mils2mm( double x ) { return wxRound( x * 25.4 / 1000. ); }
/// Return whether GOST is in play
bool IsGOST();
enum EDA_UNITS_T {
INCHES = 0,
MILLIMETRES = 1,
......@@ -131,10 +152,27 @@ class PAGE_INFO
{
public:
static const wxString Custom; /// "User" defined page type
PAGE_INFO( const wxString& aType = PAGE_INFO::A3, bool IsPortrait = false );
// paper size names which are part of the public API, pass to SetType() or
// above constructor.
static const wxString A4;
static const wxString A3;
static const wxString A2;
static const wxString A1;
static const wxString A0;
static const wxString A;
static const wxString B;
static const wxString C;
static const wxString D;
static const wxString E;
static const wxString GERBER;
static const wxString USLetter;
static const wxString USLegal;
static const wxString USLedger;
static const wxString Custom; ///< "User" defined page type
PAGE_INFO( const wxString& aType = wxT( "A3" ) );
PAGE_INFO( const wxSize& aSizeMils, const wxString& aName );
/**
* Function SetType
......@@ -150,7 +188,7 @@ public:
*
* @return bool - true iff @a aStandarePageDescription was a recognized type.
*/
bool SetType( const wxString& aStandardPageDescriptionName );
bool SetType( const wxString& aStandardPageDescriptionName, bool IsPortrait = false );
const wxString& GetType() const { return m_type; }
/**
......@@ -171,6 +209,19 @@ public:
void SetPortrait( bool isPortrait );
bool IsPortrait() const { return m_portrait; }
/**
* Function GetWxOrientation.
* @return int - ws' style printing orientation.
*/
int GetWxOrientation() const { return IsPortrait() ? wxPORTRAIT : wxLANDSCAPE; }
/**
* Function GetPaperId
* @return wxPaperSize - wxPrintData's style paper id associated with
* page type name.
*/
wxPaperSize GetPaperId() const { return m_paper_id; }
void SetWidthMils( int aWidthInMils );
int GetWidthMils() const { return m_size.x; }
......@@ -196,29 +247,79 @@ public:
const wxSize GetSizeIU() const { return wxSize( GetWidthIU(), GetHeightIU() ); }
#endif
/**
* Function GetLeftMarginMils.
* @return int - logical page left margin in mils.
*/
int GetLeftMarginMils() const { return m_left_margin; }
/**
* Function GetLeftMarginMils.
* @return int - logical page right margin in mils.
*/
int GetRightMarginMils() const { return m_right_margin; }
/**
* Function GetLeftMarginMils.
* @return int - logical page top margin in mils.
*/
int GetTopMarginMils() const { return m_top_margin; }
/**
* Function GetBottomMarginMils.
* @return int - logical page bottom margin in mils.
*/
int GetBottomMarginMils() const { return m_bottom_margin; }
/**
* Function SetLeftMarginMils
* sets left page margin to @a aMargin in mils.
*/
void SetLeftMarginMils( int aMargin ) { m_left_margin = aMargin; }
/**
* Function SetRightMarginMils
* sets right page margin to @a aMargin in mils.
*/
void SetRightMarginMils( int aMargin ) { m_right_margin = aMargin; }
/**
* Function SetTopMarginMils
* sets top page margin to @a aMargin in mils.
*/
void SetTopMarginMils( int aMargin ) { m_top_margin = aMargin; }
/**
* Function SetBottomMarginMils
* sets bottom page margin to @a aMargin in mils.
*/
void SetBottomMarginMils( int aMargin ) { m_bottom_margin = aMargin; }
/**
* Function SetUserWidthMils
* sets the width of type "User" page in mils, for any type "User" page
* Function SetCustomWidthMils
* sets the width of Custom page in mils, for any custom page
* constructed or made via SetType() after making this call.
*/
static void SetUserWidthMils( int aWidthInMils );
static void SetCustomWidthMils( int aWidthInMils );
/**
* Function SetUserHeightMils
* sets the height type "User" page in mils, for any type "User" page
* Function SetCustomHeightMils
* sets the height of Custom page in mils, for any custom page
* constructed or made via SetType() after making this call.
*/
static void SetUserHeightMils( int aHeightInMils );
static void SetCustomHeightMils( int aHeightInMils );
/**
* Function GetCustomWidthMils.
* @return int - custom paper width in mils.
*/
static int GetCustomWidthMils() { return s_user_width; }
/**
* Function GetCustomHeightMils.
* @return int - custom paper height in mils.
*/
static int GetCustomHeightMils() { return s_user_height; }
/**
* Function GetStandardSizes
......@@ -226,6 +327,11 @@ public:
static wxArrayString GetStandardSizes();
*/
protected:
// only the class implementation(s) may use this constructor
PAGE_INFO( const wxSize& aSizeMils, const wxString& aName, wxPaperSize aPaperId );
private:
// standard pre-defined sizes
......@@ -252,6 +358,11 @@ private:
wxString m_type; ///< paper type: A4, A3, etc.
wxSize m_size; ///< mils
/// Min and max page sizes for clamping.
#define MIN_PAGE_SIZE 4000
#define MAX_PAGE_SIZE 48000
int m_left_margin;
int m_right_margin;
int m_top_margin;
......@@ -259,10 +370,14 @@ private:
bool m_portrait; ///< true if portrait, false if landscape
wxPaperSize m_paper_id; ///< wx' style paper id.
static int s_user_height;
static int s_user_width;
void updatePortrait();
void updatePortrait();
void setMargins();
};
......
......@@ -412,6 +412,8 @@ public:
virtual void SetLayerPolarity( bool aPositive ) {}
void user_to_device_coordinates( wxPoint& pos ); // overload
protected:
double plot_scale_adjX, plot_scale_adjY;
double plot_width_adj;
......
......@@ -2,77 +2,79 @@
/* worksheet.h */
/***************/
/* Values are in 1/1000 inch */
// Values are in 1/1000 inch
#ifndef __WORKSHEET_H__
#define __WORKSHEET_H__
#ifndef WORKSHEET_H_
#define WORKSHEET_H_
#define GRID_REF_W 70 /* height of the band reference grid */
#define SIZETEXT 60 /* worksheet text size */
#define SIZETEXT_REF 50 /* worksheet frame reference text size */
#define PAS_REF 2000 /* no reference markings on worksheet frame */
#define TEXT_VTAB_HEIGHT SIZETEXT * 2
#include <common.h> // Mm2mils()
#define GRID_REF_W 70 // height of the band reference grid
#define SIZETEXT 60 // worksheet text size
#define SIZETEXT_REF 50 // worksheet frame reference text size
#define PAS_REF 2000 // no reference markings on worksheet frame
#define TEXT_VTAB_HEIGHT (SIZETEXT * 2)
#if defined(KICAD_GOST)
#define STAMP_OX 185 * 10000 / 254
#define STAMP_OY 55 * 10000 / 254
#define STAMP_Y_0 0
#define STAMP_Y_5 5 * 10000 / 254
#define STAMP_Y_8 8 * 10000 / 254
#define STAMP_Y_7 7 * 10000 / 254
#define STAMP_Y_10 10 * 10000 / 254
#define STAMP_Y_14 14 * 10000 / 254
#define STAMP_Y_15 15 * 10000 / 254
#define STAMP_Y_20 20 * 10000 / 254
#define STAMP_Y_25 25 * 10000 / 254
#define STAMP_Y_30 30 * 10000 / 254
#define STAMP_Y_35 35 * 10000 / 254
#define STAMP_Y_40 40 * 10000 / 254
#define STAMP_Y_45 45 * 10000 / 254
#define STAMP_Y_50 50 * 10000 / 254
#define STAMP_Y_55 55 * 10000 / 254
#define STAMP_OX Mm2mils( 185 )
#define STAMP_OY Mm2mils( 55 )
#define STAMP_Y_0 0
#define STAMP_Y_5 Mm2mils( 5 )
#define STAMP_Y_8 Mm2mils( 8 )
#define STAMP_Y_7 Mm2mils( 7 )
#define STAMP_Y_10 Mm2mils( 10 )
#define STAMP_Y_14 Mm2mils( 14 )
#define STAMP_Y_15 Mm2mils( 15 )
#define STAMP_Y_20 Mm2mils( 20 )
#define STAMP_Y_25 Mm2mils( 25 )
#define STAMP_Y_30 Mm2mils( 30 )
#define STAMP_Y_35 Mm2mils( 35 )
#define STAMP_Y_40 Mm2mils( 40 )
#define STAMP_Y_45 Mm2mils( 45 )
#define STAMP_Y_50 Mm2mils( 50 )
#define STAMP_Y_55 Mm2mils( 55 )
#define STAMP_X_0 0
#define STAMP_X_10 10 * 10000 / 254
#define STAMP_X_14 14 * 10000 / 254
#define STAMP_X_18 18 * 10000 / 254
#define STAMP_X_30 30 * 10000 / 254
#define STAMP_X_35 35 * 10000 / 254
#define STAMP_X_40 40 * 10000 / 254
#define STAMP_X_45 45 * 10000 / 254
#define STAMP_X_50 50 * 10000 / 254
#define STAMP_X_53 53 * 10000 / 254
#define STAMP_X_65 65 * 10000 / 254
#define STAMP_X_70 70 * 10000 / 254
#define STAMP_X_84 84 * 10000 / 254
#define STAMP_X_85 85 * 10000 / 254
#define STAMP_X_120 120 * 10000 / 254
#define STAMP_X_130 130 * 10000 / 254
#define STAMP_X_137 137 * 10000 / 254
#define STAMP_X_145 145 * 10000 / 254
#define STAMP_X_168 168 * 10000 / 254
#define STAMP_X_178 178 * 10000 / 254
#define STAMP_X_185 185 * 10000 / 254
#define STAMP_5 5 * 10000 / 254
#define STAMP_7 7 * 10000 / 254
#define STAMP_12 12 * 10000 / 254
#define STAMP_145 145 * 10000 / 254
#define STAMP_110 110 * 10000 / 254
#define STAMP_85 85 * 10000 / 254
#define STAMP_60 60 * 10000 / 254
#define STAMP_25 25 * 10000 / 254
#define STAMP_287 287 * 10000 / 254
#define STAMP_227 227 * 10000 / 254
#define STAMP_167 167 * 10000 / 254
#define STAMP_X_10 Mm2mils( 10 )
#define STAMP_X_14 Mm2mils( 14 )
#define STAMP_X_18 Mm2mils( 18 )
#define STAMP_X_30 Mm2mils( 30 )
#define STAMP_X_35 Mm2mils( 35 )
#define STAMP_X_40 Mm2mils( 40 )
#define STAMP_X_45 Mm2mils( 45 )
#define STAMP_X_50 Mm2mils( 50 )
#define STAMP_X_53 Mm2mils( 53 )
#define STAMP_X_65 Mm2mils( 65 )
#define STAMP_X_70 Mm2mils( 70 )
#define STAMP_X_84 Mm2mils( 84 )
#define STAMP_X_85 Mm2mils( 85 )
#define STAMP_X_120 Mm2mils( 120 )
#define STAMP_X_130 Mm2mils( 130 )
#define STAMP_X_137 Mm2mils( 137 )
#define STAMP_X_145 Mm2mils( 145 )
#define STAMP_X_168 Mm2mils( 168 )
#define STAMP_X_178 Mm2mils( 178 )
#define STAMP_X_185 Mm2mils( 185 )
#define STAMP_5 Mm2mils( 5 )
#define STAMP_7 Mm2mils( 7 )
#define STAMP_12 Mm2mils( 12 )
#define STAMP_145 Mm2mils( 145 )
#define STAMP_110 Mm2mils( 110 )
#define STAMP_85 Mm2mils( 85 )
#define STAMP_60 Mm2mils( 60 )
#define STAMP_25 Mm2mils( 25 )
#define STAMP_287 Mm2mils( 287 )
#define STAMP_227 Mm2mils( 227 )
#define STAMP_167 Mm2mils( 167 )
#endif
/* The coordinates below are relative to the bottom right corner of page and
* will be subtracted from this origin.
*/
// The coordinates below are relative to the bottom right corner of page and
// will be subtracted from this origin.
#define BLOCK_OX 4200
#define BLOCK_KICAD_VERSION_X BLOCK_OX - SIZETEXT
#define BLOCK_KICAD_VERSION_Y SIZETEXT
......@@ -98,6 +100,7 @@
#define BLOCK_COMMENT3_Y (SIZETEXT * 17)
#define BLOCK_COMMENT4_Y (SIZETEXT * 19)
struct Ki_WorkSheetData
{
public:
......@@ -109,7 +112,8 @@ public:
const wxChar* m_Text;
};
/* Work sheet structure type definitions. */
/// Work sheet structure type definitions.
enum TypeKi_WorkSheetData {
WS_DATE,
WS_REV,
......@@ -249,4 +253,4 @@ extern Ki_WorkSheetData WS_Segm4_LT;
extern Ki_WorkSheetData WS_Segm5_LT;
#endif
#endif /* __WORKSHEET_H__ */
#endif // WORKSHEET_H_
......@@ -447,7 +447,6 @@ protected:
*/
virtual void unitsChangeRefresh();
public:
EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& title,
const wxPoint& pos, const wxSize& size,
......@@ -667,10 +666,32 @@ public:
* Function GetZoom
* @return The current zoom level.
*/
double GetZoom( void );
double GetZoom();
void TraceWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth );
void TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_width );
void PlotWorkSheet( PLOTTER *plotter, BASE_SCREEN* screen );
/**
* Function TraceWorkSheet is a core function for drawing of the page layout with
* the frame and the basic inscriptions.
* @param aDC The device context.
* @param aSz The size of the page layout.
* @param aLT The left top margin of the page layout.
* @param aRB The right bottom margin of the page layout.
* @param aType The paper size type (for basic inscriptions).
* @param aFlNm The file name (for basic inscriptions).
* @param aTb The block of titles (for basic inscriptions).
* @param aNScr The number of screens (for basic inscriptions).
* @param aScr The screen number (for basic inscriptions).
* @param aLnW The line width for drawing.
* @param aClr1 The color for drawing.
* @param aClr2 The colr for inscriptions.
*/
void TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoint& aRB,
wxString& aType, wxString& aFlNm, TITLE_BLOCK& aTb,
int aNScr, int aScr, int aLnW, EDA_Colors aClr1 = RED,
EDA_Colors aClr2 = RED );
void PlotWorkSheet( PLOTTER* aPlotter, BASE_SCREEN* aScreen );
/**
* Function GetXYSheetReferences
......
......@@ -205,9 +205,7 @@ set(PCBNEW_SRCS
###
# We need some extra sources from common
###
set(PCBNEW_COMMON_SRCS
../common/dialogs/dialog_page_settings.cpp
)
#set(PCBNEW_COMMON_SRCS ../common/dialogs/dialog_page_settings.cpp )
###
......
......@@ -30,6 +30,7 @@ wxPoint BOARD_ITEM::ZeroOffset( 0, 0 );
BOARD::BOARD() :
BOARD_ITEM( (BOARD_ITEM*) NULL, PCB_T ),
m_NetInfo( this ),
m_paper( IsGOST() ? PAGE_INFO::A4 : PAGE_INFO::A3, IsGOST() ),
m_NetClasses( this )
{
// we have not loaded a board yet, assume latest until then.
......
......@@ -96,6 +96,8 @@ void PCB_EDIT_FRAME::ToPrinter( wxCommandEvent& event )
* Display the print dialog
*/
{
const PAGE_INFO& pageInfo = GetPageSettings();
if( s_PrintData == NULL ) // First print
{
s_PrintData = new wxPrintData();
......@@ -104,14 +106,33 @@ void PCB_EDIT_FRAME::ToPrinter( wxCommandEvent& event )
{
DisplayError( this, _( "Error Init Printer info" ) );
}
s_PrintData->SetQuality( wxPRINT_QUALITY_HIGH ); // Default resolution = HIGHT;
s_PrintData->SetQuality( wxPRINT_QUALITY_HIGH ); // Default resolution = HIGH;
}
if( s_pageSetupData == NULL )
s_pageSetupData = new wxPageSetupDialogData( *s_PrintData );
s_pageSetupData->SetPaperId( pageInfo.GetPaperId() );
if( pageInfo.IsCustom() )
{
if( pageInfo.IsPortrait() )
s_pageSetupData->SetPaperSize( wxSize( Mils2mm( pageInfo.GetWidthMils() ),
Mils2mm( pageInfo.GetHeightMils() ) ) );
else
s_pageSetupData->SetPaperSize( wxSize( Mils2mm( pageInfo.GetHeightMils() ),
Mils2mm( pageInfo.GetWidthMils() ) ) );
}
s_PrintData->SetOrientation( GetPageSettings().IsPortrait() ? wxPORTRAIT : wxLANDSCAPE );
s_pageSetupData->SetMarginTopLeft( wxPoint( 0, 0 ) );
s_pageSetupData->SetMarginBottomRight( wxPoint( 0, 0 ) );
s_pageSetupData->GetPrintData().SetOrientation( pageInfo.GetWxOrientation() );
*s_PrintData = s_pageSetupData->GetPrintData();
DIALOG_PRINT_USING_PRINTER* frame = new DIALOG_PRINT_USING_PRINTER( this );
DIALOG_PRINT_USING_PRINTER dlg( this );
frame->ShowModal(); frame->Destroy();
dlg.ShowModal();
}
......@@ -147,14 +168,6 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
int layer_max = NB_LAYERS;
wxString msg;
BOARD* board = m_Parent->GetBoard();
if( s_pageSetupData == NULL )
{
s_pageSetupData = new wxPageSetupDialogData;
// Set initial page margins.
// Margins are already set in Pcbnew, so we cans use 0
s_pageSetupData->SetMarginTopLeft(wxPoint(0, 0));
s_pageSetupData->SetMarginBottomRight(wxPoint(0, 0));
}
s_Parameters.m_PageSetupData = s_pageSetupData;
......@@ -203,7 +216,6 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
}
}
// Option for excluding contents of "Edges Pcb" layer
m_Exclude_Edges_Pcb->Show( true );
......@@ -269,10 +281,10 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
m_DialogPenWidth->SetValue(
ReturnStringFromValue( g_UserUnit, s_Parameters.m_PenDefaultSize, m_Parent->GetInternalUnits() ) );
// Create scale adjust option
msg.Printf( wxT( "%f" ), s_Parameters.m_XScaleAdjust );
m_FineAdjustXscaleOpt->SetValue( msg );
msg.Printf( wxT( "%f" ), s_Parameters.m_YScaleAdjust );
m_FineAdjustYscaleOpt->SetValue( msg );
......@@ -416,11 +428,10 @@ void DIALOG_PRINT_USING_PRINTER::SetPrintParameters( )
/**********************************************/
void DIALOG_PRINT_USING_PRINTER::SetPenWidth()
/***********************************************/
/* Get the new pen width value, and verify min et max value
* NOTE: s_Parameters.m_PenDefaultSize is in internal units
*/
{
// Get the new pen width value, and verify min et max value
// NOTE: s_Parameters.m_PenDefaultSize is in internal units
s_Parameters.m_PenDefaultSize = ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->GetInternalUnits() );
if( s_Parameters.m_PenDefaultSize > WIDTH_MAX_VALUE )
......@@ -443,6 +454,7 @@ void DIALOG_PRINT_USING_PRINTER::OnScaleSelectionClick( wxCommandEvent& event )
{
double scale = s_ScaleList[m_ScaleOption->GetSelection()];
bool enable = (scale == 1.0);
if( m_FineAdjustXscaleOpt )
m_FineAdjustXscaleOpt->Enable(enable);
if( m_FineAdjustYscaleOpt )
......@@ -453,12 +465,7 @@ void DIALOG_PRINT_USING_PRINTER::OnScaleSelectionClick( wxCommandEvent& event )
/**********************************************************/
void DIALOG_PRINT_USING_PRINTER::OnPageSetup( wxCommandEvent& event )
/**********************************************************/
/* Open a dialog box for printer setup (printer options, page size ...)
*/
{
*s_pageSetupData = *s_PrintData;
wxPageSetupDialog pageSetupDialog(this, s_pageSetupData);
pageSetupDialog.ShowModal();
......@@ -470,9 +477,6 @@ void DIALOG_PRINT_USING_PRINTER::OnPageSetup( wxCommandEvent& event )
/************************************************************/
void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
/************************************************************/
/* Open and display a previewer frame for printing
*/
{
SetPrintParameters( );
......@@ -499,7 +503,6 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
return;
}
// Uses the parent position and size.
// @todo uses last position and size ans store them when exit in m_Config
wxPoint WPos = m_Parent->GetPosition();
......@@ -515,9 +518,6 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
/***************************************************************************/
void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event )
/***************************************************************************/
/* Called on activate Print button
*/
{
SetPrintParameters( );
......@@ -536,7 +536,8 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintButtonClick( wxCommandEvent& event )
wxString title = _( "Print" );
BOARD_PRINTOUT_CONTROLER printout( s_Parameters, m_Parent, title );
#if !defined(__WINDOWS__) && !wxCHECK_VERSION(2,9,0)
// Alexander's patch had this removed altogether, waiting for testing.
#if 0 && !defined(__WINDOWS__) && !wxCHECK_VERSION(2,9,0)
wxDC* dc = printout.GetDC();
( (wxPostScriptDC*) dc )->SetResolution( 600 ); // Postscript DC resolution is 600 ppi
#endif
......
......@@ -32,12 +32,6 @@ static void Plot_Edges_Modules( PLOTTER* plotter, BOARD* pcb, int aLayerMask,
static void PlotTextModule( PLOTTER* plotter, TEXTE_MODULE* pt_texte,
EDA_DRAW_MODE_T trace_mode );
static int doIntValueFitToBand( int aInt, int aMin, int aMax )
{
if( aInt < aMin ) return aMin;
if( aInt > aMax ) return aMax;
return aInt;
}
/* Creates the plot for silkscreen layers
*/
......@@ -1024,7 +1018,7 @@ void PCB_BASE_FRAME::PlotDrillMark( PLOTTER* aPlotter,
diam.x = diam.y = pts->GetDrillValue();
diam.x -= aPlotter->get_plot_width_adj();
diam.x = doIntValueFitToBand( diam.x, 1, pts->m_Width - 1 );
diam.x = Clamp( 1, diam.x, pts->m_Width - 1 );
aPlotter->flash_pad_circle( pos, diam.x, aTraceMode );
}
......@@ -1042,9 +1036,9 @@ void PCB_BASE_FRAME::PlotDrillMark( PLOTTER* aPlotter,
{
diam = pad->GetDrillSize();
diam.x -= aPlotter->get_plot_width_adj();
diam.x = doIntValueFitToBand( diam.x, 1, pad->GetSize().x - 1 );
diam.x = Clamp( 1, diam.x, pad->GetSize().x - 1 );
diam.y -= aPlotter->get_plot_width_adj();
diam.y = doIntValueFitToBand( diam.y, 1, pad->GetSize().y - 1 );
diam.y = Clamp( 1, diam.y, pad->GetSize().y - 1 );
aPlotter->flash_pad_oval( pos, diam, pad->GetOrientation(), aTraceMode );
}
else
......@@ -1052,7 +1046,7 @@ void PCB_BASE_FRAME::PlotDrillMark( PLOTTER* aPlotter,
// It is quite possible that the real pad drill value is less then small drill value.
diam.x = aSmallDrillShape ? MIN( SMALL_DRILL, pad->GetDrillSize().x ) : pad->GetDrillSize().x;
diam.x -= aPlotter->get_plot_width_adj();
diam.x = doIntValueFitToBand( diam.x, 1, pad->GetSize().x - 1 );
diam.x = Clamp( 1, diam.x, pad->GetSize().x - 1 );
aPlotter->flash_pad_circle( pos, diam.x, aTraceMode );
}
}
......
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