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):
|
|
|
|
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;
|
|
|
|
if( CurrentLibEntry == NULL )
|
|
|
|
{
|
|
|
|
SetTitle( _( "Lib Component Properties" ) );
|
|
|
|
return;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-08-18 11:07:21 +00:00
|
|
|
wxString title = _( "Properties for " );
|
|
|
|
if( !CurrentAliasName.IsEmpty() )
|
|
|
|
{
|
|
|
|
m_AliasLocation = LocateAlias( CurrentLibEntry->m_AliasList, CurrentAliasName );
|
|
|
|
title += CurrentAliasName +
|
|
|
|
_( "(alias of " ) +
|
|
|
|
wxString( CurrentLibEntry->m_Name.m_Text )
|
|
|
|
+ wxT( ")" );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
title += CurrentLibEntry->m_Name.m_Text;
|
|
|
|
CurrentAliasName.Empty();
|
|
|
|
}
|
|
|
|
|
|
|
|
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 )
|
|
|
|
{
|
|
|
|
for( unsigned ii = 0; ii < CurrentLibEntry->m_AliasList.GetCount(); ii += ALIAS_NEXT )
|
|
|
|
m_PartAliasList->Append( CurrentLibEntry->m_AliasList[ii + ALIAS_NAME] );
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-08-18 11:07:21 +00:00
|
|
|
if( (CurrentLibEntry == NULL) || (CurrentLibEntry->m_AliasList.GetCount() == 0) )
|
|
|
|
{
|
|
|
|
m_ButtonDeleteAllAlias->Enable( false );
|
|
|
|
m_ButtonDeleteOneAlias->Enable( false );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Read the Footprint Filter list */
|
|
|
|
if( CurrentLibEntry )
|
|
|
|
{
|
|
|
|
for( unsigned ii = 0; ii < CurrentLibEntry->m_FootprintList.GetCount(); ii++ )
|
|
|
|
m_FootprintFilterListBox->Append( CurrentLibEntry->m_FootprintList[ii] );
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-08-18 11:07:21 +00:00
|
|
|
if( (CurrentLibEntry == NULL) || (CurrentLibEntry->m_FootprintList.GetCount() == 0) )
|
|
|
|
{
|
|
|
|
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
|
|
|
{
|
|
|
|
EndModal(0);
|
|
|
|
}
|
|
|
|
|