see my 2007-Sep-20 change_log.txt
This commit is contained in:
parent
33939aebd9
commit
664a1f727b
|
@ -4,6 +4,14 @@ Started 2007-June-11
|
|||
Please add newer entries at the top, list the date and your name with
|
||||
email address.
|
||||
|
||||
2007-Sep-20 UPDATE Dick Hollenbeck <dick@softplc.com>
|
||||
================================================================================
|
||||
+ eeschema
|
||||
* beautify, add debug Show() functions, changed ReturnFieldName()
|
||||
to return "const wxString&" for speed, added GetFieldValue().
|
||||
* tracking down questionable behavior (a bug?) in erc regarding pwr_flag, still looking
|
||||
|
||||
|
||||
2007-sept-20 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
|
||||
================================================================================
|
||||
+ all
|
||||
|
|
|
@ -555,3 +555,29 @@ EDA_BaseStruct* BASE_SCREEN::GetItemFromRedoList()
|
|||
return item;
|
||||
}
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
/**
|
||||
* Function Show
|
||||
* is used to output the object tree, currently for debugging only.
|
||||
* @param nestLevel An aid to prettier tree indenting, and is the level
|
||||
* of nesting of this object within the overall tree.
|
||||
* @param os The ostream& to output to.
|
||||
*/
|
||||
void BASE_SCREEN::Show( int nestLevel, std::ostream& os )
|
||||
{
|
||||
EDA_BaseStruct* item = EEDrawList;
|
||||
|
||||
// for now, make it look like XML, expand on this later.
|
||||
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
|
||||
">\n";
|
||||
|
||||
for( ; item; item = item->Next() )
|
||||
{
|
||||
item->Show( nestLevel+1, os );
|
||||
}
|
||||
|
||||
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
|
||||
}
|
||||
#endif
|
||||
|
|
@ -188,11 +188,14 @@ void EDA_BaseStruct::Show( int nestLevel, std::ostream& os )
|
|||
// for now, make it look like XML:
|
||||
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << ">\n";
|
||||
|
||||
/*
|
||||
EDA_BaseStruct* kid = m_Son;
|
||||
for( ; kid; kid = kid->Pnext )
|
||||
{
|
||||
kid->Show( nestLevel+1, os );
|
||||
}
|
||||
*/
|
||||
NestedSpace( nestLevel+1, os ) << "Need ::Show() override, shown class is using EDA_BaseStruct::Show()\n";
|
||||
|
||||
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
|
||||
}
|
||||
|
|
|
@ -28,11 +28,12 @@ static bool SortByPosition = TRUE;
|
|||
/**************************************/
|
||||
void ReAnnotatePowerSymbolsOnly()
|
||||
/**************************************/
|
||||
/* Used to reannotate the power symbols, before testing erc or computing netlist
|
||||
when a true component reannotation is not necessary
|
||||
|
||||
In order to avoid conflicts the ref number start with a 0:
|
||||
PWR with id 12 is named PWR12 in global annotation and PWR012 by the Power annotation
|
||||
/* Used to reannotate the power symbols, before testing erc or computing netlist
|
||||
* when a true component reannotation is not necessary
|
||||
*
|
||||
* In order to avoid conflicts the ref number start with a 0:
|
||||
* PWR with id 12 is named PWR12 in global annotation and PWR012 by the Power annotation
|
||||
*/
|
||||
{
|
||||
/* Build the screen list */
|
||||
|
@ -70,6 +71,7 @@ void InstallAnnotateFrame(WinEDA_SchematicFrame *parent, wxPoint & pos)
|
|||
/******************************************************************/
|
||||
{
|
||||
WinEDA_AnnotateFrame* frame = new WinEDA_AnnotateFrame( parent );
|
||||
|
||||
frame->ShowModal(); frame->Destroy();
|
||||
}
|
||||
|
||||
|
@ -77,9 +79,10 @@ void InstallAnnotateFrame(WinEDA_SchematicFrame *parent, wxPoint & pos)
|
|||
/******************************************************************/
|
||||
void WinEDA_AnnotateFrame::AnnotateComponents( wxCommandEvent& event )
|
||||
/******************************************************************/
|
||||
|
||||
/*
|
||||
Compute the annotation of the components for the whole projeect, or the current sheet only.
|
||||
All the components or the new ones only will be annotated.
|
||||
* Compute the annotation of the components for the whole projeect, or the current sheet only.
|
||||
* All the components or the new ones only will be annotated.
|
||||
*/
|
||||
{
|
||||
int NbSheet, ii, NbOfCmp;
|
||||
|
@ -92,12 +95,15 @@ CmpListStruct * BaseListeCmp;
|
|||
SortByPosition = (m_AnnotSortCmpCtrl->GetSelection() == 0) ? TRUE : FALSE;
|
||||
|
||||
/* If it is an annotation for all the components, reset previous annotation: */
|
||||
if( m_AnnotNewCmpCtrl->GetSelection() == 0 ) DeleteAnnotation(event);
|
||||
if (m_Abort ) return;
|
||||
if( m_AnnotNewCmpCtrl->GetSelection() == 0 )
|
||||
DeleteAnnotation( event );
|
||||
if( m_Abort )
|
||||
return;
|
||||
|
||||
|
||||
/* Build the screen list */
|
||||
EDA_ScreenList ScreenList( NULL );
|
||||
|
||||
NbSheet = ScreenList.GetCount();
|
||||
|
||||
/* Update the sheet number, sheet count and date */
|
||||
|
@ -114,7 +120,8 @@ CmpListStruct * BaseListeCmp;
|
|||
NbOfCmp += ListeComposants( NULL, screen, screen->m_SheetNumber );
|
||||
}
|
||||
}
|
||||
else NbOfCmp = ListeComposants(NULL, screen, screen->m_SheetNumber);
|
||||
else
|
||||
NbOfCmp = ListeComposants( NULL, screen, screen->m_SheetNumber );
|
||||
|
||||
if( NbOfCmp == 0 )
|
||||
return;
|
||||
|
@ -133,7 +140,8 @@ CmpListStruct * BaseListeCmp;
|
|||
screen, screen->m_SheetNumber );
|
||||
}
|
||||
}
|
||||
else ii = ListeComposants(BaseListeCmp, screen, screen->m_SheetNumber);
|
||||
else
|
||||
ii = ListeComposants( BaseListeCmp, screen, screen->m_SheetNumber );
|
||||
|
||||
if( ii != NbOfCmp )
|
||||
DisplayError( this, wxT( "Internal error in AnnotateComponents()" ) );
|
||||
|
@ -161,8 +169,9 @@ CmpListStruct * BaseListeCmp;
|
|||
/********************************************************************/
|
||||
void WinEDA_AnnotateFrame::DeleteAnnotation( wxCommandEvent& event )
|
||||
/********************************************************************/
|
||||
|
||||
/* Clear the current annotation for the whole project or only for the current sheet
|
||||
Update sheet number and number of sheets
|
||||
* Update sheet number and number of sheets
|
||||
*/
|
||||
{
|
||||
int NbSheet;
|
||||
|
@ -179,6 +188,7 @@ EDA_SchComponentStruct *DrawLibItem;
|
|||
|
||||
/* Build the screen list */
|
||||
EDA_ScreenList ScreenList( NULL );
|
||||
|
||||
NbSheet = ScreenList.GetCount();
|
||||
|
||||
/* Update the sheet number, sheet count and date */
|
||||
|
@ -186,8 +196,10 @@ EDA_SchComponentStruct *DrawLibItem;
|
|||
|
||||
ScreenSch->SetModify();
|
||||
|
||||
if( AnnotProject == TRUE ) screen = ScreenList.GetFirst();
|
||||
else screen = (SCH_SCREEN*) m_Parent->m_CurrentScreen;
|
||||
if( AnnotProject == TRUE )
|
||||
screen = ScreenList.GetFirst();
|
||||
else
|
||||
screen = (SCH_SCREEN*) m_Parent->m_CurrentScreen;
|
||||
|
||||
for( ; screen != NULL; screen = ScreenList.GetNext() )
|
||||
{
|
||||
|
@ -200,7 +212,9 @@ EDA_SchComponentStruct *DrawLibItem;
|
|||
DrawLibItem->ClearAnnotation();
|
||||
}
|
||||
}
|
||||
if( ! AnnotProject ) break;
|
||||
|
||||
if( !AnnotProject )
|
||||
break;
|
||||
}
|
||||
|
||||
m_Parent->DrawPanel->Refresh( TRUE );
|
||||
|
@ -211,8 +225,9 @@ EDA_SchComponentStruct *DrawLibItem;
|
|||
/************************************************************************************/
|
||||
int ListeComposants( CmpListStruct* BaseListeCmp, SCH_SCREEN* screen, int NumSheet )
|
||||
/***********************************************************************************/
|
||||
|
||||
/* if BaseListeCmp == NULL : Components counting
|
||||
else update data table BaseListeCmp
|
||||
* else update data table BaseListeCmp
|
||||
*/
|
||||
{
|
||||
int NbrCmp = 0;
|
||||
|
@ -236,7 +251,8 @@ EDA_LibComponentStruct *Entry;
|
|||
case DRAW_LIB_ITEM_STRUCT_TYPE:
|
||||
DrawLibItem = (EDA_SchComponentStruct*) DrawList;
|
||||
Entry = FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
|
||||
if( Entry == NULL) break;
|
||||
if( Entry == NULL )
|
||||
break;
|
||||
if( BaseListeCmp == NULL ) /* Items counting only */
|
||||
{
|
||||
NbrCmp++; break;
|
||||
|
@ -279,44 +295,58 @@ EDA_LibComponentStruct *Entry;
|
|||
DrawList = DrawList->Pnext;
|
||||
}
|
||||
|
||||
return(NbrCmp);
|
||||
return NbrCmp;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
int AnnotTriComposant( CmpListStruct* Objet1, CmpListStruct* Objet2 )
|
||||
/****************************************************************/
|
||||
|
||||
/* function used par qsort() for sorting the list
|
||||
Composants are sorted
|
||||
by reference
|
||||
if same reference: by value
|
||||
if same value: by unit number
|
||||
if same unit number, by sheet
|
||||
if same sheet, by time stamp
|
||||
* Composants are sorted
|
||||
* by reference
|
||||
* if same reference: by value
|
||||
* if same value: by unit number
|
||||
* if same unit number, by sheet
|
||||
* if same sheet, by time stamp
|
||||
**/
|
||||
{
|
||||
int ii;
|
||||
|
||||
ii = strnicmp( Objet1->m_TextRef, Objet2->m_TextRef, 32 );
|
||||
if ( SortByPosition == TRUE ) {
|
||||
if ( ii == 0 ) ii = Objet1->m_Sheet - Objet2->m_Sheet;
|
||||
if ( ii == 0 ) ii = Objet1->m_Unit - Objet2->m_Unit;
|
||||
if ( ii == 0 ) ii = Objet1->m_Pos.x - Objet2->m_Pos.x;
|
||||
if ( ii == 0 ) ii = Objet1->m_Pos.y - Objet2->m_Pos.y;
|
||||
} else {
|
||||
if ( ii == 0 ) ii = strnicmp( Objet1->m_TextValue, Objet2->m_TextValue, 32 );
|
||||
if ( ii == 0 ) ii = Objet1->m_Unit - Objet2->m_Unit;
|
||||
if ( ii == 0 ) ii = Objet1->m_Sheet - Objet2->m_Sheet;
|
||||
if( SortByPosition == TRUE )
|
||||
{
|
||||
if( ii == 0 )
|
||||
ii = Objet1->m_Sheet - Objet2->m_Sheet;
|
||||
if( ii == 0 )
|
||||
ii = Objet1->m_Unit - Objet2->m_Unit;
|
||||
if( ii == 0 )
|
||||
ii = Objet1->m_Pos.x - Objet2->m_Pos.x;
|
||||
if( ii == 0 )
|
||||
ii = Objet1->m_Pos.y - Objet2->m_Pos.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ii == 0 )
|
||||
ii = strnicmp( Objet1->m_TextValue, Objet2->m_TextValue, 32 );
|
||||
if( ii == 0 )
|
||||
ii = Objet1->m_Unit - Objet2->m_Unit;
|
||||
if( ii == 0 )
|
||||
ii = Objet1->m_Sheet - Objet2->m_Sheet;
|
||||
}
|
||||
|
||||
if ( ii == 0 ) ii = Objet1->m_TimeStamp - Objet2->m_TimeStamp;
|
||||
if( ii == 0 )
|
||||
ii = Objet1->m_TimeStamp - Objet2->m_TimeStamp;
|
||||
|
||||
return(ii);
|
||||
return ii;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************/
|
||||
static void ReAnnotateComponents( CmpListStruct* BaseListeCmp, int NbOfCmp )
|
||||
/********************************************************************/
|
||||
|
||||
/* Update the reference component for the schematic project (or the current sheet)
|
||||
*/
|
||||
{
|
||||
|
@ -330,29 +360,31 @@ EDA_SchComponentStruct *DrawLibItem;
|
|||
Text = BaseListeCmp[ii].m_TextRef;
|
||||
DrawLibItem = BaseListeCmp[ii].m_Cmp;
|
||||
|
||||
if ( BaseListeCmp[ii].m_NumRef < 0 ) strcat( Text, "?" );
|
||||
else sprintf( Text + strlen(Text),"%d",BaseListeCmp[ii].m_NumRef );
|
||||
if( BaseListeCmp[ii].m_NumRef < 0 )
|
||||
strcat( Text, "?" );
|
||||
else
|
||||
sprintf( Text + strlen( Text ), "%d", BaseListeCmp[ii].m_NumRef );
|
||||
|
||||
DrawLibItem->m_Field[REFERENCE].m_Text = CONV_FROM_UTF8( Text );
|
||||
DrawLibItem->m_Multi = BaseListeCmp[ii].m_Unit;
|
||||
DrawLibItem->m_RefIdNumber = BaseListeCmp[ii].m_NumRef;
|
||||
if ( DrawLibItem->m_RefIdNumber < 0 ) DrawLibItem->m_RefIdNumber = 0;
|
||||
if( DrawLibItem->m_RefIdNumber < 0 )
|
||||
DrawLibItem->m_RefIdNumber = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**************************************************************/
|
||||
void BreakReference( CmpListStruct* BaseListeCmp, int NbOfCmp )
|
||||
/**************************************************************/
|
||||
|
||||
/* Modifie dans BaseListeCmp la reference des composants en supprimant la
|
||||
partie nombre de la partie texte.
|
||||
Place le nombre dans .m_NumRef
|
||||
Pour les composants multiples non encore annotes, met .m_Unit a sa valeur max
|
||||
Utilise:
|
||||
BaseListeCmp
|
||||
NbOfCmp
|
||||
* partie nombre de la partie texte.
|
||||
* Place le nombre dans .m_NumRef
|
||||
* Pour les composants multiples non encore annotes, met .m_Unit a sa valeur max
|
||||
* Utilise:
|
||||
* BaseListeCmp
|
||||
* NbOfCmp
|
||||
*/
|
||||
{
|
||||
int ii, ll;
|
||||
|
@ -399,8 +431,9 @@ char * Text;
|
|||
/*****************************************************************************/
|
||||
static void ComputeReferenceNumber( CmpListStruct* BaseListeCmp, int NbOfCmp )
|
||||
/*****************************************************************************/
|
||||
|
||||
/* Compute the reference number for components without reference number
|
||||
Compute .m_NumRef member
|
||||
* Compute .m_NumRef member
|
||||
*/
|
||||
{
|
||||
int ii, jj, LastReferenceNumber, NumberOfUnits, Unit;
|
||||
|
@ -422,7 +455,8 @@ CmpListStruct * ObjRef, * ObjToTest;
|
|||
for( ii = 0; ii < NbOfCmp; ii++ )
|
||||
{
|
||||
ObjRef = &BaseListeCmp[ii];
|
||||
if( BaseListeCmp[ii].m_Flag ) continue;
|
||||
if( BaseListeCmp[ii].m_Flag )
|
||||
continue;
|
||||
|
||||
Text = BaseListeCmp[ii].m_TextRef;
|
||||
if( strnicmp( RefText, Text, 32 ) != 0 ) /* Nouveau Identificateur */
|
||||
|
@ -459,19 +493,24 @@ CmpListStruct * ObjRef, * ObjToTest;
|
|||
|
||||
for( Unit = 1; Unit <= NumberOfUnits; Unit++ )
|
||||
{
|
||||
if( BaseListeCmp[ii].m_Unit == Unit ) continue;
|
||||
if( BaseListeCmp[ii].m_Unit == Unit )
|
||||
continue;
|
||||
jj = ExistUnit( BaseListeCmp + ii, Unit, BaseListeCmp, NbOfCmp );
|
||||
if ( jj >= 0 ) continue; /* Unit exists for this reference */
|
||||
if( jj >= 0 )
|
||||
continue; /* Unit exists for this reference */
|
||||
|
||||
/* Search a component to annotate ( same prefix, same value) */
|
||||
for( jj = ii + 1; jj < NbOfCmp; jj++ )
|
||||
{
|
||||
ObjToTest = &BaseListeCmp[jj];
|
||||
if( BaseListeCmp[jj].m_Flag ) continue;
|
||||
if( BaseListeCmp[jj].m_Flag )
|
||||
continue;
|
||||
Text = BaseListeCmp[jj].m_TextRef;
|
||||
if( strnicmp(RefText, Text, 32) != 0 ) break; // references are different
|
||||
if( strnicmp( RefText, Text, 32 ) != 0 )
|
||||
break; // references are different
|
||||
Text = BaseListeCmp[jj].m_TextValue;
|
||||
if( strnicmp(ValText, Text, 32) != 0 ) break; // values are different
|
||||
if( strnicmp( ValText, Text, 32 ) != 0 )
|
||||
break; // values are different
|
||||
if( !BaseListeCmp[jj].m_IsNew )
|
||||
{
|
||||
//BaseListeCmp[jj].m_Flag = 1;
|
||||
|
@ -495,9 +534,10 @@ CmpListStruct * ObjRef, * ObjToTest;
|
|||
/*************************************************************************************************/
|
||||
static int GetLastReferenceNumber( CmpListStruct* Objet, CmpListStruct* BaseListeCmp, int NbOfCmp )
|
||||
/*************************************************************************************************/
|
||||
|
||||
/* Recherche le plus grand numero de reference dans les composants
|
||||
de meme prefixe de reference que celui pointe par Objet
|
||||
la liste des composants est supposee triee
|
||||
* de meme prefixe de reference que celui pointe par Objet
|
||||
* la liste des composants est supposee triee
|
||||
*/
|
||||
{
|
||||
CmpListStruct* LastObjet = BaseListeCmp + NbOfCmp;
|
||||
|
@ -509,9 +549,11 @@ const char * RefText;
|
|||
{
|
||||
if( strnicmp( RefText, Objet->m_TextRef, 32 ) != 0 ) /* Nouveau Identificateur */
|
||||
break;
|
||||
if( LastNumber < Objet->m_NumRef ) LastNumber = Objet->m_NumRef;
|
||||
if( LastNumber < Objet->m_NumRef )
|
||||
LastNumber = Objet->m_NumRef;
|
||||
}
|
||||
return(LastNumber);
|
||||
|
||||
return LastNumber;
|
||||
}
|
||||
|
||||
|
||||
|
@ -519,11 +561,12 @@ const char * RefText;
|
|||
static int ExistUnit( CmpListStruct* Objet, int Unit,
|
||||
CmpListStruct* BaseListeCmp, int NbOfCmp )
|
||||
/****************************************************************/
|
||||
|
||||
/* Recherche dans la liste triee des composants, pour les composants
|
||||
multiples s'il existe pour le composant de reference Objet,
|
||||
une unite de numero Unit
|
||||
Retourne index dans BaseListeCmp si oui
|
||||
retourne -1 si non
|
||||
* multiples s'il existe pour le composant de reference Objet,
|
||||
* une unite de numero Unit
|
||||
* Retourne index dans BaseListeCmp si oui
|
||||
* retourne -1 si non
|
||||
*/
|
||||
{
|
||||
CmpListStruct* EndList = BaseListeCmp + NbOfCmp;
|
||||
|
@ -536,26 +579,31 @@ CmpListStruct *ItemToTest;
|
|||
NumRef = Objet->m_NumRef;
|
||||
for( ItemToTest = BaseListeCmp, ii = 0; ItemToTest < EndList; ItemToTest++, ii++ )
|
||||
{
|
||||
if ( Objet == ItemToTest ) continue;
|
||||
if ( ItemToTest->m_IsNew ) continue; /* non affecte */
|
||||
if ( ItemToTest->m_NumRef != NumRef ) continue;
|
||||
if( Objet == ItemToTest )
|
||||
continue;
|
||||
if( ItemToTest->m_IsNew )
|
||||
continue; /* non affecte */
|
||||
if( ItemToTest->m_NumRef != NumRef )
|
||||
continue;
|
||||
if( strnicmp( RefText, ItemToTest->m_TextRef, 32 ) != 0 ) /* Nouveau Identificateur */
|
||||
continue;
|
||||
if( ItemToTest->m_Unit == Unit )
|
||||
{
|
||||
return(ii);
|
||||
return ii;
|
||||
}
|
||||
}
|
||||
return(-1);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************/
|
||||
int CheckAnnotate( WinEDA_SchematicFrame* frame, bool OneSheetOnly )
|
||||
/******************************************************************/
|
||||
|
||||
/* Retourne le nombre de composants non annotés ou de meme référence (doublés)
|
||||
Si OneSheetOnly : recherche sur le schema courant
|
||||
sinon: recherche sur toute la hierarchie
|
||||
* Si OneSheetOnly : recherche sur le schema courant
|
||||
* sinon: recherche sur toute la hierarchie
|
||||
*/
|
||||
{
|
||||
int NbSheet, ii, NumSheet = 1, error, NbOfCmp;
|
||||
|
@ -566,6 +614,7 @@ wxString msg, cmpref;
|
|||
|
||||
/* build tje screen list */
|
||||
EDA_ScreenList ScreenList( NULL );
|
||||
|
||||
NbSheet = ScreenList.GetCount();
|
||||
|
||||
/* Update the sheet number, sheet count and date */
|
||||
|
@ -582,12 +631,13 @@ wxString msg, cmpref;
|
|||
NbOfCmp += ListeComposants( NULL, screen, NumSheet );
|
||||
}
|
||||
}
|
||||
else NbOfCmp = ListeComposants(NULL, screen, NumSheet);
|
||||
else
|
||||
NbOfCmp = ListeComposants( NULL, screen, NumSheet );
|
||||
|
||||
if( NbOfCmp == 0 )
|
||||
{
|
||||
wxBell();
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ii = sizeof(CmpListStruct) * NbOfCmp;
|
||||
|
@ -622,8 +672,10 @@ wxString msg, cmpref;
|
|||
msg.Empty(); Buff.Empty();
|
||||
if( ListeCmp[ii].m_IsNew )
|
||||
{
|
||||
if( ListeCmp[ii].m_NumRef >= 0 ) Buff << ListeCmp[ii].m_NumRef;
|
||||
else Buff = wxT("?");
|
||||
if( ListeCmp[ii].m_NumRef >= 0 )
|
||||
Buff << ListeCmp[ii].m_NumRef;
|
||||
else
|
||||
Buff = wxT( "?" );
|
||||
cmpref = CONV_FROM_UTF8( ListeCmp[ii].m_TextRef );
|
||||
msg.Printf( _( "item not annotated: %s%s" ), cmpref.GetData(), Buff.GetData() );
|
||||
|
||||
|
@ -638,8 +690,10 @@ wxString msg, cmpref;
|
|||
|
||||
if( MAX( ListeCmp[ii].m_NbParts, 1 ) < ListeCmp[ii].m_Unit ) // Annotate error
|
||||
{
|
||||
if( ListeCmp[ii].m_NumRef >= 0 ) Buff << ListeCmp[ii].m_NumRef;
|
||||
else Buff = wxT("?");
|
||||
if( ListeCmp[ii].m_NumRef >= 0 )
|
||||
Buff << ListeCmp[ii].m_NumRef;
|
||||
else
|
||||
Buff = wxT( "?" );
|
||||
|
||||
cmpref = CONV_FROM_UTF8( ListeCmp[ii].m_TextRef );
|
||||
msg.Printf( _( "Error item %s%s" ), cmpref.GetData(), Buff.GetData() );
|
||||
|
@ -652,23 +706,25 @@ wxString msg, cmpref;
|
|||
}
|
||||
}
|
||||
|
||||
if ( error ) return error;
|
||||
if( error )
|
||||
return error;
|
||||
|
||||
/* comptage des elements doublés (si tous sont annotés) */
|
||||
for( ii = 0; (ii < NbOfCmp - 1) && (error < 4); ii++ )
|
||||
{
|
||||
msg.Empty(); Buff.Empty();
|
||||
if( (stricmp(ListeCmp[ii].m_TextRef,ListeCmp[ii+1].m_TextRef) != 0) ||
|
||||
( ListeCmp[ii].m_NumRef != ListeCmp[ii+1].m_NumRef ) )
|
||||
if( (stricmp( ListeCmp[ii].m_TextRef, ListeCmp[ii + 1].m_TextRef ) != 0)
|
||||
|| ( ListeCmp[ii].m_NumRef != ListeCmp[ii + 1].m_NumRef ) )
|
||||
continue;
|
||||
/* Meme reference trouvée */
|
||||
|
||||
/* Il y a erreur si meme unite */
|
||||
if( ListeCmp[ii].m_Unit == ListeCmp[ii + 1].m_Unit )
|
||||
{
|
||||
|
||||
if( ListeCmp[ii].m_NumRef >= 0 ) Buff << ListeCmp[ii].m_NumRef;
|
||||
else Buff = wxT("?");
|
||||
if( ListeCmp[ii].m_NumRef >= 0 )
|
||||
Buff << ListeCmp[ii].m_NumRef;
|
||||
else
|
||||
Buff = wxT( "?" );
|
||||
|
||||
cmpref = CONV_FROM_UTF8( ListeCmp[ii].m_TextRef );
|
||||
msg.Printf( _( "Multiple item %s%s" ),
|
||||
|
@ -684,12 +740,13 @@ wxString msg, cmpref;
|
|||
}
|
||||
|
||||
/* Il y a erreur si unites differentes mais nombre de parts differentes
|
||||
par boitier (ex U3 ( 1 part) et U3B sont incompatibles) */
|
||||
* par boitier (ex U3 ( 1 part) et U3B sont incompatibles) */
|
||||
if( ListeCmp[ii].m_NbParts != ListeCmp[ii + 1].m_NbParts )
|
||||
{
|
||||
|
||||
if( ListeCmp[ii].m_NumRef >= 0 ) Buff << ListeCmp[ii].m_NumRef;
|
||||
else Buff = wxT("?");
|
||||
if( ListeCmp[ii].m_NumRef >= 0 )
|
||||
Buff << ListeCmp[ii].m_NumRef;
|
||||
else
|
||||
Buff = wxT( "?" );
|
||||
|
||||
cmpref = CONV_FROM_UTF8( ListeCmp[ii].m_TextRef );
|
||||
msg.Printf( _( "Multiple item %s%s" ), cmpref.GetData(), Buff.GetData() );
|
||||
|
@ -715,7 +772,8 @@ wxString msg, cmpref;
|
|||
msg.Printf( _( "Diff values for %s%d%c (%s) and %s%d%c (%s)" ),
|
||||
cmpref.GetData(), ListeCmp[ii].m_NumRef, ListeCmp[ii].m_Unit + 'A' - 1,
|
||||
cmpvalue.GetData(),
|
||||
nextcmpref.GetData(), ListeCmp[ii+1].m_NumRef, ListeCmp[ii+1].m_Unit+'A'-1,
|
||||
nextcmpref.GetData(
|
||||
), ListeCmp[ii + 1].m_NumRef, ListeCmp[ii + 1].m_Unit + 'A' - 1,
|
||||
nextcmpvalue.GetData() );
|
||||
|
||||
DisplayError( frame, msg );
|
||||
|
@ -724,7 +782,5 @@ wxString msg, cmpref;
|
|||
}
|
||||
|
||||
MyFree( ListeCmp );
|
||||
return(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -90,12 +90,12 @@ class SCH_SCREEN : public BASE_SCREEN
|
|||
public:
|
||||
SCH_SCREEN( int idtype, KICAD_T aType = SCREEN_STRUCT_TYPE );
|
||||
~SCH_SCREEN();
|
||||
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT("SCH_SCREEN");
|
||||
}
|
||||
|
||||
|
||||
void FreeDrawList(); // Free EESchema drawing list (does not delete the sub hierarchies)
|
||||
|
||||
void Place( WinEDA_DrawFrame* frame, wxDC* DC ) { };
|
||||
|
|
|
@ -23,9 +23,10 @@ static int TstAlignSegment(EDA_DrawLineStruct* RefSegm, EDA_DrawLineStruct* TstS
|
|||
/*******************************************/
|
||||
bool SCH_SCREEN::SchematicCleanUp( wxDC* DC )
|
||||
/*******************************************/
|
||||
|
||||
/* Routine de nettoyage:
|
||||
- regroupe les segments de fils (ou de bus) alignes en 1 seul segment
|
||||
- Detecte les objets identiques superposes
|
||||
* - regroupe les segments de fils (ou de bus) alignes en 1 seul segment
|
||||
* - Detecte les objets identiques superposes
|
||||
*/
|
||||
{
|
||||
EDA_BaseStruct* DrawList, * TstDrawList;
|
||||
|
@ -53,12 +54,15 @@ bool Modify = FALSE;
|
|||
TstDrawList = EEDrawList;
|
||||
Modify = TRUE;
|
||||
}
|
||||
else TstDrawList = TstDrawList->Pnext;
|
||||
else
|
||||
TstDrawList = TstDrawList->Pnext;
|
||||
}
|
||||
else TstDrawList = TstDrawList->Pnext;
|
||||
else
|
||||
TstDrawList = TstDrawList->Pnext;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EDA_Appl->SchematicFrame->TestDanglingEnds( EEDrawList, DC );
|
||||
return Modify;
|
||||
}
|
||||
|
@ -67,8 +71,9 @@ bool Modify = FALSE;
|
|||
/***********************************************/
|
||||
void BreakSegmentOnJunction( SCH_SCREEN* Screen )
|
||||
/************************************************/
|
||||
|
||||
/* Routine creant des debuts / fin de segment (BUS ou WIRES) sur les jonctions
|
||||
et les raccords
|
||||
* et les raccords
|
||||
*/
|
||||
{
|
||||
EDA_BaseStruct* DrawList;
|
||||
|
@ -122,10 +127,11 @@ EDA_BaseStruct *DrawList;
|
|||
DrawPickedStruct* BreakSegment( SCH_SCREEN* screen,
|
||||
wxPoint breakpoint, bool PutInUndoList )
|
||||
/*********************************************************/
|
||||
|
||||
/* Coupe un segment ( BUS, WIRE ) en 2 au point breakpoint,
|
||||
- si ce point est sur le segment
|
||||
- extremites non comprises
|
||||
If PutInUndoList == TRUE, create a list of modifictions, for undo command
|
||||
* - si ce point est sur le segment
|
||||
* - extremites non comprises
|
||||
* If PutInUndoList == TRUE, create a list of modifictions, for undo command
|
||||
*/
|
||||
{
|
||||
EDA_BaseStruct* DrawList;
|
||||
|
@ -144,14 +150,18 @@ DrawPickedStruct * List = NULL;
|
|||
fx = segment->m_End.x; fy = segment->m_End.y;
|
||||
if( distance( fx - ox, fy - oy, breakpoint.x - ox, breakpoint.y - oy, 0 ) == 0 )
|
||||
break;
|
||||
|
||||
/* Segment connecte: doit etre coupe en 2 si px,py n'est
|
||||
pas une extremite */
|
||||
if( (ox == breakpoint.x) && (oy == breakpoint.y ) ) break;
|
||||
if( (fx == breakpoint.x) && (fy == breakpoint.y ) ) break;
|
||||
* pas une extremite */
|
||||
if( (ox == breakpoint.x) && (oy == breakpoint.y ) )
|
||||
break;
|
||||
if( (fx == breakpoint.x) && (fy == breakpoint.y ) )
|
||||
break;
|
||||
/* Ici il faut couper le segment en 2 */
|
||||
if( PutInUndoList ) // First: put copy of the old segment in undo list
|
||||
{
|
||||
DrawPickedStruct* wrapper = new DrawPickedStruct();
|
||||
|
||||
wrapper->m_Flags = IS_CHANGED;
|
||||
wrapper->m_PickedStruct = segment->GenCopy();
|
||||
wrapper->m_Image = segment;
|
||||
|
@ -168,6 +178,7 @@ DrawPickedStruct * List = NULL;
|
|||
if( PutInUndoList )
|
||||
{
|
||||
DrawPickedStruct* wrapper = new DrawPickedStruct();
|
||||
|
||||
wrapper->m_Flags = IS_NEW;
|
||||
wrapper->m_Image = NewSegment;
|
||||
wrapper->Pnext = List;
|
||||
|
@ -183,6 +194,7 @@ DrawPickedStruct * List = NULL;
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
DrawList = DrawList->Pnext;
|
||||
}
|
||||
|
||||
|
@ -190,19 +202,20 @@ DrawPickedStruct * List = NULL;
|
|||
}
|
||||
|
||||
|
||||
|
||||
/***********************************************************/
|
||||
static int TstAlignSegment( EDA_DrawLineStruct* RefSegm,
|
||||
EDA_DrawLineStruct* TstSegm )
|
||||
/***********************************************************/
|
||||
|
||||
/* Search if the 2 segments RefSegm and TstSegm are on a line.
|
||||
Retourn 0 if no
|
||||
1 if yes, and RefSegm is modified to be the equivalent segment
|
||||
* Retourn 0 if no
|
||||
* 1 if yes, and RefSegm is modified to be the equivalent segment
|
||||
*/
|
||||
{
|
||||
if( RefSegm == TstSegm ) return(0);
|
||||
if( RefSegm->m_Layer != TstSegm->m_Layer ) return(0);
|
||||
if( RefSegm == TstSegm )
|
||||
return 0;
|
||||
if( RefSegm->m_Layer != TstSegm->m_Layer )
|
||||
return 0;
|
||||
|
||||
// search for a common end, and modify coordinates to ensure RefSegm->m_End == TstSegm->m_Start
|
||||
if( RefSegm->m_Start == TstSegm->m_Start )
|
||||
|
@ -232,7 +245,6 @@ static int TstAlignSegment( EDA_DrawLineStruct* RefSegm,
|
|||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
else if( RefSegm->m_Start.x == RefSegm->m_End.x ) // Vertical segment
|
||||
{
|
||||
if( TstSegm->m_Start.x == TstSegm->m_End.x )
|
||||
|
@ -241,10 +253,10 @@ static int TstAlignSegment( EDA_DrawLineStruct* RefSegm,
|
|||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (atan2(RefSegm->m_Start.x - RefSegm->m_End.x, RefSegm->m_Start.y - RefSegm->m_End.y) ==
|
||||
if( atan2( RefSegm->m_Start.x - RefSegm->m_End.x, RefSegm->m_Start.y -
|
||||
RefSegm->m_End.y ) ==
|
||||
atan2( TstSegm->m_Start.x - TstSegm->m_End.x, TstSegm->m_Start.y - TstSegm->m_End.y ) )
|
||||
{
|
||||
RefSegm->m_End = TstSegm->m_End;
|
||||
|
@ -252,6 +264,5 @@ static int TstAlignSegment( EDA_DrawLineStruct* RefSegm,
|
|||
}
|
||||
}
|
||||
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -143,6 +143,23 @@ wxString DrawMarkerStruct::GetComment()
|
|||
}
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
/**
|
||||
* Function Show
|
||||
* is used to output the object tree, currently for debugging only.
|
||||
* @param nestLevel An aid to prettier tree indenting, and is the level
|
||||
* of nesting of this object within the overall tree.
|
||||
* @param os The ostream& to output to.
|
||||
*/
|
||||
void DrawMarkerStruct::Show( int nestLevel, std::ostream& os )
|
||||
{
|
||||
// for now, make it look like XML:
|
||||
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << m_Pos
|
||||
<< "/>\n";
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/***************************/
|
||||
/* Class EDA_DrawLineStruct */
|
||||
/***************************/
|
||||
|
@ -201,6 +218,28 @@ bool EDA_DrawLineStruct::IsOneEndPointAt( const wxPoint& pos )
|
|||
}
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
/**
|
||||
* Function Show
|
||||
* is used to output the object tree, currently for debugging only.
|
||||
* @param nestLevel An aid to prettier tree indenting, and is the level
|
||||
* of nesting of this object within the overall tree.
|
||||
* @param os The ostream& to output to.
|
||||
*/
|
||||
void EDA_DrawLineStruct::Show( int nestLevel, std::ostream& os )
|
||||
{
|
||||
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
|
||||
" layer=\"" << m_Layer << '"' <<
|
||||
" width=\"" << m_Width << '"' <<
|
||||
" startIsDangling=\"" << m_StartIsDangling << '"' <<
|
||||
" endIsDangling=\"" << m_EndIsDangling << '"' << ">" <<
|
||||
" <start" << m_Start << "/>" <<
|
||||
" <end" << m_End << "/>" <<
|
||||
"</" << GetClass().Lower().mb_str() << ">\n";
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/****************************/
|
||||
/* Class DrawPolylineStruct */
|
||||
/****************************/
|
||||
|
|
|
@ -27,51 +27,77 @@ DrawPartStruct::DrawPartStruct( KICAD_T struct_type, const wxPoint & pos):
|
|||
EDA_BaseStruct( struct_type )
|
||||
/***********************************************************************************/
|
||||
{
|
||||
m_Layer = 0;
|
||||
m_Pos = pos;
|
||||
m_TimeStamp = 0;
|
||||
}
|
||||
|
||||
|
||||
/************************************/
|
||||
DrawPartStruct::~DrawPartStruct()
|
||||
/************************************/
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************/
|
||||
wxString ReturnDefaultFieldName(int FieldNumber)
|
||||
const wxString& ReturnDefaultFieldName( int aFieldNdx )
|
||||
/****************************************************************/
|
||||
/* Return the defult ield name from its number (REFERENCE, VALUE ..)
|
||||
FieldDefaultNameList is not static, because we want the text translation
|
||||
for I18n
|
||||
|
||||
/* Return the default field name from its index (REFERENCE, VALUE ..)
|
||||
* FieldDefaultNameList is not static, because we want the text translation
|
||||
* for I18n
|
||||
*/
|
||||
{
|
||||
wxString FieldDefaultNameList[] = {
|
||||
// avoid unnecessarily copying wxStrings.
|
||||
static const wxString FieldDefaultNameList[] = {
|
||||
_( "Ref" ), /* Reference of part, i.e. "IC21" */
|
||||
_( "Value" ), /* Value of part, i.e. "3.3K" */
|
||||
_( "Footprint" ), /* Footprint, used by cvpcb or pcbnew, i.e. "16DIP300" */
|
||||
_( "Sheet" ), /* for components which are a schematic file, schematic file name, i.e. "cnt16.sch" */
|
||||
_("Field") /* User fields (1 to n) have an editable name*/
|
||||
_( "Field1" ), /* User fields (1 to n) have an editable name*/
|
||||
_( "Field2" ),
|
||||
_( "Field3" ),
|
||||
_( "Field4" ),
|
||||
_( "Field5" ),
|
||||
_( "Field6" ),
|
||||
_( "Field7" ),
|
||||
_( "Field8" ),
|
||||
wxT( "badFieldNdx!" ) // error, and "sentinel" value
|
||||
};
|
||||
int ii = FieldNumber;
|
||||
if ( ii > FIELD1 ) ii = FIELD1;
|
||||
wxString FieldName = FieldDefaultNameList[ii];
|
||||
|
||||
if (FieldNumber >= FIELD1 ) FieldName << (FieldNumber - FIELD1 + 1);
|
||||
return FieldName;
|
||||
if( (unsigned) aFieldNdx > FIELD8 ) // catches < 0 also
|
||||
aFieldNdx = FIELD8+1; // return the sentinel text
|
||||
|
||||
return FieldDefaultNameList[aFieldNdx];
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************/
|
||||
wxString EDA_SchComponentStruct::ReturnFieldName(int FieldNumber)
|
||||
const wxString& EDA_SchComponentStruct::ReturnFieldName( int aFieldNdx ) const
|
||||
/****************************************************************/
|
||||
/* Return the Field name from its number (REFERENCE, VALUE ..)
|
||||
|
||||
/* Return the Field name from its index (REFERENCE, VALUE ..)
|
||||
*/
|
||||
{
|
||||
wxString FieldName = m_Field[FieldNumber].m_Name;
|
||||
// avoid unnecessarily copying wxStrings.
|
||||
|
||||
if ( (FieldNumber < FIELD1) || FieldName.IsEmpty() )
|
||||
FieldName = ReturnDefaultFieldName(FieldNumber);
|
||||
return FieldName;
|
||||
if( aFieldNdx < FIELD1 || m_Field[aFieldNdx].m_Name.IsEmpty() )
|
||||
return ReturnDefaultFieldName( aFieldNdx );
|
||||
|
||||
return m_Field[aFieldNdx].m_Name;
|
||||
}
|
||||
|
||||
|
||||
const wxString& EDA_SchComponentStruct::GetFieldValue( int aFieldNdx ) const
|
||||
{
|
||||
// avoid unnecessarily copying wxStrings.
|
||||
static const wxString myEmpty = wxEmptyString;
|
||||
|
||||
if( (unsigned) aFieldNdx > FIELD8 || m_Field[aFieldNdx].m_Text.IsEmpty() )
|
||||
return myEmpty;
|
||||
|
||||
return m_Field[aFieldNdx].m_Text;
|
||||
}
|
||||
|
||||
|
||||
|
@ -81,10 +107,12 @@ EDA_SchComponentStruct::EDA_SchComponentStruct(const wxPoint & pos):
|
|||
/*******************************************************************/
|
||||
{
|
||||
int ii;
|
||||
|
||||
m_Multi = 0; /* In multi unit chip - which unit to draw. */
|
||||
m_RefIdNumber = 0;
|
||||
m_FlagControlMulti = 0;
|
||||
m_Convert = 0; /* Gestion des mutiples representations (conversion De Morgan) */
|
||||
|
||||
/* The rotation/mirror transformation matrix. pos normal*/
|
||||
m_Transform[0][0] = 1;
|
||||
m_Transform[0][1] = 0;
|
||||
|
@ -104,7 +132,6 @@ int ii;
|
|||
m_Field[REFERENCE].m_Layer = LAYER_REFERENCEPART;
|
||||
|
||||
m_PinIsDangling = NULL;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -115,11 +142,13 @@ EDA_Rect EDA_SchComponentStruct::GetBoundaryBox()
|
|||
EDA_LibComponentStruct* Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
|
||||
EDA_Rect BoundaryBox;
|
||||
int x0, xm, y0, ym;
|
||||
|
||||
/* Get the basic Boundary box */
|
||||
if( Entry )
|
||||
{
|
||||
BoundaryBox = Entry->GetBoundaryBox( m_Multi, m_Convert );
|
||||
x0 = BoundaryBox.GetX(); xm = BoundaryBox.GetRight();
|
||||
|
||||
// We must reverse Y values, because matrix orientation
|
||||
// suppose Y axis normal for the library items coordinates,
|
||||
// m_Transform reverse Y values, but BoundaryBox ais already reversed!
|
||||
|
@ -142,8 +171,11 @@ int x0, xm, y0, ym;
|
|||
int y2 = m_Transform[1][0] * xm + m_Transform[1][1] * ym;
|
||||
|
||||
// H and W must be > 0 for wxRect:
|
||||
if ( x2 < x1 ) EXCHG( x2, x1 );
|
||||
if ( y2 < y1 ) EXCHG( y2, y1 );
|
||||
if( x2 < x1 )
|
||||
EXCHG( x2, x1 );
|
||||
if( y2 < y1 )
|
||||
EXCHG( y2, y1 );
|
||||
|
||||
BoundaryBox.SetX( x1 ); BoundaryBox.SetY( y1 );
|
||||
BoundaryBox.SetWidth( x2 - x1 );
|
||||
BoundaryBox.SetHeight( y2 - y1 );
|
||||
|
@ -156,8 +188,9 @@ int x0, xm, y0, ym;
|
|||
/**************************************************************************/
|
||||
void PartTextStruct::SwapData( PartTextStruct* copyitem )
|
||||
/**************************************************************************/
|
||||
|
||||
/* Used if undo / redo command:
|
||||
swap data between this and copyitem
|
||||
* swap data between this and copyitem
|
||||
*/
|
||||
{
|
||||
EXCHG( m_Text, copyitem->m_Text );
|
||||
|
@ -176,11 +209,13 @@ void PartTextStruct::SwapData(PartTextStruct * copyitem)
|
|||
EXCHG( m_TextDrawingsSize, copyitem->m_TextDrawingsSize );
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
void EDA_SchComponentStruct::SwapData( EDA_SchComponentStruct* copyitem )
|
||||
/**************************************************************************/
|
||||
|
||||
/* Used if undo / redo command:
|
||||
swap data between this and copyitem
|
||||
* swap data between this and copyitem
|
||||
*/
|
||||
{
|
||||
EXCHG( m_Pos, copyitem->m_Pos );
|
||||
|
@ -202,16 +237,19 @@ void EDA_SchComponentStruct::Place(WinEDA_DrawFrame * frame, wxDC * DC)
|
|||
/***********************************************************************/
|
||||
{
|
||||
/* save old text in undo list */
|
||||
if ( g_ItemToUndoCopy &&
|
||||
(g_ItemToUndoCopy->Type() == Type()) &&
|
||||
((m_Flags & IS_NEW) == 0) )
|
||||
if( g_ItemToUndoCopy
|
||||
&& ( g_ItemToUndoCopy->Type() == Type() )
|
||||
&& ( (m_Flags & IS_NEW) == 0 ) )
|
||||
{
|
||||
/* restore old values and save new ones */
|
||||
SwapData( (EDA_SchComponentStruct*) g_ItemToUndoCopy );
|
||||
|
||||
/* save in undo list */
|
||||
( (WinEDA_SchematicFrame*) frame )->SaveCopyInUndoList( this, IS_CHANGED );
|
||||
|
||||
/* restore new values */
|
||||
SwapData( (EDA_SchComponentStruct*) g_ItemToUndoCopy );
|
||||
|
||||
delete g_ItemToUndoCopy;
|
||||
g_ItemToUndoCopy = NULL;
|
||||
}
|
||||
|
@ -223,6 +261,7 @@ void EDA_SchComponentStruct::Place(WinEDA_DrawFrame * frame, wxDC * DC)
|
|||
/***************************************************/
|
||||
void EDA_SchComponentStruct::ClearAnnotation()
|
||||
/***************************************************/
|
||||
|
||||
/* Suppress annotation ( i.i IC23 changed to IC? and part reset to 1)
|
||||
*/
|
||||
{
|
||||
|
@ -230,6 +269,7 @@ void EDA_SchComponentStruct::ClearAnnotation()
|
|||
|
||||
while( isdigit( m_Field[REFERENCE].m_Text.Last() ) )
|
||||
m_Field[REFERENCE].m_Text.RemoveLast();
|
||||
|
||||
if( m_Field[REFERENCE].m_Text.Last() != '?' )
|
||||
m_Field[REFERENCE].m_Text.Append( '?' );
|
||||
|
||||
|
@ -240,11 +280,13 @@ EDA_LibComponentStruct *Entry;
|
|||
m_Multi = 1;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************/
|
||||
EDA_SchComponentStruct* EDA_SchComponentStruct::GenCopy()
|
||||
/**************************************************************/
|
||||
{
|
||||
EDA_SchComponentStruct* new_item = new EDA_SchComponentStruct( m_Pos );
|
||||
|
||||
int ii;
|
||||
|
||||
new_item->m_Multi = m_Multi;
|
||||
|
@ -271,9 +313,10 @@ int ii;
|
|||
/*****************************************************************/
|
||||
void EDA_SchComponentStruct::SetRotationMiroir( int type_rotate )
|
||||
/******************************************************************/
|
||||
|
||||
/* Compute the new matrix transform for a schematic component
|
||||
in order to have the requested transform (type_rotate = rot, mirror..)
|
||||
which is applied to the initial transform.
|
||||
* in order to have the requested transform (type_rotate = rot, mirror..)
|
||||
* which is applied to the initial transform.
|
||||
*/
|
||||
{
|
||||
int TempMat[2][2];
|
||||
|
@ -380,13 +423,13 @@ bool Transform = FALSE;
|
|||
|
||||
if( Transform )
|
||||
{/* The new matrix transform is the old matrix transform modified by the
|
||||
requested transformation, which is the TempMat transform (rot, mirror ..)
|
||||
in order to have (in term of matrix transform):
|
||||
transform coord = new_m_Transform * coord
|
||||
where transform coord is the coord modified by new_m_Transform from the initial
|
||||
value coord.
|
||||
new_m_Transform is computed (from old_m_Transform and TempMat) to have:
|
||||
transform coord = old_m_Transform * coord * TempMat
|
||||
* requested transformation, which is the TempMat transform (rot, mirror ..)
|
||||
* in order to have (in term of matrix transform):
|
||||
* transform coord = new_m_Transform * coord
|
||||
* where transform coord is the coord modified by new_m_Transform from the initial
|
||||
* value coord.
|
||||
* new_m_Transform is computed (from old_m_Transform and TempMat) to have:
|
||||
* transform coord = old_m_Transform * coord * TempMat
|
||||
*/
|
||||
int NewMatrix[2][2];
|
||||
|
||||
|
@ -466,7 +509,7 @@ bool found = FALSE;
|
|||
|
||||
if( found )
|
||||
{
|
||||
return (type_rotate + ii);
|
||||
return type_rotate + ii;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -474,43 +517,87 @@ bool found = FALSE;
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
wxPoint EDA_SchComponentStruct::GetScreenCoord( const wxPoint& coord )
|
||||
/***********************************************************************/
|
||||
|
||||
/* Renvoie la coordonnée du point coord, en fonction de l'orientation
|
||||
du composant (rotation, miroir).
|
||||
Les coord sont toujours relatives à l'ancre (coord 0,0) du composant
|
||||
* du composant (rotation, miroir).
|
||||
* Les coord sont toujours relatives à l'ancre (coord 0,0) du composant
|
||||
*/
|
||||
{
|
||||
wxPoint screenpos;
|
||||
|
||||
screenpos.x = m_Transform[0][0] * coord.x + m_Transform[0][1] * coord.y;
|
||||
screenpos.y = m_Transform[1][0] * coord.x + m_Transform[1][1] * coord.y;
|
||||
return screenpos;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
/**
|
||||
* Function Show
|
||||
* is used to output the object tree, currently for debugging only.
|
||||
* @param nestLevel An aid to prettier tree indenting, and is the level
|
||||
* of nesting of this object within the overall tree.
|
||||
* @param os The ostream& to output to.
|
||||
*/
|
||||
void EDA_SchComponentStruct::Show( int nestLevel, std::ostream& os )
|
||||
{
|
||||
// for now, make it look like XML:
|
||||
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
|
||||
" ref=\"" << GetReference().mb_str() << '"' <<
|
||||
" chipName=\"" << m_ChipName.mb_str() << '"' <<
|
||||
m_Pos <<
|
||||
" layer=\"" << m_Layer << '"' <<
|
||||
"/>\n";
|
||||
|
||||
// skip the reference, it's been output already.
|
||||
for( int i=1; i<NUMBER_OF_FIELDS; ++i )
|
||||
{
|
||||
wxString value = GetFieldValue( i );
|
||||
|
||||
if( !value.IsEmpty() )
|
||||
{
|
||||
NestedSpace( nestLevel+1, os ) << "<field" <<
|
||||
" name=\"" << ReturnFieldName(i).mb_str() << '"' <<
|
||||
" value=\"" << value.mb_str() << "\"/>\n";
|
||||
}
|
||||
}
|
||||
|
||||
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
PartTextStruct::PartTextStruct( const wxPoint& pos, const wxString& text ) :
|
||||
EDA_BaseStruct(DRAW_PART_TEXT_STRUCT_TYPE),
|
||||
EDA_TextStruct(text)
|
||||
EDA_BaseStruct( DRAW_PART_TEXT_STRUCT_TYPE ), EDA_TextStruct( text )
|
||||
/***************************************************************************/
|
||||
{
|
||||
m_Pos = pos;
|
||||
m_FieldId = 0;
|
||||
}
|
||||
|
||||
|
||||
/************************************/
|
||||
PartTextStruct::~PartTextStruct()
|
||||
/************************************/
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************/
|
||||
void PartTextStruct::PartTextCopy( PartTextStruct* target )
|
||||
/***********************************************************/
|
||||
{
|
||||
target->m_Text = m_Text;
|
||||
if ( m_FieldId >= FIELD1 )target->m_Name = m_Name;
|
||||
if( m_FieldId >= FIELD1 )
|
||||
target->m_Name = m_Name;
|
||||
target->m_Layer = m_Layer;
|
||||
target->m_Pos = m_Pos;
|
||||
target->m_Size = m_Size;
|
||||
|
@ -526,11 +613,13 @@ void PartTextStruct::PartTextCopy(PartTextStruct * target)
|
|||
/*********************************/
|
||||
bool PartTextStruct::IsVoid()
|
||||
/*********************************/
|
||||
|
||||
/* return True if The field is void, i.e.:
|
||||
contains wxEmptyString or "~"
|
||||
* contains wxEmptyString or "~"
|
||||
*/
|
||||
{
|
||||
if ( m_Text.IsEmpty() || m_Text == wxT("~") ) return TRUE;
|
||||
if( m_Text.IsEmpty() || m_Text == wxT( "~" ) )
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -538,10 +627,11 @@ bool PartTextStruct::IsVoid()
|
|||
/********************************************/
|
||||
EDA_Rect PartTextStruct::GetBoundaryBox()
|
||||
/********************************************/
|
||||
/* return
|
||||
EDA_Rect contains the real (user coordinates) boundary box for a text field,
|
||||
according to the component position, rotation, mirror ...
|
||||
|
||||
/* return
|
||||
* EDA_Rect contains the real (user coordinates) boundary box for a text field,
|
||||
* according to the component position, rotation, mirror ...
|
||||
*
|
||||
*/
|
||||
{
|
||||
EDA_Rect BoundaryBox;
|
||||
|
@ -582,12 +672,16 @@ EDA_SchComponentStruct * DrawLibItem = (EDA_SchComponentStruct *) m_Parent;
|
|||
/* If the component orientation is +/- 90 deg, the text orienation must be changed */
|
||||
if( DrawLibItem->m_Transform[0][1] )
|
||||
{
|
||||
if ( orient == TEXT_ORIENT_HORIZ) orient = TEXT_ORIENT_VERT;
|
||||
else orient = TEXT_ORIENT_HORIZ;
|
||||
if( orient == TEXT_ORIENT_HORIZ )
|
||||
orient = TEXT_ORIENT_VERT;
|
||||
else
|
||||
orient = TEXT_ORIENT_HORIZ;
|
||||
/* is it mirrored (for text justify)*/
|
||||
EXCHG( hjustify, vjustify );
|
||||
if (DrawLibItem->m_Transform[1][0] < 0 ) vjustify = - vjustify;
|
||||
if (DrawLibItem->m_Transform[0][1] > 0 ) hjustify = - hjustify;
|
||||
if( DrawLibItem->m_Transform[1][0] < 0 )
|
||||
vjustify = -vjustify;
|
||||
if( DrawLibItem->m_Transform[0][1] > 0 )
|
||||
hjustify = -hjustify;
|
||||
}
|
||||
else /* component horizontal: is it mirrored (for text justify)*/
|
||||
{
|
||||
|
@ -597,28 +691,34 @@ EDA_SchComponentStruct * DrawLibItem = (EDA_SchComponentStruct *) m_Parent;
|
|||
vjustify = -vjustify;
|
||||
}
|
||||
|
||||
if ( orient == TEXT_ORIENT_VERT ) EXCHG(dx, dy);
|
||||
if( orient == TEXT_ORIENT_VERT )
|
||||
EXCHG( dx, dy );
|
||||
|
||||
switch( hjustify )
|
||||
{
|
||||
case GR_TEXT_HJUSTIFY_CENTER:
|
||||
x1 = x2 - (dx / 2);
|
||||
break;
|
||||
|
||||
case GR_TEXT_HJUSTIFY_RIGHT:
|
||||
x1 = x2 - dx;
|
||||
break;
|
||||
|
||||
default:
|
||||
x1 = x2;
|
||||
break;
|
||||
}
|
||||
|
||||
switch( vjustify )
|
||||
{
|
||||
case GR_TEXT_VJUSTIFY_CENTER:
|
||||
y1 = y2 - (dy / 2);
|
||||
break;
|
||||
|
||||
case GR_TEXT_VJUSTIFY_BOTTOM:
|
||||
y1 = y2 - dy;
|
||||
break;
|
||||
|
||||
default:
|
||||
y1 = y2;
|
||||
break;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
/* Definition de la representation du composant */
|
||||
#define NUMBER_OF_FIELDS 12 /* Nombre de champs de texte affectes au composant */
|
||||
typedef enum {
|
||||
enum NumFieldType {
|
||||
REFERENCE = 0, /* Champ Reference of part, i.e. "IC21" */
|
||||
VALUE, /* Champ Value of part, i.e. "3.3K" */
|
||||
FOOTPRINT, /* Champ Name Module PCB, i.e. "16DIP300" */
|
||||
|
@ -28,7 +28,7 @@ typedef enum {
|
|||
FIELD6,
|
||||
FIELD7,
|
||||
FIELD8
|
||||
} NumFieldType;
|
||||
};
|
||||
|
||||
|
||||
/* Class to manage component fields.
|
||||
|
@ -46,9 +46,10 @@ public:
|
|||
public:
|
||||
PartTextStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString );
|
||||
~PartTextStruct();
|
||||
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT( "PartTextStruct" );
|
||||
return wxT( "PartText" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -77,10 +78,18 @@ public:
|
|||
public:
|
||||
DrawPartStruct( KICAD_T struct_type, const wxPoint &pos );
|
||||
~DrawPartStruct();
|
||||
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT( "DrawPartStruct" );
|
||||
return wxT( "DrawPart" );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function GetReference
|
||||
* returns a reference to the Reference
|
||||
*/
|
||||
const wxString& GetReference() { return m_Field[REFERENCE].m_Text; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -101,18 +110,29 @@ public:
|
|||
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT( "EDA_SchComponentStruct" );
|
||||
return wxT( "EDA_SchComponent" );
|
||||
}
|
||||
|
||||
|
||||
EDA_SchComponentStruct* GenCopy( void );
|
||||
EDA_SchComponentStruct* GenCopy();
|
||||
void SetRotationMiroir( int type );
|
||||
int GetRotationMiroir();
|
||||
wxPoint GetScreenCoord( const wxPoint& coord );
|
||||
void Display_Infos( WinEDA_DrawFrame* frame );
|
||||
void ClearAnnotation();
|
||||
EDA_Rect GetBoundaryBox();
|
||||
wxString ReturnFieldName( int FieldNumber );
|
||||
|
||||
const wxString& ReturnFieldName( int aFieldNdx ) const;
|
||||
|
||||
|
||||
/**
|
||||
* Function GetFieldValue
|
||||
* returns a reference to the field value.
|
||||
* @param aFieldNdx An index into the array of fields, 0 - FIELD8
|
||||
* @return const wxString& - the field value or wxEmptyString
|
||||
*/
|
||||
const wxString& GetFieldValue( int aFieldNdx ) const;
|
||||
|
||||
|
||||
virtual void Draw( WinEDA_DrawPanel* panel,
|
||||
wxDC* DC,
|
||||
|
@ -122,6 +142,17 @@ public:
|
|||
void SwapData( EDA_SchComponentStruct* copyitem );
|
||||
|
||||
virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC );
|
||||
|
||||
#if defined(DEBUG)
|
||||
/**
|
||||
* Function Show
|
||||
* is used to output the object tree, currently for debugging only.
|
||||
* @param nestLevel An aid to prettier tree indenting, and is the level
|
||||
* of nesting of this object within the overall tree.
|
||||
* @param os The ostream& to output to.
|
||||
*/
|
||||
void Show( int nestLevel, std::ostream& os );
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ enum id_libedit {
|
|||
};
|
||||
|
||||
|
||||
|
||||
/* Routines locales */
|
||||
|
||||
/* Variables locales */
|
||||
|
@ -33,12 +32,12 @@ extern int CurrentUnit;
|
|||
/* Classe de la frame des propriétés d'un composant en librairie */
|
||||
|
||||
/* Cette classe genere une fenetre type NoteBook, pour l'edition des propriétés
|
||||
d'un composant le librairie.
|
||||
On peut éditer:
|
||||
Texte dimensions et justification de tous les champs (Ref, Val, et autres champs)
|
||||
Documentation et mots clefs
|
||||
Nombre de part par boitier
|
||||
et autres propriérés générales
|
||||
* d'un composant le librairie.
|
||||
* On peut éditer:
|
||||
* Texte dimensions et justification de tous les champs (Ref, Val, et autres champs)
|
||||
* Documentation et mots clefs
|
||||
* Nombre de part par boitier
|
||||
* et autres propriérés générales
|
||||
*/
|
||||
|
||||
#include "dialog_edit_component_in_lib.cpp"
|
||||
|
@ -52,16 +51,20 @@ wxPoint fpos = pos;
|
|||
|
||||
WinEDA_PartPropertiesFrame* frame =
|
||||
new WinEDA_PartPropertiesFrame( this );
|
||||
int IsModified = frame->ShowModal(); frame->Destroy();
|
||||
if ( IsModified ) Refresh();
|
||||
|
||||
int IsModified = frame->ShowModal(); frame->Destroy();
|
||||
|
||||
if( IsModified )
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
void WinEDA_PartPropertiesFrame::CopyFieldDataToBuffer( LibDrawField* Field )
|
||||
/***************************************************************************/
|
||||
|
||||
/* copy the field data (name, attributes, size, position... to corresponding buffers
|
||||
for editing
|
||||
* for editing
|
||||
*/
|
||||
{
|
||||
int id = Field->m_FieldId;
|
||||
|
@ -80,11 +83,14 @@ int id = Field->m_FieldId;
|
|||
m_FieldVJustify[id] = 0;
|
||||
else if( Field->m_VJustify == GR_TEXT_VJUSTIFY_TOP )
|
||||
m_FieldVJustify[id] = 2;
|
||||
else m_FieldVJustify[id] = 1;
|
||||
else
|
||||
m_FieldVJustify[id] = 1;
|
||||
|
||||
m_FieldText[id] = Field->m_Text;
|
||||
if ( id >= FIELD1 ) m_FieldName[id] = Field->m_Name;
|
||||
if( id >= FIELD1 )
|
||||
m_FieldName[id] = Field->m_Name;
|
||||
m_FieldPosition[id] = Field->m_Pos;
|
||||
|
||||
// Note: the Y axis for components in lib is from bottom to top
|
||||
// and the screen axis is top to bottom: we must change the y coord sign for editing
|
||||
m_FieldPosition[id].y = -m_FieldPosition[id].y;
|
||||
|
@ -95,21 +101,27 @@ int id = Field->m_FieldId;
|
|||
/***************************************************************************/
|
||||
void WinEDA_PartPropertiesFrame::CopyBufferToFieldData( LibDrawField* Field )
|
||||
/***************************************************************************/
|
||||
|
||||
/* Copy data from buffers(name, attributes, size, position... )to the
|
||||
field "Field"
|
||||
* field "Field"
|
||||
*/
|
||||
{
|
||||
int hjustify[3] = { GR_TEXT_HJUSTIFY_LEFT , GR_TEXT_HJUSTIFY_CENTER,
|
||||
GR_TEXT_HJUSTIFY_RIGHT };
|
||||
int vjustify[3] = { GR_TEXT_VJUSTIFY_BOTTOM , GR_TEXT_VJUSTIFY_CENTER,
|
||||
GR_TEXT_VJUSTIFY_TOP };
|
||||
int hjustify[3] = {
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_CENTER,
|
||||
GR_TEXT_HJUSTIFY_RIGHT
|
||||
};
|
||||
int vjustify[3] = {
|
||||
GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_CENTER,
|
||||
GR_TEXT_VJUSTIFY_TOP
|
||||
};
|
||||
int ii = Field->m_FieldId;
|
||||
|
||||
Field->m_Text = m_FieldText[ii];
|
||||
|
||||
if( ii >= FIELD1 && m_FieldName[ii] != ReturnDefaultFieldName( ii ) )
|
||||
Field->m_Name = m_FieldName[ii];
|
||||
else Field->m_Name.Empty();
|
||||
else
|
||||
Field->m_Name.Empty();
|
||||
|
||||
Field->m_Size.x = Field->m_Size.y = m_FieldSize[ii];
|
||||
Field->m_HJustify = hjustify[m_FieldHJustify[ii]];
|
||||
|
@ -120,16 +132,19 @@ int ii = Field->m_FieldId;
|
|||
Field->m_Attributs |= TEXT_NO_VISIBLE;
|
||||
Field->m_Orient = m_FieldOrient[ii] ? 1 : 0;
|
||||
Field->m_Pos = m_FieldPosition[ii];
|
||||
|
||||
// Note: the Y axis for components in lib is from bottom to top
|
||||
// and the screen axis is top to bottom: we must change the y coord sign after editing
|
||||
Field->m_Pos.y = -Field->m_Pos.y;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************/
|
||||
void WinEDA_PartPropertiesFrame::InitBuffers()
|
||||
/*****************************************************/
|
||||
|
||||
/* Init the buffers to a default value,
|
||||
or to values from CurrentLibEntry if CurrentLibEntry != NULL
|
||||
* or to values from CurrentLibEntry if CurrentLibEntry != NULL
|
||||
*/
|
||||
{
|
||||
int ii;
|
||||
|
@ -184,6 +199,7 @@ int ii;
|
|||
/*****************************************************/
|
||||
void WinEDA_PartPropertiesFrame::BuildPanelAlias()
|
||||
/*****************************************************/
|
||||
|
||||
/* create the panel for component alias list editing
|
||||
*/
|
||||
{
|
||||
|
@ -191,11 +207,14 @@ wxButton * Button;
|
|||
|
||||
m_PanelAlias->SetFont( *g_DialogFont );
|
||||
wxBoxSizer* PanelAliasBoxSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_PanelAlias->SetSizer( PanelAliasBoxSizer );
|
||||
wxBoxSizer* LeftBoxSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
PanelAliasBoxSizer->Add( LeftBoxSizer, 0, wxGROW | wxALL, 5 );
|
||||
|
||||
wxStaticText* Msg = new wxStaticText( m_PanelAlias, -1, _( "Alias" ) );
|
||||
|
||||
Msg->SetForegroundColour( wxColour( 200, 0, 0 ) );
|
||||
LeftBoxSizer->Add( Msg, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
|
||||
|
||||
|
@ -204,24 +223,30 @@ wxButton * Button;
|
|||
wxDefaultPosition, wxSize( 200, 250 ),
|
||||
0, NULL,
|
||||
wxLB_ALWAYS_SB | wxLB_SINGLE );
|
||||
|
||||
LeftBoxSizer->Add( m_PartAliasList, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
||||
|
||||
wxBoxSizer* RightBoxSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
PanelAliasBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
||||
|
||||
Button = new wxButton( m_PanelAlias, ID_ADD_ALIAS, _( "Add" ) );
|
||||
|
||||
Button->SetForegroundColour( *wxBLUE );
|
||||
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
|
||||
|
||||
m_ButtonDeleteOneAlias = new wxButton( m_PanelAlias, ID_DELETE_ONE_ALIAS,
|
||||
_( "Delete" ) );
|
||||
|
||||
m_ButtonDeleteOneAlias->SetForegroundColour( *wxRED );
|
||||
RightBoxSizer->Add( m_ButtonDeleteOneAlias, 0, wxGROW | wxALL, 5 );
|
||||
|
||||
m_ButtonDeleteAllAlias = new wxButton( m_PanelAlias, ID_DELETE_ALL_ALIAS,
|
||||
_( "Delete All" ) );
|
||||
|
||||
m_ButtonDeleteAllAlias->SetForegroundColour( *wxRED );
|
||||
if ( ! CurrentAliasName.IsEmpty() ) m_ButtonDeleteAllAlias->Enable(FALSE);
|
||||
if( !CurrentAliasName.IsEmpty() )
|
||||
m_ButtonDeleteAllAlias->Enable( FALSE );
|
||||
RightBoxSizer->Add( m_ButtonDeleteAllAlias, 0, wxGROW | wxALL, 5 );
|
||||
|
||||
|
||||
|
@ -243,21 +268,30 @@ wxButton * Button;
|
|||
/*****************************************************************/
|
||||
void WinEDA_PartPropertiesFrame::BuildPanelFootprintFilter()
|
||||
/*****************************************************************/
|
||||
|
||||
/* create the panel for footprint filtering in cvpcb list
|
||||
*/
|
||||
{
|
||||
m_PanelFootprintFilter = new wxPanel( m_NoteBook,
|
||||
-1,
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
wxSUNKEN_BORDER | wxTAB_TRAVERSAL );
|
||||
|
||||
m_PanelFootprintFilter = new wxPanel( m_NoteBook, -1, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
|
||||
m_NoteBook->AddPage( m_PanelFootprintFilter, _( "Footprint Filter" ) );
|
||||
|
||||
m_PanelFootprintFilter->SetFont( *g_DialogFont );
|
||||
|
||||
wxBoxSizer* PanelFpFilterBoxSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_PanelFootprintFilter->SetSizer( PanelFpFilterBoxSizer );
|
||||
wxBoxSizer* LeftBoxSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
PanelFpFilterBoxSizer->Add( LeftBoxSizer, 0, wxGROW | wxALL, 5 );
|
||||
|
||||
wxStaticText * Msg = new wxStaticText(m_PanelFootprintFilter, -1, _("Footprints"));
|
||||
wxStaticText* Msg = new wxStaticText( m_PanelFootprintFilter, -1, _(
|
||||
"Footprints" ) );
|
||||
|
||||
Msg->SetForegroundColour( wxColour( 200, 0, 0 ) );
|
||||
LeftBoxSizer->Add( Msg, 0, wxGROW | wxLEFT | wxRIGHT | wxTOP, 5 );
|
||||
|
||||
|
@ -266,22 +300,33 @@ wxBoxSizer * PanelFpFilterBoxSizer = new wxBoxSizer(wxHORIZONTAL);
|
|||
wxDefaultPosition, wxSize( 200, 250 ),
|
||||
0, NULL,
|
||||
wxLB_ALWAYS_SB | wxLB_SINGLE );
|
||||
|
||||
LeftBoxSizer->Add( m_FootprintFilterListBox, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
||||
|
||||
wxBoxSizer* RightBoxSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
PanelFpFilterBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
||||
|
||||
wxButton * Button = new wxButton(m_PanelFootprintFilter, ID_ADD_FOOTPRINT_FILTER, _("Add"));
|
||||
wxButton* Button = new wxButton( m_PanelFootprintFilter,
|
||||
ID_ADD_FOOTPRINT_FILTER, _(
|
||||
"Add" ) );
|
||||
|
||||
Button->SetForegroundColour( *wxBLUE );
|
||||
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
|
||||
|
||||
m_ButtonDeleteOneFootprintFilter = new wxButton(m_PanelFootprintFilter, ID_DELETE_ONE_FOOTPRINT_FILTER,
|
||||
_("Delete"));
|
||||
m_ButtonDeleteOneFootprintFilter = new wxButton( m_PanelFootprintFilter,
|
||||
ID_DELETE_ONE_FOOTPRINT_FILTER,
|
||||
_(
|
||||
"Delete" ) );
|
||||
|
||||
m_ButtonDeleteOneFootprintFilter->SetForegroundColour( *wxRED );
|
||||
RightBoxSizer->Add( m_ButtonDeleteOneFootprintFilter, 0, wxGROW | wxALL, 5 );
|
||||
|
||||
m_ButtonDeleteAllFootprintFilter = new wxButton(m_PanelFootprintFilter, ID_DELETE_ALL_FOOTPRINT_FILTER,
|
||||
_("Delete All"));
|
||||
m_ButtonDeleteAllFootprintFilter = new wxButton( m_PanelFootprintFilter,
|
||||
ID_DELETE_ALL_FOOTPRINT_FILTER,
|
||||
_(
|
||||
"Delete All" ) );
|
||||
|
||||
m_ButtonDeleteAllFootprintFilter->SetForegroundColour( *wxRED );
|
||||
RightBoxSizer->Add( m_ButtonDeleteAllFootprintFilter, 0, wxGROW | wxALL, 5 );
|
||||
|
||||
|
@ -301,10 +346,10 @@ wxBoxSizer * PanelFpFilterBoxSizer = new wxBoxSizer(wxHORIZONTAL);
|
|||
}
|
||||
|
||||
|
||||
|
||||
/*****************************************************/
|
||||
void WinEDA_PartPropertiesFrame::BuildPanelDoc()
|
||||
/*****************************************************/
|
||||
|
||||
/* create the panel for component doc editing
|
||||
*/
|
||||
{
|
||||
|
@ -324,7 +369,8 @@ wxString msg_text;
|
|||
msg_text = CurrentLibEntry->m_AliasList[m_AliasLocation + ALIAS_KEYWORD];
|
||||
else
|
||||
{
|
||||
if (CurrentLibEntry ) msg_text = CurrentLibEntry->m_KeyWord;
|
||||
if( CurrentLibEntry )
|
||||
msg_text = CurrentLibEntry->m_KeyWord;
|
||||
}
|
||||
m_Keywords->SetValue( msg_text );
|
||||
|
||||
|
@ -333,59 +379,75 @@ wxString msg_text;
|
|||
msg_text = CurrentLibEntry->m_AliasList[m_AliasLocation + ALIAS_DOC_FILENAME];
|
||||
else
|
||||
{
|
||||
if (CurrentLibEntry) msg_text = CurrentLibEntry->m_DocFile;
|
||||
if( CurrentLibEntry )
|
||||
msg_text = CurrentLibEntry->m_DocFile;
|
||||
}
|
||||
m_Docfile->SetValue( msg_text );
|
||||
|
||||
if ( m_AliasLocation < 0 ) m_ButtonCopyDoc->Enable(FALSE);
|
||||
|
||||
if( m_AliasLocation < 0 )
|
||||
m_ButtonCopyDoc->Enable( FALSE );
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************/
|
||||
void WinEDA_PartPropertiesFrame::BuildPanelBasic()
|
||||
/*****************************************************/
|
||||
|
||||
/* create the basic panel for component properties editing
|
||||
*/
|
||||
{
|
||||
m_PanelBasic->SetFont( *g_DialogFont );
|
||||
|
||||
AsConvertButt = new wxCheckBox( m_PanelBasic, -1, _( "As Convert" ) );
|
||||
if ( g_AsDeMorgan ) AsConvertButt->SetValue(TRUE);
|
||||
|
||||
if( g_AsDeMorgan )
|
||||
AsConvertButt->SetValue( TRUE );
|
||||
m_OptionsBoxSizer->Add( AsConvertButt, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
||||
|
||||
ShowPinNumButt = new wxCheckBox( m_PanelBasic, -1, _( "Show Pin Num" ) );
|
||||
|
||||
if( CurrentLibEntry )
|
||||
{
|
||||
if ( CurrentLibEntry->m_DrawPinNum ) ShowPinNumButt->SetValue(TRUE);
|
||||
if( CurrentLibEntry->m_DrawPinNum )
|
||||
ShowPinNumButt->SetValue( TRUE );
|
||||
}
|
||||
else ShowPinNumButt->SetValue(TRUE);
|
||||
else
|
||||
ShowPinNumButt->SetValue( TRUE );
|
||||
m_OptionsBoxSizer->Add( ShowPinNumButt, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
||||
|
||||
ShowPinNameButt = new wxCheckBox( m_PanelBasic, -1, _( "Show Pin Name" ) );
|
||||
|
||||
if( CurrentLibEntry )
|
||||
{
|
||||
if( CurrentLibEntry->m_DrawPinName ) ShowPinNameButt->SetValue(TRUE);
|
||||
if( CurrentLibEntry->m_DrawPinName )
|
||||
ShowPinNameButt->SetValue( TRUE );
|
||||
}
|
||||
else ShowPinNameButt->SetValue(TRUE);
|
||||
else
|
||||
ShowPinNameButt->SetValue( TRUE );
|
||||
m_OptionsBoxSizer->Add( ShowPinNameButt, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
||||
|
||||
m_PinsNameInsideButt = new wxCheckBox( m_PanelBasic, -1, _( "Pin Name Inside" ) );
|
||||
|
||||
if( CurrentLibEntry )
|
||||
{
|
||||
if ( CurrentLibEntry->m_TextInside ) m_PinsNameInsideButt->SetValue(TRUE);
|
||||
if( CurrentLibEntry->m_TextInside )
|
||||
m_PinsNameInsideButt->SetValue( TRUE );
|
||||
}
|
||||
else m_PinsNameInsideButt->SetValue(TRUE);
|
||||
else
|
||||
m_PinsNameInsideButt->SetValue( TRUE );
|
||||
m_OptionsBoxSizer->Add( m_PinsNameInsideButt, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
||||
|
||||
int number, number_of_units;
|
||||
if ( CurrentLibEntry ) number_of_units = CurrentLibEntry->m_UnitCount;
|
||||
else number_of_units = 1;
|
||||
if( CurrentLibEntry )
|
||||
number_of_units = CurrentLibEntry->m_UnitCount;
|
||||
else
|
||||
number_of_units = 1;
|
||||
SelNumberOfUnits->SetValue( number_of_units );
|
||||
|
||||
if( CurrentLibEntry && CurrentLibEntry->m_TextInside )
|
||||
number = CurrentLibEntry->m_TextInside;
|
||||
else number = 40;
|
||||
else
|
||||
number = 40;
|
||||
m_SetSkew->SetValue( number );
|
||||
|
||||
if( CurrentLibEntry )
|
||||
|
@ -401,11 +463,13 @@ void WinEDA_PartPropertiesFrame::BuildPanelBasic()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************/
|
||||
void WinEDA_PartPropertiesFrame::BuildPanelEditField()
|
||||
/**********************************************************/
|
||||
|
||||
/* Create and build the panel managing the fields (REF, VALUE ...)
|
||||
of the component
|
||||
* of the component
|
||||
*/
|
||||
{
|
||||
wxString Hjustify_list[] =
|
||||
|
@ -415,30 +479,39 @@ wxString Vjustify_list[] =
|
|||
int FieldId = m_CurrentFieldId;
|
||||
|
||||
m_PanelField = new wxPanel( m_NoteBook, ID_PANEL_FIELD );
|
||||
|
||||
m_PanelField->SetFont( *g_DialogFont );
|
||||
m_NoteBook->AddPage( m_PanelField, _( "Fields" ), FALSE );
|
||||
|
||||
wxBoxSizer* PanelFieldBoxSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_PanelField->SetSizer( PanelFieldBoxSizer );
|
||||
wxBoxSizer* LeftBoxSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
PanelFieldBoxSizer->Add( LeftBoxSizer, 0, wxGROW | wxALL, 5 );
|
||||
wxBoxSizer* MiddleBoxSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
PanelFieldBoxSizer->Add( MiddleBoxSizer, 0, wxGROW | wxALL, 5 );
|
||||
|
||||
m_ShowFieldTextCtrl = new wxCheckBox( m_PanelField, -1,
|
||||
_( "Show Text" ) );
|
||||
|
||||
LeftBoxSizer->Add( m_ShowFieldTextCtrl, 0, wxGROW | wxALL, 5 );
|
||||
|
||||
m_VorientFieldTextCtrl = new wxCheckBox( m_PanelField, -1,
|
||||
_( "Vertical" ) );
|
||||
|
||||
LeftBoxSizer->Add( m_VorientFieldTextCtrl, 0, wxGROW | wxALL, 5 );
|
||||
|
||||
// Create the box for field name display or edition
|
||||
m_FieldNameCtrl = new WinEDA_EnterText( m_PanelField,
|
||||
_( "Field Name:" ), m_FieldName[FieldId],
|
||||
LeftBoxSizer, wxSize( 200, -1 ) );
|
||||
if ( FieldId < FIELD1 ) m_FieldNameCtrl->Enable(FALSE );
|
||||
else m_FieldNameCtrl->Enable( TRUE );
|
||||
|
||||
if( FieldId < FIELD1 )
|
||||
m_FieldNameCtrl->Enable( FALSE );
|
||||
else
|
||||
m_FieldNameCtrl->Enable( TRUE );
|
||||
|
||||
// Create the box for text editing (text, size)
|
||||
m_FieldTextCtrl = new WinEDA_GraphicTextCtrl( m_PanelField,
|
||||
|
@ -455,12 +528,14 @@ int FieldId = m_CurrentFieldId;
|
|||
m_FieldHJustifyCtrl = new wxRadioBox( m_PanelField, -1,
|
||||
_( "Hor Justify" ), wxDefaultPosition, wxDefaultSize,
|
||||
3, Hjustify_list, 1, wxRA_SPECIFY_COLS );
|
||||
|
||||
m_FieldHJustifyCtrl->SetSelection( 1 );
|
||||
MiddleBoxSizer->Add( m_FieldHJustifyCtrl, 0, wxGROW | wxALL, 5 );
|
||||
|
||||
m_FieldVJustifyCtrl = new wxRadioBox( m_PanelField, -1,
|
||||
_( "Vert Justify" ), wxDefaultPosition, wxDefaultSize,
|
||||
3, Vjustify_list, 1, wxRA_SPECIFY_COLS );
|
||||
|
||||
m_FieldVJustifyCtrl->SetSelection( 1 );
|
||||
MiddleBoxSizer->Add( m_FieldVJustifyCtrl, 0, wxGROW | wxALL, 5 );
|
||||
|
||||
|
@ -470,23 +545,26 @@ wxString fieldnamelist[NUMBER_OF_FIELDS];
|
|||
{
|
||||
if( m_FieldName[ii].IsEmpty() )
|
||||
fieldnamelist[ii] = ReturnDefaultFieldName( ii );
|
||||
else fieldnamelist[ii] = m_FieldName[ii];
|
||||
else
|
||||
fieldnamelist[ii] = m_FieldName[ii];
|
||||
}
|
||||
|
||||
m_FieldSelection = new wxRadioBox( m_PanelField, ID_ON_SELECT_FIELD,
|
||||
_( "Field to edit" ), wxDefaultPosition, wxDefaultSize,
|
||||
NUMBER_OF_FIELDS, fieldnamelist, 2, wxRA_SPECIFY_COLS );
|
||||
|
||||
PanelFieldBoxSizer->Add( m_FieldSelection, 0, wxGROW | wxALL, 5 );
|
||||
|
||||
CopyDataToPanelField();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************/
|
||||
void WinEDA_PartPropertiesFrame::CopyDataToPanelField()
|
||||
/****************************************************************/
|
||||
|
||||
/* Set the values displayed on the panel field according to
|
||||
the current field number
|
||||
* the current field number
|
||||
*/
|
||||
{
|
||||
int FieldId = m_CurrentFieldId;
|
||||
|
@ -495,15 +573,19 @@ int FieldId = m_CurrentFieldId;
|
|||
{
|
||||
if( !m_FieldName[ii].IsEmpty() )
|
||||
m_FieldSelection->SetString( ii, m_FieldName[ii] );
|
||||
else m_FieldSelection->SetString(ii, ReturnDefaultFieldName(ii));
|
||||
else
|
||||
m_FieldSelection->SetString( ii, ReturnDefaultFieldName( ii ) );
|
||||
}
|
||||
|
||||
if( m_FieldFlags[FieldId] )
|
||||
m_ShowFieldTextCtrl->SetValue( TRUE );
|
||||
else m_ShowFieldTextCtrl->SetValue(FALSE);
|
||||
else
|
||||
m_ShowFieldTextCtrl->SetValue( FALSE );
|
||||
|
||||
if ( m_FieldOrient[FieldId] ) m_VorientFieldTextCtrl->SetValue(TRUE);
|
||||
else m_VorientFieldTextCtrl->SetValue(FALSE);
|
||||
if( m_FieldOrient[FieldId] )
|
||||
m_VorientFieldTextCtrl->SetValue( TRUE );
|
||||
else
|
||||
m_VorientFieldTextCtrl->SetValue( FALSE );
|
||||
|
||||
m_FieldHJustifyCtrl->SetSelection( m_FieldHJustify[FieldId] );
|
||||
|
||||
|
@ -512,18 +594,21 @@ int FieldId = m_CurrentFieldId;
|
|||
m_FieldPositionCtrl->SetValue( m_FieldPosition[FieldId].x, m_FieldPosition[FieldId].y );
|
||||
|
||||
m_FieldNameCtrl->SetValue( m_FieldName[FieldId] );
|
||||
if ( FieldId < FIELD1 ) m_FieldNameCtrl->Enable(FALSE );
|
||||
else m_FieldNameCtrl->Enable( TRUE );
|
||||
if( FieldId < FIELD1 )
|
||||
m_FieldNameCtrl->Enable( FALSE );
|
||||
else
|
||||
m_FieldNameCtrl->Enable( TRUE );
|
||||
m_FieldTextCtrl->SetValue( m_FieldText[FieldId] ); // display new text field
|
||||
m_FieldTextCtrl->SetValue( m_FieldSize[FieldId] ); // display new size field
|
||||
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************/
|
||||
void WinEDA_PartPropertiesFrame::CopyPanelFieldToData()
|
||||
/****************************************************************/
|
||||
|
||||
/* Copy the values displayed on the panel field to the buffers according to
|
||||
the current field number
|
||||
* the current field number
|
||||
*/
|
||||
{
|
||||
int id = m_CurrentFieldId;
|
||||
|
@ -542,8 +627,9 @@ int id = m_CurrentFieldId;
|
|||
/********************************************************************/
|
||||
void WinEDA_PartPropertiesFrame::SelectNewField( wxCommandEvent& event )
|
||||
/********************************************************************/
|
||||
|
||||
/* called when changing the current field selected
|
||||
Save the current field settings in buffer and display the new one
|
||||
* Save the current field settings in buffer and display the new one
|
||||
*/
|
||||
{
|
||||
CopyPanelFieldToData();
|
||||
|
@ -551,9 +637,11 @@ void WinEDA_PartPropertiesFrame::SelectNewField(wxCommandEvent& event)
|
|||
CopyDataToPanelField();
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
void WinEDA_PartPropertiesFrame::PartPropertiesAccept( wxCommandEvent& event )
|
||||
/**************************************************************************/
|
||||
|
||||
/* Updaye the current component parameters
|
||||
*/
|
||||
{
|
||||
|
@ -570,7 +658,7 @@ int ii, jj;
|
|||
CopyPanelFieldToData();
|
||||
|
||||
/* A new name could be entered in VALUE field.
|
||||
Must not be an existing alias name in alias list box */
|
||||
* Must not be an existing alias name in alias list box */
|
||||
jj = m_PartAliasList->GetCount();
|
||||
wxString newvalue = m_FieldText[VALUE];
|
||||
for( ii = 0; ii < jj; ii++ )
|
||||
|
@ -591,7 +679,6 @@ int ii, jj;
|
|||
CurrentLibEntry->m_KeyWord = m_Keywords->GetValue();
|
||||
CurrentLibEntry->m_DocFile = m_Docfile->GetValue();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
CurrentLibEntry->m_AliasList[m_AliasLocation + ALIAS_DOC] = m_Doc->GetValue();
|
||||
|
@ -630,13 +717,13 @@ int ii, jj;
|
|||
|
||||
if( ii == jj ) // Alias not found in new list, remove it (4 strings in kk position)
|
||||
{
|
||||
for( ii = 0; ii < ALIAS_NEXT; ii++ ) CurrentLibEntry->m_AliasList.RemoveAt(kk);
|
||||
for( ii = 0; ii < ALIAS_NEXT; ii++ )
|
||||
CurrentLibEntry->m_AliasList.RemoveAt( kk );
|
||||
|
||||
kkmax = CurrentLibEntry->m_AliasList.GetCount();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Void fields for REFERENCE and VALUE are not allowed
|
||||
if( m_FieldText[REFERENCE].IsEmpty() )
|
||||
{
|
||||
|
@ -667,14 +754,17 @@ int ii, jj;
|
|||
if( Field->m_FieldId == ii )
|
||||
{
|
||||
CopyBufferToFieldData( Field );
|
||||
|
||||
// An old field exists; delete it if void
|
||||
if( Field->m_Text.IsEmpty() )
|
||||
{
|
||||
if( ii < FIELD1 || Field->m_Name.IsEmpty() )
|
||||
{
|
||||
delete Field;
|
||||
if ( previousField ) previousField->Pnext = NextField;
|
||||
else CurrentLibEntry->Fields = NextField;
|
||||
if( previousField )
|
||||
previousField->Pnext = NextField;
|
||||
else
|
||||
CurrentLibEntry->Fields = NextField;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -687,12 +777,14 @@ int ii, jj;
|
|||
if( Field == NULL ) // Do not exists: must be created if not void
|
||||
{
|
||||
bool create = FALSE;
|
||||
if ( ! m_FieldText[ii].IsEmpty() ) create = TRUE;
|
||||
if( !m_FieldText[ii].IsEmpty() )
|
||||
create = TRUE;
|
||||
if( !m_FieldName[ii].IsEmpty() && ( m_FieldName[ii] != ReturnDefaultFieldName( ii ) ) )
|
||||
create = TRUE;
|
||||
if( create )
|
||||
{
|
||||
Field = new LibDrawField( ii );
|
||||
|
||||
CopyBufferToFieldData( Field );
|
||||
Field->Pnext = CurrentLibEntry->Fields;
|
||||
CurrentLibEntry->Fields = Field;
|
||||
|
@ -701,14 +793,15 @@ int ii, jj;
|
|||
}
|
||||
|
||||
/* for a user field (FieldId >= FIELD1), if a field value is void,
|
||||
fill it with "~" because for a library componenta void field is not a very good idea
|
||||
(we do not see anything...) and in schematic this text is like a void text */
|
||||
* fill it with "~" because for a library componenta void field is not a very good idea
|
||||
* (we do not see anything...) and in schematic this text is like a void text */
|
||||
{
|
||||
LibDrawField* Field = CurrentLibEntry->Fields;
|
||||
while( Field )
|
||||
{
|
||||
if( Field->m_FieldId >= FIELD1 )
|
||||
if ( Field->m_Text.IsEmpty() ) Field->m_Text = wxT("~");
|
||||
if( Field->m_Text.IsEmpty() )
|
||||
Field->m_Text = wxT( "~" );
|
||||
Field = (LibDrawField*) Field->Pnext;
|
||||
}
|
||||
}
|
||||
|
@ -722,7 +815,8 @@ int ii, jj;
|
|||
if( !g_AsDeMorgan )
|
||||
{
|
||||
g_AsDeMorgan = 1;
|
||||
if ( SetUnsetConvert() ) m_RecreateToolbar = TRUE;
|
||||
if( SetUnsetConvert() )
|
||||
m_RecreateToolbar = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -730,7 +824,8 @@ int ii, jj;
|
|||
if( g_AsDeMorgan )
|
||||
{
|
||||
g_AsDeMorgan = 0;
|
||||
if ( SetUnsetConvert() ) m_RecreateToolbar = TRUE;
|
||||
if( SetUnsetConvert() )
|
||||
m_RecreateToolbar = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -748,12 +843,13 @@ int ii, jj;
|
|||
CurrentLibEntry->m_Options = ENTRY_NORMAL;
|
||||
|
||||
/* Set the option "Units locked".
|
||||
Obviously, cannot be TRUE if there is only one part */
|
||||
* Obviously, cannot be TRUE if there is only one part */
|
||||
CurrentLibEntry->m_UnitSelectionLocked = m_OptionPartsLocked->GetValue();
|
||||
if( CurrentLibEntry->m_UnitCount <= 1 )
|
||||
CurrentLibEntry->m_UnitSelectionLocked = FALSE;
|
||||
|
||||
if ( m_RecreateToolbar ) m_Parent->ReCreateHToolbar();
|
||||
if( m_RecreateToolbar )
|
||||
m_Parent->ReCreateHToolbar();
|
||||
|
||||
m_Parent->DisplayLibInfos();
|
||||
|
||||
|
@ -771,20 +867,22 @@ int ii, jj;
|
|||
void WinEDA_PartPropertiesFrame::CopyDocToAlias( wxCommandEvent& WXUNUSED (event) )
|
||||
/******************************************************************************/
|
||||
{
|
||||
if( CurrentLibEntry == NULL ) return;
|
||||
if ( CurrentAliasName.IsEmpty() ) return;
|
||||
if( CurrentLibEntry == NULL )
|
||||
return;
|
||||
if( CurrentAliasName.IsEmpty() )
|
||||
return;
|
||||
|
||||
m_Doc->SetValue( CurrentLibEntry->m_Doc );
|
||||
m_Docfile->SetValue( CurrentLibEntry->m_DocFile );
|
||||
m_Keywords->SetValue( CurrentLibEntry->m_KeyWord );
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************/
|
||||
void WinEDA_PartPropertiesFrame::DeleteAllAliasOfPart(
|
||||
wxCommandEvent& WXUNUSED (event) )
|
||||
/**********************************************************/
|
||||
{
|
||||
|
||||
CurrentAliasName.Empty();
|
||||
if( CurrentLibEntry )
|
||||
{
|
||||
|
@ -796,22 +894,25 @@ void WinEDA_PartPropertiesFrame::DeleteAllAliasOfPart(
|
|||
m_ButtonDeleteOneAlias->Enable( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************/
|
||||
void WinEDA_PartPropertiesFrame::AddAliasOfPart( wxCommandEvent& WXUNUSED (event) )
|
||||
/*******************************************************************************/
|
||||
|
||||
/* Add a new name to the alias list box
|
||||
New name cannot be the root name, and must not exists
|
||||
* New name cannot be the root name, and must not exists
|
||||
*/
|
||||
{
|
||||
wxString Line;
|
||||
wxString aliasname;
|
||||
|
||||
if(CurrentLibEntry == NULL) return;
|
||||
if( CurrentLibEntry == NULL )
|
||||
return;
|
||||
|
||||
if( Get_Message(_("New alias:"),Line, this) != 0 ) return;
|
||||
if( Get_Message( _( "New alias:" ), Line, this ) != 0 )
|
||||
return;
|
||||
|
||||
Line.Replace( wxT( " " ), wxT( "_" ) );
|
||||
aliasname = Line;
|
||||
|
@ -833,12 +934,14 @@ wxString aliasname;
|
|||
}
|
||||
|
||||
m_PartAliasList->Append( aliasname );
|
||||
if ( CurrentAliasName.IsEmpty() ) m_ButtonDeleteAllAlias->Enable(TRUE);
|
||||
if( CurrentAliasName.IsEmpty() )
|
||||
m_ButtonDeleteAllAlias->Enable( TRUE );
|
||||
m_ButtonDeleteOneAlias->Enable( TRUE );
|
||||
|
||||
m_RecreateToolbar = TRUE;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************/
|
||||
void WinEDA_PartPropertiesFrame::DeleteAliasOfPart(
|
||||
wxCommandEvent& WXUNUSED (event) )
|
||||
|
@ -846,7 +949,8 @@ void WinEDA_PartPropertiesFrame::DeleteAliasOfPart(
|
|||
{
|
||||
wxString aliasname = m_PartAliasList->GetStringSelection();
|
||||
|
||||
if ( aliasname.IsEmpty() ) return;
|
||||
if( aliasname.IsEmpty() )
|
||||
return;
|
||||
if( aliasname == CurrentAliasName )
|
||||
{
|
||||
wxString msg = CurrentAliasName + _( " is Current Selected Alias!" );
|
||||
|
@ -866,25 +970,27 @@ wxString aliasname = m_PartAliasList->GetStringSelection();
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/********************************************************************/
|
||||
bool WinEDA_PartPropertiesFrame::ChangeNbUnitsPerPackage( int MaxUnit )
|
||||
/********************************************************************/
|
||||
|
||||
/* Routine de modification du nombre d'unites par package pour le
|
||||
composant courant;
|
||||
* composant courant;
|
||||
*/
|
||||
{
|
||||
int OldNumUnits, ii, FlagDel = -1;
|
||||
LibEDA_BaseStruct* DrawItem, * NextDrawItem;
|
||||
|
||||
if( CurrentLibEntry == NULL ) return FALSE;
|
||||
if( CurrentLibEntry == NULL )
|
||||
return FALSE;
|
||||
|
||||
/* Si pas de changement: termine */
|
||||
if ( CurrentLibEntry->m_UnitCount == MaxUnit ) return FALSE;
|
||||
if( CurrentLibEntry->m_UnitCount == MaxUnit )
|
||||
return FALSE;
|
||||
|
||||
OldNumUnits = CurrentLibEntry->m_UnitCount;
|
||||
if ( OldNumUnits < 1 ) OldNumUnits = 1;
|
||||
if( OldNumUnits < 1 )
|
||||
OldNumUnits = 1;
|
||||
|
||||
CurrentLibEntry->m_UnitCount = MaxUnit;
|
||||
|
||||
|
@ -903,7 +1009,8 @@ LibEDA_BaseStruct* DrawItem, * NextDrawItem;
|
|||
if( IsOK( this, _( "Delete units" ) ) )
|
||||
{
|
||||
/* Si part selectee n'existe plus: selection 1ere unit */
|
||||
if( CurrentUnit > MaxUnit ) CurrentUnit = 1;
|
||||
if( CurrentUnit > MaxUnit )
|
||||
CurrentUnit = 1;
|
||||
FlagDel = 1;
|
||||
}
|
||||
else
|
||||
|
@ -918,6 +1025,7 @@ LibEDA_BaseStruct* DrawItem, * NextDrawItem;
|
|||
DrawItem, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -946,8 +1054,9 @@ LibEDA_BaseStruct* DrawItem, * NextDrawItem;
|
|||
/*****************************************************/
|
||||
bool WinEDA_PartPropertiesFrame::SetUnsetConvert()
|
||||
/*****************************************************/
|
||||
|
||||
/* crée ou efface (selon option AsConvert) les éléments
|
||||
de la représentation convertie d'un composant
|
||||
* de la représentation convertie d'un composant
|
||||
*/
|
||||
{
|
||||
int FlagDel = 0;
|
||||
|
@ -956,11 +1065,13 @@ LibEDA_BaseStruct* DrawItem = NULL, * NextDrawItem;
|
|||
if( g_AsDeMorgan ) /* Representation convertie a creer */
|
||||
{
|
||||
/* Traitement des elements a ajouter ( pins seulement ) */
|
||||
if( CurrentLibEntry ) DrawItem = CurrentLibEntry->m_Drawings;
|
||||
if( CurrentLibEntry )
|
||||
DrawItem = CurrentLibEntry->m_Drawings;
|
||||
for( ; DrawItem != NULL; DrawItem = DrawItem->Next() )
|
||||
{
|
||||
/* Duplication des items pour autres elements */
|
||||
if( DrawItem->Type() != COMPONENT_PIN_DRAW_TYPE ) continue;
|
||||
if( DrawItem->Type() != COMPONENT_PIN_DRAW_TYPE )
|
||||
continue;
|
||||
if( DrawItem->m_Convert == 1 )
|
||||
{
|
||||
if( FlagDel == 0 )
|
||||
|
@ -982,11 +1093,11 @@ LibEDA_BaseStruct* DrawItem = NULL, * NextDrawItem;
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
else /* Representation convertie a supprimer */
|
||||
{
|
||||
/* Traitement des elements à supprimer */
|
||||
if( CurrentLibEntry ) DrawItem = CurrentLibEntry->m_Drawings;
|
||||
if( CurrentLibEntry )
|
||||
DrawItem = CurrentLibEntry->m_Drawings;
|
||||
for( ; DrawItem != NULL; DrawItem = NextDrawItem )
|
||||
{
|
||||
NextDrawItem = DrawItem->Next();
|
||||
|
@ -1006,18 +1117,24 @@ LibEDA_BaseStruct* DrawItem = NULL, * NextDrawItem;
|
|||
}
|
||||
}
|
||||
m_Parent->GetScreen()->SetModify();
|
||||
DeleteOneLibraryDrawStruct(m_Parent->DrawPanel, NULL, CurrentLibEntry, DrawItem, 0);
|
||||
DeleteOneLibraryDrawStruct( m_Parent->DrawPanel,
|
||||
NULL,
|
||||
CurrentLibEntry,
|
||||
DrawItem,
|
||||
0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
void WinEDA_PartPropertiesFrame::BrowseAndSelectDocFile( wxCommandEvent& event )
|
||||
/****************************************************************************/
|
||||
{
|
||||
wxString FullFileName, mask;
|
||||
|
||||
wxString docpath( g_RealLibDirBuffer ), filename;
|
||||
|
||||
docpath += wxT( "doc" );
|
||||
|
@ -1032,7 +1149,8 @@ wxString docpath(g_RealLibDirBuffer), filename;
|
|||
wxFD_OPEN,
|
||||
TRUE
|
||||
);
|
||||
if ( FullFileName.IsEmpty() ) return;
|
||||
if( FullFileName.IsEmpty() )
|
||||
return;
|
||||
|
||||
// Suppression du chemin par defaut pour le fichier de doc:
|
||||
filename = MakeReducedFileName( FullFileName, docpath, wxEmptyString );
|
||||
|
@ -1045,7 +1163,6 @@ void WinEDA_PartPropertiesFrame::DeleteAllFootprintFilter(
|
|||
wxCommandEvent& WXUNUSED (event) )
|
||||
/**********************************************************/
|
||||
{
|
||||
|
||||
if( IsOK( this, _( "Ok to Delete FootprintFilter LIST" ) ) )
|
||||
{
|
||||
m_FootprintFilterListBox->Clear();
|
||||
|
@ -1054,18 +1171,22 @@ void WinEDA_PartPropertiesFrame::DeleteAllFootprintFilter(
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************/
|
||||
void WinEDA_PartPropertiesFrame::AddFootprintFilter( wxCommandEvent& WXUNUSED (event) )
|
||||
/*******************************************************************************/
|
||||
|
||||
/* Add a new name to the alias list box
|
||||
New name cannot be the root name, and must not exists
|
||||
* New name cannot be the root name, and must not exists
|
||||
*/
|
||||
{
|
||||
wxString Line;
|
||||
|
||||
if(CurrentLibEntry == NULL) return;
|
||||
if( CurrentLibEntry == NULL )
|
||||
return;
|
||||
|
||||
if( Get_Message(_("New FootprintFilter:"),Line, this) != 0 ) return;
|
||||
if( Get_Message( _( "New FootprintFilter:" ), Line, this ) != 0 )
|
||||
return;
|
||||
|
||||
Line.Replace( wxT( " " ), wxT( "_" ) );
|
||||
|
||||
|
@ -1085,12 +1206,14 @@ wxString Line;
|
|||
m_ButtonDeleteOneFootprintFilter->Enable( TRUE );
|
||||
}
|
||||
|
||||
|
||||
/********************************************************/
|
||||
void WinEDA_PartPropertiesFrame::DeleteOneFootprintFilter(
|
||||
wxCommandEvent& WXUNUSED (event) )
|
||||
/********************************************************/
|
||||
{
|
||||
int ii = m_FootprintFilterListBox->GetSelection();
|
||||
|
||||
m_FootprintFilterListBox->Delete( ii );
|
||||
|
||||
if( !CurrentLibEntry || (m_FootprintFilterListBox->GetCount() == 0) )
|
||||
|
@ -1099,5 +1222,3 @@ int ii = m_FootprintFilterListBox->GetSelection();
|
|||
m_ButtonDeleteOneFootprintFilter->Enable( FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
177
eeschema/erc.cpp
177
eeschema/erc.cpp
|
@ -20,8 +20,8 @@
|
|||
#include "dialog_erc.h"
|
||||
|
||||
/* On teste
|
||||
1 - conflits entre pins connectees ( ex: 2 sorties connectees )
|
||||
2 - les imperatifs minimaux ( 1 entree doit etre connectee a une sortie )
|
||||
* 1 - conflits entre pins connectees ( ex: 2 sorties connectees )
|
||||
* 2 - les imperatifs minimaux ( 1 entree doit etre connectee a une sortie )
|
||||
*/
|
||||
|
||||
|
||||
|
@ -46,16 +46,16 @@ static void TestLabel(WinEDA_DrawPanel * panel, wxDC * DC,
|
|||
int WriteFichierERC = FALSE;
|
||||
|
||||
/* Tableau des types de conflit :
|
||||
PIN_INPUT, PIN_OUTPUT, PIN_BIDI, PIN_TRISTATE, PIN_PASSIVE,
|
||||
PIN_UNSPECIFIED, PIN_POWER_IN, PIN_POWER_OUT, PIN_OPENCOLLECTOR,
|
||||
PIN_OPENEMITTER, PIN_NC
|
||||
* PIN_INPUT, PIN_OUTPUT, PIN_BIDI, PIN_TRISTATE, PIN_PASSIVE,
|
||||
* PIN_UNSPECIFIED, PIN_POWER_IN, PIN_POWER_OUT, PIN_OPENCOLLECTOR,
|
||||
* PIN_OPENEMITTER, PIN_NC
|
||||
*/
|
||||
#define OK 0
|
||||
#define WAR 1 // utilisé aussi dans eeredraw
|
||||
#define ERR 2
|
||||
#define UNC 3
|
||||
|
||||
static wxChar * CommentERC_H[] =
|
||||
static const wxChar* CommentERC_H[] =
|
||||
{
|
||||
wxT( "Input Pin...." ),
|
||||
wxT( "Output Pin..." ),
|
||||
|
@ -70,7 +70,7 @@ static wxChar * CommentERC_H[] =
|
|||
wxT( "No Conn......" ),
|
||||
NULL
|
||||
};
|
||||
static wxChar * CommentERC_V[] =
|
||||
static const wxChar* CommentERC_V[] =
|
||||
{
|
||||
wxT( "Input Pin" ),
|
||||
wxT( "Output Pin" ),
|
||||
|
@ -88,15 +88,15 @@ static wxChar * CommentERC_V[] =
|
|||
|
||||
|
||||
/* Look up table which gives the diag for a pair of connected pins
|
||||
Can be modified by ERC options.
|
||||
at start up: must be loaded by DefaultDiagErc
|
||||
* Can be modified by ERC options.
|
||||
* at start up: must be loaded by DefaultDiagErc
|
||||
*/
|
||||
static int DiagErc[PIN_NMAX][PIN_NMAX];
|
||||
bool DiagErcTableInit; // go to TRUE after DiagErc init
|
||||
|
||||
/* Default Look up table which gives the diag for a pair of connected pins
|
||||
Same as DiagErc, but cannot be modified
|
||||
Used to init or reset DiagErc
|
||||
* Same as DiagErc, but cannot be modified
|
||||
* Used to init or reset DiagErc
|
||||
*/
|
||||
static int DefaultDiagErc[PIN_NMAX][PIN_NMAX] =
|
||||
{ /* I, O, Bi, 3S, Pas, UnS,PwrI,PwrO, OC, OE, NC */
|
||||
|
@ -121,13 +121,13 @@ static int DefaultDiagErc[PIN_NMAX][PIN_NMAX] =
|
|||
#define NOC 0 /* Pin isolee, non connectee */
|
||||
|
||||
/* Look up table which gives the minimal drive for a pair of connected pins on a net
|
||||
Initial state of a net is NOC (No Connection)
|
||||
Can be updated to NET_NC, or NOD (Not Driven) or DRV (DRIven)
|
||||
|
||||
Can be updated to NET_NC only if the previous state is NOC
|
||||
|
||||
Nets are OK when their final state is NET_NC or DRV
|
||||
Nets with the state NOD have no source signal
|
||||
* Initial state of a net is NOC (No Connection)
|
||||
* Can be updated to NET_NC, or NOD (Not Driven) or DRV (DRIven)
|
||||
*
|
||||
* Can be updated to NET_NC only if the previous state is NOC
|
||||
*
|
||||
* Nets are OK when their final state is NET_NC or DRV
|
||||
* Nets with the state NOD have no source signal
|
||||
*/
|
||||
static int MinimalReq[PIN_NMAX][PIN_NMAX] =
|
||||
{ /* In, Out, Bi, 3S, Pas, UnS,PwrI,PwrO, OC, OE, NC */
|
||||
|
@ -145,15 +145,15 @@ static int MinimalReq[PIN_NMAX][PIN_NMAX] =
|
|||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/*************************************************************/
|
||||
void InstallErcFrame( WinEDA_SchematicFrame* parent, wxPoint& pos )
|
||||
/*************************************************************/
|
||||
|
||||
/* Install function for the ERC dialog frame
|
||||
*/
|
||||
{
|
||||
WinEDA_ErcFrame* frame = new WinEDA_ErcFrame( parent );
|
||||
|
||||
frame->ShowModal(); frame->Destroy();
|
||||
}
|
||||
|
||||
|
@ -161,11 +161,13 @@ void InstallErcFrame(WinEDA_SchematicFrame *parent, wxPoint & pos)
|
|||
/*********************************************/
|
||||
void WinEDA_ErcFrame::ReBuildMatrixPanel()
|
||||
/*********************************************/
|
||||
|
||||
/* Build or rebuild the panel showing the ERC matrix
|
||||
*/
|
||||
{
|
||||
int ii, jj, event_id, text_height;
|
||||
wxPoint pos, BoxMatrixPosition;
|
||||
|
||||
#define BITMAP_SIZE 19
|
||||
int bitmap_size = BITMAP_SIZE;
|
||||
wxStaticText* text;
|
||||
|
@ -180,14 +182,17 @@ wxSize BoxMatrixMinSize;
|
|||
|
||||
// Get the current text size :
|
||||
text = new wxStaticText( m_PanelERCOptions, -1, wxT( "W" ), pos ); // this is a dummy text
|
||||
|
||||
text_height = text->GetRect().GetHeight();
|
||||
bitmap_size = MAX( bitmap_size, text_height );
|
||||
delete text;
|
||||
|
||||
// compute the Y pos interval:
|
||||
BoxMatrixMinSize.y = ( bitmap_size * (PIN_NMAX + 1) ) + 5;
|
||||
GetSizer()->Fit( this );
|
||||
GetSizer()->SetSizeHints( this );
|
||||
pos = m_MatrixSizer->GetPosition();
|
||||
|
||||
// Size computation is not made in constructor, in some wxWidgets version,
|
||||
// and m_BoxSizerForERC_Opt position is always 0,0. and we can't use it
|
||||
pos.x = MAX( pos.x, 5 );
|
||||
|
@ -203,12 +208,15 @@ wxSize BoxMatrixMinSize;
|
|||
{
|
||||
y = pos.y + (ii * bitmap_size);
|
||||
text = new wxStaticText( m_PanelERCOptions, -1, CommentERC_H[ii], wxPoint( 5, y ) );
|
||||
|
||||
x = text->GetRect().GetRight();
|
||||
pos.x = MAX( pos.x, x );
|
||||
}
|
||||
|
||||
pos.x += 5;
|
||||
}
|
||||
else pos = m_ButtonList[0][0]->GetPosition();
|
||||
else
|
||||
pos = m_ButtonList[0][0]->GetPosition();
|
||||
|
||||
for( ii = 0; ii < PIN_NMAX; ii++ )
|
||||
{
|
||||
|
@ -222,10 +230,12 @@ wxSize BoxMatrixMinSize;
|
|||
wxPoint txtpos;
|
||||
txtpos.x = x + 4; txtpos.y = y - bitmap_size;
|
||||
text = new wxStaticText( m_PanelERCOptions, -1, CommentERC_V[ii], txtpos );
|
||||
|
||||
BoxMatrixMinSize.x = MAX( BoxMatrixMinSize.x, text->GetRect().GetRight() );
|
||||
}
|
||||
event_id = ID_MATRIX_0 + ii + (jj * PIN_NMAX);
|
||||
delete m_ButtonList[ii][jj];
|
||||
|
||||
switch( diag )
|
||||
{
|
||||
case OK:
|
||||
|
@ -233,6 +243,7 @@ wxSize BoxMatrixMinSize;
|
|||
event_id,
|
||||
wxBitmap (green_xpm),
|
||||
wxPoint (x, y) );
|
||||
|
||||
break;
|
||||
|
||||
case WAR:
|
||||
|
@ -240,6 +251,7 @@ wxSize BoxMatrixMinSize;
|
|||
event_id,
|
||||
wxBitmap (warning_xpm),
|
||||
wxPoint (x, y) );
|
||||
|
||||
break;
|
||||
|
||||
case ERR:
|
||||
|
@ -247,6 +259,7 @@ wxSize BoxMatrixMinSize;
|
|||
event_id,
|
||||
wxBitmap (error_xpm),
|
||||
wxPoint (x, y) );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -267,7 +280,11 @@ wxSize BoxMatrixMinSize;
|
|||
void WinEDA_ErcFrame::TestErc( wxCommandEvent& event )
|
||||
/**************************************************/
|
||||
{
|
||||
ObjetNetListStruct * NetItemRef, * OldItem, * StartNet, * Lim;
|
||||
ObjetNetListStruct* NetItemRef;
|
||||
ObjetNetListStruct* OldItem;
|
||||
ObjetNetListStruct* StartNet;
|
||||
ObjetNetListStruct* Lim;
|
||||
|
||||
int NetNbItems, MinConn;
|
||||
|
||||
if( !DiagErcTableInit )
|
||||
|
@ -297,12 +314,14 @@ wxClientDC dc(m_Parent->DrawPanel);
|
|||
|
||||
/* Cleanup the entire hierarchy */
|
||||
EDA_ScreenList ScreenList( NULL );
|
||||
|
||||
for( SCH_SCREEN* Screen = ScreenList.GetFirst(); Screen != NULL; Screen = ScreenList.GetNext() )
|
||||
{
|
||||
bool ModifyWires;
|
||||
ModifyWires = Screen->SchematicCleanUp( NULL );
|
||||
|
||||
/* if wire list has changed, delete Udo Redo list to avoid
|
||||
pointers on deleted data problems */
|
||||
* pointers on deleted data problems */
|
||||
if( ModifyWires )
|
||||
Screen->ClearUndoRedoList();
|
||||
}
|
||||
|
@ -316,14 +335,19 @@ wxClientDC dc(m_Parent->DrawPanel);
|
|||
for( NetItemRef = g_TabObjNet; NetItemRef < Lim; NetItemRef++ )
|
||||
NetItemRef->m_FlagOfConnection = (IsConnectType) 0;
|
||||
|
||||
NetNbItems = 0; MinConn = NOC;
|
||||
NetNbItems = 0;
|
||||
MinConn = NOC;
|
||||
|
||||
StartNet = OldItem = NetItemRef = g_TabObjNet;
|
||||
|
||||
for( ; NetItemRef < Lim; NetItemRef++ )
|
||||
{
|
||||
/* Tst changement de net */
|
||||
if( OldItem->m_NetCode != NetItemRef->m_NetCode )
|
||||
{
|
||||
MinConn = NOC; NetNbItems = 0; StartNet = NetItemRef;
|
||||
MinConn = NOC;
|
||||
NetNbItems = 0;
|
||||
StartNet = NetItemRef;
|
||||
}
|
||||
|
||||
switch( NetItemRef->m_Type )
|
||||
|
@ -354,6 +378,7 @@ wxClientDC dc(m_Parent->DrawPanel);
|
|||
NetItemRef, StartNet, &NetNbItems, &MinConn );
|
||||
break;
|
||||
}
|
||||
|
||||
OldItem = NetItemRef;
|
||||
}
|
||||
|
||||
|
@ -384,7 +409,8 @@ wxClientDC dc(m_Parent->DrawPanel);
|
|||
wxFD_SAVE,
|
||||
TRUE
|
||||
);
|
||||
if ( ErcFullFileName.IsEmpty()) return;
|
||||
if( ErcFullFileName.IsEmpty() )
|
||||
return;
|
||||
|
||||
if( WriteDiagnosticERC( ErcFullFileName ) )
|
||||
{
|
||||
|
@ -400,11 +426,13 @@ wxClientDC dc(m_Parent->DrawPanel);
|
|||
/***********************************************************/
|
||||
void WinEDA_ErcFrame::DelERCMarkers( wxCommandEvent& event )
|
||||
/***********************************************************/
|
||||
|
||||
/* Delete the old ERC markers, over the whole hierarchy
|
||||
*/
|
||||
{
|
||||
EDA_BaseStruct* DrawStruct;
|
||||
DrawMarkerStruct* Marker;
|
||||
|
||||
wxClientDC dc( m_Parent->DrawPanel );
|
||||
|
||||
m_Parent->DrawPanel->PrepareGraphicContext( &dc );
|
||||
|
@ -413,12 +441,14 @@ wxClientDC dc(m_Parent->DrawPanel);
|
|||
DrawStruct = m_Parent->GetScreen()->EEDrawList;
|
||||
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext )
|
||||
{
|
||||
if(DrawStruct->Type() != DRAW_MARKER_STRUCT_TYPE ) continue;
|
||||
if( DrawStruct->Type() != DRAW_MARKER_STRUCT_TYPE )
|
||||
continue;
|
||||
/* Marqueur trouve */
|
||||
Marker = (DrawMarkerStruct*) DrawStruct;
|
||||
if( Marker->m_Type == MARQ_ERC )
|
||||
RedrawOneStruct( m_Parent->DrawPanel, &dc, Marker, g_XorMode );
|
||||
}
|
||||
|
||||
/* Suppression en memoire des marqueurs ERC */
|
||||
DeleteAllMarkers( MARQ_ERC );
|
||||
}
|
||||
|
@ -427,6 +457,7 @@ wxClientDC dc(m_Parent->DrawPanel);
|
|||
/**************************************************************/
|
||||
void WinEDA_ErcFrame::ResetDefaultERCDiag( wxCommandEvent& event )
|
||||
/**************************************************************/
|
||||
|
||||
/* Remet aux valeurs par defaut la matrice de diagnostic
|
||||
*/
|
||||
{
|
||||
|
@ -434,9 +465,11 @@ void WinEDA_ErcFrame::ResetDefaultERCDiag(wxCommandEvent& event)
|
|||
ReBuildMatrixPanel();
|
||||
}
|
||||
|
||||
|
||||
/************************************************************/
|
||||
void WinEDA_ErcFrame::ChangeErrorLevel( wxCommandEvent& event )
|
||||
/************************************************************/
|
||||
|
||||
/* Change the error level for the pressed button, on the matrix table
|
||||
*/
|
||||
{
|
||||
|
@ -453,6 +486,7 @@ wxPoint pos;
|
|||
x = ii / PIN_NMAX; y = ii % PIN_NMAX;
|
||||
|
||||
level = DiagErc[y][x];
|
||||
|
||||
switch( level )
|
||||
{
|
||||
case OK:
|
||||
|
@ -469,7 +503,6 @@ wxPoint pos;
|
|||
level = OK;
|
||||
new_bitmap_xpm = green_xpm;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if( new_bitmap_xpm )
|
||||
|
@ -477,6 +510,7 @@ wxPoint pos;
|
|||
delete Butt;
|
||||
Butt = new wxBitmapButton( m_PanelERCOptions, id,
|
||||
wxBitmap (new_bitmap_xpm), pos );
|
||||
|
||||
m_ButtonList[y][x] = Butt;
|
||||
DiagErc[y][x] = DiagErc[x][y] = level;
|
||||
}
|
||||
|
@ -489,9 +523,10 @@ static void Diagnose(WinEDA_DrawPanel * panel, wxDC * DC,
|
|||
ObjetNetListStruct* NetItemTst,
|
||||
int MinConn, int Diag )
|
||||
/********************************************************/
|
||||
|
||||
/* Routine de creation du marqueur ERC correspondant au conflit electrique
|
||||
entre NetItemRef et NetItemTst
|
||||
si MinConn < 0: Traitement des erreurs sur labels
|
||||
* entre NetItemRef et NetItemTst
|
||||
* si MinConn < 0: Traitement des erreurs sur labels
|
||||
*/
|
||||
{
|
||||
DrawMarkerStruct* Marker = NULL;
|
||||
|
@ -499,10 +534,12 @@ wxString DiagLevel;
|
|||
SCH_SCREEN* screen;
|
||||
int ii, jj;
|
||||
|
||||
if( Diag == OK ) return;
|
||||
if( Diag == OK )
|
||||
return;
|
||||
|
||||
/* Creation du nouveau marqueur type Erreur ERC */
|
||||
Marker = new DrawMarkerStruct( NetItemRef->m_Start, wxEmptyString );
|
||||
|
||||
Marker->m_Type = MARQ_ERC;
|
||||
Marker->m_MarkFlags = WAR;
|
||||
screen = NetItemRef->m_Screen;
|
||||
|
@ -513,16 +550,18 @@ int ii, jj;
|
|||
|
||||
if( MinConn < 0 ) // Traitement des erreurs sur labels
|
||||
{
|
||||
if( (NetItemRef->m_Type == NET_GLOBLABEL) ||
|
||||
(NetItemRef->m_Type == NET_GLOBBUSLABELMEMBER) )
|
||||
if( (NetItemRef->m_Type == NET_GLOBLABEL)
|
||||
|| (NetItemRef->m_Type == NET_GLOBBUSLABELMEMBER) )
|
||||
{
|
||||
Marker->m_Comment.Printf( _( "Warning GLabel %s not connected to SheetLabel" ),
|
||||
NetItemRef->m_Label->GetData() );
|
||||
}
|
||||
else Marker->m_Comment.Printf( _("Warning SheetLabel %s not connected to GLabel"),
|
||||
else
|
||||
Marker->m_Comment.Printf( _( "Warning SheetLabel %s not connected to GLabel" ),
|
||||
NetItemRef->m_Label->GetData() );
|
||||
|
||||
if( screen == panel->GetScreen() ) RedrawOneStruct(panel, DC, Marker, GR_COPY);
|
||||
if( screen == panel->GetScreen() )
|
||||
RedrawOneStruct( panel, DC, Marker, GR_COPY );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -556,7 +595,6 @@ int ii, jj;
|
|||
RedrawOneStruct( panel, DC, Marker, GR_COPY );
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if( NetItemTst ) /* Erreur entre 2 pins */
|
||||
|
@ -570,8 +608,9 @@ int ii, jj;
|
|||
g_EESchemaVar.NbWarningErc--;
|
||||
}
|
||||
|
||||
|
||||
Marker->m_Comment.Printf( _("%s: Pin %s connected to Pin %s (net %d)"), DiagLevel.GetData(),
|
||||
Marker->m_Comment.Printf( _(
|
||||
"%s: Pin %s connected to Pin %s (net %d)" ),
|
||||
DiagLevel.GetData(),
|
||||
MsgPinElectricType[ii],
|
||||
MsgPinElectricType[jj], NetItemRef->m_NetCode );
|
||||
|
||||
|
@ -587,16 +626,20 @@ static void TestOthersItems(WinEDA_DrawPanel * panel, wxDC * DC,
|
|||
ObjetNetListStruct* netstart,
|
||||
int* NetNbItems, int* MinConnexion )
|
||||
/********************************************************************/
|
||||
|
||||
/* Routine testant les conflits electriques entre
|
||||
NetItemRef
|
||||
et les autres items du meme net
|
||||
* NetItemRef
|
||||
* et les autres items du meme net
|
||||
*/
|
||||
{
|
||||
ObjetNetListStruct * NetItemTst, * Lim;
|
||||
ObjetNetListStruct* NetItemTst;
|
||||
ObjetNetListStruct* Lim;
|
||||
|
||||
int ref_elect_type, jj, erc = OK, local_minconn;
|
||||
|
||||
/* Analyse de la table des connexions : */
|
||||
Lim = g_TabObjNet + g_NbrObjNet; // pointe la fin de la liste
|
||||
|
||||
ref_elect_type = NetItemRef->m_ElectricalType;
|
||||
|
||||
NetItemTst = netstart;
|
||||
|
@ -605,14 +648,15 @@ int ref_elect_type, jj, erc = OK, local_minconn;
|
|||
/* Examen de la liste des Pins connectees a NetItemRef */
|
||||
for( ; ; NetItemTst++ )
|
||||
{
|
||||
if ( NetItemRef == NetItemTst ) continue;
|
||||
if( NetItemRef == NetItemTst )
|
||||
continue;
|
||||
|
||||
/* Est - on toujours dans le meme net ? */
|
||||
if( (NetItemTst >= Lim) || // fin de liste (donc fin de net)
|
||||
(NetItemRef->m_NetCode != NetItemTst->m_NetCode) ) // fin de net
|
||||
if( (NetItemTst >= Lim) // fin de liste (donc fin de net)
|
||||
|| (NetItemRef->m_NetCode != NetItemTst->m_NetCode) ) // fin de net
|
||||
{ /* Fin de netcode trouve: Tst connexion minimum */
|
||||
if( (*MinConnexion < NET_NC ) &&
|
||||
(local_minconn < NET_NC ) ) /* pin non connectée ou non pilotee */
|
||||
if( (*MinConnexion < NET_NC )
|
||||
&& (local_minconn < NET_NC ) ) /* pin non connectée ou non pilotee */
|
||||
{
|
||||
Diagnose( panel, DC, NetItemRef, NULL, local_minconn, WAR );
|
||||
*MinConnexion = DRV; // inhibition autres messages de ce type pour ce net
|
||||
|
@ -642,7 +686,9 @@ int ref_elect_type, jj, erc = OK, local_minconn;
|
|||
jj = NetItemTst->m_ElectricalType;
|
||||
local_minconn = MAX( MinimalReq[ref_elect_type][jj], local_minconn );
|
||||
|
||||
if ( NetItemTst <= NetItemRef ) break;
|
||||
if( NetItemTst <= NetItemRef )
|
||||
break;
|
||||
|
||||
*NetNbItems += 1;
|
||||
if( erc == OK ) // 1 marqueur par pin maxi
|
||||
{
|
||||
|
@ -665,6 +711,7 @@ int ref_elect_type, jj, erc = OK, local_minconn;
|
|||
/********************************************************/
|
||||
static bool WriteDiagnosticERC( const wxString& FullFileName )
|
||||
/*********************************************************/
|
||||
|
||||
/* Create the Diagnostic file (<xxx>.erc file)
|
||||
*/
|
||||
{
|
||||
|
@ -675,19 +722,24 @@ static FILE * OutErc;
|
|||
DrawSheetStruct* Sheet;
|
||||
wxString msg;
|
||||
|
||||
if( (OutErc = wxFopen( FullFileName, wxT("wt"))) == NULL ) return FALSE;
|
||||
if( ( OutErc = wxFopen( FullFileName, wxT( "wt" ) ) ) == NULL )
|
||||
return FALSE;
|
||||
|
||||
DateAndTime( Line );
|
||||
msg = _( "ERC control" );
|
||||
|
||||
fprintf( OutErc, "%s (%s)\n", CONV_TO_UTF8( msg ), Line );
|
||||
|
||||
EDA_ScreenList ScreenList( NULL );
|
||||
|
||||
for( SCH_SCREEN* Screen = ScreenList.GetFirst(); Screen != NULL; Screen = ScreenList.GetNext() )
|
||||
{
|
||||
Sheet = (DrawSheetStruct*) Screen;
|
||||
|
||||
msg.Printf( _( "\n***** Sheet %d (%s)\n" ),
|
||||
Sheet->m_SheetNumber,
|
||||
Screen == ScreenSch ? _( "Root" ) : Sheet->m_SheetName.GetData() );
|
||||
|
||||
fprintf( OutErc, "%s", CONV_TO_UTF8( msg ) );
|
||||
|
||||
DrawStruct = Screen->EEDrawList;
|
||||
|
@ -698,15 +750,19 @@ wxString msg;
|
|||
|
||||
/* Marqueur trouve */
|
||||
Marker = (DrawMarkerStruct*) DrawStruct;
|
||||
if( Marker->m_Type != MARQ_ERC ) continue;
|
||||
if( Marker->m_Type != MARQ_ERC )
|
||||
continue;
|
||||
|
||||
/* Write diag marqueur */
|
||||
msg.Printf( _( "ERC: %s (X= %2.3f inches, Y= %2.3f inches\n" ),
|
||||
Marker->GetComment().GetData(),
|
||||
(float) Marker->m_Pos.x / 1000,
|
||||
(float) Marker->m_Pos.y / 1000 );
|
||||
|
||||
fprintf( OutErc, "%s", CONV_TO_UTF8( msg ) );
|
||||
}
|
||||
}
|
||||
|
||||
msg.Printf( _( "\n >> Errors ERC: %d\n" ), g_EESchemaVar.NbErrorErc );
|
||||
fprintf( OutErc, "%s", CONV_TO_UTF8( msg ) );
|
||||
fclose( OutErc );
|
||||
|
@ -719,8 +775,9 @@ wxString msg;
|
|||
void TestLabel( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||
ObjetNetListStruct* NetItemRef, ObjetNetListStruct* StartNet )
|
||||
/***********************************************************************/
|
||||
|
||||
/* Routine controlant qu'un sheetLabel est bien connecte a un Glabel de la
|
||||
sous-feuille correspondante
|
||||
* sous-feuille correspondante
|
||||
*/
|
||||
{
|
||||
ObjetNetListStruct* NetItemTst, * Lim;
|
||||
|
@ -734,21 +791,24 @@ int erc = 1;
|
|||
/* Examen de la liste des Labels connectees a NetItemRef */
|
||||
for( ; ; NetItemTst++ )
|
||||
{
|
||||
if( NetItemTst == NetItemRef ) continue;
|
||||
if( NetItemTst == NetItemRef )
|
||||
continue;
|
||||
|
||||
/* Est - on toujours dans le meme net ? */
|
||||
if( ( NetItemTst == Lim ) ||
|
||||
( NetItemRef->m_NetCode != NetItemTst->m_NetCode ) )
|
||||
{ /* Fin de netcode trouve */
|
||||
if( ( NetItemTst == Lim )
|
||||
|| ( NetItemRef->m_NetCode != NetItemTst->m_NetCode ) )
|
||||
{
|
||||
/* Fin de netcode trouve */
|
||||
if( erc )
|
||||
{ /* GLabel ou SheetLabel orphelin */
|
||||
{
|
||||
/* GLabel ou SheetLabel orphelin */
|
||||
Diagnose( panel, DC, NetItemRef, NULL, -1, WAR );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if( (NetItemRef->m_Type == NET_GLOBLABEL) ||
|
||||
(NetItemRef->m_Type == NET_GLOBBUSLABELMEMBER) )
|
||||
if( (NetItemRef->m_Type == NET_GLOBLABEL)
|
||||
|| (NetItemRef->m_Type == NET_GLOBBUSLABELMEMBER) )
|
||||
{
|
||||
switch( NetItemTst->m_Type )
|
||||
{
|
||||
|
@ -774,7 +834,6 @@ int erc = 1;
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
switch( NetItemTst->m_Type )
|
||||
|
@ -803,5 +862,3 @@ int erc = 1;
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -52,13 +52,14 @@ enum id_libedit {
|
|||
/************************************************/
|
||||
class WinEDA_PartPropertiesFrame : public wxDialog
|
||||
/************************************************/
|
||||
|
||||
/* Cette classe genere une fenetre type NoteBook, pour l'edition des propriétés
|
||||
d'un composant le librairie.
|
||||
On peut éditer:
|
||||
Texte dimensions et justification de tous les champs (Ref, Val, et autres champs)
|
||||
Documentation et mots clefs
|
||||
Nombre de part par boitier
|
||||
et autres propriérés générales
|
||||
* d'un composant le librairie.
|
||||
* On peut éditer:
|
||||
* Texte dimensions et justification de tous les champs (Ref, Val, et autres champs)
|
||||
* Documentation et mots clefs
|
||||
* Nombre de part par boitier
|
||||
* et autres propriérés générales
|
||||
*/
|
||||
{
|
||||
private:
|
||||
|
@ -97,6 +98,7 @@ private:
|
|||
|
||||
|
||||
public:
|
||||
|
||||
// Constructor and destructor
|
||||
WinEDA_PartPropertiesFrame( WinEDA_LibeditFrame * parent, wxPoint & pos );
|
||||
~WinEDA_PartPropertiesFrame()
|
||||
|
@ -139,6 +141,7 @@ wxPoint fpos = pos;
|
|||
|
||||
WinEDA_PartPropertiesFrame* frame =
|
||||
new WinEDA_PartPropertiesFrame( this, fpos );
|
||||
|
||||
frame->ShowModal(); frame->Destroy();
|
||||
}
|
||||
|
||||
|
@ -199,11 +202,12 @@ int ii;
|
|||
Field = (LibDrawField*) Field->Pnext;
|
||||
}
|
||||
}
|
||||
|
||||
else SetTitle(_("Lib Component Properties"));
|
||||
else
|
||||
SetTitle( _( "Lib Component Properties" ) );
|
||||
|
||||
m_NoteBook = new wxNotebook( this, ID_LIBEDIT_NOTEBOOK,
|
||||
wxDefaultPosition, wxSize (XSIZE - 6, YSIZE - 70) );
|
||||
|
||||
SetFont( *g_DialogFont );
|
||||
m_NoteBook->SetAutoLayout( TRUE );
|
||||
c = new wxLayoutConstraints;
|
||||
|
@ -217,6 +221,7 @@ int ii;
|
|||
pos.x = 50; pos.y = YSIZE - 60;
|
||||
Button = new wxButton( this, ID_CLOSE_PART_PROPERTIES,
|
||||
_( "Cancel" ), pos );
|
||||
|
||||
Button->SetForegroundColour( *wxBLUE );
|
||||
c = new wxLayoutConstraints;
|
||||
c->left.SameAs( this, wxLeft, 20 );
|
||||
|
@ -228,6 +233,7 @@ int ii;
|
|||
pos.x += Button->GetDefaultSize().x + 70;
|
||||
Button = new wxButton( this, ID_ACCEPT_PART_PROPERTIES,
|
||||
_( "Ok" ), pos );
|
||||
|
||||
Button->SetForegroundColour( *wxRED );
|
||||
c = new wxLayoutConstraints;
|
||||
c->right.SameAs( this, wxRight, 20 );
|
||||
|
@ -250,12 +256,15 @@ int ii;
|
|||
m_NoteBook->AddPage( m_PanelAlias, _( "Alias" ), FALSE );
|
||||
|
||||
// Add panel Fields
|
||||
for ( ii = 0; ii < NUMBER_OF_FIELDS; ii++) BuildPanelEditField(ii);
|
||||
for( ii = 0; ii < NUMBER_OF_FIELDS; ii++ )
|
||||
BuildPanelEditField( ii );
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************/
|
||||
void WinEDA_PartPropertiesFrame::BuildPanelAlias()
|
||||
/*****************************************************/
|
||||
|
||||
/* create the panel for component alias list editing
|
||||
*/
|
||||
{
|
||||
|
@ -263,6 +272,7 @@ wxPoint pos;
|
|||
wxButton* Button;
|
||||
|
||||
m_PanelAlias = new wxPanel( m_NoteBook, -1 );
|
||||
|
||||
m_PanelAlias->SetFont( *g_DialogFont );
|
||||
wxLayoutConstraints* c = new wxLayoutConstraints;
|
||||
c->left.SameAs( m_NoteBook, wxLeft );
|
||||
|
@ -272,18 +282,22 @@ wxButton * Button;
|
|||
|
||||
pos.x = 200; pos.y = 70;
|
||||
Button = new wxButton( m_PanelAlias, ID_ADD_ALIAS, _( "Add" ), pos );
|
||||
|
||||
Button->SetForegroundColour( *wxBLUE );
|
||||
|
||||
pos.y += Button->GetSize().y + 10;
|
||||
Button = new wxButton( m_PanelAlias, ID_DELETE_ONE_ALIAS,
|
||||
_( "Delete" ), pos );
|
||||
|
||||
Button->SetForegroundColour( *wxRED );
|
||||
|
||||
pos.y += Button->GetSize().y + 10;
|
||||
Button = new wxButton( m_PanelAlias, ID_DELETE_ALL_ALIAS,
|
||||
_( "Delete All" ), pos );
|
||||
|
||||
Button->SetForegroundColour( *wxRED );
|
||||
if ( ! CurrentAliasName.IsEmpty() ) Button->Enable(FALSE);
|
||||
if( !CurrentAliasName.IsEmpty() )
|
||||
Button->Enable( FALSE );
|
||||
|
||||
pos.x = 5; pos.y = 30;
|
||||
m_PartAliasList = new wxListBox( m_PanelAlias,
|
||||
|
@ -291,8 +305,10 @@ wxButton * Button;
|
|||
pos, wxSize( 160, 170 ),
|
||||
0, NULL,
|
||||
wxLB_ALWAYS_SB | wxLB_SINGLE );
|
||||
|
||||
wxStaticText* Msg = new wxStaticText( m_PanelAlias, -1, _( "Alias" ),
|
||||
wxPoint (pos.x, pos.y - 20) );
|
||||
|
||||
Msg->SetForegroundColour( wxColour( 200, 0, 0 ) );
|
||||
|
||||
/* lecture des noms des alias */
|
||||
|
@ -307,6 +323,7 @@ wxButton * Button;
|
|||
/*****************************************************/
|
||||
void WinEDA_PartPropertiesFrame::BuildPanelDoc()
|
||||
/*****************************************************/
|
||||
|
||||
/* create the panel for component doc editing
|
||||
*/
|
||||
{
|
||||
|
@ -315,6 +332,7 @@ wxButton * Button;
|
|||
wxString msg_text;
|
||||
|
||||
m_PanelDoc = new wxPanel( m_NoteBook, -1 );
|
||||
|
||||
m_PanelDoc->SetFont( *g_DialogFont );
|
||||
wxLayoutConstraints* c = new wxLayoutConstraints;
|
||||
c->left.SameAs( m_NoteBook, wxLeft );
|
||||
|
@ -337,6 +355,7 @@ wxString msg_text;
|
|||
msg_text += CurrentLibEntry->m_Name.m_Text;
|
||||
}
|
||||
wxStaticText* text = new wxStaticText( m_PanelDoc, -1, msg_text, pos );
|
||||
|
||||
text->SetForegroundColour( *wxBLUE );
|
||||
}
|
||||
|
||||
|
@ -358,18 +377,21 @@ wxString msg_text;
|
|||
msg_text = CurrentLibEntry->m_AliasList[m_AliasLocation + ALIAS_KEYWORD];
|
||||
else
|
||||
{
|
||||
if (CurrentLibEntry ) msg_text = CurrentLibEntry->m_KeyWord;
|
||||
if( CurrentLibEntry )
|
||||
msg_text = CurrentLibEntry->m_KeyWord;
|
||||
}
|
||||
m_Keywords = new WinEDA_EnterText( m_PanelDoc,
|
||||
_( "Keywords:" ), msg_text,
|
||||
pos, wxSize( 285, -1 ) );
|
||||
|
||||
pos.y += 40;
|
||||
msg_text.Empty();
|
||||
if( m_AliasLocation >= 0 )
|
||||
msg_text = CurrentLibEntry->m_AliasList[m_AliasLocation + ALIAS_DOC_FILENAME];
|
||||
else
|
||||
{
|
||||
if (CurrentLibEntry) msg_text = CurrentLibEntry->m_DocFile;
|
||||
if( CurrentLibEntry )
|
||||
msg_text = CurrentLibEntry->m_DocFile;
|
||||
}
|
||||
m_Docfile = new WinEDA_EnterText( m_PanelDoc,
|
||||
_( "DocFileName:" ), msg_text,
|
||||
|
@ -378,11 +400,14 @@ wxString msg_text;
|
|||
pos.y += 40;
|
||||
Button = new wxButton( m_PanelDoc, ID_COPY_DOC_TO_ALIAS,
|
||||
_( "Copy Doc" ), pos );
|
||||
|
||||
Button->SetForegroundColour( *wxRED );
|
||||
if ( m_AliasLocation < 0 ) Button->Enable(FALSE);
|
||||
if( m_AliasLocation < 0 )
|
||||
Button->Enable( FALSE );
|
||||
|
||||
Button = new wxButton( m_PanelDoc, ID_BROWSE_DOC_FILES,
|
||||
_( "Browse DocFiles" ), wxPoint (pos.x + 140, pos.y) );
|
||||
|
||||
Button->SetForegroundColour( *wxBLUE );
|
||||
}
|
||||
|
||||
|
@ -390,12 +415,14 @@ wxString msg_text;
|
|||
/*****************************************************/
|
||||
void WinEDA_PartPropertiesFrame::BuildPanelBasic()
|
||||
/*****************************************************/
|
||||
|
||||
/* create the basic panel for component properties editing
|
||||
*/
|
||||
{
|
||||
wxPoint pos;
|
||||
|
||||
m_PanelBasic = new wxPanel( m_NoteBook, ID_PANEL_BASIC );
|
||||
|
||||
m_PanelBasic->SetFont( *g_DialogFont );
|
||||
wxLayoutConstraints* c = new wxLayoutConstraints;
|
||||
c->left.SameAs( m_NoteBook, wxLeft );
|
||||
|
@ -408,54 +435,71 @@ wxPoint pos;
|
|||
|
||||
pos.x = 10; pos.y += 22;
|
||||
AsConvertButt = new wxCheckBox( m_PanelBasic, -1, _( "As Convert" ), pos );
|
||||
if ( g_AsDeMorgan ) AsConvertButt->SetValue(TRUE);
|
||||
|
||||
if( g_AsDeMorgan )
|
||||
AsConvertButt->SetValue( TRUE );
|
||||
|
||||
pos.y += 20;
|
||||
ShowPinNumButt = new wxCheckBox( m_PanelBasic, -1, _( "Show Pin Num" ), pos );
|
||||
|
||||
if( CurrentLibEntry )
|
||||
{
|
||||
if ( CurrentLibEntry->m_DrawPinNum ) ShowPinNumButt->SetValue(TRUE);
|
||||
if( CurrentLibEntry->m_DrawPinNum )
|
||||
ShowPinNumButt->SetValue( TRUE );
|
||||
}
|
||||
else ShowPinNumButt->SetValue(TRUE);
|
||||
else
|
||||
ShowPinNumButt->SetValue( TRUE );
|
||||
|
||||
pos.y += 20;
|
||||
ShowPinNameButt = new wxCheckBox( m_PanelBasic, -1, _( "Show Pin Name" ), pos );
|
||||
|
||||
if( CurrentLibEntry )
|
||||
{
|
||||
if( CurrentLibEntry->m_DrawPinName ) ShowPinNameButt->SetValue(TRUE);
|
||||
if( CurrentLibEntry->m_DrawPinName )
|
||||
ShowPinNameButt->SetValue( TRUE );
|
||||
}
|
||||
else ShowPinNameButt->SetValue(TRUE);
|
||||
else
|
||||
ShowPinNameButt->SetValue( TRUE );
|
||||
|
||||
pos.y += 20;
|
||||
m_PinsNameInsideButt = new wxCheckBox( m_PanelBasic, -1, _( "Pin Name Inside" ), pos );
|
||||
|
||||
if( CurrentLibEntry )
|
||||
{
|
||||
if ( CurrentLibEntry->m_TextInside ) m_PinsNameInsideButt->SetValue(TRUE);
|
||||
if( CurrentLibEntry->m_TextInside )
|
||||
m_PinsNameInsideButt->SetValue( TRUE );
|
||||
}
|
||||
else m_PinsNameInsideButt->SetValue(TRUE);
|
||||
else
|
||||
m_PinsNameInsideButt->SetValue( TRUE );
|
||||
|
||||
pos.y += 40;
|
||||
new wxStaticText( m_PanelBasic, -1, _( "Number of Units:" ), pos );
|
||||
|
||||
pos.y += 15;
|
||||
wxString number;
|
||||
if ( CurrentLibEntry ) number.Printf( wxT("%d"), CurrentLibEntry->m_UnitCount);
|
||||
else number = wxT("1");
|
||||
if( CurrentLibEntry )
|
||||
number.Printf( wxT( "%d" ), CurrentLibEntry->m_UnitCount );
|
||||
else
|
||||
number = wxT( "1" );
|
||||
SelNumberOfUnits = new wxSpinCtrl( m_PanelBasic, -1, number, pos,
|
||||
wxDefaultSize, wxSP_ARROW_KEYS | wxSP_WRAP,
|
||||
1, 16 );
|
||||
|
||||
pos.y -= 15; pos.x += 180;
|
||||
new wxStaticText( m_PanelBasic, -1, _( "Skew:" ), pos );
|
||||
|
||||
pos.y += 15;
|
||||
if( CurrentLibEntry && CurrentLibEntry->m_TextInside )
|
||||
number.Printf( wxT( "%d" ), CurrentLibEntry->m_TextInside );
|
||||
else number = wxT("40");
|
||||
else
|
||||
number = wxT( "40" );
|
||||
m_SetSkew = new wxSpinCtrl( m_PanelBasic, -1, number, pos,
|
||||
wxDefaultSize, wxSP_ARROW_KEYS | wxSP_WRAP,
|
||||
1, 100 );
|
||||
|
||||
pos.x = 5; pos.y += 40;
|
||||
m_OptionPower = new wxCheckBox( m_PanelBasic, -1, _( "Power Symbol" ), pos );
|
||||
|
||||
if( CurrentLibEntry )
|
||||
{
|
||||
if( CurrentLibEntry->m_Options == ENTRY_POWER )
|
||||
|
@ -464,15 +508,17 @@ wxPoint pos;
|
|||
|
||||
pos.y = m_OptionPower->GetRect().GetBottom() + 10;
|
||||
m_OptionPartsLocked = new wxCheckBox( m_PanelBasic, -1, _( "Parts are locked" ), pos );
|
||||
|
||||
if( CurrentLibEntry )
|
||||
{
|
||||
if( CurrentLibEntry->m_UnitSelectionLocked )
|
||||
m_OptionPartsLocked->SetValue( TRUE );
|
||||
}
|
||||
if ( number == wxT("1") ) m_OptionPartsLocked->Enable(FALSE);
|
||||
|
||||
if( number == wxT( "1" ) )
|
||||
m_OptionPartsLocked->Enable( FALSE );
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************/
|
||||
void WinEDA_PartPropertiesFrame::BuildPanelEditField( int fieldId )
|
||||
/****************************************************************/
|
||||
|
@ -487,6 +533,7 @@ wxString Vjustify_list[] =
|
|||
int ii = fieldId;
|
||||
|
||||
PanelField[ii] = new wxPanel( m_NoteBook, ID_PANEL_REFERENCE + ii );
|
||||
|
||||
PanelField[ii]->SetFont( *g_DialogFont );
|
||||
wxLayoutConstraints* c = new wxLayoutConstraints;
|
||||
c->left.SameAs( m_NoteBook, wxLeft );
|
||||
|
@ -498,6 +545,7 @@ int ii = fieldId;
|
|||
pos.x = 10; pos.y = 10;
|
||||
ShowFieldText[ii] = new wxCheckBox( PanelField[ii], -1,
|
||||
_( "Show Text" ), pos );
|
||||
|
||||
if( (FieldFlags[ii] & TEXT_NO_VISIBLE ) == 0 )
|
||||
ShowFieldText[ii]->SetValue( TRUE );
|
||||
|
||||
|
@ -505,12 +553,15 @@ int ii = fieldId;
|
|||
pos.y += yy + 5;
|
||||
VorientFieldText[ii] = new wxCheckBox( PanelField[ii], -1,
|
||||
_( "Vertical" ), pos );
|
||||
if ( FieldOrient[ii] ) VorientFieldText[ii]->SetValue(TRUE);
|
||||
|
||||
if( FieldOrient[ii] )
|
||||
VorientFieldText[ii]->SetValue( TRUE );
|
||||
|
||||
pos.x = 150; pos.y = 5;
|
||||
FieldHJustify[ii] = new wxRadioBox( PanelField[ii], -1,
|
||||
_( "Hor Justify" ), pos, wxDefaultSize,
|
||||
3, Hjustify_list, 1, wxRA_SPECIFY_COLS );
|
||||
|
||||
FieldHJustify[ii]->GetSize( &xx, &yy );
|
||||
FieldHJustify[ii]->SetSelection( 1 );
|
||||
|
||||
|
@ -518,11 +569,13 @@ int ii = fieldId;
|
|||
FieldVJustify[ii] = new wxRadioBox( PanelField[ii], -1,
|
||||
_( "Vert Justify" ), pos, wxDefaultSize,
|
||||
3, Vjustify_list, 1, wxRA_SPECIFY_COLS );
|
||||
|
||||
FieldVJustify[ii]->SetSelection( 1 );
|
||||
|
||||
wxPoint txtpos;
|
||||
pos.x = 10; pos.y = 70;
|
||||
#define POSY_OFFSET 70
|
||||
|
||||
switch( ii )
|
||||
{
|
||||
case REFERENCE:
|
||||
|
@ -539,18 +592,27 @@ int ii = fieldId;
|
|||
else if( Field->m_VJustify == GR_TEXT_VJUSTIFY_TOP )
|
||||
FieldVJustify[ii]->SetSelection( 2 );
|
||||
}
|
||||
else txtpos = wxPoint(0,0);
|
||||
else
|
||||
txtpos = wxPoint( 0, 0 );
|
||||
FieldPosition[ii] = new WinEDA_PositionCtrl( PanelField[ii],
|
||||
_( "Pos" ), txtpos,
|
||||
g_UnitMetric, pos );
|
||||
FieldTextCtrl[ii] = new WinEDA_GraphicTextCtrl( PanelField[ii],
|
||||
|
||||
FieldTextCtrl[ii] = new WinEDA_GraphicTextCtrl(
|
||||
PanelField[ii],
|
||||
DrawPartStruct::ReturnFieldName (ii),
|
||||
CurrentLibEntry ?
|
||||
CurrentLibEntry->m_Prefix.m_Text.GetData() : wxT("U"),
|
||||
CurrentLibEntry ? CurrentLibEntry->m_Prefix.m_Size.x : DEFAULT_TEXT_SIZE,
|
||||
CurrentLibEntry->m_Prefix.m_Text.GetData ()
|
||||
: wxT(
|
||||
"U" ),
|
||||
CurrentLibEntry ? CurrentLibEntry->
|
||||
m_Prefix.m_Size.x : DEFAULT_TEXT_SIZE,
|
||||
g_UnitMetric,
|
||||
wxPoint(pos.x, pos.y +FieldPosition[ii]->GetDimension().y + POSY_OFFSET),
|
||||
200, TRUE);
|
||||
wxPoint (pos.x, pos.y +
|
||||
FieldPosition[ii]->GetDimension ().y + POSY_OFFSET),
|
||||
200,
|
||||
TRUE );
|
||||
|
||||
break;
|
||||
|
||||
case VALUE:
|
||||
|
@ -567,17 +629,25 @@ int ii = fieldId;
|
|||
else if( Field->m_VJustify == GR_TEXT_VJUSTIFY_TOP )
|
||||
FieldVJustify[ii]->SetSelection( 2 );
|
||||
}
|
||||
else txtpos = wxPoint(0,0);
|
||||
else
|
||||
txtpos = wxPoint( 0, 0 );
|
||||
FieldPosition[ii] = new WinEDA_PositionCtrl( PanelField[ii],
|
||||
_( "Pos" ), txtpos,
|
||||
g_UnitMetric, pos );
|
||||
FieldTextCtrl[ii] = new WinEDA_GraphicTextCtrl( PanelField[ii],
|
||||
|
||||
FieldTextCtrl[ii] = new WinEDA_GraphicTextCtrl(
|
||||
PanelField[ii],
|
||||
DrawPartStruct::ReturnFieldName (ii),
|
||||
CurrentLibEntry ? CurrentLibEntry->m_Name.m_Text.GetData() : NULL,
|
||||
CurrentLibEntry ? CurrentLibEntry->m_Name.m_Size.x : DEFAULT_TEXT_SIZE,
|
||||
CurrentLibEntry ? CurrentLibEntry->m_Name.
|
||||
m_Text.GetData () : NULL,
|
||||
CurrentLibEntry ? CurrentLibEntry->m_Name.
|
||||
m_Size.x : DEFAULT_TEXT_SIZE,
|
||||
g_UnitMetric,
|
||||
wxPoint(pos.x, pos.y +FieldPosition[ii]->GetDimension().y + POSY_OFFSET),
|
||||
200, TRUE);
|
||||
wxPoint (pos.x, pos.y +
|
||||
FieldPosition[ii]->GetDimension ().y + POSY_OFFSET),
|
||||
200,
|
||||
TRUE );
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -587,6 +657,7 @@ int ii = fieldId;
|
|||
fsize = DEFAULT_TEXT_SIZE;;
|
||||
Field = NULL;
|
||||
fpos = wxPoint( 0, 0 );
|
||||
|
||||
//recherche du Field de FieldId correspondant, s'il existe
|
||||
if( CurrentLibEntry )
|
||||
{
|
||||
|
@ -615,12 +686,18 @@ int ii = fieldId;
|
|||
FieldPosition[ii] = new WinEDA_PositionCtrl( PanelField[ii],
|
||||
_( "Pos" ), fpos,
|
||||
g_UnitMetric, pos );
|
||||
FieldTextCtrl[ii] = new WinEDA_GraphicTextCtrl( PanelField[ii],
|
||||
|
||||
FieldTextCtrl[ii] = new WinEDA_GraphicTextCtrl(
|
||||
PanelField[ii],
|
||||
DrawPartStruct::ReturnFieldName (ii),
|
||||
ftext, fsize,
|
||||
ftext,
|
||||
fsize,
|
||||
g_UnitMetric,
|
||||
wxPoint(pos.x, pos.y +FieldPosition[ii]->GetDimension().y + POSY_OFFSET),
|
||||
200, TRUE);
|
||||
wxPoint (pos.x, pos.y +
|
||||
FieldPosition[ii]->GetDimension ().y + POSY_OFFSET),
|
||||
200,
|
||||
TRUE );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -634,17 +711,23 @@ void WinEDA_PartPropertiesFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
|||
Close( true );
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
void WinEDA_PartPropertiesFrame::PartPropertiesAccept( wxCommandEvent& event )
|
||||
/**************************************************************************/
|
||||
|
||||
/* Met a jour les differents parametres pour le composant en cours d'édition
|
||||
*/
|
||||
{
|
||||
int ii, jj;
|
||||
int hjustify[3] = { GR_TEXT_HJUSTIFY_LEFT , GR_TEXT_HJUSTIFY_CENTER,
|
||||
GR_TEXT_HJUSTIFY_RIGHT };
|
||||
int vjustify[3] = { GR_TEXT_VJUSTIFY_BOTTOM , GR_TEXT_VJUSTIFY_CENTER,
|
||||
GR_TEXT_VJUSTIFY_TOP };
|
||||
int hjustify[3] = {
|
||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_CENTER,
|
||||
GR_TEXT_HJUSTIFY_RIGHT
|
||||
};
|
||||
int vjustify[3] = {
|
||||
GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_CENTER,
|
||||
GR_TEXT_VJUSTIFY_TOP
|
||||
};
|
||||
|
||||
if( CurrentLibEntry == NULL )
|
||||
{
|
||||
|
@ -656,7 +739,7 @@ int vjustify[3] = { GR_TEXT_VJUSTIFY_BOTTOM , GR_TEXT_VJUSTIFY_CENTER,
|
|||
m_Parent->SaveCopyInUndoList();
|
||||
|
||||
/* A new name could be entered in VALUE field.
|
||||
Must not be an existing alias name in alias list box */
|
||||
* Must not be an existing alias name in alias list box */
|
||||
jj = m_PartAliasList->GetCount();
|
||||
wxString newvalue = FieldTextCtrl[VALUE]->GetText();
|
||||
for( ii = 0; ii < jj; ii++ )
|
||||
|
@ -677,7 +760,6 @@ int vjustify[3] = { GR_TEXT_VJUSTIFY_BOTTOM , GR_TEXT_VJUSTIFY_CENTER,
|
|||
CurrentLibEntry->m_KeyWord = m_Keywords->GetValue();
|
||||
CurrentLibEntry->m_DocFile = m_Docfile->GetValue();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
CurrentLibEntry->m_AliasList[m_AliasLocation + ALIAS_DOC] = m_Doc->GetValue();
|
||||
|
@ -716,13 +798,13 @@ int vjustify[3] = { GR_TEXT_VJUSTIFY_BOTTOM , GR_TEXT_VJUSTIFY_CENTER,
|
|||
|
||||
if( ii == jj ) // Alias not found in new list, remove it (4 strings in kk position)
|
||||
{
|
||||
for( ii = 0; ii < ALIAS_NEXT; ii++ ) CurrentLibEntry->m_AliasList.RemoveAt(kk);
|
||||
for( ii = 0; ii < ALIAS_NEXT; ii++ )
|
||||
CurrentLibEntry->m_AliasList.RemoveAt( kk );
|
||||
|
||||
kkmax = CurrentLibEntry->m_AliasList.GetCount();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if( !FieldTextCtrl[REFERENCE]->GetText().IsEmpty() )
|
||||
{
|
||||
CurrentLibEntry->m_Prefix.m_Text = FieldTextCtrl[REFERENCE]->GetText();
|
||||
|
@ -789,8 +871,10 @@ int vjustify[3] = { GR_TEXT_VJUSTIFY_BOTTOM , GR_TEXT_VJUSTIFY_CENTER,
|
|||
if( Field->m_Text.IsEmpty() ) // An old field exists; new is void, delete it
|
||||
{
|
||||
delete Field;
|
||||
if ( previousField ) previousField->Pnext = NextField;
|
||||
else CurrentLibEntry->Fields = NextField;
|
||||
if( previousField )
|
||||
previousField->Pnext = NextField;
|
||||
else
|
||||
CurrentLibEntry->Fields = NextField;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -802,6 +886,7 @@ int vjustify[3] = { GR_TEXT_VJUSTIFY_BOTTOM , GR_TEXT_VJUSTIFY_CENTER,
|
|||
if( (Field == NULL) && ( !FieldTextCtrl[ii]->GetText().IsEmpty() ) )
|
||||
{ // Do not exists: must be created
|
||||
Field = new LibDrawField( ii );
|
||||
|
||||
Field->m_Text = FieldTextCtrl[ii]->GetText();
|
||||
Field->m_Size.x = Field->m_Size.y = FieldTextCtrl[ii]->GetTextSize();
|
||||
if( ShowFieldText[Field->m_FieldId]->GetValue() )
|
||||
|
@ -826,7 +911,8 @@ int vjustify[3] = { GR_TEXT_VJUSTIFY_BOTTOM , GR_TEXT_VJUSTIFY_CENTER,
|
|||
if( !g_AsDeMorgan )
|
||||
{
|
||||
g_AsDeMorgan = 1;
|
||||
if ( SetUnsetConvert() ) m_RecreateToolbar = TRUE;
|
||||
if( SetUnsetConvert() )
|
||||
m_RecreateToolbar = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -834,7 +920,8 @@ int vjustify[3] = { GR_TEXT_VJUSTIFY_BOTTOM , GR_TEXT_VJUSTIFY_CENTER,
|
|||
if( g_AsDeMorgan )
|
||||
{
|
||||
g_AsDeMorgan = 0;
|
||||
if ( SetUnsetConvert() ) m_RecreateToolbar = TRUE;
|
||||
if( SetUnsetConvert() )
|
||||
m_RecreateToolbar = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -852,12 +939,13 @@ int vjustify[3] = { GR_TEXT_VJUSTIFY_BOTTOM , GR_TEXT_VJUSTIFY_CENTER,
|
|||
CurrentLibEntry->m_Options = ENTRY_NORMAL;
|
||||
|
||||
/* Set the option "Units locked".
|
||||
Obviously, cannot be TRUE if there is only one part */
|
||||
* Obviously, cannot be TRUE if there is only one part */
|
||||
CurrentLibEntry->m_UnitSelectionLocked = m_OptionPartsLocked->GetValue();
|
||||
if( CurrentLibEntry->m_UnitCount <= 1 )
|
||||
CurrentLibEntry->m_UnitSelectionLocked = FALSE;
|
||||
|
||||
if ( m_RecreateToolbar ) m_Parent->ReCreateHToolbar();
|
||||
if( m_RecreateToolbar )
|
||||
m_Parent->ReCreateHToolbar();
|
||||
|
||||
m_Parent->DisplayLibInfos();
|
||||
|
||||
|
@ -869,20 +957,22 @@ int vjustify[3] = { GR_TEXT_VJUSTIFY_BOTTOM , GR_TEXT_VJUSTIFY_CENTER,
|
|||
void WinEDA_PartPropertiesFrame::CopyDocToAlias( wxCommandEvent& WXUNUSED (event) )
|
||||
/******************************************************************************/
|
||||
{
|
||||
if( CurrentLibEntry == NULL ) return;
|
||||
if ( CurrentAliasName.IsEmpty() ) return;
|
||||
if( CurrentLibEntry == NULL )
|
||||
return;
|
||||
if( CurrentAliasName.IsEmpty() )
|
||||
return;
|
||||
|
||||
m_Doc->SetValue( CurrentLibEntry->m_Doc );
|
||||
m_Docfile->SetValue( CurrentLibEntry->m_DocFile );
|
||||
m_Keywords->SetValue( CurrentLibEntry->m_KeyWord );
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************/
|
||||
void WinEDA_PartPropertiesFrame::DeleteAllAliasOfPart(
|
||||
wxCommandEvent& WXUNUSED (event) )
|
||||
/**********************************************************/
|
||||
{
|
||||
|
||||
CurrentAliasName.Empty();
|
||||
if( CurrentLibEntry )
|
||||
{
|
||||
|
@ -892,22 +982,25 @@ void WinEDA_PartPropertiesFrame::DeleteAllAliasOfPart(
|
|||
m_RecreateToolbar = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************/
|
||||
void WinEDA_PartPropertiesFrame::AddAliasOfPart( wxCommandEvent& WXUNUSED (event) )
|
||||
/*******************************************************************************/
|
||||
|
||||
/* Add a new name to the alias list box
|
||||
New name cannot be the root name, and must not exists
|
||||
* New name cannot be the root name, and must not exists
|
||||
*/
|
||||
{
|
||||
wxString Line;
|
||||
wxString aliasname;
|
||||
|
||||
if(CurrentLibEntry == NULL) return;
|
||||
if( CurrentLibEntry == NULL )
|
||||
return;
|
||||
|
||||
if( Get_Message(_("New alias:"),Line, this) != 0 ) return;
|
||||
if( Get_Message( _( "New alias:" ), Line, this ) != 0 )
|
||||
return;
|
||||
|
||||
Line.Replace( wxT( " " ), wxT( "_" ) );
|
||||
aliasname = Line;
|
||||
|
@ -933,6 +1026,7 @@ wxString aliasname;
|
|||
m_RecreateToolbar = TRUE;
|
||||
}
|
||||
|
||||
|
||||
/********************************************************/
|
||||
void WinEDA_PartPropertiesFrame::DeleteAliasOfPart(
|
||||
wxCommandEvent& WXUNUSED (event) )
|
||||
|
@ -940,7 +1034,8 @@ void WinEDA_PartPropertiesFrame::DeleteAliasOfPart(
|
|||
{
|
||||
wxString aliasname = m_PartAliasList->GetStringSelection();
|
||||
|
||||
if ( aliasname.IsEmpty() ) return;
|
||||
if( aliasname.IsEmpty() )
|
||||
return;
|
||||
if( aliasname == CurrentAliasName )
|
||||
{
|
||||
wxString msg = CurrentAliasName + _( " is Current Selected Alias!" );
|
||||
|
@ -955,25 +1050,27 @@ wxString aliasname = m_PartAliasList->GetStringSelection();
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/********************************************************************/
|
||||
bool WinEDA_PartPropertiesFrame::ChangeNbUnitsPerPackage( int MaxUnit )
|
||||
/********************************************************************/
|
||||
|
||||
/* Routine de modification du nombre d'unites par package pour le
|
||||
composant courant;
|
||||
* composant courant;
|
||||
*/
|
||||
{
|
||||
int OldNumUnits, ii, FlagDel = -1;
|
||||
LibEDA_BaseStruct* DrawItem, * NextDrawItem;
|
||||
|
||||
if( CurrentLibEntry == NULL ) return FALSE;
|
||||
if( CurrentLibEntry == NULL )
|
||||
return FALSE;
|
||||
|
||||
/* Si pas de changement: termine */
|
||||
if ( CurrentLibEntry->m_UnitCount == MaxUnit ) return FALSE;
|
||||
if( CurrentLibEntry->m_UnitCount == MaxUnit )
|
||||
return FALSE;
|
||||
|
||||
OldNumUnits = CurrentLibEntry->m_UnitCount;
|
||||
if ( OldNumUnits < 1 ) OldNumUnits = 1;
|
||||
if( OldNumUnits < 1 )
|
||||
OldNumUnits = 1;
|
||||
|
||||
CurrentLibEntry->m_UnitCount = MaxUnit;
|
||||
|
||||
|
@ -992,7 +1089,8 @@ LibEDA_BaseStruct* DrawItem, * NextDrawItem;
|
|||
if( IsOK( this, _( "Delete units" ) ) )
|
||||
{
|
||||
/* Si part selectee n'existe plus: selection 1ere unit */
|
||||
if( CurrentUnit > MaxUnit ) CurrentUnit = 1;
|
||||
if( CurrentUnit > MaxUnit )
|
||||
CurrentUnit = 1;
|
||||
FlagDel = 1;
|
||||
}
|
||||
else
|
||||
|
@ -1007,6 +1105,7 @@ LibEDA_BaseStruct* DrawItem, * NextDrawItem;
|
|||
DrawItem, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1035,8 +1134,9 @@ LibEDA_BaseStruct* DrawItem, * NextDrawItem;
|
|||
/*****************************************************/
|
||||
bool WinEDA_PartPropertiesFrame::SetUnsetConvert()
|
||||
/*****************************************************/
|
||||
|
||||
/* crée ou efface (selon option AsConvert) les éléments
|
||||
de la représentation convertie d'un composant
|
||||
* de la représentation convertie d'un composant
|
||||
*/
|
||||
{
|
||||
int FlagDel = 0;
|
||||
|
@ -1045,11 +1145,13 @@ LibEDA_BaseStruct* DrawItem = NULL, * NextDrawItem;
|
|||
if( g_AsDeMorgan ) /* Representation convertie a creer */
|
||||
{
|
||||
/* Traitement des elements a ajouter ( pins seulement ) */
|
||||
if( CurrentLibEntry ) DrawItem = CurrentLibEntry->m_Drawings;
|
||||
if( CurrentLibEntry )
|
||||
DrawItem = CurrentLibEntry->m_Drawings;
|
||||
for( ; DrawItem != NULL; DrawItem = DrawItem->Next() )
|
||||
{
|
||||
/* Duplication des items pour autres elements */
|
||||
if( DrawItem->Type() != COMPONENT_PIN_DRAW_TYPE ) continue;
|
||||
if( DrawItem->Type() != COMPONENT_PIN_DRAW_TYPE )
|
||||
continue;
|
||||
if( DrawItem->m_Convert == 1 )
|
||||
{
|
||||
if( FlagDel == 0 )
|
||||
|
@ -1071,11 +1173,11 @@ LibEDA_BaseStruct* DrawItem = NULL, * NextDrawItem;
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
else /* Representation convertie a supprimer */
|
||||
{
|
||||
/* Traitement des elements à supprimer */
|
||||
if( CurrentLibEntry ) DrawItem = CurrentLibEntry->m_Drawings;
|
||||
if( CurrentLibEntry )
|
||||
DrawItem = CurrentLibEntry->m_Drawings;
|
||||
for( ; DrawItem != NULL; DrawItem = NextDrawItem )
|
||||
{
|
||||
NextDrawItem = DrawItem->Next();
|
||||
|
@ -1095,18 +1197,24 @@ LibEDA_BaseStruct* DrawItem = NULL, * NextDrawItem;
|
|||
}
|
||||
}
|
||||
m_Parent->GetScreen()->SetModify();
|
||||
DeleteOneLibraryDrawStruct(m_Parent->DrawPanel, NULL, CurrentLibEntry, DrawItem, 0);
|
||||
DeleteOneLibraryDrawStruct( m_Parent->DrawPanel,
|
||||
NULL,
|
||||
CurrentLibEntry,
|
||||
DrawItem,
|
||||
0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
void WinEDA_PartPropertiesFrame::BrowseAndSelectDocFile( wxCommandEvent& event )
|
||||
/****************************************************************************/
|
||||
{
|
||||
wxString FullFileName;
|
||||
|
||||
wxString docpath( g_RealLibDirBuffer ), filename;
|
||||
|
||||
docpath += wxT( "doc" );
|
||||
|
@ -1120,7 +1228,8 @@ wxString docpath(g_RealLibDirBuffer), filename;
|
|||
wxFD_OPEN,
|
||||
TRUE
|
||||
);
|
||||
if ( FullFileName.IsEmpty() ) return;
|
||||
if( FullFileName.IsEmpty() )
|
||||
return;
|
||||
|
||||
// Suppression du chemin par defaut pour le fichier de doc:
|
||||
filename = MakeReducedFileName( FullFileName, docpath, wxEmptyString );
|
||||
|
|
|
@ -272,8 +272,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
|
|||
if( !Failed )
|
||||
{
|
||||
PolylineStruct->Pnext = screen->EEDrawList;
|
||||
screen->EEDrawList = (EDA_BaseStruct*)
|
||||
PolylineStruct;
|
||||
screen->EEDrawList = (EDA_BaseStruct*) PolylineStruct;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -441,6 +440,10 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
|
|||
|
||||
screen->EEDrawList = Phead;
|
||||
|
||||
#if defined(DEBUG)
|
||||
screen->Show( 0, std::cout );
|
||||
#endif
|
||||
|
||||
fclose( f );
|
||||
|
||||
TestDanglingEnds( screen->EEDrawList, NULL );
|
||||
|
|
|
@ -13,21 +13,22 @@
|
|||
#include "protos.h"
|
||||
|
||||
|
||||
|
||||
/* Routines locales */
|
||||
static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus );
|
||||
static void SheetLabelConnection( ObjetNetListStruct* SheetLabel );
|
||||
static int ListeObjetConnection(WinEDA_SchematicFrame * frame, SCH_SCREEN *screen, ObjetNetListStruct *ObjNet);
|
||||
static int ListeObjetConnection( WinEDA_SchematicFrame* frame,
|
||||
SCH_SCREEN* screen,
|
||||
ObjetNetListStruct* ObjNet );
|
||||
static int ConvertBusToMembers( ObjetNetListStruct* ObjNet );
|
||||
static void PointToPointConnect( ObjetNetListStruct* RefObj, int IsBus,
|
||||
int start );
|
||||
static void SegmentToPointConnect( ObjetNetListStruct* Jonction, int IsBus,
|
||||
int start );
|
||||
static void LabelConnection( ObjetNetListStruct* Label );
|
||||
static int TriNetCode(ObjetNetListStruct *Objet1, ObjetNetListStruct *Objet2);
|
||||
static int TriNetCode( const void* o1, const void* o2 );
|
||||
static void ConnectBusLabels( ObjetNetListStruct* Label, int NbItems );
|
||||
static void SetUnconnectedFlag( ObjetNetListStruct* ObjNet, int NbItems );
|
||||
static int TriBySheet(ObjetNetListStruct *Objet1, ObjetNetListStruct *Objet2);
|
||||
static int TriBySheet( const void* o1, const void* o2 );
|
||||
|
||||
/* Variable locales */
|
||||
static int FirstNumWireBus, LastNumWireBus, RootBusNameLength;
|
||||
|
@ -35,15 +36,15 @@ static int LastNetCode, LastBusNetCode;
|
|||
static int s_PassNumber;
|
||||
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
void FreeTabNetList( ObjetNetListStruct* TabNetItems, int NbrNetItems )
|
||||
/***********************************************************************/
|
||||
|
||||
/*
|
||||
Routine de liberation memoire des tableaux utilises pour le calcul
|
||||
de la netliste
|
||||
TabNetItems = pointeur sur le tableau principal (liste des items )
|
||||
NbrNetItems = nombre d'elements
|
||||
* Routine de liberation memoire des tableaux utilises pour le calcul
|
||||
* de la netliste
|
||||
* TabNetItems = pointeur sur le tableau principal (liste des items )
|
||||
* NbrNetItems = nombre d'elements
|
||||
*/
|
||||
{
|
||||
int i;
|
||||
|
@ -63,6 +64,7 @@ int i;
|
|||
case NET_PINLABEL:
|
||||
case NET_NOCONNECT:
|
||||
break;
|
||||
|
||||
case NET_GLOBBUSLABELMEMBER:
|
||||
case NET_SHEETBUSLABELMEMBER:
|
||||
case NET_BUSLABELMEMBER:
|
||||
|
@ -74,24 +76,26 @@ int i;
|
|||
MyFree( TabNetItems );
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************/
|
||||
void* WinEDA_SchematicFrame::BuildNetListBase()
|
||||
/*****************************************************/
|
||||
|
||||
/* Routine qui construit le tableau des elements connectes du projet
|
||||
met a jour:
|
||||
g_TabObjNet
|
||||
g_NbrObjNet
|
||||
* met a jour:
|
||||
* g_TabObjNet
|
||||
* g_NbrObjNet
|
||||
*/
|
||||
{
|
||||
int NetNumber, SheetNumber;
|
||||
int i, istart, NetCode;
|
||||
SCH_SCREEN* screen;
|
||||
ObjetNetListStruct * BaseTabObjNet;
|
||||
wxString msg;
|
||||
wxBusyCursor Busy;
|
||||
|
||||
NetNumber = 1;
|
||||
s_PassNumber = 0;
|
||||
|
||||
MsgPanel->EraseMsgBox();
|
||||
Affiche_1_Parametre( this, 1, _( "List" ), wxEmptyString, LIGHTRED );
|
||||
|
||||
|
@ -116,20 +120,24 @@ wxBusyCursor Busy;
|
|||
if( g_NbrObjNet == 0 )
|
||||
{
|
||||
DisplayError( this, _( "No component" ), 20 );
|
||||
return(NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
i = sizeof(ObjetNetListStruct) * g_NbrObjNet;
|
||||
BaseTabObjNet = g_TabObjNet = (ObjetNetListStruct *) MyZMalloc(i);
|
||||
if( BaseTabObjNet == NULL ) return(NULL);
|
||||
g_TabObjNet = (ObjetNetListStruct*) MyZMalloc( i );
|
||||
if( g_TabObjNet == NULL )
|
||||
return NULL;
|
||||
|
||||
/* 2eme passe : Remplissage des champs des structures des objets de Net */
|
||||
|
||||
s_PassNumber++;
|
||||
Affiche_1_Parametre( this, 1, _( "List" ), wxEmptyString, RED );
|
||||
for ( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
|
||||
|
||||
screen = ScreenList.GetFirst();
|
||||
for( ObjetNetListStruct* baseTabObjNet = g_TabObjNet;
|
||||
screen != NULL; screen = ScreenList.GetNext() )
|
||||
{
|
||||
g_TabObjNet += ListeObjetConnection(this, screen, g_TabObjNet );
|
||||
baseTabObjNet += ListeObjetConnection( this, screen, baseTabObjNet );
|
||||
}
|
||||
|
||||
Affiche_1_Parametre( this, -1, wxEmptyString, _( "Done" ), RED );
|
||||
|
@ -140,14 +148,13 @@ wxBusyCursor Busy;
|
|||
/* Recherche des connections pour les Segments et les Pins */
|
||||
/* Tri du Tableau des objets de Net par Sheet */
|
||||
|
||||
qsort(BaseTabObjNet, g_NbrObjNet, sizeof(ObjetNetListStruct),
|
||||
(int (*)(const void *, const void *)) TriBySheet);
|
||||
qsort( g_TabObjNet, g_NbrObjNet, sizeof(ObjetNetListStruct), TriBySheet );
|
||||
|
||||
Affiche_1_Parametre( this, 18, _( "Conn" ), wxEmptyString, CYAN );
|
||||
|
||||
g_TabObjNet = BaseTabObjNet;
|
||||
SheetNumber = g_TabObjNet[0].m_SheetNumber;
|
||||
LastNetCode = LastBusNetCode = 1;
|
||||
|
||||
for( i = istart = 0; i < g_NbrObjNet; i++ )
|
||||
{
|
||||
if( g_TabObjNet[i].m_SheetNumber != SheetNumber )
|
||||
|
@ -161,7 +168,9 @@ wxBusyCursor Busy;
|
|||
case NET_PINLABEL:
|
||||
case NET_SHEETLABEL:
|
||||
case NET_NOCONNECT:
|
||||
if ( g_TabObjNet[i].m_NetCode != 0 ) break; /* Deja connecte */
|
||||
if( g_TabObjNet[i].m_NetCode != 0 )
|
||||
break; /* Deja connecte */
|
||||
|
||||
case NET_SEGMENT:
|
||||
/* Controle des connexions type point a point ( Sans BUS ) */
|
||||
if( g_TabObjNet[i].m_NetCode == 0 )
|
||||
|
@ -202,7 +211,9 @@ wxBusyCursor Busy;
|
|||
break;
|
||||
|
||||
case NET_SHEETBUSLABELMEMBER:
|
||||
if ( g_TabObjNet[i].m_BusNetCode != 0 ) break; /* Deja connecte */
|
||||
if( g_TabObjNet[i].m_BusNetCode != 0 )
|
||||
break; /* Deja connecte */
|
||||
|
||||
case NET_BUS:
|
||||
/* Controle des connexions type point a point mode BUS */
|
||||
if( g_TabObjNet[i].m_BusNetCode == 0 )
|
||||
|
@ -223,9 +234,9 @@ wxBusyCursor Busy;
|
|||
}
|
||||
SegmentToPointConnect( g_TabObjNet + i, ISBUS, istart );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Affiche_1_Parametre( this, -1, wxEmptyString, _( "Done" ), CYAN );
|
||||
|
||||
/* Mise a jour des NetCodes des Bus Labels connectes par les Bus */
|
||||
|
@ -253,6 +264,7 @@ wxBusyCursor Busy;
|
|||
case NET_GLOBBUSLABELMEMBER:
|
||||
LabelConnection( g_TabObjNet + i );
|
||||
break;
|
||||
|
||||
case NET_SHEETBUSLABELMEMBER:
|
||||
break;
|
||||
}
|
||||
|
@ -266,14 +278,13 @@ wxBusyCursor Busy;
|
|||
|
||||
for( i = 0; i < g_NbrObjNet; i++ )
|
||||
{
|
||||
if( (g_TabObjNet[i].m_Type == NET_SHEETLABEL ) ||
|
||||
( g_TabObjNet[i].m_Type == NET_SHEETBUSLABELMEMBER ) )
|
||||
if( (g_TabObjNet[i].m_Type == NET_SHEETLABEL )
|
||||
|| ( g_TabObjNet[i].m_Type == NET_SHEETBUSLABELMEMBER ) )
|
||||
SheetLabelConnection( g_TabObjNet + i );
|
||||
}
|
||||
|
||||
/* Tri du Tableau des objets de Net par NetCode */
|
||||
qsort(g_TabObjNet, g_NbrObjNet, sizeof(ObjetNetListStruct),
|
||||
(int (*)(const void *, const void *)) TriNetCode);
|
||||
qsort( g_TabObjNet, g_NbrObjNet, sizeof(ObjetNetListStruct), TriNetCode );
|
||||
|
||||
Affiche_1_Parametre( this, -1, wxEmptyString, _( "Done" ), RED );
|
||||
|
||||
|
@ -292,11 +303,12 @@ wxBusyCursor Busy;
|
|||
Affiche_1_Parametre( this, -1, wxEmptyString, _( "Done" ), GREEN );
|
||||
|
||||
/* Affectation du m_FlagOfConnection en fonction de connection ou non */
|
||||
SetUnconnectedFlag( BaseTabObjNet, g_NbrObjNet);
|
||||
SetUnconnectedFlag( g_TabObjNet, g_NbrObjNet );
|
||||
|
||||
return( (void*) BaseTabObjNet);
|
||||
return (void*) g_TabObjNet;
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************
|
||||
* Routine qui connecte les sous feuilles par les sheetLabels *
|
||||
**************************************************************/
|
||||
|
@ -305,38 +317,48 @@ static void SheetLabelConnection(ObjetNetListStruct *SheetLabel)
|
|||
int i;
|
||||
ObjetNetListStruct* ObjetNet;
|
||||
|
||||
if( SheetLabel->m_NetCode == 0 ) return;
|
||||
if( SheetLabel->m_NetCode == 0 )
|
||||
return;
|
||||
|
||||
/* Calcul du numero de sous feuille correspondante au sheetlabel */
|
||||
|
||||
/* Comparaison du SheetLabel avec les GLABELS de la sous feuille
|
||||
pour regroupement des NetCodes */
|
||||
* pour regroupement des NetCodes */
|
||||
for( i = 0, ObjetNet = g_TabObjNet; i < g_NbrObjNet; i++ )
|
||||
{
|
||||
if( ObjetNet[i].m_SheetNumber != SheetLabel->m_NumInclude ) continue;
|
||||
if( (ObjetNet[i].m_Type != NET_GLOBLABEL ) &&
|
||||
(ObjetNet[i].m_Type != NET_GLOBBUSLABELMEMBER ) )
|
||||
if( ObjetNet[i].m_SheetNumber != SheetLabel->m_NumInclude )
|
||||
continue;
|
||||
|
||||
if( (ObjetNet[i].m_Type != NET_GLOBLABEL )
|
||||
&& (ObjetNet[i].m_Type != NET_GLOBBUSLABELMEMBER ) )
|
||||
continue;
|
||||
|
||||
if( ObjetNet[i].m_NetCode == SheetLabel->m_NetCode )
|
||||
continue;
|
||||
|
||||
if( ObjetNet[i].m_Label->CmpNoCase( *SheetLabel->m_Label ) != 0 )
|
||||
continue;
|
||||
if( ObjetNet[i].m_NetCode == SheetLabel->m_NetCode ) continue;
|
||||
if( ObjetNet[i].m_Label->CmpNoCase(*SheetLabel->m_Label) != 0) continue;
|
||||
|
||||
/* Propagation du Netcode a tous les Objets de meme NetCode */
|
||||
if( ObjetNet[i].m_NetCode )
|
||||
PropageNetCode( ObjetNet[i].m_NetCode, SheetLabel->m_NetCode, 0 );
|
||||
else ObjetNet[i].m_NetCode = SheetLabel->m_NetCode;
|
||||
else
|
||||
ObjetNet[i].m_NetCode = SheetLabel->m_NetCode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
static int ListeObjetConnection( WinEDA_SchematicFrame* frame, SCH_SCREEN* screen,
|
||||
ObjetNetListStruct* ObjNet )
|
||||
/*****************************************************************************/
|
||||
|
||||
/* Routine generant la liste des objets relatifs aux connection
|
||||
entree:
|
||||
screen: pointeur sur l'ecran a traiter
|
||||
ObjNet:
|
||||
si NULL: la routine compte seulement le nombre des objets
|
||||
sinon: pointe le tableau a remplir
|
||||
* entree:
|
||||
* screen: pointeur sur l'ecran a traiter
|
||||
* ObjNet:
|
||||
* si NULL: la routine compte seulement le nombre des objets
|
||||
* sinon: pointe le tableau a remplir
|
||||
*/
|
||||
{
|
||||
int ii, NbrItem = 0, NumSheet;
|
||||
|
@ -349,9 +371,9 @@ DrawSheetLabelStruct *SheetLabel;
|
|||
int NumInclude;
|
||||
|
||||
NumSheet = screen->m_SheetNumber;
|
||||
DrawList = screen->EEDrawList;
|
||||
|
||||
while ( DrawList )
|
||||
DrawList = screen->EEDrawList;
|
||||
for( ; DrawList; DrawList = DrawList->Pnext )
|
||||
{
|
||||
switch( DrawList->Type() )
|
||||
{
|
||||
|
@ -360,8 +382,8 @@ int NumInclude;
|
|||
#define STRUCT ( (EDA_DrawLineStruct*) DrawList )
|
||||
if( ObjNet )
|
||||
{
|
||||
if ( (STRUCT->m_Layer != LAYER_BUS) &&
|
||||
(STRUCT->m_Layer != LAYER_WIRE) )
|
||||
if( (STRUCT->m_Layer != LAYER_BUS)
|
||||
&& (STRUCT->m_Layer != LAYER_WIRE) )
|
||||
break;
|
||||
|
||||
ObjNet[NbrItem].m_Comp = STRUCT;
|
||||
|
@ -369,6 +391,7 @@ int NumInclude;
|
|||
ObjNet[NbrItem].m_SheetNumber = NumSheet;
|
||||
ObjNet[NbrItem].m_Start = STRUCT->m_Start;
|
||||
ObjNet[NbrItem].m_End = STRUCT->m_End;
|
||||
|
||||
if( STRUCT->m_Layer == LAYER_BUS )
|
||||
{
|
||||
ObjNet[NbrItem].m_Type = NET_BUS;
|
||||
|
@ -420,14 +443,18 @@ int NumInclude;
|
|||
ObjNet[NbrItem].m_Comp = STRUCT;
|
||||
ObjNet[NbrItem].m_Screen = screen;
|
||||
ObjNet[NbrItem].m_Type = NET_LABEL;
|
||||
|
||||
if( STRUCT->m_Layer == LAYER_GLOBLABEL )
|
||||
ObjNet[NbrItem].m_Type = NET_GLOBLABEL;
|
||||
|
||||
ObjNet[NbrItem].m_Label = &STRUCT->m_Text;
|
||||
ObjNet[NbrItem].m_SheetNumber = NumSheet;
|
||||
ObjNet[NbrItem].m_Start = STRUCT->m_Pos;
|
||||
ObjNet[NbrItem].m_End = ObjNet[NbrItem].m_Start;
|
||||
|
||||
/* Si c'est un Bus, eclatement en Label */
|
||||
if ( ii ) ConvertBusToMembers(ObjNet + NbrItem);
|
||||
if( ii )
|
||||
ConvertBusToMembers( ObjNet + NbrItem );
|
||||
}
|
||||
NbrItem += ii + 1;
|
||||
break;
|
||||
|
@ -441,38 +468,57 @@ int NumInclude;
|
|||
ObjNet[NbrItem].m_Comp = STRUCT;
|
||||
ObjNet[NbrItem].m_Screen = screen;
|
||||
ObjNet[NbrItem].m_Type = NET_LABEL;
|
||||
|
||||
if( STRUCT->m_Layer == LAYER_GLOBLABEL )
|
||||
ObjNet[NbrItem].m_Type = NET_GLOBLABEL;
|
||||
|
||||
ObjNet[NbrItem].m_Label = &STRUCT->m_Text;
|
||||
ObjNet[NbrItem].m_SheetNumber = NumSheet;
|
||||
ObjNet[NbrItem].m_Start = STRUCT->m_Pos;
|
||||
ObjNet[NbrItem].m_End = ObjNet[NbrItem].m_Start;
|
||||
|
||||
/* Si c'est un Bus, eclatement en Label */
|
||||
if ( ii ) ConvertBusToMembers(ObjNet + NbrItem);
|
||||
if( ii )
|
||||
ConvertBusToMembers( ObjNet + NbrItem );
|
||||
}
|
||||
NbrItem += ii + 1;
|
||||
break;
|
||||
|
||||
case DRAW_LIB_ITEM_STRUCT_TYPE:
|
||||
DrawLibItem = (EDA_SchComponentStruct*) DrawList;
|
||||
|
||||
memcpy( TransMat, DrawLibItem->m_Transform, sizeof(TransMat) );
|
||||
PartX = DrawLibItem->m_Pos.x; PartY = DrawLibItem->m_Pos.y;
|
||||
|
||||
PartX = DrawLibItem->m_Pos.x;
|
||||
PartY = DrawLibItem->m_Pos.y;
|
||||
|
||||
Entry = FindLibPart( DrawLibItem->m_ChipName, wxEmptyString, FIND_ROOT );
|
||||
|
||||
if( Entry == NULL) break;
|
||||
if(Entry->m_Drawings == NULL) break ;
|
||||
if( Entry == NULL )
|
||||
break;
|
||||
|
||||
if( Entry->m_Drawings == NULL )
|
||||
break;
|
||||
|
||||
DEntry = Entry->m_Drawings;
|
||||
|
||||
for( ; DEntry != NULL; DEntry = DEntry->Next() )
|
||||
{
|
||||
LibDrawPin* Pin = (LibDrawPin*) DEntry;
|
||||
if( DEntry->Type() != COMPONENT_PIN_DRAW_TYPE) continue;
|
||||
if( DEntry->m_Unit &&
|
||||
(DEntry->m_Unit != DrawLibItem->m_Multi) ) continue;
|
||||
if( DEntry->m_Convert &&
|
||||
(DEntry->m_Convert != DrawLibItem->m_Convert)) continue;
|
||||
if( DEntry->Type() != COMPONENT_PIN_DRAW_TYPE )
|
||||
continue;
|
||||
|
||||
if( DEntry->m_Unit
|
||||
&& (DEntry->m_Unit != DrawLibItem->m_Multi) )
|
||||
continue;
|
||||
|
||||
if( DEntry->m_Convert
|
||||
&& (DEntry->m_Convert != DrawLibItem->m_Convert) )
|
||||
continue;
|
||||
|
||||
x2 = PartX + TransMat[0][0] * Pin->m_Pos.x
|
||||
+ TransMat[0][1] * Pin->m_Pos.y;
|
||||
|
||||
y2 = PartY + TransMat[1][0] * Pin->m_Pos.x
|
||||
+ TransMat[1][1] * Pin->m_Pos.y;
|
||||
|
||||
|
@ -492,9 +538,10 @@ int NumInclude;
|
|||
}
|
||||
NbrItem++;
|
||||
|
||||
if( ( (int) Pin->m_PinType == (int) PIN_POWER_IN ) &&
|
||||
( Pin->m_Attributs & PINNOTDRAW ) )
|
||||
{ /* Il y a un PIN_LABEL Associe */
|
||||
if( ( (int) Pin->m_PinType == (int) PIN_POWER_IN )
|
||||
&& ( Pin->m_Attributs & PINNOTDRAW ) )
|
||||
{
|
||||
/* Il y a un PIN_LABEL Associe */
|
||||
if( ObjNet )
|
||||
{
|
||||
ObjNet[NbrItem].m_Comp = NULL;
|
||||
|
@ -509,6 +556,7 @@ int NumInclude;
|
|||
NbrItem++;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case DRAW_PICK_ITEM_STRUCT_TYPE:
|
||||
|
@ -540,11 +588,14 @@ int NumInclude;
|
|||
ObjNet[NbrItem].m_NumInclude = NumInclude;
|
||||
ObjNet[NbrItem].m_Start = SheetLabel->m_Pos;
|
||||
ObjNet[NbrItem].m_End = ObjNet[NbrItem].m_Start;
|
||||
|
||||
/* Si c'est un Bus, eclatement en Label */
|
||||
if ( ii ) ConvertBusToMembers(ObjNet + NbrItem);
|
||||
if( ii )
|
||||
ConvertBusToMembers( ObjNet + NbrItem );
|
||||
}
|
||||
NbrItem += ii + 1;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case DRAW_SHEETLABEL_STRUCT_TYPE:
|
||||
|
@ -560,22 +611,21 @@ int NumInclude;
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
DrawList = DrawList->Pnext;
|
||||
}
|
||||
|
||||
return(NbrItem);
|
||||
return NbrItem;
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
static void ConnectBusLabels( ObjetNetListStruct* Label, int NbItems )
|
||||
/************************************************************************/
|
||||
|
||||
/* Routine qui analyse les labels type xxBUSLABELMEMBER
|
||||
Propage les Netcodes entre labels correspondants ( c'est a dire lorsque
|
||||
leur numero de membre est identique) lorsqu'ils sont connectes
|
||||
globalement par leur BusNetCode
|
||||
Utilise et met a jour la variable LastNetCode
|
||||
* Propage les Netcodes entre labels correspondants ( c'est a dire lorsque
|
||||
* leur numero de membre est identique) lorsqu'ils sont connectes
|
||||
* globalement par leur BusNetCode
|
||||
* Utilise et met a jour la variable LastNetCode
|
||||
*/
|
||||
{
|
||||
ObjetNetListStruct* LabelInTst, * Lim;
|
||||
|
@ -584,22 +634,28 @@ ObjetNetListStruct *LabelInTst, *Lim;
|
|||
|
||||
for( ; Label < Lim; Label++ )
|
||||
{
|
||||
if( (Label->m_Type == NET_SHEETBUSLABELMEMBER) ||
|
||||
(Label->m_Type == NET_BUSLABELMEMBER) ||
|
||||
(Label->m_Type == NET_GLOBBUSLABELMEMBER) )
|
||||
if( (Label->m_Type == NET_SHEETBUSLABELMEMBER)
|
||||
|| (Label->m_Type == NET_BUSLABELMEMBER)
|
||||
|| (Label->m_Type == NET_GLOBBUSLABELMEMBER) )
|
||||
{
|
||||
if( Label->m_NetCode == 0 )
|
||||
{
|
||||
Label->m_NetCode = LastNetCode; LastNetCode++;
|
||||
Label->m_NetCode = LastNetCode;
|
||||
LastNetCode++;
|
||||
}
|
||||
|
||||
for( LabelInTst = Label + 1; LabelInTst < Lim; LabelInTst++ )
|
||||
{
|
||||
if( (LabelInTst->m_Type == NET_SHEETBUSLABELMEMBER) ||
|
||||
(LabelInTst->m_Type == NET_BUSLABELMEMBER) ||
|
||||
(LabelInTst->m_Type == NET_GLOBBUSLABELMEMBER) )
|
||||
if( (LabelInTst->m_Type == NET_SHEETBUSLABELMEMBER)
|
||||
|| (LabelInTst->m_Type == NET_BUSLABELMEMBER)
|
||||
|| (LabelInTst->m_Type == NET_GLOBBUSLABELMEMBER) )
|
||||
{
|
||||
if( LabelInTst->m_BusNetCode != Label->m_BusNetCode ) continue;
|
||||
if( LabelInTst->m_Member != Label->m_Member ) continue;
|
||||
if( LabelInTst->m_BusNetCode != Label->m_BusNetCode )
|
||||
continue;
|
||||
|
||||
if( LabelInTst->m_Member != Label->m_Member )
|
||||
continue;
|
||||
|
||||
if( LabelInTst->m_NetCode == 0 )
|
||||
LabelInTst->m_NetCode = Label->m_NetCode;
|
||||
else
|
||||
|
@ -616,9 +672,9 @@ int IsBusLabel( const wxString & LabelDrawList )
|
|||
/**************************************************/
|
||||
|
||||
/* Routine qui verifie si le Label a une notation de type Bus
|
||||
Retourne 0 si non
|
||||
nombre de membres si oui
|
||||
met a jour FirstNumWireBus, LastNumWireBus et RootBusNameLength
|
||||
* Retourne 0 si non
|
||||
* nombre de membres si oui
|
||||
* met a jour FirstNumWireBus, LastNumWireBus et RootBusNameLength
|
||||
*/
|
||||
|
||||
{
|
||||
|
@ -630,7 +686,9 @@ bool error = FALSE;
|
|||
|
||||
/* Search for '[' because a bus label is like "busname[nn..mm]" */
|
||||
ii = LabelDrawList.Find( '[' );
|
||||
if ( ii < 0 ) return(0);
|
||||
if( ii < 0 )
|
||||
return 0;
|
||||
|
||||
Num = (unsigned) ii;
|
||||
|
||||
FirstNumWireBus = LastNumWireBus = 9;
|
||||
|
@ -642,21 +700,28 @@ bool error = FALSE;
|
|||
Num++;
|
||||
}
|
||||
|
||||
if ( ! BufLine.ToLong(&tmp) ) error = TRUE;;
|
||||
if( !BufLine.ToLong( &tmp ) )
|
||||
error = TRUE;
|
||||
|
||||
FirstNumWireBus = tmp;
|
||||
while( LabelDrawList[Num] == '.' && Num < LabelDrawList.Len() )
|
||||
Num++;
|
||||
|
||||
BufLine.Empty();
|
||||
while( LabelDrawList[Num] != ']' && Num < LabelDrawList.Len() )
|
||||
{
|
||||
BufLine.Append( LabelDrawList[Num] );
|
||||
Num++;
|
||||
}
|
||||
if ( ! BufLine.ToLong(&tmp) ) error = TRUE;;
|
||||
|
||||
if( !BufLine.ToLong( &tmp ) )
|
||||
error = TRUE;;
|
||||
LastNumWireBus = tmp;
|
||||
|
||||
if( FirstNumWireBus < 0 ) FirstNumWireBus = 0;
|
||||
if( LastNumWireBus < 0 ) LastNumWireBus = 0;
|
||||
if( FirstNumWireBus < 0 )
|
||||
FirstNumWireBus = 0;
|
||||
if( LastNumWireBus < 0 )
|
||||
LastNumWireBus = 0;
|
||||
if( FirstNumWireBus > LastNumWireBus )
|
||||
{
|
||||
EXCHG( FirstNumWireBus, LastNumWireBus );
|
||||
|
@ -667,22 +732,23 @@ bool error = FALSE;
|
|||
wxString msg = _( "Bad Bus Label: " ) + LabelDrawList;
|
||||
DisplayError( NULL, msg );
|
||||
}
|
||||
return(LastNumWireBus - FirstNumWireBus + 1 );
|
||||
return LastNumWireBus - FirstNumWireBus + 1;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
static int ConvertBusToMembers( ObjetNetListStruct* BusLabel )
|
||||
/***************************************************************/
|
||||
|
||||
/* Routine qui eclate un label type Bus en autant de Label qu'il contient de membres,
|
||||
et qui cree les structures avec le type NET_GLOBBUSLABELMEMBER, NET_BUSLABELMEMBER
|
||||
ou NET_SHEETBUSLABELMEMBER
|
||||
entree = pointeur sur l'ObjetNetListStruct initialise corresp au buslabel
|
||||
suppose que FirstNumWireBus, LastNumWireBus et RootBusNameLength sont a jour
|
||||
modifie l'ObjetNetListStruct de base et remplit les suivants
|
||||
m_Label is a pointer to a new wxString
|
||||
m_Label must be deallocated by the user (only for a NET_GLOBBUSLABELMEMBER,
|
||||
NET_BUSLABELMEMBER or a NET_SHEETBUSLABELMEMBER object type)
|
||||
* et qui cree les structures avec le type NET_GLOBBUSLABELMEMBER, NET_BUSLABELMEMBER
|
||||
* ou NET_SHEETBUSLABELMEMBER
|
||||
* entree = pointeur sur l'ObjetNetListStruct initialise corresp au buslabel
|
||||
* suppose que FirstNumWireBus, LastNumWireBus et RootBusNameLength sont a jour
|
||||
* modifie l'ObjetNetListStruct de base et remplit les suivants
|
||||
* m_Label is a pointer to a new wxString
|
||||
* m_Label must be deallocated by the user (only for a NET_GLOBBUSLABELMEMBER,
|
||||
* NET_BUSLABELMEMBER or a NET_SHEETBUSLABELMEMBER object type)
|
||||
*/
|
||||
{
|
||||
int NumItem, BusMember;
|
||||
|
@ -692,42 +758,50 @@ wxString BufLine;
|
|||
BusLabel->m_Type = NET_GLOBBUSLABELMEMBER;
|
||||
else if( BusLabel->m_Type == NET_SHEETLABEL )
|
||||
BusLabel->m_Type = NET_SHEETBUSLABELMEMBER;
|
||||
else BusLabel->m_Type = NET_BUSLABELMEMBER;
|
||||
else
|
||||
BusLabel->m_Type = NET_BUSLABELMEMBER;
|
||||
|
||||
/* Convertion du BusLabel en la racine du Label + le numero du fil */
|
||||
BufLine = BusLabel->m_Label->Left( RootBusNameLength );
|
||||
BusMember = FirstNumWireBus;
|
||||
BufLine << BusMember;
|
||||
BusLabel->m_Label = new wxString( BufLine );
|
||||
|
||||
BusLabel->m_Member = BusMember;
|
||||
NumItem = 1;
|
||||
|
||||
for( BusMember++; BusMember <= LastNumWireBus; BusMember++ )
|
||||
{
|
||||
*(BusLabel + 1) = *BusLabel; BusLabel++; NumItem++;
|
||||
|
||||
/* Convertion du BusLabel en la racine du Label + le numero du fil */
|
||||
BufLine = BusLabel->m_Label->Left( RootBusNameLength );
|
||||
BufLine << BusMember;
|
||||
BusLabel->m_Label = new wxString( BufLine );
|
||||
|
||||
BusLabel->m_Member = BusMember;
|
||||
}
|
||||
return( NumItem);
|
||||
|
||||
return NumItem;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus )
|
||||
/**********************************************************************/
|
||||
|
||||
/* PropageNetCode propage le netcode NewNetCode sur tous les elements
|
||||
appartenant a l'ancien netcode OldNetCode
|
||||
Si IsBus == 0; c'est le membre NetCode qui est propage
|
||||
Si IsBus != 0; c'est le membre BusNetCode qui est propage
|
||||
* appartenant a l'ancien netcode OldNetCode
|
||||
* Si IsBus == 0; c'est le membre NetCode qui est propage
|
||||
* Si IsBus != 0; c'est le membre BusNetCode qui est propage
|
||||
*/
|
||||
|
||||
{
|
||||
int jj;
|
||||
ObjetNetListStruct* Objet = g_TabObjNet;
|
||||
|
||||
if( OldNetCode == NewNetCode ) return;
|
||||
if( OldNetCode == NewNetCode )
|
||||
return;
|
||||
|
||||
if( IsBus == 0 ) /* Propagation du NetCode */
|
||||
{
|
||||
|
@ -739,7 +813,6 @@ ObjetNetListStruct * Objet = g_TabObjNet;
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
else /* Propagation du BusNetCode */
|
||||
{
|
||||
for( jj = 0; jj < g_NbrObjNet; jj++, Objet++ )
|
||||
|
@ -752,26 +825,28 @@ ObjetNetListStruct * Objet = g_TabObjNet;
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus, int start )
|
||||
/***************************************************************************/
|
||||
|
||||
/* Routine qui verifie si l'element *Ref est connecte a
|
||||
d'autres elements de la liste des objets du schema, selon le mode Point
|
||||
a point ( Extremites superposees )
|
||||
|
||||
si IsBus:
|
||||
la connexion ne met en jeu que des elements type bus
|
||||
( BUS ou BUSLABEL ou JONCTION )
|
||||
sinon
|
||||
la connexion ne met en jeu que des elements type non bus
|
||||
( autres que BUS ou BUSLABEL )
|
||||
|
||||
L'objet Ref doit avoir un NetCode valide.
|
||||
|
||||
La liste des objets est supposee classe par NumSheet Croissants,
|
||||
et la recherche se fait a partir de l'element start, 1er element
|
||||
de la feuille de schema
|
||||
( il ne peut y avoir connexion physique entre elements de differentes sheets)
|
||||
* d'autres elements de la liste des objets du schema, selon le mode Point
|
||||
* a point ( Extremites superposees )
|
||||
*
|
||||
* si IsBus:
|
||||
* la connexion ne met en jeu que des elements type bus
|
||||
* ( BUS ou BUSLABEL ou JONCTION )
|
||||
* sinon
|
||||
* la connexion ne met en jeu que des elements type non bus
|
||||
* ( autres que BUS ou BUSLABEL )
|
||||
*
|
||||
* L'objet Ref doit avoir un NetCode valide.
|
||||
*
|
||||
* La liste des objets est supposee classe par NumSheet Croissants,
|
||||
* et la recherche se fait a partir de l'element start, 1er element
|
||||
* de la feuille de schema
|
||||
* ( il ne peut y avoir connexion physique entre elements de differentes sheets)
|
||||
*/
|
||||
{
|
||||
int i, NetCode;
|
||||
|
@ -782,7 +857,8 @@ if ( IsBus == 0 ) /* Objets autres que BUS et BUSLABELS */
|
|||
NetCode = Ref->m_NetCode;
|
||||
for( i = start; i < g_NbrObjNet; i++ )
|
||||
{
|
||||
if( Point[i].m_SheetNumber > Ref->m_SheetNumber ) break;
|
||||
if( Point[i].m_SheetNumber > Ref->m_SheetNumber )
|
||||
break;
|
||||
|
||||
switch( Point[i].m_Type )
|
||||
{
|
||||
|
@ -794,15 +870,21 @@ if ( IsBus == 0 ) /* Objets autres que BUS et BUSLABELS */
|
|||
case NET_PINLABEL:
|
||||
case NET_JONCTION:
|
||||
case NET_NOCONNECT:
|
||||
if( (((Ref->m_Start.x == Point[i].m_Start.x) && (Ref->m_Start.y == Point[i].m_Start.y))) ||
|
||||
(((Ref->m_Start.x == Point[i].m_End.x) && (Ref->m_Start.y == Point[i].m_End.y))) ||
|
||||
(((Ref->m_End.x == Point[i].m_Start.x) && (Ref->m_End.y == Point[i].m_Start.y))) ||
|
||||
(((Ref->m_End.x == Point[i].m_End.x) && (Ref->m_End.y == Point[i].m_End.y))) )
|
||||
if( ( ( (Ref->m_Start.x == Point[i].m_Start.x) &&
|
||||
(Ref->m_Start.y == Point[i].m_Start.y) ) )
|
||||
|| ( ( (Ref->m_Start.x == Point[i].m_End.x) &&
|
||||
(Ref->m_Start.y == Point[i].m_End.y) ) )
|
||||
|| ( ( (Ref->m_End.x == Point[i].m_Start.x) &&
|
||||
(Ref->m_End.y == Point[i].m_Start.y) ) )
|
||||
|| ( ( (Ref->m_End.x == Point[i].m_End.x) && (Ref->m_End.y == Point[i].m_End.y) ) ) )
|
||||
{
|
||||
if( Point[i].m_NetCode == 0 ) Point[i].m_NetCode = NetCode;
|
||||
else PropageNetCode( Point[i].m_NetCode, NetCode , 0);
|
||||
if( Point[i].m_NetCode == 0 )
|
||||
Point[i].m_NetCode = NetCode;
|
||||
else
|
||||
PropageNetCode( Point[i].m_NetCode, NetCode, 0 );
|
||||
}
|
||||
break;
|
||||
|
||||
case NET_BUS:
|
||||
case NET_BUSLABELMEMBER:
|
||||
case NET_SHEETBUSLABELMEMBER:
|
||||
|
@ -816,7 +898,8 @@ else /* Objets type BUS et BUSLABELS ( et JONCTIONS )*/
|
|||
NetCode = Ref->m_BusNetCode;
|
||||
for( i = start; i < g_NbrObjNet; i++ )
|
||||
{
|
||||
if( Point[i].m_SheetNumber > Ref->m_SheetNumber ) break;
|
||||
if( Point[i].m_SheetNumber > Ref->m_SheetNumber )
|
||||
break;
|
||||
|
||||
switch( Point[i].m_Type )
|
||||
{
|
||||
|
@ -834,14 +917,18 @@ else /* Objets type BUS et BUSLABELS ( et JONCTIONS )*/
|
|||
case NET_SHEETBUSLABELMEMBER:
|
||||
case NET_GLOBBUSLABELMEMBER:
|
||||
case NET_JONCTION:
|
||||
if( (((Ref->m_Start.x == Point[i].m_Start.x) && (Ref->m_Start.y == Point[i].m_Start.y))) ||
|
||||
(((Ref->m_Start.x == Point[i].m_End.x) && (Ref->m_Start.y == Point[i].m_End.y))) ||
|
||||
(((Ref->m_End.x == Point[i].m_Start.x) && (Ref->m_End.y == Point[i].m_Start.y))) ||
|
||||
(((Ref->m_End.x == Point[i].m_End.x) && (Ref->m_End.y == Point[i].m_End.y))) )
|
||||
if( ( ( (Ref->m_Start.x == Point[i].m_Start.x) &&
|
||||
(Ref->m_Start.y == Point[i].m_Start.y) ) )
|
||||
|| ( ( (Ref->m_Start.x == Point[i].m_End.x) &&
|
||||
(Ref->m_Start.y == Point[i].m_End.y) ) )
|
||||
|| ( ( (Ref->m_End.x == Point[i].m_Start.x) &&
|
||||
(Ref->m_End.y == Point[i].m_Start.y) ) )
|
||||
|| ( ( (Ref->m_End.x == Point[i].m_End.x) && (Ref->m_End.y == Point[i].m_End.y) ) ) )
|
||||
{
|
||||
if( Point[i].m_BusNetCode == 0 )
|
||||
Point[i].m_BusNetCode = NetCode;
|
||||
else PropageNetCode( Point[i].m_BusNetCode, NetCode,1 );
|
||||
else
|
||||
PropageNetCode( Point[i].m_BusNetCode, NetCode, 1 );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -854,14 +941,15 @@ else /* Objets type BUS et BUSLABELS ( et JONCTIONS )*/
|
|||
static void SegmentToPointConnect( ObjetNetListStruct* Jonction,
|
||||
int IsBus, int start )
|
||||
/***************************************************************/
|
||||
|
||||
/*
|
||||
Routine qui recherche si un point (jonction) est connecte a des segments,
|
||||
et regroupe les NetCodes des objets connectes a la jonction.
|
||||
Le point de jonction doit avoir un netcode valide
|
||||
La liste des objets est supposee classe par NumSheet Croissants,
|
||||
et la recherche se fait a partir de l'element start, 1er element
|
||||
de la feuille de schema
|
||||
( il ne peut y avoir connexion physique entre elements de differentes sheets)
|
||||
* Routine qui recherche si un point (jonction) est connecte a des segments,
|
||||
* et regroupe les NetCodes des objets connectes a la jonction.
|
||||
* Le point de jonction doit avoir un netcode valide
|
||||
* La liste des objets est supposee classe par NumSheet Croissants,
|
||||
* et la recherche se fait a partir de l'element start, 1er element
|
||||
* de la feuille de schema
|
||||
* ( il ne peut y avoir connexion physique entre elements de differentes sheets)
|
||||
*/
|
||||
{
|
||||
int i;
|
||||
|
@ -869,15 +957,18 @@ ObjetNetListStruct *Segment = g_TabObjNet;
|
|||
|
||||
for( i = start; i < g_NbrObjNet; i++ )
|
||||
{
|
||||
if( Segment[i].m_SheetNumber > Jonction->m_SheetNumber ) break;
|
||||
if( Segment[i].m_SheetNumber > Jonction->m_SheetNumber )
|
||||
break;
|
||||
|
||||
if( IsBus == 0 )
|
||||
{
|
||||
if ( Segment[i].m_Type != NET_SEGMENT ) continue;
|
||||
if( Segment[i].m_Type != NET_SEGMENT )
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( Segment[i].m_Type != NET_BUS ) continue;
|
||||
if( Segment[i].m_Type != NET_BUS )
|
||||
continue;
|
||||
}
|
||||
|
||||
if( SegmentIntersect( Segment[i].m_Start.x, Segment[i].m_Start.y,
|
||||
|
@ -890,19 +981,22 @@ ObjetNetListStruct *Segment = g_TabObjNet;
|
|||
if( Segment[i].m_NetCode )
|
||||
PropageNetCode( Segment[i].m_NetCode,
|
||||
Jonction->m_NetCode, IsBus );
|
||||
else Segment[i].m_NetCode = Jonction->m_NetCode;
|
||||
else
|
||||
Segment[i].m_NetCode = Jonction->m_NetCode;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( Segment[i].m_BusNetCode )
|
||||
PropageNetCode( Segment[i].m_BusNetCode,
|
||||
Jonction->m_BusNetCode, IsBus );
|
||||
else Segment[i].m_BusNetCode = Jonction->m_BusNetCode;
|
||||
else
|
||||
Segment[i].m_BusNetCode = Jonction->m_BusNetCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************
|
||||
* Routine qui connecte les groupes d'objets si labels identiques *
|
||||
*******************************************************************/
|
||||
|
@ -911,66 +1005,80 @@ static void LabelConnection(ObjetNetListStruct *LabelRef)
|
|||
int i, NetCode;
|
||||
ObjetNetListStruct* ObjetNet;
|
||||
|
||||
if( LabelRef->m_NetCode == 0 ) return;
|
||||
if( LabelRef->m_NetCode == 0 )
|
||||
return;
|
||||
|
||||
ObjetNet = g_TabObjNet;
|
||||
|
||||
for( i = 0; i < g_NbrObjNet; i++ )
|
||||
{
|
||||
NetCode = ObjetNet[i].m_NetCode;
|
||||
if( NetCode == LabelRef->m_NetCode ) continue;
|
||||
if( NetCode == LabelRef->m_NetCode )
|
||||
continue;
|
||||
|
||||
if( ObjetNet[i].m_SheetNumber != LabelRef->m_SheetNumber )
|
||||
{
|
||||
if (ObjetNet[i].m_Type != NET_PINLABEL ) continue;
|
||||
if( ObjetNet[i].m_Type != NET_PINLABEL )
|
||||
continue;
|
||||
}
|
||||
|
||||
if( (ObjetNet[i].m_Type == NET_LABEL ) ||
|
||||
(ObjetNet[i].m_Type == NET_GLOBLABEL ) ||
|
||||
(ObjetNet[i].m_Type == NET_BUSLABELMEMBER ) ||
|
||||
(ObjetNet[i].m_Type == NET_GLOBBUSLABELMEMBER ) ||
|
||||
(ObjetNet[i].m_Type == NET_PINLABEL ) )
|
||||
if( (ObjetNet[i].m_Type == NET_LABEL )
|
||||
|| (ObjetNet[i].m_Type == NET_GLOBLABEL )
|
||||
|| (ObjetNet[i].m_Type == NET_BUSLABELMEMBER )
|
||||
|| (ObjetNet[i].m_Type == NET_GLOBBUSLABELMEMBER )
|
||||
|| (ObjetNet[i].m_Type == NET_PINLABEL ) )
|
||||
{
|
||||
if( ObjetNet[i].m_Label->CmpNoCase(*LabelRef->m_Label) != 0) continue;
|
||||
if( ObjetNet[i].m_Label->CmpNoCase( *LabelRef->m_Label ) != 0 )
|
||||
continue;
|
||||
|
||||
/* Ici 2 labels identiques */
|
||||
|
||||
/* Propagation du Netcode a tous les Objets de meme NetCode */
|
||||
if( ObjetNet[i].m_NetCode )
|
||||
PropageNetCode( ObjetNet[i].m_NetCode, LabelRef->m_NetCode, 0 );
|
||||
else ObjetNet[i].m_NetCode = LabelRef->m_NetCode;
|
||||
else
|
||||
ObjetNet[i].m_NetCode = LabelRef->m_NetCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
static int TriNetCode(ObjetNetListStruct *Objet1, ObjetNetListStruct *Objet2)
|
||||
static int TriNetCode( const void* o1, const void* o2 )
|
||||
/****************************************************************************/
|
||||
|
||||
/* Routine de comparaison pour le tri par NetCode croissant
|
||||
du tableau des elements connectes ( TabPinSort ) par qsort()
|
||||
* du tableau des elements connectes ( TabPinSort ) par qsort()
|
||||
*/
|
||||
{
|
||||
return (Objet1->m_NetCode - Objet2->m_NetCode);
|
||||
ObjetNetListStruct* Objet1 = (ObjetNetListStruct*) o1;
|
||||
ObjetNetListStruct* Objet2 = (ObjetNetListStruct*) o2;
|
||||
|
||||
return Objet1->m_NetCode - Objet2->m_NetCode;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
static int TriBySheet(ObjetNetListStruct *Objet1, ObjetNetListStruct *Objet2)
|
||||
static int TriBySheet( const void* o1, const void* o2 )
|
||||
/*****************************************************************************/
|
||||
|
||||
/* Routine de comparaison pour le tri par NumSheet
|
||||
du tableau des elements connectes ( TabPinSort ) par qsort() */
|
||||
* du tableau des elements connectes ( TabPinSort ) par qsort() */
|
||||
|
||||
{
|
||||
return (Objet1->m_SheetNumber - Objet2->m_SheetNumber);
|
||||
ObjetNetListStruct* Objet1 = (ObjetNetListStruct*) o1;
|
||||
ObjetNetListStruct* Objet2 = (ObjetNetListStruct*) o2;
|
||||
|
||||
return Objet1->m_SheetNumber - Objet2->m_SheetNumber;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
static void SetUnconnectedFlag( ObjetNetListStruct* ListObj, int NbItems )
|
||||
/**********************************************************************/
|
||||
|
||||
/* Routine positionnant le membre .FlagNoConnect des elements de
|
||||
la liste des objets netliste, tries par ordre de NetCode
|
||||
* la liste des objets netliste, tries par ordre de NetCode
|
||||
*/
|
||||
{
|
||||
ObjetNetListStruct* NetItemRef, * NetItemTst, * ItemPtr;
|
||||
|
@ -980,28 +1088,33 @@ IsConnectType StateFlag;
|
|||
|
||||
|
||||
NetStart = NetEnd = ListObj;
|
||||
Lim = ListObj + NbItems;
|
||||
NetItemRef = NetStart;
|
||||
Nb = 0; StateFlag = UNCONNECT;
|
||||
Nb = 0;
|
||||
StateFlag = UNCONNECT;
|
||||
|
||||
Lim = ListObj + NbItems;
|
||||
for( ; NetItemRef < Lim; NetItemRef++ )
|
||||
{
|
||||
if( NetItemRef->m_Type == NET_NOCONNECT )
|
||||
if( StateFlag != CONNECT ) StateFlag = NOCONNECT;
|
||||
if( StateFlag != CONNECT )
|
||||
StateFlag = NOCONNECT;
|
||||
|
||||
/* Analyse du net en cours */
|
||||
NetItemTst = NetItemRef + 1;
|
||||
|
||||
if( (NetItemTst >= Lim) ||
|
||||
(NetItemRef->m_NetCode != NetItemTst->m_NetCode) )
|
||||
{ /* Net analyse: mise a jour de m_FlagOfConnection */
|
||||
if( (NetItemTst >= Lim)
|
||||
|| (NetItemRef->m_NetCode != NetItemTst->m_NetCode) )
|
||||
{
|
||||
/* Net analyse: mise a jour de m_FlagOfConnection */
|
||||
NetEnd = NetItemTst;
|
||||
|
||||
for( ItemPtr = NetStart; ItemPtr < NetEnd; ItemPtr++ )
|
||||
{
|
||||
ItemPtr->m_FlagOfConnection = StateFlag;
|
||||
}
|
||||
if(NetItemTst >= Lim) return;
|
||||
|
||||
if( NetItemTst >= Lim )
|
||||
return;
|
||||
|
||||
/* Start Analyse Nouveau Net */
|
||||
StateFlag = UNCONNECT;
|
||||
|
@ -1011,8 +1124,8 @@ IsConnectType StateFlag;
|
|||
|
||||
for( ; ; NetItemTst++ )
|
||||
{
|
||||
if( (NetItemTst >= Lim) ||
|
||||
(NetItemRef->m_NetCode != NetItemTst->m_NetCode) )
|
||||
if( (NetItemTst >= Lim)
|
||||
|| (NetItemRef->m_NetCode != NetItemTst->m_NetCode) )
|
||||
break;
|
||||
|
||||
switch( NetItemTst->m_Type )
|
||||
|
@ -1035,10 +1148,10 @@ IsConnectType StateFlag;
|
|||
break;
|
||||
|
||||
case NET_NOCONNECT:
|
||||
if( StateFlag != CONNECT ) StateFlag = NOCONNECT;
|
||||
if( StateFlag != CONNECT )
|
||||
StateFlag = NOCONNECT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,8 +15,7 @@
|
|||
|
||||
|
||||
/* Indicateurs de type de netliste generee */
|
||||
typedef enum
|
||||
{
|
||||
typedef enum {
|
||||
NET_TYPE_NOT_INIT = 0,
|
||||
NET_TYPE_PCBNEW,
|
||||
NET_TYPE_ORCADPCB2,
|
||||
|
@ -58,13 +57,14 @@ typedef enum { /* Valeur du Flag de connection */
|
|||
CONNECT /* connexion normale */
|
||||
} IsConnectType;
|
||||
|
||||
|
||||
/* Structure decrivant 1 element de connexion (pour netlist ) */
|
||||
class ObjetNetListStruct
|
||||
{
|
||||
public:
|
||||
void* m_Comp; /* Pointeur sur la definition de l'objet */
|
||||
void* m_Link; /* Pour SheetLabelStruct: Pointeur sur la feuille de hierarchie
|
||||
Pour les Pins: pointeur sur le composant */
|
||||
* Pour les Pins: pointeur sur le composant */
|
||||
int m_Flag; /* flag pour calculs internes */
|
||||
SCH_SCREEN* m_Screen; /* Ecran d'appartenance */
|
||||
NetObjetType m_Type;
|
||||
|
@ -72,7 +72,7 @@ public:
|
|||
int m_NetCode; /* pour elements simples */
|
||||
int m_BusNetCode; /* pour connexions type bus */
|
||||
int m_Member; /* pour les labels type BUSWIRE ( labels de bus eclate )
|
||||
numero de membre */
|
||||
* numero de membre */
|
||||
IsConnectType m_FlagOfConnection;
|
||||
int m_SheetNumber; /* Sheet number for this item */
|
||||
int m_NumInclude; /* Numero de sous schema correpondant a la sheet (Gestion des GLabels et Pin Sheet)*/
|
||||
|
@ -81,6 +81,7 @@ public:
|
|||
wxPoint m_Start, m_End;
|
||||
};
|
||||
|
||||
|
||||
/* Structure decrivant 1 composant de la schematique (pour annotation ) */
|
||||
struct CmpListStruct
|
||||
{
|
||||
|
|
|
@ -75,9 +75,10 @@ public:
|
|||
public:
|
||||
EDA_DrawLineStruct( const wxPoint& pos, int layer );
|
||||
~EDA_DrawLineStruct() { }
|
||||
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT( "EDA_DrawLineStruct" );
|
||||
return wxT( "EDA_DrawLine" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -92,6 +93,17 @@ public:
|
|||
|
||||
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
|
||||
int Color = -1 );
|
||||
|
||||
#if defined(DEBUG)
|
||||
/**
|
||||
* Function Show
|
||||
* is used to output the object tree, currently for debugging only.
|
||||
* @param nestLevel An aid to prettier tree indenting, and is the level
|
||||
* of nesting of this object within the overall tree.
|
||||
* @param os The ostream& to output to.
|
||||
*/
|
||||
void Show( int nestLevel, std::ostream& os );
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
@ -108,7 +120,7 @@ public:
|
|||
~DrawMarkerStruct();
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT( "DrawMarkerStruct" );
|
||||
return wxT( "DrawMarker" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -116,6 +128,16 @@ public:
|
|||
wxString GetComment();
|
||||
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
||||
int draw_mode, int Color = -1 );
|
||||
#if defined(DEBUG)
|
||||
/**
|
||||
* Function Show
|
||||
* is used to output the object tree, currently for debugging only.
|
||||
* @param nestLevel An aid to prettier tree indenting, and is the level
|
||||
* of nesting of this object within the overall tree.
|
||||
* @param os The ostream& to output to.
|
||||
*/
|
||||
void Show( int nestLevel, std::ostream& os );
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
@ -129,7 +151,7 @@ public:
|
|||
~DrawNoConnectStruct() { }
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT( "DrawNoConnectStruct" );
|
||||
return wxT( "DrawNoConnect" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -154,9 +176,10 @@ public:
|
|||
public:
|
||||
DrawBusEntryStruct( const wxPoint& pos, int shape, int id );
|
||||
~DrawBusEntryStruct() { }
|
||||
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT( "DrawBusEntryStruct" );
|
||||
return wxT( "DrawBusEntry" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -177,9 +200,10 @@ public:
|
|||
public:
|
||||
DrawPolylineStruct( int layer );
|
||||
~DrawPolylineStruct();
|
||||
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT( "DrawPolylineStruct" );
|
||||
return wxT( "DrawPolyline" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -197,9 +221,10 @@ public:
|
|||
public:
|
||||
DrawJunctionStruct( const wxPoint& pos );
|
||||
~DrawJunctionStruct() { }
|
||||
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT( "DrawJunctionStruct" );
|
||||
return wxT( "DrawJunction" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -209,8 +234,7 @@ public:
|
|||
};
|
||||
|
||||
|
||||
class DrawTextStruct : public EDA_BaseStruct
|
||||
, public EDA_TextStruct
|
||||
class DrawTextStruct : public EDA_BaseStruct, public EDA_TextStruct
|
||||
{
|
||||
public:
|
||||
int m_Layer;
|
||||
|
@ -224,7 +248,7 @@ public:
|
|||
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT( "DrawTextStruct" );
|
||||
return wxT( "DrawText" );
|
||||
}
|
||||
|
||||
|
||||
|
@ -248,7 +272,7 @@ public:
|
|||
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT( "DrawLabelStruct" );
|
||||
return wxT( "DrawLabel" );
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -264,7 +288,7 @@ public:
|
|||
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT( "DrawGlobalLabelStruct" );
|
||||
return wxT( "DrawGlobalLabel" );
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ LibEDA_BaseStruct * LocatePin(const wxPoint & RefPos,
|
|||
int Unit, int Convert, EDA_SchComponentStruct * DrawItem = NULL);
|
||||
/* Routine de localisation d'une PIN de la PartLib pointee par Entry */
|
||||
|
||||
wxString ReturnDefaultFieldName(int FieldNumber);
|
||||
const wxString& ReturnDefaultFieldName( int aFieldNdx );
|
||||
|
||||
|
||||
/***************/
|
||||
|
|
|
@ -215,7 +215,7 @@ private:
|
|||
char m_FlagRefreshReq; /* indique que l'ecran doit redessine */
|
||||
char m_FlagModified; // indique modif du PCB,utilise pour eviter une sortie sans sauvegarde
|
||||
char m_FlagSave; // indique sauvegarde auto faite
|
||||
EDA_BaseStruct* m_CurrentItem; ///< Current selected object
|
||||
EDA_BaseStruct* m_CurrentItem; ///< Currently selected object
|
||||
|
||||
/* Valeurs du pas de grille et du zoom */
|
||||
public:
|
||||
|
@ -260,17 +260,12 @@ public:
|
|||
/**
|
||||
* Function SetCurItem
|
||||
* sets the currently selected object, m_CurrentItem.
|
||||
* This is intentionally not inlined so we can set breakpoints on the
|
||||
* activity easier in base_screen.cpp.
|
||||
* @param current Any object derived from EDA_BaseStruct
|
||||
*/
|
||||
void SetCurItem( EDA_BaseStruct* current )
|
||||
{
|
||||
m_CurrentItem = current;
|
||||
}
|
||||
|
||||
void SetCurItem( EDA_BaseStruct* current ) { m_CurrentItem = current; }
|
||||
EDA_BaseStruct* GetCurItem() const { return m_CurrentItem; }
|
||||
|
||||
|
||||
/* fonctions relatives au zoom */
|
||||
int GetZoom(); /* retourne le coeff de zoom */
|
||||
void SetZoom( int coeff ); /* ajuste le coeff de zoom a coeff */
|
||||
|
@ -313,6 +308,18 @@ public:
|
|||
{
|
||||
return wxT( "BASE_SCREEN" );
|
||||
}
|
||||
|
||||
#if defined(DEBUG)
|
||||
/**
|
||||
* Function Show
|
||||
* is used to output the object tree, currently for debugging only.
|
||||
* @param nestLevel An aid to prettier tree indenting, and is the level
|
||||
* of nesting of this object within the overall tree.
|
||||
* @param os The ostream& to output to.
|
||||
*/
|
||||
void Show( int nestLevel, std::ostream& os );
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -441,10 +441,10 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay()
|
|||
{
|
||||
wxMenu itemMenu;
|
||||
|
||||
int limit = MIN( MAX_ITEMS_IN_PICKER, m_Collector->GetCount() );
|
||||
|
||||
itemMenu.SetTitle( _("Selection Clarification") ); // does this work? not under Linux!
|
||||
|
||||
int limit = MIN( MAX_ITEMS_IN_PICKER, m_Collector->GetCount() );
|
||||
|
||||
for( int i=0; i<limit; ++i )
|
||||
{
|
||||
wxString text;
|
||||
|
|
|
@ -124,6 +124,7 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
|||
DrawPanel->CursorOff( &dc );
|
||||
DrawPanel->m_CanStartBlock = -1; // Avoid to start a block coomand when clicking on menu
|
||||
|
||||
|
||||
// If command in progress: Put the Cancel command (if needed) and End command
|
||||
if( m_ID_current_state )
|
||||
{
|
||||
|
@ -161,13 +162,11 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
|||
}
|
||||
|
||||
/* Select a proper item */
|
||||
if( (item == NULL) || (item->m_Flags == 0) )
|
||||
if( !item || !item->m_Flags )
|
||||
{
|
||||
item = PcbGeneralLocateAndDisplay();
|
||||
SetCurItem(item);
|
||||
}
|
||||
|
||||
item = GetCurItem();
|
||||
if( item )
|
||||
flags = item->m_Flags;
|
||||
else
|
||||
|
@ -183,10 +182,18 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
|||
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOPLACE )
|
||||
{
|
||||
aPopMenu->AppendSeparator();
|
||||
|
||||
if( !((MODULE*)item)->IsLocked() )
|
||||
{
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_AUTOPLACE_FIXE_MODULE, _( "Lock Module" ),
|
||||
Locked_xpm );
|
||||
}
|
||||
else
|
||||
{
|
||||
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_AUTOPLACE_FREE_MODULE, _( "Unlock Module" ),
|
||||
Unlocked_xpm );
|
||||
}
|
||||
|
||||
if( !flags )
|
||||
aPopMenu->Append( ID_POPUP_PCB_AUTOPLACE_CURRENT_MODULE,
|
||||
_( "Auto place Module" ) );
|
||||
|
|
Loading…
Reference in New Issue