~cern-kicad/kicad/kicad-pns-tom

« back to all changes in this revision

Viewing changes to eeschema/sch_collectors.cpp

  • Committer: Maciej Suminski
  • Date: 2013-08-02 13:57:24 UTC
  • mfrom: (4024.1.238 kicad)
  • mto: This revision was merged to the branch mainline in revision 4221.
  • Revision ID: maciej.suminski@cern.ch-20130802135724-gix6orezshkukodv
Upstream merge.

Show diffs side-by-side

added added

removed removed

Lines of Context:
338
338
}
339
339
 
340
340
 
341
 
bool SCH_FIND_COLLECTOR::atEnd() const
 
341
bool SCH_FIND_COLLECTOR::PassedEnd() const
342
342
{
343
343
    bool retv = false;
344
344
 
351
351
    {
352
352
        if( flags & wxFR_DOWN )
353
353
        {
354
 
            if( m_foundIndex >= (GetCount() - 1) )
 
354
            if( m_foundIndex >= GetCount() )
355
355
                retv = true;
356
356
        }
357
357
        else
358
358
        {
359
 
            if( m_foundIndex == 0 )
 
359
            if( m_foundIndex < 0 )
360
360
                retv = true;
361
361
        }
362
362
    }
390
390
 
391
391
    if( flags & wxFR_DOWN )
392
392
    {
393
 
        if( !(flags & FR_SEARCH_WRAP) && (m_foundIndex == (GetCount() - 1)) )
394
 
            return;
395
 
 
396
 
        m_foundIndex += 1;
397
 
 
 
393
        if( m_foundIndex < GetCount() )
 
394
            m_foundIndex += 1;
398
395
        if( (m_foundIndex >= GetCount()) && (flags & FR_SEARCH_WRAP) )
399
396
            m_foundIndex = 0;
400
397
    }
401
398
    else
402
399
    {
403
 
        if( !(flags & FR_SEARCH_WRAP) && (m_foundIndex == 0) )
404
 
            return;
405
 
 
406
 
        m_foundIndex -= 1;
407
 
 
 
400
        if( m_foundIndex >= 0 )
 
401
            m_foundIndex -= 1;
408
402
        if( (m_foundIndex < 0) && (flags & FR_SEARCH_WRAP) )
409
403
            m_foundIndex = GetCount() - 1;
410
404
    }
452
446
 
453
447
EDA_ITEM* SCH_FIND_COLLECTOR::GetItem( SCH_FIND_COLLECTOR_DATA& aData )
454
448
{
455
 
    if( atEnd() )
 
449
    if( PassedEnd() )
456
450
        return NULL;
457
451
 
458
452
    aData = m_data[ m_foundIndex ];
462
456
 
463
457
bool SCH_FIND_COLLECTOR::ReplaceItem()
464
458
{
465
 
    if( atEnd() )
 
459
    if( PassedEnd() )
466
460
        return false;
467
461
 
468
462
    wxCHECK_MSG( IsValidIndex( m_foundIndex ), false,
516
510
void SCH_FIND_COLLECTOR::Collect( SCH_FIND_REPLACE_DATA& aFindReplaceData,
517
511
                                  SCH_SHEET_PATH* aSheetPath )
518
512
{
519
 
    if( !m_findReplaceData.ChangesSearch( aFindReplaceData ) && !m_List.empty() && !m_forceSearch )
 
513
    if( !IsSearchRequired( aFindReplaceData ) && !m_List.empty() && !m_forceSearch )
520
514
        return;
521
515
 
522
516
    m_findReplaceData = aFindReplaceData;