2007-08-14 19:24:48 +00:00
|
|
|
/****************************************************************/
|
2009-12-02 21:44:03 +00:00
|
|
|
/* EESchema: find.cpp (functions for searching a schematic item */
|
2007-08-14 19:24:48 +00:00
|
|
|
/****************************************************************/
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/*
|
2007-08-20 10:55:09 +00:00
|
|
|
* Search a text (text, value, reference) within a component or
|
|
|
|
* search a component in libraries, a marker ...,
|
2007-08-14 19:24:48 +00:00
|
|
|
* in current sheet or whole the project
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "fctsys.h"
|
2009-04-14 16:45:22 +00:00
|
|
|
#include "appl_wxstruct.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
|
|
|
#include "confirm.h"
|
|
|
|
#include "kicad_string.h"
|
|
|
|
#include "gestfich.h"
|
2009-09-18 14:56:05 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "program.h"
|
|
|
|
#include "general.h"
|
2009-07-07 17:50:02 +00:00
|
|
|
#include "class_marker_sch.h"
|
2009-09-18 14:56:05 +00:00
|
|
|
#include "protos.h"
|
2009-09-25 18:49:04 +00:00
|
|
|
#include "class_library.h"
|
2009-09-18 14:56:05 +00:00
|
|
|
|
2009-12-20 19:48:58 +00:00
|
|
|
#include "kicad_device_context.h"
|
|
|
|
|
2009-09-18 14:56:05 +00:00
|
|
|
#include <boost/foreach.hpp>
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
/* Variables Locales */
|
2007-08-14 19:24:48 +00:00
|
|
|
static int s_ItemsCount, s_MarkerCount;
|
2007-06-05 12:10:51 +00:00
|
|
|
static wxString s_OldStringFound;
|
|
|
|
|
|
|
|
#include "dialog_find.cpp"
|
|
|
|
|
|
|
|
|
2007-08-20 10:55:09 +00:00
|
|
|
/* Search markers in whole hierarchy.
|
2007-08-14 19:24:48 +00:00
|
|
|
* Mouse cursor is put on the marker
|
|
|
|
* search the first marker, or next marker
|
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
void WinEDA_FindFrame::FindMarker( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-14 19:24:48 +00:00
|
|
|
int id = event.GetId();
|
|
|
|
|
|
|
|
if( id != FIND_NEXT_MARKER )
|
|
|
|
m_Parent->FindMarker( 0 );
|
|
|
|
else
|
|
|
|
m_Parent->FindMarker( 1 );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-14 19:24:48 +00:00
|
|
|
Close();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
2007-08-14 19:24:48 +00:00
|
|
|
|
|
|
|
|
2007-10-01 15:37:42 +00:00
|
|
|
/**
|
|
|
|
* Function FindComponentAndItem
|
|
|
|
* finds a Component in the schematic, and an item in this component.
|
2007-10-31 17:47:44 +00:00
|
|
|
* @param component_reference The component reference to find.
|
2009-12-02 21:44:03 +00:00
|
|
|
* @param text_to_find - The text to search for, either in value, reference
|
|
|
|
* or elsewhere.
|
2007-10-01 15:37:42 +00:00
|
|
|
* @param Find_in_hierarchy: false => Search is made in current sheet
|
|
|
|
* true => the whole hierarchy
|
|
|
|
* @param SearchType: 0 => find component
|
|
|
|
* 1 => find pin
|
|
|
|
* 2 => find ref
|
|
|
|
* 3 => find value
|
|
|
|
* >= 4 => unused (same as 0)
|
|
|
|
* @param mouseWarp If true, then move the mouse cursor to the item.
|
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
SCH_ITEM* WinEDA_SchematicFrame::FindComponentAndItem(
|
|
|
|
const wxString& component_reference, bool Find_in_hierarchy,
|
|
|
|
int SearchType,
|
|
|
|
const wxString& text_to_find,
|
|
|
|
bool mouseWarp )
|
2007-10-01 15:37:42 +00:00
|
|
|
{
|
2009-12-02 21:44:03 +00:00
|
|
|
SCH_SHEET_PATH* sheet, * SheetWithComponentFound = NULL;
|
|
|
|
SCH_ITEM* DrawList = NULL;
|
|
|
|
SCH_COMPONENT* Component = NULL;
|
|
|
|
wxSize DrawAreaSize = DrawPanel->GetClientSize();
|
|
|
|
wxPoint pos, curpos;
|
|
|
|
bool DoCenterAndRedraw = FALSE;
|
|
|
|
bool NotFound = true;
|
|
|
|
wxString msg;
|
|
|
|
LIB_PIN* pin;
|
|
|
|
SCH_SHEET_LIST SheetList;
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
sheet = SheetList.GetFirst();
|
2007-10-01 15:37:42 +00:00
|
|
|
if( !Find_in_hierarchy )
|
2008-02-19 07:06:58 +00:00
|
|
|
sheet = m_CurrentSheet;
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
for( ; sheet != NULL; sheet = SheetList.GetNext() )
|
2007-10-01 15:37:42 +00:00
|
|
|
{
|
2008-04-14 19:22:48 +00:00
|
|
|
DrawList = (SCH_ITEM*) sheet->LastDrawList();
|
2009-12-02 21:44:03 +00:00
|
|
|
for( ; ( DrawList != NULL ) && ( NotFound == true );
|
|
|
|
DrawList = DrawList->Next() )
|
2007-10-01 15:37:42 +00:00
|
|
|
{
|
2008-03-20 01:50:21 +00:00
|
|
|
if( DrawList->Type() == TYPE_SCH_COMPONENT )
|
2007-10-01 15:37:42 +00:00
|
|
|
{
|
2008-03-20 01:50:21 +00:00
|
|
|
SCH_COMPONENT* pSch;
|
|
|
|
pSch = (SCH_COMPONENT*) DrawList;
|
2009-04-14 16:45:22 +00:00
|
|
|
if( component_reference.CmpNoCase( pSch->GetRef( sheet ) ) == 0 )
|
2007-10-01 15:37:42 +00:00
|
|
|
{
|
|
|
|
Component = pSch;
|
2008-02-12 21:12:46 +00:00
|
|
|
SheetWithComponentFound = sheet;
|
2007-10-01 15:37:42 +00:00
|
|
|
|
|
|
|
switch( SearchType )
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
case 0: // Find component only
|
|
|
|
NotFound = FALSE;
|
|
|
|
pos = pSch->m_Pos;
|
2008-02-19 07:06:58 +00:00
|
|
|
break;
|
2007-10-01 15:37:42 +00:00
|
|
|
|
|
|
|
case 1: // find a pin
|
2009-12-02 21:44:03 +00:00
|
|
|
pos = pSch->m_Pos; /* temporary: will be changed if
|
|
|
|
* the pin is found */
|
2009-10-30 19:26:25 +00:00
|
|
|
pin = pSch->GetPin( text_to_find );
|
2007-10-01 15:37:42 +00:00
|
|
|
if( pin == NULL )
|
|
|
|
break;
|
|
|
|
NotFound = FALSE;
|
|
|
|
pos += pin->m_Pos;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: // find reference
|
|
|
|
NotFound = FALSE;
|
2008-10-06 05:44:29 +00:00
|
|
|
pos = pSch->GetField( REFERENCE )->m_Pos;
|
2007-10-01 15:37:42 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 3: // find value
|
|
|
|
pos = pSch->m_Pos;
|
2008-10-06 05:44:29 +00:00
|
|
|
if( text_to_find.CmpNoCase( pSch->GetField( VALUE )->m_Text ) != 0 )
|
2007-10-01 15:37:42 +00:00
|
|
|
break;
|
|
|
|
NotFound = FALSE;
|
2008-10-06 05:44:29 +00:00
|
|
|
pos = pSch->GetField( VALUE )->m_Pos;
|
2007-10-01 15:37:42 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( (Find_in_hierarchy == FALSE) || (NotFound == FALSE) )
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( Component )
|
|
|
|
{
|
2008-02-12 21:12:46 +00:00
|
|
|
sheet = SheetWithComponentFound;
|
|
|
|
if( sheet != GetSheet() )
|
2007-10-01 15:37:42 +00:00
|
|
|
{
|
2008-02-12 21:12:46 +00:00
|
|
|
sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
|
|
|
|
*m_CurrentSheet = *sheet;
|
2009-04-14 16:45:22 +00:00
|
|
|
ActiveScreen = m_CurrentSheet->LastScreen();
|
2008-02-19 07:06:58 +00:00
|
|
|
m_CurrentSheet->UpdateAllScreenReferences();
|
2009-04-14 16:45:22 +00:00
|
|
|
DoCenterAndRedraw = TRUE;
|
2007-10-01 15:37:42 +00:00
|
|
|
}
|
|
|
|
wxPoint delta;
|
2009-04-14 16:45:22 +00:00
|
|
|
pos -= Component->m_Pos;
|
|
|
|
delta = TransformCoordinate( Component->m_Transform, pos );
|
|
|
|
pos = delta + Component->m_Pos;
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2009-04-14 16:45:22 +00:00
|
|
|
wxPoint old_cursor_position = sheet->LastScreen()->m_Curseur;
|
2008-02-12 21:12:46 +00:00
|
|
|
sheet->LastScreen()->m_Curseur = pos;
|
2007-10-01 15:37:42 +00:00
|
|
|
|
|
|
|
curpos = DrawPanel->CursorScreenPosition();
|
|
|
|
|
|
|
|
DrawPanel->GetViewStart(
|
2008-02-12 21:12:46 +00:00
|
|
|
&( GetScreen()->m_StartVisu.x ),
|
2009-04-14 16:45:22 +00:00
|
|
|
&( GetScreen()->m_StartVisu.y ) );
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2009-10-30 19:26:25 +00:00
|
|
|
// Calculating cursor position with original screen.
|
2009-01-02 13:19:34 +00:00
|
|
|
curpos -= GetScreen()->m_StartVisu;
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2009-10-30 19:26:25 +00:00
|
|
|
/* There may be need to reframe the drawing */
|
2008-02-19 07:06:58 +00:00
|
|
|
#define MARGIN 30
|
2009-12-02 21:44:03 +00:00
|
|
|
if( ( curpos.x <= MARGIN ) || ( curpos.x >= DrawAreaSize.x - MARGIN )
|
|
|
|
|| ( curpos.y <= MARGIN ) || ( curpos.y >= DrawAreaSize.y - MARGIN ) )
|
2007-10-01 15:37:42 +00:00
|
|
|
{
|
|
|
|
DoCenterAndRedraw = true;;
|
|
|
|
}
|
2008-02-19 07:06:58 +00:00
|
|
|
#undef MARGIN
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2009-04-14 16:45:22 +00:00
|
|
|
if( DoCenterAndRedraw )
|
2007-10-01 15:37:42 +00:00
|
|
|
Recadre_Trace( mouseWarp );
|
|
|
|
else
|
|
|
|
{
|
2009-12-20 19:48:58 +00:00
|
|
|
INSTALL_DC( dc, DrawPanel );
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
|
2007-10-01 15:37:42 +00:00
|
|
|
DrawPanel->CursorOff( &dc );
|
|
|
|
|
|
|
|
if( mouseWarp )
|
2009-01-17 20:31:19 +00:00
|
|
|
DrawPanel->MouseTo( curpos );
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
|
2007-10-01 15:37:42 +00:00
|
|
|
|
|
|
|
DrawPanel->CursorOn( &dc );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Print diaq */
|
|
|
|
wxString msg_item;
|
|
|
|
msg = component_reference;
|
|
|
|
|
|
|
|
switch( SearchType )
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
case 0:
|
|
|
|
break; // Find component only
|
|
|
|
|
|
|
|
case 1: // find a pin
|
|
|
|
msg_item = _( "Pin " ) + text_to_find;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: // find reference
|
|
|
|
msg_item = _( "Ref " ) + text_to_find;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3: // find value
|
|
|
|
msg_item = _( "Value " ) + text_to_find;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 4: // find field. todo
|
|
|
|
msg_item = _( "Field " ) + text_to_find;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( Component )
|
|
|
|
{
|
|
|
|
if( !NotFound )
|
|
|
|
{
|
|
|
|
if( !msg_item.IsEmpty() )
|
|
|
|
msg += wxT( " " ) + msg_item;
|
2008-02-19 07:06:58 +00:00
|
|
|
msg += _( " found" );
|
2007-10-01 15:37:42 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-02-19 07:06:58 +00:00
|
|
|
msg += _( " found" );
|
2007-10-01 15:37:42 +00:00
|
|
|
if( !msg_item.IsEmpty() )
|
|
|
|
{
|
|
|
|
msg += wxT( " but " ) + msg_item + _( " not found" );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( !msg_item.IsEmpty() )
|
|
|
|
msg += wxT( " " ) + msg_item;
|
|
|
|
msg += _( " not found" );
|
|
|
|
}
|
|
|
|
|
|
|
|
Affiche_Message( msg );
|
|
|
|
|
|
|
|
return DrawList;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* Search markers in whole the hierarchy.
|
2007-08-14 19:24:48 +00:00
|
|
|
* Mouse cursor is put on the marker
|
|
|
|
* SearchType = 0: search the first marker, else search next marker
|
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
SCH_ITEM* WinEDA_SchematicFrame::FindMarker( int SearchType )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-12-02 21:44:03 +00:00
|
|
|
SCH_SHEET_PATH* sheet, * FirstSheet = NULL;
|
|
|
|
SCH_ITEM* DrawList, * FirstStruct = NULL, * Struct = NULL;
|
|
|
|
SCH_MARKER* Marker = NULL;
|
|
|
|
int StartCount;
|
|
|
|
bool NotFound;
|
|
|
|
wxPoint firstpos, pos;
|
|
|
|
wxSize DrawAreaSize = DrawPanel->GetClientSize();
|
|
|
|
wxPoint curpos, old_cursor_position;
|
|
|
|
bool DoCenterAndRedraw = FALSE;
|
|
|
|
wxString msg, WildText;
|
2007-08-14 19:24:48 +00:00
|
|
|
|
|
|
|
g_LastSearchIsMarker = TRUE;
|
|
|
|
/* Set s_MarkerCount to 0 if we are look for the first marker */
|
|
|
|
if( SearchType == 0 )
|
|
|
|
s_MarkerCount = 0;
|
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
SCH_SHEET_LIST SheetList;
|
2007-08-14 19:24:48 +00:00
|
|
|
|
|
|
|
NotFound = TRUE; StartCount = 0;
|
|
|
|
/* Search for s_MarkerCount markers */
|
2009-12-02 21:44:03 +00:00
|
|
|
for( sheet = SheetList.GetFirst(); sheet != NULL;
|
|
|
|
sheet = SheetList.GetNext() )
|
2007-08-14 19:24:48 +00:00
|
|
|
{
|
2008-04-14 19:22:48 +00:00
|
|
|
DrawList = (SCH_ITEM*) sheet->LastDrawList();
|
2007-08-14 19:24:48 +00:00
|
|
|
while( DrawList && NotFound )
|
|
|
|
{
|
2009-12-02 21:44:03 +00:00
|
|
|
if( DrawList->Type() == TYPE_SCH_MARKER )
|
2007-08-14 19:24:48 +00:00
|
|
|
{
|
2009-12-02 21:44:03 +00:00
|
|
|
Marker = (SCH_MARKER*) DrawList;
|
2007-08-14 19:24:48 +00:00
|
|
|
NotFound = FALSE;
|
|
|
|
pos = Marker->m_Pos;
|
2008-02-12 21:12:46 +00:00
|
|
|
if( FirstSheet == NULL ) /* First item found */
|
2007-08-14 19:24:48 +00:00
|
|
|
{
|
2009-04-14 16:45:22 +00:00
|
|
|
FirstSheet = sheet; firstpos = pos;
|
2007-08-14 19:24:48 +00:00
|
|
|
FirstStruct = DrawList;
|
|
|
|
}
|
|
|
|
|
|
|
|
StartCount++;
|
|
|
|
if( s_MarkerCount >= StartCount )
|
|
|
|
{
|
2009-12-02 21:44:03 +00:00
|
|
|
NotFound = TRUE; /* Search for other markers */
|
2007-08-14 19:24:48 +00:00
|
|
|
}
|
2009-12-02 21:44:03 +00:00
|
|
|
else /* We have found s_MarkerCount
|
|
|
|
* markers -> Ok */
|
2007-08-14 19:24:48 +00:00
|
|
|
{
|
|
|
|
Struct = DrawList; s_MarkerCount++; break;
|
|
|
|
}
|
|
|
|
}
|
2008-04-14 19:22:48 +00:00
|
|
|
DrawList = DrawList->Next();
|
2007-08-14 19:24:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( NotFound == FALSE )
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
if( NotFound && FirstSheet ) /* markers are found, but we have
|
|
|
|
* reach the last marker */
|
2009-04-14 16:45:22 +00:00
|
|
|
{
|
|
|
|
// After the last marker, the first marker is used */
|
2008-02-12 21:12:46 +00:00
|
|
|
NotFound = FALSE; sheet = FirstSheet;
|
2007-08-14 19:24:48 +00:00
|
|
|
Struct = FirstStruct;
|
|
|
|
pos = firstpos; s_MarkerCount = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( NotFound == FALSE )
|
|
|
|
{
|
2008-02-12 21:12:46 +00:00
|
|
|
if( sheet != GetSheet() )
|
2007-08-14 19:24:48 +00:00
|
|
|
{
|
2008-02-12 21:12:46 +00:00
|
|
|
sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
|
|
|
|
*m_CurrentSheet = *sheet;
|
2009-04-14 16:45:22 +00:00
|
|
|
ActiveScreen = m_CurrentSheet->LastScreen();
|
2008-02-19 07:06:58 +00:00
|
|
|
m_CurrentSheet->UpdateAllScreenReferences();
|
2009-04-14 16:45:22 +00:00
|
|
|
DoCenterAndRedraw = TRUE;
|
2007-08-14 19:24:48 +00:00
|
|
|
}
|
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
old_cursor_position = sheet->LastScreen()->m_Curseur;
|
2009-04-14 16:45:22 +00:00
|
|
|
sheet->LastScreen()->m_Curseur = pos;
|
2007-08-14 19:24:48 +00:00
|
|
|
curpos = DrawPanel->CursorScreenPosition();
|
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
DrawPanel->GetViewStart( &m_CurrentSheet->LastScreen()->m_StartVisu.x,
|
2009-04-14 16:45:22 +00:00
|
|
|
&m_CurrentSheet->LastScreen()->m_StartVisu.y );
|
2008-02-19 07:06:58 +00:00
|
|
|
curpos.x -= m_CurrentSheet->LastScreen()->m_StartVisu.x;
|
|
|
|
curpos.y -= m_CurrentSheet->LastScreen()->m_StartVisu.y;
|
2007-08-14 19:24:48 +00:00
|
|
|
|
2007-10-01 15:37:42 +00:00
|
|
|
// reposition the window if the chosen marker is off screen.
|
2008-02-19 07:06:58 +00:00
|
|
|
#define MARGIN 30
|
2009-12-02 21:44:03 +00:00
|
|
|
if( ( curpos.x <= MARGIN ) || ( curpos.x >= DrawAreaSize.x - MARGIN )
|
|
|
|
|| ( curpos.y <= MARGIN ) || ( curpos.y >= DrawAreaSize.y - MARGIN ) )
|
2007-08-14 19:24:48 +00:00
|
|
|
{
|
2007-10-01 15:37:42 +00:00
|
|
|
DoCenterAndRedraw = true;;
|
2007-08-14 19:24:48 +00:00
|
|
|
}
|
2008-02-19 07:06:58 +00:00
|
|
|
#undef MARGIN
|
2007-10-01 15:37:42 +00:00
|
|
|
|
|
|
|
if( DoCenterAndRedraw )
|
|
|
|
Recadre_Trace( TRUE );
|
2007-08-14 19:24:48 +00:00
|
|
|
else
|
|
|
|
{
|
2009-12-20 19:48:58 +00:00
|
|
|
INSTALL_DC( dc, DrawPanel );
|
2008-02-19 07:06:58 +00:00
|
|
|
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
|
2007-08-14 19:24:48 +00:00
|
|
|
DrawPanel->CursorOff( &dc );
|
2009-01-17 20:31:19 +00:00
|
|
|
DrawPanel->MouseTo( curpos );
|
2008-02-19 07:06:58 +00:00
|
|
|
EXCHG( old_cursor_position, sheet->LastScreen()->m_Curseur );
|
2007-08-14 19:24:48 +00:00
|
|
|
DrawPanel->CursorOn( &dc );
|
|
|
|
}
|
2008-02-19 07:06:58 +00:00
|
|
|
wxString path = sheet->Path();
|
2009-12-02 21:44:03 +00:00
|
|
|
msg.Printf( _( "Marker %d found in %s" ),
|
|
|
|
s_MarkerCount, path.GetData() );
|
2007-08-14 19:24:48 +00:00
|
|
|
Affiche_Message( msg );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Affiche_Message( wxEmptyString );
|
|
|
|
msg = _( "Marker Not Found" );
|
|
|
|
DisplayError( this, msg, 10 );
|
|
|
|
}
|
|
|
|
|
|
|
|
return Marker;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Find a string in schematic.
|
2007-08-14 19:24:48 +00:00
|
|
|
* Call to WinEDA_SchematicFrame::FindSchematicItem()
|
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
void WinEDA_FindFrame::FindSchematicItem( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-14 19:24:48 +00:00
|
|
|
int id = event.GetId();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-14 19:24:48 +00:00
|
|
|
if( id == FIND_SHEET )
|
|
|
|
m_Parent->FindSchematicItem( m_NewTextCtrl->GetValue(), 0 );
|
|
|
|
else if( id == FIND_HIERARCHY )
|
|
|
|
m_Parent->FindSchematicItem( m_NewTextCtrl->GetValue(), 1 );
|
|
|
|
else if( id == FIND_NEXT )
|
|
|
|
m_Parent->FindSchematicItem( wxEmptyString, 2 );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-14 19:24:48 +00:00
|
|
|
Close();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-14 19:24:48 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function FindSchematicItem
|
|
|
|
* finds a string in the schematic.
|
2009-12-02 21:44:03 +00:00
|
|
|
* @param pattern The text to search for, either in value, reference or
|
|
|
|
* elsewhere.
|
2007-08-14 19:24:48 +00:00
|
|
|
* @param SearchType: 0 => Search is made in current sheet
|
|
|
|
* 1 => the whole hierarchy
|
|
|
|
* 2 => or for the next item
|
|
|
|
* @param mouseWarp If true, then move the mouse cursor to the item.
|
|
|
|
*/
|
2009-12-02 21:44:03 +00:00
|
|
|
SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem( const wxString& pattern,
|
|
|
|
int SearchType,
|
|
|
|
bool mouseWarp )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-12-02 21:44:03 +00:00
|
|
|
SCH_SHEET_PATH* Sheet, * FirstSheet = NULL;
|
|
|
|
SCH_ITEM* DrawList = NULL, * FirstStruct = NULL, * Struct = NULL;
|
|
|
|
int StartCount;
|
|
|
|
bool NotFound;
|
|
|
|
wxPoint firstpos, pos, old_cursor_position;
|
|
|
|
static int Find_in_hierarchy;
|
|
|
|
wxSize DrawAreaSize = DrawPanel->GetClientSize();
|
|
|
|
wxPoint curpos;
|
|
|
|
bool DoCenterAndRedraw = FALSE;
|
|
|
|
wxString msg, WildText;
|
2007-08-14 19:24:48 +00:00
|
|
|
|
|
|
|
g_LastSearchIsMarker = FALSE;
|
|
|
|
|
|
|
|
if( SearchType == 0 )
|
|
|
|
{
|
|
|
|
s_OldStringFound = pattern;
|
|
|
|
Find_in_hierarchy = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( SearchType == 1 )
|
|
|
|
{
|
|
|
|
s_OldStringFound = pattern;
|
|
|
|
Find_in_hierarchy = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( SearchType != 2 )
|
|
|
|
s_ItemsCount = 0;
|
|
|
|
|
2007-10-01 15:37:42 +00:00
|
|
|
WildText = s_OldStringFound;
|
|
|
|
NotFound = TRUE;
|
2007-08-14 19:24:48 +00:00
|
|
|
StartCount = 0;
|
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
SCH_SHEET_LIST SheetList;
|
2007-08-14 19:24:48 +00:00
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
Sheet = SheetList.GetFirst();
|
2007-08-14 19:24:48 +00:00
|
|
|
if( !Find_in_hierarchy )
|
2008-02-19 07:06:58 +00:00
|
|
|
Sheet = m_CurrentSheet;
|
2007-08-14 19:24:48 +00:00
|
|
|
|
2008-02-19 07:06:58 +00:00
|
|
|
for( ; Sheet != NULL; Sheet = SheetList.GetNext() )
|
2007-08-14 19:24:48 +00:00
|
|
|
{
|
2009-04-14 16:45:22 +00:00
|
|
|
DrawList = (SCH_ITEM*) Sheet->LastDrawList();
|
2007-08-14 19:24:48 +00:00
|
|
|
while( DrawList )
|
|
|
|
{
|
2007-09-01 12:00:30 +00:00
|
|
|
switch( DrawList->Type() )
|
2007-08-14 19:24:48 +00:00
|
|
|
{
|
2008-03-20 01:50:21 +00:00
|
|
|
case TYPE_SCH_COMPONENT:
|
|
|
|
SCH_COMPONENT * pSch;
|
|
|
|
pSch = (SCH_COMPONENT*) DrawList;
|
2009-04-14 16:45:22 +00:00
|
|
|
if( WildCompareString( WildText, pSch->GetRef( Sheet ), FALSE ) )
|
2007-08-14 19:24:48 +00:00
|
|
|
{
|
|
|
|
NotFound = FALSE;
|
2008-10-06 05:44:29 +00:00
|
|
|
pos = pSch->GetField( REFERENCE )->m_Pos;
|
2007-08-14 19:24:48 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-12-02 21:44:03 +00:00
|
|
|
if( WildCompareString( WildText,
|
|
|
|
pSch->GetField( VALUE )->m_Text,
|
|
|
|
false ) )
|
2007-08-14 19:24:48 +00:00
|
|
|
{
|
|
|
|
NotFound = FALSE;
|
2008-10-06 05:44:29 +00:00
|
|
|
pos = pSch->GetField( VALUE )->m_Pos;
|
2007-08-14 19:24:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
case TYPE_SCH_LABEL:
|
|
|
|
case TYPE_SCH_GLOBALLABEL:
|
|
|
|
case TYPE_SCH_HIERLABEL:
|
|
|
|
case TYPE_SCH_TEXT:
|
|
|
|
SCH_TEXT * pDraw;
|
|
|
|
pDraw = (SCH_TEXT*) DrawList;
|
2007-08-14 19:24:48 +00:00
|
|
|
if( WildCompareString( WildText, pDraw->m_Text, FALSE ) )
|
|
|
|
{
|
|
|
|
NotFound = FALSE;
|
|
|
|
pos = pDraw->m_Pos;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-10-01 15:37:42 +00:00
|
|
|
if( NotFound == FALSE ) /* Item found ! */
|
2007-08-14 19:24:48 +00:00
|
|
|
{
|
2009-04-14 16:45:22 +00:00
|
|
|
if( FirstSheet == NULL ) /* First Item found */
|
2007-08-14 19:24:48 +00:00
|
|
|
{
|
2009-04-14 16:45:22 +00:00
|
|
|
FirstSheet = Sheet;
|
2007-08-14 19:24:48 +00:00
|
|
|
firstpos = pos;
|
|
|
|
FirstStruct = DrawList;
|
|
|
|
}
|
|
|
|
|
|
|
|
StartCount++;
|
|
|
|
if( s_ItemsCount >= StartCount )
|
|
|
|
{
|
2009-10-30 19:26:25 +00:00
|
|
|
NotFound = TRUE; /* Continue search of the next element */
|
2007-08-14 19:24:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2007-10-01 15:37:42 +00:00
|
|
|
Struct = DrawList;
|
|
|
|
s_ItemsCount++;
|
2007-08-14 19:24:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if( NotFound == FALSE )
|
|
|
|
break;
|
2008-04-14 19:22:48 +00:00
|
|
|
DrawList = DrawList->Next();
|
2007-08-14 19:24:48 +00:00
|
|
|
}
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2007-08-14 19:24:48 +00:00
|
|
|
if( NotFound == FALSE )
|
|
|
|
break;
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2007-08-14 19:24:48 +00:00
|
|
|
if( Find_in_hierarchy == FALSE )
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-02-19 07:06:58 +00:00
|
|
|
if( NotFound && FirstSheet )
|
2007-08-14 19:24:48 +00:00
|
|
|
{
|
2007-10-01 15:37:42 +00:00
|
|
|
NotFound = FALSE;
|
2009-04-14 16:45:22 +00:00
|
|
|
Sheet = FirstSheet;
|
2007-08-14 19:24:48 +00:00
|
|
|
Struct = FirstStruct;
|
2007-10-01 15:37:42 +00:00
|
|
|
pos = firstpos;
|
2007-08-14 19:24:48 +00:00
|
|
|
s_ItemsCount = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( NotFound == FALSE )
|
|
|
|
{
|
2008-02-19 07:06:58 +00:00
|
|
|
if( Sheet != GetSheet() )
|
2007-08-14 19:24:48 +00:00
|
|
|
{
|
2008-02-12 21:12:46 +00:00
|
|
|
Sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
|
2008-02-19 07:06:58 +00:00
|
|
|
*m_CurrentSheet = *Sheet;
|
2009-04-14 16:45:22 +00:00
|
|
|
ActiveScreen = m_CurrentSheet->LastScreen();
|
2008-02-19 07:06:58 +00:00
|
|
|
m_CurrentSheet->UpdateAllScreenReferences();
|
2009-04-14 16:45:22 +00:00
|
|
|
DoCenterAndRedraw = TRUE;
|
2007-08-14 19:24:48 +00:00
|
|
|
}
|
|
|
|
|
2008-03-20 01:50:21 +00:00
|
|
|
/* the struct is a TYPE_SCH_COMPONENT type,
|
2007-09-15 04:25:54 +00:00
|
|
|
* coordinates must be computed according to its orientation matrix
|
2007-08-20 10:55:09 +00:00
|
|
|
*/
|
2008-03-20 01:50:21 +00:00
|
|
|
if( Struct->Type() == TYPE_SCH_COMPONENT )
|
2007-08-14 19:24:48 +00:00
|
|
|
{
|
2008-03-20 01:50:21 +00:00
|
|
|
SCH_COMPONENT* pSch = (SCH_COMPONENT*) Struct;
|
2007-08-14 19:24:48 +00:00
|
|
|
|
2009-01-02 13:19:34 +00:00
|
|
|
pos -= pSch->m_Pos;
|
2009-04-14 16:45:22 +00:00
|
|
|
pos = TransformCoordinate( pSch->m_Transform, pos );
|
2009-01-02 13:19:34 +00:00
|
|
|
pos += pSch->m_Pos;
|
2007-08-14 19:24:48 +00:00
|
|
|
}
|
|
|
|
|
2008-02-19 07:06:58 +00:00
|
|
|
old_cursor_position = Sheet->LastScreen()->m_Curseur;
|
2009-04-14 16:45:22 +00:00
|
|
|
Sheet->LastScreen()->m_Curseur = pos;
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2007-08-14 19:24:48 +00:00
|
|
|
curpos = DrawPanel->CursorScreenPosition();
|
2007-10-01 15:37:42 +00:00
|
|
|
|
|
|
|
DrawPanel->GetViewStart(
|
2009-04-14 16:45:22 +00:00
|
|
|
&( GetScreen()->m_StartVisu.x ),
|
|
|
|
&( GetScreen()->m_StartVisu.y ) );
|
2007-08-14 19:24:48 +00:00
|
|
|
|
2009-01-02 13:19:34 +00:00
|
|
|
curpos -= m_CurrentSheet->LastScreen()->m_StartVisu;
|
2007-08-14 19:24:48 +00:00
|
|
|
|
2009-10-30 19:26:25 +00:00
|
|
|
/* There may be need to reframe the drawing */
|
2008-02-19 07:06:58 +00:00
|
|
|
#define MARGIN 30
|
2007-10-01 15:37:42 +00:00
|
|
|
if( (curpos.x <= MARGIN) || (curpos.x >= DrawAreaSize.x - MARGIN)
|
|
|
|
|| (curpos.y <= MARGIN) || (curpos.y >= DrawAreaSize.y - MARGIN) )
|
2007-08-14 19:24:48 +00:00
|
|
|
{
|
2009-04-14 16:45:22 +00:00
|
|
|
DoCenterAndRedraw = true;
|
2007-08-14 19:24:48 +00:00
|
|
|
}
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2009-04-14 16:45:22 +00:00
|
|
|
if( DoCenterAndRedraw )
|
2007-10-01 15:37:42 +00:00
|
|
|
Recadre_Trace( mouseWarp );
|
2007-08-14 19:24:48 +00:00
|
|
|
else
|
|
|
|
{
|
2009-12-20 19:48:58 +00:00
|
|
|
INSTALL_DC( dc, DrawPanel );
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2008-02-19 07:06:58 +00:00
|
|
|
EXCHG( old_cursor_position, Sheet->LastScreen()->m_Curseur );
|
2007-08-14 19:24:48 +00:00
|
|
|
DrawPanel->CursorOff( &dc );
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2007-08-14 19:24:48 +00:00
|
|
|
if( mouseWarp )
|
2009-01-17 20:31:19 +00:00
|
|
|
DrawPanel->MouseTo( curpos );
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
EXCHG( old_cursor_position, Sheet->LastScreen()->m_Curseur );
|
2007-10-01 15:37:42 +00:00
|
|
|
|
2007-08-14 19:24:48 +00:00
|
|
|
DrawPanel->CursorOn( &dc );
|
|
|
|
}
|
|
|
|
|
2008-02-19 07:06:58 +00:00
|
|
|
msg = WildText + _( " Found in " ) + Sheet->Last()->m_SheetName;
|
2007-08-14 19:24:48 +00:00
|
|
|
Affiche_Message( msg );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Affiche_Message( wxEmptyString );
|
2007-10-01 15:37:42 +00:00
|
|
|
|
|
|
|
if( !mouseWarp )
|
2007-08-14 19:24:48 +00:00
|
|
|
{
|
2007-10-01 15:37:42 +00:00
|
|
|
// if called from RemoteCommand() don't popup the dialog which
|
2009-12-02 21:44:03 +00:00
|
|
|
// needs to be dismissed, user is in PCBNEW, and doesn't want to
|
2007-08-14 19:24:48 +00:00
|
|
|
// bother with dismissing the dialog in EESCHEMA.
|
|
|
|
msg = WildText + _( " Not Found" );
|
|
|
|
DisplayError( this, msg, 10 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return DrawList;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-08-27 11:41:56 +00:00
|
|
|
/*
|
|
|
|
* Search for a given component.
|
|
|
|
*
|
|
|
|
* The search is made in loaded libraries, and if not found in all libraries
|
|
|
|
* found in lib paths.
|
2007-08-14 19:24:48 +00:00
|
|
|
*/
|
2009-08-27 11:41:56 +00:00
|
|
|
void WinEDA_FindFrame::LocatePartInLibs( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-08-27 11:41:56 +00:00
|
|
|
wxArrayString nameList;
|
|
|
|
wxString Text, FindList;
|
|
|
|
bool FoundInLib = false;
|
2007-08-14 19:24:48 +00:00
|
|
|
|
|
|
|
Text = m_NewTextCtrl->GetValue();
|
|
|
|
if( Text.IsEmpty() )
|
|
|
|
{
|
2009-08-27 11:41:56 +00:00
|
|
|
Close();
|
|
|
|
return;
|
2007-08-14 19:24:48 +00:00
|
|
|
}
|
2009-08-27 11:41:56 +00:00
|
|
|
|
2007-08-14 19:24:48 +00:00
|
|
|
s_OldStringFound = Text;
|
|
|
|
|
2009-09-18 14:56:05 +00:00
|
|
|
if( CMP_LIBRARY::GetLibraryCount() == 0 )
|
2007-08-14 19:24:48 +00:00
|
|
|
{
|
2009-09-18 14:56:05 +00:00
|
|
|
DisplayError( this, _( "No component libraries are loaded." ) );
|
2009-08-27 11:41:56 +00:00
|
|
|
Close();
|
|
|
|
return;
|
2007-08-14 19:24:48 +00:00
|
|
|
}
|
|
|
|
|
2009-06-04 10:42:59 +00:00
|
|
|
int nbitemsFound = 0;
|
2009-08-27 11:41:56 +00:00
|
|
|
|
2009-09-18 14:56:05 +00:00
|
|
|
BOOST_FOREACH( CMP_LIBRARY& lib, CMP_LIBRARY::GetLibraryList() )
|
2007-08-14 19:24:48 +00:00
|
|
|
{
|
2009-10-27 10:55:46 +00:00
|
|
|
nameList.Clear();
|
2009-09-18 14:56:05 +00:00
|
|
|
lib.SearchEntryNames( nameList, Text );
|
2009-08-27 11:41:56 +00:00
|
|
|
|
|
|
|
if( nameList.IsEmpty() )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
nbitemsFound += nameList.GetCount();
|
|
|
|
|
2009-09-18 14:56:05 +00:00
|
|
|
if( !lib.IsCache() )
|
2009-08-27 11:41:56 +00:00
|
|
|
FoundInLib = true;
|
|
|
|
|
|
|
|
for( size_t i = 0; i < nameList.GetCount(); i++ )
|
2007-08-14 19:24:48 +00:00
|
|
|
{
|
2009-08-27 11:41:56 +00:00
|
|
|
if( !FindList.IsEmpty() )
|
|
|
|
FindList += wxT( "\n" );
|
|
|
|
FindList << _( "Found " ) + nameList[i] + _( " in library " )
|
2009-09-18 14:56:05 +00:00
|
|
|
+ lib.GetName();
|
2007-08-14 19:24:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !FoundInLib )
|
|
|
|
{
|
2009-06-04 10:42:59 +00:00
|
|
|
if( nbitemsFound )
|
2007-08-14 19:24:48 +00:00
|
|
|
FindList = wxT( "\n" ) + Text + _( " found only in cache" );
|
|
|
|
else
|
|
|
|
FindList = Text + _( " not found" );
|
|
|
|
FindList += _( "\nExplore All Libraries?" );
|
|
|
|
if( IsOK( this, FindList ) )
|
|
|
|
{
|
|
|
|
FindList.Empty();
|
|
|
|
ExploreAllLibraries( Text, FindList );
|
|
|
|
if( FindList.IsEmpty() )
|
2009-04-17 08:51:02 +00:00
|
|
|
DisplayInfoMessage( this, _( "Nothing found" ) );
|
2007-08-14 19:24:48 +00:00
|
|
|
else
|
2009-04-17 08:51:02 +00:00
|
|
|
DisplayInfoMessage( this, FindList );
|
2007-08-14 19:24:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2009-08-27 11:41:56 +00:00
|
|
|
{
|
2009-04-17 08:51:02 +00:00
|
|
|
DisplayInfoMessage( this, FindList );
|
2009-08-27 11:41:56 +00:00
|
|
|
}
|
2007-08-14 19:24:48 +00:00
|
|
|
|
|
|
|
Close();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-02 21:44:03 +00:00
|
|
|
int WinEDA_FindFrame::ExploreAllLibraries( const wxString& wildmask,
|
|
|
|
wxString& FindList )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-14 19:24:48 +00:00
|
|
|
wxString FullFileName;
|
2007-10-01 15:37:42 +00:00
|
|
|
FILE* file;
|
|
|
|
int nbitems = 0, LineNum = 0;
|
|
|
|
char Line[2048], * name;
|
2009-04-14 16:45:22 +00:00
|
|
|
wxString path;
|
2007-08-14 19:24:48 +00:00
|
|
|
|
2009-04-16 08:48:54 +00:00
|
|
|
for( unsigned ii = 0; ii < wxGetApp().GetLibraryPathList().GetCount(); ii++ )
|
2007-08-14 19:24:48 +00:00
|
|
|
{
|
2009-06-04 10:42:59 +00:00
|
|
|
path = wxGetApp().GetLibraryPathList()[ii] + STRING_DIR_SEP;
|
2009-12-02 21:44:03 +00:00
|
|
|
FullFileName = wxFindFirstFile( path + wxT( "*." ) +
|
|
|
|
CompLibFileExtension );
|
2007-08-14 19:24:48 +00:00
|
|
|
|
2009-04-14 16:45:22 +00:00
|
|
|
while( !FullFileName.IsEmpty() )
|
2007-08-14 19:24:48 +00:00
|
|
|
{
|
2009-04-14 16:45:22 +00:00
|
|
|
file = wxFopen( FullFileName, wxT( "rt" ) );
|
|
|
|
if( file == NULL )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
while( GetLine( file, Line, &LineNum, sizeof(Line) ) )
|
2007-10-01 15:37:42 +00:00
|
|
|
{
|
2009-04-14 16:45:22 +00:00
|
|
|
if( strnicmp( Line, "DEF", 3 ) == 0 )
|
2007-08-14 19:24:48 +00:00
|
|
|
{
|
2009-12-02 21:44:03 +00:00
|
|
|
/* Read one DEF part from library:
|
|
|
|
* DEF 74LS00 U 0 30 Y Y 4 0 N */
|
2009-04-14 16:45:22 +00:00
|
|
|
strtok( Line, " \t\r\n" );
|
|
|
|
name = strtok( NULL, " \t\r\n" );
|
2007-08-14 19:24:48 +00:00
|
|
|
wxString st_name = CONV_FROM_UTF8( name );
|
|
|
|
if( WildCompareString( wildmask, st_name, FALSE ) )
|
|
|
|
{
|
|
|
|
nbitems++;
|
|
|
|
if( !FindList.IsEmpty() )
|
|
|
|
FindList += wxT( "\n" );
|
|
|
|
FindList << _( "Found " ) << CONV_FROM_UTF8( name )
|
|
|
|
<< _( " in lib " ) << FullFileName;
|
|
|
|
}
|
|
|
|
}
|
2009-04-14 16:45:22 +00:00
|
|
|
else if( strnicmp( Line, "ALIAS", 5 ) == 0 )
|
|
|
|
{
|
2009-12-02 21:44:03 +00:00
|
|
|
/* Read one ALIAS part from library:
|
|
|
|
* ALIAS 74HC00 74HCT00 7400 74LS37 */
|
2009-04-14 16:45:22 +00:00
|
|
|
strtok( Line, " \t\r\n" );
|
|
|
|
while( ( name = strtok( NULL, " \t\r\n" ) ) != NULL )
|
|
|
|
{
|
|
|
|
wxString st_name = CONV_FROM_UTF8( name );
|
|
|
|
if( WildCompareString( wildmask, st_name, FALSE ) )
|
|
|
|
{
|
|
|
|
nbitems++;
|
|
|
|
if( !FindList.IsEmpty() )
|
|
|
|
FindList += wxT( "\n" );
|
|
|
|
FindList << _( "Found " ) << CONV_FROM_UTF8( name )
|
|
|
|
<< _( " in lib " ) << FullFileName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-08-14 19:24:48 +00:00
|
|
|
}
|
|
|
|
|
2009-04-14 16:45:22 +00:00
|
|
|
fclose( file );
|
|
|
|
FullFileName = wxFindNextFile();
|
|
|
|
}
|
2007-08-14 19:24:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return nbitems;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|