Merge trunk @ 5397

This commit is contained in:
Garth Corral 2015-01-31 17:34:01 -08:00
commit f0e295ca1c
46 changed files with 3903 additions and 459 deletions

View File

@ -285,7 +285,7 @@ if (OPENSSL_INCLUDE_DIR)
set(OPENSSL_VERSION "${_OPENSSL_VERSION}")
elseif(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str
REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*")
REGEX "^#[\t ]*define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*")
# The version number is encoded as 0xMNNFFPPS: major minor fix patch status
# The status gives if this is a developer or prerelease and is ignored here.

View File

@ -311,6 +311,10 @@ ExternalProject_Add_Step( boost bzr_add_boost
ExternalProject_Add_Step( boost bzr_init_boost
COMMAND bzr init -q <SOURCE_DIR>
#creates a .bzrignore file in boost root dir, to avoid copying useless files
#moreover these files have a very very long name, and sometimes
#have a too long full file name to be handled by DOS commands
COMMAND echo "*.htm*" > ${PREFIX}/src/boost/.bzrignore
COMMENT "creating 'boost scratch repo' specifically for boost to track boost patches"
DEPENDERS bzr_add_boost
DEPENDEES download

View File

@ -383,9 +383,15 @@ bool PGM_BASE::initPgm()
App().SetAppName( pgm_name.GetName().Lower() );
// Install some image handlers, mainly for help
wxImage::AddHandler( new wxPNGHandler );
wxImage::AddHandler( new wxGIFHandler );
wxImage::AddHandler( new wxJPEGHandler );
if( wxImage::FindHandler( wxBITMAP_TYPE_PNG ) == NULL )
wxImage::AddHandler( new wxPNGHandler );
if( wxImage::FindHandler( wxBITMAP_TYPE_GIF ) == NULL )
wxImage::AddHandler( new wxGIFHandler );
if( wxImage::FindHandler( wxBITMAP_TYPE_JPEG ) == NULL )
wxImage::AddHandler( new wxJPEGHandler );
wxFileSystem::AddHandler( new wxZipFSHandler );
// Analyze the command line & initialize the binary path

View File

@ -114,8 +114,8 @@ CONTEXT_MENU& CONTEXT_MENU::operator=( const CONTEXT_MENU& aMenu )
void CONTEXT_MENU::setupEvents()
{
Connect( wxEVT_MENU_HIGHLIGHT, wxEventHandler( CONTEXT_MENU::onMenuEvent ), NULL, this );
Connect( wxEVT_COMMAND_MENU_SELECTED, wxEventHandler( CONTEXT_MENU::onMenuEvent ), NULL, this );
Connect( wxEVT_MENU_HIGHLIGHT, wxMenuEventHandler( CONTEXT_MENU::onMenuEvent ), NULL, this );
Connect( wxEVT_COMMAND_MENU_SELECTED, wxMenuEventHandler( CONTEXT_MENU::onMenuEvent ), NULL, this );
}
@ -194,7 +194,7 @@ void CONTEXT_MENU::Clear()
}
void CONTEXT_MENU::onMenuEvent( wxEvent& aEvent )
void CONTEXT_MENU::onMenuEvent( wxMenuEvent& aEvent )
{
OPT_TOOL_EVENT evt;
@ -219,7 +219,25 @@ void CONTEXT_MENU::onMenuEvent( wxEvent& aEvent )
}
else
{
// Under Linux, every submenu can have a separate event handler, under
// Windows all submenus are handled by the main menu.
#ifdef __WINDOWS__
if( !evt ) {
// Try to find the submenu which holds the selected item
wxMenu*menu = NULL;
FindItem( m_selected, &menu );
if( menu )
{
menu->ProcessEvent( aEvent );
return;
}
assert( false ); // The event should be handled above
}
#else
evt = m_customHandler( aEvent );
#endif /* else __WINDOWS__ */
// Handling non-action menu entries (e.g. items in clarification list)
if( !evt )

View File

@ -1,9 +1,9 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -241,17 +241,9 @@ LIB_PART::LIB_PART( LIB_PART& aPart, PART_LIB* aLibrary ) :
LIB_PART::~LIB_PART()
{
#if defined(DEBUG) && 1
if( m_aliases.size() )
{
int breakhere = 1;
(void) breakhere;
}
printf( "%s: destroying part '%s' with alias list count of %d\n",
__func__, TO_UTF8( GetName() ), int( m_aliases.size() ) );
#endif
wxLogDebug( wxT( "%s: destroying part '%s' with alias list count of %d\n" ),
GetChars( wxString::FromAscii( __WXFUNCTION__ ) ), GetChars( GetName() ),
int( m_aliases.size() ) );
// If the part is being deleted directly rather than through the library,
// delete all of the aliases.
@ -298,8 +290,9 @@ void LIB_PART::SetName( const wxString& aName )
void LIB_PART::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDc, const wxPoint& aOffset, int aMulti,
int aConvert, GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor, const TRANSFORM& aTransform,
bool aShowPinText, bool aDrawFields, bool aOnlySelected )
int aConvert, GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor,
const TRANSFORM& aTransform, bool aShowPinText, bool aDrawFields,
bool aOnlySelected )
{
BASE_SCREEN* screen = aPanel ? aPanel->GetScreen() : NULL;
@ -469,7 +462,7 @@ void LIB_PART::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert,
if( aConvert && item.m_Convert && ( item.m_Convert != aConvert ) )
continue;
// The reference is a special case: we shoud change the basic text
// The reference is a special case: we should change the basic text
// to add '?' and the part id
LIB_FIELD& field = (LIB_FIELD&) item;
wxString tmp = field.GetShownText();
@ -511,7 +504,8 @@ void LIB_PART::RemoveDrawItem( LIB_ITEM* aItem, EDA_DRAW_PANEL* aPanel, wxDC* aD
if( *i == aItem )
{
if( aDc != NULL )
aItem->Draw( aPanel, aDc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, NULL, DefaultTransform );
aItem->Draw( aPanel, aDc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR,
g_XorMode, NULL, DefaultTransform );
drawings.erase( i );
SetModified();
@ -1466,7 +1460,7 @@ void LIB_PART::RotateSelectedItems( const wxPoint& aCenter )
LIB_ITEM* LIB_PART::LocateDrawItem( int aUnit, int aConvert,
KICAD_T aType, const wxPoint& aPoint )
KICAD_T aType, const wxPoint& aPoint )
{
BOOST_FOREACH( LIB_ITEM& item, drawings )
{
@ -1484,7 +1478,7 @@ LIB_ITEM* LIB_PART::LocateDrawItem( int aUnit, int aConvert,
LIB_ITEM* LIB_PART::LocateDrawItem( int aUnit, int aConvert, KICAD_T aType,
const wxPoint& aPoint, const TRANSFORM& aTransform )
const wxPoint& aPoint, const TRANSFORM& aTransform )
{
/* we use LocateDrawItem( int aUnit, int convert, KICAD_T type, const
* wxPoint& pt ) to search items.
@ -1763,15 +1757,6 @@ void LIB_PART::AddAlias( const wxString& aName )
}
/** Set the separator char between the subpart id and the reference
* 0 (no separator) or '.' , '-' and '_'
* and the ascii char value to calculate the subpart symbol id from the part number:
* 'A' or '1' only are allowed. (to print U1.A or U1.1)
* if this is a digit, a number is used as id symbol
* Note also if the subpart symbol is a digit, the separator cannot be null.
* @param aSep = the separator symbol (0 (no separator) or '.' , '-' and '_')
* @param aFirstId = the Id of the first part ('A' or '1')
*/
void LIB_PART::SetSubpartIdNotation( int aSep, int aFirstId )
{
m_subpartFirstId = 'A';

View File

@ -73,7 +73,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
chipnameTextCtrl->SetMaxLength( 32 );
chipnameTextCtrl->SetToolTip( _("The name of the symbol in the library from which this component came") );
sbSizerChipName->Add( chipnameTextCtrl, 0, wxEXPAND|wxBOTTOM, 5 );
sbSizerChipName->Add( chipnameTextCtrl, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
wxBoxSizer* bSizerChpinameButt;
bSizerChpinameButt = new wxBoxSizer( wxHORIZONTAL );
@ -149,16 +149,16 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
int m_FieldHJustifyCtrlNChoices = sizeof( m_FieldHJustifyCtrlChoices ) / sizeof( wxString );
m_FieldHJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Horiz. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldHJustifyCtrlNChoices, m_FieldHJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_FieldHJustifyCtrl->SetSelection( 2 );
bSizerJustification->Add( m_FieldHJustifyCtrl, 1, wxRIGHT|wxLEFT, 5 );
bSizerJustification->Add( m_FieldHJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxString m_FieldVJustifyCtrlChoices[] = { _("Bottom"), _("Center"), _("Top") };
int m_FieldVJustifyCtrlNChoices = sizeof( m_FieldVJustifyCtrlChoices ) / sizeof( wxString );
m_FieldVJustifyCtrl = new wxRadioBox( this, wxID_ANY, _("Vert. Justify"), wxDefaultPosition, wxDefaultSize, m_FieldVJustifyCtrlNChoices, m_FieldVJustifyCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_FieldVJustifyCtrl->SetSelection( 2 );
bSizerJustification->Add( m_FieldVJustifyCtrl, 1, wxRIGHT|wxLEFT, 5 );
bSizerJustification->Add( m_FieldVJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
fieldEditBoxSizer->Add( bSizerJustification, 0, wxEXPAND|wxBOTTOM, 5 );
fieldEditBoxSizer->Add( bSizerJustification, 1, wxEXPAND|wxBOTTOM, 5 );
wxBoxSizer* bSizerStyle;
bSizerStyle = new wxBoxSizer( wxHORIZONTAL );
@ -188,7 +188,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
bSizerStyle->Add( m_StyleRadioBox, 1, wxEXPAND|wxALL, 5 );
fieldEditBoxSizer->Add( bSizerStyle, 1, wxEXPAND, 5 );
fieldEditBoxSizer->Add( bSizerStyle, 1, wxEXPAND|wxBOTTOM, 5 );
wxBoxSizer* fieldNameBoxSizer;
fieldNameBoxSizer = new wxBoxSizer( wxVERTICAL );
@ -211,7 +211,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP(
fieldValueTextCtrl->SetMaxLength( 0 );
fieldValueTextCtrl->SetToolTip( _("The name of the currently selected field\nSome fixed fields names are not editable") );
fieldNameBoxSizer->Add( fieldValueTextCtrl, 0, wxEXPAND, 5 );
fieldNameBoxSizer->Add( fieldValueTextCtrl, 0, wxEXPAND|wxBOTTOM, 5 );
m_show_datasheet_button = new wxButton( this, wxID_ANY, _("Show in Browser"), wxDefaultPosition, wxDefaultSize, 0 );
m_show_datasheet_button->SetToolTip( _("If your datasheet is an http:// link or a complete file path, then it may show in your browser by pressing this button.") );

View File

@ -44,7 +44,7 @@
<property name="minimum_size"></property>
<property name="name">DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP</property>
<property name="pos"></property>
<property name="size">677,586</property>
<property name="size">688,586</property>
<property name="style">wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Component Properties</property>
@ -744,7 +744,7 @@
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="0">
<property name="BottomDockable">1</property>
@ -1774,7 +1774,7 @@
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="proportion">0</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerJustification</property>
@ -1782,7 +1782,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxRadioBox" expanded="0">
<property name="BottomDockable">1</property>
@ -1872,7 +1872,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxRIGHT|wxLEFT</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxRadioBox" expanded="0">
<property name="BottomDockable">1</property>
@ -1964,7 +1964,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
@ -2521,7 +2521,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="0">
<property name="BottomDockable">1</property>

View File

@ -100,7 +100,7 @@ class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public DIALOG_SHIM
public:
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Component Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 677,586 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Component Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 688,586 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
~DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP();
};

View File

@ -266,7 +266,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick( wxCommandEvent& event
/* End unused code */
// save old cmp in undo list
m_parent->SaveCopyInUndoList( m_libEntry, IS_CHANGED );
m_parent->SaveCopyInUndoList( m_libEntry );
// delete any fields with no name or no value before we copy all of m_FieldsBuf
// back into the component

View File

@ -57,7 +57,7 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
m_FieldHJustifyCtrl->SetSelection( 1 );
m_FieldHJustifyCtrl->SetToolTip( _("Select if the component is to be rotated when drawn") );
bSizerJustify->Add( m_FieldHJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerJustify->Add( m_FieldHJustifyCtrl, 1, wxEXPAND|wxALL, 5 );
wxString m_FieldVJustifyCtrlChoices[] = { _("Bottom"), _("Center"), _("Top") };
int m_FieldVJustifyCtrlNChoices = sizeof( m_FieldVJustifyCtrlChoices ) / sizeof( wxString );
@ -65,10 +65,10 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
m_FieldVJustifyCtrl->SetSelection( 0 );
m_FieldVJustifyCtrl->SetToolTip( _("Pick the graphical transformation to be used when displaying the component, if any") );
bSizerJustify->Add( m_FieldVJustifyCtrl, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bSizerJustify->Add( m_FieldVJustifyCtrl, 1, wxEXPAND|wxALL, 5 );
fieldEditBoxSizer->Add( bSizerJustify, 0, wxEXPAND|wxBOTTOM, 5 );
fieldEditBoxSizer->Add( bSizerJustify, 1, wxEXPAND|wxBOTTOM, 5 );
wxBoxSizer* bSizerAspect;
bSizerAspect = new wxBoxSizer( wxHORIZONTAL );
@ -93,10 +93,10 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
int m_StyleRadioBoxNChoices = sizeof( m_StyleRadioBoxChoices ) / sizeof( wxString );
m_StyleRadioBox = new wxRadioBox( this, wxID_ANY, _("Style:"), wxDefaultPosition, wxDefaultSize, m_StyleRadioBoxNChoices, m_StyleRadioBoxChoices, 1, wxRA_SPECIFY_COLS );
m_StyleRadioBox->SetSelection( 0 );
bSizerAspect->Add( m_StyleRadioBox, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerAspect->Add( m_StyleRadioBox, 1, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
fieldEditBoxSizer->Add( bSizerAspect, 0, wxEXPAND|wxTOP, 5 );
fieldEditBoxSizer->Add( bSizerAspect, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
wxBoxSizer* fieldNameBoxSizer;
fieldNameBoxSizer = new wxBoxSizer( wxVERTICAL );
@ -199,7 +199,6 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
this->SetSizer( mainSizer );
this->Layout();
mainSizer->Fit( this );
// Connect Events
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE::OnCloseDialog ) );

View File

@ -44,7 +44,7 @@
<property name="minimum_size"></property>
<property name="name">DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="size">542,529</property>
<property name="style">wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Field Properties</property>
@ -494,7 +494,7 @@
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM</property>
<property name="proportion">0</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerJustify</property>
@ -502,7 +502,7 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">1</property>
<object class="wxRadioBox" expanded="1">
<property name="BottomDockable">1</property>
@ -592,7 +592,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">1</property>
<object class="wxRadioBox" expanded="1">
<property name="BottomDockable">1</property>
@ -684,8 +684,8 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP</property>
<property name="proportion">0</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerAspect</property>
@ -883,7 +883,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxRadioBox" expanded="1">
<property name="BottomDockable">1</property>

View File

@ -84,7 +84,7 @@ class DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE : public DIALOG_SHIM
public:
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Field Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Field Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 542,529 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
~DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE();
};

View File

@ -1,8 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2009-2105 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2015 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -40,7 +40,7 @@ public:
DIALOG_LIB_NEW_COMPONENT( wxWindow* parent );
void SetName( const wxString& name ) { m_textName->SetValue( name ); }
wxString GetName( void ) { return m_textName->GetValue(); }
wxString GetName( void ) const { return m_textName->GetValue(); }
void SetReference( const wxString& reference )
{

View File

@ -25,13 +25,13 @@
#include <fctsys.h>
#include <class_drawpanel.h>
#include <general.h>
#include <protos.h>
//#include <general.h>
//#include <protos.h>
#include <libeditframe.h>
#include <class_libentry.h>
void LIB_EDIT_FRAME::SaveCopyInUndoList( EDA_ITEM* ItemToCopy, int unused_flag )
void LIB_EDIT_FRAME::SaveCopyInUndoList( EDA_ITEM* ItemToCopy )
{
LIB_PART* CopyItem;
PICKED_ITEMS_LIST* lastcmd;

View File

@ -506,7 +506,13 @@ private:
// General editing
public:
void SaveCopyInUndoList( EDA_ITEM* ItemToCopy, int flag_type_command = 0 );
/**
* Function SaveCopyInUndoList.
* Create a copy of the current component, and save it in the undo list.
* Because a component in library editor does not a lot of primitives,
* the full data is duplicated. It is not worth to try to optimize this save funtion
*/
void SaveCopyInUndoList( EDA_ITEM* ItemToCopy );
private:
void GetComponentFromUndoList( wxCommandEvent& event );

View File

@ -1,10 +1,10 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2013 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2013-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -188,11 +188,14 @@ private:
void initVars();
public:
protected:
EDA_ITEM( EDA_ITEM* parent, KICAD_T idType );
EDA_ITEM( KICAD_T idType );
EDA_ITEM( const EDA_ITEM& base );
public:
virtual ~EDA_ITEM() { };
/**
@ -426,17 +429,7 @@ public:
}
/**
* Function Matches
* compares \a aText against search criteria in \a aSearchData.
* Helper function used in search and replace dialog
*
* @param aText A reference to a wxString object containing the string to test.
* @param aSearchData The criteria to search against.
* @return True if \a aText matches the search criteria in \a aSearchData.
*/
bool Matches( const wxString& aText, wxFindReplaceData& aSearchData );
/**
* Function Replace
* performs a text replace on \a aText using the find and replace criteria in
* \a aSearchData on items that support text find and replace.
@ -534,6 +527,18 @@ public:
static std::ostream& NestedSpace( int nestLevel, std::ostream& os );
#endif
protected:
/**
* Function Matches
* compares \a aText against search criteria in \a aSearchData.
* This is a helper function for simplify derived class logic.
*
* @param aText A reference to a wxString object containing the string to test.
* @param aSearchData The criteria to search against.
* @return True if \a aText matches the search criteria in \a aSearchData.
*/
bool Matches( const wxString& aText, wxFindReplaceData& aSearchData );
};

View File

@ -1,8 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2014 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2009-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2015 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -111,15 +111,64 @@ public:
double m_SolderPasteMarginRatio; ///< Solder pask margin ratio value of pad size
///< The final margin is the sum of these 2 values
// Variables used in footprint handling
// Variables used in footprint edition (default value in item/footprint creation)
int m_ModuleSegmentWidth; ///< Default width for all graphic lines
// Note: the default layer is the active layer
wxSize m_ModuleTextSize; ///< Default footprint texts size
int m_ModuleTextWidth;
int m_ModuleSegmentWidth;
int m_ModuleTextWidth; ///< Default footprint texts thickness
wxString m_RefDefaultText; ///< Default ref text on fp creation
// if empty, use footprint name as default
bool m_RefDefaultVisibility; ///< Default ref text visibility on fp creation
int m_RefDefaultlayer; ///< Default ref text layer on fp creation
// should be a LAYER_ID, but use an int
// to save this param in config
wxString m_ValueDefaultText; ///< Default value text on fp creation
// if empty, use footprint name as default
bool m_ValueDefaultVisibility; ///< Default value text visibility on fp creation
int m_ValueDefaultlayer; ///< Default value text layer on fp creation
// should be a LAYER_ID, but use an int
// to save this param in config
// Miscellaneous
wxPoint m_AuxOrigin; ///< origin for plot exports
wxPoint m_GridOrigin; ///< origin for grid offsets
D_PAD m_Pad_Master;
D_PAD m_Pad_Master; ///< A dummy pad to store all default parameters
// when importing values or create a new pad
private:
/// Index for #m_ViasDimensionsList to select the current via size.
/// 0 is the index selection of the default value Netclass
unsigned m_viaSizeIndex;
// Index for m_TrackWidthList to select the value.
/// 0 is the index selection of the default value Netclass
unsigned m_trackWidthIndex;
///> Use custom values for track/via sizes (not specified in net class nor in the size lists).
bool m_useCustomTrackVia;
///> Custom track width (used after UseCustomTrackViaSize( true ) was called).
int m_customTrackWidth;
///> Custom via size (used after UseCustomTrackViaSize( true ) was called).
VIA_DIMENSION m_customViaSize;
int m_copperLayerCount; ///< Number of copper layers for this design
LSET m_enabledLayers; ///< Bit-mask for layer enabling
LSET m_visibleLayers; ///< Bit-mask for layer visibility
int m_visibleElements; ///< Bit-mask for element category visibility
int m_boardThickness; ///< Board thickness for 3D viewer
/// Current net class name used to display netclass info.
/// This is also the last used netclass after starting a track.
wxString m_currentNetClassName;
public:
BOARD_DESIGN_SETTINGS();
/**
@ -489,35 +538,6 @@ public:
inline void SetBoardThickness( int aThickness ) { m_boardThickness = aThickness; }
private:
/// Index for #m_ViasDimensionsList to select the current via size.
/// 0 is the index selection of the default value Netclass
unsigned m_viaSizeIndex;
// Index for m_TrackWidthList to select the value.
/// 0 is the index selection of the default value Netclass
unsigned m_trackWidthIndex;
///> Use custom values for track/via sizes (not specified in net class nor in the size lists).
bool m_useCustomTrackVia;
///> Custom track width (used after UseCustomTrackViaSize( true ) was called).
int m_customTrackWidth;
///> Custom via size (used after UseCustomTrackViaSize( true ) was called).
VIA_DIMENSION m_customViaSize;
int m_copperLayerCount; ///< Number of copper layers for this design
LSET m_enabledLayers; ///< Bit-mask for layer enabling
LSET m_visibleLayers; ///< Bit-mask for layer visibility
int m_visibleElements; ///< Bit-mask for element category visibility
int m_boardThickness; ///< Board thickness for 3D viewer
/// Current net class name used to display netclass info.
/// This is also the last used netclass after starting a track.
wxString m_currentNetClassName;
void formatNetClass( NETCLASS* aNetClass, OUTPUTFORMATTER* aFormatter, int aNestLevel,
int aControlBits ) const throw( IO_ERROR );
};

View File

@ -95,12 +95,12 @@ public:
}
protected:
void setCustomEventHandler( boost::function<OPT_TOOL_EVENT(const wxEvent&)> aHandler )
void setCustomEventHandler( boost::function<OPT_TOOL_EVENT(const wxMenuEvent&)> aHandler )
{
m_customHandler = aHandler;
}
virtual OPT_TOOL_EVENT handleCustomEvent( const wxEvent& aEvent )
virtual OPT_TOOL_EVENT handleCustomEvent( const wxMenuEvent& aEvent )
{
return OPT_TOOL_EVENT();
}
@ -116,7 +116,7 @@ private:
void setupEvents();
///> Event handler.
void onMenuEvent( wxEvent& aEvent );
void onMenuEvent( wxMenuEvent& aEvent );
/**
* Function setTool()
@ -144,7 +144,7 @@ private:
std::map<int, const TOOL_ACTION*> m_toolActions;
/// Custom events handler, allows to translate wxEvents to TOOL_EVENTs.
boost::function<OPT_TOOL_EVENT(const wxEvent& aEvent)> m_customHandler;
boost::function<OPT_TOOL_EVENT(const wxMenuEvent& aEvent)> m_customHandler;
friend class TOOL_INTERACTIVE;
};

View File

@ -292,6 +292,8 @@ public:
*/
inline void SetLayerVisible( int aLayer, bool aVisible = true )
{
wxASSERT( aLayer < (int) m_layers.size() );
if( m_layers[aLayer].visible != aVisible )
{
// Target has to be redrawn after changing its visibility
@ -307,9 +309,18 @@ public:
*/
inline bool IsLayerVisible( int aLayer ) const
{
wxASSERT( aLayer < (int) m_layers.size() );
return m_layers.at( aLayer ).visible;
}
inline void SetLayerDisplayOnly( int aLayer, bool aDisplayOnly = true )
{
wxASSERT( aLayer < (int) m_layers.size() );
m_layers[aLayer].displayOnly = aDisplayOnly;
}
/**
* Function SetLayerTarget()
* Changes the rendering target for a particular layer.
@ -318,6 +329,8 @@ public:
*/
inline void SetLayerTarget( int aLayer, RENDER_TARGET aTarget )
{
wxASSERT( aLayer < (int) m_layers.size() );
m_layers[aLayer].target = aTarget;
}
@ -477,6 +490,8 @@ public:
/// Returns true if the layer is cached
inline bool IsCached( int aLayer ) const
{
wxASSERT( aLayer < (int) m_layers.size() );
return m_layers.at( aLayer ).target == TARGET_CACHED;
}

View File

@ -276,22 +276,6 @@ public:
*/
void CursorGoto( const wxPoint& aPos, bool aWarp = true );
/**
* Function Save_Module_In_Library
* Save in an existing library a given footprint
* @param aLibName = name of the library to use
* @param aModule = the given footprint
* @param aOverwrite = true to overwrite an existing footprint, false to
* abort if an existing footprint with same name is found
* @param aDisplayDialog = true to display a dialog to enter or confirm the
* footprint name
* @return : true if OK, false if abort
*/
bool Save_Module_In_Library( const wxString& aLibName,
MODULE* aModule,
bool aOverwrite,
bool aDisplayDialog );
/**
* Function SelectLibrary
* puts up a dialog and allows the user to pick a library, for unspecified use.
@ -316,17 +300,19 @@ public:
virtual void OnModify();
// Modules (footprints)
/**
* Function Create_1_Module
* Creates a new module or footprint : A new module contains 2 texts :
* First = REFERENCE
* Second = VALUE: "VAL**"
* the new module is added to the board module list
* @param aModuleName = name of the new footprint
* (will be the component reference in board)
* @return a pointer to the new module
* Function CreateNewModule
* Creates a new module or footprint, at position 0,0
* The new module contains only 2 texts: a reference and a value:
* Reference = REF**
* Value = "VAL**" or Footprint name in lib
* Note: they are dummy texts, which will be replaced by the actual texts
* when the fooprint is placed on a board and a netlist is read
* @param aModuleName = name of the new footprint in library
* @return a reference to the new module
*/
MODULE* Create_1_Module( const wxString& aModuleName );
MODULE* CreateNewModule( const wxString& aModuleName );
void Edit_Module( MODULE* module, wxDC* DC );
void Rotate_Module( wxDC* DC, MODULE* module, double angle, bool incremental );

View File

@ -1602,12 +1602,15 @@ public:
void Edit_Gap( wxDC* DC, MODULE* Module );
/**
* Function Create_MuWaveBasicShape
* create a footprint with pad_count pads for micro wave applications.
* This footprint has pad_count pads:
* Function CreateMuWaveBaseFootprint
* create a basic footprint for micro wave applications.
* @param aValue = the text value
* @param aTextSize = the size of ref and value texts ( <= 0 to use board default values )
* @param aPadCount = number of pads
* Pads settings are:
* PAD_SMD, rectangular, H size = V size = current track width.
*/
MODULE* Create_MuWaveBasicShape( const wxString& name, int pad_count );
MODULE* CreateMuWaveBaseFootprint( const wxString& aValue, int aTextSize, int aPadCount );
/**
* Create_MuWaveComponent

View File

@ -96,6 +96,8 @@ set( PCBNEW_DIALOGS
dialogs/dialog_layer_selection_base.cpp
dialogs/dialog_layers_setup.cpp
dialogs/dialog_layers_setup_base.cpp
dialogs/dialog_modedit_options.cpp
dialogs/dialog_modedit_options_base.cpp
dialogs/dialog_netlist.cpp
dialogs/dialog_netlist_fbp.cpp
dialogs/dialog_pcb_text_properties.cpp

View File

@ -303,7 +303,7 @@ void BOARD::PopHighLight()
}
bool BOARD::SetLayer( LAYER_ID aIndex, const LAYER& aLayer )
bool BOARD::SetLayerDescr( LAYER_ID aIndex, const LAYER& aLayer )
{
if( unsigned( aIndex ) < DIM( m_Layer ) )
{

View File

@ -661,7 +661,15 @@ public:
return LSET::Name( aLayerId );
}
bool SetLayer( LAYER_ID aIndex, const LAYER& aLayer );
/**
* Function SetLayerDescr
* returns the type of the copper layer given by aLayer.
*
* @param aIndex A layer index in m_Layer
* @param aLayer A reference to a LAYER description.
* @return false if the index was out of range.
*/
bool SetLayerDescr( LAYER_ID aIndex, const LAYER& aLayer );
/**
* Function GetLayerType

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2015 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
@ -96,16 +96,28 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
// The final margin is the sum of these 2 values
// Usually < 0 because the mask is smaller than pad
m_ModuleTextSize = wxSize( DEFAULT_TEXT_MODULE_SIZE,
DEFAULT_TEXT_MODULE_SIZE );
m_ModuleTextWidth = DEFAULT_GR_MODULE_THICKNESS;
m_ModuleSegmentWidth = DEFAULT_GR_MODULE_THICKNESS;
// Layer thickness for 3D viewer
m_boardThickness = Millimeter2iu( DEFAULT_BOARD_THICKNESS_MM );
m_viaSizeIndex = 0;
m_trackWidthIndex = 0;
// Default values for the footprint editor and fp creation
// (also covers footprints created on the fly by micor-waves tools)
m_ModuleTextSize = wxSize( DEFAULT_TEXT_MODULE_SIZE,
DEFAULT_TEXT_MODULE_SIZE );
m_ModuleTextWidth = DEFAULT_GR_MODULE_THICKNESS;
m_ModuleSegmentWidth = DEFAULT_GR_MODULE_THICKNESS;
// These values will be overriden by config values after reading the config
// Default ref text on fp creation. if empty, use footprint name as default
m_RefDefaultText = wxT( "REF**" );
m_RefDefaultVisibility = true; // Default ref text visibility on fp creation
m_RefDefaultlayer = int( F_SilkS ); // Default ref text layer on fp creation
// Default value text on fp creation. if empty, use footprint name as default
m_ValueDefaultText = wxEmptyString;
m_ValueDefaultVisibility = true;
m_ValueDefaultlayer = int( F_Fab );
}
// Add parameters to save in project config.

View File

@ -157,8 +157,11 @@ public:
*/
MODULE* GetParentModule() const;
const std::vector<wxPoint>& GetBezierPoints() const { return m_BezierPoints; };
const std::vector<wxPoint>& GetPolyPoints() const { return m_PolyPoints; };
// Accessors:
const std::vector<wxPoint>& GetBezierPoints() const { return m_BezierPoints; }
const std::vector<wxPoint>& GetPolyPoints() const { return m_PolyPoints; }
// same accessor, to add/change corners of the polygon
std::vector<wxPoint>& GetPolyPoints() { return m_PolyPoints; }
void SetBezierPoints( const std::vector<wxPoint>& aPoints )
{

View File

@ -514,7 +514,7 @@ private:
m_cur_grid = ( m_pageNdx == 0 ) ? m_global_grid : m_project_grid;
}
void appendRowHandler( wxMouseEvent& event )
void appendRowHandler( wxCommandEvent& event )
{
if( m_cur_grid->AppendRows( 1 ) )
{
@ -527,7 +527,7 @@ private:
}
}
void deleteRowHandler( wxMouseEvent& event )
void deleteRowHandler( wxCommandEvent& event )
{
#if 1
int currRow = getCursorRow();
@ -564,7 +564,7 @@ private:
#endif
}
void moveUpHandler( wxMouseEvent& event )
void moveUpHandler( wxCommandEvent& event )
{
int curRow = getCursorRow();
if( curRow >= 1 )
@ -596,7 +596,7 @@ private:
}
}
void moveDownHandler( wxMouseEvent& event )
void moveDownHandler( wxCommandEvent& event )
{
FP_TBL_MODEL* tbl = cur_model();
@ -628,7 +628,7 @@ private:
}
}
void optionsEditor( wxMouseEvent& event )
void optionsEditor( wxCommandEvent& event )
{
FP_TBL_MODEL* tbl = cur_model();

View File

@ -206,14 +206,14 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
wxBoxSizer* m_bottom_sizer;
m_bottom_sizer = new wxBoxSizer( wxVERTICAL );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
m_bottom_sizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 5 );
m_bottom_sizer->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 5 );
bSizer1->Add( m_bottom_sizer, 0, wxEXPAND, 5 );
@ -228,14 +228,14 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FP_LIB_TABLE_BASE::onCancelCaptionButtonClick ) );
this->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( DIALOG_FP_LIB_TABLE_BASE::onKeyDown ) );
m_auinotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( DIALOG_FP_LIB_TABLE_BASE::pageChangedHandler ), NULL, this );
m_append_button->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
m_append_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
m_buttonWizard->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::OnClickLibraryWizard ), NULL, this );
m_delete_button->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::deleteRowHandler ), NULL, this );
m_move_up_button->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveUpHandler ), NULL, this );
m_move_down_button->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveDownHandler ), NULL, this );
m_edit_options->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::optionsEditor ), NULL, this );
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onCancelButtonClick ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onOKButtonClick ), NULL, this );
m_delete_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::deleteRowHandler ), NULL, this );
m_move_up_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveUpHandler ), NULL, this );
m_move_down_button->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveDownHandler ), NULL, this );
m_edit_options->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::optionsEditor ), NULL, this );
m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onCancelButtonClick ), NULL, this );
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onOKButtonClick ), NULL, this );
}
DIALOG_FP_LIB_TABLE_BASE::~DIALOG_FP_LIB_TABLE_BASE()
@ -244,13 +244,13 @@ DIALOG_FP_LIB_TABLE_BASE::~DIALOG_FP_LIB_TABLE_BASE()
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FP_LIB_TABLE_BASE::onCancelCaptionButtonClick ) );
this->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( DIALOG_FP_LIB_TABLE_BASE::onKeyDown ) );
m_auinotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( DIALOG_FP_LIB_TABLE_BASE::pageChangedHandler ), NULL, this );
m_append_button->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
m_append_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
m_buttonWizard->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::OnClickLibraryWizard ), NULL, this );
m_delete_button->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::deleteRowHandler ), NULL, this );
m_move_up_button->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveUpHandler ), NULL, this );
m_move_down_button->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveDownHandler ), NULL, this );
m_edit_options->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::optionsEditor ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onCancelButtonClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onOKButtonClick ), NULL, this );
m_delete_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::deleteRowHandler ), NULL, this );
m_move_up_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveUpHandler ), NULL, this );
m_move_down_button->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::moveDownHandler ), NULL, this );
m_edit_options->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::optionsEditor ), NULL, this );
m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onCancelButtonClick ), NULL, this );
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_FP_LIB_TABLE_BASE::onOKButtonClick ), NULL, this );
}

View File

@ -44,7 +44,7 @@
<property name="minimum_size"></property>
<property name="name">DIALOG_FP_LIB_TABLE_BASE</property>
<property name="pos"></property>
<property name="size">900,600</property>
<property name="size">634,600</property>
<property name="style">wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">PCB Library Tables</property>
@ -1093,7 +1093,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick"></event>
<event name="OnButtonClick">appendRowHandler</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
@ -1102,7 +1102,7 @@
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown">appendRowHandler</event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
@ -1269,7 +1269,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick"></event>
<event name="OnButtonClick">deleteRowHandler</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
@ -1278,7 +1278,7 @@
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown">deleteRowHandler</event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
@ -1357,7 +1357,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick"></event>
<event name="OnButtonClick">moveUpHandler</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
@ -1366,7 +1366,7 @@
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown">moveUpHandler</event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
@ -1445,7 +1445,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick"></event>
<event name="OnButtonClick">moveDownHandler</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
@ -1454,7 +1454,7 @@
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown">moveDownHandler</event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
@ -1533,7 +1533,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick"></event>
<event name="OnButtonClick">optionsEditor</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
@ -1542,7 +1542,7 @@
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown">optionsEditor</event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
@ -1743,7 +1743,7 @@
<property name="Save">0</property>
<property name="Yes">0</property>
<property name="minimum_size"></property>
<property name="name">m_sdbSizer1</property>
<property name="name">m_sdbSizer</property>
<property name="permission">protected</property>
<event name="OnApplyButtonClick"></event>
<event name="OnCancelButtonClick">onCancelButtonClick</event>

View File

@ -58,27 +58,27 @@ class DIALOG_FP_LIB_TABLE_BASE : public DIALOG_SHIM
wxButton* m_move_down_button;
wxButton* m_edit_options;
wxGrid* m_path_subs_grid;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void onCancelCaptionButtonClick( wxCloseEvent& event ) = 0;
virtual void onKeyDown( wxKeyEvent& event ) = 0;
virtual void pageChangedHandler( wxAuiNotebookEvent& event ) = 0;
virtual void appendRowHandler( wxMouseEvent& event ) = 0;
virtual void appendRowHandler( wxCommandEvent& event ) = 0;
virtual void OnClickLibraryWizard( wxCommandEvent& event ) = 0;
virtual void deleteRowHandler( wxMouseEvent& event ) = 0;
virtual void moveUpHandler( wxMouseEvent& event ) = 0;
virtual void moveDownHandler( wxMouseEvent& event ) = 0;
virtual void optionsEditor( wxMouseEvent& event ) = 0;
virtual void deleteRowHandler( wxCommandEvent& event ) = 0;
virtual void moveUpHandler( wxCommandEvent& event ) = 0;
virtual void moveDownHandler( wxCommandEvent& event ) = 0;
virtual void optionsEditor( wxCommandEvent& event ) = 0;
virtual void onCancelButtonClick( wxCommandEvent& event ) = 0;
virtual void onOKButtonClick( wxCommandEvent& event ) = 0;
public:
DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("PCB Library Tables"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 900,600 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("PCB Library Tables"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 634,600 ), long style = wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU );
~DIALOG_FP_LIB_TABLE_BASE();
};

View File

@ -0,0 +1,133 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2015 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_modedit_options.cpp
*/
#include <fctsys.h>
#include <pcbnew.h>
#include <wxPcbStruct.h>
#include <class_board_design_settings.h>
#include <base_units.h>
#include <module_editor_frame.h>
//#include <class_board.h>
#include <dialog_modedit_options_base.h>
class DIALOG_MODEDIT_OPTIONS : public DIALOG_MODEDIT_OPTIONS_BASE
{
BOARD_DESIGN_SETTINGS m_brdSettings;
FOOTPRINT_EDIT_FRAME * m_parent;
public:
DIALOG_MODEDIT_OPTIONS( FOOTPRINT_EDIT_FRAME* aParent );
private:
void OnCancelClick( wxCommandEvent& event ) { EndModal( wxID_CANCEL ); }
void OnOkClick( wxCommandEvent& event );
void initValues( );
};
DIALOG_MODEDIT_OPTIONS::DIALOG_MODEDIT_OPTIONS( FOOTPRINT_EDIT_FRAME* aParent ) :
DIALOG_MODEDIT_OPTIONS_BASE( aParent )
{
m_parent = aParent;
m_brdSettings = m_parent->GetDesignSettings();
initValues( );
GetSizer()->SetSizeHints( this );
Centre();
}
bool InvokeFPEditorPrefsDlg( FOOTPRINT_EDIT_FRAME* aCaller )
{
DIALOG_MODEDIT_OPTIONS dlg( aCaller );
int ret = dlg.ShowModal();
return ret == wxID_OK;
}
void DIALOG_MODEDIT_OPTIONS::initValues()
{
EDA_UNITS_T units = g_UserUnit;
// Modules: graphic lines width:
m_staticTextGrLineUnit->SetLabel( GetAbbreviatedUnitsLabel( units ) );
PutValueInLocalUnits( *m_OptModuleGrLineWidth, m_brdSettings.m_ModuleSegmentWidth );
// Modules: Texts: Size & width:
m_staticTextTextWidthUnit->SetLabel( GetAbbreviatedUnitsLabel( units ) );
PutValueInLocalUnits( *m_OptModuleTextWidth, m_brdSettings.m_ModuleTextWidth );
m_staticTextTextVSizeUnit->SetLabel( GetAbbreviatedUnitsLabel( units ) );
PutValueInLocalUnits( *m_OptModuleTextVSize, m_brdSettings.m_ModuleTextSize.y );
m_staticTextTextHSizeUnit->SetLabel( GetAbbreviatedUnitsLabel( units ) );
PutValueInLocalUnits( *m_OptModuleTextHSize, m_brdSettings.m_ModuleTextSize.x );
// Ref: default values
m_textCtrlRefText->SetValue( m_brdSettings.m_RefDefaultText );
int sel = m_brdSettings.m_RefDefaultlayer == F_SilkS ? 0 : 1;
m_choiceLayerReference->SetSelection( sel );
sel = m_brdSettings.m_RefDefaultVisibility ? 0 : 1;
m_choiceVisibleReference->SetSelection( sel );
// Value: default values
m_textCtrlValueText->SetValue( m_brdSettings.m_ValueDefaultText );
sel = m_brdSettings.m_ValueDefaultlayer == F_SilkS ? 0 : 1;
m_choiceLayerValue->SetSelection( sel );
sel = m_brdSettings.m_ValueDefaultVisibility ? 0 : 1;
m_choiceVisibleValue->SetSelection( sel );
}
void DIALOG_MODEDIT_OPTIONS::OnOkClick( wxCommandEvent& event )
{
m_brdSettings.m_ModuleSegmentWidth = ValueFromTextCtrl( *m_OptModuleGrLineWidth );
m_brdSettings.m_ModuleTextWidth = ValueFromTextCtrl( *m_OptModuleTextWidth );
m_brdSettings.m_ModuleTextSize.y = ValueFromTextCtrl( *m_OptModuleTextVSize );
m_brdSettings.m_ModuleTextSize.x = ValueFromTextCtrl( *m_OptModuleTextHSize );
// Ref: default values
m_brdSettings.m_RefDefaultText = m_textCtrlRefText->GetValue();
int sel = m_choiceLayerReference->GetSelection();
m_brdSettings.m_RefDefaultlayer = sel == 1 ? F_Fab : F_SilkS;
sel = m_choiceVisibleReference->GetSelection();
m_brdSettings.m_RefDefaultVisibility = sel != 1;
// Value: default values
m_brdSettings.m_ValueDefaultText = m_textCtrlValueText->GetValue();
sel = m_choiceLayerValue->GetSelection();
m_brdSettings.m_ValueDefaultlayer = sel == 1 ? F_Fab : F_SilkS;
sel = m_choiceVisibleValue->GetSelection();
m_brdSettings.m_ValueDefaultVisibility = sel != 1;
m_parent->SetDesignSettings( m_brdSettings );
EndModal( wxID_OK );
}

View File

@ -0,0 +1,197 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_modedit_options_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_MODEDIT_OPTIONS_BASE::DIALOG_MODEDIT_OPTIONS_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* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerUpper;
bSizerUpper = new wxBoxSizer( wxVERTICAL );
m_staticText281 = new wxStaticText( this, wxID_ANY, _("On new graphic item creation:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText281->Wrap( -1 );
m_staticText281->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
bSizerUpper->Add( m_staticText281, 0, wxALL, 5 );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizer1->AddGrowableCol( 1 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_EdgeModEWidthTitle = new wxStaticText( this, wxID_ANY, _("Graphic line width"), wxDefaultPosition, wxDefaultSize, 0 );
m_EdgeModEWidthTitle->Wrap( -1 );
fgSizer1->Add( m_EdgeModEWidthTitle, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_OptModuleGrLineWidth = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_OptModuleGrLineWidth->SetMaxLength( 0 );
fgSizer1->Add( m_OptModuleGrLineWidth, 0, wxEXPAND|wxALL, 5 );
m_staticTextGrLineUnit = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGrLineUnit->Wrap( -1 );
fgSizer1->Add( m_staticTextGrLineUnit, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_TextModWidthTitle = new wxStaticText( this, wxID_ANY, _("Text width"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextModWidthTitle->Wrap( -1 );
fgSizer1->Add( m_TextModWidthTitle, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_OptModuleTextWidth = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_OptModuleTextWidth->SetMaxLength( 0 );
fgSizer1->Add( m_OptModuleTextWidth, 0, wxEXPAND|wxALL, 5 );
m_staticTextTextWidthUnit = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextTextWidthUnit->Wrap( -1 );
fgSizer1->Add( m_staticTextTextWidthUnit, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_TextModSizeVTitle = new wxStaticText( this, wxID_ANY, _("Text size V"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextModSizeVTitle->Wrap( -1 );
fgSizer1->Add( m_TextModSizeVTitle, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_OptModuleTextVSize = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_OptModuleTextVSize->SetMaxLength( 0 );
fgSizer1->Add( m_OptModuleTextVSize, 0, wxEXPAND|wxALL, 5 );
m_staticTextTextVSizeUnit = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextTextVSizeUnit->Wrap( -1 );
fgSizer1->Add( m_staticTextTextVSizeUnit, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_TextModSizeHTitle = new wxStaticText( this, wxID_ANY, _("Text size H"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextModSizeHTitle->Wrap( -1 );
fgSizer1->Add( m_TextModSizeHTitle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_OptModuleTextHSize = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_OptModuleTextHSize->SetMaxLength( 0 );
fgSizer1->Add( m_OptModuleTextHSize, 0, wxEXPAND|wxALL, 5 );
m_staticTextTextHSizeUnit = new wxStaticText( this, wxID_ANY, _("unit"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextTextHSizeUnit->Wrap( -1 );
fgSizer1->Add( m_staticTextTextHSizeUnit, 0, wxALL, 5 );
bSizerUpper->Add( fgSizer1, 1, wxEXPAND|wxLEFT, 20 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerUpper->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
m_staticText28 = new wxStaticText( this, wxID_ANY, _("Default values on new footprint creation:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText28->Wrap( -1 );
m_staticText28->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
bSizerUpper->Add( m_staticText28, 0, wxALL, 5 );
m_staticTextInfo = new wxStaticText( this, wxID_ANY, _("Leave ref or value blank to use the footprint name as default text"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextInfo->Wrap( -1 );
bSizerUpper->Add( m_staticTextInfo, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
wxFlexGridSizer* fgSizer2;
fgSizer2 = new wxFlexGridSizer( 0, 6, 0, 0 );
fgSizer2->AddGrowableCol( 1 );
fgSizer2->AddGrowableCol( 3 );
fgSizer2->AddGrowableCol( 5 );
fgSizer2->SetFlexibleDirection( wxBOTH );
fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextRef = new wxStaticText( this, wxID_ANY, _("Ref"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextRef->Wrap( -1 );
fgSizer2->Add( m_staticTextRef, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_textCtrlRefText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_textCtrlRefText->SetToolTip( _("Default text for reference\nLeave blank to use the footprint name") );
fgSizer2->Add( m_textCtrlRefText, 0, wxALL|wxEXPAND, 5 );
m_staticTextRefLayer = new wxStaticText( this, wxID_ANY, _("Layer"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextRefLayer->Wrap( -1 );
fgSizer2->Add( m_staticTextRefLayer, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
wxString m_choiceLayerReferenceChoices[] = { _("SilkScreen"), _("Fab. Layer") };
int m_choiceLayerReferenceNChoices = sizeof( m_choiceLayerReferenceChoices ) / sizeof( wxString );
m_choiceLayerReference = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceLayerReferenceNChoices, m_choiceLayerReferenceChoices, 0 );
m_choiceLayerReference->SetSelection( 0 );
fgSizer2->Add( m_choiceLayerReference, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_staticText32 = new wxStaticText( this, wxID_ANY, _("Visibility"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText32->Wrap( -1 );
fgSizer2->Add( m_staticText32, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
wxString m_choiceVisibleReferenceChoices[] = { _("Visible"), _("Invisible") };
int m_choiceVisibleReferenceNChoices = sizeof( m_choiceVisibleReferenceChoices ) / sizeof( wxString );
m_choiceVisibleReference = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceVisibleReferenceNChoices, m_choiceVisibleReferenceChoices, 0 );
m_choiceVisibleReference->SetSelection( 0 );
fgSizer2->Add( m_choiceVisibleReference, 0, wxALL|wxEXPAND, 5 );
m_staticTextValue = new wxStaticText( this, wxID_ANY, _("Value"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextValue->Wrap( -1 );
fgSizer2->Add( m_staticTextValue, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
m_textCtrlValueText = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_textCtrlValueText->SetToolTip( _("Default text for value\nLeave blank to use the footprint name") );
fgSizer2->Add( m_textCtrlValueText, 0, wxALL|wxEXPAND, 5 );
m_staticTextValLayer = new wxStaticText( this, wxID_ANY, _("Layer"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextValLayer->Wrap( -1 );
fgSizer2->Add( m_staticTextValLayer, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
wxString m_choiceLayerValueChoices[] = { _("SilkScreen"), _("Fab. Layer") };
int m_choiceLayerValueNChoices = sizeof( m_choiceLayerValueChoices ) / sizeof( wxString );
m_choiceLayerValue = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceLayerValueNChoices, m_choiceLayerValueChoices, 0 );
m_choiceLayerValue->SetSelection( 1 );
fgSizer2->Add( m_choiceLayerValue, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 );
m_staticTextValVisibility = new wxStaticText( this, wxID_ANY, _("Visibility"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextValVisibility->Wrap( -1 );
fgSizer2->Add( m_staticTextValVisibility, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 5 );
wxString m_choiceVisibleValueChoices[] = { _("Visible"), _("Invisible") };
int m_choiceVisibleValueNChoices = sizeof( m_choiceVisibleValueChoices ) / sizeof( wxString );
m_choiceVisibleValue = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceVisibleValueNChoices, m_choiceVisibleValueChoices, 0 );
m_choiceVisibleValue->SetSelection( 0 );
fgSizer2->Add( m_choiceVisibleValue, 0, wxALL|wxEXPAND, 5 );
bSizerUpper->Add( fgSizer2, 0, wxEXPAND|wxLEFT, 20 );
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerUpper->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 );
bSizerMain->Add( bSizerUpper, 1, wxEXPAND, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
bSizerMain->Add( m_sdbSizer1, 0, wxALIGN_RIGHT|wxEXPAND|wxTOP|wxBOTTOM, 5 );
this->SetSizer( bSizerMain );
this->Layout();
// Connect Events
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODEDIT_OPTIONS_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODEDIT_OPTIONS_BASE::OnOkClick ), NULL, this );
}
DIALOG_MODEDIT_OPTIONS_BASE::~DIALOG_MODEDIT_OPTIONS_BASE()
{
// Disconnect Events
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODEDIT_OPTIONS_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_MODEDIT_OPTIONS_BASE::OnOkClick ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,86 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_MODEDIT_OPTIONS_BASE_H__
#define __DIALOG_MODEDIT_OPTIONS_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/choice.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_MODEDIT_OPTIONS_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_MODEDIT_OPTIONS_BASE : public DIALOG_SHIM
{
private:
protected:
wxStaticText* m_staticText281;
wxStaticText* m_EdgeModEWidthTitle;
wxTextCtrl* m_OptModuleGrLineWidth;
wxStaticText* m_staticTextGrLineUnit;
wxStaticText* m_TextModWidthTitle;
wxTextCtrl* m_OptModuleTextWidth;
wxStaticText* m_staticTextTextWidthUnit;
wxStaticText* m_TextModSizeVTitle;
wxTextCtrl* m_OptModuleTextVSize;
wxStaticText* m_staticTextTextVSizeUnit;
wxStaticText* m_TextModSizeHTitle;
wxTextCtrl* m_OptModuleTextHSize;
wxStaticText* m_staticTextTextHSizeUnit;
wxStaticLine* m_staticline1;
wxStaticText* m_staticText28;
wxStaticText* m_staticTextInfo;
wxStaticText* m_staticTextRef;
wxTextCtrl* m_textCtrlRefText;
wxStaticText* m_staticTextRefLayer;
wxChoice* m_choiceLayerReference;
wxStaticText* m_staticText32;
wxChoice* m_choiceVisibleReference;
wxStaticText* m_staticTextValue;
wxTextCtrl* m_textCtrlValueText;
wxStaticText* m_staticTextValLayer;
wxChoice* m_choiceLayerValue;
wxStaticText* m_staticTextValVisibility;
wxChoice* m_choiceVisibleValue;
wxStaticLine* m_staticline2;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
// 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_MODEDIT_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Footprint Editor Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 502,352 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_MODEDIT_OPTIONS_BASE();
};
#endif //__DIALOG_MODEDIT_OPTIONS_BASE_H__

View File

@ -46,7 +46,6 @@
class wxTopLevelWindow;
class wxPoint;
class wxSize;
//class wxRealPoint;
class wxString;
class BOARD;
@ -55,6 +54,7 @@ class MODULE;
// Often this is not used in the prototypes, since wxFrame is good enough and would
// represent maximum information hiding.
class PCB_BASE_FRAME;
class FOOTPRINT_EDIT_FRAME;
class FP_LIB_TABLE;
class BOARD;
class PCB_PLOT_PARAMS;
@ -124,4 +124,12 @@ bool InvokeLayerSetup( wxTopLevelWindow* aCaller, BOARD* aBoard );
*/
bool InvokeSVGPrint( wxTopLevelWindow* aCaller, BOARD* aBoard, PCB_PLOT_PARAMS* aSettings );
/**
* Function InvokeSVGPrint
* shows the SVG print dialog
* @param aCaller is the FOOTPRINT_EDIT_FRAME which is invoking the dialog.
* @return bool - true if user pressed OK (did not abort), else false.
*/
bool InvokeFPEditorPrefsDlg( FOOTPRINT_EDIT_FRAME* aCaller );
#endif // INVOKE_A_DIALOG_H_

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 1992-2015 KiCad Developers, see change_log.txt for contributors.
*
*
* This program is free software; you can redistribute it and/or
@ -594,7 +594,7 @@ void PCB_EDIT_FRAME::ArchiveModulesOnBoard( bool aNewModulesOnly )
}
bool PCB_BASE_FRAME::Save_Module_In_Library( const wxString& aLibrary,
bool FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary( const wxString& aLibrary,
MODULE* aModule,
bool aOverwrite,
bool aDisplayDialog )
@ -708,15 +708,18 @@ bool PCB_BASE_FRAME::Save_Module_In_Library( const wxString& aLibrary,
}
MODULE* PCB_BASE_FRAME::Create_1_Module( const wxString& aModuleName )
MODULE* PCB_BASE_FRAME::CreateNewModule( const wxString& aModuleName )
{
MODULE* module;
wxString moduleName;
wxPoint newpos;
// Creates a new footprint at position 0,0 which contains the minimal items:
// the reference and the value.
// Value : initialized to the footprint name.
// put on fab layer (front side)
// Reference : initialized to a default value (REF**).
// put on silkscreen layer (front side)
moduleName = aModuleName;
wxString moduleName = aModuleName;
// Ask for the new module reference
// Ask for the new module name
if( moduleName.IsEmpty() )
{
wxTextEntryDialog dlg( this, FMT_MOD_REF, FMT_MOD_CREATE, moduleName );
@ -736,28 +739,44 @@ MODULE* PCB_BASE_FRAME::Create_1_Module( const wxString& aModuleName )
}
// Creates the new module and add it to the head of the linked list of modules
module = new MODULE( GetBoard() );
MODULE* module = new MODULE( GetBoard() );
GetBoard()->Add( module );
// Update parameters: position, timestamp ...
newpos = GetCrossHairPosition();
module->SetPosition( newpos );
// Update parameters: timestamp ...
module->SetLastEditTime();
// Update its name in lib
module->SetFPID( FPID( moduleName ) );
wxPoint default_pos;
BOARD_DESIGN_SETTINGS& settings = GetDesignSettings();
// Update reference:
module->SetReference( moduleName );
module->Reference().SetThickness( GetDesignSettings().m_ModuleTextWidth );
module->Reference().SetSize( GetDesignSettings().m_ModuleTextSize );
if( settings.m_RefDefaultText.IsEmpty() )
module->SetReference( moduleName );
else
module->SetReference( settings.m_RefDefaultText );
module->Reference().SetThickness( settings.m_ModuleTextWidth );
module->Reference().SetSize( settings.m_ModuleTextSize );
default_pos.y = GetDesignSettings().m_ModuleTextSize.y / 2;
module->Reference().SetPosition( default_pos );
module->Reference().SetLayer( ToLAYER_ID( settings.m_RefDefaultlayer ) );
module->Reference().SetVisible( settings.m_RefDefaultVisibility );
// Set the value field to a default value
module->SetValue( wxT( "VAL**" ) );
if( settings.m_ValueDefaultText.IsEmpty() )
module->SetValue( moduleName );
else
module->SetValue( settings.m_ValueDefaultText );
module->Value().SetThickness( GetDesignSettings().m_ModuleTextWidth );
module->Value().SetSize( GetDesignSettings().m_ModuleTextSize );
module->SetPosition( wxPoint( 0, 0 ) );
default_pos.y = -default_pos.y;
module->Value().SetPosition( default_pos );
module->Value().SetLayer( ToLAYER_ID( settings.m_ValueDefaultlayer ) );
module->Value().SetVisible( settings.m_ValueDefaultVisibility );
SetMsgPanel( module );
return module;

View File

@ -2,10 +2,10 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2015 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
@ -30,6 +30,7 @@
* @brief (Re)Create the main menubar for the module editor
*/
#include <fctsys.h>
#include <pgm_base.h>
#include <pcbnew.h>
#include <wxPcbStruct.h>
@ -150,7 +151,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
_( "Close footprint editor" ),
KiBitmap( exit_xpm ) );
// Menu Edit:
//----- Edit menu ------------------
wxMenu* editMenu = new wxMenu;
// Undo
@ -198,7 +199,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
_( "&User Grid Size" ), _( "Adjust user grid" ),
KiBitmap( grid_xpm ) );
// View menu
//--------- View menu ----------------
wxMenu* viewMenu = new wxMenu;
/* Important Note for ZOOM IN and ZOOM OUT commands from menubar:
@ -237,7 +238,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
_( "Show board in 3D viewer" ),
KiBitmap( three_d_xpm ) );
// Menu Place:
//-------- Place menu --------------------
wxMenu* placeMenu = new wxMenu;
// Pad
@ -276,7 +277,26 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
_( "Place footprint reference anchor" ),
KiBitmap( anchor_xpm ) );
// Menu Help:
//----- Preferences menu -----------------
wxMenu* prefs_menu = new wxMenu;
AddMenuItem( prefs_menu, ID_PCB_LIB_TABLE_EDIT,
_( "Li&brary Tables" ), _( "Setup footprint libraries" ),
KiBitmap( library_table_xpm ) );
// Settings
AddMenuItem( prefs_menu, wxID_PREFERENCES,
_( "&Settings" ), _( "Select default parameters values in Footprint Editor" ),
KiBitmap( preference_xpm ) );
// Language submenu
Pgm().AddMenuLanguageList( prefs_menu );
// Hotkey submenu
AddHotkeyConfigMenu( prefs_menu );
//----- Help menu --------------------
wxMenu* helpMenu = new wxMenu;
// Version info
@ -303,10 +323,10 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
// Append menus to the menubar
menuBar->Append( fileMenu, _( "&File" ) );
menuBar->Append( editMenu, _( "&Edit" ) );
menuBar->Append( dimensions_Submenu, _( "Di&mensions" ) );
menuBar->Append( viewMenu, _( "&View" ) );
menuBar->Append( placeMenu, _( "&Place" ) );
menuBar->Append( prefs_menu, _( "P&references" ) );
menuBar->Append( dimensions_Submenu, _( "Di&mensions" ) );
menuBar->Append( helpMenu, _( "&Help" ) );
menuBar->Thaw();

View File

@ -300,7 +300,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
SetCrossHairPosition( wxPoint( 0, 0 ) );
MODULE* module = Create_1_Module( wxEmptyString );
MODULE* module = CreateNewModule( wxEmptyString );
if( module ) // i.e. if create module command not aborted
{
@ -375,7 +375,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_MODEDIT_SAVE_LIBMODULE:
if( GetBoard()->m_Modules && GetCurrentLib().size() )
{
Save_Module_In_Library( GetCurrentLib(), GetBoard()->m_Modules, true, true );
SaveFootprintInLibrary( GetCurrentLib(), GetBoard()->m_Modules, true, true );
GetScreen()->ClrModify();
}
break;

View File

@ -3,8 +3,8 @@
*
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2015 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
@ -36,6 +36,7 @@
#include <wxPcbStruct.h>
#include <module_editor_frame.h>
#include <class_board_design_settings.h>
#include <layers_id_colors_and_visibility.h>
#include <pcbnew_id.h>
@ -78,3 +79,73 @@ void FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
break;
}
}
PARAM_CFG_ARRAY& FOOTPRINT_EDIT_FRAME::GetConfigurationSettings()
{
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
BOARD_DESIGN_SETTINGS& settings = GetDesignSettings();
if( m_configSettings.empty() )
{
// Display options:
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorUnits" ),
(int*)&g_UserUnit, MILLIMETRES ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorDisplayPolarCoords" ),
&displ_opts->m_DisplayPolarCood, false ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true, wxT( "FpEditorPadDisplayMode" ),
&displ_opts->m_DisplayPadFill, true ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorGraphicLinesDisplayMode" ),
&displ_opts->m_DisplayModEdge, FILLED, 0, 2 ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorTextsDisplayMode" ),
&displ_opts->m_DisplayModText, FILLED, 0, 2 ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorTextsDisplayMode" ),
&displ_opts->m_DisplayModText, FILLED, 0, 2 ) );
m_configSettings.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorTextsRefDefaultText" ),
&settings.m_RefDefaultText, wxT( "REF**" ) ) );
// design settings
m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorGrlineWidth" ),
&settings.m_ModuleSegmentWidth,
Millimeter2iu( 0.15 ),
Millimeter2iu( 0.01 ), Millimeter2iu( 100.0 ),
NULL, 1/IU_PER_MM ) );
m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultSizeH" ),
&settings.m_ModuleTextSize.x,
Millimeter2iu( 1.5 ),
Millimeter2iu( 0.01 ), Millimeter2iu( 100.0 ),
NULL, 1/IU_PER_MM ) );
m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultSizeV" ),
&settings.m_ModuleTextSize.y,
Millimeter2iu( 1.5 ),
Millimeter2iu(0.01), Millimeter2iu( 100.0 ),
NULL, 1/IU_PER_MM ) );
m_configSettings.push_back( new PARAM_CFG_INT_WITH_SCALE( true, wxT( "FpEditorTextsDefaultThickness" ),
&settings.m_ModuleTextWidth,
Millimeter2iu( 0.15 ),
Millimeter2iu( 0.01 ), Millimeter2iu( 20.0 ),
NULL, 1/IU_PER_MM ) );
m_configSettings.push_back( new PARAM_CFG_WXSTRING( true,
wxT( "FpEditorRefDefaultText" ),
&settings.m_RefDefaultText, wxT( "REF**" ) ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true,
wxT( "FpEditorRefDefaultVisibility" ),
&settings.m_RefDefaultVisibility, true ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorRefDefaultLayer" ),
&settings.m_RefDefaultlayer,
int( F_SilkS ), int( F_SilkS ), int( F_Fab ) ) );
m_configSettings.push_back( new PARAM_CFG_WXSTRING( true, wxT( "FpEditorValueDefaultText" ),
&settings.m_ValueDefaultText, wxT( "" ) ) );
m_configSettings.push_back( new PARAM_CFG_BOOL( true,
wxT( "FpEditorValueDefaultVisibility" ),
&settings.m_ValueDefaultVisibility, true ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "FpEditorValueDefaultLayer" ),
&settings.m_ValueDefaultlayer,
int( F_Fab ), int( F_SilkS ), int( F_Fab ) ) );
}
return m_configSettings;
}

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2015 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
@ -60,6 +60,23 @@ public:
const PCB_PLOT_PARAMS& GetPlotSettings() const; // overload PCB_BASE_FRAME, get parent's
void SetPlotSettings( const PCB_PLOT_PARAMS& aSettings ); // overload
void LoadSettings( wxConfigBase* aCfg ); // Virtual
void SaveSettings( wxConfigBase* aCfg ); // Virtual
/**
* Function GetConfigurationSettings
* returns the footprçint editor settings list.
*
* Currently, only the settings that are needed at start
* up by the main window are defined here. There are other locally used
* settings that are scattered throughout the Pcbnew source code. If you need
* to define a configuration setting that needs to be loaded at run time,
* this is the place to define it.
*
* @return - Reference to the list of applications settings.
*/
PARAM_CFG_ARRAY& GetConfigurationSettings();
void InstallOptionsFrame( const wxPoint& pos );
void OnCloseWindow( wxCloseEvent& Event );
@ -67,6 +84,8 @@ public:
void Process_Special_Functions( wxCommandEvent& event );
void ProcessPreferences( wxCommandEvent& event );
/**
* Function RedrawActiveWindoow
* draws the footprint editor BOARD, and others elements such as axis and grid.
@ -141,6 +160,7 @@ public:
void OnVerticalToolbar( wxCommandEvent& aEvent );
void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent );
void OnUpdateOptionsToolbar( wxUpdateUIEvent& aEvent );
void OnUpdateLibSelected( wxUpdateUIEvent& aEvent );
void OnUpdateModuleSelected( wxUpdateUIEvent& aEvent );
void OnUpdateLibAndModuleSelected( wxUpdateUIEvent& aEvent );
@ -158,6 +178,22 @@ public:
*/
void LoadModuleFromBoard( wxCommandEvent& event );
/**
* Function SaveFootprintInLibrary
* Save in an existing library a given footprint
* @param aLibName = name of the library to use
* @param aModule = the given footprint
* @param aOverwrite = true to overwrite an existing footprint, false to
* abort if an existing footprint with same name is found
* @param aDisplayDialog = true to display a dialog to enter or confirm the
* footprint name
* @return : true if OK, false if abort
*/
bool SaveFootprintInLibrary( const wxString& aLibName,
MODULE* aModule,
bool aOverwrite,
bool aDisplayDialog );
/**
* Virtual Function OnModify()
* Must be called after a footprint change
@ -470,6 +506,8 @@ protected:
PCB_LAYER_WIDGET* m_Layers;
PARAM_CFG_ARRAY m_configSettings; ///< List of footprint editor configuration settings.
/**
* Function UpdateTitle
* updates window title according to getLibNickName().

View File

@ -1,10 +1,10 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2015 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
@ -49,9 +49,12 @@
#include <pcbnew.h>
#include <pcbnew_id.h>
#include <hotkeys.h>
#include <dialog_hotkeys_editor.h>
#include <module_editor_frame.h>
#include <modview_frame.h>
#include <wildcards_and_files_ext.h>
#include <class_pcb_layer_widget.h>
#include <invoke_pcb_dialog.h>
#include <tool/tool_manager.h>
#include <tool/tool_dispatcher.h>
@ -115,6 +118,20 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar )
// Preferences et option menus
EVT_MENU( ID_PREFERENCES_HOTKEY_EXPORT_CONFIG,
FOOTPRINT_EDIT_FRAME::ProcessPreferences )
EVT_MENU( ID_PREFERENCES_HOTKEY_IMPORT_CONFIG,
FOOTPRINT_EDIT_FRAME::ProcessPreferences )
EVT_MENU( ID_PREFERENCES_HOTKEY_SHOW_EDITOR,
FOOTPRINT_EDIT_FRAME::ProcessPreferences )
EVT_MENU( ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST,
FOOTPRINT_EDIT_FRAME::ProcessPreferences )
EVT_MENU( ID_PCB_LIB_TABLE_EDIT,
FOOTPRINT_EDIT_FRAME::ProcessPreferences )
EVT_MENU( wxID_PREFERENCES,
FOOTPRINT_EDIT_FRAME::ProcessPreferences )
// popup commands
EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE,
FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
@ -159,10 +176,20 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
EVT_UPDATE_UI( ID_MODEDIT_UPDATE_MODULE_IN_BOARD,
FOOTPRINT_EDIT_FRAME::OnUpdateReplaceModuleInBoard )
EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar )
EVT_UPDATE_UI_RANGE( ID_MODEDIT_PAD_TOOL, ID_MODEDIT_PLACE_GRID_COORD,
FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar )
// Option toolbar:
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH,
FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH,
FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar )
FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar )
EVT_UPDATE_UI( ID_GEN_IMPORT_DXF_FILE,
FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected )
@ -425,11 +452,10 @@ BOARD_DESIGN_SETTINGS& FOOTPRINT_EDIT_FRAME::GetDesignSettings() const
// get the BOARD_DESIGN_SETTINGS from the parent editor, not our BOARD.
// @todo(DICK) change the routing to some default or the board directly, parent may not exist
PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true );
// PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true );
// wxASSERT( parentFrame );
wxASSERT( parentFrame );
return parentFrame->GetDesignSettings();
return GetBoard()->GetDesignSettings();
}
@ -438,11 +464,10 @@ void FOOTPRINT_EDIT_FRAME::SetDesignSettings( const BOARD_DESIGN_SETTINGS& aSett
// set the BOARD_DESIGN_SETTINGS into parent editor, not our BOARD.
// @todo(DICK) change the routing to some default or the board directly, parent may not exist
PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true );
// PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true );
// wxASSERT( parentFrame );
wxASSERT( parentFrame );
parentFrame->SetDesignSettings( aSettings );
GetBoard()->SetDesignSettings( aSettings );
}
@ -452,7 +477,6 @@ const PCB_PLOT_PARAMS& FOOTPRINT_EDIT_FRAME::GetPlotSettings() const
// @todo(DICK) change the routing to some default or the board directly, parent may not exist
PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true );
wxASSERT( parentFrame );
return parentFrame->GetPlotSettings();
@ -465,13 +489,35 @@ void FOOTPRINT_EDIT_FRAME::SetPlotSettings( const PCB_PLOT_PARAMS& aSettings )
// @todo(DICK) change the routing to some default or the board directly, parent may not exist
PCB_BASE_FRAME* parentFrame = (PCB_BASE_FRAME*) Kiway().Player( FRAME_PCB, true );
wxASSERT( parentFrame );
parentFrame->SetPlotSettings( aSettings );
}
void FOOTPRINT_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
{
EDA_DRAW_FRAME::LoadSettings( aCfg );
wxConfigLoadSetups( aCfg, GetConfigurationSettings() );
// Ensure some params are valid
BOARD_DESIGN_SETTINGS& settings = GetDesignSettings();
if( ( settings.m_RefDefaultlayer != F_SilkS ) && ( settings.m_RefDefaultlayer != F_Fab ) )
settings.m_RefDefaultlayer = F_SilkS;
if( ( settings.m_ValueDefaultlayer != F_SilkS ) && ( settings.m_ValueDefaultlayer != F_Fab ) )
settings.m_ValueDefaultlayer = F_Fab;
}
void FOOTPRINT_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg )
{
EDA_DRAW_FRAME::SaveSettings( aCfg );
wxConfigSaveSetups( aCfg, GetConfigurationSettings() );
}
void FOOTPRINT_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
{
if( GetScreen()->IsModify() )
@ -488,7 +534,7 @@ void FOOTPRINT_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
// at case ID_MODEDIT_SAVE_LIBMODULE
if( GetBoard()->m_Modules && GetCurrentLib().size() )
{
if( Save_Module_In_Library( GetCurrentLib(), GetBoard()->m_Modules, true, true ) )
if( SaveFootprintInLibrary( GetCurrentLib(), GetBoard()->m_Modules, true, true ) )
{
// save was correct
GetScreen()->ClrModify();
@ -526,6 +572,43 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent )
aEvent.Check( GetToolId() == aEvent.GetId() );
}
void FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar( wxUpdateUIEvent& aEvent )
{
int id = aEvent.GetId();
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
bool state = false;
switch( id )
{
case ID_TB_OPTIONS_SHOW_PADS_SKETCH:
state = !displ_opts->m_DisplayPadFill;
break;
case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
state = !displ_opts->m_DisplayViaFill;
break;
case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH:
state = displ_opts->m_DisplayModText == SKETCH;
break;
case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH:
state = displ_opts->m_DisplayModEdge == SKETCH;
break;
case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE:
state = displ_opts->m_ContrastModeDisplay;
break;
default:
wxMessageBox( wxT( "FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar error" ) );
break;
}
aEvent.Check( state );
}
void FOOTPRINT_EDIT_FRAME::OnUpdateLibSelected( wxUpdateUIEvent& aEvent )
{
@ -754,3 +837,90 @@ void FOOTPRINT_EDIT_FRAME::SetElementVisibility( int aElement, bool aNewState )
m_Layers->SetRenderState( aElement, aNewState );
}
void FOOTPRINT_EDIT_FRAME::ProcessPreferences( wxCommandEvent& event )
{
int id = event.GetId();
switch( id )
{
// Hotkey IDs
case ID_PREFERENCES_HOTKEY_EXPORT_CONFIG:
ExportHotkeyConfigToFile( g_Module_Editor_Hokeys_Descr );
break;
case ID_PREFERENCES_HOTKEY_IMPORT_CONFIG:
ImportHotkeyConfigFromFile( g_Module_Editor_Hokeys_Descr );
break;
case ID_PREFERENCES_HOTKEY_SHOW_EDITOR:
InstallHotkeyFrame( this, g_Module_Editor_Hokeys_Descr );
break;
case ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST:
// Display current hotkey list for the footprint editor.
DisplayHotkeyList( this, g_Module_Editor_Hokeys_Descr );
break;
case ID_PCB_LIB_TABLE_EDIT:
{
bool tableChanged = false;
int r = InvokePcbLibTableEditor( this, &GFootprintTable, Prj().PcbFootprintLibs() );
if( r & 1 )
{
try
{
FILE_OUTPUTFORMATTER sf( FP_LIB_TABLE::GetGlobalTableFileName() );
GFootprintTable.Format( &sf, 0 );
tableChanged = true;
}
catch( const IO_ERROR& ioe )
{
wxString msg = wxString::Format( _(
"Error occurred saving the global footprint library "
"table:\n\n%s" ),
GetChars( ioe.errorText.GetData() )
);
wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
}
}
if( r & 2 )
{
wxString tblName = Prj().FootprintLibTblName();
try
{
Prj().PcbFootprintLibs()->Save( tblName );
tableChanged = true;
}
catch( const IO_ERROR& ioe )
{
wxString msg = wxString::Format( _(
"Error occurred saving project specific footprint library "
"table:\n\n%s" ),
GetChars( ioe.errorText )
);
wxMessageBox( msg, _( "File Save Error" ), wxOK | wxICON_ERROR );
}
}
FOOTPRINT_VIEWER_FRAME* viewer;
viewer = (FOOTPRINT_VIEWER_FRAME*)Kiway().Player( FRAME_PCB_MODULE_VIEWER, false );
if( tableChanged && viewer != NULL )
viewer->ReCreateLibraryList();
}
break;
case wxID_PREFERENCES:
InvokeFPEditorPrefsDlg( this );
break;
default:
DisplayError( this, wxT( "FOOTPRINT_EDIT_FRAME::ProcessPreferences error" ) );
}
}

View File

@ -1,10 +1,10 @@
/*
* 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) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2015 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
@ -42,6 +42,7 @@
#include <gr_basic.h>
#include <macros.h>
#include <base_units.h>
#include <validators.h>
#include <class_board.h>
#include <class_module.h>
@ -49,21 +50,19 @@
#include <pcbnew.h>
#define COEFF_COUNT 6
static std::vector< double > PolyEdges;
static std::vector< wxRealPoint > PolyEdges;
static double ShapeScaleX, ShapeScaleY;
static wxSize ShapeSize;
static int PolyShapeType;
static void Exit_Self( EDA_DRAW_PANEL* Panel, wxDC* DC );
static void Exit_Self( EDA_DRAW_PANEL* aPanel, wxDC* aDC );
static void gen_arc( std::vector <wxPoint>& aBuffer,
wxPoint aStartPoint,
wxPoint aCenter,
int a_ArcAngle );
static void ShowBoundingBoxMicroWaveInductor( EDA_DRAW_PANEL* apanel,
static void ShowBoundingBoxMicroWaveInductor( EDA_DRAW_PANEL* aPanel,
wxDC* aDC,
const wxPoint& aPosition,
bool aErase );
@ -73,19 +72,20 @@ int BuildCornersList_S_Shape( std::vector <wxPoint>& aBuffer,
wxPoint aStartPoint, wxPoint aEndPoint,
int aLength, int aWidth );
class SELFPCB
class MUWAVE_INDUCTOR
{
public:
int forme; // Shape: coil, spiral, etc ..
wxPoint m_Start;
wxPoint m_End;
wxSize m_Size;
int lng; // Trace length.
int m_Width; // Trace width.
int m_lenght; // full length trace.
int m_Width; // Trace width.
// A flag set to true when mu-wave inductor is being created
bool m_Flag;
};
static SELFPCB Mself;
static int Self_On;
// An instance of MUWAVE_INDUCTOR temporary used during mu-wave inductor creation
static MUWAVE_INDUCTOR s_inductor_pattern;
/* This function shows on screen the bounding box of the inductor that will be
@ -101,19 +101,19 @@ static void ShowBoundingBoxMicroWaveInductor( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
GRSetDrawMode( aDC, GR_XOR );
wxPoint poly[5];
wxPoint pt = Mself.m_End - Mself.m_Start;
wxPoint pt = s_inductor_pattern.m_End - s_inductor_pattern.m_Start;
double angle = -ArcTangente( pt.y, pt.x );
int len = KiROUND( EuclideanNorm( pt ) );
// calculate corners
pt.x = 0; pt.y = len / 4;
RotatePoint( &pt, angle );
poly[0] = Mself.m_Start + pt;
poly[1] = Mself.m_End + pt;
poly[0] = s_inductor_pattern.m_Start + pt;
poly[1] = s_inductor_pattern.m_End + pt;
pt.x = 0; pt.y = -len / 4;
RotatePoint( &pt, angle );
poly[2] = Mself.m_End + pt;
poly[3] = Mself.m_Start + pt;
poly[2] = s_inductor_pattern.m_End + pt;
poly[3] = s_inductor_pattern.m_Start + pt;
poly[4] = poly[0];
if( aErase )
@ -121,48 +121,48 @@ static void ShowBoundingBoxMicroWaveInductor( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
GRPoly( aPanel->GetClipBox(), aDC, 5, poly, false, 0, YELLOW, YELLOW );
}
Mself.m_End = aPanel->GetParent()->GetCrossHairPosition();
pt = Mself.m_End - Mself.m_Start;
s_inductor_pattern.m_End = aPanel->GetParent()->GetCrossHairPosition();
pt = s_inductor_pattern.m_End - s_inductor_pattern.m_Start;
angle = -ArcTangente( pt.y, pt.x );
len = KiROUND( EuclideanNorm( pt ) );
// calculate new corners
pt.x = 0; pt.y = len / 4;
RotatePoint( &pt, angle );
poly[0] = Mself.m_Start + pt;
poly[1] = Mself.m_End + pt;
poly[0] = s_inductor_pattern.m_Start + pt;
poly[1] = s_inductor_pattern.m_End + pt;
pt.x = 0; pt.y = -len / 4;
RotatePoint( &pt, angle );
poly[2] = Mself.m_End + pt;
poly[3] = Mself.m_Start + pt;
poly[2] = s_inductor_pattern.m_End + pt;
poly[3] = s_inductor_pattern.m_Start + pt;
poly[4] = poly[0];
GRPoly( aPanel->GetClipBox(), aDC, 5, poly, false, 0, YELLOW, YELLOW );
}
void Exit_Self( EDA_DRAW_PANEL* Panel, wxDC* DC )
void Exit_Self( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
{
if( Self_On )
{
Self_On = 0;
Panel->CallMouseCapture( DC, wxDefaultPosition, 0 );
}
if( aPanel->IsMouseCaptured() )
aPanel->CallMouseCapture( aDC, wxDefaultPosition, false );
s_inductor_pattern.m_Flag = false;
aPanel->SetMouseCapture( NULL, NULL );
}
void PCB_EDIT_FRAME::Begin_Self( wxDC* DC )
{
if( Self_On )
if( s_inductor_pattern.m_Flag )
{
Genere_Self( DC );
return;
}
Mself.m_Start = GetCrossHairPosition();
Mself.m_End = Mself.m_Start;
s_inductor_pattern.m_Start = GetCrossHairPosition();
s_inductor_pattern.m_End = s_inductor_pattern.m_Start;
Self_On = 1;
s_inductor_pattern.m_Flag = true;
// Update the initial coordinates.
GetScreen()->m_O_Curseur = GetCrossHairPosition();
@ -182,42 +182,44 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC )
m_canvas->CallMouseCapture( DC, wxDefaultPosition, false );
m_canvas->SetMouseCapture( NULL, NULL );
if( Self_On == 0 )
if( s_inductor_pattern.m_Flag == false )
{
DisplayError( this, wxT( "Starting point not init.." ) );
return NULL;
}
Self_On = 0;
s_inductor_pattern.m_Flag = false;
Mself.m_End = GetCrossHairPosition();
s_inductor_pattern.m_End = GetCrossHairPosition();
wxPoint pt = Mself.m_End - Mself.m_Start;
wxPoint pt = s_inductor_pattern.m_End - s_inductor_pattern.m_Start;
int min_len = KiROUND( EuclideanNorm( pt ) );
Mself.lng = min_len;
s_inductor_pattern.m_lenght = min_len;
// Enter the desired length.
msg = StringFromValue( g_UserUnit, Mself.lng );
wxTextEntryDialog dlg( this, _( "Length:" ), _( "Length" ), msg );
msg = StringFromValue( g_UserUnit, s_inductor_pattern.m_lenght );
wxTextEntryDialog dlg( this, wxEmptyString, _( "Length of Trace:" ), msg );
if( dlg.ShowModal() != wxID_OK )
return NULL; // canceled by user
msg = dlg.GetValue();
Mself.lng = ValueFromString( g_UserUnit, msg );
s_inductor_pattern.m_lenght = ValueFromString( g_UserUnit, msg );
// Control values (ii = minimum length)
if( Mself.lng < min_len )
if( s_inductor_pattern.m_lenght < min_len )
{
DisplayError( this, _( "Requested length < minimum length" ) );
return NULL;
}
// Calculate the elements.
Mself.m_Width = GetDesignSettings().GetCurrentTrackWidth();
s_inductor_pattern.m_Width = GetDesignSettings().GetCurrentTrackWidth();
std::vector <wxPoint> buffer;
ll = BuildCornersList_S_Shape( buffer, Mself.m_Start, Mself.m_End, Mself.lng, Mself.m_Width );
ll = BuildCornersList_S_Shape( buffer, s_inductor_pattern.m_Start,
s_inductor_pattern.m_End, s_inductor_pattern.m_lenght,
s_inductor_pattern.m_Width );
if( !ll )
{
@ -225,18 +227,21 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC )
return NULL;
}
// Generate module.
MODULE* module;
module = Create_1_Module( wxEmptyString );
// Generate footprint. the value is also used as footprint name.
msg.Empty();
wxTextEntryDialog cmpdlg( this, wxEmptyString, _( "Component Value:" ), msg );
cmpdlg.SetTextValidator( FILE_NAME_CHAR_VALIDATOR( &msg ) );
if( module == NULL )
return NULL;
if( ( cmpdlg.ShowModal() != wxID_OK ) || msg.IsEmpty() )
return NULL; // Aborted by user
// here the module is already in the BOARD, Create_1_Module() does that.
module->SetFPID( FPID( std::string( "MuSelf" ) ) );
MODULE* module = CreateNewModule( msg );
// here the module is already in the BOARD, CreateNewModule() does that.
module->SetFPID( FPID( std::string( "mw_inductor" ) ) );
module->SetAttributes( MOD_VIRTUAL | MOD_CMS );
module->ClearFlags();
module->SetPosition( Mself.m_End );
module->SetPosition( s_inductor_pattern.m_End );
// Generate segments
for( unsigned jj = 1; jj < buffer.size(); jj++ )
@ -245,11 +250,11 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC )
PtSegm = new EDGE_MODULE( module );
PtSegm->SetStart( buffer[jj - 1] );
PtSegm->SetEnd( buffer[jj] );
PtSegm->SetWidth( Mself.m_Width );
PtSegm->SetWidth( s_inductor_pattern.m_Width );
PtSegm->SetLayer( module->GetLayer() );
PtSegm->SetShape( S_SEGMENT );
PtSegm->SetStart0( PtSegm->GetStart() - module->GetPosition() );
PtSegm->SetEnd0( PtSegm->GetEnd() - module->GetPosition() );
PtSegm->SetEnd0( PtSegm->GetEnd() - module->GetPosition() );
module->GraphicalItems().PushBack( PtSegm );
}
@ -259,10 +264,10 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC )
module->Pads().PushFront( pad );
pad->SetPadName( wxT( "1" ) );
pad->SetPosition( Mself.m_End );
pad->SetPosition( s_inductor_pattern.m_End );
pad->SetPos0( pad->GetPosition() - module->GetPosition() );
pad->SetSize( wxSize( Mself.m_Width, Mself.m_Width ) );
pad->SetSize( wxSize( s_inductor_pattern.m_Width, s_inductor_pattern.m_Width ) );
pad->SetLayerSet( LSET( module->GetLayer() ) );
pad->SetAttribute( PAD_SMD );
@ -274,23 +279,21 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC )
pad = newpad;
pad->SetPadName( wxT( "2" ) );
pad->SetPosition( Mself.m_Start );
pad->SetPosition( s_inductor_pattern.m_Start );
pad->SetPos0( pad->GetPosition() - module->GetPosition() );
// Modify text positions.
SetMsgPanel( module );
wxPoint refPos( ( Mself.m_Start.x + Mself.m_End.x ) / 2,
( Mself.m_Start.y + Mself.m_End.y ) / 2 );
wxPoint refPos( ( s_inductor_pattern.m_Start.x + s_inductor_pattern.m_End.x ) / 2,
( s_inductor_pattern.m_Start.y + s_inductor_pattern.m_End.y ) / 2 );
wxPoint valPos = refPos;
refPos.y -= module->Reference().GetSize().y;
module->Reference().SetTextPosition( refPos );
module->Reference().SetPosition( refPos );
valPos.y += module->Value().GetSize().y;
module->Value().SetTextPosition( valPos );
module->Reference().SetPos0( module->Reference().GetTextPosition() - module->GetPosition() );
module->Value().SetPos0( module->Value().GetTextPosition() - module->GetPosition() );
module->Value().SetPosition( valPos );
module->CalculateBoundingBox();
module->Draw( m_canvas, DC, GR_OR );
@ -364,7 +367,7 @@ int BuildCornersList_S_Shape( std::vector <wxPoint>& aBuffer,
* The equations are (assuming the area size of the entire shape is Size:
* Size.x = 2 * radius + segm_len
* Size.y = (segm_count + 2 ) * 2 * radius + 2 * stubs_len
* Mself.lng = 2 * delta // connections to the coil
* s_inductor_pattern.m_lenght = 2 * delta // connections to the coil
* + (segm_count-2) * segm_len // length of the strands except 1st and last
* + (segm_count) * (PI * radius) // length of rounded
* segm_len + / 2 - radius * 2) // length of 1st and last bit
@ -522,39 +525,25 @@ int BuildCornersList_S_Shape( std::vector <wxPoint>& aBuffer,
}
MODULE* PCB_EDIT_FRAME::Create_MuWaveBasicShape( const wxString& name, int pad_count )
MODULE* PCB_EDIT_FRAME::CreateMuWaveBaseFootprint( const wxString& aValue,
int aTextSize, int aPadCount )
{
MODULE* module;
int pad_num = 1;
wxString Line;
MODULE* module = CreateNewModule( aValue );
module = Create_1_Module( name );
if( module == NULL )
return NULL;
#define DEFAULT_SIZE 30
module->SetTimeStamp( GetNewTimeStamp() );
module->Value().SetSize( wxSize( DEFAULT_SIZE, DEFAULT_SIZE ) );
module->Value().SetPos0( wxPoint( 0, -DEFAULT_SIZE ) );
module->Value().Offset( wxPoint( 0, module->Value().GetPos0().y ) );
module->Value().SetThickness( DEFAULT_SIZE / 4 );
module->Reference().SetSize( wxSize( DEFAULT_SIZE, DEFAULT_SIZE ) );
module->Reference().SetPos0( wxPoint( 0, DEFAULT_SIZE ) );
module->Reference().Offset( wxPoint( 0, module->Reference().GetPos0().y ) );
module->Reference().SetThickness( DEFAULT_SIZE / 4 );
if( aTextSize > 0 )
{
module->Reference().SetSize( wxSize( aTextSize, aTextSize ) );
module->Reference().SetThickness( aTextSize/5 );
module->Value().SetSize( wxSize( aTextSize, aTextSize ) );
module->Value().SetThickness( aTextSize/5 );
}
// Create 2 pads used in gaps and stubs. The gap is between these 2 pads
// the stub is the pad 2
while( pad_count-- )
wxString Line;
int pad_num = 1;
while( aPadCount-- )
{
D_PAD* pad = new D_PAD( module );
@ -585,6 +574,9 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
wxString msg, cmp_name;
int pad_count = 2;
int angle = 0;
// Ref and value text size (O = use board default value.
// will be set to a value depending on the footprint size, if possible
int text_size = 0;
// Enter the size of the gap or stub
int gap_size = GetDesignSettings().GetCurrentTrackWidth();
@ -593,18 +585,20 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
{
case 0:
msg = _( "Gap" );
cmp_name = wxT( "GAP" );
cmp_name = wxT( "muwave_gap" );
text_size = gap_size;
break;
case 1:
msg = _( "Stub" );
cmp_name = wxT( "STUB" );
cmp_name = wxT( "muwave_stub" );
text_size = gap_size;
pad_count = 2;
break;
case 2:
msg = _( "Arc Stub" );
cmp_name = wxT( "ASTUB" );
cmp_name = wxT( "muwave_arcstub" );
pad_count = 1;
break;
@ -631,7 +625,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
{
double fcoeff = 10.0, fval;
msg.Printf( wxT( "%3.1f" ), angle / fcoeff );
wxTextEntryDialog angledlg( this, _( "Angle (0.1deg):" ),
wxTextEntryDialog angledlg( this, _( "Angle in degrees:" ),
_( "Create microwave module" ), msg );
if( angledlg.ShowModal() != wxID_OK )
@ -660,7 +654,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
return NULL;
}
module = Create_MuWaveBasicShape( cmp_name, pad_count );
module = CreateMuWaveBaseFootprint( cmp_name, text_size, pad_count );
pad = module->Pads();
switch( shape_type )
@ -693,8 +687,8 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
edge->SetShape( S_POLYGON );
edge->SetLayer( F_Cu );
int numPoints = angle / 50 + 3; // Note: angles are in 0.1 degrees
std::vector<wxPoint> polyPoints = edge->GetPolyPoints();
int numPoints = (angle / 50) + 3; // Note: angles are in 0.1 degrees
std::vector<wxPoint>& polyPoints = edge->GetPolyPoints();
polyPoints.reserve( numPoints );
edge->m_Start0.y = -pad->GetSize().y / 2;
@ -742,7 +736,7 @@ enum id_mw_cmd {
/* Setting polynomial form parameters
*/
class WinEDA_SetParamShapeFrame : public wxDialog
class MWAVE_POLYGONAL_SHAPE_DLG : public wxDialog
{
private:
PCB_EDIT_FRAME* m_Parent;
@ -750,8 +744,8 @@ private:
EDA_SIZE_CTRL* m_SizeCtrl;
public:
WinEDA_SetParamShapeFrame( PCB_EDIT_FRAME* parent, const wxPoint& pos );
~WinEDA_SetParamShapeFrame() { };
MWAVE_POLYGONAL_SHAPE_DLG( PCB_EDIT_FRAME* parent, const wxPoint& pos );
~MWAVE_POLYGONAL_SHAPE_DLG() { };
private:
void OnOkClick( wxCommandEvent& event );
@ -780,14 +774,14 @@ private:
};
BEGIN_EVENT_TABLE( WinEDA_SetParamShapeFrame, wxDialog )
EVT_BUTTON( wxID_OK, WinEDA_SetParamShapeFrame::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_SetParamShapeFrame::OnCancelClick )
EVT_BUTTON( ID_READ_SHAPE_FILE, WinEDA_SetParamShapeFrame::ReadDataShapeDescr )
BEGIN_EVENT_TABLE( MWAVE_POLYGONAL_SHAPE_DLG, wxDialog )
EVT_BUTTON( wxID_OK, MWAVE_POLYGONAL_SHAPE_DLG::OnOkClick )
EVT_BUTTON( wxID_CANCEL, MWAVE_POLYGONAL_SHAPE_DLG::OnCancelClick )
EVT_BUTTON( ID_READ_SHAPE_FILE, MWAVE_POLYGONAL_SHAPE_DLG::ReadDataShapeDescr )
END_EVENT_TABLE()
WinEDA_SetParamShapeFrame::WinEDA_SetParamShapeFrame( PCB_EDIT_FRAME* parent,
MWAVE_POLYGONAL_SHAPE_DLG::MWAVE_POLYGONAL_SHAPE_DLG( PCB_EDIT_FRAME* parent,
const wxPoint& framepos ) :
wxDialog( parent, -1, _( "Complex shape" ), framepos, wxSize( 350, 280 ),
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER )
@ -815,8 +809,7 @@ WinEDA_SetParamShapeFrame::WinEDA_SetParamShapeFrame( PCB_EDIT_FRAME* parent,
wxString shapelist[3] =
{
_( "Normal" ), _( "Symmetrical" ),
_( "Mirrored" )
_( "Normal" ), _( "Symmetrical" ), _( "Mirrored" )
};
m_ShapeOptionCtrl = new wxRadioBox( this, -1, _( "Shape Option" ),
@ -827,49 +820,42 @@ WinEDA_SetParamShapeFrame::WinEDA_SetParamShapeFrame( PCB_EDIT_FRAME* parent,
m_SizeCtrl = new EDA_SIZE_CTRL( this, _( "Size" ), ShapeSize, g_UserUnit, LeftBoxSizer );
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
}
void WinEDA_SetParamShapeFrame::OnCancelClick( wxCommandEvent& event )
void MWAVE_POLYGONAL_SHAPE_DLG::OnCancelClick( wxCommandEvent& event )
{
PolyEdges.clear();
EndModal( -1 );
EndModal( wxID_CANCEL );
}
void WinEDA_SetParamShapeFrame::OnOkClick( wxCommandEvent& event )
void MWAVE_POLYGONAL_SHAPE_DLG::OnOkClick( wxCommandEvent& event )
{
ShapeSize = m_SizeCtrl->GetValue();
PolyShapeType = m_ShapeOptionCtrl->GetSelection();
EndModal( 1 );
EndModal( wxID_OK );
}
void WinEDA_SetParamShapeFrame::ReadDataShapeDescr( wxCommandEvent& event )
void MWAVE_POLYGONAL_SHAPE_DLG::ReadDataShapeDescr( wxCommandEvent& event )
{
wxString FullFileName;
wxString ext, mask;
FILE* File;
char* Line;
double unitconv = 10000;
char* param1, * param2;
static wxString lastpath; // To remember the last open path during a session
wxString mask = wxT( "*.*" );
ext = wxT( ".txt" );
mask = wxT( "*" ) + ext;
FullFileName = EDA_FileSelector( _( "Read descr shape file" ),
wxEmptyString,
FullFileName,
ext,
mask,
this,
wxFD_OPEN,
true );
wxString FullFileName = EDA_FileSelector( _( "Read descr shape file" ),
lastpath, FullFileName,
wxEmptyString, mask,
this, wxFD_OPEN, true );
if( FullFileName.IsEmpty() )
return;
File = wxFopen( FullFileName, wxT( "rt" ) );
wxFileName fn( FullFileName );
lastpath = fn.GetPath();
PolyEdges.clear();
FILE* File = wxFopen( FullFileName, wxT( "rt" ) );
if( File == NULL )
{
@ -877,25 +863,27 @@ void WinEDA_SetParamShapeFrame::ReadDataShapeDescr( wxCommandEvent& event )
return;
}
FILE_LINE_READER fileReader( File, FullFileName );
double unitconv = IU_PER_MM;
ShapeScaleX = ShapeScaleY = 1.0;
FILE_LINE_READER fileReader( File, FullFileName );
FILTER_READER reader( fileReader );
LOCALE_IO toggle;
while( reader.ReadLine() )
{
Line = reader.Line();
param1 = strtok( Line, " =\n\r" );
param2 = strtok( NULL, " \t\n\r" );
char* Line = reader.Line();
char* param1 = strtok( Line, " =\n\r" );
char* param2 = strtok( NULL, " \t\n\r" );
if( strnicmp( param1, "Unit", 4 ) == 0 )
{
if( strnicmp( param2, "inch", 4 ) == 0 )
unitconv = 10000;
unitconv = IU_PER_MILS*1000;
if( strnicmp( param2, "mm", 2 ) == 0 )
unitconv = 10000 / 25.4;
unitconv = IU_PER_MM;
}
if( strnicmp( param1, "$ENDCOORD", 8 ) == 0 )
@ -912,20 +900,16 @@ void WinEDA_SetParamShapeFrame::ReadDataShapeDescr( wxCommandEvent& event )
if( strnicmp( param1, "$ENDCOORD", 8 ) == 0 )
break;
PolyEdges.push_back( atof( param1 ) );
PolyEdges.push_back( atof( param2 ) );
wxRealPoint coord( atof( param1 ), atof( param2 ) );
PolyEdges.push_back( coord );
}
}
if( strnicmp( Line, "XScale", 6 ) == 0 )
{
ShapeScaleX = atof( param2 );
}
if( strnicmp( Line, "YScale", 6 ) == 0 )
{
ShapeScaleY = atof( param2 );
}
}
ShapeScaleX *= unitconv;
@ -943,17 +927,16 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
int pad_count = 2;
EDGE_MODULE* edge;
WinEDA_SetParamShapeFrame* frame = new WinEDA_SetParamShapeFrame( this, wxPoint( -1, -1 ) );
MWAVE_POLYGONAL_SHAPE_DLG dlg( this, wxPoint( -1, -1 ) );
int ok = frame->ShowModal();
frame->Destroy();
int ret = dlg.ShowModal();
m_canvas->MoveCursorToCrossHair();
if( ok != 1 )
if( ret != wxID_OK )
{
PolyEdges.clear();
return NULL;
}
if( PolyShapeType == 2 ) // mirrored
@ -974,77 +957,66 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
return NULL;
}
cmp_name = wxT( "POLY" );
cmp_name = wxT( "muwave_polygon" );
// Create a footprint with 2 pads, orientation = 0, pos 0
module = CreateMuWaveBaseFootprint( cmp_name, 0, pad_count );
// We try to place the footprint anchor to the middle of the shape len
wxPoint offset;
offset.x = -ShapeSize.x / 2;
module = Create_MuWaveBasicShape( cmp_name, pad_count );
pad1 = module->Pads();
pad1->SetX0( -ShapeSize.x / 2 );
pad1->SetX( pad1->GetPos0().x + pad1->GetPosition().x );
pad1->SetX0( offset.x );
pad1->SetX( pad1->GetPos0().x );
pad2 = (D_PAD*) pad1->Next();
pad2->SetX0( pad1->GetPos0().x + ShapeSize.x );
pad2->SetX( pad2->GetPos0().x + pad2->GetPosition().x );
pad2->SetX0( offset.x + ShapeSize.x );
pad2->SetX( pad2->GetPos0().x );
// Add a polygonal edge (corners will be added later) on copper layer
edge = new EDGE_MODULE( module );
module->GraphicalItems().PushFront( edge );
edge->SetShape( S_POLYGON );
edge->SetLayer( F_Cu );
std::vector<wxPoint> polyPoints = edge->GetPolyPoints();
polyPoints.reserve( 2 * PolyEdges.size() + 2 );
module->GraphicalItems().PushFront( edge );
// Get the corner buffer of the polygonal edge
std::vector<wxPoint>& polyPoints = edge->GetPolyPoints();
polyPoints.reserve( PolyEdges.size() + 2 );
// Init start point coord:
polyPoints.push_back( wxPoint( pad1->GetPos0().x, 0 ) );
polyPoints.push_back( wxPoint( offset.x, 0 ) );
wxPoint first_coordinate, last_coordinate;
for( unsigned ii = 0; ii < PolyEdges.size(); ii++ ) // Copy points
{
last_coordinate.x = KiROUND( PolyEdges[ii] * ShapeScaleX ) + pad1->GetPos0().x;
last_coordinate.y = -KiROUND( PolyEdges[ii] * ShapeScaleY );
last_coordinate.x = KiROUND( PolyEdges[ii].x * ShapeScaleX );
last_coordinate.y = -KiROUND( PolyEdges[ii].y * ShapeScaleY );
last_coordinate += offset;
polyPoints.push_back( last_coordinate );
}
// finish the polygonal shape
if( last_coordinate.y != 0 )
polyPoints.push_back( wxPoint( last_coordinate.x, 0 ) );
first_coordinate.y = polyPoints[1].y;
switch( PolyShapeType )
{
case 0: // Single
case 2: // Single mirrored
// Init end point coord:
pad2->SetX0( last_coordinate.x );
polyPoints.push_back( wxPoint( last_coordinate.x, 0 ) );
pad1->SetSize( wxSize( std::abs( first_coordinate.y ),
std::abs( first_coordinate.y ) ) );
pad2->SetSize( wxSize( std::abs( last_coordinate.y ),
std::abs( last_coordinate.y ) ) );
pad1->SetY0( first_coordinate.y / 2 );
pad2->SetY0( last_coordinate.y / 2 );
pad1->SetY( pad1->GetPos0().y + module->GetPosition().y );
pad2->SetY( pad2->GetPos0().y + module->GetPosition().y );
case 0: // shape from file
case 2: // shape from file, mirrored (the mirror is already done)
break;
case 1: // Symmetric
for( int ndx = polyPoints.size() - 1; ndx>=0; --ndx )
case 1: // Symmetric shape: add the symmetric (mirrored) shape
for( int ndx = polyPoints.size() - 1; ndx >= 0; --ndx )
{
wxPoint pt = polyPoints[ndx];
pt.y = -pt.y; // mirror about X axis
polyPoints.push_back( pt );
}
pad1->SetSize( wxSize( 2 * std::abs( first_coordinate.y ),
2 * std::abs( first_coordinate.y ) ) );
pad2->SetSize( wxSize( 2 * std::abs( last_coordinate.y ),
2 * std::abs( last_coordinate.y ) ) );
break;
}

View File

@ -123,10 +123,12 @@ EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aGalType )
// Netnames are drawn only when scale is sufficient (level of details)
// so there is no point in caching them
m_view->SetLayerTarget( layer, KIGFX::TARGET_NONCACHED );
m_view->SetLayerDisplayOnly( layer );
}
}
m_view->SetLayerTarget( ITEM_GAL_LAYER( ANCHOR_VISIBLE ), KIGFX::TARGET_NONCACHED );
m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( ANCHOR_VISIBLE ) );
// Some more required layers settings
m_view->SetRequired( ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ) );
@ -147,7 +149,13 @@ EDA_DRAW_PANEL_GAL( aParentWindow, aWindowId, aPosition, aSize, aGalType )
m_view->SetRequired( ITEM_GAL_LAYER( PAD_BK_VISIBLE ), ITEM_GAL_LAYER( MOD_BK_VISIBLE ) );
m_view->SetLayerTarget( ITEM_GAL_LAYER( GP_OVERLAY ), KIGFX::TARGET_OVERLAY );
m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( GP_OVERLAY ) );
m_view->SetLayerTarget( ITEM_GAL_LAYER( RATSNEST_VISIBLE ), KIGFX::TARGET_OVERLAY );
m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( RATSNEST_VISIBLE ) );
m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( WORKSHEET ) );
m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( GRID_VISIBLE ) );
m_view->SetLayerDisplayOnly( ITEM_GAL_LAYER( DRC_VISIBLE ) );
// Load display options (such as filled/outline display of items).
// Can be made only if the parent windos is a EDA_DRAW_FRAME (or a derived class)

View File

@ -800,7 +800,7 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR )
if( it->m_visible )
visibleLayers.set( it->m_number );
m_board->SetLayer( LAYER_ID( it->m_number ), *it );
m_board->SetLayerDescr( LAYER_ID( it->m_number ), *it );
UTF8 name = it->m_name;
@ -838,7 +838,7 @@ void PCB_PARSER::parseLayers() throw( IO_ERROR, PARSE_ERROR )
// DBG( printf( "aux m_visible:%s\n", layer.m_visible ? "true" : "false" );)
m_board->SetLayer( it->second, layer );
m_board->SetLayerDescr( it->second, layer );
token = NextTok();

View File

@ -152,7 +152,7 @@ public:
}
protected:
OPT_TOOL_EVENT handleCustomEvent( const wxEvent& aEvent )
OPT_TOOL_EVENT handleCustomEvent( const wxMenuEvent& aEvent )
{
#if ID_POPUP_PCB_SELECT_VIASIZE1 < ID_POPUP_PCB_SELECT_WIDTH1
#error You have changed event ids order, it breaks code. Check the source code for more details.
@ -183,7 +183,7 @@ protected:
bds.SetTrackWidthIndex( 0 );
}
else if( id > ID_POPUP_PCB_SELECT_VIASIZE1 ) // via size has changed
else if( id >= ID_POPUP_PCB_SELECT_VIASIZE1 ) // via size has changed
{
assert( id < ID_POPUP_PCB_SELECT_WIDTH_END_RANGE );

View File

@ -516,7 +516,14 @@ void SELECTION_TOOL::findCallback( BOARD_ITEM* aItem )
clearSelection();
if( aItem )
toggleSelection( aItem );
{
clearSelection();
select( aItem );
// Inform other potentially interested tools
TOOL_EVENT selectEvent( SelectedEvent );
m_toolMgr->ProcessEvent( selectEvent );
}
m_frame->GetGalCanvas()->ForceRefresh();
}