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 );
}
This diff is collapsed.
/////////////////////////////////////////////////////////////////////////////
// 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_
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__
This diff is collapsed.
......@@ -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