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 "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 "general.h"
|
2009-09-22 12:27:57 +00:00
|
|
|
#include "protos.h"
|
|
|
|
#include "libeditfrm.h"
|
2009-09-25 18:49:04 +00:00
|
|
|
#include "class_libentry.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "dialog_edit_component_in_lib.h"
|
|
|
|
|
|
|
|
|
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-09-25 18:49:04 +00:00
|
|
|
LIB_COMPONENT* component = m_Parent->GetComponent();
|
2009-09-22 12:27:57 +00:00
|
|
|
|
|
|
|
if( component == NULL )
|
2009-08-18 11:07:21 +00:00
|
|
|
{
|
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-09-25 18:49:04 +00:00
|
|
|
if( !m_Parent->GetAliasName().IsEmpty() )
|
2009-08-18 11:07:21 +00:00
|
|
|
{
|
2009-09-25 18:49:04 +00:00
|
|
|
title += m_Parent->GetAliasName() + _( " (alias of " ) +
|
2009-09-22 12:27:57 +00:00
|
|
|
component->GetName() + wxT( ")" );
|
2009-08-18 11:07:21 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-09-22 12:27:57 +00:00
|
|
|
title += component->GetName();
|
2009-09-25 18:49:04 +00:00
|
|
|
m_Parent->GetAliasName().Empty();
|
2009-08-18 11:07:21 +00:00
|
|
|
}
|
2009-09-14 13:24:17 +00:00
|
|
|
|
2009-08-18 11:07:21 +00:00
|
|
|
SetTitle( title );
|
|
|
|
InitPanelDoc();
|
|
|
|
InitBasicPanel();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-09-25 18:49:04 +00:00
|
|
|
if( !m_Parent->GetAliasName().IsEmpty() )
|
2009-08-18 11:07:21 +00:00
|
|
|
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 */
|
2009-09-22 12:27:57 +00:00
|
|
|
m_PartAliasList->Append( component->m_AliasList );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
if( component->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 */
|
2009-09-22 12:27:57 +00:00
|
|
|
m_FootprintFilterListBox->Append( component->m_FootprintList );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
if( component->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
|
|
|
}
|
|
|
|
|