Commit f8490ff4 authored by Dick Hollenbeck's avatar Dick Hollenbeck

Remove g_PcbPlotOptions, use wxformbuilder to subclass DIALOG_SHIM on several dialogs

parent e4309287
......@@ -18,7 +18,7 @@ Documentation/doxygen
*.cmake
*.bak
common/pcb_plot_params_keywords.cpp
common/pcb_plot_params_lexer.h
include/pcb_plot_params_lexer.h
pcbnew/specctra_keywords.cpp
pcbnew/specctra_lexer.h
new/html
......
......@@ -254,7 +254,6 @@ set(INC_AFTER
############
# Binaries #
############
add_subdirectory(3d-viewer)
if( USE_PNG_BITMAPS )
add_subdirectory(bitmaps_png)
......@@ -262,8 +261,8 @@ else()
add_subdirectory(bitmaps_xpm)
endif()
add_subdirectory(common)
add_subdirectory(3d-viewer)
add_subdirectory(cvpcb)
add_subdirectory(eeschema)
add_subdirectory(gerbview)
......
......@@ -113,6 +113,7 @@ set(PCB_COMMON_SRCS
../pcbnew/classpcb.cpp
../pcbnew/collectors.cpp
../pcbnew/sel_layer.cpp
../pcbnew/pcb_plot_params.cpp
pcb_plot_params_keywords.cpp
dialogs/dialog_page_settings.cpp
)
......@@ -142,7 +143,7 @@ make_lexer(
# auto-generate pcb_plot_params_lexer.h and pcb_plot_params_keywords.cpp
make_lexer(
${CMAKE_CURRENT_SOURCE_DIR}/pcb_plot_params.keywords
${CMAKE_CURRENT_SOURCE_DIR}/pcb_plot_params_lexer.h
${PROJECT_SOURCE_DIR}/include/pcb_plot_params_lexer.h
${CMAKE_CURRENT_SOURCE_DIR}/pcb_plot_params_keywords.cpp
PCBPLOTPARAMS_T
)
......
......@@ -438,9 +438,9 @@ limits\n%.1f - %.1f %s!\nSelect another custom paper size?" ),
PAGE_INFO::SetCustomWidthMils( m_layout_size.x );
PAGE_INFO::SetCustomHeightMils( m_layout_size.y );
m_pageInfo.SetWidthMils( m_layout_size.x );
m_pageInfo.SetHeightMils( m_layout_size.y );
m_pageInfo.SetPortrait( m_layout_size.x < m_layout_size.y );
}
}
else
......
......@@ -139,22 +139,21 @@ extern const wxString g_SchematicBackupFileExtension;
extern LayerStruct g_LayerDescr;
extern bool g_EditPinByPinIsOn; /* True to prevent displacing
* pins, when they are at the
* same position. */
extern int g_DrawDefaultLineThickness; /* Default line (in Eeschema
* units) thickness used to
* draw/plot items having a
* default thickness line
* value (i.e. = 0 ).
* 0 = single pixel line width
/// True to prevent displacing pins, when they are at the same position.
extern bool g_EditPinByPinIsOn;
/**
* Default line (in Eeschema units) thickness used to draw/plot items having a
* default thickness line value (i.e. = 0 ).
* 0 = single pixel line width.
*/
extern int g_DrawDefaultLineThickness;
// Color to draw selected items
/// Color to draw selected items
extern int g_ItemSelectetColor;
// Color to draw items flagged invisible, in libedit (they are invisible in Eeschema
/// Color to draw items flagged invisible, in libedit (they are invisible in Eeschema
extern int g_InvisibleItemColor;
/* Global Variables */
......
......@@ -28,8 +28,8 @@
* @brief Classes used in Pcbnew, CvPcb and GerbView.
*/
#ifndef WX_BASE_PCB_FRAME_H
#define WX_BASE_PCB_FRAME_H
#ifndef WX_BASE_PCB_FRAME_H_
#define WX_BASE_PCB_FRAME_H_
#include <vector>
......@@ -59,6 +59,8 @@ class GENERAL_COLLECTOR;
class GENERAL_COLLECTORS_GUIDE;
class BOARD_DESIGN_SETTINGS;
class ZONE_SETTINGS;
class PCB_PLOT_PARAMS;
/**
* class PCB_BASE_FRAME
......@@ -138,6 +140,14 @@ public:
const ZONE_SETTINGS& GetZoneSettings() const;
void SetZoneSettings( const ZONE_SETTINGS& aSettings );
/**
* Function GetPlotSettings
* returns the PCB_PLOT_PARAMS for the BOARD owned by this frame.
* Overloaded in FOOTPRINT_EDIT_FRAME.
*/
virtual const PCB_PLOT_PARAMS& GetPlotSettings() const;
virtual void SetPlotSettings( const PCB_PLOT_PARAMS& aSettings );
/**
* Function SetBoard
* sets the m_Pcb member in such as way as to ensure deleting any previous
......@@ -674,4 +684,4 @@ public:
DECLARE_EVENT_TABLE()
};
#endif /* WX_BASE_PCB_FRAME_H */
#endif // WX_BASE_PCB_FRAME_H_
......@@ -161,7 +161,6 @@ set(PCBNEW_SRCS
netlist_reader_kicad.cpp
onleftclick.cpp
onrightclick.cpp
pcb_plot_params.cpp
pcbnew.cpp
pcbnew_config.cpp
pcbplot.cpp
......
......@@ -205,6 +205,20 @@ void PCB_BASE_FRAME::SetZoneSettings( const ZONE_SETTINGS& aSettings )
}
const PCB_PLOT_PARAMS& PCB_BASE_FRAME::GetPlotSettings() const
{
wxASSERT( m_Pcb );
return m_Pcb->GetPlotOptions();
}
void PCB_BASE_FRAME::SetPlotSettings( const PCB_PLOT_PARAMS& aSettings )
{
wxASSERT( m_Pcb );
m_Pcb->SetPlotOptions( aSettings );
}
EDA_RECT PCB_BASE_FRAME::GetBoardBoundingBox( bool aBoardEdgesOnly ) const
{
wxASSERT( m_Pcb );
......
......@@ -17,7 +17,7 @@
#include <common.h> // PAGE_INFO
#include <class_title_block.h>
#include <class_zone_settings.h>
#include <pcb_plot_params.h>
class PCB_BASE_FRAME;
class PCB_EDIT_FRAME;
......@@ -180,6 +180,7 @@ private:
COLORS_DESIGN_SETTINGS* m_colorsSettings;
PAGE_INFO m_paper;
TITLE_BLOCK m_titles; ///< text in lower right of screen and plots
PCB_PLOT_PARAMS m_plotOptions;
/// Position of the origin axis, which is used in exports mostly
wxPoint m_originAxisPosition;
......@@ -543,6 +544,9 @@ public:
const PAGE_INFO& GetPageSettings() const { return m_paper; }
void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
const PCB_PLOT_PARAMS& GetPlotOptions() const { return m_plotOptions; }
void SetPlotOptions( const PCB_PLOT_PARAMS& aOptions ) { m_plotOptions = aOptions; }
const wxPoint& GetOriginAxisPosition() const { return m_originAxisPosition; }
void SetOriginAxisPosition( const wxPoint& aPosition ) { m_originAxisPosition = aPosition; }
......
......@@ -51,7 +51,7 @@ class BOARD;
* Enum MODULE_ATTR_T
* is the set of attributes allowed within a MODULE, using MODULE::SetAttributes()
* and MODULE::GetAttributes(). These are to be ORed together when calling
* MODULE::SetAttrbute()
* MODULE::SetAttributes()
*/
enum MODULE_ATTR_T
{
......
......@@ -37,8 +37,6 @@
#define WIDTH_MAX_VALUE 500
#define WIDTH_MIN_VALUE 1
extern int g_DrawDefaultLineThickness;
// Local variables:
static PRINT_PARAMETERS s_Parameters;
static long s_SelectedLayers = LAYER_BACK | LAYER_FRONT |
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// C++ code generated with wxFormBuilder (version Mar 19 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -9,7 +9,7 @@
///////////////////////////////////////////////////////////////////////////
DIALOG_GEN_MODULE_POSITION_BASE::DIALOG_GEN_MODULE_POSITION_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
DIALOG_GEN_MODULE_POSITION_BASE::DIALOG_GEN_MODULE_POSITION_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
......@@ -37,10 +37,13 @@ DIALOG_GEN_MODULE_POSITION_BASE::DIALOG_GEN_MODULE_POSITION_BASE( wxWindow* pare
m_browseButton = new wxButton( this, wxID_ANY, _("Browse..."), wxDefaultPosition, wxDefaultSize, 0 );
bSizerdirBrowse->Add( m_browseButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
bDirSizer->Add( bSizerdirBrowse, 1, wxEXPAND, 5 );
bUpperSizer->Add( bDirSizer, 1, 0, 5 );
m_MainSizer->Add( bUpperSizer, 0, wxEXPAND, 5 );
wxBoxSizer* bSizerOptions;
......@@ -62,12 +65,13 @@ DIALOG_GEN_MODULE_POSITION_BASE::DIALOG_GEN_MODULE_POSITION_BASE( wxWindow* pare
wxString m_radioBoxForceSmdChoices[] = { _("With INSERT attribute set"), _("Force INSERT attribute for all SMD footprints") };
int m_radioBoxForceSmdNChoices = sizeof( m_radioBoxForceSmdChoices ) / sizeof( wxString );
m_radioBoxForceSmd = new wxRadioBox( this, wxID_ANY, _("Footprints:"), wxDefaultPosition, wxDefaultSize, m_radioBoxForceSmdNChoices, m_radioBoxForceSmdChoices, 1, wxRA_SPECIFY_COLS );
m_radioBoxForceSmd = new wxRadioBox( this, wxID_ANY, _("Footprints Selection:"), wxDefaultPosition, wxDefaultSize, m_radioBoxForceSmdNChoices, m_radioBoxForceSmdChoices, 1, wxRA_SPECIFY_COLS );
m_radioBoxForceSmd->SetSelection( 0 );
m_radioBoxForceSmd->SetToolTip( _("Only footprints with option INSERT are listed in placement file.\nThis option can force this option for all footprints having only SMD pads.\nWarning: this options will modify the board.") );
bSizerOptions->Add( m_radioBoxForceSmd, 0, wxALL, 5 );
m_MainSizer->Add( bSizerOptions, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
wxStaticBoxSizer* sbSizerMsg;
......@@ -78,6 +82,7 @@ DIALOG_GEN_MODULE_POSITION_BASE::DIALOG_GEN_MODULE_POSITION_BASE( wxWindow* pare
sbSizerMsg->Add( m_messagesBox, 1, wxEXPAND, 5 );
m_MainSizer->Add( sbSizerMsg, 1, wxEXPAND, 5 );
m_sdbSizerButtons = new wxStdDialogButtonSizer();
......@@ -86,10 +91,15 @@ DIALOG_GEN_MODULE_POSITION_BASE::DIALOG_GEN_MODULE_POSITION_BASE( wxWindow* pare
m_sdbSizerButtonsCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel );
m_sdbSizerButtons->Realize();
m_MainSizer->Add( m_sdbSizerButtons, 0, wxEXPAND|wxALIGN_RIGHT|wxTOP|wxBOTTOM|wxRIGHT, 5 );
this->SetSizer( m_MainSizer );
this->Layout();
m_MainSizer->Fit( this );
this->Centre( wxBOTH );
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_GEN_MODULE_POSITION_BASE::OnClose ) );
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// C++ code generated with wxFormBuilder (version Mar 19 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -11,6 +11,7 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
......@@ -29,7 +30,7 @@
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_GEN_MODULE_POSITION_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_GEN_MODULE_POSITION_BASE : public wxDialog
class DIALOG_GEN_MODULE_POSITION_BASE : public DIALOG_SHIM
{
private:
......@@ -56,7 +57,7 @@ class DIALOG_GEN_MODULE_POSITION_BASE : public wxDialog
public:
DIALOG_GEN_MODULE_POSITION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Position Files:"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 501,340 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_GEN_MODULE_POSITION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Position Files:"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_GEN_MODULE_POSITION_BASE();
};
......
......@@ -55,6 +55,7 @@ static DRILL_PRECISION precisionListForInches[] =
{
DRILL_PRECISION( 2, 3 ), DRILL_PRECISION( 2, 4 )
};
static DRILL_PRECISION precisionListForMetric[] =
{
DRILL_PRECISION( 3, 2 ), DRILL_PRECISION( 3, 3 )
......@@ -64,12 +65,12 @@ static DRILL_PRECISION precisionListForMetric[] =
DIALOG_GENDRILL::DIALOG_GENDRILL( PCB_EDIT_FRAME* parent ) :
DIALOG_GENDRILL_BASE( parent )
{
m_Parent = parent;
m_parent = parent;
m_board = parent->GetBoard();
SetReturnCode( 1 );
initDialog();
GetSizer()->SetSizeHints( this );
Centre();
}
......@@ -83,9 +84,6 @@ int DIALOG_GENDRILL:: m_PrecisionFormat = 1;
bool DIALOG_GENDRILL::m_createRpt = false;
int DIALOG_GENDRILL::m_createMap = 0;
/*!
* DIALOG_GENDRILL destructor
*/
DIALOG_GENDRILL::~DIALOG_GENDRILL()
{
......@@ -93,13 +91,8 @@ DIALOG_GENDRILL::~DIALOG_GENDRILL()
}
/*!
* Member initialisation
*/
void DIALOG_GENDRILL::initDialog()
{
SetFocus(); // Under wxGTK: mandatory to close dialog by the ESC key
wxConfig* Config = wxGetApp().GetSettings();
if( Config )
......@@ -116,11 +109,10 @@ void DIALOG_GENDRILL::initDialog()
}
/* some param values initialization before display dialog window
*/
void DIALOG_GENDRILL::InitDisplayParams( void )
void DIALOG_GENDRILL::InitDisplayParams()
{
wxString msg;
const PCB_PLOT_PARAMS& plot_opts = m_board->GetPlotOptions();
m_Choice_Unit->SetSelection( m_UnitDrillIsInch ? 1 : 0 );
m_Choice_Precision->SetSelection( m_PrecisionFormat );
......@@ -146,11 +138,11 @@ void DIALOG_GENDRILL::InitDisplayParams( void )
m_MicroViaDrillValue->SetLabel( _( "Use Netclasses values" ) );
msg.Empty();
msg << g_PcbPlotOptions.m_HPGLPenNum;
msg << plot_opts.m_HPGLPenNum;
m_PenNum->SetValue( msg );
msg.Empty();
msg << g_PcbPlotOptions.m_HPGLPenSpeed;
msg << plot_opts.m_HPGLPenSpeed;
m_PenSpeed->SetValue( msg );
// See if we have some buried vias or/and microvias, and display
......@@ -159,7 +151,7 @@ void DIALOG_GENDRILL::InitDisplayParams( void )
m_microViasCount = 0;
m_blindOrBuriedViasCount = 0;
for( TRACK* track = m_Parent->GetBoard()->m_Track; track != NULL; track = track->Next() )
for( TRACK* track = m_parent->GetBoard()->m_Track; track != NULL; track = track->Next() )
{
if( track->Type() != PCB_VIA_T )
continue;
......@@ -178,7 +170,7 @@ void DIALOG_GENDRILL::InitDisplayParams( void )
m_platedPadsHoleCount = 0;
m_notplatedPadsHoleCount = 0;
for( MODULE* module = m_Parent->GetBoard()->m_Modules; module != NULL; module = module->Next() )
for( MODULE* module = m_parent->GetBoard()->m_Modules; module; module = module->Next() )
{
for( D_PAD* pad = module->m_Pads; pad != NULL; pad = pad->Next() )
{
......@@ -228,39 +220,30 @@ void DIALOG_GENDRILL::InitDisplayParams( void )
}
// Save drill options:
void DIALOG_GENDRILL::UpdateConfig()
{
SetParams();
wxConfig* Config = wxGetApp().GetSettings();
wxConfig* config = wxGetApp().GetSettings();
if( Config )
if( config )
{
Config->Write( ZerosFormatKey, m_ZerosFormat );
Config->Write( PrecisionKey, m_PrecisionFormat );
Config->Write( MirrorKey, m_Mirror );
Config->Write( MinimalHeaderKey, m_MinimalHeader );
Config->Write( UnitDrillInchKey, m_UnitDrillIsInch );
Config->Write( DrillOriginIsAuxAxisKey, m_DrillOriginIsAuxAxis );
config->Write( ZerosFormatKey, m_ZerosFormat );
config->Write( PrecisionKey, m_PrecisionFormat );
config->Write( MirrorKey, m_Mirror );
config->Write( MinimalHeaderKey, m_MinimalHeader );
config->Write( UnitDrillInchKey, m_UnitDrillIsInch );
config->Write( DrillOriginIsAuxAxisKey, m_DrillOriginIsAuxAxis );
}
}
/*!
* wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_RADIOBOX
*/
void DIALOG_GENDRILL::OnSelDrillUnitsSelected( wxCommandEvent& event )
{
UpdatePrecisionOptions();
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
*/
void DIALOG_GENDRILL::OnOkClick( wxCommandEvent& event )
{
GenDrillAndReportFiles();
......@@ -268,10 +251,6 @@ void DIALOG_GENDRILL::OnOkClick( wxCommandEvent& event )
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CLOSE
*/
void DIALOG_GENDRILL::OnCancelClick( wxCommandEvent& event )
{
UpdateConfig(); // Save drill options:
......@@ -279,10 +258,6 @@ void DIALOG_GENDRILL::OnCancelClick( wxCommandEvent& event )
}
/*!
* wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_SEL_ZEROS_FMT
*/
void DIALOG_GENDRILL::OnSelZerosFmtSelected( wxCommandEvent& event )
{
UpdatePrecisionOptions();
......@@ -311,11 +286,13 @@ void DIALOG_GENDRILL::UpdatePrecisionOptions()
}
void DIALOG_GENDRILL::SetParams( void )
void DIALOG_GENDRILL::SetParams()
{
wxString msg;
long ltmp;
PCB_PLOT_PARAMS plot_opts = m_board->GetPlotOptions();
m_createMap = m_Choice_Drill_Map->GetSelection();
m_createRpt = m_Choice_Drill_Report->GetSelection();
......@@ -329,17 +306,17 @@ void DIALOG_GENDRILL::SetParams( void )
msg = m_PenSpeed->GetValue();
if( msg.ToLong( &ltmp ) )
g_PcbPlotOptions.m_HPGLPenSpeed = ltmp;
plot_opts.m_HPGLPenSpeed = ltmp;
msg = m_PenNum->GetValue();
if( msg.ToLong( &ltmp ) )
g_PcbPlotOptions.m_HPGLPenNum = ltmp;
plot_opts.m_HPGLPenNum = ltmp;
if( m_Choice_Drill_Offset->GetSelection() == 0 )
m_FileDrillOffset = wxPoint( 0, 0 );
else
m_FileDrillOffset = m_Parent->GetOriginAxisPosition();
m_FileDrillOffset = m_parent->GetOriginAxisPosition();
// get precision
int idx = m_Choice_Precision->GetSelection();
......@@ -348,4 +325,6 @@ void DIALOG_GENDRILL::SetParams( void )
m_Precision = precisionListForInches[idx];
else
m_Precision = precisionListForMetric[idx];
m_board->SetPlotOptions( plot_opts );
}
......@@ -26,14 +26,17 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef _DIALOG_GENDRILL_H_
#define _DIALOG_GENDRILL_H_
#ifndef DIALOG_GENDRILL_H_
#define DIALOG_GENDRILL_H_
#include <dialog_gendrill_base.h>
class DIALOG_GENDRILL : public DIALOG_GENDRILL_BASE
{
public:
DIALOG_GENDRILL( PCB_EDIT_FRAME* parent );
~DIALOG_GENDRILL();
static int m_UnitDrillIsInch;
static int m_ZerosFormat;
static int m_PrecisionFormat;
......@@ -44,23 +47,21 @@ public:
DRILL_PRECISION m_Precision; // Selected precision for drill files
wxPoint m_FileDrillOffset; // Drill offset: 0,0 for absolute coordiantes, or auxialry axis origin
private:
PCB_EDIT_FRAME* m_Parent;
PCB_EDIT_FRAME* m_parent;
BOARD* m_board;
int m_platedPadsHoleCount;
int m_notplatedPadsHoleCount;
int m_throughViasCount;
int m_microViasCount;
int m_blindOrBuriedViasCount;
static bool m_createRpt; // true to create a drill file report
static int m_createMap; // > 0 to create a map file report
public:
DIALOG_GENDRILL( PCB_EDIT_FRAME* parent );
~DIALOG_GENDRILL();
private:
// Initialises member variables
void initDialog();
void InitDisplayParams( void );
......@@ -92,4 +93,4 @@ private:
DRILL_PRECISION GetPrecison();
};
#endif // _DIALOG_GENDRILL_H_
#endif // DIALOG_GENDRILL_H_
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// C++ code generated with wxFormBuilder (version Mar 19 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -9,7 +9,7 @@
///////////////////////////////////////////////////////////////////////////
DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
......@@ -49,6 +49,7 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con
m_LeftBoxSizer->Add( m_Choice_Drill_Offset, 0, wxALL|wxEXPAND, 5 );
bMainSizer->Add( m_LeftBoxSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bMiddleBoxSizer;
......@@ -87,6 +88,7 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con
m_PenNum = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
sbHPGOptionsSizer->Add( m_PenNum, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
bMiddleBoxSizer->Add( sbHPGOptionsSizer, 0, wxEXPAND, 5 );
wxStaticBoxSizer* sbOptSizer;
......@@ -98,8 +100,10 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con
m_Check_Minimal = new wxCheckBox( this, wxID_ANY, _("Minimal header"), wxDefaultPosition, wxDefaultSize, 0 );
sbOptSizer->Add( m_Check_Minimal, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
bMiddleBoxSizer->Add( sbOptSizer, 0, wxEXPAND, 5 );
bMainSizer->Add( bMiddleBoxSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bRightBoxSizer;
......@@ -114,6 +118,7 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con
m_ViaDrillValue->Wrap( -1 );
m_DefaultViasDrillSizer->Add( m_ViaDrillValue, 0, wxALL, 5 );
sbSizerInfo->Add( m_DefaultViasDrillSizer, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_MicroViasDrillSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Micro Vias Drill:") ), wxVERTICAL );
......@@ -122,6 +127,7 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con
m_MicroViaDrillValue->Wrap( -1 );
m_MicroViasDrillSizer->Add( m_MicroViaDrillValue, 0, wxALL, 5 );
sbSizerInfo->Add( m_MicroViasDrillSizer, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
wxStaticBoxSizer* sbSizerHoles;
......@@ -147,8 +153,10 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con
m_BuriedViasInfoMsg->Wrap( -1 );
sbSizerHoles->Add( m_BuriedViasInfoMsg, 0, wxALL, 5 );
sbSizerInfo->Add( sbSizerHoles, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
bRightBoxSizer->Add( sbSizerInfo, 0, wxEXPAND|wxTOP, 5 );
......@@ -161,10 +169,15 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con
m_CancelButton = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
bRightBoxSizer->Add( m_CancelButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
bMainSizer->Add( bRightBoxSizer, 1, wxEXPAND, 5 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
this->Centre( wxBOTH );
// Connect Events
m_Choice_Unit->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnSelDrillUnitsSelected ), NULL, this );
......
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// C++ code generated with wxFormBuilder (version Mar 19 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -11,6 +11,7 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/radiobox.h>
#include <wx/gdicmn.h>
......@@ -31,7 +32,7 @@
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_GENDRILL_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_GENDRILL_BASE : public wxDialog
class DIALOG_GENDRILL_BASE : public DIALOG_SHIM
{
private:
......@@ -69,7 +70,7 @@ class DIALOG_GENDRILL_BASE : public wxDialog
public:
DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Drill Files Generation"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 447,385 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Drill Files Generation"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_GENDRILL_BASE();
};
......
......@@ -14,8 +14,6 @@
#include <dialog_graphic_items_options.h>
extern int g_DrawDefaultLineThickness;
void PCB_EDIT_FRAME::OnConfigurePcbOptions( wxCommandEvent& aEvent )
{
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 17 2010)
// C++ code generated with wxFormBuilder (version Mar 19 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -9,7 +9,7 @@
///////////////////////////////////////////////////////////////////////////
DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
......@@ -34,6 +34,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
m_plotFormatOpt->SetSelection( 0 );
bSizer27->Add( m_plotFormatOpt, 0, 0, 5 );
bSizer26->Add( bSizer27, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizer28;
......@@ -54,10 +55,13 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
m_browseButton = new wxButton( this, wxID_ANY, _("Browse..."), wxDefaultPosition, wxDefaultSize, 0 );
bSizer29->Add( m_browseButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
bSizer28->Add( bSizer29, 1, wxEXPAND, 5 );
bSizer26->Add( bSizer28, 1, 0, 5 );
bSizer12->Add( bSizer26, 0, wxEXPAND, 5 );
wxBoxSizer* bUpperSizer;
......@@ -69,6 +73,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
m_layerCheckListBox = new wxCheckListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_layerCheckListBoxChoices, 0 );
m_LayersSizer->Add( m_layerCheckListBox, 1, wxEXPAND, 5 );
bUpperSizer->Add( m_LayersSizer, 1, wxALL|wxEXPAND, 3 );
m_PlotOptionsSizer = new wxBoxSizer( wxVERTICAL );
......@@ -114,6 +119,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
m_plotMirrorOpt = new wxCheckBox( this, ID_MIROR_OPT, _("Mirrored plot"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerPlotItems->Add( m_plotMirrorOpt, 0, wxALL, 2 );
bSizer192->Add( bSizerPlotItems, 0, wxEXPAND, 5 );
wxBoxSizer* bSizer14;
......@@ -160,10 +166,13 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
bSizer14->Add( m_linesWidth, 0, wxBOTTOM|wxEXPAND|wxLEFT, 5 );
bSizer192->Add( bSizer14, 1, wxRIGHT|wxLEFT, 3 );
sbOptionsSizer->Add( bSizer192, 0, wxEXPAND, 5 );
m_PlotOptionsSizer->Add( sbOptionsSizer, 0, wxALL|wxEXPAND, 3 );
m_GerberOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Gerber Options") ), wxVERTICAL );
......@@ -188,6 +197,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
m_GerberOptionsSizer->Add( m_useAuxOriginCheckBox, 0, wxALL, 2 );
m_PlotOptionsSizer->Add( m_GerberOptionsSizer, 0, wxALL|wxEXPAND, 3 );
m_HPGLOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("HPGL Options") ), wxVERTICAL );
......@@ -214,6 +224,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
bSizer20->Add( m_HPGLPenOverlayOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bSizer22->Add( bSizer20, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer21;
......@@ -228,10 +239,13 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
bSizer21->Add( m_HPGLPenSpeedOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bSizer22->Add( bSizer21, 1, wxEXPAND, 5 );
m_HPGLOptionsSizer->Add( bSizer22, 1, wxEXPAND, 5 );
m_PlotOptionsSizer->Add( m_HPGLOptionsSizer, 0, wxALL|wxEXPAND, 3 );
m_PSOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Postscript Options") ), wxVERTICAL );
......@@ -251,6 +265,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
bSizer18->Add( m_fineAdjustXscaleOpt, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizer17->Add( bSizer18, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer19;
......@@ -265,6 +280,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
bSizer19->Add( m_fineAdjustYscaleOpt, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizer17->Add( bSizer19, 1, wxEXPAND, 5 );
wxBoxSizer* bSizer191;
......@@ -279,8 +295,10 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
bSizer191->Add( m_PSFineAdjustWidthOpt, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
bSizer17->Add( bSizer191, 1, wxEXPAND, 5 );
m_PSOptionsSizer->Add( bSizer17, 1, wxEXPAND, 5 );
m_plotPSNegativeOpt = new wxCheckBox( this, wxID_ANY, _("Negative plot"), wxDefaultPosition, wxDefaultSize, 0 );
......@@ -289,10 +307,13 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
m_forcePSA4OutputOpt = new wxCheckBox( this, wxID_ANY, _("Force A4 output"), wxDefaultPosition, wxDefaultSize, 0 );
m_PSOptionsSizer->Add( m_forcePSA4OutputOpt, 0, wxALL, 2 );
m_PlotOptionsSizer->Add( m_PSOptionsSizer, 0, wxALL|wxEXPAND, 3 );
bUpperSizer->Add( m_PlotOptionsSizer, 0, 0, 5 );
bSizer12->Add( bUpperSizer, 0, wxEXPAND, 5 );
wxStaticBoxSizer* sbSizerMsg;
......@@ -303,6 +324,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
sbSizerMsg->Add( m_messagesBox, 1, wxEXPAND, 5 );
bSizer12->Add( sbSizerMsg, 1, wxEXPAND, 5 );
wxBoxSizer* bSizerButtons;
......@@ -318,12 +340,18 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
m_buttonQuit = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerButtons->Add( m_buttonQuit, 0, wxALL, 5 );
bSizer12->Add( bSizerButtons, 0, wxALIGN_RIGHT|wxRIGHT|wxLEFT, 5 );
m_MainSizer->Add( bSizer12, 1, wxALL|wxEXPAND, 5 );
this->SetSizer( m_MainSizer );
this->Layout();
m_MainSizer->Fit( this );
this->Centre( wxBOTH );
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PLOT_BASE::OnClose ) );
......
This source diff could not be displayed because it is too large. You can view the blob instead.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 17 2010)
// C++ code generated with wxFormBuilder (version Mar 19 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_plot_base__
#define __dialog_plot_base__
#ifndef __DIALOG_PLOT_BASE_H__
#define __DIALOG_PLOT_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
......@@ -30,7 +32,7 @@
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_PLOT_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_PLOT_BASE : public wxDialog
class DIALOG_PLOT_BASE : public DIALOG_SHIM
{
private:
......@@ -40,7 +42,7 @@ class DIALOG_PLOT_BASE : public wxDialog
ID_ALLOW_PRINT_PAD_ON_SILKSCREEN = 1000,
ID_PRINT_REF,
ID_MIROR_OPT,
ID_CREATE_DRILL_FILE,
ID_CREATE_DRILL_FILE
};
wxBoxSizer* m_MainSizer;
......@@ -107,9 +109,9 @@ class DIALOG_PLOT_BASE : public wxDialog
public:
DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plot"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 474,747 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plot"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PLOT_BASE();
};
#endif //__dialog_plot_base__
#endif //__DIALOG_PLOT_BASE_H__
/****************************************/
/* File: dialog_print_for_modedit.cpp */
/****************************************/
// Set this to 1 if you want to test PostScript printing under MSW.
#define wxTEST_POSTSCRIPT_IN_MSW 1
......@@ -30,23 +30,27 @@ static wxPrintData* s_PrintData;
static wxPageSetupDialogData* s_pageSetupData = (wxPageSetupDialogData*) NULL;
/* Dialog to print schematic. Class derived from DIALOG_PRINT_FOR_MODEDIT_BASE
* created by wxFormBuilder
/**
* Class DIALOG_PRINT_FOR_MODEDIT
* is derived from DIALOG_PRINT_FOR_MODEDIT_BASE which is created by wxFormBuilder.
*/
class DIALOG_PRINT_FOR_MODEDIT : public DIALOG_PRINT_FOR_MODEDIT_BASE
{
private:
EDA_DRAW_FRAME* m_Parent;
wxConfig* m_Config;
public:
DIALOG_PRINT_FOR_MODEDIT( EDA_DRAW_FRAME* parent );
~DIALOG_PRINT_FOR_MODEDIT() {};
DIALOG_PRINT_FOR_MODEDIT( PCB_BASE_FRAME* parent );
private:
PCB_BASE_FRAME* m_parent;
wxConfig* m_config;
void OnCloseWindow( wxCloseEvent& event );
/// Open a dialog box for printer setup (printer options, page size ...)
void OnPrintSetup( wxCommandEvent& event );
void OnPrintPreview( wxCommandEvent& event );
/// Called on activate Print button
void OnPrintButtonClick( wxCommandEvent& event );
void OnButtonCancelClick( wxCommandEvent& event ) { Close(); }
......@@ -54,12 +58,7 @@ private:
};
/*************************************************************/
void FOOTPRINT_EDIT_FRAME::ToPrinter( wxCommandEvent& event )
/*************************************************************/
/* Virtual function:
* Display the print dialog
*/
{
if( s_PrintData == NULL ) // First print
{
......@@ -74,34 +73,27 @@ void FOOTPRINT_EDIT_FRAME::ToPrinter( wxCommandEvent& event )
s_PrintData->SetOrientation( GetPageSettings().IsPortrait() ? wxPORTRAIT : wxLANDSCAPE );
DIALOG_PRINT_FOR_MODEDIT* frame = new DIALOG_PRINT_FOR_MODEDIT( this );
DIALOG_PRINT_FOR_MODEDIT dlg( this );
frame->ShowModal();
frame->Destroy();
dlg.ShowModal();
}
/*************************************************************************************/
DIALOG_PRINT_FOR_MODEDIT::DIALOG_PRINT_FOR_MODEDIT( EDA_DRAW_FRAME* parent ) :
DIALOG_PRINT_FOR_MODEDIT::DIALOG_PRINT_FOR_MODEDIT( PCB_BASE_FRAME* parent ) :
DIALOG_PRINT_FOR_MODEDIT_BASE( parent )
/*************************************************************************************/
{
m_Parent = parent;
m_parent = parent;
s_Parameters.m_ForceCentered = true;
m_Config = wxGetApp().GetSettings();
m_config = wxGetApp().GetSettings();
InitValues();
m_buttonPrint->SetDefault();
GetSizer()->SetSizeHints( this );
Center();
}
/************************************************************************/
void DIALOG_PRINT_FOR_MODEDIT::InitValues( )
/************************************************************************/
{
SetFocus();
if( s_pageSetupData == NULL )
{
s_pageSetupData = new wxPageSetupDialogData;
......@@ -115,13 +107,12 @@ void DIALOG_PRINT_FOR_MODEDIT::InitValues( )
// Read the scale adjust option
int scale_Select = 3; // default selected scale = ScaleList[3] = 1
if( m_Config )
if( m_config )
{
m_Config->Read( OPTKEY_PRINT_MODULE_SCALE, &scale_Select );
m_Config->Read( OPTKEY_PRINT_MONOCHROME_MODE, &s_Parameters.m_Print_Black_and_White, 1);
m_config->Read( OPTKEY_PRINT_MODULE_SCALE, &scale_Select );
m_config->Read( OPTKEY_PRINT_MONOCHROME_MODE, &s_Parameters.m_Print_Black_and_White, 1);
}
extern int g_DrawDefaultLineThickness;
s_Parameters.m_PenDefaultSize = g_DrawDefaultLineThickness;
m_ScaleOption->SetSelection( scale_Select );
......@@ -130,25 +121,20 @@ void DIALOG_PRINT_FOR_MODEDIT::InitValues( )
}
/********************************************************************/
void DIALOG_PRINT_FOR_MODEDIT::OnCloseWindow( wxCloseEvent& event )
/********************************************************************/
{
if( m_Config )
if( m_config )
{
m_Config->Write( OPTKEY_PRINT_MODULE_SCALE, m_ScaleOption->GetSelection() );
m_Config->Write( OPTKEY_PRINT_MONOCHROME_MODE, s_Parameters.m_Print_Black_and_White);
m_config->Write( OPTKEY_PRINT_MODULE_SCALE, m_ScaleOption->GetSelection() );
m_config->Write( OPTKEY_PRINT_MONOCHROME_MODE, s_Parameters.m_Print_Black_and_White);
}
EndModal( 0 );
}
/**********************************************************/
void DIALOG_PRINT_FOR_MODEDIT::OnPrintSetup( wxCommandEvent& event )
/**********************************************************/
/* Open a dialog box for printer setup (printer options, page size ...)
*/
void DIALOG_PRINT_FOR_MODEDIT::OnPrintSetup( wxCommandEvent& event )
{
wxPrintDialogData printDialogData( *s_PrintData );
......@@ -163,9 +149,9 @@ void DIALOG_PRINT_FOR_MODEDIT::OnPrintSetup( wxCommandEvent& event )
}
/************************************************************/
void DIALOG_PRINT_FOR_MODEDIT::OnPrintPreview( wxCommandEvent& event )
/************************************************************/
/* Open and display a previewer frame for printing
*/
......@@ -176,8 +162,8 @@ void DIALOG_PRINT_FOR_MODEDIT::OnPrintPreview( wxCommandEvent& event )
// Pass two printout objects: for preview, and possible printing.
wxString title = _( "Print Preview" );
wxPrintPreview* preview =
new wxPrintPreview( new BOARD_PRINTOUT_CONTROLER( s_Parameters, m_Parent, title ),
new BOARD_PRINTOUT_CONTROLER( s_Parameters, m_Parent, title ),
new wxPrintPreview( new BOARD_PRINTOUT_CONTROLER( s_Parameters, m_parent, title ),
new BOARD_PRINTOUT_CONTROLER( s_Parameters, m_parent, title ),
s_PrintData );
if( preview == NULL )
......@@ -187,9 +173,9 @@ void DIALOG_PRINT_FOR_MODEDIT::OnPrintPreview( wxCommandEvent& event )
}
// 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();
wxSize WSize = m_Parent->GetSize();
// @todo uses last position and size ans store them when exit in m_config
wxPoint WPos = m_parent->GetPosition();
wxSize WSize = m_parent->GetSize();
wxPreviewFrame* frame = new wxPreviewFrame( preview, this, title, WPos, WSize );
......@@ -198,24 +184,23 @@ void DIALOG_PRINT_FOR_MODEDIT::OnPrintPreview( wxCommandEvent& event )
}
/***************************************************************************/
void DIALOG_PRINT_FOR_MODEDIT::OnPrintButtonClick( wxCommandEvent& event )
/***************************************************************************/
/* Called on activate Print button
*/
{
PCB_PLOT_PARAMS plot_opts = m_parent->GetPlotSettings();
s_Parameters.m_Print_Black_and_White = m_ModeColorOption->GetSelection();
s_Parameters.m_PrintScale = s_ScaleList[m_ScaleOption->GetSelection()];
g_PcbPlotOptions.m_FineScaleAdjustX = s_Parameters.m_XScaleAdjust;
g_PcbPlotOptions.m_FineScaleAdjustY = s_Parameters.m_YScaleAdjust;
g_PcbPlotOptions.m_PlotScale = s_Parameters.m_PrintScale;
plot_opts.m_FineScaleAdjustX = s_Parameters.m_XScaleAdjust;
plot_opts.m_FineScaleAdjustY = s_Parameters.m_YScaleAdjust;
plot_opts.m_PlotScale = s_Parameters.m_PrintScale;
m_parent->SetPlotSettings( plot_opts );
wxPrintDialogData printDialogData( *s_PrintData );
wxPrinter printer( &printDialogData );
BOARD_PRINTOUT_CONTROLER printout( s_Parameters, m_Parent, _( "Print Footprint" ) );
BOARD_PRINTOUT_CONTROLER printout( s_Parameters, m_parent, _( "Print Footprint" ) );
#if !defined(__WINDOWS__) && !wxCHECK_VERSION(2,9,0)
wxDC* dc = printout.GetDC();
......@@ -232,4 +217,6 @@ void DIALOG_PRINT_FOR_MODEDIT::OnPrintButtonClick( wxCommandEvent& event )
{
*s_PrintData = printer.GetPrintDialogData().GetPrintData();
}
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// C++ code generated with wxFormBuilder (version Mar 19 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -9,7 +9,7 @@
///////////////////////////////////////////////////////////////////////////
DIALOG_PRINT_FOR_MODEDIT_BASE::DIALOG_PRINT_FOR_MODEDIT_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
DIALOG_PRINT_FOR_MODEDIT_BASE::DIALOG_PRINT_FOR_MODEDIT_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
......@@ -25,6 +25,7 @@ DIALOG_PRINT_FOR_MODEDIT_BASE::DIALOG_PRINT_FOR_MODEDIT_BASE( wxWindow* parent,
m_ScaleOption->SetSelection( 3 );
bmiddleLeftSizer->Add( m_ScaleOption, 0, wxALL, 5 );
bMainSizer->Add( bmiddleLeftSizer, 0, wxEXPAND, 5 );
wxBoxSizer* bmiddleRightSizer;
......@@ -38,6 +39,7 @@ DIALOG_PRINT_FOR_MODEDIT_BASE::DIALOG_PRINT_FOR_MODEDIT_BASE( wxWindow* parent,
bmiddleRightSizer->Add( m_ModeColorOption, 0, wxALL|wxEXPAND, 5 );
bMainSizer->Add( bmiddleRightSizer, 1, 0, 5 );
wxBoxSizer* bbuttonsSizer;
......@@ -55,10 +57,15 @@ DIALOG_PRINT_FOR_MODEDIT_BASE::DIALOG_PRINT_FOR_MODEDIT_BASE( wxWindow* parent,
m_buttonQuit = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonQuit, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
bMainSizer->Add( bbuttonsSizer, 0, 0, 5 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
this->Centre( wxBOTH );
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_FOR_MODEDIT_BASE::OnCloseWindow ) );
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// C++ code generated with wxFormBuilder (version Mar 19 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -11,6 +11,7 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/radiobox.h>
#include <wx/gdicmn.h>
......@@ -26,7 +27,7 @@
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_PRINT_FOR_MODEDIT_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_PRINT_FOR_MODEDIT_BASE : public wxDialog
class DIALOG_PRINT_FOR_MODEDIT_BASE : public DIALOG_SHIM
{
private:
......@@ -35,7 +36,7 @@ class DIALOG_PRINT_FOR_MODEDIT_BASE : public wxDialog
{
wxID_PRINT_MODE = 1000,
wxID_PRINT_OPTIONS,
wxID_PRINT_ALL,
wxID_PRINT_ALL
};
wxRadioBox* m_ScaleOption;
......@@ -55,7 +56,7 @@ class DIALOG_PRINT_FOR_MODEDIT_BASE : public wxDialog
public:
DIALOG_PRINT_FOR_MODEDIT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Print"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 375,254 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_PRINT_FOR_MODEDIT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Print"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PRINT_FOR_MODEDIT_BASE();
};
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// C++ code generated with wxFormBuilder (version Mar 19 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -9,7 +9,7 @@
///////////////////////////////////////////////////////////////////////////
DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
......@@ -24,12 +24,15 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare
m_CopperLayersBoxSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Copper Layers:") ), wxVERTICAL );
bleftSizer->Add( m_CopperLayersBoxSizer, 1, wxALL, 5 );
m_TechnicalLayersBoxSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Technical Layers:") ), wxVERTICAL );
bleftSizer->Add( m_TechnicalLayersBoxSizer, 1, wxALL, 5 );
sbLayersSizer->Add( bleftSizer, 1, wxEXPAND, 5 );
m_Exclude_Edges_Pcb = new wxCheckBox( this, wxID_ANY, _("Exclude Edges_Pcb Layer"), wxDefaultPosition, wxDefaultSize, 0 );
......@@ -37,6 +40,7 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare
sbLayersSizer->Add( m_Exclude_Edges_Pcb, 0, wxALL|wxEXPAND, 5 );
bMainSizer->Add( sbLayersSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bmiddleLeftSizer;
......@@ -66,6 +70,7 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare
bmiddleLeftSizer->Add( m_FineAdjustYscaleOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bMainSizer->Add( bmiddleLeftSizer, 0, wxEXPAND, 5 );
wxBoxSizer* bmiddleRightSizer;
......@@ -92,6 +97,7 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare
m_Print_Mirror = new wxCheckBox( this, wxID_ANY, _("Mirror"), wxDefaultPosition, wxDefaultSize, 0 );
sbOptionsSizer->Add( m_Print_Mirror, 0, wxALL, 5 );
bmiddleRightSizer->Add( sbOptionsSizer, 0, wxEXPAND|wxALL, 5 );
wxString m_Drill_Shape_OptChoices[] = { _("No drill mark"), _("Small mark"), _("Real drill") };
......@@ -108,6 +114,7 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare
bmiddleRightSizer->Add( m_ModeColorOption, 0, wxALL|wxEXPAND, 5 );
bMainSizer->Add( bmiddleRightSizer, 0, wxEXPAND, 5 );
wxBoxSizer* bbuttonsSizer;
......@@ -138,10 +145,15 @@ DIALOG_PRINT_USING_PRINTER_base::DIALOG_PRINT_USING_PRINTER_base( wxWindow* pare
bbuttonsSizer->Add( 0, 0, 1, wxEXPAND, 5 );
bMainSizer->Add( bbuttonsSizer, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
this->Centre( wxBOTH );
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PRINT_USING_PRINTER_base::OnCloseWindow ) );
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// C++ code generated with wxFormBuilder (version Mar 19 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -11,6 +11,7 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
......@@ -30,7 +31,7 @@
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_PRINT_USING_PRINTER_base
///////////////////////////////////////////////////////////////////////////////
class DIALOG_PRINT_USING_PRINTER_base : public wxDialog
class DIALOG_PRINT_USING_PRINTER_base : public DIALOG_SHIM
{
private:
......@@ -41,7 +42,7 @@ class DIALOG_PRINT_USING_PRINTER_base : public wxDialog
wxID_PRINT_MODE,
wxID_PAGE_MODE,
wxID_PRINT_OPTIONS,
wxID_PRINT_ALL,
wxID_PRINT_ALL
};
wxStaticBoxSizer* m_CopperLayersBoxSizer;
......@@ -75,7 +76,7 @@ class DIALOG_PRINT_USING_PRINTER_base : public wxDialog
public:
DIALOG_PRINT_USING_PRINTER_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Print"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 551,315 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_PRINT_USING_PRINTER_base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Print"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PRINT_USING_PRINTER_base();
};
......
......@@ -37,6 +37,9 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
wxPoint offset;
wxString msg;
PLOTTER* plotter = NULL;
const PCB_PLOT_PARAMS& plot_opts = aPcb->GetPlotOptions();
LOCALE_IO toggle; // use standard notation for float numbers
// Calculate dimensions and center of PCB
......@@ -64,8 +67,8 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
scale = 1;
HPGL_PLOTTER* hpgl_plotter = new HPGL_PLOTTER;
plotter = hpgl_plotter;
hpgl_plotter->set_pen_number( g_PcbPlotOptions.m_HPGLPenNum );
hpgl_plotter->set_pen_speed( g_PcbPlotOptions.m_HPGLPenSpeed );
hpgl_plotter->set_pen_number( plot_opts.m_HPGLPenNum );
hpgl_plotter->set_pen_speed( plot_opts.m_HPGLPenSpeed );
hpgl_plotter->set_pen_overlap( 0 );
plotter->SetPageSettings( aSheet );
plotter->set_viewport( offset, scale, 0 );
......@@ -91,8 +94,8 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
plotter = ps_plotter;
ps_plotter->SetPageSettings( pageA4 );
plotter->set_viewport( offset, scale, 0 );
break;
}
break;
case PLOT_FORMAT_DXF:
{
......@@ -103,8 +106,8 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
plotter = dxf_plotter;
plotter->SetPageSettings( aSheet );
plotter->set_viewport( offset, scale, 0 );
break;
}
break;
default:
wxASSERT( false );
......@@ -122,19 +125,19 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
switch( PtStruct->Type() )
{
case PCB_LINE_T:
PlotDrawSegment( plotter, (DRAWSEGMENT*) PtStruct, EDGE_LAYER, FILLED );
PlotDrawSegment( plotter, plot_opts, (DRAWSEGMENT*) PtStruct, EDGE_LAYER, FILLED );
break;
case PCB_TEXT_T:
PlotTextePcb( plotter, (TEXTE_PCB*) PtStruct, EDGE_LAYER, FILLED );
PlotTextePcb( plotter, plot_opts, (TEXTE_PCB*) PtStruct, EDGE_LAYER, FILLED );
break;
case PCB_DIMENSION_T:
PlotDimension( plotter, (DIMENSION*) PtStruct, EDGE_LAYER, FILLED );
PlotDimension( plotter, plot_opts, (DIMENSION*) PtStruct, EDGE_LAYER, FILLED );
break;
case PCB_TARGET_T:
PlotPcbTarget( plotter, (PCB_TARGET*) PtStruct, EDGE_LAYER, FILLED );
PlotPcbTarget( plotter, plot_opts, (PCB_TARGET*) PtStruct, EDGE_LAYER, FILLED );
break;
case PCB_MARKER_T: // do not draw
......@@ -182,7 +185,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName,
plotY += intervalle;
plot_diam = (int) ( aToolListBuffer[ii].m_Diameter );
plot_diam = (int) aToolListBuffer[ii].m_Diameter;
x = (int) ( (double) plotX - 200.0 * CharScale - (double)plot_diam / 2.0 );
y = (int) ( (double) plotY + (double) CharSize * CharScale );
plotter->marker( wxPoint( x, y ), plot_diam, ii );
......
......@@ -59,25 +59,28 @@ public:
int m_Layer; // its side (LAYER_N_BACK, or LAYER_N_FRONT)
};
/*
/**
* The dialog to create footprint position files,
* and choose options (one or 2 files, units and force all SMD footprints in list)
*/
class DIALOG_GEN_MODULE_POSITION : public DIALOG_GEN_MODULE_POSITION_BASE
{
private:
PCB_EDIT_FRAME* m_parent;
static int m_unitsOpt;
static int m_fileOpt;
public:
DIALOG_GEN_MODULE_POSITION( PCB_EDIT_FRAME * parent):
DIALOG_GEN_MODULE_POSITION_BASE( parent )
DIALOG_GEN_MODULE_POSITION( PCB_EDIT_FRAME * aParent ):
DIALOG_GEN_MODULE_POSITION_BASE( aParent ),
m_parent( aParent ),
m_plotOpts( aParent->GetPlotSettings() )
{
m_parent = parent;
}
private:
PCB_EDIT_FRAME* m_parent;
PCB_PLOT_PARAMS m_plotOpts;
static int m_unitsOpt;
static int m_fileOpt;
void OnInitDialog( wxInitDialogEvent& event );
void OnOutputDirectoryBrowseClicked( wxCommandEvent& event );
void OnCancelButton( wxCommandEvent& event )
......@@ -115,6 +118,7 @@ private:
}
};
// Static members to remember choices
int DIALOG_GEN_MODULE_POSITION::m_unitsOpt = 0;
int DIALOG_GEN_MODULE_POSITION::m_fileOpt = 0;
......@@ -122,7 +126,7 @@ int DIALOG_GEN_MODULE_POSITION::m_fileOpt = 0;
void DIALOG_GEN_MODULE_POSITION::OnInitDialog( wxInitDialogEvent& event )
{
// Output directory
m_outputDirectoryName->SetValue( g_PcbPlotOptions.GetOutputDirectory() );
m_outputDirectoryName->SetValue( m_plotOpts.GetOutputDirectory() );
m_radioBoxUnits->SetSelection( m_unitsOpt );
m_radioBoxFilesCount->SetSelection( m_fileOpt );
......@@ -176,11 +180,15 @@ void DIALOG_GEN_MODULE_POSITION::OnOKButton( wxCommandEvent& event )
wxString dirStr;
dirStr = m_outputDirectoryName->GetValue();
dirStr.Replace( wxT( "\\" ), wxT( "/" ) );
g_PcbPlotOptions.SetOutputDirectory( dirStr );
m_plotOpts.SetOutputDirectory( dirStr );
m_parent->SetPlotSettings( m_plotOpts );
CreateFiles();
}
bool DIALOG_GEN_MODULE_POSITION::CreateFiles()
{
BOARD * brd = m_parent->GetBoard();
......
......@@ -116,20 +116,20 @@ void DIALOG_GENDRILL::GenDrillAndReportFiles()
UpdateConfig(); // set params and Save drill options
m_Parent->ClearMsgPanel();
m_parent->ClearMsgPanel();
if( m_microViasCount || m_blindOrBuriedViasCount )
hasBuriedVias = true;
for( ; ; )
{
Build_Holes_List( m_Parent->GetBoard(), s_HoleListBuffer,
Build_Holes_List( m_parent->GetBoard(), s_HoleListBuffer,
s_ToolListBuffer, layer1, layer2,
gen_through_holes ? false : true, gen_NPTH_holes );
if( s_ToolListBuffer.size() > 0 ) // holes?
{
fn = m_Parent->GetScreen()->GetFileName();
fn = m_parent->GetScreen()->GetFileName();
layer_extend.Empty();
if( gen_NPTH_holes )
......@@ -169,7 +169,7 @@ void DIALOG_GENDRILL::GenDrillAndReportFiles()
return;
}
EXCELLON_WRITER excellonWriter( m_Parent->GetBoard(),
EXCELLON_WRITER excellonWriter( m_parent->GetBoard(),
aFile, m_FileDrillOffset,
&s_HoleListBuffer, &s_ToolListBuffer );
excellonWriter.SetFormat( !m_UnitDrillIsInch,
......@@ -226,7 +226,7 @@ void DIALOG_GENDRILL::GenDrillAndReportFiles()
layer1++;
layer2++; // use next layer pair
if( layer2 == m_Parent->GetBoard()->GetCopperLayerCount() - 1 )
if( layer2 == m_parent->GetBoard()->GetCopperLayerCount() - 1 )
layer2 = LAYER_N_FRONT; // the last layer is always the
// component layer
}
......@@ -237,7 +237,7 @@ void DIALOG_GENDRILL::GenDrillAndReportFiles()
if( m_Choice_Drill_Report->GetSelection() > 0 )
{
fn = m_Parent->GetScreen()->GetFileName();
fn = m_parent->GetScreen()->GetFileName();
GenDrillReport( fn.GetFullName() );
}
......@@ -628,10 +628,10 @@ void DIALOG_GENDRILL::GenDrillMap( const wxString aFileName,
return;
}
GenDrillMapFile( m_Parent->GetBoard(),
GenDrillMapFile( m_parent->GetBoard(),
plotfile,
dlg.GetPath(),
m_Parent->GetPageSettings(),
m_parent->GetPageSettings(),
s_HoleListBuffer,
s_ToolListBuffer,
m_UnitDrillIsInch,
......@@ -667,8 +667,8 @@ void DIALOG_GENDRILL::GenDrillReport( const wxString aFileName )
return;
}
GenDrillReportFile( report_dest, m_Parent->GetBoard(),
m_Parent->GetScreen()->GetFileName(),
GenDrillReportFile( report_dest, m_parent->GetBoard(),
m_parent->GetScreen()->GetFileName(),
m_UnitDrillIsInch,
s_HoleListBuffer,
s_ToolListBuffer );
......
......@@ -355,11 +355,12 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
if( strnicmp( line, "PcbPlotParams", 13 ) == 0 )
{
PCB_PLOT_PARAMS plot_opts;
PCB_PLOT_PARAMS_PARSER parser( &line[13], aReader->GetSource() );
try
{
g_PcbPlotOptions.Parse( &parser );
plot_opts.Parse( &parser );
}
catch( IO_ERROR& e )
{
......@@ -370,6 +371,8 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
wxMessageBox( msg, _( "Open Board File" ), wxOK | wxICON_ERROR );
}
GetBoard()->SetPlotOptions( plot_opts );
continue;
}
......@@ -801,7 +804,7 @@ static int WriteSetup( FILE* aFile, PCB_EDIT_FRAME* aFrame, BOARD* aBoard )
STRING_FORMATTER sf;
g_PcbPlotOptions.Format( &sf, 0 );
aBoard->GetPlotOptions().Format( &sf, 0 );
wxString record = FROM_UTF8( sf.GetString().c_str() );
record.Replace( wxT("\n"), wxT(""), true );
......
......@@ -573,8 +573,13 @@ void KICAD_PLUGIN::loadSETUP()
if( TESTLINE( "PcbPlotParams" ) )
{
PCB_PLOT_PARAMS plot_opts;
PCB_PLOT_PARAMS_PARSER parser( line + SZ( "PcbPlotParams" ), m_reader->GetSource() );
g_PcbPlotOptions.Parse( &parser );
plot_opts.Parse( &parser );
m_board->SetPlotOptions( plot_opts );
}
else if( TESTLINE( "AuxiliaryAxisOrg" ) )
......@@ -2906,11 +2911,10 @@ void KICAD_PLUGIN::saveSETUP() const
fprintf( m_fp, "AuxiliaryAxisOrg %s\n", fmtBIUPoint( m_board->GetOriginAxisPosition() ).c_str() );
/* @todo no globals
{
STRING_FORMATTER sf;
g_PcbPlotOptions.Format( &sf, 0 );
m_board->GetPlotOptions().Format( &sf, 0 );
wxString record = FROM_UTF8( sf.GetString().c_str() );
......@@ -2919,7 +2923,6 @@ void KICAD_PLUGIN::saveSETUP() const
fprintf( m_fp, "PcbPlotParams %s\n", TO_UTF8( record ) );
}
*/
fprintf( m_fp, "VisibleElements %X\n", bds.GetVisibleElements() );
......
......@@ -6,6 +6,7 @@
#ifndef MODULE_EDITOR_FRAME_H_
#define MODULE_EDITOR_FRAME_H_
#include <wxBasePcbFrame.h>
class FOOTPRINT_EDIT_FRAME : public PCB_BASE_FRAME
{
......@@ -23,6 +24,9 @@ public:
BOARD_DESIGN_SETTINGS& GetDesignSettings() const; // overload PCB_BASE_FRAME, get parent's
void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSettings ); // overload
const PCB_PLOT_PARAMS& GetPlotSettings() const; // overload PCB_BASE_FRAME, get parent's
void SetPlotSettings( const PCB_PLOT_PARAMS& aSettings ); // overload
void InstallOptionsFrame( const wxPoint& pos );
void OnCloseWindow( wxCloseEvent& Event );
......
......@@ -265,6 +265,30 @@ void FOOTPRINT_EDIT_FRAME::SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSett
}
const PCB_PLOT_PARAMS& FOOTPRINT_EDIT_FRAME::GetPlotSettings() const
{
// get the settings from the parent editor, not our BOARD.
PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) GetParent();
wxASSERT( parentFrame );
return parentFrame->GetPlotSettings();
}
void FOOTPRINT_EDIT_FRAME::SetPlotSettings( const PCB_PLOT_PARAMS& aSettings )
{
// set the settings into parent editor, not our BOARD.
PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) GetParent();
wxASSERT( parentFrame );
parentFrame->SetPlotSettings( aSettings );
}
void FOOTPRINT_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
{
if( GetScreen()->IsModify() )
......
......@@ -41,9 +41,14 @@
#define HPGL_PEN_OVERLAY_MIN 0
#define HPGL_PEN_OVERLAY_MAX 0x100
extern int g_DrawDefaultLineThickness;
PCB_PLOT_PARAMS g_PcbPlotOptions;
/**
* Default line thickness in PCnew units used to draw or plot items having a
* default thickness line value (Frame references) (i.e. = 0 ).
* 0 = single pixel line width.
*/
int g_DrawDefaultLineThickness = 60;
using namespace PCBPLOTPARAMS_T;
......@@ -109,7 +114,7 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS()
void PCB_PLOT_PARAMS::Format( OUTPUTFORMATTER* aFormatter,
int aNestLevel ) const throw( IO_ERROR )
int aNestLevel, int aControl ) const throw( IO_ERROR )
{
const char* falseStr = getTokenName( T_false );
const char* trueStr = getTokenName( T_true );
......
......@@ -28,6 +28,8 @@
#include <base_struct.h>
class PCB_PLOT_PARAMS_PARSER;
class LINE_READER;
/**
* Class PCB_PLOT_PARAMS
......@@ -99,7 +101,7 @@ private:
public:
PCB_PLOT_PARAMS();
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel ) const throw( IO_ERROR );
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl=0 ) const throw( IO_ERROR );
void Parse( PCB_PLOT_PARAMS_PARSER* aParser ) throw( IO_ERROR, PARSE_ERROR );
bool operator==( const PCB_PLOT_PARAMS &aPcbPlotParams ) const;
......@@ -157,6 +159,12 @@ public:
};
extern PCB_PLOT_PARAMS g_PcbPlotOptions;
/**
* Default line thickness in PCnew units used to draw or plot items having a
* default thickness line value (Frame references) (i.e. = 0 ).
* 0 = single pixel line width.
*/
extern int g_DrawDefaultLineThickness;
#endif // PCB_PLOT_PARAMS_H_
......@@ -54,8 +54,6 @@
#include <dialog_helpers.h>
extern int g_DrawDefaultLineThickness;
// Keys used in read/write config
#define OPTKEY_DEFAULT_LINEWIDTH_VALUE wxT( "PlotLineWidth" )
#define PCB_SHOW_FULL_RATSNET_OPT wxT( "PcbFulRatsnest" )
......
......@@ -49,10 +49,6 @@
// Colors for layers and items
COLORS_DESIGN_SETTINGS g_ColorsSettings;
int g_DrawDefaultLineThickness = 60; /* Default line thickness in PCnew units used to draw
* or plot items having a default thickness line value
* (Frame references) (i.e. = 0 ). 0 = single pixel line
* width */
bool Drc_On = true;
bool g_AutoDeleteOldTrack = true;
......
This diff is collapsed.
......@@ -2,10 +2,10 @@
* @file pcbnew/pcbplot.h
*/
#ifndef PCBPLOT_H
#define PCBPLOT_H
#ifndef PCBPLOT_H_
#define PCBPLOT_H_
#include "pcb_plot_params.h"
#include <pcb_plot_params.h>
class PLOTTER;
......@@ -30,6 +30,7 @@ class ZONE_CONTAINER;
// Conversion unit constants.
// Convert pcb dimension of 0.1 mil to PS units of inches.
#define SCALE_PS .0001
// Convert dimension 0.1 mil -> HPGL units:
#define SCALE_HPGL 0.102041
......@@ -37,28 +38,25 @@ class ZONE_CONTAINER;
#define SMALL_DRILL 150
void PlotTextePcb( PLOTTER* plotter, TEXTE_PCB* pt_texte, int masque_layer,
void PlotTextePcb( PLOTTER* plotter, const PCB_PLOT_PARAMS& aPlotOpts, TEXTE_PCB* pt_texte, int masque_layer,
EDA_DRAW_MODE_T trace_mode );
/* Plat PCB text type, ie other than text on modules
* prepare the plot settings of text */
void PlotDrawSegment( PLOTTER* plotter, DRAWSEGMENT* PtSegm, int masque_layer,
void PlotDrawSegment( PLOTTER* plotter, const PCB_PLOT_PARAMS& aPlotOpts, DRAWSEGMENT* PtSegm, int masque_layer,
EDA_DRAW_MODE_T trace_mode );
void PlotDimension( PLOTTER* plotter, DIMENSION* Dimension, int masque_layer,
void PlotDimension( PLOTTER* plotter, const PCB_PLOT_PARAMS& aPlotOpts, DIMENSION* Dimension, int masque_layer,
EDA_DRAW_MODE_T trace_mode );
void PlotPcbTarget( PLOTTER* plotter, PCB_TARGET* PtMire, int masque_layer,
void PlotPcbTarget( PLOTTER* plotter, const PCB_PLOT_PARAMS& aPlotOpts, PCB_TARGET* PtMire, int masque_layer,
EDA_DRAW_MODE_T trace_mode );
void Plot_1_EdgeModule( PLOTTER* plotter, EDGE_MODULE* PtEdge,
void Plot_1_EdgeModule( PLOTTER* plotter, const PCB_PLOT_PARAMS& aPlotOpts, EDGE_MODULE* PtEdge,
EDA_DRAW_MODE_T trace_mode, int masque_layer );
void PlotFilledAreas( PLOTTER* plotter, ZONE_CONTAINER* aZone,
void PlotFilledAreas( PLOTTER* plotter, const PCB_PLOT_PARAMS& aPlotOpts, ZONE_CONTAINER* aZone,
EDA_DRAW_MODE_T trace_mode );
// PLOTGERB.CPP
void SelectD_CODE_For_LineDraw( PLOTTER* plotter, int aSize );
#endif // #define PCBPLOT_H
#endif // PCBPLOT_H_
This diff is collapsed.
......@@ -20,6 +20,8 @@ bool PCB_BASE_FRAME::ExportToDxfFile( const wxString& aFullFileName, int aLayer,
{
LOCALE_IO toggle;
const PCB_PLOT_PARAMS& plot_opts = GetPlotSettings();
FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) );
if( output_file == NULL )
......@@ -34,7 +36,7 @@ bool PCB_BASE_FRAME::ExportToDxfFile( const wxString& aFullFileName, int aLayer,
plotter->set_filename( aFullFileName );
plotter->start_plot( output_file );
if( g_PcbPlotOptions.m_PlotFrameRef )
if( plot_opts.m_PlotFrameRef )
PlotWorkSheet( plotter, GetScreen() );
Plot_Layer( plotter, aLayer, aTraceMode );
......
......@@ -27,16 +27,17 @@ bool PCB_BASE_FRAME::ExportToGerberFile( const wxString& aFullFileName, int aLay
bool aPlotOriginIsAuxAxis, EDA_DRAW_MODE_T aTraceMode )
{
FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) );
if( output_file == NULL )
{
return false;
}
PCB_PLOT_PARAMS plot_opts = GetPlotSettings();
wxPoint offset;
// Calculate scaling from Pcbnew units (in 0.1 mil or 0.0001 inch) to gerber units
double scale = g_PcbPlotOptions.m_PlotScale;
double scale = plot_opts.m_PlotScale;
if( aPlotOriginIsAuxAxis )
{
......@@ -54,7 +55,7 @@ bool PCB_BASE_FRAME::ExportToGerberFile( const wxString& aFullFileName, int aLay
// No mirror and scaling for gerbers!
plotter->set_viewport( offset, scale, 0 );
plotter->set_default_line_width( g_PcbPlotOptions.m_PlotLineWidth );
plotter->set_default_line_width( plot_opts.m_PlotLineWidth );
plotter->set_creator( wxT( "PCBNEW-RS274X" ) );
plotter->set_filename( aFullFileName );
......@@ -63,16 +64,21 @@ bool PCB_BASE_FRAME::ExportToGerberFile( const wxString& aFullFileName, int aLay
// Skip NPTH pads on copper layers
// ( only if hole size == pad size ):
if( (aLayer >= LAYER_N_BACK) && (aLayer <= LAYER_N_FRONT) )
g_PcbPlotOptions.m_SkipNPTH_Pads = true;
plot_opts.m_SkipNPTH_Pads = true;
SetPlotSettings( plot_opts );
// Sheet refs on gerber CAN be useful... and they're always 1:1
if( g_PcbPlotOptions.m_PlotFrameRef )
if( plot_opts.m_PlotFrameRef )
PlotWorkSheet( plotter, GetScreen() );
Plot_Layer( plotter, aLayer, aTraceMode );
plotter->end_plot();
g_PcbPlotOptions.m_SkipNPTH_Pads = false;
plot_opts.m_SkipNPTH_Pads = false;
SetPlotSettings( plot_opts );
}
else // error in start_plot( ): failed opening a temporary file
{
......
......@@ -26,7 +26,6 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
double scale;
wxPoint offset;
LOCALE_IO toggle;
FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) );
if( output_file == NULL )
......@@ -34,24 +33,26 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
return false;
}
PCB_PLOT_PARAMS plot_opts = GetPlotSettings();
// Compute pen_dim (from g_m_HPGLPenDiam in mils) in pcb units,
// with plot scale (if Scale is 2, pen diameter is always g_m_HPGLPenDiam
// so apparent pen diam is real pen diam / Scale
int pen_diam = wxRound( (g_PcbPlotOptions.m_HPGLPenDiam * U_PCB) /
g_PcbPlotOptions.m_PlotScale );
int pen_diam = wxRound( (plot_opts.m_HPGLPenDiam * U_PCB) /
plot_opts.m_PlotScale );
// compute pen_overlay (from g_m_HPGLPenOvr in mils) with plot scale
if( g_PcbPlotOptions.m_HPGLPenOvr < 0 )
g_PcbPlotOptions.m_HPGLPenOvr = 0;
if( plot_opts.m_HPGLPenOvr < 0 )
plot_opts.m_HPGLPenOvr = 0;
if( g_PcbPlotOptions.m_HPGLPenOvr >= g_PcbPlotOptions.m_HPGLPenDiam )
g_PcbPlotOptions.m_HPGLPenOvr = g_PcbPlotOptions.m_HPGLPenDiam - 1;
if( plot_opts.m_HPGLPenOvr >= plot_opts.m_HPGLPenDiam )
plot_opts.m_HPGLPenOvr = plot_opts.m_HPGLPenDiam - 1;
int pen_overlay = wxRound( g_PcbPlotOptions.m_HPGLPenOvr * 10.0 /
g_PcbPlotOptions.m_PlotScale );
int pen_overlay = wxRound( plot_opts.m_HPGLPenOvr * 10.0 /
plot_opts.m_PlotScale );
if( g_PcbPlotOptions.m_PlotScale != 1.0 || g_PcbPlotOptions.m_AutoScale )
if( plot_opts.m_PlotScale != 1.0 || plot_opts.m_AutoScale )
{
// when scale != 1.0 we must calculate the position in page
// because actual position has no meaning
......@@ -66,7 +67,7 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
boardSize = bbbox.GetSize();
boardCenter = bbbox.Centre();
if( g_PcbPlotOptions.m_AutoScale ) // Optimum scale
if( plot_opts.m_AutoScale ) // Optimum scale
{
// Fit to 80% of the page
double Xscale = ( ( pageSizeIU.x * 0.8 ) / boardSize.x );
......@@ -75,7 +76,7 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
}
else
{
scale = g_PcbPlotOptions.m_PlotScale;
scale = plot_opts.m_PlotScale;
}
// Calculate the page size offset.
......@@ -96,18 +97,21 @@ bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer
plotter->SetPageSettings( GetPageSettings() );
plotter->set_viewport( offset, scale, g_PcbPlotOptions.m_PlotMirror );
plotter->set_default_line_width( g_PcbPlotOptions.m_PlotLineWidth );
// why did we have to change these settings above?
SetPlotSettings( plot_opts );
plotter->set_viewport( offset, scale, plot_opts.m_PlotMirror );
plotter->set_default_line_width( plot_opts.m_PlotLineWidth );
plotter->set_creator( wxT( "PCBNEW-HPGL" ) );
plotter->set_filename( aFullFileName );
plotter->set_pen_speed( g_PcbPlotOptions.m_HPGLPenSpeed );
plotter->set_pen_number( g_PcbPlotOptions.m_HPGLPenNum );
plotter->set_pen_speed( plot_opts.m_HPGLPenSpeed );
plotter->set_pen_number( plot_opts.m_HPGLPenNum );
plotter->set_pen_overlap( pen_overlay );
plotter->set_pen_diameter( pen_diam );
plotter->start_plot( output_file );
// The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway
if( g_PcbPlotOptions.m_PlotFrameRef && !center )
if( plot_opts.m_PlotFrameRef && !center )
PlotWorkSheet( plotter, GetScreen() );
Plot_Layer( plotter, aLayer, aTraceMode );
......
......@@ -25,6 +25,7 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
bool aUseA4, EDA_DRAW_MODE_T aTraceMode )
{
const PAGE_INFO& pageInfo = GetPageSettings();
PCB_PLOT_PARAMS plotOpts = GetPlotSettings();
wxSize paperSizeIU;
wxSize boardSize;
......@@ -45,7 +46,7 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
return false;
}
if( g_PcbPlotOptions.m_PlotScale != 1.0 || g_PcbPlotOptions.m_AutoScale )
if( plotOpts.m_PlotScale != 1.0 || plotOpts.m_AutoScale )
{
// when scale != 1.0 we must calculate the position in page
// because actual position has no meaning
......@@ -53,8 +54,8 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
}
// Set default line width
if( g_PcbPlotOptions.m_PlotLineWidth < 1 )
g_PcbPlotOptions.m_PlotLineWidth = 1;
if( plotOpts.m_PlotLineWidth < 1 )
plotOpts.m_PlotLineWidth = 1;
wxSize pageSizeIU = GetPageSizeIU();
......@@ -76,7 +77,7 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
boardSize = bbbox.GetSize();
boardCenter = bbbox.Centre();
if( g_PcbPlotOptions.m_AutoScale ) // Optimum scale
if( plotOpts.m_AutoScale ) // Optimum scale
{
// Fit to 80% of the page
double Xscale = (paperSizeIU.x * 0.8) / boardSize.x;
......@@ -86,7 +87,7 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
}
else
{
scale = g_PcbPlotOptions.m_PlotScale * paperscale;
scale = plotOpts.m_PlotScale * paperscale;
}
if( center )
......@@ -104,23 +105,26 @@ bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int
plotter->SetPageSettings( *sheetPS );
plotter->set_scale_adjust( g_PcbPlotOptions.m_FineScaleAdjustX,
g_PcbPlotOptions.m_FineScaleAdjustY );
plotter->set_plot_width_adj( g_PcbPlotOptions.m_FineWidthAdjust );
plotter->set_viewport( offset, scale, g_PcbPlotOptions.m_PlotMirror );
plotter->set_default_line_width( g_PcbPlotOptions.m_PlotLineWidth );
// why did we have to change these settings?
SetPlotSettings( plotOpts );
plotter->set_scale_adjust( plotOpts.m_FineScaleAdjustX,
plotOpts.m_FineScaleAdjustY );
plotter->set_plot_width_adj( plotOpts.m_FineWidthAdjust );
plotter->set_viewport( offset, scale, plotOpts.m_PlotMirror );
plotter->set_default_line_width( plotOpts.m_PlotLineWidth );
plotter->set_creator( wxT( "PCBNEW-PS" ) );
plotter->set_filename( aFullFileName );
plotter->start_plot( output_file );
/* The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway */
if( g_PcbPlotOptions.m_PlotFrameRef && !center )
if( plotOpts.m_PlotFrameRef && !center )
PlotWorkSheet( plotter, GetScreen() );
// If plot a negative board:
// Draw a black rectangle (background for plot board in white)
// and switch the current color to WHITE
if( g_PcbPlotOptions.m_PlotPSNegative )
if( plotOpts.m_PlotPSNegative )
{
int margin = 500; // Add a 0.5 inch margin around the board
plotter->set_negative( true );
......
......@@ -46,9 +46,6 @@
#include <wx/overlay.h>
extern int g_DrawDefaultLineThickness; // Default line thickness, used to draw Frame references
// Local functions:
/* Trace the pads of a module in sketch mode.
* Used to display pads when when the module visibility is set to not visible
......
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