2007-06-05 12:10:51 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: dialog_edit_component_in_lib.cpp
|
|
|
|
// Author: jean-pierre Charras
|
2009-08-18 11:07:21 +00:00
|
|
|
// Licence: GPL
|
2007-06-05 12:10:51 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2009-08-18 11:07:21 +00:00
|
|
|
#include "fctsys.h"
|
|
|
|
#include "appl_wxstruct.h"
|
|
|
|
#include "common.h"
|
|
|
|
#include "confirm.h"
|
|
|
|
#include "gestfich.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-08-18 11:07:21 +00:00
|
|
|
#include "program.h"
|
|
|
|
#include "libcmp.h"
|
|
|
|
#include "general.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "dialog_edit_component_in_lib.h"
|
|
|
|
|
2009-08-18 11:07:21 +00:00
|
|
|
#include "protos.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-08-18 11:07:21 +00:00
|
|
|
DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY( WinEDA_LibeditFrame* aParent):
|
2009-09-14 13:24:17 +00:00
|
|
|
DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE(aParent)
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-08-18 11:07:21 +00:00
|
|
|
m_Parent = aParent;
|
|
|
|
m_RecreateToolbar = false;
|
2007-06-05 12:10:51 +00:00
|
|
|
m_AliasLocation = -1;
|
2008-12-31 15:01:29 +00:00
|
|
|
|
2009-08-18 11:07:21 +00:00
|
|
|
Init();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-04-30 11:52:34 +00:00
|
|
|
if (GetSizer())
|
|
|
|
{
|
|
|
|
GetSizer()->SetSizeHints(this);
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-08-18 11:07:21 +00:00
|
|
|
DIALOG_EDIT_COMPONENT_IN_LIBRARY::~DIALOG_EDIT_COMPONENT_IN_LIBRARY()
|
2008-12-31 15:01:29 +00:00
|
|
|
{
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2009-08-18 11:07:21 +00:00
|
|
|
/* Initialize state of check boxes and texts
|
|
|
|
*/
|
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::Init( )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-08-18 11:07:21 +00:00
|
|
|
SetFocus();
|
|
|
|
m_AliasLocation = -1;
|
2009-09-14 13:24:17 +00:00
|
|
|
|
2009-08-18 11:07:21 +00:00
|
|
|
if( CurrentLibEntry == NULL )
|
|
|
|
{
|
2009-09-14 13:24:17 +00:00
|
|
|
SetTitle( _( "Library Component Properties" ) );
|
2009-08-18 11:07:21 +00:00
|
|
|
return;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-08-18 11:07:21 +00:00
|
|
|
wxString title = _( "Properties for " );
|
2009-09-14 13:24:17 +00:00
|
|
|
|
2009-08-18 11:07:21 +00:00
|
|
|
if( !CurrentAliasName.IsEmpty() )
|
|
|
|
{
|
2009-09-14 13:24:17 +00:00
|
|
|
title += CurrentAliasName + _( " (alias of " ) +
|
|
|
|
wxString( CurrentLibEntry->m_Name.m_Text )+ wxT( ")" );
|
2009-08-18 11:07:21 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
title += CurrentLibEntry->m_Name.m_Text;
|
|
|
|
CurrentAliasName.Empty();
|
|
|
|
}
|
2009-09-14 13:24:17 +00:00
|
|
|
|
2009-08-18 11:07:21 +00:00
|
|
|
SetTitle( title );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-08-18 11:07:21 +00:00
|
|
|
InitPanelDoc();
|
|
|
|
InitBasicPanel();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-08-18 11:07:21 +00:00
|
|
|
if( !CurrentAliasName.IsEmpty() )
|
|
|
|
m_ButtonDeleteAllAlias->Enable( false );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-08-18 11:07:21 +00:00
|
|
|
/* Place list of alias names in listbox */
|
|
|
|
if( CurrentLibEntry )
|
|
|
|
{
|
2009-09-14 13:24:17 +00:00
|
|
|
m_PartAliasList->Append( CurrentLibEntry->m_AliasList );
|
2009-08-18 11:07:21 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-09-14 13:24:17 +00:00
|
|
|
if( ( CurrentLibEntry == NULL )
|
|
|
|
|| ( CurrentLibEntry->m_AliasList.GetCount() == 0 ) )
|
2009-08-18 11:07:21 +00:00
|
|
|
{
|
|
|
|
m_ButtonDeleteAllAlias->Enable( false );
|
|
|
|
m_ButtonDeleteOneAlias->Enable( false );
|
|
|
|
}
|
2009-09-14 13:24:17 +00:00
|
|
|
|
2009-08-18 11:07:21 +00:00
|
|
|
/* Read the Footprint Filter list */
|
|
|
|
if( CurrentLibEntry )
|
|
|
|
{
|
2009-09-14 13:24:17 +00:00
|
|
|
m_FootprintFilterListBox->Append( CurrentLibEntry->m_FootprintList );
|
2009-08-18 11:07:21 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-09-14 13:24:17 +00:00
|
|
|
if( ( CurrentLibEntry == NULL )
|
|
|
|
|| ( CurrentLibEntry->m_FootprintList.GetCount() == 0 ) )
|
2009-08-18 11:07:21 +00:00
|
|
|
{
|
|
|
|
m_ButtonDeleteAllFootprintFilter->Enable( false );
|
|
|
|
m_ButtonDeleteOneFootprintFilter->Enable( false );
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-08-18 11:07:21 +00:00
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnCancelClick( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-09-14 13:24:17 +00:00
|
|
|
EndModal( wxID_CANCEL );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|