From da45f02f6ad93e7d9e1be26645df38e665612f5c Mon Sep 17 00:00:00 2001 From: Marco Mattila Date: Mon, 28 May 2012 23:01:51 +0300 Subject: [PATCH 01/17] Move pcbnew find dialog into dialogs subdirectory and use wxFormBuilder for it. --- include/wxBasePcbFrame.h | 5 +- include/wxPcbStruct.h | 2 +- pcbnew/CMakeLists.txt | 3 +- pcbnew/basepcbframe.cpp | 13 +- pcbnew/dialogs/dialog_find.cpp | 212 +++++++++ pcbnew/dialogs/dialog_find_base.cpp | 69 +++ pcbnew/dialogs/dialog_find_base.fbp | 681 ++++++++++++++++++++++++++++ pcbnew/dialogs/dialog_find_base.h | 58 +++ pcbnew/edit.cpp | 2 +- pcbnew/find.cpp | 380 ---------------- pcbnew/find.h | 126 ----- 11 files changed, 1035 insertions(+), 516 deletions(-) create mode 100644 pcbnew/dialogs/dialog_find.cpp create mode 100644 pcbnew/dialogs/dialog_find_base.cpp create mode 100644 pcbnew/dialogs/dialog_find_base.fbp create mode 100644 pcbnew/dialogs/dialog_find_base.h delete mode 100644 pcbnew/find.cpp delete mode 100644 pcbnew/find.h diff --git a/include/wxBasePcbFrame.h b/include/wxBasePcbFrame.h index b9e22ac5f4..e0c1596723 100644 --- a/include/wxBasePcbFrame.h +++ b/include/wxBasePcbFrame.h @@ -238,9 +238,10 @@ public: * Function CursorGoto * positions the cursor at a given coordinate and reframes the drawing if the * requested point is out of view. - * @param aPos The point to go to. + * @param aPos is the point to go to. + * @param aWarp is true if the pointer should be warped to the new position. */ - void CursorGoto( const wxPoint& aPos ); + void CursorGoto( const wxPoint& aPos, bool aWarp = true ); /** * Function Save_Module_In_Library diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index daf0211155..e550c18f6e 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -1488,7 +1488,7 @@ public: void Clean_Pcb( wxDC* DC ); - void InstallFindFrame( const wxPoint& pos, wxDC* DC ); + void InstallFindFrame(); /** * Function SendMessageToEESCHEMA diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 7a93d5f7ed..dbe64d2766 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -39,6 +39,8 @@ set(PCBNEW_DIALOGS dialogs/dialog_edit_module_text_base.cpp dialogs/dialog_exchange_modules_base.cpp dialogs/dialog_export_3Dfiles_base.cpp + dialogs/dialog_find_base.cpp + dialogs/dialog_find.cpp dialogs/dialog_freeroute_exchange.cpp dialogs/dialog_freeroute_exchange_base.cpp dialogs/dialog_gendrill.cpp @@ -123,7 +125,6 @@ set(PCBNEW_SRCS export_gencad.cpp export_vrml.cpp files.cpp - find.cpp gen_drill_report_files.cpp gen_holes_and_tools_lists_for_drill.cpp gen_modules_placefile.cpp diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index 6cfbdb02bb..87eecffca8 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -266,28 +266,31 @@ double PCB_BASE_FRAME::BestZoom() } -void PCB_BASE_FRAME::CursorGoto( const wxPoint& aPos ) +void PCB_BASE_FRAME::CursorGoto( const wxPoint& aPos, bool aWarp ) { // factored out of pcbnew/find.cpp PCB_SCREEN* screen = (PCB_SCREEN*)GetScreen(); - wxClientDC dc( m_canvas ); + INSTALL_UNBUFFERED_DC( dc, m_canvas ); // There may be need to reframe the drawing. if( !m_canvas->IsPointOnDisplay( aPos ) ) { screen->SetCrossHairPosition( aPos ); - RedrawScreen( aPos, true ); + RedrawScreen( aPos, aWarp ); } else { // Put cursor on item position m_canvas->CrossHairOff( &dc ); screen->SetCrossHairPosition( aPos ); - m_canvas->MoveCursorToCrossHair(); - m_canvas->CrossHairOn( &dc ); + + if( aWarp ) + m_canvas->MoveCursorToCrossHair(); } + m_canvas->CrossHairOn( &dc ); + m_canvas->CrossHairOn( &dc ); } diff --git a/pcbnew/dialogs/dialog_find.cpp b/pcbnew/dialogs/dialog_find.cpp new file mode 100644 index 0000000000..bfa29d3b42 --- /dev/null +++ b/pcbnew/dialogs/dialog_find.cpp @@ -0,0 +1,212 @@ +/* + * This program source code file is part of KICAD, a free EDA CAD application. + * + * Copyright (C) 1992-2012 Marco Mattila + * Copyright (C) 1992-2012 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 + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + + +class DIALOG_FIND : public DIALOG_FIND_BASE +{ +public: + DIALOG_FIND( PCB_BASE_FRAME* aParent ); + +private: + PCB_BASE_FRAME* parent; + + int itemCount, markerCount; + static wxString prevSearchString; + static bool warpMouse; + + static wxPoint prevPosition; + static wxSize prevSize; + + void onButtonFindItemClick( wxCommandEvent& event ); + void onButtonFindMarkerClick( wxCommandEvent& event ); + void onButtonCloseClick( wxCommandEvent& event ); + void onClose( wxCloseEvent& event ); +}; + + +// Initialize static member variables +wxPoint DIALOG_FIND::prevPosition( -1, -1 ); +wxSize DIALOG_FIND::prevSize; +wxString DIALOG_FIND::prevSearchString; +bool DIALOG_FIND::warpMouse = true; + + +DIALOG_FIND::DIALOG_FIND( PCB_BASE_FRAME* aParent ) : DIALOG_FIND_BASE( aParent ) +{ + parent = aParent; + SetFocus(); + GetSizer()->SetSizeHints( this ); + + m_SearchTextCtrl->AppendText( prevSearchString ); + m_NoMouseWarpCheckBox->SetValue( !warpMouse ); + + itemCount = markerCount = 0; + + if( prevPosition.x != -1 ) + SetSize( prevPosition.x, prevPosition.y, + prevSize.x, prevSize.y ); + else + Center(); +} + + +void DIALOG_FIND::onButtonCloseClick( wxCommandEvent& aEvent ) +{ + Close( true ); +} + + +void DIALOG_FIND::onButtonFindItemClick( wxCommandEvent& aEvent ) +{ + PCB_SCREEN* screen = (PCB_SCREEN*) ( parent->GetScreen() ); + wxPoint pos; + BOARD_ITEM* foundItem = 0; + + wxString searchString = m_SearchTextCtrl->GetValue(); + + if( !searchString.IsSameAs( prevSearchString, false ) ) + { + itemCount = 0; + } + prevSearchString = searchString; + + parent->GetCanvas()->GetViewStart( &screen->m_StartVisu.x, &screen->m_StartVisu.y ); + + int count = 0; + + for( MODULE* module = parent->GetBoard()->m_Modules; module; module = module->Next() ) + { + if( WildCompareString( searchString, module->GetReference().GetData(), false ) ) + { + count++; + + if( count > itemCount ) + { + foundItem = module; + pos = module->GetPosition(); + itemCount++; + break; + } + } + + if( WildCompareString( searchString, module->m_Value->m_Text.GetData(), false ) ) + { + count++; + + if( count > itemCount ) + { + foundItem = module; + pos = module->m_Pos; + itemCount++; + break; + } + } + } + + wxString msg; + if( foundItem ) + { + parent->SetCurItem( foundItem ); + msg.Printf( _( "<%s> found" ), GetChars( searchString ) ); + parent->SetStatusText( msg ); + + parent->CursorGoto( pos, !m_NoMouseWarpCheckBox->IsChecked() ); + } + else + { + parent->SetStatusText( wxEmptyString ); + msg.Printf( _( "<%s> not found" ), GetChars( searchString ) ); + DisplayError( this, msg, 10 ); + itemCount = 0; + } +} + + +void DIALOG_FIND::onButtonFindMarkerClick( wxCommandEvent& aEvent ) +{ + PCB_SCREEN* screen = (PCB_SCREEN*) ( parent->GetScreen() ); + wxPoint pos; + BOARD_ITEM* foundItem = 0; + + parent->GetCanvas()->GetViewStart( &screen->m_StartVisu.x, &screen->m_StartVisu.y ); + + MARKER_PCB* marker = parent->GetBoard()->GetMARKER( markerCount++ ); + + if( marker ) + { + foundItem = marker; + pos = marker->GetPosition(); + } + + wxString msg; + if( foundItem ) + { + parent->SetCurItem( foundItem ); + msg = _( "Marker found" ); + parent->SetStatusText( msg ); + + parent->CursorGoto( pos, !m_NoMouseWarpCheckBox->IsChecked() ); + } + else + { + parent->SetStatusText( wxEmptyString ); + msg = _( "No marker found" ); + DisplayError( this, msg, 10 ); + markerCount = 0; + } +} + + +void DIALOG_FIND::onClose( wxCloseEvent& aEvent ) +{ + prevPosition = GetPosition(); + prevSize = GetSize(); + warpMouse = !m_NoMouseWarpCheckBox->IsChecked(); + + EndModal( 1 ); +} + + +void PCB_EDIT_FRAME::InstallFindFrame() +{ + DIALOG_FIND dlg( this ); + dlg.ShowModal(); +} + diff --git a/pcbnew/dialogs/dialog_find_base.cpp b/pcbnew/dialogs/dialog_find_base.cpp new file mode 100644 index 0000000000..279770c043 --- /dev/null +++ b/pcbnew/dialogs/dialog_find_base.cpp @@ -0,0 +1,69 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Aug 24 2011) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_find_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_FIND_BASE::DIALOG_FIND_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* bSizerMain; + bSizerMain = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bSizer3; + bSizer3 = new wxBoxSizer( wxVERTICAL ); + + m_staticText1 = new wxStaticText( this, wxID_ANY, _("Search for:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText1->Wrap( -1 ); + bSizer3->Add( m_staticText1, 0, wxALL, 5 ); + + m_SearchTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 200,-1 ), 0 ); + bSizer3->Add( m_SearchTextCtrl, 0, wxALL|wxEXPAND, 5 ); + + m_NoMouseWarpCheckBox = new wxCheckBox( this, wxID_ANY, _("Do not warp mouse pointer"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer3->Add( m_NoMouseWarpCheckBox, 0, wxALL, 5 ); + + bSizerMain->Add( bSizer3, 1, 0, 5 ); + + wxBoxSizer* bSizer4; + bSizer4 = new wxBoxSizer( wxVERTICAL ); + + m_button1 = new wxButton( this, wxID_ANY, _("Find Item"), wxDefaultPosition, wxDefaultSize, 0 ); + m_button1->SetDefault(); + bSizer4->Add( m_button1, 0, wxALL, 5 ); + + m_button2 = new wxButton( this, wxID_ANY, _("Find Marker"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer4->Add( m_button2, 0, wxALL, 5 ); + + m_button3 = new wxButton( this, wxID_ANY, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer4->Add( m_button3, 0, wxALL, 5 ); + + bSizerMain->Add( bSizer4, 0, 0, 5 ); + + this->SetSizer( bSizerMain ); + this->Layout(); + + this->Centre( wxBOTH ); + + // Connect Events + this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FIND_BASE::onClose ) ); + m_button1->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonFindItemClick ), NULL, this ); + m_button2->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonFindMarkerClick ), NULL, this ); + m_button3->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonCloseClick ), NULL, this ); +} + +DIALOG_FIND_BASE::~DIALOG_FIND_BASE() +{ + // Disconnect Events + this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FIND_BASE::onClose ) ); + m_button1->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonFindItemClick ), NULL, this ); + m_button2->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonFindMarkerClick ), NULL, this ); + m_button3->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FIND_BASE::onButtonCloseClick ), NULL, this ); + +} diff --git a/pcbnew/dialogs/dialog_find_base.fbp b/pcbnew/dialogs/dialog_find_base.fbp new file mode 100644 index 0000000000..7482db3338 --- /dev/null +++ b/pcbnew/dialogs/dialog_find_base.fbp @@ -0,0 +1,681 @@ + + + + + + C++ + 1 + source_name + 0 + res + UTF-8 + connect + dialog_find_base + 1000 + none + 1 + dialog_find + + . + + 1 + 1 + 0 + 0 + + 1 + 1 + 1 + 1 + 0 + + + + + 1 + wxBOTH + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + impl_virtual + + + 1 + + 0 + 0 + wxID_ANY + + + 0 + + + 0 + + 1 + DIALOG_FIND_BASE + 1 + + + 1 + + + Resizable + + 1 + 350,150 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + + Find + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + onClose + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bSizerMain + wxHORIZONTAL + none + + 5 + + 1 + + + bSizer3 + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Search for: + + + 0 + + + 0 + + 1 + m_staticText1 + 1 + + + protected + 1 + + + Resizable + + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + + 0 + + 0 + + 0 + + 1 + m_SearchTextCtrl + 1 + + + protected + 1 + + + Resizable + + 1 + 200,-1 + + + 0 + + + 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 + Do not warp mouse pointer + + + 0 + + + 0 + + 1 + m_NoMouseWarpCheckBox + 1 + + + protected + 1 + + + Resizable + + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + + 0 + + + bSizer4 + wxVERTICAL + none + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + 1 + 0 + 1 + + 1 + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Find Item + + + 0 + + + 0 + + 1 + m_button1 + 1 + + + protected + 1 + + + Resizable + + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + onButtonFindItemClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Find Marker + + + 0 + + + 0 + + 1 + m_button2 + 1 + + + protected + 1 + + + Resizable + + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + onButtonFindMarkerClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Close + + + 0 + + + 0 + + 1 + m_button3 + 1 + + + protected + 1 + + + Resizable + + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + onButtonCloseClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pcbnew/dialogs/dialog_find_base.h b/pcbnew/dialogs/dialog_find_base.h new file mode 100644 index 0000000000..3373ad0945 --- /dev/null +++ b/pcbnew/dialogs/dialog_find_base.h @@ -0,0 +1,58 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Aug 24 2011) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_FIND_BASE_H__ +#define __DIALOG_FIND_BASE_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_FIND_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_FIND_BASE : public wxDialog +{ + private: + + protected: + wxStaticText* m_staticText1; + wxTextCtrl* m_SearchTextCtrl; + wxCheckBox* m_NoMouseWarpCheckBox; + wxButton* m_button1; + wxButton* m_button2; + wxButton* m_button3; + + // Virtual event handlers, overide them in your derived class + virtual void onClose( wxCloseEvent& event ) { event.Skip(); } + virtual void onButtonFindItemClick( wxCommandEvent& event ) { event.Skip(); } + virtual void onButtonFindMarkerClick( wxCommandEvent& event ) { event.Skip(); } + virtual void onButtonCloseClick( wxCommandEvent& event ) { event.Skip(); } + + + public: + + DIALOG_FIND_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Find"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 350,150 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_FIND_BASE(); + +}; + +#endif //__DIALOG_FIND_BASE_H__ diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 99d86af6a1..d9127490a7 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -286,7 +286,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_FIND_ITEMS: - InstallFindFrame( pos, &dc ); + InstallFindFrame(); break; case ID_POPUP_CLOSE_CURRENT_TOOL: diff --git a/pcbnew/find.cpp b/pcbnew/find.cpp deleted file mode 100644 index 0e75b9bfc3..0000000000 --- a/pcbnew/find.cpp +++ /dev/null @@ -1,380 +0,0 @@ -/** - * @file pcbnew/find.cpp - * @brief Pcbnew find dialog box implementation. - */ - - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include - - -static wxString s_OldStringFound; -static int s_ItemCount, s_MarkerCount; - - -void PCB_EDIT_FRAME::InstallFindFrame( const wxPoint& pos, wxDC* DC ) -{ - WinEDA_PcbFindFrame* frame = new WinEDA_PcbFindFrame( this, DC, pos ); - - frame->ShowModal(); - frame->Destroy(); -} - - -void WinEDA_PcbFindFrame::FindItem( wxCommandEvent& event ) -{ - PCB_SCREEN* screen = (PCB_SCREEN*) ( m_Parent->GetScreen() ); - wxPoint locate_pos; - wxString msg; - bool FindMarker = false; - BOARD_ITEM* foundItem = 0; - - switch( event.GetId() ) - { - case ID_FIND_ITEM: - s_ItemCount = 0; - break; - - case ID_FIND_MARKER: - s_MarkerCount = 0; - - // fall thru - - case ID_FIND_NEXT_MARKER: - FindMarker = true; - break; - } - - s_OldStringFound = m_NewText->GetValue(); - - m_Parent->GetCanvas()->GetViewStart( &screen->m_StartVisu.x, &screen->m_StartVisu.y ); - - if( FindMarker ) - { - MARKER_PCB* marker = m_Parent->GetBoard()->GetMARKER( s_MarkerCount++ ); - - if( marker ) - { - foundItem = marker; - locate_pos = marker->GetPosition(); - } - } - else - { - int StartCount = 0; - - for( MODULE* module = m_Parent->GetBoard()->m_Modules; module; module = module->Next() ) - { - if( WildCompareString( s_OldStringFound, module->GetReference().GetData(), false ) ) - { - StartCount++; - - if( StartCount > s_ItemCount ) - { - foundItem = module; - locate_pos = module->GetPosition(); - s_ItemCount++; - break; - } - } - - if( WildCompareString( s_OldStringFound, module->m_Value->m_Text.GetData(), false ) ) - { - StartCount++; - - if( StartCount > s_ItemCount ) - { - foundItem = module; - locate_pos = module->m_Pos; - s_ItemCount++; - break; - } - } - } - } - - if( foundItem ) - { - m_Parent->SetCurItem( foundItem ); - - if( FindMarker ) - msg = _( "Marker found" ); - else - msg.Printf( _( "<%s> Found" ), GetChars( s_OldStringFound ) ); - - m_Parent->SetStatusText( msg ); - - m_Parent->CursorGoto( locate_pos ); - - EndModal( 1 ); - } - else - { - m_Parent->SetStatusText( wxEmptyString ); - - if( FindMarker ) - msg = _( "Marker not found" ); - else - msg.Printf( _( "<%s> Not Found" ), GetChars( s_OldStringFound ) ); - - DisplayError( this, msg, 10 ); - EndModal( 0 ); - } -} - - -/*! - * WinEDA_PcbFindFrame type definition - */ - -IMPLEMENT_DYNAMIC_CLASS( WinEDA_PcbFindFrame, wxDialog ) - -/*! - * WinEDA_PcbFindFrame event table definition - */ - -BEGIN_EVENT_TABLE( WinEDA_PcbFindFrame, wxDialog ) - -////@begin WinEDA_PcbFindFrame event table entries - EVT_BUTTON( ID_FIND_ITEM, WinEDA_PcbFindFrame::OnFindItemClick ) - EVT_BUTTON( ID_FIND_NEXT_ITEM, WinEDA_PcbFindFrame::OnFindNextItemClick ) - EVT_BUTTON( ID_FIND_MARKER, WinEDA_PcbFindFrame::OnFindMarkerClick ) - EVT_BUTTON( ID_FIND_NEXT_MARKER, WinEDA_PcbFindFrame::OnFindNextMarkerClick ) - -////@end WinEDA_PcbFindFrame event table entries - -END_EVENT_TABLE() -/*! - * WinEDA_PcbFindFrame constructors - */ - -WinEDA_PcbFindFrame::WinEDA_PcbFindFrame() -{ -} - - -WinEDA_PcbFindFrame::WinEDA_PcbFindFrame( PCB_BASE_FRAME* parent, - wxDC* DC, - const wxPoint& pos, - wxWindowID id, - const wxString& caption, - const wxSize& size, - long style ) -{ - m_Parent = parent; - m_DC = DC; - - Create( parent, id, caption, pos, size, style ); - - m_NewText->SetFocus(); -} - - -/*! - * WinEDA_PcbFindFrame creator - */ - -bool WinEDA_PcbFindFrame::Create( wxWindow* parent, - wxWindowID id, - const wxString& caption, - const wxPoint& pos, - const wxSize& size, - long style ) -{ -////@begin WinEDA_PcbFindFrame member initialisation - m_NewText = NULL; - -////@end WinEDA_PcbFindFrame member initialisation - -////@begin WinEDA_PcbFindFrame creation - SetExtraStyle( wxWS_EX_BLOCK_EVENTS ); - wxDialog::Create( parent, id, caption, pos, size, style ); - - CreateControls(); - - if( GetSizer() ) - { - GetSizer()->SetSizeHints( this ); - } - - Centre(); - -////@end WinEDA_PcbFindFrame creation - return true; -} - - -/*! - * Control creation for WinEDA_PcbFindFrame - */ - -void WinEDA_PcbFindFrame::CreateControls() -{ -////@begin WinEDA_PcbFindFrame content construction - // Generated by DialogBlocks, 29/04/2009 15:15:49 (unregistered) - - WinEDA_PcbFindFrame* itemDialog1 = this; - - wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxVERTICAL ); - - itemDialog1->SetSizer( itemBoxSizer2 ); - - wxStaticText* itemStaticText3 = new wxStaticText( itemDialog1, - wxID_STATIC, - _( "Item to find:" ), - wxDefaultPosition, - wxDefaultSize, - 0 ); - itemBoxSizer2->Add( itemStaticText3, - 0, - wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 ); - - m_NewText = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T( "" ), - wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer2->Add( m_NewText, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 ); - - wxBoxSizer* itemBoxSizer5 = new wxBoxSizer( wxHORIZONTAL ); - itemBoxSizer2->Add( itemBoxSizer5, - 0, - wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT | - wxBOTTOM, - 5 ); - - wxBoxSizer* itemBoxSizer6 = new wxBoxSizer( wxVERTICAL ); - itemBoxSizer5->Add( itemBoxSizer6, - 0, - wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, - 5 ); - - wxButton* itemButton7 = - new wxButton( itemDialog1, ID_FIND_ITEM, _( "Find Item" ), - wxDefaultPosition, wxDefaultSize, 0 ); - itemButton7->SetDefault(); - itemBoxSizer6->Add( itemButton7, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 ); - - wxButton* itemButton8 = - new wxButton( itemDialog1, ID_FIND_NEXT_ITEM, _( "Find Next Item" ), - wxDefaultPosition, wxDefaultSize, - 0 ); - itemBoxSizer6->Add( itemButton8, - 0, - wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, - 5 ); - - wxBoxSizer* itemBoxSizer9 = new wxBoxSizer( wxVERTICAL ); - itemBoxSizer5->Add( itemBoxSizer9, - 0, - wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, - 5 ); - - wxButton* itemButton10 = - new wxButton( itemDialog1, ID_FIND_MARKER, _( "Find Marker" ), - wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer9->Add( itemButton10, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 ); - - wxButton* itemButton11 = new wxButton( itemDialog1, - ID_FIND_NEXT_MARKER, - _( "Find Next Marker" ), - wxDefaultPosition, - wxDefaultSize, - 0 ); - itemBoxSizer9->Add( itemButton11, - 0, - wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, - 5 ); - -////@end WinEDA_PcbFindFrame content construction -} - - -/*! - * Should we show tooltips? - */ - -bool WinEDA_PcbFindFrame::ShowToolTips() -{ - return true; -} - - -/*! - * Get bitmap resources - */ - -wxBitmap WinEDA_PcbFindFrame::GetBitmapResource( const wxString& name ) -{ - // Bitmap retrieval -////@begin WinEDA_PcbFindFrame bitmap retrieval - wxUnusedVar( name ); - return wxNullBitmap; - -////@end WinEDA_PcbFindFrame bitmap retrieval -} - - -/*! - * Get icon resources - */ - -wxIcon WinEDA_PcbFindFrame::GetIconResource( const wxString& name ) -{ - // Icon retrieval -////@begin WinEDA_PcbFindFrame icon retrieval - wxUnusedVar( name ); - return wxNullIcon; - -////@end WinEDA_PcbFindFrame icon retrieval -} - - -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_FIND_ITEM - */ - -void WinEDA_PcbFindFrame::OnFindItemClick( wxCommandEvent& event ) -{ - FindItem( event ); -} - - -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_FIND_NEXT_ITEM - */ - -void WinEDA_PcbFindFrame::OnFindNextItemClick( wxCommandEvent& event ) -{ - FindItem( event ); -} - - -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_FIND_MARKER - */ - -void WinEDA_PcbFindFrame::OnFindMarkerClick( wxCommandEvent& event ) -{ - FindItem( event ); -} - - -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_FIND_NEXT_MARKER - */ - -void WinEDA_PcbFindFrame::OnFindNextMarkerClick( wxCommandEvent& event ) -{ - FindItem( event ); -} diff --git a/pcbnew/find.h b/pcbnew/find.h deleted file mode 100644 index c48e8c770c..0000000000 --- a/pcbnew/find.h +++ /dev/null @@ -1,126 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: find.h -// Purpose: -// Author: jean-pierre Charras -// Modified by: -// Created: 04/03/2006 13:58:04 -// RCS-ID: -// Copyright: License GNU -// Licence: -///////////////////////////////////////////////////////////////////////////// - -// Generated by DialogBlocks (unregistered), 04/03/2006 13:58:04 - -#ifndef _FIND_H_ -#define _FIND_H_ - -/*! - * Includes - */ - -////@begin includes -////@end includes - -/*! - * Forward declarations - */ - -////@begin forward declarations -////@end forward declarations - -/*! - * Control identifiers - */ - -////@begin control identifiers -#define ID_DIALOG 10000 -#define ID_TEXTCTRL 10001 -#define ID_FIND_ITEM 10002 -#define ID_FIND_NEXT_ITEM 10003 -#define ID_FIND_MARKER 10004 -#define ID_FIND_NEXT_MARKER 10005 -#define SYMBOL_WINEDA_PCBFINDFRAME_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|MAYBE_RESIZE_BORDER -#define SYMBOL_WINEDA_PCBFINDFRAME_TITLE _("Find") -#define SYMBOL_WINEDA_PCBFINDFRAME_IDNAME ID_DIALOG -#define SYMBOL_WINEDA_PCBFINDFRAME_SIZE wxSize(400, 300) -#define SYMBOL_WINEDA_PCBFINDFRAME_POSITION wxDefaultPosition -////@end control identifiers - -/*! - * Compatibility - */ - -#ifndef wxCLOSE_BOX -#define wxCLOSE_BOX 0x1000 -#endif - -/*! - * WinEDA_PcbFindFrame class declaration - */ - -class WinEDA_PcbFindFrame: public wxDialog -{ - DECLARE_DYNAMIC_CLASS( WinEDA_PcbFindFrame ) - DECLARE_EVENT_TABLE() - -public: - /// Constructors - WinEDA_PcbFindFrame( ); - WinEDA_PcbFindFrame( PCB_BASE_FRAME* parent, - wxDC * DC, const wxPoint& pos = SYMBOL_WINEDA_PCBFINDFRAME_POSITION, - wxWindowID id = SYMBOL_WINEDA_PCBFINDFRAME_IDNAME, - const wxString& caption = SYMBOL_WINEDA_PCBFINDFRAME_TITLE, - const wxSize& size = SYMBOL_WINEDA_PCBFINDFRAME_SIZE, - long style = SYMBOL_WINEDA_PCBFINDFRAME_STYLE ); - - /// Creation - bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_PCBFINDFRAME_IDNAME, - const wxString& caption = SYMBOL_WINEDA_PCBFINDFRAME_TITLE, - const wxPoint& pos = SYMBOL_WINEDA_PCBFINDFRAME_POSITION, - const wxSize& size = SYMBOL_WINEDA_PCBFINDFRAME_SIZE, - long style = SYMBOL_WINEDA_PCBFINDFRAME_STYLE ); - - /// Creates the controls and sizers - void CreateControls(); - -////@begin WinEDA_PcbFindFrame event handler declarations - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_FIND_ITEM - void OnFindItemClick( wxCommandEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_FIND_NEXT_ITEM - void OnFindNextItemClick( wxCommandEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_FIND_MARKER - void OnFindMarkerClick( wxCommandEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_FIND_NEXT_MARKER - void OnFindNextMarkerClick( wxCommandEvent& event ); - -////@end WinEDA_PcbFindFrame event handler declarations - -////@begin WinEDA_PcbFindFrame member function declarations - - /// Retrieves bitmap resources - wxBitmap GetBitmapResource( const wxString& name ); - - /// Retrieves icon resources - wxIcon GetIconResource( const wxString& name ); -////@end WinEDA_PcbFindFrame member function declarations - - /// Should we show tooltips? - static bool ShowToolTips(); - - void FindItem(wxCommandEvent& event); - void FindMarker(wxCommandEvent& event); - -////@begin WinEDA_PcbFindFrame member variables - wxTextCtrl* m_NewText; -////@end WinEDA_PcbFindFrame member variables - - PCB_BASE_FRAME * m_Parent; - wxDC * m_DC; -}; - -#endif - // _FIND_H_ From d2926d2edfb52bf1a64af2213021417cbaaa5693 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 29 May 2012 14:25:10 +0200 Subject: [PATCH 02/17] Pcbnew: menu Edit/Reset modules fields size: Add dialog to select what modules are modified. --- include/wxBasePcbFrame.h | 10 +- include/wxPcbStruct.h | 7 + pcbnew/CMakeLists.txt | 2 + pcbnew/dialogs/dialog_design_rules_base.fbp | 4046 ++++++++--------- .../dialog_global_modules_fields_edition.cpp | 240 + ...log_global_modules_fields_edition_base.cpp | 137 + ...log_global_modules_fields_edition_base.fbp | 1492 ++++++ ...ialog_global_modules_fields_edition_base.h | 71 + .../dialog_global_pads_edition_base.fbp | 836 ++-- pcbnew/edit.cpp | 8 - pcbnew/edtxtmod.cpp | 110 +- pcbnew/menubar_pcbframe.cpp | 12 +- pcbnew/pcbframe.cpp | 6 +- pcbnew/pcbnew_id.h | 3 +- 14 files changed, 4406 insertions(+), 2574 deletions(-) create mode 100644 pcbnew/dialogs/dialog_global_modules_fields_edition.cpp create mode 100644 pcbnew/dialogs/dialog_global_modules_fields_edition_base.cpp create mode 100644 pcbnew/dialogs/dialog_global_modules_fields_edition_base.fbp create mode 100644 pcbnew/dialogs/dialog_global_modules_fields_edition_base.h diff --git a/include/wxBasePcbFrame.h b/include/wxBasePcbFrame.h index e0c1596723..992669dc51 100644 --- a/include/wxBasePcbFrame.h +++ b/include/wxBasePcbFrame.h @@ -320,10 +320,14 @@ public: * Function ResetModuleTextSizes * resets text size and width of all module text fields of given field * type to current settings in Preferences->Dimensions->Texts and Drawings. - * @param aType is the field type (TEXT_is_REFERENCE, TEXT_is_VALUE, or TEXT_is_DIVERS). - * @param aDC is the drawing context. + * @param aFilter is a filter: footprint names must match this filter. + * an empty filter, or "*" do not filter anything. + * @param aRef = true to modify the reference of footprints. + * @param aValue = true to modify the value of footprints. + * @param aOthers = true to modify the other fields of footprints. */ - void ResetModuleTextSizes( int aType, wxDC* aDC ); + void ResetModuleTextSizes( const wxString & aFilter, bool aRef, + bool aValue, bool aOthers ); void InstallPadOptionsFrame( D_PAD* pad ); void InstallTextModOptionsFrame( TEXTE_MODULE* TextMod, wxDC* DC ); diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index e550c18f6e..c7acd0093c 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -481,6 +481,13 @@ public: void Tracks_and_Vias_Size_Event( wxCommandEvent& event ); void OnSelectTool( wxCommandEvent& aEvent ); + /** + * Function OnResetModuleTextSizes + * resets text size and width of all module text fields of given field + * type to current settings in Preferences + */ + void OnResetModuleTextSizes( wxCommandEvent& event ); + void ProcessMuWaveFunctions( wxCommandEvent& event ); void MuWaveCommand( wxDC* DC, const wxPoint& MousePos ); diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index dbe64d2766..0b668f2d0a 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -50,6 +50,8 @@ set(PCBNEW_DIALOGS dialogs/dialog_general_options_BoardEditor_base.cpp dialogs/dialog_global_edit_tracks_and_vias.cpp dialogs/dialog_global_edit_tracks_and_vias_base.cpp + dialogs/dialog_global_modules_fields_edition.cpp + dialogs/dialog_global_modules_fields_edition_base.cpp dialogs/dialog_global_pads_edition_base.cpp dialogs/dialog_graphic_items_options.cpp dialogs/dialog_graphic_items_options_base.cpp diff --git a/pcbnew/dialogs/dialog_design_rules_base.fbp b/pcbnew/dialogs/dialog_design_rules_base.fbp index d8f1ee15d0..cc33864e2d 100644 --- a/pcbnew/dialogs/dialog_design_rules_base.fbp +++ b/pcbnew/dialogs/dialog_design_rules_base.fbp @@ -1,8 +1,8 @@ - + - + C++ 1 source_name @@ -15,9 +15,9 @@ none 1 dialog_design_rules_base - + . - + 1 1 1 @@ -28,15 +28,15 @@ 1 1 0 - - - - + + + + 1 - + 0 1 - + 1 0 Dock @@ -44,82 +44,82 @@ Left 1 impl_virtual - - + + 1 - + 0 0 wxID_ANY - - + + 0 - - + + 0 -1,-1 1 DIALOG_DESIGN_RULES_BASE 1 - - + + 1 - - + + Resizable - + 1 777,697 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - + Design Rules Editor 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + bMainSizer wxVERTICAL none @@ -132,85 +132,85 @@ 1 1 1 - - - - - + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY - - + + 0 - - + + 0 - + 1 m_DRnotebook 1 - - + + protected 1 - - + + Resizable - + 1 - + wxNB_TOP - + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + Net Classes Editor 1 @@ -218,81 +218,81 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY - - + + 0 - - + + 0 - + 1 m_panelNetClassesEditor 1 - - + + protected 1 - - + + Resizable - + 1 - - + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - + + + wxSUNKEN_BORDER|wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + bpanelNetClassesSizer wxVERTICAL none @@ -303,11 +303,11 @@ wxID_ANY Net Classes: - + sbSizerUpper wxVERTICAL none - + 5 wxEXPAND @@ -317,17 +317,17 @@ 1 1 1 - + 0 1 - - - + + + 1 - - + + wxALIGN_LEFT - + wxALIGN_TOP 0 1 @@ -337,7 +337,7 @@ wxALIGN_CENTRE 6 100,120,84,85,81,90 - + 1 0 Dock @@ -349,110 +349,110 @@ 1 1 1 - + 1 - - + + 1 0 0 wxID_ANY - - - - + + + + 0 0 - + 0 - - + + 0 -1,-1 1 m_grid 1 - - + + protected 1 - - + + Resizable - + wxALIGN_LEFT 120 "Default" wxALIGN_CENTRE - + 1 1 - - + + 0 Net Class parameters - + wxFILTER_NONE wxDefaultValidator - - - + + + wxHSCROLL|wxSIMPLE_BORDER|wxVSCROLL - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnNetClassesNameLeftClick - + OnNetClassesNameRightClick - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + @@ -460,7 +460,7 @@ wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT 0 - + buttonBoxSizer wxHORIZONTAL none @@ -473,14 +473,14 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 0 @@ -488,68 +488,68 @@ 0 Left 1 - + 1 - + 0 0 wxID_ADD_NETCLASS Add - - + + 0 - - + + 0 - + 1 m_addButton 1 - - + + protected 1 - - + + Resizable - + 1 - - - + + + 0 Add another Net Class - + wxFILTER_NONE wxDefaultValidator - - - - + + + + OnAddNetclassClick - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -561,14 +561,14 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 0 @@ -576,68 +576,68 @@ 0 Left 1 - + 1 - + 0 0 wxID_REMOVE_NETCLASS Remove - - + + 0 - - + + 0 - + 1 m_removeButton 1 - - + + protected 1 - - + + Resizable - + 1 - - - + + + 0 Remove the currently select Net Class The default Net Class cannot be removed - + wxFILTER_NONE wxDefaultValidator - - - - + + + + OnRemoveNetclassClick - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -649,14 +649,14 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 0 @@ -664,68 +664,68 @@ 0 Left 1 - + 1 - + 0 0 wxID_ANY Move Up - - + + 0 - - + + 0 - + 1 m_moveUpButton 1 - - + + protected 1 - - + + Resizable - + 1 - - - + + + 0 Move the currently selected Net Class up one row - + wxFILTER_NONE wxDefaultValidator - - - - + + + + OnMoveUpSelectedNetClass - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -739,17 +739,17 @@ wxID_ANY Membership: - + sbSizerNetSelectMain wxHORIZONTAL none - + 5 wxEXPAND|wxRIGHT|wxLEFT 1 - + leftNetSelectBoxSizer wxVERTICAL none @@ -762,85 +762,85 @@ 1 1 1 - - - - + + + + 1 0 - + 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY - - + + 0 - - + + 0 - + 1 m_leftClassChoice 1 - - + + protected 1 - - + + Resizable - + 1 - + wxCB_READONLY - + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - - - + + + + + + OnLeftCBSelection - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + @@ -852,100 +852,100 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY - - + + 0 - - + + 0 220,200 1 m_leftListCtrl 1 - - + + protected 1 - - + + Resizable - + 1 - + wxLC_HRULES|wxLC_REPORT|wxLC_VIRTUAL|wxLC_VRULES NETS_LIST_CTRL; dialog_design_rules_aux_helper_class.h 0 - - + + wxFILTER_NONE wxDefaultValidator - - - + + + wxSUNKEN_BORDER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -955,7 +955,7 @@ wxALIGN_CENTER_VERTICAL 0 - + bmiddleSizerNetSelect wxVERTICAL none @@ -968,14 +968,14 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 0 @@ -983,68 +983,68 @@ 0 Left 1 - + 1 - + 0 0 ID_LEFT_TO_RIGHT_COPY <<< - - + + 0 - - + + 0 - + 1 m_buttonRightToLeft 1 - - + + protected 1 - - + + Resizable - + 1 - - - + + + 0 Move the selected nets in the right list to the left list - + wxFILTER_NONE wxDefaultValidator - - - - + + + + OnRightToLeftCopyButton - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -1056,14 +1056,14 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 0 @@ -1071,68 +1071,68 @@ 0 Left 1 - + 1 - + 0 0 ID_RIGHT_TO_LEFT_COPY >>> - - + + 0 - - + + 0 - + 1 m_buttonLeftToRight 1 - - + + protected 1 - - + + Resizable - + 1 - - - + + + 0 Move the selected nets in the left list to the right list - + wxFILTER_NONE wxDefaultValidator - - - - + + + + OnLeftToRightCopyButton - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -1144,14 +1144,14 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 0 @@ -1159,68 +1159,68 @@ 0 Left 1 - + 1 - + 0 0 wxID_ANY << Select All - - + + 0 - - + + 0 - + 1 m_buttonLeftSelAll 1 - - + + protected 1 - - + + Resizable - + 1 - - - + + + 0 Select all nets in the left list - + wxFILTER_NONE wxDefaultValidator - - - - + + + + OnLeftSelectAllButton - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -1232,14 +1232,14 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 0 @@ -1247,68 +1247,68 @@ 0 Left 1 - + 1 - + 0 0 wxID_ANY Select All >> - - + + 0 - - + + 0 - + 1 m_buttonRightSelAll 1 - - + + protected 1 - - + + Resizable - + 1 - - - + + + 0 Select all nets in the right list - + wxFILTER_NONE wxDefaultValidator - - - - + + + + OnRightSelectAllButton - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -1318,7 +1318,7 @@ wxEXPAND|wxRIGHT|wxLEFT 1 - + rghtNetSelectBoxSizer wxVERTICAL none @@ -1331,85 +1331,85 @@ 1 1 1 - - - - + + + + 1 0 - + 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY - - + + 0 - - + + 0 - + 1 m_rightClassChoice 1 - - + + protected 1 - - + + Resizable - + 1 - + wxCB_READONLY - + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - - - + + + + + + OnRightCBSelection - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + @@ -1421,100 +1421,100 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY - - + + 0 - - + + 0 220,-1 1 m_rightListCtrl 1 - - + + protected 1 - - + + Resizable - + 1 - + wxLC_HRULES|wxLC_REPORT|wxLC_VIRTUAL|wxLC_VRULES NETS_LIST_CTRL; dialog_design_rules_aux_helper_class.h 0 - - + + wxFILTER_NONE wxDefaultValidator - - - + + + wxSUNKEN_BORDER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1525,7 +1525,7 @@ - + Global Design Rules 0 @@ -1533,81 +1533,81 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY - - + + 0 - - + + 0 - + 1 m_panelGolbalDesignRules 1 - - + + protected 1 - - + + Resizable - + 1 - - + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - + + + wxSUNKEN_BORDER|wxTAB_TRAVERSAL - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + bpanelGlobRulesSizer wxVERTICAL none @@ -1616,7 +1616,7 @@ wxEXPAND 0 - + bDesignRulesUpperSizer wxHORIZONTAL none @@ -1627,11 +1627,11 @@ wxID_ANY Via Options: - + sbViasOptionSizer wxVERTICAL none - + 5 wxALL|wxEXPAND @@ -1641,85 +1641,85 @@ 1 1 1 - - - - + + + + 1 0 "Through via" "Blind or buried via" 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY Default Via Type - + 1 - + 0 - - + + 0 - + 1 m_OptViaType 1 - - + + protected 1 - - + + Resizable - + 0 1 - + wxRA_SPECIFY_COLS - + 0 Select the current via type. Trough via is the usual selection - + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1731,85 +1731,85 @@ 1 1 1 - - - - + + + + 1 0 "Do not allow micro vias" "Allow micro vias" 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY Micro Vias: - + 1 - + 0 - - + + 0 - + 1 m_AllowMicroViaCtrl 1 - - + + protected 1 - - + + Resizable - + 0 1 - + wxRA_SPECIFY_COLS - + 0 Allows or do not allow use of micro vias They are very small vias only from an external copper layer to its near neightbour - + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1821,11 +1821,11 @@ wxID_ANY Minimum Allowed Values: - + sbMinSizesSizer wxVERTICAL none - + 5 wxEXPAND @@ -1834,9 +1834,9 @@ 2 wxBOTH 1 - + 0 - + fgMinValuesSizer wxFLEX_GROWMODE_SPECIFIED none @@ -1851,82 +1851,82 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY Min track width - - + + 0 - - + + 0 - + 1 m_TrackMinWidthTitle 1 - - + + protected 1 - - + + Resizable - + 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -1938,86 +1938,86 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY - - + + 0 - + 0 - + 0 - + 1 m_SetTrackMinWidthCtrl 1 - - + + protected 1 - - + + Resizable - + 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2029,82 +2029,82 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY Min via diameter - - + + 0 - - + + 0 - + 1 m_ViaMinTitle 1 - - + + protected 1 - - + + Resizable - + 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -2116,86 +2116,86 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY - - + + 0 - + 0 - + 0 - + 1 m_SetViasMinSizeCtrl 1 - - + + protected 1 - - + + Resizable - + 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2207,82 +2207,82 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY Min via drill dia - - + + 0 - - + + 0 - + 1 m_ViaMinDrillTitle 1 - - + + protected 1 - - + + Resizable - + 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -2294,86 +2294,86 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY - - + + 0 - + 0 - + 0 - + 1 m_SetViasMinDrillCtrl 1 - - + + protected 1 - - + + Resizable - + 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2385,82 +2385,82 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY Min uvia diameter - - + + 0 - - + + 0 - + 1 m_MicroViaMinSizeTitle 1 - - + + protected 1 - - + + Resizable - + 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -2472,86 +2472,86 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY - - + + 0 - + 6 - + 0 - + 1 m_SetMicroViasMinSizeCtrl 1 - - + + protected 1 - - + + Resizable - + 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2563,82 +2563,82 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY Min uvia drill dia - - + + 0 - - + + 0 - + 1 m_MicroViaMinDrillTitle 1 - - + + protected 1 - - + + Resizable - + 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -2650,86 +2650,86 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY - - + + 0 - + 6 - + 0 - + 1 m_SetMicroViasMinDrillCtrl 1 - - + + protected 1 - - + + Resizable - + 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2747,80 +2747,80 @@ 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 - - + + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2832,82 +2832,82 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY Specific via diameters and track widths, which can be used to replace default Netclass values on demand, for arbitrary via or track segments. - - + + 0 - - + + 0 - + 1 m_staticTextInfo 1 - - + + protected 1 - - + + Resizable - + 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -2915,7 +2915,7 @@ wxALIGN_CENTER_HORIZONTAL|wxEXPAND 0 - + bDesignRulesLowerSizer wxHORIZONTAL none @@ -2926,11 +2926,11 @@ wxID_ANY Custom Via Sizes: - + sViaSizeBox wxVERTICAL none - + 5 wxALL @@ -2940,82 +2940,82 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY Drill value: a blank or 0 => default Netclass value - - + + 0 - - + + 0 - + 1 m_staticText7 1 - - + + protected 1 - - + + Resizable - + 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -3027,17 +3027,17 @@ 1 1 1 - + 0 0 - - - + + + 1 - - + + wxALIGN_LEFT - + wxALIGN_TOP 0 1 @@ -3046,8 +3046,8 @@ "Diameter" "Drill" wxALIGN_CENTRE 2 - - + + 1 0 Dock @@ -3059,110 +3059,110 @@ 1 1 1 - + 1 - - + + 1 0 0 wxID_ANY - - - - + + + + 0 0 - + 0 - - + + 0 - + 1 m_gridViaSizeList 1 - - + + protected 1 - - + + Resizable - + wxALIGN_CENTRE 80 "Via 1" "Via 2" "Via 3" "Via 4" "Via 5" "Via 6" "Via 7" "Via 8" "Via 9" "Via 10" "Via 11" "Via 12" wxALIGN_CENTRE - + 12 1 - - + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3174,11 +3174,11 @@ wxID_ANY Custom Track Widths: - + sbTracksListSizer wxVERTICAL none - + 5 wxALL @@ -3188,82 +3188,82 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY - - - + + + 0 - - + + 0 - + 1 m_staticText8 1 - - + + protected 1 - - + + Resizable - + 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -3275,17 +3275,17 @@ 1 1 1 - + 0 0 - - - + + + 1 - - + + wxALIGN_LEFT - + wxALIGN_TOP 0 1 @@ -3294,8 +3294,8 @@ "Width" wxALIGN_CENTRE 1 - - + + 1 0 Dock @@ -3307,37 +3307,37 @@ 1 1 1 - + 1 - - + + 1 0 0 wxID_ANY - - - - + + + + 0 0 - + 0 - - + + 0 - + 1 m_gridTrackWidthList 1 - - + + protected 1 - - + + Resizable - + wxALIGN_CENTRE 80 "Track 1" "Track 2" "Track 3" "Track 4" "Track 5" "Track 6" "Track 7" "Track 8" "Track 9" "Track 10" "Track 11" "Track 12" @@ -3345,72 +3345,72 @@ 17,17,17,17,17,17,17,17,17,17,17,17 12 1 - - + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3429,11 +3429,11 @@ wxID_ANY Messages: - + sbSizer2 wxHORIZONTAL none - + 5 wxEXPAND @@ -3443,91 +3443,91 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY - - + + 0 - - + + 0 -1,90 1 m_MessagesList 1 - - + + protected 1 - - + + Resizable - + 1 - + wxHW_SCROLLBAR_AUTO - + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - + + + wxSUNKEN_BORDER - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + 5 - + 0 - + bSizerButtons wxVERTICAL none @@ -3540,14 +3540,14 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 1 0 @@ -3555,68 +3555,68 @@ 0 Left 1 - + 1 - + 0 0 wxID_OK OK - - + + 0 - - + + 0 - + 1 m_buttonOk 1 - - + + protected 1 - - + + Resizable - + 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - + + + + OnOkButtonClick - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -3628,14 +3628,14 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 0 @@ -3643,68 +3643,68 @@ 0 Left 1 - + 1 - + 0 0 wxID_CANCEL Cancel - - + + 0 - - + + 0 - + 1 m_buttonCancel 1 - - + + protected 1 - - + + Resizable - + 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - + + + + OnCancelButtonClick - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pcbnew/dialogs/dialog_global_modules_fields_edition.cpp b/pcbnew/dialogs/dialog_global_modules_fields_edition.cpp new file mode 100644 index 0000000000..98dde3e24c --- /dev/null +++ b/pcbnew/dialogs/dialog_global_modules_fields_edition.cpp @@ -0,0 +1,240 @@ +/* + * 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) 1992-2012 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 dialog_global_modules_fields_edition.cpp + * @brief global module fields edition. + */ + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + + +// The dialog to set options for global fields edition: +// optionas are: +// edited fields (ref, value, others +// the footprint filter, for selective edition +class DIALOG_GLOBAL_MODULES_FIELDS_EDITION : public DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE +{ + PCB_EDIT_FRAME* m_parent; + BOARD_DESIGN_SETTINGS* m_brdSettings; + // Static variable to remember options, withing a session: + static bool m_refSelection; + static bool m_valueSelection; + static bool m_othersSelection; + static wxString m_filterString; + + +public: + DIALOG_GLOBAL_MODULES_FIELDS_EDITION( PCB_EDIT_FRAME* parent ) + : DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE( parent ) + { + m_parent = parent; + initDialog(); + GetSizer()->SetSizeHints( this ); + } + +private: + void initDialog(); + + // event handlers + void OnOKClick( wxCommandEvent& event ); + void OnCancelClick( wxCommandEvent& event ) + { + EndModal( wxID_CANCEL ); + } +}; + +bool DIALOG_GLOBAL_MODULES_FIELDS_EDITION::m_refSelection = false; +bool DIALOG_GLOBAL_MODULES_FIELDS_EDITION::m_valueSelection = false; +bool DIALOG_GLOBAL_MODULES_FIELDS_EDITION::m_othersSelection = false; +wxString DIALOG_GLOBAL_MODULES_FIELDS_EDITION::m_filterString; + +void DIALOG_GLOBAL_MODULES_FIELDS_EDITION::initDialog() +{ + SetFocus(); + + m_brdSettings = &m_parent->GetDesignSettings(); + + m_ReferenceOpt->SetValue(m_refSelection), + m_ValueOpt->SetValue(m_valueSelection), + m_OtherFields->SetValue(m_othersSelection); + m_ModuleFilter->SetValue(m_filterString); + m_SizeXunit->SetLabel( GetAbbreviatedUnitsLabel() ); + m_SizeYunit->SetLabel( GetAbbreviatedUnitsLabel() ); + m_Ticknessunit->SetLabel( GetAbbreviatedUnitsLabel() ); + m_SizeX_Value->SetValue( + ReturnStringFromValue( g_UserUnit, m_brdSettings->m_ModuleTextSize.x ) ); + m_SizeY_Value->SetValue( + ReturnStringFromValue( g_UserUnit, m_brdSettings->m_ModuleTextSize.y ) ); + m_TicknessValue->SetValue( + ReturnStringFromValue( g_UserUnit, m_brdSettings->m_ModuleTextWidth) ); +} + + +void DIALOG_GLOBAL_MODULES_FIELDS_EDITION::OnOKClick( wxCommandEvent& event ) +{ + m_refSelection = m_ReferenceOpt->GetValue(); + m_valueSelection = m_ValueOpt->GetValue(); + m_othersSelection = m_OtherFields->GetValue(); + m_filterString = m_ModuleFilter->GetValue(); + + m_brdSettings->m_ModuleTextSize.x = ReturnValueFromTextCtrl( *m_SizeX_Value ); + m_brdSettings->m_ModuleTextSize.y = ReturnValueFromTextCtrl( *m_SizeY_Value ); + m_brdSettings->m_ModuleTextWidth = ReturnValueFromTextCtrl( *m_TicknessValue ); + + // clip m_ModuleTextWidth to the 1/4 of min size, to keep it always readable + int minsize = min( m_brdSettings->m_ModuleTextSize.x, + m_brdSettings->m_ModuleTextSize.y ) / 4; + if( m_brdSettings->m_ModuleTextWidth > minsize ) + m_brdSettings->m_ModuleTextWidth = minsize; + + m_parent->ResetModuleTextSizes( m_filterString, m_refSelection, + m_valueSelection, m_othersSelection ); + EndModal( wxID_OK ); +} + + +void PCB_EDIT_FRAME::OnResetModuleTextSizes( wxCommandEvent& event ) +{ + DIALOG_GLOBAL_MODULES_FIELDS_EDITION dlg(this); + dlg.ShowModal(); + + m_canvas->Refresh(); +} + +void PCB_BASE_FRAME::ResetModuleTextSizes( const wxString & aFilter, bool aRef, + bool aValue, bool aOthers ) +{ + MODULE* module; + BOARD_ITEM* boardItem; + TEXTE_MODULE* item; + ITEM_PICKER itemWrapper( NULL, UR_CHANGED ); + PICKED_ITEMS_LIST undoItemList; + unsigned int ii; + + // Prepare undo list + for( module = GetBoard()->m_Modules; module; module = module->Next() ) + { + itemWrapper.SetItem( module ); + + if( ! aFilter.IsEmpty() ) + { + if( ! WildCompareString( aFilter, module->GetLibRef(), false ) ) + continue; + } + + + if( aRef ) + { + item = module->m_Reference; + + if( item->GetSize() != GetDesignSettings().m_ModuleTextSize || + item->GetThickness() != GetDesignSettings().m_ModuleTextWidth ) + { + undoItemList.PushItem( itemWrapper ); + } + } + + if( aValue ) + { + item = module->m_Value; + + if( item->GetSize() != GetDesignSettings().m_ModuleTextSize || + item->GetThickness() != GetDesignSettings().m_ModuleTextWidth ) + { + undoItemList.PushItem( itemWrapper ); + } + } + + if( aOthers ) + { + // Go through all other module text fields + for( boardItem = module->m_Drawings; boardItem; boardItem = boardItem->Next() ) + { + if( boardItem->Type() == PCB_MODULE_TEXT_T ) + { + item = (TEXTE_MODULE*) boardItem; + + if( item->GetSize() != GetDesignSettings().m_ModuleTextSize + || item->GetThickness() != GetDesignSettings().m_ModuleTextWidth ) + { + undoItemList.PushItem( itemWrapper ); + } + } + } + } + } + + // Exit if there's nothing to do + if( !undoItemList.GetCount() ) + return; + + SaveCopyInUndoList( undoItemList, UR_CHANGED ); + + // Apply changes to modules in the undo list + for( ii = 0; ii < undoItemList.GetCount(); ii++ ) + { + module = (MODULE*) undoItemList.GetPickedItem( ii ); + + if( aRef ) + { + module->m_Reference->SetThickness( GetDesignSettings().m_ModuleTextWidth ); + module->m_Reference->SetSize( GetDesignSettings().m_ModuleTextSize ); + } + + if( aValue ) + { + module->m_Value->SetThickness( GetDesignSettings().m_ModuleTextWidth ); + module->m_Value->SetSize( GetDesignSettings().m_ModuleTextSize ); + } + + if( aOthers ) + { + for( boardItem = module->m_Drawings; boardItem; boardItem = boardItem->Next() ) + { + if( boardItem->Type() == PCB_MODULE_TEXT_T ) + { + item = (TEXTE_MODULE*) boardItem; + item->SetThickness( GetDesignSettings().m_ModuleTextWidth ); + item->SetSize( GetDesignSettings().m_ModuleTextSize ); + } + } + } + } + + OnModify(); +} diff --git a/pcbnew/dialogs/dialog_global_modules_fields_edition_base.cpp b/pcbnew/dialogs/dialog_global_modules_fields_edition_base.cpp new file mode 100644 index 0000000000..e304301bdf --- /dev/null +++ b/pcbnew/dialogs/dialog_global_modules_fields_edition_base.cpp @@ -0,0 +1,137 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Apr 10 2012) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_global_modules_fields_edition_base.h" + +/////////////////////////////////////////////////////////////////////////// + +DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE::DIALOG_GLOBAL_MODULES_FIELDS_EDITION_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* bMainSizer; + bMainSizer = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bSizerUpper; + bSizerUpper = new wxBoxSizer( wxHORIZONTAL ); + + wxBoxSizer* bLeftSizer; + bLeftSizer = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizer1; + sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Fields:") ), wxVERTICAL ); + + m_ReferenceOpt = new wxCheckBox( this, wxID_ANY, _("Modify reference"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizer1->Add( m_ReferenceOpt, 0, wxALL, 5 ); + + m_ValueOpt = new wxCheckBox( this, wxID_ANY, _("Modify value"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizer1->Add( m_ValueOpt, 0, wxALL, 5 ); + + m_OtherFields = new wxCheckBox( this, wxID_ANY, _("Modify other fields"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizer1->Add( m_OtherFields, 0, wxALL, 5 ); + + + bLeftSizer->Add( sbSizer1, 1, wxEXPAND|wxRIGHT, 5 ); + + m_staticTextFilter = new wxStaticText( this, wxID_ANY, _("Modules Filter:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextFilter->Wrap( -1 ); + m_staticTextFilter->SetToolTip( _("A string to filter modules to edit.\nIf not void, footprint names should match this filter.\nA filter can be something like SM* (case insensitive)") ); + + bLeftSizer->Add( m_staticTextFilter, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_ModuleFilter = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_ModuleFilter->SetMinSize( wxSize( 150,-1 ) ); + + bLeftSizer->Add( m_ModuleFilter, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + + bSizerUpper->Add( bLeftSizer, 1, wxEXPAND, 5 ); + + wxBoxSizer* bRightSizer; + bRightSizer = new wxBoxSizer( wxVERTICAL ); + + wxStaticBoxSizer* sbSizerSettings; + sbSizerSettings = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Current Design Settings:") ), wxVERTICAL ); + + wxFlexGridSizer* fgSizerCurrSettings; + fgSizerCurrSettings = new wxFlexGridSizer( 3, 3, 0, 0 ); + fgSizerCurrSettings->SetFlexibleDirection( wxBOTH ); + fgSizerCurrSettings->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); + + m_staticText3 = new wxStaticText( this, wxID_ANY, _("Size X:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText3->Wrap( -1 ); + fgSizerCurrSettings->Add( m_staticText3, 0, wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); + + m_SizeX_Value = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerCurrSettings->Add( m_SizeX_Value, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + + m_SizeXunit = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_SizeXunit->Wrap( -1 ); + fgSizerCurrSettings->Add( m_SizeXunit, 0, wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + + m_staticText6 = new wxStaticText( this, wxID_ANY, _("Size Y:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText6->Wrap( -1 ); + fgSizerCurrSettings->Add( m_staticText6, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT|wxALIGN_RIGHT, 5 ); + + m_SizeY_Value = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerCurrSettings->Add( m_SizeY_Value, 0, wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + + m_SizeYunit = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_SizeYunit->Wrap( -1 ); + fgSizerCurrSettings->Add( m_SizeYunit, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_staticText9 = new wxStaticText( this, wxID_ANY, _("Thickness:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText9->Wrap( -1 ); + fgSizerCurrSettings->Add( m_staticText9, 0, wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); + + m_TicknessValue = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + fgSizerCurrSettings->Add( m_TicknessValue, 0, wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + + m_Ticknessunit = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 ); + m_Ticknessunit->Wrap( -1 ); + fgSizerCurrSettings->Add( m_Ticknessunit, 0, wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + + + sbSizerSettings->Add( fgSizerCurrSettings, 1, wxEXPAND, 5 ); + + + bRightSizer->Add( sbSizerSettings, 1, wxEXPAND|wxLEFT, 5 ); + + + bSizerUpper->Add( bRightSizer, 0, wxEXPAND, 5 ); + + + bMainSizer->Add( bSizerUpper, 1, wxEXPAND, 5 ); + + m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); + bMainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 ); + + m_sdbSizerButtons = new wxStdDialogButtonSizer(); + m_sdbSizerButtonsOK = new wxButton( this, wxID_OK ); + m_sdbSizerButtons->AddButton( m_sdbSizerButtonsOK ); + m_sdbSizerButtonsCancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel ); + m_sdbSizerButtons->Realize(); + + bMainSizer->Add( m_sdbSizerButtons, 0, wxEXPAND|wxBOTTOM|wxRIGHT, 5 ); + + + this->SetSizer( bMainSizer ); + this->Layout(); + + // Connect Events + m_sdbSizerButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE::OnCancelClick ), NULL, this ); + m_sdbSizerButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE::OnOKClick ), NULL, this ); +} + +DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE::~DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE() +{ + // Disconnect Events + m_sdbSizerButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE::OnCancelClick ), NULL, this ); + m_sdbSizerButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE::OnOKClick ), NULL, this ); + +} diff --git a/pcbnew/dialogs/dialog_global_modules_fields_edition_base.fbp b/pcbnew/dialogs/dialog_global_modules_fields_edition_base.fbp new file mode 100644 index 0000000000..7df7114895 --- /dev/null +++ b/pcbnew/dialogs/dialog_global_modules_fields_edition_base.fbp @@ -0,0 +1,1492 @@ + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + dialog_global_modules_fields_edition_base + 1000 + none + 1 + dialog_global_modules_fields_edition + + . + + 1 + 1 + 1 + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE + + 482,199 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + DIALOG_SHIM; dialog_shim.h + Global Module Fields Edition + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bMainSizer + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bSizerUpper + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + bLeftSizer + wxVERTICAL + none + + 5 + wxEXPAND|wxRIGHT + 1 + + wxID_ANY + Fields: + + sbSizer1 + wxVERTICAL + none + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Modify reference + + 0 + + + 0 + + 1 + m_ReferenceOpt + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + 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 + Modify value + + 0 + + + 0 + + 1 + m_ValueOpt + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + 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 + Modify other fields + + 0 + + + 0 + + 1 + m_OtherFields + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + 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 + Modules Filter: + + 0 + + + 0 + + 1 + m_staticTextFilter + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + A string to filter modules to edit. If not void, footprint names should match this filter. A filter can be something like SM* (case insensitive) + + + + -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 + + 0 + + 0 + 150,-1 + 1 + m_ModuleFilter + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + bRightSizer + wxVERTICAL + none + + 5 + wxEXPAND|wxLEFT + 1 + + wxID_ANY + Current Design Settings: + + sbSizerSettings + wxVERTICAL + none + + + 5 + wxEXPAND + 1 + + 3 + wxBOTH + + + 0 + + fgSizerCurrSettings + wxFLEX_GROWMODE_SPECIFIED + none + 3 + 0 + + 5 + wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Size X: + + 0 + + + 0 + + 1 + m_staticText3 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT|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 + m_SizeX_Value + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT|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_SizeXunit + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT|wxALIGN_RIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Size Y: + + 0 + + + 0 + + 1 + m_staticText6 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT|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 + m_SizeY_Value + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL|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_SizeYunit + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Thickness: + + 0 + + + 0 + + 1 + m_staticText9 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT|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 + m_TicknessValue + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT|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_Ticknessunit + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND|wxBOTTOM|wxRIGHT + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbSizerButtons + protected + + OnCancelClick + + + + OnOKClick + + + + + + + + diff --git a/pcbnew/dialogs/dialog_global_modules_fields_edition_base.h b/pcbnew/dialogs/dialog_global_modules_fields_edition_base.h new file mode 100644 index 0000000000..d6d616cea1 --- /dev/null +++ b/pcbnew/dialogs/dialog_global_modules_fields_edition_base.h @@ -0,0 +1,71 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Apr 10 2012) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE_H__ +#define __DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE_H__ + +#include +#include +#include +#include "dialog_shim.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE : public DIALOG_SHIM +{ + private: + + protected: + wxCheckBox* m_ReferenceOpt; + wxCheckBox* m_ValueOpt; + wxCheckBox* m_OtherFields; + wxStaticText* m_staticTextFilter; + wxTextCtrl* m_ModuleFilter; + wxStaticText* m_staticText3; + wxTextCtrl* m_SizeX_Value; + wxStaticText* m_SizeXunit; + wxStaticText* m_staticText6; + wxTextCtrl* m_SizeY_Value; + wxStaticText* m_SizeYunit; + wxStaticText* m_staticText9; + wxTextCtrl* m_TicknessValue; + wxStaticText* m_Ticknessunit; + wxStaticLine* m_staticline1; + wxStdDialogButtonSizer* m_sdbSizerButtons; + wxButton* m_sdbSizerButtonsOK; + wxButton* m_sdbSizerButtonsCancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnOKClick( wxCommandEvent& event ) { event.Skip(); } + + + public: + + DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Global Module Fields Edition"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 482,199 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE(); + +}; + +#endif //__DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE_H__ diff --git a/pcbnew/dialogs/dialog_global_pads_edition_base.fbp b/pcbnew/dialogs/dialog_global_pads_edition_base.fbp index f2a40819b7..16bbc2b08d 100644 --- a/pcbnew/dialogs/dialog_global_pads_edition_base.fbp +++ b/pcbnew/dialogs/dialog_global_pads_edition_base.fbp @@ -1,8 +1,8 @@ - + - + C++ 1 source_name @@ -15,9 +15,9 @@ none 1 dialog_global_pads_edition - + . - + 1 1 0 @@ -28,15 +28,15 @@ 1 1 0 - - - - + + + + 1 - + 0 1 - + 1 0 Dock @@ -44,82 +44,82 @@ Left 1 impl_virtual - - + + 1 - + 0 0 wxID_ANY - - + + 0 - - + + 0 - + 1 DIALOG_GLOBAL_PADS_EDITION_BASE 1 - - + + 1 - - + + Resizable - + 1 482,165 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - + Global Pads Edition 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + bMainSizer wxHORIZONTAL none @@ -128,7 +128,7 @@ wxEXPAND 1 - + bLeftSizer wxVERTICAL none @@ -139,11 +139,11 @@ wxID_ANY Pad Filter : - + sbSizer1 wxVERTICAL none - + 5 wxALL @@ -153,83 +153,83 @@ 1 1 1 - - - - + + + + 1 0 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY Do not modify pads having a different shape - - + + 0 - - + + 0 - + 1 m_Pad_Shape_Filter_CB 1 - - + + protected 1 - - + + Resizable - + 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -241,83 +241,83 @@ 1 1 1 - - - - + + + + 1 0 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY Do not modify pads having different layers - - + + 0 - - + + 0 - + 1 m_Pad_Layer_Filter_CB 1 - - + + protected 1 - - + + Resizable - + 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -329,83 +329,83 @@ 1 1 1 - - - - + + + + 1 0 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY Do not modify pads having a different orientation - - + + 0 - - + + 0 - + 1 m_Pad_Orient_Filter_CB 1 - - + + protected 1 - - + + Resizable - + 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -417,7 +417,7 @@ wxEXPAND 0 - + bRightSizer wxVERTICAL none @@ -430,14 +430,14 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 0 @@ -445,73 +445,73 @@ 0 Left 1 - + 1 - + 0 0 ID_CHANGE_GET_PAD_SETTINGS Pad Editor - - + + 0 - - + + 0 - + 1 m_buttonPadEditor 1 - - + + protected 1 - - + + Resizable - + 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - + + + + InstallPadEditor - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + 5 - + 0 10 @@ -528,14 +528,14 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 0 @@ -543,68 +543,68 @@ 0 Left 1 - + 1 - + 0 0 ID_CHANGE_CURRENT_MODULE Change Pads on Module - - + + 0 - - + + 0 - + 1 m_buttonChangeModule 1 - - + + protected 1 - - + + Resizable - + 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - + + + + PadPropertiesAccept - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -616,14 +616,14 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 0 @@ -631,68 +631,68 @@ 0 Left 1 - + 1 - + 0 0 ID_CHANGE_ID_MODULES Change Pads on Same Modules - - + + 0 - - + + 0 - + 1 m_buttonIdModules 1 - - + + public 1 - - + + Resizable - + 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - + + + + PadPropertiesAccept - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -704,14 +704,14 @@ 1 1 1 - - - - + + + + 1 0 1 - + 1 0 0 @@ -719,68 +719,68 @@ 0 Left 1 - + 1 - + 0 0 wxID_ANY Cancel - - + + 0 - - + + 0 - + 1 m_buttonCancel 1 - - + + protected 1 - - + + Resizable - + 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - - - - + + + + OnCancelClick - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index d9127490a7..c21616962d 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -1078,14 +1078,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) Swap_Layers( event ); break; - case ID_MENU_PCB_RESET_TEXTMODULE_REFERENCE_SIZES: - ResetModuleTextSizes( TEXT_is_REFERENCE, &dc ); - break; - - case ID_MENU_PCB_RESET_TEXTMODULE_VALUE_SIZES: - ResetModuleTextSizes( TEXT_is_VALUE, &dc ); - break; - case ID_PCB_USER_GRID_SETUP: InstallGridFrame( pos ); break; diff --git a/pcbnew/edtxtmod.cpp b/pcbnew/edtxtmod.cpp index 5ffea421b9..836dd677f9 100644 --- a/pcbnew/edtxtmod.cpp +++ b/pcbnew/edtxtmod.cpp @@ -1,8 +1,8 @@ /* * 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) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr + * Copyright (C) 1992-2012 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 @@ -37,7 +37,7 @@ #include #include -#include +#include #include #include @@ -356,107 +356,3 @@ void PCB_BASE_FRAME::ResetTextSize( BOARD_ITEM* aItem, wxDC* aDC ) OnModify(); } - -void PCB_BASE_FRAME::ResetModuleTextSizes( int aType, wxDC* aDC ) -{ - MODULE* module; - BOARD_ITEM* boardItem; - TEXTE_MODULE* item; - ITEM_PICKER itemWrapper( NULL, UR_CHANGED ); - PICKED_ITEMS_LIST undoItemList; - unsigned int ii; - - module = GetBoard()->m_Modules; - - // Prepare undo list - while( module ) - { - itemWrapper.SetItem( module ); - - switch( aType ) - { - case TEXT_is_REFERENCE: - item = module->m_Reference; - - if( item->GetSize() != GetDesignSettings().m_ModuleTextSize || item->GetThickness() != GetDesignSettings().m_ModuleTextWidth ) - undoItemList.PushItem( itemWrapper ); - - break; - - case TEXT_is_VALUE: - item = module->m_Value; - - if( item->GetSize() != GetDesignSettings().m_ModuleTextSize || - item->GetThickness() != GetDesignSettings().m_ModuleTextWidth ) - undoItemList.PushItem( itemWrapper ); - - break; - - case TEXT_is_DIVERS: - // Go through all other module text fields - for( boardItem = module->m_Drawings; boardItem; boardItem = boardItem->Next() ) - { - if( boardItem->Type() == PCB_MODULE_TEXT_T ) - { - item = (TEXTE_MODULE*) boardItem; - - if( item->GetSize() != GetDesignSettings().m_ModuleTextSize - || item->GetThickness() != GetDesignSettings().m_ModuleTextWidth ) - { - undoItemList.PushItem( itemWrapper ); - break; - } - } - } - - break; - - default: - break; - } - module = module->Next(); - } - - // Exit if there's nothing to do - if( !undoItemList.GetCount() ) - return; - - SaveCopyInUndoList( undoItemList, UR_CHANGED ); - - // Apply changes to modules in the undo list - for( ii = 0; ii < undoItemList.GetCount(); ii++ ) - { - module = (MODULE*) undoItemList.GetPickedItem( ii ); - - switch( aType ) - { - case TEXT_is_REFERENCE: - module->m_Reference->SetThickness( GetDesignSettings().m_ModuleTextWidth ); - module->m_Reference->SetSize( GetDesignSettings().m_ModuleTextSize ); - break; - - case TEXT_is_VALUE: - module->m_Value->SetThickness( GetDesignSettings().m_ModuleTextWidth ); - module->m_Value->SetSize( GetDesignSettings().m_ModuleTextSize ); - break; - - case TEXT_is_DIVERS: - for( boardItem = module->m_Drawings; boardItem; boardItem = boardItem->Next() ) - { - if( boardItem->Type() == PCB_MODULE_TEXT_T ) - { - item = (TEXTE_MODULE*) boardItem; - item->SetThickness( GetDesignSettings().m_ModuleTextWidth ); - item->SetSize( GetDesignSettings().m_ModuleTextSize ); - } - } - - break; - } - } - - if( aDC ) - m_canvas->Refresh(); - - OnModify(); -} diff --git a/pcbnew/menubar_pcbframe.cpp b/pcbnew/menubar_pcbframe.cpp index 5df5fee5e4..8e8877dab9 100644 --- a/pcbnew/menubar_pcbframe.cpp +++ b/pcbnew/menubar_pcbframe.cpp @@ -295,15 +295,9 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() KiBitmap( swap_layer_xpm ) ); // Reset module reference sizes - AddMenuItem( editMenu, ID_MENU_PCB_RESET_TEXTMODULE_REFERENCE_SIZES, - _( "Reset Module &Reference Sizes" ), - _( "Reset text size and width of all module references to current defaults" ), - KiBitmap( reset_text_xpm ) ); - - // Reset module value sizes - AddMenuItem( editMenu, ID_MENU_PCB_RESET_TEXTMODULE_VALUE_SIZES, - _( "Reset Module &Value Sizes" ), - _( "Reset text size and width of all module values to current defaults" ), + AddMenuItem( editMenu, ID_MENU_PCB_RESET_TEXTMODULE_FIELDS_SIZES, + _( "&Reset Module Field Sizes" ), + _( "Reset text size and width of all module fields to current defaults" ), KiBitmap( reset_text_xpm ) ); /** Create View menu **/ diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index b64fd4ddf0..2af5e03aff 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -135,10 +135,8 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) EVT_MENU( ID_PCB_GLOBAL_DELETE, PCB_EDIT_FRAME::Process_Special_Functions ) EVT_MENU( ID_MENU_PCB_CLEAN, PCB_EDIT_FRAME::Process_Special_Functions ) EVT_MENU( ID_MENU_PCB_SWAP_LAYERS, PCB_EDIT_FRAME::Process_Special_Functions ) - EVT_MENU( ID_MENU_PCB_RESET_TEXTMODULE_REFERENCE_SIZES, - PCB_EDIT_FRAME::Process_Special_Functions ) - EVT_MENU( ID_MENU_PCB_RESET_TEXTMODULE_VALUE_SIZES, - PCB_EDIT_FRAME::Process_Special_Functions ) + EVT_MENU( ID_MENU_PCB_RESET_TEXTMODULE_FIELDS_SIZES, + PCB_EDIT_FRAME::OnResetModuleTextSizes ) // Menu Help EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp ) diff --git a/pcbnew/pcbnew_id.h b/pcbnew/pcbnew_id.h index 88bf2da19c..7f49e0bf3d 100644 --- a/pcbnew/pcbnew_id.h +++ b/pcbnew/pcbnew_id.h @@ -219,8 +219,7 @@ enum pcbnew_ids ID_MENU_LIST_NETS, ID_MENU_PCB_CLEAN, ID_MENU_PCB_SWAP_LAYERS, - ID_MENU_PCB_RESET_TEXTMODULE_REFERENCE_SIZES, - ID_MENU_PCB_RESET_TEXTMODULE_VALUE_SIZES, + ID_MENU_PCB_RESET_TEXTMODULE_FIELDS_SIZES, ID_GEN_EXPORT_FILE_VRML, ID_GEN_EXPORT_SPECCTRA, From f1284bd73c175ecf0895f27452afc12322a4c860 Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Tue, 29 May 2012 13:10:56 -0500 Subject: [PATCH 03/17] Mostly EAGLE_PLUGIN work: * Derive the pcbnew copper zone and non-copper zone dialog windows from DIAG_SHIM, which injects some template code. * Update UIpolicies.txt to talk about DIALOG_SHIM support. * Add zone support to eagle_plugin. * Organize ZONE_CONTAINER class declaration for future privacy and accessors. --- Documentation/guidelines/UIpolicies.txt | 8 + pcbnew/class_board.cpp | 2 +- pcbnew/class_zone.cpp | 8 +- pcbnew/class_zone.h | 114 +- pcbnew/dialogs/dialog_copper_zones.cpp | 23 +- pcbnew/dialogs/dialog_copper_zones_base.cpp | 524 +- pcbnew/dialogs/dialog_copper_zones_base.fbp | 6933 ++++++++--------- pcbnew/dialogs/dialog_copper_zones_base.h | 263 +- ...ialog_non_copper_zones_properties_base.cpp | 11 +- ...ialog_non_copper_zones_properties_base.fbp | 1544 ++-- .../dialog_non_copper_zones_properties_base.h | 21 +- pcbnew/eagle_plugin.cpp | 484 +- pcbnew/eagle_plugin.h | 24 +- pcbnew/specctra_export.cpp | 2 +- pcbnew/zones_by_polygon.cpp | 2 +- pcbnew/zones_non_copper_type_functions.cpp | 1 - pcbnew/zones_test_and_combine_areas.cpp | 6 +- 17 files changed, 5236 insertions(+), 4734 deletions(-) diff --git a/Documentation/guidelines/UIpolicies.txt b/Documentation/guidelines/UIpolicies.txt index 60d3ded9e3..f0de9f7d3b 100644 --- a/Documentation/guidelines/UIpolicies.txt +++ b/Documentation/guidelines/UIpolicies.txt @@ -42,6 +42,14 @@ Dialogs: leaving them all bundled tightly together. The dialog box should look nice at any size large enough to show all the components. + When using wxFormBuilder, please add the following settings to the + "Dialog" node: + subclass.name <- DIALOG_SHIM + subclass.header <- dialog_shim.h + + This will provide for an override of the Show( bool ) wxWindow() function + and provide retentitive size and position for the session. + Use tooltips to explain the functionality of each non-obvious control. This is important because the help files and the wiki often lag behind the source code. diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 38f8d95828..3756e8d380 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -1468,7 +1468,7 @@ int BOARD::SetAreasNetCodesFromNetNames( void ) if( GetArea( ii )->GetNet() != 0 ) // i.e. if this zone is connected to a net { - const NETINFO_ITEM* net = FindNet( GetArea( ii )->m_Netname ); + const NETINFO_ITEM* net = FindNet( GetArea( ii )->GetNetName() ); if( net ) { diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index d6e2b1c1e3..635d08160b 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -74,6 +74,7 @@ ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) : // For corner moving, corner index to drag, or -1 if no selection m_CornerSelection = -1; + m_IsFilled = aZone.m_IsFilled; m_ZoneClearance = aZone.m_ZoneClearance; // clearance value m_ZoneMinThickness = aZone.m_ZoneMinThickness; m_FillMode = aZone.m_FillMode; // Filling mode (segments/polygons) @@ -84,6 +85,11 @@ ZONE_CONTAINER::ZONE_CONTAINER( const ZONE_CONTAINER& aZone ) : m_ThermalReliefCopperBridge = aZone.m_ThermalReliefCopperBridge; m_FilledPolysList = aZone.m_FilledPolysList; m_FillSegmList = aZone.m_FillSegmList; + + cornerSmoothingType = aZone.cornerSmoothingType; + cornerRadius = aZone.cornerRadius; + utility = aZone.utility; + utility2 = aZone.utility; } @@ -717,7 +723,7 @@ void ZONE_CONTAINER::DisplayInfo( EDA_DRAW_FRAME* frame ) frame->AppendMsgPanel( _( "Corners" ), msg, BLUE ); if( m_FillMode ) - msg.Printf( _( "Segments" ), m_FillMode ); + msg = _( "Segments" ); else msg = _( "Polygons" ); diff --git a/pcbnew/class_zone.h b/pcbnew/class_zone.h index 645e3bad85..1b80fc8173 100644 --- a/pcbnew/class_zone.h +++ b/pcbnew/class_zone.h @@ -77,58 +77,7 @@ struct SEGMENT class ZONE_CONTAINER : public BOARD_CONNECTED_ITEM { public: - wxString m_Netname; // Net Name - CPolyLine* m_Poly; // outlines - // For corner moving, corner index to drag, or -1 if no selection. - int m_CornerSelection; - int m_ZoneClearance; // clearance value - int m_ZoneMinThickness; // Min thickness value in filled areas - - // How to fill areas: 0 = use filled polygons, != 0 fill with segments. - int m_FillMode; - - // number of segments to convert a circle to a polygon (uses - //ARC_APPROX_SEGMENTS_COUNT_LOW_DEF or ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF) - int m_ArcToSegmentsCount; - - // thickness of the gap in thermal reliefs. - int m_ThermalReliefGap; - - // thickness of the copper bridge in thermal reliefs - int m_ThermalReliefCopperBridge; - int utility, utility2; // flags used in polygon calculations - - // true when a zone was filled, false after deleting the filled areas - bool m_IsFilled; - - /* set of filled polygons used to draw a zone as a filled area. - * from outlines (m_Poly) but unlike m_Poly these filled polygons have no hole - * (they are* all in one piece) In very simple cases m_FilledPolysList is same - * as m_Poly. In less simple cases (when m_Poly has holes) m_FilledPolysList is - * a polygon equivalent to m_Poly, without holes but with extra outline segment - * connecting "holes" with external main outline. In complex cases an outline - * described by m_Poly can have many filled areas - */ - std::vector m_FilledPolysList; - - /* set of segments used to fill area, when fill zone by segment is used. - * ( m_FillMode == 1 ) - * in this case segments have m_ZoneMinThickness width - */ - std::vector m_FillSegmList; - -private: - CPolyLine* smoothedPoly; // Corner-smoothed version of m_Poly - int cornerSmoothingType; - unsigned int cornerRadius; - // Priority: when a zone outline is inside and other zone, if its priority is higher - // the other zone priority, it will be created inside. - // if priorities are equal, a DRC error is set - unsigned m_priority; - ZoneConnection m_PadConnection; - -public: ZONE_CONTAINER( BOARD* parent ); ZONE_CONTAINER( const ZONE_CONTAINER& aZone ); @@ -257,13 +206,13 @@ public: * returns the net name. * @return const wxString& - The net name. */ - const wxString& GetNetName() const { return m_Netname; }; - void SetNetName( const wxString& aName ) { m_Netname = aName; } + const wxString& GetNetName() const { return m_Netname; }; + void SetNetName( const wxString& aName ) { m_Netname = aName; } - void SetFillMode( int aFillMode ) { m_FillMode = aFillMode; } - int GetFillMode() const { return m_FillMode; } + void SetFillMode( int aFillMode ) { m_FillMode = aFillMode; } + int GetFillMode() const { return m_FillMode; } - void SetThermalReliefGap( int aThermalReliefGap ) { m_ThermalReliefGap = aThermalReliefGap; } + void SetThermalReliefGap( int aThermalReliefGap ) { m_ThermalReliefGap = aThermalReliefGap; } int GetThermalReliefGap( D_PAD* aPad = NULL ) const; void SetThermalReliefCopperBridge( int aThermalReliefCopperBridge ) @@ -547,6 +496,59 @@ public: #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override #endif + + + CPolyLine* m_Poly; // outlines + + // For corner moving, corner index to drag, or -1 if no selection. + int m_CornerSelection; + int m_ZoneClearance; // clearance value + int m_ZoneMinThickness; // Min thickness value in filled areas + + // How to fill areas: 0 = use filled polygons, != 0 fill with segments. + int m_FillMode; + + // number of segments to convert a circle to a polygon (uses + //ARC_APPROX_SEGMENTS_COUNT_LOW_DEF or ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF) + int m_ArcToSegmentsCount; + + // thickness of the gap in thermal reliefs. + int m_ThermalReliefGap; + + // thickness of the copper bridge in thermal reliefs + int m_ThermalReliefCopperBridge; + int utility, utility2; // flags used in polygon calculations + + // true when a zone was filled, false after deleting the filled areas + bool m_IsFilled; + + /* set of filled polygons used to draw a zone as a filled area. + * from outlines (m_Poly) but unlike m_Poly these filled polygons have no hole + * (they are* all in one piece) In very simple cases m_FilledPolysList is same + * as m_Poly. In less simple cases (when m_Poly has holes) m_FilledPolysList is + * a polygon equivalent to m_Poly, without holes but with extra outline segment + * connecting "holes" with external main outline. In complex cases an outline + * described by m_Poly can have many filled areas + */ + std::vector m_FilledPolysList; + + /* set of segments used to fill area, when fill zone by segment is used. + * ( m_FillMode == 1 ) + * in this case segments have m_ZoneMinThickness width + */ + std::vector m_FillSegmList; + + +private: + wxString m_Netname; // Net Name + CPolyLine* smoothedPoly; // Corner-smoothed version of m_Poly + int cornerSmoothingType; + unsigned int cornerRadius; + // Priority: when a zone outline is inside and other zone, if its priority is higher + // the other zone priority, it will be created inside. + // if priorities are equal, a DRC error is set + unsigned m_priority; + ZoneConnection m_PadConnection; }; diff --git a/pcbnew/dialogs/dialog_copper_zones.cpp b/pcbnew/dialogs/dialog_copper_zones.cpp index 4a047dd6f0..ac4f324cf1 100644 --- a/pcbnew/dialogs/dialog_copper_zones.cpp +++ b/pcbnew/dialogs/dialog_copper_zones.cpp @@ -56,9 +56,6 @@ private: wxListView* m_LayerSelectionCtrl; - static wxPoint prevPosition; ///< Dialog position & size - static wxSize prevSize; - /** * Function initDialog * fills in the dialog controls using the current settings. @@ -108,8 +105,6 @@ private: // Initialize static member variables wxString DIALOG_COPPER_ZONE::m_netNameShowFilter( wxT( "*" ) ); -wxPoint DIALOG_COPPER_ZONE::prevPosition( -1, -1 ); -wxSize DIALOG_COPPER_ZONE::prevSize; ZONE_EDIT_T InvokeCopperZonesEditor( PCB_BASE_FRAME* aCaller, ZONE_SETTINGS* aSettings ) @@ -157,11 +152,7 @@ DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* GetSizer()->SetSizeHints( this ); - if( prevPosition.x != -1 ) - SetSize( prevPosition.x, prevPosition.y, - prevSize.x, prevSize.y ); - else - Center(); + Center(); } @@ -169,8 +160,6 @@ void DIALOG_COPPER_ZONE::initDialog() { BOARD* board = m_Parent->GetBoard(); - SetFocus(); // Required under wxGTK if we want to demiss the dialog with the ESC key - wxString msg; if( m_settings.m_Zone_45_Only ) @@ -297,8 +286,6 @@ void DIALOG_COPPER_ZONE::OnButtonCancelClick( wxCommandEvent& event ) void DIALOG_COPPER_ZONE::OnButtonOkClick( wxCommandEvent& event ) { m_netNameShowFilter = m_ShowNetNameFilter->GetValue(); - prevPosition = GetPosition(); - prevSize = GetSize(); if( AcceptOptions( true ) ) { @@ -311,9 +298,6 @@ void DIALOG_COPPER_ZONE::OnButtonOkClick( wxCommandEvent& event ) // called on system close button void DIALOG_COPPER_ZONE::OnClose( wxCloseEvent& event ) { - prevPosition = GetPosition(); - prevSize = GetSize(); - if( m_OnExitCode != ZONE_ABORT ) *m_ptr = m_settings; @@ -384,7 +368,7 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab wxString txtvalue = m_ZoneClearanceCtrl->GetValue(); m_settings.m_ZoneClearance = ReturnValueFromString( g_UserUnit, txtvalue ); - // Test if this is a reasonnable value for this parameter + // Test if this is a reasonable value for this parameter // A too large value can hang Pcbnew #define CLEARANCE_MAX_VALUE 5000 // in 1/10000 inch if( m_settings.m_ZoneClearance > CLEARANCE_MAX_VALUE ) @@ -519,9 +503,6 @@ void DIALOG_COPPER_ZONE::OnNetSortingOptionSelected( wxCommandEvent& event ) void DIALOG_COPPER_ZONE::ExportSetupToOtherCopperZones( wxCommandEvent& event ) { - prevPosition = GetPosition(); - prevSize = GetSize(); - if( !AcceptOptions( true, true ) ) return; diff --git a/pcbnew/dialogs/dialog_copper_zones_base.cpp b/pcbnew/dialogs/dialog_copper_zones_base.cpp index 3a8f99b575..b793d06e6c 100644 --- a/pcbnew/dialogs/dialog_copper_zones_base.cpp +++ b/pcbnew/dialogs/dialog_copper_zones_base.cpp @@ -1,256 +1,268 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 30 2011) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#include "dialog_copper_zones_base.h" - -/////////////////////////////////////////////////////////////////////////// - -BEGIN_EVENT_TABLE( DIALOG_COPPER_ZONE_BASE, wxDialog ) - EVT_CLOSE( DIALOG_COPPER_ZONE_BASE::_wxFB_OnClose ) - EVT_SIZE( DIALOG_COPPER_ZONE_BASE::_wxFB_OnSize ) - EVT_CHOICE( ID_M_NETDISPLAYOPTION, DIALOG_COPPER_ZONE_BASE::_wxFB_OnNetSortingOptionSelected ) - EVT_TEXT_ENTER( ID_TEXTCTRL_NETNAMES_FILTER, DIALOG_COPPER_ZONE_BASE::_wxFB_OnRunFiltersButtonClick ) - EVT_TEXT_ENTER( ID_TEXTCTRL_NETNAMES_FILTER, DIALOG_COPPER_ZONE_BASE::_wxFB_OnRunFiltersButtonClick ) - EVT_BUTTON( wxID_APPLY_FILTERS, DIALOG_COPPER_ZONE_BASE::_wxFB_OnRunFiltersButtonClick ) - EVT_CHOICE( ID_CORNER_SMOOTHING, DIALOG_COPPER_ZONE_BASE::_wxFB_OnCornerSmoothingModeChoice ) - EVT_CHOICE( ID_M_PADINZONEOPT, DIALOG_COPPER_ZONE_BASE::_wxFB_OnPadsInZoneClick ) - EVT_BUTTON( wxID_BUTTON_EXPORT, DIALOG_COPPER_ZONE_BASE::_wxFB_ExportSetupToOtherCopperZones ) - EVT_BUTTON( wxID_OK, DIALOG_COPPER_ZONE_BASE::_wxFB_OnButtonOkClick ) - EVT_BUTTON( wxID_CANCEL, DIALOG_COPPER_ZONE_BASE::_wxFB_OnButtonCancelClick ) -END_EVENT_TABLE() - -DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_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 ); - - m_MainBoxSizer = new wxBoxSizer( wxVERTICAL ); - - wxBoxSizer* m_OptionsBoxSizer; - m_OptionsBoxSizer = new wxBoxSizer( wxHORIZONTAL ); - - m_layerSizer = new wxBoxSizer( wxVERTICAL ); - - m_staticText17 = new wxStaticText( this, wxID_ANY, _("Layer:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText17->Wrap( -1 ); - m_layerSizer->Add( m_staticText17, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); - - m_OptionsBoxSizer->Add( m_layerSizer, 1, wxEXPAND, 5 ); - - wxBoxSizer* bSizer7; - bSizer7 = 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 ); - - m_ListNetNameSelection = new wxListBox( this, ID_NETNAME_SELECTION, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - bSizer7->Add( m_ListNetNameSelection, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - m_OptionsBoxSizer->Add( bSizer7, 1, wxEXPAND, 5 ); - - wxStaticBoxSizer* m_NetSortOptSizer; - m_NetSortOptSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Net Filtering") ), wxVERTICAL ); - - m_staticText16 = new wxStaticText( this, wxID_ANY, _("Display:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText16->Wrap( -1 ); - m_NetSortOptSizer->Add( m_staticText16, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); - - wxString m_NetDisplayOptionChoices[] = { _("Show all (alphabetical)"), _("Show all (advanced)"), _("Filtered (alphabetical)"), _("Filtered (advanced)") }; - int m_NetDisplayOptionNChoices = sizeof( m_NetDisplayOptionChoices ) / sizeof( wxString ); - m_NetDisplayOption = new wxChoice( this, ID_M_NETDISPLAYOPTION, wxDefaultPosition, wxDefaultSize, m_NetDisplayOptionNChoices, m_NetDisplayOptionChoices, 0 ); - m_NetDisplayOption->SetSelection( 0 ); - m_NetSortOptSizer->Add( m_NetDisplayOption, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - - m_staticText5 = new wxStaticText( this, wxID_ANY, _("Hidden net filter:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText5->Wrap( -1 ); - 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->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 ); - - m_staticText51 = new wxStaticText( this, wxID_ANY, _("Visible net filter:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText51->Wrap( -1 ); - 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->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 ); - - m_buttonRunFilter = new wxButton( this, wxID_APPLY_FILTERS, _("Apply Filters"), wxDefaultPosition, wxDefaultSize, 0 ); - m_NetSortOptSizer->Add( m_buttonRunFilter, 0, wxALL|wxEXPAND, 5 ); - - m_OptionsBoxSizer->Add( m_NetSortOptSizer, 0, wxALL, 5 ); - - m_MainBoxSizer->Add( m_OptionsBoxSizer, 1, wxALL|wxEXPAND, 5 ); - - wxStaticBoxSizer* m_ExportableSetupSizer; - m_ExportableSetupSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Settings") ), wxHORIZONTAL ); - - wxBoxSizer* bSizer9; - bSizer9 = new wxBoxSizer( wxVERTICAL ); - - m_ClearanceValueTitle = new wxStaticText( this, wxID_ANY, _("Clearance"), wxDefaultPosition, wxDefaultSize, 0 ); - m_ClearanceValueTitle->Wrap( -1 ); - bSizer9->Add( m_ClearanceValueTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_ZoneClearanceCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bSizer9->Add( m_ZoneClearanceCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - m_MinThicknessValueTitle = new wxStaticText( this, wxID_ANY, _("Minimum width"), wxDefaultPosition, wxDefaultSize, 0 ); - m_MinThicknessValueTitle->Wrap( -1 ); - m_MinThicknessValueTitle->SetToolTip( _("Minimun thickness of filled areas.") ); - - bSizer9->Add( m_MinThicknessValueTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_ZoneMinThicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bSizer9->Add( m_ZoneMinThicknessCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - m_staticText151 = new wxStaticText( this, wxID_ANY, _("Corner smoothing:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText151->Wrap( -1 ); - bSizer9->Add( m_staticText151, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); - - wxString m_cornerSmoothingChoiceChoices[] = { _("None"), _("Chamfer"), _("Fillet") }; - int m_cornerSmoothingChoiceNChoices = sizeof( m_cornerSmoothingChoiceChoices ) / sizeof( wxString ); - m_cornerSmoothingChoice = new wxChoice( this, ID_CORNER_SMOOTHING, wxDefaultPosition, wxDefaultSize, m_cornerSmoothingChoiceNChoices, m_cornerSmoothingChoiceChoices, 0 ); - m_cornerSmoothingChoice->SetSelection( 0 ); - bSizer9->Add( m_cornerSmoothingChoice, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - - m_cornerSmoothingTitle = new wxStaticText( this, wxID_ANY, _("Chamfer distance (mm):"), wxDefaultPosition, wxDefaultSize, 0 ); - m_cornerSmoothingTitle->Wrap( -1 ); - bSizer9->Add( m_cornerSmoothingTitle, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); - - m_cornerSmoothingCtrl = new wxTextCtrl( this, ID_M_CORNERSMOOTHINGCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - bSizer9->Add( m_cornerSmoothingCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - - m_ExportableSetupSizer->Add( bSizer9, 0, wxEXPAND, 5 ); - - wxBoxSizer* m_LeftBox; - m_LeftBox = new wxBoxSizer( wxVERTICAL ); - - m_staticText13 = new wxStaticText( this, wxID_ANY, _("Pad connection:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText13->Wrap( -1 ); - m_LeftBox->Add( m_staticText13, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); - - wxString m_PadInZoneOptChoices[] = { _("Solid"), _("Thermal relief"), _("None") }; - int m_PadInZoneOptNChoices = sizeof( m_PadInZoneOptChoices ) / sizeof( wxString ); - m_PadInZoneOpt = new wxChoice( this, ID_M_PADINZONEOPT, wxDefaultPosition, wxDefaultSize, m_PadInZoneOptNChoices, m_PadInZoneOptChoices, 0 ); - m_PadInZoneOpt->SetSelection( 0 ); - m_LeftBox->Add( m_PadInZoneOpt, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - - wxStaticBoxSizer* m_ThermalShapesParamsSizer; - m_ThermalShapesParamsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Thermal Reliefs") ), wxVERTICAL ); - - m_AntipadSizeText = new wxStaticText( this, wxID_ANY, _("Antipad clearance"), wxDefaultPosition, wxDefaultSize, 0 ); - m_AntipadSizeText->Wrap( -1 ); - m_ThermalShapesParamsSizer->Add( m_AntipadSizeText, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); - - m_AntipadSizeValue = new wxTextCtrl( this, wxID_ANTIPAD_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_AntipadSizeValue->SetToolTip( _("Clearance between pads in the same net and filled areas.") ); - - m_ThermalShapesParamsSizer->Add( m_AntipadSizeValue, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - - m_CopperBridgeWidthText = new wxStaticText( this, wxID_ANY, _("Spoke width"), wxDefaultPosition, wxDefaultSize, 0 ); - m_CopperBridgeWidthText->Wrap( -1 ); - m_ThermalShapesParamsSizer->Add( m_CopperBridgeWidthText, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_CopperWidthValue = new wxTextCtrl( this, wxID_COPPER_BRIDGE_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_CopperWidthValue->SetToolTip( _("Width of copper in thermal reliefs.") ); - - m_ThermalShapesParamsSizer->Add( m_CopperWidthValue, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - - m_LeftBox->Add( m_ThermalShapesParamsSizer, 0, wxALL|wxEXPAND, 5 ); - - m_ExportableSetupSizer->Add( m_LeftBox, 0, wxEXPAND, 5 ); - - wxBoxSizer* m_MiddleBox; - m_MiddleBox = new wxBoxSizer( wxVERTICAL ); - - m_staticText171 = new wxStaticText( this, wxID_ANY, _("Priority level:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText171->Wrap( -1 ); - m_staticText171->SetToolTip( _("On each copper layer, zones are filled by priority order.\nSo when a zone is inside an other zone:\n* If its priority is highter: its outlines are removed from the other layer.\n* If its priority is equal: a DRC error is set.") ); - - m_MiddleBox->Add( m_staticText171, 0, wxRIGHT|wxLEFT, 5 ); - - m_PriorityLevelCtrl = new wxSpinCtrl( this, ID_M_PRIORITYLEVELCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 100, 0 ); - m_MiddleBox->Add( m_PriorityLevelCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); - - m_staticText11 = new wxStaticText( this, wxID_ANY, _("Fill mode:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText11->Wrap( -1 ); - m_MiddleBox->Add( m_staticText11, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); - - wxString m_FillModeCtrlChoices[] = { _("Polygon"), _("Segment") }; - int m_FillModeCtrlNChoices = sizeof( m_FillModeCtrlChoices ) / sizeof( wxString ); - m_FillModeCtrl = new wxChoice( this, ID_M_FILLMODECTRL, wxDefaultPosition, wxDefaultSize, m_FillModeCtrlNChoices, m_FillModeCtrlChoices, 0 ); - m_FillModeCtrl->SetSelection( 0 ); - m_MiddleBox->Add( m_FillModeCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - - m_staticText12 = new wxStaticText( this, wxID_ANY, _("Segments / 360 deg:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText12->Wrap( -1 ); - m_MiddleBox->Add( m_staticText12, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); - - wxString m_ArcApproximationOptChoices[] = { _("16"), _("32") }; - int m_ArcApproximationOptNChoices = sizeof( m_ArcApproximationOptChoices ) / sizeof( wxString ); - m_ArcApproximationOpt = new wxChoice( this, ID_M_ARCAPPROXIMATIONOPT, wxDefaultPosition, wxDefaultSize, m_ArcApproximationOptNChoices, m_ArcApproximationOptChoices, 0 ); - m_ArcApproximationOpt->SetSelection( 0 ); - m_MiddleBox->Add( m_ArcApproximationOpt, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - - m_ExportableSetupSizer->Add( m_MiddleBox, 0, wxEXPAND, 5 ); - - wxBoxSizer* bSizer81; - bSizer81 = new wxBoxSizer( wxVERTICAL ); - - m_staticText14 = new wxStaticText( this, wxID_ANY, _("Outline slope:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText14->Wrap( -1 ); - bSizer81->Add( m_staticText14, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); - - wxString m_OrientEdgesOptChoices[] = { _("Arbitrary"), _("H, V, and 45 deg only") }; - int m_OrientEdgesOptNChoices = sizeof( m_OrientEdgesOptChoices ) / sizeof( wxString ); - m_OrientEdgesOpt = new wxChoice( this, ID_M_ORIENTEDGESOPT, wxDefaultPosition, wxDefaultSize, m_OrientEdgesOptNChoices, m_OrientEdgesOptChoices, 0 ); - m_OrientEdgesOpt->SetSelection( 0 ); - bSizer81->Add( m_OrientEdgesOpt, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - - m_staticText15 = new wxStaticText( this, wxID_ANY, _("Outline style:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText15->Wrap( -1 ); - bSizer81->Add( m_staticText15, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); - - wxString m_OutlineAppearanceCtrlChoices[] = { _("Line"), _("Hatched"), _("Fully hatched") }; - int m_OutlineAppearanceCtrlNChoices = sizeof( m_OutlineAppearanceCtrlChoices ) / sizeof( wxString ); - m_OutlineAppearanceCtrl = new wxChoice( this, ID_M_OUTLINEAPPEARANCECTRL, wxDefaultPosition, wxDefaultSize, m_OutlineAppearanceCtrlNChoices, m_OutlineAppearanceCtrlChoices, 0 ); - m_OutlineAppearanceCtrl->SetSelection( 0 ); - bSizer81->Add( m_OutlineAppearanceCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - - m_ExportableSetupSizer->Add( bSizer81, 0, wxEXPAND, 5 ); - - m_MainBoxSizer->Add( m_ExportableSetupSizer, 1, wxALL|wxEXPAND, 5 ); - - wxBoxSizer* bSizer10; - bSizer10 = new wxBoxSizer( wxHORIZONTAL ); - - m_ExportSetupButton = new wxButton( this, wxID_BUTTON_EXPORT, _("Export Settings to Other Zones"), wxDefaultPosition, wxDefaultSize, 0 ); - m_ExportSetupButton->SetToolTip( _("Export this zone setup (excluding layer and net selection) to all other copper zones.") ); - - bSizer10->Add( m_ExportSetupButton, 0, wxALL|wxEXPAND, 5 ); - - m_OkButton = new wxButton( this, wxID_OK, _("Ok"), wxDefaultPosition, wxDefaultSize, 0 ); - m_OkButton->SetDefault(); - bSizer10->Add( m_OkButton, 0, wxALL|wxEXPAND, 5 ); - - m_ButtonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer10->Add( m_ButtonCancel, 0, wxALL|wxEXPAND, 5 ); - - m_MainBoxSizer->Add( bSizer10, 0, wxALIGN_RIGHT|wxALL, 5 ); - - this->SetSizer( m_MainBoxSizer ); - this->Layout(); -} - -DIALOG_COPPER_ZONE_BASE::~DIALOG_COPPER_ZONE_BASE() -{ -} +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Apr 11 2012) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_copper_zones_base.h" + +/////////////////////////////////////////////////////////////////////////// + +BEGIN_EVENT_TABLE( DIALOG_COPPER_ZONE_BASE, DIALOG_SHIM ) + EVT_CLOSE( DIALOG_COPPER_ZONE_BASE::_wxFB_OnClose ) + EVT_SIZE( DIALOG_COPPER_ZONE_BASE::_wxFB_OnSize ) + EVT_CHOICE( ID_M_NETDISPLAYOPTION, DIALOG_COPPER_ZONE_BASE::_wxFB_OnNetSortingOptionSelected ) + EVT_TEXT_ENTER( ID_TEXTCTRL_NETNAMES_FILTER, DIALOG_COPPER_ZONE_BASE::_wxFB_OnRunFiltersButtonClick ) + EVT_TEXT_ENTER( ID_TEXTCTRL_NETNAMES_FILTER, DIALOG_COPPER_ZONE_BASE::_wxFB_OnRunFiltersButtonClick ) + EVT_BUTTON( wxID_APPLY_FILTERS, DIALOG_COPPER_ZONE_BASE::_wxFB_OnRunFiltersButtonClick ) + EVT_CHOICE( ID_CORNER_SMOOTHING, DIALOG_COPPER_ZONE_BASE::_wxFB_OnCornerSmoothingModeChoice ) + EVT_CHOICE( ID_M_PADINZONEOPT, DIALOG_COPPER_ZONE_BASE::_wxFB_OnPadsInZoneClick ) + EVT_BUTTON( wxID_BUTTON_EXPORT, DIALOG_COPPER_ZONE_BASE::_wxFB_ExportSetupToOtherCopperZones ) + EVT_BUTTON( wxID_OK, DIALOG_COPPER_ZONE_BASE::_wxFB_OnButtonOkClick ) + EVT_BUTTON( wxID_CANCEL, DIALOG_COPPER_ZONE_BASE::_wxFB_OnButtonCancelClick ) +END_EVENT_TABLE() + +DIALOG_COPPER_ZONE_BASE::DIALOG_COPPER_ZONE_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 ); + + m_MainBoxSizer = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* m_OptionsBoxSizer; + m_OptionsBoxSizer = new wxBoxSizer( wxHORIZONTAL ); + + m_layerSizer = new wxBoxSizer( wxVERTICAL ); + + m_staticText17 = new wxStaticText( this, wxID_ANY, _("Layer:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText17->Wrap( -1 ); + m_layerSizer->Add( m_staticText17, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); + + + m_OptionsBoxSizer->Add( m_layerSizer, 1, wxEXPAND, 5 ); + + wxBoxSizer* bSizer7; + bSizer7 = 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 ); + + m_ListNetNameSelection = new wxListBox( this, ID_NETNAME_SELECTION, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + bSizer7->Add( m_ListNetNameSelection, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + + m_OptionsBoxSizer->Add( bSizer7, 1, wxEXPAND, 5 ); + + wxStaticBoxSizer* m_NetSortOptSizer; + m_NetSortOptSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Net Filtering") ), wxVERTICAL ); + + m_staticText16 = new wxStaticText( this, wxID_ANY, _("Display:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText16->Wrap( -1 ); + m_NetSortOptSizer->Add( m_staticText16, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); + + wxString m_NetDisplayOptionChoices[] = { _("Show all (alphabetical)"), _("Show all (advanced)"), _("Filtered (alphabetical)"), _("Filtered (advanced)") }; + int m_NetDisplayOptionNChoices = sizeof( m_NetDisplayOptionChoices ) / sizeof( wxString ); + m_NetDisplayOption = new wxChoice( this, ID_M_NETDISPLAYOPTION, wxDefaultPosition, wxDefaultSize, m_NetDisplayOptionNChoices, m_NetDisplayOptionChoices, 0 ); + m_NetDisplayOption->SetSelection( 0 ); + m_NetSortOptSizer->Add( m_NetDisplayOption, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + + m_staticText5 = new wxStaticText( this, wxID_ANY, _("Hidden net filter:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText5->Wrap( -1 ); + 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->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 ); + + m_staticText51 = new wxStaticText( this, wxID_ANY, _("Visible net filter:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText51->Wrap( -1 ); + 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->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 ); + + m_buttonRunFilter = new wxButton( this, wxID_APPLY_FILTERS, _("Apply Filters"), wxDefaultPosition, wxDefaultSize, 0 ); + m_NetSortOptSizer->Add( m_buttonRunFilter, 0, wxALL|wxEXPAND, 5 ); + + + m_OptionsBoxSizer->Add( m_NetSortOptSizer, 0, wxALL, 5 ); + + + m_MainBoxSizer->Add( m_OptionsBoxSizer, 1, wxALL|wxEXPAND, 5 ); + + wxStaticBoxSizer* m_ExportableSetupSizer; + m_ExportableSetupSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Settings") ), wxHORIZONTAL ); + + wxBoxSizer* bSizer9; + bSizer9 = new wxBoxSizer( wxVERTICAL ); + + m_ClearanceValueTitle = new wxStaticText( this, wxID_ANY, _("Clearance"), wxDefaultPosition, wxDefaultSize, 0 ); + m_ClearanceValueTitle->Wrap( -1 ); + bSizer9->Add( m_ClearanceValueTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_ZoneClearanceCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bSizer9->Add( m_ZoneClearanceCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_MinThicknessValueTitle = new wxStaticText( this, wxID_ANY, _("Minimum width"), wxDefaultPosition, wxDefaultSize, 0 ); + m_MinThicknessValueTitle->Wrap( -1 ); + m_MinThicknessValueTitle->SetToolTip( _("Minimun thickness of filled areas.") ); + + bSizer9->Add( m_MinThicknessValueTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_ZoneMinThicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bSizer9->Add( m_ZoneMinThicknessCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_staticText151 = new wxStaticText( this, wxID_ANY, _("Corner smoothing:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText151->Wrap( -1 ); + bSizer9->Add( m_staticText151, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); + + wxString m_cornerSmoothingChoiceChoices[] = { _("None"), _("Chamfer"), _("Fillet") }; + int m_cornerSmoothingChoiceNChoices = sizeof( m_cornerSmoothingChoiceChoices ) / sizeof( wxString ); + m_cornerSmoothingChoice = new wxChoice( this, ID_CORNER_SMOOTHING, wxDefaultPosition, wxDefaultSize, m_cornerSmoothingChoiceNChoices, m_cornerSmoothingChoiceChoices, 0 ); + m_cornerSmoothingChoice->SetSelection( 0 ); + bSizer9->Add( m_cornerSmoothingChoice, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + + m_cornerSmoothingTitle = new wxStaticText( this, wxID_ANY, _("Chamfer distance (mm):"), wxDefaultPosition, wxDefaultSize, 0 ); + m_cornerSmoothingTitle->Wrap( -1 ); + bSizer9->Add( m_cornerSmoothingTitle, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); + + m_cornerSmoothingCtrl = new wxTextCtrl( this, ID_M_CORNERSMOOTHINGCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + bSizer9->Add( m_cornerSmoothingCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + + + m_ExportableSetupSizer->Add( bSizer9, 0, wxEXPAND, 5 ); + + wxBoxSizer* m_LeftBox; + m_LeftBox = new wxBoxSizer( wxVERTICAL ); + + m_staticText13 = new wxStaticText( this, wxID_ANY, _("Pad connection:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText13->Wrap( -1 ); + m_LeftBox->Add( m_staticText13, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); + + wxString m_PadInZoneOptChoices[] = { _("Solid"), _("Thermal relief"), _("None") }; + int m_PadInZoneOptNChoices = sizeof( m_PadInZoneOptChoices ) / sizeof( wxString ); + m_PadInZoneOpt = new wxChoice( this, ID_M_PADINZONEOPT, wxDefaultPosition, wxDefaultSize, m_PadInZoneOptNChoices, m_PadInZoneOptChoices, 0 ); + m_PadInZoneOpt->SetSelection( 0 ); + m_LeftBox->Add( m_PadInZoneOpt, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + + wxStaticBoxSizer* m_ThermalShapesParamsSizer; + m_ThermalShapesParamsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Thermal Reliefs") ), wxVERTICAL ); + + m_AntipadSizeText = new wxStaticText( this, wxID_ANY, _("Antipad clearance"), wxDefaultPosition, wxDefaultSize, 0 ); + m_AntipadSizeText->Wrap( -1 ); + m_ThermalShapesParamsSizer->Add( m_AntipadSizeText, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); + + m_AntipadSizeValue = new wxTextCtrl( this, wxID_ANTIPAD_SIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_AntipadSizeValue->SetToolTip( _("Clearance between pads in the same net and filled areas.") ); + + m_ThermalShapesParamsSizer->Add( m_AntipadSizeValue, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + + m_CopperBridgeWidthText = new wxStaticText( this, wxID_ANY, _("Spoke width"), wxDefaultPosition, wxDefaultSize, 0 ); + m_CopperBridgeWidthText->Wrap( -1 ); + m_ThermalShapesParamsSizer->Add( m_CopperBridgeWidthText, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); + + m_CopperWidthValue = new wxTextCtrl( this, wxID_COPPER_BRIDGE_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_CopperWidthValue->SetToolTip( _("Width of copper in thermal reliefs.") ); + + m_ThermalShapesParamsSizer->Add( m_CopperWidthValue, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + + + m_LeftBox->Add( m_ThermalShapesParamsSizer, 0, wxALL|wxEXPAND, 5 ); + + + m_ExportableSetupSizer->Add( m_LeftBox, 0, wxEXPAND, 5 ); + + wxBoxSizer* m_MiddleBox; + m_MiddleBox = new wxBoxSizer( wxVERTICAL ); + + m_staticText171 = new wxStaticText( this, wxID_ANY, _("Priority level:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText171->Wrap( -1 ); + m_staticText171->SetToolTip( _("On each copper layer, zones are filled by priority order.\nSo when a zone is inside an other zone:\n* If its priority is highter: its outlines are removed from the other layer.\n* If its priority is equal: a DRC error is set.") ); + + m_MiddleBox->Add( m_staticText171, 0, wxRIGHT|wxLEFT, 5 ); + + m_PriorityLevelCtrl = new wxSpinCtrl( this, ID_M_PRIORITYLEVELCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 100, 0 ); + m_MiddleBox->Add( m_PriorityLevelCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + + m_staticText11 = new wxStaticText( this, wxID_ANY, _("Fill mode:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText11->Wrap( -1 ); + m_MiddleBox->Add( m_staticText11, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); + + wxString m_FillModeCtrlChoices[] = { _("Polygon"), _("Segment") }; + int m_FillModeCtrlNChoices = sizeof( m_FillModeCtrlChoices ) / sizeof( wxString ); + m_FillModeCtrl = new wxChoice( this, ID_M_FILLMODECTRL, wxDefaultPosition, wxDefaultSize, m_FillModeCtrlNChoices, m_FillModeCtrlChoices, 0 ); + m_FillModeCtrl->SetSelection( 0 ); + m_MiddleBox->Add( m_FillModeCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + + m_staticText12 = new wxStaticText( this, wxID_ANY, _("Segments / 360 deg:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText12->Wrap( -1 ); + m_MiddleBox->Add( m_staticText12, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); + + wxString m_ArcApproximationOptChoices[] = { _("16"), _("32") }; + int m_ArcApproximationOptNChoices = sizeof( m_ArcApproximationOptChoices ) / sizeof( wxString ); + m_ArcApproximationOpt = new wxChoice( this, ID_M_ARCAPPROXIMATIONOPT, wxDefaultPosition, wxDefaultSize, m_ArcApproximationOptNChoices, m_ArcApproximationOptChoices, 0 ); + m_ArcApproximationOpt->SetSelection( 0 ); + m_MiddleBox->Add( m_ArcApproximationOpt, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + + + m_ExportableSetupSizer->Add( m_MiddleBox, 0, wxEXPAND, 5 ); + + wxBoxSizer* bSizer81; + bSizer81 = new wxBoxSizer( wxVERTICAL ); + + m_staticText14 = new wxStaticText( this, wxID_ANY, _("Outline slope:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText14->Wrap( -1 ); + bSizer81->Add( m_staticText14, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); + + wxString m_OrientEdgesOptChoices[] = { _("Arbitrary"), _("H, V, and 45 deg only") }; + int m_OrientEdgesOptNChoices = sizeof( m_OrientEdgesOptChoices ) / sizeof( wxString ); + m_OrientEdgesOpt = new wxChoice( this, ID_M_ORIENTEDGESOPT, wxDefaultPosition, wxDefaultSize, m_OrientEdgesOptNChoices, m_OrientEdgesOptChoices, 0 ); + m_OrientEdgesOpt->SetSelection( 0 ); + bSizer81->Add( m_OrientEdgesOpt, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + + m_staticText15 = new wxStaticText( this, wxID_ANY, _("Outline style:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText15->Wrap( -1 ); + bSizer81->Add( m_staticText15, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); + + wxString m_OutlineAppearanceCtrlChoices[] = { _("Line"), _("Hatched"), _("Fully hatched") }; + int m_OutlineAppearanceCtrlNChoices = sizeof( m_OutlineAppearanceCtrlChoices ) / sizeof( wxString ); + m_OutlineAppearanceCtrl = new wxChoice( this, ID_M_OUTLINEAPPEARANCECTRL, wxDefaultPosition, wxDefaultSize, m_OutlineAppearanceCtrlNChoices, m_OutlineAppearanceCtrlChoices, 0 ); + m_OutlineAppearanceCtrl->SetSelection( 0 ); + bSizer81->Add( m_OutlineAppearanceCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); + + + m_ExportableSetupSizer->Add( bSizer81, 0, wxEXPAND, 5 ); + + + m_MainBoxSizer->Add( m_ExportableSetupSizer, 1, wxALL|wxEXPAND, 5 ); + + wxBoxSizer* bSizer10; + bSizer10 = new wxBoxSizer( wxHORIZONTAL ); + + m_ExportSetupButton = new wxButton( this, wxID_BUTTON_EXPORT, _("Export Settings to Other Zones"), wxDefaultPosition, wxDefaultSize, 0 ); + m_ExportSetupButton->SetToolTip( _("Export this zone setup (excluding layer and net selection) to all other copper zones.") ); + + bSizer10->Add( m_ExportSetupButton, 0, wxALL|wxEXPAND, 5 ); + + m_OkButton = new wxButton( this, wxID_OK, _("Ok"), wxDefaultPosition, wxDefaultSize, 0 ); + m_OkButton->SetDefault(); + bSizer10->Add( m_OkButton, 0, wxALL|wxEXPAND, 5 ); + + m_ButtonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer10->Add( m_ButtonCancel, 0, wxALL|wxEXPAND, 5 ); + + + m_MainBoxSizer->Add( bSizer10, 0, wxALIGN_RIGHT|wxALL, 5 ); + + + this->SetSizer( m_MainBoxSizer ); + this->Layout(); +} + +DIALOG_COPPER_ZONE_BASE::~DIALOG_COPPER_ZONE_BASE() +{ +} diff --git a/pcbnew/dialogs/dialog_copper_zones_base.fbp b/pcbnew/dialogs/dialog_copper_zones_base.fbp index 02a43cca91..bb67a02271 100644 --- a/pcbnew/dialogs/dialog_copper_zones_base.fbp +++ b/pcbnew/dialogs/dialog_copper_zones_base.fbp @@ -1,3515 +1,3418 @@ - - - - - - C++ - 1 - source_name - 0 - res - UTF-8 - table - dialog_copper_zones_base - 1000 - none - 1 - dialog_copper_zones_base - - . - - 1 - 1 - 1 - 0 - - 1 - 1 - 1 - 1 - 0 - - - - - 1 - - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - impl_virtual - - - 1 - - 0 - 0 - ID_DIALOG_COPPER_ZONE_BASE - - - 0 - - - 0 - - 1 - DIALOG_COPPER_ZONE_BASE - 1 - - - 1 - - - Resizable - - 1 - 550,500 - wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - - Zone Properties - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - OnClose - - - - - - - - - - - - - - - - - - - - - - - - - OnSize - - - - m_MainBoxSizer - wxVERTICAL - protected - - 5 - wxALL|wxEXPAND - 1 - - - m_OptionsBoxSizer - wxHORIZONTAL - none - - 5 - wxEXPAND - 1 - - - m_layerSizer - wxVERTICAL - protected - - 5 - wxLEFT|wxRIGHT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Layer: - - - 0 - - - 0 - - 1 - m_staticText17 - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - - bSizer7 - 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 - Net: - - - 0 - - - 0 - - 1 - m_staticText2 - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 1 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_NETNAME_SELECTION - - - 0 - - - 0 - -1,-1 - 1 - m_ListNetNameSelection - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL - 0 - - wxID_ANY - Net Filtering - - m_NetSortOptSizer - wxVERTICAL - none - - - 5 - wxLEFT|wxRIGHT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Display: - - - 0 - - - 0 - - 1 - m_staticText16 - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - "Show all (alphabetical)" "Show all (advanced)" "Filtered (alphabetical)" "Filtered (advanced)" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_M_NETDISPLAYOPTION - - - 0 - - - 0 - - 1 - m_NetDisplayOption - 1 - - - protected - 1 - - - Resizable - - 0 - 1 - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - OnNetSortingOptionSelected - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Hidden net filter: - - - 0 - - - 0 - - 1 - m_staticText5 - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_TEXTCTRL_NETNAMES_FILTER - - - 0 - - 0 - - 0 - - 1 - m_DoNotShowNetNameFilter - 1 - - - protected - 1 - - - Resizable - - 1 - - wxTE_PROCESS_ENTER - - 0 - Pattern to filter net names in filtered list. Net names matching this pattern are not displayed. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OnRunFiltersButtonClick - - - - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Visible net filter: - - - 0 - - - 0 - - 1 - m_staticText51 - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_TEXTCTRL_NETNAMES_FILTER - - - 0 - - 0 - - 0 - - 1 - m_ShowNetNameFilter - 1 - - - protected - 1 - - - Resizable - - 1 - - wxTE_PROCESS_ENTER - - 0 - Pattern to filter net names in filtered list. Only net names matching this pattern are displayed. - - wxFILTER_NONE - wxDefaultValidator - - * - - - - - - - - - - - - - - - - - - - - - - - - - - - OnRunFiltersButtonClick - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_APPLY_FILTERS - Apply Filters - - - 0 - - - 0 - - 1 - m_buttonRunFilter - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnRunFiltersButtonClick - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 1 - - wxID_ANY - Settings - - m_ExportableSetupSizer - wxHORIZONTAL - none - - - 5 - wxEXPAND - 0 - - - bSizer9 - 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 - Clearance - - - 0 - - - 0 - - 1 - m_ClearanceValueTitle - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -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 - - 0 - - 0 - - 1 - m_ZoneClearanceCtrl - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - 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 - Minimum width - - - 0 - - - 0 - - 1 - m_MinThicknessValueTitle - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - Minimun thickness of filled areas. - - wxFILTER_NONE - wxDefaultValidator - - - - - -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 - - 0 - - 0 - - 1 - m_ZoneMinThicknessCtrl - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxLEFT|wxRIGHT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Corner smoothing: - - - 0 - - - 0 - - 1 - m_staticText151 - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - "None" "Chamfer" "Fillet" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_CORNER_SMOOTHING - - - 0 - - - 0 - - 1 - m_cornerSmoothingChoice - 1 - - - protected - 1 - - - Resizable - - 0 - 1 - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - OnCornerSmoothingModeChoice - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxLEFT|wxRIGHT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Chamfer distance (mm): - - - 0 - - - 0 - - 1 - m_cornerSmoothingTitle - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_M_CORNERSMOOTHINGCTRL - - - 0 - - 0 - - 0 - - 1 - m_cornerSmoothingCtrl - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 0 - - - m_LeftBox - wxVERTICAL - none - - 5 - wxLEFT|wxRIGHT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Pad connection: - - - 0 - - - 0 - - 1 - m_staticText13 - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - "Solid" "Thermal relief" "None" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_M_PADINZONEOPT - - - 0 - - - 0 - - 1 - m_PadInZoneOpt - 1 - - - protected - 1 - - - Resizable - - 0 - 1 - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - OnPadsInZoneClick - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - wxID_ANY - Thermal Reliefs - - m_ThermalShapesParamsSizer - wxVERTICAL - none - - - 5 - wxLEFT|wxRIGHT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Antipad clearance - - - 0 - - - 0 - - 1 - m_AntipadSizeText - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANTIPAD_SIZE - - - 0 - - 0 - - 0 - - 1 - m_AntipadSizeValue - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - Clearance between pads in the same net and filled areas. - - 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 - Spoke width - - - 0 - - - 0 - - 1 - m_CopperBridgeWidthText - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_COPPER_BRIDGE_VALUE - - - 0 - - 0 - - 0 - - 1 - m_CopperWidthValue - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - Width of copper in thermal reliefs. - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 0 - - - m_MiddleBox - wxVERTICAL - none - - 5 - wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Priority level: - - - 0 - - - 0 - - 1 - m_staticText171 - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - On each copper layer, zones are filled by priority order. So when a zone is inside an other zone: * If its priority is highter: its outlines are removed from the other layer. * If its priority is equal: a DRC error is set. - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_M_PRIORITYLEVELCTRL - 0 - - 100 - - 0 - - 0 - - 0 - - 1 - m_PriorityLevelCtrl - 1 - - - protected - 1 - - - Resizable - - 1 - - wxSP_ARROW_KEYS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxLEFT|wxRIGHT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Fill mode: - - - 0 - - - 0 - - 1 - m_staticText11 - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - "Polygon" "Segment" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_M_FILLMODECTRL - - - 0 - - - 0 - - 1 - m_FillModeCtrl - 1 - - - protected - 1 - - - Resizable - - 0 - 1 - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxLEFT|wxRIGHT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Segments / 360 deg: - - - 0 - - - 0 - - 1 - m_staticText12 - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - "16" "32" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_M_ARCAPPROXIMATIONOPT - - - 0 - - - 0 - - 1 - m_ArcApproximationOpt - 1 - - - protected - 1 - - - Resizable - - 0 - 1 - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 0 - - - bSizer81 - wxVERTICAL - none - - 5 - wxLEFT|wxRIGHT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Outline slope: - - - 0 - - - 0 - - 1 - m_staticText14 - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - "Arbitrary" "H, V, and 45 deg only" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_M_ORIENTEDGESOPT - - - 0 - - - 0 - - 1 - m_OrientEdgesOpt - 1 - - - protected - 1 - - - Resizable - - 0 - 1 - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxLEFT|wxRIGHT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Outline style: - - - 0 - - - 0 - - 1 - m_staticText15 - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - "Line" "Hatched" "Fully hatched" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - ID_M_OUTLINEAPPEARANCECTRL - - - 0 - - - 0 - - 1 - m_OutlineAppearanceCtrl - 1 - - - protected - 1 - - - Resizable - - 0 - 1 - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_RIGHT|wxALL - 0 - - - bSizer10 - wxHORIZONTAL - none - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_BUTTON_EXPORT - Export Settings to Other Zones - - - 0 - - - 0 - - 1 - m_ExportSetupButton - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - Export this zone setup (excluding layer and net selection) to all other copper zones. - - wxFILTER_NONE - wxDefaultValidator - - - - - ExportSetupToOtherCopperZones - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_OK - Ok - - - 0 - - - 0 - - 1 - m_OkButton - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnButtonOkClick - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - 1 - 1 - 1 - 1 - - - - - 1 - 0 - 1 - - 1 - 0 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_CANCEL - Cancel - - - 0 - - - 0 - - 1 - m_ButtonCancel - 1 - - - protected - 1 - - - Resizable - - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - OnButtonCancelClick - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + table + dialog_copper_zones_base + 1000 + none + 1 + dialog_copper_zones_base + + . + + 1 + 1 + 1 + 1 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + + 1 + 1 + impl_virtual + + + + 0 + ID_DIALOG_COPPER_ZONE_BASE + + + DIALOG_COPPER_ZONE_BASE + + 550,500 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + DIALOG_SHIM; dialog_shim.h + Zone Properties + + + + + + + + + + + + + + OnClose + + + + + + + + + + + + + + + + + + + + + + + + + OnSize + + + + m_MainBoxSizer + wxVERTICAL + protected + + 5 + wxALL|wxEXPAND + 1 + + + m_OptionsBoxSizer + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + + m_layerSizer + wxVERTICAL + protected + + 5 + wxLEFT|wxRIGHT|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Layer: + + 0 + + + 0 + + 1 + m_staticText17 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + bSizer7 + 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 + Net: + + 0 + + + 0 + + 1 + m_staticText2 + 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 + ID_NETNAME_SELECTION + + 0 + + + 0 + -1,-1 + 1 + m_ListNetNameSelection + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + wxID_ANY + Net Filtering + + m_NetSortOptSizer + wxVERTICAL + none + + + 5 + wxLEFT|wxRIGHT|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Display: + + 0 + + + 0 + + 1 + m_staticText16 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Show all (alphabetical)" "Show all (advanced)" "Filtered (alphabetical)" "Filtered (advanced)" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_M_NETDISPLAYOPTION + + 0 + + + 0 + + 1 + m_NetDisplayOption + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + OnNetSortingOptionSelected + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Hidden net filter: + + 0 + + + 0 + + 1 + m_staticText5 + 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 + ID_TEXTCTRL_NETNAMES_FILTER + + 0 + + 0 + + 0 + + 1 + m_DoNotShowNetNameFilter + 1 + + + protected + 1 + + Resizable + 1 + + wxTE_PROCESS_ENTER + + 0 + Pattern to filter net names in filtered list. Net names matching this pattern are not displayed. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OnRunFiltersButtonClick + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Visible net filter: + + 0 + + + 0 + + 1 + m_staticText51 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_TEXTCTRL_NETNAMES_FILTER + + 0 + + 0 + + 0 + + 1 + m_ShowNetNameFilter + 1 + + + protected + 1 + + Resizable + 1 + + wxTE_PROCESS_ENTER + + 0 + Pattern to filter net names in filtered list. Only net names matching this pattern are displayed. + + wxFILTER_NONE + wxDefaultValidator + + * + + + + + + + + + + + + + + + + + + + + + + + + + + + OnRunFiltersButtonClick + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_APPLY_FILTERS + Apply Filters + + 0 + + + 0 + + 1 + m_buttonRunFilter + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnRunFiltersButtonClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 1 + + wxID_ANY + Settings + + m_ExportableSetupSizer + wxHORIZONTAL + none + + + 5 + wxEXPAND + 0 + + + bSizer9 + 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 + Clearance + + 0 + + + 0 + + 1 + m_ClearanceValueTitle + 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 + + 0 + + 0 + + 1 + m_ZoneClearanceCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + 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 + Minimum width + + 0 + + + 0 + + 1 + m_MinThicknessValueTitle + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Minimun thickness of filled areas. + + + + -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 + + 0 + + 0 + + 1 + m_ZoneMinThicknessCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxLEFT|wxRIGHT|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Corner smoothing: + + 0 + + + 0 + + 1 + m_staticText151 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "None" "Chamfer" "Fillet" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_CORNER_SMOOTHING + + 0 + + + 0 + + 1 + m_cornerSmoothingChoice + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + OnCornerSmoothingModeChoice + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxLEFT|wxRIGHT|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Chamfer distance (mm): + + 0 + + + 0 + + 1 + m_cornerSmoothingTitle + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_M_CORNERSMOOTHINGCTRL + + 0 + + 0 + + 0 + + 1 + m_cornerSmoothingCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + m_LeftBox + wxVERTICAL + none + + 5 + wxLEFT|wxRIGHT|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Pad connection: + + 0 + + + 0 + + 1 + m_staticText13 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Solid" "Thermal relief" "None" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_M_PADINZONEOPT + + 0 + + + 0 + + 1 + m_PadInZoneOpt + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + OnPadsInZoneClick + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + wxID_ANY + Thermal Reliefs + + m_ThermalShapesParamsSizer + wxVERTICAL + none + + + 5 + wxLEFT|wxRIGHT|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Antipad clearance + + 0 + + + 0 + + 1 + m_AntipadSizeText + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANTIPAD_SIZE + + 0 + + 0 + + 0 + + 1 + m_AntipadSizeValue + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Clearance between pads in the same net and filled areas. + + 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 + Spoke width + + 0 + + + 0 + + 1 + m_CopperBridgeWidthText + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_COPPER_BRIDGE_VALUE + + 0 + + 0 + + 0 + + 1 + m_CopperWidthValue + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Width of copper in thermal reliefs. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + m_MiddleBox + wxVERTICAL + none + + 5 + wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Priority level: + + 0 + + + 0 + + 1 + m_staticText171 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + On each copper layer, zones are filled by priority order. So when a zone is inside an other zone: * If its priority is highter: its outlines are removed from the other layer. * If its priority is equal: a DRC error is set. + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_M_PRIORITYLEVELCTRL + 0 + 100 + + 0 + + 0 + + 0 + + 1 + m_PriorityLevelCtrl + 1 + + + protected + 1 + + Resizable + 1 + + wxSP_ARROW_KEYS + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxLEFT|wxRIGHT|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Fill mode: + + 0 + + + 0 + + 1 + m_staticText11 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Polygon" "Segment" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_M_FILLMODECTRL + + 0 + + + 0 + + 1 + m_FillModeCtrl + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxLEFT|wxRIGHT|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Segments / 360 deg: + + 0 + + + 0 + + 1 + m_staticText12 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "16" "32" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_M_ARCAPPROXIMATIONOPT + + 0 + + + 0 + + 1 + m_ArcApproximationOpt + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 0 + + + bSizer81 + wxVERTICAL + none + + 5 + wxLEFT|wxRIGHT|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Outline slope: + + 0 + + + 0 + + 1 + m_staticText14 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Arbitrary" "H, V, and 45 deg only" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_M_ORIENTEDGESOPT + + 0 + + + 0 + + 1 + m_OrientEdgesOpt + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxLEFT|wxRIGHT|wxTOP + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Outline style: + + 0 + + + 0 + + 1 + m_staticText15 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Line" "Hatched" "Fully hatched" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + ID_M_OUTLINEAPPEARANCECTRL + + 0 + + + 0 + + 1 + m_OutlineAppearanceCtrl + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_RIGHT|wxALL + 0 + + + bSizer10 + wxHORIZONTAL + none + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_BUTTON_EXPORT + Export Settings to Other Zones + + 0 + + + 0 + + 1 + m_ExportSetupButton + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + Export this zone setup (excluding layer and net selection) to all other copper zones. + + wxFILTER_NONE + wxDefaultValidator + + + + + ExportSetupToOtherCopperZones + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_OK + Ok + + 0 + + + 0 + + 1 + m_OkButton + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnButtonOkClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_CANCEL + Cancel + + 0 + + + 0 + + 1 + m_ButtonCancel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnButtonCancelClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pcbnew/dialogs/dialog_copper_zones_base.h b/pcbnew/dialogs/dialog_copper_zones_base.h index 0df2b42f94..14617522f2 100644 --- a/pcbnew/dialogs/dialog_copper_zones_base.h +++ b/pcbnew/dialogs/dialog_copper_zones_base.h @@ -1,131 +1,132 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 30 2011) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#ifndef __DIALOG_COPPER_ZONES_BASE_H__ -#define __DIALOG_COPPER_ZONES_BASE_H__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -/// Class DIALOG_COPPER_ZONE_BASE -/////////////////////////////////////////////////////////////////////////////// -class DIALOG_COPPER_ZONE_BASE : public wxDialog -{ - DECLARE_EVENT_TABLE() - private: - - // Private event handlers - void _wxFB_OnClose( wxCloseEvent& event ){ OnClose( event ); } - void _wxFB_OnSize( wxSizeEvent& event ){ OnSize( event ); } - void _wxFB_OnNetSortingOptionSelected( wxCommandEvent& event ){ OnNetSortingOptionSelected( event ); } - void _wxFB_OnRunFiltersButtonClick( wxCommandEvent& event ){ OnRunFiltersButtonClick( event ); } - void _wxFB_OnCornerSmoothingModeChoice( wxCommandEvent& event ){ OnCornerSmoothingModeChoice( event ); } - void _wxFB_OnPadsInZoneClick( wxCommandEvent& event ){ OnPadsInZoneClick( event ); } - void _wxFB_ExportSetupToOtherCopperZones( wxCommandEvent& event ){ ExportSetupToOtherCopperZones( event ); } - void _wxFB_OnButtonOkClick( wxCommandEvent& event ){ OnButtonOkClick( event ); } - void _wxFB_OnButtonCancelClick( wxCommandEvent& event ){ OnButtonCancelClick( event ); } - - - protected: - enum - { - ID_DIALOG_COPPER_ZONE_BASE = 1000, - ID_NETNAME_SELECTION, - ID_M_NETDISPLAYOPTION, - ID_TEXTCTRL_NETNAMES_FILTER, - wxID_APPLY_FILTERS, - ID_CORNER_SMOOTHING, - ID_M_CORNERSMOOTHINGCTRL, - ID_M_PADINZONEOPT, - wxID_ANTIPAD_SIZE, - wxID_COPPER_BRIDGE_VALUE, - ID_M_PRIORITYLEVELCTRL, - ID_M_FILLMODECTRL, - ID_M_ARCAPPROXIMATIONOPT, - ID_M_ORIENTEDGESOPT, - ID_M_OUTLINEAPPEARANCECTRL, - wxID_BUTTON_EXPORT, - }; - - wxBoxSizer* m_MainBoxSizer; - wxBoxSizer* m_layerSizer; - wxStaticText* m_staticText17; - wxStaticText* m_staticText2; - wxListBox* m_ListNetNameSelection; - wxStaticText* m_staticText16; - wxChoice* m_NetDisplayOption; - wxStaticText* m_staticText5; - wxTextCtrl* m_DoNotShowNetNameFilter; - wxStaticText* m_staticText51; - wxTextCtrl* m_ShowNetNameFilter; - wxButton* m_buttonRunFilter; - wxStaticText* m_ClearanceValueTitle; - wxTextCtrl* m_ZoneClearanceCtrl; - wxStaticText* m_MinThicknessValueTitle; - wxTextCtrl* m_ZoneMinThicknessCtrl; - wxStaticText* m_staticText151; - wxChoice* m_cornerSmoothingChoice; - wxStaticText* m_cornerSmoothingTitle; - wxTextCtrl* m_cornerSmoothingCtrl; - wxStaticText* m_staticText13; - wxChoice* m_PadInZoneOpt; - wxStaticText* m_AntipadSizeText; - wxTextCtrl* m_AntipadSizeValue; - wxStaticText* m_CopperBridgeWidthText; - wxTextCtrl* m_CopperWidthValue; - wxStaticText* m_staticText171; - wxSpinCtrl* m_PriorityLevelCtrl; - wxStaticText* m_staticText11; - wxChoice* m_FillModeCtrl; - wxStaticText* m_staticText12; - wxChoice* m_ArcApproximationOpt; - wxStaticText* m_staticText14; - wxChoice* m_OrientEdgesOpt; - wxStaticText* m_staticText15; - wxChoice* m_OutlineAppearanceCtrl; - wxButton* m_ExportSetupButton; - wxButton* m_OkButton; - wxButton* m_ButtonCancel; - - // Virtual event handlers, overide them in your derived class - virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } - virtual void OnSize( wxSizeEvent& event ) { event.Skip(); } - virtual void OnNetSortingOptionSelected( wxCommandEvent& event ) { event.Skip(); } - virtual void OnRunFiltersButtonClick( wxCommandEvent& event ) { event.Skip(); } - virtual void OnCornerSmoothingModeChoice( wxCommandEvent& event ) { event.Skip(); } - virtual void OnPadsInZoneClick( wxCommandEvent& event ) { event.Skip(); } - virtual void ExportSetupToOtherCopperZones( wxCommandEvent& event ) { event.Skip(); } - virtual void OnButtonOkClick( wxCommandEvent& event ) { event.Skip(); } - virtual void OnButtonCancelClick( wxCommandEvent& event ) { event.Skip(); } - - - public: - - DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID id = ID_DIALOG_COPPER_ZONE_BASE, const wxString& title = _("Zone Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 550,500 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); - ~DIALOG_COPPER_ZONE_BASE(); - -}; - -#endif //__DIALOG_COPPER_ZONES_BASE_H__ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Apr 11 2012) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __DIALOG_COPPER_ZONES_BASE_H__ +#define __DIALOG_COPPER_ZONES_BASE_H__ + +#include +#include +#include +#include "dialog_shim.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_COPPER_ZONE_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_COPPER_ZONE_BASE : public DIALOG_SHIM +{ + DECLARE_EVENT_TABLE() + private: + + // Private event handlers + void _wxFB_OnClose( wxCloseEvent& event ){ OnClose( event ); } + void _wxFB_OnSize( wxSizeEvent& event ){ OnSize( event ); } + void _wxFB_OnNetSortingOptionSelected( wxCommandEvent& event ){ OnNetSortingOptionSelected( event ); } + void _wxFB_OnRunFiltersButtonClick( wxCommandEvent& event ){ OnRunFiltersButtonClick( event ); } + void _wxFB_OnCornerSmoothingModeChoice( wxCommandEvent& event ){ OnCornerSmoothingModeChoice( event ); } + void _wxFB_OnPadsInZoneClick( wxCommandEvent& event ){ OnPadsInZoneClick( event ); } + void _wxFB_ExportSetupToOtherCopperZones( wxCommandEvent& event ){ ExportSetupToOtherCopperZones( event ); } + void _wxFB_OnButtonOkClick( wxCommandEvent& event ){ OnButtonOkClick( event ); } + void _wxFB_OnButtonCancelClick( wxCommandEvent& event ){ OnButtonCancelClick( event ); } + + + protected: + enum + { + ID_DIALOG_COPPER_ZONE_BASE = 1000, + ID_NETNAME_SELECTION, + ID_M_NETDISPLAYOPTION, + ID_TEXTCTRL_NETNAMES_FILTER, + wxID_APPLY_FILTERS, + ID_CORNER_SMOOTHING, + ID_M_CORNERSMOOTHINGCTRL, + ID_M_PADINZONEOPT, + wxID_ANTIPAD_SIZE, + wxID_COPPER_BRIDGE_VALUE, + ID_M_PRIORITYLEVELCTRL, + ID_M_FILLMODECTRL, + ID_M_ARCAPPROXIMATIONOPT, + ID_M_ORIENTEDGESOPT, + ID_M_OUTLINEAPPEARANCECTRL, + wxID_BUTTON_EXPORT + }; + + wxBoxSizer* m_MainBoxSizer; + wxBoxSizer* m_layerSizer; + wxStaticText* m_staticText17; + wxStaticText* m_staticText2; + wxListBox* m_ListNetNameSelection; + wxStaticText* m_staticText16; + wxChoice* m_NetDisplayOption; + wxStaticText* m_staticText5; + wxTextCtrl* m_DoNotShowNetNameFilter; + wxStaticText* m_staticText51; + wxTextCtrl* m_ShowNetNameFilter; + wxButton* m_buttonRunFilter; + wxStaticText* m_ClearanceValueTitle; + wxTextCtrl* m_ZoneClearanceCtrl; + wxStaticText* m_MinThicknessValueTitle; + wxTextCtrl* m_ZoneMinThicknessCtrl; + wxStaticText* m_staticText151; + wxChoice* m_cornerSmoothingChoice; + wxStaticText* m_cornerSmoothingTitle; + wxTextCtrl* m_cornerSmoothingCtrl; + wxStaticText* m_staticText13; + wxChoice* m_PadInZoneOpt; + wxStaticText* m_AntipadSizeText; + wxTextCtrl* m_AntipadSizeValue; + wxStaticText* m_CopperBridgeWidthText; + wxTextCtrl* m_CopperWidthValue; + wxStaticText* m_staticText171; + wxSpinCtrl* m_PriorityLevelCtrl; + wxStaticText* m_staticText11; + wxChoice* m_FillModeCtrl; + wxStaticText* m_staticText12; + wxChoice* m_ArcApproximationOpt; + wxStaticText* m_staticText14; + wxChoice* m_OrientEdgesOpt; + wxStaticText* m_staticText15; + wxChoice* m_OutlineAppearanceCtrl; + wxButton* m_ExportSetupButton; + wxButton* m_OkButton; + wxButton* m_ButtonCancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } + virtual void OnSize( wxSizeEvent& event ) { event.Skip(); } + virtual void OnNetSortingOptionSelected( wxCommandEvent& event ) { event.Skip(); } + virtual void OnRunFiltersButtonClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCornerSmoothingModeChoice( wxCommandEvent& event ) { event.Skip(); } + virtual void OnPadsInZoneClick( wxCommandEvent& event ) { event.Skip(); } + virtual void ExportSetupToOtherCopperZones( wxCommandEvent& event ) { event.Skip(); } + virtual void OnButtonOkClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnButtonCancelClick( wxCommandEvent& event ) { event.Skip(); } + + + public: + + DIALOG_COPPER_ZONE_BASE( wxWindow* parent, wxWindowID id = ID_DIALOG_COPPER_ZONE_BASE, const wxString& title = _("Zone Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 550,500 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + ~DIALOG_COPPER_ZONE_BASE(); + +}; + +#endif //__DIALOG_COPPER_ZONES_BASE_H__ diff --git a/pcbnew/dialogs/dialog_non_copper_zones_properties_base.cpp b/pcbnew/dialogs/dialog_non_copper_zones_properties_base.cpp index e31779ac72..a27b59790a 100644 --- a/pcbnew/dialogs/dialog_non_copper_zones_properties_base.cpp +++ b/pcbnew/dialogs/dialog_non_copper_zones_properties_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 16 2008) +// C++ code generated with wxFormBuilder (version Apr 11 2012) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -9,12 +9,12 @@ /////////////////////////////////////////////////////////////////////////// -BEGIN_EVENT_TABLE( DialogNonCopperZonesPropertiesBase, wxDialog ) +BEGIN_EVENT_TABLE( DialogNonCopperZonesPropertiesBase, DIALOG_SHIM ) EVT_BUTTON( wxID_OK, DialogNonCopperZonesPropertiesBase::_wxFB_OnOkClick ) EVT_BUTTON( wxID_CANCEL, DialogNonCopperZonesPropertiesBase::_wxFB_OnCancelClick ) END_EVENT_TABLE() -DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( 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 ); @@ -40,6 +40,7 @@ DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow m_ZoneMinThicknessCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); sbLeftSizer_->Add( m_ZoneMinThicknessCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + m_UpperSizer->Add( sbLeftSizer_, 0, 0, 5 ); wxStaticBoxSizer* m_OutilinesBoxOpt; @@ -57,6 +58,7 @@ DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow m_OutlineAppearanceCtrl->SetSelection( 1 ); m_OutilinesBoxOpt->Add( m_OutlineAppearanceCtrl, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + m_UpperSizer->Add( m_OutilinesBoxOpt, 0, 0, 5 ); wxBoxSizer* m_ButtonsSizer; @@ -69,8 +71,10 @@ DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); m_ButtonsSizer->Add( m_buttonCancel, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); + m_UpperSizer->Add( m_ButtonsSizer, 1, wxALIGN_CENTER_VERTICAL, 5 ); + m_MainSizer->Add( m_UpperSizer, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 ); m_staticTextLayerSelection = new wxStaticText( this, wxID_ANY, _("Layer selection:"), wxDefaultPosition, wxDefaultSize, 0 ); @@ -80,6 +84,7 @@ DialogNonCopperZonesPropertiesBase::DialogNonCopperZonesPropertiesBase( wxWindow m_LayerSelectionCtrl = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); m_MainSizer->Add( m_LayerSelectionCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + this->SetSizer( m_MainSizer ); this->Layout(); diff --git a/pcbnew/dialogs/dialog_non_copper_zones_properties_base.fbp b/pcbnew/dialogs/dialog_non_copper_zones_properties_base.fbp index 9065fe7f94..6562e17508 100644 --- a/pcbnew/dialogs/dialog_non_copper_zones_properties_base.fbp +++ b/pcbnew/dialogs/dialog_non_copper_zones_properties_base.fbp @@ -1,606 +1,938 @@ - - - - - - C++ - 1 - UTF-8 - table - dialog_non_copper_zones_properties_base - 1000 - none - 1 - dialog_non_copper_zones_properties_base - - . - - 1 - 1 - 0 - - - wxBOTH - - 1 - - - - 0 - wxID_ANY - - - DialogNonCopperZonesPropertiesBase - - 416,287 - wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - - Non Copper Zones Properties - - - - wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - m_MainSizer - wxVERTICAL - none - - 5 - wxEXPAND|wxALIGN_CENTER_HORIZONTAL - 1 - - - m_UpperSizer - wxHORIZONTAL - none - - 5 - - 0 - - wxID_ANY - Zone Fill Options: - - sbLeftSizer_ - wxVERTICAL - none - - - 5 - wxALL|wxEXPAND - 0 - - - "Use polygons" "Use segments" - - 1 - - - 0 - wxID_ANY - Filling Mode: - 1 - - - m_FillModeCtrl - protected - - 0 - - wxRA_SPECIFY_COLS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - - - 1 - - - 0 - wxID_ANY - Zone min thickness value - - - m_MinThicknessValueTitle - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 0 - - - - 1 - - - 0 - wxID_ANY - - 0 - - m_ZoneMinThicknessCtrl - protected - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - - 0 - - wxID_ANY - Outlines Options: - - m_OutilinesBoxOpt - wxVERTICAL - none - - - 5 - wxALL|wxALIGN_CENTER_VERTICAL - 0 - - - "Any" "H, V and 45 deg" - - 1 - - - 0 - wxID_ANY - Zone Edges Orient - 1 - - - m_OrientEdgesOpt - protected - - 0 - - wxRA_SPECIFY_COLS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxALIGN_CENTER_VERTICAL - 0 - - - "Line" "Hatched Outline" "Full Hatched" - - 1 - - - 0 - wxID_ANY - Outlines Appearence - 1 - - - m_OutlineAppearanceCtrl - protected - - 1 - - wxRA_SPECIFY_COLS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL - 1 - - - m_ButtonsSizer - wxVERTICAL - none - - 5 - wxALL|wxALIGN_CENTER_HORIZONTAL - 0 - - - - 1 - 1 - - - 0 - wxID_OK - OK - - - m_buttonOk - protected - - - - - - - - - OnOkClick - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxALIGN_CENTER_HORIZONTAL - 0 - - - - 0 - 1 - - - 0 - wxID_CANCEL - Cancel - - - m_buttonCancel - protected - - - - - - - - - OnCancelClick - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - - - 1 - - - 0 - wxID_ANY - Layer selection: - - - m_staticTextLayerSelection - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 0 - - - - - 1 - - - 0 - wxID_ANY - - - m_LayerSelectionCtrl - protected - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + table + dialog_non_copper_zones_properties_base + 1000 + none + 1 + dialog_non_copper_zones_properties_base + + . + + 1 + 1 + 1 + 1 + 0 + + 0 + wxAUI_MGR_DEFAULT + + wxBOTH + + 1 + 1 + impl_virtual + + + + 0 + wxID_ANY + + + DialogNonCopperZonesPropertiesBase + + 416,287 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + DIALOG_SHIM; dialog_shim.h + Non Copper Zones Properties + + + + wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + m_MainSizer + wxVERTICAL + none + + 5 + wxEXPAND|wxALIGN_CENTER_HORIZONTAL + 1 + + + m_UpperSizer + wxHORIZONTAL + none + + 5 + + 0 + + wxID_ANY + Zone Fill Options: + + sbLeftSizer_ + wxVERTICAL + none + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Use polygons" "Use segments" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Filling Mode: + 1 + + 0 + + + 0 + + 1 + m_FillModeCtrl + 1 + + + protected + 1 + + Resizable + 0 + 1 + + wxRA_SPECIFY_COLS + + 0 + + + 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 + Zone min thickness value + + 0 + + + 0 + + 1 + m_MinThicknessValueTitle + 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 + + 0 + + 0 + + 1 + m_ZoneMinThicknessCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + + 0 + + wxID_ANY + Outlines Options: + + m_OutilinesBoxOpt + wxVERTICAL + none + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 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 + 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 + wxALIGN_CENTER_VERTICAL + 1 + + + m_ButtonsSizer + wxVERTICAL + none + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_OK + OK + + 0 + + + 0 + + 1 + m_buttonOk + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnOkClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_HORIZONTAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_CANCEL + Cancel + + 0 + + + 0 + + 1 + m_buttonCancel + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnCancelClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Layer selection: + + 0 + + + 0 + + 1 + m_staticTextLayerSelection + 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 + + + 0 + + 1 + m_LayerSelectionCtrl + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pcbnew/dialogs/dialog_non_copper_zones_properties_base.h b/pcbnew/dialogs/dialog_non_copper_zones_properties_base.h index a2f7db34a2..d0aba70995 100644 --- a/pcbnew/dialogs/dialog_non_copper_zones_properties_base.h +++ b/pcbnew/dialogs/dialog_non_copper_zones_properties_base.h @@ -1,15 +1,17 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 16 2008) +// C++ code generated with wxFormBuilder (version Apr 11 2012) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// -#ifndef __dialog_non_copper_zones_properties_base__ -#define __dialog_non_copper_zones_properties_base__ +#ifndef __DIALOG_NON_COPPER_ZONES_PROPERTIES_BASE_H__ +#define __DIALOG_NON_COPPER_ZONES_PROPERTIES_BASE_H__ +#include +#include #include - +#include "dialog_shim.h" #include #include #include @@ -29,7 +31,7 @@ /////////////////////////////////////////////////////////////////////////////// /// Class DialogNonCopperZonesPropertiesBase /////////////////////////////////////////////////////////////////////////////// -class DialogNonCopperZonesPropertiesBase : public wxDialog +class DialogNonCopperZonesPropertiesBase : public DIALOG_SHIM { DECLARE_EVENT_TABLE() private: @@ -51,14 +53,15 @@ class DialogNonCopperZonesPropertiesBase : public wxDialog wxListBox* m_LayerSelectionCtrl; // Virtual event handlers, overide them in your derived class - virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); } - virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); } + virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } public: - DialogNonCopperZonesPropertiesBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Non Copper Zones Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 416,287 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER ); + + DialogNonCopperZonesPropertiesBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Non Copper Zones Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 416,287 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER ); ~DialogNonCopperZonesPropertiesBase(); }; -#endif //__dialog_non_copper_zones_properties_base__ +#endif //__DIALOG_NON_COPPER_ZONES_PROPERTIES_BASE_H__ diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index 503adcc2ac..3fc9c3cfd0 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -55,6 +55,8 @@ Load() TODO's *) fix text twisting and final location issues. *) netclass info? *) code factoring, for polygon at least +*) zone fill clearances +*) package rectangles */ @@ -92,7 +94,9 @@ typedef MODULE_MAP::const_iterator MODULE_CITER; typedef boost::optional opt_string; typedef boost::optional opt_int; typedef boost::optional opt_double; -typedef boost::optional opt_cptree; +typedef boost::optional opt_bool; +//typedef boost::optional opt_cptree; + /// Eagle wire struct EWIRE @@ -179,9 +183,8 @@ struct ETEXT opt_string font; opt_double ratio; opt_erot erot; - opt_int align; - enum { + enum { // for align CENTER, CENTER_LEFT, TOP_CENTER, @@ -194,6 +197,78 @@ struct ETEXT BOTTOM_LEFT = -TOP_RIGHT, BOTTOM_RIGHT = -TOP_LEFT, }; + + opt_int align; +}; + +/// Eagle thru hol pad +struct EPAD +{ + std::string name; + double x; + double y; + double drill; + opt_double diameter; + + // for shape: (square | round | octagon | long | offset) + enum { + SQUARE, + ROUND, + OCTAGON, + LONG, + OFFSET, + }; + + opt_int shape; + + opt_erot erot; + + opt_bool stop; + opt_bool thermals; + opt_bool first; +}; + + +/// Eagle SMD pad +struct ESMD +{ + std::string name; + double x; + double y; + double dx; + double dy; + int layer; + opt_int roundness; + opt_erot erot; + opt_bool stop; + opt_bool thermals; + opt_bool cream; +}; + +struct EVERTEX +{ + double x; + double y; +}; + +// Eagle polygon, without vertices which are parsed as needed +struct EPOLYGON +{ + double width; + int layer; + opt_double spacing; + + enum { // for pour + SOLID, + HATCH, + CUTOUT, + }; + + opt_int pour; + opt_double isolate; + opt_bool orphans; + opt_bool thermals; + opt_int rank; }; @@ -212,6 +287,18 @@ static inline unsigned long timeStamp( CPTREE& aTree ) } +static opt_bool parseOptionalBool( CPTREE& attribs, const char* aName ) +{ + opt_bool ret; + opt_string stemp = attribs.get_optional( aName ); + + if( stemp ) + ret = !stemp->compare( "yes" ); + + return ret; +} + + EAGLE_PLUGIN::EAGLE_PLUGIN() { init( NULL ); @@ -459,40 +546,31 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics, const std::string& aXpath ) // net related info on it from the DTD. else if( !gr->first.compare( "rectangle" ) ) { -#if 0 ERECT r = erect( gr->second ); int layer = kicad_layer( r.layer ); - // hope the angle of rotation is zero. - - // might be better off making this into a ZONE: - if( IsValidCopperLayerIndex( layer ) ) { - auto_ptr dseg = new DRAWSEGMENT( m_board ); + // use a "netcode = 0" type ZONE: + ZONE_CONTAINER* zone = new ZONE_CONTAINER( m_board ); + m_board->Add( zone, ADD_APPEND ); - dseg->SetTimeStamp( timeStamp( gr->second ) ); - dseg->SetLayer( layer ); - dseg->SetShape( S_POLYGON ); - dseg->SetWidth( Mils2iu( 12 ) ); + zone->SetTimeStamp( timeStamp( gr->second ) ); + zone->SetLayer( layer ); + zone->SetNet( 0 ); - std::vector pts; + int outline_hatch = CPolyLine::DIAGONAL_EDGE; - pts.push_back( wxPoint( kicad_x( r.x1 ), kicad_y( r.y1 ) ) ); - pts.push_back( wxPoint( kicad_x( r.x2 ), kicad_y( r.y1 ) ) ); - pts.push_back( wxPoint( kicad_x( r.x2 ), kicad_y( r.y2 ) ) ); - pts.push_back( wxPoint( kicad_x( r.x1 ), kicad_y( r.y2 ) ) ); - dseg->SetPolyPoints( pts ); + zone->m_Poly->Start( layer, kicad_x( r.x1 ), kicad_y( r.y1 ), outline_hatch ); + zone->AppendCorner( wxPoint( kicad_x( r.x2 ), kicad_y( r.y1 ) ) ); + zone->AppendCorner( wxPoint( kicad_x( r.x2 ), kicad_y( r.y2 ) ) ); + zone->AppendCorner( wxPoint( kicad_x( r.x1 ), kicad_y( r.y2 ) ) ); + zone->m_Poly->Close(); - m_board->Add( dseg.release(), ADD_APPEND ); + // this is not my fault: + zone->m_Poly->SetHatch( outline_hatch, + Mils2iu( zone->m_Poly->GetDefaultHatchPitchMils() ) ); } -#elif 0 - // use a "netcode = 0" type ZONE: - auto_ptr zone = new ZONE_CONTAINER( m_board ); - - ; - m_board->Add( zone.release(), ADD_APPEND ); -#endif } else if( !gr->first.compare( "hole" ) ) { @@ -630,18 +708,13 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements, const std::string& aXpath ) for( D_PAD* pad = m->m_Pads; pad; pad = pad->Next() ) { - const ENET& enet = m_pads_to_nets[ makeKey( name, TO_UTF8( pad->GetPadName())) ]; + std::string key = makeKey( name, TO_UTF8( pad->GetPadName() ) ); - D(printf( "refname:'%s' pad:'%s' netcode:%d netname:'%s'\n", - name.c_str(), TO_UTF8( pad->GetPadName() ), - enet.netcode, - enet.netname.c_str() - );) - - if( enet.netname.size() ) + NET_MAP_CITER ni = m_pads_to_nets.find( key ); + if( ni != m_pads_to_nets.end() ) { - pad->SetNetname( FROM_UTF8( enet.netname.c_str() ) ); - pad->SetNet( enet.netcode ); + pad->SetNetname( FROM_UTF8( ni->second.netname.c_str() ) ); + pad->SetNet( ni->second.netcode ); } } @@ -808,7 +881,7 @@ ERECT EAGLE_PLUGIN::erect( CPTREE& aRect ) const r.y2 = attribs.get( "y2" ); r.layer = attribs.get( "layer" ); - // @todo: hoping that rot is not used + // @todo: stop hoping that rot is not used return r; } @@ -883,7 +956,11 @@ EROT EAGLE_PLUGIN::erot( const std::string& aRot ) const rot.spin = aRot.find( 'S' ) != aRot.npos; rot.mirror = aRot.find( 'M' ) != aRot.npos; - rot.degrees = strtod( aRot.c_str() + 1 + int( rot.spin || rot.mirror ), NULL ); + rot.degrees = strtod( aRot.c_str() + + 1 // skip leading 'R' + + int( rot.spin ) // skip optional leading 'S' + + int( rot.mirror ), // skip optional leading 'M' + NULL ); return rot; } @@ -947,6 +1024,173 @@ EATTR EAGLE_PLUGIN::eattr( CPTREE& aAttribute ) const } +EPAD EAGLE_PLUGIN::epad( CPTREE& aPad ) const +{ + EPAD p; + CPTREE& attribs = aPad.get_child( "" ); + + /* + + + */ + + // the DTD says these must be present, throw exception if not found + p.name = attribs.get( "name" ); + p.x = attribs.get( "x" ); + p.y = attribs.get( "y" ); + p.drill = attribs.get( "drill" ); + + p.diameter = attribs.get_optional( "diameter" ); + + opt_string s = attribs.get_optional( "shape" ); + if( s ) + { + // (square | round | octagon | long | offset) + if( !s->compare( "square" ) ) + p.shape = EPAD::SQUARE; + else if( !s->compare( "round" ) ) + p.shape = EPAD::ROUND; + else if( !s->compare( "octagon" ) ) + p.shape = EPAD::OCTAGON; + else if( !s->compare( "long" ) ) + p.shape = EPAD::LONG; + else if( !s->compare( "offset" ) ) + p.shape = EPAD::OFFSET; + } + + opt_string rot = attribs.get_optional( "rot" ); + if( rot ) + { + p.erot = erot( *rot ); + } + + p.stop = parseOptionalBool( attribs, "stop" ); + p.thermals = parseOptionalBool( attribs, "thermals" ); + p.first = parseOptionalBool( attribs, "first" ); + + return p; +} + + +ESMD EAGLE_PLUGIN::esmd( CPTREE& aSMD ) const +{ + ESMD s; + CPTREE& attribs = aSMD.get_child( "" ); + + /* + + */ + + // the DTD says these must be present, throw exception if not found + s.name = attribs.get( "name" ); + s.x = attribs.get( "x" ); + s.y = attribs.get( "y" ); + s.dx = attribs.get( "dx" ); + s.dy = attribs.get( "dy" ); + s.layer = attribs.get( "layer" ); + + opt_string rot = attribs.get_optional( "rot" ); + if( rot ) + { + s.erot = erot( *rot ); + } + + s.roundness = attribs.get_optional( "roundness" ); + s.thermals = parseOptionalBool( attribs, "thermals" ); + s.stop = parseOptionalBool( attribs, "stop" ); + s.thermals = parseOptionalBool( attribs, "thermals" ); + s.cream = parseOptionalBool( attribs, "cream" ); + + return s; +} + + +EVERTEX EAGLE_PLUGIN::evertex( CPTREE& aVertex ) const +{ + EVERTEX v; + CPTREE& attribs = aVertex.get_child( "" ); + + /* + + + */ + + v.x = attribs.get( "x" ); + v.y = attribs.get( "y" ); + + return v; +} + + +EPOLYGON EAGLE_PLUGIN::epolygon( CPTREE& aPolygon ) const +{ + EPOLYGON p; + CPTREE& attribs = aPolygon.get_child( "" ); + + /* + or context -- + orphans %Bool; "no" -- only in context -- + thermals %Bool; "yes" -- only in context -- + rank %Int; "0" -- 1..6 in context, 0 or 7 in context -- + > + */ + + p.width = attribs.get( "width" ); + p.layer = attribs.get( "layer" ); + p.spacing = attribs.get_optional( "spacing" ); + + opt_string s = attribs.get_optional( "pour" ); + if( s ) + { + // (solid | hatch | cutout) + if( !s->compare( "hatch" ) ) + p.pour = EPOLYGON::HATCH; + else if( !s->compare( "cutout" ) ) + p.pour = EPOLYGON::CUTOUT; + else + p.pour = EPOLYGON::SOLID; + } + + p.orphans = parseOptionalBool( attribs, "orphans" ); + p.thermals = parseOptionalBool( attribs, "thermals" ); + p.rank = attribs.get_optional( "rank" ); + + return p; +} + + MODULE* EAGLE_PLUGIN::makeModule( CPTREE& aPackage, const std::string& aPkgName ) const { std::auto_ptr m( new MODULE( NULL ) ); @@ -1014,11 +1258,10 @@ void EAGLE_PLUGIN::packageWire( MODULE* aModule, CPTREE& aTree ) const void EAGLE_PLUGIN::packagePad( MODULE* aModule, CPTREE& aTree ) const { - // pay for this tree traversal only once - CPTREE& attrs = aTree.get_child( "" ); + // this is thru hole technology here, no SMDs + EPAD e = epad( aTree ); /* from /doc/eagle.dtd - m_Pads.PushBack( pad ); - // the DTD says these must be present, throw exception if not found - const std::string& name = attrs.get( "name" ); - - double x = attrs.get( "x" ); - double y = attrs.get( "y" ); - double drill = attrs.get( "drill" ); + pad->SetPadName( FROM_UTF8( e.name.c_str() ) ); // pad's "Position" is not relative to the module's, // whereas Pos0 is relative to the module's but is the unrotated coordinate. - pad->SetPadName( FROM_UTF8( name.c_str() ) ); - - wxPoint padpos( kicad_x( x ), kicad_y( y ) ); + wxPoint padpos( kicad_x( e.x ), kicad_y( e.y ) ); pad->SetPos0( padpos ); @@ -1057,34 +1293,31 @@ void EAGLE_PLUGIN::packagePad( MODULE* aModule, CPTREE& aTree ) const pad->SetPosition( padpos + aModule->GetPosition() ); - pad->SetDrillSize( wxSize( kicad( drill ), kicad( drill ) ) ); + pad->SetDrillSize( wxSize( kicad( e.drill ), kicad( e.drill ) ) ); - pad->SetLayerMask( 0x00C0FFFF ); // should tell it to go through all layers + pad->SetLayerMask( ALL_CU_LAYERS | SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT ); - // Optional according to DTD. - opt_double diameter = attrs.get_optional( "diameter" ); - opt_string shape = attrs.get_optional( "shape" ); - opt_string rot = attrs.get_optional( "rot" ); - /* - opt_string stop = attrs.get_optional( "stop" ); - opt_string thermals = attrs.get_optional( "thermals" ); - opt_string first = attrs.get_optional( "first" ); - */ - - if( diameter ) + if( e.diameter ) { - int kidiam = kicad( *diameter ); - pad->SetSize( wxSize( kidiam, kidiam ) ); + int diameter = kicad( *e.diameter ); + pad->SetSize( wxSize( diameter, diameter ) ); + } + else + { + // the pad size is optional in the eagle DTD, supply something here that is a + // 6 mil copper surround as a minimum. + int drillz = pad->GetDrillSize().x; + int diameter = std::max( drillz + 2 * Mils2iu( 6 ), int( drillz * 1.2 ) ); + pad->SetSize( wxSize( diameter, diameter ) ); } - if( shape ) // if not shape, our default is circle and that matches their default "round" + if( e.shape ) // if not shape, our default is circle and that matches their default "round" { // - - if( !shape->compare( "round" ) ) + if( *e.shape == EPAD::ROUND ) wxASSERT( pad->GetShape()==PAD_CIRCLE ); // verify set in D_PAD constructor - else if( !shape->compare( "octagon" ) ) + else if( *e.shape == EPAD::OCTAGON ) { wxASSERT( pad->GetShape()==PAD_CIRCLE ); // verify set in D_PAD constructor @@ -1092,7 +1325,7 @@ void EAGLE_PLUGIN::packagePad( MODULE* aModule, CPTREE& aTree ) const // pad->SetShape( PAD_OCTAGON ); } - else if( !shape->compare( "long" ) ) + else if( *e.shape == EPAD::LONG ) { pad->SetShape( PAD_OVAL ); @@ -1100,19 +1333,18 @@ void EAGLE_PLUGIN::packagePad( MODULE* aModule, CPTREE& aTree ) const z.x *= 2; pad->SetSize( z ); } - else if( !shape->compare( "square" ) ) + else if( *e.shape == EPAD::SQUARE ) { pad->SetShape( PAD_RECT ); } } - if( rot ) + if( e.erot ) { - EROT r = erot( *rot ); - pad->SetOrientation( r.degrees * 10 ); + pad->SetOrientation( e.erot->degrees * 10 ); } - // don't know what stop and thermals should look like now. + // @todo: handle stop and thermal } @@ -1236,32 +1468,8 @@ void EAGLE_PLUGIN::packageHole( MODULE* aModule, CPTREE& aTree ) const void EAGLE_PLUGIN::packageSMD( MODULE* aModule, CPTREE& aTree ) const { - // pay for this tree traversal only once - CPTREE& attrs = aTree.get_child( "" ); - - /* - - */ - - // the DTD says these must be present, throw exception if not found - const std::string& name = attrs.get( "name" ); - double x = attrs.get( "x" ); - double y = attrs.get( "y" ); - double dx = attrs.get( "dx" ); - double dy = attrs.get( "dy" ); - int layer = attrs.get( "layer" ); + ESMD e = esmd( aTree ); + int layer = kicad_layer( e.layer ); if( !IsValidCopperLayerIndex( layer ) ) { @@ -1271,15 +1479,14 @@ void EAGLE_PLUGIN::packageSMD( MODULE* aModule, CPTREE& aTree ) const D_PAD* pad = new D_PAD( aModule ); aModule->m_Pads.PushBack( pad ); - - pad->SetPadName( FROM_UTF8( name.c_str() ) ); + pad->SetPadName( FROM_UTF8( e.name.c_str() ) ); pad->SetShape( PAD_RECT ); pad->SetAttribute( PAD_SMD ); // pad's "Position" is not relative to the module's, // whereas Pos0 is relative to the module's but is the unrotated coordinate. - wxPoint padpos( kicad_x( x ), kicad_y( y ) ); + wxPoint padpos( kicad_x( e.x ), kicad_y( e.y ) ); pad->SetPos0( padpos ); @@ -1287,33 +1494,26 @@ void EAGLE_PLUGIN::packageSMD( MODULE* aModule, CPTREE& aTree ) const pad->SetPosition( padpos + aModule->GetPosition() ); - pad->SetSize( wxSize( kicad( dx ), kicad( dy ) ) ); + pad->SetSize( wxSize( kicad( e.dx ), kicad( e.dy ) ) ); - pad->SetLayer( kicad_layer( layer ) ); - pad->SetLayerMask( 0x00888000 ); + pad->SetLayer( layer ); + pad->SetLayerMask( LAYER_FRONT | SOLDERPASTE_LAYER_FRONT | SOLDERMASK_LAYER_FRONT ); // Optional according to DTD - opt_double roundness = attrs.get_optional( "roundness" ); - opt_string rot = attrs.get_optional( "rot" ); - opt_string stop = attrs.get_optional( "stop" ); - opt_string thermals = attrs.get_optional( "thermals" ); - opt_string cream = attrs.get_optional( "cream" ); - - if( roundness ) // set set shape to PAD_RECT above, in case roundness is not present + if( e.roundness ) // set set shape to PAD_RECT above, in case roundness is not present { - if( *roundness >= 75 ) // roundness goes from 0-100% + if( *e.roundness >= 75 ) // roundness goes from 0-100% as integer { - if( dy == dx ) + if( e.dy == e.dx ) pad->SetShape( PAD_ROUND ); else pad->SetShape( PAD_OVAL ); } } - if( rot ) + if( e.erot ) { - EROT r = erot( *rot ); - pad->SetOrientation( r.degrees * 10 ); + pad->SetOrientation( e.erot->degrees * 10 ); } // don't know what stop, thermals, and cream should look like now. @@ -1413,14 +1613,54 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals, const std::string& aXpath ) std::string key = makeKey( reference, pad ) ; - D(printf( "adding refname:'%s' pad:'%s' netcode:%d netname:'%s'\n", - reference.c_str(), pad.c_str(), netCode, nname.c_str() );) + // D(printf( "adding refname:'%s' pad:'%s' netcode:%d netname:'%s'\n", reference.c_str(), pad.c_str(), netCode, nname.c_str() );) m_pads_to_nets[ key ] = ENET( netCode, nname ); } else if( !it->first.compare( "polygon" ) ) { + EPOLYGON p = epolygon( it->second ); + int layer = kicad_layer( p.layer ); + + if( IsValidCopperLayerIndex( layer ) ) + { + // use a "netcode = 0" type ZONE: + ZONE_CONTAINER* zone = new ZONE_CONTAINER( m_board ); + m_board->Add( zone, ADD_APPEND ); + + zone->SetTimeStamp( timeStamp( it->second ) ); + zone->SetLayer( layer ); + zone->SetNet( netCode ); + zone->SetNetName( netName ); + + + + int outline_hatch = CPolyLine::DIAGONAL_EDGE; + + bool first = true; + for( CITER vi = it->second.begin(); vi != it->second.end(); ++vi ) + { + if( vi->first.compare( "vertex" ) ) // skip node + continue; + + EVERTEX v = evertex( vi->second ); + + // the ZONE_CONTAINER API needs work, as you can see: + if( first ) + { + zone->m_Poly->Start( layer, kicad_x( v.x ), kicad_y( v.y ), outline_hatch ); + first = false; + } + else + zone->AppendCorner( wxPoint( kicad_x( v.x ), kicad_y( v.y ) ) ); + } + + zone->m_Poly->Close(); + + zone->m_Poly->SetHatch( outline_hatch, + Mils2iu( zone->m_Poly->GetDefaultHatchPitchMils() ) ); + } } } } diff --git a/pcbnew/eagle_plugin.h b/pcbnew/eagle_plugin.h index 032fd6952e..bba024013b 100644 --- a/pcbnew/eagle_plugin.h +++ b/pcbnew/eagle_plugin.h @@ -57,6 +57,7 @@ struct ENET }; typedef std::map< std::string, ENET > NET_MAP; +typedef NET_MAP::const_iterator NET_MAP_CITER; /* #include @@ -81,7 +82,10 @@ struct EATTR; struct ECIRCLE; struct ETEXT; struct ERECT; - +struct EPAD; +struct ESMD; +struct EVERTEX; +struct EPOLYGON; /** * Class EAGLE_PLUGIN @@ -190,20 +194,26 @@ private: void loadElements( CPTREE& aElements, const std::string& aXpath ); + // none of the 'e'funcs do any "to KiCad" conversion, they merely read the XML into binary: + /** * Function ewire * converts a 's xml attributes to binary without additional conversion. * @param aResult is an EWIRE to fill in with the data converted to binary. */ - EWIRE ewire( CPTREE& aWire ) const; + EWIRE ewire( CPTREE& aWire ) const; - EVIA evia( CPTREE& aVia ) const; + EVIA evia( CPTREE& aVia ) const; - ECIRCLE ecircle( CPTREE& aCircle ) const; - ETEXT etext( CPTREE& aText ) const; - ERECT erect( CPTREE& aRect ) const; + ECIRCLE ecircle( CPTREE& aCircle ) const; + ETEXT etext( CPTREE& aText ) const; + ERECT erect( CPTREE& aRect ) const; - EROT erot( const std::string& aRot ) const; + EROT erot( const std::string& aRot ) const; + EPAD epad( CPTREE& aPad ) const; + ESMD esmd( CPTREE& aSMD ) const; + EVERTEX evertex( CPTREE& aVertex ) const; + EPOLYGON epolygon( CPTREE& aPolygon ) const; /** * Function eattr diff --git a/pcbnew/specctra_export.cpp b/pcbnew/specctra_export.cpp index 3ced90fe48..d00185fbd0 100644 --- a/pcbnew/specctra_export.cpp +++ b/pcbnew/specctra_export.cpp @@ -1152,7 +1152,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR ) PATH* mainPolygon = new PATH( plane, T_polygon ); plane->SetShape( mainPolygon ); - plane->name = TO_UTF8( item->m_Netname ); + plane->name = TO_UTF8( item->GetNetName() ); if( plane->name.size() == 0 ) { diff --git a/pcbnew/zones_by_polygon.cpp b/pcbnew/zones_by_polygon.cpp index 3695d87797..b543640cb5 100644 --- a/pcbnew/zones_by_polygon.cpp +++ b/pcbnew/zones_by_polygon.cpp @@ -800,7 +800,7 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* aZone ) NETINFO_ITEM* net = GetBoard()->FindNet( zoneInfo.m_NetcodeSelection ); if( net ) // net == NULL should not occur - aZone->m_Netname = net->GetNetname(); + aZone->SetNetName( net->GetNetname() ); // Combine zones if possible GetBoard()->AreaPolygonModified( &_AuxiliaryList, aZone, true, s_Verbose ); diff --git a/pcbnew/zones_non_copper_type_functions.cpp b/pcbnew/zones_non_copper_type_functions.cpp index 9911a254be..28af1f3fdb 100644 --- a/pcbnew/zones_non_copper_type_functions.cpp +++ b/pcbnew/zones_non_copper_type_functions.cpp @@ -74,7 +74,6 @@ DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME* void DIALOG_NON_COPPER_ZONES_EDITOR::Init() { - SetFocus(); SetReturnCode( ZONE_ABORT ); // Will be changed on button click m_FillModeCtrl->SetSelection( m_settings.m_FillMode ? 1 : 0 ); diff --git a/pcbnew/zones_test_and_combine_areas.cpp b/pcbnew/zones_test_and_combine_areas.cpp index fb6d206d08..c9b1bf5fc0 100644 --- a/pcbnew/zones_test_and_combine_areas.cpp +++ b/pcbnew/zones_test_and_combine_areas.cpp @@ -282,7 +282,7 @@ int BOARD::ClipAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList, { wxString str; str.Printf( wxT( "Area %08lX of net \"%s\" has arcs intersecting other sides.\n" ), - aCurrArea->GetTimeStamp(), GetChars( aCurrArea->m_Netname ) ); + aCurrArea->GetTimeStamp(), GetChars( aCurrArea->GetNetName() ) ); str += wxT( "This may cause problems with other editing operations,\n" ); str += wxT( "such as adding cutouts. It can't be fixed automatically.\n" ); str += wxT( "Manual correction is recommended." ); @@ -305,7 +305,7 @@ int BOARD::ClipAreaPolygon( PICKED_ITEMS_LIST * aNewZonesList, { wxString str; str.Printf( wxT( "Area %08lX of net \"%s\" is self-intersecting and will be clipped.\n" ), - aCurrArea->GetTimeStamp(), GetChars( aCurrArea->m_Netname ) ); + aCurrArea->GetTimeStamp(), GetChars( aCurrArea->GetNetName() ) ); str += wxT( "This may result in splitting the area.\n" ); str += wxT( "If the area is complex, this may take a few seconds." ); wxMessageBox( str ); @@ -482,7 +482,7 @@ int BOARD::CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList, int aNetCode, str.Printf( wxT( "Areas %d and %d of net \"%s\" intersect, but some of the intersecting sides are arcs.\n" ), ia1 + 1, ia2 + 1, - GetChars( curr_area->m_Netname ) ); + GetChars( curr_area->GetNetName() ) ); str += wxT( "Therefore, these areas can't be combined." ); wxMessageBox( str ); } From badef10f412feeda73a6e12c296cd4d7175130c9 Mon Sep 17 00:00:00 2001 From: Marco Mattila Date: Tue, 29 May 2012 23:43:17 +0300 Subject: [PATCH 04/17] Derive pcbnew find dialog from DIALOG_SHIM. --- pcbnew/dialogs/dialog_find.cpp | 16 +++------------- pcbnew/dialogs/dialog_find_base.cpp | 5 +++-- pcbnew/dialogs/dialog_find_base.fbp | 6 +++--- pcbnew/dialogs/dialog_find_base.h | 7 +++++-- 4 files changed, 14 insertions(+), 20 deletions(-) diff --git a/pcbnew/dialogs/dialog_find.cpp b/pcbnew/dialogs/dialog_find.cpp index bfa29d3b42..db30c764c0 100644 --- a/pcbnew/dialogs/dialog_find.cpp +++ b/pcbnew/dialogs/dialog_find.cpp @@ -1,7 +1,8 @@ /* * This program source code file is part of KICAD, a free EDA CAD application. * - * Copyright (C) 1992-2012 Marco Mattila + * Copyright (C) 2012 Marco Mattila + * Copyright (C) 2006 Jean-Pierre Charras * Copyright (C) 1992-2012 Kicad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or @@ -51,9 +52,6 @@ private: static wxString prevSearchString; static bool warpMouse; - static wxPoint prevPosition; - static wxSize prevSize; - void onButtonFindItemClick( wxCommandEvent& event ); void onButtonFindMarkerClick( wxCommandEvent& event ); void onButtonCloseClick( wxCommandEvent& event ); @@ -62,8 +60,6 @@ private: // Initialize static member variables -wxPoint DIALOG_FIND::prevPosition( -1, -1 ); -wxSize DIALOG_FIND::prevSize; wxString DIALOG_FIND::prevSearchString; bool DIALOG_FIND::warpMouse = true; @@ -79,11 +75,7 @@ DIALOG_FIND::DIALOG_FIND( PCB_BASE_FRAME* aParent ) : DIALOG_FIND_BASE( aParent itemCount = markerCount = 0; - if( prevPosition.x != -1 ) - SetSize( prevPosition.x, prevPosition.y, - prevSize.x, prevSize.y ); - else - Center(); + Center(); } @@ -196,8 +188,6 @@ void DIALOG_FIND::onButtonFindMarkerClick( wxCommandEvent& aEvent ) void DIALOG_FIND::onClose( wxCloseEvent& aEvent ) { - prevPosition = GetPosition(); - prevSize = GetSize(); warpMouse = !m_NoMouseWarpCheckBox->IsChecked(); EndModal( 1 ); diff --git a/pcbnew/dialogs/dialog_find_base.cpp b/pcbnew/dialogs/dialog_find_base.cpp index 279770c043..ce3209a7ea 100644 --- a/pcbnew/dialogs/dialog_find_base.cpp +++ b/pcbnew/dialogs/dialog_find_base.cpp @@ -9,7 +9,7 @@ /////////////////////////////////////////////////////////////////////////// -DIALOG_FIND_BASE::DIALOG_FIND_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) +DIALOG_FIND_BASE::DIALOG_FIND_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 ); @@ -41,13 +41,14 @@ DIALOG_FIND_BASE::DIALOG_FIND_BASE( wxWindow* parent, wxWindowID id, const wxStr m_button2 = new wxButton( this, wxID_ANY, _("Find Marker"), wxDefaultPosition, wxDefaultSize, 0 ); bSizer4->Add( m_button2, 0, wxALL, 5 ); - m_button3 = new wxButton( this, wxID_ANY, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); + m_button3 = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 ); bSizer4->Add( m_button3, 0, wxALL, 5 ); bSizerMain->Add( bSizer4, 0, 0, 5 ); this->SetSizer( bSizerMain ); this->Layout(); + bSizerMain->Fit( this ); this->Centre( wxBOTH ); diff --git a/pcbnew/dialogs/dialog_find_base.fbp b/pcbnew/dialogs/dialog_find_base.fbp index 7482db3338..76ebf5b651 100644 --- a/pcbnew/dialogs/dialog_find_base.fbp +++ b/pcbnew/dialogs/dialog_find_base.fbp @@ -69,9 +69,9 @@ Resizable 1 - 350,150 + -1,-1 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - + DIALOG_SHIM; dialog_shim.h Find 0 @@ -614,7 +614,7 @@ 0 0 - wxID_ANY + wxID_CANCEL Close diff --git a/pcbnew/dialogs/dialog_find_base.h b/pcbnew/dialogs/dialog_find_base.h index 3373ad0945..63ba7a9e6b 100644 --- a/pcbnew/dialogs/dialog_find_base.h +++ b/pcbnew/dialogs/dialog_find_base.h @@ -11,6 +11,9 @@ #include #include #include +class DIALOG_SHIM; + +#include "dialog_shim.h" #include #include #include @@ -29,7 +32,7 @@ /////////////////////////////////////////////////////////////////////////////// /// Class DIALOG_FIND_BASE /////////////////////////////////////////////////////////////////////////////// -class DIALOG_FIND_BASE : public wxDialog +class DIALOG_FIND_BASE : public DIALOG_SHIM { private: @@ -50,7 +53,7 @@ class DIALOG_FIND_BASE : public wxDialog public: - DIALOG_FIND_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Find"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 350,150 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_FIND_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Find"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_FIND_BASE(); }; From a1f23f3a4cec6bb92597b8c6ecfafa865f9cc4d5 Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Tue, 29 May 2012 16:01:17 -0500 Subject: [PATCH 05/17] generalize the BOARD loading process PCB_EDIT_FRAME::LoadOnePcbFile() to use any supported PLUGIN --- common/wildcards_and_files_ext.cpp | 1 + include/wildcards_and_files_ext.h | 1 + pcbnew/files.cpp | 98 ++++++++++++++++++------------ 3 files changed, 62 insertions(+), 38 deletions(-) diff --git a/common/wildcards_and_files_ext.cpp b/common/wildcards_and_files_ext.cpp index 0edffe7d64..3911ce022d 100644 --- a/common/wildcards_and_files_ext.cpp +++ b/common/wildcards_and_files_ext.cpp @@ -55,6 +55,7 @@ const wxString SchematicFileWildcard( _( "KiCad schematic files (*.sch)|*.sch" ) const wxString NetlistFileWildcard( _( "KiCad netlist files (*.net)|*.net" ) ); const wxString GerberFileWildcard( _( "Gerber files (*.pho)|*.pho" ) ); const wxString LegacyPcbFileWildcard( _( "KiCad printed circuit board files (*.brd)|*.brd" ) ); +const wxString EaglePcbFileWildcard( _( "Eagle printed circuit board files (*.brd)|*.brd" ) ); const wxString PcbFileWildcard( _( "KiCad s-expr printed circuit board files (*.kicad_pcb)|*.kicad_pcb" ) ); const wxString FootprintLibFileWildcard( _( "KiCad footprint library file (*.mod)|*.mod" ) ); const wxString PdfFileWildcard( _( "Portable document format files (*.pdf)|*.pdf" ) ); diff --git a/include/wildcards_and_files_ext.h b/include/wildcards_and_files_ext.h index 60a80c2dc6..5d3843d3c8 100644 --- a/include/wildcards_and_files_ext.h +++ b/include/wildcards_and_files_ext.h @@ -63,6 +63,7 @@ extern const wxString NetlistFileWildcard; extern const wxString GerberFileWildcard; extern const wxString LegacyPcbFileWildcard; extern const wxString PcbFileWildcard; +extern const wxString EaglePcbFileWildcard; extern const wxString PdfFileWildcard; extern const wxString MacrosFileWildcard; extern const wxString AllFilesWildcard; diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index 803e07f8dd..0945e1f441 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -90,39 +90,39 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event ) case ID_MENU_READ_LAST_SAVED_VERSION_BOARD: case ID_MENU_RECOVER_BOARD: - { - wxFileName fn; + { + wxFileName fn; - if( id == ID_MENU_RECOVER_BOARD ) - { - fn = wxFileName( wxEmptyString, saveFileName, PcbFileExtension ); - } - else - { - fn = GetScreen()->GetFileName(); - fn.SetExt( pcbBackupFileExtension ); - } + if( id == ID_MENU_RECOVER_BOARD ) + { + fn = wxFileName( wxEmptyString, saveFileName, PcbFileExtension ); + } + else + { + fn = GetScreen()->GetFileName(); + fn.SetExt( pcbBackupFileExtension ); + } - if( !fn.FileExists() ) - { - msg = _( "Recovery file " ) + fn.GetFullPath() + _( " not found." ); - DisplayInfoMessage( this, msg ); - break; - } - else - { - msg = _( "OK to load recovery file " ) + fn.GetFullPath(); - - if( !IsOK( this, msg ) ) + if( !fn.FileExists() ) + { + msg = _( "Recovery file " ) + fn.GetFullPath() + _( " not found." ); + DisplayInfoMessage( this, msg ); break; - } + } + else + { + msg = _( "OK to load recovery file " ) + fn.GetFullPath(); - LoadOnePcbFile( fn.GetFullPath(), false ); - fn.SetExt( PcbFileExtension ); - GetScreen()->SetFileName( fn.GetFullPath() ); - UpdateTitle(); + if( !IsOK( this, msg ) ) + break; + } + + LoadOnePcbFile( fn.GetFullPath(), false ); + fn.SetExt( PcbFileExtension ); + GetScreen()->SetFileName( fn.GetFullPath() ); + UpdateTitle(); + } break; - } case ID_APPEND_FILE: LoadOnePcbFile( wxEmptyString, true ); @@ -154,8 +154,6 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event ) bool PCB_EDIT_FRAME::LoadOnePcbFile( const wxString& aFileName, bool aAppend, bool aForceFileDialog ) { - wxString msg; - if( GetScreen()->IsModify() && !aAppend ) { if( !IsOK( this, _( "The current board has been modified. Do you wish to discard \ @@ -170,12 +168,32 @@ the changes?" ) ) ) GetBoard()->m_Status_Pcb = 0; } - wxFileName fileName = aFileName; + wxFileName fileName = aFileName; + + IO_MGR::PCB_FILE_T pluginType = IO_MGR::LEGACY; + + static const struct { + const wxString& filter; + IO_MGR::PCB_FILE_T pluginType; + } loaders[] = { + { LegacyPcbFileWildcard, IO_MGR::LEGACY }, + { PcbFileWildcard, IO_MGR::KICAD }, + { EaglePcbFileWildcard, IO_MGR::EAGLE }, + }; if( !fileName.IsOk() || !fileName.FileExists() || aForceFileDialog ) { wxString name; wxString path = wxGetCwd(); + wxString fileFilters; + + for( unsigned i = 0; i 0 ) + fileFilters += wxChar( '|' ); + + fileFilters += loaders[i].filter; + } if( aForceFileDialog && fileName.FileExists() ) { @@ -183,7 +201,7 @@ the changes?" ) ) ) name = fileName.GetFullName(); } - wxFileDialog dlg( this, _( "Open Board File" ), path, name, LegacyPcbFileWildcard, + wxFileDialog dlg( this, _( "Open Board File" ), path, name, fileFilters, wxFD_OPEN | wxFD_FILE_MUST_EXIST ); if( dlg.ShowModal() == wxID_CANCEL ) @@ -191,10 +209,15 @@ the changes?" ) ) ) fileName = dlg.GetPath(); - if( !fileName.HasExt() ) - fileName.SetExt( PcbFileExtension ); + int chosenFilter = dlg.GetFilterIndex(); + pluginType = loaders[chosenFilter].pluginType; } + PLUGIN::RELEASER pi( IO_MGR::PluginFind( pluginType ) ); + + if( !fileName.HasExt() ) + fileName.SetExt( pi->GetFileExtension() ); + if( !aAppend ) Clear_Pcb( false ); // pass false since we prompted above for a modified board @@ -224,13 +247,12 @@ the changes?" ) ) ) try { // load or append either: - loadedBoard = IO_MGR::Load( IO_MGR::LEGACY, GetScreen()->GetFileName(), - aAppend ? GetBoard() : NULL, - NULL ); + loadedBoard = pi->Load( GetScreen()->GetFileName(), aAppend ? GetBoard() : NULL, NULL ); if( !aAppend ) { - if( loadedBoard->GetFileFormatVersionAtLoad() < LEGACY_BOARD_FILE_VERSION ) + if( pluginType == IO_MGR::LEGACY && + loadedBoard->GetFileFormatVersionAtLoad() < LEGACY_BOARD_FILE_VERSION ) { DisplayInfoMessage( this, _( "This file was created by an older \ version of Pcbnew. It will be stored in the new file format when you save \ From 0a42863bd1a3b451ad7c2c2fb265d70eeabf8143 Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Wed, 30 May 2012 09:14:42 -0500 Subject: [PATCH 06/17] add translation to static file filters, comments --- common/wildcards_and_files_ext.cpp | 2 +- pcbnew/files.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/common/wildcards_and_files_ext.cpp b/common/wildcards_and_files_ext.cpp index 3911ce022d..ace1a52e2d 100644 --- a/common/wildcards_and_files_ext.cpp +++ b/common/wildcards_and_files_ext.cpp @@ -55,7 +55,7 @@ const wxString SchematicFileWildcard( _( "KiCad schematic files (*.sch)|*.sch" ) const wxString NetlistFileWildcard( _( "KiCad netlist files (*.net)|*.net" ) ); const wxString GerberFileWildcard( _( "Gerber files (*.pho)|*.pho" ) ); const wxString LegacyPcbFileWildcard( _( "KiCad printed circuit board files (*.brd)|*.brd" ) ); -const wxString EaglePcbFileWildcard( _( "Eagle printed circuit board files (*.brd)|*.brd" ) ); +const wxString EaglePcbFileWildcard( _( "Eagle ver. 6.x XML PCB files (*.brd)|*.brd" ) ); const wxString PcbFileWildcard( _( "KiCad s-expr printed circuit board files (*.kicad_pcb)|*.kicad_pcb" ) ); const wxString FootprintLibFileWildcard( _( "KiCad footprint library file (*.mod)|*.mod" ) ); const wxString PdfFileWildcard( _( "Portable document format files (*.pdf)|*.pdf" ) ); diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index 0945e1f441..ac50e01bdc 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -172,6 +172,10 @@ the changes?" ) ) ) IO_MGR::PCB_FILE_T pluginType = IO_MGR::LEGACY; + // This is a subset of all PLUGINs which are trusted to be able to + // load a BOARD. Order is subject to change as KICAD plugin matures. + // User may occasionally use the wrong pluging to load a *.brd file, + // but eventually *.kicad_pcb will be more common than legacy *.brd files. static const struct { const wxString& filter; IO_MGR::PCB_FILE_T pluginType; @@ -187,12 +191,12 @@ the changes?" ) ) ) wxString path = wxGetCwd(); wxString fileFilters; - for( unsigned i = 0; i 0 ) fileFilters += wxChar( '|' ); - fileFilters += loaders[i].filter; + fileFilters += wxGetTranslation( loaders[i].filter ); } if( aForceFileDialog && fileName.FileExists() ) From 0aafa5a591950d6f3f66b224a8f35fdd6b6f2d41 Mon Sep 17 00:00:00 2001 From: Marco Mattila Date: Wed, 30 May 2012 20:38:52 +0300 Subject: [PATCH 07/17] Add flip to pcbnew text fields. --- include/wxPcbStruct.h | 1 + pcbnew/class_pcb_text.cpp | 5 ++++- pcbnew/edit.cpp | 6 ++++++ pcbnew/edit_pcb_text.cpp | 26 +++++++++++++++++++++++--- pcbnew/hotkeys.cpp | 8 ++++---- pcbnew/hotkeys.h | 2 +- pcbnew/hotkeys_board_editor.cpp | 9 ++++++--- pcbnew/onrightclick.cpp | 4 +++- pcbnew/pcbnew_id.h | 1 + 9 files changed, 49 insertions(+), 13 deletions(-) diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index c7acd0093c..3cf5496d1e 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -928,6 +928,7 @@ public: // Handling texts on the board void Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); + void FlipTextePcb( TEXTE_PCB* aTextePcb, wxDC* aDC ); TEXTE_PCB* Create_Texte_Pcb( wxDC* DC ); void Delete_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ); void StartMoveTextePcb( TEXTE_PCB* TextePcb, wxDC* DC ); diff --git a/pcbnew/class_pcb_text.cpp b/pcbnew/class_pcb_text.cpp index e5099e9543..ed98248d9d 100644 --- a/pcbnew/class_pcb_text.cpp +++ b/pcbnew/class_pcb_text.cpp @@ -161,7 +161,10 @@ 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 ) ) + if( GetLayer() == LAYER_N_BACK + || GetLayer() == LAYER_N_FRONT + || GetLayer() == SILKSCREEN_N_BACK + || GetLayer() == SILKSCREEN_N_FRONT ) { m_Mirror = not m_Mirror; /* inverse mirror */ } diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index c21616962d..fe488532cd 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -81,6 +81,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) case ID_TOOLBARH_PCB_SELECT_LAYER: case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR: case ID_POPUP_PCB_ROTATE_TEXTEPCB: + case ID_POPUP_PCB_FLIP_TEXTEPCB: case ID_POPUP_PCB_EDIT_TEXTEPCB: case ID_POPUP_PCB_EDIT_MIRE: case ID_POPUP_PCB_ROTATE_TEXTMODULE: @@ -930,6 +931,11 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) m_canvas->MoveCursorToCrossHair(); break; + case ID_POPUP_PCB_FLIP_TEXTEPCB: + FlipTextePcb( (TEXTE_PCB*) GetCurItem(), &dc ); + m_canvas->MoveCursorToCrossHair(); + break; + case ID_POPUP_PCB_DELETE_TEXTEPCB: Delete_Texte_Pcb( (TEXTE_PCB*) GetCurItem(), &dc ); m_canvas->MoveCursorToCrossHair(); diff --git a/pcbnew/edit_pcb_text.cpp b/pcbnew/edit_pcb_text.cpp index a059552f4e..249c223b65 100644 --- a/pcbnew/edit_pcb_text.cpp +++ b/pcbnew/edit_pcb_text.cpp @@ -216,7 +216,6 @@ TEXTE_PCB* PCB_EDIT_FRAME::Create_Texte_Pcb( wxDC* DC ) void PCB_EDIT_FRAME::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ) { int angle = 900; - int drawmode = GR_XOR; if( TextePcb == NULL ) return; @@ -228,13 +227,34 @@ void PCB_EDIT_FRAME::Rotate_Texte_Pcb( TEXTE_PCB* TextePcb, wxDC* DC ) NORMALIZE_ANGLE_POS( TextePcb->m_Orient ); /* Redraw text in new position. */ - TextePcb->Draw( m_canvas, DC, drawmode ); + TextePcb->Draw( m_canvas, DC, GR_XOR ); TextePcb->DisplayInfo( this ); if( TextePcb->GetFlags() == 0 ) // i.e. not edited, or moved - SaveCopyInUndoList( TextePcb, UR_ROTATED, TextePcb->m_Pos ); + SaveCopyInUndoList( TextePcb, UR_ROTATED, TextePcb->GetPosition() ); else // set flag edit, to show it was a complex command TextePcb->SetFlags( IN_EDIT ); OnModify(); } + + +void PCB_EDIT_FRAME::FlipTextePcb( TEXTE_PCB* aTextePcb, wxDC* aDC ) +{ + if( aTextePcb == NULL ) + return; + + aTextePcb->Draw( m_canvas, aDC, GR_XOR ); + + aTextePcb->Flip( aTextePcb->GetPosition() ); + + aTextePcb->Draw( m_canvas, aDC, GR_XOR ); + aTextePcb->DisplayInfo( this ); + + if( aTextePcb->GetFlags() == 0 ) // i.e. not edited, or moved + SaveCopyInUndoList( aTextePcb, UR_FLIPPED, aTextePcb->GetPosition() ); + else // set flag edit, to show it was a complex command + aTextePcb->SetFlags( IN_EDIT ); + + OnModify(); +} diff --git a/pcbnew/hotkeys.cpp b/pcbnew/hotkeys.cpp index 0ee3290907..bc64a74db8 100644 --- a/pcbnew/hotkeys.cpp +++ b/pcbnew/hotkeys.cpp @@ -67,7 +67,7 @@ static EDA_HOTKEY HkPlaceItem( wxT( "Place Item" ), HK_PLACE_ITEM, 'P' ); static EDA_HOTKEY HkAddMicroVia( wxT( "Add MicroVia" ), HK_ADD_MICROVIA, 'V' + GR_KB_CTRL ); static EDA_HOTKEY HkEndTrack( wxT( "End Track" ), HK_END_TRACK, WXK_END ); static EDA_HOTKEY HkEditBoardItem( wxT( "Edit Item" ), HK_EDIT_ITEM, 'E' ); -static EDA_HOTKEY HkFlipFootprint( wxT( "Flip Footprint" ), HK_FLIP_FOOTPRINT, 'F' ); +static EDA_HOTKEY HkFlipItem( wxT( "Flip Item" ), HK_FLIP_ITEM, 'F' ); static EDA_HOTKEY HkRotateItem( wxT( "Rotate Item" ), HK_ROTATE_ITEM, 'R' ); static EDA_HOTKEY HkMoveItem( wxT( "Move Item" ), HK_MOVE_ITEM, 'M' ); static EDA_HOTKEY HkDragFootprint( wxT( "Drag Footprint" ), HK_DRAG_ITEM, 'G' ); @@ -78,7 +78,7 @@ static EDA_HOTKEY HkLock_Unlock_Footprint( wxT( "Lock/Unlock Footprint" ), static EDA_HOTKEY HkDelete( wxT( "Delete Track or Footprint" ), HK_DELETE, WXK_DELETE ); static EDA_HOTKEY HkResetLocalCoord( wxT( "Reset Local Coordinates" ), HK_RESET_LOCAL_COORD, ' ' ); -static EDA_HOTKEY HkSwitchHighContrastMode( wxT("Switch Highcontrast mode"), +static EDA_HOTKEY HkSwitchHighContrastMode( wxT("Switch Highcontrast mode"), HK_SWITCH_HIGHCONTRAST_MODE,'H'); /* Fit on Screen */ #if !defined( __WXMAC__ ) @@ -210,8 +210,8 @@ EDA_HOTKEY* board_edit_Hotkey_List[] = &HkSwitchTrackPosture, &HkDragTrackKeepSlope, &HkPlaceItem, - &HkEndTrack, &HkMoveItem, - &HkFlipFootprint, &HkRotateItem, &HkDragFootprint, + &HkEndTrack, &HkMoveItem, &HkFlipItem, + &HkRotateItem, &HkDragFootprint, &HkGetAndMoveFootprint, &HkLock_Unlock_Footprint, &HkSavefile, &HkLoadfile, &HkFindItem, &HkEditBoardItem, &HkSwitch2CopperLayer, &HkSwitch2InnerLayer1, diff --git a/pcbnew/hotkeys.h b/pcbnew/hotkeys.h index d3246fd2ad..c6f4413f44 100644 --- a/pcbnew/hotkeys.h +++ b/pcbnew/hotkeys.h @@ -14,9 +14,9 @@ enum hotkey_id_commnand { HK_DELETE = HK_COMMON_END, HK_BACK_SPACE, HK_ROTATE_ITEM, + HK_FLIP_ITEM, HK_MOVE_ITEM, HK_DRAG_ITEM, - HK_FLIP_FOOTPRINT, HK_GET_AND_MOVE_FOOTPRINT, HK_LOCK_UNLOCK_FOOTPRINT, HK_ADD_NEW_TRACK, diff --git a/pcbnew/hotkeys_board_editor.cpp b/pcbnew/hotkeys_board_editor.cpp index 8338ed362e..4b71934430 100644 --- a/pcbnew/hotkeys_board_editor.cpp +++ b/pcbnew/hotkeys_board_editor.cpp @@ -624,9 +624,10 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit OnHotkeyRotateItem( HK_ROTATE_ITEM ); break; - case HK_FLIP_FOOTPRINT: // move to other side - OnHotkeyRotateItem( HK_FLIP_FOOTPRINT ); + case HK_FLIP_ITEM: + OnHotkeyRotateItem( HK_FLIP_ITEM ); break; + case HK_SWITCH_HIGHCONTRAST_MODE: // switch to high contrast mode and refresh the canvas DisplayOpt.ContrastModeDisplay = !DisplayOpt.ContrastModeDisplay; m_canvas->Refresh(); @@ -1002,7 +1003,7 @@ bool PCB_EDIT_FRAME::OnHotkeyRotateItem( int aIdCommand ) if( aIdCommand == HK_ROTATE_ITEM ) // Rotation evt_type = ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE; - if( aIdCommand == HK_FLIP_FOOTPRINT ) // move to other side + if( aIdCommand == HK_FLIP_ITEM ) // move to other side evt_type = ID_POPUP_PCB_CHANGE_SIDE_MODULE; } break; @@ -1010,6 +1011,8 @@ bool PCB_EDIT_FRAME::OnHotkeyRotateItem( int aIdCommand ) case PCB_TEXT_T: if( aIdCommand == HK_ROTATE_ITEM ) // Rotation evt_type = ID_POPUP_PCB_ROTATE_TEXTEPCB; + else if( aIdCommand == HK_FLIP_ITEM ) + evt_type = ID_POPUP_PCB_FLIP_TEXTEPCB; break; diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp index cc3f769e0d..0548b4061e 100644 --- a/pcbnew/onrightclick.cpp +++ b/pcbnew/onrightclick.cpp @@ -685,7 +685,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* menu msg, KiBitmap( rotate_module_pos_xpm ) ); AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE, _( "Rotate -" ), KiBitmap( rotate_module_neg_xpm ) ); - msg = AddHotkeyName( _( "Flip" ), g_Board_Editor_Hokeys_Descr, HK_FLIP_FOOTPRINT ); + msg = AddHotkeyName( _( "Flip" ), g_Board_Editor_Hokeys_Descr, HK_FLIP_ITEM ); AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_CHANGE_SIDE_MODULE, msg, KiBitmap( invert_module_xpm ) ); @@ -839,6 +839,8 @@ void PCB_EDIT_FRAME::createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu ) msg = AddHotkeyName( _( "Rotate" ), g_Board_Editor_Hokeys_Descr, HK_ROTATE_ITEM ); AddMenuItem( sub_menu_Text, ID_POPUP_PCB_ROTATE_TEXTEPCB, msg, KiBitmap( rotate_ccw_xpm ) ); + msg = AddHotkeyName( _( "Flip" ), g_Board_Editor_Hokeys_Descr, HK_FLIP_ITEM ); + AddMenuItem( sub_menu_Text, ID_POPUP_PCB_FLIP_TEXTEPCB, msg, KiBitmap( invert_module_xpm ) ); msg = AddHotkeyName( _( "Edit" ), g_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM ); AddMenuItem( sub_menu_Text, ID_POPUP_PCB_EDIT_TEXTEPCB, msg, KiBitmap( edit_text_xpm ) ); AddMenuItem( sub_menu_Text, ID_POPUP_PCB_RESET_TEXT_SIZE, diff --git a/pcbnew/pcbnew_id.h b/pcbnew/pcbnew_id.h index 7f49e0bf3d..1e1d33247c 100644 --- a/pcbnew/pcbnew_id.h +++ b/pcbnew/pcbnew_id.h @@ -66,6 +66,7 @@ enum pcbnew_ids ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST, ID_POPUP_PCB_ROTATE_TEXTEPCB, + ID_POPUP_PCB_FLIP_TEXTEPCB, ID_POPUP_PCB_EDIT_TEXTEPCB, ID_POPUP_PCB_DELETE_TEXTEPCB, From 26eadad6113c4ed714254bced2b04755528cbe7e Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Wed, 30 May 2012 16:40:32 -0500 Subject: [PATCH 08/17] EAGLE_PLUGIN now positions text correct for most cases --- pcbnew/class_edge_mod.h | 10 +- pcbnew/eagle_plugin.cpp | 1006 ++++++++++++++++++++------------------- pcbnew/eagle_plugin.h | 41 -- pcbnew/files.cpp | 2 +- 4 files changed, 533 insertions(+), 526 deletions(-) diff --git a/pcbnew/class_edge_mod.h b/pcbnew/class_edge_mod.h index 8b5b557d4b..609ee2cb49 100644 --- a/pcbnew/class_edge_mod.h +++ b/pcbnew/class_edge_mod.h @@ -42,14 +42,11 @@ class EDA_DRAW_FRAME; class EDGE_MODULE : public DRAWSEGMENT { -public: - wxPoint m_Start0; // Start point or center, relative to module origin, orient 0. - wxPoint m_End0; // End point, relative to module origin, orient 0. - public: EDGE_MODULE( MODULE* parent, STROKE_T aShape = S_SEGMENT ); // Do not create a copy constructor. The one generated by the compiler is adequate. + // EDGE_MODULE( const EDGE_MODULE& ); ~EDGE_MODULE(); @@ -90,6 +87,11 @@ public: #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const; // overload #endif + +//protected: @todo: is it just me? + + wxPoint m_Start0; // Start point or center, relative to module origin, orient 0. + wxPoint m_End0; // End point, relative to module origin, orient 0. }; #endif // CLASS_EDGE_MOD_H_ diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index 3fc9c3cfd0..5b07cd6214 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -52,7 +52,6 @@ Load() TODO's *) set layer counts, types and names into BOARD *) footprint placement on board back *) eagle "mirroring" does not mean put on board back -*) fix text twisting and final location issues. *) netclass info? *) code factoring, for polygon at least *) zone fill clearances @@ -98,6 +97,54 @@ typedef boost::optional opt_bool; //typedef boost::optional opt_cptree; +static opt_bool parseOptionalBool( CPTREE& attribs, const char* aName ) +{ + opt_bool ret; + opt_string stemp = attribs.get_optional( aName ); + + if( stemp ) + ret = !stemp->compare( "yes" ); + + return ret; +} + +// None of the 'e'funcs do any "to KiCad" conversion, they merely convert +// some XML node into binary: + + +/// Eagle rotation +struct EROT +{ + bool mirror; + bool spin; + double degrees; +}; +typedef boost::optional opt_erot; + +static EROT erot( const std::string& aRot ) +{ + EROT rot; + + rot.spin = aRot.find( 'S' ) != aRot.npos; + rot.mirror = aRot.find( 'M' ) != aRot.npos; + rot.degrees = strtod( aRot.c_str() + + 1 // skip leading 'R' + + int( rot.spin ) // skip optional leading 'S' + + int( rot.mirror ), // skip optional leading 'M' + NULL ); + + return rot; +} + +static opt_erot parseOptionalEROT( CPTREE& attribs ) +{ + opt_erot ret; + opt_string stemp = attribs.get_optional( "rot" ); + if( stemp ) + ret = erot( *stemp ); + return ret; +} + /// Eagle wire struct EWIRE { @@ -107,8 +154,27 @@ struct EWIRE double y2; double width; int layer; + EWIRE( CPTREE& aWire ); }; +/** + * Constructor EWIRE + * converts a 's xml attributes to binary without additional conversion. + * @param aResult is an EWIRE to fill in with the data converted to binary. + */ +EWIRE::EWIRE( CPTREE& aWire ) +{ + CPTREE& attribs = aWire.get_child( "" ); + + x1 = attribs.get( "x1" ); + y1 = attribs.get( "y1" ); + x2 = attribs.get( "x2" ); + y2 = attribs.get( "y2" ); + width = attribs.get( "width" ); + layer = attribs.get( "layer" ); +} + + /// Eagle via struct EVIA { @@ -119,8 +185,39 @@ struct EVIA double drill; opt_double diam; opt_string shape; + EVIA( CPTREE& aVia ); }; +EVIA::EVIA( CPTREE& aVia ) +{ + CPTREE& attribs = aVia.get_child( "" ); + + /* + + + */ + + x = attribs.get( "x" ); + y = attribs.get( "y" ); + + std::string ext = attribs.get( "extent" ); + + sscanf( ext.c_str(), "%u-%u", &layer_start, &layer_end ); + + drill = attribs.get( "drill" ); + diam = attribs.get_optional( "diameter" ); + shape = attribs.get_optional( "shape" ); +} + + /// Eagle circle struct ECIRCLE { @@ -129,27 +226,70 @@ struct ECIRCLE double radius; double width; int layer; + + ECIRCLE( CPTREE& aCircle ); }; +ECIRCLE::ECIRCLE( CPTREE& aCircle ) +{ + CPTREE& attribs = aCircle.get_child( "" ); + + /* + + + */ + + x = attribs.get( "x" ); + y = attribs.get( "y" ); + radius = attribs.get( "radius" ); + width = attribs.get( "width" ); + layer = attribs.get( "layer" ); +} + + /// Eagle XML rectangle in binary struct ERECT { - double x1; - double y1; - double x2; - double y2; - int layer; + double x1; + double y1; + double x2; + double y2; + int layer; + opt_erot erot; + + ERECT( CPTREE& aRect ); }; -/// Eagle rotation -struct EROT +ERECT::ERECT( CPTREE& aRect ) { - bool mirror; - bool spin; - double degrees; -}; + CPTREE& attribs = aRect.get_child( "" ); + + /* + + + */ + + x1 = attribs.get( "x1" ); + y1 = attribs.get( "y1" ); + x2 = attribs.get( "x2" ); + y2 = attribs.get( "y2" ); + layer = attribs.get( "layer" ); + erot = parseOptionalEROT( attribs ); +} -typedef boost::optional opt_erot; /// Eagle "attribute" XML element, no foolin'. struct EATTR @@ -159,7 +299,7 @@ struct EATTR opt_double x; opt_double y; opt_double size; - // opt_int layer; + opt_int layer; opt_double ratio; opt_erot erot; opt_int display; @@ -170,8 +310,67 @@ struct EATTR NAME, BOTH, }; + + EATTR( CPTREE& aTree ); }; +/** + * Constructor EATTR + * parses an Eagle "attribute" XML element. Note that an attribute element + * is different than an XML element attribute. The attribute element is a + * full XML node in and of itself, and has attributes of its own. Blame Eagle. + */ +EATTR::EATTR( CPTREE& aAttribute ) +{ + CPTREE& attribs = aAttribute.get_child( "" ); + + /* + + or context -- + constant %Bool; "no" -- only in context -- + > + */ + + name = attribs.get( "name" ); // #REQUIRED + value = attribs.get_optional( "value" ); + + x = attribs.get_optional( "x" ); + y = attribs.get_optional( "y" ); + size = attribs.get_optional( "size" ); + + // KiCad cannot currently put a TEXTE_MODULE on a different layer than the MODULE + // Eagle can it seems. + layer = attribs.get_optional( "layer" ); + + ratio = attribs.get_optional( "ratio" ); + erot = parseOptionalEROT( attribs ); + + opt_string stemp = attribs.get_optional( "display" ); + if( stemp ) + { + // (off | value | name | both) + if( !stemp->compare( "off" ) ) + display = EATTR::Off; + else if( !stemp->compare( "value" ) ) + display = EATTR::VALUE; + else if( !stemp->compare( "name" ) ) + display = EATTR::NAME; + else if( !stemp->compare( "both" ) ) + display = EATTR::BOTH; + } +} + + /// Eagle text element struct ETEXT { @@ -199,8 +398,65 @@ struct ETEXT }; opt_int align; + + ETEXT( CPTREE& aText ); }; +ETEXT::ETEXT( CPTREE& aText ) +{ + CPTREE& attribs = aText.get_child( "" ); + + /* + + + */ + + text = aText.data(); + x = attribs.get( "x" ); + y = attribs.get( "y" ); + size = attribs.get( "size" ); + layer = attribs.get( "layer" ); + + font = attribs.get_optional( "font" ); + ratio = attribs.get_optional( "ratio" ); + erot = parseOptionalEROT( attribs ); + + opt_string stemp = attribs.get_optional( "align" ); + if( stemp ) + { + // (bottom-left | bottom-center | bottom-right | center-left | + // center | center-right | top-left | top-center | top-right) + if( !stemp->compare( "center" ) ) + align = ETEXT::CENTER; + else if( !stemp->compare( "center-right" ) ) + align = ETEXT::CENTER_RIGHT; + else if( !stemp->compare( "top-left" ) ) + align = ETEXT::TOP_LEFT; + else if( !stemp->compare( "top-center" ) ) + align = ETEXT::TOP_CENTER; + else if( !stemp->compare( "top-right" ) ) + align = ETEXT::TOP_RIGHT; + else if( !stemp->compare( "bottom-left" ) ) + align = ETEXT::BOTTOM_LEFT; + else if( !stemp->compare( "bottom-center" ) ) + align = ETEXT::BOTTOM_CENTER; + else if( !stemp->compare( "bottom-right" ) ) + align = ETEXT::BOTTOM_RIGHT; + else if( !stemp->compare( "center-left" ) ) + align = ETEXT::CENTER_LEFT; + } +} + + /// Eagle thru hol pad struct EPAD { @@ -226,8 +482,60 @@ struct EPAD opt_bool stop; opt_bool thermals; opt_bool first; + + EPAD( CPTREE& aPad ); }; +EPAD::EPAD( CPTREE& aPad ) +{ + CPTREE& attribs = aPad.get_child( "" ); + + /* + + + */ + + // the DTD says these must be present, throw exception if not found + name = attribs.get( "name" ); + x = attribs.get( "x" ); + y = attribs.get( "y" ); + drill = attribs.get( "drill" ); + + diameter = attribs.get_optional( "diameter" ); + + opt_string s = attribs.get_optional( "shape" ); + if( s ) + { + // (square | round | octagon | long | offset) + if( !s->compare( "square" ) ) + shape = EPAD::SQUARE; + else if( !s->compare( "round" ) ) + shape = EPAD::ROUND; + else if( !s->compare( "octagon" ) ) + shape = EPAD::OCTAGON; + else if( !s->compare( "long" ) ) + shape = EPAD::LONG; + else if( !s->compare( "offset" ) ) + shape = EPAD::OFFSET; + } + + erot = parseOptionalEROT( attribs ); + stop = parseOptionalBool( attribs, "stop" ); + thermals = parseOptionalBool( attribs, "thermals" ); + first = parseOptionalBool( attribs, "first" ); +} + /// Eagle SMD pad struct ESMD @@ -243,14 +551,73 @@ struct ESMD opt_bool stop; opt_bool thermals; opt_bool cream; + + ESMD( CPTREE& aSMD ); }; +ESMD::ESMD( CPTREE& aSMD ) +{ + CPTREE& attribs = aSMD.get_child( "" ); + + /* + + */ + + // the DTD says these must be present, throw exception if not found + name = attribs.get( "name" ); + x = attribs.get( "x" ); + y = attribs.get( "y" ); + dx = attribs.get( "dx" ); + dy = attribs.get( "dy" ); + layer = attribs.get( "layer" ); + erot = parseOptionalEROT( attribs ); + + roundness = attribs.get_optional( "roundness" ); + thermals = parseOptionalBool( attribs, "thermals" ); + stop = parseOptionalBool( attribs, "stop" ); + thermals = parseOptionalBool( attribs, "thermals" ); + cream = parseOptionalBool( attribs, "cream" ); +} + + struct EVERTEX { double x; double y; + + EVERTEX( CPTREE& aVertex ); }; +EVERTEX::EVERTEX( CPTREE& aVertex ) +{ + CPTREE& attribs = aVertex.get_child( "" ); + + /* + + + */ + + x = attribs.get( "x" ); + y = attribs.get( "y" ); +} + + // Eagle polygon, without vertices which are parsed as needed struct EPOLYGON { @@ -269,8 +636,48 @@ struct EPOLYGON opt_bool orphans; opt_bool thermals; opt_int rank; + + EPOLYGON( CPTREE& aPolygon ); }; +EPOLYGON::EPOLYGON( CPTREE& aPolygon ) +{ + CPTREE& attribs = aPolygon.get_child( "" ); + + /* + or context -- + orphans %Bool; "no" -- only in context -- + thermals %Bool; "yes" -- only in context -- + rank %Int; "0" -- 1..6 in context, 0 or 7 in context -- + > + */ + + width = attribs.get( "width" ); + layer = attribs.get( "layer" ); + spacing = attribs.get_optional( "spacing" ); + + opt_string s = attribs.get_optional( "pour" ); + if( s ) + { + // (solid | hatch | cutout) + if( !s->compare( "hatch" ) ) + pour = EPOLYGON::HATCH; + else if( !s->compare( "cutout" ) ) + pour = EPOLYGON::CUTOUT; + else + pour = EPOLYGON::SOLID; + } + + orphans = parseOptionalBool( attribs, "orphans" ); + thermals = parseOptionalBool( attribs, "thermals" ); + rank = attribs.get_optional( "rank" ); +} + /// Assemble a two part key as a simple concatonation of aFirst and aSecond parts, /// using '\x02' as a separator. @@ -287,18 +694,6 @@ static inline unsigned long timeStamp( CPTREE& aTree ) } -static opt_bool parseOptionalBool( CPTREE& attribs, const char* aName ) -{ - opt_bool ret; - opt_string stemp = attribs.get_optional( aName ); - - if( stemp ) - ret = !stemp->compare( "yes" ); - - return ret; -} - - EAGLE_PLUGIN::EAGLE_PLUGIN() { init( NULL ); @@ -429,7 +824,7 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics, const std::string& aXpath ) { if( !gr->first.compare( "wire" ) ) { - EWIRE w = ewire( gr->second ); + EWIRE w( gr->second ); DRAWSEGMENT* dseg = new DRAWSEGMENT( m_board ); m_board->Add( dseg, ADD_APPEND ); @@ -442,18 +837,19 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics, const std::string& aXpath ) } else if( !gr->first.compare( "text" ) ) { - double ratio = 6; - int sign = 1; - #if defined(DEBUG) - if( !gr->second.data().compare( "designed by" ) ) + if( !gr->second.data().compare( "ATMEGA328" ) ) { int breakhere = 1; (void) breakhere; } #endif - ETEXT t = etext( gr->second ); + ETEXT t( gr->second ); + int layer = kicad_layer( t.layer ); + + double ratio = 6; + int sign = 1; TEXTE_PCB* pcbtxt = new TEXTE_PCB( m_board ); m_board->Add( pcbtxt, ADD_APPEND ); @@ -461,7 +857,7 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics, const std::string& aXpath ) pcbtxt->SetTimeStamp( timeStamp( gr->second ) ); pcbtxt->SetText( FROM_UTF8( t.text.c_str() ) ); pcbtxt->SetPosition( wxPoint( kicad_x( t.x ), kicad_y( t.y ) ) ); - pcbtxt->SetLayer( kicad_layer( t.layer ) ); + pcbtxt->SetLayer( layer ); pcbtxt->SetSize( kicad_fontz( t.size ) ); @@ -476,7 +872,11 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics, const std::string& aXpath ) if( t.erot->spin || t.erot->degrees != 180 ) pcbtxt->SetOrientation( t.erot->degrees * 10 ); - else // 180 degree no spin text, flip the justification to opposite + else + // flip the justification to opposite + sign = -1; + + if( t.erot->degrees == 270 ) sign = -1; pcbtxt->SetMirrored( t.erot->mirror ); @@ -529,7 +929,7 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics, const std::string& aXpath ) } else if( !gr->first.compare( "circle" ) ) { - ECIRCLE c = ecircle( gr->second ); + ECIRCLE c( gr->second ); DRAWSEGMENT* dseg = new DRAWSEGMENT( m_board ); m_board->Add( dseg, ADD_APPEND ); @@ -546,7 +946,7 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics, const std::string& aXpath ) // net related info on it from the DTD. else if( !gr->first.compare( "rectangle" ) ) { - ERECT r = erect( gr->second ); + ERECT r( gr->second ); int layer = kicad_layer( r.layer ); if( IsValidCopperLayerIndex( layer ) ) @@ -680,7 +1080,7 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements, const std::string& aXpath ) double x = attrs.get( "x" ); double y = attrs.get( "y" ); - opt_string rot = attrs.get_optional( "rot" ); + opt_erot erot = parseOptionalEROT( attrs ); std::string key = makeKey( library, package ); @@ -695,7 +1095,7 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements, const std::string& aXpath ) } #if defined(DEBUG) - if( !name.compare( "IC3" ) ) + if( !name.compare( "ATMEGA328" ) ) { int breakhere = 1; (void) breakhere; @@ -706,6 +1106,7 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements, const std::string& aXpath ) MODULE* m = new MODULE( *mi->second ); m_board->Add( m, ADD_APPEND ); + // update the nets within the pads of the clone for( D_PAD* pad = m->m_Pads; pad; pad = pad->Next() ) { std::string key = makeKey( name, TO_UTF8( pad->GetPadName() ) ); @@ -723,13 +1124,11 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements, const std::string& aXpath ) m->SetValue( FROM_UTF8( value.c_str() ) ); // m->Value().SetVisible( false ); - if( rot ) + if( erot ) { - EROT r = erot( *rot ); + m->SetOrientation( erot->degrees * 10 ); - m->SetOrientation( r.degrees * 10 ); - - if( r.mirror ) + if( erot->mirror ) { m->Flip( m->GetPosition() ); } @@ -738,18 +1137,25 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements, const std::string& aXpath ) // VALUE and NAME can have something like our text "effects" overrides // in SWEET and new schematic. Eagle calls these XML elements "attribute". // There can be one for NAME and/or VALUE both. - CA_ITER_RANGE attributes = it->second.equal_range( "attribute" ); - for( CA_ITER ait = attributes.first; ait != attributes.second; ++ait ) + for( CITER ait = it->second.begin(); ait != it->second.end(); ++ait ) { + if( ait->first.compare( "attribute" ) ) + continue; + double ratio = 6; - EATTR a = eattr( ait->second ); + EATTR a( ait->second ); TEXTE_MODULE* txt; if( !a.name.compare( "NAME" ) ) txt = &m->Reference(); - else // "VALUE" or else our understanding of file format is incomplete. + else if( !a.name.compare( "VALUE" ) ) txt = &m->Value(); + else + { + // our understanding of file format is incomplete? + return; + } if( a.value ) { @@ -777,420 +1183,24 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements, const std::string& aXpath ) txt->SetThickness( lw ); } + double angle = 0; if( a.erot ) - { - double angle = a.erot->degrees * 10; + angle = a.erot->degrees * 10; - if( angle != 1800 ) - { - angle -= m->GetOrientation(); // subtract module's angle - txt->SetOrientation( angle ); - } - else - { - txt->SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT ); - txt->SetVertJustify( GR_TEXT_VJUSTIFY_TOP ); - } + if( angle != 1800 ) + { + angle -= m->GetOrientation(); // subtract module's angle + txt->SetOrientation( angle ); + } + else + { + txt->SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT ); + txt->SetVertJustify( GR_TEXT_VJUSTIFY_TOP ); } } } } - -EWIRE EAGLE_PLUGIN::ewire( CPTREE& aWire ) const -{ - EWIRE w; - CPTREE& attribs = aWire.get_child( "" ); - - w.x1 = attribs.get( "x1" ); - w.y1 = attribs.get( "y1" ); - w.x2 = attribs.get( "x2" ); - w.y2 = attribs.get( "y2" ); - w.width = attribs.get( "width" ); - w.layer = attribs.get( "layer" ); - return w; -} - - -EVIA EAGLE_PLUGIN::evia( CPTREE& aVia ) const -{ - EVIA v; - CPTREE& attribs = aVia.get_child( "" ); - - /* - - - */ - - v.x = attribs.get( "x" ); - v.y = attribs.get( "y" ); - - std::string ext = attribs.get( "extent" ); - - sscanf( ext.c_str(), "%u-%u", &v.layer_start, &v.layer_end ); - - v.drill = attribs.get( "drill" ); - v.diam = attribs.get_optional( "diameter" ); - v.shape = attribs.get_optional( "shape" ); - return v; -} - - -ECIRCLE EAGLE_PLUGIN::ecircle( CPTREE& aCircle ) const -{ - ECIRCLE c; - CPTREE& attribs = aCircle.get_child( "" ); - - c.x = attribs.get( "x" ); - c.y = attribs.get( "y" ); - c.radius = attribs.get( "radius" ); - c.width = attribs.get( "width" ); - c.layer = attribs.get( "layer" ); - return c; -} - - -ERECT EAGLE_PLUGIN::erect( CPTREE& aRect ) const -{ - ERECT r; - CPTREE& attribs = aRect.get_child( "" ); - - /* - - - */ - - r.x1 = attribs.get( "x1" ); - r.y1 = attribs.get( "y1" ); - r.x2 = attribs.get( "x2" ); - r.y2 = attribs.get( "y2" ); - r.layer = attribs.get( "layer" ); - - // @todo: stop hoping that rot is not used - - return r; -} - - -ETEXT EAGLE_PLUGIN::etext( CPTREE& aText ) const -{ - ETEXT t; - CPTREE& attribs = aText.get_child( "" ); - - /* - - - */ - - t.text = aText.data(); - t.x = attribs.get( "x" ); - t.y = attribs.get( "y" ); - t.size = attribs.get( "size" ); - t.layer = attribs.get( "layer" ); - - t.font = attribs.get_optional( "font" ); - t.ratio = attribs.get_optional( "ratio" ); - - opt_string rot = attribs.get_optional( "rot" ); - if( rot ) - { - t.erot = erot( *rot ); - } - - opt_string align = attribs.get_optional( "align" ); - if( align ) - { - // (bottom-left | bottom-center | bottom-right | center-left | - // center | center-right | top-left | top-center | top-right) - if( !align->compare( "center" ) ) - *t.align = ETEXT::CENTER; - else if( !align->compare( "center-right" ) ) - *t.align = ETEXT::CENTER_RIGHT; - else if( !align->compare( "top-left" ) ) - *t.align = ETEXT::TOP_LEFT; - else if( !align->compare( "top-center" ) ) - *t.align = ETEXT::TOP_CENTER; - else if( !align->compare( "top-right" ) ) - *t.align = ETEXT::TOP_RIGHT; - else if( !align->compare( "bottom-left" ) ) - *t.align = ETEXT::BOTTOM_LEFT; - else if( !align->compare( "bottom-center" ) ) - *t.align = ETEXT::BOTTOM_CENTER; - else if( !align->compare( "bottom-right" ) ) - *t.align = ETEXT::BOTTOM_RIGHT; - else if( !align->compare( "center-left" ) ) - *t.align = ETEXT::CENTER_LEFT; - } - - return t; -} - - -EROT EAGLE_PLUGIN::erot( const std::string& aRot ) const -{ - EROT rot; - - rot.spin = aRot.find( 'S' ) != aRot.npos; - rot.mirror = aRot.find( 'M' ) != aRot.npos; - rot.degrees = strtod( aRot.c_str() - + 1 // skip leading 'R' - + int( rot.spin ) // skip optional leading 'S' - + int( rot.mirror ), // skip optional leading 'M' - NULL ); - - return rot; -} - - -EATTR EAGLE_PLUGIN::eattr( CPTREE& aAttribute ) const -{ - EATTR a; - CPTREE& attribs = aAttribute.get_child( "" ); - - /* - - or context -- - constant %Bool; "no" -- only in context -- - > - */ - - a.name = attribs.get( "name" ); // #REQUIRED - a.value = attribs.get_optional( "value" ); - - a.x = attribs.get_optional( "x" ); - a.y = attribs.get_optional( "y" ); - - // KiCad cannot currently put a TEXTE_MODULE on a different layer than the MODULE - // Eagle can it seems. Skip layer. - - a.size = attribs.get_optional( "size" ); - a.ratio = attribs.get_optional( "ratio" ); - - opt_string rot = attribs.get_optional( "rot" ); - if( rot ) - { - a.erot = erot( *rot ); - } - - opt_string display = attribs.get_optional( "display" ); - if( display ) - { - // (off | value | name | both) - if( !display->compare( "off" ) ) - a.display = EATTR::Off; - else if( !display->compare( "value" ) ) - a.display = EATTR::VALUE; - else if( !display->compare( "name" ) ) - a.display = EATTR::NAME; - else if( !display->compare( "both" ) ) - a.display = EATTR::BOTH; - } - - return a; -} - - -EPAD EAGLE_PLUGIN::epad( CPTREE& aPad ) const -{ - EPAD p; - CPTREE& attribs = aPad.get_child( "" ); - - /* - - - */ - - // the DTD says these must be present, throw exception if not found - p.name = attribs.get( "name" ); - p.x = attribs.get( "x" ); - p.y = attribs.get( "y" ); - p.drill = attribs.get( "drill" ); - - p.diameter = attribs.get_optional( "diameter" ); - - opt_string s = attribs.get_optional( "shape" ); - if( s ) - { - // (square | round | octagon | long | offset) - if( !s->compare( "square" ) ) - p.shape = EPAD::SQUARE; - else if( !s->compare( "round" ) ) - p.shape = EPAD::ROUND; - else if( !s->compare( "octagon" ) ) - p.shape = EPAD::OCTAGON; - else if( !s->compare( "long" ) ) - p.shape = EPAD::LONG; - else if( !s->compare( "offset" ) ) - p.shape = EPAD::OFFSET; - } - - opt_string rot = attribs.get_optional( "rot" ); - if( rot ) - { - p.erot = erot( *rot ); - } - - p.stop = parseOptionalBool( attribs, "stop" ); - p.thermals = parseOptionalBool( attribs, "thermals" ); - p.first = parseOptionalBool( attribs, "first" ); - - return p; -} - - -ESMD EAGLE_PLUGIN::esmd( CPTREE& aSMD ) const -{ - ESMD s; - CPTREE& attribs = aSMD.get_child( "" ); - - /* - - */ - - // the DTD says these must be present, throw exception if not found - s.name = attribs.get( "name" ); - s.x = attribs.get( "x" ); - s.y = attribs.get( "y" ); - s.dx = attribs.get( "dx" ); - s.dy = attribs.get( "dy" ); - s.layer = attribs.get( "layer" ); - - opt_string rot = attribs.get_optional( "rot" ); - if( rot ) - { - s.erot = erot( *rot ); - } - - s.roundness = attribs.get_optional( "roundness" ); - s.thermals = parseOptionalBool( attribs, "thermals" ); - s.stop = parseOptionalBool( attribs, "stop" ); - s.thermals = parseOptionalBool( attribs, "thermals" ); - s.cream = parseOptionalBool( attribs, "cream" ); - - return s; -} - - -EVERTEX EAGLE_PLUGIN::evertex( CPTREE& aVertex ) const -{ - EVERTEX v; - CPTREE& attribs = aVertex.get_child( "" ); - - /* - - - */ - - v.x = attribs.get( "x" ); - v.y = attribs.get( "y" ); - - return v; -} - - -EPOLYGON EAGLE_PLUGIN::epolygon( CPTREE& aPolygon ) const -{ - EPOLYGON p; - CPTREE& attribs = aPolygon.get_child( "" ); - - /* - or context -- - orphans %Bool; "no" -- only in context -- - thermals %Bool; "yes" -- only in context -- - rank %Int; "0" -- 1..6 in context, 0 or 7 in context -- - > - */ - - p.width = attribs.get( "width" ); - p.layer = attribs.get( "layer" ); - p.spacing = attribs.get_optional( "spacing" ); - - opt_string s = attribs.get_optional( "pour" ); - if( s ) - { - // (solid | hatch | cutout) - if( !s->compare( "hatch" ) ) - p.pour = EPOLYGON::HATCH; - else if( !s->compare( "cutout" ) ) - p.pour = EPOLYGON::CUTOUT; - else - p.pour = EPOLYGON::SOLID; - } - - p.orphans = parseOptionalBool( attribs, "orphans" ); - p.thermals = parseOptionalBool( attribs, "thermals" ); - p.rank = attribs.get_optional( "rank" ); - - return p; -} - - MODULE* EAGLE_PLUGIN::makeModule( CPTREE& aPackage, const std::string& aPkgName ) const { std::auto_ptr m( new MODULE( NULL ) ); @@ -1236,7 +1246,7 @@ MODULE* EAGLE_PLUGIN::makeModule( CPTREE& aPackage, const std::string& aPkgName void EAGLE_PLUGIN::packageWire( MODULE* aModule, CPTREE& aTree ) const { - EWIRE w = ewire( aTree ); + EWIRE w( aTree ); int layer = kicad_layer( w.layer ); if( IsValidNonCopperLayerIndex( layer ) ) // skip copper package wires @@ -1250,6 +1260,13 @@ void EAGLE_PLUGIN::packageWire( MODULE* aModule, CPTREE& aTree ) const dwg->SetStart0( start ); dwg->SetEnd0( end ); + + switch( layer ) + { + case ECO1_N: layer = SILKSCREEN_N_FRONT; break; + case ECO2_N: layer = SILKSCREEN_N_BACK; break; + } + dwg->SetLayer( layer ); dwg->SetWidth( width ); } @@ -1259,7 +1276,7 @@ void EAGLE_PLUGIN::packageWire( MODULE* aModule, CPTREE& aTree ) const void EAGLE_PLUGIN::packagePad( MODULE* aModule, CPTREE& aTree ) const { // this is thru hole technology here, no SMDs - EPAD e = epad( aTree ); + EPAD e( aTree ); /* from /doc/eagle.dtd @@ -1304,8 +1321,8 @@ void EAGLE_PLUGIN::packagePad( MODULE* aModule, CPTREE& aTree ) const } else { - // the pad size is optional in the eagle DTD, supply something here that is a - // 6 mil copper surround as a minimum. + // The pad size is optional in the eagle DTD, supply something here that is a + // 6 mil copper surround as a minimum, otherwise 120% of drillz. int drillz = pad->GetDrillSize().x; int diameter = std::max( drillz + 2 * Mils2iu( 6 ), int( drillz * 1.2 ) ); pad->SetSize( wxSize( diameter, diameter ) ); @@ -1352,16 +1369,20 @@ void EAGLE_PLUGIN::packageText( MODULE* aModule, CPTREE& aTree ) const { int sign = 1; double ratio = 6; - ETEXT t = etext( aTree ); + ETEXT t( aTree ); + int layer = kicad_layer( t.layer ); TEXTE_MODULE* txt; - if( !t.text.compare( ">NAME" ) ) + if( !t.text.compare( ">NAME" ) || !t.text.compare( ">name" ) ) txt = &aModule->Reference(); - else if( !t.text.compare( ">VALUE" ) ) + else if( !t.text.compare( ">VALUE" ) || !t.text.compare( ">value" ) ) txt = &aModule->Value(); else - return; + { + txt = new TEXTE_MODULE( aModule ); + aModule->m_Drawings.PushBack( txt ); + } txt->SetTimeStamp( timeStamp( aTree ) ); txt->SetText( FROM_UTF8( t.text.c_str() ) ); @@ -1371,7 +1392,13 @@ void EAGLE_PLUGIN::packageText( MODULE* aModule, CPTREE& aTree ) const txt->SetPosition( pos ); txt->SetPos0( pos - aModule->GetPosition() ); - txt->SetLayer( kicad_layer( t.layer ) ); + switch( layer ) + { + case ECO1_N: layer = SILKSCREEN_N_FRONT; break; + case ECO2_N: layer = SILKSCREEN_N_BACK; break; + } + + txt->SetLayer( layer ); txt->SetSize( kicad_fontz( t.size ) ); @@ -1442,9 +1469,9 @@ void EAGLE_PLUGIN::packageText( MODULE* aModule, CPTREE& aTree ) const void EAGLE_PLUGIN::packageRectangle( MODULE* aModule, CPTREE& aTree ) const { - /* - ERECT r = erect( aTree ); - */ + ERECT r( aTree ); + + } @@ -1456,7 +1483,25 @@ void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, CPTREE& aTree ) const void EAGLE_PLUGIN::packageCircle( MODULE* aModule, CPTREE& aTree ) const { - // CPTREE& attrs = aTree.get_child( "" ); + ECIRCLE e( aTree ); + int layer = kicad_layer( e.layer ); + + EDGE_MODULE* gr = new EDGE_MODULE( aModule, S_CIRCLE ); + aModule->m_Drawings.PushBack( gr ); + + gr->SetWidth( kicad( e.width ) ); + + switch( layer ) + { + case ECO1_N: layer = SILKSCREEN_N_FRONT; break; + case ECO2_N: layer = SILKSCREEN_N_BACK; break; + } + + gr->SetLayer( layer ); + gr->SetTimeStamp( timeStamp( aTree ) ); + + gr->SetStart0( wxPoint( kicad_x( e.x ), kicad_y( e.y ) ) ); + gr->SetEnd0( wxPoint( kicad_x( e.x + e.radius ), kicad_y( e.y ) ) ); } @@ -1468,7 +1513,7 @@ void EAGLE_PLUGIN::packageHole( MODULE* aModule, CPTREE& aTree ) const void EAGLE_PLUGIN::packageSMD( MODULE* aModule, CPTREE& aTree ) const { - ESMD e = esmd( aTree ); + ESMD e( aTree ); int layer = kicad_layer( e.layer ); if( !IsValidCopperLayerIndex( layer ) ) @@ -1536,7 +1581,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals, const std::string& aXpath ) { if( !it->first.compare( "wire" ) ) { - EWIRE w = ewire( it->second ); + EWIRE w( it->second ); int layer = kicad_layer( w.layer ); if( IsValidCopperLayerIndex( layer ) ) @@ -1562,7 +1607,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals, const std::string& aXpath ) else if( !it->first.compare( "via" ) ) { - EVIA v = evia( it->second ); + EVIA v( it->second ); int layer_start = kicad_layer( v.layer_start ); int layer_end = kicad_layer( v.layer_end ); @@ -1570,9 +1615,9 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals, const std::string& aXpath ) if( IsValidCopperLayerIndex( layer_start ) && IsValidCopperLayerIndex( layer_end ) ) { - int drill = kicad( v.drill ); - - SEGVIA* via = new SEGVIA( m_board ); + int drillz = kicad( v.drill ); + SEGVIA* via = new SEGVIA( m_board ); + m_board->m_Track.Insert( via, NULL ); via->SetLayerPair( layer_start, layer_end ); @@ -1584,9 +1629,12 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals, const std::string& aXpath ) via->SetWidth( kidiam ); } else - via->SetWidth( drill * 3 ); + { + int diameter = std::max( drillz + 2 * Mils2iu( 6 ), int( drillz * 2.0 ) ); + via->SetWidth( diameter ); + } - via->SetDrill( drill ); + via->SetDrill( drillz ); via->SetTimeStamp( timeStamp( it->second ) ); @@ -1597,9 +1645,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals, const std::string& aXpath ) via->SetNet( netCode ); - via->SetShape( S_CIRCLE ); // @todo should be in SEGVIA constructor - - m_board->m_Track.Insert( via, NULL ); + via->SetShape( S_CIRCLE ); // @todo should be in SEGVIA constructor } } @@ -1620,7 +1666,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals, const std::string& aXpath ) else if( !it->first.compare( "polygon" ) ) { - EPOLYGON p = epolygon( it->second ); + EPOLYGON p( it->second ); int layer = kicad_layer( p.layer ); if( IsValidCopperLayerIndex( layer ) ) @@ -1644,7 +1690,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals, const std::string& aXpath ) if( vi->first.compare( "vertex" ) ) // skip node continue; - EVERTEX v = evertex( vi->second ); + EVERTEX v( vi->second ); // the ZONE_CONTAINER API needs work, as you can see: if( first ) diff --git a/pcbnew/eagle_plugin.h b/pcbnew/eagle_plugin.h index bba024013b..4d1fa926ec 100644 --- a/pcbnew/eagle_plugin.h +++ b/pcbnew/eagle_plugin.h @@ -75,18 +75,6 @@ namespace boost { typedef boost::property_tree::ptree PTREE; typedef const PTREE CPTREE; -struct EWIRE; -struct EVIA; -struct EROT; -struct EATTR; -struct ECIRCLE; -struct ETEXT; -struct ERECT; -struct EPAD; -struct ESMD; -struct EVERTEX; -struct EPOLYGON; - /** * Class EAGLE_PLUGIN * works with Eagle 6.x XML board files and footprints. @@ -194,35 +182,6 @@ private: void loadElements( CPTREE& aElements, const std::string& aXpath ); - // none of the 'e'funcs do any "to KiCad" conversion, they merely read the XML into binary: - - /** - * Function ewire - * converts a 's xml attributes to binary without additional conversion. - * @param aResult is an EWIRE to fill in with the data converted to binary. - */ - EWIRE ewire( CPTREE& aWire ) const; - - EVIA evia( CPTREE& aVia ) const; - - ECIRCLE ecircle( CPTREE& aCircle ) const; - ETEXT etext( CPTREE& aText ) const; - ERECT erect( CPTREE& aRect ) const; - - EROT erot( const std::string& aRot ) const; - EPAD epad( CPTREE& aPad ) const; - ESMD esmd( CPTREE& aSMD ) const; - EVERTEX evertex( CPTREE& aVertex ) const; - EPOLYGON epolygon( CPTREE& aPolygon ) const; - - /** - * Function eattr - * parses an Eagle "attribute" element. Note that an attribute element - * is different than an XML element attribute. The attribute element is a - * full XML node in and of itself, and has attributes of its own. Blame Eagle. - */ - EATTR eattr( CPTREE& aAttribute ) const; - /** * Function fmtDEG * formats an angle in a way particular to a board file format. This function diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index ac50e01bdc..3eecab336d 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -174,7 +174,7 @@ the changes?" ) ) ) // This is a subset of all PLUGINs which are trusted to be able to // load a BOARD. Order is subject to change as KICAD plugin matures. - // User may occasionally use the wrong pluging to load a *.brd file, + // User may occasionally use the wrong plugin to load a *.brd file, // but eventually *.kicad_pcb will be more common than legacy *.brd files. static const struct { const wxString& filter; From 29b5837a913d1f2a01f12b276688642156ddce4d Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 31 May 2012 15:47:02 +0200 Subject: [PATCH 09/17] Eeschema, Libedit: Fix bug that can crashes Eeschema: In libedit 2 mandatory fields could be deleted. Fixed now. Very minor other fixes. --- .../dialog_edit_libentry_fields_in_lib.cpp | 8 ++++---- pcbnew/class_drawsegment.cpp | 2 +- .../dialog_global_modules_fields_edition.cpp | 11 +++++++---- ...dialog_global_modules_fields_edition_base.cpp | 13 +++++++------ ...dialog_global_modules_fields_edition_base.fbp | 16 ++++++++-------- .../dialog_global_modules_fields_edition_base.h | 2 +- 6 files changed, 28 insertions(+), 24 deletions(-) diff --git a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp index df98b0f925..674c3ffd27 100644 --- a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp +++ b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp @@ -321,7 +321,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::deleteFieldButtonHandler( wxCommandEven if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too return; - if( fieldNdx <= VALUE ) + if( fieldNdx < MANDATORY_FIELDS ) { wxBell(); return; @@ -360,7 +360,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB:: moveUpButtonHandler( wxCommandEvent& e if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too return; - if( fieldNdx <= MANDATORY_FIELDS ) + if( fieldNdx < MANDATORY_FIELDS ) { wxBell(); return; @@ -651,10 +651,10 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel() // only user defined fields may be moved, and not the top most user defined // field since it would be moving up into the fixed fields, > not >= - moveUpButton->Enable( fieldNdx > MANDATORY_FIELDS ); + moveUpButton->Enable( fieldNdx >= MANDATORY_FIELDS ); // if fieldNdx == REFERENCE, VALUE, then disable delete button - deleteFieldButton->Enable( fieldNdx > VALUE ); + deleteFieldButton->Enable( fieldNdx >= MANDATORY_FIELDS ); fieldValueTextCtrl->SetValue( field.m_Text ); diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp index 6d43a35483..04f360b4d1 100644 --- a/pcbnew/class_drawsegment.cpp +++ b/pcbnew/class_drawsegment.cpp @@ -206,7 +206,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx if( ( draw_mode & GR_ALLOW_HIGHCONTRAST ) && DisplayOpt.ContrastModeDisplay ) { - if( !IsOnLayer( curr_layer ) ) + if( !IsOnLayer( curr_layer ) && !IsOnLayer( EDGE_N ) ) { color &= ~MASKCOLOR; color |= DARKDARKGRAY; diff --git a/pcbnew/dialogs/dialog_global_modules_fields_edition.cpp b/pcbnew/dialogs/dialog_global_modules_fields_edition.cpp index 98dde3e24c..a734b59b25 100644 --- a/pcbnew/dialogs/dialog_global_modules_fields_edition.cpp +++ b/pcbnew/dialogs/dialog_global_modules_fields_edition.cpp @@ -45,8 +45,8 @@ // The dialog to set options for global fields edition: // optionas are: -// edited fields (ref, value, others -// the footprint filter, for selective edition +// - edited fields (ref, value, others +// - the footprint filter, for selective edition class DIALOG_GLOBAL_MODULES_FIELDS_EDITION : public DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE { PCB_EDIT_FRAME* m_parent; @@ -64,7 +64,6 @@ public: { m_parent = parent; initDialog(); - GetSizer()->SetSizeHints( this ); } private: @@ -85,7 +84,7 @@ wxString DIALOG_GLOBAL_MODULES_FIELDS_EDITION::m_filterString; void DIALOG_GLOBAL_MODULES_FIELDS_EDITION::initDialog() { - SetFocus(); + m_sdbSizerButtonsOK->SetDefault(); m_brdSettings = &m_parent->GetDesignSettings(); @@ -102,6 +101,10 @@ void DIALOG_GLOBAL_MODULES_FIELDS_EDITION::initDialog() ReturnStringFromValue( g_UserUnit, m_brdSettings->m_ModuleTextSize.y ) ); m_TicknessValue->SetValue( ReturnStringFromValue( g_UserUnit, m_brdSettings->m_ModuleTextWidth) ); + + Layout(); + GetSizer()->SetSizeHints( this ); + Centre(); } diff --git a/pcbnew/dialogs/dialog_global_modules_fields_edition_base.cpp b/pcbnew/dialogs/dialog_global_modules_fields_edition_base.cpp index e304301bdf..dd58594904 100644 --- a/pcbnew/dialogs/dialog_global_modules_fields_edition_base.cpp +++ b/pcbnew/dialogs/dialog_global_modules_fields_edition_base.cpp @@ -26,13 +26,13 @@ DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE::DIALOG_GLOBAL_MODULES_FIELDS_EDITION_ sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Fields:") ), wxVERTICAL ); m_ReferenceOpt = new wxCheckBox( this, wxID_ANY, _("Modify reference"), wxDefaultPosition, wxDefaultSize, 0 ); - sbSizer1->Add( m_ReferenceOpt, 0, wxALL, 5 ); + sbSizer1->Add( m_ReferenceOpt, 0, wxALL|wxEXPAND, 5 ); m_ValueOpt = new wxCheckBox( this, wxID_ANY, _("Modify value"), wxDefaultPosition, wxDefaultSize, 0 ); - sbSizer1->Add( m_ValueOpt, 0, wxALL, 5 ); + sbSizer1->Add( m_ValueOpt, 0, wxALL|wxEXPAND, 5 ); m_OtherFields = new wxCheckBox( this, wxID_ANY, _("Modify other fields"), wxDefaultPosition, wxDefaultSize, 0 ); - sbSizer1->Add( m_OtherFields, 0, wxALL, 5 ); + sbSizer1->Add( m_OtherFields, 0, wxALL|wxEXPAND, 5 ); bLeftSizer->Add( sbSizer1, 1, wxEXPAND|wxRIGHT, 5 ); @@ -44,9 +44,9 @@ DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE::DIALOG_GLOBAL_MODULES_FIELDS_EDITION_ bLeftSizer->Add( m_staticTextFilter, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_ModuleFilter = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_ModuleFilter->SetMinSize( wxSize( 150,-1 ) ); + m_ModuleFilter->SetMinSize( wxSize( 180,-1 ) ); - bLeftSizer->Add( m_ModuleFilter, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + bLeftSizer->Add( m_ModuleFilter, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); bSizerUpper->Add( bLeftSizer, 1, wxEXPAND, 5 ); @@ -59,6 +59,7 @@ DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE::DIALOG_GLOBAL_MODULES_FIELDS_EDITION_ wxFlexGridSizer* fgSizerCurrSettings; fgSizerCurrSettings = new wxFlexGridSizer( 3, 3, 0, 0 ); + fgSizerCurrSettings->AddGrowableCol( 1 ); fgSizerCurrSettings->SetFlexibleDirection( wxBOTH ); fgSizerCurrSettings->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); @@ -99,7 +100,7 @@ DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE::DIALOG_GLOBAL_MODULES_FIELDS_EDITION_ sbSizerSettings->Add( fgSizerCurrSettings, 1, wxEXPAND, 5 ); - bRightSizer->Add( sbSizerSettings, 1, wxEXPAND|wxLEFT, 5 ); + bRightSizer->Add( sbSizerSettings, 0, wxEXPAND|wxLEFT, 5 ); bSizerUpper->Add( bRightSizer, 0, wxEXPAND, 5 ); diff --git a/pcbnew/dialogs/dialog_global_modules_fields_edition_base.fbp b/pcbnew/dialogs/dialog_global_modules_fields_edition_base.fbp index 7df7114895..1cb0a6b557 100644 --- a/pcbnew/dialogs/dialog_global_modules_fields_edition_base.fbp +++ b/pcbnew/dialogs/dialog_global_modules_fields_edition_base.fbp @@ -42,7 +42,7 @@ DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE - 482,199 + 409,199 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Global Module Fields Edition @@ -123,7 +123,7 @@ 5 - wxALL + wxALL|wxEXPAND 0 1 @@ -211,7 +211,7 @@ 5 - wxALL + wxALL|wxEXPAND 0 1 @@ -299,7 +299,7 @@ 5 - wxALL + wxALL|wxEXPAND 0 1 @@ -472,7 +472,7 @@ 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT + wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND 0 1 @@ -508,7 +508,7 @@ 0 0 - 150,-1 + 180,-1 1 m_ModuleFilter 1 @@ -575,7 +575,7 @@ 5 wxEXPAND|wxLEFT - 1 + 0 wxID_ANY Current Design Settings: @@ -591,7 +591,7 @@ 3 wxBOTH - + 1 0 diff --git a/pcbnew/dialogs/dialog_global_modules_fields_edition_base.h b/pcbnew/dialogs/dialog_global_modules_fields_edition_base.h index d6d616cea1..1518ee6810 100644 --- a/pcbnew/dialogs/dialog_global_modules_fields_edition_base.h +++ b/pcbnew/dialogs/dialog_global_modules_fields_edition_base.h @@ -63,7 +63,7 @@ class DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE : public DIALOG_SHIM public: - DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Global Module Fields Edition"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 482,199 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Global Module Fields Edition"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 409,199 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_GLOBAL_MODULES_FIELDS_EDITION_BASE(); }; From 583006b599d97821da87c7ae9a0f36fbeb89cf05 Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Thu, 31 May 2012 10:18:55 -0500 Subject: [PATCH 10/17] EAGLE_PLUGIN add mechanical "hole" support for both MODULEs and BOARD --- pcbnew/class_text_mod.cpp | 38 ++--- pcbnew/eagle_plugin.cpp | 349 ++++++++++++++++++++++++++------------ pcbnew/eagle_plugin.h | 2 + 3 files changed, 257 insertions(+), 132 deletions(-) diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index a588b12484..9a4f5f7590 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -50,7 +50,7 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) : BOARD_ITEM( parent, PCB_MODULE_TEXT_T ), EDA_TEXT() { - MODULE* Module = (MODULE*) m_Parent; + MODULE* module = (MODULE*) m_Parent; m_Type = text_type; /* Reference */ @@ -63,11 +63,11 @@ TEXTE_MODULE::TEXTE_MODULE( MODULE* parent, int text_type ) : SetLayer( SILKSCREEN_N_FRONT ); - if( Module && ( Module->Type() == PCB_MODULE_T ) ) + if( module && ( module->Type() == PCB_MODULE_T ) ) { - m_Pos = Module->m_Pos; + m_Pos = module->m_Pos; - int moduleLayer = Module->GetLayer(); + int moduleLayer = module->GetLayer(); if( moduleLayer == LAYER_N_BACK ) SetLayer( SILKSCREEN_N_BACK ); @@ -120,18 +120,18 @@ int TEXTE_MODULE::GetLength() const // Update draw coordinates void TEXTE_MODULE::SetDrawCoord() { - MODULE* Module = (MODULE*) m_Parent; + MODULE* module = (MODULE*) m_Parent; m_Pos = m_Pos0; - if( Module == NULL ) + if( module == NULL ) return; - int angle = Module->m_Orient; + double angle = module->GetOrientation(); NORMALIZE_ANGLE_POS( angle ); RotatePoint( &m_Pos.x, &m_Pos.y, angle ); - m_Pos += Module->m_Pos; + m_Pos += module->GetPosition(); } @@ -139,17 +139,17 @@ void TEXTE_MODULE::SetDrawCoord() // anchor point) void TEXTE_MODULE::SetLocalCoord() { - MODULE* Module = (MODULE*) m_Parent; + MODULE* module = (MODULE*) m_Parent; - if( Module == NULL ) + if( module == NULL ) { m_Pos0 = m_Pos; return; } - m_Pos0 = m_Pos - Module->m_Pos; + m_Pos0 = m_Pos - module->m_Pos; - int angle = Module->m_Orient; + int angle = module->m_Orient; NORMALIZE_ANGLE_POS( angle ); RotatePoint( &m_Pos0.x, &m_Pos0.y, -angle ); @@ -242,7 +242,7 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const w wxSize size; wxPoint pos; // Center of text PCB_BASE_FRAME* frame; - MODULE* Module = (MODULE*) m_Parent; /* parent must *not* be null + MODULE* module = (MODULE*) m_Parent; /* parent must *not* be null * (a module text without a footprint * parent has no sense) */ @@ -282,16 +282,16 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const w pos.x, pos.y + anchor_size, 0, color ); } - color = brd->GetLayerColor(Module->GetLayer()); + color = brd->GetLayerColor(module->GetLayer()); - if( Module->GetLayer() == LAYER_N_BACK ) + 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 ) + else if( module->GetLayer() == LAYER_N_FRONT ) { if( brd->IsElementVisible( MOD_TEXT_FR_VISIBLE ) == false ) return; @@ -336,12 +336,12 @@ void TEXTE_MODULE::DrawUmbilical( EDA_DRAW_PANEL* aPanel, int TEXTE_MODULE::GetDrawRotation() const { int rotation; - MODULE* Module = (MODULE*) m_Parent; + MODULE* module = (MODULE*) m_Parent; rotation = m_Orient; - if( Module ) - rotation += Module->m_Orient; + if( module ) + rotation += module->m_Orient; NORMALIZE_ANGLE_POS( rotation ); diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index 5b07cd6214..ea55259079 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -108,8 +108,12 @@ static opt_bool parseOptionalBool( CPTREE& attribs, const char* aName ) return ret; } -// None of the 'e'funcs do any "to KiCad" conversion, they merely convert -// some XML node into binary: + +// All of the 'E'STRUCTS below merely hold Eagle XML information verbatim, in binary. +// For maintenance and troubleshooting purposes, it was thought that we'd need to +// separate the conversion process into distinct steps. There is no intent to have KiCad +// forms of information in these 'E'STRUCTS. They are only binary forms +// of the Eagle information in the corresponding Eagle XML nodes. /// Eagle rotation @@ -477,7 +481,7 @@ struct EPAD opt_int shape; - opt_erot erot; + opt_erot rot; opt_bool stop; opt_bool thermals; @@ -506,7 +510,7 @@ EPAD::EPAD( CPTREE& aPad ) > */ - // the DTD says these must be present, throw exception if not found + // #REQUIRED says DTD, throw exception if not found name = attribs.get( "name" ); x = attribs.get( "x" ); y = attribs.get( "y" ); @@ -530,7 +534,7 @@ EPAD::EPAD( CPTREE& aPad ) shape = EPAD::OFFSET; } - erot = parseOptionalEROT( attribs ); + rot = parseOptionalEROT( attribs ); stop = parseOptionalBool( attribs, "stop" ); thermals = parseOptionalBool( attribs, "thermals" ); first = parseOptionalBool( attribs, "first" ); @@ -547,7 +551,7 @@ struct ESMD double dy; int layer; opt_int roundness; - opt_erot erot; + opt_erot rot; opt_bool stop; opt_bool thermals; opt_bool cream; @@ -582,7 +586,7 @@ ESMD::ESMD( CPTREE& aSMD ) dx = attribs.get( "dx" ); dy = attribs.get( "dy" ); layer = attribs.get( "layer" ); - erot = parseOptionalEROT( attribs ); + rot = parseOptionalEROT( attribs ); roundness = attribs.get_optional( "roundness" ); thermals = parseOptionalBool( attribs, "thermals" ); @@ -602,7 +606,7 @@ struct EVERTEX EVERTEX::EVERTEX( CPTREE& aVertex ) { - CPTREE& attribs = aVertex.get_child( "" ); + CPTREE& attribs = aVertex.get_child( "" ); /* @@ -642,7 +646,7 @@ struct EPOLYGON EPOLYGON::EPOLYGON( CPTREE& aPolygon ) { - CPTREE& attribs = aPolygon.get_child( "" ); + CPTREE& attribs = aPolygon.get_child( "" ); /* ( "rank" ); } +struct EHOLE +{ + double x; + double y; + double drill; + + EHOLE( CPTREE& aHole ); +}; + +EHOLE::EHOLE( CPTREE& aHole ) +{ + CPTREE& attribs = aHole.get_child( "" ); + + /* + + + */ + + // #REQUIRED: + x = attribs.get( "x" ); + y = attribs.get( "y" ); + drill = attribs.get( "drill" ); +} + +struct EELEMENT +{ + std::string name; + std::string library; + std::string package; + std::string value; + double x; + double y; + opt_bool locked; + // opt_bool smashed; + opt_erot rot; + + EELEMENT( CPTREE& aElement ); +}; + +EELEMENT::EELEMENT( CPTREE& aElement ) +{ + CPTREE& attribs = aElement.get_child( "" ); + + /* + + + */ + + // #REQUIRED + name = attribs.get( "name" ); + library = attribs.get( "library" ); + package = attribs.get( "package" ); + value = attribs.get( "value" ); + + x = attribs.get( "x" ); + y = attribs.get( "y" ); + + // optional + locked = parseOptionalBool( attribs, "locked" ); + // smashed = pasreOptionalBool( attribs, "smashed" ); + rot = parseOptionalEROT( attribs ); +} + /// Assemble a two part key as a simple concatonation of aFirst and aSecond parts, -/// using '\x02' as a separator. +/// using a separator. static inline std::string makeKey( const std::string& aFirst, const std::string& aSecond ) { std::string key = aFirst + '\x02' + aSecond; return key; } + /// Make a unique time stamp, in this case from a unique tree memory location static inline unsigned long timeStamp( CPTREE& aTree ) { @@ -776,6 +858,7 @@ BOARD* EAGLE_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPE void EAGLE_PLUGIN::init( PROPERTIES* aProperties ) { + m_hole_count = 0; m_pads_to_nets.clear(); m_templates.clear(); @@ -835,6 +918,7 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics, const std::string& aXpath ) dseg->SetEnd( wxPoint( kicad_x( w.x2 ), kicad_y( w.y2 ) ) ); dseg->SetWidth( kicad( w.width ) ); } + else if( !gr->first.compare( "text" ) ) { #if defined(DEBUG) @@ -927,6 +1011,7 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics, const std::string& aXpath ) break; } } + else if( !gr->first.compare( "circle" ) ) { ECIRCLE c( gr->second ); @@ -972,10 +1057,48 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics, const std::string& aXpath ) Mils2iu( zone->m_Poly->GetDefaultHatchPitchMils() ) ); } } + else if( !gr->first.compare( "hole" ) ) { - // there's a hole here + EHOLE e( gr->second ); + + // Fabricate a MODULE with a single PAD_HOLE_NOT_PLATED pad. + // Use m_hole_count to gen up a unique name. + + MODULE* module = new MODULE( m_board ); + m_board->Add( module, ADD_APPEND ); + + char temp[40]; + sprintf( temp, "@HOLE%d", m_hole_count++ ); + module->SetReference( FROM_UTF8( temp ) ); + module->Reference().SetVisible( false ); + + wxPoint pos( kicad_x( e.x ), kicad_y( e.y ) ); + + module->SetPosition( pos ); + + // Add a PAD_HOLE_NOT_PLATED pad to this module. + D_PAD* pad = new D_PAD( module ); + module->m_Pads.PushBack( pad ); + + pad->SetShape( PAD_ROUND ); + pad->SetAttribute( PAD_HOLE_NOT_PLATED ); + + /* pad's position is already centered on module at relative (0, 0) + wxPoint padpos( kicad_x( e.x ), kicad_y( e.y ) ); + + pad->SetPos0( padpos ); + pad->SetPosition( padpos + module->GetPosition() ); + */ + + wxSize sz( kicad( e.drill ), kicad( e.drill ) ); + + pad->SetDrillSize( sz ); + pad->SetSize( sz ); + + pad->SetLayerMask( ALL_CU_LAYERS /* | SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT */ ); } + else if( !gr->first.compare( "frame" ) ) { // picture this @@ -1044,58 +1167,30 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements, const std::string& aXpath ) if( it->first.compare( "element" ) ) continue; - CPTREE& attrs = it->second.get_child( "" ); + EELEMENT e( it->second ); - /* - - a '*' means zero or more times - - - - */ - - std::string name = attrs.get( "name" ); - std::string library = attrs.get( "library" ); - std::string package = attrs.get( "package" ); - std::string value = attrs.get( "value" ); - -#if 1 && defined(DEBUG) - if( !name.compare( "GROUND" ) ) +#if 0 && defined(DEBUG) + if( !e.name.compare( "GROUND" ) ) { int breakhere = 1; (void) breakhere; } #endif - double x = attrs.get( "x" ); - double y = attrs.get( "y" ); - - opt_erot erot = parseOptionalEROT( attrs ); - - std::string key = makeKey( library, package ); + std::string key = makeKey( e.library, e.package ); MODULE_CITER mi = m_templates.find( key ); if( mi == m_templates.end() ) { wxString emsg = wxString::Format( _( "No '%s' package in library '%s'" ), - GetChars( FROM_UTF8( package.c_str() ) ), - GetChars( FROM_UTF8( library.c_str() ) ) ); + GetChars( FROM_UTF8( e.package.c_str() ) ), + GetChars( FROM_UTF8( e.library.c_str() ) ) ); THROW_IO_ERROR( emsg ); } #if defined(DEBUG) - if( !name.compare( "ATMEGA328" ) ) + if( !e.name.compare( "ATMEGA328" ) ) { int breakhere = 1; (void) breakhere; @@ -1109,26 +1204,27 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements, const std::string& aXpath ) // update the nets within the pads of the clone for( D_PAD* pad = m->m_Pads; pad; pad = pad->Next() ) { - std::string key = makeKey( name, TO_UTF8( pad->GetPadName() ) ); + std::string key = makeKey( e.name, TO_UTF8( pad->GetPadName() ) ); NET_MAP_CITER ni = m_pads_to_nets.find( key ); if( ni != m_pads_to_nets.end() ) { - pad->SetNetname( FROM_UTF8( ni->second.netname.c_str() ) ); - pad->SetNet( ni->second.netcode ); + const ENET* enet = &ni->second; + pad->SetNetname( FROM_UTF8( enet->netname.c_str() ) ); + pad->SetNet( enet->netcode ); } } - m->SetPosition( wxPoint( kicad_x( x ), kicad_y( y ) ) ); - m->SetReference( FROM_UTF8( name.c_str() ) ); - m->SetValue( FROM_UTF8( value.c_str() ) ); + m->SetPosition( wxPoint( kicad_x( e.x ), kicad_y( e.y ) ) ); + m->SetReference( FROM_UTF8( e.name.c_str() ) ); + m->SetValue( FROM_UTF8( e.value.c_str() ) ); // m->Value().SetVisible( false ); - if( erot ) + if( e.rot ) { - m->SetOrientation( erot->degrees * 10 ); + m->SetOrientation( e.rot->degrees * 10 ); - if( erot->mirror ) + if( e.rot->mirror ) { m->Flip( m->GetPosition() ); } @@ -1142,7 +1238,6 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements, const std::string& aXpath ) if( ait->first.compare( "attribute" ) ) continue; - double ratio = 6; EATTR a( ait->second ); TEXTE_MODULE* txt; @@ -1154,7 +1249,7 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements, const std::string& aXpath ) else { // our understanding of file format is incomplete? - return; + continue; } if( a.value ) @@ -1171,6 +1266,7 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements, const std::string& aXpath ) txt->SetPos0( pos0 ); } + double ratio = 6; if( a.ratio ) ratio = *a.ratio; @@ -1278,22 +1374,6 @@ void EAGLE_PLUGIN::packagePad( MODULE* aModule, CPTREE& aTree ) const // this is thru hole technology here, no SMDs EPAD e( aTree ); - /* from /doc/eagle.dtd - - - */ - D_PAD* pad = new D_PAD( aModule ); aModule->m_Pads.PushBack( pad ); @@ -1314,6 +1394,33 @@ void EAGLE_PLUGIN::packagePad( MODULE* aModule, CPTREE& aTree ) const pad->SetLayerMask( ALL_CU_LAYERS | SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT ); + if( e.shape ) + { + switch( *e.shape ) + { + case EPAD::ROUND: + wxASSERT( pad->GetShape()==PAD_CIRCLE ); // verify set in D_PAD constructor + break; + case EPAD::OCTAGON: + // no KiCad octagonal pad shape, use PAD_CIRCLE for now. + // pad->SetShape( PAD_OCTAGON ); + wxASSERT( pad->GetShape()==PAD_CIRCLE ); // verify set in D_PAD constructor + break; + case EPAD::LONG: + pad->SetShape( PAD_OVAL ); + break; + case EPAD::SQUARE: + pad->SetShape( PAD_RECT ); + break; + case EPAD::OFFSET: + ; // don't know what to do here. + } + } + else + { + // if shape is not present, our default is circle and that matches their default "round" + } + if( e.diameter ) { int diameter = kicad( *e.diameter ); @@ -1321,44 +1428,37 @@ void EAGLE_PLUGIN::packagePad( MODULE* aModule, CPTREE& aTree ) const } else { - // The pad size is optional in the eagle DTD, supply something here that is a - // 6 mil copper surround as a minimum, otherwise 120% of drillz. - int drillz = pad->GetDrillSize().x; - int diameter = std::max( drillz + 2 * Mils2iu( 6 ), int( drillz * 1.2 ) ); + // The pad size is optional in the eagle DTD, so we must guess. + // Supply something here that is a minimum copper surround, or otherwise + // 120% of drillz whichever is greater. But for PAD_OVAL, we can use + // a smaller minimum than for a round pad, since there is a larger copper + // body on the elongated ends. + + int min_copper; + + if( pad->GetShape() == PAD_OVAL ) + min_copper = Mils2iu( 4 ); + else + min_copper = Mils2iu( 6 ); + + // minz copper surround as a minimum, otherwise 110% of drillz. + int drillz = pad->GetDrillSize().x; + int diameter = std::max( drillz + 2 * min_copper, int( drillz * 1.2 ) ); + pad->SetSize( wxSize( diameter, diameter ) ); } - if( e.shape ) // if not shape, our default is circle and that matches their default "round" + if( pad->GetShape() == PAD_OVAL ) { - // - if( *e.shape == EPAD::ROUND ) - wxASSERT( pad->GetShape()==PAD_CIRCLE ); // verify set in D_PAD constructor - - else if( *e.shape == EPAD::OCTAGON ) - { - wxASSERT( pad->GetShape()==PAD_CIRCLE ); // verify set in D_PAD constructor - - // @todo no KiCad octagonal pad shape, use PAD_CIRCLE for now. - // pad->SetShape( PAD_OCTAGON ); - } - - else if( *e.shape == EPAD::LONG ) - { - pad->SetShape( PAD_OVAL ); - - wxSize z = pad->GetSize(); - z.x *= 2; - pad->SetSize( z ); - } - else if( *e.shape == EPAD::SQUARE ) - { - pad->SetShape( PAD_RECT ); - } + // The Eagle "long" pad seems to be tall, "width = height x 4/3" apparently. + wxSize sz = pad->GetSize(); + sz.x = (sz.x * 4)/3; + pad->SetSize( sz ); } - if( e.erot ) + if( e.rot ) { - pad->SetOrientation( e.erot->degrees * 10 ); + pad->SetOrientation( e.rot->degrees * 10 ); } // @todo: handle stop and thermal @@ -1367,8 +1467,6 @@ void EAGLE_PLUGIN::packagePad( MODULE* aModule, CPTREE& aTree ) const void EAGLE_PLUGIN::packageText( MODULE* aModule, CPTREE& aTree ) const { - int sign = 1; - double ratio = 6; ETEXT t( aTree ); int layer = kicad_layer( t.layer ); @@ -1402,11 +1500,13 @@ void EAGLE_PLUGIN::packageText( MODULE* aModule, CPTREE& aTree ) const txt->SetSize( kicad_fontz( t.size ) ); + double ratio = 6; if( t.ratio ) ratio = *t.ratio; txt->SetThickness( kicad( t.size * ratio / 100 ) ); + int sign = 1; if( t.erot ) { if( t.erot->spin || t.erot->degrees != 180 ) @@ -1469,15 +1569,13 @@ void EAGLE_PLUGIN::packageText( MODULE* aModule, CPTREE& aTree ) const void EAGLE_PLUGIN::packageRectangle( MODULE* aModule, CPTREE& aTree ) const { - ERECT r( aTree ); - - + // ERECT r( aTree ); } void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, CPTREE& aTree ) const { - // CPTREE& attrs = aTree.get_child( "" ); + // EPOLYGON p( aTree ); } @@ -1507,7 +1605,32 @@ void EAGLE_PLUGIN::packageCircle( MODULE* aModule, CPTREE& aTree ) const void EAGLE_PLUGIN::packageHole( MODULE* aModule, CPTREE& aTree ) const { - // CPTREE& attrs = aTree.get_child( "" ); + EHOLE e( aTree ); + + // we add a PAD_HOLE_NOT_PLATED pad to this module. + D_PAD* pad = new D_PAD( aModule ); + aModule->m_Pads.PushBack( pad ); + + pad->SetShape( PAD_ROUND ); + pad->SetAttribute( PAD_HOLE_NOT_PLATED ); + + // Mechanical purpose only: + // no offset, no net name, no pad name allowed + // pad->SetOffset( wxPoint( 0, 0 ) ); + // pad->SetPadName( wxEmptyString ); + // pad->SetNetname( wxEmptyString ); + + wxPoint padpos( kicad_x( e.x ), kicad_y( e.y ) ); + + pad->SetPos0( padpos ); + pad->SetPosition( padpos + aModule->GetPosition() ); + + wxSize sz( kicad( e.drill ), kicad( e.drill ) ); + + pad->SetDrillSize( sz ); + pad->SetSize( sz ); + + pad->SetLayerMask( ALL_CU_LAYERS /* | SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT */ ); } @@ -1556,9 +1679,9 @@ void EAGLE_PLUGIN::packageSMD( MODULE* aModule, CPTREE& aTree ) const } } - if( e.erot ) + if( e.rot ) { - pad->SetOrientation( e.erot->degrees * 10 ); + pad->SetOrientation( e.rot->degrees * 10 ); } // don't know what stop, thermals, and cream should look like now. diff --git a/pcbnew/eagle_plugin.h b/pcbnew/eagle_plugin.h index 4d1fa926ec..99805a7081 100644 --- a/pcbnew/eagle_plugin.h +++ b/pcbnew/eagle_plugin.h @@ -117,6 +117,8 @@ public: private: + int m_hole_count; ///< generates unique module names from eagle "hole"s. + NET_MAP m_pads_to_nets; MODULE_MAP m_templates; ///< is part of a MODULE factory that operates From a65c42b7d86b2d955a8dd7096c6ca4aeab894055 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 31 May 2012 19:41:37 +0200 Subject: [PATCH 11/17] Cvpcb: code cleaning and minot fix --- cvpcb/class_DisplayFootprintsFrame.h | 8 +++ cvpcb/setvisu.cpp | 82 +++++++++++++--------------- 2 files changed, 47 insertions(+), 43 deletions(-) diff --git a/cvpcb/class_DisplayFootprintsFrame.h b/cvpcb/class_DisplayFootprintsFrame.h index 1b6c4e456c..37dad4c960 100644 --- a/cvpcb/class_DisplayFootprintsFrame.h +++ b/cvpcb/class_DisplayFootprintsFrame.h @@ -34,6 +34,14 @@ public: void OnUpdateTextDrawMode( wxUpdateUIEvent& aEvent ); void OnUpdateLineDrawMode( wxUpdateUIEvent& aEvent ); + /** + * Function InitDisplay + * Refresh the full display for this frame: + * Set the title, the status line and redraw the canvas + * Must be called after the footprint to display is modifed + */ + void InitDisplay(); + /** * Function IsGridVisible() , virtual * @return true if the grid must be shown diff --git a/cvpcb/setvisu.cpp b/cvpcb/setvisu.cpp index ce069a4a50..6a37058c09 100644 --- a/cvpcb/setvisu.cpp +++ b/cvpcb/setvisu.cpp @@ -30,82 +30,78 @@ */ void CVPCB_MAINFRAME::CreateScreenCmp() { - wxString msg, FootprintName; - bool IsNew = false; - - FootprintName = m_FootprintList->GetSelectedFootprint(); - if( m_DisplayFootprintFrame == NULL ) { m_DisplayFootprintFrame = new DISPLAY_FOOTPRINTS_FRAME( this, _( "Module" ), wxPoint( 0, 0 ), wxSize( 600, 400 ), KICAD_DEFAULT_DRAWFRAME_STYLE ); - IsNew = true; m_DisplayFootprintFrame->Show( true ); } else { - // Raising the window does not show the window on Windows if iconized. - // This should work on any platform. if( m_DisplayFootprintFrame->IsIconized() ) m_DisplayFootprintFrame->Iconize( false ); - m_DisplayFootprintFrame->Raise(); - - // Raising the window does not set the focus on Linux. This should work on any platform. - if( wxWindow::FindFocus() != m_DisplayFootprintFrame ) - m_DisplayFootprintFrame->SetFocus(); } - if( !FootprintName.IsEmpty() ) + m_DisplayFootprintFrame->InitDisplay(); +} + +/* Refresh the full display for this frame: + * Set the title, the status line and redraw the canvas + * Must be called after the footprint to display is modifed + */ +void DISPLAY_FOOTPRINTS_FRAME::InitDisplay() +{ + wxString msg; + CVPCB_MAINFRAME * parentframe = (CVPCB_MAINFRAME *) GetParent(); + wxString footprintName = parentframe->m_FootprintList->GetSelectedFootprint(); + + if( !footprintName.IsEmpty() ) { - msg = _( "Footprint: " ) + FootprintName; - m_DisplayFootprintFrame->SetTitle( msg ); - FOOTPRINT_INFO* Module = m_footprints.GetModuleInfo( FootprintName ); + msg = _( "Footprint: " ) + footprintName; + SetTitle( msg ); + FOOTPRINT_INFO* module_info = parentframe->m_footprints.GetModuleInfo( footprintName ); msg = _( "Lib: " ); - if( Module ) - msg += Module->m_LibName; + if( module_info ) + msg += module_info->m_LibName; else msg += wxT( "???" ); - m_DisplayFootprintFrame->SetStatusText( msg, 0 ); + SetStatusText( msg, 0 ); - if( m_DisplayFootprintFrame->GetBoard()->m_Modules.GetCount() ) + if( GetBoard()->m_Modules.GetCount() ) { // there is only one module in the list - m_DisplayFootprintFrame->GetBoard()->m_Modules.DeleteAll(); + GetBoard()->m_Modules.DeleteAll(); } - MODULE* mod = m_DisplayFootprintFrame->Get_Module( FootprintName ); + MODULE* module = Get_Module( footprintName ); - if( mod ) - m_DisplayFootprintFrame->GetBoard()->m_Modules.PushBack( mod ); + if( module ) + GetBoard()->m_Modules.PushBack( module ); - m_DisplayFootprintFrame->Zoom_Automatique( false ); - m_DisplayFootprintFrame->GetCanvas()->Refresh(); + Zoom_Automatique( false ); - // Display new cursor coordinates and zoom value: - m_DisplayFootprintFrame->UpdateStatusBar(); - - if( m_DisplayFootprintFrame->m_Draw3DFrame ) - m_DisplayFootprintFrame->m_Draw3DFrame->NewDisplay(); } - else if( !IsNew ) // No footprint to display. Erase old footprint, if any + else // No footprint to display. Erase old footprint, if any { - if( m_DisplayFootprintFrame->GetBoard()->m_Modules.GetCount() ) + if( GetBoard()->m_Modules.GetCount() ) { - m_DisplayFootprintFrame->GetBoard()->m_Modules.DeleteAll(); - m_DisplayFootprintFrame->Zoom_Automatique( false ); - m_DisplayFootprintFrame->SetStatusText( wxEmptyString, 0 ); - m_DisplayFootprintFrame->UpdateStatusBar(); + GetBoard()->m_Modules.DeleteAll(); + Zoom_Automatique( false ); + SetStatusText( wxEmptyString, 0 ); } - - m_DisplayFootprintFrame->Refresh(); - - if( m_DisplayFootprintFrame->m_Draw3DFrame ) - m_DisplayFootprintFrame->m_Draw3DFrame->NewDisplay(); } + + // Display new cursor coordinates and zoom value: + UpdateStatusBar(); + + GetCanvas()->Refresh(); + + if( m_Draw3DFrame ) + m_Draw3DFrame->NewDisplay(); } /* From b07caa93c90b8a9905f00f44f3393e47e1c80fd1 Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Fri, 1 Jun 2012 02:39:32 -0500 Subject: [PATCH 12/17] EAGLE_PLUGIN: load layer definitions, zone parameters, text positions. Sketch for BOARD::Move(). Pass page_width and page_height to PLUGIN::Save(). --- pcbnew/class_board.cpp | 6 + pcbnew/class_board.h | 9 +- pcbnew/eagle_plugin.cpp | 386 ++++++++++++++++++++++++++++++---------- pcbnew/eagle_plugin.h | 15 +- pcbnew/files.cpp | 7 +- 5 files changed, 317 insertions(+), 106 deletions(-) diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 3756e8d380..c3a38201a3 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -89,6 +89,12 @@ BOARD::~BOARD() } +void BOARD::Move( const wxPoint& aMoveVector ) // overload +{ + +} + + void BOARD::chainMarkedSegments( wxPoint aPosition, int aLayerMask, TRACK_PTRS* aList ) { TRACK* segment; // The current segment being analyzed. diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index 92e8a7638c..3ea070f1ac 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -3,8 +3,8 @@ * @brief Class BOARD to handle a board. */ -#ifndef CLASS_BOARD_H -#define CLASS_BOARD_H +#ifndef CLASS_BOARD_H_ +#define CLASS_BOARD_H_ #include @@ -255,10 +255,11 @@ public: BOARD(); ~BOARD(); + void Move( const wxPoint& aMoveVector ); // overload + void SetFileFormatVersionAtLoad( int aVersion ) { m_fileFormatVersionAtLoad = aVersion; } int GetFileFormatVersionAtLoad() const { return m_fileFormatVersionAtLoad; } - /** * Function GetDefaultLayerName * returns a default name of a PCB layer when given \a aLayerNumber. This @@ -1327,4 +1328,4 @@ public: TRACK* CreateLockPoint( wxPoint& aPosition, TRACK* aSegment, PICKED_ITEMS_LIST* aList ); }; -#endif // #ifndef CLASS_BOARD_H +#endif // CLASS_BOARD_H_ diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index ea55259079..09e438366d 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -49,13 +49,10 @@ our error message. Load() TODO's *) finish xpath support -*) set layer counts, types and names into BOARD -*) footprint placement on board back -*) eagle "mirroring" does not mean put on board back +*) test footprint placement on board back *) netclass info? -*) code factoring, for polygon at least -*) zone fill clearances -*) package rectangles +*) verify zone fill clearances are correct +*) write BOARD::Move() and reposition to center of page? */ @@ -122,7 +119,10 @@ struct EROT bool mirror; bool spin; double degrees; + + EROT() : mirror( false ), spin( false ), degrees( 0 ) {} }; + typedef boost::optional opt_erot; static EROT erot( const std::string& aRot ) @@ -184,8 +184,8 @@ struct EVIA { double x; double y; - int layer_start; /// < extent - int layer_end; /// < inclusive + int layer_front_most; /// < extent + int layer_back_most; /// < inclusive double drill; opt_double diam; opt_string shape; @@ -214,7 +214,7 @@ EVIA::EVIA( CPTREE& aVia ) std::string ext = attribs.get( "extent" ); - sscanf( ext.c_str(), "%u-%u", &layer_start, &layer_end ); + sscanf( ext.c_str(), "%u-%u", &layer_front_most, &layer_back_most ); drill = attribs.get( "drill" ); diam = attribs.get_optional( "diameter" ); @@ -265,7 +265,7 @@ struct ERECT double x2; double y2; int layer; - opt_erot erot; + opt_erot rot; ERECT( CPTREE& aRect ); }; @@ -286,12 +286,12 @@ ERECT::ERECT( CPTREE& aRect ) > */ - x1 = attribs.get( "x1" ); - y1 = attribs.get( "y1" ); - x2 = attribs.get( "x2" ); - y2 = attribs.get( "y2" ); - layer = attribs.get( "layer" ); - erot = parseOptionalEROT( attribs ); + x1 = attribs.get( "x1" ); + y1 = attribs.get( "y1" ); + x2 = attribs.get( "x2" ); + y2 = attribs.get( "y2" ); + layer = attribs.get( "layer" ); + rot = parseOptionalEROT( attribs ); } @@ -305,7 +305,7 @@ struct EATTR opt_double size; opt_int layer; opt_double ratio; - opt_erot erot; + opt_erot rot; opt_int display; enum { // for 'display' field above @@ -357,7 +357,7 @@ EATTR::EATTR( CPTREE& aAttribute ) layer = attribs.get_optional( "layer" ); ratio = attribs.get_optional( "ratio" ); - erot = parseOptionalEROT( attribs ); + rot = parseOptionalEROT( attribs ); opt_string stemp = attribs.get_optional( "display" ); if( stemp ) @@ -385,7 +385,7 @@ struct ETEXT int layer; opt_string font; opt_double ratio; - opt_erot erot; + opt_erot rot; enum { // for align CENTER, @@ -432,7 +432,7 @@ ETEXT::ETEXT( CPTREE& aText ) font = attribs.get_optional( "font" ); ratio = attribs.get_optional( "ratio" ); - erot = parseOptionalEROT( attribs ); + rot = parseOptionalEROT( attribs ); opt_string stemp = attribs.get_optional( "align" ); if( stemp ) @@ -760,6 +760,42 @@ EELEMENT::EELEMENT( CPTREE& aElement ) } +struct ELAYER +{ + int number; + std::string name; + int color; + int fill; + opt_bool visible; + opt_bool active; + + ELAYER( CPTREE& aLayer ); +}; + +ELAYER::ELAYER( CPTREE& aLayer ) +{ + CPTREE& attribs = aLayer.get_child( "" ); + + /* + + + */ + + number = attribs.get( "number" ); + name = attribs.get( "name" ); + color = attribs.get( "color" ); + visible = parseOptionalBool( attribs, "visible" ); + active = parseOptionalBool( attribs, "active" ); +} + + /// Assemble a two part key as a simple concatonation of aFirst and aSecond parts, /// using a separator. static inline std::string makeKey( const std::string& aFirst, const std::string& aSecond ) @@ -834,10 +870,7 @@ BOARD* EAGLE_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPE read_xml( filename, doc, xml_parser::trim_whitespace | xml_parser::no_comments ); - std::string xpath = "eagle.drawing.board"; - CPTREE& brd = doc.get_child( xpath ); - - loadAllSections( brd, xpath, bool( aAppendToMe ) ); + loadAllSections( doc, bool( aAppendToMe ) ); } // Class ptree_error is a base class for xml_parser_error & file_parser_error, @@ -851,6 +884,23 @@ BOARD* EAGLE_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPE // IO_ERROR exceptions are left uncaught, they pass upwards from here. + /* + if( aProperties ) + { + const wxString& pageWidth = (*aProperties)["page_width"]; + const wxString& pageHeight = (*aProperties)["page_height"]; + + if( pageWidth.size() && pageHeight.size() ) + { + EDA_RECT bbbox = m_board->GetBoundingBox(); + int w = wxAtoi( pageWidth ); + int h = wxAtoi( pageHeight ); + + m_board->Move( ); + } + } + */ + deleter.release(); return m_board; } @@ -870,37 +920,71 @@ void EAGLE_PLUGIN::init( PROPERTIES* aProperties ) } -void EAGLE_PLUGIN::loadAllSections( CPTREE& aEagleBoard, const std::string& aXpath, bool aAppendToMe ) +void EAGLE_PLUGIN::loadAllSections( CPTREE& aDoc, bool aAppendToMe ) { - std::string xpath; + CPTREE& drawing = aDoc.get_child( "eagle.drawing" ); + CPTREE& board = drawing.get_child( "board" ); { - xpath = aXpath + '.' + "plain"; - CPTREE& plain = aEagleBoard.get_child( "plain" ); - loadPlain( plain, xpath ); + CPTREE& layers = drawing.get_child( "layers" ); + loadLayerDefs( layers ); } { - xpath = aXpath + '.' + "signals"; - CPTREE& signals = aEagleBoard.get_child( "signals" ); - loadSignals( signals, xpath ); + CPTREE& plain = board.get_child( "plain" ); + loadPlain( plain ); } { - xpath = aXpath + '.' + "libraries"; - CPTREE& libs = aEagleBoard.get_child( "libraries" ); - loadLibraries( libs, xpath ); + CPTREE& signals = board.get_child( "signals" ); + loadSignals( signals ); } { - xpath = aXpath + '.' + "elements"; - CPTREE& elems = aEagleBoard.get_child( "elements" ); - loadElements( elems, xpath ); + CPTREE& libs = board.get_child( "libraries" ); + loadLibraries( libs ); + } + + { + CPTREE& elems = board.get_child( "elements" ); + loadElements( elems ); } } -void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics, const std::string& aXpath ) +void EAGLE_PLUGIN::loadLayerDefs( CPTREE& aLayers ) +{ + typedef std::vector ELAYERS; + typedef ELAYERS::const_iterator EITER; + + ELAYERS cu; // copper layers + + // find the subset of layers that are copper, and active + for( CITER layer = aLayers.begin(); layer != aLayers.end(); ++layer ) + { + ELAYER elayer( layer->second ); + + if( elayer.number >= 1 && elayer.number <= 16 && ( !elayer.active || *elayer.active ) ) + { + cu.push_back( elayer ); + } + } + + m_board->SetCopperLayerCount( cu.size() ); + + for( EITER it = cu.begin(); it != cu.end(); ++it ) + { + int layer = kicad_layer( it->number ); + + m_board->SetLayerName( layer, FROM_UTF8( it->name.c_str() ) ); + m_board->SetLayerType( layer, LT_SIGNAL ); + + // could map the colors here + } +} + + +void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics ) { // (polygon | wire | text | circle | rectangle | frame | hole)* for( CITER gr = aGraphics.begin(); gr != aGraphics.end(); ++gr ) @@ -932,38 +1016,46 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics, const std::string& aXpath ) ETEXT t( gr->second ); int layer = kicad_layer( t.layer ); - double ratio = 6; int sign = 1; TEXTE_PCB* pcbtxt = new TEXTE_PCB( m_board ); m_board->Add( pcbtxt, ADD_APPEND ); + pcbtxt->SetLayer( layer ); pcbtxt->SetTimeStamp( timeStamp( gr->second ) ); pcbtxt->SetText( FROM_UTF8( t.text.c_str() ) ); pcbtxt->SetPosition( wxPoint( kicad_x( t.x ), kicad_y( t.y ) ) ); - pcbtxt->SetLayer( layer ); pcbtxt->SetSize( kicad_fontz( t.size ) ); - if( t.ratio ) - ratio = *t.ratio; + double ratio = t.ratio ? *t.ratio : 8; // DTD says 8 is default pcbtxt->SetThickness( kicad( t.size * ratio / 100 ) ); - if( t.erot ) + if( t.rot ) { // eagles does not rotate text spun to 180 degrees unless spin is set. - if( t.erot->spin || t.erot->degrees != 180 ) - pcbtxt->SetOrientation( t.erot->degrees * 10 ); +#if 0 + if( t.rot->spin || ( t.rot->degrees != 180 && t.rot->degrees != 270 ) ) + pcbtxt->SetOrientation( t.rot->degrees * 10 ); + + else + // flip the justification to opposite + sign = -1; +#else + // eagles does not rotate text spun to 180 degrees unless spin is set. + if( t.rot->spin || t.rot->degrees != 180 ) + pcbtxt->SetOrientation( t.rot->degrees * 10 ); else // flip the justification to opposite sign = -1; - if( t.erot->degrees == 270 ) + if( t.rot->degrees == 270 ) sign = -1; +#endif + pcbtxt->SetMirrored( t.rot->mirror ); - pcbtxt->SetMirrored( t.erot->mirror ); } int align = t.align ? *t.align : ETEXT::BOTTOM_LEFT; @@ -1111,7 +1203,7 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics, const std::string& aXpath ) } -void EAGLE_PLUGIN::loadLibraries( CPTREE& aLibs, const std::string& aXpath ) +void EAGLE_PLUGIN::loadLibraries( CPTREE& aLibs ) { for( CITER library = aLibs.begin(); library != aLibs.end(); ++library ) { @@ -1160,7 +1252,7 @@ void EAGLE_PLUGIN::loadLibraries( CPTREE& aLibs, const std::string& aXpath ) } -void EAGLE_PLUGIN::loadElements( CPTREE& aElements, const std::string& aXpath ) +void EAGLE_PLUGIN::loadElements( CPTREE& aElements ) { for( CITER it = aElements.begin(); it != aElements.end(); ++it ) { @@ -1169,8 +1261,8 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements, const std::string& aXpath ) EELEMENT e( it->second ); -#if 0 && defined(DEBUG) - if( !e.name.compare( "GROUND" ) ) +#if 1 && defined(DEBUG) + if( !e.value.compare( "LP2985-33DBVR" ) ) { int breakhere = 1; (void) breakhere; @@ -1232,7 +1324,10 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements, const std::string& aXpath ) // VALUE and NAME can have something like our text "effects" overrides // in SWEET and new schematic. Eagle calls these XML elements "attribute". - // There can be one for NAME and/or VALUE both. + // There can be one for NAME and/or VALUE both. Features present in the + // EATTR override the ones established in the package only if they are + // present here. So the logic is a bit different than in packageText() + // and in plain text. for( CITER ait = it->second.begin(); ait != it->second.end(); ++ait ) { if( ait->first.compare( "attribute" ) ) @@ -1266,37 +1361,49 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements, const std::string& aXpath ) txt->SetPos0( pos0 ); } - double ratio = 6; - if( a.ratio ) - ratio = *a.ratio; + // Even though size and ratio are both optional, I am not seeing + // a case where ratio is present but size is not. if( a.size ) { wxSize fontz = kicad_fontz( *a.size ); txt->SetSize( fontz ); - int lw = int( fontz.y * ratio / 100.0 ); - txt->SetThickness( lw ); + if( a.ratio ) + { + double ratio = *a.ratio; + int lw = int( fontz.y * ratio / 100.0 ); + txt->SetThickness( lw ); + } } - double angle = 0; - if( a.erot ) - angle = a.erot->degrees * 10; + // The "rot" in a EATTR seems to be assumed to be zero if it is not + // present, and this becomes an override to the package's text field + EROT rot; - if( angle != 1800 ) + if( a.rot ) + rot = *a.rot; + + if( rot.spin || (rot.degrees != 180 && rot.degrees != 270) ) { + double angle = rot.degrees * 10; angle -= m->GetOrientation(); // subtract module's angle txt->SetOrientation( angle ); } + else { + // ETEXT::TOP_RIGHT: txt->SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT ); txt->SetVertJustify( GR_TEXT_VJUSTIFY_TOP ); } + + txt->SetMirrored( rot.mirror ); } } } + MODULE* EAGLE_PLUGIN::makeModule( CPTREE& aPackage, const std::string& aPkgName ) const { std::auto_ptr m( new MODULE( NULL ) ); @@ -1357,12 +1464,6 @@ void EAGLE_PLUGIN::packageWire( MODULE* aModule, CPTREE& aTree ) const dwg->SetStart0( start ); dwg->SetEnd0( end ); - switch( layer ) - { - case ECO1_N: layer = SILKSCREEN_N_FRONT; break; - case ECO2_N: layer = SILKSCREEN_N_BACK; break; - } - dwg->SetLayer( layer ); dwg->SetWidth( width ); } @@ -1490,34 +1591,36 @@ void EAGLE_PLUGIN::packageText( MODULE* aModule, CPTREE& aTree ) const txt->SetPosition( pos ); txt->SetPos0( pos - aModule->GetPosition() ); + /* switch( layer ) { - case ECO1_N: layer = SILKSCREEN_N_FRONT; break; - case ECO2_N: layer = SILKSCREEN_N_BACK; break; + case COMMENT_N: layer = SILKSCREEN_N_FRONT; break; } + */ txt->SetLayer( layer ); txt->SetSize( kicad_fontz( t.size ) ); - double ratio = 6; - if( t.ratio ) - ratio = *t.ratio; + double ratio = t.ratio ? *t.ratio : 8; // DTD says 8 is default txt->SetThickness( kicad( t.size * ratio / 100 ) ); + double angle = t.rot ? t.rot->degrees * 10 : 0; + + // An eagle package is never rotated, the DTD does not allow it. + // angle -= aModule->GetOrienation(); + int sign = 1; - if( t.erot ) + if( t.rot ) { - if( t.erot->spin || t.erot->degrees != 180 ) - txt->SetOrientation( t.erot->degrees * 10 ); + if( t.rot->spin || (angle != 1800 && angle != 2700) ) + txt->SetOrientation( angle ); - else // 180 degrees, reverse justification below, don't spin - { + else // 180 or 270 degrees, reverse justification below, don't spin sign = -1; - } - txt->SetMirrored( t.erot->mirror ); + txt->SetMirrored( t.rot->mirror ); } int align = t.align ? *t.align : ETEXT::BOTTOM_LEFT; // bottom-left is eagle default @@ -1569,13 +1672,83 @@ void EAGLE_PLUGIN::packageText( MODULE* aModule, CPTREE& aTree ) const void EAGLE_PLUGIN::packageRectangle( MODULE* aModule, CPTREE& aTree ) const { - // ERECT r( aTree ); + ERECT r( aTree ); + int layer = kicad_layer( r.layer ); + + if( IsValidNonCopperLayerIndex( layer ) ) // skip copper "package.rectangle"s + { + EDGE_MODULE* dwg = new EDGE_MODULE( aModule, S_POLYGON ); + aModule->m_Drawings.PushBack( dwg ); + + dwg->SetLayer( layer ); + dwg->SetWidth( 0 ); + + dwg->SetTimeStamp( timeStamp( aTree ) ); + + std::vector pts; + + wxPoint start( wxPoint( kicad_x( r.x1 ), kicad_y( r.y1 ) ) ); + wxPoint end( wxPoint( kicad_x( r.x1 ), kicad_y( r.y2 ) ) ); + + pts.push_back( start ); + pts.push_back( wxPoint( kicad_x( r.x2 ), kicad_y( r.y1 ) ) ); + pts.push_back( wxPoint( kicad_x( r.x2 ), kicad_y( r.y2 ) ) ); + pts.push_back( end ); + + dwg->SetPolyPoints( pts ); + + dwg->SetStart0( start ); + dwg->SetEnd0( end ); + } } void EAGLE_PLUGIN::packagePolygon( MODULE* aModule, CPTREE& aTree ) const { - // EPOLYGON p( aTree ); + EPOLYGON p( aTree ); + int layer = kicad_layer( p.layer ); + + if( IsValidNonCopperLayerIndex( layer ) ) // skip copper "package.rectangle"s + { + EDGE_MODULE* dwg = new EDGE_MODULE( aModule, S_POLYGON ); + aModule->m_Drawings.PushBack( dwg ); + + dwg->SetWidth( 0 ); // it's filled, no need for boundary width + + /* + switch( layer ) + { + case ECO1_N: layer = SILKSCREEN_N_FRONT; break; + case ECO2_N: layer = SILKSCREEN_N_BACK; break; + + // all MODULE templates (created from eagle packages) are on front layer + // until cloned. + case COMMENT_N: layer = SILKSCREEN_N_FRONT; break; + } + */ + + dwg->SetLayer( layer ); + + dwg->SetTimeStamp( timeStamp( aTree ) ); + + std::vector pts; + pts.reserve( aTree.size() ); + + for( CITER vi = aTree.begin(); vi != aTree.end(); ++vi ) + { + if( vi->first.compare( "vertex" ) ) // skip node + continue; + + EVERTEX v( vi->second ); + + pts.push_back( wxPoint( kicad_x( v.x ), kicad_y( v.y ) ) ); + } + + dwg->SetPolyPoints( pts ); + + dwg->SetStart0( *pts.begin() ); + dwg->SetEnd0( pts.back() ); + } } @@ -1589,11 +1762,13 @@ void EAGLE_PLUGIN::packageCircle( MODULE* aModule, CPTREE& aTree ) const gr->SetWidth( kicad( e.width ) ); + /* switch( layer ) { case ECO1_N: layer = SILKSCREEN_N_FRONT; break; case ECO2_N: layer = SILKSCREEN_N_BACK; break; } + */ gr->SetLayer( layer ); gr->SetTimeStamp( timeStamp( aTree ) ); @@ -1688,7 +1863,7 @@ void EAGLE_PLUGIN::packageSMD( MODULE* aModule, CPTREE& aTree ) const } -void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals, const std::string& aXpath ) +void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals ) { int netCode = 1; @@ -1732,17 +1907,17 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals, const std::string& aXpath ) { EVIA v( it->second ); - int layer_start = kicad_layer( v.layer_start ); - int layer_end = kicad_layer( v.layer_end ); + int layer_front_most = kicad_layer( v.layer_front_most ); + int layer_back_most = kicad_layer( v.layer_back_most ); - if( IsValidCopperLayerIndex( layer_start ) && - IsValidCopperLayerIndex( layer_end ) ) + if( IsValidCopperLayerIndex( layer_front_most ) && + IsValidCopperLayerIndex( layer_back_most ) ) { int drillz = kicad( v.drill ); SEGVIA* via = new SEGVIA( m_board ); m_board->m_Track.Insert( via, NULL ); - via->SetLayerPair( layer_start, layer_end ); + via->SetLayerPair( layer_front_most, layer_back_most ); // via diameters are externally controllable, not usually in a board: // http://www.eaglecentral.ca/forums/index.php/mv/msg/34704/119478/ @@ -1759,6 +1934,13 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals, const std::string& aXpath ) via->SetDrill( drillz ); + if( layer_front_most == LAYER_N_FRONT && layer_back_most == LAYER_N_BACK ) + via->SetShape( VIA_THROUGH ); + else if( layer_front_most == LAYER_N_FRONT || layer_back_most == LAYER_N_BACK ) + via->SetShape( VIA_MICROVIA ); + else + via->SetShape( VIA_BLIND_BURIED ); + via->SetTimeStamp( timeStamp( it->second ) ); wxPoint pos( kicad_x( v.x ), kicad_y( v.y ) ); @@ -1803,8 +1985,6 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals, const std::string& aXpath ) zone->SetNet( netCode ); zone->SetNetName( netName ); - - int outline_hatch = CPolyLine::DIAGONAL_EDGE; bool first = true; @@ -1829,6 +2009,23 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals, const std::string& aXpath ) zone->m_Poly->SetHatch( outline_hatch, Mils2iu( zone->m_Poly->GetDefaultHatchPitchMils() ) ); + + // clearances, etc. + zone->SetArcSegCount( 32 ); // @todo: should be a constructor default? + zone->SetMinThickness( kicad( p.width ) ); + + if( p.spacing ) + zone->SetZoneClearance( kicad( *p.spacing ) ); + + if( p.rank ) + zone->SetPriority( *p.rank ); + + // missing == yes per DTD. + bool thermals = !p.thermals || *p.thermals; + zone->SetPadConnection( thermals ? THERMAL_PAD : PAD_IN_ZONE ); + + int rank = p.rank ? *p.rank : 0; + zone->SetPriority( rank ); } } } @@ -1956,8 +2153,13 @@ int EAGLE_PLUGIN::kicad_layer( int aEagleLayer ) case 36: kiLayer = ADHESIVE_N_BACK; break; case 49: kiLayer = COMMENT_N; break; case 50: kiLayer = COMMENT_N; break; - case 51: kiLayer = ECO1_N; break; - case 52: kiLayer = ECO2_N; break; + + // Packages show the future chip pins on SMD parts using layer 51. + // This is an area slightly smaller than the PAD/SMD copper area. + // Carry those visual aids into the MODULE on the drawing layer, not silkscreen. + case 51: kiLayer = DRAW_N; break; + case 52: kiLayer = DRAW_N; break; + case 95: kiLayer = ECO1_N; break; case 96: kiLayer = ECO2_N; break; default: diff --git a/pcbnew/eagle_plugin.h b/pcbnew/eagle_plugin.h index 99805a7081..fb12685d6c 100644 --- a/pcbnew/eagle_plugin.h +++ b/pcbnew/eagle_plugin.h @@ -174,15 +174,12 @@ private: // all these loadXXX() throw IO_ERROR or ptree_error exceptions: - void loadAllSections( CPTREE& aEagleBoard, const std::string& aXpath, bool aAppendToMe ); - - void loadPlain( CPTREE& aPlain, const std::string& aXpath ); - - void loadSignals( CPTREE& aSignals, const std::string& aXpath ); - - void loadLibraries( CPTREE& aLibs, const std::string& aXpath ); - - void loadElements( CPTREE& aElements, const std::string& aXpath ); + void loadAllSections( CPTREE& aDocument, bool aAppendToMe ); + void loadLayerDefs( CPTREE& aLayers ); + void loadPlain( CPTREE& aPlain ); + void loadSignals( CPTREE& aSignals ); + void loadLibraries( CPTREE& aLibs ); + void loadElements( CPTREE& aElements ); /** * Function fmtDEG diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index 3eecab336d..6d5d6bd4b8 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -250,8 +250,13 @@ the changes?" ) ) ) try { + PROPERTIES props; + + props["page_width"] = wxString::Format( wxT( "%d" ), GetPageSizeIU().x ); + props["page_height"] = wxString::Format( wxT( "%d" ), GetPageSizeIU().y ); + // load or append either: - loadedBoard = pi->Load( GetScreen()->GetFileName(), aAppend ? GetBoard() : NULL, NULL ); + loadedBoard = pi->Load( GetScreen()->GetFileName(), aAppend ? GetBoard() : NULL, &props ); if( !aAppend ) { From 91e8aca0a9ad68ca368b4c9db763abe3445324c5 Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Sat, 2 Jun 2012 12:07:30 -0500 Subject: [PATCH 13/17] EAGLE_PLUGIN: finish xpath error reporting mechanism for XML document traversal --- pcbnew/eagle_plugin.cpp | 383 ++++++++++++++++++++++++++++++---------- pcbnew/eagle_plugin.h | 56 +++--- 2 files changed, 316 insertions(+), 123 deletions(-) diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index 09e438366d..ace1997afd 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -48,11 +48,10 @@ our error message. Load() TODO's -*) finish xpath support *) test footprint placement on board back *) netclass info? *) verify zone fill clearances are correct -*) write BOARD::Move() and reposition to center of page? +*) write BOARD::Move() and reposition to center of page from centerBoard() */ @@ -78,6 +77,88 @@ Load() TODO's using namespace boost::property_tree; +/// segment (element) of our XPATH into the Eagle XML document tree in PTREE form. +struct TRIPLET +{ + const char* element; + const char* attribute; + const char* value; + + TRIPLET( const char* aElement, const char* aAttribute = "", const char* aValue = "" ) : + element( aElement ), + attribute( aAttribute ), + value( aValue ) + {} +}; + + +/** + * Class XPATH + * keeps track of what we are working on within a PTREE. + * Then if an exception is thrown, the place within the tree that gave us + * grief can be reported almost accurately. To minimally impact + * speed, merely assign const char* pointers during the tree walking + * expedition. The const char* pointers must be to C strings residing either in + * the data or code segment (i.e. "compiled in") or within the XML document, but + * not on the stack, since the stack is unwound during the throwing of the + * exception. The XML document will not immediately vanish since we capture + * the xpath (using function Contents()) before the XML document tree (PTREE) + * is destroyed. + */ +class XPATH +{ + std::vector p; + +public: + void push( const char* aPathSegment, const char* aAttribute="" ) + { + p.push_back( TRIPLET( aPathSegment, aAttribute ) ); + } + + void clear() { p.clear(); } + + void pop() { p.pop_back(); } + + /// modify the last path node's value + void Value( const char* aValue ) + { + p.back().value = aValue; + } + + /// modify the last path node's attribute + void Attribute( const char* aAttribute ) + { + p.back().attribute = aAttribute; + } + + /// return the contents of the XPATH as a single string + std::string Contents() + { + typedef std::vector::const_iterator CITER; + + std::string ret; + + for( CITER it = p.begin(); it != p.end(); ++it ) + { + if( it != p.begin() ) + ret += '.'; + + ret += it->element; + + if( it->attribute[0] && it->value[0] ) + { + ret += '['; + ret += it->attribute; + ret += '='; + ret += it->value; + ret += ']'; + } + } + + return ret; + } +}; + typedef EAGLE_PLUGIN::BIU BIU; typedef PTREE::const_assoc_iterator CA_ITER; @@ -91,9 +172,13 @@ typedef boost::optional opt_string; typedef boost::optional opt_int; typedef boost::optional opt_double; typedef boost::optional opt_bool; -//typedef boost::optional opt_cptree; +/** + * Function parseOptionalBool + * returns an opt_bool and sets it true or false according to the presence + * and value of an attribute within the CPTREE element. + */ static opt_bool parseOptionalBool( CPTREE& attribs, const char* aName ) { opt_bool ret; @@ -125,6 +210,8 @@ struct EROT typedef boost::optional opt_erot; +/// parse an Eagle XML "rot" field. Unfortunately the DTD seems not to explain +/// this format very well. R[S][M]. Examples: "R90", "MR180", "SR180" static EROT erot( const std::string& aRot ) { EROT rot; @@ -136,10 +223,10 @@ static EROT erot( const std::string& aRot ) + int( rot.spin ) // skip optional leading 'S' + int( rot.mirror ), // skip optional leading 'M' NULL ); - return rot; } +/// Eagle "rot" fields are optional, handle that by returning opt_erot. static opt_erot parseOptionalEROT( CPTREE& attribs ) { opt_erot ret; @@ -164,18 +251,36 @@ struct EWIRE /** * Constructor EWIRE * converts a 's xml attributes to binary without additional conversion. - * @param aResult is an EWIRE to fill in with the data converted to binary. + * This result is an EWIRE with the textual data merely converted to binary. */ EWIRE::EWIRE( CPTREE& aWire ) { CPTREE& attribs = aWire.get_child( "" ); + /* + + + */ + x1 = attribs.get( "x1" ); y1 = attribs.get( "y1" ); x2 = attribs.get( "x2" ); y2 = attribs.get( "y2" ); width = attribs.get( "width" ); layer = attribs.get( "layer" ); + + // ignoring extent, style, curve and cap } @@ -331,18 +436,18 @@ EATTR::EATTR( CPTREE& aAttribute ) /* or context -- - constant %Bool; "no" -- only in context -- - > + name %String; #REQUIRED + value %String; #IMPLIED + x %Coord; #IMPLIED + y %Coord; #IMPLIED + size %Dimension; #IMPLIED + layer %Layer; #IMPLIED + font %TextFont; #IMPLIED + ratio %Int; #IMPLIED + rot %Rotation; "R0" + display %AttributeDisplay; "value" -- only in or context -- + constant %Bool; "no" -- only in context -- + > */ name = attribs.get( "name" ); // #REQUIRED @@ -478,11 +583,8 @@ struct EPAD LONG, OFFSET, }; - opt_int shape; - opt_erot rot; - opt_bool stop; opt_bool thermals; opt_bool first; @@ -579,7 +681,7 @@ ESMD::ESMD( CPTREE& aSMD ) > */ - // the DTD says these must be present, throw exception if not found + // DTD #REQUIRED, throw exception if not found name = attribs.get( "name" ); x = attribs.get( "x" ); y = attribs.get( "y" ); @@ -622,7 +724,7 @@ EVERTEX::EVERTEX( CPTREE& aVertex ) } -// Eagle polygon, without vertices which are parsed as needed +/// Eagle polygon, without vertices which are parsed as needed struct EPOLYGON { double width; @@ -634,7 +736,6 @@ struct EPOLYGON HATCH, CUTOUT, }; - opt_int pour; opt_double isolate; opt_bool orphans; @@ -682,6 +783,7 @@ EPOLYGON::EPOLYGON( CPTREE& aPolygon ) rank = attribs.get_optional( "rank" ); } +/// Eagle hole element struct EHOLE { double x; @@ -710,6 +812,8 @@ EHOLE::EHOLE( CPTREE& aHole ) drill = attribs.get( "drill" ); } + +/// Eagle element element struct EELEMENT { std::string name; @@ -805,14 +909,16 @@ static inline std::string makeKey( const std::string& aFirst, const std::string& } -/// Make a unique time stamp, in this case from a unique tree memory location +/// Make a unique time stamp static inline unsigned long timeStamp( CPTREE& aTree ) { + // in this case from a unique tree memory location return (unsigned long)(void*) &aTree; } -EAGLE_PLUGIN::EAGLE_PLUGIN() +EAGLE_PLUGIN::EAGLE_PLUGIN() : + m_xpath( new XPATH() ) { init( NULL ); } @@ -820,6 +926,7 @@ EAGLE_PLUGIN::EAGLE_PLUGIN() EAGLE_PLUGIN::~EAGLE_PLUGIN() { + delete m_xpath; } @@ -865,41 +972,41 @@ BOARD* EAGLE_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPE try { - // 8 bit filename should be encoded in current locale, not necessarily utf8. + // 8 bit "filename" should be encoded according to disk filename encoding, + // (maybe this is current locale, maybe not, its a filesystem issue), + // and is not necessarily utf8. std::string filename = (const char*) aFileName.fn_str(); read_xml( filename, doc, xml_parser::trim_whitespace | xml_parser::no_comments ); - loadAllSections( doc, bool( aAppendToMe ) ); + loadAllSections( doc ); + + // should be empty, else missing m_xpath->pop() + wxASSERT( m_xpath->Contents().size() == 0 ); + } + + catch( file_parser_error fpe ) + { + // for xml_parser_error, what() has the line number in it, + // but no byte offset. That should be an adequate error message. + THROW_IO_ERROR( fpe.what() ); } // Class ptree_error is a base class for xml_parser_error & file_parser_error, // so one catch should be OK for all errors. catch( ptree_error pte ) { - // for xml_parser_error, what() has the line number in it, - // but no byte offset. That should be an adequate error message. - THROW_IO_ERROR( pte.what() ); + std::string errmsg = pte.what(); + + errmsg += " @\n"; + errmsg += m_xpath->Contents(); + + THROW_IO_ERROR( errmsg ); } // IO_ERROR exceptions are left uncaught, they pass upwards from here. - /* - if( aProperties ) - { - const wxString& pageWidth = (*aProperties)["page_width"]; - const wxString& pageHeight = (*aProperties)["page_height"]; - - if( pageWidth.size() && pageHeight.size() ) - { - EDA_RECT bbbox = m_board->GetBoundingBox(); - int w = wxAtoi( pageWidth ); - int h = wxAtoi( pageHeight ); - - m_board->Move( ); - } - } - */ + centerBoard(); deleter.release(); return m_board; @@ -909,6 +1016,8 @@ BOARD* EAGLE_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPE void EAGLE_PLUGIN::init( PROPERTIES* aProperties ) { m_hole_count = 0; + + m_xpath->clear(); m_pads_to_nets.clear(); m_templates.clear(); @@ -920,10 +1029,10 @@ void EAGLE_PLUGIN::init( PROPERTIES* aProperties ) } -void EAGLE_PLUGIN::loadAllSections( CPTREE& aDoc, bool aAppendToMe ) +void EAGLE_PLUGIN::loadAllSections( CPTREE& aDoc ) { CPTREE& drawing = aDoc.get_child( "eagle.drawing" ); - CPTREE& board = drawing.get_child( "board" ); + m_xpath->push( "eagle.drawing" ); { CPTREE& layers = drawing.get_child( "layers" ); @@ -931,29 +1040,32 @@ void EAGLE_PLUGIN::loadAllSections( CPTREE& aDoc, bool aAppendToMe ) } { + CPTREE& board = drawing.get_child( "board" ); + m_xpath->push( "board" ); + CPTREE& plain = board.get_child( "plain" ); loadPlain( plain ); - } - { CPTREE& signals = board.get_child( "signals" ); loadSignals( signals ); - } - { CPTREE& libs = board.get_child( "libraries" ); loadLibraries( libs ); - } - { CPTREE& elems = board.get_child( "elements" ); loadElements( elems ); + + m_xpath->pop(); // "board" } + + m_xpath->pop(); // "eagle.drawing" } void EAGLE_PLUGIN::loadLayerDefs( CPTREE& aLayers ) { + m_xpath->push( "layers.layer" ); + typedef std::vector ELAYERS; typedef ELAYERS::const_iterator EITER; @@ -981,16 +1093,21 @@ void EAGLE_PLUGIN::loadLayerDefs( CPTREE& aLayers ) // could map the colors here } + + m_xpath->pop(); } void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics ) { + m_xpath->push( "plain" ); + // (polygon | wire | text | circle | rectangle | frame | hole)* for( CITER gr = aGraphics.begin(); gr != aGraphics.end(); ++gr ) { if( !gr->first.compare( "wire" ) ) { + m_xpath->push( "wire" ); EWIRE w( gr->second ); DRAWSEGMENT* dseg = new DRAWSEGMENT( m_board ); @@ -1001,6 +1118,7 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics ) dseg->SetStart( wxPoint( kicad_x( w.x1 ), kicad_y( w.y1 ) ) ); dseg->SetEnd( wxPoint( kicad_x( w.x2 ), kicad_y( w.y2 ) ) ); dseg->SetWidth( kicad( w.width ) ); + m_xpath->pop(); } else if( !gr->first.compare( "text" ) ) @@ -1012,7 +1130,7 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics ) (void) breakhere; } #endif - + m_xpath->push( "text" ); ETEXT t( gr->second ); int layer = kicad_layer( t.layer ); @@ -1034,7 +1152,6 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics ) if( t.rot ) { - // eagles does not rotate text spun to 180 degrees unless spin is set. #if 0 if( t.rot->spin || ( t.rot->degrees != 180 && t.rot->degrees != 270 ) ) pcbtxt->SetOrientation( t.rot->degrees * 10 ); @@ -1102,10 +1219,12 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics ) pcbtxt->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM ); break; } + m_xpath->pop(); } else if( !gr->first.compare( "circle" ) ) { + m_xpath->push( "circle" ); ECIRCLE c( gr->second ); DRAWSEGMENT* dseg = new DRAWSEGMENT( m_board ); @@ -1117,12 +1236,14 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics ) dseg->SetStart( wxPoint( kicad_x( c.x ), kicad_y( c.y ) ) ); dseg->SetEnd( wxPoint( kicad_x( c.x + c.radius ), kicad_y( c.y ) ) ); dseg->SetWidth( kicad( c.width ) ); + m_xpath->pop(); } // This seems to be a simplified rectangular [copper] zone, cannot find any // net related info on it from the DTD. else if( !gr->first.compare( "rectangle" ) ) { + m_xpath->push( "rectangle" ); ERECT r( gr->second ); int layer = kicad_layer( r.layer ); @@ -1148,10 +1269,12 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics ) zone->m_Poly->SetHatch( outline_hatch, Mils2iu( zone->m_Poly->GetDefaultHatchPitchMils() ) ); } + m_xpath->pop(); } else if( !gr->first.compare( "hole" ) ) { + m_xpath->push( "hole" ); EHOLE e( gr->second ); // Fabricate a MODULE with a single PAD_HOLE_NOT_PLATED pad. @@ -1189,6 +1312,7 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics ) pad->SetSize( sz ); pad->SetLayerMask( ALL_CU_LAYERS /* | SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT */ ); + m_xpath->pop(); } else if( !gr->first.compare( "frame" ) ) @@ -1197,63 +1321,83 @@ void EAGLE_PLUGIN::loadPlain( CPTREE& aGraphics ) } else if( !gr->first.compare( "polygon" ) ) { - // step up, be a man + // could be on a copper layer, could be on another layer. + // copper layer would be done using netCode=0 type of ZONE_CONTAINER. } } + m_xpath->pop(); } void EAGLE_PLUGIN::loadLibraries( CPTREE& aLibs ) { + m_xpath->push( "libraries.library", "name" ); + for( CITER library = aLibs.begin(); library != aLibs.end(); ++library ) { const std::string& lib_name = library->second.get( ".name" ); - // library will have node, skip that and get the packages node - CPTREE& packages = library->second.get_child( "packages" ); + m_xpath->Value( lib_name.c_str() ); - // Create a MODULE for all the eagle packages, for use later via a copy constructor - // to instantiate needed MODULES in our BOARD. Save the MODULE templates in - // a MODULE_MAP using a single lookup key consisting of libname+pkgname. - - for( CITER package = packages.begin(); package != packages.end(); ++package ) { - const std::string& pack_name = package->second.get( ".name" ); + m_xpath->push( "packages" ); -#if defined(DEBUG) - if( !pack_name.compare( "TO220H" ) ) + // library will have node, skip that and get the single packages node + CPTREE& packages = library->second.get_child( "packages" ); + + // Create a MODULE for all the eagle packages, for use later via a copy constructor + // to instantiate needed MODULES in our BOARD. Save the MODULE templates in + // a MODULE_MAP using a single lookup key consisting of libname+pkgname. + + for( CITER package = packages.begin(); package != packages.end(); ++package ) { - int breakhere = 1; - (void) breakhere; + m_xpath->push( "package", "name" ); + const std::string& pack_name = package->second.get( ".name" ); + + #if defined(DEBUG) + if( !pack_name.compare( "TO220H" ) ) + { + int breakhere = 1; + (void) breakhere; + } + #endif + m_xpath->Value( pack_name.c_str() ); + + std::string key = makeKey( lib_name, pack_name ); + + MODULE* m = makeModule( package->second, pack_name ); + + // add the templating MODULE to the MODULE template factory "m_templates" + std::pair r = m_templates.insert( key, m ); + + if( !r.second ) + { + wxString lib = FROM_UTF8( lib_name.c_str() ); + wxString pkg = FROM_UTF8( pack_name.c_str() ); + + wxString emsg = wxString::Format( + _( " name:'%s' duplicated in eagle :'%s'" ), + GetChars( pkg ), + GetChars( lib ) + ); + THROW_IO_ERROR( emsg ); + } + + m_xpath->pop(); } -#endif - std::string key = makeKey( lib_name, pack_name ); - - MODULE* m = makeModule( package->second, pack_name ); - - // add the templating MODULE to the MODULE template factory "m_templates" - std::pair r = m_templates.insert( key, m ); - - if( !r.second ) - { - wxString lib = FROM_UTF8( lib_name.c_str() ); - wxString pkg = FROM_UTF8( pack_name.c_str() ); - - wxString emsg = wxString::Format( - _( " name:'%s' duplicated in eagle :'%s'" ), - GetChars( pkg ), - GetChars( lib ) - ); - THROW_IO_ERROR( emsg ); - } + m_xpath->pop(); // "packages" } } + + m_xpath->pop(); } void EAGLE_PLUGIN::loadElements( CPTREE& aElements ) { + m_xpath->push( "elements.element", "name" ); + for( CITER it = aElements.begin(); it != aElements.end(); ++it ) { if( it->first.compare( "element" ) ) @@ -1261,6 +1405,8 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements ) EELEMENT e( it->second ); + m_xpath->Value( e.name.c_str() ); + #if 1 && defined(DEBUG) if( !e.value.compare( "LP2985-33DBVR" ) ) { @@ -1322,12 +1468,14 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements ) } } + m_xpath->push( "attribute", "name" ); + // VALUE and NAME can have something like our text "effects" overrides // in SWEET and new schematic. Eagle calls these XML elements "attribute". // There can be one for NAME and/or VALUE both. Features present in the // EATTR override the ones established in the package only if they are - // present here. So the logic is a bit different than in packageText() - // and in plain text. + // present here (except for rot, which if not present means angle zero). + // So the logic is a bit different than in packageText() and in plain text. for( CITER ait = it->second.begin(); ait != it->second.end(); ++ait ) { if( ait->first.compare( "attribute" ) ) @@ -1347,6 +1495,8 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements ) continue; } + m_xpath->Value( a.name.c_str() ); + if( a.value ) { txt->SetText( FROM_UTF8( a.value->c_str() ) ); @@ -1378,7 +1528,9 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements ) } // The "rot" in a EATTR seems to be assumed to be zero if it is not - // present, and this becomes an override to the package's text field + // present, and this zero rotation becomes an override to the + // package's text field. If they did not want zero, they specify + // what they want explicitly. EROT rot; if( a.rot ) @@ -1390,7 +1542,6 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements ) angle -= m->GetOrientation(); // subtract module's angle txt->SetOrientation( angle ); } - else { // ETEXT::TOP_RIGHT: @@ -1400,7 +1551,11 @@ void EAGLE_PLUGIN::loadElements( CPTREE& aElements ) txt->SetMirrored( rot.mirror ); } + + m_xpath->pop(); // "attribute" } + + m_xpath->pop(); // "elements.element" } @@ -1865,6 +2020,8 @@ void EAGLE_PLUGIN::packageSMD( MODULE* aModule, CPTREE& aTree ) const void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals ) { + m_xpath->push( "signals.signal", "name" ); + int netCode = 1; for( CITER net = aSignals.begin(); net != aSignals.end(); ++net, ++netCode ) @@ -1872,6 +2029,8 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals ) const std::string& nname = net->second.get( ".name" ); wxString netName = FROM_UTF8( nname.c_str() ); + m_xpath->Value( nname.c_str() ); + m_board->AppendNet( new NETINFO_ITEM( m_board, netName, netCode ) ); // (contactref | polygon | wire | via)* @@ -1879,6 +2038,7 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals ) { if( !it->first.compare( "wire" ) ) { + m_xpath->push( "wire" ); EWIRE w( it->second ); int layer = kicad_layer( w.layer ); @@ -1901,10 +2061,13 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals ) { // put non copper wires where the sun don't shine. } + + m_xpath->pop(); } else if( !it->first.compare( "via" ) ) { + m_xpath->push( "via" ); EVIA v( it->second ); int layer_front_most = kicad_layer( v.layer_front_most ); @@ -1952,10 +2115,12 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals ) via->SetShape( S_CIRCLE ); // @todo should be in SEGVIA constructor } + m_xpath->pop(); } else if( !it->first.compare( "contactref" ) ) { + m_xpath->push( "contactref" ); // CPTREE& attribs = it->second.get_child( "" ); @@ -1967,10 +2132,13 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals ) // D(printf( "adding refname:'%s' pad:'%s' netcode:%d netname:'%s'\n", reference.c_str(), pad.c_str(), netCode, nname.c_str() );) m_pads_to_nets[ key ] = ENET( netCode, nname ); + + m_xpath->pop(); } else if( !it->first.compare( "polygon" ) ) { + m_xpath->push( "polygon" ); EPOLYGON p( it->second ); int layer = kicad_layer( p.layer ); @@ -2027,9 +2195,13 @@ void EAGLE_PLUGIN::loadSignals( CPTREE& aSignals ) int rank = p.rank ? *p.rank : 0; zone->SetPriority( rank ); } + + m_xpath->pop(); // "polygon" } } } + + m_xpath->pop(); // "signals.signal" } @@ -2163,8 +2335,8 @@ int EAGLE_PLUGIN::kicad_layer( int aEagleLayer ) case 95: kiLayer = ECO1_N; break; case 96: kiLayer = ECO2_N; break; default: - D( printf( "unexpected eagle layer: %d\n", aEagleLayer );) - kiLayer = -1; break; // our eagle understanding is incomplete + D( printf( "unsupported eagle layer: %d\n", aEagleLayer );) + kiLayer = -1; break; // some layers do not map to KiCad } } @@ -2172,6 +2344,27 @@ int EAGLE_PLUGIN::kicad_layer( int aEagleLayer ) } +void EAGLE_PLUGIN::centerBoard() +{ + /* + if( m_props ) + { + const wxString& pageWidth = (*m_props)["page_width"]; + const wxString& pageHeight = (*m_props)["page_height"]; + + if( pageWidth.size() && pageHeight.size() ) + { + EDA_RECT bbbox = m_board->GetBoundingBox(); + int w = wxAtoi( pageWidth ); + int h = wxAtoi( pageHeight ); + + m_board->Move( ); + } + } + */ +} + + /* void EAGLE_PLUGIN::Save( const wxString& aFileName, BOARD* aBoard, PROPERTIES* aProperties ) { diff --git a/pcbnew/eagle_plugin.h b/pcbnew/eagle_plugin.h index fb12685d6c..25bf85a5d1 100644 --- a/pcbnew/eagle_plugin.h +++ b/pcbnew/eagle_plugin.h @@ -56,28 +56,18 @@ struct ENET {} }; -typedef std::map< std::string, ENET > NET_MAP; -typedef NET_MAP::const_iterator NET_MAP_CITER; - -/* -#include -namespace boost { - namespace property_tree - { - template < class Key, class Data, class KeyCompare = std::less > - class basic_ptree; - - typedef basic_ptree< std::string, std::string > ptree; - } -} -*/ +typedef std::map< std::string, ENET > NET_MAP; +typedef NET_MAP::const_iterator NET_MAP_CITER; typedef boost::property_tree::ptree PTREE; typedef const PTREE CPTREE; +class XPATH; + /** * Class EAGLE_PLUGIN - * works with Eagle 6.x XML board files and footprints. + * works with Eagle 6.x XML board files and footprints to implement the + * Pcbnew PLUGIN API, or a portion of it. */ class EAGLE_PLUGIN : public PLUGIN { @@ -110,38 +100,46 @@ public: //------------------------------------------------------ - typedef int BIU; + typedef int BIU; EAGLE_PLUGIN(); ~EAGLE_PLUGIN(); private: - int m_hole_count; ///< generates unique module names from eagle "hole"s. + XPATH* m_xpath; ///< keeps track of what we are working on within + ///< XML document during a Load(). - NET_MAP m_pads_to_nets; + std::string m_err_path; ///< snapshot m_xpath contentx into here on exception - MODULE_MAP m_templates; ///< is part of a MODULE factory that operates + int m_hole_count; ///< generates unique module names from eagle "hole"s. + + NET_MAP m_pads_to_nets; ///< net list + + MODULE_MAP m_templates; ///< is part of a MODULE factory that operates ///< using copy construction. ///< lookup key is libname.packagename - PROPERTIES* m_props; ///< passed via Save() or Load(), no ownership, may be NULL. - - BOARD* m_board; ///< which BOARD, no ownership here - double mm_per_biu; ///< how many mm in each BIU - double biu_per_mm; ///< how many bius in a mm + PROPERTIES* m_props; ///< passed via Save() or Load(), no ownership, may be NULL. + BOARD* m_board; ///< which BOARD is being worked on, no ownership here + double mm_per_biu; ///< how many mm in each BIU + double biu_per_mm; ///< how many bius in a mm /// initialize PLUGIN like a constructor would, and futz with fresh BOARD if needed. void init( PROPERTIES* aProperties ); + /// Convert an Eagle distance to a KiCad distance. int kicad( double d ) const; int kicad_y( double y ) const { return -kicad( y ); } int kicad_x( double x ) const { return kicad( x ); } + + /// create a font size (fontz) from an eagle font size scalar wxSize kicad_fontz( double d ) const; - + /// Convert an Eagle layer to a KiCad layer. static int kicad_layer( int aLayer ); + /// Convert a KiCad distance to an Eagle distance. double eagle( BIU d ) const { return mm_per_biu * d; } double eagle_x( BIU x ) const { return eagle( x ); } double eagle_y( BIU y ) const { return eagle( y ); } @@ -174,13 +172,16 @@ private: // all these loadXXX() throw IO_ERROR or ptree_error exceptions: - void loadAllSections( CPTREE& aDocument, bool aAppendToMe ); + void loadAllSections( CPTREE& aDocument ); void loadLayerDefs( CPTREE& aLayers ); void loadPlain( CPTREE& aPlain ); void loadSignals( CPTREE& aSignals ); void loadLibraries( CPTREE& aLibs ); void loadElements( CPTREE& aElements ); + /// move the BOARD into the center of the page + void centerBoard(); + /** * Function fmtDEG * formats an angle in a way particular to a board file format. This function @@ -203,7 +204,6 @@ private: void packageCircle( MODULE* aModule, CPTREE& aTree ) const; void packageHole( MODULE* aModule, CPTREE& aTree ) const; void packageSMD( MODULE* aModule, CPTREE& aTree ) const; - }; #endif // EAGLE_PLUGIN_H_ From 47877ec70c52d41d65a103ca9a61eadd041ed724 Mon Sep 17 00:00:00 2001 From: Marco Mattila Date: Sun, 3 Jun 2012 00:19:17 +0300 Subject: [PATCH 14/17] Do some ZONE_CONTAINED encapsulation. --- 3d-viewer/3d_draw.cpp | 25 +++++----- pcbnew/class_zone.h | 48 +++++++++++++++---- pcbnew/edit.cpp | 2 +- pcbnew/kicad_plugin.cpp | 2 +- pcbnew/legacy_plugin.cpp | 6 ++- pcbnew/onrightclick.cpp | 2 +- pcbnew/plot_rtn.cpp | 5 +- pcbnew/zones_by_polygon_fill_functions.cpp | 2 +- ...nvert_brd_items_to_polygons_with_Boost.cpp | 15 +++--- pcbnew/zones_polygons_test_connections.cpp | 13 ++--- 10 files changed, 79 insertions(+), 41 deletions(-) diff --git a/3d-viewer/3d_draw.cpp b/3d-viewer/3d_draw.cpp index 0cda29ba35..422b4822f9 100644 --- a/3d-viewer/3d_draw.cpp +++ b/3d-viewer/3d_draw.cpp @@ -258,7 +258,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List() if( curr_zone->m_FillMode == 0 ) { // solid polygons only are used to fill areas - if( curr_zone->m_FilledPolysList.size() > 3 ) + if( curr_zone->GetFilledPolysList().size() > 3 ) { Draw3D_SolidPolygonsInZones( curr_zone ); } @@ -286,14 +286,16 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List() { ZONE_CONTAINER* zone = pcb->GetArea( ii ); - if( zone->m_FilledPolysList.size() == 0 ) + std::vector polysList = zone->GetFilledPolysList(); + + if( polysList.size() == 0 ) continue; if( zone->m_ZoneMinThickness <= 1 ) continue; - int imax = zone->m_FilledPolysList.size() - 1; - CPolyPt* firstcorner = &zone->m_FilledPolysList[0]; + int imax = polysList.size() - 1; + CPolyPt* firstcorner = &polysList[0]; CPolyPt* begincorner = firstcorner; SEGZONE dummysegment( pcb ); dummysegment.SetLayer( zone->GetLayer() ); @@ -301,7 +303,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List() for( int ic = 1; ic <= imax; ic++ ) { - CPolyPt* endcorner = &zone->m_FilledPolysList[ic]; + CPolyPt* endcorner = &polysList[ic]; if( begincorner->utility == 0 ) { @@ -330,7 +332,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List() ic++; if( ic < imax - 1 ) - begincorner = firstcorner = &zone->m_FilledPolysList[ic]; + begincorner = firstcorner = &polysList[ic]; } else { @@ -440,7 +442,8 @@ void EDA_3D_CANVAS::Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone ) // Draw solid areas contained in this zone int StartContour = 1; - for( unsigned ii = 0; ii < aZone->m_FilledPolysList.size(); ii++ ) + std::vector polysList = aZone->GetFilledPolysList(); + for( unsigned ii = 0; ii < polysList.size(); ii++ ) { if( StartContour == 1 ) { @@ -449,11 +452,11 @@ void EDA_3D_CANVAS::Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone ) StartContour = 0; } - v_data[0] = aZone->m_FilledPolysList[ii].x * g_Parm_3D_Visu.m_BoardScale; - v_data[1] = -aZone->m_FilledPolysList[ii].y * g_Parm_3D_Visu.m_BoardScale; - gluTessVertex( tess, v_data, &aZone->m_FilledPolysList[ii] ); + v_data[0] = polysList[ii].x * g_Parm_3D_Visu.m_BoardScale; + v_data[1] = -polysList[ii].y * g_Parm_3D_Visu.m_BoardScale; + gluTessVertex( tess, v_data, &polysList[ii] ); - if( aZone->m_FilledPolysList[ii].end_contour == 1 ) + if( polysList[ii].end_contour == 1 ) { gluTessEndContour( tess ); gluTessEndPolygon( tess ); diff --git a/pcbnew/class_zone.h b/pcbnew/class_zone.h index 1b80fc8173..8c81c296f9 100644 --- a/pcbnew/class_zone.h +++ b/pcbnew/class_zone.h @@ -457,6 +457,34 @@ public: */ bool IsSame( const ZONE_CONTAINER &aZoneToCompare ); + /** + * Function ClearFilledPolysList + * clears the list of filled polygons. + */ + void ClearFilledPolysList() + { + m_FilledPolysList.clear(); + } + + /** + * Function GetFilledPolysList + * returns a reference to the list of filled polygons. + * @return Reference to the list of filled polygons. + */ + const std::vector& GetFilledPolysList() const + { + return m_FilledPolysList; + } + + /** + * Function AddFilledPolysList + * sets the list of filled polygons. + */ + void AddFilledPolysList( std::vector& aPolysList ) + { + m_FilledPolysList = aPolysList; + } + /** * Function GetSmoothedPoly * returns a pointer to the corner-smoothed version of @@ -522,16 +550,6 @@ public: // true when a zone was filled, false after deleting the filled areas bool m_IsFilled; - /* set of filled polygons used to draw a zone as a filled area. - * from outlines (m_Poly) but unlike m_Poly these filled polygons have no hole - * (they are* all in one piece) In very simple cases m_FilledPolysList is same - * as m_Poly. In less simple cases (when m_Poly has holes) m_FilledPolysList is - * a polygon equivalent to m_Poly, without holes but with extra outline segment - * connecting "holes" with external main outline. In complex cases an outline - * described by m_Poly can have many filled areas - */ - std::vector m_FilledPolysList; - /* set of segments used to fill area, when fill zone by segment is used. * ( m_FillMode == 1 ) * in this case segments have m_ZoneMinThickness width @@ -549,6 +567,16 @@ private: // if priorities are equal, a DRC error is set unsigned m_priority; ZoneConnection m_PadConnection; + + /* set of filled polygons used to draw a zone as a filled area. + * from outlines (m_Poly) but unlike m_Poly these filled polygons have no hole + * (they are* all in one piece) In very simple cases m_FilledPolysList is same + * as m_Poly. In less simple cases (when m_Poly has holes) m_FilledPolysList is + * a polygon equivalent to m_Poly, without holes but with extra outline segment + * connecting "holes" with external main outline. In complex cases an outline + * described by m_Poly can have many filled areas + */ + std::vector m_FilledPolysList; }; diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index fe488532cd..4f1bd33441 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -579,7 +579,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) { // Remove filled areas in zone ZONE_CONTAINER* zone_container = GetBoard()->GetArea( ii ); - zone_container->m_FilledPolysList.clear(); + zone_container->ClearFilledPolysList(); } SetCurItem( NULL ); // CurItem might be deleted by this command, clear the pointer diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index cbae672f75..0303c807a0 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -970,7 +970,7 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, OUTPUTFORMATTER* aFormatter, int aNe } // Save the PolysList - const std::vector< CPolyPt >& fv = aZone->m_FilledPolysList; + const std::vector< CPolyPt >& fv = aZone->GetFilledPolysList(); if( fv.size() ) { diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index bf0c374fb2..a1636740ee 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -2258,6 +2258,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() else if( TESTLINE( "$POLYSCORNERS" ) ) { // Read the PolysList (polygons used for fill areas in the zone) + std::vector polysList; while( READLINE( m_reader ) ) { @@ -2273,8 +2274,9 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER() bool end_contour = intParse( data, &data ); // end_countour was a bool when file saved, so '0' or '1' here int utility = intParse( data ); - zc->m_FilledPolysList.push_back( CPolyPt( x, y, end_contour, utility ) ); + polysList.push_back( CPolyPt( x, y, end_contour, utility ) ); } + zc->AddFilledPolysList( polysList ); } else if( TESTLINE( "$FILLSEGMENTS" ) ) @@ -3569,7 +3571,7 @@ void LEGACY_PLUGIN::saveZONE_CONTAINER( const ZONE_CONTAINER* me ) const } // Save the PolysList - const CPOLY_PTS& fv = me->m_FilledPolysList; + const CPOLY_PTS& fv = me->GetFilledPolysList(); if( fv.size() ) { fprintf( m_fp, "$POLYSCORNERS\n" ); diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp index 0548b4061e..d33c08b470 100644 --- a/pcbnew/onrightclick.cpp +++ b/pcbnew/onrightclick.cpp @@ -631,7 +631,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu* AddMenuItem( zones_menu, ID_POPUP_PCB_FILL_ZONE, _( "Fill Zone" ), KiBitmap( fill_zone_xpm ) ); - if( edge_zone->m_FilledPolysList.size() > 0 ) + if( edge_zone->GetFilledPolysList().size() > 0 ) { AddMenuItem( zones_menu, ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE, _( "Remove Filled Areas in Zone" ), KiBitmap( zone_unfill_xpm ) ); diff --git a/pcbnew/plot_rtn.cpp b/pcbnew/plot_rtn.cpp index 2a431c719f..0617152f06 100644 --- a/pcbnew/plot_rtn.cpp +++ b/pcbnew/plot_rtn.cpp @@ -523,7 +523,8 @@ void PlotTextePcb( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts, TEXTE_PC */ void PlotFilledAreas( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts, ZONE_CONTAINER* aZone, EDA_DRAW_MODE_T trace_mode ) { - unsigned imax = aZone->m_FilledPolysList.size(); + std::vector polysList = aZone->GetFilledPolysList(); + unsigned imax = polysList.size(); if( imax == 0 ) // Nothing to draw return; @@ -540,7 +541,7 @@ void PlotFilledAreas( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts, ZONE_ */ for( unsigned ic = 0; ic < imax; ic++ ) { - CPolyPt* corner = &aZone->m_FilledPolysList[ic]; + CPolyPt* corner = &polysList[ic]; cornerList.push_back( wxPoint( corner->x, corner->y) ); if( corner->end_contour ) // Plot the current filled area outline diff --git a/pcbnew/zones_by_polygon_fill_functions.cpp b/pcbnew/zones_by_polygon_fill_functions.cpp index 2705b44831..88126a0c4a 100644 --- a/pcbnew/zones_by_polygon_fill_functions.cpp +++ b/pcbnew/zones_by_polygon_fill_functions.cpp @@ -105,7 +105,7 @@ int PCB_EDIT_FRAME::Fill_Zone( ZONE_CONTAINER* aZone ) wxBusyCursor dummy; // Shows an hourglass cursor (removed by its destructor) - aZone->m_FilledPolysList.clear(); + aZone->ClearFilledPolysList(); aZone->UnFill(); aZone->BuildFilledPolysListData( GetBoard() ); diff --git a/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp b/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp index 24a34ad036..f844b5a6a4 100644 --- a/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp +++ b/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp @@ -471,6 +471,7 @@ int CopyPolygonsFromKPolygonListToFilledPolysList( ZONE_CONTAINER* aZone, KPolygonSet& aKPolyList ) { int count = 0; + std::vector polysList; for( unsigned ii = 0; ii < aKPolyList.size(); ii++ ) { @@ -487,14 +488,15 @@ int CopyPolygonsFromKPolygonListToFilledPolysList( ZONE_CONTAINER* aZone, // Flag this corner if starting a hole connection segment: // This is used by draw functions to draw only useful segments (and not extra segments) // corner.utility = (aBoolengine->GetPolygonPointEdgeType() == KB_FALSE_EDGE) ? 1 : 0; - aZone->m_FilledPolysList.push_back( corner ); + polysList.push_back( corner ); count++; } corner.end_contour = true; - aZone->m_FilledPolysList.pop_back(); - aZone->m_FilledPolysList.push_back( corner ); + polysList.pop_back(); + polysList.push_back( corner ); } + aZone->AddFilledPolysList( polysList ); return count; } @@ -503,7 +505,8 @@ int CopyPolygonsFromKPolygonListToFilledPolysList( ZONE_CONTAINER* aZone, int CopyPolygonsFromFilledPolysListTotKPolygonList( ZONE_CONTAINER* aZone, KPolygonSet& aKPolyList ) { - unsigned corners_count = aZone->m_FilledPolysList.size(); + std::vector polysList = aZone->GetFilledPolysList(); + unsigned corners_count = polysList.size(); int count = 0; unsigned ic = 0; @@ -511,7 +514,7 @@ int CopyPolygonsFromFilledPolysListTotKPolygonList( ZONE_CONTAINER* aZone, for( unsigned ii = 0; ii < corners_count; ii++ ) { - CPolyPt* corner = &aZone->m_FilledPolysList[ic]; + CPolyPt* corner = &polysList[ic]; if( corner->end_contour ) polycount++; @@ -527,7 +530,7 @@ int CopyPolygonsFromFilledPolysListTotKPolygonList( ZONE_CONTAINER* aZone, { for( ; ic < corners_count; ic++ ) { - CPolyPt* corner = &aZone->m_FilledPolysList[ic]; + CPolyPt* corner = &polysList[ic]; cornerslist.push_back( KPolyPoint( corner->x, corner->y ) ); count++; diff --git a/pcbnew/zones_polygons_test_connections.cpp b/pcbnew/zones_polygons_test_connections.cpp index 6762202bd4..91b4695717 100644 --- a/pcbnew/zones_polygons_test_connections.cpp +++ b/pcbnew/zones_polygons_test_connections.cpp @@ -28,7 +28,7 @@ void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode ); bool sort_areas( const ZONE_CONTAINER* ref, const ZONE_CONTAINER* tst ) { if( ref->GetNet() == tst->GetNet() ) - return ref->m_FilledPolysList.size() < tst->m_FilledPolysList.size(); + return ref->GetFilledPolysList().size() < tst->GetFilledPolysList().size(); else return ref->GetNet() < tst->GetNet(); } @@ -71,7 +71,7 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode ) continue; if( (aNetcode >= 0) && ( aNetcode != curr_zone->GetNet() ) ) continue; - if( curr_zone->m_FilledPolysList.size() == 0 ) + if( curr_zone->GetFilledPolysList().size() == 0 ) continue; zones_candidates.push_back(curr_zone); } @@ -120,10 +120,11 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode ) // test if a candidate is inside a filled area of this zone unsigned indexstart = 0, indexend; - for( indexend = 0; indexend < curr_zone->m_FilledPolysList.size(); indexend++ ) + std::vector polysList = curr_zone->GetFilledPolysList(); + for( indexend = 0; indexend < polysList.size(); indexend++ ) { // end of a filled sub-area found - if( curr_zone->m_FilledPolysList[indexend].end_contour ) + if( polysList[indexend].end_contour ) { subnet++; EDA_RECT bbox = curr_zone->CalculateSubAreaBoundaryBox( indexstart, indexend ); @@ -162,7 +163,7 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode ) if( bbox.Contains( pos1 ) ) { - if( TestPointInsidePolygon( curr_zone->m_FilledPolysList, indexstart, + if( TestPointInsidePolygon( polysList, indexstart, indexend, pos1.x, pos1.y ) ) connected = true; } @@ -170,7 +171,7 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode ) { if( bbox.Contains( pos2 ) ) { - if( TestPointInsidePolygon( curr_zone->m_FilledPolysList, + if( TestPointInsidePolygon( polysList, indexstart, indexend, pos2.x, pos2.y ) ) connected = true; From 20fc8ee3cc45a0378c77aa18b5843b0f82a4b51f Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 3 Jun 2012 13:16:08 +0200 Subject: [PATCH 15/17] Eeschema: Fix incorrect display refresh when editing the reference of a component from the popup menu. --- eeschema/edit_component_in_schematic.cpp | 9 +++------ eeschema/onleftclick.cpp | 2 +- eeschema/schedit.cpp | 8 ++++---- include/wxEeschemaStruct.h | 9 ++++++++- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/eeschema/edit_component_in_schematic.cpp b/eeschema/edit_component_in_schematic.cpp index c940fd2826..c56ce78a47 100644 --- a/eeschema/edit_component_in_schematic.cpp +++ b/eeschema/edit_component_in_schematic.cpp @@ -35,14 +35,13 @@ #include #include -#include #include #include #include -void SCH_EDIT_FRAME::EditComponentFieldText( SCH_FIELD* aField, wxDC* aDC ) +void SCH_EDIT_FRAME::EditComponentFieldText( SCH_FIELD* aField ) { wxCHECK_RET( aField != NULL && aField->Type() == SCH_FIELD_T, wxT( "Cannot edit invalid schematic field." ) ); @@ -81,7 +80,6 @@ create a new power component with the new value." ), GetChars( entry->GetName() wxString title; title.Printf( _( "Edit %s Field" ), GetChars( aField->GetName() ) ); -// wxTextEntryDialog dlg( this, wxEmptyString , title, newtext ); if( aField->GetText().IsEmpty() ) // Means the field was not already in use { aField->m_Pos = component->GetPosition(); @@ -104,7 +102,7 @@ create a new power component with the new value." ), GetChars( entry->GetName() { if( fieldNdx == REFERENCE ) { - // Test is reference is acceptable: + // Test if the reference string is valid: if( SCH_COMPONENT::IsReferenceStringValid( newtext ) ) { component->SetRef( m_CurrentSheet, newtext ); @@ -136,10 +134,9 @@ create a new power component with the new value." ), GetChars( entry->GetName() if( can_update ) { - aField->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode ); dlg.TransfertDataToField(); - aField->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode ); OnModify(); + m_canvas->Refresh(); } component->DisplayInfo( this ); diff --git a/eeschema/onleftclick.cpp b/eeschema/onleftclick.cpp index bd4c30e38f..2fc952c46e 100644 --- a/eeschema/onleftclick.cpp +++ b/eeschema/onleftclick.cpp @@ -363,7 +363,7 @@ void SCH_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition ) break; case SCH_FIELD_T: - EditComponentFieldText( (SCH_FIELD*) item, aDC ); + EditComponentFieldText( (SCH_FIELD*) item ); m_canvas->MoveCursorToCrossHair(); break; diff --git a/eeschema/schedit.cpp b/eeschema/schedit.cpp index 3a95b96d18..4cba871d62 100644 --- a/eeschema/schedit.cpp +++ b/eeschema/schedit.cpp @@ -811,15 +811,15 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent ) switch( aEvent.GetId() ) { case ID_SCH_EDIT_COMPONENT_REFERENCE: - EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( REFERENCE ), &dc ); + EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( REFERENCE ) ); break; case ID_SCH_EDIT_COMPONENT_VALUE: - EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( VALUE ), &dc ); + EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( VALUE ) ); break; case ID_SCH_EDIT_COMPONENT_FOOTPRINT: - EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( FOOTPRINT ), &dc ); + EditComponentFieldText( ( (SCH_COMPONENT*) item )->GetField( FOOTPRINT ) ); break; case ID_SCH_EDIT_ITEM: @@ -850,7 +850,7 @@ void SCH_EDIT_FRAME::OnEditItem( wxCommandEvent& aEvent ) break; case SCH_FIELD_T: - EditComponentFieldText( (SCH_FIELD*) item, &dc ); + EditComponentFieldText( (SCH_FIELD*) item ); break; case SCH_BITMAP_T: diff --git a/include/wxEeschemaStruct.h b/include/wxEeschemaStruct.h index b129a97b57..ac84df5a1b 100644 --- a/include/wxEeschemaStruct.h +++ b/include/wxEeschemaStruct.h @@ -963,7 +963,14 @@ private: void ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC ); void SetInitCmp( SCH_COMPONENT* DrawComponent, wxDC* DC ); - void EditComponentFieldText( SCH_FIELD* aField, wxDC* aDC ); + /** + * Function EditComponentFieldText + * displays the edit field dialog to edit the parameters of \a aField. + * + * @param aField is a pointer to the SCH_FIELD object to be edited. + */ + void EditComponentFieldText( SCH_FIELD* aField ); + void RotateField( SCH_FIELD* aField, wxDC* aDC ); /** From 150b7cd4e2de152919280604364b58b1fd7d7843 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 3 Jun 2012 17:47:53 +0200 Subject: [PATCH 16/17] Fix eagle_plugin issue (File not found) under Windows. --- pcbnew/eagle_plugin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index ace1997afd..e3924f5b30 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -975,7 +975,7 @@ BOARD* EAGLE_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPE // 8 bit "filename" should be encoded according to disk filename encoding, // (maybe this is current locale, maybe not, its a filesystem issue), // and is not necessarily utf8. - std::string filename = (const char*) aFileName.fn_str(); + std::string filename = (const char*) aFileName.char_str( wxConvFile ); read_xml( filename, doc, xml_parser::trim_whitespace | xml_parser::no_comments ); @@ -2443,4 +2443,4 @@ bool EAGLE_PLUGIN::IsFootprintLibWritable( const wxString& aLibraryPath ) return true; } -*/ \ No newline at end of file +*/ From d5b1087fb84345182af99fc8bd8dd3d05111590d Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 3 Jun 2012 19:41:49 +0200 Subject: [PATCH 17/17] Appying lajos' patch to boost 1.49 --- include/boost/polygon/polygon.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/boost/polygon/polygon.hpp b/include/boost/polygon/polygon.hpp index 4c3e43a5eb..bd8e8d5a38 100644 --- a/include/boost/polygon/polygon.hpp +++ b/include/boost/polygon/polygon.hpp @@ -23,6 +23,7 @@ #include "transform.hpp" #include "detail/transform_detail.hpp" +#include "detail/polygon_sort_adaptor.hpp" //interval #include "interval_data.hpp"