Commit f0e295ca authored by Garth Corral's avatar Garth Corral

Merge trunk @ 5397

parents cf01c580 8412f2ad
......@@ -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.
......
......@@ -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
......
......@@ -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
......
......@@ -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 )
......
/*
* 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';
......
......@@ -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.") );
......
......@@ -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>
......
......@@ -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();
};
......
......@@ -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
......
......@@ -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 ) );
......
......@@ -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>
......
......@@ -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();
};
......
/*
* 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 )
{
......
......@@ -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;
......
......@@ -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 );
......
/*
* 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 );
};
......
/*
* 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 );
};
......
......@@ -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;
};
......
......@@ -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;
}
......
......@@ -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 );
......
......@@ -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
......
......@@ -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
......
......@@ -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 ) )
{
......
......@@ -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
......
/*
* 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.
......
......@@ -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 )
{
......
......@@ -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();
......
......@@ -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 );
}
......@@ -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>
......
......@@ -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();
};
......
/*
* 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 );
}
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 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__
......@@ -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_
/*
* 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;
......
......@@ -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();
......
......@@ -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;
......
......@@ -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;
}
/*
* 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().
......
This diff is collapsed.
This diff is collapsed.
......@@ -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)
......
......@@ -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();
......
......@@ -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 );
......
......@@ -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();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment