Component library editor improvements, build fix, and bug fixes.
* Add offset and block hit testing to library component objects. * Improved search for library entries. * Fixed library component editor component removal and addition. * Library editor now uses wxUpdateUIEvents for updating all UI objects. * Added version check to cmake find boost macro. * Removed unused code in file libalias.cpp. * Added method to WinEDA_DrawPanel to take mouse out of managed mode.
This commit is contained in:
parent
7a0f7bda9c
commit
3803b79ac5
|
@ -107,7 +107,7 @@ check_find_package_result(OPENGL_FOUND "OpenGL")
|
||||||
######################
|
######################
|
||||||
# Find Boost library #
|
# Find Boost library #
|
||||||
######################
|
######################
|
||||||
find_package(Boost QUIET)
|
find_package(Boost 1.36 QUIET)
|
||||||
check_find_package_result(Boost_FOUND "Boost")
|
check_find_package_result(Boost_FOUND "Boost")
|
||||||
|
|
||||||
##########################
|
##########################
|
||||||
|
|
|
@ -1377,3 +1377,15 @@ void WinEDA_DrawPanel::OnPan( wxCommandEvent& event )
|
||||||
Scroll( x, y );
|
Scroll( x, y );
|
||||||
MouseToCursorSchema();
|
MouseToCursorSchema();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WinEDA_DrawPanel::UnManageCursor( void )
|
||||||
|
{
|
||||||
|
wxClientDC dc( this );
|
||||||
|
|
||||||
|
if( ManageCurseur && ForceCloseManageCurseur )
|
||||||
|
{
|
||||||
|
ForceCloseManageCurseur( this, &dc );
|
||||||
|
m_AutoPAN_Request = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -77,7 +77,6 @@ set(EESCHEMA_SRCS
|
||||||
getpart.cpp
|
getpart.cpp
|
||||||
hierarch.cpp
|
hierarch.cpp
|
||||||
hotkeys.cpp
|
hotkeys.cpp
|
||||||
libalias.cpp
|
|
||||||
libarch.cpp
|
libarch.cpp
|
||||||
libedit.cpp
|
libedit.cpp
|
||||||
libedit_onleftclick.cpp
|
libedit_onleftclick.cpp
|
||||||
|
|
|
@ -93,101 +93,11 @@ int MarkItemsInBloc( EDA_LibComponentStruct* LibComponent,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( item->Type() )
|
if( item->Inside( Rect ) )
|
||||||
{
|
|
||||||
case COMPONENT_ARC_DRAW_TYPE:
|
|
||||||
{
|
|
||||||
pos = ( (LibDrawArc*) item )->m_ArcStart; pos.y = -pos.y;
|
|
||||||
if( Rect.Inside( pos ) )
|
|
||||||
{
|
{
|
||||||
item->m_Selected = IS_SELECTED;
|
item->m_Selected = IS_SELECTED;
|
||||||
ItemsCount++;
|
ItemsCount++;
|
||||||
}
|
}
|
||||||
pos = ( (LibDrawArc*) item )->m_ArcEnd; pos.y = -pos.y;
|
|
||||||
if( Rect.Inside( pos ) )
|
|
||||||
{
|
|
||||||
item->m_Selected = IS_SELECTED;
|
|
||||||
ItemsCount++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case COMPONENT_CIRCLE_DRAW_TYPE:
|
|
||||||
pos = ( (LibDrawCircle*) item )->m_Pos; pos.y = -pos.y;
|
|
||||||
if( Rect.Inside( pos ) )
|
|
||||||
{
|
|
||||||
item->m_Selected = IS_SELECTED;
|
|
||||||
ItemsCount++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COMPONENT_RECT_DRAW_TYPE:
|
|
||||||
pos = ( (LibDrawSquare*) item )->m_Pos; pos.y = -pos.y;
|
|
||||||
if( Rect.Inside( pos ) )
|
|
||||||
{
|
|
||||||
item->m_Selected = IS_SELECTED;
|
|
||||||
ItemsCount++;
|
|
||||||
}
|
|
||||||
pos = ( (LibDrawSquare*) item )->m_End; pos.y = -pos.y;
|
|
||||||
if( Rect.Inside( pos ) )
|
|
||||||
{
|
|
||||||
item->m_Selected = IS_SELECTED;
|
|
||||||
ItemsCount++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COMPONENT_POLYLINE_DRAW_TYPE:
|
|
||||||
{
|
|
||||||
int ii, imax = ( (LibDrawPolyline*) item )->GetCornerCount();
|
|
||||||
for( ii = 0; ii < imax; ii ++ )
|
|
||||||
{
|
|
||||||
pos = ( (LibDrawPolyline*) item )->m_PolyPoints[ii];
|
|
||||||
NEGATE( pos.y );
|
|
||||||
if( Rect.Inside( pos ) )
|
|
||||||
{
|
|
||||||
item->m_Selected = IS_SELECTED;
|
|
||||||
ItemsCount++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COMPONENT_LINE_DRAW_TYPE:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
|
||||||
pos = ( (LibDrawText*) item )->m_Pos; pos.y = -pos.y;
|
|
||||||
if( Rect.Inside( pos ) )
|
|
||||||
{
|
|
||||||
item->m_Selected = IS_SELECTED;
|
|
||||||
ItemsCount++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COMPONENT_PIN_DRAW_TYPE:
|
|
||||||
#undef STRUCT
|
|
||||||
#define STRUCT ( (LibDrawPin*) item )
|
|
||||||
pos = STRUCT->m_Pos; pos.y = -pos.y;
|
|
||||||
if( Rect.Inside( pos ) )
|
|
||||||
{
|
|
||||||
item->m_Selected = IS_SELECTED;
|
|
||||||
ItemsCount++;
|
|
||||||
}
|
|
||||||
pos = STRUCT->ReturnPinEndPoint(); pos.y = -pos.y;
|
|
||||||
if( Rect.Inside( pos ) )
|
|
||||||
{
|
|
||||||
item->m_Selected = IS_SELECTED;
|
|
||||||
ItemsCount++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COMPONENT_FIELD_DRAW_TYPE:
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ItemsCount;
|
return ItemsCount;
|
||||||
|
@ -513,54 +423,12 @@ void MoveMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
NEGATE( offset.y ); // Y axis for lib items is Down to Up: reverse y offset value
|
NEGATE( offset.y ); // Y axis for lib items is Down to Up: reverse y offset value
|
||||||
item = LibEntry->m_Drawings;
|
for( item = LibEntry->m_Drawings; item != NULL; item = item->Next() )
|
||||||
for( ; item != NULL; item = item->Next() )
|
|
||||||
{
|
{
|
||||||
if( item->m_Selected == 0 )
|
if( item->m_Selected == 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
switch( item->Type() )
|
item->SetOffset( offset );
|
||||||
{
|
|
||||||
case COMPONENT_PIN_DRAW_TYPE:
|
|
||||||
( (LibDrawPin*) item )->m_Pos += offset;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COMPONENT_ARC_DRAW_TYPE:
|
|
||||||
{
|
|
||||||
( (LibDrawArc*) item )->m_Pos += offset;
|
|
||||||
( (LibDrawArc*) item )->m_ArcStart += offset;
|
|
||||||
( (LibDrawArc*) item )->m_ArcEnd += offset;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case COMPONENT_CIRCLE_DRAW_TYPE:
|
|
||||||
( (LibDrawCircle*) item )->m_Pos += offset;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COMPONENT_RECT_DRAW_TYPE:
|
|
||||||
( (LibDrawSquare*) item )->m_Pos += offset;
|
|
||||||
( (LibDrawSquare*) item )->m_End += offset;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COMPONENT_POLYLINE_DRAW_TYPE:
|
|
||||||
{
|
|
||||||
unsigned ii, imax = ( (LibDrawPolyline*) item )->GetCornerCount();
|
|
||||||
for( ii = 0; ii < imax; ii ++ )
|
|
||||||
( (LibDrawPolyline*) item )->m_PolyPoints[ii] += offset;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COMPONENT_LINE_DRAW_TYPE:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
|
||||||
( (LibDrawText*) item )->m_Pos += offset;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
item->m_Flags = item->m_Selected = 0;
|
item->m_Flags = item->m_Selected = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,11 +39,13 @@ bool LibDrawText::Save( FILE* ExportFile ) const
|
||||||
// changed to '~'
|
// changed to '~'
|
||||||
text.Replace( wxT( " " ), wxT( "~" ) );
|
text.Replace( wxT( " " ), wxT( "~" ) );
|
||||||
|
|
||||||
fprintf( ExportFile, "T %d %d %d %d %d %d %d %s ", m_Orient,
|
if( fprintf( ExportFile, "T %d %d %d %d %d %d %d %s ", m_Orient,
|
||||||
m_Pos.x, m_Pos.y, m_Size.x, m_Attributs, m_Unit, m_Convert,
|
m_Pos.x, m_Pos.y, m_Size.x, m_Attributs, m_Unit, m_Convert,
|
||||||
CONV_TO_UTF8( text ) );
|
CONV_TO_UTF8( text ) ) < 0 )
|
||||||
fprintf( ExportFile, " %s %d", m_Italic ? "Italic" : "Normal",
|
return false;
|
||||||
( m_Bold>0 ) ? 1 : 0 );
|
if( fprintf( ExportFile, " %s %d", m_Italic ? "Italic" : "Normal",
|
||||||
|
( m_Bold > 0 ) ? 1 : 0 ) < 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
char hjustify = 'C';
|
char hjustify = 'C';
|
||||||
if( m_HJustify == GR_TEXT_HJUSTIFY_LEFT )
|
if( m_HJustify == GR_TEXT_HJUSTIFY_LEFT )
|
||||||
|
@ -57,9 +59,8 @@ bool LibDrawText::Save( FILE* ExportFile ) const
|
||||||
else if( m_VJustify == GR_TEXT_VJUSTIFY_TOP )
|
else if( m_VJustify == GR_TEXT_VJUSTIFY_TOP )
|
||||||
vjustify = 'T';
|
vjustify = 'T';
|
||||||
|
|
||||||
fprintf( ExportFile, " %c %c", hjustify, vjustify );
|
if( fprintf( ExportFile, " %c %c\n", hjustify, vjustify ) < 0 )
|
||||||
|
return false;
|
||||||
fprintf( ExportFile, "\n" );
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -192,6 +193,33 @@ LibEDA_BaseStruct* LibDrawText::DoGenCopy()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool LibDrawText::DoCompare( const LibEDA_BaseStruct& other ) const
|
||||||
|
{
|
||||||
|
wxASSERT( other.Type() == COMPONENT_GRAPHIC_TEXT_DRAW_TYPE );
|
||||||
|
|
||||||
|
const LibDrawText* tmp = ( LibDrawText* ) &other;
|
||||||
|
|
||||||
|
return ( ( m_Pos == tmp->m_Pos ) && ( m_Size == tmp->m_Size )
|
||||||
|
&& ( m_Text == tmp->m_Text ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LibDrawText::DoOffset( const wxPoint& offset )
|
||||||
|
{
|
||||||
|
m_Pos += offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool LibDrawText::DoTestInside( EDA_Rect& rect )
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* FIXME: This should calculate the text size and justification and
|
||||||
|
* use rectangle instect.
|
||||||
|
*/
|
||||||
|
return rect.Inside( m_Pos.x, -m_Pos.y );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Function GetPenSize
|
/** Function GetPenSize
|
||||||
* @return the size of the "pen" that be used to draw or plot this item
|
* @return the size of the "pen" that be used to draw or plot this item
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -404,59 +404,86 @@ bool EDA_LibComponentStruct::Save( FILE* aFile )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* First line: it s a comment (component name for readers) */
|
/* First line: it s a comment (component name for readers) */
|
||||||
fprintf( aFile, "#\n# %s\n#\n", CONV_TO_UTF8( m_Name.m_Text ) );
|
if( fprintf( aFile, "#\n# %s\n#\n", CONV_TO_UTF8( m_Name.m_Text ) ) < 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
/* Save data */
|
/* Save data */
|
||||||
fprintf( aFile, "DEF" );
|
if( fprintf( aFile, "DEF" ) < 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
if( (m_Name.m_Attributs & TEXT_NO_VISIBLE) == 0 )
|
if( (m_Name.m_Attributs & TEXT_NO_VISIBLE) == 0 )
|
||||||
fprintf( aFile, " %s", CONV_TO_UTF8( m_Name.m_Text ) );
|
{
|
||||||
|
if( fprintf( aFile, " %s", CONV_TO_UTF8( m_Name.m_Text ) ) < 0 )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
fprintf( aFile, " ~%s", CONV_TO_UTF8( m_Name.m_Text ) );
|
{
|
||||||
|
if( fprintf( aFile, " ~%s", CONV_TO_UTF8( m_Name.m_Text ) ) < 0 )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if( !m_Prefix.m_Text.IsEmpty() )
|
if( !m_Prefix.m_Text.IsEmpty() )
|
||||||
fprintf( aFile, " %s", CONV_TO_UTF8( m_Prefix.m_Text ) );
|
{
|
||||||
|
if( fprintf( aFile, " %s", CONV_TO_UTF8( m_Prefix.m_Text ) ) < 0 )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
fprintf( aFile, " ~" );
|
{
|
||||||
fprintf( aFile, " %d %d %c %c %d %c %c\n",
|
if( fprintf( aFile, " ~" ) < 0 )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( fprintf( aFile, " %d %d %c %c %d %c %c\n",
|
||||||
0, m_TextInside,
|
0, m_TextInside,
|
||||||
m_DrawPinNum ? 'Y' : 'N',
|
m_DrawPinNum ? 'Y' : 'N',
|
||||||
m_DrawPinName ? 'Y' : 'N',
|
m_DrawPinName ? 'Y' : 'N',
|
||||||
m_UnitCount, m_UnitSelectionLocked ? 'L' : 'F',
|
m_UnitCount, m_UnitSelectionLocked ? 'L' : 'F',
|
||||||
m_Options == ENTRY_POWER ? 'P' : 'N' );
|
m_Options == ENTRY_POWER ? 'P' : 'N' ) < 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
SaveDateAndTime( aFile );
|
if( !SaveDateAndTime( aFile ) || !m_Prefix.Save( aFile )
|
||||||
|
|| !m_Name.Save( aFile ) )
|
||||||
/* Save fields */
|
return false;
|
||||||
m_Prefix.Save( aFile );
|
|
||||||
m_Name.Save( aFile );
|
|
||||||
|
|
||||||
for( Field = m_Fields; Field != NULL; Field = Field->Next() )
|
for( Field = m_Fields; Field != NULL; Field = Field->Next() )
|
||||||
{
|
{
|
||||||
if( Field->m_Text.IsEmpty() && Field->m_Name.IsEmpty() )
|
if( Field->m_Text.IsEmpty() && Field->m_Name.IsEmpty() )
|
||||||
continue;
|
continue;
|
||||||
Field->Save( aFile );
|
if( !Field->Save( aFile ) )
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Save the alias list: a line starting by "ALIAS" */
|
/* Save the alias list: a line starting by "ALIAS" */
|
||||||
if( m_AliasList.GetCount() != 0 )
|
if( m_AliasList.GetCount() != 0 )
|
||||||
{
|
{
|
||||||
fprintf( aFile, "ALIAS" );
|
if( fprintf( aFile, "ALIAS" ) < 0 )
|
||||||
unsigned ii;
|
return false;
|
||||||
for( ii = 0; ii < m_AliasList.GetCount(); ii++ )
|
|
||||||
fprintf( aFile, " %s", CONV_TO_UTF8( m_AliasList[ii] ) );
|
|
||||||
|
|
||||||
fprintf( aFile, "\n" );
|
for( size_t ii = 0; ii < m_AliasList.GetCount(); ii++ )
|
||||||
|
{
|
||||||
|
if( fprintf( aFile, " %s", CONV_TO_UTF8( m_AliasList[ii] ) ) < 0 )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( fprintf( aFile, "\n" ) < 0 )
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write the footprint filter list */
|
/* Write the footprint filter list */
|
||||||
if( m_FootprintList.GetCount() != 0 )
|
if( m_FootprintList.GetCount() != 0 )
|
||||||
{
|
{
|
||||||
fprintf( aFile, "$FPLIST\n" );
|
if( fprintf( aFile, "$FPLIST\n" ) < 0 )
|
||||||
unsigned ii;
|
return false;
|
||||||
for( ii = 0; ii < m_FootprintList.GetCount(); ii++ )
|
|
||||||
fprintf( aFile, " %s\n", CONV_TO_UTF8( m_FootprintList[ii] ) );
|
|
||||||
|
|
||||||
fprintf( aFile, "$ENDFPLIST\n" );
|
for( size_t ii = 0; ii < m_FootprintList.GetCount(); ii++ )
|
||||||
|
{
|
||||||
|
if( fprintf( aFile, " %s\n",
|
||||||
|
CONV_TO_UTF8( m_FootprintList[ii] ) ) < 0 )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( fprintf( aFile, "$ENDFPLIST\n" ) < 0 )
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Save graphics items (including pins) */
|
/* Save graphics items (including pins) */
|
||||||
|
@ -466,17 +493,23 @@ bool EDA_LibComponentStruct::Save( FILE* aFile )
|
||||||
* when a file editing "by hand" is made */
|
* when a file editing "by hand" is made */
|
||||||
SortDrawItems();
|
SortDrawItems();
|
||||||
|
|
||||||
fprintf( aFile, "DRAW\n" );
|
if( fprintf( aFile, "DRAW\n" ) < 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
DrawEntry = m_Drawings;
|
DrawEntry = m_Drawings;
|
||||||
while( DrawEntry )
|
while( DrawEntry )
|
||||||
{
|
{
|
||||||
DrawEntry->Save( aFile );
|
if( !DrawEntry->Save( aFile ) )
|
||||||
|
return false;
|
||||||
DrawEntry = DrawEntry->Next();
|
DrawEntry = DrawEntry->Next();
|
||||||
}
|
}
|
||||||
fprintf( aFile, "ENDDRAW\n" );
|
|
||||||
|
if( fprintf( aFile, "ENDDRAW\n" ) < 0 )
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf( aFile, "ENDDEF\n" );
|
if( fprintf( aFile, "ENDDEF\n" ) < 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -897,7 +930,7 @@ bool EDA_LibComponentStruct::SaveDateAndTime( FILE* file )
|
||||||
year = ( m_LastDate >> 26 ) + 1990;
|
year = ( m_LastDate >> 26 ) + 1990;
|
||||||
|
|
||||||
if ( fprintf( file, "Ti %d/%d/%d %d:%d:%d\n",
|
if ( fprintf( file, "Ti %d/%d/%d %d:%d:%d\n",
|
||||||
year, mon, day, hour, min, sec ) == EOF )
|
year, mon, day, hour, min, sec ) < 0 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -927,6 +960,81 @@ bool EDA_LibComponentStruct::LoadDateAndTime( char* Line )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EDA_LibComponentStruct::SetOffset( const wxPoint& offset )
|
||||||
|
{
|
||||||
|
LibEDA_BaseStruct* DrawEntry;
|
||||||
|
|
||||||
|
m_Name.SetOffset( offset );
|
||||||
|
m_Prefix.SetOffset( offset );
|
||||||
|
|
||||||
|
for( LibDrawField* field = m_Fields; field != NULL; field = field->Next() )
|
||||||
|
{
|
||||||
|
field->SetOffset( offset );
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawEntry = m_Drawings;
|
||||||
|
|
||||||
|
while( DrawEntry )
|
||||||
|
{
|
||||||
|
DrawEntry->SetOffset( offset );
|
||||||
|
DrawEntry = DrawEntry->Next();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EDA_LibComponentStruct::RemoveDuplicateDrawItems()
|
||||||
|
{
|
||||||
|
LibEDA_BaseStruct* DEntryRef;
|
||||||
|
LibEDA_BaseStruct* DEntryCompare;
|
||||||
|
bool deleted;
|
||||||
|
|
||||||
|
DEntryRef = m_Drawings;
|
||||||
|
|
||||||
|
while( DEntryRef )
|
||||||
|
{
|
||||||
|
if( DEntryRef->Next() == NULL )
|
||||||
|
return;
|
||||||
|
DEntryCompare = DEntryRef->Next();
|
||||||
|
|
||||||
|
if( DEntryCompare == NULL )
|
||||||
|
return;
|
||||||
|
|
||||||
|
deleted = false;
|
||||||
|
|
||||||
|
while( DEntryCompare )
|
||||||
|
{
|
||||||
|
if( DEntryRef == DEntryCompare )
|
||||||
|
{
|
||||||
|
RemoveDrawItem( DEntryRef, NULL, NULL );
|
||||||
|
deleted = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEntryCompare = DEntryCompare->Next();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !deleted )
|
||||||
|
DEntryRef = DEntryRef->Next();
|
||||||
|
else
|
||||||
|
DEntryRef = m_Drawings;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool EDA_LibComponentStruct::HasConversion() const
|
||||||
|
{
|
||||||
|
LibEDA_BaseStruct* entry;
|
||||||
|
|
||||||
|
for( entry = m_Drawings; entry != NULL; entry = entry->Next() )
|
||||||
|
{
|
||||||
|
if( entry->m_Convert > 1 )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SaveDoc
|
* Function SaveDoc
|
||||||
* writes the doc info out to a FILE in "*.dcm" format.
|
* writes the doc info out to a FILE in "*.dcm" format.
|
||||||
|
@ -941,17 +1049,23 @@ bool LibCmpEntry::SaveDoc( FILE* aFile )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* Generation des lignes utiles */
|
/* Generation des lignes utiles */
|
||||||
fprintf( aFile, "#\n$CMP %s\n", CONV_TO_UTF8( m_Name.m_Text ) );
|
if( fprintf( aFile, "#\n$CMP %s\n", CONV_TO_UTF8( m_Name.m_Text ) ) < 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
if( ! m_Doc.IsEmpty() )
|
if( ! m_Doc.IsEmpty()
|
||||||
fprintf( aFile, "D %s\n", CONV_TO_UTF8( m_Doc ) );
|
&& fprintf( aFile, "D %s\n", CONV_TO_UTF8( m_Doc ) ) < 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
if( ! m_KeyWord.IsEmpty() )
|
if( ! m_KeyWord.IsEmpty()
|
||||||
fprintf( aFile, "K %s\n", CONV_TO_UTF8( m_KeyWord ) );
|
&& fprintf( aFile, "K %s\n", CONV_TO_UTF8( m_KeyWord ) ) < 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
if( ! m_DocFile.IsEmpty() )
|
if( ! m_DocFile.IsEmpty()
|
||||||
fprintf( aFile, "F %s\n", CONV_TO_UTF8( m_DocFile ) );
|
&& fprintf( aFile, "F %s\n", CONV_TO_UTF8( m_DocFile ) ) < 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if( fprintf( aFile, "$ENDCMP\n" ) < 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
fprintf( aFile, "$ENDCMP\n" );
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const wxString& GetName() { return m_Name.m_Text; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write the entry document information to a FILE in "*.dcm" format.
|
* Write the entry document information to a FILE in "*.dcm" format.
|
||||||
*
|
*
|
||||||
|
@ -199,6 +201,40 @@ public:
|
||||||
void RemoveDrawItem( LibEDA_BaseStruct* item,
|
void RemoveDrawItem( LibEDA_BaseStruct* item,
|
||||||
WinEDA_DrawPanel* panel = NULL,
|
WinEDA_DrawPanel* panel = NULL,
|
||||||
wxDC* dc = NULL );
|
wxDC* dc = NULL );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move the component offset.
|
||||||
|
*
|
||||||
|
* @param offset - Offset displacement.
|
||||||
|
*/
|
||||||
|
void SetOffset( const wxPoint& offset );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove duplicate draw items from list.
|
||||||
|
*/
|
||||||
|
void RemoveDuplicateDrawItems();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test if component has more than one body conversion type (DeMorgan).
|
||||||
|
*
|
||||||
|
* @return bool - True if component has more than one conversion.
|
||||||
|
*/
|
||||||
|
bool HasConversion() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test if alias name is in component alias list.
|
||||||
|
*
|
||||||
|
* Alias name comparisons are case insensitive.
|
||||||
|
*
|
||||||
|
* @param name - Name of alias.
|
||||||
|
*
|
||||||
|
* @return bool - True if alias name in alias list.
|
||||||
|
*/
|
||||||
|
bool HasAlias( const wxChar* name )
|
||||||
|
{
|
||||||
|
wxASSERT( name != NULL );
|
||||||
|
return m_AliasList.Index( name ) != wxNOT_FOUND;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,7 @@ LibDrawField::LibDrawField( int idfield ) :
|
||||||
m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT;
|
m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LibDrawField::~LibDrawField()
|
LibDrawField::~LibDrawField()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -74,13 +75,14 @@ bool LibDrawField::Save( FILE* ExportFile ) const
|
||||||
vjustify = 'T';
|
vjustify = 'T';
|
||||||
if( text.IsEmpty() )
|
if( text.IsEmpty() )
|
||||||
text = wxT( "~" );
|
text = wxT( "~" );
|
||||||
fprintf( ExportFile, "F%d \"%s\" %d %d %d %c %c %c %c%c%c",
|
if( fprintf( ExportFile, "F%d \"%s\" %d %d %d %c %c %c %c%c%c",
|
||||||
m_FieldId, CONV_TO_UTF8( text ), m_Pos.x, m_Pos.y, m_Size.x,
|
m_FieldId, CONV_TO_UTF8( text ), m_Pos.x, m_Pos.y, m_Size.x,
|
||||||
m_Orient == 0 ? 'H' : 'V',
|
m_Orient == 0 ? 'H' : 'V',
|
||||||
(m_Attributs & TEXT_NO_VISIBLE ) ? 'I' : 'V',
|
(m_Attributs & TEXT_NO_VISIBLE ) ? 'I' : 'V',
|
||||||
hjustify, vjustify,
|
hjustify, vjustify,
|
||||||
m_Italic ? 'I' : 'N',
|
m_Italic ? 'I' : 'N',
|
||||||
m_Bold ? 'B' : 'N' );
|
m_Bold ? 'B' : 'N' ) < 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
/* Save field name, if necessary
|
/* Save field name, if necessary
|
||||||
* Field name is saved only if it is not the default name.
|
* Field name is saved only if it is not the default name.
|
||||||
|
@ -88,10 +90,13 @@ bool LibDrawField::Save( FILE* ExportFile ) const
|
||||||
* a country to an other
|
* a country to an other
|
||||||
*/
|
*/
|
||||||
if( m_FieldId >= FIELD1 && !m_Name.IsEmpty()
|
if( m_FieldId >= FIELD1 && !m_Name.IsEmpty()
|
||||||
&& m_Name != ReturnDefaultFieldName( m_FieldId ))
|
&& m_Name != ReturnDefaultFieldName( m_FieldId )
|
||||||
fprintf( ExportFile, " \"%s\"", CONV_TO_UTF8( m_Name ) );
|
&& fprintf( ExportFile, " \"%s\"", CONV_TO_UTF8( m_Name ) ) < 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if( fprintf( ExportFile, "\n" ) < 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
fprintf( ExportFile, "\n" );
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,10 +317,12 @@ bool LibDrawField::HitTest( const wxPoint& refPos )
|
||||||
* @param aThreshold = unused here (TextHitTest calculates its threshold )
|
* @param aThreshold = unused here (TextHitTest calculates its threshold )
|
||||||
* @param aTransMat = the transform matrix
|
* @param aTransMat = the transform matrix
|
||||||
*/
|
*/
|
||||||
bool LibDrawField::HitTest( wxPoint aPosRef, int aThreshold, const int aTransMat[2][2] )
|
bool LibDrawField::HitTest( wxPoint aPosRef, int aThreshold,
|
||||||
|
const int aTransMat[2][2] )
|
||||||
{
|
{
|
||||||
int extraCharCount = 0;
|
int extraCharCount = 0;
|
||||||
// Reference designator text has one or 2 additional character (displays U? or U?A)
|
// Reference designator text has one or 2 additional character (displays
|
||||||
|
// U? or U?A)
|
||||||
if( m_FieldId == REFERENCE )
|
if( m_FieldId == REFERENCE )
|
||||||
{
|
{
|
||||||
extraCharCount++;
|
extraCharCount++;
|
||||||
|
@ -382,6 +389,33 @@ void LibDrawField::Copy( LibDrawField* Target ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool LibDrawField::DoCompare( const LibEDA_BaseStruct& other ) const
|
||||||
|
{
|
||||||
|
wxASSERT( other.Type() == COMPONENT_FIELD_DRAW_TYPE );
|
||||||
|
|
||||||
|
const LibDrawField* tmp = ( LibDrawField* ) &other;
|
||||||
|
|
||||||
|
return ( ( m_FieldId == tmp->m_FieldId ) && ( m_Text == tmp->m_Text )
|
||||||
|
&& ( m_Pos == tmp->m_Pos ) && ( m_Size == tmp->m_Size ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LibDrawField::DoOffset( const wxPoint& offset )
|
||||||
|
{
|
||||||
|
m_Pos += offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool LibDrawField::DoTestInside( EDA_Rect& rect )
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* FIXME: This fails to take into acount the size and/or orientation of
|
||||||
|
* the text.
|
||||||
|
*/
|
||||||
|
return rect.Inside( m_Pos.x, -m_Pos.y );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ReturnDefaultFieldName
|
* Function ReturnDefaultFieldName
|
||||||
* Return the default field name from its index (REFERENCE, VALUE ..)
|
* Return the default field name from its index (REFERENCE, VALUE ..)
|
||||||
|
|
|
@ -105,6 +105,9 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual LibEDA_BaseStruct* DoGenCopy();
|
virtual LibEDA_BaseStruct* DoGenCopy();
|
||||||
|
virtual bool DoCompare( const LibEDA_BaseStruct& other ) const;
|
||||||
|
virtual void DoOffset( const wxPoint& offset );
|
||||||
|
virtual bool DoTestInside( EDA_Rect& rect );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CLASS_LIBENTRY_FIELDS_H
|
#endif // CLASS_LIBENTRY_FIELDS_H
|
||||||
|
|
|
@ -68,7 +68,7 @@ void LibraryStruct::GetEntryNames( wxArrayString& names, bool sort,
|
||||||
if( makeUpperCase )
|
if( makeUpperCase )
|
||||||
names.Add( entry.m_Name.m_Text.MakeUpper() );
|
names.Add( entry.m_Name.m_Text.MakeUpper() );
|
||||||
else
|
else
|
||||||
names.Add( entry.m_Name.m_Text );
|
names.Add( entry.GetName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sort )
|
if( sort )
|
||||||
|
@ -84,11 +84,11 @@ void LibraryStruct::SearchEntryNames( wxArrayString& names,
|
||||||
BOOST_FOREACH( LibCmpEntry& entry, m_Entries )
|
BOOST_FOREACH( LibCmpEntry& entry, m_Entries )
|
||||||
{
|
{
|
||||||
if( !keySearch.IsEmpty() && KeyWordOk( keySearch, entry.m_KeyWord ) )
|
if( !keySearch.IsEmpty() && KeyWordOk( keySearch, entry.m_KeyWord ) )
|
||||||
names.Add( entry.m_Name.m_Text );
|
names.Add( entry.GetName() );
|
||||||
if( !nameSearch.IsEmpty() && WildCompareString( nameSearch,
|
if( !nameSearch.IsEmpty() && WildCompareString( nameSearch,
|
||||||
entry.m_Name.m_Text,
|
entry.GetName(),
|
||||||
false ) )
|
false ) )
|
||||||
names.Add( entry.m_Name.m_Text );
|
names.Add( entry.GetName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sort )
|
if( sort )
|
||||||
|
@ -100,7 +100,7 @@ LibCmpEntry* LibraryStruct::FindEntry( const wxChar* name )
|
||||||
{
|
{
|
||||||
BOOST_FOREACH( LibCmpEntry& entry, m_Entries )
|
BOOST_FOREACH( LibCmpEntry& entry, m_Entries )
|
||||||
{
|
{
|
||||||
if( entry.m_Name.m_Text.CmpNoCase( name ) == 0 )
|
if( entry.GetName().CmpNoCase( name ) == 0 )
|
||||||
return &entry;
|
return &entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,19 +110,56 @@ LibCmpEntry* LibraryStruct::FindEntry( const wxChar* name )
|
||||||
|
|
||||||
LibCmpEntry* LibraryStruct::FindEntry( const wxChar* name, LibrEntryType type )
|
LibCmpEntry* LibraryStruct::FindEntry( const wxChar* name, LibrEntryType type )
|
||||||
{
|
{
|
||||||
LibCmpEntry* entry = FindEntry( name );
|
BOOST_FOREACH( LibCmpEntry& entry, m_Entries )
|
||||||
|
|
||||||
if( entry && entry->Type != ROOT && type == ROOT )
|
|
||||||
{
|
{
|
||||||
EDA_LibCmpAliasStruct* alias = ( EDA_LibCmpAliasStruct* ) entry;
|
if( entry.GetName().CmpNoCase( name ) == 0 && entry.Type == type )
|
||||||
|
return &entry;
|
||||||
|
}
|
||||||
|
|
||||||
entry = FindEntry( alias->m_RootName );
|
|
||||||
|
|
||||||
if( entry && entry->Type != ROOT )
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return entry;
|
|
||||||
|
EDA_LibComponentStruct* LibraryStruct::FindComponent( const wxChar* name,
|
||||||
|
bool searchAliases )
|
||||||
|
{
|
||||||
|
if( !searchAliases )
|
||||||
|
return (EDA_LibComponentStruct*) FindEntry( name, ROOT );
|
||||||
|
|
||||||
|
EDA_LibComponentStruct* component = NULL;
|
||||||
|
LibCmpEntry* entry = FindEntry( name );
|
||||||
|
|
||||||
|
if( entry != NULL && entry->Type == ALIAS )
|
||||||
|
{
|
||||||
|
EDA_LibCmpAliasStruct* alias = (EDA_LibCmpAliasStruct*) entry;
|
||||||
|
component = (EDA_LibComponentStruct*) FindEntry( alias->m_RootName,
|
||||||
|
ROOT );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
component = (EDA_LibComponentStruct*) entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
return component;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool LibraryStruct::AddAlias( EDA_LibCmpAliasStruct* alias )
|
||||||
|
{
|
||||||
|
wxASSERT( alias != NULL );
|
||||||
|
|
||||||
|
if( FindEntry( alias->GetName() ) != NULL )
|
||||||
|
{
|
||||||
|
wxString msg;
|
||||||
|
|
||||||
|
msg.Printf( _( "Cannot add duplicate alias <%s> to library <%s>." ),
|
||||||
|
(const wxChar*) alias->GetName(), (const wxChar*) m_Name );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Entries.push_back( (LibCmpEntry*) alias );
|
||||||
|
m_IsModified = true;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -130,25 +167,32 @@ EDA_LibComponentStruct* LibraryStruct::AddComponent( EDA_LibComponentStruct* cmp
|
||||||
{
|
{
|
||||||
wxASSERT( cmp != NULL );
|
wxASSERT( cmp != NULL );
|
||||||
|
|
||||||
EDA_LibCmpAliasStruct* Alias;
|
|
||||||
EDA_LibComponentStruct* newCmp = CopyLibEntryStruct( cmp );
|
EDA_LibComponentStruct* newCmp = CopyLibEntryStruct( cmp );
|
||||||
|
|
||||||
if( newCmp == NULL )
|
if( newCmp == NULL )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
newCmp->m_AliasList.Clear();
|
|
||||||
m_Entries.push_back( (LibCmpEntry*) newCmp );
|
m_Entries.push_back( (LibCmpEntry*) newCmp );
|
||||||
m_IsModified = true;
|
m_IsModified = true;
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < cmp->m_AliasList.GetCount(); ii += ALIAS_NEXT )
|
for( size_t i = 0; i < newCmp->m_AliasList.GetCount(); i++ )
|
||||||
{
|
{
|
||||||
wxString aliasname = cmp->m_AliasList[ii + ALIAS_NAME];
|
EDA_LibCmpAliasStruct* alias = FindAlias( newCmp->m_AliasList[ i ] );
|
||||||
newCmp->m_AliasList.Add( aliasname );
|
|
||||||
Alias = new EDA_LibCmpAliasStruct( aliasname, newCmp->m_Name.m_Text );
|
if( alias == NULL )
|
||||||
Alias->m_Doc = cmp->m_AliasList[ii + ALIAS_DOC];
|
{
|
||||||
Alias->m_KeyWord = cmp->m_AliasList[ii + ALIAS_KEYWORD];
|
alias = new EDA_LibCmpAliasStruct( newCmp->m_AliasList[ i ],
|
||||||
Alias->m_DocFile = cmp->m_AliasList[ii + ALIAS_DOC_FILENAME];
|
newCmp->GetName() );
|
||||||
m_Entries.push_back( (LibCmpEntry *) Alias );
|
m_Entries.push_back( alias );
|
||||||
|
}
|
||||||
|
else if( alias->m_RootName != newCmp->GetName() )
|
||||||
|
{
|
||||||
|
wxLogError( _( "Conflict in library <%s>: alias <%s> already has \
|
||||||
|
root name <%s> and will not be assigned to root name <%s>." ),
|
||||||
|
(const wxChar*) m_Name,
|
||||||
|
(const wxChar*) alias->m_RootName,
|
||||||
|
(const wxChar*) newCmp->GetName() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Entries.sort();
|
m_Entries.sort();
|
||||||
|
@ -163,7 +207,7 @@ void LibraryStruct::RemoveEntry( const wxString& name )
|
||||||
|
|
||||||
for( i = m_Entries.begin(); i < m_Entries.end(); i++ )
|
for( i = m_Entries.begin(); i < m_Entries.end(); i++ )
|
||||||
{
|
{
|
||||||
if( i->m_Name.m_Text.CmpNoCase( name ) == 0 )
|
if( i->GetName().CmpNoCase( name ) == 0 )
|
||||||
{
|
{
|
||||||
m_Entries.erase( i );
|
m_Entries.erase( i );
|
||||||
return;
|
return;
|
||||||
|
@ -184,31 +228,31 @@ void LibraryStruct::RemoveEntry( LibCmpEntry* entry )
|
||||||
if( entry->Type == ALIAS )
|
if( entry->Type == ALIAS )
|
||||||
{
|
{
|
||||||
Alias = (EDA_LibCmpAliasStruct*) entry;
|
Alias = (EDA_LibCmpAliasStruct*) entry;
|
||||||
Root = ( EDA_LibComponentStruct* ) FindEntry( Alias->m_RootName, ROOT );
|
Root = FindComponent( Alias->m_RootName );
|
||||||
|
|
||||||
/* Remove alias name from the root component alias list */
|
/* Remove alias name from the root component alias list */
|
||||||
if( Root == NULL )
|
if( Root == NULL )
|
||||||
{
|
{
|
||||||
wxLogWarning( wxT( "No root component found for alias <%s> in \
|
wxLogWarning( wxT( "No root component found for alias <%s> in \
|
||||||
library <%s>." ),
|
library <%s>." ),
|
||||||
( const wxChar* ) entry->m_Name.m_Text,
|
( const wxChar* ) entry->GetName(),
|
||||||
( const wxChar* ) m_Name );
|
( const wxChar* ) m_Name );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int index = Root->m_AliasList.Index( entry->m_Name.m_Text, false );
|
int index = Root->m_AliasList.Index( entry->GetName(), false );
|
||||||
|
|
||||||
if( index == wxNOT_FOUND )
|
if( index == wxNOT_FOUND )
|
||||||
wxLogWarning( wxT( "Alias <%s> not found in component <%s> \
|
wxLogWarning( wxT( "Alias <%s> not found in component <%s> \
|
||||||
alias list in library <%s>" ),
|
alias list in library <%s>" ),
|
||||||
( const wxChar* ) entry->m_Name.m_Text,
|
( const wxChar* ) entry->GetName(),
|
||||||
( const wxChar* ) Root->m_Name.m_Text,
|
( const wxChar* ) Root->GetName(),
|
||||||
( const wxChar* ) m_Name );
|
( const wxChar* ) m_Name );
|
||||||
else
|
else
|
||||||
Root->m_AliasList.RemoveAt( index );
|
Root->m_AliasList.RemoveAt( index );
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveEntry( Alias->m_Name.m_Text );
|
RemoveEntry( Alias->GetName() );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -218,7 +262,7 @@ alias list in library <%s>" ),
|
||||||
/* Entry is a component with no aliases so removal is simple. */
|
/* Entry is a component with no aliases so removal is simple. */
|
||||||
if( Root->m_AliasList.GetCount() == 0 )
|
if( Root->m_AliasList.GetCount() == 0 )
|
||||||
{
|
{
|
||||||
RemoveEntry( Root->m_Name.m_Text );
|
RemoveEntry( Root->GetName() );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,14 +271,14 @@ alias list in library <%s>" ),
|
||||||
|
|
||||||
/* The root component is not really deleted, it is renamed with the first
|
/* The root component is not really deleted, it is renamed with the first
|
||||||
* alias name. */
|
* alias name. */
|
||||||
Alias = (EDA_LibCmpAliasStruct*) FindEntry( AliasName, ALIAS );
|
Alias = FindAlias( AliasName );
|
||||||
|
|
||||||
if( Alias == NULL || Alias->Type == ROOT )
|
if( Alias == NULL )
|
||||||
{
|
{
|
||||||
wxLogWarning( wxT( "Alias <%s> for component <%s> not found in \
|
wxLogWarning( wxT( "Alias <%s> for component <%s> not found in \
|
||||||
library <%s>" ),
|
library <%s>" ),
|
||||||
( const wxChar* ) AliasName,
|
( const wxChar* ) AliasName,
|
||||||
( const wxChar* ) Root->m_Name.m_Text,
|
( const wxChar* ) Root->GetName(),
|
||||||
( const wxChar* ) m_Name );
|
( const wxChar* ) m_Name );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -254,27 +298,93 @@ library <%s>" ),
|
||||||
/* Change the "RootName" for all other aliases */
|
/* Change the "RootName" for all other aliases */
|
||||||
for( size_t ii = 0; ii < Root->m_AliasList.GetCount(); ii++ )
|
for( size_t ii = 0; ii < Root->m_AliasList.GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
Alias = (EDA_LibCmpAliasStruct*) FindEntry( Root->m_AliasList[ii],
|
Alias = FindAlias( Root->m_AliasList[ii] );
|
||||||
ALIAS );
|
|
||||||
|
|
||||||
/* Should not occur if library was saved by the library editor.
|
/* Should not occur if library was saved by the library editor.
|
||||||
* However, it is possible if the library was edited by hand or
|
* However, it is possible if the library was edited by hand or
|
||||||
* some other program or a there is a bug in the library editor. */
|
* some other program or a there is a bug in the library editor. */
|
||||||
if( Alias == NULL || Alias->Type != ALIAS )
|
if( Alias == NULL )
|
||||||
{
|
{
|
||||||
wxLogWarning( wxT( "Alias <%s> for component <%s> not found in \
|
wxLogWarning( wxT( "Alias <%s> for component <%s> not found in \
|
||||||
library <%s>." ),
|
library <%s>." ),
|
||||||
( const wxChar* ) AliasName,
|
( const wxChar* ) AliasName,
|
||||||
( const wxChar* ) Root->m_Name.m_Text,
|
( const wxChar* ) Root->GetName(),
|
||||||
( const wxChar* ) m_Name );
|
( const wxChar* ) m_Name );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Alias->m_RootName = Root->m_Name.m_Text;
|
Alias->m_RootName = Root->GetName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
EDA_LibComponentStruct* LibraryStruct::ReplaceComponent(
|
||||||
|
EDA_LibComponentStruct* oldComponent,
|
||||||
|
EDA_LibComponentStruct* newComponent )
|
||||||
|
{
|
||||||
|
wxASSERT( oldComponent != NULL && newComponent != NULL
|
||||||
|
&& oldComponent->GetName().CmpNoCase( newComponent->GetName() )== 0 );
|
||||||
|
|
||||||
|
size_t i;
|
||||||
|
int index;
|
||||||
|
EDA_LibCmpAliasStruct* alias;
|
||||||
|
|
||||||
|
if( oldComponent->m_AliasList != newComponent->m_AliasList )
|
||||||
|
{
|
||||||
|
/* Remove extra aliases. */
|
||||||
|
for( i = 0; i < oldComponent->m_AliasList.GetCount(); i++ )
|
||||||
|
{
|
||||||
|
index =
|
||||||
|
newComponent->m_AliasList.Index( oldComponent->m_AliasList[ i ] );
|
||||||
|
|
||||||
|
if( index != wxNOT_FOUND )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
wxLogDebug( wxT( "Removing extra alias <%s> from component <%s> \
|
||||||
|
in library <%s>." ),
|
||||||
|
(const wxChar*) oldComponent->m_AliasList[ i ],
|
||||||
|
(const wxChar*) oldComponent->GetName(),
|
||||||
|
(const wxChar*) m_Name );
|
||||||
|
|
||||||
|
RemoveEntry( oldComponent->m_AliasList[ i ] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Add new aliases. */
|
||||||
|
for( i = 0; i < newComponent->m_AliasList.GetCount(); i++ )
|
||||||
|
{
|
||||||
|
index =
|
||||||
|
oldComponent->m_AliasList.Index( newComponent->m_AliasList[ i ] );
|
||||||
|
|
||||||
|
if( index != wxNOT_FOUND
|
||||||
|
|| FindEntry( newComponent->m_AliasList[ i ] ) != NULL )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
wxLogDebug( wxT( "Adding extra alias <%s> from component <%s> \
|
||||||
|
in library <%s>." ),
|
||||||
|
(const wxChar*) newComponent->m_AliasList[ i ],
|
||||||
|
(const wxChar*) newComponent->GetName(),
|
||||||
|
(const wxChar*) m_Name );
|
||||||
|
|
||||||
|
alias = new EDA_LibCmpAliasStruct( newComponent->m_AliasList[ i ],
|
||||||
|
newComponent->GetName() );
|
||||||
|
m_Entries.push_back( alias );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RemoveEntry( oldComponent->GetName() );
|
||||||
|
|
||||||
|
EDA_LibComponentStruct* newCmp = CopyLibEntryStruct( newComponent );
|
||||||
|
|
||||||
|
if( newCmp == NULL )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
m_Entries.push_back( (LibCmpEntry*) newCmp );
|
||||||
|
m_Entries.sort();
|
||||||
|
m_IsModified = true;
|
||||||
|
return newCmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
LibCmpEntry* LibraryStruct::GetNextEntry( const wxChar* name )
|
LibCmpEntry* LibraryStruct::GetNextEntry( const wxChar* name )
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
@ -282,7 +392,7 @@ LibCmpEntry* LibraryStruct::GetNextEntry( const wxChar* name )
|
||||||
|
|
||||||
for( i = 0; i < m_Entries.size(); i++ )
|
for( i = 0; i < m_Entries.size(); i++ )
|
||||||
{
|
{
|
||||||
if( m_Entries[i].m_Name.m_Text.CmpNoCase( name ) == 0 )
|
if( m_Entries[i].GetName().CmpNoCase( name ) == 0 )
|
||||||
{
|
{
|
||||||
if( i < m_Entries.size() - 1 )
|
if( i < m_Entries.size() - 1 )
|
||||||
{
|
{
|
||||||
|
@ -306,7 +416,7 @@ LibCmpEntry* LibraryStruct::GetPreviousEntry( const wxChar* name )
|
||||||
|
|
||||||
for( i = 0; i < m_Entries.size(); i++ )
|
for( i = 0; i < m_Entries.size(); i++ )
|
||||||
{
|
{
|
||||||
if( m_Entries[i].m_Name.m_Text.CmpNoCase( name ) == 0 && entry )
|
if( m_Entries[i].GetName().CmpNoCase( name ) == 0 && entry )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
entry = &m_Entries[i];
|
entry = &m_Entries[i];
|
||||||
|
@ -407,7 +517,7 @@ void LibraryStruct::LoadAliases( EDA_LibComponentStruct* component )
|
||||||
{
|
{
|
||||||
AliasEntry =
|
AliasEntry =
|
||||||
new EDA_LibCmpAliasStruct( component->m_AliasList[ii],
|
new EDA_LibCmpAliasStruct( component->m_AliasList[ii],
|
||||||
component->m_Name.m_Text );
|
component->GetName() );
|
||||||
m_Entries.push_back( AliasEntry );
|
m_Entries.push_back( AliasEntry );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -484,7 +594,7 @@ document file." ),
|
||||||
|
|
||||||
wxString cmpname = CONV_FROM_UTF8( Name );
|
wxString cmpname = CONV_FROM_UTF8( Name );
|
||||||
|
|
||||||
Entry = FindEntry( cmpname, ALIAS );
|
Entry = FindEntry( cmpname );
|
||||||
|
|
||||||
while( GetLine( f, Line, &LineNum, sizeof(Line) ) )
|
while( GetLine( f, Line, &LineNum, sizeof(Line) ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -137,11 +137,6 @@ public:
|
||||||
/**
|
/**
|
||||||
* Find entry by name and type.
|
* Find entry by name and type.
|
||||||
*
|
*
|
||||||
* If the search type is an alias, the return entry can be either an
|
|
||||||
* alias or a component object. If the search type is a component
|
|
||||||
* (root) type, the object returned will be a component. This was
|
|
||||||
* done to emulate the old search pattern.
|
|
||||||
*
|
|
||||||
* @param name - Name of entry, case insensitive.
|
* @param name - Name of entry, case insensitive.
|
||||||
* @param type - Type of entry, root or alias.
|
* @param type - Type of entry, root or alias.
|
||||||
*
|
*
|
||||||
|
@ -149,6 +144,52 @@ public:
|
||||||
*/
|
*/
|
||||||
LibCmpEntry* FindEntry( const wxChar* name, LibrEntryType type );
|
LibCmpEntry* FindEntry( const wxChar* name, LibrEntryType type );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find component by name.
|
||||||
|
*
|
||||||
|
* This is a helper for FindEntry so casting a LibCmpEntry pointer to
|
||||||
|
* a EDA_LibComponentStruct pointer is not required.
|
||||||
|
*
|
||||||
|
* @param name - Name of component, case insensitive.
|
||||||
|
* @param searchAliases - Searches for component by alias name as well as
|
||||||
|
* component name if true.
|
||||||
|
*
|
||||||
|
* @return Pointer to component if found. NULL if not found.
|
||||||
|
*/
|
||||||
|
EDA_LibComponentStruct* FindComponent( const wxChar* name,
|
||||||
|
bool searchAliases = true );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find alias by name.
|
||||||
|
*
|
||||||
|
* This is a helper for FindEntry so casting a LibCmpEntry pointer to
|
||||||
|
* a EDA_LibCmpAliasStruct pointer is not required.
|
||||||
|
*
|
||||||
|
* @param name - Name of alias, case insensitive.
|
||||||
|
*
|
||||||
|
* @return Pointer to alias if found. NULL if not found.
|
||||||
|
*/
|
||||||
|
EDA_LibCmpAliasStruct* FindAlias( const wxChar* name )
|
||||||
|
{
|
||||||
|
return (EDA_LibCmpAliasStruct*) FindEntry( name, ALIAS );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a new alias entry to the library.
|
||||||
|
*
|
||||||
|
* First check if a component or alias with the same name already exists
|
||||||
|
* in the library and add alias if no conflict occurs. Once the alias
|
||||||
|
* is added to the library it is owned by the library. Deleting the
|
||||||
|
* alias pointer will render the library unstable. Use RemoveEntry to
|
||||||
|
* remove the alias from the library.
|
||||||
|
*
|
||||||
|
* @param alias - Alias to add to library.
|
||||||
|
*
|
||||||
|
* @return bool - True if alias added to library. False if conflict
|
||||||
|
* exists.
|
||||||
|
*/
|
||||||
|
bool AddAlias( EDA_LibCmpAliasStruct* alias );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add component entry to library.
|
* Add component entry to library.
|
||||||
*
|
*
|
||||||
|
@ -172,6 +213,16 @@ public:
|
||||||
*/
|
*/
|
||||||
void RemoveEntry( LibCmpEntry* entry );
|
void RemoveEntry( LibCmpEntry* entry );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace an existing component entry in the library.
|
||||||
|
*
|
||||||
|
* @param oldComponent - The component to replace.
|
||||||
|
* @param newComponent - The new component.
|
||||||
|
*/
|
||||||
|
EDA_LibComponentStruct* ReplaceComponent(
|
||||||
|
EDA_LibComponentStruct* oldComponent,
|
||||||
|
EDA_LibComponentStruct* newComponent );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the first entry in the library.
|
* Return the first entry in the library.
|
||||||
*
|
*
|
||||||
|
|
|
@ -137,29 +137,46 @@ bool LibDrawPin::Save( FILE* ExportFile ) const
|
||||||
StringPinNum = wxT( "~" );
|
StringPinNum = wxT( "~" );
|
||||||
|
|
||||||
if( !m_PinName.IsEmpty() )
|
if( !m_PinName.IsEmpty() )
|
||||||
fprintf( ExportFile, "X %s", CONV_TO_UTF8( m_PinName ) );
|
{
|
||||||
|
if( fprintf( ExportFile, "X %s", CONV_TO_UTF8( m_PinName ) ) < 0 )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
fprintf( ExportFile, "X ~" );
|
{
|
||||||
|
if( fprintf( ExportFile, "X ~" ) < 0 )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
fprintf( ExportFile, " %s %d %d %d %c %d %d %d %d %c",
|
if( fprintf( ExportFile, " %s %d %d %d %c %d %d %d %d %c",
|
||||||
CONV_TO_UTF8( StringPinNum ), m_Pos.x, m_Pos.y,
|
CONV_TO_UTF8( StringPinNum ), m_Pos.x, m_Pos.y,
|
||||||
(int) m_PinLen, (int) m_Orient, m_PinNumSize, m_PinNameSize,
|
(int) m_PinLen, (int) m_Orient, m_PinNumSize, m_PinNameSize,
|
||||||
m_Unit, m_Convert, Etype );
|
m_Unit, m_Convert, Etype ) < 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
if( ( m_PinShape ) || ( m_Attributs & PINNOTDRAW ) )
|
if( ( m_PinShape ) || ( m_Attributs & PINNOTDRAW ) )
|
||||||
fprintf( ExportFile, " " );
|
{
|
||||||
if( m_Attributs & PINNOTDRAW )
|
if( fprintf( ExportFile, " " ) < 0 )
|
||||||
fprintf( ExportFile, "N" );
|
return false;
|
||||||
if( m_PinShape & INVERT )
|
}
|
||||||
fprintf( ExportFile, "I" );
|
if( m_Attributs & PINNOTDRAW
|
||||||
if( m_PinShape & CLOCK )
|
&& fprintf( ExportFile, "N" ) < 0 )
|
||||||
fprintf( ExportFile, "C" );
|
return false;
|
||||||
if( m_PinShape & LOWLEVEL_IN )
|
if( m_PinShape & INVERT
|
||||||
fprintf( ExportFile, "L" );
|
&& fprintf( ExportFile, "I" ) < 0 )
|
||||||
if( m_PinShape & LOWLEVEL_OUT )
|
return false;
|
||||||
fprintf( ExportFile, "V" );
|
if( m_PinShape & CLOCK
|
||||||
|
&& fprintf( ExportFile, "C" ) < 0 )
|
||||||
|
return false;
|
||||||
|
if( m_PinShape & LOWLEVEL_IN
|
||||||
|
&& fprintf( ExportFile, "L" ) < 0 )
|
||||||
|
return false;
|
||||||
|
if( m_PinShape & LOWLEVEL_OUT
|
||||||
|
&& fprintf( ExportFile, "V" ) < 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if( fprintf( ExportFile, "\n" ) < 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
fprintf( ExportFile, "\n" );
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1037,13 +1054,36 @@ LibEDA_BaseStruct* LibDrawPin::DoGenCopy()
|
||||||
newpin->m_Convert = m_Convert;
|
newpin->m_Convert = m_Convert;
|
||||||
newpin->m_Flags = m_Flags;
|
newpin->m_Flags = m_Flags;
|
||||||
newpin->m_Width = m_Width;
|
newpin->m_Width = m_Width;
|
||||||
|
|
||||||
newpin->m_PinName = m_PinName;
|
newpin->m_PinName = m_PinName;
|
||||||
|
|
||||||
return (LibEDA_BaseStruct*) newpin;
|
return (LibEDA_BaseStruct*) newpin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool LibDrawPin::DoCompare( const LibEDA_BaseStruct& other ) const
|
||||||
|
{
|
||||||
|
wxASSERT( other.Type() == COMPONENT_PIN_DRAW_TYPE );
|
||||||
|
|
||||||
|
const LibDrawPin* tmp = ( LibDrawPin* ) &other;
|
||||||
|
|
||||||
|
return ( m_Pos == tmp->m_Pos );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LibDrawPin::DoOffset( const wxPoint& offset )
|
||||||
|
{
|
||||||
|
m_Pos += offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool LibDrawPin::DoTestInside( EDA_Rect& rect )
|
||||||
|
{
|
||||||
|
wxPoint end = ReturnPinEndPoint();
|
||||||
|
|
||||||
|
return rect.Inside( m_Pos.x, -m_Pos.y ) || rect.Inside( end.x, -end.y );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Function LibDrawPin::DisplayInfo
|
/** Function LibDrawPin::DisplayInfo
|
||||||
* Displays info (pin num and name, orientation ...
|
* Displays info (pin num and name, orientation ...
|
||||||
* on the Info window
|
* on the Info window
|
||||||
|
|
|
@ -70,6 +70,15 @@ void LibEDA_BaseStruct::DisplayInfo( WinEDA_DrawFrame* frame )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool LibEDA_BaseStruct::operator==( const LibEDA_BaseStruct& other ) const
|
||||||
|
{
|
||||||
|
return ( ( Type() == other.Type() )
|
||||||
|
&& ( m_Unit == other.m_Unit )
|
||||||
|
&& ( m_Convert == other.m_Convert )
|
||||||
|
&& DoCompare( other ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************/
|
/**********************/
|
||||||
/** class LibDrawArc **/
|
/** class LibDrawArc **/
|
||||||
/**********************/
|
/**********************/
|
||||||
|
@ -77,8 +86,9 @@ void LibEDA_BaseStruct::DisplayInfo( WinEDA_DrawFrame* frame )
|
||||||
LibDrawArc::LibDrawArc( EDA_LibComponentStruct* aParent ) :
|
LibDrawArc::LibDrawArc( EDA_LibComponentStruct* aParent ) :
|
||||||
LibEDA_BaseStruct( COMPONENT_ARC_DRAW_TYPE, aParent )
|
LibEDA_BaseStruct( COMPONENT_ARC_DRAW_TYPE, aParent )
|
||||||
{
|
{
|
||||||
m_Rayon = 0;
|
m_Radius = 0;
|
||||||
t1 = t2 = 0;
|
m_t1 = 0;
|
||||||
|
m_t2 = 0;
|
||||||
m_Width = 0;
|
m_Width = 0;
|
||||||
m_Fill = NO_FILL;
|
m_Fill = NO_FILL;
|
||||||
m_typeName = _( "Arc" );
|
m_typeName = _( "Arc" );
|
||||||
|
@ -92,20 +102,21 @@ LibDrawArc::LibDrawArc( EDA_LibComponentStruct* aParent ) :
|
||||||
*/
|
*/
|
||||||
bool LibDrawArc::Save( FILE* ExportFile ) const
|
bool LibDrawArc::Save( FILE* ExportFile ) const
|
||||||
{
|
{
|
||||||
int x1 = t1;
|
int x1 = m_t1;
|
||||||
|
|
||||||
if( x1 > 1800 )
|
if( x1 > 1800 )
|
||||||
x1 -= 3600;
|
x1 -= 3600;
|
||||||
|
|
||||||
int x2 = t2;
|
int x2 = m_t2;
|
||||||
|
|
||||||
if( x2 > 1800 )
|
if( x2 > 1800 )
|
||||||
x2 -= 3600;
|
x2 -= 3600;
|
||||||
|
|
||||||
fprintf( ExportFile, "A %d %d %d %d %d %d %d %d %c %d %d %d %d\n",
|
if( fprintf( ExportFile, "A %d %d %d %d %d %d %d %d %c %d %d %d %d\n",
|
||||||
m_Pos.x, m_Pos.y, m_Rayon, x1, x2, m_Unit, m_Convert, m_Width,
|
m_Pos.x, m_Pos.y, m_Radius, x1, x2, m_Unit, m_Convert, m_Width,
|
||||||
fill_tab[m_Fill], m_ArcStart.x, m_ArcStart.y, m_ArcEnd.x,
|
fill_tab[m_Fill], m_ArcStart.x, m_ArcStart.y, m_ArcEnd.x,
|
||||||
m_ArcEnd.y );
|
m_ArcEnd.y ) < 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -117,8 +128,8 @@ bool LibDrawArc::Load( char* line, wxString& errorMsg )
|
||||||
char tmp[256];
|
char tmp[256];
|
||||||
|
|
||||||
cnt = sscanf( &line[2], "%d %d %d %d %d %d %d %d %s %d %d %d %d",
|
cnt = sscanf( &line[2], "%d %d %d %d %d %d %d %d %s %d %d %d %d",
|
||||||
&m_Pos.x, &m_Pos.y, &m_Rayon, &t1, &t2, &m_Unit, &m_Convert,
|
&m_Pos.x, &m_Pos.y, &m_Radius, &m_t1, &m_t2, &m_Unit,
|
||||||
&m_Width, tmp, &startx, &starty, &endx, &endy );
|
&m_Convert, &m_Width, tmp, &startx, &starty, &endx, &endy );
|
||||||
if( cnt < 8 )
|
if( cnt < 8 )
|
||||||
{
|
{
|
||||||
errorMsg.Printf( _( "arc only had %d parameters of the required 8" ),
|
errorMsg.Printf( _( "arc only had %d parameters of the required 8" ),
|
||||||
|
@ -131,8 +142,8 @@ bool LibDrawArc::Load( char* line, wxString& errorMsg )
|
||||||
if( tmp[0] == 'f' )
|
if( tmp[0] == 'f' )
|
||||||
m_Fill = FILLED_WITH_BG_BODYCOLOR;
|
m_Fill = FILLED_WITH_BG_BODYCOLOR;
|
||||||
|
|
||||||
NORMALIZE_ANGLE( t1 );
|
NORMALIZE_ANGLE( m_t1 );
|
||||||
NORMALIZE_ANGLE( t2 );
|
NORMALIZE_ANGLE( m_t2 );
|
||||||
|
|
||||||
// Actual Coordinates of arc ends are read from file
|
// Actual Coordinates of arc ends are read from file
|
||||||
if( cnt >= 13 )
|
if( cnt >= 13 )
|
||||||
|
@ -146,14 +157,14 @@ bool LibDrawArc::Load( char* line, wxString& errorMsg )
|
||||||
{
|
{
|
||||||
// Actual Coordinates of arc ends are not read from file
|
// Actual Coordinates of arc ends are not read from file
|
||||||
// (old library), calculate them
|
// (old library), calculate them
|
||||||
m_ArcStart.x = m_Rayon;
|
m_ArcStart.x = m_Radius;
|
||||||
m_ArcStart.y = 0;
|
m_ArcStart.y = 0;
|
||||||
m_ArcEnd.x = m_Rayon;
|
m_ArcEnd.x = m_Radius;
|
||||||
m_ArcEnd.y = 0;
|
m_ArcEnd.y = 0;
|
||||||
RotatePoint( &m_ArcStart.x, &m_ArcStart.y, -t1 );
|
RotatePoint( &m_ArcStart.x, &m_ArcStart.y, -m_t1 );
|
||||||
m_ArcStart.x += m_Pos.x;
|
m_ArcStart.x += m_Pos.x;
|
||||||
m_ArcStart.y += m_Pos.y;
|
m_ArcStart.y += m_Pos.y;
|
||||||
RotatePoint( &m_ArcEnd.x, &m_ArcEnd.y, -t2 );
|
RotatePoint( &m_ArcEnd.x, &m_ArcEnd.y, -m_t2 );
|
||||||
m_ArcEnd.x += m_Pos.x;
|
m_ArcEnd.x += m_Pos.x;
|
||||||
m_ArcEnd.y += m_Pos.y;
|
m_ArcEnd.y += m_Pos.y;
|
||||||
}
|
}
|
||||||
|
@ -199,13 +210,13 @@ bool LibDrawArc::HitTest( wxPoint aRefPoint, int aThreshold,
|
||||||
int dist = wxRound( sqrt( ( (double) relpos.x * (double) relpos.x ) +
|
int dist = wxRound( sqrt( ( (double) relpos.x * (double) relpos.x ) +
|
||||||
( (double) relpos.y * (double) relpos.y ) ) );
|
( (double) relpos.y * (double) relpos.y ) ) );
|
||||||
|
|
||||||
if( abs( dist - m_Rayon ) > aThreshold )
|
if( abs( dist - m_Radius ) > aThreshold )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// We are on the circle, ensure we are only on the arc, i.e. between
|
// We are on the circle, ensure we are only on the arc, i.e. between
|
||||||
// m_ArcStart and m_ArcEnd
|
// m_ArcStart and m_ArcEnd
|
||||||
int astart = t1; // arc starting point ( in 0.1 degree)
|
int astart = m_t1; // arc starting point ( in 0.1 degree)
|
||||||
int aend = t2; // arc ending point ( in 0.1 degree)
|
int aend = m_t2; // arc ending point ( in 0.1 degree)
|
||||||
int atest = wxRound( atan2( (double) relpos.y,
|
int atest = wxRound( atan2( (double) relpos.y,
|
||||||
(double) relpos.x ) * 1800.0 / M_PI );
|
(double) relpos.x ) * 1800.0 / M_PI );
|
||||||
NORMALIZE_ANGLE_180( atest );
|
NORMALIZE_ANGLE_180( atest );
|
||||||
|
@ -229,9 +240,9 @@ LibEDA_BaseStruct* LibDrawArc::DoGenCopy()
|
||||||
newitem->m_Pos = m_Pos;
|
newitem->m_Pos = m_Pos;
|
||||||
newitem->m_ArcStart = m_ArcStart;
|
newitem->m_ArcStart = m_ArcStart;
|
||||||
newitem->m_ArcEnd = m_ArcEnd;
|
newitem->m_ArcEnd = m_ArcEnd;
|
||||||
newitem->m_Rayon = m_Rayon;
|
newitem->m_Radius = m_Radius;
|
||||||
newitem->t1 = t1;
|
newitem->m_t1 = m_t1;
|
||||||
newitem->t2 = t2;
|
newitem->m_t2 = m_t2;
|
||||||
newitem->m_Width = m_Width;
|
newitem->m_Width = m_Width;
|
||||||
newitem->m_Unit = m_Unit;
|
newitem->m_Unit = m_Unit;
|
||||||
newitem->m_Convert = m_Convert;
|
newitem->m_Convert = m_Convert;
|
||||||
|
@ -242,6 +253,32 @@ LibEDA_BaseStruct* LibDrawArc::DoGenCopy()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool LibDrawArc::DoCompare( const LibEDA_BaseStruct& other ) const
|
||||||
|
{
|
||||||
|
wxASSERT( other.Type() == COMPONENT_ARC_DRAW_TYPE );
|
||||||
|
|
||||||
|
const LibDrawArc* tmp = ( LibDrawArc* ) &other;
|
||||||
|
|
||||||
|
return ( ( m_Pos == tmp->m_Pos ) && ( m_t1 == tmp->m_t1 )
|
||||||
|
&& ( m_t2 == tmp->m_t2 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LibDrawArc::DoOffset( const wxPoint& offset )
|
||||||
|
{
|
||||||
|
m_Pos += offset;
|
||||||
|
m_ArcStart += offset;
|
||||||
|
m_ArcEnd += offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool LibDrawArc::DoTestInside( EDA_Rect& rect )
|
||||||
|
{
|
||||||
|
return rect.Inside( m_ArcStart.x, -m_ArcStart.y )
|
||||||
|
|| rect.Inside( m_ArcEnd.x, -m_ArcEnd.y );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Function GetPenSize
|
/** Function GetPenSize
|
||||||
* @return the size of the "pen" that be used to draw or plot this item
|
* @return the size of the "pen" that be used to draw or plot this item
|
||||||
*/
|
*/
|
||||||
|
@ -271,8 +308,8 @@ void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
pos1 = TransformCoordinate( aTransformMatrix, m_ArcEnd ) + aOffset;
|
pos1 = TransformCoordinate( aTransformMatrix, m_ArcEnd ) + aOffset;
|
||||||
pos2 = TransformCoordinate( aTransformMatrix, m_ArcStart ) + aOffset;
|
pos2 = TransformCoordinate( aTransformMatrix, m_ArcStart ) + aOffset;
|
||||||
posc = TransformCoordinate( aTransformMatrix, m_Pos ) + aOffset;
|
posc = TransformCoordinate( aTransformMatrix, m_Pos ) + aOffset;
|
||||||
int pt1 = t1;
|
int pt1 = m_t1;
|
||||||
int pt2 = t2;
|
int pt2 = m_t2;
|
||||||
bool swap = MapAngles( &pt1, &pt2, aTransformMatrix );
|
bool swap = MapAngles( &pt1, &pt2, aTransformMatrix );
|
||||||
if( swap )
|
if( swap )
|
||||||
{
|
{
|
||||||
|
@ -288,17 +325,17 @@ void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
|
|
||||||
if( fill == FILLED_WITH_BG_BODYCOLOR )
|
if( fill == FILLED_WITH_BG_BODYCOLOR )
|
||||||
GRFilledArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2,
|
GRFilledArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2,
|
||||||
m_Rayon, GetPenSize( ), color,
|
m_Radius, GetPenSize( ), color,
|
||||||
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
||||||
else if( fill == FILLED_SHAPE && !aData )
|
else if( fill == FILLED_SHAPE && !aData )
|
||||||
GRFilledArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2,
|
GRFilledArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2,
|
||||||
m_Rayon, color, color );
|
m_Radius, color, color );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef DRAW_ARC_WITH_ANGLE
|
#ifdef DRAW_ARC_WITH_ANGLE
|
||||||
|
|
||||||
GRArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2,
|
GRArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2,
|
||||||
m_Rayon, GetPenSize( ), color );
|
m_Radius, GetPenSize( ), color );
|
||||||
#else
|
#else
|
||||||
|
|
||||||
GRArc1( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y,
|
GRArc1( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y,
|
||||||
|
@ -325,20 +362,20 @@ EDA_Rect LibDrawArc::GetBoundingBox()
|
||||||
wxPoint normEnd = m_ArcEnd - m_Pos;
|
wxPoint normEnd = m_ArcEnd - m_Pos;
|
||||||
|
|
||||||
if( ( normStart == nullPoint ) || ( normEnd == nullPoint )
|
if( ( normStart == nullPoint ) || ( normEnd == nullPoint )
|
||||||
|| ( m_Rayon == 0 ) )
|
|| ( m_Radius == 0 ) )
|
||||||
{
|
{
|
||||||
wxLogDebug( wxT("Invalid arc drawing definition, center(%d, %d) \
|
wxLogDebug( wxT("Invalid arc drawing definition, center(%d, %d) \
|
||||||
start(%d, %d), end(%d, %d), radius %d" ),
|
start(%d, %d), end(%d, %d), radius %d" ),
|
||||||
m_Pos.x, m_Pos.y, m_ArcStart.x, m_ArcStart.y, m_ArcEnd.x,
|
m_Pos.x, m_Pos.y, m_ArcStart.x, m_ArcStart.y, m_ArcEnd.x,
|
||||||
m_ArcEnd.y, m_Rayon );
|
m_ArcEnd.y, m_Radius );
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
endPos = TransformCoordinate( DefaultTransformMatrix, m_ArcEnd );
|
endPos = TransformCoordinate( DefaultTransformMatrix, m_ArcEnd );
|
||||||
startPos = TransformCoordinate( DefaultTransformMatrix, m_ArcStart );
|
startPos = TransformCoordinate( DefaultTransformMatrix, m_ArcStart );
|
||||||
centerPos = TransformCoordinate( DefaultTransformMatrix, m_Pos );
|
centerPos = TransformCoordinate( DefaultTransformMatrix, m_Pos );
|
||||||
angleStart = t1;
|
angleStart = m_t1;
|
||||||
angleEnd = t2;
|
angleEnd = m_t2;
|
||||||
|
|
||||||
if( MapAngles( &angleStart, &angleEnd, DefaultTransformMatrix ) )
|
if( MapAngles( &angleStart, &angleEnd, DefaultTransformMatrix ) )
|
||||||
{
|
{
|
||||||
|
@ -354,20 +391,20 @@ start(%d, %d), end(%d, %d), radius %d" ),
|
||||||
|
|
||||||
/* Zero degrees is a special case. */
|
/* Zero degrees is a special case. */
|
||||||
if( angleStart == 0 )
|
if( angleStart == 0 )
|
||||||
maxX = centerPos.x + m_Rayon;
|
maxX = centerPos.x + m_Radius;
|
||||||
|
|
||||||
/* Arc end angle wrapped passed 360. */
|
/* Arc end angle wrapped passed 360. */
|
||||||
if( angleStart > angleEnd )
|
if( angleStart > angleEnd )
|
||||||
angleEnd += 3600;
|
angleEnd += 3600;
|
||||||
|
|
||||||
if( angleStart <= 900 && angleEnd >= 900 ) /* 90 deg */
|
if( angleStart <= 900 && angleEnd >= 900 ) /* 90 deg */
|
||||||
maxY = centerPos.y + m_Rayon;
|
maxY = centerPos.y + m_Radius;
|
||||||
if( angleStart <= 1800 && angleEnd >= 1800 ) /* 180 deg */
|
if( angleStart <= 1800 && angleEnd >= 1800 ) /* 180 deg */
|
||||||
minX = centerPos.x - m_Rayon;
|
minX = centerPos.x - m_Radius;
|
||||||
if( angleStart <= 2700 && angleEnd >= 2700 ) /* 270 deg */
|
if( angleStart <= 2700 && angleEnd >= 2700 ) /* 270 deg */
|
||||||
minY = centerPos.y - m_Rayon;
|
minY = centerPos.y - m_Radius;
|
||||||
if( angleStart <= 3600 && angleEnd >= 3600 ) /* 0 deg */
|
if( angleStart <= 3600 && angleEnd >= 3600 ) /* 0 deg */
|
||||||
maxX = centerPos.x + m_Rayon;
|
maxX = centerPos.x + m_Radius;
|
||||||
|
|
||||||
rect.SetOrigin( minX, minY );
|
rect.SetOrigin( minX, minY );
|
||||||
rect.SetEnd( maxX, maxY );
|
rect.SetEnd( maxX, maxY );
|
||||||
|
@ -403,7 +440,7 @@ void LibDrawArc::DisplayInfo( WinEDA_DrawFrame* frame )
|
||||||
LibDrawCircle::LibDrawCircle( EDA_LibComponentStruct* aParent ) :
|
LibDrawCircle::LibDrawCircle( EDA_LibComponentStruct* aParent ) :
|
||||||
LibEDA_BaseStruct( COMPONENT_CIRCLE_DRAW_TYPE, aParent )
|
LibEDA_BaseStruct( COMPONENT_CIRCLE_DRAW_TYPE, aParent )
|
||||||
{
|
{
|
||||||
m_Rayon = 0;
|
m_Radius = 0;
|
||||||
m_Fill = NO_FILL;
|
m_Fill = NO_FILL;
|
||||||
m_typeName = _( "Circle" );
|
m_typeName = _( "Circle" );
|
||||||
}
|
}
|
||||||
|
@ -411,8 +448,9 @@ LibDrawCircle::LibDrawCircle( EDA_LibComponentStruct* aParent ) :
|
||||||
|
|
||||||
bool LibDrawCircle::Save( FILE* ExportFile ) const
|
bool LibDrawCircle::Save( FILE* ExportFile ) const
|
||||||
{
|
{
|
||||||
fprintf( ExportFile, "C %d %d %d %d %d %d %c\n", m_Pos.x, m_Pos.y,
|
if( fprintf( ExportFile, "C %d %d %d %d %d %d %c\n", m_Pos.x, m_Pos.y,
|
||||||
m_Rayon, m_Unit, m_Convert, m_Width, fill_tab[m_Fill] );
|
m_Radius, m_Unit, m_Convert, m_Width, fill_tab[m_Fill] ) < 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -423,7 +461,7 @@ bool LibDrawCircle::Load( char* line, wxString& errorMsg )
|
||||||
char tmp[256];
|
char tmp[256];
|
||||||
|
|
||||||
int cnt = sscanf( &line[2], "%d %d %d %d %d %d %s", &m_Pos.x, &m_Pos.y,
|
int cnt = sscanf( &line[2], "%d %d %d %d %d %d %s", &m_Pos.x, &m_Pos.y,
|
||||||
&m_Rayon, &m_Unit, &m_Convert, &m_Width, tmp );
|
&m_Radius, &m_Unit, &m_Convert, &m_Width, tmp );
|
||||||
|
|
||||||
if( cnt < 6 )
|
if( cnt < 6 )
|
||||||
{
|
{
|
||||||
|
@ -462,10 +500,12 @@ bool LibDrawCircle::HitTest( const wxPoint& aPosRef )
|
||||||
/** Function HitTest
|
/** Function HitTest
|
||||||
* @return true if the point aPosRef is near this object
|
* @return true if the point aPosRef is near this object
|
||||||
* @param aPosRef = a wxPoint to test
|
* @param aPosRef = a wxPoint to test
|
||||||
* @param aThreshold = max distance to this object (usually the half thickness of a line)
|
* @param aThreshold = max distance to this object (usually the half
|
||||||
|
* thickness of a line)
|
||||||
* @param aTransMat = the transform matrix
|
* @param aTransMat = the transform matrix
|
||||||
*/
|
*/
|
||||||
bool LibDrawCircle::HitTest( wxPoint aPosRef, int aThreshold, const int aTransMat[2][2] )
|
bool LibDrawCircle::HitTest( wxPoint aPosRef, int aThreshold,
|
||||||
|
const int aTransMat[2][2] )
|
||||||
{
|
{
|
||||||
wxPoint relpos = aPosRef - TransformCoordinate( aTransMat, m_Pos );
|
wxPoint relpos = aPosRef - TransformCoordinate( aTransMat, m_Pos );
|
||||||
|
|
||||||
|
@ -473,7 +513,7 @@ bool LibDrawCircle::HitTest( wxPoint aPosRef, int aThreshold, const int aTransMa
|
||||||
wxRound( sqrt( ( (double) relpos.x * relpos.x ) +
|
wxRound( sqrt( ( (double) relpos.x * relpos.x ) +
|
||||||
( (double) relpos.y * relpos.y ) ) );
|
( (double) relpos.y * relpos.y ) ) );
|
||||||
|
|
||||||
if( abs( dist - m_Rayon ) <= aThreshold )
|
if( abs( dist - m_Radius ) <= aThreshold )
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -484,7 +524,7 @@ LibEDA_BaseStruct* LibDrawCircle::DoGenCopy()
|
||||||
LibDrawCircle* newitem = new LibDrawCircle( GetParent() );
|
LibDrawCircle* newitem = new LibDrawCircle( GetParent() );
|
||||||
|
|
||||||
newitem->m_Pos = m_Pos;
|
newitem->m_Pos = m_Pos;
|
||||||
newitem->m_Rayon = m_Rayon;
|
newitem->m_Radius = m_Radius;
|
||||||
newitem->m_Width = m_Width;
|
newitem->m_Width = m_Width;
|
||||||
newitem->m_Unit = m_Unit;
|
newitem->m_Unit = m_Unit;
|
||||||
newitem->m_Convert = m_Convert;
|
newitem->m_Convert = m_Convert;
|
||||||
|
@ -495,6 +535,32 @@ LibEDA_BaseStruct* LibDrawCircle::DoGenCopy()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool LibDrawCircle::DoCompare( const LibEDA_BaseStruct& other ) const
|
||||||
|
{
|
||||||
|
wxASSERT( other.Type() == COMPONENT_CIRCLE_DRAW_TYPE );
|
||||||
|
|
||||||
|
const LibDrawCircle* tmp = ( LibDrawCircle* ) &other;
|
||||||
|
|
||||||
|
return ( ( m_Pos == tmp->m_Pos ) && ( m_Radius == tmp->m_Radius ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LibDrawCircle::DoOffset( const wxPoint& offset )
|
||||||
|
{
|
||||||
|
m_Pos += offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool LibDrawCircle::DoTestInside( EDA_Rect& rect )
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* FIXME: This fails to take into acount the radius around the center
|
||||||
|
* point.
|
||||||
|
*/
|
||||||
|
return rect.Inside( m_Pos.x, -m_Pos.y );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Function GetPenSize
|
/** Function GetPenSize
|
||||||
* @return the size of the "pen" that be used to draw or plot this item
|
* @return the size of the "pen" that be used to draw or plot this item
|
||||||
*/
|
*/
|
||||||
|
@ -529,14 +595,14 @@ void LibDrawCircle::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
|
|
||||||
if( fill == FILLED_WITH_BG_BODYCOLOR )
|
if( fill == FILLED_WITH_BG_BODYCOLOR )
|
||||||
GRFilledCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y,
|
GRFilledCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y,
|
||||||
m_Rayon, GetPenSize( ), color,
|
m_Radius, GetPenSize( ), color,
|
||||||
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
||||||
else if( fill == FILLED_SHAPE )
|
else if( fill == FILLED_SHAPE )
|
||||||
GRFilledCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y,
|
GRFilledCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y,
|
||||||
m_Rayon, 0, color, color );
|
m_Radius, 0, color, color );
|
||||||
else
|
else
|
||||||
GRCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y,
|
GRCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y,
|
||||||
m_Rayon, GetPenSize( ), color );
|
m_Radius, GetPenSize( ), color );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -544,8 +610,8 @@ EDA_Rect LibDrawCircle::GetBoundingBox()
|
||||||
{
|
{
|
||||||
EDA_Rect rect;
|
EDA_Rect rect;
|
||||||
|
|
||||||
rect.SetOrigin( m_Pos.x - m_Rayon, ( m_Pos.y - m_Rayon ) * -1 );
|
rect.SetOrigin( m_Pos.x - m_Radius, ( m_Pos.y - m_Radius ) * -1 );
|
||||||
rect.SetEnd( m_Pos.x + m_Rayon, ( m_Pos.y + m_Rayon ) * -1 );
|
rect.SetEnd( m_Pos.x + m_Radius, ( m_Pos.y + m_Radius ) * -1 );
|
||||||
rect.Inflate( m_Width / 2, m_Width / 2 );
|
rect.Inflate( m_Width / 2, m_Width / 2 );
|
||||||
|
|
||||||
return rect;
|
return rect;
|
||||||
|
@ -564,7 +630,7 @@ void LibDrawCircle::DisplayInfo( WinEDA_DrawFrame* frame )
|
||||||
|
|
||||||
frame->MsgPanel->Affiche_1_Parametre( 20, _( "Line width" ), msg, BLUE );
|
frame->MsgPanel->Affiche_1_Parametre( 20, _( "Line width" ), msg, BLUE );
|
||||||
|
|
||||||
msg = ReturnStringFromValue( g_UnitMetric, m_Rayon,
|
msg = ReturnStringFromValue( g_UnitMetric, m_Radius,
|
||||||
EESCHEMA_INTERNAL_UNIT, true );
|
EESCHEMA_INTERNAL_UNIT, true );
|
||||||
frame->MsgPanel->Affiche_1_Parametre( 40, _( "Radius" ), msg, RED );
|
frame->MsgPanel->Affiche_1_Parametre( 40, _( "Radius" ), msg, RED );
|
||||||
|
|
||||||
|
@ -590,8 +656,10 @@ LibDrawSquare::LibDrawSquare( EDA_LibComponentStruct* aParent ) :
|
||||||
|
|
||||||
bool LibDrawSquare::Save( FILE* ExportFile ) const
|
bool LibDrawSquare::Save( FILE* ExportFile ) const
|
||||||
{
|
{
|
||||||
fprintf( ExportFile, "S %d %d %d %d %d %d %d %c\n", m_Pos.x, m_Pos.y,
|
if( fprintf( ExportFile, "S %d %d %d %d %d %d %d %c\n", m_Pos.x, m_Pos.y,
|
||||||
m_End.x, m_End.y, m_Unit, m_Convert, m_Width, fill_tab[m_Fill] );
|
m_End.x, m_End.y, m_Unit, m_Convert, m_Width,
|
||||||
|
fill_tab[m_Fill] ) < 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -637,6 +705,29 @@ LibEDA_BaseStruct* LibDrawSquare::DoGenCopy()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool LibDrawSquare::DoCompare( const LibEDA_BaseStruct& other ) const
|
||||||
|
{
|
||||||
|
wxASSERT( other.Type() == COMPONENT_RECT_DRAW_TYPE );
|
||||||
|
|
||||||
|
const LibDrawSquare* tmp = ( LibDrawSquare* ) &other;
|
||||||
|
|
||||||
|
return ( ( m_Pos == tmp->m_Pos ) && ( m_End == tmp->m_End ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LibDrawSquare::DoOffset( const wxPoint& offset )
|
||||||
|
{
|
||||||
|
m_Pos += offset;
|
||||||
|
m_End += offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool LibDrawSquare::DoTestInside( EDA_Rect& rect )
|
||||||
|
{
|
||||||
|
return rect.Inside( m_Pos.x, -m_Pos.y ) || rect.Inside( m_End.x, -m_End.y );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Function GetPenSize
|
/** Function GetPenSize
|
||||||
* @return the size of the "pen" that be used to draw or plot this item
|
* @return the size of the "pen" that be used to draw or plot this item
|
||||||
*/
|
*/
|
||||||
|
@ -782,7 +873,8 @@ LibDrawSegment::LibDrawSegment( EDA_LibComponentStruct* aParent ) :
|
||||||
|
|
||||||
bool LibDrawSegment::Save( FILE* ExportFile ) const
|
bool LibDrawSegment::Save( FILE* ExportFile ) const
|
||||||
{
|
{
|
||||||
fprintf( ExportFile, "L %d %d %d", m_Unit, m_Convert, m_Width );
|
if( fprintf( ExportFile, "L %d %d %d", m_Unit, m_Convert, m_Width ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -809,6 +901,29 @@ LibEDA_BaseStruct* LibDrawSegment::DoGenCopy()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool LibDrawSegment::DoCompare( const LibEDA_BaseStruct& other ) const
|
||||||
|
{
|
||||||
|
wxASSERT( other.Type() == COMPONENT_LINE_DRAW_TYPE );
|
||||||
|
|
||||||
|
const LibDrawSegment* tmp = ( LibDrawSegment* ) &other;
|
||||||
|
|
||||||
|
return ( ( m_Pos == tmp->m_Pos ) && ( m_End == tmp->m_End ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LibDrawSegment::DoOffset( const wxPoint& offset )
|
||||||
|
{
|
||||||
|
m_Pos += offset;
|
||||||
|
m_End += offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool LibDrawSegment::DoTestInside( EDA_Rect& rect )
|
||||||
|
{
|
||||||
|
return rect.Inside( m_Pos.x, -m_Pos.y ) || rect.Inside( m_End.x, -m_End.y );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Function GetPenSize
|
/** Function GetPenSize
|
||||||
* @return the size of the "pen" that be used to draw or plot this item
|
* @return the size of the "pen" that be used to draw or plot this item
|
||||||
*/
|
*/
|
||||||
|
@ -913,14 +1028,19 @@ bool LibDrawPolyline::Save( FILE* ExportFile ) const
|
||||||
{
|
{
|
||||||
int ccount = GetCornerCount();
|
int ccount = GetCornerCount();
|
||||||
|
|
||||||
fprintf( ExportFile, "P %d %d %d %d", ccount, m_Unit, m_Convert, m_Width );
|
if( fprintf( ExportFile, "P %d %d %d %d",
|
||||||
|
ccount, m_Unit, m_Convert, m_Width ) < 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
for( unsigned i = 0; i < GetCornerCount(); i++ )
|
for( unsigned i = 0; i < GetCornerCount(); i++ )
|
||||||
{
|
{
|
||||||
fprintf( ExportFile, " %d %d", m_PolyPoints[i].x, m_PolyPoints[i].y );
|
if( fprintf( ExportFile, " %d %d",
|
||||||
|
m_PolyPoints[i].x, m_PolyPoints[i].y ) < 0 )
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf( ExportFile, " %c\n", fill_tab[m_Fill] );
|
if( fprintf( ExportFile, " %c\n", fill_tab[m_Fill] ) < 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1001,6 +1121,43 @@ LibEDA_BaseStruct* LibDrawPolyline::DoGenCopy()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool LibDrawPolyline::DoCompare( const LibEDA_BaseStruct& other ) const
|
||||||
|
{
|
||||||
|
wxASSERT( other.Type() == COMPONENT_POLYLINE_DRAW_TYPE );
|
||||||
|
|
||||||
|
const LibDrawPolyline* tmp = ( LibDrawPolyline* ) &other;
|
||||||
|
|
||||||
|
if( m_PolyPoints.size() != tmp->m_PolyPoints.size() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
for( size_t i = 0; i < m_PolyPoints.size(); i++ )
|
||||||
|
{
|
||||||
|
if( m_PolyPoints[i] != tmp->m_PolyPoints[i] )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LibDrawPolyline::DoOffset( const wxPoint& offset )
|
||||||
|
{
|
||||||
|
for( size_t i = 0; i < m_PolyPoints.size(); i++ )
|
||||||
|
m_PolyPoints[i] += offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool LibDrawPolyline::DoTestInside( EDA_Rect& rect )
|
||||||
|
{
|
||||||
|
for( size_t i = 0; i < m_PolyPoints.size(); i++ )
|
||||||
|
{
|
||||||
|
if( rect.Inside( m_PolyPoints[i].x, -m_PolyPoints[i].y ) )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void LibDrawPolyline::AddPoint( const wxPoint& point )
|
void LibDrawPolyline::AddPoint( const wxPoint& point )
|
||||||
{
|
{
|
||||||
m_PolyPoints.push_back( point );
|
m_PolyPoints.push_back( point );
|
||||||
|
@ -1176,15 +1333,19 @@ bool LibDrawBezier::Save( FILE* ExportFile ) const
|
||||||
{
|
{
|
||||||
int ccount = GetCornerCount();
|
int ccount = GetCornerCount();
|
||||||
|
|
||||||
fprintf( ExportFile, "B %d %d %d %d", ccount, m_Unit, m_Convert, m_Width );
|
if( fprintf( ExportFile, "B %d %d %d %d",
|
||||||
|
ccount, m_Unit, m_Convert, m_Width ) < 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
for( unsigned i = 0; i < GetCornerCount(); i++ )
|
for( unsigned i = 0; i < GetCornerCount(); i++ )
|
||||||
{
|
{
|
||||||
fprintf( ExportFile, " %d %d", m_BezierPoints[i].x,
|
if( fprintf( ExportFile, " %d %d", m_BezierPoints[i].x,
|
||||||
m_BezierPoints[i].y );
|
m_BezierPoints[i].y ) < 0 )
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf( ExportFile, " %c\n", fill_tab[m_Fill] );
|
if( fprintf( ExportFile, " %c\n", fill_tab[m_Fill] ) < 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1262,6 +1423,50 @@ LibEDA_BaseStruct* LibDrawBezier::DoGenCopy()
|
||||||
return (LibEDA_BaseStruct*) newitem;
|
return (LibEDA_BaseStruct*) newitem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool LibDrawBezier::DoCompare( const LibEDA_BaseStruct& other ) const
|
||||||
|
{
|
||||||
|
wxASSERT( other.Type() == COMPONENT_BEZIER_DRAW_TYPE );
|
||||||
|
|
||||||
|
const LibDrawBezier* tmp = ( LibDrawBezier* ) &other;
|
||||||
|
|
||||||
|
if( m_BezierPoints.size() != tmp->m_BezierPoints.size() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
for( size_t i = 0; i < m_BezierPoints.size(); i++ )
|
||||||
|
{
|
||||||
|
if( m_BezierPoints[i] != tmp->m_BezierPoints[i] )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LibDrawBezier::DoOffset( const wxPoint& offset )
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
for( i = 0; i < m_BezierPoints.size(); i++ )
|
||||||
|
m_BezierPoints[i] += offset;
|
||||||
|
|
||||||
|
for( i = 0; i < m_PolyPoints.size(); i++ )
|
||||||
|
m_PolyPoints[i] += offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool LibDrawBezier::DoTestInside( EDA_Rect& rect )
|
||||||
|
{
|
||||||
|
for( size_t i = 0; i < m_PolyPoints.size(); i++ )
|
||||||
|
{
|
||||||
|
if( rect.Inside( m_PolyPoints[i].x, -m_PolyPoints[i].y ) )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Function GetPenSize
|
/** Function GetPenSize
|
||||||
* @return the size of the "pen" that be used to draw or plot this item
|
* @return the size of the "pen" that be used to draw or plot this item
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -189,8 +189,49 @@ public:
|
||||||
*/
|
*/
|
||||||
LibEDA_BaseStruct* GenCopy() { return DoGenCopy(); }
|
LibEDA_BaseStruct* GenCopy() { return DoGenCopy(); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test LibEDA_BaseStruct objects for equivalence.
|
||||||
|
*
|
||||||
|
* @param tst - Object to test against.
|
||||||
|
*
|
||||||
|
* @return bool - True if object is identical to this object.
|
||||||
|
*/
|
||||||
|
bool operator==( const LibEDA_BaseStruct& other ) const;
|
||||||
|
bool operator==( const LibEDA_BaseStruct* other ) const
|
||||||
|
{
|
||||||
|
return *this == *other;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set drawing object offset from the current position.
|
||||||
|
*
|
||||||
|
* @param offset - Cooridinates to offset position.
|
||||||
|
*/
|
||||||
|
void SetOffset( const wxPoint offset ) { DoOffset( offset ); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test if any part of the draw object is inside rectangle bounds.
|
||||||
|
*
|
||||||
|
* This is used for block selection. The real work is done by the
|
||||||
|
* DoTestInside method for each derived object type.
|
||||||
|
*
|
||||||
|
* @param rect - Rectangle to check against.
|
||||||
|
*
|
||||||
|
* @return bool - True if object is inside rectangle.
|
||||||
|
*/
|
||||||
|
bool Inside( EDA_Rect& rect ) { return DoTestInside( rect ); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual LibEDA_BaseStruct* DoGenCopy() = 0;
|
virtual LibEDA_BaseStruct* DoGenCopy() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provide the draw object specific comparison.
|
||||||
|
*
|
||||||
|
* This is called by the == operator.
|
||||||
|
*/
|
||||||
|
virtual bool DoCompare( const LibEDA_BaseStruct& other ) const = 0;
|
||||||
|
virtual void DoOffset( const wxPoint& offset ) = 0;
|
||||||
|
virtual bool DoTestInside( EDA_Rect& rect ) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -318,6 +359,9 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual LibEDA_BaseStruct* DoGenCopy();
|
virtual LibEDA_BaseStruct* DoGenCopy();
|
||||||
|
virtual bool DoCompare( const LibEDA_BaseStruct& other ) const;
|
||||||
|
virtual void DoOffset( const wxPoint& offset );
|
||||||
|
virtual bool DoTestInside( EDA_Rect& rect );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -328,8 +372,9 @@ protected:
|
||||||
class LibDrawArc : public LibEDA_BaseStruct
|
class LibDrawArc : public LibEDA_BaseStruct
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int m_Rayon;
|
int m_Radius;
|
||||||
int t1, t2; /* position des 2 extremites de l'arc en 0.1 degres */
|
int m_t1;
|
||||||
|
int m_t2; /* position des 2 extremites de l'arc en 0.1 degres */
|
||||||
wxPoint m_ArcStart;
|
wxPoint m_ArcStart;
|
||||||
wxPoint m_ArcEnd; /* position des 2 extremites de l'arc en coord reelles*/
|
wxPoint m_ArcEnd; /* position des 2 extremites de l'arc en coord reelles*/
|
||||||
wxPoint m_Pos; /* Position or centre (Arc and Circle) or start point
|
wxPoint m_Pos; /* Position or centre (Arc and Circle) or start point
|
||||||
|
@ -386,6 +431,9 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual LibEDA_BaseStruct* DoGenCopy();
|
virtual LibEDA_BaseStruct* DoGenCopy();
|
||||||
|
virtual bool DoCompare( const LibEDA_BaseStruct& other ) const;
|
||||||
|
virtual void DoOffset( const wxPoint& offset );
|
||||||
|
virtual bool DoTestInside( EDA_Rect& rect );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -395,7 +443,7 @@ protected:
|
||||||
class LibDrawCircle : public LibEDA_BaseStruct
|
class LibDrawCircle : public LibEDA_BaseStruct
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int m_Rayon;
|
int m_Radius;
|
||||||
wxPoint m_Pos; /* Position or centre (Arc and Circle) or start
|
wxPoint m_Pos; /* Position or centre (Arc and Circle) or start
|
||||||
* point (segments) */
|
* point (segments) */
|
||||||
int m_Width; /* Line width */
|
int m_Width; /* Line width */
|
||||||
|
@ -451,6 +499,9 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual LibEDA_BaseStruct* DoGenCopy();
|
virtual LibEDA_BaseStruct* DoGenCopy();
|
||||||
|
virtual bool DoCompare( const LibEDA_BaseStruct& other ) const;
|
||||||
|
virtual void DoOffset( const wxPoint& offset );
|
||||||
|
virtual bool DoTestInside( EDA_Rect& rect );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -523,6 +574,9 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual LibEDA_BaseStruct* DoGenCopy();
|
virtual LibEDA_BaseStruct* DoGenCopy();
|
||||||
|
virtual bool DoCompare( const LibEDA_BaseStruct& other ) const;
|
||||||
|
virtual void DoOffset( const wxPoint& offset );
|
||||||
|
virtual bool DoTestInside( EDA_Rect& rect );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -587,6 +641,9 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual LibEDA_BaseStruct* DoGenCopy();
|
virtual LibEDA_BaseStruct* DoGenCopy();
|
||||||
|
virtual bool DoCompare( const LibEDA_BaseStruct& other ) const;
|
||||||
|
virtual void DoOffset( const wxPoint& offset );
|
||||||
|
virtual bool DoTestInside( EDA_Rect& rect );
|
||||||
};
|
};
|
||||||
|
|
||||||
/**********************************/
|
/**********************************/
|
||||||
|
@ -650,6 +707,9 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual LibEDA_BaseStruct* DoGenCopy();
|
virtual LibEDA_BaseStruct* DoGenCopy();
|
||||||
|
virtual bool DoCompare( const LibEDA_BaseStruct& other ) const;
|
||||||
|
virtual void DoOffset( const wxPoint& offset );
|
||||||
|
virtual bool DoTestInside( EDA_Rect& rect );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -724,6 +784,9 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual LibEDA_BaseStruct* DoGenCopy();
|
virtual LibEDA_BaseStruct* DoGenCopy();
|
||||||
|
virtual bool DoCompare( const LibEDA_BaseStruct& other ) const;
|
||||||
|
virtual void DoOffset( const wxPoint& offset );
|
||||||
|
virtual bool DoTestInside( EDA_Rect& rect );
|
||||||
};
|
};
|
||||||
|
|
||||||
/**********************************************************/
|
/**********************************************************/
|
||||||
|
@ -798,6 +861,9 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual LibEDA_BaseStruct* DoGenCopy();
|
virtual LibEDA_BaseStruct* DoGenCopy();
|
||||||
|
virtual bool DoCompare( const LibEDA_BaseStruct& other ) const;
|
||||||
|
virtual void DoOffset( const wxPoint& offset );
|
||||||
|
virtual bool DoTestInside( EDA_Rect& rect );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CLASSES_BODY_ITEMS_H
|
#endif // CLASSES_BODY_ITEMS_H
|
||||||
|
|
|
@ -397,7 +397,6 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateStatusBar(); /* Affichage des coord curseur */
|
UpdateStatusBar(); /* Affichage des coord curseur */
|
||||||
SetToolbars();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -44,20 +44,19 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::Init( )
|
||||||
{
|
{
|
||||||
SetFocus();
|
SetFocus();
|
||||||
m_AliasLocation = -1;
|
m_AliasLocation = -1;
|
||||||
|
|
||||||
if( CurrentLibEntry == NULL )
|
if( CurrentLibEntry == NULL )
|
||||||
{
|
{
|
||||||
SetTitle( _( "Lib Component Properties" ) );
|
SetTitle( _( "Library Component Properties" ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString title = _( "Properties for " );
|
wxString title = _( "Properties for " );
|
||||||
|
|
||||||
if( !CurrentAliasName.IsEmpty() )
|
if( !CurrentAliasName.IsEmpty() )
|
||||||
{
|
{
|
||||||
m_AliasLocation = LocateAlias( CurrentLibEntry->m_AliasList, CurrentAliasName );
|
title += CurrentAliasName + _( " (alias of " ) +
|
||||||
title += CurrentAliasName +
|
wxString( CurrentLibEntry->m_Name.m_Text )+ wxT( ")" );
|
||||||
_( "(alias of " ) +
|
|
||||||
wxString( CurrentLibEntry->m_Name.m_Text )
|
|
||||||
+ wxT( ")" );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -76,11 +75,11 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::Init( )
|
||||||
/* Place list of alias names in listbox */
|
/* Place list of alias names in listbox */
|
||||||
if( CurrentLibEntry )
|
if( CurrentLibEntry )
|
||||||
{
|
{
|
||||||
for( unsigned ii = 0; ii < CurrentLibEntry->m_AliasList.GetCount(); ii += ALIAS_NEXT )
|
m_PartAliasList->Append( CurrentLibEntry->m_AliasList );
|
||||||
m_PartAliasList->Append( CurrentLibEntry->m_AliasList[ii + ALIAS_NAME] );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (CurrentLibEntry == NULL) || (CurrentLibEntry->m_AliasList.GetCount() == 0) )
|
if( ( CurrentLibEntry == NULL )
|
||||||
|
|| ( CurrentLibEntry->m_AliasList.GetCount() == 0 ) )
|
||||||
{
|
{
|
||||||
m_ButtonDeleteAllAlias->Enable( false );
|
m_ButtonDeleteAllAlias->Enable( false );
|
||||||
m_ButtonDeleteOneAlias->Enable( false );
|
m_ButtonDeleteOneAlias->Enable( false );
|
||||||
|
@ -89,21 +88,20 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::Init( )
|
||||||
/* Read the Footprint Filter list */
|
/* Read the Footprint Filter list */
|
||||||
if( CurrentLibEntry )
|
if( CurrentLibEntry )
|
||||||
{
|
{
|
||||||
for( unsigned ii = 0; ii < CurrentLibEntry->m_FootprintList.GetCount(); ii++ )
|
m_FootprintFilterListBox->Append( CurrentLibEntry->m_FootprintList );
|
||||||
m_FootprintFilterListBox->Append( CurrentLibEntry->m_FootprintList[ii] );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (CurrentLibEntry == NULL) || (CurrentLibEntry->m_FootprintList.GetCount() == 0) )
|
if( ( CurrentLibEntry == NULL )
|
||||||
|
|| ( CurrentLibEntry->m_FootprintList.GetCount() == 0 ) )
|
||||||
{
|
{
|
||||||
m_ButtonDeleteAllFootprintFilter->Enable( false );
|
m_ButtonDeleteAllFootprintFilter->Enable( false );
|
||||||
m_ButtonDeleteOneFootprintFilter->Enable( false );
|
m_ButtonDeleteOneFootprintFilter->Enable( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnCancelClick( wxCommandEvent& event )
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnCancelClick( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
EndModal(0);
|
EndModal( wxID_CANCEL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -217,15 +217,13 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick( wxCommandEvent& event
|
||||||
/* A new name could be entered in VALUE field.
|
/* 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 */
|
||||||
wxString* newvalue = &m_FieldsBuf[VALUE].m_Text;
|
wxString* newvalue = &m_FieldsBuf[VALUE].m_Text;
|
||||||
for( unsigned ii = 0; ii < m_LibEntry->m_AliasList.GetCount(); ii += ALIAS_NEXT )
|
for( size_t i = 0; i < m_LibEntry->m_AliasList.GetCount(); i++ )
|
||||||
{
|
{
|
||||||
wxString* libname = &(m_LibEntry->m_AliasList[ii + ALIAS_NAME]);
|
if( newvalue->CmpNoCase( m_LibEntry->m_AliasList[i] ) == 0 )
|
||||||
if( newvalue->CmpNoCase( *libname ) == 0 )
|
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf(
|
msg.Printf( _( "A new name is entered for this component\nAn \
|
||||||
_(
|
alias %s already exists!\nCannot update this component" ),
|
||||||
"A new name is entered for this component\nAn alias %s already exists!\nCannot update this component" ),
|
|
||||||
newvalue->GetData() );
|
newvalue->GetData() );
|
||||||
DisplayError( this, msg );
|
DisplayError( this, msg );
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -30,70 +30,59 @@ extern int CurrentUnit;
|
||||||
#include "dialog_edit_component_in_lib.h"
|
#include "dialog_edit_component_in_lib.h"
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
void WinEDA_LibeditFrame::OnEditComponentProperties( wxCommandEvent& event )
|
||||||
void WinEDA_LibeditFrame::InstallLibeditFrame( void )
|
|
||||||
/*****************************************************************/
|
|
||||||
{
|
{
|
||||||
DIALOG_EDIT_COMPONENT_IN_LIBRARY* frame =
|
EditComponentProperties();
|
||||||
new DIALOG_EDIT_COMPONENT_IN_LIBRARY( this );
|
}
|
||||||
|
|
||||||
int IsModified = frame->ShowModal(); frame->Destroy();
|
|
||||||
|
|
||||||
if( IsModified )
|
void WinEDA_LibeditFrame::EditComponentProperties()
|
||||||
Refresh();
|
{
|
||||||
|
wxASSERT( CurrentLibEntry != NULL && CurrentLib != NULL );
|
||||||
|
|
||||||
|
DIALOG_EDIT_COMPONENT_IN_LIBRARY dlg( this );
|
||||||
|
|
||||||
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
|
return;
|
||||||
|
|
||||||
|
UpdateAliasSelectList();
|
||||||
|
UpdatePartSelectList();
|
||||||
|
DisplayLibInfos();
|
||||||
|
GetScreen()->SetModify();
|
||||||
|
SaveCopyInUndoList( CurrentLibEntry );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************/
|
|
||||||
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitPanelDoc()
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitPanelDoc()
|
||||||
/*****************************************************/
|
{
|
||||||
|
LibCmpEntry* entry;
|
||||||
|
|
||||||
/* create the panel for component doc editing
|
if( CurrentLibEntry == NULL )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if( CurrentAliasName.IsEmpty() )
|
||||||
|
{
|
||||||
|
entry = CurrentLibEntry;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
entry = ( LibCmpEntry* ) CurrentLib->FindAlias( CurrentAliasName );
|
||||||
|
|
||||||
|
if( entry == NULL )
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Doc->SetValue( entry->m_Doc );
|
||||||
|
m_Keywords->SetValue( entry->m_KeyWord );
|
||||||
|
m_Docfile->SetValue( entry->m_DocFile );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* create the basic panel for component properties editing
|
||||||
*/
|
*/
|
||||||
{
|
|
||||||
wxString msg_text;
|
|
||||||
|
|
||||||
if( m_AliasLocation >= 0 )
|
|
||||||
msg_text = CurrentLibEntry->m_AliasList[m_AliasLocation + ALIAS_DOC];
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( CurrentLibEntry )
|
|
||||||
msg_text = CurrentLibEntry->m_Doc;
|
|
||||||
}
|
|
||||||
m_Doc->SetValue( msg_text );
|
|
||||||
|
|
||||||
msg_text.Empty();
|
|
||||||
if( m_AliasLocation >= 0 )
|
|
||||||
msg_text = CurrentLibEntry->m_AliasList[m_AliasLocation + ALIAS_KEYWORD];
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( CurrentLibEntry )
|
|
||||||
msg_text = CurrentLibEntry->m_KeyWord;
|
|
||||||
}
|
|
||||||
m_Keywords->SetValue( msg_text );
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
m_Docfile->SetValue( msg_text );
|
|
||||||
|
|
||||||
if( m_AliasLocation < 0 )
|
|
||||||
m_ButtonCopyDoc->Enable( FALSE );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************/
|
|
||||||
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitBasicPanel()
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitBasicPanel()
|
||||||
/*****************************************************/
|
|
||||||
|
|
||||||
/* create the basic panel for component properties editing
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
if( g_AsDeMorgan )
|
if( g_AsDeMorgan )
|
||||||
m_AsConvertButt->SetValue( TRUE );
|
m_AsConvertButt->SetValue( TRUE );
|
||||||
|
@ -135,101 +124,96 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitBasicPanel()
|
||||||
number = 40;
|
number = 40;
|
||||||
m_SetSkew->SetValue( number );
|
m_SetSkew->SetValue( number );
|
||||||
|
|
||||||
if( CurrentLibEntry )
|
if( CurrentLibEntry && CurrentLibEntry->m_Options == ENTRY_POWER )
|
||||||
{
|
|
||||||
if( CurrentLibEntry->m_Options == ENTRY_POWER )
|
|
||||||
m_OptionPower->SetValue( TRUE );
|
m_OptionPower->SetValue( TRUE );
|
||||||
}
|
|
||||||
|
|
||||||
if( CurrentLibEntry )
|
if( CurrentLibEntry && CurrentLibEntry->m_UnitSelectionLocked )
|
||||||
{
|
|
||||||
if( CurrentLibEntry->m_UnitSelectionLocked )
|
|
||||||
m_OptionPartsLocked->SetValue( TRUE );
|
m_OptionPartsLocked->SetValue( TRUE );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************/
|
|
||||||
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
|
||||||
/**************************************************************************/
|
|
||||||
|
|
||||||
/* Updaye the current component parameters
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
int ii, jj;
|
|
||||||
|
|
||||||
if( CurrentLibEntry == NULL )
|
|
||||||
{
|
|
||||||
Close(); return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_Parent->GetScreen()->SetModify();
|
|
||||||
m_Parent->SaveCopyInUndoList( CurrentLibEntry );
|
|
||||||
|
|
||||||
/* Update the doc, keyword and doc filename strings */
|
/* Update the doc, keyword and doc filename strings */
|
||||||
if( m_AliasLocation < 0 )
|
size_t i;
|
||||||
|
int index;
|
||||||
|
LibCmpEntry* entry;
|
||||||
|
|
||||||
|
if( CurrentAliasName.IsEmpty() )
|
||||||
{
|
{
|
||||||
CurrentLibEntry->m_Doc = m_Doc->GetValue();
|
entry = CurrentLibEntry;
|
||||||
CurrentLibEntry->m_KeyWord = m_Keywords->GetValue();
|
|
||||||
CurrentLibEntry->m_DocFile = m_Docfile->GetValue();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CurrentLibEntry->m_AliasList[m_AliasLocation + ALIAS_DOC] = m_Doc->GetValue();
|
entry = CurrentLib->FindEntry( CurrentAliasName );
|
||||||
CurrentLibEntry->m_AliasList[m_AliasLocation + ALIAS_KEYWORD] = m_Keywords->GetValue();
|
|
||||||
CurrentLibEntry->m_AliasList[m_AliasLocation + ALIAS_DOC_FILENAME] = m_Docfile->GetValue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update the alias list */
|
if( entry == NULL )
|
||||||
/* 1 - Add names: test for a not existing name in old alias list: */
|
|
||||||
jj = m_PartAliasList->GetCount();
|
|
||||||
for( ii = 0; ii < jj; ii++ )
|
|
||||||
{
|
{
|
||||||
if( LocateAlias( CurrentLibEntry->m_AliasList, m_PartAliasList->GetString( ii ) ) < 0 )
|
wxString msg;
|
||||||
|
msg.Printf( _( "Alias <%s> not found for component <%s> in library <%s>." ),
|
||||||
|
(const wxChar*) CurrentAliasName,
|
||||||
|
(const wxChar*) CurrentLibEntry->GetName(),
|
||||||
|
(const wxChar*) CurrentLib->m_Name );
|
||||||
|
wxMessageBox( msg, _( "Component Library Error" ),
|
||||||
|
wxID_OK | wxICON_ERROR, this );
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// new alias must be created
|
entry->m_Doc = m_Doc->GetValue();
|
||||||
CurrentLibEntry->m_AliasList.Add( m_PartAliasList->GetString( ii ) );
|
entry->m_KeyWord = m_Keywords->GetValue();
|
||||||
CurrentLibEntry->m_AliasList.Add( wxEmptyString ); // Add a void doc string
|
entry->m_DocFile = m_Docfile->GetValue();
|
||||||
CurrentLibEntry->m_AliasList.Add( wxEmptyString ); // Add a void keyword list string
|
}
|
||||||
CurrentLibEntry->m_AliasList.Add( wxEmptyString ); // Add a void doc filename string
|
|
||||||
|
if( m_PartAliasList->GetStrings() != CurrentLibEntry->m_AliasList )
|
||||||
|
{
|
||||||
|
EDA_LibCmpAliasStruct* alias;
|
||||||
|
wxArrayString aliases = m_PartAliasList->GetStrings();
|
||||||
|
|
||||||
|
/* Add names not existing in the old alias list. */
|
||||||
|
for( i = 0; i < aliases.GetCount(); i++ )
|
||||||
|
{
|
||||||
|
index = CurrentLibEntry->m_AliasList.Index( aliases[ i ], false );
|
||||||
|
|
||||||
|
if( index != wxNOT_FOUND )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
alias = new EDA_LibCmpAliasStruct( aliases[ i ],
|
||||||
|
CurrentLibEntry->GetName() );
|
||||||
|
if( !CurrentLib->AddAlias( alias ) )
|
||||||
|
{
|
||||||
|
delete alias;
|
||||||
|
alias = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 2 - Remove delete names: test for an non existing name in new alias list: */
|
/* Remove names and library alias entries not in the new alias list. */
|
||||||
int kk, kkmax = CurrentLibEntry->m_AliasList.GetCount();
|
for( i = 0; CurrentLibEntry->m_AliasList.GetCount(); i++ )
|
||||||
for( kk = 0; kk < kkmax; )
|
|
||||||
{
|
{
|
||||||
jj = m_PartAliasList->GetCount();
|
index = aliases.Index( CurrentLibEntry->m_AliasList[ i ], false );
|
||||||
wxString aliasname = CurrentLibEntry->m_AliasList[kk];
|
|
||||||
for( ii = 0; ii < jj; ii++ )
|
if( index == wxNOT_FOUND )
|
||||||
{
|
continue;
|
||||||
if( aliasname.CmpNoCase( m_PartAliasList->GetString( ii ).GetData() ) == 0 )
|
|
||||||
{
|
LibCmpEntry* alias =
|
||||||
kk += ALIAS_NEXT; // Alias exist in new list. keep it and test next old name
|
CurrentLib->FindAlias( CurrentLibEntry->m_AliasList[ i ] );
|
||||||
break;
|
if( alias != NULL )
|
||||||
}
|
CurrentLib->RemoveEntry( alias );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ii == jj ) // Alias not found in new list, remove it (4 strings in kk position)
|
CurrentLibEntry->m_AliasList = aliases;
|
||||||
{
|
|
||||||
for( ii = 0; ii < ALIAS_NEXT; ii++ )
|
|
||||||
CurrentLibEntry->m_AliasList.RemoveAt( kk );
|
|
||||||
|
|
||||||
kkmax = CurrentLibEntry->m_AliasList.GetCount();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ii = m_SelNumberOfUnits->GetValue();
|
index = m_SelNumberOfUnits->GetValue();
|
||||||
if( ChangeNbUnitsPerPackage( ii ) )
|
ChangeNbUnitsPerPackage( index );
|
||||||
m_RecreateToolbar = TRUE;
|
|
||||||
|
|
||||||
if( m_AsConvertButt->GetValue() )
|
if( m_AsConvertButt->GetValue() )
|
||||||
{
|
{
|
||||||
if( !g_AsDeMorgan )
|
if( !g_AsDeMorgan )
|
||||||
{
|
{
|
||||||
g_AsDeMorgan = 1;
|
g_AsDeMorgan = 1;
|
||||||
if( SetUnsetConvert() )
|
SetUnsetConvert();
|
||||||
m_RecreateToolbar = TRUE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -237,8 +221,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
|
||||||
if( g_AsDeMorgan )
|
if( g_AsDeMorgan )
|
||||||
{
|
{
|
||||||
g_AsDeMorgan = 0;
|
g_AsDeMorgan = 0;
|
||||||
if( SetUnsetConvert() )
|
SetUnsetConvert();
|
||||||
m_RecreateToolbar = TRUE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,18 +244,11 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
|
||||||
if( CurrentLibEntry->m_UnitCount <= 1 )
|
if( CurrentLibEntry->m_UnitCount <= 1 )
|
||||||
CurrentLibEntry->m_UnitSelectionLocked = FALSE;
|
CurrentLibEntry->m_UnitSelectionLocked = FALSE;
|
||||||
|
|
||||||
if( m_RecreateToolbar )
|
|
||||||
m_Parent->ReCreateHToolbar();
|
|
||||||
|
|
||||||
m_Parent->DisplayLibInfos();
|
|
||||||
|
|
||||||
/* Update the footprint filter list */
|
/* Update the footprint filter list */
|
||||||
CurrentLibEntry->m_FootprintList.Clear();
|
CurrentLibEntry->m_FootprintList.Clear();
|
||||||
jj = m_FootprintFilterListBox->GetCount();
|
CurrentLibEntry->m_FootprintList = m_FootprintFilterListBox->GetStrings();
|
||||||
for( ii = 0; ii < jj; ii++ )
|
|
||||||
CurrentLibEntry->m_FootprintList.Add( m_FootprintFilterListBox->GetString( ii ) );
|
|
||||||
|
|
||||||
EndModal( 1 );
|
EndModal( wxID_OK );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -280,9 +256,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
|
||||||
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::CopyDocToAlias( wxCommandEvent& WXUNUSED (event) )
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::CopyDocToAlias( wxCommandEvent& WXUNUSED (event) )
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
{
|
{
|
||||||
if( CurrentLibEntry == NULL )
|
if( CurrentLibEntry == NULL || CurrentAliasName.IsEmpty() )
|
||||||
return;
|
|
||||||
if( CurrentAliasName.IsEmpty() )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_Doc->SetValue( CurrentLibEntry->m_Doc );
|
m_Doc->SetValue( CurrentLibEntry->m_Doc );
|
||||||
|
@ -296,18 +270,25 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAllAliasOfPart(
|
||||||
wxCommandEvent& WXUNUSED (event) )
|
wxCommandEvent& WXUNUSED (event) )
|
||||||
/**********************************************************/
|
/**********************************************************/
|
||||||
{
|
{
|
||||||
CurrentAliasName.Empty();
|
if( m_PartAliasList->FindString( CurrentAliasName ) != wxNOT_FOUND )
|
||||||
if( CurrentLibEntry )
|
|
||||||
{
|
{
|
||||||
if( IsOK( this, _( "Ok to Delete Alias LIST" ) ) )
|
wxString msg;
|
||||||
|
msg.Printf( _( "Alias <%s> cannot be removed while it is being \
|
||||||
|
edited!" ),
|
||||||
|
(const wxChar*) CurrentAliasName );
|
||||||
|
DisplayError( this, msg );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CurrentAliasName.Empty();
|
||||||
|
|
||||||
|
if( IsOK( this, _( "Remove all aliases from list?" ) ) )
|
||||||
{
|
{
|
||||||
m_PartAliasList->Clear();
|
m_PartAliasList->Clear();
|
||||||
m_RecreateToolbar = TRUE;
|
|
||||||
m_ButtonDeleteAllAlias->Enable( FALSE );
|
m_ButtonDeleteAllAlias->Enable( FALSE );
|
||||||
m_ButtonDeleteOneAlias->Enable( FALSE );
|
m_ButtonDeleteOneAlias->Enable( FALSE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************/
|
/*******************************************************************************/
|
||||||
|
@ -330,56 +311,49 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddAliasOfPart( wxCommandEvent& WXUNUSED
|
||||||
Line.Replace( wxT( " " ), wxT( "_" ) );
|
Line.Replace( wxT( " " ), wxT( "_" ) );
|
||||||
aliasname = Line;
|
aliasname = Line;
|
||||||
|
|
||||||
if( CurrentLibEntry->m_Name.m_Text.CmpNoCase( Line ) == 0 )
|
if( m_PartAliasList->FindString( aliasname ) != wxNOT_FOUND
|
||||||
|
|| CurrentLib->FindEntry( aliasname ) != NULL )
|
||||||
{
|
{
|
||||||
DisplayError( this, _( "This is the Root Part" ), 10 ); return;
|
wxString msg;
|
||||||
}
|
msg.Printf( _( "Alias or component name <%s> already exists in \
|
||||||
|
library <%s>." ),
|
||||||
/* test for an existing name: */
|
(const wxChar*) aliasname,
|
||||||
int ii, jj = m_PartAliasList->GetCount();
|
(const wxChar*) CurrentLib->m_Name );
|
||||||
for( ii = 0; ii < jj; ii++ )
|
DisplayError( this, msg );
|
||||||
{
|
|
||||||
if( aliasname.CmpNoCase( m_PartAliasList->GetString( ii ) ) == 0 )
|
|
||||||
{
|
|
||||||
DisplayError( this, _( "Already in use" ), 10 );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
m_PartAliasList->Append( aliasname );
|
m_PartAliasList->Append( aliasname );
|
||||||
if( CurrentAliasName.IsEmpty() )
|
if( CurrentAliasName.IsEmpty() )
|
||||||
m_ButtonDeleteAllAlias->Enable( TRUE );
|
m_ButtonDeleteAllAlias->Enable( TRUE );
|
||||||
m_ButtonDeleteOneAlias->Enable( TRUE );
|
m_ButtonDeleteOneAlias->Enable( TRUE );
|
||||||
|
|
||||||
m_RecreateToolbar = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************/
|
|
||||||
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAliasOfPart(
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::DeleteAliasOfPart(
|
||||||
wxCommandEvent& WXUNUSED (event) )
|
wxCommandEvent& WXUNUSED (event) )
|
||||||
/********************************************************/
|
|
||||||
{
|
{
|
||||||
wxString aliasname = m_PartAliasList->GetStringSelection();
|
wxString aliasname = m_PartAliasList->GetStringSelection();
|
||||||
|
|
||||||
if( aliasname.IsEmpty() )
|
if( aliasname.IsEmpty() )
|
||||||
return;
|
return;
|
||||||
if( aliasname == CurrentAliasName )
|
if( aliasname.CmpNoCase( CurrentAliasName ) == 0 )
|
||||||
{
|
{
|
||||||
wxString msg = CurrentAliasName + _( " is Current Selected Alias!" );
|
wxString msg;
|
||||||
|
msg.Printf( _( "Alias <%s> cannot be removed while it is being \
|
||||||
|
edited!" ),
|
||||||
|
(const wxChar*) aliasname );
|
||||||
DisplayError( this, msg );
|
DisplayError( this, msg );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ii = m_PartAliasList->GetSelection();
|
m_PartAliasList->Delete( m_PartAliasList->GetSelection() );
|
||||||
m_PartAliasList->Delete( ii );
|
|
||||||
|
|
||||||
if( !CurrentLibEntry || (CurrentLibEntry->m_AliasList.GetCount() == 0) )
|
if( m_PartAliasList->IsEmpty() )
|
||||||
{
|
{
|
||||||
m_ButtonDeleteAllAlias->Enable( FALSE );
|
m_ButtonDeleteAllAlias->Enable( FALSE );
|
||||||
m_ButtonDeleteOneAlias->Enable( FALSE );
|
m_ButtonDeleteOneAlias->Enable( FALSE );
|
||||||
}
|
}
|
||||||
m_RecreateToolbar = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -602,21 +576,24 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::AddFootprintFilter( wxCommandEvent& WXUNU
|
||||||
if( CurrentLibEntry == NULL )
|
if( CurrentLibEntry == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( Get_Message( _( "New FootprintFilter:" ), _( "Footprint Filter" ), Line, this ) != 0 )
|
if( Get_Message( _( "Add Footprint Filter" ), _( "Footprint Filter" ),
|
||||||
|
Line, this ) != 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Line.Replace( wxT( " " ), wxT( "_" ) );
|
Line.Replace( wxT( " " ), wxT( "_" ) );
|
||||||
|
|
||||||
/* test for an existing name: */
|
/* test for an existing name: */
|
||||||
int ii, jj = m_FootprintFilterListBox->GetCount();
|
int index = m_FootprintFilterListBox->FindString( Line );
|
||||||
for( ii = 0; ii < jj; ii++ )
|
|
||||||
|
if( index != wxNOT_FOUND )
|
||||||
{
|
{
|
||||||
if( Line.CmpNoCase( m_FootprintFilterListBox->GetString( ii ) ) == 0 )
|
wxString msg;
|
||||||
{
|
|
||||||
DisplayError( this, _( "Already in use" ), 10 );
|
msg.Printf( _( "Foot print filter <%s> is already defined." ),
|
||||||
|
(const wxChar*) Line );
|
||||||
|
DisplayError( this, msg );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
m_FootprintFilterListBox->Append( Line );
|
m_FootprintFilterListBox->Append( Line );
|
||||||
m_ButtonDeleteAllFootprintFilter->Enable( TRUE );
|
m_ButtonDeleteAllFootprintFilter->Enable( TRUE );
|
||||||
|
|
|
@ -73,7 +73,10 @@ LibCmpEntry* FindLibPart( const wxChar* Name, const wxString& LibName,
|
||||||
if( Lib == NULL )
|
if( Lib == NULL )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
Entry = Lib->FindEntry( Name, type );
|
if( type == ROOT )
|
||||||
|
Entry = (LibCmpEntry*) Lib->FindComponent( Name );
|
||||||
|
else
|
||||||
|
Entry = Lib->FindEntry( Name );
|
||||||
|
|
||||||
if( Entry != NULL )
|
if( Entry != NULL )
|
||||||
{
|
{
|
||||||
|
|
|
@ -459,8 +459,6 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
|
||||||
|
|
||||||
bool ItemInEdit = GetScreen()->GetCurItem()
|
bool ItemInEdit = GetScreen()->GetCurItem()
|
||||||
&& GetScreen()->GetCurItem()->m_Flags;
|
&& GetScreen()->GetCurItem()->m_Flags;
|
||||||
bool RefreshToolBar = FALSE; /* Refresh tool bar when the undo/redo
|
|
||||||
* tool state is modified. */
|
|
||||||
|
|
||||||
if( hotkey == 0 )
|
if( hotkey == 0 )
|
||||||
return;
|
return;
|
||||||
|
@ -578,7 +576,4 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( RefreshToolBar )
|
|
||||||
SetToolbars();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,91 +0,0 @@
|
||||||
/****************************/
|
|
||||||
/* EESchema - libalias.cpp */
|
|
||||||
/****************************/
|
|
||||||
|
|
||||||
/* Routines de maintenanace des librairies: gestion des alias des composants
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "fctsys.h"
|
|
||||||
#include "common.h"
|
|
||||||
#include "confirm.h"
|
|
||||||
#include "program.h"
|
|
||||||
#include "libcmp.h"
|
|
||||||
#include "general.h"
|
|
||||||
#include "protos.h"
|
|
||||||
|
|
||||||
/* Variables locales */
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************/
|
|
||||||
bool BuildAliasData( LibraryStruct* Lib, EDA_LibComponentStruct* component )
|
|
||||||
/**************************************************************************/
|
|
||||||
|
|
||||||
/* Create the alias data for the lib component to edit
|
|
||||||
* Alias data is:
|
|
||||||
* alias name
|
|
||||||
* doc string
|
|
||||||
* keywords string
|
|
||||||
* doc file name
|
|
||||||
*
|
|
||||||
* in .m_AliastList
|
|
||||||
* Alias data (4 strings) replace each alias name.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
wxArrayString List;
|
|
||||||
LibCmpEntry* CmpEntry;
|
|
||||||
unsigned ii;
|
|
||||||
|
|
||||||
if( component == NULL || Lib == NULL
|
|
||||||
|| component->m_AliasList.GetCount() == 0 )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
List = component->m_AliasList;
|
|
||||||
component->m_AliasList.Clear();
|
|
||||||
for( ii = 0; ii < List.GetCount(); ii++ )
|
|
||||||
{
|
|
||||||
CmpEntry = FindLibPart( List[ii], Lib->m_Name, ALIAS );
|
|
||||||
if( CmpEntry && CmpEntry->Type != ALIAS )
|
|
||||||
{
|
|
||||||
DisplayError( NULL,
|
|
||||||
wxT( "BuildListAlias err: alias is a ROOT entry!" ) );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( LocateAlias( component->m_AliasList, List[ii] ) < 0 )
|
|
||||||
{
|
|
||||||
/* Alias not found in list: create it (datas must be in this order) */
|
|
||||||
component->m_AliasList.Add( List[ii] );
|
|
||||||
component->m_AliasList.Add( CmpEntry->m_Doc );
|
|
||||||
component->m_AliasList.Add( CmpEntry->m_KeyWord );
|
|
||||||
component->m_AliasList.Add( CmpEntry->m_DocFile );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
int LocateAlias( const wxArrayString& AliasData, const wxString& Name )
|
|
||||||
/***********************************************************************/
|
|
||||||
|
|
||||||
/* Return an index in alias data list
|
|
||||||
* ( -1 if not found )
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
int index = -1;
|
|
||||||
unsigned ii;
|
|
||||||
|
|
||||||
for( ii = 0; ii < AliasData.GetCount(); ii += ALIAS_NEXT )
|
|
||||||
{
|
|
||||||
if( Name.CmpNoCase( AliasData[ii + ALIAS_NAME].GetData() ) == 0 )
|
|
||||||
{
|
|
||||||
index = ii;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return index;
|
|
||||||
}
|
|
|
@ -13,14 +13,6 @@
|
||||||
#define DOC_EXT wxT( "dcm" ) /* Ext. of documentation files */
|
#define DOC_EXT wxT( "dcm" ) /* Ext. of documentation files */
|
||||||
|
|
||||||
|
|
||||||
//Offsets used in editing library component, for handle alias data
|
|
||||||
#define ALIAS_NAME 0
|
|
||||||
#define ALIAS_DOC 1
|
|
||||||
#define ALIAS_KEYWORD 2
|
|
||||||
#define ALIAS_DOC_FILENAME 3
|
|
||||||
#define ALIAS_NEXT 4
|
|
||||||
|
|
||||||
|
|
||||||
enum LocateDrawStructType {
|
enum LocateDrawStructType {
|
||||||
LOCATE_COMPONENT_ARC_DRAW_TYPE = 1,
|
LOCATE_COMPONENT_ARC_DRAW_TYPE = 1,
|
||||||
LOCATE_COMPONENT_CIRCLE_DRAW_TYPE = 2,
|
LOCATE_COMPONENT_CIRCLE_DRAW_TYPE = 2,
|
||||||
|
|
|
@ -25,9 +25,13 @@
|
||||||
/* Affiche dans la zone messages la librairie , et le composant edite */
|
/* Affiche dans la zone messages la librairie , et le composant edite */
|
||||||
void WinEDA_LibeditFrame::DisplayLibInfos()
|
void WinEDA_LibeditFrame::DisplayLibInfos()
|
||||||
{
|
{
|
||||||
wxString msg = wxT( "Libedit: " );
|
wxString msg = _( "Component Library Editor: " );
|
||||||
|
|
||||||
|
if( CurrentLib )
|
||||||
|
msg += CurrentLib->m_FullFileName;
|
||||||
|
else
|
||||||
|
msg += _( "no library selected" );
|
||||||
|
|
||||||
msg += CurrentLib ? CurrentLib->m_FullFileName : wxT( "No Lib" );
|
|
||||||
SetTitle( msg );
|
SetTitle( msg );
|
||||||
|
|
||||||
msg = _( " Part: " );
|
msg = _( " Part: " );
|
||||||
|
@ -37,12 +41,12 @@ void WinEDA_LibeditFrame::DisplayLibInfos()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg += CurrentLibEntry->m_Name.m_Text;
|
msg += CurrentLibEntry->GetName();
|
||||||
if( !CurrentAliasName.IsEmpty() )
|
if( !CurrentAliasName.IsEmpty() )
|
||||||
msg << wxT( " Alias " ) << CurrentAliasName;
|
msg << _( " Alias " ) << CurrentAliasName;
|
||||||
}
|
}
|
||||||
static wxChar UnitLetter[] = wxT( "?ABCDEFGHIJKLMNOPQRSTUVWXYZ" );
|
static wxChar UnitLetter[] = wxT( "?ABCDEFGHIJKLMNOPQRSTUVWXYZ" );
|
||||||
msg << wxT( " Unit " ) << UnitLetter[CurrentUnit];
|
msg << _( " Unit " ) << UnitLetter[CurrentUnit];
|
||||||
|
|
||||||
if( CurrentConvert > 1 )
|
if( CurrentConvert > 1 )
|
||||||
msg += _( " Convert" );
|
msg += _( " Convert" );
|
||||||
|
@ -111,14 +115,16 @@ bool WinEDA_LibeditFrame::LoadOneLibraryPart()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load the new library component */
|
/* Load the new library component */
|
||||||
LibEntry = CurrentLib->FindEntry( CmpName, ALIAS );
|
LibEntry = CurrentLib->FindEntry( CmpName );
|
||||||
|
|
||||||
if( LibEntry == NULL )
|
if( LibEntry == NULL )
|
||||||
{
|
{
|
||||||
msg = _( "Component \"" );
|
msg.Printf( _( "Component or alias name \"%s\" not found in \
|
||||||
msg << CmpName << _( "\" not found." );
|
library \"%s\"." ),
|
||||||
|
(const wxChar*) CmpName,
|
||||||
|
(const wxChar*) CurrentLib->m_Name );
|
||||||
DisplayError( this, msg );
|
DisplayError( this, msg );
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetScreen()->ClearUndoRedoList();
|
GetScreen()->ClearUndoRedoList();
|
||||||
|
@ -126,7 +132,6 @@ bool WinEDA_LibeditFrame::LoadOneLibraryPart()
|
||||||
if( !LoadOneLibraryPartAux( LibEntry, CurrentLib ) )
|
if( !LoadOneLibraryPartAux( LibEntry, CurrentLib ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ReCreateHToolbar();
|
|
||||||
Zoom_Automatique( FALSE );
|
Zoom_Automatique( FALSE );
|
||||||
DrawPanel->Refresh();
|
DrawPanel->Refresh();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -144,18 +149,19 @@ bool WinEDA_LibeditFrame::LoadOneLibraryPartAux( LibCmpEntry* LibEntry,
|
||||||
LibraryStruct* Library )
|
LibraryStruct* Library )
|
||||||
{
|
{
|
||||||
wxString msg, cmpName, rootName;
|
wxString msg, cmpName, rootName;
|
||||||
|
EDA_LibComponentStruct* component;
|
||||||
|
|
||||||
if( ( LibEntry == NULL ) || ( Library == NULL ) )
|
if( ( LibEntry == NULL ) || ( Library == NULL ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if( LibEntry->m_Name.m_Text.IsEmpty() )
|
if( LibEntry->GetName().IsEmpty() )
|
||||||
{
|
{
|
||||||
wxLogWarning( wxT( "Entry in library <%s> has empty name field." ),
|
wxLogWarning( wxT( "Entry in library <%s> has empty name field." ),
|
||||||
(const wxChar*) LibEntry );
|
(const wxChar*) LibEntry );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmpName = LibEntry->m_Name.m_Text;
|
cmpName = LibEntry->GetName();
|
||||||
CurrentAliasName.Empty();
|
CurrentAliasName.Empty();
|
||||||
|
|
||||||
if( LibEntry->Type != ROOT )
|
if( LibEntry->Type != ROOT )
|
||||||
|
@ -165,9 +171,9 @@ bool WinEDA_LibeditFrame::LoadOneLibraryPartAux( LibCmpEntry* LibEntry,
|
||||||
wxLogDebug( wxT( "\"<%s>\" is alias of \"<%s>\"" ),
|
wxLogDebug( wxT( "\"<%s>\" is alias of \"<%s>\"" ),
|
||||||
(const wxChar*) cmpName, (const wxChar*) rootName );
|
(const wxChar*) cmpName, (const wxChar*) rootName );
|
||||||
|
|
||||||
LibEntry = Library->FindEntry( rootName, ROOT );
|
component = Library->FindComponent( rootName );
|
||||||
|
|
||||||
if( LibEntry == NULL )
|
if( component == NULL )
|
||||||
{
|
{
|
||||||
msg.Printf( wxT( "Root entry <%s> for alias <%s> not found in \
|
msg.Printf( wxT( "Root entry <%s> for alias <%s> not found in \
|
||||||
library <%s>." ),
|
library <%s>." ),
|
||||||
|
@ -180,18 +186,20 @@ library <%s>." ),
|
||||||
|
|
||||||
CurrentAliasName = cmpName;
|
CurrentAliasName = cmpName;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if( CurrentLibEntry )
|
|
||||||
{
|
{
|
||||||
SAFE_DELETE( CurrentLibEntry );
|
component = (EDA_LibComponentStruct*) LibEntry;
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentLibEntry = CopyLibEntryStruct( (EDA_LibComponentStruct*) LibEntry );
|
if( CurrentLibEntry )
|
||||||
|
SAFE_DELETE( CurrentLibEntry );
|
||||||
|
|
||||||
|
CurrentLibEntry = CopyLibEntryStruct( component );
|
||||||
|
|
||||||
if( CurrentLibEntry == NULL )
|
if( CurrentLibEntry == NULL )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Could not create copy of part <%s> in library <%s>." ),
|
msg.Printf( _( "Could not create copy of part <%s> in library <%s>." ),
|
||||||
(const wxChar*) LibEntry->m_Name.m_Text,
|
(const wxChar*) LibEntry->GetName(),
|
||||||
(const wxChar*) Library->m_Name );
|
(const wxChar*) Library->m_Name );
|
||||||
DisplayError( this, msg );
|
DisplayError( this, msg );
|
||||||
return false;
|
return false;
|
||||||
|
@ -199,16 +207,21 @@ library <%s>." ),
|
||||||
|
|
||||||
CurrentUnit = 1;
|
CurrentUnit = 1;
|
||||||
CurrentConvert = 1;
|
CurrentConvert = 1;
|
||||||
DisplayLibInfos();
|
|
||||||
|
|
||||||
BuildAliasData( Library, CurrentLibEntry );
|
|
||||||
|
|
||||||
g_ScreenLib->ClrModify();
|
|
||||||
g_AsDeMorgan = 0;
|
g_AsDeMorgan = 0;
|
||||||
|
|
||||||
if( LookForConvertPart( CurrentLibEntry ) > 1 )
|
if( LookForConvertPart( CurrentLibEntry ) > 1 )
|
||||||
g_AsDeMorgan = 1;
|
g_AsDeMorgan = 1;
|
||||||
|
|
||||||
|
g_ScreenLib->ClrModify();
|
||||||
|
DisplayLibInfos();
|
||||||
|
UpdateAliasSelectList();
|
||||||
|
UpdatePartSelectList();
|
||||||
|
|
||||||
|
/* Display the document information based on the entry selected just in
|
||||||
|
* case the entry is an alias. */
|
||||||
|
DisplayCmpDoc( LibEntry->GetName() );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,14 +270,23 @@ void WinEDA_LibeditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
||||||
* Save (on disk) the current library
|
* Save (on disk) the current library
|
||||||
* if exists the old file is renamed (.bak)
|
* if exists the old file is renamed (.bak)
|
||||||
*/
|
*/
|
||||||
void WinEDA_LibeditFrame::SaveActiveLibrary()
|
void WinEDA_LibeditFrame::SaveActiveLibrary( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxFileName fn;
|
wxFileName fn;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
|
DrawPanel->UnManageCursor();
|
||||||
|
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||||
|
|
||||||
|
if( GetScreen()->IsModify() )
|
||||||
|
{
|
||||||
|
if( IsOK( this, _( "Include last component changes?" ) ) )
|
||||||
|
SaveOnePartInMemory();
|
||||||
|
}
|
||||||
|
|
||||||
if( CurrentLib == NULL )
|
if( CurrentLib == NULL )
|
||||||
{
|
{
|
||||||
DisplayError( this, wxT( "No library specified" ) );
|
DisplayError( this, wxT( "No library specified." ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,14 +376,14 @@ void WinEDA_LibeditFrame::DeleteOnePart()
|
||||||
|
|
||||||
if( ListNames.IsEmpty() )
|
if( ListNames.IsEmpty() )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Component library <%s> does not have any entries to delete." ),
|
msg.Printf( _( "Component library <%s> is empty." ),
|
||||||
( const wxChar* ) CurrentLib->m_Name );
|
( const wxChar* ) CurrentLib->m_Name );
|
||||||
wxMessageBox( msg, _( "Delete Entry Error" ),
|
wxMessageBox( msg, _( "Delete Entry Error" ),
|
||||||
wxID_OK | wxICON_EXCLAMATION, this );
|
wxID_OK | wxICON_EXCLAMATION, this );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.Printf( _( "Select 1 of %d components to\ndelete from library <%s>." ),
|
msg.Printf( _( "Select 1 of %d components to delete\nfrom library <%s>." ),
|
||||||
ListNames.GetCount(), ( const wxChar* ) CurrentLib->m_Name );
|
ListNames.GetCount(), ( const wxChar* ) CurrentLib->m_Name );
|
||||||
|
|
||||||
wxSingleChoiceDialog dlg( this, msg, _( "Delete Component" ), ListNames );
|
wxSingleChoiceDialog dlg( this, msg, _( "Delete Component" ), ListNames );
|
||||||
|
@ -380,12 +402,67 @@ void WinEDA_LibeditFrame::DeleteOnePart()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg = _( "Delete component \"" ) + LibEntry->m_Name.m_Text +
|
msg.Printf( _( "Delete component \"%s\" from library \"%s\"?" ),
|
||||||
_( "\" from library \"" ) + CurrentLib->m_Name + wxT( "\"?" );
|
(const wxChar*) LibEntry->GetName(),
|
||||||
|
(const wxChar*) CurrentLib->m_Name );
|
||||||
|
|
||||||
if( IsOK( this, msg ) )
|
if( !IsOK( this, msg ) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if( CurrentLibEntry == NULL
|
||||||
|
|| ( CurrentLibEntry->GetName().CmpNoCase( LibEntry->GetName() ) != 0
|
||||||
|
&& !CurrentLibEntry->HasAlias( LibEntry->GetName() ) ) )
|
||||||
{
|
{
|
||||||
CurrentLib->RemoveEntry( LibEntry );
|
CurrentLib->RemoveEntry( LibEntry );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If deleting the current entry or removing one of the aliases for
|
||||||
|
* the current entry, sync the changes in the current entry as well.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if( GetScreen()->IsModify()
|
||||||
|
&& !IsOK( this, _( "The component being deleted has been modified. \
|
||||||
|
All changes will be lost. Discard changes?" ) ) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
wxString newCmpName;
|
||||||
|
LibCmpEntry* nextEntry;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If the current component has no aliases, then the next entry
|
||||||
|
* in the library will be shown. If the current component has
|
||||||
|
* aliases, the updated component will be shown
|
||||||
|
*/
|
||||||
|
if( CurrentLibEntry->GetName().CmpNoCase( LibEntry->GetName() ) == 0 )
|
||||||
|
{
|
||||||
|
if( CurrentLibEntry->m_AliasList.IsEmpty() )
|
||||||
|
{
|
||||||
|
nextEntry = CurrentLib->GetNextEntry( CurrentLibEntry->GetName() );
|
||||||
|
|
||||||
|
if( nextEntry != NULL )
|
||||||
|
newCmpName = nextEntry->GetName();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newCmpName = CurrentLibEntry->m_AliasList[ 0 ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newCmpName = CurrentLibEntry->GetName();
|
||||||
|
}
|
||||||
|
|
||||||
|
CurrentLib->RemoveEntry( LibEntry );
|
||||||
|
|
||||||
|
if( !newCmpName.IsEmpty() )
|
||||||
|
{
|
||||||
|
nextEntry = CurrentLib->FindEntry( newCmpName );
|
||||||
|
|
||||||
|
if( nextEntry != NULL && LoadOneLibraryPartAux( nextEntry, CurrentLib ) )
|
||||||
|
Zoom_Automatique( false );
|
||||||
|
|
||||||
|
DrawPanel->Refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,7 +478,7 @@ void WinEDA_LibeditFrame::CreateNewLibraryPart()
|
||||||
EDA_LibComponentStruct* NewStruct;
|
EDA_LibComponentStruct* NewStruct;
|
||||||
int diag;
|
int diag;
|
||||||
|
|
||||||
if( CurrentLibEntry
|
if( CurrentLibEntry && GetScreen()->IsModify()
|
||||||
&& !IsOK( this,
|
&& !IsOK( this,
|
||||||
_( "Clear old component from screen (changes will be lost)?" ) ) )
|
_( "Clear old component from screen (changes will be lost)?" ) ) )
|
||||||
return;
|
return;
|
||||||
|
@ -424,9 +501,9 @@ void WinEDA_LibeditFrame::CreateNewLibraryPart()
|
||||||
if( CurrentLib->FindEntry( msg ) )
|
if( CurrentLib->FindEntry( msg ) )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg << _( "Component \"" ) << Dialogbox.ReturnCmpName() <<
|
msg.Printf( _( "Component \"%s\" exists in library \"%s\"." ),
|
||||||
_( "\" exists in library \"" ) << CurrentLib->m_Name <<
|
(const wxChar*) Dialogbox.ReturnCmpName(),
|
||||||
_( "\"." );
|
(const wxChar*) CurrentLib->m_Name );
|
||||||
DisplayError( this, msg );
|
DisplayError( this, msg );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -446,9 +523,8 @@ void WinEDA_LibeditFrame::CreateNewLibraryPart()
|
||||||
CurrentLibEntry = NewStruct;
|
CurrentLibEntry = NewStruct;
|
||||||
CurrentUnit = 1;
|
CurrentUnit = 1;
|
||||||
CurrentConvert = 1;
|
CurrentConvert = 1;
|
||||||
ReCreateHToolbar();
|
|
||||||
|
|
||||||
DisplayLibInfos();
|
DisplayLibInfos();
|
||||||
|
DisplayCmpDoc( CurrentLibEntry->GetName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -461,10 +537,9 @@ void WinEDA_LibeditFrame::CreateNewLibraryPart()
|
||||||
*/
|
*/
|
||||||
void WinEDA_LibeditFrame::SaveOnePartInMemory()
|
void WinEDA_LibeditFrame::SaveOnePartInMemory()
|
||||||
{
|
{
|
||||||
LibCmpEntry* Entry;
|
EDA_LibComponentStruct* oldComponent;
|
||||||
EDA_LibComponentStruct* Component;
|
EDA_LibComponentStruct* Component;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
bool NewCmp = TRUE;
|
|
||||||
|
|
||||||
if( CurrentLibEntry == NULL )
|
if( CurrentLibEntry == NULL )
|
||||||
{
|
{
|
||||||
|
@ -483,44 +558,29 @@ void WinEDA_LibeditFrame::SaveOnePartInMemory()
|
||||||
|
|
||||||
g_ScreenLib->ClrModify();
|
g_ScreenLib->ClrModify();
|
||||||
|
|
||||||
Entry = CurrentLib->FindEntry( CurrentLibEntry->m_Name.m_Text, ROOT );
|
oldComponent = CurrentLib->FindComponent( CurrentLibEntry->GetName() );
|
||||||
|
|
||||||
if( Entry != NULL )
|
if( oldComponent != NULL )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Component \"%s\" exists. Change it?" ),
|
msg.Printf( _( "Component \"%s\" exists. Change it?" ),
|
||||||
(const wxChar*) Entry->m_Name.m_Text );
|
(const wxChar*) oldComponent->GetName() );
|
||||||
if( !IsOK( this, msg ) )
|
if( !IsOK( this, msg ) )
|
||||||
return;
|
return;
|
||||||
NewCmp = FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxASSERT( CurrentLibEntry->Type == ROOT );
|
wxASSERT( CurrentLibEntry->Type == ROOT );
|
||||||
|
|
||||||
/* Effacement des alias deja existants en librairie */
|
if( oldComponent != NULL )
|
||||||
for( unsigned ii = 0;
|
Component = CurrentLib->ReplaceComponent( oldComponent,
|
||||||
ii < CurrentLibEntry->m_AliasList.GetCount();
|
CurrentLibEntry );
|
||||||
ii += ALIAS_NEXT )
|
else
|
||||||
{
|
|
||||||
LibCmpEntry* LocalEntry;
|
|
||||||
wxString aliasname = CurrentLibEntry->m_AliasList[ii];
|
|
||||||
LocalEntry = CurrentLib->FindEntry( aliasname, ALIAS );
|
|
||||||
|
|
||||||
while( LocalEntry != NULL && LocalEntry->Type == ALIAS )
|
|
||||||
{
|
|
||||||
CurrentLib->RemoveEntry( LocalEntry );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !NewCmp )
|
|
||||||
CurrentLib->RemoveEntry( Entry );
|
|
||||||
|
|
||||||
Component = CurrentLib->AddComponent( CurrentLibEntry );
|
Component = CurrentLib->AddComponent( CurrentLibEntry );
|
||||||
|
|
||||||
if( Component == NULL )
|
if( Component == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
msg.Printf( _( "Component %s saved in library %s" ),
|
msg.Printf( _( "Component %s saved in library %s" ),
|
||||||
( const wxChar* ) Component->m_Name.m_Text,
|
( const wxChar* ) Component->GetName(),
|
||||||
( const wxChar* ) CurrentLib->m_Name );
|
( const wxChar* ) CurrentLib->m_Name );
|
||||||
Affiche_Message( msg );
|
Affiche_Message( msg );
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,9 +79,10 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EraseMsgBox();
|
if( CurrentAliasName.IsEmpty() )
|
||||||
AfficheDoc( this, CurrentLibEntry->m_Doc.GetData(),
|
DisplayCmpDoc( CurrentAliasName );
|
||||||
CurrentLibEntry->m_KeyWord.GetData() );
|
else
|
||||||
|
DisplayCmpDoc( CurrentLibEntry->GetName() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,8 +152,10 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
}
|
}
|
||||||
if( DrawEntry == NULL )
|
if( DrawEntry == NULL )
|
||||||
{
|
{
|
||||||
AfficheDoc( this, CurrentLibEntry->m_Doc.GetData(),
|
if( CurrentAliasName.IsEmpty() )
|
||||||
CurrentLibEntry->m_KeyWord.GetData() );
|
DisplayCmpDoc( CurrentLibEntry->GetName() );
|
||||||
|
else
|
||||||
|
DisplayCmpDoc( CurrentAliasName );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
SaveCopyInUndoList( CurrentLibEntry );
|
SaveCopyInUndoList( CurrentLibEntry );
|
||||||
|
@ -224,7 +227,7 @@ void WinEDA_LibeditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
}
|
}
|
||||||
if( DrawEntry == NULL )
|
if( DrawEntry == NULL )
|
||||||
{
|
{
|
||||||
InstallLibeditFrame( );
|
EditComponentProperties();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,9 +67,6 @@ void WinEDA_LibeditFrame::GetComponentFromRedoList(wxCommandEvent& event)
|
||||||
CurrentLibEntry->SetNext( NULL );
|
CurrentLibEntry->SetNext( NULL );
|
||||||
CurrentDrawItem = NULL;
|
CurrentDrawItem = NULL;
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
ReCreateHToolbar();
|
|
||||||
SetToolbars();
|
|
||||||
|
|
||||||
DrawPanel->Refresh();
|
DrawPanel->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,8 +98,5 @@ void WinEDA_LibeditFrame::GetComponentFromUndoList(wxCommandEvent& event)
|
||||||
CurrentLibEntry->SetNext( NULL );
|
CurrentLibEntry->SetNext( NULL );
|
||||||
CurrentDrawItem = NULL;
|
CurrentDrawItem = NULL;
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
ReCreateHToolbar();
|
|
||||||
SetToolbars();
|
|
||||||
|
|
||||||
DrawPanel->Refresh();
|
DrawPanel->Refresh();
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,18 +193,32 @@ void WinEDA_LibeditFrame::EditField( wxDC* DC, LibDrawField* Field )
|
||||||
*/
|
*/
|
||||||
if( Field->m_FieldId == VALUE )
|
if( Field->m_FieldId == VALUE )
|
||||||
{
|
{
|
||||||
/* test for an existing name in alias list: */
|
wxString msg;
|
||||||
for( unsigned ii = 0; ii < CurrentLibEntry->m_AliasList.GetCount();
|
|
||||||
ii += ALIAS_NEXT )
|
|
||||||
{
|
|
||||||
wxString aliasname = CurrentLibEntry->m_AliasList[ii + ALIAS_NAME];
|
|
||||||
|
|
||||||
if( Text.CmpNoCase( aliasname ) == 0 )
|
/* Test for an existing name in the current components alias list. */
|
||||||
|
if( CurrentLibEntry->m_AliasList.Index( Text, false ) != wxNOT_FOUND )
|
||||||
{
|
{
|
||||||
DisplayError( this, _( "This name is an existing alias of \
|
msg.Printf( _( "The field name <%s> is an existing alias of the \
|
||||||
the component\nAborting" ) );
|
component <%s>.\nPlease choose another name that does not conflict with any \
|
||||||
|
names in the alias list." ),
|
||||||
|
(const wxChar*) Text,
|
||||||
|
(const wxChar*) CurrentLibEntry->GetName() );
|
||||||
|
DisplayError( this, msg );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Test for an existing entry in the library to prevent duplicate
|
||||||
|
* entry names.
|
||||||
|
*/
|
||||||
|
if( CurrentLib && CurrentLib->FindEntry( Text ) != NULL )
|
||||||
|
{
|
||||||
|
msg.Printf( _( "The field name <%s> conflicts with an existing \
|
||||||
|
entry in the component library <%s>.\nPlease choose another name that does \
|
||||||
|
not conflict with any library entries." ),
|
||||||
|
(const wxChar*) Text,
|
||||||
|
(const wxChar*) CurrentLib->m_Name );
|
||||||
|
DisplayError( this, msg );
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,9 +247,7 @@ the component\nAborting" ) );
|
||||||
DefaultTransformMatrix );
|
DefaultTransformMatrix );
|
||||||
|
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
|
UpdateAliasSelectList();
|
||||||
if( Field->m_FieldId == VALUE )
|
|
||||||
ReCreateHToolbar();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -39,13 +39,10 @@ BEGIN_EVENT_TABLE( WinEDA_LibeditFrame, WinEDA_DrawFrame )
|
||||||
EVT_CLOSE( WinEDA_LibeditFrame::OnCloseWindow )
|
EVT_CLOSE( WinEDA_LibeditFrame::OnCloseWindow )
|
||||||
EVT_SIZE( WinEDA_LibeditFrame::OnSize )
|
EVT_SIZE( WinEDA_LibeditFrame::OnSize )
|
||||||
|
|
||||||
|
/* Main horizontal toolbar. */
|
||||||
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_LibeditFrame::OnZoom )
|
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_LibeditFrame::OnZoom )
|
||||||
|
|
||||||
// Tools et boutons de Libedit:
|
|
||||||
|
|
||||||
/* Main horizontal toolbar */
|
|
||||||
EVT_TOOL( ID_LIBEDIT_SAVE_CURRENT_LIB,
|
EVT_TOOL( ID_LIBEDIT_SAVE_CURRENT_LIB,
|
||||||
WinEDA_LibeditFrame::Process_Special_Functions )
|
WinEDA_LibeditFrame::SaveActiveLibrary )
|
||||||
EVT_TOOL( ID_LIBEDIT_SELECT_CURRENT_LIB,
|
EVT_TOOL( ID_LIBEDIT_SELECT_CURRENT_LIB,
|
||||||
WinEDA_LibeditFrame::Process_Special_Functions )
|
WinEDA_LibeditFrame::Process_Special_Functions )
|
||||||
EVT_TOOL( ID_LIBEDIT_DELETE_PART,
|
EVT_TOOL( ID_LIBEDIT_DELETE_PART,
|
||||||
|
@ -61,7 +58,7 @@ BEGIN_EVENT_TABLE( WinEDA_LibeditFrame, WinEDA_DrawFrame )
|
||||||
EVT_TOOL( ID_LIBEDIT_REDO,
|
EVT_TOOL( ID_LIBEDIT_REDO,
|
||||||
WinEDA_LibeditFrame::GetComponentFromRedoList )
|
WinEDA_LibeditFrame::GetComponentFromRedoList )
|
||||||
EVT_TOOL( ID_LIBEDIT_GET_FRAME_EDIT_PART,
|
EVT_TOOL( ID_LIBEDIT_GET_FRAME_EDIT_PART,
|
||||||
WinEDA_LibeditFrame::Process_Special_Functions )
|
WinEDA_LibeditFrame::OnEditComponentProperties )
|
||||||
EVT_TOOL( ID_LIBEDIT_GET_FRAME_EDIT_FIELDS,
|
EVT_TOOL( ID_LIBEDIT_GET_FRAME_EDIT_FIELDS,
|
||||||
WinEDA_LibeditFrame::Process_Special_Functions )
|
WinEDA_LibeditFrame::Process_Special_Functions )
|
||||||
EVT_TOOL( ID_LIBEDIT_CHECK_PART,
|
EVT_TOOL( ID_LIBEDIT_CHECK_PART,
|
||||||
|
@ -74,32 +71,56 @@ BEGIN_EVENT_TABLE( WinEDA_LibeditFrame, WinEDA_DrawFrame )
|
||||||
WinEDA_LibeditFrame::Process_Special_Functions )
|
WinEDA_LibeditFrame::Process_Special_Functions )
|
||||||
EVT_TOOL( ID_LIBEDIT_EDIT_PIN_BY_PIN,
|
EVT_TOOL( ID_LIBEDIT_EDIT_PIN_BY_PIN,
|
||||||
WinEDA_LibeditFrame::Process_Special_Functions )
|
WinEDA_LibeditFrame::Process_Special_Functions )
|
||||||
|
EVT_TOOL( ExportPartId, WinEDA_LibeditFrame::OnExportPart )
|
||||||
|
EVT_TOOL( CreateNewLibAndSavePartId, WinEDA_LibeditFrame::OnExportPart )
|
||||||
|
EVT_TOOL( ImportPartId, WinEDA_LibeditFrame::OnImportPart )
|
||||||
|
|
||||||
|
|
||||||
EVT_KICAD_CHOICEBOX( ID_LIBEDIT_SELECT_PART_NUMBER,
|
EVT_KICAD_CHOICEBOX( ID_LIBEDIT_SELECT_PART_NUMBER,
|
||||||
WinEDA_LibeditFrame::Process_Special_Functions )
|
WinEDA_LibeditFrame::OnSelectPart )
|
||||||
EVT_KICAD_CHOICEBOX( ID_LIBEDIT_SELECT_ALIAS,
|
EVT_KICAD_CHOICEBOX( ID_LIBEDIT_SELECT_ALIAS,
|
||||||
WinEDA_LibeditFrame::Process_Special_Functions )
|
WinEDA_LibeditFrame::OnSelectAlias )
|
||||||
|
|
||||||
/* Right Vertical toolbar */
|
/* Right vertical toolbar. */
|
||||||
EVT_TOOL( ID_NO_SELECT_BUTT, WinEDA_LibeditFrame::Process_Special_Functions )
|
EVT_TOOL( ID_NO_SELECT_BUTT, WinEDA_LibeditFrame::Process_Special_Functions )
|
||||||
EVT_TOOL_RANGE( ID_LIBEDIT_START_V_TOOL, ID_LIBEDIT_END_V_TOOL,
|
EVT_TOOL_RANGE( ID_LIBEDIT_START_V_TOOL, ID_LIBEDIT_END_V_TOOL,
|
||||||
WinEDA_LibeditFrame::Process_Special_Functions )
|
WinEDA_LibeditFrame::Process_Special_Functions )
|
||||||
|
|
||||||
/* PopUp events and commands: */
|
/* Context menu events and commands. */
|
||||||
EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE,
|
EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE,
|
||||||
WinEDA_LibeditFrame::Process_Special_Functions )
|
WinEDA_LibeditFrame::Process_Special_Functions )
|
||||||
|
|
||||||
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
|
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
|
||||||
WinEDA_LibeditFrame::Process_Special_Functions )
|
WinEDA_LibeditFrame::Process_Special_Functions )
|
||||||
|
|
||||||
EVT_TOOL( ExportPartId, WinEDA_LibeditFrame::OnExportPart )
|
/* Update user interface elements. */
|
||||||
EVT_TOOL( CreateNewLibAndSavePartId, WinEDA_LibeditFrame::OnExportPart )
|
|
||||||
EVT_TOOL( ImportPartId, WinEDA_LibeditFrame::OnImportPart )
|
|
||||||
EVT_UPDATE_UI( ExportPartId, WinEDA_LibeditFrame::OnUpdateEditingPart )
|
EVT_UPDATE_UI( ExportPartId, WinEDA_LibeditFrame::OnUpdateEditingPart )
|
||||||
EVT_UPDATE_UI( CreateNewLibAndSavePartId,
|
EVT_UPDATE_UI( CreateNewLibAndSavePartId,
|
||||||
WinEDA_LibeditFrame::OnUpdateEditingPart )
|
WinEDA_LibeditFrame::OnUpdateEditingPart )
|
||||||
|
EVT_UPDATE_UI( ID_LIBEDIT_SAVE_CURRENT_PART,
|
||||||
|
WinEDA_LibeditFrame::OnUpdateEditingPart )
|
||||||
|
EVT_UPDATE_UI( ID_LIBEDIT_GET_FRAME_EDIT_FIELDS,
|
||||||
|
WinEDA_LibeditFrame::OnUpdateEditingPart )
|
||||||
|
EVT_UPDATE_UI( ID_LIBEDIT_CHECK_PART,
|
||||||
|
WinEDA_LibeditFrame::OnUpdateEditingPart )
|
||||||
|
EVT_UPDATE_UI( ID_LIBEDIT_UNDO, WinEDA_LibeditFrame::OnUpdateUndo )
|
||||||
|
EVT_UPDATE_UI( ID_LIBEDIT_REDO, WinEDA_LibeditFrame::OnUpdateRedo )
|
||||||
|
EVT_UPDATE_UI( ID_LIBEDIT_SAVE_CURRENT_LIB,
|
||||||
|
WinEDA_LibeditFrame::OnUpdateSaveCurrentLib )
|
||||||
|
EVT_UPDATE_UI( ID_LIBEDIT_VIEW_DOC, WinEDA_LibeditFrame::OnUpdateViewDoc )
|
||||||
|
EVT_UPDATE_UI( ID_LIBEDIT_EDIT_PIN_BY_PIN,
|
||||||
|
WinEDA_LibeditFrame::OnUpdatePinByPin )
|
||||||
|
EVT_UPDATE_UI( ID_LIBEDIT_SELECT_PART_NUMBER,
|
||||||
|
WinEDA_LibeditFrame::OnUpdatePartNumber )
|
||||||
|
EVT_UPDATE_UI( ID_LIBEDIT_SELECT_ALIAS,
|
||||||
|
WinEDA_LibeditFrame::OnUpdateSelectAlias )
|
||||||
|
EVT_UPDATE_UI( ID_DE_MORGAN_NORMAL_BUTT,
|
||||||
|
WinEDA_LibeditFrame::OnUpdateDeMorganNormal )
|
||||||
|
EVT_UPDATE_UI( ID_DE_MORGAN_CONVERT_BUTT,
|
||||||
|
WinEDA_LibeditFrame::OnUpdateDeMorganConvert )
|
||||||
|
EVT_UPDATE_UI_RANGE( ID_LIBEDIT_PIN_BUTT, ID_LIBEDIT_EXPORT_BODY_BUTT,
|
||||||
|
WinEDA_LibeditFrame::OnUpdateEditingPart )
|
||||||
|
|
||||||
// PopUp Menus pour Zooms trait<69>s dans drawpanel.cpp
|
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
|
@ -126,14 +147,14 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
|
||||||
ReCreateHToolbar();
|
ReCreateHToolbar();
|
||||||
ReCreateVToolbar();
|
ReCreateVToolbar();
|
||||||
DisplayLibInfos();
|
DisplayLibInfos();
|
||||||
|
UpdateAliasSelectList();
|
||||||
|
UpdatePartSelectList();
|
||||||
BestZoom();
|
BestZoom();
|
||||||
Show( true );
|
Show( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************/
|
|
||||||
WinEDA_LibeditFrame::~WinEDA_LibeditFrame()
|
WinEDA_LibeditFrame::~WinEDA_LibeditFrame()
|
||||||
/**********************************************/
|
|
||||||
{
|
{
|
||||||
WinEDA_SchematicFrame* frame =
|
WinEDA_SchematicFrame* frame =
|
||||||
(WinEDA_SchematicFrame*) wxGetApp().GetTopWindow();
|
(WinEDA_SchematicFrame*) wxGetApp().GetTopWindow();
|
||||||
|
@ -216,123 +237,6 @@ void WinEDA_LibeditFrame::OnCloseWindow( wxCloseEvent& Event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Enable or disable tools of the differents toolbars, according to the
|
|
||||||
* current conditions or options.
|
|
||||||
*
|
|
||||||
* FIXME: Get rid of this function and use WX_UPDATE_UI to handle enabling of
|
|
||||||
* menu and toolbar items.
|
|
||||||
*/
|
|
||||||
void WinEDA_LibeditFrame::SetToolbars()
|
|
||||||
{
|
|
||||||
if( m_HToolBar == NULL )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( CurrentLib == NULL )
|
|
||||||
{
|
|
||||||
if( m_HToolBar )
|
|
||||||
m_HToolBar->EnableTool( ID_LIBEDIT_SAVE_CURRENT_LIB, false );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( m_HToolBar )
|
|
||||||
m_HToolBar->EnableTool( ID_LIBEDIT_SAVE_CURRENT_LIB, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( CurrentLibEntry == NULL )
|
|
||||||
{
|
|
||||||
if( m_HToolBar )
|
|
||||||
{
|
|
||||||
m_HToolBar->EnableTool( ID_LIBEDIT_SAVE_CURRENT_PART, false );
|
|
||||||
m_HToolBar->EnableTool( ID_DE_MORGAN_CONVERT_BUTT, false );
|
|
||||||
m_HToolBar->EnableTool( ID_DE_MORGAN_NORMAL_BUTT, false );
|
|
||||||
m_HToolBar->EnableTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, false );
|
|
||||||
m_HToolBar->EnableTool( ID_LIBEDIT_VIEW_DOC, false );
|
|
||||||
m_HToolBar->EnableTool( ID_LIBEDIT_CHECK_PART, false );
|
|
||||||
m_HToolBar->EnableTool( ID_LIBEDIT_GET_FRAME_EDIT_FIELDS, false );
|
|
||||||
m_SelpartBox->Enable( false );
|
|
||||||
m_HToolBar->EnableTool( ID_LIBEDIT_UNDO, false );
|
|
||||||
m_HToolBar->EnableTool( ID_LIBEDIT_REDO, false );
|
|
||||||
}
|
|
||||||
g_EditPinByPinIsOn = false;
|
|
||||||
m_HToolBar->ToggleTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, g_EditPinByPinIsOn );
|
|
||||||
|
|
||||||
if( m_VToolBar )
|
|
||||||
{
|
|
||||||
m_VToolBar->EnableTool( ID_LIBEDIT_BODY_TEXT_BUTT, false );
|
|
||||||
m_VToolBar->EnableTool( ID_LIBEDIT_BODY_LINE_BUTT, false );
|
|
||||||
m_VToolBar->EnableTool( ID_LIBEDIT_BODY_RECT_BUTT, false );
|
|
||||||
m_VToolBar->EnableTool( ID_LIBEDIT_BODY_CIRCLE_BUTT, false );
|
|
||||||
m_VToolBar->EnableTool( ID_LIBEDIT_BODY_ARC_BUTT, false );
|
|
||||||
m_VToolBar->EnableTool( ID_LIBEDIT_DELETE_ITEM_BUTT, false );
|
|
||||||
m_VToolBar->EnableTool( ID_LIBEDIT_ANCHOR_ITEM_BUTT, false );
|
|
||||||
m_VToolBar->EnableTool( ID_LIBEDIT_IMPORT_BODY_BUTT, false );
|
|
||||||
m_VToolBar->EnableTool( ID_LIBEDIT_EXPORT_BODY_BUTT, false );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // if we have a current entry to edit:
|
|
||||||
{
|
|
||||||
if( m_HToolBar )
|
|
||||||
{
|
|
||||||
m_HToolBar->EnableTool( ID_LIBEDIT_SAVE_CURRENT_PART, true );
|
|
||||||
m_HToolBar->EnableTool( ID_LIBEDIT_GET_FRAME_EDIT_FIELDS, true );
|
|
||||||
if( (CurrentLibEntry->m_UnitCount > 1) || g_AsDeMorgan )
|
|
||||||
m_HToolBar->EnableTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, true );
|
|
||||||
else
|
|
||||||
m_HToolBar->EnableTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, false );
|
|
||||||
|
|
||||||
m_HToolBar->ToggleTool( ID_LIBEDIT_EDIT_PIN_BY_PIN,
|
|
||||||
g_EditPinByPinIsOn );
|
|
||||||
|
|
||||||
m_HToolBar->EnableTool( ID_DE_MORGAN_CONVERT_BUTT, g_AsDeMorgan );
|
|
||||||
m_HToolBar->EnableTool( ID_DE_MORGAN_NORMAL_BUTT, g_AsDeMorgan );
|
|
||||||
/* Enable the "get doc" tool */
|
|
||||||
bool enable_dtool = false;
|
|
||||||
if( !CurrentAliasName.IsEmpty() )
|
|
||||||
{
|
|
||||||
int AliasLocation = LocateAlias( CurrentLibEntry->m_AliasList,
|
|
||||||
CurrentAliasName );
|
|
||||||
if( AliasLocation >= 0 )
|
|
||||||
if( !CurrentLibEntry->m_AliasList[AliasLocation +
|
|
||||||
ALIAS_DOC_FILENAME].IsEmpty() )
|
|
||||||
enable_dtool = true;
|
|
||||||
}
|
|
||||||
else if( !CurrentLibEntry->m_DocFile.IsEmpty() )
|
|
||||||
enable_dtool = true;
|
|
||||||
if( enable_dtool )
|
|
||||||
m_HToolBar->EnableTool( ID_LIBEDIT_VIEW_DOC, true );
|
|
||||||
else
|
|
||||||
m_HToolBar->EnableTool( ID_LIBEDIT_VIEW_DOC, false );
|
|
||||||
m_HToolBar->EnableTool( ID_LIBEDIT_CHECK_PART, true );
|
|
||||||
m_SelpartBox->Enable( (CurrentLibEntry->m_UnitCount > 1 ) ? true : false );
|
|
||||||
|
|
||||||
if( GetScreen() )
|
|
||||||
{
|
|
||||||
m_HToolBar->EnableTool( ID_LIBEDIT_UNDO,
|
|
||||||
GetScreen()->GetUndoCommandCount() );
|
|
||||||
m_HToolBar->EnableTool( ID_LIBEDIT_REDO,
|
|
||||||
GetScreen()->GetRedoCommandCount() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( m_VToolBar )
|
|
||||||
{
|
|
||||||
m_VToolBar->EnableTool( ID_LIBEDIT_BODY_TEXT_BUTT, true );
|
|
||||||
m_VToolBar->EnableTool( ID_LIBEDIT_BODY_LINE_BUTT, true );
|
|
||||||
m_VToolBar->EnableTool( ID_LIBEDIT_BODY_RECT_BUTT, true );
|
|
||||||
m_VToolBar->EnableTool( ID_LIBEDIT_BODY_CIRCLE_BUTT, true );
|
|
||||||
m_VToolBar->EnableTool( ID_LIBEDIT_BODY_ARC_BUTT, true );
|
|
||||||
m_VToolBar->EnableTool( ID_LIBEDIT_DELETE_ITEM_BUTT, true );
|
|
||||||
m_VToolBar->EnableTool( ID_LIBEDIT_ANCHOR_ITEM_BUTT, true );
|
|
||||||
m_VToolBar->EnableTool( ID_LIBEDIT_IMPORT_BODY_BUTT, true );
|
|
||||||
m_VToolBar->EnableTool( ID_LIBEDIT_EXPORT_BODY_BUTT, true );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DisplayUnitsMsg();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int WinEDA_LibeditFrame::BestZoom()
|
int WinEDA_LibeditFrame::BestZoom()
|
||||||
{
|
{
|
||||||
int dx, dy, ii, jj;
|
int dx, dy, ii, jj;
|
||||||
|
@ -374,17 +278,200 @@ int WinEDA_LibeditFrame::BestZoom()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WinEDA_LibeditFrame::UpdateAliasSelectList()
|
||||||
|
{
|
||||||
|
if( m_SelAliasBox == NULL )
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_SelAliasBox->Clear();
|
||||||
|
|
||||||
|
if( CurrentLibEntry == NULL )
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_SelAliasBox->Append( CurrentLibEntry->GetName() );
|
||||||
|
m_SelAliasBox->SetSelection( 0 );
|
||||||
|
|
||||||
|
if( !CurrentLibEntry->m_AliasList.IsEmpty() )
|
||||||
|
{
|
||||||
|
m_SelAliasBox->Append( CurrentLibEntry->m_AliasList );
|
||||||
|
|
||||||
|
int index = m_SelAliasBox->FindString( CurrentAliasName );
|
||||||
|
|
||||||
|
if( index != wxNOT_FOUND )
|
||||||
|
m_SelAliasBox->SetSelection( index );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WinEDA_LibeditFrame::UpdatePartSelectList()
|
||||||
|
{
|
||||||
|
if( m_SelpartBox == NULL )
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
if( !m_SelpartBox->IsEmpty() )
|
||||||
|
m_SelpartBox->Clear();
|
||||||
|
|
||||||
|
if( CurrentLibEntry == NULL || CurrentLibEntry->m_UnitCount <= 1 )
|
||||||
|
{
|
||||||
|
m_SelpartBox->Append( wxEmptyString );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for( int i = 0; i < CurrentLibEntry->m_UnitCount; i++ )
|
||||||
|
{
|
||||||
|
wxString msg;
|
||||||
|
msg.Printf( _( "Part %c" ), 'A' + i );
|
||||||
|
m_SelpartBox->Append( msg );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_SelpartBox->SetSelection( ( CurrentUnit > 0 ) ? CurrentUnit - 1 : 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void WinEDA_LibeditFrame::OnUpdateEditingPart( wxUpdateUIEvent& event )
|
void WinEDA_LibeditFrame::OnUpdateEditingPart( wxUpdateUIEvent& event )
|
||||||
{
|
{
|
||||||
event.Enable( CurrentLibEntry != NULL );
|
event.Enable( CurrentLibEntry != NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WinEDA_LibeditFrame::OnUpdateNotEditingPart( wxUpdateUIEvent& event )
|
void WinEDA_LibeditFrame::OnUpdateNotEditingPart( wxUpdateUIEvent& event )
|
||||||
{
|
{
|
||||||
event.Enable( CurrentLibEntry == NULL );
|
event.Enable( CurrentLibEntry == NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WinEDA_LibeditFrame::OnUpdateUndo( wxUpdateUIEvent& event )
|
||||||
|
{
|
||||||
|
event.Enable( CurrentLibEntry != NULL && GetScreen() != NULL
|
||||||
|
&& GetScreen()->GetUndoCommandCount() != 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WinEDA_LibeditFrame::OnUpdateRedo( wxUpdateUIEvent& event )
|
||||||
|
{
|
||||||
|
event.Enable( CurrentLibEntry != NULL && GetScreen() != NULL
|
||||||
|
&& GetScreen()->GetRedoCommandCount() != 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WinEDA_LibeditFrame::OnUpdateSaveCurrentLib( wxUpdateUIEvent& event )
|
||||||
|
{
|
||||||
|
event.Enable( CurrentLib != NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WinEDA_LibeditFrame::OnUpdateViewDoc( wxUpdateUIEvent& event )
|
||||||
|
{
|
||||||
|
bool enable = false;
|
||||||
|
|
||||||
|
if( CurrentLibEntry != NULL && CurrentLib != NULL )
|
||||||
|
{
|
||||||
|
if( !CurrentAliasName.IsEmpty() )
|
||||||
|
{
|
||||||
|
LibCmpEntry* entry = CurrentLib->FindEntry( CurrentAliasName );
|
||||||
|
|
||||||
|
if( entry != NULL )
|
||||||
|
enable = !entry->m_DocFile.IsEmpty();
|
||||||
|
}
|
||||||
|
else if( !CurrentLibEntry->m_DocFile.IsEmpty() )
|
||||||
|
{
|
||||||
|
enable = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
event.Enable( enable );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WinEDA_LibeditFrame::OnUpdatePinByPin( wxUpdateUIEvent& event )
|
||||||
|
{
|
||||||
|
event.Enable( ( CurrentLibEntry != NULL )
|
||||||
|
&& ( ( CurrentLibEntry->m_UnitCount > 1 ) || g_AsDeMorgan ) );
|
||||||
|
|
||||||
|
if( m_HToolBar )
|
||||||
|
m_HToolBar->ToggleTool( event.GetId(), g_EditPinByPinIsOn );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WinEDA_LibeditFrame::OnUpdatePartNumber( wxUpdateUIEvent& event )
|
||||||
|
{
|
||||||
|
if( m_SelpartBox == NULL )
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Using the typical event.Enable() call dosen't seem to work with wxGTK
|
||||||
|
* so use the pointer to alias combobox to directly enable or disable.
|
||||||
|
*/
|
||||||
|
m_SelpartBox->Enable( CurrentLibEntry != NULL
|
||||||
|
&& CurrentLibEntry->m_UnitCount > 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WinEDA_LibeditFrame::OnUpdateDeMorganNormal( wxUpdateUIEvent& event )
|
||||||
|
{
|
||||||
|
if( m_HToolBar == NULL )
|
||||||
|
return;
|
||||||
|
|
||||||
|
event.Enable( CurrentLibEntry != NULL && CurrentLibEntry->HasConversion() );
|
||||||
|
m_HToolBar->ToggleTool( event.GetId(), CurrentConvert <= 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WinEDA_LibeditFrame::OnUpdateDeMorganConvert( wxUpdateUIEvent& event )
|
||||||
|
{
|
||||||
|
if( m_HToolBar == NULL )
|
||||||
|
return;
|
||||||
|
|
||||||
|
event.Enable( CurrentLibEntry != NULL && CurrentLibEntry->HasConversion() );
|
||||||
|
m_HToolBar->ToggleTool( event.GetId(), CurrentConvert > 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WinEDA_LibeditFrame::OnUpdateSelectAlias( wxUpdateUIEvent& event )
|
||||||
|
{
|
||||||
|
if( m_SelAliasBox == NULL )
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* Using the typical event.Enable() call dosen't seem to work with wxGTK
|
||||||
|
* so use the pointer to alias combobox to directly enable or disable.
|
||||||
|
*/
|
||||||
|
m_SelAliasBox->Enable( CurrentLibEntry != NULL
|
||||||
|
&& !CurrentLibEntry->m_AliasList.IsEmpty() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WinEDA_LibeditFrame::OnSelectAlias( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
if( m_SelAliasBox == NULL
|
||||||
|
|| m_SelAliasBox->GetStringSelection().CmpNoCase( CurrentAliasName ) == 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
|
LibItemToRepeat = NULL;
|
||||||
|
|
||||||
|
if( m_SelAliasBox->GetStringSelection().CmpNoCase(CurrentLibEntry->GetName() ) == 0 )
|
||||||
|
CurrentAliasName.Empty();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CurrentAliasName = m_SelAliasBox->GetStringSelection();
|
||||||
|
DisplayCmpDoc( CurrentAliasName );
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawPanel->Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WinEDA_LibeditFrame::OnSelectPart( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
int i = event.GetSelection();
|
||||||
|
if( i < 0 )
|
||||||
|
return;
|
||||||
|
LibItemToRepeat = NULL;
|
||||||
|
CurrentUnit = i + 1;
|
||||||
|
DrawPanel->Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
|
void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
int id = event.GetId();
|
int id = event.GetId();
|
||||||
|
@ -434,23 +521,15 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
|
||||||
switch( id )
|
switch( id )
|
||||||
{
|
{
|
||||||
case ID_LIBEDIT_SAVE_CURRENT_LIB:
|
|
||||||
if( GetScreen()->IsModify() )
|
|
||||||
{
|
|
||||||
if( IsOK( this, _( "Include last component changes?" ) ) )
|
|
||||||
SaveOnePartInMemory();
|
|
||||||
}
|
|
||||||
SaveActiveLibrary();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_LIBEDIT_NEW_PART:
|
case ID_LIBEDIT_NEW_PART:
|
||||||
{
|
{
|
||||||
g_EditPinByPinIsOn = false;
|
g_EditPinByPinIsOn = false;
|
||||||
LibItemToRepeat = NULL;
|
LibItemToRepeat = NULL;
|
||||||
CreateNewLibraryPart();
|
CreateNewLibraryPart();
|
||||||
|
UpdateAliasSelectList();
|
||||||
|
UpdatePartSelectList();
|
||||||
GetScreen()->ClearUndoRedoList();
|
GetScreen()->ClearUndoRedoList();
|
||||||
DrawPanel->Refresh();
|
DrawPanel->Refresh();
|
||||||
SetToolbars();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,7 +543,6 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
g_EditPinByPinIsOn = false;
|
g_EditPinByPinIsOn = false;
|
||||||
GetScreen()->ClearUndoRedoList();
|
GetScreen()->ClearUndoRedoList();
|
||||||
SetToolbars();
|
|
||||||
}
|
}
|
||||||
DrawPanel->Refresh();
|
DrawPanel->Refresh();
|
||||||
break;
|
break;
|
||||||
|
@ -473,12 +551,10 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
SaveOnePartInMemory();
|
SaveOnePartInMemory();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_LIBEDIT_GET_FRAME_EDIT_PART:
|
|
||||||
InstallLibeditFrame( );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_LIBEDIT_GET_FRAME_EDIT_FIELDS:
|
case ID_LIBEDIT_GET_FRAME_EDIT_FIELDS:
|
||||||
InstallFieldsEditorDialog( );
|
InstallFieldsEditorDialog( );
|
||||||
|
UpdateAliasSelectList();
|
||||||
|
UpdatePartSelectList();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_LIBEDIT_DELETE_PART:
|
case ID_LIBEDIT_DELETE_PART:
|
||||||
|
@ -487,22 +563,17 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_LIBEDIT_CHECK_PART:
|
case ID_LIBEDIT_CHECK_PART:
|
||||||
if( CurrentLibEntry )
|
if( CurrentLibEntry && TestPins( CurrentLibEntry ) == false )
|
||||||
if( TestPins( CurrentLibEntry ) == false )
|
|
||||||
DisplayInfoMessage( this, _( " Pins Test OK!" ) );
|
DisplayInfoMessage( this, _( " Pins Test OK!" ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_DE_MORGAN_NORMAL_BUTT:
|
case ID_DE_MORGAN_NORMAL_BUTT:
|
||||||
m_HToolBar->ToggleTool( ID_DE_MORGAN_NORMAL_BUTT, true );
|
|
||||||
m_HToolBar->ToggleTool( ID_DE_MORGAN_CONVERT_BUTT, false );
|
|
||||||
LibItemToRepeat = NULL;
|
LibItemToRepeat = NULL;
|
||||||
CurrentConvert = 1;
|
CurrentConvert = 1;
|
||||||
DrawPanel->Refresh();
|
DrawPanel->Refresh();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_DE_MORGAN_CONVERT_BUTT:
|
case ID_DE_MORGAN_CONVERT_BUTT:
|
||||||
m_HToolBar->ToggleTool( ID_DE_MORGAN_NORMAL_BUTT, false );
|
|
||||||
m_HToolBar->ToggleTool( ID_DE_MORGAN_CONVERT_BUTT, true );
|
|
||||||
LibItemToRepeat = NULL;
|
LibItemToRepeat = NULL;
|
||||||
CurrentConvert = 2;
|
CurrentConvert = 2;
|
||||||
DrawPanel->Refresh();
|
DrawPanel->Refresh();
|
||||||
|
@ -514,11 +585,9 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
wxString docfilename;
|
wxString docfilename;
|
||||||
if( !CurrentAliasName.IsEmpty() )
|
if( !CurrentAliasName.IsEmpty() )
|
||||||
{
|
{
|
||||||
int AliasLocation = LocateAlias( CurrentLibEntry->m_AliasList,
|
LibCmpEntry* entry = CurrentLib->FindEntry( CurrentAliasName );
|
||||||
CurrentAliasName );
|
if( entry != NULL )
|
||||||
if( AliasLocation >= 0 )
|
docfilename = entry->m_DocFile;
|
||||||
docfilename =
|
|
||||||
CurrentLibEntry->m_AliasList[AliasLocation + ALIAS_DOC_FILENAME];
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
docfilename = CurrentLibEntry->m_DocFile;
|
docfilename = CurrentLibEntry->m_DocFile;
|
||||||
|
@ -531,32 +600,6 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
|
||||||
case ID_LIBEDIT_EDIT_PIN_BY_PIN:
|
case ID_LIBEDIT_EDIT_PIN_BY_PIN:
|
||||||
g_EditPinByPinIsOn = g_EditPinByPinIsOn ? false : true;
|
g_EditPinByPinIsOn = g_EditPinByPinIsOn ? false : true;
|
||||||
m_HToolBar->ToggleTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, g_EditPinByPinIsOn );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_LIBEDIT_SELECT_PART_NUMBER:
|
|
||||||
{
|
|
||||||
int ii = m_SelpartBox->GetChoice();
|
|
||||||
if( ii < 0 )
|
|
||||||
return;
|
|
||||||
LibItemToRepeat = NULL;
|
|
||||||
CurrentUnit = ii + 1;
|
|
||||||
DrawPanel->Refresh();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_LIBEDIT_SELECT_ALIAS:
|
|
||||||
{
|
|
||||||
int ii = m_SelAliasBox->GetChoice();
|
|
||||||
if( ii < 0 )
|
|
||||||
return;
|
|
||||||
LibItemToRepeat = NULL;
|
|
||||||
if( ii > 0 )
|
|
||||||
CurrentAliasName = m_SelAliasBox->GetValue();
|
|
||||||
else
|
|
||||||
CurrentAliasName.Empty();
|
|
||||||
DrawPanel->Refresh();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_LIBEDIT_PIN_EDIT:
|
case ID_POPUP_LIBEDIT_PIN_EDIT:
|
||||||
|
|
|
@ -83,20 +83,17 @@ static void PlotLibPart( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem )
|
||||||
case COMPONENT_ARC_DRAW_TYPE:
|
case COMPONENT_ARC_DRAW_TYPE:
|
||||||
{
|
{
|
||||||
LibDrawArc* Arc = (LibDrawArc*) DEntry;
|
LibDrawArc* Arc = (LibDrawArc*) DEntry;
|
||||||
t1 = Arc->t1; t2 = Arc->t2;
|
t1 = Arc->m_t1;
|
||||||
|
t2 = Arc->m_t2;
|
||||||
pos = TransformCoordinate( TransMat, Arc->m_Pos ) + DrawLibItem->m_Pos;
|
pos = TransformCoordinate( TransMat, Arc->m_Pos ) + DrawLibItem->m_Pos;
|
||||||
MapAngles( &t1, &t2, TransMat );
|
MapAngles( &t1, &t2, TransMat );
|
||||||
if( draw_bgfill && Arc->m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
if( draw_bgfill && Arc->m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
||||||
{
|
{
|
||||||
plotter->set_color( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
plotter->set_color( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
||||||
plotter->arc( pos, -t2, -t1, Arc->m_Rayon, FILLED_SHAPE, 0 );
|
plotter->arc( pos, -t2, -t1, Arc->m_Radius, FILLED_SHAPE, 0 );
|
||||||
}
|
}
|
||||||
plotter->set_color( ReturnLayerColor( LAYER_DEVICE ) );
|
plotter->set_color( ReturnLayerColor( LAYER_DEVICE ) );
|
||||||
plotter->arc( pos,
|
plotter->arc( pos, -t2, -t1, Arc->m_Radius, Arc->m_Fill,
|
||||||
-t2,
|
|
||||||
-t1,
|
|
||||||
Arc->m_Rayon,
|
|
||||||
Arc->m_Fill,
|
|
||||||
thickness );
|
thickness );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -108,11 +105,11 @@ static void PlotLibPart( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem )
|
||||||
if( draw_bgfill && Circle->m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
if( draw_bgfill && Circle->m_Fill == FILLED_WITH_BG_BODYCOLOR )
|
||||||
{
|
{
|
||||||
plotter->set_color( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
plotter->set_color( ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) );
|
||||||
plotter->circle( pos, Circle->m_Rayon * 2, FILLED_SHAPE, 0 );
|
plotter->circle( pos, Circle->m_Radius * 2, FILLED_SHAPE, 0 );
|
||||||
}
|
}
|
||||||
plotter->set_color( ReturnLayerColor( LAYER_DEVICE ) );
|
plotter->set_color( ReturnLayerColor( LAYER_DEVICE ) );
|
||||||
plotter->circle( pos,
|
plotter->circle( pos,
|
||||||
Circle->m_Rayon * 2,
|
Circle->m_Radius * 2,
|
||||||
Circle->m_Fill,
|
Circle->m_Fill,
|
||||||
thickness );
|
thickness );
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,15 +223,6 @@ EDA_LibComponentStruct* CopyLibEntryStruct( EDA_LibComponentStruct* OldEntry );
|
||||||
* Parametres de sortie: pointeur sur la structure creee */
|
* Parametres de sortie: pointeur sur la structure creee */
|
||||||
|
|
||||||
|
|
||||||
/***************/
|
|
||||||
/* SYMBEDIT.CPP */
|
|
||||||
/***************/
|
|
||||||
void SuppressDuplicateDrawItem( EDA_LibComponentStruct* LibEntry );
|
|
||||||
|
|
||||||
/* Routine de suppression des elements de trace dupliques, situation
|
|
||||||
* frequente lorsque l'on charge des symboles predessines plusieurs fois
|
|
||||||
* pour definir un composant */
|
|
||||||
|
|
||||||
/**************/
|
/**************/
|
||||||
/* NETLIST.CPP */
|
/* NETLIST.CPP */
|
||||||
/**************/
|
/**************/
|
||||||
|
@ -365,18 +356,6 @@ void BreakSegment(SCH_SCREEN * aScreen, wxPoint aBreakpoint );
|
||||||
|
|
||||||
void SetaParent( EDA_BaseStruct* Struct, BASE_SCREEN* Screen );
|
void SetaParent( EDA_BaseStruct* Struct, BASE_SCREEN* Screen );
|
||||||
|
|
||||||
/***************/
|
|
||||||
/* LIBALIAS.CPP */
|
|
||||||
/***************/
|
|
||||||
|
|
||||||
bool BuildAliasData( LibraryStruct* Lib, EDA_LibComponentStruct* component );
|
|
||||||
|
|
||||||
/* Create the alias data for the lib component to edit */
|
|
||||||
int LocateAlias( const wxArrayString& AliasData, const wxString& Name );
|
|
||||||
|
|
||||||
/* Return an index in alias data list ( -1 if not found ) */
|
|
||||||
|
|
||||||
|
|
||||||
/***************/
|
/***************/
|
||||||
/* OPTIONS.CPP */
|
/* OPTIONS.CPP */
|
||||||
/***************/
|
/***************/
|
||||||
|
|
|
@ -36,7 +36,7 @@ EDA_LibComponentStruct* CopyLibEntryStruct( EDA_LibComponentStruct* OldEntry )
|
||||||
if( OldEntry->Type != ROOT )
|
if( OldEntry->Type != ROOT )
|
||||||
{
|
{
|
||||||
msg.Printf( wxT( "Component <%s> must be root type to make copy." ),
|
msg.Printf( wxT( "Component <%s> must be root type to make copy." ),
|
||||||
(const wxChar*) OldEntry->m_Name.m_Text );
|
(const wxChar*) OldEntry->GetName() );
|
||||||
wxLogError( msg );
|
wxLogError( msg );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ EDA_LibComponentStruct* CopyLibEntryStruct( EDA_LibComponentStruct* OldEntry )
|
||||||
msg.Printf( wxT( "Error attempting to copy draw item <%s> from \
|
msg.Printf( wxT( "Error attempting to copy draw item <%s> from \
|
||||||
component <%s>." ),
|
component <%s>." ),
|
||||||
(const wxChar*) OldDrawings->GetClass(),
|
(const wxChar*) OldDrawings->GetClass(),
|
||||||
(const wxChar*) OldEntry->m_Name.m_Text );
|
(const wxChar*) OldEntry->GetName() );
|
||||||
wxLogError( msg );
|
wxLogError( msg );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -572,7 +572,7 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||||
case COMPONENT_CIRCLE_DRAW_TYPE:
|
case COMPONENT_CIRCLE_DRAW_TYPE:
|
||||||
dx = ( (LibDrawCircle*) CurrentDrawItem )->m_Pos.x - curr_pos.x;
|
dx = ( (LibDrawCircle*) CurrentDrawItem )->m_Pos.x - curr_pos.x;
|
||||||
dy = ( (LibDrawCircle*) CurrentDrawItem )->m_Pos.y - curr_pos.y;
|
dy = ( (LibDrawCircle*) CurrentDrawItem )->m_Pos.y - curr_pos.y;
|
||||||
( (LibDrawCircle*) CurrentDrawItem )->m_Rayon =
|
( (LibDrawCircle*) CurrentDrawItem )->m_Radius =
|
||||||
(int) sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) );
|
(int) sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) );
|
||||||
( (LibDrawCircle*) CurrentDrawItem )->m_Fill = FlSymbol_Fill;
|
( (LibDrawCircle*) CurrentDrawItem )->m_Fill = FlSymbol_Fill;
|
||||||
break;
|
break;
|
||||||
|
@ -741,13 +741,16 @@ static void ComputeArc( LibDrawArc* DrawItem, wxPoint ArcCentre )
|
||||||
int cX, cY; /* Coord centre de l'arc */
|
int cX, cY; /* Coord centre de l'arc */
|
||||||
int angle;
|
int angle;
|
||||||
|
|
||||||
cX = ArcCentre.x; cY = ArcCentre.y;
|
cX = ArcCentre.x;
|
||||||
|
cY = ArcCentre.y;
|
||||||
|
|
||||||
cY = -cY; /* Attention a l'orientation de l'axe Y */
|
cY = -cY; /* Attention a l'orientation de l'axe Y */
|
||||||
|
|
||||||
/* calcul de cX et cY pour que l'arc passe par ArcStartX,Y et ArcEndX,Y */
|
/* calcul de cX et cY pour que l'arc passe par ArcStartX,Y et ArcEndX,Y */
|
||||||
dx = ArcEndX - ArcStartX; dy = ArcEndY - ArcStartY;
|
dx = ArcEndX - ArcStartX;
|
||||||
cX -= ArcStartX; cY -= ArcStartY;
|
dy = ArcEndY - ArcStartY;
|
||||||
|
cX -= ArcStartX;
|
||||||
|
cY -= ArcStartY;
|
||||||
angle = (int) ( atan2( (double) dy, (double) dx ) * 1800 / M_PI );
|
angle = (int) ( atan2( (double) dy, (double) dx ) * 1800 / M_PI );
|
||||||
RotatePoint( &dx, &dy, angle ); /* Le segment dx, dy est horizontal */
|
RotatePoint( &dx, &dy, angle ); /* Le segment dx, dy est horizontal */
|
||||||
/* -> dx = longueur, dy = 0 */
|
/* -> dx = longueur, dy = 0 */
|
||||||
|
@ -755,59 +758,61 @@ static void ComputeArc( LibDrawArc* DrawItem, wxPoint ArcCentre )
|
||||||
cX = dx / 2; /* cX, cY est sur la mediane du segment 0,0 a dx,0 */
|
cX = dx / 2; /* cX, cY est sur la mediane du segment 0,0 a dx,0 */
|
||||||
|
|
||||||
RotatePoint( &cX, &cY, -angle );
|
RotatePoint( &cX, &cY, -angle );
|
||||||
cX += ArcStartX; cY += ArcStartY;
|
cX += ArcStartX;
|
||||||
|
cY += ArcStartY;
|
||||||
DrawItem->m_Pos.x = cX; DrawItem->m_Pos.y = cY;
|
DrawItem->m_Pos.x = cX;
|
||||||
|
DrawItem->m_Pos.y = cY;
|
||||||
|
|
||||||
dx = ArcStartX - DrawItem->m_Pos.x;
|
dx = ArcStartX - DrawItem->m_Pos.x;
|
||||||
dy = ArcStartY - DrawItem->m_Pos.y;
|
dy = ArcStartY - DrawItem->m_Pos.y;
|
||||||
|
|
||||||
DrawItem->m_Rayon = (int) sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) );
|
DrawItem->m_Radius = (int) sqrt( ( (double) dx * dx ) +
|
||||||
|
( (double) dy * dy ) );
|
||||||
|
|
||||||
DrawItem->t1 = (int) ( atan2( (double) dy, (double) dx ) * 1800 / M_PI );
|
DrawItem->m_t1 = (int) ( atan2( (double) dy, (double) dx ) * 1800 / M_PI );
|
||||||
|
|
||||||
dx = ArcEndX - DrawItem->m_Pos.x;
|
dx = ArcEndX - DrawItem->m_Pos.x;
|
||||||
dy = ArcEndY - DrawItem->m_Pos.y;
|
dy = ArcEndY - DrawItem->m_Pos.y;
|
||||||
|
|
||||||
DrawItem->t2 = (int) ( atan2( (double) dy, (double) dx ) * 1800 / M_PI );
|
DrawItem->m_t2 = (int) ( atan2( (double) dy, (double) dx ) * 1800 / M_PI );
|
||||||
|
|
||||||
DrawItem->m_ArcStart.x = ArcStartX;
|
DrawItem->m_ArcStart.x = ArcStartX;
|
||||||
DrawItem->m_ArcStart.y = ArcStartY;
|
DrawItem->m_ArcStart.y = ArcStartY;
|
||||||
DrawItem->m_ArcEnd.x = ArcEndX;
|
DrawItem->m_ArcEnd.x = ArcEndX;
|
||||||
DrawItem->m_ArcEnd.y = ArcEndY;
|
DrawItem->m_ArcEnd.y = ArcEndY;
|
||||||
|
|
||||||
NORMALIZE_ANGLE( DrawItem->t1 );
|
NORMALIZE_ANGLE( DrawItem->m_t1 );
|
||||||
NORMALIZE_ANGLE( DrawItem->t2 ); // angles = 0 .. 3600
|
NORMALIZE_ANGLE( DrawItem->m_t2 ); // angles = 0 .. 3600
|
||||||
|
|
||||||
// limitation val abs a < 1800 (1/2 cercle) pour eviter Pbs d'affichage en miroir
|
// limitation val abs a < 1800 (1/2 cercle) pour eviter Pbs d'affichage en miroir
|
||||||
// car en trace on suppose que l'arc fait moins de 180 deg pour trouver
|
// car en trace on suppose que l'arc fait moins de 180 deg pour trouver
|
||||||
// son orientation apres rot, miroir...
|
// son orientation apres rot, miroir...
|
||||||
if( (DrawItem->t2 - DrawItem->t1) > 1800 )
|
if( (DrawItem->m_t2 - DrawItem->m_t1) > 1800 )
|
||||||
DrawItem->t2 -= 3600;
|
DrawItem->m_t2 -= 3600;
|
||||||
else if( (DrawItem->t2 - DrawItem->t1) <= -1800 )
|
else if( (DrawItem->m_t2 - DrawItem->m_t1) <= -1800 )
|
||||||
DrawItem->t2 += 3600;
|
DrawItem->m_t2 += 3600;
|
||||||
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
angle = DrawItem->t2 - DrawItem->t1;
|
angle = DrawItem->m_t2 - DrawItem->m_t1;
|
||||||
msg.Printf( _( "Arc %.1f deg" ), (float) angle / 10 );
|
msg.Printf( _( "Arc %.1f deg" ), (float) angle / 10 );
|
||||||
WinEDA_SchematicFrame* frame =
|
WinEDA_SchematicFrame* frame =
|
||||||
(WinEDA_SchematicFrame*) wxGetApp().GetTopWindow();
|
(WinEDA_SchematicFrame*) wxGetApp().GetTopWindow();
|
||||||
frame->m_LibeditFrame->PrintMsg( msg );
|
frame->m_LibeditFrame->PrintMsg( msg );
|
||||||
|
|
||||||
while( (DrawItem->t2 - DrawItem->t1) >= 1800 )
|
while( (DrawItem->m_t2 - DrawItem->m_t1) >= 1800 )
|
||||||
{
|
{
|
||||||
DrawItem->t2--;
|
DrawItem->m_t2--;
|
||||||
DrawItem->t1++;
|
DrawItem->m_t1++;
|
||||||
}
|
}
|
||||||
|
|
||||||
while( (DrawItem->t1 - DrawItem->t2) >= 1800 )
|
while( (DrawItem->m_t1 - DrawItem->m_t2) >= 1800 )
|
||||||
{
|
{
|
||||||
DrawItem->t2++;
|
DrawItem->m_t2++;
|
||||||
DrawItem->t1--;
|
DrawItem->m_t1--;
|
||||||
}
|
}
|
||||||
|
|
||||||
NORMALIZE_ANGLE( DrawItem->t1 );
|
NORMALIZE_ANGLE( DrawItem->m_t1 );
|
||||||
NORMALIZE_ANGLE( DrawItem->t2 );
|
NORMALIZE_ANGLE( DrawItem->m_t2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,6 @@
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
|
|
||||||
static bool CompareSymbols( LibEDA_BaseStruct* DEntryRef,
|
|
||||||
LibEDA_BaseStruct* DEntryCompare );
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read a component shape file (a symbol file *.sym )and add data (graphic
|
* Read a component shape file (a symbol file *.sym )and add data (graphic
|
||||||
* items) to the current component.
|
* items) to the current component.
|
||||||
|
@ -124,7 +120,7 @@ void WinEDA_LibeditFrame::LoadOneSymbol( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove duplicated drawings:
|
// Remove duplicated drawings:
|
||||||
SuppressDuplicateDrawItem( CurrentLibEntry );
|
CurrentLibEntry->RemoveDuplicateDrawItems();
|
||||||
|
|
||||||
// Clear flags
|
// Clear flags
|
||||||
DrawEntry = CurrentLibEntry->m_Drawings;
|
DrawEntry = CurrentLibEntry->m_Drawings;
|
||||||
|
@ -246,149 +242,6 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Delete redundant graphic items.
|
|
||||||
*
|
|
||||||
* Useful after loading asymbole from a file symbol, because some graphic items
|
|
||||||
* can be duplicated.
|
|
||||||
*/
|
|
||||||
void SuppressDuplicateDrawItem( EDA_LibComponentStruct* LibEntry )
|
|
||||||
{
|
|
||||||
LibEDA_BaseStruct* DEntryRef, * DEntryCompare;
|
|
||||||
bool deleted;
|
|
||||||
wxDC* DC = NULL;
|
|
||||||
|
|
||||||
DEntryRef = LibEntry->m_Drawings;
|
|
||||||
while( DEntryRef )
|
|
||||||
{
|
|
||||||
if( DEntryRef->Next() == NULL )
|
|
||||||
return;
|
|
||||||
DEntryCompare = DEntryRef->Next();
|
|
||||||
if( DEntryCompare == NULL )
|
|
||||||
return;
|
|
||||||
deleted = 0;
|
|
||||||
while( DEntryCompare )
|
|
||||||
{
|
|
||||||
if( CompareSymbols( DEntryRef, DEntryCompare ) == TRUE )
|
|
||||||
{
|
|
||||||
LibEntry->RemoveDrawItem( DEntryRef, NULL, DC );
|
|
||||||
deleted = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
DEntryCompare = DEntryCompare->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !deleted )
|
|
||||||
DEntryRef = DEntryRef->Next();
|
|
||||||
else
|
|
||||||
DEntryRef = LibEntry->m_Drawings;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Compare 2 graphic items (arc, lines ...).
|
|
||||||
*
|
|
||||||
* return FALSE if different
|
|
||||||
* TRUE if they are identical, and therefore redundant
|
|
||||||
*/
|
|
||||||
static bool CompareSymbols( LibEDA_BaseStruct* DEntryRef,
|
|
||||||
LibEDA_BaseStruct* DEntryCompare )
|
|
||||||
{
|
|
||||||
/* Comparaison des proprietes generales */
|
|
||||||
if( DEntryRef->Type() != DEntryCompare->Type() )
|
|
||||||
return FALSE;
|
|
||||||
if( DEntryRef->m_Unit != DEntryCompare->m_Unit )
|
|
||||||
return FALSE;
|
|
||||||
if( DEntryRef->m_Convert != DEntryCompare->m_Convert )
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
switch( DEntryRef->Type() )
|
|
||||||
{
|
|
||||||
case COMPONENT_ARC_DRAW_TYPE:
|
|
||||||
#undef REFSTRUCT
|
|
||||||
#undef CMPSTRUCT
|
|
||||||
#define REFSTRUCT ( (LibDrawArc*) DEntryRef )
|
|
||||||
#define CMPSTRUCT ( (LibDrawArc*) DEntryCompare )
|
|
||||||
if( REFSTRUCT->m_Pos.x != CMPSTRUCT->m_Pos.x )
|
|
||||||
return FALSE;
|
|
||||||
if( REFSTRUCT->m_Pos.y != CMPSTRUCT->m_Pos.y )
|
|
||||||
return FALSE;
|
|
||||||
if( REFSTRUCT->t1 != CMPSTRUCT->t1 )
|
|
||||||
return FALSE;
|
|
||||||
if( REFSTRUCT->t2 != CMPSTRUCT->t2 )
|
|
||||||
return FALSE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COMPONENT_CIRCLE_DRAW_TYPE:
|
|
||||||
#undef REFSTRUCT
|
|
||||||
#undef CMPSTRUCT
|
|
||||||
#define REFSTRUCT ( (LibDrawCircle*) DEntryRef )
|
|
||||||
#define CMPSTRUCT ( (LibDrawCircle*) DEntryCompare )
|
|
||||||
if( REFSTRUCT->m_Pos.x != CMPSTRUCT->m_Pos.x )
|
|
||||||
return FALSE;
|
|
||||||
if( REFSTRUCT->m_Pos.y != CMPSTRUCT->m_Pos.y )
|
|
||||||
return FALSE;
|
|
||||||
if( REFSTRUCT->m_Rayon != CMPSTRUCT->m_Rayon )
|
|
||||||
return FALSE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
|
||||||
#undef REFSTRUCT
|
|
||||||
#undef CMPSTRUCT
|
|
||||||
#define REFSTRUCT ( (LibDrawText*) DEntryRef )
|
|
||||||
#define CMPSTRUCT ( (LibDrawText*) DEntryCompare )
|
|
||||||
if( REFSTRUCT->m_Pos != CMPSTRUCT->m_Pos )
|
|
||||||
return FALSE;
|
|
||||||
if( REFSTRUCT->m_Size != CMPSTRUCT->m_Size )
|
|
||||||
return FALSE;
|
|
||||||
if( REFSTRUCT->m_Text != CMPSTRUCT->m_Text )
|
|
||||||
return FALSE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COMPONENT_RECT_DRAW_TYPE:
|
|
||||||
#undef REFSTRUCT
|
|
||||||
#undef CMPSTRUCT
|
|
||||||
#define REFSTRUCT ( (LibDrawSquare*) DEntryRef )
|
|
||||||
#define CMPSTRUCT ( (LibDrawSquare*) DEntryCompare )
|
|
||||||
if( REFSTRUCT->m_Pos != CMPSTRUCT->m_Pos )
|
|
||||||
return FALSE;
|
|
||||||
if( REFSTRUCT->m_End != CMPSTRUCT->m_End )
|
|
||||||
return FALSE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COMPONENT_PIN_DRAW_TYPE:
|
|
||||||
#undef REFSTRUCT
|
|
||||||
#undef CMPSTRUCT
|
|
||||||
#define REFSTRUCT ( (LibDrawPin*) DEntryRef )
|
|
||||||
#define CMPSTRUCT ( (LibDrawPin*) DEntryCompare )
|
|
||||||
if( REFSTRUCT->m_Pos != CMPSTRUCT->m_Pos )
|
|
||||||
return FALSE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COMPONENT_POLYLINE_DRAW_TYPE:
|
|
||||||
#undef REFSTRUCT
|
|
||||||
#undef CMPSTRUCT
|
|
||||||
#define REFSTRUCT ( (LibDrawPolyline*) DEntryRef )
|
|
||||||
#define CMPSTRUCT ( (LibDrawPolyline*) DEntryCompare )
|
|
||||||
if( REFSTRUCT->GetCornerCount() != CMPSTRUCT->GetCornerCount() )
|
|
||||||
return FALSE;
|
|
||||||
for( unsigned ii = 0; ii < REFSTRUCT->GetCornerCount(); ii++ )
|
|
||||||
{
|
|
||||||
if( REFSTRUCT->m_PolyPoints[ii] != CMPSTRUCT->m_PolyPoints[ii] )
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* Routine de placement du point d'ancrage ( reference des coordonnes pour */
|
/* Routine de placement du point d'ancrage ( reference des coordonnes pour */
|
||||||
/* le trace) du composant courant */
|
/* le trace) du composant courant */
|
||||||
|
@ -398,76 +251,14 @@ static bool CompareSymbols( LibEDA_BaseStruct* DEntryRef,
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
void WinEDA_LibeditFrame::PlaceAncre()
|
void WinEDA_LibeditFrame::PlaceAncre()
|
||||||
{
|
{
|
||||||
EDA_LibComponentStruct* LibEntry;
|
if( CurrentLibEntry == NULL )
|
||||||
LibEDA_BaseStruct* DrawEntry;
|
|
||||||
|
|
||||||
LibEntry = CurrentLibEntry;
|
|
||||||
if( LibEntry == NULL )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxSize offset( -GetScreen()->m_Curseur.x, GetScreen()->m_Curseur.y );
|
wxPoint offset( -GetScreen()->m_Curseur.x, GetScreen()->m_Curseur.y );
|
||||||
|
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
|
|
||||||
LibEntry->m_Name.m_Pos += offset;
|
CurrentLibEntry->SetOffset( offset );
|
||||||
LibEntry->m_Prefix.m_Pos += offset;
|
|
||||||
|
|
||||||
for( LibDrawField* field = LibEntry->m_Fields; field; field = field->Next() )
|
|
||||||
{
|
|
||||||
field->m_Pos += offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
DrawEntry = LibEntry->m_Drawings;
|
|
||||||
while( DrawEntry )
|
|
||||||
{
|
|
||||||
switch( DrawEntry->Type() )
|
|
||||||
{
|
|
||||||
case COMPONENT_ARC_DRAW_TYPE:
|
|
||||||
#undef STRUCT
|
|
||||||
#define STRUCT ( (LibDrawArc*) DrawEntry )
|
|
||||||
STRUCT->m_Pos += offset;
|
|
||||||
STRUCT->m_ArcStart += offset;
|
|
||||||
STRUCT->m_ArcEnd += offset;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COMPONENT_CIRCLE_DRAW_TYPE:
|
|
||||||
#undef STRUCT
|
|
||||||
#define STRUCT ( (LibDrawCircle*) DrawEntry )
|
|
||||||
STRUCT->m_Pos += offset;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
|
||||||
#undef STRUCT
|
|
||||||
#define STRUCT ( (LibDrawText*) DrawEntry )
|
|
||||||
STRUCT->m_Pos += offset;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COMPONENT_RECT_DRAW_TYPE:
|
|
||||||
#undef STRUCT
|
|
||||||
#define STRUCT ( (LibDrawSquare*) DrawEntry )
|
|
||||||
STRUCT->m_Pos += offset;
|
|
||||||
STRUCT->m_End += offset;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COMPONENT_PIN_DRAW_TYPE:
|
|
||||||
#undef STRUCT
|
|
||||||
#define STRUCT ( (LibDrawPin*) DrawEntry )
|
|
||||||
STRUCT->m_Pos += offset;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COMPONENT_POLYLINE_DRAW_TYPE:
|
|
||||||
#undef STRUCT
|
|
||||||
#define STRUCT ( (LibDrawPolyline*) DrawEntry )
|
|
||||||
for( unsigned ii = 0; ii < STRUCT->GetCornerCount(); ii++ )
|
|
||||||
STRUCT->m_PolyPoints[ii] += offset;
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
DrawEntry = DrawEntry->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Redraw the symbol */
|
/* Redraw the symbol */
|
||||||
GetScreen()->m_Curseur.x = GetScreen()->m_Curseur.y = 0;
|
GetScreen()->m_Curseur.x = GetScreen()->m_Curseur.y = 0;
|
||||||
|
|
|
@ -18,11 +18,6 @@
|
||||||
#define LISTBOX_WIDTH 120
|
#define LISTBOX_WIDTH 120
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// resources
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// USE_XPM_BITMAPS
|
|
||||||
#include "bitmaps.h"
|
#include "bitmaps.h"
|
||||||
|
|
||||||
#include "id.h"
|
#include "id.h"
|
||||||
|
@ -32,19 +27,17 @@ extern int ImportPartId;
|
||||||
extern int CreateNewLibAndSavePartId;
|
extern int CreateNewLibAndSavePartId;
|
||||||
|
|
||||||
|
|
||||||
/****************************************************/
|
|
||||||
void WinEDA_LibeditFrame::ReCreateVToolbar()
|
void WinEDA_LibeditFrame::ReCreateVToolbar()
|
||||||
/****************************************************/
|
|
||||||
{
|
{
|
||||||
if( m_VToolBar == NULL )
|
if( m_VToolBar != NULL )
|
||||||
{
|
return;
|
||||||
m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, FALSE );
|
|
||||||
|
m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, false );
|
||||||
|
|
||||||
// Set up toolbar
|
// Set up toolbar
|
||||||
m_VToolBar->AddTool( ID_NO_SELECT_BUTT, wxEmptyString,
|
m_VToolBar->AddTool( ID_NO_SELECT_BUTT, wxEmptyString,
|
||||||
wxBitmap( cursor_xpm ),
|
wxBitmap( cursor_xpm ),
|
||||||
_( "deselect current tool" ), wxITEM_CHECK );
|
_( "Deselect current tool" ), wxITEM_CHECK );
|
||||||
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, TRUE );
|
|
||||||
|
|
||||||
m_VToolBar->AddSeparator();
|
m_VToolBar->AddSeparator();
|
||||||
m_VToolBar->AddTool( ID_LIBEDIT_PIN_BUTT, wxEmptyString,
|
m_VToolBar->AddTool( ID_LIBEDIT_PIN_BUTT, wxEmptyString,
|
||||||
|
@ -57,15 +50,15 @@ void WinEDA_LibeditFrame::ReCreateVToolbar()
|
||||||
|
|
||||||
m_VToolBar->AddTool( ID_LIBEDIT_BODY_RECT_BUTT, wxEmptyString,
|
m_VToolBar->AddTool( ID_LIBEDIT_BODY_RECT_BUTT, wxEmptyString,
|
||||||
wxBitmap( add_rectangle_xpm ),
|
wxBitmap( add_rectangle_xpm ),
|
||||||
_( "Add rectangles" ), wxITEM_CHECK );
|
_( "Add rectangle" ), wxITEM_CHECK );
|
||||||
|
|
||||||
m_VToolBar->AddTool( ID_LIBEDIT_BODY_CIRCLE_BUTT, wxEmptyString,
|
m_VToolBar->AddTool( ID_LIBEDIT_BODY_CIRCLE_BUTT, wxEmptyString,
|
||||||
wxBitmap( add_circle_xpm ),
|
wxBitmap( add_circle_xpm ),
|
||||||
_( "Add circles" ), wxITEM_CHECK );
|
_( "Add circle" ), wxITEM_CHECK );
|
||||||
|
|
||||||
m_VToolBar->AddTool( ID_LIBEDIT_BODY_ARC_BUTT, wxEmptyString,
|
m_VToolBar->AddTool( ID_LIBEDIT_BODY_ARC_BUTT, wxEmptyString,
|
||||||
wxBitmap( add_arc_xpm ),
|
wxBitmap( add_arc_xpm ),
|
||||||
_( "Add arcs" ), wxITEM_CHECK );
|
_( "Add arc" ), wxITEM_CHECK );
|
||||||
|
|
||||||
m_VToolBar->AddTool( ID_LIBEDIT_BODY_LINE_BUTT, wxEmptyString,
|
m_VToolBar->AddTool( ID_LIBEDIT_BODY_LINE_BUTT, wxEmptyString,
|
||||||
wxBitmap( add_polygon_xpm ),
|
wxBitmap( add_polygon_xpm ),
|
||||||
|
@ -93,39 +86,34 @@ void WinEDA_LibeditFrame::ReCreateVToolbar()
|
||||||
m_VToolBar->Realize();
|
m_VToolBar->Realize();
|
||||||
}
|
}
|
||||||
|
|
||||||
SetToolbars();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************/
|
|
||||||
void WinEDA_LibeditFrame::ReCreateHToolbar()
|
void WinEDA_LibeditFrame::ReCreateHToolbar()
|
||||||
/*************************************************/
|
|
||||||
|
|
||||||
/* Create or update the main Horizontal Toolbar for the schematic library editor
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
int ii;
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
// Create the toolbar if not exists
|
// Create the toolbar if not exists
|
||||||
if( m_HToolBar == NULL )
|
if( m_HToolBar != NULL )
|
||||||
{
|
return;
|
||||||
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );
|
|
||||||
|
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, true );
|
||||||
SetToolBar( m_HToolBar );
|
SetToolBar( m_HToolBar );
|
||||||
|
|
||||||
// Set up toolbar
|
// Set up toolbar
|
||||||
m_HToolBar->AddTool( ID_LIBEDIT_SAVE_CURRENT_LIB, wxEmptyString,
|
m_HToolBar->AddTool( ID_LIBEDIT_SAVE_CURRENT_LIB, wxEmptyString,
|
||||||
wxBitmap( save_library_xpm ),
|
wxBitmap( save_library_xpm ),
|
||||||
_( "Save current loaded library on disk (file update)" ) );
|
_( "Save current library to disk" ) );
|
||||||
|
|
||||||
m_HToolBar->AddTool( ID_LIBEDIT_SELECT_CURRENT_LIB, wxEmptyString, wxBitmap( library_xpm ),
|
m_HToolBar->AddTool( ID_LIBEDIT_SELECT_CURRENT_LIB, wxEmptyString,
|
||||||
|
wxBitmap( library_xpm ),
|
||||||
_( "Select working library" ) );
|
_( "Select working library" ) );
|
||||||
|
|
||||||
m_HToolBar->AddTool( ID_LIBEDIT_DELETE_PART, wxEmptyString, wxBitmap( delete_xpm ),
|
m_HToolBar->AddTool( ID_LIBEDIT_DELETE_PART, wxEmptyString,
|
||||||
|
wxBitmap( delete_xpm ),
|
||||||
_( "Delete component in current library" ) );
|
_( "Delete component in current library" ) );
|
||||||
|
|
||||||
m_HToolBar->AddSeparator();
|
m_HToolBar->AddSeparator();
|
||||||
m_HToolBar->AddTool( ID_LIBEDIT_NEW_PART, wxEmptyString, wxBitmap( new_component_xpm ),
|
m_HToolBar->AddTool( ID_LIBEDIT_NEW_PART, wxEmptyString,
|
||||||
|
wxBitmap( new_component_xpm ),
|
||||||
_( "New component" ) );
|
_( "New component" ) );
|
||||||
|
|
||||||
m_HToolBar->AddTool( ID_LIBEDIT_SELECT_PART, wxEmptyString,
|
m_HToolBar->AddTool( ID_LIBEDIT_SELECT_PART, wxEmptyString,
|
||||||
|
@ -134,23 +122,27 @@ void WinEDA_LibeditFrame::ReCreateHToolbar()
|
||||||
|
|
||||||
m_HToolBar->AddTool( ID_LIBEDIT_SAVE_CURRENT_PART, wxEmptyString,
|
m_HToolBar->AddTool( ID_LIBEDIT_SAVE_CURRENT_PART, wxEmptyString,
|
||||||
wxBitmap( save_part_in_mem_xpm ),
|
wxBitmap( save_part_in_mem_xpm ),
|
||||||
_( "Save current component into current loaded library (in memory)" ) );
|
_( "Update current component in current library" ) );
|
||||||
|
|
||||||
m_HToolBar->AddTool( ImportPartId, wxEmptyString, wxBitmap( import_xpm ),
|
m_HToolBar->AddTool( ImportPartId, wxEmptyString, wxBitmap( import_xpm ),
|
||||||
_( "import component" ) );
|
_( "Import component" ) );
|
||||||
|
|
||||||
m_HToolBar->AddTool( ExportPartId, wxEmptyString, wxBitmap( export_xpm ),
|
m_HToolBar->AddTool( ExportPartId, wxEmptyString, wxBitmap( export_xpm ),
|
||||||
_( "export component" ) );
|
_( "Export component" ) );
|
||||||
|
|
||||||
m_HToolBar->AddTool( CreateNewLibAndSavePartId, wxEmptyString,
|
m_HToolBar->AddTool( CreateNewLibAndSavePartId, wxEmptyString,
|
||||||
wxBitmap( new_library_xpm ),
|
wxBitmap( new_library_xpm ),
|
||||||
_( "Create a new library an save current component into" ) );
|
_( "Save current component to new library" ) );
|
||||||
|
|
||||||
m_HToolBar->AddSeparator();
|
m_HToolBar->AddSeparator();
|
||||||
msg = AddHotkeyName( _( "Undo last edition" ), s_Schematic_Hokeys_Descr, HK_UNDO );
|
msg = AddHotkeyName( _( "Undo last command" ), s_Schematic_Hokeys_Descr,
|
||||||
m_HToolBar->AddTool( ID_LIBEDIT_UNDO, wxEmptyString, wxBitmap( undo_xpm ), msg );
|
HK_UNDO );
|
||||||
msg = AddHotkeyName( _( "Redo the last undo command" ), s_Schematic_Hokeys_Descr, HK_REDO );
|
m_HToolBar->AddTool( ID_LIBEDIT_UNDO, wxEmptyString, wxBitmap( undo_xpm ),
|
||||||
m_HToolBar->AddTool( ID_LIBEDIT_REDO, wxEmptyString, wxBitmap( redo_xpm ), msg );
|
msg );
|
||||||
|
msg = AddHotkeyName( _( "Redo the last command" ), s_Schematic_Hokeys_Descr,
|
||||||
|
HK_REDO );
|
||||||
|
m_HToolBar->AddTool( ID_LIBEDIT_REDO, wxEmptyString, wxBitmap( redo_xpm ),
|
||||||
|
msg );
|
||||||
|
|
||||||
m_HToolBar->AddSeparator();
|
m_HToolBar->AddSeparator();
|
||||||
m_HToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_PART, wxEmptyString,
|
m_HToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_PART, wxEmptyString,
|
||||||
|
@ -159,12 +151,11 @@ void WinEDA_LibeditFrame::ReCreateHToolbar()
|
||||||
|
|
||||||
m_HToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_FIELDS, wxEmptyString,
|
m_HToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_FIELDS, wxEmptyString,
|
||||||
wxBitmap( add_text_xpm ),
|
wxBitmap( add_text_xpm ),
|
||||||
_( "Add, remove fields and edit fields properties" ) );
|
_( "Add and remove fields and edit field properties" ) );
|
||||||
|
|
||||||
m_HToolBar->AddSeparator();
|
m_HToolBar->AddSeparator();
|
||||||
m_HToolBar->AddTool( ID_LIBEDIT_CHECK_PART, wxEmptyString,
|
m_HToolBar->AddTool( ID_LIBEDIT_CHECK_PART, wxEmptyString,
|
||||||
wxBitmap( erc_xpm ),
|
wxBitmap( erc_xpm ), _( "Test for duplicate pins" ) );
|
||||||
_( "Test duplicate pins" ) );
|
|
||||||
|
|
||||||
m_HToolBar->AddSeparator();
|
m_HToolBar->AddSeparator();
|
||||||
msg = AddHotkeyName( _( "Zoom in" ), s_Libedit_Hokeys_Descr, HK_ZOOM_IN );
|
msg = AddHotkeyName( _( "Zoom in" ), s_Libedit_Hokeys_Descr, HK_ZOOM_IN );
|
||||||
|
@ -175,101 +166,47 @@ void WinEDA_LibeditFrame::ReCreateHToolbar()
|
||||||
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, wxBitmap( zoom_out_xpm ),
|
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, wxBitmap( zoom_out_xpm ),
|
||||||
msg );
|
msg );
|
||||||
|
|
||||||
msg = AddHotkeyName( _( "Redraw view" ), s_Libedit_Hokeys_Descr, HK_ZOOM_REDRAW );
|
msg = AddHotkeyName( _( "Redraw view" ), s_Libedit_Hokeys_Descr,
|
||||||
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, wxBitmap( zoom_redraw_xpm ),
|
HK_ZOOM_REDRAW );
|
||||||
msg );
|
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
|
||||||
|
wxBitmap( zoom_redraw_xpm ), msg );
|
||||||
|
|
||||||
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
|
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
|
||||||
wxBitmap( zoom_auto_xpm ),
|
wxBitmap( zoom_auto_xpm ), _( "Zoom page" ) );
|
||||||
_( "Zoom auto" ) );
|
|
||||||
|
|
||||||
m_HToolBar->AddSeparator();
|
m_HToolBar->AddSeparator();
|
||||||
m_HToolBar->AddTool( ID_DE_MORGAN_NORMAL_BUTT, wxEmptyString,
|
m_HToolBar->AddTool( ID_DE_MORGAN_NORMAL_BUTT, wxEmptyString,
|
||||||
wxBitmap( morgan1_xpm ),
|
wxBitmap( morgan1_xpm ),
|
||||||
_( "show as \"De Morgan\" normal part" ), wxITEM_CHECK );
|
_( "Show as \"De Morgan\" normal part" ),
|
||||||
m_HToolBar->ToggleTool( ID_DE_MORGAN_NORMAL_BUTT,
|
wxITEM_CHECK );
|
||||||
(CurrentConvert <= 1) ? TRUE : FALSE );
|
|
||||||
|
|
||||||
m_HToolBar->AddTool( ID_DE_MORGAN_CONVERT_BUTT, wxEmptyString,
|
m_HToolBar->AddTool( ID_DE_MORGAN_CONVERT_BUTT, wxEmptyString,
|
||||||
wxBitmap( morgan2_xpm ),
|
wxBitmap( morgan2_xpm ),
|
||||||
_( "show as \"De Morgan\" convert part" ), wxITEM_CHECK );
|
_( "Show as \"De Morgan\" convert part" ),
|
||||||
m_HToolBar->ToggleTool( ID_DE_MORGAN_CONVERT_BUTT,
|
wxITEM_CHECK );
|
||||||
(CurrentConvert >= 2) ? TRUE : FALSE );
|
|
||||||
|
|
||||||
m_HToolBar->AddSeparator();
|
m_HToolBar->AddSeparator();
|
||||||
m_HToolBar->AddTool( ID_LIBEDIT_VIEW_DOC, wxEmptyString,
|
m_HToolBar->AddTool( ID_LIBEDIT_VIEW_DOC, wxEmptyString,
|
||||||
wxBitmap( datasheet_xpm ),
|
wxBitmap( datasheet_xpm ), _( "Edit document file" ) );
|
||||||
_( "Documents" ) );
|
|
||||||
m_HToolBar->EnableTool( ID_LIBEDIT_VIEW_DOC, FALSE );
|
|
||||||
|
|
||||||
m_HToolBar->AddSeparator();
|
m_HToolBar->AddSeparator();
|
||||||
m_SelpartBox = new WinEDAChoiceBox( m_HToolBar, ID_LIBEDIT_SELECT_PART_NUMBER,
|
m_SelpartBox = new WinEDAChoiceBox( m_HToolBar,
|
||||||
wxDefaultPosition, wxSize( LISTBOX_WIDTH, -1 ) );
|
ID_LIBEDIT_SELECT_PART_NUMBER,
|
||||||
|
wxDefaultPosition,
|
||||||
|
wxSize( LISTBOX_WIDTH, -1 ) );
|
||||||
m_HToolBar->AddControl( m_SelpartBox );
|
m_HToolBar->AddControl( m_SelpartBox );
|
||||||
|
|
||||||
m_SelAliasBox = new WinEDAChoiceBox( m_HToolBar, ID_LIBEDIT_SELECT_ALIAS,
|
m_SelAliasBox = new WinEDAChoiceBox( m_HToolBar, ID_LIBEDIT_SELECT_ALIAS,
|
||||||
wxDefaultPosition, wxSize( LISTBOX_WIDTH, -1 ) );
|
wxDefaultPosition,
|
||||||
|
wxSize( LISTBOX_WIDTH, -1 ) );
|
||||||
m_HToolBar->AddControl( m_SelAliasBox );
|
m_HToolBar->AddControl( m_SelAliasBox );
|
||||||
|
|
||||||
m_HToolBar->AddSeparator();
|
m_HToolBar->AddSeparator();
|
||||||
m_HToolBar->AddTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, wxEmptyString,
|
m_HToolBar->AddTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, wxEmptyString,
|
||||||
wxBitmap( pin2pin_xpm ),
|
wxBitmap( pin2pin_xpm ),
|
||||||
_( "Edit pins part per part (Carefully use!)" ), wxITEM_CHECK );
|
_( "Edit pins part per part ( Use carefully!)" ),
|
||||||
m_HToolBar->ToggleTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, g_EditPinByPinIsOn );
|
wxITEM_CHECK );
|
||||||
|
|
||||||
// after adding the buttons to the toolbar, must call Realize() to reflect the changes
|
// after adding the buttons to the toolbar, must call Realize() to reflect
|
||||||
|
// the changes
|
||||||
m_HToolBar->Realize();
|
m_HToolBar->Realize();
|
||||||
}
|
}
|
||||||
else /* Toolbar already created, it only must be updated */
|
|
||||||
{
|
|
||||||
m_SelAliasBox->Clear();
|
|
||||||
m_SelpartBox->Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Update the part selection box */
|
|
||||||
int jj = 1;
|
|
||||||
if( CurrentLibEntry )
|
|
||||||
jj = CurrentLibEntry->m_UnitCount;
|
|
||||||
if( jj > 1 )
|
|
||||||
for( ii = 0; ii < jj; ii++ )
|
|
||||||
{
|
|
||||||
wxString msg;
|
|
||||||
msg.Printf( _( "Part %c" ), 'A' + ii );
|
|
||||||
m_SelpartBox->Append( msg );
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
m_SelpartBox->Append( wxEmptyString );
|
|
||||||
m_SelpartBox->SetSelection( ( CurrentUnit > 0 ) ? CurrentUnit - 1 : 0 );
|
|
||||||
|
|
||||||
if( CurrentLibEntry )
|
|
||||||
{
|
|
||||||
if( CurrentLibEntry->m_UnitCount > 1 )
|
|
||||||
m_SelpartBox->Enable( TRUE );
|
|
||||||
else
|
|
||||||
m_SelpartBox->Enable( FALSE );
|
|
||||||
m_SelAliasBox->Append( CurrentLibEntry->m_Name.m_Text );
|
|
||||||
m_SelAliasBox->SetSelection( 0 );
|
|
||||||
int count = CurrentLibEntry->m_AliasList.GetCount();
|
|
||||||
if( count > 0 ) /* Update the part selection box */
|
|
||||||
{
|
|
||||||
m_SelAliasBox->Enable( TRUE );
|
|
||||||
for( ii = 0, jj = 1; ii < count; ii += ALIAS_NEXT, jj++ )
|
|
||||||
{
|
|
||||||
m_SelAliasBox->Append( CurrentLibEntry->m_AliasList[ii] );
|
|
||||||
if( CurrentAliasName == CurrentLibEntry->m_AliasList[ii] )
|
|
||||||
m_SelAliasBox->SetSelection( jj );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
m_SelAliasBox->Enable( FALSE );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_SelAliasBox->Enable( FALSE );
|
|
||||||
m_SelpartBox->Enable( FALSE );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Must be called AFTER Realize():
|
|
||||||
SetToolbars();
|
|
||||||
}
|
|
||||||
|
|
|
@ -17,34 +17,18 @@
|
||||||
|
|
||||||
#include "id.h"
|
#include "id.h"
|
||||||
|
|
||||||
/****************************************************/
|
|
||||||
void WinEDA_ViewlibFrame::ReCreateHToolbar()
|
void WinEDA_ViewlibFrame::ReCreateHToolbar()
|
||||||
/****************************************************/
|
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
EDA_LibComponentStruct* RootLibEntry = NULL, * CurrentLibEntry = NULL;
|
LibraryStruct* lib;
|
||||||
bool asdeMorgan = FALSE, state;
|
EDA_LibComponentStruct* component = NULL;
|
||||||
|
LibCmpEntry* entry = NULL;
|
||||||
if( (g_CurrentViewLibraryName != wxEmptyString)
|
bool asdeMorgan = false;
|
||||||
&& (g_CurrentViewComponentName != wxEmptyString) )
|
|
||||||
{
|
|
||||||
RootLibEntry =
|
|
||||||
( EDA_LibComponentStruct* ) FindLibPart( g_CurrentViewComponentName,
|
|
||||||
g_CurrentViewLibraryName );
|
|
||||||
|
|
||||||
if( RootLibEntry && LookForConvertPart( RootLibEntry ) > 1 )
|
|
||||||
asdeMorgan = TRUE;
|
|
||||||
CurrentLibEntry =
|
|
||||||
( EDA_LibComponentStruct* ) FindLibPart( g_CurrentViewComponentName,
|
|
||||||
g_CurrentViewLibraryName,
|
|
||||||
ALIAS );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( m_HToolBar == NULL )
|
if( m_HToolBar == NULL )
|
||||||
{
|
{
|
||||||
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN,
|
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR,
|
||||||
this,
|
|
||||||
ID_H_TOOLBAR,
|
|
||||||
TRUE );
|
TRUE );
|
||||||
SetToolBar( m_HToolBar );
|
SetToolBar( m_HToolBar );
|
||||||
|
|
||||||
|
@ -116,11 +100,27 @@ void WinEDA_ViewlibFrame::ReCreateHToolbar()
|
||||||
_( "Insert component in schematic" ) );
|
_( "Insert component in schematic" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// after adding the buttons to the toolbar, must call Realize() to reflect
|
// after adding the buttons to the toolbar, must call Realize() to
|
||||||
// the changes
|
// reflect the changes
|
||||||
m_HToolBar->Realize();
|
m_HToolBar->Realize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( (g_CurrentViewLibraryName != wxEmptyString)
|
||||||
|
&& (g_CurrentViewComponentName != wxEmptyString) )
|
||||||
|
{
|
||||||
|
lib = FindLibrary( g_CurrentViewLibraryName );
|
||||||
|
|
||||||
|
if( lib != NULL )
|
||||||
|
{
|
||||||
|
component = lib->FindComponent( g_CurrentViewComponentName );
|
||||||
|
|
||||||
|
if( component && component->HasConversion() )
|
||||||
|
asdeMorgan = true;
|
||||||
|
|
||||||
|
entry = lib->FindEntry( g_CurrentViewComponentName );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Must be AFTER Realize():
|
// Must be AFTER Realize():
|
||||||
m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT,
|
m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT,
|
||||||
(g_ViewConvert <= 1) ? TRUE : FALSE );
|
(g_ViewConvert <= 1) ? TRUE : FALSE );
|
||||||
|
@ -130,8 +130,8 @@ void WinEDA_ViewlibFrame::ReCreateHToolbar()
|
||||||
m_HToolBar->EnableTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, asdeMorgan );
|
m_HToolBar->EnableTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, asdeMorgan );
|
||||||
|
|
||||||
int jj = 1;
|
int jj = 1;
|
||||||
if( RootLibEntry )
|
if( component )
|
||||||
jj = MAX( RootLibEntry->m_UnitCount, 1 );
|
jj = MAX( component->m_UnitCount, 1 );
|
||||||
SelpartBox->Clear();
|
SelpartBox->Clear();
|
||||||
for( ii = 0; ii < jj; ii++ )
|
for( ii = 0; ii < jj; ii++ )
|
||||||
{
|
{
|
||||||
|
@ -141,20 +141,13 @@ void WinEDA_ViewlibFrame::ReCreateHToolbar()
|
||||||
}
|
}
|
||||||
|
|
||||||
SelpartBox->SetSelection( 0 );
|
SelpartBox->SetSelection( 0 );
|
||||||
state = FALSE;
|
SelpartBox->Enable( component && component->HasConversion() );
|
||||||
if( CurrentLibEntry && jj > 1 )
|
|
||||||
state = TRUE;
|
|
||||||
SelpartBox->Enable( state );
|
|
||||||
|
|
||||||
state = FALSE;
|
m_HToolBar->EnableTool( ID_LIBVIEW_VIEWDOC,
|
||||||
if( CurrentLibEntry && (CurrentLibEntry->m_DocFile != wxEmptyString) )
|
entry && ( entry->m_DocFile != wxEmptyString ) );
|
||||||
state = TRUE;
|
|
||||||
m_HToolBar->EnableTool( ID_LIBVIEW_VIEWDOC, state );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************/
|
|
||||||
void WinEDA_ViewlibFrame::ReCreateVToolbar()
|
void WinEDA_ViewlibFrame::ReCreateVToolbar()
|
||||||
/****************************************************/
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,13 +277,21 @@ int WinEDA_ViewlibFrame::BestZoom()
|
||||||
{
|
{
|
||||||
int bestzoom, ii, jj;
|
int bestzoom, ii, jj;
|
||||||
wxSize size, itemsize;
|
wxSize size, itemsize;
|
||||||
EDA_LibComponentStruct* CurrentLibEntry = NULL;
|
EDA_LibComponentStruct* component;
|
||||||
|
LibraryStruct* lib;
|
||||||
|
|
||||||
CurrentLibEntry =
|
GetScreen()->m_Curseur.x = 0;
|
||||||
( EDA_LibComponentStruct* ) FindLibPart( g_CurrentViewComponentName,
|
GetScreen()->m_Curseur.y = 0;
|
||||||
g_CurrentViewLibraryName );
|
bestzoom = 16;
|
||||||
|
|
||||||
if( CurrentLibEntry == NULL )
|
lib = FindLibrary( g_CurrentViewLibraryName );
|
||||||
|
|
||||||
|
if( lib == NULL )
|
||||||
|
return bestzoom;
|
||||||
|
|
||||||
|
component = lib->FindComponent( g_CurrentViewComponentName );
|
||||||
|
|
||||||
|
if( component == NULL )
|
||||||
{
|
{
|
||||||
bestzoom = 16;
|
bestzoom = 16;
|
||||||
GetScreen()->m_Curseur.x = 0;
|
GetScreen()->m_Curseur.x = 0;
|
||||||
|
@ -291,14 +299,13 @@ int WinEDA_ViewlibFrame::BestZoom()
|
||||||
return bestzoom;
|
return bestzoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
EDA_Rect BoundaryBox = CurrentLibEntry->GetBoundaryBox( g_ViewUnit,
|
EDA_Rect BoundaryBox = component->GetBoundaryBox( g_ViewUnit,
|
||||||
g_ViewConvert );
|
g_ViewConvert );
|
||||||
itemsize = BoundaryBox.GetSize();
|
itemsize = BoundaryBox.GetSize();
|
||||||
|
|
||||||
size = DrawPanel->GetClientSize();
|
size = DrawPanel->GetClientSize();
|
||||||
size -= wxSize( 100, 100 ); // reserve a 100 mils margin
|
size -= wxSize( 25, 25 ); // reserve a 25 mils margin.
|
||||||
ii = itemsize.x / size.x;
|
ii = wxRound( double( itemsize.x ) / double( size.x ) );
|
||||||
jj = itemsize.y / size.y;
|
jj = wxRound( double( itemsize.y ) / double( size.y ) );
|
||||||
bestzoom = MAX( ii, jj ) + 1;
|
bestzoom = MAX( ii, jj ) + 1;
|
||||||
|
|
||||||
GetScreen()->m_Curseur = BoundaryBox.Centre();
|
GetScreen()->m_Curseur = BoundaryBox.Centre();
|
||||||
|
|
|
@ -172,9 +172,7 @@ void WinEDA_ViewlibFrame::SelectAndViewLibraryPart( int option )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LibCmpEntry* LibEntry = FindLibPart( g_CurrentViewComponentName,
|
LibCmpEntry* LibEntry = Lib->FindEntry( g_CurrentViewComponentName );
|
||||||
g_CurrentViewLibraryName,
|
|
||||||
ALIAS );
|
|
||||||
|
|
||||||
if( LibEntry == NULL )
|
if( LibEntry == NULL )
|
||||||
return;
|
return;
|
||||||
|
@ -258,18 +256,23 @@ void WinEDA_ViewlibFrame::ViewOneLibraryContent( LibraryStruct* Lib, int Flag )
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
||||||
{
|
{
|
||||||
EDA_LibComponentStruct* LibEntry = NULL;
|
EDA_LibComponentStruct* component;
|
||||||
LibCmpEntry* ViewCmpEntry = NULL;
|
LibCmpEntry* entry;
|
||||||
const wxChar* RootName, * CmpName;
|
LibraryStruct* lib;
|
||||||
wxString Msg;
|
wxString msg;
|
||||||
|
wxString tmp;
|
||||||
|
|
||||||
ActiveScreen = GetScreen();
|
ActiveScreen = GetScreen();
|
||||||
|
|
||||||
LibEntry =
|
lib = FindLibrary( g_CurrentViewLibraryName );
|
||||||
( EDA_LibComponentStruct* ) FindLibPart( g_CurrentViewComponentName,
|
|
||||||
g_CurrentViewLibraryName,
|
if( lib == NULL )
|
||||||
ALIAS );
|
return;
|
||||||
ViewCmpEntry = (LibCmpEntry*) LibEntry;
|
|
||||||
|
entry = lib->FindEntry( g_CurrentViewComponentName );
|
||||||
|
|
||||||
|
if( entry == NULL )
|
||||||
|
return;
|
||||||
|
|
||||||
/* Forcage de la reinit de la brosse et plume courante */
|
/* Forcage de la reinit de la brosse et plume courante */
|
||||||
GRResetPenAndBrush( DC );
|
GRResetPenAndBrush( DC );
|
||||||
|
@ -281,51 +284,52 @@ void WinEDA_ViewlibFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
||||||
|
|
||||||
DrawPanel->DrawBackGround( DC );
|
DrawPanel->DrawBackGround( DC );
|
||||||
|
|
||||||
if( LibEntry )
|
if( entry->Type != ROOT )
|
||||||
{
|
{
|
||||||
CmpName = LibEntry->m_Name.m_Text.GetData();
|
EDA_LibCmpAliasStruct* alias = (EDA_LibCmpAliasStruct*) entry;
|
||||||
if( LibEntry->Type != ROOT )
|
|
||||||
{
|
|
||||||
RootName =
|
|
||||||
( (EDA_LibCmpAliasStruct*) LibEntry )->m_RootName.GetData();
|
|
||||||
Msg.Printf( _( "Current Part: <%s> (is Alias of <%s>)" ),
|
|
||||||
CmpName, RootName );
|
|
||||||
LibEntry =
|
|
||||||
( EDA_LibComponentStruct* ) FindLibPart( RootName,
|
|
||||||
g_CurrentViewLibraryName,
|
|
||||||
ROOT );
|
|
||||||
|
|
||||||
if( LibEntry == NULL )
|
component = lib->FindComponent( alias->m_RootName );
|
||||||
|
|
||||||
|
if( component == NULL )
|
||||||
{
|
{
|
||||||
Msg.Printf( _( "Error: Root Part <%s> not found" ), RootName );
|
msg.Printf( _( "Root component <%s> for alias <%s> not found in \
|
||||||
DisplayError( this, Msg );
|
library." ),
|
||||||
|
(const wxChar*) alias->m_RootName,
|
||||||
|
(const wxChar*) entry->GetName(),
|
||||||
|
(const wxChar*) lib->m_Name );
|
||||||
|
DisplayError( this, msg );
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
msg.Printf( _( "Current Part: <%s> (is Alias of <%s>)" ),
|
||||||
/* Affichage du composant ROOT, avec nom de l'alias */
|
(const wxChar*) entry->GetName(),
|
||||||
wxString RealName;
|
(const wxChar*) alias->m_RootName );
|
||||||
RealName = LibEntry->m_Name.m_Text;
|
|
||||||
LibEntry->m_Name.m_Text = CmpName;
|
/* Temporarily change the name field text to reflect the alias name. */
|
||||||
|
tmp = component->GetName();
|
||||||
|
component->m_Name.m_Text = alias->GetName();
|
||||||
if( g_ViewUnit < 1 )
|
if( g_ViewUnit < 1 )
|
||||||
g_ViewUnit = 1;
|
g_ViewUnit = 1;
|
||||||
if( g_ViewConvert < 1 )
|
if( g_ViewConvert < 1 )
|
||||||
g_ViewConvert = 1;
|
g_ViewConvert = 1;
|
||||||
LibEntry->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_ViewUnit,
|
component->m_Name.m_Text = tmp;
|
||||||
g_ViewConvert, GR_DEFAULT_DRAWMODE );
|
|
||||||
LibEntry->m_Name.m_Text = RealName;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Msg.Printf( _( "Current Part: <%s>" ),
|
component = (EDA_LibComponentStruct*) entry;
|
||||||
ViewCmpEntry->m_Name.m_Text.GetData() );
|
msg.Printf( _( "Current Part: <%s>" ),
|
||||||
LibEntry->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_ViewUnit,
|
(const wxChar*) component->GetName() );
|
||||||
g_ViewConvert, GR_DEFAULT_DRAWMODE );
|
|
||||||
}
|
|
||||||
AfficheDoc( this, ViewCmpEntry->m_Doc, ViewCmpEntry->m_KeyWord );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SetStatusText( Msg, 0 );
|
component->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_ViewUnit,
|
||||||
|
g_ViewConvert, GR_DEFAULT_DRAWMODE );
|
||||||
|
|
||||||
|
if( !tmp.IsEmpty() )
|
||||||
|
component->m_Name.m_Text = tmp;
|
||||||
|
|
||||||
|
AfficheDoc( this, entry->m_Doc, entry->m_KeyWord );
|
||||||
|
|
||||||
|
SetStatusText( msg, 0 );
|
||||||
|
|
||||||
DrawPanel->Trace_Curseur( DC );
|
DrawPanel->Trace_Curseur( DC );
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,6 +149,14 @@ public:
|
||||||
void CursorOff( wxDC* DC ); // remove the grid cursor from the display
|
void CursorOff( wxDC* DC ); // remove the grid cursor from the display
|
||||||
void CursorOn( wxDC* DC ); // display the grid cursor
|
void CursorOn( wxDC* DC ); // display the grid cursor
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Release managed cursor.
|
||||||
|
*
|
||||||
|
* Check to see if the cursor is being managed for block or editing
|
||||||
|
* commands and release it.
|
||||||
|
*/
|
||||||
|
void UnManageCursor( void );
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -474,9 +474,24 @@ public:
|
||||||
void Process_Special_Functions( wxCommandEvent& event );
|
void Process_Special_Functions( wxCommandEvent& event );
|
||||||
void OnImportPart( wxCommandEvent& event );
|
void OnImportPart( wxCommandEvent& event );
|
||||||
void OnExportPart( wxCommandEvent& event );
|
void OnExportPart( wxCommandEvent& event );
|
||||||
|
void OnSelectAlias( wxCommandEvent& event );
|
||||||
|
void OnSelectPart( wxCommandEvent& event );
|
||||||
|
void OnEditComponentProperties( wxCommandEvent& event );
|
||||||
|
|
||||||
void OnUpdateEditingPart( wxUpdateUIEvent& event );
|
void OnUpdateEditingPart( wxUpdateUIEvent& event );
|
||||||
void OnUpdateNotEditingPart( wxUpdateUIEvent& event );
|
void OnUpdateNotEditingPart( wxUpdateUIEvent& event );
|
||||||
|
void OnUpdateUndo( wxUpdateUIEvent& event );
|
||||||
|
void OnUpdateRedo( wxUpdateUIEvent& event );
|
||||||
|
void OnUpdateSaveCurrentLib( wxUpdateUIEvent& event );
|
||||||
|
void OnUpdateViewDoc( wxUpdateUIEvent& event );
|
||||||
|
void OnUpdatePinByPin( wxUpdateUIEvent& event );
|
||||||
|
void OnUpdatePartNumber( wxUpdateUIEvent& event );
|
||||||
|
void OnUpdateDeMorganNormal( wxUpdateUIEvent& event );
|
||||||
|
void OnUpdateDeMorganConvert( wxUpdateUIEvent& event );
|
||||||
|
void OnUpdateSelectAlias( wxUpdateUIEvent& event );
|
||||||
|
|
||||||
|
void UpdateAliasSelectList();
|
||||||
|
void UpdatePartSelectList();
|
||||||
void DisplayLibInfos();
|
void DisplayLibInfos();
|
||||||
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
|
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
|
||||||
void OnCloseWindow( wxCloseEvent& Event );
|
void OnCloseWindow( wxCloseEvent& Event );
|
||||||
|
@ -485,7 +500,6 @@ public:
|
||||||
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
|
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
|
||||||
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
|
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
|
||||||
int BestZoom(); // Retourne le meilleur zoom
|
int BestZoom(); // Retourne le meilleur zoom
|
||||||
void SetToolbars();
|
|
||||||
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
|
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
|
||||||
|
|
||||||
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); }
|
SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); }
|
||||||
|
@ -506,13 +520,13 @@ private:
|
||||||
void SaveOnePartInMemory();
|
void SaveOnePartInMemory();
|
||||||
void SelectActiveLibrary();
|
void SelectActiveLibrary();
|
||||||
bool LoadOneLibraryPart();
|
bool LoadOneLibraryPart();
|
||||||
void SaveActiveLibrary();
|
void SaveActiveLibrary( wxCommandEvent& event );
|
||||||
|
|
||||||
bool LoadOneLibraryPartAux( LibCmpEntry* LibEntry,
|
bool LoadOneLibraryPartAux( LibCmpEntry* LibEntry,
|
||||||
LibraryStruct* Library );
|
LibraryStruct* Library );
|
||||||
|
|
||||||
void DisplayCmpDoc( const wxString& Name );
|
void DisplayCmpDoc( const wxString& Name );
|
||||||
void InstallLibeditFrame();
|
void EditComponentProperties();
|
||||||
|
|
||||||
// General editing
|
// General editing
|
||||||
public:
|
public:
|
||||||
|
@ -537,13 +551,15 @@ private:
|
||||||
void PlaceAncre();
|
void PlaceAncre();
|
||||||
|
|
||||||
// Edition des graphismes:
|
// Edition des graphismes:
|
||||||
LibEDA_BaseStruct* CreateGraphicItem( EDA_LibComponentStruct * LibEntry, wxDC* DC );
|
LibEDA_BaseStruct* CreateGraphicItem( EDA_LibComponentStruct* LibEntry,
|
||||||
|
wxDC* DC );
|
||||||
void GraphicItemBeginDraw( wxDC* DC );
|
void GraphicItemBeginDraw( wxDC* DC );
|
||||||
void StartMoveDrawSymbol( wxDC* DC );
|
void StartMoveDrawSymbol( wxDC* DC );
|
||||||
void EndDrawGraphicItem( wxDC* DC );
|
void EndDrawGraphicItem( wxDC* DC );
|
||||||
void LoadOneSymbol();
|
void LoadOneSymbol();
|
||||||
void SaveOneSymbol();
|
void SaveOneSymbol();
|
||||||
void EditGraphicSymbol( wxDC* DC, LibEDA_BaseStruct* DrawItem );
|
void EditGraphicSymbol( wxDC* DC,
|
||||||
|
LibEDA_BaseStruct* DrawItem );
|
||||||
void EditSymbolText( wxDC* DC, LibEDA_BaseStruct* DrawItem );
|
void EditSymbolText( wxDC* DC, LibEDA_BaseStruct* DrawItem );
|
||||||
void RotateSymbolText( wxDC* DC );
|
void RotateSymbolText( wxDC* DC );
|
||||||
void DeleteDrawPoly( wxDC* DC );
|
void DeleteDrawPoly( wxDC* DC );
|
||||||
|
|
Loading…
Reference in New Issue