From 372ce6595a8e3a0f9935fcb993db40a777fc46b6 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 25 Mar 2013 14:37:48 +0100 Subject: [PATCH 01/63] Very minor changes in dialog zones. --- pcbnew/dialogs/dialog_copper_zones.cpp | 5 +- .../dialog_keepout_area_properties.cpp | 8 +- .../dialog_keepout_area_properties_base.cpp | 14 +- .../dialog_keepout_area_properties_base.fbp | 443 ++++++++++-------- .../dialog_keepout_area_properties_base.h | 10 +- 5 files changed, 274 insertions(+), 206 deletions(-) diff --git a/pcbnew/dialogs/dialog_copper_zones.cpp b/pcbnew/dialogs/dialog_copper_zones.cpp index 06483cfcd6..37a5b0adc9 100644 --- a/pcbnew/dialogs/dialog_copper_zones.cpp +++ b/pcbnew/dialogs/dialog_copper_zones.cpp @@ -251,12 +251,11 @@ void DIALOG_COPPER_ZONE::initDialog() m_LayerSelectionCtrl->InsertColumn( 0, col0 ); // Build copper layer list and append to layer widget int layerCount = board->GetCopperLayerCount(); - int layerNumber, itemIndex; wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y ); m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL ); for( int ii = 0; ii < layerCount; ii++ ) { - layerNumber = LAYER_N_BACK; + int layerNumber = LAYER_N_BACK; if( layerCount <= 1 || ii < layerCount - 1 ) layerNumber = ii; @@ -268,7 +267,7 @@ void DIALOG_COPPER_ZONE::initDialog() msg = board->GetLayerName( layerNumber ).Trim(); EDA_COLOR_T layerColor = board->GetLayerColor( layerNumber ); imageList->Add( makeLayerBitmap( layerColor ) ); - itemIndex = m_LayerSelectionCtrl->InsertItem( 0, msg, ii ); + int itemIndex = m_LayerSelectionCtrl->InsertItem( 0, msg, ii ); if( m_settings.m_CurrentZone_Layer == layerNumber ) m_LayerSelectionCtrl->Select( itemIndex ); diff --git a/pcbnew/dialogs/dialog_keepout_area_properties.cpp b/pcbnew/dialogs/dialog_keepout_area_properties.cpp index ea400d9ca1..e039da0606 100644 --- a/pcbnew/dialogs/dialog_keepout_area_properties.cpp +++ b/pcbnew/dialogs/dialog_keepout_area_properties.cpp @@ -149,13 +149,11 @@ void DIALOG_KEEPOUT_AREA_PROPERTIES::initDialog() m_LayerSelectionCtrl->InsertColumn( 0, col0 ); // Build copper layer list and append to layer widget int layerCount = board->GetCopperLayerCount(); - int layerNumber, itemIndex; - EDA_COLOR_T layerColor; wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y ); m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL ); for( int ii = 0; ii < layerCount; ii++ ) { - layerNumber = LAYER_N_BACK; + int layerNumber = LAYER_N_BACK; if( layerCount <= 1 || ii < layerCount - 1 ) layerNumber = ii; @@ -165,9 +163,9 @@ void DIALOG_KEEPOUT_AREA_PROPERTIES::initDialog() m_LayerId.insert( m_LayerId.begin(), layerNumber ); msg = board->GetLayerName( layerNumber ); - layerColor = board->GetLayerColor( layerNumber ); + EDA_COLOR_T layerColor = board->GetLayerColor( layerNumber ); imageList->Add( makeLayerBitmap( layerColor ) ); - itemIndex = m_LayerSelectionCtrl->InsertItem( 0, msg, ii ); + int itemIndex = m_LayerSelectionCtrl->InsertItem( 0, msg, ii ); if( m_zonesettings.m_CurrentZone_Layer == layerNumber ) m_LayerSelectionCtrl->Select( itemIndex ); diff --git a/pcbnew/dialogs/dialog_keepout_area_properties_base.cpp b/pcbnew/dialogs/dialog_keepout_area_properties_base.cpp index 507de0d24e..47534ecde3 100644 --- a/pcbnew/dialogs/dialog_keepout_area_properties_base.cpp +++ b/pcbnew/dialogs/dialog_keepout_area_properties_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 10 2012) +// C++ code generated with wxFormBuilder (version Oct 8 2012) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -40,23 +40,21 @@ DIALOG_KEEPOUT_AREA_PROPERTIES_BASE::DIALOG_KEEPOUT_AREA_PROPERTIES_BASE( wxWind wxBoxSizer* bSizerRight; bSizerRight = new wxBoxSizer( wxVERTICAL ); - wxStaticBoxSizer* m_OutilinesBoxOpt; - m_OutilinesBoxOpt = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Outlines Options:") ), wxVERTICAL ); + m_staticTextprops = new wxStaticText( this, wxID_ANY, _("Properties:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextprops->Wrap( -1 ); + bSizerRight->Add( m_staticTextprops, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); wxString m_OrientEdgesOptChoices[] = { _("Any"), _("H, V and 45 deg") }; int m_OrientEdgesOptNChoices = sizeof( m_OrientEdgesOptChoices ) / sizeof( wxString ); m_OrientEdgesOpt = new wxRadioBox( this, wxID_ANY, _("Zone Edges Orient"), wxDefaultPosition, wxDefaultSize, m_OrientEdgesOptNChoices, m_OrientEdgesOptChoices, 1, wxRA_SPECIFY_COLS ); m_OrientEdgesOpt->SetSelection( 0 ); - m_OutilinesBoxOpt->Add( m_OrientEdgesOpt, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + bSizerRight->Add( m_OrientEdgesOpt, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); wxString m_OutlineAppearanceCtrlChoices[] = { _("Line"), _("Hatched Outline"), _("Full Hatched") }; int m_OutlineAppearanceCtrlNChoices = sizeof( m_OutlineAppearanceCtrlChoices ) / sizeof( wxString ); m_OutlineAppearanceCtrl = new wxRadioBox( this, wxID_ANY, _("Outlines Appearence"), wxDefaultPosition, wxDefaultSize, m_OutlineAppearanceCtrlNChoices, m_OutlineAppearanceCtrlChoices, 1, wxRA_SPECIFY_COLS ); m_OutlineAppearanceCtrl->SetSelection( 1 ); - m_OutilinesBoxOpt->Add( m_OutlineAppearanceCtrl, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - - bSizerRight->Add( m_OutilinesBoxOpt, 0, wxEXPAND|wxALL, 5 ); + bSizerRight->Add( m_OutlineAppearanceCtrl, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); wxStaticBoxSizer* sbSizerCutoutOpts; sbSizerCutoutOpts = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Keepout Options:") ), wxVERTICAL ); diff --git a/pcbnew/dialogs/dialog_keepout_area_properties_base.fbp b/pcbnew/dialogs/dialog_keepout_area_properties_base.fbp index d3b2aa9699..5f2969b46e 100644 --- a/pcbnew/dialogs/dialog_keepout_area_properties_base.fbp +++ b/pcbnew/dialogs/dialog_keepout_area_properties_base.fbp @@ -42,7 +42,7 @@ DIALOG_KEEPOUT_AREA_PROPERTIES_BASE - 308,355 + 308,338 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Keepout Area Properties @@ -310,196 +310,265 @@ none 5 - wxEXPAND|wxALL + wxTOP|wxRIGHT|wxLEFT 0 - + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 wxID_ANY - Outlines Options: + Properties: + + 0 + + + 0 - m_OutilinesBoxOpt - wxVERTICAL - none + 1 + m_staticTextprops + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Any" "H, V and 45 deg" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Zone Edges Orient + 1 + + 0 + + + 0 + + 1 + m_OrientEdgesOpt + 1 + + + protected + 1 + + Resizable + 0 + 1 + + wxRA_SPECIFY_COLS + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Line" "Hatched Outline" "Full Hatched" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Outlines Appearence + 1 + + 0 + + + 0 + + 1 + m_OutlineAppearanceCtrl + 1 + + + protected + 1 + + Resizable + 1 + 1 + + wxRA_SPECIFY_COLS + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + - - 5 - wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Any" "H, V and 45 deg" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Zone Edges Orient - 1 - - 0 - - - 0 - - 1 - m_OrientEdgesOpt - 1 - - - protected - 1 - - Resizable - 0 - 1 - - wxRA_SPECIFY_COLS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Line" "Hatched Outline" "Full Hatched" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Outlines Appearence - 1 - - 0 - - - 0 - - 1 - m_OutlineAppearanceCtrl - 1 - - - protected - 1 - - Resizable - 1 - 1 - - wxRA_SPECIFY_COLS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pcbnew/dialogs/dialog_keepout_area_properties_base.h b/pcbnew/dialogs/dialog_keepout_area_properties_base.h index bd16619914..6ffbd255f4 100644 --- a/pcbnew/dialogs/dialog_keepout_area_properties_base.h +++ b/pcbnew/dialogs/dialog_keepout_area_properties_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 10 2012) +// C++ code generated with wxFormBuilder (version Oct 8 2012) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -11,6 +11,9 @@ #include #include #include +class DIALOG_SHIM; +class wxListView; + #include "dialog_shim.h" #include #include @@ -21,8 +24,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -45,6 +48,7 @@ class DIALOG_KEEPOUT_AREA_PROPERTIES_BASE : public DIALOG_SHIM protected: wxStaticText* m_staticTextLayerSelection; wxListView* m_LayerSelectionCtrl; + wxStaticText* m_staticTextprops; wxRadioBox* m_OrientEdgesOpt; wxRadioBox* m_OutlineAppearanceCtrl; wxCheckBox* m_cbTracksCtrl; @@ -62,7 +66,7 @@ class DIALOG_KEEPOUT_AREA_PROPERTIES_BASE : public DIALOG_SHIM public: - DIALOG_KEEPOUT_AREA_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Keepout Area Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 308,355 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER ); + DIALOG_KEEPOUT_AREA_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Keepout Area Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 308,338 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER ); ~DIALOG_KEEPOUT_AREA_PROPERTIES_BASE(); }; From 8d61cd0e5b31324ae004a963d4e8f4e2f6ca46e9 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 25 Mar 2013 18:02:29 +0100 Subject: [PATCH 02/63] Pcbnew: fix issue in zone keepout dialog: layers not displayed on Linux --- pcbnew/dialogs/dialog_copper_zones.cpp | 8 +++-- pcbnew/dialogs/dialog_copper_zones_base.cpp | 25 +++++++++------ pcbnew/dialogs/dialog_copper_zones_base.fbp | 10 +++--- pcbnew/dialogs/dialog_copper_zones_base.h | 7 ++-- .../dialog_keepout_area_properties.cpp | 32 +++++++++---------- .../dialog_keepout_area_properties_base.cpp | 11 ++++--- .../dialog_keepout_area_properties_base.fbp | 16 +++++----- .../dialog_keepout_area_properties_base.h | 5 ++- 8 files changed, 65 insertions(+), 49 deletions(-) diff --git a/pcbnew/dialogs/dialog_copper_zones.cpp b/pcbnew/dialogs/dialog_copper_zones.cpp index 37a5b0adc9..9198f04125 100644 --- a/pcbnew/dialogs/dialog_copper_zones.cpp +++ b/pcbnew/dialogs/dialog_copper_zones.cpp @@ -246,9 +246,9 @@ void DIALOG_COPPER_ZONE::initDialog() m_settings.m_ArcToSegmentsCount == ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF ? 1 : 0 ); // Create one column in m_LayerSelectionCtrl - wxListItem col0; - col0.SetId( 0 ); - m_LayerSelectionCtrl->InsertColumn( 0, col0 ); + wxListItem column0; + column0.SetId( 0 ); + m_LayerSelectionCtrl->InsertColumn( 0, column0 ); // Build copper layer list and append to layer widget int layerCount = board->GetCopperLayerCount(); wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y ); @@ -273,6 +273,8 @@ void DIALOG_COPPER_ZONE::initDialog() m_LayerSelectionCtrl->Select( itemIndex ); } + m_LayerSelectionCtrl->SetColumnWidth( -1, wxLIST_AUTOSIZE); + wxString netNameDoNotShowFilter = wxT( "N-*" ); if( m_Config ) { diff --git a/pcbnew/dialogs/dialog_copper_zones_base.cpp b/pcbnew/dialogs/dialog_copper_zones_base.cpp index 02e794730b..fd3f870df6 100644 --- a/pcbnew/dialogs/dialog_copper_zones_base.cpp +++ b/pcbnew/dialogs/dialog_copper_zones_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 10 2012) +// C++ code generated with wxFormBuilder (version Oct 8 2012) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -39,24 +39,24 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i m_staticText17->Wrap( -1 ); m_layerSizer->Add( m_staticText17, 0, wxTOP|wxRIGHT, 5 ); - m_LayerSelectionCtrl = new wxListView( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_NO_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL ); - m_layerSizer->Add( m_LayerSelectionCtrl, 1, wxEXPAND|wxRIGHT, 5 ); + m_LayerSelectionCtrl = new wxListView( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_ALIGN_LEFT|wxLC_NO_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL ); + m_layerSizer->Add( m_LayerSelectionCtrl, 1, wxRIGHT, 5 ); - m_OptionsBoxSizer->Add( m_layerSizer, 1, wxEXPAND, 5 ); + m_OptionsBoxSizer->Add( m_layerSizer, 0, wxEXPAND, 5 ); - wxBoxSizer* bSizer7; - bSizer7 = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bSizerNets; + bSizerNets = new wxBoxSizer( wxVERTICAL ); m_staticText2 = new wxStaticText( this, wxID_ANY, _("Net:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText2->Wrap( -1 ); - bSizer7->Add( m_staticText2, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + bSizerNets->Add( m_staticText2, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_ListNetNameSelection = new wxListBox( this, ID_NETNAME_SELECTION, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - bSizer7->Add( m_ListNetNameSelection, 1, wxEXPAND, 5 ); + bSizerNets->Add( m_ListNetNameSelection, 1, wxEXPAND, 5 ); - m_OptionsBoxSizer->Add( bSizer7, 1, wxEXPAND, 5 ); + m_OptionsBoxSizer->Add( bSizerNets, 1, wxEXPAND, 5 ); wxStaticBoxSizer* m_NetSortOptSizer; m_NetSortOptSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Net Filtering") ), wxVERTICAL ); @@ -76,6 +76,7 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i m_NetSortOptSizer->Add( m_staticText5, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_DoNotShowNetNameFilter = new wxTextCtrl( this, ID_TEXTCTRL_NETNAMES_FILTER, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); + m_DoNotShowNetNameFilter->SetMaxLength( 0 ); m_DoNotShowNetNameFilter->SetToolTip( _("Pattern to filter net names in filtered list.\nNet names matching this pattern are not displayed.") ); m_NetSortOptSizer->Add( m_DoNotShowNetNameFilter, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); @@ -85,6 +86,7 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i m_NetSortOptSizer->Add( m_staticText51, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_ShowNetNameFilter = new wxTextCtrl( this, ID_TEXTCTRL_NETNAMES_FILTER, _("*"), wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER ); + m_ShowNetNameFilter->SetMaxLength( 0 ); m_ShowNetNameFilter->SetToolTip( _("Pattern to filter net names in filtered list.\nOnly net names matching this pattern are displayed.") ); m_NetSortOptSizer->Add( m_ShowNetNameFilter, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); @@ -109,6 +111,7 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i bSizerSettings->Add( m_ClearanceValueTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_ZoneClearanceCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_ZoneClearanceCtrl->SetMaxLength( 0 ); bSizerSettings->Add( m_ZoneClearanceCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_MinThicknessValueTitle = new wxStaticText( this, wxID_ANY, _("Minimum width"), wxDefaultPosition, wxDefaultSize, 0 ); @@ -118,6 +121,7 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i bSizerSettings->Add( m_MinThicknessValueTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_ZoneMinThicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_ZoneMinThicknessCtrl->SetMaxLength( 0 ); bSizerSettings->Add( m_ZoneMinThicknessCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_staticText151 = new wxStaticText( this, wxID_ANY, _("Corner smoothing:"), wxDefaultPosition, wxDefaultSize, 0 ); @@ -135,6 +139,7 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i bSizerSettings->Add( m_cornerSmoothingTitle, 0, wxRIGHT|wxLEFT, 5 ); m_cornerSmoothingCtrl = new wxTextCtrl( this, ID_M_CORNERSMOOTHINGCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_cornerSmoothingCtrl->SetMaxLength( 0 ); bSizerSettings->Add( m_cornerSmoothingCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); @@ -161,6 +166,7 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i m_ThermalShapesParamsSizer->Add( m_AntipadSizeText, 0, wxTOP|wxRIGHT, 5 ); m_AntipadSizeValue = new wxTextCtrl( this, wxID_ANTIPAD_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_AntipadSizeValue->SetMaxLength( 0 ); m_AntipadSizeValue->SetToolTip( _("Clearance between pads in the same net and filled areas.") ); m_ThermalShapesParamsSizer->Add( m_AntipadSizeValue, 0, wxEXPAND|wxBOTTOM, 5 ); @@ -170,6 +176,7 @@ DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID i m_ThermalShapesParamsSizer->Add( m_CopperBridgeWidthText, 0, wxTOP|wxRIGHT, 5 ); m_CopperWidthValue = new wxTextCtrl( this, wxID_COPPER_BRIDGE_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_CopperWidthValue->SetMaxLength( 0 ); m_CopperWidthValue->SetToolTip( _("Width of copper in thermal reliefs.") ); m_ThermalShapesParamsSizer->Add( m_CopperWidthValue, 0, wxEXPAND|wxBOTTOM, 5 ); diff --git a/pcbnew/dialogs/dialog_copper_zones_base.fbp b/pcbnew/dialogs/dialog_copper_zones_base.fbp index 82fa8cbe9d..c80a953e65 100644 --- a/pcbnew/dialogs/dialog_copper_zones_base.fbp +++ b/pcbnew/dialogs/dialog_copper_zones_base.fbp @@ -42,7 +42,7 @@ DIALOG_COPPER_ZONE_BASE - 567,500 + 567,443 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Copper Zone Properties @@ -103,7 +103,7 @@ 5 wxEXPAND - 1 + 0 m_layerSizer @@ -194,7 +194,7 @@ 5 - wxEXPAND|wxRIGHT + wxRIGHT 1 1 @@ -241,7 +241,7 @@ Resizable 1 - wxLC_NO_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL + wxLC_ALIGN_LEFT|wxLC_NO_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL wxListView; 0 @@ -305,7 +305,7 @@ 1 - bSizer7 + bSizerNets wxVERTICAL none diff --git a/pcbnew/dialogs/dialog_copper_zones_base.h b/pcbnew/dialogs/dialog_copper_zones_base.h index 904802b9cb..1b7eff8ce0 100644 --- a/pcbnew/dialogs/dialog_copper_zones_base.h +++ b/pcbnew/dialogs/dialog_copper_zones_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 10 2012) +// C++ code generated with wxFormBuilder (version Oct 8 2012) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -11,6 +11,9 @@ #include #include #include +class DIALOG_SHIM; +class wxListView; + #include "dialog_shim.h" #include #include @@ -126,7 +129,7 @@ class DIALOG_COPPER_ZONE_BASE : public DIALOG_SHIM public: - DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID id = ID_DIALOG_COPPER_ZONE_BASE, const wxString& title = _("Copper Zone Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 567,500 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID id = ID_DIALOG_COPPER_ZONE_BASE, const wxString& title = _("Copper Zone Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 567,443 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_COPPER_ZONE_BASE(); }; diff --git a/pcbnew/dialogs/dialog_keepout_area_properties.cpp b/pcbnew/dialogs/dialog_keepout_area_properties.cpp index e039da0606..52536f8fdd 100644 --- a/pcbnew/dialogs/dialog_keepout_area_properties.cpp +++ b/pcbnew/dialogs/dialog_keepout_area_properties.cpp @@ -5,9 +5,9 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr - * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2013 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr + * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck + * Copyright (C) 1992-2013 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 @@ -55,12 +55,12 @@ public: DIALOG_KEEPOUT_AREA_PROPERTIES( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aSettings ); private: - PCB_BASE_FRAME* m_Parent; - wxConfig* m_Config; ///< Current config + PCB_BASE_FRAME* m_parent; + wxConfig* m_config; ///< Current config ZONE_SETTINGS m_zonesettings; ZONE_SETTINGS* m_ptr; - std::vector m_LayerId; ///< Handle the real layer number from layer + std::vector m_layerId; ///< Handle the real layer number from layer ///< name position in m_LayerSelectionCtrl /** @@ -105,8 +105,8 @@ ZONE_EDIT_T InvokeKeepoutAreaEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSe DIALOG_KEEPOUT_AREA_PROPERTIES::DIALOG_KEEPOUT_AREA_PROPERTIES( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* aSettings ) : DIALOG_KEEPOUT_AREA_PROPERTIES_BASE( aParent ) { - m_Parent = aParent; - m_Config = wxGetApp().GetSettings(); + m_parent = aParent; + m_config = wxGetApp().GetSettings(); m_ptr = aSettings; m_zonesettings = *aSettings; @@ -121,7 +121,7 @@ DIALOG_KEEPOUT_AREA_PROPERTIES::DIALOG_KEEPOUT_AREA_PROPERTIES( PCB_BASE_FRAME* void DIALOG_KEEPOUT_AREA_PROPERTIES::initDialog() { - BOARD* board = m_Parent->GetBoard(); + BOARD* board = m_parent->GetBoard(); wxString msg; @@ -144,9 +144,9 @@ void DIALOG_KEEPOUT_AREA_PROPERTIES::initDialog() } // Create one column in m_LayerSelectionCtrl - wxListItem col0; - col0.SetId( 0 ); - m_LayerSelectionCtrl->InsertColumn( 0, col0 ); + wxListItem column0; + column0.SetId( 0 ); + m_LayerSelectionCtrl->InsertColumn( 0, column0 ); // Build copper layer list and append to layer widget int layerCount = board->GetCopperLayerCount(); wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y ); @@ -160,7 +160,7 @@ void DIALOG_KEEPOUT_AREA_PROPERTIES::initDialog() else if( ii == layerCount - 1 ) layerNumber = LAYER_N_FRONT; - m_LayerId.insert( m_LayerId.begin(), layerNumber ); + m_layerId.insert( m_layerId.begin(), layerNumber ); msg = board->GetLayerName( layerNumber ); EDA_COLOR_T layerColor = board->GetLayerColor( layerNumber ); @@ -228,7 +228,7 @@ bool DIALOG_KEEPOUT_AREA_PROPERTIES::AcceptOptionsForKeepOut() return false; } - m_zonesettings.m_CurrentZone_Layer = m_LayerId[ii]; + m_zonesettings.m_CurrentZone_Layer = m_layerId[ii]; switch( m_OutlineAppearanceCtrl->GetSelection() ) { case 0: @@ -244,9 +244,9 @@ bool DIALOG_KEEPOUT_AREA_PROPERTIES::AcceptOptionsForKeepOut() break; } - if( m_Config ) + if( m_config ) { - m_Config->Write( ZONE_NET_OUTLINES_HATCH_OPTION_KEY, + m_config->Write( ZONE_NET_OUTLINES_HATCH_OPTION_KEY, (long) m_zonesettings.m_Zone_HatchingStyle ); } diff --git a/pcbnew/dialogs/dialog_keepout_area_properties_base.cpp b/pcbnew/dialogs/dialog_keepout_area_properties_base.cpp index 47534ecde3..90355241c4 100644 --- a/pcbnew/dialogs/dialog_keepout_area_properties_base.cpp +++ b/pcbnew/dialogs/dialog_keepout_area_properties_base.cpp @@ -10,6 +10,7 @@ /////////////////////////////////////////////////////////////////////////// BEGIN_EVENT_TABLE( DIALOG_KEEPOUT_AREA_PROPERTIES_BASE, DIALOG_SHIM ) + EVT_SIZE( DIALOG_KEEPOUT_AREA_PROPERTIES_BASE::_wxFB_OnSize ) EVT_BUTTON( wxID_CANCEL, DIALOG_KEEPOUT_AREA_PROPERTIES_BASE::_wxFB_OnCancelClick ) EVT_BUTTON( wxID_OK, DIALOG_KEEPOUT_AREA_PROPERTIES_BASE::_wxFB_OnOkClick ) END_EVENT_TABLE() @@ -27,12 +28,12 @@ DIALOG_KEEPOUT_AREA_PROPERTIES_BASE::DIALOG_KEEPOUT_AREA_PROPERTIES_BASE( wxWind wxBoxSizer* m_layersListSizer; m_layersListSizer = new wxBoxSizer( wxVERTICAL ); - m_staticTextLayerSelection = new wxStaticText( this, wxID_ANY, _("Layer selection:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextLayerSelection = new wxStaticText( this, wxID_ANY, _("Layer:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextLayerSelection->Wrap( -1 ); m_layersListSizer->Add( m_staticTextLayerSelection, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - m_LayerSelectionCtrl = new wxListView( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_ALIGN_LEFT|wxLC_ICON|wxLC_NO_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_SMALL_ICON ); - m_layersListSizer->Add( m_LayerSelectionCtrl, 1, wxALL|wxEXPAND, 5 ); + m_LayerSelectionCtrl = new wxListView( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_ALIGN_LEFT|wxLC_NO_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL ); + m_layersListSizer->Add( m_LayerSelectionCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); m_UpperSizer->Add( m_layersListSizer, 1, wxEXPAND, 5 ); @@ -48,7 +49,7 @@ DIALOG_KEEPOUT_AREA_PROPERTIES_BASE::DIALOG_KEEPOUT_AREA_PROPERTIES_BASE( wxWind int m_OrientEdgesOptNChoices = sizeof( m_OrientEdgesOptChoices ) / sizeof( wxString ); m_OrientEdgesOpt = new wxRadioBox( this, wxID_ANY, _("Zone Edges Orient"), wxDefaultPosition, wxDefaultSize, m_OrientEdgesOptNChoices, m_OrientEdgesOptChoices, 1, wxRA_SPECIFY_COLS ); m_OrientEdgesOpt->SetSelection( 0 ); - bSizerRight->Add( m_OrientEdgesOpt, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + bSizerRight->Add( m_OrientEdgesOpt, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); wxString m_OutlineAppearanceCtrlChoices[] = { _("Line"), _("Hatched Outline"), _("Full Hatched") }; int m_OutlineAppearanceCtrlNChoices = sizeof( m_OutlineAppearanceCtrlChoices ) / sizeof( wxString ); @@ -87,7 +88,7 @@ DIALOG_KEEPOUT_AREA_PROPERTIES_BASE::DIALOG_KEEPOUT_AREA_PROPERTIES_BASE( wxWind m_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel ); m_sdbSizerButtons->Realize(); - m_MainSizer->Add( m_sdbSizerButtons, 0, wxEXPAND, 5 ); + m_MainSizer->Add( m_sdbSizerButtons, 0, wxEXPAND|wxALL, 5 ); this->SetSizer( m_MainSizer ); diff --git a/pcbnew/dialogs/dialog_keepout_area_properties_base.fbp b/pcbnew/dialogs/dialog_keepout_area_properties_base.fbp index 5f2969b46e..be963ad401 100644 --- a/pcbnew/dialogs/dialog_keepout_area_properties_base.fbp +++ b/pcbnew/dialogs/dialog_keepout_area_properties_base.fbp @@ -22,7 +22,7 @@ 1 1 1 - 1 + 0 0 0 @@ -42,7 +42,7 @@ DIALOG_KEEPOUT_AREA_PROPERTIES_BASE - 308,338 + 358,338 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Keepout Area Properties @@ -84,7 +84,7 @@ - + OnSize @@ -141,7 +141,7 @@ 0 0 wxID_ANY - Layer selection: + Layer: 0 @@ -194,7 +194,7 @@ 5 - wxALL|wxEXPAND + wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND 1 1 @@ -241,7 +241,7 @@ Resizable 1 - wxLC_ALIGN_LEFT|wxLC_ICON|wxLC_NO_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_SMALL_ICON + wxLC_ALIGN_LEFT|wxLC_NO_HEADER|wxLC_REPORT|wxLC_SINGLE_SEL wxListView; 0 @@ -393,7 +393,7 @@ 5 - wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 0 1 @@ -936,7 +936,7 @@ 5 - wxEXPAND + wxEXPAND|wxALL 0 0 diff --git a/pcbnew/dialogs/dialog_keepout_area_properties_base.h b/pcbnew/dialogs/dialog_keepout_area_properties_base.h index 6ffbd255f4..04c6e47057 100644 --- a/pcbnew/dialogs/dialog_keepout_area_properties_base.h +++ b/pcbnew/dialogs/dialog_keepout_area_properties_base.h @@ -32,6 +32,7 @@ class wxListView; /////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////// /// Class DIALOG_KEEPOUT_AREA_PROPERTIES_BASE /////////////////////////////////////////////////////////////////////////////// @@ -41,6 +42,7 @@ class DIALOG_KEEPOUT_AREA_PROPERTIES_BASE : public DIALOG_SHIM private: // Private event handlers + void _wxFB_OnSize( wxSizeEvent& event ){ OnSize( event ); } void _wxFB_OnCancelClick( wxCommandEvent& event ){ OnCancelClick( event ); } void _wxFB_OnOkClick( wxCommandEvent& event ){ OnOkClick( event ); } @@ -60,13 +62,14 @@ class DIALOG_KEEPOUT_AREA_PROPERTIES_BASE : public DIALOG_SHIM wxButton* m_sdbSizerButtonsCancel; // Virtual event handlers, overide them in your derived class + virtual void OnSize( wxSizeEvent& event ) { event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } public: - DIALOG_KEEPOUT_AREA_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Keepout Area Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 308,338 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER ); + DIALOG_KEEPOUT_AREA_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Keepout Area Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 358,338 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER ); ~DIALOG_KEEPOUT_AREA_PROPERTIES_BASE(); }; From db5d90ce9fce7281b2c79721ad0e1b47a0176669 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Mon, 25 Mar 2013 13:09:55 -0400 Subject: [PATCH 03/63] Fix SCH_FIELD get reference designator text bug. (fixes lp:1159401) --- eeschema/sch_field.cpp | 8 ++++---- eeschema/sch_field.h | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index bc9da6c744..7a86a35a3e 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -90,7 +90,7 @@ EDA_ITEM* SCH_FIELD::Clone() const } -const wxString SCH_FIELD::GetText() const +const wxString SCH_FIELD::GetFullyQualifiedText() const { wxString text = m_Text; @@ -194,7 +194,7 @@ void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, color = ReturnLayerColor( LAYER_FIELDS ); } - DrawGraphicText( panel, DC, textpos, color, GetText(), orient, m_Size, + DrawGraphicText( panel, DC, textpos, color, GetFullyQualifiedText(), orient, m_Size, GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, LineWidth, m_Italic, m_Bold ); @@ -387,7 +387,7 @@ void SCH_FIELD::Place( SCH_EDIT_FRAME* frame, wxDC* DC ) bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation ) { bool match; - wxString text = GetText(); + wxString text = GetFullyQualifiedText(); if( ((m_id > VALUE) && !(aSearchData.GetFlags() & FR_SEARCH_ALL_FIELDS)) || ((m_id == REFERENCE) && !(aSearchData.GetFlags() & FR_REPLACE_REFERENCES)) ) @@ -427,7 +427,7 @@ bool SCH_FIELD::Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint bool SCH_FIELD::Replace( wxFindReplaceData& aSearchData, void* aAuxData ) { bool isReplaced; - wxString text = GetText(); + wxString text = GetFullyQualifiedText(); if( m_id == REFERENCE && aAuxData != NULL ) { diff --git a/eeschema/sch_field.h b/eeschema/sch_field.h index de1a03af95..fd1fca9e7c 100644 --- a/eeschema/sch_field.h +++ b/eeschema/sch_field.h @@ -89,13 +89,14 @@ public: void SetId( int aId ) { m_id = aId; } /** - * Function GetText - * overrides the default implementation to allow for the part suffix to be added - * to the reference designator field if the component has multiple parts. + * Function GetFullyQualifiedText + * returns the fully qualified field text by allowing for the part suffix to be added + * to the reference designator field if the component has multiple parts. For all other + * fields this is the equivalent of EDA_TEXT::GetText(). * * @return a const wxString object containing the field's string. */ - const wxString GetText() const; + const wxString GetFullyQualifiedText() const; void Place( SCH_EDIT_FRAME* frame, wxDC* DC ); From 00bdc800874a3c3d8fcd15f11f23431d76c20167 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 26 Mar 2013 10:58:40 +0100 Subject: [PATCH 04/63] Pcbnew: Fix a collision name between 2 methods: EDA_ITEM::GetFlags() and ZONE_CONTAINER::GetFlags(), which creates a very strange behavior when creating/edition zones. ZONE_CONTAINER::GetFlags() is now named ZONE_CONTAINER::GetLocalFlags(). --- pcbnew/class_board.cpp | 6 +++--- pcbnew/class_board.h | 7 +++---- pcbnew/class_zone.cpp | 5 ++--- pcbnew/class_zone.h | 6 +++--- pcbnew/export_vrml.cpp | 10 ++++------ pcbnew/legacy_plugin.cpp | 4 ++-- pcbnew/zones_test_and_combine_areas.cpp | 7 ++++--- 7 files changed, 21 insertions(+), 24 deletions(-) diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 1a77fe35a2..0e8fe450b5 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -2272,9 +2272,9 @@ bool BOARD::NormalizeAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList, ZONE_CONTAI // mark all areas as unmodified except this one, if modified for( unsigned ia = 0; ia < m_ZoneDescriptorList.size(); ia++ ) - m_ZoneDescriptorList[ia]->SetFlags( 0 ); + m_ZoneDescriptorList[ia]->SetLocalFlags( 0 ); - aCurrArea->SetFlags( 1 ); + aCurrArea->SetLocalFlags( 1 ); if( curr_polygon->IsPolygonSelfIntersecting() ) { @@ -2299,7 +2299,7 @@ bool BOARD::NormalizeAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList, ZONE_CONTAI delete NewArea->Outline(); NewArea->SetOutline( new_p ); NewArea->Outline()->Hatch(); - NewArea->SetFlags( 1 ); + NewArea->SetLocalFlags( 1 ); } } diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index abad85ec46..218fee5ef5 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -1107,7 +1107,6 @@ public: * @param aNewZonesList = a PICKED_ITEMS_LIST * where to store new created areas pickers * @param aCurrArea = the zone to process * @return true if changes are made - * Also sets areas->utility1 flags if areas are modified */ bool NormalizeAreaPolygon( PICKED_ITEMS_LIST* aNewZonesList, ZONE_CONTAINER* aCurrArea ); @@ -1130,13 +1129,13 @@ public: * @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas (useful * in undo commands can be NULL * @param aNetCode = net to consider - * @param aUseUtility : if true, don't check areas if both utility flags are 0 - * Sets utility flag = 1 for any areas modified + * @param aUseLocalFlags : if true, don't check areas if both local flags are 0 + * Sets local flag = 1 for any areas modified * @return true if some areas modified */ bool CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList, int aNetCode, - bool aUseUtility ); + bool aUseLocalFlags ); /** * Function RemoveArea diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index 2d598130b0..d3ad2608ea 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -66,7 +66,7 @@ ZONE_CONTAINER::ZONE_CONTAINER( BOARD* aBoard ) : SetDoNotAllowVias( true ); // has meaning only if m_isKeepout == true SetDoNotAllowTracks( true ); // has meaning only if m_isKeepout == true m_cornerRadius = 0; - utility = 0; // flags used in polygon calculations + SetLocalFlags( 0 ); // flags tempoarry used in zone calculations m_Poly = new CPolyLine(); // Outlines aBoard->GetZoneSettings().ExportSetting( *this ); } @@ -101,8 +101,7 @@ ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) : m_cornerSmoothingType = aZone.m_cornerSmoothingType; m_cornerRadius = aZone.m_cornerRadius; - - utility = aZone.utility; + SetLocalFlags( aZone.GetLocalFlags() ); } diff --git a/pcbnew/class_zone.h b/pcbnew/class_zone.h index 2ef1f34b9a..7b14356c49 100644 --- a/pcbnew/class_zone.h +++ b/pcbnew/class_zone.h @@ -242,8 +242,8 @@ public: int GetSelectedCorner() const { return m_CornerSelection; } void SetSelectedCorner( int aCorner ) { m_CornerSelection = aCorner; } - int GetFlags() const { return utility; } - void SetFlags( int aFlags ) { utility = aFlags; } + int GetLocalFlags() const { return m_localFlgs; } + void SetLocalFlags( int aFlags ) { m_localFlgs = aFlags; } std::vector & FillSegments() { return m_FillSegmList; } const std::vector & FillSegments() const { return m_FillSegmList; } @@ -617,7 +617,7 @@ private: /// The index of the corner being moved or -1 if no corner is selected. int m_CornerSelection; - int utility; ///< Flags used in polygon calculations. + int m_localFlgs; ///< Flags used in polygon calculations. /** Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used. diff --git a/pcbnew/export_vrml.cpp b/pcbnew/export_vrml.cpp index e07889c2ce..1aea2044cf 100755 --- a/pcbnew/export_vrml.cpp +++ b/pcbnew/export_vrml.cpp @@ -818,15 +818,13 @@ static void export_vrml_zones( BOARD* pcb ) { CPolyPt* endcorner = &zone->m_FilledPolysList[ic]; - if( begincorner->utility == 0 ) // Draw only basic outlines, not extra segments - export_vrml_line( layer, begincorner->x, begincorner->y, - endcorner->x, endcorner->y, width, 1 ); + export_vrml_line( layer, begincorner->x, begincorner->y, + endcorner->x, endcorner->y, width, 1 ); if( (endcorner->end_contour) || (ic == imax) ) // the last corner of a filled area is found: draw it { - if( endcorner->utility == 0 ) // Draw only basic outlines, not extra segments - export_vrml_line( layer, endcorner->x, endcorner->y, - firstcorner->x, firstcorner->y, width, 1 ); + export_vrml_line( layer, endcorner->x, endcorner->y, + firstcorner->x, firstcorner->y, width, 1 ); ic++; // A new contour? diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index b3a26ad4bc..515f31e411 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -2348,9 +2348,9 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() BIU y = biuParse( data, &data ); bool end_contour = intParse( data, &data ); // end_countour was a bool when file saved, so '0' or '1' here - int utility = intParse( data ); + int cornerUtilityFlg = intParse( data ); - polysList.push_back( CPolyPt( x, y, end_contour, utility ) ); + polysList.push_back( CPolyPt( x, y, end_contour, cornerUtilityFlg ) ); } zc->AddFilledPolysList( polysList ); } diff --git a/pcbnew/zones_test_and_combine_areas.cpp b/pcbnew/zones_test_and_combine_areas.cpp index ff9b736a3b..718661e8a2 100644 --- a/pcbnew/zones_test_and_combine_areas.cpp +++ b/pcbnew/zones_test_and_combine_areas.cpp @@ -86,7 +86,7 @@ bool BOARD::OnAreaPolygonModified( PICKED_ITEMS_LIST* aModifiedZonesList, bool BOARD::CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList, int aNetCode, - bool aUseUtility ) + bool aUseLocalFlags ) { if( m_ZoneDescriptorList.size() <= 1 ) return false; @@ -127,7 +127,8 @@ bool BOARD::CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList, int aNetCode, || b1.bottom > b2.top || b1.top < b2.bottom ) ) { // check area2 against curr_area - if( curr_area->GetFlags() || area2->GetFlags() || aUseUtility == false ) + if( curr_area->GetLocalFlags() || area2->GetLocalFlags() + || aUseLocalFlags == false ) { bool ret = TestAreaIntersection( curr_area, area2 ); @@ -350,7 +351,7 @@ bool BOARD::CombineAreas( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_ RemoveArea( aDeletedList, area_to_combine ); - area_ref->SetFlags( 1 ); + area_ref->SetLocalFlags( 1 ); area_ref->Outline()->Hatch(); return true; From f824c83842c641f972a1e506122b1f4f8f6ed689 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 26 Mar 2013 18:05:47 +0100 Subject: [PATCH 05/63] Pcbnew: fix an issue when texts in footprints have a size = 60 mils (default size for texts). After saving and reading the .kicad_pcb file, the size was not correct. --- pcbnew/class_text_mod.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index 419a779faf..bbcacd4f8b 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -61,8 +61,9 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) : m_Type = TEXT_is_DIVERS; m_NoShow = false; - m_Size.x = m_Size.y = 400; - m_Thickness = 120; /* Set default dimension to a reasonable value. */ + + // Set text tickness to a default value + m_Thickness = Millimeter2iu( 0.15 ); SetLayer( SILKSCREEN_N_FRONT ); From a6232e2c92d4a374896f33ef509d98f9929999c3 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Tue, 26 Mar 2013 13:25:18 -0400 Subject: [PATCH 06/63] Fix field text position access bug in Eeschema. (fixes lp:1160214) --- .../dialog_edit_component_in_schematic.cpp | 19 ++++++++-------- .../dialog_edit_libentry_fields_in_lib.cpp | 10 +++++---- eeschema/sch_component.cpp | 22 +++++++++---------- eeschema/sch_screen.cpp | 4 ++-- 4 files changed, 29 insertions(+), 26 deletions(-) diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp index 387ddb71a5..fddff29360 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp @@ -233,7 +233,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick( wxCommandEvent& event // change all field positions from relative to absolute for( unsigned i = 0; im_Pos ); + m_FieldsBuf[i].SetTextPosition( m_FieldsBuf[i].GetTextPosition() + m_Cmp->m_Pos ); } // Delete any fields with no name before we copy all of m_FieldsBuf back into the component. @@ -458,7 +458,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent m_FieldsBuf.push_back( aComponent->m_Fields[i] ); // make the editable field position relative to the component - m_FieldsBuf[i].SetPosition( m_FieldsBuf[i].GetPosition() - m_Cmp->m_Pos ); + m_FieldsBuf[i].SetTextPosition( m_FieldsBuf[i].GetTextPosition() - m_Cmp->m_Pos ); } // Add template fieldnames: @@ -491,7 +491,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent fld = *schField; // make the editable field position relative to the component - fld.SetPosition( fld.GetPosition() - m_Cmp->m_Pos ); + fld.SetTextPosition( fld.GetTextPosition() - m_Cmp->m_Pos ); } m_FieldsBuf.push_back( fld ); @@ -510,7 +510,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent m_FieldsBuf.push_back( *cmp ); // make the editable field position relative to the component - m_FieldsBuf[newNdx].SetPosition( m_FieldsBuf[newNdx].GetPosition() - m_Cmp->m_Pos ); + m_FieldsBuf[newNdx].SetTextPosition( m_FieldsBuf[newNdx].GetTextPosition() - + m_Cmp->m_Pos ); } } @@ -644,7 +645,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel() textSizeTextCtrl->SetValue( EDA_GRAPHIC_TEXT_CTRL::FormatSize( g_UserUnit, field.GetSize().x ) ); - wxPoint coord = field.GetPosition(); + wxPoint coord = field.GetTextPosition(); wxPoint zero = -m_Cmp->m_Pos; // relative zero // If the field value is empty and the position is at relative zero, we @@ -655,10 +656,10 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel() { rotateCheckBox->SetValue( m_FieldsBuf[REFERENCE].GetOrientation() == TEXT_ORIENT_VERT ); - coord.x = m_FieldsBuf[REFERENCE].GetPosition().x + coord.x = m_FieldsBuf[REFERENCE].GetTextPosition().x + ( fieldNdx - MANDATORY_FIELDS + 1 ) * 100; - coord.y = m_FieldsBuf[REFERENCE].GetPosition().y + coord.y = m_FieldsBuf[REFERENCE].GetTextPosition().y + ( fieldNdx - MANDATORY_FIELDS + 1 ) * 100; // coord can compute negative if field is < MANDATORY_FIELDS, e.g. FOOTPRINT. @@ -844,11 +845,11 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event ) // Perhaps the FOOTPRINT field should also be considered, // but for most of components it is not set in library LIB_FIELD& refField = entry->GetReferenceField(); - m_Cmp->GetField( REFERENCE )->SetPosition( refField.GetPosition() + m_Cmp->m_Pos ); + m_Cmp->GetField( REFERENCE )->SetTextPosition( refField.GetTextPosition() + m_Cmp->m_Pos ); m_Cmp->GetField( REFERENCE )->ImportValues( refField ); LIB_FIELD& valField = entry->GetValueField(); - m_Cmp->GetField( VALUE )->SetPosition( valField.GetPosition() + m_Cmp->m_Pos ); + m_Cmp->GetField( VALUE )->SetTextPosition( valField.GetTextPosition() + m_Cmp->m_Pos ); m_Cmp->GetField( VALUE )->ImportValues( valField ); m_Cmp->SetOrientation( CMP_NORMAL ); diff --git a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp index eb4f23cdf4..8aa9b493ba 100644 --- a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp +++ b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp @@ -661,7 +661,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel() textSizeTextCtrl->SetValue( EDA_GRAPHIC_TEXT_CTRL::FormatSize( g_UserUnit, field.GetSize().x ) ); - wxPoint coord = field.GetPosition(); + wxPoint coord = field.GetTextPosition(); wxPoint zero; // If the field value is empty and the position is at relative zero, we set the @@ -672,8 +672,10 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel() { rotateCheckBox->SetValue( m_FieldsBuf[REFERENCE].GetOrientation() == TEXT_ORIENT_VERT ); - coord.x = m_FieldsBuf[REFERENCE].GetPosition().x + (fieldNdx - MANDATORY_FIELDS + 1) * 100; - coord.y = m_FieldsBuf[REFERENCE].GetPosition().y + (fieldNdx - MANDATORY_FIELDS + 1) * 100; + coord.x = m_FieldsBuf[REFERENCE].GetTextPosition().x + + (fieldNdx - MANDATORY_FIELDS + 1) * 100; + coord.y = m_FieldsBuf[REFERENCE].GetTextPosition().y + + (fieldNdx - MANDATORY_FIELDS + 1) * 100; // coord can compute negative if field is < MANDATORY_FIELDS, e.g. FOOTPRINT. // That is ok, we basically don't want all the new empty fields on @@ -761,7 +763,7 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField() // and the screen axis is top to bottom: we must change the y coord sign for editing NEGATE( pos.y ); - field.SetPosition( pos ); + field.SetTextPosition( pos ); return true; } diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index 56cd7fe1cf..2cfe36af41 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -157,7 +157,7 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_COMPONENT& libComponent, SCH_SHEET_PATH* sheet schField = AddField( fld ); } - schField->SetPosition( m_Pos + it->GetPosition() ); + schField->SetTextPosition( m_Pos + it->GetTextPosition() ); schField->ImportValues( *it ); @@ -490,11 +490,11 @@ void SCH_COMPONENT::SetRef( const SCH_SHEET_PATH* sheet, const wxString& ref ) SCH_FIELD* rf = GetField( REFERENCE ); if( rf->GetText().IsEmpty() - || ( abs( rf->GetPosition().x - m_Pos.x ) + - abs( rf->GetPosition().y - m_Pos.y ) > 10000 ) ) + || ( abs( rf->GetTextPosition().x - m_Pos.x ) + + abs( rf->GetTextPosition().y - m_Pos.y ) > 10000 ) ) { // move it to a reasonable position - rf->SetPosition( m_Pos + wxPoint( 50, 50 ) ); + rf->SetTextPosition( m_Pos + wxPoint( 50, 50 ) ); } rf->SetText( ref ); // for drawing. @@ -1206,7 +1206,7 @@ bool SCH_COMPONENT::Load( LINE_READER& aLine, wxString& aErrorMsg ) for( int i = 0; iGetText().IsEmpty() ) - GetField( i )->SetPosition( m_Pos ); + GetField( i )->SetTextPosition( m_Pos ); } } else if( line[0] == 'A' && line[1] == 'R' ) @@ -1511,9 +1511,9 @@ void SCH_COMPONENT::MirrorY( int aYaxis_position ) for( int ii = 0; ii < GetFieldCount(); ii++ ) { // Move the fields to the new position because the component itself has moved. - wxPoint pos = GetField( ii )->GetPosition(); + wxPoint pos = GetField( ii )->GetTextPosition(); pos.x -= dx; - GetField( ii )->SetPosition( pos ); + GetField( ii )->SetTextPosition( pos ); } } @@ -1531,9 +1531,9 @@ void SCH_COMPONENT::MirrorX( int aXaxis_position ) for( int ii = 0; ii < GetFieldCount(); ii++ ) { // Move the fields to the new position because the component itself has moved. - wxPoint pos = GetField( ii )->GetPosition(); + wxPoint pos = GetField( ii )->GetTextPosition(); pos.y -= dy; - GetField( ii )->SetPosition( pos ); + GetField( ii )->SetTextPosition( pos ); } } @@ -1550,10 +1550,10 @@ void SCH_COMPONENT::Rotate( wxPoint aPosition ) for( int ii = 0; ii < GetFieldCount(); ii++ ) { // Move the fields to the new position because the component itself has moved. - wxPoint pos = GetField( ii )->GetPosition(); + wxPoint pos = GetField( ii )->GetTextPosition(); pos.x -= prev.x - m_Pos.x; pos.y -= prev.y - m_Pos.y; - GetField( ii )->SetPosition( pos ); + GetField( ii )->SetTextPosition( pos ); } } diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index d38a4f833f..fae91ce1bb 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -1084,10 +1084,10 @@ bool SCH_SCREEN::SetComponentFootprint( SCH_SHEET_PATH* aSheetPath, const wxStri */ SCH_FIELD * fpfield = component->GetField( FOOTPRINT ); if( fpfield->GetText().IsEmpty() - && ( fpfield->GetPosition() == component->GetPosition() ) ) + && ( fpfield->GetTextPosition() == component->GetPosition() ) ) { fpfield->SetOrientation( component->GetField( VALUE )->GetOrientation() ); - fpfield->SetPosition( component->GetField( VALUE )->GetPosition() ); + fpfield->SetTextPosition( component->GetField( VALUE )->GetTextPosition() ); fpfield->SetSize( component->GetField( VALUE )->GetSize() ); if( fpfield->GetOrientation() == 0 ) From cc46ee0ec9117cb5669c4f12339f998aed13c4db Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 26 Mar 2013 19:15:30 +0100 Subject: [PATCH 07/63] Pcbnew: Fix Bug #1160396 --- pcbnew/pcb_parser.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pcbnew/pcb_parser.h b/pcbnew/pcb_parser.h index a9659c176c..4b70774565 100644 --- a/pcbnew/pcb_parser.h +++ b/pcbnew/pcb_parser.h @@ -176,9 +176,10 @@ class PCB_PARSER : public PCB_LEXER inline int parseBoardUnits() throw( IO_ERROR ) { - // There should be no rounding issues here, since the values in the file are in mm - // and get converted to nano-meters. This product should be an integer, exactly. - return int( parseDouble() * IU_PER_MM ); + // There should be no major rounding issues here, + // since the values in the file are in mm + // and get converted to nano-meters. + return KiROUND( parseDouble() * IU_PER_MM ); } inline int parseBoardUnits( const char* aExpected ) throw( PARSE_ERROR ) From ccd0ab78f34bf36ffc5d2c4a4425b71ecbc1a627 Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Tue, 26 Mar 2013 21:02:23 +0100 Subject: [PATCH 08/63] Removed unused define TEXT_VTAB_HEIGHT --- include/worksheet.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/worksheet.h b/include/worksheet.h index 0324969c7c..3f417528b8 100644 --- a/include/worksheet.h +++ b/include/worksheet.h @@ -13,7 +13,6 @@ #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) From 50682ef2dc4c5d0f8ef28ae5ea6f12c038c3682f Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Wed, 27 Mar 2013 08:33:24 -0500 Subject: [PATCH 09/63] remove interrim fix, no longer needed --- pcbnew/pcb_parser.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index 41c058383b..56a89a6989 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -2153,15 +2153,6 @@ D_PAD* PCB_PARSER::parseD_PAD() throw( IO_ERROR, PARSE_ERROR ) case T_layers: { int layerMask = parseBoardItemLayersAsMask(); - - // 15-Nov-2012 before today, only the cu layers that were used were - // saved. After wildcard *.Cu support went into effect, this is no - // longer an issue, but in order to load the interrim s-expression files, - // turn on all Cu layers for thru hole pads. New files will not need this - // and eventually this code can be removed. - if( pad->GetAttribute() == PAD_STANDARD ) - layerMask |= ALL_CU_LAYERS; - pad->SetLayerMask( layerMask ); } break; From 0cbe14c12e4b897a342c298763048267a819723c Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Wed, 27 Mar 2013 09:01:50 -0500 Subject: [PATCH 10/63] reference a test program in a comment --- pcbnew/pcb_parser.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pcbnew/pcb_parser.h b/pcbnew/pcb_parser.h index 4b70774565..78071fdfac 100644 --- a/pcbnew/pcb_parser.h +++ b/pcbnew/pcb_parser.h @@ -155,8 +155,8 @@ class PCB_PARSER : public PCB_LEXER /** * Function parseDouble - * parses the current token as an ASCII numeric string with possible leading whitespace into - * a double precision floating point number. + * parses the current token as an ASCII numeric string with possible leading + * whitespace into a double precision floating point number. * * @throw IO_ERROR if an error occurs attempting to convert the current token. * @return The result of the parsed token. @@ -176,9 +176,12 @@ class PCB_PARSER : public PCB_LEXER inline int parseBoardUnits() throw( IO_ERROR ) { - // There should be no major rounding issues here, - // since the values in the file are in mm - // and get converted to nano-meters. + // There should be no major rounding issues here, since the values in + // the file are in mm and get converted to nano-meters. + // See test program tools/test-nm-biu-to-ascii-mm-round-tripping.cpp + // to confirm or experiment. Use a similar strategy in both places, here + // and in the test program. Make that program with: + // $ make test-nm-biu-to-ascii-mm-round-tripping return KiROUND( parseDouble() * IU_PER_MM ); } From aae87178a78c3225ac7c57bbaffdd478ea024efa Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Wed, 27 Mar 2013 19:32:12 +0100 Subject: [PATCH 11/63] Renamed global variables: Drc_On => g_Drc_On Route_Layer_TOP => g_Route_Layer_TOP Route_Layer_BOTTOM => g_Route_Layer_BOTTOM Track_45_Only_Allowed => g_Track_45_Only_Allowed --- pcbnew/autorouter/autoplac.cpp | 18 ++++++------- pcbnew/autorouter/autorout.cpp | 8 +++--- pcbnew/autorouter/graphpcb.cpp | 24 ++++++++--------- pcbnew/autorouter/solve.cpp | 16 ++++++------ pcbnew/controle.cpp | 2 +- pcbnew/dialogs/dialog_general_options.cpp | 13 +++++---- pcbnew/edit.cpp | 2 +- pcbnew/edit_track_width.cpp | 4 +-- pcbnew/editedge.cpp | 2 +- pcbnew/editrack-part2.cpp | 4 +-- pcbnew/editrack.cpp | 32 +++++++++++------------ pcbnew/magnetic_tracks_functions.cpp | 2 +- pcbnew/move_or_drag_track.cpp | 24 ++++++++--------- pcbnew/pcbnew.cpp | 8 +++--- pcbnew/pcbnew.h | 8 +++--- pcbnew/pcbnew_config.cpp | 2 +- pcbnew/toolbars_update_user_interface.cpp | 4 +-- pcbnew/zones_by_polygon.cpp | 8 +++--- 18 files changed, 90 insertions(+), 91 deletions(-) diff --git a/pcbnew/autorouter/autoplac.cpp b/pcbnew/autorouter/autoplac.cpp index 7ebb1dc80c..431e25bf8a 100644 --- a/pcbnew/autorouter/autoplac.cpp +++ b/pcbnew/autorouter/autoplac.cpp @@ -140,8 +140,8 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC ) } memopos = CurrPosition; - lay_tmp_BOTTOM = Route_Layer_BOTTOM; - lay_tmp_TOP = Route_Layer_TOP; + lay_tmp_BOTTOM = g_Route_Layer_BOTTOM; + lay_tmp_TOP = g_Route_Layer_TOP; RoutingMatrix.m_GridRouting = (int) GetScreen()->GetGridSize().x; @@ -353,8 +353,8 @@ end_of_tst: RoutingMatrix.UnInitRoutingMatrix(); - Route_Layer_TOP = lay_tmp_TOP; - Route_Layer_BOTTOM = lay_tmp_BOTTOM; + g_Route_Layer_TOP = lay_tmp_TOP; + g_Route_Layer_BOTTOM = lay_tmp_BOTTOM; Module = GetBoard()->m_Modules; @@ -447,12 +447,12 @@ int PCB_EDIT_FRAME::GenPlaceBoard() msg.Printf( wxT( "%d" ), RoutingMatrix.m_MemSize / 1024 ); m_messagePanel->SetMessage( 24, wxT( "Mem(Kb)" ), msg, CYAN ); - Route_Layer_BOTTOM = LAYER_N_FRONT; + g_Route_Layer_BOTTOM = LAYER_N_FRONT; if( RoutingMatrix.m_RoutingLayersCount > 1 ) - Route_Layer_BOTTOM = LAYER_N_BACK; + g_Route_Layer_BOTTOM = LAYER_N_BACK; - Route_Layer_TOP = LAYER_N_FRONT; + g_Route_Layer_TOP = LAYER_N_FRONT; /* Place the edge layer segments */ TRACK TmpSegm( NULL ); @@ -969,10 +969,10 @@ void CreateKeepOutRectangle( int ux0, int uy0, int ux1, int uy1, DIST_CELL data, LocalKeepOut; int lgain, cgain; - if( aLayerMask & GetLayerMask( Route_Layer_BOTTOM ) ) + if( aLayerMask & GetLayerMask( g_Route_Layer_BOTTOM ) ) trace = 1; /* Trace on bottom layer. */ - if( ( aLayerMask & GetLayerMask( Route_Layer_TOP ) ) && RoutingMatrix.m_RoutingLayersCount ) + if( ( aLayerMask & GetLayerMask( g_Route_Layer_TOP ) ) && RoutingMatrix.m_RoutingLayersCount ) trace |= 2; /* Trace on top layer. */ if( trace == 0 ) diff --git a/pcbnew/autorouter/autorout.cpp b/pcbnew/autorouter/autorout.cpp index 4a1fe56d2e..b0dc59b0b7 100644 --- a/pcbnew/autorouter/autorout.cpp +++ b/pcbnew/autorouter/autorout.cpp @@ -61,12 +61,12 @@ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode ) if( GetBoard()->GetCopperLayerCount() > 1 ) { - Route_Layer_TOP = GetScreen()->m_Route_Layer_TOP; - Route_Layer_BOTTOM = GetScreen()->m_Route_Layer_BOTTOM; + g_Route_Layer_TOP = GetScreen()->m_Route_Layer_TOP; + g_Route_Layer_BOTTOM = GetScreen()->m_Route_Layer_BOTTOM; } else { - Route_Layer_TOP = Route_Layer_BOTTOM = LAYER_N_BACK; + g_Route_Layer_TOP = g_Route_Layer_BOTTOM = LAYER_N_BACK; } switch( mode ) @@ -172,7 +172,7 @@ void PCB_EDIT_FRAME::Autoroute( wxDC* DC, int mode ) /* Map the board */ RoutingMatrix.m_RoutingLayersCount = 1; - if( Route_Layer_TOP != Route_Layer_BOTTOM ) + if( g_Route_Layer_TOP != g_Route_Layer_BOTTOM ) RoutingMatrix.m_RoutingLayersCount = 2; if( RoutingMatrix.InitRoutingMatrix() < 0 ) diff --git a/pcbnew/autorouter/graphpcb.cpp b/pcbnew/autorouter/graphpcb.cpp index 06a7311c06..fab7ca6b2e 100644 --- a/pcbnew/autorouter/graphpcb.cpp +++ b/pcbnew/autorouter/graphpcb.cpp @@ -76,10 +76,10 @@ static void TraceCircle( int ux0, int uy0, int ux1, int uy1, int lg, int layer, } \ else \ { \ - if( layer == Route_Layer_BOTTOM ) \ + if( layer == g_Route_Layer_BOTTOM ) \ RoutingMatrix.WriteCell( dy, dx, BOTTOM, color ); \ if( RoutingMatrix.m_RoutingLayersCount > 1 ) \ - if( layer == Route_Layer_TOP ) \ + if( layer == g_Route_Layer_TOP ) \ RoutingMatrix.WriteCell( dy, dx, TOP, color ); \ } \ } @@ -152,10 +152,10 @@ void TraceFilledCircle( int cx, int cy, int radius, int tstwrite = 0; int distmin; - if( aLayerMask & GetLayerMask( Route_Layer_BOTTOM ) ) + if( aLayerMask & GetLayerMask( g_Route_Layer_BOTTOM ) ) trace = 1; // Trace on BOTTOM - if( aLayerMask & GetLayerMask( Route_Layer_TOP ) ) + if( aLayerMask & GetLayerMask( g_Route_Layer_TOP ) ) if( RoutingMatrix.m_RoutingLayersCount > 1 ) trace |= 2; // Trace on TOP @@ -275,13 +275,13 @@ void TraceSegmentPcb( TRACK* pt_segm, int color, int marge, int op_logic ) { int mask_layer = 0; - if( pt_segm->IsOnLayer( Route_Layer_BOTTOM ) ) - mask_layer = 1 << Route_Layer_BOTTOM; + if( pt_segm->IsOnLayer( g_Route_Layer_BOTTOM ) ) + mask_layer = 1 << g_Route_Layer_BOTTOM; - if( pt_segm->IsOnLayer( Route_Layer_TOP ) ) + if( pt_segm->IsOnLayer( g_Route_Layer_TOP ) ) { if( mask_layer == 0 ) - mask_layer = 1 << Route_Layer_TOP; + mask_layer = 1 << g_Route_Layer_TOP; else mask_layer = -1; } @@ -474,10 +474,10 @@ void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1, int row_min, row_max, col_min, col_max; int trace = 0; - if( ( aLayerMask & GetLayerMask( Route_Layer_BOTTOM ) ) ) + if( ( aLayerMask & GetLayerMask( g_Route_Layer_BOTTOM ) ) ) trace = 1; // Trace on BOTTOM - if( ( aLayerMask & GetLayerMask( Route_Layer_TOP ) ) && + if( ( aLayerMask & GetLayerMask( g_Route_Layer_TOP ) ) && RoutingMatrix.m_RoutingLayersCount > 1 ) trace |= 2; // Trace on TOP @@ -540,10 +540,10 @@ void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1, int rotrow, rotcol; int trace = 0; - if( aLayerMask & GetLayerMask( Route_Layer_BOTTOM ) ) + if( aLayerMask & GetLayerMask( g_Route_Layer_BOTTOM ) ) trace = 1; // Trace on BOTTOM - if( aLayerMask & GetLayerMask( Route_Layer_TOP ) ) + if( aLayerMask & GetLayerMask( g_Route_Layer_TOP ) ) { if( RoutingMatrix.m_RoutingLayersCount > 1 ) trace |= 2; // Trace on TOP diff --git a/pcbnew/autorouter/solve.cpp b/pcbnew/autorouter/solve.cpp index 2455ef10ed..768825a765 100644 --- a/pcbnew/autorouter/solve.cpp +++ b/pcbnew/autorouter/solve.cpp @@ -416,8 +416,8 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe, int marge; int padLayerMaskStart; /* Mask layers belonging to the starting pad. */ int padLayerMaskEnd; /* Mask layers belonging to the ending pad. */ - int topLayerMask = GetLayerMask( Route_Layer_TOP ); - int bottomLayerMask = GetLayerMask( Route_Layer_BOTTOM ); + int topLayerMask = GetLayerMask( g_Route_Layer_TOP ); + int bottomLayerMask = GetLayerMask( g_Route_Layer_BOTTOM ); int routeLayerMask; /* Mask two layers for routing. */ int tab_mask[2]; /* Enables the calculation of the mask layer being * tested. (side = TOP or BOTTOM) */ @@ -1169,7 +1169,7 @@ static void OrCell_Trace( BOARD* pcb, int col, int row, g_CurrentTrackList.PushBack( newTrack ); - g_CurrentTrackSegment->SetState( TRACK_AR, ON ); + g_CurrentTrackSegment->SetState( TRACK_AR, true ); g_CurrentTrackSegment->SetLayer( 0x0F ); g_CurrentTrackSegment->SetStart(wxPoint( pcb->GetBoundingBox().GetX() + @@ -1189,12 +1189,12 @@ static void OrCell_Trace( BOARD* pcb, int col, int row, g_CurrentTrackList.PushBack( newTrack ); - g_CurrentTrackSegment->SetLayer( Route_Layer_BOTTOM ); + g_CurrentTrackSegment->SetLayer( g_Route_Layer_BOTTOM ); if( side == TOP ) - g_CurrentTrackSegment->SetLayer( Route_Layer_TOP ); + g_CurrentTrackSegment->SetLayer( g_Route_Layer_TOP ); - g_CurrentTrackSegment->SetState( TRACK_AR, ON ); + g_CurrentTrackSegment->SetState( TRACK_AR, true ); g_CurrentTrackSegment->SetEnd( wxPoint( pcb->GetBoundingBox().GetX() + ( RoutingMatrix.m_GridRouting * row ), pcb->GetBoundingBox().GetY() + @@ -1305,12 +1305,12 @@ static void AddNewTrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC ) g_FirstTrackSegment->start = pcbframe->GetBoard()->GetPad( g_FirstTrackSegment, FLG_START ); if( g_FirstTrackSegment->start ) - g_FirstTrackSegment->SetState( BEGIN_ONPAD, ON ); + g_FirstTrackSegment->SetState( BEGIN_ONPAD, true ); g_CurrentTrackSegment->end = pcbframe->GetBoard()->GetPad( g_CurrentTrackSegment, FLG_END ); if( g_CurrentTrackSegment->end ) - g_CurrentTrackSegment->SetState( END_ONPAD, ON ); + g_CurrentTrackSegment->SetState( END_ONPAD, true ); /* Out the new track on the matrix board */ for( TRACK* track = g_FirstTrackSegment; track; track = track->Next() ) diff --git a/pcbnew/controle.cpp b/pcbnew/controle.cpp index 232cb9d8d5..accad0fd10 100644 --- a/pcbnew/controle.cpp +++ b/pcbnew/controle.cpp @@ -332,7 +332,7 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH { // If there's no intrusion and DRC is active, we pass the cursor // "as is", and let ShowNewTrackWhenMovingCursor figure out what to do. - if( !Drc_On || !g_CurrentTrackSegment || + if( !g_Drc_On || !g_CurrentTrackSegment || (BOARD_ITEM*)g_CurrentTrackSegment != this->GetCurItem() || !LocateIntrusion( m_Pcb->m_Track, g_CurrentTrackSegment, GetScreen()->m_Active_Layer, GetScreen()->RefPos( true ) ) ) diff --git a/pcbnew/dialogs/dialog_general_options.cpp b/pcbnew/dialogs/dialog_general_options.cpp index 329c9fae3d..874389513c 100644 --- a/pcbnew/dialogs/dialog_general_options.cpp +++ b/pcbnew/dialogs/dialog_general_options.cpp @@ -82,18 +82,17 @@ void DIALOG_GENERALOPTIONS::init() m_SaveTime->SetValue( timevalue ); m_MaxShowLinks->SetValue( g_MaxLinksShowed ); - m_DrcOn->SetValue( Drc_On ); + m_DrcOn->SetValue( g_Drc_On ); m_ShowModuleRatsnest->SetValue( g_Show_Module_Ratsnest ); m_ShowGlobalRatsnest->SetValue( m_Board->IsElementVisible( RATSNEST_VISIBLE ) ); m_TrackAutodel->SetValue( g_AutoDeleteOldTrack ); m_Track_45_Only_Ctrl->SetValue( g_Track_45_Only_Allowed ); - m_Segments_45_Only_Ctrl->SetValue( Segments_45_Only ); + m_Segments_45_Only_Ctrl->SetValue( g_Segments_45_Only ); m_ZoomNoCenterOpt->SetValue( GetParent()->GetCanvas()->GetEnableZoomNoCenter() ); m_MiddleButtonPANOpt->SetValue( GetParent()->GetCanvas()->GetEnableMiddleButtonPan() ); m_OptMiddleButtonPanLimited->SetValue( GetParent()->GetCanvas()->GetMiddleButtonPanLimited() ); m_OptMiddleButtonPanLimited->Enable( m_MiddleButtonPANOpt->GetValue() ); m_AutoPANOpt->SetValue( GetParent()->GetCanvas()->GetEnableAutoPan() ); - m_Segments_45_Only_Ctrl->SetValue( Segments_45_Only ); m_Track_DoubleSegm_Ctrl->SetValue( g_TwoSegmentTrackBuild ); m_MagneticPadOptCtrl->SetSelection( g_MagneticPadOption ); @@ -125,7 +124,7 @@ void DIALOG_GENERALOPTIONS::OnOkClick( wxCommandEvent& event ) /* Updating the combobox to display the active layer. */ g_MaxLinksShowed = m_MaxShowLinks->GetValue(); - Drc_On = m_DrcOn->GetValue(); + g_Drc_On = m_DrcOn->GetValue(); if( m_Board->IsElementVisible(RATSNEST_VISIBLE) != m_ShowGlobalRatsnest->GetValue() ) { @@ -135,7 +134,7 @@ void DIALOG_GENERALOPTIONS::OnOkClick( wxCommandEvent& event ) g_Show_Module_Ratsnest = m_ShowModuleRatsnest->GetValue(); g_AutoDeleteOldTrack = m_TrackAutodel->GetValue(); - Segments_45_Only = m_Segments_45_Only_Ctrl->GetValue(); + g_Segments_45_Only = m_Segments_45_Only_Ctrl->GetValue(); g_Track_45_Only_Allowed = m_Track_45_Only_Ctrl->GetValue(); GetParent()->GetCanvas()->SetEnableZoomNoCenter( m_ZoomNoCenterOpt->GetValue() ); @@ -162,11 +161,11 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) switch( id ) { case ID_TB_OPTIONS_DRC_OFF: - Drc_On = !state; + g_Drc_On = !state; if( GetToolId() == ID_TRACK_BUTT ) { - if( Drc_On ) + if( g_Drc_On ) m_canvas->SetCursor( wxCURSOR_PENCIL ); else m_canvas->SetCursor( wxCURSOR_QUESTION_ARROW ); diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 74fad5c15a..13d0908dc5 100755 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -1329,7 +1329,7 @@ void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent ) break; case ID_TRACK_BUTT: - if( Drc_On ) + if( g_Drc_On ) SetToolID( id, wxCURSOR_PENCIL, _( "Add tracks" ) ); else SetToolID( id, wxCURSOR_QUESTION_ARROW, _( "Add tracks" ) ); diff --git a/pcbnew/edit_track_width.cpp b/pcbnew/edit_track_width.cpp index 99dcd94ea8..869afdaede 100644 --- a/pcbnew/edit_track_width.cpp +++ b/pcbnew/edit_track_width.cpp @@ -76,7 +76,7 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem, { int diagdrc = OK_DRC; - if( Drc_On ) + if( g_Drc_On ) diagdrc = m_drc->Drc( aTrackItem, GetBoard()->m_Track ); if( diagdrc == OK_DRC ) @@ -175,7 +175,7 @@ void PCB_EDIT_FRAME::Edit_Track_Width( wxDC* aDC, TRACK* aTrackSegment ) for( int ii = 0; ii < nb_segm; ii++, pt_track = pt_track->Next() ) { - pt_track->SetState( BUSY, OFF ); + pt_track->SetState( BUSY, false ); if( SetTrackSegmentWidth( pt_track, &itemsListPicker, false ) ) change = true; diff --git a/pcbnew/editedge.cpp b/pcbnew/editedge.cpp index 274a248f81..685bf7a916 100644 --- a/pcbnew/editedge.cpp +++ b/pcbnew/editedge.cpp @@ -343,7 +343,7 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi if( aErase ) Segment->Draw( aPanel, aDC, GR_XOR ); - if( Segments_45_Only && Segment->GetShape() == S_SEGMENT ) + if( g_Segments_45_Only && Segment->GetShape() == S_SEGMENT ) { wxPoint pt; diff --git a/pcbnew/editrack-part2.cpp b/pcbnew/editrack-part2.cpp index 92b37902cd..6f89d66e60 100644 --- a/pcbnew/editrack-part2.cpp +++ b/pcbnew/editrack-part2.cpp @@ -73,7 +73,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) } // Is the current segment Ok (no DRC error) ? - if( Drc_On ) + if( g_Drc_On ) { if( BAD_DRC==m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) ) // DRC error, the change layer is not made @@ -150,7 +150,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) break; } - if( Drc_On && BAD_DRC == m_drc->Drc( via, GetBoard()->m_Track ) ) + if( g_Drc_On && BAD_DRC == m_drc->Drc( via, GetBoard()->m_Track ) ) { // DRC fault: the Via cannot be placed here ... delete via; diff --git a/pcbnew/editrack.cpp b/pcbnew/editrack.cpp index 7d0e9eda78..97888d433f 100644 --- a/pcbnew/editrack.cpp +++ b/pcbnew/editrack.cpp @@ -182,7 +182,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) { g_CurrentTrackSegment->m_PadsConnected.push_back( pad ); // Useful to display track length, if the pad has a die length: - g_CurrentTrackSegment->SetState( BEGIN_ONPAD, ON ); + g_CurrentTrackSegment->SetState( BEGIN_ONPAD, true ); g_CurrentTrackSegment->start = pad; } @@ -196,7 +196,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) g_CurrentTrackSegment->start = g_FirstTrackSegment; g_FirstTrackSegment->end = g_CurrentTrackSegment; - g_FirstTrackSegment->SetState( BEGIN_ONPAD | END_ONPAD, OFF ); + g_FirstTrackSegment->SetState( BEGIN_ONPAD | END_ONPAD, false ); } D( g_CurrentTrackList.VerifyListIntegrity(); ); @@ -205,7 +205,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) SetCurItem( g_CurrentTrackSegment, false ); m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false ); - if( Drc_On ) + if( g_Drc_On ) { if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) ) { @@ -216,7 +216,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) else // Track in progress : segment coordinates are updated by ShowNewTrackWhenMovingCursor. { // Test for a D.R.C. error: - if( Drc_On ) + if( g_Drc_On ) { if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) ) return NULL; @@ -261,7 +261,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) g_CurrentTrackList.PushBack( newTrack ); newTrack->SetFlags( IS_NEW ); - newTrack->SetState( BEGIN_ONPAD | END_ONPAD, OFF ); + newTrack->SetState( BEGIN_ONPAD | END_ONPAD, false ); D_PAD* pad = GetBoard()->GetPad( previousTrack, FLG_END ); @@ -357,7 +357,7 @@ bool PCB_EDIT_FRAME::Add45DegreeSegment( wxDC* aDC ) else newTrack->SetEnd( wxPoint(newTrack->GetEnd().x - segm_step_45, newTrack->GetEnd().y) ); - if( Drc_On && BAD_DRC == m_drc->Drc( curTrack, GetBoard()->m_Track ) ) + if( g_Drc_On && BAD_DRC == m_drc->Drc( curTrack, GetBoard()->m_Track ) ) { delete newTrack; return false; @@ -392,7 +392,7 @@ bool PCB_EDIT_FRAME::Add45DegreeSegment( wxDC* aDC ) else newTrack->SetEnd( wxPoint(newTrack->GetEnd().x, newTrack->GetEnd().y - segm_step_45) ); - if( Drc_On && BAD_DRC==m_drc->Drc( newTrack, GetBoard()->m_Track ) ) + if( g_Drc_On && BAD_DRC==m_drc->Drc( newTrack, GetBoard()->m_Track ) ) { delete newTrack; return false; @@ -416,7 +416,7 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* aDC ) if( aTrack == NULL ) return false; - if( Drc_On && BAD_DRC == m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) ) + if( g_Drc_On && BAD_DRC == m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) ) return false; // Saving the coordinate of end point of the trace @@ -495,7 +495,7 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* aDC ) for( track = firstTrack; track && i < newCount; ++i, track = track->Next() ) { track->ClearFlags(); - track->SetState( BUSY, OFF ); + track->SetState( BUSY, false ); } // delete the old track, if it exists and is redundant @@ -737,7 +737,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo { g_CurrentTrackSegment->SetEnd( screen->GetCrossHairPosition() ); - if( Drc_On ) + if( g_Drc_On ) PushTrack( aPanel ); ComputeBreakPoint( g_CurrentTrackSegment, @@ -1047,7 +1047,7 @@ void DeleteNullTrackSegments( BOARD* pcb, DLIST& aTrackList ) firsttrack->start = LockPoint; if( LockPoint && LockPoint->Type()==PCB_PAD_T ) - firsttrack->SetState( BEGIN_ONPAD, ON ); + firsttrack->SetState( BEGIN_ONPAD, true ); track = firsttrack; @@ -1059,12 +1059,12 @@ void DeleteNullTrackSegments( BOARD* pcb, DLIST& aTrackList ) if( LockPoint ) { track->end = LockPoint; - track->SetState( END_ONPAD, ON ); + track->SetState( END_ONPAD, true ); if( next_track ) { next_track->start = LockPoint; - next_track->SetState( BEGIN_ONPAD, ON ); + next_track->SetState( BEGIN_ONPAD, true ); } } @@ -1082,7 +1082,7 @@ void EnsureEndTrackOnPad( D_PAD* aPad ) if( g_CurrentTrackSegment->GetEnd() == aPad->GetPosition() ) // Ok ! { g_CurrentTrackSegment->end = aPad; - g_CurrentTrackSegment->SetState( END_ONPAD, ON ); + g_CurrentTrackSegment->SetState( END_ONPAD, true ); return; } @@ -1097,8 +1097,8 @@ void EnsureEndTrackOnPad( D_PAD* aPad ) } g_CurrentTrackSegment->SetEnd( aPad->GetPosition() ); - g_CurrentTrackSegment->SetState( END_ONPAD, OFF ); + g_CurrentTrackSegment->SetState( END_ONPAD, false ); g_CurrentTrackSegment->end = aPad; - g_CurrentTrackSegment->SetState( END_ONPAD, ON ); + g_CurrentTrackSegment->SetState( END_ONPAD, true ); } diff --git a/pcbnew/magnetic_tracks_functions.cpp b/pcbnew/magnetic_tracks_functions.cpp index 88dc20b69e..f365647597 100644 --- a/pcbnew/magnetic_tracks_functions.cpp +++ b/pcbnew/magnetic_tracks_functions.cpp @@ -107,7 +107,7 @@ bool Project( wxPoint* aNearPos, wxPoint on_grid, const TRACK* track ) bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize, wxPoint on_grid, wxPoint* curpos ) { - bool doCheckNet = g_MagneticPadOption != capture_always && Drc_On; + bool doCheckNet = g_MagneticPadOption != capture_always && g_Drc_On; bool doTrack = false; bool doPad = false; bool amMovingVia = false; diff --git a/pcbnew/move_or_drag_track.cpp b/pcbnew/move_or_drag_track.cpp index 2228e6ec40..2ceb75e937 100644 --- a/pcbnew/move_or_drag_track.cpp +++ b/pcbnew/move_or_drag_track.cpp @@ -90,7 +90,7 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* aPanel, wxDC* aDC ) { TRACK* track = g_DragSegmentList[jj].m_Track; g_DragSegmentList[jj].RestoreInitialValues(); - track->SetState( IN_EDIT, OFF ); + track->SetState( IN_EDIT, false ); track->ClearFlags(); } @@ -717,13 +717,13 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC // Test if more than one segment is connected to this point if( TrackToStartPoint ) { - TrackToStartPoint->SetState( BUSY, ON ); + TrackToStartPoint->SetState( BUSY, true ); if( ( TrackToStartPoint->Type() == PCB_VIA_T ) || track->GetTrace( GetBoard()->m_Track, NULL, FLG_START ) ) error = true; - TrackToStartPoint->SetState( BUSY, OFF ); + TrackToStartPoint->SetState( BUSY, false ); } if( ( track->end == NULL ) || ( track->end->Type() == PCB_TRACE_T ) ) @@ -732,13 +732,13 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC // Test if more than one segment is connected to this point if( TrackToEndPoint ) { - TrackToEndPoint->SetState( BUSY, ON ); + TrackToEndPoint->SetState( BUSY, true ); if( (TrackToEndPoint->Type() == PCB_VIA_T) || track->GetTrace( GetBoard()->m_Track, NULL, FLG_END ) ) error = true; - TrackToEndPoint->SetState( BUSY, OFF ); + TrackToEndPoint->SetState( BUSY, false ); } if( error ) @@ -834,7 +834,7 @@ bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC ) int current_net_code = Track->GetNet(); // DRC control: - if( Drc_On ) + if( g_Drc_On ) { errdrc = m_drc->Drc( Track, GetBoard()->m_Track ); @@ -853,13 +853,13 @@ bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC ) // DRC Ok: place track segments Track->ClearFlags(); - Track->SetState( IN_EDIT, OFF ); + Track->SetState( IN_EDIT, false ); /* Draw dragged tracks */ for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ ) { Track = g_DragSegmentList[ii].m_Track; - Track->SetState( IN_EDIT, OFF ); + Track->SetState( IN_EDIT, false ); Track->ClearFlags(); /* Test the connections modified by the move @@ -869,16 +869,16 @@ bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC ) Track->start = GetBoard()->GetPadFast( Track->GetStart(), layerMask ); if( Track->start ) - Track->SetState( BEGIN_ONPAD, ON ); + Track->SetState( BEGIN_ONPAD, true ); else - Track->SetState( BEGIN_ONPAD, OFF ); + Track->SetState( BEGIN_ONPAD, false ); Track->end = GetBoard()->GetPadFast( Track->GetEnd(), layerMask ); if( Track->end ) - Track->SetState( END_ONPAD, ON ); + Track->SetState( END_ONPAD, true ); else - Track->SetState( END_ONPAD, OFF ); + Track->SetState( END_ONPAD, false ); } EraseDragList(); diff --git a/pcbnew/pcbnew.cpp b/pcbnew/pcbnew.cpp index 4a2199b002..199ff3a537 100644 --- a/pcbnew/pcbnew.cpp +++ b/pcbnew/pcbnew.cpp @@ -56,17 +56,17 @@ // Colors for layers and items COLORS_DESIGN_SETTINGS g_ColorsSettings; -bool Drc_On = true; +bool g_Drc_On = true; bool g_AutoDeleteOldTrack = true; bool g_Show_Module_Ratsnest; bool g_Raccord_45_Auto = true; bool g_Alternate_Track_Posture = false; bool g_Track_45_Only_Allowed = true; // True to allow horiz, vert. and 45deg only tracks -bool Segments_45_Only; // True to allow horiz, vert. and 45deg only graphic segments +bool g_Segments_45_Only; // True to allow horiz, vert. and 45deg only graphic segments bool g_TwoSegmentTrackBuild = true; -int Route_Layer_TOP; -int Route_Layer_BOTTOM; +int g_Route_Layer_TOP; +int g_Route_Layer_BOTTOM; int g_MaxLinksShowed; int g_MagneticPadOption = capture_cursor_in_track_tool; int g_MagneticTrackOption = capture_cursor_in_track_tool; diff --git a/pcbnew/pcbnew.h b/pcbnew/pcbnew.h index 5695ff5566..0cbe3b0694 100644 --- a/pcbnew/pcbnew.h +++ b/pcbnew/pcbnew.h @@ -49,17 +49,17 @@ extern wxString g_DocModulesFileName; /* variables */ -extern bool Drc_On; +extern bool g_Drc_On; extern bool g_AutoDeleteOldTrack; extern bool g_Show_Module_Ratsnest; extern bool g_Raccord_45_Auto; extern bool g_Track_45_Only_Allowed; extern bool g_Alternate_Track_Posture; -extern bool Segments_45_Only; +extern bool g_Segments_45_Only; /* Layer pair for auto routing and switch layers by hotkey */ -extern int Route_Layer_TOP; -extern int Route_Layer_BOTTOM; +extern int g_Route_Layer_TOP; +extern int g_Route_Layer_BOTTOM; extern int g_MaxLinksShowed; // Max count links showed in routing extern bool g_TwoSegmentTrackBuild; diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index 781c0c8cfe..b6d1d76224 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -451,7 +451,7 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings() &g_Show_Module_Ratsnest, true ) ); m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "TwoSegT" ), &g_TwoSegmentTrackBuild, true ) ); - m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "SegmPcb45Only" ), &Segments_45_Only, + m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "SegmPcb45Only" ), &g_Segments_45_Only, true ) ); return m_configSettings; } diff --git a/pcbnew/toolbars_update_user_interface.cpp b/pcbnew/toolbars_update_user_interface.cpp index 6c82eeefcd..23d850d2b1 100644 --- a/pcbnew/toolbars_update_user_interface.cpp +++ b/pcbnew/toolbars_update_user_interface.cpp @@ -113,10 +113,10 @@ void PCB_EDIT_FRAME::OnUpdateZoneDisplayStyle( wxUpdateUIEvent& aEvent ) void PCB_EDIT_FRAME::OnUpdateDrcEnable( wxUpdateUIEvent& aEvent ) { - bool state = !Drc_On; + bool state = !g_Drc_On; aEvent.Check( state ); m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_DRC_OFF, - Drc_On ? + g_Drc_On ? _( "Disable design rule checking" ) : _( "Enable design rule checking" ) ); } diff --git a/pcbnew/zones_by_polygon.cpp b/pcbnew/zones_by_polygon.cpp index c931dc5d09..f8a5a6592f 100644 --- a/pcbnew/zones_by_polygon.cpp +++ b/pcbnew/zones_by_polygon.cpp @@ -657,7 +657,7 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) zone->AppendCorner( GetScreen()->GetCrossHairPosition() ); - if( Drc_On && (m_drc->Drc( zone, 0 ) == BAD_DRC) && zone->IsOnCopperLayer() ) + if( g_Drc_On && (m_drc->Drc( zone, 0 ) == BAD_DRC) && zone->IsOnCopperLayer() ) { zone->ClearFlags(); zone->RemoveAllContours(); @@ -682,7 +682,7 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) // by Show_New_Edge_While_Move_Mouse if( zone->GetCornerPosition( ii - 1 ) != zone->GetCornerPosition( ii ) ) { - if( !Drc_On || !zone->IsOnCopperLayer() || ( m_drc->Drc( zone, ii - 1 ) == OK_DRC ) ) + if( !g_Drc_On || !zone->IsOnCopperLayer() || ( m_drc->Drc( zone, ii - 1 ) == OK_DRC ) ) { // Ok, we can add a new corner if( m_canvas->IsMouseCaptured() ) @@ -720,10 +720,10 @@ bool PCB_EDIT_FRAME::End_Zone( wxDC* DC ) int icorner = zone->GetNumCorners() - 1; if( zone->IsOnCopperLayer() ) { - if( Drc_On && m_drc->Drc( zone, icorner - 1 ) == BAD_DRC ) // we can't validate last edge + if( g_Drc_On && m_drc->Drc( zone, icorner - 1 ) == BAD_DRC ) // we can't validate last edge return false; - if( Drc_On && m_drc->Drc( zone, icorner ) == BAD_DRC ) // we can't validate the closing edge + if( g_Drc_On && m_drc->Drc( zone, icorner ) == BAD_DRC ) // we can't validate the closing edge { DisplayError( this, _( "DRC error: closing this area creates a drc error with an other area" ) ); From 5874ac0f6f52a3e46fcd4ed33e70aece2020b35d Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 27 Mar 2013 19:34:23 +0100 Subject: [PATCH 12/63] Commit patch for x3d file reader (with minor changes). Commit other minor patches and fixes --- 3d-viewer/3d_read_mesh.cpp | 530 +---------------- 3d-viewer/3d_struct.h | 20 - 3d-viewer/CMakeLists.txt | 2 + 3d-viewer/modelparsers.h | 176 ++++++ 3d-viewer/vrmlmodelparser.cpp | 557 ++++++++++++++++++ 3d-viewer/x3dmodelparser.cpp | 458 ++++++++++++++ common/class_page_info.cpp | 4 +- common/wildcards_and_files_ext.cpp | 2 +- eeschema/dialogs/dialog_build_BOM.cpp | 6 +- include/wildcards_and_files_ext.h | 2 +- .../dialog_edit_module_for_BoardEditor.cpp | 7 +- .../dialog_edit_module_for_Modedit.cpp | 7 +- pcbnew/dialogs/dialog_gendrill_base.cpp | 8 +- pcbnew/dialogs/dialog_gendrill_base.fbp | 4 +- pcbnew/dialogs/dialog_gendrill_base.h | 4 +- pcbnew/export_vrml.cpp | 29 +- 16 files changed, 1269 insertions(+), 547 deletions(-) create mode 100644 3d-viewer/modelparsers.h create mode 100644 3d-viewer/vrmlmodelparser.cpp create mode 100644 3d-viewer/x3dmodelparser.cpp diff --git a/3d-viewer/3d_read_mesh.cpp b/3d-viewer/3d_read_mesh.cpp index 326d99b941..c91b2ff859 100644 --- a/3d-viewer/3d_read_mesh.cpp +++ b/3d-viewer/3d_read_mesh.cpp @@ -35,20 +35,33 @@ #include <3d_viewer.h> #include +#include "3d_struct.h" +#include "modelparsers.h" // Imported function: extern void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits ); -// separator chars -static const char* sep_chars = " \t\n\r"; +S3D_MODEL_PARSER* S3D_MODEL_PARSER::Create( S3D_MASTER* aMaster, + const wxString aExtension ) +{ + if ( aExtension == wxT( "x3d" ) ) + { + return new X3D_MODEL_PARSER(aMaster); + } + else if ( aExtension == wxT( "wrl" ) ) + { + return new VRML_MODEL_PARSER(aMaster); + } + else + { + return NULL; + } +} int S3D_MASTER::ReadData() { - char line[1024], * text; wxFileName fn; wxString FullFilename; - FILE* file; - int LineNum = 0; if( m_Shape3DName.IsEmpty() ) { @@ -65,6 +78,7 @@ int S3D_MASTER::ReadData() if( wxFileName::FileExists( shape3DNname ) ) { FullFilename = shape3DNname; + fn.Assign(FullFilename); } else { @@ -79,512 +93,22 @@ int S3D_MASTER::ReadData() } } - file = wxFopen( FullFilename, wxT( "rt" ) ); - - if( file == NULL ) + wxString extension = fn.GetExt(); + S3D_MODEL_PARSER* parser = S3D_MODEL_PARSER::Create(this, extension); + if(parser) { - return -1; - } - - // Switch the locale to standard C (needed to print floating point numbers like 1.3) - SetLocaleTo_C_standard(); - - while( GetLine( file, line, &LineNum, 512 ) ) - { - text = strtok( line, sep_chars ); - - if( stricmp( text, "DEF" ) == 0 || stricmp( text, "Group" ) == 0) - { - while( GetLine( file, line, &LineNum, 512 ) ) - { - text = strtok( line, sep_chars ); - - if( text == NULL ) - continue; - - if( *text == '}' ) - break; - - if( stricmp( text, "children" ) == 0 ) - { - ReadChildren( file, &LineNum ); - } - } - } - } - - fclose( file ); - SetLocaleTo_Default(); // revert to the current locale - return 0; -} - - -int S3D_MASTER::ReadMaterial( FILE* file, int* LineNum ) -{ - char line[512], * text, * command; - wxString mat_name; - S3D_MATERIAL* material = NULL; - - command = strtok( NULL, sep_chars ); - text = strtok( NULL, sep_chars ); - mat_name = FROM_UTF8( text ); - - if( stricmp( command, "USE" ) == 0 ) - { - for( material = m_Materials; material; material = material->Next() ) - { - if( material->m_Name == mat_name ) - { - material->SetMaterial(); - return 1; - } - } - - D( printf( "ReadMaterial error: material not found\n" ) ); + parser->Load(FullFilename); + delete parser; return 0; - } - - if( stricmp( command, "DEF" ) == 0 || stricmp( command, "Material") == 0) + } + else { - material = new S3D_MATERIAL( this, mat_name ); - - Insert( material ); - - while( GetLine( file, line, LineNum, 512 ) ) - { - text = strtok( line, sep_chars ); - - if( text == NULL ) - continue; - - if( text[0] == '}' ) - { - material->SetMaterial(); - return 0; - } - - if( stricmp( text, "diffuseColor" ) == 0 ) - { - text = strtok( NULL, sep_chars ); - material->m_DiffuseColor.x = atof( text ); - text = strtok( NULL, sep_chars ); - material->m_DiffuseColor.y = atof( text ); - text = strtok( NULL, sep_chars ); - material->m_DiffuseColor.z = atof( text ); - } - else if( stricmp( text, "emissiveColor" ) == 0 ) - { - text = strtok( NULL, sep_chars ); - material->m_EmissiveColor.x = atof( text ); - text = strtok( NULL, sep_chars ); - material->m_EmissiveColor.y = atof( text ); - text = strtok( NULL, sep_chars ); - material->m_EmissiveColor.z = atof( text ); - } - else if( strnicmp( text, "specularColor", 13 ) == 0 ) - { - text = strtok( NULL, sep_chars ); - material->m_SpecularColor.x = atof( text ); - text = strtok( NULL, sep_chars ); - material->m_SpecularColor.y = atof( text ); - text = strtok( NULL, sep_chars ); - material->m_SpecularColor.z = atof( text ); - } - else if( strnicmp( text, "ambientIntensity", 16 ) == 0 ) - { - text = strtok( NULL, sep_chars ); - material->m_AmbientIntensity = atof( text ); - } - else if( strnicmp( text, "transparency", 12 ) == 0 ) - { - text = strtok( NULL, sep_chars ); - material->m_Transparency = atof( text ); - } - else if( strnicmp( text, "shininess", 9 ) == 0 ) - { - text = strtok( NULL, sep_chars ); - material->m_Shininess = atof( text ); - } - } + wxLogDebug( wxT( "Unknown file type <%s>" ), GetChars( extension ) ); } return -1; } - -int S3D_MASTER::ReadChildren( FILE* file, int* LineNum ) -{ - char line[1024], * text; - - while( GetLine( file, line, LineNum, 512 ) ) - { - text = strtok( line, sep_chars ); - - if( *text == ']' ) - return 0; - - if( *text == ',' ) - continue; - - if( stricmp( text, "Shape" ) == 0 ) - { - ReadShape( file, LineNum ); - } - else - { - D( printf( "ReadChildren error line %d <%s> \n", *LineNum, text ) ); - break; - } - } - - return 1; -} - - -int S3D_MASTER::ReadShape( FILE* file, int* LineNum ) -{ - char line[1024], * text; - int err = 1; - - while( GetLine( file, line, LineNum, 512 ) ) - { - text = strtok( line, sep_chars ); - - if( *text == '}' ) - { - err = 0; - break; - } - - if( stricmp( text, "appearance" ) == 0 ) - { - ReadAppearance( file, LineNum ); - } - else if( stricmp( text, "geometry" ) == 0 ) - { - ReadGeometry( file, LineNum ); - } - else - { - D( printf( "ReadShape error line %d <%s> \n", *LineNum, text ) ); - break; - } - } - - return err; -} - - -int S3D_MASTER::ReadAppearance( FILE* file, int* LineNum ) -{ - char line[1024], * text; - int err = 1; - - while( GetLine( file, line, LineNum, 512 ) ) - { - text = strtok( line, sep_chars ); - - if( *text == '}' ) - { - err = 0; break; - } - - if( stricmp( text, "material" ) == 0 ) - { - ReadMaterial( file, LineNum ); - } - else - { - D( printf( "ReadAppearance error line %d <%s> \n", *LineNum, text ) ); - break; - } - } - - return err; -} - - -#define BUFSIZE 2000 - -/** - * Function ReadCoordList - * reads 3D coordinate lists like: - * coord Coordinate { point [ - * -5.24489 6.57640e-3 -9.42129e-2, - * -5.11821 6.57421e-3 0.542654, - * -3.45868 0.256565 1.32000 ] } - * or: - * normal Normal { vector [ - * 0.995171 -6.08102e-6 9.81541e-2, - * 0.923880 -4.09802e-6 0.382683, - * 0.707107 -9.38186e-7 0.707107] - * } - * - * text_buffer contains the first line of this node : - * "coord Coordinate { point [" - */ -void ReadCoordsList( FILE* file, char* text_buffer, std::vector< double >& aList, int* LineNum ) -{ - unsigned int ii = 0, jj = 0; - char* text; - bool HasData = false; - bool StartData = false; - bool EndNode = false; - char string_num[512]; - - text = text_buffer; - - while( !EndNode ) - { - if( *text == 0 ) // Needs data ! - { - text = text_buffer; - GetLine( file, text_buffer, LineNum, 512 ); - } - - while( !EndNode && *text ) - { - switch( *text ) - { - case '[': - StartData = true; - jj = 0; - string_num[jj] = 0; - break; - - case '}': - EndNode = true; - break; - - case ']': - case '\t': - case ' ': - case ',': - jj = 0; - - if( !StartData || !HasData ) - break; - - aList.push_back( atof( string_num ) ); - string_num[jj] = 0; - ii++; - - HasData = false; - - if( *text == ']' ) - { - StartData = false; - } - - break; - - default: - if( !StartData ) - break; - - if( jj >= sizeof( string_num ) ) - break; - - string_num[jj] = *text; - jj++; - string_num[jj] = 0; - HasData = true; - break; - } - - text++; - } - } -} - - -int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum ) -{ - char line[1024], buffer[1024], * text; - int err = 1; - std::vector< double > points; - std::vector< double > list; - double vrmlunits_to_3Dunits = g_Parm_3D_Visu.m_BiuTo3Dunits * UNITS3D_TO_UNITSPCB; - - while( GetLine( file, line, LineNum, 512 ) ) - { - strcpy( buffer, line ); - text = strtok( buffer, sep_chars ); - - if( *text == '}' ) - { - err = 0; - break; - } - - if( stricmp( text, "normalPerVertex" ) == 0 ) - { - text = strtok( NULL, " ,\t\n\r" ); - - if( stricmp( text, "true" ) == 0 ) - { - } - else - { - } - continue; - } - - if( stricmp( text, "colorPerVertex" ) == 0 ) - { - text = strtok( NULL, " ,\t\n\r" ); - - if( stricmp( text, "true" ) == 0 ) - { - } - else - { - } - continue; - } - - if( stricmp( text, "normal" ) == 0 ) - { - ReadCoordsList( file, line, list, LineNum ); - list.clear(); - continue; - } - - if( stricmp( text, "normalIndex" ) == 0 ) - { - while( GetLine( file, line, LineNum, 512 ) ) - { - text = strtok( line, " ,\t\n\r" ); - - while( text ) - { - if( *text == ']' ) - break; - - text = strtok( NULL, " ,\t\n\r" ); - } - - if( text && (*text == ']') ) - break; - } - - continue; - } - - if( stricmp( text, "color" ) == 0 ) - { - ReadCoordsList( file, line, list, LineNum ); - list.clear(); - continue; - } - - if( stricmp( text, "solid" ) == 0 ) - { - // ignore solid - continue; - } - - if( stricmp( text, "colorIndex" ) == 0 ) - { - while( GetLine( file, line, LineNum, 512 ) ) - { - text = strtok( line, " ,\t\n\r" ); - - while( text ) - { - if( *text == ']' ) - break; - - text = strtok( NULL, " ,\t\n\r" ); - } - - if( text && (*text == ']') ) - break; - } - - continue; - } - - if( stricmp( text, "coord" ) == 0 ) - { - ReadCoordsList( file, line, points, LineNum ); - } - else if( stricmp( text, "coordIndex" ) == 0 ) - { - if( points.size() < 3 || points.size() % 3 != 0 ) - { - wxLogError( wxT( "3D geometry read error <%s> at line %d." ), - GetChars( FROM_UTF8( text ) ), *LineNum ); - err = 1; - break; - } - - std::vector< int > coordIndex; - std::vector< S3D_VERTEX > vertices; - - while( GetLine( file, line, LineNum, 512 ) ) - { - int jj; - text = strtok( line, " ,\t\n\r" ); - - while( text ) - { - if( *text == ']' ) - break; - - jj = atoi( text ); - - if( jj < 0 ) - { - for( jj = 0; jj < (int) coordIndex.size(); jj++ ) - { - int kk = coordIndex[jj] * 3; - - if( (kk < 0) || ((kk + 3) > (int)points.size()) ) - { - wxLogError( wxT( "3D geometry index read error <%s> at line %d." ), - GetChars( FROM_UTF8( text ) ), *LineNum ); - err = 1; - break; - } - - S3D_VERTEX vertex; - vertex.x = points[kk]; - vertex.y = points[kk + 1]; - vertex.z = points[kk + 2]; - vertices.push_back( vertex ); - } - - Set_Object_Coords( vertices ); - Set_Object_Data( vertices, vrmlunits_to_3Dunits ); - vertices.clear(); - coordIndex.clear(); - } - else - { - coordIndex.push_back( jj ); - } - - text = strtok( NULL, " ,\t\n\r" ); - } - - if( text && (*text == ']') ) - break; - } - } - else - { - wxLogError( wxT( "3D geometry read error <%s> at line %d." ), - GetChars( FROM_UTF8( text ) ), *LineNum ); - err = 1; - break; - } - } - - return err; -} - - int STRUCT_3D_SHAPE::ReadData( FILE* file, int* LineNum ) { char line[512]; diff --git a/3d-viewer/3d_struct.h b/3d-viewer/3d_struct.h index 26e6738339..4c1d2be577 100644 --- a/3d-viewer/3d_struct.h +++ b/3d-viewer/3d_struct.h @@ -115,26 +115,6 @@ public: void Copy( S3D_MASTER* pattern ); int ReadData(); - - /** - * Function ReadMaterial - * read the description of a 3D material definition in the form: - * DEF yellow material Material ( - * DiffuseColor 1.00000 1.00000 0.00000e 0 - * EmissiveColor 0.00000e 0 0.00000e 0 0.00000e 0 - * SpecularColor 1.00000 1.00000 1.00000 - * AmbientIntensity 1.00000 - * Transparency 0.00000e 0 - * Shininess 1.00000 - *) - * Or type: - * USE yellow material - */ - int ReadMaterial( FILE* file, int* LineNum ); - int ReadChildren( FILE* file, int* LineNum ); - int ReadShape( FILE* file, int* LineNum ); - int ReadAppearance( FILE* file, int* LineNum ); - int ReadGeometry( FILE* file, int* LineNum ); void Set_Object_Coords( std::vector< S3D_VERTEX >& aVertices ); #if defined(DEBUG) diff --git a/3d-viewer/CMakeLists.txt b/3d-viewer/CMakeLists.txt index c48af8613b..94cc9d396e 100644 --- a/3d-viewer/CMakeLists.txt +++ b/3d-viewer/CMakeLists.txt @@ -19,6 +19,8 @@ set(3D-VIEWER_SRCS 3d_toolbar.cpp info3d_visu.cpp trackball.cpp + x3dmodelparser.cpp + vrmlmodelparser.cpp ) add_library(3d-viewer STATIC ${3D-VIEWER_SRCS}) diff --git a/3d-viewer/modelparsers.h b/3d-viewer/modelparsers.h new file mode 100644 index 0000000000..55e2dc738e --- /dev/null +++ b/3d-viewer/modelparsers.h @@ -0,0 +1,176 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2013 Tuomas Vaherkoski + * Copyright (C) 1992-2013 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 + */ + +/** + * @file modelparsers.h + */ + +#ifndef MODELPARSERS_H +#define MODELPARSERS_H + +#include +#include +#include + + +class S3D_MASTER; +class S3D_VERTEX; + +extern void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits ); + +class S3D_MODEL_PARSER; +class X3D_MODEL_PARSER; + +/** + * abstract class S3D_MODEL_PARSER + * Base class for 3D model parsers. + */ +class S3D_MODEL_PARSER +{ +public: + S3D_MODEL_PARSER(S3D_MASTER* aMaster) + :master(aMaster) + {} + + virtual ~S3D_MODEL_PARSER() + {} + + S3D_MASTER* GetMaster() + { + return master; + } + + /** + * Function Create + * Factory method for creating concrete 3D model parsers + * Notice that the caller is responible to delete created parser. + * + * @param aMaster is master object that the parser will fill. + * @param aExtension is file extension of the file you are going to parse. + */ + static S3D_MODEL_PARSER* Create( S3D_MASTER* aMaster, + const wxString aExtension ); + /** + * Function Load + * + * Concrete parsers should implement this function + */ + virtual void Load(const wxString aFilename) = 0; + +private: + S3D_MASTER* master; +}; + + +class wxXmlNode; + +/** + * class X3D_MODEL_PARSER + * Implements parser for X3D file format (VRML2.0 successor) + * X3D files can be exported from eg. Blender */ +class X3D_MODEL_PARSER: public S3D_MODEL_PARSER +{ +public: + X3D_MODEL_PARSER(S3D_MASTER* aMaster); + ~X3D_MODEL_PARSER(); + void Load(const wxString aFilename); + + typedef std::map< wxString, wxString > PROPERTY_MAP; + typedef std::vector< wxXmlNode* > NODE_LIST; + + /** + * Function GetChildsByName + * Searches all child nodes with aName. + * + * @param aParent is node to search from + * @param aName is the name of node you try to find + * @param aResult contains found nodes + */ + static void GetChildsByName(wxXmlNode* aParent, const wxString aName, + NODE_LIST& aResult); + + /** + * Function GetNodeProperties + * Collects all node properties to map. + * + * @param aProps contains map of found properties + */ + static void GetNodeProperties(wxXmlNode* aNode, PROPERTY_MAP& aProps); + + /** + * Return string representing x3d file in vrml format + * Function Load must be called before this function, otherwise empty + * data set is returned. + */ + wxString VRML_representation(); + +private: + std::vector vrml_materials; + std::vector vrml_points; + std::vector vrml_coord_indexes; + + void readTransform( wxXmlNode* aTransformNode ); + void readMaterial( wxXmlNode* aMatNode ); + void readIndexedFaceSet( wxXmlNode* aFaceNode, + PROPERTY_MAP& aTransfromProps ); + bool parseDoubleTriplet( const wxString& aData, S3D_VERTEX& aResult ); + + void rotate( S3D_VERTEX& aCoordinate, S3D_VERTEX& aRotAxis, double angle); +}; + +/** + * class WRL_MODEL_PARSER + * Parses + */ +class VRML_MODEL_PARSER: public S3D_MODEL_PARSER +{ +public: + VRML_MODEL_PARSER(S3D_MASTER* aMaster); + ~VRML_MODEL_PARSER(); + void Load(const wxString aFilename); + +private: + /** + * Function ReadMaterial + * read the description of a 3D material definition in the form: + * DEF yellow material Material ( + * DiffuseColor 1.00000 1.00000 0.00000e 0 + * EmissiveColor 0.00000e 0 0.00000e 0 0.00000e 0 + * SpecularColor 1.00000 1.00000 1.00000 + * AmbientIntensity 1.00000 + * Transparency 0.00000e 0 + * Shininess 1.00000 + *) + * Or type: + * USE yellow material + */ + int readMaterial( FILE* file, int* LineNum ); + int readChildren( FILE* file, int* LineNum ); + int readShape( FILE* file, int* LineNum ); + int readAppearance( FILE* file, int* LineNum ); + int readGeometry( FILE* file, int* LineNum ); + void readCoordsList( FILE* file, char* text_buffer, std::vector< double >& aList, int* LineNum ); +}; + +#endif // MODELPARSERS_H diff --git a/3d-viewer/vrmlmodelparser.cpp b/3d-viewer/vrmlmodelparser.cpp new file mode 100644 index 0000000000..cbb3205e41 --- /dev/null +++ b/3d-viewer/vrmlmodelparser.cpp @@ -0,0 +1,557 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2013 Tuomas Vaherkoski + * Copyright (C) 2012 Jean-Pierre Charras, jp.charras@wanadoo.fr + * Copyright (C) 2011 Wayne Stambaugh + * Copyright (C) 1992-2011 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 + */ + +/** + * @file vrmlmodelparser.cpp + */ + +#include +#include +#include +#include +#include + +#include "3d_struct.h" +#include "modelparsers.h" + +// separator chars +static const char* sep_chars = " \t\n\r"; + +VRML_MODEL_PARSER::VRML_MODEL_PARSER(S3D_MASTER* aMaster) +:S3D_MODEL_PARSER(aMaster) +{} + +VRML_MODEL_PARSER::~VRML_MODEL_PARSER() +{} + +void VRML_MODEL_PARSER::Load(const wxString aFilename) +{ + char line[1024], * text; + FILE* file; + int LineNum = 0; + + file = wxFopen( aFilename, wxT( "rt" ) ); + + if( file == NULL ) + { + return; + } + + // Switch the locale to standard C (needed to print floating point numbers like 1.3) + SetLocaleTo_C_standard(); + + while( GetLine( file, line, &LineNum, 512 ) ) + { + text = strtok( line, sep_chars ); + + if( stricmp( text, "DEF" ) == 0 || stricmp( text, "Group" ) == 0) + { + while( GetLine( file, line, &LineNum, 512 ) ) + { + text = strtok( line, sep_chars ); + + if( text == NULL ) + continue; + + if( *text == '}' ) + break; + + if( stricmp( text, "children" ) == 0 ) + { + readChildren( file, &LineNum ); + } + } + } + } + + fclose( file ); + SetLocaleTo_Default(); // revert to the current locale +} + +int VRML_MODEL_PARSER::readMaterial( FILE* file, int* LineNum ) +{ + char line[512], * text, * command; + wxString mat_name; + S3D_MATERIAL* material = NULL; + + command = strtok( NULL, sep_chars ); + text = strtok( NULL, sep_chars ); + mat_name = FROM_UTF8( text ); + + if( stricmp( command, "USE" ) == 0 ) + { + for( material = GetMaster()->m_Materials; material; material = material->Next() ) + { + if( material->m_Name == mat_name ) + { + material->SetMaterial(); + return 1; + } + } + + D( printf( "ReadMaterial error: material not found\n" ) ); + return 0; + } + + if( stricmp( command, "DEF" ) == 0 || stricmp( command, "Material") == 0) + { + material = new S3D_MATERIAL( GetMaster(), mat_name ); + + GetMaster()->Insert( material ); + + while( GetLine( file, line, LineNum, 512 ) ) + { + text = strtok( line, sep_chars ); + + if( text == NULL ) + continue; + + if( text[0] == '}' ) + { + material->SetMaterial(); + return 0; + } + + if( stricmp( text, "diffuseColor" ) == 0 ) + { + text = strtok( NULL, sep_chars ); + material->m_DiffuseColor.x = atof( text ); + text = strtok( NULL, sep_chars ); + material->m_DiffuseColor.y = atof( text ); + text = strtok( NULL, sep_chars ); + material->m_DiffuseColor.z = atof( text ); + } + else if( stricmp( text, "emissiveColor" ) == 0 ) + { + text = strtok( NULL, sep_chars ); + material->m_EmissiveColor.x = atof( text ); + text = strtok( NULL, sep_chars ); + material->m_EmissiveColor.y = atof( text ); + text = strtok( NULL, sep_chars ); + material->m_EmissiveColor.z = atof( text ); + } + else if( strnicmp( text, "specularColor", 13 ) == 0 ) + { + text = strtok( NULL, sep_chars ); + material->m_SpecularColor.x = atof( text ); + text = strtok( NULL, sep_chars ); + material->m_SpecularColor.y = atof( text ); + text = strtok( NULL, sep_chars ); + material->m_SpecularColor.z = atof( text ); + } + else if( strnicmp( text, "ambientIntensity", 16 ) == 0 ) + { + text = strtok( NULL, sep_chars ); + material->m_AmbientIntensity = atof( text ); + } + else if( strnicmp( text, "transparency", 12 ) == 0 ) + { + text = strtok( NULL, sep_chars ); + material->m_Transparency = atof( text ); + } + else if( strnicmp( text, "shininess", 9 ) == 0 ) + { + text = strtok( NULL, sep_chars ); + material->m_Shininess = atof( text ); + } + } + } + + return -1; +} + + +int VRML_MODEL_PARSER::readChildren( FILE* file, int* LineNum ) +{ + char line[1024], * text; + + while( GetLine( file, line, LineNum, 512 ) ) + { + text = strtok( line, sep_chars ); + + if( *text == ']' ) + return 0; + + if( *text == ',' ) + continue; + + if( stricmp( text, "Shape" ) == 0 ) + { + readShape( file, LineNum ); + } + else + { + D( printf( "ReadChildren error line %d <%s> \n", *LineNum, text ) ); + break; + } + } + + return 1; +} + + +int VRML_MODEL_PARSER::readShape( FILE* file, int* LineNum ) +{ + char line[1024], * text; + int err = 1; + + while( GetLine( file, line, LineNum, 512 ) ) + { + text = strtok( line, sep_chars ); + + if( *text == '}' ) + { + err = 0; + break; + } + + if( stricmp( text, "appearance" ) == 0 ) + { + readAppearance( file, LineNum ); + } + else if( stricmp( text, "geometry" ) == 0 ) + { + readGeometry( file, LineNum ); + } + else + { + D( printf( "ReadShape error line %d <%s> \n", *LineNum, text ) ); + break; + } + } + + return err; +} + + +int VRML_MODEL_PARSER::readAppearance( FILE* file, int* LineNum ) +{ + char line[1024], * text; + int err = 1; + + while( GetLine( file, line, LineNum, 512 ) ) + { + text = strtok( line, sep_chars ); + + if( *text == '}' ) + { + err = 0; break; + } + + if( stricmp( text, "material" ) == 0 ) + { + readMaterial( file, LineNum ); + } + else + { + D( printf( "ReadAppearance error line %d <%s> \n", *LineNum, text ) ); + break; + } + } + + return err; +} + + +#define BUFSIZE 2000 + +/** + * Function ReadCoordList + * reads 3D coordinate lists like: + * coord Coordinate { point [ + * -5.24489 6.57640e-3 -9.42129e-2, + * -5.11821 6.57421e-3 0.542654, + * -3.45868 0.256565 1.32000 ] } + * or: + * normal Normal { vector [ + * 0.995171 -6.08102e-6 9.81541e-2, + * 0.923880 -4.09802e-6 0.382683, + * 0.707107 -9.38186e-7 0.707107] + * } + * + * text_buffer contains the first line of this node : + * "coord Coordinate { point [" + */ +void VRML_MODEL_PARSER::readCoordsList( FILE* file, char* text_buffer, std::vector< double >& aList, int* LineNum ) +{ + unsigned int ii = 0, jj = 0; + char* text; + bool HasData = false; + bool StartData = false; + bool EndNode = false; + char string_num[512]; + + text = text_buffer; + + while( !EndNode ) + { + if( *text == 0 ) // Needs data ! + { + text = text_buffer; + GetLine( file, text_buffer, LineNum, 512 ); + } + + while( !EndNode && *text ) + { + switch( *text ) + { + case '[': + StartData = true; + jj = 0; + string_num[jj] = 0; + break; + + case '}': + EndNode = true; + break; + + case ']': + case '\t': + case ' ': + case ',': + jj = 0; + + if( !StartData || !HasData ) + break; + + aList.push_back( atof( string_num ) ); + string_num[jj] = 0; + ii++; + + HasData = false; + + if( *text == ']' ) + { + StartData = false; + } + + break; + + default: + if( !StartData ) + break; + + if( jj >= sizeof( string_num ) ) + break; + + string_num[jj] = *text; + jj++; + string_num[jj] = 0; + HasData = true; + break; + } + + text++; + } + } +} + + +int VRML_MODEL_PARSER::readGeometry( FILE* file, int* LineNum ) +{ + char line[1024], buffer[1024], * text; + int err = 1; + std::vector< double > points; + std::vector< double > list; + double vrmlunits_to_3Dunits = g_Parm_3D_Visu.m_BiuTo3Dunits * UNITS3D_TO_UNITSPCB; + + while( GetLine( file, line, LineNum, 512 ) ) + { + strcpy( buffer, line ); + text = strtok( buffer, sep_chars ); + + if( *text == '}' ) + { + err = 0; + break; + } + + if( stricmp( text, "normalPerVertex" ) == 0 ) + { + text = strtok( NULL, " ,\t\n\r" ); + + if( stricmp( text, "true" ) == 0 ) + { + } + else + { + } + continue; + } + + if( stricmp( text, "colorPerVertex" ) == 0 ) + { + text = strtok( NULL, " ,\t\n\r" ); + + if( stricmp( text, "true" ) == 0 ) + { + } + else + { + } + continue; + } + + if( stricmp( text, "normal" ) == 0 ) + { + readCoordsList( file, line, list, LineNum ); + list.clear(); + continue; + } + + if( stricmp( text, "normalIndex" ) == 0 ) + { + while( GetLine( file, line, LineNum, 512 ) ) + { + text = strtok( line, " ,\t\n\r" ); + + while( text ) + { + if( *text == ']' ) + break; + + text = strtok( NULL, " ,\t\n\r" ); + } + + if( text && (*text == ']') ) + break; + } + + continue; + } + + if( stricmp( text, "color" ) == 0 ) + { + readCoordsList( file, line, list, LineNum ); + list.clear(); + continue; + } + + if( stricmp( text, "solid" ) == 0 ) + { + // ignore solid + continue; + } + + if( stricmp( text, "colorIndex" ) == 0 ) + { + while( GetLine( file, line, LineNum, 512 ) ) + { + text = strtok( line, " ,\t\n\r" ); + + while( text ) + { + if( *text == ']' ) + break; + + text = strtok( NULL, " ,\t\n\r" ); + } + + if( text && (*text == ']') ) + break; + } + + continue; + } + + if( stricmp( text, "coord" ) == 0 ) + { + readCoordsList( file, line, points, LineNum ); + } + else if( stricmp( text, "coordIndex" ) == 0 ) + { + if( points.size() < 3 || points.size() % 3 != 0 ) + { + wxLogError( wxT( "3D geometry read error <%s> at line %d." ), + GetChars( FROM_UTF8( text ) ), *LineNum ); + err = 1; + break; + } + + std::vector< int > coordIndex; + std::vector< S3D_VERTEX > vertices; + + while( GetLine( file, line, LineNum, 512 ) ) + { + int jj; + text = strtok( line, " ,\t\n\r" ); + + while( text ) + { + if( *text == ']' ) + break; + + jj = atoi( text ); + + if( jj < 0 ) + { + for( jj = 0; jj < (int) coordIndex.size(); jj++ ) + { + int kk = coordIndex[jj] * 3; + + if( (kk < 0) || ((kk + 3) > (int)points.size()) ) + { + wxLogError( wxT( "3D geometry index read error <%s> at line %d." ), + GetChars( FROM_UTF8( text ) ), *LineNum ); + err = 1; + break; + } + + S3D_VERTEX vertex; + vertex.x = points[kk]; + vertex.y = points[kk + 1]; + vertex.z = points[kk + 2]; + vertices.push_back( vertex ); + } + + GetMaster()->Set_Object_Coords( vertices ); + Set_Object_Data( vertices, vrmlunits_to_3Dunits ); + vertices.clear(); + coordIndex.clear(); + } + else + { + coordIndex.push_back( jj ); + } + + text = strtok( NULL, " ,\t\n\r" ); + } + + if( text && (*text == ']') ) + break; + } + } + else + { + wxLogError( wxT( "3D geometry read error <%s> at line %d." ), + GetChars( FROM_UTF8( text ) ), *LineNum ); + err = 1; + break; + } + } + + return err; +} diff --git a/3d-viewer/x3dmodelparser.cpp b/3d-viewer/x3dmodelparser.cpp new file mode 100644 index 0000000000..8402164547 --- /dev/null +++ b/3d-viewer/x3dmodelparser.cpp @@ -0,0 +1,458 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2013 Tuomas Vaherkoski + * Copyright (C) 1992-2013 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 + */ + +/** + * @file x3dmodelparser.cpp + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "3d_struct.h" +#include "modelparsers.h" + +X3D_MODEL_PARSER::X3D_MODEL_PARSER( S3D_MASTER* aMaster ) +:S3D_MODEL_PARSER( aMaster ) +{} + +X3D_MODEL_PARSER::~X3D_MODEL_PARSER() +{} + +void X3D_MODEL_PARSER::Load( const wxString aFilename ) +{ + wxXmlDocument doc; + if( !doc.Load( aFilename ) ) + { + wxLogError( wxT( "Error while parsing file <%s>" ), GetChars( aFilename ) ); + return; + } + + if( doc.GetRoot()->GetName() != wxT( "X3D" ) ) + { + wxLogError( wxT( "Filetype is not X3D <%s>" ), GetChars( aFilename ) ); + return; + } + + // Shapes are inside of Transform nodes + // Transform node contains information about + // transition, scale and rotation of the shape + NODE_LIST transforms; + GetChildsByName( doc.GetRoot(), wxT( "Transform" ), transforms ); + for( NODE_LIST::iterator node_it = transforms.begin(); + node_it != transforms.end(); + node_it++ ) + { + readTransform( *node_it ); + } +} + +wxString X3D_MODEL_PARSER::VRML_representation() +{ + wxString output; + for( unsigned i = 0; i < vrml_points.size(); i++ ) + { + output += wxT("Shape {\n" + " appearance Appearance {\n" + " material Material {\n" ) + + vrml_materials[i] + + wxT(" }\n" + " }\n" + " geometry IndexedFaceSet {\n" + " solid TRUE\n" + " coord Coordinate {\n" + " point [\n") + + vrml_points[i] + + wxT( " ]\n" + " }\n" + " coordIndex [\n" ) + + vrml_coord_indexes[i] + + wxT(" ]\n" + " }\n" + "},\n"); + } + + return output; +} + +void X3D_MODEL_PARSER::GetChildsByName( wxXmlNode* aParent, + const wxString aName, + std::vector< wxXmlNode* >& aResult ) +{ + // Breadth-first search (BFS) + std::queue< wxXmlNode* > found; + found.push( aParent ); + while( !found.empty() ) + { + wxXmlNode *elem = found.front(); + for( wxXmlNode *child = elem->GetChildren(); + child != NULL; + child = child->GetNext() ) + { + if( child->GetName() == aName) + { + aResult.push_back( child ); + } + found.push( child ); + } + found.pop(); + } +} + +void X3D_MODEL_PARSER::GetNodeProperties( wxXmlNode* aNode, PROPERTY_MAP& aProps ) { + wxXmlProperty *prop; + for( prop = aNode->GetProperties(); + prop != NULL; + prop = prop->GetNext() ) + { + aProps[ prop->GetName() ] = prop->GetValue(); + } +} + +/* Private ----- */ + +void X3D_MODEL_PARSER::readTransform( wxXmlNode* aTransformNode ) +{ + NODE_LIST childnodes; + GetChildsByName( aTransformNode, wxT( "Material" ), childnodes ); + + for( NODE_LIST::iterator node = childnodes.begin(); + node != childnodes.end(); + node++ ) + { + readMaterial( *node ); + } + childnodes.clear(); + + PROPERTY_MAP properties; + GetNodeProperties( aTransformNode, properties ); + GetChildsByName( aTransformNode, wxT("IndexedFaceSet"), childnodes ); + for( NODE_LIST::iterator node = childnodes.begin(); + node != childnodes.end(); + node++ ) + { + readIndexedFaceSet( *node, properties ); + } + childnodes.clear(); +} + +void X3D_MODEL_PARSER::readMaterial( wxXmlNode* aMatNode ) +{ + PROPERTY_MAP properties; + GetNodeProperties( aMatNode, properties ); + + // DEFine new Material named as value of DEF + if( properties.find( wxT( "DEF" ) ) != properties.end() ) { + double amb, shine, transp; + + S3D_MATERIAL* material = new S3D_MATERIAL( GetMaster(), properties[ wxT( "DEF" ) ] ); + GetMaster()->Insert( material ); + + if( !parseDoubleTriplet( properties[ wxT( "diffuseColor" ) ], + material->m_DiffuseColor) ) + { + D( printf("diffuseColor parsing error") ); + } + + if( !parseDoubleTriplet( properties[ wxT( "specularColor" ) ], + material->m_SpecularColor ) ) + { + D( printf("specularColor parsing error") ); + } + + if( !parseDoubleTriplet( properties[ wxT( "emissiveColor" ) ], + material->m_EmissiveColor ) ) + { + D( printf("emissiveColor parsing error") ); + } + + wxStringTokenizer values; + values.SetString( properties[ wxT( "ambientIntensity" ) ] ); + if( values.GetNextToken().ToDouble( &amb ) ) + { + material->m_AmbientIntensity = amb; + } + else + { + D( printf("ambienterror") ); + } + + values.SetString( properties[ wxT( "shininess" ) ] ); + if( values.GetNextToken().ToDouble(&shine) ) + { + material->m_Shininess = shine; + } + else { + D( printf( "shininess error" ) ); + } + + values.SetString( properties[ wxT( "transparency" ) ] ); + if( values.GetNextToken().ToDouble(&transp) ) + { + material->m_Transparency = transp; + } + else + { + D( printf( "trans error") ); + } + + material->SetMaterial(); + + // VRML + wxString vrml_material; + PROPERTY_MAP::const_iterator p = ++properties.begin(); // skip DEF + for(;p != properties.end();p++) { + vrml_material.Append( p->first + wxT(" ") + p->second + wxT("\n") ); + } + + vrml_materials.push_back(vrml_material); + } + + // USE existing material named by value of USE + else if( properties.find( wxT( "USE" ) ) != properties.end() ) { + S3D_MATERIAL* material = NULL; + wxString mat_name = properties[ wxT( "USE" ) ]; + + for( material = GetMaster()->m_Materials; material; material = material->Next() ) + { + if( material->m_Name == mat_name ) + { + + wxString vrml_material; + vrml_material.Append( wxString::Format( wxT( "specularColor %f %f %f\n"), + material->m_SpecularColor.x, + material->m_SpecularColor.y, + material->m_SpecularColor.z) ); + + vrml_material.Append( wxString::Format( wxT( "diffuseColor %f %f %f\n"), + material->m_DiffuseColor.x, + material->m_DiffuseColor.y, + material->m_DiffuseColor.z) ); + + vrml_material.Append( wxString::Format( wxT( "emissiveColor %f %f %f\n"), + material->m_EmissiveColor.x, + material->m_EmissiveColor.y, + material->m_EmissiveColor.z) ); + + vrml_material.Append( wxString::Format( wxT( "ambientIntensity %f\n"), + material->m_AmbientIntensity) ); + + vrml_material.Append( wxString::Format( wxT( "shininess %f\n"), + material->m_Shininess) ); + + vrml_material.Append( wxString::Format( wxT( "transparency %f\n"), + material->m_Transparency) ); + + vrml_materials.push_back(vrml_material); + + + material->SetMaterial(); + return; + } + } + + D( printf( "ReadMaterial error: material not found\n" ) ); + + } +} + +bool X3D_MODEL_PARSER::parseDoubleTriplet( const wxString& aData, + S3D_VERTEX& aResult ) +{ + wxStringTokenizer tokens(aData); + return tokens.GetNextToken().ToDouble( &aResult.x ) && + tokens.GetNextToken().ToDouble( &aResult.y ) && + tokens.GetNextToken().ToDouble( &aResult.z ); +} + + +void X3D_MODEL_PARSER::rotate( S3D_VERTEX& aV, + S3D_VERTEX& aU, + double angle) +{ + S3D_VERTEX rotated; + double C = cos(angle); + double S = sin(angle); + double t = 1.0 - C; + + rotated.x = ( t * aU.x * aU.x + C ) * aV.x + + ( t * aU.x * aU.y - S * aU.z ) * aV.y + + ( t * aU.x * aU.z + S * aU.y ) * aV.z; + + rotated.y = ( t * aU.x * aU.y + S * aU.z ) * aV.x + + ( t * aU.y * aU.y + C ) * aV.y + + ( t * aU.y * aU.z - S * aU.x ) * aV.z; + + rotated.z = ( t * aU.x * aU.z - S * aU.y ) * aV.x + + ( t * aU.y * aU.z + S * aU.x ) * aV.y + + ( t * aU.z * aU.z + C) * aV.z; + + aV.x = rotated.x; + aV.y = rotated.y; + aV.z = rotated.z; +} + +/* Steps: + * 1. Read transform data + * 2. Read vectex triplets + * 3. Read coordinate indexes + * 4. Apply geometry to Master object + */ +void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode, + PROPERTY_MAP& aTransformProps) +{ + /* Step 1: Read transform data + * --------------------------- */ + + S3D_VERTEX translation; + parseDoubleTriplet( aTransformProps[ wxT( "translation" ) ], + translation ); + + S3D_VERTEX scale; + parseDoubleTriplet( aTransformProps[ wxT( "scale" ) ], scale ); + + S3D_VERTEX rotation; + double angle = 0.0; + wxStringTokenizer tokens(aTransformProps[ wxT( "rotation" ) ]); + if( !(tokens.GetNextToken().ToDouble( &rotation.x ) && + tokens.GetNextToken().ToDouble( &rotation.y ) && + tokens.GetNextToken().ToDouble( &rotation.z ) && + tokens.GetNextToken().ToDouble( &angle ) ) ) + { + D( printf("rotation read error") ); + } + + double vrmlunits_to_3Dunits = g_Parm_3D_Visu.m_BiuTo3Dunits * + UNITS3D_TO_UNITSPCB; + + /* Step 2: Read all coordinate points + * ---------------------------- */ + std::vector< double > points; + NODE_LIST coordinates; + GetChildsByName( aFaceNode, wxT( "Coordinate" ), coordinates); + + PROPERTY_MAP coordinate_properties; + // IndexedFaceSet has one Coordinate child node + GetNodeProperties( coordinates[0], coordinate_properties ); + + // Save points to vector as doubles + wxStringTokenizer point_tokens( coordinate_properties[ wxT("point") ] ); + double point = 0.0; + while( point_tokens.HasMoreTokens() ) + { + if( point_tokens.GetNextToken().ToDouble( &point ) ) + { + points.push_back( point ); + } + else + { + wxLogError( wxT( "Error converting to double" ) ); + } + } + + if(points.size() % 3 != 0) { + D( printf("Number of points is incorrect") ); + return; + } + + /* Create 3D vertex from 3 points and + * apply tansforms in order of SCALE, ROTATION, TRANSLATION + */ + wxString vrml_pointlist; + std::vector< S3D_VERTEX > triplets; + for( unsigned id = 0; id < points.size() / 3; id++ ) + { + int triplet_indx = id * 3; + S3D_VERTEX point( points[ triplet_indx ], + points[ triplet_indx + 1 ], + points[ triplet_indx + 2 ] ); + + point.x *= scale.x; + point.y *= scale.y; + point.z *= scale.z; + + rotate(point, rotation, angle); + + point.x += translation.x; + point.y += translation.y; + point.z += translation.z; + + triplets.push_back(point); + + // VRML + vrml_pointlist.Append( wxString::Format(wxT("%f %f %f\n"), point.x, point.y, point.z) ); + } + vrml_points.push_back(vrml_pointlist); + + /* -- Read coordinate indexes -- */ + PROPERTY_MAP faceset_properties; + GetNodeProperties( aFaceNode, faceset_properties ); + + std::vector< S3D_VERTEX > vertices; + std::vector< int > coordIndex; + + wxString coordIndex_str = faceset_properties[ wxT( "coordIndex" ) ]; + wxStringTokenizer index_tokens( coordIndex_str ); + + wxString vrml_coord_indx_list; + while( index_tokens.HasMoreTokens() ) + { + long index = 0; + index_tokens.GetNextToken().ToLong(&index); + + // -1 marks the end of polygon + if( index < 0 ) + { + /* Step 4: Apply geometry to Master object + * --------------------------------------- */ + std::vector::const_iterator id; + for( id = coordIndex.begin(); + id != coordIndex.end(); + id++ ) + { + vertices.push_back( triplets.at(*id) ); + } + + GetMaster()->Set_Object_Coords( vertices ); + Set_Object_Data( vertices, vrmlunits_to_3Dunits ); + + vertices.clear(); + coordIndex.clear(); + vrml_coord_indx_list.Append( wxT("-1\n") ); + } + else + { + coordIndex.push_back( index ); + vrml_coord_indx_list.Append( wxString::Format(wxT("%u "), index) ); + } + } + vrml_coord_indexes.push_back(vrml_coord_indx_list); +} + diff --git a/common/class_page_info.cpp b/common/class_page_info.cpp index e7c111213d..9e61f04365 100644 --- a/common/class_page_info.cpp +++ b/common/class_page_info.cpp @@ -330,8 +330,8 @@ void PAGE_INFO::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aContro GetCustomWidthMils() * 25.4 / 1000.0, GetCustomHeightMils() * 25.4 / 1000.0 ); - if( IsCustom() && IsPortrait() ) - aFormatter->Print( 0, " portrait" ); + if( IsPortrait() ) + aFormatter->Print( 0, " portrait" ); aFormatter->Print( 0, ")\n" ); } diff --git a/common/wildcards_and_files_ext.cpp b/common/wildcards_and_files_ext.cpp index 0d0333b84e..2a09e046fb 100644 --- a/common/wildcards_and_files_ext.cpp +++ b/common/wildcards_and_files_ext.cpp @@ -95,4 +95,4 @@ const wxString PdfFileWildcard( _( "Portable document format files (*.pdf)|*.pdf const wxString PSFileWildcard( _( "PostScript files (.ps)|*.ps" ) ); const wxString ReportFileWildcard = _( "Report files (*.rpt)|*.rpt" ); const wxString FootprintPlaceFileWildcard = _( "Footprint place files (*.pos)|*.pos" ); -const wxString VrmlFileWildcard( _( "Vrml files (*.wrl)|*.wrl" ) ); +const wxString Shapes3DFileWildcard( _( "Vrml and x3d files (*.wrl *.x3d)|*.wrl;*.x3d" ) ); diff --git a/eeschema/dialogs/dialog_build_BOM.cpp b/eeschema/dialogs/dialog_build_BOM.cpp index 224ba98b87..eac045fc38 100644 --- a/eeschema/dialogs/dialog_build_BOM.cpp +++ b/eeschema/dialogs/dialog_build_BOM.cpp @@ -481,7 +481,7 @@ void DIALOG_BUILD_BOM::CreateSpreadSheetPartsShortList( ) bom_lister.SetCvsFormOn( s_ExportSeparatorSymbol ); // Set the list of fields to add to list - for( int ii = FOOTPRINT; ii < FIELD8; ii++ ) + for( int ii = FOOTPRINT; ii <= FIELD8; ii++ ) if( IsFieldChecked( ii ) ) bom_lister.AddFieldIdToPrintList( ii ); // Write the list of components grouped by values: @@ -530,7 +530,7 @@ void DIALOG_BUILD_BOM::CreateSpreadSheetPartsFullList( bool aIncludeSubComponent aIncludeSubComponents ); // Set the list of fields to add to list - for( int ii = FOOTPRINT; ii < FIELD8; ii++ ) + for( int ii = FOOTPRINT; ii <= FIELD8; ii++ ) if( IsFieldChecked( ii ) ) bom_lister.AddFieldIdToPrintList( ii ); @@ -564,7 +564,7 @@ void DIALOG_BUILD_BOM::CreatePartsAndLabelsFullList( bool aIncludeSubComponents bom_lister.SetCvsFormOff(); bom_lister.SetPrintLocation( s_Add_Location ); // Set the list of fields to add to list - for( int ii = FOOTPRINT; ii < FIELD8; ii++ ) + for( int ii = FOOTPRINT; ii <= FIELD8; ii++ ) if( IsFieldChecked( ii ) ) bom_lister.AddFieldIdToPrintList( ii ); diff --git a/include/wildcards_and_files_ext.h b/include/wildcards_and_files_ext.h index 4408ae09d3..9f1368eabb 100644 --- a/include/wildcards_and_files_ext.h +++ b/include/wildcards_and_files_ext.h @@ -91,7 +91,7 @@ extern const wxString DrillFileWildcard; extern const wxString SVGFileWildcard; extern const wxString ReportFileWildcard; extern const wxString FootprintPlaceFileWildcard; -extern const wxString VrmlFileWildcard; +extern const wxString Shapes3DFileWildcard; extern const wxString DocModulesFileName; extern const wxString LegacyFootprintLibPathWildcard; extern const wxString KiCadFootprintLibFileWildcard; diff --git a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp index 6f00d9ee68..c5a14ca726 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp @@ -431,17 +431,18 @@ void DIALOG_MODULE_BOARD_EDITOR::Browse3DLib( wxCommandEvent& event ) #ifdef __WINDOWS__ fullpath.Replace( wxT( "/" ), wxT( "\\" ) ); #endif + fullfilename = EDA_FileSelector( _( "3D Shape:" ), fullpath, wxEmptyString, - VrmlFileExtension, - wxGetTranslation( VrmlFileWildcard ), + wxEmptyString, + wxGetTranslation( Shapes3DFileWildcard ), this, wxFD_OPEN, true ); - if( fullfilename == wxEmptyString ) + if( fullfilename.IsEmpty() ) return; wxFileName fn = fullfilename; diff --git a/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp b/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp index d11bd5f277..811607e3ce 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp @@ -302,17 +302,18 @@ void DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DLib( wxCommandEvent& event ) #ifdef __WINDOWS__ fullpath.Replace( wxT( "/" ), wxT( "\\" ) ); #endif + fullfilename = EDA_FileSelector( _( "3D Shape:" ), fullpath, wxEmptyString, - VrmlFileExtension, - wxGetTranslation( VrmlFileWildcard ), + wxEmptyString, + wxGetTranslation( Shapes3DFileWildcard ), this, wxFD_OPEN, true ); - if( fullfilename == wxEmptyString ) + if( fullfilename.IsEmpty() ) return; wxFileName fn = fullfilename; diff --git a/pcbnew/dialogs/dialog_gendrill_base.cpp b/pcbnew/dialogs/dialog_gendrill_base.cpp index 69efb248ed..59f9bb910f 100644 --- a/pcbnew/dialogs/dialog_gendrill_base.cpp +++ b/pcbnew/dialogs/dialog_gendrill_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 10 2012) +// C++ code generated with wxFormBuilder (version Oct 8 2012) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -23,6 +23,7 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con bdirnameSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Output directory:") ), wxHORIZONTAL ); m_outputDirectoryName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_outputDirectoryName->SetMaxLength( 0 ); bdirnameSizer->Add( m_outputDirectoryName, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); m_buttonBrowse = new wxButton( this, wxID_ANY, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 ); @@ -79,7 +80,7 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con bMiddleBoxSizer->Add( m_Choice_Drill_Map, 0, wxALL|wxEXPAND, 5 ); wxStaticBoxSizer* sbOptSizer; - sbOptSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options:") ), wxVERTICAL ); + sbOptSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Drill File Options:") ), wxVERTICAL ); m_Check_Mirror = new wxCheckBox( this, wxID_ANY, _("Mirror y axis"), wxDefaultPosition, wxDefaultSize, 0 ); sbOptSizer->Add( m_Check_Mirror, 0, wxRIGHT|wxLEFT, 5 ); @@ -163,7 +164,7 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con bSizerButtons->Add( 10, 20, 0, 0, 5 ); - m_buttonDrill = new wxButton( this, ID_GEN_DRILL_FILE, _("Drill Fille"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonDrill = new wxButton( this, ID_GEN_DRILL_FILE, _("Drill File"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonDrill->SetDefault(); bSizerButtons->Add( m_buttonDrill, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); @@ -186,6 +187,7 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con bmsgSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Messages:") ), wxVERTICAL ); m_messagesBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY ); + m_messagesBox->SetMaxLength( 0 ); m_messagesBox->SetMinSize( wxSize( -1,90 ) ); bmsgSizer->Add( m_messagesBox, 1, wxALL|wxEXPAND, 5 ); diff --git a/pcbnew/dialogs/dialog_gendrill_base.fbp b/pcbnew/dialogs/dialog_gendrill_base.fbp index ca554b9996..1f53eb1c23 100644 --- a/pcbnew/dialogs/dialog_gendrill_base.fbp +++ b/pcbnew/dialogs/dialog_gendrill_base.fbp @@ -697,7 +697,7 @@ 0 wxID_ANY - Options: + Drill File Options: sbOptSizer wxVERTICAL @@ -1673,7 +1673,7 @@ 0 0 ID_GEN_DRILL_FILE - Drill Fille + Drill File 0 diff --git a/pcbnew/dialogs/dialog_gendrill_base.h b/pcbnew/dialogs/dialog_gendrill_base.h index a3b9680676..a71232832d 100644 --- a/pcbnew/dialogs/dialog_gendrill_base.h +++ b/pcbnew/dialogs/dialog_gendrill_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 10 2012) +// C++ code generated with wxFormBuilder (version Oct 8 2012) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -11,6 +11,8 @@ #include #include #include +class DIALOG_SHIM; + #include "dialog_shim.h" #include #include diff --git a/pcbnew/export_vrml.cpp b/pcbnew/export_vrml.cpp index 1aea2044cf..7ccbd48081 100755 --- a/pcbnew/export_vrml.cpp +++ b/pcbnew/export_vrml.cpp @@ -40,6 +40,8 @@ #include #include +#include "../3d-viewer/modelparsers.h" + #include #include @@ -1149,11 +1151,28 @@ static void export_vrml_module( BOARD* aPcb, MODULE* aModule, vrmlm->m_MatScale.y * aVRMLModelsToBiu, vrmlm->m_MatScale.z * aVRMLModelsToBiu ); - fprintf( aOutputFile, -// " children [\n Inline {\n url \"file://%s\"\n } ]\n", - " children [\n Inline {\n url \"%s\"\n } ]\n", - TO_UTF8( fname ) ); - fprintf( aOutputFile, " }\n" ); + if( fname.EndsWith( wxT( "x3d" ) ) ) + { + X3D_MODEL_PARSER* parser = new X3D_MODEL_PARSER(vrmlm); + + if(parser) + { + // embed x3d model in vrml format + parser->Load(fname); + fprintf( aOutputFile, + " children [\n %s ]\n", TO_UTF8( parser->VRML_representation() ) ); + fprintf( aOutputFile, " }\n" ); + delete parser; + } + } + else + { + fprintf( aOutputFile, + " children [\n Inline {\n url \"%s\"\n } ]\n", + TO_UTF8( fname ) ); + fprintf( aOutputFile, " }\n" ); + } + } } From e90fc3a9b24c5505b9cb412dc7925d646956e047 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 27 Mar 2013 20:36:10 +0100 Subject: [PATCH 13/63] Better fix for bug #1155888 --- common/class_page_info.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/class_page_info.cpp b/common/class_page_info.cpp index 9e61f04365..1166ad89c6 100644 --- a/common/class_page_info.cpp +++ b/common/class_page_info.cpp @@ -330,8 +330,8 @@ void PAGE_INFO::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aContro GetCustomWidthMils() * 25.4 / 1000.0, GetCustomHeightMils() * 25.4 / 1000.0 ); - if( IsPortrait() ) - aFormatter->Print( 0, " portrait" ); + if( !IsCustom() && IsPortrait() ) + aFormatter->Print( 0, " portrait" ); aFormatter->Print( 0, ")\n" ); } From 5a5b90984a66e078d881b8fb6fcd424203e2a079 Mon Sep 17 00:00:00 2001 From: Andrey Fedorushkov Date: Thu, 28 Mar 2013 00:38:20 +0400 Subject: [PATCH 14/63] all: new Russian GOST patch - author Konstantin Baranovskiy pcbnew: fix print format in THROW_IO_ERROR fix properties file export_vrml.cpp --- common/common_plot_functions.cpp | 763 +++++--- common/dialogs/dialog_page_settings.cpp | 10 +- common/drawtxt.cpp | 65 +- common/newstroke_font.cpp | 2 +- common/worksheet.cpp | 2246 ++++++++++++---------- eeschema/component_references_lister.cpp | 28 + eeschema/lib_pin.h | 2 +- eeschema/libeditframe.cpp | 4 + eeschema/sch_junction.cpp | 4 + include/worksheet.h | 274 ++- pcbnew/export_vrml.cpp | 0 pcbnew/gpcb_plugin.cpp | 2 +- pcbnew/kicad_plugin.cpp | 2 +- 13 files changed, 1973 insertions(+), 1429 deletions(-) mode change 100755 => 100644 pcbnew/export_vrml.cpp diff --git a/common/common_plot_functions.cpp b/common/common_plot_functions.cpp index 334cbd18f0..6f8b3bc139 100644 --- a/common/common_plot_functions.cpp +++ b/common/common_plot_functions.cpp @@ -59,17 +59,12 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, int iusPerMil = plotter->GetIUsPerDecimil() * 10; wxSize pageSize = aPageInfo.GetSizeMils(); // in mils int xg, yg; - wxPoint pos, ref; + int refx, refy; + wxPoint pos, end, ref; wxString msg; wxSize text_size; -#if defined(KICAD_GOST) - wxSize text_size2; - wxSize text_size3; - wxSize text_size1_5; -#else int UpperLimit = VARIABLE_BLOCK_START_POSITION; -#endif EDA_COLOR_T plotClr; plotClr = plotter->GetColorMode() ? RED : BLACK; @@ -84,6 +79,19 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, yg = ( pageSize.y - aPageInfo.GetBottomMarginMils() ) * iusPerMil; #if defined(KICAD_GOST) + + int lnMsg, ln; + text_size.x = SIZETEXT * iusPerMil; + text_size.y = SIZETEXT * iusPerMil; + wxSize sz; + wxSize text_size0_8( SIZETEXT * iusPerMil * 0.8, SIZETEXT * iusPerMil * 1 ); + wxSize text_size1_5( SIZETEXT * iusPerMil * 1.5, SIZETEXT * iusPerMil * 1.5 ); + wxSize text_size2( SIZETEXT * iusPerMil * 2, SIZETEXT * iusPerMil * 2 ); + wxSize text_size3( SIZETEXT * iusPerMil * 3, SIZETEXT * iusPerMil * 3 ); + int lineOsn_widht = plotter->GetCurrentLineWidth() * 2; + int lineTonk_widht = plotter->GetCurrentLineWidth(); + + plotter->SetCurrentLineWidth( lineOsn_widht ); plotter->MoveTo( ref ); pos.x = xg; pos.y = ref.y; @@ -95,6 +103,7 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, pos.y = yg; plotter->LineTo( pos ); plotter->FinishTo( ref ); + plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH ); #else @@ -125,9 +134,6 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, #endif - text_size.x = WSTEXTSIZE * iusPerMil; - text_size.y = WSTEXTSIZE * iusPerMil; - // upper left corner in mils ref.x = aPageInfo.GetLeftMarginMils(); ref.y = aPageInfo.GetTopMarginMils(); @@ -137,56 +143,516 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, yg = ( pageSize.y - aPageInfo.GetBottomMarginMils() ); #if defined(KICAD_GOST) - for( Ki_WorkSheetData* WsItem = &WS_Segm1_LU; + + // Lower right corner + refx = xg; + refy = yg; + + // First page + if( aSheetNumber == 1 ) + { + for( Ki_WorkSheetData* WsItem = &WS_Osn1_Line1; + WsItem != NULL; + WsItem = WsItem->Pnext ) + { + pos.x = (refx - WsItem->m_Posx) * iusPerMil; + pos.y = (refy - WsItem->m_Posy) * iusPerMil; + end.x = (refx - WsItem->m_Endx) * iusPerMil; + end.y = (refy - WsItem->m_Endy) * iusPerMil; + msg = WsItem->m_Legende; + switch( WsItem->m_Type ) + { + case WS_OSN: + plotter->SetCurrentLineWidth( lineOsn_widht ); + plotter->MoveTo( pos ); + plotter->FinishTo( end ); + plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH ); + break; + + case WS_TONK: + plotter->SetCurrentLineWidth( lineTonk_widht ); + plotter->MoveTo( pos ); + plotter->FinishTo( end ); + plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH ); + break; + + case WS_TEXT: + if( !msg.IsEmpty() ) + { + if( WsItem == &WS_Osn1_Text1 ) + plotter->Text( pos, plotClr, + msg, TEXT_ORIENT_HORIZ, text_size0_8, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, + PLOTTER::DEFAULT_LINE_WIDTH, false, false ); + else + plotter->Text( pos, plotClr, + msg, TEXT_ORIENT_HORIZ, text_size, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, + PLOTTER::DEFAULT_LINE_WIDTH, false, false ); + } + break; + + case WS_TEXTL: + if( !msg.IsEmpty() ) + plotter->Text( pos, plotClr, + msg, TEXT_ORIENT_HORIZ, text_size, + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, + PLOTTER::DEFAULT_LINE_WIDTH, false, false ); + break; + + } + } + + // Sheet number + if( aNumberOfSheets > 1 ) + { + pos.x = (refx - Mm2mils( 36 )) * iusPerMil; + pos.y = (refy - Mm2mils( 17.5 )) * iusPerMil; + msg.Empty(); + msg << aSheetNumber; + plotter->Text( pos, plotClr, + msg, TEXT_ORIENT_HORIZ, text_size, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, + PLOTTER::DEFAULT_LINE_WIDTH, false, false ); + } + + // Count of sheets + pos.x = (refx - Mm2mils( 10 )) * iusPerMil; + pos.y = (refy - Mm2mils( 17.5 )) * iusPerMil; + msg.Empty(); + msg << aNumberOfSheets; + plotter->Text( pos, plotClr, + msg, TEXT_ORIENT_HORIZ, text_size, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, + PLOTTER::DEFAULT_LINE_WIDTH, false, false ); + + // Company name + msg = aTitleBlock.GetCompany(); + if( !msg.IsEmpty() ) + { + sz = text_size1_5; + lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil; + ln = Mm2mils( 49 ); + if( lnMsg > ln ) + sz.x *= float( ln ) / lnMsg; + pos.x = (refx - Mm2mils( 25 )) * iusPerMil; + pos.y = (refy - Mm2mils( 7.5 )) * iusPerMil; + plotter->Text( pos, plotClr, + msg, TEXT_ORIENT_HORIZ, sz, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, + PLOTTER::DEFAULT_LINE_WIDTH, false, false ); + } + + // Title + msg = aTitleBlock.GetTitle(); + if( !msg.IsEmpty() ) + { + sz = text_size1_5; + wxArrayString lines; + int titleWidth = 0; + int titleHeight = (sz.y + sz.y * 0.5) / iusPerMil; + int titleFieldWidth = Mm2mils( 69 ); + int titleFieldHeight = Mm2mils( 24 ); + int index = 0; + wxString fullMsg = msg; + do // Reduce the height of wrapped title until the fit + { + do // Wrap the title + { + titleWidth = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil; + if( titleWidth > titleFieldWidth ) + { + index = 0; + do + { + msg = msg.Left( msg.Length() - 1 ); + if( msg.Length() == 0 ) + { + lines.Clear(); + msg = fullMsg; + sz.x -= iusPerMil; + break; + } + else + { + index++; + titleWidth = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil; + + wxString ch = wxString( msg.Last() ); + if( titleWidth < titleFieldWidth && ch == wxT( " " ) ) + { + // New sentence on a new line + int dot = msg.Index( wxT( ". " ) ); + if( dot != wxNOT_FOUND ) + { + index += msg.Length() - dot - 2; + msg = msg.Left( dot + 1 ); + lines.Add( msg ); + msg = fullMsg.Right( index ); + break; + } + else + { + msg = msg.Left( msg.Length() - 1 ); + lines.Add( msg ); + msg = fullMsg.Right( index ); + break; + } + } + } + }while( 1 ); + } + else + { + // New sentence on a new line + int dot = msg.Index( wxT( ". " ) ); + if( dot != wxNOT_FOUND ) + { + lines.Add( msg.Left( dot + 1 ) ); + lines.Add( fullMsg.Right( msg.Length() - dot - 2 ) ); + } + else + lines.Add( msg ); + break; + } + }while( 1 ); + + if( titleFieldHeight < titleHeight * lines.Count() ) + { + sz.y -= iusPerMil; + sz.x -= iusPerMil; + msg = fullMsg; + lines.Clear(); + } + else + break; + }while( 1 ); + + pos.x = (refx - Mm2mils( 85 )) * iusPerMil; + pos.y = (refy - Mm2mils( 27.5 ) - (titleHeight * (lines.Count() - 1) / 2)) * iusPerMil; + + for( int curLn = 0; curLn < lines.Count(); curLn++ ) + { + msg = lines[curLn]; + plotter->Text( pos, plotClr, + msg, TEXT_ORIENT_HORIZ, sz, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, + PLOTTER::DEFAULT_LINE_WIDTH, false, false ); + pos.y += titleHeight * iusPerMil; + } + } + + // Decimal number + msg = aTitleBlock.GetComment1(); + if( !msg.IsEmpty() ) + { + sz = text_size3; + lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil; + ln = Mm2mils( 119 ); + if( lnMsg > ln ) + sz.x *= float( ln ) / lnMsg; + pos.x = (refx - Mm2mils( 60 )) * iusPerMil; + pos.y = (refy - Mm2mils( 47.5 )) * iusPerMil; + plotter->Text( pos, plotClr, + msg, TEXT_ORIENT_HORIZ, sz, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, + PLOTTER::DEFAULT_LINE_WIDTH, false, false ); + } + + // Developer + msg = aTitleBlock.GetComment2(); + if( !msg.IsEmpty() ) + { + sz = text_size; + lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil; + ln = Mm2mils( 22 ); + if( lnMsg > ln ) + sz.x *= float( ln ) / lnMsg; + pos.x = (refx - Mm2mils( 167.5 )) * iusPerMil; + pos.y = (refy - Mm2mils( 27.5 )) * iusPerMil; + plotter->Text( pos, plotClr, + msg, TEXT_ORIENT_HORIZ, sz, + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, + PLOTTER::DEFAULT_LINE_WIDTH, false, false ); + } + + // Verifier + msg = aTitleBlock.GetComment3(); + if( !msg.IsEmpty() ) + { + sz = text_size; + lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil; + ln = Mm2mils( 22 ); + if( lnMsg > ln ) + sz.x *= float( ln ) / lnMsg; + pos.x = (refx - Mm2mils( 167.5 )) * iusPerMil; + pos.y = (refy - Mm2mils( 22.5 )) * iusPerMil; + plotter->Text( pos, plotClr, + msg, TEXT_ORIENT_HORIZ, sz, + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, + PLOTTER::DEFAULT_LINE_WIDTH, false, false ); + } + + // Approver + msg = aTitleBlock.GetComment4(); + if( !msg.IsEmpty() ) + { + sz = text_size; + lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil; + ln = Mm2mils( 22 ); + if( lnMsg > ln ) + sz.x *= float( ln ) / lnMsg; + pos.x = (refx - Mm2mils( 167.5 )) * iusPerMil; + pos.y = (refy - Mm2mils( 2.5 )) * iusPerMil; + plotter->Text( pos, plotClr, + msg, TEXT_ORIENT_HORIZ, sz, + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, + PLOTTER::DEFAULT_LINE_WIDTH, false, false ); + } + } + else // other pages + { + for( Ki_WorkSheetData* WsItem = &WS_Osn2a_Line1; + WsItem != NULL; + WsItem = WsItem->Pnext ) + { + pos.x = (refx - WsItem->m_Posx) * iusPerMil; + pos.y = (refy - WsItem->m_Posy) * iusPerMil; + end.x = (refx - WsItem->m_Endx) * iusPerMil; + end.y = (refy - WsItem->m_Endy) * iusPerMil; + msg = WsItem->m_Legende; + switch( WsItem->m_Type ) + { + case WS_OSN: + plotter->SetCurrentLineWidth( lineOsn_widht ); + plotter->MoveTo( pos ); + plotter->FinishTo( end ); + plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH ); + break; + + case WS_TONK: + plotter->SetCurrentLineWidth( lineTonk_widht ); + plotter->MoveTo( pos ); + plotter->FinishTo( end ); + plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH ); + break; + + case WS_TEXT: + if( !msg.IsEmpty() ) + { + if( WsItem == &WS_Osn2a_Text1 ) + plotter->Text( pos, plotClr, + msg, TEXT_ORIENT_HORIZ, text_size0_8, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, + PLOTTER::DEFAULT_LINE_WIDTH, false, false ); + else + plotter->Text( pos, plotClr, + msg, TEXT_ORIENT_HORIZ, text_size, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, + PLOTTER::DEFAULT_LINE_WIDTH, false, false ); + } + break; + + case WS_TEXTL: + if( !msg.IsEmpty() ) + plotter->Text( pos, plotClr, + msg, TEXT_ORIENT_HORIZ, text_size, + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, + PLOTTER::DEFAULT_LINE_WIDTH, false, false ); + break; + } + } + + // Sheet number + pos.x = (refx - Mm2mils( 5 )) * iusPerMil; + pos.y = (refy - Mm2mils( 4 )) * iusPerMil; + msg.Empty(); + msg << aSheetNumber; + plotter->Text( pos, plotClr, + msg, TEXT_ORIENT_HORIZ, text_size, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, + PLOTTER::DEFAULT_LINE_WIDTH, false, false ); + + // Decimal number + msg = aTitleBlock.GetComment1(); + if( !msg.IsEmpty() ) + { + sz = text_size3; + lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil; + ln = Mm2mils( 109 ); + if( lnMsg > ln ) + sz.x *= float( ln ) / lnMsg; + pos.x = (refx - Mm2mils( 65 )) * iusPerMil; + pos.y = (refy - Mm2mils( 7.5 )) * iusPerMil; + plotter->Text( pos, plotClr, + msg, TEXT_ORIENT_HORIZ, sz, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, + PLOTTER::DEFAULT_LINE_WIDTH, false, false ); + } + } + + // Format + pos.x = (refx - Mm2mils( 23 )) * iusPerMil; + pos.y = (refy + Mm2mils( 2.5 )) * iusPerMil; + msg.Empty(); + msg << aPageInfo.GetType(); + plotter->Text( pos, plotClr, + msg, TEXT_ORIENT_HORIZ, text_size, + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, + PLOTTER::DEFAULT_LINE_WIDTH, false, false ); + + // Lower left corner + refx = ref.x; + refy = yg; + for( Ki_WorkSheetData* WsItem = &WS_DopLeft_Line1; WsItem != NULL; WsItem = WsItem->Pnext ) { - pos.x = ( ref.x - WsItem->m_Posx ) * iusPerMil; - pos.y = ( yg - WsItem->m_Posy ) * iusPerMil; - msg.Empty(); + if( aSheetNumber > 1 && WsItem == &WS_DopLeft_Line9 ) // Some fields for first page only + break; + + pos.x = (refx - WsItem->m_Posx) * iusPerMil; + pos.y = (refy - WsItem->m_Posy) * iusPerMil; + end.x = (refx - WsItem->m_Endx) * iusPerMil; + end.y = (refy - WsItem->m_Endy) * iusPerMil; + msg = WsItem->m_Legende; switch( WsItem->m_Type ) { - case WS_CADRE: - break; - - case WS_PODPIS_LU: - if( WsItem->m_Legende ) - msg = WsItem->m_Legende; - plotter->Text( pos, plotClr, - msg, TEXT_ORIENT_VERT, text_size, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, - PLOTTER::DEFAULT_LINE_WIDTH, false, false ); - break; - - case WS_SEGMENT_LU: + case WS_OSN: + plotter->SetCurrentLineWidth( lineOsn_widht ); plotter->MoveTo( pos ); - pos.x = ( ref.x - WsItem->m_Endx ) * iusPerMil; - pos.y = ( yg - WsItem->m_Endy ) * iusPerMil; - plotter->FinishTo( pos ); + plotter->FinishTo( end ); + plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH ); + break; + + case WS_TONK: + plotter->SetCurrentLineWidth( lineTonk_widht ); + plotter->MoveTo( pos ); + plotter->FinishTo( end ); + plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH ); + break; + + case WS_TEXT: + if( !msg.IsEmpty() ) + plotter->Text( pos, plotClr, + msg, TEXT_ORIENT_VERT, text_size, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, + PLOTTER::DEFAULT_LINE_WIDTH, false, false ); break; } } - for( Ki_WorkSheetData* WsItem = &WS_Segm1_LT; - WsItem != NULL; - WsItem = WsItem->Pnext ) + if( aPageInfo.GetType() == PAGE_INFO::A4 || !aPageInfo.IsPortrait() ) // A4 or Landscape { - pos.x = ( ref.x + WsItem->m_Posx ) * iusPerMil; - pos.y = ( ref.y + WsItem->m_Posy ) * iusPerMil; - msg.Empty(); - switch( WsItem->m_Type ) + // Left Top corner + refx = ref.x; + refy = ref.y; + for( Ki_WorkSheetData* WsItem = &WS_DopTop_Line1; + WsItem != NULL; + WsItem = WsItem->Pnext ) { - case WS_SEGMENT_LT: - plotter->MoveTo( pos ); - pos.x = ( ref.x + WsItem->m_Endx ) * iusPerMil; - pos.y = ( ref.y + WsItem->m_Endy ) * iusPerMil; - plotter->FinishTo( pos ); - break; + if( aSheetNumber > 1 && WsItem == &WS_DopTop_Line3 )// Some fields for first page only + break; + + pos.x = (refx + WsItem->m_Posx) * iusPerMil; + pos.y = (refy + WsItem->m_Posy) * iusPerMil; + end.x = (refx + WsItem->m_Endx) * iusPerMil; + end.y = (refy + WsItem->m_Endy) * iusPerMil; + msg = WsItem->m_Legende; + switch( WsItem->m_Type ) + { + case WS_OSN: + plotter->SetCurrentLineWidth( lineOsn_widht ); + plotter->MoveTo( pos ); + plotter->FinishTo( end ); + plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH ); + break; + + case WS_TONK: + plotter->SetCurrentLineWidth( lineTonk_widht ); + plotter->MoveTo( pos ); + plotter->FinishTo( end ); + plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH ); + break; + } + } + + // Decimal number + msg = aTitleBlock.GetComment1(); + if( !msg.IsEmpty() ) + { + sz = text_size2; + lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil; + ln = Mm2mils( 69 ); + if( lnMsg > ln ) + sz.x *= float( ln ) / lnMsg; + pos.x = (refx + Mm2mils( 35 )) * iusPerMil; + pos.y = (refy + Mm2mils( 7 )) * iusPerMil; + plotter->Text( pos, plotClr, + msg, 1800, sz, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, + PLOTTER::DEFAULT_LINE_WIDTH, false, false ); + } + } + else // Portrait + { + // Right Top corner + // Lines are used from the upper left corner by the change of coordinates + refx = xg; + refy = ref.y; + for( Ki_WorkSheetData* WsItem = &WS_DopTop_Line1; + WsItem != NULL; + WsItem = WsItem->Pnext ) + { + if( aSheetNumber > 1 && WsItem == &WS_DopTop_Line3 )// Some fields for first page only + break; + + pos.x = (refx - WsItem->m_Posy) * iusPerMil; + pos.y = (refy + WsItem->m_Posx) * iusPerMil; + end.x = (refx - WsItem->m_Endy) * iusPerMil; + end.y = (refy + WsItem->m_Endx) * iusPerMil; + msg = WsItem->m_Legende; + switch( WsItem->m_Type ) + { + case WS_OSN: + plotter->SetCurrentLineWidth( lineOsn_widht ); + plotter->MoveTo( pos ); + plotter->FinishTo( end ); + plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH ); + break; + + case WS_TONK: + plotter->SetCurrentLineWidth( lineTonk_widht ); + plotter->MoveTo( pos ); + plotter->FinishTo( end ); + plotter->SetCurrentLineWidth( PLOTTER::DEFAULT_LINE_WIDTH ); + break; + } + } + + // Decimal number + msg = aTitleBlock.GetComment1(); + if( !msg.IsEmpty() ) + { + sz = text_size2; + lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / iusPerMil; + ln = Mm2mils( 69 ); + if( lnMsg > ln ) + sz.x *= float( ln ) / lnMsg; + pos.x = (refx - Mm2mils( 7 )) * iusPerMil; + pos.y = (refy + Mm2mils( 35 )) * iusPerMil; + plotter->Text( pos, plotClr, + msg, TEXT_ORIENT_VERT, sz, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, + PLOTTER::DEFAULT_LINE_WIDTH, false, false ); } } #else + text_size.x = WSTEXTSIZE * iusPerMil; + text_size.y = WSTEXTSIZE * iusPerMil; + // Plot legend along the X axis. int ipas = ( xg - ref.x ) / PAS_REF; int gxpas = ( xg - ref.x ) / ipas; @@ -271,220 +737,10 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, PLOTTER::DEFAULT_LINE_WIDTH, false, false ); } -#endif - // Plot the worksheet. text_size.x = SIZETEXT * iusPerMil; text_size.y = SIZETEXT * iusPerMil; -#if defined(KICAD_GOST) - text_size2.x = SIZETEXT * iusPerMil * 2; - text_size2.y = SIZETEXT * iusPerMil * 2; - text_size3.x = SIZETEXT * iusPerMil * 3; - text_size3.y = SIZETEXT * iusPerMil * 3; - text_size1_5.x = SIZETEXT * iusPerMil * 1.5; - text_size1_5.y = SIZETEXT * iusPerMil * 1.5; - - ref.x = pageSize.x - aPageInfo.GetRightMarginMils(); - ref.y = pageSize.y - aPageInfo.GetBottomMarginMils(); - - if( aSheetNumber == 1 ) - { - for( Ki_WorkSheetData* WsItem = &WS_Date; - WsItem != NULL; - WsItem = WsItem->Pnext ) - { - pos.x = ( ref.x - WsItem->m_Posx ) * iusPerMil; - pos.y = ( ref.y - WsItem->m_Posy ) * iusPerMil; - msg.Empty(); - - switch( WsItem->m_Type ) - { - case WS_DATE: - break; - - case WS_REV: - break; - - case WS_KICAD_VERSION: - break; - - case WS_PODPIS: - if( WsItem->m_Legende ) - msg = WsItem->m_Legende; - plotter->Text( pos, plotClr, - msg, TEXT_ORIENT_HORIZ, text_size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, - PLOTTER::DEFAULT_LINE_WIDTH, false, false ); - break; - - case WS_SIZESHEET: - break; - - case WS_IDENTSHEET: - if( WsItem->m_Legende ) - msg = WsItem->m_Legende; - if( aNumberOfSheets > 1 ) - msg << aSheetNumber; - plotter->Text( pos, plotClr, - msg, TEXT_ORIENT_HORIZ, text_size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, - PLOTTER::DEFAULT_LINE_WIDTH, false, false ); - break; - - case WS_SHEETS: - if( WsItem->m_Legende ) - msg = WsItem->m_Legende; - msg << aNumberOfSheets; - plotter->Text( pos, plotClr, - msg, TEXT_ORIENT_HORIZ, text_size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, - PLOTTER::DEFAULT_LINE_WIDTH, false, false ); - break; - - case WS_COMPANY_NAME: - msg = aTitleBlock.GetCompany(); - if( !msg.IsEmpty() ) - { - plotter->Text( pos, plotClr, - msg, TEXT_ORIENT_HORIZ, text_size1_5, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, - PLOTTER::DEFAULT_LINE_WIDTH, false, false ); - } - break; - - case WS_TITLE: - msg = aTitleBlock.GetTitle(); - if( !msg.IsEmpty() ) - { - plotter->Text( pos, plotClr, - msg, TEXT_ORIENT_HORIZ, text_size1_5, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, - PLOTTER::DEFAULT_LINE_WIDTH, false, false ); - } - break; - - case WS_COMMENT1: - msg = aTitleBlock.GetComment1(); - if( !msg.IsEmpty() ) - { - plotter->Text( pos, plotClr, - msg, TEXT_ORIENT_HORIZ, text_size3, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, - PLOTTER::DEFAULT_LINE_WIDTH, false, false ); - pos.x = (aPageInfo.GetLeftMarginMils() + 1260) * iusPerMil; - pos.y = (aPageInfo.GetTopMarginMils() + 270) * iusPerMil; - plotter->Text( pos, plotClr, - msg.GetData(), 1800, text_size2, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, - PLOTTER::DEFAULT_LINE_WIDTH, false, false ); - } - break; - - case WS_COMMENT2: - msg = aTitleBlock.GetComment2(); - if( !msg.IsEmpty() ) - { - plotter->Text( pos, plotClr, - msg, TEXT_ORIENT_HORIZ, text_size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, - PLOTTER::DEFAULT_LINE_WIDTH, false, false ); - } - break; - - case WS_COMMENT3: - msg = aTitleBlock.GetComment3(); - if( !msg.IsEmpty() ) - { - plotter->Text( pos, plotClr, - msg, TEXT_ORIENT_HORIZ, text_size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, - PLOTTER::DEFAULT_LINE_WIDTH, false, false ); - } - break; - - case WS_COMMENT4: - msg = aTitleBlock.GetComment4(); - if( !msg.IsEmpty() ) - { - plotter->Text( pos, plotClr, - msg, TEXT_ORIENT_HORIZ, text_size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, - PLOTTER::DEFAULT_LINE_WIDTH, false, false ); - } - break; - - case WS_UPPER_SEGMENT: - case WS_LEFT_SEGMENT: - case WS_SEGMENT: - plotter->MoveTo( pos ); - pos.x = ( ref.x - WsItem->m_Endx ) * iusPerMil; - pos.y = ( ref.y - WsItem->m_Endy ) * iusPerMil; - plotter->FinishTo( pos ); - break; - } - } - } - else - { - for( Ki_WorkSheetData* WsItem = &WS_CADRE_D; - WsItem != NULL; - WsItem = WsItem->Pnext ) - { - pos.x = ( ref.x - WsItem->m_Posx ) * iusPerMil; - pos.y = ( ref.y - WsItem->m_Posy ) * iusPerMil; - msg.Empty(); - - switch( WsItem->m_Type ) - { - case WS_CADRE: - // Begin list number > 1 - msg = aTitleBlock.GetComment1(); - if( !msg.IsEmpty() ) - { - plotter->Text( pos, plotClr, - msg, TEXT_ORIENT_HORIZ, text_size3, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, - PLOTTER::DEFAULT_LINE_WIDTH, false, false ); - pos.x = (aPageInfo.GetLeftMarginMils() + 1260) * iusPerMil; - pos.y = (aPageInfo.GetTopMarginMils() + 270) * iusPerMil; - plotter->Text( pos, plotClr, - msg, 1800, text_size2, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, - PLOTTER::DEFAULT_LINE_WIDTH, false, false ); - } - break; - - case WS_PODPIS_D: - if( WsItem->m_Legende ) - msg = WsItem->m_Legende; - plotter->Text( pos, plotClr, msg, TEXT_ORIENT_HORIZ, text_size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, - PLOTTER::DEFAULT_LINE_WIDTH, false, false ); - break; - - case WS_IDENTSHEET_D: - if( WsItem->m_Legende ) - msg = WsItem->m_Legende; - msg << aSheetNumber; - plotter->Text( pos, plotClr, msg, TEXT_ORIENT_HORIZ, text_size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, - PLOTTER::DEFAULT_LINE_WIDTH, false, false ); - break; - - case WS_LEFT_SEGMENT_D: - case WS_SEGMENT_D: - plotter->MoveTo( pos ); - pos.x = ( ref.x - WsItem->m_Endx ) * iusPerMil; - pos.y = ( ref.y - WsItem->m_Endy ) * iusPerMil; - plotter->FinishTo( pos ); - break; - } - } - } - -#else - ref.x = pageSize.x - GRID_REF_W - aPageInfo.GetRightMarginMils(); ref.y = pageSize.y - GRID_REF_W - aPageInfo.GetBottomMarginMils(); @@ -603,4 +859,5 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, } #endif + } diff --git a/common/dialogs/dialog_page_settings.cpp b/common/dialogs/dialog_page_settings.cpp index 3d5b7a16c4..a183d52698 100644 --- a/common/dialogs/dialog_page_settings.cpp +++ b/common/dialogs/dialog_page_settings.cpp @@ -609,12 +609,20 @@ void DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample() wxPoint pointLeftTop( pageDUMMY.GetLeftMarginMils(), pageDUMMY.GetTopMarginMils() ); wxPoint pointRightBottom( pageDUMMY.GetRightMarginMils(), pageDUMMY.GetBottomMarginMils() ); + // Get page type + int idx = m_paperSizeComboBox->GetSelection(); + + if( idx < 0 ) + idx = 0; + + wxString paperType = m_pageFmt[idx].Left( m_pageFmt[idx].Index( wxT( " " ) ) ); + // Draw layout preview. wxString emptyString; GRResetPenAndBrush( ( wxDC* ) &memDC ); m_Parent->TraceWorkSheet( (wxDC*) &memDC, dummySize, pointLeftTop, pointRightBottom, - emptyString, emptyString, m_tb, m_Screen->m_NumberOfScreens, + paperType, emptyString, m_tb, m_Screen->m_NumberOfScreens, m_Screen->m_ScreenNumber, 1, appScale, LIGHTGRAY, RED ); memDC.SelectObject( wxNullBitmap ); diff --git a/common/drawtxt.cpp b/common/drawtxt.cpp index 96df5f941a..623b85a163 100644 --- a/common/drawtxt.cpp +++ b/common/drawtxt.cpp @@ -122,7 +122,11 @@ int NegableTextLength( const wxString& aText ) { if( aText[i] == '~' ) { - char_count--; + /* '~~' draw as '~' and count as two chars */ + if( i > 0 && aText[i - 1] == '~' ) + i--; + else + char_count--; } } @@ -160,9 +164,13 @@ int ReturnGraphicTextWidth( const wxString& aText, int aXSize, bool aItalic, boo { int AsciiCode = aText[i]; - if( AsciiCode == '~' ) /* Skip the negation marks */ + /* Skip the negation marks + * and first '~' char of '~~' + * ('~~' draw as '~') */ + if( AsciiCode == '~' ) { - continue; + if( i > 0 && aText[i - 1] != '~' ) + continue; } const char* ptcar = GetHersheyShapeDescription( AsciiCode ); @@ -406,37 +414,44 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, overbar_italic_comp = 0; }; - int overbars = 0; // Number of ~ seen + int overbars = 0; /* Number of '~' seen (except '~~') */ ptr = 0; /* ptr = text index */ while( ptr < char_count ) { if( aText[ptr + overbars] == '~' ) { - /* Found an overbar, adjust the pointers */ - overbars++; + if( ptr + overbars + 1 < aText.length() && + aText[ptr + overbars + 1] == '~' ) /* '~~' draw as '~' */ + ptr++; // skip first '~' char and draw second - if( overbars & 1 ) // odd overbars count - { - /* Starting the overbar */ - overbar_pos = current_char_pos; - overbar_pos.x += overbar_italic_comp; - overbar_pos.y -= OverbarPositionY( size_v, aWidth ); - RotatePoint( &overbar_pos, aPos, aOrient ); - } else { - /* Ending the overbar */ - coord[0] = overbar_pos; - overbar_pos = current_char_pos; - overbar_pos.x += overbar_italic_comp; - overbar_pos.y -= OverbarPositionY( size_v, aWidth ); - RotatePoint( &overbar_pos, aPos, aOrient ); - coord[1] = overbar_pos; - /* Plot the overbar segment */ - DrawGraphicTextPline( clipBox, aDC, aColor, aWidth, - sketch_mode, 2, coord, aCallback, aPlotter ); + /* Found an overbar, adjust the pointers */ + overbars++; + + if( overbars & 1 ) // odd overbars count + { + /* Starting the overbar */ + overbar_pos = current_char_pos; + overbar_pos.x += overbar_italic_comp; + overbar_pos.y -= OverbarPositionY( size_v, aWidth ); + RotatePoint( &overbar_pos, aPos, aOrient ); + } + else + { + /* Ending the overbar */ + coord[0] = overbar_pos; + overbar_pos = current_char_pos; + overbar_pos.x += overbar_italic_comp; + overbar_pos.y -= OverbarPositionY( size_v, aWidth ); + RotatePoint( &overbar_pos, aPos, aOrient ); + coord[1] = overbar_pos; + /* Plot the overbar segment */ + DrawGraphicTextPline( clipBox, aDC, aColor, aWidth, + sketch_mode, 2, coord, aCallback, aPlotter ); + } + continue; /* Skip ~ processing */ } - continue; /* Skip ~ processing */ } AsciiCode = aText.GetChar( ptr + overbars ); diff --git a/common/newstroke_font.cpp b/common/newstroke_font.cpp index 45d7986ad5..3098de653f 100644 --- a/common/newstroke_font.cpp +++ b/common/newstroke_font.cpp @@ -123,7 +123,7 @@ const char* const newstroke_font[] = "KYVcUcSbR`RVQTOSQRRPRFSDUCVC", "H\\RbRD", "KYNcOcQbR`RVSTUSSRRPRFQDOCNC", - "KZMHNGPFTHVGWF", + "KZMSNRPQTSVRWQ", "F^K[KFYFY[K[", /* // LATIN-1 SUPPLEMENT (0080-00FF) */ "F^K[KFYFY[K[", /* U+80 */ diff --git a/common/worksheet.cpp b/common/worksheet.cpp index e751077edb..01bcc09663 100644 --- a/common/worksheet.cpp +++ b/common/worksheet.cpp @@ -20,17 +20,833 @@ // Must be defined in main applications: +#if defined(KICAD_GOST) + +// Center - right bottom corner + +Ki_WorkSheetData WS_Osn1_Line1 = +{ + WS_OSN, + &WS_Osn1_Line2, + Mm2mils( 185 ), Mm2mils( 55 ), + 0, Mm2mils( 55 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn1_Line2 = +{ + WS_OSN, + &WS_Osn1_Line3, + Mm2mils( 120 ), Mm2mils( 40 ), + 0, Mm2mils( 40 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn1_Line3 = +{ + WS_OSN, + &WS_Osn1_Line4, + Mm2mils( 185 ), Mm2mils( 35 ), + Mm2mils( 120 ), Mm2mils( 35 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn1_Line4 = +{ + WS_OSN, + &WS_Osn1_Line5, + Mm2mils( 50 ), Mm2mils( 35 ), + 0, Mm2mils( 35 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn1_Line5 = +{ + WS_OSN, + &WS_Osn1_Line6, + Mm2mils( 185 ), Mm2mils( 30 ), + Mm2mils( 120 ), Mm2mils( 30 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn1_Line6 = +{ + WS_OSN, + &WS_Osn1_Line7, + Mm2mils( 50 ), Mm2mils( 20 ), + 0, Mm2mils( 20 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn1_Line7 = +{ + WS_OSN, + &WS_Osn1_Line8, + Mm2mils( 120 ), Mm2mils( 15 ), + 0, Mm2mils( 15 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn1_Line8 = +{ + WS_OSN, + &WS_Osn1_Line9, + Mm2mils( 185 ), Mm2mils( 55 ), + Mm2mils( 185 ), 0, + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn1_Line9 = +{ + WS_OSN, + &WS_Osn1_Line10, + Mm2mils( 178 ), Mm2mils( 55 ), + Mm2mils( 178 ), Mm2mils( 30 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn1_Line10 = +{ + WS_OSN, + &WS_Osn1_Line11, + Mm2mils( 168 ), Mm2mils( 55 ), + Mm2mils( 168 ), 0, + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn1_Line11 = +{ + WS_OSN, + &WS_Osn1_Line12, + Mm2mils( 145 ), Mm2mils( 55 ), + Mm2mils( 145 ), 0, + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn1_Line12 = +{ + WS_OSN, + &WS_Osn1_Line13, + Mm2mils( 130 ), Mm2mils( 55 ), + Mm2mils( 130 ), 0, + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn1_Line13 = +{ + WS_OSN, + &WS_Osn1_Line14, + Mm2mils( 120 ), Mm2mils( 55 ), + Mm2mils( 120 ), 0, + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn1_Line14 = +{ + WS_OSN, + &WS_Osn1_Line15, + Mm2mils( 50 ), Mm2mils( 40 ), + Mm2mils( 50 ), 0, + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn1_Line15 = +{ + WS_OSN, + &WS_Osn1_Line16, + Mm2mils( 35 ), Mm2mils( 40 ), + Mm2mils( 35 ), Mm2mils( 20 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn1_Line16 = +{ + WS_OSN, + &WS_Osn1_Line17, + Mm2mils( 30 ), Mm2mils( 20 ), + Mm2mils( 30 ), Mm2mils( 15 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn1_Line17 = +{ + WS_OSN, + &WS_Osn1_Line18, + Mm2mils( 18 ), Mm2mils( 40 ), + Mm2mils( 18 ), Mm2mils( 20 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn1_Line18 = +{ + WS_TONK, + &WS_Osn1_Line19, + Mm2mils( 185 ), Mm2mils( 50 ), + Mm2mils( 120 ), Mm2mils( 50 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn1_Line19 = +{ + WS_TONK, + &WS_Osn1_Line20, + Mm2mils( 185 ), Mm2mils( 45 ), + Mm2mils( 120 ), Mm2mils( 45 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn1_Line20 = +{ + WS_TONK, + &WS_Osn1_Line21, + Mm2mils( 185 ), Mm2mils( 40 ), + Mm2mils( 120 ), Mm2mils( 40 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn1_Line21 = +{ + WS_TONK, + &WS_Osn1_Line22, + Mm2mils( 185 ), Mm2mils( 25 ), + Mm2mils( 120 ), Mm2mils( 25 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn1_Line22 = +{ + WS_TONK, + &WS_Osn1_Line23, + Mm2mils( 185 ), Mm2mils( 20 ), + Mm2mils( 120 ), Mm2mils( 20 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn1_Line23 = +{ + WS_TONK, + &WS_Osn1_Line24, + Mm2mils( 185 ), Mm2mils( 15 ), + Mm2mils( 120 ), Mm2mils( 15 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn1_Line24 = +{ + WS_TONK, + &WS_Osn1_Line25, + Mm2mils( 185 ), Mm2mils( 10 ), + Mm2mils( 120 ), Mm2mils( 10 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn1_Line25 = +{ + WS_TONK, + &WS_Osn1_Line26, + Mm2mils( 185 ), Mm2mils( 5 ), + Mm2mils( 120 ), Mm2mils( 5 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn1_Line26 = +{ + WS_TONK, + &WS_Osn1_Line27, + Mm2mils( 45 ), Mm2mils( 35 ), + Mm2mils( 45 ), Mm2mils( 20 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn1_Line27 = +{ + WS_TONK, + &WS_Osn1_Text1, + Mm2mils( 40 ), Mm2mils( 35 ), + Mm2mils( 40 ), Mm2mils( 20 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn1_Text1 = +{ + WS_TEXT, + &WS_Osn1_Text2, + Mm2mils( 181.5 ), Mm2mils( 32.5 ), + 0, 0, + wxT( "Изм." ), NULL +}; + +Ki_WorkSheetData WS_Osn1_Text2 = +{ + WS_TEXTL, + &WS_Osn1_Text3, + Mm2mils( 184 ), Mm2mils( 27.5 ), + 0, 0, + wxT( "Разраб." ), NULL +}; + +Ki_WorkSheetData WS_Osn1_Text3 = +{ + WS_TEXTL, + &WS_Osn1_Text4, + Mm2mils( 184 ), Mm2mils( 22.5 ), + 0, 0, + wxT( "Пров." ), NULL +}; + +Ki_WorkSheetData WS_Osn1_Text4 = +{ + WS_TEXTL, + &WS_Osn1_Text5, + Mm2mils( 184 ), Mm2mils( 17.5 ), + 0, 0, + wxT( "Т.контр." ), NULL +}; + +Ki_WorkSheetData WS_Osn1_Text5 = +{ + WS_TEXTL, + &WS_Osn1_Text6, + Mm2mils( 184 ), Mm2mils( 7.5 ), + 0, 0, + wxT( "Ð.контр." ), NULL +}; + +Ki_WorkSheetData WS_Osn1_Text6 = +{ + WS_TEXTL, + &WS_Osn1_Text7, + Mm2mils( 184 ), Mm2mils( 2.5 ), + 0, 0, + wxT( "Утв." ), NULL +}; + +Ki_WorkSheetData WS_Osn1_Text7 = +{ + WS_TEXT, + &WS_Osn1_Text8, + Mm2mils( 173 ), Mm2mils( 32.5 ), + 0, 0, + wxT( "ЛиÑÑ‚" ), NULL +}; + +Ki_WorkSheetData WS_Osn1_Text8 = +{ + WS_TEXT, + &WS_Osn1_Text9, + Mm2mils( 156.5 ), Mm2mils( 32.5 ), + 0, 0, + wxT( "N докум." ), NULL +}; + +Ki_WorkSheetData WS_Osn1_Text9 = +{ + WS_TEXT, + &WS_Osn1_Text10, + Mm2mils( 137.5 ), Mm2mils( 32.5 ), + 0, 0, + wxT( "Подп." ), NULL +}; + +Ki_WorkSheetData WS_Osn1_Text10 = +{ + WS_TEXT, + &WS_Osn1_Text11, + Mm2mils( 125 ), Mm2mils( 32.5 ), + 0, 0, + wxT( "Дата" ), NULL +}; + +Ki_WorkSheetData WS_Osn1_Text11 = +{ + WS_TEXT, + &WS_Osn1_Text12, + Mm2mils( 42.5 ), Mm2mils( 37.5 ), + 0, 0, + wxT( "Лит." ), NULL +}; + +Ki_WorkSheetData WS_Osn1_Text12 = +{ + WS_TEXT, + &WS_Osn1_Text13, + Mm2mils( 26.5 ), Mm2mils( 37.5 ), + 0, 0, + wxT( "МаÑÑа" ), NULL +}; + +Ki_WorkSheetData WS_Osn1_Text13 = +{ + WS_TEXT, + &WS_Osn1_Text14, + Mm2mils( 9 ), Mm2mils( 37.5 ), + 0, 0, + wxT( "МаÑштаб" ), NULL +}; + +Ki_WorkSheetData WS_Osn1_Text14 = +{ + WS_TEXTL, + &WS_Osn1_Text15, + Mm2mils( 49 ), Mm2mils( 17.5 ), + 0, 0, + wxT( "ЛиÑÑ‚" ), NULL +}; + +Ki_WorkSheetData WS_Osn1_Text15 = +{ + WS_TEXTL, + &WS_Osn1_Text16, + Mm2mils( 29 ), Mm2mils( 17.5 ), + 0, 0, + wxT( "ЛиÑтов" ), NULL +}; + +Ki_WorkSheetData WS_Osn1_Text16 = +{ + WS_TEXTL, + &WS_Osn1_Text17, + Mm2mils( 40 ), -Mm2mils( 2.5 ), + 0, 0, + wxT( "Формат" ), NULL +}; + +Ki_WorkSheetData WS_Osn1_Text17 = +{ + WS_TEXTL, + NULL, + Mm2mils( 110 ), -Mm2mils( 2.5 ), + 0, 0, + wxT( "Копировал" ), NULL +}; + +Ki_WorkSheetData WS_Osn2a_Line1 = +{ + WS_OSN, + &WS_Osn2a_Line2, + Mm2mils( 185 ), Mm2mils( 15 ), + 0, Mm2mils( 15 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn2a_Line2 = +{ + WS_OSN, + &WS_Osn2a_Line3, + Mm2mils( 185 ), Mm2mils( 5 ), + Mm2mils( 120 ), Mm2mils( 5 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn2a_Line3 = +{ + WS_OSN, + &WS_Osn2a_Line4, + Mm2mils( 10 ), Mm2mils( 8 ), + 0, Mm2mils( 8 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn2a_Line4 = +{ + WS_OSN, + &WS_Osn2a_Line5, + Mm2mils( 185 ), Mm2mils( 15 ), + Mm2mils( 185 ), 0, + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn2a_Line5 = +{ + WS_OSN, + &WS_Osn2a_Line6, + Mm2mils( 178 ), Mm2mils( 15 ), + Mm2mils( 178 ), 0, + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn2a_Line6 = +{ + WS_OSN, + &WS_Osn2a_Line7, + Mm2mils( 168 ), Mm2mils( 15 ), + Mm2mils( 168 ), 0, + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn2a_Line7 = +{ + WS_OSN, + &WS_Osn2a_Line8, + Mm2mils( 145 ), Mm2mils( 15 ), + Mm2mils( 145 ), 0, + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn2a_Line8 = +{ + WS_OSN, + &WS_Osn2a_Line9, + Mm2mils( 130 ), Mm2mils( 15 ), + Mm2mils( 130 ), 0, + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn2a_Line9 = +{ + WS_OSN, + &WS_Osn2a_Line10, + Mm2mils( 120 ), Mm2mils( 15 ), + Mm2mils( 120 ), 0, + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn2a_Line10 = +{ + WS_OSN, + &WS_Osn2a_Line11, + Mm2mils( 10 ), Mm2mils( 15 ), + Mm2mils( 10 ), 0, + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn2a_Line11 = +{ + WS_TONK, + &WS_Osn2a_Text1, + Mm2mils( 185 ), Mm2mils( 10 ), + Mm2mils( 120 ), Mm2mils( 10 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_Osn2a_Text1 = +{ + WS_TEXT, + &WS_Osn2a_Text2, + Mm2mils( 181.5 ), Mm2mils( 2.5 ), + 0, 0, + wxT( "Изм." ), NULL +}; + +Ki_WorkSheetData WS_Osn2a_Text2 = +{ + WS_TEXT, + &WS_Osn2a_Text3, + Mm2mils( 173 ), Mm2mils( 2.5 ), + 0, 0, + wxT( "ЛиÑÑ‚" ), NULL +}; + +Ki_WorkSheetData WS_Osn2a_Text3 = +{ + WS_TEXT, + &WS_Osn2a_Text4, + Mm2mils( 156.5 ), Mm2mils( 2.5 ), + 0, 0, + wxT( "N докум." ), NULL +}; + +Ki_WorkSheetData WS_Osn2a_Text4 = +{ + WS_TEXT, + &WS_Osn2a_Text5, + Mm2mils( 137.5 ), Mm2mils( 2.5 ), + 0, 0, + wxT( "Подп." ), NULL +}; + +Ki_WorkSheetData WS_Osn2a_Text5 = +{ + WS_TEXT, + &WS_Osn2a_Text6, + Mm2mils( 125 ), Mm2mils( 2.5 ), + 0, 0, + wxT( "Дата" ), NULL +}; + +Ki_WorkSheetData WS_Osn2a_Text6 = +{ + WS_TEXT, + &WS_Osn2a_Text7, + Mm2mils( 5 ), Mm2mils( 11.5 ), + 0, 0, + wxT( "ЛиÑÑ‚" ), NULL +}; + +Ki_WorkSheetData WS_Osn2a_Text7 = +{ + WS_TEXTL, + &WS_Osn2a_Text8, + Mm2mils( 40 ), -Mm2mils( 2.5 ), + 0, 0, + wxT( "Формат" ), NULL +}; + +Ki_WorkSheetData WS_Osn2a_Text8 = +{ + WS_TEXTL, + NULL, + Mm2mils( 110 ), -Mm2mils( 2.5 ), + 0, 0, + wxT( "Копировал" ), NULL +}; + +// Center - left bottom corner + +Ki_WorkSheetData WS_DopLeft_Line1 = +{ + WS_OSN, + &WS_DopLeft_Line2, + Mm2mils( 12 ), Mm2mils( 145 ), + 0, Mm2mils( 145 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_DopLeft_Line2 = +{ + WS_OSN, + &WS_DopLeft_Line3, + Mm2mils( 12 ), Mm2mils( 110 ), + 0, Mm2mils( 110 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_DopLeft_Line3 = +{ + WS_OSN, + &WS_DopLeft_Line4, + Mm2mils( 12 ), Mm2mils( 85 ), + 0, Mm2mils( 85 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_DopLeft_Line4 = +{ + WS_OSN, + &WS_DopLeft_Line5, + Mm2mils( 12 ), Mm2mils( 60 ), + 0, Mm2mils( 60 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_DopLeft_Line5 = +{ + WS_OSN, + &WS_DopLeft_Line6, + Mm2mils( 12 ), Mm2mils( 25 ), + 0, Mm2mils( 25 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_DopLeft_Line6 = +{ + WS_OSN, + &WS_DopLeft_Line7, + Mm2mils( 12 ), 0, + 0, 0, + NULL, NULL +}; + +Ki_WorkSheetData WS_DopLeft_Line7 = +{ + WS_OSN, + &WS_DopLeft_Line8, + Mm2mils( 12 ), Mm2mils( 145 ), + Mm2mils( 12 ), 0, + NULL, NULL +}; + +Ki_WorkSheetData WS_DopLeft_Line8 = +{ + WS_OSN, + &WS_DopLeft_Text1, + Mm2mils( 7 ), Mm2mils( 145 ), + Mm2mils( 7 ), 0, + NULL, NULL +}; + +Ki_WorkSheetData WS_DopLeft_Text1 = +{ + WS_TEXT, + &WS_DopLeft_Text2, + Mm2mils( 9.5 ), Mm2mils( 12.5 ), + 0, 0, + wxT( "Инв.N подл." ), NULL +}; + +Ki_WorkSheetData WS_DopLeft_Text2 = +{ + WS_TEXT, + &WS_DopLeft_Text3, + Mm2mils( 9.5 ), Mm2mils( 42.5 ), + 0, 0, + wxT( "Подп. и дата" ), NULL +}; + +Ki_WorkSheetData WS_DopLeft_Text3 = +{ + WS_TEXT, + &WS_DopLeft_Text4, + Mm2mils( 9.5 ), Mm2mils( 72.5 ), + 0, 0, + wxT( "Взам.инв.N" ), NULL +}; + +Ki_WorkSheetData WS_DopLeft_Text4 = +{ + WS_TEXT, + &WS_DopLeft_Text5, + Mm2mils( 9.5 ), Mm2mils( 97.5 ), + 0, 0, + wxT( "Инв.N дубл." ), NULL +}; + +Ki_WorkSheetData WS_DopLeft_Text5 = +{ + WS_TEXT, + &WS_DopLeft_Line9, + Mm2mils( 9.5 ), Mm2mils( 127.5 ), + 0, 0, + wxT( "Подп. и дата" ), NULL +}; + +Ki_WorkSheetData WS_DopLeft_Line9 = +{ + WS_OSN, + &WS_DopLeft_Line10, + Mm2mils( 7 ), Mm2mils( 287 ), + Mm2mils( 7 ), Mm2mils( 167 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_DopLeft_Line10 = +{ + WS_OSN, + &WS_DopLeft_Line11, + Mm2mils( 12 ), Mm2mils( 287 ), + Mm2mils( 12 ), Mm2mils( 167 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_DopLeft_Line11 = +{ + WS_OSN, + &WS_DopLeft_Line12, + Mm2mils( 12 ), Mm2mils( 287 ), + Mm2mils( 12 ), Mm2mils( 167 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_DopLeft_Line12 = +{ + WS_OSN, + &WS_DopLeft_Line13, + Mm2mils( 12 ), Mm2mils( 167 ), + 0, Mm2mils( 167 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_DopLeft_Line13 = +{ + WS_OSN, + &WS_DopLeft_Line14, + Mm2mils( 12 ), Mm2mils( 227 ), + 0, Mm2mils( 227 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_DopLeft_Line14 = +{ + WS_OSN, + &WS_DopLeft_Text6, + Mm2mils( 12 ), Mm2mils( 287 ), + 0, Mm2mils( 287 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_DopLeft_Text6 = +{ + WS_TEXT, + &WS_DopLeft_Text7, + Mm2mils( 9.5 ), Mm2mils( 197 ), + 0, 0, + wxT( "Справ. N" ), NULL +}; + +Ki_WorkSheetData WS_DopLeft_Text7 = +{ + WS_TEXT, + NULL, + Mm2mils( 9.5 ), Mm2mils( 257 ), + 0, 0, + wxT( "Перв. примен." ), NULL +}; + +// Center - left top corner + +Ki_WorkSheetData WS_DopTop_Line1 = +{ + WS_OSN, + &WS_DopTop_Line2, + Mm2mils( 70 ), 0, + Mm2mils( 70 ), Mm2mils( 14 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_DopTop_Line2 = +{ + WS_OSN, + &WS_DopTop_Line3, + Mm2mils( 70 ), Mm2mils( 14 ), + 0, Mm2mils( 14 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_DopTop_Line3 = +{ + WS_OSN, + &WS_DopTop_Line4, + Mm2mils( 70 ), Mm2mils( 14 ), + Mm2mils( 137 ), Mm2mils( 14 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_DopTop_Line4 = +{ + WS_OSN, + &WS_DopTop_Line5, + Mm2mils( 84 ), Mm2mils( 7 ), + Mm2mils( 137 ), Mm2mils( 7 ), + NULL, NULL +}; + +Ki_WorkSheetData WS_DopTop_Line5 = +{ + WS_OSN, + &WS_DopTop_Line6, + Mm2mils( 84 ), Mm2mils( 14 ), + Mm2mils( 84 ), 0, + NULL, NULL +}; + +Ki_WorkSheetData WS_DopTop_Line6 = +{ + WS_OSN, + NULL, + Mm2mils( 137 ), Mm2mils( 14 ), + Mm2mils( 137 ), 0, + NULL, NULL +}; + +#else + Ki_WorkSheetData WS_Date = { WS_DATE, &WS_Licence, BLOCK_DATE_X, BLOCK_DATE_Y, 0, 0, -#if defined(KICAD_GOST) - NULL, NULL -#else wxT( "Date: " ),NULL -#endif }; Ki_WorkSheetData WS_Licence = @@ -46,29 +862,14 @@ Ki_WorkSheetData WS_Revision = { WS_REV, &WS_SizeSheet, -#if defined(KICAD_GOST) - STAMP_X_185 - 30,STAMP_Y_30 + 90, -#else BLOCK_REV_X, BLOCK_REV_Y, -#endif 0, 0, -#if defined(KICAD_GOST) - NULL, NULL -#else wxT( "Rev: " ), NULL -#endif }; Ki_WorkSheetData WS_SizeSheet = { WS_SIZESHEET, -#if defined(KICAD_GOST) - &WS_Title, - BLOCK_SIZE_SHEET_X,BLOCK_SIZE_SHEET_Y, - 0, 0, - NULL, NULL -}; -#else &WS_IdentSheet, BLOCK_SIZE_SHEET_X, BLOCK_SIZE_SHEET_Y, 0, 0, @@ -83,21 +884,14 @@ Ki_WorkSheetData WS_IdentSheet = 0, 0, wxT( "Id: " ), NULL }; -#endif Ki_WorkSheetData WS_Title = { WS_TITLE, &WS_SheetFilename, -#if defined(KICAD_GOST) - STAMP_X_85, STAMP_Y_25 + 90, - 0, 0, - NULL, NULL -#else BLOCK_TITLE_X, BLOCK_TITLE_Y, 0, 0, wxT( "Title: " ), NULL -#endif }; Ki_WorkSheetData WS_SheetFilename = @@ -122,13 +916,8 @@ Ki_WorkSheetData WS_Company = { WS_COMPANY_NAME, &WS_Comment1, -#if defined(KICAD_GOST) - STAMP_X_50 / 2, STAMP_Y_0 + 270, - 0, 0, -#else BLOCK_COMMENT_X,BLOCK_COMPANY_Y, 0, 0, -#endif NULL, NULL }; @@ -136,13 +925,8 @@ Ki_WorkSheetData WS_Comment1 = { WS_COMMENT1, &WS_Comment2, -#if defined(KICAD_GOST) - STAMP_X_120 / 2,STAMP_Y_40 + 270, - STAMP_OX, 0, -#else BLOCK_COMMENT_X,BLOCK_COMMENT1_Y, 0, 0, -#endif NULL, NULL }; @@ -150,13 +934,8 @@ Ki_WorkSheetData WS_Comment2 = { WS_COMMENT2, &WS_Comment3, -#if defined(KICAD_GOST) - STAMP_X_168 - 30, STAMP_Y_25 + 90, - STAMP_OX, 0, -#else BLOCK_COMMENT_X,BLOCK_COMMENT2_Y, 0, 0, -#endif NULL, NULL }; @@ -164,13 +943,8 @@ Ki_WorkSheetData WS_Comment3 = { WS_COMMENT3, &WS_Comment4, -#if defined(KICAD_GOST) - STAMP_X_168 - 30, STAMP_Y_20 + 90, - STAMP_OX, 0, -#else BLOCK_COMMENT_X,BLOCK_COMMENT3_Y, 0, 0, -#endif NULL, NULL }; @@ -178,13 +952,8 @@ Ki_WorkSheetData WS_Comment4 = { WS_COMMENT4, &WS_MostLeftLine, -#if defined(KICAD_GOST) - STAMP_X_168 - 30, STAMP_Y_0 + 90, - STAMP_OX, 0, -#else BLOCK_COMMENT_X, BLOCK_COMMENT4_Y, 0, 0, -#endif NULL, NULL }; @@ -193,11 +962,6 @@ Ki_WorkSheetData WS_Comment4 = Ki_WorkSheetData WS_MostLeftLine = { WS_LEFT_SEGMENT, -#if defined(KICAD_GOST) - &WS_MostUpperLine, - STAMP_OX, STAMP_OY, - STAMP_OX, 0, -#else &WS_SeparatorLine, BLOCK_OX, SIZETEXT * 16, BLOCK_OX, 0, @@ -212,7 +976,6 @@ Ki_WorkSheetData WS_SeparatorLine = &WS_MostUpperLine, BLOCK_OX, VARIABLE_BLOCK_START_POSITION, 0, VARIABLE_BLOCK_START_POSITION, -#endif NULL, NULL }; @@ -222,13 +985,8 @@ Ki_WorkSheetData WS_MostUpperLine = { WS_UPPER_SEGMENT, &WS_Segm3, -#if defined(KICAD_GOST) - STAMP_OX, STAMP_OY, - 0, STAMP_OY, -#else BLOCK_OX, SIZETEXT * 16, 0, SIZETEXT * 16, -#endif NULL, NULL }; @@ -238,13 +996,8 @@ Ki_WorkSheetData WS_Segm3 = { WS_SEGMENT, &WS_Segm4, -#if defined(KICAD_GOST) - STAMP_OX, STAMP_Y_50, - STAMP_X_120,STAMP_Y_50, -#else BLOCK_OX, SIZETEXT * 6, 0, SIZETEXT * 6, -#endif NULL, NULL }; @@ -254,13 +1007,8 @@ Ki_WorkSheetData WS_Segm4 = { WS_SEGMENT, &WS_Segm5, -#if defined(KICAD_GOST) - STAMP_OX, STAMP_Y_45, - STAMP_X_120, STAMP_Y_45, -#else BLOCK_REV_X + SIZETEXT,SIZETEXT * 4, BLOCK_REV_X + SIZETEXT,0, -#endif NULL, NULL }; @@ -269,13 +1017,8 @@ Ki_WorkSheetData WS_Segm5 = { WS_SEGMENT, &WS_Segm6, -#if defined(KICAD_GOST) - STAMP_OX, STAMP_Y_40, - 0, STAMP_Y_40, -#else BLOCK_OX, SIZETEXT * 2, 0, SIZETEXT * 2, -#endif NULL, NULL }; @@ -284,13 +1027,8 @@ Ki_WorkSheetData WS_Segm6 = { WS_SEGMENT, &WS_Segm7, -#if defined(KICAD_GOST) - STAMP_OX, STAMP_Y_35, - STAMP_X_120,STAMP_Y_35, -#else BLOCK_OX, SIZETEXT * 4, 0, SIZETEXT * 4, -#endif NULL, NULL }; @@ -298,710 +1036,13 @@ Ki_WorkSheetData WS_Segm6 = Ki_WorkSheetData WS_Segm7 = { WS_SEGMENT, -#if defined(KICAD_GOST) - &WS_Segm8, - STAMP_X_50,STAMP_Y_35, - 0, STAMP_Y_35, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm8 = -{ - WS_SEGMENT, - &WS_Segm9, - STAMP_OX, STAMP_Y_30, - STAMP_X_120,STAMP_Y_30, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm9 = -{ - WS_SEGMENT, - &WS_Segm10, - STAMP_OX, STAMP_Y_25, - STAMP_X_120,STAMP_Y_25, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm10 = -{ - WS_SEGMENT, - &WS_Segm11, - STAMP_OX, STAMP_Y_20, - STAMP_X_120,STAMP_Y_20, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm11 = -{ - WS_SEGMENT, - &WS_Segm12, - STAMP_X_50,STAMP_Y_20, - 0, STAMP_Y_20, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm12 = -{ - WS_SEGMENT, - &WS_Segm13, - STAMP_OX, STAMP_Y_15, - 0, STAMP_Y_15, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm13 = -{ - WS_SEGMENT, - &WS_Segm14, - STAMP_OX, STAMP_Y_10, - STAMP_X_120,STAMP_Y_10, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm14 = -{ - WS_SEGMENT, - &WS_Segm15, - STAMP_OX, STAMP_Y_5, - STAMP_X_120,STAMP_Y_5, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm15 = -{ - WS_SEGMENT, - &WS_Segm16, - STAMP_X_178,STAMP_OY, - STAMP_X_178,STAMP_Y_30, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm16 = -{ - WS_SEGMENT, - &WS_Segm17, - STAMP_X_168,STAMP_OY, - STAMP_X_168,0, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm17 = -{ - WS_SEGMENT, - &WS_Segm18, - STAMP_X_145,STAMP_OY, - STAMP_X_145,0, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm18 = -{ - WS_SEGMENT, - &WS_Segm19, - STAMP_X_130,STAMP_OY, - STAMP_X_130,0, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm19 = -{ - WS_SEGMENT, - &WS_Segm20, - STAMP_X_120,STAMP_OY, - STAMP_X_120,0, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm20 = -{ - WS_SEGMENT, - &WS_Segm21, - STAMP_X_50,STAMP_Y_40, - STAMP_X_50,0, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm21 = -{ - WS_SEGMENT, - &WS_Segm22, - STAMP_X_45,STAMP_Y_35, - STAMP_X_45,STAMP_Y_20, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm22 = -{ - WS_SEGMENT, - &WS_Segm23, - STAMP_X_40,STAMP_Y_35, - STAMP_X_40,STAMP_Y_20, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm23 = -{ - WS_SEGMENT, - &WS_Segm24, - STAMP_X_35,STAMP_Y_40, - STAMP_X_35,STAMP_Y_20, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm24 = -{ - WS_SEGMENT, - &WS_Segm25, - STAMP_X_30,STAMP_Y_20, - STAMP_X_30,STAMP_Y_15, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm25 = -{ - WS_SEGMENT, - &WS_Izm, - STAMP_X_18,STAMP_Y_40, - STAMP_X_18,STAMP_Y_20, - NULL, NULL -}; - -Ki_WorkSheetData WS_Izm = -{ - WS_PODPIS, - &WS_Razr, - STAMP_X_185 - 30,STAMP_Y_30 + 90, - 0, 0, - wxT( "Изм." ),NULL -}; - -Ki_WorkSheetData WS_Razr = -{ - WS_PODPIS, - &WS_Prov, - STAMP_X_185 - 30, STAMP_Y_25 + 90, - 0, 0, - wxT( "Разраб." ),NULL -}; - -Ki_WorkSheetData WS_Prov = -{ - WS_PODPIS, - &WS_TKon, - STAMP_X_185 - 30, STAMP_Y_20 + 90, - 0, 0, - wxT( "Пров." ),NULL -}; - -Ki_WorkSheetData WS_TKon = -{ - WS_PODPIS, - &WS_NKon, - STAMP_X_185 - 30, STAMP_Y_15 + 90, - 0, 0, - wxT( "Т.контр." ),NULL -}; - -Ki_WorkSheetData WS_NKon = -{ - WS_PODPIS, - &WS_Utv, - STAMP_X_185 - 30, STAMP_Y_5 + 90, - 0, 0, - wxT( "Ð.контр." ),NULL -}; - -Ki_WorkSheetData WS_Utv = -{ - WS_PODPIS, - &WS_List, - STAMP_X_185 - 30,STAMP_Y_0 + 90, - 0, 0, - wxT( "Утв." ),NULL -}; - -Ki_WorkSheetData WS_List = -{ - WS_PODPIS, - &WS_NDoc, - STAMP_X_178 - 30, STAMP_Y_30 + 90, - 0, 0, - wxT( "ЛиÑÑ‚" ),NULL -}; - -Ki_WorkSheetData WS_NDoc = -{ - WS_PODPIS, - &WS_Podp, - STAMP_X_168 - 30, STAMP_Y_30 + 90, - 0, 0, - wxT( "N докум." ),NULL -}; - -Ki_WorkSheetData WS_Podp = -{ - WS_PODPIS, - &WS_Data, - STAMP_X_145 - 30, STAMP_Y_30 + 90, - 0, 0, - wxT( "Подп." ),NULL -}; - -Ki_WorkSheetData WS_Data = -{ - WS_PODPIS, - &WS_Art, - STAMP_X_130 - 30, STAMP_Y_30 + 90, - 0, 0, - wxT( "Дата" ),NULL -}; - -Ki_WorkSheetData WS_Art = -{ - WS_PODPIS, - &WS_Mass, - STAMP_X_50 - 30, STAMP_Y_35 + 90, - 0, 0, - wxT( "Лит." ),NULL -}; - -Ki_WorkSheetData WS_Mass = -{ - WS_PODPIS, - &WS_Msht, - STAMP_X_35 - 30, STAMP_Y_35 + 90, - 0, 0, - wxT( "МаÑÑа" ),NULL -}; - -Ki_WorkSheetData WS_Msht = -{ - WS_PODPIS, - &WS_List1, - STAMP_X_18 - 30, STAMP_Y_35 + 90, - 0, 0, - wxT( "МаÑштаб" ),NULL -}; - -Ki_WorkSheetData WS_List1 = -{ - WS_IDENTSHEET, - &WS_List2, - STAMP_X_50 - 30, STAMP_Y_15 + 90, - 0, 0, - wxT( "ЛиÑÑ‚ " ),NULL -}; - -Ki_WorkSheetData WS_List2 = -{ - WS_SHEETS, - NULL, - STAMP_X_30 - 30, STAMP_Y_15 + 90, - 0, 0, - wxT( "ЛиÑтов " ),NULL -}; - -Ki_WorkSheetData WS_CADRE_D = -{ - WS_CADRE, - &WS_Segm1_D, - STAMP_X_65, STAMP_Y_0 + 270, - 0, 0, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm1_D = -{ - WS_LEFT_SEGMENT_D, - &WS_Segm2_D, - STAMP_OX, STAMP_Y_15, - STAMP_OX, 0, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm2_D = -{ - WS_SEGMENT_D, - &WS_Segm3_D, - STAMP_X_178, STAMP_Y_15, - STAMP_X_178, 0, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm3_D = -{ - WS_SEGMENT_D, - &WS_Segm4_D, - STAMP_X_168, STAMP_Y_15, - STAMP_X_168, 0, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm4_D = -{ - WS_SEGMENT_D, - &WS_Segm5_D, - STAMP_X_145, STAMP_Y_15, - STAMP_X_145, 0, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm5_D = -{ - WS_SEGMENT_D, - &WS_Segm6_D, - STAMP_X_130, STAMP_Y_15, - STAMP_X_130, 0, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm6_D = -{ - WS_SEGMENT_D, - &WS_Segm7_D, - STAMP_X_120, STAMP_Y_15, - STAMP_X_120, 0, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm7_D = -{ - WS_SEGMENT_D, - &WS_Segm8_D, - STAMP_X_10, STAMP_Y_15, - STAMP_X_10, 0, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm8_D = -{ - WS_SEGMENT_D, - &WS_Segm9_D, - STAMP_X_185, STAMP_Y_10, - STAMP_X_120, STAMP_Y_10, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm9_D = -{ - WS_SEGMENT_D, - &WS_Segm10_D, - STAMP_X_185, STAMP_Y_5, - STAMP_X_120, STAMP_Y_5, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm10_D = -{ - WS_SEGMENT_D, - &WS_Segm11_D, - STAMP_X_10, STAMP_Y_8, - 0, STAMP_Y_8, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm11_D = -{ - WS_SEGMENT_D, - &WS_Izm_D, - STAMP_X_185, STAMP_Y_15, - 0, STAMP_Y_15, - NULL, NULL -}; - -Ki_WorkSheetData WS_Izm_D = -{ - WS_PODPIS_D, - &WS_List_D, - STAMP_X_185 - 30,STAMP_Y_0 + 90, - 0, 0, - wxT( "Изм." ),NULL -}; - -Ki_WorkSheetData WS_List_D = -{ - WS_PODPIS_D, - &WS_NDoc_D, - STAMP_X_178 - 30, STAMP_Y_0 + 90, - 0, 0, - wxT( "ЛиÑÑ‚" ),NULL -}; - -Ki_WorkSheetData WS_NDoc_D = -{ - WS_PODPIS_D, - &WS_Podp_D, - STAMP_X_168 - 30, STAMP_Y_0 + 90, - 0, 0, - wxT( "N докум." ),NULL -}; - -Ki_WorkSheetData WS_Podp_D = -{ - WS_PODPIS_D, - &WS_Date_D, - STAMP_X_145 - 30, STAMP_Y_0 + 90, - 0, 0, - wxT( "Подп." ),NULL -}; - -Ki_WorkSheetData WS_Date_D = -{ - WS_PODPIS_D, - &WS_List1_D, - STAMP_X_130 - 30, STAMP_Y_0 + 90, - 0, 0, - wxT( "Дата" ),NULL -}; - -Ki_WorkSheetData WS_List1_D = -{ - WS_PODPIS_D, - &WS_ListN_D, - STAMP_X_10 - 30, STAMP_Y_8 + 90, - 0, 0, - wxT( "ЛиÑÑ‚" ),NULL -}; - -Ki_WorkSheetData WS_ListN_D = -{ - WS_IDENTSHEET_D, - NULL, - STAMP_Y_0 + 196,STAMP_Y_0 + 90, - 0, 0, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm1_LU = -{ - WS_SEGMENT_LU, - &WS_Segm2_LU, - STAMP_12, STAMP_145, - STAMP_12, 0, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm2_LU = -{ - WS_SEGMENT_LU, - &WS_Segm3_LU, - STAMP_7, STAMP_145, - STAMP_7, 0, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm3_LU = -{ - WS_SEGMENT_LU, - &WS_Segm4_LU, - STAMP_12, STAMP_145, - 0, STAMP_145, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm4_LU = -{ - WS_SEGMENT_LU, - &WS_Segm5_LU, - STAMP_12, STAMP_110, - 0, STAMP_110, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm5_LU = -{ - WS_SEGMENT_LU, - &WS_Segm6_LU, - STAMP_12, STAMP_85, - 0, STAMP_85, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm6_LU = -{ - WS_SEGMENT_LU, - &WS_Segm7_LU, - STAMP_12, STAMP_60, - 0, STAMP_60, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm7_LU = -{ - WS_SEGMENT_LU, - &WS_Segm8_LU, - STAMP_12, STAMP_25, - 0, STAMP_25, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm8_LU = -{ - WS_SEGMENT_LU, - &WS_Segm9_LU, - STAMP_12, 0, - 0, 0, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm9_LU = -{ - WS_SEGMENT_LU, - &WS_Segm10_LU, - STAMP_12, STAMP_287, - STAMP_12, STAMP_167, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm10_LU = -{ - WS_SEGMENT_LU, - &WS_Segm11_LU, - STAMP_7, STAMP_287, - STAMP_7, STAMP_167, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm11_LU = -{ - WS_SEGMENT_LU, - &WS_Segm12_LU, - STAMP_12, STAMP_287, - 0, STAMP_287, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm12_LU = -{ - WS_SEGMENT_LU, - &WS_Segm13_LU, - STAMP_12, STAMP_227, - 0, STAMP_227, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm13_LU = -{ - WS_SEGMENT_LU, - &WS_Podp1_LU, - STAMP_12, STAMP_167, - 0, STAMP_167, - NULL, NULL -}; - -Ki_WorkSheetData WS_Podp1_LU = -{ - WS_PODPIS_LU, - &WS_Podp2_LU, - STAMP_7 + 90, 0 + 492, - 0, 0, - wxT( "Инв.N подл." ),NULL -}; - -Ki_WorkSheetData WS_Podp2_LU = -{ - WS_PODPIS_LU, - &WS_Podp3_LU, - STAMP_7 + 90, STAMP_25 + 688, - 0, 0, - wxT( "Подп. и дата" ),NULL -}; - -Ki_WorkSheetData WS_Podp3_LU = -{ - WS_PODPIS_LU, - &WS_Podp4_LU, - STAMP_7 + 90, STAMP_60 + 492, - 0, 0, - wxT( "Взам.инв.N" ),NULL -}; - -Ki_WorkSheetData WS_Podp4_LU = -{ - WS_PODPIS_LU, - &WS_Podp5_LU, - STAMP_7 + 90, STAMP_85 + 492, - 0, 0, - wxT( "Инв.N дубл." ),NULL -}; - -Ki_WorkSheetData WS_Podp5_LU = -{ - WS_PODPIS_LU, - &WS_Podp6_LU, - STAMP_7 + 90, STAMP_110 + 688, - 0, 0, - wxT( "Подп. и дата" ),NULL -}; - -Ki_WorkSheetData WS_Podp6_LU = -{ - WS_PODPIS_LU, - &WS_Podp7_LU, - STAMP_7 + 90, STAMP_167 + 1180, - 0, 0, - wxT( "Справ. N" ),NULL -}; - -Ki_WorkSheetData WS_Podp7_LU = -{ - WS_PODPIS_LU, - NULL, - STAMP_7 + 90, STAMP_227 + 1180, - 0, 0, - wxT( "Перв. примен." ),NULL -}; - -Ki_WorkSheetData WS_Segm1_LT = -{ - WS_SEGMENT_LT, - &WS_Segm2_LT, - STAMP_X_0, STAMP_Y_14, - STAMP_X_137, STAMP_Y_14, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm2_LT = -{ - WS_SEGMENT_LT, - &WS_Segm3_LT, - STAMP_X_137, STAMP_Y_14, - STAMP_X_137, 0, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm3_LT = -{ - WS_SEGMENT_LT, - &WS_Segm4_LT, - STAMP_X_137, STAMP_Y_7, - STAMP_X_84, STAMP_Y_7, - NULL, NULL -}; - -Ki_WorkSheetData WS_Segm4_LT = -{ - WS_SEGMENT_LT, - &WS_Segm5_LT, - STAMP_X_84, STAMP_Y_14, - STAMP_X_84, 0, - NULL, NULL -}; -Ki_WorkSheetData WS_Segm5_LT = -{ - WS_SEGMENT_LT, - NULL, - STAMP_X_70, STAMP_Y_14, - STAMP_X_70, 0, -#else NULL, BLOCK_OX - (SIZETEXT * 11),SIZETEXT * 4, BLOCK_OX - (SIZETEXT * 11),SIZETEXT * 2, -#endif NULL, NULL }; +#endif void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWidth, double aScalar, const wxString &aFilename ) @@ -1041,6 +1082,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi EDA_COLOR_T aClr1, EDA_COLOR_T aClr2 ) { wxPoint pos; + wxPoint end; int refx, refy; wxString Line; Ki_WorkSheetData* WsItem; @@ -1060,261 +1102,488 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi yg = aSz.y - aRB.y; #if defined(KICAD_GOST) + + int lnMsg, ln; + int lnWosn = aLnW * 2; + int lnWtonk = aLnW; + wxSize sz; + wxSize size0_8( SIZETEXT * aScalar * 0.8, SIZETEXT * aScalar * 1 ); + wxSize size1_5( SIZETEXT * aScalar * 1.5, SIZETEXT * aScalar * 1.5 ); + wxSize size2( SIZETEXT * aScalar * 2, SIZETEXT * aScalar * 2 ); + wxSize size3( SIZETEXT * aScalar * 3, SIZETEXT * aScalar * 3 ); + // Draw the border. GRRect( m_canvas->GetClipBox(), aDC, refx * aScalar, refy * aScalar, - xg * aScalar, yg * aScalar, aLnW, aClr1 ); + xg * aScalar, yg * aScalar, lnWosn, aClr1 ); - refx = aLT.x; - refy = aSz.y - aRB.y; // Lower left corner - for( WsItem = &WS_Segm1_LU; WsItem != NULL; WsItem = WsItem->Pnext ) - { - pos.x = ( refx - WsItem->m_Posx ) * aScalar; - pos.y = ( refy - WsItem->m_Posy ) * aScalar; - msg.Empty(); - switch( WsItem->m_Type ) - { - case WS_CADRE: - break; - - case WS_PODPIS_LU: - if( WsItem->m_Legende ) - msg = WsItem->m_Legende; - DrawGraphicText( m_canvas, aDC, pos, aClr1, - msg, TEXT_ORIENT_VERT, size, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, - aLnW, false, false ); - break; - - case WS_SEGMENT_LU: - xg = aLT.x - WsItem->m_Endx; - yg = aSz.y - aRB.y - WsItem->m_Endy; - GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y, - xg * aScalar, yg * aScalar, aLnW, aClr1 ); - break; - } - } - - refy = aRB.y; // Left Top corner - for( WsItem = &WS_Segm1_LT; WsItem != NULL; WsItem = WsItem->Pnext ) - { - pos.x = ( refx + WsItem->m_Posx ) * aScalar; - pos.y = ( refy + WsItem->m_Posy ) * aScalar; - msg.Empty(); - switch( WsItem->m_Type ) - { - case WS_SEGMENT_LT: - xg = aLT.x + WsItem->m_Endx; - yg = aRB.y + WsItem->m_Endy; - GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y, - xg * aScalar, yg * aScalar, aLnW, aClr1 ); - break; - } - } - - wxSize size2( SIZETEXT * aScalar * 2, SIZETEXT * aScalar * 2); - wxSize size3( SIZETEXT * aScalar * 3, SIZETEXT * aScalar * 3); - wxSize size1_5( SIZETEXT * aScalar * 1.5, SIZETEXT * aScalar * 1.5); - // lower right corner + // Center - right bottom corner refx = aSz.x - aRB.x; refy = aSz.y - aRB.y; + // First page if( aScr == 1 ) { - for( WsItem = &WS_Date; WsItem != NULL; WsItem = WsItem->Pnext ) + for( WsItem = &WS_Osn1_Line1; WsItem != NULL; WsItem = WsItem->Pnext ) { pos.x = (refx - WsItem->m_Posx) * aScalar; pos.y = (refy - WsItem->m_Posy) * aScalar; - msg.Empty(); + end.x = (refx - WsItem->m_Endx) * aScalar; + end.y = (refy - WsItem->m_Endy) * aScalar; + msg = WsItem->m_Legende; switch( WsItem->m_Type ) { - case WS_DATE: + case WS_OSN: + GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y, end.x, end.y, + lnWosn, aClr1 ); break; - case WS_REV: + case WS_TONK: + GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y, end.x, end.y, + lnWtonk, aClr1 ); break; - case WS_KICAD_VERSION: + case WS_TEXT: + if( !msg.IsEmpty() ) + { + if( WsItem == &WS_Osn1_Text1 ) + DrawGraphicText( m_canvas, aDC, pos, aClr1, + msg, TEXT_ORIENT_HORIZ, size0_8, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, + aLnW, false, false ); + else + DrawGraphicText( m_canvas, aDC, pos, aClr1, + msg, TEXT_ORIENT_HORIZ, size, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, + aLnW, false, false ); + } break; - case WS_PODPIS: - if( WsItem->m_Legende ) - msg = WsItem->m_Legende; - DrawGraphicText( m_canvas, aDC, pos, aClr1, - msg, TEXT_ORIENT_HORIZ, size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, + case WS_TEXTL: + if( !msg.IsEmpty() ) + DrawGraphicText( m_canvas, aDC, pos, aClr1, + msg, TEXT_ORIENT_HORIZ, size, + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, + aLnW, false, false ); + break; + + } + } + + // Sheet number + if( aNScr > 1 ) + { + pos.x = (refx - Mm2mils( 36 )) * aScalar; + pos.y = (refy - Mm2mils( 17.5 )) * aScalar; + msg.Empty(); + msg << aScr; + DrawGraphicText( m_canvas, aDC, pos, aClr1, msg, + TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_CENTER, + GR_TEXT_VJUSTIFY_CENTER, aLnW, false, false ); + } + + // Count of sheets + pos.x = (refx - Mm2mils( 10 )) * aScalar; + pos.y = (refy - Mm2mils( 17.5 )) * aScalar; + msg.Empty(); + msg << aNScr; + DrawGraphicText( m_canvas, aDC, pos, aClr1, msg, + TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, + GR_TEXT_VJUSTIFY_CENTER, aLnW, false, false ); + + // Company name + msg = aTb.GetCompany(); + if( !msg.IsEmpty() ) + { + sz = size1_5; + lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar; + ln = Mm2mils( 49 ); + if( lnMsg > ln ) + sz.x *= float( ln ) / lnMsg; + pos.x = (refx - Mm2mils( 25 )) * aScalar; + pos.y = (refy - Mm2mils( 7.5 )) * aScalar; + DrawGraphicText( m_canvas, aDC, pos, aClr2, + msg, TEXT_ORIENT_HORIZ, sz, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, + aLnW, false, false ); + } + + // Title + msg = aTb.GetTitle(); + if( !msg.IsEmpty() ) + { + sz = size1_5; + wxArrayString lines; + int titleWidth = 0; + int titleHeight = (sz.y + sz.y * 0.5) / aScalar; + int titleFieldWidth = Mm2mils( 69 ); + int titleFieldHeight = Mm2mils( 24 ); + int index = 0; + wxString fullMsg = msg; + do // Reduce the height of wrapped title until the fit + { + do // Wrap the title + { + titleWidth = ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar; + if( titleWidth > titleFieldWidth ) + { + index = 0; + do + { + msg = msg.Left( msg.Length() - 1 ); + if( msg.Length() == 0 ) + { + lines.Clear(); + msg = fullMsg; + sz.x -= aScalar; + break; + } + else + { + index++; + titleWidth = ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar; + + wxString ch = wxString( msg.Last() ); + if( titleWidth < titleFieldWidth && ch == wxT( " " ) ) + { + // New sentence on a new line + int dot = msg.Index( wxT( ". " ) ); + if( dot != wxNOT_FOUND ) + { + index += msg.Length() - dot - 2; + msg = msg.Left( dot + 1 ); + lines.Add( msg ); + msg = fullMsg.Right( index ); + break; + } + else + { + msg = msg.Left( msg.Length() - 1 ); + lines.Add( msg ); + msg = fullMsg.Right( index ); + break; + } + } + } + }while( 1 ); + } + else + { + // New sentence on a new line + int dot = msg.Index( wxT( ". " ) ); + if( dot != wxNOT_FOUND ) + { + lines.Add( msg.Left( dot + 1 ) ); + lines.Add( fullMsg.Right( msg.Length() - dot - 2 ) ); + } + else + lines.Add( msg ); + break; + } + }while( 1 ); + + if( titleFieldHeight < titleHeight * lines.Count() ) + { + sz.y -= aScalar; + sz.x -= aScalar; + msg = fullMsg; + lines.Clear(); + } + else + break; + }while( 1 ); + + pos.x = (refx - Mm2mils( 85 )) * aScalar; + pos.y = (refy - Mm2mils( 27.5 ) - (titleHeight * (lines.Count() - 1) / 2)) * aScalar; + + for( int curLn = 0; curLn < lines.Count(); curLn++ ) + { + msg = lines[curLn]; + DrawGraphicText( m_canvas, aDC, pos, aClr2, + msg, TEXT_ORIENT_HORIZ, sz, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, aLnW, false, false ); + pos.y += titleHeight * aScalar; + } + } + + // Decimal number + msg = aTb.GetComment1(); + if( !msg.IsEmpty() ) + { + sz = size3; + lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar; + ln = Mm2mils( 119 ); + if( lnMsg > ln ) + sz.x *= float( ln ) / lnMsg; + pos.x = (refx - Mm2mils( 60 )) * aScalar; + pos.y = (refy - Mm2mils( 47.5 )) * aScalar; + DrawGraphicText( m_canvas, aDC, pos, aClr2, + msg, TEXT_ORIENT_HORIZ, sz, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, + aLnW, false, false ); + } + + // Developer + msg = aTb.GetComment2(); + if( !msg.IsEmpty() ) + { + sz = size; + lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar; + ln = Mm2mils( 22 ); + if( lnMsg > ln ) + sz.x *= float( ln ) / lnMsg; + pos.x = (refx - Mm2mils( 167.5 )) * aScalar; + pos.y = (refy - Mm2mils( 27.5 )) * aScalar; + DrawGraphicText( m_canvas, aDC, pos, aClr2, + msg, TEXT_ORIENT_HORIZ, sz, + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, + aLnW, false, false ); + } + + // Verifier + msg = aTb.GetComment3(); + if( !msg.IsEmpty() ) + { + sz = size; + lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar; + ln = Mm2mils( 22 ); + if( lnMsg > ln ) + sz.x *= float( ln ) / lnMsg; + pos.x = (refx - Mm2mils( 167 )) * aScalar; + pos.y = (refy - Mm2mils( 22.5 )) * aScalar; + DrawGraphicText( m_canvas, aDC, pos, aClr2, + msg, TEXT_ORIENT_HORIZ, sz, + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, + aLnW, false, false ); + } + + // Approver + msg = aTb.GetComment4(); + if( !msg.IsEmpty() ) + { + sz = size; + lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar; + ln = Mm2mils( 22 ); + if( lnMsg > ln ) + sz.x *= float( ln ) / lnMsg; + pos.x = (refx - Mm2mils( 167 )) * aScalar; + pos.y = (refy - Mm2mils( 2.5 )) * aScalar; + DrawGraphicText( m_canvas, aDC, pos, aClr2, + msg, TEXT_ORIENT_HORIZ, sz, + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, + aLnW, false, false ); + } + } + else // other pages + { + for( WsItem = &WS_Osn2a_Line1; WsItem != NULL; WsItem = WsItem->Pnext ) + { + pos.x = (refx - WsItem->m_Posx) * aScalar; + pos.y = (refy - WsItem->m_Posy) * aScalar; + end.x = (refx - WsItem->m_Endx) * aScalar; + end.y = (refy - WsItem->m_Endy) * aScalar; + msg = WsItem->m_Legende; + switch( WsItem->m_Type ) + { + case WS_OSN: + GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y, end.x, end.y, + lnWosn, aClr1 ); break; - case WS_SIZESHEET: + case WS_TONK: + GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y, end.x, end.y, + lnWtonk, aClr1 ); break; - case WS_IDENTSHEET: - if( WsItem->m_Legende ) - msg = WsItem->m_Legende; - if( aNScr > 1 ) - msg << aScr; - DrawGraphicText( m_canvas, aDC, pos, aClr1, msg, - TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, - GR_TEXT_VJUSTIFY_CENTER, aLnW, false, false ); - break; - - case WS_SHEETS: - if( WsItem->m_Legende ) - msg = WsItem->m_Legende; - msg << aNScr; - DrawGraphicText( m_canvas, aDC, pos, aClr1, msg, - TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, - GR_TEXT_VJUSTIFY_CENTER, aLnW, false, false ); - break; - - case WS_COMPANY_NAME: - msg = aTb.GetCompany(); + case WS_TEXT: if( !msg.IsEmpty() ) { - DrawGraphicText( m_canvas, aDC, pos, aClr2, - msg, TEXT_ORIENT_HORIZ, size1_5, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, - aLnW, false, false ); + if( WsItem == &WS_Osn2a_Text1 ) + DrawGraphicText( m_canvas, aDC, pos, aClr1, + msg, TEXT_ORIENT_HORIZ, size0_8, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, + aLnW, false, false ); + else + DrawGraphicText( m_canvas, aDC, pos, aClr1, + msg, TEXT_ORIENT_HORIZ, size, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, + aLnW, false, false ); } break; - case WS_TITLE: - msg = aTb.GetTitle(); + case WS_TEXTL: if( !msg.IsEmpty() ) - { - DrawGraphicText( m_canvas, aDC, pos, aClr2, - msg, TEXT_ORIENT_HORIZ, size1_5, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, - aLnW, false, false ); - } - break; - - case WS_COMMENT1: - msg = aTb.GetComment1(); - if( !msg.IsEmpty() ) - { - DrawGraphicText( m_canvas, aDC, pos, aClr2, - msg, TEXT_ORIENT_HORIZ, size3, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, - aLnW, false, false ); - pos.x = (aLT.x + 1260) * aScalar; - pos.y = (aLT.y + 270) * aScalar; - DrawGraphicText( m_canvas, aDC, pos, aClr2, - msg, 1800, size2, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, - aLnW, false, false ); - } - break; - - case WS_COMMENT2: - msg = aTb.GetComment2(); - if( !msg.IsEmpty() ) - { - DrawGraphicText( m_canvas, aDC, pos, aClr2, + DrawGraphicText( m_canvas, aDC, pos, aClr1, msg, TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, aLnW, false, false ); - } - break; - - case WS_COMMENT3: - msg = aTb.GetComment3(); - if( !msg.IsEmpty() ) - { - DrawGraphicText( m_canvas, aDC, pos, aClr2, - msg, TEXT_ORIENT_HORIZ, size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, - aLnW, false, false ); - } - break; - - case WS_COMMENT4: - msg = aTb.GetComment4(); - if( !msg.IsEmpty() ) - { - DrawGraphicText( m_canvas, aDC, pos, aClr2, - msg, TEXT_ORIENT_HORIZ, size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, - aLnW, false, false ); - } - break; - - case WS_UPPER_SEGMENT: - case WS_LEFT_SEGMENT: - WS_MostUpperLine.m_Posy = WS_MostUpperLine.m_Endy = - WS_MostLeftLine.m_Posy = STAMP_OY; - pos.y = ( refy - WsItem->m_Posy ) * aScalar; - - case WS_SEGMENT: - xg = aSz.x - aRB.x - WsItem->m_Endx; - yg = aSz.y - aRB.y - WsItem->m_Endy; - GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y, - xg * aScalar, yg * aScalar, aLnW, aClr1 ); break; } } - } - else - { - for( WsItem = &WS_CADRE_D; WsItem != NULL; WsItem = WsItem->Pnext ) - { - pos.x = ( refx - WsItem->m_Posx ) * aScalar; - pos.y = ( refy - WsItem->m_Posy ) * aScalar; - msg.Empty(); + // Sheet number + pos.x = (refx - Mm2mils( 5 )) * aScalar; + pos.y = (refy - Mm2mils( 4 )) * aScalar; + msg.Empty(); + msg << aScr; + DrawGraphicText( m_canvas, aDC, pos, aClr1, msg, + TEXT_ORIENT_HORIZ, size, GR_TEXT_HJUSTIFY_CENTER, + GR_TEXT_VJUSTIFY_CENTER, aLnW, false, false ); + + // Decimal number + msg = aTb.GetComment1(); + if( !msg.IsEmpty() ) + { + sz = size3; + lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar; + ln = Mm2mils( 109 ); + if( lnMsg > ln ) + sz.x *= float( ln ) / lnMsg; + pos.x = (refx - Mm2mils( 65 )) * aScalar; + pos.y = (refy - Mm2mils( 7.5 )) * aScalar; + DrawGraphicText( m_canvas, aDC, pos, aClr2, + msg, TEXT_ORIENT_HORIZ, sz, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, + aLnW, false, false ); + } + } + + // Format + pos.x = (refx - Mm2mils( 23 )) * aScalar; + pos.y = (refy + Mm2mils( 2.5 )) * aScalar; + msg.Empty(); + msg << aType; + DrawGraphicText( m_canvas, aDC, pos, aClr1, + msg, TEXT_ORIENT_HORIZ, size, + GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, + aLnW, false, false ); + + // Center - left bottom corner + refx = aLT.x; + refy = aSz.y - aRB.y; + for( WsItem = &WS_DopLeft_Line1; WsItem != NULL; WsItem = WsItem->Pnext ) + { + if( aScr > 1 && WsItem == &WS_DopLeft_Line9 ) // Some fields for first page only + break; + + pos.x = (refx - WsItem->m_Posx) * aScalar; + pos.y = (refy - WsItem->m_Posy) * aScalar; + end.x = (refx - WsItem->m_Endx) * aScalar; + end.y = (refy - WsItem->m_Endy) * aScalar; + msg = WsItem->m_Legende; + switch( WsItem->m_Type ) + { + case WS_OSN: + GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y, end.x, end.y, + lnWosn, aClr1 ); + break; + + case WS_TEXT: + if( !msg.IsEmpty() ) + DrawGraphicText( m_canvas, aDC, pos, aClr1, + msg, TEXT_ORIENT_VERT, size, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, + aLnW, false, false ); + break; + } + } + + if( aType == PAGE_INFO::A4 || aSz.x > aSz.y ) // A4 or Landscape + { + // Center - left top corner + refx = aLT.x; + refy = aLT.y; + for( WsItem = &WS_DopTop_Line1; WsItem != NULL; WsItem = WsItem->Pnext ) + { + if( aScr > 1 && WsItem == &WS_DopTop_Line3 ) // Some fields for first page only + break; + + pos.x = (refx + WsItem->m_Posx) * aScalar; + pos.y = (refy + WsItem->m_Posy) * aScalar; + end.x = (refx + WsItem->m_Endx) * aScalar; + end.y = (refy + WsItem->m_Endy) * aScalar; + msg = WsItem->m_Legende; switch( WsItem->m_Type ) { - case WS_CADRE: - // Begin list number > 1 - msg = aTb.GetComment1(); - if( !msg.IsEmpty() ) - { - DrawGraphicText( m_canvas, aDC, pos, aClr2, - msg, TEXT_ORIENT_HORIZ, size3, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, - aLnW, false, false ); - pos.x = (aLT.x + 1260) * aScalar; - pos.y = (aLT.y + 270) * aScalar; - DrawGraphicText( m_canvas, aDC, pos, aClr2, - msg, 1800, size2, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, - aLnW, false, false ); - } + case WS_OSN: + GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y, end.x, end.y, + lnWosn, aClr1 ); break; - case WS_PODPIS_D: - if( WsItem->m_Legende ) - msg = WsItem->m_Legende; - DrawGraphicText( m_canvas, aDC, pos, aClr1, - msg, TEXT_ORIENT_HORIZ, size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, - aLnW, false, false ); - break; - - case WS_IDENTSHEET_D: - if( WsItem->m_Legende ) - msg = WsItem->m_Legende; - msg << aScr; - DrawGraphicText( m_canvas, aDC, pos, aClr1, - msg, TEXT_ORIENT_HORIZ, size, - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, - aLnW, false, false ); - break; - - case WS_LEFT_SEGMENT_D: - pos.y = ( refy - WsItem->m_Posy ) * aScalar; - - case WS_SEGMENT_D: - xg = aSz.x - aRB.x - WsItem->m_Endx; - yg = aSz.y - aRB.y - WsItem->m_Endy; - GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y, - xg * aScalar, yg * aScalar, aLnW, aClr1 ); + case WS_TONK: + GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y, end.x, end.y, + lnWtonk, aClr1 ); break; } } + + // Decimal number + msg = aTb.GetComment1(); + if( !msg.IsEmpty() ) + { + sz = size2; + lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar; + ln = Mm2mils( 69 ); + if( lnMsg > ln ) + sz.x *= float( ln ) / lnMsg; + pos.x = (refx + Mm2mils( 35 )) * aScalar; + pos.y = (refy + Mm2mils( 7 )) * aScalar; + DrawGraphicText( m_canvas, aDC, pos, aClr2, + msg, 1800, sz, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, + aLnW, false, false ); + } + } + else // Portrait + { + // Center - right top corner + // Lines are used from the upper left corner by the change of coordinates + refx = aSz.x - aRB.x; + refy = aLT.y; + for( WsItem = &WS_DopTop_Line1; WsItem != NULL; WsItem = WsItem->Pnext ) + { + if( aScr > 1 && WsItem == &WS_DopTop_Line3 ) // Some fields for first page only + break; + + pos.x = (refx - WsItem->m_Posy) * aScalar; + pos.y = (refy + WsItem->m_Posx) * aScalar; + end.x = (refx - WsItem->m_Endy) * aScalar; + end.y = (refy + WsItem->m_Endx) * aScalar; + msg = WsItem->m_Legende; + switch( WsItem->m_Type ) + { + case WS_OSN: + GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y, end.x, end.y, + lnWosn, aClr1 ); + break; + + case WS_TONK: + GRLine( m_canvas->GetClipBox(), aDC, pos.x, pos.y, end.x, end.y, + lnWtonk, aClr1 ); + break; + } + } + + // Decimal number + msg = aTb.GetComment1(); + if( !msg.IsEmpty() ) + { + sz = size2; + lnMsg = ReturnGraphicTextWidth( msg, sz.x, false, false ) / aScalar; + ln = Mm2mils( 69 ); + if( lnMsg > ln ) + sz.x *= float( ln ) / lnMsg; + pos.x = (refx - Mm2mils( 7 )) * aScalar; + pos.y = (refy + Mm2mils( 35 )) * aScalar; + DrawGraphicText( m_canvas, aDC, pos, aClr2, + msg, TEXT_ORIENT_VERT, sz, + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, + aLnW, false, false ); + } } #else + // Draw the border. int ii, jj, ipas, gxpas, gypas; for( ii = 0; ii < 2; ii++ ) @@ -1602,6 +1871,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi } #endif + } diff --git a/eeschema/component_references_lister.cpp b/eeschema/component_references_lister.cpp index e576e9ace4..54d64a6455 100644 --- a/eeschema/component_references_lister.cpp +++ b/eeschema/component_references_lister.cpp @@ -155,7 +155,11 @@ static bool engStrToDouble( wxString aStr, double* aDouble ) aStr.Append( wxT( "R" ) ); // Regular expression for a value string, e.g., 47k2 +#if defined(KICAD_GOST) + static wxRegEx valueRegEx( wxT( "^([0-9]+)(мк|[pnumRkKMGT.,кнМГ])([0-9]*)(мк*|[pnumRkKMGTкнМГ]*)" ) ); +#else static wxRegEx valueRegEx( wxT( "^([0-9]+)([pnumRkKMGT.,])([0-9]*)([pnumRkKMGT]*)" ) ); +#endif if( !valueRegEx.Matches( aStr ) ) return false; @@ -164,7 +168,31 @@ static bool engStrToDouble( wxString aStr, double* aDouble ) + wxT( "." ) + valueRegEx.GetMatch( aStr, 3 ) ); wxString multiplierString = valueRegEx.GetMatch( aStr, 2 ); +#if defined(KICAD_GOST) + if ( multiplierString == wxT( "мк" ) ) + multiplierString = wxT( "u" ); + else if ( multiplierString == wxT( "к" ) ) + multiplierString = wxT( "k" ); + else if ( multiplierString == wxT( "н" ) ) + multiplierString = wxT( "n" ); + else if ( multiplierString == wxT( "Ðœ" ) ) + multiplierString = wxT( "M" ); + else if ( multiplierString == wxT( "Г" ) ) + multiplierString = wxT( "G" ); +#endif wxString post_multiplierString = valueRegEx.GetMatch( aStr, 4 ); +#if defined(KICAD_GOST) + if ( post_multiplierString == wxT( "мк" ) ) + multiplierString = wxT( "u" ); + else if ( post_multiplierString == wxT( "к" ) ) + multiplierString = wxT( "k" ); + else if ( post_multiplierString == wxT( "н" ) ) + multiplierString = wxT( "n" ); + else if ( post_multiplierString == wxT( "Ðœ" ) ) + multiplierString = wxT( "M" ); + else if ( post_multiplierString == wxT( "Г" ) ) + multiplierString = wxT( "G" ); +#endif double multiplier; switch( (wxChar)multiplierString[0] ) diff --git a/eeschema/lib_pin.h b/eeschema/lib_pin.h index ca731c1dfc..af07ad25b6 100644 --- a/eeschema/lib_pin.h +++ b/eeschema/lib_pin.h @@ -36,7 +36,7 @@ #define PIN_LENGTH 300 /* Default Length of each pin to be drawn. */ #if defined(KICAD_GOST) -#define INVERT_PIN_RADIUS 20 /* Radius of inverted pin circle. */ +#define INVERT_PIN_RADIUS 30 /* Radius of inverted pin circle. */ #else #define INVERT_PIN_RADIUS 35 /* Radius of inverted pin circle. */ #endif diff --git a/eeschema/libeditframe.cpp b/eeschema/libeditframe.cpp index 439e456dc9..ce82d3c848 100644 --- a/eeschema/libeditframe.cpp +++ b/eeschema/libeditframe.cpp @@ -469,7 +469,11 @@ void LIB_EDIT_FRAME::UpdatePartSelectList() for( int i = 0; i < m_component->GetPartCount(); i++ ) { wxString msg; +#if defined(KICAD_GOST) + msg.Printf( _( "Part %d" ), i + 1 ); +#else msg.Printf( _( "Part %c" ), 'A' + i ); +#endif m_partSelectBox->Append( msg ); } } diff --git a/eeschema/sch_junction.cpp b/eeschema/sch_junction.cpp index a8d7efab93..07c81f3cac 100644 --- a/eeschema/sch_junction.cpp +++ b/eeschema/sch_junction.cpp @@ -44,7 +44,11 @@ SCH_JUNCTION::SCH_JUNCTION( const wxPoint& pos ) : SCH_ITEM( NULL, SCH_JUNCTION_T ) { +#if defined(KICAD_GOST) +#define DRAWJUNCTION_DIAMETER 50 /* Diameter of junction symbol between wires by GOST*/ +#else #define DRAWJUNCTION_DIAMETER 32 /* Diameter of junction symbol between wires */ +#endif m_pos = pos; m_Layer = LAYER_JUNCTION; m_size.x = m_size.y = DRAWJUNCTION_DIAMETER; diff --git a/include/worksheet.h b/include/worksheet.h index 3f417528b8..5a27f45c1e 100644 --- a/include/worksheet.h +++ b/include/worksheet.h @@ -10,72 +10,17 @@ #include // Mm2mils() #define GRID_REF_W 70 // height of the band reference grid + +#if defined(KICAD_GOST) +#define SIZETEXT 100 // worksheet text size +#else #define SIZETEXT 60 // worksheet text size +#endif + #define SIZETEXT_REF 50 // worksheet frame reference text size #define PAS_REF 2000 // no reference markings on worksheet frame -#if defined(KICAD_GOST) - -// There is a page layout minor issue in GOST mode. -// This is the rounding-off error of 1 mil exactly. -// I hope this problem will go away when we will go -// to nanometers (zaka62). -#define STAMP_OX Mm2mils( 185 ) + 1 -#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 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 - +#if !defined(KICAD_GOST) // The coordinates below are relative to the bottom right corner of page and // will be subtracted from this origin. @@ -97,13 +42,15 @@ #define BLOCK_FILENAME_X BLOCK_OX - SIZETEXT #define BLOCK_FILENAME_Y (SIZETEXT * 9) #define BLOCK_COMMENT_X BLOCK_OX - SIZETEXT -#define VARIABLE_BLOCK_START_POSITION (SIZETEXT * 10) #define BLOCK_COMPANY_Y (SIZETEXT * 11) #define BLOCK_COMMENT1_Y (SIZETEXT * 13) #define BLOCK_COMMENT2_Y (SIZETEXT * 15) #define BLOCK_COMMENT3_Y (SIZETEXT * 17) #define BLOCK_COMMENT4_Y (SIZETEXT * 19) +#endif + +#define VARIABLE_BLOCK_START_POSITION (SIZETEXT * 10) struct Ki_WorkSheetData { @@ -119,17 +66,17 @@ public: /// Work sheet structure type definitions. enum TypeKi_WorkSheetData { +#if defined(KICAD_GOST) + WS_OSN, + WS_TONK, + WS_TEXT, + WS_TEXTL +#else WS_DATE, WS_REV, WS_KICAD_VERSION, -#if defined(KICAD_GOST) - WS_PODPIS, -#endif WS_SIZESHEET, WS_IDENTSHEET, -#if defined(KICAD_GOST) - WS_SHEETS, -#endif WS_TITLE, WS_FILENAME, WS_FULLSHEETNAME, @@ -141,20 +88,110 @@ enum TypeKi_WorkSheetData { WS_SEGMENT, WS_UPPER_SEGMENT, WS_LEFT_SEGMENT, -#if defined(KICAD_GOST) - WS_CADRE, - WS_LEFT_SEGMENT_D, - WS_SEGMENT_D, - WS_PODPIS_D, - WS_IDENTSHEET_D, - WS_SEGMENT_LU, - WS_SEGMENT_LT, - WS_PODPIS_LU -#else WS_CADRE #endif }; +#if defined(KICAD_GOST) + +extern Ki_WorkSheetData WS_Osn1_Line1; +extern Ki_WorkSheetData WS_Osn1_Line2; +extern Ki_WorkSheetData WS_Osn1_Line3; +extern Ki_WorkSheetData WS_Osn1_Line4; +extern Ki_WorkSheetData WS_Osn1_Line5; +extern Ki_WorkSheetData WS_Osn1_Line6; +extern Ki_WorkSheetData WS_Osn1_Line7; +extern Ki_WorkSheetData WS_Osn1_Line8; +extern Ki_WorkSheetData WS_Osn1_Line9; +extern Ki_WorkSheetData WS_Osn1_Line10; +extern Ki_WorkSheetData WS_Osn1_Line11; +extern Ki_WorkSheetData WS_Osn1_Line12; +extern Ki_WorkSheetData WS_Osn1_Line13; +extern Ki_WorkSheetData WS_Osn1_Line14; +extern Ki_WorkSheetData WS_Osn1_Line15; +extern Ki_WorkSheetData WS_Osn1_Line16; +extern Ki_WorkSheetData WS_Osn1_Line17; +extern Ki_WorkSheetData WS_Osn1_Line18; +extern Ki_WorkSheetData WS_Osn1_Line19; +extern Ki_WorkSheetData WS_Osn1_Line20; +extern Ki_WorkSheetData WS_Osn1_Line21; +extern Ki_WorkSheetData WS_Osn1_Line22; +extern Ki_WorkSheetData WS_Osn1_Line23; +extern Ki_WorkSheetData WS_Osn1_Line24; +extern Ki_WorkSheetData WS_Osn1_Line25; +extern Ki_WorkSheetData WS_Osn1_Line26; +extern Ki_WorkSheetData WS_Osn1_Line27; + +extern Ki_WorkSheetData WS_Osn1_Text1; +extern Ki_WorkSheetData WS_Osn1_Text2; +extern Ki_WorkSheetData WS_Osn1_Text3; +extern Ki_WorkSheetData WS_Osn1_Text4; +extern Ki_WorkSheetData WS_Osn1_Text5; +extern Ki_WorkSheetData WS_Osn1_Text6; +extern Ki_WorkSheetData WS_Osn1_Text7; +extern Ki_WorkSheetData WS_Osn1_Text8; +extern Ki_WorkSheetData WS_Osn1_Text9; +extern Ki_WorkSheetData WS_Osn1_Text10; +extern Ki_WorkSheetData WS_Osn1_Text11; +extern Ki_WorkSheetData WS_Osn1_Text12; +extern Ki_WorkSheetData WS_Osn1_Text13; +extern Ki_WorkSheetData WS_Osn1_Text14; +extern Ki_WorkSheetData WS_Osn1_Text15; +extern Ki_WorkSheetData WS_Osn1_Text16; +extern Ki_WorkSheetData WS_Osn1_Text17; + +extern Ki_WorkSheetData WS_Osn2a_Line1; +extern Ki_WorkSheetData WS_Osn2a_Line2; +extern Ki_WorkSheetData WS_Osn2a_Line3; +extern Ki_WorkSheetData WS_Osn2a_Line4; +extern Ki_WorkSheetData WS_Osn2a_Line5; +extern Ki_WorkSheetData WS_Osn2a_Line6; +extern Ki_WorkSheetData WS_Osn2a_Line7; +extern Ki_WorkSheetData WS_Osn2a_Line8; +extern Ki_WorkSheetData WS_Osn2a_Line9; +extern Ki_WorkSheetData WS_Osn2a_Line10; +extern Ki_WorkSheetData WS_Osn2a_Line11; + +extern Ki_WorkSheetData WS_Osn2a_Text1; +extern Ki_WorkSheetData WS_Osn2a_Text2; +extern Ki_WorkSheetData WS_Osn2a_Text3; +extern Ki_WorkSheetData WS_Osn2a_Text4; +extern Ki_WorkSheetData WS_Osn2a_Text5; +extern Ki_WorkSheetData WS_Osn2a_Text6; +extern Ki_WorkSheetData WS_Osn2a_Text7; +extern Ki_WorkSheetData WS_Osn2a_Text8; + +extern Ki_WorkSheetData WS_DopLeft_Line1; +extern Ki_WorkSheetData WS_DopLeft_Line2; +extern Ki_WorkSheetData WS_DopLeft_Line3; +extern Ki_WorkSheetData WS_DopLeft_Line4; +extern Ki_WorkSheetData WS_DopLeft_Line5; +extern Ki_WorkSheetData WS_DopLeft_Line6; +extern Ki_WorkSheetData WS_DopLeft_Line7; +extern Ki_WorkSheetData WS_DopLeft_Line8; +extern Ki_WorkSheetData WS_DopLeft_Line9; +extern Ki_WorkSheetData WS_DopLeft_Line10; +extern Ki_WorkSheetData WS_DopLeft_Line11; +extern Ki_WorkSheetData WS_DopLeft_Line12; +extern Ki_WorkSheetData WS_DopLeft_Line13; +extern Ki_WorkSheetData WS_DopLeft_Line14; + +extern Ki_WorkSheetData WS_DopLeft_Text1; +extern Ki_WorkSheetData WS_DopLeft_Text2; +extern Ki_WorkSheetData WS_DopLeft_Text3; +extern Ki_WorkSheetData WS_DopLeft_Text4; +extern Ki_WorkSheetData WS_DopLeft_Text5; +extern Ki_WorkSheetData WS_DopLeft_Text6; +extern Ki_WorkSheetData WS_DopLeft_Text7; + +extern Ki_WorkSheetData WS_DopTop_Line1; +extern Ki_WorkSheetData WS_DopTop_Line2; +extern Ki_WorkSheetData WS_DopTop_Line3; +extern Ki_WorkSheetData WS_DopTop_Line4; +extern Ki_WorkSheetData WS_DopTop_Line5; +extern Ki_WorkSheetData WS_DopTop_Line6; + +#else extern Ki_WorkSheetData WS_Date; extern Ki_WorkSheetData WS_Revision; extern Ki_WorkSheetData WS_Licence; @@ -176,85 +213,6 @@ extern Ki_WorkSheetData WS_Segm4; extern Ki_WorkSheetData WS_Segm5; extern Ki_WorkSheetData WS_Segm6; extern Ki_WorkSheetData WS_Segm7; - -#if defined(KICAD_GOST) -extern Ki_WorkSheetData WS_Izm; -extern Ki_WorkSheetData WS_Razr; -extern Ki_WorkSheetData WS_Prov; -extern Ki_WorkSheetData WS_TKon; -extern Ki_WorkSheetData WS_NKon; -extern Ki_WorkSheetData WS_Utv; -extern Ki_WorkSheetData WS_List; -extern Ki_WorkSheetData WS_NDoc; -extern Ki_WorkSheetData WS_Podp; -extern Ki_WorkSheetData WS_Data; -extern Ki_WorkSheetData WS_Art; -extern Ki_WorkSheetData WS_Mass; -extern Ki_WorkSheetData WS_Msht; -extern Ki_WorkSheetData WS_List1; -extern Ki_WorkSheetData WS_List2; -extern Ki_WorkSheetData WS_Segm8; -extern Ki_WorkSheetData WS_Segm9; -extern Ki_WorkSheetData WS_Segm10; -extern Ki_WorkSheetData WS_Segm11; -extern Ki_WorkSheetData WS_Segm12; -extern Ki_WorkSheetData WS_Segm13; -extern Ki_WorkSheetData WS_Segm14; -extern Ki_WorkSheetData WS_Segm15; -extern Ki_WorkSheetData WS_Segm16; -extern Ki_WorkSheetData WS_Segm17; -extern Ki_WorkSheetData WS_Segm18; -extern Ki_WorkSheetData WS_Segm19; -extern Ki_WorkSheetData WS_Segm20; -extern Ki_WorkSheetData WS_Segm21; -extern Ki_WorkSheetData WS_Segm22; -extern Ki_WorkSheetData WS_Segm23; -extern Ki_WorkSheetData WS_Segm24; -extern Ki_WorkSheetData WS_Segm25; -extern Ki_WorkSheetData WS_CADRE_D; -extern Ki_WorkSheetData WS_Segm1_D; -extern Ki_WorkSheetData WS_Segm2_D; -extern Ki_WorkSheetData WS_Segm3_D; -extern Ki_WorkSheetData WS_Segm4_D; -extern Ki_WorkSheetData WS_Segm5_D; -extern Ki_WorkSheetData WS_Segm6_D; -extern Ki_WorkSheetData WS_Segm7_D; -extern Ki_WorkSheetData WS_Segm8_D; -extern Ki_WorkSheetData WS_Segm9_D; -extern Ki_WorkSheetData WS_Segm10_D; -extern Ki_WorkSheetData WS_Segm11_D; -extern Ki_WorkSheetData WS_Izm_D; -extern Ki_WorkSheetData WS_List_D; -extern Ki_WorkSheetData WS_NDoc_D; -extern Ki_WorkSheetData WS_Podp_D; -extern Ki_WorkSheetData WS_Date_D; -extern Ki_WorkSheetData WS_List1_D; -extern Ki_WorkSheetData WS_ListN_D; -extern Ki_WorkSheetData WS_Segm1_LU; -extern Ki_WorkSheetData WS_Segm2_LU; -extern Ki_WorkSheetData WS_Segm3_LU; -extern Ki_WorkSheetData WS_Segm4_LU; -extern Ki_WorkSheetData WS_Segm5_LU; -extern Ki_WorkSheetData WS_Segm6_LU; -extern Ki_WorkSheetData WS_Segm7_LU; -extern Ki_WorkSheetData WS_Segm8_LU; -extern Ki_WorkSheetData WS_Segm9_LU; -extern Ki_WorkSheetData WS_Segm10_LU; -extern Ki_WorkSheetData WS_Segm11_LU; -extern Ki_WorkSheetData WS_Segm12_LU; -extern Ki_WorkSheetData WS_Segm13_LU; -extern Ki_WorkSheetData WS_Podp1_LU; -extern Ki_WorkSheetData WS_Podp2_LU; -extern Ki_WorkSheetData WS_Podp3_LU; -extern Ki_WorkSheetData WS_Podp4_LU; -extern Ki_WorkSheetData WS_Podp5_LU; -extern Ki_WorkSheetData WS_Podp6_LU; -extern Ki_WorkSheetData WS_Podp7_LU; -extern Ki_WorkSheetData WS_Segm1_LT; -extern Ki_WorkSheetData WS_Segm2_LT; -extern Ki_WorkSheetData WS_Segm3_LT; -extern Ki_WorkSheetData WS_Segm4_LT; -extern Ki_WorkSheetData WS_Segm5_LT; #endif #endif // WORKSHEET_H_ diff --git a/pcbnew/export_vrml.cpp b/pcbnew/export_vrml.cpp old mode 100755 new mode 100644 diff --git a/pcbnew/gpcb_plugin.cpp b/pcbnew/gpcb_plugin.cpp index 9e77743a07..8e16cbe103 100644 --- a/pcbnew/gpcb_plugin.cpp +++ b/pcbnew/gpcb_plugin.cpp @@ -924,7 +924,7 @@ bool GPCB_PLUGIN::FootprintLibDelete( const wxString& aLibraryPath, PROPERTIES* if( tmp.GetExt() != KiCadFootprintFileExtension ) { - THROW_IO_ERROR( wxString::Format( _( "unexpected file '%s' has found in library path '%'" ), + THROW_IO_ERROR( wxString::Format( _( "unexpected file '%s' has found in library path '%s'" ), files[i].GetData(), aLibraryPath.GetData() ) ); } } diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index 5687d8ec78..2411ba9c54 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -1770,7 +1770,7 @@ bool PCB_IO::FootprintLibDelete( const wxString& aLibraryPath, PROPERTIES* aProp if( tmp.GetExt() != KiCadFootprintFileExtension ) { - THROW_IO_ERROR( wxString::Format( _( "unexpected file '%s' has found in library path '%'" ), + THROW_IO_ERROR( wxString::Format( _( "unexpected file '%s' has found in library path '%s'" ), files[i].GetData(), aLibraryPath.GetData() ) ); } } From 4865a68fa0ead81617d63cb4039e25707baa88fd Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Thu, 28 Mar 2013 07:40:19 +0100 Subject: [PATCH 15/63] Extremely trivial stuff (mostly cosmetics) --- eeschema/dialogs/dialog_edit_label.cpp | 2 +- .../dialogs/dialog_print_using_printer.cpp | 2 +- pcbnew/attribut.cpp | 2 +- pcbnew/class_text_mod.h | 11 -------- pcbnew/clean.cpp | 22 ++++++++-------- pcbnew/connect.cpp | 2 +- pcbnew/deltrack.cpp | 2 +- pcbnew/dialogs/dialog_edit_module_text.cpp | 2 +- pcbnew/dragsegm.cpp | 8 +++--- pcbnew/modules.cpp | 8 +++--- pcbnew/move-drag_pads.cpp | 4 +-- pcbnew/tr_modif.cpp | 26 +++++++++---------- 12 files changed, 40 insertions(+), 51 deletions(-) diff --git a/eeschema/dialogs/dialog_edit_label.cpp b/eeschema/dialogs/dialog_edit_label.cpp index a4bd0f3ca4..70424476a2 100644 --- a/eeschema/dialogs/dialog_edit_label.cpp +++ b/eeschema/dialogs/dialog_edit_label.cpp @@ -140,7 +140,7 @@ void DIALOG_LABEL_EDITOR::InitDialog() break; } - int MINTEXTWIDTH = 40; // M's are big characters, a few establish a lot of width + const int MINTEXTWIDTH = 40; // M's are big characters, a few establish a lot of width int max_len = 0; diff --git a/gerbview/dialogs/dialog_print_using_printer.cpp b/gerbview/dialogs/dialog_print_using_printer.cpp index ab2ff965ba..c5619e3d2b 100644 --- a/gerbview/dialogs/dialog_print_using_printer.cpp +++ b/gerbview/dialogs/dialog_print_using_printer.cpp @@ -138,7 +138,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) s_Parameters.m_PageSetupData = g_pageSetupData; layer_max = 32; - /* Create layer list */ + // Create layer list int mask = 1, ii; for( ii = 0; ii < layer_max; ii++, mask <<= 1 ) { diff --git a/pcbnew/attribut.cpp b/pcbnew/attribut.cpp index 6d8eba2471..2bc380abf1 100644 --- a/pcbnew/attribut.cpp +++ b/pcbnew/attribut.cpp @@ -80,7 +80,7 @@ void PCB_EDIT_FRAME::Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On ) for( ; (Track != NULL) && (nb_segm > 0); nb_segm-- ) { Track->SetState( TRACK_LOCKED, Flag_On ); - Track->SetState( BUSY, OFF ); + Track->SetState( BUSY, false ); Track = Track->Next(); } diff --git a/pcbnew/class_text_mod.h b/pcbnew/class_text_mod.h index 5042b27875..6394f0a7c8 100644 --- a/pcbnew/class_text_mod.h +++ b/pcbnew/class_text_mod.h @@ -132,17 +132,6 @@ public: bool IsOnLayer( int aLayer ) const; - /* - * Function IsOnOneOfTheseLayers - * returns true if this object is on one of the given layers. Is virtual - * so objects like D_PAD, which reside on multiple layers, can do their own - * form of testing. - * virtual inheritance from BOARD_ITEM. (not yet written) - * @param aLayerMask The bit-mapped set of layers to test for. - * @return bool - true if on one of the given layers, else false. - * bool IsOnOneOfTheseLayers( int aLayerMask ) const; - */ - wxString GetClass() const { diff --git a/pcbnew/clean.cpp b/pcbnew/clean.cpp index ec60732ccb..b2b5e7a1fe 100644 --- a/pcbnew/clean.cpp +++ b/pcbnew/clean.cpp @@ -345,7 +345,7 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks() if( other && other->Type() == PCB_VIA_T ) { // search for another segment following the via - track->SetState( BUSY, ON ); + track->SetState( BUSY, true ); SEGVIA* via = (SEGVIA*) other; other = via->GetTrace( m_Brd->m_Track, NULL, FLG_START ); @@ -360,7 +360,7 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks() if( (other == NULL) && (zone == NULL) ) flag_erase |= 2; - track->SetState( BUSY, OFF ); + track->SetState( BUSY, false ); } } } @@ -401,7 +401,7 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks() { // search for another segment following the via - track->SetState( BUSY, ON ); + track->SetState( BUSY, true ); SEGVIA* via = (SEGVIA*) other; other = via->GetTrace( m_Brd->m_Track, NULL, FLG_END ); @@ -416,7 +416,7 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks() if( (other == NULL) && (zone == NULL) ) flag_erase |= 0x20; - track->SetState( BUSY, OFF ); + track->SetState( BUSY, false ); } } } @@ -520,9 +520,9 @@ bool TRACKS_CLEANER::clean_segments() break; // We must have only one segment connected - segStart->SetState( BUSY, ON ); + segStart->SetState( BUSY, true ); other = segment->GetTrace( m_Brd->m_Track, NULL, FLG_START ); - segStart->SetState( BUSY, OFF ); + segStart->SetState( BUSY, false ); if( other == NULL ) flag = 1; // OK @@ -558,9 +558,9 @@ bool TRACKS_CLEANER::clean_segments() break; // We must have only one segment connected - segEnd->SetState( BUSY, ON ); + segEnd->SetState( BUSY, true ); other = segment->GetTrace( m_Brd->m_Track, NULL, FLG_END ); - segEnd->SetState( BUSY, OFF ); + segEnd->SetState( BUSY, false ); if( other == NULL ) flag |= 2; // Ok @@ -731,7 +731,7 @@ bool PCB_EDIT_FRAME::RemoveMisConnectedTracks() for( segment = GetBoard()->m_Track; segment; segment = (TRACK*) segment->Next() ) { - segment->SetState( FLAG0, OFF ); + segment->SetState( FLAG0, false ); // find the netcode for segment using anything connected to the "start" of "segment" net_code_s = -1; @@ -773,7 +773,7 @@ bool PCB_EDIT_FRAME::RemoveMisConnectedTracks() // Netcodes do not agree, so mark the segment as "to be removed" if( net_code_s != net_code_e ) { - segment->SetState( FLAG0, ON ); + segment->SetState( FLAG0, true ); } } @@ -784,7 +784,7 @@ bool PCB_EDIT_FRAME::RemoveMisConnectedTracks() if( segment->GetState( FLAG0 ) ) // Segment is flagged to be removed { - segment->SetState( FLAG0, OFF ); + segment->SetState( FLAG0, false ); isModified = true; GetBoard()->m_Status_Pcb = 0; Remove_One_Track( NULL, segment ); diff --git a/pcbnew/connect.cpp b/pcbnew/connect.cpp index 5b3699fd8f..f734899928 100644 --- a/pcbnew/connect.cpp +++ b/pcbnew/connect.cpp @@ -840,7 +840,7 @@ void PCB_BASE_FRAME::RecalculateAllTracksNetcode() curr_track->m_PadsConnected.clear(); curr_track->start = NULL; curr_track->end = NULL; - curr_track->SetState( BUSY | IN_EDIT | BEGIN_ONPAD | END_ONPAD, OFF ); + curr_track->SetState( BUSY | IN_EDIT | BEGIN_ONPAD | END_ONPAD, false ); curr_track->SetZoneSubNet( 0 ); curr_track->SetNet( 0 ); // net code = 0 means not connected } diff --git a/pcbnew/deltrack.cpp b/pcbnew/deltrack.cpp index a9a4bb78a5..b69e4bd487 100644 --- a/pcbnew/deltrack.cpp +++ b/pcbnew/deltrack.cpp @@ -213,7 +213,7 @@ void PCB_EDIT_FRAME::Remove_One_Track( wxDC* DC, TRACK* pt_segm ) for( ; ii < segments_to_delete_count; ii++, tracksegment = next_track ) { next_track = tracksegment->Next(); - tracksegment->SetState( BUSY, OFF ); + tracksegment->SetState( BUSY, false ); D( std::cout << __func__ << ": track " << tracksegment << " status=" \ << TO_UTF8( TRACK::ShowState( tracksegment->GetState( -1 ) ) ) \ diff --git a/pcbnew/dialogs/dialog_edit_module_text.cpp b/pcbnew/dialogs/dialog_edit_module_text.cpp index d0b2b329fd..c75de02cfe 100644 --- a/pcbnew/dialogs/dialog_edit_module_text.cpp +++ b/pcbnew/dialogs/dialog_edit_module_text.cpp @@ -134,7 +134,7 @@ void DialogEditModuleText::initDlg( ) PutValueInLocalUnits( *m_TxtWidthCtlr, m_currentText->GetThickness() ); int text_orient = m_currentText->GetOrientation(); - NORMALIZE_ANGLE_90(text_orient) + NORMALIZE_ANGLE_90( text_orient ); if( (text_orient != 0) ) m_Orient->SetSelection( 1 ); diff --git a/pcbnew/dragsegm.cpp b/pcbnew/dragsegm.cpp index c9eecbcf94..0da2c00240 100644 --- a/pcbnew/dragsegm.cpp +++ b/pcbnew/dragsegm.cpp @@ -209,7 +209,7 @@ void DRAG_LIST::fillList( CONNECTIONS& aConnections ) TRACK * track = pad->m_TracksConnected[jj]; track->start = NULL; track->end = NULL; - track->SetState( START_ON_PAD|END_ON_PAD|BUSY, OFF ); + track->SetState( START_ON_PAD|END_ON_PAD|BUSY, false ); } } @@ -226,13 +226,13 @@ void DRAG_LIST::fillList( CONNECTIONS& aConnections ) if( pad->HitTest( track->GetStart() ) ) { track->start = pad; - track->SetState( START_ON_PAD, ON ); + track->SetState( START_ON_PAD, false ); } if( pad->HitTest( track->GetEnd() ) ) { track->end = pad; - track->SetState( END_ON_PAD, ON ); + track->SetState( END_ON_PAD, false ); } DRAG_SEGM_PICKER wrapper( track ); @@ -407,7 +407,7 @@ void UndrawAndMarkSegmentsToDrag( EDA_DRAW_PANEL* aCanvas, wxDC* aDC ) TRACK* track = g_DragSegmentList[ii].m_Track; track->Draw( aCanvas, aDC, GR_XOR ); - track->SetState( IN_EDIT, ON ); + track->SetState( IN_EDIT, false ); if( g_DragSegmentList[ii].m_Flag & STARTPOINT ) track->SetFlags( STARTPOINT ); diff --git a/pcbnew/modules.cpp b/pcbnew/modules.cpp index ffb9131cdb..7d5c46da58 100644 --- a/pcbnew/modules.cpp +++ b/pcbnew/modules.cpp @@ -129,7 +129,7 @@ void PCB_EDIT_FRAME::StartMoveModule( MODULE* aModule, wxDC* aDC, TRACK* segm = g_DragSegmentList[ii].m_Track; itemWrapper.SetItem( segm ); itemWrapper.SetLink( segm->Clone() ); - itemWrapper.GetLink()->SetState( IN_EDIT, OFF ); + itemWrapper.GetLink()->SetState( IN_EDIT, false ); s_PickedList.PushItem( itemWrapper ); } @@ -179,7 +179,7 @@ void Abort_MoveOrCopyModule( EDA_DRAW_PANEL* Panel, wxDC* DC ) { pt_segm = g_DragSegmentList[ii].m_Track; pt_segm->Draw( Panel, DC, GR_XOR ); - pt_segm->SetState( IN_EDIT, OFF ); + pt_segm->SetState( IN_EDIT, false ); g_DragSegmentList[ii].RestoreInitialValues(); pt_segm->Draw( Panel, DC, GR_OR ); } @@ -276,7 +276,7 @@ bool PCB_EDIT_FRAME::Delete_Module( MODULE* aModule, wxDC* aDC, bool aAskBeforeD /* Remove module from list, and put it in undo command list */ m_Pcb->m_Modules.Remove( aModule ); - aModule->SetState( IS_DELETED, ON ); + aModule->SetState( IS_DELETED, true ); SaveCopyInUndoList( aModule, UR_DELETED ); if( aDC && GetBoard()->IsElementVisible( RATSNEST_VISIBLE ) ) @@ -404,7 +404,7 @@ void PCB_BASE_FRAME::PlaceModule( MODULE* aModule, wxDC* aDC, bool aDoNotRecreat for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ ) { TRACK * track = g_DragSegmentList[ii].m_Track; - track->SetState( IN_EDIT, OFF ); + track->SetState( IN_EDIT, false ); if( aDC ) track->Draw( m_canvas, aDC, GR_OR ); diff --git a/pcbnew/move-drag_pads.cpp b/pcbnew/move-drag_pads.cpp index 0134d48c6d..0c35d4e11a 100644 --- a/pcbnew/move-drag_pads.cpp +++ b/pcbnew/move-drag_pads.cpp @@ -46,7 +46,7 @@ static void Abort_Move_Pad( EDA_DRAW_PANEL* Panel, wxDC* DC ) { TRACK* Track = g_DragSegmentList[ii].m_Track; Track->Draw( Panel, DC, GR_XOR ); - Track->SetState( IN_EDIT, OFF ); + Track->SetState( IN_EDIT, false ); g_DragSegmentList[ii].RestoreInitialValues(); Track->Draw( Panel, DC, GR_OR ); } @@ -177,7 +177,7 @@ void PCB_BASE_FRAME::PlacePad( D_PAD* aPad, wxDC* DC ) if( g_DragSegmentList[ii].m_Pad_End ) Track->SetEnd( aPad->GetPosition() ); - Track->SetState( IN_EDIT, OFF ); + Track->SetState( IN_EDIT, false ); if( DC ) Track->Draw( m_canvas, DC, GR_OR ); diff --git a/pcbnew/tr_modif.cpp b/pcbnew/tr_modif.cpp index 8c31cc32f0..69abe49d35 100644 --- a/pcbnew/tr_modif.cpp +++ b/pcbnew/tr_modif.cpp @@ -75,7 +75,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC, /* Reconstruct the complete track (the new track has to start on a segment of track). */ - ListSetState( aNewTrack, aNewTrackSegmentsCount, BUSY, OFF ); + ListSetState( aNewTrack, aNewTrackSegmentsCount, BUSY, false ); /* If the new track begins with a via, complete the track segment using * the following segment as a reference because a via is often a hub of @@ -114,7 +114,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC, for( pt_del = bufStart; pt_del; pt_del = pt_del->Next() ) { // D( std::cout<<"track "<SetState( BUSY | IN_EDIT | IS_LINKED, OFF ); + pt_del->SetState( BUSY | IN_EDIT | IS_LINKED, false ); if( pt_del == bufEnd ) // Last segment reached break; @@ -162,7 +162,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC, } // Mark as deleted a new track (which is not involved in the search for other connections) - ListSetState( aNewTrack, aNewTrackSegmentsCount, IS_DELETED, ON ); + ListSetState( aNewTrack, aNewTrackSegmentsCount, IS_DELETED, true ); /* A segment must be connected to the starting point, otherwise * it is unnecessary to analyze the other point @@ -172,7 +172,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC, if( pt_segm == NULL ) // Not connected to the track starting point. { // Clear the delete flag. - ListSetState( aNewTrack, aNewTrackSegmentsCount, IS_DELETED, OFF ); + ListSetState( aNewTrack, aNewTrackSegmentsCount, IS_DELETED, false ); return 0; } @@ -191,7 +191,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC, { if( pt_segm->GetState( IS_LINKED ) == 0 ) { - pt_segm->SetState( IS_LINKED, ON ); + pt_segm->SetState( IS_LINKED, true ); nbconnect++; } } @@ -207,7 +207,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC, // Clear used flags for( pt_del = bufStart; pt_del; pt_del = pt_del->Next() ) { - pt_del->SetState( BUSY | IS_DELETED | IN_EDIT | IS_LINKED, OFF ); + pt_del->SetState( BUSY | IS_DELETED | IN_EDIT | IS_LINKED, false ); if( pt_del == bufEnd ) // Last segment reached break; @@ -217,8 +217,8 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC, } // Mark trace as edited (which does not involve searching for other tracks) - ListSetState( aNewTrack, aNewTrackSegmentsCount, IS_DELETED, OFF ); - ListSetState( aNewTrack, aNewTrackSegmentsCount, IN_EDIT, ON ); + ListSetState( aNewTrack, aNewTrackSegmentsCount, IS_DELETED, false ); + ListSetState( aNewTrack, aNewTrackSegmentsCount, IN_EDIT, true ); // Test all marked segments. while( nbconnect ) @@ -233,7 +233,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC, } nbconnect--; - pt_del->SetState( IS_LINKED, OFF ); + pt_del->SetState( IS_LINKED, false ); pt_del = GetBoard()->MarkTrace( pt_del, &nb_segm, NULL, NULL, true ); @@ -278,13 +278,13 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC, { if( pt_del->GetState( IN_EDIT ) ) { - pt_del->SetState( IN_EDIT, OFF ); + pt_del->SetState( IN_EDIT, false ); if( aDC ) pt_del->Draw( m_canvas, aDC, GR_OR ); } - pt_del->SetState( IN_EDIT | IS_LINKED, OFF ); + pt_del->SetState( IN_EDIT | IS_LINKED, false ); } return 1; @@ -292,13 +292,13 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC, } // Clear BUSY flag here because the track did not get marked. - ListSetState( pt_del, nb_segm, BUSY, OFF ); + ListSetState( pt_del, nb_segm, BUSY, false ); } // Clear used flags for( pt_del = m_Pcb->m_Track; pt_del; pt_del = pt_del->Next() ) { - pt_del->SetState( BUSY | IS_DELETED | IN_EDIT | IS_LINKED, OFF ); + pt_del->SetState( BUSY | IS_DELETED | IN_EDIT | IS_LINKED, false ); if( pt_del == bufEnd ) // Last segment reached break; From 3c037a3c31a0be9f68ee285796e89f66ec8ea56a Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 28 Mar 2013 10:40:29 +0100 Subject: [PATCH 16/63] Pcbnew, Module Editor: fix bug Bug #1161114 (pad not visible after undoing a move pad) --- pcbnew/move-drag_pads.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pcbnew/move-drag_pads.cpp b/pcbnew/move-drag_pads.cpp index 0c35d4e11a..7cc032af6a 100644 --- a/pcbnew/move-drag_pads.cpp +++ b/pcbnew/move-drag_pads.cpp @@ -149,6 +149,7 @@ void PCB_BASE_FRAME::PlacePad( D_PAD* aPad, wxDC* DC ) } // Save old module and old items values + aPad->ClearFlags(); wxPoint pad_curr_position = aPad->GetPosition(); aPad->SetPosition( Pad_OldPos ); @@ -192,8 +193,6 @@ void PCB_BASE_FRAME::PlacePad( D_PAD* aPad, wxDC* DC ) aPad->SetX0( dX + aPad->GetPos0().x ); aPad->SetY0( dY + aPad->GetPos0().y ); - aPad->ClearFlags(); - if( DC ) aPad->Draw( m_canvas, DC, GR_OR ); From cd18ff1762a4d78498c61279a4264e28445a5578 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Thu, 28 Mar 2013 12:51:22 -0400 Subject: [PATCH 17/63] Fix X3D patch commit coding policy issues. --- 3d-viewer/3d_read_mesh.cpp | 29 ++-- 3d-viewer/modelparsers.h | 56 ++++--- 3d-viewer/vrmlmodelparser.cpp | 39 ++--- 3d-viewer/x3dmodelparser.cpp | 267 +++++++++++++++++-------------- common/common_plot_functions.cpp | 2 +- include/wxPcbStruct.h | 11 ++ pcbnew/export_vrml.cpp | 88 +++++----- 7 files changed, 265 insertions(+), 227 deletions(-) diff --git a/3d-viewer/3d_read_mesh.cpp b/3d-viewer/3d_read_mesh.cpp index c91b2ff859..11f356f8e9 100644 --- a/3d-viewer/3d_read_mesh.cpp +++ b/3d-viewer/3d_read_mesh.cpp @@ -41,16 +41,17 @@ // Imported function: extern void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits ); -S3D_MODEL_PARSER* S3D_MODEL_PARSER::Create( S3D_MASTER* aMaster, - const wxString aExtension ) + +S3D_MODEL_PARSER* S3D_MODEL_PARSER::Create( S3D_MASTER* aMaster, + const wxString aExtension ) { if ( aExtension == wxT( "x3d" ) ) { - return new X3D_MODEL_PARSER(aMaster); + return new X3D_MODEL_PARSER( aMaster ); } else if ( aExtension == wxT( "wrl" ) ) { - return new VRML_MODEL_PARSER(aMaster); + return new VRML_MODEL_PARSER( aMaster ); } else { @@ -58,6 +59,7 @@ S3D_MODEL_PARSER* S3D_MODEL_PARSER::Create( S3D_MASTER* aMaster, } } + int S3D_MASTER::ReadData() { wxFileName fn; @@ -69,16 +71,17 @@ int S3D_MASTER::ReadData() } wxString shape3DNname = m_Shape3DName; + #ifdef __WINDOWS__ - shape3DNname.Replace( wxT("/"), wxT("\\") ); + shape3DNname.Replace( wxT( "/" ), wxT( "\\" ) ); #else - shape3DNname.Replace( wxT("\\"), wxT("/") ); + shape3DNname.Replace( wxT( "\\" ), wxT( "/" ) ); #endif if( wxFileName::FileExists( shape3DNname ) ) { FullFilename = shape3DNname; - fn.Assign(FullFilename); + fn.Assign( FullFilename ); } else { @@ -94,14 +97,15 @@ int S3D_MASTER::ReadData() } wxString extension = fn.GetExt(); - S3D_MODEL_PARSER* parser = S3D_MODEL_PARSER::Create(this, extension); - if(parser) + S3D_MODEL_PARSER* parser = S3D_MODEL_PARSER::Create( this, extension ); + + if( parser ) { - parser->Load(FullFilename); + parser->Load( FullFilename ); delete parser; return 0; - } - else + } + else { wxLogDebug( wxT( "Unknown file type <%s>" ), GetChars( extension ) ); } @@ -109,6 +113,7 @@ int S3D_MASTER::ReadData() return -1; } + int STRUCT_3D_SHAPE::ReadData( FILE* file, int* LineNum ) { char line[512]; diff --git a/3d-viewer/modelparsers.h b/3d-viewer/modelparsers.h index 55e2dc738e..7153c21ba2 100644 --- a/3d-viewer/modelparsers.h +++ b/3d-viewer/modelparsers.h @@ -49,8 +49,8 @@ class X3D_MODEL_PARSER; class S3D_MODEL_PARSER { public: - S3D_MODEL_PARSER(S3D_MASTER* aMaster) - :master(aMaster) + S3D_MODEL_PARSER(S3D_MASTER* aMaster) : + master( aMaster ) {} virtual ~S3D_MODEL_PARSER() @@ -64,19 +64,18 @@ public: /** * Function Create * Factory method for creating concrete 3D model parsers - * Notice that the caller is responible to delete created parser. + * Notice that the caller is responsible to delete created parser. * * @param aMaster is master object that the parser will fill. * @param aExtension is file extension of the file you are going to parse. */ - static S3D_MODEL_PARSER* Create( S3D_MASTER* aMaster, - const wxString aExtension ); + static S3D_MODEL_PARSER* Create( S3D_MASTER* aMaster, const wxString aExtension ); /** * Function Load * * Concrete parsers should implement this function */ - virtual void Load(const wxString aFilename) = 0; + virtual void Load( const wxString aFilename ) = 0; private: S3D_MASTER* master; @@ -92,9 +91,9 @@ class wxXmlNode; class X3D_MODEL_PARSER: public S3D_MODEL_PARSER { public: - X3D_MODEL_PARSER(S3D_MASTER* aMaster); + X3D_MODEL_PARSER( S3D_MASTER* aMaster ); ~X3D_MODEL_PARSER(); - void Load(const wxString aFilename); + void Load( const wxString aFilename ); typedef std::map< wxString, wxString > PROPERTY_MAP; typedef std::vector< wxXmlNode* > NODE_LIST; @@ -107,8 +106,7 @@ public: * @param aName is the name of node you try to find * @param aResult contains found nodes */ - static void GetChildsByName(wxXmlNode* aParent, const wxString aName, - NODE_LIST& aResult); + static void GetChildsByName( wxXmlNode* aParent, const wxString aName, NODE_LIST& aResult ); /** * Function GetNodeProperties @@ -116,7 +114,7 @@ public: * * @param aProps contains map of found properties */ - static void GetNodeProperties(wxXmlNode* aNode, PROPERTY_MAP& aProps); + static void GetNodeProperties( wxXmlNode* aNode, PROPERTY_MAP& aProps ); /** * Return string representing x3d file in vrml format @@ -126,17 +124,16 @@ public: wxString VRML_representation(); private: - std::vector vrml_materials; - std::vector vrml_points; - std::vector vrml_coord_indexes; + std::vector< wxString > vrml_materials; + std::vector< wxString > vrml_points; + std::vector< wxString > vrml_coord_indexes; void readTransform( wxXmlNode* aTransformNode ); void readMaterial( wxXmlNode* aMatNode ); - void readIndexedFaceSet( wxXmlNode* aFaceNode, - PROPERTY_MAP& aTransfromProps ); + void readIndexedFaceSet( wxXmlNode* aFaceNode, PROPERTY_MAP& aTransfromProps ); bool parseDoubleTriplet( const wxString& aData, S3D_VERTEX& aResult ); - void rotate( S3D_VERTEX& aCoordinate, S3D_VERTEX& aRotAxis, double angle); + void rotate( S3D_VERTEX& aCoordinate, S3D_VERTEX& aRotAxis, double angle ); }; /** @@ -146,9 +143,9 @@ private: class VRML_MODEL_PARSER: public S3D_MODEL_PARSER { public: - VRML_MODEL_PARSER(S3D_MASTER* aMaster); + VRML_MODEL_PARSER( S3D_MASTER* aMaster ); ~VRML_MODEL_PARSER(); - void Load(const wxString aFilename); + void Load( const wxString aFilename ); private: /** @@ -170,7 +167,26 @@ private: int readShape( FILE* file, int* LineNum ); int readAppearance( FILE* file, int* LineNum ); int readGeometry( FILE* file, int* LineNum ); - void readCoordsList( FILE* file, char* text_buffer, std::vector< double >& aList, int* LineNum ); + + /** + * Function ReadCoordList + * reads 3D coordinate lists like: + * coord Coordinate { point [ + * -5.24489 6.57640e-3 -9.42129e-2, + * -5.11821 6.57421e-3 0.542654, + * -3.45868 0.256565 1.32000 ] } + * or: + * normal Normal { vector [ + * 0.995171 -6.08102e-6 9.81541e-2, + * 0.923880 -4.09802e-6 0.382683, + * 0.707107 -9.38186e-7 0.707107] + * } + * + * text_buffer contains the first line of this node : + * "coord Coordinate { point [" + */ + void readCoordsList( FILE* file, char* text_buffer, std::vector< double >& aList, + int* LineNum ); }; #endif // MODELPARSERS_H diff --git a/3d-viewer/vrmlmodelparser.cpp b/3d-viewer/vrmlmodelparser.cpp index cbb3205e41..20ec219991 100644 --- a/3d-viewer/vrmlmodelparser.cpp +++ b/3d-viewer/vrmlmodelparser.cpp @@ -36,19 +36,21 @@ #include "3d_struct.h" #include "modelparsers.h" - + // separator chars static const char* sep_chars = " \t\n\r"; -VRML_MODEL_PARSER::VRML_MODEL_PARSER(S3D_MASTER* aMaster) -:S3D_MODEL_PARSER(aMaster) +VRML_MODEL_PARSER::VRML_MODEL_PARSER( S3D_MASTER* aMaster ) : + S3D_MODEL_PARSER( aMaster ) {} + VRML_MODEL_PARSER::~VRML_MODEL_PARSER() {} -void VRML_MODEL_PARSER::Load(const wxString aFilename) -{ + +void VRML_MODEL_PARSER::Load( const wxString aFilename ) +{ char line[1024], * text; FILE* file; int LineNum = 0; @@ -67,7 +69,7 @@ void VRML_MODEL_PARSER::Load(const wxString aFilename) { text = strtok( line, sep_chars ); - if( stricmp( text, "DEF" ) == 0 || stricmp( text, "Group" ) == 0) + if( stricmp( text, "DEF" ) == 0 || stricmp( text, "Group" ) == 0 ) { while( GetLine( file, line, &LineNum, 512 ) ) { @@ -91,6 +93,7 @@ void VRML_MODEL_PARSER::Load(const wxString aFilename) SetLocaleTo_Default(); // revert to the current locale } + int VRML_MODEL_PARSER::readMaterial( FILE* file, int* LineNum ) { char line[512], * text, * command; @@ -258,7 +261,8 @@ int VRML_MODEL_PARSER::readAppearance( FILE* file, int* LineNum ) if( *text == '}' ) { - err = 0; break; + err = 0; + break; } if( stricmp( text, "material" ) == 0 ) @@ -278,24 +282,8 @@ int VRML_MODEL_PARSER::readAppearance( FILE* file, int* LineNum ) #define BUFSIZE 2000 -/** - * Function ReadCoordList - * reads 3D coordinate lists like: - * coord Coordinate { point [ - * -5.24489 6.57640e-3 -9.42129e-2, - * -5.11821 6.57421e-3 0.542654, - * -3.45868 0.256565 1.32000 ] } - * or: - * normal Normal { vector [ - * 0.995171 -6.08102e-6 9.81541e-2, - * 0.923880 -4.09802e-6 0.382683, - * 0.707107 -9.38186e-7 0.707107] - * } - * - * text_buffer contains the first line of this node : - * "coord Coordinate { point [" - */ -void VRML_MODEL_PARSER::readCoordsList( FILE* file, char* text_buffer, std::vector< double >& aList, int* LineNum ) +void VRML_MODEL_PARSER::readCoordsList( FILE* file, char* text_buffer, + std::vector< double >& aList, int* LineNum ) { unsigned int ii = 0, jj = 0; char* text; @@ -399,6 +387,7 @@ int VRML_MODEL_PARSER::readGeometry( FILE* file, int* LineNum ) else { } + continue; } diff --git a/3d-viewer/x3dmodelparser.cpp b/3d-viewer/x3dmodelparser.cpp index 8402164547..8205726ce1 100644 --- a/3d-viewer/x3dmodelparser.cpp +++ b/3d-viewer/x3dmodelparser.cpp @@ -39,17 +39,20 @@ #include "3d_struct.h" #include "modelparsers.h" -X3D_MODEL_PARSER::X3D_MODEL_PARSER( S3D_MASTER* aMaster ) -:S3D_MODEL_PARSER( aMaster ) +X3D_MODEL_PARSER::X3D_MODEL_PARSER( S3D_MASTER* aMaster ) : + S3D_MODEL_PARSER( aMaster ) {} + X3D_MODEL_PARSER::~X3D_MODEL_PARSER() {} -void X3D_MODEL_PARSER::Load( const wxString aFilename ) + +void X3D_MODEL_PARSER::Load( const wxString aFilename ) { - wxXmlDocument doc; - if( !doc.Load( aFilename ) ) + wxXmlDocument doc; + + if( !doc.Load( aFilename ) ) { wxLogError( wxT( "Error while parsing file <%s>" ), GetChars( aFilename ) ); return; @@ -62,74 +65,85 @@ void X3D_MODEL_PARSER::Load( const wxString aFilename ) } // Shapes are inside of Transform nodes - // Transform node contains information about + // Transform node contains information about // transition, scale and rotation of the shape NODE_LIST transforms; GetChildsByName( doc.GetRoot(), wxT( "Transform" ), transforms ); + for( NODE_LIST::iterator node_it = transforms.begin(); node_it != transforms.end(); - node_it++ ) + node_it++ ) { readTransform( *node_it ); } } -wxString X3D_MODEL_PARSER::VRML_representation() + +wxString X3D_MODEL_PARSER::VRML_representation() { wxString output; - for( unsigned i = 0; i < vrml_points.size(); i++ ) + + for( unsigned i = 0; i < vrml_points.size(); i++ ) { - output += wxT("Shape {\n" - " appearance Appearance {\n" - " material Material {\n" ) + - vrml_materials[i] + - wxT(" }\n" - " }\n" - " geometry IndexedFaceSet {\n" - " solid TRUE\n" - " coord Coordinate {\n" - " point [\n") + + output += wxT( "Shape {\n" + " appearance Appearance {\n" + " material Material {\n" ) + + vrml_materials[i] + + wxT( " }\n" + " }\n" + " geometry IndexedFaceSet {\n" + " solid TRUE\n" + " coord Coordinate {\n" + " point [\n") + vrml_points[i] + wxT( " ]\n" " }\n" " coordIndex [\n" ) + vrml_coord_indexes[i] + - wxT(" ]\n" - " }\n" - "},\n"); + wxT( " ]\n" + " }\n" + "},\n" ); } return output; } -void X3D_MODEL_PARSER::GetChildsByName( wxXmlNode* aParent, - const wxString aName, - std::vector< wxXmlNode* >& aResult ) + +void X3D_MODEL_PARSER::GetChildsByName( wxXmlNode* aParent, + const wxString aName, + std::vector< wxXmlNode* >& aResult ) { // Breadth-first search (BFS) std::queue< wxXmlNode* > found; found.push( aParent ); - while( !found.empty() ) + + while( !found.empty() ) { wxXmlNode *elem = found.front(); + for( wxXmlNode *child = elem->GetChildren(); - child != NULL; + child != NULL; child = child->GetNext() ) { - if( child->GetName() == aName) + if( child->GetName() == aName ) { aResult.push_back( child ); } + found.push( child ); } + found.pop(); } } -void X3D_MODEL_PARSER::GetNodeProperties( wxXmlNode* aNode, PROPERTY_MAP& aProps ) { + +void X3D_MODEL_PARSER::GetNodeProperties( wxXmlNode* aNode, PROPERTY_MAP& aProps ) +{ wxXmlProperty *prop; - for( prop = aNode->GetProperties(); - prop != NULL; + + for( prop = aNode->GetAttributes(); + prop != NULL; prop = prop->GetNext() ) { aProps[ prop->GetName() ] = prop->GetValue(); @@ -145,98 +159,110 @@ void X3D_MODEL_PARSER::readTransform( wxXmlNode* aTransformNode ) for( NODE_LIST::iterator node = childnodes.begin(); node != childnodes.end(); - node++ ) + node++ ) { readMaterial( *node ); } + childnodes.clear(); PROPERTY_MAP properties; GetNodeProperties( aTransformNode, properties ); GetChildsByName( aTransformNode, wxT("IndexedFaceSet"), childnodes ); + for( NODE_LIST::iterator node = childnodes.begin(); node != childnodes.end(); - node++ ) + node++ ) { readIndexedFaceSet( *node, properties ); } + childnodes.clear(); } + void X3D_MODEL_PARSER::readMaterial( wxXmlNode* aMatNode ) { PROPERTY_MAP properties; GetNodeProperties( aMatNode, properties ); // DEFine new Material named as value of DEF - if( properties.find( wxT( "DEF" ) ) != properties.end() ) { + if( properties.find( wxT( "DEF" ) ) != properties.end() ) + { double amb, shine, transp; S3D_MATERIAL* material = new S3D_MATERIAL( GetMaster(), properties[ wxT( "DEF" ) ] ); GetMaster()->Insert( material ); - if( !parseDoubleTriplet( properties[ wxT( "diffuseColor" ) ], - material->m_DiffuseColor) ) - { - D( printf("diffuseColor parsing error") ); + if( !parseDoubleTriplet( properties[ wxT( "diffuseColor" ) ], + material->m_DiffuseColor ) ) + { + D( printf("diffuseColor parsing error") ); } - + if( !parseDoubleTriplet( properties[ wxT( "specularColor" ) ], material->m_SpecularColor ) ) { - D( printf("specularColor parsing error") ); + D( printf("specularColor parsing error") ); } if( !parseDoubleTriplet( properties[ wxT( "emissiveColor" ) ], material->m_EmissiveColor ) ) - { - D( printf("emissiveColor parsing error") ); + { + D( printf("emissiveColor parsing error") ); } wxStringTokenizer values; values.SetString( properties[ wxT( "ambientIntensity" ) ] ); - if( values.GetNextToken().ToDouble( &amb ) ) + + if( values.GetNextToken().ToDouble( &amb ) ) { material->m_AmbientIntensity = amb; - } - else + } + else { - D( printf("ambienterror") ); + D( printf( "ambienterror" ) ); } values.SetString( properties[ wxT( "shininess" ) ] ); - if( values.GetNextToken().ToDouble(&shine) ) + + if( values.GetNextToken().ToDouble( &shine ) ) { material->m_Shininess = shine; - } - else { - D( printf( "shininess error" ) ); + } + else + { + D( printf( "shininess error" ) ); } values.SetString( properties[ wxT( "transparency" ) ] ); - if( values.GetNextToken().ToDouble(&transp) ) + + if( values.GetNextToken().ToDouble( &transp ) ) { material->m_Transparency = transp; - } + } else - { + { D( printf( "trans error") ); } material->SetMaterial(); - + // VRML wxString vrml_material; PROPERTY_MAP::const_iterator p = ++properties.begin(); // skip DEF - for(;p != properties.end();p++) { - vrml_material.Append( p->first + wxT(" ") + p->second + wxT("\n") ); + + for(;p != properties.end();p++) + { + vrml_material.Append( p->first + wxT( " " ) + p->second + wxT( "\n" ) ); } - vrml_materials.push_back(vrml_material); + vrml_materials.push_back( vrml_material ); } - + // USE existing material named by value of USE - else if( properties.find( wxT( "USE" ) ) != properties.end() ) { + else if( properties.find( wxT( "USE" ) ) != properties.end() ) + { S3D_MATERIAL* material = NULL; wxString mat_name = properties[ wxT( "USE" ) ]; @@ -244,34 +270,33 @@ void X3D_MODEL_PARSER::readMaterial( wxXmlNode* aMatNode ) { if( material->m_Name == mat_name ) { - + wxString vrml_material; - vrml_material.Append( wxString::Format( wxT( "specularColor %f %f %f\n"), - material->m_SpecularColor.x, - material->m_SpecularColor.y, - material->m_SpecularColor.z) ); + vrml_material.Append( wxString::Format( wxT( "specularColor %f %f %f\n" ), + material->m_SpecularColor.x, + material->m_SpecularColor.y, + material->m_SpecularColor.z ) ); - vrml_material.Append( wxString::Format( wxT( "diffuseColor %f %f %f\n"), - material->m_DiffuseColor.x, - material->m_DiffuseColor.y, - material->m_DiffuseColor.z) ); + vrml_material.Append( wxString::Format( wxT( "diffuseColor %f %f %f\n" ), + material->m_DiffuseColor.x, + material->m_DiffuseColor.y, + material->m_DiffuseColor.z ) ); - vrml_material.Append( wxString::Format( wxT( "emissiveColor %f %f %f\n"), - material->m_EmissiveColor.x, - material->m_EmissiveColor.y, - material->m_EmissiveColor.z) ); + vrml_material.Append( wxString::Format( wxT( "emissiveColor %f %f %f\n" ), + material->m_EmissiveColor.x, + material->m_EmissiveColor.y, + material->m_EmissiveColor.z ) ); - vrml_material.Append( wxString::Format( wxT( "ambientIntensity %f\n"), - material->m_AmbientIntensity) ); + vrml_material.Append( wxString::Format( wxT( "ambientIntensity %f\n"), + material->m_AmbientIntensity ) ); - vrml_material.Append( wxString::Format( wxT( "shininess %f\n"), - material->m_Shininess) ); - - vrml_material.Append( wxString::Format( wxT( "transparency %f\n"), - material->m_Transparency) ); - - vrml_materials.push_back(vrml_material); + vrml_material.Append( wxString::Format( wxT( "shininess %f\n"), + material->m_Shininess ) ); + vrml_material.Append( wxString::Format( wxT( "transparency %f\n"), + material->m_Transparency ) ); + + vrml_materials.push_back( vrml_material ); material->SetMaterial(); return; @@ -279,39 +304,40 @@ void X3D_MODEL_PARSER::readMaterial( wxXmlNode* aMatNode ) } D( printf( "ReadMaterial error: material not found\n" ) ); - } } -bool X3D_MODEL_PARSER::parseDoubleTriplet( const wxString& aData, + +bool X3D_MODEL_PARSER::parseDoubleTriplet( const wxString& aData, S3D_VERTEX& aResult ) { wxStringTokenizer tokens(aData); + return tokens.GetNextToken().ToDouble( &aResult.x ) && tokens.GetNextToken().ToDouble( &aResult.y ) && - tokens.GetNextToken().ToDouble( &aResult.z ); + tokens.GetNextToken().ToDouble( &aResult.z ); } -void X3D_MODEL_PARSER::rotate( S3D_VERTEX& aV, - S3D_VERTEX& aU, - double angle) +void X3D_MODEL_PARSER::rotate( S3D_VERTEX& aV, + S3D_VERTEX& aU, + double angle ) { S3D_VERTEX rotated; - double C = cos(angle); - double S = sin(angle); + double C = cos( angle ); + double S = sin( angle ); double t = 1.0 - C; - rotated.x = ( t * aU.x * aU.x + C ) * aV.x + - ( t * aU.x * aU.y - S * aU.z ) * aV.y + + rotated.x = ( t * aU.x * aU.x + C ) * aV.x + + ( t * aU.x * aU.y - S * aU.z ) * aV.y + ( t * aU.x * aU.z + S * aU.y ) * aV.z; - rotated.y = ( t * aU.x * aU.y + S * aU.z ) * aV.x + - ( t * aU.y * aU.y + C ) * aV.y + + rotated.y = ( t * aU.x * aU.y + S * aU.z ) * aV.x + + ( t * aU.y * aU.y + C ) * aV.y + ( t * aU.y * aU.z - S * aU.x ) * aV.z; - rotated.z = ( t * aU.x * aU.z - S * aU.y ) * aV.x + - ( t * aU.y * aU.z + S * aU.x ) * aV.y + + rotated.z = ( t * aU.x * aU.z - S * aU.y ) * aV.x + + ( t * aU.y * aU.z + S * aU.x ) * aV.y + ( t * aU.z * aU.z + C) * aV.z; aV.x = rotated.x; @@ -319,21 +345,21 @@ void X3D_MODEL_PARSER::rotate( S3D_VERTEX& aV, aV.z = rotated.z; } + /* Steps: * 1. Read transform data - * 2. Read vectex triplets + * 2. Read vertex triplets * 3. Read coordinate indexes * 4. Apply geometry to Master object */ -void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode, +void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode, PROPERTY_MAP& aTransformProps) { /* Step 1: Read transform data * --------------------------- */ - + S3D_VERTEX translation; - parseDoubleTriplet( aTransformProps[ wxT( "translation" ) ], - translation ); + parseDoubleTriplet( aTransformProps[ wxT( "translation" ) ], translation ); S3D_VERTEX scale; parseDoubleTriplet( aTransformProps[ wxT( "scale" ) ], scale ); @@ -341,6 +367,7 @@ void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode, S3D_VERTEX rotation; double angle = 0.0; wxStringTokenizer tokens(aTransformProps[ wxT( "rotation" ) ]); + if( !(tokens.GetNextToken().ToDouble( &rotation.x ) && tokens.GetNextToken().ToDouble( &rotation.y ) && tokens.GetNextToken().ToDouble( &rotation.z ) && @@ -349,7 +376,7 @@ void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode, D( printf("rotation read error") ); } - double vrmlunits_to_3Dunits = g_Parm_3D_Visu.m_BiuTo3Dunits * + double vrmlunits_to_3Dunits = g_Parm_3D_Visu.m_BiuTo3Dunits * UNITS3D_TO_UNITSPCB; /* Step 2: Read all coordinate points @@ -365,7 +392,8 @@ void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode, // Save points to vector as doubles wxStringTokenizer point_tokens( coordinate_properties[ wxT("point") ] ); double point = 0.0; - while( point_tokens.HasMoreTokens() ) + + while( point_tokens.HasMoreTokens() ) { if( point_tokens.GetNextToken().ToDouble( &point ) ) { @@ -377,28 +405,30 @@ void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode, } } - if(points.size() % 3 != 0) { - D( printf("Number of points is incorrect") ); + if( points.size() % 3 != 0 ) + { + D( printf( "Number of points is incorrect" ) ); return; } /* Create 3D vertex from 3 points and - * apply tansforms in order of SCALE, ROTATION, TRANSLATION + * apply transforms in order of SCALE, ROTATION, TRANSLATION */ wxString vrml_pointlist; std::vector< S3D_VERTEX > triplets; + for( unsigned id = 0; id < points.size() / 3; id++ ) { int triplet_indx = id * 3; - S3D_VERTEX point( points[ triplet_indx ], - points[ triplet_indx + 1 ], + S3D_VERTEX point( points[ triplet_indx ], + points[ triplet_indx + 1 ], points[ triplet_indx + 2 ] ); point.x *= scale.x; point.y *= scale.y; point.z *= scale.z; - rotate(point, rotation, angle); + rotate( point, rotation, angle ); point.x += translation.x; point.y += translation.y; @@ -407,9 +437,10 @@ void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode, triplets.push_back(point); // VRML - vrml_pointlist.Append( wxString::Format(wxT("%f %f %f\n"), point.x, point.y, point.z) ); + vrml_pointlist.Append( wxString::Format( wxT( "%f %f %f\n" ), point.x, point.y, point.z ) ); } - vrml_points.push_back(vrml_pointlist); + + vrml_points.push_back( vrml_pointlist ); /* -- Read coordinate indexes -- */ PROPERTY_MAP faceset_properties; @@ -422,10 +453,11 @@ void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode, wxStringTokenizer index_tokens( coordIndex_str ); wxString vrml_coord_indx_list; - while( index_tokens.HasMoreTokens() ) + + while( index_tokens.HasMoreTokens() ) { long index = 0; - index_tokens.GetNextToken().ToLong(&index); + index_tokens.GetNextToken().ToLong( &index ); // -1 marks the end of polygon if( index < 0 ) @@ -433,11 +465,12 @@ void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode, /* Step 4: Apply geometry to Master object * --------------------------------------- */ std::vector::const_iterator id; + for( id = coordIndex.begin(); id != coordIndex.end(); id++ ) { - vertices.push_back( triplets.at(*id) ); + vertices.push_back( triplets.at( *id ) ); } GetMaster()->Set_Object_Coords( vertices ); @@ -445,14 +478,14 @@ void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode, vertices.clear(); coordIndex.clear(); - vrml_coord_indx_list.Append( wxT("-1\n") ); + vrml_coord_indx_list.Append( wxT( "-1\n" ) ); } else { coordIndex.push_back( index ); - vrml_coord_indx_list.Append( wxString::Format(wxT("%u "), index) ); + vrml_coord_indx_list.Append( wxString::Format( wxT( "%u " ), index ) ); } } - vrml_coord_indexes.push_back(vrml_coord_indx_list); -} + vrml_coord_indexes.push_back( vrml_coord_indx_list ); +} diff --git a/common/common_plot_functions.cpp b/common/common_plot_functions.cpp index 6f8b3bc139..4e07bdaa78 100644 --- a/common/common_plot_functions.cpp +++ b/common/common_plot_functions.cpp @@ -59,7 +59,7 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, int iusPerMil = plotter->GetIUsPerDecimil() * 10; wxSize pageSize = aPageInfo.GetSizeMils(); // in mils int xg, yg; - int refx, refy; +// int refx, refy; wxPoint pos, end, ref; wxString msg; wxSize text_size; diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 7f465694d9..7fdae7f55e 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -905,6 +905,17 @@ public: /** * Function ExportVRML_File * Creates the file(s) exporting current BOARD to a VRML file. + * + * @note When copying 3D shapes files, the new filename is build from the full path + * name, changing the separators by underscore. This is needed because files + * with the same shortname can exist in different directories + * @note ExportVRML_File generates coordinates in board units (BIU) inside the file. + * @todo Use mm inside the file. A general scale transform is applied to the whole + * file (1.0 to have the actual WRML unit im mm, 0.001 to have the actual WRML + * unit in meters. + * @note For 3D models built by a 3D modeler, the unit is 0,1 inches. A specfic scale + * is applied to 3D models to convert them to internal units. + * * @param aFullFileName = the full filename of the file to create * @param aMMtoWRMLunit = the VRML scaling factor: * 1.0 to export in mm. 0.001 for meters diff --git a/pcbnew/export_vrml.cpp b/pcbnew/export_vrml.cpp index 7ccbd48081..b9ec9ff37b 100644 --- a/pcbnew/export_vrml.cpp +++ b/pcbnew/export_vrml.cpp @@ -257,6 +257,7 @@ static void write_triangle_bag( FILE* output_file, int color_index, //{{{ "}\n", 0 // End marker }; + int marker_found = 0, lineno = 0; while( marker_found < 4 ) @@ -554,6 +555,7 @@ static void export_vrml_arc( int layer, double centerx, double centery, ring.bag( layer, false ); } + static void export_vrml_varc( TRIANGLEBAG& triangles, int top_layer, int bottom_layer, double centerx, double centery, @@ -958,28 +960,28 @@ static void export_vrml_pad( BOARD* pcb, D_PAD* aPad ) //{{{ pad_dy = 0; case PAD_TRAPEZOID: + { + int coord[8] = { - int coord[8] = - { - KiROUND(-pad_w - pad_dy), KiROUND(+pad_h + pad_dx), - KiROUND(-pad_w + pad_dy), KiROUND(-pad_h - pad_dx), - KiROUND(+pad_w - pad_dy), KiROUND(+pad_h - pad_dx), - KiROUND(+pad_w + pad_dy), KiROUND(-pad_h + pad_dx), - }; + KiROUND( -pad_w - pad_dy ), KiROUND( +pad_h + pad_dx ), + KiROUND( -pad_w + pad_dy ), KiROUND( -pad_h - pad_dx ), + KiROUND( +pad_w - pad_dy ), KiROUND( +pad_h - pad_dx ), + KiROUND( +pad_w + pad_dy ), KiROUND( -pad_h + pad_dx ), + }; - for( int i = 0; i < 4; i++ ) - { - RotatePoint( &coord[i * 2], &coord[i * 2 + 1], aPad->GetOrientation() ); - coord[i * 2] += KiROUND( pad_x ); - coord[i * 2 + 1] += KiROUND( pad_y ); - } - - bag_flat_quad( layer, coord[0], coord[1], - coord[2], coord[3], - coord[4], coord[5], - coord[6], coord[7] ); + for( int i = 0; i < 4; i++ ) + { + RotatePoint( &coord[i * 2], &coord[i * 2 + 1], aPad->GetOrientation() ); + coord[i * 2] += KiROUND( pad_x ); + coord[i * 2 + 1] += KiROUND( pad_y ); } - break; + + bag_flat_quad( layer, coord[0], coord[1], + coord[2], coord[3], + coord[4], coord[5], + coord[6], coord[7] ); + } + break; default: ; @@ -1043,11 +1045,11 @@ static void export_vrml_module( BOARD* aPcb, MODULE* aModule, switch( item->Type() ) { case PCB_MODULE_TEXT_T: - export_vrml_text_module( dynamic_cast(item) ); + export_vrml_text_module( dynamic_cast( item ) ); break; case PCB_MODULE_EDGE_T: - export_vrml_edge_module( dynamic_cast(item) ); + export_vrml_edge_module( dynamic_cast( item ) ); break; default: @@ -1078,13 +1080,13 @@ static void export_vrml_module( BOARD* aPcb, MODULE* aModule, fname = vrmlm->m_Shape3DName; } - fname.Replace(wxT("\\"), wxT("/" ) ); + fname.Replace( wxT( "\\" ), wxT( "/" ) ); wxString source_fname = fname; if( aExport3DFiles ) // Change illegal characters in short filename { ChangeIllegalCharacters( fname, true ); - fname = a3D_Subdir + wxT("/") + fname; + fname = a3D_Subdir + wxT( "/" ) + fname; if( !wxFileExists( fname ) ) wxCopyFile( source_fname, fname ); @@ -1153,12 +1155,12 @@ static void export_vrml_module( BOARD* aPcb, MODULE* aModule, if( fname.EndsWith( wxT( "x3d" ) ) ) { - X3D_MODEL_PARSER* parser = new X3D_MODEL_PARSER(vrmlm); + X3D_MODEL_PARSER* parser = new X3D_MODEL_PARSER( vrmlm ); - if(parser) + if( parser ) { // embed x3d model in vrml format - parser->Load(fname); + parser->Load( fname ); fprintf( aOutputFile, " children [\n %s ]\n", TO_UTF8( parser->VRML_representation() ) ); fprintf( aOutputFile, " }\n" ); @@ -1187,28 +1189,7 @@ static void write_and_empty_triangle_bag( FILE* output_file, TRIANGLEBAG& triang } } -/* ExportVRML_File - * Creates the file(s) exporting current BOARD to a VRML file. - * aFullFileName = the full filename of the file to create - * aMMtoWRMLunit = the general WRML scaling factor. 1.0 to export in mm - * @param aExport3DFiles = true to copy 3D shapes in the subdir a3D_Subdir - * a3D_Subdir = sub directory where 3D shapes files are copied - * used only when aExport3DFiles == true - */ -/* Note1: - * When copying 3D shapes files, the new filename is build from - * the full path name, changing the separators by underscore. - * this is needed because files with the same shortname can exist in different directories - * Note 2: - * ExportVRML_File generates coordinates in board units (BIU) inside the file. - * (TODO: use mm inside the file) - * A general scale transform is applied to the whole file - * (1.0 to have the actual WRML unit im mm, 0.001 to have the actual WRML unit im meter - * Note 3: - * For 3D models built by a 3D modeler, the unit is 0,1 inch - * A specfic scale is applied to 3D models to convert them to BIU - * - */ + bool PCB_EDIT_FRAME::ExportVRML_File( const wxString & aFullFileName, double aMMtoWRMLunit, bool aExport3DFiles, const wxString & a3D_Subdir ) @@ -1218,6 +1199,7 @@ bool PCB_EDIT_FRAME::ExportVRML_File( const wxString & aFullFileName, BOARD* pcb = GetBoard(); output_file = wxFopen( aFullFileName, wxT( "wt" ) ); + if( output_file == NULL ) return false; @@ -1227,7 +1209,7 @@ bool PCB_EDIT_FRAME::ExportVRML_File( const wxString & aFullFileName, // Begin with the usual VRML boilerplate wxString name = aFullFileName; - name.Replace(wxT("\\"), wxT("/" ) ); + name.Replace( wxT( "\\" ), wxT( "/" ) ); ChangeIllegalCharacters( name, false ); fprintf( output_file, "#VRML V2.0 utf8\n" "WorldInfo {\n" @@ -1275,6 +1257,7 @@ bool PCB_EDIT_FRAME::ExportVRML_File( const wxString & aFullFileName, * is 2.54 * aMMtoWRMLunit */ double wrml_3D_models_scaling_factor = 2.54 * aMMtoWRMLunit; + // Export footprints for( MODULE* module = pcb->m_Modules; module != 0; module = module->Next() ) export_vrml_module( pcb, module, output_file, @@ -1307,6 +1290,7 @@ bool PCB_EDIT_FRAME::ExportVRML_File( const wxString & aFullFileName, return true; } + /* * some characters cannot be used in filenames, * this function change them to "_" @@ -1314,8 +1298,8 @@ bool PCB_EDIT_FRAME::ExportVRML_File( const wxString & aFullFileName, static void ChangeIllegalCharacters( wxString & aFileName, bool aDirSepIsIllegal ) { if( aDirSepIsIllegal ) - aFileName.Replace(wxT("/"), wxT("_" ) ); + aFileName.Replace( wxT( "/" ), wxT( "_" ) ); - aFileName.Replace(wxT(" "), wxT("_" ) ); - aFileName.Replace(wxT(":"), wxT("_" ) ); + aFileName.Replace( wxT( " " ), wxT( "_" ) ); + aFileName.Replace( wxT( ":" ), wxT( "_" ) ); } From 675f8d4a0b546e62dfe2239d244e3ae3b5e23a48 Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Thu, 28 Mar 2013 20:12:46 +0100 Subject: [PATCH 18/63] Typedef STATUS_FLAGS to encapsulate EDA_ITEM bitmapped flags --- common/class_undoredo_container.cpp | 4 +-- eeschema/edit_bitmap.cpp | 2 +- eeschema/getpart.cpp | 4 +-- eeschema/lib_arc.cpp | 2 +- eeschema/lib_arc.h | 2 +- eeschema/lib_circle.cpp | 2 +- eeschema/lib_circle.h | 2 +- eeschema/lib_draw_item.h | 2 +- eeschema/lib_field.cpp | 2 +- eeschema/lib_field.h | 2 +- eeschema/lib_polyline.cpp | 2 +- eeschema/lib_polyline.h | 2 +- eeschema/lib_rectangle.cpp | 2 +- eeschema/lib_rectangle.h | 2 +- eeschema/lib_text.cpp | 2 +- eeschema/lib_text.h | 2 +- eeschema/libeditframe.cpp | 2 +- eeschema/pinedit.cpp | 2 +- include/base_struct.h | 15 +++++----- include/class_undoredo_container.h | 10 +++---- pcbnew/class_track.cpp | 34 +++++++++++------------ pcbnew/class_track.h | 2 +- pcbnew/dialogs/dialog_global_deletion.cpp | 2 +- pcbnew/dragsegm.cpp | 2 +- pcbnew/legacy_plugin.cpp | 7 +++-- pcbnew/modedit_onclick.cpp | 2 +- pcbnew/move_or_drag_track.cpp | 6 ++-- pcbnew/onrightclick.cpp | 2 +- pcbnew/pcb_parser.cpp | 8 +++--- pcbnew/tr_modif.cpp | 6 ++-- 30 files changed, 71 insertions(+), 65 deletions(-) diff --git a/common/class_undoredo_container.cpp b/common/class_undoredo_container.cpp index 51fa8d54ad..5d51e2216c 100644 --- a/common/class_undoredo_container.cpp +++ b/common/class_undoredo_container.cpp @@ -195,7 +195,7 @@ UNDO_REDO_T PICKED_ITEMS_LIST::GetPickedItemStatus( unsigned int aIdx ) } -int PICKED_ITEMS_LIST::GetPickerFlags( unsigned aIdx ) +STATUS_FLAGS PICKED_ITEMS_LIST::GetPickerFlags( unsigned aIdx ) { if( aIdx < m_ItemsList.size() ) return m_ItemsList[aIdx].GetFlags(); @@ -253,7 +253,7 @@ bool PICKED_ITEMS_LIST::SetPickedItemStatus( UNDO_REDO_T aStatus, unsigned aIdx } -bool PICKED_ITEMS_LIST::SetPickerFlags( int aFlags, unsigned aIdx ) +bool PICKED_ITEMS_LIST::SetPickerFlags( STATUS_FLAGS aFlags, unsigned aIdx ) { if( aIdx < m_ItemsList.size() ) { diff --git a/eeschema/edit_bitmap.cpp b/eeschema/edit_bitmap.cpp index b00de40b20..312edcff7c 100644 --- a/eeschema/edit_bitmap.cpp +++ b/eeschema/edit_bitmap.cpp @@ -85,7 +85,7 @@ static void moveBitmap( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosit dirty.Inflate( 4 ); // Give a margin aPanel->SetMouseCapture( NULL, NULL ); // Avoid loop in redraw panel - int flgs = image->GetFlags(); + STATUS_FLAGS flgs = image->GetFlags(); image->ClearFlags(); aPanel->RefreshDrawingRect( dirty ); image->SetFlags( flgs ); diff --git a/eeschema/getpart.cpp b/eeschema/getpart.cpp index 666c6ea3fb..327a11ccea 100644 --- a/eeschema/getpart.cpp +++ b/eeschema/getpart.cpp @@ -360,7 +360,7 @@ void SCH_EDIT_FRAME::OnSelectUnit( wxCommandEvent& aEvent ) if( unit > unitCount ) unit = unitCount; - int flags = component->GetFlags(); + STATUS_FLAGS flags = component->GetFlags(); if( !flags ) // No command in progress: save in undo list SaveCopyInUndoList( component, UR_CHANGED ); @@ -405,7 +405,7 @@ void SCH_EDIT_FRAME::ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC ) return; } - int flags = DrawComponent->GetFlags(); + STATUS_FLAGS flags = DrawComponent->GetFlags(); if( DrawComponent->GetFlags() ) DrawComponent->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode, g_GhostColor ); diff --git a/eeschema/lib_arc.cpp b/eeschema/lib_arc.cpp index 2673290c61..2107bc715e 100644 --- a/eeschema/lib_arc.cpp +++ b/eeschema/lib_arc.cpp @@ -574,7 +574,7 @@ wxString LIB_ARC::GetSelectMenuText() const } -void LIB_ARC::BeginEdit( int aEditMode, const wxPoint aPosition ) +void LIB_ARC::BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aPosition ) { wxCHECK_RET( ( aEditMode & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0, wxT( "Invalid edit mode for LIB_ARC object." ) ); diff --git a/eeschema/lib_arc.h b/eeschema/lib_arc.h index 49b66cb782..d32d000a72 100644 --- a/eeschema/lib_arc.h +++ b/eeschema/lib_arc.h @@ -110,7 +110,7 @@ public: int GetPenSize() const; - void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ); + void BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ); bool ContinueEdit( const wxPoint aNextPoint ); diff --git a/eeschema/lib_circle.cpp b/eeschema/lib_circle.cpp index c6357b1f1d..9e957863fc 100644 --- a/eeschema/lib_circle.cpp +++ b/eeschema/lib_circle.cpp @@ -296,7 +296,7 @@ wxString LIB_CIRCLE::GetSelectMenuText() const } -void LIB_CIRCLE::BeginEdit( int aEditMode, const wxPoint aPosition ) +void LIB_CIRCLE::BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aPosition ) { wxCHECK_RET( ( aEditMode & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0, wxT( "Invalid edit mode for LIB_CIRCLE object." ) ); diff --git a/eeschema/lib_circle.h b/eeschema/lib_circle.h index 3d5bb6c877..723acf4fe7 100644 --- a/eeschema/lib_circle.h +++ b/eeschema/lib_circle.h @@ -71,7 +71,7 @@ public: void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); - void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ); + void BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ); bool ContinueEdit( const wxPoint aNextPoint ); diff --git a/eeschema/lib_draw_item.h b/eeschema/lib_draw_item.h index 26993b2b55..0e1d6d621f 100644 --- a/eeschema/lib_draw_item.h +++ b/eeschema/lib_draw_item.h @@ -175,7 +175,7 @@ public: * started. This may or may not be required depending on the item * being edited and the edit mode. */ - virtual void BeginEdit( int aEditMode, const wxPoint aPosition = wxPoint( 0, 0 ) ) {} + virtual void BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aPosition = wxPoint( 0, 0 ) ) {} /** * Continue an edit in progress at \a aPosition. diff --git a/eeschema/lib_field.cpp b/eeschema/lib_field.cpp index 5eb3dbdebf..b52414e7cb 100644 --- a/eeschema/lib_field.cpp +++ b/eeschema/lib_field.cpp @@ -659,7 +659,7 @@ wxString LIB_FIELD::GetSelectMenuText() const } -void LIB_FIELD::BeginEdit( int aEditMode, const wxPoint aPosition ) +void LIB_FIELD::BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aPosition ) { wxCHECK_RET( ( aEditMode & ( IS_NEW | IS_MOVED ) ) != 0, wxT( "Invalid edit mode for LIB_FIELD object." ) ); diff --git a/eeschema/lib_field.h b/eeschema/lib_field.h index 8d4deb810a..2680ff1a82 100644 --- a/eeschema/lib_field.h +++ b/eeschema/lib_field.h @@ -207,7 +207,7 @@ public: EDA_COLOR_T GetDefaultColor(); - void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ); + void BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ); bool ContinueEdit( const wxPoint aNextPoint ); diff --git a/eeschema/lib_polyline.cpp b/eeschema/lib_polyline.cpp index 6b3519b844..072fdda345 100644 --- a/eeschema/lib_polyline.cpp +++ b/eeschema/lib_polyline.cpp @@ -420,7 +420,7 @@ wxString LIB_POLYLINE::GetSelectMenuText() const } -void LIB_POLYLINE::BeginEdit( int aEditMode, const wxPoint aPosition ) +void LIB_POLYLINE::BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aPosition ) { wxCHECK_RET( ( aEditMode & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0, wxT( "Invalid edit mode for LIB_POLYLINE object." ) ); diff --git a/eeschema/lib_polyline.h b/eeschema/lib_polyline.h index 0d803bfe6c..2a0c5566b1 100644 --- a/eeschema/lib_polyline.h +++ b/eeschema/lib_polyline.h @@ -84,7 +84,7 @@ public: void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); - void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ); + void BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ); bool ContinueEdit( const wxPoint aNextPoint ); diff --git a/eeschema/lib_rectangle.cpp b/eeschema/lib_rectangle.cpp index 8a93e05e53..019f6f20ec 100644 --- a/eeschema/lib_rectangle.cpp +++ b/eeschema/lib_rectangle.cpp @@ -333,7 +333,7 @@ wxString LIB_RECTANGLE::GetSelectMenuText() const } -void LIB_RECTANGLE::BeginEdit( int aEditMode, const wxPoint aPosition ) +void LIB_RECTANGLE::BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aPosition ) { wxCHECK_RET( ( aEditMode & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0, wxT( "Invalid edit mode for LIB_RECTANGLE object." ) ); diff --git a/eeschema/lib_rectangle.h b/eeschema/lib_rectangle.h index 11645a9478..2d0989b8e3 100644 --- a/eeschema/lib_rectangle.h +++ b/eeschema/lib_rectangle.h @@ -75,7 +75,7 @@ public: void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); - void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ); + void BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ); bool ContinueEdit( const wxPoint aNextPoint ); diff --git a/eeschema/lib_text.cpp b/eeschema/lib_text.cpp index bd7dea54a7..320119c09a 100644 --- a/eeschema/lib_text.cpp +++ b/eeschema/lib_text.cpp @@ -495,7 +495,7 @@ wxString LIB_TEXT::GetSelectMenuText() const } -void LIB_TEXT::BeginEdit( int aEditMode, const wxPoint aPosition ) +void LIB_TEXT::BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aPosition ) { wxCHECK_RET( ( aEditMode & ( IS_NEW | IS_MOVED ) ) != 0, wxT( "Invalid edit mode for LIB_TEXT object." ) ); diff --git a/eeschema/lib_text.h b/eeschema/lib_text.h index 6da3c3b086..21ce2e9eb8 100644 --- a/eeschema/lib_text.h +++ b/eeschema/lib_text.h @@ -100,7 +100,7 @@ public: void Rotate(); - void BeginEdit( int aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ); + void BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ); bool ContinueEdit( const wxPoint aNextPoint ); diff --git a/eeschema/libeditframe.cpp b/eeschema/libeditframe.cpp index ce82d3c848..21f8d4716f 100644 --- a/eeschema/libeditframe.cpp +++ b/eeschema/libeditframe.cpp @@ -754,7 +754,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; m_canvas->MoveCursorToCrossHair(); - int oldFlags = m_drawItem->GetFlags(); + STATUS_FLAGS oldFlags = m_drawItem->GetFlags(); m_drawItem->ClearFlags(); m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, NULL, DefaultTransform ); ( (LIB_POLYLINE*) m_drawItem )->DeleteSegment( GetScreen()->GetCrossHairPosition( true ) ); diff --git a/eeschema/pinedit.cpp b/eeschema/pinedit.cpp index f03c6e3a4b..2095e17325 100644 --- a/eeschema/pinedit.cpp +++ b/eeschema/pinedit.cpp @@ -72,7 +72,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event ) if( m_drawItem == NULL || m_drawItem->Type() != LIB_PIN_T ) return; - int item_flags = m_drawItem->GetFlags(); // save flags to restore them after editing + STATUS_FLAGS item_flags = m_drawItem->GetFlags(); // save flags to restore them after editing LIB_PIN* pin = (LIB_PIN*) m_drawItem; DIALOG_LIB_EDIT_PIN dlg( this, pin ); diff --git a/include/base_struct.h b/include/base_struct.h index c258b17d47..56ce1a04e7 100644 --- a/include/base_struct.h +++ b/include/base_struct.h @@ -383,6 +383,7 @@ public: ///< already been edited, in some functions #define EDA_ITEM_ALL_FLAGS -1 +typedef unsigned STATUS_FLAGS; /** * Class EDA_ITEM @@ -399,7 +400,7 @@ private: * functions. */ KICAD_T m_StructType; - int m_Status; + STATUS_FLAGS m_Status; protected: EDA_ITEM* Pnext; ///< next in linked list @@ -414,7 +415,7 @@ protected: bool m_forceVisible; /// Flag bits for editing and other uses. - int m_Flags; + STATUS_FLAGS m_Flags; // Link to an copy of the item use to save the item's state for undo/redo feature. EDA_ITEM* m_Image; @@ -475,12 +476,12 @@ public: m_Status &= ~type; } - int GetStatus() const { return m_Status; } - void SetStatus( int aStatus ) { m_Status = aStatus; } + STATUS_FLAGS GetStatus() const { return m_Status; } + void SetStatus( STATUS_FLAGS aStatus ) { m_Status = aStatus; } - void SetFlags( int aMask ) { m_Flags |= aMask; } - void ClearFlags( int aMask = EDA_ITEM_ALL_FLAGS ) { m_Flags &= ~aMask; } - int GetFlags() const { return m_Flags; } + void SetFlags( STATUS_FLAGS aMask ) { m_Flags |= aMask; } + void ClearFlags( STATUS_FLAGS aMask = EDA_ITEM_ALL_FLAGS ) { m_Flags &= ~aMask; } + STATUS_FLAGS GetFlags() const { return m_Flags; } void SetImage( EDA_ITEM* aItem ) { m_Image = aItem; } diff --git a/include/class_undoredo_container.h b/include/class_undoredo_container.h index 93a699166e..6c95bae24d 100644 --- a/include/class_undoredo_container.h +++ b/include/class_undoredo_container.h @@ -81,7 +81,7 @@ enum UNDO_REDO_T { class ITEM_PICKER { private: - int m_pickerFlags; /* a copy of m_Flags member. useful in mode/drag + STATUS_FLAGS m_pickerFlags; /* a copy of m_Flags member. useful in mode/drag * undo/redo commands */ UNDO_REDO_T m_undoRedoStatus; /* type of operation to undo/redo for this item */ EDA_ITEM* m_pickedItem; /* Pointer on the schematic or board item that is concerned @@ -113,9 +113,9 @@ public: UNDO_REDO_T GetStatus() { return m_undoRedoStatus; } - void SetFlags( int aFlags ) { m_pickerFlags = aFlags; } + void SetFlags( STATUS_FLAGS aFlags ) { m_pickerFlags = aFlags; } - int GetFlags() { return m_pickerFlags; } + STATUS_FLAGS GetFlags() const { return m_pickerFlags; } void SetLink( EDA_ITEM* aItem ) { m_link = aItem; } @@ -231,7 +231,7 @@ public: * @param aIdx Index of the picker in the picked list * @return The value stored in the picker, if the picker exists, or 0 if does not exist */ - int GetPickerFlags( unsigned aIdx ); + STATUS_FLAGS GetPickerFlags( unsigned aIdx ); /** * Function SetPickedItem @@ -275,7 +275,7 @@ public: * @param aIdx Index of the picker in the picked list * @return True if the picker exists or false if does not exist */ - bool SetPickerFlags( int aFlags, unsigned aIdx ); + bool SetPickerFlags( STATUS_FLAGS aFlags, unsigned aIdx ); /** * Function RemovePicker diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index dc80db4d1c..b8c2413614 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -273,9 +273,9 @@ bool TRACK::IsNull() } -int TRACK::IsPointOnEnds( const wxPoint& point, int min_dist ) +STATUS_FLAGS TRACK::IsPointOnEnds( const wxPoint& point, int min_dist ) { - int result = 0; + STATUS_FLAGS result = 0; if( min_dist < 0 ) min_dist = m_Width / 2; @@ -1408,15 +1408,15 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace ) if( via ) { layerMask |= via->ReturnMaskLayer(); - via->SetState( BUSY, ON ); + via->SetState( BUSY, true ); } - Track->SetState( BUSY, ON ); + Track->SetState( BUSY, true ); segm = ::GetTrace( this, TrackListEnd, Track->m_Start, layerMask ); - Track->SetState( BUSY, OFF ); + Track->SetState( BUSY, false ); if( via ) - via->SetState( BUSY, OFF ); + via->SetState( BUSY, false ); if( segm == NULL ) { @@ -1434,13 +1434,13 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace ) BeginPad = Track->GetState( BEGIN_ONPAD ); EndPad = Track->GetState( END_ONPAD ); - Track->SetState( BEGIN_ONPAD | END_ONPAD, OFF ); + Track->SetState( BEGIN_ONPAD | END_ONPAD, false ); if( BeginPad ) - Track->SetState( END_ONPAD, ON ); + Track->SetState( END_ONPAD, true ); if( EndPad ) - Track->SetState( BEGIN_ONPAD, ON ); + Track->SetState( BEGIN_ONPAD, true ); EXCHG( Track->m_Start, Track->m_End ); EXCHG( Track->start, Track->end ); @@ -1455,15 +1455,15 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace ) if( via ) { layerMask |= via->ReturnMaskLayer(); - via->SetState( BUSY, ON ); + via->SetState( BUSY, true ); } - Track->SetState( BUSY, ON ); + Track->SetState( BUSY, true ); segm = ::GetTrace( this, TrackListEnd, Track->m_End, layerMask ); - Track->SetState( BUSY, OFF ); + Track->SetState( BUSY, false ); if( via ) - via->SetState( BUSY, OFF ); + via->SetState( BUSY, false ); if( segm == NULL ) { @@ -1478,13 +1478,13 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace ) BeginPad = Track->GetState( BEGIN_ONPAD ); EndPad = Track->GetState( END_ONPAD ); - Track->SetState( BEGIN_ONPAD | END_ONPAD, OFF ); + Track->SetState( BEGIN_ONPAD | END_ONPAD, false ); if( BeginPad ) - Track->SetState( END_ONPAD, ON ); + Track->SetState( END_ONPAD, true ); if( EndPad ) - Track->SetState( BEGIN_ONPAD, ON ); + Track->SetState( BEGIN_ONPAD, true ); EXCHG( Track->m_Start, Track->m_End ); EXCHG( Track->start, Track->end ); @@ -1543,7 +1543,7 @@ void TRACK::Show( int nestLevel, std::ostream& os ) const " layer=\"" << m_Layer << '"' << " width=\"" << m_Width << '"' << " flags=\"" << m_Flags << '"' << - " status=\"" << GetState( -1 ) << '"' << + " status=\"" << GetStatus( ) << '"' << // " drill=\"" << GetDrillValue() << '"' << " netcode=\"" << GetNet() << "\">" << diff --git a/pcbnew/class_track.h b/pcbnew/class_track.h index df6aed9c37..8ac2836061 100644 --- a/pcbnew/class_track.h +++ b/pcbnew/class_track.h @@ -229,7 +229,7 @@ public: * (dist = min_dist) both ends, or 0 if none of the above. * if min_dist < 0: min_dist = track_width/2 */ - int IsPointOnEnds( const wxPoint& point, int min_dist = 0 ); + STATUS_FLAGS IsPointOnEnds( const wxPoint& point, int min_dist = 0 ); /** * Function IsNull diff --git a/pcbnew/dialogs/dialog_global_deletion.cpp b/pcbnew/dialogs/dialog_global_deletion.cpp index 47d0a20831..89e65bc54f 100644 --- a/pcbnew/dialogs/dialog_global_deletion.cpp +++ b/pcbnew/dialogs/dialog_global_deletion.cpp @@ -139,7 +139,7 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( ) if( m_DelTracks->GetValue() ) { - int track_mask_filter = 0; + STATUS_FLAGS track_mask_filter = 0; if( !m_TrackFilterLocked->GetValue() ) track_mask_filter |= TRACK_LOCKED; diff --git a/pcbnew/dragsegm.cpp b/pcbnew/dragsegm.cpp index 0da2c00240..c23c8fe5da 100644 --- a/pcbnew/dragsegm.cpp +++ b/pcbnew/dragsegm.cpp @@ -350,7 +350,7 @@ void Collect_TrackSegmentsToDrag( BOARD* aPcb, const wxPoint& aRefPos, int aLaye if( track->IsDragging() ) continue; // already put in list - int flag = 0; + STATUS_FLAGS flag = 0; int maxdist = std::max( aMaxDist, track->GetWidth() / 2 ); if( (track->GetFlags() & STARTPOINT) == 0 ) diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index 515f31e411..8798236902 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -1990,11 +1990,14 @@ void LEGACY_PLUGIN::loadTrackList( int aStructType ) int makeType; time_t timeStamp; - int layer, type, flags, net_code; + int layer, type, net_code, flags_int; // parse the 2nd line to determine the type of object // e.g. "De 15 1 7 0 0" for a via - sscanf( line + SZ( "De" ), " %d %d %d %lX %X", &layer, &type, &net_code, &timeStamp, &flags ); + sscanf( line + SZ( "De" ), " %d %d %d %lX %X", &layer, &type, &net_code, + &timeStamp, &flags_int ); + STATUS_FLAGS flags; + flags = static_cast( flags_int ); if( aStructType==PCB_TRACE_T && type==1 ) makeType = PCB_VIA_T; diff --git a/pcbnew/modedit_onclick.cpp b/pcbnew/modedit_onclick.cpp index aa5c25bc67..f722179a91 100644 --- a/pcbnew/modedit_onclick.cpp +++ b/pcbnew/modedit_onclick.cpp @@ -253,7 +253,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen if( item ) { - int flags = item->GetFlags(); + STATUS_FLAGS flags = item->GetFlags(); switch( item->Type() ) { case PCB_MODULE_T: diff --git a/pcbnew/move_or_drag_track.cpp b/pcbnew/move_or_drag_track.cpp index 2ceb75e937..394ed2bc0f 100644 --- a/pcbnew/move_or_drag_track.cpp +++ b/pcbnew/move_or_drag_track.cpp @@ -637,7 +637,7 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC } else { - int diag = aTrack->IsPointOnEnds( GetScreen()->GetCrossHairPosition(), -1 ); + STATUS_FLAGS diag = aTrack->IsPointOnEnds( GetScreen()->GetCrossHairPosition(), -1 ); wxPoint pos; switch( aCommand ) @@ -766,7 +766,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC if( TrackToStartPoint ) { - int flag = STARTPOINT; + STATUS_FLAGS flag = STARTPOINT; if( track->GetStart() != TrackToStartPoint->GetStart() ) flag = ENDPOINT; @@ -777,7 +777,7 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC if( TrackToEndPoint ) { - int flag = STARTPOINT; + STATUS_FLAGS flag = STARTPOINT; if( track->GetEnd() != TrackToEndPoint->GetStart() ) flag = ENDPOINT; diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp index d0504f2931..14b6055a06 100644 --- a/pcbnew/onrightclick.cpp +++ b/pcbnew/onrightclick.cpp @@ -53,7 +53,7 @@ static wxMenu* Append_Track_Width_List( BOARD* aBoard ); bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) { wxString msg; - int flags = 0; + STATUS_FLAGS flags = 0; bool locate_track = false; bool blockActive = !GetScreen()->m_BlockLocate.IsIdle(); diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index 56a89a6989..d11833c600 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -1282,7 +1282,7 @@ DRAWSEGMENT* PCB_PARSER::parseDRAWSEGMENT() throw( IO_ERROR, PARSE_ERROR ) break; case T_status: - segment->SetStatus( parseHex() ); + segment->SetStatus( static_cast( parseHex() ) ); break; default: @@ -1966,7 +1966,7 @@ EDGE_MODULE* PCB_PARSER::parseEDGE_MODULE() throw( IO_ERROR, PARSE_ERROR ) break; case T_status: - segment->SetStatus( parseHex() ); + segment->SetStatus( static_cast( parseHex() ) ); break; default: @@ -2263,7 +2263,7 @@ TRACK* PCB_PARSER::parseTRACK() throw( IO_ERROR, PARSE_ERROR ) break; case T_status: - track->SetStatus( parseHex() ); + track->SetStatus( static_cast( parseHex() ) ); break; default: @@ -2343,7 +2343,7 @@ SEGVIA* PCB_PARSER::parseSEGVIA() throw( IO_ERROR, PARSE_ERROR ) break; case T_status: - via->SetStatus( parseHex() ); + via->SetStatus( static_cast( parseHex() ) ); NeedRIGHT(); break; diff --git a/pcbnew/tr_modif.cpp b/pcbnew/tr_modif.cpp index 69abe49d35..3a042ae2da 100644 --- a/pcbnew/tr_modif.cpp +++ b/pcbnew/tr_modif.cpp @@ -41,7 +41,8 @@ #include -static void ListSetState( EDA_ITEM* Start, int NbItem, int State, int onoff ); +static void ListSetState( EDA_ITEM* Start, int NbItem, STATUS_FLAGS State, + bool onoff ); void DrawTraces( EDA_DRAW_PANEL* panel, wxDC* DC, TRACK* aTrackList, int nbsegment, @@ -311,7 +312,8 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC, /* Set the bits of .m_State member to on/off value, using bit mask State * of a list of EDA_ITEM */ -static void ListSetState( EDA_ITEM* Start, int NbItem, int State, int onoff ) +static void ListSetState( EDA_ITEM* Start, int NbItem, STATUS_FLAGS State, + bool onoff ) { for( ; (Start != NULL ) && ( NbItem > 0 ); NbItem--, Start = Start->Next() ) { From bf56b2b35dfb13d7893ba5a95fa71a5dded4807d Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Thu, 28 Mar 2013 16:49:17 -0400 Subject: [PATCH 19/63] Fix a GOST compile error. --- common/common_plot_functions.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/common_plot_functions.cpp b/common/common_plot_functions.cpp index 4e07bdaa78..57ce954da2 100644 --- a/common/common_plot_functions.cpp +++ b/common/common_plot_functions.cpp @@ -59,7 +59,11 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, int iusPerMil = plotter->GetIUsPerDecimil() * 10; wxSize pageSize = aPageInfo.GetSizeMils(); // in mils int xg, yg; -// int refx, refy; + +#if defined( KICAD_GOST ) + int refx, refy; +#endif + wxPoint pos, end, ref; wxString msg; wxSize text_size; From d0724de1de98583f7e0f6a5a1d25980b95b5ff51 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 29 Mar 2013 11:14:32 +0100 Subject: [PATCH 20/63] Fix rounding issue when a double is stored in a wxConfig file (wxWidgets 2.9.4 store only 4 digits in mantissa). A new inline function ConfigBaseWriteDouble( config, key, double_value ) is used instead of config->Write( key, double_value ) which store 12 digits --- common/projet_config.cpp | 12 ++++++-- include/param_config.h | 25 ++++++++++++++++ pcbnew/dialogs/dialog_copper_zones.cpp | 11 ++++--- pcbnew/dialogs/dialog_plot.cpp | 7 +++-- pcbnew/dialogs/dialog_print_using_printer.cpp | 6 ++-- pcbnew/pcbframe.cpp | 29 ++++++++++--------- pcbnew/pcbnew_config.cpp | 2 ++ 7 files changed, 66 insertions(+), 26 deletions(-) diff --git a/common/projet_config.cpp b/common/projet_config.cpp index dba92bb4e5..8e77bc7961 100644 --- a/common/projet_config.cpp +++ b/common/projet_config.cpp @@ -508,7 +508,11 @@ void PARAM_CFG_INT_WITH_SCALE::SaveParam( wxConfigBase* aConfig ) const if( m_Pt_param == NULL || aConfig == NULL ) return; - aConfig->Write( m_Ident, *m_Pt_param * m_BIU_to_cfgunit ); + // We cannot use aConfig->Write for a double, because + // this function uses a format with very few digits in mantissa, + // and truncature issues are frequent. + // We uses our function. + ConfigBaseWriteDouble( aConfig, m_Ident, *m_Pt_param * m_BIU_to_cfgunit ); } @@ -617,7 +621,11 @@ void PARAM_CFG_DOUBLE::SaveParam( wxConfigBase* aConfig ) const if( m_Pt_param == NULL || aConfig == NULL ) return; - aConfig->Write( m_Ident, *m_Pt_param ); + // We cannot use aConfig->Write for a double, because + // this function uses a format with very few digits in mantissa, + // and truncature issues are frequent. + // We uses our function. + ConfigBaseWriteDouble( aConfig, m_Ident, *m_Pt_param ); } diff --git a/include/param_config.h b/include/param_config.h index 1868cf9afb..65f8759779 100644 --- a/include/param_config.h +++ b/include/param_config.h @@ -14,6 +14,31 @@ +/** + * inline ConfigBaseWriteDouble + * This is a helper funvtion tor write doubles in config + * We cannot use wxConfigBase->Write for a double, because + * this function uses a format with very few digits in mantissa, + * and truncation issues are frequent. + * We use here a better floatting format. + * + * Note: prior to 2.9.1, the separator was localized, and after, uses + * the "C" notation + */ + void inline ConfigBaseWriteDouble( wxConfigBase* aConfig, + const wxString& aKey, double aValue ) + { + wxString tnumber; + +#if wxCHECK_VERSION(2,9,1) + tnumber = wxString::FromCDouble( aValue, 12 ); +#else + tnumber.Printf( wxT("%12f"), aValue ); +#endif + aConfig->Write( aKey, tnumber ); +} + + /** Type of parameter in the configuration file */ enum paramcfg_id { PARAM_INT, diff --git a/pcbnew/dialogs/dialog_copper_zones.cpp b/pcbnew/dialogs/dialog_copper_zones.cpp index 6daacdb21b..92167854f5 100644 --- a/pcbnew/dialogs/dialog_copper_zones.cpp +++ b/pcbnew/dialogs/dialog_copper_zones.cpp @@ -415,21 +415,20 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab m_settings.m_Zone_45_Only = true; m_settings.m_ThermalReliefGap = ReturnValueFromTextCtrl( *m_AntipadSizeValue ); - m_settings.m_ThermalReliefCopperBridge = ReturnValueFromTextCtrl( *m_CopperWidthValue ); if( m_Config ) { - m_Config->Write( ZONE_CLEARANCE_WIDTH_STRING_KEY, - (double) m_settings.m_ZoneClearance / IU_PER_MILS ); + ConfigBaseWriteDouble( m_Config, ZONE_CLEARANCE_WIDTH_STRING_KEY, + (double) m_settings.m_ZoneClearance / IU_PER_MILS ); - m_Config->Write( ZONE_MIN_THICKNESS_WIDTH_STRING_KEY, + ConfigBaseWriteDouble( m_Config, ZONE_MIN_THICKNESS_WIDTH_STRING_KEY, (double) m_settings.m_ZoneMinThickness / IU_PER_MILS ); - m_Config->Write( ZONE_THERMAL_RELIEF_GAP_STRING_KEY, + ConfigBaseWriteDouble( m_Config, ZONE_THERMAL_RELIEF_GAP_STRING_KEY, (double) m_settings.m_ThermalReliefGap / IU_PER_MILS ); - m_Config->Write( ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY, + ConfigBaseWriteDouble( m_Config, ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY, (double) m_settings.m_ThermalReliefCopperBridge / IU_PER_MILS ); } diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp index 636f7eae8a..fff9f9bbf7 100644 --- a/pcbnew/dialogs/dialog_plot.cpp +++ b/pcbnew/dialogs/dialog_plot.cpp @@ -627,7 +627,7 @@ void DIALOG_PLOT::applyPlotSettings() m_messagesBox->AppendText( msg ); } - m_config->Write( OPTKEY_PLOT_X_FINESCALE_ADJ, m_XScaleAdjust ); + ConfigBaseWriteDouble( m_config, OPTKEY_PLOT_X_FINESCALE_ADJ, m_XScaleAdjust ); // Y scale msg = m_fineAdjustYscaleOpt->GetValue(); @@ -641,7 +641,7 @@ void DIALOG_PLOT::applyPlotSettings() m_messagesBox->AppendText( msg ); } - m_config->Write( OPTKEY_PLOT_Y_FINESCALE_ADJ, m_YScaleAdjust ); + ConfigBaseWriteDouble( m_config, OPTKEY_PLOT_Y_FINESCALE_ADJ, m_YScaleAdjust ); // PS Width correction msg = m_PSFineAdjustWidthOpt->GetValue(); @@ -661,7 +661,8 @@ void DIALOG_PLOT::applyPlotSettings() } // Store m_PSWidthAdjust in mm in user config - m_config->Write( CONFIG_PS_FINEWIDTH_ADJ, (double)m_PSWidthAdjust / IU_PER_MM ); + ConfigBaseWriteDouble( m_config, CONFIG_PS_FINEWIDTH_ADJ, + (double)m_PSWidthAdjust / IU_PER_MM ); tempOptions.SetUseGerberExtensions( m_useGerberExtensions->GetValue() ); diff --git a/pcbnew/dialogs/dialog_print_using_printer.cpp b/pcbnew/dialogs/dialog_print_using_printer.cpp index 379bd073f6..111d107391 100644 --- a/pcbnew/dialogs/dialog_print_using_printer.cpp +++ b/pcbnew/dialogs/dialog_print_using_printer.cpp @@ -314,8 +314,10 @@ void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event ) if( m_config ) { - m_config->Write( OPTKEY_PRINT_X_FINESCALE_ADJ, s_Parameters.m_XScaleAdjust ); - m_config->Write( OPTKEY_PRINT_Y_FINESCALE_ADJ, s_Parameters.m_YScaleAdjust ); + ConfigBaseWriteDouble( m_config, OPTKEY_PRINT_X_FINESCALE_ADJ, + s_Parameters.m_XScaleAdjust ); + ConfigBaseWriteDouble( m_config, OPTKEY_PRINT_Y_FINESCALE_ADJ, + s_Parameters.m_YScaleAdjust ); m_config->Write( OPTKEY_PRINT_SCALE, m_ScaleOption->GetSelection() ); m_config->Write( OPTKEY_PRINT_PAGE_FRAME, s_Parameters.m_Print_Sheet_Ref); m_config->Write( OPTKEY_PRINT_MONOCHROME_MODE, s_Parameters.m_Print_Black_and_White); diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 3378c576e3..5ee7f1a2f1 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -61,11 +61,11 @@ // Keys used in read/write config #define OPTKEY_DEFAULT_LINEWIDTH_VALUE wxT( "PlotLineWidth_mm" ) -#define PCB_SHOW_FULL_RATSNET_OPT wxT( "PcbFulRatsnest" ) -#define PCB_MAGNETIC_PADS_OPT wxT( "PcbMagPadOpt" ) -#define PCB_MAGNETIC_TRACKS_OPT wxT( "PcbMagTrackOpt" ) -#define SHOW_MICROWAVE_TOOLS wxT( "ShowMicrowaveTools" ) -#define SHOW_LAYER_MANAGER_TOOLS wxT( "ShowLayerManagerTools" ) +#define PCB_SHOW_FULL_RATSNET_OPT wxT( "PcbFullRatsnest" ) +#define PCB_MAGNETIC_PADS_OPT wxT( "PcbMagPadOpt" ) +#define PCB_MAGNETIC_TRACKS_OPT wxT( "PcbMagTrackOpt" ) +#define SHOW_MICROWAVE_TOOLS wxT( "ShowMicrowaveTools" ) +#define SHOW_LAYER_MANAGER_TOOLS wxT( "ShowLayerManagerTools" ) BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) @@ -313,14 +313,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title, m_drc = new DRC( this ); // these 2 objects point to each other - m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill; - m_DisplayPadFill = DisplayOpt.DisplayPadFill; - m_DisplayViaFill = DisplayOpt.DisplayViaFill; - m_DisplayPadNum = DisplayOpt.DisplayPadNum; - - m_DisplayModEdge = DisplayOpt.DisplayModEdge; - m_DisplayModText = DisplayOpt.DisplayModText; - wxIcon icon; icon.CopyFromBitmap( KiBitmap( icon_pcbnew_xpm ) ); SetIcon( icon ); @@ -333,6 +325,16 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title, // LoadSettings() *after* creating m_LayersManager, because LoadSettings() // initialize parameters in m_LayersManager LoadSettings(); + + // Be sure options are updated + m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill; + m_DisplayPadFill = DisplayOpt.DisplayPadFill; + m_DisplayViaFill = DisplayOpt.DisplayViaFill; + m_DisplayPadNum = DisplayOpt.DisplayPadNum; + + m_DisplayModEdge = DisplayOpt.DisplayModEdge; + m_DisplayModText = DisplayOpt.DisplayModText; + SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y ); GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnit, ID_POPUP_GRID_USER ); @@ -592,6 +594,7 @@ void PCB_EDIT_FRAME::LoadSettings() long tmp; config->Read( PCB_SHOW_FULL_RATSNET_OPT, &tmp ); GetBoard()->SetElementVisibility(RATSNEST_VISIBLE, tmp); + config->Read( PCB_MAGNETIC_PADS_OPT, &g_MagneticPadOption ); config->Read( PCB_MAGNETIC_TRACKS_OPT, &g_MagneticTrackOption ); config->Read( SHOW_MICROWAVE_TOOLS, &m_show_microwave_tools ); diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index b6d1d76224..895d9c1e63 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -348,6 +348,8 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings() &DisplayOpt.DisplayModText, FILLED, 0, 2 ) ); m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "PcbAffT" ), &DisplayOpt.DisplayDrawItems, FILLED, 0, 2 ) ); + m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "PcbShowZonesMode" ), + &DisplayOpt.DisplayZonesMode, 0, 0, 2 ) ); // Colors: m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLay0" ), LOC_COLOR( 0 ), From 45fc0125a78fae448b92ca23cf8640c9f3f37347 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Fri, 29 Mar 2013 20:06:08 -0400 Subject: [PATCH 21/63] Fix field position bug in edit component dialog when OK button cancelled due to empty field. --- .../dialog_edit_component_in_schematic.cpp | 63 +++++++++++++------ 1 file changed, 44 insertions(+), 19 deletions(-) diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp index fddff29360..5184ca74fb 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp @@ -1,3 +1,26 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + /** * @file dialog_edit_component_in_schematic.cpp */ @@ -142,8 +165,9 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions() newname.Replace( wxT( " " ), wxT( "_" ) ); if( newname.IsEmpty() ) + { DisplayError( NULL, _( "No Component Name!" ) ); - + } else if( newname.CmpNoCase( m_Cmp->m_ChipName ) ) { if( CMP_LIBRARY::FindLibraryEntry( newname ) == NULL ) @@ -230,12 +254,6 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick( wxCommandEvent& event copyPanelToOptions(); - // change all field positions from relative to absolute - for( unsigned i = 0; im_Pos ); - } - // Delete any fields with no name before we copy all of m_FieldsBuf back into the component. for( unsigned i = MANDATORY_FIELDS; i does not have a value and is not defined in \ -the field template list. Empty field values are invalid an will be removed from the component. \ -Do you wish to remove this and all remaining undefined fields?" ), + msg.Printf( _( "The field name <%s> does not have a value and is not defined in " + "the field template list. Empty field values are invalid an will " + "be removed from the component. Do you wish to remove this and " + "all remaining undefined fields?" ), GetChars( m_FieldsBuf[i].GetName( false ) ) ); wxMessageDialog dlg( this, msg, _( "Remove Fields" ), wxYES_NO | wxNO_DEFAULT ); @@ -271,6 +290,12 @@ Do you wish to remove this and all remaining undefined fields?" ), ++i; } + // change all field positions from relative to absolute + for( unsigned i = 0; im_Pos ); + } + LIB_COMPONENT* entry = CMP_LIBRARY::FindLibraryComponent( m_Cmp->m_ChipName ); if( entry && entry->IsPower() ) @@ -440,8 +465,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent #if 0 && defined(DEBUG) for( int i = 0; iGetFieldCount(); ++i ) { - printf( "Orig[%d] (x=%d, y=%d)\n", i, aComponent->m_Fields[i].m_Pos.x, - aComponent->m_Fields[i].m_Pos.y ); + printf( "Orig[%d] (x=%d, y=%d)\n", i, aComponent->m_Fields[i].GetTextPosition().x, + aComponent->m_Fields[i].GetTextPosition().y ); } #endif @@ -607,18 +632,18 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel() // Select the right text justification if( field.GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT ) - m_FieldHJustifyCtrl->SetSelection(0); + m_FieldHJustifyCtrl->SetSelection( 0 ); else if( field.GetHorizJustify() == GR_TEXT_HJUSTIFY_RIGHT ) - m_FieldHJustifyCtrl->SetSelection(2); + m_FieldHJustifyCtrl->SetSelection( 2 ); else - m_FieldHJustifyCtrl->SetSelection(1); + m_FieldHJustifyCtrl->SetSelection( 1 ); if( field.GetVertJustify() == GR_TEXT_VJUSTIFY_BOTTOM ) - m_FieldVJustifyCtrl->SetSelection(0); + m_FieldVJustifyCtrl->SetSelection( 0 ); else if( field.GetVertJustify() == GR_TEXT_VJUSTIFY_TOP ) - m_FieldVJustifyCtrl->SetSelection(2); + m_FieldVJustifyCtrl->SetSelection( 2 ); else - m_FieldVJustifyCtrl->SetSelection(1); + m_FieldVJustifyCtrl->SetSelection( 1 ); fieldNameTextCtrl->SetValue( field.GetName( false ) ); @@ -729,7 +754,7 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField() wxPoint pos; pos.x = ReturnValueFromString( g_UserUnit, posXTextCtrl->GetValue() ); pos.y = ReturnValueFromString( g_UserUnit, posYTextCtrl->GetValue() ); - field.SetPosition( pos ); + field.SetTextPosition( pos ); return true; } From 9c60e618c0a5dda29aa9b9f8fae055b85fb839c0 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 30 Mar 2013 14:36:19 +0100 Subject: [PATCH 22/63] pcbnew: fix some cosmetic issues (could be very dependant on wxWidgets/Gtk versions) --- pcbnew/dialogs/dialog_layers_setup_base.cpp | 40 +- pcbnew/dialogs/dialog_layers_setup_base.fbp | 284 ++- pcbnew/dialogs/dialog_layers_setup_base.h | 12 +- pcbnew/dialogs/dialog_pad_properties_base.cpp | 70 +- pcbnew/dialogs/dialog_pad_properties_base.fbp | 137 +- pcbnew/dialogs/dialog_pad_properties_base.h | 3 +- ...ialog_pcbnew_config_libs_and_paths_fbp.cpp | 87 +- ...ialog_pcbnew_config_libs_and_paths_fbp.fbp | 1750 ++++++++++------- .../dialog_pcbnew_config_libs_and_paths_fbp.h | 18 +- template/kicad.pro | 31 +- 10 files changed, 1484 insertions(+), 948 deletions(-) diff --git a/pcbnew/dialogs/dialog_layers_setup_base.cpp b/pcbnew/dialogs/dialog_layers_setup_base.cpp index 59d55b9b0b..466b5d8976 100644 --- a/pcbnew/dialogs/dialog_layers_setup_base.cpp +++ b/pcbnew/dialogs/dialog_layers_setup_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 10 2012) +// C++ code generated with wxFormBuilder (version Oct 8 2012) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -19,35 +19,47 @@ DIALOG_LAYERS_SETUP_BASE::DIALOG_LAYERS_SETUP_BASE( wxWindow* parent, wxWindowID wxBoxSizer* bChoicesSizer; bChoicesSizer = new wxBoxSizer( wxHORIZONTAL ); - wxStaticBoxSizer* sbPresetsSizer; - sbPresetsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Preset Layer Groupings") ), wxVERTICAL ); + wxBoxSizer* bPresetsSizer; + bPresetsSizer = new wxBoxSizer( wxVERTICAL ); + + m_staticTextGrouping = new wxStaticText( this, wxID_ANY, _("Preset Layer Groupings"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextGrouping->Wrap( -1 ); + bPresetsSizer->Add( m_staticTextGrouping, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); wxString m_PresetsChoiceChoices[] = { _("Custom"), _("Two layers, parts on Front only"), _("Two layers, parts on Back only"), _("Two layers, parts on Front and Back"), _("Four layers, parts on Front only"), _("Four layers, parts on Front and Back"), _("All layers on") }; int m_PresetsChoiceNChoices = sizeof( m_PresetsChoiceChoices ) / sizeof( wxString ); m_PresetsChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_PresetsChoiceNChoices, m_PresetsChoiceChoices, 0 ); m_PresetsChoice->SetSelection( 0 ); - sbPresetsSizer->Add( m_PresetsChoice, 0, wxEXPAND, 5 ); + bPresetsSizer->Add( m_PresetsChoice, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - bChoicesSizer->Add( sbPresetsSizer, 2, wxALL|wxEXPAND, 5 ); + bChoicesSizer->Add( bPresetsSizer, 1, wxEXPAND, 5 ); - wxStaticBoxSizer* sbCopperLayersSizer; - sbCopperLayersSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Copper Layers") ), wxVERTICAL ); + wxBoxSizer* bCopperLayersSizer; + bCopperLayersSizer = new wxBoxSizer( wxVERTICAL ); + + m_staticTextCopperLayers = new wxStaticText( this, wxID_ANY, _("Copper Layers"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextCopperLayers->Wrap( -1 ); + bCopperLayersSizer->Add( m_staticTextCopperLayers, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); wxString m_CopperLayersChoiceChoices[] = { _("2"), _("4"), _("6"), _("8"), _("10"), _("12"), _("14"), _("16") }; int m_CopperLayersChoiceNChoices = sizeof( m_CopperLayersChoiceChoices ) / sizeof( wxString ); m_CopperLayersChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_CopperLayersChoiceNChoices, m_CopperLayersChoiceChoices, 0 ); m_CopperLayersChoice->SetSelection( 0 ); - sbCopperLayersSizer->Add( m_CopperLayersChoice, 0, wxEXPAND, 5 ); + bCopperLayersSizer->Add( m_CopperLayersChoice, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - bChoicesSizer->Add( sbCopperLayersSizer, 1, wxALL|wxEXPAND, 5 ); + bChoicesSizer->Add( bCopperLayersSizer, 1, wxEXPAND, 5 ); bMainSizer->Add( bChoicesSizer, 0, wxEXPAND, 5 ); - wxStaticBoxSizer* sbLayersSizer; - sbLayersSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Layers") ), wxVERTICAL ); + wxBoxSizer* b_layersListSizer; + b_layersListSizer = new wxBoxSizer( wxVERTICAL ); + + m_staticTextLayers = new wxStaticText( this, wxID_ANY, _("Layers"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextLayers->Wrap( -1 ); + b_layersListSizer->Add( m_staticTextLayers, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); wxBoxSizer* bCaptionsSizer; bCaptionsSizer = new wxBoxSizer( wxHORIZONTAL ); @@ -59,7 +71,7 @@ DIALOG_LAYERS_SETUP_BASE::DIALOG_LAYERS_SETUP_BASE( wxWindow* parent, wxWindowID bCaptionsSizer->Add( m_TitlePanel, 1, wxEXPAND, 5 ); - sbLayersSizer->Add( bCaptionsSizer, 0, wxALIGN_CENTER|wxEXPAND, 5 ); + b_layersListSizer->Add( bCaptionsSizer, 0, wxALIGN_CENTER|wxEXPAND|wxRIGHT|wxLEFT, 5 ); m_LayersListPanel = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxALWAYS_SHOW_SB|wxRAISED_BORDER|wxTAB_TRAVERSAL|wxVSCROLL ); m_LayersListPanel->SetScrollRate( 0, 5 ); @@ -834,10 +846,10 @@ DIALOG_LAYERS_SETUP_BASE::DIALOG_LAYERS_SETUP_BASE( wxWindow* parent, wxWindowID m_LayersListPanel->SetSizer( m_LayerListFlexGridSizer ); m_LayersListPanel->Layout(); m_LayerListFlexGridSizer->Fit( m_LayersListPanel ); - sbLayersSizer->Add( m_LayersListPanel, 1, wxALL|wxEXPAND, 5 ); + b_layersListSizer->Add( m_LayersListPanel, 1, wxALL|wxEXPAND, 5 ); - bMainSizer->Add( sbLayersSizer, 1, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 5 ); + bMainSizer->Add( b_layersListSizer, 1, wxEXPAND, 5 ); m_sdbSizer2 = new wxStdDialogButtonSizer(); m_sdbSizer2OK = new wxButton( this, wxID_OK ); diff --git a/pcbnew/dialogs/dialog_layers_setup_base.fbp b/pcbnew/dialogs/dialog_layers_setup_base.fbp index 7594bc8510..4fd892ccf1 100644 --- a/pcbnew/dialogs/dialog_layers_setup_base.fbp +++ b/pcbnew/dialogs/dialog_layers_setup_base.fbp @@ -102,19 +102,99 @@ none 5 - wxALL|wxEXPAND - 2 - - wxID_ANY - Preset Layer Groupings + wxEXPAND + 1 + - sbPresetsSizer + bPresetsSizer wxVERTICAL none - 5 - wxEXPAND + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Preset Layer Groupings + + 0 + + + 0 + + 1 + m_staticTextGrouping + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT 0 1 @@ -204,19 +284,99 @@ 5 - wxALL|wxEXPAND + wxEXPAND 1 - - wxID_ANY - Copper Layers + - sbCopperLayersSizer + bCopperLayersSizer wxVERTICAL none - 5 - wxEXPAND + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Copper Layers + + 0 + + + 0 + + 1 + m_staticTextCopperLayers + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxRIGHT|wxLEFT 0 1 @@ -308,19 +468,99 @@ 5 - wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND + wxEXPAND 1 - - wxID_ANY - Layers + - sbLayersSizer + b_layersListSizer wxVERTICAL none - 5 - wxALIGN_CENTER|wxEXPAND + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Layers + + 0 + + + 0 + + 1 + m_staticTextLayers + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER|wxEXPAND|wxRIGHT|wxLEFT 0 diff --git a/pcbnew/dialogs/dialog_layers_setup_base.h b/pcbnew/dialogs/dialog_layers_setup_base.h index e0962b4b63..48f4dafa67 100644 --- a/pcbnew/dialogs/dialog_layers_setup_base.h +++ b/pcbnew/dialogs/dialog_layers_setup_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 10 2012) +// C++ code generated with wxFormBuilder (version Oct 8 2012) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -11,17 +11,18 @@ #include #include #include +class DIALOG_SHIM; + #include "dialog_shim.h" #include -#include +#include #include #include #include #include +#include #include -#include #include -#include #include #include #include @@ -126,8 +127,11 @@ class DIALOG_LAYERS_SETUP_BASE : public DIALOG_SHIM private: protected: + wxStaticText* m_staticTextGrouping; wxChoice* m_PresetsChoice; + wxStaticText* m_staticTextCopperLayers; wxChoice* m_CopperLayersChoice; + wxStaticText* m_staticTextLayers; wxPanel* m_TitlePanel; wxScrolledWindow* m_LayersListPanel; wxFlexGridSizer* m_LayerListFlexGridSizer; diff --git a/pcbnew/dialogs/dialog_pad_properties_base.cpp b/pcbnew/dialogs/dialog_pad_properties_base.cpp index 21e66b3dac..2088cf454c 100644 --- a/pcbnew/dialogs/dialog_pad_properties_base.cpp +++ b/pcbnew/dialogs/dialog_pad_properties_base.cpp @@ -221,25 +221,8 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind m_LeftBoxSizer->Add( fgSizerShapeType, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - wxBoxSizer* bMiddleUpperSizer; - bMiddleUpperSizer = new wxBoxSizer( wxHORIZONTAL ); - - m_DrillShapeBoxSizer = new wxBoxSizer( wxVERTICAL ); - - - bMiddleUpperSizer->Add( m_DrillShapeBoxSizer, 0, wxBOTTOM, 5 ); - - wxBoxSizer* m_MiddleRightBoxSizer; - m_MiddleRightBoxSizer = new wxBoxSizer( wxVERTICAL ); - - - bMiddleUpperSizer->Add( m_MiddleRightBoxSizer, 0, wxBOTTOM, 5 ); - - - m_LeftBoxSizer->Add( bMiddleUpperSizer, 0, wxEXPAND, 5 ); - wxStaticBoxSizer* sbSizeModuleInfo; - sbSizeModuleInfo = new wxStaticBoxSizer( new wxStaticBox( m_panelGeneral, wxID_ANY, _("Footprint Orientation") ), wxVERTICAL ); + sbSizeModuleInfo = new wxStaticBoxSizer( new wxStaticBox( m_panelGeneral, wxID_ANY, _("Parent footprint orientation") ), wxVERTICAL ); wxFlexGridSizer* fgSizer4; fgSizer4 = new wxFlexGridSizer( 2, 2, 0, 0 ); @@ -264,13 +247,13 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind fgSizer4->Add( m_staticModuleSideValue, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 ); - sbSizeModuleInfo->Add( fgSizer4, 1, wxEXPAND, 5 ); + sbSizeModuleInfo->Add( fgSizer4, 0, 0, 5 ); - m_LeftBoxSizer->Add( sbSizeModuleInfo, 0, wxEXPAND|wxBOTTOM, 5 ); + m_LeftBoxSizer->Add( sbSizeModuleInfo, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - bGeneralSizer->Add( m_LeftBoxSizer, 0, wxALL|wxEXPAND, 5 ); + bGeneralSizer->Add( m_LeftBoxSizer, 1, wxALL|wxEXPAND, 5 ); wxBoxSizer* bSizer10; bSizer10 = new wxBoxSizer( wxVERTICAL ); @@ -280,6 +263,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind wxFlexGridSizer* fgSizerGeometry; fgSizerGeometry = new wxFlexGridSizer( 14, 3, 0, 0 ); + fgSizerGeometry->AddGrowableCol( 1 ); fgSizerGeometry->SetFlexibleDirection( wxBOTH ); fgSizerGeometry->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); @@ -322,10 +306,10 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind fgSizerGeometry->Add( m_PadDrill_Y_Unit, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - sbSizer2->Add( fgSizerGeometry, 1, wxEXPAND, 5 ); + sbSizer2->Add( fgSizerGeometry, 0, wxEXPAND, 5 ); - bSizer10->Add( sbSizer2, 0, wxALL, 5 ); + bSizer10->Add( sbSizer2, 0, wxALL|wxEXPAND, 5 ); wxStaticBoxSizer* m_LayersSizer; m_LayersSizer = new wxStaticBoxSizer( new wxStaticBox( m_panelGeneral, wxID_ANY, _("Layers") ), wxVERTICAL ); @@ -386,7 +370,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind m_LayersSizer->Add( sbSizerTechlayers, 0, wxALL|wxEXPAND, 5 ); - bSizer10->Add( m_LayersSizer, 1, wxALL|wxEXPAND, 5 ); + bSizer10->Add( m_LayersSizer, 0, wxALL|wxEXPAND, 5 ); bGeneralSizer->Add( bSizer10, 0, wxALL|wxEXPAND, 5 ); @@ -397,8 +381,8 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind bGeneralSizer->Fit( m_panelGeneral ); m_notebook->AddPage( m_panelGeneral, _("General"), true ); m_localSettingsPanel = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* bSizer14; - bSizer14 = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bSizerPanelClearance; + bSizerPanelClearance = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* bSizerClearance; bSizerClearance = new wxBoxSizer( wxVERTICAL ); @@ -408,6 +392,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind wxFlexGridSizer* fgClearancesGridSizer; fgClearancesGridSizer = new wxFlexGridSizer( 4, 3, 0, 0 ); + fgClearancesGridSizer->AddGrowableCol( 1 ); fgClearancesGridSizer->SetFlexibleDirection( wxBOTH ); fgClearancesGridSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); @@ -468,16 +453,17 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind fgClearancesGridSizer->Add( m_SolderPasteRatioMarginUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - sbClearancesSizer->Add( fgClearancesGridSizer, 1, wxEXPAND, 5 ); + sbClearancesSizer->Add( fgClearancesGridSizer, 0, wxEXPAND, 5 ); - bSizerClearance->Add( sbClearancesSizer, 0, wxEXPAND|wxALL, 5 ); + bSizerClearance->Add( sbClearancesSizer, 0, wxALL|wxEXPAND, 5 ); wxStaticBoxSizer* sbSizerZonesSettings; sbSizerZonesSettings = new wxStaticBoxSizer( new wxStaticBox( m_localSettingsPanel, wxID_ANY, _("Copper Zones") ), wxVERTICAL ); wxFlexGridSizer* fgSizer41; fgSizer41 = new wxFlexGridSizer( 3, 3, 0, 0 ); + fgSizer41->AddGrowableCol( 1 ); fgSizer41->SetFlexibleDirection( wxBOTH ); fgSizer41->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); @@ -489,7 +475,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind int m_ZoneConnectionChoiceNChoices = sizeof( m_ZoneConnectionChoiceChoices ) / sizeof( wxString ); m_ZoneConnectionChoice = new wxChoice( m_localSettingsPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_ZoneConnectionChoiceNChoices, m_ZoneConnectionChoiceChoices, 0 ); m_ZoneConnectionChoice->SetSelection( 0 ); - fgSizer41->Add( m_ZoneConnectionChoice, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP, 5 ); + fgSizer41->Add( m_ZoneConnectionChoice, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxEXPAND, 5 ); m_staticText53 = new wxStaticText( m_localSettingsPanel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_staticText53->Wrap( -1 ); @@ -520,10 +506,10 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind fgSizer41->Add( m_ThermalGapUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - sbSizerZonesSettings->Add( fgSizer41, 1, wxEXPAND, 5 ); + sbSizerZonesSettings->Add( fgSizer41, 0, wxEXPAND, 5 ); - bSizerClearance->Add( sbSizerZonesSettings, 0, wxEXPAND|wxALL, 5 ); + bSizerClearance->Add( sbSizerZonesSettings, 0, wxALL|wxEXPAND, 5 ); m_staticTextWarning = new wxStaticText( m_localSettingsPanel, wxID_ANY, _("Set fields to 0 to use parent or global values"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextWarning->Wrap( -1 ); @@ -532,29 +518,26 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind bSizerClearance->Add( m_staticTextWarning, 0, wxALL, 5 ); - bSizer14->Add( bSizerClearance, 0, wxALL, 5 ); + bSizerPanelClearance->Add( bSizerClearance, 0, wxALL|wxEXPAND, 5 ); - bSizer14->Add( 0, 0, 1, wxEXPAND, 5 ); - - - m_localSettingsPanel->SetSizer( bSizer14 ); + m_localSettingsPanel->SetSizer( bSizerPanelClearance ); m_localSettingsPanel->Layout(); - bSizer14->Fit( m_localSettingsPanel ); + bSizerPanelClearance->Fit( m_localSettingsPanel ); m_notebook->AddPage( m_localSettingsPanel, _("Local Clearance and Settings"), false ); - bSizerUpper->Add( m_notebook, 0, wxALL|wxEXPAND, 5 ); + bSizerUpper->Add( m_notebook, 0, wxALL, 5 ); - wxBoxSizer* bSizer13x; - bSizer13x = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bSizerDisplayPad; + bSizerDisplayPad = new wxBoxSizer( wxVERTICAL ); m_panelShowPad = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxSize( 200,200 ), wxFULL_REPAINT_ON_RESIZE|wxSIMPLE_BORDER ); m_panelShowPad->SetBackgroundColour( wxColour( 0, 0, 0 ) ); - bSizer13x->Add( m_panelShowPad, 1, wxRIGHT|wxTOP, 5 ); + bSizerDisplayPad->Add( m_panelShowPad, 1, wxRIGHT|wxTOP|wxEXPAND, 5 ); - bSizerUpper->Add( bSizer13x, 1, wxALL, 5 ); + bSizerUpper->Add( bSizerDisplayPad, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 ); m_MainSizer->Add( bSizerUpper, 1, wxEXPAND, 5 ); @@ -572,12 +555,11 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); m_sdbSizer1->Realize(); - m_MainSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 5 ); + m_MainSizer->Add( m_sdbSizer1, 0, wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); this->SetSizer( m_MainSizer ); this->Layout(); - m_MainSizer->Fit( this ); this->Centre( wxBOTH ); diff --git a/pcbnew/dialogs/dialog_pad_properties_base.fbp b/pcbnew/dialogs/dialog_pad_properties_base.fbp index a4561cdf35..299fe40396 100644 --- a/pcbnew/dialogs/dialog_pad_properties_base.fbp +++ b/pcbnew/dialogs/dialog_pad_properties_base.fbp @@ -42,7 +42,7 @@ -1,-1 DIALOG_PAD_PROPERTIES_BASE - -1,-1 + 745,725 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Pad Properties @@ -102,7 +102,7 @@ none 5 - wxALL|wxEXPAND + wxALL 0 1 @@ -265,11 +265,11 @@ bGeneralSizer wxHORIZONTAL none - + 5 wxALL|wxEXPAND - 0 - + 1 + m_LeftBoxSizer wxVERTICAL @@ -3821,56 +3821,23 @@ - + 5 - wxEXPAND + wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND 0 - - - bMiddleUpperSizer - wxHORIZONTAL - none - - 5 - wxBOTTOM - 0 - - - m_DrillShapeBoxSizer - wxVERTICAL - protected - - - - 5 - wxBOTTOM - 0 - - - m_MiddleRightBoxSizer - wxVERTICAL - none - - - - - - 5 - wxEXPAND|wxBOTTOM - 0 - + wxID_ANY - Footprint Orientation + Parent footprint orientation sbSizeModuleInfo wxVERTICAL none - + 5 - wxEXPAND - 1 - + + 0 + 2 wxBOTH 1 @@ -4220,20 +4187,20 @@ - + 5 wxALL|wxEXPAND 0 - + bSizer10 wxVERTICAL none - + 5 - wxALL + wxALL|wxEXPAND 0 - + wxID_ANY Drill @@ -4241,14 +4208,14 @@ wxVERTICAL none - + 5 wxEXPAND - 1 - + 0 + 3 wxBOTH - + 1 0 @@ -5029,11 +4996,11 @@ - + 5 wxALL|wxEXPAND - 1 - + 0 + wxID_ANY Layers @@ -6290,25 +6257,25 @@ - + - bSizer14 + bSizerPanelClearance wxVERTICAL none - + 5 - wxALL + wxALL|wxEXPAND 0 - + bSizerClearance wxVERTICAL none - + 5 - wxEXPAND|wxALL + wxALL|wxEXPAND 0 - + wxID_ANY Clearances @@ -6319,11 +6286,11 @@ 5 wxEXPAND - 1 + 0 3 wxBOTH - + 1 0 @@ -7364,11 +7331,11 @@ - + 5 - wxEXPAND|wxALL + wxALL|wxEXPAND 0 - + wxID_ANY Copper Zones @@ -7376,14 +7343,14 @@ wxVERTICAL none - + 5 wxEXPAND - 1 - + 0 + 3 wxBOTH - + 1 0 @@ -7477,7 +7444,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP + wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxEXPAND 0 1 @@ -8249,16 +8216,6 @@ - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - @@ -8266,16 +8223,16 @@ 5 - wxALL + wxEXPAND|wxTOP|wxBOTTOM 1 - bSizer13x + bSizerDisplayPad wxVERTICAL none 5 - wxRIGHT|wxTOP + wxRIGHT|wxTOP|wxEXPAND 1 1 @@ -8442,7 +8399,7 @@ 5 - wxALL|wxEXPAND + wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT 0 0 diff --git a/pcbnew/dialogs/dialog_pad_properties_base.h b/pcbnew/dialogs/dialog_pad_properties_base.h index 501a1db753..13782e4627 100644 --- a/pcbnew/dialogs/dialog_pad_properties_base.h +++ b/pcbnew/dialogs/dialog_pad_properties_base.h @@ -93,7 +93,6 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM wxStaticText* m_staticText23; wxChoice* m_trapDeltaDirChoice; wxStaticText* m_staticText521; - wxBoxSizer* m_DrillShapeBoxSizer; wxStaticText* m_staticTitleModuleRot; wxStaticText* m_staticModuleRotValue; wxStaticText* m_staticTitleModuleSide; @@ -163,7 +162,7 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM public: - DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_DIALOG_EDIT_PAD, const wxString& title = _("Pad Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSUNKEN_BORDER ); + DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_DIALOG_EDIT_PAD, const wxString& title = _("Pad Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 745,725 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSUNKEN_BORDER ); ~DIALOG_PAD_PROPERTIES_BASE(); }; diff --git a/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths_fbp.cpp b/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths_fbp.cpp index ca98f5acfe..03eadd2a36 100644 --- a/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths_fbp.cpp +++ b/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths_fbp.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 10 2012) +// C++ code generated with wxFormBuilder (version Oct 8 2012) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -16,20 +16,21 @@ DIALOG_PCBNEW_CONFIG_LIBS_FBP::DIALOG_PCBNEW_CONFIG_LIBS_FBP( wxWindow* parent, wxBoxSizer* bMainSizer; bMainSizer = new wxBoxSizer( wxVERTICAL ); - wxStaticBoxSizer* sbLibsChoiceSizer; - sbLibsChoiceSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Footprint library files") ), wxHORIZONTAL ); + wxBoxSizer* bLibsChoiceSizer; + bLibsChoiceSizer = new wxBoxSizer( wxVERTICAL ); - wxBoxSizer* bLibsButtonsSizer; - bLibsButtonsSizer = new wxBoxSizer( wxHORIZONTAL ); + m_staticTextLibs = new wxStaticText( this, wxID_ANY, _("Footprint library files"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextLibs->Wrap( -1 ); + bLibsChoiceSizer->Add( m_staticTextLibs, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - sbLibsChoiceSizer->Add( bLibsButtonsSizer, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + wxBoxSizer* bLibsChoiceListSizer; + bLibsChoiceListSizer = new wxBoxSizer( wxHORIZONTAL ); m_ListLibr = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_EXTENDED|wxLB_HSCROLL|wxLB_NEEDED_SB|wxLB_SINGLE ); m_ListLibr->SetToolTip( _("List of active library files.\nOnly library files in this list are loaded by Pcbnew.\nThe order of this list is important:\nPcbnew searchs for a given footprint using this list order priority.") ); m_ListLibr->SetMinSize( wxSize( 400,90 ) ); - sbLibsChoiceSizer->Add( m_ListLibr, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bLibsChoiceListSizer->Add( m_ListLibr, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); wxBoxSizer* bRightSizer; bRightSizer = new wxBoxSizer( wxVERTICAL ); @@ -56,37 +57,51 @@ DIALOG_PCBNEW_CONFIG_LIBS_FBP::DIALOG_PCBNEW_CONFIG_LIBS_FBP( wxWindow* parent, bRightSizer->Add( m_buttonDown, 0, wxALL, 5 ); - sbLibsChoiceSizer->Add( bRightSizer, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + bLibsChoiceListSizer->Add( bRightSizer, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); - bMainSizer->Add( sbLibsChoiceSizer, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + bLibsChoiceSizer->Add( bLibsChoiceListSizer, 1, wxEXPAND, 5 ); - wxStaticBoxSizer* sbModulesDocSizer; - sbModulesDocSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Footprint documentation file") ), wxHORIZONTAL ); + + bMainSizer->Add( bLibsChoiceSizer, 1, wxEXPAND, 5 ); + + wxBoxSizer* bModulesDocSizer; + bModulesDocSizer = new wxBoxSizer( wxVERTICAL ); + + m_staticTextModulesDoc = new wxStaticText( this, wxID_ANY, _("Footprint documentation file"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextModulesDoc->Wrap( -1 ); + bModulesDocSizer->Add( m_staticTextModulesDoc, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizerDoc; + bSizerDoc = new wxBoxSizer( wxHORIZONTAL ); m_TextHelpModulesFileName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - sbModulesDocSizer->Add( m_TextHelpModulesFileName, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + m_TextHelpModulesFileName->SetMaxLength( 0 ); + bSizerDoc->Add( m_TextHelpModulesFileName, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT, 5 ); m_buttonModDoc = new wxButton( this, wxID_BROWSE_MOD_DOC, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 ); - sbModulesDocSizer->Add( m_buttonModDoc, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 10 ); + bSizerDoc->Add( m_buttonModDoc, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 10 ); - bMainSizer->Add( sbModulesDocSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + bModulesDocSizer->Add( bSizerDoc, 1, wxEXPAND, 5 ); - wxStaticBoxSizer* sbSizer4; - sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("User defined search paths") ), wxHORIZONTAL ); - sbSizer4->SetMinSize( wxSize( 400,70 ) ); - wxBoxSizer* bUserListSizer; - bUserListSizer = new wxBoxSizer( wxVERTICAL ); + bMainSizer->Add( bModulesDocSizer, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizerPaths; + bSizerPaths = new wxBoxSizer( wxVERTICAL ); + + m_staticTextPaths = new wxStaticText( this, wxID_ANY, _("User defined search paths"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextPaths->Wrap( -1 ); + bSizerPaths->Add( m_staticTextPaths, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizerPathsChoice; + bSizerPathsChoice = new wxBoxSizer( wxHORIZONTAL ); m_listUserPaths = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); m_listUserPaths->SetToolTip( _("Additional paths used in this project. The priority is higher than default KiCad paths.") ); - bUserListSizer->Add( m_listUserPaths, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - - sbSizer4->Add( bUserListSizer, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); + bSizerPathsChoice->Add( m_listUserPaths, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); wxBoxSizer* bUserPathsButtonsSizer; bUserPathsButtonsSizer = new wxBoxSizer( wxVERTICAL ); @@ -101,28 +116,29 @@ DIALOG_PCBNEW_CONFIG_LIBS_FBP::DIALOG_PCBNEW_CONFIG_LIBS_FBP( wxWindow* parent, bUserPathsButtonsSizer->Add( m_buttonRemovePath, 0, wxALL|wxBOTTOM, 5 ); - sbSizer4->Add( bUserPathsButtonsSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 ); + bSizerPathsChoice->Add( bUserPathsButtonsSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 ); - bMainSizer->Add( sbSizer4, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - - wxStaticBoxSizer* sbLibPathSizer; - sbLibPathSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Current search path list") ), wxVERTICAL ); - - wxBoxSizer* bUserLibPathSizer; - bUserLibPathSizer = new wxBoxSizer( wxHORIZONTAL ); + bSizerPaths->Add( bSizerPathsChoice, 0, wxEXPAND, 5 ); - sbLibPathSizer->Add( bUserLibPathSizer, 1, wxEXPAND, 5 ); + bMainSizer->Add( bSizerPaths, 0, wxEXPAND, 5 ); + + wxBoxSizer* bLibPathSizer; + bLibPathSizer = new wxBoxSizer( wxVERTICAL ); + + m_staticTextPathList = new wxStaticText( this, wxID_ANY, _("Current search path list"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextPathList->Wrap( -1 ); + bLibPathSizer->Add( m_staticTextPathList, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_DefaultLibraryPathslistBox = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_NEEDED_SB ); m_DefaultLibraryPathslistBox->SetToolTip( _("System and user paths used to search and load library files and component doc files.\nSorted by decreasing priority order.") ); m_DefaultLibraryPathslistBox->SetMinSize( wxSize( -1,70 ) ); - sbLibPathSizer->Add( m_DefaultLibraryPathslistBox, 0, wxALL|wxEXPAND, 5 ); + bLibPathSizer->Add( m_DefaultLibraryPathslistBox, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - bMainSizer->Add( sbLibPathSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + bMainSizer->Add( bLibPathSizer, 0, wxEXPAND, 5 ); m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); bMainSizer->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); @@ -139,7 +155,6 @@ DIALOG_PCBNEW_CONFIG_LIBS_FBP::DIALOG_PCBNEW_CONFIG_LIBS_FBP( wxWindow* parent, this->SetSizer( bMainSizer ); this->Layout(); - bMainSizer->Fit( this ); this->Centre( wxBOTH ); diff --git a/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths_fbp.fbp b/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths_fbp.fbp index 8afce21b01..0c059fd230 100644 --- a/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths_fbp.fbp +++ b/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths_fbp.fbp @@ -42,7 +42,7 @@ DIALOG_PCBNEW_CONFIG_LIBS_FBP - -1,-1 + 530,540 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h @@ -93,32 +93,662 @@ none 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT + wxEXPAND 1 - - wxID_ANY - Footprint library files + - sbLibsChoiceSizer - wxHORIZONTAL + bLibsChoiceSizer + wxVERTICAL none - 5 - wxALIGN_CENTER_HORIZONTAL + wxTOP|wxRIGHT|wxLEFT 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Footprint library files + + 0 + + + 0 + + 1 + m_staticTextLibs + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 - bLibsButtonsSizer + bLibsChoiceListSizer wxHORIZONTAL none + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + 400,90 + 1 + m_ListLibr + 1 + + + protected + 1 + + Resizable + 1 + + wxLB_EXTENDED|wxLB_HSCROLL|wxLB_NEEDED_SB|wxLB_SINGLE + + 0 + List of active library files. Only library files in this list are loaded by Pcbnew. The order of this list is important: Pcbnew searchs for a given footprint using this list order priority. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT + 0 + + + bRightSizer + wxVERTICAL + none + + 5 + wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_ADD_LIB + Add + + 0 + + + 0 + + 1 + m_buttonAddLib + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Add a new library after the selected library, and load it + + wxFILTER_NONE + wxDefaultValidator + + + + + OnAddOrInsertLibClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Insert + + 0 + + + 0 + + 1 + m_buttonIns + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Add a new library before the selected library, and load it + + wxFILTER_NONE + wxDefaultValidator + + + + + OnAddOrInsertLibClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_REMOVE_LIB + Remove + + 0 + + + 0 + + 1 + m_buttonRemoveLib + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Unload the selected library + + wxFILTER_NONE + wxDefaultValidator + + + + + OnRemoveLibClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Up + + 0 + + + 0 + + 1 + m_buttonUp + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnButtonUpClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Down + + 0 + + + 0 + + 1 + m_buttonDown + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnButtonDownClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + bModulesDocSizer + wxVERTICAL + none 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 1 - + wxTOP|wxRIGHT|wxLEFT + 0 + 1 1 1 @@ -132,7 +762,6 @@ 1 0 - 1 1 @@ -147,14 +776,15 @@ 0 0 wxID_ANY + Footprint documentation file 0 0 - 400,90 + 1 - m_ListLibr + m_staticTextModulesDoc 1 @@ -164,17 +794,14 @@ Resizable 1 - wxLB_EXTENDED|wxLB_HSCROLL|wxLB_NEEDED_SB|wxLB_SINGLE + 0 - List of active library files. Only library files in this list are loaded by Pcbnew. The order of this list is important: Pcbnew searchs for a given footprint using this list order priority. - - wxFILTER_NONE - wxDefaultValidator - + + -1 @@ -185,8 +812,6 @@ - - @@ -204,18 +829,18 @@ 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT - 0 + wxEXPAND + 1 - bRightSizer - wxVERTICAL + bSizerDoc + wxHORIZONTAL none 5 - wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT - 0 - + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxRIGHT|wxLEFT + 1 + 1 1 1 @@ -232,95 +857,6 @@ 1 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_ADD_LIB - Add - - 0 - - - 0 - - 1 - m_buttonAddLib - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Add a new library after the selected library, and load it - - wxFILTER_NONE - wxDefaultValidator - - - - - OnAddOrInsertLibClick - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 0 Dock 0 @@ -332,15 +868,15 @@ 0 0 wxID_ANY - Insert 0 + 0 0 1 - m_buttonIns + m_TextHelpModulesFileName 1 @@ -353,15 +889,15 @@ 0 - Add a new library before the selected library, and load it + wxFILTER_NONE wxDefaultValidator + - OnAddOrInsertLibClick @@ -384,12 +920,16 @@ + + + + - 5 - wxALL|wxALIGN_CENTER_HORIZONTAL + 10 + wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT 0 1 @@ -419,8 +959,8 @@ 0 0 - ID_REMOVE_LIB - Remove + wxID_BROWSE_MOD_DOC + Browse 0 @@ -428,95 +968,7 @@ 0 1 - m_buttonRemoveLib - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Unload the selected library - - wxFILTER_NONE - wxDefaultValidator - - - - - OnRemoveLibClick - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Up - - 0 - - - 0 - - 1 - m_buttonUp + m_buttonModDoc 1 @@ -537,95 +989,7 @@ - OnButtonUpClick - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Down - - 0 - - - 0 - - 1 - m_buttonDown - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnButtonDownClick + OnBrowseModDocFile @@ -657,21 +1021,18 @@ 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT + wxEXPAND 0 - - wxID_ANY - Footprint documentation file + - sbModulesDocSizer - wxHORIZONTAL + bSizerPaths + wxVERTICAL none - 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT - 1 - + wxTOP|wxRIGHT|wxLEFT + 0 + 1 1 1 @@ -699,15 +1060,15 @@ 0 0 wxID_ANY + User defined search paths 0 - 0 0 1 - m_TextHelpModulesFileName + m_staticTextPaths 1 @@ -721,106 +1082,10 @@ 0 - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10 - wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_BROWSE_MOD_DOC - Browse - - 0 - - - 0 - - 1 - m_buttonModDoc - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnBrowseModDocFile + -1 @@ -846,28 +1111,14 @@ - - - - 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 0 - - wxID_ANY - User defined search paths - 400,70 - sbSizer4 - wxHORIZONTAL - none - 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND - 1 + wxEXPAND + 0 - bUserListSizer - wxVERTICAL + bSizerPathsChoice + wxHORIZONTAL none 5 @@ -957,279 +1208,279 @@ - - - - 5 - wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND - 0 - - - bUserPathsButtonsSizer - wxVERTICAL - none 5 - wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_LIB_PATH_SEL - Add - - 0 - - - 0 + - 1 - m_buttonAddPath - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnAddOrInsertPath - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxLEFT|wxRIGHT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_INSERT_PATH - Insert - - 0 - - - 0 - - 1 - m_buttonInsPath - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnAddOrInsertPath - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxBOTTOM - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_REMOVE_PATH - Remove - - 0 - - - 0 - - 1 - m_buttonRemovePath - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnRemoveUserPath - - - - - - - - - - - - - - - - - - - - - - - + bUserPathsButtonsSizer + wxVERTICAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_LIB_PATH_SEL + Add + + 0 + + + 0 + + 1 + m_buttonAddPath + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnAddOrInsertPath + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxLEFT|wxRIGHT|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_INSERT_PATH + Insert + + 0 + + + 0 + + 1 + m_buttonInsPath + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnAddOrInsertPath + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxBOTTOM + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_REMOVE_PATH + Remove + + 0 + + + 0 + + 1 + m_buttonRemovePath + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnRemoveUserPath + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1238,30 +1489,99 @@ 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT + wxEXPAND 0 - - wxID_ANY - Current search path list + - sbLibPathSizer + bLibPathSizer wxVERTICAL none - 5 - wxEXPAND - 1 - + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Current search path list + + 0 + + + 0 - bUserLibPathSizer - wxHORIZONTAL - none + 1 + m_staticTextPathList + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + 5 - wxALL|wxEXPAND + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 0 1 diff --git a/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths_fbp.h b/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths_fbp.h index 9a52a9bffa..913f452512 100644 --- a/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths_fbp.h +++ b/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths_fbp.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 10 2012) +// C++ code generated with wxFormBuilder (version Oct 8 2012) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -11,16 +11,18 @@ #include #include #include +class DIALOG_SHIM; + #include "dialog_shim.h" -#include -#include #include -#include +#include +#include #include #include #include +#include #include -#include +#include #include #include #include @@ -45,18 +47,22 @@ class DIALOG_PCBNEW_CONFIG_LIBS_FBP : public DIALOG_SHIM wxID_REMOVE_PATH }; + wxStaticText* m_staticTextLibs; wxListBox* m_ListLibr; wxButton* m_buttonAddLib; wxButton* m_buttonIns; wxButton* m_buttonRemoveLib; wxButton* m_buttonUp; wxButton* m_buttonDown; + wxStaticText* m_staticTextModulesDoc; wxTextCtrl* m_TextHelpModulesFileName; wxButton* m_buttonModDoc; + wxStaticText* m_staticTextPaths; wxListBox* m_listUserPaths; wxButton* m_buttonAddPath; wxButton* m_buttonInsPath; wxButton* m_buttonRemovePath; + wxStaticText* m_staticTextPathList; wxListBox* m_DefaultLibraryPathslistBox; wxStaticLine* m_staticline1; wxStdDialogButtonSizer* m_sdbSizer1; @@ -78,7 +84,7 @@ class DIALOG_PCBNEW_CONFIG_LIBS_FBP : public DIALOG_SHIM public: - DIALOG_PCBNEW_CONFIG_LIBS_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_PCBNEW_CONFIG_LIBS_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 530,540 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_PCBNEW_CONFIG_LIBS_FBP(); }; diff --git a/template/kicad.pro b/template/kicad.pro index a186ec4ffb..6f3b21352f 100644 --- a/template/kicad.pro +++ b/template/kicad.pro @@ -1,4 +1,4 @@ -update=21/03/2013 14:06:30 +update=30/03/2013 13:45:59 version=1 last_client=pcbnew [general] @@ -53,20 +53,21 @@ LibName30=valves version=1 LastNetListRead= UseCmpFile=1 -PadDrill=0.6 -PadSizeH=1 -PadSizeV=1 -PcbTextSizeV=1 -PcbTextSizeH=1 -PcbTextThickness=0.3 -ModuleTextSizeV=1 -ModuleTextSizeH=1 -ModuleTextSizeThickness=0.15 -SolderMaskClearance=0 -SolderMaskMinWidth=0 -DrawSegmentWidth=0.2 -BoardOutlineThickness=0.15 -ModuleOutlineThickness=0.15 +PadDrill=0.600000000000 +PadDrillOvalY=0.600000000000 +PadSizeH=1.500000000000 +PadSizeV=1.500000000000 +PcbTextSizeV=1.500000000000 +PcbTextSizeH=1.500000000000 +PcbTextThickness=0.300000000000 +ModuleTextSizeV=1.000000000000 +ModuleTextSizeH=1.000000000000 +ModuleTextSizeThickness=0.150000000000 +SolderMaskClearance=0.000000000000 +SolderMaskMinWidth=0.000000000000 +DrawSegmentWidth=0.200000000000 +BoardOutlineThickness=0.100000000000 +ModuleOutlineThickness=0.150000000000 [pcbnew/libraries] LibDir= LibName1=sockets From e0303a45584f7f31423f6a655635bb8de2a1f9c2 Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Sat, 30 Mar 2013 18:24:04 +0100 Subject: [PATCH 23/63] - New typedef LAYER_MSK to encapsulate a layer bitmap - Renamed ReturnMaskLayer to GetLayerMask (since it's a plain getter) --- common/drawframe.cpp | 2 +- common/pcbcommon.cpp | 2 +- eeschema/libedit_plot_component.cpp | 2 +- eeschema/libeditframe.h | 2 +- eeschema/schframe.cpp | 3 +- gerbview/class_gbr_layout.cpp | 2 +- gerbview/class_gbr_layout.h | 5 +- gerbview/class_gbr_screen.h | 1 + gerbview/class_gerber_draw_item.h | 5 +- gerbview/class_gerbview_layer_widget.cpp | 12 ++-- .../dialogs/dialog_print_using_printer.cpp | 8 +-- gerbview/draw_gerber_screen.cpp | 4 +- gerbview/gerbview_frame.cpp | 4 +- gerbview/gerbview_frame.h | 7 ++- include/class_board_design_settings.h | 22 ++++---- include/class_board_item.h | 3 +- include/class_colors_design_settings.h | 1 + include/class_layer_box_selector.h | 1 + include/layers_id_colors_and_visibility.h | 11 ++++ include/pcbcommon.h | 10 +--- include/wxEeschemaStruct.h | 2 +- include/wxPcbStruct.h | 2 +- include/wxstruct.h | 4 +- pcbnew/class_board.cpp | 56 +++++++++---------- pcbnew/class_board.h | 20 +++---- pcbnew/class_board_design_settings.cpp | 14 ++--- pcbnew/class_module.cpp | 2 +- pcbnew/class_module.h | 2 +- pcbnew/class_module_transform_functions.cpp | 4 +- pcbnew/class_pad.cpp | 2 +- pcbnew/class_pad.h | 6 +- pcbnew/class_pad_draw_functions.cpp | 4 +- pcbnew/class_pcb_layer_widget.cpp | 14 ++--- pcbnew/class_track.cpp | 50 +++++++++-------- pcbnew/class_track.h | 12 ++-- pcbnew/collectors.h | 28 ++++++---- pcbnew/connect.cpp | 10 ++-- pcbnew/dialogs/dialog_SVG_print.cpp | 6 +- pcbnew/dialogs/dialog_SVG_print.h | 2 +- pcbnew/dialogs/dialog_global_deletion.cpp | 10 ++-- pcbnew/dialogs/dialog_layers_setup.cpp | 24 ++++---- pcbnew/dialogs/dialog_pad_properties.cpp | 14 ++--- pcbnew/dialogs/dialog_pcb_text_properties.cpp | 6 +- pcbnew/dialogs/dialog_print_using_printer.cpp | 4 +- pcbnew/drag.h | 2 +- pcbnew/dragsegm.cpp | 6 +- pcbnew/drc.cpp | 2 +- pcbnew/drc_clearance_test_functions.cpp | 6 +- pcbnew/eagle_plugin.h | 1 + pcbnew/editrack.cpp | 4 +- pcbnew/export_gencad.cpp | 20 +++---- pcbnew/export_vrml.cpp | 4 +- pcbnew/kicad_plugin.cpp | 6 +- pcbnew/kicad_plugin.h | 3 +- pcbnew/layer_widget.h | 1 + pcbnew/legacy_plugin.cpp | 7 +-- pcbnew/magnetic_tracks_functions.cpp | 4 +- pcbnew/module_editor_frame.h | 2 +- pcbnew/move_or_drag_track.cpp | 10 ++-- pcbnew/pcad2kicadpcb_plugin/pcb_callbacks.h | 1 + pcbnew/pcb_parser.cpp | 35 ++++++------ pcbnew/pcb_parser.h | 14 +++-- pcbnew/pcb_plot_params.h | 3 +- pcbnew/pcbnew.h | 1 + pcbnew/pcbplot.cpp | 6 +- pcbnew/pcbplot.h | 5 +- pcbnew/plot_board_layers.cpp | 18 +++--- pcbnew/plot_brditems_plotter.cpp | 6 +- pcbnew/print_board_functions.cpp | 30 +++++----- pcbnew/printout_controler.cpp | 2 +- pcbnew/printout_controler.h | 4 +- pcbnew/protos.h | 2 +- pcbnew/sel_layer.cpp | 8 +-- pcbnew/tr_modif.cpp | 10 ++-- pcbnew/tracepcb.cpp | 6 +- polygon/PolyLine.h | 2 +- 76 files changed, 329 insertions(+), 307 deletions(-) diff --git a/common/drawframe.cpp b/common/drawframe.cpp index e67d5996ff..5c08e7ffe6 100644 --- a/common/drawframe.cpp +++ b/common/drawframe.cpp @@ -320,7 +320,7 @@ void EDA_DRAW_FRAME::ToolOnRightClick( wxCommandEvent& event ) } -void EDA_DRAW_FRAME::PrintPage( wxDC* aDC,int aPrintMask, bool aPrintMirrorMode, void* aData ) +void EDA_DRAW_FRAME::PrintPage( wxDC* aDC,LAYER_MSK aPrintMask, bool aPrintMirrorMode, void* aData ) { wxMessageBox( wxT("EDA_DRAW_FRAME::PrintPage() error") ); } diff --git a/common/pcbcommon.cpp b/common/pcbcommon.cpp index 058af23ea9..58441b01c5 100644 --- a/common/pcbcommon.cpp +++ b/common/pcbcommon.cpp @@ -71,7 +71,7 @@ int GetLayerMask( int aLayerNumber ) /* Look up Table for conversion copper layer count -> general copper layer * mask: */ -int g_TabAllCopperLayerMask[NB_COPPER_LAYERS] = { +LAYER_MSK g_TabAllCopperLayerMask[NB_COPPER_LAYERS] = { 0x0001, 0x8001, 0x8003, 0x8007, 0x800F, 0x801F, 0x803F, 0x807F, 0x80FF, 0x81FF, 0x83FF, 0x87FF, diff --git a/eeschema/libedit_plot_component.cpp b/eeschema/libedit_plot_component.cpp index 3f0d4e1ad5..90362cc417 100644 --- a/eeschema/libedit_plot_component.cpp +++ b/eeschema/libedit_plot_component.cpp @@ -144,7 +144,7 @@ void LIB_EDIT_FRAME::SVG_Print_Component( const wxString& FullFileName ) plotBW, plotFrameRef ); } -void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode, void* aData) +void LIB_EDIT_FRAME::PrintPage( wxDC* aDC, LAYER_MSK aPrintMask, bool aPrintMirrorMode, void* aData) { if( ! m_component ) return; diff --git a/eeschema/libeditframe.h b/eeschema/libeditframe.h index b991a838ab..439b0d059d 100644 --- a/eeschema/libeditframe.h +++ b/eeschema/libeditframe.h @@ -637,7 +637,7 @@ public: * @param aPrintMirrorMode = not used here (Set when printing in mirror mode) * @param aData = a pointer on an auxiliary data (not always used, NULL if not used) */ - virtual void PrintPage( wxDC* aDC, int aPrintMask, + virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMask, bool aPrintMirrorMode, void* aData = NULL ); /** diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index f9102268e6..18b52d2f03 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -848,7 +848,8 @@ void SCH_EDIT_FRAME::OnPrint( wxCommandEvent& event ) } } -void SCH_EDIT_FRAME::PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode, void* aData ) +void SCH_EDIT_FRAME::PrintPage( wxDC* aDC, LAYER_MSK aPrintMask, bool aPrintMirrorMode, + void* aData ) { GetScreen()->Draw( m_canvas, aDC, GR_DEFAULT_DRAWMODE ); TraceWorkSheet( aDC, GetScreen(), GetDefaultLineThickness(), IU_PER_MILS, diff --git a/gerbview/class_gbr_layout.cpp b/gerbview/class_gbr_layout.cpp index ca18a84e7b..a503a03a98 100644 --- a/gerbview/class_gbr_layout.cpp +++ b/gerbview/class_gbr_layout.cpp @@ -29,7 +29,7 @@ GBR_LAYOUT::~GBR_LAYOUT() */ bool GBR_LAYOUT::IsLayerVisible( int aLayerIndex ) const { - return m_printLayersMask & (1 << aLayerIndex ); + return m_printLayersMask & GetLayerMask( aLayerIndex ); } diff --git a/gerbview/class_gbr_layout.h b/gerbview/class_gbr_layout.h index 3dd34641ea..8967357e38 100644 --- a/gerbview/class_gbr_layout.h +++ b/gerbview/class_gbr_layout.h @@ -15,6 +15,7 @@ #include #include +#include /** * Class GBR_LAYOUT @@ -27,7 +28,7 @@ private: PAGE_INFO m_paper; TITLE_BLOCK m_titles; wxPoint m_originAxisPosition; - int m_printLayersMask; // When printing: the list of layers to print + LAYER_MSK m_printLayersMask; // When printing: the list of layers to print public: DLIST m_Drawings; // linked list of Gerber Items @@ -90,7 +91,7 @@ public: * changes the bit-mask of visible layers * @param aLayerMask = The new bit-mask of visible layers */ - void SetVisibleLayers( int aLayerMask ) + void SetVisibleLayers( LAYER_MSK aLayerMask ) { m_printLayersMask = aLayerMask; } diff --git a/gerbview/class_gbr_screen.h b/gerbview/class_gbr_screen.h index adc14b4567..77640a1a2a 100644 --- a/gerbview/class_gbr_screen.h +++ b/gerbview/class_gbr_screen.h @@ -8,6 +8,7 @@ #include #include +#include #define ZOOM_FACTOR( x ) ( x * IU_PER_DECIMILS ) diff --git a/gerbview/class_gerber_draw_item.h b/gerbview/class_gerber_draw_item.h index 08723f54b4..3d6cfda162 100644 --- a/gerbview/class_gerber_draw_item.h +++ b/gerbview/class_gerber_draw_item.h @@ -31,6 +31,7 @@ #include #include +#include #include class GERBER_IMAGE; @@ -133,9 +134,9 @@ public: */ void SetLayer( int aLayer ) { m_Layer = aLayer; } - int ReturnMaskLayer() + LAYER_MSK GetLayerMask() { - return 1 << m_Layer; + return ::GetLayerMask( m_Layer ); } bool GetLayerPolarity() diff --git a/gerbview/class_gerbview_layer_widget.cpp b/gerbview/class_gerbview_layer_widget.cpp index 64228206f4..eea92f7d16 100644 --- a/gerbview/class_gerbview_layer_widget.cpp +++ b/gerbview/class_gerbview_layer_widget.cpp @@ -163,7 +163,7 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) int rowCount; int menuId = event.GetId(); bool visible = (menuId == ID_SHOW_ALL_COPPERS) ? true : false;; - int visibleLayers = 0; + LAYER_MSK visibleLayers = NO_LAYERS; switch( menuId ) { @@ -181,9 +181,9 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 ); cb->SetValue( loc_visible ); if( loc_visible ) - visibleLayers |= (1 << row); + visibleLayers |= GetLayerMask( row ); else - visibleLayers &= ~(1 << row); + visibleLayers &= ~GetLayerMask( row ); } myframe->SetVisibleLayers( visibleLayers ); @@ -235,12 +235,12 @@ bool GERBER_LAYER_WIDGET::OnLayerSelect( int aLayer ) void GERBER_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal ) { - int visibleLayers = myframe->GetVisibleLayers(); + LAYER_MSK visibleLayers = myframe->GetVisibleLayers(); if( isVisible ) - visibleLayers |= (1 << aLayer); + visibleLayers |= GetLayerMask( aLayer ); else - visibleLayers &= ~(1 << aLayer); + visibleLayers &= ~GetLayerMask( aLayer ); myframe->SetVisibleLayers( visibleLayers ); diff --git a/gerbview/dialogs/dialog_print_using_printer.cpp b/gerbview/dialogs/dialog_print_using_printer.cpp index c5619e3d2b..27749d4df4 100644 --- a/gerbview/dialogs/dialog_print_using_printer.cpp +++ b/gerbview/dialogs/dialog_print_using_printer.cpp @@ -188,7 +188,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) { m_BoxSelectLayer[layer]->SetValue( option ); if( option ) - s_SelectedLayers |= 1 << layer; + s_SelectedLayers |= GetLayerMask( layer ); } } } @@ -223,15 +223,15 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) int DIALOG_PRINT_USING_PRINTER::SetLayerMaskFromListSelection() /**************************************************************/ { - int page_count; - s_Parameters.m_PrintMaskLayer = 0; + int page_count = 0; + s_Parameters.m_PrintMaskLayer = NO_LAYERS; int ii; for( ii = 0, page_count = 0; ii < GERBVIEW_LAYER_COUNT; ii++ ) { if( m_BoxSelectLayer[ii]->IsChecked() ) { page_count++; - s_Parameters.m_PrintMaskLayer |= 1 << ii; + s_Parameters.m_PrintMaskLayer |= GetLayerMask( ii ); } } diff --git a/gerbview/draw_gerber_screen.cpp b/gerbview/draw_gerber_screen.cpp index 12eba4be26..42aa4d79dd 100644 --- a/gerbview/draw_gerber_screen.cpp +++ b/gerbview/draw_gerber_screen.cpp @@ -41,11 +41,11 @@ #include -void GERBVIEW_FRAME::PrintPage( wxDC* aDC, int aPrintMasklayer, +void GERBVIEW_FRAME::PrintPage( wxDC* aDC, LAYER_MSK aPrintMasklayer, bool aPrintMirrorMode, void* aData ) { // Save current draw options, because print mode has specific options: - int visiblemask = GetVisibleLayers(); + LAYER_MSK visiblemask = GetVisibleLayers(); GBR_DISPLAY_OPTIONS imgDisplayOptions = m_DisplayOptions; // Set draw options for printing: diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 10c75758c2..b1b9945afb 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -537,7 +537,7 @@ void GERBVIEW_FRAME::SetVisibleAlls() * Returns a bit-mask of all the layers that are visible * @return int - the visible layers in bit-mapped form. */ -int GERBVIEW_FRAME::GetVisibleLayers() const +LAYER_MSK GERBVIEW_FRAME::GetVisibleLayers() const { return -1; // TODO } @@ -549,7 +549,7 @@ int GERBVIEW_FRAME::GetVisibleLayers() const * changes the bit-mask of visible layers * @param aLayerMask = The new bit-mask of visible layers */ -void GERBVIEW_FRAME::SetVisibleLayers( int aLayerMask ) +void GERBVIEW_FRAME::SetVisibleLayers( LAYER_MSK aLayerMask ) { GetLayout()->SetVisibleLayers( aLayerMask ); } diff --git a/gerbview/gerbview_frame.h b/gerbview/gerbview_frame.h index 6a325020cb..bc69fd4915 100644 --- a/gerbview/gerbview_frame.h +++ b/gerbview/gerbview_frame.h @@ -37,6 +37,7 @@ #include #include #include +#include #define NO_AVAILABLE_LAYERS -1 @@ -299,7 +300,7 @@ public: * Returns a bit-mask of all the layers that are visible * @return int - the visible layers in bit-mapped form. */ - int GetVisibleLayers() const; + LAYER_MSK GetVisibleLayers() const; /** * Function SetVisibleLayers @@ -307,7 +308,7 @@ public: * changes the bit-mask of visible layers * @param aLayerMask = The new bit-mask of visible layers */ - void SetVisibleLayers( int aLayerMask ); + void SetVisibleLayers( LAYER_MSK aLayerMask ); /** * Function IsLayerVisible @@ -716,7 +717,7 @@ public: * @param aPrintMirrorMode = not used here (Set when printing in mirror mode) * @param aData = a pointer on an auxiliary data (not always used, NULL if not used) */ - virtual void PrintPage( wxDC* aDC, int aPrintMasklayer, bool aPrintMirrorMode, + virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMasklayer, bool aPrintMirrorMode, void* aData = NULL ); /** diff --git a/include/class_board_design_settings.h b/include/class_board_design_settings.h index 98854008f9..bcf6e6b651 100644 --- a/include/class_board_design_settings.h +++ b/include/class_board_design_settings.h @@ -56,7 +56,7 @@ public: * returns a bit-mask of all the layers that are visible * @return int - the visible layers in bit-mapped form. */ - int GetVisibleLayers() const; + LAYER_MSK GetVisibleLayers() const; /** * Function SetVisibleAlls @@ -70,7 +70,7 @@ public: * changes the bit-mask of visible layers * @param aMask = The new bit-mask of visible layers */ - void SetVisibleLayers( int aMask ); + void SetVisibleLayers( LAYER_MSK aMask ); /** * Function IsLayerVisible @@ -85,7 +85,7 @@ public: return false; // If a layer is disabled, it is automatically invisible - return (bool) ( m_VisibleLayers & m_EnabledLayers & (1 << aLayerIndex) ); + return bool( m_VisibleLayers & m_EnabledLayers & GetLayerMask( aLayerIndex ) ); } /** @@ -143,7 +143,7 @@ public: * returns a bit-mask of all the layers that are enabled * @return int - the enabled layers in bit-mapped form. */ - inline int GetEnabledLayers() const + inline LAYER_MSK GetEnabledLayers() const { return m_EnabledLayers; } @@ -153,7 +153,7 @@ public: * changes the bit-mask of enabled layers * @param aMask = The new bit-mask of enabled layers */ - void SetEnabledLayers( int aMask ); + void SetEnabledLayers( LAYER_MSK aMask ); /** * Function IsLayerEnabled @@ -163,7 +163,7 @@ public: */ bool IsLayerEnabled( int aLayerIndex ) const { - return bool( m_EnabledLayers & (1 << aLayerIndex) ); + return bool( m_EnabledLayers & GetLayerMask( aLayerIndex ) ); } /** @@ -194,11 +194,11 @@ public: void SetBoardThickness( int aThickness ) { m_boardThickness = aThickness; } private: - int m_CopperLayerCount; ///< Number of copper layers for this design - int m_EnabledLayers; ///< Bit-mask for layer enabling - int m_VisibleLayers; ///< Bit-mask for layer visibility - int m_VisibleElements; ///< Bit-mask for element category visibility - int m_boardThickness; ///< Board thickness for 3D viewer + int m_CopperLayerCount; ///< Number of copper layers for this design + LAYER_MSK m_EnabledLayers; ///< Bit-mask for layer enabling + LAYER_MSK m_VisibleLayers; ///< Bit-mask for layer visibility + int m_VisibleElements; ///< Bit-mask for element category visibility + int m_boardThickness; ///< Board thickness for 3D viewer }; #endif // BOARD_DESIGN_SETTINGS_H_ diff --git a/include/class_board_item.h b/include/class_board_item.h index 2c64957d48..99b36d54f7 100644 --- a/include/class_board_item.h +++ b/include/class_board_item.h @@ -34,7 +34,8 @@ #include #include #include - +#include +#include /// Abbrevation for fomatting internal units to a string. #define FMT_IU BOARD_ITEM::FormatInternalUnits diff --git a/include/class_colors_design_settings.h b/include/class_colors_design_settings.h index fe606cb389..b2149a1149 100644 --- a/include/class_colors_design_settings.h +++ b/include/class_colors_design_settings.h @@ -5,6 +5,7 @@ #ifndef _COLORS_DESIGN_SETTING_H #define _COLORS_DESIGN_SETTING_H +#include #define LAYERSCOLORSBUFFERSIZE 32 #define ITEMSCOLORSBUFFERSIZE 32 diff --git a/include/class_layer_box_selector.h b/include/class_layer_box_selector.h index 4ee711981c..23ba970766 100644 --- a/include/class_layer_box_selector.h +++ b/include/class_layer_box_selector.h @@ -3,6 +3,7 @@ #include #include +#include class wxAuiToolBar; diff --git a/include/layers_id_colors_and_visibility.h b/include/layers_id_colors_and_visibility.h index 6b7fd7ef38..70038f0299 100644 --- a/include/layers_id_colors_and_visibility.h +++ b/include/layers_id_colors_and_visibility.h @@ -51,6 +51,7 @@ #define LAYER_COUNT 32 // Masks to identify a layer by a bit map +typedef unsigned LAYER_MSK; #define LAYER_BACK (1 << LAYER_N_BACK) ///< bit mask for copper layer #define LAYER_2 (1 << LAYER_N_2) ///< bit mask for layer 2 #define LAYER_3 (1 << LAYER_N_3) ///< bit mask for layer 3 @@ -92,6 +93,16 @@ #define ALL_CU_LAYERS 0x0000FFFF #define INTERNAL_LAYERS 0x00007FFE #define EXTERNAL_LAYERS 0x00008001 +#define NO_LAYERS 0x00000000 + +/** return a one bit layer mask from a layer number + * aLayerNumber = the layer number to convert (0 .. LAYERS-1) + */ +inline LAYER_MSK GetLayerMask( unsigned aLayerNumber ) +{ + return 1 << aLayerNumber; +} + // layers order in dialogs (plot, print and toolbars) diff --git a/include/pcbcommon.h b/include/pcbcommon.h index 4e7d1f7882..6ce9572123 100644 --- a/include/pcbcommon.h +++ b/include/pcbcommon.h @@ -18,16 +18,8 @@ class TRACK; class BOARD; class DISPLAY_OPTIONS; - -/** - * Function GetLayerMask - * @return a one bit layer mask from a layer number - * @param aLayerNumber = the layer number to convert (0 .. LAYER_COUNT-1) - */ -int GetLayerMask( int aLayerNumber ); - /// Look up Table for conversion copper layer count -> general copper layer mask: -extern int g_TabAllCopperLayerMask[NB_COPPER_LAYERS]; +extern LAYER_MSK g_TabAllCopperLayerMask[NB_COPPER_LAYERS]; extern DISPLAY_OPTIONS DisplayOpt; diff --git a/include/wxEeschemaStruct.h b/include/wxEeschemaStruct.h index aadf337054..921dd26ec0 100644 --- a/include/wxEeschemaStruct.h +++ b/include/wxEeschemaStruct.h @@ -1219,7 +1219,7 @@ public: * @param aPrintMirrorMode = not used here (Set when printing in mirror mode) * @param aData = a pointer on an auxiliary data (not always used, NULL if not used) */ - virtual void PrintPage( wxDC* aDC, int aPrintMask, + virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMask, bool aPrintMirrorMode, void* aData = NULL ); void SetSimulatorCommand( const wxString& aCommand ) { m_simulatorCommand = aCommand; } diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 7fdae7f55e..fdd36da6a0 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -270,7 +270,7 @@ public: * @param aPrintMirrorMode = true to plot mirrored * @param aData = a pointer on an auxiliary data (NULL if not used) */ - virtual void PrintPage( wxDC* aDC, int aPrintMaskLayer, bool aPrintMirrorMode, + virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMaskLayer, bool aPrintMirrorMode, void * aData = NULL ); void GetKicadAbout( wxCommandEvent& event ); diff --git a/include/wxstruct.h b/include/wxstruct.h index a359981191..ad5230d8db 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -43,7 +43,9 @@ #include #include +#include #include +#include #ifdef USE_WX_OVERLAY #include @@ -880,7 +882,7 @@ public: * @param aPrintMirrorMode = not used here (Set when printing in mirror mode) * @param aData = a pointer on an auxiliary data (not always used, NULL if not used) */ - virtual void PrintPage( wxDC* aDC, int aPrintMask, bool aPrintMirrorMode, void* aData = NULL ); + virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMask, bool aPrintMirrorMode, void* aData = NULL ); /** * Function CoordinateToString diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 0e8fe450b5..7ccfdb71d8 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -127,7 +127,7 @@ void BOARD::Move( const wxPoint& aMoveVector ) // overload } -void BOARD::chainMarkedSegments( wxPoint aPosition, int aLayerMask, TRACK_PTRS* aList ) +void BOARD::chainMarkedSegments( wxPoint aPosition, LAYER_MSK aLayerMask, TRACK_PTRS* aList ) { TRACK* segment; // The current segment being analyzed. TRACK* via; // The via identified, eventually destroy @@ -166,7 +166,7 @@ void BOARD::chainMarkedSegments( wxPoint aPosition, int aLayerMask, TRACK_PTRS* if( via ) { - aLayerMask = via->ReturnMaskLayer(); + aLayerMask = via->GetLayerMask(); aList->push_back( via ); } @@ -212,7 +212,7 @@ void BOARD::chainMarkedSegments( wxPoint aPosition, int aLayerMask, TRACK_PTRS* * candidate: * we must analyze connections to its other end */ - aLayerMask = candidate->ReturnMaskLayer(); + aLayerMask = candidate->GetLayerMask(); if( aPosition == candidate->GetStart() ) { @@ -227,7 +227,7 @@ void BOARD::chainMarkedSegments( wxPoint aPosition, int aLayerMask, TRACK_PTRS* /* flag this item an push it in list of selected items */ aList->push_back( candidate ); - candidate->SetState( BUSY, ON ); + candidate->SetState( BUSY, true ); } else { @@ -542,25 +542,25 @@ void BOARD::SetCopperLayerCount( int aCount ) } -int BOARD::GetEnabledLayers() const +LAYER_MSK BOARD::GetEnabledLayers() const { return m_designSettings.GetEnabledLayers(); } -int BOARD::GetVisibleLayers() const +LAYER_MSK BOARD::GetVisibleLayers() const { return m_designSettings.GetVisibleLayers(); } -void BOARD::SetEnabledLayers( int aLayerMask ) +void BOARD::SetEnabledLayers( LAYER_MSK aLayerMask ) { m_designSettings.SetEnabledLayers( aLayerMask ); } -void BOARD::SetVisibleLayers( int aLayerMask ) +void BOARD::SetVisibleLayers( LAYER_MSK aLayerMask ) { m_designSettings.SetVisibleLayers( aLayerMask ); } @@ -1557,7 +1557,7 @@ TRACK* BOARD::GetViaByPosition( const wxPoint& aPosition, int aLayerMask ) } -D_PAD* BOARD::GetPad( const wxPoint& aPosition, int aLayerMask ) +D_PAD* BOARD::GetPad( const wxPoint& aPosition, LAYER_MSK aLayerMask ) { D_PAD* pad = NULL; @@ -1578,7 +1578,7 @@ D_PAD* BOARD::GetPad( TRACK* aTrace, int aEndPoint ) D_PAD* pad = NULL; wxPoint aPosition; - int aLayerMask = GetLayerMask( aTrace->GetLayer() ); + LAYER_MSK aLayerMask = GetLayerMask( aTrace->GetLayer() ); if( aEndPoint == FLG_START ) { @@ -1601,7 +1601,7 @@ D_PAD* BOARD::GetPad( TRACK* aTrace, int aEndPoint ) } -D_PAD* BOARD::GetPadFast( const wxPoint& aPosition, int aLayerMask ) +D_PAD* BOARD::GetPadFast( const wxPoint& aPosition, LAYER_MSK aLayerMask ) { for( unsigned i=0; i& aPadList, const wxPoint& aPosition, int aLayerMask ) +D_PAD* BOARD::GetPad( std::vector& aPadList, const wxPoint& aPosition, LAYER_MSK aLayerMask ) { // Search the aPoint coordinates in aPadList // aPadList is sorted by X then Y values, and a fast binary search is used @@ -1643,7 +1643,7 @@ D_PAD* BOARD::GetPad( std::vector& aPadList, const wxPoint& aPosition, i if( pad->GetPosition() == aPosition ) // candidate found { // The pad must match the layer mask: - if( (aLayerMask & pad->GetLayerMask()) != 0 ) + if( aLayerMask & pad->GetLayerMask()) return pad; // More than one pad can be at aPosition @@ -1747,7 +1747,7 @@ void BOARD::GetSortedPadListByXthenYCoord( std::vector& aVector, int aNe } -TRACK* BOARD::GetTrace( TRACK* aTrace, const wxPoint& aPosition, int aLayerMask ) +TRACK* BOARD::GetTrace( TRACK* aTrace, const wxPoint& aPosition, LAYER_MSK aLayerMask ) { for( TRACK* track = aTrace; track; track = track->Next() ) { @@ -1798,11 +1798,11 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount, // Ensure the flag BUSY of all tracks of the board is cleared // because we use it to mark segments of the track for( TRACK* track = m_Track; track; track = track->Next() ) - track->SetState( BUSY, OFF ); + track->SetState( BUSY, false ); /* Set flags of the initial track segment */ - aTrace->SetState( BUSY, ON ); - int layerMask = aTrace->ReturnMaskLayer(); + aTrace->SetState( BUSY, true ); + LAYER_MSK layerMask = aTrace->GetLayerMask(); trackList.push_back( aTrace ); @@ -1838,13 +1838,13 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount, if( Segm1 ) // search for others segments connected to the initial segment start point { - layerMask = Segm1->ReturnMaskLayer(); + layerMask = Segm1->GetLayerMask(); chainMarkedSegments( aTrace->GetStart(), layerMask, &trackList ); } if( Segm2 ) // search for others segments connected to the initial segment end point { - layerMask = Segm2->ReturnMaskLayer(); + layerMask = Segm2->GetLayerMask(); chainMarkedSegments( aTrace->GetStart(), layerMask, &trackList ); } } @@ -1869,9 +1869,9 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount, if( via == aTrace ) continue; - via->SetState( BUSY, ON ); // Try to flag it. the flag will be cleared later if needed + via->SetState( BUSY, true ); // Try to flag it. the flag will be cleared later if needed - layerMask = via->ReturnMaskLayer(); + layerMask = via->GetLayerMask(); TRACK* track = ::GetTrace( m_Track, NULL, via->GetStart(), layerMask ); @@ -1901,7 +1901,7 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount, { // The via connects segments of an other track: it is removed // from list because it is member of an other track - via->SetState( BUSY, OFF ); + via->SetState( BUSY, false ); break; } } @@ -1984,7 +1984,7 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount, if( track->GetState( BUSY ) ) { NbSegmBusy++; - track->SetState( BUSY, OFF ); + track->SetState( BUSY, false ); full_len += track->GetLength(); // Add now length die. @@ -2096,7 +2096,7 @@ MODULE* BOARD::GetFootprint( const wxPoint& aPosition, int aActiveLayer, } -BOARD_CONNECTED_ITEM* BOARD::GetLockPoint( const wxPoint& aPosition, int aLayerMask ) +BOARD_CONNECTED_ITEM* BOARD::GetLockPoint( const wxPoint& aPosition, LAYER_MSK aLayerMask ) { for( MODULE* module = m_Modules; module; module = module->Next() ) { @@ -2155,7 +2155,7 @@ TRACK* BOARD::CreateLockPoint( wxPoint& aPosition, TRACK* aSegment, PICKED_ITEMS // The new segment begins at the new point, newTrack->SetStart(lockPoint); newTrack->start = aSegment; - newTrack->SetState( BEGIN_ONPAD, OFF ); + newTrack->SetState( BEGIN_ONPAD, false ); DLIST* list = (DLIST*)aSegment->GetList(); wxASSERT( list ); @@ -2177,16 +2177,16 @@ TRACK* BOARD::CreateLockPoint( wxPoint& aPosition, TRACK* aSegment, PICKED_ITEMS // Old track segment now ends at new point. aSegment->SetEnd(lockPoint); aSegment->end = newTrack; - aSegment->SetState( END_ONPAD, OFF ); + aSegment->SetState( END_ONPAD, false ); D_PAD * pad = GetPad( newTrack, FLG_START ); if ( pad ) { newTrack->start = pad; - newTrack->SetState( BEGIN_ONPAD, ON ); + newTrack->SetState( BEGIN_ONPAD, true ); aSegment->end = pad; - aSegment->SetState( END_ONPAD, ON ); + aSegment->SetState( END_ONPAD, true ); } aPosition = lockPoint; diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index 218fee5ef5..c397e3d05b 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -234,7 +234,7 @@ private: * @param aLayerMask The allowed layers for segments to search. * @param aList The track list to fill with points of flagged segments. */ - void chainMarkedSegments( wxPoint aPosition, int aLayerMask, TRACK_PTRS* aList ); + void chainMarkedSegments( wxPoint aPosition, LAYER_MSK aLayerMask, TRACK_PTRS* aList ); void formatNetClass( NETCLASS* aNetClass, OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const @@ -425,7 +425,7 @@ public: * Returns a bit-mask of all the layers that are enabled * @return int - the enabled layers in bit-mapped form. */ - int GetEnabledLayers() const; + LAYER_MSK GetEnabledLayers() const; /** * Function SetEnabledLayers @@ -433,7 +433,7 @@ public: * Changes the bit-mask of enabled layers * @param aLayerMask = The new bit-mask of enabled layers */ - void SetEnabledLayers( int aLayerMask ); + void SetEnabledLayers( LAYER_MSK aLayerMask ); /** * Function IsLayerEnabled @@ -465,7 +465,7 @@ public: * Returns a bit-mask of all the layers that are visible * @return int - the visible layers in bit-mapped form. */ - int GetVisibleLayers() const; + LAYER_MSK GetVisibleLayers() const; /** * Function SetVisibleLayers @@ -473,7 +473,7 @@ public: * changes the bit-mask of visible layers * @param aLayerMask = The new bit-mask of visible layers */ - void SetVisibleLayers( int aLayerMask ); + void SetVisibleLayers( LAYER_MSK aLayerMask ); // these 2 functions are not tidy at this time, since there are PCB_VISIBLEs that // are not stored in the bitmap. @@ -1223,7 +1223,7 @@ public: * @param aLayerMask A layer or layers to mask the hit test. * @return A pointer to a D_PAD object if found or NULL if not found. */ - D_PAD* GetPad( const wxPoint& aPosition, int aLayerMask = ALL_LAYERS ); + D_PAD* GetPad( const wxPoint& aPosition, LAYER_MSK aLayerMask = ALL_LAYERS ); /** * Function GetPad @@ -1245,7 +1245,7 @@ public: * @param aLayer A layer or layers to mask the hit test. * @return A pointer to a D_PAD object if found or NULL if not found. */ - D_PAD* GetPadFast( const wxPoint& aPosition, int aLayer ); + D_PAD* GetPadFast( const wxPoint& aPosition, LAYER_MSK aLayerMask ); /** * Function GetPad @@ -1262,7 +1262,7 @@ public: * @param aLayerMask A layer or layers to mask the hit test. * @return a D_PAD object pointer to the connected pad. */ - D_PAD* GetPad( std::vector& aPadList, const wxPoint& aPosition, int aLayerMask ); + D_PAD* GetPad( std::vector& aPadList, const wxPoint& aPosition, LAYER_MSK aLayerMask ); /** * Function GetSortedPadListByXthenYCoord @@ -1289,7 +1289,7 @@ public: * layer mask. * @return A TRACK object pointer if found otherwise NULL. */ - TRACK* GetTrace( TRACK* aTrace, const wxPoint& aPosition, int aLayerMask ); + TRACK* GetTrace( TRACK* aTrace, const wxPoint& aPosition, LAYER_MSK aLayerMask ); /** * Function MarkTrace @@ -1348,7 +1348,7 @@ public: * layer mask. * @return A pointer to a BOARD_ITEM object if found otherwise NULL. */ - BOARD_CONNECTED_ITEM* GetLockPoint( const wxPoint& aPosition, int aLayerMask ); + BOARD_CONNECTED_ITEM* GetLockPoint( const wxPoint& aPosition, LAYER_MSK aLayerMask ); /** * Function CreateLockPoint diff --git a/pcbnew/class_board_design_settings.cpp b/pcbnew/class_board_design_settings.cpp index d5e8b5c226..a7764d807f 100644 --- a/pcbnew/class_board_design_settings.cpp +++ b/pcbnew/class_board_design_settings.cpp @@ -171,7 +171,7 @@ void BOARD_DESIGN_SETTINGS::AppendConfigs( PARAM_CFG_ARRAY* aResult ) // see pcbstruct.h -int BOARD_DESIGN_SETTINGS::GetVisibleLayers() const +LAYER_MSK BOARD_DESIGN_SETTINGS::GetVisibleLayers() const { return m_VisibleLayers; } @@ -184,7 +184,7 @@ void BOARD_DESIGN_SETTINGS::SetVisibleAlls() } -void BOARD_DESIGN_SETTINGS::SetVisibleLayers( int aMask ) +void BOARD_DESIGN_SETTINGS::SetVisibleLayers( LAYER_MSK aMask ) { // Although Pcbnew uses only 29, GerbView uses all 32 layers m_VisibleLayers = aMask & m_EnabledLayers & FULL_LAYERS; @@ -198,9 +198,9 @@ void BOARD_DESIGN_SETTINGS::SetLayerVisibility( int aLayerIndex, bool aNewState return; if( aNewState && IsLayerEnabled( aLayerIndex ) ) - m_VisibleLayers |= 1 << aLayerIndex; + m_VisibleLayers |= GetLayerMask( aLayerIndex ); else - m_VisibleLayers &= ~( 1 << aLayerIndex ); + m_VisibleLayers &= ~GetLayerMask( aLayerIndex ); } @@ -229,12 +229,12 @@ void BOARD_DESIGN_SETTINGS::SetCopperLayerCount( int aNewLayerCount ) if( m_CopperLayerCount > 1 ) m_EnabledLayers |= LAYER_FRONT; - for( int ii = 1; ii < aNewLayerCount - 1; ii++ ) - m_EnabledLayers |= 1 << ii; + for( int ii = LAYER_N_2; ii < aNewLayerCount - 1; ++ii ) + m_EnabledLayers |= GetLayerMask( ii ); } -void BOARD_DESIGN_SETTINGS::SetEnabledLayers( int aMask ) +void BOARD_DESIGN_SETTINGS::SetEnabledLayers( LAYER_MSK aMask ) { // Back and front layers are always enabled. aMask |= LAYER_BACK | LAYER_FRONT; diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index 5d1a9b183f..c6eaac88f0 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -573,7 +573,7 @@ D_PAD* MODULE::FindPadByName( const wxString& aPadName ) const } -D_PAD* MODULE::GetPad( const wxPoint& aPosition, int aLayerMask ) +D_PAD* MODULE::GetPad( const wxPoint& aPosition, LAYER_MSK aLayerMask ) { for( D_PAD* pad = m_Pads; pad; pad = pad->Next() ) { diff --git a/pcbnew/class_module.h b/pcbnew/class_module.h index 74041b7050..507d38e0b1 100644 --- a/pcbnew/class_module.h +++ b/pcbnew/class_module.h @@ -312,7 +312,7 @@ public: * @param aLayerMask A layer or layers to mask the hit test. * @return A pointer to a D_PAD object if found otherwise NULL. */ - D_PAD* GetPad( const wxPoint& aPosition, int aLayerMask = ALL_LAYERS ); + D_PAD* GetPad( const wxPoint& aPosition, LAYER_MSK aLayerMask = ALL_LAYERS ); /** * GetPadCount diff --git a/pcbnew/class_module_transform_functions.cpp b/pcbnew/class_module_transform_functions.cpp index afad7503a0..be9bb14dc8 100644 --- a/pcbnew/class_module_transform_functions.cpp +++ b/pcbnew/class_module_transform_functions.cpp @@ -79,9 +79,9 @@ int BOARD::ReturnFlippedLayerNumber( int oldlayer ) /* Calculate the mask layer when flipping a footprint * BACK and FRONT copper layers , mask, paste, solder layers are swapped */ -int ChangeSideMaskLayer( int aMask ) +LAYER_MSK ChangeSideMaskLayer( LAYER_MSK aMask ) { - int newMask; + LAYER_MSK newMask; newMask = aMask & ~(LAYER_BACK | LAYER_FRONT | SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT | diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index 7d3101e523..d80ff222ae 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -690,7 +690,7 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList ) // see class_pad.h bool D_PAD::IsOnLayer( int aLayer ) const { - return (1 << aLayer) & m_layerMask; + return ::GetLayerMask( aLayer ) & m_layerMask; } diff --git a/pcbnew/class_pad.h b/pcbnew/class_pad.h index 2a58543ec6..a7003f9cfb 100644 --- a/pcbnew/class_pad.h +++ b/pcbnew/class_pad.h @@ -186,8 +186,8 @@ public: void SetDrillShape( PAD_SHAPE_T aDrillShape ) { m_DrillShape = aDrillShape; } PAD_SHAPE_T GetDrillShape() const { return m_DrillShape; } - void SetLayerMask( int aLayerMask ) { m_layerMask = aLayerMask; } - int GetLayerMask() const { return m_layerMask; } + void SetLayerMask( LAYER_MSK aLayerMask ) { m_layerMask = aLayerMask; } + LAYER_MSK GetLayerMask() const { return m_layerMask; } void SetAttribute( PAD_ATTR_T aAttribute ); PAD_ATTR_T GetAttribute() const { return m_Attribute; } @@ -454,7 +454,7 @@ private: */ wxPoint m_Offset; - int m_layerMask; ///< Bitwise layer :1= copper layer, 15= cmp, + LAYER_MSK m_layerMask; ///< Bitwise layer :1= copper layer, 15= cmp, ///< 2..14 = internal layers ///< 16 .. 31 = technical layers diff --git a/pcbnew/class_pad_draw_functions.cpp b/pcbnew/class_pad_draw_functions.cpp index e9cc99131e..09d1862a71 100644 --- a/pcbnew/class_pad_draw_functions.cpp +++ b/pcbnew/class_pad_draw_functions.cpp @@ -246,8 +246,8 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode, // if routing between copper and component layers, // or the current layer is one of said 2 external copper layers, // then highlight only the current layer. - if( ( ( 1 << routeTop ) | ( 1 << routeBot ) ) == ( LAYER_BACK | LAYER_FRONT ) - || ( ( 1 << screen->m_Active_Layer ) & ( LAYER_BACK | LAYER_FRONT ) ) ) + if( ( ::GetLayerMask( routeTop ) | ::GetLayerMask( routeBot ) ) == ( LAYER_BACK | LAYER_FRONT ) + || ( ::GetLayerMask( screen->m_Active_Layer ) & ( LAYER_BACK | LAYER_FRONT ) ) ) { if( !IsOnLayer( screen->m_Active_Layer ) ) ColorTurnToDarkDarkGray( &color ); diff --git a/pcbnew/class_pcb_layer_widget.cpp b/pcbnew/class_pcb_layer_widget.cpp index 819a589f20..6de78f808d 100644 --- a/pcbnew/class_pcb_layer_widget.cpp +++ b/pcbnew/class_pcb_layer_widget.cpp @@ -263,7 +263,7 @@ void PCB_LAYER_WIDGET::ReFill() // show all coppers first, with front on top, back on bottom, then technical layers layer = LAYER_N_FRONT; - if( enabledLayers & (1 << layer) ) + if( enabledLayers & GetLayerMask( layer ) ) { AppendLayerRow( LAYER_WIDGET::ROW( brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), _("Front copper layer"), true ) ); @@ -271,7 +271,7 @@ void PCB_LAYER_WIDGET::ReFill() for( layer = LAYER_N_FRONT-1; layer >= 1; --layer ) { - if( enabledLayers & (1 << layer) ) + if( enabledLayers & GetLayerMask( layer ) ) { AppendLayerRow( LAYER_WIDGET::ROW( brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), _("An innner copper layer"), true ) ); @@ -279,7 +279,7 @@ void PCB_LAYER_WIDGET::ReFill() } layer = LAYER_N_BACK; - if( enabledLayers & (1 << layer) ) + if( enabledLayers & GetLayerMask( layer ) ) { AppendLayerRow( LAYER_WIDGET::ROW( brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), _("Back copper layer"), true ) ); @@ -309,7 +309,7 @@ void PCB_LAYER_WIDGET::ReFill() { layer = techLayerSeq[i].layerId; - if( !(enabledLayers & (1 << layer)) ) + if( !(enabledLayers & GetLayerMask( layer )) ) continue; AppendLayerRow( LAYER_WIDGET::ROW( @@ -349,12 +349,12 @@ void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal { BOARD* brd = myframe->GetBoard(); - int visibleLayers = brd->GetVisibleLayers(); + LAYER_MSK visibleLayers = brd->GetVisibleLayers(); if( isVisible ) - visibleLayers |= (1 << aLayer); + visibleLayers |= GetLayerMask( aLayer ); else - visibleLayers &= ~(1 << aLayer); + visibleLayers &= ~GetLayerMask( aLayer ); brd->SetVisibleLayers( visibleLayers ); diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index b8c2413614..514c091529 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -87,7 +87,7 @@ inline bool IsNear( wxPoint& p1, wxPoint& p2, int max_dist ) } -TRACK* GetTrace( TRACK* aStartTrace, TRACK* aEndTrace, const wxPoint& aPosition, int aLayerMask ) +TRACK* GetTrace( TRACK* aStartTrace, TRACK* aEndTrace, const wxPoint& aPosition, LAYER_MSK aLayerMask ) { TRACK* PtSegm; @@ -100,13 +100,13 @@ TRACK* GetTrace( TRACK* aStartTrace, TRACK* aEndTrace, const wxPoint& aPosition, { if( aPosition == PtSegm->GetStart() ) { - if( aLayerMask & PtSegm->ReturnMaskLayer() ) + if( aLayerMask & PtSegm->GetLayerMask() ) return PtSegm; } if( aPosition == PtSegm->GetEnd() ) { - if( aLayerMask & PtSegm->ReturnMaskLayer() ) + if( aLayerMask & PtSegm->GetLayerMask() ) return PtSegm; } } @@ -429,7 +429,7 @@ bool SEGVIA::IsOnLayer( int layer_number ) const } -int TRACK::ReturnMaskLayer() const +LAYER_MSK TRACK::GetLayerMask() const { if( Type() == PCB_VIA_T ) { @@ -445,18 +445,19 @@ int TRACK::ReturnMaskLayer() const // ReturnLayerPair() knows how layers are stored ( (SEGVIA*) this )->ReturnLayerPair( &top_layer, &bottom_layer ); - int layermask = 0; + LAYER_MSK layermask = NO_LAYERS; while( bottom_layer <= top_layer ) { - layermask |= GetLayerMask( bottom_layer++ ); + layermask |= ::GetLayerMask( bottom_layer ); + ++bottom_layer; } return layermask; } else { - return GetLayerMask( m_Layer ); + return ::GetLayerMask( m_Layer ); } } @@ -1190,7 +1191,7 @@ bool TRACK::HitTest( const EDA_RECT& aRect ) const } -TRACK* TRACK::GetVia( const wxPoint& aPosition, int aLayerMask ) +TRACK* TRACK::GetVia( const wxPoint& aPosition, int aLayer ) { TRACK* track; @@ -1205,10 +1206,10 @@ TRACK* TRACK::GetVia( const wxPoint& aPosition, int aLayerMask ) if( track->GetState( BUSY | IS_DELETED ) ) continue; - if( aLayerMask < 0 ) + if( aLayer < 0 ) break; - if( track->IsOnLayer( aLayerMask ) ) + if( track->IsOnLayer( aLayer ) ) break; } @@ -1216,7 +1217,7 @@ TRACK* TRACK::GetVia( const wxPoint& aPosition, int aLayerMask ) } -TRACK* TRACK::GetVia( TRACK* aEndTrace, const wxPoint& aPosition, int aLayerMask ) +TRACK* TRACK::GetVia( TRACK* aEndTrace, const wxPoint& aPosition, LAYER_MSK aLayerMask ) { TRACK* trace; @@ -1228,7 +1229,7 @@ TRACK* TRACK::GetVia( TRACK* aEndTrace, const wxPoint& aPosition, int aLayerMask { if( trace->GetState( BUSY | IS_DELETED ) == 0 ) { - if( aLayerMask & trace->ReturnMaskLayer() ) + if( aLayerMask & trace->GetLayerMask() ) return trace; } } @@ -1258,7 +1259,7 @@ TRACK* TRACK::GetTrace( TRACK* aStartTrace, TRACK* aEndTrace, int aEndPoint ) else position = m_End; - Reflayer = ReturnMaskLayer(); + Reflayer = GetLayerMask(); previousSegment = nextSegment = this; @@ -1282,13 +1283,13 @@ TRACK* TRACK::GetTrace( TRACK* aStartTrace, TRACK* aEndTrace, int aEndPoint ) if( IsNear( position, nextSegment->m_Start, max_dist ) ) { - if( Reflayer & nextSegment->ReturnMaskLayer() ) + if( Reflayer & nextSegment->GetLayerMask() ) return nextSegment; } if( IsNear( position, nextSegment->m_End, max_dist ) ) { - if( Reflayer & nextSegment->ReturnMaskLayer() ) + if( Reflayer & nextSegment->GetLayerMask() ) return nextSegment; } suite: @@ -1310,13 +1311,13 @@ suite: if( IsNear( position, previousSegment->m_Start, max_dist ) ) { - if( Reflayer & previousSegment->ReturnMaskLayer() ) + if( Reflayer & previousSegment->GetLayerMask() ) return previousSegment; } if( IsNear( position, previousSegment->m_End, max_dist ) ) { - if( Reflayer & previousSegment->ReturnMaskLayer() ) + if( Reflayer & previousSegment->GetLayerMask() ) return previousSegment; } suite1: @@ -1352,13 +1353,13 @@ suite1: if( IsNear( position, nextSegment->m_Start, max_dist ) ) { - if( Reflayer & nextSegment->ReturnMaskLayer() ) + if( Reflayer & nextSegment->GetLayerMask() ) return nextSegment; } if( IsNear( position, nextSegment->m_End, max_dist ) ) { - if( Reflayer & nextSegment->ReturnMaskLayer() ) + if( Reflayer & nextSegment->GetLayerMask() ) return nextSegment; } @@ -1373,7 +1374,8 @@ suite1: int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace ) { TRACK* Track, * via, * segm, * TrackListEnd; - int NbEnds, layerMask, ii, ok = 0; + int NbEnds, ii, ok = 0; + LAYER_MSK layerMask; if( aCount <= 1 ) { @@ -1402,12 +1404,12 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace ) if( Track->Type() == PCB_VIA_T ) continue; - layerMask = Track->ReturnMaskLayer(); + layerMask = Track->GetLayerMask(); via = GetVia( TrackListEnd, Track->m_Start, layerMask ); if( via ) { - layerMask |= via->ReturnMaskLayer(); + layerMask |= via->GetLayerMask(); via->SetState( BUSY, true ); } @@ -1449,12 +1451,12 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace ) } } - layerMask = Track->ReturnMaskLayer(); + layerMask = Track->GetLayerMask(); via = GetVia( TrackListEnd, Track->m_End, layerMask ); if( via ) { - layerMask |= via->ReturnMaskLayer(); + layerMask |= via->GetLayerMask(); via->SetState( BUSY, true ); } diff --git a/pcbnew/class_track.h b/pcbnew/class_track.h index 8ac2836061..14d6eac95e 100644 --- a/pcbnew/class_track.h +++ b/pcbnew/class_track.h @@ -68,7 +68,7 @@ class MSG_PANEL_ITEM; * @return A TRACK object pointer if found otherwise NULL. */ extern TRACK* GetTrace( TRACK* aStartTrace, TRACK* aEndTrace, const wxPoint& aPosition, - int aLayerMask ); + LAYER_MSK aLayerMask ); class TRACK : public BOARD_CONNECTED_ITEM @@ -215,12 +215,12 @@ public: bool IsDrillDefault() { return m_Drill <= 0; } /** - * Function ReturnMaskLayer + * Function GetLayerMask * returns a "layer mask", which is a bitmap of all layers on which the * TRACK segment or SEGVIA physically resides. * @return int - a layer mask, see pcbstruct.h's LAYER_BACK, etc. */ - int ReturnMaskLayer() const; + LAYER_MSK GetLayerMask() const; /** * Function IsPointOnEnds @@ -265,10 +265,10 @@ public: * finds the first SEGVIA object at \a aPosition on \a aLayer starting at the trace. * * @param aPosition The wxPoint to HitTest() against. - * @param aLayerMask The layer to match, pass -1 for a don't care. + * @param aLayer The layer to match, pass -1 for a don't care. * @return A pointer to a SEGVIA object if found, else NULL. */ - TRACK* GetVia( const wxPoint& aPosition, int aLayerMask = -1 ); + TRACK* GetVia( const wxPoint& aPosition, int aLayer = -1 ); /** * Function GetVia @@ -280,7 +280,7 @@ public: * @param aLayerMask The layers to match, pass -1 for a don't care. * @return A pointer to a SEGVIA object if found, else NULL. */ - TRACK* GetVia( TRACK* aEndTrace, const wxPoint& aPosition, int aLayerMask ); + TRACK* GetVia( TRACK* aEndTrace, const wxPoint& aPosition, LAYER_MSK aLayerMask ); /** * Function GetTrace diff --git a/pcbnew/collectors.h b/pcbnew/collectors.h index cd1f25dcfa..b958b82e98 100644 --- a/pcbnew/collectors.h +++ b/pcbnew/collectors.h @@ -379,10 +379,10 @@ private: int m_PreferredLayer; bool m_IgnorePreferredLayer; - int m_LayerLocked; ///< bit-mapped layer locked bits + LAYER_MSK m_LayerLocked; ///< bit-mapped layer locked bits bool m_IgnoreLockedLayers; - int m_LayerVisible; ///< bit-mapped layer visible bits + LAYER_MSK m_LayerVisible; ///< bit-mapped layer visible bits bool m_IgnoreNonVisibleLayers; bool m_IgnoreLockedItems; @@ -407,11 +407,11 @@ public: * @param aVisibleLayerMask = current visible layers (bit mask) * @param aPreferredLayer = the layer to search first */ - GENERAL_COLLECTORS_GUIDE( int aVisibleLayerMask, int aPreferredLayer ) + GENERAL_COLLECTORS_GUIDE( LAYER_MSK aVisibleLayerMask, int aPreferredLayer ) { m_PreferredLayer = LAYER_N_FRONT; m_IgnorePreferredLayer = false; - m_LayerLocked = 0; + m_LayerLocked = NO_LAYERS; m_LayerVisible = aVisibleLayerMask; m_IgnoreLockedLayers = true; m_IgnoreNonVisibleLayers = true; @@ -443,13 +443,16 @@ public: * Function IsLayerLocked * @return bool - true if the given layer is locked, else false. */ - bool IsLayerLocked( int aLayer ) const { return (1<GetLayerMask() & cp_item->GetTrack()->ReturnMaskLayer()) == 0 ) + if( (pad->GetLayerMask() & cp_item->GetTrack()->GetLayerMask()) == 0 ) continue; if( pad->HitTest( cp_item->GetPoint() ) ) @@ -296,7 +296,7 @@ int CONNECTIONS::SearchConnectedTracks( const TRACK * aTrack ) int count = 0; m_connected.clear(); - int layerMask = aTrack->ReturnMaskLayer(); + LAYER_MSK layerMask = aTrack->GetLayerMask(); // Search for connections to starting point: #define USE_EXTENDED_SEARCH @@ -318,7 +318,7 @@ int CONNECTIONS::SearchConnectedTracks( const TRACK * aTrack ) continue; if( m_candidates[ii].GetPoint() != position ) break; - if( (m_candidates[ii].GetTrack()->ReturnMaskLayer() & layerMask ) != 0 ) + if( m_candidates[ii].GetTrack()->GetLayerMask() & layerMask ) m_connected.push_back( m_candidates[ii].GetTrack() ); } // search before: @@ -328,7 +328,7 @@ int CONNECTIONS::SearchConnectedTracks( const TRACK * aTrack ) continue; if( m_candidates[ii].GetPoint() != position ) break; - if( (m_candidates[ii].GetTrack()->ReturnMaskLayer() & layerMask ) != 0 ) + if( m_candidates[ii].GetTrack()->GetLayerMask() & layerMask ) m_connected.push_back( m_candidates[ii].GetTrack() ); } } @@ -339,7 +339,7 @@ int CONNECTIONS::SearchConnectedTracks( const TRACK * aTrack ) { TRACK * ctrack = tracks_candidates[ii]->GetTrack(); - if( ( ctrack->ReturnMaskLayer() & layerMask ) == 0 ) + if( ( ctrack->GetLayerMask() & layerMask ) == 0 ) continue; if( ctrack == aTrack ) diff --git a/pcbnew/dialogs/dialog_SVG_print.cpp b/pcbnew/dialogs/dialog_SVG_print.cpp index 472f8f5ef3..9b9e7052bb 100644 --- a/pcbnew/dialogs/dialog_SVG_print.cpp +++ b/pcbnew/dialogs/dialog_SVG_print.cpp @@ -127,7 +127,7 @@ void DIALOG_SVG_PRINT::initDialog() if( m_boxSelectLayer[layer] == NULL ) continue; - long mask = 1 << layer; + LAYER_MSK mask = GetLayerMask( layer ); if( mask & s_SelectedLayers ) m_boxSelectLayer[layer]->SetValue( true ); @@ -235,7 +235,7 @@ void DIALOG_SVG_PRINT::ExportSVGFile( bool aOnlyOneFile ) SetPenWidth(); // Build layers mask - int printMaskLayer = 0; + LAYER_MSK printMaskLayer = NO_LAYERS; for( int layer = 0; layerGetSelection() != 0 ) // Use current layer only - layers_filter = 1 << m_currentLayer; + layers_filter = GetLayerMask( m_currentLayer ); if( m_DelDrawings->GetValue() ) @@ -111,7 +111,7 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( ) for( item = pcb->m_Drawings; item != NULL; item = nextitem ) { nextitem = item->Next(); - bool removeme = (GetLayerMask( item->GetLayer() ) & masque_layer) != 0; + bool removeme = GetLayerMask( item->GetLayer() ) & masque_layer; if( ( item->Type() == PCB_TEXT_T ) && m_DelTexts->GetValue() ) removeme = true; @@ -162,7 +162,7 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( ) if( (track->Type() == PCB_VIA_T) && !m_TrackFilterVias->GetValue() ) continue; - if( (track->ReturnMaskLayer() & layers_filter) == 0 ) + if( (track->GetLayerMask() & layers_filter) == 0 ) continue; itemPicker.SetItem( track ); diff --git a/pcbnew/dialogs/dialog_layers_setup.cpp b/pcbnew/dialogs/dialog_layers_setup.cpp index e91369152d..7d7d836410 100644 --- a/pcbnew/dialogs/dialog_layers_setup.cpp +++ b/pcbnew/dialogs/dialog_layers_setup.cpp @@ -76,7 +76,7 @@ private: PCB_EDIT_FRAME* m_Parent; int m_CopperLayerCount; - int m_EnabledLayers; + LAYER_MSK m_EnabledLayers; BOARD* m_Pcb; @@ -90,12 +90,12 @@ private: void showCopperChoice( int copperCount ); void showBoardLayerNames(); - void showSelectedLayerCheckBoxes( int enableLayerMask ); + void showSelectedLayerCheckBoxes( LAYER_MSK enableLayerMask ); void showLayerTypes(); - void showPresets( int enabledLayerMask ); + void showPresets( LAYER_MSK enabledLayerMask ); /** return the selected layer mask within the UI checkboxes */ - int getUILayerMask(); + LAYER_MSK getUILayerMask(); wxString getLayerName( int layer ); int getLayerTypeIndex( int layer ); @@ -171,12 +171,12 @@ public: // Layer bit masks for each defined "Preset Layer Grouping" -static const int presets[] = +static const LAYER_MSK presets[] = { #define FRONT_AUX (SILKSCREEN_LAYER_FRONT | SOLDERMASK_LAYER_FRONT | ADHESIVE_LAYER_FRONT | SOLDERPASTE_LAYER_FRONT) #define BACK_AUX (SILKSCREEN_LAYER_BACK | SOLDERMASK_LAYER_BACK | ADHESIVE_LAYER_BACK | SOLDERPASTE_LAYER_BACK) - 0, // shift the array index up by one, matches with "Custom". + NO_LAYERS, // shift the array index up by one, matches with "Custom". // "Two layers, parts on Front only" EDGE_LAYER | LAYER_FRONT | LAYER_BACK | FRONT_AUX, @@ -348,16 +348,16 @@ void DIALOG_LAYERS_SETUP::showBoardLayerNames() } -void DIALOG_LAYERS_SETUP::showSelectedLayerCheckBoxes( int enabledLayers ) +void DIALOG_LAYERS_SETUP::showSelectedLayerCheckBoxes( LAYER_MSK enabledLayers ) { for( int layer=0; layerGetValue() ) { - layerMaskResult |= (1 << layer); + layerMaskResult |= GetLayerMask( layer ); } } diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index 20d8390fe3..b489b89a5b 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -65,7 +65,7 @@ static PAD_ATTR_T CodeType[] = { // Default mask layers setup for pads according to the pad type -static long Std_Pad_Layers[] = { +static const LAYER_MSK Std_Pad_Layers[] = { // PAD_STANDARD: PAD_STANDARD_DEFAULT_LAYERS, @@ -114,7 +114,7 @@ private: * updates the CheckBox states in pad layers list, * @param layer_mask = pad layer mask (ORed layers bit mask) */ - void setPadLayersList( long layer_mask ); + void setPadLayersList( LAYER_MSK layer_mask ); /// Copy values from dialog field to aPad's members bool transferDataToPad( D_PAD* aPad ); @@ -592,13 +592,12 @@ void DIALOG_PAD_PROPERTIES::PadOrientEvent( wxCommandEvent& event ) void DIALOG_PAD_PROPERTIES::PadTypeSelected( wxCommandEvent& event ) { - long layer_mask; unsigned ii = m_PadType->GetSelection(); if( ii >= NBTYPES ) // catches < 0 also ii = 0; - layer_mask = Std_Pad_Layers[ii]; + LAYER_MSK layer_mask = Std_Pad_Layers[ii]; setPadLayersList( layer_mask ); // Enable/disable drill dialog items: @@ -619,7 +618,7 @@ void DIALOG_PAD_PROPERTIES::PadTypeSelected( wxCommandEvent& event ) } -void DIALOG_PAD_PROPERTIES::setPadLayersList( long layer_mask ) +void DIALOG_PAD_PROPERTIES::setPadLayersList( LAYER_MSK layer_mask ) { if( ( layer_mask & ALL_CU_LAYERS ) == LAYER_FRONT ) m_rbCopperLayersSel->SetSelection(0); @@ -672,7 +671,7 @@ bool DIALOG_PAD_PROPERTIES::padValuesOK() error_msgs.Add( _( "Incorrect value for pad drill: pad drill bigger than pad size" ) ); } - int padlayers_mask = m_dummyPad->GetLayerMask(); + LAYER_MSK padlayers_mask = m_dummyPad->GetLayerMask(); if( ( padlayers_mask == 0 ) && ( m_dummyPad->GetAttribute() != PAD_HOLE_NOT_PLATED ) ) error_msgs.Add( _( "Error: pad has no layer and is not a mechanical pad" ) ); @@ -851,7 +850,6 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event ) bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad ) { - long padLayerMask; wxString msg; int x, y; @@ -1038,7 +1036,7 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad ) break; } - padLayerMask = 0; + LAYER_MSK padLayerMask = NO_LAYERS; switch( m_rbCopperLayersSel->GetSelection() ) { diff --git a/pcbnew/dialogs/dialog_pcb_text_properties.cpp b/pcbnew/dialogs/dialog_pcb_text_properties.cpp index a3740b1548..dfcc221af1 100644 --- a/pcbnew/dialogs/dialog_pcb_text_properties.cpp +++ b/pcbnew/dialogs/dialog_pcb_text_properties.cpp @@ -126,11 +126,11 @@ void DIALOG_PCB_TEXT_PROPERTIES::MyInit() PutValueInLocalUnits( *m_PositionXCtrl, m_SelectedPCBText->GetTextPosition().x ); PutValueInLocalUnits( *m_PositionYCtrl, m_SelectedPCBText->GetTextPosition().y ); - int enabledLayers = m_Parent->GetBoard()->GetEnabledLayers(); + LAYER_MSK enabledLayers = m_Parent->GetBoard()->GetEnabledLayers(); - for( int layer = 0; layer < NB_LAYERS; ++layer ) + for( int layer = 0; layer < NB_LAYERS; ++layer ) { - if( enabledLayers & (1 << layer) ) + if( enabledLayers & GetLayerMask( layer ) ) { layerList.push_back( layer ); int itemIndex = diff --git a/pcbnew/dialogs/dialog_print_using_printer.cpp b/pcbnew/dialogs/dialog_print_using_printer.cpp index 111d107391..7d711ae9f1 100644 --- a/pcbnew/dialogs/dialog_print_using_printer.cpp +++ b/pcbnew/dialogs/dialog_print_using_printer.cpp @@ -282,7 +282,7 @@ int DIALOG_PRINT_USING_PRINTER::SetLayerMaskFromListSelection() int page_count; int layers_count = NB_LAYERS; - s_Parameters.m_PrintMaskLayer = 0; + s_Parameters.m_PrintMaskLayer = NO_LAYERS; int ii; for( ii = 0, page_count = 0; ii < layers_count; ii++ ) { @@ -291,7 +291,7 @@ int DIALOG_PRINT_USING_PRINTER::SetLayerMaskFromListSelection() if( m_BoxSelectLayer[ii]->IsChecked() ) { page_count++; - s_Parameters.m_PrintMaskLayer |= 1 << ii; + s_Parameters.m_PrintMaskLayer |= GetLayerMask( ii ); } } diff --git a/pcbnew/drag.h b/pcbnew/drag.h index bc4e216c4f..beb87b62c5 100644 --- a/pcbnew/drag.h +++ b/pcbnew/drag.h @@ -183,7 +183,7 @@ void EraseDragList(); * @param aNetCode = the net code to consider * @param aMaxDist = max distance from aRefPos to a track end candidate to collect the track */ -void Collect_TrackSegmentsToDrag( BOARD* aPcb, const wxPoint& aRefPos, int aLayerMask, +void Collect_TrackSegmentsToDrag( BOARD* aPcb, const wxPoint& aRefPos, LAYER_MSK aLayerMask, int aNetCode, int aMaxDist ); /* Add aTrack to the drag list diff --git a/pcbnew/dragsegm.cpp b/pcbnew/dragsegm.cpp index c23c8fe5da..abe8a8344b 100644 --- a/pcbnew/dragsegm.cpp +++ b/pcbnew/dragsegm.cpp @@ -334,7 +334,7 @@ void AddSegmentToDragList( int flag, TRACK* aTrack ) } -void Collect_TrackSegmentsToDrag( BOARD* aPcb, const wxPoint& aRefPos, int aLayerMask, +void Collect_TrackSegmentsToDrag( BOARD* aPcb, const wxPoint& aRefPos, LAYER_MSK aLayerMask, int aNetCode, int aMaxDist ) { TRACK* track = aPcb->m_Track->GetStartNetCode( aNetCode ); @@ -344,7 +344,7 @@ void Collect_TrackSegmentsToDrag( BOARD* aPcb, const wxPoint& aRefPos, int aLaye if( track->GetNet() != aNetCode ) // not the same netcodenet code: all candidates tested break; - if( ( aLayerMask & track->ReturnMaskLayer() ) == 0 ) + if( ( aLayerMask & track->GetLayerMask() ) == 0 ) continue; // Cannot be connected, not on the same layer if( track->IsDragging() ) @@ -393,7 +393,7 @@ void Collect_TrackSegmentsToDrag( BOARD* aPcb, const wxPoint& aRefPos, int aLaye // If a connected via is found at location aRefPos, // collect also tracks connected by this via. if( track->Type() == PCB_VIA_T ) - Collect_TrackSegmentsToDrag( aPcb, aRefPos, track->ReturnMaskLayer(), + Collect_TrackSegmentsToDrag( aPcb, aRefPos, track->GetLayerMask(), aNetCode, track->GetWidth() / 2 ); } } diff --git a/pcbnew/drc.cpp b/pcbnew/drc.cpp index 67d1194022..bd08a55e20 100644 --- a/pcbnew/drc.cpp +++ b/pcbnew/drc.cpp @@ -663,7 +663,7 @@ bool DRC::doTrackKeepoutDrc( TRACK* aRefSeg ) bool DRC::doPadToPadsDrc( D_PAD* aRefPad, D_PAD** aStart, D_PAD** aEnd, int x_limit ) { - int layerMask = aRefPad->GetLayerMask() & ALL_CU_LAYERS; + LAYER_MSK layerMask = aRefPad->GetLayerMask() & ALL_CU_LAYERS; /* used to test DRC pad to holes: this dummy pad has the size and shape of the hole * to test pad to pad hole DRC, using the pad to pad DRC test function. diff --git a/pcbnew/drc_clearance_test_functions.cpp b/pcbnew/drc_clearance_test_functions.cpp index 804e33dca5..5df8dcfe95 100644 --- a/pcbnew/drc_clearance_test_functions.cpp +++ b/pcbnew/drc_clearance_test_functions.cpp @@ -150,7 +150,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads ) { TRACK* track; wxPoint delta; // lenght on X and Y axis of segments - int layerMask; + LAYER_MSK layerMask; int net_code_ref; wxPoint shape_pos; @@ -164,7 +164,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads ) m_segmEnd = delta = aRefSeg->GetEnd() - origin; m_segmAngle = 0; - layerMask = aRefSeg->ReturnMaskLayer(); + layerMask = aRefSeg->GetLayerMask(); net_code_ref = aRefSeg->GetNet(); // Phase 0 : Test vias @@ -343,7 +343,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads ) continue; // No problem if segment are on different layers : - if( ( layerMask & track->ReturnMaskLayer() ) == 0 ) + if( ( layerMask & track->GetLayerMask() ) == 0 ) continue; // the minimum distance = clearance plus half the reference track diff --git a/pcbnew/eagle_plugin.h b/pcbnew/eagle_plugin.h index 373cca6671..a84b2af6bd 100644 --- a/pcbnew/eagle_plugin.h +++ b/pcbnew/eagle_plugin.h @@ -27,6 +27,7 @@ */ #include +#include // forward declaration on ptree template so we can confine use of big boost diff --git a/pcbnew/editrack.cpp b/pcbnew/editrack.cpp index 97888d433f..7064aceac4 100644 --- a/pcbnew/editrack.cpp +++ b/pcbnew/editrack.cpp @@ -99,7 +99,7 @@ static void Abort_Create_Track( EDA_DRAW_PANEL* Panel, wxDC* DC ) TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) { TRACK* TrackOnStartPoint = NULL; - int layerMask = GetLayerMask( GetScreen()->m_Active_Layer ); + LAYER_MSK layerMask = GetLayerMask( GetScreen()->m_Active_Layer ); BOARD_CONNECTED_ITEM* LockPoint; wxPoint pos = GetScreen()->GetCrossHairPosition(); @@ -411,7 +411,7 @@ bool PCB_EDIT_FRAME::Add45DegreeSegment( wxDC* aDC ) bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* aDC ) { - int layerMask = GetLayerMask( GetScreen()->m_Active_Layer ); + LAYER_MSK layerMask = GetLayerMask( GetScreen()->m_Active_Layer ); if( aTrack == NULL ) return false; diff --git a/pcbnew/export_gencad.cpp b/pcbnew/export_gencad.cpp index 780c3857ec..06001dcdd7 100644 --- a/pcbnew/export_gencad.cpp +++ b/pcbnew/export_gencad.cpp @@ -231,8 +231,8 @@ static int ViaSort( const void* aRefptr, const void* aObjptr ) if( padref->GetDrillValue() != padcmp->GetDrillValue() ) return padref->GetDrillValue() - padcmp->GetDrillValue(); - if( padref->ReturnMaskLayer() != padcmp->ReturnMaskLayer() ) - return padref->ReturnMaskLayer() - padcmp->ReturnMaskLayer(); + if( padref->GetLayerMask() != padcmp->GetLayerMask() ) + return padref->GetLayerMask() - padcmp->GetLayerMask(); return 0; } @@ -258,7 +258,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) padstacks.resize( 1 ); // We count pads from 1 // The master layermask (i.e. the enabled layers) for padstack generation - unsigned master_layermask = aPcb->GetDesignSettings().GetEnabledLayers(); + LAYER_MSK master_layermask = aPcb->GetDesignSettings().GetEnabledLayers(); fputs( "$PADS\n", aFile ); @@ -293,7 +293,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) viastacks.push_back( via ); fprintf( aFile, "PAD V%d.%d.%X ROUND %g\nCIRCLE 0 0 %g\n", via->GetWidth(), via->GetDrillValue(), - via->ReturnMaskLayer(), + via->GetLayerMask(), via->GetDrillValue() / SCALE_FACTOR, via->GetWidth() / (SCALE_FACTOR * 2) ); } @@ -434,14 +434,14 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) for( unsigned i = 0; i < viastacks.size(); i++ ) { TRACK* via = viastacks[i]; - unsigned mask = via->ReturnMaskLayer() & master_layermask; + LAYER_MSK mask = via->GetLayerMask() & master_layermask; fprintf( aFile, "PADSTACK VIA%d.%d.%X %g\n", via->GetWidth(), via->GetDrillValue(), mask, via->GetDrillValue() / SCALE_FACTOR ); for( int layer = 0; layer < 32; layer++ ) { - if( mask & (1 << layer) ) + if( mask & GetLayerMask( layer ) ) { fprintf( aFile, "PAD V%d.%d.%X %s 0 0\n", via->GetWidth(), via->GetDrillValue(), @@ -465,7 +465,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) pad->GetDrillSize().x / SCALE_FACTOR ); for( int layer = 0; layer < 32; layer++ ) { - if( pad->GetLayerMask() & (1 << layer) & master_layermask ) + if( pad->GetLayerMask() & GetLayerMask( layer ) & master_layermask ) { fprintf( aFile, "PAD P%d %s 0 0\n", i, TO_UTF8( GenCADLayerName[layer] ) ); @@ -477,7 +477,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) pad->GetDrillSize().x / SCALE_FACTOR ); for( int layer = 0; layer < 32; layer++ ) { - if( pad->GetLayerMask() & (1 << layer) & master_layermask ) + if( pad->GetLayerMask() & GetLayerMask( layer ) & master_layermask ) { fprintf( aFile, "PAD P%d %s 0 0\n", i, TO_UTF8( GenCADLayerNameFlipped[layer] ) ); @@ -760,7 +760,7 @@ static void CreateRoutesSection( FILE* aFile, BOARD* aPcb ) int vianum = 1; int old_netcode, old_width, old_layer; int nbitems, ii; - unsigned master_layermask = aPcb->GetDesignSettings().GetEnabledLayers(); + LAYER_MSK master_layermask = aPcb->GetDesignSettings().GetEnabledLayers(); // Count items nbitems = 0; @@ -836,7 +836,7 @@ static void CreateRoutesSection( FILE* aFile, BOARD* aPcb ) { fprintf( aFile, "VIA VIA%d.%d.%X %g %g ALL %g via%d\n", track->GetWidth(), track->GetDrillValue(), - track->ReturnMaskLayer() & master_layermask, + track->GetLayerMask() & master_layermask, MapXTo( track->GetStart().x ), MapYTo( track->GetStart().y ), track->GetDrillValue() / SCALE_FACTOR, vianum++ ); } diff --git a/pcbnew/export_vrml.cpp b/pcbnew/export_vrml.cpp index b9ec9ff37b..b1706d069a 100644 --- a/pcbnew/export_vrml.cpp +++ b/pcbnew/export_vrml.cpp @@ -918,7 +918,7 @@ static void export_vrml_pad( BOARD* pcb, D_PAD* aPad ) //{{{ } // The pad proper, on the selected layers - int layer_mask = aPad->GetLayerMask(); + LAYER_MSK layer_mask = aPad->GetLayerMask(); int copper_layers = pcb->GetCopperLayerCount( ); // The (maybe offseted) pad position @@ -939,7 +939,7 @@ static void export_vrml_pad( BOARD* pcb, D_PAD* aPad ) //{{{ if( (layer > FIRST_COPPER_LAYER) && (layer == copper_layers - 1) ) layer = LAST_COPPER_LAYER; - if( layer_mask & (1 << layer) ) + if( layer_mask & GetLayerMask( layer ) ) { // OK, the pad is on this layer, export it switch( aPad->GetShape() ) diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index 2411ba9c54..a047e644fa 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -425,7 +425,7 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const m_out->Print( aNestLevel, "(layers\n" ); unsigned mask = LAYER_FRONT; - unsigned layer = LAYER_N_FRONT; + int layer = LAYER_N_FRONT; // Save only the used copper layers from front to back. while( mask != 0 ) @@ -980,12 +980,12 @@ void PCB_IO::format( MODULE* aModule, int aNestLevel ) const } -void PCB_IO::formatLayers( int aLayerMask, int aNestLevel ) const +void PCB_IO::formatLayers( LAYER_MSK aLayerMask, int aNestLevel ) const throw( IO_ERROR ) { m_out->Print( aNestLevel, "(layers" ); - int cuMask = ALL_CU_LAYERS; + LAYER_MSK cuMask = ALL_CU_LAYERS; if( m_board ) cuMask &= m_board->GetEnabledLayers(); diff --git a/pcbnew/kicad_plugin.h b/pcbnew/kicad_plugin.h index 0a1076f003..aa2b297ad4 100644 --- a/pcbnew/kicad_plugin.h +++ b/pcbnew/kicad_plugin.h @@ -26,6 +26,7 @@ #include #include +#include class BOARD; class BOARD_ITEM; @@ -189,7 +190,7 @@ private: void formatLayer( const BOARD_ITEM* aItem ) const; - void formatLayers( int aLayerMask, int aNestLevel = 0 ) const + void formatLayers( LAYER_MSK aLayerMask, int aNestLevel = 0 ) const throw( IO_ERROR ); /// we only cache one footprint library for now, this determines which one. diff --git a/pcbnew/layer_widget.h b/pcbnew/layer_widget.h index 39d55d17ad..a39fe8644b 100644 --- a/pcbnew/layer_widget.h +++ b/pcbnew/layer_widget.h @@ -41,6 +41,7 @@ #include #include #include +#include #include #define LYR_COLUMN_COUNT 4 ///< Layer tab column count diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index 8798236902..fa681a52c0 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -409,7 +409,7 @@ void LEGACY_PLUGIN::loadGENERAL() else if( TESTLINE( "EnabledLayers" ) ) { - int enabledLayers = hexParse( line + SZ( "EnabledLayers" ) ); + LAYER_MSK enabledLayers = hexParse( line + SZ( "EnabledLayers" ) ); // layer usage m_board->SetEnabledLayers( enabledLayers ); @@ -420,7 +420,7 @@ void LEGACY_PLUGIN::loadGENERAL() else if( TESTLINE( "VisibleLayers" ) ) { - int visibleLayers = hexParse( line + SZ( "VisibleLayers" ) ); + LAYER_MSK visibleLayers = hexParse( line + SZ( "VisibleLayers" ) ); m_board->SetVisibleLayers( visibleLayers ); } @@ -1239,7 +1239,6 @@ void LEGACY_PLUGIN::loadPAD( MODULE* aModule ) // sscanf( PtLine, "%s %s %X", BufLine, BufCar, &m_layerMask ); PAD_ATTR_T attribute; - int layer_mask; data = strtok( line + SZ( "At" ), delims ); @@ -1255,7 +1254,7 @@ void LEGACY_PLUGIN::loadPAD( MODULE* aModule ) data = strtok( NULL, delims ); // skip BufCar data = strtok( NULL, delims ); - layer_mask = hexParse( data ); + LAYER_MSK layer_mask = hexParse( data ); pad->SetLayerMask( layer_mask ); pad->SetAttribute( attribute ); diff --git a/pcbnew/magnetic_tracks_functions.cpp b/pcbnew/magnetic_tracks_functions.cpp index f365647597..4edb3d416c 100644 --- a/pcbnew/magnetic_tracks_functions.cpp +++ b/pcbnew/magnetic_tracks_functions.cpp @@ -157,7 +157,7 @@ bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize, if( doPad ) { - int layer_mask = GetLayerMask( screen->m_Active_Layer ); + LAYER_MSK layer_mask = GetLayerMask( screen->m_Active_Layer ); D_PAD* pad = m_Pcb->GetPad( pos, layer_mask ); if( pad ) @@ -192,7 +192,7 @@ bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize, if( !currTrack ) { - int layer_mask = GetLayerMask( layer ); + LAYER_MSK layer_mask = GetLayerMask( layer ); TRACK* track = m_Pcb->GetTrace( m_Pcb->m_Track, pos, layer_mask ); diff --git a/pcbnew/module_editor_frame.h b/pcbnew/module_editor_frame.h index da3166e3ed..870d988e4c 100644 --- a/pcbnew/module_editor_frame.h +++ b/pcbnew/module_editor_frame.h @@ -154,7 +154,7 @@ public: * @param aPrintMirrorMode = not used here (Set when printing in mirror mode) * @param aData = a pointer on an auxiliary data (NULL if not used) */ - virtual void PrintPage( wxDC* aDC, int aPrintMaskLayer, bool aPrintMirrorMode, + virtual void PrintPage( wxDC* aDC, LAYER_MSK aPrintMaskLayer, bool aPrintMirrorMode, void * aData = NULL); // BOARD handling diff --git a/pcbnew/move_or_drag_track.cpp b/pcbnew/move_or_drag_track.cpp index 394ed2bc0f..3e89a847b4 100644 --- a/pcbnew/move_or_drag_track.cpp +++ b/pcbnew/move_or_drag_track.cpp @@ -629,7 +629,7 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC if( aCommand != ID_POPUP_PCB_MOVE_TRACK_SEGMENT ) { Collect_TrackSegmentsToDrag( GetBoard(), aTrack->GetStart(), - aTrack->ReturnMaskLayer(), + aTrack->GetLayerMask(), aTrack->GetNet(), aTrack->GetWidth() / 2 ); } @@ -649,17 +649,17 @@ void PCB_EDIT_FRAME::StartMoveOneNodeOrSegment( TRACK* aTrack, wxDC* aDC, int aC case ID_POPUP_PCB_DRAG_TRACK_SEGMENT: // drag a segment pos = aTrack->GetStart(); - Collect_TrackSegmentsToDrag( GetBoard(), pos, aTrack->ReturnMaskLayer(), + Collect_TrackSegmentsToDrag( GetBoard(), pos, aTrack->GetLayerMask(), aTrack->GetNet(), aTrack->GetWidth() / 2 ); pos = aTrack->GetEnd(); aTrack->SetFlags( IS_DRAGGED | ENDPOINT | STARTPOINT ); - Collect_TrackSegmentsToDrag( GetBoard(), pos, aTrack->ReturnMaskLayer(), + Collect_TrackSegmentsToDrag( GetBoard(), pos, aTrack->GetLayerMask(), aTrack->GetNet(), aTrack->GetWidth() / 2 ); break; case ID_POPUP_PCB_MOVE_TRACK_NODE: // Drag via or move node pos = (diag & STARTPOINT) ? aTrack->GetStart() : aTrack->GetEnd(); - Collect_TrackSegmentsToDrag( GetBoard(), pos, aTrack->ReturnMaskLayer(), + Collect_TrackSegmentsToDrag( GetBoard(), pos, aTrack->GetLayerMask(), aTrack->GetNet(), aTrack->GetWidth() / 2 ); PosInit = pos; break; @@ -865,7 +865,7 @@ bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC ) /* Test the connections modified by the move * (only pad connection must be tested, track connection will be * tested by TestNetConnection() ) */ - int layerMask = GetLayerMask( Track->GetLayer() ); + LAYER_MSK layerMask = GetLayerMask( Track->GetLayer() ); Track->start = GetBoard()->GetPadFast( Track->GetStart(), layerMask ); if( Track->start ) diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_callbacks.h b/pcbnew/pcad2kicadpcb_plugin/pcb_callbacks.h index 2cbc11c53f..9d49ea3a3c 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_callbacks.h +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_callbacks.h @@ -31,6 +31,7 @@ #define PCB_CALLBACKS_H_ #include +#include "include/layers_id_colors_and_visibility.h" enum LAYER_TYPE_T { diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index d11833c600..8f45cec82a 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -66,7 +66,7 @@ void PCB_PARSER::init() std::string untranslated = TO_UTF8( BOARD::GetStandardLayerName( layerNdx ) ); m_layerIndices[ untranslated ] = layerNdx; - m_layerMasks[ untranslated ] = 1 << layerNdx; + m_layerMasks[ untranslated ] = GetLayerMask( layerNdx ); } m_layerMasks[ "*.Cu" ] = ALL_CU_LAYERS; @@ -667,8 +667,8 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR ) std::string type; int layerIndex; bool isVisible = true; - int visibleLayers = 0; - int enabledLayers = 0; + LAYER_MSK visibleLayers = NO_LAYERS; + LAYER_MSK enabledLayers = NO_LAYERS; int copperLayerCount = 0; for( token = NextTok(); token != T_RIGHT; token = NextTok() ) @@ -700,13 +700,13 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR ) Expecting( "hide or )" ); } - enabledLayers |= 1 << layerIndex; + enabledLayers |= GetLayerMask( layerIndex ); if( isVisible ) - visibleLayers |= 1 << layerIndex; + visibleLayers |= GetLayerMask( layerIndex ); m_layerIndices[ name ] = layerIndex; - m_layerMasks[ name ] = 1 << layerIndex; + m_layerMasks[ name ] = GetLayerMask(layerIndex); wxString wname = FROM_UTF8( name.c_str() ); enum LAYER_T layerType = LAYER::ParseType( type.c_str() ); @@ -736,10 +736,11 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR ) } -int PCB_PARSER::lookUpLayer( const LAYER_MAP& aMap ) throw( PARSE_ERROR, IO_ERROR ) +template +T PCB_PARSER::lookUpLayer( const M& aMap ) throw( PARSE_ERROR, IO_ERROR ) { // avoid constructing another std::string, use lexer's directly - LAYER_MAP::const_iterator it = aMap.find( curText ); + typename M::const_iterator it = aMap.find( curText ); if( it == aMap.end() ) { @@ -747,7 +748,7 @@ int PCB_PARSER::lookUpLayer( const LAYER_MAP& aMap ) throw( PARSE_ERROR, IO_ERRO // dump the whole darn table, there's something wrong with it. for( it = aMap.begin(); it != aMap.end(); ++it ) { - printf( &aMap == &m_layerIndices ? "lm[%s] = %d\n" : "lm[%s] = %08X\n", + printf( &aMap == (void*)&m_layerIndices ? "lm[%s] = %d\n" : "lm[%s] = %08X\n", it->first.c_str(), it->second ); } #endif @@ -771,7 +772,7 @@ int PCB_PARSER::parseBoardItemLayer() throw( PARSE_ERROR, IO_ERROR ) NextTok(); - int layerIndex = lookUpLayer( m_layerIndices ); + int layerIndex = lookUpLayer( m_layerIndices ); // Handle closing ) in object parser. @@ -779,17 +780,17 @@ int PCB_PARSER::parseBoardItemLayer() throw( PARSE_ERROR, IO_ERROR ) } -int PCB_PARSER::parseBoardItemLayersAsMask() throw( PARSE_ERROR, IO_ERROR ) +LAYER_MSK PCB_PARSER::parseBoardItemLayersAsMask() throw( PARSE_ERROR, IO_ERROR ) { - wxCHECK_MSG( CurTok() == T_layers, 0, + wxCHECK_MSG( CurTok() == T_layers, NO_LAYERS, wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as item layer mask." ) ); - int layerMask = 0; + LAYER_MSK layerMask = NO_LAYERS; for( T token = NextTok(); token != T_RIGHT; token = NextTok() ) { - int mask = lookUpLayer( m_layerMasks ); + LAYER_MSK mask = lookUpLayer( m_layerMasks ); layerMask |= mask; } @@ -2152,7 +2153,7 @@ D_PAD* PCB_PARSER::parseD_PAD() throw( IO_ERROR, PARSE_ERROR ) case T_layers: { - int layerMask = parseBoardItemLayersAsMask(); + LAYER_MSK layerMask = parseBoardItemLayersAsMask(); pad->SetLayerMask( layerMask ); } break; @@ -2324,9 +2325,9 @@ SEGVIA* PCB_PARSER::parseSEGVIA() throw( IO_ERROR, PARSE_ERROR ) { int layer1, layer2; NextTok(); - layer1 = lookUpLayer( m_layerIndices ); + layer1 = lookUpLayer( m_layerIndices ); NextTok(); - layer2 = lookUpLayer( m_layerIndices ); + layer2 = lookUpLayer( m_layerIndices ); via->SetLayerPair( layer1, layer2 ); NeedRIGHT(); } diff --git a/pcbnew/pcb_parser.h b/pcbnew/pcb_parser.h index 78071fdfac..e1f89e839e 100644 --- a/pcbnew/pcb_parser.h +++ b/pcbnew/pcb_parser.h @@ -58,11 +58,12 @@ class FPL_CACHE; */ class PCB_PARSER : public PCB_LEXER { - typedef KEYWORD_MAP LAYER_MAP; + typedef boost::unordered_map< std::string, int > LAYER_NUM_MAP; + typedef boost::unordered_map< std::string, LAYER_MSK > LAYER_MSK_MAP; BOARD* m_board; - LAYER_MAP m_layerIndices; ///< map layer name to it's index - LAYER_MAP m_layerMasks; ///< map layer names to their masks + LAYER_NUM_MAP m_layerIndices; ///< map layer name to it's index + LAYER_MSK_MAP m_layerMasks; ///< map layer names to their masks /** @@ -99,13 +100,14 @@ class PCB_PARSER : public PCB_LEXER * Function lookUpLayer * parses the current token for the layer definition of a #BOARD_ITEM object. * - * @param aMap is the LAYER_MAP to use for the lookup. + * @param aMap is the LAYER_{NUM|MSK}_MAP to use for the lookup. * * @throw IO_ERROR if the layer is not valid. * @throw PARSE_ERROR if the layer syntax is incorrect. * @return int - The result of the parsed #BOARD_ITEM layer or set designator. */ - int lookUpLayer( const LAYER_MAP& aMap ) throw( PARSE_ERROR, IO_ERROR ); + template + T lookUpLayer( const M& aMap ) throw( PARSE_ERROR, IO_ERROR ); /** * Function parseBoardItemLayer @@ -125,7 +127,7 @@ class PCB_PARSER : public PCB_LEXER * @throw PARSE_ERROR if the layers syntax is incorrect. * @return The mask of layers the parsed #BOARD_ITEM is on. */ - int parseBoardItemLayersAsMask() throw( PARSE_ERROR, IO_ERROR ); + LAYER_MSK parseBoardItemLayersAsMask() throw( PARSE_ERROR, IO_ERROR ); /** * Function parseXY diff --git a/pcbnew/pcb_plot_params.h b/pcbnew/pcb_plot_params.h index 77d5890788..737032bbbb 100644 --- a/pcbnew/pcb_plot_params.h +++ b/pcbnew/pcb_plot_params.h @@ -27,6 +27,7 @@ #include #include // EDA_DRAW_MODE_T #include +#include class PCB_PLOT_PARAMS; class LINE_READER; @@ -115,7 +116,7 @@ private: bool m_excludeEdgeLayer; /// Set of layers to plot - long m_layerSelection; + LAYER_MSK m_layerSelection; /** When plotting gerbers use a conventional set of extensions instead of * appending a suffix to the board name */ diff --git a/pcbnew/pcbnew.h b/pcbnew/pcbnew.h index 0cbe3b0694..aeeb6a9a61 100644 --- a/pcbnew/pcbnew.h +++ b/pcbnew/pcbnew.h @@ -9,6 +9,7 @@ #include // wxWidgets include. #include // IS_DRAGGED and IN_EDIT definitions. #include // to define DMils2iu() conversion function +#include // Arcs are approximated by segments: define the number of segments per 360 deg (KiCad uses 0.1 // deg approximation). Be aware 3600 / ARC_APPROX_SEGMENTS_COUNT_LOW_DEF is an integer. diff --git a/pcbnew/pcbplot.cpp b/pcbnew/pcbplot.cpp index 5e374cf8e4..503e44f31e 100644 --- a/pcbnew/pcbplot.cpp +++ b/pcbnew/pcbplot.cpp @@ -255,11 +255,9 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) // Save the current plot options in the board m_parent->SetPlotSettings( m_plotOpts ); - long layerMask = 1; - - for( layer = 0; layer < NB_LAYERS; layer++, layerMask <<= 1 ) + for( layer = 0; layer < NB_LAYERS; ++layer ) { - if( m_plotOpts.GetLayerSelection() & layerMask ) + if( m_plotOpts.GetLayerSelection() & GetLayerMask( layer ) ) { // Pick the basename from the board file wxFileName fn( boardFilename ); diff --git a/pcbnew/pcbplot.h b/pcbnew/pcbplot.h index 0c89c03bf0..a4e71ee323 100644 --- a/pcbnew/pcbplot.h +++ b/pcbnew/pcbplot.h @@ -32,6 +32,7 @@ #include #include #include +#include class PLOTTER; class TEXTE_PCB; @@ -199,7 +200,7 @@ void PlotOneBoardLayer( BOARD* aBoard, PLOTTER* aPlotter, int aLayer, * SetDrillMarksType( DrillMarksType aVal ) controle the actual hole: * no hole, small hole, actual hole */ -void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, long aLayerMask, +void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LAYER_MSK aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt ); /** @@ -211,7 +212,7 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, long aLayerMask, * @param aLayerMask = the mask to define the layers to plot (silkscreen Front and/or Back) * @param aPlotOpt = the plot options (files, sketch). Has meaning for some formats only */ -void PlotSilkScreen( BOARD* aBoard, PLOTTER* aPlotter, long aLayerMask, +void PlotSilkScreen( BOARD* aBoard, PLOTTER* aPlotter, LAYER_MSK aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt ); diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index ae54ca70c0..8e9ec9ad72 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -67,7 +67,7 @@ static void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, * Silkscreen layers have specific requirement for pads (not filled) and texts * (with option to remove them from some copper areas (pads...) */ -void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask, +void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, LAYER_MSK aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt ) { BRDITEMS_PLOTTER itemplotter( aPlotter, aBoard, aPlotOpt ); @@ -93,7 +93,7 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask, for( D_PAD * pad = Module->Pads(); pad != NULL; pad = pad->Next() ) { // See if the pad is on this layer - int masklayer = pad->GetLayerMask(); + LAYER_MSK masklayer = pad->GetLayerMask(); if( (masklayer & layersmask_plotpads) == 0 ) continue; @@ -124,7 +124,7 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask, { ZONE_CONTAINER* edge_zone = aBoard->GetArea( ii ); - if( ( ( 1 << edge_zone->GetLayer() ) & aLayerMask ) == 0 ) + if( ( GetLayerMask( edge_zone->GetLayer() ) & aLayerMask ) == 0 ) continue; itemplotter.PlotFilledAreas( edge_zone ); @@ -134,7 +134,7 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask, // compatibility): for( SEGZONE* seg = aBoard->m_Zone; seg != NULL; seg = seg->Next() ) { - if( ( ( 1 << seg->GetLayer() ) & aLayerMask ) == 0 ) + if( ( GetLayerMask( seg->GetLayer() ) & aLayerMask ) == 0 ) continue; aPlotter->ThickSegment( seg->GetStart(), seg->GetEnd(), seg->GetWidth(), @@ -154,7 +154,7 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, int aLayer, // Specify that the contents of the "Edges Pcb" layer are to be plotted // in addition to the contents of the currently specified layer. - int layer_mask = GetLayerMask( aLayer ); + LAYER_MSK layer_mask = GetLayerMask( aLayer ); if( !aPlotOpt.GetExcludeEdgeLayer() ) layer_mask |= EDGE_LAYER; @@ -240,7 +240,7 @@ void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, int aLayer, * Silk screen layers are not plotted here. */ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, - long aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt ) + LAYER_MSK aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt ) { BRDITEMS_PLOTTER itemplotter( aPlotter, aBoard, aPlotOpt ); @@ -367,7 +367,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, // vias are not plotted if not on selected layer, but if layer // is SOLDERMASK_LAYER_BACK or SOLDERMASK_LAYER_FRONT,vias are drawn, // only if they are on the corresponding external copper layer - int via_mask_layer = Via->ReturnMaskLayer(); + int via_mask_layer = Via->GetLayerMask(); if( aPlotOpt.GetPlotViaOnMaskLayer() ) { @@ -435,7 +435,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter, { ZONE_CONTAINER* zone = aBoard->GetArea( ii ); - if( ( ( 1 << zone->GetLayer() ) & aLayerMask ) == 0 ) + if( ( GetLayerMask(zone->GetLayer() ) & aLayerMask ) == 0 ) continue; itemplotter.PlotFilledAreas( zone ); @@ -580,7 +580,7 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, // vias are plotted only if they are on the corresponding // external copper layer - int via_mask_layer = via->ReturnMaskLayer(); + LAYER_MSK via_mask_layer = via->GetLayerMask(); if( via_mask_layer & LAYER_BACK ) via_mask_layer |= SOLDERMASK_LAYER_BACK; diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index d2d9091a9d..a549acde42 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -112,7 +112,7 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule ) if( textLayer >= LAYER_COUNT ) return false; - if( ( ( 1 << textLayer ) & m_layerMask ) == 0 ) + if( ( GetLayerMask( textLayer ) & m_layerMask ) == 0 ) trace_ref = false; if( !textModule->IsVisible() && !GetPlotInvisibleText() ) @@ -124,7 +124,7 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule ) if( textLayer > LAYER_COUNT ) return false; - if( ( (1 << textLayer) & m_layerMask ) == 0 ) + if( ( GetLayerMask( textLayer ) & m_layerMask ) == 0 ) trace_val = false; if( !textModule->IsVisible() && !GetPlotInvisibleText() ) @@ -164,7 +164,7 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule ) if( textLayer >= LAYER_COUNT ) return false; - if( !( ( 1 << textLayer ) & m_layerMask ) ) + if( !( GetLayerMask( textLayer ) & m_layerMask ) ) continue; PlotTextModule( textModule, getColor( textLayer ) ); diff --git a/pcbnew/print_board_functions.cpp b/pcbnew/print_board_functions.cpp index 8c27dbba4b..09c4a3f9d0 100644 --- a/pcbnew/print_board_functions.cpp +++ b/pcbnew/print_board_functions.cpp @@ -45,11 +45,11 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule, - GR_DRAWMODE aDraw_mode, int aMasklayer, + GR_DRAWMODE aDraw_mode, LAYER_MSK aMasklayer, PRINT_PARAMETERS::DrillShapeOptT aDrillShapeOpt ); void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC, - int aPrintMaskLayer, + LAYER_MSK aPrintMaskLayer, bool aPrintMirrorMode, void * aData) { @@ -131,7 +131,7 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC, * @param aData = a pointer to an optional data (NULL if not used) */ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, - int aPrintMaskLayer, + LAYER_MSK aPrintMaskLayer, bool aPrintMirrorMode, void* aData) { @@ -176,7 +176,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, for(int kk = 0; kk < 32; kk ++ ) { - if( ((1 << kk) & aPrintMaskLayer) != 0 ) + if( GetLayerMask( kk ) & aPrintMaskLayer ) { GetScreen()->m_Active_Layer = kk; break; @@ -232,10 +232,8 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, case PCB_DIMENSION_T: case PCB_TEXT_T: case PCB_TARGET_T: - if( ( ( 1 << item->GetLayer() ) & aPrintMaskLayer ) == 0 ) - break; - - item->Draw( m_canvas, aDC, drawmode ); + if( GetLayerMask( item->GetLayer() ) & aPrintMaskLayer ) + item->Draw( m_canvas, aDC, drawmode ); break; case PCB_MARKER_T: @@ -247,7 +245,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, // Print tracks for( TRACK * track = Pcb->m_Track; track; track = track->Next() ) { - if( ( aPrintMaskLayer & track->ReturnMaskLayer() ) == 0 ) + if( !( aPrintMaskLayer & track->GetLayerMask() ) ) continue; if( track->Type() == PCB_VIA_T ) // VIA encountered. @@ -270,7 +268,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, // Outdated: only for compatibility to old boards for( TRACK * track = Pcb->m_Zone; track != NULL; track = track->Next() ) { - if( ( aPrintMaskLayer & track->ReturnMaskLayer() ) == 0 ) + if( !( aPrintMaskLayer & track->GetLayerMask() ) ) continue; track->Draw( m_canvas, aDC, drawmode ); @@ -281,9 +279,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, { ZONE_CONTAINER* zone = Pcb->GetArea( ii ); - if( ( aPrintMaskLayer & ( 1 << zone->GetLayer() ) ) == 0 ) - continue; - + if( aPrintMaskLayer & GetLayerMask( zone->GetLayer() ) ) zone->DrawFilledArea( m_canvas, aDC, drawmode ); } @@ -312,7 +308,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, for( ; track != NULL; track = track->Next() ) { - if( ( aPrintMaskLayer & track->ReturnMaskLayer() ) == 0 ) + if( !( aPrintMaskLayer & track->GetLayerMask() ) ) continue; if( track->Type() == PCB_VIA_T ) // VIA encountered. @@ -350,13 +346,13 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule, - GR_DRAWMODE aDraw_mode, int aMasklayer, + GR_DRAWMODE aDraw_mode, LAYER_MSK aMasklayer, PRINT_PARAMETERS::DrillShapeOptT aDrillShapeOpt ) { // Print pads for( D_PAD* pad = aModule->Pads(); pad; pad = pad->Next() ) { - if( (pad->GetLayerMask() & aMasklayer ) == 0 ) + if( !(pad->GetLayerMask() & aMasklayer ) ) continue; // Manage hole according to the print drill option @@ -387,7 +383,7 @@ static void Print_Module( EDA_DRAW_PANEL* aPanel, wxDC* aDC, MODULE* aModule, } // Print footprint graphic shapes - int mlayer = GetLayerMask( aModule->GetLayer() ); + LAYER_MSK mlayer = GetLayerMask( aModule->GetLayer() ); if( aModule->GetLayer() == LAYER_N_BACK ) mlayer = SILKSCREEN_LAYER_BACK; diff --git a/pcbnew/printout_controler.cpp b/pcbnew/printout_controler.cpp index f3c040be05..74fd538310 100644 --- a/pcbnew/printout_controler.cpp +++ b/pcbnew/printout_controler.cpp @@ -95,7 +95,7 @@ bool BOARD_PRINTOUT_CONTROLLER::OnPrintPage( int aPage ) int layers_count = LAYER_COUNT; #endif - int mask_layer = m_PrintParams.m_PrintMaskLayer; + LAYER_MSK mask_layer = m_PrintParams.m_PrintMaskLayer; // compute layer mask from page number if we want one page per layer if( m_PrintParams.m_OptionPrintPage == 0 ) // One page per layer diff --git a/pcbnew/printout_controler.h b/pcbnew/printout_controler.h index e7a2f1a1dd..a31ccad559 100644 --- a/pcbnew/printout_controler.h +++ b/pcbnew/printout_controler.h @@ -33,7 +33,7 @@ #include - +#include #define DEFAULT_ORIENTATION_PAPER wxLANDSCAPE // other option is wxPORTRAIT @@ -51,7 +51,7 @@ public: double m_XScaleAdjust; // fine scale adjust for X axis double m_YScaleAdjust; // fine scale adjust for Y axis bool m_Print_Sheet_Ref; // Option: print page references - long m_PrintMaskLayer; // Layers to print + LAYER_MSK m_PrintMaskLayer; // Layers to print bool m_PrintMirror; // Option: Print mirrored bool m_Print_Black_and_White; // Option: Print in B&W or Color int m_OptionPrintPage; // Option: 0 = a layer per page, 1 = all layers at once diff --git a/pcbnew/protos.h b/pcbnew/protos.h index 7a76739260..0ae8f2e77b 100644 --- a/pcbnew/protos.h +++ b/pcbnew/protos.h @@ -56,7 +56,7 @@ void DrawTraces( EDA_DRAW_PANEL* panel, * calculates the mask layer when flipping a footprint. * BACK and FRONT copper layers , mask, paste, solder layers are swapped. */ -int ChangeSideMaskLayer( int aMask ); +LAYER_MSK ChangeSideMaskLayer( LAYER_MSK aMask ); void DrawModuleOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* module ); diff --git a/pcbnew/sel_layer.cpp b/pcbnew/sel_layer.cpp index 990e56424f..d1e739ebe9 100644 --- a/pcbnew/sel_layer.cpp +++ b/pcbnew/sel_layer.cpp @@ -107,8 +107,8 @@ SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( PCB_BASE_FRAME* parent, /* Build the layer list */ LayerCount = 0; - int Masque_Layer = g_TabAllCopperLayerMask[board->GetCopperLayerCount() - 1]; - Masque_Layer += ALL_NO_CU_LAYERS; + LAYER_MSK Masque_Layer = g_TabAllCopperLayerMask[board->GetCopperLayerCount() - 1]; + Masque_Layer |= ALL_NO_CU_LAYERS; for( ii = 0; ii < NB_LAYERS; ii++ ) { @@ -262,8 +262,8 @@ SELECT_LAYERS_PAIR_DIALOG::SELECT_LAYERS_PAIR_DIALOG( PCB_BASE_FRAME* parent ) : m_Parent = parent; PCB_SCREEN* screen = (PCB_SCREEN*) m_Parent->GetScreen(); - int Masque_Layer = g_TabAllCopperLayerMask[board->GetCopperLayerCount() - 1]; - Masque_Layer += ALL_NO_CU_LAYERS; + LAYER_MSK Masque_Layer = g_TabAllCopperLayerMask[board->GetCopperLayerCount() - 1]; + Masque_Layer |= ALL_NO_CU_LAYERS; for( ii = 0, LayerCount = 0; ii < NB_COPPER_LAYERS; ii++ ) { diff --git a/pcbnew/tr_modif.cpp b/pcbnew/tr_modif.cpp index 3a042ae2da..11fa841a96 100644 --- a/pcbnew/tr_modif.cpp +++ b/pcbnew/tr_modif.cpp @@ -70,7 +70,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC, int ii, jj, nb_segm, nbconnect; wxPoint start; wxPoint end; - int startmasklayer, endmasklayer; + LAYER_MSK startmasklayer, endmasklayer; int netcode = aNewTrack->GetNet(); @@ -135,14 +135,14 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC, return 0; // Determine layers interconnected these points. - startmasklayer = StartTrack->ReturnMaskLayer(); - endmasklayer = EndTrack->ReturnMaskLayer(); + startmasklayer = StartTrack->GetLayerMask(); + endmasklayer = EndTrack->GetLayerMask(); // There may be a via or a pad on the end points. pt_segm = m_Pcb->m_Track->GetVia( NULL, start, startmasklayer ); if( pt_segm ) - startmasklayer |= pt_segm->ReturnMaskLayer(); + startmasklayer |= pt_segm->GetLayerMask(); if( StartTrack->start && ( StartTrack->start->Type() == PCB_PAD_T ) ) { @@ -154,7 +154,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC, pt_segm = m_Pcb->m_Track->GetVia( NULL, end, endmasklayer ); if( pt_segm ) - endmasklayer |= pt_segm->ReturnMaskLayer(); + endmasklayer |= pt_segm->GetLayerMask(); if( EndTrack->end && ( EndTrack->end->Type() == PCB_PAD_T ) ) { diff --git a/pcbnew/tracepcb.cpp b/pcbnew/tracepcb.cpp index fb62fec1c1..3df519dfea 100644 --- a/pcbnew/tracepcb.cpp +++ b/pcbnew/tracepcb.cpp @@ -55,7 +55,7 @@ * The pads must appear on the layers selected in LayerMask */ static void Trace_Pads_Only( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* Module, - int ox, int oy, int LayerMask, GR_DRAWMODE draw_mode ); + int ox, int oy, LAYER_MSK LayerMask, GR_DRAWMODE draw_mode ); void FOOTPRINT_EDIT_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg ) @@ -199,7 +199,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC, GR_DRAWMODE aDrawMode, const for( MODULE* module = m_Modules; module; module = module->Next() ) { bool display = true; - int layerMask = ALL_CU_LAYERS; + LAYER_MSK layerMask = ALL_CU_LAYERS; if( module->IsMoving() ) continue; @@ -286,7 +286,7 @@ void BOARD::DrawHighLight( EDA_DRAW_PANEL* am_canvas, wxDC* DC, int aNetCode ) * The pads must appear on the layers selected in LayerMask */ static void Trace_Pads_Only( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* aModule, - int ox, int oy, int aLayerMask, GR_DRAWMODE draw_mode ) + int ox, int oy, LAYER_MSK aLayerMask, GR_DRAWMODE draw_mode ) { PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) panel->GetParent(); diff --git a/polygon/PolyLine.h b/polygon/PolyLine.h index 98273d3769..39368bf003 100644 --- a/polygon/PolyLine.h +++ b/polygon/PolyLine.h @@ -19,7 +19,7 @@ #include #include // for wxPoint definition - +#include #include class CRect From c650c378c07e3177aa6340a24c8fae6213407015 Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Sat, 30 Mar 2013 18:49:58 +0100 Subject: [PATCH 24/63] Fixed the logic for "do you want to make the footprint visible" requester (meaning was inverted) --- eeschema/backanno.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/eeschema/backanno.cpp b/eeschema/backanno.cpp index 2ca9608ae9..2292301d6c 100644 --- a/eeschema/backanno.cpp +++ b/eeschema/backanno.cpp @@ -122,10 +122,8 @@ bool SCH_EDIT_FRAME::ProcessCmpToFootprintLinkFile( wxString& aFullFilename, if( aForceFieldsVisibleAttribute ) { - if( aFieldsVisibleAttributeState ) - component->GetField( FOOTPRINT )->SetVisible( false ); - else - component->GetField( FOOTPRINT )->SetVisible( true ); + component->GetField( FOOTPRINT ) + ->SetVisible( aFieldsVisibleAttributeState ); } } } From 27ee815742c307246ba6a98797f2166daed7566b Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Sat, 30 Mar 2013 20:55:26 +0100 Subject: [PATCH 25/63] Minor flags and layer mask cleanup --- common/base_struct.cpp | 2 +- common/copy_to_clipboard.cpp | 3 +-- common/pcbcommon.cpp | 27 ----------------------- eeschema/lib_pin.cpp | 12 +++++----- eeschema/onrightclick.cpp | 3 +-- eeschema/sch_bitmap.cpp | 4 ++-- eeschema/sch_component.cpp | 4 ++-- eeschema/sch_junction.cpp | 4 ++-- eeschema/sch_line.cpp | 14 ++++++------ eeschema/sch_marker.cpp | 4 ++-- eeschema/sch_no_connect.cpp | 4 ++-- eeschema/sch_sheet.cpp | 4 ++-- eeschema/sch_text.cpp | 6 ++--- gerbview/class_gbr_layout.cpp | 2 +- gerbview/class_gerber_draw_item.cpp | 2 +- include/layers_id_colors_and_visibility.h | 1 + pcbnew/legacy_plugin.cpp | 4 ++-- 17 files changed, 35 insertions(+), 65 deletions(-) diff --git a/common/base_struct.cpp b/common/base_struct.cpp index 3b9cb8d3e6..37969c81fe 100644 --- a/common/base_struct.cpp +++ b/common/base_struct.cpp @@ -90,7 +90,7 @@ void EDA_ITEM::InitVars() void EDA_ITEM::SetModified() { - m_Flags |= IS_CHANGED; + SetFlags( IS_CHANGED ); // If this a child object, then the parent modification state also needs to be set. if( m_Parent ) diff --git a/common/copy_to_clipboard.cpp b/common/copy_to_clipboard.cpp index 973768033f..95ff829288 100644 --- a/common/copy_to_clipboard.cpp +++ b/common/copy_to_clipboard.cpp @@ -109,8 +109,7 @@ bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame ) dc.SetClippingRegion( DrawArea ); } - const int maskLayer = 0xFFFFFFFF; - aFrame->PrintPage( &dc, maskLayer, false ); + aFrame->PrintPage( &dc, FULL_LAYERS, false ); screen->m_IsPrinting = false; aFrame->GetCanvas()->SetClipBox( tmp ); wxMetafile* mf = dc.Close(); diff --git a/common/pcbcommon.cpp b/common/pcbcommon.cpp index 58441b01c5..70b8473508 100644 --- a/common/pcbcommon.cpp +++ b/common/pcbcommon.cpp @@ -42,33 +42,6 @@ class MODULE; -/* return a one bit layer mask from a layer number - * aLayerNumber = the layer number to convert (0 .. LAYER_COUNT-1) - */ -int GetLayerMask( int aLayerNumber ) -{ - wxASSERT( aLayerNumber < LAYER_COUNT && aLayerNumber >= 0 ); - -#if 0 - // Look up Table for conversion one layer number -> one bit layer mask: - static int tabOneLayerMask[LAYER_COUNT] = - { - 0x00000001, 0x00000002, 0x00000004, 0x00000008, - 0x00000010, 0x00000020, 0x00000040, 0x00000080, - 0x00000100, 0x00000200, 0x00000400, 0x00000800, - 0x00001000, 0x00002000, 0x00004000, 0x00008000, - 0x00010000, 0x00020000, 0x00040000, 0x00080000, - 0x00100000, 0x00200000, 0x00400000, 0x00800000, - 0x01000000, 0x02000000, 0x04000000, 0x08000000, - 0x10000000, 0x20000000, 0x40000000, 0x80000000 - }; - - return( tabOneLayerMask[aLayerNumber] ); -#else - return 1 << aLayerNumber; -#endif -} - /* Look up Table for conversion copper layer count -> general copper layer * mask: */ LAYER_MSK g_TabAllCopperLayerMask[NB_COPPER_LAYERS] = { diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index 9f8848a244..a7e636c020 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -262,9 +262,7 @@ void LIB_PIN::SetNumber( const wxString& number ) SetPinNumFromString( tmp ); if( m_number != oldNumber ) - { - m_Flags |= IS_CHANGED; - } + SetFlags( IS_CHANGED ); /* Others pin numbers marked by EnableEditMode() are not modified * because each pin has its own number @@ -437,7 +435,7 @@ void LIB_PIN::SetConversion( int style ) return; m_Convert = style; - m_Flags |= IS_CHANGED; + SetFlags( IS_CHANGED ); if( style == 0 ) { @@ -514,9 +512,9 @@ void LIB_PIN::EnableEditMode( bool enable, bool editPinByPin ) && !IsNew() && editPinByPin == false && enable ) - pinList[i]->m_Flags |= IS_LINKED | IN_EDIT; + pinList[i]->SetFlags( IS_LINKED | IN_EDIT ); else - pinList[i]->m_Flags &= ~( IS_LINKED | IN_EDIT ); + pinList[i]->ClearFlags( IS_LINKED | IN_EDIT ); } } @@ -650,7 +648,7 @@ bool LIB_PIN::Save( OUTPUTFORMATTER& aFormatter ) if( aFormatter.Print( 0, "\n" ) < 0 ) return false; - m_Flags &= ~IS_CHANGED; + ClearFlags( IS_CHANGED ); return true; } diff --git a/eeschema/onrightclick.cpp b/eeschema/onrightclick.cpp index cb2669f975..9f59ce816f 100644 --- a/eeschema/onrightclick.cpp +++ b/eeschema/onrightclick.cpp @@ -205,8 +205,7 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) return true; } - int flags = item->GetFlags(); - bool is_new = (flags & IS_NEW) ? true : false; + bool is_new = item->IsNew(); switch( item->Type() ) { diff --git a/eeschema/sch_bitmap.cpp b/eeschema/sch_bitmap.cpp index 49a4a1c9ec..7cce2b7d3b 100644 --- a/eeschema/sch_bitmap.cpp +++ b/eeschema/sch_bitmap.cpp @@ -255,9 +255,9 @@ bool SCH_BITMAP::IsSelectStateChanged( const wxRect& aRect ) bool previousState = IsSelected(); if( aRect.Contains( m_Pos ) ) - m_Flags |= SELECTED; + SetFlags( SELECTED ); else - m_Flags &= ~SELECTED; + ClearFlags( SELECTED ); return previousState != IsSelected(); } diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index 2cfe36af41..c6efcda0dd 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -1607,9 +1607,9 @@ bool SCH_COMPONENT::IsSelectStateChanged( const wxRect& aRect ) EDA_RECT boundingBox = GetBoundingBox(); if( aRect.Intersects( boundingBox ) ) - m_Flags |= SELECTED; + SetFlags( SELECTED ); else - m_Flags &= ~SELECTED; + ClearFlags( SELECTED ); return previousState != IsSelected(); } diff --git a/eeschema/sch_junction.cpp b/eeschema/sch_junction.cpp index 07c81f3cac..4e715aa247 100644 --- a/eeschema/sch_junction.cpp +++ b/eeschema/sch_junction.cpp @@ -168,9 +168,9 @@ bool SCH_JUNCTION::IsSelectStateChanged( const wxRect& aRect ) bool previousState = IsSelected(); if( aRect.Contains( m_pos ) ) - m_Flags |= SELECTED; + SetFlags( SELECTED ); else - m_Flags &= ~SELECTED; + ClearFlags( SELECTED ); return previousState != IsSelected(); } diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp index c9d4bfdad5..7977e87770 100644 --- a/eeschema/sch_line.cpp +++ b/eeschema/sch_line.cpp @@ -436,22 +436,22 @@ bool SCH_LINE::IsSelectStateChanged( const wxRect& aRect ) if( aRect.Contains( m_start ) && aRect.Contains( m_end ) ) { - m_Flags |= SELECTED; - m_Flags &= ~(STARTPOINT | ENDPOINT); + SetFlags( SELECTED ); + ClearFlags( STARTPOINT | ENDPOINT ); } else if( aRect.Contains( m_start ) ) { - m_Flags &= ~STARTPOINT; - m_Flags |= ( SELECTED | ENDPOINT ); + ClearFlags( STARTPOINT ); + SetFlags( SELECTED | ENDPOINT ); } else if( aRect.Contains( m_end ) ) { - m_Flags &= ~ENDPOINT; - m_Flags |= ( SELECTED | STARTPOINT ); + ClearFlags( ENDPOINT ); + SetFlags( SELECTED | STARTPOINT ); } else { - m_Flags &= ~( SELECTED | STARTPOINT | ENDPOINT ); + ClearFlags( SELECTED | STARTPOINT | ENDPOINT ); } return previousState != IsSelected(); diff --git a/eeschema/sch_marker.cpp b/eeschema/sch_marker.cpp index c6a6354edb..c559c7449c 100644 --- a/eeschema/sch_marker.cpp +++ b/eeschema/sch_marker.cpp @@ -193,9 +193,9 @@ bool SCH_MARKER::IsSelectStateChanged( const wxRect& aRect ) bool previousState = IsSelected(); if( aRect.Contains( m_Pos ) ) - m_Flags |= SELECTED; + SetFlags( SELECTED ); else - m_Flags &= ~SELECTED; + ClearFlags( SELECTED ); return previousState != IsSelected(); } diff --git a/eeschema/sch_no_connect.cpp b/eeschema/sch_no_connect.cpp index 4d88f7824f..d375f842d1 100644 --- a/eeschema/sch_no_connect.cpp +++ b/eeschema/sch_no_connect.cpp @@ -174,9 +174,9 @@ bool SCH_NO_CONNECT::IsSelectStateChanged( const wxRect& aRect ) bool previousState = IsSelected(); if( aRect.Contains( m_pos ) ) - m_Flags |= SELECTED; + SetFlags( SELECTED ); else - m_Flags &= ~SELECTED; + ClearFlags( SELECTED ); return previousState != IsSelected(); } diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index ba9ad92b4f..9335ce4eca 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -992,9 +992,9 @@ bool SCH_SHEET::IsSelectStateChanged( const wxRect& aRect ) EDA_RECT boundingBox = GetBoundingBox(); if( aRect.Intersects( boundingBox ) ) - m_Flags |= SELECTED; + SetFlags( SELECTED ); else - m_Flags &= ~SELECTED; + ClearFlags( SELECTED ); return previousState != IsSelected(); } diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index 7cfa12c7fa..3cdf203175 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -543,7 +543,7 @@ bool SCH_TEXT::IsDanglingStateChanged( std::vector< DANGLING_END_ITEM >& aItemLi break; } - if( m_isDangling == false ) + if( !m_isDangling ) break; } @@ -556,9 +556,9 @@ bool SCH_TEXT::IsSelectStateChanged( const wxRect& aRect ) bool previousState = IsSelected(); if( aRect.Contains( m_Pos ) ) - m_Flags |= SELECTED; + SetFlags( SELECTED ); else - m_Flags &= ~SELECTED; + SetFlags( SELECTED ); return previousState != IsSelected(); } diff --git a/gerbview/class_gbr_layout.cpp b/gerbview/class_gbr_layout.cpp index a503a03a98..abd461876a 100644 --- a/gerbview/class_gbr_layout.cpp +++ b/gerbview/class_gbr_layout.cpp @@ -14,7 +14,7 @@ GBR_LAYOUT::GBR_LAYOUT() { PAGE_INFO pageInfo( wxT( "GERBER" ) ); SetPageSettings( pageInfo ); - m_printLayersMask = -1; + m_printLayersMask = FULL_LAYERS; } diff --git a/gerbview/class_gerber_draw_item.cpp b/gerbview/class_gerber_draw_item.cpp index 1e80c9ebb2..f9fb900284 100644 --- a/gerbview/class_gerber_draw_item.cpp +++ b/gerbview/class_gerber_draw_item.cpp @@ -621,7 +621,7 @@ void GERBER_DRAW_ITEM::Show( int nestLevel, std::ostream& os ) const " layer=\"" << m_Layer << '"' << " size=\"" << m_Size << '"' << " flags=\"" << m_Flags << '"' << - " status=\"" << GetState( -1 ) << '"' << + " status=\"" << GetStatus() << '"' << "" << ""; diff --git a/include/layers_id_colors_and_visibility.h b/include/layers_id_colors_and_visibility.h index 70038f0299..f2e4da7c56 100644 --- a/include/layers_id_colors_and_visibility.h +++ b/include/layers_id_colors_and_visibility.h @@ -100,6 +100,7 @@ typedef unsigned LAYER_MSK; */ inline LAYER_MSK GetLayerMask( unsigned aLayerNumber ) { + wxASSERT( aLayerNumber < LAYER_COUNT && aLayerNumber >= 0 ); return 1 << aLayerNumber; } diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index fa681a52c0..3a945691a3 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -1730,7 +1730,7 @@ void LEGACY_PLUGIN::loadPCB_LINE() case 4: int state; state = hexParse( data ); - dseg->SetState( state, ON ); + dseg->SetState( state, true ); break; // Bezier Control Points @@ -2046,7 +2046,7 @@ void LEGACY_PLUGIN::loadTrackList( int aStructType ) } newTrack->SetNet( net_code ); - newTrack->SetState( flags, ON ); + newTrack->SetState( flags, true ); } THROW_IO_ERROR( "Missing '$EndTRACK'" ); From 29bf40dc96386e6310913bed4bf897b24dc68e83 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Sat, 30 Mar 2013 19:41:08 -0400 Subject: [PATCH 26/63] Fix build errors in layer mask changes. --- include/layers_id_colors_and_visibility.h | 28 ++++++++++++++++++++- pcbnew/pcad2kicadpcb_plugin/pcb_callbacks.h | 2 +- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/include/layers_id_colors_and_visibility.h b/include/layers_id_colors_and_visibility.h index f2e4da7c56..c6e703fa8f 100644 --- a/include/layers_id_colors_and_visibility.h +++ b/include/layers_id_colors_and_visibility.h @@ -1,11 +1,37 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2010 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2007 KiCad Developers, see change_log.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + /** * @file layers_id_colors_and_visibility.h - * @brief Classes and definitions used in Pcbnew. + * @brief Board layer functions and definitions. */ #ifndef _LAYERS_ID_AND_VISIBILITY_H_ #define _LAYERS_ID_AND_VISIBILITY_H_ +#include // wxASSERT + /* Layer identification (layer number) */ #define UNDEFINED_LAYER -1 #define FIRST_COPPER_LAYER 0 diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_callbacks.h b/pcbnew/pcad2kicadpcb_plugin/pcb_callbacks.h index 9d49ea3a3c..05b4837ee5 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_callbacks.h +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_callbacks.h @@ -31,7 +31,7 @@ #define PCB_CALLBACKS_H_ #include -#include "include/layers_id_colors_and_visibility.h" +#include enum LAYER_TYPE_T { From 8e0967943778dc661d6e802eef72da1a9fcc7c77 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 31 Mar 2013 14:44:23 +0200 Subject: [PATCH 27/63] Minor cosmetic fixes (mainly on Linux) in dialogs. --- .../dialogs/dialog_eeschema_config_fbp.cpp | 61 +- .../dialogs/dialog_eeschema_config_fbp.fbp | 2175 +++++++++++------ eeschema/dialogs/dialog_eeschema_config_fbp.h | 22 +- ...ialog_pcbnew_config_libs_and_paths_fbp.cpp | 10 +- ...ialog_pcbnew_config_libs_and_paths_fbp.fbp | 10 +- 5 files changed, 1475 insertions(+), 803 deletions(-) diff --git a/eeschema/dialogs/dialog_eeschema_config_fbp.cpp b/eeschema/dialogs/dialog_eeschema_config_fbp.cpp index 07980061e8..c13dbac92f 100644 --- a/eeschema/dialogs/dialog_eeschema_config_fbp.cpp +++ b/eeschema/dialogs/dialog_eeschema_config_fbp.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Sep 8 2010) +// C++ code generated with wxFormBuilder (version Oct 8 2012) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -16,14 +16,21 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind wxBoxSizer* bMainSizer; bMainSizer = new wxBoxSizer( wxVERTICAL ); - wxStaticBoxSizer* sbLibsChoiceSizer; - sbLibsChoiceSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Component library files") ), wxHORIZONTAL ); + wxBoxSizer* bSizerUpper; + bSizerUpper = new wxBoxSizer( wxVERTICAL ); + + m_staticTextLibsList = new wxStaticText( this, wxID_ANY, _("Component library files"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextLibsList->Wrap( -1 ); + bSizerUpper->Add( m_staticTextLibsList, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizerLibsChoice; + bSizerLibsChoice = new wxBoxSizer( wxHORIZONTAL ); m_ListLibr = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_EXTENDED|wxLB_HSCROLL|wxLB_NEEDED_SB|wxLB_SINGLE ); m_ListLibr->SetToolTip( _("List of active library files.\nOnly library files in this list are loaded by Eeschema.\nThe order of this list is important:\nEeschema searchs for a given component using this list order priority.") ); m_ListLibr->SetMinSize( wxSize( 400,250 ) ); - sbLibsChoiceSizer->Add( m_ListLibr, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bSizerLibsChoice->Add( m_ListLibr, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); wxBoxSizer* bRightSizer; bRightSizer = new wxBoxSizer( wxVERTICAL ); @@ -49,18 +56,30 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind m_buttonDown = new wxButton( this, wxID_ANY, _("Down"), wxDefaultPosition, wxDefaultSize, 0 ); bRightSizer->Add( m_buttonDown, 0, wxALL|wxEXPAND, 5 ); - sbLibsChoiceSizer->Add( bRightSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - bMainSizer->Add( sbLibsChoiceSizer, 2, wxALL|wxEXPAND, 5 ); + bSizerLibsChoice->Add( bRightSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - wxStaticBoxSizer* sbSizer4; - sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("User defined search path") ), wxHORIZONTAL ); + + bSizerUpper->Add( bSizerLibsChoice, 1, wxEXPAND, 5 ); + + + bMainSizer->Add( bSizerUpper, 2, wxEXPAND, 5 ); + + wxBoxSizer* bSizerMiddle; + bSizerMiddle = new wxBoxSizer( wxVERTICAL ); + + m_staticTextPaths = new wxStaticText( this, wxID_ANY, _("User defined search path"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextPaths->Wrap( -1 ); + bSizerMiddle->Add( m_staticTextPaths, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* bSizerPathsChoice; + bSizerPathsChoice = new wxBoxSizer( wxHORIZONTAL ); m_listUserPaths = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_HSCROLL|wxLB_NEEDED_SB|wxLB_SINGLE ); m_listUserPaths->SetToolTip( _("Additional paths used in this project. The priority is higher than default KiCad paths.") ); m_listUserPaths->SetMinSize( wxSize( 400,90 ) ); - sbSizer4->Add( m_listUserPaths, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bSizerPathsChoice->Add( m_listUserPaths, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); wxBoxSizer* bUserPathsButtonsSizer; bUserPathsButtonsSizer = new wxBoxSizer( wxVERTICAL ); @@ -74,19 +93,29 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind m_buttonRemovePath = new wxButton( this, wxID_REMOVE_PATH, _("Remove"), wxDefaultPosition, wxDefaultSize, 0 ); bUserPathsButtonsSizer->Add( m_buttonRemovePath, 0, wxALL|wxEXPAND, 5 ); - sbSizer4->Add( bUserPathsButtonsSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - bMainSizer->Add( sbSizer4, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bSizerPathsChoice->Add( bUserPathsButtonsSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - wxStaticBoxSizer* sbLibPathSizer; - sbLibPathSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Current search path list") ), wxVERTICAL ); + + bSizerMiddle->Add( bSizerPathsChoice, 1, wxEXPAND, 5 ); + + + bMainSizer->Add( bSizerMiddle, 1, wxEXPAND, 5 ); + + wxBoxSizer* bSizerLower; + bSizerLower = new wxBoxSizer( wxVERTICAL ); + + m_staticTextPathlist = new wxStaticText( this, wxID_ANY, _("Current search path list"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextPathlist->Wrap( -1 ); + bSizerLower->Add( m_staticTextPathlist, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_DefaultLibraryPathslistBox = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, wxLB_NEEDED_SB ); m_DefaultLibraryPathslistBox->SetToolTip( _("System and user paths used to search and load library files and component doc files.\nSorted by decreasing priority order.") ); - sbLibPathSizer->Add( m_DefaultLibraryPathslistBox, 1, wxALL|wxEXPAND, 5 ); + bSizerLower->Add( m_DefaultLibraryPathslistBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - bMainSizer->Add( sbLibPathSizer, 1, wxALL|wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + + bMainSizer->Add( bSizerLower, 1, wxEXPAND, 5 ); m_staticline3 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); bMainSizer->Add( m_staticline3, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); @@ -97,8 +126,10 @@ DIALOG_EESCHEMA_CONFIG_FBP::DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWind m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); m_sdbSizer1->Realize(); + bMainSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 5 ); + this->SetSizer( bMainSizer ); this->Layout(); bMainSizer->Fit( this ); diff --git a/eeschema/dialogs/dialog_eeschema_config_fbp.fbp b/eeschema/dialogs/dialog_eeschema_config_fbp.fbp index 95608e8ea9..1d538dd0c6 100644 --- a/eeschema/dialogs/dialog_eeschema_config_fbp.fbp +++ b/eeschema/dialogs/dialog_eeschema_config_fbp.fbp @@ -2,11 +2,13 @@ - + C++ 1 source_name + 0 0 + res UTF-8 connect dialog_eeschema_config_fbp @@ -14,763 +16,1371 @@ none 1 dialog_eeschema_config - + . - + 1 + 1 1 1 0 - + 0 + wxAUI_MGR_DEFAULT + wxBOTH - + 1 1 impl_virtual - - - + + + 0 wxID_ANY - - + + DIALOG_EESCHEMA_CONFIG_FBP - + -1,-1 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - - - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - + + + + + + + + + + + + + + + OnCloseWindow - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - + bMainSizer wxVERTICAL none 5 - wxALL|wxEXPAND + wxEXPAND 2 - - wxID_ANY - Component library files - - sbLibsChoiceSizer - wxHORIZONTAL - none - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 1 - - - - - 1 - 1 - - - 0 - wxID_ANY - - 400,250 - m_ListLibr - protected - - - wxLB_EXTENDED|wxLB_HSCROLL|wxLB_NEEDED_SB|wxLB_SINGLE - - List of active library files. Only library files in this list are loaded by Eeschema. The order of this list is important: Eeschema searchs for a given component using this list order priority. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - OnFilesListClick - OnFilesListClick - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - - bRightSizer - wxVERTICAL - none - - 5 - wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxTOP|wxEXPAND - 0 - - - - 1 - 0 - 1 - - - 0 - ID_ADD_LIB - Add - - - m_buttonAddLib - protected - - - - - Add a new library after the selected library, and load it - - wxFILTER_NONE - wxDefaultValidator - - - - - OnAddOrInsertLibClick - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxTOP|wxEXPAND - 0 - - - - 1 - 0 - 1 - - - 0 - wxID_ANY - Insert - - - m_buttonIns - protected - - - - - Add a new library before the selected library, and load it - - wxFILTER_NONE - wxDefaultValidator - - - - - OnAddOrInsertLibClick - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND - 0 - - - - 1 - 0 - 1 - - - 0 - ID_REMOVE_LIB - Remove - - - m_buttonRemoveLib - protected - - - - - Unload the selected library - - wxFILTER_NONE - wxDefaultValidator - - - - - OnRemoveLibClick - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 0 - - - - 1 - 0 - 1 - - - 0 - wxID_ANY - Up - - - m_buttonUp - protected - - - - - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnButtonUpClick - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - - - 1 - 0 - 1 - - - 0 - wxID_ANY - Down - - - m_buttonDown - protected - - - - - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnButtonDownClick - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 1 - - wxID_ANY - User defined search path - - sbSizer4 - wxHORIZONTAL - none - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 1 - - - - - 1 - 1 - - - 0 - wxID_ANY - - 400,90 - m_listUserPaths - protected - - - wxLB_HSCROLL|wxLB_NEEDED_SB|wxLB_SINGLE - - Additional paths used in this project. The priority is higher than default KiCad paths. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxALL - 0 - - - bUserPathsButtonsSizer - wxVERTICAL - none - - 5 - wxLEFT|wxRIGHT|wxTOP|wxEXPAND - 0 - - - - 1 - 0 - 1 - - - 0 - ID_LIB_PATH_SEL - Add - - - m_buttonAddPath - protected - - - - - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnAddOrInsertPath - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxLEFT|wxRIGHT|wxTOP|wxEXPAND - 0 - - - - 1 - 0 - 1 - - - 0 - wxID_INSERT_PATH - Insert - - - m_buttonInsPath - protected - - - - - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnAddOrInsertPath - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - - - 1 - 0 - 1 - - - 0 - wxID_REMOVE_PATH - Remove - - - m_buttonRemovePath - protected - - - - - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnRemoveUserPath - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT - 1 - - wxID_ANY - Current search path list - - sbLibPathSizer + + + bSizerUpper wxVERTICAL none - 5 - wxALL|wxEXPAND - 1 - - - - + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + 0 + Dock + 0 + Left 1 - - + + 1 + + 0 0 wxID_ANY - - -1,-1 - m_DefaultLibraryPathslistBox + Component library files + + 0 + + + 0 + + 1 + m_staticTextLibsList + 1 + + protected - - + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizerLibsChoice + wxHORIZONTAL + none + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + 400,250 + 1 + m_ListLibr + 1 + + + protected + 1 + + Resizable + 1 + + wxLB_EXTENDED|wxLB_HSCROLL|wxLB_NEEDED_SB|wxLB_SINGLE + + 0 + List of active library files. Only library files in this list are loaded by Eeschema. The order of this list is important: Eeschema searchs for a given component using this list order priority. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + OnFilesListClick + OnFilesListClick + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + + bRightSizer + wxVERTICAL + none + + 5 + wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxTOP|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_ADD_LIB + Add + + 0 + + + 0 + + 1 + m_buttonAddLib + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Add a new library after the selected library, and load it + + wxFILTER_NONE + wxDefaultValidator + + + + + OnAddOrInsertLibClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxTOP|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Insert + + 0 + + + 0 + + 1 + m_buttonIns + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Add a new library before the selected library, and load it + + wxFILTER_NONE + wxDefaultValidator + + + + + OnAddOrInsertLibClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_REMOVE_LIB + Remove + + 0 + + + 0 + + 1 + m_buttonRemoveLib + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Unload the selected library + + wxFILTER_NONE + wxDefaultValidator + + + + + OnRemoveLibClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Up + + 0 + + + 0 + + 1 + m_buttonUp + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnButtonUpClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Down + + 0 + + + 0 + + 1 + m_buttonDown + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnButtonDownClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizerMiddle + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + User defined search path + + 0 + + + 0 + + 1 + m_staticTextPaths + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizerPathsChoice + wxHORIZONTAL + none + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + 400,90 + 1 + m_listUserPaths + 1 + + + protected + 1 + + Resizable + 1 + + wxLB_HSCROLL|wxLB_NEEDED_SB|wxLB_SINGLE + + 0 + Additional paths used in this project. The priority is higher than default KiCad paths. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + + bUserPathsButtonsSizer + wxVERTICAL + none + + 5 + wxLEFT|wxRIGHT|wxTOP|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_LIB_PATH_SEL + Add + + 0 + + + 0 + + 1 + m_buttonAddPath + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnAddOrInsertPath + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxLEFT|wxRIGHT|wxTOP|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_INSERT_PATH + Insert + + 0 + + + 0 + + 1 + m_buttonInsPath + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnAddOrInsertPath + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_REMOVE_PATH + Remove + + 0 + + + 0 + + 1 + m_buttonRemovePath + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnRemoveUserPath + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizerLower + wxVERTICAL + none + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Current search path list + + 0 + + + 0 + + 1 + m_staticTextPathlist + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + -1,-1 + 1 + m_DefaultLibraryPathslistBox + 1 + + + protected + 1 + + Resizable + 1 + wxLB_NEEDED_SB - + + 0 System and user paths used to search and load library files and component doc files. Sorted by decreasing priority order. - + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -780,53 +1390,80 @@ wxEXPAND|wxRIGHT|wxLEFT 0 - - + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + 0 + Dock + 0 + Left 1 - - + + 1 + + 0 0 wxID_ANY - - + + 0 + + + 0 + + 1 m_staticline3 + 1 + + protected - - + 1 + + Resizable + 1 + wxLI_HORIZONTAL - - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -842,17 +1479,17 @@ 1 0 0 - + m_sdbSizer1 public - + OnCancelClick - - - + + + OnOkClick - - + + diff --git a/eeschema/dialogs/dialog_eeschema_config_fbp.h b/eeschema/dialogs/dialog_eeschema_config_fbp.h index cfe10c54b1..f005bffc27 100644 --- a/eeschema/dialogs/dialog_eeschema_config_fbp.h +++ b/eeschema/dialogs/dialog_eeschema_config_fbp.h @@ -1,24 +1,25 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Sep 8 2010) +// C++ code generated with wxFormBuilder (version Oct 8 2012) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// -#ifndef __dialog_eeschema_config_fbp__ -#define __dialog_eeschema_config_fbp__ +#ifndef __DIALOG_EESCHEMA_CONFIG_FBP_H__ +#define __DIALOG_EESCHEMA_CONFIG_FBP_H__ +#include +#include #include - #include -#include +#include #include #include #include #include +#include #include #include -#include #include #include @@ -38,19 +39,22 @@ class DIALOG_EESCHEMA_CONFIG_FBP : public wxDialog ID_REMOVE_LIB, ID_LIB_PATH_SEL, wxID_INSERT_PATH, - wxID_REMOVE_PATH, + wxID_REMOVE_PATH }; + wxStaticText* m_staticTextLibsList; wxListBox* m_ListLibr; wxButton* m_buttonAddLib; wxButton* m_buttonIns; wxButton* m_buttonRemoveLib; wxButton* m_buttonUp; wxButton* m_buttonDown; + wxStaticText* m_staticTextPaths; wxListBox* m_listUserPaths; wxButton* m_buttonAddPath; wxButton* m_buttonInsPath; wxButton* m_buttonRemovePath; + wxStaticText* m_staticTextPathlist; wxListBox* m_DefaultLibraryPathslistBox; wxStaticLine* m_staticline3; @@ -72,9 +76,9 @@ class DIALOG_EESCHEMA_CONFIG_FBP : public wxDialog wxButton* m_sdbSizer1OK; wxButton* m_sdbSizer1Cancel; - DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_EESCHEMA_CONFIG_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_EESCHEMA_CONFIG_FBP(); }; -#endif //__dialog_eeschema_config_fbp__ +#endif //__DIALOG_EESCHEMA_CONFIG_FBP_H__ diff --git a/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths_fbp.cpp b/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths_fbp.cpp index 03eadd2a36..ca168284a8 100644 --- a/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths_fbp.cpp +++ b/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths_fbp.cpp @@ -63,7 +63,7 @@ DIALOG_PCBNEW_CONFIG_LIBS_FBP::DIALOG_PCBNEW_CONFIG_LIBS_FBP( wxWindow* parent, bLibsChoiceSizer->Add( bLibsChoiceListSizer, 1, wxEXPAND, 5 ); - bMainSizer->Add( bLibsChoiceSizer, 1, wxEXPAND, 5 ); + bMainSizer->Add( bLibsChoiceSizer, 2, wxEXPAND, 5 ); wxBoxSizer* bModulesDocSizer; bModulesDocSizer = new wxBoxSizer( wxVERTICAL ); @@ -119,10 +119,10 @@ DIALOG_PCBNEW_CONFIG_LIBS_FBP::DIALOG_PCBNEW_CONFIG_LIBS_FBP( wxWindow* parent, bSizerPathsChoice->Add( bUserPathsButtonsSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 ); - bSizerPaths->Add( bSizerPathsChoice, 0, wxEXPAND, 5 ); + bSizerPaths->Add( bSizerPathsChoice, 1, wxEXPAND, 5 ); - bMainSizer->Add( bSizerPaths, 0, wxEXPAND, 5 ); + bMainSizer->Add( bSizerPaths, 1, wxEXPAND, 5 ); wxBoxSizer* bLibPathSizer; bLibPathSizer = new wxBoxSizer( wxVERTICAL ); @@ -135,10 +135,10 @@ DIALOG_PCBNEW_CONFIG_LIBS_FBP::DIALOG_PCBNEW_CONFIG_LIBS_FBP( wxWindow* parent, m_DefaultLibraryPathslistBox->SetToolTip( _("System and user paths used to search and load library files and component doc files.\nSorted by decreasing priority order.") ); m_DefaultLibraryPathslistBox->SetMinSize( wxSize( -1,70 ) ); - bLibPathSizer->Add( m_DefaultLibraryPathslistBox, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bLibPathSizer->Add( m_DefaultLibraryPathslistBox, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - bMainSizer->Add( bLibPathSizer, 0, wxEXPAND, 5 ); + bMainSizer->Add( bLibPathSizer, 1, wxEXPAND, 5 ); m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); bMainSizer->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); diff --git a/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths_fbp.fbp b/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths_fbp.fbp index 0c059fd230..a125a39de6 100644 --- a/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths_fbp.fbp +++ b/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths_fbp.fbp @@ -94,7 +94,7 @@ 5 wxEXPAND - 1 + 2 bLibsChoiceSizer @@ -1022,7 +1022,7 @@ 5 wxEXPAND - 0 + 1 bSizerPaths @@ -1114,7 +1114,7 @@ 5 wxEXPAND - 0 + 1 bSizerPathsChoice @@ -1490,7 +1490,7 @@ 5 wxEXPAND - 0 + 1 bLibPathSizer @@ -1582,7 +1582,7 @@ 5 wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 0 + 1 1 1 From 9fd79dfa9156c8077b1910c9b437a2d015a66b9d Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Sun, 31 Mar 2013 15:27:46 +0200 Subject: [PATCH 28/63] Implemented the LAYER_NUM typedef (LAYER was already taken as a class name...) to represent a layer number. --- 3d-viewer/3d_draw.cpp | 51 ++++++------ 3d-viewer/info3d_visu.cpp | 4 +- 3d-viewer/info3d_visu.h | 4 +- bitmap2component/bitmap2component.cpp | 5 +- common/class_colors_design_settings.cpp | 4 +- common/class_layer_box_selector.cpp | 12 +-- eeschema/dialogs/dialog_color_config.cpp | 3 +- gerbview/class_excellon.h | 2 +- gerbview/class_gbr_layer_box_selector.cpp | 6 +- gerbview/class_gbr_layer_box_selector.h | 6 +- gerbview/class_gbr_layout.cpp | 2 +- gerbview/class_gbr_layout.h | 2 +- gerbview/class_gbr_screen.h | 2 +- gerbview/class_gerber_draw_item.cpp | 2 +- gerbview/class_gerber_draw_item.h | 6 +- gerbview/class_gerbview_layer_widget.cpp | 11 ++- gerbview/class_gerbview_layer_widget.h | 6 +- gerbview/dcode.cpp | 2 +- .../dialogs/dialog_print_using_printer.cpp | 15 ++-- .../dialogs/dialog_select_one_pcb_layer.cpp | 30 +++---- gerbview/draw_gerber_screen.cpp | 4 +- gerbview/events_called_functions.cpp | 4 +- gerbview/excellon_read_drill_file.cpp | 6 +- gerbview/export_to_pcbnew.cpp | 42 +++++----- gerbview/files.cpp | 4 +- gerbview/gerbview.cpp | 7 +- gerbview/gerbview.h | 2 - gerbview/gerbview_frame.cpp | 30 +++---- gerbview/gerbview_frame.h | 20 ++--- gerbview/initpcb.cpp | 8 +- gerbview/locate.cpp | 2 +- gerbview/readgerb.cpp | 2 +- gerbview/rs274d.cpp | 10 +-- gerbview/select_layers_to_pcb.cpp | 60 +++++++------- gerbview/select_layers_to_pcb.h | 4 +- gerbview/toolbars_gerber.cpp | 2 +- include/class_board_design_settings.h | 8 +- include/class_board_item.h | 10 +-- include/class_colors_design_settings.h | 5 +- include/class_layer_box_selector.h | 14 ++-- include/class_pcb_screen.h | 6 +- include/layers_id_colors_and_visibility.h | 44 +++++----- include/macros.h | 2 +- include/pcbcommon.h | 2 +- include/sch_item_struct.h | 1 + include/wxBasePcbFrame.h | 4 +- include/wxPcbStruct.h | 8 +- pcbnew/autorouter/autoplac.cpp | 4 +- pcbnew/autorouter/routing_matrix.cpp | 4 +- pcbnew/basepcbframe.cpp | 4 +- pcbnew/block.cpp | 2 +- pcbnew/board_undo_redo.cpp | 2 +- pcbnew/class_board.cpp | 62 +++++++------- pcbnew/class_board.h | 44 +++++----- pcbnew/class_board_design_settings.cpp | 9 +- pcbnew/class_dimension.cpp | 4 +- pcbnew/class_dimension.h | 2 +- pcbnew/class_drawsegment.cpp | 5 +- pcbnew/class_edge_mod.cpp | 2 +- pcbnew/class_marker_pcb.cpp | 2 +- pcbnew/class_marker_pcb.h | 2 +- pcbnew/class_mire.cpp | 2 +- pcbnew/class_mire.h | 2 +- pcbnew/class_module_transform_functions.cpp | 4 +- pcbnew/class_pad.cpp | 2 +- pcbnew/class_pad.h | 2 +- pcbnew/class_pad_draw_functions.cpp | 4 +- pcbnew/class_pcb_layer_box_selector.cpp | 10 +-- pcbnew/class_pcb_layer_box_selector.h | 25 +----- pcbnew/class_pcb_layer_widget.cpp | 18 ++-- pcbnew/class_pcb_layer_widget.h | 6 +- pcbnew/class_text_mod.cpp | 6 +- pcbnew/class_text_mod.h | 2 +- pcbnew/class_track.cpp | 36 ++++---- pcbnew/class_track.h | 8 +- pcbnew/class_zone.cpp | 6 +- pcbnew/class_zone.h | 2 +- pcbnew/class_zone_settings.cpp | 2 +- pcbnew/class_zone_settings.h | 2 +- pcbnew/clean.cpp | 8 +- pcbnew/collectors.cpp | 4 +- pcbnew/collectors.h | 22 ++--- pcbnew/deltrack.cpp | 4 +- pcbnew/dialogs/dialog_SVG_print.cpp | 18 ++-- pcbnew/dialogs/dialog_copper_zones.cpp | 8 +- pcbnew/dialogs/dialog_global_deletion.cpp | 4 +- pcbnew/dialogs/dialog_global_deletion.h | 4 +- .../dialog_graphic_item_properties.cpp | 18 ++-- ...og_graphic_item_properties_for_Modedit.cpp | 6 +- .../dialog_keepout_area_properties.cpp | 4 +- pcbnew/dialogs/dialog_layers_setup.cpp | 53 ++++++------ pcbnew/dialogs/dialog_pcb_text_properties.cpp | 4 +- pcbnew/dialogs/dialog_plot.cpp | 3 +- pcbnew/dialogs/dialog_print_using_printer.cpp | 19 ++--- pcbnew/dimension.cpp | 6 +- pcbnew/drc_clearance_test_functions.cpp | 2 +- pcbnew/eagle_plugin.cpp | 44 +++++----- pcbnew/eagle_plugin.h | 2 +- pcbnew/edgemod.cpp | 2 +- pcbnew/edit.cpp | 14 ++-- pcbnew/edit_pcb_text.cpp | 2 +- pcbnew/editedge.cpp | 2 +- pcbnew/editrack-part2.cpp | 6 +- pcbnew/editrack.cpp | 2 +- pcbnew/export_gencad.cpp | 6 +- pcbnew/export_vrml.cpp | 51 ++++++------ pcbnew/gen_drill_report_files.cpp | 6 +- pcbnew/gen_modules_placefile.cpp | 4 +- pcbnew/gendrill_Excellon_writer.h | 4 +- pcbnew/hotkeys_board_editor.cpp | 10 +-- pcbnew/kicad_plugin.cpp | 14 ++-- pcbnew/layer_widget.cpp | 32 +++---- pcbnew/layer_widget.h | 20 ++--- pcbnew/legacy_plugin.cpp | 83 +++++++++++-------- pcbnew/magnetic_tracks_functions.cpp | 2 +- pcbnew/pcad2kicadpcb_plugin/pcb.cpp | 14 ++-- pcbnew/pcad2kicadpcb_plugin/pcb.h | 2 +- pcbnew/pcad2kicadpcb_plugin/pcb_callbacks.h | 4 +- pcbnew/pcad2kicadpcb_plugin/pcb_component.cpp | 6 +- pcbnew/pcad2kicadpcb_plugin/pcb_component.h | 6 +- pcbnew/pcb_parser.cpp | 14 ++-- pcbnew/pcb_parser.h | 4 +- pcbnew/pcbframe.cpp | 2 +- pcbnew/pcbnew.cpp | 4 +- pcbnew/pcbnew.h | 4 +- pcbnew/pcbplot.cpp | 8 +- pcbnew/pcbplot.h | 4 +- pcbnew/plot_board_layers.cpp | 4 +- pcbnew/plot_brditems_plotter.cpp | 10 +-- pcbnew/plotcontroller.h | 2 +- pcbnew/print_board_functions.cpp | 6 +- pcbnew/printout_controler.cpp | 6 +- pcbnew/protos.h | 2 +- pcbnew/sel_layer.cpp | 47 +++++------ pcbnew/specctra.cpp | 15 ++-- pcbnew/specctra.h | 8 +- pcbnew/specctra_export.cpp | 38 ++++----- pcbnew/specctra_import.cpp | 10 +-- pcbnew/specctra_test.cpp | 2 +- pcbnew/swap_layers.cpp | 32 +++---- pcbnew/zones_by_polygon.cpp | 12 +-- pcbnew/zones_functions_for_undo_redo.cpp | 2 +- pcbnew/zones_functions_for_undo_redo.h | 2 +- pcbnew/zones_non_copper_type_functions.cpp | 10 ++- pcbnew/zones_test_and_combine_areas.cpp | 4 +- polygon/PolyLine.cpp | 6 +- polygon/PolyLine.h | 8 +- 147 files changed, 782 insertions(+), 782 deletions(-) diff --git a/3d-viewer/3d_draw.cpp b/3d-viewer/3d_draw.cpp index b97701bd75..d2ad04e200 100644 --- a/3d-viewer/3d_draw.cpp +++ b/3d-viewer/3d_draw.cpp @@ -56,14 +56,14 @@ extern void CheckGLError(); /* returns true if aLayer should be displayed, false otherwise */ -static bool Is3DLayerEnabled( int aLayer ); +static bool Is3DLayerEnabled( LAYER_NUM aLayer ); /* returns the Z orientation parameter 1.0 or -1.0 for aLayer * Z orientation is 1.0 for all layers but "back" layers: * LAYER_N_BACK , ADHESIVE_N_BACK, SOLDERPASTE_N_BACK ), SILKSCREEN_N_BACK * used to calculate the Z orientation parameter for glNormal3f */ -static GLfloat Get3DLayer_Z_Orientation( int aLayer ); +static GLfloat Get3DLayer_Z_Orientation( LAYER_NUM aLayer ); void EDA_3D_CANVAS::Redraw( bool finish ) { @@ -163,7 +163,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List() Draw3D_Via( (SEGVIA*) track ); else { - int layer = track->GetLayer(); + LAYER_NUM layer = track->GetLayer(); if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) ) Draw3D_Track( track ); @@ -174,7 +174,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List() { for( int ii = 0; ii < pcb->GetAreaCount(); ii++ ) { - int layer = pcb->GetArea( ii )->GetLayer(); + LAYER_NUM layer = pcb->GetArea( ii )->GetLayer(); if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) ) Draw3D_Zone( pcb->GetArea( ii ) ); @@ -236,8 +236,8 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List() */ void EDA_3D_CANVAS::Draw3D_Zone( ZONE_CONTAINER* aZone ) { - int layer = aZone->GetLayer(); - int color = g_ColorsSettings.GetLayerColor( layer ); + LAYER_NUM layer = aZone->GetLayer(); + EDA_COLOR_T color = g_ColorsSettings.GetLayerColor( layer ); int thickness = g_Parm_3D_Visu.GetLayerObjectThicknessBIU( layer ); if( layer == LAST_COPPER_LAYER ) @@ -456,7 +456,7 @@ void EDA_3D_CANVAS::DrawGrid( double aGriSizeMM ) void EDA_3D_CANVAS::Draw3D_Track( TRACK* aTrack ) { - int layer = aTrack->GetLayer(); + LAYER_NUM layer = aTrack->GetLayer(); int color = g_ColorsSettings.GetLayerColor( layer ); int thickness = g_Parm_3D_Visu.GetCopperThicknessBIU(); @@ -475,7 +475,7 @@ void EDA_3D_CANVAS::Draw3D_Track( TRACK* aTrack ) void EDA_3D_CANVAS::Draw3D_Via( SEGVIA* via ) { - int layer, top_layer, bottom_layer; + LAYER_NUM layer, top_layer, bottom_layer; int color; double biu_to_3Dunits = g_Parm_3D_Visu.m_BiuTo3Dunits ; @@ -486,7 +486,7 @@ void EDA_3D_CANVAS::Draw3D_Via( SEGVIA* via ) via->ReturnLayerPair( &top_layer, &bottom_layer ); // Drawing horizontal thick rings: - for( layer = bottom_layer; layer < g_Parm_3D_Visu.m_CopperLayersCount; layer++ ) + for( layer = bottom_layer; layer < g_Parm_3D_Visu.m_CopperLayersCount; ++layer ) { int zpos = g_Parm_3D_Visu.GetLayerZcoordBIU( layer ); @@ -530,7 +530,7 @@ void EDA_3D_CANVAS::Draw3D_Via( SEGVIA* via ) void EDA_3D_CANVAS::Draw3D_DrawSegment( DRAWSEGMENT* segment ) { - int layer = segment->GetLayer(); + LAYER_NUM layer = segment->GetLayer(); int color = g_ColorsSettings.GetLayerColor( layer ); int thickness = g_Parm_3D_Visu.GetLayerObjectThicknessBIU( layer ); @@ -538,7 +538,7 @@ void EDA_3D_CANVAS::Draw3D_DrawSegment( DRAWSEGMENT* segment ) if( layer == EDGE_N ) { - for( layer = 0; layer < g_Parm_3D_Visu.m_CopperLayersCount; layer++ ) + for( layer = FIRST_LAYER; layer < g_Parm_3D_Visu.m_CopperLayersCount; ++layer ) { glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) ); int zpos = g_Parm_3D_Visu.GetLayerZcoordBIU(layer); @@ -624,7 +624,7 @@ static void Draw3dTextSegm( int x0, int y0, int xf, int yf ) void EDA_3D_CANVAS::Draw3D_DrawText( TEXTE_PCB* text ) { - int layer = text->GetLayer(); + LAYER_NUM layer = text->GetLayer(); int color = g_ColorsSettings.GetLayerColor( layer ); SetGLColor( color ); @@ -754,7 +754,7 @@ void EDGE_MODULE::Draw3D( EDA_3D_CANVAS* glcanvas ) if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( m_Layer ) == false ) return; - int color = g_ColorsSettings.GetLayerColor( m_Layer ); + EDA_COLOR_T color = g_ColorsSettings.GetLayerColor( m_Layer ); SetGLColor( color ); // for outline shape = S_POLYGON: @@ -790,7 +790,7 @@ void EDGE_MODULE::Draw3D( EDA_3D_CANVAS* glcanvas ) if( m_Layer == EDGE_N ) { - for( int layer = 0; layer < g_Parm_3D_Visu.m_CopperLayersCount; layer++ ) + for( LAYER_NUM layer = FIRST_LAYER; layer < g_Parm_3D_Visu.m_CopperLayersCount; ++layer ) { glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) ); int zpos = g_Parm_3D_Visu.GetLayerZcoordBIU( layer ); @@ -948,7 +948,7 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas ) switch( GetShape() ) { case PAD_CIRCLE: - for( int layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; layer++ ) + for( LAYER_NUM layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; ++layer ) { if( layer && (layer == nlmax) ) layer = LAYER_N_FRONT; @@ -1007,7 +1007,6 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas ) wxPoint coord[5]; BuildPadPolygon( coord, wxSize(0,0), m_Orient ); for( int ii = 0; ii < 4; ii ++ ) - { CPolyPt pt( coord[ii].x + shape_pos.x, coord[ii].y+ shape_pos.y ); polyPadShape.push_back( pt ); @@ -1027,7 +1026,7 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas ) if( polyPadShape.size() ) { - for( int layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; layer++ ) + for( LAYER_NUM layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; ++layer ) { if( layer && (layer == nlmax) ) layer = LAYER_N_FRONT; @@ -1061,41 +1060,41 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas ) } -bool Is3DLayerEnabled( int aLayer ) +bool Is3DLayerEnabled( LAYER_NUM aLayer ) { - int flg = -1; + int flg; // see if layer needs to be shown // check the flags switch (aLayer) { case DRAW_N: - flg=g_Parm_3D_Visu.FL_DRAWINGS; + flg = g_Parm_3D_Visu.FL_DRAWINGS; break; case COMMENT_N: - flg=g_Parm_3D_Visu.FL_COMMENTS; + flg = g_Parm_3D_Visu.FL_COMMENTS; break; case ECO1_N: - flg=g_Parm_3D_Visu.FL_ECO1; + flg = g_Parm_3D_Visu.FL_ECO1; break; case ECO2_N: - flg=g_Parm_3D_Visu.FL_ECO2; + flg = g_Parm_3D_Visu.FL_ECO2; break; - } + default: // the layer was not a layer with a flag, so show it - if( flg < 0 ) return true; + } // if the layer has a flag, return the flag return g_Parm_3D_Visu.m_DrawFlags[flg]; } -GLfloat Get3DLayer_Z_Orientation( int aLayer ) +GLfloat Get3DLayer_Z_Orientation( LAYER_NUM aLayer ) { double nZ; diff --git a/3d-viewer/info3d_visu.cpp b/3d-viewer/info3d_visu.cpp index 6fe6c9248b..4047783b4d 100644 --- a/3d-viewer/info3d_visu.cpp +++ b/3d-viewer/info3d_visu.cpp @@ -135,7 +135,7 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard ) } // calculate z position for each non copper layer - for( int layer_id = FIRST_NO_COPPER_LAYER; layer_id < NB_LAYERS; layer_id++ ) + for( int layer_id = FIRST_NON_COPPER_LAYER; layer_id < NB_PCB_LAYERS; layer_id++ ) { double zpos; #define NonCopperLayerThicknessMargin 1.1 @@ -184,7 +184,7 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard ) default: zpos = zpos_copper_front + - (layer_id - FIRST_NO_COPPER_LAYER + 5) * + (layer_id - FIRST_NON_COPPER_LAYER + 5) * m_NonCopperLayerThickness * NonCopperLayerThicknessMargin; break; } diff --git a/3d-viewer/info3d_visu.h b/3d-viewer/info3d_visu.h index ec2aa74d86..a6b0456ef1 100644 --- a/3d-viewer/info3d_visu.h +++ b/3d-viewer/info3d_visu.h @@ -93,7 +93,7 @@ public: double m_CurrentZpos; // temporary storage of current value of Z position, // used in some calculation private: - double m_LayerZcoord[LAYER_COUNT]; // Z position of each layer (normalized) + double m_LayerZcoord[NB_LAYERS]; // Z position of each layer (normalized) double m_CopperThickness; // Copper thickness (normalized) double m_EpoxyThickness; // Epoxy thickness (normalized) double m_NonCopperLayerThickness; // Non copper layers thickness @@ -173,7 +173,7 @@ public: INFO3D_VISU(); */ int GetLayerObjectThicknessBIU( int aLayerId) const { - return aLayerId >= FIRST_NO_COPPER_LAYER ? + return aLayerId >= FIRST_NON_COPPER_LAYER ? GetNonCopperLayerThicknessBIU() : GetCopperThicknessBIU(); } diff --git a/bitmap2component/bitmap2component.cpp b/bitmap2component/bitmap2component.cpp index 7c5ac02efa..bbb64cd5a8 100644 --- a/bitmap2component/bitmap2component.cpp +++ b/bitmap2component/bitmap2component.cpp @@ -32,7 +32,7 @@ #include #include #include - +#include #include #include @@ -310,8 +310,7 @@ void BITMAPCONV_INFO::OuputOnePolygon( KPolygon & aPolygon ) case PCBNEW_FMT: { - #define SILKSCREEN_N_FRONT 21 - int layer = SILKSCREEN_N_FRONT; + LAYER_NUM layer = SILKSCREEN_N_FRONT; int width = 1; fprintf( m_Outfile, "DP %d %d %d %d %d %d %d\n", 0, 0, 0, 0, diff --git a/common/class_colors_design_settings.cpp b/common/class_colors_design_settings.cpp index 8901544c58..21835b80e5 100644 --- a/common/class_colors_design_settings.cpp +++ b/common/class_colors_design_settings.cpp @@ -78,7 +78,7 @@ COLORS_DESIGN_SETTINGS:: COLORS_DESIGN_SETTINGS() * @return the color for aLayer which is one of the layer indices given * in pcbstruct.h or in schematic */ -EDA_COLOR_T COLORS_DESIGN_SETTINGS::GetLayerColor( int aLayer ) const +EDA_COLOR_T COLORS_DESIGN_SETTINGS::GetLayerColor( LAYER_NUM aLayer ) const { if( (unsigned) aLayer < DIM(m_LayersColors) ) { @@ -93,7 +93,7 @@ EDA_COLOR_T COLORS_DESIGN_SETTINGS::GetLayerColor( int aLayer ) const * sets the color for aLayer which is one of the layer indices given * in pcbstruct.h or in schematic */ -void COLORS_DESIGN_SETTINGS::SetLayerColor( int aLayer, EDA_COLOR_T aColor ) +void COLORS_DESIGN_SETTINGS::SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor ) { if( (unsigned) aLayer < DIM(m_LayersColors) ) { diff --git a/common/class_layer_box_selector.cpp b/common/class_layer_box_selector.cpp index d38943a7bb..3ec360025b 100644 --- a/common/class_layer_box_selector.cpp +++ b/common/class_layer_box_selector.cpp @@ -65,14 +65,14 @@ int LAYER_BOX_SELECTOR::GetChoice() // Get Current Layer -int LAYER_BOX_SELECTOR::GetLayerSelection() +LAYER_NUM LAYER_BOX_SELECTOR::GetLayerSelection() const { - return (long) GetClientData( GetSelection() ); + return (LAYER_NUM)((unsigned long) GetClientData( GetSelection() ) ); } // Set Layer # -int LAYER_BOX_SELECTOR::SetLayerSelection( int layer ) +int LAYER_BOX_SELECTOR::SetLayerSelection( LAYER_NUM layer ) { int elements = GetCount(); @@ -97,8 +97,8 @@ int LAYER_BOX_SELECTOR::SetLayerSelection( int layer ) void LAYER_BOX_SELECTOR::ResyncBitmapOnly() { - int elements = GetCount(); - for( int i = 0; i < elements; i++ ) + LAYER_NUM elements = GetCount(); + for( LAYER_NUM i = FIRST_LAYER; i < elements; ++i ) { wxBitmap layerbmp( 14, 14 ); SetBitmapLayer( layerbmp, i ); @@ -106,7 +106,7 @@ void LAYER_BOX_SELECTOR::ResyncBitmapOnly() } -void LAYER_BOX_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, int aLayerIndex ) +void LAYER_BOX_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayerIndex ) { wxMemoryDC bmpDC; wxBrush brush; diff --git a/eeschema/dialogs/dialog_color_config.cpp b/eeschema/dialogs/dialog_color_config.cpp index 92b5e0b9d1..57ec480a0a 100644 --- a/eeschema/dialogs/dialog_color_config.cpp +++ b/eeschema/dialogs/dialog_color_config.cpp @@ -11,6 +11,7 @@ #include #include +#include #define ID_COLOR_SETUP 1800 @@ -290,7 +291,7 @@ bool DIALOG_COLOR_CONFIG::UpdateColorsSettings() bool warning = false; - for( int ii = 0; ii < MAX_LAYERS; ii++ ) + for( LAYER_NUM ii = FIRST_LAYER; ii < MAX_LAYERS; ++ii ) { SetLayerColor( currentColors[ ii ], ii ); diff --git a/gerbview/class_excellon.h b/gerbview/class_excellon.h index 7f8b5b9df3..0bc3e26449 100644 --- a/gerbview/class_excellon.h +++ b/gerbview/class_excellon.h @@ -76,7 +76,7 @@ private: excellon_state m_State; // state of excellon file analysis bool m_SlotOn; // true during an oval driil definition -public: EXCELLON_IMAGE( GERBVIEW_FRAME* aParent, int layer ) : +public: EXCELLON_IMAGE( GERBVIEW_FRAME* aParent, LAYER_NUM layer ) : GERBER_IMAGE( aParent, layer ) { m_State = READ_HEADER_STATE; diff --git a/gerbview/class_gbr_layer_box_selector.cpp b/gerbview/class_gbr_layer_box_selector.cpp index 45918ec131..038aac142f 100644 --- a/gerbview/class_gbr_layer_box_selector.cpp +++ b/gerbview/class_gbr_layer_box_selector.cpp @@ -46,7 +46,7 @@ void GBR_LAYER_BOX_SELECTOR::Resync() { Clear(); - for( int layerid = 0; layerid < LAYER_COUNT; layerid++ ) + for( LAYER_NUM layerid = FIRST_LAYER; layerid < NB_LAYERS; ++layerid ) { wxBitmap layerbmp( 14, 14 ); wxString layername; @@ -65,7 +65,7 @@ void GBR_LAYER_BOX_SELECTOR::Resync() // Returns a color index from the layer id -EDA_COLOR_T GBR_LAYER_BOX_SELECTOR::GetLayerColor( int aLayerIndex ) const +EDA_COLOR_T GBR_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayerIndex ) const { GERBVIEW_FRAME* frame = (GERBVIEW_FRAME*) GetParent()->GetParent(); @@ -74,7 +74,7 @@ EDA_COLOR_T GBR_LAYER_BOX_SELECTOR::GetLayerColor( int aLayerIndex ) const // Returns the name of the layer id -wxString GBR_LAYER_BOX_SELECTOR::GetLayerName( int aLayerIndex ) const +wxString GBR_LAYER_BOX_SELECTOR::GetLayerName( LAYER_NUM aLayerIndex ) const { wxString name; name.Printf( _( "Layer %d" ), aLayerIndex + 1 ); diff --git a/gerbview/class_gbr_layer_box_selector.h b/gerbview/class_gbr_layer_box_selector.h index 64812e5a57..0ba19a2647 100644 --- a/gerbview/class_gbr_layer_box_selector.h +++ b/gerbview/class_gbr_layer_box_selector.h @@ -37,15 +37,15 @@ public: // Returns a color index from the layer id // Virtual function - EDA_COLOR_T GetLayerColor( int aLayerIndex ) const; + EDA_COLOR_T GetLayerColor( LAYER_NUM aLayerIndex ) const; // Returns true if the layer id is enabled (i.e. is it should be displayed) // Virtual function - bool IsLayerEnabled( int aLayerIndex ) const { return true; }; + bool IsLayerEnabled( LAYER_NUM aLayerIndex ) const { return true; }; // Returns the name of the layer id // Virtual function - wxString GetLayerName( int aLayerIndex ) const; + wxString GetLayerName( LAYER_NUM aLayerIndex ) const; }; #endif //CLASS_GBR_LAYER_BOX_SELECTOR_H diff --git a/gerbview/class_gbr_layout.cpp b/gerbview/class_gbr_layout.cpp index abd461876a..345722f2f5 100644 --- a/gerbview/class_gbr_layout.cpp +++ b/gerbview/class_gbr_layout.cpp @@ -27,7 +27,7 @@ GBR_LAYOUT::~GBR_LAYOUT() * param aLayerIndex = The index of the layer to be tested * return bool - true if the layer is visible. */ -bool GBR_LAYOUT::IsLayerVisible( int aLayerIndex ) const +bool GBR_LAYOUT::IsLayerVisible( LAYER_NUM aLayerIndex ) const { return m_printLayersMask & GetLayerMask( aLayerIndex ); } diff --git a/gerbview/class_gbr_layout.h b/gerbview/class_gbr_layout.h index 8967357e38..cc497703b5 100644 --- a/gerbview/class_gbr_layout.h +++ b/gerbview/class_gbr_layout.h @@ -102,7 +102,7 @@ public: * @param aLayerIndex = The index of the layer to be tested * @return bool - true if the layer is visible. */ - bool IsLayerVisible( int aLayerIndex ) const; + bool IsLayerVisible( LAYER_NUM aLayerIndex ) const; #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const; // overload diff --git a/gerbview/class_gbr_screen.h b/gerbview/class_gbr_screen.h index 77640a1a2a..8be96b21d5 100644 --- a/gerbview/class_gbr_screen.h +++ b/gerbview/class_gbr_screen.h @@ -17,7 +17,7 @@ class GBR_SCREEN : public BASE_SCREEN { public: - int m_Active_Layer; + LAYER_NUM m_Active_Layer; /** * Constructor * @param aPageSizeIU is the size of the initial paper page in internal units. diff --git a/gerbview/class_gerber_draw_item.cpp b/gerbview/class_gerber_draw_item.cpp index f9fb900284..39d8053eab 100644 --- a/gerbview/class_gerber_draw_item.cpp +++ b/gerbview/class_gerber_draw_item.cpp @@ -44,7 +44,7 @@ GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( GBR_LAYOUT* aParent, GERBER_IMAGE* aGerberpa EDA_ITEM( (EDA_ITEM*)aParent, TYPE_GERBER_DRAW_ITEM ) { m_imageParams = aGerberparams; - m_Layer = 0; + m_Layer = FIRST_LAYER; m_Shape = GBR_SEGMENT; m_Flashed = false; m_DCode = 0; diff --git a/gerbview/class_gerber_draw_item.h b/gerbview/class_gerber_draw_item.h index 3d6cfda162..cb304dbc64 100644 --- a/gerbview/class_gerber_draw_item.h +++ b/gerbview/class_gerber_draw_item.h @@ -90,7 +90,7 @@ public: * redundancy for these parameters */ private: - int m_Layer; + LAYER_NUM m_Layer; // These values are used to draw this item, according to gerber layers parameters // Because they can change inside a gerber image, they are stored here @@ -123,7 +123,7 @@ public: * Function GetLayer * returns the layer this item is on. */ - int GetLayer() const { return m_Layer; } + LAYER_NUM GetLayer() const { return m_Layer; } /** * Function SetLayer @@ -132,7 +132,7 @@ public: * is virtual because some items (in fact: class DIMENSION) * have a slightly different initialization */ - void SetLayer( int aLayer ) { m_Layer = aLayer; } + void SetLayer( LAYER_NUM aLayer ) { m_Layer = aLayer; } LAYER_MSK GetLayerMask() { diff --git a/gerbview/class_gerbview_layer_widget.cpp b/gerbview/class_gerbview_layer_widget.cpp index eea92f7d16..bb6a3a57df 100644 --- a/gerbview/class_gerbview_layer_widget.cpp +++ b/gerbview/class_gerbview_layer_widget.cpp @@ -196,10 +196,9 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) void GERBER_LAYER_WIDGET::ReFill() { - int layer; ClearLayerRows(); - for( layer = 0; layer < GERBVIEW_LAYER_COUNT; layer++ ) + for( LAYER_NUM layer = FIRST_LAYER; layer < NB_GERBER_LAYERS; ++layer ) { wxString msg; msg.Printf( _("Layer %d"), layer+1 ); @@ -212,18 +211,18 @@ void GERBER_LAYER_WIDGET::ReFill() //------------------------------------------------ -void GERBER_LAYER_WIDGET::OnLayerColorChange( int aLayer, EDA_COLOR_T aColor ) +void GERBER_LAYER_WIDGET::OnLayerColorChange( LAYER_NUM aLayer, EDA_COLOR_T aColor ) { myframe->SetLayerColor( aLayer, aColor ); myframe->m_SelLayerBox->ResyncBitmapOnly(); myframe->GetCanvas()->Refresh(); } -bool GERBER_LAYER_WIDGET::OnLayerSelect( int aLayer ) +bool GERBER_LAYER_WIDGET::OnLayerSelect( LAYER_NUM aLayer ) { // the layer change from the GERBER_LAYER_WIDGET can be denied by returning // false from this function. - int layer = myframe->getActiveLayer( ); + LAYER_NUM layer = myframe->getActiveLayer( ); myframe->setActiveLayer( aLayer, false ); myframe->syncLayerBox(); @@ -233,7 +232,7 @@ bool GERBER_LAYER_WIDGET::OnLayerSelect( int aLayer ) return true; } -void GERBER_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal ) +void GERBER_LAYER_WIDGET::OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal ) { LAYER_MSK visibleLayers = myframe->GetVisibleLayers(); diff --git a/gerbview/class_gerbview_layer_widget.h b/gerbview/class_gerbview_layer_widget.h index 60349aba6b..cd974e08ea 100644 --- a/gerbview/class_gerbview_layer_widget.h +++ b/gerbview/class_gerbview_layer_widget.h @@ -88,9 +88,9 @@ public: void ReFillRender(); //---------------- - void OnLayerColorChange( int aLayer, EDA_COLOR_T aColor ); - bool OnLayerSelect( int aLayer ); - void OnLayerVisible( int aLayer, bool isVisible, bool isFinal ); + void OnLayerColorChange( LAYER_NUM aLayer, EDA_COLOR_T aColor ); + bool OnLayerSelect( LAYER_NUM aLayer ); + void OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal ); void OnRenderColorChange( int aId, EDA_COLOR_T aColor ); void OnRenderEnable( int aId, bool isEnabled ); /** diff --git a/gerbview/dcode.cpp b/gerbview/dcode.cpp index 8bfa1c4c8b..7cc851c5b1 100644 --- a/gerbview/dcode.cpp +++ b/gerbview/dcode.cpp @@ -165,7 +165,7 @@ int GERBVIEW_FRAME::ReadDCodeDefinitionFile( const wxString& D_Code_FullFileName wxString msg; D_CODE* dcode; FILE* dest; - int layer = getActiveLayer(); + LAYER_NUM layer = getActiveLayer(); int type_outil; if( g_GERBER_List[layer] == NULL ) diff --git a/gerbview/dialogs/dialog_print_using_printer.cpp b/gerbview/dialogs/dialog_print_using_printer.cpp index 27749d4df4..31d21469ad 100644 --- a/gerbview/dialogs/dialog_print_using_printer.cpp +++ b/gerbview/dialogs/dialog_print_using_printer.cpp @@ -123,7 +123,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) /************************************************************************/ { SetFocus(); - int layer_max = GERBVIEW_LAYER_COUNT; + LAYER_NUM layer_max = NB_GERBER_LAYERS; wxString msg; if( g_pageSetupData == NULL ) @@ -137,11 +137,11 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) s_Parameters.m_PageSetupData = g_pageSetupData; - layer_max = 32; + layer_max = NB_LAYERS; // Create layer list - int mask = 1, ii; - for( ii = 0; ii < layer_max; ii++, mask <<= 1 ) + for(LAYER_NUM ii = FIRST_LAYER; ii < layer_max; ++ii ) { + LAYER_MSK mask = GetLayerMask( ii ); msg = _( "Layer" ); msg << wxT( " " ) << ii + 1; m_BoxSelectLayer[ii] = new wxCheckBox( this, -1, msg ); @@ -176,7 +176,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) s_Parameters.m_XScaleAdjust = s_Parameters.m_YScaleAdjust = 1.0; s_SelectedLayers = 0; - for( int layer = 0; layerIsChecked() ) { @@ -255,7 +254,7 @@ void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event ) m_Config->Write( OPTKEY_PRINT_PAGE_FRAME, s_Parameters.m_Print_Sheet_Ref); m_Config->Write( OPTKEY_PRINT_MONOCHROME_MODE, s_Parameters.m_Print_Black_and_White); wxString layerKey; - for( int layer = 0; layer < GERBVIEW_LAYER_COUNT; ++layer ) + for( LAYER_NUM layer = FIRST_LAYER; layer < NB_GERBER_LAYERS; ++layer ) { layerKey.Printf( OPTKEY_LAYERBASE, layer ); m_Config->Write( layerKey, m_BoxSelectLayer[layer]->IsChecked() ); diff --git a/gerbview/dialogs/dialog_select_one_pcb_layer.cpp b/gerbview/dialogs/dialog_select_one_pcb_layer.cpp index 6c6e06f329..4da2ad218a 100644 --- a/gerbview/dialogs/dialog_select_one_pcb_layer.cpp +++ b/gerbview/dialogs/dialog_select_one_pcb_layer.cpp @@ -8,7 +8,7 @@ #include // Exported function -const wxString GetPCBDefaultLayerName( int aLayerNumber ); +const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber ); enum layer_sel_id { @@ -23,11 +23,11 @@ class SELECT_LAYER_DIALOG : public wxDialog private: GERBVIEW_FRAME* m_Parent; wxRadioBox* m_LayerList; - int m_LayerId[NB_LAYERS + 1]; // One extra element for "(Deselect)" radiobutton + LAYER_NUM m_LayerId[int(NB_LAYERS) + 1]; // One extra element for "(Deselect)" radiobutton public: // Constructor and destructor - SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent, int aDefaultLayer, + SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent, LAYER_NUM aDefaultLayer, int aCopperLayerCount, bool aShowDeselectOption ); ~SELECT_LAYER_DIALOG() { }; @@ -61,9 +61,9 @@ END_EVENT_TABLE() * different radiobutton is clicked on) prior to then clicking on the "Deselect" * button provided within the "Layer selection:" dialog box). */ -int GERBVIEW_FRAME::SelectPCBLayer( int aDefaultLayer, int aCopperLayerCount, bool aShowDeselectOption ) +LAYER_NUM GERBVIEW_FRAME::SelectPCBLayer( LAYER_NUM aDefaultLayer, int aCopperLayerCount, bool aShowDeselectOption ) { - int layer; + LAYER_NUM layer; SELECT_LAYER_DIALOG* frame = new SELECT_LAYER_DIALOG( this, aDefaultLayer, aCopperLayerCount, aShowDeselectOption ); @@ -81,14 +81,14 @@ int GERBVIEW_FRAME::SelectPCBLayer( int aDefaultLayer, int aCopperLayerCount, bo * to the right of that radiobox. */ SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent, - int aDefaultLayer, int aCopperLayerCount, + LAYER_NUM aDefaultLayer, int aCopperLayerCount, bool aShowDeselectOption ) : wxDialog( parent, -1, _( "Select Layer:" ), wxPoint( -1, -1 ), wxSize( 470, 250 ), DIALOG_STYLE ) { wxButton* Button; - int ii; + LAYER_NUM ii; wxString LayerList[NB_LAYERS + 1]; // One extra element for "(Deselect)" // radiobutton int LayerCount, LayerSelect = -1; @@ -97,11 +97,11 @@ SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent, // Build the layer list; first build copper layers list LayerCount = 0; - for( ii = 0; ii < BOARD_COPPER_LAYERS_MAX_COUNT; ii++ ) + for( ii = FIRST_COPPER_LAYER; ii < NB_COPPER_LAYERS; ++ii ) { - m_LayerId[ii] = 0; + m_LayerId[ii] = FIRST_LAYER; - if( ii == 0 || ii == BOARD_COPPER_LAYERS_MAX_COUNT-1 || ii < aCopperLayerCount-1 ) + if( ii == FIRST_COPPER_LAYER || ii == LAST_COPPER_LAYER || ii < aCopperLayerCount-1 ) { LayerList[LayerCount] = GetPCBDefaultLayerName( ii ); @@ -113,9 +113,9 @@ SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent, } } // Build the layer list; build copper layers list - for( ; ii < NB_LAYERS; ii++ ) + for( ; ii < NB_LAYERS; ++ii ) { - m_LayerId[ii] = 0; + m_LayerId[ii] = FIRST_LAYER; LayerList[LayerCount] = GetPCBDefaultLayerName( ii ); @@ -131,10 +131,10 @@ SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent, { LayerList[LayerCount] = _( "(Deselect)" ); - if( NB_LAYERS == aDefaultLayer ) + if( NB_PCB_LAYERS == aDefaultLayer ) LayerSelect = LayerCount; - m_LayerId[LayerCount] = NB_LAYERS; + m_LayerId[LayerCount] = NB_PCB_LAYERS; LayerCount++; } @@ -181,7 +181,7 @@ void SELECT_LAYER_DIALOG::OnCancelClick( wxCommandEvent& event ) EndModal( -1 ); } -const wxString GetPCBDefaultLayerName( int aLayerNumber ) +const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber ) { const wxChar* txt; diff --git a/gerbview/draw_gerber_screen.cpp b/gerbview/draw_gerber_screen.cpp index 42aa4d79dd..198eb78efd 100644 --- a/gerbview/draw_gerber_screen.cpp +++ b/gerbview/draw_gerber_screen.cpp @@ -193,9 +193,9 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode, bool end = false; - for( int layer = 0; !end; layer++ ) + for( LAYER_NUM layer = FIRST_LAYER; !end; ++layer ) { - int active_layer = gerbFrame->getActiveLayer(); + LAYER_NUM active_layer = gerbFrame->getActiveLayer(); if( layer == active_layer ) // active layer will be drawn after other layers continue; diff --git a/gerbview/events_called_functions.cpp b/gerbview/events_called_functions.cpp index 46b69c1385..28df5efb48 100644 --- a/gerbview/events_called_functions.cpp +++ b/gerbview/events_called_functions.cpp @@ -235,7 +235,7 @@ void GERBVIEW_FRAME::OnSelectActiveDCode( wxCommandEvent& event ) */ void GERBVIEW_FRAME::OnSelectActiveLayer( wxCommandEvent& event ) { - int layer = getActiveLayer(); + LAYER_NUM layer = getActiveLayer(); setActiveLayer( event.GetSelection() ); @@ -249,7 +249,7 @@ void GERBVIEW_FRAME::OnSelectActiveLayer( wxCommandEvent& event ) */ void GERBVIEW_FRAME::OnShowGerberSourceFile( wxCommandEvent& event ) { - int layer = getActiveLayer(); + LAYER_NUM layer = getActiveLayer(); GERBER_IMAGE* gerber_layer = g_GERBER_List[layer]; if( gerber_layer ) diff --git a/gerbview/excellon_read_drill_file.cpp b/gerbview/excellon_read_drill_file.cpp index 7d6a07e32e..2057432fae 100644 --- a/gerbview/excellon_read_drill_file.cpp +++ b/gerbview/excellon_read_drill_file.cpp @@ -78,13 +78,13 @@ extern double ReadDouble( char*& text, bool aSkipSeparator = true ); extern void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem, APERTURE_T aAperture, int Dcode_index, - int aLayer, + LAYER_NUM aLayer, const wxPoint& aPos, wxSize aSize, bool aLayerNegative ); void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index, - int aLayer, + LAYER_NUM aLayer, const wxPoint& aStart, const wxPoint& aEnd, wxSize aPenSize, @@ -153,7 +153,7 @@ static EXCELLON_CMD excellon_G_CmdList[] = bool GERBVIEW_FRAME::Read_EXCELLON_File( const wxString& aFullFileName ) { wxString msg; - int layer = getActiveLayer(); // current layer used in GerbView + LAYER_NUM layer = getActiveLayer(); // current layer used in GerbView if( g_GERBER_List[layer] == NULL ) { diff --git a/gerbview/export_to_pcbnew.cpp b/gerbview/export_to_pcbnew.cpp index 73510a082b..c7c2c6d018 100644 --- a/gerbview/export_to_pcbnew.cpp +++ b/gerbview/export_to_pcbnew.cpp @@ -44,7 +44,7 @@ public: * Function ExportPcb * saves a board from a set of Gerber images. */ - bool ExportPcb( int* LayerLookUpTable ); + bool ExportPcb( LAYER_NUM* LayerLookUpTable ); private: /** @@ -53,7 +53,7 @@ private: * @param aGbrItem = the Gerber item (line, arc) to export * @param aLayer = the technical layer to use */ - void export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer ); + void export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ); /** * Function export_copper_item @@ -61,7 +61,7 @@ private: * @param aGbrItem = the Gerber item (line, arc, flashed) to export * @param aLayer = the copper layer to use */ - void export_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer ); + void export_copper_item( GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ); /** * Function export_flashed_copper_item @@ -76,7 +76,7 @@ private: * @param aGbrItem = the Gerber item (line only) to export * @param aLayer = the copper layer to use */ - void export_segline_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer ); + void export_segline_copper_item( GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ); /** * Function export_segarc_copper_item @@ -85,7 +85,7 @@ private: * @param aGbrItem = the Gerber item (arc only) to export * @param aLayer = the copper layer to use */ - void export_segarc_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer ); + void export_segarc_copper_item( GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ); /** * function writePcbLineItem @@ -93,7 +93,7 @@ private: * to the board file */ void writePcbLineItem( int aShape, int aType, wxPoint& aStart, wxPoint& aEnd, - int aWidth, int aLayer, int aDrill, int aAngle = 0 ); + int aWidth, LAYER_NUM aLayer, int aDrill, int aAngle = 0 ); /** * function writePcbHeader @@ -123,7 +123,7 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event ) int layercount = 0; // Count the Gerber layers which are actually currently used - for( int ii = 0; ii < GERBVIEW_LAYER_COUNT; ii++ ) + for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii ) { if( g_GERBER_List[ii] != NULL ) layercount++; @@ -170,7 +170,7 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event ) } -bool GBR_TO_PCB_EXPORTER::ExportPcb( int* LayerLookUpTable ) +bool GBR_TO_PCB_EXPORTER::ExportPcb( LAYER_NUM* LayerLookUpTable ) { m_fp = wxFopen( m_pcb_file_name, wxT( "wt" ) ); @@ -182,7 +182,7 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( int* LayerLookUpTable ) return false; } - m_pcbCopperLayersCount = LayerLookUpTable[GERBVIEW_LAYER_COUNT]; + m_pcbCopperLayersCount = LayerLookUpTable[NB_GERBER_LAYERS]; writePcbHeader(); @@ -192,10 +192,10 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( int* LayerLookUpTable ) for( ; gerb_item; gerb_item = gerb_item->Next() ) { - int layer = gerb_item->GetLayer(); - int pcb_layer_number = LayerLookUpTable[layer]; + LAYER_NUM layer = gerb_item->GetLayer(); + LAYER_NUM pcb_layer_number = LayerLookUpTable[layer]; - if( pcb_layer_number < 0 || pcb_layer_number > LAST_NO_COPPER_LAYER ) + if( pcb_layer_number < FIRST_LAYER || pcb_layer_number > LAST_NON_COPPER_LAYER ) continue; if( pcb_layer_number > LAST_COPPER_LAYER ) @@ -208,8 +208,8 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( int* LayerLookUpTable ) for( ; gerb_item; gerb_item = gerb_item->Next() ) { - int layer = gerb_item->GetLayer(); - int pcb_layer_number = LayerLookUpTable[layer]; + LAYER_NUM layer = gerb_item->GetLayer(); + LAYER_NUM pcb_layer_number = LayerLookUpTable[layer]; if( pcb_layer_number < 0 || pcb_layer_number > LAST_COPPER_LAYER ) continue; @@ -227,7 +227,7 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( int* LayerLookUpTable ) } -void GBR_TO_PCB_EXPORTER::export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer ) +void GBR_TO_PCB_EXPORTER::export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ) { #define SEG_SHAPE 0 #define ARC_SHAPE 2 @@ -263,7 +263,7 @@ void GBR_TO_PCB_EXPORTER::export_non_copper_item( GERBER_DRAW_ITEM* aGbrItem, in } -void GBR_TO_PCB_EXPORTER::export_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer ) +void GBR_TO_PCB_EXPORTER::export_copper_item( GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ) { switch( aGbrItem->m_Shape ) { @@ -285,7 +285,7 @@ void GBR_TO_PCB_EXPORTER::export_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aL } -void GBR_TO_PCB_EXPORTER::export_segline_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer ) +void GBR_TO_PCB_EXPORTER::export_segline_copper_item( GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ) { wxPoint seg_start, seg_end; @@ -300,7 +300,7 @@ void GBR_TO_PCB_EXPORTER::export_segline_copper_item( GERBER_DRAW_ITEM* aGbrItem } -void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( GERBER_DRAW_ITEM* aGbrItem, int aLayer ) +void GBR_TO_PCB_EXPORTER::export_segarc_copper_item( GERBER_DRAW_ITEM* aGbrItem, LAYER_NUM aLayer ) { double a = atan2( (double) ( aGbrItem->m_Start.y - aGbrItem->m_ArcCentre.y ), (double) ( aGbrItem->m_Start.x - aGbrItem->m_ArcCentre.x ) ); @@ -378,7 +378,9 @@ void GBR_TO_PCB_EXPORTER::export_flashed_copper_item( GERBER_DRAW_ITEM* aGbrItem // Layers are 0 to 15 (Cu/Cmp) = 0x0F #define IS_VIA 1 #define SHAPE_VIA_THROUGH 3 - writePcbLineItem( SHAPE_VIA_THROUGH, IS_VIA, via_pos, via_pos, width, 0x0F, -1 ); + // XXX EVIL usage of LAYER + writePcbLineItem( SHAPE_VIA_THROUGH, IS_VIA, via_pos, via_pos, width, + 0x0F, -1 ); } @@ -408,7 +410,7 @@ void GBR_TO_PCB_EXPORTER::writePcbHeader() void GBR_TO_PCB_EXPORTER::writePcbLineItem( int aShape, int aType, wxPoint& aStart, wxPoint& aEnd, - int aWidth, int aLayer, int aDrill, int aAngle ) + int aWidth, LAYER_NUM aLayer, int aDrill, int aAngle ) { if( aDrill <= -2 ) fprintf( m_fp, "$DRAWSEGMENT\n" ); diff --git a/gerbview/files.cpp b/gerbview/files.cpp index 5d0a8aaf7d..14cb8fc4df 100644 --- a/gerbview/files.cpp +++ b/gerbview/files.cpp @@ -168,7 +168,7 @@ bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFullFileName ) } // Read gerber files: each file is loaded on a new GerbView layer - int layer = getActiveLayer(); + LAYER_NUM layer = getActiveLayer(); for( unsigned ii = 0; ii < filenamesList.GetCount(); ii++ ) { @@ -249,7 +249,7 @@ bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName ) } // Read gerber files: each file is loaded on a new GerbView layer - int layer = getActiveLayer(); + LAYER_NUM layer = getActiveLayer(); for( unsigned ii = 0; ii < filenamesList.GetCount(); ii++ ) { diff --git a/gerbview/gerbview.cpp b/gerbview/gerbview.cpp index 36bbd91341..a79cf2038a 100644 --- a/gerbview/gerbview.cpp +++ b/gerbview/gerbview.cpp @@ -126,15 +126,16 @@ bool EDA_APP::OnInit() wxSetWorkingDirectory( fn.GetPath() ); // Load all files specified on the command line. - int jj = 0; + LAYER_NUM jj = FIRST_LAYER; - for( int ii = 1; ii < argc && ii <= GERBVIEW_LAYER_COUNT; ++ii ) + for( LAYER_NUM ii = LAYER_N_2; ii < argc && ii <= NB_GERBER_LAYERS; ++ii ) { fn = wxFileName( argv[ii] ); if( fn.FileExists() ) { - frame->setActiveLayer( jj++ ); + frame->setActiveLayer( jj ); + ++jj; frame->LoadGerberFiles( fn.GetFullPath() ); } } diff --git a/gerbview/gerbview.h b/gerbview/gerbview.h index 48fd793af5..42a469a631 100644 --- a/gerbview/gerbview.h +++ b/gerbview/gerbview.h @@ -24,8 +24,6 @@ class PAGE_INFO; */ #define GERBER_BUFZ 4000 -#define GERBVIEW_LAYER_COUNT 32 // Number of different layers shown by GerbView - /// List of page sizes extern const wxChar* g_GerberPageSizeList[8]; diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index b1b9945afb..ab0c0e8217 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -92,7 +92,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* aParent, const wxString& aTitle, SetLayout( new GBR_LAYOUT() ); - SetVisibleLayers( -1 ); // All 32 layers visible. + SetVisibleLayers( FULL_LAYERS ); // All 32 layers visible. SetScreen( new GBR_SCREEN( GetLayout()->GetPageSettings().GetSizeIU() ) ); @@ -325,21 +325,21 @@ void GERBVIEW_FRAME::SetElementVisibility( GERBER_VISIBLE_ID aItemIdVisible, } -int GERBVIEW_FRAME::getNextAvailableLayer( int aLayer ) const +LAYER_NUM GERBVIEW_FRAME::getNextAvailableLayer( LAYER_NUM aLayer ) const { - int layer = aLayer; + LAYER_NUM layer = aLayer; - for( int i = 0; i < GERBVIEW_LAYER_COUNT; i++ ) + for( LAYER_NUM i = FIRST_LAYER; i < NB_GERBER_LAYERS; ++i ) { GERBER_IMAGE* gerber = g_GERBER_List[ layer ]; if( gerber == NULL || gerber->m_FileName.IsEmpty() ) return layer; - layer++; + ++layer; - if( layer >= GERBVIEW_LAYER_COUNT ) - layer = 0; + if( layer >= NB_GERBER_LAYERS ) + layer = FIRST_LAYER; } return NO_AVAILABLE_LAYERS; @@ -385,9 +385,9 @@ void GERBVIEW_FRAME::Liste_D_Codes() wxString Line; wxArrayString list; double scale = IU_PER_MILS * 1000; - int curr_layer = getActiveLayer(); + LAYER_NUM curr_layer = getActiveLayer(); - for( int layer = 0; layer < 32; layer++ ) + for( LAYER_NUM layer = FIRST_LAYER; layer < NB_LAYERS; ++layer ) { GERBER_IMAGE* gerber = g_GERBER_List[layer]; @@ -539,7 +539,7 @@ void GERBVIEW_FRAME::SetVisibleAlls() */ LAYER_MSK GERBVIEW_FRAME::GetVisibleLayers() const { - return -1; // TODO + return FULL_LAYERS; // TODO } @@ -561,7 +561,7 @@ void GERBVIEW_FRAME::SetVisibleLayers( LAYER_MSK aLayerMask ) * @param aLayerIndex = The index of the layer to be tested * @return bool - true if the layer is visible. */ -bool GERBVIEW_FRAME::IsLayerVisible( int aLayerIndex ) const +bool GERBVIEW_FRAME::IsLayerVisible( LAYER_NUM aLayerIndex ) const { if( ! m_DisplayOptions.m_IsPrinting ) return m_LayersManager->IsLayerVisible( aLayerIndex ); @@ -650,7 +650,7 @@ EDA_COLOR_T GERBVIEW_FRAME::GetNegativeItemsColor() const * Function GetLayerColor * gets a layer color for any valid layer. */ -EDA_COLOR_T GERBVIEW_FRAME::GetLayerColor( int aLayer ) const +EDA_COLOR_T GERBVIEW_FRAME::GetLayerColor( LAYER_NUM aLayer ) const { return m_colorsSettings->GetLayerColor( aLayer ); } @@ -660,7 +660,7 @@ EDA_COLOR_T GERBVIEW_FRAME::GetLayerColor( int aLayer ) const * Function SetLayerColor * changes a layer color for any valid layer. */ -void GERBVIEW_FRAME::SetLayerColor( int aLayer, EDA_COLOR_T aColor ) +void GERBVIEW_FRAME::SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor ) { m_colorsSettings->SetLayerColor( aLayer, aColor ); } @@ -670,7 +670,7 @@ void GERBVIEW_FRAME::SetLayerColor( int aLayer, EDA_COLOR_T aColor ) * Function getActiveLayer * returns the active layer */ -int GERBVIEW_FRAME::getActiveLayer() +LAYER_NUM GERBVIEW_FRAME::getActiveLayer() { return ( (GBR_SCREEN*) GetScreen() )->m_Active_Layer; } @@ -681,7 +681,7 @@ int GERBVIEW_FRAME::getActiveLayer() * will change the currently active layer to \a aLayer and also * update the PCB_LAYER_WIDGET. */ -void GERBVIEW_FRAME::setActiveLayer( int aLayer, bool doLayerWidgetUpdate ) +void GERBVIEW_FRAME::setActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate ) { ( (GBR_SCREEN*) GetScreen() )->m_Active_Layer = aLayer; diff --git a/gerbview/gerbview_frame.h b/gerbview/gerbview_frame.h index bc69fd4915..36ccf8e7e3 100644 --- a/gerbview/gerbview_frame.h +++ b/gerbview/gerbview_frame.h @@ -39,7 +39,7 @@ #include #include -#define NO_AVAILABLE_LAYERS -1 +#define NO_AVAILABLE_LAYERS UNDEFINED_LAYER class DCODE_SELECTION_BOX; class GERBER_LAYER_WIDGET; @@ -145,10 +145,10 @@ public: void SetCurItem( GERBER_DRAW_ITEM* aItem, bool aDisplayInfo = true ); /** Install the dialog box for layer selection - * @param aDefaultLayer = Preselection (NB_LAYERS for "(Deselect)" layer) + * @param aDefaultLayer = Preselection (NB_PCB_LAYERS for "(Deselect)" layer) * @param aCopperLayerCount = number of copper layers * @param aShowDeselectOption = display a "(Deselect)" radiobutton (when set to true) - * @return new layer value (NB_LAYERS when "(Deselect)" radiobutton selected), + * @return new layer value (NB_PCB_LAYERS when "(Deselect)" radiobutton selected), * or -1 if canceled * * Providing the option to also display a "(Deselect)" radiobutton makes the @@ -159,7 +159,7 @@ public: * different radiobutton is clicked on) prior to then clicking on the "Deselect" * button provided within the "Layer selection:" dialog box). */ - int SelectPCBLayer( int aDefaultLayer, int aOpperLayerCount, bool aNullLayer = false ); + LAYER_NUM SelectPCBLayer( LAYER_NUM aDefaultLayer, int aOpperLayerCount, bool aNullLayer = false ); protected: GERBER_LAYER_WIDGET* m_LayersManager; @@ -316,7 +316,7 @@ public: * @param aLayerIndex = The index of the layer to be tested * @return bool - true if the layer is visible. */ - bool IsLayerVisible( int aLayerIndex ) const; + bool IsLayerVisible( LAYER_NUM aLayerIndex ) const; /** * Function GetVisibleElementColor @@ -330,13 +330,13 @@ public: * Function GetLayerColor * gets a layer color for any valid layer. */ - EDA_COLOR_T GetLayerColor( int aLayer ) const; + EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const; /** * Function SetLayerColor * changes a layer color for any valid layer. */ - void SetLayerColor( int aLayer, EDA_COLOR_T aColor ); + void SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor ); /** * Function GetNegativeItemsColor @@ -388,13 +388,13 @@ public: * will change the currently active layer to \a aLayer and also * update the PCB_LAYER_WIDGET. */ - void setActiveLayer( int aLayer, bool doLayerWidgetUpdate = true ); + void setActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate = true ); /** * Function getActiveLayer * returns the active layer */ - int getActiveLayer(); + LAYER_NUM getActiveLayer(); /** * Function getNextAvailableLayer @@ -403,7 +403,7 @@ public: * @param aLayer The first layer to search. * @return The first empty layer found or NO_AVAILABLE_LAYERS. */ - int getNextAvailableLayer( int aLayer = 0 ) const; + LAYER_NUM getNextAvailableLayer( LAYER_NUM aLayer = FIRST_LAYER ) const; bool hasAvailableLayers() const { diff --git a/gerbview/initpcb.cpp b/gerbview/initpcb.cpp index 2c84644919..0efef5b750 100644 --- a/gerbview/initpcb.cpp +++ b/gerbview/initpcb.cpp @@ -39,7 +39,7 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query ) { - int layer; + LAYER_NUM layer; if( GetLayout() == NULL ) return false; @@ -52,7 +52,7 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query ) GetLayout()->m_Drawings.DeleteAll(); - for( layer = 0; layer < GERBVIEW_LAYER_COUNT; layer++ ) + for( layer = FIRST_LAYER; layer < NB_GERBER_LAYERS; ++layer ) { if( g_GERBER_List[layer] ) { @@ -65,7 +65,7 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query ) SetScreen( new GBR_SCREEN( GetPageSettings().GetSizeIU() ) ); - setActiveLayer(0); + setActiveLayer( FIRST_LAYER ); m_LayersManager->UpdateLayerIcons(); syncLayerBox(); return true; @@ -74,7 +74,7 @@ bool GERBVIEW_FRAME::Clear_Pcb( bool query ) void GERBVIEW_FRAME::Erase_Current_Layer( bool query ) { - int layer = getActiveLayer(); + LAYER_NUM layer = getActiveLayer(); wxString msg; msg.Printf( _( "Clear layer %d?" ), layer + 1 ); diff --git a/gerbview/locate.cpp b/gerbview/locate.cpp index 38261076a4..4a16337f68 100644 --- a/gerbview/locate.cpp +++ b/gerbview/locate.cpp @@ -46,7 +46,7 @@ GERBER_DRAW_ITEM* GERBVIEW_FRAME::Locate( const wxPoint& aPosition, int aTypeloc if( aTypeloc == CURSEUR_ON_GRILLE ) ref = GetScreen()->GetNearestGridPosition( ref ); - int layer = getActiveLayer(); + LAYER_NUM layer = getActiveLayer(); // Search first on active layer GERBER_DRAW_ITEM* gerb_item = GetItemsList(); diff --git a/gerbview/readgerb.cpp b/gerbview/readgerb.cpp index 3c89f21c08..45f0541b32 100644 --- a/gerbview/readgerb.cpp +++ b/gerbview/readgerb.cpp @@ -24,7 +24,7 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName, wxString msg; char* text; - int layer; /* current layer used in GerbView */ + LAYER_NUM layer; // current layer used in GerbView layer = getActiveLayer(); diff --git a/gerbview/rs274d.cpp b/gerbview/rs274d.cpp index 1256aeaae3..e7681bbedd 100644 --- a/gerbview/rs274d.cpp +++ b/gerbview/rs274d.cpp @@ -88,7 +88,7 @@ void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem, APERTURE_T aAperture, int Dcode_index, - int aLayer, + LAYER_NUM aLayer, const wxPoint& aPos, wxSize aSize, bool aLayerNegative ) @@ -140,7 +140,7 @@ void fillFlashedGBRITEM( GERBER_DRAW_ITEM* aGbrItem, */ void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index, - int aLayer, + LAYER_NUM aLayer, const wxPoint& aStart, const wxPoint& aEnd, wxSize aPenSize, @@ -189,7 +189,7 @@ void fillLineGBRITEM( GERBER_DRAW_ITEM* aGbrItem, * false when arc is inside one quadrant * @param aLayerNegative = true if the current layer is negative */ -static void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index, int aLayer, +static void fillArcGBRITEM( GERBER_DRAW_ITEM* aGbrItem, int Dcode_index, LAYER_NUM aLayer, const wxPoint& aStart, const wxPoint& aEnd, const wxPoint& aRelCenter, wxSize aPenSize, bool aClockwise, bool aMultiquadrant, @@ -328,7 +328,7 @@ static void fillArcPOLY( GERBER_DRAW_ITEM* aGbrItem, aGbrItem->SetLayerPolarity( aLayerNegative ); - fillArcGBRITEM( &dummyGbrItem, 0, 0, + fillArcGBRITEM( &dummyGbrItem, 0, FIRST_LAYER, aStart, aEnd, rel_center, wxSize(0, 0), aClockwise, aMultiquadrant, aLayerNegative ); @@ -549,7 +549,7 @@ bool GERBER_IMAGE::Execute_DCODE_Command( char*& text, int D_commande ) GERBER_DRAW_ITEM* gbritem; GBR_LAYOUT* layout = m_Parent->GetLayout(); - int activeLayer = m_Parent->getActiveLayer(); + LAYER_NUM activeLayer = m_Parent->getActiveLayer(); int dcode = 0; D_CODE* tool = NULL; diff --git a/gerbview/select_layers_to_pcb.cpp b/gerbview/select_layers_to_pcb.cpp index a8a3c8d756..def5128ef1 100644 --- a/gerbview/select_layers_to_pcb.cpp +++ b/gerbview/select_layers_to_pcb.cpp @@ -35,12 +35,12 @@ #include // Imported function -extern const wxString GetPCBDefaultLayerName( int aLayerNumber ); +extern const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber ); enum swap_layer_id { ID_LAYERS_MAP_DIALOG = ID_GERBER_END_LIST, ID_BUTTON_0, - ID_TEXT_0 = ID_BUTTON_0 + GERBVIEW_LAYER_COUNT + ID_TEXT_0 = ID_BUTTON_0 + NB_GERBER_LAYERS }; @@ -54,7 +54,7 @@ int LAYERS_MAP_DIALOG::m_exportBoardCopperLayersCount = 2; BEGIN_EVENT_TABLE( LAYERS_MAP_DIALOG, LAYERS_MAP_DIALOG_BASE ) - EVT_COMMAND_RANGE( ID_BUTTON_0, ID_BUTTON_0 + GERBVIEW_LAYER_COUNT-1, + EVT_COMMAND_RANGE( ID_BUTTON_0, ID_BUTTON_0 + NB_GERBER_LAYERS-1, wxEVT_COMMAND_BUTTON_CLICKED, LAYERS_MAP_DIALOG::OnSelectLayer ) END_EVENT_TABLE() @@ -102,11 +102,11 @@ void LAYERS_MAP_DIALOG::initDialog() // the above code should be modified as required in the event that those // buttons should be some other size in that version. - for( int ii = 0; ii < GERBVIEW_LAYER_COUNT; ii++ ) + for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii ) { // Specify the default value for each member of these arrays. m_buttonTable[ii] = -1; - m_layersLookUpTable[ii] = LAYER_UNSELECTED; + m_layersLookUpTable[ii] = UNSELECTED_LAYER; } // Ensure we have: @@ -118,9 +118,9 @@ void LAYERS_MAP_DIALOG::initDialog() int idx = ( m_exportBoardCopperLayersCount / 2 ) - 1; m_comboCopperLayersCount->SetSelection( idx ); - int pcb_layer_num = 0; + LAYER_NUM pcb_layer_num = FIRST_LAYER; m_itemsCount = 0; - for( int ii = 0; ii < GERBVIEW_LAYER_COUNT; ii++ ) + for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii ) { if( g_GERBER_List[ii] == NULL ) continue; @@ -132,10 +132,10 @@ void LAYERS_MAP_DIALOG::initDialog() m_buttonTable[m_itemsCount] = ii; m_layersLookUpTable[ii] = pcb_layer_num; m_itemsCount++; - pcb_layer_num++; + ++pcb_layer_num; } - if( m_itemsCount <= GERBVIEW_LAYER_COUNT/2 ) // Only one list is enough + if( m_itemsCount <= NB_GERBER_LAYERS/2 ) // Only one list is enough { m_staticlineSep->Hide(); } @@ -177,7 +177,7 @@ void LAYERS_MAP_DIALOG::initDialog() // is nb_items; otherwise, the number of rows is 16 (with two // separate columns of controls being used if nb_items > 16). - if( ii == GERBVIEW_LAYER_COUNT/2 ) + if( ii == NB_GERBER_LAYERS/2 ) flexColumnBoxSizer = m_flexRightColumnBoxSizer; // Provide a text string to identify the Gerber layer @@ -225,7 +225,7 @@ void LAYERS_MAP_DIALOG::initDialog() wxDefaultSize, 0 ); goodSize = text->GetSize(); - for( int jj = 0; jj < BOARD_LAYERS_MAX_COUNT; jj++ ) + for( LAYER_NUM jj = FIRST_LAYER; jj < NB_LAYERS; ++jj ) { text->SetLabel( GetPCBDefaultLayerName( jj ) ); if( goodSize.x < text->GetSize().x ) @@ -258,8 +258,8 @@ void LAYERS_MAP_DIALOG::normalizeBrdLayersCount() if( ( m_exportBoardCopperLayersCount & 1 ) ) m_exportBoardCopperLayersCount++; - if( m_exportBoardCopperLayersCount > BOARD_COPPER_LAYERS_MAX_COUNT ) - m_exportBoardCopperLayersCount = BOARD_COPPER_LAYERS_MAX_COUNT; + if( m_exportBoardCopperLayersCount > NB_LAYERS ) + m_exportBoardCopperLayersCount = NB_LAYERS; if( m_exportBoardCopperLayersCount < 2 ) m_exportBoardCopperLayersCount = 2; @@ -281,8 +281,9 @@ void LAYERS_MAP_DIALOG::OnBrdLayersCountSelection( wxCommandEvent& event ) void LAYERS_MAP_DIALOG::OnResetClick( wxCommandEvent& event ) { wxString msg; - int ii, layer; - for( ii = 0, layer = 0; ii < m_itemsCount; ii++, layer++ ) + int ii; + LAYER_NUM layer; + for( ii = 0, layer = FIRST_LAYER; ii < m_itemsCount; ii++, ++layer ) { if( (layer == m_exportBoardCopperLayersCount - 1) && (m_exportBoardCopperLayersCount > 1) ) @@ -304,7 +305,7 @@ void LAYERS_MAP_DIALOG::OnStoreSetup( wxCommandEvent& event ) config->Write( wxT("BrdLayersCount"), m_exportBoardCopperLayersCount ); wxString key; - for( int ii = 0; ii < GERBVIEW_LAYER_COUNT; ii++ ) + for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii ) { key.Printf( wxT("GbrLyr%dToPcb"), ii ); config->Write( key, m_layersLookUpTable[ii] ); @@ -322,16 +323,18 @@ void LAYERS_MAP_DIALOG::OnGetSetup( wxCommandEvent& event ) m_comboCopperLayersCount->SetSelection( idx ); wxString key; - for( int ii = 0; ii < GERBVIEW_LAYER_COUNT; ii++ ) + for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii ) { key.Printf( wxT("GbrLyr%dToPcb"), ii ); - config->Read( key, &m_layersLookUpTable[ii] ); + int ilayer; + config->Read( key, &ilayer); + m_layersLookUpTable[ii] = ilayer; } for( int ii = 0; ii < m_itemsCount; ii++ ) { - int layer = m_layersLookUpTable[ii]; - if( layer == LAYER_UNSELECTED ) + LAYER_NUM layer = m_layersLookUpTable[ii]; + if( layer == UNSELECTED_LAYER ) { m_layersList[ii]->SetLabel( _( "Do not export" ) ); m_layersList[ii]->SetForegroundColour( *wxBLUE ); @@ -346,29 +349,29 @@ void LAYERS_MAP_DIALOG::OnGetSetup( wxCommandEvent& event ) void LAYERS_MAP_DIALOG::OnSelectLayer( wxCommandEvent& event ) { - int ii, jj; + int ii; ii = event.GetId() - ID_BUTTON_0; - if( (ii < 0) || (ii >= GERBVIEW_LAYER_COUNT) ) + if( (ii < FIRST_LAYER) || (ii >= NB_GERBER_LAYERS) ) { wxFAIL_MSG( wxT("Bad layer id") ); return; } - jj = m_layersLookUpTable[m_buttonTable[ii]]; - if( ( jj < 0 ) || ( jj > LAYER_UNSELECTED ) ) + LAYER_NUM jj = m_layersLookUpTable[m_buttonTable[ii]]; + if( ( jj < FIRST_LAYER ) || ( jj > NB_LAYERS ) ) jj = LAYER_N_BACK; // (Defaults to "Copper" layer.) jj = m_Parent->SelectPCBLayer( jj, m_exportBoardCopperLayersCount, true ); - if( ( jj < 0 ) || ( jj > LAYER_UNSELECTED ) ) + if( ( jj < FIRST_LAYER ) || ( jj > NB_LAYERS ) ) return; if( jj != m_layersLookUpTable[m_buttonTable[ii]] ) { m_layersLookUpTable[m_buttonTable[ii]] = jj; - if( jj == LAYER_UNSELECTED ) + if( jj == UNSELECTED_LAYER ) { m_layersList[ii]->SetLabel( _( "Do not export" ) ); @@ -402,7 +405,7 @@ void LAYERS_MAP_DIALOG::OnOkClick( wxCommandEvent& event ) normalizeBrdLayersCount(); int inner_layer_max = 0; - for( int ii = 0; ii < GERBVIEW_LAYER_COUNT; ii++ ) + for( LAYER_NUM ii = FIRST_LAYER; ii < NB_GERBER_LAYERS; ++ii ) { if( m_layersLookUpTable[ii] < LAYER_N_FRONT ) { @@ -420,6 +423,7 @@ void LAYERS_MAP_DIALOG::OnOkClick( wxCommandEvent& event ) _("The exported board has not enough copper layers to handle selected inner layers") ); return; } - m_layersLookUpTable[GERBVIEW_LAYER_COUNT] = m_exportBoardCopperLayersCount; + // XXX EVIL usage of LAYER + m_layersLookUpTable[NB_GERBER_LAYERS] = m_exportBoardCopperLayersCount; EndModal( wxID_OK ); } diff --git a/gerbview/select_layers_to_pcb.h b/gerbview/select_layers_to_pcb.h index 47d3155743..b2040c9354 100644 --- a/gerbview/select_layers_to_pcb.h +++ b/gerbview/select_layers_to_pcb.h @@ -24,7 +24,7 @@ private: static int m_exportBoardCopperLayersCount; wxFlexGridSizer* m_flexRightColumnBoxSizer; // An extra wxFlexGridSizer used // when we have more than 16 gerber files loaded - int m_layersLookUpTable[32+1]; // Indexes Gerber layers to PCB file layers + LAYER_NUM m_layersLookUpTable[int(NB_LAYERS)+1]; // Indexes Gerber layers to PCB file layers // the last value in table is the number of copper layers int m_buttonTable[32]; // Indexes buttons to Gerber layers wxStaticText* m_layersList[32]; // Indexes text strings to buttons @@ -32,7 +32,7 @@ private: public: LAYERS_MAP_DIALOG( GERBVIEW_FRAME* parent ); ~LAYERS_MAP_DIALOG() {}; - int * GetLayersLookUpTable() { return m_layersLookUpTable; } + LAYER_NUM * GetLayersLookUpTable() { return m_layersLookUpTable; } int GetCopperLayersCount() { return m_exportBoardCopperLayersCount; } private: diff --git a/gerbview/toolbars_gerber.cpp b/gerbview/toolbars_gerber.cpp index 820980ee1c..2247e83f51 100644 --- a/gerbview/toolbars_gerber.cpp +++ b/gerbview/toolbars_gerber.cpp @@ -291,7 +291,7 @@ void GERBVIEW_FRAME::OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent ) void GERBVIEW_FRAME::OnUpdateSelectDCode( wxUpdateUIEvent& aEvent ) { - int layer = getActiveLayer(); + LAYER_NUM layer = getActiveLayer(); GERBER_IMAGE* gerber = g_GERBER_List[layer]; int selected = ( gerber ) ? gerber->m_Selected_Tool : 0; diff --git a/include/class_board_design_settings.h b/include/class_board_design_settings.h index bcf6e6b651..3fed1d53c5 100644 --- a/include/class_board_design_settings.h +++ b/include/class_board_design_settings.h @@ -78,10 +78,10 @@ public: * @param aLayerIndex = The index of the layer to be tested * @return bool - true if the layer is visible. */ - bool IsLayerVisible( int aLayerIndex ) const + bool IsLayerVisible( LAYER_NUM aLayerIndex ) const { // @@IMB: Altough Pcbnew uses only 29, GerbView uses all 32 layers - if( aLayerIndex < 0 || aLayerIndex >= 32 ) + if( aLayerIndex < FIRST_LAYER || aLayerIndex >= NB_LAYERS ) return false; // If a layer is disabled, it is automatically invisible @@ -94,7 +94,7 @@ public: * @param aLayerIndex = The index of the layer to be changed * @param aNewState = The new visibility state of the layer */ - void SetLayerVisibility( int aLayerIndex, bool aNewState ); + void SetLayerVisibility( LAYER_NUM aLayerIndex, bool aNewState ); /** * Function GetVisibleElements @@ -161,7 +161,7 @@ public: * @param aLayerIndex = The index of the layer to be tested * @return bool - true if the layer is enabled */ - bool IsLayerEnabled( int aLayerIndex ) const + bool IsLayerEnabled( LAYER_NUM aLayerIndex ) const { return bool( m_EnabledLayers & GetLayerMask( aLayerIndex ) ); } diff --git a/include/class_board_item.h b/include/class_board_item.h index 99b36d54f7..586490e5f6 100644 --- a/include/class_board_item.h +++ b/include/class_board_item.h @@ -78,13 +78,13 @@ class BOARD_ITEM : public EDA_ITEM void SetBack( EDA_ITEM* aBack ) { Pback = aBack; } protected: - int m_Layer; + LAYER_NUM m_Layer; public: BOARD_ITEM( BOARD_ITEM* aParent, KICAD_T idtype ) : EDA_ITEM( aParent, idtype ) - , m_Layer( 0 ) + , m_Layer( FIRST_LAYER ) { } @@ -103,7 +103,7 @@ public: * Function GetLayer * returns the layer this item is on. */ - int GetLayer() const { return m_Layer; } + LAYER_NUM GetLayer() const { return m_Layer; } /** * Function SetLayer @@ -112,7 +112,7 @@ public: * is virtual because some items (in fact: class DIMENSION) * have a slightly different initialization */ - virtual void SetLayer( int aLayer ) { m_Layer = aLayer; } + virtual void SetLayer( LAYER_NUM aLayer ) { m_Layer = aLayer; } /** * Function Draw @@ -129,7 +129,7 @@ public: * @param aLayer The layer to test for. * @return bool - true if on given layer, else false. */ - virtual bool IsOnLayer( int aLayer ) const + virtual bool IsOnLayer( LAYER_NUM aLayer ) const { return m_Layer == aLayer; } diff --git a/include/class_colors_design_settings.h b/include/class_colors_design_settings.h index b2149a1149..5813b82676 100644 --- a/include/class_colors_design_settings.h +++ b/include/class_colors_design_settings.h @@ -7,6 +7,7 @@ #define _COLORS_DESIGN_SETTING_H #include +// XXX shouldn't these come from somewhere else? #define LAYERSCOLORSBUFFERSIZE 32 #define ITEMSCOLORSBUFFERSIZE 32 @@ -33,14 +34,14 @@ public: * @return the color for aLayer which is one of the layer indices given * in pcbstruct.h or in schematic */ - EDA_COLOR_T GetLayerColor( int aLayer ) const; + EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const; /** * Function SetLayerColor * sets the color for aLayer which is one of the layer indices given * in pcbstruct.h or in schematic */ - void SetLayerColor( int aLayer, EDA_COLOR_T aColor ); + void SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor ); /** * Function GetItemColor diff --git a/include/class_layer_box_selector.h b/include/class_layer_box_selector.h index 23ba970766..e7248584aa 100644 --- a/include/class_layer_box_selector.h +++ b/include/class_layer_box_selector.h @@ -35,24 +35,24 @@ public: // Returns a color index from the layer id // Virtual function because GerbView uses its own functions in a derived class - virtual EDA_COLOR_T GetLayerColor( int aLayerIndex ) const = 0; + virtual EDA_COLOR_T GetLayerColor( LAYER_NUM aLayerIndex ) const = 0; // Returns the name of the layer id // Virtual pure function because GerbView uses its own functions in a derived class - virtual wxString GetLayerName( int aLayerIndex ) const = 0; + virtual wxString GetLayerName( LAYER_NUM aLayerIndex ) const = 0; // Returns true if the layer id is enabled (i.e. is it should be displayed) // Virtual function pure because GerbView uses its own functions in a derived class - virtual bool IsLayerEnabled( int aLayerIndex ) const = 0; + virtual bool IsLayerEnabled( LAYER_NUM aLayerIndex ) const = 0; // Get Current Item # int GetChoice(); // Get Current Layer - int GetLayerSelection(); + LAYER_NUM GetLayerSelection() const; // Set Layer # - int SetLayerSelection(int layer); + int SetLayerSelection(LAYER_NUM layer); // Reload the Layers // Virtual pure function because GerbView uses its own functions in a derived class @@ -66,10 +66,10 @@ public: protected: // Fills the layer bitmap aLayerbmp with the layer color - void SetBitmapLayer( wxBitmap& aLayerbmp, int aLayerIndex ); + void SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayerIndex ); }; -#define DECLARE_LAYERS_HOTKEY(list) int list[LAYER_COUNT] = \ +#define DECLARE_LAYERS_HOTKEY(list) int list[NB_LAYERS] = \ { \ HK_SWITCH_LAYER_TO_COPPER, \ HK_SWITCH_LAYER_TO_INNER1, \ diff --git a/include/class_pcb_screen.h b/include/class_pcb_screen.h index c7381f32af..e15082be40 100644 --- a/include/class_pcb_screen.h +++ b/include/class_pcb_screen.h @@ -17,9 +17,9 @@ class UNDO_REDO_CONTAINER; class PCB_SCREEN : public BASE_SCREEN { public: - int m_Active_Layer; - int m_Route_Layer_TOP; - int m_Route_Layer_BOTTOM; + LAYER_NUM m_Active_Layer; + LAYER_NUM m_Route_Layer_TOP; + LAYER_NUM m_Route_Layer_BOTTOM; public: diff --git a/include/layers_id_colors_and_visibility.h b/include/layers_id_colors_and_visibility.h index c6e703fa8f..acae0e041f 100644 --- a/include/layers_id_colors_and_visibility.h +++ b/include/layers_id_colors_and_visibility.h @@ -30,10 +30,17 @@ #ifndef _LAYERS_ID_AND_VISIBILITY_H_ #define _LAYERS_ID_AND_VISIBILITY_H_ -#include // wxASSERT +/* NOTE: the idea here is to have LAYER_NUM and LAYER_MSK as abstract + * type as possible (even if they're currently implemented as int and + * unsigned int, respectively). In this way it would be reasonably easy + * to overcome the current 32 layer limit. For example switching to a 64 + * bit mask or even some kind of bit array */ /* Layer identification (layer number) */ +typedef int LAYER_NUM; #define UNDEFINED_LAYER -1 +#define NO_LAYER 0 +#define FIRST_LAYER 0 #define FIRST_COPPER_LAYER 0 #define LAYER_N_BACK 0 #define LAYER_N_2 1 @@ -52,9 +59,9 @@ #define LAYER_N_15 14 #define LAYER_N_FRONT 15 #define LAST_COPPER_LAYER LAYER_N_FRONT -#define NB_COPPER_LAYERS (LAST_COPPER_LAYER + 1) +#define NB_COPPER_LAYERS (LAST_COPPER_LAYER - FIRST_COPPER_LAYER + 1) -#define FIRST_NO_COPPER_LAYER 16 +#define FIRST_NON_COPPER_LAYER 16 #define ADHESIVE_N_BACK 16 #define ADHESIVE_N_FRONT 17 #define SOLDERPASTE_N_BACK 18 @@ -68,13 +75,14 @@ #define ECO1_N 26 #define ECO2_N 27 #define EDGE_N 28 -#define LAST_NO_COPPER_LAYER 28 +#define LAST_NON_COPPER_LAYER 28 +#define NB_PCB_LAYERS (LAST_NON_COPPER_LAYER + 1) #define UNUSED_LAYER_29 29 #define UNUSED_LAYER_30 30 #define UNUSED_LAYER_31 31 -#define NB_LAYERS (LAST_NO_COPPER_LAYER + 1) - -#define LAYER_COUNT 32 +#define NB_GERBER_LAYERS 32 +#define NB_LAYERS 32 +#define UNSELECTED_LAYER 32 // Masks to identify a layer by a bit map typedef unsigned LAYER_MSK; @@ -108,9 +116,6 @@ typedef unsigned LAYER_MSK; #define ECO2_LAYER (1 << ECO2_N) #define EDGE_LAYER (1 << EDGE_N) -#define FIRST_NON_COPPER_LAYER ADHESIVE_N_BACK -#define LAST_NON_COPPER_LAYER EDGE_N - // extra bits 0xE0000000 /* Helpful global layers mask : */ #define ALL_LAYERS 0x1FFFFFFF // Pcbnew used 29 layers @@ -124,9 +129,8 @@ typedef unsigned LAYER_MSK; /** return a one bit layer mask from a layer number * aLayerNumber = the layer number to convert (0 .. LAYERS-1) */ -inline LAYER_MSK GetLayerMask( unsigned aLayerNumber ) +inline LAYER_MSK GetLayerMask( LAYER_NUM aLayerNumber ) { - wxASSERT( aLayerNumber < LAYER_COUNT && aLayerNumber >= 0 ); return 1 << aLayerNumber; } @@ -135,7 +139,7 @@ inline LAYER_MSK GetLayerMask( unsigned aLayerNumber ) // layers order in dialogs (plot, print and toolbars) // in same order than in setup layers dialog // (Front or Top to Back or Bottom) -#define DECLARE_LAYERS_ORDER_LIST(list) int list[LAYER_COUNT] =\ +#define DECLARE_LAYERS_ORDER_LIST(list) LAYER_NUM list[NB_LAYERS] =\ { LAYER_N_FRONT,\ LAYER_N_15, LAYER_N_14, LAYER_N_13, LAYER_N_12,\ LAYER_N_11, LAYER_N_10, LAYER_N_9, LAYER_N_8,\ @@ -186,14 +190,14 @@ enum PCB_VISIBLE /** - * Function IsValidLayerIndex + * Function IsValidPcbLayerIndex * tests whether a given integer is a valid layer index * @param aLayerIndex = Layer index to test * @return true if aLayerIndex is a valid layer index */ -inline bool IsValidLayerIndex( int aLayerIndex ) +inline bool IsValidPcbLayerIndex( LAYER_NUM aLayerIndex ) { - return aLayerIndex >= 0 && aLayerIndex < NB_LAYERS; + return aLayerIndex >= FIRST_LAYER && aLayerIndex < NB_PCB_LAYERS; } /** @@ -202,7 +206,7 @@ inline bool IsValidLayerIndex( int aLayerIndex ) * @param aLayerIndex = Layer index to test * @return true if aLayerIndex is a valid copper layer index */ -inline bool IsValidCopperLayerIndex( int aLayerIndex ) +inline bool IsValidCopperLayerIndex( LAYER_NUM aLayerIndex ) { return aLayerIndex >= FIRST_COPPER_LAYER && aLayerIndex <= LAST_COPPER_LAYER; } @@ -213,10 +217,10 @@ inline bool IsValidCopperLayerIndex( int aLayerIndex ) * @param aLayerIndex = Layer index to test * @return true if aLayerIndex is a valid non copper layer index */ -inline bool IsValidNonCopperLayerIndex( int aLayerIndex ) +inline bool IsValidNonCopperLayerIndex( LAYER_NUM aLayerIndex ) { - return aLayerIndex >= FIRST_NO_COPPER_LAYER - && aLayerIndex <= LAST_NO_COPPER_LAYER; + return aLayerIndex >= FIRST_NON_COPPER_LAYER + && aLayerIndex <= LAST_NON_COPPER_LAYER; } #endif // _LAYERS_ID_AND_VISIBILITY_H_ diff --git a/include/macros.h b/include/macros.h index c72863456a..f7c370f464 100644 --- a/include/macros.h +++ b/include/macros.h @@ -17,7 +17,7 @@ #define TO_UTF8( wxstring ) ( (const char*) (wxstring).utf8_str() ) /** - * Macro FROM_UTF8 + * function FROM_UTF8 * converts a UTF8 encoded C string to a wxString for all wxWidgets build modes. */ //#define FROM_UTF8( cstring ) wxString::FromUTF8( cstring ) diff --git a/include/pcbcommon.h b/include/pcbcommon.h index 6ce9572123..8f4af14fc0 100644 --- a/include/pcbcommon.h +++ b/include/pcbcommon.h @@ -7,7 +7,7 @@ #include -#include // LAYER_COUNT and NB_COPPER_LAYERS definitions. +#include #define MIN_DRAW_WIDTH 1 ///< Minimum trace drawing width. diff --git a/include/sch_item_struct.h b/include/sch_item_struct.h index 42e6496715..3f71041b4d 100644 --- a/include/sch_item_struct.h +++ b/include/sch_item_struct.h @@ -83,6 +83,7 @@ enum DANGLING_END_T { */ class DANGLING_END_ITEM { +private: /// A pointer to the connectable object. const void* m_item; diff --git a/include/wxBasePcbFrame.h b/include/wxBasePcbFrame.h index 8903f6f904..cdc7b19cf7 100644 --- a/include/wxBasePcbFrame.h +++ b/include/wxBasePcbFrame.h @@ -597,9 +597,9 @@ public: // layerhandling: // (See pcbnew/sel_layer.cpp for description of why null_layer parameter // is provided) - int SelectLayer( int default_layer, int min_layer, int max_layer, bool null_layer = false ); + LAYER_NUM SelectLayer( LAYER_NUM default_layer, LAYER_NUM min_layer, LAYER_NUM max_layer, bool null_layer = false ); void SelectLayerPair(); - virtual void SwitchLayer( wxDC* DC, int layer ); + virtual void SwitchLayer( wxDC* DC, LAYER_NUM layer ); void InstallGridFrame( const wxPoint& pos ); diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index fdd36da6a0..5ba16dc3e6 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -113,7 +113,7 @@ protected: * will change the currently active layer to \a aLayer and also * update the PCB_LAYER_WIDGET. */ - void setActiveLayer( int aLayer, bool doLayerWidgetUpdate = true ) + void setActiveLayer( LAYER_NUM aLayer, bool doLayerWidgetUpdate = true ) { ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = aLayer; @@ -125,7 +125,7 @@ protected: * Function getActiveLayer * returns the active layer */ - int getActiveLayer() + LAYER_NUM getActiveLayer() { return ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer; } @@ -1206,7 +1206,7 @@ public: bool MergeCollinearTracks( TRACK* track, wxDC* DC, int end ); void Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC ); - void SwitchLayer( wxDC* DC, int layer ); + void SwitchLayer( wxDC* DC, LAYER_NUM layer ); /** * Function Add45DegreeSegment @@ -1406,7 +1406,7 @@ public: DRAWSEGMENT* Begin_DrawSegment( DRAWSEGMENT* Segment, STROKE_T shape, wxDC* DC ); void End_Edge( DRAWSEGMENT* Segment, wxDC* DC ); void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ); - void Delete_Drawings_All_Layer( int aLayer ); + void Delete_Drawings_All_Layer( LAYER_NUM aLayer ); // Dimension handling: void ShowDimensionPropertyDialog( DIMENSION* aDimension, wxDC* aDC ); diff --git a/pcbnew/autorouter/autoplac.cpp b/pcbnew/autorouter/autoplac.cpp index 431e25bf8a..ce7d5bb9d8 100644 --- a/pcbnew/autorouter/autoplac.cpp +++ b/pcbnew/autorouter/autoplac.cpp @@ -99,7 +99,7 @@ void PCB_EDIT_FRAME::AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC ) wxPoint PosOK; wxPoint memopos; int error; - int lay_tmp_TOP, lay_tmp_BOTTOM; + LAYER_NUM lay_tmp_TOP, lay_tmp_BOTTOM; // Undo: init list PICKED_ITEMS_LIST newList; @@ -457,7 +457,7 @@ int PCB_EDIT_FRAME::GenPlaceBoard() /* Place the edge layer segments */ TRACK TmpSegm( NULL ); - TmpSegm.SetLayer( -1 ); + TmpSegm.SetLayer( UNDEFINED_LAYER ); TmpSegm.SetNet( -1 ); TmpSegm.SetWidth( RoutingMatrix.m_GridRouting / 2 ); diff --git a/pcbnew/autorouter/routing_matrix.cpp b/pcbnew/autorouter/routing_matrix.cpp index 5508ffda70..5ed0f91e4b 100644 --- a/pcbnew/autorouter/routing_matrix.cpp +++ b/pcbnew/autorouter/routing_matrix.cpp @@ -240,7 +240,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag ) tmpSegm.SetLayer( edge->GetLayer() ); if( tmpSegm.GetLayer() == EDGE_N ) - tmpSegm.SetLayer( -1 ); + tmpSegm.SetLayer( UNDEFINED_LAYER ); tmpSegm.SetStart( edge->GetStart() ); tmpSegm.SetEnd( edge->GetEnd() ); @@ -275,7 +275,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag ) if( DrawSegm->GetLayer() == EDGE_N ) { - tmpSegm.SetLayer( -1 ); + tmpSegm.SetLayer( UNDEFINED_LAYER ); type_cell |= CELL_is_EDGE; } diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index c35d951f86..a4eedd1c48 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -305,9 +305,9 @@ void PCB_BASE_FRAME::Show3D_Frame( wxCommandEvent& event ) // Note: virtual, overridden in PCB_EDIT_FRAME; -void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, int layer ) +void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, LAYER_NUM layer ) { - int preslayer = ((PCB_SCREEN*)GetScreen())->m_Active_Layer; + LAYER_NUM preslayer = ((PCB_SCREEN*)GetScreen())->m_Active_Layer; // Check if the specified layer matches the present layer if( layer == preslayer ) diff --git a/pcbnew/block.cpp b/pcbnew/block.cpp index a95a6c159e..88e96f8abf 100644 --- a/pcbnew/block.cpp +++ b/pcbnew/block.cpp @@ -393,7 +393,7 @@ void PCB_EDIT_FRAME::Block_SelectItems() { for( MODULE* module = m_Pcb->m_Modules; module != NULL; module = module->Next() ) { - int layer = module->GetLayer(); + LAYER_NUM layer = module->GetLayer(); if( module->HitTest( GetScreen()->m_BlockLocate ) && ( !module->IsLocked() || blockIncludeLockedModules ) ) diff --git a/pcbnew/board_undo_redo.cpp b/pcbnew/board_undo_redo.cpp index 8a03a3002f..88cfaa49b1 100644 --- a/pcbnew/board_undo_redo.cpp +++ b/pcbnew/board_undo_redo.cpp @@ -198,7 +198,7 @@ void SwapData( BOARD_ITEM* aItem, BOARD_ITEM* aImage ) if( aItem->Type() != PCB_MODULE_T && aItem->Type() != PCB_ZONE_AREA_T ) { // These items have a global swap function. - int layer, layerimg; + LAYER_NUM layer, layerimg; layer = aItem->GetLayer(); layerimg = aImage->GetLayer(); aItem->SetLayer( layerimg ); diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 7ccfdb71d8..a71bbef987 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -75,7 +75,7 @@ BOARD::BOARD() : BuildListOfNets(); // prepare pad and netlist containers. - for( int layer = 0; layer < LAYER_COUNT; ++layer ) + for( LAYER_NUM layer = FIRST_LAYER; layer < NB_LAYERS; ++layer ) { m_Layer[layer].m_Name = GetStandardLayerName( layer ); @@ -344,7 +344,7 @@ int BOARD::GetCurrentMicroViaDrill() } -bool BOARD::SetLayer( int aIndex, const LAYER& aLayer ) +bool BOARD::SetLayer( LAYER_NUM aIndex, const LAYER& aLayer ) { if( aIndex < NB_COPPER_LAYERS ) { @@ -356,9 +356,9 @@ bool BOARD::SetLayer( int aIndex, const LAYER& aLayer ) } -wxString BOARD::GetLayerName( int aLayerIndex ) const +wxString BOARD::GetLayerName( LAYER_NUM aLayerIndex ) const { - if( !IsValidLayerIndex( aLayerIndex ) ) + if( !IsValidPcbLayerIndex( aLayerIndex ) ) return wxEmptyString; // All layer names are stored in the BOARD. @@ -368,7 +368,7 @@ wxString BOARD::GetLayerName( int aLayerIndex ) const // over-ridden by BOARD::SetLayerName(). // For copper layers, return the actual copper layer name, // otherwise return the Standard English layer name. - if( aLayerIndex < FIRST_NO_COPPER_LAYER ) + if( aLayerIndex < FIRST_NON_COPPER_LAYER ) return m_Layer[aLayerIndex].m_Name; } @@ -376,7 +376,7 @@ wxString BOARD::GetLayerName( int aLayerIndex ) const } -wxString BOARD::GetStandardLayerName( int aLayerNumber ) +wxString BOARD::GetStandardLayerName( LAYER_NUM aLayerNumber ) { const wxChar* txt; @@ -422,7 +422,7 @@ wxString BOARD::GetStandardLayerName( int aLayerNumber ) } -bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName ) +bool BOARD::SetLayerName( LAYER_NUM aLayerIndex, const wxString& aLayerName ) { if( !IsValidCopperLayerIndex( aLayerIndex ) ) return false; @@ -441,7 +441,7 @@ bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName ) if( IsLayerEnabled( aLayerIndex ) ) { - for( int i = 0; i < NB_COPPER_LAYERS; i++ ) + for( LAYER_NUM i = FIRST_COPPER_LAYER; i < NB_COPPER_LAYERS; ++i ) { if( i != aLayerIndex && IsLayerEnabled( i ) && NameTemp == m_Layer[i].m_Name ) return false; @@ -456,7 +456,7 @@ bool BOARD::SetLayerName( int aLayerIndex, const wxString& aLayerName ) } -LAYER_T BOARD::GetLayerType( int aLayerIndex ) const +LAYER_T BOARD::GetLayerType( LAYER_NUM aLayerIndex ) const { if( !IsValidCopperLayerIndex( aLayerIndex ) ) return LT_SIGNAL; @@ -470,7 +470,7 @@ LAYER_T BOARD::GetLayerType( int aLayerIndex ) const } -bool BOARD::SetLayerType( int aLayerIndex, LAYER_T aLayerType ) +bool BOARD::SetLayerType( LAYER_NUM aLayerIndex, LAYER_T aLayerType ) { if( !IsValidCopperLayerIndex( aLayerIndex ) ) return false; @@ -574,7 +574,7 @@ void BOARD::SetVisibleElements( int aMask ) for( int ii = 0; ii < PCB_VISIBLE( END_PCB_VISIBLE_LIST ); ii++ ) { int item_mask = 1 << ii; - SetElementVisibility( ii, bool( aMask & item_mask ) ); + SetElementVisibility( ii, aMask & item_mask ); } } @@ -683,19 +683,19 @@ void BOARD::SetVisibleElementColor( int aPCB_VISIBLE, EDA_COLOR_T aColor ) } -void BOARD::SetLayerColor( int aLayer, EDA_COLOR_T aColor ) +void BOARD::SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor ) { GetColorsSettings()->SetLayerColor( aLayer, aColor ); } -EDA_COLOR_T BOARD::GetLayerColor( int aLayer ) const +EDA_COLOR_T BOARD::GetLayerColor( LAYER_NUM aLayer ) const { return GetColorsSettings()->GetLayerColor( aLayer ); } -bool BOARD::IsModuleLayerVisible( int layer ) +bool BOARD::IsModuleLayerVisible( LAYER_NUM layer ) { if( layer==LAYER_N_FRONT ) return IsElementVisible( PCB_VISIBLE(MOD_FR_VISIBLE) ); @@ -1195,16 +1195,16 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData, /* now using PcbGeneralLocateAndDisplay(), but this remains a useful example * of how the INSPECTOR can be used in a lightweight way. * // see pcbstruct.h - * BOARD_ITEM* BOARD::FindPadOrModule( const wxPoint& refPos, int layer ) + * BOARD_ITEM* BOARD::FindPadOrModule( const wxPoint& refPos, LAYER_NUM layer ) * { * class PadOrModule : public INSPECTOR * { * public: * BOARD_ITEM* found; - * int layer; + * LAYER_NUM layer; * int layer_mask; * - * PadOrModule( int alayer ) : + * PadOrModule( LAYER_NUM alayer ) : * found(0), layer(alayer), layer_mask( g_TabOneLayerMask[alayer] ) * {} * @@ -1437,7 +1437,7 @@ int BOARD::ReturnSortedNetnamesList( wxArrayString& aNames, bool aSortbyPadsCoun } -void BOARD::RedrawAreasOutlines( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, int aLayer ) +void BOARD::RedrawAreasOutlines( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, LAYER_NUM aLayer ) { if( !aDC ) return; @@ -1452,7 +1452,7 @@ void BOARD::RedrawAreasOutlines( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE a } -void BOARD::RedrawFilledAreas( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, int aLayer ) +void BOARD::RedrawFilledAreas( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, LAYER_NUM aLayer ) { if( !aDC ) return; @@ -1468,8 +1468,8 @@ void BOARD::RedrawFilledAreas( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDr ZONE_CONTAINER* BOARD::HitTestForAnyFilledArea( const wxPoint& aRefPos, - int aStartLayer, - int aEndLayer ) + LAYER_NUM aStartLayer, + LAYER_NUM aEndLayer ) { if( aEndLayer < 0 ) aEndLayer = aStartLayer; @@ -1480,7 +1480,7 @@ ZONE_CONTAINER* BOARD::HitTestForAnyFilledArea( const wxPoint& aRefPos, for( unsigned ia = 0; ia < m_ZoneDescriptorList.size(); ia++ ) { ZONE_CONTAINER* area = m_ZoneDescriptorList[ia]; - int layer = area->GetLayer(); + LAYER_NUM layer = area->GetLayer(); if( (layer < aStartLayer) || (layer > aEndLayer) ) continue; @@ -1531,7 +1531,7 @@ int BOARD::SetAreasNetCodesFromNetNames( void ) } -TRACK* BOARD::GetViaByPosition( const wxPoint& aPosition, int aLayerMask ) +TRACK* BOARD::GetViaByPosition( const wxPoint& aPosition, LAYER_NUM aLayer) { TRACK* track; @@ -1546,10 +1546,10 @@ TRACK* BOARD::GetViaByPosition( const wxPoint& aPosition, int aLayerMask ) if( track->GetState( BUSY | IS_DELETED ) ) continue; - if( aLayerMask < 0 ) + if( aLayer == UNDEFINED_LAYER ) break; - if( track->IsOnLayer( aLayerMask ) ) + if( track->IsOnLayer( aLayer ) ) break; } @@ -1751,7 +1751,7 @@ TRACK* BOARD::GetTrace( TRACK* aTrace, const wxPoint& aPosition, LAYER_MSK aLaye { for( TRACK* track = aTrace; track; track = track->Next() ) { - int layer = track->GetLayer(); + LAYER_NUM layer = track->GetLayer(); if( track->GetState( BUSY | IS_DELETED ) ) continue; @@ -1893,7 +1893,7 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount, * if there are on the same layer, the via is on the selected track * if there are on different layers, the via is on an other track */ - int layer = track->GetLayer(); + LAYER_NUM layer = track->GetLayer(); while( ( track = ::GetTrace( track->Next(), NULL, via->GetStart(), layerMask ) ) != NULL ) { @@ -2018,7 +2018,7 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount, } -MODULE* BOARD::GetFootprint( const wxPoint& aPosition, int aActiveLayer, +MODULE* BOARD::GetFootprint( const wxPoint& aPosition, LAYER_NUM aActiveLayer, bool aVisibleOnly, bool aIgnoreLocked ) { MODULE* pt_module; @@ -2026,7 +2026,7 @@ MODULE* BOARD::GetFootprint( const wxPoint& aPosition, int aActiveLayer, MODULE* Altmodule = NULL; int min_dim = 0x7FFFFFFF; int alt_min_dim = 0x7FFFFFFF; - int layer; + LAYER_NUM layer; for( pt_module = m_Modules; pt_module; pt_module = (MODULE*) pt_module->Next() ) { @@ -2213,7 +2213,7 @@ void BOARD::SetTrackWidthIndex( unsigned aIndex ) ZONE_CONTAINER* BOARD::AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, - int aLayer, wxPoint aStartPointPosition, int aHatch ) + LAYER_NUM aLayer, wxPoint aStartPointPosition, int aHatch ) { ZONE_CONTAINER* new_area = InsertArea( aNetcode, m_ZoneDescriptorList.size( ) - 1, @@ -2248,7 +2248,7 @@ void BOARD::RemoveArea( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_to } -ZONE_CONTAINER* BOARD::InsertArea( int netcode, int iarea, int layer, int x, int y, int hatch ) +ZONE_CONTAINER* BOARD::InsertArea( int netcode, int iarea, LAYER_NUM layer, int x, int y, int hatch ) { ZONE_CONTAINER* new_area = new ZONE_CONTAINER( this ); diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index c397e3d05b..bd2885df42 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -188,7 +188,7 @@ private: /// edge zone descriptors, owned by pointer. ZONE_CONTAINERS m_ZoneDescriptorList; - LAYER m_Layer[LAYER_COUNT]; + LAYER m_Layer[NB_LAYERS]; // if true m_highLight_NetCode is used HIGH_LIGHT_INFO m_highLight; // current high light data HIGH_LIGHT_INFO m_highLightPrevious; // a previously stored high light data @@ -442,7 +442,7 @@ public: * @param aLayer = The layer to be tested * @return bool - true if the layer is visible. */ - bool IsLayerEnabled( int aLayer ) const + bool IsLayerEnabled( LAYER_NUM aLayer ) const { return m_designSettings.IsLayerEnabled( aLayer ); } @@ -454,7 +454,7 @@ public: * @param aLayerIndex = The index of the layer to be tested * @return bool - true if the layer is visible. */ - bool IsLayerVisible( int aLayerIndex ) const + bool IsLayerVisible( LAYER_NUM aLayerIndex ) const { return m_designSettings.IsLayerVisible( aLayerIndex ); } @@ -529,7 +529,7 @@ public: * @param layer One of the two allowed layers for modules: LAYER_N_FRONT or LAYER_N_BACK * @return bool - true if the layer is visible, else false. */ - bool IsModuleLayerVisible( int layer ); + bool IsModuleLayerVisible( LAYER_NUM layer ); /** * Function GetVisibleElementColor @@ -596,7 +596,7 @@ public: * @return wxString - the layer name, which for copper layers may * be custom, else standard. */ - wxString GetLayerName( int aLayerIndex ) const; + wxString GetLayerName( LAYER_NUM aLayerIndex ) const; /** * Function SetLayerName @@ -607,7 +607,7 @@ public: * @return bool - true if aLayerName was legal and unique among other * layer names at other layer indices and aLayerIndex was within range, else false. */ - bool SetLayerName( int aLayerIndex, const wxString& aLayerName ); + bool SetLayerName( LAYER_NUM aLayerIndex, const wxString& aLayerName ); /** * Function GetStandardLayerName @@ -620,9 +620,9 @@ public: * @return wxString - containing the layer name or "BAD INDEX" if aLayerNumber * is not legal */ - static wxString GetStandardLayerName( int aLayerNumber ); + static wxString GetStandardLayerName( LAYER_NUM aLayerNumber ); - bool SetLayer( int aIndex, const LAYER& aLayer ); + bool SetLayer( LAYER_NUM aIndex, const LAYER& aLayer ); /** * Function GetLayerType @@ -632,7 +632,7 @@ public: * @return LAYER_T - the layer type, or LAYER_T(-1) if the * index was out of range. */ - LAYER_T GetLayerType( int aLayerIndex ) const; + LAYER_T GetLayerType( LAYER_NUM aLayerIndex ) const; /** * Function SetLayerType @@ -642,19 +642,19 @@ public: * @param aLayerType The new layer type. * @return bool - true if aLayerType was legal and aLayerIndex was within range, else false. */ - bool SetLayerType( int aLayerIndex, LAYER_T aLayerType ); + bool SetLayerType( LAYER_NUM aLayerIndex, LAYER_T aLayerType ); /** * Function SetLayerColor * changes a layer color for any valid layer, including non-copper ones. */ - void SetLayerColor( int aLayer, EDA_COLOR_T aColor ); + void SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor ); /** * Function GetLayerColor * gets a layer color for any valid layer, including non-copper ones. */ - EDA_COLOR_T GetLayerColor( int aLayer ) const; + EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const; /** * Function ReturnFlippedLayerNumber @@ -662,7 +662,7 @@ public: * some (not all) layers: external copper, Mask, Paste, and solder * are swapped between front and back sides */ - static int ReturnFlippedLayerNumber( int oldlayer ); + static LAYER_NUM ReturnFlippedLayerNumber( LAYER_NUM oldlayer ); /** Functions to get some items count */ int GetNumSegmTrack() const; @@ -1005,8 +1005,8 @@ public: * @return ZONE_CONTAINER* return a pointer to the ZONE_CONTAINER found, else NULL */ ZONE_CONTAINER* HitTestForAnyFilledArea( const wxPoint& aRefPos, - int aStartLayer, - int aEndLayer = -1 ); + LAYER_NUM aStartLayer, + LAYER_NUM aEndLayer = UNDEFINED_LAYER ); /** * Function RedrawAreasOutlines @@ -1015,14 +1015,14 @@ public: void RedrawAreasOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode, - int aLayer ); + LAYER_NUM aLayer ); /** * Function RedrawFilledAreas * Redraw all filled areas on layer aLayer ( redraw all if aLayer < 0 ) */ void RedrawFilledAreas( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode, - int aLayer ); + LAYER_NUM aLayer ); /** * Function SetAreasNetCodesFromNetNames @@ -1090,14 +1090,14 @@ public: * @return a reference to the new area */ ZONE_CONTAINER* AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, - int aLayer, wxPoint aStartPointPosition, int aHatch ); + LAYER_NUM aLayer, wxPoint aStartPointPosition, int aHatch ); /** * Function InsertArea * add empty copper area to net, inserting after m_ZoneDescriptorList[iarea] * @return pointer to the new area */ - ZONE_CONTAINER* InsertArea( int netcode, int iarea, int layer, int x, int y, int hatch ); + ZONE_CONTAINER* InsertArea( int netcode, int iarea, LAYER_NUM layer, int x, int y, int hatch ); /** * Function NormalizeAreaPolygon @@ -1210,10 +1210,10 @@ public: * of the via. *

* @param aPosition The wxPoint to HitTest() against. - * @param aLayerMask The layers to search. Use -1 for a don't care. + * @param aLayer The layer to search. Use -1 for a don't care. * @return TRACK* A point a to the SEGVIA object if found, else NULL. */ - TRACK* GetViaByPosition( const wxPoint& aPosition, int aLayerMask = -1 ); + TRACK* GetViaByPosition( const wxPoint& aPosition, LAYER_NUM aLayer = UNDEFINED_LAYER ); /** * Function GetPad @@ -1332,7 +1332,7 @@ public: * @param aIgnoreLocked Ignore locked modules when true. * @return MODULE* The best module or NULL if none. */ - MODULE* GetFootprint( const wxPoint& aPosition, int aActiveLayer, + MODULE* GetFootprint( const wxPoint& aPosition, LAYER_NUM aActiveLayer, bool aVisibleOnly, bool aIgnoreLocked = false ); /** diff --git a/pcbnew/class_board_design_settings.cpp b/pcbnew/class_board_design_settings.cpp index a7764d807f..633a685507 100644 --- a/pcbnew/class_board_design_settings.cpp +++ b/pcbnew/class_board_design_settings.cpp @@ -191,7 +191,7 @@ void BOARD_DESIGN_SETTINGS::SetVisibleLayers( LAYER_MSK aMask ) } -void BOARD_DESIGN_SETTINGS::SetLayerVisibility( int aLayerIndex, bool aNewState ) +void BOARD_DESIGN_SETTINGS::SetLayerVisibility( LAYER_NUM aLayerIndex, bool aNewState ) { // Altough Pcbnew uses only 29, GerbView uses all 32 layers if( aLayerIndex < 0 || aLayerIndex >= 32 ) @@ -229,7 +229,7 @@ void BOARD_DESIGN_SETTINGS::SetCopperLayerCount( int aNewLayerCount ) if( m_CopperLayerCount > 1 ) m_EnabledLayers |= LAYER_FRONT; - for( int ii = LAYER_N_2; ii < aNewLayerCount - 1; ++ii ) + for( LAYER_NUM ii = LAYER_N_2; ii < aNewLayerCount - 1; ++ii ) m_EnabledLayers |= GetLayerMask( ii ); } @@ -247,9 +247,10 @@ void BOARD_DESIGN_SETTINGS::SetEnabledLayers( LAYER_MSK aMask ) // update m_CopperLayerCount to ensure its consistency with m_EnabledLayers m_CopperLayerCount = 0; - for( int ii = 0; aMask && ii < NB_COPPER_LAYERS; ii++, aMask >>= 1 ) + unsigned shiftMask = aMask; + for( LAYER_NUM ii = FIRST_LAYER; aMask && ii < NB_COPPER_LAYERS; ++ii, shiftMask >>= 1 ) { - if( aMask & 1 ) + if( shiftMask & 1 ) m_CopperLayerCount++; } } diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp index 6d3183107d..1b77f73417 100644 --- a/pcbnew/class_dimension.cpp +++ b/pcbnew/class_dimension.cpp @@ -49,7 +49,7 @@ DIMENSION::DIMENSION( BOARD_ITEM* aParent ) : BOARD_ITEM( aParent, PCB_DIMENSION_T ), m_Text( this ) { - m_Layer = DRAW_LAYER; + m_Layer = DRAW_N; m_Width = Millimeter2iu( 0.2 ); m_Value = 0; m_Shape = 0; @@ -86,7 +86,7 @@ const wxString DIMENSION::GetText() const } -void DIMENSION::SetLayer( int aLayer ) +void DIMENSION::SetLayer( LAYER_NUM aLayer ) { m_Layer = aLayer; m_Text.SetLayer( aLayer ); diff --git a/pcbnew/class_dimension.h b/pcbnew/class_dimension.h index 42b32930e0..26f17d72b1 100644 --- a/pcbnew/class_dimension.h +++ b/pcbnew/class_dimension.h @@ -80,7 +80,7 @@ public: m_Text.SetSize( aTextSize ); } - void SetLayer( int aLayer ); + void SetLayer( LAYER_NUM aLayer ); void SetShape( int aShape ) { m_Shape = aShape; } int GetShape() const { return m_Shape; } diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp index 746442fea9..9e23534245 100644 --- a/pcbnew/class_drawsegment.cpp +++ b/pcbnew/class_drawsegment.cpp @@ -55,7 +55,8 @@ DRAWSEGMENT::DRAWSEGMENT( BOARD_ITEM* aParent, KICAD_T idtype ) : BOARD_ITEM( aParent, idtype ) { - m_Width = m_Flags = m_Type = m_Angle = 0; + m_Width = m_Type = m_Angle = 0; + m_Flags = 0; m_Shape = S_SEGMENT; } @@ -175,7 +176,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, int l_trace; int mode; int radius; - int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; + LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; EDA_COLOR_T color; BOARD * brd = GetBoard( ); diff --git a/pcbnew/class_edge_mod.cpp b/pcbnew/class_edge_mod.cpp index 1d73a2f9be..5ea8860864 100644 --- a/pcbnew/class_edge_mod.cpp +++ b/pcbnew/class_edge_mod.cpp @@ -103,7 +103,7 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, int ux0, uy0, dx, dy, radius, StAngle, EndAngle; int type_trace; int typeaff; - int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; + LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; PCB_BASE_FRAME* frame; MODULE* module = (MODULE*) m_Parent; diff --git a/pcbnew/class_marker_pcb.cpp b/pcbnew/class_marker_pcb.cpp index d16c973855..d7c4beb2e4 100644 --- a/pcbnew/class_marker_pcb.cpp +++ b/pcbnew/class_marker_pcb.cpp @@ -86,7 +86,7 @@ MARKER_PCB::~MARKER_PCB() * param aLayer The layer to test for. * return bool - true if on given layer, else false. */ -bool MARKER_PCB::IsOnLayer( int aLayer ) const +bool MARKER_PCB::IsOnLayer( LAYER_NUM aLayer ) const { return IsValidCopperLayerIndex( aLayer ); } diff --git a/pcbnew/class_marker_pcb.h b/pcbnew/class_marker_pcb.h index d1fc47ec7a..7728b152c0 100644 --- a/pcbnew/class_marker_pcb.h +++ b/pcbnew/class_marker_pcb.h @@ -69,7 +69,7 @@ public: return HitTestMarker( aPosition ); } - bool IsOnLayer( int aLayer ) const; + bool IsOnLayer( LAYER_NUM aLayer ) const; void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); diff --git a/pcbnew/class_mire.cpp b/pcbnew/class_mire.cpp index 340d2020f5..c05a03dfee 100644 --- a/pcbnew/class_mire.cpp +++ b/pcbnew/class_mire.cpp @@ -53,7 +53,7 @@ PCB_TARGET::PCB_TARGET( BOARD_ITEM* aParent ) : m_Size = 5000; } -PCB_TARGET::PCB_TARGET( BOARD_ITEM* aParent, int aShape, int aLayer, +PCB_TARGET::PCB_TARGET( BOARD_ITEM* aParent, int aShape, LAYER_NUM aLayer, const wxPoint& aPos, int aSize, int aWidth ) : BOARD_ITEM( aParent, PCB_TARGET_T ) { diff --git a/pcbnew/class_mire.h b/pcbnew/class_mire.h index e454c3431c..32f02dd103 100644 --- a/pcbnew/class_mire.h +++ b/pcbnew/class_mire.h @@ -51,7 +51,7 @@ public: // Do not create a copy constructor. The one generated by the compiler is adequate. - PCB_TARGET( BOARD_ITEM* aParent, int aShape, int aLayer, + PCB_TARGET( BOARD_ITEM* aParent, int aShape, LAYER_NUM aLayer, const wxPoint& aPos, int aSize, int aWidth ); ~PCB_TARGET(); diff --git a/pcbnew/class_module_transform_functions.cpp b/pcbnew/class_module_transform_functions.cpp index be9bb14dc8..159b83697d 100644 --- a/pcbnew/class_module_transform_functions.cpp +++ b/pcbnew/class_module_transform_functions.cpp @@ -22,9 +22,9 @@ * some layers: external copper, Mask, Paste, and solder * are swapped between front and back sides */ -int BOARD::ReturnFlippedLayerNumber( int oldlayer ) +LAYER_NUM BOARD::ReturnFlippedLayerNumber( LAYER_NUM oldlayer ) { - int newlayer; + LAYER_NUM newlayer; switch( oldlayer ) { diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index d80ff222ae..ee52e4ad20 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -688,7 +688,7 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList ) // see class_pad.h -bool D_PAD::IsOnLayer( int aLayer ) const +bool D_PAD::IsOnLayer( LAYER_NUM aLayer ) const { return ::GetLayerMask( aLayer ) & m_layerMask; } diff --git a/pcbnew/class_pad.h b/pcbnew/class_pad.h index a7003f9cfb..55387f4378 100644 --- a/pcbnew/class_pad.h +++ b/pcbnew/class_pad.h @@ -345,7 +345,7 @@ public: void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); - bool IsOnLayer( int aLayer ) const; + bool IsOnLayer( LAYER_NUM aLayer ) const; bool HitTest( const wxPoint& aPosition ); diff --git a/pcbnew/class_pad_draw_functions.cpp b/pcbnew/class_pad_draw_functions.cpp index 09d1862a71..5db58b736f 100644 --- a/pcbnew/class_pad_draw_functions.cpp +++ b/pcbnew/class_pad_draw_functions.cpp @@ -240,8 +240,8 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode, // when routing tracks if( frame && frame->GetToolId() == ID_TRACK_BUTT ) { - int routeTop = screen->m_Route_Layer_TOP; - int routeBot = screen->m_Route_Layer_BOTTOM; + LAYER_NUM routeTop = screen->m_Route_Layer_TOP; + LAYER_NUM routeBot = screen->m_Route_Layer_BOTTOM; // if routing between copper and component layers, // or the current layer is one of said 2 external copper layers, diff --git a/pcbnew/class_pcb_layer_box_selector.cpp b/pcbnew/class_pcb_layer_box_selector.cpp index e44dabaa7d..be7c847f33 100644 --- a/pcbnew/class_pcb_layer_box_selector.cpp +++ b/pcbnew/class_pcb_layer_box_selector.cpp @@ -58,11 +58,11 @@ void PCB_LAYER_BOX_SELECTOR::Resync() static DECLARE_LAYERS_ORDER_LIST( layertranscode ); static DECLARE_LAYERS_HOTKEY( layerhk ); - for( int i = 0; i < LAYER_COUNT; i++ ) + for( LAYER_NUM i = FIRST_LAYER; i < NB_LAYERS; ++i ) { wxBitmap layerbmp( 14, 14 ); wxString layername; - int layerid = i; + LAYER_NUM layerid = i; if( m_layerorder ) layerid = layertranscode[i]; @@ -83,7 +83,7 @@ void PCB_LAYER_BOX_SELECTOR::Resync() // Returns true if the layer id is enabled (i.e. is it should be displayed) -bool PCB_LAYER_BOX_SELECTOR::IsLayerEnabled( int aLayerIndex ) const +bool PCB_LAYER_BOX_SELECTOR::IsLayerEnabled( LAYER_NUM aLayerIndex ) const { PCB_BASE_FRAME* pcbFrame = (PCB_BASE_FRAME*) GetParent()->GetParent(); BOARD* board = pcbFrame->GetBoard(); @@ -94,7 +94,7 @@ bool PCB_LAYER_BOX_SELECTOR::IsLayerEnabled( int aLayerIndex ) const // Returns a color index from the layer id -EDA_COLOR_T PCB_LAYER_BOX_SELECTOR::GetLayerColor( int aLayerIndex ) const +EDA_COLOR_T PCB_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayerIndex ) const { PCB_BASE_FRAME* pcbFrame = (PCB_BASE_FRAME*) GetParent()->GetParent(); BOARD* board = pcbFrame->GetBoard(); @@ -105,7 +105,7 @@ EDA_COLOR_T PCB_LAYER_BOX_SELECTOR::GetLayerColor( int aLayerIndex ) const // Returns the name of the layer id -wxString PCB_LAYER_BOX_SELECTOR::GetLayerName( int aLayerIndex ) const +wxString PCB_LAYER_BOX_SELECTOR::GetLayerName( LAYER_NUM aLayerIndex ) const { PCB_BASE_FRAME* pcbFrame = (PCB_BASE_FRAME*) GetParent()->GetParent(); BOARD* board = pcbFrame->GetBoard(); diff --git a/pcbnew/class_pcb_layer_box_selector.h b/pcbnew/class_pcb_layer_box_selector.h index 790988fd07..ef75213cc4 100644 --- a/pcbnew/class_pcb_layer_box_selector.h +++ b/pcbnew/class_pcb_layer_box_selector.h @@ -40,34 +40,15 @@ public: // Returns a color index from the layer id // Virtual function - EDA_COLOR_T GetLayerColor( int aLayerIndex ) const; + EDA_COLOR_T GetLayerColor( LAYER_NUM aLayerIndex ) const; // Returns true if the layer id is enabled (i.e. is it should be displayed) // Virtual function - bool IsLayerEnabled( int aLayerIndex ) const; + bool IsLayerEnabled( LAYER_NUM aLayerIndex ) const; // Returns the name of the layer id // Virtual function - wxString GetLayerName( int aLayerIndex ) const; + wxString GetLayerName( LAYER_NUM aLayerIndex ) const; }; -#define DECLARE_LAYERS_HOTKEY(list) int list[LAYER_COUNT] = \ - { \ - HK_SWITCH_LAYER_TO_COPPER, \ - HK_SWITCH_LAYER_TO_INNER1, \ - HK_SWITCH_LAYER_TO_INNER2, \ - HK_SWITCH_LAYER_TO_INNER3, \ - HK_SWITCH_LAYER_TO_INNER4, \ - HK_SWITCH_LAYER_TO_INNER5, \ - HK_SWITCH_LAYER_TO_INNER6, \ - HK_SWITCH_LAYER_TO_INNER7, \ - HK_SWITCH_LAYER_TO_INNER8, \ - HK_SWITCH_LAYER_TO_INNER9, \ - HK_SWITCH_LAYER_TO_INNER10, \ - HK_SWITCH_LAYER_TO_INNER11, \ - HK_SWITCH_LAYER_TO_INNER12, \ - HK_SWITCH_LAYER_TO_INNER13, \ - HK_SWITCH_LAYER_TO_INNER14, \ - HK_SWITCH_LAYER_TO_COMPONENT \ - }; #endif //CLASS_PCB_PCB_LAYER_BOX_SELECTOR_H diff --git a/pcbnew/class_pcb_layer_widget.cpp b/pcbnew/class_pcb_layer_widget.cpp index 6de78f808d..a852a2723d 100644 --- a/pcbnew/class_pcb_layer_widget.cpp +++ b/pcbnew/class_pcb_layer_widget.cpp @@ -151,7 +151,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) for( int row=rowCount-1; row>=0; --row ) { wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 ); - int layer = getDecodedId( cb->GetId() ); + LAYER_NUM layer = getDecodedId( cb->GetId() ); if( IsValidCopperLayerIndex( layer ) ) { lastCu = row; @@ -162,7 +162,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) for( int row=0; rowGetId() ); + LAYER_NUM layer = getDecodedId( cb->GetId() ); if( IsValidCopperLayerIndex( layer ) ) { @@ -241,7 +241,7 @@ void PCB_LAYER_WIDGET::SyncLayerVisibilities() wxWindow* w = getLayerComp( row, 0 ); - int layerId = getDecodedId( w->GetId() ); + LAYER_NUM layerId = getDecodedId( w->GetId() ); // this does not fire a UI event SetLayerVisible( layerId, board->IsLayerVisible( layerId ) ); @@ -252,7 +252,7 @@ void PCB_LAYER_WIDGET::SyncLayerVisibilities() void PCB_LAYER_WIDGET::ReFill() { BOARD* brd = myframe->GetBoard(); - int layer; + LAYER_NUM layer; int enabledLayers = brd->GetEnabledLayers(); @@ -269,7 +269,7 @@ void PCB_LAYER_WIDGET::ReFill() brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), _("Front copper layer"), true ) ); } - for( layer = LAYER_N_FRONT-1; layer >= 1; --layer ) + for( layer = LAYER_N_FRONT-1; layer >= 1; --layer ) { if( enabledLayers & GetLayerMask( layer ) ) { @@ -287,7 +287,7 @@ void PCB_LAYER_WIDGET::ReFill() // technical layers are shown in this order: static const struct { - int layerId; + LAYER_NUM layerId; wxString tooltip; } techLayerSeq[] = { { ADHESIVE_N_FRONT, _( "Adhesive on board's front" ) }, @@ -324,7 +324,7 @@ void PCB_LAYER_WIDGET::ReFill() //------------------------------------------------ -void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, EDA_COLOR_T aColor ) +void PCB_LAYER_WIDGET::OnLayerColorChange( LAYER_NUM aLayer, EDA_COLOR_T aColor ) { myframe->GetBoard()->SetLayerColor( aLayer, aColor ); myframe->ReCreateLayerBox( NULL ); @@ -332,7 +332,7 @@ void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, EDA_COLOR_T aColor ) } -bool PCB_LAYER_WIDGET::OnLayerSelect( int aLayer ) +bool PCB_LAYER_WIDGET::OnLayerSelect( LAYER_NUM aLayer ) { // the layer change from the PCB_LAYER_WIDGET can be denied by returning // false from this function. @@ -345,7 +345,7 @@ bool PCB_LAYER_WIDGET::OnLayerSelect( int aLayer ) } -void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal ) +void PCB_LAYER_WIDGET::OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal ) { BOARD* brd = myframe->GetBoard(); diff --git a/pcbnew/class_pcb_layer_widget.h b/pcbnew/class_pcb_layer_widget.h index 8fa09595b5..dd8d8ade01 100644 --- a/pcbnew/class_pcb_layer_widget.h +++ b/pcbnew/class_pcb_layer_widget.h @@ -82,9 +82,9 @@ public: void SetLayersManagerTabsText(); //---------------- - void OnLayerColorChange( int aLayer, EDA_COLOR_T aColor ); - bool OnLayerSelect( int aLayer ); - void OnLayerVisible( int aLayer, bool isVisible, bool isFinal ); + void OnLayerColorChange( LAYER_NUM aLayer, EDA_COLOR_T aColor ); + bool OnLayerSelect( LAYER_NUM aLayer ); + void OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal ); void OnRenderColorChange( int aId, EDA_COLOR_T aColor ); void OnRenderEnable( int aId, bool isEnabled ); //--------------- diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index bbcacd4f8b..bd0b9790e3 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -71,7 +71,7 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) : { m_Pos = module->GetPosition(); - int moduleLayer = module->GetLayer(); + LAYER_NUM moduleLayer = module->GetLayer(); if( moduleLayer == LAYER_N_BACK ) SetLayer( SILKSCREEN_N_BACK ); @@ -397,7 +397,7 @@ void TEXTE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) BOARD* board = NULL; board = (BOARD*) module->GetParent(); - if( m_Layer < NB_LAYERS && board ) + if( m_Layer < NB_PCB_LAYERS && board ) msg = board->GetLayerName( m_Layer ); else msg.Printf( wxT( "%d" ), m_Layer ); @@ -426,7 +426,7 @@ void TEXTE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) // see class_text_mod.h -bool TEXTE_MODULE::IsOnLayer( int aLayer ) const +bool TEXTE_MODULE::IsOnLayer( LAYER_NUM aLayer ) const { if( m_Layer == aLayer ) return true; diff --git a/pcbnew/class_text_mod.h b/pcbnew/class_text_mod.h index 6394f0a7c8..e5087c9ed5 100644 --- a/pcbnew/class_text_mod.h +++ b/pcbnew/class_text_mod.h @@ -130,7 +130,7 @@ public: bool HitTest( const wxPoint& aPosition ); - bool IsOnLayer( int aLayer ) const; + bool IsOnLayer( LAYER_NUM aLayer ) const; wxString GetClass() const diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index 514c091529..0f8aa12aaa 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -222,8 +222,8 @@ wxString SEGVIA::GetSelectMenuText() const if( shape != VIA_THROUGH ) { // say which layers, only two for now - int topLayer; - int botLayer; + LAYER_NUM topLayer; + LAYER_NUM botLayer; ReturnLayerPair( &topLayer, &botLayer ); text << _( " on " ) << board->GetLayerName( topLayer ).Trim() << wxT( " <-> " ) << board->GetLayerName( botLayer ).Trim(); @@ -416,9 +416,9 @@ SEARCH_RESULT TRACK::Visit( INSPECTOR* inspector, const void* testData, } -bool SEGVIA::IsOnLayer( int layer_number ) const +bool SEGVIA::IsOnLayer( LAYER_NUM layer_number ) const { - int bottom_layer, top_layer; + LAYER_NUM bottom_layer, top_layer; ReturnLayerPair( &top_layer, &bottom_layer ); @@ -440,7 +440,7 @@ LAYER_MSK TRACK::GetLayerMask() const // VIA_BLIND_BURIED or VIA_MICRVIA: - int bottom_layer, top_layer; + LAYER_NUM bottom_layer, top_layer; // ReturnLayerPair() knows how layers are stored ( (SEGVIA*) this )->ReturnLayerPair( &top_layer, &bottom_layer ); @@ -462,7 +462,7 @@ LAYER_MSK TRACK::GetLayerMask() const } -void SEGVIA::SetLayerPair( int top_layer, int bottom_layer ) +void SEGVIA::SetLayerPair( LAYER_NUM top_layer, LAYER_NUM bottom_layer ) { if( GetShape() == VIA_THROUGH ) { @@ -473,17 +473,19 @@ void SEGVIA::SetLayerPair( int top_layer, int bottom_layer ) if( bottom_layer > top_layer ) EXCHG( bottom_layer, top_layer ); + // XXX EVIL usage of LAYER m_Layer = (top_layer & 15) + ( (bottom_layer & 15) << 4 ); } -void SEGVIA::ReturnLayerPair( int* top_layer, int* bottom_layer ) const +void SEGVIA::ReturnLayerPair( LAYER_NUM* top_layer, LAYER_NUM* bottom_layer ) const { - int b_layer = LAYER_N_BACK; - int t_layer = LAYER_N_FRONT; + LAYER_NUM b_layer = LAYER_N_BACK; + LAYER_NUM t_layer = LAYER_N_FRONT; if( GetShape() != VIA_THROUGH ) { + // XXX EVIL usage of LAYER b_layer = (m_Layer >> 4) & 15; t_layer = m_Layer & 15; @@ -586,7 +588,7 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, { int l_trace; int radius; - int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; + LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; if( Type() == PCB_ZONE_T && DisplayOpt.DisplayZonesMode != 0 ) return; @@ -751,7 +753,7 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, const wxPoint& aOffset ) { int radius; - int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; + LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; int fillvia = 0; PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) panel->GetParent(); @@ -906,7 +908,7 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, if( GetShape() == VIA_BLIND_BURIED ) { int ax = 0, ay = radius, bx = 0, by = drill_radius; - int layer_top, layer_bottom; + LAYER_NUM layer_top, layer_bottom; ( (SEGVIA*) this )->ReturnLayerPair( &layer_top, &layer_bottom ); @@ -1114,7 +1116,7 @@ void TRACK::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList ) if( Type() == PCB_VIA_T ) { SEGVIA* Via = (SEGVIA*) this; - int top_layer, bottom_layer; + LAYER_NUM top_layer, bottom_layer; Via->ReturnLayerPair( &top_layer, &bottom_layer ); msg = board->GetLayerName( top_layer ) + wxT( "/" ) + board->GetLayerName( bottom_layer ); @@ -1191,7 +1193,7 @@ bool TRACK::HitTest( const EDA_RECT& aRect ) const } -TRACK* TRACK::GetVia( const wxPoint& aPosition, int aLayer ) +TRACK* TRACK::GetVia( const wxPoint& aPosition, LAYER_NUM aLayer) { TRACK* track; @@ -1206,7 +1208,7 @@ TRACK* TRACK::GetVia( const wxPoint& aPosition, int aLayer ) if( track->GetState( BUSY | IS_DELETED ) ) continue; - if( aLayer < 0 ) + if( aLayer == UNDEFINED_LAYER ) break; if( track->IsOnLayer( aLayer ) ) @@ -1580,8 +1582,8 @@ void SEGVIA::Show( int nestLevel, std::ostream& os ) const break; } - int topLayer; - int botLayer; + LAYER_NUM topLayer; + LAYER_NUM botLayer; BOARD* board = (BOARD*) m_Parent; diff --git a/pcbnew/class_track.h b/pcbnew/class_track.h index 14d6eac95e..7bc1eff36b 100644 --- a/pcbnew/class_track.h +++ b/pcbnew/class_track.h @@ -268,7 +268,7 @@ public: * @param aLayer The layer to match, pass -1 for a don't care. * @return A pointer to a SEGVIA object if found, else NULL. */ - TRACK* GetVia( const wxPoint& aPosition, int aLayer = -1 ); + TRACK* GetVia( const wxPoint& aPosition, LAYER_NUM aLayer = UNDEFINED_LAYER ); /** * Function GetVia @@ -377,7 +377,7 @@ public: void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE aDrawMode, const wxPoint& aOffset = ZeroOffset ); - bool IsOnLayer( int aLayer ) const; + bool IsOnLayer( LAYER_NUM aLayer ) const; /** * Function SetLayerPair @@ -389,7 +389,7 @@ public: * @param top_layer = first layer connected by the via * @param bottom_layer = last layer connected by the via */ - void SetLayerPair( int top_layer, int bottom_layer ); + void SetLayerPair( LAYER_NUM top_layer, LAYER_NUM bottom_layer ); /** * Function ReturnLayerPair @@ -398,7 +398,7 @@ public: * @param top_layer = pointer to the first layer (can be null) * @param bottom_layer = pointer to the last layer (can be null) */ - void ReturnLayerPair( int* top_layer, int* bottom_layer ) const; + void ReturnLayerPair( LAYER_NUM* top_layer, LAYER_NUM* bottom_layer ) const; const wxPoint& GetPosition() const { return m_Start; } // was overload void SetPosition( const wxPoint& aPoint ) { m_Start = aPoint; m_End = aPoint; } // was overload diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index d3ad2608ea..6b161ad189 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -170,7 +170,7 @@ void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE aDrawMod return; wxPoint seg_start, seg_end; - int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; + LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; BOARD* brd = GetBoard(); EDA_COLOR_T color = brd->GetLayerColor( m_Layer ); @@ -255,7 +255,7 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel, return; BOARD* brd = GetBoard(); - int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; + LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; EDA_COLOR_T color = brd->GetLayerColor( m_Layer ); if( brd->IsLayerVisible( m_Layer ) == false && ( color & HIGHLIGHT_FLAG ) != HIGHLIGHT_FLAG ) @@ -400,7 +400,7 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( EDA_DRAW_PANEL* panel, wxDC* DC, if( DC == NULL ) return; - int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; + LAYER_NUM curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer; BOARD* brd = GetBoard(); EDA_COLOR_T color = brd->GetLayerColor( m_Layer ); diff --git a/pcbnew/class_zone.h b/pcbnew/class_zone.h index 7b14356c49..c06d3076ab 100644 --- a/pcbnew/class_zone.h +++ b/pcbnew/class_zone.h @@ -183,7 +183,7 @@ public: */ bool IsOnCopperLayer( void ) const { - return ( GetLayer() < FIRST_NO_COPPER_LAYER ) ? true : false; + return ( GetLayer() < FIRST_NON_COPPER_LAYER ) ? true : false; } /** diff --git a/pcbnew/class_zone_settings.cpp b/pcbnew/class_zone_settings.cpp index af0d0e5d44..bdf85dbbd6 100644 --- a/pcbnew/class_zone_settings.cpp +++ b/pcbnew/class_zone_settings.cpp @@ -44,7 +44,7 @@ ZONE_SETTINGS::ZONE_SETTINGS() // Min thickness value in filled areas (this is the minimum width of copper to fill solid areas) : m_ZoneMinThickness = Mils2iu( ZONE_THICKNESS_MIL ); m_NetcodeSelection = 0; // Net code selection for the current zone - m_CurrentZone_Layer = 0; // Layer used to create the current zone + m_CurrentZone_Layer = FIRST_LAYER; // Layer used to create the current zone m_Zone_HatchingStyle = CPolyLine::DIAGONAL_EDGE; // Option to show the zone area (outlines only, short hatches or full hatches m_ArcToSegmentsCount = ARC_APPROX_SEGMENTS_COUNT_LOW_DEF; // Option to select number of segments to approximate a circle diff --git a/pcbnew/class_zone_settings.h b/pcbnew/class_zone_settings.h index b26db0c7b8..0ec12f32df 100644 --- a/pcbnew/class_zone_settings.h +++ b/pcbnew/class_zone_settings.h @@ -39,7 +39,7 @@ public: int m_ZoneClearance; ///< Clearance value int m_ZoneMinThickness; ///< Min thickness value in filled areas int m_NetcodeSelection; ///< Net code selection for the current zone - int m_CurrentZone_Layer; ///< Layer used to create the current zone + LAYER_NUM m_CurrentZone_Layer; ///< Layer used to create the current zone /// Option to show the zone area (outlines only, short hatches or full hatches int m_Zone_HatchingStyle; diff --git a/pcbnew/clean.cpp b/pcbnew/clean.cpp index b2b5e7a1fe..dc426d0c6c 100644 --- a/pcbnew/clean.cpp +++ b/pcbnew/clean.cpp @@ -182,7 +182,7 @@ void TRACKS_CLEANER::buildTrackConnectionInfo() track->start = NULL; track->end = NULL; track->m_PadsConnected.clear(); - track->SetState( START_ON_PAD|END_ON_PAD|BUSY, OFF ); + track->SetState( START_ON_PAD|END_ON_PAD|BUSY, false ); } // Build connections info tracks to pads @@ -197,13 +197,13 @@ void TRACKS_CLEANER::buildTrackConnectionInfo() if( pad->HitTest( track->GetStart() ) ) { track->start = pad; - track->SetState( START_ON_PAD, ON ); + track->SetState( START_ON_PAD, true ); } if( pad->HitTest( track->GetEnd() ) ) { track->end = pad; - track->SetState( END_ON_PAD, ON ); + track->SetState( END_ON_PAD, true ); } } } @@ -309,7 +309,7 @@ bool TRACKS_CLEANER::deleteUnconnectedTracks() // For via test, an enhancement could be to test if connected // to 2 items on different layers. // Currently a via must be connected to 2 items, that can be on the same layer - int top_layer, bottom_layer; + LAYER_NUM top_layer, bottom_layer; ZONE_CONTAINER* zone; if( (type_end & START_ON_PAD ) == 0 ) diff --git a/pcbnew/collectors.cpp b/pcbnew/collectors.cpp index 965f35a9ef..5970de7ef7 100644 --- a/pcbnew/collectors.cpp +++ b/pcbnew/collectors.cpp @@ -350,7 +350,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa if( item->IsOnLayer( m_Guide->GetPreferredLayer() ) || m_Guide->IgnorePreferredLayer() ) { - int layer = item->GetLayer(); + LAYER_NUM layer = item->GetLayer(); // Modules and their subcomponents: text and pads are not sensitive to the layer // visibility controls. They all have their own separate visibility controls @@ -378,7 +378,7 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa // no effect on other criteria, since there is a separate "ignore" control for // those in the COLLECTORS_GUIDE - int layer = item->GetLayer(); + LAYER_NUM layer = item->GetLayer(); // Modules and their subcomponents: text and pads are not sensitive to the layer // visibility controls. They all have their own separate visibility controls diff --git a/pcbnew/collectors.h b/pcbnew/collectors.h index b958b82e98..8eef56af40 100644 --- a/pcbnew/collectors.h +++ b/pcbnew/collectors.h @@ -71,13 +71,13 @@ public: * Function IsLayerLocked * @return bool - true if the given layer is locked, else false. */ - virtual bool IsLayerLocked( int layer ) const = 0; + virtual bool IsLayerLocked( LAYER_NUM layer ) const = 0; /** * Function IsLayerVisible * @return bool - true if the given layer is visible, else false. */ - virtual bool IsLayerVisible( int layer ) const = 0; + virtual bool IsLayerVisible( LAYER_NUM layer ) const = 0; /** * Function IgnoreLockedLayers @@ -95,7 +95,7 @@ public: * Function GetPreferredLayer * @return int - the preferred layer for HitTest()ing. */ - virtual int GetPreferredLayer() const = 0; + virtual LAYER_NUM GetPreferredLayer() const = 0; /** * Function IgnorePreferredLayer @@ -376,7 +376,7 @@ private: // the storage architecture here is not important, since this is only // a carrier object and its functions are what is used, and data only indirectly. - int m_PreferredLayer; + LAYER_NUM m_PreferredLayer; bool m_IgnorePreferredLayer; LAYER_MSK m_LayerLocked; ///< bit-mapped layer locked bits @@ -407,7 +407,7 @@ public: * @param aVisibleLayerMask = current visible layers (bit mask) * @param aPreferredLayer = the layer to search first */ - GENERAL_COLLECTORS_GUIDE( LAYER_MSK aVisibleLayerMask, int aPreferredLayer ) + GENERAL_COLLECTORS_GUIDE( LAYER_MSK aVisibleLayerMask, LAYER_NUM aPreferredLayer ) { m_PreferredLayer = LAYER_N_FRONT; m_IgnorePreferredLayer = false; @@ -443,11 +443,11 @@ public: * Function IsLayerLocked * @return bool - true if the given layer is locked, else false. */ - bool IsLayerLocked( int aLayer ) const + bool IsLayerLocked( LAYER_NUM aLayer ) const { return GetLayerMask( aLayer ) & m_LayerLocked; } - void SetLayerLocked( int aLayer, bool isLocked ) + void SetLayerLocked( LAYER_NUM aLayer, bool isLocked ) { if( isLocked ) m_LayerLocked |= GetLayerMask( aLayer ); @@ -460,11 +460,11 @@ public: * Function IsLayerVisible * @return bool - true if the given layer is visible, else false. */ - bool IsLayerVisible( int aLayer ) const + bool IsLayerVisible( LAYER_NUM aLayer ) const { return GetLayerMask( aLayer ) & m_LayerVisible; } - void SetLayerVisible( int aLayer, bool isVisible ) + void SetLayerVisible( LAYER_NUM aLayer, bool isVisible ) { if( isVisible ) m_LayerVisible |= GetLayerMask( aLayer ); @@ -494,8 +494,8 @@ public: * Function GetPreferredLayer * @return int - the preferred layer for HitTest()ing. */ - int GetPreferredLayer() const { return m_PreferredLayer; } - void SetPreferredLayer( int aLayer ) { m_PreferredLayer = aLayer; } + LAYER_NUM GetPreferredLayer() const { return m_PreferredLayer; } + void SetPreferredLayer( LAYER_NUM aLayer ) { m_PreferredLayer = aLayer; } /** diff --git a/pcbnew/deltrack.cpp b/pcbnew/deltrack.cpp index b69e4bd487..f85c787f69 100644 --- a/pcbnew/deltrack.cpp +++ b/pcbnew/deltrack.cpp @@ -53,7 +53,7 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack ) { if( g_CurrentTrackList.GetCount() > 0 ) { - int previous_layer = getActiveLayer(); + LAYER_NUM previous_layer = getActiveLayer(); D( g_CurrentTrackList.VerifyListIntegrity(); ) @@ -216,7 +216,7 @@ void PCB_EDIT_FRAME::Remove_One_Track( wxDC* DC, TRACK* pt_segm ) tracksegment->SetState( BUSY, false ); D( std::cout << __func__ << ": track " << tracksegment << " status=" \ - << TO_UTF8( TRACK::ShowState( tracksegment->GetState( -1 ) ) ) \ + << TO_UTF8( TRACK::ShowState( tracksegment->GetStatus() ) ) \ << std::endl; ) GetBoard()->m_Track.Remove( tracksegment ); diff --git a/pcbnew/dialogs/dialog_SVG_print.cpp b/pcbnew/dialogs/dialog_SVG_print.cpp index 9b9e7052bb..39eab85e9d 100644 --- a/pcbnew/dialogs/dialog_SVG_print.cpp +++ b/pcbnew/dialogs/dialog_SVG_print.cpp @@ -103,8 +103,8 @@ void DIALOG_SVG_PRINT::initDialog() ReturnStringFromValue( g_UserUnit, g_DrawDefaultLineThickness ) ); // Create layers list - int layer; - for( layer = 0; layer < NB_LAYERS; ++layer ) + LAYER_NUM layer; + for( layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer ) { if( !m_board->IsLayerEnabled( layer ) ) m_boxSelectLayer[layer] = NULL; @@ -118,7 +118,7 @@ void DIALOG_SVG_PRINT::initDialog() // (Front or Top to Back or Bottom) DECLARE_LAYERS_ORDER_LIST( layersOrder ); - for( int layer_idx = 0; layer_idx < NB_LAYERS; ++layer_idx ) + for( LAYER_NUM layer_idx = FIRST_LAYER; layer_idx < NB_LAYERS; ++layer_idx ) { layer = layersOrder[layer_idx]; @@ -132,7 +132,7 @@ void DIALOG_SVG_PRINT::initDialog() if( mask & s_SelectedLayers ) m_boxSelectLayer[layer]->SetValue( true ); - if( layer < 16 ) + if( layer <= LAST_COPPER_LAYER ) m_CopperLayersBoxSizer->Add( m_boxSelectLayer[layer], 0, wxGROW | wxALL, @@ -148,7 +148,7 @@ void DIALOG_SVG_PRINT::initDialog() { wxString layerKey; - for( int layer = 0; layerGetValue() ) - printMaskLayer |= 1 << layer; + printMaskLayer |= GetLayerMask( layer ); } wxString msg; - for( int layer = 0; layer // needed for wx/listctrl.h, in wxGTK 2.8.12 #include - +#include /** @@ -70,7 +70,7 @@ private: ///< true = pad count sort. long m_NetFiltering; - std::vector m_LayerId; ///< Handle the real layer number from layer + std::vector m_LayerId; ///< Handle the real layer number from layer ///< name position in m_LayerSelectionCtrl static wxString m_netNameShowFilter; ///< the filter to show nets (default * "*"). @@ -250,9 +250,9 @@ void DIALOG_COPPER_ZONE::initDialog() int layerCount = board->GetCopperLayerCount(); wxImageList* imageList = new wxImageList( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y ); m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL ); - for( int ii = 0; ii < layerCount; ii++ ) + for( LAYER_NUM ii = FIRST_LAYER; ii < layerCount; ++ii ) { - int layerNumber = LAYER_N_BACK; + LAYER_NUM layerNumber = LAYER_N_BACK; if( layerCount <= 1 || ii < layerCount - 1 ) layerNumber = ii; diff --git a/pcbnew/dialogs/dialog_global_deletion.cpp b/pcbnew/dialogs/dialog_global_deletion.cpp index 5be3fe9a6e..0481490122 100644 --- a/pcbnew/dialogs/dialog_global_deletion.cpp +++ b/pcbnew/dialogs/dialog_global_deletion.cpp @@ -22,7 +22,7 @@ DIALOG_GLOBAL_DELETION::DIALOG_GLOBAL_DELETION( PCB_EDIT_FRAME* parent ) : DIALOG_GLOBAL_DELETION_BASE( parent ) { m_Parent = parent; - m_currentLayer = 0; + m_currentLayer = FIRST_LAYER; m_TrackFilterAR->Enable( m_DelTracks->GetValue() ); m_TrackFilterLocked->Enable( m_DelTracks->GetValue() ); m_TrackFilterNormal->Enable( m_DelTracks->GetValue() ); @@ -42,7 +42,7 @@ void PCB_EDIT_FRAME::InstallPcbGlobalDeleteFrame( const wxPoint& pos ) dlg.ShowModal(); } -void DIALOG_GLOBAL_DELETION::SetCurrentLayer( int aLayer ) +void DIALOG_GLOBAL_DELETION::SetCurrentLayer( LAYER_NUM aLayer ) { m_currentLayer = aLayer; m_textCtrlCurrLayer->SetValue( m_Parent->GetBoard()->GetLayerName( aLayer ) ); diff --git a/pcbnew/dialogs/dialog_global_deletion.h b/pcbnew/dialogs/dialog_global_deletion.h index c5bbaac03b..1983409708 100644 --- a/pcbnew/dialogs/dialog_global_deletion.h +++ b/pcbnew/dialogs/dialog_global_deletion.h @@ -11,11 +11,11 @@ class DIALOG_GLOBAL_DELETION: public DIALOG_GLOBAL_DELETION_BASE { private: PCB_EDIT_FRAME * m_Parent; - int m_currentLayer; + LAYER_NUM m_currentLayer; public: DIALOG_GLOBAL_DELETION( PCB_EDIT_FRAME* parent ); - void SetCurrentLayer( int aLayer ); + void SetCurrentLayer( LAYER_NUM aLayer ); private: void OnOkClick( wxCommandEvent& event ) diff --git a/pcbnew/dialogs/dialog_graphic_item_properties.cpp b/pcbnew/dialogs/dialog_graphic_item_properties.cpp index 6dddab0eee..9b4525e962 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties.cpp @@ -156,18 +156,18 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::initDlg( ) PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness ); - for( int layer=FIRST_NO_COPPER_LAYER; layer <= LAST_NO_COPPER_LAYER; ++layer ) + for( LAYER_NUM layer=FIRST_NON_COPPER_LAYER; layer <= LAST_NON_COPPER_LAYER; ++layer ) { m_LayerSelectionCtrl->Append( m_parent->GetBoard()->GetLayerName( layer ) ); } - int layer = m_Item->GetLayer(); + LAYER_NUM layer = m_Item->GetLayer(); // Control: - if ( layer < FIRST_NO_COPPER_LAYER ) - layer = FIRST_NO_COPPER_LAYER; - if ( layer > LAST_NO_COPPER_LAYER ) - layer = LAST_NO_COPPER_LAYER; - m_LayerSelectionCtrl->SetSelection( layer - FIRST_NO_COPPER_LAYER ); + if ( layer < FIRST_NON_COPPER_LAYER ) + layer = FIRST_NON_COPPER_LAYER; + if ( layer > LAST_NON_COPPER_LAYER ) + layer = LAST_NON_COPPER_LAYER; + m_LayerSelectionCtrl->SetSelection( layer - FIRST_NON_COPPER_LAYER ); } @@ -177,7 +177,7 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::OnLayerChoice( wxCommandEvent& event ) { int thickness; - if( (m_LayerSelectionCtrl->GetCurrentSelection() + FIRST_NO_COPPER_LAYER) == EDGE_N ) + if( (m_LayerSelectionCtrl->GetCurrentSelection() + FIRST_NON_COPPER_LAYER) == EDGE_N ) thickness = m_brdSettings.m_EdgeSegmentWidth; else thickness = m_brdSettings.m_DrawSegmentWidth; @@ -216,7 +216,7 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event ) msg = m_DefaultThicknessCtrl->GetValue(); int thickness = ReturnValueFromString( g_UserUnit, msg ); - m_Item->SetLayer( m_LayerSelectionCtrl->GetCurrentSelection() + FIRST_NO_COPPER_LAYER); + m_Item->SetLayer( FIRST_NON_COPPER_LAYER + m_LayerSelectionCtrl->GetCurrentSelection() ); if( m_Item->GetLayer() == EDGE_N ) m_brdSettings.m_EdgeSegmentWidth = thickness; diff --git a/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp b/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp index 677a3ff7cc..a7ed5de1e0 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp @@ -32,7 +32,7 @@ private: EDGE_MODULE* m_item; BOARD_DESIGN_SETTINGS m_brdSettings; MODULE * m_module; - std::vector m_layerId; // the layer Id with the same order as m_LayerSelectionCtrl widget + std::vector m_layerId; // the layer Id with the same order as m_LayerSelectionCtrl widget public: DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES( FOOTPRINT_EDIT_FRAME* aParent, @@ -155,7 +155,7 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::initDlg() m_layerId.push_back( LAYER_N_BACK ); m_LayerSelectionCtrl->Append( m_parent->GetBoard()->GetLayerName( LAYER_N_FRONT ) ); m_layerId.push_back( LAYER_N_FRONT ); - for( int layer = FIRST_NO_COPPER_LAYER; layer <= LAST_NO_COPPER_LAYER; ++layer ) + for( LAYER_NUM layer = FIRST_NON_COPPER_LAYER; layer <= LAST_NON_COPPER_LAYER; ++layer ) { if( layer == EDGE_N ) // Do not use pcb edge layer for footprints, this is a special layer @@ -195,7 +195,7 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event ) return; } - int layer = m_layerId[idx]; + LAYER_NUM layer = m_layerId[idx]; if( IsValidCopperLayerIndex( layer ) ) { /* an edge is put on a copper layer, and it is very dangerous. a diff --git a/pcbnew/dialogs/dialog_keepout_area_properties.cpp b/pcbnew/dialogs/dialog_keepout_area_properties.cpp index 98c587d5bd..7a5f105196 100644 --- a/pcbnew/dialogs/dialog_keepout_area_properties.cpp +++ b/pcbnew/dialogs/dialog_keepout_area_properties.cpp @@ -60,7 +60,7 @@ private: ZONE_SETTINGS m_zonesettings; ZONE_SETTINGS* m_ptr; - std::vector m_layerId; ///< Handle the real layer number from layer + std::vector m_layerId; ///< Handle the real layer number from layer ///< name position in m_LayerSelectionCtrl /** @@ -153,7 +153,7 @@ void DIALOG_KEEPOUT_AREA_PROPERTIES::initDialog() m_LayerSelectionCtrl->AssignImageList( imageList, wxIMAGE_LIST_SMALL ); for( int ii = 0; ii < layerCount; ii++ ) { - int layerNumber = LAYER_N_BACK; + LAYER_NUM layerNumber = LAYER_N_BACK; if( layerCount <= 1 || ii < layerCount - 1 ) layerNumber = ii; diff --git a/pcbnew/dialogs/dialog_layers_setup.cpp b/pcbnew/dialogs/dialog_layers_setup.cpp index 7d7d836410..a1825fc194 100644 --- a/pcbnew/dialogs/dialog_layers_setup.cpp +++ b/pcbnew/dialogs/dialog_layers_setup.cpp @@ -85,7 +85,7 @@ private: wxStaticText* m_TypeStaticText; - void setLayerCheckBox( int layer, bool isChecked ); + void setLayerCheckBox( LAYER_NUM layer, bool isChecked ); void setCopperLayerCheckBoxes( int copperCount ); void showCopperChoice( int copperCount ); @@ -96,8 +96,8 @@ private: /** return the selected layer mask within the UI checkboxes */ LAYER_MSK getUILayerMask(); - wxString getLayerName( int layer ); - int getLayerTypeIndex( int layer ); + wxString getLayerName( LAYER_NUM layer ); + int getLayerTypeIndex( LAYER_NUM layer ); void OnCancelButtonClick( wxCommandEvent& event ); @@ -114,19 +114,19 @@ private: * maps \a aLayerNumber to the wx IDs for that layer which are * the layer name control ID, checkbox control ID, and choice control ID */ - CTLs getCTLs( int aLayerNumber ); + CTLs getCTLs( LAYER_NUM aLayerNumber ); - wxControl* getName( int aLayer ) + wxControl* getName( LAYER_NUM aLayer ) { return getCTLs( aLayer ).name; } - wxCheckBox* getCheckBox( int aLayer ) + wxCheckBox* getCheckBox( LAYER_NUM aLayer ) { return getCTLs( aLayer ).checkbox; } - wxChoice* getChoice( int aLayer ) + wxChoice* getChoice( LAYER_NUM aLayer ) { return (wxChoice*) getCTLs( aLayer ).choice; } @@ -198,7 +198,7 @@ static const LAYER_MSK presets[] = }; -CTLs DIALOG_LAYERS_SETUP::getCTLs( int aLayerNumber ) +CTLs DIALOG_LAYERS_SETUP::getCTLs( LAYER_NUM aLayerNumber ) { #define RETCOP(x) return CTLs( x##Name, x##CheckBox, x##Choice, x##Panel ); #define RETAUX(x) return CTLs( x##Name, x##CheckBox, x##StaticText, x##Panel ); @@ -327,7 +327,7 @@ void DIALOG_LAYERS_SETUP::showBoardLayerNames() // obtaining them from BOARD::GetLayerName() which calls // BOARD::GetStandardLayerName() for non-coppers. - for( int layer=0; layerGetValue() ) @@ -402,7 +402,7 @@ LAYER_MSK DIALOG_LAYERS_SETUP::getUILayerMask() } -void DIALOG_LAYERS_SETUP::setLayerCheckBox( int aLayer, bool isChecked ) +void DIALOG_LAYERS_SETUP::setLayerCheckBox( LAYER_NUM aLayer, bool isChecked ) { wxCheckBox* ctl = getCheckBox( aLayer ); ctl->SetValue( isChecked ); @@ -427,8 +427,7 @@ void DIALOG_LAYERS_SETUP::setCopperLayerCheckBoxes( int copperCount ) setLayerCheckBox( LAYER_N_FRONT, false ); } - int layer; - for( layer=LAYER_N_2; layer < NB_COPPER_LAYERS-1; ++layer, --copperCount ) + for( LAYER_NUM layer=LAYER_N_2; layer < NB_COPPER_LAYERS-1; ++layer, --copperCount ) { bool state = copperCount > 0; @@ -548,10 +547,10 @@ void DIALOG_LAYERS_SETUP::OnOkButtonClick( wxCommandEvent& event ) */ m_Pcb->SetVisibleLayers( m_EnabledLayers ); - for( int layer = FIRST_COPPER_LAYER; + for( LAYER_NUM layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; ++layer ) { - if( (1<GetEnabledLayers() ) == 0 ) + if( !( GetLayerMask( getActiveLayer() ) & GetBoard()->GetEnabledLayers() ) ) { - for( int i = 0; i < LAYER_COUNT; i++ ) + for( LAYER_NUM i = FIRST_LAYER; i < NB_LAYERS; ++i ) { - int tmp = i; + LAYER_NUM tmp = i; - if( i >= LAYER_COUNT ) - tmp = i - LAYER_COUNT; + if( i >= NB_LAYERS ) + tmp = i - NB_LAYERS; - if( ( 1 << tmp ) & GetBoard()->GetEnabledLayers() ) + if( GetLayerMask( tmp ) & GetBoard()->GetEnabledLayers() ) { wxLogDebug( wxT( "Setting current layer to %d." ), getActiveLayer() ); setActiveLayer( tmp, true ); diff --git a/pcbnew/dialogs/dialog_pcb_text_properties.cpp b/pcbnew/dialogs/dialog_pcb_text_properties.cpp index dfcc221af1..7a78102c41 100644 --- a/pcbnew/dialogs/dialog_pcb_text_properties.cpp +++ b/pcbnew/dialogs/dialog_pcb_text_properties.cpp @@ -56,7 +56,7 @@ private: PCB_EDIT_FRAME* m_Parent; wxDC* m_DC; TEXTE_PCB* m_SelectedPCBText; - std::vector layerList; + std::vector layerList; void MyInit(); @@ -128,7 +128,7 @@ void DIALOG_PCB_TEXT_PROPERTIES::MyInit() LAYER_MSK enabledLayers = m_Parent->GetBoard()->GetEnabledLayers(); - for( int layer = 0; layer < NB_LAYERS; ++layer ) + for( LAYER_NUM layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer ) { if( enabledLayers & GetLayerMask( layer ) ) { diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp index fff9f9bbf7..cdf268ed5a 100644 --- a/pcbnew/dialogs/dialog_plot.cpp +++ b/pcbnew/dialogs/dialog_plot.cpp @@ -148,7 +148,8 @@ void DIALOG_PLOT::Init_Dialog() // List layers in same order than in setup layers dialog // (Front or Top to Back or Bottom) DECLARE_LAYERS_ORDER_LIST( layersOrder ); - int layerIndex, checkIndex, layer; + int layerIndex, checkIndex; + LAYER_NUM layer; for( layerIndex = 0; layerIndex < NB_LAYERS; layerIndex++ ) { diff --git a/pcbnew/dialogs/dialog_print_using_printer.cpp b/pcbnew/dialogs/dialog_print_using_printer.cpp index 7d711ae9f1..21afdf456c 100644 --- a/pcbnew/dialogs/dialog_print_using_printer.cpp +++ b/pcbnew/dialogs/dialog_print_using_printer.cpp @@ -144,16 +144,16 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( PCB_EDIT_FRAME* parent ) void DIALOG_PRINT_USING_PRINTER::InitValues( ) { - int layer_max = NB_LAYERS; + LAYER_NUM layer_max = NB_PCB_LAYERS; wxString msg; BOARD* board = m_parent->GetBoard(); s_Parameters.m_PageSetupData = s_pageSetupData; // Create layer list. - int layer; + LAYER_NUM layer; wxString layerKey; - for( layer = 0; layer < NB_LAYERS; ++layer ) + for( layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer ) { if( !board->IsLayerEnabled( layer ) ) m_BoxSelectLayer[layer] = NULL; @@ -166,16 +166,16 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) // List layers in same order than in setup layers dialog // (Front or Top to Back or Bottom) DECLARE_LAYERS_ORDER_LIST(layersOrder); - for( int layer_idx = 0; layer_idx < NB_LAYERS; ++layer_idx ) + for( LAYER_NUM layer_idx = FIRST_LAYER; layer_idx < NB_PCB_LAYERS; ++layer_idx ) { layer = layersOrder[layer_idx]; - wxASSERT(layer < NB_LAYERS); + wxASSERT(layer < NB_PCB_LAYERS); if( m_BoxSelectLayer[layer] == NULL ) continue; - if( layer < NB_COPPER_LAYERS ) + if( layer <= LAST_COPPER_LAYER ) m_CopperLayersBoxSizer->Add( m_BoxSelectLayer[layer], 0, wxGROW | wxALL, 1 ); else @@ -280,11 +280,10 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) int DIALOG_PRINT_USING_PRINTER::SetLayerMaskFromListSelection() { int page_count; - int layers_count = NB_LAYERS; s_Parameters.m_PrintMaskLayer = NO_LAYERS; - int ii; - for( ii = 0, page_count = 0; ii < layers_count; ii++ ) + LAYER_NUM ii; + for( ii = FIRST_LAYER, page_count = 0; ii < NB_PCB_LAYERS; ++ii ) { if( m_BoxSelectLayer[ii] == NULL ) continue; @@ -324,7 +323,7 @@ void DIALOG_PRINT_USING_PRINTER::OnCloseWindow( wxCloseEvent& event ) m_config->Write( OPTKEY_PRINT_PAGE_PER_LAYER, s_Parameters.m_OptionPrintPage ); m_config->Write( OPTKEY_PRINT_PADS_DRILL, (long) s_Parameters.m_DrillShapeOpt ); wxString layerKey; - for( int layer = 0; layer < NB_LAYERS; ++layer ) + for( LAYER_NUM layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer ) { if( m_BoxSelectLayer[layer] == NULL ) continue; diff --git a/pcbnew/dimension.cpp b/pcbnew/dimension.cpp index adc6c49a2a..45d76f83cd 100644 --- a/pcbnew/dimension.cpp +++ b/pcbnew/dimension.cpp @@ -132,12 +132,12 @@ DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR( PCB_EDIT_FRAME* aParent, PutValueInLocalUnits( *m_textCtrlPosY, aDimension->Text().GetTextPosition().y ); AddUnitSymbol( *m_staticTextPosY ); - for( int layer = FIRST_NO_COPPER_LAYER; layerAppend( aParent->GetBoard()->GetLayerName( layer ) ); } - m_SelLayerBox->SetSelection( aDimension->GetLayer() - FIRST_NO_COPPER_LAYER ); + m_SelLayerBox->SetSelection( aDimension->GetLayer() - FIRST_NON_COPPER_LAYER ); GetSizer()->Fit( this ); GetSizer()->SetSizeHints( this ); @@ -199,7 +199,7 @@ void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event ) CurrentDimension->Text().SetMirrored( ( m_rbMirror->GetSelection() == 1 ) ? true : false ); - CurrentDimension->SetLayer( m_SelLayerBox->GetCurrentSelection() + FIRST_NO_COPPER_LAYER ); + CurrentDimension->SetLayer( FIRST_NON_COPPER_LAYER + m_SelLayerBox->GetCurrentSelection() ); if( m_DC ) // Display new text { diff --git a/pcbnew/drc_clearance_test_functions.cpp b/pcbnew/drc_clearance_test_functions.cpp index 5df8dcfe95..640f4a4639 100644 --- a/pcbnew/drc_clearance_test_functions.cpp +++ b/pcbnew/drc_clearance_test_functions.cpp @@ -205,7 +205,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads ) // and **only one layer** can be drilled if( aRefSeg->GetShape() == VIA_MICROVIA ) { - int layer1, layer2; + LAYER_NUM layer1, layer2; bool err = true; ( (SEGVIA*) aRefSeg )->ReturnLayerPair( &layer1, &layer2 ); diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index a1b0f61443..fd2384fe2d 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -256,7 +256,7 @@ struct EWIRE double x2; double y2; double width; - int layer; + LAYER_NUM layer; // for style: (continuous | longdash | shortdash | dashdot) enum { @@ -388,7 +388,7 @@ struct ECIRCLE double y; double radius; double width; - int layer; + LAYER_NUM layer; ECIRCLE( CPTREE& aCircle ); }; @@ -1312,7 +1312,7 @@ void EAGLE_PLUGIN::loadLayerDefs( CPTREE& aLayers ) for( EITER it = cu.begin(); it != cu.end(); ++it ) { - int layer = kicad_layer( it->number ); + LAYER_NUM layer = kicad_layer( it->number ); m_board->SetLayerName( layer, FROM_UTF8( it->name.c_str() ) ); m_board->SetLayerType( layer, LT_SIGNAL ); @@ -1333,9 +1333,9 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics ) { m_xpath->push( "wire" ); EWIRE w( gr->second ); - int layer = kicad_layer( w.layer ); + LAYER_NUM layer = kicad_layer( w.layer ); - if( layer != -1 ) + if( layer != UNDEFINED_LAYER ) { DRAWSEGMENT* dseg = new DRAWSEGMENT( m_board ); m_board->Add( dseg, ADD_APPEND ); @@ -1360,7 +1360,7 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics ) #endif m_xpath->push( "text" ); ETEXT t( gr->second ); - int layer = kicad_layer( t.layer ); + LAYER_NUM layer = kicad_layer( t.layer ); if( layer != -1 ) // supported layer { @@ -1450,9 +1450,9 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics ) { m_xpath->push( "circle" ); ECIRCLE c( gr->second ); - int layer = kicad_layer( c.layer ); + LAYER_NUM layer = kicad_layer( c.layer ); - if( layer != -1 ) // unsupported layer + if( layer != UNDEFINED_LAYER ) // unsupported layer { DRAWSEGMENT* dseg = new DRAWSEGMENT( m_board ); m_board->Add( dseg, ADD_APPEND ); @@ -1473,7 +1473,7 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics ) { m_xpath->push( "rectangle" ); ERECT r( gr->second ); - int layer = kicad_layer( r.layer ); + LAYER_NUM layer = kicad_layer( r.layer ); if( IsValidCopperLayerIndex( layer ) ) { @@ -1908,7 +1908,7 @@ MODULE* EAGLE_PLUGIN::makeModule( CPTREE& aPackage, const std::string& aPkgName void EAGLE_PLUGIN::packageWire( MODULE* aModule, CPTREE& aTree ) const { EWIRE w( aTree ); - int layer = kicad_layer( w.layer ); + LAYER_NUM layer = kicad_layer( w.layer ); if( IsValidNonCopperLayerIndex( layer ) ) // skip copper package wires { @@ -2015,7 +2015,7 @@ void EAGLE_PLUGIN::packagePad( MODULE* aModule, CPTREE& aTree ) const void EAGLE_PLUGIN::packageText( MODULE* aModule, CPTREE& aTree ) const { ETEXT t( aTree ); - int layer = kicad_layer( t.layer ); + LAYER_NUM layer = kicad_layer( t.layer ); TEXTE_MODULE* txt; @@ -2118,7 +2118,7 @@ void EAGLE_PLUGIN::packageText( MODULE* aModule, CPTREE& aTree ) const void EAGLE_PLUGIN::packageRectangle( MODULE* aModule, CPTREE& aTree ) const { ERECT r( aTree ); - int layer = kicad_layer( r.layer ); + LAYER_NUM layer = kicad_layer( r.layer ); if( IsValidNonCopperLayerIndex( layer ) ) // skip copper "package.rectangle"s { @@ -2151,7 +2151,7 @@ void EAGLE_PLUGIN::packageRectangle( MODULE* aModule, CPTREE& aTree ) const void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, CPTREE& aTree ) const { EPOLYGON p( aTree ); - int layer = kicad_layer( p.layer ); + LAYER_NUM layer = kicad_layer( p.layer ); if( IsValidNonCopperLayerIndex( layer ) ) // skip copper "package.rectangle"s { @@ -2200,7 +2200,7 @@ void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, CPTREE& aTree ) const void EAGLE_PLUGIN::packageCircle( MODULE* aModule, CPTREE& aTree ) const { ECIRCLE e( aTree ); - int layer = kicad_layer( e.layer ); + LAYER_NUM layer = kicad_layer( e.layer ); EDGE_MODULE* gr = new EDGE_MODULE( aModule, S_CIRCLE ); aModule->GraphicalItems().PushBack( gr ); @@ -2257,7 +2257,7 @@ void EAGLE_PLUGIN::packageHole( MODULE* aModule, CPTREE& aTree ) const void EAGLE_PLUGIN::packageSMD( MODULE* aModule, CPTREE& aTree ) const { ESMD e( aTree ); - int layer = kicad_layer( e.layer ); + LAYER_NUM layer = kicad_layer( e.layer ); if( !IsValidCopperLayerIndex( layer ) ) { @@ -2349,7 +2349,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals ) { m_xpath->push( "wire" ); EWIRE w( it->second ); - int layer = kicad_layer( w.layer ); + LAYER_NUM layer = kicad_layer( w.layer ); if( IsValidCopperLayerIndex( layer ) ) { @@ -2383,8 +2383,8 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals ) m_xpath->push( "via" ); EVIA v( it->second ); - int layer_front_most = kicad_layer( v.layer_front_most ); - int layer_back_most = kicad_layer( v.layer_back_most ); + LAYER_NUM layer_front_most = kicad_layer( v.layer_front_most ); + LAYER_NUM layer_back_most = kicad_layer( v.layer_back_most ); if( IsValidCopperLayerIndex( layer_front_most ) && IsValidCopperLayerIndex( layer_back_most ) ) @@ -2462,7 +2462,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals ) { m_xpath->push( "polygon" ); EPOLYGON p( it->second ); - int layer = kicad_layer( p.layer ); + LAYER_NUM layer = kicad_layer( p.layer ); if( IsValidCopperLayerIndex( layer ) ) { @@ -2545,7 +2545,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals ) } -int EAGLE_PLUGIN::kicad_layer( int aEagleLayer ) const +LAYER_NUM EAGLE_PLUGIN::kicad_layer( int aEagleLayer ) const { /* will assume this is a valid mapping for all eagle boards until I get paid more: @@ -2625,7 +2625,7 @@ int EAGLE_PLUGIN::kicad_layer( int aEagleLayer ) const else { /* -#define FIRST_NO_COPPER_LAYER 16 +#define FIRST_NON_COPPER_LAYER 16 #define ADHESIVE_N_BACK 16 #define ADHESIVE_N_FRONT 17 #define SOLDERPASTE_N_BACK 18 @@ -2639,7 +2639,7 @@ int EAGLE_PLUGIN::kicad_layer( int aEagleLayer ) const #define ECO1_N 26 #define ECO2_N 27 #define EDGE_N 28 -#define LAST_NO_COPPER_LAYER 28 +#define LAST_NON_COPPER_LAYER 28 #define UNUSED_LAYER_29 29 #define UNUSED_LAYER_30 30 #define UNUSED_LAYER_31 31 diff --git a/pcbnew/eagle_plugin.h b/pcbnew/eagle_plugin.h index a84b2af6bd..077bb942aa 100644 --- a/pcbnew/eagle_plugin.h +++ b/pcbnew/eagle_plugin.h @@ -159,7 +159,7 @@ private: wxSize kicad_fontz( double d ) const; /// Convert an Eagle layer to a KiCad layer. - int kicad_layer( int aLayer ) const; + LAYER_NUM kicad_layer( int aLayer ) const; /// Convert a KiCad distance to an Eagle distance. double eagle( BIU d ) const { return mm_per_biu * d; } diff --git a/pcbnew/edgemod.cpp b/pcbnew/edgemod.cpp index 620ae55961..2b5f52b82d 100644 --- a/pcbnew/edgemod.cpp +++ b/pcbnew/edgemod.cpp @@ -191,7 +191,7 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Width( EDGE_MODULE* aEdge ) void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* aEdge ) { MODULE* module = GetBoard()->m_Modules; - int new_layer = SILKSCREEN_N_FRONT; + LAYER_NUM new_layer = SILKSCREEN_N_FRONT; if( aEdge ) new_layer = aEdge->GetLayer(); diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 13d0908dc5..51f4c5f8e8 100755 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -62,7 +62,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) int id = event.GetId(); wxPoint pos; - int itmp; + LAYER_NUM itmp; INSTALL_UNBUFFERED_DC( dc, m_canvas ); MODULE* module; @@ -916,7 +916,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_PCB_SELECT_LAYER: - itmp = SelectLayer( getActiveLayer(), -1, -1 ); + itmp = SelectLayer( getActiveLayer(), UNDEFINED_LAYER, UNDEFINED_LAYER ); if( itmp >= 0 ) setActiveLayer( itmp ); @@ -929,7 +929,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_PCB_SELECT_NO_CU_LAYER: - itmp = SelectLayer( getActiveLayer(), FIRST_NO_COPPER_LAYER, -1 ); + itmp = SelectLayer( getActiveLayer(), FIRST_NON_COPPER_LAYER, UNDEFINED_LAYER ); if( itmp >= 0 ) setActiveLayer( itmp ); @@ -938,7 +938,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_POPUP_PCB_SELECT_CU_LAYER: - itmp = SelectLayer( getActiveLayer(), -1, LAST_COPPER_LAYER ); + itmp = SelectLayer( getActiveLayer(), UNDEFINED_LAYER, LAST_COPPER_LAYER ); if( itmp >= 0 ) setActiveLayer( itmp ); @@ -951,7 +951,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_TOOLBARH_PCB_SELECT_LAYER: - setActiveLayer( (size_t) m_SelLayerBox->GetLayerSelection()); + setActiveLayer( m_SelLayerBox->GetLayerSelection() ); if( DisplayOpt.ContrastModeDisplay ) m_canvas->Refresh( true ); @@ -1238,9 +1238,9 @@ void PCB_EDIT_FRAME::RemoveStruct( BOARD_ITEM* Item, wxDC* DC ) } -void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, int layer ) +void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, LAYER_NUM layer ) { - int curLayer = getActiveLayer(); + LAYER_NUM curLayer = getActiveLayer(); // Check if the specified layer matches the present layer if( layer == curLayer ) diff --git a/pcbnew/edit_pcb_text.cpp b/pcbnew/edit_pcb_text.cpp index 3930ab6026..3037184890 100644 --- a/pcbnew/edit_pcb_text.cpp +++ b/pcbnew/edit_pcb_text.cpp @@ -203,7 +203,7 @@ TEXTE_PCB* PCB_EDIT_FRAME::CreateTextePcb( wxDC* aDC, TEXTE_PCB* aText ) { GetBoard()->Add( textePcb ); textePcb->SetFlags( IS_NEW ); - int layer = ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer; + LAYER_NUM layer = ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer; textePcb->SetLayer( layer ); // Set the mirrored option for layers on the BACK side of the board diff --git a/pcbnew/editedge.cpp b/pcbnew/editedge.cpp index 685bf7a916..39bd894238 100644 --- a/pcbnew/editedge.cpp +++ b/pcbnew/editedge.cpp @@ -144,7 +144,7 @@ void PCB_EDIT_FRAME::Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC ) } -void PCB_EDIT_FRAME::Delete_Drawings_All_Layer( int aLayer ) +void PCB_EDIT_FRAME::Delete_Drawings_All_Layer( LAYER_NUM aLayer ) { if( aLayer <= LAST_COPPER_LAYER ) { diff --git a/pcbnew/editrack-part2.cpp b/pcbnew/editrack-part2.cpp index 6f89d66e60..e36a3a92a1 100644 --- a/pcbnew/editrack-part2.cpp +++ b/pcbnew/editrack-part2.cpp @@ -109,8 +109,8 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) via->SetLayerPair( LAYER_N_BACK, LAYER_N_FRONT ); via->SetDrill( GetBoard()->GetCurrentViaDrill() ); - int first_layer = getActiveLayer(); - int last_layer; + LAYER_NUM first_layer = getActiveLayer(); + LAYER_NUM last_layer; // prepare switch to new active layer: if( first_layer != GetScreen()->m_Route_Layer_TOP ) @@ -127,7 +127,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) case VIA_MICROVIA: // from external to the near neighbor inner layer { - int last_inner_layer = GetBoard()->GetCopperLayerCount() - 2; + LAYER_NUM last_inner_layer = FIRST_LAYER + (GetBoard()->GetCopperLayerCount() - 2); if ( first_layer == LAYER_N_BACK ) last_layer = LAYER_N_2; else if ( first_layer == LAYER_N_FRONT ) diff --git a/pcbnew/editrack.cpp b/pcbnew/editrack.cpp index 7064aceac4..651f26dd0c 100644 --- a/pcbnew/editrack.cpp +++ b/pcbnew/editrack.cpp @@ -535,7 +535,7 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* aDC ) } -TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack, int aLayer, const wxPoint& aRef ) +TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack, LAYER_NUM aLayer, const wxPoint& aRef ) { int net = aTrack->GetNet(); int width = aTrack->GetWidth(); diff --git a/pcbnew/export_gencad.cpp b/pcbnew/export_gencad.cpp index 06001dcdd7..4d19b63a34 100644 --- a/pcbnew/export_gencad.cpp +++ b/pcbnew/export_gencad.cpp @@ -439,7 +439,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) via->GetWidth(), via->GetDrillValue(), mask, via->GetDrillValue() / SCALE_FACTOR ); - for( int layer = 0; layer < 32; layer++ ) + for( LAYER_NUM layer = FIRST_LAYER; layer < NB_LAYERS; ++layer ) { if( mask & GetLayerMask( layer ) ) { @@ -463,7 +463,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) // Straight padstack fprintf( aFile, "PADSTACK PAD%d %g\n", i, pad->GetDrillSize().x / SCALE_FACTOR ); - for( int layer = 0; layer < 32; layer++ ) + for( LAYER_NUM layer = FIRST_LAYER; layer < NB_LAYERS; ++layer ) { if( pad->GetLayerMask() & GetLayerMask( layer ) & master_layermask ) { @@ -475,7 +475,7 @@ static void CreatePadsShapesSection( FILE* aFile, BOARD* aPcb ) // Flipped padstack fprintf( aFile, "PADSTACK PAD%dF %g\n", i, pad->GetDrillSize().x / SCALE_FACTOR ); - for( int layer = 0; layer < 32; layer++ ) + for( LAYER_NUM layer = FIRST_LAYER; layer < NB_LAYERS; ++layer ) { if( pad->GetLayerMask() & GetLayerMask( layer ) & master_layermask ) { diff --git a/pcbnew/export_vrml.cpp b/pcbnew/export_vrml.cpp index b1706d069a..99e4e006d5 100644 --- a/pcbnew/export_vrml.cpp +++ b/pcbnew/export_vrml.cpp @@ -96,7 +96,7 @@ struct FLAT_FAN { pts.push_back( POINT_2D( x, y ) ); } - void bag( int layer, bool close = true ); + void bag( LAYER_NUM layer, bool close = true ); }; // A flat quad ring @@ -114,7 +114,7 @@ struct FLAT_RING outer.push_back( POINT_2D( x, y ) ); } - void bag( int layer, bool close = true ); + void bag( LAYER_NUM layer, bool close = true ); }; // A vertical quad loop @@ -131,11 +131,11 @@ struct VLoop }; // The bags for all the layers -static TRIANGLEBAG layer_triangles[LAYER_COUNT]; +static TRIANGLEBAG layer_triangles[NB_LAYERS]; static TRIANGLEBAG via_triangles[4]; -static double layer_z[LAYER_COUNT]; +static double layer_z[NB_LAYERS]; -static void bag_flat_triangle( int layer, //{{{ +static void bag_flat_triangle( LAYER_NUM layer, //{{{ double x1, double y1, double x2, double y2, double x3, double y3 ) @@ -146,7 +146,7 @@ static void bag_flat_triangle( int layer, //{{{ } -void FLAT_FAN::bag( int layer, bool close ) //{{{ +void FLAT_FAN::bag( LAYER_NUM layer, bool close ) //{{{ { unsigned i; @@ -158,7 +158,7 @@ void FLAT_FAN::bag( int layer, bool close ) //{{{ } -static void bag_flat_quad( int layer, //{{{ +static void bag_flat_quad( LAYER_NUM layer, //{{{ double x1, double y1, double x2, double y2, double x3, double y3, @@ -169,7 +169,7 @@ static void bag_flat_quad( int layer, //{{{ } -void FLAT_RING::bag( int layer, bool close ) //{{{ +void FLAT_RING::bag( LAYER_NUM layer, bool close ) //{{{ { unsigned i; @@ -343,7 +343,7 @@ static void compute_layer_Zs( BOARD* pcb ) //{{{ double half_thickness = board_thickness / 2; // Compute each layer's Z value, more or less like the 3d view - for( int i = 0; i <= LAYER_N_FRONT; i++ ) + for( LAYER_NUM i = FIRST_LAYER; i <= LAYER_N_FRONT; ++i ) { if( i < copper_layers ) layer_z[i] = board_thickness * i / (copper_layers - 1) - half_thickness; @@ -370,7 +370,7 @@ static void compute_layer_Zs( BOARD* pcb ) //{{{ } -static void export_vrml_line( int layer, double startx, double starty, //{{{ +static void export_vrml_line( LAYER_NUM layer, double startx, double starty, //{{{ double endx, double endy, double width, int divisions ) { double r = width / 2; @@ -399,7 +399,7 @@ static void export_vrml_line( int layer, double startx, double starty, //{{{ } -static void export_vrml_circle( int layer, double startx, double starty, +static void export_vrml_circle( LAYER_NUM layer, double startx, double starty, //{{{ double endx, double endy, double width ) { double hole, radius; @@ -419,7 +419,7 @@ static void export_vrml_circle( int layer, double startx, double starty, static void export_vrml_slot( TRIANGLEBAG& triangles, //{{{ - int top_layer, int bottom_layer, double xc, double yc, + LAYER_NUM top_layer, LAYER_NUM bottom_layer, double xc, double yc, double dx, double dy, int orient ) { double capx, capy; // Cap center @@ -478,7 +478,7 @@ static void export_vrml_hole( TRIANGLEBAG& triangles, } -static void export_vrml_oval_pad( int layer, double xc, double yc, +static void export_vrml_oval_pad( LAYER_NUM layer, double xc, double yc, double dx, double dy, int orient ) { double capx, capy; // Cap center @@ -521,7 +521,7 @@ static void export_vrml_oval_pad( int layer, double xc, double yc, } -static void export_vrml_arc( int layer, double centerx, double centery, +static void export_vrml_arc( LAYER_NUM layer, double centerx, double centery, double arc_startx, double arc_starty, double width, double arc_angle ) { @@ -557,7 +557,7 @@ static void export_vrml_arc( int layer, double centerx, double centery, static void export_vrml_varc( TRIANGLEBAG& triangles, - int top_layer, int bottom_layer, + LAYER_NUM top_layer, LAYER_NUM bottom_layer, double centerx, double centery, double arc_startx, double arc_starty, double arc_angle ) @@ -594,7 +594,7 @@ static void export_vrml_varc( TRIANGLEBAG& triangles, static void export_vrml_drawsegment( DRAWSEGMENT* drawseg ) //{{{ { - int layer = drawseg->GetLayer(); + LAYER_NUM layer = drawseg->GetLayer(); double w = drawseg->GetWidth(); double x = drawseg->GetStart().x; double y = drawseg->GetStart().y; @@ -658,7 +658,7 @@ static void export_vrml_drawsegment( DRAWSEGMENT* drawseg ) //{{{ /* C++ doesn't have closures and neither continuation forms... this is * for coupling the vrml_text_callback with the common parameters */ -static int s_text_layer; +static LAYER_NUM s_text_layer; static int s_text_width; static void vrml_text_callback( int x0, int y0, int xf, int yf ) { @@ -735,13 +735,12 @@ static void export_vrml_drawings( BOARD* pcb ) //{{{ } -static void export_round_padstack( BOARD* pcb, double x, double y, - double r, - int bottom_layer, int top_layer ) +static void export_round_padstack( BOARD* pcb, double x, double y, double r, //{{{ + LAYER_NUM bottom_layer, LAYER_NUM top_layer ) { int copper_layers = pcb->GetCopperLayerCount( ); - for( int layer = bottom_layer; layer < copper_layers; layer++ ) + for( LAYER_NUM layer = bottom_layer; layer < copper_layers; ++layer ) { // The last layer is always the component one, unless it's single face if( (layer > FIRST_COPPER_LAYER) && (layer == copper_layers - 1) ) @@ -756,7 +755,7 @@ static void export_round_padstack( BOARD* pcb, double x, double y, static void export_vrml_via( BOARD* pcb, SEGVIA* via ) //{{{ { double x, y, r, hole; - int top_layer, bottom_layer; + LAYER_NUM top_layer, bottom_layer; r = via->GetWidth() / 2; hole = via->GetDrillValue() / 2; @@ -813,7 +812,7 @@ static void export_vrml_zones( BOARD* pcb ) if( width > 0 ) { int imax = zone->m_FilledPolysList.size() - 1; - int layer = zone->GetLayer(); + LAYER_NUM layer = zone->GetLayer(); CPolyPt* firstcorner = &zone->m_FilledPolysList[0]; CPolyPt* begincorner = firstcorner; @@ -866,7 +865,7 @@ static void export_vrml_text_module( TEXTE_MODULE* module ) //{{{ static void export_vrml_edge_module( EDGE_MODULE* aOutline ) //{{{ { - int layer = aOutline->GetLayer(); + LAYER_NUM layer = aOutline->GetLayer(); double x = aOutline->GetStart().x; double y = aOutline->GetStart().y; double xf = aOutline->GetEnd().x; @@ -933,7 +932,7 @@ static void export_vrml_pad( BOARD* pcb, D_PAD* aPad ) //{{{ double pad_w = aPad->GetSize().x / 2; double pad_h = aPad->GetSize().y / 2; - for( int layer = FIRST_COPPER_LAYER; layer < copper_layers; layer++ ) + for( LAYER_NUM layer = FIRST_COPPER_LAYER; layer < copper_layers; ++layer ) { // The last layer is always the component one, unless it's single face if( (layer > FIRST_COPPER_LAYER) && (layer == copper_layers - 1) ) @@ -1267,7 +1266,7 @@ bool PCB_EDIT_FRAME::ExportVRML_File( const wxString & aFullFileName, /* Output the bagged triangles for each layer * Each layer will be a separate shape */ - for( int layer = 0; layer < LAYER_COUNT; layer++ ) + for( LAYER_NUM layer = FIRST_LAYER; layer < NB_LAYERS; ++layer ) write_and_empty_triangle_bag( output_file, layer_triangles[layer], pcb->GetLayerColor(layer), diff --git a/pcbnew/gen_drill_report_files.cpp b/pcbnew/gen_drill_report_files.cpp index ce0d15e015..462cf2a60f 100644 --- a/pcbnew/gen_drill_report_files.cpp +++ b/pcbnew/gen_drill_report_files.cpp @@ -336,8 +336,8 @@ bool EXCELLON_WRITER::GenDrillReportFile( const wxString& aFullFileName ) { unsigned totalHoleCount; char line[1024]; - int layer1 = LAYER_N_BACK; - int layer2 = LAYER_N_FRONT; + LAYER_NUM layer1 = LAYER_N_BACK; + LAYER_NUM layer2 = LAYER_N_FRONT; bool gen_through_holes = true; bool gen_NPTH_holes = false; @@ -443,7 +443,7 @@ bool EXCELLON_WRITER::GenDrillReportFile( const wxString& aFullFileName ) continue; } - layer1++; layer2++; // use next layer pair + ++layer1; ++layer2; // use next layer pair if( layer2 == m_pcb->GetCopperLayerCount() - 1 ) layer2 = LAYER_N_FRONT; // the last layer is always the diff --git a/pcbnew/gen_modules_placefile.cpp b/pcbnew/gen_modules_placefile.cpp index f6cbbe1afa..eaf18bb680 100644 --- a/pcbnew/gen_modules_placefile.cpp +++ b/pcbnew/gen_modules_placefile.cpp @@ -57,7 +57,7 @@ public: MODULE* m_Module; // Link to the actual footprint const wxChar* m_Reference; // Its schematic reference const wxChar* m_Value; // Its schematic value - int m_Layer; // its side (LAYER_N_BACK, or LAYER_N_FRONT) + LAYER_NUM m_Layer; // its side (LAYER_N_BACK, or LAYER_N_FRONT) }; @@ -486,7 +486,7 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName, -module_pos.y * conv_unit, double(list[ii].m_Module->GetOrientation()) / 10 ); - int layer = list[ii].m_Module->GetLayer(); + LAYER_NUM layer = list[ii].m_Module->GetLayer(); wxASSERT( layer==LAYER_N_FRONT || layer==LAYER_N_BACK ); diff --git a/pcbnew/gendrill_Excellon_writer.h b/pcbnew/gendrill_Excellon_writer.h index 0e1318a39c..0803066f44 100644 --- a/pcbnew/gendrill_Excellon_writer.h +++ b/pcbnew/gendrill_Excellon_writer.h @@ -70,8 +70,8 @@ public: int m_Hole_Orient; // Hole rotation (= pad rotation) for oblong holes int m_Hole_Shape; // hole shape: round (0) or oval (1) wxPoint m_Hole_Pos; // hole position - int m_Hole_Bottom_Layer; // hole starting layer (usually back layer) - int m_Hole_Top_Layer; // hole ending layer (usually front layer): + LAYER_NUM m_Hole_Bottom_Layer; // hole starting layer (usually back layer) + LAYER_NUM m_Hole_Top_Layer; // hole ending layer (usually front layer): // m_Hole_First_Layer < m_Hole_Last_Layer bool m_Hole_NotPlated; // hole not plated. Must be in a specific drill file public: diff --git a/pcbnew/hotkeys_board_editor.cpp b/pcbnew/hotkeys_board_editor.cpp index 2593994d4f..f1ef2fa000 100644 --- a/pcbnew/hotkeys_board_editor.cpp +++ b/pcbnew/hotkeys_board_editor.cpp @@ -129,7 +129,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); cmd.SetEventObject( this ); - int ll; + LAYER_NUM ll; unsigned int cnt; switch( hk_id ) @@ -249,9 +249,9 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit if( GetBoard()->GetCopperLayerCount() < 2 ) // Single layer ll = LAYER_N_BACK; else if( ll == LAYER_N_FRONT ) - ll = std::max( LAYER_N_BACK, GetBoard()->GetCopperLayerCount() - 2 ); + ll = std::max( LAYER_N_BACK, FIRST_COPPER_LAYER + GetBoard()->GetCopperLayerCount() - 2 ); else - ll--; + --ll; SwitchLayer( aDC, ll ); break; @@ -267,7 +267,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit else if( ll >= GetBoard()->GetCopperLayerCount() - 2 ) ll = LAYER_N_FRONT; else - ll++; + ++ll; SwitchLayer( aDC, ll ); break; @@ -585,7 +585,7 @@ bool PCB_EDIT_FRAME::OnHotkeyDeleteItem( wxDC* aDC ) if( ItemFree ) { wxPoint pos = GetScreen()->RefPos( false ); - MODULE* module = GetBoard()->GetFootprint( pos, ALL_LAYERS, false ); + MODULE* module = GetBoard()->GetFootprint( pos, UNDEFINED_LAYER, false ); if( module == NULL ) return false; diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index a047e644fa..d9c5ee4c49 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -383,7 +383,7 @@ void PCB_IO::formatLayer( const BOARD_ITEM* aItem ) const { if( m_ctl & CTL_STD_LAYER_NAMES ) { - int layer = aItem->GetLayer(); + LAYER_NUM layer = aItem->GetLayer(); // English layer names should never need quoting. m_out->Print( 0, " (layer %s)", TO_UTF8( BOARD::GetStandardLayerName( layer ) ) ); @@ -425,7 +425,7 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const m_out->Print( aNestLevel, "(layers\n" ); unsigned mask = LAYER_FRONT; - int layer = LAYER_N_FRONT; + LAYER_NUM layer = LAYER_N_FRONT; // Save only the used copper layers from front to back. while( mask != 0 ) @@ -443,14 +443,14 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const } mask >>= 1; - layer--; + --layer; } mask = ADHESIVE_LAYER_BACK; layer = ADHESIVE_N_BACK; // Save used non-copper layers in the order they are defined. - while( layer < LAYER_COUNT ) + while( layer < NB_LAYERS ) { if( mask & aBoard->GetEnabledLayers() ) { @@ -464,7 +464,7 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const } mask <<= 1; - layer++; + ++layer; } m_out->Print( aNestLevel, ")\n\n" ); @@ -1036,7 +1036,7 @@ void PCB_IO::formatLayers( LAYER_MSK aLayerMask, int aNestLevel ) const wxString layerName; - for( int layer = 0; layerMask; ++layer, layerMask >>= 1 ) + for( LAYER_NUM layer = FIRST_LAYER; layerMask; ++layer, layerMask >>= 1 ) { if( layerMask & 1 ) { @@ -1236,7 +1236,7 @@ void PCB_IO::format( TRACK* aTrack, int aNestLevel ) const { if( aTrack->Type() == PCB_VIA_T ) { - int layer1, layer2; + LAYER_NUM layer1, layer2; SEGVIA* via = (SEGVIA*) aTrack; BOARD* board = (BOARD*) via->GetParent(); diff --git a/pcbnew/layer_widget.cpp b/pcbnew/layer_widget.cpp index 63f372ae15..3d028f2ead 100644 --- a/pcbnew/layer_widget.cpp +++ b/pcbnew/layer_widget.cpp @@ -223,7 +223,7 @@ wxBitmapButton* LAYER_WIDGET::makeColorButton( wxWindow* aParent, EDA_COLOR_T aC void LAYER_WIDGET::OnLeftDownLayers( wxMouseEvent& event ) { int row; - int layer; + LAYER_NUM layer; wxWindow* eventSource = (wxWindow*) event.GetEventObject(); @@ -284,7 +284,7 @@ void LAYER_WIDGET::OnMiddleDownLayerColor( wxMouseEvent& event ) wxBitmap bm = makeBitmap( newColor ); eventSource->SetBitmapLabel( bm ); - int layer = getDecodedId( eventSource->GetId() ); + LAYER_NUM layer = getDecodedId( eventSource->GetId() ); // tell the client code. OnLayerColorChange( layer, newColor ); @@ -297,7 +297,7 @@ void LAYER_WIDGET::OnMiddleDownLayerColor( wxMouseEvent& event ) void LAYER_WIDGET::OnLayerCheckBox( wxCommandEvent& event ) { wxCheckBox* eventSource = (wxCheckBox*) event.GetEventObject(); - int layer = getDecodedId( eventSource->GetId() ); + LAYER_NUM layer = getDecodedId( eventSource->GetId() ); OnLayerVisible( layer, eventSource->IsChecked() ); passOnFocus(); } @@ -348,14 +348,14 @@ void LAYER_WIDGET::OnTabChange( wxNotebookEvent& event ) wxWindow* LAYER_WIDGET::getLayerComp( int aRow, int aColumn ) const { - int ndx = aRow * LYR_COLUMN_COUNT + aColumn; - if( (unsigned) ndx < m_LayersFlexGridSizer->GetChildren().GetCount() ) + unsigned ndx = aRow * LYR_COLUMN_COUNT + aColumn; + if( ndx < m_LayersFlexGridSizer->GetChildren().GetCount() ) return m_LayersFlexGridSizer->GetChildren()[ndx]->GetWindow(); return NULL; } -int LAYER_WIDGET::findLayerRow( int aLayer ) const +int LAYER_WIDGET::findLayerRow( LAYER_NUM aLayer ) const { int count = GetLayerRowCount(); for( int row=0; rowGetId() ); - return -1; + return UNDEFINED_LAYER; } -void LAYER_WIDGET::SetLayerVisible( int aLayer, bool isVisible ) +void LAYER_WIDGET::SetLayerVisible( LAYER_NUM aLayer, bool isVisible ) { int row = findLayerRow( aLayer ); if( row >= 0 ) @@ -768,7 +768,7 @@ void LAYER_WIDGET::SetLayerVisible( int aLayer, bool isVisible ) } -bool LAYER_WIDGET::IsLayerVisible( int aLayer ) +bool LAYER_WIDGET::IsLayerVisible( LAYER_NUM aLayer ) { int row = findLayerRow( aLayer ); if( row >= 0 ) @@ -781,7 +781,7 @@ bool LAYER_WIDGET::IsLayerVisible( int aLayer ) } -void LAYER_WIDGET::SetLayerColor( int aLayer, EDA_COLOR_T aColor ) +void LAYER_WIDGET::SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor ) { int row = findLayerRow( aLayer ); if( row >= 0 ) @@ -798,7 +798,7 @@ void LAYER_WIDGET::SetLayerColor( int aLayer, EDA_COLOR_T aColor ) } -EDA_COLOR_T LAYER_WIDGET::GetLayerColor( int aLayer ) const +EDA_COLOR_T LAYER_WIDGET::GetLayerColor( LAYER_NUM aLayer ) const { int row = findLayerRow( aLayer ); if( row >= 0 ) @@ -875,7 +875,7 @@ class MYFRAME : public wxFrame { } - void OnLayerColorChange( int aLayer, EDA_COLOR_T aColor ) + void OnLayerColorChange( LAYER aLayer, EDA_COLOR_T aColor ) { printf( "OnLayerColorChange( aLayer:%d, aColor:%d )\n", aLayer, aColor ); @@ -888,13 +888,13 @@ class MYFRAME : public wxFrame */ } - bool OnLayerSelect( int aLayer ) + bool OnLayerSelect( LAYER aLayer ) { printf( "OnLayerSelect( aLayer:%d )\n", aLayer ); return true; } - void OnLayerVisible( int aLayer, bool isVisible, bool isFinal ) + void OnLayerVisible( LAYER aLayer, bool isVisible, bool isFinal ) { printf( "OnLayerVisible( aLayer:%d, isVisible:%d isFinal:%d)\n", aLayer, isVisible, isFinal ); } diff --git a/pcbnew/layer_widget.h b/pcbnew/layer_widget.h index a39fe8644b..a74a9e186b 100644 --- a/pcbnew/layer_widget.h +++ b/pcbnew/layer_widget.h @@ -181,7 +181,7 @@ protected: * Function findLayerRow * returns the row index that \a aLayer resides in, or -1 if not found. */ - int findLayerRow( int aLayer ) const; + int findLayerRow( LAYER_NUM aLayer ) const; int findRenderRow( int aId ) const; /** @@ -296,37 +296,37 @@ public: * Function SelectLayer * changes the row selection in the layer list to \a aLayer provided. */ - void SelectLayer( int aLayer ); + void SelectLayer( LAYER_NUM aLayer ); /** * Function GetSelectedLayer * returns the selected layer or -1 if none. */ - int GetSelectedLayer(); + LAYER_NUM GetSelectedLayer(); /** * Function SetLayerVisible * sets \a aLayer visible or not. This does not invoke OnLayerVisible(). */ - void SetLayerVisible( int aLayer, bool isVisible ); + void SetLayerVisible( LAYER_NUM aLayer, bool isVisible ); /** * Function IsLayerVisible * returns the visible state of the layer ROW associated with \a aLayer id. */ - bool IsLayerVisible( int aLayer ); + bool IsLayerVisible( LAYER_NUM aLayer ); /** * Function SetLayerColor * changes the color of \a aLayer */ - void SetLayerColor( int aLayer, EDA_COLOR_T aColor ); + void SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor ); /** * Function GetLayerColor * returns the color of the layer ROW associated with \a aLayer id. */ - EDA_COLOR_T GetLayerColor( int aLayer ) const; + EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const; /** * Function SetRenderState @@ -374,7 +374,7 @@ public: * @param aLayer is the board layer to change * @param aColor is the new color */ - virtual void OnLayerColorChange( int aLayer, EDA_COLOR_T aColor ) = 0; + virtual void OnLayerColorChange( LAYER_NUM aLayer, EDA_COLOR_T aColor ) = 0; /** * Function OnLayerSelect @@ -383,7 +383,7 @@ public: * the change by returning false. * @param aLayer is the board layer to select */ - virtual bool OnLayerSelect( int aLayer ) = 0; + virtual bool OnLayerSelect( LAYER_NUM aLayer ) = 0; /** * Function OnLayerVisible @@ -395,7 +395,7 @@ public: * such calls, and can be used to decide when to update the screen only * one time instead of several times in the midst of a multiple layer change. */ - virtual void OnLayerVisible( int aLayer, bool isVisible, bool isFinal = true ) = 0; + virtual void OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal = true ) = 0; /** * Function OnRenderColorChange diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index 3a945691a3..29669bec82 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -208,6 +208,14 @@ static inline int intParse( const char* next, const char** out = NULL ) return (int) strtol( next, (char**) out, 10 ); } +/** + * Function layerParse + * Like intParse but returns a LAYER_NUM + */ +static inline LAYER_NUM layerParse( const char* next, const char** out = NULL ) +{ + return intParse( next, out ); +} /** * Function hexParse @@ -429,7 +437,9 @@ void LEGACY_PLUGIN::loadGENERAL() int layer_mask = hexParse( line + SZ( "Ly" ) ); int layer_count = 0; - for( int ii = 0; ii < NB_COPPER_LAYERS && layer_mask; ++ii, layer_mask >>= 1 ) + for( LAYER_NUM ii = FIRST_COPPER_LAYER; + ii < NB_COPPER_LAYERS && layer_mask; + ++ii, layer_mask >>= 1 ) { if( layer_mask & 1 ) layer_count++; @@ -657,7 +667,7 @@ void LEGACY_PLUGIN::loadSETUP() { // eg: "Layer[n] " - int layer = intParse( line + SZ( "Layer[" ), &data ); + LAYER_NUM layer = layerParse( line + SZ( "Layer[" ), &data ); data = strtok( (char*) data+1, delims ); // +1 for ']' if( data ) @@ -970,7 +980,7 @@ MODULE* LEGACY_PLUGIN::LoadMODULE() BIU pos_x = biuParse( line + SZ( "Po" ), &data ); BIU pos_y = biuParse( data, &data ); int orient = intParse( data, &data ); - int layer = intParse( data, &data ); + LAYER_NUM layer = layerParse( data, &data ); long edittime = hexParse( data, &data ); time_t timestamp = hexParse( data, &data ); @@ -1377,7 +1387,7 @@ void LEGACY_PLUGIN::loadMODULE_EDGE( MODULE* aModule ) // common to all cases, and we have to check their values uniformly at end BIU width = 1; - int layer = FIRST_NON_COPPER_LAYER; + LAYER_NUM layer = FIRST_NON_COPPER_LAYER; switch( shape ) { @@ -1391,7 +1401,7 @@ void LEGACY_PLUGIN::loadMODULE_EDGE( MODULE* aModule ) double angle = degParse( data, &data ); width = biuParse( data, &data ); - layer = intParse( data ); + layer = layerParse( data ); dwg->SetAngle( angle ); dwg->m_Start0 = wxPoint( start0_x, start0_y ); @@ -1411,7 +1421,7 @@ void LEGACY_PLUGIN::loadMODULE_EDGE( MODULE* aModule ) BIU end0_y = biuParse( data, &data ); width = biuParse( data, &data ); - layer = intParse( data ); + layer = layerParse( data ); dwg->m_Start0 = wxPoint( start0_x, start0_y ); dwg->m_End0 = wxPoint( end0_x, end0_y ); @@ -1430,7 +1440,7 @@ void LEGACY_PLUGIN::loadMODULE_EDGE( MODULE* aModule ) int ptCount = intParse( data, &data ); width = biuParse( data, &data ); - layer = intParse( data ); + layer = layerParse( data ); dwg->m_Start0 = wxPoint( start0_x, start0_y ); dwg->m_End0 = wxPoint( end0_x, end0_y ); @@ -1481,7 +1491,7 @@ void LEGACY_PLUGIN::loadMODULE_EDGE( MODULE* aModule ) // can use the copper layers m_Layer < FIRST_NON_COPPER_LAYER is allowed. // @todo: changes use of EDGE_MODULE these footprints and allows only // m_Layer >= FIRST_NON_COPPER_LAYER - if( layer < 0 || layer > LAST_NON_COPPER_LAYER ) + if( layer < FIRST_LAYER || layer > LAST_NON_COPPER_LAYER ) layer = SILKSCREEN_N_FRONT; dwg->SetWidth( width ); @@ -1543,7 +1553,7 @@ void LEGACY_PLUGIN::loadMODULE_TEXT( TEXTE_MODULE* aText ) char* mirror = strtok( (char*) data, delims ); char* hide = strtok( NULL, delims ); char* tmp = strtok( NULL, delims ); - int layer = tmp ? intParse( tmp ) : SILKSCREEN_N_FRONT; + LAYER_NUM layer = tmp ? layerParse( tmp ) : SILKSCREEN_N_FRONT; char* italic = strtok( NULL, delims ); char* hjust = strtok( (char*) txt_end, delims ); @@ -1584,10 +1594,10 @@ void LEGACY_PLUGIN::loadMODULE_TEXT( TEXTE_MODULE* aText ) if( vjust ) aText->SetVertJustify( vertJustify( vjust ) ); - if( layer < 0 ) - layer = 0; - else if( layer > LAST_NO_COPPER_LAYER ) - layer = LAST_NO_COPPER_LAYER; + if( layer < FIRST_LAYER ) + layer = FIRST_LAYER; + else if( layer > LAST_NON_COPPER_LAYER ) + layer = LAST_NON_COPPER_LAYER; else if( layer == LAYER_N_BACK ) layer = SILKSCREEN_N_BACK; else if( layer == LAYER_N_FRONT ) @@ -1701,14 +1711,14 @@ void LEGACY_PLUGIN::loadPCB_LINE() switch( i ) { case 0: - int layer; - layer = intParse( data ); + LAYER_NUM layer; + layer = layerParse( data ); - if( layer < FIRST_NO_COPPER_LAYER ) - layer = FIRST_NO_COPPER_LAYER; + if( layer < FIRST_NON_COPPER_LAYER ) + layer = FIRST_NON_COPPER_LAYER; - else if( layer > LAST_NO_COPPER_LAYER ) - layer = LAST_NO_COPPER_LAYER; + else if( layer > LAST_NON_COPPER_LAYER ) + layer = LAST_NON_COPPER_LAYER; dseg->SetLayer( layer ); break; @@ -1893,7 +1903,7 @@ void LEGACY_PLUGIN::loadPCB_TEXT() // e.g. "De 21 1 0 Normal C\r\n" // sscanf( line + 2, " %d %d %lX %s %c\n", &m_Layer, &normal_display, &m_TimeStamp, style, &hJustify ); - int layer = intParse( line + SZ( "De" ), &data ); + LAYER_NUM layer = layerParse( line + SZ( "De" ), &data ); int notMirrored = intParse( data, &data ); time_t timestamp = hexParse( data, &data ); char* style = strtok( (char*) data, delims ); @@ -1917,8 +1927,8 @@ void LEGACY_PLUGIN::loadPCB_TEXT() if( layer < FIRST_COPPER_LAYER ) layer = FIRST_COPPER_LAYER; - else if( layer > LAST_NO_COPPER_LAYER ) - layer = LAST_NO_COPPER_LAYER; + else if( layer > LAST_NON_COPPER_LAYER ) + layer = LAST_NON_COPPER_LAYER; pcbtxt->SetLayer( layer ); } @@ -2200,7 +2210,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() else if( TESTLINE( "ZLayer" ) ) // layer found { - int layer = intParse( line + SZ( "ZLayer" ) ); + LAYER_NUM layer = layerParse( line + SZ( "ZLayer" ) ); zc->SetLayer( layer ); } @@ -2435,17 +2445,18 @@ void LEGACY_PLUGIN::loadDIMENSION() else if( TESTLINE( "Ge" ) ) { - int layer; + LAYER_NUM layer; time_t timestamp; int shape; + int ilayer; - sscanf( line + SZ( "Ge" ), " %d %d %lX", &shape, &layer, ×tamp ); + sscanf( line + SZ( "Ge" ), " %d %d %lX", &shape, &ilayer, ×tamp ); - if( layer < FIRST_NO_COPPER_LAYER ) - layer = FIRST_NO_COPPER_LAYER; - - else if( layer > LAST_NO_COPPER_LAYER ) - layer = LAST_NO_COPPER_LAYER; + if( ilayer < FIRST_NON_COPPER_LAYER ) + layer = FIRST_NON_COPPER_LAYER; + else if( ilayer > LAST_NON_COPPER_LAYER ) + layer = LAST_NON_COPPER_LAYER; + else layer = ilayer; dim->SetLayer( layer ); dim->SetTimeStamp( timestamp ); @@ -2625,18 +2636,18 @@ void LEGACY_PLUGIN::loadPCB_TARGET() // sscanf( Line + 2, " %X %d %d %d %d %d %lX", &m_Shape, &m_Layer, &m_Pos.x, &m_Pos.y, &m_Size, &m_Width, &m_TimeStamp ); int shape = intParse( line + SZ( "Po" ), &data ); - int layer = intParse( data, &data ); + LAYER_NUM layer = layerParse( data, &data ); BIU pos_x = biuParse( data, &data ); BIU pos_y = biuParse( data, &data ); BIU size = biuParse( data, &data ); BIU width = biuParse( data, &data ); time_t timestamp = hexParse( data ); - if( layer < FIRST_NO_COPPER_LAYER ) - layer = FIRST_NO_COPPER_LAYER; + if( layer < FIRST_NON_COPPER_LAYER ) + layer = FIRST_NON_COPPER_LAYER; - else if( layer > LAST_NO_COPPER_LAYER ) - layer = LAST_NO_COPPER_LAYER; + else if( layer > LAST_NON_COPPER_LAYER ) + layer = LAST_NON_COPPER_LAYER; PCB_TARGET* t = new PCB_TARGET( m_board, shape, layer, wxPoint( pos_x, pos_y ), size, width ); m_board->Add( t, ADD_APPEND ); @@ -2973,7 +2984,7 @@ void LEGACY_PLUGIN::saveSETUP( const BOARD* aBoard ) const unsigned layerMask = ALL_CU_LAYERS & aBoard->GetEnabledLayers(); - for( int layer = 0; layerMask; ++layer, layerMask >>= 1 ) + for( LAYER_NUM layer = FIRST_LAYER; layerMask; ++layer, layerMask >>= 1 ) { if( layerMask & 1 ) { diff --git a/pcbnew/magnetic_tracks_functions.cpp b/pcbnew/magnetic_tracks_functions.cpp index 4edb3d416c..87ad7bff83 100644 --- a/pcbnew/magnetic_tracks_functions.cpp +++ b/pcbnew/magnetic_tracks_functions.cpp @@ -173,7 +173,7 @@ bool Magnetize( PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize aGridSize, // after pads, only track & via tests remain, skip them if not desired if( doTrack ) { - int layer = screen->m_Active_Layer; + LAYER_NUM layer = screen->m_Active_Layer; for( TRACK* via = m_Pcb->m_Track; via && (via = via->GetVia( *curpos, layer )) != NULL; diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb.cpp index 393ab9da63..39a65ebf33 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb.cpp @@ -48,7 +48,7 @@ namespace PCAD2KICAD { -int PCB::GetKiCadLayer( int aPCadLayer ) +LAYER_NUM PCB::GetKiCadLayer( int aPCadLayer ) { wxASSERT( aPCadLayer >= 0 && aPCadLayer < MAX_PCAD_LAYER_QTY ); return m_layersMap[aPCadLayer].KiCadLayer; @@ -447,9 +447,7 @@ void PCB::ConnectPinToNet( wxString aCompRef, wxString aPinRef, wxString aNetNam int PCB::FindLayer( wxString aLayerName ) { - int i; - - for ( i = 0; i < (int) m_layersStackup.GetCount(); i++ ) + for ( LAYER_NUM i = FIRST_COPPER_LAYER; i < (int)m_layersStackup.GetCount(); ++i ) { if( m_layersStackup[i] == aLayerName ) return i; @@ -479,7 +477,7 @@ int PCB::FindLayer( wxString aLayerName ) void PCB::MapLayer( XNODE* aNode ) { wxString lName, layerType; - int KiCadLayer; + LAYER_NUM KiCadLayer; long num = 0; aNode->GetAttribute( wxT( "Name" ), &lName ); @@ -509,12 +507,12 @@ void PCB::MapLayer( XNODE* aNode ) KiCadLayer = EDGE_N; else { - KiCadLayer = FindLayer( lName ); + int layernum = FindLayer( lName ); - if( KiCadLayer == -1 ) + if( layernum == -1 ) KiCadLayer = DRAW_N; // default else - KiCadLayer = FIRST_COPPER_LAYER + m_layersStackup.GetCount() - 1 - KiCadLayer; + KiCadLayer = FIRST_COPPER_LAYER + m_layersStackup.GetCount() - 1 - layernum; } if( FindNode( aNode, wxT( "layerNum" ) ) ) diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb.h b/pcbnew/pcad2kicadpcb_plugin/pcb.h index 91b76cd6c4..baedea0e55 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb.h +++ b/pcbnew/pcad2kicadpcb_plugin/pcb.h @@ -53,7 +53,7 @@ public: PCB( BOARD* aBoard ); ~PCB(); - int GetKiCadLayer( int aPCadLayer ); + LAYER_NUM GetKiCadLayer( int aPCadLayer ); LAYER_TYPE_T GetLayerType( int aPCadLayer ); wxString GetLayerNetNameRef( int aPCadLayer ); int GetNewTimestamp(); diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_callbacks.h b/pcbnew/pcad2kicadpcb_plugin/pcb_callbacks.h index 05b4837ee5..a12dc70343 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_callbacks.h +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_callbacks.h @@ -42,7 +42,7 @@ enum LAYER_TYPE_T typedef struct _TLAYER { - int KiCadLayer; + LAYER_NUM KiCadLayer; LAYER_TYPE_T layerType; wxString netNameRef; } TLAYER; @@ -53,7 +53,7 @@ namespace PCAD2KICAD class PCB_CALLBACKS { public: - virtual int GetKiCadLayer( int aPCadLayer ) = 0; + virtual LAYER_NUM GetKiCadLayer( int aPCadLayer ) = 0; virtual LAYER_TYPE_T GetLayerType( int aPCadLayer ) = 0; virtual wxString GetLayerNetNameRef( int aPCadLayer ) = 0; virtual int GetNewTimestamp() = 0; diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_component.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_component.cpp index 2e59042f43..0bcb43984b 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_component.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_component.cpp @@ -43,7 +43,7 @@ PCB_COMPONENT::PCB_COMPONENT( PCB_CALLBACKS* aCallbacks, m_tag = 0; m_objType = wxT( '?' ); m_PCadLayer = 0; - m_KiCadLayer = 0; + m_KiCadLayer = NO_LAYER; m_timestamp = 0; m_positionX = 0; m_positionY = 0; @@ -77,9 +77,9 @@ void PCB_COMPONENT::Flip() m_positionX = -m_positionX; } -int PCB_COMPONENT::FlipLayers( int aLayer ) +LAYER_NUM PCB_COMPONENT::FlipLayers( LAYER_NUM aLayer ) { - int result = aLayer; // dafault is no swap + LAYER_NUM result = aLayer; // dafault is no swap // routed layers if( aLayer == LAYER_N_BACK ) diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_component.h b/pcbnew/pcad2kicadpcb_plugin/pcb_component.h index a89deb9062..48700318d0 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_component.h +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_component.h @@ -51,7 +51,7 @@ public: int m_tag; char m_objType; int m_PCadLayer; - int m_KiCadLayer; + LAYER_NUM m_KiCadLayer; int m_timestamp; int m_positionX; int m_positionY; @@ -70,7 +70,7 @@ public: virtual void AddToModule( MODULE* aModule ); virtual void AddToBoard() = 0; - int GetKiCadLayer() { return m_callbacks->GetKiCadLayer( m_PCadLayer ); } + LAYER_NUM GetKiCadLayer() { return m_callbacks->GetKiCadLayer( m_PCadLayer ); } int GetNewTimestamp() { return m_callbacks->GetNewTimestamp(); } int GetNetCode( wxString aNetName ) { return m_callbacks->GetNetCode( aNetName ); } @@ -78,7 +78,7 @@ protected: PCB_CALLBACKS* m_callbacks; BOARD* m_board; - int FlipLayers( int aLayer ); + LAYER_NUM FlipLayers( LAYER_NUM aLayer ); }; WX_DEFINE_ARRAY( PCB_COMPONENT*, PCB_COMPONENTS_ARRAY ); diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index 8f45cec82a..ecf7ddac85 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -61,7 +61,7 @@ void PCB_PARSER::init() // Add untranslated default (i.e. english) layernames. // Some may be overridden later if parsing a board rather than a footprint. // The english name will survive if parsing only a footprint. - for( int layerNdx = 0; layerNdx < NB_LAYERS; ++layerNdx ) + for( LAYER_NUM layerNdx = FIRST_LAYER; layerNdx < NB_PCB_LAYERS; ++layerNdx ) { std::string untranslated = TO_UTF8( BOARD::GetStandardLayerName( layerNdx ) ); @@ -665,7 +665,7 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR ) T token; std::string name; std::string type; - int layerIndex; + LAYER_NUM layerIndex; bool isVisible = true; LAYER_MSK visibleLayers = NO_LAYERS; LAYER_MSK enabledLayers = NO_LAYERS; @@ -765,14 +765,14 @@ T PCB_PARSER::lookUpLayer( const M& aMap ) throw( PARSE_ERROR, IO_ERROR ) } -int PCB_PARSER::parseBoardItemLayer() throw( PARSE_ERROR, IO_ERROR ) +LAYER_NUM PCB_PARSER::parseBoardItemLayer() throw( PARSE_ERROR, IO_ERROR ) { wxCHECK_MSG( CurTok() == T_layer, UNDEFINED_LAYER, wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as layer." ) ); NextTok(); - int layerIndex = lookUpLayer( m_layerIndices ); + LAYER_NUM layerIndex = lookUpLayer( m_layerIndices ); // Handle closing ) in object parser. @@ -2323,11 +2323,11 @@ SEGVIA* PCB_PARSER::parseSEGVIA() throw( IO_ERROR, PARSE_ERROR ) case T_layers: { - int layer1, layer2; + LAYER_NUM layer1, layer2; NextTok(); - layer1 = lookUpLayer( m_layerIndices ); + layer1 = lookUpLayer( m_layerIndices ); NextTok(); - layer2 = lookUpLayer( m_layerIndices ); + layer2 = lookUpLayer( m_layerIndices ); via->SetLayerPair( layer1, layer2 ); NeedRIGHT(); } diff --git a/pcbnew/pcb_parser.h b/pcbnew/pcb_parser.h index e1f89e839e..92574af4e4 100644 --- a/pcbnew/pcb_parser.h +++ b/pcbnew/pcb_parser.h @@ -58,7 +58,7 @@ class FPL_CACHE; */ class PCB_PARSER : public PCB_LEXER { - typedef boost::unordered_map< std::string, int > LAYER_NUM_MAP; + typedef boost::unordered_map< std::string, LAYER_NUM > LAYER_NUM_MAP; typedef boost::unordered_map< std::string, LAYER_MSK > LAYER_MSK_MAP; BOARD* m_board; @@ -117,7 +117,7 @@ class PCB_PARSER : public PCB_LEXER * @throw PARSE_ERROR if the layer syntax is incorrect. * @return The index the parsed #BOARD_ITEM layer. */ - int parseBoardItemLayer() throw( IO_ERROR, PARSE_ERROR ); + LAYER_NUM parseBoardItemLayer() throw( IO_ERROR, PARSE_ERROR ); /** * Function parseBoardItemLayersAsMask diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 5ee7f1a2f1..9a72c1078c 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -658,7 +658,7 @@ void PCB_EDIT_FRAME::SetGridColor(EDA_COLOR_T aColor) bool PCB_EDIT_FRAME::IsMicroViaAcceptable( void ) { int copperlayercnt = GetBoard()->GetCopperLayerCount( ); - int currLayer = getActiveLayer(); + LAYER_NUM currLayer = getActiveLayer(); if( !GetDesignSettings().m_MicroViasAllowed ) return false; // Obvious.. diff --git a/pcbnew/pcbnew.cpp b/pcbnew/pcbnew.cpp index 199ff3a537..279829bb44 100644 --- a/pcbnew/pcbnew.cpp +++ b/pcbnew/pcbnew.cpp @@ -65,8 +65,8 @@ bool g_Track_45_Only_Allowed = true; // True to allow horiz, vert. an bool g_Segments_45_Only; // True to allow horiz, vert. and 45deg only graphic segments bool g_TwoSegmentTrackBuild = true; -int g_Route_Layer_TOP; -int g_Route_Layer_BOTTOM; +LAYER_NUM g_Route_Layer_TOP; +LAYER_NUM g_Route_Layer_BOTTOM; int g_MaxLinksShowed; int g_MagneticPadOption = capture_cursor_in_track_tool; int g_MagneticTrackOption = capture_cursor_in_track_tool; diff --git a/pcbnew/pcbnew.h b/pcbnew/pcbnew.h index aeeb6a9a61..bea9f057bf 100644 --- a/pcbnew/pcbnew.h +++ b/pcbnew/pcbnew.h @@ -59,8 +59,8 @@ extern bool g_Alternate_Track_Posture; extern bool g_Segments_45_Only; /* Layer pair for auto routing and switch layers by hotkey */ -extern int g_Route_Layer_TOP; -extern int g_Route_Layer_BOTTOM; +extern LAYER_NUM g_Route_Layer_TOP; +extern LAYER_NUM g_Route_Layer_BOTTOM; extern int g_MaxLinksShowed; // Max count links showed in routing extern bool g_TwoSegmentTrackBuild; diff --git a/pcbnew/pcbplot.cpp b/pcbnew/pcbplot.cpp index 503e44f31e..1a508a4265 100644 --- a/pcbnew/pcbplot.cpp +++ b/pcbnew/pcbplot.cpp @@ -44,7 +44,7 @@ /** Get the 'traditional' gerber extension depending on the layer */ -static wxString GetGerberExtension( int layer )/*{{{*/ +static wxString GetGerberExtension( LAYER_NUM layer )/*{{{*/ { switch( layer ) { @@ -190,8 +190,6 @@ bool EnsureOutputDirectory( wxFileName *aOutputDir, */ void DIALOG_PLOT::Plot( wxCommandEvent& event ) { - int layer; - applyPlotSettings(); // Create output directory if it does not exist (also transform it in @@ -255,7 +253,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) // Save the current plot options in the board m_parent->SetPlotSettings( m_plotOpts ); - for( layer = 0; layer < NB_LAYERS; ++layer ) + for( LAYER_NUM layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer ) { if( m_plotOpts.GetLayerSelection() & GetLayerMask( layer ) ) { @@ -372,7 +370,7 @@ bool PLOT_CONTROLLER::OpenPlotfile( const wxString &aSuffix, /*{{{*/ }/*}}}*/ /** Plot a single layer on the current plotfile */ -bool PLOT_CONTROLLER::PlotLayer( int aLayer )/*{{{*/ +bool PLOT_CONTROLLER::PlotLayer( LAYER_NUM aLayer )/*{{{*/ { LOCALE_IO toggle; diff --git a/pcbnew/pcbplot.h b/pcbnew/pcbplot.h index a4e71ee323..21c352e994 100644 --- a/pcbnew/pcbplot.h +++ b/pcbnew/pcbplot.h @@ -148,7 +148,7 @@ public: * and in B&W mode, is plotted as white but other colors are plotted in BLACK * so the returned color is LIGHTGRAY when the layer color is WHITE */ - EDA_COLOR_T getColor( int aLayer ); + EDA_COLOR_T getColor( LAYER_NUM aLayer ); private: /** Helper function to plot a single drill mark. It compensate and clamp @@ -176,7 +176,7 @@ PLOTTER* StartPlotBoard( BOARD* aBoard, * @param aLayer = the layer id to plot * @param aPlotOpt = the plot options (files, sketch). Has meaning for some formats only */ -void PlotOneBoardLayer( BOARD* aBoard, PLOTTER* aPlotter, int aLayer, +void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, LAYER_NUM aLayer, const PCB_PLOT_PARAMS& aPlotOpt ); /** diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index 8e9ec9ad72..7b8b9c9ad3 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -142,7 +142,7 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, LAYER_MSK aLayerMask, } } -void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, int aLayer, +void PlotOneBoardLayer( BOARD *aBoard, PLOTTER* aPlotter, LAYER_NUM aLayer, const PCB_PLOT_PARAMS& aPlotOpt ) { PCB_PLOT_PARAMS plotOpt = aPlotOpt; @@ -468,7 +468,7 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter, long aLayerMask, const PCB_PLOT_PARAMS& aPlotOpt, int aMinThickness ) { - int layer = ( aLayerMask & SOLDERMASK_LAYER_BACK ) ? + LAYER_NUM layer = ( aLayerMask & SOLDERMASK_LAYER_BACK ) ? SOLDERMASK_N_BACK : SOLDERMASK_N_FRONT; int inflate = aMinThickness/2; diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index a549acde42..f1c271de6f 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -54,7 +54,7 @@ */ -EDA_COLOR_T BRDITEMS_PLOTTER::getColor( int aLayer ) +EDA_COLOR_T BRDITEMS_PLOTTER::getColor( LAYER_NUM aLayer ) { EDA_COLOR_T color = m_board->GetLayerColor( aLayer ); if (color == WHITE) @@ -107,9 +107,9 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule ) bool trace_ref = GetPlotReference(); TEXTE_MODULE* textModule = &aModule->Reference(); - unsigned textLayer = textModule->GetLayer(); + LAYER_NUM textLayer = textModule->GetLayer(); - if( textLayer >= LAYER_COUNT ) + if( textLayer >= NB_LAYERS ) return false; if( ( GetLayerMask( textLayer ) & m_layerMask ) == 0 ) @@ -121,7 +121,7 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule ) textModule = &aModule->Value(); textLayer = textModule->GetLayer(); - if( textLayer > LAYER_COUNT ) + if( textLayer > NB_LAYERS ) return false; if( ( GetLayerMask( textLayer ) & m_layerMask ) == 0 ) @@ -161,7 +161,7 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule ) textLayer = textModule->GetLayer(); - if( textLayer >= LAYER_COUNT ) + if( textLayer >= NB_LAYERS ) return false; if( !( GetLayerMask( textLayer ) & m_layerMask ) ) diff --git a/pcbnew/plotcontroller.h b/pcbnew/plotcontroller.h index b4afbc77b4..89e0028d0b 100644 --- a/pcbnew/plotcontroller.h +++ b/pcbnew/plotcontroller.h @@ -25,7 +25,7 @@ public: void ClosePlot(); bool OpenPlotfile( const wxString &aSuffix, PlotFormat aFormat, const wxString &aSheetDesc ); - bool PlotLayer( int layer ); + bool PlotLayer( LAYER_NUM layer ); private: /// Option bank diff --git a/pcbnew/print_board_functions.cpp b/pcbnew/print_board_functions.cpp index 09c4a3f9d0..9fb8bdb7f1 100644 --- a/pcbnew/print_board_functions.cpp +++ b/pcbnew/print_board_functions.cpp @@ -156,7 +156,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, } save_opt = DisplayOpt; - int activeLayer = GetScreen()->m_Active_Layer; + LAYER_NUM activeLayer = GetScreen()->m_Active_Layer; DisplayOpt.ContrastModeDisplay = false; DisplayOpt.DisplayPadFill = true; @@ -172,9 +172,9 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, DisplayOpt.DisplayPadFill = true; // Calculate the active layer number to print from its mask layer: - GetScreen()->m_Active_Layer = 0; + GetScreen()->m_Active_Layer = FIRST_LAYER; - for(int kk = 0; kk < 32; kk ++ ) + for( LAYER_NUM kk = FIRST_LAYER; kk < NB_LAYERS; ++kk ) { if( GetLayerMask( kk ) & aPrintMaskLayer ) { diff --git a/pcbnew/printout_controler.cpp b/pcbnew/printout_controler.cpp index 74fd538310..44eea74cc9 100644 --- a/pcbnew/printout_controler.cpp +++ b/pcbnew/printout_controler.cpp @@ -65,7 +65,7 @@ PRINT_PARAMETERS::PRINT_PARAMETERS() m_XScaleAdjust = 1.0; m_YScaleAdjust = 1.0; m_Print_Sheet_Ref = false; - m_PrintMaskLayer = 0xFFFFFFFF; + m_PrintMaskLayer = FULL_LAYERS; m_PrintMirror = false; m_Print_Black_and_White = true; m_OptionPrintPage = 1; @@ -90,9 +90,9 @@ BOARD_PRINTOUT_CONTROLLER::BOARD_PRINTOUT_CONTROLLER( const PRINT_PARAMETERS& aP bool BOARD_PRINTOUT_CONTROLLER::OnPrintPage( int aPage ) { #ifdef PCBNEW - int layers_count = NB_LAYERS; + int layers_count = NB_PCB_LAYERS; #else - int layers_count = LAYER_COUNT; + int layers_count = NB_LAYERS; #endif LAYER_MSK mask_layer = m_PrintParams.m_PrintMaskLayer; diff --git a/pcbnew/protos.h b/pcbnew/protos.h index 0ae8f2e77b..a906b947df 100644 --- a/pcbnew/protos.h +++ b/pcbnew/protos.h @@ -65,7 +65,7 @@ void DrawModuleOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* module ); /* EDITRACK.C : */ /****************/ -TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack, int aLayer, const wxPoint& aRef ); +TRACK* LocateIntrusion( TRACK* listStart, TRACK* aTrack, LAYER_NUM aLayer, const wxPoint& aRef ); void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ); diff --git a/pcbnew/sel_layer.cpp b/pcbnew/sel_layer.cpp index d1e739ebe9..0985c06a41 100644 --- a/pcbnew/sel_layer.cpp +++ b/pcbnew/sel_layer.cpp @@ -25,12 +25,12 @@ class SELECT_LAYER_DIALOG : public wxDialog private: PCB_BASE_FRAME* m_Parent; wxRadioBox* m_LayerList; - int m_LayerId[NB_LAYERS + 1]; // One extra element for "(Deselect)" radiobutton + LAYER_NUM m_LayerId[int(NB_PCB_LAYERS) + 1]; // One extra element for "(Deselect)" radiobutton public: // Constructor and destructor - SELECT_LAYER_DIALOG( PCB_BASE_FRAME* parent, int default_layer, - int min_layer, int max_layer, bool null_layer ); + SELECT_LAYER_DIALOG( PCB_BASE_FRAME* parent, LAYER_NUM default_layer, + LAYER_NUM min_layer, LAYER_NUM max_layer, bool null_layer ); ~SELECT_LAYER_DIALOG() { }; private: @@ -49,11 +49,11 @@ END_EVENT_TABLE() /** Install the dialog box for layer selection - * @param default_layer = Preselection (NB_LAYERS for "(Deselect)" layer) + * @param default_layer = Preselection (NB_PCB_LAYERS for "(Deselect)" layer) * @param min_layer = min layer value (-1 if no min value) * @param max_layer = max layer value (-1 if no max value) * @param null_layer = display a "(Deselect)" radiobutton (when set to true) - * @return new layer value (NB_LAYERS when "(Deselect)" radiobutton selected), + * @return new layer value (NB_PCB_LAYERS when "(Deselect)" radiobutton selected), * or -1 if canceled * * Providing the option to also display a "(Deselect)" radiobutton makes the @@ -65,19 +65,18 @@ END_EVENT_TABLE() * "Deselect" * button provided within the "Swap Layers:" or "Layer selection:" dialog box). */ -int PCB_BASE_FRAME::SelectLayer( int default_layer, - int min_layer, - int max_layer, +LAYER_NUM PCB_BASE_FRAME::SelectLayer( LAYER_NUM default_layer, + LAYER_NUM min_layer, + LAYER_NUM max_layer, bool null_layer ) { - int layer; SELECT_LAYER_DIALOG* frame = new SELECT_LAYER_DIALOG( this, default_layer, min_layer, max_layer, null_layer ); - layer = frame->ShowModal(); + LAYER_NUM layer = frame->ShowModal(); frame->Destroy(); return layer; } @@ -90,16 +89,16 @@ int PCB_BASE_FRAME::SelectLayer( int default_layer, * to the right of that radiobox. */ SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( PCB_BASE_FRAME* parent, - int default_layer, int min_layer, - int max_layer, bool null_layer ) : + LAYER_NUM default_layer, LAYER_NUM min_layer, + LAYER_NUM max_layer, bool null_layer ) : wxDialog( parent, -1, _( "Select Layer:" ), wxPoint( -1, -1 ), wxSize( 470, 250 ), DIALOG_STYLE ) { BOARD* board = parent->GetBoard(); wxButton* Button; - int ii; - wxString LayerList[NB_LAYERS + 1]; // One extra element for "(Deselect)" + LAYER_NUM ii; + wxString LayerList[NB_PCB_LAYERS + 1]; // One extra element for "(Deselect)" // radiobutton int LayerCount, LayerSelect = -1; @@ -110,9 +109,9 @@ SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( PCB_BASE_FRAME* parent, LAYER_MSK Masque_Layer = g_TabAllCopperLayerMask[board->GetCopperLayerCount() - 1]; Masque_Layer |= ALL_NO_CU_LAYERS; - for( ii = 0; ii < NB_LAYERS; ii++ ) + for( ii = FIRST_LAYER; ii < NB_PCB_LAYERS; ++ii ) { - m_LayerId[ii] = 0; + m_LayerId[ii] = FIRST_LAYER; if( GetLayerMask( ii ) & Masque_Layer ) { @@ -137,10 +136,10 @@ SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( PCB_BASE_FRAME* parent, { LayerList[LayerCount] = _( "(Deselect)" ); - if( NB_LAYERS == default_layer ) + if( NB_PCB_LAYERS == default_layer ) LayerSelect = LayerCount; - m_LayerId[LayerCount] = NB_LAYERS; + m_LayerId[LayerCount] = NB_PCB_LAYERS; LayerCount++; } @@ -198,7 +197,7 @@ private: PCB_BASE_FRAME* m_Parent; wxRadioBox* m_LayerListTOP; wxRadioBox* m_LayerListBOTTOM; - int m_LayerId[NB_COPPER_LAYERS]; + LAYER_NUM m_LayerId[NB_COPPER_LAYERS]; public: SELECT_LAYERS_PAIR_DIALOG( PCB_BASE_FRAME* parent ); ~SELECT_LAYERS_PAIR_DIALOG() { }; @@ -255,9 +254,8 @@ SELECT_LAYERS_PAIR_DIALOG::SELECT_LAYERS_PAIR_DIALOG( PCB_BASE_FRAME* parent ) : { BOARD* board = parent->GetBoard(); wxButton* Button; - int ii, LayerCount; wxString LayerList[NB_COPPER_LAYERS]; - int LayerTopSelect = 0, LayerBottomSelect = 0; + LAYER_NUM LayerTopSelect = FIRST_LAYER, LayerBottomSelect = FIRST_LAYER; m_Parent = parent; @@ -265,9 +263,10 @@ SELECT_LAYERS_PAIR_DIALOG::SELECT_LAYERS_PAIR_DIALOG( PCB_BASE_FRAME* parent ) : LAYER_MSK Masque_Layer = g_TabAllCopperLayerMask[board->GetCopperLayerCount() - 1]; Masque_Layer |= ALL_NO_CU_LAYERS; - for( ii = 0, LayerCount = 0; ii < NB_COPPER_LAYERS; ii++ ) + LAYER_NUM LayerCount = FIRST_LAYER; + for( LAYER_NUM ii = FIRST_COPPER_LAYER; ii < NB_COPPER_LAYERS; ++ii ) { - m_LayerId[ii] = 0; + m_LayerId[ii] = FIRST_LAYER; if( (GetLayerMask( ii ) & Masque_Layer) ) { @@ -280,7 +279,7 @@ SELECT_LAYERS_PAIR_DIALOG::SELECT_LAYERS_PAIR_DIALOG( PCB_BASE_FRAME* parent ) : LayerBottomSelect = LayerCount; m_LayerId[LayerCount] = ii; - LayerCount++; + ++LayerCount; } } diff --git a/pcbnew/specctra.cpp b/pcbnew/specctra.cpp index 398297f1b4..cc2c8cfc1d 100644 --- a/pcbnew/specctra.cpp +++ b/pcbnew/specctra.cpp @@ -79,11 +79,12 @@ void SPECCTRA_DB::buildLayerMaps( BOARD* aBoard ) layerIds.clear(); pcbLayer2kicad.resize( layerCount ); - kicadLayer2pcb.resize( LAYER_N_FRONT+1 ); + kicadLayer2pcb.resize( LAYER_N_FRONT + 1 ); - for( int kiNdx=layerCount-1, pcbNdx=0; kiNdx >= 0; --kiNdx, ++pcbNdx ) + for( LAYER_NUM kiNdx = layerCount - 1, pcbNdx=FIRST_LAYER; + kiNdx >= 0; --kiNdx, ++pcbNdx ) { - int kilayer = kiNdx>0 && kiNdx==layerCount-1 ? LAYER_N_FRONT : kiNdx; + LAYER_NUM kilayer = (kiNdx>0 && kiNdx==layerCount-1) ? LAYER_N_FRONT : kiNdx; // establish bi-directional mapping between KiCad's BOARD layer and PCB layer pcbLayer2kicad[pcbNdx] = kilayer; @@ -95,14 +96,14 @@ void SPECCTRA_DB::buildLayerMaps( BOARD* aBoard ) } -int SPECCTRA_DB::findLayerName( const std::string& aLayerName ) const +LAYER_NUM SPECCTRA_DB::findLayerName( const std::string& aLayerName ) const { - for( unsigned i=0; i kicadLayer2pcb; + std::vector kicadLayer2pcb; /// maps PCB layer number to BOARD layer numbers - std::vector pcbLayer2kicad; + std::vector pcbLayer2kicad; /// used during FromSESSION() only, memory for it is not owned here. UNIT_RES* routeResolution; @@ -3608,7 +3608,7 @@ class SPECCTRA_DB : public SPECCTRA_LEXER * Function findLayerName * returns the PCB layer index for a given layer name */ - int findLayerName( const std::string& aLayerName ) const; + LAYER_NUM findLayerName( const std::string& aLayerName ) const; /** * Function readCOMPnPIN @@ -3740,7 +3740,7 @@ class SPECCTRA_DB : public SPECCTRA_LEXER * or delete it. */ PADSTACK* makeVia( int aCopperDiameter, int aDrillDiameter, - int aTopLayer, int aBotLayer ); + LAYER_NUM aTopLayer, LAYER_NUM aBotLayer ); /** * Function makeVia diff --git a/pcbnew/specctra_export.cpp b/pcbnew/specctra_export.cpp index 1faabd2388..de4fe71b55 100644 --- a/pcbnew/specctra_export.cpp +++ b/pcbnew/specctra_export.cpp @@ -330,9 +330,9 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad ) uniqifier += 'A'; // A for all layers const int copperCount = aBoard->GetCopperLayerCount(); - for( int layer=0; layerIsOnLayer( kilayer ) ) { @@ -376,7 +376,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad ) { double diameter = scale(aPad->GetSize().x); - for( int ndx=0; ndxAppend( shape ); @@ -409,7 +409,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad ) lowerLeft += dsnOffset; upperRight += dsnOffset; - for( int ndx=0; ndxAppend( shape ); @@ -460,7 +460,7 @@ PADSTACK* SPECCTRA_DB::makePADSTACK( BOARD* aBoard, D_PAD* aPad ) start += dsnOffset; stop += dsnOffset; - for( int ndx=0; ndxAppend( shape ); @@ -569,7 +569,7 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule ) POINT vertex = mapPt( pad->GetPos0() ); int layerCount = aBoard->GetCopperLayerCount(); - for( int layer=0; layerkeepouts.push_back( keepout ); @@ -716,14 +716,14 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule ) PADSTACK* SPECCTRA_DB::makeVia( int aCopperDiameter, int aDrillDiameter, - int aTopLayer, int aBotLayer ) + LAYER_NUM aTopLayer, LAYER_NUM aBotLayer ) { char name[48]; PADSTACK* padstack = new PADSTACK(); double dsnDiameter = scale( aCopperDiameter ); - for( int layer=aTopLayer; layer<=aBotLayer; ++layer ) + for( LAYER_NUM layer=aTopLayer; layer<=aBotLayer; ++layer ) { SHAPE* shape = new SHAPE( padstack ); padstack->Append( shape ); @@ -750,8 +750,8 @@ PADSTACK* SPECCTRA_DB::makeVia( int aCopperDiameter, int aDrillDiameter, PADSTACK* SPECCTRA_DB::makeVia( const SEGVIA* aVia ) { - int topLayer; - int botLayer; + LAYER_NUM topLayer; + LAYER_NUM botLayer; aVia->ReturnLayerPair( &topLayer, &botLayer ); @@ -991,7 +991,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR ) int layerCount = aBoard->GetCopperLayerCount(); - for( int pcbNdx=0; pcbNdxstructure ); pcb->structure->layers.push_back( layer ); @@ -1415,7 +1415,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR ) NETCLASS* netclass = nclasses.GetDefault(); PADSTACK* via = makeVia( netclass->GetViaDiameter(), netclass->GetViaDrill(), - 0, aBoard->GetCopperLayerCount()-1 ); + FIRST_LAYER, aBoard->GetCopperLayerCount()-1 ); // we AppendVia() this first one, there is no way it can be a duplicate, // the pcb->library via container is empty at this point. After this, @@ -1431,7 +1431,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR ) int viaDrill = aBoard->m_ViasDimensionsList[i].m_Drill; via = makeVia( viaSize, viaDrill, - 0, aBoard->GetCopperLayerCount()-1 ); + FIRST_LAYER, aBoard->GetCopperLayerCount()-1 ); // maybe add 'via' to the library, but only if unique. PADSTACK* registered = pcb->library->LookupVia( via ); @@ -1448,7 +1448,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR ) netclass = nc->second; via = makeVia( netclass->GetViaDiameter(), netclass->GetViaDrill(), - 0, aBoard->GetCopperLayerCount()-1 ); + FIRST_LAYER, aBoard->GetCopperLayerCount()-1 ); // maybe add 'via' to the library, but only if unique. PADSTACK* registered = pcb->library->LookupVia( via ); @@ -1474,7 +1474,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR ) int old_netcode = -1; int old_width = -1; - int old_layer = -1; + LAYER_NUM old_layer = UNDEFINED_LAYER; for( int i=0; iwire_type = T_protect; // @todo, this should be configurable - int kiLayer = track->GetLayer(); - int pcbLayer = kicadLayer2pcb[kiLayer]; + LAYER_NUM kiLayer = track->GetLayer(); + LAYER_NUM pcbLayer = kicadLayer2pcb[kiLayer]; path = new PATH( wire ); wire->SetShape( path ); @@ -1666,7 +1666,7 @@ void SPECCTRA_DB::exportNETCLASS( NETCLASS* aNetClass, BOARD* aBoard ) // this should never become a performance issue. PADSTACK* via = makeVia( aNetClass->GetViaDiameter(), aNetClass->GetViaDrill(), - 0, aBoard->GetCopperLayerCount()-1 ); + FIRST_LAYER, aBoard->GetCopperLayerCount()-1 ); snprintf( text, sizeof(text), "(use_via %s)", via->GetPadstackId().c_str() ); clazz->circuit.push_back( text ); diff --git a/pcbnew/specctra_import.cpp b/pcbnew/specctra_import.cpp index e96be41bf4..5a495ca4f3 100644 --- a/pcbnew/specctra_import.cpp +++ b/pcbnew/specctra_import.cpp @@ -224,7 +224,7 @@ static wxPoint mapPt( const POINT& aPoint, UNIT_RES* aResolution ) TRACK* SPECCTRA_DB::makeTRACK( PATH* aPath, int aPointIndex, int aNetcode ) throw( IO_ERROR ) { - int layerNdx = findLayerName( aPath->layer_id ); + LAYER_NUM layerNdx = findLayerName( aPath->layer_id ); if( layerNdx == -1 ) { @@ -319,8 +319,8 @@ SEGVIA* SPECCTRA_DB::makeVIA( PADSTACK* aPadstack, const POINT& aPoint, int aNet } else // VIA_MICROVIA or VIA_BLIND_BURIED { - int topLayerNdx = -1; - int botLayerNdx = 7000; + LAYER_NUM topLayerNdx = UNDEFINED_LAYER; + LAYER_NUM botLayerNdx = 7000; int viaDiam = -1; for( int i=0; ishape; - int layerNdx = findLayerName( circle->layer_id ); - if( layerNdx == -1 ) + LAYER_NUM layerNdx = findLayerName( circle->layer_id ); + if( layerNdx == UNDEFINED_LAYER ) { wxString layerName = FROM_UTF8( circle->layer_id.c_str() ); ThrowIOError( _("Session file uses invalid layer id \"%s\""), diff --git a/pcbnew/specctra_test.cpp b/pcbnew/specctra_test.cpp index 713c9b15a0..c0b95f7d72 100644 --- a/pcbnew/specctra_test.cpp +++ b/pcbnew/specctra_test.cpp @@ -100,7 +100,7 @@ int BOARD::GetCopperLayerCount() const } // a dummy to satisfy link of specctra_test without pulling in BOARD stuff. -wxString BOARD::GetLayerName( int aLayer ) const +wxString BOARD::GetLayerName( LAYER_NUM aLayer ) const { return wxEmptyString; } diff --git a/pcbnew/swap_layers.cpp b/pcbnew/swap_layers.cpp index bf9f0c5789..58be1f5469 100644 --- a/pcbnew/swap_layers.cpp +++ b/pcbnew/swap_layers.cpp @@ -20,14 +20,14 @@ #define LAYER_NO_CHANGE NB_LAYERS -static int New_Layer[NB_LAYERS]; -wxStaticText* layer_list[NB_LAYERS]; +static LAYER_NUM New_Layer[NB_PCB_LAYERS]; +wxStaticText* layer_list[NB_PCB_LAYERS]; enum swap_layer_id { ID_WINEDA_SWAPLAYERFRAME = 1800, ID_BUTTON_0, - ID_TEXT_0 = ID_BUTTON_0 + NB_LAYERS + ID_TEXT_0 = ID_BUTTON_0 + NB_PCB_LAYERS }; @@ -59,7 +59,7 @@ private: BEGIN_EVENT_TABLE( WinEDA_SwapLayerFrame, wxDialog ) - EVT_COMMAND_RANGE( ID_BUTTON_0, ID_BUTTON_0 + NB_LAYERS - 1, + EVT_COMMAND_RANGE( ID_BUTTON_0, ID_BUTTON_0 + NB_PCB_LAYERS - 1, wxEVT_COMMAND_BUTTON_CLICKED, WinEDA_SwapLayerFrame::Sel_Layer ) EVT_BUTTON( wxID_OK, WinEDA_SwapLayerFrame::OnOkClick ) @@ -114,7 +114,7 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( PCB_BASE_FRAME* parent ) : MainBoxSizer = new wxBoxSizer( wxHORIZONTAL ); OuterBoxSizer->Add( MainBoxSizer, 1, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 ); - for( int ii = 0; ii < NB_LAYERS; ii++ ) + for( LAYER_NUM ii = FIRST_LAYER; ii < NB_PCB_LAYERS; ++ii ) { // Provide a vertical line to separate the two FlexGrid sizers if( ii == 16 ) @@ -204,11 +204,11 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( PCB_BASE_FRAME* parent ) : */ if( ii == 0 ) { - text = new wxStaticText( this, item_ID, board->GetLayerName( 0 ), + text = new wxStaticText( this, item_ID, board->GetLayerName( FIRST_LAYER ), wxDefaultPosition, wxDefaultSize, 0 ); goodSize = text->GetSize(); - for( int jj = 1; jj < NB_LAYERS; jj++ ) + for( LAYER_NUM jj = LAYER_N_2; jj < NB_PCB_LAYERS; ++jj ) { text->SetLabel( board->GetLayerName( jj ) ); @@ -238,7 +238,7 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( PCB_BASE_FRAME* parent ) : * FlexGrid sizer. (As it incorporates three columns, three spacers * are thus required for each otherwise unused row.) */ - for( int ii = 3 * NB_LAYERS; ii < 96; ii++ ) + for( int ii = 3 * NB_PCB_LAYERS; ii < 96; ii++ ) { FlexColumnBoxSizer->Add( 5, h, 0, wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | @@ -275,23 +275,23 @@ WinEDA_SwapLayerFrame::WinEDA_SwapLayerFrame( PCB_BASE_FRAME* parent ) : void WinEDA_SwapLayerFrame::Sel_Layer( wxCommandEvent& event ) { - int ii, jj; + int ii; ii = event.GetId(); - if( ii < ID_BUTTON_0 || ii >= ID_BUTTON_0 + NB_LAYERS ) + if( ii < ID_BUTTON_0 || ii >= ID_BUTTON_0 + NB_PCB_LAYERS ) return; ii = event.GetId() - ID_BUTTON_0; - jj = New_Layer[ii]; + LAYER_NUM jj = New_Layer[ii]; - if( (jj < 0) || (jj > NB_LAYERS) ) + if( (jj < 0) || (jj > NB_PCB_LAYERS) ) jj = LAYER_NO_CHANGE; // (Defaults to "No Change".) - jj = m_Parent->SelectLayer( jj, -1, -1, true ); + jj = m_Parent->SelectLayer( jj, UNDEFINED_LAYER, UNDEFINED_LAYER, true ); - if( (jj < 0) || (jj > NB_LAYERS) ) + if( (jj < FIRST_LAYER) || (jj > NB_PCB_LAYERS) ) return; // No change if the selected layer matches the layer being edited. @@ -350,7 +350,7 @@ void PCB_EDIT_FRAME::Swap_Layers( wxCommandEvent& event ) EDA_ITEM* PtStruct; /* Init default values */ - for( ii = 0; ii < NB_LAYERS; ii++ ) + for( ii = FIRST_LAYER; ii < NB_PCB_LAYERS; ii++ ) New_Layer[ii] = LAYER_NO_CHANGE; WinEDA_SwapLayerFrame* frame = new WinEDA_SwapLayerFrame( this ); @@ -375,7 +375,7 @@ void PCB_EDIT_FRAME::Swap_Layers( wxCommandEvent& event ) if( Via->GetShape() == VIA_THROUGH ) continue; - int top_layer, bottom_layer; + LAYER_NUM top_layer, bottom_layer; Via->ReturnLayerPair( &top_layer, &bottom_layer ); diff --git a/pcbnew/zones_by_polygon.cpp b/pcbnew/zones_by_polygon.cpp index f8a5a6592f..fd48f024ee 100644 --- a/pcbnew/zones_by_polygon.cpp +++ b/pcbnew/zones_by_polygon.cpp @@ -372,7 +372,7 @@ void PCB_EDIT_FRAME::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* aZone ) return; } - int layer = aZone->GetLayer(); + LAYER_NUM layer = aZone->GetLayer(); if( DC ) { @@ -620,7 +620,7 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC ) } // Show the Net for zones on copper layers - if( zoneInfo.m_CurrentZone_Layer < FIRST_NO_COPPER_LAYER && + if( zoneInfo.m_CurrentZone_Layer < FIRST_NON_COPPER_LAYER && ! zoneInfo.GetIsKeepout() ) { if( s_CurrentZone ) @@ -739,7 +739,7 @@ bool PCB_EDIT_FRAME::End_Zone( wxDC* DC ) m_canvas->SetMouseCapture( NULL, NULL ); // Undraw old drawings, because they can have important changes - int layer = zone->GetLayer(); + LAYER_NUM layer = zone->GetLayer(); GetBoard()->RedrawAreasOutlines( m_canvas, DC, GR_XOR, layer ); GetBoard()->RedrawFilledAreas( m_canvas, DC, GR_XOR, layer ); @@ -851,7 +851,7 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* aZone ) // note the net name and the layer can be changed, so we must save all zones s_AuxiliaryList.ClearListAndDeleteItems(); s_PickedList.ClearListAndDeleteItems(); - SaveCopyOfZones(s_PickedList, GetBoard(), -1, -1 ); + SaveCopyOfZones(s_PickedList, GetBoard(), -1, UNDEFINED_LAYER ); if( aZone->GetIsKeepout() ) { @@ -859,7 +859,7 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* aZone ) zoneInfo << *aZone; edited = InvokeKeepoutAreaEditor( this, &zoneInfo ); } - else if( aZone->GetLayer() < FIRST_NO_COPPER_LAYER ) + else if( aZone->GetLayer() < FIRST_NON_COPPER_LAYER ) { // edit a zone on a copper layer @@ -910,7 +910,7 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* aZone ) GetBoard()->OnAreaPolygonModified( &s_AuxiliaryList, aZone ); // Redraw the real new zone outlines - GetBoard()->RedrawAreasOutlines( m_canvas, DC, GR_OR, -1 ); + GetBoard()->RedrawAreasOutlines( m_canvas, DC, GR_OR, UNDEFINED_LAYER ); UpdateCopyOfZonesList( s_PickedList, s_AuxiliaryList, GetBoard() ); SaveCopyInUndoList(s_PickedList, UR_UNSPECIFIED); diff --git a/pcbnew/zones_functions_for_undo_redo.cpp b/pcbnew/zones_functions_for_undo_redo.cpp index e113f7a61a..922e955c41 100644 --- a/pcbnew/zones_functions_for_undo_redo.cpp +++ b/pcbnew/zones_functions_for_undo_redo.cpp @@ -134,7 +134,7 @@ bool ZONE_CONTAINER::IsSame( const ZONE_CONTAINER& aZoneToCompare ) * @param aLayer = the layer of zones. if aLayer < 0, all layers are used * @return the count of saved copies */ -int SaveCopyOfZones( PICKED_ITEMS_LIST& aPickList, BOARD* aPcb, int aNetCode, int aLayer ) +int SaveCopyOfZones( PICKED_ITEMS_LIST& aPickList, BOARD* aPcb, int aNetCode, LAYER_NUM aLayer ) { int copyCount = 0; diff --git a/pcbnew/zones_functions_for_undo_redo.h b/pcbnew/zones_functions_for_undo_redo.h index 7ef0ae2a9d..a5260a3fa8 100644 --- a/pcbnew/zones_functions_for_undo_redo.h +++ b/pcbnew/zones_functions_for_undo_redo.h @@ -56,7 +56,7 @@ * @param aLayer = the layer of zones. if aLayer < 0, all layers are used * @return the count of saved copies */ -int SaveCopyOfZones(PICKED_ITEMS_LIST & aPickList, BOARD* aPcb, int aNetCode, int aLayer ); +int SaveCopyOfZones(PICKED_ITEMS_LIST & aPickList, BOARD* aPcb, int aNetCode, LAYER_NUM aLayer ); /** diff --git a/pcbnew/zones_non_copper_type_functions.cpp b/pcbnew/zones_non_copper_type_functions.cpp index 5305c4e137..f6b2594bff 100644 --- a/pcbnew/zones_non_copper_type_functions.cpp +++ b/pcbnew/zones_non_copper_type_functions.cpp @@ -98,9 +98,11 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::Init() break; } - for( int layer_number = FIRST_NO_COPPER_LAYER, ii = 0; - layer_number <= LAST_NO_COPPER_LAYER; - layer_number++, ii++ ) + int ii; + LAYER_NUM layer_number; + for( layer_number = FIRST_NON_COPPER_LAYER, ii = 0; + layer_number <= LAST_NON_COPPER_LAYER; + ++layer_number, ++ii ) { wxString msg; @@ -171,7 +173,7 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::OnOkClick( wxCommandEvent& event ) return; } - m_settings.m_CurrentZone_Layer = ii + FIRST_NO_COPPER_LAYER; + m_settings.m_CurrentZone_Layer = FIRST_NON_COPPER_LAYER + ii; *m_ptr = m_settings; diff --git a/pcbnew/zones_test_and_combine_areas.cpp b/pcbnew/zones_test_and_combine_areas.cpp index 718661e8a2..c476d79bf5 100644 --- a/pcbnew/zones_test_and_combine_areas.cpp +++ b/pcbnew/zones_test_and_combine_areas.cpp @@ -53,7 +53,7 @@ bool BOARD::OnAreaPolygonModified( PICKED_ITEMS_LIST* aModifiedZonesList, bool modified = NormalizeAreaPolygon( aModifiedZonesList, modified_area ); // now see if we need to clip against other areas - int layer = modified_area->GetLayer(); + LAYER_NUM layer = modified_area->GetLayer(); bool bCheckAllAreas = TestAreaIntersections( modified_area ); if( bCheckAllAreas ) @@ -62,7 +62,7 @@ bool BOARD::OnAreaPolygonModified( PICKED_ITEMS_LIST* aModifiedZonesList, CombineAllAreasInNet( aModifiedZonesList, modified_area->GetNet(), true ); } - if( layer >= FIRST_NO_COPPER_LAYER ) // Refill non copper zones on this layer + if( layer >= FIRST_NON_COPPER_LAYER ) // Refill non copper zones on this layer { for( unsigned ia = 0; ia < m_ZoneDescriptorList.size(); ia++ ) if( m_ZoneDescriptorList[ia]->GetLayer() == layer ) diff --git a/polygon/PolyLine.cpp b/polygon/PolyLine.cpp index 1475f4c755..5ed3951842 100644 --- a/polygon/PolyLine.cpp +++ b/polygon/PolyLine.cpp @@ -21,7 +21,7 @@ CPolyLine::CPolyLine() { m_hatchStyle = NO_HATCH; m_hatchPitch = 0; - m_layer = 0; + m_layer = NO_LAYER; m_utility = 0; } @@ -207,7 +207,7 @@ void CPolyLine::ImportSettings( const CPolyLine * aPoly ) /* initialize a contour * set layer, hatch style, and starting point */ -void CPolyLine::Start( int layer, int x, int y, int hatch ) +void CPolyLine::Start( LAYER_NUM layer, int x, int y, int hatch ) { m_layer = layer; SetHatchStyle( (enum HATCH_STYLE) hatch ); @@ -795,7 +795,7 @@ void CPolyLine::Hatch() double hatch_line_len = m_hatchPitch; // To have a better look, give a slope depending on the layer - int layer = GetLayer(); + LAYER_NUM layer = GetLayer(); int slope_flag = (layer & 1) ? 1 : -1; // 1 or -1 double slope = 0.707106 * slope_flag; // 45 degrees slope int max_a, min_a; diff --git a/polygon/PolyLine.h b/polygon/PolyLine.h index 39368bf003..15f2cb49d9 100644 --- a/polygon/PolyLine.h +++ b/polygon/PolyLine.h @@ -98,7 +98,7 @@ public: /* initialize a contour * set layer, hatch style, and starting point */ - void Start( int layer, int x, int y, int hatch ); + void Start( LAYER_NUM layer, int x, int y, int hatch ); void AppendCorner( int x, int y ); void InsertCorner( int ic, int x, int y ); @@ -175,8 +175,8 @@ public: void AppendArc( int xi, int yi, int xf, int yf, int xc, int yc, int num ); // access functions - void SetLayer( int aLayer ) { m_layer = aLayer; } - int GetLayer() const { return m_layer; } + void SetLayer( LAYER_NUM aLayer ) { m_layer = aLayer; } + LAYER_NUM GetLayer() const { return m_layer; } int GetNumCorners(); int GetNumSides(); int GetClosed(); @@ -254,7 +254,7 @@ public: int Distance( wxPoint aStart, wxPoint aEnd, int aWidth ); private: - int m_layer; // layer to draw on + LAYER_NUM m_layer; // layer to draw on enum HATCH_STYLE m_hatchStyle; // hatch style, see enum above int m_hatchPitch; // for DIAGONAL_EDGE hatched outlines, basic distance between 2 hatch lines // and the len of eacvh segment From 86851d39a47a711da4abf2ecdba5e0749c3ba06b Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Sun, 31 Mar 2013 20:57:31 +0200 Subject: [PATCH 29/63] Hide the anchor for hidden text (suggested by Sergey Borshch) --- pcbnew/class_text_mod.cpp | 87 ++++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 43 deletions(-) diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index bd0b9790e3..f00d1f58e6 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -241,27 +241,47 @@ EDA_RECT TEXTE_MODULE::GetBoundingBox() const void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, const wxPoint& offset ) { - int width, orient; - wxSize size; - wxPoint pos; // Center of text - PCB_BASE_FRAME* frame; - MODULE* module = (MODULE*) m_Parent; /* parent must *not* be null - * (a module text without a footprint - * parent has no sense) */ + MODULE* module = (MODULE*) m_Parent; + /* parent must *not* be NULL (a module text without a footprint + parent has no sense) */ + wxASSERT( module ); if( panel == NULL ) return; - frame = (PCB_BASE_FRAME*) panel->GetParent(); + BOARD* brd = GetBoard( ); + EDA_COLOR_T color; + // Determine the element color or suppress it element if hidden + switch( module->GetLayer() ) + { + case LAYER_N_BACK: + if( !brd->IsElementVisible( MOD_TEXT_BK_VISIBLE ) ) + return; + color = brd->GetVisibleElementColor( MOD_TEXT_BK_VISIBLE ); + break; - pos.x = m_Pos.x - offset.x; - pos.y = m_Pos.y - offset.y; + case LAYER_N_FRONT: + if( !brd->IsElementVisible( MOD_TEXT_FR_VISIBLE ) ) + return; + color = brd->GetVisibleElementColor( MOD_TEXT_FR_VISIBLE ); + break; - size = m_Size; - orient = GetDrawRotation(); - width = m_Thickness; + default: + color = brd->GetLayerColor( module->GetLayer() ); + } + // 'Ghost' the element if forced show + if( m_NoShow ) + { + if( !brd->IsElementVisible( MOD_TEXT_INVISIBLE ) ) + return; + color = brd->GetVisibleElementColor( MOD_TEXT_INVISIBLE ); + } + + // Draw mode compensation for the width + PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) panel->GetParent(); + int width = m_Thickness; if( ( frame->m_DisplayModText == LINE ) || ( DC->LogicalToDeviceXRel( width ) < MIN_DRAW_WIDTH ) ) width = 0; @@ -269,51 +289,32 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, width = -width; GRSetDrawMode( DC, draw_mode ); + wxPoint pos( m_Pos.x - offset.x, + m_Pos.y - offset.y); - BOARD * brd = GetBoard( ); - EDA_COLOR_T color; + // Draw the text anchor point if( brd->IsElementVisible( ANCHOR_VISIBLE ) ) { - color = brd->GetVisibleElementColor(ANCHOR_VISIBLE); - + EDA_COLOR_T anchor_color = brd->GetVisibleElementColor(ANCHOR_VISIBLE); int anchor_size = DC->DeviceToLogicalXRel( 2 ); GRLine( panel->GetClipBox(), DC, pos.x - anchor_size, pos.y, - pos.x + anchor_size, pos.y, 0, color ); + pos.x + anchor_size, pos.y, 0, anchor_color ); GRLine( panel->GetClipBox(), DC, pos.x, pos.y - anchor_size, - pos.x, pos.y + anchor_size, 0, color ); + pos.x, pos.y + anchor_size, 0, anchor_color ); } - color = brd->GetLayerColor(module->GetLayer()); + // Draw the text proper, with the right attributes + wxSize size = m_Size; + int orient = GetDrawRotation(); - - if( module->GetLayer() == LAYER_N_BACK ) - { - if( brd->IsElementVisible( MOD_TEXT_BK_VISIBLE ) == false ) - return; - color = brd->GetVisibleElementColor(MOD_TEXT_BK_VISIBLE); - } - else if( module->GetLayer() == LAYER_N_FRONT ) - { - if( brd->IsElementVisible( MOD_TEXT_FR_VISIBLE ) == false ) - return; - color = brd->GetVisibleElementColor(MOD_TEXT_FR_VISIBLE); - } - - if( m_NoShow ) - { - if( brd->IsElementVisible( MOD_TEXT_INVISIBLE ) == false ) - return; - color = brd->GetVisibleElementColor(MOD_TEXT_INVISIBLE); - } - - /* If the text is mirrored : negate size.x (mirror / Y axis) */ + // If the text is mirrored : negate size.x (mirror / Y axis) if( m_Mirror ) size.x = -size.x; - DrawGraphicText( panel, DC, pos, (enum EDA_COLOR_T) color, m_Text, orient, + DrawGraphicText( panel, DC, pos, color, m_Text, orient, size, m_HJustify, m_VJustify, width, m_Italic, m_Bold ); } From c32f56ffaac4f1e6975020706fc622caa155519b Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Sun, 31 Mar 2013 22:40:22 +0200 Subject: [PATCH 30/63] Removed the long time dead SCH_POLYLINE class (schematic level polyline) --- eeschema/CMakeLists.txt | 1 - eeschema/bus-wire-junction.cpp | 27 --- eeschema/load_one_schematic_file.cpp | 5 - eeschema/operations_on_items_lists.cpp | 3 - eeschema/sch_collectors.cpp | 5 - eeschema/sch_polyline.cpp | 295 ------------------------- eeschema/sch_polyline.h | 144 ------------ eeschema/schematic_undo_redo.cpp | 1 - include/base_struct.h | 1 - include/class_colors_design_settings.h | 3 +- 10 files changed, 1 insertion(+), 484 deletions(-) delete mode 100644 eeschema/sch_polyline.cpp delete mode 100644 eeschema/sch_polyline.h diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index 768d7c08bf..a4f03f0ce2 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -132,7 +132,6 @@ set(EESCHEMA_SRCS sch_line.cpp sch_marker.cpp sch_no_connect.cpp - sch_polyline.cpp sch_screen.cpp sch_sheet.cpp sch_sheet_path.cpp diff --git a/eeschema/bus-wire-junction.cpp b/eeschema/bus-wire-junction.cpp index 6cc039235e..1072491a17 100644 --- a/eeschema/bus-wire-junction.cpp +++ b/eeschema/bus-wire-junction.cpp @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include @@ -346,33 +345,7 @@ void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC ) if( ( screen->GetCurItem() == NULL ) || !screen->GetCurItem()->IsNew() ) return; - /* Cancel trace in progress */ - if( screen->GetCurItem()->Type() == SCH_POLYLINE_T ) - { - SCH_POLYLINE* polyLine = (SCH_POLYLINE*) screen->GetCurItem(); - wxPoint endpos; - - endpos = screen->GetCrossHairPosition(); - - int idx = polyLine->GetCornerCount() - 1; - wxPoint pt = (*polyLine)[idx]; - - if( GetForceHVLines() ) - { - /* Coerce the line to vertical or horizontal one: */ - if( std::abs( endpos.x - pt.x ) < std::abs( endpos.y - pt.y ) ) - endpos.x = pt.x; - else - endpos.y = pt.y; - } - - polyLine->SetPoint( idx, endpos ); - polyLine->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode ); - } - else - { DrawSegment( m_canvas, DC, wxDefaultPosition, false ); - } screen->Remove( screen->GetCurItem() ); m_canvas->SetMouseCaptureCallback( NULL ); diff --git a/eeschema/load_one_schematic_file.cpp b/eeschema/load_one_schematic_file.cpp index e621454278..05edd267b4 100644 --- a/eeschema/load_one_schematic_file.cpp +++ b/eeschema/load_one_schematic_file.cpp @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include @@ -182,10 +181,6 @@ again." ); item = new SCH_BUS_ENTRY(); break; - case 'P': // Its a polyline item. - item = new SCH_POLYLINE(); - break; - case 'C': // It is a connection item. item = new SCH_JUNCTION(); break; diff --git a/eeschema/operations_on_items_lists.cpp b/eeschema/operations_on_items_lists.cpp index c7cad1af69..943b514296 100644 --- a/eeschema/operations_on_items_lists.cpp +++ b/eeschema/operations_on_items_lists.cpp @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -25,7 +24,6 @@ void SetSchItemParent( SCH_ITEM* Struct, SCH_SCREEN* Screen ) { switch( Struct->Type() ) { - case SCH_POLYLINE_T: case SCH_JUNCTION_T: case SCH_TEXT_T: case SCH_LABEL_T: @@ -185,7 +183,6 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList, { switch( newitem->Type() ) { - case SCH_POLYLINE_T: case SCH_JUNCTION_T: case SCH_LINE_T: case SCH_BUS_ENTRY_T: diff --git a/eeschema/sch_collectors.cpp b/eeschema/sch_collectors.cpp index 2d4e0236f3..62bc97dbbf 100644 --- a/eeschema/sch_collectors.cpp +++ b/eeschema/sch_collectors.cpp @@ -41,7 +41,6 @@ const KICAD_T SCH_COLLECTOR::AllItems[] = { SCH_NO_CONNECT_T, SCH_BUS_ENTRY_T, SCH_LINE_T, - SCH_POLYLINE_T, SCH_BITMAP_T, SCH_TEXT_T, SCH_LABEL_T, @@ -62,7 +61,6 @@ const KICAD_T SCH_COLLECTOR::AllItemsButPins[] = { SCH_NO_CONNECT_T, SCH_BUS_ENTRY_T, SCH_LINE_T, - SCH_POLYLINE_T, SCH_BITMAP_T, SCH_TEXT_T, SCH_LABEL_T, @@ -111,7 +109,6 @@ const KICAD_T SCH_COLLECTOR::MovableItems[] = { SCH_NO_CONNECT_T, SCH_BUS_ENTRY_T, // SCH_LINE_T, - SCH_POLYLINE_T, SCH_BITMAP_T, SCH_TEXT_T, SCH_LABEL_T, @@ -129,7 +126,6 @@ const KICAD_T SCH_COLLECTOR::DraggableItems[] = { SCH_JUNCTION_T, SCH_BUS_ENTRY_T, SCH_LINE_T, - SCH_POLYLINE_T, SCH_LABEL_T, SCH_GLOBAL_LABEL_T, SCH_HIERARCHICAL_LABEL_T, @@ -158,7 +154,6 @@ const KICAD_T SCH_COLLECTOR::ParentItems[] = { SCH_NO_CONNECT_T, SCH_BUS_ENTRY_T, SCH_LINE_T, - SCH_POLYLINE_T, SCH_TEXT_T, SCH_LABEL_T, SCH_GLOBAL_LABEL_T, diff --git a/eeschema/sch_polyline.cpp b/eeschema/sch_polyline.cpp deleted file mode 100644 index dc38b29f48..0000000000 --- a/eeschema/sch_polyline.cpp +++ /dev/null @@ -1,295 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, you may find one here: - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * or you may search the http://www.gnu.org website for the version 2 license, - * or you may write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -/** - * @file sch_polyline.cpp - */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - - -SCH_POLYLINE::SCH_POLYLINE( int layer ) : - SCH_ITEM( NULL, SCH_POLYLINE_T ) -{ - m_width = 0; - - switch( layer ) - { - default: - m_Layer = LAYER_NOTES; - break; - - case LAYER_WIRE: - case LAYER_NOTES: - case LAYER_BUS: - m_Layer = layer; - break; - } -} - - -SCH_POLYLINE::~SCH_POLYLINE() -{ -} - - -EDA_ITEM* SCH_POLYLINE::Clone() const -{ - return new SCH_POLYLINE( *this ); -} - - -bool SCH_POLYLINE::Save( FILE* aFile ) const -{ - bool success = true; - - const char* layer = "Notes"; - const char* width = "Line"; - - if( GetLayer() == LAYER_WIRE ) - layer = "Wire"; - - if( GetLayer() == LAYER_BUS ) - layer = "Bus"; - - if( fprintf( aFile, "Poly %s %s %d\n", width, layer, GetCornerCount() ) == EOF ) - { - return false; - } - - for( unsigned ii = 0; ii < GetCornerCount(); ii++ ) - { - if( fprintf( aFile, "\t%-4d %-4d\n", m_points[ii ].x, m_points[ii].y ) == EOF ) - { - success = false; - break; - } - } - - return success; -} - - -bool SCH_POLYLINE::Load( LINE_READER& aLine, wxString& aErrorMsg ) -{ - char Name1[256]; - char Name2[256]; - wxPoint pt; - int ii; - char* line = (char*) aLine; - - while( (*line != ' ' ) && *line ) - line++; - - if( sscanf( line, "%s %s %d", Name1, Name2, &ii ) != 3 ) - { - aErrorMsg.Printf( wxT( "Eeschema file polyline struct error at line %d, aborted" ), - aLine.LineNumber() ); - aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine ); - return false; - } - - m_Layer = LAYER_NOTES; - - if( Name2[0] == 'W' ) - m_Layer = LAYER_WIRE; - - if( Name2[0] == 'B' ) - m_Layer = LAYER_BUS; - - for( unsigned jj = 0; jj < (unsigned)ii; jj++ ) - { - wxPoint point; - - if( !aLine.ReadLine() || sscanf( ((char*) aLine), "%d %d", &pt.x, &pt.y ) != 2 ) - { - aErrorMsg.Printf( wxT( "Eeschema file polyline struct error at line %d, aborted" ), - aLine.LineNumber() ); - aErrorMsg << wxT( "\n" ) << FROM_UTF8( (char*) aLine ); - return false; - } - - AddPoint( pt ); - } - - return true; -} - - -int SCH_POLYLINE::GetPenSize() const -{ - int pensize = ( m_width == 0 ) ? GetDefaultLineThickness() : m_width; - - return pensize; -} - - -void SCH_POLYLINE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, - GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor ) -{ - EDA_COLOR_T color; - int width = GetPenSize(); - - if( aColor >= 0 ) - color = aColor; - else - color = ReturnLayerColor( m_Layer ); - - GRSetDrawMode( aDC, aDrawMode ); - - if( m_Layer == LAYER_BUS ) - { - width *= 3; - } - - GRMoveTo( m_points[0].x, m_points[0].y ); - - if( m_Layer == LAYER_NOTES ) - { - for( unsigned i = 1; i < GetCornerCount(); i++ ) - GRDashedLineTo( aPanel->GetClipBox(), aDC, m_points[i].x + aOffset.x, - m_points[i].y + aOffset.y, width, color ); - } - else - { - for( unsigned i = 1; i < GetCornerCount(); i++ ) - GRLineTo( aPanel->GetClipBox(), aDC, m_points[i].x + aOffset.x, - m_points[i].y + aOffset.y, width, color ); - } -} - - -void SCH_POLYLINE::MirrorX( int aXaxis_position ) -{ - for( unsigned ii = 0; ii < GetCornerCount(); ii++ ) - { - m_points[ii].y -= aXaxis_position; - NEGATE( m_points[ii].y ); - m_points[ii].y = aXaxis_position; - } -} - - -void SCH_POLYLINE::MirrorY( int aYaxis_position ) -{ - for( unsigned ii = 0; ii < GetCornerCount(); ii++ ) - { - m_points[ii].x -= aYaxis_position; - NEGATE( m_points[ii].x ); - m_points[ii].x = aYaxis_position; - } -} - - -void SCH_POLYLINE::Rotate( wxPoint aPosition ) -{ - for( unsigned ii = 0; ii < GetCornerCount(); ii++ ) - { - RotatePoint( &m_points[ii], aPosition, 900 ); - } -} - - -wxString SCH_POLYLINE::GetSelectMenuText() const -{ - wxString menuText, fmt; - - switch( m_Layer ) - { - case LAYER_NOTES: - fmt = _( "Graphic Polyline with %d Points" ); - break; - - case LAYER_WIRE: - fmt = _( "Polyline Wire with %d Points" ); - break; - - case LAYER_BUS: - fmt = _( "Polyline Bus with %d Points" ); - break; - - default: - fmt = _( "Polyline on Unkown Layer with %d Points" ); - } - - menuText.Printf( fmt, m_points.size() ); - - return menuText; -} - - -BITMAP_DEF SCH_POLYLINE::GetMenuImage() const -{ - if( m_Layer == LAYER_NOTES ) - return add_dashed_line_xpm; - else if( m_Layer == LAYER_WIRE ) - return add_line_xpm; - - return add_bus_xpm; -} - - -bool SCH_POLYLINE::HitTest( const wxPoint& aPosition, int aAccuracy ) const -{ - for( size_t i = 0; i < m_points.size() - 1; i++ ) - { - if( TestSegmentHit( aPosition, m_points[i], m_points[i + 1], aAccuracy ) ) - return true; - } - - return false; -} - - -bool SCH_POLYLINE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const -{ - EDA_RECT rect = aRect; - - rect.Inflate( aAccuracy ); - - if( aContained ) - return rect.Contains( GetBoundingBox() ); - - return rect.Intersects( GetBoundingBox() ); -} - - -void SCH_POLYLINE::SetPosition( const wxPoint& aPosition ) -{ - wxPoint offset = m_points[0] - aPosition; - - for( size_t i = 0; i < m_points.size(); i++ ) - m_points[i] = m_points[i] - offset; -} - diff --git a/eeschema/sch_polyline.h b/eeschema/sch_polyline.h deleted file mode 100644 index 84ac454d2f..0000000000 --- a/eeschema/sch_polyline.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, you may find one here: - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * or you may search the http://www.gnu.org website for the version 2 license, - * or you may write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -/** - * @file sch_polyline.h - * - */ - -#ifndef _SCH_POLYLINE_H_ -#define _SCH_POLYLINE_H_ - - -#include - - -class SCH_POLYLINE : public SCH_ITEM -{ - int m_width; // Thickness - std::vector m_points; // list of points (>= 2) - -public: - SCH_POLYLINE( int layer = LAYER_NOTES ); - - // Do not create a copy constructor. The one generated by the compiler is adequate. - - ~SCH_POLYLINE(); - - wxString GetClass() const - { - return wxT( "SCH_POLYLINE" ); - } - - void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, - GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR ); - - bool Save( FILE* aFile ) const; - - bool Load( LINE_READER& aLine, wxString& aErrorMsg ); - - /** - * Function AddPoint - * add a corner to m_points - */ - void AddPoint( const wxPoint& point ) - { - m_points.push_back( point ); - } - - - /** - * Function SetPoint - * sets the point at \a aIndex in the list to \a aPoint. - * - * @param aIndex The index in the point list. - * @param aPoint The new point value. - */ - void SetPoint( int aIndex, const wxPoint& aPoint ) - { - // (unsigned) excludes aIndex<0 also - wxCHECK_RET( (unsigned)aIndex < m_points.size(), - wxT( "Invalid SCH_POLYLINE point list index." ) ); - - m_points[ aIndex ] = aPoint; - } - - - /** - * Function GetCornerCount - * @return the number of corners - */ - unsigned GetCornerCount() const { return m_points.size(); } - - int GetPenSize() const; - - void Move( const wxPoint& aMoveVector ) - { - for( unsigned ii = 0; ii < GetCornerCount(); ii++ ) - m_points[ii] += aMoveVector; - } - - void MirrorY( int aYaxis_position ); - - void MirrorX( int aXaxis_position ); - - void Rotate( wxPoint aPosition ); - - wxString GetSelectMenuText() const; - - BITMAP_DEF GetMenuImage() const; - - /** - * Function operator[] - * is used for read only access and returns the point at \a aIndex. - * @param aIndex The index of the list of points to return. - * @return A wxPoint object containing the point at \a aIndex. - */ - wxPoint operator[]( int aIndex ) const - { - // (unsigned) excludes aIndex<0 also - wxCHECK_MSG( (unsigned)aIndex < m_points.size(), wxDefaultPosition, - wxT( "Invalid SCH_POLYLINE point list index." ) ); - - return m_points[ aIndex ]; - } - - wxPoint GetPosition() const { return m_points[0]; } - - void SetPosition( const wxPoint& aPosition ); - - bool HitTest( const wxPoint& aPosition, int aAccuracy ) const; - - bool HitTest( const EDA_RECT& aRect, bool aContained = false, - int aAccuracy = 0 ) const; - - EDA_ITEM* Clone() const; - -#if defined(DEBUG) - void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override -#endif -}; - - -#endif // _SCH_POLYLINE_H_ diff --git a/eeschema/schematic_undo_redo.cpp b/eeschema/schematic_undo_redo.cpp index 89c2c59e40..4481e8cce0 100644 --- a/eeschema/schematic_undo_redo.cpp +++ b/eeschema/schematic_undo_redo.cpp @@ -39,7 +39,6 @@ #include #include #include -#include #include #include diff --git a/include/base_struct.h b/include/base_struct.h index 56ce1a04e7..0c0db083d5 100644 --- a/include/base_struct.h +++ b/include/base_struct.h @@ -84,7 +84,6 @@ enum KICAD_T { SCH_NO_CONNECT_T, SCH_BUS_ENTRY_T, SCH_LINE_T, - SCH_POLYLINE_T, SCH_BITMAP_T, SCH_TEXT_T, SCH_LABEL_T, diff --git a/include/class_colors_design_settings.h b/include/class_colors_design_settings.h index 5813b82676..d49cab4ba1 100644 --- a/include/class_colors_design_settings.h +++ b/include/class_colors_design_settings.h @@ -7,8 +7,7 @@ #define _COLORS_DESIGN_SETTING_H #include -// XXX shouldn't these come from somewhere else? -#define LAYERSCOLORSBUFFERSIZE 32 +#define LAYERSCOLORSBUFFERSIZE NB_LAYERS #define ITEMSCOLORSBUFFERSIZE 32 /** From 81751632962179fd7c0470ade27f675e742d82d8 Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Mon, 1 Apr 2013 07:26:53 +0200 Subject: [PATCH 31/63] Better type safety to DANGLING_END_ITEM (SCH_ITEM* instead of void*) --- include/sch_item_struct.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/sch_item_struct.h b/include/sch_item_struct.h index 3f71041b4d..5ac910dab2 100644 --- a/include/sch_item_struct.h +++ b/include/sch_item_struct.h @@ -85,7 +85,7 @@ class DANGLING_END_ITEM { private: /// A pointer to the connectable object. - const void* m_item; + const EDA_ITEM* m_item; /// The position of the connection point. wxPoint m_pos; @@ -94,7 +94,7 @@ private: DANGLING_END_T m_type; public: - DANGLING_END_ITEM( DANGLING_END_T aType, const void* aItem, const wxPoint& aPosition ) + DANGLING_END_ITEM( DANGLING_END_T aType, const EDA_ITEM* aItem, const wxPoint& aPosition ) { m_item = aItem; m_type = aType; @@ -102,7 +102,7 @@ public: } wxPoint GetPosition() const { return m_pos; } - const void* GetItem() const { return m_item; } + const EDA_ITEM* GetItem() const { return m_item; } DANGLING_END_T GetType() const { return m_type; } }; From cc0524a21a7b64d7541cddb5d04499a23ae9ee4c Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Mon, 1 Apr 2013 07:47:44 +0200 Subject: [PATCH 32/63] Converted the IS_BUS/IS_WIRE define to an enum --- eeschema/netlist.cpp | 48 +++++++++++++++++++++++++------------------- eeschema/netlist.h | 4 +--- 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/eeschema/netlist.cpp b/eeschema/netlist.cpp index 5eaeb3a0b5..8d071e8714 100644 --- a/eeschema/netlist.cpp +++ b/eeschema/netlist.cpp @@ -49,15 +49,21 @@ const SCH_SHEET_PATH BOM_LABEL::emptySheetPath; +enum BUS_OR_WIRE +{ + IS_WIRE = 0, + IS_BUS = 1 +}; + // Buffer to build the list of items used in netlist and erc calculations NETLIST_OBJECT_LIST g_NetObjectslist; //#define NETLIST_DEBUG -static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus ); +static void PropageNetCode( int OldNetCode, int NewNetCode, BUS_OR_WIRE IsBus ); static void SheetLabelConnect( NETLIST_OBJECT* SheetLabel ); -static void PointToPointConnect( NETLIST_OBJECT* Ref, int IsBus, int start ); -static void SegmentToPointConnect( NETLIST_OBJECT* Jonction, int IsBus, int start ); +static void PointToPointConnect( NETLIST_OBJECT* Ref, BUS_OR_WIRE IsBus, int start ); +static void SegmentToPointConnect( NETLIST_OBJECT* Jonction, BUS_OR_WIRE IsBus, int start ); static void LabelConnect( NETLIST_OBJECT* Label ); static void ConnectBusLabels( NETLIST_OBJECT_LIST& aNetItemBuffer ); static void SetUnconnectedFlag( NETLIST_OBJECT_LIST& aNetItemBuffer ); @@ -184,7 +190,7 @@ void SCH_EDIT_FRAME::BuildNetListBase() LastNetCode++; } - PointToPointConnect( net_item, 0, istart ); + PointToPointConnect( net_item, IS_WIRE, istart ); break; case NET_JUNCTION: @@ -195,7 +201,7 @@ void SCH_EDIT_FRAME::BuildNetListBase() LastNetCode++; } - SegmentToPointConnect( net_item, 0, istart ); + SegmentToPointConnect( net_item, IS_WIRE, istart ); /* Control of the junction, on BUS. */ if( net_item->m_BusNetCode == 0 ) @@ -204,7 +210,7 @@ void SCH_EDIT_FRAME::BuildNetListBase() LastBusNetCode++; } - SegmentToPointConnect( net_item, ISBUS, istart ); + SegmentToPointConnect( net_item, IS_BUS, istart ); break; case NET_LABEL: @@ -217,7 +223,7 @@ void SCH_EDIT_FRAME::BuildNetListBase() LastNetCode++; } - SegmentToPointConnect( net_item, 0, istart ); + SegmentToPointConnect( net_item, IS_WIRE, istart ); break; case NET_SHEETBUSLABELMEMBER: @@ -232,7 +238,7 @@ void SCH_EDIT_FRAME::BuildNetListBase() LastBusNetCode++; } - PointToPointConnect( net_item, ISBUS, istart ); + PointToPointConnect( net_item, IS_BUS, istart ); break; case NET_BUSLABELMEMBER: @@ -245,7 +251,7 @@ void SCH_EDIT_FRAME::BuildNetListBase() LastBusNetCode++; } - SegmentToPointConnect( net_item, ISBUS, istart ); + SegmentToPointConnect( net_item, IS_BUS, istart ); break; } } @@ -547,7 +553,7 @@ static void SheetLabelConnect( NETLIST_OBJECT* SheetLabel ) /* Propagate Netcode having all the objects of the same Netcode. */ if( ObjetNet->GetNet() ) - PropageNetCode( ObjetNet->GetNet(), SheetLabel->GetNet(), 0 ); + PropageNetCode( ObjetNet->GetNet(), SheetLabel->GetNet(), IS_WIRE ); else ObjetNet->SetNet( SheetLabel->GetNet() ); } @@ -593,7 +599,7 @@ static void ConnectBusLabels( NETLIST_OBJECT_LIST& aNetItemBuffer ) if( LabelInTst->GetNet() == 0 ) LabelInTst->SetNet( Label->GetNet() ); else - PropageNetCode( LabelInTst->GetNet(), Label->GetNet(), 0 ); + PropageNetCode( LabelInTst->GetNet(), Label->GetNet(), IS_WIRE ); } } } @@ -607,12 +613,12 @@ static void ConnectBusLabels( NETLIST_OBJECT_LIST& aNetItemBuffer ) * If IsBus == 0; Netcode is the member who is spreading * If IsBus != 0; is the member who is spreading BusNetCode */ -static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus ) +static void PropageNetCode( int OldNetCode, int NewNetCode, BUS_OR_WIRE IsBus ) { if( OldNetCode == NewNetCode ) return; - if( IsBus == 0 ) /* Propagate NetCode */ + if( IsBus == IS_WIRE ) // Propagate NetCode { for( unsigned jj = 0; jj < g_NetObjectslist.size(); jj++ ) { @@ -658,11 +664,11 @@ static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus ) * Leaf schema * (There can be no physical connection between elements of different sheets) */ -static void PointToPointConnect( NETLIST_OBJECT* Ref, int IsBus, int start ) +static void PointToPointConnect( NETLIST_OBJECT* Ref, BUS_OR_WIRE IsBus, int start ) { int netCode; - if( IsBus == 0 ) /* Objects other than BUS and BUSLABELS. */ + if( IsBus == IS_WIRE ) // Objects other than BUS and BUSLABELS { netCode = Ref->GetNet(); @@ -692,7 +698,7 @@ static void PointToPointConnect( NETLIST_OBJECT* Ref, int IsBus, int start ) if( item->GetNet() == 0 ) item->SetNet( netCode ); else - PropageNetCode( item->GetNet(), netCode, 0 ); + PropageNetCode( item->GetNet(), netCode, IS_WIRE ); } break; @@ -744,7 +750,7 @@ static void PointToPointConnect( NETLIST_OBJECT* Ref, int IsBus, int start ) if( item->m_BusNetCode == 0 ) item->m_BusNetCode = netCode; else - PropageNetCode( item->m_BusNetCode, netCode, 1 ); + PropageNetCode( item->m_BusNetCode, netCode, IS_BUS ); } break; } @@ -760,7 +766,7 @@ static void PointToPointConnect( NETLIST_OBJECT* Ref, int IsBus, int start ) * The list of objects is expected sorted by sheets. * Search is done from index aIdxStart to the last element of g_NetObjectslist */ -static void SegmentToPointConnect( NETLIST_OBJECT* aJonction, int aIsBus, int aIdxStart ) +static void SegmentToPointConnect( NETLIST_OBJECT* aJonction, BUS_OR_WIRE aIsBus, int aIdxStart ) { for( unsigned i = aIdxStart; i < g_NetObjectslist.size(); i++ ) { @@ -770,7 +776,7 @@ static void SegmentToPointConnect( NETLIST_OBJECT* aJonction, int aIsBus, int aI if( Segment->m_SheetList != aJonction->m_SheetList ) continue; - if( aIsBus == 0 ) + if( aIsBus == IS_WIRE ) { if( Segment->m_Type != NET_SEGMENT ) continue; @@ -784,7 +790,7 @@ static void SegmentToPointConnect( NETLIST_OBJECT* aJonction, int aIsBus, int aI if( SegmentIntersect( Segment->m_Start, Segment->m_End, aJonction->m_Start ) ) { /* Propagation Netcode has all the objects of the same Netcode. */ - if( aIsBus == 0 ) + if( aIsBus == IS_WIRE ) { if( Segment->GetNet() ) PropageNetCode( Segment->GetNet(), aJonction->GetNet(), aIsBus ); @@ -849,7 +855,7 @@ void LabelConnect( NETLIST_OBJECT* LabelRef ) continue; if( g_NetObjectslist[i]->GetNet() ) - PropageNetCode( g_NetObjectslist[i]->GetNet(), LabelRef->GetNet(), 0 ); + PropageNetCode( g_NetObjectslist[i]->GetNet(), LabelRef->GetNet(), IS_WIRE ); else g_NetObjectslist[i]->SetNet( LabelRef->GetNet() ); } diff --git a/eeschema/netlist.h b/eeschema/netlist.h index e656ff4dcc..e1c6ea3f10 100644 --- a/eeschema/netlist.h +++ b/eeschema/netlist.h @@ -45,9 +45,7 @@ class SCH_REFERENC_LIST; #define NETLIST_HEAD_STRING "EESchema Netlist Version 1.1" -#define ISBUS 1 - -/* Max pin number per component and footprint */ +// Max pin number per component and footprint #define MAXPIN 5000 From 0dd413a711b90fcb755d5c76af4851b37b469c12 Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Mon, 1 Apr 2013 07:53:38 +0200 Subject: [PATCH 33/63] Removed unused defines --- gerbview/rs274d.cpp | 5 ----- gerbview/select_layers_to_pcb.h | 4 ---- 2 files changed, 9 deletions(-) diff --git a/gerbview/rs274d.cpp b/gerbview/rs274d.cpp index e7681bbedd..03c5f6ffd9 100644 --- a/gerbview/rs274d.cpp +++ b/gerbview/rs274d.cpp @@ -62,11 +62,6 @@ * D10 ... D999 = Identification Tool: tool selection */ -// Photoplot actions: -#define GERB_ACTIVE_DRAW 1 // Activate light (lower pen) -#define GERB_STOP_DRAW 2 // Extinguish light (lift pen) -#define GERB_FLASH 3 // Flash - /* Local Functions (are lower case since they are private to this source file) **/ diff --git a/gerbview/select_layers_to_pcb.h b/gerbview/select_layers_to_pcb.h index b2040c9354..c4ad9789b5 100644 --- a/gerbview/select_layers_to_pcb.h +++ b/gerbview/select_layers_to_pcb.h @@ -8,10 +8,6 @@ #include #include -#define BOARD_LAYERS_MAX_COUNT NB_LAYERS -#define BOARD_COPPER_LAYERS_MAX_COUNT NB_COPPER_LAYERS -#define LAYER_UNSELECTED BOARD_LAYERS_MAX_COUNT - /* * This dialog shows the gerber files loaded, and allows user to choose * equivalence tbetween gerber layers and pcb layers From f37812f8986fc068bb4ce6300039e47bcc875bd6 Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Mon, 1 Apr 2013 12:35:20 +0200 Subject: [PATCH 34/63] Refactoring: split in two the SCH_BUS_ENTRY class --- eeschema/busentry.cpp | 20 ++- eeschema/load_one_schematic_file.cpp | 9 +- eeschema/onleftclick.cpp | 16 ++- eeschema/onrightclick.cpp | 9 +- eeschema/operations_on_items_lists.cpp | 6 +- eeschema/sch_bus_entry.cpp | 164 +++++++++++++------------ eeschema/sch_bus_entry.h | 91 +++++++++----- eeschema/sch_collectors.cpp | 23 ++-- eeschema/sch_screen.cpp | 13 +- eeschema/schedit.cpp | 10 +- include/base_struct.h | 3 +- include/wxEeschemaStruct.h | 9 +- 12 files changed, 227 insertions(+), 146 deletions(-) diff --git a/eeschema/busentry.cpp b/eeschema/busentry.cpp index 2a198f3857..2066aba264 100644 --- a/eeschema/busentry.cpp +++ b/eeschema/busentry.cpp @@ -43,28 +43,36 @@ static int s_LastShape = '\\'; -SCH_BUS_ENTRY* SCH_EDIT_FRAME::CreateBusEntry( wxDC* aDC, int aType ) +SCH_BUS_BUS_ENTRY* SCH_EDIT_FRAME::CreateBusBusEntry( wxDC* aDC ) { SCH_SCREEN* screen = GetScreen(); // Create and place a new bus entry at cursor position - SCH_BUS_ENTRY* busEntry = new SCH_BUS_ENTRY( screen->GetCrossHairPosition(), s_LastShape, - aType ); + SCH_BUS_BUS_ENTRY* busEntry = new SCH_BUS_BUS_ENTRY( screen->GetCrossHairPosition(), s_LastShape ); busEntry->SetFlags( IS_NEW ); GetScreen()->SetCurItem( busEntry ); addCurrentItemToList( aDC ); return busEntry; } +SCH_BUS_WIRE_ENTRY* SCH_EDIT_FRAME::CreateBusWireEntry( wxDC* aDC ) +{ + SCH_SCREEN* screen = GetScreen(); + + // Create and place a new bus entry at cursor position + SCH_BUS_WIRE_ENTRY* busEntry = new SCH_BUS_WIRE_ENTRY( screen->GetCrossHairPosition(), s_LastShape ); + busEntry->SetFlags( IS_NEW ); + GetScreen()->SetCurItem( busEntry ); + addCurrentItemToList( aDC ); + return busEntry; +} /* set the shape of BusEntry (shape = / or \ ) */ -void SCH_EDIT_FRAME::SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY* BusEntry, int entry_shape ) +void SCH_EDIT_FRAME::SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY_BASE* BusEntry, char entry_shape ) { if( BusEntry == NULL ) return; - - if( BusEntry->Type() != SCH_BUS_ENTRY_T ) { DisplayError( this, wxT( "SetBusEntryType: Bad StructType" ) ); return; diff --git a/eeschema/load_one_schematic_file.cpp b/eeschema/load_one_schematic_file.cpp index 05edd267b4..7d7a9be5ad 100644 --- a/eeschema/load_one_schematic_file.cpp +++ b/eeschema/load_one_schematic_file.cpp @@ -147,6 +147,7 @@ again." ); while( reader.ReadLine() ) { + itemLoaded = false; line = reader.Line(); item = NULL; @@ -167,6 +168,8 @@ again." ); itemLoaded = ReadSchemaDescr( &reader, msgDiag, aScreen ); else if( line[1] == 'B' ) item = new SCH_BITMAP(); + else if( line[1] == 'E' ) + itemLoaded = true; // The EOF marker break; case 'L': // Its a library item. @@ -178,7 +181,9 @@ again." ); break; case 'E': // Its a WIRE or BUS item. - item = new SCH_BUS_ENTRY(); + /* The bus entry can be represented by two different + * classes, so we need a factory function */ + itemLoaded = SCH_BUS_ENTRY_BASE::Load( reader, msgDiag, &item ); break; case 'C': // It is a connection item. @@ -220,6 +225,8 @@ again." ); if( item ) { + // Load it if it wasn't by a factory + if( !itemLoaded ) itemLoaded = item->Load( reader, msgDiag ); if( !itemLoaded ) diff --git a/eeschema/onleftclick.cpp b/eeschema/onleftclick.cpp index 1fcd2085b9..067db61625 100644 --- a/eeschema/onleftclick.cpp +++ b/eeschema/onleftclick.cpp @@ -70,7 +70,8 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) case SCH_TEXT_T: case SCH_SHEET_PIN_T: case SCH_SHEET_T: - case SCH_BUS_ENTRY_T: + case SCH_BUS_WIRE_ENTRY_T: + case SCH_BUS_BUS_ENTRY_T: case SCH_JUNCTION_T: case SCH_COMPONENT_T: case SCH_FIELD_T: @@ -157,11 +158,20 @@ void SCH_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) break; case ID_WIRETOBUS_ENTRY_BUTT: + if( ( item == NULL ) || ( item->GetFlags() == 0 ) ) + { + CreateBusWireEntry( aDC ); + m_canvas->SetAutoPanRequest( true ); + } + else + { + addCurrentItemToList( aDC ); + } + break; case ID_BUSTOBUS_ENTRY_BUTT: if( ( item == NULL ) || ( item->GetFlags() == 0 ) ) { - CreateBusEntry( aDC, ( GetToolId() == ID_WIRETOBUS_ENTRY_BUTT ) ? - WIRE_TO_BUS : BUS_TO_BUS ); + CreateBusBusEntry( aDC ); m_canvas->SetAutoPanRequest( true ); } else diff --git a/eeschema/onrightclick.cpp b/eeschema/onrightclick.cpp index 9f59ce816f..42e406b794 100644 --- a/eeschema/onrightclick.cpp +++ b/eeschema/onrightclick.cpp @@ -64,7 +64,7 @@ static void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component ); static void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field ); static void AddMenusForMarkers( wxMenu* aPopMenu, SCH_MARKER* aMarker, SCH_EDIT_FRAME* aFrame ); static void AddMenusForBitmap( wxMenu* aPopMenu, SCH_BITMAP * aBitmap ); -static void AddMenusForBusEntry( wxMenu* aPopMenu, SCH_BUS_ENTRY * aBusEntry ); +static void AddMenusForBusEntry( wxMenu* aPopMenu, SCH_BUS_ENTRY_BASE * aBusEntry ); @@ -219,8 +219,9 @@ bool SCH_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu ) addJunctionMenuEntries( PopMenu, (SCH_JUNCTION*) item ); break; - case SCH_BUS_ENTRY_T: - AddMenusForBusEntry( PopMenu, (SCH_BUS_ENTRY*) item ); + case SCH_BUS_BUS_ENTRY_T: + case SCH_BUS_WIRE_ENTRY_T: + AddMenusForBusEntry( PopMenu, dynamic_cast( item ) ); break; case SCH_MARKER_T: @@ -873,7 +874,7 @@ void AddMenusForBitmap( wxMenu* aPopMenu, SCH_BITMAP * aBitmap ) } } -void AddMenusForBusEntry( wxMenu* aPopMenu, SCH_BUS_ENTRY * aBusEntry ) +void AddMenusForBusEntry( wxMenu* aPopMenu, SCH_BUS_ENTRY_BASE* aBusEntry ) { wxString msg; if( !aBusEntry->GetFlags() ) diff --git a/eeschema/operations_on_items_lists.cpp b/eeschema/operations_on_items_lists.cpp index 943b514296..a080833d0a 100644 --- a/eeschema/operations_on_items_lists.cpp +++ b/eeschema/operations_on_items_lists.cpp @@ -31,7 +31,8 @@ void SetSchItemParent( SCH_ITEM* Struct, SCH_SCREEN* Screen ) case SCH_HIERARCHICAL_LABEL_T: case SCH_COMPONENT_T: case SCH_LINE_T: - case SCH_BUS_ENTRY_T: + case SCH_BUS_BUS_ENTRY_T: + case SCH_BUS_WIRE_ENTRY_T: case SCH_SHEET_T: case SCH_MARKER_T: case SCH_NO_CONNECT_T: @@ -185,7 +186,8 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList, { case SCH_JUNCTION_T: case SCH_LINE_T: - case SCH_BUS_ENTRY_T: + case SCH_BUS_BUS_ENTRY_T: + case SCH_BUS_WIRE_ENTRY_T: case SCH_TEXT_T: case SCH_LABEL_T: case SCH_GLOBAL_LABEL_T: diff --git a/eeschema/sch_bus_entry.cpp b/eeschema/sch_bus_entry.cpp index b7c2c61e27..e792949410 100644 --- a/eeschema/sch_bus_entry.cpp +++ b/eeschema/sch_bus_entry.cpp @@ -42,80 +42,81 @@ #include -SCH_BUS_ENTRY::SCH_BUS_ENTRY( const wxPoint& pos, int shape, int id ) : - SCH_ITEM( NULL, SCH_BUS_ENTRY_T ) +SCH_BUS_ENTRY_BASE::SCH_BUS_ENTRY_BASE( KICAD_T aType, const wxPoint& pos, char shape ) : + SCH_ITEM( NULL, aType ) { m_pos = pos; m_size.x = 100; m_size.y = 100; - m_Layer = LAYER_WIRE; - m_width = 0; - - if( id == BUS_TO_BUS ) - { - m_Layer = LAYER_BUS; - } if( shape == '/' ) m_size.y = -100; } - -EDA_ITEM* SCH_BUS_ENTRY::Clone() const +SCH_BUS_WIRE_ENTRY::SCH_BUS_WIRE_ENTRY( const wxPoint& pos, char shape ) : + SCH_BUS_ENTRY_BASE( SCH_BUS_WIRE_ENTRY_T, pos, shape ) { - return new SCH_BUS_ENTRY( *this ); + m_Layer = LAYER_WIRE; +} + +SCH_BUS_BUS_ENTRY::SCH_BUS_BUS_ENTRY( const wxPoint& pos, char shape ) : + SCH_BUS_ENTRY_BASE( SCH_BUS_BUS_ENTRY_T, pos, shape ) +{ + m_Layer = LAYER_BUS; +} + +EDA_ITEM* SCH_BUS_WIRE_ENTRY::Clone() const +{ + return new SCH_BUS_WIRE_ENTRY( *this ); +} + +EDA_ITEM* SCH_BUS_BUS_ENTRY::Clone() const +{ + return new SCH_BUS_BUS_ENTRY( *this ); } -wxPoint SCH_BUS_ENTRY::m_End() const +wxPoint SCH_BUS_ENTRY_BASE::m_End() const { return wxPoint( m_pos.x + m_size.x, m_pos.y + m_size.y ); } -void SCH_BUS_ENTRY::SwapData( SCH_ITEM* aItem ) +void SCH_BUS_ENTRY_BASE::SwapData( SCH_ITEM* aItem ) { - wxCHECK_RET( (aItem != NULL) && (aItem->Type() == SCH_BUS_ENTRY_T), - wxT( "Cannot swap bus entry data with invalid item." ) ); + SCH_BUS_ENTRY_BASE* item = dynamic_cast( aItem ); + wxCHECK_RET( item, wxT( "Cannot swap bus entry data with invalid item." ) ); - SCH_BUS_ENTRY* item = (SCH_BUS_ENTRY*)aItem; EXCHG( m_pos, item->m_pos ); EXCHG( m_size, item->m_size ); - EXCHG( m_width, item->m_width ); } -bool SCH_BUS_ENTRY::Save( FILE* aFile ) const +bool SCH_BUS_WIRE_ENTRY::Save( FILE* aFile ) const { - bool success = true; - - const char* layer = "Wire"; - const char* width = "Line"; - - if( GetLayer() == LAYER_BUS ) - { - layer = "Bus"; width = "Bus"; - } - - if( fprintf( aFile, "Entry %s %s\n", layer, width ) == EOF ) - { - success = false; - } - if( fprintf( aFile, "\t%-4d %-4d %-4d %-4d\n", + if( fprintf( aFile, "Entry Wire Line\n\t%-4d %-4d %-4d %-4d\n", m_pos.x, m_pos.y, m_End().x, m_End().y ) == EOF ) - { - success = false; - } - - return success; + return false; + return true; } -bool SCH_BUS_ENTRY::Load( LINE_READER& aLine, wxString& aErrorMsg ) +bool SCH_BUS_BUS_ENTRY::Save( FILE* aFile ) const +{ + if( fprintf( aFile, "Entry Bus Bus\n\t%-4d %-4d %-4d %-4d\n", + m_pos.x, m_pos.y, m_End().x, m_End().y ) == EOF ) + return false; + return true; +} + + +bool SCH_BUS_ENTRY_BASE::Load( LINE_READER& aLine, wxString& aErrorMsg, + SCH_ITEM **out ) { char Name1[256]; char Name2[256]; char* line = (char*) aLine; + *out = NULL; while( (*line != ' ' ) && *line ) line++; @@ -128,13 +129,16 @@ bool SCH_BUS_ENTRY::Load( LINE_READER& aLine, wxString& aErrorMsg ) return false; } - m_Layer = LAYER_WIRE; - + SCH_BUS_ENTRY_BASE *this_new; if( Name1[0] == 'B' ) - m_Layer = LAYER_BUS; + this_new = new SCH_BUS_BUS_ENTRY; + else + this_new = new SCH_BUS_WIRE_ENTRY; + *out = this_new; - if( !aLine.ReadLine() || sscanf( (char*) aLine, "%d %d %d %d ", &m_pos.x, &m_pos.y, - &m_size.x, &m_size.y ) != 4 ) + if( !aLine.ReadLine() || sscanf( (char*) aLine, "%d %d %d %d ", + &this_new->m_pos.x, &this_new->m_pos.y, + &this_new->m_size.x, &this_new->m_size.y ) != 4 ) { aErrorMsg.Printf( wxT( "Eeschema file bus entry load error at line %d" ), aLine.LineNumber() ); @@ -142,14 +146,14 @@ bool SCH_BUS_ENTRY::Load( LINE_READER& aLine, wxString& aErrorMsg ) return false; } - m_size.x -= m_pos.x; - m_size.y -= m_pos.y; + this_new->m_size.x -= this_new->m_pos.x; + this_new->m_size.y -= this_new->m_pos.y; return true; } -EDA_RECT SCH_BUS_ENTRY::GetBoundingBox() const +EDA_RECT SCH_BUS_ENTRY_BASE::GetBoundingBox() const { EDA_RECT box; @@ -157,27 +161,25 @@ EDA_RECT SCH_BUS_ENTRY::GetBoundingBox() const box.SetEnd( m_End() ); box.Normalize(); - int width = ( m_width == 0 ) ? GetDefaultLineThickness() : m_width; - box.Inflate( width / 2 ); + box.Inflate( GetPenSize() / 2 ); return box; } -int SCH_BUS_ENTRY::GetPenSize() const +int SCH_BUS_WIRE_ENTRY::GetPenSize() const { - int pensize = ( m_width == 0 ) ? GetDefaultLineThickness() : m_width; - - if( m_Layer == LAYER_BUS ) - { - pensize = ( m_width == 0 ) ? GetDefaultBusThickness() : m_width; - } - - return pensize; + return GetDefaultLineThickness(); } -void SCH_BUS_ENTRY::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, +int SCH_BUS_BUS_ENTRY::GetPenSize() const +{ + return GetDefaultBusThickness(); +} + + +void SCH_BUS_ENTRY_BASE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor ) { EDA_COLOR_T color; @@ -194,7 +196,7 @@ void SCH_BUS_ENTRY::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOff } -void SCH_BUS_ENTRY::MirrorX( int aXaxis_position ) +void SCH_BUS_ENTRY_BASE::MirrorX( int aXaxis_position ) { m_pos.y -= aXaxis_position; NEGATE( m_pos.y ); @@ -203,7 +205,7 @@ void SCH_BUS_ENTRY::MirrorX( int aXaxis_position ) } -void SCH_BUS_ENTRY::MirrorY( int aYaxis_position ) +void SCH_BUS_ENTRY_BASE::MirrorY( int aYaxis_position ) { m_pos.x -= aYaxis_position; NEGATE( m_pos.x ); @@ -212,14 +214,14 @@ void SCH_BUS_ENTRY::MirrorY( int aYaxis_position ) } -void SCH_BUS_ENTRY::Rotate( wxPoint aPosition ) +void SCH_BUS_ENTRY_BASE::Rotate( wxPoint aPosition ) { RotatePoint( &m_pos, aPosition, 900 ); RotatePoint( &m_size.x, &m_size.y, 900 ); } -void SCH_BUS_ENTRY::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) +void SCH_BUS_ENTRY_BASE::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) { DANGLING_END_ITEM item( ENTRY_END, this, m_pos ); aItemList.push_back( item ); @@ -229,44 +231,47 @@ void SCH_BUS_ENTRY::GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) } -bool SCH_BUS_ENTRY::IsSelectStateChanged( const wxRect& aRect ) +bool SCH_BUS_ENTRY_BASE::IsSelectStateChanged( const wxRect& aRect ) { bool previousState = IsSelected(); // If either end of the bus entry is inside the selection rectangle, the entire // bus entry is selected. Bus entries have a fixed length and angle. if( aRect.Contains( m_pos ) || aRect.Contains( m_End() ) ) - m_Flags |= SELECTED; + SetFlags( SELECTED ); else - m_Flags &= ~SELECTED; + ClearFlags( SELECTED ); return previousState != IsSelected(); } -void SCH_BUS_ENTRY::GetConnectionPoints( vector< wxPoint >& aPoints ) const +void SCH_BUS_ENTRY_BASE::GetConnectionPoints( vector< wxPoint >& aPoints ) const { aPoints.push_back( m_pos ); aPoints.push_back( m_End() ); } -wxString SCH_BUS_ENTRY::GetSelectMenuText() const +wxString SCH_BUS_WIRE_ENTRY::GetSelectMenuText() const { - if( m_Layer == LAYER_WIRE ) return wxString( _( "Bus to Wire Entry" ) ); +} + +wxString SCH_BUS_BUS_ENTRY::GetSelectMenuText() const +{ return wxString( _( "Bus to Bus Entry" ) ); } -bool SCH_BUS_ENTRY::HitTest( const wxPoint& aPosition, int aAccuracy ) const +bool SCH_BUS_ENTRY_BASE::HitTest( const wxPoint& aPosition, int aAccuracy ) const { return TestSegmentHit( aPosition, m_pos, m_End(), aAccuracy ); } -bool SCH_BUS_ENTRY::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const +bool SCH_BUS_ENTRY_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const { EDA_RECT rect = aRect; @@ -279,7 +284,7 @@ bool SCH_BUS_ENTRY::HitTest( const EDA_RECT& aRect, bool aContained, int aAccura } -void SCH_BUS_ENTRY::Plot( PLOTTER* aPlotter ) +void SCH_BUS_ENTRY_BASE::Plot( PLOTTER* aPlotter ) { aPlotter->SetCurrentLineWidth( GetPenSize() ); aPlotter->SetColor( ReturnLayerColor( GetLayer() ) ); @@ -291,7 +296,7 @@ void SCH_BUS_ENTRY::Plot( PLOTTER* aPlotter ) * Set the shape of the bus entry. * aShape = ascii code '/' or '\' */ -void SCH_BUS_ENTRY::SetBusEntryShape( int aShape ) +void SCH_BUS_ENTRY_BASE::SetBusEntryShape( char aShape ) { switch( aShape ) { @@ -311,12 +316,11 @@ void SCH_BUS_ENTRY::SetBusEntryShape( int aShape ) /* GetBusEntryShape: * return the shape of the bus entry, as an ascii code '/' or '\' */ -int SCH_BUS_ENTRY::GetBusEntryShape() const +char SCH_BUS_ENTRY_BASE::GetBusEntryShape() const { - int shape = '\\'; - if( GetSize().y < 0 ) - shape = '/'; - - return shape; + return '/'; + else + return '\\'; } + diff --git a/eeschema/sch_bus_entry.h b/eeschema/sch_bus_entry.h index 9ad33c8d42..4eb3bd1938 100644 --- a/eeschema/sch_bus_entry.h +++ b/eeschema/sch_bus_entry.h @@ -33,33 +33,23 @@ #include -/* Flags for BUS ENTRY (bus to bus or wire to bus */ -#define WIRE_TO_BUS 0 -#define BUS_TO_BUS 1 - - /** - * Class SCH_BUS_ENTRY + * Class SCH_BUS_ENTRY_BASE * - * Defines a bus or wire entry. + * Base class for a bus or wire entry. */ -class SCH_BUS_ENTRY : public SCH_ITEM +class SCH_BUS_ENTRY_BASE : public SCH_ITEM { +protected: wxPoint m_pos; - int m_width; wxSize m_size; public: - SCH_BUS_ENTRY( const wxPoint& pos = wxPoint( 0, 0 ), int shape = '\\', int id = WIRE_TO_BUS ); + SCH_BUS_ENTRY_BASE( KICAD_T aType, const wxPoint& pos = wxPoint( 0, 0 ), char shape = '\\' ); // Do not create a copy constructor. The one generated by the compiler is adequate. - ~SCH_BUS_ENTRY() { } - - wxString GetClass() const - { - return wxT( "SCH_BUS_ENTRY" ); - } + ~SCH_BUS_ENTRY_BASE() { } wxPoint m_End() const; @@ -67,17 +57,13 @@ public: * function GetBusEntryShape * @return the shape of the bus entry, as an ascii code '/' or '\' */ - int GetBusEntryShape() const; + char GetBusEntryShape() const; /** * function SetBusEntryShape * @param aShape = the shape of the bus entry, as an ascii code '/' or '\' */ - void SetBusEntryShape( int aShape ); - - int GetWidth() const { return m_width; } - - void SetWidth( int aWidth ) { m_width = aWidth; } + void SetBusEntryShape( char aShape ); wxSize GetSize() const { return m_size; } @@ -88,14 +74,10 @@ public: void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR ); - bool Save( FILE* aFile ) const; - - bool Load( LINE_READER& aLine, wxString& aErrorMsg ); + static bool Load( LINE_READER& aLine, wxString& aErrorMsg, SCH_ITEM **out ); EDA_RECT GetBoundingBox() const; - int GetPenSize() const; - void Move( const wxPoint& aMoveVector ) { m_pos += aMoveVector; @@ -116,8 +98,6 @@ public: void GetConnectionPoints( vector< wxPoint >& aPoints ) const; - wxString GetSelectMenuText() const; - BITMAP_DEF GetMenuImage() const { return add_entry_xpm; } wxPoint GetPosition() const { return m_pos; } @@ -130,12 +110,61 @@ public: void Plot( PLOTTER* aPlotter ); - EDA_ITEM* Clone() const; - #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override #endif }; +/** + * Class SCH_BUS_WIRE_ENTRY + * + * Class for a wire to bus entry. + */ +class SCH_BUS_WIRE_ENTRY : public SCH_BUS_ENTRY_BASE +{ +public: + SCH_BUS_WIRE_ENTRY( const wxPoint& pos = wxPoint( 0, 0 ), char shape = '\\' ); + + ~SCH_BUS_WIRE_ENTRY() { } + + wxString GetClass() const + { + return wxT( "SCH_BUS_WIRE_ENTRY" ); + } + + bool Save( FILE* aFile ) const; + + int GetPenSize() const; + + wxString GetSelectMenuText() const; + + EDA_ITEM* Clone() const; +}; + +/** + * Class SCH_BUS_WIRE_ENTRY + * + * Class for a bus to bus entry. + */ +class SCH_BUS_BUS_ENTRY : public SCH_BUS_ENTRY_BASE +{ +public: + SCH_BUS_BUS_ENTRY( const wxPoint& pos = wxPoint( 0, 0 ), char shape = '\\' ); + + ~SCH_BUS_BUS_ENTRY() { } + + wxString GetClass() const + { + return wxT( "SCH_BUS_BUS_ENTRY" ); + } + + bool Save( FILE* aFile ) const; + + int GetPenSize() const; + + wxString GetSelectMenuText() const; + + EDA_ITEM* Clone() const; +}; #endif // _SCH_BUS_ENTRY_H_ diff --git a/eeschema/sch_collectors.cpp b/eeschema/sch_collectors.cpp index 62bc97dbbf..1d672670bf 100644 --- a/eeschema/sch_collectors.cpp +++ b/eeschema/sch_collectors.cpp @@ -33,13 +33,15 @@ #include #include #include +#include const KICAD_T SCH_COLLECTOR::AllItems[] = { SCH_MARKER_T, SCH_JUNCTION_T, SCH_NO_CONNECT_T, - SCH_BUS_ENTRY_T, + SCH_BUS_BUS_ENTRY_T, + SCH_BUS_WIRE_ENTRY_T, SCH_LINE_T, SCH_BITMAP_T, SCH_TEXT_T, @@ -59,7 +61,8 @@ const KICAD_T SCH_COLLECTOR::AllItemsButPins[] = { SCH_MARKER_T, SCH_JUNCTION_T, SCH_NO_CONNECT_T, - SCH_BUS_ENTRY_T, + SCH_BUS_BUS_ENTRY_T, + SCH_BUS_WIRE_ENTRY_T, SCH_LINE_T, SCH_BITMAP_T, SCH_TEXT_T, @@ -107,7 +110,8 @@ const KICAD_T SCH_COLLECTOR::MovableItems[] = { SCH_MARKER_T, SCH_JUNCTION_T, SCH_NO_CONNECT_T, - SCH_BUS_ENTRY_T, + SCH_BUS_BUS_ENTRY_T, + SCH_BUS_WIRE_ENTRY_T, // SCH_LINE_T, SCH_BITMAP_T, SCH_TEXT_T, @@ -124,7 +128,8 @@ const KICAD_T SCH_COLLECTOR::MovableItems[] = { const KICAD_T SCH_COLLECTOR::DraggableItems[] = { SCH_JUNCTION_T, - SCH_BUS_ENTRY_T, + SCH_BUS_BUS_ENTRY_T, + SCH_BUS_WIRE_ENTRY_T, SCH_LINE_T, SCH_LABEL_T, SCH_GLOBAL_LABEL_T, @@ -152,7 +157,8 @@ const KICAD_T SCH_COLLECTOR::ParentItems[] = { SCH_MARKER_T, SCH_JUNCTION_T, SCH_NO_CONNECT_T, - SCH_BUS_ENTRY_T, + SCH_BUS_BUS_ENTRY_T, + SCH_BUS_WIRE_ENTRY_T, SCH_LINE_T, SCH_TEXT_T, SCH_LABEL_T, @@ -241,13 +247,16 @@ bool SCH_COLLECTOR::IsCorner() const if( GetCount() != 2 ) return false; + bool is_busentry0 = dynamic_cast( m_List[0] ); + bool is_busentry1 = dynamic_cast( m_List[1] ); + if( (m_List[0]->Type() == SCH_LINE_T) && (m_List[1]->Type() == SCH_LINE_T) ) return true; - if( (m_List[0]->Type() == SCH_LINE_T) && (m_List[1]->Type() == SCH_BUS_ENTRY_T) ) + if( (m_List[0]->Type() == SCH_LINE_T) && is_busentry1 ) return true; - if( (m_List[0]->Type() == SCH_BUS_ENTRY_T) && (m_List[1]->Type() == SCH_LINE_T) ) + if( is_busentry0 && (m_List[1]->Type() == SCH_LINE_T) ) return true; return false; diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index fae91ce1bb..2617401a5d 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -394,7 +394,10 @@ bool SCH_SCREEN::IsTerminalPoint( const wxPoint& aPosition, int aLayer ) break; case LAYER_WIRE: - if( GetItem( aPosition, std::max( GetDefaultLineThickness(), 3 ), SCH_BUS_ENTRY_T ) ) + if( GetItem( aPosition, std::max( GetDefaultLineThickness(), 3 ), SCH_BUS_WIRE_ENTRY_T) ) + return true; + + if( GetItem( aPosition, std::max( GetDefaultLineThickness(), 3 ), SCH_BUS_BUS_ENTRY_T) ) return true; if( GetItem( aPosition, std::max( GetDefaultLineThickness(), 3 ), SCH_JUNCTION_T ) ) @@ -958,13 +961,15 @@ bool SCH_SCREEN::BreakSegmentsOnJunctions() if( BreakSegment( junction->GetPosition() ) ) brokenSegments = true; } - else if( item->Type() == SCH_BUS_ENTRY_T ) + else + { + SCH_BUS_ENTRY_BASE* busEntry = dynamic_cast( item ); + if( busEntry ) { - SCH_BUS_ENTRY* busEntry = ( SCH_BUS_ENTRY* ) item; - if( BreakSegment( busEntry->GetPosition() ) || BreakSegment( busEntry->m_End() ) ) brokenSegments = true; + } } } diff --git a/eeschema/schedit.cpp b/eeschema/schedit.cpp index a2f4f9c6d4..605c28cbfc 100644 --- a/eeschema/schedit.cpp +++ b/eeschema/schedit.cpp @@ -137,12 +137,12 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_POPUP_SCH_ENTRY_SELECT_SLASH: m_canvas->MoveCursorToCrossHair(); - SetBusEntryShape( &dc, (SCH_BUS_ENTRY*) item, '/' ); + SetBusEntryShape( &dc, dynamic_cast( item ), '/' ); break; case ID_POPUP_SCH_ENTRY_SELECT_ANTISLASH: m_canvas->MoveCursorToCrossHair(); - SetBusEntryShape( &dc, (SCH_BUS_ENTRY*) item, '\\' ); + SetBusEntryShape( &dc, dynamic_cast( item ), '\\' ); break; case ID_POPUP_CANCEL_CURRENT_COMMAND: @@ -417,7 +417,8 @@ void SCH_EDIT_FRAME::OnMoveItem( wxCommandEvent& aEvent ) case SCH_JUNCTION_T: case SCH_NO_CONNECT_T: - case SCH_BUS_ENTRY_T: + case SCH_BUS_BUS_ENTRY_T: + case SCH_BUS_WIRE_ENTRY_T: case SCH_LABEL_T: case SCH_GLOBAL_LABEL_T: case SCH_HIERARCHICAL_LABEL_T: @@ -939,7 +940,8 @@ void SCH_EDIT_FRAME::OnDragItem( wxCommandEvent& aEvent ) switch( item->Type() ) { - case SCH_BUS_ENTRY_T: + case SCH_BUS_BUS_ENTRY_T: + case SCH_BUS_WIRE_ENTRY_T: case SCH_LINE_T: case SCH_JUNCTION_T: if( item->GetLayer() == LAYER_BUS ) diff --git a/include/base_struct.h b/include/base_struct.h index 0c0db083d5..40eb7fcaff 100644 --- a/include/base_struct.h +++ b/include/base_struct.h @@ -82,7 +82,8 @@ enum KICAD_T { SCH_MARKER_T, SCH_JUNCTION_T, SCH_NO_CONNECT_T, - SCH_BUS_ENTRY_T, + SCH_BUS_WIRE_ENTRY_T, + SCH_BUS_BUS_ENTRY_T, SCH_LINE_T, SCH_BITMAP_T, SCH_TEXT_T, diff --git a/include/wxEeschemaStruct.h b/include/wxEeschemaStruct.h index 921dd26ec0..728cc3795f 100644 --- a/include/wxEeschemaStruct.h +++ b/include/wxEeschemaStruct.h @@ -48,7 +48,9 @@ class CMP_LIBRARY; class LIB_COMPONENT; class LIB_DRAW_ITEM; class EDA_ITEM; -class SCH_BUS_ENTRY; +class SCH_BUS_ENTRY_BASE; +class SCH_BUS_WIRE_ENTRY; +class SCH_BUS_BUS_ENTRY; class SCH_GLOBALLABEL; class SCH_TEXT; class SCH_BITMAP; @@ -811,8 +813,9 @@ private: void UpdateTitle(); // Bus Entry - SCH_BUS_ENTRY* CreateBusEntry( wxDC* DC, int entry_type ); - void SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY* BusEntry, int entry_type ); + SCH_BUS_WIRE_ENTRY* CreateBusWireEntry( wxDC* DC ); + SCH_BUS_BUS_ENTRY* CreateBusBusEntry( wxDC* DC ); + void SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY_BASE* BusEntry, char entry_shape ); /** * Function AddNoConnect From 92e0eb628c7d5fc9739c8ba9019ed62a1d68ffab Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 1 Apr 2013 12:50:01 +0200 Subject: [PATCH 35/63] Minor changes in dialogs to ensure a better likeness between dialogs on Linux and Windows (mainly, remove some wxStaticBoxSizer in dialogs) --- ...dialog_edit_component_in_schematic_fbp.cpp | 578 +- ...dialog_edit_component_in_schematic_fbp.fbp | 5703 +++++++++-------- .../dialog_edit_component_in_schematic_fbp.h | 183 +- .../dialog_edit_libentry_fields_in_lib.cpp | 47 +- ...ialog_edit_libentry_fields_in_lib_base.cpp | 435 +- ...ialog_edit_libentry_fields_in_lib_base.fbp | 1271 ++-- .../dialog_edit_libentry_fields_in_lib_base.h | 167 +- polygon/clipper.cpp | 928 +-- polygon/clipper.hpp | 89 +- 9 files changed, 5102 insertions(+), 4299 deletions(-) diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp index b4dc2af1d7..64340c9450 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.cpp @@ -1,280 +1,298 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 30 2011) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#include "dialog_edit_component_in_schematic_fbp.h" - -/////////////////////////////////////////////////////////////////////////// - -DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) -{ - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* mainSizer; - mainSizer = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* upperSizer; - upperSizer = new wxBoxSizer( wxHORIZONTAL ); - - wxStaticBoxSizer* optionsSizer; - optionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options") ), wxVERTICAL ); - - wxStaticBoxSizer* unitSizer; - unitSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Unit") ), wxVERTICAL ); - - wxString unitChoiceChoices[] = { _("1"), _("2"), _("3"), _("4"), _("5"), _("6"), _("7"), _("8"), _("9"), _("10"), _("11"), _("12"), _("13"), _("14"), _("15"), _("16"), _("17"), _("18"), _("19"), _("20"), _("21"), _("22"), _("23"), _("24"), _("25"), _("26") }; - int unitChoiceNChoices = sizeof( unitChoiceChoices ) / sizeof( wxString ); - unitChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, unitChoiceNChoices, unitChoiceChoices, 0 ); - unitChoice->SetSelection( 0 ); - unitSizer->Add( unitChoice, 0, wxALL|wxEXPAND, 5 ); - - optionsSizer->Add( unitSizer, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 8 ); - - wxBoxSizer* orientationSizer; - orientationSizer = new wxBoxSizer( wxHORIZONTAL ); - - wxString orientationRadioBoxChoices[] = { _("0"), _("+90"), _("180"), _("-90") }; - int orientationRadioBoxNChoices = sizeof( orientationRadioBoxChoices ) / sizeof( wxString ); - orientationRadioBox = new wxRadioBox( this, wxID_ANY, _("Orientation (Degrees)"), wxDefaultPosition, wxDefaultSize, orientationRadioBoxNChoices, orientationRadioBoxChoices, 1, wxRA_SPECIFY_COLS ); - orientationRadioBox->SetSelection( 0 ); - orientationRadioBox->SetToolTip( _("Select if the component is to be rotated when drawn") ); - - orientationSizer->Add( orientationRadioBox, 1, wxALL|wxEXPAND, 8 ); - - optionsSizer->Add( orientationSizer, 0, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 0 ); - - wxBoxSizer* mirrorSizer; - mirrorSizer = new wxBoxSizer( wxHORIZONTAL ); - - wxString mirrorRadioBoxChoices[] = { _("Normal"), _("Mirror ---"), _("Mirror |") }; - int mirrorRadioBoxNChoices = sizeof( mirrorRadioBoxChoices ) / sizeof( wxString ); - mirrorRadioBox = new wxRadioBox( this, wxID_ANY, _("Mirror"), wxDefaultPosition, wxDefaultSize, mirrorRadioBoxNChoices, mirrorRadioBoxChoices, 1, wxRA_SPECIFY_COLS ); - mirrorRadioBox->SetSelection( 0 ); - mirrorRadioBox->SetToolTip( _("Pick the graphical transformation to be used when displaying the component, if any") ); - - mirrorSizer->Add( mirrorRadioBox, 1, wxALL, 8 ); - - optionsSizer->Add( mirrorSizer, 0, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 0 ); - - wxStaticBoxSizer* chipnameSizer; - chipnameSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Chip Name") ), wxHORIZONTAL ); - - chipnameTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - chipnameTextCtrl->SetMaxLength( 32 ); - chipnameTextCtrl->SetToolTip( _("The name of the symbol in the library from which this component came") ); - - chipnameSizer->Add( chipnameTextCtrl, 1, wxALL|wxEXPAND, 5 ); - - optionsSizer->Add( chipnameSizer, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 8 ); - - convertCheckBox = new wxCheckBox( this, wxID_ANY, _("Convert"), wxDefaultPosition, wxDefaultSize, 0 ); - convertCheckBox->SetToolTip( _("Use the alternate shape of this component.\nFor gates, this is the \"De Morgan\" conversion") ); - - optionsSizer->Add( convertCheckBox, 0, wxALL, 8 ); - - partsAreLockedLabel = new wxStaticText( this, wxID_ANY, _("Parts are locked"), wxDefaultPosition, wxDefaultSize, 0 ); - partsAreLockedLabel->Wrap( -1 ); - optionsSizer->Add( partsAreLockedLabel, 0, wxALL|wxEXPAND, 8 ); - - defaultsButton = new wxButton( this, wxID_ANY, _("Reset to Library Defaults"), wxDefaultPosition, wxDefaultSize, 0 ); - defaultsButton->SetToolTip( _("Set position and style of fields and component orientation to default lib value.\nFields texts are not modified.") ); - - optionsSizer->Add( defaultsButton, 0, wxALL|wxEXPAND, 5 ); - - upperSizer->Add( optionsSizer, 0, wxALIGN_TOP|wxALL|wxEXPAND, 5 ); - - wxStaticBoxSizer* fieldsSizer; - fieldsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Fields") ), wxHORIZONTAL ); - - wxStaticBoxSizer* gridStaticBoxSizer; - gridStaticBoxSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL ); - - fieldListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES ); - fieldListCtrl->SetMinSize( wxSize( 220,-1 ) ); - - gridStaticBoxSizer->Add( fieldListCtrl, 1, wxALL|wxEXPAND, 8 ); - - addFieldButton = new wxButton( this, wxID_ANY, _("Add Field"), wxDefaultPosition, wxDefaultSize, 0 ); - addFieldButton->SetToolTip( _("Add a new custom field") ); - - gridStaticBoxSizer->Add( addFieldButton, 0, wxALL|wxEXPAND, 5 ); - - deleteFieldButton = new wxButton( this, wxID_ANY, _("Delete Field"), wxDefaultPosition, wxDefaultSize, 0 ); - deleteFieldButton->SetToolTip( _("Delete one of the optional fields") ); - - gridStaticBoxSizer->Add( deleteFieldButton, 0, wxALL|wxEXPAND, 5 ); - - moveUpButton = new wxButton( this, wxID_ANY, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 ); - moveUpButton->SetToolTip( _("Move the selected optional fields up one position") ); - - gridStaticBoxSizer->Add( moveUpButton, 0, wxALL|wxEXPAND, 5 ); - - fieldsSizer->Add( gridStaticBoxSizer, 3, wxEXPAND|wxRIGHT|wxLEFT, 8 ); - - wxBoxSizer* fieldEditBoxSizer; - fieldEditBoxSizer = new wxBoxSizer( wxVERTICAL ); - - wxStaticBoxSizer* sbSizerOptions; - sbSizerOptions = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Text Justification:") ), wxHORIZONTAL ); - - wxString m_FieldHJustifyCtrlChoices[] = { _("Left"), _("Center"), _("Right") }; - int m_FieldHJustifyCtrlNChoices = sizeof( m_FieldHJustifyCtrlChoices ) / sizeof( wxString ); - m_FieldHJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Horiz. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldHJustifyCtrlNChoices, m_FieldHJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS ); - m_FieldHJustifyCtrl->SetSelection( 0 ); - sbSizerOptions->Add( m_FieldHJustifyCtrl, 1, wxRIGHT|wxLEFT, 5 ); - - wxString m_FieldVJustifyCtrlChoices[] = { _("Bottom"), _("Center"), _("Top") }; - int m_FieldVJustifyCtrlNChoices = sizeof( m_FieldVJustifyCtrlChoices ) / sizeof( wxString ); - m_FieldVJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Vert. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldVJustifyCtrlNChoices, m_FieldVJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS ); - m_FieldVJustifyCtrl->SetSelection( 2 ); - sbSizerOptions->Add( m_FieldVJustifyCtrl, 1, wxRIGHT|wxLEFT, 5 ); - - fieldEditBoxSizer->Add( sbSizerOptions, 0, wxEXPAND, 5 ); - - wxStaticBoxSizer* visibilitySizer; - visibilitySizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Visibility") ), wxHORIZONTAL ); - - wxBoxSizer* bShowRotateSizer; - bShowRotateSizer = new wxBoxSizer( wxVERTICAL ); - - showCheckBox = new wxCheckBox( this, wxID_ANY, _("Show"), wxDefaultPosition, wxDefaultSize, 0 ); - showCheckBox->SetToolTip( _("Check if you want this field visible") ); - - bShowRotateSizer->Add( showCheckBox, 0, wxALL, 5 ); - - rotateCheckBox = new wxCheckBox( this, wxID_ANY, _("Rotate"), wxDefaultPosition, wxDefaultSize, 0 ); - rotateCheckBox->SetToolTip( _("Check if you want this field's text rotated 90 degrees") ); - - bShowRotateSizer->Add( rotateCheckBox, 0, wxALL, 5 ); - - visibilitySizer->Add( bShowRotateSizer, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - wxString m_StyleRadioBoxChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") }; - int m_StyleRadioBoxNChoices = sizeof( m_StyleRadioBoxChoices ) / sizeof( wxString ); - m_StyleRadioBox = new wxRadioBox( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, m_StyleRadioBoxNChoices, m_StyleRadioBoxChoices, 1, wxRA_SPECIFY_COLS ); - m_StyleRadioBox->SetSelection( 3 ); - m_StyleRadioBox->SetToolTip( _("The style of the currently selected field's text in the schemati") ); - - visibilitySizer->Add( m_StyleRadioBox, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - fieldEditBoxSizer->Add( visibilitySizer, 0, wxEXPAND|wxTOP, 5 ); - - wxBoxSizer* fieldNameBoxSizer; - fieldNameBoxSizer = new wxBoxSizer( wxVERTICAL ); - - fieldNameLabel = new wxStaticText( this, wxID_ANY, _("Field Name"), wxDefaultPosition, wxDefaultSize, 0 ); - fieldNameLabel->Wrap( -1 ); - fieldNameBoxSizer->Add( fieldNameLabel, 0, 0, 5 ); - - fieldNameTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fieldNameTextCtrl->SetToolTip( _("The name of the currently selected field\nSome fixed fields names are not editable") ); - - fieldNameBoxSizer->Add( fieldNameTextCtrl, 0, wxEXPAND, 5 ); - - fieldEditBoxSizer->Add( fieldNameBoxSizer, 0, wxALL|wxEXPAND, 5 ); - - wxBoxSizer* fieldTextBoxSizer; - fieldTextBoxSizer = new wxBoxSizer( wxVERTICAL ); - - fieldValueLabel = new wxStaticText( this, wxID_ANY, _("Field Value"), wxDefaultPosition, wxDefaultSize, 0 ); - fieldValueLabel->Wrap( -1 ); - fieldTextBoxSizer->Add( fieldValueLabel, 0, 0, 5 ); - - fieldValueTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fieldValueTextCtrl->SetToolTip( _("The text (or value) of the currently selected field") ); - - fieldTextBoxSizer->Add( fieldValueTextCtrl, 0, wxEXPAND, 5 ); - - fieldEditBoxSizer->Add( fieldTextBoxSizer, 0, wxALL|wxEXPAND, 5 ); - - wxBoxSizer* textSizeBoxSizer; - textSizeBoxSizer = new wxBoxSizer( wxVERTICAL ); - - textSizeLabel = new wxStaticText( this, wxID_ANY, _("Size(\")"), wxDefaultPosition, wxDefaultSize, 0 ); - textSizeLabel->Wrap( -1 ); - textSizeBoxSizer->Add( textSizeLabel, 0, 0, 5 ); - - textSizeTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - textSizeTextCtrl->SetToolTip( _("The size of the currently selected field's text in the schematic") ); - - textSizeBoxSizer->Add( textSizeTextCtrl, 0, wxEXPAND, 5 ); - - fieldEditBoxSizer->Add( textSizeBoxSizer, 0, wxALL|wxEXPAND, 5 ); - - wxBoxSizer* positionBoxSizer; - positionBoxSizer = new wxBoxSizer( wxHORIZONTAL ); - - wxBoxSizer* posXBoxSizer; - posXBoxSizer = new wxBoxSizer( wxVERTICAL ); - - posXLabel = new wxStaticText( this, wxID_ANY, _("PosX(\")"), wxDefaultPosition, wxDefaultSize, 0 ); - posXLabel->Wrap( -1 ); - posXBoxSizer->Add( posXLabel, 0, 0, 5 ); - - posXTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - posXTextCtrl->SetToolTip( _("The X coordinate of the text relative to the component") ); - - posXBoxSizer->Add( posXTextCtrl, 0, wxEXPAND, 5 ); - - positionBoxSizer->Add( posXBoxSizer, 1, wxALL|wxEXPAND, 5 ); - - wxBoxSizer* posYBoxSizer; - posYBoxSizer = new wxBoxSizer( wxVERTICAL ); - - posYLabel = new wxStaticText( this, wxID_ANY, _("PosY(\")"), wxDefaultPosition, wxDefaultSize, 0 ); - posYLabel->Wrap( -1 ); - posYBoxSizer->Add( posYLabel, 0, 0, 5 ); - - posYTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - posYTextCtrl->SetToolTip( _("The Y coordinate of the text relative to the component") ); - - posYBoxSizer->Add( posYTextCtrl, 0, wxEXPAND, 5 ); - - positionBoxSizer->Add( posYBoxSizer, 1, wxALL|wxEXPAND, 5 ); - - fieldEditBoxSizer->Add( positionBoxSizer, 0, wxEXPAND, 5 ); - - fieldsSizer->Add( fieldEditBoxSizer, 2, wxEXPAND, 5 ); - - upperSizer->Add( fieldsSizer, 1, wxALL|wxEXPAND, 5 ); - - mainSizer->Add( upperSizer, 1, wxEXPAND, 5 ); - - stdDialogButtonSizer = new wxStdDialogButtonSizer(); - stdDialogButtonSizerOK = new wxButton( this, wxID_OK ); - stdDialogButtonSizer->AddButton( stdDialogButtonSizerOK ); - stdDialogButtonSizerCancel = new wxButton( this, wxID_CANCEL ); - stdDialogButtonSizer->AddButton( stdDialogButtonSizerCancel ); - stdDialogButtonSizer->Realize(); - mainSizer->Add( stdDialogButtonSizer, 0, wxALL|wxEXPAND, 8 ); - - this->SetSizer( mainSizer ); - this->Layout(); - - // Connect Events - defaultsButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::SetInitCmp ), NULL, this ); - fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemDeselected ), NULL, this ); - fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemSelected ), NULL, this ); - addFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::addFieldButtonHandler ), NULL, this ); - deleteFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::deleteFieldButtonHandler ), NULL, this ); - moveUpButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::moveUpButtonHandler ), NULL, this ); - stdDialogButtonSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnCancelButtonClick ), NULL, this ); - stdDialogButtonSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnOKButtonClick ), NULL, this ); -} - -DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP() -{ - // Disconnect Events - defaultsButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::SetInitCmp ), NULL, this ); - fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemDeselected ), NULL, this ); - fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemSelected ), NULL, this ); - addFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::addFieldButtonHandler ), NULL, this ); - deleteFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::deleteFieldButtonHandler ), NULL, this ); - moveUpButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::moveUpButtonHandler ), NULL, this ); - stdDialogButtonSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnCancelButtonClick ), NULL, this ); - stdDialogButtonSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnOKButtonClick ), NULL, this ); - -} +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Oct 8 2012) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_edit_component_in_schematic_fbp.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* mainSizer; + mainSizer = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* upperSizer; + upperSizer = new wxBoxSizer( wxHORIZONTAL ); + + wxStaticBoxSizer* optionsSizer; + optionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Component") ), wxVERTICAL ); + + m_staticTextUnit = new wxStaticText( this, wxID_ANY, _("Unit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextUnit->Wrap( -1 ); + optionsSizer->Add( m_staticTextUnit, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + wxString unitChoiceChoices[] = { _("1"), _("2"), _("3"), _("4"), _("5"), _("6"), _("7"), _("8"), _("9"), _("10"), _("11"), _("12"), _("13"), _("14"), _("15"), _("16"), _("17"), _("18"), _("19"), _("20"), _("21"), _("22"), _("23"), _("24"), _("25"), _("26") }; + int unitChoiceNChoices = sizeof( unitChoiceChoices ) / sizeof( wxString ); + unitChoice = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, unitChoiceNChoices, unitChoiceChoices, 0 ); + unitChoice->SetSelection( 0 ); + optionsSizer->Add( unitChoice, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + wxBoxSizer* orientationSizer; + orientationSizer = new wxBoxSizer( wxHORIZONTAL ); + + wxString orientationRadioBoxChoices[] = { _("0"), _("+90"), _("180"), _("-90") }; + int orientationRadioBoxNChoices = sizeof( orientationRadioBoxChoices ) / sizeof( wxString ); + orientationRadioBox = new wxRadioBox( this, wxID_ANY, _("Orientation (Degrees)"), wxDefaultPosition, wxDefaultSize, orientationRadioBoxNChoices, orientationRadioBoxChoices, 1, wxRA_SPECIFY_COLS ); + orientationRadioBox->SetSelection( 0 ); + orientationRadioBox->SetToolTip( _("Select if the component is to be rotated when drawn") ); + + orientationSizer->Add( orientationRadioBox, 1, wxALL|wxEXPAND, 8 ); + + + optionsSizer->Add( orientationSizer, 0, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 0 ); + + wxBoxSizer* mirrorSizer; + mirrorSizer = new wxBoxSizer( wxHORIZONTAL ); + + wxString mirrorRadioBoxChoices[] = { _("Normal"), _("Mirror ---"), _("Mirror |") }; + int mirrorRadioBoxNChoices = sizeof( mirrorRadioBoxChoices ) / sizeof( wxString ); + mirrorRadioBox = new wxRadioBox( this, wxID_ANY, _("Mirror"), wxDefaultPosition, wxDefaultSize, mirrorRadioBoxNChoices, mirrorRadioBoxChoices, 1, wxRA_SPECIFY_COLS ); + mirrorRadioBox->SetSelection( 0 ); + mirrorRadioBox->SetToolTip( _("Pick the graphical transformation to be used when displaying the component, if any") ); + + mirrorSizer->Add( mirrorRadioBox, 1, wxALL, 8 ); + + + optionsSizer->Add( mirrorSizer, 0, wxLEFT|wxRIGHT|wxTOP|wxEXPAND, 0 ); + + m_staticTextChipname = new wxStaticText( this, wxID_ANY, _("Chip Name"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextChipname->Wrap( -1 ); + optionsSizer->Add( m_staticTextChipname, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + chipnameTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + chipnameTextCtrl->SetMaxLength( 32 ); + chipnameTextCtrl->SetToolTip( _("The name of the symbol in the library from which this component came") ); + + optionsSizer->Add( chipnameTextCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + convertCheckBox = new wxCheckBox( this, wxID_ANY, _("Convert"), wxDefaultPosition, wxDefaultSize, 0 ); + convertCheckBox->SetToolTip( _("Use the alternate shape of this component.\nFor gates, this is the \"De Morgan\" conversion") ); + + optionsSizer->Add( convertCheckBox, 0, wxALL, 8 ); + + partsAreLockedLabel = new wxStaticText( this, wxID_ANY, _("Parts are locked"), wxDefaultPosition, wxDefaultSize, 0 ); + partsAreLockedLabel->Wrap( -1 ); + optionsSizer->Add( partsAreLockedLabel, 0, wxALL|wxEXPAND, 8 ); + + defaultsButton = new wxButton( this, wxID_ANY, _("Reset to Library Defaults"), wxDefaultPosition, wxDefaultSize, 0 ); + defaultsButton->SetToolTip( _("Set position and style of fields and component orientation to default lib value.\nFields texts are not modified.") ); + + optionsSizer->Add( defaultsButton, 0, wxALL|wxEXPAND, 5 ); + + + upperSizer->Add( optionsSizer, 0, wxALIGN_TOP|wxALL|wxEXPAND, 5 ); + + wxStaticBoxSizer* fieldsSizer; + fieldsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Fields") ), wxHORIZONTAL ); + + wxStaticBoxSizer* gridStaticBoxSizer; + gridStaticBoxSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL ); + + fieldListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES ); + fieldListCtrl->SetMinSize( wxSize( 220,-1 ) ); + + gridStaticBoxSizer->Add( fieldListCtrl, 1, wxALL|wxEXPAND, 8 ); + + addFieldButton = new wxButton( this, wxID_ANY, _("Add Field"), wxDefaultPosition, wxDefaultSize, 0 ); + addFieldButton->SetToolTip( _("Add a new custom field") ); + + gridStaticBoxSizer->Add( addFieldButton, 0, wxALL|wxEXPAND, 5 ); + + deleteFieldButton = new wxButton( this, wxID_ANY, _("Delete Field"), wxDefaultPosition, wxDefaultSize, 0 ); + deleteFieldButton->SetToolTip( _("Delete one of the optional fields") ); + + gridStaticBoxSizer->Add( deleteFieldButton, 0, wxALL|wxEXPAND, 5 ); + + moveUpButton = new wxButton( this, wxID_ANY, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 ); + moveUpButton->SetToolTip( _("Move the selected optional fields up one position") ); + + gridStaticBoxSizer->Add( moveUpButton, 0, wxALL|wxEXPAND, 5 ); + + + fieldsSizer->Add( gridStaticBoxSizer, 3, wxEXPAND|wxRIGHT|wxLEFT, 8 ); + + wxBoxSizer* fieldEditBoxSizer; + fieldEditBoxSizer = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizerJustification; + bSizerJustification = new wxBoxSizer( wxHORIZONTAL ); + + wxString m_FieldHJustifyCtrlChoices[] = { _("Left"), _("Center"), _("Right") }; + int m_FieldHJustifyCtrlNChoices = sizeof( m_FieldHJustifyCtrlChoices ) / sizeof( wxString ); + m_FieldHJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Horiz. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldHJustifyCtrlNChoices, m_FieldHJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS ); + m_FieldHJustifyCtrl->SetSelection( 0 ); + bSizerJustification->Add( m_FieldHJustifyCtrl, 1, wxRIGHT|wxLEFT, 5 ); + + wxString m_FieldVJustifyCtrlChoices[] = { _("Bottom"), _("Center"), _("Top") }; + int m_FieldVJustifyCtrlNChoices = sizeof( m_FieldVJustifyCtrlChoices ) / sizeof( wxString ); + m_FieldVJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Vert. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldVJustifyCtrlNChoices, m_FieldVJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS ); + m_FieldVJustifyCtrl->SetSelection( 2 ); + bSizerJustification->Add( m_FieldVJustifyCtrl, 1, wxRIGHT|wxLEFT, 5 ); + + + fieldEditBoxSizer->Add( bSizerJustification, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizerStyle; + bSizerStyle = new wxBoxSizer( wxHORIZONTAL ); + + wxStaticBoxSizer* visibilitySizer; + visibilitySizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Visibility") ), wxVERTICAL ); + + showCheckBox = new wxCheckBox( this, wxID_ANY, _("Show"), wxDefaultPosition, wxDefaultSize, 0 ); + showCheckBox->SetToolTip( _("Check if you want this field visible") ); + + visibilitySizer->Add( showCheckBox, 0, wxALL, 5 ); + + rotateCheckBox = new wxCheckBox( this, wxID_ANY, _("Rotate"), wxDefaultPosition, wxDefaultSize, 0 ); + rotateCheckBox->SetToolTip( _("Check if you want this field's text rotated 90 degrees") ); + + visibilitySizer->Add( rotateCheckBox, 0, wxALL, 5 ); + + + bSizerStyle->Add( visibilitySizer, 1, wxEXPAND|wxALL, 5 ); + + wxString m_StyleRadioBoxChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") }; + int m_StyleRadioBoxNChoices = sizeof( m_StyleRadioBoxChoices ) / sizeof( wxString ); + m_StyleRadioBox = new wxRadioBox( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, m_StyleRadioBoxNChoices, m_StyleRadioBoxChoices, 1, wxRA_SPECIFY_COLS ); + m_StyleRadioBox->SetSelection( 3 ); + m_StyleRadioBox->SetToolTip( _("The style of the currently selected field's text in the schemati") ); + + bSizerStyle->Add( m_StyleRadioBox, 1, wxEXPAND|wxALL, 5 ); + + + fieldEditBoxSizer->Add( bSizerStyle, 1, wxEXPAND, 5 ); + + wxBoxSizer* fieldNameBoxSizer; + fieldNameBoxSizer = new wxBoxSizer( wxVERTICAL ); + + fieldNameLabel = new wxStaticText( this, wxID_ANY, _("Field Name"), wxDefaultPosition, wxDefaultSize, 0 ); + fieldNameLabel->Wrap( -1 ); + fieldNameBoxSizer->Add( fieldNameLabel, 0, wxTOP, 5 ); + + fieldNameTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fieldNameTextCtrl->SetMaxLength( 0 ); + fieldNameTextCtrl->SetToolTip( _("The name of the currently selected field\nSome fixed fields names are not editable") ); + + fieldNameBoxSizer->Add( fieldNameTextCtrl, 0, wxEXPAND, 5 ); + + + fieldEditBoxSizer->Add( fieldNameBoxSizer, 0, wxEXPAND, 5 ); + + wxBoxSizer* fieldTextBoxSizer; + fieldTextBoxSizer = new wxBoxSizer( wxVERTICAL ); + + fieldValueLabel = new wxStaticText( this, wxID_ANY, _("Field Value"), wxDefaultPosition, wxDefaultSize, 0 ); + fieldValueLabel->Wrap( -1 ); + fieldTextBoxSizer->Add( fieldValueLabel, 0, wxTOP, 5 ); + + fieldValueTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fieldValueTextCtrl->SetMaxLength( 0 ); + fieldValueTextCtrl->SetToolTip( _("The text (or value) of the currently selected field") ); + + fieldTextBoxSizer->Add( fieldValueTextCtrl, 0, wxEXPAND, 5 ); + + + fieldEditBoxSizer->Add( fieldTextBoxSizer, 0, wxEXPAND, 5 ); + + wxFlexGridSizer* fgSizerPosSize; + fgSizerPosSize = new wxFlexGridSizer( 3, 3, 0, 0 ); + fgSizerPosSize->AddGrowableCol( 1 ); + fgSizerPosSize->SetFlexibleDirection( wxBOTH ); + fgSizerPosSize->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + textSizeLabel = new wxStaticText( this, wxID_ANY, _("Size"), wxDefaultPosition, wxDefaultSize, 0 ); + textSizeLabel->Wrap( -1 ); + fgSizerPosSize->Add( textSizeLabel, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + textSizeTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + textSizeTextCtrl->SetMaxLength( 0 ); + textSizeTextCtrl->SetToolTip( _("The size of the currently selected field's text in the schematic") ); + + fgSizerPosSize->Add( textSizeTextCtrl, 0, wxEXPAND|wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticTextUnitSize = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextUnitSize->Wrap( -1 ); + fgSizerPosSize->Add( m_staticTextUnitSize, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + posXLabel = new wxStaticText( this, wxID_ANY, _("PosX"), wxDefaultPosition, wxDefaultSize, 0 ); + posXLabel->Wrap( -1 ); + fgSizerPosSize->Add( posXLabel, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + posXTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + posXTextCtrl->SetMaxLength( 0 ); + posXTextCtrl->SetToolTip( _("The X coordinate of the text relative to the component") ); + + fgSizerPosSize->Add( posXTextCtrl, 0, wxEXPAND|wxTOP|wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticTextUnitPosX = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextUnitPosX->Wrap( -1 ); + fgSizerPosSize->Add( m_staticTextUnitPosX, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + posYLabel = new wxStaticText( this, wxID_ANY, _("PosY"), wxDefaultPosition, wxDefaultSize, 0 ); + posYLabel->Wrap( -1 ); + fgSizerPosSize->Add( posYLabel, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + posYTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + posYTextCtrl->SetMaxLength( 0 ); + posYTextCtrl->SetToolTip( _("The Y coordinate of the text relative to the component") ); + + fgSizerPosSize->Add( posYTextCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticTextUnitPosY = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextUnitPosY->Wrap( -1 ); + fgSizerPosSize->Add( m_staticTextUnitPosY, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + + fieldEditBoxSizer->Add( fgSizerPosSize, 1, wxEXPAND|wxTOP, 5 ); + + + fieldsSizer->Add( fieldEditBoxSizer, 2, wxEXPAND, 5 ); + + + upperSizer->Add( fieldsSizer, 1, wxALL|wxEXPAND, 5 ); + + + mainSizer->Add( upperSizer, 1, wxEXPAND, 5 ); + + stdDialogButtonSizer = new wxStdDialogButtonSizer(); + stdDialogButtonSizerOK = new wxButton( this, wxID_OK ); + stdDialogButtonSizer->AddButton( stdDialogButtonSizerOK ); + stdDialogButtonSizerCancel = new wxButton( this, wxID_CANCEL ); + stdDialogButtonSizer->AddButton( stdDialogButtonSizerCancel ); + stdDialogButtonSizer->Realize(); + + mainSizer->Add( stdDialogButtonSizer, 0, wxALL|wxEXPAND, 8 ); + + + this->SetSizer( mainSizer ); + this->Layout(); + + // Connect Events + defaultsButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::SetInitCmp ), NULL, this ); + fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemDeselected ), NULL, this ); + fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemSelected ), NULL, this ); + addFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::addFieldButtonHandler ), NULL, this ); + deleteFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::deleteFieldButtonHandler ), NULL, this ); + moveUpButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::moveUpButtonHandler ), NULL, this ); + stdDialogButtonSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnCancelButtonClick ), NULL, this ); + stdDialogButtonSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnOKButtonClick ), NULL, this ); +} + +DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP() +{ + // Disconnect Events + defaultsButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::SetInitCmp ), NULL, this ); + fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemDeselected ), NULL, this ); + fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnListItemSelected ), NULL, this ); + addFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::addFieldButtonHandler ), NULL, this ); + deleteFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::deleteFieldButtonHandler ), NULL, this ); + moveUpButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::moveUpButtonHandler ), NULL, this ); + stdDialogButtonSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnCancelButtonClick ), NULL, this ); + stdDialogButtonSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::OnOKButtonClick ), NULL, this ); + +} diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp index 3a99632ae6..17467f4e39 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp @@ -1,2700 +1,3003 @@ - - - - - ; - C++ - 1 - source_name - 0 - res - ANSI - connect - dialog_edit_component_in_schematic_fbp - 1000 - none - 1 - - - . - - 1 - 1 - 0 - 0 - - 1 - 1 - 1 - 1 - 0 - - - - - 1 - - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - impl_virtual - - - 1 - - 0 - 0 - wxID_ANY - - - 0 - - - 0 - - 1 - DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP - 1 - - - 1 - - - Resizable - - 1 - 700,521 - wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU - - Component Properties - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - mainSizer - wxVERTICAL - none - - 5 - wxEXPAND - 1 - - - upperSizer - wxHORIZONTAL - none - - 5 - wxALIGN_TOP|wxALL|wxEXPAND - 0 - - wxID_ANY - Options - - optionsSizer - wxVERTICAL - none - - - 8 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 0 - - wxID_ANY - Unit - - unitSizer - wxVERTICAL - none - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - - 0 - - - 0 - - 1 - unitChoice - 1 - - - protected - 1 - - - Resizable - - 0 - 1 - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - wxLEFT|wxRIGHT|wxTOP|wxEXPAND - 0 - - - orientationSizer - wxHORIZONTAL - none - - 8 - wxALL|wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - "0" "+90" "180" "-90" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Orientation (Degrees) - - 1 - - 0 - - - 0 - - 1 - orientationRadioBox - 1 - - - protected - 1 - - - Resizable - - 0 - 1 - - wxRA_SPECIFY_COLS - - 0 - Select if the component is to be rotated when drawn - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - wxLEFT|wxRIGHT|wxTOP|wxEXPAND - 0 - - - mirrorSizer - wxHORIZONTAL - none - - 8 - wxALL - 1 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - "Normal" "Mirror ---" "Mirror |" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Mirror - - 1 - - 0 - - - 0 - - 1 - mirrorRadioBox - 1 - - - protected - 1 - - - Resizable - - 0 - 1 - - wxRA_SPECIFY_COLS - - 0 - Pick the graphical transformation to be used when displaying the component, if any - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 8 - wxEXPAND|wxLEFT|wxRIGHT|wxTOP - 0 - - wxID_ANY - Chip Name - - chipnameSizer - wxHORIZONTAL - none - - - 5 - wxALL|wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - - 0 - - 32 - - 0 - - 1 - chipnameTextCtrl - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - The name of the symbol in the library from which this component came - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 8 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Convert - - - 0 - - - 0 - - 1 - convertCheckBox - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - Use the alternate shape of this component. For gates, this is the "De Morgan" conversion - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 8 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Parts are locked - - - 0 - - - 0 - - 1 - partsAreLockedLabel - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Reset to Library Defaults - - - 0 - - - 0 - - 1 - defaultsButton - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - Set position and style of fields and component orientation to default lib value. Fields texts are not modified. - - wxFILTER_NONE - wxDefaultValidator - - - - - SetInitCmp - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 1 - - wxID_ANY - Fields - - fieldsSizer - wxHORIZONTAL - none - - - 8 - wxEXPAND|wxRIGHT|wxLEFT - 3 - - wxID_ANY - - - gridStaticBoxSizer - wxVERTICAL - none - - - 8 - wxALL|wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - - 0 - - - 0 - 220,-1 - 1 - fieldListCtrl - 1 - - - protected - 1 - - - Resizable - - 1 - - wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OnListItemDeselected - - - - OnListItemSelected - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Add Field - - - 0 - - - 0 - - 1 - addFieldButton - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - Add a new custom field - - wxFILTER_NONE - wxDefaultValidator - - - - - addFieldButtonHandler - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Delete Field - - - 0 - - - 0 - - 1 - deleteFieldButton - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - Delete one of the optional fields - - wxFILTER_NONE - wxDefaultValidator - - - - - deleteFieldButtonHandler - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Move Up - - - 0 - - - 0 - - 1 - moveUpButton - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - Move the selected optional fields up one position - - wxFILTER_NONE - wxDefaultValidator - - - - - moveUpButtonHandler - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 2 - - - fieldEditBoxSizer - wxVERTICAL - none - - 5 - wxEXPAND - 0 - - wxID_ANY - Text Justification: - - sbSizerOptions - wxHORIZONTAL - none - - - 5 - wxRIGHT|wxLEFT - 1 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - "Left" "Center" "Right" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Horiz. Justify - - 1 - - 0 - - - 0 - - 1 - m_FieldHJustifyCtrl - 1 - - - protected - 1 - - - Resizable - - 0 - 1 - - wxRA_SPECIFY_COLS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxRIGHT|wxLEFT - 1 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - "Bottom" "Center" "Top" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Vert. Justify - - 1 - - 0 - - - 0 - - 1 - m_FieldVJustifyCtrl - 1 - - - protected - 1 - - - Resizable - - 2 - 1 - - wxRA_SPECIFY_COLS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxTOP - 0 - - wxID_ANY - Visibility - - visibilitySizer - wxHORIZONTAL - none - - - 5 - wxALIGN_CENTER_VERTICAL - 1 - - - bShowRotateSizer - wxVERTICAL - none - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Show - - - 0 - - - 0 - - 1 - showCheckBox - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - Check if you want this field visible - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Rotate - - - 0 - - - 0 - - 1 - rotateCheckBox - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - Check if you want this field's text rotated 90 degrees - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT - 1 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - "Normal" "Italic" "Bold" "Bold Italic" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Style: - - 1 - - 0 - - - 0 - - 1 - m_StyleRadioBox - 1 - - - protected - 1 - - - Resizable - - 3 - 1 - - wxRA_SPECIFY_COLS - - 0 - The style of the currently selected field's text in the schemati - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - - fieldNameBoxSizer - wxVERTICAL - none - - 5 - - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Field Name - - - 0 - - - 0 - - 1 - fieldNameLabel - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - - 0 - - 0 - - 0 - - 1 - fieldNameTextCtrl - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - The name of the currently selected field Some fixed fields names are not editable - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - - fieldTextBoxSizer - wxVERTICAL - none - - 5 - - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Field Value - - - 0 - - - 0 - - 1 - fieldValueLabel - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - - 0 - - 0 - - 0 - - 1 - fieldValueTextCtrl - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - The text (or value) of the currently selected field - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - - textSizeBoxSizer - wxVERTICAL - none - - 5 - - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Size(") - - - 0 - - - 0 - - 1 - textSizeLabel - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - - 0 - - 0 - - 0 - - 1 - textSizeTextCtrl - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - The size of the currently selected field's text in the schematic - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 0 - - - positionBoxSizer - wxHORIZONTAL - none - - 5 - wxALL|wxEXPAND - 1 - - - posXBoxSizer - wxVERTICAL - none - - 5 - - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - PosX(") - - - 0 - - - 0 - - 1 - posXLabel - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - - 0 - - 0 - - 0 - - 1 - posXTextCtrl - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - The X coordinate of the text relative to the component - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 1 - - - posYBoxSizer - wxVERTICAL - none - - 5 - - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - PosY(") - - - 0 - - - 0 - - 1 - posYLabel - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - - 0 - - 0 - - 0 - - 1 - posYTextCtrl - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - The Y coordinate of the text relative to the component - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 8 - wxALL|wxEXPAND - 0 - - 0 - 1 - 0 - 0 - 0 - 1 - 0 - 0 - - stdDialogButtonSizer - protected - - OnCancelButtonClick - - - - OnOKButtonClick - - - - - - - - + + + + + ; + C++ + 1 + source_name + 0 + 0 + res + ANSI + connect + dialog_edit_component_in_schematic_fbp + 1000 + none + 1 + + + . + + 1 + 1 + 1 + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP + + 700,482 + wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU + + Component Properties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + mainSizer + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + upperSizer + wxHORIZONTAL + none + + 5 + wxALIGN_TOP|wxALL|wxEXPAND + 0 + + wxID_ANY + Component + + optionsSizer + wxVERTICAL + none + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Unit + + 0 + + + 0 + + 1 + m_staticTextUnit + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + unitChoice + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + wxLEFT|wxRIGHT|wxTOP|wxEXPAND + 0 + + + orientationSizer + wxHORIZONTAL + none + + 8 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "0" "+90" "180" "-90" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Orientation (Degrees) + 1 + + 0 + + + 0 + + 1 + orientationRadioBox + 1 + + + protected + 1 + + Resizable + 0 + 1 + + wxRA_SPECIFY_COLS + + 0 + Select if the component is to be rotated when drawn + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + wxLEFT|wxRIGHT|wxTOP|wxEXPAND + 0 + + + mirrorSizer + wxHORIZONTAL + none + + 8 + wxALL + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Normal" "Mirror ---" "Mirror |" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Mirror + 1 + + 0 + + + 0 + + 1 + mirrorRadioBox + 1 + + + protected + 1 + + Resizable + 0 + 1 + + wxRA_SPECIFY_COLS + + 0 + Pick the graphical transformation to be used when displaying the component, if any + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Chip Name + + 0 + + + 0 + + 1 + m_staticTextChipname + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 32 + + 0 + + 1 + chipnameTextCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + The name of the symbol in the library from which this component came + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 8 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Convert + + 0 + + + 0 + + 1 + convertCheckBox + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Use the alternate shape of this component. For gates, this is the "De Morgan" conversion + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 8 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Parts are locked + + 0 + + + 0 + + 1 + partsAreLockedLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Reset to Library Defaults + + 0 + + + 0 + + 1 + defaultsButton + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Set position and style of fields and component orientation to default lib value. Fields texts are not modified. + + wxFILTER_NONE + wxDefaultValidator + + + + + SetInitCmp + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 1 + + wxID_ANY + Fields + + fieldsSizer + wxHORIZONTAL + none + + + 8 + wxEXPAND|wxRIGHT|wxLEFT + 3 + + wxID_ANY + + + gridStaticBoxSizer + wxVERTICAL + none + + + 8 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + 220,-1 + 1 + fieldListCtrl + 1 + + + protected + 1 + + Resizable + 1 + + wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnListItemDeselected + + + + OnListItemSelected + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Add Field + + 0 + + + 0 + + 1 + addFieldButton + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Add a new custom field + + wxFILTER_NONE + wxDefaultValidator + + + + + addFieldButtonHandler + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Delete Field + + 0 + + + 0 + + 1 + deleteFieldButton + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Delete one of the optional fields + + wxFILTER_NONE + wxDefaultValidator + + + + + deleteFieldButtonHandler + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Move Up + + 0 + + + 0 + + 1 + moveUpButton + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Move the selected optional fields up one position + + wxFILTER_NONE + wxDefaultValidator + + + + + moveUpButtonHandler + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 2 + + + fieldEditBoxSizer + wxVERTICAL + none + + 5 + wxEXPAND + 0 + + + bSizerJustification + wxHORIZONTAL + none + + 5 + wxRIGHT|wxLEFT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Left" "Center" "Right" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Horiz. Justify + 1 + + 0 + + + 0 + + 1 + m_FieldHJustifyCtrl + 1 + + + protected + 1 + + Resizable + 0 + 1 + + wxRA_SPECIFY_COLS + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxRIGHT|wxLEFT + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Bottom" "Center" "Top" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Vert. Justify + 1 + + 0 + + + 0 + + 1 + m_FieldVJustifyCtrl + 1 + + + protected + 1 + + Resizable + 2 + 1 + + wxRA_SPECIFY_COLS + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizerStyle + wxHORIZONTAL + none + + 5 + wxEXPAND|wxALL + 1 + + wxID_ANY + Visibility + + visibilitySizer + wxVERTICAL + none + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Show + + 0 + + + 0 + + 1 + showCheckBox + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Check if you want this field visible + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Rotate + + 0 + + + 0 + + 1 + rotateCheckBox + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Check if you want this field's text rotated 90 degrees + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALL + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Normal" "Italic" "Bold" "Bold Italic" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Style: + 1 + + 0 + + + 0 + + 1 + m_StyleRadioBox + 1 + + + protected + 1 + + Resizable + 3 + 1 + + wxRA_SPECIFY_COLS + + 0 + The style of the currently selected field's text in the schemati + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + fieldNameBoxSizer + wxVERTICAL + none + + 5 + wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Field Name + + 0 + + + 0 + + 1 + fieldNameLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + fieldNameTextCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + The name of the currently selected field Some fixed fields names are not editable + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + fieldTextBoxSizer + wxVERTICAL + none + + 5 + wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Field Value + + 0 + + + 0 + + 1 + fieldValueLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + fieldValueTextCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + The text (or value) of the currently selected field + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxTOP + 1 + + 3 + wxBOTH + 1 + + 0 + + fgSizerPosSize + wxFLEX_GROWMODE_SPECIFIED + none + 3 + 0 + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Size + + 0 + + + 0 + + 1 + textSizeLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxBOTTOM|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + textSizeTextCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + The size of the currently selected field's text in the schematic + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + unit + + 0 + + + 0 + + 1 + m_staticTextUnitSize + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + PosX + + 0 + + + 0 + + 1 + posXLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxTOP|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + posXTextCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + The X coordinate of the text relative to the component + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + unit + + 0 + + + 0 + + 1 + m_staticTextUnitPosX + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + PosY + + 0 + + + 0 + + 1 + posYLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + posYTextCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + The Y coordinate of the text relative to the component + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + unit + + 0 + + + 0 + + 1 + m_staticTextUnitPosY + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 8 + wxALL|wxEXPAND + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + stdDialogButtonSizer + protected + + OnCancelButtonClick + + + + OnOKButtonClick + + + + + + + + diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.h b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.h index 43cb5187ef..c81bee0417 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.h +++ b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.h @@ -1,89 +1,94 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 30 2011) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#ifndef __DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP_H__ -#define __DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP_H__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -/// Class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP -/////////////////////////////////////////////////////////////////////////////// -class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public wxDialog -{ - private: - - protected: - wxChoice* unitChoice; - wxRadioBox* orientationRadioBox; - wxRadioBox* mirrorRadioBox; - wxTextCtrl* chipnameTextCtrl; - wxCheckBox* convertCheckBox; - wxStaticText* partsAreLockedLabel; - wxButton* defaultsButton; - wxListCtrl* fieldListCtrl; - wxButton* addFieldButton; - wxButton* deleteFieldButton; - wxButton* moveUpButton; - wxRadioBox* m_FieldHJustifyCtrl; - wxRadioBox* m_FieldVJustifyCtrl; - wxCheckBox* showCheckBox; - wxCheckBox* rotateCheckBox; - wxRadioBox* m_StyleRadioBox; - wxStaticText* fieldNameLabel; - wxTextCtrl* fieldNameTextCtrl; - wxStaticText* fieldValueLabel; - wxTextCtrl* fieldValueTextCtrl; - wxStaticText* textSizeLabel; - wxTextCtrl* textSizeTextCtrl; - wxStaticText* posXLabel; - wxTextCtrl* posXTextCtrl; - wxStaticText* posYLabel; - wxTextCtrl* posYTextCtrl; - wxStdDialogButtonSizer* stdDialogButtonSizer; - wxButton* stdDialogButtonSizerOK; - wxButton* stdDialogButtonSizerCancel; - - // Virtual event handlers, overide them in your derived class - virtual void SetInitCmp( wxCommandEvent& event ) { event.Skip(); } - virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); } - virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); } - virtual void addFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); } - virtual void deleteFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); } - virtual void moveUpButtonHandler( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); } - virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); } - - - public: - - DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Component Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 700,521 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU ); - ~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(); - -}; - -#endif //__DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP_H__ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Oct 8 2012) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP_H__ +#define __DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public wxDialog +{ + private: + + protected: + wxStaticText* m_staticTextUnit; + wxChoice* unitChoice; + wxRadioBox* orientationRadioBox; + wxRadioBox* mirrorRadioBox; + wxStaticText* m_staticTextChipname; + wxTextCtrl* chipnameTextCtrl; + wxCheckBox* convertCheckBox; + wxStaticText* partsAreLockedLabel; + wxButton* defaultsButton; + wxListCtrl* fieldListCtrl; + wxButton* addFieldButton; + wxButton* deleteFieldButton; + wxButton* moveUpButton; + wxRadioBox* m_FieldHJustifyCtrl; + wxRadioBox* m_FieldVJustifyCtrl; + wxCheckBox* showCheckBox; + wxCheckBox* rotateCheckBox; + wxRadioBox* m_StyleRadioBox; + wxStaticText* fieldNameLabel; + wxTextCtrl* fieldNameTextCtrl; + wxStaticText* fieldValueLabel; + wxTextCtrl* fieldValueTextCtrl; + wxStaticText* textSizeLabel; + wxTextCtrl* textSizeTextCtrl; + wxStaticText* m_staticTextUnitSize; + wxStaticText* posXLabel; + wxTextCtrl* posXTextCtrl; + wxStaticText* m_staticTextUnitPosX; + wxStaticText* posYLabel; + wxTextCtrl* posYTextCtrl; + wxStaticText* m_staticTextUnitPosY; + wxStdDialogButtonSizer* stdDialogButtonSizer; + wxButton* stdDialogButtonSizerOK; + wxButton* stdDialogButtonSizerCancel; + + // Virtual event handlers, overide them in your derived class + virtual void SetInitCmp( wxCommandEvent& event ) { event.Skip(); } + virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); } + virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); } + virtual void addFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); } + virtual void deleteFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); } + virtual void moveUpButtonHandler( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); } + + + public: + + DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Component Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 700,482 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU ); + ~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(); + +}; + +#endif //__DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP_H__ diff --git a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp index 8aa9b493ba..c4ddee491e 100644 --- a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp +++ b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp @@ -34,8 +34,8 @@ class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB : public DIALOG_EDIT_LIBENTRY_FIELDS_IN /*****************************************************************************************/ { private: - LIB_EDIT_FRAME* m_Parent; - LIB_COMPONENT* m_LibEntry; + LIB_EDIT_FRAME* m_parent; + LIB_COMPONENT* m_libEntry; bool m_skipCopyFromPanel; /// a copy of the edited component's LIB_FIELDs @@ -64,10 +64,10 @@ private: int getSelectedFieldNdx(); /** - * Function InitBuffers + * Function initBuffers * sets up to edit the given component. */ - void InitBuffers(); + void initBuffers(); /** * Function findField @@ -133,8 +133,8 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( aParent ) /***********************************************************************/ { - m_Parent = aParent; - m_LibEntry = aLibEntry; + m_parent = aParent; + m_libEntry = aLibEntry; GetSizer()->SetSizeHints( this ); Centre(); @@ -163,20 +163,11 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnInitDialog( wxInitDialogEvent& event columnLabel.SetText( _( "Value" ) ); fieldListCtrl->InsertColumn( COLUMN_TEXT, columnLabel ); - wxString label = _( "Size" ) + ReturnUnitSymbol( g_UserUnit ); - textSizeLabel->SetLabel( label ); + m_staticTextUnitSize->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) ); + m_staticTextUnitPosX->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) ); + m_staticTextUnitPosY->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) ); - label = _( "Pos " ); - label += _( "X" ); - label += ReturnUnitSymbol( g_UserUnit ); - posXLabel->SetLabel( label ); - - label = _( "Pos " ); - label += _( "Y" ); - label += ReturnUnitSymbol( g_UserUnit ); - posYLabel->SetLabel( label ); - - InitBuffers(); + initBuffers(); copySelectedFieldToPanel(); stdDialogButtonSizerOK->SetDefault(); @@ -237,7 +228,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick( wxCommandEvent& event * or root alias of the component */ wxString newvalue = m_FieldsBuf[VALUE].GetText(); - if( m_LibEntry->HasAlias( newvalue ) && !m_LibEntry->GetAlias( newvalue )->IsRoot() ) + if( m_libEntry->HasAlias( newvalue ) && !m_libEntry->GetAlias( newvalue )->IsRoot() ) { wxString msg; msg.Printf( _( "A new name is entered for this component\n\ @@ -249,7 +240,7 @@ An alias %s already exists!\nCannot update this component" ), /* End unused code */ /* save old cmp in undo list */ - m_Parent->SaveCopyInUndoList( m_LibEntry, IS_CHANGED ); + m_parent->SaveCopyInUndoList( m_libEntry, IS_CHANGED ); // delete any fields with no name or no value before we copy all of m_FieldsBuf // back into the component @@ -274,12 +265,12 @@ An alias %s already exists!\nCannot update this component" ), #endif // copy all the fields back, fully replacing any previous fields - m_LibEntry->SetFields( m_FieldsBuf ); + m_libEntry->SetFields( m_FieldsBuf ); // We need to keep the name and the value the same at the moment! - SetName( m_LibEntry->GetValueField().GetText() ); + SetName( m_libEntry->GetValueField().GetText() ); - m_Parent->OnModify(); + m_parent->OnModify(); EndModal( 0 ); } @@ -445,13 +436,11 @@ LIB_FIELD* DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::findField( const wxString& aField } -/***********************************************************/ -void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers() -/***********************************************************/ +void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers() { LIB_FIELDS cmpFields; - m_LibEntry->GetFields( cmpFields ); + m_libEntry->GetFields( cmpFields ); #if defined(DEBUG) for( unsigned i=0; iGetParent())->GetTemplateFieldNames(); + ((SCH_EDIT_FRAME*)m_parent->GetParent())->GetTemplateFieldNames(); for( TEMPLATE_FIELDNAMES::const_iterator it = tfnames.begin(); it!=tfnames.end(); ++it ) { diff --git a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.cpp b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.cpp index ac6f536a58..9fec9447e7 100644 --- a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.cpp +++ b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.cpp @@ -1,208 +1,227 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 30 2011) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#include "dialog_edit_libentry_fields_in_lib_base.h" - -/////////////////////////////////////////////////////////////////////////// - -DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) -{ - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* mainSizer; - mainSizer = new wxBoxSizer( wxVERTICAL ); - - wxStaticBoxSizer* fieldsSizer; - fieldsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Fields") ), wxHORIZONTAL ); - - wxStaticBoxSizer* gridStaticBoxSizer; - gridStaticBoxSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, wxEmptyString ), wxVERTICAL ); - - fieldListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES ); - fieldListCtrl->SetMinSize( wxSize( 220,-1 ) ); - - gridStaticBoxSizer->Add( fieldListCtrl, 1, wxALL|wxEXPAND, 8 ); - - addFieldButton = new wxButton( this, wxID_ANY, _("Add Field"), wxDefaultPosition, wxDefaultSize, 0 ); - addFieldButton->SetToolTip( _("Add a new custom field") ); - - gridStaticBoxSizer->Add( addFieldButton, 0, wxALL|wxEXPAND, 5 ); - - deleteFieldButton = new wxButton( this, wxID_ANY, _("Delete Field"), wxDefaultPosition, wxDefaultSize, 0 ); - deleteFieldButton->SetToolTip( _("Delete one of the optional fields") ); - - gridStaticBoxSizer->Add( deleteFieldButton, 0, wxALL|wxEXPAND, 5 ); - - moveUpButton = new wxButton( this, wxID_ANY, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 ); - moveUpButton->SetToolTip( _("Move the selected optional fields up one position") ); - - gridStaticBoxSizer->Add( moveUpButton, 0, wxALL|wxEXPAND, 5 ); - - fieldsSizer->Add( gridStaticBoxSizer, 5, wxEXPAND|wxRIGHT, 8 ); - - wxBoxSizer* fieldEditBoxSizer; - fieldEditBoxSizer = new wxBoxSizer( wxVERTICAL ); - - wxStaticBoxSizer* optionsSizer; - optionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Text Justification:") ), wxHORIZONTAL ); - - wxString m_FieldHJustifyCtrlChoices[] = { _("Left"), _("Center"), _("Right") }; - int m_FieldHJustifyCtrlNChoices = sizeof( m_FieldHJustifyCtrlChoices ) / sizeof( wxString ); - m_FieldHJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Horiz. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldHJustifyCtrlNChoices, m_FieldHJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS ); - m_FieldHJustifyCtrl->SetSelection( 1 ); - m_FieldHJustifyCtrl->SetToolTip( _("Select if the component is to be rotated when drawn") ); - - optionsSizer->Add( m_FieldHJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT, 8 ); - - wxString m_FieldVJustifyCtrlChoices[] = { _("Bottom"), _("Center"), _("Top") }; - int m_FieldVJustifyCtrlNChoices = sizeof( m_FieldVJustifyCtrlChoices ) / sizeof( wxString ); - m_FieldVJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Vert. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldVJustifyCtrlNChoices, m_FieldVJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS ); - m_FieldVJustifyCtrl->SetSelection( 0 ); - m_FieldVJustifyCtrl->SetToolTip( _("Pick the graphical transformation to be used when displaying the component, if any") ); - - optionsSizer->Add( m_FieldVJustifyCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 8 ); - - fieldEditBoxSizer->Add( optionsSizer, 0, wxALIGN_TOP|wxEXPAND|wxBOTTOM, 5 ); - - wxStaticBoxSizer* visibilitySizer; - visibilitySizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Visibility") ), wxHORIZONTAL ); - - wxBoxSizer* bShowRotateSizer; - bShowRotateSizer = new wxBoxSizer( wxVERTICAL ); - - showCheckBox = new wxCheckBox( this, wxID_ANY, _("Show"), wxDefaultPosition, wxDefaultSize, 0 ); - showCheckBox->SetToolTip( _("Check if you want this field visible") ); - - bShowRotateSizer->Add( showCheckBox, 0, wxALL, 5 ); - - rotateCheckBox = new wxCheckBox( this, wxID_ANY, _("Rotate"), wxDefaultPosition, wxDefaultSize, 0 ); - rotateCheckBox->SetToolTip( _("Check if you want this field's text rotated 90 degrees") ); - - bShowRotateSizer->Add( rotateCheckBox, 0, wxALL, 5 ); - - visibilitySizer->Add( bShowRotateSizer, 1, wxALIGN_CENTER_VERTICAL, 5 ); - - wxString m_StyleRadioBoxChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") }; - int m_StyleRadioBoxNChoices = sizeof( m_StyleRadioBoxChoices ) / sizeof( wxString ); - m_StyleRadioBox = new wxRadioBox( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, m_StyleRadioBoxNChoices, m_StyleRadioBoxChoices, 1, wxRA_SPECIFY_COLS ); - m_StyleRadioBox->SetSelection( 1 ); - visibilitySizer->Add( m_StyleRadioBox, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - fieldEditBoxSizer->Add( visibilitySizer, 0, wxEXPAND, 5 ); - - wxBoxSizer* fieldNameBoxSizer; - fieldNameBoxSizer = new wxBoxSizer( wxVERTICAL ); - - fieldNameLabel = new wxStaticText( this, wxID_ANY, _("Field Name"), wxDefaultPosition, wxDefaultSize, 0 ); - fieldNameLabel->Wrap( -1 ); - fieldNameBoxSizer->Add( fieldNameLabel, 0, 0, 5 ); - - fieldNameTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fieldNameTextCtrl->SetToolTip( _("The text (or value) of the currently selected field") ); - - fieldNameBoxSizer->Add( fieldNameTextCtrl, 0, wxEXPAND, 5 ); - - fieldEditBoxSizer->Add( fieldNameBoxSizer, 0, wxALL|wxEXPAND, 5 ); - - wxBoxSizer* fieldTextBoxSizer; - fieldTextBoxSizer = new wxBoxSizer( wxVERTICAL ); - - fieldValueLabel = new wxStaticText( this, wxID_ANY, _("Field Value"), wxDefaultPosition, wxDefaultSize, 0 ); - fieldValueLabel->Wrap( -1 ); - fieldTextBoxSizer->Add( fieldValueLabel, 0, 0, 5 ); - - fieldValueTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - fieldValueTextCtrl->SetToolTip( _("The text (or value) of the currently selected field") ); - - fieldTextBoxSizer->Add( fieldValueTextCtrl, 0, wxEXPAND, 5 ); - - fieldEditBoxSizer->Add( fieldTextBoxSizer, 0, wxALL|wxEXPAND, 5 ); - - wxBoxSizer* textSizeBoxSizer; - textSizeBoxSizer = new wxBoxSizer( wxVERTICAL ); - - textSizeLabel = new wxStaticText( this, wxID_ANY, _("Size(\")"), wxDefaultPosition, wxDefaultSize, 0 ); - textSizeLabel->Wrap( -1 ); - textSizeBoxSizer->Add( textSizeLabel, 0, 0, 5 ); - - textSizeTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - textSizeTextCtrl->SetToolTip( _("The vertical height of the currently selected field's text in the schematic") ); - - textSizeBoxSizer->Add( textSizeTextCtrl, 0, wxEXPAND, 5 ); - - fieldEditBoxSizer->Add( textSizeBoxSizer, 0, wxALL|wxEXPAND, 5 ); - - wxBoxSizer* positionBoxSizer; - positionBoxSizer = new wxBoxSizer( wxHORIZONTAL ); - - wxBoxSizer* posXBoxSizer; - posXBoxSizer = new wxBoxSizer( wxVERTICAL ); - - posXLabel = new wxStaticText( this, wxID_ANY, _("PosX(\")"), wxDefaultPosition, wxDefaultSize, 0 ); - posXLabel->Wrap( -1 ); - posXBoxSizer->Add( posXLabel, 0, 0, 5 ); - - posXTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - posXBoxSizer->Add( posXTextCtrl, 0, wxEXPAND, 5 ); - - positionBoxSizer->Add( posXBoxSizer, 1, wxALL|wxEXPAND, 5 ); - - wxBoxSizer* posYBoxSizer; - posYBoxSizer = new wxBoxSizer( wxVERTICAL ); - - posYLabel = new wxStaticText( this, wxID_ANY, _("PosY(\")"), wxDefaultPosition, wxDefaultSize, 0 ); - posYLabel->Wrap( -1 ); - posYBoxSizer->Add( posYLabel, 0, 0, 5 ); - - posYTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - posYTextCtrl->SetToolTip( _("The Y coordinate of the text relative to the component") ); - - posYBoxSizer->Add( posYTextCtrl, 0, wxEXPAND, 5 ); - - positionBoxSizer->Add( posYBoxSizer, 1, wxALL|wxEXPAND, 5 ); - - fieldEditBoxSizer->Add( positionBoxSizer, 1, wxEXPAND, 5 ); - - fieldsSizer->Add( fieldEditBoxSizer, 3, wxEXPAND, 5 ); - - mainSizer->Add( fieldsSizer, 1, wxEXPAND|wxALL, 5 ); - - stdDialogButtonSizer = new wxStdDialogButtonSizer(); - stdDialogButtonSizerOK = new wxButton( this, wxID_OK ); - stdDialogButtonSizer->AddButton( stdDialogButtonSizerOK ); - stdDialogButtonSizerCancel = new wxButton( this, wxID_CANCEL ); - stdDialogButtonSizer->AddButton( stdDialogButtonSizerCancel ); - stdDialogButtonSizer->Realize(); - mainSizer->Add( stdDialogButtonSizer, 0, wxALL|wxEXPAND, 8 ); - - this->SetSizer( mainSizer ); - this->Layout(); - - // Connect Events - this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnInitDialog ) ); - fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemDeselected ), NULL, this ); - fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemSelected ), NULL, this ); - addFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::addFieldButtonHandler ), NULL, this ); - deleteFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::deleteFieldButtonHandler ), NULL, this ); - moveUpButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::moveUpButtonHandler ), NULL, this ); - stdDialogButtonSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnCancelButtonClick ), NULL, this ); - stdDialogButtonSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnOKButtonClick ), NULL, this ); -} - -DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE() -{ - // Disconnect Events - this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnInitDialog ) ); - fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemDeselected ), NULL, this ); - fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemSelected ), NULL, this ); - addFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::addFieldButtonHandler ), NULL, this ); - deleteFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::deleteFieldButtonHandler ), NULL, this ); - moveUpButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::moveUpButtonHandler ), NULL, this ); - stdDialogButtonSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnCancelButtonClick ), NULL, this ); - stdDialogButtonSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnOKButtonClick ), NULL, this ); - -} +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Oct 8 2012) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_edit_libentry_fields_in_lib_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +{ + this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + + wxBoxSizer* mainSizer; + mainSizer = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizerFieldsSetup; + bSizerFieldsSetup = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizerFiledsList; + bSizerFiledsList = new wxBoxSizer( wxVERTICAL ); + + fieldListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES ); + fieldListCtrl->SetMinSize( wxSize( 220,-1 ) ); + + bSizerFiledsList->Add( fieldListCtrl, 1, wxALL|wxEXPAND, 8 ); + + addFieldButton = new wxButton( this, wxID_ANY, _("Add Field"), wxDefaultPosition, wxDefaultSize, 0 ); + addFieldButton->SetToolTip( _("Add a new custom field") ); + + bSizerFiledsList->Add( addFieldButton, 0, wxALL|wxEXPAND, 5 ); + + deleteFieldButton = new wxButton( this, wxID_ANY, _("Delete Field"), wxDefaultPosition, wxDefaultSize, 0 ); + deleteFieldButton->SetToolTip( _("Delete one of the optional fields") ); + + bSizerFiledsList->Add( deleteFieldButton, 0, wxALL|wxEXPAND, 5 ); + + moveUpButton = new wxButton( this, wxID_ANY, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 ); + moveUpButton->SetToolTip( _("Move the selected optional fields up one position") ); + + bSizerFiledsList->Add( moveUpButton, 0, wxALL|wxEXPAND, 5 ); + + + bSizerFieldsSetup->Add( bSizerFiledsList, 1, wxEXPAND, 5 ); + + wxBoxSizer* fieldEditBoxSizer; + fieldEditBoxSizer = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizerJustify; + bSizerJustify = new wxBoxSizer( wxHORIZONTAL ); + + wxString m_FieldHJustifyCtrlChoices[] = { _("Left"), _("Center"), _("Right") }; + int m_FieldHJustifyCtrlNChoices = sizeof( m_FieldHJustifyCtrlChoices ) / sizeof( wxString ); + m_FieldHJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Horiz. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldHJustifyCtrlNChoices, m_FieldHJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS ); + m_FieldHJustifyCtrl->SetSelection( 1 ); + m_FieldHJustifyCtrl->SetToolTip( _("Select if the component is to be rotated when drawn") ); + + bSizerJustify->Add( m_FieldHJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + wxString m_FieldVJustifyCtrlChoices[] = { _("Bottom"), _("Center"), _("Top") }; + int m_FieldVJustifyCtrlNChoices = sizeof( m_FieldVJustifyCtrlChoices ) / sizeof( wxString ); + m_FieldVJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Vert. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldVJustifyCtrlNChoices, m_FieldVJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS ); + m_FieldVJustifyCtrl->SetSelection( 0 ); + m_FieldVJustifyCtrl->SetToolTip( _("Pick the graphical transformation to be used when displaying the component, if any") ); + + bSizerJustify->Add( m_FieldVJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + + + fieldEditBoxSizer->Add( bSizerJustify, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizerAspect; + bSizerAspect = new wxBoxSizer( wxHORIZONTAL ); + + wxStaticBoxSizer* visibilitySizer; + visibilitySizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Visibility") ), wxVERTICAL ); + + showCheckBox = new wxCheckBox( this, wxID_ANY, _("Show"), wxDefaultPosition, wxDefaultSize, 0 ); + showCheckBox->SetToolTip( _("Check if you want this field visible") ); + + visibilitySizer->Add( showCheckBox, 0, wxALL, 5 ); + + rotateCheckBox = new wxCheckBox( this, wxID_ANY, _("Rotate"), wxDefaultPosition, wxDefaultSize, 0 ); + rotateCheckBox->SetToolTip( _("Check if you want this field's text rotated 90 degrees") ); + + visibilitySizer->Add( rotateCheckBox, 0, wxALL, 5 ); + + + bSizerAspect->Add( visibilitySizer, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + wxString m_StyleRadioBoxChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") }; + int m_StyleRadioBoxNChoices = sizeof( m_StyleRadioBoxChoices ) / sizeof( wxString ); + m_StyleRadioBox = new wxRadioBox( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, m_StyleRadioBoxNChoices, m_StyleRadioBoxChoices, 1, wxRA_SPECIFY_COLS ); + m_StyleRadioBox->SetSelection( 0 ); + bSizerAspect->Add( m_StyleRadioBox, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + + fieldEditBoxSizer->Add( bSizerAspect, 0, wxEXPAND, 5 ); + + wxBoxSizer* fieldNameBoxSizer; + fieldNameBoxSizer = new wxBoxSizer( wxVERTICAL ); + + fieldNameLabel = new wxStaticText( this, wxID_ANY, _("Field Name"), wxDefaultPosition, wxDefaultSize, 0 ); + fieldNameLabel->Wrap( -1 ); + fieldNameBoxSizer->Add( fieldNameLabel, 0, 0, 5 ); + + fieldNameTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fieldNameTextCtrl->SetMaxLength( 0 ); + fieldNameTextCtrl->SetToolTip( _("The text (or value) of the currently selected field") ); + + fieldNameBoxSizer->Add( fieldNameTextCtrl, 0, wxEXPAND, 5 ); + + + fieldEditBoxSizer->Add( fieldNameBoxSizer, 0, wxALL|wxEXPAND, 5 ); + + wxBoxSizer* fieldTextBoxSizer; + fieldTextBoxSizer = new wxBoxSizer( wxVERTICAL ); + + fieldValueLabel = new wxStaticText( this, wxID_ANY, _("Field Value"), wxDefaultPosition, wxDefaultSize, 0 ); + fieldValueLabel->Wrap( -1 ); + fieldTextBoxSizer->Add( fieldValueLabel, 0, 0, 5 ); + + fieldValueTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fieldValueTextCtrl->SetMaxLength( 0 ); + fieldValueTextCtrl->SetToolTip( _("The text (or value) of the currently selected field") ); + + fieldTextBoxSizer->Add( fieldValueTextCtrl, 0, wxEXPAND, 5 ); + + + fieldEditBoxSizer->Add( fieldTextBoxSizer, 0, wxALL|wxEXPAND, 5 ); + + wxFlexGridSizer* fgSizerPosSize; + fgSizerPosSize = new wxFlexGridSizer( 3, 3, 0, 0 ); + fgSizerPosSize->AddGrowableCol( 1 ); + fgSizerPosSize->SetFlexibleDirection( wxBOTH ); + fgSizerPosSize->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + textSizeLabel = new wxStaticText( this, wxID_ANY, _("Size"), wxDefaultPosition, wxDefaultSize, 0 ); + textSizeLabel->Wrap( -1 ); + fgSizerPosSize->Add( textSizeLabel, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + textSizeTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + textSizeTextCtrl->SetMaxLength( 0 ); + textSizeTextCtrl->SetToolTip( _("The vertical height of the currently selected field's text in the schematic") ); + + fgSizerPosSize->Add( textSizeTextCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxBOTTOM, 5 ); + + m_staticTextUnitSize = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextUnitSize->Wrap( -1 ); + fgSizerPosSize->Add( m_staticTextUnitSize, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + posXLabel = new wxStaticText( this, wxID_ANY, _("PosX"), wxDefaultPosition, wxDefaultSize, 0 ); + posXLabel->Wrap( -1 ); + fgSizerPosSize->Add( posXLabel, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + posXTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + posXTextCtrl->SetMaxLength( 0 ); + fgSizerPosSize->Add( posXTextCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP, 5 ); + + m_staticTextUnitPosX = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextUnitPosX->Wrap( -1 ); + fgSizerPosSize->Add( m_staticTextUnitPosX, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + posYLabel = new wxStaticText( this, wxID_ANY, _("PosY"), wxDefaultPosition, wxDefaultSize, 0 ); + posYLabel->Wrap( -1 ); + fgSizerPosSize->Add( posYLabel, 0, wxALIGN_CENTER_VERTICAL, 5 ); + + posYTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + posYTextCtrl->SetMaxLength( 0 ); + posYTextCtrl->SetToolTip( _("The Y coordinate of the text relative to the component") ); + + fgSizerPosSize->Add( posYTextCtrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticTextUnitPosY = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextUnitPosY->Wrap( -1 ); + fgSizerPosSize->Add( m_staticTextUnitPosY, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + + fieldEditBoxSizer->Add( fgSizerPosSize, 1, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 ); + + + bSizerFieldsSetup->Add( fieldEditBoxSizer, 0, wxEXPAND, 5 ); + + + mainSizer->Add( bSizerFieldsSetup, 1, wxEXPAND, 5 ); + + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + mainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); + + stdDialogButtonSizer = new wxStdDialogButtonSizer(); + stdDialogButtonSizerOK = new wxButton( this, wxID_OK ); + stdDialogButtonSizer->AddButton( stdDialogButtonSizerOK ); + stdDialogButtonSizerCancel = new wxButton( this, wxID_CANCEL ); + stdDialogButtonSizer->AddButton( stdDialogButtonSizerCancel ); + stdDialogButtonSizer->Realize(); + + mainSizer->Add( stdDialogButtonSizer, 0, wxALL|wxEXPAND, 8 ); + + + this->SetSizer( mainSizer ); + this->Layout(); + + // Connect Events + this->Connect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnInitDialog ) ); + fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemDeselected ), NULL, this ); + fieldListCtrl->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemSelected ), NULL, this ); + addFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::addFieldButtonHandler ), NULL, this ); + deleteFieldButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::deleteFieldButtonHandler ), NULL, this ); + moveUpButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::moveUpButtonHandler ), NULL, this ); + stdDialogButtonSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnCancelButtonClick ), NULL, this ); + stdDialogButtonSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnOKButtonClick ), NULL, this ); +} + +DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE() +{ + // Disconnect Events + this->Disconnect( wxEVT_INIT_DIALOG, wxInitDialogEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnInitDialog ) ); + fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_DESELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemDeselected ), NULL, this ); + fieldListCtrl->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnListItemSelected ), NULL, this ); + addFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::addFieldButtonHandler ), NULL, this ); + deleteFieldButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::deleteFieldButtonHandler ), NULL, this ); + moveUpButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::moveUpButtonHandler ), NULL, this ); + stdDialogButtonSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnCancelButtonClick ), NULL, this ); + stdDialogButtonSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnOKButtonClick ), NULL, this ); + +} diff --git a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.fbp b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.fbp index 73d4ac4b1e..32444ab993 100644 --- a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.fbp +++ b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.fbp @@ -1,11 +1,12 @@ - + ; C++ 1 source_name + 0 0 res ANSI @@ -19,66 +20,33 @@ . 1 + 1 1 0 0 - 1 - 1 - 1 - 1 0 - - + wxAUI_MGR_DEFAULT - - 1 - 0 - 1 1 - 0 - Dock - 0 - Left 1 impl_virtual - 1 - 0 0 wxID_ANY - - - 0 - - 0 - 1 DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE - 1 - - - 1 - - Resizable - - 1 - 615,550 + 615,456 wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU Fields Properties - 0 - - wxFILTER_NONE - wxDefaultValidator - @@ -125,28 +93,22 @@ none 5 - wxEXPAND|wxALL + wxEXPAND 1 - - wxID_ANY - Fields + - fieldsSizer + bSizerFieldsSetup wxHORIZONTAL none - - 8 - wxEXPAND|wxRIGHT - 5 - - wxID_ANY - + 5 + wxEXPAND + 1 + - gridStaticBoxSizer + bSizerFiledsList wxVERTICAL none - 8 wxALL|wxEXPAND @@ -156,7 +118,10 @@ 1 1 1 + + + @@ -176,7 +141,6 @@ 0 0 wxID_ANY - 0 @@ -191,9 +155,7 @@ protected 1 - Resizable - 1 wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES @@ -261,7 +223,10 @@ 1 1 1 + + + @@ -283,7 +248,6 @@ 0 wxID_ANY Add Field - 0 @@ -298,9 +262,7 @@ protected 1 - Resizable - 1 @@ -349,7 +311,10 @@ 1 1 1 + + + @@ -371,7 +336,6 @@ 0 wxID_ANY Delete Field - 0 @@ -386,9 +350,7 @@ protected 1 - Resizable - 1 @@ -437,7 +399,10 @@ 1 1 1 + + + @@ -459,7 +424,6 @@ 0 wxID_ANY Move Up - 0 @@ -474,9 +438,7 @@ protected 1 - Resizable - 1 @@ -521,7 +483,7 @@ 5 wxEXPAND - 3 + 0 fieldEditBoxSizer @@ -529,18 +491,15 @@ none 5 - wxALIGN_TOP|wxEXPAND|wxBOTTOM + wxEXPAND 0 - - wxID_ANY - Text Justification: + - optionsSizer + bSizerJustify wxHORIZONTAL none - - 8 + 5 wxBOTTOM|wxRIGHT|wxLEFT 1 @@ -548,7 +507,10 @@ 1 1 1 + + + @@ -570,7 +532,6 @@ 0 wxID_ANY Horiz. Justify - 1 0 @@ -586,9 +547,7 @@ protected 1 - Resizable - 1 1 @@ -630,15 +589,18 @@ - 8 + 5 wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND - 0 + 1 1 1 1 1 + + + @@ -660,7 +622,6 @@ 0 wxID_ANY Vert. Justify - 1 0 @@ -676,9 +637,7 @@ protected 1 - Resizable - 0 1 @@ -725,23 +684,23 @@ 5 wxEXPAND 0 - - wxID_ANY - Visibility + - visibilitySizer + bSizerAspect wxHORIZONTAL none - 5 - wxALIGN_CENTER_VERTICAL + wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT 1 - + + wxID_ANY + Visibility - bShowRotateSizer + visibilitySizer wxVERTICAL none + 5 wxALL @@ -751,7 +710,10 @@ 1 1 1 + + + @@ -773,7 +735,6 @@ 0 wxID_ANY Show - 0 @@ -788,9 +749,7 @@ protected 1 - Resizable - 1 @@ -839,7 +798,10 @@ 1 1 1 + + + @@ -861,7 +823,6 @@ 0 wxID_ANY Rotate - 0 @@ -876,9 +837,7 @@ protected 1 - Resizable - 1 @@ -929,7 +888,10 @@ 1 1 1 + + + @@ -951,7 +913,6 @@ 0 wxID_ANY Style: - 1 0 @@ -967,10 +928,8 @@ protected 1 - Resizable - - 1 + 0 1 wxRA_SPECIFY_COLS @@ -1030,7 +989,10 @@ 1 1 1 + + + @@ -1051,7 +1013,6 @@ 0 wxID_ANY Field Name - 0 @@ -1066,19 +1027,13 @@ protected 1 - Resizable - 1 0 - - wxFILTER_NONE - wxDefaultValidator - @@ -1117,7 +1072,10 @@ 1 1 1 + + + @@ -1137,7 +1095,6 @@ 0 0 wxID_ANY - 0 @@ -1153,9 +1110,7 @@ protected 1 - Resizable - 1 @@ -1219,7 +1174,10 @@ 1 1 1 + + + @@ -1240,7 +1198,6 @@ 0 wxID_ANY Field Value - 0 @@ -1255,19 +1212,13 @@ protected 1 - Resizable - 1 0 - - wxFILTER_NONE - wxDefaultValidator - @@ -1306,7 +1257,10 @@ 1 1 1 + + + @@ -1326,7 +1280,6 @@ 0 0 wxID_ANY - 0 @@ -1342,9 +1295,7 @@ protected 1 - Resizable - 1 @@ -1392,23 +1343,33 @@ 5 - wxALL|wxEXPAND - 0 - + wxEXPAND|wxTOP|wxBOTTOM|wxLEFT + 1 + + 3 + wxBOTH + 1 + + 0 - textSizeBoxSizer - wxVERTICAL + fgSizerPosSize + wxFLEX_GROWMODE_SPECIFIED none + 3 + 0 5 - + wxALIGN_CENTER_VERTICAL 0 1 1 1 1 + + + @@ -1428,8 +1389,7 @@ 0 0 wxID_ANY - Size(") - + Size 0 @@ -1444,19 +1404,13 @@ protected 1 - Resizable - 1 0 - - wxFILTER_NONE - wxDefaultValidator - @@ -1488,14 +1442,17 @@ 5 - wxEXPAND + wxEXPAND|wxALIGN_CENTER_VERTICAL|wxBOTTOM 0 1 1 1 1 + + + @@ -1515,7 +1472,6 @@ 0 0 wxID_ANY - 0 @@ -1531,9 +1487,7 @@ protected 1 - Resizable - 1 @@ -1577,393 +1531,601 @@ - - - - 5 - wxEXPAND - 1 - - - positionBoxSizer - wxHORIZONTAL - none 5 - wxALL|wxEXPAND - 1 - + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + unit + + 0 + + + 0 - posXBoxSizer - wxVERTICAL - none - - 5 - - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - PosX(") - - - 0 - - - 0 - - 1 - posXLabel - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - - 0 - - 0 - - 0 - - 1 - posXTextCtrl - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + 1 + m_staticTextUnitSize + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + 5 - wxALL|wxEXPAND - 1 - + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + PosX + + 0 + + + 0 - posYBoxSizer - wxVERTICAL - none - - 5 - - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - PosY(") - - - 0 - - - 0 - - 1 - posYLabel - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - - 0 - - 0 - - 0 - - 1 - posYTextCtrl - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - The Y coordinate of the text relative to the component - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + 1 + posXLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + posXTextCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + unit + + 0 + + + 0 + + 1 + m_staticTextUnitPosX + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + PosY + + 0 + + + 0 + + 1 + posYLabel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + posYTextCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + The Y coordinate of the text relative to the component + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + unit + + 0 + + + 0 + + 1 + m_staticTextUnitPosY + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + @@ -1972,6 +2134,87 @@ + + 5 + wxEXPAND | wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline1 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 8 wxALL|wxEXPAND diff --git a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.h b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.h index dae27cc21c..9097ea205e 100644 --- a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.h +++ b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.h @@ -1,81 +1,86 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 30 2011) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#ifndef __DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE_H__ -#define __DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE_H__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -/// Class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE -/////////////////////////////////////////////////////////////////////////////// -class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE : public wxDialog -{ - private: - - protected: - wxListCtrl* fieldListCtrl; - wxButton* addFieldButton; - wxButton* deleteFieldButton; - wxButton* moveUpButton; - wxRadioBox* m_FieldHJustifyCtrl; - wxRadioBox* m_FieldVJustifyCtrl; - wxCheckBox* showCheckBox; - wxCheckBox* rotateCheckBox; - wxRadioBox* m_StyleRadioBox; - wxStaticText* fieldNameLabel; - wxTextCtrl* fieldNameTextCtrl; - wxStaticText* fieldValueLabel; - wxTextCtrl* fieldValueTextCtrl; - wxStaticText* textSizeLabel; - wxTextCtrl* textSizeTextCtrl; - wxStaticText* posXLabel; - wxTextCtrl* posXTextCtrl; - wxStaticText* posYLabel; - wxTextCtrl* posYTextCtrl; - wxStdDialogButtonSizer* stdDialogButtonSizer; - wxButton* stdDialogButtonSizerOK; - wxButton* stdDialogButtonSizerCancel; - - // Virtual event handlers, overide them in your derived class - virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); } - virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); } - virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); } - virtual void addFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); } - virtual void deleteFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); } - virtual void moveUpButtonHandler( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); } - virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); } - - - public: - - DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Fields Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 615,550 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU ); - ~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE(); - -}; - -#endif //__DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE_H__ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Oct 8 2012) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE_H__ +#define __DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE : public wxDialog +{ + private: + + protected: + wxListCtrl* fieldListCtrl; + wxButton* addFieldButton; + wxButton* deleteFieldButton; + wxButton* moveUpButton; + wxRadioBox* m_FieldHJustifyCtrl; + wxRadioBox* m_FieldVJustifyCtrl; + wxCheckBox* showCheckBox; + wxCheckBox* rotateCheckBox; + wxRadioBox* m_StyleRadioBox; + wxStaticText* fieldNameLabel; + wxTextCtrl* fieldNameTextCtrl; + wxStaticText* fieldValueLabel; + wxTextCtrl* fieldValueTextCtrl; + wxStaticText* textSizeLabel; + wxTextCtrl* textSizeTextCtrl; + wxStaticText* m_staticTextUnitSize; + wxStaticText* posXLabel; + wxTextCtrl* posXTextCtrl; + wxStaticText* m_staticTextUnitPosX; + wxStaticText* posYLabel; + wxTextCtrl* posYTextCtrl; + wxStaticText* m_staticTextUnitPosY; + wxStaticLine* m_staticline1; + wxStdDialogButtonSizer* stdDialogButtonSizer; + wxButton* stdDialogButtonSizerOK; + wxButton* stdDialogButtonSizerCancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); } + virtual void OnListItemDeselected( wxListEvent& event ) { event.Skip(); } + virtual void OnListItemSelected( wxListEvent& event ) { event.Skip(); } + virtual void addFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); } + virtual void deleteFieldButtonHandler( wxCommandEvent& event ) { event.Skip(); } + virtual void moveUpButtonHandler( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOKButtonClick( wxCommandEvent& event ) { event.Skip(); } + + + public: + + DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Fields Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 615,456 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU ); + ~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE(); + +}; + +#endif //__DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE_H__ diff --git a/polygon/clipper.cpp b/polygon/clipper.cpp index 6823e943ad..060ab6c86d 100644 --- a/polygon/clipper.cpp +++ b/polygon/clipper.cpp @@ -1,8 +1,8 @@ /******************************************************************************* * * * Author : Angus Johnson * -* Version : 5.0.3 * -* Date : 12 January 2013 * +* Version : 5.1.4 * +* Date : 24 March 2013 * * Website : http://www.angusj.com * * Copyright : Angus Johnson 2010-2013 * * * @@ -26,7 +26,7 @@ * Paper no. DETC2005-85513 pp. 565-575 * * ASME 2005 International Design Engineering Technical Conferences * * and Computers and Information in Engineering Conference (IDETC/CIE2005) * -* September 24–28, 2005 , Long Beach, California, USA * +* September 24-28, 2005 , Long Beach, California, USA * * http://www.me.berkeley.edu/~mcmains/pubs/DAC05OffsetPolygon.pdf * * * *******************************************************************************/ @@ -63,7 +63,89 @@ inline long64 Abs(long64 val) { return val < 0 ? -val : val; } + //------------------------------------------------------------------------------ +// PolyTree methods ... +//------------------------------------------------------------------------------ + +void PolyTree::Clear() +{ + for (PolyNodes::size_type i = 0; i < AllNodes.size(); ++i) + delete AllNodes[i]; + AllNodes.resize(0); + Childs.resize(0); +} +//------------------------------------------------------------------------------ + +PolyNode* PolyTree::GetFirst() const +{ + if (Childs.size() > 0) + return Childs[0]; + else + return 0; +} +//------------------------------------------------------------------------------ + +int PolyTree::Total() const +{ + return AllNodes.size(); +} + +//------------------------------------------------------------------------------ +// PolyNode methods ... +//------------------------------------------------------------------------------ + +PolyNode::PolyNode(): Childs(), Parent(0), Index(0) +{ +} +//------------------------------------------------------------------------------ + +int PolyNode::ChildCount() const +{ + return Childs.size(); +} +//------------------------------------------------------------------------------ + +void PolyNode::AddChild(PolyNode& child) +{ + unsigned cnt = Childs.size(); + Childs.push_back(&child); + child.Parent = this; + child.Index = cnt; +} +//------------------------------------------------------------------------------ + +PolyNode* PolyNode::GetNext() const +{ + if (Childs.size() > 0) + return Childs[0]; + else + return GetNextSiblingUp(); +} +//------------------------------------------------------------------------------ + +PolyNode* PolyNode::GetNextSiblingUp() const +{ + if (!Parent) //protects against PolyTree.GetNextSiblingUp() + return 0; + else if (Index == Parent->Childs.size() - 1) + return Parent->GetNextSiblingUp(); + else + return Parent->Childs[Index + 1]; +} +//------------------------------------------------------------------------------ + +bool PolyNode::IsHole() const +{ + bool result = true; + PolyNode* node = Parent; + while (node) + { + result = !result; + node = node->Parent; + } + return result; +} //------------------------------------------------------------------------------ // Int128 class (enables safe math on signed 64bit integers) @@ -77,19 +159,20 @@ class Int128 { public: - long64 hi; ulong64 lo; + long64 hi; Int128(long64 _lo = 0) { - lo = (ulong64)_lo; - if (_lo < 0) hi = -1; else hi = 0; + lo = (ulong64)_lo; + if (_lo < 0) hi = -1; else hi = 0; } - Int128(const Int128 &val): hi(val.hi), lo(val.lo){} - Int128(const long64& _hi, const ulong64& _lo): hi(_hi), lo(_lo){} + Int128(const Int128 &val): lo(val.lo), hi(val.hi){} + Int128(const long64& _hi, const ulong64& _lo): lo(_lo), hi(_hi){} + long64 operator = (const long64 &val) { lo = (ulong64)val; @@ -157,7 +240,7 @@ class Int128 { if (lo == 0) return Int128(-hi,0); - else + else return Int128(~hi,~lo +1); } @@ -188,12 +271,12 @@ class Int128 } divisor.lo >>= 1; if ((divisor.hi & 1) == 1) - divisor.lo |= 0x8000000000000000LL; + divisor.lo |= 0x8000000000000000LL; divisor.hi = (ulong64)divisor.hi >> 1; cntr.lo >>= 1; if ((cntr.hi & 1) == 1) - cntr.lo |= 0x8000000000000000LL; + cntr.lo |= 0x8000000000000000LL; cntr.hi >>= 1; while (cntr.hi != 0 || cntr.lo != 0) @@ -206,12 +289,12 @@ class Int128 } divisor.lo >>= 1; if ((divisor.hi & 1) == 1) - divisor.lo |= 0x8000000000000000LL; + divisor.lo |= 0x8000000000000000LL; divisor.hi >>= 1; cntr.lo >>= 1; if ((cntr.hi & 1) == 1) - cntr.lo |= 0x8000000000000000LL; + cntr.lo |= 0x8000000000000000LL; cntr.hi >>= 1; } if (negate) result = -result; @@ -278,7 +361,7 @@ bool FullRangeNeeded(const Polygon &pts) return result; } //------------------------------------------------------------------------------ - + bool Orientation(const Polygon &poly) { return Area(poly) >= 0; @@ -360,8 +443,8 @@ bool PointInPolygon(const IntPoint &pt, OutPt *pp, bool UseFullInt64Range) { if ((((pp2->pt.Y <= pt.Y) && (pt.Y < pp2->prev->pt.Y)) || ((pp2->prev->pt.Y <= pt.Y) && (pt.Y < pp2->pt.Y))) && - Int128(pt.X - pp2->pt.X) < - Int128Mul(pp2->prev->pt.X - pp2->pt.X, pt.Y - pp2->pt.Y) / + Int128(pt.X - pp2->pt.X) < + Int128Mul(pp2->prev->pt.X - pp2->pt.X, pt.Y - pp2->pt.Y) / Int128(pp2->prev->pt.Y - pp2->pt.Y)) result = !result; pp2 = pp2->next; @@ -423,7 +506,7 @@ void SetDx(TEdge &e) e.deltaY = (e.ytop - e.ybot); if (e.deltaY == 0) e.dx = HORIZONTAL; - else e.dx = (double)(e.deltaX) / (e.deltaY); + else e.dx = (double)(e.deltaX) / e.deltaY; } //--------------------------------------------------------------------------- @@ -460,14 +543,18 @@ bool IntersectPoint(TEdge &edge1, TEdge &edge2, IntPoint &ip, bool UseFullInt64Range) { double b1, b2; - if (SlopesEqual(edge1, edge2, UseFullInt64Range)) return false; + if (SlopesEqual(edge1, edge2, UseFullInt64Range)) + { + if (edge2.ybot > edge1.ybot) ip.Y = edge2.ybot; + else ip.Y = edge1.ybot; + return false; + } else if (NEAR_ZERO(edge1.dx)) { ip.X = edge1.xbot; if (NEAR_EQUAL(edge2.dx, HORIZONTAL)) - { ip.Y = edge2.ybot; - } else + else { b2 = edge2.ybot - (edge2.xbot / edge2.dx); ip.Y = Round(ip.X / edge2.dx + b2); @@ -477,14 +564,14 @@ bool IntersectPoint(TEdge &edge1, TEdge &edge2, { ip.X = edge2.xbot; if (NEAR_EQUAL(edge1.dx, HORIZONTAL)) - { ip.Y = edge1.ybot; - } else + else { b1 = edge1.ybot - (edge1.xbot / edge1.dx); ip.Y = Round(ip.X / edge1.dx + b1); } - } else + } + else { b1 = edge1.xbot - edge1.ybot * edge1.dx; b2 = edge2.xbot - edge2.ybot * edge2.dx; @@ -492,25 +579,26 @@ bool IntersectPoint(TEdge &edge1, TEdge &edge2, ip.Y = Round(q); if (std::fabs(edge1.dx) < std::fabs(edge2.dx)) ip.X = Round(edge1.dx * q + b1); - else + else ip.X = Round(edge2.dx * q + b2); } - if (ip.Y < edge1.ytop || ip.Y < edge2.ytop) + if (ip.Y < edge1.ytop || ip.Y < edge2.ytop) { if (edge1.ytop > edge2.ytop) { ip.X = edge1.xtop; ip.Y = edge1.ytop; return TopX(edge2, edge1.ytop) < edge1.xtop; - } else + } + else { ip.X = edge2.xtop; ip.Y = edge2.ytop; return TopX(edge1, edge2.ytop) > edge2.xtop; } - } - else + } + else return true; } //------------------------------------------------------------------------------ @@ -670,7 +758,8 @@ OutPt* GetBottomPt(OutPt *pp) } //------------------------------------------------------------------------------ -bool FindSegment(OutPt* &pp, IntPoint &pt1, IntPoint &pt2) +bool FindSegment(OutPt* &pp, bool UseFullInt64Range, + IntPoint &pt1, IntPoint &pt2) { //outPt1 & outPt2 => the overlap segment (if the function returns true) if (!pp) return false; @@ -678,8 +767,8 @@ bool FindSegment(OutPt* &pp, IntPoint &pt1, IntPoint &pt2) IntPoint pt1a = pt1, pt2a = pt2; do { - if (SlopesEqual(pt1a, pt2a, pp->pt, pp->prev->pt, true) && - SlopesEqual(pt1a, pt2a, pp->pt, true) && + if (SlopesEqual(pt1a, pt2a, pp->pt, pp->prev->pt, UseFullInt64Range) && + SlopesEqual(pt1a, pt2a, pp->pt, UseFullInt64Range) && GetOverlapSegment(pt1a, pt2a, pp->pt, pp->prev->pt, pt1, pt2)) return true; pp = pp->next; @@ -1081,7 +1170,7 @@ bool Clipper::Execute(ClipType clipType, Polygons &solution, m_SubjFillType = subjFillType; m_ClipFillType = clipFillType; m_ClipType = clipType; - m_UsingExPolygons = false; + m_UsingPolyTree = false; bool succeeded = ExecuteInternal(); if (succeeded) BuildResult(solution); m_ExecuteLocked = false; @@ -1089,79 +1178,34 @@ bool Clipper::Execute(ClipType clipType, Polygons &solution, } //------------------------------------------------------------------------------ -bool Clipper::Execute(ClipType clipType, ExPolygons &solution, +bool Clipper::Execute(ClipType clipType, PolyTree& polytree, PolyFillType subjFillType, PolyFillType clipFillType) { if( m_ExecuteLocked ) return false; m_ExecuteLocked = true; - solution.resize(0); m_SubjFillType = subjFillType; m_ClipFillType = clipFillType; m_ClipType = clipType; - m_UsingExPolygons = true; + m_UsingPolyTree = true; bool succeeded = ExecuteInternal(); - if (succeeded) BuildResultEx(solution); + if (succeeded) BuildResult2(polytree); m_ExecuteLocked = false; return succeeded; } //------------------------------------------------------------------------------ -bool PolySort(OutRec *or1, OutRec *or2) +void Clipper::FixHoleLinkage(OutRec &outRec) { - if (or1 == or2) return false; - if (!or1->pts || !or2->pts) - { - if (or1->pts != or2->pts) - { - return or1->pts ? true : false; - } - else return false; - } - int i1, i2; - if (or1->isHole) - i1 = or1->FirstLeft->idx; else - i1 = or1->idx; - if (or2->isHole) - i2 = or2->FirstLeft->idx; else - i2 = or2->idx; - int result = i1 - i2; - if (result == 0 && (or1->isHole != or2->isHole)) - { - return or1->isHole ? false : true; - } - else return result < 0; -} -//------------------------------------------------------------------------------ + //skip OutRecs that (a) contain outermost polygons or + //(b) already have the correct owner/child linkage ... + if (!outRec.FirstLeft || + (outRec.isHole != outRec.FirstLeft->isHole && + outRec.FirstLeft->pts)) return; -OutRec* FindAppendLinkEnd(OutRec *outRec) -{ - while (outRec->AppendLink) outRec = outRec->AppendLink; - return outRec; -} -//------------------------------------------------------------------------------ - -void Clipper::FixHoleLinkage(OutRec *outRec) -{ - OutRec *tmp; - if (outRec->bottomPt) - tmp = m_PolyOuts[outRec->bottomPt->idx]->FirstLeft; - else - tmp = outRec->FirstLeft; - if (outRec == tmp) throw clipperException("HoleLinkage error"); - - if (tmp) - { - if (tmp->AppendLink) tmp = FindAppendLinkEnd(tmp); - if (tmp == outRec) tmp = 0; - else if (tmp->isHole) - { - FixHoleLinkage(tmp); - tmp = tmp->FirstLeft; - } - } - outRec->FirstLeft = tmp; - if (!tmp) outRec->isHole = false; - outRec->AppendLink = 0; + OutRec* orfl = outRec.FirstLeft; + while (orfl && ((orfl->isHole == outRec.isHole) || !orfl->pts)) + orfl = orfl->FirstLeft; + outRec.FirstLeft = orfl; } //------------------------------------------------------------------------------ @@ -1196,15 +1240,12 @@ bool Clipper::ExecuteInternal() if (!outRec->pts) continue; FixupOutPolygon(*outRec); if (!outRec->pts) continue; - if (outRec->isHole && m_UsingExPolygons) FixHoleLinkage(outRec); if ((outRec->isHole ^ m_ReverseOutput) == (Area(*outRec, m_UseFullRange) > 0)) ReversePolyPtLinks(outRec->pts); } if (m_Joins.size() > 0) JoinCommonEdges(); - if (m_UsingExPolygons) - std::sort(m_PolyOuts.begin(), m_PolyOuts.end(), PolySort); } ClearJoins(); @@ -1357,11 +1398,11 @@ bool Clipper::IsContributing(const TEdge& edge) const switch(pft) { - case pftEvenOdd: + case pftEvenOdd: case pftNonZero: if (Abs(edge.windCnt) != 1) return false; break; - case pftPositive: + case pftPositive: if (edge.windCnt != 1) return false; break; default: //pftNegative @@ -1373,46 +1414,46 @@ bool Clipper::IsContributing(const TEdge& edge) const case ctIntersection: switch(pft2) { - case pftEvenOdd: - case pftNonZero: + case pftEvenOdd: + case pftNonZero: return (edge.windCnt2 != 0); - case pftPositive: + case pftPositive: return (edge.windCnt2 > 0); - default: + default: return (edge.windCnt2 < 0); } case ctUnion: switch(pft2) { - case pftEvenOdd: - case pftNonZero: + case pftEvenOdd: + case pftNonZero: return (edge.windCnt2 == 0); - case pftPositive: + case pftPositive: return (edge.windCnt2 <= 0); - default: + default: return (edge.windCnt2 >= 0); } case ctDifference: if (edge.polyType == ptSubject) switch(pft2) { - case pftEvenOdd: - case pftNonZero: + case pftEvenOdd: + case pftNonZero: return (edge.windCnt2 == 0); - case pftPositive: + case pftPositive: return (edge.windCnt2 <= 0); - default: + default: return (edge.windCnt2 >= 0); } else switch(pft2) { - case pftEvenOdd: - case pftNonZero: + case pftEvenOdd: + case pftNonZero: return (edge.windCnt2 != 0); - case pftPositive: + case pftPositive: return (edge.windCnt2 > 0); - default: + default: return (edge.windCnt2 < 0); } default: @@ -1432,7 +1473,7 @@ void Clipper::AddLocalMinPoly(TEdge *e1, TEdge *e2, const IntPoint &pt) e2->side = esRight; e = e1; if (e->prevInAEL == e2) - prevE = e2->prevInAEL; + prevE = e2->prevInAEL; else prevE = e->prevInAEL; } else @@ -1462,9 +1503,9 @@ void Clipper::AddLocalMaxPoly(TEdge *e1, TEdge *e2, const IntPoint &pt) e1->outIdx = -1; e2->outIdx = -1; } - else if (e1->outIdx < e2->outIdx) - AppendPolygon(e1, e2); - else + else if (e1->outIdx < e2->outIdx) + AppendPolygon(e1, e2); + else AppendPolygon(e2, e1); } //------------------------------------------------------------------------------ @@ -1493,14 +1534,10 @@ void Clipper::CopyAELToSEL() { TEdge* e = m_ActiveEdges; m_SortedEdges = e; - if (!m_ActiveEdges) return; - m_SortedEdges->prevInSEL = 0; - e = e->nextInAEL; while ( e ) { e->prevInSEL = e->prevInAEL; - e->prevInSEL->nextInSEL = e; - e->nextInSEL = 0; + e->nextInSEL = e->nextInAEL; e = e->nextInAEL; } } @@ -1585,21 +1622,18 @@ void Clipper::InsertLocalMinimaIntoAEL(const long64 botY) AddLocalMinPoly( lb, rb, IntPoint(lb->xcurr, m_CurrentLM->Y) ); //if any output polygons share an edge, they'll need joining later ... - if (rb->outIdx >= 0) + if (rb->outIdx >= 0 && NEAR_EQUAL(rb->dx, HORIZONTAL)) { - if (NEAR_EQUAL(rb->dx, HORIZONTAL)) + for (HorzJoinList::size_type i = 0; i < m_HorizJoins.size(); ++i) { - for (HorzJoinList::size_type i = 0; i < m_HorizJoins.size(); ++i) - { - IntPoint pt, pt2; //returned by GetOverlapSegment() but unused here. - HorzJoinRec* hj = m_HorizJoins[i]; - //if horizontals rb and hj.edge overlap, flag for joining later ... - if (GetOverlapSegment(IntPoint(hj->edge->xbot, hj->edge->ybot), - IntPoint(hj->edge->xtop, hj->edge->ytop), - IntPoint(rb->xbot, rb->ybot), - IntPoint(rb->xtop, rb->ytop), pt, pt2)) - AddJoin(hj->edge, rb, hj->savedIdx); - } + IntPoint pt, pt2; //returned by GetOverlapSegment() but unused here. + HorzJoinRec* hj = m_HorizJoins[i]; + //if horizontals rb and hj.edge overlap, flag for joining later ... + if (GetOverlapSegment(IntPoint(hj->edge->xbot, hj->edge->ybot), + IntPoint(hj->edge->xtop, hj->edge->ytop), + IntPoint(rb->xbot, rb->ybot), + IntPoint(rb->xtop, rb->ytop), pt, pt2)) + AddJoin(hj->edge, rb, hj->savedIdx); } } @@ -1723,28 +1757,22 @@ void Clipper::IntersectEdges(TEdge *e1, TEdge *e2, if ( e1Contributing && e2contributing ) { - if ( e1stops || e2stops || + if ( e1stops || e2stops || (e1Wc != 0 && e1Wc != 1) || (e2Wc != 0 && e2Wc != 1) || (e1->polyType != e2->polyType && m_ClipType != ctXor) ) - AddLocalMaxPoly(e1, e2, pt); + AddLocalMaxPoly(e1, e2, pt); else DoBothEdges( e1, e2, pt ); } else if ( e1Contributing ) { - if ((e2Wc == 0 || e2Wc == 1) && - (m_ClipType != ctIntersection || - e2->polyType == ptSubject || (e2->windCnt2 != 0))) - DoEdge1(e1, e2, pt); + if (e2Wc == 0 || e2Wc == 1) DoEdge1(e1, e2, pt); } else if ( e2contributing ) { - if ((e1Wc == 0 || e1Wc == 1) && - (m_ClipType != ctIntersection || - e1->polyType == ptSubject || (e1->windCnt2 != 0))) - DoEdge2(e1, e2, pt); - } - else if ( (e1Wc == 0 || e1Wc == 1) && + if (e1Wc == 0 || e1Wc == 1) DoEdge2(e1, e2, pt); + } + else if ( (e1Wc == 0 || e1Wc == 1) && (e2Wc == 0 || e2Wc == 1) && !e1stops && !e2stops ) { //neither edge is currently contributing ... @@ -1852,11 +1880,11 @@ void Clipper::AppendPolygon(TEdge *e1, TEdge *e2) OutRec *outRec2 = m_PolyOuts[e2->outIdx]; OutRec *holeStateRec; - if (Param1RightOfParam2(outRec1, outRec2)) + if (Param1RightOfParam2(outRec1, outRec2)) holeStateRec = outRec2; - else if (Param1RightOfParam2(outRec2, outRec1)) + else if (Param1RightOfParam2(outRec2, outRec1)) holeStateRec = outRec1; - else + else holeStateRec = GetLowermostRec(outRec1, outRec2); OutPt* p1_lft = outRec1->pts; @@ -1918,7 +1946,9 @@ void Clipper::AppendPolygon(TEdge *e1, TEdge *e2) } outRec2->pts = 0; outRec2->bottomPt = 0; - outRec2->AppendLink = outRec1; + + outRec2->FirstLeft = outRec1; + int OKIdx = e1->outIdx; int ObsoleteIdx = e2->outIdx; @@ -1957,9 +1987,9 @@ OutRec* Clipper::CreateOutRec() OutRec* result = new OutRec; result->isHole = false; result->FirstLeft = 0; - result->AppendLink = 0; result->pts = 0; result->bottomPt = 0; + result->polyNode = 0; return result; } //------------------------------------------------------------------------------ @@ -2056,9 +2086,6 @@ TEdge *GetMaximaPair(TEdge *e) void Clipper::SwapPositionsInAEL(TEdge *edge1, TEdge *edge2) { - if( !edge1->nextInAEL && !edge1->prevInAEL ) return; - if( !edge2->nextInAEL && !edge2->prevInAEL ) return; - if( edge1->nextInAEL == edge2 ) { TEdge* next = edge2->nextInAEL; @@ -2176,28 +2203,28 @@ void Clipper::ProcessHorizontal(TEdge *horzEdge) TEdge* e = GetNextInAEL( horzEdge , dir ); while( e ) { + if ( e->xcurr == horzEdge->xtop && !eMaxPair ) + { + if (SlopesEqual(*e, *horzEdge->nextInLML, m_UseFullRange)) + { + //if output polygons share an edge, they'll need joining later ... + if (horzEdge->outIdx >= 0 && e->outIdx >= 0) + AddJoin(horzEdge->nextInLML, e, horzEdge->outIdx); + break; //we've reached the end of the horizontal line + } + else if (e->dx < horzEdge->nextInLML->dx) + //we really have got to the end of the intermediate horz edge so quit. + //nb: More -ve slopes follow more +ve slopes ABOVE the horizontal. + break; + } + TEdge* eNext = GetNextInAEL( e, dir ); if (eMaxPair || - ((dir == dLeftToRight) && (e->xcurr <= horzRight)) || - ((dir == dRightToLeft) && (e->xcurr >= horzLeft))) + ((dir == dLeftToRight) && (e->xcurr < horzRight)) || + ((dir == dRightToLeft) && (e->xcurr > horzLeft))) { - //ok, so far it looks like we're still in range of the horizontal edge - if ( e->xcurr == horzEdge->xtop && !eMaxPair ) - { - if (SlopesEqual(*e, *horzEdge->nextInLML, m_UseFullRange)) - { - //if output polygons share an edge, they'll need joining later ... - if (horzEdge->outIdx >= 0 && e->outIdx >= 0) - AddJoin(horzEdge->nextInLML, e, horzEdge->outIdx); - break; //we've reached the end of the horizontal line - } - else if (e->dx < horzEdge->nextInLML->dx) - //we really have got to the end of the intermediate horz edge so quit. - //nb: More -ve slopes follow more +ve slopes ABOVE the horizontal. - break; - } - + //so far we're still in range of the horizontal edge if( e == eMaxPair ) { //horzEdge is evidently a maxima horizontal and we've arrived at its end. @@ -2233,8 +2260,8 @@ void Clipper::ProcessHorizontal(TEdge *horzEdge) } SwapPositionsInAEL( horzEdge, e ); } - else if( (dir == dLeftToRight && e->xcurr > horzRight && m_SortedEdges) || - (dir == dRightToLeft && e->xcurr < horzLeft && m_SortedEdges) ) break; + else if( (dir == dLeftToRight && e->xcurr >= horzRight) || + (dir == dRightToLeft && e->xcurr <= horzLeft) ) break; e = eNext; } //end while @@ -2283,7 +2310,7 @@ bool Clipper::ProcessIntersections(const long64 botY, const long64 topY) try { BuildIntersectList(botY, topY); if ( !m_IntersectNodes) return true; - if ( FixupIntersections() ) ProcessIntersectList(); + if ( FixupIntersectionOrder() ) ProcessIntersectList(); else return false; } catch(...) { @@ -2312,16 +2339,12 @@ void Clipper::BuildIntersectList(const long64 botY, const long64 topY) //prepare for sorting ... TEdge* e = m_ActiveEdges; - e->tmpX = TopX( *e, topY ); m_SortedEdges = e; - m_SortedEdges->prevInSEL = 0; - e = e->nextInAEL; while( e ) { e->prevInSEL = e->prevInAEL; - e->prevInSEL->nextInSEL = e; - e->nextInSEL = 0; - e->tmpX = TopX( *e, topY ); + e->nextInSEL = e->nextInAEL; + e->xcurr = TopX( *e, topY ); e = e->nextInAEL; } @@ -2335,9 +2358,10 @@ void Clipper::BuildIntersectList(const long64 botY, const long64 topY) { TEdge *eNext = e->nextInSEL; IntPoint pt; - if(e->tmpX > eNext->tmpX && - IntersectPoint(*e, *eNext, pt, m_UseFullRange)) + if(e->xcurr > eNext->xcurr) { + if (!IntersectPoint(*e, *eNext, pt, m_UseFullRange) && e->xcurr > eNext->xcurr +1) + throw clipperException("Intersection error"); if (pt.Y > botY) { pt.Y = botY; @@ -2427,7 +2451,8 @@ void Clipper::DoMaxima(TEdge *e, long64 topY) { if (!eNext) throw clipperException("DoMaxima error"); IntersectEdges( e, eNext, IntPoint(X, topY), ipBoth ); - eNext = eNext->nextInAEL; + SwapPositionsInAEL(e, eNext); + eNext = e->nextInAEL; } if( e->outIdx < 0 && eMaxPair->outIdx < 0 ) { @@ -2575,61 +2600,77 @@ void Clipper::FixupOutPolygon(OutRec &outRec) void Clipper::BuildResult(Polygons &polys) { - int k = 0; - polys.resize(m_PolyOuts.size()); + polys.reserve(m_PolyOuts.size()); for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i) { if (m_PolyOuts[i]->pts) { - Polygon* pg = &polys[k]; - pg->clear(); + Polygon pg; OutPt* p = m_PolyOuts[i]->pts; do { - pg->push_back(p->pt); - p = p->prev; - } while (p != m_PolyOuts[i]->pts); - //make sure each polygon has at least 3 vertices ... - if (pg->size() < 3) pg->clear(); else k++; - } - } - polys.resize(k); -} -//------------------------------------------------------------------------------ - -void Clipper::BuildResultEx(ExPolygons &polys) -{ - PolyOutList::size_type i = 0; - int k = 0; - polys.resize(0); - polys.reserve(m_PolyOuts.size()); - while (i < m_PolyOuts.size() && m_PolyOuts[i]->pts) - { - ExPolygon epg; - OutPt* p = m_PolyOuts[i]->pts; - do { - epg.outer.push_back(p->pt); - p = p->prev; - } while (p != m_PolyOuts[i]->pts); - i++; - //make sure polygons have at least 3 vertices ... - if (epg.outer.size() < 3) continue; - while (i < m_PolyOuts.size() - && m_PolyOuts[i]->pts && m_PolyOuts[i]->isHole) - { - Polygon pg; - p = m_PolyOuts[i]->pts; - do { pg.push_back(p->pt); p = p->prev; } while (p != m_PolyOuts[i]->pts); - epg.holes.push_back(pg); - i++; + if (pg.size() > 2) + polys.push_back(pg); } - polys.push_back(epg); - k++; } - polys.resize(k); +} +//------------------------------------------------------------------------------ + +int PointCount(OutPt *pts) +{ + if (!pts) return 0; + int result = 0; + OutPt* p = pts; + do + { + result++; + p = p->next; + } + while (p != pts); + return result; +} +//------------------------------------------------------------------------------ + +void Clipper::BuildResult2(PolyTree& polytree) +{ + polytree.Clear(); + polytree.AllNodes.reserve(m_PolyOuts.size()); + //add each output polygon/contour to polytree ... + for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); i++) + { + OutRec* outRec = m_PolyOuts[i]; + int cnt = PointCount(outRec->pts); + if (cnt < 3) continue; + FixHoleLinkage(*outRec); + PolyNode* pn = new PolyNode(); + //nb: polytree takes ownership of all the PolyNodes + polytree.AllNodes.push_back(pn); + outRec->polyNode = pn; + pn->Parent = 0; + pn->Index = 0; + pn->Contour.reserve(cnt); + OutPt *op = outRec->pts; + for (int j = 0; j < cnt; j++) + { + pn->Contour.push_back(op->pt); + op = op->prev; + } + } + + //fixup PolyNode links etc ... + polytree.Childs.reserve(m_PolyOuts.size()); + for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); i++) + { + OutRec* outRec = m_PolyOuts[i]; + if (!outRec->polyNode) continue; + if (outRec->FirstLeft) + outRec->FirstLeft->polyNode->AddChild(*outRec->polyNode); + else + polytree.AddChild(*outRec->polyNode); + } } //------------------------------------------------------------------------------ @@ -2649,7 +2690,7 @@ void SwapIntersectNodes(IntersectNode &int1, IntersectNode &int2) } //------------------------------------------------------------------------------ -bool Clipper::FixupIntersections() +bool Clipper::FixupIntersectionOrder() { if ( !m_IntersectNodes->next ) return true; @@ -2664,8 +2705,8 @@ bool Clipper::FixupIntersections() else if (e1->nextInSEL == int1->edge2) e2 = e1->nextInSEL; else { - //The current intersection is out of order, so try and swap it with - //a subsequent intersection ... + //The current intersection (Int1) is out of order (since it doesn't + //contain adjacent edges), so swap it with a subsequent intersection ... while (int2) { if (int2->edge1->nextInSEL == int2->edge2 || @@ -2674,7 +2715,8 @@ bool Clipper::FixupIntersections() } if ( !int2 ) return false; //oops!!! - //found an intersect node that can be swapped ... + //found an intersect node (Int2) that does contain adjacent edges, + //so prepare to process it before Int1 ... SwapIntersectNodes(*int1, *int2); e1 = int1->edge1; e2 = int1->edge2; @@ -2751,72 +2793,73 @@ void Clipper::DoBothEdges(TEdge *edge1, TEdge *edge2, const IntPoint &pt) bool Clipper::JoinPoints(const JoinRec *j, OutPt *&p1, OutPt *&p2) { - OutRec *outRec1 = m_PolyOuts[j->poly1Idx]; - OutRec *outRec2 = m_PolyOuts[j->poly2Idx]; - if (!outRec1 || !outRec2) return false; - OutPt *pp1a = outRec1->pts; - OutPt *pp2a = outRec2->pts; - IntPoint pt1 = j->pt2a, pt2 = j->pt2b; - IntPoint pt3 = j->pt1a, pt4 = j->pt1b; - if (!FindSegment(pp1a, pt1, pt2)) return false; - if (outRec1 == outRec2) - { - //we're searching the same polygon for overlapping segments so - //segment 2 mustn't be the same as segment 1 ... - pp2a = pp1a->next; - if (!FindSegment(pp2a, pt3, pt4) || (pp2a == pp1a)) return false; - } - else if (!FindSegment(pp2a, pt3, pt4)) return false; + OutRec *outRec1 = m_PolyOuts[j->poly1Idx]; + OutRec *outRec2 = m_PolyOuts[j->poly2Idx]; + if (!outRec1 || !outRec2) return false; + OutPt *pp1a = outRec1->pts; + OutPt *pp2a = outRec2->pts; + IntPoint pt1 = j->pt2a, pt2 = j->pt2b; + IntPoint pt3 = j->pt1a, pt4 = j->pt1b; + if (!FindSegment(pp1a, m_UseFullRange, pt1, pt2)) return false; + if (outRec1 == outRec2) + { + //we're searching the same polygon for overlapping segments so + //segment 2 mustn't be the same as segment 1 ... + pp2a = pp1a->next; + if (!FindSegment(pp2a, m_UseFullRange, pt3, pt4) || (pp2a == pp1a)) + return false; + } + else if (!FindSegment(pp2a, m_UseFullRange, pt3, pt4)) return false; - if (!GetOverlapSegment(pt1, pt2, pt3, pt4, pt1, pt2)) return false; + if (!GetOverlapSegment(pt1, pt2, pt3, pt4, pt1, pt2)) return false; - OutPt *p3, *p4, *prev = pp1a->prev; - //get p1 & p2 polypts - the overlap start & endpoints on poly1 - if (PointsEqual(pp1a->pt, pt1)) p1 = pp1a; - else if (PointsEqual(prev->pt, pt1)) p1 = prev; - else p1 = InsertPolyPtBetween(pp1a, prev, pt1); + OutPt *p3, *p4, *prev = pp1a->prev; + //get p1 & p2 polypts - the overlap start & endpoints on poly1 + if (PointsEqual(pp1a->pt, pt1)) p1 = pp1a; + else if (PointsEqual(prev->pt, pt1)) p1 = prev; + else p1 = InsertPolyPtBetween(pp1a, prev, pt1); - if (PointsEqual(pp1a->pt, pt2)) p2 = pp1a; - else if (PointsEqual(prev->pt, pt2)) p2 = prev; - else if ((p1 == pp1a) || (p1 == prev)) - p2 = InsertPolyPtBetween(pp1a, prev, pt2); - else if (Pt3IsBetweenPt1AndPt2(pp1a->pt, p1->pt, pt2)) - p2 = InsertPolyPtBetween(pp1a, p1, pt2); else - p2 = InsertPolyPtBetween(p1, prev, pt2); + if (PointsEqual(pp1a->pt, pt2)) p2 = pp1a; + else if (PointsEqual(prev->pt, pt2)) p2 = prev; + else if ((p1 == pp1a) || (p1 == prev)) + p2 = InsertPolyPtBetween(pp1a, prev, pt2); + else if (Pt3IsBetweenPt1AndPt2(pp1a->pt, p1->pt, pt2)) + p2 = InsertPolyPtBetween(pp1a, p1, pt2); else + p2 = InsertPolyPtBetween(p1, prev, pt2); - //get p3 & p4 polypts - the overlap start & endpoints on poly2 - prev = pp2a->prev; - if (PointsEqual(pp2a->pt, pt1)) p3 = pp2a; - else if (PointsEqual(prev->pt, pt1)) p3 = prev; - else p3 = InsertPolyPtBetween(pp2a, prev, pt1); + //get p3 & p4 polypts - the overlap start & endpoints on poly2 + prev = pp2a->prev; + if (PointsEqual(pp2a->pt, pt1)) p3 = pp2a; + else if (PointsEqual(prev->pt, pt1)) p3 = prev; + else p3 = InsertPolyPtBetween(pp2a, prev, pt1); - if (PointsEqual(pp2a->pt, pt2)) p4 = pp2a; - else if (PointsEqual(prev->pt, pt2)) p4 = prev; - else if ((p3 == pp2a) || (p3 == prev)) - p4 = InsertPolyPtBetween(pp2a, prev, pt2); - else if (Pt3IsBetweenPt1AndPt2(pp2a->pt, p3->pt, pt2)) - p4 = InsertPolyPtBetween(pp2a, p3, pt2); else - p4 = InsertPolyPtBetween(p3, prev, pt2); + if (PointsEqual(pp2a->pt, pt2)) p4 = pp2a; + else if (PointsEqual(prev->pt, pt2)) p4 = prev; + else if ((p3 == pp2a) || (p3 == prev)) + p4 = InsertPolyPtBetween(pp2a, prev, pt2); + else if (Pt3IsBetweenPt1AndPt2(pp2a->pt, p3->pt, pt2)) + p4 = InsertPolyPtBetween(pp2a, p3, pt2); else + p4 = InsertPolyPtBetween(p3, prev, pt2); - //p1.pt == p3.pt and p2.pt == p4.pt so join p1 to p3 and p2 to p4 ... - if (p1->next == p2 && p3->prev == p4) - { - p1->next = p3; - p3->prev = p1; - p2->prev = p4; - p4->next = p2; - return true; - } - else if (p1->prev == p2 && p3->next == p4) - { - p1->prev = p3; - p3->next = p1; - p2->next = p4; - p4->prev = p2; - return true; - } - else - return false; //an orientation is probably wrong + //p1.pt == p3.pt and p2.pt == p4.pt so join p1 to p3 and p2 to p4 ... + if (p1->next == p2 && p3->prev == p4) + { + p1->next = p3; + p3->prev = p1; + p2->prev = p4; + p4->next = p2; + return true; + } + else if (p1->prev == p2 && p3->next == p4) + { + p1->prev = p3; + p3->next = p1; + p2->next = p4; + p4->prev = p2; + return true; + } + else + return false; //an orientation is probably wrong } //---------------------------------------------------------------------- @@ -2833,17 +2876,76 @@ void Clipper::FixupJoinRecs(JoinRec *j, OutPt *pt, unsigned startIdx) } //---------------------------------------------------------------------- +bool Poly2ContainsPoly1(OutPt* outPt1, OutPt* outPt2, bool UseFullInt64Range) +{ + //find the first pt in outPt1 that isn't also a vertex of outPt2 ... + OutPt* outPt = outPt1; + do + { + if (!PointIsVertex(outPt->pt, outPt2)) break; + outPt = outPt->next; + } + while (outPt != outPt1); + bool result; + //sometimes a point on one polygon can be touching the other polygon + //so to be totally confident outPt1 is inside outPt2 repeat ... + do + { + result = PointInPolygon(outPt->pt, outPt2, UseFullInt64Range); + outPt = outPt->next; + } + while (result && outPt != outPt1); + return result; +} +//---------------------------------------------------------------------- + +void Clipper::FixupFirstLefts1(OutRec* OldOutRec, OutRec* NewOutRec) +{ + + for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i) + { + OutRec* outRec = m_PolyOuts[i]; + if (outRec->pts && outRec->FirstLeft == OldOutRec) + { + if (Poly2ContainsPoly1(outRec->pts, NewOutRec->pts, m_UseFullRange)) + outRec->FirstLeft = NewOutRec; + } + } +} +//---------------------------------------------------------------------- + +void Clipper::FixupFirstLefts2(OutRec* OldOutRec, OutRec* NewOutRec) +{ + for (PolyOutList::size_type i = 0; i < m_PolyOuts.size(); ++i) + { + OutRec* outRec = m_PolyOuts[i]; + if (outRec->FirstLeft == OldOutRec) outRec->FirstLeft = NewOutRec; + } +} +//---------------------------------------------------------------------- + void Clipper::JoinCommonEdges() { for (JoinList::size_type i = 0; i < m_Joins.size(); i++) { JoinRec* j = m_Joins[i]; - OutPt *p1, *p2; - if (!JoinPoints(j, p1, p2)) continue; OutRec *outRec1 = m_PolyOuts[j->poly1Idx]; OutRec *outRec2 = m_PolyOuts[j->poly2Idx]; + if (!outRec1->pts || !outRec2->pts) continue; + + //get the polygon fragment with the correct hole state (FirstLeft) + //before calling JoinPoints() ... + OutRec *holeStateRec; + if (outRec1 == outRec2) holeStateRec = outRec1; + else if (Param1RightOfParam2(outRec1, outRec2)) holeStateRec = outRec2; + else if (Param1RightOfParam2(outRec2, outRec1)) holeStateRec = outRec1; + else holeStateRec = GetLowermostRec(outRec1, outRec2); + + OutPt *p1, *p2; + if (!JoinPoints(j, p1, p2)) continue; + if (outRec1 == outRec2) { //instead of joining two polygons, we've just created a new one by @@ -2859,21 +2961,25 @@ void Clipper::JoinCommonEdges() outRec2->bottomPt = outRec2->pts; outRec2->bottomPt->idx = outRec2->idx; - if (PointInPolygon(outRec2->pts->pt, outRec1->pts, m_UseFullRange)) + if (Poly2ContainsPoly1(outRec2->pts, outRec1->pts, m_UseFullRange)) { //outRec2 is contained by outRec1 ... outRec2->isHole = !outRec1->isHole; outRec2->FirstLeft = outRec1; FixupJoinRecs(j, p2, i+1); + + //fixup FirstLeft pointers that may need reassigning to OutRec1 + if (m_UsingPolyTree) FixupFirstLefts2(outRec2, outRec1); + FixupOutPolygon(*outRec1); //nb: do this BEFORE testing orientation FixupOutPolygon(*outRec2); // but AFTER calling FixupJoinRecs() if ((outRec2->isHole ^ m_ReverseOutput) == (Area(*outRec2, m_UseFullRange) > 0)) ReversePolyPtLinks(outRec2->pts); - - } else if (PointInPolygon(outRec1->pts->pt, outRec2->pts, m_UseFullRange)) + + } else if (Poly2ContainsPoly1(outRec1->pts, outRec2->pts, m_UseFullRange)) { //outRec1 is contained by outRec2 ... outRec2->isHole = outRec1->isHole; @@ -2882,20 +2988,16 @@ void Clipper::JoinCommonEdges() outRec1->FirstLeft = outRec2; FixupJoinRecs(j, p2, i+1); + + //fixup FirstLeft pointers that may need reassigning to OutRec1 + if (m_UsingPolyTree) FixupFirstLefts2(outRec1, outRec2); + FixupOutPolygon(*outRec1); //nb: do this BEFORE testing orientation FixupOutPolygon(*outRec2); // but AFTER calling FixupJoinRecs() if ((outRec1->isHole ^ m_ReverseOutput) == (Area(*outRec1, m_UseFullRange) > 0)) ReversePolyPtLinks(outRec1->pts); - //make sure any contained holes now link to the correct polygon ... - if (m_UsingExPolygons && outRec1->isHole) - for (PolyOutList::size_type k = 0; k < m_PolyOuts.size(); ++k) - { - OutRec *orec = m_PolyOuts[k]; - if (orec->isHole && orec->bottomPt && orec->FirstLeft == outRec1) - orec->FirstLeft = outRec2; - } - } + } else { //the 2 polygons are completely separate ... @@ -2903,47 +3005,31 @@ void Clipper::JoinCommonEdges() outRec2->FirstLeft = outRec1->FirstLeft; FixupJoinRecs(j, p2, i+1); + + //fixup FirstLeft pointers that may need reassigning to OutRec2 + if (m_UsingPolyTree) FixupFirstLefts1(outRec1, outRec2); + FixupOutPolygon(*outRec1); //nb: do this BEFORE testing orientation FixupOutPolygon(*outRec2); // but AFTER calling FixupJoinRecs() - - if (m_UsingExPolygons && outRec2->pts) - for (PolyOutList::size_type k = 0; k < m_PolyOuts.size(); ++k) - { - OutRec *orec = m_PolyOuts[k]; - if (orec->isHole && orec->bottomPt && orec->FirstLeft == outRec1 && - PointInPolygon(orec->bottomPt->pt, outRec2->pts, m_UseFullRange)) - orec->FirstLeft = outRec2; - } } - + } else { //joined 2 polygons together ... - //make sure any holes contained by outRec2 now link to outRec1 ... - if (m_UsingExPolygons) - for (PolyOutList::size_type k = 0; k < m_PolyOuts.size(); ++k) - if (m_PolyOuts[k]->isHole && m_PolyOuts[k]->bottomPt && - m_PolyOuts[k]->FirstLeft == outRec2) - m_PolyOuts[k]->FirstLeft = outRec1; - - - //and cleanup redundant edges too ... + //cleanup redundant edges ... FixupOutPolygon(*outRec1); - if (outRec1->pts) - { - outRec1->isHole = Area(*outRec1, m_UseFullRange) < 0; - if (outRec1->isHole && !outRec1->FirstLeft) - outRec1->FirstLeft = outRec2->FirstLeft; - } - //delete the obsolete pointer ... int OKIdx = outRec1->idx; int ObsoleteIdx = outRec2->idx; outRec2->pts = 0; outRec2->bottomPt = 0; - outRec2->AppendLink = outRec1; + + outRec1->isHole = holeStateRec->isHole; + if (holeStateRec == outRec2) + outRec1->FirstLeft = outRec2->FirstLeft; + outRec2->FirstLeft = outRec1; //now fixup any subsequent Joins that match this polygon for (JoinList::size_type k = i+1; k < m_Joins.size(); k++) @@ -2952,6 +3038,9 @@ void Clipper::JoinCommonEdges() if (j2->poly1Idx == ObsoleteIdx) j2->poly1Idx = OKIdx; if (j2->poly2Idx == ObsoleteIdx) j2->poly2Idx = OKIdx; } + + //fixup FirstLeft pointers that may need reassigning to OutRec1 + if (m_UsingPolyTree) FixupFirstLefts2(outRec2, outRec1); } } } @@ -2982,19 +3071,26 @@ struct DoublePoint //------------------------------------------------------------------------------ Polygon BuildArc(const IntPoint &pt, - const double a1, const double a2, const double r) + const double a1, const double a2, const double r, double limit) { - long64 steps = std::max(6, int(std::sqrt(std::fabs(r)) * std::fabs(a2 - a1))); - if (steps > 0x100) steps = 0x100; - int n = (unsigned)steps; - Polygon result(n); - double da = (a2 - a1) / (n -1); - double a = a1; - for (int i = 0; i < n; ++i) + //see notes in clipper.pas regarding steps + double arcFrac = std::fabs(a2 - a1) / (2 * pi); + int steps = (int)(arcFrac * pi / std::acos(1 - limit / std::fabs(r))); + if (steps < 2) steps = 2; + else if (steps > (int)(222.0 * arcFrac)) steps = (int)(222.0 * arcFrac); + + double x = std::cos(a1); + double y = std::sin(a1); + double c = std::cos((a2 - a1) / steps); + double s = std::sin((a2 - a1) / steps); + Polygon result(steps +1); + for (int i = 0; i <= steps; ++i) { - result[i].X = pt.X + Round(std::cos(a)*r); - result[i].Y = pt.Y + Round(std::sin(a)*r); - a += da; + result[i].X = pt.X + Round(x * r); + result[i].Y = pt.Y + Round(y * r); + double x2 = x; + x = x * c - s * y; //cross product + y = x2 * s + y * c; //dot product } return result; } @@ -3002,7 +3098,7 @@ Polygon BuildArc(const IntPoint &pt, DoublePoint GetUnitNormal(const IntPoint &pt1, const IntPoint &pt2) { - if(pt2.X == pt1.X && pt2.Y == pt1.Y) + if(pt2.X == pt1.X && pt2.Y == pt1.Y) return DoublePoint(0, 0); double dx = (double)(pt2.X - pt1.X); @@ -3026,11 +3122,11 @@ private: size_t m_i, m_j, m_k; static const int buffLength = 128; JoinType m_jointype; - + public: PolyOffsetBuilder(const Polygons& in_polys, Polygons& out_polys, - double delta, JoinType jointype, double MiterLimit, bool AutoFix) + double delta, JoinType jointype, double limit, bool autoFix) { //nb precondition - out_polys != ptsin_polys if (NEAR_ZERO(delta)) @@ -3043,20 +3139,20 @@ PolyOffsetBuilder(const Polygons& in_polys, Polygons& out_polys, this->m_delta = delta; this->m_jointype = jointype; - //ChecksInput - fixes polygon orientation if necessary and removes + //ChecksInput - fixes polygon orientation if necessary and removes //duplicate vertices. Can be set false when you're sure that polygon //orientation is correct and that there are no duplicate vertices. - if (AutoFix) + if (autoFix) { size_t Len = m_p.size(), botI = 0; while (botI < Len && m_p[botI].size() == 0) botI++; if (botI == Len) return; - + //botPt: used to find the lowermost (in inverted Y-axis) & leftmost point - //This point (on m_p[botI]) must be on an outer polygon ring and if - //its orientation is false (counterclockwise) then assume all polygons + //This point (on m_p[botI]) must be on an outer polygon ring and if + //its orientation is false (counterclockwise) then assume all polygons //need reversing ... - IntPoint botPt = m_p[botI][0]; + IntPoint botPt = m_p[botI][0]; for (size_t i = botI; i < Len; ++i) { if (m_p[i].size() < 3) continue; @@ -3066,7 +3162,7 @@ PolyOffsetBuilder(const Polygons& in_polys, Polygons& out_polys, { if (PointsEqual(*it, *(it -1))) it = m_p[i].erase(it); - else + else { if (UpdateBotPt(*it, botPt)) botI = i; ++it; @@ -3077,9 +3173,20 @@ PolyOffsetBuilder(const Polygons& in_polys, Polygons& out_polys, ReversePolygons(m_p); } - if (MiterLimit <= 1) MiterLimit = 1; - m_RMin = 2.0/(MiterLimit*MiterLimit); - + switch (jointype) + { + case jtRound: + if (limit <= 0) limit = 0.25; + else if (limit > std::fabs(delta)) limit = std::fabs(delta); + break; + case jtMiter: + if (limit < 2) limit = 2; + break; + default: //unused + limit = 1; + } + m_RMin = 2.0/(limit*limit); + double deltaSq = delta*delta; out_polys.clear(); out_polys.resize(m_p.size()); @@ -3101,7 +3208,7 @@ PolyOffsetBuilder(const Polygons& in_polys, Polygons& out_polys, else if (len == 1) { Polygon arc; - arc = BuildArc(m_p[m_i][len-1], 0, 2 * pi, delta); + arc = BuildArc(m_p[m_i][len-1], 0, 2 * pi, delta, limit); out_polys[m_i] = arc; continue; } @@ -3112,7 +3219,7 @@ PolyOffsetBuilder(const Polygons& in_polys, Polygons& out_polys, normals[len-1] = GetUnitNormal(m_p[m_i][len-1], m_p[m_i][0]); for (m_j = 0; m_j < len -1; ++m_j) normals[m_j] = GetUnitNormal(m_p[m_i][m_j], m_p[m_i][m_j+1]); - + m_k = len -1; for (m_j = 0; m_j < len; ++m_j) { @@ -3120,13 +3227,13 @@ PolyOffsetBuilder(const Polygons& in_polys, Polygons& out_polys, { case jtMiter: { - m_R = 1 + (normals[m_j].X*normals[m_k].X + + m_R = 1 + (normals[m_j].X*normals[m_k].X + normals[m_j].Y*normals[m_k].Y); - if (m_R >= m_RMin) DoMiter(); else DoSquare(MiterLimit); + if (m_R >= m_RMin) DoMiter(); else DoSquare(limit); break; } - case jtSquare: DoSquare(); break; - case jtRound: DoRound(); break; + case jtSquare: DoSquare(1.0); break; + case jtRound: DoRound(limit); break; } m_k = m_j; } @@ -3165,14 +3272,13 @@ private: void AddPoint(const IntPoint& pt) { - Polygon::size_type len = m_curr_poly->size(); - if (len == m_curr_poly->capacity()) - m_curr_poly->reserve(len + buffLength); + if (m_curr_poly->size() == m_curr_poly->capacity()) + m_curr_poly->reserve(m_curr_poly->capacity() + buffLength); m_curr_poly->push_back(pt); } //------------------------------------------------------------------------------ -void DoSquare(double mul = 1.0) +void DoSquare(double mul) { IntPoint pt1 = IntPoint((long64)Round(m_p[m_i][m_j].X + normals[m_k].X * m_delta), (long64)Round(m_p[m_i][m_j].Y + normals[m_k].Y * m_delta)); @@ -3206,7 +3312,7 @@ void DoMiter() if ((normals[m_k].X * normals[m_j].Y - normals[m_j].X * normals[m_k].Y) * m_delta >= 0) { double q = m_delta / m_R; - AddPoint(IntPoint((long64)Round(m_p[m_i][m_j].X + + AddPoint(IntPoint((long64)Round(m_p[m_i][m_j].X + (normals[m_k].X + normals[m_j].X) * q), (long64)Round(m_p[m_i][m_j].Y + (normals[m_k].Y + normals[m_j].Y) * q))); } @@ -3223,7 +3329,7 @@ void DoMiter() } //------------------------------------------------------------------------------ -void DoRound() +void DoRound(double limit) { IntPoint pt1 = IntPoint((long64)Round(m_p[m_i][m_j].X + normals[m_k].X * m_delta), (long64)Round(m_p[m_i][m_j].Y + normals[m_k].Y * m_delta)); @@ -3239,7 +3345,7 @@ void DoRound() double a2 = std::atan2(normals[m_j].Y, normals[m_j].X); if (m_delta > 0 && a2 < a1) a2 += pi *2; else if (m_delta < 0 && a2 > a1) a2 -= pi *2; - Polygon arc = BuildArc(m_p[m_i][m_j], a1, a2, m_delta); + Polygon arc = BuildArc(m_p[m_i][m_j], a1, a2, m_delta, limit); for (Polygon::size_type m = 0; m < arc.size(); m++) AddPoint(arc[m]); } @@ -3267,14 +3373,14 @@ bool UpdateBotPt(const IntPoint &pt, IntPoint &botPt) //------------------------------------------------------------------------------ void OffsetPolygons(const Polygons &in_polys, Polygons &out_polys, - double delta, JoinType jointype, double MiterLimit, bool AutoFix) + double delta, JoinType jointype, double limit, bool autoFix) { if (&out_polys == &in_polys) { Polygons poly2(in_polys); - PolyOffsetBuilder(poly2, out_polys, delta, jointype, MiterLimit, AutoFix); + PolyOffsetBuilder(poly2, out_polys, delta, jointype, limit, autoFix); } - else PolyOffsetBuilder(in_polys, out_polys, delta, jointype, MiterLimit, AutoFix); + else PolyOffsetBuilder(in_polys, out_polys, delta, jointype, limit, autoFix); } //------------------------------------------------------------------------------ @@ -3300,6 +3406,86 @@ void SimplifyPolygons(Polygons &polys, PolyFillType fillType) } //------------------------------------------------------------------------------ +bool PointsAreClose(IntPoint pt1, IntPoint pt2, long64 distSqrd) +{ + long64 dx = pt1.X - pt2.X; + long64 dy = pt1.Y - pt2.Y; + return ((dx * dx) + (dy * dy) <= distSqrd); +} +//------------------------------------------------------------------------------ + +void CleanPolygon(Polygon& in_poly, Polygon& out_poly, double distance) +{ + //distance = proximity in units/pixels below which vertices + //will be stripped. Default ~= sqrt(2). + int highI = in_poly.size() -1; + long64 d = (int)(distance * distance); + while (highI > 0 && PointsAreClose(in_poly[highI], in_poly[0], d)) highI--; + if (highI < 2) + { + out_poly.clear(); + return; + } + out_poly.resize(highI + 1); + bool UseFullRange = FullRangeNeeded(in_poly); + IntPoint pt = in_poly[highI]; + int i = 0; + int k = 0; + for (;;) + { + if (i >= highI) break; + int j = i + 1; + + if (PointsAreClose(pt, in_poly[j], d)) + { + i = j + 1; + while (i <= highI && PointsAreClose(pt, in_poly[i], d)) i++; + continue; + } + + if (PointsAreClose(in_poly[i], in_poly[j], d) || + SlopesEqual(pt, in_poly[i], in_poly[j], UseFullRange)) + { + i = j; + continue; + } + + pt = in_poly[i++]; + out_poly[k++] = pt; + } + + if (i <= highI) out_poly[k++] = in_poly[i]; + if (k > 2 && SlopesEqual(out_poly[k -2], out_poly[k -1], out_poly[0], UseFullRange)) + k--; + if (k < 3) out_poly.clear(); + else if (k <= highI) out_poly.resize(k); +} +//------------------------------------------------------------------------------ + +void CleanPolygons(Polygons& in_polys, Polygons& out_polys, double distance) +{ + for (Polygons::size_type i = 0; i < in_polys.size(); ++i) + CleanPolygon(in_polys[i], out_polys[i], distance); +} +//------------------------------------------------------------------------------ + +void AddPolyNodeToPolygons(PolyNode& polynode, Polygons& polygons) +{ + if (polynode.Contour.size() > 0) + polygons.push_back(polynode.Contour); + for (int i = 0; i < polynode.ChildCount(); ++i) + AddPolyNodeToPolygons(*polynode.Childs[i], polygons); +} +//------------------------------------------------------------------------------ + +void PolyTreeToPolygons(PolyTree& polytree, Polygons& polygons) +{ + polygons.resize(0); + polygons.reserve(polytree.Total()); + AddPolyNodeToPolygons(polytree, polygons); +} +//------------------------------------------------------------------------------ + std::ostream& operator <<(std::ostream &s, IntPoint& p) { s << p.X << ' ' << p.Y << "\n"; diff --git a/polygon/clipper.hpp b/polygon/clipper.hpp index 20371ab5c8..16540f327b 100644 --- a/polygon/clipper.hpp +++ b/polygon/clipper.hpp @@ -1,8 +1,8 @@ /******************************************************************************* * * * Author : Angus Johnson * -* Version : 5.0.3 * -* Date : 12 January 2013 * +* Version : 5.1.4 * +* Date : 24 March 2013 * * Website : http://www.angusj.com * * Copyright : Angus Johnson 2010-2013 * * * @@ -26,7 +26,7 @@ * Paper no. DETC2005-85513 pp. 565-575 * * ASME 2005 International Design Engineering Technical Conferences * * and Computers and Information in Engineering Conference (IDETC/CIE2005) * -* September 24–28, 2005 , Long Beach, California, USA * +* September 24-28, 2005 , Long Beach, California, USA * * http://www.me.berkeley.edu/~mcmains/pubs/DAC05OffsetPolygon.pdf * * * *******************************************************************************/ @@ -64,25 +64,59 @@ public: typedef std::vector< IntPoint > Polygon; typedef std::vector< Polygon > Polygons; + std::ostream& operator <<(std::ostream &s, Polygon &p); std::ostream& operator <<(std::ostream &s, Polygons &p); -struct ExPolygon { - Polygon outer; - Polygons holes; -}; -typedef std::vector< ExPolygon > ExPolygons; +class PolyNode; +typedef std::vector< PolyNode* > PolyNodes; +class PolyNode +{ +public: + PolyNode(); + Polygon Contour; + PolyNodes Childs; + PolyNode* Parent; + PolyNode* GetNext() const; + bool IsHole() const; + int ChildCount() const; +private: + PolyNode* GetNextSiblingUp() const; + unsigned Index; //node index in Parent.Childs + void AddChild(PolyNode& child); + friend class Clipper; //to access Index +}; + +class PolyTree: public PolyNode +{ +public: + ~PolyTree(){Clear();}; + PolyNode* GetFirst() const; + void Clear(); + int Total() const; +private: + PolyNodes AllNodes; + friend class Clipper; //to access AllNodes +}; + enum JoinType { jtSquare, jtRound, jtMiter }; bool Orientation(const Polygon &poly); double Area(const Polygon &poly); + void OffsetPolygons(const Polygons &in_polys, Polygons &out_polys, - double delta, JoinType jointype = jtSquare, double MiterLimit = 2, bool AutoFix = true); + double delta, JoinType jointype = jtSquare, double limit = 0, bool autoFix = true); + void SimplifyPolygon(const Polygon &in_poly, Polygons &out_polys, PolyFillType fillType = pftEvenOdd); void SimplifyPolygons(const Polygons &in_polys, Polygons &out_polys, PolyFillType fillType = pftEvenOdd); void SimplifyPolygons(Polygons &polys, PolyFillType fillType = pftEvenOdd); +void CleanPolygon(Polygon& in_poly, Polygon& out_poly, double distance = 1.415); +void CleanPolygons(Polygons& in_polys, Polygons& out_polys, double distance = 1.415); + +void PolyTreeToPolygons(PolyTree& polytree, Polygons& polygons); + void ReversePolygon(Polygon& p); void ReversePolygons(Polygons& p); @@ -100,7 +134,6 @@ struct TEdge { double dx; long64 deltaX; long64 deltaY; - long64 tmpX; PolyType polyType; EdgeSide side; int windDelta; //1 or -1 depending on winding direction @@ -140,8 +173,8 @@ struct OutPt; //forward declaration struct OutRec { int idx; bool isHole; - OutRec *FirstLeft; - OutRec *AppendLink; + OutRec *FirstLeft; //see comments in clipper.pas + PolyNode *polyNode; OutPt *pts; OutPt *bottomPt; }; @@ -204,13 +237,13 @@ public: Clipper(); ~Clipper(); bool Execute(ClipType clipType, - Polygons &solution, - PolyFillType subjFillType = pftEvenOdd, - PolyFillType clipFillType = pftEvenOdd); + Polygons &solution, + PolyFillType subjFillType = pftEvenOdd, + PolyFillType clipFillType = pftEvenOdd); bool Execute(ClipType clipType, - ExPolygons &solution, - PolyFillType subjFillType = pftEvenOdd, - PolyFillType clipFillType = pftEvenOdd); + PolyTree &polytree, + PolyFillType subjFillType = pftEvenOdd, + PolyFillType clipFillType = pftEvenOdd); void Clear(); bool ReverseSolution() {return m_ReverseOutput;}; void ReverseSolution(bool value) {m_ReverseOutput = value;}; @@ -225,12 +258,12 @@ private: Scanbeam *m_Scanbeam; TEdge *m_ActiveEdges; TEdge *m_SortedEdges; - IntersectNode *m_IntersectNodes; - bool m_ExecuteLocked; - PolyFillType m_ClipFillType; - PolyFillType m_SubjFillType; - bool m_ReverseOutput; - bool m_UsingExPolygons; + IntersectNode *m_IntersectNodes; + bool m_ExecuteLocked; + PolyFillType m_ClipFillType; + PolyFillType m_SubjFillType; + bool m_ReverseOutput; + bool m_UsingPolyTree; void DisposeScanbeamList(); void SetWindingCount(TEdge& edge); bool IsEvenOddFillType(const TEdge& edge) const; @@ -269,13 +302,13 @@ private: void ProcessIntersectList(); void ProcessEdgesAtTopOfScanbeam(const long64 topY); void BuildResult(Polygons& polys); - void BuildResultEx(ExPolygons& polys); + void BuildResult2(PolyTree& polytree); void SetHoleState(TEdge *e, OutRec *OutRec); void DisposeIntersectNodes(); - bool FixupIntersections(); + bool FixupIntersectionOrder(); void FixupOutPolygon(OutRec &outRec); bool IsHole(TEdge *e); - void FixHoleLinkage(OutRec *outRec); + void FixHoleLinkage(OutRec &outRec); void AddJoin(TEdge *e1, TEdge *e2, int e1OutIdx = -1, int e2OutIdx = -1); void ClearJoins(); void AddHorzJoin(TEdge *e, int idx); @@ -283,6 +316,8 @@ private: bool JoinPoints(const JoinRec *j, OutPt *&p1, OutPt *&p2); void FixupJoinRecs(JoinRec *j, OutPt *pt, unsigned startIdx); void JoinCommonEdges(); + void FixupFirstLefts1(OutRec* OldOutRec, OutRec* NewOutRec); + void FixupFirstLefts2(OutRec* OldOutRec, OutRec* NewOutRec); }; //------------------------------------------------------------------------------ From fd1cd36f63f5c3bd60afcca50365406ad39ecf81 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 1 Apr 2013 13:42:09 +0200 Subject: [PATCH 36/63] Minor changes in dialogs to ensure a better likeness between dialogs on Linux and Windows (mainly, remove some wxStaticBoxSizer in dialogs) --- .../dialog_edit_component_in_schematic.cpp | 15 +++------------ .../dialog_edit_component_in_schematic_fbp.fbp | 4 ++-- .../dialog_edit_libentry_fields_in_lib_base.cpp | 12 ++++++------ .../dialog_edit_libentry_fields_in_lib_base.fbp | 12 ++++++------ 4 files changed, 17 insertions(+), 26 deletions(-) diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp index 5184ca74fb..9141746a2d 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp @@ -102,18 +102,9 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( wxWindow columnLabel.SetText( _( "Value" ) ); fieldListCtrl->InsertColumn( 1, columnLabel ); - wxString label = _( "Size" ) + ReturnUnitSymbol( g_UserUnit ); - textSizeLabel->SetLabel( label ); - - label = _( "Pos " ); - label += _( "X" ); - label += ReturnUnitSymbol( g_UserUnit ); - posXLabel->SetLabel( label ); - - label = _( "Pos " ); - label += _( "Y" ); - label += ReturnUnitSymbol( g_UserUnit ); - posYLabel->SetLabel( label ); + m_staticTextUnitSize->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) ); + m_staticTextUnitPosX->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) ); + m_staticTextUnitPosY->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) ); copySelectedFieldToPanel(); diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp index 17467f4e39..1af1b32aa2 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic_fbp.fbp @@ -15,7 +15,7 @@ 1000 none 1 - + dialog_edit_component_in_schematic_base . @@ -44,7 +44,7 @@ 700,482 wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU - + ; Component Properties diff --git a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.cpp b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.cpp index 9fec9447e7..12987379d7 100644 --- a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.cpp +++ b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.cpp @@ -25,17 +25,17 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE fieldListCtrl = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES ); fieldListCtrl->SetMinSize( wxSize( 220,-1 ) ); - bSizerFiledsList->Add( fieldListCtrl, 1, wxALL|wxEXPAND, 8 ); + bSizerFiledsList->Add( fieldListCtrl, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 8 ); addFieldButton = new wxButton( this, wxID_ANY, _("Add Field"), wxDefaultPosition, wxDefaultSize, 0 ); addFieldButton->SetToolTip( _("Add a new custom field") ); - bSizerFiledsList->Add( addFieldButton, 0, wxALL|wxEXPAND, 5 ); + bSizerFiledsList->Add( addFieldButton, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); deleteFieldButton = new wxButton( this, wxID_ANY, _("Delete Field"), wxDefaultPosition, wxDefaultSize, 0 ); deleteFieldButton->SetToolTip( _("Delete one of the optional fields") ); - bSizerFiledsList->Add( deleteFieldButton, 0, wxALL|wxEXPAND, 5 ); + bSizerFiledsList->Add( deleteFieldButton, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); moveUpButton = new wxButton( this, wxID_ANY, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 ); moveUpButton->SetToolTip( _("Move the selected optional fields up one position") ); @@ -68,7 +68,7 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE bSizerJustify->Add( m_FieldVJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - fieldEditBoxSizer->Add( bSizerJustify, 0, wxEXPAND, 5 ); + fieldEditBoxSizer->Add( bSizerJustify, 0, wxEXPAND|wxBOTTOM, 5 ); wxBoxSizer* bSizerAspect; bSizerAspect = new wxBoxSizer( wxHORIZONTAL ); @@ -96,7 +96,7 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE bSizerAspect->Add( m_StyleRadioBox, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - fieldEditBoxSizer->Add( bSizerAspect, 0, wxEXPAND, 5 ); + fieldEditBoxSizer->Add( bSizerAspect, 0, wxEXPAND|wxTOP, 5 ); wxBoxSizer* fieldNameBoxSizer; fieldNameBoxSizer = new wxBoxSizer( wxVERTICAL ); @@ -186,7 +186,7 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE mainSizer->Add( bSizerFieldsSetup, 1, wxEXPAND, 5 ); m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - mainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); + mainSizer->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); stdDialogButtonSizer = new wxStdDialogButtonSizer(); stdDialogButtonSizerOK = new wxButton( this, wxID_OK ); diff --git a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.fbp b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.fbp index 32444ab993..5858889787 100644 --- a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.fbp +++ b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib_base.fbp @@ -111,7 +111,7 @@ none 8 - wxALL|wxEXPAND + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 1 1 @@ -216,7 +216,7 @@ 5 - wxALL|wxEXPAND + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -304,7 +304,7 @@ 5 - wxALL|wxEXPAND + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -491,7 +491,7 @@ none 5 - wxEXPAND + wxEXPAND|wxBOTTOM 0 @@ -682,7 +682,7 @@ 5 - wxEXPAND + wxEXPAND|wxTOP 0 @@ -2136,7 +2136,7 @@ 5 - wxEXPAND | wxALL + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 1 From e18404eea1ce1a4af9b42369cdddbfb0c6895c5b Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Mon, 1 Apr 2013 13:59:19 +0200 Subject: [PATCH 37/63] Removed unused width attribute from schematic line --- eeschema/sch_line.cpp | 10 ++-------- eeschema/sch_line.h | 1 - 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp index 7977e87770..d1a36da083 100644 --- a/eeschema/sch_line.cpp +++ b/eeschema/sch_line.cpp @@ -49,7 +49,6 @@ SCH_LINE::SCH_LINE( const wxPoint& pos, int layer ) : { m_start = pos; m_end = pos; - m_width = 0; // Default thickness used m_startIsDangling = m_endIsDangling = false; switch( layer ) @@ -74,7 +73,6 @@ SCH_LINE::SCH_LINE( const SCH_LINE& aLine ) : { m_start = aLine.m_start; m_end = aLine.m_end; - m_width = aLine.m_width; m_startIsDangling = m_endIsDangling = false; } @@ -107,7 +105,6 @@ void SCH_LINE::Show( int nestLevel, std::ostream& os ) const { NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << " layer=\"" << m_Layer << '"' - << " width=\"" << m_width << '"' << " startIsDangling=\"" << m_startIsDangling << '"' << " endIsDangling=\"" << m_endIsDangling << '"' << ">" @@ -210,14 +207,11 @@ bool SCH_LINE::Load( LINE_READER& aLine, wxString& aErrorMsg ) int SCH_LINE::GetPenSize() const { - int pensize = ( m_width == 0 ) ? GetDefaultLineThickness() : m_width; if( m_Layer == LAYER_BUS ) - { - pensize = ( m_width == 0 ) ? GetDefaultBusThickness() : m_width; - } + return GetDefaultBusThickness(); - return pensize; + return GetDefaultLineThickness(); } diff --git a/eeschema/sch_line.h b/eeschema/sch_line.h index bb5c7876dc..a76173b66d 100644 --- a/eeschema/sch_line.h +++ b/eeschema/sch_line.h @@ -42,7 +42,6 @@ class SCH_LINE : public SCH_ITEM { bool m_startIsDangling; ///< True if start point is not connected. bool m_endIsDangling; ///< True if end point is not connected. - int m_width; ///< Set to 0 for wires and greater than 0 for busses. wxPoint m_start; ///< Line start point wxPoint m_end; ///< Line end point From 23981977f38d1609dc22fba594e87f9fb01ffc55 Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Tue, 2 Apr 2013 18:04:12 +0200 Subject: [PATCH 38/63] Fixed idiotic merge error in busentry handling --- eeschema/busentry.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/eeschema/busentry.cpp b/eeschema/busentry.cpp index 2066aba264..a9f6f70755 100644 --- a/eeschema/busentry.cpp +++ b/eeschema/busentry.cpp @@ -73,10 +73,6 @@ void SCH_EDIT_FRAME::SetBusEntryShape( wxDC* DC, SCH_BUS_ENTRY_BASE* BusEntry, c { if( BusEntry == NULL ) return; - { - DisplayError( this, wxT( "SetBusEntryType: Bad StructType" ) ); - return; - } /* Put old item in undo list if it is not currently in edit */ if( BusEntry->GetFlags() == 0 ) From 41d254fb48f18fa6dfc56589ce68da708dca0d7c Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Tue, 2 Apr 2013 19:11:42 +0200 Subject: [PATCH 39/63] Meaningful tooltip for ECO layers --- pcbnew/class_pcb_layer_widget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pcbnew/class_pcb_layer_widget.cpp b/pcbnew/class_pcb_layer_widget.cpp index a852a2723d..0dea4b0e36 100644 --- a/pcbnew/class_pcb_layer_widget.cpp +++ b/pcbnew/class_pcb_layer_widget.cpp @@ -300,8 +300,8 @@ void PCB_LAYER_WIDGET::ReFill() { SOLDERMASK_N_BACK, _( "Solder mask on board's back" ) }, { DRAW_N, _( "Explanatory drawings" ) }, { COMMENT_N, _( "Explanatory comments" ) }, - { ECO1_N, _( "TDB" ) }, - { ECO2_N, _( "TBD" ) }, + { ECO1_N, _( "User defined meaning" ) }, + { ECO2_N, _( "User defined meaning" ) }, { EDGE_N, _( "Board's perimeter definition" ) }, }; From a47d36e399bb8adff5a28bb8647c207b9ecf44a1 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 3 Apr 2013 18:16:26 +0200 Subject: [PATCH 40/63] Pcbnew: fix Bug #1163201. Fix Bug #1162779. Fix incorrect comment in CMakeLists.txt. --- CMakeLists.txt | 2 +- common/drawtxt.cpp | 209 +++++++++++++++++-------------- pcbnew/netlist_reader_common.cpp | 4 + pcbnew/netlist_reader_kicad.cpp | 132 ++++++++++++------- 4 files changed, 210 insertions(+), 137 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e3c6ae22a0..9d7d8a9860 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,7 +42,7 @@ option(KICAD_STABLE_VERSION ) option(KICAD_TESTING_VERSION - "set this option to ON to build the stable version of KICAD. mainly used to set version ID (default OFF)" + "set this option to ON to build the testing version of KICAD. mainly used to set version ID (default OFF)" ) option(KICAD_SCRIPTING diff --git a/common/drawtxt.cpp b/common/drawtxt.cpp index 623b85a163..c8724bbe3a 100644 --- a/common/drawtxt.cpp +++ b/common/drawtxt.cpp @@ -40,13 +40,15 @@ #include -#define EDA_DRAWBASE #include #include -/* factor used to calculate actual size of shapes from hershey fonts (could be adjusted depending on the font name) - * Its value is choosen in order to have letters like M, P .. vertical size equal to the vertical char size parameter - * Of course some shapes can be bigger or smaller than the vertical char size parameter +/* factor used to calculate actual size of shapes from hershey fonts + * (could be adjusted depending on the font name) + * Its value is choosen in order to have letters like M, P .. vertical size + * equal to the vertical char size parameter + * Of course some shapes can be bigger or smaller than the vertical char size + * parameter */ #define HERSHEY_SCALE_FACTOR 1 / 21.0 double s_HerscheyScaleFactor = HERSHEY_SCALE_FACTOR; @@ -59,6 +61,7 @@ int OverbarPositionY( int size_v, int thickness ) return KiROUND( ( (double) size_v * 1.1 ) + ( (double) thickness * 1.5 ) ); } + /** * Function GetPensizeForBold * @return the "best" value for a pen size to draw/plot a bold text @@ -84,12 +87,13 @@ int GetPenSizeForBold( int aTextSize ) */ int Clamp_Text_PenSize( int aPenSize, int aSize, bool aBold ) { - int penSize = aPenSize; - double scale = aBold ? 4.0 : 6.0; - int maxWidth = KiROUND( std::abs( aSize ) / scale ); + int penSize = aPenSize; + double scale = aBold ? 4.0 : 6.0; + int maxWidth = KiROUND( std::abs( aSize ) / scale ); if( penSize > maxWidth ) penSize = maxWidth; + return penSize; } @@ -112,17 +116,19 @@ int Clamp_Text_PenSize( int aPenSize, wxSize aSize, bool aBold ) /** * Function NegableTextLength - * Return the text length of a negable string, excluding the ~ markers */ + * Return the text length (char count) of a negable string, + * excluding the ~ markers + */ int NegableTextLength( const wxString& aText ) { int char_count = aText.length(); - /* Fix the character count, removing the ~ found */ + // Fix the character count, removing the ~ found for( int i = char_count - 1; i >= 0; i-- ) { if( aText[i] == '~' ) { - /* '~~' draw as '~' and count as two chars */ + // '~~' draw as '~' and count as two chars if( i > 0 && aText[i - 1] == '~' ) i--; else @@ -142,13 +148,15 @@ int NegableTextLength( const wxString& aText ) */ static const char* GetHersheyShapeDescription( int AsciiCode ) { - /* calculate font length */ + // calculate font length int font_length_max = newstroke_font_bufsize; if( AsciiCode >= (32 + font_length_max) ) AsciiCode = '?'; + if( AsciiCode < 32 ) - AsciiCode = 32; /* Clamp control chars */ + AsciiCode = 32; /* Clamp control chars */ + AsciiCode -= 32; return newstroke_font[AsciiCode]; @@ -162,48 +170,50 @@ int ReturnGraphicTextWidth( const wxString& aText, int aXSize, bool aItalic, boo for( int i = 0; i < char_count; i++ ) { - int AsciiCode = aText[i]; + int asciiCode = aText[i]; /* Skip the negation marks * and first '~' char of '~~' - * ('~~' draw as '~') */ - if( AsciiCode == '~' ) + * ('~~' draw as '~') + */ + if( asciiCode == '~' ) { - if( i > 0 && aText[i - 1] != '~' ) + if( i == 0 || aText[i - 1] != '~' ) continue; } - const char* ptcar = GetHersheyShapeDescription( AsciiCode ); - /* Get metrics */ - int xsta = *ptcar++ - 'R'; - int xsto = *ptcar++ - 'R'; + const char* shape_ptr = GetHersheyShapeDescription( asciiCode ); + // Get metrics + int xsta = *shape_ptr++ - 'R'; + int xsto = *shape_ptr++ - 'R'; tally += KiROUND( aXSize * (xsto - xsta) * s_HerscheyScaleFactor ); } - /* Italic correction, 1/8em */ + // For italic correction, add 1/8 size if( aItalic ) { tally += KiROUND( aXSize * 0.125 ); } + return tally; } -/* Helper function for drawing character polygons */ -static void DrawGraphicTextPline( - EDA_RECT* aClipBox, - wxDC* aDC, - EDA_COLOR_T aColor, - int aWidth, - bool aSketchMode, - int point_count, - wxPoint* coord, - void (* aCallback)(int x0, int y0, int xf, int yf ), - PLOTTER* aPlotter ) +// Helper function for drawing character polylines +static void DrawGraphicTextPline( EDA_RECT* aClipBox, + wxDC* aDC, + EDA_COLOR_T aColor, + int aWidth, + bool aSketchMode, + int point_count, + wxPoint* coord, + void (* aCallback)( int x0, int y0, int xf, int yf ), + PLOTTER* aPlotter ) { if( aPlotter ) { aPlotter->MoveTo( coord[0] ); + for( int ik = 1; ik < point_count; ik++ ) { aPlotter->LineTo( coord[ik] ); @@ -268,26 +278,26 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, void (* aCallback)( int x0, int y0, int xf, int yf ), PLOTTER* aPlotter ) { - int AsciiCode; - int x0, y0; - int size_h, size_v; - unsigned ptr; - int dx, dy; // Draw coordinate for segments to draw. also used in some other calculation - wxPoint current_char_pos; // Draw coordinates for the current char - wxPoint overbar_pos; // Start point for the current overbar - int overbar_italic_comp; // Italic compensation for overbar - EDA_RECT* clipBox; // Clip box used in basic draw functions + int AsciiCode; + int x0, y0; + int size_h, size_v; + unsigned ptr; + int dx, dy; // Draw coordinate for segments to draw. also used in some other calculation + wxPoint current_char_pos; // Draw coordinates for the current char + wxPoint overbar_pos; // Start point for the current overbar + int overbar_italic_comp; // Italic compensation for overbar + EDA_RECT* clipBox; // Clip box used in basic draw functions clipBox = aPanel ? aPanel->GetClipBox() : NULL; #define BUF_SIZE 100 wxPoint coord[BUF_SIZE + 1]; // Buffer coordinate used to draw polylines (one char shape) - bool sketch_mode = false; - bool italic_reverse = false; // true for mirrored texts with m_Size.x < 0 + bool sketch_mode = false; + bool italic_reverse = false; // true for mirrored texts with m_Size.x < 0 - size_h = aSize.x; /* PLEASE NOTE: H is for HORIZONTAL not for HEIGHT */ - size_v = aSize.y; + size_h = aSize.x; /* PLEASE NOTE: H is for HORIZONTAL not for HEIGHT */ + size_v = aSize.y; - if( aWidth == 0 && aBold ) // Use default values if aWidth == 0 + if( aWidth == 0 && aBold ) // Use default values if aWidth == 0 aWidth = GetPenSizeForBold( std::min( aSize.x, aSize.y ) ); if( aWidth < 0 ) @@ -300,17 +310,18 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, aWidth = Clamp_Text_PenSize( aWidth, aSize, aBold ); #endif - if( size_h < 0 ) // text is mirrored using size.x < 0 (mirror / Y axis) + if( size_h < 0 ) // text is mirrored using size.x < 0 (mirror / Y axis) italic_reverse = true; unsigned char_count = NegableTextLength( aText ); + if( char_count == 0 ) return; current_char_pos = aPos; - dx = ReturnGraphicTextWidth( aText, size_h, aItalic, aWidth ); - dy = size_v; + dx = ReturnGraphicTextWidth( aText, size_h, aItalic, aWidth ); + dy = size_v; /* Do not draw the text if out of draw area! */ if( aPanel ) @@ -318,20 +329,23 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, int xm, ym, ll, xc, yc; ll = std::abs( dx ); - xc = current_char_pos.x; - yc = current_char_pos.y; + xc = current_char_pos.x; + yc = current_char_pos.y; - x0 = aPanel->GetClipBox()->GetX() - ll; - y0 = aPanel->GetClipBox()->GetY() - ll; - xm = aPanel->GetClipBox()->GetRight() + ll; - ym = aPanel->GetClipBox()->GetBottom() + ll; + x0 = aPanel->GetClipBox()->GetX() - ll; + y0 = aPanel->GetClipBox()->GetY() - ll; + xm = aPanel->GetClipBox()->GetRight() + ll; + ym = aPanel->GetClipBox()->GetBottom() + ll; if( xc < x0 ) return; + if( yc < y0 ) return; + if( xc > xm ) return; + if( yc > ym ) return; } @@ -404,6 +418,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, if( aItalic ) { overbar_italic_comp = OverbarPositionY( size_v, aWidth ) / 8; + if( italic_reverse ) { overbar_italic_comp = -overbar_italic_comp; @@ -412,17 +427,20 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, else { overbar_italic_comp = 0; - }; + } + + ; + + int overbars = 0; /* Number of '~' seen (except '~~') */ + ptr = 0; /* ptr = text index */ - int overbars = 0; /* Number of '~' seen (except '~~') */ - ptr = 0; /* ptr = text index */ while( ptr < char_count ) { if( aText[ptr + overbars] == '~' ) { - if( ptr + overbars + 1 < aText.length() && - aText[ptr + overbars + 1] == '~' ) /* '~~' draw as '~' */ - ptr++; // skip first '~' char and draw second + if( ptr + overbars + 1 < aText.length() + && aText[ptr + overbars + 1] == '~' ) /* '~~' draw as '~' */ + ptr++; // skip first '~' char and draw second else { @@ -431,41 +449,44 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, if( overbars & 1 ) // odd overbars count { - /* Starting the overbar */ - overbar_pos = current_char_pos; - overbar_pos.x += overbar_italic_comp; - overbar_pos.y -= OverbarPositionY( size_v, aWidth ); + // Starting the overbar + overbar_pos = current_char_pos; + overbar_pos.x += overbar_italic_comp; + overbar_pos.y -= OverbarPositionY( size_v, aWidth ); RotatePoint( &overbar_pos, aPos, aOrient ); } else { - /* Ending the overbar */ - coord[0] = overbar_pos; - overbar_pos = current_char_pos; - overbar_pos.x += overbar_italic_comp; - overbar_pos.y -= OverbarPositionY( size_v, aWidth ); + // Ending the overbar + coord[0] = overbar_pos; + overbar_pos = current_char_pos; + overbar_pos.x += overbar_italic_comp; + overbar_pos.y -= OverbarPositionY( size_v, aWidth ); RotatePoint( &overbar_pos, aPos, aOrient ); coord[1] = overbar_pos; - /* Plot the overbar segment */ + // Plot the overbar segment DrawGraphicTextPline( clipBox, aDC, aColor, aWidth, sketch_mode, 2, coord, aCallback, aPlotter ); } - continue; /* Skip ~ processing */ + + continue; /* Skip ~ processing */ } } AsciiCode = aText.GetChar( ptr + overbars ); const char* ptcar = GetHersheyShapeDescription( AsciiCode ); - /* Get metrics */ - int xsta = *ptcar++ - 'R'; - int xsto = *ptcar++ - 'R'; + // Get metrics + int xsta = *ptcar++ - 'R'; + int xsto = *ptcar++ - 'R'; int point_count = 0; bool endcar = false; + while( !endcar ) { int hc1, hc2; hc1 = *ptcar++; + if( hc1 ) { hc2 = *ptcar++; @@ -473,12 +494,15 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, else { // End of character, insert a synthetic pen up: - hc1 = ' '; - hc2 = 'R'; - endcar = true; + hc1 = ' '; + hc2 = 'R'; + endcar = true; } - // Do the Hershey decode thing: coordinates values are coded as + 'R' - hc1 -= 'R'; hc2 -= 'R'; + + // Do the Hershey decode thing: + // coordinates values are coded as + 'R' + hc1 -= 'R'; + hc2 -= 'R'; /* Pen up request */ if( hc1 == -50 && hc2 == 0 ) @@ -487,33 +511,36 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, { if( aWidth <= 1 ) aWidth = 0; + DrawGraphicTextPline( clipBox, aDC, aColor, aWidth, sketch_mode, point_count, coord, aCallback, aPlotter ); } + point_count = 0; } else { wxPoint currpoint; - hc1 -= xsta; hc2 -= 11; /* Align the midpoint */ - hc1 = KiROUND( hc1 * size_h * s_HerscheyScaleFactor ); - hc2 = KiROUND( hc2 * size_v * s_HerscheyScaleFactor ); + hc1 -= xsta; hc2 -= 11; // Align the midpoint + hc1 = KiROUND( hc1 * size_h * s_HerscheyScaleFactor ); + hc2 = KiROUND( hc2 * size_v * s_HerscheyScaleFactor ); - // To simulate an italic font, add a x offset depending on the y offset + // To simulate an italic font, + // add a x offset depending on the y offset if( aItalic ) hc1 -= KiROUND( italic_reverse ? -hc2 / 8.0 : hc2 / 8.0 ); + currpoint.x = hc1 + current_char_pos.x; currpoint.y = hc2 + current_char_pos.y; RotatePoint( &currpoint, aPos, aOrient ); coord[point_count] = currpoint; + if( point_count < BUF_SIZE - 1 ) point_count++; } - } - - /* end draw 1 char */ + } // end draw 1 char ptr++; @@ -524,9 +551,9 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, if( overbars % 2 ) { /* Close the last overbar */ - coord[0] = overbar_pos; - overbar_pos = current_char_pos; - overbar_pos.y -= OverbarPositionY( size_v, aWidth ); + coord[0] = overbar_pos; + overbar_pos = current_char_pos; + overbar_pos.y -= OverbarPositionY( size_v, aWidth ); RotatePoint( &overbar_pos, aPos, aOrient ); coord[1] = overbar_pos; /* Plot the overbar segment */ @@ -565,7 +592,7 @@ void PLOTTER::Text( const wxPoint& aPos, { int textPensize = aWidth; - if( textPensize == 0 && aBold ) // Use default values if aWidth == 0 + if( textPensize == 0 && aBold ) // Use default values if aWidth == 0 textPensize = GetPenSizeForBold( std::min( aSize.x, aSize.y ) ); if( textPensize >= 0 ) diff --git a/pcbnew/netlist_reader_common.cpp b/pcbnew/netlist_reader_common.cpp index c174d540ef..24462bd5e7 100644 --- a/pcbnew/netlist_reader_common.cpp +++ b/pcbnew/netlist_reader_common.cpp @@ -236,6 +236,7 @@ void NETLIST_READER::TestFootprintsMatchingAndExchange() break; } } + if( cmp_info == NULL ) // not found in netlist continue; @@ -296,9 +297,11 @@ int NETLIST_READER::SetPadsNetName( const wxString & aModule, const wxString & a int padcount = 0; MODULE* module = m_pcbframe->GetBoard()->FindModuleByReference( aModule ); + if( module ) { D_PAD * pad = module->FindPadByName( aPadname ); + if( pad ) { padcount++; @@ -316,6 +319,7 @@ int NETLIST_READER::SetPadsNetName( const wxString & aModule, const wxString & a } return padcount; } + if( m_messageWindow ) { wxString msg; diff --git a/pcbnew/netlist_reader_kicad.cpp b/pcbnew/netlist_reader_kicad.cpp index ad1dd62f8e..6b7de75230 100644 --- a/pcbnew/netlist_reader_kicad.cpp +++ b/pcbnew/netlist_reader_kicad.cpp @@ -173,62 +173,104 @@ void NETLIST_READER_KICAD_PARSER::SkipCurrent() throw( IO_ERROR, PARSE_ERROR ) void NETLIST_READER_KICAD_PARSER::Parse( BOARD * aBrd ) throw( IO_ERROR, PARSE_ERROR ) { - wxString text; + int plevel = 0; // the count of ')' to read and end of file, + // after parsing all sections + while( ( token = NextTok() ) != T_EOF ) { if( token == T_LEFT ) token = NextTok(); - if( token == T_components ) - { - // The section comp starts here. - while( ( token = NextTok() ) != T_RIGHT ) - { - if( token == T_LEFT ) - token = NextTok(); - if( token == T_comp ) - { - // A comp section if found. Read it - COMPONENT_INFO* cmp_info = ParseComp(); - netlist_reader->AddModuleInfo( cmp_info ); - } - } - if( netlist_reader->BuildModuleListOnlyOpt() ) - return; // at this point, the module list is read and built. - // Load new footprints - netlist_reader->InitializeModules(); - netlist_reader->TestFootprintsMatchingAndExchange(); - } - if( token == T_nets ) + switch( token ) { - // The section nets starts here. - while( ( token = NextTok() ) != T_RIGHT ) - { - if( token == T_LEFT ) - token = NextTok(); - if( token == T_net ) - { - // A net section if found. Read it - ParseNet( aBrd ); - } - } - } + case T_export: // The netlist starts here. + // nothing to do here, + // just increment the count of ')' to read and end of file + plevel++; + break; - if( token == T_libparts && netlist_reader->ReadLibpartSectionOpt() ) - { - // The section libparts starts here. - while( ( token = NextTok() ) != T_RIGHT ) - { - if( token == T_LEFT ) - token = NextTok(); - if( token == T_libpart ) + case T_version: // The netlist starts here. + // version id not yet used: read it but does not use it + NextTok(); + NeedRIGHT(); + break; + + case T_components: // The section comp starts here. + while( ( token = NextTok() ) != T_RIGHT ) { - // A libpart section if found. Read it - ParseKicadLibpartList(); + if( token == T_LEFT ) + token = NextTok(); + if( token == T_comp ) // A comp section if found. Read it + { + COMPONENT_INFO* cmp_info = ParseComp(); + netlist_reader->AddModuleInfo( cmp_info ); + } } - } + if( netlist_reader->BuildModuleListOnlyOpt() ) + return; // at this point, the module list is read and built. + // Load new footprints + netlist_reader->InitializeModules(); + netlist_reader->TestFootprintsMatchingAndExchange(); + break; + + case T_nets: // The section nets starts here. + while( ( token = NextTok() ) != T_RIGHT ) + { + if( token == T_LEFT ) + token = NextTok(); + if( token == T_net ) + { + // A net section if found. Read it + ParseNet( aBrd ); + } + } + break; + + case T_libparts: // The section libparts starts here. + if( netlist_reader->ReadLibpartSectionOpt() ) + { + while( ( token = NextTok() ) != T_RIGHT ) + { + if( token == T_LEFT ) + token = NextTok(); + if( token == T_libpart ) + { + // A libpart section if found. Read it + ParseKicadLibpartList(); + } + } + } + else + SkipCurrent(); + break; + + case T_libraries: // The section libraries starts here. + // List of libraries in use. + // Not used here, just skip it + SkipCurrent(); + break; + + case T_design: // The section design starts here. + // Not used (mainly thet are comments), just skip it + SkipCurrent(); + break; + + case T_RIGHT: // The closing parenthesis of the file. + // Not used (mainly thet are comments), just skip it + plevel--; + break; + + default: + SkipCurrent(); + break; } } + + if( plevel != 0 ) + { + wxLogDebug(wxT("NETLIST_READER_KICAD_PARSER::Parse(): bad parenthesis count (count = %d"), + plevel ); + } } void NETLIST_READER_KICAD_PARSER::ParseNet( BOARD * aBrd ) From d12a45923b3ebf7fe73a252040ba18ead16f762b Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Thu, 4 Apr 2013 23:35:01 +0200 Subject: [PATCH 41/63] More work on EDA_COLOR_T and layers. In particular the new mechanism for handling extended color palettes is in place, included renaming the ini keys and saving the color name instead of its index; this means better forward compatibility with palette changes. Since ini keys are changed, colors will be reset --- 3d-viewer/3d_draw.cpp | 14 +-- 3d-viewer/3d_draw_basic_functions.cpp | 4 +- common/common.cpp | 4 +- common/common_plotDXF_functions.cpp | 23 ++-- common/common_plotPS_functions.cpp | 6 +- common/drawframe.cpp | 4 +- common/gr_basic.cpp | 100 ++++++++++++++++++ common/msgpanel.cpp | 4 +- common/projet_config.cpp | 8 +- common/selcolor.cpp | 14 ++- eeschema/bus-wire-junction.cpp | 2 +- eeschema/class_libentry.cpp | 2 +- eeschema/dialogs/dialog_color_config.cpp | 17 ++- eeschema/eeschema_config.cpp | 54 +++++----- eeschema/general.h | 2 +- eeschema/lib_arc.cpp | 10 +- eeschema/lib_bezier.cpp | 10 +- eeschema/lib_circle.cpp | 10 +- eeschema/lib_draw_item.cpp | 2 +- eeschema/lib_field.cpp | 6 +- eeschema/lib_pin.cpp | 12 +-- eeschema/lib_polyline.cpp | 10 +- eeschema/lib_rectangle.cpp | 10 +- eeschema/protos.h | 6 -- eeschema/sch_bitmap.cpp | 2 +- eeschema/sch_bus_entry.cpp | 4 +- eeschema/sch_field.cpp | 8 +- eeschema/sch_junction.cpp | 4 +- eeschema/sch_line.cpp | 4 +- eeschema/sch_marker.cpp | 4 +- eeschema/sch_no_connect.cpp | 4 +- eeschema/sch_sheet.cpp | 14 +-- eeschema/sch_text.cpp | 8 +- gerbview/class_gerber_draw_item.cpp | 3 +- gerbview/gerbview_config.cpp | 21 ++-- include/colors.h | 66 +++++++++--- include/layers_id_colors_and_visibility.h | 51 ++++++++- include/param_config.h | 2 +- include/plot_common.h | 2 +- pcbnew/autorouter/autorout.h | 3 +- pcbnew/autorouter/graphpcb.cpp | 44 ++++---- pcbnew/autorouter/routing_matrix.cpp | 2 +- pcbnew/class_pad_draw_functions.cpp | 14 ++- pcbnew/class_pcb_text.cpp | 2 +- pcbnew/class_track.cpp | 6 +- pcbnew/class_zone.cpp | 6 +- pcbnew/dialogs/dialog_plot.cpp | 6 +- pcbnew/dialogs/dialog_plot.h | 2 +- pcbnew/dialogs/dialog_print_using_printer.cpp | 11 +- pcbnew/export_vrml.cpp | 18 ++-- pcbnew/kicad_plugin.cpp | 26 ++--- pcbnew/legacy_plugin.cpp | 18 +--- pcbnew/pcbnew_config.cpp | 84 +++++++-------- pcbnew/printout_controler.cpp | 12 +-- 54 files changed, 464 insertions(+), 321 deletions(-) diff --git a/3d-viewer/3d_draw.cpp b/3d-viewer/3d_draw.cpp index d2ad04e200..56c17fac04 100644 --- a/3d-viewer/3d_draw.cpp +++ b/3d-viewer/3d_draw.cpp @@ -49,7 +49,7 @@ #include <3d_draw_basic_functions.h> // Imported function: -extern void SetGLColor( int color ); +extern void SetGLColor( EDA_COLOR_T color ); extern void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits ); extern void CheckGLError(); @@ -326,8 +326,8 @@ void EDA_3D_CANVAS::Draw3D_Zone( ZONE_CONTAINER* aZone ) void EDA_3D_CANVAS::DrawGrid( double aGriSizeMM ) { double zpos = 0.0; - int gridcolor = DARKGRAY; // Color of grid lines - int gridcolor_marker = LIGHTGRAY; // Color of grid lines every 5 lines + EDA_COLOR_T gridcolor = DARKGRAY; // Color of grid lines + EDA_COLOR_T gridcolor_marker = LIGHTGRAY; // Color of grid lines every 5 lines double scale = g_Parm_3D_Visu.m_BiuTo3Dunits; glNormal3f( 0.0, 0.0, 1.0 ); @@ -457,7 +457,7 @@ void EDA_3D_CANVAS::DrawGrid( double aGriSizeMM ) void EDA_3D_CANVAS::Draw3D_Track( TRACK* aTrack ) { LAYER_NUM layer = aTrack->GetLayer(); - int color = g_ColorsSettings.GetLayerColor( layer ); + EDA_COLOR_T color = g_ColorsSettings.GetLayerColor( layer ); int thickness = g_Parm_3D_Visu.GetCopperThicknessBIU(); if( layer == LAST_COPPER_LAYER ) @@ -476,7 +476,7 @@ void EDA_3D_CANVAS::Draw3D_Track( TRACK* aTrack ) void EDA_3D_CANVAS::Draw3D_Via( SEGVIA* via ) { LAYER_NUM layer, top_layer, bottom_layer; - int color; + EDA_COLOR_T color; double biu_to_3Dunits = g_Parm_3D_Visu.m_BiuTo3Dunits ; int outer_radius = via->GetWidth() / 2; @@ -531,7 +531,7 @@ void EDA_3D_CANVAS::Draw3D_Via( SEGVIA* via ) void EDA_3D_CANVAS::Draw3D_DrawSegment( DRAWSEGMENT* segment ) { LAYER_NUM layer = segment->GetLayer(); - int color = g_ColorsSettings.GetLayerColor( layer ); + EDA_COLOR_T color = g_ColorsSettings.GetLayerColor( layer ); int thickness = g_Parm_3D_Visu.GetLayerObjectThicknessBIU( layer ); SetGLColor( color ); @@ -625,7 +625,7 @@ static void Draw3dTextSegm( int x0, int y0, int xf, int yf ) void EDA_3D_CANVAS::Draw3D_DrawText( TEXTE_PCB* text ) { LAYER_NUM layer = text->GetLayer(); - int color = g_ColorsSettings.GetLayerColor( layer ); + EDA_COLOR_T color = g_ColorsSettings.GetLayerColor( layer ); SetGLColor( color ); s_Text3DZPos = g_Parm_3D_Visu.GetLayerZcoordBIU( layer ); diff --git a/3d-viewer/3d_draw_basic_functions.cpp b/3d-viewer/3d_draw_basic_functions.cpp index 06fbd76100..e8cd9a2b61 100644 --- a/3d-viewer/3d_draw_basic_functions.cpp +++ b/3d-viewer/3d_draw_basic_functions.cpp @@ -122,10 +122,10 @@ static void Draw3D_VerticalPolygonalCylinder( const std::vector& aPolys } -void SetGLColor( int color ) +void SetGLColor( EDA_COLOR_T color ) { double red, green, blue; - StructColors colordata = ColorRefs[color & MASKCOLOR]; + const StructColors &colordata = g_ColorRefs[ColorGetBase( color )]; red = colordata.m_Red / 255.0; blue = colordata.m_Blue / 255.0; diff --git a/common/common.cpp b/common/common.cpp index b67dc35e68..6ce54a387d 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -72,9 +72,9 @@ bool IsGOST() * Please: if you change a value, remember these values are carefully chosen * to have good results in Pcbnew, that uses the ORed value of basic colors * when displaying superimposed objects - * This list must have exactly NBCOLOR items + * This list must have exactly NBCOLORS items */ -StructColors ColorRefs[NBCOLOR] = +const StructColors g_ColorRefs[NBCOLORS] = { { 0, 0, 0, BLACK, wxT( "BLACK" ), DARKDARKGRAY }, { 192, 0, 0, BLUE, wxT( "BLUE" ), LIGHTBLUE }, diff --git a/common/common_plotDXF_functions.cpp b/common/common_plotDXF_functions.cpp index 09b07f5f19..88dc4d6013 100644 --- a/common/common_plotDXF_functions.cpp +++ b/common/common_plotDXF_functions.cpp @@ -45,7 +45,7 @@ void DXF_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil, SetDefaultLineWidth( 0 ); // No line width on DXF plotMirror = false; // No mirroring on DXF - currentColor = BLACK; + m_currentColor = BLACK; } /** @@ -151,7 +151,7 @@ bool DXF_PLOTTER::StartPlot() " 2\n" "LAYER\n" " 70\n" - "%d\n", NBCOLOR ); + "%d\n", NBCOLORS ); /* The layer/colors palette. The acad/DXF palette is divided in 3 zones: @@ -159,7 +159,7 @@ bool DXF_PLOTTER::StartPlot() - An HSV zone (10-250, 5 values x 2 saturations x 10 hues - Greys (251 - 255) - The is *no* black... the white does it on paper, usually, and + There is *no* black... the white does it on paper, usually, and anyway it depends on the plotter configuration, since DXF colors are meant to be logical only (they represent *both* line color and width); later version with plot styles only complicate the matter! @@ -170,7 +170,7 @@ bool DXF_PLOTTER::StartPlot() static const struct { const char *name; int color; - } dxf_layer[NBCOLOR] = { + } dxf_layer[NBCOLORS] = { { "BLACK", 250 }, { "BLUE", 5 }, { "GREEN", 3 }, @@ -197,9 +197,8 @@ bool DXF_PLOTTER::StartPlot() { "LIGHTYELLOW", 51 }, }; - for( int i = 0; i < NBCOLOR; i++ ) + for( EDA_COLOR_T i = BLACK; i < NBCOLORS; ++i ) { - wxString cname = ColorRefs[i].m_Name; fprintf( outputFile, " 0\n" "LAYER\n" @@ -254,10 +253,10 @@ void DXF_PLOTTER::SetColor( EDA_COLOR_T color ) || ( color == BLACK ) || ( color == WHITE ) ) { - currentColor = color; + m_currentColor = color; } else - currentColor = BLACK; + m_currentColor = BLACK; } /** @@ -287,7 +286,7 @@ void DXF_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_T fill, int DPOINT centre_dev = userToDeviceCoordinates( centre ); if( radius > 0 ) { - wxString cname = ColorRefs[currentColor].m_Name; + wxString cname( ColorGetName( m_currentColor ) ); if (!fill) { fprintf( outputFile, "0\nCIRCLE\n8\n%s\n10\n%g\n20\n%g\n40\n%g\n", @@ -349,7 +348,7 @@ void DXF_PLOTTER::PenTo( const wxPoint& pos, char plume ) if( penLastpos != pos && plume == 'D' ) { // DXF LINE - wxString cname = ColorRefs[currentColor].m_Name; + wxString cname( ColorGetName( m_currentColor ) ); fprintf( outputFile, "0\nLINE\n8\n%s\n10\n%g\n20\n%g\n11\n%g\n21\n%g\n", TO_UTF8( cname ), pen_lastpos_dev.x, pen_lastpos_dev.y, pos_dev.x, pos_dev.y ); @@ -396,7 +395,7 @@ void DXF_PLOTTER::Arc( const wxPoint& centre, int StAngle, int EndAngle, int rad double radius_dev = userToDeviceSize( radius ); // Emit a DXF ARC entity - wxString cname = ColorRefs[currentColor].m_Name; + wxString cname( ColorGetName( m_currentColor ) ); fprintf( outputFile, "0\nARC\n8\n%s\n10\n%g\n20\n%g\n40\n%g\n50\n%g\n51\n%g\n", TO_UTF8( cname ), @@ -570,7 +569,7 @@ void DXF_PLOTTER::Text( const wxPoint& aPos, more useful as a CAD object */ DPOINT origin_dev = userToDeviceCoordinates( aPos ); SetColor( aColor ); - wxString cname = ColorRefs[currentColor].m_Name; + wxString cname( ColorGetName( m_currentColor ) ); DPOINT size_dev = userToDeviceSize( aSize ); int h_code = 0, v_code = 0; switch( aH_justify ) diff --git a/common/common_plotPS_functions.cpp b/common/common_plotPS_functions.cpp index 2a012a9f06..43a8a27a90 100644 --- a/common/common_plotPS_functions.cpp +++ b/common/common_plotPS_functions.cpp @@ -39,9 +39,9 @@ void PSLIKE_PLOTTER::SetColor( EDA_COLOR_T color ) if( colorMode ) { - double r = ColorRefs[color].m_Red / 255.0; - double g = ColorRefs[color].m_Green / 255.0; - double b = ColorRefs[color].m_Blue / 255.0; + double r = g_ColorRefs[color].m_Red / 255.0; + double g = g_ColorRefs[color].m_Green / 255.0; + double b = g_ColorRefs[color].m_Blue / 255.0; if( negativeMode ) emitSetRGBColor( 1 - r, 1 - g, 1 - b ); else diff --git a/common/drawframe.cpp b/common/drawframe.cpp index 5c08e7ffe6..9ce99459b2 100644 --- a/common/drawframe.cpp +++ b/common/drawframe.cpp @@ -162,9 +162,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* aParent, m_messagePanel = new EDA_MSG_PANEL( this, -1, wxPoint( 0, m_FrameSize.y ), wxSize( m_FrameSize.x, m_MsgFrameHeight ) ); - m_messagePanel->SetBackgroundColour( wxColour( ColorRefs[LIGHTGRAY].m_Red, - ColorRefs[LIGHTGRAY].m_Green, - ColorRefs[LIGHTGRAY].m_Blue ) ); + m_messagePanel->SetBackgroundColour( MakeColour( LIGHTGRAY ) ); } diff --git a/common/gr_basic.cpp b/common/gr_basic.cpp index 9706ad5016..eb38f55cd7 100644 --- a/common/gr_basic.cpp +++ b/common/gr_basic.cpp @@ -1451,3 +1451,103 @@ void GRBezier( EDA_RECT* ClipBox, std::vector Points = Bezier2Poly( x1, y1, x2, y2, x3, y3, x4, y4 ); GRPoly( ClipBox, DC, Points.size(), &Points[0], false, width, Color, Color ); } + + +EDA_COLOR_T ColorMix( EDA_COLOR_T aColor1, EDA_COLOR_T aColor2 ) +{ + /* Memoization storage. This could be potentially called for each + * color merge so a cache is useful (there are few colours anyway) */ + static EDA_COLOR_T mix_cache[NBCOLORS][NBCOLORS]; + + // TODO how is alpha used? it's a mac only thing, I have no idea + aColor1 = ColorGetBase( aColor1 ); + aColor2 = ColorGetBase( aColor2 ); + + // First easy thing: a black gives always the other colour + if( aColor1 == BLACK ) + return aColor2; + if( aColor2 == BLACK) + return aColor1; + + /* Now we are sure that black can't occur, so the rule is: + * BLACK means not computed yet. If we're lucky we already have + * an answer */ + EDA_COLOR_T candidate = mix_cache[aColor1][aColor2]; + if( candidate != BLACK ) + return candidate; + + // Blend the two colors (i.e. OR the RGB values) + const StructColors &c1 = g_ColorRefs[aColor1]; + const StructColors &c2 = g_ColorRefs[aColor2]; + + // Ask the palette for the nearest color to the mix + wxColour mixed( c1.m_Red | c2.m_Red, + c1.m_Green | c2.m_Green, + c1.m_Blue | c2.m_Blue ); + candidate = ColorFindNearest( mixed ); + + /* Here, BLACK is *not* a good answer, since it would recompute the next time. + * Even theorically its not possible (with the current rules), but + * maybe the metric will change in the future */ + if( candidate == BLACK) + candidate = DARKDARKGRAY; + + // Store the result in the cache. The operation is commutative, too + mix_cache[aColor1][aColor2] = candidate; + mix_cache[aColor2][aColor1] = candidate; + return candidate; +} + + +EDA_COLOR_T ColorByName( const wxChar *aName ) +{ + // look for a match in the palette itself + for( EDA_COLOR_T trying = BLACK; trying < NBCOLORS; ++trying ) + { + if( 0 == wxStricmp( aName, g_ColorRefs[trying].m_Name ) ) + return trying; + } + + // Not found, no idea... + return UNSPECIFIED_COLOR; +} + + +EDA_COLOR_T ColorFindNearest( const wxColour &aColor ) +{ + EDA_COLOR_T candidate = BLACK; + + // These are ints because we will subtract them later + int r = aColor.Red(); + int g = aColor.Green(); + int b = aColor.Blue(); + + /* Find the 'nearest' color in the palette. This is fun. There is + a gazilion of metrics for the color space and no one of the + useful one is in the RGB color space. Who cares, this is a CAD, + not a photosomething... + + I hereby declare that the distance is the sum of the square of the + component difference. Think about the RGB color cube. Now get the + euclidean distance, but without the square root... for ordering + purposes it's the same, obviously. Also each component can't be + less of the target one, since I found this currently work better... + */ + int nearest_distance = 255 * 255 * 3 + 1; // Can't beat this + + for( EDA_COLOR_T trying = BLACK; trying < NBCOLORS; ++trying ) + { + const StructColors &c = g_ColorRefs[trying]; + int distance = (r - c.m_Red) * (r - c.m_Red) + + (g - c.m_Green) * (g - c.m_Green) + + (b - c.m_Blue) * (b - c.m_Blue); + if( distance < nearest_distance && c.m_Red >= r && + c.m_Green >= g && c.m_Blue >= b ) + { + nearest_distance = distance; + candidate = trying; + } + } + + return candidate; +} diff --git a/common/msgpanel.cpp b/common/msgpanel.cpp index 7aeebbbb52..2ec882c3e8 100644 --- a/common/msgpanel.cpp +++ b/common/msgpanel.cpp @@ -205,9 +205,7 @@ void EDA_MSG_PANEL::showItem( wxDC& aDC, const MSG_PANEL_ITEM& aItem ) if( color >= 0 ) { color = ColorGetBase( color ); - aDC.SetTextForeground( wxColour( ColorRefs[color].m_Red, - ColorRefs[color].m_Green, - ColorRefs[color].m_Blue ) ); + aDC.SetTextForeground( MakeColour( color ) ); } if( !aItem.m_UpperText.IsEmpty() ) diff --git a/common/projet_config.cpp b/common/projet_config.cpp index 5ebb436256..2a488b8aa0 100644 --- a/common/projet_config.cpp +++ b/common/projet_config.cpp @@ -371,13 +371,11 @@ PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( bool Insetup, void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig ) const { - static const int MAX_COLOR = 0x8001F; - if( m_Pt_param == NULL || aConfig == NULL ) return; - EDA_COLOR_T itmp = ColorFromInt( aConfig->Read( m_Ident, m_Default ) ); + EDA_COLOR_T itmp = ColorByName( aConfig->Read( m_Ident, wxT("NONE") ) ); - if( (itmp < 0) || (itmp > MAX_COLOR) ) + if( itmp == UNSPECIFIED_COLOR ) itmp = m_Default; *m_Pt_param = itmp; } @@ -388,7 +386,7 @@ void PARAM_CFG_SETCOLOR::SaveParam( wxConfigBase* aConfig ) const if( m_Pt_param == NULL || aConfig == NULL ) return; - aConfig->Write( m_Ident, (long) *m_Pt_param ); + aConfig->Write( m_Ident, ColorGetName( *m_Pt_param ) ); } diff --git a/common/selcolor.cpp b/common/selcolor.cpp index f4b395bf09..13dec6c276 100644 --- a/common/selcolor.cpp +++ b/common/selcolor.cpp @@ -54,7 +54,7 @@ EDA_COLOR_T DisplayColorFrame( wxWindow* parent, int OldColor ) framepos, OldColor ); color = static_cast( frame->ShowModal() ); frame->Destroy(); - if( color > NBCOLOR ) + if( color > NBCOLORS ) color = UNSPECIFIED_COLOR; return color; } @@ -125,7 +125,7 @@ void WinEDA_SelColorFrame::Init_Dialog( int aOldColor ) wxStdDialogButtonSizer* StdDialogButtonSizer = NULL; wxButton* Button = NULL; - int ii, butt_ID, buttcolor; + int ii, butt_ID; int w = 20, h = 20; bool ColorFound = false; @@ -137,7 +137,7 @@ void WinEDA_SelColorFrame::Init_Dialog( int aOldColor ) MainBoxSizer = new wxBoxSizer( wxHORIZONTAL ); OuterBoxSizer->Add( MainBoxSizer, 1, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 ); - for( ii = 0; ColorRefs[ii].m_Name != NULL && ii < NBCOLOR; ii++ ) + for( ii = 0; ii < NBCOLORS; ++ii ) { // Provide a separate column for every eight buttons (and their // associated text strings), so provide a FlexGrid Sizer with @@ -163,11 +163,9 @@ void WinEDA_SelColorFrame::Init_Dialog( int aOldColor ) wxBitmap ButtBitmap( w, h ); wxBrush Brush; iconDC.SelectObject( ButtBitmap ); - buttcolor = ColorRefs[ii].m_Numcolor; + EDA_COLOR_T buttcolor = g_ColorRefs[ii].m_Numcolor; iconDC.SetPen( *wxBLACK_PEN ); - Brush.SetColour( ColorRefs[buttcolor].m_Red, - ColorRefs[buttcolor].m_Green, - ColorRefs[buttcolor].m_Blue ); + ColorSetBrush( &Brush, buttcolor ); Brush.SetStyle( wxSOLID ); iconDC.SetBrush( Brush ); @@ -190,7 +188,7 @@ void WinEDA_SelColorFrame::Init_Dialog( int aOldColor ) BitmapButton->SetFocus(); } - Label = new wxStaticText( this, -1, ColorRefs[ii].m_Name, + Label = new wxStaticText( this, -1, ColorGetName( buttcolor ), wxDefaultPosition, wxDefaultSize, 0 ); FlexColumnBoxSizer->Add( Label, 1, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | diff --git a/eeschema/bus-wire-junction.cpp b/eeschema/bus-wire-junction.cpp index 1072491a17..a2440f0800 100644 --- a/eeschema/bus-wire-junction.cpp +++ b/eeschema/bus-wire-junction.cpp @@ -67,7 +67,7 @@ static void DrawSegment( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi return; segment = (SCH_LINE*) s_wires.begin(); - EDA_COLOR_T color = ReturnLayerColor( segment->GetLayer() ); + EDA_COLOR_T color = GetLayerColor( segment->GetLayer() ); ColorChangeHighlightFlag( &color, !(color & HIGHLIGHT_FLAG) ); if( aErase ) diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp index 3d2341d565..a525245cfe 100644 --- a/eeschema/class_libentry.cpp +++ b/eeschema/class_libentry.cpp @@ -391,7 +391,7 @@ void LIB_COMPONENT::Plot( PLOTTER* aPlotter, int aUnit, int aConvert, if( aConvert && item.m_Convert && ( item.m_Convert != aConvert ) ) continue; - aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE ) ); + aPlotter->SetColor( GetLayerColor( LAYER_DEVICE ) ); bool fill = aPlotter->GetColorMode(); item.Plot( aPlotter, aOffset, fill, aTransform ); diff --git a/eeschema/dialogs/dialog_color_config.cpp b/eeschema/dialogs/dialog_color_config.cpp index 57ec480a0a..e28842b048 100644 --- a/eeschema/dialogs/dialog_color_config.cpp +++ b/eeschema/dialogs/dialog_color_config.cpp @@ -130,7 +130,6 @@ void DIALOG_COLOR_CONFIG::Init() void DIALOG_COLOR_CONFIG::CreateControls() { wxStaticText* label; - int color; int buttonId = 1800; ButtonIndex* groups = buttonGroups; @@ -168,12 +167,10 @@ void DIALOG_COLOR_CONFIG::CreateControls() wxBitmap bitmap( BUTT_SIZE_X, BUTT_SIZE_Y ); iconDC.SelectObject( bitmap ); - color = currentColors[ buttons->m_Layer ] = ReturnLayerColor( buttons->m_Layer ); + EDA_COLOR_T color = currentColors[ buttons->m_Layer ] = GetLayerColor( buttons->m_Layer ); iconDC.SetPen( *wxBLACK_PEN ); wxBrush brush; - brush.SetColour( ColorRefs[ color ].m_Red, - ColorRefs[ color ].m_Green, - ColorRefs[ color ].m_Blue ); + ColorSetBrush( &brush, color ); brush.SetStyle( wxSOLID ); iconDC.SetBrush( brush ); @@ -267,9 +264,7 @@ void DIALOG_COLOR_CONFIG::SetColor( wxCommandEvent& event ) iconDC.SelectObject( bitmap ); wxBrush brush; iconDC.SetPen( *wxBLACK_PEN ); - brush.SetColour( ColorRefs[ color ].m_Red, - ColorRefs[ color ].m_Green, - ColorRefs[ color ].m_Blue ); + ColorSetBrush( &brush, color); brush.SetStyle( wxSOLID ); iconDC.SetBrush( brush ); @@ -295,13 +290,13 @@ bool DIALOG_COLOR_CONFIG::UpdateColorsSettings() { SetLayerColor( currentColors[ ii ], ii ); - if( g_DrawBgColor == ReturnLayerColor( ii ) ) + if( g_DrawBgColor == GetLayerColor( ii ) ) warning = true; } - m_Parent->SetGridColor( ReturnLayerColor( LAYER_GRID ) ); + m_Parent->SetGridColor( GetLayerColor( LAYER_GRID ) ); - if( g_DrawBgColor == ReturnLayerColor( LAYER_GRID ) ) + if( g_DrawBgColor == GetLayerColor( LAYER_GRID ) ) warning = true; return warning; diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index 1ec9a4e2fa..438d57c597 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -90,7 +90,7 @@ void SetDefaultLineThickness( int aThickness) s_drawDefaultLineThickness = 1; } -EDA_COLOR_T ReturnLayerColor( int aLayer ) +EDA_COLOR_T GetLayerColor( int aLayer ) { return s_layerColor[aLayer]; } @@ -460,80 +460,80 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetConfigurationSettings( void ) 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" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorWireEx" ), &s_layerColor[LAYER_WIRE], GREEN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorBus" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorBusEx" ), &s_layerColor[LAYER_BUS], BLUE ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorConn" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorConnEx" ), &s_layerColor[LAYER_JUNCTION], GREEN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLlab" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLLabelEx" ), &s_layerColor[LAYER_LOCLABEL], BLACK ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorHlab" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorHLabelEx" ), &s_layerColor[LAYER_HIERLABEL], BROWN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorGbllab" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorGLabelEx" ), &s_layerColor[LAYER_GLOBLABEL], RED ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPinF" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPinFunEx" ), &s_layerColor[LAYER_PINFUN], MAGENTA ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColPinN" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPinNumEx" ), &s_layerColor[LAYER_PINNUM], RED ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPNam" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPinNameEx" ), &s_layerColor[LAYER_PINNAM], CYAN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorField" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorFieldEx" ), &s_layerColor[LAYER_FIELDS], MAGENTA ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorRef" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorReferenceEx" ), &s_layerColor[LAYER_REFERENCEPART], CYAN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorValue" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorValueEx" ), &s_layerColor[LAYER_VALUEPART], CYAN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNote" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNoteEx" ), &s_layerColor[LAYER_NOTES], LIGHTBLUE ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorBody" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorBodyEx" ), &s_layerColor[LAYER_DEVICE], RED ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorBodyBg" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorBodyBgEx" ), &s_layerColor[LAYER_DEVICE_BACKGROUND], LIGHTYELLOW ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNetN" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNetNameEx" ), &s_layerColor[LAYER_NETNAM], DARKGRAY ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPin" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPinEx" ), &s_layerColor[LAYER_PIN], RED ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorSheet" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorSheetEx" ), &s_layerColor[LAYER_SHEET], MAGENTA ) ); m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, - wxT( "ColorSheetFileName" ), + wxT( "ColorSheetFileNameEx" ), &s_layerColor[LAYER_SHEETFILENAME], BROWN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorSheetName" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorSheetNameEx" ), &s_layerColor[LAYER_SHEETNAME], CYAN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorSheetLab" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorSheetLabelEx" ), &s_layerColor[LAYER_SHEETLABEL], BROWN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNoCo" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNoConnectEx" ), &s_layerColor[LAYER_NOCONNECT], BLUE ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorErcW" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorErcWEx" ), &s_layerColor[LAYER_ERC_WARN], GREEN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorErcE" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorErcEEx" ), &s_layerColor[LAYER_ERC_ERR], RED ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorGrid" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorGridEx" ), &s_layerColor[LAYER_GRID], DARKGRAY ) ); m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "PrintMonochrome" ), @@ -558,7 +558,7 @@ void SCH_EDIT_FRAME::LoadSettings() wxGetApp().ReadCurrentSetupValues( GetConfigurationSettings() ); // This is required until someone gets rid of the global variable s_layerColor. - m_GridColor = ReturnLayerColor( LAYER_GRID ); + m_GridColor = GetLayerColor( LAYER_GRID ); SetDefaultBusThickness( cfg->Read( DefaultBusWidthEntry, 12l ) ); SetDefaultLineThickness( cfg->Read( DefaultDrawLineWidthEntry, 6l ) ); diff --git a/eeschema/general.h b/eeschema/general.h index 16ee83ea5e..ddf0d5373b 100644 --- a/eeschema/general.h +++ b/eeschema/general.h @@ -90,7 +90,7 @@ void SetDefaultLineThickness( int aThickness); int GetDefaultBusThickness(); void SetDefaultBusThickness( int aThickness ); -EDA_COLOR_T ReturnLayerColor( int aLayer ); +EDA_COLOR_T GetLayerColor( int aLayer ); // Color to draw selected items EDA_COLOR_T GetItemSelectedColor(); diff --git a/eeschema/lib_arc.cpp b/eeschema/lib_arc.cpp index 2107bc715e..bc219fbb42 100644 --- a/eeschema/lib_arc.cpp +++ b/eeschema/lib_arc.cpp @@ -370,12 +370,12 @@ void LIB_ARC::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR ) { - aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); + aPlotter->SetColor( GetLayerColor( LAYER_DEVICE_BACKGROUND ) ); aPlotter->Arc( pos, -t2, -t1, m_Radius, FILLED_SHAPE, 0 ); } bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR; - aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE ) ); + aPlotter->SetColor( GetLayerColor( LAYER_DEVICE ) ); aPlotter->Arc( pos, -t2, -t1, m_Radius, already_filled ? NO_FILL : m_Fill, GetPenSize() ); } @@ -416,7 +416,7 @@ void LIB_ARC::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf return; wxPoint pos1, pos2, posc; - EDA_COLOR_T color = ReturnLayerColor( LAYER_DEVICE ); + EDA_COLOR_T color = GetLayerColor( LAYER_DEVICE ); if( aColor < 0 ) // Used normal color or selected color { @@ -452,8 +452,8 @@ void LIB_ARC::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf { GRFilledArc( aPanel->GetClipBox(), aDC, posc.x, posc.y, pt1, pt2, m_Radius, GetPenSize( ), - (m_Flags & IS_MOVED) ? color : ReturnLayerColor( LAYER_DEVICE_BACKGROUND ), - ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); + (m_Flags & IS_MOVED) ? color : GetLayerColor( LAYER_DEVICE_BACKGROUND ), + GetLayerColor( LAYER_DEVICE_BACKGROUND ) ); } else if( fill == FILLED_SHAPE && !aData ) { diff --git a/eeschema/lib_bezier.cpp b/eeschema/lib_bezier.cpp index 9ef49e9a78..2caa429e01 100644 --- a/eeschema/lib_bezier.cpp +++ b/eeschema/lib_bezier.cpp @@ -270,12 +270,12 @@ void LIB_BEZIER::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR ) { - aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); + aPlotter->SetColor( GetLayerColor( LAYER_DEVICE_BACKGROUND ) ); aPlotter->PlotPoly( cornerList, FILLED_WITH_BG_BODYCOLOR, 0 ); } bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR; - aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE ) ); + aPlotter->SetColor( GetLayerColor( LAYER_DEVICE ) ); aPlotter->PlotPoly( cornerList, already_filled ? NO_FILL : m_Fill, GetPenSize() ); } @@ -293,7 +293,7 @@ void LIB_BEZIER::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& wxPoint pos1; std::vector PolyPointsTraslated; - EDA_COLOR_T color = ReturnLayerColor( LAYER_DEVICE ); + EDA_COLOR_T color = GetLayerColor( LAYER_DEVICE ); m_PolyPoints = Bezier2Poly( m_BezierPoints[0], m_BezierPoints[1], @@ -326,8 +326,8 @@ void LIB_BEZIER::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& if( fill == FILLED_WITH_BG_BODYCOLOR ) GRPoly( aPanel->GetClipBox(), aDC, m_PolyPoints.size(), &PolyPointsTraslated[0], 1, GetPenSize(), - (m_Flags & IS_MOVED) ? color : ReturnLayerColor( LAYER_DEVICE_BACKGROUND ), - ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); + (m_Flags & IS_MOVED) ? color : GetLayerColor( LAYER_DEVICE_BACKGROUND ), + GetLayerColor( LAYER_DEVICE_BACKGROUND ) ); else if( fill == FILLED_SHAPE ) GRPoly( aPanel->GetClipBox(), aDC, m_PolyPoints.size(), &PolyPointsTraslated[0], 1, GetPenSize(), color, color ); diff --git a/eeschema/lib_circle.cpp b/eeschema/lib_circle.cpp index 9e957863fc..eba6999410 100644 --- a/eeschema/lib_circle.cpp +++ b/eeschema/lib_circle.cpp @@ -194,12 +194,12 @@ void LIB_CIRCLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR ) { - aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); + aPlotter->SetColor( GetLayerColor( LAYER_DEVICE_BACKGROUND ) ); aPlotter->Circle( pos, m_Radius * 2, FILLED_SHAPE, 0 ); } bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR; - aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE ) ); + aPlotter->SetColor( GetLayerColor( LAYER_DEVICE ) ); aPlotter->Circle( pos, m_Radius * 2, already_filled ? NO_FILL : m_Fill, GetPenSize() ); } @@ -216,7 +216,7 @@ void LIB_CIRCLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& { wxPoint pos1; - EDA_COLOR_T color = ReturnLayerColor( LAYER_DEVICE ); + EDA_COLOR_T color = GetLayerColor( LAYER_DEVICE ); if( aColor < 0 ) // Used normal color or selected color { @@ -237,8 +237,8 @@ void LIB_CIRCLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& if( fill == FILLED_WITH_BG_BODYCOLOR ) GRFilledCircle( aPanel->GetClipBox(), aDC, pos1.x, pos1.y, m_Radius, GetPenSize(), - (m_Flags & IS_MOVED) ? color : ReturnLayerColor( LAYER_DEVICE_BACKGROUND ), - ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); + (m_Flags & IS_MOVED) ? color : GetLayerColor( LAYER_DEVICE_BACKGROUND ), + GetLayerColor( LAYER_DEVICE_BACKGROUND ) ); else if( fill == FILLED_SHAPE ) GRFilledCircle( aPanel->GetClipBox(), aDC, pos1.x, pos1.y, m_Radius, 0, color, color ); else diff --git a/eeschema/lib_draw_item.cpp b/eeschema/lib_draw_item.cpp index faafab2c1b..14c26e191e 100644 --- a/eeschema/lib_draw_item.cpp +++ b/eeschema/lib_draw_item.cpp @@ -156,5 +156,5 @@ void LIB_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, EDA_COLOR_T LIB_ITEM::GetDefaultColor() { - return ReturnLayerColor( LAYER_DEVICE ); + return GetLayerColor( LAYER_DEVICE ); } diff --git a/eeschema/lib_field.cpp b/eeschema/lib_field.cpp index b52414e7cb..b4bafcc4f2 100644 --- a/eeschema/lib_field.cpp +++ b/eeschema/lib_field.cpp @@ -523,15 +523,15 @@ EDA_COLOR_T LIB_FIELD::GetDefaultColor() switch( m_id ) { case REFERENCE: - color = ReturnLayerColor( LAYER_REFERENCEPART ); + color = GetLayerColor( LAYER_REFERENCEPART ); break; case VALUE: - color = ReturnLayerColor( LAYER_VALUEPART ); + color = GetLayerColor( LAYER_VALUEPART ); break; default: - color = ReturnLayerColor( LAYER_FIELDS ); + color = GetLayerColor( LAYER_FIELDS ); break; } diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index a7e636c020..0861f79762 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -860,7 +860,7 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel, int posX = aPinPos.x, posY = aPinPos.y, len = m_length; EDA_RECT* clipbox = aPanel ? aPanel->GetClipBox() : NULL; - EDA_COLOR_T color = ReturnLayerColor( LAYER_PIN ); + EDA_COLOR_T color = GetLayerColor( LAYER_PIN ); if( aColor < 0 ) // Used normal color or selected color { @@ -1090,9 +1090,9 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, Color = GetItemSelectedColor(); NameColor = (EDA_COLOR_T) ( Color == UNSPECIFIED_COLOR ? - ReturnLayerColor( LAYER_PINNAM ) : Color ); + GetLayerColor( LAYER_PINNAM ) : Color ); NumColor = (EDA_COLOR_T) ( Color == UNSPECIFIED_COLOR ? - ReturnLayerColor( LAYER_PINNUM ) : Color ); + GetLayerColor( LAYER_PINNUM ) : Color ); /* Create the pin num string */ ReturnPinStringNum( StringPinNum ); @@ -1271,7 +1271,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel, void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrientation ) { int MapX1, MapY1, x1, y1; - EDA_COLOR_T color = ReturnLayerColor( LAYER_PIN ); + EDA_COLOR_T color = GetLayerColor( LAYER_PIN ); aPlotter->SetColor( color ); @@ -1385,8 +1385,8 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxSize PinNumSize = wxSize( m_numTextSize, m_numTextSize ); /* Get the num and name colors */ - NameColor = ReturnLayerColor( LAYER_PINNAM ); - NumColor = ReturnLayerColor( LAYER_PINNUM ); + NameColor = GetLayerColor( LAYER_PINNAM ); + NumColor = GetLayerColor( LAYER_PINNUM ); /* Create the pin num string */ ReturnPinStringNum( StringPinNum ); diff --git a/eeschema/lib_polyline.cpp b/eeschema/lib_polyline.cpp index 072fdda345..86807d6b97 100644 --- a/eeschema/lib_polyline.cpp +++ b/eeschema/lib_polyline.cpp @@ -242,13 +242,13 @@ void LIB_POLYLINE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR ) { - aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); + aPlotter->SetColor( GetLayerColor( LAYER_DEVICE_BACKGROUND ) ); aPlotter->PlotPoly( cornerList, FILLED_WITH_BG_BODYCOLOR, 0 ); aFill = false; // body is now filled, do not fill it later. } bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR; - aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE ) ); + aPlotter->SetColor( GetLayerColor( LAYER_DEVICE ) ); aPlotter->PlotPoly( cornerList, already_filled ? NO_FILL : m_Fill, GetPenSize() ); } @@ -270,7 +270,7 @@ void LIB_POLYLINE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint const TRANSFORM& aTransform ) { wxPoint pos1; - EDA_COLOR_T color = ReturnLayerColor( LAYER_DEVICE ); + EDA_COLOR_T color = GetLayerColor( LAYER_DEVICE ); wxPoint* buffer = NULL; if( aColor < 0 ) // Used normal color or selected color @@ -299,8 +299,8 @@ void LIB_POLYLINE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint if( fill == FILLED_WITH_BG_BODYCOLOR ) GRPoly( aPanel->GetClipBox(), aDC, m_PolyPoints.size(), buffer, 1, GetPenSize(), - (m_Flags & IS_MOVED) ? color : ReturnLayerColor( LAYER_DEVICE_BACKGROUND ), - ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); + (m_Flags & IS_MOVED) ? color : GetLayerColor( LAYER_DEVICE_BACKGROUND ), + GetLayerColor( LAYER_DEVICE_BACKGROUND ) ); else if( fill == FILLED_SHAPE ) GRPoly( aPanel->GetClipBox(), aDC, m_PolyPoints.size(), buffer, 1, GetPenSize(), color, color ); diff --git a/eeschema/lib_rectangle.cpp b/eeschema/lib_rectangle.cpp index 019f6f20ec..5ac99ba5a2 100644 --- a/eeschema/lib_rectangle.cpp +++ b/eeschema/lib_rectangle.cpp @@ -179,12 +179,12 @@ void LIB_RECTANGLE::Plot( PLOTTER* aPlotter, const wxPoint& aOffset, bool aFill, if( aFill && m_Fill == FILLED_WITH_BG_BODYCOLOR ) { - aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); + aPlotter->SetColor( GetLayerColor( LAYER_DEVICE_BACKGROUND ) ); aPlotter->Rect( pos, end, FILLED_WITH_BG_BODYCOLOR, 0 ); } bool already_filled = m_Fill == FILLED_WITH_BG_BODYCOLOR; - aPlotter->SetColor( ReturnLayerColor( LAYER_DEVICE ) ); + aPlotter->SetColor( GetLayerColor( LAYER_DEVICE ) ); aPlotter->Rect( pos, end, already_filled ? NO_FILL : m_Fill, GetPenSize() ); } @@ -201,7 +201,7 @@ void LIB_RECTANGLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, { wxPoint pos1, pos2; - EDA_COLOR_T color = ReturnLayerColor( LAYER_DEVICE ); + EDA_COLOR_T color = GetLayerColor( LAYER_DEVICE ); if( aColor < 0 ) // Used normal color or selected color { @@ -225,8 +225,8 @@ void LIB_RECTANGLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, if( fill == FILLED_WITH_BG_BODYCOLOR && !aData ) GRFilledRect( aPanel->GetClipBox(), aDC, pos1.x, pos1.y, pos2.x, pos2.y, GetPenSize( ), - (m_Flags & IS_MOVED) ? color : ReturnLayerColor( LAYER_DEVICE_BACKGROUND ), - ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); + (m_Flags & IS_MOVED) ? color : GetLayerColor( LAYER_DEVICE_BACKGROUND ), + GetLayerColor( LAYER_DEVICE_BACKGROUND ) ); else if( m_Fill == FILLED_SHAPE && !aData ) GRFilledRect( aPanel->GetClipBox(), aDC, pos1.x, pos1.y, pos2.x, pos2.y, GetPenSize(), color, color ); diff --git a/eeschema/protos.h b/eeschema/protos.h index e19c93b8d4..47341416b5 100644 --- a/eeschema/protos.h +++ b/eeschema/protos.h @@ -48,12 +48,6 @@ SCH_ITEM* DuplicateStruct( SCH_ITEM* DrawStruct, bool aClone = false ); void DrawDanglingSymbol( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& pos, EDA_COLOR_T Color ); -/***********************************/ -/* dialogs/dialog_color_config.cpp */ -/***********************************/ -EDA_COLOR_T ReturnLayerColor( int Layer ); - - /***************/ /* SELPART.CPP */ /***************/ diff --git a/eeschema/sch_bitmap.cpp b/eeschema/sch_bitmap.cpp index 7cce2b7d3b..a69ec64b45 100644 --- a/eeschema/sch_bitmap.cpp +++ b/eeschema/sch_bitmap.cpp @@ -301,5 +301,5 @@ bool SCH_BITMAP::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy void SCH_BITMAP::Plot( PLOTTER* aPlotter ) { - m_Image->PlotImage( aPlotter, m_Pos, ReturnLayerColor( GetLayer() ), GetPenSize() ); + m_Image->PlotImage( aPlotter, m_Pos, GetLayerColor( GetLayer() ), GetPenSize() ); } diff --git a/eeschema/sch_bus_entry.cpp b/eeschema/sch_bus_entry.cpp index e792949410..22b9cbde18 100644 --- a/eeschema/sch_bus_entry.cpp +++ b/eeschema/sch_bus_entry.cpp @@ -187,7 +187,7 @@ void SCH_BUS_ENTRY_BASE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& if( aColor >= 0 ) color = aColor; else - color = ReturnLayerColor( m_Layer ); + color = GetLayerColor( m_Layer ); GRSetDrawMode( aDC, aDrawMode ); @@ -287,7 +287,7 @@ bool SCH_BUS_ENTRY_BASE::HitTest( const EDA_RECT& aRect, bool aContained, int aA void SCH_BUS_ENTRY_BASE::Plot( PLOTTER* aPlotter ) { aPlotter->SetCurrentLineWidth( GetPenSize() ); - aPlotter->SetColor( ReturnLayerColor( GetLayer() ) ); + aPlotter->SetColor( GetLayerColor( GetLayer() ) ); aPlotter->MoveTo( m_pos ); aPlotter->FinishTo( m_End() ); } diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index 7a86a35a3e..c2691c0780 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -187,11 +187,11 @@ void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, else { if( m_id == REFERENCE ) - color = ReturnLayerColor( LAYER_REFERENCEPART ); + color = GetLayerColor( LAYER_REFERENCEPART ); else if( m_id == VALUE ) - color = ReturnLayerColor( LAYER_VALUEPART ); + color = GetLayerColor( LAYER_VALUEPART ); else - color = ReturnLayerColor( LAYER_FIELDS ); + color = GetLayerColor( LAYER_FIELDS ); } DrawGraphicText( panel, DC, textpos, color, GetFullyQualifiedText(), orient, m_Size, @@ -537,7 +537,7 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter ) wxCHECK_RET( parent != NULL && parent->Type() == SCH_COMPONENT_T, wxT( "Cannot plot field with invalid parent." ) ); - EDA_COLOR_T color = ReturnLayerColor( GetLayer() ); + EDA_COLOR_T color = GetLayerColor( GetLayer() ); if( m_Attributs & TEXT_NO_VISIBLE ) return; diff --git a/eeschema/sch_junction.cpp b/eeschema/sch_junction.cpp index 4e715aa247..b41b28521f 100644 --- a/eeschema/sch_junction.cpp +++ b/eeschema/sch_junction.cpp @@ -125,7 +125,7 @@ void SCH_JUNCTION::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffs if( aColor >= 0 ) color = aColor; else - color = ReturnLayerColor( m_Layer ); + color = GetLayerColor( m_Layer ); GRSetDrawMode( aDC, aDrawMode ); @@ -242,6 +242,6 @@ bool SCH_JUNCTION::doIsConnected( const wxPoint& aPosition ) const void SCH_JUNCTION::Plot( PLOTTER* aPlotter ) { - aPlotter->SetColor( ReturnLayerColor( GetLayer() ) ); + aPlotter->SetColor( GetLayerColor( GetLayer() ) ); aPlotter->Circle( m_pos, m_size.x, FILLED_SHAPE ); } diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp index d1a36da083..c95de0a913 100644 --- a/eeschema/sch_line.cpp +++ b/eeschema/sch_line.cpp @@ -224,7 +224,7 @@ void SCH_LINE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset, if( Color >= 0 ) color = Color; else - color = ReturnLayerColor( m_Layer ); + color = GetLayerColor( m_Layer ); GRSetDrawMode( DC, DrawMode ); @@ -596,7 +596,7 @@ bool SCH_LINE::doIsConnected( const wxPoint& aPosition ) const void SCH_LINE::Plot( PLOTTER* aPlotter ) { - aPlotter->SetColor( ReturnLayerColor( GetLayer() ) ); + aPlotter->SetColor( GetLayerColor( GetLayer() ) ); aPlotter->SetCurrentLineWidth( GetPenSize() ); if( m_Layer == LAYER_NOTES ) diff --git a/eeschema/sch_marker.cpp b/eeschema/sch_marker.cpp index c559c7449c..99af636539 100644 --- a/eeschema/sch_marker.cpp +++ b/eeschema/sch_marker.cpp @@ -111,8 +111,8 @@ void SCH_MARKER::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, if( GetMarkerType() == MARK_ERC ) { - color = ( GetErrorLevel() == WAR ) ? ReturnLayerColor( LAYER_ERC_WARN ) : - ReturnLayerColor( LAYER_ERC_ERR ); + color = ( GetErrorLevel() == WAR ) ? GetLayerColor( LAYER_ERC_WARN ) : + GetLayerColor( LAYER_ERC_ERR ); } if( aColor < 0 ) diff --git a/eeschema/sch_no_connect.cpp b/eeschema/sch_no_connect.cpp index d375f842d1..8225ee6e40 100644 --- a/eeschema/sch_no_connect.cpp +++ b/eeschema/sch_no_connect.cpp @@ -136,7 +136,7 @@ void SCH_NO_CONNECT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf if( aColor >= 0 ) color = aColor; else - color = ReturnLayerColor( LAYER_NOCONNECT ); + color = GetLayerColor( LAYER_NOCONNECT ); GRSetDrawMode( aDC, aDrawMode ); @@ -243,7 +243,7 @@ void SCH_NO_CONNECT::Plot( PLOTTER* aPlotter ) pY = m_pos.y; aPlotter->SetCurrentLineWidth( GetPenSize() ); - aPlotter->SetColor( ReturnLayerColor( GetLayer() ) ); + aPlotter->SetColor( GetLayerColor( GetLayer() ) ); aPlotter->MoveTo( wxPoint( pX - delta, pY - delta ) ); aPlotter->FinishTo( wxPoint( pX + delta, pY + delta ) ); aPlotter->MoveTo( wxPoint( pX + delta, pY - delta ) ); diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index 9335ce4eca..a94e7150b2 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -577,7 +577,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, if( aColor >= 0 ) color = aColor; else - color = ReturnLayerColor( m_Layer ); + color = GetLayerColor( m_Layer ); GRSetDrawMode( aDC, aDrawMode ); @@ -596,7 +596,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, if( aColor > 0 ) txtcolor = aColor; else - txtcolor = ReturnLayerColor( LAYER_SHEETNAME ); + txtcolor = GetLayerColor( LAYER_SHEETNAME ); Text = wxT( "Sheet: " ) + m_name; DrawGraphicText( aPanel, aDC, pos_sheetname, @@ -609,7 +609,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, if( aColor >= 0 ) txtcolor = aColor; else - txtcolor = ReturnLayerColor( LAYER_SHEETFILENAME ); + txtcolor = GetLayerColor( LAYER_SHEETFILENAME ); Text = wxT( "File: " ) + m_fileName; DrawGraphicText( aPanel, aDC, pos_filename, @@ -1106,7 +1106,7 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter ) wxPoint pos_sheetname, pos_filename; wxPoint pos; - aPlotter->SetColor( ReturnLayerColor( GetLayer() ) ); + aPlotter->SetColor( GetLayerColor( GetLayer() ) ); int thickness = GetPenSize(); aPlotter->SetCurrentLineWidth( thickness ); @@ -1146,7 +1146,7 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter ) thickness = GetDefaultLineThickness(); thickness = Clamp_Text_PenSize( thickness, size, false ); - aPlotter->SetColor( ReturnLayerColor( LAYER_SHEETNAME ) ); + aPlotter->SetColor( GetLayerColor( LAYER_SHEETNAME ) ); bool italic = false; aPlotter->Text( pos_sheetname, txtcolor, Text, name_orientation, size, @@ -1159,13 +1159,13 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter ) thickness = GetDefaultLineThickness(); thickness = Clamp_Text_PenSize( thickness, size, false ); - aPlotter->SetColor( ReturnLayerColor( LAYER_SHEETFILENAME ) ); + aPlotter->SetColor( GetLayerColor( LAYER_SHEETFILENAME ) ); aPlotter->Text( pos_filename, txtcolor, Text, name_orientation, size, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, thickness, italic, false ); - aPlotter->SetColor( ReturnLayerColor( GetLayer() ) ); + aPlotter->SetColor( GetLayerColor( GetLayer() ) ); /* Draw texts : SheetLabel */ for( size_t i = 0; i < m_pins.size(); i++ ) diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index 3cdf203175..9be8696555 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -350,7 +350,7 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset, if( Color >= 0 ) color = Color; else - color = ReturnLayerColor( m_Layer ); + color = GetLayerColor( m_Layer ); GRSetDrawMode( DC, DrawMode ); @@ -657,7 +657,7 @@ void SCH_TEXT::Plot( PLOTTER* aPlotter ) { static std::vector Poly; - EDA_COLOR_T color = ReturnLayerColor( GetLayer() ); + EDA_COLOR_T color = GetLayerColor( GetLayer() ); wxPoint textpos = m_Pos + GetSchematicTextOffset(); int thickness = GetPenSize(); @@ -1276,7 +1276,7 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel, if( Color >= 0 ) color = Color; else - color = ReturnLayerColor( m_Layer ); + color = GetLayerColor( m_Layer ); GRSetDrawMode( DC, DrawMode ); @@ -1614,7 +1614,7 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel, if( Color >= 0 ) color = Color; else - color = ReturnLayerColor( m_Layer ); + color = GetLayerColor( m_Layer ); GRSetDrawMode( DC, DrawMode ); diff --git a/gerbview/class_gerber_draw_item.cpp b/gerbview/class_gerber_draw_item.cpp index 39d8053eab..6020f2139e 100644 --- a/gerbview/class_gerber_draw_item.cpp +++ b/gerbview/class_gerber_draw_item.cpp @@ -328,8 +328,7 @@ void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDra if( aDrawMode & GR_HIGHLIGHT ) ColorChangeHighlightFlag( &color, !(aDrawMode & GR_AND) ); - if( color & HIGHLIGHT_FLAG ) - color = ColorRefs[color & MASKCOLOR].m_LightColor; + ColorApplyHighlightFlag( &color ); alt_color = gerbFrame->GetNegativeItemsColor(); diff --git a/gerbview/gerbview_config.cpp b/gerbview/gerbview_config.cpp index 6db6f420dd..f3a06de0b2 100644 --- a/gerbview/gerbview_config.cpp +++ b/gerbview/gerbview_config.cpp @@ -91,12 +91,12 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings() m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "DrawModeOption" ), &m_displayMode, 2, 0, 2 ) ); m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, - wxT( "DCodeColor" ), + wxT( "DCodeColorEx" ), &g_ColorsSettings.m_ItemsColors[ DCODES_VISIBLE], WHITE ) ); m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, - wxT( "NegativeObjectsColor" ), + wxT( "NegativeObjectsColorEx" ), &g_ColorsSettings.m_ItemsColors[ NEGATIVE_OBJECTS_VISIBLE], DARKGRAY ) ); @@ -122,15 +122,14 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings() // because the parameter list that use these keywords does not store them, // just points to them. static const wxChar* keys[] = { - wxT("ColorLayer_0"), wxT("ColorLayer_1"), wxT("ColorLayer_2"), wxT("ColorLayer_3"), - wxT("ColorLayer_4"), wxT("ColorLayer_5"), wxT("ColorLayer_6"), wxT("ColorLayer_7"), - wxT("ColorLayer_8"), wxT("ColorLayer_9"), wxT("ColorLayer_10"), wxT("ColorLayer_11"), - wxT("ColorLayer_12"), wxT("ColorLayer_13"), wxT("ColorLayer_14"), wxT("ColorLayer_15"), - - wxT("ColorLayer_16"), wxT("ColorLayer_17"), wxT("ColorLayer_18"), wxT("ColorLayer_19"), - wxT("ColorLayer_20"), wxT("ColorLayer_21"), wxT("ColorLayer_22"), wxT("ColorLayer_23"), - wxT("ColorLayer_24"), wxT("ColorLayer_25"), wxT("ColorLayer_26"), wxT("ColorLayer_27"), - wxT("ColorLayer_28"), wxT("ColorLayer_29"), wxT("ColorLayer_30"), wxT("ColorLayer_31"), + wxT("ColorLayer0Ex"), wxT("ColorLayer1Ex"), wxT("ColorLayer2Ex"), wxT("ColorLayer3Ex"), + wxT("ColorLayer4Ex"), wxT("ColorLayer5Ex"), wxT("ColorLayer6Ex"), wxT("ColorLayer7Ex"), + wxT("ColorLayer8Ex"), wxT("ColorLayer9Ex"), wxT("ColorLayer10Ex"), wxT("ColorLayer11Ex"), + wxT("ColorLayer12Ex"), wxT("ColorLayer13Ex"), wxT("ColorLayer14Ex"), wxT("ColorLayer15Ex"), + wxT("ColorLayer16Ex"), wxT("ColorLayer17Ex"), wxT("ColorLayer18Ex"), wxT("ColorLayer19Ex"), + wxT("ColorLayer20Ex"), wxT("ColorLayer21Ex"), wxT("ColorLayer22Ex"), wxT("ColorLayer23Ex"), + wxT("ColorLayer24Ex"), wxT("ColorLayer25Ex"), wxT("ColorLayer26Ex"), wxT("ColorLayer27Ex"), + wxT("ColorLayer28Ex"), wxT("ColorLayer29Ex"), wxT("ColorLayer30Ex"), wxT("ColorLayer31Ex"), }; wxASSERT( DIM(keys) == DIM(color_default) ); diff --git a/include/colors.h b/include/colors.h index ee33edc137..feb9575ece 100644 --- a/include/colors.h +++ b/include/colors.h @@ -37,25 +37,37 @@ enum EDA_COLOR_T DARKMAGENTA, DARKBROWN, LIGHTYELLOW, - LASTCOLOR, + NBCOLORS, ///< Number of colors HIGHLIGHT_FLAG = ( 1<<19 ), - NBCOLOR = 24, ///< Number of colors MASKCOLOR = 31 ///< mask for color index into ColorRefs[] }; -/// Checked cast. Use only when necessary (ex. I/O) +/// Checked cast. Use only when necessary (usually I/O) inline EDA_COLOR_T ColorFromInt( int aColor ) { - wxASSERT( aColor >= UNSPECIFIED_COLOR && aColor < LASTCOLOR ); + wxASSERT( aColor >= UNSPECIFIED_COLOR && aColor < NBCOLORS ); return static_cast( aColor ); } +inline EDA_COLOR_T operator++( EDA_COLOR_T& aColor ) +{ + // We have to accept NBCOLORS for loop termination conditions + wxASSERT( aColor >= UNSPECIFIED_COLOR && aColor <= NBCOLORS ); + aColor = static_cast( int( aColor ) + 1 ); + return aColor; +} + + /// Return only the plain color part inline EDA_COLOR_T ColorGetBase( EDA_COLOR_T aColor) { - return static_cast( aColor & MASKCOLOR ); + EDA_COLOR_T base = static_cast( aColor & MASKCOLOR ); + return base; } +/// Mix two colors in some way (hopefully like a logical OR) +EDA_COLOR_T ColorMix( EDA_COLOR_T aColor1, EDA_COLOR_T aColor2 ); + /// Force the color part of a color to darkdarkgray inline void ColorTurnToDarkDarkGray( EDA_COLOR_T *aColor ) { @@ -82,7 +94,6 @@ inline void SetAlpha( EDA_COLOR_T* aColor, unsigned char aBlend ) | ((aBlend & MASKALPHA) << 24)); } - /** * Function GetAlpha * returns the alpha blend parameter from a color index. @@ -105,8 +116,38 @@ struct StructColors EDA_COLOR_T m_LightColor; }; -// list of existing Colors: -extern StructColors ColorRefs[NBCOLOR]; +/// list of existing Colors +extern const StructColors g_ColorRefs[NBCOLORS]; + +/// Step a color to the highlighted version if the highlight flag is set +inline void ColorApplyHighlightFlag( EDA_COLOR_T *aColor ) +{ + EDA_COLOR_T base = ColorGetBase( *aColor ); + wxASSERT( base > UNSPECIFIED_COLOR && base < NBCOLORS ); + if( *aColor & HIGHLIGHT_FLAG ) + *aColor = g_ColorRefs[base].m_LightColor; +} + +/// Find a color by name +EDA_COLOR_T ColorByName( const wxChar *aName ); + +/// Find the nearest color match +EDA_COLOR_T ColorFindNearest( const wxColour &aColor ); + +inline const wxChar *ColorGetName( EDA_COLOR_T aColor ) +{ + EDA_COLOR_T base = ColorGetBase( aColor ); + wxASSERT( base > UNSPECIFIED_COLOR && base < NBCOLORS ); + return g_ColorRefs[base].m_Name; +} + +inline void ColorSetBrush( wxBrush *aBrush, EDA_COLOR_T aColor ) +{ + EDA_COLOR_T base = ColorGetBase( aColor ); + wxASSERT( base > UNSPECIFIED_COLOR && base < NBCOLORS ); + const StructColors &col = g_ColorRefs[base]; + aBrush->SetColour( col.m_Red, col.m_Green, col.m_Blue ); +} /** * Function MakeColour @@ -123,11 +164,12 @@ inline wxColour MakeColour( EDA_COLOR_T aColor ) int alpha = GetAlpha( aColor ); alpha = alpha ? alpha : wxALPHA_OPAQUE; #endif - int ndx = aColor & MASKCOLOR; + EDA_COLOR_T ndx = ColorGetBase( aColor ); + wxASSERT( ndx > UNSPECIFIED_COLOR && ndx < NBCOLORS ); - return wxColour( ColorRefs[ndx].m_Red, - ColorRefs[ndx].m_Green, - ColorRefs[ndx].m_Blue + return wxColour( g_ColorRefs[ndx].m_Red, + g_ColorRefs[ndx].m_Green, + g_ColorRefs[ndx].m_Blue #if wxCHECK_VERSION(2,8,5) ,(unsigned char) alpha #endif diff --git a/include/layers_id_colors_and_visibility.h b/include/layers_id_colors_and_visibility.h index acae0e041f..28dacafee3 100644 --- a/include/layers_id_colors_and_visibility.h +++ b/include/layers_id_colors_and_visibility.h @@ -134,12 +134,26 @@ inline LAYER_MSK GetLayerMask( LAYER_NUM aLayerNumber ) return 1 << aLayerNumber; } +/** + * Count the number of set layers in the mask + */ +inline int LayerMaskCountSet( LAYER_MSK aMask ) +{ + int count = 0; + + for( LAYER_NUM i = FIRST_LAYER; i < NB_LAYERS; ++i ) + { + if( aMask & GetLayerMask( i ) ) + ++count; + } + return count; +} // layers order in dialogs (plot, print and toolbars) // in same order than in setup layers dialog // (Front or Top to Back or Bottom) -#define DECLARE_LAYERS_ORDER_LIST(list) LAYER_NUM list[NB_LAYERS] =\ +#define DECLARE_LAYERS_ORDER_LIST(list) const LAYER_NUM list[NB_LAYERS] =\ { LAYER_N_FRONT,\ LAYER_N_15, LAYER_N_14, LAYER_N_13, LAYER_N_12,\ LAYER_N_11, LAYER_N_10, LAYER_N_9, LAYER_N_8,\ @@ -223,4 +237,39 @@ inline bool IsValidNonCopperLayerIndex( LAYER_NUM aLayerIndex ) && aLayerIndex <= LAST_NON_COPPER_LAYER; } +/* IMPORTANT: If a layer is not a front layer not necessarily is true + the converse. The same hold for a back layer. + So a layer can be: + - Front + - Back + - Neither (internal or auxiliary) + + The check most frequent is for back layers, since it involves flips */ + + +/** + * Layer classification: check if it's a front layer + */ +inline bool IsFrontLayer( LAYER_NUM aLayer ) +{ + return ( aLayer == LAYER_N_FRONT || + aLayer == ADHESIVE_N_FRONT || + aLayer == SOLDERPASTE_N_FRONT || + aLayer == SILKSCREEN_N_FRONT || + aLayer == SOLDERPASTE_N_FRONT ); +} + +/** + * Layer classification: check if it's a back layer + */ +inline bool IsBackLayer( LAYER_NUM aLayer ) +{ + return ( aLayer == LAYER_N_BACK || + aLayer == ADHESIVE_N_BACK || + aLayer == SOLDERPASTE_N_BACK || + aLayer == SILKSCREEN_N_BACK || + aLayer == SOLDERPASTE_N_BACK ); +} + + #endif // _LAYERS_ID_AND_VISIBILITY_H_ diff --git a/include/param_config.h b/include/param_config.h index 65f8759779..59785fc088 100644 --- a/include/param_config.h +++ b/include/param_config.h @@ -161,7 +161,7 @@ public: public: PARAM_CFG_SETCOLOR( const wxChar* ident, EDA_COLOR_T* ptparam, - EDA_COLOR_T default_val, const wxChar* group = NULL ); + EDA_COLOR_T default_val, const wxChar* group = NULL ); PARAM_CFG_SETCOLOR( bool Insetup, const wxChar* ident, EDA_COLOR_T* ptparam, EDA_COLOR_T default_val, const wxChar* group = NULL ); diff --git a/include/plot_common.h b/include/plot_common.h index 437c676d8d..fce08c366b 100644 --- a/include/plot_common.h +++ b/include/plot_common.h @@ -895,7 +895,7 @@ public: protected: bool textAsLines; - int currentColor; + EDA_COLOR_T m_currentColor; }; class TITLE_BLOCK; diff --git a/pcbnew/autorouter/autorout.h b/pcbnew/autorouter/autorout.h index baa2074c65..b1c4f1ab84 100644 --- a/pcbnew/autorouter/autorout.h +++ b/pcbnew/autorouter/autorout.h @@ -34,6 +34,7 @@ #include +#include class BOARD; @@ -208,7 +209,7 @@ void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1, /* Same as above, but the rectangle is inclined angle angle. */ void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1, - int angle, int masque_layer, int color, int op_logic ); + int angle, LAYER_MSK masque_layer, int color, int op_logic ); /* QUEUE.CPP */ void FreeQueue(); diff --git a/pcbnew/autorouter/graphpcb.cpp b/pcbnew/autorouter/graphpcb.cpp index fab7ca6b2e..d7182012d5 100644 --- a/pcbnew/autorouter/graphpcb.cpp +++ b/pcbnew/autorouter/graphpcb.cpp @@ -43,32 +43,32 @@ #include #include -void TracePcbLine( int x0, int y0, int x1, int y1, int layer, int color ); +void TracePcbLine( int x0, int y0, int x1, int y1, LAYER_NUM layer, int color ); void TraceArc( int ux0, int uy0, int ux1, int uy1, int ArcAngle, - int lg, int layer, int color, + int lg, LAYER_NUM layer, int color, int op_logic ); static void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, - int lg, int layer, int color, + int lg, LAYER_NUM layer, int color, int op_logic ); static void TraceFilledCircle( int cx, int cy, int radius, - int aLayerMask, + LAYER_MSK aLayerMask, int color, int op_logic ); -static void TraceCircle( int ux0, int uy0, int ux1, int uy1, int lg, int layer, +static void TraceCircle( int ux0, int uy0, int ux1, int uy1, int lg, LAYER_NUM layer, int color, int op_logic ); // Macro call to update cell. #define OP_CELL( layer, dy, dx ) \ { \ - if( layer < 0 ) \ + if( layer == UNDEFINED_LAYER ) \ { \ RoutingMatrix.WriteCell( dy, dx, BOTTOM, color ); \ if( RoutingMatrix.m_RoutingLayersCount > 1 ) \ @@ -140,7 +140,7 @@ void PlacePad( D_PAD* aPad, int color, int marge, int op_logic ) * op_logic: type of writing in the cell (WRITE, OR) */ void TraceFilledCircle( int cx, int cy, int radius, - int aLayerMask, + LAYER_MSK aLayerMask, int color, int op_logic ) { @@ -273,32 +273,32 @@ void TraceSegmentPcb( TRACK* pt_segm, int color, int marge, int op_logic ) // Test if VIA (filled circle was drawn) if( pt_segm->Type() == PCB_VIA_T ) { - int mask_layer = 0; + LAYER_MSK layer_mask = NO_LAYERS; if( pt_segm->IsOnLayer( g_Route_Layer_BOTTOM ) ) - mask_layer = 1 << g_Route_Layer_BOTTOM; + layer_mask = GetLayerMask( g_Route_Layer_BOTTOM ); if( pt_segm->IsOnLayer( g_Route_Layer_TOP ) ) { - if( mask_layer == 0 ) - mask_layer = 1 << g_Route_Layer_TOP; + if( layer_mask == 0 ) + layer_mask = GetLayerMask( g_Route_Layer_TOP ); else - mask_layer = -1; + layer_mask = FULL_LAYERS; } if( color == VIA_IMPOSSIBLE ) - mask_layer = -1; + layer_mask = FULL_LAYERS; - if( mask_layer ) + if( layer_mask ) TraceFilledCircle( pt_segm->GetStart().x, pt_segm->GetStart().y, - half_width, mask_layer, color, op_logic ); + half_width, layer_mask, color, op_logic ); return; } - int layer = pt_segm->GetLayer(); + LAYER_NUM layer = pt_segm->GetLayer(); if( color == VIA_IMPOSSIBLE ) - layer = -1; + layer = UNDEFINED_LAYER; // The segment is here a straight line or a circle or an arc.: if( pt_segm->GetShape() == S_CIRCLE ) @@ -328,7 +328,7 @@ void TraceSegmentPcb( TRACK* pt_segm, int color, int marge, int op_logic ) /* Draws a line, if layer = -1 on all layers */ -void TracePcbLine( int x0, int y0, int x1, int y1, int layer, int color, int op_logic ) +void TracePcbLine( int x0, int y0, int x1, int y1, LAYER_NUM layer, int color, int op_logic ) { int dx, dy, lim; int cumul, inc, il, delta; @@ -531,7 +531,7 @@ void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1, void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1, - int angle, int aLayerMask, int color, int op_logic ) + int angle, LAYER_MSK aLayerMask, int color, int op_logic ) { int row, col; int cx, cy; // Center of rectangle @@ -623,7 +623,7 @@ void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1, * half-width = lg, org = ux0,uy0 end = ux1,uy1 * coordinates are in PCB units */ -void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer, +void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, LAYER_NUM layer, int color, int op_logic ) { int row, col; @@ -749,7 +749,7 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, int layer, * half-width = lg, center = ux0, uy0, ux1,uy1 is a point on the circle. * coord are in PCB units. */ -void TraceCircle( int ux0, int uy0, int ux1, int uy1, int lg, int layer, +void TraceCircle( int ux0, int uy0, int ux1, int uy1, int lg, LAYER_NUM layer, int color, int op_logic ) { int radius, nb_segm; @@ -794,7 +794,7 @@ void TraceCircle( int ux0, int uy0, int ux1, int uy1, int lg, int layer, * PCB units. */ void TraceArc( int ux0, int uy0, int ux1, int uy1, int ArcAngle, int lg, - int layer, int color, int op_logic ) + LAYER_NUM layer, int color, int op_logic ) { int radius, nb_segm; int x0, y0, // Starting point of the current segment trace diff --git a/pcbnew/autorouter/routing_matrix.cpp b/pcbnew/autorouter/routing_matrix.cpp index 5ed0f91e4b..48708e1088 100644 --- a/pcbnew/autorouter/routing_matrix.cpp +++ b/pcbnew/autorouter/routing_matrix.cpp @@ -198,7 +198,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag ) { int ux0 = 0, uy0 = 0, ux1, uy1, dx, dy; int marge, via_marge; - int layerMask; + LAYER_MSK layerMask; // use the default NETCLASS? NETCLASS* nc = aPcb->m_NetClasses.GetDefault(); diff --git a/pcbnew/class_pad_draw_functions.cpp b/pcbnew/class_pad_draw_functions.cpp index 5db58b736f..23c1706f9b 100644 --- a/pcbnew/class_pad_draw_functions.cpp +++ b/pcbnew/class_pad_draw_functions.cpp @@ -138,7 +138,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode, else drawInfo.m_ShowPadFilled = false; - EDA_COLOR_T color = ColorFromInt(0); // XXX EVIL (it will be ORed later) + EDA_COLOR_T color = BLACK; if( m_layerMask & LAYER_FRONT ) { color = brd->GetVisibleElementColor( PAD_FR_VISIBLE ); @@ -146,13 +146,12 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode, if( m_layerMask & LAYER_BACK ) { - // XXX EVIL merge - color = ColorFromInt( color | brd->GetVisibleElementColor( PAD_BK_VISIBLE ) ); + color = ColorMix( color, brd->GetVisibleElementColor( PAD_BK_VISIBLE ) ); } - if( color == 0 ) // Not on a visible copper layer XXX EVIL check + if( color == BLACK ) // Not on a visible copper layer (i.e. still nothing to show) { - // If the pad in on only one tech layer, use the layer color else use DARKGRAY + // If the pad is on only one tech layer, use the layer color else use DARKGRAY int mask_non_copper_layers = m_layerMask & ~ALL_CU_LAYERS; #ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR mask_non_copper_layers &= brd->GetVisibleLayers(); @@ -328,8 +327,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode, if( aDraw_mode & GR_HIGHLIGHT ) ColorChangeHighlightFlag( &color, !(aDraw_mode & GR_AND) ); - if( color & HIGHLIGHT_FLAG ) - color = ColorRefs[color & MASKCOLOR].m_LightColor; + ColorApplyHighlightFlag( &color ); bool DisplayIsol = DisplayOpt.DisplayPadIsol; @@ -362,7 +360,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode, drawInfo.m_Display_netname = false; // Display net names is restricted to pads that are on the active layer - // in hight contrast mode display + // in high contrast mode display if( ( aDraw_mode & GR_ALLOW_HIGHCONTRAST ) && !IsOnLayer( screen->m_Active_Layer ) && DisplayOpt.ContrastModeDisplay ) drawInfo.m_Display_netname = false; diff --git a/pcbnew/class_pcb_text.cpp b/pcbnew/class_pcb_text.cpp index a92b898a7c..d535f4a414 100644 --- a/pcbnew/class_pcb_text.cpp +++ b/pcbnew/class_pcb_text.cpp @@ -180,7 +180,7 @@ wxString TEXTE_PCB::GetSelectMenuText() const if( m_Text.Len() < 12 ) shorttxt << m_Text; else - shorttxt += m_Text.Left( 10 ) + wxT( ".." ); + shorttxt += m_Text.Left( 10 ) + wxT( "..." ); text.Printf( _( "Pcb Text %s on %s"), GetChars ( shorttxt ), GetChars( GetLayerName() ) ); diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index 0f8aa12aaa..d8f0cabb72 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -614,8 +614,7 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, if( draw_mode & GR_HIGHLIGHT ) ColorChangeHighlightFlag( &color, !(draw_mode & GR_AND) ); - if( color & HIGHLIGHT_FLAG ) - color = ColorRefs[color & MASKCOLOR].m_LightColor; + ColorApplyHighlightFlag( &color ); SetAlpha( &color, 150 ); @@ -780,8 +779,7 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, if( draw_mode & GR_HIGHLIGHT ) ColorChangeHighlightFlag( &color, !(draw_mode & GR_AND) ); - if( color & HIGHLIGHT_FLAG ) - color = ColorRefs[color & MASKCOLOR].m_LightColor; + ColorApplyHighlightFlag( &color ); SetAlpha( &color, 150 ); diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index 6b161ad189..7a0fc5816a 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -189,8 +189,7 @@ void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE aDrawMod if( aDrawMode & GR_HIGHLIGHT ) ColorChangeHighlightFlag( &color, !(aDrawMode & GR_AND) ); - if( color & HIGHLIGHT_FLAG ) - color = ColorRefs[color & MASKCOLOR].m_LightColor; + ColorApplyHighlightFlag( &color ); SetAlpha( &color, 150 ); @@ -272,8 +271,7 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel, if( aDrawMode & GR_HIGHLIGHT ) ColorChangeHighlightFlag( &color, !(aDrawMode & GR_AND) ); - if( color & HIGHLIGHT_FLAG ) - color = ColorRefs[color & MASKCOLOR].m_LightColor; + ColorApplyHighlightFlag( &color ); SetAlpha( &color, 150 ); diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp index cdf268ed5a..805bbe34af 100644 --- a/pcbnew/dialogs/dialog_plot.cpp +++ b/pcbnew/dialogs/dialog_plot.cpp @@ -163,7 +163,7 @@ void DIALOG_PLOT::Init_Dialog() m_layerList.push_back( layer ); checkIndex = m_layerCheckListBox->Append( m_board->GetLayerName( layer ) ); - if( m_plotOpts.GetLayerSelection() & ( 1 << layer ) ) + if( m_plotOpts.GetLayerSelection() & GetLayerMask( layer ) ) m_layerCheckListBox->Check( checkIndex ); } @@ -241,7 +241,7 @@ void DIALOG_PLOT::OnPopUpLayers( wxCommandEvent& event ) case ID_LAYER_FAB: // Select layers usually neede d to build a board for( i = 0; i < m_layerList.size(); i++ ) { - long layermask = 1 << m_layerList[ i ]; + LAYER_MSK layermask = GetLayerMask( m_layerList[ i ] ); if( ( layermask & ( ALL_CU_LAYERS | SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT | SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT | @@ -675,7 +675,7 @@ void DIALOG_PLOT::applyPlotSettings() for( i = 0; i < m_layerList.size(); i++ ) { if( m_layerCheckListBox->IsChecked( i ) ) - selectedLayers |= (1 << m_layerList[i]); + selectedLayers |= GetLayerMask( m_layerList[i] ); } tempOptions.SetLayerSelection( selectedLayers ); diff --git a/pcbnew/dialogs/dialog_plot.h b/pcbnew/dialogs/dialog_plot.h index d9edce8ca4..14bb893fcc 100644 --- a/pcbnew/dialogs/dialog_plot.h +++ b/pcbnew/dialogs/dialog_plot.h @@ -43,7 +43,7 @@ private: BOARD* m_board; BOARD_DESIGN_SETTINGS m_brdSettings; wxConfig* m_config; - std::vector m_layerList; // List to hold CheckListBox layer numbers + std::vector m_layerList; // List to hold CheckListBox layer numbers double m_XScaleAdjust; // X scale factor adjust to compensate // plotter X scaling error double m_YScaleAdjust; // X scale factor adjust to compensate diff --git a/pcbnew/dialogs/dialog_print_using_printer.cpp b/pcbnew/dialogs/dialog_print_using_printer.cpp index 21afdf456c..990a6c706c 100644 --- a/pcbnew/dialogs/dialog_print_using_printer.cpp +++ b/pcbnew/dialogs/dialog_print_using_printer.cpp @@ -28,7 +28,7 @@ extern int g_DrawDefaultLineThickness; // Local variables -static long s_SelectedLayers; +static LAYER_MSK s_SelectedLayers; static double s_ScaleList[] = { 0, 0.5, 0.7, 0.999, 1.0, 1.4, 2.0, 3.0, 4.0 }; @@ -144,7 +144,6 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( PCB_EDIT_FRAME* parent ) void DIALOG_PRINT_USING_PRINTER::InitValues( ) { - LAYER_NUM layer_max = NB_PCB_LAYERS; wxString msg; BOARD* board = m_parent->GetBoard(); @@ -189,7 +188,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) m_BoxSelectLayer[layer]->SetValue( option ); else { - long mask = 1 << layer; + LAYER_MSK mask = GetLayerMask( layer ); if( mask & s_SelectedLayers ) m_BoxSelectLayer[layer]->SetValue( true ); } @@ -220,8 +219,8 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) s_Parameters.m_YScaleAdjust > MAX_SCALE ) s_Parameters.m_XScaleAdjust = s_Parameters.m_YScaleAdjust = 1.0; - s_SelectedLayers = 0; - for( int layer = 0; layerSetValue( option ); if( option ) - s_SelectedLayers |= 1 << layer; + s_SelectedLayers |= GetLayerMask( layer ); } } } diff --git a/pcbnew/export_vrml.cpp b/pcbnew/export_vrml.cpp index 99e4e006d5..27948adb86 100644 --- a/pcbnew/export_vrml.cpp +++ b/pcbnew/export_vrml.cpp @@ -273,19 +273,19 @@ static void write_triangle_bag( FILE* output_file, int color_index, //{{{ case 1: // Material marker fprintf( output_file, " diffuseColor %g %g %g\n", - (double) ColorRefs[color_index].m_Red / 255.0, - (double) ColorRefs[color_index].m_Green / 255.0, - (double) ColorRefs[color_index].m_Blue / 255.0 ); + (double) g_ColorRefs[color_index].m_Red / 255.0, + (double) g_ColorRefs[color_index].m_Green / 255.0, + (double) g_ColorRefs[color_index].m_Blue / 255.0 ); fprintf( output_file, " specularColor %g %g %g\n", - (double) ColorRefs[color_index].m_Red / 255.0, - (double) ColorRefs[color_index].m_Green / 255.0, - (double) ColorRefs[color_index].m_Blue / 255.0 ); + (double) g_ColorRefs[color_index].m_Red / 255.0, + (double) g_ColorRefs[color_index].m_Green / 255.0, + (double) g_ColorRefs[color_index].m_Blue / 255.0 ); fprintf( output_file, " emissiveColor %g %g %g\n", - (double) ColorRefs[color_index].m_Red / 255.0, - (double) ColorRefs[color_index].m_Green / 255.0, - (double) ColorRefs[color_index].m_Blue / 255.0 ); + (double) g_ColorRefs[color_index].m_Red / 255.0, + (double) g_ColorRefs[color_index].m_Green / 255.0, + (double) g_ColorRefs[color_index].m_Blue / 255.0 ); break; case 2: diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index d9c5ee4c49..e1950d7c57 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -424,12 +424,10 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const // Layers. m_out->Print( aNestLevel, "(layers\n" ); - unsigned mask = LAYER_FRONT; - LAYER_NUM layer = LAYER_N_FRONT; - // Save only the used copper layers from front to back. - while( mask != 0 ) + for( LAYER_NUM layer = LAST_COPPER_LAYER; layer >= FIRST_COPPER_LAYER; --layer) { + LAYER_MSK mask = GetLayerMask( layer ); if( mask & aBoard->GetEnabledLayers() ) { m_out->Print( aNestLevel+1, "(%d %s %s", layer, @@ -441,17 +439,12 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const m_out->Print( 0, ")\n" ); } - - mask >>= 1; - --layer; } - mask = ADHESIVE_LAYER_BACK; - layer = ADHESIVE_N_BACK; - // Save used non-copper layers in the order they are defined. - while( layer < NB_LAYERS ) + for( LAYER_NUM layer = FIRST_NON_COPPER_LAYER; layer <= LAST_NON_COPPER_LAYER; ++layer) { + LAYER_MSK mask = GetLayerMask( layer ); if( mask & aBoard->GetEnabledLayers() ) { m_out->Print( aNestLevel+1, "(%d %s user", layer, @@ -462,9 +455,6 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const m_out->Print( 0, ")\n" ); } - - mask <<= 1; - ++layer; } m_out->Print( aNestLevel, ")\n\n" ); @@ -1029,16 +1019,14 @@ void PCB_IO::formatLayers( LAYER_MSK aLayerMask, int aNestLevel ) const // output any individual layers not handled in wildcard combos above - unsigned layerMask = aLayerMask; - if( m_board ) - layerMask &= m_board->GetEnabledLayers(); + aLayerMask &= m_board->GetEnabledLayers(); wxString layerName; - for( LAYER_NUM layer = FIRST_LAYER; layerMask; ++layer, layerMask >>= 1 ) + for( LAYER_NUM layer = FIRST_LAYER; layer < NB_PCB_LAYERS; ++layer ) { - if( layerMask & 1 ) + if( aLayerMask & GetLayerMask( layer ) ) { if( m_board && !(m_ctl & CTL_STD_LAYER_NAMES) ) layerName = m_board->GetLayerName( layer ); diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index 29669bec82..edbf0bc346 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -434,18 +434,9 @@ void LEGACY_PLUGIN::loadGENERAL() else if( TESTLINE( "Ly" ) ) // Old format for Layer count { - int layer_mask = hexParse( line + SZ( "Ly" ) ); - int layer_count = 0; + LAYER_MSK layer_mask = hexParse( line + SZ( "Ly" ) ); - for( LAYER_NUM ii = FIRST_COPPER_LAYER; - ii < NB_COPPER_LAYERS && layer_mask; - ++ii, layer_mask >>= 1 ) - { - if( layer_mask & 1 ) - layer_count++; - } - - m_board->SetCopperLayerCount( layer_count ); + m_board->SetCopperLayerCount( LayerMaskCountSet( layer_mask & ALL_CU_LAYERS ) ); } else if( TESTLINE( "BoardThickness" ) ) @@ -1550,6 +1541,7 @@ void LEGACY_PLUGIN::loadMODULE_TEXT( TEXTE_MODULE* aText ) // after switching to strtok, there's no easy coming back because of the // embedded nul(s?) placed to the right of the current field. + // (that's the reason why strtok was deprecated...) char* mirror = strtok( (char*) data, delims ); char* hide = strtok( NULL, delims ); char* tmp = strtok( NULL, delims ); @@ -2984,9 +2976,9 @@ void LEGACY_PLUGIN::saveSETUP( const BOARD* aBoard ) const unsigned layerMask = ALL_CU_LAYERS & aBoard->GetEnabledLayers(); - for( LAYER_NUM layer = FIRST_LAYER; layerMask; ++layer, layerMask >>= 1 ) + for( LAYER_NUM layer = FIRST_LAYER; layer <= LAST_COPPER_LAYER; ++layer ) { - if( layerMask & 1 ) + if( layerMask & GetLayerMask( layer ) ) { fprintf( m_fp, "Layer[%d] %s %s\n", layer, TO_UTF8( aBoard->GetLayerName( layer ) ), diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index 358c0e89fa..b1289ecfda 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -351,95 +351,95 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings() &DisplayOpt.DisplayZonesMode, 0, 0, 2 ) ); // Colors: - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLay0" ), LOC_COLOR( 0 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer0Ex" ), LOC_COLOR( 0 ), GREEN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLay1" ), LOC_COLOR( 1 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer1Ex" ), LOC_COLOR( 1 ), BLUE ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLay2" ), LOC_COLOR( 2 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer2Ex" ), LOC_COLOR( 2 ), LIGHTGRAY ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLay3" ), LOC_COLOR( 3 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer3Ex" ), LOC_COLOR( 3 ), MAGENTA ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLay4" ), LOC_COLOR( 4 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer4Ex" ), LOC_COLOR( 4 ), RED ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLay5" ), LOC_COLOR( 5 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer5Ex" ), LOC_COLOR( 5 ), MAGENTA ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLay6" ), LOC_COLOR( 6 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer6Ex" ), LOC_COLOR( 6 ), BROWN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLay7" ), LOC_COLOR( 7 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer7Ex" ), LOC_COLOR( 7 ), MAGENTA ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLay8" ), LOC_COLOR( 8 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer8Ex" ), LOC_COLOR( 8 ), LIGHTGRAY ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLay9" ), LOC_COLOR( 9 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer9Ex" ), LOC_COLOR( 9 ), BLUE ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLayA" ), LOC_COLOR( 10 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer10Ex" ), LOC_COLOR( 10 ), GREEN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLayB" ), LOC_COLOR( 11 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer11Ex" ), LOC_COLOR( 11 ), CYAN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLayC" ), LOC_COLOR( 12 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer12Ex" ), LOC_COLOR( 12 ), LIGHTRED ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLayD" ), LOC_COLOR( 13 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer13Ex" ), LOC_COLOR( 13 ), LIGHTMAGENTA ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLayE" ), LOC_COLOR( 14 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer14Ex" ), LOC_COLOR( 14 ), YELLOW ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLayF" ), LOC_COLOR( 15 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer15Ex" ), LOC_COLOR( 15 ), RED ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLayG" ), LOC_COLOR( 16 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer16Ex" ), LOC_COLOR( 16 ), BLUE ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLayH" ), LOC_COLOR( 17 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer17Ex" ), LOC_COLOR( 17 ), MAGENTA ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLayI" ), LOC_COLOR( 18 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer18Ex" ), LOC_COLOR( 18 ), LIGHTCYAN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLayJ" ), LOC_COLOR( 19 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer19Ex" ), LOC_COLOR( 19 ), RED ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLayK" ), LOC_COLOR( 20 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer20Ex" ), LOC_COLOR( 20 ), MAGENTA ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLayL" ), LOC_COLOR( 21 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer21Ex" ), LOC_COLOR( 21 ), CYAN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLayM" ), LOC_COLOR( 22 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer22Ex" ), LOC_COLOR( 22 ), BROWN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLayN" ), LOC_COLOR( 23 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer23Ex" ), LOC_COLOR( 23 ), MAGENTA ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLayO" ), LOC_COLOR( 24 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer24Ex" ), LOC_COLOR( 24 ), LIGHTGRAY ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLayP" ), LOC_COLOR( 25 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer25Ex" ), LOC_COLOR( 25 ), BLUE ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLayQ" ), LOC_COLOR( 26 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer26Ex" ), LOC_COLOR( 26 ), GREEN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLayR" ), LOC_COLOR( 27 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer27Ex" ), LOC_COLOR( 27 ), YELLOW ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLayS" ), LOC_COLOR( 28 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer28Ex" ), LOC_COLOR( 28 ), YELLOW ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLayT" ), LOC_COLOR( 29 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer29Ex" ), LOC_COLOR( 29 ), LIGHTMAGENTA ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLayU" ), LOC_COLOR( 30 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer30Ex" ), LOC_COLOR( 30 ), YELLOW ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColLayV" ), LOC_COLOR( 31 ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorLayer31Ex" ), LOC_COLOR( 31 ), LIGHTGRAY ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "CTxtMoC" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorTxtFrontEx" ), ITEM_COLOR( MOD_TEXT_FR_VISIBLE ), LIGHTGRAY ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "CTxtMoS" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorTxtBackEx" ), ITEM_COLOR( MOD_TEXT_BK_VISIBLE ), BLUE ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "CTxtVis" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorTxtInvisEx" ), ITEM_COLOR( MOD_TEXT_INVISIBLE ), DARKGRAY ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "CAncreM" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorAnchorEx" ), ITEM_COLOR( ANCHOR_VISIBLE ), BLUE ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "CoPadCu" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPadBackEx" ), ITEM_COLOR( PAD_BK_VISIBLE ), GREEN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "CoPadCm" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPadFrontEx" ), ITEM_COLOR( PAD_FR_VISIBLE ), RED ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "CoViaTh" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorViaThruEx" ), ITEM_COLOR( VIA_THROUGH_VISIBLE ), LIGHTGRAY ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "CoViaBu" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorViaBBlindEx" ), ITEM_COLOR( VIA_BBLIND_VISIBLE ), BROWN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "CoViaMi" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorViaMicroEx" ), ITEM_COLOR( VIA_MICROVIA_VISIBLE ), CYAN ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "CoRatsN" ), + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorRatsEx" ), ITEM_COLOR( RATSNEST_VISIBLE ), WHITE ) ); diff --git a/pcbnew/printout_controler.cpp b/pcbnew/printout_controler.cpp index 44eea74cc9..514d578f5e 100644 --- a/pcbnew/printout_controler.cpp +++ b/pcbnew/printout_controler.cpp @@ -90,9 +90,9 @@ BOARD_PRINTOUT_CONTROLLER::BOARD_PRINTOUT_CONTROLLER( const PRINT_PARAMETERS& aP bool BOARD_PRINTOUT_CONTROLLER::OnPrintPage( int aPage ) { #ifdef PCBNEW - int layers_count = NB_PCB_LAYERS; + LAYER_NUM layers_count = NB_PCB_LAYERS; #else - int layers_count = NB_LAYERS; + LAYER_NUM layers_count = NB_LAYERS; #endif LAYER_MSK mask_layer = m_PrintParams.m_PrintMaskLayer; @@ -100,10 +100,12 @@ bool BOARD_PRINTOUT_CONTROLLER::OnPrintPage( int aPage ) // compute layer mask from page number if we want one page per layer if( m_PrintParams.m_OptionPrintPage == 0 ) // One page per layer { - int ii, jj, mask = 1; + int jj; + LAYER_NUM ii; - for( ii = 0, jj = 0; ii < layers_count; ii++ ) + for( ii = FIRST_LAYER, jj = 0; ii < layers_count; ++ii ) { + LAYER_MSK mask = GetLayerMask( ii ); if( mask_layer & mask ) jj++; @@ -112,8 +114,6 @@ bool BOARD_PRINTOUT_CONTROLLER::OnPrintPage( int aPage ) m_PrintParams.m_PrintMaskLayer = mask; break; } - - mask <<= 1; } } From 752e4a4a58fd20266d362d63235b0e32724cf303 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 5 Apr 2013 09:38:00 +0200 Subject: [PATCH 42/63] All: change some texts and messages hard to translate, or not translatable (and some incorrect messages). Pcbnew, layer manager: add option (popup menu) to always keep copper layers not visible but the active layer, even when the active layer is changed. Usefull for multilayer ( more than 4 layers) PCBs. --- 3d-viewer/3d_toolbar.cpp | 8 +- common/basicframe.cpp | 8 +- .../dialogs/dialog_plot_schematic_base.cpp | 4 +- .../dialogs/dialog_plot_schematic_base.fbp | 6 +- eeschema/dialogs/dialog_plot_schematic_base.h | 2 +- include/convert_to_biu.h | 4 +- pcbnew/class_pcb_layer_widget.cpp | 74 +- pcbnew/class_pcb_layer_widget.h | 13 +- pcbnew/dialogs/dialog_fp_lib_table_base.cpp | 474 +-- pcbnew/dialogs/dialog_fp_lib_table_base.fbp | 2902 ++++++++--------- pcbnew/dialogs/dialog_fp_lib_table_base.h | 178 +- pcbnew/dialogs/dialog_gendrill.cpp | 2 +- pcbnew/files.cpp | 5 +- pcbnew/gpcb_plugin.cpp | 2 +- pcbnew/kicad_plugin.cpp | 2 +- pcbnew/menubar_modedit.cpp | 4 +- pcbnew/pcbframe.cpp | 1 + 17 files changed, 1849 insertions(+), 1840 deletions(-) diff --git a/3d-viewer/3d_toolbar.cpp b/3d-viewer/3d_toolbar.cpp index 2ab028f7aa..7d3db91a0c 100644 --- a/3d-viewer/3d_toolbar.cpp +++ b/3d-viewer/3d_toolbar.cpp @@ -105,16 +105,16 @@ void EDA_3D_FRAME::ReCreateHToolbar() m_HToolBar->AddSeparator(); m_HToolBar->AddTool( ID_MOVE3D_LEFT, wxEmptyString, KiBitmap( left_xpm ), - _( "Move left <-" ) ); + _( "Move left" ) ); m_HToolBar->AddTool( ID_MOVE3D_RIGHT, wxEmptyString, KiBitmap( right_xpm ), - _( "Move right ->" ) ); + _( "Move right" ) ); m_HToolBar->AddTool( ID_MOVE3D_UP, wxEmptyString, KiBitmap( up_xpm ), - _( "Move up ^" ) ); + _( "Move up" ) ); m_HToolBar->AddTool( ID_MOVE3D_DOWN, wxEmptyString, KiBitmap( down_xpm ), - _( "Move down v" ) ); + _( "Move down" ) ); m_HToolBar->AddSeparator(); m_HToolBar->AddTool( ID_ORTHO, wxEmptyString, KiBitmap( ortho_xpm ), diff --git a/common/basicframe.cpp b/common/basicframe.cpp index 8611ae2a3b..378183e7ee 100644 --- a/common/basicframe.cpp +++ b/common/basicframe.cpp @@ -1,9 +1,9 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 2011 Wayne Stambaugh - * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 20131 Wayne Stambaugh + * Copyright (C) 1992-2013 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 @@ -289,7 +289,7 @@ wxString EDA_BASE_FRAME::GetFileFromHistory( int cmdId, const wxString& type, if( !wxFileName::FileExists( fn ) ) { - msg = type + _( " file <" ) + fn + _( "> was not found." ); + msg.Printf( wxT( "file <%s> was not found." ), GetChars( fn ) ); wxMessageBox( msg ); fileHistory->RemoveFileFromHistory( i ); fn = wxEmptyString; diff --git a/eeschema/dialogs/dialog_plot_schematic_base.cpp b/eeschema/dialogs/dialog_plot_schematic_base.cpp index 62722720cb..4c45a9b934 100644 --- a/eeschema/dialogs/dialog_plot_schematic_base.cpp +++ b/eeschema/dialogs/dialog_plot_schematic_base.cpp @@ -44,7 +44,7 @@ DIALOG_PLOT_SCHEMATIC_BASE::DIALOG_PLOT_SCHEMATIC_BASE( wxWindow* parent, wxWind m_plotOriginOpt->SetSelection( 0 ); m_paperHPGLSizer->Add( m_plotOriginOpt, 0, wxALL, 5 ); - m_penHPLGWidthTitle = new wxStaticText( this, wxID_ANY, _("Pen Width:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_penHPLGWidthTitle = new wxStaticText( this, wxID_ANY, _("Pen width"), wxDefaultPosition, wxDefaultSize, 0 ); m_penHPLGWidthTitle->Wrap( -1 ); m_paperHPGLSizer->Add( m_penHPLGWidthTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); @@ -67,7 +67,7 @@ DIALOG_PLOT_SCHEMATIC_BASE::DIALOG_PLOT_SCHEMATIC_BASE( wxWindow* parent, wxWind wxStaticBoxSizer* sbSizerPlotFormat; sbSizerPlotFormat = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("General Options") ), wxVERTICAL ); - m_defaultLineWidthTitle = new wxStaticText( this, wxID_ANY, _("Default Line Thickness:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_defaultLineWidthTitle = new wxStaticText( this, wxID_ANY, _("Default line thickness"), wxDefaultPosition, wxDefaultSize, 0 ); m_defaultLineWidthTitle->Wrap( -1 ); sbSizerPlotFormat->Add( m_defaultLineWidthTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); diff --git a/eeschema/dialogs/dialog_plot_schematic_base.fbp b/eeschema/dialogs/dialog_plot_schematic_base.fbp index a27e12f982..80bafdfdfd 100644 --- a/eeschema/dialogs/dialog_plot_schematic_base.fbp +++ b/eeschema/dialogs/dialog_plot_schematic_base.fbp @@ -45,7 +45,7 @@ -1,-1 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h - Plot + Plot Schematic @@ -507,7 +507,7 @@ 0 0 wxID_ANY - Pen Width: + Pen width 0 @@ -787,7 +787,7 @@ 0 0 wxID_ANY - Default Line Thickness: + Default line thickness 0 diff --git a/eeschema/dialogs/dialog_plot_schematic_base.h b/eeschema/dialogs/dialog_plot_schematic_base.h index 06eee76a19..0f2cc0e7d1 100644 --- a/eeschema/dialogs/dialog_plot_schematic_base.h +++ b/eeschema/dialogs/dialog_plot_schematic_base.h @@ -77,7 +77,7 @@ class DIALOG_PLOT_SCHEMATIC_BASE : public DIALOG_SHIM public: - DIALOG_PLOT_SCHEMATIC_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_SCHEMATIC_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plot Schematic"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_PLOT_SCHEMATIC_BASE(); }; diff --git a/include/convert_to_biu.h b/include/convert_to_biu.h index 7e66002fed..2b67f4b239 100644 --- a/include/convert_to_biu.h +++ b/include/convert_to_biu.h @@ -20,9 +20,9 @@ #if defined(PCBNEW) || defined(CVPCB) || defined(GERBVIEW) #if defined( USE_PCBNEW_NANOMETRES ) #if defined(GERBVIEW) - #define IU_PER_MM 1e5 // Gerbview uses 10 micrometer. + #define IU_PER_MM 1e5 // Gerbview IU is 10 nanometers. #else - #define IU_PER_MM 1e6 // Pcbnew uses nanometers. + #define IU_PER_MM 1e6 // Pcbnew IU is 1 nanometer. #endif #define IU_PER_MILS (IU_PER_MM * 0.0254) #define IU_PER_DECIMILS (IU_PER_MM * 0.00254) diff --git a/pcbnew/class_pcb_layer_widget.cpp b/pcbnew/class_pcb_layer_widget.cpp index 0dea4b0e36..87e6364358 100644 --- a/pcbnew/class_pcb_layer_widget.cpp +++ b/pcbnew/class_pcb_layer_widget.cpp @@ -78,6 +78,7 @@ PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_EDIT_FRAME* aParent, wxWindow* aFocusOwn LAYER_WIDGET( aParent, aFocusOwner, aPointSize ), myframe( aParent ) { + m_alwaysShowActiveCopperLayer = false; ReFillRender(); // Update default tabs labels for GerbView @@ -90,7 +91,7 @@ PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_EDIT_FRAME* aParent, wxWindow* aFocusOwn // since Popupmenu() calls this->ProcessEvent() we must call this->Connect() // and not m_LayerScrolledWindow->Connect() - Connect( ID_SHOW_ALL_COPPERS, ID_SHOW_NO_COPPERS_BUT_ACTIVE, wxEVT_COMMAND_MENU_SELECTED, + Connect( ID_SHOW_ALL_COPPERS, ID_ALWAYS_SHOW_NO_COPPERS_BUT_ACTIVE, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( PCB_LAYER_WIDGET::onPopupSelection ), NULL, this ); // install the right click handler into each control at end of ReFill() @@ -120,9 +121,14 @@ void PCB_LAYER_WIDGET::onRightDownLayers( wxMouseEvent& event ) // menu text is capitalized: // http://library.gnome.org/devel/hig-book/2.20/design-text-labels.html.en#layout-capitalization - menu.Append( new wxMenuItem( &menu, ID_SHOW_ALL_COPPERS, _( "Show All Copper Layers" ) ) ); - menu.Append( new wxMenuItem( &menu, ID_SHOW_NO_COPPERS_BUT_ACTIVE, _( "Hide All Copper Layers But Active" ) ) ); - menu.Append( new wxMenuItem( &menu, ID_SHOW_NO_COPPERS, _( "Hide All Copper Layers" ) ) ); + menu.Append( new wxMenuItem( &menu, ID_SHOW_ALL_COPPERS, + _( "Show All Copper Layers" ) ) ); + menu.Append( new wxMenuItem( &menu, ID_SHOW_NO_COPPERS_BUT_ACTIVE, + _( "Hide All Copper Layers But Active" ) ) ); + menu.Append( new wxMenuItem( &menu, ID_ALWAYS_SHOW_NO_COPPERS_BUT_ACTIVE, + _( "Always Hide All Copper Layers But Active" ) ) ); + menu.Append( new wxMenuItem( &menu, ID_SHOW_NO_COPPERS, + _( "Hide All Copper Layers" ) ) ); PopupMenu( &menu ); @@ -135,20 +141,22 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) int rowCount; int menuId = event.GetId(); bool visible; + bool force_active_layer_visible; switch( menuId ) { case ID_SHOW_ALL_COPPERS: - visible = true; - goto L_change_coppers; - + case ID_ALWAYS_SHOW_NO_COPPERS_BUT_ACTIVE: case ID_SHOW_NO_COPPERS_BUT_ACTIVE: case ID_SHOW_NO_COPPERS: - visible = false; - L_change_coppers: + visible = menuId == ID_SHOW_ALL_COPPERS; + m_alwaysShowActiveCopperLayer = ( menuId == ID_ALWAYS_SHOW_NO_COPPERS_BUT_ACTIVE ); + force_active_layer_visible = ( menuId == ID_SHOW_NO_COPPERS_BUT_ACTIVE || + menuId == ID_ALWAYS_SHOW_NO_COPPERS_BUT_ACTIVE ); + // Search the last copper layer row index: int lastCu = -1; rowCount = GetLayerRowCount(); - for( int row=rowCount-1; row>=0; --row ) + for( int row = rowCount-1; row>=0; --row ) { wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 ); LAYER_NUM layer = getDecodedId( cb->GetId() ); @@ -159,6 +167,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) } } + // Enbale/disable the copper layers visibility: for( int row=0; rowgetActiveLayer() ) ) + if( force_active_layer_visible && (layer == myframe->getActiveLayer() ) ) loc_visible = true; cb->SetValue( loc_visible ); bool isLastCopperLayer = (row==lastCu); - OnLayerVisible( layer, loc_visible, isLastCopperLayer ); if( isLastCopperLayer ) @@ -338,12 +345,27 @@ bool PCB_LAYER_WIDGET::OnLayerSelect( LAYER_NUM aLayer ) // false from this function. myframe->setActiveLayer( aLayer, false ); - if(DisplayOpt.ContrastModeDisplay) + if( m_alwaysShowActiveCopperLayer ) + OnLayerSelected(); + else if(DisplayOpt.ContrastModeDisplay) myframe->GetCanvas()->Refresh(); return true; } +void PCB_LAYER_WIDGET::OnLayerSelected() +{ + if( !m_alwaysShowActiveCopperLayer ) + return; + + // postprocess after an active layer selection + // ensure active layer visible + wxCommandEvent event; + event.SetId( ID_ALWAYS_SHOW_NO_COPPERS_BUT_ACTIVE ); + onPopupSelection( event ); +} + + void PCB_LAYER_WIDGET::OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal ) { @@ -371,29 +393,7 @@ void PCB_LAYER_WIDGET::OnRenderColorChange( int aId, EDA_COLOR_T aColor ) void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled ) { BOARD* brd = myframe->GetBoard(); - - /* @todo: - - move: - - GRID_VISIBLE, ? maybe not this one - into m_VisibleElements and get rid of globals. - */ - - switch( aId ) - { - // see todo above, don't really want anything except IsElementVisible() here. - - case GRID_VISIBLE: - // @todo, make read/write accessors for grid control so the write accessor can fire updates to - // grid state listeners. I think the grid state should be kept in the BOARD. - brd->SetElementVisibility( aId, isEnabled ); // set visibilty flag also in list, and myframe->m_Draw_Grid - break; - - default: - brd->SetElementVisibility( aId, isEnabled ); - } - + brd->SetElementVisibility( aId, isEnabled ); myframe->GetCanvas()->Refresh(); } diff --git a/pcbnew/class_pcb_layer_widget.h b/pcbnew/class_pcb_layer_widget.h index dd8d8ade01..a312315832 100644 --- a/pcbnew/class_pcb_layer_widget.h +++ b/pcbnew/class_pcb_layer_widget.h @@ -89,17 +89,24 @@ public: void OnRenderEnable( int aId, bool isEnabled ); //--------------- + void OnLayerSelected(); // postprocess after an active layer selection + // ensure active layer visible if + // m_alwaysShowActiveCopperLayer is true; + protected: static const LAYER_WIDGET::ROW s_render_rows[]; + bool m_alwaysShowActiveCopperLayer; // If true: Only shows the current active layer + // even if it is changed PCB_EDIT_FRAME* myframe; // popup menu ids. -#define ID_SHOW_ALL_COPPERS wxID_HIGHEST -#define ID_SHOW_NO_COPPERS (wxID_HIGHEST+1) -#define ID_SHOW_NO_COPPERS_BUT_ACTIVE (wxID_HIGHEST+2) +#define ID_SHOW_ALL_COPPERS wxID_HIGHEST +#define ID_SHOW_NO_COPPERS (wxID_HIGHEST+1) +#define ID_SHOW_NO_COPPERS_BUT_ACTIVE (wxID_HIGHEST+2) +#define ID_ALWAYS_SHOW_NO_COPPERS_BUT_ACTIVE (wxID_HIGHEST+3) /** * Function OnRightDownLayers diff --git a/pcbnew/dialogs/dialog_fp_lib_table_base.cpp b/pcbnew/dialogs/dialog_fp_lib_table_base.cpp index 1f9c45145d..5f21d99b6a 100644 --- a/pcbnew/dialogs/dialog_fp_lib_table_base.cpp +++ b/pcbnew/dialogs/dialog_fp_lib_table_base.cpp @@ -1,237 +1,237 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 8 2012) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#include "dialog_fp_lib_table_base.h" - -/////////////////////////////////////////////////////////////////////////// - -DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_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 ); - - wxBoxSizer* bSizer1; - bSizer1 = new wxBoxSizer( wxVERTICAL ); - - m_splitter = new wxSplitterWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH ); - m_splitter->Connect( wxEVT_IDLE, wxIdleEventHandler( DIALOG_FP_LIB_TABLE_BASE::m_splitterOnIdle ), NULL, this ); - m_splitter->SetMinimumPaneSize( 10 ); - - m_top = new wxPanel( m_splitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxStaticBoxSizer* m_top_sizer; - m_top_sizer = new wxStaticBoxSizer( new wxStaticBox( m_top, wxID_ANY, _("Library Tables by Scope") ), wxVERTICAL ); - - m_auinotebook = new wxAuiNotebook( m_top, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_BOTTOM ); - m_global_panel = new wxPanel( m_auinotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - m_global_panel->SetToolTip( _("Module libraries which are visible for all projects") ); - - wxBoxSizer* m_global_sizer; - m_global_sizer = new wxBoxSizer( wxVERTICAL ); - - m_global_grid = new wxGrid( m_global_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); - - // Grid - m_global_grid->CreateGrid( 1, 5 ); - m_global_grid->EnableEditing( true ); - m_global_grid->EnableGridLines( true ); - m_global_grid->EnableDragGridSize( true ); - m_global_grid->SetMargins( 0, 0 ); - - // Columns - m_global_grid->AutoSizeColumns(); - m_global_grid->EnableDragColMove( false ); - m_global_grid->EnableDragColSize( true ); - m_global_grid->SetColLabelSize( 30 ); - m_global_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); - - // Rows - m_global_grid->EnableDragRowSize( true ); - m_global_grid->SetRowLabelSize( 40 ); - m_global_grid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); - - // Label Appearance - - // Cell Defaults - m_global_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); - m_global_sizer->Add( m_global_grid, 1, wxALL|wxEXPAND, 5 ); - - - m_global_panel->SetSizer( m_global_sizer ); - m_global_panel->Layout(); - m_global_sizer->Fit( m_global_panel ); - m_auinotebook->AddPage( m_global_panel, _("Global Libraries"), true, wxNullBitmap ); - m_project_panel = new wxPanel( m_auinotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - m_project_panel->SetToolTip( _("Module libraries which are visible for curent project only") ); - - wxBoxSizer* m_project_sizer; - m_project_sizer = new wxBoxSizer( wxVERTICAL ); - - m_project_grid = new wxGrid( m_project_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); - - // Grid - m_project_grid->CreateGrid( 1, 5 ); - m_project_grid->EnableEditing( true ); - m_project_grid->EnableGridLines( true ); - m_project_grid->EnableDragGridSize( true ); - m_project_grid->SetMargins( 0, 0 ); - - // Columns - m_project_grid->AutoSizeColumns(); - m_project_grid->EnableDragColMove( false ); - m_project_grid->EnableDragColSize( true ); - m_project_grid->SetColLabelSize( 30 ); - m_project_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); - - // Rows - m_project_grid->EnableDragRowSize( true ); - m_project_grid->SetRowLabelSize( 40 ); - m_project_grid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); - - // Label Appearance - - // Cell Defaults - m_project_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); - m_project_sizer->Add( m_project_grid, 1, wxALL|wxEXPAND, 5 ); - - - m_project_panel->SetSizer( m_project_sizer ); - m_project_panel->Layout(); - m_project_sizer->Fit( m_project_panel ); - m_auinotebook->AddPage( m_project_panel, _("Project Specific Libraries"), false, wxNullBitmap ); - - m_top_sizer->Add( m_auinotebook, 1, wxEXPAND | wxALL, 5 ); - - wxBoxSizer* bSizer51; - bSizer51 = new wxBoxSizer( wxHORIZONTAL ); - - m_append_button = new wxButton( m_top, wxID_ANY, _("Append Row"), wxDefaultPosition, wxDefaultSize, 0 ); - m_append_button->SetToolTip( _("Add a pcb library row to this table") ); - - bSizer51->Add( m_append_button, 0, wxALL, 5 ); - - m_delete_button = new wxButton( m_top, wxID_ANY, _("Delete Row"), wxDefaultPosition, wxDefaultSize, 0 ); - m_delete_button->SetToolTip( _("Remove a PCB library from this library table") ); - - bSizer51->Add( m_delete_button, 0, wxALL, 5 ); - - m_move_up_button = new wxButton( m_top, wxID_ANY, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 ); - m_move_up_button->SetToolTip( _("Move the currently selected row up one position") ); - - bSizer51->Add( m_move_up_button, 0, wxALL, 5 ); - - m_move_down_button = new wxButton( m_top, wxID_ANY, _("Move Down"), wxDefaultPosition, wxDefaultSize, 0 ); - m_move_down_button->SetToolTip( _("Move the currently selected row down one position") ); - - bSizer51->Add( m_move_down_button, 0, wxALL, 5 ); - - - m_top_sizer->Add( bSizer51, 0, wxALIGN_CENTER|wxBOTTOM, 8 ); - - - m_top->SetSizer( m_top_sizer ); - m_top->Layout(); - m_top_sizer->Fit( m_top ); - m_bottom = new wxPanel( m_splitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); - wxBoxSizer* m_bottom_sizer; - m_bottom_sizer = new wxBoxSizer( wxVERTICAL ); - - wxStaticBoxSizer* sbSizer1; - sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( m_bottom, wxID_ANY, _("Path Substitutions") ), wxVERTICAL ); - - m_path_subs_grid = new wxGrid( m_bottom, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); - - // Grid - m_path_subs_grid->CreateGrid( 1, 2 ); - m_path_subs_grid->EnableEditing( true ); - m_path_subs_grid->EnableGridLines( true ); - m_path_subs_grid->EnableDragGridSize( false ); - m_path_subs_grid->SetMargins( 0, 0 ); - - // Columns - m_path_subs_grid->SetColSize( 0, 150 ); - m_path_subs_grid->SetColSize( 1, 500 ); - m_path_subs_grid->AutoSizeColumns(); - m_path_subs_grid->EnableDragColMove( false ); - m_path_subs_grid->EnableDragColSize( true ); - m_path_subs_grid->SetColLabelSize( 30 ); - m_path_subs_grid->SetColLabelValue( 0, _("Environment Variable") ); - m_path_subs_grid->SetColLabelValue( 1, _("Path Segment") ); - m_path_subs_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); - - // Rows - m_path_subs_grid->EnableDragRowSize( true ); - m_path_subs_grid->SetRowLabelSize( 40 ); - m_path_subs_grid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); - - // Label Appearance - - // Cell Defaults - m_path_subs_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); - sbSizer1->Add( m_path_subs_grid, 1, wxALL|wxEXPAND, 5 ); - - - m_bottom_sizer->Add( sbSizer1, 1, wxALL|wxEXPAND, 5 ); - - m_sdbSizer1 = new wxStdDialogButtonSizer(); - m_sdbSizer1OK = new wxButton( m_bottom, wxID_OK ); - m_sdbSizer1->AddButton( m_sdbSizer1OK ); - m_sdbSizer1Cancel = new wxButton( m_bottom, wxID_CANCEL ); - m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); - m_sdbSizer1->Realize(); - - m_bottom_sizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 5 ); - - - m_bottom->SetSizer( m_bottom_sizer ); - m_bottom->Layout(); - m_bottom_sizer->Fit( m_bottom ); - m_splitter->SplitHorizontally( m_top, m_bottom, 398 ); - bSizer1->Add( m_splitter, 2, wxEXPAND, 5 ); - - - this->SetSizer( bSizer1 ); - this->Layout(); - - this->Centre( wxBOTH ); - - // Connect Events - m_auinotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( DIALOG_FP_LIB_TABLE_BASE::pageChangedHandler ), NULL, this ); - m_global_grid->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCellLeftClick ), NULL, this ); - m_global_grid->Connect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCellLeftDClick ), NULL, this ); - m_global_grid->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCellRightClick ), NULL, this ); - m_global_grid->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCmdSelectCell ), NULL, this ); - m_project_grid->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCellLeftClick ), NULL, this ); - m_project_grid->Connect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCellLeftDClick ), NULL, this ); - m_project_grid->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCellRightClick ), NULL, this ); - m_project_grid->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCmdSelectCell ), NULL, this ); - m_append_button->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this ); - m_delete_button->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::deleteRowHandler ), NULL, this ); - m_move_up_button->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveUpHandler ), NULL, this ); - m_move_down_button->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveDownHandler ), NULL, this ); - m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onCancelButtonClick ), NULL, this ); - m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onOKButtonClick ), NULL, this ); -} - -DIALOG_FP_LIB_TABLE_BASE::~DIALOG_FP_LIB_TABLE_BASE() -{ - // Disconnect Events - m_auinotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( DIALOG_FP_LIB_TABLE_BASE::pageChangedHandler ), NULL, this ); - m_global_grid->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCellLeftClick ), NULL, this ); - m_global_grid->Disconnect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCellLeftDClick ), NULL, this ); - m_global_grid->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCellRightClick ), NULL, this ); - m_global_grid->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCmdSelectCell ), NULL, this ); - m_project_grid->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCellLeftClick ), NULL, this ); - m_project_grid->Disconnect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCellLeftDClick ), NULL, this ); - m_project_grid->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCellRightClick ), NULL, this ); - m_project_grid->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCmdSelectCell ), NULL, this ); - m_append_button->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this ); - m_delete_button->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::deleteRowHandler ), NULL, this ); - m_move_up_button->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveUpHandler ), NULL, this ); - m_move_down_button->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveDownHandler ), NULL, this ); - m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onCancelButtonClick ), NULL, this ); - m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onOKButtonClick ), NULL, this ); - -} +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Oct 8 2012) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_fp_lib_table_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_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 ); + + wxBoxSizer* bSizer1; + bSizer1 = new wxBoxSizer( wxVERTICAL ); + + m_splitter = new wxSplitterWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH ); + m_splitter->Connect( wxEVT_IDLE, wxIdleEventHandler( DIALOG_FP_LIB_TABLE_BASE::m_splitterOnIdle ), NULL, this ); + m_splitter->SetMinimumPaneSize( 10 ); + + m_top = new wxPanel( m_splitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxStaticBoxSizer* m_top_sizer; + m_top_sizer = new wxStaticBoxSizer( new wxStaticBox( m_top, wxID_ANY, _("Library Tables by Scope") ), wxVERTICAL ); + + m_auinotebook = new wxAuiNotebook( m_top, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_BOTTOM ); + m_global_panel = new wxPanel( m_auinotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_global_panel->SetToolTip( _("Module libraries which are visible for all projects") ); + + wxBoxSizer* m_global_sizer; + m_global_sizer = new wxBoxSizer( wxVERTICAL ); + + m_global_grid = new wxGrid( m_global_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + + // Grid + m_global_grid->CreateGrid( 1, 5 ); + m_global_grid->EnableEditing( true ); + m_global_grid->EnableGridLines( true ); + m_global_grid->EnableDragGridSize( true ); + m_global_grid->SetMargins( 0, 0 ); + + // Columns + m_global_grid->AutoSizeColumns(); + m_global_grid->EnableDragColMove( false ); + m_global_grid->EnableDragColSize( true ); + m_global_grid->SetColLabelSize( 30 ); + m_global_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Rows + m_global_grid->EnableDragRowSize( true ); + m_global_grid->SetRowLabelSize( 40 ); + m_global_grid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Label Appearance + + // Cell Defaults + m_global_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); + m_global_sizer->Add( m_global_grid, 1, wxALL|wxEXPAND, 5 ); + + + m_global_panel->SetSizer( m_global_sizer ); + m_global_panel->Layout(); + m_global_sizer->Fit( m_global_panel ); + m_auinotebook->AddPage( m_global_panel, _("Global Libraries"), true, wxNullBitmap ); + m_project_panel = new wxPanel( m_auinotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + m_project_panel->SetToolTip( _("Module libraries which are visible for curent project only") ); + + wxBoxSizer* m_project_sizer; + m_project_sizer = new wxBoxSizer( wxVERTICAL ); + + m_project_grid = new wxGrid( m_project_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + + // Grid + m_project_grid->CreateGrid( 1, 5 ); + m_project_grid->EnableEditing( true ); + m_project_grid->EnableGridLines( true ); + m_project_grid->EnableDragGridSize( true ); + m_project_grid->SetMargins( 0, 0 ); + + // Columns + m_project_grid->AutoSizeColumns(); + m_project_grid->EnableDragColMove( false ); + m_project_grid->EnableDragColSize( true ); + m_project_grid->SetColLabelSize( 30 ); + m_project_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Rows + m_project_grid->EnableDragRowSize( true ); + m_project_grid->SetRowLabelSize( 40 ); + m_project_grid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Label Appearance + + // Cell Defaults + m_project_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); + m_project_sizer->Add( m_project_grid, 1, wxALL|wxEXPAND, 5 ); + + + m_project_panel->SetSizer( m_project_sizer ); + m_project_panel->Layout(); + m_project_sizer->Fit( m_project_panel ); + m_auinotebook->AddPage( m_project_panel, _("Project Specific Libraries"), false, wxNullBitmap ); + + m_top_sizer->Add( m_auinotebook, 1, wxEXPAND | wxALL, 5 ); + + wxBoxSizer* bSizer51; + bSizer51 = new wxBoxSizer( wxHORIZONTAL ); + + m_append_button = new wxButton( m_top, wxID_ANY, _("Append Row"), wxDefaultPosition, wxDefaultSize, 0 ); + m_append_button->SetToolTip( _("Add a PCB library row to this table") ); + + bSizer51->Add( m_append_button, 0, wxALL, 5 ); + + m_delete_button = new wxButton( m_top, wxID_ANY, _("Delete Row"), wxDefaultPosition, wxDefaultSize, 0 ); + m_delete_button->SetToolTip( _("Remove a PCB library from this library table") ); + + bSizer51->Add( m_delete_button, 0, wxALL, 5 ); + + m_move_up_button = new wxButton( m_top, wxID_ANY, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0 ); + m_move_up_button->SetToolTip( _("Move the currently selected row up one position") ); + + bSizer51->Add( m_move_up_button, 0, wxALL, 5 ); + + m_move_down_button = new wxButton( m_top, wxID_ANY, _("Move Down"), wxDefaultPosition, wxDefaultSize, 0 ); + m_move_down_button->SetToolTip( _("Move the currently selected row down one position") ); + + bSizer51->Add( m_move_down_button, 0, wxALL, 5 ); + + + m_top_sizer->Add( bSizer51, 0, wxALIGN_CENTER|wxBOTTOM, 8 ); + + + m_top->SetSizer( m_top_sizer ); + m_top->Layout(); + m_top_sizer->Fit( m_top ); + m_bottom = new wxPanel( m_splitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); + wxBoxSizer* m_bottom_sizer; + m_bottom_sizer = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizer1; + sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( m_bottom, wxID_ANY, _("Path Substitutions") ), wxVERTICAL ); + + m_path_subs_grid = new wxGrid( m_bottom, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); + + // Grid + m_path_subs_grid->CreateGrid( 1, 2 ); + m_path_subs_grid->EnableEditing( true ); + m_path_subs_grid->EnableGridLines( true ); + m_path_subs_grid->EnableDragGridSize( false ); + m_path_subs_grid->SetMargins( 0, 0 ); + + // Columns + m_path_subs_grid->SetColSize( 0, 150 ); + m_path_subs_grid->SetColSize( 1, 500 ); + m_path_subs_grid->AutoSizeColumns(); + m_path_subs_grid->EnableDragColMove( false ); + m_path_subs_grid->EnableDragColSize( true ); + m_path_subs_grid->SetColLabelSize( 30 ); + m_path_subs_grid->SetColLabelValue( 0, _("Environment Variable") ); + m_path_subs_grid->SetColLabelValue( 1, _("Path Segment") ); + m_path_subs_grid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Rows + m_path_subs_grid->EnableDragRowSize( true ); + m_path_subs_grid->SetRowLabelSize( 40 ); + m_path_subs_grid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); + + // Label Appearance + + // Cell Defaults + m_path_subs_grid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); + sbSizer1->Add( m_path_subs_grid, 1, wxALL|wxEXPAND, 5 ); + + + m_bottom_sizer->Add( sbSizer1, 1, wxALL|wxEXPAND, 5 ); + + m_sdbSizer1 = new wxStdDialogButtonSizer(); + m_sdbSizer1OK = new wxButton( m_bottom, wxID_OK ); + m_sdbSizer1->AddButton( m_sdbSizer1OK ); + m_sdbSizer1Cancel = new wxButton( m_bottom, wxID_CANCEL ); + m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); + m_sdbSizer1->Realize(); + + m_bottom_sizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 5 ); + + + m_bottom->SetSizer( m_bottom_sizer ); + m_bottom->Layout(); + m_bottom_sizer->Fit( m_bottom ); + m_splitter->SplitHorizontally( m_top, m_bottom, 398 ); + bSizer1->Add( m_splitter, 2, wxEXPAND, 5 ); + + + this->SetSizer( bSizer1 ); + this->Layout(); + + this->Centre( wxBOTH ); + + // Connect Events + m_auinotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( DIALOG_FP_LIB_TABLE_BASE::pageChangedHandler ), NULL, this ); + m_global_grid->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCellLeftClick ), NULL, this ); + m_global_grid->Connect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCellLeftDClick ), NULL, this ); + m_global_grid->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCellRightClick ), NULL, this ); + m_global_grid->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCmdSelectCell ), NULL, this ); + m_project_grid->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCellLeftClick ), NULL, this ); + m_project_grid->Connect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCellLeftDClick ), NULL, this ); + m_project_grid->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCellRightClick ), NULL, this ); + m_project_grid->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCmdSelectCell ), NULL, this ); + m_append_button->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this ); + m_delete_button->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::deleteRowHandler ), NULL, this ); + m_move_up_button->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveUpHandler ), NULL, this ); + m_move_down_button->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveDownHandler ), NULL, this ); + m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onCancelButtonClick ), NULL, this ); + m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onOKButtonClick ), NULL, this ); +} + +DIALOG_FP_LIB_TABLE_BASE::~DIALOG_FP_LIB_TABLE_BASE() +{ + // Disconnect Events + m_auinotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( DIALOG_FP_LIB_TABLE_BASE::pageChangedHandler ), NULL, this ); + m_global_grid->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCellLeftClick ), NULL, this ); + m_global_grid->Disconnect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCellLeftDClick ), NULL, this ); + m_global_grid->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCellRightClick ), NULL, this ); + m_global_grid->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCmdSelectCell ), NULL, this ); + m_project_grid->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCellLeftClick ), NULL, this ); + m_project_grid->Disconnect( wxEVT_GRID_CELL_LEFT_DCLICK, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCellLeftDClick ), NULL, this ); + m_project_grid->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCellRightClick ), NULL, this ); + m_project_grid->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( DIALOG_FP_LIB_TABLE_BASE::onGridCmdSelectCell ), NULL, this ); + m_append_button->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this ); + m_delete_button->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::deleteRowHandler ), NULL, this ); + m_move_up_button->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveUpHandler ), NULL, this ); + m_move_down_button->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveDownHandler ), NULL, this ); + m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onCancelButtonClick ), NULL, this ); + m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onOKButtonClick ), NULL, this ); + +} diff --git a/pcbnew/dialogs/dialog_fp_lib_table_base.fbp b/pcbnew/dialogs/dialog_fp_lib_table_base.fbp index b5d7c1b9d4..9802ed25d8 100644 --- a/pcbnew/dialogs/dialog_fp_lib_table_base.fbp +++ b/pcbnew/dialogs/dialog_fp_lib_table_base.fbp @@ -1,1451 +1,1451 @@ - - - - - - C++ - 1 - source_name - 0 - 0 - res - UTF-8 - connect - dialog_fp_lib_table_base - 1000 - none - 1 - MyProject1 - - . - - 1 - 1 - 1 - 0 - 0 - - 0 - wxAUI_MGR_DEFAULT - - wxBOTH - - 1 - 1 - impl_virtual - - - - 0 - wxID_ANY - - - DIALOG_FP_LIB_TABLE_BASE - - 996,652 - wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - DIALOG_SHIM; dialog_shim.h - PCB Library Tables - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bSizer1 - wxVERTICAL - none - - 5 - wxEXPAND - 2 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - 10 - - 0 - - 1 - m_splitter - 1 - - - protected - 1 - - Resizable - 0.0 - 398 - -1 - 1 - - wxSPLIT_HORIZONTAL - wxSP_3DSASH - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_top - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - - - - wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - wxID_ANY - Library Tables by Scope - - m_top_sizer - wxVERTICAL - none - - - 5 - wxEXPAND | wxALL - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_auinotebook - 1 - - - protected - 1 - - Resizable - 1 - - wxAUI_NB_BOTTOM - - -1 - 0 - - - - - - - - - - - pageChangedHandler - - - - - - - - - - - - - - - - - - - - - - - - - - - - Global Libraries - 1 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_global_panel - 1 - - - protected - 0 - - Resizable - 1 - - - 0 - Module libraries which are visible for all projects - - - wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - - m_global_sizer - wxVERTICAL - none - - 5 - wxALL|wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - - - - 1 - - - wxALIGN_LEFT - - wxALIGN_TOP - 0 - 1 - wxALIGN_CENTRE - 30 - - wxALIGN_CENTRE - 5 - - - 1 - 0 - Dock - 1 - Left - 0 - 1 - 1 - 1 - 1 - 1 - - 0 - - - 1 - 0 - 0 - wxID_ANY - - - - 0 - 0 - - 0 - - - 0 - - 0 - m_global_grid - 1 - - - protected - 1 - - Fixed - wxALIGN_CENTRE - 40 - - wxALIGN_CENTRE - - 1 - 1 - - - 0 - - - - - - - - - onGridCellLeftClick - onGridCellLeftDClick - onGridCellRightClick - - - - - - - - - - - - - - - - - onGridCmdSelectCell - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Project Specific Libraries - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_project_panel - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - Module libraries which are visible for curent project only - - - wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - - m_project_sizer - wxVERTICAL - none - - 5 - wxALL|wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - - - - 1 - - - wxALIGN_LEFT - - wxALIGN_TOP - 0 - 1 - wxALIGN_CENTRE - 30 - - wxALIGN_CENTRE - 5 - - - 1 - 0 - Dock - 1 - Left - 0 - 1 - 1 - 1 - 1 - 1 - - 0 - - - 1 - 0 - 0 - wxID_ANY - - - - 0 - 0 - - 0 - - - 0 - - 0 - m_project_grid - 1 - - - protected - 1 - - Fixed - wxALIGN_CENTRE - 40 - - wxALIGN_CENTRE - - 1 - 1 - - - 0 - - - - - - - - - onGridCellLeftClick - onGridCellLeftDClick - onGridCellRightClick - - - - - - - - - - - - - - - - - onGridCmdSelectCell - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 8 - wxALIGN_CENTER|wxBOTTOM - 0 - - - bSizer51 - wxHORIZONTAL - none - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Append Row - - 0 - - - 0 - - 1 - m_append_button - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Add a pcb library row to this table - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - appendRowHandler - - - - - - - - - - - - - - - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Delete Row - - 0 - - - 0 - - 1 - m_delete_button - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Remove a PCB library from this library table - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - deleteRowHandler - - - - - - - - - - - - - - - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Move Up - - 0 - - - 0 - - 1 - m_move_up_button - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Move the currently selected row up one position - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - moveUpHandler - - - - - - - - - - - - - - - - - - 5 - wxALL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Move Down - - 0 - - - 0 - - 1 - m_move_down_button - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Move the currently selected row down one position - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - moveDownHandler - - - - - - - - - - - - - - - - - - - - - - - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_bottom - 1 - - - protected - 1 - - Resizable - 1 - - - 0 - - - - wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - - - - m_bottom_sizer - wxVERTICAL - none - - 5 - wxALL|wxEXPAND - 1 - - wxID_ANY - Path Substitutions - - sbSizer1 - wxVERTICAL - none - - - 5 - wxALL|wxEXPAND - 1 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - - - - 1 - - - wxALIGN_LEFT - - wxALIGN_TOP - 0 - 1 - wxALIGN_CENTRE - 30 - "Environment Variable" "Path Segment" - wxALIGN_CENTRE - 2 - 150,500 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - 0 - 1 - 1 - 1 - - 1 - - - 1 - 0 - 0 - wxID_ANY - - - - 0 - 0 - - 0 - - - 0 - - 1 - m_path_subs_grid - 1 - - - protected - 1 - - Resizable - wxALIGN_CENTRE - 40 - - wxALIGN_CENTRE - - 1 - 1 - - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 0 - 1 - 0 - 0 - 0 - 1 - 0 - 0 - - m_sdbSizer1 - protected - - onCancelButtonClick - - - - onOKButtonClick - - - - - - - - - - - - - + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + dialog_fp_lib_table_base + 1000 + none + 1 + MyProject1 + + . + + 1 + 1 + 1 + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + DIALOG_FP_LIB_TABLE_BASE + + 996,652 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + DIALOG_SHIM; dialog_shim.h + PCB Library Tables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizer1 + wxVERTICAL + none + + 5 + wxEXPAND + 2 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 10 + + 0 + + 1 + m_splitter + 1 + + + protected + 1 + + Resizable + 0.0 + 398 + -1 + 1 + + wxSPLIT_HORIZONTAL + wxSP_3DSASH + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_top + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + wxID_ANY + Library Tables by Scope + + m_top_sizer + wxVERTICAL + none + + + 5 + wxEXPAND | wxALL + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_auinotebook + 1 + + + protected + 1 + + Resizable + 1 + + wxAUI_NB_BOTTOM + + -1 + 0 + + + + + + + + + + + pageChangedHandler + + + + + + + + + + + + + + + + + + + + + + + + + + + + Global Libraries + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_global_panel + 1 + + + protected + 0 + + Resizable + 1 + + + 0 + Module libraries which are visible for all projects + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + m_global_sizer + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + 1 + 0 + + + + 1 + + + wxALIGN_LEFT + + wxALIGN_TOP + 0 + 1 + wxALIGN_CENTRE + 30 + + wxALIGN_CENTRE + 5 + + + 1 + 0 + Dock + 1 + Left + 0 + 1 + 1 + 1 + 1 + 1 + + 0 + + + 1 + 0 + 0 + wxID_ANY + + + + 0 + 0 + + 0 + + + 0 + + 0 + m_global_grid + 1 + + + protected + 1 + + Fixed + wxALIGN_CENTRE + 40 + + wxALIGN_CENTRE + + 1 + 1 + + + 0 + + + + + + + + + onGridCellLeftClick + onGridCellLeftDClick + onGridCellRightClick + + + + + + + + + + + + + + + + + onGridCmdSelectCell + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Project Specific Libraries + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_project_panel + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + Module libraries which are visible for curent project only + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + m_project_sizer + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + 1 + 0 + + + + 1 + + + wxALIGN_LEFT + + wxALIGN_TOP + 0 + 1 + wxALIGN_CENTRE + 30 + + wxALIGN_CENTRE + 5 + + + 1 + 0 + Dock + 1 + Left + 0 + 1 + 1 + 1 + 1 + 1 + + 0 + + + 1 + 0 + 0 + wxID_ANY + + + + 0 + 0 + + 0 + + + 0 + + 0 + m_project_grid + 1 + + + protected + 1 + + Fixed + wxALIGN_CENTRE + 40 + + wxALIGN_CENTRE + + 1 + 1 + + + 0 + + + + + + + + + onGridCellLeftClick + onGridCellLeftDClick + onGridCellRightClick + + + + + + + + + + + + + + + + + onGridCmdSelectCell + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 8 + wxALIGN_CENTER|wxBOTTOM + 0 + + + bSizer51 + wxHORIZONTAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Append Row + + 0 + + + 0 + + 1 + m_append_button + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Add a PCB library row to this table + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + appendRowHandler + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Delete Row + + 0 + + + 0 + + 1 + m_delete_button + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Remove a PCB library from this library table + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + deleteRowHandler + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Move Up + + 0 + + + 0 + + 1 + m_move_up_button + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Move the currently selected row up one position + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + moveUpHandler + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Move Down + + 0 + + + 0 + + 1 + m_move_down_button + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Move the currently selected row down one position + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + moveDownHandler + + + + + + + + + + + + + + + + + + + + + + + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_bottom + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxTAB_TRAVERSAL + + + + + + + + + + + + + + + + + + + + + + + + + + m_bottom_sizer + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 1 + + wxID_ANY + Path Substitutions + + sbSizer1 + wxVERTICAL + none + + + 5 + wxALL|wxEXPAND + 1 + + 1 + 1 + 1 + 1 + + + + + 1 + 0 + + + + 1 + + + wxALIGN_LEFT + + wxALIGN_TOP + 0 + 1 + wxALIGN_CENTRE + 30 + "Environment Variable" "Path Segment" + wxALIGN_CENTRE + 2 + 150,500 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + 0 + 1 + 1 + 1 + + 1 + + + 1 + 0 + 0 + wxID_ANY + + + + 0 + 0 + + 0 + + + 0 + + 1 + m_path_subs_grid + 1 + + + protected + 1 + + Resizable + wxALIGN_CENTRE + 40 + + wxALIGN_CENTRE + + 1 + 1 + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizer1 + protected + + onCancelButtonClick + + + + onOKButtonClick + + + + + + + + + + + + + diff --git a/pcbnew/dialogs/dialog_fp_lib_table_base.h b/pcbnew/dialogs/dialog_fp_lib_table_base.h index 5a0e15dcd0..83b918d6db 100644 --- a/pcbnew/dialogs/dialog_fp_lib_table_base.h +++ b/pcbnew/dialogs/dialog_fp_lib_table_base.h @@ -1,89 +1,89 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 8 2012) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#ifndef __DIALOG_FP_LIB_TABLE_BASE_H__ -#define __DIALOG_FP_LIB_TABLE_BASE_H__ - -#include -#include -#include -class DIALOG_SHIM; - -#include "dialog_shim.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/////////////////////////////////////////////////////////////////////////// - - -/////////////////////////////////////////////////////////////////////////////// -/// Class DIALOG_FP_LIB_TABLE_BASE -/////////////////////////////////////////////////////////////////////////////// -class DIALOG_FP_LIB_TABLE_BASE : public DIALOG_SHIM -{ - private: - - protected: - wxSplitterWindow* m_splitter; - wxPanel* m_top; - wxAuiNotebook* m_auinotebook; - wxPanel* m_global_panel; - wxGrid* m_global_grid; - wxPanel* m_project_panel; - wxGrid* m_project_grid; - wxButton* m_append_button; - wxButton* m_delete_button; - wxButton* m_move_up_button; - wxButton* m_move_down_button; - wxPanel* m_bottom; - wxGrid* m_path_subs_grid; - wxStdDialogButtonSizer* m_sdbSizer1; - wxButton* m_sdbSizer1OK; - wxButton* m_sdbSizer1Cancel; - - // Virtual event handlers, overide them in your derived class - virtual void pageChangedHandler( wxAuiNotebookEvent& event ) { event.Skip(); } - virtual void onGridCellLeftClick( wxGridEvent& event ) { event.Skip(); } - virtual void onGridCellLeftDClick( wxGridEvent& event ) { event.Skip(); } - virtual void onGridCellRightClick( wxGridEvent& event ) { event.Skip(); } - virtual void onGridCmdSelectCell( wxGridEvent& event ) { event.Skip(); } - virtual void appendRowHandler( wxMouseEvent& event ) { event.Skip(); } - virtual void deleteRowHandler( wxMouseEvent& event ) { event.Skip(); } - virtual void moveUpHandler( wxMouseEvent& event ) { event.Skip(); } - virtual void moveDownHandler( wxMouseEvent& event ) { event.Skip(); } - virtual void onCancelButtonClick( wxCommandEvent& event ) { event.Skip(); } - virtual void onOKButtonClick( wxCommandEvent& event ) { event.Skip(); } - - - public: - - DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("PCB Library Tables"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 996,652 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); - ~DIALOG_FP_LIB_TABLE_BASE(); - - void m_splitterOnIdle( wxIdleEvent& ) - { - m_splitter->SetSashPosition( 398 ); - m_splitter->Disconnect( wxEVT_IDLE, wxIdleEventHandler( DIALOG_FP_LIB_TABLE_BASE::m_splitterOnIdle ), NULL, this ); - } - -}; - -#endif //__DIALOG_FP_LIB_TABLE_BASE_H__ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Oct 8 2012) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_FP_LIB_TABLE_BASE_H__ +#define __DIALOG_FP_LIB_TABLE_BASE_H__ + +#include +#include +#include +class DIALOG_SHIM; + +#include "dialog_shim.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_FP_LIB_TABLE_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_FP_LIB_TABLE_BASE : public DIALOG_SHIM +{ + private: + + protected: + wxSplitterWindow* m_splitter; + wxPanel* m_top; + wxAuiNotebook* m_auinotebook; + wxPanel* m_global_panel; + wxGrid* m_global_grid; + wxPanel* m_project_panel; + wxGrid* m_project_grid; + wxButton* m_append_button; + wxButton* m_delete_button; + wxButton* m_move_up_button; + wxButton* m_move_down_button; + wxPanel* m_bottom; + wxGrid* m_path_subs_grid; + wxStdDialogButtonSizer* m_sdbSizer1; + wxButton* m_sdbSizer1OK; + wxButton* m_sdbSizer1Cancel; + + // Virtual event handlers, overide them in your derived class + virtual void pageChangedHandler( wxAuiNotebookEvent& event ) { event.Skip(); } + virtual void onGridCellLeftClick( wxGridEvent& event ) { event.Skip(); } + virtual void onGridCellLeftDClick( wxGridEvent& event ) { event.Skip(); } + virtual void onGridCellRightClick( wxGridEvent& event ) { event.Skip(); } + virtual void onGridCmdSelectCell( wxGridEvent& event ) { event.Skip(); } + virtual void appendRowHandler( wxMouseEvent& event ) { event.Skip(); } + virtual void deleteRowHandler( wxMouseEvent& event ) { event.Skip(); } + virtual void moveUpHandler( wxMouseEvent& event ) { event.Skip(); } + virtual void moveDownHandler( wxMouseEvent& event ) { event.Skip(); } + virtual void onCancelButtonClick( wxCommandEvent& event ) { event.Skip(); } + virtual void onOKButtonClick( wxCommandEvent& event ) { event.Skip(); } + + + public: + + DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("PCB Library Tables"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 996,652 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_FP_LIB_TABLE_BASE(); + + void m_splitterOnIdle( wxIdleEvent& ) + { + m_splitter->SetSashPosition( 398 ); + m_splitter->Disconnect( wxEVT_IDLE, wxIdleEventHandler( DIALOG_FP_LIB_TABLE_BASE::m_splitterOnIdle ), NULL, this ); + } + +}; + +#endif //__DIALOG_FP_LIB_TABLE_BASE_H__ diff --git a/pcbnew/dialogs/dialog_gendrill.cpp b/pcbnew/dialogs/dialog_gendrill.cpp index dccf7adb92..9939f66aa2 100644 --- a/pcbnew/dialogs/dialog_gendrill.cpp +++ b/pcbnew/dialogs/dialog_gendrill.cpp @@ -523,7 +523,7 @@ void DIALOG_GENDRILL::OnGenReportFile( wxCommandEvent& event ) } else { - msg.Printf( _( "Create report file %s\n" ), GetChars( dlg.GetPath() ) ); + msg.Printf( _( "Report file %s created\n" ), GetChars( dlg.GetPath() ) ); m_messagesBox->AppendText( msg ); } } diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index 12635a60b1..2b36023dd8 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -161,8 +161,9 @@ bool PCB_EDIT_FRAME::LoadOnePcbFile( const wxString& aFileName, bool aAppend, { if( GetScreen()->IsModify() && !aAppend ) { - if( !IsOK( this, _( "The current board has been modified. Do you wish to discard \ -the changes?" ) ) ) + if( !IsOK( this, + _( "The current board has been modified.\n" + "Do you wish to discard the changes?" ) ) ) return false; } diff --git a/pcbnew/gpcb_plugin.cpp b/pcbnew/gpcb_plugin.cpp index 8e16cbe103..76dcfed4f1 100644 --- a/pcbnew/gpcb_plugin.cpp +++ b/pcbnew/gpcb_plugin.cpp @@ -924,7 +924,7 @@ bool GPCB_PLUGIN::FootprintLibDelete( const wxString& aLibraryPath, PROPERTIES* if( tmp.GetExt() != KiCadFootprintFileExtension ) { - THROW_IO_ERROR( wxString::Format( _( "unexpected file '%s' has found in library path '%s'" ), + THROW_IO_ERROR( wxString::Format( _( "unexpected file '%s' was found in library path '%s'" ), files[i].GetData(), aLibraryPath.GetData() ) ); } } diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index e1950d7c57..a74f05cb96 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -1758,7 +1758,7 @@ bool PCB_IO::FootprintLibDelete( const wxString& aLibraryPath, PROPERTIES* aProp if( tmp.GetExt() != KiCadFootprintFileExtension ) { - THROW_IO_ERROR( wxString::Format( _( "unexpected file '%s' has found in library path '%s'" ), + THROW_IO_ERROR( wxString::Format( _( "unexpected file '%s' was found in library path '%s'" ), files[i].GetData(), aLibraryPath.GetData() ) ); } } diff --git a/pcbnew/menubar_modedit.cpp b/pcbnew/menubar_modedit.cpp index 49060946a0..df68cee10a 100644 --- a/pcbnew/menubar_modedit.cpp +++ b/pcbnew/menubar_modedit.cpp @@ -102,8 +102,8 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() // Save the currently loaded legacy library as an s-expression library. AddMenuItem( fileMenu, ID_MODEDIT_SAVE_LIBRARY_AS, - _( "Save Current Library as Other" ), - _( "Save entire current library as new library." ), + _( "Save Current Library as ..." ), + _( "Save entire current library under a new name." ), wxNullBitmap ); // Save module diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 9a72c1078c..db8e6f4127 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -679,6 +679,7 @@ bool PCB_EDIT_FRAME::IsMicroViaAcceptable( void ) void PCB_EDIT_FRAME::syncLayerWidgetLayer() { m_Layers->SelectLayer( getActiveLayer() ); + m_Layers->OnLayerSelected(); } From 63e987edd0e54c161502b8da2f9ea83db9a730ea Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Fri, 5 Apr 2013 10:55:46 +0200 Subject: [PATCH 43/63] Removed the default generation of phantom text by the postscript plot driver. It crashes Adobe's own implementation of postscript! --- include/plot_common.h | 13 ++++++++++--- pcbnew/pcb_plot_params.cpp | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/include/plot_common.h b/include/plot_common.h index fce08c366b..dfe2588349 100644 --- a/include/plot_common.h +++ b/include/plot_common.h @@ -37,6 +37,7 @@ enum PlotFormat { * 2) only use native postscript fonts * 3) use the internal vector font and add 'phantom' text to aid * searching + * 4) keep the default for the plot driver * * This is recognized by the DXF driver too, where NATIVE emits * TEXT entities instead of stroking the text @@ -44,7 +45,8 @@ enum PlotFormat { enum PlotTextMode { PLOTTEXTMODE_STROKE, PLOTTEXTMODE_NATIVE, - PLOTTEXTMODE_PHANTOM + PLOTTEXTMODE_PHANTOM, + PLOTTEXTMODE_DEFAULT }; @@ -439,7 +441,8 @@ public: */ virtual void SetTextMode( PlotTextMode mode ) { - m_textMode = mode; + if( mode != PLOTTEXTMODE_DEFAULT ) + m_textMode = mode; } virtual void SetDefaultLineWidth( int width ); @@ -514,6 +517,9 @@ class PS_PLOTTER : public PSLIKE_PLOTTER public: PS_PLOTTER() { + // The phantom plot in postscript is an hack and reportedly + // crashes Adobe's own postscript interpreter! + m_textMode = PLOTTEXTMODE_STROKE; } static wxString GetDefaultFileExtension() @@ -838,7 +844,8 @@ public: */ virtual void SetTextMode( PlotTextMode mode ) { - textAsLines = ( mode != PLOTTEXTMODE_NATIVE ); + if( mode != PLOTTEXTMODE_DEFAULT ) + textAsLines = ( mode != PLOTTEXTMODE_NATIVE ); } virtual bool StartPlot(); diff --git a/pcbnew/pcb_plot_params.cpp b/pcbnew/pcb_plot_params.cpp index 5d0fd927dc..b3ea9c527c 100644 --- a/pcbnew/pcb_plot_params.cpp +++ b/pcbnew/pcb_plot_params.cpp @@ -111,7 +111,7 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS() m_color = BLACK; m_referenceColor = BLACK; m_valueColor = BLACK; - m_textMode = PLOTTEXTMODE_PHANTOM; + m_textMode = PLOTTEXTMODE_DEFAULT; // This parameter controls if the NPTH pads will be plotted or not // it is are "local" parameters From 90f2e67ed8637234f0f61997646570c2c741af3f Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Fri, 5 Apr 2013 17:09:04 +0200 Subject: [PATCH 44/63] Typo fix --- common/basicframe.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/basicframe.cpp b/common/basicframe.cpp index 378183e7ee..5da0db7756 100644 --- a/common/basicframe.cpp +++ b/common/basicframe.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 20131 Wayne Stambaugh + * Copyright (C) 2013 Wayne Stambaugh * Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or From db09deedf7e78edafad95d4c9510fb23314b4dec Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Fri, 5 Apr 2013 19:23:56 +0200 Subject: [PATCH 45/63] New color palette --- common/common.cpp | 54 ++++++++++++++++------------- common/common_plotDXF_functions.cpp | 54 ++++++++++++++++------------- common/selcolor.cpp | 8 ++--- include/colors.h | 40 ++++++++++++--------- 4 files changed, 87 insertions(+), 69 deletions(-) diff --git a/common/common.cpp b/common/common.cpp index 6ce54a387d..524a833ddd 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -76,30 +76,36 @@ bool IsGOST() */ const StructColors g_ColorRefs[NBCOLORS] = { - { 0, 0, 0, BLACK, wxT( "BLACK" ), DARKDARKGRAY }, - { 192, 0, 0, BLUE, wxT( "BLUE" ), LIGHTBLUE }, - { 0, 160, 0, GREEN, wxT( "GREEN" ), LIGHTGREEN }, - { 160, 160, 0, CYAN, wxT( "CYAN" ), LIGHTCYAN }, - { 0, 0, 160, RED, wxT( "RED" ), LIGHTRED }, - { 160, 0, 160, MAGENTA, wxT( "MAGENTA" ), LIGHTMAGENTA }, - { 0, 128, 128, BROWN, wxT( "BROWN" ), YELLOW }, - { 192, 192, 192, LIGHTGRAY, wxT( "GRAY" ), WHITE }, - { 128, 128, 128, DARKGRAY, wxT( "DARKGRAY" ), LIGHTGRAY }, - { 255, 0, 0, LIGHTBLUE, wxT( "LIGHTBLUE" ), LIGHTBLUE }, - { 0, 255, 0, LIGHTGREEN, wxT( "LIGHTGREEN" ), LIGHTGREEN }, - { 255, 255, 0, LIGHTCYAN, wxT( "LIGHTCYAN" ), LIGHTCYAN }, - { 0, 0, 255, LIGHTRED, wxT( "LIGHTRED" ), LIGHTRED }, - { 255, 0, 255, LIGHTMAGENTA, wxT( "LIGHTMAGENTA" ), LIGHTMAGENTA }, - { 0, 255, 255, YELLOW, wxT( "YELLOW" ), YELLOW }, - { 255, 255, 255, WHITE, wxT( "WHITE" ), WHITE }, - { 64, 64, 64, DARKDARKGRAY, wxT( "DARKDARKGRAY" ), DARKGRAY }, - { 64, 0, 0, DARKBLUE, wxT( "DARKBLUE" ), BLUE }, - { 0, 64, 0, DARKGREEN, wxT( "DARKGREEN" ), GREEN }, - { 64, 64, 0, DARKCYAN, wxT( "DARKCYAN" ), CYAN }, - { 0, 0, 80, DARKRED, wxT( "DARKRED" ), RED }, - { 64, 0, 64, DARKMAGENTA, wxT( "DARKMAGENTA" ), MAGENTA }, - { 0, 64, 64, DARKBROWN, wxT( "DARKBROWN" ), BROWN }, - { 128, 255, 255, LIGHTYELLOW, wxT( "LIGHTYELLOW" ), LIGHTYELLOW } + { 0, 0, 0, BLACK, wxT( "Black" ), DARKDARKGRAY }, + { 72, 72, 72, DARKDARKGRAY, wxT( "Gray 1" ), DARKGRAY }, + { 132, 132, 132, DARKGRAY, wxT( "Gray 2" ), LIGHTGRAY }, + { 194, 194, 194, LIGHTGRAY, wxT( "Gray 3" ), WHITE }, + { 255, 255, 255, WHITE, wxT( "White" ), WHITE }, + { 194, 255, 255, LIGHTYELLOW, wxT( "L.Yellow" ), WHITE }, + { 72, 0, 0, DARKBLUE, wxT( "Blue 1" ), BLUE }, + { 0, 72, 0, DARKGREEN, wxT( "Green 1" ), GREEN }, + { 72, 72, 0, DARKCYAN, wxT( "Cyan 1" ), CYAN }, + { 0, 0, 72, DARKRED, wxT( "Red 1" ), RED }, + { 72, 0, 72, DARKMAGENTA, wxT( "Magenta 1" ), MAGENTA }, + { 0, 72, 72, DARKBROWN, wxT( "Brown 1" ), BROWN }, + { 132, 0, 0, BLUE, wxT( "Blue 2" ), LIGHTBLUE }, + { 0, 132, 0, GREEN, wxT( "Green 2" ), LIGHTGREEN }, + { 132, 132, 0, CYAN, wxT( "Cyan 2" ), LIGHTCYAN }, + { 0, 0, 132, RED, wxT( "Red 2" ), LIGHTRED }, + { 132, 0, 132, MAGENTA, wxT( "Magenta 2" ), LIGHTMAGENTA }, + { 0, 132, 132, BROWN, wxT( "Brown 2" ), YELLOW }, + { 194, 0, 0, LIGHTBLUE, wxT( "Blue 3" ), PUREBLUE, }, + { 0, 194, 0, LIGHTGREEN, wxT( "Green 3" ), PUREGREEN }, + { 194, 194, 0, LIGHTCYAN, wxT( "Cyan 3" ), PURECYAN }, + { 0, 0, 194, LIGHTRED, wxT( "Red 3" ), PURERED }, + { 194, 0, 194, LIGHTMAGENTA, wxT( "Magenta 3" ), PUREMAGENTA }, + { 0, 194, 194, YELLOW, wxT( "Yellow 3" ), PUREYELLOW }, + { 255, 0, 0, PUREBLUE, wxT( "Blue 4" ), WHITE }, + { 0, 255, 0, PUREGREEN, wxT( "Green 4" ), WHITE }, + { 255, 255, 0, PURECYAN, wxT( "Cyan 4" ), WHITE }, + { 0, 0, 255, PURERED, wxT( "Red 4" ), WHITE }, + { 255, 0, 255, PUREMAGENTA, wxT( "Magenta 4" ), WHITE }, + { 0, 255, 255, PUREYELLOW, wxT( "Yellow 4" ), WHITE }, }; diff --git a/common/common_plotDXF_functions.cpp b/common/common_plotDXF_functions.cpp index 88dc4d6013..7958292074 100644 --- a/common/common_plotDXF_functions.cpp +++ b/common/common_plotDXF_functions.cpp @@ -171,30 +171,36 @@ bool DXF_PLOTTER::StartPlot() const char *name; int color; } dxf_layer[NBCOLORS] = { - { "BLACK", 250 }, - { "BLUE", 5 }, - { "GREEN", 3 }, - { "CYAN", 4 }, - { "RED", 1 }, - { "MAGENTA", 6 }, - { "BROWN", 54 }, - { "LIGHTGRAY", 9 }, - { "DARKGRAY", 8 }, - { "LIGHTBLUE", 171 }, - { "LIGHTGREEN", 91 }, - { "LIGHTCYAN", 131 }, - { "LIGHTRED", 11 }, - { "LIGHTMAGENTA", 221 }, - { "YELLOW", 2 }, - { "WHITE", 7 }, - { "DARKDARKGRAY", 251 }, - { "DARKBLUE", 178 }, - { "DARKGREEN", 98 }, - { "DARKCYAN", 138 }, - { "DARKRED", 18 }, - { "DARKMAGENTA", 228 }, - { "DARKBROWN", 58 }, - { "LIGHTYELLOW", 51 }, + { "BLACK", 7 }, // In DXF, color 7 is *both* white and black! + { "GRAY1", 251 }, + { "GRAY2", 8 }, + { "GRAY3", 9 }, + { "WHITE", 7 }, + { "LYELLOW", 51 }, + { "BLUE1", 178 }, + { "GREEN1", 98 }, + { "CYAN1", 138 }, + { "RED1", 18 }, + { "MAGENTA1", 228 }, + { "BROWN1", 58 }, + { "BLUE2", 5 }, + { "GREEN2", 3 }, + { "CYAN2", 4 }, + { "RED2", 1 }, + { "MAGENTA2", 6 }, + { "BROWN2", 54 }, + { "BLUE3", 171 }, + { "GREEN3", 91 }, + { "CYAN3", 131 }, + { "RED3", 11 }, + { "MAGENTA3", 221 }, + { "YELLOW3", 2 }, + { "BLUE4", 5 }, + { "GREEN4", 3 }, + { "CYAN4", 4 }, + { "RED4", 1 }, + { "MAGENTA4", 6 }, + { "YELLOW4", 2 } }; for( EDA_COLOR_T i = BLACK; i < NBCOLORS; ++i ) diff --git a/common/selcolor.cpp b/common/selcolor.cpp index 13dec6c276..ac5e22fdd3 100644 --- a/common/selcolor.cpp +++ b/common/selcolor.cpp @@ -139,15 +139,15 @@ void WinEDA_SelColorFrame::Init_Dialog( int aOldColor ) for( ii = 0; ii < NBCOLORS; ++ii ) { - // Provide a separate column for every eight buttons (and their + // Provide a separate column for every six buttons (and their // associated text strings), so provide a FlexGrid Sizer with // eight rows and two columns. - if( ii % 8 == 0 ) + if( ii % 6 == 0 ) { - FlexColumnBoxSizer = new wxFlexGridSizer( 8, 2, 0, 0 ); + FlexColumnBoxSizer = new wxFlexGridSizer( 6, 2, 0, 0 ); // Specify that all of the rows can be expanded. - for( int ii = 0; ii < 8; ii++ ) + for( int ii = 0; ii < 6; ii++ ) { FlexColumnBoxSizer->AddGrowableRow( ii ); } diff --git a/include/colors.h b/include/colors.h index feb9575ece..123544d071 100644 --- a/include/colors.h +++ b/include/colors.h @@ -14,32 +14,38 @@ enum EDA_COLOR_T { UNSPECIFIED_COLOR = -1, BLACK = 0, - BLUE, - GREEN, - CYAN, - RED, - MAGENTA, - BROWN, - LIGHTGRAY, - DARKGRAY, - LIGHTBLUE, - LIGHTGREEN, - LIGHTCYAN, - LIGHTRED, - LIGHTMAGENTA, - YELLOW, - WHITE, DARKDARKGRAY, + DARKGRAY, + LIGHTGRAY, + WHITE, + LIGHTYELLOW, DARKBLUE, DARKGREEN, DARKCYAN, DARKRED, DARKMAGENTA, DARKBROWN, - LIGHTYELLOW, + BLUE, + GREEN, + CYAN, + RED, + MAGENTA, + BROWN, + LIGHTBLUE, + LIGHTGREEN, + LIGHTCYAN, + LIGHTRED, + LIGHTMAGENTA, + YELLOW, + PUREBLUE, + PUREGREEN, + PURECYAN, + PURERED, + PUREMAGENTA, + PUREYELLOW, NBCOLORS, ///< Number of colors HIGHLIGHT_FLAG = ( 1<<19 ), - MASKCOLOR = 31 ///< mask for color index into ColorRefs[] + MASKCOLOR = 31 ///< mask for color index into g_ColorRefs[] }; /// Checked cast. Use only when necessary (usually I/O) From 00f0e278518a164e9936ca7bccab4abd70f3fd86 Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Fri, 5 Apr 2013 21:04:58 +0200 Subject: [PATCH 46/63] Factored layer utility functions: classification, layer flip and mask flip --- common/CMakeLists.txt | 1 - common/pcbcommon.cpp | 112 +++++++++++++++ include/layers_id_colors_and_visibility.h | 25 ++++ pcbnew/class_board.h | 8 -- pcbnew/class_dimension.cpp | 2 +- pcbnew/class_drawsegment.cpp | 2 +- pcbnew/class_mire.cpp | 2 +- pcbnew/class_module.cpp | 22 ++- pcbnew/class_module_transform_functions.cpp | 130 ------------------ pcbnew/class_pad.cpp | 69 ++-------- pcbnew/class_pad_draw_functions.cpp | 94 ++----------- pcbnew/class_pcb_text.cpp | 2 +- pcbnew/class_track.cpp | 2 +- pcbnew/class_zone.cpp | 2 +- pcbnew/dialogs/dialog_pad_properties.cpp | 4 +- pcbnew/dialogs/dialog_plot.cpp | 2 +- pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp | 2 +- pcbnew/pcad2kicadpcb_plugin/pcb_component.cpp | 37 +---- pcbnew/pcad2kicadpcb_plugin/pcb_component.h | 2 - pcbnew/pcad2kicadpcb_plugin/pcb_line.cpp | 2 +- pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp | 2 +- pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp | 2 +- pcbnew/protos.h | 7 - polygon/PolyLine.cpp | 2 +- 24 files changed, 186 insertions(+), 349 deletions(-) delete mode 100644 pcbnew/class_module_transform_functions.cpp diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 8961793ec1..6c17b8496d 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -106,7 +106,6 @@ set(PCB_COMMON_SRCS ../pcbnew/class_marker_pcb.cpp ../pcbnew/class_mire.cpp ../pcbnew/class_module.cpp - ../pcbnew/class_module_transform_functions.cpp ../pcbnew/class_pad.cpp ../pcbnew/class_pad_draw_functions.cpp ../pcbnew/class_pcb_text.cpp diff --git a/common/pcbcommon.cpp b/common/pcbcommon.cpp index 70b8473508..8dfbd03e08 100644 --- a/common/pcbcommon.cpp +++ b/common/pcbcommon.cpp @@ -72,3 +72,115 @@ int g_PadCMPColor = RED; */ DLIST g_CurrentTrackList; +LAYER_NUM FlipLayer( LAYER_NUM oldlayer ) +{ + switch( oldlayer ) + { + case LAYER_N_BACK: + return LAYER_N_FRONT; + + case LAYER_N_FRONT: + return LAYER_N_BACK; + + case SILKSCREEN_N_BACK: + return SILKSCREEN_N_FRONT; + + case SILKSCREEN_N_FRONT: + return SILKSCREEN_N_BACK; + + case ADHESIVE_N_BACK: + return ADHESIVE_N_FRONT; + + case ADHESIVE_N_FRONT: + return ADHESIVE_N_BACK; + + case SOLDERMASK_N_BACK: + return SOLDERMASK_N_FRONT; + + case SOLDERMASK_N_FRONT: + return SOLDERMASK_N_BACK; + + case SOLDERPASTE_N_BACK: + return SOLDERPASTE_N_FRONT; + + case SOLDERPASTE_N_FRONT: + return SOLDERPASTE_N_BACK; + + // No change for the other layers + default: + return oldlayer; + } +} + + +LAYER_MSK FlipLayerMask( LAYER_MSK aMask ) +{ + LAYER_MSK newMask; + + newMask = aMask & ~(LAYER_BACK | LAYER_FRONT | + SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT | + ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT | + SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT | + SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT | + ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT); + + if( aMask & LAYER_BACK ) + newMask |= LAYER_FRONT; + + if( aMask & LAYER_FRONT ) + newMask |= LAYER_BACK; + + if( aMask & SILKSCREEN_LAYER_BACK ) + newMask |= SILKSCREEN_LAYER_FRONT; + + if( aMask & SILKSCREEN_LAYER_FRONT ) + newMask |= SILKSCREEN_LAYER_BACK; + + if( aMask & ADHESIVE_LAYER_BACK ) + newMask |= ADHESIVE_LAYER_FRONT; + + if( aMask & ADHESIVE_LAYER_FRONT ) + newMask |= ADHESIVE_LAYER_BACK; + + if( aMask & SOLDERMASK_LAYER_BACK ) + newMask |= SOLDERMASK_LAYER_FRONT; + + if( aMask & SOLDERMASK_LAYER_FRONT ) + newMask |= SOLDERMASK_LAYER_BACK; + + if( aMask & SOLDERPASTE_LAYER_BACK ) + newMask |= SOLDERPASTE_LAYER_FRONT; + + if( aMask & SOLDERPASTE_LAYER_FRONT ) + newMask |= SOLDERPASTE_LAYER_BACK; + + if( aMask & ADHESIVE_LAYER_BACK ) + newMask |= ADHESIVE_LAYER_FRONT; + + if( aMask & ADHESIVE_LAYER_FRONT ) + newMask |= ADHESIVE_LAYER_BACK; + + return newMask; +} + +LAYER_NUM ExtractLayer( LAYER_MSK aMask ) +{ + if( aMask == NO_LAYERS ) + return UNSELECTED_LAYER; + + LAYER_NUM candidate = UNDEFINED_LAYER; + + // Scan all the layers and take note of the first set; if other are + // then found return UNDEFINED_LAYER + for( LAYER_NUM i = FIRST_LAYER; i < NB_LAYERS; ++i ) + { + if( aMask & GetLayerMask( i ) ) + { + if( candidate == UNDEFINED_LAYER ) + candidate = i; + else + return UNDEFINED_LAYER; + } + } + return candidate; +} diff --git a/include/layers_id_colors_and_visibility.h b/include/layers_id_colors_and_visibility.h index 28dacafee3..a9dd03f915 100644 --- a/include/layers_id_colors_and_visibility.h +++ b/include/layers_id_colors_and_visibility.h @@ -124,6 +124,12 @@ typedef unsigned LAYER_MSK; #define ALL_CU_LAYERS 0x0000FFFF #define INTERNAL_LAYERS 0x00007FFE #define EXTERNAL_LAYERS 0x00008001 +#define BACK_LAYERS (LAYER_BACK | ADHESIVE_LAYER_BACK | \ + SOLDERPASTE_LAYER_BACK | SILKSCREEN_LAYER_BACK | \ + SOLDERMASK_LAYER_BACK) +#define FRONT_LAYERS (LAYER_FRONT | ADHESIVE_LAYER_FRONT | \ + SOLDERPASTE_LAYER_FRONT | SILKSCREEN_LAYER_FRONT | \ + SOLDERMASK_LAYER_FRONT) #define NO_LAYERS 0x00000000 /** return a one bit layer mask from a layer number @@ -271,5 +277,24 @@ inline bool IsBackLayer( LAYER_NUM aLayer ) aLayer == SOLDERPASTE_N_BACK ); } +/** + * Function ReturnFlippedLayerNumber + * @return the layer number after flipping an item + * some (not all) layers: external copper, Mask, Paste, and solder + * are swapped between front and back sides + */ +LAYER_NUM FlipLayer( LAYER_NUM oldlayer ); + +/** + * Calculate the mask layer when flipping a footprint + * BACK and FRONT copper layers, mask, paste, solder layers are swapped + */ +LAYER_MSK FlipLayerMask( LAYER_MSK aMask ); + +/** + * Extract the set layer from a mask. Returns UNDEFINED_LAYER if more + * than one is set or UNSELECTED_LAYER if none is + */ +LAYER_NUM ExtractLayer( LAYER_MSK aMask ); #endif // _LAYERS_ID_AND_VISIBILITY_H_ diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index bd2885df42..fe92536160 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -656,14 +656,6 @@ public: */ EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const; - /** - * Function ReturnFlippedLayerNumber - * @return the layer number after flipping an item - * some (not all) layers: external copper, Mask, Paste, and solder - * are swapped between front and back sides - */ - static LAYER_NUM ReturnFlippedLayerNumber( LAYER_NUM oldlayer ); - /** Functions to get some items count */ int GetNumSegmTrack() const; diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp index 1b77f73417..c1f54724c4 100644 --- a/pcbnew/class_dimension.cpp +++ b/pcbnew/class_dimension.cpp @@ -176,7 +176,7 @@ void DIMENSION::Rotate( const wxPoint& aRotCentre, double aAngle ) void DIMENSION::Flip( const wxPoint& aCentre ) { Mirror( aCentre ); - SetLayer( BOARD::ReturnFlippedLayerNumber( GetLayer() ) ); + SetLayer( FlipLayer( GetLayer() ) ); } diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp index 9e23534245..8926769111 100644 --- a/pcbnew/class_drawsegment.cpp +++ b/pcbnew/class_drawsegment.cpp @@ -111,7 +111,7 @@ void DRAWSEGMENT::Flip( const wxPoint& aCentre ) NEGATE( m_Angle ); } - SetLayer( BOARD::ReturnFlippedLayerNumber( GetLayer() ) ); + SetLayer( FlipLayer( GetLayer() ) ); } const wxPoint DRAWSEGMENT::GetArcEnd() const diff --git a/pcbnew/class_mire.cpp b/pcbnew/class_mire.cpp index c05a03dfee..e1a2df6a78 100644 --- a/pcbnew/class_mire.cpp +++ b/pcbnew/class_mire.cpp @@ -194,7 +194,7 @@ void PCB_TARGET::Rotate(const wxPoint& aRotCentre, double aAngle) void PCB_TARGET::Flip(const wxPoint& aCentre ) { m_Pos.y = aCentre.y - ( m_Pos.y - aCentre.y ); - SetLayer( BOARD::ReturnFlippedLayerNumber( GetLayer() ) ); + SetLayer( FlipLayer( GetLayer() ) ); } diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index c6eaac88f0..2c06379a03 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -758,7 +758,7 @@ void MODULE::Flip( const wxPoint& aCentre ) SetPosition( finalPos ); // Flip layer - SetLayer( BOARD::ReturnFlippedLayerNumber( GetLayer() ) ); + SetLayer( FlipLayer( GetLayer() ) ); // Reverse mirror orientation. NEGATE( m_Orient ); @@ -777,7 +777,7 @@ void MODULE::Flip( const wxPoint& aCentre ) text->m_Mirror = false; NEGATE_AND_NORMALIZE_ANGLE_POS( text->m_Orient ); text->SetLayer( GetLayer() ); - text->SetLayer( BOARD::ReturnFlippedLayerNumber( text->GetLayer() ) ); + text->SetLayer( FlipLayer( text->GetLayer() ) ); if( GetLayer() == LAYER_N_BACK ) text->SetLayer( SILKSCREEN_N_BACK ); @@ -785,8 +785,7 @@ void MODULE::Flip( const wxPoint& aCentre ) if( GetLayer() == LAYER_N_FRONT ) text->SetLayer( SILKSCREEN_N_FRONT ); - if( (GetLayer() == SILKSCREEN_N_BACK) - || (GetLayer() == ADHESIVE_N_BACK) || (GetLayer() == LAYER_N_BACK) ) + if( IsBackLayer( GetLayer() ) ) text->m_Mirror = true; // Mirror value. @@ -798,7 +797,7 @@ void MODULE::Flip( const wxPoint& aCentre ) text->m_Mirror = false; NEGATE_AND_NORMALIZE_ANGLE_POS( text->m_Orient ); text->SetLayer( GetLayer() ); - text->SetLayer( BOARD::ReturnFlippedLayerNumber( text->GetLayer() ) ); + text->SetLayer( FlipLayer( text->GetLayer() ) ); if( GetLayer() == LAYER_N_BACK ) text->SetLayer( SILKSCREEN_N_BACK ); @@ -806,8 +805,7 @@ void MODULE::Flip( const wxPoint& aCentre ) if( GetLayer() == LAYER_N_FRONT ) text->SetLayer( SILKSCREEN_N_FRONT ); - if( (GetLayer() == SILKSCREEN_N_BACK) - || (GetLayer() == ADHESIVE_N_BACK) || (GetLayer() == LAYER_N_BACK) ) + if( IsBackLayer( GetLayer() ) ) text->m_Mirror = true; // Reverse mirror module graphics and texts. @@ -839,7 +837,7 @@ void MODULE::Flip( const wxPoint& aCentre ) em->SetAngle( -em->GetAngle() ); } - em->SetLayer( BOARD::ReturnFlippedLayerNumber( em->GetLayer() ) ); + em->SetLayer( FlipLayer( em->GetLayer() ) ); } break; @@ -854,7 +852,7 @@ void MODULE::Flip( const wxPoint& aCentre ) NEGATE_AND_NORMALIZE_ANGLE_POS( text->m_Orient ); text->SetLayer( GetLayer() ); - text->SetLayer( BOARD::ReturnFlippedLayerNumber( text->GetLayer() ) ); + text->SetLayer( FlipLayer( text->GetLayer() ) ); if( GetLayer() == LAYER_N_BACK ) text->SetLayer( SILKSCREEN_N_BACK ); @@ -862,12 +860,8 @@ void MODULE::Flip( const wxPoint& aCentre ) if( GetLayer() == LAYER_N_FRONT ) text->SetLayer( SILKSCREEN_N_FRONT ); - if( GetLayer() == SILKSCREEN_N_BACK - || GetLayer() == ADHESIVE_N_BACK - || GetLayer() == LAYER_N_BACK ) - { + if( IsBackLayer( GetLayer() ) ) text->m_Mirror = true; - } break; diff --git a/pcbnew/class_module_transform_functions.cpp b/pcbnew/class_module_transform_functions.cpp deleted file mode 100644 index 159b83697d..0000000000 --- a/pcbnew/class_module_transform_functions.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/** - * @file class_module_transform_functions.cpp - * @brief Functions of class MODULE to handle some geometric changes such as move, rotate ... - */ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - - - -/* Returns the layer number after flipping an item - * some layers: external copper, Mask, Paste, and solder - * are swapped between front and back sides - */ -LAYER_NUM BOARD::ReturnFlippedLayerNumber( LAYER_NUM oldlayer ) -{ - LAYER_NUM newlayer; - - switch( oldlayer ) - { - case LAYER_N_BACK: - newlayer = LAYER_N_FRONT; - break; - - case LAYER_N_FRONT: - newlayer = LAYER_N_BACK; - break; - - case SILKSCREEN_N_BACK: - newlayer = SILKSCREEN_N_FRONT; - break; - - case SILKSCREEN_N_FRONT: - newlayer = SILKSCREEN_N_BACK; - break; - - case ADHESIVE_N_BACK: - newlayer = ADHESIVE_N_FRONT; - break; - - case ADHESIVE_N_FRONT: - newlayer = ADHESIVE_N_BACK; - break; - - case SOLDERMASK_N_BACK: - newlayer = SOLDERMASK_N_FRONT; - break; - - case SOLDERMASK_N_FRONT: - newlayer = SOLDERMASK_N_BACK; - break; - - case SOLDERPASTE_N_BACK: - newlayer = SOLDERPASTE_N_FRONT; - break; - - case SOLDERPASTE_N_FRONT: - newlayer = SOLDERPASTE_N_BACK; - break; - - default: - newlayer = oldlayer; - } - - return newlayer; -} - - -/* Calculate the mask layer when flipping a footprint - * BACK and FRONT copper layers , mask, paste, solder layers are swapped - */ -LAYER_MSK ChangeSideMaskLayer( LAYER_MSK aMask ) -{ - LAYER_MSK newMask; - - newMask = aMask & ~(LAYER_BACK | LAYER_FRONT | - SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT | - ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT | - SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT | - SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT | - ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT); - - if( aMask & LAYER_BACK ) - newMask |= LAYER_FRONT; - - if( aMask & LAYER_FRONT ) - newMask |= LAYER_BACK; - - if( aMask & SILKSCREEN_LAYER_BACK ) - newMask |= SILKSCREEN_LAYER_FRONT; - - if( aMask & SILKSCREEN_LAYER_FRONT ) - newMask |= SILKSCREEN_LAYER_BACK; - - if( aMask & ADHESIVE_LAYER_BACK ) - newMask |= ADHESIVE_LAYER_FRONT; - - if( aMask & ADHESIVE_LAYER_FRONT ) - newMask |= ADHESIVE_LAYER_BACK; - - if( aMask & SOLDERMASK_LAYER_BACK ) - newMask |= SOLDERMASK_LAYER_FRONT; - - if( aMask & SOLDERMASK_LAYER_FRONT ) - newMask |= SOLDERMASK_LAYER_BACK; - - if( aMask & SOLDERPASTE_LAYER_BACK ) - newMask |= SOLDERPASTE_LAYER_FRONT; - - if( aMask & SOLDERPASTE_LAYER_FRONT ) - newMask |= SOLDERPASTE_LAYER_BACK; - - if( aMask & ADHESIVE_LAYER_BACK ) - newMask |= ADHESIVE_LAYER_FRONT; - - if( aMask & ADHESIVE_LAYER_FRONT ) - newMask |= ADHESIVE_LAYER_BACK; - - return newMask; -} diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index ee52e4ad20..9a82cf7d9b 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -168,7 +168,7 @@ void D_PAD::Flip( int aTranslationY ) SetOrientation( -GetOrientation() ); // flip pads layers - SetLayerMask( ChangeSideMaskLayer( m_layerMask ) ); + SetLayerMask( FlipLayerMask( m_layerMask ) ); // m_boundingRadius = -1; the shape has not been changed } @@ -542,76 +542,31 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList ) if( (m_layerMask & ALL_CU_LAYERS) == 0 ) // pad is not on any copper layers { - switch( m_layerMask & ~ALL_CU_LAYERS ) + LAYER_NUM pad_layer = ExtractLayer( m_layerMask & ~ALL_CU_LAYERS ); + switch( pad_layer ) { - case ADHESIVE_LAYER_BACK: - layerInfo = board->GetLayerName( ADHESIVE_N_BACK ); + case UNSELECTED_LAYER: + layerInfo = _( "No layers" ); break; - case ADHESIVE_LAYER_FRONT: - layerInfo = board->GetLayerName( ADHESIVE_N_FRONT ); - break; - - case SOLDERPASTE_LAYER_BACK: - layerInfo = board->GetLayerName( SOLDERPASTE_N_BACK ); - break; - - case SOLDERPASTE_LAYER_FRONT: - layerInfo = board->GetLayerName( SOLDERPASTE_N_FRONT ); - break; - - case SILKSCREEN_LAYER_BACK: - layerInfo = board->GetLayerName( SILKSCREEN_N_BACK ); - break; - - case SILKSCREEN_LAYER_FRONT: - layerInfo = board->GetLayerName( SILKSCREEN_N_FRONT ); - break; - - case SOLDERMASK_LAYER_BACK: - layerInfo = board->GetLayerName( SOLDERMASK_N_BACK ); - break; - - case SOLDERMASK_LAYER_FRONT: - layerInfo = board->GetLayerName( SOLDERMASK_N_FRONT ); - break; - - case DRAW_LAYER: - layerInfo = board->GetLayerName( DRAW_N ); - break; - - case COMMENT_LAYER: - layerInfo = board->GetLayerName( COMMENT_N ); - break; - - case ECO1_LAYER: - layerInfo = board->GetLayerName( ECO1_N ); - break; - - case ECO2_LAYER: - layerInfo = board->GetLayerName( ECO2_N ); - break; - - case EDGE_LAYER: - layerInfo = board->GetLayerName( EDGE_N ); + case UNDEFINED_LAYER: + layerInfo = _( "Non-copper" ); break; default: - layerInfo = _( "Non-copper" ); + layerInfo = board->GetLayerName( pad_layer ); break; } } else { -#define INTERIOR_COPPER (ALL_CU_LAYERS & ~(LAYER_BACK | LAYER_FRONT)) - static const wxChar* andInternal = _( " & int" ); if( (m_layerMask & (LAYER_BACK | LAYER_FRONT)) == LAYER_BACK ) { layerInfo = board->GetLayerName( LAYER_N_BACK ); - if( m_layerMask & INTERIOR_COPPER ) + if( m_layerMask & INTERNAL_LAYERS ) layerInfo += andInternal; } @@ -620,7 +575,7 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList ) layerInfo = board->GetLayerName( LAYER_N_BACK ) + wxT(", ") + board->GetLayerName( LAYER_N_FRONT ); - if( m_layerMask & INTERIOR_COPPER ) + if( m_layerMask & INTERNAL_LAYERS ) layerInfo += andInternal; } @@ -628,10 +583,10 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList ) { layerInfo = board->GetLayerName( LAYER_N_FRONT ); - if( m_layerMask & INTERIOR_COPPER ) + if( m_layerMask & INTERNAL_LAYERS ) layerInfo += andInternal; } - else // necessarily true: if( m_layerMask & INTERIOR_COPPER ) + else // necessarily true: if( m_layerMask & INTERNAL_LAYERS ) { layerInfo = _( "internal" ); } diff --git a/pcbnew/class_pad_draw_functions.cpp b/pcbnew/class_pad_draw_functions.cpp index 23c1706f9b..c8fa9f75c7 100644 --- a/pcbnew/class_pad_draw_functions.cpp +++ b/pcbnew/class_pad_draw_functions.cpp @@ -100,16 +100,6 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode, * ECO, edge and Draw layers and not considered */ - // Mask layers for Back side of board - #define BACK_SIDE_LAYERS \ - (LAYER_BACK | ADHESIVE_LAYER_BACK | SOLDERPASTE_LAYER_BACK \ - | SILKSCREEN_LAYER_BACK | SOLDERMASK_LAYER_BACK) - - // Mask layers for Front side of board - #define FRONT_SIDE_LAYERS \ - (LAYER_FRONT | ADHESIVE_LAYER_FRONT | SOLDERPASTE_LAYER_FRONT \ - | SILKSCREEN_LAYER_FRONT | SOLDERMASK_LAYER_FRONT) - BOARD* brd = GetBoard(); bool frontVisible = brd->IsElementVisible( PCB_VISIBLE( PAD_FR_VISIBLE ) ); bool backVisible = brd->IsElementVisible( PCB_VISIBLE( PAD_BK_VISIBLE ) ); @@ -120,13 +110,13 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode, /* If pad are only on front side (no layer on back side) * and if hide front side pads is enabled, do not draw */ - if( !frontVisible && ( (m_layerMask & BACK_SIDE_LAYERS) == 0 ) ) + if( !frontVisible && ( (m_layerMask & BACK_LAYERS) == 0 ) ) return; /* If pad are only on back side (no layer on front side) * and if hide back side pads is enabled, do not draw */ - if( !backVisible && ( (m_layerMask & FRONT_SIDE_LAYERS) == 0 ) ) + if( !backVisible && ( (m_layerMask & FRONT_LAYERS) == 0 ) ) return; @@ -152,86 +142,29 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode, if( color == BLACK ) // Not on a visible copper layer (i.e. still nothing to show) { // If the pad is on only one tech layer, use the layer color else use DARKGRAY - int mask_non_copper_layers = m_layerMask & ~ALL_CU_LAYERS; + LAYER_MSK mask_non_copper_layers = m_layerMask & ~ALL_CU_LAYERS; #ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR mask_non_copper_layers &= brd->GetVisibleLayers(); #endif - switch( mask_non_copper_layers ) + LAYER_NUM pad_layer = ExtractLayer( mask_non_copper_layers ); + switch( pad_layer ) { - case 0: + case UNDEFINED_LAYER: // More than one layer + color = DARKGRAY; break; - case ADHESIVE_LAYER_BACK: - color = brd->GetLayerColor( ADHESIVE_N_BACK ); - break; - - case ADHESIVE_LAYER_FRONT: - color = brd->GetLayerColor( ADHESIVE_N_FRONT ); - break; - - case SOLDERPASTE_LAYER_BACK: - color = brd->GetLayerColor( SOLDERPASTE_N_BACK ); -#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR - showActualMaskSize = SOLDERPASTE_N_BACK; -#endif - break; - - case SOLDERPASTE_LAYER_FRONT: - color = brd->GetLayerColor( SOLDERPASTE_N_FRONT ); -#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR - showActualMaskSize = SOLDERPASTE_N_FRONT; -#endif - break; - - case SILKSCREEN_LAYER_BACK: - color = brd->GetLayerColor( SILKSCREEN_N_BACK ); - break; - - case SILKSCREEN_LAYER_FRONT: - color = brd->GetLayerColor( SILKSCREEN_N_FRONT ); - break; - - case SOLDERMASK_LAYER_BACK: - color = brd->GetLayerColor( SOLDERMASK_N_BACK ); -#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR - showActualMaskSize = SOLDERMASK_N_BACK; -#endif - break; - - case SOLDERMASK_LAYER_FRONT: - color = brd->GetLayerColor( SOLDERMASK_N_FRONT ); -#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR - showActualMaskSize = SOLDERMASK_N_FRONT; -#endif - break; - - case DRAW_LAYER: - color = brd->GetLayerColor( DRAW_N ); - break; - - case COMMENT_LAYER: - color = brd->GetLayerColor( COMMENT_N ); - break; - - case ECO1_LAYER: - color = brd->GetLayerColor( ECO1_N ); - break; - - case ECO2_LAYER: - color = brd->GetLayerColor( ECO2_N ); - break; - - case EDGE_LAYER: - color = brd->GetLayerColor( EDGE_N ); + case UNSELECTED_LAYER: // Shouldn't really happen... break; default: - color = DARKGRAY; - break; + color = brd->GetLayerColor( pad_layer ); +#ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR + showActualMaskSize = pad_layer; +#endif } } - // if PAD_SMD pad and high contrast mode + // if SMD or connector pad and high contrast mode if( ( aDraw_mode & GR_ALLOW_HIGHCONTRAST ) && ( GetAttribute() == PAD_SMD || GetAttribute() == PAD_CONN ) && DisplayOpt.ContrastModeDisplay ) @@ -286,6 +219,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode, break; default: + // Another layer which has no margin to handle break; } } diff --git a/pcbnew/class_pcb_text.cpp b/pcbnew/class_pcb_text.cpp index d535f4a414..5b53db3350 100644 --- a/pcbnew/class_pcb_text.cpp +++ b/pcbnew/class_pcb_text.cpp @@ -169,7 +169,7 @@ void TEXTE_PCB::Flip(const wxPoint& aCentre ) { m_Mirror = not m_Mirror; /* inverse mirror */ } - SetLayer( BOARD::ReturnFlippedLayerNumber( GetLayer() ) ); + SetLayer( FlipLayer( GetLayer() ) ); } diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index d8f0cabb72..326b78e06a 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -390,7 +390,7 @@ void TRACK::Flip( const wxPoint& aCentre ) } else { - SetLayer( BOARD::ReturnFlippedLayerNumber( GetLayer() ) ); + SetLayer( FlipLayer( GetLayer() ) ); } } diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index 7a0fc5816a..48aa55462e 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -826,7 +826,7 @@ void ZONE_CONTAINER::Rotate( const wxPoint& centre, double angle ) void ZONE_CONTAINER::Flip( const wxPoint& aCentre ) { Mirror( aCentre ); - SetLayer( BOARD::ReturnFlippedLayerNumber( GetLayer() ) ); + SetLayer( FlipLayer( GetLayer() ) ); } diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index b489b89a5b..27ca9bc5ae 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -294,7 +294,7 @@ void DIALOG_PAD_PROPERTIES::initValues() m_dummyPad->SetDelta( sz ); // flip pad's layers - m_dummyPad->SetLayerMask( ChangeSideMaskLayer( m_dummyPad->GetLayerMask() ) ); + m_dummyPad->SetLayerMask( FlipLayerMask( m_dummyPad->GetLayerMask() ) ); } m_staticTextWarningPadFlipped->Show(m_isFlipped); @@ -799,7 +799,7 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event ) } if( m_isFlipped ) - m_currentPad->SetLayerMask( ChangeSideMaskLayer( m_currentPad->GetLayerMask() ) ); + m_currentPad->SetLayerMask( FlipLayerMask( m_currentPad->GetLayerMask() ) ); m_currentPad->SetPadName( m_padMaster.GetPadName() ); diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp index 805bbe34af..4bafc1ef3c 100644 --- a/pcbnew/dialogs/dialog_plot.cpp +++ b/pcbnew/dialogs/dialog_plot.cpp @@ -238,7 +238,7 @@ void DIALOG_PLOT::OnPopUpLayers( wxCommandEvent& event ) switch( event.GetId() ) { - case ID_LAYER_FAB: // Select layers usually neede d to build a board + case ID_LAYER_FAB: // Select layers usually needed to build a board for( i = 0; i < m_layerList.size(); i++ ) { LAYER_MSK layermask = GetLayerMask( m_layerList[ i ] ); diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp index 8ebb0b684d..7adda1fda4 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp @@ -144,7 +144,7 @@ void PCB_ARC::Flip() m_startX = -m_startX; m_angle = -m_angle; - m_KiCadLayer = FlipLayers( m_KiCadLayer ); + m_KiCadLayer = FlipLayer( m_KiCadLayer ); } diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_component.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_component.cpp index 0bcb43984b..f551919ad8 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_component.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_component.cpp @@ -43,7 +43,7 @@ PCB_COMPONENT::PCB_COMPONENT( PCB_CALLBACKS* aCallbacks, m_tag = 0; m_objType = wxT( '?' ); m_PCadLayer = 0; - m_KiCadLayer = NO_LAYER; + m_KiCadLayer = LAYER_N_FRONT; // It *has* to be somewhere... m_timestamp = 0; m_positionX = 0; m_positionY = 0; @@ -77,39 +77,4 @@ void PCB_COMPONENT::Flip() m_positionX = -m_positionX; } -LAYER_NUM PCB_COMPONENT::FlipLayers( LAYER_NUM aLayer ) -{ - LAYER_NUM result = aLayer; // dafault is no swap - - // routed layers - if( aLayer == LAYER_N_BACK ) - result = LAYER_N_FRONT; - - if( aLayer == LAYER_N_FRONT ) - result = LAYER_N_BACK; - - // Silk - if( aLayer == SILKSCREEN_N_FRONT ) - result = SILKSCREEN_N_BACK; - - if( aLayer == SILKSCREEN_N_BACK ) - result = SILKSCREEN_N_FRONT; - - // Paste - if( aLayer == SOLDERPASTE_N_FRONT ) - result = SOLDERPASTE_N_BACK; - - if( aLayer == SOLDERPASTE_N_BACK ) - result = SOLDERPASTE_N_FRONT; - - // Mask - if( aLayer == SOLDERMASK_N_FRONT ) - result = SOLDERMASK_N_BACK; - - if( aLayer == SOLDERMASK_N_BACK ) - result = SOLDERMASK_N_FRONT; - - return result; -} - } // namespace PCAD2KICAD diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_component.h b/pcbnew/pcad2kicadpcb_plugin/pcb_component.h index 48700318d0..97c769f63e 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_component.h +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_component.h @@ -77,8 +77,6 @@ public: protected: PCB_CALLBACKS* m_callbacks; BOARD* m_board; - - LAYER_NUM FlipLayers( LAYER_NUM aLayer ); }; WX_DEFINE_ARRAY( PCB_COMPONENT*, PCB_COMPONENTS_ARRAY ); diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_line.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_line.cpp index 6a3170e415..280551795b 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_line.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_line.cpp @@ -110,7 +110,7 @@ void PCB_LINE::Flip() PCB_COMPONENT::Flip(); m_toX = -m_toX; - m_KiCadLayer = FlipLayers( m_KiCadLayer ); + m_KiCadLayer = FlipLayer( m_KiCadLayer ); } diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp index de0c5c41fb..daa698bdd2 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp @@ -606,7 +606,7 @@ void PCB_MODULE::Flip() if( m_mirror == 1 ) { // Flipped - m_KiCadLayer = FlipLayers( m_KiCadLayer ); + m_KiCadLayer = FlipLayer( m_KiCadLayer ); m_rotation = -m_rotation; m_name.textPositionX = -m_name.textPositionX; m_name.mirror = m_mirror; diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp index ea5a41f72b..53a27fce03 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp @@ -180,7 +180,7 @@ void PCB_PAD::Flip() m_rotation = -m_rotation; for( i = 0; i < (int)m_shapes.GetCount(); i++ ) - m_shapes[i]->m_KiCadLayer = FlipLayers( m_shapes[i]->m_KiCadLayer ); + m_shapes[i]->m_KiCadLayer = FlipLayer( m_shapes[i]->m_KiCadLayer ); } diff --git a/pcbnew/protos.h b/pcbnew/protos.h index a906b947df..7218e7508d 100644 --- a/pcbnew/protos.h +++ b/pcbnew/protos.h @@ -51,13 +51,6 @@ void DrawTraces( EDA_DRAW_PANEL* panel, /* MODULES.C */ /*************/ -/** - * Function ChangeSideMaskLayer - * calculates the mask layer when flipping a footprint. - * BACK and FRONT copper layers , mask, paste, solder layers are swapped. - */ -LAYER_MSK ChangeSideMaskLayer( LAYER_MSK aMask ); - void DrawModuleOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* module ); diff --git a/polygon/PolyLine.cpp b/polygon/PolyLine.cpp index 5ed3951842..52241b5543 100644 --- a/polygon/PolyLine.cpp +++ b/polygon/PolyLine.cpp @@ -21,7 +21,7 @@ CPolyLine::CPolyLine() { m_hatchStyle = NO_HATCH; m_hatchPitch = 0; - m_layer = NO_LAYER; + m_layer = LAYER_N_FRONT; m_utility = 0; } From 74a57d4ea8f72a9d54353060290b390d85347dfb Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Sat, 6 Apr 2013 07:01:48 +0200 Subject: [PATCH 47/63] Cleanup of the eeschema 'layers' i.e. entitity colours. This also fixes the spurious warning about stuff that couldn't be seen when changing colours. NOTE that the 'net name' layer is present and configurable but non used anywhere! --- common/sch_item_struct.cpp | 2 +- eeschema/dialogs/dialog_color_config.cpp | 7 ++++--- eeschema/eeschema.cpp | 2 +- eeschema/eeschema_config.cpp | 9 +++------ eeschema/general.h | 20 ++++++++++---------- eeschema/sch_component.cpp | 4 ++-- eeschema/sch_screen.cpp | 2 +- include/class_bitmap_base.h | 2 +- include/sch_item_struct.h | 7 ++++--- polygon/PolyLine.cpp | 8 ++++---- 10 files changed, 31 insertions(+), 32 deletions(-) diff --git a/common/sch_item_struct.cpp b/common/sch_item_struct.cpp index 65a2fba58b..a0be20a0db 100644 --- a/common/sch_item_struct.cpp +++ b/common/sch_item_struct.cpp @@ -58,7 +58,7 @@ bool sort_schematic_items( const SCH_ITEM* aItem1, const SCH_ITEM* aItem2 ) SCH_ITEM::SCH_ITEM( EDA_ITEM* aParent, KICAD_T aType ) : EDA_ITEM( aParent, aType ) { - m_Layer = 0; + m_Layer = LAYER_WIRE; // It's only a default, in fact } diff --git a/eeschema/dialogs/dialog_color_config.cpp b/eeschema/dialogs/dialog_color_config.cpp index e28842b048..baee49f6d3 100644 --- a/eeschema/dialogs/dialog_color_config.cpp +++ b/eeschema/dialogs/dialog_color_config.cpp @@ -67,7 +67,7 @@ static ButtonIndex buttonGroups[] = { }; -static EDA_COLOR_T currentColors[ MAX_LAYER ]; +static EDA_COLOR_T currentColors[ NB_SCH_LAYERS ]; IMPLEMENT_DYNAMIC_CLASS( DIALOG_COLOR_CONFIG, wxDialog ) @@ -167,7 +167,8 @@ void DIALOG_COLOR_CONFIG::CreateControls() wxBitmap bitmap( BUTT_SIZE_X, BUTT_SIZE_Y ); iconDC.SelectObject( bitmap ); - EDA_COLOR_T color = currentColors[ buttons->m_Layer ] = GetLayerColor( buttons->m_Layer ); + EDA_COLOR_T color = GetLayerColor( LayerNumber( buttons->m_Layer ) ); + currentColors[ buttons->m_Layer ] = color; iconDC.SetPen( *wxBLACK_PEN ); wxBrush brush; ColorSetBrush( &brush, color ); @@ -286,7 +287,7 @@ bool DIALOG_COLOR_CONFIG::UpdateColorsSettings() bool warning = false; - for( LAYER_NUM ii = FIRST_LAYER; ii < MAX_LAYERS; ++ii ) + for( LayerNumber ii = LAYER_WIRE; ii < NB_SCH_LAYERS; ++ii ) { SetLayerColor( currentColors[ ii ], ii ); diff --git a/eeschema/eeschema.cpp b/eeschema/eeschema.cpp index 464c0451d1..2512d3cbd1 100644 --- a/eeschema/eeschema.cpp +++ b/eeschema/eeschema.cpp @@ -118,7 +118,7 @@ bool EDA_APP::OnInit() // Give a default colour for all layers // (actual color will beinitialized by config) - for( int ii = 0; ii < MAX_LAYERS; ii++ ) + for( int ii = 0; ii < NB_SCH_LAYERS; ii++ ) SetLayerColor( DARKGRAY, ii ); // read current setup and reopen last directory if no filename to open in diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index 438d57c597..d6d9348073 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -53,7 +53,7 @@ #define FR_HISTORY_LIST_CNT 10 ///< Maximum number of find and replace strings. -static EDA_COLOR_T s_layerColor[MAX_LAYERS]; +static EDA_COLOR_T s_layerColor[NB_SCH_LAYERS]; // The width to draw busses that do not have a specific width static int s_defaultBusThickness; @@ -65,7 +65,7 @@ int GetDefaultBusThickness() void SetDefaultBusThickness( int aThickness) { - if( aThickness >=1 ) + if( aThickness >= 1 ) s_defaultBusThickness = aThickness; else s_defaultBusThickness = 1; @@ -90,7 +90,7 @@ void SetDefaultLineThickness( int aThickness) s_drawDefaultLineThickness = 1; } -EDA_COLOR_T GetLayerColor( int aLayer ) +EDA_COLOR_T GetLayerColor( LayerNumber aLayer ) { return s_layerColor[aLayer]; } @@ -478,9 +478,6 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetConfigurationSettings( void ) m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorGLabelEx" ), &s_layerColor[LAYER_GLOBLABEL], RED ) ); - m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPinFunEx" ), - &s_layerColor[LAYER_PINFUN], - MAGENTA ) ); m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorPinNumEx" ), &s_layerColor[LAYER_PINNUM], RED ) ); diff --git a/eeschema/general.h b/eeschema/general.h index ddf0d5373b..41f7f478cf 100644 --- a/eeschema/general.h +++ b/eeschema/general.h @@ -18,8 +18,8 @@ class TRANSFORM; #define SCHEMATIC_HEAD_STRING "Schematic File Version" -#define TXTMARGE 10 // Offset in mils for placement of labels and pin numbers. -#define DEFAULT_TEXT_SIZE 50 /* Default size for field texts */ +#define TXTMARGE 10 // Offset in mils for placement of labels and pin numbers +#define DEFAULT_TEXT_SIZE 50 // Default size for field texts #define GR_DEFAULT_DRAWMODE GR_COPY @@ -33,7 +33,6 @@ typedef enum { LAYER_LOCLABEL, LAYER_GLOBLABEL, LAYER_HIERLABEL, - LAYER_PINFUN, LAYER_PINNUM, LAYER_PINNAM, LAYER_REFERENCEPART, @@ -52,12 +51,15 @@ typedef enum { LAYER_ERC_ERR, LAYER_DEVICE_BACKGROUND, LAYER_GRID, - LAYER_ITEM_SELECTED, - LAYER_INVISIBLE_ITEM, - - MAX_LAYER // end of list + NB_SCH_LAYERS } LayerNumber; +inline LayerNumber operator++( LayerNumber& a ) +{ + a = LayerNumber( int( a ) + 1 ); + return a; +} + /* Rotation, mirror of graphic items in components bodies are handled by a * transform matrix. The default matrix is useful to draw lib entries with @@ -67,8 +69,6 @@ typedef enum { */ extern TRANSFORM DefaultTransform; -#define MAX_LAYERS (int) MAX_LAYER - extern wxSize g_RepeatStep; extern int g_RepeatDeltaLabel; @@ -90,7 +90,7 @@ void SetDefaultLineThickness( int aThickness); int GetDefaultBusThickness(); void SetDefaultBusThickness( int aThickness ); -EDA_COLOR_T GetLayerColor( int aLayer ); +EDA_COLOR_T GetLayerColor( LayerNumber aLayer ); // Color to draw selected items EDA_COLOR_T GetItemSelectedColor(); diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp index c6efcda0dd..b04de25fab 100644 --- a/eeschema/sch_component.cpp +++ b/eeschema/sch_component.cpp @@ -218,9 +218,9 @@ void SCH_COMPONENT::Init( const wxPoint& pos ) { SCH_FIELD field( pos, i, this, TEMPLATE_FIELDNAME::GetDefaultFieldName( i ) ); - if( i==REFERENCE ) + if( i == REFERENCE ) field.SetLayer( LAYER_REFERENCEPART ); - else if( i==VALUE ) + else if( i == VALUE ) field.SetLayer( LAYER_VALUEPART ); // else keep LAYER_FIELDS from SCH_FIELD constructor diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index 2617401a5d..304e5dadef 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -508,7 +508,7 @@ bool SCH_SCREEN::Save( FILE* aFile ) const } // This section is not used, but written for file compatibility - if( fprintf( aFile, "EELAYER %d %d\n", MAX_LAYERS, 0 ) < 0 + if( fprintf( aFile, "EELAYER %d %d\n", NB_SCH_LAYERS, 0 ) < 0 || fprintf( aFile, "EELAYER END\n" ) < 0 ) return false; diff --git a/include/class_bitmap_base.h b/include/class_bitmap_base.h index 1ba129ca8e..a735c2772b 100644 --- a/include/class_bitmap_base.h +++ b/include/class_bitmap_base.h @@ -31,7 +31,7 @@ #define _BITMAP_BASE_H_ -#include +#include /** * This class handle bitmap images in KiCad. diff --git a/include/sch_item_struct.h b/include/sch_item_struct.h index 5ac910dab2..11b7d4866c 100644 --- a/include/sch_item_struct.h +++ b/include/sch_item_struct.h @@ -32,6 +32,7 @@ #include #include +#include using namespace std; @@ -117,7 +118,7 @@ public: class SCH_ITEM : public EDA_ITEM { protected: - int m_Layer; + LayerNumber m_Layer; EDA_ITEMS m_connections; ///< List of items connected to this item. public: @@ -147,14 +148,14 @@ public: * Function GetLayer * returns the layer this item is on. */ - int GetLayer() const { return m_Layer; } + LayerNumber GetLayer() const { return m_Layer; } /** * Function SetLayer * sets the layer this item is on. * @param aLayer The layer number. */ - void SetLayer( int aLayer ) { m_Layer = aLayer; } + void SetLayer( LayerNumber aLayer ) { m_Layer = aLayer; } /** * Function GetPenSize virtual pure diff --git a/polygon/PolyLine.cpp b/polygon/PolyLine.cpp index 52241b5543..12b7b0f318 100644 --- a/polygon/PolyLine.cpp +++ b/polygon/PolyLine.cpp @@ -19,10 +19,10 @@ CPolyLine::CPolyLine() { - m_hatchStyle = NO_HATCH; - m_hatchPitch = 0; - m_layer = LAYER_N_FRONT; - m_utility = 0; + m_hatchStyle = NO_HATCH; + m_hatchPitch = 0; + m_layer = LAYER_N_FRONT; + m_utility = 0; } From ca4a3651c09da7de9c4bdf5a8c2c6a8f627aa125 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 6 Apr 2013 14:01:53 +0200 Subject: [PATCH 48/63] Gerbview, layer manager: add option (popup menu) to always keep layers not visible but the active layer, even when the active layer is changed. Pcbnew: fix swig warning for operator EDA_COLOR_T::++ (changed to function EDA_COLOR_T:: NextColor) --- common/common_plotDXF_functions.cpp | 2 +- common/confirm.cpp | 4 +- common/gr_basic.cpp | 28 ++++++------- gerbview/class_gerbview_layer_widget.cpp | 53 ++++++++++++++++++------ gerbview/class_gerbview_layer_widget.h | 21 ++++++++-- gerbview/events_called_functions.cpp | 5 ++- gerbview/toolbars_gerber.cpp | 11 ++--- include/colors.h | 13 +++--- include/sch_item_struct.h | 2 +- pcbnew/class_pcb_layer_widget.cpp | 22 ++++++---- pcbnew/class_pcb_layer_widget.h | 10 ++++- 11 files changed, 115 insertions(+), 56 deletions(-) diff --git a/common/common_plotDXF_functions.cpp b/common/common_plotDXF_functions.cpp index 7958292074..2b878b3295 100644 --- a/common/common_plotDXF_functions.cpp +++ b/common/common_plotDXF_functions.cpp @@ -203,7 +203,7 @@ bool DXF_PLOTTER::StartPlot() { "YELLOW4", 2 } }; - for( EDA_COLOR_T i = BLACK; i < NBCOLORS; ++i ) + for( EDA_COLOR_T i = BLACK; i < NBCOLORS; i = NextColor(i) ) { fprintf( outputFile, " 0\n" diff --git a/common/confirm.cpp b/common/confirm.cpp index 32eb3f4afe..2a76b4e6ba 100644 --- a/common/confirm.cpp +++ b/common/confirm.cpp @@ -1,6 +1,6 @@ -/* +/** * @file confirm.cpp - * utilities to display some error, warning and info short messges + * @brief utilities to display some error, warning and info short messges */ #include diff --git a/common/gr_basic.cpp b/common/gr_basic.cpp index eb38f55cd7..9ed374f4be 100644 --- a/common/gr_basic.cpp +++ b/common/gr_basic.cpp @@ -1456,7 +1456,7 @@ void GRBezier( EDA_RECT* ClipBox, EDA_COLOR_T ColorMix( EDA_COLOR_T aColor1, EDA_COLOR_T aColor2 ) { /* Memoization storage. This could be potentially called for each - * color merge so a cache is useful (there are few colours anyway) */ + * color merge so a cache is useful (there are few colours anyway) */ static EDA_COLOR_T mix_cache[NBCOLORS][NBCOLORS]; // TODO how is alpha used? it's a mac only thing, I have no idea @@ -1469,7 +1469,7 @@ EDA_COLOR_T ColorMix( EDA_COLOR_T aColor1, EDA_COLOR_T aColor2 ) if( aColor2 == BLACK) return aColor1; - /* Now we are sure that black can't occur, so the rule is: + /* Now we are sure that black can't occur, so the rule is: * BLACK means not computed yet. If we're lucky we already have * an answer */ EDA_COLOR_T candidate = mix_cache[aColor1][aColor2]; @@ -1477,11 +1477,11 @@ EDA_COLOR_T ColorMix( EDA_COLOR_T aColor1, EDA_COLOR_T aColor2 ) return candidate; // Blend the two colors (i.e. OR the RGB values) - const StructColors &c1 = g_ColorRefs[aColor1]; - const StructColors &c2 = g_ColorRefs[aColor2]; + const StructColors &c1 = g_ColorRefs[aColor1]; + const StructColors &c2 = g_ColorRefs[aColor2]; // Ask the palette for the nearest color to the mix - wxColour mixed( c1.m_Red | c2.m_Red, + wxColour mixed( c1.m_Red | c2.m_Red, c1.m_Green | c2.m_Green, c1.m_Blue | c2.m_Blue ); candidate = ColorFindNearest( mixed ); @@ -1489,7 +1489,7 @@ EDA_COLOR_T ColorMix( EDA_COLOR_T aColor1, EDA_COLOR_T aColor2 ) /* Here, BLACK is *not* a good answer, since it would recompute the next time. * Even theorically its not possible (with the current rules), but * maybe the metric will change in the future */ - if( candidate == BLACK) + if( candidate == BLACK) candidate = DARKDARKGRAY; // Store the result in the cache. The operation is commutative, too @@ -1502,12 +1502,12 @@ EDA_COLOR_T ColorMix( EDA_COLOR_T aColor1, EDA_COLOR_T aColor2 ) EDA_COLOR_T ColorByName( const wxChar *aName ) { // look for a match in the palette itself - for( EDA_COLOR_T trying = BLACK; trying < NBCOLORS; ++trying ) + for( EDA_COLOR_T trying = BLACK; trying < NBCOLORS; trying = NextColor(trying) ) { if( 0 == wxStricmp( aName, g_ColorRefs[trying].m_Name ) ) return trying; } - + // Not found, no idea... return UNSPECIFIED_COLOR; } @@ -1525,23 +1525,23 @@ EDA_COLOR_T ColorFindNearest( const wxColour &aColor ) /* Find the 'nearest' color in the palette. This is fun. There is a gazilion of metrics for the color space and no one of the useful one is in the RGB color space. Who cares, this is a CAD, - not a photosomething... - + not a photosomething... + I hereby declare that the distance is the sum of the square of the component difference. Think about the RGB color cube. Now get the - euclidean distance, but without the square root... for ordering + euclidean distance, but without the square root... for ordering purposes it's the same, obviously. Also each component can't be less of the target one, since I found this currently work better... */ int nearest_distance = 255 * 255 * 3 + 1; // Can't beat this - for( EDA_COLOR_T trying = BLACK; trying < NBCOLORS; ++trying ) + for( EDA_COLOR_T trying = BLACK; trying < NBCOLORS; trying = NextColor(trying) ) { - const StructColors &c = g_ColorRefs[trying]; + const StructColors &c = g_ColorRefs[trying]; int distance = (r - c.m_Red) * (r - c.m_Red) + (g - c.m_Green) * (g - c.m_Green) + (b - c.m_Blue) * (b - c.m_Blue); - if( distance < nearest_distance && c.m_Red >= r && + if( distance < nearest_distance && c.m_Red >= r && c.m_Green >= g && c.m_Blue >= b ) { nearest_distance = distance; diff --git a/gerbview/class_gerbview_layer_widget.cpp b/gerbview/class_gerbview_layer_widget.cpp index bb6a3a57df..911f2594f3 100644 --- a/gerbview/class_gerbview_layer_widget.cpp +++ b/gerbview/class_gerbview_layer_widget.cpp @@ -55,6 +55,8 @@ GERBER_LAYER_WIDGET::GERBER_LAYER_WIDGET( GERBVIEW_FRAME* aParent, wxWindow* aFo LAYER_WIDGET( aParent, aFocusOwner, aPointSize ), myframe( aParent ) { + m_alwaysShowActiveLayer = false; + ReFillRender(); // Update default tabs labels for GerbView @@ -67,7 +69,8 @@ GERBER_LAYER_WIDGET::GERBER_LAYER_WIDGET( GERBVIEW_FRAME* aParent, wxWindow* aFo // since Popupmenu() calls this->ProcessEvent() we must call this->Connect() // and not m_LayerScrolledWindow->Connect() - Connect( ID_SHOW_ALL_COPPERS, ID_SHOW_NO_COPPERS_BUT_ACTIVE, wxEVT_COMMAND_MENU_SELECTED, + Connect( ID_SHOW_ALL_LAYERS, ID_ALWAYS_SHOW_NO_LAYERS_BUT_ACTIVE, + wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( GERBER_LAYER_WIDGET::onPopupSelection ), NULL, this ); // install the right click handler into each control at end of ReFill() @@ -144,13 +147,16 @@ void GERBER_LAYER_WIDGET::onRightDownLayers( wxMouseEvent& event ) // menu text is capitalized: // http://library.gnome.org/devel/hig-book/2.20/design-text-labels.html.en#layout-capitalization - menu.Append( new wxMenuItem( &menu, ID_SHOW_ALL_COPPERS, + menu.Append( new wxMenuItem( &menu, ID_SHOW_ALL_LAYERS, _("Show All Layers") ) ); - menu.Append( new wxMenuItem( &menu, ID_SHOW_NO_COPPERS_BUT_ACTIVE, + menu.Append( new wxMenuItem( &menu, ID_SHOW_NO_LAYERS_BUT_ACTIVE, _( "Hide All Layers But Active" ) ) ); - menu.Append( new wxMenuItem( &menu, ID_SHOW_NO_COPPERS, + menu.Append( new wxMenuItem( &menu, ID_ALWAYS_SHOW_NO_LAYERS_BUT_ACTIVE, + _( "Always Hide All Layers But Active" ) ) ); + + menu.Append( new wxMenuItem( &menu, ID_SHOW_NO_LAYERS, _( "Hide All Layers" ) ) ); PopupMenu( &menu ); @@ -162,24 +168,32 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) { int rowCount; int menuId = event.GetId(); - bool visible = (menuId == ID_SHOW_ALL_COPPERS) ? true : false;; + bool visible = (menuId == ID_SHOW_ALL_LAYERS) ? true : false;; LAYER_MSK visibleLayers = NO_LAYERS; + bool force_active_layer_visible; + + m_alwaysShowActiveLayer = ( menuId == ID_ALWAYS_SHOW_NO_LAYERS_BUT_ACTIVE ); + force_active_layer_visible = ( menuId == ID_SHOW_NO_LAYERS_BUT_ACTIVE || + menuId == ID_ALWAYS_SHOW_NO_LAYERS_BUT_ACTIVE ); switch( menuId ) { - case ID_SHOW_ALL_COPPERS: - case ID_SHOW_NO_COPPERS: - case ID_SHOW_NO_COPPERS_BUT_ACTIVE: + case ID_SHOW_ALL_LAYERS: + case ID_SHOW_NO_LAYERS: + case ID_ALWAYS_SHOW_NO_LAYERS_BUT_ACTIVE: + case ID_SHOW_NO_LAYERS_BUT_ACTIVE: rowCount = GetLayerRowCount(); for( int row=0; row < rowCount; ++row ) { + wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 ); + LAYER_NUM layer = getDecodedId( cb->GetId() ); bool loc_visible = visible; - if( (menuId == ID_SHOW_NO_COPPERS_BUT_ACTIVE ) && - (row == m_CurrentRow ) ) + + if( force_active_layer_visible && (layer == myframe->getActiveLayer() ) ) loc_visible = true; - wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 ); cb->SetValue( loc_visible ); + if( loc_visible ) visibleLayers |= GetLayerMask( row ); else @@ -192,6 +206,18 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) } } +bool GERBER_LAYER_WIDGET::OnLayerSelected() +{ + if( !m_alwaysShowActiveLayer ) + return false; + + // postprocess after an active layer selection + // ensure active layer visible + wxCommandEvent event; + event.SetId( ID_ALWAYS_SHOW_NO_LAYERS_BUT_ACTIVE ); + onPopupSelection( event ); + return true; +} void GERBER_LAYER_WIDGET::ReFill() @@ -227,7 +253,10 @@ bool GERBER_LAYER_WIDGET::OnLayerSelect( LAYER_NUM aLayer ) myframe->syncLayerBox(); if( layer != myframe->getActiveLayer( ) ) - myframe->GetCanvas()->Refresh(); + { + if( ! OnLayerSelected() ) + myframe->GetCanvas()->Refresh(); + } return true; } diff --git a/gerbview/class_gerbview_layer_widget.h b/gerbview/class_gerbview_layer_widget.h index cd974e08ea..b92a301d9f 100644 --- a/gerbview/class_gerbview_layer_widget.h +++ b/gerbview/class_gerbview_layer_widget.h @@ -42,11 +42,14 @@ class GERBER_LAYER_WIDGET : public LAYER_WIDGET { GERBVIEW_FRAME* myframe; + bool m_alwaysShowActiveLayer; // If true: Only shows the current active layer + // even if it is changed // popup menu ids. -#define ID_SHOW_ALL_COPPERS wxID_HIGHEST -#define ID_SHOW_NO_COPPERS (wxID_HIGHEST+1) -#define ID_SHOW_NO_COPPERS_BUT_ACTIVE (wxID_HIGHEST+2) +#define ID_SHOW_ALL_LAYERS wxID_HIGHEST +#define ID_SHOW_NO_LAYERS (wxID_HIGHEST+1) +#define ID_SHOW_NO_LAYERS_BUT_ACTIVE (wxID_HIGHEST+2) +#define ID_ALWAYS_SHOW_NO_LAYERS_BUT_ACTIVE (wxID_HIGHEST+3) /** * Function OnRightDownLayers @@ -101,6 +104,18 @@ public: void SetLayersManagerTabsText( ); //--------------- + /** + * Function OnLayerSelected + * ensure the active layer is visible, and other layers not visible + * when m_alwaysShowActiveLayer is true + * Otherwise do nothing. + * @return true m_alwaysShowActiveLayer is true and the canvas is refreshed, + * and false if do nothing + */ + bool OnLayerSelected(); // postprocess after an active layer selection + // ensure active layer visible if + // m_alwaysShowActiveCopperLayer is true; + /** * Function UpdateLayerIcons * Update the layer manager icons (layers only) diff --git a/gerbview/events_called_functions.cpp b/gerbview/events_called_functions.cpp index 28df5efb48..828021cb2d 100644 --- a/gerbview/events_called_functions.cpp +++ b/gerbview/events_called_functions.cpp @@ -240,7 +240,10 @@ void GERBVIEW_FRAME::OnSelectActiveLayer( wxCommandEvent& event ) setActiveLayer( event.GetSelection() ); if( layer != getActiveLayer() ) - m_canvas->Refresh(); + { + if( m_LayersManager->OnLayerSelected() ) + m_canvas->Refresh(); + } } diff --git a/gerbview/toolbars_gerber.cpp b/gerbview/toolbars_gerber.cpp index 2247e83f51..bc878db1d4 100644 --- a/gerbview/toolbars_gerber.cpp +++ b/gerbview/toolbars_gerber.cpp @@ -1,9 +1,9 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 2011 Wayne Stambaugh - * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2013 Wayne Stambaugh + * Copyright (C) 1992-2013 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 @@ -87,8 +87,9 @@ void GERBVIEW_FRAME::ReCreateHToolbar( void ) m_mainToolBar->AddSeparator(); - m_SelLayerBox = new GBR_LAYER_BOX_SELECTOR( m_mainToolBar, ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER, - wxDefaultPosition, wxSize( 150, -1 ), 0,NULL); + m_SelLayerBox = new GBR_LAYER_BOX_SELECTOR( m_mainToolBar, + ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER, + wxDefaultPosition, wxSize( 150, -1 ), 0,NULL); m_SelLayerBox->Resync(); m_mainToolBar->AddControl( m_SelLayerBox ); diff --git a/include/colors.h b/include/colors.h index 123544d071..eff6e49a55 100644 --- a/include/colors.h +++ b/include/colors.h @@ -37,12 +37,12 @@ enum EDA_COLOR_T LIGHTRED, LIGHTMAGENTA, YELLOW, - PUREBLUE, - PUREGREEN, - PURECYAN, - PURERED, + PUREBLUE, + PUREGREEN, + PURECYAN, + PURERED, PUREMAGENTA, - PUREYELLOW, + PUREYELLOW, NBCOLORS, ///< Number of colors HIGHLIGHT_FLAG = ( 1<<19 ), MASKCOLOR = 31 ///< mask for color index into g_ColorRefs[] @@ -55,7 +55,7 @@ inline EDA_COLOR_T ColorFromInt( int aColor ) return static_cast( aColor ); } -inline EDA_COLOR_T operator++( EDA_COLOR_T& aColor ) +inline EDA_COLOR_T NextColor( EDA_COLOR_T& aColor ) { // We have to accept NBCOLORS for loop termination conditions wxASSERT( aColor >= UNSPECIFIED_COLOR && aColor <= NBCOLORS ); @@ -63,7 +63,6 @@ inline EDA_COLOR_T operator++( EDA_COLOR_T& aColor ) return aColor; } - /// Return only the plain color part inline EDA_COLOR_T ColorGetBase( EDA_COLOR_T aColor) { diff --git a/include/sch_item_struct.h b/include/sch_item_struct.h index 11b7d4866c..82e2e50eed 100644 --- a/include/sch_item_struct.h +++ b/include/sch_item_struct.h @@ -32,7 +32,7 @@ #include #include -#include +#include using namespace std; diff --git a/pcbnew/class_pcb_layer_widget.cpp b/pcbnew/class_pcb_layer_widget.cpp index 87e6364358..ef2199251a 100644 --- a/pcbnew/class_pcb_layer_widget.cpp +++ b/pcbnew/class_pcb_layer_widget.cpp @@ -91,7 +91,8 @@ PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_EDIT_FRAME* aParent, wxWindow* aFocusOwn // since Popupmenu() calls this->ProcessEvent() we must call this->Connect() // and not m_LayerScrolledWindow->Connect() - Connect( ID_SHOW_ALL_COPPERS, ID_ALWAYS_SHOW_NO_COPPERS_BUT_ACTIVE, wxEVT_COMMAND_MENU_SELECTED, + Connect( ID_SHOW_ALL_COPPERS, ID_ALWAYS_SHOW_NO_COPPERS_BUT_ACTIVE, + wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( PCB_LAYER_WIDGET::onPopupSelection ), NULL, this ); // install the right click handler into each control at end of ReFill() @@ -102,9 +103,9 @@ PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_EDIT_FRAME* aParent, wxWindow* aFocusOwn void PCB_LAYER_WIDGET::installRightLayerClickHandler() { int rowCount = GetLayerRowCount(); - for( int row=0; row---------- - void OnLayerSelected(); // postprocess after an active layer selection + /** + * Function OnLayerSelected + * ensure the active layer is visible, and other layers not visible + * when m_alwaysShowActiveLayer is true + * Otherwise do nothing. + * @return true m_alwaysShowActiveLayer is true and the canvas is refreshed, + * and false if do nothing + */ + bool OnLayerSelected(); // postprocess after an active layer selection // ensure active layer visible if // m_alwaysShowActiveCopperLayer is true; From 150cfebb5956b8b6265635e5824c6c4a7a494971 Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Sat, 6 Apr 2013 14:28:02 +0200 Subject: [PATCH 49/63] Fixed some tab-induced disalignments Charras beat me on fixing the include/sch_item_struct.h include issue from 4069 --- 3d-viewer/3d_draw.cpp | 7 +++--- 3d-viewer/3d_draw_basic_functions.cpp | 2 +- common/projet_config.cpp | 4 ++-- eeschema/bus-wire-junction.cpp | 2 +- eeschema/hierarch.cpp | 2 +- eeschema/load_one_schematic_file.cpp | 2 +- eeschema/netlist.h | 2 +- eeschema/sch_bus_entry.cpp | 4 ++-- eeschema/sch_screen.cpp | 8 +++---- pcbnew/autorouter/graphpcb.cpp | 6 ++--- pcbnew/class_track.cpp | 2 +- pcbnew/print_board_functions.cpp | 2 +- pcbnew/scripting/units.i | 32 +++++++++++++-------------- pcbnew/sel_layer.cpp | 2 +- pcbnew/tracepcb.cpp | 2 +- 15 files changed, 39 insertions(+), 40 deletions(-) diff --git a/3d-viewer/3d_draw.cpp b/3d-viewer/3d_draw.cpp index 56c17fac04..9162f36706 100644 --- a/3d-viewer/3d_draw.cpp +++ b/3d-viewer/3d_draw.cpp @@ -552,7 +552,7 @@ void EDA_3D_CANVAS::Draw3D_DrawSegment( DRAWSEGMENT* segment ) break; case S_CIRCLE: - { + { int radius = KiROUND( hypot( double(segment->GetStart().x - segment->GetEnd().x), double(segment->GetStart().y - segment->GetEnd().y) ) ); @@ -998,12 +998,11 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas ) polyPadShape.insert( polyPadShape.end(), holecornersBuffer.begin(), holecornersBuffer.end() ); } - break; case PAD_RECT: case PAD_TRAPEZOID: - { + { wxPoint coord[5]; BuildPadPolygon( coord, wxSize(0,0), m_Orient ); for( int ii = 0; ii < 4; ii ++ ) @@ -1018,7 +1017,7 @@ void D_PAD::Draw3D( EDA_3D_CANVAS* glcanvas ) polyPadShape.insert( polyPadShape.end(), holecornersBuffer.begin(), holecornersBuffer.end() ); } - break; + break; default: break; diff --git a/3d-viewer/3d_draw_basic_functions.cpp b/3d-viewer/3d_draw_basic_functions.cpp index e8cd9a2b61..854866213f 100644 --- a/3d-viewer/3d_draw_basic_functions.cpp +++ b/3d-viewer/3d_draw_basic_functions.cpp @@ -124,7 +124,7 @@ static void Draw3D_VerticalPolygonalCylinder( const std::vector& aPolys void SetGLColor( EDA_COLOR_T color ) { - double red, green, blue; + double red, green, blue; const StructColors &colordata = g_ColorRefs[ColorGetBase( color )]; red = colordata.m_Red / 255.0; diff --git a/common/projet_config.cpp b/common/projet_config.cpp index 2a488b8aa0..901eb2b1fd 100644 --- a/common/projet_config.cpp +++ b/common/projet_config.cpp @@ -358,8 +358,8 @@ PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( const wxChar* ident, EDA_COLOR_T* ptpara PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( bool Insetup, const wxChar* ident, - EDA_COLOR_T* ptparam, - EDA_COLOR_T default_val, + EDA_COLOR_T* ptparam, + EDA_COLOR_T default_val, const wxChar* group ) : PARAM_CFG_BASE( ident, PARAM_SETCOLOR, group ) { diff --git a/eeschema/bus-wire-junction.cpp b/eeschema/bus-wire-junction.cpp index a2440f0800..3419efcd9e 100644 --- a/eeschema/bus-wire-junction.cpp +++ b/eeschema/bus-wire-junction.cpp @@ -345,7 +345,7 @@ void SCH_EDIT_FRAME::DeleteCurrentSegment( wxDC* DC ) if( ( screen->GetCurItem() == NULL ) || !screen->GetCurItem()->IsNew() ) return; - DrawSegment( m_canvas, DC, wxDefaultPosition, false ); + DrawSegment( m_canvas, DC, wxDefaultPosition, false ); screen->Remove( screen->GetCurItem() ); m_canvas->SetMouseCaptureCallback( NULL ); diff --git a/eeschema/hierarch.cpp b/eeschema/hierarch.cpp index 64cac94fb1..07c9b5aa8b 100644 --- a/eeschema/hierarch.cpp +++ b/eeschema/hierarch.cpp @@ -101,7 +101,7 @@ class HIERARCHY_NAVIG_DLG : public wxDialog { public: SCH_EDIT_FRAME* m_Parent; - HIERARCHY_TREE* m_Tree; + HIERARCHY_TREE* m_Tree; int m_nbsheets; wxDC* m_DC; diff --git a/eeschema/load_one_schematic_file.cpp b/eeschema/load_one_schematic_file.cpp index 7d7a9be5ad..6d0d5528c0 100644 --- a/eeschema/load_one_schematic_file.cpp +++ b/eeschema/load_one_schematic_file.cpp @@ -227,7 +227,7 @@ again." ); { // Load it if it wasn't by a factory if( !itemLoaded ) - itemLoaded = item->Load( reader, msgDiag ); + itemLoaded = item->Load( reader, msgDiag ); if( !itemLoaded ) { diff --git a/eeschema/netlist.h b/eeschema/netlist.h index e1c6ea3f10..55189e5df4 100644 --- a/eeschema/netlist.h +++ b/eeschema/netlist.h @@ -45,7 +45,7 @@ class SCH_REFERENC_LIST; #define NETLIST_HEAD_STRING "EESchema Netlist Version 1.1" -// Max pin number per component and footprint +// Max pin number per component and footprint #define MAXPIN 5000 diff --git a/eeschema/sch_bus_entry.cpp b/eeschema/sch_bus_entry.cpp index 22b9cbde18..dfd9e54900 100644 --- a/eeschema/sch_bus_entry.cpp +++ b/eeschema/sch_bus_entry.cpp @@ -62,7 +62,7 @@ SCH_BUS_WIRE_ENTRY::SCH_BUS_WIRE_ENTRY( const wxPoint& pos, char shape ) : SCH_BUS_BUS_ENTRY::SCH_BUS_BUS_ENTRY( const wxPoint& pos, char shape ) : SCH_BUS_ENTRY_BASE( SCH_BUS_BUS_ENTRY_T, pos, shape ) { - m_Layer = LAYER_BUS; + m_Layer = LAYER_BUS; } EDA_ITEM* SCH_BUS_WIRE_ENTRY::Clone() const @@ -255,7 +255,7 @@ void SCH_BUS_ENTRY_BASE::GetConnectionPoints( vector< wxPoint >& aPoints ) const wxString SCH_BUS_WIRE_ENTRY::GetSelectMenuText() const { - return wxString( _( "Bus to Wire Entry" ) ); + return wxString( _( "Bus to Wire Entry" ) ); } diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp index 304e5dadef..258c3f3385 100644 --- a/eeschema/sch_screen.cpp +++ b/eeschema/sch_screen.cpp @@ -965,10 +965,10 @@ bool SCH_SCREEN::BreakSegmentsOnJunctions() { SCH_BUS_ENTRY_BASE* busEntry = dynamic_cast( item ); if( busEntry ) - { - if( BreakSegment( busEntry->GetPosition() ) - || BreakSegment( busEntry->m_End() ) ) - brokenSegments = true; + { + if( BreakSegment( busEntry->GetPosition() ) + || BreakSegment( busEntry->m_End() ) ) + brokenSegments = true; } } } diff --git a/pcbnew/autorouter/graphpcb.cpp b/pcbnew/autorouter/graphpcb.cpp index d7182012d5..ad2f5496e6 100644 --- a/pcbnew/autorouter/graphpcb.cpp +++ b/pcbnew/autorouter/graphpcb.cpp @@ -71,14 +71,14 @@ static void TraceCircle( int ux0, int uy0, int ux1, int uy1, int lg, LAYER_NUM l if( layer == UNDEFINED_LAYER ) \ { \ RoutingMatrix.WriteCell( dy, dx, BOTTOM, color ); \ - if( RoutingMatrix.m_RoutingLayersCount > 1 ) \ - RoutingMatrix.WriteCell( dy, dx, TOP, color ); \ + if( RoutingMatrix.m_RoutingLayersCount > 1 ) \ + RoutingMatrix.WriteCell( dy, dx, TOP, color ); \ } \ else \ { \ if( layer == g_Route_Layer_BOTTOM ) \ RoutingMatrix.WriteCell( dy, dx, BOTTOM, color ); \ - if( RoutingMatrix.m_RoutingLayersCount > 1 ) \ + if( RoutingMatrix.m_RoutingLayersCount > 1 ) \ if( layer == g_Route_Layer_TOP ) \ RoutingMatrix.WriteCell( dy, dx, TOP, color ); \ } \ diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index 326b78e06a..80e54e873c 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -1206,7 +1206,7 @@ TRACK* TRACK::GetVia( const wxPoint& aPosition, LAYER_NUM aLayer) if( track->GetState( BUSY | IS_DELETED ) ) continue; - if( aLayer == UNDEFINED_LAYER ) + if( aLayer == UNDEFINED_LAYER ) break; if( track->IsOnLayer( aLayer ) ) diff --git a/pcbnew/print_board_functions.cpp b/pcbnew/print_board_functions.cpp index 9fb8bdb7f1..c00a59f4a9 100644 --- a/pcbnew/print_board_functions.cpp +++ b/pcbnew/print_board_functions.cpp @@ -280,7 +280,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC, ZONE_CONTAINER* zone = Pcb->GetArea( ii ); if( aPrintMaskLayer & GetLayerMask( zone->GetLayer() ) ) - zone->DrawFilledArea( m_canvas, aDC, drawmode ); + zone->DrawFilledArea( m_canvas, aDC, drawmode ); } // Draw footprints, this is done at last in order to print the pad holes in diff --git a/pcbnew/scripting/units.i b/pcbnew/scripting/units.i index 83764b3d0e..e76276b2cd 100644 --- a/pcbnew/scripting/units.i +++ b/pcbnew/scripting/units.i @@ -46,34 +46,34 @@ def ToMils(iu): if type(iu) in [int,float]: - return float(iu) / float(IU_PER_MILS) + return float(iu) / float(IU_PER_MILS) elif type(iu) in [wxPoint,wxSize]: - return tuple(map(ToMils,iu)) - + return tuple(map(ToMils,iu)) + def FromMils(mils): if type(mils) in [int,float]: return int(float(mils)*float(IU_PER_MILS)) elif type(mils) in [wxPoint,wxSize]: - return tuple(map(FromMils,mils)) - + return tuple(map(FromMils,mils)) + def wxSizeMM(mmx,mmy): return wxSize(FromMM(mmx),FromMM(mmy)) def wxSizeMils(mmx,mmy): return wxSize(FromMils(mmx),FromMils(mmy)) - + def wxPointMM(mmx,mmy): return wxPoint(FromMM(mmx),FromMM(mmy)) def wxPointMils(mmx,mmy): return wxPoint(FromMils(mmx),FromMils(mmy)) def wxRectMM(x,y,wx,wy): - x = int(FromMM(x)) - y = int(FromMM(y)) - wx = int(FromMM(wx)) - wy = int (FromMM(wy)) - return wxRect(x,y,wx,wy) + x = int(FromMM(x)) + y = int(FromMM(y)) + wx = int(FromMM(wx)) + wy = int (FromMM(wy)) + return wxRect(x,y,wx,wy) def wxRectMils(x,y,wx,wy): - x = int(FromMils(x)) - y = int(FromMils(y)) - wx = int(FromMils(wx)) - wy = int (FromMils(wy)) - return wxRect(x,y,wx,wy) + x = int(FromMils(x)) + y = int(FromMils(y)) + wx = int(FromMils(wx)) + wy = int (FromMils(wy)) + return wxRect(x,y,wx,wy) } diff --git a/pcbnew/sel_layer.cpp b/pcbnew/sel_layer.cpp index 0985c06a41..9b4b512266 100644 --- a/pcbnew/sel_layer.cpp +++ b/pcbnew/sel_layer.cpp @@ -68,7 +68,7 @@ END_EVENT_TABLE() LAYER_NUM PCB_BASE_FRAME::SelectLayer( LAYER_NUM default_layer, LAYER_NUM min_layer, LAYER_NUM max_layer, - bool null_layer ) + bool null_layer ) { SELECT_LAYER_DIALOG* frame = new SELECT_LAYER_DIALOG( this, default_layer, diff --git a/pcbnew/tracepcb.cpp b/pcbnew/tracepcb.cpp index 3df519dfea..82ad49f011 100644 --- a/pcbnew/tracepcb.cpp +++ b/pcbnew/tracepcb.cpp @@ -198,7 +198,7 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC, GR_DRAWMODE aDrawMode, const for( MODULE* module = m_Modules; module; module = module->Next() ) { - bool display = true; + bool display = true; LAYER_MSK layerMask = ALL_CU_LAYERS; if( module->IsMoving() ) From 9ebb4afaccf6bf930de702c8e55f874022820021 Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Sat, 6 Apr 2013 18:46:03 +0200 Subject: [PATCH 50/63] Removed arbitrary MAX_LAYER_ROWS limit (only used in one assertion, anyway) --- 3d-viewer/3d_draw.cpp | 4 ++-- pcbnew/layer_widget.cpp | 10 +++++----- pcbnew/layer_widget.h | 12 ++++++++---- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/3d-viewer/3d_draw.cpp b/3d-viewer/3d_draw.cpp index 9162f36706..c88a3a15cb 100644 --- a/3d-viewer/3d_draw.cpp +++ b/3d-viewer/3d_draw.cpp @@ -1084,8 +1084,8 @@ bool Is3DLayerEnabled( LAYER_NUM aLayer ) break; default: - // the layer was not a layer with a flag, so show it - return true; + // the layer was not a layer with a flag, so show it + return true; } // if the layer has a flag, return the flag diff --git a/pcbnew/layer_widget.cpp b/pcbnew/layer_widget.cpp index 3d028f2ead..3ead91151e 100644 --- a/pcbnew/layer_widget.cpp +++ b/pcbnew/layer_widget.cpp @@ -174,7 +174,7 @@ int LAYER_WIDGET::encodeId( int aColumn, int aId ) } -int LAYER_WIDGET::getDecodedId( int aControlId ) +LAYER_NUM LAYER_WIDGET::getDecodedId( int aControlId ) { int id = aControlId / LYR_COLUMN_COUNT; // rounding is OK. return id; @@ -319,7 +319,7 @@ void LAYER_WIDGET::OnMiddleDownRenderColor( wxMouseEvent& event ) wxBitmap bm = makeBitmap( newColor ); eventSource->SetBitmapLabel( bm ); - int id = getDecodedId( eventSource->GetId() ); + LAYER_NUM id = getDecodedId( eventSource->GetId() ); // tell the client code. OnRenderColorChange( id, newColor ); @@ -331,7 +331,7 @@ void LAYER_WIDGET::OnMiddleDownRenderColor( wxMouseEvent& event ) void LAYER_WIDGET::OnRenderCheckBox( wxCommandEvent& event ) { wxCheckBox* eventSource = (wxCheckBox*) event.GetEventObject(); - int id = getDecodedId( eventSource->GetId() ); + LAYER_NUM id = getDecodedId( eventSource->GetId() ); OnRenderEnable( id, eventSource->IsChecked() ); passOnFocus(); } @@ -398,7 +398,7 @@ int LAYER_WIDGET::findRenderRow( int aId ) const void LAYER_WIDGET::insertLayerRow( int aRow, const ROW& aSpec ) { - wxASSERT( aRow >= 0 && aRow < MAX_LAYER_ROWS ); + wxASSERT( aRow >= 0 ); int col; int index = aRow * LYR_COLUMN_COUNT; @@ -440,7 +440,7 @@ void LAYER_WIDGET::insertLayerRow( int aRow, const ROW& aSpec ) void LAYER_WIDGET::insertRenderRow( int aRow, const ROW& aSpec ) { - wxASSERT( aRow >= 0 && aRow < MAX_LAYER_ROWS ); + wxASSERT( aRow >= 0 ); int col; int index = aRow * RND_COLUMN_COUNT; diff --git a/pcbnew/layer_widget.h b/pcbnew/layer_widget.h index a74a9e186b..151a1c4127 100644 --- a/pcbnew/layer_widget.h +++ b/pcbnew/layer_widget.h @@ -62,6 +62,10 @@ *

void OnLayerVisible( int aLayer, bool isVisible ); *

void OnRenderColorChange( int id, int aColor ); *

void OnRenderEnable( int id, bool isEnabled ); + * + * Please note that even if designed toward layers, it is used to + * contain other stuff, too (the second page in pcbnew contains render + * items, for example) */ class LAYER_WIDGET : public wxPanel { @@ -133,9 +137,11 @@ protected: /** * Function getDecodedId - * decodes \a aControlId to original un-encoded value. + * decodes \a aControlId to original un-encoded value. This of + * course holds iff encodedId was called with a LAYER_NUM (this box + * is used for other things than layers, too) */ - static int getDecodedId( int aControlId ); + static LAYER_NUM getDecodedId( int aControlId ); /** * Function makeColorButton @@ -243,8 +249,6 @@ public: */ void AppendLayerRow( const ROW& aRow ); -#define MAX_LAYER_ROWS 64 ///< cannot append more than this number of rows - /** * Function AppendLayerRows * appends new rows in the layer portion of the widget. The user must From 204d085b64f852a9e28051eeebaf531ecedee195 Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Sun, 7 Apr 2013 13:55:18 +0200 Subject: [PATCH 51/63] More cleanup on layer code usage Better description for entities on right click menu and panel Typo fixes and some comment reformats --- bitmap2component/bitmap2component.cpp | 1 + common/block_commande.cpp | 2 +- common/drawtxt.cpp | 39 +++++---- common/pcbcommon.cpp | 44 ++++++++++- eeschema/lib_pin.cpp | 4 +- eeschema/sch_marker.cpp | 2 +- eeschema/sch_text.cpp | 2 +- gerbview/export_to_pcbnew.cpp | 2 +- include/layers_id_colors_and_visibility.h | 32 +++++--- include/pcbcommon.h | 2 + pcbnew/class_board.cpp | 80 +++++++++---------- pcbnew/class_dimension.cpp | 3 +- pcbnew/class_drawsegment.cpp | 4 +- pcbnew/class_edge_mod.cpp | 9 ++- pcbnew/class_mire.cpp | 4 +- pcbnew/class_module.cpp | 66 ++++------------ pcbnew/class_pad.cpp | 92 +++++----------------- pcbnew/class_pcb_layer_widget.cpp | 4 - pcbnew/class_pcb_text.cpp | 14 +--- pcbnew/class_text_mod.cpp | 89 +++++---------------- pcbnew/class_text_mod.h | 34 ++++---- pcbnew/class_track.cpp | 53 +++++++------ pcbnew/class_zone.cpp | 21 ++--- pcbnew/cross-probing.cpp | 6 +- pcbnew/dialogs/dialog_edit_module_text.cpp | 17 ++-- pcbnew/dialogs/dialog_layers_setup.cpp | 13 ++- pcbnew/dialogs/dialog_plot.cpp | 6 +- pcbnew/edgemod.cpp | 8 +- pcbnew/editedge.cpp | 2 +- pcbnew/editmod.cpp | 12 +-- pcbnew/edtxtmod.cpp | 2 +- pcbnew/gen_modules_placefile.cpp | 4 +- pcbnew/kicad_plugin.cpp | 6 +- pcbnew/legacy_plugin.cpp | 26 +++--- pcbnew/modedit.cpp | 4 +- pcbnew/modedit_onclick.cpp | 2 +- pcbnew/onrightclick.cpp | 2 +- pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp | 4 +- pcbnew/pcb_parser.cpp | 19 ++--- pcbnew/sel_layer.cpp | 2 +- 40 files changed, 319 insertions(+), 419 deletions(-) diff --git a/bitmap2component/bitmap2component.cpp b/bitmap2component/bitmap2component.cpp index bbb64cd5a8..e2c2bacbbc 100644 --- a/bitmap2component/bitmap2component.cpp +++ b/bitmap2component/bitmap2component.cpp @@ -26,6 +26,7 @@ // For some unknown reasons, polygon.hpp shoul be included first #include +#include #include #include #include diff --git a/common/block_commande.cpp b/common/block_commande.cpp index 59a6beca79..cc0ae64629 100644 --- a/common/block_commande.cpp +++ b/common/block_commande.cpp @@ -108,7 +108,7 @@ void BLOCK_SELECTOR::SetMessageBlock( EDA_DRAW_FRAME* frame ) break; default: - msg = wxT( "????" ); + msg = wxT( "???" ); break; } diff --git a/common/drawtxt.cpp b/common/drawtxt.cpp index c8724bbe3a..05aa82c172 100644 --- a/common/drawtxt.cpp +++ b/common/drawtxt.cpp @@ -51,7 +51,7 @@ * parameter */ #define HERSHEY_SCALE_FACTOR 1 / 21.0 -double s_HerscheyScaleFactor = HERSHEY_SCALE_FACTOR; +double s_HersheyScaleFactor = HERSHEY_SCALE_FACTOR; /* Helper function for texts with over bar @@ -186,7 +186,7 @@ int ReturnGraphicTextWidth( const wxString& aText, int aXSize, bool aItalic, boo // Get metrics int xsta = *shape_ptr++ - 'R'; int xsto = *shape_ptr++ - 'R'; - tally += KiROUND( aXSize * (xsto - xsta) * s_HerscheyScaleFactor ); + tally += KiROUND( aXSize * (xsto - xsta) * s_HersheyScaleFactor ); } // For italic correction, add 1/8 size @@ -429,10 +429,8 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, overbar_italic_comp = 0; } - ; - - int overbars = 0; /* Number of '~' seen (except '~~') */ - ptr = 0; /* ptr = text index */ + int overbars = 0; // Number of '~' seen (except '~~') + ptr = 0; // ptr = text index while( ptr < char_count ) { @@ -444,7 +442,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, else { - /* Found an overbar, adjust the pointers */ + // Found an overbar, adjust the pointers overbars++; if( overbars & 1 ) // odd overbars count @@ -469,7 +467,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, sketch_mode, 2, coord, aCallback, aPlotter ); } - continue; /* Skip ~ processing */ + continue; // Skip ~ processing } } @@ -494,9 +492,9 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, else { // End of character, insert a synthetic pen up: - hc1 = ' '; - hc2 = 'R'; - endcar = true; + hc1 = ' '; + hc2 = 'R'; + endcar = true; } // Do the Hershey decode thing: @@ -504,7 +502,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, hc1 -= 'R'; hc2 -= 'R'; - /* Pen up request */ + // Pen up request if( hc1 == -50 && hc2 == 0 ) { if( point_count ) @@ -523,8 +521,8 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, { wxPoint currpoint; hc1 -= xsta; hc2 -= 11; // Align the midpoint - hc1 = KiROUND( hc1 * size_h * s_HerscheyScaleFactor ); - hc2 = KiROUND( hc2 * size_v * s_HerscheyScaleFactor ); + hc1 = KiROUND( hc1 * size_h * s_HersheyScaleFactor ); + hc2 = KiROUND( hc2 * size_v * s_HersheyScaleFactor ); // To simulate an italic font, // add a x offset depending on the y offset @@ -545,18 +543,19 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, ptr++; // Apply the advance width - current_char_pos.x += KiROUND( size_h * (xsto - xsta) * s_HerscheyScaleFactor ); + current_char_pos.x += KiROUND( size_h * (xsto - xsta) * s_HersheyScaleFactor ); } if( overbars % 2 ) { - /* Close the last overbar */ - coord[0] = overbar_pos; - overbar_pos = current_char_pos; - overbar_pos.y -= OverbarPositionY( size_v, aWidth ); + // Close the last overbar + coord[0] = overbar_pos; + overbar_pos = current_char_pos; + overbar_pos.y -= OverbarPositionY( size_v, aWidth ); RotatePoint( &overbar_pos, aPos, aOrient ); coord[1] = overbar_pos; - /* Plot the overbar segment */ + + // Plot the overbar segment DrawGraphicTextPline( clipBox, aDC, aColor, aWidth, sketch_mode, 2, coord, aCallback, aPlotter ); } diff --git a/common/pcbcommon.cpp b/common/pcbcommon.cpp index 8dfbd03e08..9ec0201914 100644 --- a/common/pcbcommon.cpp +++ b/common/pcbcommon.cpp @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -52,7 +53,7 @@ LAYER_MSK g_TabAllCopperLayerMask[NB_COPPER_LAYERS] = { }; -DISPLAY_OPTIONS DisplayOpt; /* Display options for board items */ +DISPLAY_OPTIONS DisplayOpt; // Display options for board items int g_RotationAngle; @@ -184,3 +185,44 @@ LAYER_NUM ExtractLayer( LAYER_MSK aMask ) } return candidate; } + +wxString LayerMaskDescribe( const BOARD *aBoard, LAYER_MSK aMask ) +{ + // Try the single or no- layer case (easy) + LAYER_NUM layer = ExtractLayer( aMask ); + switch( layer ) + { + case UNSELECTED_LAYER: + return _( "No layers" ); + + case UNDEFINED_LAYER: + break; + + default: + return aBoard->GetLayerName( layer ); + } + + // Try to be smart and useful, starting with outer copper + // (which are more important than internal ones) + wxString layerInfo; + if( aMask & LAYER_FRONT ) + AccumulateDescription( layerInfo, aBoard->GetLayerName( LAYER_N_FRONT ) ); + + if( aMask & LAYER_BACK ) + AccumulateDescription( layerInfo, aBoard->GetLayerName( LAYER_N_BACK ) ); + + if( aMask & INTERNAL_CU_LAYERS ) + AccumulateDescription( layerInfo, _("Internal" ) ); + + if( aMask & ALL_NO_CU_LAYERS ) + AccumulateDescription( layerInfo, _("Non-copper" ) ); + + return layerInfo; +} + +void AccumulateDescription( wxString &aDesc, const wxString &aItem ) +{ + if( !aDesc.IsEmpty() ) + aDesc << wxT(", "); + aDesc << aItem; +} diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index 0861f79762..e5fc24163a 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -179,7 +179,7 @@ const wxChar* MsgPinElectricType[] = wxT( "openCol" ), wxT( "openEm" ), wxT( "NotConnected" ), - wxT( "?????" ) + wxT( "???" ) }; @@ -1852,7 +1852,7 @@ void LIB_PIN::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) aList.push_back( MSG_PANEL_ITEM( _( "Visible" ), Text, DARKGREEN ) ); - /* Display pin length */ + // Display pin length Text = ReturnStringFromValue( g_UserUnit, m_length, true ); aList.push_back( MSG_PANEL_ITEM( _( "Length" ), Text, MAGENTA ) ); diff --git a/eeschema/sch_marker.cpp b/eeschema/sch_marker.cpp index 99af636539..8663cc2aca 100644 --- a/eeschema/sch_marker.cpp +++ b/eeschema/sch_marker.cpp @@ -49,7 +49,7 @@ const wxChar* NameMarqueurType[] = wxT( "ERC" ), wxT( "PCB" ), wxT( "SIMUL" ), - wxT( "?????" ) + wxT( "???" ) }; diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index 9be8696555..9802fcd708 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -57,7 +57,7 @@ const char* SheetLabelType[] = "BiDi", "3State", "UnSpc", - "?????" + "???" }; /* Coding polygons for global symbol graphic shapes. diff --git a/gerbview/export_to_pcbnew.cpp b/gerbview/export_to_pcbnew.cpp index c7c2c6d018..24dda6bbbb 100644 --- a/gerbview/export_to_pcbnew.cpp +++ b/gerbview/export_to_pcbnew.cpp @@ -395,7 +395,7 @@ void GBR_TO_PCB_EXPORTER::writePcbHeader() // Write copper layer count fprintf( m_fp, "LayerCount %d\n", m_pcbCopperLayersCount ); // Write enabled layer mask: - int lmask = ALL_NO_CU_LAYERS | EXTERNAL_LAYERS; + int lmask = ALL_NO_CU_LAYERS | EXTERNAL_CU_LAYERS; for( int ii = 0; ii < m_pcbCopperLayersCount - 2; ii++ ) lmask |= 2 << ii; diff --git a/include/layers_id_colors_and_visibility.h b/include/layers_id_colors_and_visibility.h index a9dd03f915..aabb15af40 100644 --- a/include/layers_id_colors_and_visibility.h +++ b/include/layers_id_colors_and_visibility.h @@ -30,6 +30,8 @@ #ifndef _LAYERS_ID_AND_VISIBILITY_H_ #define _LAYERS_ID_AND_VISIBILITY_H_ +class BOARD; + /* NOTE: the idea here is to have LAYER_NUM and LAYER_MSK as abstract * type as possible (even if they're currently implemented as int and * unsigned int, respectively). In this way it would be reasonably easy @@ -117,19 +119,24 @@ typedef unsigned LAYER_MSK; #define EDGE_LAYER (1 << EDGE_N) // extra bits 0xE0000000 -/* Helpful global layers mask : */ + +// Helpful global layer masks: +// ALL_AUX_LAYERS layers are technical layers, ALL_NO_CU_LAYERS has user +// and edge layers too! #define ALL_LAYERS 0x1FFFFFFF // Pcbnew used 29 layers #define FULL_LAYERS 0xFFFFFFFF // Gerbview used 32 layers #define ALL_NO_CU_LAYERS 0x1FFF0000 #define ALL_CU_LAYERS 0x0000FFFF -#define INTERNAL_LAYERS 0x00007FFE -#define EXTERNAL_LAYERS 0x00008001 -#define BACK_LAYERS (LAYER_BACK | ADHESIVE_LAYER_BACK | \ - SOLDERPASTE_LAYER_BACK | SILKSCREEN_LAYER_BACK | \ - SOLDERMASK_LAYER_BACK) -#define FRONT_LAYERS (LAYER_FRONT | ADHESIVE_LAYER_FRONT | \ - SOLDERPASTE_LAYER_FRONT | SILKSCREEN_LAYER_FRONT | \ - SOLDERMASK_LAYER_FRONT) +#define INTERNAL_CU_LAYERS 0x00007FFE +#define EXTERNAL_CU_LAYERS 0x00008001 +#define FRONT_AUX_LAYERS (SILKSCREEN_LAYER_FRONT | SOLDERMASK_LAYER_FRONT \ + | ADHESIVE_LAYER_FRONT | SOLDERPASTE_LAYER_FRONT) +#define BACK_AUX_LAYERS (SILKSCREEN_LAYER_BACK | SOLDERMASK_LAYER_BACK \ + | ADHESIVE_LAYER_BACK | SOLDERPASTE_LAYER_BACK) +#define ALL_AUX_LAYERS (FRONT_AUX_LAYERS | BACK_AUX_LAYERS) +#define BACK_LAYERS (LAYER_BACK | BACK_AUX_LAYERS) +#define FRONT_LAYERS (LAYER_FRONT | FRONT_AUX_LAYERS) + #define NO_LAYERS 0x00000000 /** return a one bit layer mask from a layer number @@ -297,4 +304,11 @@ LAYER_MSK FlipLayerMask( LAYER_MSK aMask ); */ LAYER_NUM ExtractLayer( LAYER_MSK aMask ); +/** + * Return a string (to be shown to the user) describing a layer mask. + * Useful for showing where is a pad, track, entity, etc. + * The BOARD is needed because layer names are (somewhat) customizable + */ +wxString LayerMaskDescribe( const BOARD *aBoard, LAYER_MSK aMask ); + #endif // _LAYERS_ID_AND_VISIBILITY_H_ diff --git a/include/pcbcommon.h b/include/pcbcommon.h index 8f4af14fc0..6aec7cf240 100644 --- a/include/pcbcommon.h +++ b/include/pcbcommon.h @@ -34,5 +34,7 @@ extern DLIST g_CurrentTrackList; #define g_FirstTrackSegment g_CurrentTrackList.GetFirst() ///< first segment created +/// Utility for comma separated lists +void AccumulateDescription( wxString &aDesc, const wxString &aItem ); #endif // PCBCOMMON_H_ diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index a71bbef987..18f84dacfd 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -697,12 +697,18 @@ EDA_COLOR_T BOARD::GetLayerColor( LAYER_NUM aLayer ) const bool BOARD::IsModuleLayerVisible( LAYER_NUM layer ) { - if( layer==LAYER_N_FRONT ) + switch( layer ) + { + case LAYER_N_FRONT: return IsElementVisible( PCB_VISIBLE(MOD_FR_VISIBLE) ); - else if( layer==LAYER_N_BACK ) + + case LAYER_N_BACK: return IsElementVisible( PCB_VISIBLE(MOD_BK_VISIBLE) ); - else + + default: + wxFAIL_MSG( wxT( "BOARD::IsModuleLayerVisible() param error: bad layer" ) ); return true; + } } @@ -2023,10 +2029,10 @@ MODULE* BOARD::GetFootprint( const wxPoint& aPosition, LAYER_NUM aActiveLayer, { MODULE* pt_module; MODULE* module = NULL; - MODULE* Altmodule = NULL; + MODULE* alt_module = NULL; int min_dim = 0x7FFFFFFF; int alt_min_dim = 0x7FFFFFFF; - LAYER_NUM layer; + bool current_layer_back = IsBackLayer( aActiveLayer ); for( pt_module = m_Modules; pt_module; pt_module = (MODULE*) pt_module->Next() ) { @@ -2038,46 +2044,36 @@ MODULE* BOARD::GetFootprint( const wxPoint& aPosition, LAYER_NUM aActiveLayer, if( aIgnoreLocked && pt_module->IsLocked() ) continue; - /* Calculate priority: the priority is given to the layer of the - * module and the copper layer if the module layer is indelible, - * adhesive copper, a layer if cmp module layer is indelible, - * adhesive component. - */ - layer = pt_module->GetLayer(); + LAYER_NUM layer = pt_module->GetLayer(); - if( layer==ADHESIVE_N_BACK || layer==SILKSCREEN_N_BACK ) - layer = LAYER_N_BACK; - else if( layer==ADHESIVE_N_FRONT || layer==SILKSCREEN_N_FRONT ) - layer = LAYER_N_FRONT; - - /* Test of minimum size to choosing the best candidate. */ - - EDA_RECT bb = pt_module->GetFootPrintRect(); - int offx = bb.GetX() + bb.GetWidth() / 2; - int offy = bb.GetY() + bb.GetHeight() / 2; - - //off x & offy point to the middle of the box. - int dist = abs( aPosition.x - offx ) + abs( aPosition.y - offy ); - - //int dist = std::min(lx, ly); // to pick the smallest module (kinda - // screwy with same-sized modules -- this is bad!) - - if( aActiveLayer == layer ) + // Filter non visible modules if requested + if( (!aVisibleOnly) || IsModuleLayerVisible( layer ) ) { - if( dist <= min_dim ) + EDA_RECT bb = pt_module->GetFootPrintRect(); + int offx = bb.GetX() + bb.GetWidth() / 2; + int offy = bb.GetY() + bb.GetHeight() / 2; + + // off x & offy point to the middle of the box. + int dist = ( aPosition.x - offx ) * ( aPosition.x - offx ) + + ( aPosition.y - offy ) * ( aPosition.y - offy ); + + if( current_layer_back == IsBackLayer( layer ) ) { - /* better footprint shown on the active layer */ - module = pt_module; - min_dim = dist; + if( dist <= min_dim ) + { + // better footprint shown on the active side + module = pt_module; + min_dim = dist; + } } - } - else if( aVisibleOnly && IsModuleLayerVisible( layer ) ) - { - if( dist <= alt_min_dim ) + else if( aVisibleOnly && IsModuleLayerVisible( layer ) ) { - /* better footprint shown on other layers */ - Altmodule = pt_module; - alt_min_dim = dist; + if( dist <= alt_min_dim ) + { + // better footprint shown on the other side + alt_module = pt_module; + alt_min_dim = dist; + } } } } @@ -2087,9 +2083,9 @@ MODULE* BOARD::GetFootprint( const wxPoint& aPosition, LAYER_NUM aActiveLayer, return module; } - if( Altmodule ) + if( alt_module) { - return Altmodule; + return alt_module; } return NULL; diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp index c1f54724c4..64d0f08518 100644 --- a/pcbnew/class_dimension.cpp +++ b/pcbnew/class_dimension.cpp @@ -490,7 +490,8 @@ wxString DIMENSION::GetSelectMenuText() const { wxString text; - text << _( "Dimension" ) << wxT( " \"" ) << GetText() << wxT( "\"" ); + text << _( "Dimension" ) << wxT( " \"" ) << GetText() << wxT( "\" on " ) + << GetLayerName(); return text; } diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp index 8926769111..eafeda0688 100644 --- a/pcbnew/class_drawsegment.cpp +++ b/pcbnew/class_drawsegment.cpp @@ -356,7 +356,7 @@ void DRAWSEGMENT::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) end << GetEnd(); aList.push_back( MSG_PANEL_ITEM( start, end, DARKGREEN ) ); - aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), board->GetLayerName( m_Layer ), DARKBROWN ) ); + aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), DARKBROWN ) ); msg = ::CoordinateToString( m_Width ); aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, DARKCYAN ) ); } @@ -534,7 +534,7 @@ wxString DRAWSEGMENT::GetSelectMenuText() const wxString text; wxString temp = ::LengthDoubleToString( GetLength() ); - text.Printf( _( "Pcb Graphic: %s length: %s on %s" ), + text.Printf( _( "Pcb Graphic: %s, length %s on %s" ), GetChars( ShowShape( (STROKE_T) m_Shape ) ), GetChars( temp ), GetChars( GetLayerName() ) ); diff --git a/pcbnew/class_edge_mod.cpp b/pcbnew/class_edge_mod.cpp index 5ea8860864..80a2c9a548 100644 --- a/pcbnew/class_edge_mod.cpp +++ b/pcbnew/class_edge_mod.cpp @@ -250,9 +250,10 @@ void EDGE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) aList.push_back( MSG_PANEL_ITEM( _( "Value" ), module->GetValue(), BLUE ) ); msg.Printf( wxT( "%8.8lX" ), module->GetTimeStamp() ); aList.push_back( MSG_PANEL_ITEM( _( "TimeStamp" ), msg, BROWN ) ); - aList.push_back( MSG_PANEL_ITEM( _( "Mod Layer" ), board->GetLayerName( module->GetLayer() ), - RED ) ); - aList.push_back( MSG_PANEL_ITEM( _( "Seg Layer" ), board->GetLayerName( GetLayer() ), RED ) ); + aList.push_back( MSG_PANEL_ITEM( _( "Mod Layer" ), + module->GetLayerName(), RED ) ); + aList.push_back( MSG_PANEL_ITEM( _( "Seg Layer" ), + GetLayerName(), RED ) ); msg = ::CoordinateToString( m_Width ); aList.push_back( MSG_PANEL_ITEM( _( "Width" ), msg, BLUE ) ); } @@ -264,7 +265,7 @@ wxString EDGE_MODULE::GetSelectMenuText() const wxString text; text << _( "Graphic" ) << wxT( " " ) << ShowShape( (STROKE_T) m_Shape ); - text << wxT( " (" ) << GetLayerName() << wxT( ")" ); + text << wxT( " on " ) << GetLayerName(); text << _( " of " ) << ( (MODULE*) GetParent() )->GetReference(); return text; diff --git a/pcbnew/class_mire.cpp b/pcbnew/class_mire.cpp index e1a2df6a78..29c548ee43 100644 --- a/pcbnew/class_mire.cpp +++ b/pcbnew/class_mire.cpp @@ -217,8 +217,8 @@ wxString PCB_TARGET::GetSelectMenuText() const msg = ::CoordinateToString( m_Size ); - text.Printf( _( "Target on %s size %s" ), - GetChars( GetLayerName() ), GetChars( msg ) ); + // Targets are on *every* layer by definition + text.Printf( _( "Target size %s" ), GetChars( msg ) ); return text; } diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index 2c06379a03..5a4bf89a33 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -72,9 +72,9 @@ MODULE::MODULE( BOARD* parent ) : m_ThermalWidth = 0; // Use zone setting by default m_ThermalGap = 0; // Use zone setting by default - m_Reference = new TEXTE_MODULE( this, TEXT_is_REFERENCE ); + m_Reference = new TEXTE_MODULE( this, TEXTE_MODULE::TEXT_is_REFERENCE ); - m_Value = new TEXTE_MODULE( this, TEXT_is_VALUE ); + m_Value = new TEXTE_MODULE( this, TEXTE_MODULE::TEXT_is_VALUE ); // Reserve one void 3D entry, to avoid problems with void list m_3D_Drawings.PushBack( new S3D_MASTER( this ) ); @@ -440,7 +440,6 @@ void MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) int nbpad; char bufcar[512], Line[512]; wxString msg; - BOARD* board = GetBoard(); aList.push_back( MSG_PANEL_ITEM( m_Reference->GetText(), m_Value->GetText(), DARKCYAN ) ); @@ -458,7 +457,7 @@ void MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) // display time stamp in schematic msg.Printf( wxT( "%8.8lX" ), m_TimeStamp ); aList.push_back( MSG_PANEL_ITEM( _( "Netlist path" ), m_Path, BROWN ) ); - aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), board->GetLayerName( m_Layer ), RED ) ); + aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), RED ) ); EDA_ITEM* PtStruct = m_Pads; nbpad = 0; @@ -485,7 +484,7 @@ void MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) msg.Printf( wxT( "%.1f" ), (float) m_Orient / 10 ); aList.push_back( MSG_PANEL_ITEM( _( "Orient" ), msg, BROWN ) ); - /* Controls on right side of the dialog */ + // Controls on right side of the dialog switch( m_Attributs & 255 ) { case 0: @@ -575,7 +574,7 @@ D_PAD* MODULE::FindPadByName( const wxString& aPadName ) const D_PAD* MODULE::GetPad( const wxPoint& aPosition, LAYER_MSK aLayerMask ) { - for( D_PAD* pad = m_Pads; pad; pad = pad->Next() ) + for( D_PAD* pad = m_Pads; pad; pad = pad->Next() ) { // ... and on the correct layer. if( ( pad->GetLayerMask() & aLayerMask ) == 0 ) @@ -684,7 +683,7 @@ wxString MODULE::GetSelectMenuText() const wxString text; text << _( "Footprint" ) << wxT( " " ) << GetReference(); - text << wxT( " (" ) << GetLayerName() << wxT( ")" ); + text << wxT( " on " ) << GetLayerName(); return text; } @@ -765,28 +764,18 @@ void MODULE::Flip( const wxPoint& aCentre ) NORMALIZE_ANGLE_POS( m_Orient ); // Mirror pads to other side of board about the x axis, i.e. vertically. - for( D_PAD* pad = m_Pads; pad; pad = pad->Next() ) + for( D_PAD* pad = m_Pads; pad; pad = pad->Next() ) pad->Flip( m_Pos.y ); // Mirror reference. text = m_Reference; text->m_Pos.y -= m_Pos.y; - text->m_Pos.y = -text->m_Pos.y; + NEGATE( text->m_Pos.y ); text->m_Pos.y += m_Pos.y; NEGATE(text->m_Pos0.y); - text->m_Mirror = false; NEGATE_AND_NORMALIZE_ANGLE_POS( text->m_Orient ); - text->SetLayer( GetLayer() ); text->SetLayer( FlipLayer( text->GetLayer() ) ); - - if( GetLayer() == LAYER_N_BACK ) - text->SetLayer( SILKSCREEN_N_BACK ); - - if( GetLayer() == LAYER_N_FRONT ) - text->SetLayer( SILKSCREEN_N_FRONT ); - - if( IsBackLayer( GetLayer() ) ) - text->m_Mirror = true; + text->m_Mirror = IsBackLayer( GetLayer() ); // Mirror value. text = m_Value; @@ -794,28 +783,18 @@ void MODULE::Flip( const wxPoint& aCentre ) NEGATE( text->m_Pos.y ); text->m_Pos.y += m_Pos.y; NEGATE( text->m_Pos0.y ); - text->m_Mirror = false; NEGATE_AND_NORMALIZE_ANGLE_POS( text->m_Orient ); - text->SetLayer( GetLayer() ); text->SetLayer( FlipLayer( text->GetLayer() ) ); - - if( GetLayer() == LAYER_N_BACK ) - text->SetLayer( SILKSCREEN_N_BACK ); - - if( GetLayer() == LAYER_N_FRONT ) - text->SetLayer( SILKSCREEN_N_FRONT ); - - if( IsBackLayer( GetLayer() ) ) - text->m_Mirror = true; + text->m_Mirror = IsBackLayer( GetLayer() ); // Reverse mirror module graphics and texts. - for( EDA_ITEM* item = m_Drawings; item; item = item->Next() ) + for( EDA_ITEM* item = m_Drawings; item; item = item->Next() ) { switch( item->Type() ) { case PCB_MODULE_EDGE_T: { - EDGE_MODULE* em = (EDGE_MODULE*) item; + EDGE_MODULE* em = (EDGE_MODULE*) item; wxPoint s = em->GetStart(); s.y -= m_Pos.y; @@ -842,27 +821,14 @@ void MODULE::Flip( const wxPoint& aCentre ) break; case PCB_MODULE_TEXT_T: - // Reverse mirror position and mirror. text = (TEXTE_MODULE*) item; text->m_Pos.y -= m_Pos.y; - text->m_Pos.y = -text->m_Pos.y; + NEGATE( text->m_Pos0.y ); text->m_Pos.y += m_Pos.y; NEGATE( text->m_Pos0.y ); - text->m_Mirror = false; NEGATE_AND_NORMALIZE_ANGLE_POS( text->m_Orient ); - - text->SetLayer( GetLayer() ); text->SetLayer( FlipLayer( text->GetLayer() ) ); - - if( GetLayer() == LAYER_N_BACK ) - text->SetLayer( SILKSCREEN_N_BACK ); - - if( GetLayer() == LAYER_N_FRONT ) - text->SetLayer( SILKSCREEN_N_FRONT ); - - if( IsBackLayer( GetLayer() ) ) - text->m_Mirror = true; - + text->m_Mirror = IsBackLayer( GetLayer() ); break; default: @@ -1021,13 +987,11 @@ void MODULE::SetOrientation( double newangle ) void MODULE::Show( int nestLevel, std::ostream& os ) const { - BOARD* board = GetBoard(); - // for now, make it look like XML, expand on this later. NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << " ref=\"" << m_Reference->GetText().mb_str() << '"' << " value=\"" << m_Value->GetText().mb_str() << '"' << - " layer=\"" << board->GetLayerName( m_Layer ).mb_str() << '"' << + " layer=\"" << GetLayerName().mb_str() << '"' << ">\n"; NestedSpace( nestLevel + 1, os ) << "& aList ) board = GetBoard(); - wxString layerInfo; - - if( (m_layerMask & ALL_CU_LAYERS) == 0 ) // pad is not on any copper layers - { - LAYER_NUM pad_layer = ExtractLayer( m_layerMask & ~ALL_CU_LAYERS ); - switch( pad_layer ) - { - case UNSELECTED_LAYER: - layerInfo = _( "No layers" ); - break; - - case UNDEFINED_LAYER: - layerInfo = _( "Non-copper" ); - break; - - default: - layerInfo = board->GetLayerName( pad_layer ); - break; - } - } - else - { - static const wxChar* andInternal = _( " & int" ); - - if( (m_layerMask & (LAYER_BACK | LAYER_FRONT)) == LAYER_BACK ) - { - layerInfo = board->GetLayerName( LAYER_N_BACK ); - - if( m_layerMask & INTERNAL_LAYERS ) - layerInfo += andInternal; - } - - else if( (m_layerMask & (LAYER_BACK | LAYER_FRONT)) == (LAYER_BACK | LAYER_FRONT) ) - { - layerInfo = board->GetLayerName( LAYER_N_BACK ) + wxT(", ") + - board->GetLayerName( LAYER_N_FRONT ); - - if( m_layerMask & INTERNAL_LAYERS ) - layerInfo += andInternal; - } - - else if( (m_layerMask & (LAYER_BACK | LAYER_FRONT)) == LAYER_FRONT ) - { - layerInfo = board->GetLayerName( LAYER_N_FRONT ); - - if( m_layerMask & INTERNAL_LAYERS ) - layerInfo += andInternal; - } - else // necessarily true: if( m_layerMask & INTERNAL_LAYERS ) - { - layerInfo = _( "internal" ); - } - } - - aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), layerInfo, DARKGREEN ) ); + aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), + LayerMaskDescribe( board, m_layerMask ), DARKGREEN ) ); aList.push_back( MSG_PANEL_ITEM( ShowPadShape(), ShowPadAttr(), DARKGREEN ) ); @@ -758,7 +705,7 @@ wxString D_PAD::ShowPadShape() const return _( "Trap" ); default: - return wxT( "??Unknown??" ); + return wxT( "???" ); } } @@ -771,7 +718,7 @@ wxString D_PAD::ShowPadAttr() const return _( "Std" ); case PAD_SMD: - return _( "Smd" ); + return _( "SMD" ); case PAD_CONN: return _( "Conn" ); @@ -780,7 +727,7 @@ wxString D_PAD::ShowPadAttr() const return _( "Not Plated" ); default: - return wxT( "??Unkown??" ); + return wxT( "???" ); } } @@ -788,22 +735,21 @@ wxString D_PAD::ShowPadAttr() const wxString D_PAD::GetSelectMenuText() const { wxString text; - wxString padlayers; - BOARD * board = GetBoard(); + wxString padlayers( LayerMaskDescribe( GetBoard(), m_layerMask ) ); + wxString padname( GetPadName() ); - - if ( (m_layerMask & ALL_CU_LAYERS) == ALL_CU_LAYERS ) - padlayers = _("all copper layers"); - else if( (m_layerMask & LAYER_BACK ) == LAYER_BACK ) - padlayers = board->GetLayerName(LAYER_N_BACK); - else if( (m_layerMask & LAYER_FRONT) == LAYER_FRONT ) - padlayers = board->GetLayerName(LAYER_N_FRONT); - else - padlayers = _( "???" ); - - text.Printf( _( "Pad [%s] (%s) of %s" ), - GetChars(GetPadName() ), GetChars( padlayers ), + if( padname.IsEmpty() ) + { + text.Printf( _( "Pad on %s of %s" ), + GetChars( padlayers ), GetChars(( (MODULE*) GetParent() )->GetReference() ) ); + } + else + { + text.Printf( _( "Pad %s on %s of %s" ), + GetChars(GetPadName() ), GetChars( padlayers ), + GetChars(( (MODULE*) GetParent() )->GetReference() ) ); + } return text; } diff --git a/pcbnew/class_pcb_layer_widget.cpp b/pcbnew/class_pcb_layer_widget.cpp index ef2199251a..944801ce9d 100644 --- a/pcbnew/class_pcb_layer_widget.cpp +++ b/pcbnew/class_pcb_layer_widget.cpp @@ -265,8 +265,6 @@ void PCB_LAYER_WIDGET::ReFill() int enabledLayers = brd->GetEnabledLayers(); -// m_Layers->Freeze(); // no screen updates until done modifying - ClearLayerRows(); // show all coppers first, with front on top, back on bottom, then technical layers @@ -327,8 +325,6 @@ void PCB_LAYER_WIDGET::ReFill() } installRightLayerClickHandler(); - -// m_Layers->Thaw(); } //------------------------------------------------ diff --git a/pcbnew/class_pcb_text.cpp b/pcbnew/class_pcb_text.cpp index 5b53db3350..5912c3d0fa 100644 --- a/pcbnew/class_pcb_text.cpp +++ b/pcbnew/class_pcb_text.cpp @@ -124,12 +124,11 @@ void TEXTE_PCB::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) wxASSERT( board ); if( m_Parent && m_Parent->Type() == PCB_DIMENSION_T ) - aList.push_back( MSG_PANEL_ITEM( _( "DIMENSION" ), m_Text, DARKGREEN ) ); + aList.push_back( MSG_PANEL_ITEM( _( "Dimension" ), m_Text, DARKGREEN ) ); else aList.push_back( MSG_PANEL_ITEM( _( "PCB Text" ), m_Text, DARKGREEN ) ); - aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), - board->GetLayerName( m_Layer ), BLUE ) ); + aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), BLUE ) ); if( !m_Mirror ) aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), _( "No" ), DARKGREEN ) ); @@ -161,15 +160,8 @@ void TEXTE_PCB::Rotate( const wxPoint& aRotCentre, double aAngle ) void TEXTE_PCB::Flip(const wxPoint& aCentre ) { m_Pos.y = aCentre.y - ( m_Pos.y - aCentre.y ); -// NEGATE( m_Orient ); not needed: m_Mirror handles this - if( GetLayer() == LAYER_N_BACK - || GetLayer() == LAYER_N_FRONT - || GetLayer() == SILKSCREEN_N_BACK - || GetLayer() == SILKSCREEN_N_FRONT ) - { - m_Mirror = not m_Mirror; /* inverse mirror */ - } SetLayer( FlipLayer( GetLayer() ) ); + m_Mirror = !m_Mirror; } diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index f00d1f58e6..b4e55d91b3 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -49,21 +49,18 @@ #include -TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) : +TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, TEXT_TYPE text_type ) : BOARD_ITEM( parent, PCB_MODULE_TEXT_T ), EDA_TEXT() { MODULE* module = (MODULE*) m_Parent; - m_Type = text_type; /* Reference */ - - if( (m_Type != TEXT_is_REFERENCE) && (m_Type != TEXT_is_VALUE) ) - m_Type = TEXT_is_DIVERS; + m_Type = text_type; m_NoShow = false; // Set text tickness to a default value - m_Thickness = Millimeter2iu( 0.15 ); + m_Thickness = Millimeter2iu( 0.15 ); SetLayer( SILKSCREEN_N_FRONT ); @@ -71,21 +68,16 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) : { m_Pos = module->GetPosition(); - LAYER_NUM moduleLayer = module->GetLayer(); - - if( moduleLayer == LAYER_N_BACK ) - SetLayer( SILKSCREEN_N_BACK ); - else if( moduleLayer == LAYER_N_FRONT ) - SetLayer( SILKSCREEN_N_FRONT ); - else - SetLayer( moduleLayer ); - - if( moduleLayer == SILKSCREEN_N_BACK - || moduleLayer == ADHESIVE_N_BACK - || moduleLayer == LAYER_N_BACK ) + if( IsBackLayer( module->GetLayer() ) ) { + SetLayer( SILKSCREEN_N_BACK ); m_Mirror = true; } + else + { + SetLayer( SILKSCREEN_N_FRONT ); + m_Mirror = false; + } } } @@ -367,7 +359,6 @@ void TEXTE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) return; wxString msg, Line; - int ii; static const wxString text_type_msg[3] = { @@ -380,12 +371,8 @@ void TEXTE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) Line = m_Text; aList.push_back( MSG_PANEL_ITEM( _( "Text" ), Line, BROWN ) ); - ii = m_Type; - - if( ii > 2 ) - ii = 2; - - aList.push_back( MSG_PANEL_ITEM( _( "Type" ), text_type_msg[ii], DARKGREEN ) ); + wxASSERT( m_Type >= TEXT_is_REFERENCE && m_Type <= TEXT_is_DIVERS ); + aList.push_back( MSG_PANEL_ITEM( _( "Type" ), text_type_msg[m_Type], DARKGREEN ) ); if( m_NoShow ) msg = _( "No" ); @@ -394,21 +381,13 @@ void TEXTE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) aList.push_back( MSG_PANEL_ITEM( _( "Display" ), msg, DARKGREEN ) ); - // Display text layer (use layer name if possible) - BOARD* board = NULL; - board = (BOARD*) module->GetParent(); - - if( m_Layer < NB_PCB_LAYERS && board ) - msg = board->GetLayerName( m_Layer ); - else - msg.Printf( wxT( "%d" ), m_Layer ); - - aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), msg, DARKGREEN ) ); - - msg = _( " No" ); + // Display text layer + aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), DARKGREEN ) ); if( m_Mirror ) msg = _( " Yes" ); + else + msg = _( " No" ); aList.push_back( MSG_PANEL_ITEM( _( "Mirror" ), msg, DARKGREEN ) ); @@ -426,39 +405,6 @@ void TEXTE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) } -// see class_text_mod.h -bool TEXTE_MODULE::IsOnLayer( LAYER_NUM aLayer ) const -{ - if( m_Layer == aLayer ) - return true; - - /* test the parent, which is a MODULE */ - if( aLayer == GetParent()->GetLayer() ) - return true; - - if( aLayer == LAYER_N_BACK ) - { - if( m_Layer==ADHESIVE_N_BACK || m_Layer==SILKSCREEN_N_BACK ) - return true; - } - else if( aLayer == LAYER_N_FRONT ) - { - if( m_Layer==ADHESIVE_N_FRONT || m_Layer==SILKSCREEN_N_FRONT ) - return true; - } - - return false; -} - - -/* see class_text_mod.h - * bool TEXTE_MODULE::IsOnOneOfTheseLayers( int aLayerMask ) const - * { - * - * } - */ - - wxString TEXTE_MODULE::GetSelectMenuText() const { wxString text; @@ -476,7 +422,8 @@ wxString TEXTE_MODULE::GetSelectMenuText() const default: // wrap this one in quotes: text << _( "Text" ) << wxT( " \"" ) << m_Text << wxT( "\"" ) << _( " of " ) - << ( (MODULE*) GetParent() )->GetReference(); + << ( (MODULE*) GetParent() )->GetReference() << _( " on " ) + << GetLayerName(); break; } diff --git a/pcbnew/class_text_mod.h b/pcbnew/class_text_mod.h index e5087c9ed5..1e7e94a199 100644 --- a/pcbnew/class_text_mod.h +++ b/pcbnew/class_text_mod.h @@ -43,10 +43,6 @@ class MODULE; class MSG_PANEL_ITEM; -#define TEXT_is_REFERENCE 0 -#define TEXT_is_VALUE 1 -#define TEXT_is_DIVERS 2 - #define UMBILICAL_COLOR LIGHTBLUE @@ -56,18 +52,28 @@ class TEXTE_MODULE : public BOARD_ITEM, public EDA_TEXT friend class MODULE; friend class FOOTPRINT_EDIT_FRAME; +public: + enum TEXT_TYPE + { + TEXT_is_REFERENCE = 0, + TEXT_is_VALUE = 1, + TEXT_is_DIVERS = 2 + }; + +private: + /* Note: orientation in 1/10 deg relative to the footprint * Physical orient is m_Orient + m_Parent->m_Orient */ - int m_Type; ///< 0=ref, 1=val, etc. - bool m_NoShow; ///< true = invisible + TEXT_TYPE m_Type; ///< 0=ref, 1=val, etc. + bool m_NoShow; ///< true = invisible - wxPoint m_Pos0; ///< text coordinates relatives to the footprint anchor, orient 0. + wxPoint m_Pos0; ///< text coordinates relatives to the footprint anchor, orient 0. ///< text coordinate ref point is the text centre public: - TEXTE_MODULE( MODULE* parent, int text_type = TEXT_is_DIVERS ); + TEXTE_MODULE( MODULE* parent, TEXT_TYPE text_type = TEXT_is_DIVERS ); // Do not create a copy constructor. The one generated by the compiler is adequate. @@ -77,9 +83,10 @@ public: TEXTE_MODULE* Back() const { return (TEXTE_MODULE*) Pback; } - /// @deprecated it seems - void SetType( int aType ) { m_Type = aType; } - int GetType() const { return m_Type; } + /// @deprecated it seems (but the type is used to 'protect' + //reference and value from deletion, and for identification) + void SetType( TEXT_TYPE aType ) { m_Type = aType; } + TEXT_TYPE GetType() const { return m_Type; } void SetVisible( bool isVisible ) { m_NoShow = !isVisible; } bool IsVisible() const { return !m_NoShow; } @@ -89,7 +96,7 @@ public: void Copy( TEXTE_MODULE* source ); // copy structure - int GetLength() const; /* text length */ + int GetLength() const; // text length int GetDrawRotation() const; // Return text rotation for drawings and plotting @@ -130,9 +137,6 @@ public: bool HitTest( const wxPoint& aPosition ); - bool IsOnLayer( LAYER_NUM aLayer ) const; - - wxString GetClass() const { return wxT( "MTEXT" ); diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index 80e54e873c..be84b15d29 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -172,7 +172,8 @@ wxString SEGZONE::GetSelectMenuText() const } else { - text << _( "** BOARD NOT DEFINED **" ); + wxFAIL_MSG( wxT( "SEGZONE::GetSelectMenuText: BOARD is NULL" ) ); + text << wxT( "???" ); } text << _( " on " ) << GetLayerName(); @@ -200,16 +201,16 @@ wxString SEGVIA::GetSelectMenuText() const NETINFO_ITEM* net; BOARD* board = GetBoard(); - text << _( "Via" ) << wxT( " " ) << ShowWidth(); - int shape = GetShape(); if( shape == VIA_BLIND_BURIED ) - text << wxT( " " ) << _( "Blind/Buried" ); + text << wxT( " " ) << _( "Blind/Buried " ); else if( shape == VIA_MICROVIA ) - text << wxT( " " ) << _( "Micro Via" ); + text << wxT( " " ) << _( "Micro " ); // else say nothing about normal (through) vias + text << _( "Via" ) << wxT( " " ) << ShowWidth(); + if( board ) { net = board->FindNet( GetNet() ); @@ -219,19 +220,17 @@ wxString SEGVIA::GetSelectMenuText() const text << wxChar( ' ' ) << _( "Net:" ) << GetNet(); - if( shape != VIA_THROUGH ) - { - // say which layers, only two for now - LAYER_NUM topLayer; - LAYER_NUM botLayer; - ReturnLayerPair( &topLayer, &botLayer ); - text << _( " on " ) << board->GetLayerName( topLayer ).Trim() << wxT( " <-> " ) - << board->GetLayerName( botLayer ).Trim(); - } + // say which layers, only two for now + LAYER_NUM topLayer; + LAYER_NUM botLayer; + ReturnLayerPair( &topLayer, &botLayer ); + text << _( " on " ) << board->GetLayerName( topLayer ) << wxT( "/" ) + << board->GetLayerName( botLayer ); } else { - text << _( "** BOARD NOT DEFINED **" ); + wxFAIL_MSG( wxT( "SEGVIA::GetSelectMenuText: BOARD is NULL" ) ); + text << wxT( "???" ); } return text; @@ -1020,7 +1019,7 @@ void TRACK::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList ) { default: case 0: - msg = _( "??? Via" ); // Not used yet, does not exist currently + msg = wxT( "???" ); // Not used yet, does not exist currently break; case 1: @@ -1049,7 +1048,7 @@ void TRACK::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList ) break; default: - msg = wxT( "????" ); + msg = wxT( "???" ); break; } @@ -1068,7 +1067,7 @@ void TRACK::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList ) aList.push_back( MSG_PANEL_ITEM( _( "NetName" ), msg, RED ) ); /* Display net code : (useful in test or debug) */ - msg.Printf( wxT( "%d .%d" ), GetNet(), GetSubNet() ); + msg.Printf( wxT( "%d.%d" ), GetNet(), GetSubNet() ); aList.push_back( MSG_PANEL_ITEM( _( "NetCode" ), msg, RED ) ); } @@ -1117,7 +1116,8 @@ void TRACK::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList ) LAYER_NUM top_layer, bottom_layer; Via->ReturnLayerPair( &top_layer, &bottom_layer ); - msg = board->GetLayerName( top_layer ) + wxT( "/" ) + board->GetLayerName( bottom_layer ); + msg = board->GetLayerName( top_layer ) + wxT( "/" ) + + board->GetLayerName( bottom_layer ); } else { @@ -1126,7 +1126,7 @@ void TRACK::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList ) aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), msg, BROWN ) ); - /* Display width */ + // Display width msg = ::CoordinateToString( (unsigned) m_Width ); if( Type() == PCB_VIA_T ) // Display Diam and Drill values @@ -1330,7 +1330,7 @@ suite1: } } - /* General search. */ + // General search for( nextSegment = aStartTrace; nextSegment != NULL; nextSegment = nextSegment->Next() ) { if( nextSegment->GetState( IS_DELETED | BUSY ) ) @@ -1524,11 +1524,12 @@ wxString TRACK::GetSelectMenuText() const } else { - text << _( "** BOARD NOT DEFINED **" ); + wxFAIL_MSG( wxT( "TRACK::GetSelectMenuText: BOARD is NULL" ) ); + text << wxT( "???" ); } - text << _( " on " ) << GetLayerName() << wxT(" ") << _("Net:") << GetNet() - << wxT(" ") << _("Length:") << ::LengthDoubleToString( GetLength() ); + text << _( " on " ) << GetLayerName() << wxT(", ") << _("Net:") << GetNet() + << wxT(", ") << _("Length:") << ::LengthDoubleToString( GetLength() ); return text; } @@ -1591,8 +1592,8 @@ void SEGVIA::Show( int nestLevel, std::ostream& os ) const " type=\"" << cp << '"'; if( board ) - os << " layers=\"" << board->GetLayerName( topLayer ).Trim().mb_str() << "," - << board->GetLayerName( botLayer ).Trim().mb_str() << '"'; + os << " layers=\"" << board->GetLayerName( topLayer ).mb_str() << "," + << board->GetLayerName( botLayer ).mb_str() << '"'; os << " width=\"" << m_Width << '"' << " drill=\"" << GetDrillValue() << '"' diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index 48aa55462e..3fcf9c31e7 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -657,23 +657,13 @@ void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) msg.Empty(); if( GetDoNotAllowVias() ) - msg = _("No via"); + AccumulateDescription( msg, _("No via") ); if( GetDoNotAllowTracks() ) - { - if( !msg.IsEmpty() ) - msg += wxT(", "); - - msg += _("No track"); - } + AccumulateDescription( msg, _("No track") ); if( GetDoNotAllowCopperPour() ) - { - if( !msg.IsEmpty() ) - msg += wxT(", "); - - msg += _("No copper pour"); - } + AccumulateDescription( msg, _("No copper pour") ); aList.push_back( MSG_PANEL_ITEM( _( "Keepout" ), msg, RED ) ); } @@ -712,8 +702,7 @@ void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) aList.push_back( MSG_PANEL_ITEM( _( "Non Copper Zone" ), wxEmptyString, RED ) ); } - msg = board->GetLayerName( m_Layer ); - aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), msg, BROWN ) ); + aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), GetLayerName(), BROWN ) ); msg.Printf( wxT( "%d" ), (int) m_Poly->m_CornersList.size() ); aList.push_back( MSG_PANEL_ITEM( _( "Corners" ), msg, BLUE ) ); @@ -975,7 +964,7 @@ wxString ZONE_CONTAINER::GetSelectMenuText() const } } - text << _( " on layer " ) << GetLayerName(); + text << _( " on " ) << GetLayerName(); return text; } diff --git a/pcbnew/cross-probing.cpp b/pcbnew/cross-probing.cpp index 33ef3dfa91..ced4db35dd 100644 --- a/pcbnew/cross-probing.cpp +++ b/pcbnew/cross-probing.cpp @@ -171,14 +171,12 @@ void PCB_EDIT_FRAME::SendMessageToEESCHEMA( BOARD_ITEM* objectToSync ) break; case PCB_MODULE_TEXT_T: - #define REFERENCE 0 - #define VALUE 1 module = (MODULE*) objectToSync->GetParent(); text_mod = (TEXTE_MODULE*) objectToSync; - if( text_mod->GetType() == REFERENCE ) + if( text_mod->GetType() == TEXTE_MODULE::TEXT_is_REFERENCE ) text_key = "$REF:"; - else if( text_mod->GetType() == VALUE ) + else if( text_mod->GetType() == TEXTE_MODULE::TEXT_is_VALUE ) text_key = "$VAL:"; else break; diff --git a/pcbnew/dialogs/dialog_edit_module_text.cpp b/pcbnew/dialogs/dialog_edit_module_text.cpp index e9c291d656..c4630694f6 100644 --- a/pcbnew/dialogs/dialog_edit_module_text.cpp +++ b/pcbnew/dialogs/dialog_edit_module_text.cpp @@ -131,13 +131,20 @@ void DialogEditModuleText::initDlg( ) m_ModuleInfoText->SetLabel( msg ); - - if( m_currentText->GetType() == TEXT_is_VALUE ) + switch( m_currentText->GetType() ) + { + case TEXTE_MODULE::TEXT_is_VALUE: m_TextDataTitle->SetLabel( _( "Value:" ) ); - else if( m_currentText->GetType() == TEXT_is_DIVERS ) + break; + + case TEXTE_MODULE::TEXT_is_DIVERS: m_TextDataTitle->SetLabel( _( "Text:" ) ); - else if( m_currentText->GetType() != TEXT_is_REFERENCE ) - m_TextDataTitle->SetLabel( wxT( "???" ) ); + break; + + default: + m_TextDataTitle->SetLabel( _( "Reference:" ) ); + break; + } m_Name->SetValue( m_currentText->GetText() ); diff --git a/pcbnew/dialogs/dialog_layers_setup.cpp b/pcbnew/dialogs/dialog_layers_setup.cpp index a1825fc194..4cccbfc508 100644 --- a/pcbnew/dialogs/dialog_layers_setup.cpp +++ b/pcbnew/dialogs/dialog_layers_setup.cpp @@ -173,25 +173,22 @@ public: // Layer bit masks for each defined "Preset Layer Grouping" static const LAYER_MSK presets[] = { -#define FRONT_AUX (SILKSCREEN_LAYER_FRONT | SOLDERMASK_LAYER_FRONT | ADHESIVE_LAYER_FRONT | SOLDERPASTE_LAYER_FRONT) -#define BACK_AUX (SILKSCREEN_LAYER_BACK | SOLDERMASK_LAYER_BACK | ADHESIVE_LAYER_BACK | SOLDERPASTE_LAYER_BACK) - NO_LAYERS, // shift the array index up by one, matches with "Custom". // "Two layers, parts on Front only" - EDGE_LAYER | LAYER_FRONT | LAYER_BACK | FRONT_AUX, + EDGE_LAYER | LAYER_FRONT | LAYER_BACK | FRONT_AUX_LAYERS, // "Two layers, parts on Back only", - EDGE_LAYER | LAYER_FRONT | LAYER_BACK | BACK_AUX, + EDGE_LAYER | LAYER_FRONT | LAYER_BACK | BACK_AUX_LAYERS, // "Two layers, parts on Front and Back", - EDGE_LAYER | LAYER_FRONT | LAYER_BACK | BACK_AUX | FRONT_AUX, + EDGE_LAYER | LAYER_FRONT | LAYER_BACK | ALL_AUX_LAYERS, // "Four layers, parts on Front only" - EDGE_LAYER | LAYER_FRONT | LAYER_BACK | LAYER_2 | LAYER_3 | FRONT_AUX, + EDGE_LAYER | LAYER_FRONT | LAYER_BACK | LAYER_2 | LAYER_3 | FRONT_AUX_LAYERS, // "Four layers, parts on Front and Back" - EDGE_LAYER | LAYER_FRONT | LAYER_BACK | LAYER_2 | LAYER_3 | FRONT_AUX | BACK_AUX, + EDGE_LAYER | LAYER_FRONT | LAYER_BACK | LAYER_2 | LAYER_3 | ALL_AUX_LAYERS, // "All layers on", ALL_LAYERS, diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp index 4bafc1ef3c..a632c5a3d2 100644 --- a/pcbnew/dialogs/dialog_plot.cpp +++ b/pcbnew/dialogs/dialog_plot.cpp @@ -242,11 +242,7 @@ void DIALOG_PLOT::OnPopUpLayers( wxCommandEvent& event ) for( i = 0; i < m_layerList.size(); i++ ) { LAYER_MSK layermask = GetLayerMask( m_layerList[ i ] ); - if( ( layermask & - ( ALL_CU_LAYERS | SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT | - SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT | - SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT ) ) - != 0 ) + if( layermask & ( ALL_CU_LAYERS | ALL_AUX_LAYERS ) ) m_layerCheckListBox->Check( i, true ); else m_layerCheckListBox->Check( i, false ); diff --git a/pcbnew/edgemod.cpp b/pcbnew/edgemod.cpp index 2b5f52b82d..9d3c0c9aab 100644 --- a/pcbnew/edgemod.cpp +++ b/pcbnew/edgemod.cpp @@ -340,11 +340,11 @@ EDGE_MODULE* FOOTPRINT_EDIT_FRAME::Begin_Edge_Module( EDGE_MODULE* aEdge, aEdge->SetWidth( GetDesignSettings().m_ModuleSegmentWidth ); aEdge->SetLayer( module->GetLayer() ); - if( module->GetLayer() == LAYER_N_FRONT ) - aEdge->SetLayer( SILKSCREEN_N_FRONT ); - - if( module->GetLayer() == LAYER_N_BACK ) + // The default layer for an edge is the corresponding silk layer + if( module->IsFlipped() ) aEdge->SetLayer( SILKSCREEN_N_BACK ); + else + aEdge->SetLayer( SILKSCREEN_N_FRONT ); // Initialize the starting point of the new segment or arc aEdge->SetStart( GetScreen()->GetCrossHairPosition() ); diff --git a/pcbnew/editedge.cpp b/pcbnew/editedge.cpp index 39bd894238..9488ef438c 100644 --- a/pcbnew/editedge.cpp +++ b/pcbnew/editedge.cpp @@ -152,7 +152,7 @@ void PCB_EDIT_FRAME::Delete_Drawings_All_Layer( LAYER_NUM aLayer ) return; } - wxString msg = _( "Delete Layer " ) + GetBoard()->GetLayerName( aLayer ); + wxString msg = _( "Delete everything on layer " ) + GetBoard()->GetLayerName( aLayer ); if( !IsOK( this, msg ) ) return; diff --git a/pcbnew/editmod.cpp b/pcbnew/editmod.cpp index 02a0e537fc..33e997ff4d 100644 --- a/pcbnew/editmod.cpp +++ b/pcbnew/editmod.cpp @@ -79,19 +79,19 @@ void FOOTPRINT_EDIT_FRAME::RemoveStruct( EDA_ITEM* Item ) { TEXTE_MODULE* text = (TEXTE_MODULE*) Item; - if( text->GetType() == TEXT_is_REFERENCE ) + switch( text->GetType() ) { + case TEXTE_MODULE::TEXT_is_REFERENCE: DisplayError( this, _( "Cannot delete REFERENCE!" ) ); break; - } - if( text->GetType() == TEXT_is_VALUE ) - { + case TEXTE_MODULE::TEXT_is_VALUE: DisplayError( this, _( "Cannot delete VALUE!" ) ); break; - } - DeleteTextModule( text ); + default: + DeleteTextModule( text ); + } } break; diff --git a/pcbnew/edtxtmod.cpp b/pcbnew/edtxtmod.cpp index 790cc991e2..4b78b6d24a 100644 --- a/pcbnew/edtxtmod.cpp +++ b/pcbnew/edtxtmod.cpp @@ -139,7 +139,7 @@ void PCB_BASE_FRAME::DeleteTextModule( TEXTE_MODULE* Text ) Module = (MODULE*) Text->GetParent(); - if( Text->GetType() == TEXT_is_DIVERS ) + if( Text->GetType() == TEXTE_MODULE::TEXT_is_DIVERS ) { m_canvas->RefreshDrawingRect( Text->GetBoundingBox() ); Text->DeleteStructure(); diff --git a/pcbnew/gen_modules_placefile.cpp b/pcbnew/gen_modules_placefile.cpp index eaf18bb680..d000e68869 100644 --- a/pcbnew/gen_modules_placefile.cpp +++ b/pcbnew/gen_modules_placefile.cpp @@ -677,7 +677,7 @@ bool PCB_EDIT_FRAME::DoGenFootprintsReport( const wxString& aFullFilename, bool double(pad->GetOrientation() - Module->GetOrientation()) / 10 ); fputs( line, rptfile ); - static const char* shape_name[6] = { "??? ", "Circ", "Rect", "Oval", "trap", "spec" }; + static const char* shape_name[6] = { "???", "Circ", "Rect", "Oval", "Trap", "Spec" }; sprintf( line, "Shape %s\n", shape_name[pad->GetShape()] ); fputs( line, rptfile ); @@ -690,7 +690,7 @@ bool PCB_EDIT_FRAME::DoGenFootprintsReport( const wxString& aFullFilename, bool if( pad->GetLayerMask() & LAYER_FRONT ) layer |= 2; - static const char* layer_name[4] = { "??? ", "copper", "component", "all" }; + static const char* layer_name[4] = { "none", "back", "front", "both" }; sprintf( line, "Layer %s\n", layer_name[layer] ); fputs( line, rptfile ); diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index a74f05cb96..0b441d4334 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -1187,9 +1187,9 @@ void PCB_IO::format( TEXTE_MODULE* aText, int aNestLevel ) const switch( aText->GetType() ) { - case 0: type = wxT( "reference" ); break; - case 1: type = wxT( "value" ); break; - default: type = wxT( "user" ); + case TEXTE_MODULE::TEXT_is_REFERENCE: type = wxT( "reference" ); break; + case TEXTE_MODULE::TEXT_is_VALUE: type = wxT( "value" ); break; + default: type = wxT( "user" ); } // Due to the Pcbnew history, m_Orient is saved in screen value diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index edbf0bc346..def084e9c1 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -948,12 +948,17 @@ MODULE* LEGACY_PLUGIN::LoadMODULE() TEXTE_MODULE* textm; - if( tnum == TEXT_is_REFERENCE ) - textm = &module->Reference(); - else if( tnum == TEXT_is_VALUE ) - textm = &module->Value(); - else + switch( tnum ) { + case TEXTE_MODULE::TEXT_is_REFERENCE: + textm = &module->Reference(); + break; + + case TEXTE_MODULE::TEXT_is_VALUE: + textm = &module->Value(); + break; + + default: // text is a drawing textm = new TEXTE_MODULE( module.get() ); module->GraphicalItems().PushBack( textm ); @@ -1551,10 +1556,11 @@ void LEGACY_PLUGIN::loadMODULE_TEXT( TEXTE_MODULE* aText ) char* hjust = strtok( (char*) txt_end, delims ); char* vjust = strtok( NULL, delims ); - if( type != TEXT_is_REFERENCE && type != TEXT_is_VALUE ) - type = TEXT_is_DIVERS; + if( type != TEXTE_MODULE::TEXT_is_REFERENCE + && type != TEXTE_MODULE::TEXT_is_VALUE ) + type = TEXTE_MODULE::TEXT_is_DIVERS; - aText->SetType( type ); + aText->SetType( static_cast( type ) ); aText->SetPos0( wxPoint( pos0_x, pos0_y ) ); aText->SetSize( wxSize( size0_x, size0_y ) ); @@ -1730,8 +1736,8 @@ void LEGACY_PLUGIN::loadPCB_LINE() dseg->SetTimeStamp( timestamp ); break; case 4: - int state; - state = hexParse( data ); + STATUS_FLAGS state; + state = static_cast( hexParse( data ) ); dseg->SetState( state, true ); break; diff --git a/pcbnew/modedit.cpp b/pcbnew/modedit.cpp index e0f9088e6c..92c95cd170 100644 --- a/pcbnew/modedit.cpp +++ b/pcbnew/modedit.cpp @@ -482,12 +482,12 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) if( val && ref ) { - ref->SetType( TEXT_is_REFERENCE ); // just in case ... + ref->SetType( TEXTE_MODULE::TEXT_is_REFERENCE ); // just in case ... if( ref->GetLength() == 0 ) ref->SetText( wxT( "Ref**" ) ); - val->SetType( TEXT_is_VALUE ); // just in case ... + val->SetType( TEXTE_MODULE::TEXT_is_VALUE ); // just in case ... if( val->GetLength() == 0 ) val->SetText( L"Val**" ); diff --git a/pcbnew/modedit_onclick.cpp b/pcbnew/modedit_onclick.cpp index f722179a91..4628f1ba80 100644 --- a/pcbnew/modedit_onclick.cpp +++ b/pcbnew/modedit_onclick.cpp @@ -314,7 +314,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen HK_EDIT_ITEM ); AddMenuItem( PopMenu, ID_POPUP_PCB_EDIT_TEXTMODULE, msg, KiBitmap( edit_text_xpm ) ); - if( ( (TEXTE_MODULE*) item )->GetType() == TEXT_is_DIVERS ) + if( ( (TEXTE_MODULE*) item )->GetType() == TEXTE_MODULE::TEXT_is_DIVERS ) { msg = AddHotkeyName( _("Delete Text Mod." ), g_Module_Editor_Hokeys_Descr, HK_DELETE ); diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp index 14b6055a06..c2b2b73638 100644 --- a/pcbnew/onrightclick.cpp +++ b/pcbnew/onrightclick.cpp @@ -775,7 +775,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* me } // Graphic texts can be deleted only if are not currently edited. - if( !flags && FpText->GetType() == TEXT_is_DIVERS ) + if( !flags && FpText->GetType() == TEXTE_MODULE::TEXT_is_DIVERS ) { AddMenuItem( sub_menu_Fp_text, ID_POPUP_PCB_DELETE_TEXTMODULE, _( "Delete" ), KiBitmap( delete_xpm ) ); diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp index daa698bdd2..3e7c54a934 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp @@ -519,7 +519,7 @@ void PCB_MODULE::AddToBoard() TEXTE_MODULE* ref_text = &module->Reference(); ref_text->SetText( m_name.text ); - ref_text->SetType( TEXT_is_REFERENCE ); + ref_text->SetType( TEXTE_MODULE::TEXT_is_REFERENCE ); ref_text->SetPos0( wxPoint( m_name.correctedPositionX, m_name.correctedPositionY ) ); ref_text->SetSize( wxSize( KiROUND( m_name.textHeight / 2 ), @@ -540,7 +540,7 @@ void PCB_MODULE::AddToBoard() TEXTE_MODULE* val_text = &module->Value(); val_text->SetText( m_value.text ); - val_text->SetType( TEXT_is_REFERENCE ); + val_text->SetType( TEXTE_MODULE::TEXT_is_REFERENCE ); val_text->SetPos0( wxPoint( m_value.correctedPositionX, m_value.correctedPositionY ) ); val_text->SetSize( wxSize( KiROUND( m_value.textHeight / 2 ), diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index ecf7ddac85..39dda89adb 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -1669,18 +1669,19 @@ MODULE* PCB_PARSER::parseMODULE() throw( IO_ERROR, PARSE_ERROR ) text->SetOrientation( orientation ); text->SetDrawCoord(); - if( text->GetType() == TEXT_is_REFERENCE ) + switch( text->GetType() ) { + case TEXTE_MODULE::TEXT_is_REFERENCE: module->Reference() = *text; delete text; - } - else if( text->GetType() == TEXT_is_VALUE ) - { + break; + + case TEXTE_MODULE::TEXT_is_VALUE: module->Value() = *text; delete text; - } - else - { + break; + + default: module->GraphicalItems().PushBack( text ); } @@ -1743,11 +1744,11 @@ TEXTE_MODULE* PCB_PARSER::parseTEXTE_MODULE() throw( IO_ERROR, PARSE_ERROR ) switch( token ) { case T_reference: - text->SetType( TEXT_is_REFERENCE ); + text->SetType( TEXTE_MODULE::TEXT_is_REFERENCE ); break; case T_value: - text->SetType( TEXT_is_VALUE ); + text->SetType( TEXTE_MODULE::TEXT_is_VALUE ); break; case T_user: diff --git a/pcbnew/sel_layer.cpp b/pcbnew/sel_layer.cpp index 9b4b512266..5e265a26dc 100644 --- a/pcbnew/sel_layer.cpp +++ b/pcbnew/sel_layer.cpp @@ -104,7 +104,7 @@ SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( PCB_BASE_FRAME* parent, m_Parent = parent; - /* Build the layer list */ + // Build the layer list LayerCount = 0; LAYER_MSK Masque_Layer = g_TabAllCopperLayerMask[board->GetCopperLayerCount() - 1]; Masque_Layer |= ALL_NO_CU_LAYERS; From b739b2b0756fd1eb670af5ccb37ef40cbdff0c7f Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Sun, 7 Apr 2013 18:20:46 +0200 Subject: [PATCH 52/63] Support for a visibility flag and color selection to NPTH holes (when disabled they are shown as standard holes, a lot less distracting than the previous fixed yellow color) --- common/class_colors_design_settings.cpp | 31 ++++++++------------- include/layers_id_colors_and_visibility.h | 1 + pcbnew/class_board.cpp | 2 ++ pcbnew/class_pad.cpp | 2 +- pcbnew/class_pad_draw_functions.cpp | 34 ++++++++++++----------- pcbnew/class_pcb_layer_widget.cpp | 1 + pcbnew/pcbnew_config.cpp | 3 ++ 7 files changed, 38 insertions(+), 36 deletions(-) diff --git a/common/class_colors_design_settings.cpp b/common/class_colors_design_settings.cpp index 21835b80e5..df35c9427d 100644 --- a/common/class_colors_design_settings.cpp +++ b/common/class_colors_design_settings.cpp @@ -36,34 +36,27 @@ static const EDA_COLOR_T default_layer_color[LAYERSCOLORSBUFFERSIZE] = static const EDA_COLOR_T default_items_color[LAYERSCOLORSBUFFERSIZE] = { - LIGHTGRAY, // unused - CYAN, // VIA_MICROVIA_VISIBLE - BROWN, // VIA_BBLIND_VISIBLE - LIGHTGRAY, // VIA_THROUGH_VISIBLE - LIGHTGRAY, // MOD_TEXT_FR_VISIBLE + LIGHTGRAY, // unused + CYAN, // VIA_MICROVIA_VISIBLE + BROWN, // VIA_BBLIND_VISIBLE + LIGHTGRAY, // VIA_THROUGH_VISIBLE + YELLOW, // NON_PLATED_VISIBLE + LIGHTGRAY, // MOD_TEXT_FR_VISIBLE BLUE, // MOD_TEXT_BK_VISIBLE DARKGRAY, // MOD_TEXT_INVISIBLE BLUE, // ANCHOR_VISIBLE RED, // PAD_FR_VISIBLE GREEN, // PAD_BK_VISIBLE LIGHTGRAY, // RATSNEST_VISIBLE - DARKGRAY, //GRID_VISIBLE + DARKGRAY, // GRID_VISIBLE LIGHTRED, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, - LIGHTGRAY, LIGHTGRAY, - LIGHTGRAY, LIGHTGRAY, - LIGHTGRAY, LIGHTGRAY, - LIGHTGRAY, LIGHTGRAY, - LIGHTGRAY, - LIGHTGRAY, - LIGHTGRAY, - LIGHTGRAY, - LIGHTGRAY, - LIGHTGRAY, - LIGHTGRAY, - LIGHTGRAY + LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, + LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, + LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, LIGHTGRAY, + LIGHTGRAY, LIGHTGRAY, LIGHTGRAY }; -COLORS_DESIGN_SETTINGS:: COLORS_DESIGN_SETTINGS() +COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS() { for( unsigned ii = 0; ii < DIM(m_LayersColors); ii++ ) m_LayersColors[ii] = default_layer_color[ii]; diff --git a/include/layers_id_colors_and_visibility.h b/include/layers_id_colors_and_visibility.h index aabb15af40..c7dccae948 100644 --- a/include/layers_id_colors_and_visibility.h +++ b/include/layers_id_colors_and_visibility.h @@ -196,6 +196,7 @@ enum PCB_VISIBLE VIA_MICROVIA_VISIBLE, VIA_BBLIND_VISIBLE, VIA_THROUGH_VISIBLE, + NON_PLATED_VISIBLE, MOD_TEXT_FR_VISIBLE, MOD_TEXT_BK_VISIBLE, MOD_TEXT_INVISIBLE, ///< text marked as invisible diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 18f84dacfd..804d0d1875 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -637,6 +637,7 @@ EDA_COLOR_T BOARD::GetVisibleElementColor( int aPCB_VISIBLE ) switch( aPCB_VISIBLE ) { + case NON_PLATED_VISIBLE: case VIA_THROUGH_VISIBLE: case VIA_MICROVIA_VISIBLE: case VIA_BBLIND_VISIBLE: @@ -663,6 +664,7 @@ void BOARD::SetVisibleElementColor( int aPCB_VISIBLE, EDA_COLOR_T aColor ) { switch( aPCB_VISIBLE ) { + case NON_PLATED_VISIBLE: case VIA_THROUGH_VISIBLE: case VIA_MICROVIA_VISIBLE: case VIA_BBLIND_VISIBLE: diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index f0e8ba1af9..ed5e4cf1b3 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -524,7 +524,7 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList ) wxString msg = module->GetReference(); aList.push_back( MSG_PANEL_ITEM( _( "Module" ), msg, DARKCYAN ) ); ReturnStringPadName( Line ); - aList.push_back( MSG_PANEL_ITEM( _( "RefP" ), Line, BROWN ) ); + aList.push_back( MSG_PANEL_ITEM( _( "Pad" ), Line, BROWN ) ); } aList.push_back( MSG_PANEL_ITEM( _( "Net" ), m_Netname, DARKCYAN ) ); diff --git a/pcbnew/class_pad_draw_functions.cpp b/pcbnew/class_pad_draw_functions.cpp index c8fa9f75c7..884a637314 100644 --- a/pcbnew/class_pad_draw_functions.cpp +++ b/pcbnew/class_pad_draw_functions.cpp @@ -79,7 +79,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode, #ifdef SHOW_PADMASK_REAL_SIZE_AND_COLOR int showActualMaskSize = 0; /* Layer number if the actual pad size on mask layer can * be displayed i.e. if only one layer is shown for this pad - * and this layer is a mask (solder mask or sloder paste + * and this layer is a mask (solder mask or solder paste */ #endif @@ -229,13 +229,13 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode, // layer so we can see pads on paste or solder layer and the size of the // mask if( ( aDraw_mode & GR_ALLOW_HIGHCONTRAST ) && - DisplayOpt.ContrastModeDisplay && screen->m_Active_Layer > LAST_COPPER_LAYER ) + DisplayOpt.ContrastModeDisplay && screen->m_Active_Layer >= FIRST_NON_COPPER_LAYER ) { if( IsOnLayer( screen->m_Active_Layer ) ) { color = brd->GetLayerColor( screen->m_Active_Layer ); - // In hight contrast mode, and if the active layer is the mask + // In high contrast mode, and if the active layer is the mask // layer shows the pad size with the mask clearance switch( screen->m_Active_Layer ) { @@ -268,8 +268,12 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode, if( ( m_layerMask & ALL_CU_LAYERS ) == 0 ) DisplayIsol = false; - if( GetAttribute() == PAD_HOLE_NOT_PLATED ) + if( ( GetAttribute() == PAD_HOLE_NOT_PLATED ) && + brd->IsElementVisible( NON_PLATED_VISIBLE ) ) + { drawInfo.m_ShowNotPlatedHole = true; + drawInfo.m_NPHoleColor = brd->GetVisibleElementColor( NON_PLATED_VISIBLE ); + } drawInfo.m_DrawMode = aDraw_mode; drawInfo.m_Color = color; @@ -286,7 +290,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode, */ drawInfo.m_PadClearance = DisplayIsol ? GetClearance() : 0; - /* Draw the pad number */ + // Draw the pad number if( frame && !frame->m_DisplayPadNum ) drawInfo.m_Display_padnum = false; @@ -360,7 +364,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) seg_width, m_PadSketchModePenSize, aDrawInfo.m_Color ); } - /* Draw the isolation line. */ + // Draw the clearance line if( aDrawInfo.m_PadClearance ) { seg_width += 2 * aDrawInfo.m_PadClearance; @@ -392,18 +396,17 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) } break; - default: break; } - /* Draw the pad hole */ + // Draw the pad hole wxPoint holepos = m_Pos - aDrawInfo.m_Offset; int hole = m_Drill.x >> 1; bool drawhole = hole > 0; - if( !aDrawInfo.m_ShowPadFilled && !aDrawInfo. m_ShowNotPlatedHole ) + if( !aDrawInfo.m_ShowPadFilled && !aDrawInfo.m_ShowNotPlatedHole ) drawhole = false; if( drawhole ) @@ -439,13 +442,13 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) halfsize.x = m_Drill.x >> 1; halfsize.y = m_Drill.y >> 1; - if( m_Drill.x > m_Drill.y ) /* horizontal */ + if( m_Drill.x > m_Drill.y ) // horizontal { delta_cx = halfsize.x - halfsize.y; delta_cy = 0; seg_width = m_Drill.y; } - else /* vertical */ + else // vertical { delta_cx = 0; delta_cy = halfsize.y - halfsize.x; @@ -469,7 +472,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) GRSetDrawMode( aDC, aDrawInfo.m_DrawMode ); - /* Draw "No connect" ( / or \ or cross X ) if necessary. : */ + // Draw "No connect" ( / or \ or cross X ) if necessary if( m_Netname.IsEmpty() && aDrawInfo.m_ShowNCMark ) { int dx0 = std::min( halfsize.x, halfsize.y ); @@ -479,12 +482,12 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) GRLine( aClipBox, aDC, holepos.x - dx0, holepos.y - dx0, holepos.x + dx0, holepos.y + dx0, 0, nc_color ); - if( m_layerMask & LAYER_BACK ) /* Draw / */ + if( m_layerMask & LAYER_BACK ) // Draw / GRLine( aClipBox, aDC, holepos.x + dx0, holepos.y - dx0, holepos.x - dx0, holepos.y + dx0, 0, nc_color ); } - /* Draw the pad number */ + // Draw the pad number if( !aDrawInfo.m_Display_padnum && !aDrawInfo.m_Display_netname ) return; @@ -627,8 +630,7 @@ void D_PAD::BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, int aRotat halfsize.x = m_Size.x >> 1; halfsize.y = m_Size.y >> 1; - /* For rectangular shapes, inflate is easy - */ + // For rectangular shapes, inflate is easy if( GetShape() == PAD_RECT ) { halfsize += aInflateValue; diff --git a/pcbnew/class_pcb_layer_widget.cpp b/pcbnew/class_pcb_layer_widget.cpp index 944801ce9d..e115e44f1c 100644 --- a/pcbnew/class_pcb_layer_widget.cpp +++ b/pcbnew/class_pcb_layer_widget.cpp @@ -55,6 +55,7 @@ const LAYER_WIDGET::ROW PCB_LAYER_WIDGET::s_render_rows[] = { RR( _( "Through Via" ), VIA_THROUGH_VISIBLE, WHITE, _( "Show through vias" ) ), RR( _( "Bl/Buried Via" ), VIA_BBLIND_VISIBLE, WHITE, _( "Show blind or buried vias" ) ), RR( _( "Micro Via" ), VIA_MICROVIA_VISIBLE, WHITE, _( "Show micro vias") ), + RR( _( "Non Plated" ), NON_PLATED_VISIBLE, WHITE, _( "Show non plated holes") ), RR( _( "Ratsnest" ), RATSNEST_VISIBLE, WHITE, _( "Show unconnected nets as a ratsnest") ), RR( _( "Pads Front" ), PAD_FR_VISIBLE, WHITE, _( "Show footprint pads on board's front" ) ), diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index b1289ecfda..fa622281c5 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -439,6 +439,9 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings() m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorViaMicroEx" ), ITEM_COLOR( VIA_MICROVIA_VISIBLE ), CYAN ) ); + m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorNonPlatedEx" ), + ITEM_COLOR( NON_PLATED_VISIBLE ), + YELLOW ) ); m_configSettings.push_back( new PARAM_CFG_SETCOLOR( true, wxT( "ColorRatsEx" ), ITEM_COLOR( RATSNEST_VISIBLE ), WHITE ) ); From e04b6a04a6ca127bedf41c250b2a2bfe9c18a569 Mon Sep 17 00:00:00 2001 From: Marco Mattila Date: Sun, 7 Apr 2013 21:49:13 +0300 Subject: [PATCH 53/63] Use the boundary of the object and not just the boundary of the text in SCH_TEXT hit testing. --- eeschema/sch_text.cpp | 28 ++++++++++------------------ eeschema/sch_text.h | 6 ------ 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index 9802fcd708..6eb22f2574 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -643,13 +643,21 @@ void SCH_TEXT::GetNetListItem( vector& aNetListItems, bool SCH_TEXT::HitTest( const wxPoint& aPosition, int aAccuracy ) const { - return TextHitTest( aPosition, aAccuracy ); + EDA_RECT bBox = GetBoundingBox(); + bBox.Inflate( aAccuracy ); + return bBox.Contains( aPosition ); } bool SCH_TEXT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy ) const { - return TextHitTest( aRect, aContained, aAccuracy ); + EDA_RECT bBox = GetBoundingBox(); + bBox.Inflate( aAccuracy ); + + if( aContained ) + return aRect.Contains( bBox ); + + return aRect.Intersects( bBox ); } @@ -1019,11 +1027,6 @@ wxString SCH_LABEL::GetSelectMenuText() const } -bool SCH_LABEL::HitTest( const wxPoint& aPosition, int aAccuracy ) const -{ - return TextHitTest( aPosition, aAccuracy ); -} - SCH_GLOBALLABEL::SCH_GLOBALLABEL( const wxPoint& pos, const wxString& text ) : SCH_TEXT( pos, text, SCH_GLOBAL_LABEL_T ) @@ -1454,11 +1457,6 @@ wxString SCH_GLOBALLABEL::GetSelectMenuText() const } -bool SCH_GLOBALLABEL::HitTest( const wxPoint& aPosition, int aAccuracy ) const -{ - return TextHitTest( aPosition, aAccuracy ); -} - SCH_HIERLABEL::SCH_HIERLABEL( const wxPoint& pos, const wxString& text, KICAD_T aType ) : SCH_TEXT( pos, text, aType ) @@ -1802,9 +1800,3 @@ wxString SCH_HIERLABEL::GetSelectMenuText() const msg.Printf( _( "Hierarchical Label %s" ), GetChars( tmp ) ); return msg; } - - -bool SCH_HIERLABEL::HitTest( const wxPoint& aPosition, int aAccuracy ) const -{ - return TextHitTest( aPosition, aAccuracy ); -} diff --git a/eeschema/sch_text.h b/eeschema/sch_text.h index 2d2bc481f6..dff401acc6 100644 --- a/eeschema/sch_text.h +++ b/eeschema/sch_text.h @@ -262,8 +262,6 @@ public: bool IsReplaceable() const { return true; } - bool HitTest( const wxPoint& aPosition, int aAccuracy ) const; - EDA_ITEM* Clone() const; private: @@ -315,8 +313,6 @@ public: BITMAP_DEF GetMenuImage() const { return add_glabel_xpm; } - bool HitTest( const wxPoint& aPosition, int aAccuracy ) const; - EDA_ITEM* Clone() const; private: @@ -370,8 +366,6 @@ public: BITMAP_DEF GetMenuImage() const { return add_hierarchical_label_xpm; } - bool HitTest( const wxPoint& aPosition, int aAccuracy ) const; - EDA_ITEM* Clone() const; private: From 7bb04c8f63f2c73be8638937d044c65d75ad5a82 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 8 Apr 2013 09:13:26 +0200 Subject: [PATCH 54/63] Make some messages translatable. Make dialog footprint wizard list resizable. --- pcbnew/class_track.cpp | 42 +++++++++++-------- .../dialogs/dialog_footprint_wizard_list.fbp | 14 +++---- .../dialog_footprint_wizard_list_base.cpp | 18 ++++---- .../dialog_footprint_wizard_list_base.h | 6 ++- 4 files changed, 45 insertions(+), 35 deletions(-) diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index be84b15d29..1edb513bae 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -197,40 +197,46 @@ EDA_ITEM* SEGVIA::Clone() const wxString SEGVIA::GetSelectMenuText() const { + // Note: we use here Printf to make message translatable. wxString text; + wxString format; NETINFO_ITEM* net; BOARD* board = GetBoard(); int shape = GetShape(); if( shape == VIA_BLIND_BURIED ) - text << wxT( " " ) << _( "Blind/Buried " ); + format = _( "Blind/Buried Via %s, net[%s] (%d) on layers %s/%s" ); else if( shape == VIA_MICROVIA ) - text << wxT( " " ) << _( "Micro " ); + format = _( "Micro Via %s, Net [%s] (%d) on layers %s/%s" ); // else say nothing about normal (through) vias - - text << _( "Via" ) << wxT( " " ) << ShowWidth(); + else format = _( "Via %s net [%s] (%d) on layers %s/%s" ); if( board ) { net = board->FindNet( GetNet() ); + wxString netname; if( net ) - text << wxT( " [" ) << net->GetNetname() << wxT( "]" ); - - text << wxChar( ' ' ) << _( "Net:" ) << GetNet(); + netname = net->GetNetname(); // say which layers, only two for now LAYER_NUM topLayer; LAYER_NUM botLayer; ReturnLayerPair( &topLayer, &botLayer ); - text << _( " on " ) << board->GetLayerName( topLayer ) << wxT( "/" ) - << board->GetLayerName( botLayer ); + text.Printf( format.GetData(), GetChars( ShowWidth() ), + GetChars( netname ), GetNet(), + GetChars( board->GetLayerName( topLayer ) ), + GetChars( board->GetLayerName( botLayer ) ) ); + } else { wxFAIL_MSG( wxT( "SEGVIA::GetSelectMenuText: BOARD is NULL" ) ); text << wxT( "???" ); + text.Printf( format.GetData(), GetChars( ShowWidth() ), + wxT( "???" ), 0, + wxT( "??" ), wxT( "??" ) ); } return text; @@ -1116,7 +1122,7 @@ void TRACK::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList ) LAYER_NUM top_layer, bottom_layer; Via->ReturnLayerPair( &top_layer, &bottom_layer ); - msg = board->GetLayerName( top_layer ) + wxT( "/" ) + msg = board->GetLayerName( top_layer ) + wxT( "/" ) + board->GetLayerName( bottom_layer ); } else @@ -1507,29 +1513,31 @@ int TRACK::GetEndSegments( int aCount, TRACK** aStartTrace, TRACK** aEndTrace ) wxString TRACK::GetSelectMenuText() const { wxString text; - wxString temp; + wxString netname; NETINFO_ITEM* net; BOARD* board = GetBoard(); // deleting tracks requires all the information we can get to // disambiguate all the choices under the cursor! - text << _( "Track" ) << wxT( " " ) << ShowWidth(); - if( board ) { net = board->FindNet( GetNet() ); if( net ) - text << wxT( " [" ) << net->GetNetname() << wxT( "]" ); + netname = net->GetNetname(); + else + netname = _("Not found"); } else { wxFAIL_MSG( wxT( "TRACK::GetSelectMenuText: BOARD is NULL" ) ); - text << wxT( "???" ); + netname = wxT( "???" ); } - text << _( " on " ) << GetLayerName() << wxT(", ") << _("Net:") << GetNet() - << wxT(", ") << _("Length:") << ::LengthDoubleToString( GetLength() ); + text.Printf( _("Track %s, net [%s] (%d) on layer %s, length: %s" ), + GetChars( ShowWidth() ), GetChars( netname ), + GetNet(), GetLayerName(), + GetChars( ::LengthDoubleToString( GetLength() ) ) ); return text; } diff --git a/pcbnew/dialogs/dialog_footprint_wizard_list.fbp b/pcbnew/dialogs/dialog_footprint_wizard_list.fbp index ea4218b74e..7060f4a00f 100644 --- a/pcbnew/dialogs/dialog_footprint_wizard_list.fbp +++ b/pcbnew/dialogs/dialog_footprint_wizard_list.fbp @@ -39,11 +39,11 @@ 0 wxID_ANY - + 400,200 DIALOG_FOOTPRINT_WIZARD_LIST_BASE - - wxDEFAULT_DIALOG_STYLE + 404,200 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Footprint Wizards @@ -88,12 +88,12 @@ - bSizer4 + bSizerMain wxVERTICAL none 5 - wxALL + wxALL|wxEXPAND 1 1 @@ -153,7 +153,7 @@ 0 - -1,120 + 485,120 1 m_footprintWizardsGrid 1 @@ -255,7 +255,7 @@ 1 1 - 0 + 1 0 Dock 0 diff --git a/pcbnew/dialogs/dialog_footprint_wizard_list_base.cpp b/pcbnew/dialogs/dialog_footprint_wizard_list_base.cpp index 6bdf498878..6a0aabd45c 100644 --- a/pcbnew/dialogs/dialog_footprint_wizard_list_base.cpp +++ b/pcbnew/dialogs/dialog_footprint_wizard_list_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 10 2012) +// C++ code generated with wxFormBuilder (version Oct 8 2012) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -11,10 +11,10 @@ DIALOG_FOOTPRINT_WIZARD_LIST_BASE::DIALOG_FOOTPRINT_WIZARD_LIST_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 ); + this->SetSizeHints( wxSize( 400,200 ), wxDefaultSize ); - wxBoxSizer* bSizer4; - bSizer4 = new wxBoxSizer( wxVERTICAL ); + wxBoxSizer* bSizerMain; + bSizerMain = new wxBoxSizer( wxVERTICAL ); m_footprintWizardsGrid = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); @@ -47,17 +47,17 @@ DIALOG_FOOTPRINT_WIZARD_LIST_BASE::DIALOG_FOOTPRINT_WIZARD_LIST_BASE( wxWindow* // Cell Defaults m_footprintWizardsGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); - m_footprintWizardsGrid->SetMinSize( wxSize( -1,120 ) ); + m_footprintWizardsGrid->SetMinSize( wxSize( 485,120 ) ); - bSizer4->Add( m_footprintWizardsGrid, 1, wxALL, 5 ); + bSizerMain->Add( m_footprintWizardsGrid, 1, wxALL|wxEXPAND, 5 ); m_btOpen = new wxButton( this, wxID_ANY, _("Open"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer4->Add( m_btOpen, 0, wxALIGN_CENTER|wxALL, 5 ); + m_btOpen->SetDefault(); + bSizerMain->Add( m_btOpen, 0, wxALIGN_CENTER|wxALL, 5 ); - this->SetSizer( bSizer4 ); + this->SetSizer( bSizerMain ); this->Layout(); - bSizer4->Fit( this ); this->Centre( wxBOTH ); diff --git a/pcbnew/dialogs/dialog_footprint_wizard_list_base.h b/pcbnew/dialogs/dialog_footprint_wizard_list_base.h index 974728e6b4..8b7c0abb31 100644 --- a/pcbnew/dialogs/dialog_footprint_wizard_list_base.h +++ b/pcbnew/dialogs/dialog_footprint_wizard_list_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 10 2012) +// C++ code generated with wxFormBuilder (version Oct 8 2012) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -11,6 +11,8 @@ #include #include #include +class DIALOG_SHIM; + #include "dialog_shim.h" #include #include @@ -43,7 +45,7 @@ class DIALOG_FOOTPRINT_WIZARD_LIST_BASE : public DIALOG_SHIM public: - DIALOG_FOOTPRINT_WIZARD_LIST_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Footprint Wizards"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + DIALOG_FOOTPRINT_WIZARD_LIST_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Footprint Wizards"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 404,200 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_FOOTPRINT_WIZARD_LIST_BASE(); }; From 6bf3d7cdc3e463f608b711aa08102196cd1f6c55 Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Mon, 8 Apr 2013 16:04:45 -0500 Subject: [PATCH 55/63] Implement "KiCad s-epression" support for boost::property_tree's ptree, the 8 bit string version of property_tree. The ram resident structure of the ptree is mostly compatible with one created using the xml_parser from boost::property_tree, with slight differences in the way atoms are stored. The result is you can use Format() to convert from xml to s-expression, but not the other way around. You can write a simple s-expression beautifier in just a few lines of code. The main value however is the s-expression parser, i.e. Scan(), which is an alternative to crafting a custom recursive descent parser for a particular grammar. The tipping point depends on whether you want to read only a small portion of a much larger document. If so, then using the ptree will likely be a "faster to code" route. Documentation on how to navigate a ptree can be found on the boost website and there are a number of examples in the pcbnew/eagle_plugin.cpp file in this project. Powerful path navigation support makes it easy to extract a subset of a ptree. --- common/CMakeLists.txt | 1 + common/ptree.cpp | 226 +++++++++++++++++++++++++++++++ include/ptree.h | 96 +++++++++++++ tools/CMakeLists.txt | 7 +- tools/parser_gen.cpp | 290 ---------------------------------------- tools/property_tree.cpp | 91 +++++++++++++ 6 files changed, 418 insertions(+), 293 deletions(-) create mode 100644 common/ptree.cpp create mode 100644 include/ptree.h delete mode 100644 tools/parser_gen.cpp create mode 100644 tools/property_tree.cpp diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 6c17b8496d..b0d61ebd8c 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -71,6 +71,7 @@ set(COMMON_SRCS netlist_keywords.cpp newstroke_font.cpp projet_config.cpp + ptree.cpp richio.cpp selcolor.cpp string.cpp diff --git a/common/ptree.cpp b/common/ptree.cpp new file mode 100644 index 0000000000..bb1db39eb4 --- /dev/null +++ b/common/ptree.cpp @@ -0,0 +1,226 @@ + +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck + * Copyright (C) 2013 KiCad Developers, see CHANGELOG.TXT for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include + +#include +#include +#include + +typedef PTREE::const_iterator CITER; +typedef PTREE::iterator ITER; + +#if defined(DEBUG) + #define D(x) x +#else + #define D(x) +#endif + +#define CTL_OMIT_NL (1<<0) +#define CTL_IN_ATTRS (1<<1) + + +//----------------------------------------------------------------------- + +/** + * Function scanList + * reads a sexpr list from the input stream into a new node with key + * aLexer->CurText(). + */ +inline void scanList( PTREE* aTree, DSNLEXER* aLexer ) +{ + assert( aLexer->CurTok() == DSN_LEFT ); + + int tok = aLexer->NextTok(); + + const char* key = aLexer->CurText(); + + //D(printf( "%s: '%s'\n", __func__, key );) + + PTREE* list = &aTree->push_back( PTREE::value_type( key, PTREE() ) )->second; + + if( tok != DSN_RIGHT ) + { + while( ( tok = aLexer->NextTok() ) != DSN_RIGHT ) + { + if( tok == DSN_EOF ) + aLexer->Unexpected( DSN_EOF ); + + Scan( list, aLexer ); + } + } +} + + +inline void scanAtom( PTREE* aTree, DSNLEXER* aLexer ) +{ + const char* key = aLexer->CurText(); + + //D(printf( "%s: '%s'\n", __func__, key );) + + aTree->push_back( PTREE::value_type( key, PTREE() ) ); +} + + +void Scan( PTREE* aTree, DSNLEXER* aLexer ) throw( IO_ERROR ) +{ + int tok = aLexer->CurTok(); + + // conditionally read first token. + if( tok == DSN_NONE ) + tok = aLexer->NextTok(); + + if( tok == DSN_EOF ) + { + aLexer->Unexpected( DSN_EOF ); + } + + if( tok == DSN_LEFT ) + { + scanList( aTree, aLexer ); + } + else + { + scanAtom( aTree, aLexer ); + } +} + + +//----------------------------------------------------------------------- + +inline bool isAtom( CPTREE& aTree ) +{ + return aTree.size()==0 && aTree.data().size()==0; +} + + +inline bool isLast( CPTREE& aTree, CITER it ) +{ + CITER next = it; + ++next; + return next == aTree.end(); +} + + +inline CITER next( CITER it ) +{ + CITER n = it; + return ++n; +} + + +static void formatNode( OUTPUTFORMATTER* out, int aNestLevel, int aCtl, + const std::string& aKey, CPTREE& aTree ) throw( IO_ERROR ); + + +static void formatList( OUTPUTFORMATTER* out, int aNestLevel, int aCtl, CPTREE& aTree ) + throw( IO_ERROR ) +{ + for( CITER it = aTree.begin(); it != aTree.end(); ++it ) + { + // Processing a tree which was read in with xml_parser? + if( it->first == "" ) + { + formatList( out, aNestLevel, aCtl | CTL_IN_ATTRS, it->second ); + continue; + } + + int ctl = 0; + +#if defined(DEBUG) + if( it->first == "field" ) + { + int breakhere = 1; + (void) breakhere; + } +#endif + + if( isLast( aTree, it ) ) // is "it" the last one? + { + //if( !( aCtl & CTL_IN_ATTRS ) ) + ctl = CTL_OMIT_NL; + } + else if( isAtom( next( it )->second ) ) + { + /* if( !( aCtl & CTL_IN_ATTRS ) ) */ + ctl = CTL_OMIT_NL; + } + + formatNode( out, aNestLevel+1, ctl, it->first, it->second ); + } +} + + +static void formatNode( OUTPUTFORMATTER* out, int aNestLevel, int aCtl, + const std::string& aKey, CPTREE& aTree ) + throw( IO_ERROR ) +{ + if( !isAtom( aTree ) ) // is a list, not an atom + { + int ctl = CTL_OMIT_NL; + + // aTree is list and its first child is a list + if( aTree.size() && !isAtom( aTree.begin()->second ) && !aTree.data().size() ) + ctl = 0; + + out->Print( aNestLevel, "(%s%s", out->Quotes( aKey ).c_str(), ctl & CTL_OMIT_NL ? "" : "\n" ); + + if( aTree.data().size() ) // only xml typically uses "data()", not sexpr. + { + out->Print( 0, " %s%s", + out->Quotes( aTree.data() ).c_str(), + aTree.size() ? "\n" : "" + ); + } + + formatList( out, aNestLevel, aCtl, aTree ); + + out->Print( 0, ")%s", aCtl & CTL_OMIT_NL ? "" : "\n" ); + } + + else // is an atom, not a list + { + const char* atom = out->Quotes( aKey ).c_str(); + out->Print( 0, " %s", atom ); + } +} + + +void Format( OUTPUTFORMATTER* out, int aNestLevel, int aCtl, CPTREE& aTree ) throw( IO_ERROR ) +{ + if( aTree.size() == 1 && !aTree.data().size() ) + { + // The topmost node is basically only a container for the document root. + // It anchors the paths which traverse the tree deeper. + CITER it = aTree.begin(); + formatNode( out, aNestLevel, aCtl, it->first, it->second ); + } + else + { + // This is not expected, neither for sexpr nor xml. + formatNode( out, aNestLevel, aCtl, "", aTree ); + } +} + diff --git a/include/ptree.h b/include/ptree.h new file mode 100644 index 0000000000..66943c63f9 --- /dev/null +++ b/include/ptree.h @@ -0,0 +1,96 @@ +#ifndef PTREE_H_ +#define PTREE_H_ + +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck + * Copyright (C) 2013 KiCad Developers, see CHANGELOG.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 + */ + + +/* + +Implement "KiCad s-epression" support for boost::property_tree's ptree, the 8 +bit string version of property_tree. The ram resident structure of the ptree is +mostly compatible with one created using the xml_parser from +boost::property_tree, with slight differences in the way atoms are stored. The +result is you can use Format() to convert from xml to s-expression, but not the +other way around. You can write a simple s-expression beautifier in just a few +lines of code. + +The main value however is the s-expression parser, i.e. Scan(), which is an +alternative to crafting a custom recursive descent parser for a particular +grammar. The tipping point depends on whether you want to read only a small +portion of a much larger document. If so, then using the ptree will likely be a +"faster to code" route. Documentation on how to navigate a ptree can be found on +the boost website and there are a number of examples in the +pcbnew/eagle_plugin.cpp file in this project. Powerful path navigation support +makes it easy to extract a subset of a ptree. + +*/ + + +#include +#include +#include + +typedef boost::property_tree::ptree PTREE; +typedef const PTREE CPTREE; + + +/** + * Function Scan + * fills an empty PTREE with information from a KiCad s-expresion stream. Use + * a DSNLEXER with an empty keyword table as @a aLexer. Useful for parsing + * s-expression files or strings of arbitrary grammars, say from a file or clipboard. + * The s-expression must be "KiCad compatible". See Documentation/s-expressions.txt + * for this KiCad compatible definition (it is the non-specctra mode). + * And also see in tools/property_tree.cpp for example usage. + * + * + * + * FILE* fp = fopen( argv[1], "r" ); + * + * static const KEYWORD empty_keywords[1] = {}; + * + * DSNLEXER lexer( empty_keywords, 0, fp, wxString( FROM_UTF8( argv[1] ) ) ); + * + * try + * { + * PTREE doc; + * Scan( &doc, &lexer ); + * } + * catch( IO_ERROR ioe ) + * { + * fprintf( stderr, "%s\n", TO_UTF8( ioe.errorText ) ); + * } + * + * + */ +void Scan( PTREE* aTree, DSNLEXER* aLexer ) throw ( IO_ERROR ); + +/** + * Function Format + * outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative. + */ +void Format( OUTPUTFORMATTER* out, int aNestLevel, int aCtl, CPTREE& aTree ) throw( IO_ERROR ); + +#endif // PTREE_H_ diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 3a91d948b3..daebd3fc47 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -65,13 +65,14 @@ add_executable( test-nm-biu-to-ascii-mm-round-tripping test-nm-biu-to-ascii-mm-round-tripping.cpp ) -add_executable( parser_gen +add_executable( property_tree EXCLUDE_FROM_ALL - parser_gen.cpp + property_tree.cpp ../common/richio.cpp ../common/dsnlexer.cpp + ../common/ptree.cpp ) -target_link_libraries( parser_gen +target_link_libraries( property_tree ${wxWidgets_LIBRARIES} ) diff --git a/tools/parser_gen.cpp b/tools/parser_gen.cpp deleted file mode 100644 index 1b42f39939..0000000000 --- a/tools/parser_gen.cpp +++ /dev/null @@ -1,290 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 2012 KiCad Developers, see CHANGELOG.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 - */ - - -// This is wanting to be an s-expression C++ parser generator. Feed it a sample -// file and maybe someday it will generate a C++ file which uses DSNLEXER to -// parse the described grammar OK. - -// Until then, it is a non-specctra mode s-expression beautifier. - - -#include -#include -#include -#include -#include - - -// http://sexpr.sourceforge.net/ see comments about graphviz -// http://www.codeproject.com/KB/recipes/JSON_Spirit.aspx - -#define D(x) x -//#define D(x) - - -/** - * Class ELEM - */ -class ELEM -{ -protected: - int token; - std::string text; - - typedef boost::ptr_vector ELEMS; - typedef ELEMS::const_iterator ELEMS_CITER; - typedef ELEMS::iterator ELEMS_ITER; - - ELEMS kids; ///< ELEM pointers - -public: - - // there are two constructors, one for a list, one for an atom - - /// List constructor - ELEM( int aToken ) : - token( aToken ), - text( "" ) - { - // D( printf( "ELEM%p: list\n", this ); ) - } - - /// Atom constructor - ELEM( const std::string& aText, int aToken ) : - token( aToken ), - text( aText ) - { - // D( printf( "ELEM%p: '%s'\n", this, text.c_str() ); ) - } - - int Token() const { return token; } - - const char* Text() { return text.c_str(); } - - - /** - * Function Format - * writes this object as ASCII out to an OUTPUTFORMATTER - * @param out The formatter to write to. - * @param nestLevel A multiple of the number of spaces to preceed the output with. - * @throw IO_ERROR if a system error writing the output, such as a full disk. - */ - void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel = 0, int aControlBits = 0 ); - -#define CTL_OMIT_NL (1<<0) - - /** - * Function Length - * returns the number of ELEMs in this ELEM. - * @return int - the count of children - */ - int Length() const - { - return kids.size(); - } - - void Append( ELEM* aElem ) - { - kids.push_back( aElem ); - } - - ELEM* Replace( int aIndex, ELEM* aElem ) - { - ELEMS::auto_type ret = kids.replace( aIndex, aElem ); - return ret.release(); - } - - ELEM* Remove( int aIndex ) - { - ELEMS::auto_type ret = kids.release( kids.begin()+aIndex ); - return ret.release(); - } - - void Insert( int aIndex, ELEM* aElem ) - { - kids.insert( kids.begin()+aIndex, aElem ); - } - - ELEM* At( int aIndex ) const - { - const ELEM& ref = kids.at( aIndex ); - return (ELEM*) &ref; - } - - ELEM* operator[]( int aIndex ) const - { - return At( aIndex ); - } - - void Delete( int aIndex ) - { - kids.erase( kids.begin()+aIndex ); - } -}; - - -void ELEM::Format( OUTPUTFORMATTER* out, int nestLevel, int ctl ) -{ - if( token == DSN_LEFT ) // this is a list - { - out->Print( nestLevel, "(" ); - - const int count = Length(); - for( int i=0; i 0 ) - out->Print( 0, " " ); - - if( next && next->token == DSN_LEFT ) - { - cur->Format( out, nestLevel+1, 0 ); - } - else - { - cur->Format( out, nestLevel+1, CTL_OMIT_NL ); - } - } - - out->Print( 0, ")%s", ctl & CTL_OMIT_NL ? "" : "\n" ); - } - else // this is an atom - { - const char* s = out->Quotes( text ).c_str(); - out->Print( 0, "%s%s", s, ctl & CTL_OMIT_NL ? "" : "\n" ); - } -} - -ELEM* Scan( DSNLEXER* lex ); -ELEM* ScanList( DSNLEXER* lex ); -ELEM* ScanAtom( DSNLEXER* lex ); - - -void usage() -{ - fprintf( stderr, "Usage: parser_gen \n" ); - exit( 1 ); -} - - -static KEYWORD empty_keywords[1] = {}; - - -ELEM* Scan( DSNLEXER* lex ) -{ - ELEM* elem = NULL; - int tok = lex->CurTok(); - - // conditionally read first token. - if( tok == DSN_NONE ) - tok = lex->NextTok(); - - if( tok == DSN_EOF ) - { - lex->Unexpected( DSN_EOF ); - } - - if( tok == DSN_LEFT ) - { - elem = ScanList( lex ); - } - else - { - elem = ScanAtom( lex ); - } - - return elem; -} - - -/** - * Function ScanList - * reads and returns a sexpList from the input stream. - */ -ELEM* ScanList( DSNLEXER* lex ) -{ - int tok; - ELEM* list = NULL; - - assert( lex->CurTok() == DSN_LEFT ); - - list = new ELEM( DSN_LEFT ); - - while( ( tok = lex->NextTok() ) != DSN_RIGHT ) - { - if( tok == DSN_EOF ) - lex->Unexpected( DSN_EOF ); - - ELEM* elem = Scan( lex ); - list->Append( elem ); - } - - return list; -} - - -ELEM* ScanAtom( DSNLEXER* lex ) -{ - return new ELEM( lex->CurText(), lex->CurTok() ); -} - - -int main( int argc, char** argv ) -{ - if( argc != 2 ) - { - usage(); - } - - FILE* fp = fopen( argv[1], "rt" ); - if( !fp ) - { - fprintf( stderr, "Unable to open '%s'\n", argv[1] ); - usage(); - } - - DSNLEXER lexer( empty_keywords, 0, fp, wxString( FROM_UTF8( argv[1] ) ) ); - - try - { - ELEM* elem = Scan( &lexer ); - - if( elem ) - { - STRING_FORMATTER sf; - - elem->Format( &sf, 0 ); - - printf( "%s", sf.GetString().c_str() ); - } - } - catch( IO_ERROR ioe ) - { - fprintf( stderr, "%s\n", TO_UTF8( ioe.errorText ) ); - } -} - diff --git a/tools/property_tree.cpp b/tools/property_tree.cpp new file mode 100644 index 0000000000..ea1bb77175 --- /dev/null +++ b/tools/property_tree.cpp @@ -0,0 +1,91 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck + * Copyright (C) 2012 KiCad Developers, see CHANGELOG.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 + */ + + +// This is a propertytree test utility. +// It can convert XML to sexpressions or beautify s-expressions in non-specctra mode. + + +#include +#include +#include +#include +#include +#include + + +void usage() +{ + fprintf( stderr, "Usage: parser_gen \n" ); + exit( 1 ); +} + + +int main( int argc, char** argv ) +{ + if( argc != 2 ) + { + usage(); + } + + FILE* fp = fopen( argv[1], "r" ); + if( !fp ) + { + fprintf( stderr, "Unable to open '%s'\n", argv[1] ); + usage(); + } + + static const KEYWORD empty_keywords[1] = {}; + + DSNLEXER lexer( empty_keywords, 0, fp, wxString( FROM_UTF8( argv[1] ) ) ); + + try + { + PTREE doc; + +#if 0 + using namespace boost::property_tree; + + read_xml( argv[1], doc, xml_parser::trim_whitespace | xml_parser::no_comments ); +#else + Scan( &doc, &lexer ); +#endif + +#if 1 + STRING_FORMATTER sf; + Format( &sf, 0, 0, doc ); + printf( "%s", sf.GetString().c_str() ); +#else + // writing the unchanged ptree in file2.xml + boost::property_tree::xml_writer_settings settings( ' ', 2 ); + write_xml( "/tmp/output.xml", doc, std::locale(), settings ); +#endif + + } + catch( IO_ERROR ioe ) + { + fprintf( stderr, "%s\n", TO_UTF8( ioe.errorText ) ); + } +} + From 477069c063d1f49f79de482270cbb548e2ec555f Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Mon, 8 Apr 2013 20:16:53 -0400 Subject: [PATCH 56/63] Fix compile bug in ptree.cpp with wxWidgets 2.9.x and MinGW. --- common/ptree.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/ptree.cpp b/common/ptree.cpp index bb1db39eb4..19cb21f94f 100644 --- a/common/ptree.cpp +++ b/common/ptree.cpp @@ -23,10 +23,13 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +// Something in either causes a bunch of compiler +// errors in version 2.9 on MinGW. +#include + #include #include -#include #include typedef PTREE::const_iterator CITER; From 0de48234bc630635cff68df0be3048ff5b79361b Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Tue, 9 Apr 2013 04:31:36 +0200 Subject: [PATCH 57/63] Printf was missing a GetChars --- pcbnew/class_track.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index 1edb513bae..96586180e1 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -1536,7 +1536,7 @@ wxString TRACK::GetSelectMenuText() const text.Printf( _("Track %s, net [%s] (%d) on layer %s, length: %s" ), GetChars( ShowWidth() ), GetChars( netname ), - GetNet(), GetLayerName(), + GetNet(), GetChars( GetLayerName() ), GetChars( ::LengthDoubleToString( GetLength() ) ) ); return text; From b525e3be551584ecc7f90afce09d2ce6b412841c Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Tue, 9 Apr 2013 18:00:46 +0200 Subject: [PATCH 58/63] Factored out text anchor drawing More layer classification cleanup --- common/class_layer_box_selector.cpp | 4 +- common/dsnlexer.cpp | 2 +- common/eda_text.cpp | 18 ++----- common/gr_basic.cpp | 13 +++++ common/wxwineda.cpp | 1 + cvpcb/cvpcb.h | 1 - gerbview/class_gbr_layer_box_selector.cpp | 8 +-- gerbview/class_gbr_layer_box_selector.h | 6 +-- gerbview/class_gbr_layout.cpp | 6 +-- gerbview/class_gbr_layout.h | 4 +- .../dialogs/dialog_print_using_printer.cpp | 2 +- gerbview/export_to_pcbnew.cpp | 2 +- gerbview/gerbview_frame.cpp | 8 +-- gerbview/gerbview_frame.h | 4 +- gerbview/readgerb.cpp | 1 + gerbview/select_layers_to_pcb.cpp | 4 +- include/class_board_design_settings.h | 20 +++----- include/class_layer_box_selector.h | 8 +-- include/drawtxt.h | 3 ++ include/eda_text.h | 1 + include/gr_basic.h | 3 ++ include/layers_id_colors_and_visibility.h | 51 ++++++++++++------- kicad/prjconfig.cpp | 1 + pcbnew/basepcbframe.cpp | 2 +- pcbnew/class_board.cpp | 38 +++++++------- pcbnew/class_board.h | 34 ++++++------- pcbnew/class_board_design_settings.cpp | 22 ++------ pcbnew/class_marker_pcb.cpp | 2 +- pcbnew/class_module.cpp | 14 ++--- pcbnew/class_pad_draw_functions.cpp | 2 +- pcbnew/class_pcb_layer_box_selector.cpp | 12 ++--- pcbnew/class_pcb_layer_box_selector.h | 6 +-- pcbnew/class_pcb_layer_widget.cpp | 44 ++++++++-------- pcbnew/class_text_mod.cpp | 10 +--- pcbnew/class_track.cpp | 17 ++----- .../dialog_graphic_item_properties.cpp | 6 ++- ...og_graphic_item_properties_for_Modedit.cpp | 6 +-- pcbnew/dialogs/dialog_layers_setup.cpp | 2 +- pcbnew/eagle_plugin.cpp | 18 +++---- pcbnew/edgemod.cpp | 2 +- pcbnew/edit.cpp | 2 +- pcbnew/onleftclick.cpp | 6 +-- pcbnew/onrightclick.cpp | 2 +- pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp | 2 +- pcbnew/pcad2kicadpcb_plugin/pcb_line.cpp | 4 +- pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp | 2 +- pcbnew/pcbnew.h | 3 +- pcbnew/swap_layers.cpp | 2 +- pcbnew/zones_test_and_combine_areas.cpp | 2 +- 49 files changed, 210 insertions(+), 223 deletions(-) diff --git a/common/class_layer_box_selector.cpp b/common/class_layer_box_selector.cpp index 3ec360025b..b273240118 100644 --- a/common/class_layer_box_selector.cpp +++ b/common/class_layer_box_selector.cpp @@ -106,14 +106,14 @@ void LAYER_BOX_SELECTOR::ResyncBitmapOnly() } -void LAYER_BOX_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayerIndex ) +void LAYER_BOX_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer ) { wxMemoryDC bmpDC; wxBrush brush; // Prepare Bitmap bmpDC.SelectObject( aLayerbmp ); - brush.SetColour( MakeColour( GetLayerColor( aLayerIndex ) ) ); + brush.SetColour( MakeColour( GetLayerColor( aLayer ) ) ); brush.SetStyle( wxSOLID ); bmpDC.SetBrush( brush ); diff --git a/common/dsnlexer.cpp b/common/dsnlexer.cpp index b2eb6880c9..9efadcecca 100644 --- a/common/dsnlexer.cpp +++ b/common/dsnlexer.cpp @@ -29,7 +29,7 @@ #include // bsearch() #include - +#include #include //#include "fctsys.h" diff --git a/common/eda_text.cpp b/common/eda_text.cpp index 0f59228954..6e2c70a0fe 100644 --- a/common/eda_text.cpp +++ b/common/eda_text.cpp @@ -269,22 +269,12 @@ void EDA_TEXT::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC, if( aDrawMode != -1 ) GRSetDrawMode( aDC, aDrawMode ); - /* Draw text anchor, if allowed */ + // Draw text anchor, if requested if( aAnchor_color != UNSPECIFIED_COLOR ) { - - int anchor_size = aDC->DeviceToLogicalXRel( 2 ); - - aAnchor_color = (EDA_COLOR_T) ( aAnchor_color & MASKCOLOR ); - - int cX = aPos.x + aOffset.x; - int cY = aPos.y + aOffset.y; - - GRLine( aPanel->GetClipBox(), aDC, cX - anchor_size, cY, - cX + anchor_size, cY, 0, aAnchor_color ); - - GRLine( aPanel->GetClipBox(), aDC, cX, cY - anchor_size, - cX, cY + anchor_size, 0, aAnchor_color ); + GRDrawAnchor( aPanel->GetClipBox(), aDC, + aPos.x + aOffset.x, aPos.y + aOffset.y, + DIM_ANCRE_TEXTE, aAnchor_color ); } if( aFillMode == SKETCH ) diff --git a/common/gr_basic.cpp b/common/gr_basic.cpp index 9ed374f4be..9ff0cd4f3e 100644 --- a/common/gr_basic.cpp +++ b/common/gr_basic.cpp @@ -1551,3 +1551,16 @@ EDA_COLOR_T ColorFindNearest( const wxColour &aColor ) return candidate; } + +void GRDrawAnchor( EDA_RECT *aClipBox, wxDC *aDC, int x, int y, + int aSize, EDA_COLOR_T aColor ) +{ + int anchor_size = aDC->DeviceToLogicalXRel( aSize ); + + GRLine( aClipBox, aDC, + x - anchor_size, y, + x + anchor_size, y, 0, aColor ); + GRLine( aClipBox, aDC, + x, y - anchor_size, + x, y + anchor_size, 0, aColor ); +} diff --git a/common/wxwineda.cpp b/common/wxwineda.cpp index 93192e28db..4a92cc1b7a 100644 --- a/common/wxwineda.cpp +++ b/common/wxwineda.cpp @@ -30,6 +30,7 @@ #include #include #include +#include /*******************************************************/ diff --git a/cvpcb/cvpcb.h b/cvpcb/cvpcb.h index 5399a555e1..08b8b6e209 100644 --- a/cvpcb/cvpcb.h +++ b/cvpcb/cvpcb.h @@ -28,7 +28,6 @@ typedef boost::ptr_vector< COMPONENT_INFO > COMPONENT_LIST; extern const wxString FootprintAliasFileExtension; extern const wxString RetroFileExtension; -extern const wxString RetroFileWildcard; extern const wxString FootprintAliasFileWildcard; extern const wxString titleLibLoadError; diff --git a/gerbview/class_gbr_layer_box_selector.cpp b/gerbview/class_gbr_layer_box_selector.cpp index 038aac142f..681c9b75ac 100644 --- a/gerbview/class_gbr_layer_box_selector.cpp +++ b/gerbview/class_gbr_layer_box_selector.cpp @@ -65,18 +65,18 @@ void GBR_LAYER_BOX_SELECTOR::Resync() // Returns a color index from the layer id -EDA_COLOR_T GBR_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayerIndex ) const +EDA_COLOR_T GBR_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayer ) const { GERBVIEW_FRAME* frame = (GERBVIEW_FRAME*) GetParent()->GetParent(); - return frame->GetLayerColor( aLayerIndex ); + return frame->GetLayerColor( aLayer ); } // Returns the name of the layer id -wxString GBR_LAYER_BOX_SELECTOR::GetLayerName( LAYER_NUM aLayerIndex ) const +wxString GBR_LAYER_BOX_SELECTOR::GetLayerName( LAYER_NUM aLayer ) const { wxString name; - name.Printf( _( "Layer %d" ), aLayerIndex + 1 ); + name.Printf( _( "Layer %d" ), aLayer + 1 ); return name; } diff --git a/gerbview/class_gbr_layer_box_selector.h b/gerbview/class_gbr_layer_box_selector.h index 0ba19a2647..b6e4d8ec64 100644 --- a/gerbview/class_gbr_layer_box_selector.h +++ b/gerbview/class_gbr_layer_box_selector.h @@ -37,15 +37,15 @@ public: // Returns a color index from the layer id // Virtual function - EDA_COLOR_T GetLayerColor( LAYER_NUM aLayerIndex ) const; + EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const; // Returns true if the layer id is enabled (i.e. is it should be displayed) // Virtual function - bool IsLayerEnabled( LAYER_NUM aLayerIndex ) const { return true; }; + bool IsLayerEnabled( LAYER_NUM aLayer ) const { return true; }; // Returns the name of the layer id // Virtual function - wxString GetLayerName( LAYER_NUM aLayerIndex ) const; + wxString GetLayerName( LAYER_NUM aLayer ) const; }; #endif //CLASS_GBR_LAYER_BOX_SELECTOR_H diff --git a/gerbview/class_gbr_layout.cpp b/gerbview/class_gbr_layout.cpp index 345722f2f5..ad475e07f6 100644 --- a/gerbview/class_gbr_layout.cpp +++ b/gerbview/class_gbr_layout.cpp @@ -24,12 +24,12 @@ GBR_LAYOUT::~GBR_LAYOUT() /* Function IsLayerVisible * tests whether a given layer is visible - * param aLayerIndex = The index of the layer to be tested + * param aLayer = The layer to be tested * return bool - true if the layer is visible. */ -bool GBR_LAYOUT::IsLayerVisible( LAYER_NUM aLayerIndex ) const +bool GBR_LAYOUT::IsLayerVisible( LAYER_NUM aLayer ) const { - return m_printLayersMask & GetLayerMask( aLayerIndex ); + return m_printLayersMask & GetLayerMask( aLayer ); } diff --git a/gerbview/class_gbr_layout.h b/gerbview/class_gbr_layout.h index cc497703b5..ea16415dff 100644 --- a/gerbview/class_gbr_layout.h +++ b/gerbview/class_gbr_layout.h @@ -99,10 +99,10 @@ public: /** * Function IsLayerVisible * tests whether a given layer is visible - * @param aLayerIndex = The index of the layer to be tested + * @param aLayer = The layer to be tested * @return bool - true if the layer is visible. */ - bool IsLayerVisible( LAYER_NUM aLayerIndex ) const; + bool IsLayerVisible( LAYER_NUM aLayer ) const; #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const; // overload diff --git a/gerbview/dialogs/dialog_print_using_printer.cpp b/gerbview/dialogs/dialog_print_using_printer.cpp index 31d21469ad..e49e2bdf6c 100644 --- a/gerbview/dialogs/dialog_print_using_printer.cpp +++ b/gerbview/dialogs/dialog_print_using_printer.cpp @@ -139,7 +139,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) layer_max = NB_LAYERS; // Create layer list - for(LAYER_NUM ii = FIRST_LAYER; ii < layer_max; ++ii ) + for( LAYER_NUM ii = FIRST_LAYER; ii < layer_max; ++ii ) { LAYER_MSK mask = GetLayerMask( ii ); msg = _( "Layer" ); diff --git a/gerbview/export_to_pcbnew.cpp b/gerbview/export_to_pcbnew.cpp index 24dda6bbbb..e2635cd59b 100644 --- a/gerbview/export_to_pcbnew.cpp +++ b/gerbview/export_to_pcbnew.cpp @@ -195,7 +195,7 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( LAYER_NUM* LayerLookUpTable ) LAYER_NUM layer = gerb_item->GetLayer(); LAYER_NUM pcb_layer_number = LayerLookUpTable[layer]; - if( pcb_layer_number < FIRST_LAYER || pcb_layer_number > LAST_NON_COPPER_LAYER ) + if( !IsPcbLayer( pcb_layer_number ) ) continue; if( pcb_layer_number > LAST_COPPER_LAYER ) diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index ab0c0e8217..b5d1dff3ed 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -558,15 +558,15 @@ void GERBVIEW_FRAME::SetVisibleLayers( LAYER_MSK aLayerMask ) /** * Function IsLayerVisible * tests whether a given layer is visible - * @param aLayerIndex = The index of the layer to be tested + * @param aLayer = The layer to be tested * @return bool - true if the layer is visible. */ -bool GERBVIEW_FRAME::IsLayerVisible( LAYER_NUM aLayerIndex ) const +bool GERBVIEW_FRAME::IsLayerVisible( LAYER_NUM aLayer ) const { if( ! m_DisplayOptions.m_IsPrinting ) - return m_LayersManager->IsLayerVisible( aLayerIndex ); + return m_LayersManager->IsLayerVisible( aLayer ); else - return GetLayout()->IsLayerVisible( aLayerIndex ); + return GetLayout()->IsLayerVisible( aLayer ); } diff --git a/gerbview/gerbview_frame.h b/gerbview/gerbview_frame.h index 36ccf8e7e3..ba1f079c9d 100644 --- a/gerbview/gerbview_frame.h +++ b/gerbview/gerbview_frame.h @@ -313,10 +313,10 @@ public: /** * Function IsLayerVisible * tests whether a given layer is visible - * @param aLayerIndex = The index of the layer to be tested + * @param aLayer = The layer to be tested * @return bool - true if the layer is visible. */ - bool IsLayerVisible( LAYER_NUM aLayerIndex ) const; + bool IsLayerVisible( LAYER_NUM aLayer ) const; /** * Function GetVisibleElementColor diff --git a/gerbview/readgerb.cpp b/gerbview/readgerb.cpp index 45f0541b32..0fffdc9328 100644 --- a/gerbview/readgerb.cpp +++ b/gerbview/readgerb.cpp @@ -11,6 +11,7 @@ #include #include +#include /* Read a gerber file, RS274D or RS274X format. */ diff --git a/gerbview/select_layers_to_pcb.cpp b/gerbview/select_layers_to_pcb.cpp index def5128ef1..b9f4158982 100644 --- a/gerbview/select_layers_to_pcb.cpp +++ b/gerbview/select_layers_to_pcb.cpp @@ -360,12 +360,12 @@ void LAYERS_MAP_DIALOG::OnSelectLayer( wxCommandEvent& event ) } LAYER_NUM jj = m_layersLookUpTable[m_buttonTable[ii]]; - if( ( jj < FIRST_LAYER ) || ( jj > NB_LAYERS ) ) + if( !IsValidLayer( jj ) ) jj = LAYER_N_BACK; // (Defaults to "Copper" layer.) jj = m_Parent->SelectPCBLayer( jj, m_exportBoardCopperLayersCount, true ); - if( ( jj < FIRST_LAYER ) || ( jj > NB_LAYERS ) ) + if( !IsValidLayer( jj ) ) return; if( jj != m_layersLookUpTable[m_buttonTable[ii]] ) diff --git a/include/class_board_design_settings.h b/include/class_board_design_settings.h index 3fed1d53c5..0eedc23d22 100644 --- a/include/class_board_design_settings.h +++ b/include/class_board_design_settings.h @@ -75,26 +75,22 @@ public: /** * Function IsLayerVisible * tests whether a given layer is visible - * @param aLayerIndex = The index of the layer to be tested + * @param aLayer = The layer to be tested * @return bool - true if the layer is visible. */ - bool IsLayerVisible( LAYER_NUM aLayerIndex ) const + bool IsLayerVisible( LAYER_NUM aLayer ) const { - // @@IMB: Altough Pcbnew uses only 29, GerbView uses all 32 layers - if( aLayerIndex < FIRST_LAYER || aLayerIndex >= NB_LAYERS ) - return false; - // If a layer is disabled, it is automatically invisible - return bool( m_VisibleLayers & m_EnabledLayers & GetLayerMask( aLayerIndex ) ); + return m_VisibleLayers & m_EnabledLayers & GetLayerMask( aLayer ); } /** * Function SetLayerVisibility * changes the visibility of a given layer - * @param aLayerIndex = The index of the layer to be changed + * @param aLayer = The layer to be changed * @param aNewState = The new visibility state of the layer */ - void SetLayerVisibility( LAYER_NUM aLayerIndex, bool aNewState ); + void SetLayerVisibility( LAYER_NUM aLayer, bool aNewState ); /** * Function GetVisibleElements @@ -158,12 +154,12 @@ public: /** * Function IsLayerEnabled * tests whether a given layer is enabled - * @param aLayerIndex = The index of the layer to be tested + * @param aLayer = The of the layer to be tested * @return bool - true if the layer is enabled */ - bool IsLayerEnabled( LAYER_NUM aLayerIndex ) const + bool IsLayerEnabled( LAYER_NUM aLayer ) const { - return bool( m_EnabledLayers & GetLayerMask( aLayerIndex ) ); + return m_EnabledLayers & GetLayerMask( aLayer ); } /** diff --git a/include/class_layer_box_selector.h b/include/class_layer_box_selector.h index e7248584aa..e313b6242a 100644 --- a/include/class_layer_box_selector.h +++ b/include/class_layer_box_selector.h @@ -35,15 +35,15 @@ public: // Returns a color index from the layer id // Virtual function because GerbView uses its own functions in a derived class - virtual EDA_COLOR_T GetLayerColor( LAYER_NUM aLayerIndex ) const = 0; + virtual EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const = 0; // Returns the name of the layer id // Virtual pure function because GerbView uses its own functions in a derived class - virtual wxString GetLayerName( LAYER_NUM aLayerIndex ) const = 0; + virtual wxString GetLayerName( LAYER_NUM aLayer ) const = 0; // Returns true if the layer id is enabled (i.e. is it should be displayed) // Virtual function pure because GerbView uses its own functions in a derived class - virtual bool IsLayerEnabled( LAYER_NUM aLayerIndex ) const = 0; + virtual bool IsLayerEnabled( LAYER_NUM aLayer ) const = 0; // Get Current Item # int GetChoice(); @@ -66,7 +66,7 @@ public: protected: // Fills the layer bitmap aLayerbmp with the layer color - void SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayerIndex ); + void SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer ); }; #define DECLARE_LAYERS_HOTKEY(list) int list[NB_LAYERS] = \ diff --git a/include/drawtxt.h b/include/drawtxt.h index 53ef4ddea8..43c638e39e 100644 --- a/include/drawtxt.h +++ b/include/drawtxt.h @@ -10,6 +10,9 @@ #include #include // EDA_TEXT_HJUSTIFY_T and EDA_TEXT_VJUSTIFY_T +/// Minimum dimension in pixel for drawing text +#define MIN_TEXT_SIZE 5 + class EDA_DRAW_PANEL; class PLOTTER; diff --git a/include/eda_text.h b/include/eda_text.h index d620d8d093..3ceb8da49e 100644 --- a/include/eda_text.h +++ b/include/eda_text.h @@ -62,6 +62,7 @@ enum EDA_DRAW_MODE_T { #define DEFAULT_SIZE_TEXT 60 /* default text height (in mils or 1/1000") */ #define TEXT_NO_VISIBLE 1 //< EDA_TEXT::m_Attribut(e?) visibility flag. +#define DIM_ANCRE_TEXTE 2 // Anchor size for text /** diff --git a/include/gr_basic.h b/include/gr_basic.h index e8d290bb6e..207c63447d 100644 --- a/include/gr_basic.h +++ b/include/gr_basic.h @@ -260,4 +260,7 @@ void GRSFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, void GRLineArray( EDA_RECT* aClipBox, wxDC* aDC,std::vector& aLines, int aWidth, EDA_COLOR_T aColor ); +void GRDrawAnchor( EDA_RECT* aClipBox, wxDC *aDC, int x, int y, int aSize, + EDA_COLOR_T aColor ); + #endif /* define GR_BASIC */ diff --git a/include/layers_id_colors_and_visibility.h b/include/layers_id_colors_and_visibility.h index c7dccae948..1dd41130f0 100644 --- a/include/layers_id_colors_and_visibility.h +++ b/include/layers_id_colors_and_visibility.h @@ -216,39 +216,52 @@ enum PCB_VISIBLE END_PCB_VISIBLE_LIST // sentinel }; - /** - * Function IsValidPcbLayerIndex - * tests whether a given integer is a valid layer index - * @param aLayerIndex = Layer index to test + * Function IsValidLayer + * tests whether a given integer is a valid layer index, i.e. can + * be safely put in a LAYER_NUM + * @param aLayerIndex = Layer index to test. It can be an int, so its + * useful during I/O * @return true if aLayerIndex is a valid layer index */ -inline bool IsValidPcbLayerIndex( LAYER_NUM aLayerIndex ) +inline bool IsValidLayer( int aLayerIndex ) { - return aLayerIndex >= FIRST_LAYER && aLayerIndex < NB_PCB_LAYERS; + return aLayerIndex >= FIRST_LAYER && aLayerIndex < NB_LAYERS; } /** - * Function IsValidCopperLayerIndex - * tests whether an integer is a valid copper layer index - * @param aLayerIndex = Layer index to test - * @return true if aLayerIndex is a valid copper layer index + * Function IsPcbLayer + * tests whether a layer is a valid layer for pcbnew + * @param aLayer = Layer to test + * @return true if aLayer is a layer valid in pcbnew */ -inline bool IsValidCopperLayerIndex( LAYER_NUM aLayerIndex ) +inline bool IsPcbLayer( LAYER_NUM aLayer ) { - return aLayerIndex >= FIRST_COPPER_LAYER && aLayerIndex <= LAST_COPPER_LAYER; + return aLayer >= FIRST_LAYER && aLayer < NB_PCB_LAYERS; } /** - * Function IsValidNonCopperLayerIndex - * tests whether an integer is a valid non copper layer index - * @param aLayerIndex = Layer index to test - * @return true if aLayerIndex is a valid non copper layer index + * Function IsCopperLayer + * tests whether a layer is a copper layer + * @param aLayer = Layer to test + * @return true if aLayer is a valid copper layer */ -inline bool IsValidNonCopperLayerIndex( LAYER_NUM aLayerIndex ) +inline bool IsCopperLayer( LAYER_NUM aLayer ) { - return aLayerIndex >= FIRST_NON_COPPER_LAYER - && aLayerIndex <= LAST_NON_COPPER_LAYER; + return aLayer >= FIRST_COPPER_LAYER + && aLayer <= LAST_COPPER_LAYER; +} + +/** + * Function IsNonCopperLayer + * tests whether a layer is a non copper layer + * @param aLayer = Layer to test + * @return true if aLayer is a non copper layer + */ +inline bool IsNonCopperLayer( LAYER_NUM aLayer ) +{ + return aLayer >= FIRST_NON_COPPER_LAYER + && aLayer <= LAST_NON_COPPER_LAYER; } /* IMPORTANT: If a layer is not a front layer not necessarily is true diff --git a/kicad/prjconfig.cpp b/kicad/prjconfig.cpp index 8737574d99..12d2b991ba 100644 --- a/kicad/prjconfig.cpp +++ b/kicad/prjconfig.cpp @@ -38,6 +38,7 @@ #include #include #include +#include #include #include diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index a4eedd1c48..42f2432810 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -315,7 +315,7 @@ void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, LAYER_NUM layer ) // Copper layers cannot be selected unconditionally; how many // of those layers are currently enabled needs to be checked. - if( IsValidCopperLayerIndex( layer ) ) + if( IsCopperLayer( layer ) ) { // If only one copper layer is enabled, the only such layer // that can be selected to is the "Copper" layer (so the diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 804d0d1875..eb7c6d540b 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -356,23 +356,23 @@ bool BOARD::SetLayer( LAYER_NUM aIndex, const LAYER& aLayer ) } -wxString BOARD::GetLayerName( LAYER_NUM aLayerIndex ) const +wxString BOARD::GetLayerName( LAYER_NUM aLayer ) const { - if( !IsValidPcbLayerIndex( aLayerIndex ) ) + if( !IsPcbLayer( aLayer ) ) return wxEmptyString; // All layer names are stored in the BOARD. - if( IsLayerEnabled( aLayerIndex ) ) + if( IsLayerEnabled( aLayer ) ) { // Standard names were set in BOARD::BOARD() but they may be // over-ridden by BOARD::SetLayerName(). // For copper layers, return the actual copper layer name, // otherwise return the Standard English layer name. - if( aLayerIndex < FIRST_NON_COPPER_LAYER ) - return m_Layer[aLayerIndex].m_Name; + if( IsCopperLayer( aLayer ) ) + return m_Layer[aLayer].m_Name; } - return GetStandardLayerName( aLayerIndex ); + return GetStandardLayerName( aLayer ); } @@ -422,9 +422,9 @@ wxString BOARD::GetStandardLayerName( LAYER_NUM aLayerNumber ) } -bool BOARD::SetLayerName( LAYER_NUM aLayerIndex, const wxString& aLayerName ) +bool BOARD::SetLayerName( LAYER_NUM aLayer, const wxString& aLayerName ) { - if( !IsValidCopperLayerIndex( aLayerIndex ) ) + if( !IsCopperLayer( aLayer ) ) return false; if( aLayerName == wxEmptyString || aLayerName.Len() > 20 ) @@ -439,15 +439,15 @@ bool BOARD::SetLayerName( LAYER_NUM aLayerIndex, const wxString& aLayerName ) // replace any spaces with underscores before we do any comparing NameTemp.Replace( wxT( " " ), wxT( "_" ) ); - if( IsLayerEnabled( aLayerIndex ) ) + if( IsLayerEnabled( aLayer ) ) { for( LAYER_NUM i = FIRST_COPPER_LAYER; i < NB_COPPER_LAYERS; ++i ) { - if( i != aLayerIndex && IsLayerEnabled( i ) && NameTemp == m_Layer[i].m_Name ) + if( i != aLayer && IsLayerEnabled( i ) && NameTemp == m_Layer[i].m_Name ) return false; } - m_Layer[aLayerIndex].m_Name = NameTemp; + m_Layer[aLayer].m_Name = NameTemp; return true; } @@ -456,30 +456,30 @@ bool BOARD::SetLayerName( LAYER_NUM aLayerIndex, const wxString& aLayerName ) } -LAYER_T BOARD::GetLayerType( LAYER_NUM aLayerIndex ) const +LAYER_T BOARD::GetLayerType( LAYER_NUM aLayer ) const { - if( !IsValidCopperLayerIndex( aLayerIndex ) ) + if( !IsCopperLayer( aLayer ) ) return LT_SIGNAL; //@@IMB: The original test was broken due to the discontinuity // in the layer sequence. - if( IsLayerEnabled( aLayerIndex ) ) - return m_Layer[aLayerIndex].m_Type; + if( IsLayerEnabled( aLayer ) ) + return m_Layer[aLayer].m_Type; return LT_SIGNAL; } -bool BOARD::SetLayerType( LAYER_NUM aLayerIndex, LAYER_T aLayerType ) +bool BOARD::SetLayerType( LAYER_NUM aLayer, LAYER_T aLayerType ) { - if( !IsValidCopperLayerIndex( aLayerIndex ) ) + if( !IsCopperLayer( aLayer ) ) return false; //@@IMB: The original test was broken due to the discontinuity // in the layer sequence. - if( IsLayerEnabled( aLayerIndex ) ) + if( IsLayerEnabled( aLayer ) ) { - m_Layer[aLayerIndex].m_Type = aLayerType; + m_Layer[aLayer].m_Type = aLayerType; return true; } diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index fe92536160..bd0b33ea4e 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -451,12 +451,12 @@ public: * Function IsLayerVisible * is a proxy function that calls the correspondent function in m_BoardSettings * tests whether a given layer is visible - * @param aLayerIndex = The index of the layer to be tested + * @param aLayer = The layer to be tested * @return bool - true if the layer is visible. */ - bool IsLayerVisible( LAYER_NUM aLayerIndex ) const + bool IsLayerVisible( LAYER_NUM aLayer ) const { - return m_designSettings.IsLayerVisible( aLayerIndex ); + return m_designSettings.IsLayerVisible( aLayer ); } /** @@ -588,26 +588,26 @@ public: /** * Function GetLayerName - * returns the name of a layer given by aLayerIndex. Copper layers may + * returns the name of a layer given by aLayer. Copper layers may * have custom names. * - * @param aLayerIndex = A layer index, like LAYER_N_BACK, etc. + * @param aLayer = A layer, like LAYER_N_BACK, etc. * * @return wxString - the layer name, which for copper layers may * be custom, else standard. */ - wxString GetLayerName( LAYER_NUM aLayerIndex ) const; + wxString GetLayerName( LAYER_NUM aLayer ) const; /** * Function SetLayerName - * changes the name of the layer given by aLayerIndex. + * changes the name of the layer given by aLayer. * - * @param aLayerIndex A layer index, like LAYER_N_BACK, etc. + * @param aLayer A layer, like LAYER_N_BACK, etc. * @param aLayerName The new layer name * @return bool - true if aLayerName was legal and unique among other - * layer names at other layer indices and aLayerIndex was within range, else false. + * layer names at other layer indices and aLayer was within range, else false. */ - bool SetLayerName( LAYER_NUM aLayerIndex, const wxString& aLayerName ); + bool SetLayerName( LAYER_NUM aLayer, const wxString& aLayerName ); /** * Function GetStandardLayerName @@ -626,23 +626,23 @@ public: /** * Function GetLayerType - * returns the type of the copper layer given by aLayerIndex. + * returns the type of the copper layer given by aLayer. * - * @param aLayerIndex A layer index, like LAYER_N_BACK, etc. + * @param aLayer A layer index, like LAYER_N_BACK, etc. * @return LAYER_T - the layer type, or LAYER_T(-1) if the * index was out of range. */ - LAYER_T GetLayerType( LAYER_NUM aLayerIndex ) const; + LAYER_T GetLayerType( LAYER_NUM aLayer ) const; /** * Function SetLayerType - * changes the type of the layer given by aLayerIndex. + * changes the type of the layer given by aLayer. * - * @param aLayerIndex A layer index, like LAYER_N_BACK, etc. + * @param aLayer A layer index, like LAYER_N_BACK, etc. * @param aLayerType The new layer type. - * @return bool - true if aLayerType was legal and aLayerIndex was within range, else false. + * @return bool - true if aLayerType was legal and aLayer was within range, else false. */ - bool SetLayerType( LAYER_NUM aLayerIndex, LAYER_T aLayerType ); + bool SetLayerType( LAYER_NUM aLayer, LAYER_T aLayerType ); /** * Function SetLayerColor diff --git a/pcbnew/class_board_design_settings.cpp b/pcbnew/class_board_design_settings.cpp index 633a685507..f1f5ce0c88 100644 --- a/pcbnew/class_board_design_settings.cpp +++ b/pcbnew/class_board_design_settings.cpp @@ -186,21 +186,16 @@ void BOARD_DESIGN_SETTINGS::SetVisibleAlls() void BOARD_DESIGN_SETTINGS::SetVisibleLayers( LAYER_MSK aMask ) { - // Although Pcbnew uses only 29, GerbView uses all 32 layers m_VisibleLayers = aMask & m_EnabledLayers & FULL_LAYERS; } -void BOARD_DESIGN_SETTINGS::SetLayerVisibility( LAYER_NUM aLayerIndex, bool aNewState ) +void BOARD_DESIGN_SETTINGS::SetLayerVisibility( LAYER_NUM aLayer, bool aNewState ) { - // Altough Pcbnew uses only 29, GerbView uses all 32 layers - if( aLayerIndex < 0 || aLayerIndex >= 32 ) - return; - - if( aNewState && IsLayerEnabled( aLayerIndex ) ) - m_VisibleLayers |= GetLayerMask( aLayerIndex ); + if( aNewState && IsLayerEnabled( aLayer ) ) + m_VisibleLayers |= GetLayerMask( aLayer ); else - m_VisibleLayers &= ~GetLayerMask( aLayerIndex ); + m_VisibleLayers &= ~GetLayerMask( aLayer ); } @@ -245,12 +240,5 @@ void BOARD_DESIGN_SETTINGS::SetEnabledLayers( LAYER_MSK aMask ) m_VisibleLayers &= aMask; // update m_CopperLayerCount to ensure its consistency with m_EnabledLayers - m_CopperLayerCount = 0; - - unsigned shiftMask = aMask; - for( LAYER_NUM ii = FIRST_LAYER; aMask && ii < NB_COPPER_LAYERS; ++ii, shiftMask >>= 1 ) - { - if( shiftMask & 1 ) - m_CopperLayerCount++; - } + m_CopperLayerCount = LayerMaskCountSet( aMask & ALL_CU_LAYERS); } diff --git a/pcbnew/class_marker_pcb.cpp b/pcbnew/class_marker_pcb.cpp index d7c4beb2e4..88b361fbba 100644 --- a/pcbnew/class_marker_pcb.cpp +++ b/pcbnew/class_marker_pcb.cpp @@ -88,7 +88,7 @@ MARKER_PCB::~MARKER_PCB() */ bool MARKER_PCB::IsOnLayer( LAYER_NUM aLayer ) const { - return IsValidCopperLayerIndex( aLayer ); + return IsCopperLayer( aLayer ); } void MARKER_PCB::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index 5a4bf89a33..b6317bb3d5 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -181,21 +181,13 @@ MODULE::~MODULE() void MODULE::DrawAncre( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset, int dim_ancre, GR_DRAWMODE draw_mode ) { - int anchor_size = DC->DeviceToLogicalXRel( dim_ancre ); - GRSetDrawMode( DC, draw_mode ); if( GetBoard()->IsElementVisible( ANCHOR_VISIBLE ) ) { - EDA_COLOR_T color = g_ColorsSettings.GetItemColor( ANCHOR_VISIBLE ); - GRLine( panel->GetClipBox(), DC, - m_Pos.x - offset.x - anchor_size, m_Pos.y - offset.y, - m_Pos.x - offset.x + anchor_size, m_Pos.y - offset.y, - 0, color ); - GRLine( panel->GetClipBox(), DC, - m_Pos.x - offset.x, m_Pos.y - offset.y - anchor_size, - m_Pos.x - offset.x, m_Pos.y - offset.y + anchor_size, - 0, color ); + GRDrawAnchor( panel->GetClipBox(), DC, m_Pos.x, m_Pos.y, + dim_ancre, + g_ColorsSettings.GetItemColor( ANCHOR_VISIBLE ) ); } } diff --git a/pcbnew/class_pad_draw_functions.cpp b/pcbnew/class_pad_draw_functions.cpp index 884a637314..23147ec956 100644 --- a/pcbnew/class_pad_draw_functions.cpp +++ b/pcbnew/class_pad_draw_functions.cpp @@ -229,7 +229,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode, // layer so we can see pads on paste or solder layer and the size of the // mask if( ( aDraw_mode & GR_ALLOW_HIGHCONTRAST ) && - DisplayOpt.ContrastModeDisplay && screen->m_Active_Layer >= FIRST_NON_COPPER_LAYER ) + DisplayOpt.ContrastModeDisplay && !IsCopperLayer( screen->m_Active_Layer ) ) { if( IsOnLayer( screen->m_Active_Layer ) ) { diff --git a/pcbnew/class_pcb_layer_box_selector.cpp b/pcbnew/class_pcb_layer_box_selector.cpp index be7c847f33..5cdcedf17d 100644 --- a/pcbnew/class_pcb_layer_box_selector.cpp +++ b/pcbnew/class_pcb_layer_box_selector.cpp @@ -83,33 +83,33 @@ void PCB_LAYER_BOX_SELECTOR::Resync() // Returns true if the layer id is enabled (i.e. is it should be displayed) -bool PCB_LAYER_BOX_SELECTOR::IsLayerEnabled( LAYER_NUM aLayerIndex ) const +bool PCB_LAYER_BOX_SELECTOR::IsLayerEnabled( LAYER_NUM aLayer ) const { PCB_BASE_FRAME* pcbFrame = (PCB_BASE_FRAME*) GetParent()->GetParent(); BOARD* board = pcbFrame->GetBoard(); wxASSERT( board != NULL ); - return board->IsLayerEnabled( aLayerIndex ); + return board->IsLayerEnabled( aLayer ); } // Returns a color index from the layer id -EDA_COLOR_T PCB_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayerIndex ) const +EDA_COLOR_T PCB_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayer ) const { PCB_BASE_FRAME* pcbFrame = (PCB_BASE_FRAME*) GetParent()->GetParent(); BOARD* board = pcbFrame->GetBoard(); wxASSERT( board != NULL ); - return board->GetLayerColor( aLayerIndex ); + return board->GetLayerColor( aLayer ); } // Returns the name of the layer id -wxString PCB_LAYER_BOX_SELECTOR::GetLayerName( LAYER_NUM aLayerIndex ) const +wxString PCB_LAYER_BOX_SELECTOR::GetLayerName( LAYER_NUM aLayer ) const { PCB_BASE_FRAME* pcbFrame = (PCB_BASE_FRAME*) GetParent()->GetParent(); BOARD* board = pcbFrame->GetBoard(); wxASSERT( board != NULL ); - return board->GetLayerName( aLayerIndex ); + return board->GetLayerName( aLayer ); } diff --git a/pcbnew/class_pcb_layer_box_selector.h b/pcbnew/class_pcb_layer_box_selector.h index ef75213cc4..e56087d90a 100644 --- a/pcbnew/class_pcb_layer_box_selector.h +++ b/pcbnew/class_pcb_layer_box_selector.h @@ -40,15 +40,15 @@ public: // Returns a color index from the layer id // Virtual function - EDA_COLOR_T GetLayerColor( LAYER_NUM aLayerIndex ) const; + EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const; // Returns true if the layer id is enabled (i.e. is it should be displayed) // Virtual function - bool IsLayerEnabled( LAYER_NUM aLayerIndex ) const; + bool IsLayerEnabled( LAYER_NUM aLayer ) const; // Returns the name of the layer id // Virtual function - wxString GetLayerName( LAYER_NUM aLayerIndex ) const; + wxString GetLayerName( LAYER_NUM aLayer ) const; }; #endif //CLASS_PCB_PCB_LAYER_BOX_SELECTOR_H diff --git a/pcbnew/class_pcb_layer_widget.cpp b/pcbnew/class_pcb_layer_widget.cpp index e115e44f1c..e60e8129ba 100644 --- a/pcbnew/class_pcb_layer_widget.cpp +++ b/pcbnew/class_pcb_layer_widget.cpp @@ -163,7 +163,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) { wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 ); LAYER_NUM layer = getDecodedId( cb->GetId() ); - if( IsValidCopperLayerIndex( layer ) ) + if( IsCopperLayer( layer ) ) { lastCu = row; break; @@ -176,7 +176,7 @@ void PCB_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, 3 ); LAYER_NUM layer = getDecodedId( cb->GetId() ); - if( IsValidCopperLayerIndex( layer ) ) + if( IsCopperLayer( layer ) ) { bool loc_visible = visible; if( force_active_layer_visible && (layer == myframe->getActiveLayer() ) ) @@ -262,36 +262,36 @@ void PCB_LAYER_WIDGET::SyncLayerVisibilities() void PCB_LAYER_WIDGET::ReFill() { BOARD* brd = myframe->GetBoard(); - LAYER_NUM layer; - - int enabledLayers = brd->GetEnabledLayers(); + int enabledLayers = brd->GetEnabledLayers(); ClearLayerRows(); // show all coppers first, with front on top, back on bottom, then technical layers - - layer = LAYER_N_FRONT; - if( enabledLayers & GetLayerMask( layer ) ) - { - AppendLayerRow( LAYER_WIDGET::ROW( - brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), _("Front copper layer"), true ) ); - } - - for( layer = LAYER_N_FRONT-1; layer >= 1; --layer ) + for( LAYER_NUM layer = LAYER_N_FRONT; layer >= FIRST_LAYER; --layer ) { if( enabledLayers & GetLayerMask( layer ) ) { + const wxChar *dsc; + switch( layer ) + { + case LAYER_N_FRONT: + dsc = _("Front copper layer"); + break; + + case LAYER_N_BACK: + dsc = _("Back copper layer"); + break; + + default: + dsc = _("Inner copper layer"); + break; + } + AppendLayerRow( LAYER_WIDGET::ROW( - brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), _("An innner copper layer"), true ) ); + brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), dsc, true ) ); } } - layer = LAYER_N_BACK; - if( enabledLayers & GetLayerMask( layer ) ) - { - AppendLayerRow( LAYER_WIDGET::ROW( - brd->GetLayerName( layer ), layer, brd->GetLayerColor( layer ), _("Back copper layer"), true ) ); - } // technical layers are shown in this order: static const struct { @@ -315,7 +315,7 @@ void PCB_LAYER_WIDGET::ReFill() for( unsigned i=0; iIsElementVisible( ANCHOR_VISIBLE ) ) { EDA_COLOR_T anchor_color = brd->GetVisibleElementColor(ANCHOR_VISIBLE); - int anchor_size = DC->DeviceToLogicalXRel( 2 ); - - GRLine( panel->GetClipBox(), DC, - pos.x - anchor_size, pos.y, - pos.x + anchor_size, pos.y, 0, anchor_color ); - GRLine( panel->GetClipBox(), DC, - pos.x, pos.y - anchor_size, - pos.x, pos.y + anchor_size, 0, anchor_color ); + GRDrawAnchor( panel->GetClipBox(), DC, pos.x, pos.y, + DIM_ANCRE_TEXTE, anchor_color ); } // Draw the text proper, with the right attributes diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index 96586180e1..3eb4364dbd 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -55,7 +55,7 @@ static bool ShowClearance( const TRACK* aTrack ) { // maybe return true for tracks and vias, not for zone segments - return aTrack->GetLayer() <= LAST_COPPER_LAYER + return IsCopperLayer( aTrack->GetLayer() ) && ( aTrack->Type() == PCB_TRACE_T || aTrack->Type() == PCB_VIA_T ) && ( ( DisplayOpt.ShowTrackClearanceMode == SHOW_CLEARANCE_NEW_AND_EDITED_TRACKS_AND_VIA_AREAS && ( aTrack->IsDragging() || aTrack->IsMoving() || aTrack->IsNew() ) ) @@ -87,7 +87,8 @@ inline bool IsNear( wxPoint& p1, wxPoint& p2, int max_dist ) } -TRACK* GetTrace( TRACK* aStartTrace, TRACK* aEndTrace, const wxPoint& aPosition, LAYER_MSK aLayerMask ) +TRACK* GetTrace( TRACK* aStartTrace, TRACK* aEndTrace, const wxPoint& aPosition, + LAYER_MSK aLayerMask ) { TRACK* PtSegm; @@ -389,14 +390,8 @@ void TRACK::Flip( const wxPoint& aCentre ) m_Start.y = aCentre.y - (m_Start.y - aCentre.y); m_End.y = aCentre.y - (m_End.y - aCentre.y); - if( Type() == PCB_VIA_T ) - { - // Huh? Wouldn't it be better to us Type() != VIA and get rid of these brackets? - } - else - { + if( Type() != PCB_VIA_T ) SetLayer( FlipLayer( GetLayer() ) ); - } } @@ -406,10 +401,6 @@ SEARCH_RESULT TRACK::Visit( INSPECTOR* inspector, const void* testData, { KICAD_T stype = *scanTypes; -#if 0 && defined(DEBUG) - std::cout << GetClass().mb_str() << ' '; -#endif - // If caller wants to inspect my type if( stype == Type() ) { diff --git a/pcbnew/dialogs/dialog_graphic_item_properties.cpp b/pcbnew/dialogs/dialog_graphic_item_properties.cpp index 9b4525e962..0c29dcfc14 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties.cpp @@ -156,13 +156,15 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::initDlg( ) PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness ); - for( LAYER_NUM layer=FIRST_NON_COPPER_LAYER; layer <= LAST_NON_COPPER_LAYER; ++layer ) + for( LAYER_NUM layer = FIRST_NON_COPPER_LAYER; + layer <= LAST_NON_COPPER_LAYER; ++layer ) { m_LayerSelectionCtrl->Append( m_parent->GetBoard()->GetLayerName( layer ) ); } LAYER_NUM layer = m_Item->GetLayer(); - // Control: + + // It has to be an aux layer if ( layer < FIRST_NON_COPPER_LAYER ) layer = FIRST_NON_COPPER_LAYER; if ( layer > LAST_NON_COPPER_LAYER ) diff --git a/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp b/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp index a7ed5de1e0..9af075cc13 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp @@ -196,10 +196,10 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::OnOkClick( wxCommandEvent& event ) } LAYER_NUM layer = m_layerId[idx]; - if( IsValidCopperLayerIndex( layer ) ) + if( IsCopperLayer( layer ) ) { - /* an edge is put on a copper layer, and it is very dangerous. a - *confirmation is requested */ + /* an edge is put on a copper layer: this it is very dangerous. a + * confirmation is requested */ if( !IsOK( NULL, _( "The graphic item will be on a copper layer. This is very dangerous. Are you sure?" ) ) ) return; diff --git a/pcbnew/dialogs/dialog_layers_setup.cpp b/pcbnew/dialogs/dialog_layers_setup.cpp index 4cccbfc508..d06f501394 100644 --- a/pcbnew/dialogs/dialog_layers_setup.cpp +++ b/pcbnew/dialogs/dialog_layers_setup.cpp @@ -580,7 +580,7 @@ wxString DIALOG_LAYERS_SETUP::getLayerName( LAYER_NUM aLayer ) { wxString ret; - wxASSERT( aLayer >= FIRST_COPPER_LAYER && aLayer <= LAST_COPPER_LAYER ); + wxASSERT( IsCopperLayer( aLayer ) ); wxTextCtrl* ctl = (wxTextCtrl*) getName( aLayer ); diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index fd2384fe2d..00df1c0879 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -1475,7 +1475,7 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics ) ERECT r( gr->second ); LAYER_NUM layer = kicad_layer( r.layer ); - if( IsValidCopperLayerIndex( layer ) ) + if( IsCopperLayer( layer ) ) { // use a "netcode = 0" type ZONE: ZONE_CONTAINER* zone = new ZONE_CONTAINER( m_board ); @@ -1910,7 +1910,7 @@ void EAGLE_PLUGIN::packageWire( MODULE* aModule, CPTREE& aTree ) const EWIRE w( aTree ); LAYER_NUM layer = kicad_layer( w.layer ); - if( IsValidNonCopperLayerIndex( layer ) ) // skip copper package wires + if( IsNonCopperLayer( layer ) ) // skip copper package wires { wxPoint start( kicad_x( w.x1 ), kicad_y( w.y1 ) ); wxPoint end( kicad_x( w.x2 ), kicad_y( w.y2 ) ); @@ -2120,7 +2120,7 @@ void EAGLE_PLUGIN::packageRectangle( MODULE* aModule, CPTREE& aTree ) const ERECT r( aTree ); LAYER_NUM layer = kicad_layer( r.layer ); - if( IsValidNonCopperLayerIndex( layer ) ) // skip copper "package.rectangle"s + if( IsNonCopperLayer( layer ) ) // skip copper "package.rectangle"s { EDGE_MODULE* dwg = new EDGE_MODULE( aModule, S_POLYGON ); aModule->GraphicalItems().PushBack( dwg ); @@ -2153,7 +2153,7 @@ void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, CPTREE& aTree ) const EPOLYGON p( aTree ); LAYER_NUM layer = kicad_layer( p.layer ); - if( IsValidNonCopperLayerIndex( layer ) ) // skip copper "package.rectangle"s + if( IsNonCopperLayer( layer ) ) // skip copper "package.rectangle"s { EDGE_MODULE* dwg = new EDGE_MODULE( aModule, S_POLYGON ); aModule->GraphicalItems().PushBack( dwg ); @@ -2259,7 +2259,7 @@ void EAGLE_PLUGIN::packageSMD( MODULE* aModule, CPTREE& aTree ) const ESMD e( aTree ); LAYER_NUM layer = kicad_layer( e.layer ); - if( !IsValidCopperLayerIndex( layer ) ) + if( !IsCopperLayer( layer ) ) { return; } @@ -2351,7 +2351,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals ) EWIRE w( it->second ); LAYER_NUM layer = kicad_layer( w.layer ); - if( IsValidCopperLayerIndex( layer ) ) + if( IsCopperLayer( layer ) ) { TRACK* t = new TRACK( m_board ); @@ -2386,8 +2386,8 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals ) LAYER_NUM layer_front_most = kicad_layer( v.layer_front_most ); LAYER_NUM layer_back_most = kicad_layer( v.layer_back_most ); - if( IsValidCopperLayerIndex( layer_front_most ) && - IsValidCopperLayerIndex( layer_back_most ) ) + if( IsCopperLayer( layer_front_most ) && + IsCopperLayer( layer_back_most ) ) { int kidiam; int drillz = kicad( v.drill ); @@ -2464,7 +2464,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals ) EPOLYGON p( it->second ); LAYER_NUM layer = kicad_layer( p.layer ); - if( IsValidCopperLayerIndex( layer ) ) + if( IsCopperLayer( layer ) ) { // use a "netcode = 0" type ZONE: ZONE_CONTAINER* zone = new ZONE_CONTAINER( m_board ); diff --git a/pcbnew/edgemod.cpp b/pcbnew/edgemod.cpp index 9d3c0c9aab..f02c0f54a5 100644 --- a/pcbnew/edgemod.cpp +++ b/pcbnew/edgemod.cpp @@ -202,7 +202,7 @@ void FOOTPRINT_EDIT_FRAME::Edit_Edge_Layer( EDGE_MODULE* aEdge ) if( new_layer < 0 ) return; - if( IsValidCopperLayerIndex( new_layer ) ) + if( IsCopperLayer( new_layer ) ) { /* an edge is put on a copper layer, and it is very dangerous. a *confirmation is requested */ diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 51f4c5f8e8..ee0e094ee0 100755 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -1248,7 +1248,7 @@ void PCB_EDIT_FRAME::SwitchLayer( wxDC* DC, LAYER_NUM layer ) // Copper layers cannot be selected unconditionally; how many // of those layers are currently enabled needs to be checked. - if( IsValidCopperLayerIndex( layer ) ) + if( IsCopperLayer( layer ) ) { // If only one copper layer is enabled, the only such layer // that can be selected to is the "Back" layer (so the diff --git a/pcbnew/onleftclick.cpp b/pcbnew/onleftclick.cpp index d1c780643a..aa9e169ebf 100644 --- a/pcbnew/onleftclick.cpp +++ b/pcbnew/onleftclick.cpp @@ -243,7 +243,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) if( GetToolId() == ID_PCB_ARC_BUTT ) shape = S_ARC; - if( getActiveLayer() <= LAST_COPPER_LAYER ) + if( IsCopperLayer( getActiveLayer() ) ) { DisplayError( this, _( "Graphic not authorized on Copper layers" ) ); break; @@ -267,7 +267,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) break; case ID_TRACK_BUTT: - if( getActiveLayer() > LAST_COPPER_LAYER ) + if( !IsCopperLayer( getActiveLayer() ) ) { DisplayError( this, _( "Tracks on Copper layers only " ) ); break; @@ -366,7 +366,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) break; case ID_PCB_DIMENSION_BUTT: - if( getActiveLayer() <= LAST_COPPER_LAYER ) + if( IsCopperLayer( getActiveLayer() ) ) { DisplayError( this, _( "Dimension not authorized on Copper layers" ) ); break; diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp index c2b2b73638..538368545d 100644 --- a/pcbnew/onrightclick.cpp +++ b/pcbnew/onrightclick.cpp @@ -204,7 +204,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_DRAWING, _( "Delete Drawing" ), KiBitmap( delete_xpm ) ); - if( item->GetLayer() > LAST_COPPER_LAYER ) + if( !IsCopperLayer( item->GetLayer() ) ) AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_DRAWING_LAYER, _( "Delete All Drawings on Layer" ), KiBitmap( delete_xpm ) ); } diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp index 7adda1fda4..5a5a21fda9 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp @@ -150,7 +150,7 @@ void PCB_ARC::Flip() void PCB_ARC::AddToModule( MODULE* aModule ) { - if( IsValidNonCopperLayerIndex( m_KiCadLayer ) ) + if( IsNonCopperLayer( m_KiCadLayer ) ) { EDGE_MODULE* arc = new EDGE_MODULE( aModule, S_ARC ); aModule->GraphicalItems().PushBack( arc ); diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_line.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_line.cpp index 280551795b..ad18b26748 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_line.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_line.cpp @@ -116,7 +116,7 @@ void PCB_LINE::Flip() void PCB_LINE::AddToModule( MODULE* aModule ) { - if( IsValidNonCopperLayerIndex( m_KiCadLayer ) ) + if( IsNonCopperLayer( m_KiCadLayer ) ) { EDGE_MODULE* segment = new EDGE_MODULE( aModule, S_SEGMENT ); aModule->GraphicalItems().PushBack( segment ); @@ -134,7 +134,7 @@ void PCB_LINE::AddToModule( MODULE* aModule ) void PCB_LINE::AddToBoard() { - if( IsValidCopperLayerIndex( m_KiCadLayer ) ) + if( IsCopperLayer( m_KiCadLayer ) ) { TRACK* track = new TRACK( m_board ); m_board->m_Track.Append( track ); diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp index 53a27fce03..4ec4338efa 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp @@ -319,7 +319,7 @@ void PCB_PAD::AddToBoard() if( width == 0 || height == 0 ) THROW_IO_ERROR( wxT( "pad or via with zero size" ) ); - if( IsValidCopperLayerIndex( m_KiCadLayer ) ) + if( IsCopperLayer( m_KiCadLayer ) ) { SEGVIA* via = new SEGVIA( m_board ); m_board->m_Track.Append( via ); diff --git a/pcbnew/pcbnew.h b/pcbnew/pcbnew.h index bea9f057bf..b829be7ce2 100644 --- a/pcbnew/pcbnew.h +++ b/pcbnew/pcbnew.h @@ -29,8 +29,7 @@ #define FLG_START 0 // Flag used in locate routines #define FLG_END 1 // Flag used in locate routines -#define DIM_ANCRE_MODULE 3 /* Anchor size (footprint center) */ -#define DIM_ANCRE_TEXTE 2 /* Anchor size (Text center) */ +#define DIM_ANCRE_MODULE 3 // Anchor size (footprint center) #define TEXTS_MIN_SIZE DMils2iu( 50 ) ///< Minimum text size in Pcbnew units value (50 * 0.0001 mils) diff --git a/pcbnew/swap_layers.cpp b/pcbnew/swap_layers.cpp index 58be1f5469..545c063770 100644 --- a/pcbnew/swap_layers.cpp +++ b/pcbnew/swap_layers.cpp @@ -291,7 +291,7 @@ void WinEDA_SwapLayerFrame::Sel_Layer( wxCommandEvent& event ) jj = m_Parent->SelectLayer( jj, UNDEFINED_LAYER, UNDEFINED_LAYER, true ); - if( (jj < FIRST_LAYER) || (jj > NB_PCB_LAYERS) ) + if( !IsValidLayer( jj ) ) return; // No change if the selected layer matches the layer being edited. diff --git a/pcbnew/zones_test_and_combine_areas.cpp b/pcbnew/zones_test_and_combine_areas.cpp index c476d79bf5..32a4a411c0 100644 --- a/pcbnew/zones_test_and_combine_areas.cpp +++ b/pcbnew/zones_test_and_combine_areas.cpp @@ -62,7 +62,7 @@ bool BOARD::OnAreaPolygonModified( PICKED_ITEMS_LIST* aModifiedZonesList, CombineAllAreasInNet( aModifiedZonesList, modified_area->GetNet(), true ); } - if( layer >= FIRST_NON_COPPER_LAYER ) // Refill non copper zones on this layer + if( !IsCopperLayer( layer ) ) // Refill non copper zones on this layer { for( unsigned ia = 0; ia < m_ZoneDescriptorList.size(); ia++ ) if( m_ZoneDescriptorList[ia]->GetLayer() == layer ) From 20eaf66d5bb60df2d2d0566486f86a1dc90d7e86 Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Tue, 9 Apr 2013 19:16:53 +0200 Subject: [PATCH 59/63] Hunted down hardcoded pixel size thresholds for drawing Dynamic contrast for netname and pin numbers ('halo' text) Handle netname drawing even on diagonal tracks --- common/drawtxt.cpp | 32 ++++++ common/gr_basic.cpp | 8 ++ include/colors.h | 6 ++ include/drawtxt.h | 23 ++++ pcbnew/class_dimension.cpp | 2 +- pcbnew/class_drawsegment.cpp | 2 +- pcbnew/class_edge_mod.cpp | 2 +- pcbnew/class_mire.cpp | 2 +- pcbnew/class_pad_draw_functions.cpp | 33 +++--- pcbnew/class_text_mod.cpp | 2 +- pcbnew/class_track.cpp | 157 ++++++++++++++++------------ pcbnew/class_track.h | 1 + 12 files changed, 185 insertions(+), 85 deletions(-) diff --git a/common/drawtxt.cpp b/common/drawtxt.cpp index 05aa82c172..a6aa906537 100644 --- a/common/drawtxt.cpp +++ b/common/drawtxt.cpp @@ -561,6 +561,38 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, } } +void DrawGraphicHaloText( EDA_DRAW_PANEL * aPanel, + wxDC * aDC, + const wxPoint &aPos, + enum EDA_COLOR_T aBgColor, + enum EDA_COLOR_T aColor1, + enum EDA_COLOR_T aColor2, + const wxString &aText, + int aOrient, + const wxSize &aSize, + enum EDA_TEXT_HJUSTIFY_T aH_justify, + enum EDA_TEXT_VJUSTIFY_T aV_justify, + int aWidth, + bool aItalic, + bool aBold, + void (*aCallback)( int x0, int y0, int xf, int yf ), + PLOTTER * aPlotter ) +{ + // Swap color if contrast would be better + if( ColorIsLight( aBgColor ) ) { + EDA_COLOR_T c = aColor1; + aColor1 = aColor2; + aColor2 = c; + } + + DrawGraphicText( aPanel, aDC, aPos, aColor1, aText, aOrient, aSize, + aH_justify, aV_justify, aWidth, aItalic, aBold, + aCallback, aPlotter ); + + DrawGraphicText( aPanel, aDC, aPos, aColor2, aText, aOrient, aSize, + aH_justify, aV_justify, aWidth / 4, aItalic, aBold, + aCallback, aPlotter ); +} /** * Function PlotGraphicText diff --git a/common/gr_basic.cpp b/common/gr_basic.cpp index 9ff0cd4f3e..4cbeba1628 100644 --- a/common/gr_basic.cpp +++ b/common/gr_basic.cpp @@ -1512,6 +1512,14 @@ EDA_COLOR_T ColorByName( const wxChar *aName ) return UNSPECIFIED_COLOR; } +bool ColorIsLight( EDA_COLOR_T aColor ) +{ + const StructColors &c = g_ColorRefs[ColorGetBase( aColor )]; + int r = c.m_Red; + int g = c.m_Green; + int b = c.m_Blue; + return ((r * r) + (g * g) + (b * b)) > (128 * 128 * 3); +} EDA_COLOR_T ColorFindNearest( const wxColour &aColor ) { diff --git a/include/colors.h b/include/colors.h index eff6e49a55..7074b68abb 100644 --- a/include/colors.h +++ b/include/colors.h @@ -139,6 +139,12 @@ EDA_COLOR_T ColorByName( const wxChar *aName ); /// Find the nearest color match EDA_COLOR_T ColorFindNearest( const wxColour &aColor ); +/** + * Check if a color is light i.e. if black would be more readable than + * white on it + */ +bool ColorIsLight( EDA_COLOR_T aColor ); + inline const wxChar *ColorGetName( EDA_COLOR_T aColor ) { EDA_COLOR_T base = ColorGetBase( aColor ); diff --git a/include/drawtxt.h b/include/drawtxt.h index 43c638e39e..cbbd9fadd7 100644 --- a/include/drawtxt.h +++ b/include/drawtxt.h @@ -88,4 +88,27 @@ void DrawGraphicText( EDA_DRAW_PANEL * aPanel, PLOTTER * aPlotter = NULL ); +/** + * Draw graphic text with a border, so that it can be read on different + * backgrounds. See DrawGraphicText for most of the parameters. + * If aBgColor is a dark color text is drawn in aColor2 with aColor1 + * border; otherwise colors are swapped. + */ +void DrawGraphicHaloText( EDA_DRAW_PANEL * aPanel, + wxDC * aDC, + const wxPoint &aPos, + enum EDA_COLOR_T aBgColor, + enum EDA_COLOR_T aColor1, + enum EDA_COLOR_T aColor2, + const wxString &aText, + int aOrient, + const wxSize &aSize, + enum EDA_TEXT_HJUSTIFY_T aH_justify, + enum EDA_TEXT_VJUSTIFY_T aV_justify, + int aWidth, + bool aItalic, + bool aBold, + void (*aCallback)( int x0, int y0, int xf, int yf ) = NULL, + PLOTTER * aPlotter = NULL ); + #endif /* __INCLUDE__DRAWTXT_H__ */ diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp index 64d0f08518..c28d719df8 100644 --- a/pcbnew/class_dimension.cpp +++ b/pcbnew/class_dimension.cpp @@ -350,7 +350,7 @@ void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color, typeaff = DisplayOpt.DisplayDrawItems; width = m_Width; - if( DC->LogicalToDeviceXRel( width ) < 2 ) + if( DC->LogicalToDeviceXRel( width ) <= MIN_DRAW_WIDTH ) typeaff = LINE; switch( typeaff ) diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp index eafeda0688..1ecd428739 100644 --- a/pcbnew/class_drawsegment.cpp +++ b/pcbnew/class_drawsegment.cpp @@ -209,7 +209,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, if( m_Flags & FORCE_SKETCH ) mode = SKETCH; - if( l_trace < DC->DeviceToLogicalXRel( MIN_DRAW_WIDTH ) ) + if( DC->LogicalToDeviceXRel( l_trace ) <= MIN_DRAW_WIDTH ) mode = LINE; switch( m_Shape ) diff --git a/pcbnew/class_edge_mod.cpp b/pcbnew/class_edge_mod.cpp index 80a2c9a548..3cb827fa47 100644 --- a/pcbnew/class_edge_mod.cpp +++ b/pcbnew/class_edge_mod.cpp @@ -146,7 +146,7 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, typeaff = SKETCH; } - if( DC->LogicalToDeviceXRel( m_Width ) < MIN_DRAW_WIDTH ) + if( DC->LogicalToDeviceXRel( m_Width ) <= MIN_DRAW_WIDTH ) typeaff = LINE; switch( type_trace ) diff --git a/pcbnew/class_mire.cpp b/pcbnew/class_mire.cpp index 29c548ee43..82d26093c7 100644 --- a/pcbnew/class_mire.cpp +++ b/pcbnew/class_mire.cpp @@ -115,7 +115,7 @@ void PCB_TARGET::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color, typeaff = DisplayOpt.DisplayDrawItems; width = m_Width; - if( DC->LogicalToDeviceXRel( width ) < 2 ) + if( DC->LogicalToDeviceXRel( width ) <= MIN_DRAW_WIDTH ) typeaff = LINE; radius = m_Size / 3; diff --git a/pcbnew/class_pad_draw_functions.cpp b/pcbnew/class_pad_draw_functions.cpp index 23147ec956..5d14ba78b3 100644 --- a/pcbnew/class_pad_draw_functions.cpp +++ b/pcbnew/class_pad_draw_functions.cpp @@ -433,7 +433,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) switch( m_DrillShape ) { case PAD_CIRCLE: - if( aDC->LogicalToDeviceXRel( hole ) > 1 ) + if( aDC->LogicalToDeviceXRel( hole ) > MIN_DRAW_WIDTH ) GRFilledCircle( aClipBox, aDC, holepos.x, holepos.y, hole, 0, aDrawInfo.m_Color, hole_color ); break; @@ -487,6 +487,11 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) holepos.x - dx0, holepos.y + dx0, 0, nc_color ); } + if( aDrawInfo.m_DrawMode != GR_XOR ) + GRSetDrawMode( aDC, GR_COPY ); + else + GRSetDrawMode( aDC, GR_XOR ); + // Draw the pad number if( !aDrawInfo.m_Display_padnum && !aDrawInfo.m_Display_netname ) return; @@ -542,15 +547,17 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) numpad_len = std::max( numpad_len, MIN_CHAR_COUNT ); tsize = std::min( AreaSize.y, AreaSize.x / numpad_len ); - #define CHAR_SIZE_MIN 5 - if( aDC->LogicalToDeviceXRel( tsize ) >= CHAR_SIZE_MIN ) // Not drawable when size too small. + if( aDC->LogicalToDeviceXRel( tsize ) >= MIN_TEXT_SIZE ) // Not drawable when size too small. { // tsize reserve room for marges and segments thickness - tsize = (int) ( tsize * 0.8 ); - DrawGraphicText( aDrawInfo.m_DrawPanel, aDC, tpos, WHITE, buffer, t_angle, - wxSize( tsize, tsize ), GR_TEXT_HJUSTIFY_CENTER, - GR_TEXT_VJUSTIFY_CENTER, tsize / 7, false, false ); + tsize = ( tsize * 8 ) / 10; + DrawGraphicHaloText( aDrawInfo.m_DrawPanel, aDC, tpos, + aDrawInfo.m_Color, BLACK, WHITE, + buffer, t_angle, + wxSize( tsize , tsize ), GR_TEXT_HJUSTIFY_CENTER, + GR_TEXT_VJUSTIFY_CENTER, tsize / 7, false, false ); + } } @@ -561,7 +568,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) shortname_len = std::max( shortname_len, MIN_CHAR_COUNT ); tsize = std::min( AreaSize.y, AreaSize.x / shortname_len ); - if( aDC->LogicalToDeviceXRel( tsize ) >= CHAR_SIZE_MIN ) // Not drawable in size too small. + if( aDC->LogicalToDeviceXRel( tsize ) >= MIN_TEXT_SIZE ) // Not drawable in size too small. { tpos = tpos0; @@ -571,10 +578,12 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) RotatePoint( &tpos, shape_pos, angle ); // tsize reserve room for marges and segments thickness - tsize = (int) ( tsize * 0.8 ); - DrawGraphicText( aDrawInfo.m_DrawPanel, aDC, tpos, WHITE, m_ShortNetname, t_angle, - wxSize( tsize, tsize ), GR_TEXT_HJUSTIFY_CENTER, - GR_TEXT_VJUSTIFY_CENTER, tsize / 7, false, false ); + tsize = ( tsize * 8 ) / 10; + DrawGraphicHaloText( aDrawInfo.m_DrawPanel, aDC, tpos, + aDrawInfo.m_Color, BLACK, WHITE, + m_ShortNetname, t_angle, + wxSize( tsize, tsize ), GR_TEXT_HJUSTIFY_CENTER, + GR_TEXT_VJUSTIFY_CENTER, tsize / 7, false, false ); } } diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index a02944b39a..0d6c32fa48 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -275,7 +275,7 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) panel->GetParent(); int width = m_Thickness; if( ( frame->m_DisplayModText == LINE ) - || ( DC->LogicalToDeviceXRel( width ) < MIN_DRAW_WIDTH ) ) + || ( DC->LogicalToDeviceXRel( width ) <= MIN_DRAW_WIDTH ) ) width = 0; else if( frame->m_DisplayModText == SKETCH ) width = -width; diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index 3eb4364dbd..933f9ebed8 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -579,7 +579,7 @@ TRACK* TRACK::GetEndNetCode( int NetCode ) } -void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, +void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, const wxPoint& aOffset ) { int l_trace; @@ -592,29 +592,29 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, BOARD * brd = GetBoard( ); EDA_COLOR_T color = brd->GetLayerColor(m_Layer); - if( brd->IsLayerVisible( m_Layer ) == false && !( draw_mode & GR_HIGHLIGHT ) ) + if( brd->IsLayerVisible( m_Layer ) == false && !( aDrawMode & GR_HIGHLIGHT ) ) return; #ifdef USE_WX_OVERLAY // If dragged not draw in OnPaint otherwise remains impressed in wxOverlay - if( (m_Flags && IS_DRAGGED) && DC->IsKindOf(wxCLASSINFO(wxPaintDC))) + if( (m_Flags && IS_DRAGGED) && aDC->IsKindOf(wxCLASSINFO(wxPaintDC))) return; #endif - if( ( draw_mode & GR_ALLOW_HIGHCONTRAST ) && DisplayOpt.ContrastModeDisplay ) + if( ( aDrawMode & GR_ALLOW_HIGHCONTRAST ) && DisplayOpt.ContrastModeDisplay ) { if( !IsOnLayer( curr_layer ) ) ColorTurnToDarkDarkGray( &color ); } - if( draw_mode & GR_HIGHLIGHT ) - ColorChangeHighlightFlag( &color, !(draw_mode & GR_AND) ); + if( aDrawMode & GR_HIGHLIGHT ) + ColorChangeHighlightFlag( &color, !(aDrawMode & GR_AND) ); ColorApplyHighlightFlag( &color ); SetAlpha( &color, 150 ); - GRSetDrawMode( DC, draw_mode ); + GRSetDrawMode( aDC, aDrawMode ); l_trace = m_Width >> 1; @@ -624,29 +624,29 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, radius = (int) hypot( (double) ( m_End.x - m_Start.x ), (double) ( m_End.y - m_Start.y ) ); - if( DC->LogicalToDeviceXRel( l_trace ) < MIN_DRAW_WIDTH ) + if( aDC->LogicalToDeviceXRel( l_trace ) <= MIN_DRAW_WIDTH ) { - GRCircle( panel->GetClipBox(), DC, m_Start.x + aOffset.x, + GRCircle( panel->GetClipBox(), aDC, m_Start.x + aOffset.x, m_Start.y + aOffset.y, radius, color ); } else { - if( DC->LogicalToDeviceXRel( l_trace ) <= 1 ) /* Sketch mode if l_trace/zoom <= 1 */ + if( aDC->LogicalToDeviceXRel( l_trace ) <= MIN_DRAW_WIDTH ) // Line mode if too small { - GRCircle( panel->GetClipBox(), DC, m_Start.x + aOffset.x, + GRCircle( panel->GetClipBox(), aDC, m_Start.x + aOffset.x, m_Start.y + aOffset.y, radius, color ); } else if( ( !DisplayOpt.DisplayPcbTrackFill) || GetState( FORCE_SKETCH ) ) { - GRCircle( panel->GetClipBox(), DC, m_Start.x + aOffset.x, + GRCircle( panel->GetClipBox(), aDC, m_Start.x + aOffset.x, m_Start.y + aOffset.y, radius - l_trace, color ); - GRCircle( panel->GetClipBox(), DC, m_Start.x + aOffset.x, + GRCircle( panel->GetClipBox(), aDC, m_Start.x + aOffset.x, m_Start.y + aOffset.y, radius + l_trace, color ); } else { - GRCircle( panel->GetClipBox(), DC, m_Start.x + aOffset.x, + GRCircle( panel->GetClipBox(), aDC, m_Start.x + aOffset.x, m_Start.y + aOffset.y, radius, m_Width, color ); } } @@ -654,19 +654,19 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, return; } - if( DC->LogicalToDeviceXRel( l_trace ) < MIN_DRAW_WIDTH ) + if( aDC->LogicalToDeviceXRel( l_trace ) <= MIN_DRAW_WIDTH ) { - GRLine( panel->GetClipBox(), DC, m_Start + aOffset, m_End + aOffset, 0, color ); + GRLine( panel->GetClipBox(), aDC, m_Start + aOffset, m_End + aOffset, 0, color ); return; } if( !DisplayOpt.DisplayPcbTrackFill || GetState( FORCE_SKETCH ) ) { - GRCSegm( panel->GetClipBox(), DC, m_Start + aOffset, m_End + aOffset, m_Width, color ); + GRCSegm( panel->GetClipBox(), aDC, m_Start + aOffset, m_End + aOffset, m_Width, color ); } else { - GRFillCSegm( panel->GetClipBox(), DC, m_Start.x + aOffset.x, + GRFillCSegm( panel->GetClipBox(), aDC, m_Start.x + aOffset.x, m_Start.y + aOffset.y, m_End.x + aOffset.x, m_End.y + aOffset.y, m_Width, color ); } @@ -677,14 +677,13 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, // Show clearance for tracks, not for zone segments if( ShowClearance( this ) ) { - GRCSegm( panel->GetClipBox(), DC, m_Start + aOffset, m_End + aOffset, + GRCSegm( panel->GetClipBox(), aDC, m_Start + aOffset, m_End + aOffset, m_Width + (GetClearance() * 2), color ); } /* Display the short netname for tracks, not for zone segments. * we must filter tracks, to avoid a lot of texts. - * - only horizontal or vertical tracks are eligible - * - only tracks with a length > 10 * thickness are eligible + * - only tracks with a length > 10 * thickness are eligible * and, of course, if we are not printing the board */ if( Type() == PCB_ZONE_T ) @@ -694,15 +693,14 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, return; #define THRESHOLD 10 - if( (m_End.x - m_Start.x) != 0 && (m_End.y - m_Start.y) != 0 ) - return; - int len = std::abs( (m_End.x - m_Start.x) + (m_End.y - m_Start.y) ); + int len = int( hypot( (m_End.x - m_Start.x), (m_End.y - m_Start.y) ) ); if( len < THRESHOLD * m_Width ) return; - if( DC->LogicalToDeviceXRel( m_Width ) < 6 ) // no room to display a text inside track + // no room to display a text inside track + if( aDC->LogicalToDeviceXRel( m_Width ) < MIN_TEXT_SIZE ) return; if( GetNet() == 0 ) @@ -719,32 +717,53 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, { // calculate a good size for the text int tsize = std::min( m_Width, len / textlen ); + int dx = m_End.x - m_Start.x ; + int dy = m_End.y - m_Start.y ; wxPoint tpos = m_Start + m_End; tpos.x /= 2; tpos.y /= 2; // Calculate angle: if the track segment is vertical, angle = 90 degrees - int angle = 0; + // If horizontal 0 degrees, otherwise compute it + int angle; // angle is in 0.1 degree - if( (m_End.x - m_Start.x) == 0 ) // Vertical segment - angle = 900; // angle is in 0.1 degree - - if( DC->LogicalToDeviceXRel( tsize ) >= 6 ) + if( dy == 0 ) // Horizontal segment { - if( !(!IsOnLayer( curr_layer )&& DisplayOpt.ContrastModeDisplay) ) + angle = 0; + } + else + { + if( dx == 0 ) // Vertical segment { - tsize = (tsize * 8) / 10; // small reduction to give a better look - DrawGraphicText( panel, DC, tpos, - WHITE, net->GetShortNetname(), angle, wxSize( tsize, tsize ), - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, tsize / 7, - false, false ); + angle = 900; } + else + { + /* atan2 is *not* the solution here, since can give upside + down text. We want to work only in the first and fourth quadrant */ + angle = 10 * RAD2DEG( -atan( double( dy )/ double( dx ) ) ); + } + } + + if( ( aDC->LogicalToDeviceXRel( tsize ) >= MIN_TEXT_SIZE ) + && ( !(!IsOnLayer( curr_layer )&& DisplayOpt.ContrastModeDisplay) ) ) + { + if( (aDrawMode & GR_XOR) == 0 ) + GRSetDrawMode( aDC, GR_COPY ); + + tsize = (tsize * 8) / 10; // small reduction to give a better look + DrawGraphicHaloText( panel, aDC, tpos, + color, BLACK, WHITE, net->GetShortNetname(), angle, + wxSize( tsize, tsize ), + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, + tsize / 7, + false, false ); } } } -void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, +void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, const wxPoint& aOffset ) { int radius; @@ -757,7 +776,7 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, if( frame->m_DisplayViaFill == FILLED ) fillvia = 1; - GRSetDrawMode( DC, draw_mode ); + GRSetDrawMode( aDC, aDrawMode ); BOARD * brd = GetBoard( ); EDA_COLOR_T color = brd->GetVisibleElementColor(VIAS_VISIBLE + m_Shape); @@ -772,8 +791,8 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, ColorTurnToDarkDarkGray( &color ); } - if( draw_mode & GR_HIGHLIGHT ) - ColorChangeHighlightFlag( &color, !(draw_mode & GR_AND) ); + if( aDrawMode & GR_HIGHLIGHT ) + ColorChangeHighlightFlag( &color, !(aDrawMode & GR_AND) ); ColorApplyHighlightFlag( &color ); @@ -783,16 +802,16 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, radius = m_Width >> 1; // for small via size on screen (radius < 4 pixels) draw a simplified shape - int radius_in_pixels = DC->LogicalToDeviceXRel( radius ); + int radius_in_pixels = aDC->LogicalToDeviceXRel( radius ); bool fast_draw = false; // Vias are drawn as a filled circle or a double circle. The hole will be drawn later int drill_radius = GetDrillValue() / 2; - int inner_radius = radius - DC->DeviceToLogicalXRel( 2 ); + int inner_radius = radius - aDC->DeviceToLogicalXRel( 2 ); - if( radius_in_pixels < 3 ) + if( radius_in_pixels < MIN_VIA_DRAW_SIZE ) { fast_draw = true; fillvia = false; @@ -800,16 +819,16 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, if( fillvia ) { - GRFilledCircle( panel->GetClipBox(), DC, m_Start + aOffset, radius, color ); + GRFilledCircle( panel->GetClipBox(), aDC, m_Start + aOffset, radius, color ); } else { - GRCircle( panel->GetClipBox(), DC, m_Start + aOffset,radius, 0, color ); + GRCircle( panel->GetClipBox(), aDC, m_Start + aOffset, radius, 0, color ); if ( fast_draw ) return; - GRCircle( panel->GetClipBox(), DC, m_Start + aOffset, inner_radius, 0, color ); + GRCircle( panel->GetClipBox(), aDC, m_Start + aOffset, inner_radius, 0, color ); } // Draw the via hole if the display option allows it @@ -834,13 +853,11 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, color = BLACK; // or DARKGRAY; } - if( draw_mode != GR_XOR ) - GRSetDrawMode( DC, GR_COPY ); - else - GRSetDrawMode( DC, GR_XOR ); + if( (aDrawMode & GR_XOR) == 0) + GRSetDrawMode( aDC, GR_COPY ); - if( DC->LogicalToDeviceXRel( drill_radius ) > 1 ) // Draw hole if large enough. - GRFilledCircle( panel->GetClipBox(), DC, m_Start.x + aOffset.x, + if( aDC->LogicalToDeviceXRel( drill_radius ) > MIN_DRAW_WIDTH ) // Draw hole if large enough. + GRFilledCircle( panel->GetClipBox(), aDC, m_Start.x + aOffset.x, m_Start.y + aOffset.y, drill_radius, 0, color, color ); if( screen->m_IsPrinting ) @@ -849,14 +866,14 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, else { if( drill_radius < inner_radius ) // We can show the via hole - GRCircle( panel->GetClipBox(), DC, m_Start + aOffset, drill_radius, 0, color ); + GRCircle( panel->GetClipBox(), aDC, m_Start + aOffset, drill_radius, 0, color ); } } } if( ShowClearance( this ) ) { - GRCircle( panel->GetClipBox(), DC, m_Start + aOffset, radius + GetClearance(), 0, color ); + GRCircle( panel->GetClipBox(), aDC, m_Start + aOffset, radius + GetClearance(), 0, color ); } // for Micro Vias, draw a partial cross : X on component layer, or + on copper layer @@ -877,21 +894,21 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, } /* lines | or \ */ - GRLine( panel->GetClipBox(), DC, m_Start.x + aOffset.x - ax, + GRLine( panel->GetClipBox(), aDC, m_Start.x + aOffset.x - ax, m_Start.y + aOffset.y - ay, m_Start.x + aOffset.x - bx, m_Start.y + aOffset.y - by, 0, color ); - GRLine( panel->GetClipBox(), DC, m_Start.x + aOffset.x + bx, + GRLine( panel->GetClipBox(), aDC, m_Start.x + aOffset.x + bx, m_Start.y + aOffset.y + by, m_Start.x + aOffset.x + ax, m_Start.y + aOffset.y + ay, 0, color ); - /* lines - or / */ - GRLine( panel->GetClipBox(), DC, m_Start.x + aOffset.x + ay, + // lines - or / + GRLine( panel->GetClipBox(), aDC, m_Start.x + aOffset.x + ay, m_Start.y + aOffset.y - ax, m_Start.x + aOffset.x + by, m_Start.y + aOffset.y - bx, 0, color ); - GRLine( panel->GetClipBox(), DC, m_Start.x + aOffset.x - by, + GRLine( panel->GetClipBox(), aDC, m_Start.x + aOffset.x - by, m_Start.y + aOffset.y + bx, m_Start.x + aOffset.x - ay, m_Start.y + aOffset.y + ax, 0, color ); @@ -906,19 +923,19 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, ( (SEGVIA*) this )->ReturnLayerPair( &layer_top, &layer_bottom ); - /* lines for the top layer */ + // lines for the top layer RotatePoint( &ax, &ay, layer_top * 3600 / brd->GetCopperLayerCount( ) ); RotatePoint( &bx, &by, layer_top * 3600 / brd->GetCopperLayerCount( ) ); - GRLine( panel->GetClipBox(), DC, m_Start.x + aOffset.x - ax, + GRLine( panel->GetClipBox(), aDC, m_Start.x + aOffset.x - ax, m_Start.y + aOffset.y - ay, m_Start.x + aOffset.x - bx, m_Start.y + aOffset.y - by, 0, color ); - /* lines for the bottom layer */ + // lines for the bottom layer ax = 0; ay = radius; bx = 0; by = drill_radius; RotatePoint( &ax, &ay, layer_bottom * 3600 / brd->GetCopperLayerCount( ) ); RotatePoint( &bx, &by, layer_bottom * 3600 / brd->GetCopperLayerCount( ) ); - GRLine( panel->GetClipBox(), DC, m_Start.x + aOffset.x - ax, + GRLine( panel->GetClipBox(), aDC, m_Start.x + aOffset.x - ax, m_Start.y + aOffset.y - ay, m_Start.x + aOffset.x - bx, m_Start.y + aOffset.y - by, 0, color ); @@ -943,13 +960,17 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, // calculate a good size for the text int tsize = m_Width / len; - if( DC->LogicalToDeviceXRel( tsize ) >= 6 ) + if( aDC->LogicalToDeviceXRel( tsize ) >= MIN_TEXT_SIZE ) { tsize = (tsize * 8) / 10; // small reduction to give a better look, inside via - DrawGraphicText( panel, DC, m_Start, - WHITE, net->GetShortNetname(), 0, wxSize( tsize, tsize ), - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, tsize / 7, - false, false ); + if( (aDrawMode & GR_XOR) == 0 ) + GRSetDrawMode( aDC, GR_COPY ); + + DrawGraphicHaloText( panel, aDC, m_Start, + color, WHITE, BLACK, net->GetShortNetname(), 0, + wxSize( tsize, tsize ), + GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, + tsize / 7, false, false ); } } } diff --git a/pcbnew/class_track.h b/pcbnew/class_track.h index 7bc1eff36b..e11ab41e0e 100644 --- a/pcbnew/class_track.h +++ b/pcbnew/class_track.h @@ -50,6 +50,7 @@ class MSG_PANEL_ITEM; #define UNDEFINED_DRILL_DIAMETER -1 //< Undefined via drill diameter. +#define MIN_VIA_DRAW_SIZE 4 /// Minimum size in pixel for full drawing /** * Function GetTrace From 42709330e08415fb5217248ca5fd8c3f26105ba4 Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Tue, 9 Apr 2013 19:49:01 +0200 Subject: [PATCH 60/63] Better strings for the translators (converted concatenations to formats) --- common/basicframe.cpp | 6 +- common/dialogs/dialog_page_settings.cpp | 6 +- common/dsnlexer.cpp | 18 ++--- common/eda_doc.cpp | 3 +- common/gestfich.cpp | 9 +-- common/wxwineda.cpp | 3 +- cvpcb/cvpcb.cpp | 1 - cvpcb/dialogs/dialog_cvpcb_config.cpp | 2 +- cvpcb/setvisu.cpp | 9 +-- eeschema/component_references_lister.cpp | 66 +++++++++++-------- eeschema/database.cpp | 33 +++++++--- eeschema/dialogs/annotate_dialog.cpp | 23 ++++--- eeschema/dialogs/dialog_build_BOM.cpp | 8 +-- .../dialogs/dialog_edit_component_in_lib.cpp | 13 ++-- eeschema/dialogs/dialog_edit_label.cpp | 2 +- eeschema/dialogs/dialog_eeschema_config.cpp | 2 +- eeschema/eelibs_read_libraryfiles.cpp | 5 +- eeschema/files-io.cpp | 2 +- eeschema/find.cpp | 32 ++++----- eeschema/getpart.cpp | 4 +- eeschema/lib_arc.cpp | 2 +- eeschema/lib_circle.cpp | 2 +- eeschema/lib_export.cpp | 6 +- eeschema/lib_polyline.cpp | 8 +-- eeschema/lib_rectangle.cpp | 2 +- eeschema/lib_text.cpp | 2 +- eeschema/libarch.cpp | 3 +- eeschema/libedit.cpp | 30 +++++---- eeschema/libeditframe.cpp | 2 +- eeschema/load_one_schematic_file.cpp | 15 +++-- eeschema/netform.cpp | 7 +- eeschema/netlist.cpp | 14 ++-- eeschema/onrightclick.cpp | 60 +++++++++++------ eeschema/pinedit.cpp | 3 + eeschema/plot_schematic_DXF.cpp | 4 +- eeschema/plot_schematic_HPGL.cpp | 4 +- eeschema/plot_schematic_PDF.cpp | 4 +- eeschema/plot_schematic_PS.cpp | 4 +- eeschema/plot_schematic_SVG.cpp | 16 +++-- eeschema/sheet.cpp | 33 ++++++---- eeschema/symbedit.cpp | 2 +- gerbview/dcode.cpp | 2 +- gerbview/export_to_pcbnew.cpp | 2 +- gerbview/gerbview_frame.cpp | 2 +- gerbview/readgerb.cpp | 2 +- kicad/class_treeproject_item.cpp | 2 +- kicad/files-io.cpp | 13 ++-- kicad/prjconfig.cpp | 16 +++-- kicad/tree_project_frame.cpp | 3 +- pcbnew/autorouter/autoplac.cpp | 2 +- pcbnew/autorouter/solve.cpp | 2 +- pcbnew/build_BOM_from_board.cpp | 2 +- pcbnew/class_dimension.cpp | 5 +- pcbnew/class_edge_mod.cpp | 8 +-- pcbnew/class_marker_pcb.cpp | 8 +-- pcbnew/class_module.cpp | 11 ++-- pcbnew/class_pcb_text.cpp | 2 +- pcbnew/class_text_mod.cpp | 12 ++-- pcbnew/class_track.cpp | 11 ++-- pcbnew/class_zone.cpp | 8 +-- .../dialog_edit_module_for_BoardEditor.cpp | 4 +- pcbnew/dialogs/dialog_global_deletion.cpp | 2 +- pcbnew/dialogs/dialog_orient_footprints.cpp | 2 +- .../dialog_pcbnew_config_libs_and_paths.cpp | 3 +- pcbnew/editedge.cpp | 4 +- pcbnew/export_gencad.cpp | 2 +- pcbnew/gen_modules_placefile.cpp | 8 +-- pcbnew/gpcb_plugin.cpp | 14 ++-- pcbnew/kicad_plugin.cpp | 28 ++++---- pcbnew/layer_widget.cpp | 6 +- pcbnew/legacy_plugin.cpp | 32 ++++----- pcbnew/librairi.cpp | 20 +++--- pcbnew/loadcmp.cpp | 6 +- pcbnew/netlist.cpp | 8 +-- pcbnew/netlist_reader_common.cpp | 8 +-- pcbnew/netlist_reader_firstformat.cpp | 4 +- pcbnew/onleftclick.cpp | 4 +- pcbnew/pcb_parser.cpp | 8 +-- pcbnew/pcbplot.cpp | 6 +- pcbnew/specctra_export.cpp | 4 +- pcbnew/xchgmod.cpp | 12 ++-- 81 files changed, 424 insertions(+), 344 deletions(-) diff --git a/common/basicframe.cpp b/common/basicframe.cpp index 5da0db7756..d7ea5354eb 100644 --- a/common/basicframe.cpp +++ b/common/basicframe.cpp @@ -388,7 +388,8 @@ void EDA_BASE_FRAME::OnSelectPreferredEditor( wxCommandEvent& event ) wildcard += wxT( ".exe" ); #endif - wildcard = _( "Executable file (" ) + wildcard + wxT( ")|" ) + wildcard; + wildcard.Printf( _( "Executable file (%s)|%s" ), + GetChars( wildcard ), GetChars( wildcard ) ); wxFileDialog dlg( this, _( "Select Preferred Editor" ), fn.GetPath(), fn.GetFullName(), wildcard, @@ -644,7 +645,8 @@ edits you made?" ), // Rename the old file to the backup file name. if( !wxRenameFile( aFileName.GetFullPath(), backupFileName.GetFullPath() ) ) { - msg = _( "Could not create backup file " ) + backupFileName.GetFullPath(); + msg.Printf( _( "Could not create backup file <%s>" ), + GetChars( backupFileName.GetFullPath() ) ); wxMessageBox( msg ); } } diff --git a/common/dialogs/dialog_page_settings.cpp b/common/dialogs/dialog_page_settings.cpp index a183d52698..20aca80eb9 100644 --- a/common/dialogs/dialog_page_settings.cpp +++ b/common/dialogs/dialog_page_settings.cpp @@ -63,9 +63,9 @@ const wxString pageFmts[] = _("C 17x22in"), _("D 22x34in"), _("E 34x44in"), - _("USLetter 8.5x11in"), - _("USLegal 8.5x14in"), - _("USLedger 11x17in"), + _("US Letter 8.5x11in"), + _("US Legal 8.5x14in"), + _("US Ledger 11x17in"), _("User (Custom)"), wxT("") // end of list }; diff --git a/common/dsnlexer.cpp b/common/dsnlexer.cpp index 9efadcecca..00e9fad992 100644 --- a/common/dsnlexer.cpp +++ b/common/dsnlexer.cpp @@ -280,24 +280,25 @@ bool DSNLEXER::IsSymbol( int aTok ) void DSNLEXER::Expecting( int aTok ) throw( IO_ERROR ) { - wxString errText( _("Expecting") ); - errText << wxT(" ") << GetTokenString( aTok ); + wxString errText; + errText.Printf( _("Expecting %s"), GetChars( GetTokenString( aTok ) ) ); THROW_PARSE_ERROR( errText, CurSource(), CurLine(), CurLineNumber(), CurOffset() ); } void DSNLEXER::Expecting( const char* text ) throw( IO_ERROR ) { - wxString errText( _("Expecting") ); - errText << wxT(" '") << wxString::FromUTF8( text ) << wxT("'"); + wxString errText; + errText.Printf( _("Expecting '%s'"), + GetChars( wxString::FromUTF8( text ) ) ); THROW_PARSE_ERROR( errText, CurSource(), CurLine(), CurLineNumber(), CurOffset() ); } void DSNLEXER::Unexpected( int aTok ) throw( IO_ERROR ) { - wxString errText( _("Unexpected") ); - errText << wxT(" ") << GetTokenString( aTok ); + wxString errText; + errText.Printf( _("Unexpected %s"), GetChars( GetTokenString( aTok ) ) ); THROW_PARSE_ERROR( errText, CurSource(), CurLine(), CurLineNumber(), CurOffset() ); } @@ -312,8 +313,9 @@ void DSNLEXER::Duplicate( int aTok ) throw( IO_ERROR ) void DSNLEXER::Unexpected( const char* text ) throw( IO_ERROR ) { - wxString errText( _("Unexpected") ); - errText << wxT(" '") << wxString::FromUTF8( text ) << wxT("'"); + wxString errText; + errText.Printf( _("Unexpected '%s'"), + GetChars( wxString::FromUTF8( text ) ) ); THROW_PARSE_ERROR( errText, CurSource(), CurLine(), CurLineNumber(), CurOffset() ); } diff --git a/common/eda_doc.cpp b/common/eda_doc.cpp index 4082634b36..495359cf06 100644 --- a/common/eda_doc.cpp +++ b/common/eda_doc.cpp @@ -122,8 +122,7 @@ bool GetAssociatedDocument( wxFrame* aFrame, if( !wxFileExists( fullfilename ) ) { - msg = _( "Doc File " ); - msg << wxT("\"") << aDocName << wxT("\"") << _( " not found" ); + msg.Printf( _( "Doc File <%s> not found" ), GetChars( aDocName ) ); DisplayError( aFrame, msg ); return false; } diff --git a/common/gestfich.cpp b/common/gestfich.cpp index 0fb679615b..900b5b10a9 100644 --- a/common/gestfich.cpp +++ b/common/gestfich.cpp @@ -652,15 +652,16 @@ bool OpenPDF( const wxString& file ) if( !success ) { - wxString msg = _( "Problem while running the PDF viewer" ); - msg << _( "\n command is " ) << command; + wxString msg; + msg.Printf( _( "Problem while running the PDF viewer\nCommand is '%s'" ), + GetChars( command ) ); DisplayError( NULL, msg ); } } else { - wxString msg = _( "Unable to find a PDF viewer for" ); - msg << wxT( " " ) << filename; + wxString msg; + msg.Printf( _( "Unable to find a PDF viewer for <%s>" ), GetChars( filename ) ); DisplayError( NULL, msg ); success = false; } diff --git a/common/wxwineda.cpp b/common/wxwineda.cpp index 4a92cc1b7a..f68fe9a19c 100644 --- a/common/wxwineda.cpp +++ b/common/wxwineda.cpp @@ -57,7 +57,8 @@ EDA_GRAPHIC_TEXT_CTRL::EDA_GRAPHIC_TEXT_CTRL( wxWindow* parent, if( !Title.IsEmpty() ) { - wxString msg = _( "Size" ) + ReturnUnitSymbol( m_UserUnit ); + wxString msg; + msg.Printf( _( "Size%s" ), GetChars( ReturnUnitSymbol( m_UserUnit ) ) ); wxStaticText* text = new wxStaticText( parent, -1, msg ); BoxSizer->Add( text, 0, wxGROW | wxLEFT | wxRIGHT, 5 ); diff --git a/cvpcb/cvpcb.cpp b/cvpcb/cvpcb.cpp index 06b2367234..b556d198e5 100644 --- a/cvpcb/cvpcb.cpp +++ b/cvpcb/cvpcb.cpp @@ -27,7 +27,6 @@ const wxString RetroFileExtension( wxT( "stf" ) ); const wxString FootprintAliasFileExtension( wxT( "equ" ) ); // Wildcard for schematic retroannotation (import footprint names in schematic): -const wxString RetroFileWildcard( _( "KiCad retroannotation files (*.stf)|*.stf" ) ); const wxString FootprintAliasFileWildcard( _( "KiCad footprint alias files (*.equ)|*.equ" ) ); const wxString titleLibLoadError( _( "Library Load Error" ) ); diff --git a/cvpcb/dialogs/dialog_cvpcb_config.cpp b/cvpcb/dialogs/dialog_cvpcb_config.cpp index 7ffa02d5cc..b9ca3946c7 100644 --- a/cvpcb/dialogs/dialog_cvpcb_config.cpp +++ b/cvpcb/dialogs/dialog_cvpcb_config.cpp @@ -54,7 +54,7 @@ DIALOG_CVPCB_CONFIG::DIALOG_CVPCB_CONFIG( CVPCB_MAINFRAME* parent ) : m_Config = wxGetApp().GetCommonSettings(); Init( ); - title = _( "Project file: " ) + fn.GetFullPath(); + title.Format( _( "Project file: <%s>" ), GetChars( fn.GetFullPath() ) ); SetTitle( title ); if( GetSizer() ) diff --git a/cvpcb/setvisu.cpp b/cvpcb/setvisu.cpp index 02ef50df1a..e1196ec57d 100644 --- a/cvpcb/setvisu.cpp +++ b/cvpcb/setvisu.cpp @@ -60,15 +60,16 @@ void DISPLAY_FOOTPRINTS_FRAME::InitDisplay() if( !footprintName.IsEmpty() ) { - msg = _( "Footprint: " ) + footprintName; + msg.Printf( _( "Footprint: %s" ), GetChars( footprintName ) ); SetTitle( msg ); FOOTPRINT_INFO* module_info = parentframe->m_footprints.GetModuleInfo( footprintName ); - msg = _( "Lib: " ); + const wxChar *libname; if( module_info ) - msg += module_info->m_LibName; + libname = GetChars( module_info->m_LibName ); else - msg += wxT( "???" ); + libname = GetChars( wxT( "???" ) ); + msg.Printf( _( "Lib: %s" ), libname ); SetStatusText( msg, 0 ); diff --git a/eeschema/component_references_lister.cpp b/eeschema/component_references_lister.cpp index 54d64a6455..a6c92abe5f 100644 --- a/eeschema/component_references_lister.cpp +++ b/eeschema/component_references_lister.cpp @@ -708,14 +708,20 @@ int SCH_REFERENCE_LIST::CheckAnnotation( wxArrayString* aMessageList ) else tmp = wxT( "?" ); - msg.Printf( _( "Item not annotated: %s%s" ), - GetChars( componentFlatList[ii].GetRef() ), GetChars( tmp ) ); if( ( componentFlatList[ii].m_Unit > 0 ) && ( componentFlatList[ii].m_Unit < 0x7FFFFFFF ) ) { - tmp.Printf( _( " (unit %d)" ), componentFlatList[ii].m_Unit ); - msg << tmp; + msg.Printf( _( "Item not annotated: %s%s (unit %d)\n" ), + GetChars( componentFlatList[ii].GetRef() ), + GetChars( tmp ), + componentFlatList[ii].m_Unit ); + } + else + { + msg.Printf( _( "Item not annotated: %s%s\n" ), + GetChars( componentFlatList[ii].GetRef() ), + GetChars( tmp ) ); } if( aMessageList ) @@ -736,16 +742,14 @@ int SCH_REFERENCE_LIST::CheckAnnotation( wxArrayString* aMessageList ) else tmp = wxT( "?" ); - msg.Printf( _( "Error item %s%s" ), GetChars( componentFlatList[ii].GetRef() ), - GetChars( tmp ) ); - - tmp.Printf( _( " unit %d and no more than %d parts" ), + msg.Printf( _( "Error item %s%s unit %d and no more than %d parts\n" ), + GetChars( componentFlatList[ii].GetRef() ), + GetChars( tmp ), componentFlatList[ii].m_Unit, componentFlatList[ii].GetLibComponent()->GetPartCount() ); - msg << tmp; if( aMessageList ) - aMessageList->Add( msg + wxT( "\n" ) ); + aMessageList->Add( msg ); error++; break; @@ -775,18 +779,23 @@ int SCH_REFERENCE_LIST::CheckAnnotation( wxArrayString* aMessageList ) else tmp = wxT( "?" ); - msg.Printf( _( "Multiple item %s%s" ), - GetChars( componentFlatList[ii].GetRef() ), GetChars( tmp ) ); - - if( ( componentFlatList[ii].m_Unit > 0 ) - && ( componentFlatList[ii].m_Unit < 0x7FFFFFFF ) ) + if( ( componentFlatList[ii].m_Unit > 0 ) + && ( componentFlatList[ii].m_Unit < 0x7FFFFFFF ) ) { - tmp.Printf( _( " (unit %d)" ), componentFlatList[ii].m_Unit ); - msg << tmp; + msg.Printf( _( "Multiple item %s%s (unit %d)\n" ), + GetChars( componentFlatList[ii].GetRef() ), + GetChars( tmp ), + componentFlatList[ii].m_Unit ); + } + else + { + msg.Printf( _( "Multiple item %s%s\n" ), + GetChars( componentFlatList[ii].GetRef() ), + GetChars( tmp ) ); } if( aMessageList ) - aMessageList->Add( msg + wxT( "\n" ) ); + aMessageList->Add( msg ); error++; continue; @@ -802,18 +811,23 @@ int SCH_REFERENCE_LIST::CheckAnnotation( wxArrayString* aMessageList ) else tmp = wxT( "?" ); - msg.Printf( _( "Multiple item %s%s" ), - GetChars( componentFlatList[ii].GetRef() ), GetChars( tmp ) ); - - if( ( componentFlatList[ii].m_Unit > 0 ) - && ( componentFlatList[ii].m_Unit < 0x7FFFFFFF ) ) + if( ( componentFlatList[ii].m_Unit > 0 ) + && ( componentFlatList[ii].m_Unit < 0x7FFFFFFF ) ) { - tmp.Printf( _( " (unit %d)" ), componentFlatList[ii].m_Unit ); - msg << tmp; + msg.Printf( _( "Multiple item %s%s (unit %d)\n" ), + GetChars( componentFlatList[ii].GetRef() ), + GetChars( tmp ), + componentFlatList[ii].m_Unit ); + } + else + { + msg.Printf( _( "Multiple item %s%s\n" ), + GetChars( componentFlatList[ii].GetRef() ), + GetChars( tmp ) ); } if( aMessageList ) - aMessageList->Add( msg + wxT( "\n" )); + aMessageList->Add( msg ); error++; } diff --git a/eeschema/database.cpp b/eeschema/database.cpp index 8058f17431..6aca6f8793 100644 --- a/eeschema/database.cpp +++ b/eeschema/database.cpp @@ -56,18 +56,31 @@ wxString DataBaseGetName( EDA_DRAW_FRAME* frame, wxString& Keys, wxString& BufNa if( nameList.empty() ) { - msg = _( "No components found matching " ); - - if( !BufName.IsEmpty() ) + if( !BufName.IsEmpty() ) { - msg += _( "name search criteria <" ) + BufName + wxT( "> " ); - - if( !Keys.IsEmpty() ) - msg += _( "and " ); + if( !Keys.IsEmpty() ) + { + msg.Printf( _( "No components found matching name search criteria '%s' and key search criteria '%s'" ), + GetChars( BufName ), GetChars( Keys ) ); + } + else + { + msg.Printf( _( "No components found matching name search criteria '%s'" ), + GetChars( BufName ) ); + } + } + else + { + if( !Keys.IsEmpty() ) + { + msg.Printf( _( "No components found matching key search criteria '%s'" ), + GetChars( Keys ) ); + } + else + { + msg = _( "No components found matching" ); + } } - - if( !Keys.IsEmpty() ) - msg += _( "key search criteria <" ) + Keys + wxT( "> " ); DisplayInfoMessage( frame, msg ); diff --git a/eeschema/dialogs/annotate_dialog.cpp b/eeschema/dialogs/annotate_dialog.cpp index 8d2fc2ade2..c463e11009 100644 --- a/eeschema/dialogs/annotate_dialog.cpp +++ b/eeschema/dialogs/annotate_dialog.cpp @@ -132,16 +132,19 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event ) if( GetResetItems() ) { - message = _( "Clear and annotate all of the components " ); + if( GetLevel() ) + message += _( "Clear and annotate all of the components on the entire schematic?" ); + else + message += _( "Clear and annotate all of the components on the current sheet?" ); promptUser = true; } else - message = _( "Annotate only the unannotated components " ); - - if( GetLevel() ) - message += _( "on the entire schematic?" ); - else - message += _( "on the current sheet?" ); + { + if( GetLevel() ) + message += _( "Annotate only the unannotated components on the entire schematic?" ); + else + message += _( "Annotate only the unannotated components on the current sheet?" ); + } message += _( "\n\nThis operation will change the current annotation and cannot be undone." ); @@ -179,11 +182,11 @@ void DIALOG_ANNOTATE::OnClearAnnotationCmpClick( wxCommandEvent& event ) { int response; - wxString message = _( "Clear the existing annotation for " ); + wxString message; if( GetLevel() ) - message += _( "the entire schematic?" ); + message = _( "Clear the existing annotation for the entire schematic?" ); else - message += _( "the current sheet?" ); + message = _( "Clear the existing annotation for the current sheet?" ); message += _( "\n\nThis operation will clear the existing annotation and cannot be undone." ); response = wxMessageBox( message, wxT( "" ), wxICON_EXCLAMATION | wxOK | wxCANCEL ); diff --git a/eeschema/dialogs/dialog_build_BOM.cpp b/eeschema/dialogs/dialog_build_BOM.cpp index eac045fc38..95c01afe22 100644 --- a/eeschema/dialogs/dialog_build_BOM.cpp +++ b/eeschema/dialogs/dialog_build_BOM.cpp @@ -472,7 +472,7 @@ void DIALOG_BUILD_BOM::CreateSpreadSheetPartsShortList( ) if( ( f = wxFopen( m_listFileName, wxT( "wt" ) ) ) == NULL ) { wxString msg; - msg.Printf( _( "Failed to open file '%s'" ), GetChars(m_listFileName) ); + msg.Printf( _( "Failed to open file <%s>" ), GetChars(m_listFileName) ); DisplayError( this, msg ); return; } @@ -509,8 +509,7 @@ void DIALOG_BUILD_BOM::CreateSpreadSheetPartsFullList( bool aIncludeSubComponent if( ( f = wxFopen( m_listFileName, wxT( "wt" ) ) ) == NULL ) { - msg = _( "Failed to open file " ); - msg << m_listFileName; + msg.Printf( _( "Failed to open file <%s>" ), GetChars( m_listFileName ) ); DisplayError( this, msg ); return; } @@ -553,8 +552,7 @@ void DIALOG_BUILD_BOM::CreatePartsAndLabelsFullList( bool aIncludeSubComponents if( ( f = wxFopen( m_listFileName, wxT( "wt" ) ) ) == NULL ) { - msg = _( "Failed to open file " ); - msg << m_listFileName; + msg.Printf( _( "Failed to open file <%s>" ), GetChars( m_listFileName ) ); DisplayError( this, msg ); return; } diff --git a/eeschema/dialogs/dialog_edit_component_in_lib.cpp b/eeschema/dialogs/dialog_edit_component_in_lib.cpp index 0bb2726259..8b5ba1de76 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_lib.cpp @@ -49,18 +49,17 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::initDlg() return; } - wxString title = _( "Properties for " ); - + wxString title; bool isRoot = m_Parent->GetAliasName().CmpNoCase( component->GetName() ) == 0; if( !isRoot ) { - title += m_Parent->GetAliasName() + _( " (alias of " ) + component->GetName() + wxT( ")" ); + title.Printf( _( "Properties for %s (alias of %s)" ), + GetChars( m_Parent->GetAliasName() ), + GetChars( component->GetName() ) ); } else - { - title += component->GetName(); - } + title.Printf( _( "Properties for %s" ), GetChars( component->GetName() ) ); SetTitle( title ); InitPanelDoc(); @@ -453,7 +452,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::BrowseAndSelectDocFile( wxCommandEvent& e void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllFootprintFilter( wxCommandEvent& event ) { - if( IsOK( this, _( "Ok to Delete FootprintFilter LIST" ) ) ) + if( IsOK( this, _( "OK to Delete FootprintFilter LIST" ) ) ) { m_FootprintFilterListBox->Clear(); m_ButtonDeleteAllFootprintFilter->Enable( false ); diff --git a/eeschema/dialogs/dialog_edit_label.cpp b/eeschema/dialogs/dialog_edit_label.cpp index 70424476a2..edc191d350 100644 --- a/eeschema/dialogs/dialog_edit_label.cpp +++ b/eeschema/dialogs/dialog_edit_label.cpp @@ -194,7 +194,7 @@ void DIALOG_LABEL_EDITOR::InitDialog() m_TextStyle->SetSelection( style ); wxString units = ReturnUnitSymbol( g_UserUnit, wxT( "(%s)" ) ); - msg = _( "H" ) + units + _( " x W" ) + units; + msg.Printf( _( "H%s x W%s" ), GetChars( units ), GetChars( units ) ); m_staticSizeUnits->SetLabel( msg ); msg = ReturnStringFromValue( g_UserUnit, m_CurrentText->GetSize().x ); diff --git a/eeschema/dialogs/dialog_eeschema_config.cpp b/eeschema/dialogs/dialog_eeschema_config.cpp index 0e4751d171..b8994c03a5 100644 --- a/eeschema/dialogs/dialog_eeschema_config.cpp +++ b/eeschema/dialogs/dialog_eeschema_config.cpp @@ -54,7 +54,7 @@ DIALOG_EESCHEMA_CONFIG::DIALOG_EESCHEMA_CONFIG( SCH_EDIT_FRAME* aSchFrame, Init(); - msg = _( "from " ) + wxGetApp().GetCurrentOptionFile(); + msg.Printf( _( "from <%s>" ), GetChars( wxGetApp().GetCurrentOptionFile() ) ); SetTitle( msg ); if( GetSizer() ) diff --git a/eeschema/eelibs_read_libraryfiles.cpp b/eeschema/eelibs_read_libraryfiles.cpp index 05ab46c11f..5d623767ed 100644 --- a/eeschema/eelibs_read_libraryfiles.cpp +++ b/eeschema/eelibs_read_libraryfiles.cpp @@ -68,12 +68,11 @@ void SCH_EDIT_FRAME::LoadLibraries( void ) } // Loaded library statusbar message - msg = _( "Library " ) + tmp; fn = tmp; if( CMP_LIBRARY::AddLibrary( fn, errMsg ) ) { - msg += _( " loaded" ); + msg.Printf( _( "Library <%s> loaded" ), GetChars( tmp ) ); sortOrder.Add( fn.GetName() ); } else @@ -84,7 +83,7 @@ void SCH_EDIT_FRAME::LoadLibraries( void ) GetChars( fn.GetFullPath() ), GetChars( errMsg ) ); DisplayError( this, prompt ); - msg += _( " error!" ); + msg.Printf( _( "Library <%s> error!" ), GetChars( tmp ) ); } PrintMsg( msg ); diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index c282cca629..46263035c2 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -336,7 +336,7 @@ bool SCH_EDIT_FRAME::LoadOneEEProject( const wxString& aFileName, bool aIsNew ) } // Reloading configuration. - msg = _( "Ready\nWorking dir: \n" ) + wxGetCwd(); + msg.Printf( _( "Ready\nWorking dir: <%s>\n" ), GetChars( wxGetCwd() ) ); PrintMsg( msg ); LoadProjectFile( wxEmptyString, false ); diff --git a/eeschema/find.cpp b/eeschema/find.cpp index b77390f734..845eb4ec74 100644 --- a/eeschema/find.cpp +++ b/eeschema/find.cpp @@ -122,7 +122,6 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference, wxPoint pos, curpos; bool centerAndRedraw = false; bool notFound = true; - wxString msg; LIB_PIN* pin; SCH_SHEET_LIST sheetList; @@ -236,28 +235,29 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference, /* Print diag */ wxString msg_item; - msg = aReference; + wxString msg; switch( aSearchType ) { default: case FIND_COMPONENT_ONLY: // Find component only + msg_item = _( "component" ); break; case FIND_PIN: // find a pin - msg_item = _( "Pin " ) + aSearchText; + msg_item.Printf( _( "pin %s" ), GetChars( aSearchText ) ); break; case FIND_REFERENCE: // find reference - msg_item = _( "Ref " ) + aSearchText; + msg_item.Printf( _( "reference %s" ), GetChars( aSearchText ) ); break; case FIND_VALUE: // find value - msg_item = _( "Value " ) + aSearchText; + msg_item.Printf( _( "value " ), GetChars( aSearchText ) ); break; case FIND_FIELD: // find field. todo - msg_item = _( "Field " ) + aSearchText; + msg_item.Printf( _( "field " ), GetChars( aSearchText ) ); break; } @@ -265,27 +265,19 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference, { if( !notFound ) { - if( !msg_item.IsEmpty() ) - msg += wxT( " " ) + msg_item; - - msg += _( " found" ); + msg.Printf( _( "%s %s found" ), + GetChars( aReference ), GetChars( msg_item ) ); } else { - msg += _( " found" ); - - if( !msg_item.IsEmpty() ) - { - msg += wxT( " but " ) + msg_item + _( " not found" ); - } + msg.Printf( _( "%s found but %s not found" ), + GetChars( aReference ), GetChars( msg_item ) ); } } else { - if( !msg_item.IsEmpty() ) - msg += wxT( " " ) + msg_item; - - msg += _( " not found" ); + msg.Printf( _( "Component %s not found" ), + GetChars( aReference ) ); } SetStatusText( msg ); diff --git a/eeschema/getpart.cpp b/eeschema/getpart.cpp index 327a11ccea..3f651f5cce 100644 --- a/eeschema/getpart.cpp +++ b/eeschema/getpart.cpp @@ -117,8 +117,8 @@ wxString SCH_BASE_FRAME::SelectComponentFromLibrary( const wxString& aLibname, } } - /* Ask for a component name or key words */ - msg.Printf( _( "component selection (%d items loaded):" ), CmpCount ); + // Ask for a component name or key words + msg.Printf( _( "Component selection (%d items loaded):" ), CmpCount ); DIALOG_GET_COMPONENT dlg( this, aHistoryList, msg, aUseLibBrowser ); diff --git a/eeschema/lib_arc.cpp b/eeschema/lib_arc.cpp index bc219fbb42..38e8d97549 100644 --- a/eeschema/lib_arc.cpp +++ b/eeschema/lib_arc.cpp @@ -131,7 +131,7 @@ bool LIB_ARC::Load( LINE_READER& aLineReader, wxString& aErrorMsg ) &m_Convert, &m_Width, tmp, &startx, &starty, &endx, &endy ); if( cnt < 8 ) { - aErrorMsg.Printf( _( "arc only had %d parameters of the required 8" ), cnt ); + aErrorMsg.Printf( _( "Arc only had %d parameters of the required 8" ), cnt ); return false; } diff --git a/eeschema/lib_circle.cpp b/eeschema/lib_circle.cpp index eba6999410..72ed65b853 100644 --- a/eeschema/lib_circle.cpp +++ b/eeschema/lib_circle.cpp @@ -74,7 +74,7 @@ bool LIB_CIRCLE::Load( LINE_READER& aLineReader, wxString& aErrorMsg ) if( cnt < 6 ) { - aErrorMsg.Printf( _( "circle only had %d parameters of the required 6" ), cnt ); + aErrorMsg.Printf( _( "Circle only had %d parameters of the required 6" ), cnt ); return false; } diff --git a/eeschema/lib_export.cpp b/eeschema/lib_export.cpp index c81695e6cf..b32980b330 100644 --- a/eeschema/lib_export.cpp +++ b/eeschema/lib_export.cpp @@ -149,19 +149,19 @@ void LIB_EDIT_FRAME::OnExportPart( wxCommandEvent& event ) { if( createLib ) { - msg = fn.GetFullPath() + _( " - OK" ); + msg.Printf( _( "<%s> - OK" ), GetChars( fn.GetFullPath() ) ); DisplayInfoMessage( this, _( "This library will not be available \ until it is loaded by Eeschema.\n\nModify the Eeschema library configuration \ if you want to include it as part of this project." ) ); } else { - msg = fn.GetFullPath() + _( " - Export OK" ); + msg.Printf( _( "<%s> - Export OK" ), GetChars( fn.GetFullPath() ) ); } } // Error else { - msg = _( "Error creating " ) + fn.GetFullName(); + msg.Printf( _( "Error creating <%s>" ), GetChars( fn.GetFullName() ) ); } SetStatusText( msg ); diff --git a/eeschema/lib_polyline.cpp b/eeschema/lib_polyline.cpp index 86807d6b97..27c5f4b4bf 100644 --- a/eeschema/lib_polyline.cpp +++ b/eeschema/lib_polyline.cpp @@ -85,13 +85,13 @@ bool LIB_POLYLINE::Load( LINE_READER& aLineReader, wxString& aErrorMsg ) if( i < 4 ) { - aErrorMsg.Printf( _( "polyline only had %d parameters of the required 4" ), i ); + aErrorMsg.Printf( _( "Polyline only had %d parameters of the required 4" ), i ); return false; } if( ccount <= 0 ) { - aErrorMsg.Printf( _( "polyline count parameter %d is invalid" ), ccount ); + aErrorMsg.Printf( _( "Polyline count parameter %d is invalid" ), ccount ); return false; } @@ -107,7 +107,7 @@ bool LIB_POLYLINE::Load( LINE_READER& aLineReader, wxString& aErrorMsg ) if( p == NULL || sscanf( p, "%d", &pt.x ) != 1 ) { - aErrorMsg.Printf( _( "polyline point %d X position not defined" ), i ); + aErrorMsg.Printf( _( "Polyline point %d X position not defined" ), i ); return false; } @@ -115,7 +115,7 @@ bool LIB_POLYLINE::Load( LINE_READER& aLineReader, wxString& aErrorMsg ) if( p == NULL || sscanf( p, "%d", &pt.y ) != 1 ) { - aErrorMsg.Printf( _( "polyline point %d Y position not defined" ), i ); + aErrorMsg.Printf( _( "Polyline point %d Y position not defined" ), i ); return false; } diff --git a/eeschema/lib_rectangle.cpp b/eeschema/lib_rectangle.cpp index 5ac99ba5a2..508e49ff42 100644 --- a/eeschema/lib_rectangle.cpp +++ b/eeschema/lib_rectangle.cpp @@ -76,7 +76,7 @@ bool LIB_RECTANGLE::Load( LINE_READER& aLineReader, wxString& aErrorMsg ) if( cnt < 7 ) { - aErrorMsg.Printf( _( "rectangle only had %d parameters of the required 7" ), cnt ); + aErrorMsg.Printf( _( "Rectangle only had %d parameters of the required 7" ), cnt ); return false; } diff --git a/eeschema/lib_text.cpp b/eeschema/lib_text.cpp index 320119c09a..7964844b47 100644 --- a/eeschema/lib_text.cpp +++ b/eeschema/lib_text.cpp @@ -130,7 +130,7 @@ bool LIB_TEXT::Load( LINE_READER& aLineReader, wxString& errorMsg ) if( cnt < 8 ) { - errorMsg.Printf( _( "text only had %d parameters of the required 8" ), cnt ); + errorMsg.Printf( _( "Text only had %d parameters of the required 8" ), cnt ); return false; } diff --git a/eeschema/libarch.cpp b/eeschema/libarch.cpp index 896b4736f6..05ebc3731a 100644 --- a/eeschema/libarch.cpp +++ b/eeschema/libarch.cpp @@ -102,7 +102,8 @@ bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName ) } catch( ... /* IO_ERROR ioe */ ) { - msg = wxT( "Failed to create component library file " ) + aFileName; + msg.Printf( _( "Failed to create component library file <%s>" ), + GetChars( aFileName ) ); DisplayError( this, msg ); return false; } diff --git a/eeschema/libedit.cpp b/eeschema/libedit.cpp index 7ec6f1351f..8f761b5104 100644 --- a/eeschema/libedit.cpp +++ b/eeschema/libedit.cpp @@ -170,7 +170,7 @@ void LIB_EDIT_FRAME::LoadOneLibraryPart( wxCommandEvent& event ) if( libEntry == NULL ) { - msg.Printf( _( "Component name \"%s\" not found in library \"%s\"." ), + msg.Printf( _( "Component name %s not found in library %s" ), GetChars( CmpName ), GetChars( searchLib->GetName() ) ); DisplayError( this, msg ); @@ -337,7 +337,8 @@ bool LIB_EDIT_FRAME::SaveActiveLibrary( bool newFile ) { fn = wxFileName( m_library->GetFullFileName() ); - msg = _( "Modify library file \"" ) + fn.GetFullPath() + _( "\"?" ); + msg.Printf( _( "Modify library file <%s> ?" ), + GetChars( fn.GetFullPath() ) ); if( !IsOK( this, msg ) ) return false; @@ -374,7 +375,8 @@ bool LIB_EDIT_FRAME::SaveActiveLibrary( bool newFile ) if( !m_library->Save( libFormatter ) ) { - msg = _( "Error occurred while saving library file \"" ) + fn.GetFullPath() + _( "\"." ); + msg.Printf( _( "Error occurred while saving library file <%s>" ), + GetChars( fn.GetFullPath() ) ); AppendMsgPanel( _( "*** ERROR: ***" ), msg, RED ); DisplayError( this, msg ); return false; @@ -383,7 +385,8 @@ bool LIB_EDIT_FRAME::SaveActiveLibrary( bool newFile ) catch( ... /* IO_ERROR ioe */ ) { libFileName.MakeAbsolute(); - msg = wxT( "Failed to create component library file " ) + libFileName.GetFullPath(); + msg.Printf( _( "Failed to create component library file <%s>" ), + GetChars( libFileName.GetFullPath() ) ); DisplayError( this, msg ); return false; } @@ -413,8 +416,8 @@ bool LIB_EDIT_FRAME::SaveActiveLibrary( bool newFile ) if( !m_library->SaveDocs( docFormatter ) ) { - msg = _( "Error occurred while saving library document file \"" ) + - docFileName.GetFullPath() + _( "\"." ); + msg.Printf( _( "Error occurred while saving library documentation file <%s>" ), + GetChars( docFileName.GetFullPath() ) ); AppendMsgPanel( _( "*** ERROR: ***" ), msg, RED ); DisplayError( this, msg ); return false; @@ -423,15 +426,16 @@ bool LIB_EDIT_FRAME::SaveActiveLibrary( bool newFile ) catch( ... /* IO_ERROR ioe */ ) { docFileName.MakeAbsolute(); - msg = wxT( "Failed to create component document library file " ) + - docFileName.GetFullPath(); + msg.Printf( _( "Failed to create component document library file <%s>" ), + GetChars( docFileName.GetFullPath() ) ); DisplayError( this, msg ); return false; } - msg = _( "Library file \"" ) + fn.GetFullName() + wxT( "\" Ok" ); + msg.Printf( _( "Library file <%s> OK" ), GetChars( fn.GetFullName() ) ); fn.SetExt( DOC_EXT ); - wxString msg1 = _( "Document file \"" ) + fn.GetFullPath() + wxT( "\" Ok" ); + wxString msg1; + msg1.Printf( _( "Documentation file <%s> OK" ), GetChars( fn.GetFullPath() ) ); AppendMsgPanel( msg, msg1, BLUE ); return true; @@ -539,7 +543,7 @@ void LIB_EDIT_FRAME::DeleteOnePart( wxCommandEvent& event ) return; } - msg.Printf( _( "Delete component \"%s\" from library \"%s\"?" ), + msg.Printf( _( "Delete component %s from library %s?" ), GetChars( LibEntry->GetName() ), GetChars( m_library->GetName() ) ); @@ -615,7 +619,7 @@ lost!\n\nClear the current component from the screen?" ) ) ) if( m_library && m_library->FindEntry( name ) ) { wxString msg; - msg.Printf( _( "Component \"%s\" already exists in library \"%s\"." ), + msg.Printf( _( "Component %s already exists in library %s" ), GetChars( name ), GetChars( m_library->GetName() ) ); DisplayError( this, msg ); @@ -704,7 +708,7 @@ void LIB_EDIT_FRAME::SaveOnePartInMemory() if( oldComponent != NULL ) { - msg.Printf( _( "Component \"%s\" already exists. Change it?" ), + msg.Printf( _( "Component %s already exists. Change it?" ), GetChars( m_component->GetName() ) ); if( !IsOK( this, msg ) ) diff --git a/eeschema/libeditframe.cpp b/eeschema/libeditframe.cpp index 21f8d4716f..acee6deba3 100644 --- a/eeschema/libeditframe.cpp +++ b/eeschema/libeditframe.cpp @@ -369,7 +369,7 @@ void LIB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event ) if( lib.IsModified() ) { wxString msg; - msg.Printf( _( "Library \"%s\" was modified!\nDiscard changes?" ), + msg.Printf( _( "Library %s was modified!\nDiscard changes?" ), GetChars( lib.GetName() ) ); if( !IsOK( this, msg ) ) diff --git a/eeschema/load_one_schematic_file.cpp b/eeschema/load_one_schematic_file.cpp index 6d0d5528c0..f75c81ab7b 100644 --- a/eeschema/load_one_schematic_file.cpp +++ b/eeschema/load_one_schematic_file.cpp @@ -86,7 +86,7 @@ bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFi if( ( f = wxFopen( fname, wxT( "rt" ) ) ) == NULL ) { - msgDiag = _( "Failed to open " ) + aFullFileName; + msgDiag.Printf( _( "Failed to open <%s>" ), GetChars( aFullFileName ) ); DisplayError( this, msgDiag ); return false; } @@ -94,14 +94,14 @@ bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFi // reader now owns the open FILE. FILE_LINE_READER reader( f, aFullFileName ); - msgDiag = _( "Loading " ) + aScreen->GetFileName(); + msgDiag.Printf( _( "Loading <%s>" ), GetChars( aScreen->GetFileName() ) ); PrintMsg( msgDiag ); if( !reader.ReadLine() || strncmp( (char*)reader + 9, SCHEMATIC_HEAD_STRING, sizeof( SCHEMATIC_HEAD_STRING ) - 1 ) != 0 ) { - msgDiag = aFullFileName + _( " is NOT an Eeschema file!" ); + msgDiag.Printf( _( "<%s> is NOT an Eeschema file!" ), GetChars( aFullFileName ) ); DisplayError( this, msgDiag ); return false; } @@ -119,8 +119,9 @@ bool SCH_EDIT_FRAME::LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFi if( version > EESCHEMA_VERSION ) { - msgDiag = aFullFileName + _( " was created by a more recent \ -version of Eeschema and may not load correctly. Please consider updating!" ); + msgDiag.Printf( _( "<%s> was created by a more recent \ +version of Eeschema and may not load correctly. Please consider updating!" ), + GetChars( aFullFileName ) ); DisplayInfoMessage( this, msgDiag ); } @@ -138,7 +139,7 @@ again." ); if( !reader.ReadLine() || strncmp( reader, "LIBS:", 5 ) != 0 ) { - msgDiag = aFullFileName + _( " is NOT an Eeschema file!" ); + msgDiag.Printf( _( "<%s> is NOT an Eeschema file!" ), GetChars( aFullFileName ) ); DisplayError( this, msgDiag ); return false; } @@ -252,7 +253,7 @@ again." ); aScreen->TestDanglingEnds(); - msgDiag = _( "Done Loading " ) + aScreen->GetFileName(); + msgDiag.Printf( _( "Done Loading <%s>" ), GetChars( aScreen->GetFileName() ) ); PrintMsg( msgDiag ); return true; // Although it may be that file is only partially loaded. diff --git a/eeschema/netform.cpp b/eeschema/netform.cpp index 5d71c919d9..9a39af7109 100644 --- a/eeschema/netform.cpp +++ b/eeschema/netform.cpp @@ -380,7 +380,9 @@ bool SCH_EDIT_FRAME::WriteNetListFile( int aFormat, const wxString& aFullFileNam { if( ( f = wxFopen( aFullFileName, wxT( "wt" ) ) ) == NULL ) { - wxString msg = _( "Failed to create file " ) + aFullFileName; + wxString msg; + msg.Printf( _( "Failed to create file <%s>" ), + GetChars( aFullFileName ) ); DisplayError( this, msg ); return false; } @@ -1102,7 +1104,8 @@ bool NETLIST_EXPORT_TOOL::WriteGENERICNetList( const wxString& aOutFileName ) if( ( out = wxFopen( aOutFileName, wxT( "wt" ) ) ) == NULL ) { - wxString msg = _( "Failed to create file " ) + aOutFileName; + wxString msg; + msg.Printf( _( "Failed to create file <%s>" ), GetChars( aOutFileName ) ); DisplayError( NULL, msg ); return false; } diff --git a/eeschema/netlist.cpp b/eeschema/netlist.cpp index 8d071e8714..d6c0471a8e 100644 --- a/eeschema/netlist.cpp +++ b/eeschema/netlist.cpp @@ -146,14 +146,14 @@ void SCH_EDIT_FRAME::BuildNetListBase() if( g_NetObjectslist.size() == 0 ) return; // no objects - activity << wxT( " " ) << _( "net count =" ) << wxT( " " ) << g_NetObjectslist.size(); + activity += wxString::Format( _( " net count = %u" ), g_NetObjectslist.size() ); SetStatusText( activity ); /* Sort objects by Sheet */ sort( g_NetObjectslist.begin(), g_NetObjectslist.end(), SortItemsBySheet ); - activity << wxT( ", " ) << _( "connections" ) << wxT( "..." ); + activity += _( ", connections... " ); SetStatusText( activity ); sheet = &(g_NetObjectslist[0]->m_SheetList); @@ -261,13 +261,13 @@ void SCH_EDIT_FRAME::BuildNetListBase() dumpNetTable(); #endif - activity << _( "done" ); + activity += _( "done" ); SetStatusText( activity ); /* Updating the Bus Labels Netcode connected by Bus */ ConnectBusLabels( g_NetObjectslist ); - activity << wxT( ", " ) << _( "bus labels" ) << wxT( "..." ); + activity += _( ", bus labels..." ); SetStatusText( activity ); /* Group objects by label. */ @@ -306,11 +306,11 @@ void SCH_EDIT_FRAME::BuildNetListBase() dumpNetTable(); #endif - activity << _( "done" ); + activity += _( "done" ); SetStatusText( activity ); /* Connection hierarchy. */ - activity << wxT( ", " ) << _( "hierarchy..." ); + activity += _( ", hierarchy..." ); SetStatusText( activity ); for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ ) @@ -328,7 +328,7 @@ void SCH_EDIT_FRAME::BuildNetListBase() dumpNetTable(); #endif - activity << _( "done" ); + activity += _( "done" ); SetStatusText( activity ); /* Compress numbers of Netcode having consecutive values. */ diff --git a/eeschema/onrightclick.cpp b/eeschema/onrightclick.cpp index 42e406b794..db36e65d66 100644 --- a/eeschema/onrightclick.cpp +++ b/eeschema/onrightclick.cpp @@ -301,36 +301,54 @@ void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field ) { wxString msg, name; - name << wxT(" "); - switch( Field->GetId() ) - { - case REFERENCE: name << _( "Reference" ); break; - case VALUE: name << _( "Value" ); break; - case FOOTPRINT: name << _( "Footprint Field" ); break; - default: name << _( "Field" ); break; - } - if( !Field->GetFlags() ) { - msg = AddHotkeyName( _( "Move" ) + name, s_Schematic_Hokeys_Descr, - HK_MOVE_COMPONENT_OR_ITEM ); + switch( Field->GetId() ) + { + case REFERENCE: name = _( "Move reference" ); break; + case VALUE: name = _( "Move value" ); break; + case FOOTPRINT: name = _( "Move footprint field" ); break; + default: name = _( "Move field" ); break; + } + + msg = AddHotkeyName( name, s_Schematic_Hokeys_Descr, + HK_MOVE_COMPONENT_OR_ITEM ); AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_text_xpm ) ); } - msg = AddHotkeyName( _( "Rotate" ) + name, s_Schematic_Hokeys_Descr, - HK_ROTATE ); + switch( Field->GetId() ) + { + case REFERENCE: name = _( "Rotate reference" ); break; + case VALUE: name = _( "Rotate value" ); break; + case FOOTPRINT: name = _( "Rotate footprint field" ); break; + default: name = _( "Rotate field" ); break; + } + + msg = AddHotkeyName( name, s_Schematic_Hokeys_Descr, HK_ROTATE ); AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_field_xpm ) ); // Ref, value and footprint have specific hotkeys. Show the specific hotkey: hotkey_id_commnand id; switch( Field->GetId() ) { - case REFERENCE: id = HK_EDIT_COMPONENT_REFERENCE; break; - case VALUE: id = HK_EDIT_COMPONENT_VALUE; break; - case FOOTPRINT: id = HK_EDIT_COMPONENT_FOOTPRINT; break; - default: id = HK_EDIT; break; + case REFERENCE: + id = HK_EDIT_COMPONENT_REFERENCE; + name = _( "Edit reference" ); + break; + case VALUE: + id = HK_EDIT_COMPONENT_VALUE; + name = _( "Edit value" ); + break; + case FOOTPRINT: + id = HK_EDIT_COMPONENT_FOOTPRINT; + name = _( "Edit footprint field" ); + break; + default: + id = HK_EDIT; + name = _( "Edit field" ); + break; } - msg = AddHotkeyName( _( "Edit" ) + name, s_Schematic_Hokeys_Descr, id ); + msg = AddHotkeyName( name, s_Schematic_Hokeys_Descr, id ); AddMenuItem( PopMenu, ID_SCH_EDIT_ITEM, msg, KiBitmap( edit_text_xpm ) ); } @@ -350,8 +368,8 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component ) if( !Component->GetFlags() ) { - msg = _( "Move Component" ); - msg << wxT( " " ) << Component->GetField( REFERENCE )->GetText(); + msg.Printf( _( "Move Component %s" ), + GetChars( Component->GetField( REFERENCE )->GetText() ) ); msg = AddHotkeyName( msg, s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT_OR_ITEM ); AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) ); msg = AddHotkeyName( _( "Drag Component" ), s_Schematic_Hokeys_Descr, HK_DRAG ); @@ -825,7 +843,7 @@ void AddMenusForBlock( wxMenu* PopMenu, SCH_EDIT_FRAME* frame ) msg = AddHotkeyName( _( "Mirror Block --" ), s_Schematic_Hokeys_Descr, HK_MIRROR_X_COMPONENT ); AddMenuItem( PopMenu, ID_SCH_MIRROR_X, msg, KiBitmap( mirror_v_xpm ) ); - msg = AddHotkeyName( _( "Rotate Block ccw" ), s_Schematic_Hokeys_Descr, HK_ROTATE ); + msg = AddHotkeyName( _( "Rotate Block CCW" ), s_Schematic_Hokeys_Descr, HK_ROTATE ); AddMenuItem( PopMenu, ID_SCH_ROTATE_CLOCKWISE, msg, KiBitmap( rotate_ccw_xpm ) ); #if 0 diff --git a/eeschema/pinedit.cpp b/eeschema/pinedit.cpp index 2095e17325..f84128f232 100644 --- a/eeschema/pinedit.cpp +++ b/eeschema/pinedit.cpp @@ -645,6 +645,9 @@ void LIB_EDIT_FRAME::OnCheckComponent( wxCommandEvent& event ) dup_error++; Pin->ReturnPinStringNum( stringPinNum ); + + /* TODO I dare someone to find a way to make happy translators on + this thing! Lorenzo */ curr_pin->ReturnPinStringNum( stringCurrPinNum ); msg.Printf( _( "Duplicate pin %s \"%s\" at location (%.3f, \ %.3f) conflicts with pin %s \"%s\" at location (%.3f, %.3f)" ), diff --git a/eeschema/plot_schematic_DXF.cpp b/eeschema/plot_schematic_DXF.cpp index 41183c98c5..8cc0c75268 100644 --- a/eeschema/plot_schematic_DXF.cpp +++ b/eeschema/plot_schematic_DXF.cpp @@ -84,9 +84,9 @@ void DIALOG_PLOT_SCHEMATIC::CreateDXFFile( bool aPlotAll, bool aPlotFrameRef ) wxString msg; if( PlotOneSheetDXF( plotFileName, screen, plot_offset, 1.0, aPlotFrameRef ) ) - msg.Printf( _( "Plot: %s OK\n" ), GetChars( plotFileName ) ); + msg.Printf( _( "Plot: <%s> OK\n" ), GetChars( plotFileName ) ); else // Error - msg.Printf( _( "** Unable to create %s **\n" ), GetChars( plotFileName ) ); + msg.Printf( _( "Unable to create <%s>\n" ), GetChars( plotFileName ) ); m_MessagesBox->AppendText( msg ); diff --git a/eeschema/plot_schematic_HPGL.cpp b/eeschema/plot_schematic_HPGL.cpp index f11c94e8fd..a64b95a29f 100644 --- a/eeschema/plot_schematic_HPGL.cpp +++ b/eeschema/plot_schematic_HPGL.cpp @@ -182,9 +182,9 @@ void DIALOG_PLOT_SCHEMATIC::createHPGLFile( bool aPlotAll, bool aPlotFrameRef ) wxString msg; if( Plot_1_Page_HPGL( plotFileName, screen, plotPage, plotOffset, plot_scale, aPlotFrameRef ) ) - msg.Printf( _( "Plot: %s OK\n" ), GetChars( plotFileName ) ); + msg.Printf( _( "Plot: <%s> OK\n" ), GetChars( plotFileName ) ); else // Error - msg.Printf( _( "** Unable to create %s **\n" ), GetChars( plotFileName ) ); + msg.Printf( _( "Unable to create <%s>\n" ), GetChars( plotFileName ) ); m_MessagesBox->AppendText( msg ); diff --git a/eeschema/plot_schematic_PDF.cpp b/eeschema/plot_schematic_PDF.cpp index 2c299d8c8e..ba2176b77a 100644 --- a/eeschema/plot_schematic_PDF.cpp +++ b/eeschema/plot_schematic_PDF.cpp @@ -90,7 +90,7 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef ) if( ! plotter->OpenFile( plotFileName ) ) { - msg.Printf( _( "** Unable to create %s **\n" ), GetChars( plotFileName ) ); + msg.Printf( _( "Unable to create <%s>\n" ), GetChars( plotFileName ) ); m_MessagesBox->AppendText( msg ); delete plotter; return; @@ -124,7 +124,7 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef ) m_parent->GetCurrentSheet().UpdateAllScreenReferences(); m_parent->SetSheetNumberAndCount(); - msg.Printf( _( "Plot: %s OK\n" ), GetChars( plotFileName ) ); + msg.Printf( _( "Plot: <%s> OK\n" ), GetChars( plotFileName ) ); m_MessagesBox->AppendText( msg ); } diff --git a/eeschema/plot_schematic_PS.cpp b/eeschema/plot_schematic_PS.cpp index 7d992cfcca..66d32ac79b 100644 --- a/eeschema/plot_schematic_PS.cpp +++ b/eeschema/plot_schematic_PS.cpp @@ -108,9 +108,9 @@ void DIALOG_PLOT_SCHEMATIC::createPSFile( bool aPlotAll, bool aPlotFrameRef ) if( plotOneSheetPS( plotFileName, screen, plotPage, plot_offset, scale, aPlotFrameRef ) ) - msg.Printf( _( "Plot: %s OK\n" ), GetChars( plotFileName ) ); + msg.Printf( _( "Plot: <%s> OK\n" ), GetChars( plotFileName ) ); else // Error - msg.Printf( _( "** Unable to create %s **\n" ), GetChars( plotFileName ) ); + msg.Printf( _( "Unable to create <%s>\n" ), GetChars( plotFileName ) ); m_MessagesBox->AppendText( msg ); diff --git a/eeschema/plot_schematic_SVG.cpp b/eeschema/plot_schematic_SVG.cpp index 86d6bb4aba..de1ffb0466 100644 --- a/eeschema/plot_schematic_SVG.cpp +++ b/eeschema/plot_schematic_SVG.cpp @@ -77,12 +77,18 @@ void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef ) bool success = plotOneSheetSVG( m_parent, fn.GetFullPath(), screen, getModeColor() ? false : true, aPrintFrameRef ); - msg = _( "Create file " ) + fn.GetFullPath(); if( !success ) - msg += _( " error" ); + { + msg.Printf( _( "Error creating file <%s>\n" ), + GetChars( fn.GetFullPath() ) ); + } + else + { + msg.Printf( _( "File <%s> OK\n" ), + GetChars( fn.GetFullPath() ) ); + } - msg += wxT( "\n" ); m_MessagesBox->AppendText( msg ); } @@ -102,10 +108,10 @@ void DIALOG_PLOT_SCHEMATIC::createSVGFile( bool aPrintAll, bool aPrintFrameRef ) getModeColor() ? false : true, aPrintFrameRef ); if( success ) - msg.Printf( _( "Plot: %s OK\n" ), + msg.Printf( _( "Plot: <%s> OK\n" ), GetChars( fn.GetFullPath() ) ); else // Error - msg.Printf( _( "** Unable to create %s **\n" ), + msg.Printf( _( "Unable to create <%s>\n" ), GetChars( fn.GetFullPath() ) ); m_MessagesBox->AppendText( msg ); diff --git a/eeschema/sheet.cpp b/eeschema/sheet.cpp index 836a3e83e5..896d2d1d52 100644 --- a/eeschema/sheet.cpp +++ b/eeschema/sheet.cpp @@ -107,13 +107,18 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) { if( ( useScreen != NULL ) || loadFromFile ) // Load from existing file. { - msg.Printf( _( "A file named \"%s\" already exists" ), - GetChars( newFullFilename ) ); - if( useScreen != NULL ) - msg += _( " in the current schematic hierarchy" ); + { + msg.Printf( _( "A file named <%s> already exists in the current schematic hierarchy." ), + GetChars( newFullFilename ) ); + } + else + { + msg.Printf( _( "A file named <%s> already exists." ), + GetChars( newFullFilename ) ); + } - msg += _(".\n\nDo you want to create a sheet with the contents of this file?" ); + msg += _("\n\nDo you want to create a sheet with the contents of this file?" ); if( !IsOK( this, msg ) ) return false; @@ -141,14 +146,20 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) if( ( useScreen != NULL ) || loadFromFile ) // Load from existing file. { - tmp.Printf( _( "A file named \"%s\" already exists" ), - GetChars( newFullFilename ) ); - msg += tmp; - + wxString tmp; if( useScreen != NULL ) - msg += _( " in the current schematic hierarchy" ); + { + tmp.Printf( _( "A file named <%s> already exists in the current schematic hierarchy." ), + GetChars( newFullFilename ) ); + } + else + { + tmp.Printf( _( "A file named <%s> already exists." ), + GetChars( newFullFilename ) ); + } - msg += _(".\n\nDo you want to replace the sheet with the contents of this file?" ); + msg += tmp; + msg += _("\n\nDo you want to replace the sheet with the contents of this file?" ); if( !IsOK( this, msg ) ) return false; diff --git a/eeschema/symbedit.cpp b/eeschema/symbedit.cpp index cf24aae25a..0e22eff8ff 100644 --- a/eeschema/symbedit.cpp +++ b/eeschema/symbedit.cpp @@ -154,7 +154,7 @@ void LIB_EDIT_FRAME::SaveOneSymbol() wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() ); - msg.Printf( _( "Saving symbol in [%s]" ), GetChars( fn.GetPath() ) ); + msg.Printf( _( "Saving symbol in <%s>" ), GetChars( fn.GetPath() ) ); SetStatusText( msg ); wxString line; diff --git a/gerbview/dcode.cpp b/gerbview/dcode.cpp index 7cc851c5b1..5dbb5a7e8a 100644 --- a/gerbview/dcode.cpp +++ b/gerbview/dcode.cpp @@ -185,7 +185,7 @@ int GERBVIEW_FRAME::ReadDCodeDefinitionFile( const wxString& D_Code_FullFileName dest = wxFopen( D_Code_FullFileName, wxT( "rt" ) ); if( dest == 0 ) { - msg = _( "File " ) + D_Code_FullFileName + _( " not found" ); + msg.Printf( _( "File <%s> not found" ), GetChars( D_Code_FullFileName ) ); DisplayError( this, msg, 10 ); return -1; } diff --git a/gerbview/export_to_pcbnew.cpp b/gerbview/export_to_pcbnew.cpp index e2635cd59b..a1ada2d65f 100644 --- a/gerbview/export_to_pcbnew.cpp +++ b/gerbview/export_to_pcbnew.cpp @@ -160,7 +160,7 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event ) if( wxFileExists( fileName ) ) { - if( !IsOK( this, _( "Ok to change the existing file ?" ) ) ) + if( !IsOK( this, _( "OK to change the existing file ?" ) ) ) return; } diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index b5d1dff3ed..02b0d01125 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -478,7 +478,7 @@ void GERBVIEW_FRAME::UpdateTitleAndInfo() gerber->DisplayImageInfo(); // Display Image Name and Layer Name (from the current gerber data): - text.Printf( _( "Image name: \"%s\" Layer name: \"%s\"" ), + text.Printf( _( "Image name: '%s' Layer name: '%s'" ), GetChars( gerber->m_ImageName ), GetChars( gerber->GetLayerParams().m_LayerName ) ); SetStatusText( text, 0 ); diff --git a/gerbview/readgerb.cpp b/gerbview/readgerb.cpp index 0fffdc9328..74a9cb9ea3 100644 --- a/gerbview/readgerb.cpp +++ b/gerbview/readgerb.cpp @@ -44,7 +44,7 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName, gerber->m_Current_File = wxFopen( GERBER_FullFileName, wxT( "rt" ) ); if( gerber->m_Current_File == 0 ) { - msg = _( "File " ) + GERBER_FullFileName + _( " not found" ); + msg.Printf( _( "File <%s> not found" ), GetChars( GERBER_FullFileName ) ); DisplayError( this, msg, 10 ); return false; } diff --git a/kicad/class_treeproject_item.cpp b/kicad/class_treeproject_item.cpp index 1c2102f21f..33a7fb8823 100644 --- a/kicad/class_treeproject_item.cpp +++ b/kicad/class_treeproject_item.cpp @@ -151,7 +151,7 @@ bool TREEPROJECT_ITEM::Delete( bool check ) { wxString msg; - msg.Printf( _( "Do you really want to delete '%s'" ), GetChars( GetFileName() ) ); + msg.Printf( _( "Do you really want to delete <%s>" ), GetChars( GetFileName() ) ); wxMessageDialog dialog( m_parent, msg, _( "Delete File" ), wxYES_NO | wxICON_QUESTION ); diff --git a/kicad/files-io.cpp b/kicad/files-io.cpp index c88c7d5078..911dee57ed 100644 --- a/kicad/files-io.cpp +++ b/kicad/files-io.cpp @@ -71,7 +71,9 @@ void KICAD_MANAGER_FRAME::OnUnarchiveFiles( wxCommandEvent& event ) if( dlg.ShowModal() == wxID_CANCEL ) return; - PrintMsg( _( "\nOpen " ) + dlg.GetPath() + wxT( "\n" ) ); + wxString msg; + msg.Printf( _("\nOpen <%s>\n" ), GetChars( dlg.GetPath() ) ); + PrintMsg( msg ); wxDirDialog dirDlg( this, _( "Target Directory" ), fn.GetPath(), wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST ); @@ -80,7 +82,8 @@ void KICAD_MANAGER_FRAME::OnUnarchiveFiles( wxCommandEvent& event ) return; wxSetWorkingDirectory( dirDlg.GetPath() ); - PrintMsg( _( "Unzipping project in " ) + dirDlg.GetPath() + wxT( "\n" ) ); + msg.Printf( _( "Unzipping project in <%s>\n" ), GetChars( dirDlg.GetPath() ) ); + PrintMsg( msg ); wxFileSystem zipfilesys; zipfilesys.AddHandler( new wxZipFSHandler ); @@ -100,7 +103,8 @@ void KICAD_MANAGER_FRAME::OnUnarchiveFiles( wxCommandEvent& event ) wxString unzipfilename = localfilename.AfterLast( ':' ); - PrintMsg( _( "Extract file " ) + unzipfilename ); + msg.Printf( _( "Extract file <%s>" ), GetChars( unzipfilename ) ); + PrintMsg( msg ); wxInputStream* stream = zipfile->GetStream(); @@ -176,7 +180,8 @@ void KICAD_MANAGER_FRAME::OnArchiveFiles( wxCommandEvent& event ) while( cont ) { wxFileSystem fsfile; - PrintMsg( _( "Archive file " ) + currFilename ); + msg.Printf(_( "Archive file <%s>" ), GetChars( currFilename ) ); + PrintMsg( msg ); // Read input file and put it in zip file: wxFSFile * infile = fsfile.OpenFile(currFilename); if( infile ) diff --git a/kicad/prjconfig.cpp b/kicad/prjconfig.cpp index 12d2b991ba..58ab903e17 100644 --- a/kicad/prjconfig.cpp +++ b/kicad/prjconfig.cpp @@ -235,8 +235,11 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event ) if( !m_ProjectFileName.FileExists() && !filename.IsSameAs( nameless_prj ) ) { - DisplayError( this, _( "KiCad project file <" ) + - m_ProjectFileName.GetFullPath() + _( "> not found" ) ); + wxString msg; + msg.Printf( _( "KiCad project file <%s> not found" ), + GetChars( m_ProjectFileName.GetFullPath() ) ); + + DisplayError( this, msg ); return; } @@ -260,10 +263,11 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event ) wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_INIT_WATCHED_PATHS ); wxPostEvent( this, cmd); #endif - - PrintMsg( _( "Working dir: " ) + m_ProjectFileName.GetPath() + - _( "\nProject: " ) + m_ProjectFileName.GetFullName() + - wxT( "\n" ) ); + wxString msg; + msg.Format( _( "Working dir: <%s>\nProject: <%s>\n" ), + GetChars( m_ProjectFileName.GetPath() ), + GetChars( m_ProjectFileName.GetFullName() ) ); + PrintMsg( msg ); } diff --git a/kicad/tree_project_frame.cpp b/kicad/tree_project_frame.cpp index b442b1a918..ae58782f93 100644 --- a/kicad/tree_project_frame.cpp +++ b/kicad/tree_project_frame.cpp @@ -739,7 +739,8 @@ void TREE_PROJECT_FRAME::OnRenameFile( wxCommandEvent& ) return; wxString buffer = m_TreeProject->GetItemText( curr_item ); - wxString msg = _( "Change filename: " ) + tree_data->m_FileName; + wxString msg; + msg.Printf( _( "Change filename: <%s>" ), GetChars( tree_data->m_FileName ) ); wxTextEntryDialog dlg( this, msg, _( "Change filename" ), buffer ); diff --git a/pcbnew/autorouter/autoplac.cpp b/pcbnew/autorouter/autoplac.cpp index ce7d5bb9d8..7a32b43473 100644 --- a/pcbnew/autorouter/autoplac.cpp +++ b/pcbnew/autorouter/autoplac.cpp @@ -648,7 +648,7 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC ) if( m_canvas->GetAbortRequest() ) { - if( IsOK( this, _( "Ok to abort?" ) ) ) + if( IsOK( this, _( "OK to abort?" ) ) ) return ESC; else m_canvas->SetAbortRequest( false ); diff --git a/pcbnew/autorouter/solve.cpp b/pcbnew/autorouter/solve.cpp index 768825a765..c3c174d352 100644 --- a/pcbnew/autorouter/solve.cpp +++ b/pcbnew/autorouter/solve.cpp @@ -362,7 +362,7 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int aLayersCount ) } msg.Printf( wxT( "%d" ), nbsucces ); - AppendMsgPanel( wxT( "Ok" ), msg, GREEN ); + AppendMsgPanel( wxT( "OK" ), msg, GREEN ); msg.Printf( wxT( "%d" ), nbunsucces ); AppendMsgPanel( wxT( "Fail" ), msg, RED ); msg.Printf( wxT( " %d" ), GetBoard()->GetUnconnectedNetCount() ); diff --git a/pcbnew/build_BOM_from_board.cpp b/pcbnew/build_BOM_from_board.cpp index b57468a080..66bbd9718d 100644 --- a/pcbnew/build_BOM_from_board.cpp +++ b/pcbnew/build_BOM_from_board.cpp @@ -80,7 +80,7 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent ) if( FichBom == NULL ) { - msg = _( "Unable to create file " ) + fn.GetFullPath(); + msg.Printf( _( "Unable to create file <%s>" ), GetChars( fn.GetFullPath() ) ); DisplayError( this, msg ); return; } diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp index c28d719df8..7d9e4aad33 100644 --- a/pcbnew/class_dimension.cpp +++ b/pcbnew/class_dimension.cpp @@ -489,9 +489,8 @@ EDA_RECT DIMENSION::GetBoundingBox() const wxString DIMENSION::GetSelectMenuText() const { wxString text; - - text << _( "Dimension" ) << wxT( " \"" ) << GetText() << wxT( "\" on " ) - << GetLayerName(); + text.Printf( _( "Dimension \"%s\" on %s" ), + GetChars( GetText() ), GetChars( GetLayerName() ) ); return text; } diff --git a/pcbnew/class_edge_mod.cpp b/pcbnew/class_edge_mod.cpp index 3cb827fa47..e0ed4790fc 100644 --- a/pcbnew/class_edge_mod.cpp +++ b/pcbnew/class_edge_mod.cpp @@ -263,10 +263,10 @@ void EDGE_MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) wxString EDGE_MODULE::GetSelectMenuText() const { wxString text; - - text << _( "Graphic" ) << wxT( " " ) << ShowShape( (STROKE_T) m_Shape ); - text << wxT( " on " ) << GetLayerName(); - text << _( " of " ) << ( (MODULE*) GetParent() )->GetReference(); + text.Printf( _( "Graphic (%s) on %s of %s" ), + GetChars( ShowShape( (STROKE_T) m_Shape ) ), + GetChars( GetLayerName() ), + GetChars( ((MODULE*) GetParent())->GetReference() ) ); return text; } diff --git a/pcbnew/class_marker_pcb.cpp b/pcbnew/class_marker_pcb.cpp index 88b361fbba..4e947e07cd 100644 --- a/pcbnew/class_marker_pcb.cpp +++ b/pcbnew/class_marker_pcb.cpp @@ -99,8 +99,9 @@ void MARKER_PCB::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) wxString errorTxt; - errorTxt << _( "ErrType" ) << wxT( "(" ) << rpt.GetErrorCode() << wxT( ")- " ) - << rpt.GetErrorText() << wxT( ":" ); + errorTxt.Printf( _( "ErrType (%d)- %s:" ), + rpt.GetErrorCode(), + GetChars( rpt.GetErrorText() ) ); aList.push_back( MSG_PANEL_ITEM( errorTxt, wxEmptyString, RED ) ); @@ -131,8 +132,7 @@ void MARKER_PCB::Flip(const wxPoint& aCentre ) wxString MARKER_PCB::GetSelectMenuText() const { wxString text; - - text << _( "Marker" ) << wxT( " @(" ) << GetPos().x << wxT( "," ) << GetPos().y << wxT( ")" ); + text.Printf( _( "Marker @(%d,%d)" ), GetPos().x, GetPos().y ); return text; } diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp index b6317bb3d5..b000a609ca 100644 --- a/pcbnew/class_module.cpp +++ b/pcbnew/class_module.cpp @@ -512,8 +512,9 @@ void MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) aList.push_back( MSG_PANEL_ITEM( _( "3D-Shape" ), msg, RED ) ); - wxString doc = _( "Doc: " ) + m_Doc; - wxString keyword = _( "KeyW: " ) + m_KeyWord; + wxString doc, keyword; + doc.Printf( _( "Doc: %s" ), GetChars( m_Doc ) ); + keyword.Printf( _( "KeyW: %s" ), GetChars( m_KeyWord ) ); aList.push_back( MSG_PANEL_ITEM( doc, keyword, BLACK ) ); } @@ -673,9 +674,9 @@ SEARCH_RESULT MODULE::Visit( INSPECTOR* inspector, const void* testData, wxString MODULE::GetSelectMenuText() const { wxString text; - - text << _( "Footprint" ) << wxT( " " ) << GetReference(); - text << wxT( " on " ) << GetLayerName(); + text.Printf( _( "Footprint %s on %s" ), + GetChars ( GetReference() ), + GetChars ( GetLayerName() ) ); return text; } diff --git a/pcbnew/class_pcb_text.cpp b/pcbnew/class_pcb_text.cpp index 5912c3d0fa..c5fc88bb37 100644 --- a/pcbnew/class_pcb_text.cpp +++ b/pcbnew/class_pcb_text.cpp @@ -174,7 +174,7 @@ wxString TEXTE_PCB::GetSelectMenuText() const else shorttxt += m_Text.Left( 10 ) + wxT( "..." ); - text.Printf( _( "Pcb Text %s on %s"), + text.Printf( _( "Pcb Text \"%s\" on %s"), GetChars ( shorttxt ), GetChars( GetLayerName() ) ); return text; diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index 0d6c32fa48..acc817b4c6 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -406,18 +406,18 @@ wxString TEXTE_MODULE::GetSelectMenuText() const switch( m_Type ) { case TEXT_is_REFERENCE: - text << _( "Reference" ) << wxT( " " ) << m_Text; + text.Printf( _( "Reference %s" ), GetChars( m_Text ) ); break; case TEXT_is_VALUE: - text << _( "Value" ) << wxT( " " ) << m_Text << _( " of " ) - << ( (MODULE*) GetParent() )->GetReference(); + text.Printf( _( "Value %s of %s" ), GetChars( m_Text ), + GetChars( ( (MODULE*) GetParent() )->GetReference() ) ); break; default: // wrap this one in quotes: - text << _( "Text" ) << wxT( " \"" ) << m_Text << wxT( "\"" ) << _( " of " ) - << ( (MODULE*) GetParent() )->GetReference() << _( " on " ) - << GetLayerName(); + text.Printf( _( "Text \"%s\" on %s of %s" ), GetChars( m_Text ), + GetChars( GetLayerName() ), + GetChars( ( (MODULE*) GetParent() )->GetReference() ) ); break; } diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index 933f9ebed8..024ad5aaf7 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -158,7 +158,7 @@ EDA_ITEM* SEGZONE::Clone() const wxString SEGZONE::GetSelectMenuText() const { - wxString text; + wxString text, nettxt; NETINFO_ITEM* net; BOARD* board = GetBoard(); @@ -169,15 +169,16 @@ wxString SEGZONE::GetSelectMenuText() const net = board->FindNet( GetNet() ); if( net ) - text << wxT( " [" ) << net->GetNetname() << wxT( "]" ); + nettxt = net->GetNetname(); } else { wxFAIL_MSG( wxT( "SEGZONE::GetSelectMenuText: BOARD is NULL" ) ); - text << wxT( "???" ); + nettxt = wxT( "???" ); } - text << _( " on " ) << GetLayerName(); + text.Printf( _( "Zone (%08lX) [%s] on %s" ), + m_TimeStamp, GetChars( nettxt ), GetChars( GetLayerName() ) ); return text; } @@ -198,7 +199,6 @@ EDA_ITEM* SEGVIA::Clone() const wxString SEGVIA::GetSelectMenuText() const { - // Note: we use here Printf to make message translatable. wxString text; wxString format; NETINFO_ITEM* net; @@ -234,7 +234,6 @@ wxString SEGVIA::GetSelectMenuText() const else { wxFAIL_MSG( wxT( "SEGVIA::GetSelectMenuText: BOARD is NULL" ) ); - text << wxT( "???" ); text.Printf( format.GetData(), GetChars( ShowWidth() ), wxT( "???" ), 0, wxT( "??" ), wxT( "??" ) ); diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index 3fcf9c31e7..a561e974a3 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -924,8 +924,6 @@ wxString ZONE_CONTAINER::GetSelectMenuText() const NETINFO_ITEM* net; BOARD* board = GetBoard(); - text = _( "Zone Outline" ); - int ncont = m_Poly->GetContour( m_CornerSelection ); if( ncont ) @@ -934,8 +932,7 @@ wxString ZONE_CONTAINER::GetSelectMenuText() const if( GetIsKeepout() ) text << wxT( " " ) << _( "(Keepout)" ); - text << wxT( " " ); - text << wxString::Format( wxT( "(%08lX)" ), m_TimeStamp ); + text << wxString::Format( wxT( " (%08lX)" ), m_TimeStamp ); // Display net name for copper zones if( !GetIsKeepout() ) @@ -964,7 +961,8 @@ wxString ZONE_CONTAINER::GetSelectMenuText() const } } - text << _( " on " ) << GetLayerName(); + text.Printf( _( "Zone Outline %s on %s" ), GetChars( text ), + GetChars( GetLayerName() ) ); return text; } diff --git a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp index c5a14ca726..ae71a34709 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp @@ -267,9 +267,9 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties() m_ValueCtrl->SetValue( m_ValueCopy->GetText() ); m_AttributsCtrl->SetItemToolTip( 0, - _( "Use this attribute for most non smd components" ) ); + _( "Use this attribute for most non SMD components" ) ); m_AttributsCtrl->SetItemToolTip( 1, - _( "Use this attribute for smd components.\nOnly components with this option are put in the footprint position list file" ) ); + _( "Use this attribute for SMD components.\nOnly components with this option are put in the footprint position list file" ) ); m_AttributsCtrl->SetItemToolTip( 2, _( "Use this attribute for \"virtual\" components drawn on board (like a old ISA PC bus connector)" ) ); diff --git a/pcbnew/dialogs/dialog_global_deletion.cpp b/pcbnew/dialogs/dialog_global_deletion.cpp index 0481490122..cce6a7b4b5 100644 --- a/pcbnew/dialogs/dialog_global_deletion.cpp +++ b/pcbnew/dialogs/dialog_global_deletion.cpp @@ -68,7 +68,7 @@ void DIALOG_GLOBAL_DELETION::AcceptPcbDelete( ) } else { - if( !IsOK( this, _( "Ok to delete selected items ?" ) ) ) + if( !IsOK( this, _( "OK to delete selected items ?" ) ) ) return; BOARD * pcb = m_Parent->GetBoard(); diff --git a/pcbnew/dialogs/dialog_orient_footprints.cpp b/pcbnew/dialogs/dialog_orient_footprints.cpp index e14fd86ef0..01cae40e27 100644 --- a/pcbnew/dialogs/dialog_orient_footprints.cpp +++ b/pcbnew/dialogs/dialog_orient_footprints.cpp @@ -127,7 +127,7 @@ bool PCB_EDIT_FRAME::ReOrientModules( const wxString& ModuleMask, wxString line; bool modified = false; - line.Printf( _( "Ok to set footprints orientation to %.1f degrees ?" ), (double)Orient / 10 ); + line.Printf( _( "OK to set footprints orientation to %.1f degrees ?" ), (double)Orient / 10 ); if( !IsOK( this, line ) ) return false; diff --git a/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths.cpp b/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths.cpp index 7813c5c58e..9d467f5e15 100644 --- a/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths.cpp +++ b/pcbnew/dialogs/dialog_pcbnew_config_libs_and_paths.cpp @@ -60,7 +60,8 @@ DIALOG_PCBNEW_CONFIG_LIBS::DIALOG_PCBNEW_CONFIG_LIBS( PCB_EDIT_FRAME* parent ): Init( ); - wxString title = _( "from " ) + wxGetApp().GetCurrentOptionFile(); + wxString title; + title.Printf( _( "from <%s>" ), GetChars( wxGetApp().GetCurrentOptionFile() ) ); SetTitle( title ); m_sdbSizer1OK->SetDefault(); diff --git a/pcbnew/editedge.cpp b/pcbnew/editedge.cpp index 9488ef438c..2bdebcd6f4 100644 --- a/pcbnew/editedge.cpp +++ b/pcbnew/editedge.cpp @@ -152,7 +152,9 @@ void PCB_EDIT_FRAME::Delete_Drawings_All_Layer( LAYER_NUM aLayer ) return; } - wxString msg = _( "Delete everything on layer " ) + GetBoard()->GetLayerName( aLayer ); + wxString msg; + msg.Printf( _( "Delete everything on layer %s?" ), + GetChars( GetBoard()->GetLayerName( aLayer ) ) ); if( !IsOK( this, msg ) ) return; diff --git a/pcbnew/export_gencad.cpp b/pcbnew/export_gencad.cpp index 4d19b63a34..5273d037fa 100644 --- a/pcbnew/export_gencad.cpp +++ b/pcbnew/export_gencad.cpp @@ -136,7 +136,7 @@ void PCB_EDIT_FRAME::ExportToGenCAD( wxCommandEvent& aEvent ) if( ( file = wxFopen( dlg.GetPath(), wxT( "wt" ) ) ) == NULL ) { - msg = _( "Unable to create " ) + dlg.GetPath(); + msg.Printf( _( "Unable to create <%s>" ), GetChars( dlg.GetPath() ) ); DisplayError( this, msg ); return; } diff --git a/pcbnew/gen_modules_placefile.cpp b/pcbnew/gen_modules_placefile.cpp index d000e68869..9264755326 100644 --- a/pcbnew/gen_modules_placefile.cpp +++ b/pcbnew/gen_modules_placefile.cpp @@ -235,9 +235,9 @@ bool DIALOG_GEN_MODULE_POSITION::CreateFiles() } if( singleFile ) - msg.Printf( _( "Place file: %s\n" ), GetChars( fn.GetFullPath() ) ); + msg.Printf( _( "Place file: <%s>\n" ), GetChars( fn.GetFullPath() ) ); else - msg.Printf( _( "Component side place file: %s\n" ), GetChars( fn.GetFullPath() ) ); + msg.Printf( _( "Component side place file: <%s>\n" ), GetChars( fn.GetFullPath() ) ); AddMessage( msg ); msg.Printf( _( "Footprint count %d\n" ), fpcount ); @@ -268,7 +268,7 @@ bool DIALOG_GEN_MODULE_POSITION::CreateFiles() // Display results if( !singleFile ) { - msg.Printf( _( "Copper side place file: %s\n" ), GetChars( fn.GetFullPath() ) ); + msg.Printf( _( "Copper side place file: <%s>\n" ), GetChars( fn.GetFullPath() ) ); AddMessage( msg ); msg.Printf( _( "Footprint count %d\n" ), fpcount ); AddMessage( msg ); @@ -531,7 +531,7 @@ void PCB_EDIT_FRAME::GenFootprintsReport( wxCommandEvent& event ) wxString msg; if( success ) { - msg.Printf( _( "Module report file created:\n%s" ), + msg.Printf( _( "Module report file created:\n<%s>" ), GetChars( fn.GetFullPath() ) ); wxMessageBox( msg, _( "Module Report" ), wxICON_INFORMATION ); } diff --git a/pcbnew/gpcb_plugin.cpp b/pcbnew/gpcb_plugin.cpp index 76dcfed4f1..230bae94d1 100644 --- a/pcbnew/gpcb_plugin.cpp +++ b/pcbnew/gpcb_plugin.cpp @@ -232,7 +232,7 @@ void GPCB_FPL_CACHE::Load() if( !dir.IsOpened() ) { - THROW_IO_ERROR( wxString::Format( _( "footprint library path '%s' does not exist" ), + THROW_IO_ERROR( wxString::Format( _( "footprint library path <%s> does not exist" ), m_lib_path.GetPath().GetData() ) ); } @@ -278,7 +278,7 @@ void GPCB_FPL_CACHE::Remove( const wxString& aFootprintName ) if( it == m_modules.end() ) { - THROW_IO_ERROR( wxString::Format( _( "library '%s' has no footprint '%s' to delete" ), + THROW_IO_ERROR( wxString::Format( _( "library <%s> has no footprint %s to delete" ), m_lib_path.GetPath().GetData(), aFootprintName.GetData() ) ); } @@ -878,7 +878,7 @@ void GPCB_PLUGIN::FootprintDelete( const wxString& aLibraryPath, const wxString& if( !m_cache->IsWritable() ) { - THROW_IO_ERROR( wxString::Format( _( "Library '%s' is read only" ), + THROW_IO_ERROR( wxString::Format( _( "Library <%s> is read only" ), aLibraryPath.GetData() ) ); } @@ -897,7 +897,7 @@ bool GPCB_PLUGIN::FootprintLibDelete( const wxString& aLibraryPath, PROPERTIES* if( !fn.IsDirWritable() ) { - THROW_IO_ERROR( wxString::Format( _( "user does not have permission to delete directory '%s'" ), + THROW_IO_ERROR( wxString::Format( _( "user does not have permission to delete directory <%s>" ), aLibraryPath.GetData() ) ); } @@ -905,7 +905,7 @@ bool GPCB_PLUGIN::FootprintLibDelete( const wxString& aLibraryPath, PROPERTIES* if( dir.HasSubDirs() ) { - THROW_IO_ERROR( wxString::Format( _( "library directory '%s' has unexpected sub-directories" ), + THROW_IO_ERROR( wxString::Format( _( "library directory <%s> has unexpected sub-directories" ), aLibraryPath.GetData() ) ); } @@ -924,7 +924,7 @@ bool GPCB_PLUGIN::FootprintLibDelete( const wxString& aLibraryPath, PROPERTIES* if( tmp.GetExt() != KiCadFootprintFileExtension ) { - THROW_IO_ERROR( wxString::Format( _( "unexpected file '%s' was found in library path '%s'" ), + THROW_IO_ERROR( wxString::Format( _( "unexpected file <%s> was found in library path '%s'" ), files[i].GetData(), aLibraryPath.GetData() ) ); } } @@ -942,7 +942,7 @@ bool GPCB_PLUGIN::FootprintLibDelete( const wxString& aLibraryPath, PROPERTIES* // we don't want that. we want bare metal portability with no UI here. if( !wxRmdir( aLibraryPath ) ) { - THROW_IO_ERROR( wxString::Format( _( "footprint library '%s' cannot be deleted" ), + THROW_IO_ERROR( wxString::Format( _( "footprint library <%s> cannot be deleted" ), aLibraryPath.GetData() ) ); } diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index 0b441d4334..7c145c96ad 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -158,13 +158,13 @@ void FP_CACHE::Save() { if( !m_lib_path.DirExists() && !m_lib_path.Mkdir() ) { - THROW_IO_ERROR( wxString::Format( _( "Cannot create footprint library path '%s'." ), + THROW_IO_ERROR( wxString::Format( _( "Cannot create footprint library path <%s>" ), m_lib_path.GetPath().GetData() ) ); } if( !m_lib_path.IsDirWritable() ) { - THROW_IO_ERROR( wxString::Format( _( "Footprint library path '%s' is read only" ), + THROW_IO_ERROR( wxString::Format( _( "Footprint library path <%s> is read only" ), GetChars( m_lib_path.GetPath() ) ) ); } @@ -193,7 +193,7 @@ void FP_CACHE::Save() if( wxRename( tempFileName, fn.GetFullPath() ) ) { - THROW_IO_ERROR( wxString::Format( _( "cannot rename temporary file '%s' to footprint library file '%s'" ), + THROW_IO_ERROR( wxString::Format( _( "Cannot rename temporary file <%s> to footprint library file <%s>" ), tempFileName.GetData(), fn.GetFullPath().GetData() ) ); } @@ -210,7 +210,7 @@ void FP_CACHE::Load() if( !dir.IsOpened() ) { - THROW_IO_ERROR( wxString::Format( _( "footprint library path '%s' does not exist" ), + THROW_IO_ERROR( wxString::Format( _( "Footprint library path <%s> does not exist" ), m_lib_path.GetPath().GetData() ) ); } @@ -249,7 +249,7 @@ void FP_CACHE::Remove( const wxString& aFootprintName ) if( it == m_modules.end() ) { - THROW_IO_ERROR( wxString::Format( _( "library '%s' has no footprint '%s' to delete" ), + THROW_IO_ERROR( wxString::Format( _( "library <%s> has no footprint %s to delete" ), m_lib_path.GetPath().GetData(), aFootprintName.GetData() ) ); } @@ -1632,7 +1632,7 @@ void PCB_IO::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootpri if( !m_cache->IsWritable() ) { - THROW_IO_ERROR( wxString::Format( _( "Library '%s' is read only" ), + THROW_IO_ERROR( wxString::Format( _( "Library <%s> is read only" ), aLibraryPath.GetData() ) ); } @@ -1645,13 +1645,13 @@ void PCB_IO::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootpri if( !fn.IsOk() ) { - THROW_IO_ERROR( wxString::Format( _( "Footprint file name '%s' is not valid." ), + THROW_IO_ERROR( wxString::Format( _( "Footprint file name <%s> is not valid." ), GetChars( fn.GetFullPath() ) ) ); } if( fn.FileExists() && !fn.IsFileWritable() ) { - THROW_IO_ERROR( wxString::Format( _( "user does not have write permission to delete file '%s' " ), + THROW_IO_ERROR( wxString::Format( _( "user does not have write permission to delete file <%s> " ), GetChars( fn.GetFullPath() ) ) ); } @@ -1694,7 +1694,7 @@ void PCB_IO::FootprintDelete( const wxString& aLibraryPath, const wxString& aFoo if( !m_cache->IsWritable() ) { - THROW_IO_ERROR( wxString::Format( _( "Library '%s' is read only" ), + THROW_IO_ERROR( wxString::Format( _( "Library <%s> is read only" ), aLibraryPath.GetData() ) ); } @@ -1706,7 +1706,7 @@ void PCB_IO::FootprintLibCreate( const wxString& aLibraryPath, PROPERTIES* aProp { if( wxDir::Exists( aLibraryPath ) ) { - THROW_IO_ERROR( wxString::Format( _( "cannot overwrite library path '%s'" ), + THROW_IO_ERROR( wxString::Format( _( "cannot overwrite library path <%s>" ), aLibraryPath.GetData() ) ); } @@ -1731,7 +1731,7 @@ bool PCB_IO::FootprintLibDelete( const wxString& aLibraryPath, PROPERTIES* aProp if( !fn.IsDirWritable() ) { - THROW_IO_ERROR( wxString::Format( _( "user does not have permission to delete directory '%s'" ), + THROW_IO_ERROR( wxString::Format( _( "user does not have permission to delete directory <%s>" ), aLibraryPath.GetData() ) ); } @@ -1739,7 +1739,7 @@ bool PCB_IO::FootprintLibDelete( const wxString& aLibraryPath, PROPERTIES* aProp if( dir.HasSubDirs() ) { - THROW_IO_ERROR( wxString::Format( _( "library directory '%s' has unexpected sub-directories" ), + THROW_IO_ERROR( wxString::Format( _( "library directory <%s> has unexpected sub-directories" ), aLibraryPath.GetData() ) ); } @@ -1758,7 +1758,7 @@ bool PCB_IO::FootprintLibDelete( const wxString& aLibraryPath, PROPERTIES* aProp if( tmp.GetExt() != KiCadFootprintFileExtension ) { - THROW_IO_ERROR( wxString::Format( _( "unexpected file '%s' was found in library path '%s'" ), + THROW_IO_ERROR( wxString::Format( _( "unexpected file <%s> was found in library path '%s'" ), files[i].GetData(), aLibraryPath.GetData() ) ); } } @@ -1776,7 +1776,7 @@ bool PCB_IO::FootprintLibDelete( const wxString& aLibraryPath, PROPERTIES* aProp // we don't want that. we want bare metal portability with no UI here. if( !wxRmdir( aLibraryPath ) ) { - THROW_IO_ERROR( wxString::Format( _( "footprint library '%s' cannot be deleted" ), + THROW_IO_ERROR( wxString::Format( _( "footprint library <%s> cannot be deleted" ), aLibraryPath.GetData() ) ); } diff --git a/pcbnew/layer_widget.cpp b/pcbnew/layer_widget.cpp index 3ead91151e..250538af92 100644 --- a/pcbnew/layer_widget.cpp +++ b/pcbnew/layer_widget.cpp @@ -452,7 +452,7 @@ void LAYER_WIDGET::insertRenderRow( int aRow, const ROW& aSpec ) { wxBitmapButton* bmb = makeColorButton( m_RenderScrolledWindow, aSpec.color, encodeId( col, aSpec.id ) ); bmb->Connect( wxEVT_MIDDLE_DOWN, wxMouseEventHandler( LAYER_WIDGET::OnMiddleDownRenderColor ), NULL, this ); - bmb->SetToolTip( _("Middle click for color change" ) ); + bmb->SetToolTip( _( "Middle click for color change" ) ); m_RenderFlexGridSizer->wxSizer::Insert( index+col, bmb, 0, flags ); // could add a left click handler on the color button that toggles checkbox. @@ -530,7 +530,7 @@ LAYER_WIDGET::LAYER_WIDGET( wxWindow* aParent, wxWindow* aFocusOwner, int aPoint m_LayerPanel->SetSizer( bSizer3 ); m_LayerPanel->Layout(); bSizer3->Fit( m_LayerPanel ); - m_notebook->AddPage( m_LayerPanel, _("Layer"), true ); + m_notebook->AddPage( m_LayerPanel, _( "Layer" ), true ); m_RenderingPanel = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizer4; @@ -550,7 +550,7 @@ LAYER_WIDGET::LAYER_WIDGET( wxWindow* aParent, wxWindow* aFocusOwner, int aPoint m_RenderingPanel->SetSizer( bSizer4 ); m_RenderingPanel->Layout(); bSizer4->Fit( m_RenderingPanel ); - m_notebook->AddPage( m_RenderingPanel, _("Render"), false ); + m_notebook->AddPage( m_RenderingPanel, _( "Render" ), false ); boxSizer->Add( m_notebook, 1, wxEXPAND | wxALL, 5 ); diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index def084e9c1..f3dec7cf47 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -90,7 +90,7 @@ typedef LEGACY_PLUGIN::BIU BIU; -#define VERSION_ERROR_FORMAT _( "File '%s' is format version: %d.\nI only support format version <= %d.\nPlease upgrade Pcbnew to load this file." ) +#define VERSION_ERROR_FORMAT _( "File <%s> is format version: %d.\nI only support format version <= %d.\nPlease upgrade Pcbnew to load this file." ) #define UNKNOWN_GRAPHIC_FORMAT _( "unknown graphic type: %d") #define UNKNOWN_PAD_FORMAT _( "unknown pad type: %d") #define UNKNOWN_PAD_ATTRIBUTE _( "unknown pad attribute: %d" ) @@ -2739,7 +2739,7 @@ BIU LEGACY_PLUGIN::biuParse( const char* aValue, const char** nptrptr ) if( errno ) { - m_error.Printf( _( "invalid float number in\nfile: '%s'\nline: %d\noffset: %d" ), + m_error.Printf( _( "invalid float number in\nfile: <%s>\nline: %d\noffset: %d" ), m_reader->GetSource().GetData(), m_reader->LineNumber(), aValue - m_reader->Line() + 1 ); THROW_IO_ERROR( m_error ); @@ -2747,7 +2747,7 @@ BIU LEGACY_PLUGIN::biuParse( const char* aValue, const char** nptrptr ) if( aValue == nptr ) { - m_error.Printf( _( "missing float number in\nfile: '%s'\nline: %d\noffset: %d" ), + m_error.Printf( _( "missing float number in\nfile: <%s>\nline: %d\noffset: %d" ), m_reader->GetSource().GetData(), m_reader->LineNumber(), aValue - m_reader->Line() + 1 ); THROW_IO_ERROR( m_error ); @@ -2774,7 +2774,7 @@ double LEGACY_PLUGIN::degParse( const char* aValue, const char** nptrptr ) if( errno ) { - m_error.Printf( _( "invalid float number in\nfile: '%s'\nline: %d\noffset: %d" ), + m_error.Printf( _( "invalid float number in\nfile: <%s>\nline: %d\noffset: %d" ), m_reader->GetSource().GetData(), m_reader->LineNumber(), aValue - m_reader->Line() + 1 ); THROW_IO_ERROR( m_error ); @@ -2782,7 +2782,7 @@ double LEGACY_PLUGIN::degParse( const char* aValue, const char** nptrptr ) if( aValue == nptr ) { - m_error.Printf( _( "missing float number in\nfile: '%s'\nline: %d\noffset: %d" ), + m_error.Printf( _( "missing float number in\nfile: <%s>\nline: %d\noffset: %d" ), m_reader->GetSource().GetData(), m_reader->LineNumber(), aValue - m_reader->Line() + 1 ); THROW_IO_ERROR( m_error ); @@ -2830,7 +2830,7 @@ void LEGACY_PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, PROPERTIES* FILE* fp = wxFopen( aFileName, wxT( "w" ) ); if( !fp ) { - m_error.Printf( _( "Unable to open file '%s'" ), aFileName.GetData() ); + m_error.Printf( _( "Unable to open file <%s>" ), aFileName.GetData() ); THROW_IO_ERROR( m_error ); } @@ -2867,7 +2867,7 @@ void LEGACY_PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, PROPERTIES* wxString LEGACY_PLUGIN::writeError() const { - return wxString::Format( _( "error writing to file '%s'" ), m_filename.GetData() ); + return wxString::Format( _( "error writing to file <%s>" ), m_filename.GetData() ); } #define CHECK_WRITE_ERROR() \ @@ -3991,7 +3991,7 @@ void FPL_CACHE::ReadAndVerifyHeader( LINE_READER* aReader ) } L_bad_library: - THROW_IO_ERROR( wxString::Format( _( "File '%s' is empty or is not a legacy library" ), + THROW_IO_ERROR( wxString::Format( _( "File <%s> is empty or is not a legacy library" ), m_lib_path.GetData() ) ); } @@ -4104,7 +4104,7 @@ void FPL_CACHE::Save() if( !m_writable ) { THROW_IO_ERROR( wxString::Format( - _( "Legacy library file '%s' is read only" ), m_lib_path.GetData() ) ); + _( "Legacy library file <%s> is read only" ), m_lib_path.GetData() ) ); } wxString tempFileName; @@ -4124,7 +4124,7 @@ void FPL_CACHE::Save() if( !fp ) { THROW_IO_ERROR( wxString::Format( - _( "Unable to open or create legacy library file '%s'" ), + _( "Unable to open or create legacy library file <%s>" ), m_lib_path.GetData() ) ); } @@ -4150,7 +4150,7 @@ void FPL_CACHE::Save() if( wxRename( tempFileName, m_lib_path ) ) { THROW_IO_ERROR( wxString::Format( - _( "Unable to rename tempfile '%s' to library file '%s'" ), + _( "Unable to rename tempfile <%s> to library file <%s>" ), tempFileName.GetData(), m_lib_path.GetData() ) ); } @@ -4266,7 +4266,7 @@ void LEGACY_PLUGIN::FootprintSave( const wxString& aLibraryPath, const MODULE* a if( !m_cache->m_writable ) { - THROW_IO_ERROR( wxString::Format( _( "Library '%s' is read only" ), aLibraryPath.GetData() ) ); + THROW_IO_ERROR( wxString::Format( _( "Library <%s> is read only" ), aLibraryPath.GetData() ) ); } std::string footprintName = TO_UTF8( aFootprint->GetLibRef() ); @@ -4310,7 +4310,7 @@ void LEGACY_PLUGIN::FootprintDelete( const wxString& aLibraryPath, const wxStrin if( !m_cache->m_writable ) { - THROW_IO_ERROR( wxString::Format( _( "Library '%s' is read only" ), aLibraryPath.GetData() ) ); + THROW_IO_ERROR( wxString::Format( _( "Library <%s> is read only" ), aLibraryPath.GetData() ) ); } std::string footprintName = TO_UTF8( aFootprintName ); @@ -4320,7 +4320,7 @@ void LEGACY_PLUGIN::FootprintDelete( const wxString& aLibraryPath, const wxStrin if( erasedCount != 1 ) { THROW_IO_ERROR( wxString::Format( - _( "library '%s' has no footprint '%s' to delete" ), + _( "library <%s> has no footprint %s to delete" ), aLibraryPath.GetData(), aFootprintName.GetData() ) ); } @@ -4333,7 +4333,7 @@ void LEGACY_PLUGIN::FootprintLibCreate( const wxString& aLibraryPath, PROPERTIES if( wxFileExists( aLibraryPath ) ) { THROW_IO_ERROR( wxString::Format( - _( "library '%s' already exists, will not create anew" ), + _( "library <%s> already exists, will not create anew" ), aLibraryPath.GetData() ) ); } @@ -4360,7 +4360,7 @@ bool LEGACY_PLUGIN::FootprintLibDelete( const wxString& aLibraryPath, PROPERTIES if( wxRemove( aLibraryPath ) ) { THROW_IO_ERROR( wxString::Format( - _( "library '%s' cannot be deleted" ), + _( "library <%s> cannot be deleted" ), aLibraryPath.GetData() ) ); } diff --git a/pcbnew/librairi.cpp b/pcbnew/librairi.cpp index b560b1f4ee..81e8efa549 100644 --- a/pcbnew/librairi.cpp +++ b/pcbnew/librairi.cpp @@ -53,27 +53,27 @@ // unique, "file local" translations: -#define FMT_OK_OVERWRITE _( "Library '%s' exists, OK to replace ?" ) +#define FMT_OK_OVERWRITE _( "Library <%s> exists, OK to replace ?" ) #define FMT_CREATE_LIB _( "Create New Library" ) -#define FMT_OK_DELETE _( "Ok to delete module '%s' in library '%s'" ) +#define FMT_OK_DELETE _( "OK to delete module %s in library <%s>" ) #define FMT_IMPORT_MODULE _( "Import Footprint Module" ) -#define FMT_FILE_NOT_FOUND _( "File '%s' not found" ) +#define FMT_FILE_NOT_FOUND _( "File <%s> not found" ) #define FMT_NOT_MODULE _( "Not a module file" ) -#define FMT_MOD_NOT_FOUND _( "Unable to find or load footprint '%s' from lib path '%s'" ) -#define FMT_BAD_PATH _( "Unable to find or load footprint from path '%s'" ) -#define FMT_BAD_PATHS _( "The footprint library '%s' could not be found in any of the search paths." ) -#define FMT_LIB_READ_ONLY _( "Library '%s' is read only, not writable" ) +#define FMT_MOD_NOT_FOUND _( "Unable to find or load footprint %s from lib path <%s>" ) +#define FMT_BAD_PATH _( "Unable to find or load footprint from path <%s>" ) +#define FMT_BAD_PATHS _( "The footprint library <%s> could not be found in any of the search paths." ) +#define FMT_LIB_READ_ONLY _( "Library <%s> is read only, not writable" ) #define FMT_EXPORT_MODULE _( "Export Module" ) #define FMT_SAVE_MODULE _( "Save Module" ) #define FMT_MOD_REF _( "Module Reference:" ) -#define FMT_EXPORTED _( "Module exported to file '%s'" ) -#define FMT_MOD_DELETED _( "Component '%s' deleted from library '%s'" ) +#define FMT_EXPORTED _( "Module exported to file <%s>" ) +#define FMT_MOD_DELETED _( "Module %s deleted from library <%s>" ) #define FMT_MOD_CREATE _( "Module Creation" ) #define FMT_NO_MODULES _( "No modules to archive!" ) #define FMT_LIBRARY _( "Library" ) // window title -#define FMT_MOD_EXISTS _( "Footprint '%s' already exists in library '%s'" ) +#define FMT_MOD_EXISTS _( "Module %s already exists in library <%s>" ) #define FMT_NO_REF_ABORTED _( "No reference, aborted" ) #define FMT_SELECT_LIB _( "Select Active Library:" ) diff --git a/pcbnew/loadcmp.cpp b/pcbnew/loadcmp.cpp index 67689c9f5b..3a8161f8cc 100644 --- a/pcbnew/loadcmp.cpp +++ b/pcbnew/loadcmp.cpp @@ -302,7 +302,7 @@ MODULE* PCB_BASE_FRAME::loadFootprintFromLibrary( const wxString& aLibraryPath, if( aDisplayError ) { wxString msg = wxString::Format( - _( "Footprint '%s' not found in library '%s'" ), + _( "Footprint %s not found in library <%s>" ), aFootprintName.GetData(), libPath.GetData() ); @@ -375,7 +375,7 @@ MODULE* PCB_BASE_FRAME::loadFootprintFromLibraries( if( aDisplayError ) { wxString msg = wxString::Format( - _( "Footprint '%s' not found in any library" ), + _( "Footprint %s not found in any library" ), aFootprintName.GetData() ); DisplayError( NULL, msg ); @@ -574,7 +574,7 @@ void FOOTPRINT_EDIT_FRAME::OnSaveLibraryAs( wxCommandEvent& aEvent ) } wxString msg = wxString::Format( - _( "Footprint library\n'%s' saved as\n'%s'" ), + _( "Footprint library\n<%s> saved as\n<%s>" ), GetChars( curLibPath ), GetChars( dstLibPath ) ); DisplayInfoMessage( this, msg ); diff --git a/pcbnew/netlist.cpp b/pcbnew/netlist.cpp index ec92189f30..590905e98e 100644 --- a/pcbnew/netlist.cpp +++ b/pcbnew/netlist.cpp @@ -78,7 +78,7 @@ static FILE* OpenNetlistFile( const wxString& aFullFileName ) if( file == NULL ) { wxString msg; - msg.Printf( _( "Netlist file %s not found" ), GetChars( aFullFileName ) ); + msg.Printf( _( "Netlist file <%s> not found" ), GetChars( aFullFileName ) ); wxMessageBox( msg ); } @@ -126,12 +126,12 @@ bool PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFullFilename, if( aMessageWindow ) { wxString msg; - msg.Printf( _( "Reading Netlist \"%s\"" ), GetChars( aNetlistFullFilename ) ); + msg.Printf( _( "Reading Netlist <%s>" ), GetChars( aNetlistFullFilename ) ); aMessageWindow->AppendText( msg + wxT( "\n" ) ); if( useCmpfile ) { - msg.Printf( _( "Using component/footprint link file \"%s\"" ), + msg.Printf( _( "Using component/footprint link file <%s>" ), GetChars( aCmpFullFileName ) ); aMessageWindow->AppendText( msg + wxT( "\n" ) ); } @@ -176,7 +176,7 @@ bool PCB_EDIT_FRAME::ReadPcbNetlist( const wxString& aNetlistFullFilename, if( aDeleteExtraFootprints ) { if( IsOK( NULL, - _( "Ok to delete not locked footprints not found in netlist?" ) ) ) + _( "OK to delete not locked footprints not found in netlist?" ) ) ) netList_Reader.RemoveExtraFootprints(); } diff --git a/pcbnew/netlist_reader_common.cpp b/pcbnew/netlist_reader_common.cpp index 24462bd5e7..f0cc2c58bc 100644 --- a/pcbnew/netlist_reader_common.cpp +++ b/pcbnew/netlist_reader_common.cpp @@ -256,7 +256,7 @@ void NETLIST_READER::TestFootprintsMatchingAndExchange() else if( m_messageWindow ) { wxString msg; - msg.Printf( _( "Component \"%s\": module [%s] not found\n" ), + msg.Printf( _( "Component %s: module %s not found\n" ), GetChars( cmp_info->m_Reference ), GetChars( cmp_info->m_Footprint ) ); @@ -266,7 +266,7 @@ void NETLIST_READER::TestFootprintsMatchingAndExchange() else if( m_messageWindow ) { wxString msg; - msg.Printf( _( "Component \"%s\": Mismatch! module is [%s] and netlist said [%s]\n" ), + msg.Printf( _( "Component %s: Mismatch! module is %s and netlist said %s\n" ), GetChars( cmp_info->m_Reference ), GetChars( module->GetLibRef() ), GetChars( cmp_info->m_Footprint ) ); @@ -323,7 +323,7 @@ int NETLIST_READER::SetPadsNetName( const wxString & aModule, const wxString & a if( m_messageWindow ) { wxString msg; - msg.Printf( _( "Module [%s]: Pad [%s] not found" ), + msg.Printf( _( "Module %s: Pad %s not found" ), GetChars( aModule ), GetChars( aPadname ) ); m_messageWindow->AppendText( msg + wxT( "\n" ) ); } @@ -564,7 +564,7 @@ bool NETLIST_READER::loadNewModules() if( m_messageWindow ) { wxString msg; - msg.Printf( _( "Component [%s]: footprint <%s> not found" ), + msg.Printf( _( "Component %s: footprint %s not found" ), GetChars( cmp_info->m_Reference ), GetChars( cmp_info->m_Footprint ) ); diff --git a/pcbnew/netlist_reader_firstformat.cpp b/pcbnew/netlist_reader_firstformat.cpp index fd3da7cfd8..c98b1eb122 100644 --- a/pcbnew/netlist_reader_firstformat.cpp +++ b/pcbnew/netlist_reader_firstformat.cpp @@ -279,7 +279,7 @@ void* NETLIST_READER::ReadOldFmtNetlistModuleDescr( char* aText, bool aBuildList if( m_messageWindow ) { wxString msg; - msg.Printf( _( "Component [%s] not found" ), GetChars( cmpReference ) ); + msg.Printf( _( "Component %s not found" ), GetChars( cmpReference ) ); m_messageWindow->AppendText( msg + wxT( "\n" ) ); } } @@ -334,7 +334,7 @@ bool NETLIST_READER::SetPadNetName( char* aText ) if( m_messageWindow ) { wxString msg; - msg.Printf( _( "Module [%s]: Pad [%s] not found" ), + msg.Printf( _( "Module %s: Pad %s not found" ), GetChars( m_currModule->GetReference() ), GetChars( pinName ) ); m_messageWindow->AppendText( msg + wxT( "\n" ) ); diff --git a/pcbnew/onleftclick.cpp b/pcbnew/onleftclick.cpp index aa9e169ebf..0e42cfd2a5 100644 --- a/pcbnew/onleftclick.cpp +++ b/pcbnew/onleftclick.cpp @@ -245,7 +245,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) if( IsCopperLayer( getActiveLayer() ) ) { - DisplayError( this, _( "Graphic not authorized on Copper layers" ) ); + DisplayError( this, _( "Graphic not allowed on Copper layers" ) ); break; } @@ -368,7 +368,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition ) case ID_PCB_DIMENSION_BUTT: if( IsCopperLayer( getActiveLayer() ) ) { - DisplayError( this, _( "Dimension not authorized on Copper layers" ) ); + DisplayError( this, _( "Dimension not allowed on Copper layers" ) ); break; } diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index 39dda89adb..0383a5e797 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -89,7 +89,7 @@ double PCB_PARSER::parseDouble() throw( IO_ERROR ) if( errno ) { wxString error; - error.Printf( _( "invalid floating point number in\nfile: '%s'\nline: %d\noffset: %d" ), + error.Printf( _( "invalid floating point number in\nfile: <%s>\nline: %d\noffset: %d" ), GetChars( CurSource() ), CurLineNumber(), CurOffset() ); THROW_IO_ERROR( error ); @@ -98,7 +98,7 @@ double PCB_PARSER::parseDouble() throw( IO_ERROR ) if( CurText() == tmp ) { wxString error; - error.Printf( _( "missing floating point number in\nfile: '%s'\nline: %d\noffset: %d" ), + error.Printf( _( "missing floating point number in\nfile: <%s>\nline: %d\noffset: %d" ), GetChars( CurSource() ), CurLineNumber(), CurOffset() ); THROW_IO_ERROR( error ); @@ -754,7 +754,7 @@ T PCB_PARSER::lookUpLayer( const M& aMap ) throw( PARSE_ERROR, IO_ERROR ) #endif wxString error = wxString::Format( - _( "Layer '%s' in file <%s> at line %d, position %d, was not defined in the layers section" ), + _( "Layer %s in file <%s> at line %d, position %d, was not defined in the layers section" ), GetChars( FROM_UTF8( CurText() ) ), GetChars( CurSource() ), CurLineNumber(), CurOffset() ); @@ -1128,7 +1128,7 @@ void PCB_PARSER::parseNETCLASS() throw( IO_ERROR, PARSE_ERROR ) // auto_ptr will delete nc on this code path wxString error; - error.Printf( _( "duplicate NETCLASS name '%s' in file %s at line %d, offset %d" ), + error.Printf( _( "duplicate NETCLASS name '%s' in file <%s> at line %d, offset %d" ), nc->GetName().GetData(), CurSource().GetData(), CurLineNumber(), CurOffset() ); THROW_IO_ERROR( error ); } diff --git a/pcbnew/pcbplot.cpp b/pcbnew/pcbplot.cpp index 1a508a4265..17004e252c 100644 --- a/pcbnew/pcbplot.cpp +++ b/pcbnew/pcbplot.cpp @@ -153,7 +153,7 @@ bool EnsureOutputDirectory( wxFileName *aOutputDir, if( !aOutputDir->MakeAbsolute( boardFilePath ) ) { wxString msg; - msg.Printf( _( "Cannot make %s absolute with respect to %s!" ), + msg.Printf( _( "Cannot make <%s> absolute with respect to <%s>!" ), GetChars( aOutputDir->GetPath() ), GetChars( boardFilePath ) ); wxMessageBox( msg, _( "Plot" ), wxOK | wxICON_ERROR ); @@ -168,9 +168,9 @@ bool EnsureOutputDirectory( wxFileName *aOutputDir, if( aMessageBox ) { wxString msg; - msg.Printf( _( "Directory %s created.\n" ), GetChars( outputPath ) ); + msg.Printf( _( "Directory <%s> created.\n" ), GetChars( outputPath ) ); aMessageBox->AppendText( msg ); - return true; + return true; } } else diff --git a/pcbnew/specctra_export.cpp b/pcbnew/specctra_export.cpp index de4fe71b55..8b751fb538 100644 --- a/pcbnew/specctra_export.cpp +++ b/pcbnew/specctra_export.cpp @@ -964,7 +964,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR ) if( module->GetReference() == wxEmptyString ) { - ThrowIOError( _("Component with value of \"%s\" has empty reference id."), + ThrowIOError( _("Component with value of %s has empty reference id."), GetChars( module->GetValue() ) ); } @@ -972,7 +972,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR ) STRINGSET_PAIR refpair = refs.insert( TO_UTF8( module->GetReference() ) ); if( !refpair.second ) // insert failed { - ThrowIOError( _("Multiple components have identical reference IDs of \"%s\"."), + ThrowIOError( _("Multiple components have identical reference IDs of %s."), GetChars( module->GetReference() ) ); } } diff --git a/pcbnew/xchgmod.cpp b/pcbnew/xchgmod.cpp index cff88fb8e4..f0290bec13 100644 --- a/pcbnew/xchgmod.cpp +++ b/pcbnew/xchgmod.cpp @@ -192,7 +192,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference, { if( ShowError ) { - msg.Printf( _( "file %s not found" ), GetChars( fn.GetFullPath() ) ); + msg.Printf( _( "file <%s> not found" ), GetChars( fn.GetFullPath() ) ); m_WinMessages->AppendText( msg ); } @@ -207,7 +207,7 @@ int DIALOG_EXCHANGE_MODULE::Maj_ListeCmp( const wxString& reference, { if( ShowError ) { - msg.Printf( _( "Unable to create file %s" ), + msg.Printf( _( "Unable to create file <%s>" ), GetChars( tmpFileName.GetFullPath() ) ); m_WinMessages->AppendText( msg ); } @@ -323,14 +323,14 @@ void DIALOG_EXCHANGE_MODULE::Change_ModuleId( bool aUseValue ) { check_module_value = true; value = m_CurrentModule->GetValue(); - msg.Printf( _( "Change modules <%s> -> <%s> (val = %s)?" ), + msg.Printf( _( "Change modules %s -> %s (for value = %s)?" ), GetChars( m_CurrentModule->GetLibRef() ), GetChars( newmodulename ), GetChars( m_CurrentModule->GetValue() ) ); } else { - msg.Printf( _( "Change modules <%s> -> <%s> ?" ), + msg.Printf( _( "Change modules %s -> %s ?" ), GetChars( lib_reference ), GetChars( newmodulename ) ); } @@ -462,7 +462,7 @@ bool DIALOG_EXCHANGE_MODULE::Change_1_Module( MODULE* Module, namecmp = new_module; /* Load module. */ - line.Printf( _( "Change module %s (%s) " ), + line.Printf( _( "Change module %s (from %s) " ), GetChars( Module->GetReference() ), GetChars( oldnamecmp ) ); m_WinMessages->AppendText( line ); @@ -480,7 +480,7 @@ bool DIALOG_EXCHANGE_MODULE::Change_1_Module( MODULE* Module, if( Module == m_CurrentModule ) m_CurrentModule = NewModule; - m_WinMessages->AppendText( wxT( "Ok\n" ) ); + m_WinMessages->AppendText( wxT( "OK\n" ) ); m_Parent->Exchange_Module( Module, NewModule, aUndoPickList ); From 66453e3d9288b2105854b1862f75a57bd863eead Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Tue, 9 Apr 2013 21:20:21 +0200 Subject: [PATCH 61/63] Fixed pad preview color --- pcbnew/dialogs/dialog_pad_properties.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index 27ca9bc5ae..6cecfca528 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -174,7 +174,7 @@ void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event ) wxPaintDC dc( m_panelShowPad ); PAD_DRAWINFO drawInfo; - EDA_COLOR_T color = ColorFromInt( 0 ); // XXX EVIL merge + EDA_COLOR_T color = BLACK; if( m_dummyPad->GetLayerMask() & LAYER_FRONT ) { @@ -183,10 +183,12 @@ void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event ) if( m_dummyPad->GetLayerMask() & LAYER_BACK ) { - color = ColorFromInt( color | m_board->GetVisibleElementColor( PAD_BK_VISIBLE ) ); // XXX EVIL merge + color = ColorMix( color, m_board->GetVisibleElementColor( PAD_BK_VISIBLE ) ); } - if( color == 0 ) + // What could happen: the pad color is *actually* black, or no + // copper was selected + if( color == BLACK ) color = LIGHTGRAY; drawInfo.m_Color = color; @@ -229,9 +231,8 @@ void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event ) // Draw X and Y axis. // this is particularly useful to show the reference position of pads // with offset and no hole - int width = 0; - GRLine( NULL, &dc, -dim, 0, dim, 0, width, BLUE ); // X axis - GRLine( NULL, &dc, 0, -dim, 0, dim, width, BLUE ); // Y axis + GRLine( NULL, &dc, -dim, 0, dim, 0, 0, BLUE ); // X axis + GRLine( NULL, &dc, 0, -dim, 0, dim, 0, BLUE ); // Y axis event.Skip(); } From 4cbbce3aa688bca278fa4fa755d90259244144d3 Mon Sep 17 00:00:00 2001 From: Lorenzo Marcantonio Date: Wed, 10 Apr 2013 09:03:19 +0200 Subject: [PATCH 62/63] Removed ugly usage of an extra layer slot for the layer count in gerbview Fixed layer picker for exporting to pcbnew Realigned pcb layer name with class BOARD --- .../dialogs/dialog_select_one_pcb_layer.cpp | 69 ++++++++++--------- gerbview/export_to_pcbnew.cpp | 9 +-- gerbview/select_layers_to_pcb.cpp | 2 - gerbview/select_layers_to_pcb.h | 8 +-- 4 files changed, 44 insertions(+), 44 deletions(-) diff --git a/gerbview/dialogs/dialog_select_one_pcb_layer.cpp b/gerbview/dialogs/dialog_select_one_pcb_layer.cpp index 4da2ad218a..dd22789103 100644 --- a/gerbview/dialogs/dialog_select_one_pcb_layer.cpp +++ b/gerbview/dialogs/dialog_select_one_pcb_layer.cpp @@ -61,7 +61,8 @@ END_EVENT_TABLE() * different radiobutton is clicked on) prior to then clicking on the "Deselect" * button provided within the "Layer selection:" dialog box). */ -LAYER_NUM GERBVIEW_FRAME::SelectPCBLayer( LAYER_NUM aDefaultLayer, int aCopperLayerCount, bool aShowDeselectOption ) +LAYER_NUM GERBVIEW_FRAME::SelectPCBLayer( LAYER_NUM aDefaultLayer, int aCopperLayerCount, + bool aShowDeselectOption ) { LAYER_NUM layer; SELECT_LAYER_DIALOG* frame = new SELECT_LAYER_DIALOG( this, aDefaultLayer, @@ -89,7 +90,7 @@ SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent, { wxButton* Button; LAYER_NUM ii; - wxString LayerList[NB_LAYERS + 1]; // One extra element for "(Deselect)" + wxString LayerList[NB_PCB_LAYERS + 1]; // One extra element for "(Deselect)" // radiobutton int LayerCount, LayerSelect = -1; @@ -112,8 +113,8 @@ SELECT_LAYER_DIALOG::SELECT_LAYER_DIALOG( GERBVIEW_FRAME* parent, LayerCount++; } } - // Build the layer list; build copper layers list - for( ; ii < NB_LAYERS; ++ii ) + // Build the layer list; build non copper layers list + for( ; ii < NB_PCB_LAYERS; ++ii ) { m_LayerId[ii] = FIRST_LAYER; @@ -188,36 +189,36 @@ const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber ) // Use a switch to explicitly show the mapping more clearly switch( aLayerNumber ) { - case LAYER_N_FRONT: txt = _( "Front" ); break; - case LAYER_N_2: txt = _( "Inner1" ); break; - case LAYER_N_3: txt = _( "Inner2" ); break; - case LAYER_N_4: txt = _( "Inner3" ); break; - case LAYER_N_5: txt = _( "Inner4" ); break; - case LAYER_N_6: txt = _( "Inner5" ); break; - case LAYER_N_7: txt = _( "Inner6" ); break; - case LAYER_N_8: txt = _( "Inner7" ); break; - case LAYER_N_9: txt = _( "Inner8" ); break; - case LAYER_N_10: txt = _( "Inner9" ); break; - case LAYER_N_11: txt = _( "Inner10" ); break; - case LAYER_N_12: txt = _( "Inner11" ); break; - case LAYER_N_13: txt = _( "Inner12" ); break; - case LAYER_N_14: txt = _( "Inner13" ); break; - case LAYER_N_15: txt = _( "Inner14" ); break; - case LAYER_N_BACK: txt = _( "Back" ); break; - case ADHESIVE_N_BACK: txt = _( "Adhes_Back" ); break; - case ADHESIVE_N_FRONT: txt = _( "Adhes_Front" ); break; - case SOLDERPASTE_N_BACK: txt = _( "SoldP_Back" ); break; - case SOLDERPASTE_N_FRONT: txt = _( "SoldP_Front" ); break; - case SILKSCREEN_N_BACK: txt = _( "SilkS_Back" ); break; - case SILKSCREEN_N_FRONT: txt = _( "SilkS_Front" ); break; - case SOLDERMASK_N_BACK: txt = _( "Mask_Back" ); break; - case SOLDERMASK_N_FRONT: txt = _( "Mask_Front" ); break; - case DRAW_N: txt = _( "Drawings" ); break; - case COMMENT_N: txt = _( "Comments" ); break; - case ECO1_N: txt = _( "Eco1" ); break; - case ECO2_N: txt = _( "Eco2" ); break; - case EDGE_N: txt = _( "PCB_Edges" ); break; - default: txt = wxT( "BAD INDEX" ); break; + case LAYER_N_FRONT: txt = wxT( "F.Cu" ); break; + case LAYER_N_2: txt = wxT( "Inner1.Cu" ); break; + case LAYER_N_3: txt = wxT( "Inner2.Cu" ); break; + case LAYER_N_4: txt = wxT( "Inner3.Cu" ); break; + case LAYER_N_5: txt = wxT( "Inner4.Cu" ); break; + case LAYER_N_6: txt = wxT( "Inner5.Cu" ); break; + case LAYER_N_7: txt = wxT( "Inner6.Cu" ); break; + case LAYER_N_8: txt = wxT( "Inner7.Cu" ); break; + case LAYER_N_9: txt = wxT( "Inner8.Cu" ); break; + case LAYER_N_10: txt = wxT( "Inner9.Cu" ); break; + case LAYER_N_11: txt = wxT( "Inner10.Cu" ); break; + case LAYER_N_12: txt = wxT( "Inner11.Cu" ); break; + case LAYER_N_13: txt = wxT( "Inner12.Cu" ); break; + case LAYER_N_14: txt = wxT( "Inner13.Cu" ); break; + case LAYER_N_15: txt = wxT( "Inner14.Cu" ); break; + case LAYER_N_BACK: txt = wxT( "B.Cu" ); break; + case ADHESIVE_N_BACK: txt = wxT( "B.Adhes" ); break; + case ADHESIVE_N_FRONT: txt = wxT( "F.Adhes" ); break; + case SOLDERPASTE_N_BACK: txt = wxT( "B.Paste" ); break; + case SOLDERPASTE_N_FRONT: txt = wxT( "F.Paste" ); break; + case SILKSCREEN_N_BACK: txt = wxT( "B.SilkS" ); break; + case SILKSCREEN_N_FRONT: txt = wxT( "F.SilkS" ); break; + case SOLDERMASK_N_BACK: txt = wxT( "B.Mask" ); break; + case SOLDERMASK_N_FRONT: txt = wxT( "F.Mask" ); break; + case DRAW_N: txt = wxT( "Dwgs.User" ); break; + case COMMENT_N: txt = wxT( "Cmts.User" ); break; + case ECO1_N: txt = wxT( "Eco1.User" ); break; + case ECO2_N: txt = wxT( "Eco2.User" ); break; + case EDGE_N: txt = wxT( "Edge.Cuts" ); break; + default: txt = wxT( "BAD_INDEX" ); break; } return wxString( txt ); diff --git a/gerbview/export_to_pcbnew.cpp b/gerbview/export_to_pcbnew.cpp index a1ada2d65f..a127b11fee 100644 --- a/gerbview/export_to_pcbnew.cpp +++ b/gerbview/export_to_pcbnew.cpp @@ -44,7 +44,7 @@ public: * Function ExportPcb * saves a board from a set of Gerber images. */ - bool ExportPcb( LAYER_NUM* LayerLookUpTable ); + bool ExportPcb( LAYER_NUM* LayerLookUpTable, int aCopperLayers ); private: /** @@ -166,11 +166,12 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event ) GBR_TO_PCB_EXPORTER gbr_exporter( this, fileName ); - gbr_exporter.ExportPcb( layerdlg->GetLayersLookUpTable() ); + gbr_exporter.ExportPcb( layerdlg->GetLayersLookUpTable(), + layerdlg->GetCopperLayersCount() ); } -bool GBR_TO_PCB_EXPORTER::ExportPcb( LAYER_NUM* LayerLookUpTable ) +bool GBR_TO_PCB_EXPORTER::ExportPcb( LAYER_NUM* LayerLookUpTable, int aCopperLayers ) { m_fp = wxFopen( m_pcb_file_name, wxT( "wt" ) ); @@ -182,7 +183,7 @@ bool GBR_TO_PCB_EXPORTER::ExportPcb( LAYER_NUM* LayerLookUpTable ) return false; } - m_pcbCopperLayersCount = LayerLookUpTable[NB_GERBER_LAYERS]; + m_pcbCopperLayersCount = aCopperLayers; writePcbHeader(); diff --git a/gerbview/select_layers_to_pcb.cpp b/gerbview/select_layers_to_pcb.cpp index b9f4158982..6583e578ae 100644 --- a/gerbview/select_layers_to_pcb.cpp +++ b/gerbview/select_layers_to_pcb.cpp @@ -423,7 +423,5 @@ void LAYERS_MAP_DIALOG::OnOkClick( wxCommandEvent& event ) _("The exported board has not enough copper layers to handle selected inner layers") ); return; } - // XXX EVIL usage of LAYER - m_layersLookUpTable[NB_GERBER_LAYERS] = m_exportBoardCopperLayersCount; EndModal( wxID_OK ); } diff --git a/gerbview/select_layers_to_pcb.h b/gerbview/select_layers_to_pcb.h index c4ad9789b5..dd27ee28ea 100644 --- a/gerbview/select_layers_to_pcb.h +++ b/gerbview/select_layers_to_pcb.h @@ -20,16 +20,16 @@ private: static int m_exportBoardCopperLayersCount; wxFlexGridSizer* m_flexRightColumnBoxSizer; // An extra wxFlexGridSizer used // when we have more than 16 gerber files loaded - LAYER_NUM m_layersLookUpTable[int(NB_LAYERS)+1]; // Indexes Gerber layers to PCB file layers + LAYER_NUM m_layersLookUpTable[NB_GERBER_LAYERS]; // Indexes Gerber layers to PCB file layers // the last value in table is the number of copper layers - int m_buttonTable[32]; // Indexes buttons to Gerber layers - wxStaticText* m_layersList[32]; // Indexes text strings to buttons + int m_buttonTable[int(NB_GERBER_LAYERS)+1]; // Indexes buttons to Gerber layers + wxStaticText* m_layersList[int(NB_GERBER_LAYERS)+1]; // Indexes text strings to buttons public: LAYERS_MAP_DIALOG( GERBVIEW_FRAME* parent ); ~LAYERS_MAP_DIALOG() {}; LAYER_NUM * GetLayersLookUpTable() { return m_layersLookUpTable; } - int GetCopperLayersCount() { return m_exportBoardCopperLayersCount; } + static int GetCopperLayersCount() { return m_exportBoardCopperLayersCount; } private: void initDialog(); From 0d41a7a52343a1a1cb80282c8cf26a1b93720341 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 10 Apr 2013 09:23:20 +0200 Subject: [PATCH 63/63] All: fix some issues in messages to translate. Remove fully outdated files --- HOW_TO_CONTRIBUTE.txt | 22 +- README.txt | 21 +- common/dsnlexer.cpp | 8 +- .../dialogs/dialog_edit_component_in_lib.cpp | 2 +- eeschema/find.cpp | 4 +- eeschema/onrightclick.cpp | 26 +- .../dialog_edit_module_for_BoardEditor.cpp | 9 +- pcbnew/gen_modules_placefile.cpp | 5 +- pcbnew/legacy_plugin.cpp | 18 +- pcbnew/loadcmp.cpp | 10 +- pcbnew/pcb_parser.cpp | 6 +- scripts/kicad-devel | 284 - scripts/kicad-get-rss | 65 - scripts/pcb-dr-adjust/example.brd | 6181 ----------------- scripts/pcb-dr-adjust/howto.txt | 27 - scripts/pcb-dr-adjust/pcb-dr-adjust.cfg | 7 - scripts/pcb-dr-adjust/pcb-dr-adjust.pl | 147 - scripts/setfont.sh | 43 - 18 files changed, 69 insertions(+), 6816 deletions(-) delete mode 100755 scripts/kicad-devel delete mode 100755 scripts/kicad-get-rss delete mode 100644 scripts/pcb-dr-adjust/example.brd delete mode 100644 scripts/pcb-dr-adjust/howto.txt delete mode 100644 scripts/pcb-dr-adjust/pcb-dr-adjust.cfg delete mode 100644 scripts/pcb-dr-adjust/pcb-dr-adjust.pl delete mode 100755 scripts/setfont.sh diff --git a/HOW_TO_CONTRIBUTE.txt b/HOW_TO_CONTRIBUTE.txt index 8d7477eb51..6175aa05d9 100644 --- a/HOW_TO_CONTRIBUTE.txt +++ b/HOW_TO_CONTRIBUTE.txt @@ -2,9 +2,9 @@ Contribute to KiCad (under Linux) -------------------- 1) make sure you have all the dependencies of KiCad: - sudo apt-get install debhelper dpatch libx11-dev - sudo apt-get install libglu1-mesa-dev libgl1-mesa-dev mesa-common-dev - sudo apt-get install libwxbase2.8-dev libwxgtk2.8-dev libboost-dev fakeroot + sudo apt-get install debhelper dpatch libx11-dev + sudo apt-get install libglu1-mesa-dev libgl1-mesa-dev mesa-common-dev + sudo apt-get install libwxbase2.8-dev libwxgtk2.8-dev libboost-dev fakeroot sudo apt-get install cmake bzr 2) initialize Bazaar: @@ -24,18 +24,20 @@ Contribute to KiCad (under Linux) cd kicad_john mkdir build; cd build cmake ../ -DKICAD_TESTING_VERSION=ON -DCMAKE_BUILD_TYPE=Debug + to build a debug version + or + cmake ../ -DKICAD_TESTING_VERSION=ON -DCMAKE_BUILD_TYPE=Release + to build a release version make -j 4 # this is for a 4 core machine 7) Repeat step 5 and 6 until satisfied. -8) Delete the "build" folder and create a patch: - cd kicad_john - rm -R ./build - bzr add . - bzr status - bzr diff > gui_better_zoom.patch +8) Create a patch: + in kicad_john: + if some files are added: bzr add [FILE...] + bzr diff > my_changes.patch -9) Send the patch file "gui_better_zoom.patch" to the KiCad developers mailing list. +9) Send the patch file "my_changes.patch" to the KiCad developers mailing list. in the subject of the e-mail include the keyword "[PATCH]". in the body of the e-mail clearly explain what you have done. diff --git a/README.txt b/README.txt index da5b569b05..5a7fe278f9 100644 --- a/README.txt +++ b/README.txt @@ -5,16 +5,15 @@ Documentation subfolder. Files ----- -AUTHORS.txt - The authors, contributors, document writers and translators list -CHANGELOG.txt - This years changelog (see for previous years Documentation/changelogs) -CMakeList.txt - CMAKE build tool script -COPYRIGHT.txt - A copy of the GNU General Public License Version 2 -CTestConfig.txt - Support for CTest and CDash testing tools -Doxyfile - Doxygen preferences -INSTALL.txt - The release (binairy) installation instructions -TODO.txt - Todo list -uncrustify.cfg - Uncrustify code formatting tool preferences -version.txt - The current stable released version +AUTHORS.txt - The authors, contributors, document writers and translators list +CHANGELOG.txt - This years changelog (see for previous years Documentation/changelogs) +CMakeList.txt - CMAKE build tool script +COPYRIGHT.txt - A copy of the GNU General Public License Version 2 +CTestConfig.cmake - Support for CTest and CDash testing tools +Doxyfile - Doxygen config file for Kicad +INSTALL.txt - The release (binairy) installation instructions +TODO.txt - Todo list +uncrustify.cfg - Uncrustify config file for uncrustify sorces formatting tool Subdirectories -------------- @@ -37,6 +36,6 @@ packaging - Files for packaging on Windows and Mac OSX pcbnew - Sourcecode of the printed circuit board editor polygon - Sourcecode of the polygon library resources - Resources for installation, freedesktop mime-types for linux -scripts - Helper scripts. For building, sourcecode packaging, font setting, pcb adjusting. +scripts - Helper scripts. For building, sourcecode packaging. template - Project template(s) diff --git a/common/dsnlexer.cpp b/common/dsnlexer.cpp index 00e9fad992..03b4112221 100644 --- a/common/dsnlexer.cpp +++ b/common/dsnlexer.cpp @@ -281,7 +281,7 @@ bool DSNLEXER::IsSymbol( int aTok ) void DSNLEXER::Expecting( int aTok ) throw( IO_ERROR ) { wxString errText; - errText.Printf( _("Expecting %s"), GetChars( GetTokenString( aTok ) ) ); + errText.Printf( _("Expecting '%s'"), GetChars( GetTokenString( aTok ) ) ); THROW_PARSE_ERROR( errText, CurSource(), CurLine(), CurLineNumber(), CurOffset() ); } @@ -289,7 +289,7 @@ void DSNLEXER::Expecting( int aTok ) throw( IO_ERROR ) void DSNLEXER::Expecting( const char* text ) throw( IO_ERROR ) { wxString errText; - errText.Printf( _("Expecting '%s'"), + errText.Printf( _("Expecting '%s'"), GetChars( wxString::FromUTF8( text ) ) ); THROW_PARSE_ERROR( errText, CurSource(), CurLine(), CurLineNumber(), CurOffset() ); } @@ -298,7 +298,7 @@ void DSNLEXER::Expecting( const char* text ) throw( IO_ERROR ) void DSNLEXER::Unexpected( int aTok ) throw( IO_ERROR ) { wxString errText; - errText.Printf( _("Unexpected %s"), GetChars( GetTokenString( aTok ) ) ); + errText.Printf( _("Unexpected '%s'"), GetChars( GetTokenString( aTok ) ) ); THROW_PARSE_ERROR( errText, CurSource(), CurLine(), CurLineNumber(), CurOffset() ); } @@ -314,7 +314,7 @@ void DSNLEXER::Duplicate( int aTok ) throw( IO_ERROR ) void DSNLEXER::Unexpected( const char* text ) throw( IO_ERROR ) { wxString errText; - errText.Printf( _("Unexpected '%s'"), + errText.Printf( _("Unexpected '%s'"), GetChars( wxString::FromUTF8( text ) ) ); THROW_PARSE_ERROR( errText, CurSource(), CurLine(), CurLineNumber(), CurOffset() ); } diff --git a/eeschema/dialogs/dialog_edit_component_in_lib.cpp b/eeschema/dialogs/dialog_edit_component_in_lib.cpp index 8b5ba1de76..42a2d55034 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_lib.cpp @@ -452,7 +452,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::BrowseAndSelectDocFile( wxCommandEvent& e void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllFootprintFilter( wxCommandEvent& event ) { - if( IsOK( this, _( "OK to Delete FootprintFilter LIST" ) ) ) + if( IsOK( this, _( "OK to delete the footprint filter list ?" ) ) ) { m_FootprintFilterListBox->Clear(); m_ButtonDeleteAllFootprintFilter->Enable( false ); diff --git a/eeschema/find.cpp b/eeschema/find.cpp index 845eb4ec74..0349a84603 100644 --- a/eeschema/find.cpp +++ b/eeschema/find.cpp @@ -253,11 +253,11 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference, break; case FIND_VALUE: // find value - msg_item.Printf( _( "value " ), GetChars( aSearchText ) ); + msg_item.Printf( _( "value" ), GetChars( aSearchText ) ); break; case FIND_FIELD: // find field. todo - msg_item.Printf( _( "field " ), GetChars( aSearchText ) ); + msg_item.Printf( _( "field" ), GetChars( aSearchText ) ); break; } diff --git a/eeschema/onrightclick.cpp b/eeschema/onrightclick.cpp index db36e65d66..85fb879095 100644 --- a/eeschema/onrightclick.cpp +++ b/eeschema/onrightclick.cpp @@ -305,10 +305,10 @@ void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field ) { switch( Field->GetId() ) { - case REFERENCE: name = _( "Move reference" ); break; - case VALUE: name = _( "Move value" ); break; - case FOOTPRINT: name = _( "Move footprint field" ); break; - default: name = _( "Move field" ); break; + case REFERENCE: name = _( "Move Reference" ); break; + case VALUE: name = _( "Move Value" ); break; + case FOOTPRINT: name = _( "Move Footprint Field" ); break; + default: name = _( "Move Field" ); break; } msg = AddHotkeyName( name, s_Schematic_Hokeys_Descr, @@ -318,10 +318,10 @@ void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field ) switch( Field->GetId() ) { - case REFERENCE: name = _( "Rotate reference" ); break; - case VALUE: name = _( "Rotate value" ); break; - case FOOTPRINT: name = _( "Rotate footprint field" ); break; - default: name = _( "Rotate field" ); break; + case REFERENCE: name = _( "Rotate Reference" ); break; + case VALUE: name = _( "Rotate Value" ); break; + case FOOTPRINT: name = _( "Rotate Footprint Field" ); break; + default: name = _( "Rotate Field" ); break; } msg = AddHotkeyName( name, s_Schematic_Hokeys_Descr, HK_ROTATE ); @@ -333,19 +333,19 @@ void AddMenusForComponentField( wxMenu* PopMenu, SCH_FIELD* Field ) { case REFERENCE: id = HK_EDIT_COMPONENT_REFERENCE; - name = _( "Edit reference" ); + name = _( "Edit Reference" ); break; case VALUE: id = HK_EDIT_COMPONENT_VALUE; - name = _( "Edit value" ); + name = _( "Edit Value" ); break; case FOOTPRINT: id = HK_EDIT_COMPONENT_FOOTPRINT; - name = _( "Edit footprint field" ); + name = _( "Edit Footprint Field" ); break; default: id = HK_EDIT; - name = _( "Edit field" ); + name = _( "Edit Field" ); break; } msg = AddHotkeyName( name, s_Schematic_Hokeys_Descr, id ); @@ -368,7 +368,7 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component ) if( !Component->GetFlags() ) { - msg.Printf( _( "Move Component %s" ), + msg.Printf( _( "Move Component %s" ), GetChars( Component->GetField( REFERENCE )->GetText() ) ); msg = AddHotkeyName( msg, s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT_OR_ITEM ); AddMenuItem( PopMenu, ID_SCH_MOVE_ITEM, msg, KiBitmap( move_xpm ) ); diff --git a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp index ae71a34709..49c414771c 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp @@ -267,11 +267,14 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties() m_ValueCtrl->SetValue( m_ValueCopy->GetText() ); m_AttributsCtrl->SetItemToolTip( 0, - _( "Use this attribute for most non SMD components" ) ); + _( "Use this attribute for most non SMD components\n" + "Components with this option are not put in the footprint position list file" ) ); m_AttributsCtrl->SetItemToolTip( 1, - _( "Use this attribute for SMD components.\nOnly components with this option are put in the footprint position list file" ) ); + _( "Use this attribute for SMD components.\n" + "Only components with this option are put in the footprint position list file" ) ); m_AttributsCtrl->SetItemToolTip( 2, - _( "Use this attribute for \"virtual\" components drawn on board (like a old ISA PC bus connector)" ) ); + _( "Use this attribute for \"virtual\" components drawn on board\n" + "(like a old ISA PC bus connector)" ) ); /* Controls on right side of the dialog */ switch( m_CurrentModule->GetAttributes() & 255 ) diff --git a/pcbnew/gen_modules_placefile.cpp b/pcbnew/gen_modules_placefile.cpp index 9264755326..92eb693446 100644 --- a/pcbnew/gen_modules_placefile.cpp +++ b/pcbnew/gen_modules_placefile.cpp @@ -237,7 +237,8 @@ bool DIALOG_GEN_MODULE_POSITION::CreateFiles() if( singleFile ) msg.Printf( _( "Place file: <%s>\n" ), GetChars( fn.GetFullPath() ) ); else - msg.Printf( _( "Component side place file: <%s>\n" ), GetChars( fn.GetFullPath() ) ); + msg.Printf( _( "Front side (top side) place file: <%s>\n" ), + GetChars( fn.GetFullPath() ) ); AddMessage( msg ); msg.Printf( _( "Footprint count %d\n" ), fpcount ); @@ -268,7 +269,7 @@ bool DIALOG_GEN_MODULE_POSITION::CreateFiles() // Display results if( !singleFile ) { - msg.Printf( _( "Copper side place file: <%s>\n" ), GetChars( fn.GetFullPath() ) ); + msg.Printf( _( "Back side (bottom side) place file: <%s>\n" ), GetChars( fn.GetFullPath() ) ); AddMessage( msg ); msg.Printf( _( "Footprint count %d\n" ), fpcount ); AddMessage( msg ); diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index f3dec7cf47..e39698c58a 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -1556,7 +1556,7 @@ void LEGACY_PLUGIN::loadMODULE_TEXT( TEXTE_MODULE* aText ) char* hjust = strtok( (char*) txt_end, delims ); char* vjust = strtok( NULL, delims ); - if( type != TEXTE_MODULE::TEXT_is_REFERENCE + if( type != TEXTE_MODULE::TEXT_is_REFERENCE && type != TEXTE_MODULE::TEXT_is_VALUE ) type = TEXTE_MODULE::TEXT_is_DIVERS; @@ -2739,16 +2739,18 @@ BIU LEGACY_PLUGIN::biuParse( const char* aValue, const char** nptrptr ) if( errno ) { - m_error.Printf( _( "invalid float number in\nfile: <%s>\nline: %d\noffset: %d" ), - m_reader->GetSource().GetData(), m_reader->LineNumber(), aValue - m_reader->Line() + 1 ); + m_error.Printf( _( "invalid float number in file: <%s>\nline: %d, offset: %d" ), + m_reader->GetSource().GetData(), + m_reader->LineNumber(), aValue - m_reader->Line() + 1 ); THROW_IO_ERROR( m_error ); } if( aValue == nptr ) { - m_error.Printf( _( "missing float number in\nfile: <%s>\nline: %d\noffset: %d" ), - m_reader->GetSource().GetData(), m_reader->LineNumber(), aValue - m_reader->Line() + 1 ); + m_error.Printf( _( "missing float number in file: <%s>\nline: %d, offset: %d" ), + m_reader->GetSource().GetData(), + m_reader->LineNumber(), aValue - m_reader->Line() + 1 ); THROW_IO_ERROR( m_error ); } @@ -2774,7 +2776,7 @@ double LEGACY_PLUGIN::degParse( const char* aValue, const char** nptrptr ) if( errno ) { - m_error.Printf( _( "invalid float number in\nfile: <%s>\nline: %d\noffset: %d" ), + m_error.Printf( _( "invalid float number in file: <%s>\nline: %d, offset: %d" ), m_reader->GetSource().GetData(), m_reader->LineNumber(), aValue - m_reader->Line() + 1 ); THROW_IO_ERROR( m_error ); @@ -2782,7 +2784,7 @@ double LEGACY_PLUGIN::degParse( const char* aValue, const char** nptrptr ) if( aValue == nptr ) { - m_error.Printf( _( "missing float number in\nfile: <%s>\nline: %d\noffset: %d" ), + m_error.Printf( _( "missing float number in file: <%s>\nline: %d, offset: %d" ), m_reader->GetSource().GetData(), m_reader->LineNumber(), aValue - m_reader->Line() + 1 ); THROW_IO_ERROR( m_error ); @@ -4333,7 +4335,7 @@ void LEGACY_PLUGIN::FootprintLibCreate( const wxString& aLibraryPath, PROPERTIES if( wxFileExists( aLibraryPath ) ) { THROW_IO_ERROR( wxString::Format( - _( "library <%s> already exists, will not create anew" ), + _( "library <%s> already exists, will not create a new" ), aLibraryPath.GetData() ) ); } diff --git a/pcbnew/loadcmp.cpp b/pcbnew/loadcmp.cpp index 3a8161f8cc..847d9a70ed 100644 --- a/pcbnew/loadcmp.cpp +++ b/pcbnew/loadcmp.cpp @@ -441,7 +441,7 @@ wxString PCB_BASE_FRAME::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow, wxArrayString headers; headers.Add( wxT("Module") ); std::vector itemsToDisplay; - + // Conversion from wxArrayString to vector of ArrayString for( unsigned i = 0; i < footprint_names_list.GetCount(); i++ ) { @@ -449,7 +449,7 @@ wxString PCB_BASE_FRAME::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow, item.Add( footprint_names_list[i] ); itemsToDisplay.push_back( item ); } - + msg.Printf( _( "Modules [%d items]" ), (int) footprint_names_list.GetCount() ); EDA_LIST_DIALOG dlg( aWindow, msg, headers, itemsToDisplay, OldName, DisplayCmpDoc ); @@ -512,14 +512,14 @@ MODULE* FOOTPRINT_EDIT_FRAME::Select_1_Module_From_BOARD( BOARD* aPcb ) wxArrayString headers; headers.Add( wxT("Module") ); std::vector itemsToDisplay; - + // Conversion from wxArrayString to vector of ArrayString for( unsigned i = 0; i < listnames.GetCount(); i++ ) { wxArrayString item; item.Add( listnames[i] ); itemsToDisplay.push_back( item ); - } + } EDA_LIST_DIALOG dlg( this, msg, headers, itemsToDisplay, wxEmptyString, NULL, SORT_LIST ); if( dlg.ShowModal() == wxID_OK ) @@ -574,7 +574,7 @@ void FOOTPRINT_EDIT_FRAME::OnSaveLibraryAs( wxCommandEvent& aEvent ) } wxString msg = wxString::Format( - _( "Footprint library\n<%s> saved as\n<%s>" ), + _( "Footprint library <%s> saved as <%s>" ), GetChars( curLibPath ), GetChars( dstLibPath ) ); DisplayInfoMessage( this, msg ); diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index 0383a5e797..143d222442 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -89,7 +89,7 @@ double PCB_PARSER::parseDouble() throw( IO_ERROR ) if( errno ) { wxString error; - error.Printf( _( "invalid floating point number in\nfile: <%s>\nline: %d\noffset: %d" ), + error.Printf( _( "invalid floating point number in file: <%s>\nline: %d, offset: %d" ), GetChars( CurSource() ), CurLineNumber(), CurOffset() ); THROW_IO_ERROR( error ); @@ -98,7 +98,7 @@ double PCB_PARSER::parseDouble() throw( IO_ERROR ) if( CurText() == tmp ) { wxString error; - error.Printf( _( "missing floating point number in\nfile: <%s>\nline: %d\noffset: %d" ), + error.Printf( _( "missing floating point number in file: <%s>\nline: %d, offset: %d" ), GetChars( CurSource() ), CurLineNumber(), CurOffset() ); THROW_IO_ERROR( error ); @@ -1680,7 +1680,7 @@ MODULE* PCB_PARSER::parseMODULE() throw( IO_ERROR, PARSE_ERROR ) module->Value() = *text; delete text; break; - + default: module->GraphicalItems().PushBack( text ); } diff --git a/scripts/kicad-devel b/scripts/kicad-devel deleted file mode 100755 index a33aa154da..0000000000 --- a/scripts/kicad-devel +++ /dev/null @@ -1,284 +0,0 @@ -#!/usr/bin/perl -w -my $vernr = "0.0.2"; -my $monthshort = "Mar"; -my $monthlong = "March"; -my $year = "2009"; - - -use strict; -use warnings; -use Getopt::Long; -use Pod::Usage; - -### -# User defined settings -### -my $svn_path_remote = 'https://kicad.svn.sourceforge.net/svnroot/kicad/trunk'; -my $svn_path_local = '/media/data/projects/applications/kicad/subversion/kicad-core'; -my $build_path = '/home/jerry/builds/kicad'; - - -## TODO -## Add debian package generation -## dh_make -e jerkejacobs@gmail.com -s -n -## debuild -us -uc -## TODO - - -### -# Commandline options -### -my $option_about = 0; -my $option_manual = 0; -my $option_help = 0; -my $option_build_binaries = 0; -my $option_svn_update = 0; -my $option_verbose = 1; -my $option_version = 0; -my $option_generate_makefiles = 0; -my $option_no_clear = 0; -my $option_install_binaries = 0; -my $no_options = 0; # No options given - -### -# Commands -### -my $command_silent = '&> /dev/null'; # Nullify stderr and stdout from commands -my $command_cmake = "cmake -DCMAKE_BUILD_TYPE=Debug -DwxWidgets_USE_DEBUG=ON -DKICAD_AUIMANAGER=ON -DKICAD_AUITOOLBAR=ON $svn_path_local"; # Where cmake looks for CMakeLists.txt -my $command_svn_update = 'svn update'; # Subversion update command - -### -# Help and about messages -### -my $about_message = "KiCad Devel, version $vernr, $monthshort $year, jerkejacobs\@gmail.org\n"; -my $short_help = "No options given try `kicad_devel.pl --help' for more information.\n"; - - -########################################### -########### Commandline options ########### -########################################### -if (@ARGV == 0) -{ - print $short_help; -} -else -{ - GetOptions('help|?' => \$option_help, - 'man' => \$option_manual, - 'build-binaries|compile' => \$option_build_binaries, - 'svn-update' => \$option_svn_update, - 'about' => \$option_about, - 'version' => \$option_version, - 'generate-makefiles' => \$option_generate_makefiles, - 'install|install-binaries' => \$option_install_binaries, - 'no-clear' => \$option_no_clear, - - # Verbose settings - 'quiet|noverbose' => sub { $option_verbose = 0 }); - - pod2usage(1) if $option_help; - pod2usage(-verbose => 2) if $option_manual; -} - - -########################### -########### Main ########## -########################### - -# Init main function -main(); - -sub -main -{ - # No commandline options given - if ($no_options) { - print $short_help; - exit(0); - } - - # Option svn update given - if ($option_svn_update) { - svn_update(); - } - - # Generate makefiles - if ($option_generate_makefiles) { - generate_makefiles(); - } - - # Option build binaries given - if ($option_build_binaries) { - build_binaries(); - } - - # Install compiled binaries - if ($option_install_binaries) { - install_binaries(); - } - exit(0); -} - -### -# Clear the console screen -### -sub -clear_screen { - - # Clear screen if no clear option is false - if ($option_no_clear == 0) - { - print `clear`; - } - else - { - print "\n\n"; - } -} - -### -# Print line of $_[1] char -# $_[0] = Number of chars before newline -# $_[1] = Char to print line of -### -sub -print_line { - for(my $i = 0; $i < $_[0]; ++$i) { - print $_[1]; - } - print "\n"; -} - -### -# Execute cmake on svn_path_local to generate makefiles -# on build_path -### -sub -generate_makefiles { - - # Print settings to output - if ($option_verbose == 1) - { - clear_screen(); - - print_line(80, '#'); - - print " Generating makefiles\n"; - - print_line(80, '#'); - - print " SVN Path : $svn_path_local\n"; - print " Build Path : $build_path\n"; - print " CMake Command : $command_cmake\n"; - - print_line(80, '#'); - } - - ### - # Execute cmake command with correct verbose level output - ### - - # Execute command and dump output to console - if ($option_verbose == 0) - { - chdir $build_path; - `$command_cmake $command_silent`; - } - - # Execute command and display output to console - if ($option_verbose == 1) - { - chdir $build_path - or die "Can't cd to $build_path"; - print `$command_cmake`; - } - - # Print output - if ($option_verbose == 1) - { - print_line(80, '#'); - } -} - -### -# Update local subversion repository on $svn_path_local -### -sub -svn_update -{ - if ($option_verbose) - { - clear_screen(); - print_line(80, '#'); - print "Updating local subversion repository\n"; - print_line(80, '#'); - print "Repository path : $svn_path_local\n"; - print "SVN Command : $command_svn_update\n"; - print_line(80, '#'); - chdir $svn_path_local - or die "Can't cd to $svn_path_local"; - print `$command_svn_update`; - print_line(80, '#'); - } - else - { - chdir $svn_path_local; - `$command_svn_update $command_silent`; - } -} - -### -# Build the binaries on $build_path -### -sub -build_binaries -{ - chdir $build_path - or die "Can't cd to $build_path"; - system("make -j 4"); -} - -### -# Install the compiled binaries from $build_path -### -sub -install_binaries -{ - chdir $build_path - or die "Can't cd to $build_path"; - system("make install"); -} - -######## Begin of POD manual page ######## -__END__ - -=head1 NAME - -kicad_devel - KiCad development helper program - -=head1 SYNOPSIS - -kicad_devel [options] - -Options: - - --help -? brief help message - --man -M full program manual - --verbose -V set verbosity level - --about about information - --version -v display version information - --svn-update -svn-up update kicad subversion path - --build-binaries -compile compile sourcecode in build path - --install-binaries -install install compiled binaries - --no-clear dont clear the console screen after every command is executed - -=head1 OPTIONS - -=head2 HELP - -=head1 DESCRIPTION - -B will read the given input file(s) and do something -useful with the contents thereof. - -=cut diff --git a/scripts/kicad-get-rss b/scripts/kicad-get-rss deleted file mode 100755 index 58f4144886..0000000000 --- a/scripts/kicad-get-rss +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/sh -# RSS Feed Display Script by Hellf[i]re v0.1 -# -# This script is designed for most any RSS Feed. As some feeds may -# not be -# completely compliant, it may need a bit of tweaking -# -# This script depends on curl. -# Gentoo: emerge -av net-misc/curl -# Debian: apt-get install curl -# Homepage: http://curl.haxx.se/ -# -# Usage: -# .conkyrc: ${execi [time] /path/to/script/conky-rss.sh} -# -# Applications needed: -# bash, cat, grep, sed, curl -# -# Usage Example -# ${execi 300 /home/youruser/scripts/conky-rss.sh} - -#RSS Setup -URI=http://sourceforge.net/export/rss2_keepsake.php?group_id=145591 #URI of RSS Feed -FEEDFILE="/tmp/kicad-svn-`date +%y%m%d-%H%M%S`.rss" -URLFILE="/tmp/kicad-svn-`date +%y%m%d-%H%M%S`.url" - -# Get feed and save -EXEC="/usr/bin/curl -s" #Path to curl -`$EXEC $URI &> $FEEDFILE` - -# Get commit description -cat $FEEDFILE | \ -grep title | \ -sed -e 's/[ \t]*//' | \ -sed -e '/activity/d' | \ -sed -e '/artifact/d' | \ -sed -e 's///' | \ -sed -e 's/<\!\[CDATA\[//' | \ -sed -e 's/\]\]>//' | \ -sed -e 's/<\/title>//' - -# Space between descriptions and messages -echo "" - -# Get viewvc urls only -cat $FEEDFILE | \ -grep link | \ -sed -e '/tracker/d' | \ -sed -e '/export/d' | \ -sed -e 's/[ \t]*//' | \ -sed -e 's/<link>//' | \ -sed -e 's/<\/link>//' &> $URLFILE - -# Get commit messages from urls -exec < $URLFILE -while read LINE -do - curl -s "$LINE" | \ - grep vc_log | \ - sed -e 's/<td><pre class=\"vc_log\">//' | \ - sed -e 's/<\/pre><\/td>//' | \ - sed -e '/<style/d' -done - -rm /tmp/kicad-svn-* diff --git a/scripts/pcb-dr-adjust/example.brd b/scripts/pcb-dr-adjust/example.brd deleted file mode 100644 index 1d710fc5e6..0000000000 --- a/scripts/pcb-dr-adjust/example.brd +++ /dev/null @@ -1,6181 +0,0 @@ -PCBNEW-BOARD Version 1 date 8/4/2008-08:06:04 - -$GENERAL -LayerCount 2 -Ly 1FFF8001 -Links 188 -NoConn 1 -Di 48705 21705 86960 52795 -Ndraw 4 -Ntrack 1100 -Nzone 0 -Nmodule 73 -Nnets 56 -$EndGENERAL - -$SHEETDESCR -Sheet A4 11700 8267 -Title "" -Date "8 apr 2008" -Rev "" -Comp "" -Comment1 "" -Comment2 "" -Comment3 "" -Comment4 "" -$EndSHEETDESCR - -$SETUP -InternalUnit 0.000100 INCH -GridSize 100 100 -UserGridSize 0.010000 0.010000 mm -ZoneGridSize 100 -Layers 2 -Layer[0] Copper signal -Layer[1] Inner_L1 signal -TrackWidth 197 -TrackWidthHistory 197 -TrackClearence 71 -ZoneClearence 150 -DrawSegmWidth 150 -EdgeSegmWidth 150 -ViaSize 450 -ViaDrill 315 -ViaSizeHistory 450 -MicroViaSize 200 -MicroViaDrill 80 -MicroViasAllowed 0 -TextPcbWidth 120 -TextPcbSize 600 800 -EdgeModWidth 150 -TextModSize 600 600 -TextModWidth 120 -PadSize 600 600 -PadDrill 400 -AuxiliaryAxisOrg 0 0 -$EndSETUP - -$EQUIPOT -Na 0 "" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 1 "/SPSet" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 2 "/SPRead" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 3 "/KBD_INT" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 4 "/KBD_DATA" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 5 "/WPSet" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 6 "VCC" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 7 "GND" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 8 "N-000025" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 9 "N-000023" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 10 "/WPRead" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 11 "/HPSet" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 12 "/HPRead" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 13 "/SPoSet" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 14 "/Reset" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 15 "/SPoRead" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 16 "/WPoSet" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 17 "/WPoRead" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 18 "/HPoSet" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 19 "/HPoRead" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 20 "N-000024" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 21 "/XPoSet" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 22 "/XPoRead" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 23 "/TESTLED" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 24 "/SDA" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 25 "/SCL" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 26 "/XPLinePWR" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 27 "GNDPWR" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 28 "/HPLinePWR" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 29 "/SPLinePWR" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 30 "/WPLinePWR" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 31 "/SPlSet" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 32 "/WPlSet" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 33 "/WPOutToLine" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 34 "+12V" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 35 "/SPOutToLine" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 36 "/XPlSet" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 37 "/HPlSet" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 38 "/HPOutToLine" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 39 "/XPOutToLine" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 40 "/WPLine" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 41 "/HPLine" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 42 "/XPLine" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 43 "N-000059" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 44 "N-000012" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 45 "/SPLine" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 46 "/VccIN" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 47 "N-000020" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 48 "N-000016" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 49 "N-000007" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 50 "N-000017" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 51 "N-000006" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 52 "N-000018" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 53 "N-000005" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 54 "N-000019" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 55 "N-000004" -St ~ -$EndEQUIPOT -$EQUIPOT -Na 56 "N-000003" -St ~ -$EndEQUIPOT -$MODULE 28dip300 -Po 72500 43000 900 15 00200000 47B03D84 ~P -Li 28dip300 -Cd Module Dil 28 pins, pads ronds, e=300 mils -Kw DIL -Sc 47B03D84 -AR /47B03D84 -Op 0 0 0 -T0 -4500 0 600 450 900 120 N V 21 "I1" -T1 4000 0 600 450 900 120 N V 21 "ATMEGA8-16PI" -DS -7500 -1000 7500 -1000 150 21 -DS 7500 -1000 7500 1000 150 21 -DS 7500 1000 -7500 1000 150 21 -DS -7500 1000 -7500 -1000 150 21 -DS -7500 -500 -7000 -500 150 21 -DS -7000 -500 -7000 500 150 21 -DS -7000 500 -7500 500 150 21 -$PAD -Sh "2" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 1 "/SPSet" -Po -5500 1500 -$EndPAD -$PAD -Sh "3" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 2 "/SPRead" -Po -4500 1500 -$EndPAD -$PAD -Sh "4" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 3 "/KBD_INT" -Po -3500 1500 -$EndPAD -$PAD -Sh "5" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 4 "/KBD_DATA" -Po -2500 1500 -$EndPAD -$PAD -Sh "6" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 5 "/WPSet" -Po -1500 1500 -$EndPAD -$PAD -Sh "7" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 6 "VCC" -Po -500 1500 -$EndPAD -$PAD -Sh "8" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 7 "GND" -Po 500 1500 -$EndPAD -$PAD -Sh "9" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 8 "N-000025" -Po 1500 1500 -$EndPAD -$PAD -Sh "10" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 9 "N-000023" -Po 2500 1500 -$EndPAD -$PAD -Sh "11" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 10 "/WPRead" -Po 3500 1500 -$EndPAD -$PAD -Sh "12" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 11 "/HPSet" -Po 4500 1500 -$EndPAD -$PAD -Sh "13" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 12 "/HPRead" -Po 5500 1500 -$EndPAD -$PAD -Sh "14" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 13 "/SPoSet" -Po 6500 1500 -$EndPAD -$PAD -Sh "1" R 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 14 "/Reset" -Po -6500 1500 -$EndPAD -$PAD -Sh "15" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 15 "/SPoRead" -Po 6500 -1500 -$EndPAD -$PAD -Sh "16" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 16 "/WPoSet" -Po 5500 -1500 -$EndPAD -$PAD -Sh "17" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 17 "/WPoRead" -Po 4500 -1500 -$EndPAD -$PAD -Sh "18" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 18 "/HPoSet" -Po 3500 -1500 -$EndPAD -$PAD -Sh "19" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 19 "/HPoRead" -Po 2500 -1500 -$EndPAD -$PAD -Sh "20" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 6 "VCC" -Po 1500 -1500 -$EndPAD -$PAD -Sh "21" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 6 "VCC" -Po 500 -1500 -$EndPAD -$PAD -Sh "22" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 7 "GND" -Po -500 -1500 -$EndPAD -$PAD -Sh "23" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 20 "N-000024" -Po -1500 -1500 -$EndPAD -$PAD -Sh "24" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 21 "/XPoSet" -Po -2500 -1500 -$EndPAD -$PAD -Sh "25" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 22 "/XPoRead" -Po -3500 -1500 -$EndPAD -$PAD -Sh "26" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 23 "/TESTLED" -Po -4500 -1500 -$EndPAD -$PAD -Sh "27" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 24 "/SDA" -Po -5500 -1500 -$EndPAD -$PAD -Sh "28" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 25 "/SCL" -Po -6500 -1500 -$EndPAD -$SHAPE3D -Na "dil/dil_28-w300.wrl" -Sc 1.000000 1.000000 1.000000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE 28dip300 -$MODULE 8DIP-ELL300 -Po 61000 41000 1800 15 47C511AD 47A5AE8D ~P -Li 8DIP-ELL300 -Cd Module Dil 8 pins, pads elliptiques -Kw DIL -Sc 47A5AE8D -AR /47A5AE8D -Op 0 0 0 -T0 -2500 0 700 450 2700 120 N V 21 "OK2" -T1 0 0 700 400 1800 120 N V 21 "CNY74" -DS -2000 -500 -1500 -500 150 21 -DS -1500 -500 -1500 500 150 21 -DS -1500 500 -2000 500 150 21 -DS -2000 -1000 2000 -1000 150 21 -DS 2000 -1000 2000 1000 150 21 -DS 2000 1000 -2000 1000 150 21 -DS -2000 1000 -2000 -1000 150 21 -$PAD -Sh "1" R 620 900 0 0 1800 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 26 "/XPLinePWR" -Po -1500 1500 -$EndPAD -$PAD -Sh "2" O 620 900 0 0 1800 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 27 "GNDPWR" -Po -500 1500 -$EndPAD -$PAD -Sh "3" O 620 900 0 0 1800 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 27 "GNDPWR" -Po 500 1500 -$EndPAD -$PAD -Sh "4" O 620 900 0 0 1800 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 28 "/HPLinePWR" -Po 1500 1500 -$EndPAD -$PAD -Sh "5" O 620 900 0 0 1800 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 7 "GND" -Po 1500 -1500 -$EndPAD -$PAD -Sh "6" O 620 900 0 0 1800 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 19 "/HPoRead" -Po 500 -1500 -$EndPAD -$PAD -Sh "7" O 620 900 0 0 1800 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 22 "/XPoRead" -Po -500 -1500 -$EndPAD -$PAD -Sh "8" O 620 900 0 0 1800 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 7 "GND" -Po -1500 -1500 -$EndPAD -$SHAPE3D -Na "dil/dil_8.wrl" -Sc 1.000000 1.000000 1.000000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE 8DIP-ELL300 -$MODULE 8DIP-ELL300 -Po 52000 41000 1800 15 00200000 47BAEAF7 ~P -Li 8DIP-ELL300 -Cd Module Dil 8 pins, pads elliptiques -Kw DIL -Sc 47BAEAF7 -AR /47BAEAF7 -Op 0 0 0 -T0 -2500 0 700 450 2700 120 N V 21 "OK1" -T1 0 0 700 400 1800 120 N V 21 "CNY74" -DS -2000 -500 -1500 -500 150 21 -DS -1500 -500 -1500 500 150 21 -DS -1500 500 -2000 500 150 21 -DS -2000 -1000 2000 -1000 150 21 -DS 2000 -1000 2000 1000 150 21 -DS 2000 1000 -2000 1000 150 21 -DS -2000 1000 -2000 -1000 150 21 -$PAD -Sh "1" R 620 900 0 0 1800 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 29 "/SPLinePWR" -Po -1500 1500 -$EndPAD -$PAD -Sh "2" O 620 900 0 0 1800 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 27 "GNDPWR" -Po -500 1500 -$EndPAD -$PAD -Sh "3" O 620 900 0 0 1800 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 27 "GNDPWR" -Po 500 1500 -$EndPAD -$PAD -Sh "4" O 620 900 0 0 1800 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 30 "/WPLinePWR" -Po 1500 1500 -$EndPAD -$PAD -Sh "5" O 620 900 0 0 1800 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 7 "GND" -Po 1500 -1500 -$EndPAD -$PAD -Sh "6" O 620 900 0 0 1800 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 17 "/WPoRead" -Po 500 -1500 -$EndPAD -$PAD -Sh "7" O 620 900 0 0 1800 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 15 "/SPoRead" -Po -500 -1500 -$EndPAD -$PAD -Sh "8" O 620 900 0 0 1800 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 7 "GND" -Po -1500 -1500 -$EndPAD -$SHAPE3D -Na "dil/dil_8.wrl" -Sc 1.000000 1.000000 1.000000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE 8DIP-ELL300 -$MODULE 8DIP-ELL300 -Po 56500 41000 0 15 00200000 47BAEAFC ~P -Li 8DIP-ELL300 -Cd Module Dil 8 pins, pads elliptiques -Kw DIL -Sc 47BAEAFC -AR /47BAEAFC -Op 0 0 0 -T0 -2500 0 700 450 900 120 N V 21 "OK3" -T1 0 0 700 400 0 120 N V 21 "CNY74" -DS -2000 -500 -1500 -500 150 21 -DS -1500 -500 -1500 500 150 21 -DS -1500 500 -2000 500 150 21 -DS -2000 -1000 2000 -1000 150 21 -DS 2000 -1000 2000 1000 150 21 -DS 2000 1000 -2000 1000 150 21 -DS -2000 1000 -2000 -1000 150 21 -$PAD -Sh "1" R 620 900 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 31 "/SPlSet" -Po -1500 1500 -$EndPAD -$PAD -Sh "2" O 620 900 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 13 "/SPoSet" -Po -500 1500 -$EndPAD -$PAD -Sh "3" O 620 900 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 16 "/WPoSet" -Po 500 1500 -$EndPAD -$PAD -Sh "4" O 620 900 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 32 "/WPlSet" -Po 1500 1500 -$EndPAD -$PAD -Sh "5" O 620 900 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 33 "/WPOutToLine" -Po 1500 -1500 -$EndPAD -$PAD -Sh "6" O 620 900 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 34 "+12V" -Po 500 -1500 -$EndPAD -$PAD -Sh "7" O 620 900 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 34 "+12V" -Po -500 -1500 -$EndPAD -$PAD -Sh "8" O 620 900 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 35 "/SPOutToLine" -Po -1500 -1500 -$EndPAD -$SHAPE3D -Na "dil/dil_8.wrl" -Sc 1.000000 1.000000 1.000000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE 8DIP-ELL300 -$MODULE 8DIP-ELL300 -Po 66000 41000 0 15 47C511EA 47A5AEAB ~P -Li 8DIP-ELL300 -Cd Module Dil 8 pins, pads elliptiques -Kw DIL -Sc 47A5AEAB -AR /47A5AEAB -Op 0 0 0 -T0 -2500 0 700 450 900 120 N V 21 "OK4" -T1 0 0 700 400 0 120 N V 21 "CNY74" -DS -2000 -500 -1500 -500 150 21 -DS -1500 -500 -1500 500 150 21 -DS -1500 500 -2000 500 150 21 -DS -2000 -1000 2000 -1000 150 21 -DS 2000 -1000 2000 1000 150 21 -DS 2000 1000 -2000 1000 150 21 -DS -2000 1000 -2000 -1000 150 21 -$PAD -Sh "1" R 620 900 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 36 "/XPlSet" -Po -1500 1500 -$EndPAD -$PAD -Sh "2" O 620 900 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 21 "/XPoSet" -Po -500 1500 -$EndPAD -$PAD -Sh "3" O 620 900 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 18 "/HPoSet" -Po 500 1500 -$EndPAD -$PAD -Sh "4" O 620 900 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 37 "/HPlSet" -Po 1500 1500 -$EndPAD -$PAD -Sh "5" O 620 900 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 38 "/HPOutToLine" -Po 1500 -1500 -$EndPAD -$PAD -Sh "6" O 620 900 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 34 "+12V" -Po 500 -1500 -$EndPAD -$PAD -Sh "7" O 620 900 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 34 "+12V" -Po -500 -1500 -$EndPAD -$PAD -Sh "8" O 620 900 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 39 "/XPOutToLine" -Po -1500 -1500 -$EndPAD -$SHAPE3D -Na "dil/dil_8.wrl" -Sc 1.000000 1.000000 1.000000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE 8DIP-ELL300 -$MODULE C2V10 -Po 71500 25000 900 15 47C3D976 47A81946 ~P -Li C2V10 -Cd Condensateur polarise -Kw CP -Sc 47A81946 -AR /47A81946 -Op 0 0 0 -T0 0 1000 500 500 900 100 N V 21 "C6" -T1 0 -1000 500 500 900 100 N V 21 "20uF" -DC 0 0 1900 -1100 120 21 -$PAD -Sh "1" R 700 700 0 0 900 -Dr 400 0 0 -At STD N 00E00001 -Ne 34 "+12V" -Po -1000 0 -$EndPAD -$PAD -Sh "2" C 700 700 0 0 900 -Dr 400 0 0 -At STD N 00E00001 -Ne 27 "GNDPWR" -Po 1000 0 -$EndPAD -$SHAPE3D -Na "cjb/c_vert_c2v10.wrl" -Sc 1.000000 1.000000 1.000000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE C2V10 -$MODULE C2V10 -Po 78500 33000 2700 15 47C3D99A 47A7FA68 ~P -Li C2V10 -Cd Condensateur polarise -Kw CP -Sc 47A7FA68 -AR /47A7FA68 -Op 0 0 0 -T0 0 1000 500 500 2700 100 N V 21 "C2" -T1 0 -1000 500 500 2700 100 N V 21 "20uF" -DC 0 0 1900 -1100 120 21 -$PAD -Sh "1" R 700 700 0 0 2700 -Dr 400 0 0 -At STD N 00E00001 -Ne 6 "VCC" -Po -1000 0 -$EndPAD -$PAD -Sh "2" C 700 700 0 0 2700 -Dr 400 0 0 -At STD N 00E00001 -Ne 7 "GND" -Po 1000 0 -$EndPAD -$SHAPE3D -Na "cjb/c_vert_c2v10.wrl" -Sc 1.000000 1.000000 1.000000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE C2V10 -$MODULE D3 -Po 55600 33800 0 15 00200000 47A728E3 ~P -Li D3 -Cd Diode 3 pas -Kw DIODE DEV -Sc 47A728E3 -AR /47A728E3 -Op 0 0 0 -T0 0 0 400 400 0 80 N V 21 "D5" -T1 0 0 400 400 0 80 N I 21 "12V" -DS 1500 0 1200 0 120 21 -DS 1200 0 1200 -400 120 21 -DS 1200 -400 -1200 -400 120 21 -DS -1200 -400 -1200 0 120 21 -DS -1200 0 -1500 0 120 21 -DS -1200 0 -1200 400 120 21 -DS -1200 400 1200 400 120 21 -DS 1200 400 1200 0 120 21 -DS 1000 -400 1000 400 120 21 -DS 900 400 900 -400 120 21 -$PAD -Sh "2" R 550 550 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 40 "/WPLine" -Po 1500 0 -$EndPAD -$PAD -Sh "1" C 550 550 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 27 "GNDPWR" -Po -1500 0 -$EndPAD -$SHAPE3D -Na "discret/diode.wrl" -Sc 0.300000 0.300000 0.300000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE D3 -$MODULE D3 -Po 66800 33200 2700 15 00200000 47A80CF7 ~P -Li D3 -Cd Diode 3 pas -Kw DIODE DEV -Sc 47A80CF7 -AR /47A80CF7 -Op 0 0 0 -T0 0 0 400 400 2700 80 N V 21 "D7" -T1 0 0 400 400 2700 80 N I 21 "12V" -DS 1500 0 1200 0 120 21 -DS 1200 0 1200 -400 120 21 -DS 1200 -400 -1200 -400 120 21 -DS -1200 -400 -1200 0 120 21 -DS -1200 0 -1500 0 120 21 -DS -1200 0 -1200 400 120 21 -DS -1200 400 1200 400 120 21 -DS 1200 400 1200 0 120 21 -DS 1000 -400 1000 400 120 21 -DS 900 400 900 -400 120 21 -$PAD -Sh "2" R 550 550 0 0 2700 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 41 "/HPLine" -Po 1500 0 -$EndPAD -$PAD -Sh "1" C 550 550 0 0 2700 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 27 "GNDPWR" -Po -1500 0 -$EndPAD -$SHAPE3D -Na "discret/diode.wrl" -Sc 0.300000 0.300000 0.300000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE D3 -$MODULE D3 -Po 70000 30000 900 15 00200000 47A81985 ~P -Li D3 -Cd Diode 3 pas -Kw DIODE DEV -Sc 47A81985 -AR /47A81985 -Op 0 0 0 -T0 0 0 400 400 900 80 N V 21 "D8" -T1 0 0 400 400 900 80 N I 21 "12V" -DS 1500 0 1200 0 120 21 -DS 1200 0 1200 -400 120 21 -DS 1200 -400 -1200 -400 120 21 -DS -1200 -400 -1200 0 120 21 -DS -1200 0 -1500 0 120 21 -DS -1200 0 -1200 400 120 21 -DS -1200 400 1200 400 120 21 -DS 1200 400 1200 0 120 21 -DS 1000 -400 1000 400 120 21 -DS 900 400 900 -400 120 21 -$PAD -Sh "2" R 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 34 "+12V" -Po 1500 0 -$EndPAD -$PAD -Sh "1" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 27 "GNDPWR" -Po -1500 0 -$EndPAD -$SHAPE3D -Na "discret/diode.wrl" -Sc 0.300000 0.300000 0.300000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE D3 -$MODULE D3 -Po 61200 32300 900 15 00200000 47A80CEF ~P -Li D3 -Cd Diode 3 pas -Kw DIODE DEV -Sc 47A80CEF -AR /47A80CEF -Op 0 0 0 -T0 0 0 400 400 900 80 N V 21 "D6" -T1 0 0 400 400 900 80 N I 21 "12V" -DS 1500 0 1200 0 120 21 -DS 1200 0 1200 -400 120 21 -DS 1200 -400 -1200 -400 120 21 -DS -1200 -400 -1200 0 120 21 -DS -1200 0 -1500 0 120 21 -DS -1200 0 -1200 400 120 21 -DS -1200 400 1200 400 120 21 -DS 1200 400 1200 0 120 21 -DS 1000 -400 1000 400 120 21 -DS 900 400 900 -400 120 21 -$PAD -Sh "2" R 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 42 "/XPLine" -Po 1500 0 -$EndPAD -$PAD -Sh "1" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 27 "GNDPWR" -Po -1500 0 -$EndPAD -$SHAPE3D -Na "discret/diode.wrl" -Sc 0.300000 0.300000 0.300000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE D3 -$MODULE D3 -Po 78500 30000 0 15 00200000 47A6D0FE ~P -Li D3 -Cd Diode 3 pas -Kw DIODE DEV -Sc 47A6D0FE -AR /47A6D0FE -Op 0 0 0 -T0 0 0 400 400 0 80 N V 21 "D1" -T1 0 0 400 400 0 80 N I 21 "DIODESCH" -DS 1500 0 1200 0 120 21 -DS 1200 0 1200 -400 120 21 -DS 1200 -400 -1200 -400 120 21 -DS -1200 -400 -1200 0 120 21 -DS -1200 0 -1500 0 120 21 -DS -1200 0 -1200 400 120 21 -DS -1200 400 1200 400 120 21 -DS 1200 400 1200 0 120 21 -DS 1000 -400 1000 400 120 21 -DS 900 400 900 -400 120 21 -$PAD -Sh "2" R 550 550 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 6 "VCC" -Po 1500 0 -$EndPAD -$PAD -Sh "1" C 550 550 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 43 "N-000059" -Po -1500 0 -$EndPAD -$SHAPE3D -Na "discret/diode.wrl" -Sc 0.300000 0.300000 0.300000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE D3 -$MODULE D3 -Po 81300 31500 900 15 00200000 47A6CF6C ~P -Li D3 -Cd Diode 3 pas -Kw DIODE DEV -Sc 47A6CF6C -AR /47A6CF6C -Op 0 0 0 -T0 0 0 400 400 900 80 N V 21 "D2" -T1 0 0 400 400 900 80 N I 21 "5V" -DS 1500 0 1200 0 120 21 -DS 1200 0 1200 -400 120 21 -DS 1200 -400 -1200 -400 120 21 -DS -1200 -400 -1200 0 120 21 -DS -1200 0 -1500 0 120 21 -DS -1200 0 -1200 400 120 21 -DS -1200 400 1200 400 120 21 -DS 1200 400 1200 0 120 21 -DS 1000 -400 1000 400 120 21 -DS 900 400 900 -400 120 21 -$PAD -Sh "2" R 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 6 "VCC" -Po 1500 0 -$EndPAD -$PAD -Sh "1" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 7 "GND" -Po -1500 0 -$EndPAD -$SHAPE3D -Na "discret/diode.wrl" -Sc 0.300000 0.300000 0.300000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE D3 -$MODULE D3 -Po 67500 24500 900 15 00200000 47A818B9 ~P -Li D3 -Cd Diode 3 pas -Kw DIODE DEV -Sc 47A818B9 -AR /47A818B9 -Op 0 0 0 -T0 0 0 400 400 900 80 N V 21 "D3" -T1 0 0 400 400 900 80 N I 21 "12V" -DS 1500 0 1200 0 120 21 -DS 1200 0 1200 -400 120 21 -DS 1200 -400 -1200 -400 120 21 -DS -1200 -400 -1200 0 120 21 -DS -1200 0 -1500 0 120 21 -DS -1200 0 -1200 400 120 21 -DS -1200 400 1200 400 120 21 -DS 1200 400 1200 0 120 21 -DS 1000 -400 1000 400 120 21 -DS 900 400 900 -400 120 21 -$PAD -Sh "2" R 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 44 "N-000012" -Po 1500 0 -$EndPAD -$PAD -Sh "1" C 550 550 0 0 900 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 27 "GNDPWR" -Po -1500 0 -$EndPAD -$SHAPE3D -Na "discret/diode.wrl" -Sc 0.300000 0.300000 0.300000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE D3 -$MODULE D3 -Po 52000 33800 1800 15 00200000 47A5B938 ~P -Li D3 -Cd Diode 3 pas -Kw DIODE DEV -Sc 47A5B938 -AR /47A5B938 -Op 0 0 0 -T0 0 0 400 400 1800 80 N V 21 "D4" -T1 0 0 400 400 1800 80 N I 21 "12V" -DS 1500 0 1200 0 120 21 -DS 1200 0 1200 -400 120 21 -DS 1200 -400 -1200 -400 120 21 -DS -1200 -400 -1200 0 120 21 -DS -1200 0 -1500 0 120 21 -DS -1200 0 -1200 400 120 21 -DS -1200 400 1200 400 120 21 -DS 1200 400 1200 0 120 21 -DS 1000 -400 1000 400 120 21 -DS 900 400 900 -400 120 21 -$PAD -Sh "2" R 550 550 0 0 1800 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 45 "/SPLine" -Po 1500 0 -$EndPAD -$PAD -Sh "1" C 550 550 0 0 1800 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 27 "GNDPWR" -Po -1500 0 -$EndPAD -$SHAPE3D -Na "discret/diode.wrl" -Sc 0.300000 0.300000 0.300000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE D3 -$MODULE fuse-LITTLEFUSE -Po 75000 32000 900 15 00200000 47A6D070 ~P -Li fuse-LITTLEFUSE -Cd LITTLEFUSE -Kw LITTLEFUSE -Sc 47A6D070 -AR /47A6D070 -Op 0 0 0 -At VIRTUAL -T0 250 -1100 500 500 900 35 N V 21 "F1" -T1 450 1120 500 500 900 35 N V 21 "FUSE" -DS 1400 120 1540 120 26 21 -DS 1540 120 1540 -120 26 21 -DS 1400 -120 1540 -120 26 21 -DS 1400 120 1400 -120 26 21 -DS -1540 120 -1400 120 26 21 -DS -1400 120 -1400 -120 26 21 -DS -1540 -120 -1400 -120 26 21 -DS -1540 120 -1540 -120 26 21 -DS 2000 0 1550 0 240 21 -DS -2000 0 -1550 0 240 21 -DS 1050 -700 -1050 -700 60 21 -DS 1050 700 -1050 700 60 21 -DS -300 -100 -300 100 20 21 -DS -1050 -400 -1050 400 20 21 -DS 1050 -400 1050 400 20 21 -DS 300 -100 300 100 20 21 -DS 1400 -200 1400 200 60 21 -DS 1050 700 1400 200 60 21 -DS 1050 -700 1400 -200 60 21 -DS -1050 -700 -1400 -200 60 21 -DS -1400 -200 -1400 200 60 21 -DS -1400 200 -1050 700 60 21 -DS -600 0 600 0 20 21 -DS -300 -100 300 -100 20 21 -DS -300 100 300 100 20 21 -$PAD -Sh "1" O 700 1400 0 0 900 -Dr 320 0 0 -At STD N 00A88001 -Ne 46 "/VccIN" -Po -2000 0 -$EndPAD -$PAD -Sh "2" O 700 1400 0 0 900 -Dr 320 0 0 -At STD N 00A88001 -Ne 43 "N-000059" -Po 2000 0 -$EndPAD -$EndMODULE fuse-LITTLEFUSE -$MODULE HC-18UV -Po 76000 41000 900 15 47C3D9A9 47BC0385 ~P -Li HC-18UV -Cd Quartz boitier HC-18U vertical -Kw QUARTZ DEV -Sc 47BC0385 -AR /47BC0385 -Op 0 A 0 -T0 -50 -700 450 500 900 60 N V 21 "X2" -T1 0 650 450 500 900 60 N V 21 "CRYSTAL" -DS -2750 -500 -2250 -1000 60 21 -DS 2250 -1000 2750 -500 60 21 -DS 2750 500 2250 1000 60 21 -DS -2750 500 -2250 1000 60 21 -DS -2250 -1000 2250 -1000 60 21 -DS -2750 -500 -2750 500 60 21 -DS -2250 1000 2250 1000 60 21 -DS 2750 500 2750 -500 60 21 -$PAD -Sh "1" C 700 700 0 0 900 -Dr 320 0 0 -At STD N 00E00001 -Ne 8 "N-000025" -Po -1000 0 -$EndPAD -$PAD -Sh "2" C 700 700 0 0 900 -Dr 320 0 0 -At STD N 00E00001 -Ne 9 "N-000023" -Po 1000 0 -$EndPAD -$SHAPE3D -Na "discret/crystal_hc18u_vertical.wrl" -Sc 1.000000 1.000000 1.000000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE HC-18UV -$MODULE KL-RJ45 -Po 57500 28000 1800 15 47C3D91F 47AC6799 ~~ -Li KL-RJ45 -Cd RJ-45 CONNECTOR FOR IN-CIRCUIT PROGRAMMING CABLE -Kw RJ-45 CONNECTOR FOR IN-CIRCUIT PROGRAMMING CABLE -Sc 47AC6799 -AR /47AC6799 -Op 0 0 0 -At VIRTUAL -T0 6750 -350 700 700 1800 35 N V 21 "J1" -T1 7100 650 700 700 1800 35 N V 21 "KL-RJ45" -DS -1300 5500 4800 5500 150 21 -DS -1280 6700 4780 6700 50 21 -DS 4780 6700 4780 -1450 50 21 -DS 4780 -1450 -1280 -1450 50 21 -DS -1280 -1450 -1280 6700 50 21 -$PAD -Sh "1" R 550 550 0 0 1800 -Dr 394 0 0 -At STD N 00A80001 -Ne 27 "GNDPWR" -Po 0 0 -$EndPAD -$PAD -Sh "2" C 550 550 0 0 1800 -Dr 394 0 0 -At STD N 00A80001 -Ne 45 "/SPLine" -Po 500 -1000 -$EndPAD -$PAD -Sh "3" C 550 550 0 0 1800 -Dr 394 0 0 -At STD N 00A80001 -Ne 27 "GNDPWR" -Po 1000 0 -$EndPAD -$PAD -Sh "4" C 550 550 0 0 1800 -Dr 394 0 0 -At STD N 00A80001 -Ne 41 "/HPLine" -Po 1500 -1000 -$EndPAD -$PAD -Sh "5" C 550 550 0 0 1800 -Dr 394 0 0 -At STD N 00A80001 -Ne 27 "GNDPWR" -Po 2000 0 -$EndPAD -$PAD -Sh "6" C 550 550 0 0 1800 -Dr 394 0 0 -At STD N 00A80001 -Ne 40 "/WPLine" -Po 2500 -1000 -$EndPAD -$PAD -Sh "7" C 550 550 0 0 1800 -Dr 394 0 0 -At STD N 00A80001 -Ne 34 "+12V" -Po 3000 0 -$EndPAD -$PAD -Sh "8" C 550 550 0 0 1800 -Dr 394 0 0 -At STD N 00A80001 -Ne 42 "/XPLine" -Po 3500 -1000 -$EndPAD -$PAD -Sh "" C 1575 1575 0 0 1800 -Dr 1181 0 0 -At HOLE N 00F0FFFF -Ne 0 "" -Po -591 2362 -$EndPAD -$PAD -Sh "" C 1575 1575 0 0 1800 -Dr 1181 0 0 -At STD N 00E0FFFF -Ne 0 "" -Po 4134 2543 -$EndPAD -$PAD -Sh "9" C 800 800 0 0 1800 -Dr 500 0 0 -At STD N 00E0FFFF -Ne 27 "GNDPWR" -Po -1377 3724 -$EndPAD -$PAD -Sh "10" C 800 800 0 0 1800 -Dr 500 0 0 -At STD N 00E0FFFF -Ne 27 "GNDPWR" -Po 4921 3724 -$EndPAD -$SHAPE3D -Na "rj45-te.wrl" -Sc 0.400000 0.400000 0.400000 -Of 0.000000 0.000000 0.000000 -Ro 90.000000 180.000000 180.000000 -$EndSHAPE3D -$EndMODULE KL-RJ45 -$MODULE KL-RJ45 -Po 65000 28000 1800 15 47C3D962 47AC67D2 ~~ -Li KL-RJ45 -Cd RJ-45 CONNECTOR FOR IN-CIRCUIT PROGRAMMING CABLE -Kw RJ-45 CONNECTOR FOR IN-CIRCUIT PROGRAMMING CABLE -Sc 47AC67D2 -AR /47AC67D2 -Op 0 0 0 -At VIRTUAL -T0 6750 -350 700 700 1800 35 N V 21 "J2" -T1 7100 650 700 700 1800 35 N V 21 "KL-RJ45" -DS -1300 5500 4800 5500 150 21 -DS -1280 6700 4780 6700 50 21 -DS 4780 6700 4780 -1450 50 21 -DS 4780 -1450 -1280 -1450 50 21 -DS -1280 -1450 -1280 6700 50 21 -$PAD -Sh "1" R 550 550 0 0 1800 -Dr 394 0 0 -At STD N 00A80001 -Ne 27 "GNDPWR" -Po 0 0 -$EndPAD -$PAD -Sh "2" C 550 550 0 0 1800 -Dr 394 0 0 -At STD N 00A80001 -Ne 45 "/SPLine" -Po 500 -1000 -$EndPAD -$PAD -Sh "3" C 550 550 0 0 1800 -Dr 394 0 0 -At STD N 00A80001 -Ne 27 "GNDPWR" -Po 1000 0 -$EndPAD -$PAD -Sh "4" C 550 550 0 0 1800 -Dr 394 0 0 -At STD N 00A80001 -Ne 41 "/HPLine" -Po 1500 -1000 -$EndPAD -$PAD -Sh "5" C 550 550 0 0 1800 -Dr 394 0 0 -At STD N 00A80001 -Ne 27 "GNDPWR" -Po 2000 0 -$EndPAD -$PAD -Sh "6" C 550 550 0 0 1800 -Dr 394 0 0 -At STD N 00A80001 -Ne 40 "/WPLine" -Po 2500 -1000 -$EndPAD -$PAD -Sh "7" C 550 550 0 0 1800 -Dr 394 0 0 -At STD N 00A80001 -Ne 34 "+12V" -Po 3000 0 -$EndPAD -$PAD -Sh "8" C 550 550 0 0 1800 -Dr 394 0 0 -At STD N 00A80001 -Ne 42 "/XPLine" -Po 3500 -1000 -$EndPAD -$PAD -Sh "" C 1575 1575 0 0 1800 -Dr 1181 0 0 -At HOLE N 00F0FFFF -Ne 0 "" -Po -591 2362 -$EndPAD -$PAD -Sh "" C 1575 1575 0 0 1800 -Dr 1181 0 0 -At STD N 00E0FFFF -Ne 0 "" -Po 4134 2543 -$EndPAD -$PAD -Sh "9" C 800 800 0 0 1800 -Dr 500 0 0 -At STD N 00E0FFFF -Ne 27 "GNDPWR" -Po -1377 3724 -$EndPAD -$PAD -Sh "10" C 800 800 0 0 1800 -Dr 500 0 0 -At STD N 00E0FFFF -Ne 27 "GNDPWR" -Po 4921 3724 -$EndPAD -$SHAPE3D -Na "rj45-te.wrl" -Sc 0.400000 0.400000 0.400000 -Of 0.000000 0.000000 0.000000 -Ro 90.000000 180.000000 180.000000 -$EndSHAPE3D -$EndMODULE KL-RJ45 -$MODULE Mini_din6 -Po 79500 24000 1800 15 47C3D994 47BAA6C1 ~~ -Li Mini_din6 -Kw MINI DIN -Sc 47BAA6C1 -AR /47BAA6C1 -Op 0 0 0 -T0 0 -3000 600 600 1800 120 N V 21 "X1" -T1 0 3500 600 600 1800 120 N V 21 "PS2" -DS -2500 500 -2500 -2000 150 21 -DS -2500 -2000 2500 -2000 150 21 -DS 2500 -2000 2500 2000 150 21 -DS 2500 2000 -2500 2000 150 21 -DS -2500 2000 -2500 500 150 21 -$PAD -Sh "4" C 540 540 0 0 1800 -Dr 200 0 0 -At STD N 00E00001 -Ne 6 "VCC" -Po -400 -500 -$EndPAD -$PAD -Sh "3" C 540 540 0 0 1800 -Dr 200 0 0 -At STD N 00E00001 -Ne 7 "GND" -Po 450 -500 -$EndPAD -$PAD -Sh "1" C 540 540 0 0 1800 -Dr 200 0 0 -At STD N 00E00001 -Ne 4 "/KBD_DATA" -Po 1250 -1500 -$EndPAD -$PAD -Sh "6" C 540 540 0 0 1800 -Dr 200 0 0 -At STD N 00E00001 -Ne 0 "" -Po -1250 -1500 -$EndPAD -$PAD -Sh "5" C 540 540 0 0 1800 -Dr 200 0 0 -At STD N 00E00001 -Ne 3 "/KBD_INT" -Po -1250 -500 -$EndPAD -$PAD -Sh "2" C 540 540 0 0 1800 -Dr 200 0 0 -At STD N 00E00001 -Ne 0 "" -Po 1250 -500 -$EndPAD -$PAD -Sh "GND" R 1260 787 0 0 1800 -Dr 200 0 0 -At MECA N 00F0FFFF -Ne 0 "" -Po 0 700 -$EndPAD -$PAD -Sh "GND" R 854 1260 0 0 1800 -Dr 200 0 0 -At MECA N 00F0FFFF -Ne 0 "" -Po 2750 500 -$EndPAD -$PAD -Sh "GND" R 854 1260 0 0 1800 -Dr 276 0 0 -At MECA N 00F0FFFF -Ne 0 "" -Po -2750 500 -$EndPAD -$SHAPE3D -Na "cjb/minidin_6.wrl" -Sc 1.000000 1.000000 1.000000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE Mini_din6 -$MODULE PIN_ARRAY_2X1 -Po 55500 38000 1800 15 4565C520 47BAEAFA ~P -Li PIN_ARRAY_2X1 -Cd Connecteurs 2 pins -Kw CONN DEV -Sc 47BAEAFA -AR /47BAEAFA -Op 0 0 0 -T0 0 -750 300 300 1800 60 N V 21 "JP1" -T1 0 -750 300 300 1800 60 N I 21 "JUMPER" -DS -1000 500 -1000 -500 60 21 -DS -1000 -500 1000 -500 60 21 -DS 1000 -500 1000 500 60 21 -DS 1000 500 -1000 500 60 21 -$PAD -Sh "1" R 600 600 0 0 1800 -Dr 400 0 0 -At STD N 00E0FFFF -Ne 34 "+12V" -Po -500 0 -$EndPAD -$PAD -Sh "2" C 600 600 0 0 1800 -Dr 400 0 0 -At STD N 00E0FFFF -Ne 35 "/SPOutToLine" -Po 500 0 -$EndPAD -$SHAPE3D -Na "pin_array/pins_array_2x1.wrl" -Sc 1.000000 1.000000 1.000000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE PIN_ARRAY_2X1 -$MODULE PIN_ARRAY_2X1 -Po 59600 36200 2700 15 47C511DF 47A80CFD ~P -Li PIN_ARRAY_2X1 -Cd Connecteurs 2 pins -Kw CONN DEV -Sc 47A80CFD -AR /47A80CFD -Op 0 0 0 -T0 0 -750 300 300 2700 60 N V 21 "SW4" -T1 0 -750 300 300 2700 60 N I 21 "SW_PUSH" -DS -1000 500 -1000 -500 60 21 -DS -1000 -500 1000 -500 60 21 -DS 1000 -500 1000 500 60 21 -DS 1000 500 -1000 500 60 21 -$PAD -Sh "1" R 600 600 0 0 2700 -Dr 400 0 0 -At STD N 00E0FFFF -Ne 42 "/XPLine" -Po -500 0 -$EndPAD -$PAD -Sh "2" C 600 600 0 0 2700 -Dr 400 0 0 -At STD N 00E0FFFF -Ne 27 "GNDPWR" -Po 500 0 -$EndPAD -$SHAPE3D -Na "pin_array/pins_array_2x1.wrl" -Sc 1.000000 1.000000 1.000000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE PIN_ARRAY_2X1 -$MODULE PIN_ARRAY_2X1 -Po 65000 38000 1800 15 4565C520 47A7FA97 ~P -Li PIN_ARRAY_2X1 -Cd Connecteurs 2 pins -Kw CONN DEV -Sc 47A7FA97 -AR /47A7FA97 -Op 0 0 0 -T0 0 -750 300 300 1800 60 N V 21 "JP3" -T1 0 -750 300 300 1800 60 N I 21 "JUMPER" -DS -1000 500 -1000 -500 60 21 -DS -1000 -500 1000 -500 60 21 -DS 1000 -500 1000 500 60 21 -DS 1000 500 -1000 500 60 21 -$PAD -Sh "1" R 600 600 0 0 1800 -Dr 400 0 0 -At STD N 00E0FFFF -Ne 34 "+12V" -Po -500 0 -$EndPAD -$PAD -Sh "2" C 600 600 0 0 1800 -Dr 400 0 0 -At STD N 00E0FFFF -Ne 39 "/XPOutToLine" -Po 500 0 -$EndPAD -$SHAPE3D -Na "pin_array/pins_array_2x1.wrl" -Sc 1.000000 1.000000 1.000000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE PIN_ARRAY_2X1 -$MODULE PIN_ARRAY_2X1 -Po 67000 38000 0 15 4565C520 47A7FAA8 ~P -Li PIN_ARRAY_2X1 -Cd Connecteurs 2 pins -Kw CONN DEV -Sc 47A7FAA8 -AR /47A7FAA8 -Op 0 0 0 -T0 0 -750 300 300 0 60 N V 21 "JP4" -T1 0 -750 300 300 0 60 N I 21 "JUMPER" -DS -1000 500 -1000 -500 60 21 -DS -1000 -500 1000 -500 60 21 -DS 1000 -500 1000 500 60 21 -DS 1000 500 -1000 500 60 21 -$PAD -Sh "1" R 600 600 0 0 0 -Dr 400 0 0 -At STD N 00E0FFFF -Ne 34 "+12V" -Po -500 0 -$EndPAD -$PAD -Sh "2" C 600 600 0 0 0 -Dr 400 0 0 -At STD N 00E0FFFF -Ne 38 "/HPOutToLine" -Po 500 0 -$EndPAD -$SHAPE3D -Na "pin_array/pins_array_2x1.wrl" -Sc 1.000000 1.000000 1.000000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE PIN_ARRAY_2X1 -$MODULE PIN_ARRAY_2X1 -Po 50600 35800 2700 15 4565C520 47A72A2C ~P -Li PIN_ARRAY_2X1 -Cd Connecteurs 2 pins -Kw CONN DEV -Sc 47A72A2C -AR /47A72A2C -Op 0 0 0 -T0 0 -750 300 300 2700 60 N V 21 "SW2" -T1 0 -750 300 300 2700 60 N I 21 "SW_PUSH" -DS -1000 500 -1000 -500 60 21 -DS -1000 -500 1000 -500 60 21 -DS 1000 -500 1000 500 60 21 -DS 1000 500 -1000 500 60 21 -$PAD -Sh "1" R 600 600 0 0 2700 -Dr 400 0 0 -At STD N 00E0FFFF -Ne 45 "/SPLine" -Po -500 0 -$EndPAD -$PAD -Sh "2" C 600 600 0 0 2700 -Dr 400 0 0 -At STD N 00E0FFFF -Ne 27 "GNDPWR" -Po 500 0 -$EndPAD -$SHAPE3D -Na "pin_array/pins_array_2x1.wrl" -Sc 1.000000 1.000000 1.000000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE PIN_ARRAY_2X1 -$MODULE PIN_ARRAY_2X1 -Po 57500 38000 0 15 4565C520 47BAEAFB ~P -Li PIN_ARRAY_2X1 -Cd Connecteurs 2 pins -Kw CONN DEV -Sc 47BAEAFB -AR /47BAEAFB -Op 0 0 0 -T0 0 -750 300 300 0 60 N V 21 "JP2" -T1 0 -750 300 300 0 60 N I 21 "JUMPER" -DS -1000 500 -1000 -500 60 21 -DS -1000 -500 1000 -500 60 21 -DS 1000 -500 1000 500 60 21 -DS 1000 500 -1000 500 60 21 -$PAD -Sh "1" R 600 600 0 0 0 -Dr 400 0 0 -At STD N 00E0FFFF -Ne 34 "+12V" -Po -500 0 -$EndPAD -$PAD -Sh "2" C 600 600 0 0 0 -Dr 400 0 0 -At STD N 00E0FFFF -Ne 33 "/WPOutToLine" -Po 500 0 -$EndPAD -$SHAPE3D -Na "pin_array/pins_array_2x1.wrl" -Sc 1.000000 1.000000 1.000000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE PIN_ARRAY_2X1 -$MODULE PIN_ARRAY_2X1 -Po 57600 35000 0 15 4565C520 47A72A1E ~P -Li PIN_ARRAY_2X1 -Cd Connecteurs 2 pins -Kw CONN DEV -Sc 47A72A1E -AR /47A72A1E -Op 0 0 0 -T0 0 -750 300 300 0 60 N V 21 "SW3" -T1 0 -750 300 300 0 60 N I 21 "SW_PUSH" -DS -1000 500 -1000 -500 60 21 -DS -1000 -500 1000 -500 60 21 -DS 1000 -500 1000 500 60 21 -DS 1000 500 -1000 500 60 21 -$PAD -Sh "1" R 600 600 0 0 0 -Dr 400 0 0 -At STD N 00E0FFFF -Ne 40 "/WPLine" -Po -500 0 -$EndPAD -$PAD -Sh "2" C 600 600 0 0 0 -Dr 400 0 0 -At STD N 00E0FFFF -Ne 27 "GNDPWR" -Po 500 0 -$EndPAD -$SHAPE3D -Na "pin_array/pins_array_2x1.wrl" -Sc 1.000000 1.000000 1.000000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE PIN_ARRAY_2X1 -$MODULE PIN_ARRAY_2X1 -Po 65100 34600 1800 15 4565C520 47A80CFC ~P -Li PIN_ARRAY_2X1 -Cd Connecteurs 2 pins -Kw CONN DEV -Sc 47A80CFC -AR /47A80CFC -Op 0 0 0 -T0 0 -750 300 300 1800 60 N V 21 "SW5" -T1 0 -750 300 300 1800 60 N I 21 "SW_PUSH" -DS -1000 500 -1000 -500 60 21 -DS -1000 -500 1000 -500 60 21 -DS 1000 -500 1000 500 60 21 -DS 1000 500 -1000 500 60 21 -$PAD -Sh "1" R 600 600 0 0 1800 -Dr 400 0 0 -At STD N 00E0FFFF -Ne 41 "/HPLine" -Po -500 0 -$EndPAD -$PAD -Sh "2" C 600 600 0 0 1800 -Dr 400 0 0 -At STD N 00E0FFFF -Ne 27 "GNDPWR" -Po 500 0 -$EndPAD -$SHAPE3D -Na "pin_array/pins_array_2x1.wrl" -Sc 1.000000 1.000000 1.000000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE PIN_ARRAY_2X1 -$MODULE PIN_ARRAY_2X1 -Po 69500 44000 900 15 4565C520 47BC0432 ~P -Li PIN_ARRAY_2X1 -Cd Connecteurs 2 pins -Kw CONN DEV -Sc 47BC0432 -AR /47BC0432 -Op 0 0 0 -T0 0 -750 300 300 900 60 N V 21 "SW1" -T1 0 -750 300 300 900 60 N I 21 "TEST_SW" -DS -1000 500 -1000 -500 60 21 -DS -1000 -500 1000 -500 60 21 -DS 1000 -500 1000 500 60 21 -DS 1000 500 -1000 500 60 21 -$PAD -Sh "1" R 600 600 0 0 900 -Dr 400 0 0 -At STD N 00E0FFFF -Ne 20 "N-000024" -Po -500 0 -$EndPAD -$PAD -Sh "2" C 600 600 0 0 900 -Dr 400 0 0 -At STD N 00E0FFFF -Ne 7 "GND" -Po 500 0 -$EndPAD -$SHAPE3D -Na "pin_array/pins_array_2x1.wrl" -Sc 1.000000 1.000000 1.000000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE PIN_ARRAY_2X1 -$MODULE PIN_ARRAY_2X1 -Po 82400 32500 2700 15 47C51489 47BC01D2 ~P -Li PIN_ARRAY_2X1 -Cd Connecteurs 2 pins -Kw CONN DEV -Sc 47BC01D2 -AR /47BC01D2 -Op 0 0 0 -T0 0 -750 300 300 2700 60 N V 21 "P3" -T1 0 -750 300 300 2700 60 N I 21 "CONN_2" -DS -1000 500 -1000 -500 60 21 -DS -1000 -500 1000 -500 60 21 -DS 1000 -500 1000 500 60 21 -DS 1000 500 -1000 500 60 21 -$PAD -Sh "1" R 600 600 0 0 2700 -Dr 400 0 0 -At STD N 00E0FFFF -Ne 6 "VCC" -Po -500 0 -$EndPAD -$PAD -Sh "2" C 600 600 0 0 2700 -Dr 400 0 0 -At STD N 00E0FFFF -Ne 7 "GND" -Po 500 0 -$EndPAD -$SHAPE3D -Na "pin_array/pins_array_2x1.wrl" -Sc 1.000000 1.000000 1.000000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE PIN_ARRAY_2X1 -$MODULE PIN_ARRAY_2X1 -Po 68500 23500 900 15 4565C520 47A81846 ~P -Li PIN_ARRAY_2X1 -Cd Connecteurs 2 pins -Kw CONN DEV -Sc 47A81846 -AR /47A81846 -Op 0 0 0 -T0 0 -750 300 300 900 60 N V 21 "P4" -T1 0 -750 300 300 900 60 N I 21 "CONN_2" -DS -1000 500 -1000 -500 60 21 -DS -1000 -500 1000 -500 60 21 -DS 1000 -500 1000 500 60 21 -DS 1000 500 -1000 500 60 21 -$PAD -Sh "1" R 600 600 0 0 900 -Dr 400 0 0 -At STD N 00E0FFFF -Ne 27 "GNDPWR" -Po -500 0 -$EndPAD -$PAD -Sh "2" C 600 600 0 0 900 -Dr 400 0 0 -At STD N 00E0FFFF -Ne 44 "N-000012" -Po 500 0 -$EndPAD -$SHAPE3D -Na "pin_array/pins_array_2x1.wrl" -Sc 1.000000 1.000000 1.000000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE PIN_ARRAY_2X1 -$MODULE PIN_ARRAY_2X1 -Po 69000 30500 2700 15 4565C520 47BC01D9 ~P -Li PIN_ARRAY_2X1 -Cd Connecteurs 2 pins -Kw CONN DEV -Sc 47BC01D9 -AR /47BC01D9 -Op 0 0 0 -T0 0 -750 300 300 2700 60 N V 21 "P5" -T1 0 -750 300 300 2700 60 N I 21 "CONN_2" -DS -1000 500 -1000 -500 60 21 -DS -1000 -500 1000 -500 60 21 -DS 1000 -500 1000 500 60 21 -DS 1000 500 -1000 500 60 21 -$PAD -Sh "1" R 600 600 0 0 2700 -Dr 400 0 0 -At STD N 00E0FFFF -Ne 34 "+12V" -Po -500 0 -$EndPAD -$PAD -Sh "2" C 600 600 0 0 2700 -Dr 400 0 0 -At STD N 00E0FFFF -Ne 27 "GNDPWR" -Po 500 0 -$EndPAD -$SHAPE3D -Na "pin_array/pins_array_2x1.wrl" -Sc 1.000000 1.000000 1.000000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE PIN_ARRAY_2X1 -$MODULE pin_array_7x2 -Po 83500 43000 900 15 47C542E7 47BAEB8E ~~ -Li pin_array_7x2 -Cd Double rangee de contacts 2 x 8 pins -Kw CONN -Sc 47BAEB8E -AR /47BAEB8E -Op 0 0 0 -T0 0 -1300 400 400 900 80 N V 21 "P1" -T1 0 1300 400 400 900 80 N V 21 "CONN_14" -DS -3400 -950 3400 -950 120 21 -DS 3400 950 -3400 950 120 21 -DS -3400 900 -3400 -900 120 21 -DS 3400 -900 3400 900 120 21 -$PAD -Sh "1" R 600 600 0 0 900 -Dr 400 0 0 -At STD N 00E00001 -Ne 1 "/SPSet" -Po -3000 500 -$EndPAD -$PAD -Sh "2" C 600 600 0 0 900 -Dr 400 0 0 -At STD N 00E00001 -Ne 2 "/SPRead" -Po -3000 -500 -$EndPAD -$PAD -Sh "3" C 600 600 0 0 900 -Dr 400 0 0 -At STD N 00E00001 -Ne 21 "/XPoSet" -Po -2000 500 -$EndPAD -$PAD -Sh "4" C 600 600 0 0 900 -Dr 400 0 0 -At STD N 00E00001 -Ne 22 "/XPoRead" -Po -2000 -500 -$EndPAD -$PAD -Sh "5" C 600 600 0 0 900 -Dr 400 0 0 -At STD N 00E00001 -Ne 5 "/WPSet" -Po -1000 500 -$EndPAD -$PAD -Sh "6" C 600 600 0 0 900 -Dr 400 0 0 -At STD N 00E00001 -Ne 10 "/WPRead" -Po -1000 -500 -$EndPAD -$PAD -Sh "7" C 600 600 0 0 900 -Dr 400 0 0 -At STD N 00E00001 -Ne 11 "/HPSet" -Po 0 500 -$EndPAD -$PAD -Sh "8" C 600 600 0 0 900 -Dr 400 0 0 -At STD N 00E00001 -Ne 12 "/HPRead" -Po 0 -500 -$EndPAD -$PAD -Sh "9" C 600 600 0 0 900 -Dr 400 0 0 -At STD N 00E00001 -Ne 24 "/SDA" -Po 1000 500 -$EndPAD -$PAD -Sh "10" C 600 600 0 0 900 -Dr 400 0 0 -At STD N 00E00001 -Ne 25 "/SCL" -Po 1000 -500 -$EndPAD -$PAD -Sh "11" C 600 600 0 0 900 -Dr 400 0 0 -At STD N 00E00001 -Ne 0 "" -Po 2000 500 -$EndPAD -$PAD -Sh "12" C 600 600 0 0 900 -Dr 400 0 0 -At STD N 00E00001 -Ne 14 "/Reset" -Po 2000 -500 -$EndPAD -$PAD -Sh "13" C 600 600 0 0 900 -Dr 400 0 0 -At STD N 00E00001 -Ne 46 "/VccIN" -Po 3000 500 -$EndPAD -$PAD -Sh "14" C 600 600 0 0 900 -Dr 400 0 0 -At STD N 00E00001 -Ne 7 "GND" -Po 3000 -500 -$EndPAD -$SHAPE3D -Na "pin_array/pins_array_8x2.wrl" -Sc 1.000000 1.000000 1.000000 -Of 0.050000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE pin_array_7x2 -$MODULE SM0805 -Po 77500 40000 1800 0 42806E04 47BC03B6 ~P -Li SM0805 -Sc 47BC03B6 -AR /47BC03B6 -Op 0 0 0 -At SMD -T0 0 0 250 250 1800 50 M V 20 "C4" -T1 0 0 250 250 1800 50 M I 20 "33pF" -DC -650 -300 -650 -250 50 20 -DS -200 -300 -600 -300 50 20 -DS -600 -300 -600 300 50 20 -DS -600 300 -200 300 50 20 -DS 200 300 600 300 50 20 -DS 600 300 600 -300 50 20 -DS 600 -300 200 -300 50 20 -$PAD -Sh "1" R 350 550 0 0 1800 -Dr 0 0 0 -At SMD N 00440001 -Ne 7 "GND" -Po -375 0 -$EndPAD -$PAD -Sh "2" R 350 550 0 0 1800 -Dr 0 0 0 -At SMD N 00440001 -Ne 9 "N-000023" -Po 375 0 -$EndPAD -$SHAPE3D -Na "smd/chip_cms.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE SM0805 -$MODULE SM0805 -Po 77500 42000 1800 0 42806E04 47BC03AB ~P -Li SM0805 -Sc 47BC03AB -AR /47BC03AB -Op 0 0 0 -At SMD -T0 0 0 250 250 1800 50 M V 20 "C3" -T1 0 0 250 250 1800 50 M I 20 "33pF" -DC -650 -300 -650 -250 50 20 -DS -200 -300 -600 -300 50 20 -DS -600 -300 -600 300 50 20 -DS -600 300 -200 300 50 20 -DS 200 300 600 300 50 20 -DS 600 300 600 -300 50 20 -DS 600 -300 200 -300 50 20 -$PAD -Sh "1" R 350 550 0 0 1800 -Dr 0 0 0 -At SMD N 00440001 -Ne 7 "GND" -Po -375 0 -$EndPAD -$PAD -Sh "2" R 350 550 0 0 1800 -Dr 0 0 0 -At SMD N 00440001 -Ne 8 "N-000025" -Po 375 0 -$EndPAD -$SHAPE3D -Na "smd/chip_cms.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE SM0805 -$MODULE SM0805 -Po 67500 36500 2700 0 42806E04 47BACF0B ~P -Li SM0805 -Sc 47BACF0B -AR /47BACF0B -Op 0 0 0 -At SMD -T0 0 0 250 250 2700 50 M V 20 "R18" -T1 0 0 250 250 2700 50 M I 20 "2K" -DC -650 -300 -650 -250 50 20 -DS -200 -300 -600 -300 50 20 -DS -600 -300 -600 300 50 20 -DS -600 300 -200 300 50 20 -DS 200 300 600 300 50 20 -DS 600 300 600 -300 50 20 -DS 600 -300 200 -300 50 20 -$PAD -Sh "1" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 27 "GNDPWR" -Po -375 0 -$EndPAD -$PAD -Sh "2" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 38 "/HPOutToLine" -Po 375 0 -$EndPAD -$SHAPE3D -Na "smd/chip_cms.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE SM0805 -$MODULE SM0805 -Po 61000 50000 2700 0 42806E04 47A6EEF5 ~P -Li SM0805 -Sc 47A6EEF5 -AR /47A6EEF5 -Op 0 0 0 -At SMD -T0 0 0 250 250 2700 50 M V 20 "R9" -T1 0 0 250 250 2700 50 M I 20 "200" -DC -650 -300 -650 -250 50 20 -DS -200 -300 -600 -300 50 20 -DS -600 -300 -600 300 50 20 -DS -600 300 -200 300 50 20 -DS 200 300 600 300 50 20 -DS 600 300 600 -300 50 20 -DS 600 -300 200 -300 50 20 -$PAD -Sh "1" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 47 "N-000020" -Po -375 0 -$EndPAD -$PAD -Sh "2" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 6 "VCC" -Po 375 0 -$EndPAD -$SHAPE3D -Na "smd/chip_cms.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE SM0805 -$MODULE SM0805 -Po 67500 29500 2700 0 42806E04 47A81945 ~P -Li SM0805 -Sc 47A81945 -AR /47A81945 -Op 0 0 0 -At SMD -T0 0 0 250 250 2700 50 M V 20 "C5" -T1 0 0 250 250 2700 50 M I 20 "100nF" -DC -650 -300 -650 -250 50 20 -DS -200 -300 -600 -300 50 20 -DS -600 -300 -600 300 50 20 -DS -600 300 -200 300 50 20 -DS 200 300 600 300 50 20 -DS 600 300 600 -300 50 20 -DS 600 -300 200 -300 50 20 -$PAD -Sh "1" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 34 "+12V" -Po -375 0 -$EndPAD -$PAD -Sh "2" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 27 "GNDPWR" -Po 375 0 -$EndPAD -$SHAPE3D -Na "smd/chip_cms.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE SM0805 -$MODULE SM0805 -Po 64500 36500 2700 0 42806E04 47BACF38 ~P -Li SM0805 -Sc 47BACF38 -AR /47BACF38 -Op 0 0 0 -At SMD -T0 0 0 250 250 2700 50 M V 20 "R17" -T1 0 0 250 250 2700 50 M I 20 "2K" -DC -650 -300 -650 -250 50 20 -DS -200 -300 -600 -300 50 20 -DS -600 -300 -600 300 50 20 -DS -600 300 -200 300 50 20 -DS 200 300 600 300 50 20 -DS 600 300 600 -300 50 20 -DS 600 -300 200 -300 50 20 -$PAD -Sh "1" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 27 "GNDPWR" -Po -375 0 -$EndPAD -$PAD -Sh "2" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 39 "/XPOutToLine" -Po 375 0 -$EndPAD -$SHAPE3D -Na "smd/chip_cms.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE SM0805 -$MODULE SM0805 -Po 51800 35800 2700 0 42806E04 47A5B964 ~P -Li SM0805 -Sc 47A5B964 -AR /47A5B964 -Op 0 0 0 -At SMD -T0 0 0 250 250 2700 50 M V 20 "C7" -T1 0 0 250 250 2700 50 M I 20 "100pF" -DC -650 -300 -650 -250 50 20 -DS -200 -300 -600 -300 50 20 -DS -600 -300 -600 300 50 20 -DS -600 300 -200 300 50 20 -DS 200 300 600 300 50 20 -DS 600 300 600 -300 50 20 -DS 600 -300 200 -300 50 20 -$PAD -Sh "1" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 45 "/SPLine" -Po -375 0 -$EndPAD -$PAD -Sh "2" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 27 "GNDPWR" -Po 375 0 -$EndPAD -$SHAPE3D -Na "smd/chip_cms.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE SM0805 -$MODULE SM0805 -Po 56000 36000 1800 0 42806E04 47A728E5 ~P -Li SM0805 -Sc 47A728E5 -AR /47A728E5 -Op 0 0 0 -At SMD -T0 0 0 250 250 1800 50 M V 20 "C8" -T1 0 0 250 250 1800 50 M I 20 "100pF" -DC -650 -300 -650 -250 50 20 -DS -200 -300 -600 -300 50 20 -DS -600 -300 -600 300 50 20 -DS -600 300 -200 300 50 20 -DS 200 300 600 300 50 20 -DS 600 300 600 -300 50 20 -DS 600 -300 200 -300 50 20 -$PAD -Sh "1" R 350 550 0 0 1800 -Dr 0 0 0 -At SMD N 00440001 -Ne 40 "/WPLine" -Po -375 0 -$EndPAD -$PAD -Sh "2" R 350 550 0 0 1800 -Dr 0 0 0 -At SMD N 00440001 -Ne 27 "GNDPWR" -Po 375 0 -$EndPAD -$SHAPE3D -Na "smd/chip_cms.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE SM0805 -$MODULE SM0805 -Po 53000 50000 2700 0 42806E04 47A6EEC7 ~P -Li SM0805 -Sc 47A6EEC7 -AR /47A6EEC7 -Op 0 0 0 -At SMD -T0 0 0 250 250 2700 50 M V 20 "R1" -T1 0 0 250 250 2700 50 M I 20 "200" -DC -650 -300 -650 -250 50 20 -DS -200 -300 -600 -300 50 20 -DS -600 -300 -600 300 50 20 -DS -600 300 -200 300 50 20 -DS 200 300 600 300 50 20 -DS 600 300 600 -300 50 20 -DS 600 -300 200 -300 50 20 -$PAD -Sh "1" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 48 "N-000016" -Po -375 0 -$EndPAD -$PAD -Sh "2" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 6 "VCC" -Po 375 0 -$EndPAD -$SHAPE3D -Na "smd/chip_cms.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE SM0805 -$MODULE SM0805 -Po 54000 50000 2700 0 42806E04 47A6EECB ~P -Li SM0805 -Sc 47A6EECB -AR /47A6EECB -Op 0 0 0 -At SMD -T0 0 0 250 250 2700 50 M V 20 "R2" -T1 0 0 250 250 2700 50 M I 20 "330" -DC -650 -300 -650 -250 50 20 -DS -200 -300 -600 -300 50 20 -DS -600 -300 -600 300 50 20 -DS -600 300 -200 300 50 20 -DS 200 300 600 300 50 20 -DS 600 300 600 -300 50 20 -DS 600 -300 200 -300 50 20 -$PAD -Sh "1" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 49 "N-000007" -Po -375 0 -$EndPAD -$PAD -Sh "2" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 6 "VCC" -Po 375 0 -$EndPAD -$SHAPE3D -Na "smd/chip_cms.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE SM0805 -$MODULE SM0805 -Po 55000 50000 2700 0 42806E04 47A6EECE ~P -Li SM0805 -Sc 47A6EECE -AR /47A6EECE -Op 0 0 0 -At SMD -T0 0 0 250 250 2700 50 M V 20 "R3" -T1 0 0 250 250 2700 50 M I 20 "200" -DC -650 -300 -650 -250 50 20 -DS -200 -300 -600 -300 50 20 -DS -600 -300 -600 300 50 20 -DS -600 300 -200 300 50 20 -DS 200 300 600 300 50 20 -DS 600 300 600 -300 50 20 -DS 600 -300 200 -300 50 20 -$PAD -Sh "1" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 50 "N-000017" -Po -375 0 -$EndPAD -$PAD -Sh "2" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 6 "VCC" -Po 375 0 -$EndPAD -$SHAPE3D -Na "smd/chip_cms.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE SM0805 -$MODULE SM0805 -Po 56000 50000 2700 0 42806E04 47A6EED4 ~P -Li SM0805 -Sc 47A6EED4 -AR /47A6EED4 -Op 0 0 0 -At SMD -T0 0 0 250 250 2700 50 M V 20 "R4" -T1 0 0 250 250 2700 50 M I 20 "330" -DC -650 -300 -650 -250 50 20 -DS -200 -300 -600 -300 50 20 -DS -600 -300 -600 300 50 20 -DS -600 300 -200 300 50 20 -DS 200 300 600 300 50 20 -DS 600 300 600 -300 50 20 -DS 600 -300 200 -300 50 20 -$PAD -Sh "1" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 51 "N-000006" -Po -375 0 -$EndPAD -$PAD -Sh "2" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 6 "VCC" -Po 375 0 -$EndPAD -$SHAPE3D -Na "smd/chip_cms.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE SM0805 -$MODULE SM0805 -Po 57000 50000 2700 0 42806E04 47A6EEDA ~P -Li SM0805 -Sc 47A6EEDA -AR /47A6EEDA -Op 0 0 0 -At SMD -T0 0 0 250 250 2700 50 M V 20 "R5" -T1 0 0 250 250 2700 50 M I 20 "200" -DC -650 -300 -650 -250 50 20 -DS -200 -300 -600 -300 50 20 -DS -600 -300 -600 300 50 20 -DS -600 300 -200 300 50 20 -DS 200 300 600 300 50 20 -DS 600 300 600 -300 50 20 -DS 600 -300 200 -300 50 20 -$PAD -Sh "1" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 52 "N-000018" -Po -375 0 -$EndPAD -$PAD -Sh "2" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 6 "VCC" -Po 375 0 -$EndPAD -$SHAPE3D -Na "smd/chip_cms.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE SM0805 -$MODULE SM0805 -Po 58000 50000 2700 0 42806E04 47A6EEDE ~P -Li SM0805 -Sc 47A6EEDE -AR /47A6EEDE -Op 0 0 0 -At SMD -T0 0 0 250 250 2700 50 M V 20 "R6" -T1 0 0 250 250 2700 50 M I 20 "330" -DC -650 -300 -650 -250 50 20 -DS -200 -300 -600 -300 50 20 -DS -600 -300 -600 300 50 20 -DS -600 300 -200 300 50 20 -DS 200 300 600 300 50 20 -DS 600 300 600 -300 50 20 -DS 600 -300 200 -300 50 20 -$PAD -Sh "1" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 53 "N-000005" -Po -375 0 -$EndPAD -$PAD -Sh "2" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 6 "VCC" -Po 375 0 -$EndPAD -$SHAPE3D -Na "smd/chip_cms.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE SM0805 -$MODULE SM0805 -Po 59000 50000 2700 0 42806E04 47A6EEED ~P -Li SM0805 -Sc 47A6EEED -AR /47A6EEED -Op 0 0 0 -At SMD -T0 0 0 250 250 2700 50 M V 20 "R7" -T1 0 0 250 250 2700 50 M I 20 "330" -DC -650 -300 -650 -250 50 20 -DS -200 -300 -600 -300 50 20 -DS -600 -300 -600 300 50 20 -DS -600 300 -200 300 50 20 -DS 200 300 600 300 50 20 -DS 600 300 600 -300 50 20 -DS 600 -300 200 -300 50 20 -$PAD -Sh "1" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 54 "N-000019" -Po -375 0 -$EndPAD -$PAD -Sh "2" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 6 "VCC" -Po 375 0 -$EndPAD -$SHAPE3D -Na "smd/chip_cms.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE SM0805 -$MODULE SM0805 -Po 60000 50000 2700 0 42806E04 47A6EEF2 ~P -Li SM0805 -Sc 47A6EEF2 -AR /47A6EEF2 -Op 0 0 0 -At SMD -T0 0 0 250 250 2700 50 M V 20 "R8" -T1 0 0 250 250 2700 50 M I 20 "200" -DC -650 -300 -650 -250 50 20 -DS -200 -300 -600 -300 50 20 -DS -600 -300 -600 300 50 20 -DS -600 300 -200 300 50 20 -DS 200 300 600 300 50 20 -DS 600 300 600 -300 50 20 -DS 600 -300 200 -300 50 20 -$PAD -Sh "1" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 55 "N-000004" -Po -375 0 -$EndPAD -$PAD -Sh "2" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 6 "VCC" -Po 375 0 -$EndPAD -$SHAPE3D -Na "smd/chip_cms.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE SM0805 -$MODULE SM0805 -Po 82200 30400 2700 0 42806E04 47A7FA60 ~P -Li SM0805 -Sc 47A7FA60 -AR /47A7FA60 -Op 0 0 0 -At SMD -T0 0 0 250 250 2700 50 M V 20 "C1" -T1 0 0 250 250 2700 50 M I 20 "100nF" -DC -650 -300 -650 -250 50 20 -DS -200 -300 -600 -300 50 20 -DS -600 -300 -600 300 50 20 -DS -600 300 -200 300 50 20 -DS 200 300 600 300 50 20 -DS 600 300 600 -300 50 20 -DS 600 -300 200 -300 50 20 -$PAD -Sh "1" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 6 "VCC" -Po -375 0 -$EndPAD -$PAD -Sh "2" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 7 "GND" -Po 375 0 -$EndPAD -$SHAPE3D -Na "smd/chip_cms.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE SM0805 -$MODULE SM0805 -Po 62000 50000 2700 0 42806E04 47A6EEF8 ~P -Li SM0805 -Sc 47A6EEF8 -AR /47A6EEF8 -Op 0 0 0 -At SMD -T0 0 0 250 250 2700 50 M V 20 "R10" -T1 0 0 250 250 2700 50 M I 20 "330" -DC -650 -300 -650 -250 50 20 -DS -200 -300 -600 -300 50 20 -DS -600 -300 -600 300 50 20 -DS -600 300 -200 300 50 20 -DS 200 300 600 300 50 20 -DS 600 300 600 -300 50 20 -DS 600 -300 200 -300 50 20 -$PAD -Sh "1" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 56 "N-000003" -Po -375 0 -$EndPAD -$PAD -Sh "2" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 6 "VCC" -Po 375 0 -$EndPAD -$SHAPE3D -Na "smd/chip_cms.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE SM0805 -$MODULE SM0805 -Po 53800 38400 1800 0 42806E04 47BAEAF8 ~P -Li SM0805 -Sc 47BAEAF8 -AR /47BAEAF8 -Op 0 0 0 -At SMD -T0 0 0 250 250 1800 50 M V 20 "R11" -T1 0 0 250 250 1800 50 M I 20 "330" -DC -650 -300 -650 -250 50 20 -DS -200 -300 -600 -300 50 20 -DS -600 -300 -600 300 50 20 -DS -600 300 -200 300 50 20 -DS 200 300 600 300 50 20 -DS 600 300 600 -300 50 20 -DS 600 -300 200 -300 50 20 -$PAD -Sh "1" R 350 550 0 0 1800 -Dr 0 0 0 -At SMD N 00440001 -Ne 34 "+12V" -Po -375 0 -$EndPAD -$PAD -Sh "2" R 350 550 0 0 1800 -Dr 0 0 0 -At SMD N 00440001 -Ne 29 "/SPLinePWR" -Po 375 0 -$EndPAD -$SHAPE3D -Na "smd/chip_cms.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE SM0805 -$MODULE SM0805 -Po 50500 38000 2700 0 42806E04 47BAEAF9 ~P -Li SM0805 -Sc 47BAEAF9 -AR /47BAEAF9 -Op 0 0 0 -At SMD -T0 0 0 250 250 2700 50 M V 20 "R12" -T1 0 0 250 250 2700 50 M I 20 "330" -DC -650 -300 -650 -250 50 20 -DS -200 -300 -600 -300 50 20 -DS -600 -300 -600 300 50 20 -DS -600 300 -200 300 50 20 -DS 200 300 600 300 50 20 -DS 600 300 600 -300 50 20 -DS 600 -300 200 -300 50 20 -$PAD -Sh "1" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 34 "+12V" -Po -375 0 -$EndPAD -$PAD -Sh "2" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 30 "/WPLinePWR" -Po 375 0 -$EndPAD -$SHAPE3D -Na "smd/chip_cms.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE SM0805 -$MODULE SM0805 -Po 55000 36500 2700 0 42806E04 47BAEB00 ~P -Li SM0805 -Sc 47BAEB00 -AR /47BAEB00 -Op 0 0 0 -At SMD -T0 0 0 250 250 2700 50 M V 20 "R13" -T1 0 0 250 250 2700 50 M I 20 "2K" -DC -650 -300 -650 -250 50 20 -DS -200 -300 -600 -300 50 20 -DS -600 -300 -600 300 50 20 -DS -600 300 -200 300 50 20 -DS 200 300 600 300 50 20 -DS 600 300 600 -300 50 20 -DS 600 -300 200 -300 50 20 -$PAD -Sh "1" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 27 "GNDPWR" -Po -375 0 -$EndPAD -$PAD -Sh "2" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 35 "/SPOutToLine" -Po 375 0 -$EndPAD -$SHAPE3D -Na "smd/chip_cms.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE SM0805 -$MODULE SM0805 -Po 58000 36500 2700 0 42806E04 47BAEAFF ~P -Li SM0805 -Sc 47BAEAFF -AR /47BAEAFF -Op 0 0 0 -At SMD -T0 0 0 250 250 2700 50 M V 20 "R14" -T1 0 0 250 250 2700 50 M I 20 "2K" -DC -650 -300 -650 -250 50 20 -DS -200 -300 -600 -300 50 20 -DS -600 -300 -600 300 50 20 -DS -600 300 -200 300 50 20 -DS 200 300 600 300 50 20 -DS 600 300 600 -300 50 20 -DS 600 -300 200 -300 50 20 -$PAD -Sh "1" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 27 "GNDPWR" -Po -375 0 -$EndPAD -$PAD -Sh "2" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 33 "/WPOutToLine" -Po 375 0 -$EndPAD -$SHAPE3D -Na "smd/chip_cms.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE SM0805 -$MODULE SM0805 -Po 62800 38600 1800 0 42806E04 47A5AF30 ~P -Li SM0805 -Sc 47A5AF30 -AR /47A5AF30 -Op 0 0 0 -At SMD -T0 0 0 250 250 1800 50 M V 20 "R15" -T1 0 0 250 250 1800 50 M I 20 "330" -DC -650 -300 -650 -250 50 20 -DS -200 -300 -600 -300 50 20 -DS -600 -300 -600 300 50 20 -DS -600 300 -200 300 50 20 -DS 200 300 600 300 50 20 -DS 600 300 600 -300 50 20 -DS 600 -300 200 -300 50 20 -$PAD -Sh "1" R 350 550 0 0 1800 -Dr 0 0 0 -At SMD N 00440001 -Ne 34 "+12V" -Po -375 0 -$EndPAD -$PAD -Sh "2" R 350 550 0 0 1800 -Dr 0 0 0 -At SMD N 00440001 -Ne 26 "/XPLinePWR" -Po 375 0 -$EndPAD -$SHAPE3D -Na "smd/chip_cms.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE SM0805 -$MODULE SM0805 -Po 59500 38000 2700 0 42806E04 47A728CD ~P -Li SM0805 -Sc 47A728CD -AR /47A728CD -Op 0 0 0 -At SMD -T0 0 0 250 250 2700 50 M V 20 "R16" -T1 0 0 250 250 2700 50 M I 20 "330" -DC -650 -300 -650 -250 50 20 -DS -200 -300 -600 -300 50 20 -DS -600 -300 -600 300 50 20 -DS -600 300 -200 300 50 20 -DS 200 300 600 300 50 20 -DS 600 300 600 -300 50 20 -DS 600 -300 200 -300 50 20 -$PAD -Sh "1" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 34 "+12V" -Po -375 0 -$EndPAD -$PAD -Sh "2" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 28 "/HPLinePWR" -Po 375 0 -$EndPAD -$SHAPE3D -Na "smd/chip_cms.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE SM0805 -$MODULE SM0805 -Po 67200 35400 0 0 42806E04 47A80CF9 ~P -Li SM0805 -Sc 47A80CF9 -AR /47A80CF9 -Op 0 0 0 -At SMD -T0 0 0 250 250 0 50 M V 20 "C10" -T1 0 0 250 250 0 50 M I 20 "100pF" -DC -650 -300 -650 -250 50 20 -DS -200 -300 -600 -300 50 20 -DS -600 -300 -600 300 50 20 -DS -600 300 -200 300 50 20 -DS 200 300 600 300 50 20 -DS 600 300 600 -300 50 20 -DS 600 -300 200 -300 50 20 -$PAD -Sh "1" R 350 550 0 0 0 -Dr 0 0 0 -At SMD N 00440001 -Ne 41 "/HPLine" -Po -375 0 -$EndPAD -$PAD -Sh "2" R 350 550 0 0 0 -Dr 0 0 0 -At SMD N 00440001 -Ne 27 "GNDPWR" -Po 375 0 -$EndPAD -$SHAPE3D -Na "smd/chip_cms.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE SM0805 -$MODULE SM0805 -Po 61000 36200 2700 0 42806E04 47A80CF1 ~P -Li SM0805 -Sc 47A80CF1 -AR /47A80CF1 -Op 0 0 0 -At SMD -T0 0 0 250 250 2700 50 M V 20 "C9" -T1 0 0 250 250 2700 50 M I 20 "100pF" -DC -650 -300 -650 -250 50 20 -DS -200 -300 -600 -300 50 20 -DS -600 -300 -600 300 50 20 -DS -600 300 -200 300 50 20 -DS 200 300 600 300 50 20 -DS 600 300 600 -300 50 20 -DS 600 -300 200 -300 50 20 -$PAD -Sh "1" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 42 "/XPLine" -Po -375 0 -$EndPAD -$PAD -Sh "2" R 350 550 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 27 "GNDPWR" -Po 375 0 -$EndPAD -$SHAPE3D -Na "smd/chip_cms.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE SM0805 -$MODULE DC-7G3HWA -Po 57500 47500 0 15 47B45E84 47BAEE3B ~P -Li DC-7G3HWA -Cd Module Dil 20 pins, pads ronds -Kw DIL -Sc 47BAEE3B -AR /47BAEE3B -Op 0 0 0 -T0 -3500 -500 700 450 0 120 N V 21 "U1" -T1 2500 500 700 450 0 120 N V 21 "LED10SEG" -DS -5500 -500 -5000 -500 150 21 -DS -5000 -500 -5000 500 150 21 -DS -5000 500 -5500 500 150 21 -DS -5500 -1000 5500 -1000 150 21 -DS 5500 -1000 5500 1000 150 21 -DS 5500 1000 -5500 1000 150 21 -DS -5500 1000 -5500 -1000 150 21 -$PAD -Sh "1" R 550 550 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 48 "N-000016" -Po -4500 1500 -$EndPAD -$PAD -Sh "2" C 550 550 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 49 "N-000007" -Po -3500 1500 -$EndPAD -$PAD -Sh "3" C 550 550 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 50 "N-000017" -Po -2500 1500 -$EndPAD -$PAD -Sh "4" C 550 550 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 51 "N-000006" -Po -1500 1500 -$EndPAD -$PAD -Sh "5" C 550 550 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 52 "N-000018" -Po -500 1500 -$EndPAD -$PAD -Sh "6" C 550 550 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 53 "N-000005" -Po 500 1500 -$EndPAD -$PAD -Sh "7" C 550 550 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 54 "N-000019" -Po 1500 1500 -$EndPAD -$PAD -Sh "8" C 550 550 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 55 "N-000004" -Po 2500 1500 -$EndPAD -$PAD -Sh "9" C 550 550 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 47 "N-000020" -Po 3500 1500 -$EndPAD -$PAD -Sh "10" C 550 550 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 56 "N-000003" -Po 4500 1500 -$EndPAD -$PAD -Sh "11" C 550 550 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 19 "/HPoRead" -Po 4500 -1500 -$EndPAD -$PAD -Sh "12" C 550 550 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 37 "/HPlSet" -Po 3500 -1500 -$EndPAD -$PAD -Sh "13" C 550 550 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 23 "/TESTLED" -Po 2500 -1500 -$EndPAD -$PAD -Sh "14" C 550 550 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 7 "GND" -Po 1500 -1500 -$EndPAD -$PAD -Sh "15" C 550 550 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 22 "/XPoRead" -Po 500 -1500 -$EndPAD -$PAD -Sh "16" C 550 550 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 36 "/XPlSet" -Po -500 -1500 -$EndPAD -$PAD -Sh "17" C 550 550 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 17 "/WPoRead" -Po -1500 -1500 -$EndPAD -$PAD -Sh "18" C 550 550 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 32 "/WPlSet" -Po -2500 -1500 -$EndPAD -$PAD -Sh "19" C 550 550 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 15 "/SPoRead" -Po -3500 -1500 -$EndPAD -$PAD -Sh "20" C 550 550 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 31 "/SPlSet" -Po -4500 -1500 -$EndPAD -$SHAPE3D -Na "dc7g3hwa-te.wrl" -Sc 3.950000 3.950000 3.950000 -Of -0.450000 -0.150000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE DC-7G3HWA -$MODULE LM78LXX -Po 69000 28000 0 15 47C42901 47A81831 ~P -Li LM78LXX -Cd Regulateur TO92 serie LM78Lxx -Kw TR TO92 -Sc 47A81831 -AR /47A81831 -Op 0 0 0 -T0 -750 1500 400 400 0 80 N V 21 "U2" -T1 -500 -2000 400 400 0 80 N V 21 "LM7812" -DS -500 1000 1000 -500 120 21 -DS 1000 -500 1000 -1000 120 21 -DS 1000 -1000 500 -1500 120 21 -DS 500 -1500 -500 -1500 120 21 -DS -500 -1500 -1500 -500 120 21 -DS -1500 -500 -1500 500 120 21 -DS -1500 500 -1000 1000 120 21 -DS -1000 1000 -500 1000 120 21 -$PAD -Sh "VI" C 550 550 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 44 "N-000012" -Po 500 -500 -$EndPAD -$PAD -Sh "GND" R 550 550 0 0 0 -Dr 320 0 0 -At STD N 00E0FFFF -Ne 27 "GNDPWR" -Po -500 -500 -$EndPAD -$PAD -Sh "VO" C 550 550 0 0 0 -Dr 320 0 0 -At HOLE N 00F0FFFF -Ne 34 "+12V" -Po -500 500 -$EndPAD -$SHAPE3D -Na "discret/to98.wrl" -Sc 1.000000 1.000000 1.000000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 0.000000 -$EndSHAPE3D -$EndMODULE LM78LXX -$MODULE irlml2803 -Po 66200 36200 900 0 00200000 47AADEA8 ~P -Li irlml2803 -Cd SOT-23 -Kw SOT-23 -Sc 47AADEA8 -AR /47AADEA8 -Op 0 0 0 -At SMD -T0 500 -1000 500 500 900 35 M V 20 "Q8" -T1 750 1000 500 500 900 35 M V 20 "IRLML2803" -DS -90 280 90 280 26 20 -DS 90 280 90 509 26 20 -DS -90 509 90 509 26 20 -DS -90 280 -90 509 26 20 -DS 280 -509 460 -509 26 20 -DS 460 -509 460 -280 26 20 -DS 280 -280 460 -280 26 20 -DS 280 -509 280 -280 26 20 -DS -460 -509 -280 -509 26 20 -DS -280 -509 -280 -280 26 20 -DS -460 -280 -280 -280 26 20 -DS -460 -509 -460 -280 26 20 -DS 560 260 560 -260 60 20 -DS 560 -260 -560 -260 60 20 -DS -560 -260 -560 260 60 20 -DS -560 260 560 260 60 20 -$PAD -Sh "1" R 393 551 0 0 900 -Dr 0 0 0 -At SMD N 00440001 -Ne 38 "/HPOutToLine" -Po -374 -433 -$EndPAD -$PAD -Sh "2" R 393 551 0 0 900 -Dr 0 0 0 -At SMD N 00440001 -Ne 27 "GNDPWR" -Po 374 -433 -$EndPAD -$PAD -Sh "3" R 393 551 0 0 900 -Dr 0 0 0 -At SMD N 00440001 -Ne 41 "/HPLine" -Po 0 433 -$EndPAD -$SHAPE3D -Na "smd/cms_sot23.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 180.000000 -$EndSHAPE3D -$EndMODULE irlml2803 -$MODULE irlml2803 -Po 53400 37200 0 0 00200000 47AADEB5 ~P -Li irlml2803 -Cd SOT-23 -Kw SOT-23 -Sc 47AADEB5 -AR /47AADEB5 -Op 0 0 0 -At SMD -T0 500 -1000 500 500 0 35 M V 20 "Q1" -T1 750 1000 500 500 0 35 M V 20 "IRLML2803" -DS -90 280 90 280 26 20 -DS 90 280 90 509 26 20 -DS -90 509 90 509 26 20 -DS -90 280 -90 509 26 20 -DS 280 -509 460 -509 26 20 -DS 460 -509 460 -280 26 20 -DS 280 -280 460 -280 26 20 -DS 280 -509 280 -280 26 20 -DS -460 -509 -280 -509 26 20 -DS -280 -509 -280 -280 26 20 -DS -460 -280 -280 -280 26 20 -DS -460 -509 -460 -280 26 20 -DS 560 260 560 -260 60 20 -DS 560 -260 -560 -260 60 20 -DS -560 -260 -560 260 60 20 -DS -560 260 560 260 60 20 -$PAD -Sh "1" R 393 551 0 0 0 -Dr 0 0 0 -At SMD N 00440001 -Ne 45 "/SPLine" -Po -374 -433 -$EndPAD -$PAD -Sh "2" R 393 551 0 0 0 -Dr 0 0 0 -At SMD N 00440001 -Ne 27 "GNDPWR" -Po 374 -433 -$EndPAD -$PAD -Sh "3" R 393 551 0 0 0 -Dr 0 0 0 -At SMD N 00440001 -Ne 29 "/SPLinePWR" -Po 0 433 -$EndPAD -$SHAPE3D -Na "smd/cms_sot23.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 180.000000 -$EndSHAPE3D -$EndMODULE irlml2803 -$MODULE irlml2803 -Po 51500 38000 0 0 00200000 47AADEBD ~P -Li irlml2803 -Cd SOT-23 -Kw SOT-23 -Sc 47AADEBD -AR /47AADEBD -Op 0 0 0 -At SMD -T0 500 -1000 500 500 0 35 M V 20 "Q2" -T1 750 1000 500 500 0 35 M V 20 "IRLML2803" -DS -90 280 90 280 26 20 -DS 90 280 90 509 26 20 -DS -90 509 90 509 26 20 -DS -90 280 -90 509 26 20 -DS 280 -509 460 -509 26 20 -DS 460 -509 460 -280 26 20 -DS 280 -280 460 -280 26 20 -DS 280 -509 280 -280 26 20 -DS -460 -509 -280 -509 26 20 -DS -280 -509 -280 -280 26 20 -DS -460 -280 -280 -280 26 20 -DS -460 -509 -460 -280 26 20 -DS 560 260 560 -260 60 20 -DS 560 -260 -560 -260 60 20 -DS -560 -260 -560 260 60 20 -DS -560 260 560 260 60 20 -$PAD -Sh "1" R 393 551 0 0 0 -Dr 0 0 0 -At SMD N 00440001 -Ne 40 "/WPLine" -Po -374 -433 -$EndPAD -$PAD -Sh "2" R 393 551 0 0 0 -Dr 0 0 0 -At SMD N 00440001 -Ne 27 "GNDPWR" -Po 374 -433 -$EndPAD -$PAD -Sh "3" R 393 551 0 0 0 -Dr 0 0 0 -At SMD N 00440001 -Ne 30 "/WPLinePWR" -Po 0 433 -$EndPAD -$SHAPE3D -Na "smd/cms_sot23.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 180.000000 -$EndSHAPE3D -$EndMODULE irlml2803 -$MODULE irlml2803 -Po 62400 37400 0 0 00200000 47AADEC1 ~P -Li irlml2803 -Cd SOT-23 -Kw SOT-23 -Sc 47AADEC1 -AR /47AADEC1 -Op 0 0 0 -At SMD -T0 500 -1000 500 500 0 35 M V 20 "Q3" -T1 750 1000 500 500 0 35 M V 20 "IRLML2803" -DS -90 280 90 280 26 20 -DS 90 280 90 509 26 20 -DS -90 509 90 509 26 20 -DS -90 280 -90 509 26 20 -DS 280 -509 460 -509 26 20 -DS 460 -509 460 -280 26 20 -DS 280 -280 460 -280 26 20 -DS 280 -509 280 -280 26 20 -DS -460 -509 -280 -509 26 20 -DS -280 -509 -280 -280 26 20 -DS -460 -280 -280 -280 26 20 -DS -460 -509 -460 -280 26 20 -DS 560 260 560 -260 60 20 -DS 560 -260 -560 -260 60 20 -DS -560 -260 -560 260 60 20 -DS -560 260 560 260 60 20 -$PAD -Sh "1" R 393 551 0 0 0 -Dr 0 0 0 -At SMD N 00440001 -Ne 42 "/XPLine" -Po -374 -433 -$EndPAD -$PAD -Sh "2" R 393 551 0 0 0 -Dr 0 0 0 -At SMD N 00440001 -Ne 27 "GNDPWR" -Po 374 -433 -$EndPAD -$PAD -Sh "3" R 393 551 0 0 0 -Dr 0 0 0 -At SMD N 00440001 -Ne 26 "/XPLinePWR" -Po 0 433 -$EndPAD -$SHAPE3D -Na "smd/cms_sot23.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 180.000000 -$EndSHAPE3D -$EndMODULE irlml2803 -$MODULE irlml2803 -Po 60600 38000 0 0 00200000 47AADEC6 ~P -Li irlml2803 -Cd SOT-23 -Kw SOT-23 -Sc 47AADEC6 -AR /47AADEC6 -Op 0 0 0 -At SMD -T0 500 -1000 500 500 0 35 M V 20 "Q4" -T1 750 1000 500 500 0 35 M V 20 "IRLML2803" -DS -90 280 90 280 26 20 -DS 90 280 90 509 26 20 -DS -90 509 90 509 26 20 -DS -90 280 -90 509 26 20 -DS 280 -509 460 -509 26 20 -DS 460 -509 460 -280 26 20 -DS 280 -280 460 -280 26 20 -DS 280 -509 280 -280 26 20 -DS -460 -509 -280 -509 26 20 -DS -280 -509 -280 -280 26 20 -DS -460 -280 -280 -280 26 20 -DS -460 -509 -460 -280 26 20 -DS 560 260 560 -260 60 20 -DS 560 -260 -560 -260 60 20 -DS -560 -260 -560 260 60 20 -DS -560 260 560 260 60 20 -$PAD -Sh "1" R 393 551 0 0 0 -Dr 0 0 0 -At SMD N 00440001 -Ne 41 "/HPLine" -Po -374 -433 -$EndPAD -$PAD -Sh "2" R 393 551 0 0 0 -Dr 0 0 0 -At SMD N 00440001 -Ne 27 "GNDPWR" -Po 374 -433 -$EndPAD -$PAD -Sh "3" R 393 551 0 0 0 -Dr 0 0 0 -At SMD N 00440001 -Ne 28 "/HPLinePWR" -Po 0 433 -$EndPAD -$SHAPE3D -Na "smd/cms_sot23.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 180.000000 -$EndSHAPE3D -$EndMODULE irlml2803 -$MODULE irlml2803 -Po 53200 35600 2700 0 00200000 47AADEB1 ~P -Li irlml2803 -Cd SOT-23 -Kw SOT-23 -Sc 47AADEB1 -AR /47AADEB1 -Op 0 0 0 -At SMD -T0 500 -1000 500 500 2700 35 M V 20 "Q5" -T1 750 1000 500 500 2700 35 M V 20 "IRLML2803" -DS -90 280 90 280 26 20 -DS 90 280 90 509 26 20 -DS -90 509 90 509 26 20 -DS -90 280 -90 509 26 20 -DS 280 -509 460 -509 26 20 -DS 460 -509 460 -280 26 20 -DS 280 -280 460 -280 26 20 -DS 280 -509 280 -280 26 20 -DS -460 -509 -280 -509 26 20 -DS -280 -509 -280 -280 26 20 -DS -460 -280 -280 -280 26 20 -DS -460 -509 -460 -280 26 20 -DS 560 260 560 -260 60 20 -DS 560 -260 -560 -260 60 20 -DS -560 -260 -560 260 60 20 -DS -560 260 560 260 60 20 -$PAD -Sh "1" R 393 551 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 35 "/SPOutToLine" -Po -374 -433 -$EndPAD -$PAD -Sh "2" R 393 551 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 27 "GNDPWR" -Po 374 -433 -$EndPAD -$PAD -Sh "3" R 393 551 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 45 "/SPLine" -Po 0 433 -$EndPAD -$SHAPE3D -Na "smd/cms_sot23.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 180.000000 -$EndSHAPE3D -$EndMODULE irlml2803 -$MODULE irlml2803 -Po 57000 36500 1800 0 00200000 47AADEAE ~P -Li irlml2803 -Cd SOT-23 -Kw SOT-23 -Sc 47AADEAE -AR /47AADEAE -Op 0 0 0 -At SMD -T0 500 -1000 500 500 1800 35 M V 20 "Q6" -T1 750 1000 500 500 1800 35 M V 20 "IRLML2803" -DS -90 280 90 280 26 20 -DS 90 280 90 509 26 20 -DS -90 509 90 509 26 20 -DS -90 280 -90 509 26 20 -DS 280 -509 460 -509 26 20 -DS 460 -509 460 -280 26 20 -DS 280 -280 460 -280 26 20 -DS 280 -509 280 -280 26 20 -DS -460 -509 -280 -509 26 20 -DS -280 -509 -280 -280 26 20 -DS -460 -280 -280 -280 26 20 -DS -460 -509 -460 -280 26 20 -DS 560 260 560 -260 60 20 -DS 560 -260 -560 -260 60 20 -DS -560 -260 -560 260 60 20 -DS -560 260 560 260 60 20 -$PAD -Sh "1" R 393 551 0 0 1800 -Dr 0 0 0 -At SMD N 00440001 -Ne 33 "/WPOutToLine" -Po -374 -433 -$EndPAD -$PAD -Sh "2" R 393 551 0 0 1800 -Dr 0 0 0 -At SMD N 00440001 -Ne 27 "GNDPWR" -Po 374 -433 -$EndPAD -$PAD -Sh "3" R 393 551 0 0 1800 -Dr 0 0 0 -At SMD N 00440001 -Ne 40 "/WPLine" -Po 0 433 -$EndPAD -$SHAPE3D -Na "smd/cms_sot23.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 180.000000 -$EndSHAPE3D -$EndMODULE irlml2803 -$MODULE irlml2803 -Po 62400 35800 2700 0 00200000 47AADEAB ~P -Li irlml2803 -Cd SOT-23 -Kw SOT-23 -Sc 47AADEAB -AR /47AADEAB -Op 0 0 0 -At SMD -T0 500 -1000 500 500 2700 35 M V 20 "Q7" -T1 750 1000 500 500 2700 35 M V 20 "IRLML2803" -DS -90 280 90 280 26 20 -DS 90 280 90 509 26 20 -DS -90 509 90 509 26 20 -DS -90 280 -90 509 26 20 -DS 280 -509 460 -509 26 20 -DS 460 -509 460 -280 26 20 -DS 280 -280 460 -280 26 20 -DS 280 -509 280 -280 26 20 -DS -460 -509 -280 -509 26 20 -DS -280 -509 -280 -280 26 20 -DS -460 -280 -280 -280 26 20 -DS -460 -509 -460 -280 26 20 -DS 560 260 560 -260 60 20 -DS 560 -260 -560 -260 60 20 -DS -560 -260 -560 260 60 20 -DS -560 260 560 260 60 20 -$PAD -Sh "1" R 393 551 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 39 "/XPOutToLine" -Po -374 -433 -$EndPAD -$PAD -Sh "2" R 393 551 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 27 "GNDPWR" -Po 374 -433 -$EndPAD -$PAD -Sh "3" R 393 551 0 0 2700 -Dr 0 0 0 -At SMD N 00440001 -Ne 42 "/XPLine" -Po 0 433 -$EndPAD -$SHAPE3D -Na "smd/cms_sot23.wrl" -Sc 0.100000 0.100000 0.100000 -Of 0.000000 0.000000 0.000000 -Ro 0.000000 0.000000 180.000000 -$EndSHAPE3D -$EndMODULE irlml2803 -$MODULE myhole-1 -Po 84500 51000 0 15 47FB25E3 47FB241C ~~ -Li myhole-1 -Cd MOUNTING PAD 3.6 MM, SQUARE -Kw MOUNTING PAD 3.6 MM, SQUARE -Sc 47FB241C -AR /47FB241C -Op 0 0 0 -At VIRTUAL -T0 0 0 400 400 0 120 N V 21 "MH4" -T1 0 0 400 400 0 120 N V 21 "MTHOLE" -DS 1350 0 1150 0 20 21 -DS 0 -1350 0 -1150 20 21 -DS -1150 0 -1350 0 20 21 -DS 0 1150 0 1350 20 21 -DS -1500 -1500 1500 -1500 590 21 -DS 1500 -1500 1500 1500 590 21 -DS 1500 1500 -1500 1500 590 21 -DS -1500 1500 -1500 -1500 590 21 -DS -1500 -1500 1500 -1500 590 21 -DS 1500 -1500 1500 1500 590 21 -DS 1500 1500 -1500 1500 590 21 -DS -1500 1500 -1500 -1500 590 21 -DS -1500 -1500 1500 -1500 590 21 -DS 1500 -1500 1500 1500 590 21 -DS 1500 1500 -1500 1500 590 21 -DS -1500 1500 -1500 -1500 590 21 -DS -1500 -1500 1500 -1500 590 21 -DS 1500 -1500 1500 1500 590 21 -DS 1500 1500 -1500 1500 590 21 -DS -1500 1500 -1500 -1500 590 21 -DS -1500 -1500 1500 -1500 590 21 -DS 1500 -1500 1500 1500 590 21 -DS 1500 1500 -1500 1500 590 21 -DS -1500 1500 -1500 -1500 590 21 -DS -1400 -1400 1400 -1400 80 21 -DS 1400 -1400 1400 1400 80 21 -DS 1400 1400 -1400 1400 80 21 -DS -1400 1400 -1400 -1400 80 21 -DC 0 0 -150 150 90 21 -DC 0 0 -374 374 40 21 -DA 0 0 0 850 4500 980 21 -DA 0 0 0 -850 4500 980 21 -$PAD -Sh "1" C 2500 2500 0 0 0 -Dr 1180 0 0 -At STD N 00A8FFFF -Ne 0 "" -Po 0 0 -$EndPAD -$EndMODULE myhole-1 -$MODULE myhole-1 -Po 50500 23500 0 15 47FB25E3 47FB241F ~~ -Li myhole-1 -Cd MOUNTING PAD 3.6 MM, SQUARE -Kw MOUNTING PAD 3.6 MM, SQUARE -Sc 47FB241F -AR /47FB241F -Op 0 0 0 -At VIRTUAL -T0 0 0 400 400 0 120 N V 21 "MH2" -T1 0 0 400 400 0 120 N V 21 "MTHOLE" -DS 1350 0 1150 0 20 21 -DS 0 -1350 0 -1150 20 21 -DS -1150 0 -1350 0 20 21 -DS 0 1150 0 1350 20 21 -DS -1500 -1500 1500 -1500 590 21 -DS 1500 -1500 1500 1500 590 21 -DS 1500 1500 -1500 1500 590 21 -DS -1500 1500 -1500 -1500 590 21 -DS -1500 -1500 1500 -1500 590 21 -DS 1500 -1500 1500 1500 590 21 -DS 1500 1500 -1500 1500 590 21 -DS -1500 1500 -1500 -1500 590 21 -DS -1500 -1500 1500 -1500 590 21 -DS 1500 -1500 1500 1500 590 21 -DS 1500 1500 -1500 1500 590 21 -DS -1500 1500 -1500 -1500 590 21 -DS -1500 -1500 1500 -1500 590 21 -DS 1500 -1500 1500 1500 590 21 -DS 1500 1500 -1500 1500 590 21 -DS -1500 1500 -1500 -1500 590 21 -DS -1500 -1500 1500 -1500 590 21 -DS 1500 -1500 1500 1500 590 21 -DS 1500 1500 -1500 1500 590 21 -DS -1500 1500 -1500 -1500 590 21 -DS -1400 -1400 1400 -1400 80 21 -DS 1400 -1400 1400 1400 80 21 -DS 1400 1400 -1400 1400 80 21 -DS -1400 1400 -1400 -1400 80 21 -DC 0 0 -150 150 90 21 -DC 0 0 -374 374 40 21 -DA 0 0 0 850 4500 980 21 -DA 0 0 0 -850 4500 980 21 -$PAD -Sh "1" C 2500 2500 0 0 0 -Dr 1180 0 0 -At STD N 00A8FFFF -Ne 0 "" -Po 0 0 -$EndPAD -$EndMODULE myhole-1 -$MODULE myhole-1 -Po 84500 23500 0 15 47FB25E3 47FB2423 ~~ -Li myhole-1 -Cd MOUNTING PAD 3.6 MM, SQUARE -Kw MOUNTING PAD 3.6 MM, SQUARE -Sc 47FB2423 -AR /47FB2423 -Op 0 0 0 -At VIRTUAL -T0 0 0 400 400 0 120 N V 21 "MH3" -T1 0 0 400 400 0 120 N V 21 "MTHOLE" -DS 1350 0 1150 0 20 21 -DS 0 -1350 0 -1150 20 21 -DS -1150 0 -1350 0 20 21 -DS 0 1150 0 1350 20 21 -DS -1500 -1500 1500 -1500 590 21 -DS 1500 -1500 1500 1500 590 21 -DS 1500 1500 -1500 1500 590 21 -DS -1500 1500 -1500 -1500 590 21 -DS -1500 -1500 1500 -1500 590 21 -DS 1500 -1500 1500 1500 590 21 -DS 1500 1500 -1500 1500 590 21 -DS -1500 1500 -1500 -1500 590 21 -DS -1500 -1500 1500 -1500 590 21 -DS 1500 -1500 1500 1500 590 21 -DS 1500 1500 -1500 1500 590 21 -DS -1500 1500 -1500 -1500 590 21 -DS -1500 -1500 1500 -1500 590 21 -DS 1500 -1500 1500 1500 590 21 -DS 1500 1500 -1500 1500 590 21 -DS -1500 1500 -1500 -1500 590 21 -DS -1500 -1500 1500 -1500 590 21 -DS 1500 -1500 1500 1500 590 21 -DS 1500 1500 -1500 1500 590 21 -DS -1500 1500 -1500 -1500 590 21 -DS -1400 -1400 1400 -1400 80 21 -DS 1400 -1400 1400 1400 80 21 -DS 1400 1400 -1400 1400 80 21 -DS -1400 1400 -1400 -1400 80 21 -DC 0 0 -150 150 90 21 -DC 0 0 -374 374 40 21 -DA 0 0 0 850 4500 980 21 -DA 0 0 0 -850 4500 980 21 -$PAD -Sh "1" C 2500 2500 0 0 0 -Dr 1180 0 0 -At STD N 00A8FFFF -Ne 0 "" -Po 0 0 -$EndPAD -$EndMODULE myhole-1 -$MODULE myhole-1 -Po 50500 51000 0 15 47FB25E3 47FB2418 ~~ -Li myhole-1 -Cd MOUNTING PAD 3.6 MM, SQUARE -Kw MOUNTING PAD 3.6 MM, SQUARE -Sc 47FB2418 -AR /47FB2418 -Op 0 0 0 -At VIRTUAL -T0 0 0 400 400 0 120 N V 21 "MH1" -T1 0 0 400 400 0 120 N V 21 "MTHOLE" -DS 1350 0 1150 0 20 21 -DS 0 -1350 0 -1150 20 21 -DS -1150 0 -1350 0 20 21 -DS 0 1150 0 1350 20 21 -DS -1500 -1500 1500 -1500 590 21 -DS 1500 -1500 1500 1500 590 21 -DS 1500 1500 -1500 1500 590 21 -DS -1500 1500 -1500 -1500 590 21 -DS -1500 -1500 1500 -1500 590 21 -DS 1500 -1500 1500 1500 590 21 -DS 1500 1500 -1500 1500 590 21 -DS -1500 1500 -1500 -1500 590 21 -DS -1500 -1500 1500 -1500 590 21 -DS 1500 -1500 1500 1500 590 21 -DS 1500 1500 -1500 1500 590 21 -DS -1500 1500 -1500 -1500 590 21 -DS -1500 -1500 1500 -1500 590 21 -DS 1500 -1500 1500 1500 590 21 -DS 1500 1500 -1500 1500 590 21 -DS -1500 1500 -1500 -1500 590 21 -DS -1500 -1500 1500 -1500 590 21 -DS 1500 -1500 1500 1500 590 21 -DS 1500 1500 -1500 1500 590 21 -DS -1500 1500 -1500 -1500 590 21 -DS -1400 -1400 1400 -1400 80 21 -DS 1400 -1400 1400 1400 80 21 -DS 1400 1400 -1400 1400 80 21 -DS -1400 1400 -1400 -1400 80 21 -DC 0 0 -150 150 90 21 -DC 0 0 -374 374 40 21 -DA 0 0 0 850 4500 980 21 -DA 0 0 0 -850 4500 980 21 -$PAD -Sh "1" C 2500 2500 0 0 0 -Dr 1180 0 0 -At STD N 00A8FFFF -Ne 0 "" -Po 0 0 -$EndPAD -$EndMODULE myhole-1 -$DRAWSEGMENT -Po 0 49000 22000 49000 52500 150 -De 28 0 900 0 0 -$EndDRAWSEGMENT -$DRAWSEGMENT -Po 0 86000 22000 49000 22000 150 -De 28 0 900 0 0 -$EndDRAWSEGMENT -$DRAWSEGMENT -Po 0 86000 52500 49000 52500 150 -De 28 0 900 0 0 -$EndDRAWSEGMENT -$DRAWSEGMENT -Po 0 86000 22000 86000 52500 150 -De 28 0 900 0 0 -$EndDRAWSEGMENT -$TRACK -Po 0 81500 49000 81500 52000 197 -1 -De 0 0 0 0 0 -Po 0 82000 49000 82000 52000 197 -1 -De 0 0 0 0 0 -Po 0 82500 49000 82500 52000 197 -1 -De 0 0 0 0 0 -Po 0 81500 49000 81500 52000 197 -1 -De 15 0 0 0 0 -Po 0 82000 49000 82000 52000 197 -1 -De 15 0 0 0 0 -Po 0 82500 49000 82500 52000 197 -1 -De 15 0 0 0 0 -Po 0 81000 49000 81000 52000 197 -1 -De 15 0 0 0 0 -Po 0 80500 49000 80500 52000 197 -1 -De 15 0 0 0 0 -Po 0 80000 49000 80000 52000 197 -1 -De 15 0 0 0 0 -Po 0 79500 49000 79500 52000 197 -1 -De 15 0 0 0 0 -Po 0 79000 49000 79000 52000 197 -1 -De 15 0 0 0 0 -Po 0 78500 49000 78500 52000 197 -1 -De 15 0 0 0 0 -Po 0 78000 49000 78000 52000 197 -1 -De 15 0 0 0 0 -Po 0 77500 49000 77500 52000 197 -1 -De 15 0 0 0 0 -Po 0 77000 49000 77000 52000 197 -1 -De 15 0 0 0 0 -Po 0 76500 49000 76500 52000 197 -1 -De 15 0 0 0 0 -Po 0 76000 49000 76000 52000 197 -1 -De 15 0 0 0 0 -Po 0 75500 49500 75500 52000 197 -1 -De 15 0 0 0 0 -Po 0 75500 49500 75500 52000 197 -1 -De 0 0 0 0 0 -Po 0 81000 49000 81000 52000 197 -1 -De 0 0 0 0 0 -Po 0 80500 49000 80500 52000 197 -1 -De 0 0 0 0 0 -Po 0 80000 49000 80000 52000 197 -1 -De 0 0 0 0 0 -Po 0 79500 49000 79500 52000 197 -1 -De 0 0 0 0 0 -Po 0 79000 49000 79000 52000 197 -1 -De 0 0 0 0 0 -Po 0 78500 49000 78500 52000 197 -1 -De 0 0 0 0 0 -Po 0 78000 49000 78000 52000 197 -1 -De 0 0 0 0 0 -Po 0 77500 49000 77500 52000 197 -1 -De 0 0 0 0 0 -Po 0 77000 49000 77000 52000 197 -1 -De 0 0 0 0 0 -Po 0 76500 49000 76500 52000 197 -1 -De 0 0 0 0 0 -Po 0 76000 49000 76000 52000 197 -1 -De 0 0 0 0 0 -Po 0 65000 49000 65000 52000 197 -1 -De 0 0 0 0 0 -Po 0 65500 49000 65500 52000 197 -1 -De 0 0 0 0 0 -Po 0 66000 49000 66000 52000 197 -1 -De 0 0 0 0 0 -Po 0 66500 49000 66500 52000 197 -1 -De 0 0 0 0 0 -Po 0 67000 49000 67000 52000 197 -1 -De 0 0 0 0 0 -Po 0 67500 49000 67500 52000 197 -1 -De 0 0 0 0 0 -Po 0 68000 49000 68000 52000 197 -1 -De 0 0 0 0 0 -Po 0 68500 49000 68500 52000 197 -1 -De 0 0 0 0 0 -Po 0 69000 49000 69000 52000 197 -1 -De 0 0 0 0 0 -Po 0 69500 49000 69500 52000 197 -1 -De 0 0 0 0 0 -Po 0 70000 49000 70000 52000 197 -1 -De 0 0 0 0 0 -Po 0 64500 49500 64500 52000 197 -1 -De 0 0 0 0 0 -Po 0 64000 49500 64000 52000 197 -1 -De 0 0 0 0 0 -Po 0 63500 49500 63500 52000 197 -1 -De 0 0 0 0 0 -Po 0 63500 49500 63500 52000 197 -1 -De 15 0 0 0 0 -Po 0 64000 49500 64000 52000 197 -1 -De 15 0 0 0 0 -Po 0 64500 49500 64500 52000 197 -1 -De 15 0 0 0 0 -Po 0 65000 49000 65000 52000 197 -1 -De 15 0 0 0 0 -Po 0 65500 49000 65500 52000 197 -1 -De 15 0 0 0 0 -Po 0 66000 49000 66000 52000 197 -1 -De 15 0 0 0 0 -Po 0 66500 49000 66500 52000 197 -1 -De 15 0 0 0 0 -Po 0 67000 49000 67000 52000 197 -1 -De 15 0 0 0 0 -Po 0 67500 49000 67500 52000 197 -1 -De 15 0 0 0 0 -Po 0 68000 49000 68000 52000 197 -1 -De 15 0 0 0 0 -Po 0 68500 49000 68500 52000 197 -1 -De 15 0 0 0 0 -Po 0 69000 49000 69000 52000 197 -1 -De 15 0 0 0 0 -Po 0 69500 49000 69500 52000 197 -1 -De 15 0 0 0 0 -Po 0 70000 49000 70000 52000 197 -1 -De 15 0 0 0 0 -Po 0 81000 34000 85500 34000 197 -1 -De 0 0 0 0 0 -Po 0 80500 34500 85500 34500 197 -1 -De 0 0 0 0 0 -Po 0 80000 35000 85500 35000 197 -1 -De 0 0 0 0 0 -Po 0 80000 35500 85500 35500 197 -1 -De 0 0 0 0 0 -Po 0 80000 36000 85500 36000 197 -1 -De 0 0 0 0 0 -Po 0 80000 36500 85500 36500 197 -1 -De 0 0 0 0 0 -Po 0 85500 37000 82000 37000 197 -1 -De 0 0 0 0 0 -Po 0 82000 37000 80000 37000 197 -1 -De 0 0 0 0 0 -Po 0 80000 37500 85500 37500 197 -1 -De 0 0 0 0 0 -Po 0 85500 38000 80000 38000 197 -1 -De 0 0 0 0 0 -Po 0 80000 38500 85500 38500 197 -1 -De 0 0 0 0 0 -Po 0 85500 39000 81000 39000 197 -1 -De 0 0 0 0 0 -Po 0 85500 34000 81000 34000 197 -1 -De 15 0 0 0 0 -Po 0 80500 34500 85500 34500 197 -1 -De 15 0 0 0 0 -Po 0 85500 35000 80000 35000 197 -1 -De 15 0 0 0 0 -Po 0 80000 35500 85500 35500 197 -1 -De 15 0 0 0 0 -Po 0 85500 36000 80000 36000 197 -1 -De 15 0 0 0 0 -Po 0 80000 36500 85500 36500 197 -1 -De 15 0 0 0 0 -Po 0 85500 37000 80000 37000 197 -1 -De 15 0 0 0 0 -Po 0 80000 37500 85500 37500 197 -1 -De 15 0 0 0 0 -Po 0 85500 38000 80000 38000 197 -1 -De 15 0 0 0 0 -Po 0 80000 38500 85500 38500 197 -1 -De 15 0 0 0 0 -Po 0 85500 39000 81000 39000 197 -1 -De 15 0 0 0 0 -Po 0 49500 25500 52000 25500 197 -1 -De 15 0 0 0 0 -Po 0 52000 26000 49500 26000 197 -1 -De 15 0 0 0 0 -Po 0 49500 26500 52000 26500 197 -1 -De 15 0 0 0 0 -Po 0 52000 27000 49500 27000 197 -1 -De 15 0 0 0 0 -Po 0 49500 27500 52000 27500 197 -1 -De 15 0 0 0 0 -Po 0 52000 28000 49500 28000 197 -1 -De 15 0 0 0 0 -Po 0 49500 28500 52000 28500 197 -1 -De 15 0 0 0 0 -Po 0 52000 29000 49500 29000 197 -1 -De 15 0 0 0 0 -Po 0 49500 29500 52000 29500 197 -1 -De 15 0 0 0 0 -Po 0 49500 30000 54500 30000 197 -1 -De 15 0 0 0 0 -Po 0 54500 30500 49500 30500 197 -1 -De 15 0 0 0 0 -Po 0 49500 31000 56500 31000 197 -1 -De 15 0 0 0 0 -Po 0 56500 31500 49500 31500 197 -1 -De 15 0 0 0 0 -Po 0 49500 32000 56500 32000 197 -1 -De 15 0 0 0 0 -Po 0 56500 32500 49500 32500 197 -1 -De 15 0 0 0 0 -Po 0 49500 25500 52000 25500 197 -1 -De 0 0 0 0 0 -Po 0 52000 26000 49500 26000 197 -1 -De 0 0 0 0 0 -Po 0 49500 26500 52000 26500 197 -1 -De 0 0 0 0 0 -Po 0 52000 27000 49500 27000 197 -1 -De 0 0 0 0 0 -Po 0 49500 27500 52000 27500 197 -1 -De 0 0 0 0 0 -Po 0 52000 28000 49500 28000 197 -1 -De 0 0 0 0 0 -Po 0 49500 28500 52000 28500 197 -1 -De 0 0 0 0 0 -Po 0 52000 29000 49500 29000 197 -1 -De 0 0 0 0 0 -Po 0 49500 29500 52000 29500 197 -1 -De 0 0 0 0 0 -Po 0 49500 30000 54500 30000 197 -1 -De 0 0 0 0 0 -Po 0 49500 30500 54500 30500 197 -1 -De 0 0 0 0 0 -Po 0 49500 31000 56500 31000 197 -1 -De 0 0 0 0 0 -Po 0 56500 31500 49500 31500 197 -1 -De 0 0 0 0 0 -Po 0 49500 32000 56500 32000 197 -1 -De 0 0 0 0 0 -Po 0 56500 32500 49500 32500 197 -1 -De 0 0 0 0 0 -Po 0 49500 44000 51000 44000 197 -1 -De 0 0 0 0 0 -Po 0 51000 44500 49500 44500 197 -1 -De 0 0 0 0 0 -Po 0 49500 45000 51000 45000 197 -1 -De 0 0 0 0 0 -Po 0 51000 45500 49500 45500 197 -1 -De 0 0 0 0 0 -Po 0 49500 46000 51000 46000 197 -1 -De 0 0 0 0 0 -Po 0 49500 46500 51000 46500 197 -1 -De 0 0 0 0 0 -Po 0 51500 47000 49500 47000 197 -1 -De 0 0 0 0 0 -Po 0 49500 47500 51500 47500 197 -1 -De 0 0 0 0 0 -Po 0 51500 48000 49500 48000 197 -1 -De 0 0 0 0 0 -Po 0 49500 48500 51500 48500 197 -1 -De 0 0 0 0 0 -Po 0 51500 49000 49500 49000 197 -1 -De 0 0 0 0 0 -Po 0 49500 44000 51000 44000 197 -1 -De 15 0 0 0 0 -Po 0 51000 44500 49500 44500 197 -1 -De 15 0 0 0 0 -Po 0 49500 45000 51000 45000 197 -1 -De 15 0 0 0 0 -Po 0 51000 45500 49500 45500 197 -1 -De 15 0 0 0 0 -Po 0 49500 46000 51000 46000 197 -1 -De 15 0 0 0 0 -Po 0 51000 46500 49500 46500 197 -1 -De 15 0 0 0 0 -Po 0 49500 47000 51500 47000 197 -1 -De 15 0 0 0 0 -Po 0 51500 47500 49500 47500 197 -1 -De 15 0 0 0 0 -Po 0 49500 48000 51500 48000 197 -1 -De 15 0 0 0 0 -Po 0 51500 48500 49500 48500 197 -1 -De 15 0 0 0 0 -Po 0 49500 49000 51500 49000 197 -1 -De 15 0 0 0 0 -Po 0 74000 25000 76500 25000 197 -1 -De 15 0 0 0 0 -Po 0 76500 25500 74000 25500 197 -1 -De 15 0 0 0 0 -Po 0 74000 26000 76500 26000 197 -1 -De 15 0 0 0 0 -Po 0 76500 26500 73500 26500 197 -1 -De 15 0 0 0 0 -Po 0 76500 27000 73000 27000 197 -1 -De 15 0 0 0 0 -Po 0 76500 27500 71000 27500 197 -1 -De 15 0 0 0 0 -Po 0 71000 28000 76500 28000 197 -1 -De 15 0 0 0 0 -Po 0 76500 28500 71000 28500 197 -1 -De 15 0 0 0 0 -Po 0 71000 29000 76500 29000 197 -1 -De 15 0 0 0 0 -Po 0 71000 29500 74000 29500 197 -1 -De 15 0 0 0 0 -Po 0 74000 30000 71000 30000 197 -1 -De 15 0 0 0 0 -Po 0 71000 30500 74000 30500 197 -1 -De 15 0 0 0 0 -Po 0 74000 31000 71000 31000 197 -1 -De 15 0 0 0 0 -Po 0 85500 25500 82500 25500 197 -1 -De 0 0 0 0 0 -Po 0 82500 26000 85500 26000 197 -1 -De 0 0 0 0 0 -Po 0 85500 26500 82500 26500 197 -1 -De 0 0 0 0 0 -Po 0 82500 27000 85500 27000 197 -1 -De 0 0 0 0 0 -Po 0 85500 27500 82500 27500 197 -1 -De 0 0 0 0 0 -Po 0 82500 28000 85500 28000 197 -1 -De 0 0 0 0 0 -Po 0 85500 28500 82500 28500 197 -1 -De 0 0 0 0 0 -Po 0 82500 29000 85500 29000 197 -1 -De 0 0 0 0 0 -Po 0 85500 29500 82500 29500 197 -1 -De 0 0 0 0 0 -Po 0 83000 30000 85500 30000 197 -1 -De 0 0 0 0 0 -Po 0 85500 30500 83000 30500 197 -1 -De 0 0 0 0 0 -Po 0 83000 31000 85500 31000 197 -1 -De 0 0 0 0 0 -Po 0 85500 31500 83000 31500 197 -1 -De 0 0 0 0 0 -Po 0 83000 32000 85500 32000 197 -1 -De 0 0 0 0 0 -Po 0 85500 32500 83000 32500 197 -1 -De 0 0 0 0 0 -Po 0 83000 33000 85500 33000 197 -1 -De 0 0 0 0 0 -Po 0 85500 33500 83000 33500 197 -1 -De 0 0 0 0 0 -Po 0 85500 25500 82500 25500 197 -1 -De 15 0 0 0 0 -Po 0 82500 26000 85500 26000 197 -1 -De 15 0 0 0 0 -Po 0 82500 27000 85500 27000 197 -1 -De 15 0 0 0 0 -Po 0 85500 27500 82500 27500 197 -1 -De 15 0 0 0 0 -Po 0 85500 28000 82500 28000 197 -1 -De 15 0 0 0 0 -Po 0 82500 28500 85500 28500 197 -1 -De 15 0 0 0 0 -Po 0 85500 29000 82500 29000 197 -1 -De 15 0 0 0 0 -Po 0 82500 29500 85500 29500 197 -1 -De 15 0 0 0 0 -Po 0 85500 30000 83000 30000 197 -1 -De 15 0 0 0 0 -Po 0 83000 30500 85500 30500 197 -1 -De 15 0 0 0 0 -Po 0 85500 31000 83000 31000 197 -1 -De 15 0 0 0 0 -Po 0 83000 31500 85500 31500 197 -1 -De 15 0 0 0 0 -Po 0 85500 32000 83000 32000 197 -1 -De 15 0 0 0 0 -Po 0 83000 32500 85500 32500 197 -1 -De 15 0 0 0 0 -Po 0 85500 33000 83000 33000 197 -1 -De 15 0 0 0 0 -Po 0 83000 33500 85500 33500 197 -1 -De 15 0 0 0 0 -Po 0 82500 26500 85500 26500 197 -1 -De 15 0 0 0 0 -Po 0 63000 31000 65000 31000 197 -1 -De 15 0 0 0 0 -Po 0 65000 31500 63000 31500 197 -1 -De 15 0 0 0 0 -Po 0 63000 32000 65000 32000 197 -1 -De 15 0 0 0 0 -Po 0 65000 32500 63000 32500 197 -1 -De 15 0 0 0 0 -Po 0 63000 33000 65000 33000 197 -1 -De 15 0 0 0 0 -Po 0 65000 33500 63000 33500 197 -1 -De 15 0 0 0 0 -Po 0 69500 32500 73500 32500 197 -1 -De 15 0 0 0 0 -Po 0 73500 33000 69500 33000 197 -1 -De 15 0 0 0 0 -Po 0 69500 33500 73500 33500 197 -1 -De 15 0 0 0 0 -Po 0 68500 34000 71000 34000 197 -1 -De 15 0 0 0 0 -Po 0 71000 34500 68500 34500 197 -1 -De 15 0 0 0 0 -Po 0 68500 35000 71000 35000 197 -1 -De 15 0 0 0 0 -Po 0 71000 35500 68500 35500 197 -1 -De 15 0 0 0 0 -Po 0 68500 36000 70500 36000 197 -1 -De 15 0 0 0 0 -Po 0 68500 36500 70000 36500 197 -1 -De 15 0 0 0 0 -Po 0 68500 36500 70000 36500 197 -1 -De 0 0 0 0 0 -Po 0 68500 36000 70500 36000 197 -1 -De 0 0 0 0 0 -Po 0 71000 35500 68500 35500 197 -1 -De 0 0 0 0 0 -Po 0 68500 35000 71000 35000 197 -1 -De 0 0 0 0 0 -Po 0 71000 34500 68500 34500 197 -1 -De 0 0 0 0 0 -Po 0 68500 34000 71000 34000 197 -1 -De 0 0 0 0 0 -Po 0 69500 33500 73500 33500 197 -1 -De 0 0 0 0 0 -Po 0 73500 33000 69500 33000 197 -1 -De 0 0 0 0 0 -Po 0 69500 32500 73500 32500 197 -1 -De 0 0 0 0 0 -Po 0 71000 31000 74000 31000 197 -1 -De 0 0 0 0 0 -Po 0 74000 30500 71000 30500 197 -1 -De 0 0 0 0 0 -Po 0 71000 30000 74000 30000 197 -1 -De 0 0 0 0 0 -Po 0 74000 29500 71000 29500 197 -1 -De 0 0 0 0 0 -Po 0 71000 29000 76500 29000 197 -1 -De 0 0 0 0 0 -Po 0 76500 28500 71000 28500 197 -1 -De 0 0 0 0 0 -Po 0 71000 28000 76500 28000 197 -1 -De 0 0 0 0 0 -Po 0 76500 27500 71000 27500 197 -1 -De 0 0 0 0 0 -Po 0 73000 27000 76500 27000 197 -1 -De 0 0 0 0 0 -Po 0 76500 26500 73500 26500 197 -1 -De 0 0 0 0 0 -Po 0 74000 26000 76500 26000 197 -1 -De 0 0 0 0 0 -Po 0 76500 25500 74000 25500 197 -1 -De 0 0 0 0 0 -Po 0 74000 25000 76500 25000 197 -1 -De 0 0 0 0 0 -Po 0 63000 31000 65000 31000 197 -1 -De 0 0 0 0 0 -Po 0 65000 31500 63000 31500 197 -1 -De 0 0 0 0 0 -Po 0 63000 32000 65000 32000 197 -1 -De 0 0 0 0 0 -Po 0 65000 32500 63000 32500 197 -1 -De 0 0 0 0 0 -Po 0 63000 33000 65000 33000 197 -1 -De 0 0 0 0 0 -Po 0 65000 33500 63000 33500 197 -1 -De 0 0 0 0 0 -Po 0 83300 46500 83800 46000 197 -1 -De 0 0 1 0 2 -Po 0 83000 46500 83300 46500 197 -1 -De 0 0 1 0 2 -Po 0 83800 46000 84000 46000 197 -1 -De 0 0 1 0 402 -Po 0 74000 48500 74700 47800 197 -1 -De 0 0 1 0 802 -Po 0 81700 47800 83000 46500 197 -1 -De 0 0 1 0 2 -Po 0 74700 47800 81700 47800 197 -1 -De 0 0 1 0 2 -Po 0 83000 46000 81500 47500 197 -1 -De 0 0 2 0 802 -Po 0 81500 47500 74000 47500 197 -1 -De 0 0 2 0 402 -Po 0 81300 28700 81300 25200 197 -1 -De 0 0 3 0 0 -Po 3 81300 28700 81300 28700 450 -1 -De 15 1 3 0 0 -Po 0 80750 24650 81300 25200 197 -1 -De 0 0 3 0 0 -Po 0 80750 24500 80750 24650 197 -1 -De 0 0 3 0 800 -Po 0 75000 46500 74000 46500 197 -1 -De 0 0 3 0 402 -Po 0 79400 31700 79500 31600 197 -1 -De 15 0 3 0 2 -Po 3 75000 46500 75000 46500 450 -1 -De 15 1 3 0 2 -Po 0 75000 46500 75300 46500 197 -1 -De 15 0 3 0 2 -Po 0 80500 29500 81300 28700 197 -1 -De 15 0 3 0 2 -Po 0 79100 42700 79100 39200 197 -1 -De 15 0 3 0 2 -Po 0 79100 39200 79400 38900 197 -1 -De 15 0 3 0 2 -Po 0 79400 38900 79400 31700 197 -1 -De 15 0 3 0 2 -Po 0 79500 31600 79900 31600 197 -1 -De 15 0 3 0 2 -Po 0 79900 31600 80500 31000 197 -1 -De 15 0 3 0 2 -Po 0 80500 31000 80500 29500 197 -1 -De 15 0 3 0 2 -Po 0 80800 24500 80750 24500 197 -1 -De 0 0 3 0 402 -Po 0 75300 46500 79100 42700 197 -1 -De 15 0 3 0 2 -Po 0 77300 28800 77300 26500 197 -1 -De 15 0 4 0 0 -Po 0 73200 34100 73200 43200 197 -1 -De 15 0 4 0 2 -Po 0 76500 30300 76500 29600 197 -1 -De 15 0 4 0 0 -Po 0 76200 30600 76500 30300 197 -1 -De 15 0 4 0 0 -Po 0 76200 31100 76200 30600 197 -1 -De 15 0 4 0 0 -Po 0 76400 31300 76200 31100 197 -1 -De 15 0 4 0 0 -Po 0 76400 34300 76400 31300 197 -1 -De 15 0 4 0 0 -Po 0 76000 34700 76400 34300 197 -1 -De 15 0 4 0 0 -Po 0 74300 34700 76000 34700 197 -1 -De 15 0 4 0 0 -Po 0 73700 34100 74300 34700 197 -1 -De 15 0 4 0 0 -Po 0 73200 34100 73700 34100 197 -1 -De 15 0 4 0 0 -Po 3 77300 26500 77300 26500 450 -1 -De 15 1 4 0 2 -Po 0 78300 25500 77300 26500 197 -1 -De 0 0 4 0 2 -Po 0 78250 25500 78300 25500 197 -1 -De 0 0 4 0 802 -Po 0 74000 45300 74000 45500 197 -1 -De 15 0 4 0 402 -Po 0 73600 44900 74000 45300 197 -1 -De 15 0 4 0 2 -Po 0 73600 44800 73600 44900 197 -1 -De 15 0 4 0 2 -Po 0 73500 44700 73600 44800 197 -1 -De 15 0 4 0 2 -Po 0 73500 43500 73500 44700 197 -1 -De 15 0 4 0 2 -Po 0 73200 43200 73500 43500 197 -1 -De 15 0 4 0 2 -Po 0 76500 29600 77300 28800 197 -1 -De 15 0 4 0 0 -Po 0 83300 44500 83800 44000 197 -1 -De 0 0 5 0 2 -Po 0 83800 44000 84000 44000 197 -1 -De 0 0 5 0 402 -Po 0 74000 44500 83300 44500 197 -1 -De 0 0 5 0 802 -Po 0 60000 50400 60000 50375 197 -1 -De 0 0 6 0 402 -Po 0 71000 42500 71000 41500 197 -1 -De 15 0 6 0 C02 -Po 0 61000 50400 60000 50400 197 -1 -De 0 0 6 0 2 -Po 0 61000 50375 61000 50400 197 -1 -De 0 0 6 0 802 -Po 0 58000 50400 58000 50375 197 -1 -De 0 0 6 0 402 -Po 0 53000 50375 53000 50400 197 -1 -De 0 0 6 0 802 -Po 0 53000 50400 54000 50400 197 -1 -De 0 0 6 0 2 -Po 0 54000 50400 54000 50375 197 -1 -De 0 0 6 0 402 -Po 0 61000 50400 62000 50400 197 -1 -De 0 0 6 0 2 -Po 0 80000 30000 81300 30000 197 -1 -De 0 0 6 0 C02 -Po 0 54000 50400 55000 50400 197 -1 -De 0 0 6 0 2 -Po 0 57000 50400 57000 50375 197 -1 -De 0 0 6 0 402 -Po 0 55000 50400 56000 50400 197 -1 -De 0 0 6 0 2 -Po 0 58000 50400 59000 50400 197 -1 -De 0 0 6 0 2 -Po 0 59000 50400 59000 50375 197 -1 -De 0 0 6 0 402 -Po 0 60000 50400 59000 50400 197 -1 -De 0 0 6 0 2 -Po 0 82200 30025 82000 30100 197 -1 -De 0 0 6 0 802 -Po 0 82000 30100 81900 30000 197 -1 -De 0 0 6 0 2 -Po 0 81900 30000 81300 30000 197 -1 -De 0 0 6 0 402 -Po 0 82000 30100 81900 30000 197 -1 -De 0 0 6 0 2 -Po 0 81900 30000 82700 30000 197 -1 -De 0 0 6 0 2 -Po 0 56000 50375 56000 50400 197 -1 -De 0 0 6 0 802 -Po 0 82700 31300 82400 32000 197 -1 -De 0 0 6 0 402 -Po 0 82400 32000 80900 32000 197 -1 -De 15 0 6 0 802 -Po 3 80900 32000 80900 32000 450 -1 -De 15 1 6 0 2 -Po 0 80900 32000 78500 32000 197 -1 -De 0 0 6 0 402 -Po 0 80000 30000 80000 27300 197 -1 -De 15 0 6 0 802 -Po 3 80000 27300 80000 27300 450 -1 -De 15 1 6 0 2 -Po 0 80000 27300 80000 24600 197 -1 -De 0 0 6 0 2 -Po 0 80000 24600 79900 24500 197 -1 -De 0 0 6 0 402 -Po 0 71000 42500 72000 43500 197 -1 -De 0 0 6 0 802 -Po 0 72000 43500 74000 43500 197 -1 -De 0 0 6 0 402 -Po 0 74000 43500 73500 43000 197 -1 -De 15 0 6 0 802 -Po 0 73500 43000 73500 39300 197 -1 -De 15 0 6 0 2 -Po 0 73500 39300 73600 39200 197 -1 -De 15 0 6 0 2 -Po 0 73600 39200 73600 39100 197 -1 -De 15 0 6 0 2 -Po 0 73600 39100 73700 39100 197 -1 -De 15 0 6 0 2 -Po 0 73700 39100 73800 39000 197 -1 -De 15 0 6 0 2 -Po 0 73800 39000 74300 39000 197 -1 -De 15 0 6 0 2 -Po 0 74300 39000 76700 36500 197 -1 -De 15 0 6 0 2 -Po 0 76700 36500 76700 34900 197 -1 -De 15 0 6 0 2 -Po 0 76700 34900 76700 33600 197 -1 -De 15 0 6 0 2 -Po 0 76700 33600 76700 30900 197 -1 -De 15 0 6 0 2 -Po 3 76700 30900 76700 30900 450 -1 -De 15 1 6 0 2 -Po 0 76700 30900 78500 32000 197 -1 -De 0 0 6 0 402 -Po 0 62000 50400 62400 50000 197 -1 -De 0 0 6 0 2 -Po 0 62400 50000 62500 50000 197 -1 -De 0 0 6 0 2 -Po 0 62500 50000 63600 48900 197 -1 -De 0 0 6 0 2 -Po 0 63600 48900 64100 48900 197 -1 -De 0 0 6 0 2 -Po 3 64100 48900 64100 48900 450 -1 -De 15 1 6 0 2 -Po 0 64100 48900 69000 44000 197 -1 -De 15 0 6 0 2 -Po 0 69000 44000 69800 44000 197 -1 -De 15 0 6 0 2 -Po 0 69800 44000 70600 43200 197 -1 -De 15 0 6 0 2 -Po 0 70600 43200 70600 43100 197 -1 -De 15 0 6 0 2 -Po 0 70600 43100 71000 42700 197 -1 -De 15 0 6 0 2 -Po 0 71000 42700 71000 42500 197 -1 -De 15 0 6 0 402 -Po 0 56000 50400 57000 50400 197 -1 -De 0 0 6 0 2 -Po 0 55000 50400 55000 50375 197 -1 -De 0 0 6 0 402 -Po 0 62000 50400 62000 50375 197 -1 -De 0 0 6 0 402 -Po 0 82700 30000 82700 31300 197 -1 -De 0 0 6 0 2 -Po 0 57000 50400 58000 50400 197 -1 -De 0 0 6 0 2 -Po 0 82200 30775 82000 31000 197 -1 -De 0 0 7 0 802 -Po 0 82000 31000 81900 31100 197 -1 -De 0 0 7 0 2 -Po 0 81900 31100 81900 32722 197 -1 -De 0 0 7 0 2 -Po 0 81900 32722 82400 33000 197 -1 -De 0 0 7 0 402 -Po 0 50500 42500 50500 42000 197 -1 -De 0 0 7 0 802 -Po 0 50500 42000 51400 41100 197 -1 -De 0 0 7 0 2 -Po 0 51400 41100 53000 41100 197 -1 -De 0 0 7 0 2 -Po 0 53000 41100 53000 42000 197 -1 -De 0 0 7 0 2 -Po 0 53000 42000 53500 42500 197 -1 -De 0 0 7 0 402 -Po 0 59500 42500 59500 41600 197 -1 -De 0 0 7 0 802 -Po 0 62500 41400 62500 44000 197 -1 -De 0 0 7 0 2 -Po 0 59700 41400 62500 41400 197 -1 -De 0 0 7 0 2 -Po 0 59500 41600 59700 41400 197 -1 -De 0 0 7 0 2 -Po 0 77875 40000 83000 40000 197 -1 -De 0 0 7 0 C02 -Po 0 77900 42000 77900 42100 197 -1 -De 0 0 7 0 2 -Po 0 77900 42100 77400 42600 197 -1 -De 0 0 7 0 2 -Po 0 77400 42600 75900 42600 197 -1 -De 0 0 7 0 2 -Po 0 75900 42600 75800 42500 197 -1 -De 0 0 7 0 2 -Po 0 75800 42500 74000 42500 197 -1 -De 0 0 7 0 402 -Po 0 53800 42500 53500 42500 197 -1 -De 0 0 7 0 402 -Po 0 81300 33000 80000 34000 197 -1 -De 0 0 7 0 802 -Po 0 80000 34000 78500 34000 197 -1 -De 0 0 7 0 402 -Po 0 71000 43500 72000 42500 197 -1 -De 15 0 7 0 802 -Po 3 72000 42500 72000 42500 450 -1 -De 15 1 7 0 2 -Po 0 72000 42500 74000 42500 197 -1 -De 0 0 7 0 402 -Po 0 78500 34000 77900 34500 197 -1 -De 0 0 7 0 802 -Po 0 77900 34500 77900 35800 197 -1 -De 0 0 7 0 2 -Po 3 77900 35800 77900 35800 450 -1 -De 15 1 7 0 2 -Po 0 77900 35800 77900 39200 197 -1 -De 15 0 7 0 2 -Po 3 77900 39200 77900 39200 450 -1 -De 15 1 7 0 2 -Po 0 77900 39200 77900 40000 197 -1 -De 0 0 7 0 2 -Po 0 69500 43500 69200 43200 197 -1 -De 0 0 7 0 802 -Po 0 82200 30775 82000 30900 197 -1 -De 0 0 7 0 802 -Po 0 82000 30900 81900 30800 197 -1 -De 0 0 7 0 2 -Po 0 81900 30800 80000 30800 197 -1 -De 0 0 7 0 2 -Po 3 80000 30800 80000 30800 450 -1 -De 15 1 7 0 2 -Po 0 80000 30800 79800 30800 197 -1 -De 15 0 7 0 2 -Po 0 79800 30800 79300 30300 197 -1 -De 15 0 7 0 2 -Po 0 79300 30300 79300 27300 197 -1 -De 15 0 7 0 2 -Po 3 79300 27300 79300 27300 450 -1 -De 15 1 7 0 2 -Po 0 79300 27300 79300 24700 197 -1 -De 0 0 7 0 2 -Po 0 79300 24700 79100 24500 197 -1 -De 0 0 7 0 2 -Po 0 79100 24500 79050 24500 197 -1 -De 0 0 7 0 402 -Po 0 53500 42500 54100 42500 197 -1 -De 0 0 7 0 800 -Po 0 58800 41800 59500 42500 197 -1 -De 0 0 7 0 400 -Po 0 57800 41800 58800 41800 197 -1 -De 0 0 7 0 0 -Po 0 57500 42100 57800 41800 197 -1 -De 0 0 7 0 0 -Po 0 57500 42900 57500 42100 197 -1 -De 0 0 7 0 0 -Po 0 57200 43200 57500 42900 197 -1 -De 0 0 7 0 0 -Po 0 56800 43200 57200 43200 197 -1 -De 0 0 7 0 0 -Po 0 56500 42900 56800 43200 197 -1 -De 0 0 7 0 0 -Po 0 56500 42000 56500 42900 197 -1 -De 0 0 7 0 0 -Po 0 56100 41600 56500 42000 197 -1 -De 0 0 7 0 0 -Po 0 54500 41600 56100 41600 197 -1 -De 0 0 7 0 0 -Po 0 77900 42000 77875 42000 197 -1 -De 0 0 7 0 402 -Po 0 54300 42300 54300 41800 197 -1 -De 0 0 7 0 0 -Po 0 54100 42500 54300 42300 197 -1 -De 0 0 7 0 0 -Po 0 62500 44000 63900 44000 197 -1 -De 0 0 7 0 0 -Po 0 66300 43200 69200 43200 197 -1 -De 0 0 7 0 0 -Po 0 66000 42900 66300 43200 197 -1 -De 0 0 7 0 0 -Po 0 66000 42100 66000 42900 197 -1 -De 0 0 7 0 0 -Po 0 65700 41800 66000 42100 197 -1 -De 0 0 7 0 0 -Po 0 64000 41800 65700 41800 197 -1 -De 0 0 7 0 0 -Po 0 63900 41900 64000 41800 197 -1 -De 0 0 7 0 0 -Po 0 63900 42400 63900 41900 197 -1 -De 0 0 7 0 0 -Po 0 63900 44000 63900 42400 197 -1 -De 0 0 7 0 0 -Po 0 69200 43200 69500 43500 197 -1 -De 0 0 7 0 400 -Po 0 59500 42500 57500 44500 197 -1 -De 0 0 7 0 800 -Po 0 59000 46500 59000 46000 197 -1 -De 0 0 7 0 400 -Po 0 58800 46700 59000 46500 197 -1 -De 0 0 7 0 0 -Po 0 57800 46700 58800 46700 197 -1 -De 0 0 7 0 0 -Po 0 57500 46400 57800 46700 197 -1 -De 0 0 7 0 0 -Po 0 57500 44500 57500 46400 197 -1 -De 0 0 7 0 0 -Po 0 77875 40000 77900 40000 197 -1 -De 0 0 7 0 802 -Po 0 71000 43500 69500 43500 197 -1 -De 0 0 7 0 C02 -Po 0 82400 33000 81300 33000 197 -1 -De 0 0 7 0 C02 -Po 0 77900 40000 77900 42000 197 -1 -De 0 0 7 0 2 -Po 0 54300 41800 54500 41600 197 -1 -De 0 0 7 0 0 -Po 0 75500 41500 74000 41500 197 -1 -De 0 0 8 0 402 -Po 0 76000 42000 77125 42000 197 -1 -De 0 0 8 0 C02 -Po 0 76000 42000 75500 41500 197 -1 -De 0 0 8 0 802 -Po 0 75500 40500 74000 40500 197 -1 -De 0 0 9 0 402 -Po 0 77125 40000 76000 40000 197 -1 -De 0 0 9 0 C02 -Po 0 76000 40000 75500 40500 197 -1 -De 0 0 9 0 802 -Po 3 77600 43100 77600 43100 450 -1 -De 15 1 10 0 2 -Po 0 77600 43100 78500 44000 197 -1 -De 0 0 10 0 2 -Po 0 74000 39500 77600 43100 197 -1 -De 15 0 10 0 802 -Po 0 78500 44000 83000 44000 197 -1 -De 0 0 10 0 402 -Po 3 74700 39500 74700 39500 450 -1 -De 15 1 11 0 0 -Po 0 78000 40800 76000 40800 197 -1 -De 15 0 11 0 0 -Po 0 78400 41200 78000 40800 197 -1 -De 15 0 11 0 0 -Po 0 74700 39500 74600 39400 197 -1 -De 0 0 11 0 0 -Po 0 78400 42300 78400 41200 197 -1 -De 0 0 11 0 0 -Po 0 79600 43500 78400 42300 197 -1 -De 0 0 11 0 0 -Po 0 76000 40800 74700 39500 197 -1 -De 15 0 11 0 0 -Po 0 84000 43100 83600 43500 197 -1 -De 0 0 11 0 0 -Po 0 74600 39400 74600 39100 197 -1 -De 0 0 11 0 0 -Po 0 74600 39100 74000 38500 197 -1 -De 0 0 11 0 400 -Po 3 78400 41200 78400 41200 450 -1 -De 15 1 11 0 0 -Po 0 84000 43000 84000 43100 197 -1 -De 0 0 11 0 800 -Po 0 83600 43500 79600 43500 197 -1 -De 0 0 11 0 0 -Po 0 83000 43000 79600 43000 197 -1 -De 0 0 12 0 800 -Po 0 79500 41700 79500 39500 197 -1 -De 15 0 12 0 0 -Po 3 79500 41700 79500 41700 450 -1 -De 15 1 12 0 0 -Po 3 79500 39500 79500 39500 450 -1 -De 15 1 12 0 2 -Po 0 79500 42900 79500 41700 197 -1 -De 0 0 12 0 0 -Po 0 79600 43000 79500 42900 197 -1 -De 0 0 12 0 0 -Po 0 79500 39500 77500 37500 197 -1 -De 0 0 12 0 2 -Po 0 77500 37500 74000 37500 197 -1 -De 0 0 12 0 402 -Po 0 72000 35000 74000 35000 197 -1 -De 0 0 13 0 0 -Po 0 69700 42500 64200 48000 197 -1 -De 15 0 13 0 2 -Po 0 71300 42000 70800 42000 197 -1 -De 0 0 13 0 2 -Po 3 72000 35000 72000 35000 450 -1 -De 15 1 13 0 2 -Po 0 56500 46300 56500 46900 197 -1 -De 0 0 13 0 0 -Po 0 56500 46300 56500 45800 197 -1 -De 0 0 13 0 0 -Po 0 56500 45800 56200 45500 197 -1 -De 0 0 13 0 0 -Po 0 56200 45500 55700 45500 197 -1 -De 0 0 13 0 0 -Po 0 55700 45500 55500 45700 197 -1 -De 0 0 13 0 0 -Po 0 55500 45700 55500 46300 197 -1 -De 0 0 13 0 0 -Po 0 55500 46300 55200 46600 197 -1 -De 0 0 13 0 0 -Po 0 55200 46600 54900 46600 197 -1 -De 0 0 13 0 0 -Po 0 54900 46600 54500 46200 197 -1 -De 0 0 13 0 0 -Po 0 54500 46200 54500 44400 197 -1 -De 0 0 13 0 0 -Po 0 54500 44400 56000 42900 197 -1 -De 0 0 13 0 0 -Po 0 56000 42900 56000 42500 197 -1 -De 0 0 13 0 400 -Po 0 72000 35000 72000 38500 197 -1 -De 15 0 13 0 2 -Po 0 72000 38500 72000 41300 197 -1 -De 15 0 13 0 2 -Po 3 72000 41300 72000 41300 450 -1 -De 15 1 13 0 2 -Po 0 72000 41300 71300 42000 197 -1 -De 0 0 13 0 2 -Po 0 57400 47800 56500 46900 197 -1 -De 0 0 13 0 0 -Po 0 70800 42000 70700 42100 197 -1 -De 0 0 13 0 2 -Po 0 70700 42100 70600 42100 197 -1 -De 0 0 13 0 2 -Po 0 70600 42100 70200 42500 197 -1 -De 0 0 13 0 2 -Po 0 70200 42500 69700 42500 197 -1 -De 0 0 13 0 2 -Po 3 69700 42500 69700 42500 450 -1 -De 15 1 13 0 2 -Po 0 61300 47800 57400 47800 197 -1 -De 0 0 13 0 0 -Po 3 64200 48000 64200 48000 450 -1 -De 15 1 13 0 2 -Po 0 64200 48000 64000 47800 197 -1 -De 0 0 13 0 2 -Po 0 64000 47800 61300 47800 197 -1 -De 0 0 13 0 2 -Po 0 74000 36500 74000 35000 197 -1 -De 0 0 13 0 800 -Po 0 74000 49500 74300 49500 197 -1 -De 0 0 14 0 800 -Po 0 75300 48500 74300 49500 197 -1 -De 0 0 14 0 0 -Po 0 75700 48500 75300 48500 197 -1 -De 0 0 14 0 0 -Po 0 84900 46500 84900 41000 197 -1 -De 0 0 14 0 0 -Po 0 83500 40500 83000 41000 197 -1 -De 0 0 14 0 400 -Po 0 84400 40500 83500 40500 197 -1 -De 0 0 14 0 0 -Po 0 82900 48500 84900 46500 197 -1 -De 0 0 14 0 0 -Po 0 75700 48500 82900 48500 197 -1 -De 0 0 14 0 0 -Po 0 84900 41000 84400 40500 197 -1 -De 0 0 14 0 0 -Po 0 51000 41900 51100 41800 197 -1 -De 0 0 15 0 0 -Po 0 51000 42900 51000 41900 197 -1 -De 0 0 15 0 0 -Po 0 71000 36600 69700 37900 197 -1 -De 0 0 15 0 0 -Po 0 69700 37900 69700 40500 197 -1 -De 0 0 15 0 0 -Po 0 69700 40500 69500 40700 197 -1 -De 0 0 15 0 0 -Po 0 69500 40700 66400 40700 197 -1 -De 0 0 15 0 0 -Po 0 66400 40700 51300 40700 197 -1 -De 0 0 15 0 0 -Po 0 51300 40700 49700 42300 197 -1 -De 0 0 15 0 0 -Po 0 49700 42300 49700 43100 197 -1 -De 0 0 15 0 0 -Po 0 49700 43100 49800 43200 197 -1 -De 0 0 15 0 0 -Po 0 49800 43200 50700 43200 197 -1 -De 0 0 15 0 0 -Po 0 50700 43200 51000 42900 197 -1 -De 0 0 15 0 0 -Po 0 54000 46000 53900 46000 197 -1 -De 0 0 15 0 800 -Po 0 52500 46400 52500 42500 197 -1 -De 0 0 15 0 400 -Po 0 52800 46700 52500 46400 197 -1 -De 0 0 15 0 0 -Po 0 53200 46700 52800 46700 197 -1 -De 0 0 15 0 0 -Po 0 53900 46000 53200 46700 197 -1 -De 0 0 15 0 0 -Po 0 71000 36500 71000 36600 197 -1 -De 0 0 15 0 800 -Po 0 51800 41800 52500 42500 197 -1 -De 0 0 15 0 400 -Po 0 51100 41800 51800 41800 197 -1 -De 0 0 15 0 0 -Po 0 66600 41100 57600 41100 197 -1 -De 0 0 16 0 0 -Po 0 57600 41100 57000 41700 197 -1 -De 0 0 16 0 0 -Po 0 71000 37600 71000 37500 197 -1 -De 0 0 16 0 400 -Po 0 71000 37600 70200 38400 197 -1 -De 0 0 16 0 0 -Po 0 70200 38400 70200 40400 197 -1 -De 0 0 16 0 0 -Po 0 70200 40400 69500 41100 197 -1 -De 0 0 16 0 0 -Po 0 69500 41100 66600 41100 197 -1 -De 0 0 16 0 0 -Po 0 57000 42500 57000 41700 197 -1 -De 0 0 16 0 800 -Po 0 66600 41100 66600 41100 197 -1 -De 0 0 16 0 0 -Po 0 58100 48400 58200 48400 197 -1 -De 0 0 17 0 2 -Po 0 58200 48400 64500 48400 197 -1 -De 0 0 17 0 2 -Po 3 67700 48000 67700 48000 450 -1 -De 15 1 17 0 2 -Po 0 67700 48000 70600 45100 197 -1 -De 15 0 17 0 2 -Po 0 70600 45100 70700 45100 197 -1 -De 15 0 17 0 2 -Po 0 70700 45100 70800 45000 197 -1 -De 15 0 17 0 2 -Po 0 70800 45000 71300 45000 197 -1 -De 15 0 17 0 2 -Po 0 71300 45000 72000 44300 197 -1 -De 15 0 17 0 2 -Po 3 72000 44300 72000 44300 450 -1 -De 15 1 17 0 2 -Po 0 72000 44300 72300 44000 197 -1 -De 0 0 17 0 2 -Po 0 56000 46300 56000 46300 197 -1 -De 0 0 17 0 2 -Po 3 74500 44000 74500 44000 450 -1 -De 15 1 17 0 2 -Po 0 74500 44000 74500 41000 197 -1 -De 15 0 17 0 2 -Po 3 74500 41000 74500 41000 450 -1 -De 15 1 17 0 2 -Po 0 74500 41000 73800 41000 197 -1 -De 0 0 17 0 2 -Po 0 73800 41000 73700 40900 197 -1 -De 0 0 17 0 2 -Po 0 73700 40900 73600 40900 197 -1 -De 0 0 17 0 2 -Po 0 73600 40900 71200 38500 197 -1 -De 0 0 17 0 2 -Po 0 71200 38500 71000 38500 197 -1 -De 0 0 17 0 402 -Po 0 56000 46300 56000 46000 197 -1 -De 0 0 17 0 400 -Po 0 51500 42500 51500 46200 197 -1 -De 0 0 17 0 800 -Po 0 51500 46200 53000 47700 197 -1 -De 0 0 17 0 0 -Po 0 53000 47700 55200 47700 197 -1 -De 0 0 17 0 0 -Po 0 55200 47700 56000 46900 197 -1 -De 0 0 17 0 0 -Po 0 56000 46900 56000 46800 197 -1 -De 0 0 17 0 0 -Po 0 56000 46800 56000 46000 197 -1 -De 0 0 17 0 400 -Po 0 58200 48400 57500 48400 197 -1 -De 0 0 17 0 0 -Po 0 57500 48400 56000 46900 197 -1 -De 0 0 17 0 0 -Po 0 56000 46900 56000 46800 197 -1 -De 0 0 17 0 0 -Po 0 72300 44000 74500 44000 197 -1 -De 0 0 17 0 2 -Po 0 64500 48400 64900 48000 197 -1 -De 0 0 17 0 2 -Po 0 64900 48000 67700 48000 197 -1 -De 0 0 17 0 2 -Po 0 71600 40700 71300 41000 197 -1 -De 0 0 18 0 0 -Po 0 71600 39800 71600 40700 197 -1 -De 0 0 18 0 0 -Po 0 71300 39500 71600 39800 197 -1 -De 0 0 18 0 0 -Po 0 71300 39500 71000 39500 197 -1 -De 0 0 18 0 400 -Po 0 67100 41700 69900 41700 197 -1 -De 0 0 18 0 2 -Po 0 66500 42300 67100 41700 197 -1 -De 0 0 18 0 2 -Po 0 66500 42500 66500 42300 197 -1 -De 0 0 18 0 802 -Po 0 70600 41000 69900 41700 197 -1 -De 0 0 18 0 0 -Po 0 71300 41000 70600 41000 197 -1 -De 0 0 18 0 0 -Po 0 70600 40500 69700 41400 197 -1 -De 0 0 19 0 0 -Po 0 71000 40500 70600 40500 197 -1 -De 0 0 19 0 800 -Po 0 60500 42500 60500 42100 197 -1 -De 15 0 19 0 800 -Po 0 63600 43400 63600 41600 197 -1 -De 0 0 19 0 0 -Po 0 63500 43500 63600 43400 197 -1 -De 0 0 19 0 0 -Po 3 63500 43500 63500 43500 450 -1 -De 15 1 19 0 0 -Po 0 63500 41800 63500 43500 197 -1 -De 15 0 19 0 0 -Po 0 60800 41800 60500 42100 197 -1 -De 15 0 19 0 0 -Po 0 63500 41800 60800 41800 197 -1 -De 15 0 19 0 0 -Po 0 63600 41400 66900 41400 197 -1 -De 0 0 19 0 0 -Po 0 63600 41400 63600 41600 197 -1 -De 0 0 19 0 0 -Po 0 66900 41400 66900 41400 197 -1 -De 0 0 19 0 1 -Po 0 60500 42500 60500 44800 197 -1 -De 0 0 19 0 800 -Po 0 62000 45700 62000 46000 197 -1 -De 0 0 19 0 400 -Po 0 61200 44900 62000 45700 197 -1 -De 0 0 19 0 0 -Po 0 60600 44900 61200 44900 197 -1 -De 0 0 19 0 0 -Po 0 60500 44800 60600 44900 197 -1 -De 0 0 19 0 0 -Po 0 69700 41400 66900 41400 197 -1 -De 0 0 19 0 0 -Po 0 71000 44500 69500 44500 197 -1 -De 0 0 20 0 C02 -Po 0 74400 45100 74800 45500 197 -1 -De 0 0 21 0 2 -Po 0 74800 45500 83300 45500 197 -1 -De 0 0 21 0 2 -Po 0 83300 45500 83800 45000 197 -1 -De 0 0 21 0 2 -Po 0 74200 45000 74300 45100 197 -1 -De 0 0 21 0 2 -Po 0 71500 45000 74200 45000 197 -1 -De 0 0 21 0 2 -Po 0 71000 45500 70500 45000 197 -1 -De 0 0 21 0 802 -Po 0 70500 45000 69000 45000 197 -1 -De 0 0 21 0 2 -Po 0 69000 45000 67700 43700 197 -1 -De 0 0 21 0 2 -Po 0 67700 43700 66500 43700 197 -1 -De 0 0 21 0 2 -Po 3 66500 43700 66500 43700 450 -1 -De 15 1 21 0 2 -Po 0 66500 43700 65500 42700 197 -1 -De 15 0 21 0 2 -Po 0 65500 42700 65500 42500 197 -1 -De 15 0 21 0 402 -Po 0 71000 45500 71500 45000 197 -1 -De 0 0 21 0 802 -Po 0 83800 45000 84000 45000 197 -1 -De 0 0 21 0 402 -Po 0 74300 45100 74400 45100 197 -1 -De 0 0 21 0 2 -Po 0 83000 45000 82000 45000 197 -1 -De 0 0 22 0 800 -Po 0 73200 46500 71000 46500 197 -1 -De 0 0 22 0 402 -Po 0 73600 46100 73200 46500 197 -1 -De 0 0 22 0 2 -Po 0 73700 46100 73600 46100 197 -1 -De 0 0 22 0 2 -Po 0 73800 46000 73700 46100 197 -1 -De 0 0 22 0 2 -Po 0 82000 46000 73800 46000 197 -1 -De 0 0 22 0 2 -Po 0 61500 42500 62000 43000 197 -1 -De 15 0 22 0 802 -Po 0 62000 43000 62000 43200 197 -1 -De 15 0 22 0 2 -Po 0 62000 43200 63700 44900 197 -1 -De 15 0 22 0 2 -Po 3 63700 44900 63700 44900 450 -1 -De 15 1 22 0 2 -Po 0 63700 44900 65300 46500 197 -1 -De 0 0 22 0 2 -Po 0 65300 46500 71000 46500 197 -1 -De 0 0 22 0 402 -Po 0 61500 42500 61500 42200 197 -1 -De 0 0 22 0 800 -Po 0 58000 45000 58000 46000 197 -1 -De 0 0 22 0 400 -Po 0 60000 43000 58000 45000 197 -1 -De 0 0 22 0 0 -Po 0 60000 42000 60000 43000 197 -1 -De 0 0 22 0 0 -Po 0 60300 41700 60000 42000 197 -1 -De 0 0 22 0 0 -Po 0 61000 41700 60300 41700 197 -1 -De 0 0 22 0 0 -Po 0 61500 42200 61000 41700 197 -1 -De 0 0 22 0 0 -Po 3 82000 46000 82000 46000 450 -1 -De 15 1 22 0 2 -Po 0 82000 45000 82000 46000 197 -1 -De 15 0 22 0 0 -Po 3 82000 45000 82000 45000 450 -1 -De 15 1 22 0 0 -Po 0 60000 46000 61500 47500 197 -1 -De 0 0 23 0 802 -Po 0 61500 47500 71000 47500 197 -1 -De 0 0 23 0 402 -Po 3 81200 42000 81200 42000 450 -1 -De 15 1 24 0 2 -Po 0 82700 41500 82200 42000 197 -1 -De 0 0 24 0 2 -Po 3 76700 46500 76700 46500 450 -1 -De 15 1 24 0 2 -Po 0 83500 41500 82700 41500 197 -1 -De 0 0 24 0 2 -Po 0 76200 47000 73800 47000 197 -1 -De 0 0 24 0 2 -Po 0 81200 42000 76700 46500 197 -1 -De 15 0 24 0 2 -Po 0 82200 42000 81200 42000 197 -1 -De 0 0 24 0 2 -Po 0 73700 47100 73600 47100 197 -1 -De 0 0 24 0 2 -Po 0 73600 47100 72200 48500 197 -1 -De 0 0 24 0 2 -Po 0 72200 48500 71000 48500 197 -1 -De 0 0 24 0 402 -Po 0 76700 46500 76200 47000 197 -1 -De 0 0 24 0 2 -Po 0 84000 42000 83500 41500 197 -1 -De 0 0 24 0 802 -Po 0 73800 47000 73700 47100 197 -1 -De 0 0 24 0 2 -Po 0 74300 49000 72200 49000 197 -1 -De 0 0 25 0 0 -Po 0 75100 48200 74300 49000 197 -1 -De 0 0 25 0 0 -Po 0 75300 48200 75100 48200 197 -1 -De 0 0 25 0 0 -Po 0 83500 42500 84500 42500 197 -1 -De 0 0 25 0 0 -Po 0 83000 42000 83500 42500 197 -1 -De 0 0 25 0 800 -Po 0 84600 42600 84600 46400 197 -1 -De 0 0 25 0 0 -Po 0 84600 46400 82800 48200 197 -1 -De 0 0 25 0 0 -Po 0 82800 48200 75300 48200 197 -1 -De 0 0 25 0 0 -Po 0 71700 49500 71000 49500 197 -1 -De 0 0 25 0 400 -Po 0 72200 49000 71700 49500 197 -1 -De 0 0 25 0 0 -Po 0 84500 42500 84600 42600 197 -1 -De 0 0 25 0 0 -Po 0 62400 38600 62425 38600 197 -1 -De 0 0 26 0 402 -Po 0 62400 37833 62400 38600 197 -1 -De 0 0 26 0 802 -Po 0 62400 39400 62500 39500 197 -1 -De 0 0 26 0 402 -Po 0 62400 38600 62400 39400 197 -1 -De 0 0 26 0 2 -Po 0 62833 36174 62800 36200 197 -1 -De 0 0 27 0 802 -Po 0 62800 36200 62800 37000 197 -1 -De 0 0 27 0 2 -Po 0 53500 33800 54100 33800 197 -1 -De 0 0 27 0 C02 -Po 0 55000 36125 55000 36100 197 -1 -De 0 0 27 0 802 -Po 0 55000 36100 55100 36000 197 -1 -De 0 0 27 0 2 -Po 0 55100 36000 55625 36000 197 -1 -De 0 0 27 0 402 -Po 0 67575 35400 67600 35400 197 -1 -De 0 0 27 0 802 -Po 0 67600 35400 67600 36000 197 -1 -De 0 0 27 0 2 -Po 0 62800 37000 62774 36967 197 -1 -De 0 0 27 0 402 -Po 0 67500 36100 67500 36125 197 -1 -De 0 0 27 0 402 -Po 0 64000 28000 65000 28000 197 -1 -De 0 0 27 0 C02 -Po 0 61500 39500 60500 39500 197 -1 -De 0 0 27 0 C02 -Po 0 52500 39500 51500 39500 197 -1 -De 0 0 27 0 C02 -Po 0 64000 28000 63000 28000 197 -1 -De 0 0 27 0 C02 -Po 0 56500 28000 57500 28000 197 -1 -De 0 0 27 0 C02 -Po 0 56500 28000 55500 28000 197 -1 -De 0 0 27 0 C02 -Po 0 61000 36575 61000 37600 197 -1 -De 0 0 27 0 802 -Po 0 61000 37600 60974 37567 197 -1 -De 0 0 27 0 402 -Po 0 58877 24276 58900 24300 197 -1 -De 0 0 27 0 802 -Po 0 58900 24300 60100 24300 197 -1 -De 0 0 27 0 2 -Po 0 60100 24300 60079 24276 197 -1 -De 0 0 27 0 402 -Po 0 58000 36125 58000 35100 197 -1 -De 0 0 27 0 802 -Po 0 58000 35100 58100 35000 197 -1 -De 0 0 27 0 402 -Po 0 53633 35974 53600 36000 197 -1 -De 0 0 27 0 802 -Po 0 53600 36000 53600 36600 197 -1 -De 0 0 27 0 2 -Po 0 53600 36600 53800 36800 197 -1 -De 0 0 27 0 2 -Po 0 53800 36800 53774 36767 197 -1 -De 0 0 27 0 402 -Po 0 51800 36175 51800 36200 197 -1 -De 0 0 27 0 802 -Po 0 51800 36200 51700 36300 197 -1 -De 0 0 27 0 2 -Po 0 51700 36300 50600 36300 197 -1 -De 0 0 27 0 402 -Po 0 51800 36175 51800 37500 197 -1 -De 0 0 27 0 802 -Po 0 51800 37500 51900 37600 197 -1 -De 0 0 27 0 2 -Po 0 51900 37600 51874 37567 197 -1 -De 0 0 27 0 402 -Po 0 53600 36000 53700 36100 197 -1 -De 0 0 27 0 2 -Po 0 53700 36100 55000 36100 197 -1 -De 0 0 27 0 2 -Po 0 61000 36575 61000 36600 197 -1 -De 0 0 27 0 802 -Po 0 61000 36600 60900 36700 197 -1 -De 0 0 27 0 2 -Po 0 60900 36700 59600 36700 197 -1 -De 0 0 27 0 402 -Po 0 64500 36125 64500 34700 197 -1 -De 0 0 27 0 802 -Po 0 64500 34700 64600 34600 197 -1 -De 0 0 27 0 402 -Po 0 62800 36200 62900 36100 197 -1 -De 0 0 27 0 2 -Po 0 62900 36100 64500 36100 197 -1 -De 0 0 27 0 2 -Po 0 64500 36100 64500 36125 197 -1 -De 0 0 27 0 402 -Po 0 64500 36100 64800 35800 197 -1 -De 0 0 27 0 2 -Po 0 64800 35800 65800 35800 197 -1 -De 0 0 27 0 2 -Po 0 65800 35800 65767 35826 197 -1 -De 0 0 27 0 402 -Po 0 53600 36000 53633 35974 197 -1 -De 0 0 27 0 402 -Po 0 65800 35800 65100 35100 197 -1 -De 0 0 27 0 2 -Po 0 67300 34200 68000 34900 197 -1 -De 0 0 27 0 2 -Po 0 66200 34200 67300 34200 197 -1 -De 0 0 27 0 2 -Po 0 66100 34100 66200 34200 197 -1 -De 0 0 27 0 2 -Po 0 65100 34100 66100 34100 197 -1 -De 0 0 27 0 2 -Po 0 65100 35100 65100 34100 197 -1 -De 0 0 27 0 2 -Po 0 68000 34900 68000 35900 197 -1 -De 0 0 27 0 2 -Po 0 67800 36100 67500 36100 197 -1 -De 0 0 27 0 2 -Po 0 68000 35900 67800 36100 197 -1 -De 0 0 27 0 2 -Po 0 69000 31000 69500 31500 197 -1 -De 0 0 27 0 802 -Po 0 69500 31500 69600 31500 197 -1 -De 0 0 27 0 2 -Po 0 69600 31500 70000 31500 197 -1 -De 0 0 27 0 402 -Po 0 68500 24000 68200 24300 197 -1 -De 0 0 27 0 802 -Po 0 68200 24300 66400 24300 197 -1 -De 0 0 27 0 2 -Po 0 66400 24300 66377 24276 197 -1 -De 0 0 27 0 402 -Po 0 68500 24000 71500 24000 197 -1 -De 0 0 27 0 C02 -Po 0 61000 36600 61300 36900 197 -1 -De 0 0 27 0 2 -Po 0 61300 36900 61300 37000 197 -1 -De 0 0 27 0 2 -Po 0 61300 37000 61400 37100 197 -1 -De 0 0 27 0 2 -Po 0 61400 37100 61400 37700 197 -1 -De 0 0 27 0 2 -Po 0 61400 37700 61800 38100 197 -1 -De 0 0 27 0 2 -Po 3 61800 38100 61800 38100 450 -1 -De 15 1 27 0 2 -Po 0 61800 38100 62300 38100 197 -1 -De 15 0 27 0 2 -Po 0 62300 38100 63400 37000 197 -1 -De 15 0 27 0 2 -Po 3 63400 37000 63400 37000 450 -1 -De 15 1 27 0 2 -Po 0 63400 37000 62800 37000 197 -1 -De 0 0 27 0 2 -Po 0 51500 39500 51500 39300 197 -1 -De 0 0 27 0 802 -Po 0 51500 39300 51900 38900 197 -1 -De 0 0 27 0 2 -Po 0 51900 38900 51900 37600 197 -1 -De 0 0 27 0 2 -Po 0 61000 36575 61000 36600 197 -1 -De 0 0 27 0 802 -Po 0 61000 36600 60600 36200 197 -1 -De 0 0 27 0 2 -Po 0 60600 36200 59100 36200 197 -1 -De 0 0 27 0 2 -Po 0 59100 36200 59100 35200 197 -1 -De 0 0 27 0 2 -Po 0 59100 35200 60500 33800 197 -1 -De 0 0 27 0 2 -Po 0 60500 33800 61200 33800 197 -1 -De 0 0 27 0 402 -Po 0 60500 39500 60500 39400 197 -1 -De 0 0 27 0 802 -Po 0 67600 36000 67500 36100 197 -1 -De 0 0 27 0 2 -Po 0 61000 38900 61000 37600 197 -1 -De 0 0 27 0 2 -Po 0 58000 36125 58000 36100 197 -1 -De 0 0 27 0 802 -Po 0 58000 36100 58400 36500 197 -1 -De 0 0 27 0 2 -Po 0 58400 36500 58500 36500 197 -1 -De 0 0 27 0 2 -Po 0 58500 36500 58700 36700 197 -1 -De 0 0 27 0 2 -Po 0 58700 36700 59600 36700 197 -1 -De 0 0 27 0 402 -Po 0 67500 29875 67500 29900 197 -1 -De 0 0 27 0 802 -Po 0 67500 29900 66900 30500 197 -1 -De 0 0 27 0 2 -Po 3 66900 30500 66900 30500 450 -1 -De 15 1 27 0 2 -Po 0 66900 30500 66800 30600 197 -1 -De 15 0 27 0 2 -Po 0 66800 30600 66800 31700 197 -1 -De 15 0 27 0 402 -Po 0 56626 36933 56600 36900 197 -1 -De 0 0 27 0 802 -Po 0 56600 36900 56400 36700 197 -1 -De 0 0 27 0 2 -Po 0 56400 36700 56000 36700 197 -1 -De 0 0 27 0 2 -Po 3 56000 36700 56000 36700 450 -1 -De 15 1 27 0 2 -Po 0 56000 36700 56100 36600 197 -1 -De 15 0 27 0 2 -Po 0 56100 36600 56100 35100 197 -1 -De 15 0 27 0 2 -Po 3 56100 35100 56100 35100 450 -1 -De 15 1 27 0 2 -Po 0 56100 35100 56600 34600 197 -1 -De 0 0 27 0 2 -Po 0 56600 34600 56600 34500 197 -1 -De 0 0 27 0 2 -Po 0 56600 34500 57600 34500 197 -1 -De 0 0 27 0 2 -Po 0 57600 34500 57600 35700 197 -1 -De 0 0 27 0 2 -Po 0 57600 35700 58000 36100 197 -1 -De 0 0 27 0 2 -Po 0 65000 28000 65500 27500 197 -1 -De 0 0 27 0 802 -Po 0 65500 27500 68500 27500 197 -1 -De 0 0 27 0 402 -Po 0 55625 36000 55600 36000 197 -1 -De 0 0 27 0 802 -Po 0 55600 36000 55600 37000 197 -1 -De 0 0 27 0 2 -Po 0 55600 37000 55700 37100 197 -1 -De 0 0 27 0 2 -Po 0 55700 37100 56300 37100 197 -1 -De 0 0 27 0 2 -Po 0 56300 37100 56500 36900 197 -1 -De 0 0 27 0 2 -Po 0 56500 36900 56600 36900 197 -1 -De 0 0 27 0 2 -Po 0 57500 28000 58000 28500 197 -1 -De 0 0 27 0 802 -Po 0 58000 28500 59000 28500 197 -1 -De 0 0 27 0 2 -Po 0 59000 28500 62200 28500 197 -1 -De 0 0 27 0 2 -Po 0 62200 28500 62300 28400 197 -1 -De 0 0 27 0 2 -Po 0 62300 28400 62400 28400 197 -1 -De 0 0 27 0 2 -Po 0 62400 28400 62800 28000 197 -1 -De 0 0 27 0 2 -Po 0 62800 28000 63000 28000 197 -1 -De 0 0 27 0 402 -Po 0 67500 26000 68500 27000 197 -1 -De 15 0 27 0 802 -Po 0 68500 27000 68500 27500 197 -1 -De 15 0 27 0 402 -Po 0 67500 29900 67100 29500 197 -1 -De 0 0 27 0 2 -Po 0 67100 29500 67000 29500 197 -1 -De 0 0 27 0 2 -Po 0 67000 29500 66800 29300 197 -1 -De 0 0 27 0 2 -Po 0 66800 29300 66700 29300 197 -1 -De 0 0 27 0 2 -Po 3 66700 29300 66700 29300 450 -1 -De 15 1 27 0 2 -Po 0 66700 29300 68500 27500 197 -1 -De 15 0 27 0 402 -Po 0 58900 24300 52600 24300 197 -1 -De 0 0 27 0 2 -Po 0 52600 24300 52579 24276 197 -1 -De 0 0 27 0 402 -Po 0 69000 31000 67900 29900 197 -1 -De 0 0 27 0 802 -Po 0 67900 29900 67500 29900 197 -1 -De 0 0 27 0 2 -Po 0 67500 29900 67500 29875 197 -1 -De 0 0 27 0 402 -Po 0 67500 26000 66400 24900 197 -1 -De 15 0 27 0 802 -Po 0 66400 24900 66400 24300 197 -1 -De 15 0 27 0 2 -Po 0 66400 24300 66377 24276 197 -1 -De 15 0 27 0 402 -Po 0 69600 31500 69600 31600 197 -1 -De 0 0 27 0 0 -Po 0 68000 33200 68000 34900 197 -1 -De 0 0 27 0 0 -Po 0 69600 31600 68000 33200 197 -1 -De 0 0 27 0 0 -Po 0 53500 33800 53500 33400 197 -1 -De 15 0 27 0 800 -Po 0 50500 36300 49900 35700 197 -1 -De 15 0 27 0 0 -Po 0 50500 36300 50600 36300 197 -1 -De 15 0 27 0 400 -Po 0 53500 33400 53200 33100 197 -1 -De 15 0 27 0 0 -Po 0 53200 33100 50100 33100 197 -1 -De 15 0 27 0 0 -Po 0 50100 33100 49900 33300 197 -1 -De 15 0 27 0 0 -Po 0 49900 33300 49900 35700 197 -1 -De 15 0 27 0 0 -Po 0 53774 36767 54267 36767 197 -1 -De 0 0 27 0 800 -Po 0 54100 36600 54100 33800 197 -1 -De 15 0 27 0 400 -Po 0 54300 36800 54100 36600 197 -1 -De 15 0 27 0 0 -Po 3 54300 36800 54300 36800 450 -1 -De 15 1 27 0 0 -Po 0 54267 36767 54300 36800 197 -1 -De 0 0 27 0 0 -Po 0 59000 28500 59000 28000 197 -1 -De 0 0 27 0 0 -Po 0 59400 24799 58877 24276 197 -1 -De 15 0 27 0 400 -Po 0 59400 27600 59400 24799 197 -1 -De 15 0 27 0 0 -Po 0 59000 28000 59400 27600 197 -1 -De 15 0 27 0 0 -Po 3 59000 28000 59000 28000 450 -1 -De 15 1 27 0 0 -Po 0 60500 39400 61000 38900 197 -1 -De 0 0 27 0 2 -Po 0 59500 38375 59500 38400 197 -1 -De 0 0 28 0 802 -Po 0 59500 38400 60600 38400 197 -1 -De 0 0 28 0 2 -Po 0 60600 38400 60600 38433 197 -1 -De 0 0 28 0 402 -Po 0 59500 38375 59500 39500 197 -1 -De 0 0 28 0 C02 -Po 0 53400 38400 53400 37633 197 -1 -De 0 0 29 0 402 -Po 0 53400 38400 53400 39400 197 -1 -De 0 0 29 0 2 -Po 0 53400 39400 53500 39500 197 -1 -De 0 0 29 0 402 -Po 0 53425 38400 53400 38400 197 -1 -De 0 0 29 0 802 -Po 0 50500 38400 51500 38400 197 -1 -De 0 0 30 0 2 -Po 0 51500 38400 51500 38433 197 -1 -De 0 0 30 0 402 -Po 0 50500 38375 50500 39500 197 -1 -De 0 0 30 0 C02 -Po 0 50500 38375 50500 38400 197 -1 -De 0 0 30 0 802 -Po 0 53700 43300 54200 43300 197 -1 -De 0 0 31 0 0 -Po 0 53000 44000 53700 43300 197 -1 -De 0 0 31 0 0 -Po 0 53000 46000 53000 44000 197 -1 -De 0 0 31 0 800 -Po 0 54200 43300 55000 42500 197 -1 -De 0 0 31 0 400 -Po 0 56400 44500 55400 44500 197 -1 -De 0 0 32 0 0 -Po 0 58000 42900 56400 44500 197 -1 -De 0 0 32 0 0 -Po 0 55400 44500 55000 44900 197 -1 -De 0 0 32 0 0 -Po 0 55000 44900 55000 46000 197 -1 -De 0 0 32 0 400 -Po 0 58000 42500 58000 42900 197 -1 -De 0 0 32 0 800 -Po 0 57400 36900 57374 36933 197 -1 -De 0 0 33 0 402 -Po 0 58000 38000 58000 36875 197 -1 -De 0 0 33 0 C02 -Po 0 58000 38000 58000 39500 197 -1 -De 15 0 33 0 C02 -Po 0 58000 36900 57400 36900 197 -1 -De 0 0 33 0 2 -Po 0 58000 36875 58000 36900 197 -1 -De 0 0 33 0 802 -Po 0 57000 38000 56000 38000 197 -1 -De 0 0 34 0 C02 -Po 0 65500 38000 66500 38000 197 -1 -De 0 0 34 0 C02 -Po 0 66500 39500 65500 39500 197 -1 -De 0 0 34 0 C02 -Po 0 70000 28500 68500 28500 197 -1 -De 0 0 34 0 C02 -Po 0 65500 38000 65500 39500 197 -1 -De 15 0 34 0 C02 -Po 0 56000 39500 56000 38000 197 -1 -De 15 0 34 0 C02 -Po 0 54175 38400 54200 38400 197 -1 -De 0 0 34 0 802 -Po 0 54200 38400 54300 38500 197 -1 -De 0 0 34 0 2 -Po 0 54300 38500 55300 38500 197 -1 -De 0 0 34 0 2 -Po 0 55300 38500 55800 38000 197 -1 -De 0 0 34 0 2 -Po 0 55800 38000 56000 38000 197 -1 -De 0 0 34 0 402 -Po 0 68500 28500 69000 29000 197 -1 -De 15 0 34 0 802 -Po 0 69000 29000 69000 30000 197 -1 -De 15 0 34 0 402 -Po 0 68500 28500 67900 29100 197 -1 -De 0 0 34 0 802 -Po 0 67900 29100 67500 29100 197 -1 -De 0 0 34 0 2 -Po 0 67500 29100 67500 29125 197 -1 -De 0 0 34 0 402 -Po 0 57000 38000 57500 38500 197 -1 -De 0 0 34 0 802 -Po 0 57500 38500 58300 38500 197 -1 -De 0 0 34 0 2 -Po 0 58300 38500 58400 38400 197 -1 -De 0 0 34 0 2 -Po 0 58400 38400 59200 37600 197 -1 -De 0 0 34 0 2 -Po 0 56000 39500 57000 39500 197 -1 -De 0 0 34 0 C02 -Po 0 59500 37600 59500 37625 197 -1 -De 0 0 34 0 402 -Po 0 65500 38000 64900 38600 197 -1 -De 0 0 34 0 802 -Po 0 64900 38600 63175 38600 197 -1 -De 0 0 34 0 402 -Po 0 54200 38400 54200 39200 197 -1 -De 0 0 34 0 2 -Po 3 54200 39200 54200 39200 450 -1 -De 15 1 34 0 2 -Po 0 54200 39200 54000 39000 197 -1 -De 15 0 34 0 2 -Po 0 54000 39000 54000 38800 197 -1 -De 15 0 34 0 2 -Po 0 54000 38800 50600 38800 197 -1 -De 15 0 34 0 2 -Po 0 50600 38800 49800 38000 197 -1 -De 15 0 34 0 2 -Po 3 49800 38000 49800 38000 450 -1 -De 15 1 34 0 2 -Po 0 49800 38000 50200 37600 197 -1 -De 0 0 34 0 2 -Po 0 50200 37600 50500 37600 197 -1 -De 0 0 34 0 2 -Po 0 50500 37600 50500 37625 197 -1 -De 0 0 34 0 402 -Po 0 62000 28000 61500 27500 197 -1 -De 0 0 34 0 802 -Po 0 54700 28000 54500 28000 197 -1 -De 0 0 34 0 402 -Po 0 55100 27600 54700 28000 197 -1 -De 0 0 34 0 2 -Po 0 55200 27600 55100 27600 197 -1 -De 0 0 34 0 2 -Po 0 55300 27500 55200 27600 197 -1 -De 0 0 34 0 2 -Po 0 61500 27500 55300 27500 197 -1 -De 0 0 34 0 2 -Po 0 70000 28500 70500 28000 197 -1 -De 15 0 34 0 802 -Po 0 70500 28000 70500 27500 197 -1 -De 15 0 34 0 2 -Po 3 70500 27500 70500 27500 450 -1 -De 15 1 34 0 2 -Po 0 70500 27500 70500 27000 197 -1 -De 0 0 34 0 2 -Po 0 70500 27000 71500 26000 197 -1 -De 0 0 34 0 402 -Po 0 67500 29125 67500 28600 197 -1 -De 0 0 34 0 802 -Po 3 66800 28400 66800 28400 450 -1 -De 15 1 34 0 2 -Po 0 67300 28400 66800 28400 197 -1 -De 0 0 34 0 2 -Po 0 67500 28600 67300 28400 197 -1 -De 0 0 34 0 2 -Po 0 66800 28400 66300 28900 197 -1 -De 15 0 34 0 2 -Po 0 66500 35400 66500 38000 197 -1 -De 15 0 34 0 402 -Po 0 66300 35200 66500 35400 197 -1 -De 15 0 34 0 2 -Po 0 66300 28900 66300 35200 197 -1 -De 15 0 34 0 2 -Po 0 58400 38400 58400 38600 197 -1 -De 0 0 34 0 0 -Po 0 63175 40025 63175 38600 197 -1 -De 0 0 34 0 400 -Po 0 63000 40200 63175 40025 197 -1 -De 0 0 34 0 0 -Po 0 59000 40200 63000 40200 197 -1 -De 0 0 34 0 0 -Po 0 58800 40000 59000 40200 197 -1 -De 0 0 34 0 0 -Po 0 58800 39000 58800 40000 197 -1 -De 0 0 34 0 0 -Po 0 58400 38600 58800 39000 197 -1 -De 0 0 34 0 0 -Po 0 62000 28000 62000 27700 197 -1 -De 0 0 34 0 800 -Po 0 66800 27000 66800 28400 197 -1 -De 15 0 34 0 0 -Po 3 66800 27000 66800 27000 450 -1 -De 15 1 34 0 0 -Po 0 66600 26800 66800 27000 197 -1 -De 0 0 34 0 0 -Po 0 62900 26800 66600 26800 197 -1 -De 0 0 34 0 0 -Po 0 62000 27700 62900 26800 197 -1 -De 0 0 34 0 0 -Po 0 59200 37600 59500 37600 197 -1 -De 0 0 34 0 2 -Po 0 54948 35200 54900 35200 197 -1 -De 0 0 35 0 0 -Po 0 54974 35226 54948 35200 197 -1 -De 0 0 35 0 0 -Po 0 55000 38000 55000 39500 197 -1 -De 15 0 35 0 C02 -Po 0 55000 36875 55000 38000 197 -1 -De 0 0 35 0 C02 -Po 0 53633 35226 54974 35226 197 -1 -De 0 0 35 0 800 -Po 0 55000 35300 55000 38000 197 -1 -De 15 0 35 0 400 -Po 0 54900 35200 55000 35300 197 -1 -De 15 0 35 0 0 -Po 3 54900 35200 54900 35200 450 -1 -De 15 1 35 0 0 -Po 0 64500 44500 63800 44500 197 -1 -De 0 0 36 0 0 -Po 0 64500 44500 64500 42500 197 -1 -De 0 0 36 0 400 -Po 0 57000 46400 57700 47100 197 -1 -De 0 0 36 0 0 -Po 0 57700 47100 59200 47100 197 -1 -De 0 0 36 0 0 -Po 0 59200 47100 59500 46800 197 -1 -De 0 0 36 0 0 -Po 0 59500 46800 59500 45800 197 -1 -De 0 0 36 0 0 -Po 0 59500 45800 59900 45400 197 -1 -De 0 0 36 0 0 -Po 0 59900 45400 61200 45400 197 -1 -De 0 0 36 0 0 -Po 0 61200 45400 61500 45700 197 -1 -De 0 0 36 0 0 -Po 0 61500 45700 61500 46300 197 -1 -De 0 0 36 0 0 -Po 0 61500 46300 61700 46500 197 -1 -De 0 0 36 0 0 -Po 0 61700 46500 62200 46500 197 -1 -De 0 0 36 0 0 -Po 0 62200 46500 63000 45700 197 -1 -De 0 0 36 0 0 -Po 0 63000 45700 63000 44500 197 -1 -De 0 0 36 0 0 -Po 0 63000 44500 63800 44500 197 -1 -De 0 0 36 0 0 -Po 0 57000 46000 57000 46400 197 -1 -De 0 0 36 0 800 -Po 0 64700 46600 61600 46600 197 -1 -De 15 0 37 0 0 -Po 0 67500 43800 64700 46600 197 -1 -De 15 0 37 0 0 -Po 0 67500 42500 67500 43800 197 -1 -De 15 0 37 0 800 -Po 0 61600 46600 61000 46000 197 -1 -De 15 0 37 0 400 -Po 0 67500 36875 67500 36900 197 -1 -De 0 0 38 0 802 -Po 0 67500 36875 67500 38000 197 -1 -De 0 0 38 0 C02 -Po 0 67200 36600 65800 36600 197 -1 -De 0 0 38 0 2 -Po 0 65800 36600 65767 36574 197 -1 -De 0 0 38 0 402 -Po 0 67500 36900 67200 36600 197 -1 -De 0 0 38 0 2 -Po 0 67500 38000 67500 39500 197 -1 -De 15 0 38 0 C02 -Po 0 64500 38000 64500 39500 197 -1 -De 15 0 39 0 C02 -Po 0 64500 36875 64500 38000 197 -1 -De 0 0 39 0 C02 -Po 0 64500 36900 63700 37700 197 -1 -De 0 0 39 0 2 -Po 0 63700 37700 63500 37700 197 -1 -De 0 0 39 0 2 -Po 3 63500 37700 63500 37700 450 -1 -De 15 1 39 0 2 -Po 0 63500 37700 63800 37400 197 -1 -De 15 0 39 0 2 -Po 0 63800 37400 63800 36700 197 -1 -De 15 0 39 0 2 -Po 0 63800 36700 63500 36400 197 -1 -De 15 0 39 0 2 -Po 0 63500 36400 63500 35600 197 -1 -De 15 0 39 0 2 -Po 3 63500 35600 63500 35600 450 -1 -De 15 1 39 0 2 -Po 0 63500 35600 63300 35400 197 -1 -De 0 0 39 0 2 -Po 0 63300 35400 62800 35400 197 -1 -De 0 0 39 0 2 -Po 0 62800 35400 62833 35426 197 -1 -De 0 0 39 0 402 -Po 0 64500 36875 64500 36900 197 -1 -De 0 0 39 0 802 -Po 0 57000 36100 56900 36000 197 -1 -De 0 0 40 0 2 -Po 0 56900 36000 56375 36000 197 -1 -De 0 0 40 0 402 -Po 0 57100 35000 57100 33800 197 -1 -De 15 0 40 0 C02 -Po 0 57000 36067 57000 35100 197 -1 -De 0 0 40 0 802 -Po 0 57000 35100 57100 35000 197 -1 -De 0 0 40 0 402 -Po 0 55000 29000 56300 30300 197 -1 -De 0 0 40 0 802 -Po 0 56300 30300 58000 30300 197 -1 -De 0 0 40 0 2 -Po 0 58000 30300 58200 30300 197 -1 -De 0 0 40 0 2 -Po 0 58200 30300 61500 30300 197 -1 -De 0 0 40 0 2 -Po 0 61500 30300 61600 30200 197 -1 -De 0 0 40 0 2 -Po 0 61600 30200 61600 30000 197 -1 -De 0 0 40 0 2 -Po 0 61600 30000 61800 29800 197 -1 -De 0 0 40 0 2 -Po 0 61800 29800 61800 29700 197 -1 -De 0 0 40 0 2 -Po 0 57000 36067 57000 36100 197 -1 -De 0 0 40 0 802 -Po 0 56375 36000 56400 36000 197 -1 -De 0 0 40 0 802 -Po 0 56400 36000 56400 35900 197 -1 -De 0 0 40 0 2 -Po 0 56400 35900 56000 35500 197 -1 -De 0 0 40 0 2 -Po 0 56000 35500 55800 35500 197 -1 -De 0 0 40 0 2 -Po 0 55800 35500 55100 34800 197 -1 -De 0 0 40 0 2 -Po 0 55100 34800 52500 34800 197 -1 -De 0 0 40 0 2 -Po 3 52500 34800 52500 34800 450 -1 -De 15 1 40 0 2 -Po 0 52500 34800 51100 36200 197 -1 -De 15 0 40 0 2 -Po 0 51100 36200 51100 36600 197 -1 -De 15 0 40 0 2 -Po 0 51100 36600 50900 36800 197 -1 -De 15 0 40 0 2 -Po 0 50900 36800 50200 36800 197 -1 -De 15 0 40 0 2 -Po 0 50200 36800 49800 37200 197 -1 -De 15 0 40 0 2 -Po 3 49800 37200 49800 37200 450 -1 -De 15 1 40 0 2 -Po 0 49800 37200 51000 37200 197 -1 -De 0 0 40 0 2 -Po 0 51000 37200 51000 37500 197 -1 -De 0 0 40 0 2 -Po 0 51000 37500 51100 37600 197 -1 -De 0 0 40 0 2 -Po 0 51100 37600 51126 37567 197 -1 -De 0 0 40 0 402 -Po 0 58000 30300 58200 30100 197 -1 -De 0 0 40 0 0 -Po 0 57100 32600 57100 33800 197 -1 -De 15 0 40 0 400 -Po 0 58200 31500 57100 32600 197 -1 -De 15 0 40 0 0 -Po 0 58200 30100 58200 31500 197 -1 -De 15 0 40 0 0 -Po 3 58200 30100 58200 30100 450 -1 -De 15 1 40 0 0 -Po 0 61800 29700 62500 29000 197 -1 -De 0 0 40 0 402 -Po 0 66800 35400 66825 35400 197 -1 -De 0 0 41 0 402 -Po 0 66800 35400 66800 36000 197 -1 -De 0 0 41 0 2 -Po 0 66800 36000 66600 36200 197 -1 -De 0 0 41 0 2 -Po 0 66600 36200 66633 36200 197 -1 -De 0 0 41 0 402 -Po 0 66800 34700 66700 34600 197 -1 -De 0 0 41 0 802 -Po 0 66700 34600 65600 34600 197 -1 -De 0 0 41 0 402 -Po 0 56000 29000 56500 28500 197 -1 -De 0 0 41 0 802 -Po 0 62200 29900 62000 30100 197 -1 -De 15 0 41 0 0 -Po 0 62200 29900 62400 29900 197 -1 -De 15 0 41 0 0 -Po 3 62400 29900 62400 29900 450 -1 -De 15 1 41 0 2 -Po 0 60900 29000 62000 30100 197 -1 -De 15 0 41 0 2 -Po 0 60800 29000 60900 29000 197 -1 -De 15 0 41 0 2 -Po 3 60800 29000 60800 29000 450 -1 -De 15 1 41 0 2 -Po 0 57800 29000 60800 29000 197 -1 -De 0 0 41 0 2 -Po 0 57400 28600 57800 29000 197 -1 -De 0 0 41 0 2 -Po 0 57300 28600 57400 28600 197 -1 -De 0 0 41 0 2 -Po 0 57200 28500 57300 28600 197 -1 -De 0 0 41 0 2 -Po 0 56500 28500 57200 28500 197 -1 -De 0 0 41 0 2 -Po 0 62400 29900 63300 29000 197 -1 -De 0 0 41 0 2 -Po 0 63300 29000 63500 29000 197 -1 -De 0 0 41 0 402 -Po 0 63500 29000 64000 28500 197 -1 -De 0 0 41 0 802 -Po 0 64000 28500 65500 28500 197 -1 -De 0 0 41 0 2 -Po 0 65500 28500 65600 28400 197 -1 -De 0 0 41 0 2 -Po 0 65600 28400 65700 28400 197 -1 -De 0 0 41 0 2 -Po 3 65700 28400 65700 28400 450 -1 -De 15 1 41 0 2 -Po 0 65700 28400 65600 28500 197 -1 -De 15 0 41 0 2 -Po 0 65600 28500 65600 34600 197 -1 -De 15 0 41 0 402 -Po 0 60226 37567 60226 37526 197 -1 -De 0 0 41 0 800 -Po 0 62400 32800 62400 29900 197 -1 -De 0 0 41 0 0 -Po 0 62000 33200 62400 32800 197 -1 -De 0 0 41 0 0 -Po 0 58900 33200 62000 33200 197 -1 -De 0 0 41 0 0 -Po 0 58800 33300 58900 33200 197 -1 -De 0 0 41 0 0 -Po 3 58800 33300 58800 33300 450 -1 -De 15 1 41 0 0 -Po 0 58800 37200 58800 33300 197 -1 -De 15 0 41 0 0 -Po 3 58800 37200 58800 37200 450 -1 -De 15 1 41 0 0 -Po 0 59900 37200 58800 37200 197 -1 -De 0 0 41 0 0 -Po 0 60226 37526 59900 37200 197 -1 -De 0 0 41 0 0 -Po 0 66800 34700 66800 35400 197 -1 -De 0 0 41 0 802 -Po 0 61000 35800 61000 35825 197 -1 -De 0 0 42 0 402 -Po 0 61967 35800 62000 35800 197 -1 -De 0 0 42 0 802 -Po 0 62000 35800 62000 37000 197 -1 -De 0 0 42 0 2 -Po 0 62000 37000 62026 36967 197 -1 -De 0 0 42 0 402 -Po 0 61000 35800 60900 35700 197 -1 -De 0 0 42 0 2 -Po 0 60900 35700 59600 35700 197 -1 -De 0 0 42 0 402 -Po 0 61500 29000 61500 29600 197 -1 -De 0 0 42 0 802 -Po 0 61500 29600 61200 29900 197 -1 -De 0 0 42 0 2 -Po 3 61200 29900 61200 29900 450 -1 -De 15 1 42 0 2 -Po 0 61200 29900 61200 30800 197 -1 -De 15 0 42 0 402 -Po 0 61200 30800 60700 31300 197 -1 -De 15 0 42 0 802 -Po 0 60700 31300 60700 35100 197 -1 -De 15 0 42 0 2 -Po 3 60700 35100 60700 35100 450 -1 -De 15 1 42 0 2 -Po 0 60700 35100 60700 35500 197 -1 -De 0 0 42 0 2 -Po 0 60700 35500 61000 35800 197 -1 -De 0 0 42 0 2 -Po 0 61000 35800 61000 35825 197 -1 -De 0 0 42 0 402 -Po 0 61500 29000 61000 29500 197 -1 -De 0 0 42 0 802 -Po 0 61000 29500 60900 29500 197 -1 -De 0 0 42 0 2 -Po 0 60900 29500 60600 29800 197 -1 -De 0 0 42 0 2 -Po 0 60600 29800 59900 29800 197 -1 -De 0 0 42 0 2 -Po 3 59900 29800 59900 29800 450 -1 -De 15 1 42 0 2 -Po 0 59900 29800 58900 30800 197 -1 -De 15 0 42 0 2 -Po 3 58900 30800 58900 30800 450 -1 -De 15 1 42 0 2 -Po 0 58900 30800 58700 30600 197 -1 -De 0 0 42 0 2 -Po 0 58700 30600 56100 30600 197 -1 -De 0 0 42 0 2 -Po 0 56100 30600 55000 29500 197 -1 -De 0 0 42 0 2 -Po 0 55000 29500 54800 29500 197 -1 -De 0 0 42 0 2 -Po 0 54800 29500 54700 29400 197 -1 -De 0 0 42 0 2 -Po 0 54700 29400 54600 29400 197 -1 -De 0 0 42 0 2 -Po 0 54600 29400 54200 29000 197 -1 -De 0 0 42 0 2 -Po 0 54200 29000 54000 29000 197 -1 -De 0 0 42 0 402 -Po 0 61967 35800 61000 35800 197 -1 -De 0 0 42 0 802 -Po 0 77000 30000 75000 30000 197 -1 -De 0 0 43 0 C00 -Po 0 68500 23000 67500 23000 197 -1 -De 0 0 44 0 C02 -Po 0 69500 24000 69500 27500 197 -1 -De 15 0 44 0 402 -Po 0 68500 23000 69500 24000 197 -1 -De 15 0 44 0 802 -Po 0 51800 35425 51800 35400 197 -1 -De 0 0 45 0 802 -Po 0 51700 35300 50600 35300 197 -1 -De 0 0 45 0 402 -Po 0 52767 35600 52800 35600 197 -1 -De 0 0 45 0 802 -Po 0 52800 35600 52600 35400 197 -1 -De 0 0 45 0 2 -Po 0 52600 35400 51800 35400 197 -1 -De 0 0 45 0 2 -Po 0 52800 35600 52800 36600 197 -1 -De 0 0 45 0 2 -Po 0 52800 36600 53000 36800 197 -1 -De 0 0 45 0 2 -Po 0 53000 36800 53026 36767 197 -1 -De 0 0 45 0 402 -Po 0 50600 35300 50500 35200 197 -1 -De 15 0 45 0 802 -Po 0 50500 35200 50500 33800 197 -1 -De 15 0 45 0 402 -Po 0 57000 29000 57400 29400 197 -1 -De 0 0 45 0 802 -Po 0 57400 29400 57500 29500 197 -1 -De 0 0 45 0 2 -Po 0 57500 29500 59300 29500 197 -1 -De 0 0 45 0 2 -Po 3 59300 29500 59300 29500 450 -1 -De 15 1 45 0 2 -Po 3 63200 29900 63200 29900 450 -1 -De 15 1 45 0 2 -Po 0 59300 29500 59300 29000 197 -1 -De 15 0 45 0 0 -Po 0 59800 28500 59300 29000 197 -1 -De 15 0 45 0 0 -Po 0 62800 28500 59800 28500 197 -1 -De 15 0 45 0 0 -Po 0 63000 28700 62800 28500 197 -1 -De 15 0 45 0 0 -Po 0 63000 29300 63000 28700 197 -1 -De 15 0 45 0 0 -Po 0 63200 29500 63000 29300 197 -1 -De 15 0 45 0 0 -Po 0 63200 29900 63200 29500 197 -1 -De 15 0 45 0 0 -Po 0 64300 29000 64500 29000 197 -1 -De 0 0 45 0 402 -Po 0 63900 29400 64300 29000 197 -1 -De 0 0 45 0 2 -Po 0 63800 29400 63900 29400 197 -1 -De 0 0 45 0 2 -Po 0 63700 29500 63800 29400 197 -1 -De 0 0 45 0 2 -Po 0 63600 29500 63700 29500 197 -1 -De 0 0 45 0 2 -Po 0 63200 29900 63600 29500 197 -1 -De 0 0 45 0 2 -Po 0 57400 29400 57400 29900 197 -1 -De 0 0 45 0 0 -Po 0 51100 33200 50500 33800 197 -1 -De 0 0 45 0 400 -Po 0 57400 33200 51100 33200 197 -1 -De 0 0 45 0 0 -Po 0 57400 31100 57400 33200 197 -1 -De 0 0 45 0 0 -Po 3 57400 31100 57400 31100 450 -1 -De 15 1 45 0 0 -Po 0 57400 29900 57400 31100 197 -1 -De 15 0 45 0 0 -Po 3 57400 29900 57400 29900 450 -1 -De 15 1 45 0 0 -Po 0 51800 35400 51700 35300 197 -1 -De 0 0 45 0 2 -Po 0 80500 39500 84000 39500 197 -1 -De 0 0 46 0 0 -Po 0 84000 39500 84000 40000 197 -1 -De 0 0 46 0 400 -Po 0 75000 37000 78000 37000 197 -1 -De 0 0 46 0 0 -Po 0 78000 37000 80500 39500 197 -1 -De 0 0 46 0 0 -Po 0 75000 34000 75000 37000 197 -1 -De 0 0 46 0 800 -Po 0 61000 49625 61000 49000 197 -1 -De 0 0 47 0 C02 -Po 0 53000 49625 53000 49000 197 -1 -De 0 0 48 0 C02 -Po 0 54000 49625 54000 49000 197 -1 -De 0 0 49 0 C02 -Po 0 55000 49000 55000 49625 197 -1 -De 0 0 50 0 C02 -Po 0 56000 49625 56000 49000 197 -1 -De 0 0 51 0 C02 -Po 0 57000 49625 57000 49000 197 -1 -De 0 0 52 0 C02 -Po 0 58000 49625 58000 49000 197 -1 -De 0 0 53 0 C02 -Po 0 59000 49625 59000 49000 197 -1 -De 0 0 54 0 C02 -Po 0 60000 49625 60000 49000 197 -1 -De 0 0 55 0 C02 -Po 0 62000 49000 62000 49625 197 -1 -De 0 0 56 0 C02 -$EndTRACK -$ZONE -$EndZONE -$EndBOARD diff --git a/scripts/pcb-dr-adjust/howto.txt b/scripts/pcb-dr-adjust/howto.txt deleted file mode 100644 index 213c6e5189..0000000000 --- a/scripts/pcb-dr-adjust/howto.txt +++ /dev/null @@ -1,27 +0,0 @@ -Dr:: 0,400,400; -ShC:: 0,700,600,0,900,900 -ShR:: 0,0,0,0,0,0 -ShO:: 0,0,0,0,0,0 -Vias:: 0,700,600,0,400,400 -infile: example.brd -outfile: processed.brd - -1. edit a copy of configuration file 'pcb-dr-adjust.cfg' in project folder - a. Dr:: from,to,result:from_2,to_2,result_2 - Replaces all drills (from...to] with 'result' value - b. Sh[C,R,O]:[|locked]: fromX,toX,resultX,fromY,toY,resultY; e.t.c. - C,R,O - different types of pads - locked/unlocked - process X and Y only if both checks match/independently - c. Vias:: the same as Shapes - d. infile: your_board_filename - e. outfile: your_out_filename - Should be not the same as infile now. -2. run pcb-dr-adjust.pl. Under Windows - download ActivePerl from http://activestate.com - Undex *nix - chmod 755 pcb-dr-adjust.cfg, execute "./pcb-dr-adjust.pl" or "path-to-svn/scripts/pcb-dr-adjust/pcb-dr-adjust.pl" -3. take a look at outfile and rename it manually if correct. - - -P.S. Next release I will add "make install" to *nix,*win32 makefiles to install it to bin folder. - I will try to make this tool as good as time permit. Any contributions welcome! - -Enjoy! \ No newline at end of file diff --git a/scripts/pcb-dr-adjust/pcb-dr-adjust.cfg b/scripts/pcb-dr-adjust/pcb-dr-adjust.cfg deleted file mode 100644 index 7e5a5d6f55..0000000000 --- a/scripts/pcb-dr-adjust/pcb-dr-adjust.cfg +++ /dev/null @@ -1,7 +0,0 @@ -Dr:: 0,400,400; -ShC:: 0,700,600,0,900,900 -ShR:: 0,0,0,0,0,0 -ShO:: 0,0,0,0,0,0 -Vias:: 0,700,600,0,400,400 -infile: example.brd -outfile: processed.brd \ No newline at end of file diff --git a/scripts/pcb-dr-adjust/pcb-dr-adjust.pl b/scripts/pcb-dr-adjust/pcb-dr-adjust.pl deleted file mode 100644 index b50eec9996..0000000000 --- a/scripts/pcb-dr-adjust/pcb-dr-adjust.pl +++ /dev/null @@ -1,147 +0,0 @@ -#!/usr/bin/perl -w -# version:0.01 -# Script is written by Vladimir Kalyaev. You can copy and modify it, but -# this header should remain unchanged if any part of code is taken. Use -# it gently AS-IS without any warranties. -# Dedicated to my daughter Jacy. - -open FH, "<pcb-dr-adjust.cfg" || die "can't load configuration file pcb-dr-adjust.cfg\n"; -$totalBins=0; -print "Type\tLocked\tBin\tXmin\tXmax\tXnew\tYmin\tYmax\tYnew\n"; -#$prev=0; -#@bins=(); - -$inp{"Dr"}[0] = qr!^(Dr\s+)(\d+)(\s+)(\d+)(\s+.*)$!; -$inp{"ShC"}[0] = qr!^(Sh\s+\"\d+\"\s+C\s+)(\d+)(\s+)(\d+)(\s+.*)$!; -$inp{"ShR"}[0] = qr!^(Sh\s+\"\d+\"\s+R\s+)(\d+)(\s+)(\d+)(\s+.*)$!; -$inp{"ShO"}[0] = qr!^(Sh\s+\"\d+\"\s+O\s+)(\d+)(\s+)(\d+)(\s+.*)$!; -$inp{"Vias"}[0] = qr!^(Po\s+\d+\s+\d+\s+\d+\s+\d+\s+\d+\s+)(\d+)(\s+)(\d+)(.*)$!; -#my ($pref,$curX,$space,$curY,$rest)=($1,$2,$3,$4,$5); - -#< Po 3 72000 42500 72000 42500 450 450 -#--- -#> Po 3 72000 42500 72000 42500 620 450 - -while (<FH>) -{ - s!\s+$!!; - $line=$_; - if ($line=~s!.*(Dr)::\s*!!) - { - $totalBins=3; $type=$1; $locked="u"; # Dr cant be "locked"! - while ($line=~m!(\d+),(\d+),(\d+)!g) - { - $inp{$type}[$totalBins]=[$1, $2, $3, 0, 0, 0]; - $inp{$type}[1]=$locked; - print "$type\t$inp{$type}[1]\t$totalBins\t$inp{$type}[$totalBins]->[0]\t$inp{$type}[$totalBins]->[1]\t$inp{$type}[$totalBins]->[2]\n"; - $totalBins++; - } - $inp{$type}[2]=$totalBins-1; $inp{$type}[1]=$locked; - } - if ($line =~s!.*(Sh.|Vias):(.?):\s*!!) - { - $totalBins=3; $type=$1; - if (defined $2) {$locked = $2;}; - if ($locked =~ m!^\s*$!) {$locked="u";}; - - while ($line=~m!(\d+),(\d+),(\d+),(\d+),(\d+),(\d+)!g) - { - $inp{$type}[1]=$locked; - $inp{$type}[$totalBins]=[$1, $2, $3, $4, $5, $6]; - print "$type\t$inp{$type}[1]\t$totalBins\t$inp{$type}[$totalBins]->[0]\t$inp{$type}[$totalBins]->[1]\t$inp{$type}[$totalBins]->[2]\t$inp{$type}[$totalBins]->[3]\t$inp{$type}[$totalBins]->[4]\t$inp{$type}[$totalBins]->[5]\n"; - $totalBins++; - } - $inp{$type}[2]=$totalBins-1; $inp{$type}[1]=$locked; - } - if ($line =~ s!infile:\s*(.+?)\s*$!!) - { - $infile=$1; - } - if ($line =~ s!outfile:\s*(.+?)\s*$!!) - { - $outfile=$1; - } -} -#Sh "1" C 1600 1600 0 0 0 -#Sh "1" R 550 550 0 0 900 -#R/C/O -#Dr 1200 0 0 -if (!defined $infile) { $infile = "<example.brd";} else {$infile="<$infile";}; -if (!defined $outfile) { $outfile = ">processed.brd";} else {$outfile=">$outfile";}; - -open FH, $infile || die "can't read inputfile ==$infile==\n"; -open FHout, $outfile || die "can't open outfile ==$outfile==\n"; -while (<FH>) -{ -#print "before:$_|\n"; - s!\s+$!!; - #chomp();# chop(); - $curline=$_; -#print "after :$_|\n"; - foreach $key (sort keys %inp) - { -# print "proc key:$key\n"; - if ($_ =~ $inp{$key}[0]) - { -# print "proc key:$key\n"; -#Sh "6" C 550 550 0 0 900 -#Sh "6" C ,550, ,550, 0 0 900 -#Dr 320 0 0 -#Dr ,320, ,0, 0 -#$inp{"ShC"}[0] = qr!^(Sh\s+\"\d+\"\s+C\s+)(\d+)(\s+)(\d+)(\s+.*)$!; - my ($pref,$curX,$space,$curY,$rest)=($1,$2,$3,$4,$5); -# print "inp{$key}=$inp{$key}[0]\n"; -# print "$curline\n"; -# print "$1,$2,$3,$4,$5\n"; -#-------------------------------- - -#0 - regexp -#1 - locked -#2 - totalBins -#3=>[1,2,3,4,5,6] - bins -#4=>.... -#5=>.... - - $index=3; - $flagX=0; $flagY=0; - $newX =0; $newY =0; -# $curline = "bef:$pref,$curX,$space,$curY,$rest. locked=$inp{$key}[1], totalBins=$inp{$key}[2]\n"; -# print $curline; - - while ( ($index < $inp{$key}[2]+1) ) - { - if (($flagX == 0) && ($curX > $inp{$key}[$index]->[0]) && ($curX <= $inp{$key}[$index]->[1]) ) - { - $flagX=1; $newX=$inp{$key}[$index]->[2]; - if ($inp{$key}[1] =~ m!l!i) { } else {$curX=$newX;}; - } - - if (($flagY == 0) && ($curY > $inp{$key}[$index]->[3]) && ($curY <= $inp{$key}[$index]->[4]) ) - { - $flagY=1; $newY=$inp{$key}[$index]->[5]; - if ($inp{$key}[1] =~ m!l!i) { } else {$curY=$newY;}; - } - - if (($inp{$key}[1] =~ m!l!i) && ($flagX =~ m!1!) && ($flagY =~ m!1!)) - { - # This section means LOCKED = change together only - $curX=$newX; - $curY=$newY; - } - $index ++; - } - -#-------------------------------- -# $curline = "aft:$pref,$curX,$space,$curY,$rest.\n"; -# print $curline; - $curline = "$pref$curX$space$curY$rest"; - } - } - print FHout "$curline\n"; -} -#$local = "TR|PL|EX|TQ|TA|SN|BA|BS|DT|BH|GL"; -#$pcode = qr/^\s*($local)\d\w?\s+\d[A-Z]{2}\s*$/; -#@vcheck = ("SN12 6QL","G3 7XR","GLZ 7PX"," OX11 0EY","NW1 1AD"); -#foreach $tp (@vcheck) { -# $tp =~ $pcode and print "$1\n"; -# } \ No newline at end of file diff --git a/scripts/setfont.sh b/scripts/setfont.sh deleted file mode 100755 index 871f059872..0000000000 --- a/scripts/setfont.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh - -# Copyright 2007 SoftPLC Corporation -# dick@softplc.com - - -# This script can operate on a *.brd file or a *.mod file and serves three purposes: -# 1) it resizes all the fonts to XSIZE and YSIZE -# 2) it sets the pen width of the fonts to PENWIDTH -# 3) it sets the "value" fields in all modules to "invisible" - -# The two steps above correspond to the two regular expressions in the sed -# invocation below. - - -#----<configuration>---------------------------------------------------- - -# tenths of mils, e.g. 400 = .0400 inches -XSIZE=300 -YSIZE=350 - -# tenths of mils -PENWIDTH=60 - -#----</configuration>-------------------------------------------------- - - - -if [ $# -ne 1 ]; then - echo "usage: $0 <boardfile.brd>" - exit 1 -fi - - -sed \ --e "s/^\(T[0-9] -*[0-9]\{1,6\}\ -*[0-9]\{1,6\}\) -*[0-9]\{1,6\} -*[0-9]\{1,6\} \(-*[0-9]\{1,6\}\) [0-9]\{1,6\} \([NM] [IV] -*[0-9]\{1,6\} .*\)/\1 $YSIZE $XSIZE \2 $PENWIDTH \3/" \ --e "s/^\(T1 -*[0-9]\{1,6\}\ -*[0-9]\{1,6\} -*[0-9]\{1,6\} -*[0-9]\{1,6\} -*[0-9]\{1,6\} [0-9]\{1,6\} [NM]\) [IV] \(-*[0-9]\{1,6\} .*\)/\1 I \2/" \ -$1 > out.tmp - -# delete original and rename out.tmp to original -rm $1 -mv out.tmp $1 -