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"
|
2010-02-16 16:21:52 +00:00
|
|
|
#include "libeditframe.h"
|
2010-02-16 08:34:09 +00:00
|
|
|
#include "class_library.h"
|
|
|
|
//#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;
|
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
|
|
|
|
2010-10-04 18:54:14 +00:00
|
|
|
if( GetSizer() )
|
2008-04-30 11:52:34 +00:00
|
|
|
{
|
2010-10-04 18:54:14 +00:00
|
|
|
GetSizer()->SetSizeHints( this );
|
2008-04-30 11:52:34 +00:00
|
|
|
}
|
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
|
|
|
|
*/
|
2010-10-04 18:54:14 +00:00
|
|
|
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
|
|
|
|
2010-10-04 18:54:14 +00:00
|
|
|
bool isRoot = m_Parent->GetAliasName().CmpNoCase( component->GetName() ) == 0;
|
|
|
|
|
|
|
|
if( !isRoot )
|
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-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
|
|
|
|
2010-10-04 18:54:14 +00:00
|
|
|
if( isRoot && component->GetAliasCount() == 1 )
|
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 */
|
2010-10-04 18:54:14 +00:00
|
|
|
m_PartAliasListCtrl->Append( component->GetAliasNames( false ) );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-10-04 18:54:14 +00:00
|
|
|
if( component->GetAliasCount() <= 1 )
|
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 */
|
2010-09-09 17:37:25 +00:00
|
|
|
m_FootprintFilterListBox->Append( component->GetFootPrints() );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-09-09 17:37:25 +00:00
|
|
|
if( component->GetFootPrints().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
|
|
|
}
|
|
|
|
|
2010-02-16 08:34:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitPanelDoc()
|
|
|
|
{
|
2010-10-04 18:54:14 +00:00
|
|
|
LIB_ALIAS* alias;
|
2010-02-16 08:34:09 +00:00
|
|
|
LIB_COMPONENT* component = m_Parent->GetComponent();
|
|
|
|
|
|
|
|
if( component == NULL )
|
|
|
|
return;
|
|
|
|
|
2010-02-17 13:22:25 +00:00
|
|
|
wxString aliasname = m_Parent->GetAliasName();
|
2010-10-04 18:54:14 +00:00
|
|
|
|
|
|
|
if( aliasname.IsEmpty() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
alias = component->GetAlias( aliasname );
|
|
|
|
|
|
|
|
if( alias != NULL )
|
2010-02-16 08:34:09 +00:00
|
|
|
{
|
2010-10-04 18:54:14 +00:00
|
|
|
m_DocCtrl->SetValue( alias->GetDescription() );
|
|
|
|
m_KeywordsCtrl->SetValue( alias->GetKeyWords() );
|
|
|
|
m_DocfileCtrl->SetValue( alias->GetDocFileName() );
|
2010-02-16 08:34:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* create the basic panel for component properties editing
|
|
|
|
*/
|
|
|
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitBasicPanel()
|
|
|
|
{
|
|
|
|
LIB_COMPONENT* component = m_Parent->GetComponent();
|
|
|
|
|
|
|
|
if( m_Parent->GetShowDeMorgan() )
|
|
|
|
m_AsConvertButt->SetValue( true );
|
|
|
|
|
|
|
|
/* Default values for a new component. */
|
|
|
|
if( component == NULL )
|
|
|
|
{
|
|
|
|
m_ShowPinNumButt->SetValue( true );
|
|
|
|
m_ShowPinNameButt->SetValue( true );
|
|
|
|
m_PinsNameInsideButt->SetValue( true );
|
|
|
|
m_SelNumberOfUnits->SetValue( 1 );
|
|
|
|
m_SetSkew->SetValue( 40 );
|
|
|
|
m_OptionPower->SetValue( false );
|
|
|
|
m_OptionPartsLocked->SetValue( false );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-06-24 18:31:43 +00:00
|
|
|
m_ShowPinNumButt->SetValue( component->ShowPinNumbers() );
|
|
|
|
m_ShowPinNameButt->SetValue( component->ShowPinNames() );
|
|
|
|
m_PinsNameInsideButt->SetValue( component->GetPinNameOffset() != 0 );
|
2010-02-16 08:34:09 +00:00
|
|
|
m_SelNumberOfUnits->SetValue( component->GetPartCount() );
|
2010-06-24 18:31:43 +00:00
|
|
|
m_SetSkew->SetValue( component->GetPinNameOffset() );
|
2010-10-04 18:54:14 +00:00
|
|
|
m_OptionPower->SetValue( component->IsPower() );
|
2010-10-25 15:43:42 +00:00
|
|
|
m_OptionPartsLocked->SetValue( component->UnitsLocked() && component->GetPartCount() > 1 );
|
2010-02-16 08:34:09 +00:00
|
|
|
}
|