Commit 35749e57 authored by Wayne Stambaugh's avatar Wayne Stambaugh
Browse files

Fix Eeschema find item bugs and other minor changes.

* Fix bug in hierarchical searches using sheet path pointers which are
  destroyed on every search.  Use human readable path as last sheet found
  in test to prevent comparison of deleted pointers.
* Fix a bug in SCH_COMPONENT::Matches() that would prevent searching for
  pins if the search all fields flags was not set.
* Fix a bug in SCH_COMPONENT::Matches() to use the sheet path to perform
  the comparison to the correct reference designator and unit number.
* Fix wrapping in sheet path and sheet path list MatchNextItem methods.
* Push search methods down to EDA_ITEM object so advanced searching can
  be performed on all items derived from EDA_ITEM.
* Add virtual method to EDA_ITEM object to test if item supports replacing
  text.
* Replace switch statement magic numbers in Eeschema socket connection code
  with Pcbnew for improved readability.
parent 16957670
Loading
Loading
Loading
Loading
+54 −0
Original line number Original line Diff line number Diff line
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
 * Copyright (C) 2008-20011 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, you may find one here:
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * or you may search the http://www.gnu.org website for the version 2 license,
 * or you may write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 */

/**
/**
 * @file base_struct.cpp
 * @file base_struct.cpp
 * @brief Implementation of EDA_ITEM and EDA_TEXT base classes for KiCad.
 * @brief Implementation of EDA_ITEM and EDA_TEXT base classes for KiCad.
@@ -13,6 +38,8 @@
#include "class_base_screen.h"
#include "class_base_screen.h"
#include "drawtxt.h"
#include "drawtxt.h"


#include "../eeschema/dialogs/dialog_schematic_find.h"



enum textbox {
enum textbox {
    ID_TEXTBOX_LIST = 8010
    ID_TEXTBOX_LIST = 8010
@@ -133,6 +160,33 @@ wxString EDA_ITEM::GetSelectMenuText() const
}
}




bool EDA_ITEM::Matches( const wxString& aText, wxFindReplaceData& aSearchData )
{
    wxString text = aText;
    wxString searchText = aSearchData.GetFindString();

    // Don't match if searching for replaceable item and the item doesn't support text replace.
    if( (aSearchData.GetFlags() & FR_SEARCH_REPLACE) && !IsReplaceable() )
        return false;

    if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
        return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );

    if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
    {
        if( aSearchData.GetFlags() & wxFR_MATCHCASE )
            return text.Matches( searchText );

        return text.MakeUpper().Matches( searchText.MakeUpper() );
    }

    if( aSearchData.GetFlags() & wxFR_MATCHCASE )
        return aText.Find( searchText ) != wxNOT_FOUND;

    return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
}


bool EDA_ITEM::operator<( const EDA_ITEM& aItem ) const
bool EDA_ITEM::operator<( const EDA_ITEM& aItem ) const
{
{
    wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
    wxFAIL_MSG( wxString::Format( wxT( "Less than operator not defined for item type %s." ),
+0 −23
Original line number Original line Diff line number Diff line
@@ -108,29 +108,6 @@ void SCH_ITEM::Place( SCH_EDIT_FRAME* aFrame, wxDC* aDC )
}
}




bool SCH_ITEM::Matches( const wxString& aText, wxFindReplaceData& aSearchData )
{
    wxString text = aText;
    wxString searchText = aSearchData.GetFindString();

    if( aSearchData.GetFlags() & wxFR_WHOLEWORD )
        return aText.IsSameAs( searchText, aSearchData.GetFlags() & wxFR_MATCHCASE );

    if( aSearchData.GetFlags() & FR_MATCH_WILDCARD )
    {
        if( aSearchData.GetFlags() & wxFR_MATCHCASE )
            return text.Matches( searchText );

        return text.MakeUpper().Matches( searchText.MakeUpper() );
    }

    if( aSearchData.GetFlags() & wxFR_MATCHCASE )
        return aText.Find( searchText ) != wxNOT_FOUND;

    return text.MakeUpper().Find( searchText.MakeUpper() ) != wxNOT_FOUND;
}


bool SCH_ITEM::IsConnected( const wxPoint& aPosition ) const
bool SCH_ITEM::IsConnected( const wxPoint& aPosition ) const
{
{
    if( m_Flags & STRUCT_DELETED || m_Flags & SKIP_STRUCT )
    if( m_Flags & STRUCT_DELETED || m_Flags & SKIP_STRUCT )
+46 −23
Original line number Original line Diff line number Diff line
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
 * Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, you may find one here:
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * or you may search the http://www.gnu.org website for the version 2 license,
 * or you may write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 */

/**
/**
 * @file eeschema/cross-probing.cpp
 * @file eeschema/cross-probing.cpp
 */
 */
@@ -17,17 +42,20 @@




/**
/**
 * Read a remote command sent by Pcbnew (via a socket connection) ,
 * Function RemoteCommand
 * so when user selects a module or pin in Pcbnew,
 * read a remote command sent by Pcbnew via a socket connection.
 * Deschema shows that same component or pin.
 * <p>
 * The cursor is put on the item
 * When user selects a module or pin in Pcbnew, Eeschema shows that same
 *  port KICAD_SCH_PORT_SERVICE_NUMBER (currently 4243)
 * component or pin and moves cursor on the item.  The socket port used
 * is #KICAD_SCH_PORT_SERVICE_NUMBER which defaults to 4243.
 *
 * Valid commands are:
 * \li \c \$PART: \c "reference" Put cursor on component.
 * \li \c \$PART: \c "reference" \c \$REF: \c "ref" Put cursor on component reference.
 * \li \c \$PART: \c "reference" \c \$VAL: \c "value" Put cursor on component value.
 * \li \c \$PART: \c "reference" \c \$PAD: \c "pin name" Put cursor on the component pin.
 * <p>
 * @param cmdline = received command from Pcbnew
 * @param cmdline = received command from Pcbnew
 * commands are:
 * $PART: "reference"   put cursor on component
 * $PART: "reference" $REF: "ref"  put cursor on reference component
 * $PART: "reference" $VAL: "value" put cursor on value component
 * $PART: "reference" $PAD: "pin name"  put cursor on the component pin
 */
 */
void RemoteCommand( const char* cmdline )
void RemoteCommand( const char* cmdline )
{
{
@@ -57,7 +85,7 @@ void RemoteCommand( const char* cmdline )


    if( idcmd == NULL )    // component only
    if( idcmd == NULL )    // component only
    {
    {
        frame->FindComponentAndItem( part_ref, true, 0, wxEmptyString, false );
        frame->FindComponentAndItem( part_ref, true, FIND_COMPONENT_ONLY, wxEmptyString, false );
        return;
        return;
    }
    }


@@ -70,28 +98,23 @@ void RemoteCommand( const char* cmdline )


    if( strcmp( idcmd, "$REF:" ) == 0 )
    if( strcmp( idcmd, "$REF:" ) == 0 )
    {
    {
        frame->FindComponentAndItem( part_ref, true, 2, msg, false );
        frame->FindComponentAndItem( part_ref, true, FIND_REFERENCE, msg, false );
    }
    }
    else if( strcmp( idcmd, "$VAL:" ) == 0 )
    else if( strcmp( idcmd, "$VAL:" ) == 0 )
    {
    {
        frame->FindComponentAndItem( part_ref, true, 3, msg, false );
        frame->FindComponentAndItem( part_ref, true, FIND_VALUE, msg, false );
    }
    }
    else if( strcmp( idcmd, "$PAD:" ) == 0 )
    else if( strcmp( idcmd, "$PAD:" ) == 0 )
    {
    {
        frame->FindComponentAndItem( part_ref, true, 1, msg, false );
        frame->FindComponentAndItem( part_ref, true, FIND_PIN, msg, false );
    }
    }
    else
    else
        frame->FindComponentAndItem( part_ref, true, 0, wxEmptyString, false );
    {
        frame->FindComponentAndItem( part_ref, true, FIND_COMPONENT_ONLY, wxEmptyString, false );
    }
}
}




/** Send a remote command to Eeschema via a socket,
 * @param objectToSync = item to be located on board (footprint, pad or text)
 * @param LibItem = component in lib if objectToSync is a sub item of a component
 * Commands are
 * $PART: reference   put cursor on footprint anchor
 * $PIN: number $PART: reference put cursor on the footprint pad
 */
void SCH_EDIT_FRAME::SendMessageToPCBNEW( EDA_ITEM* objectToSync, SCH_COMPONENT* LibItem )
void SCH_EDIT_FRAME::SendMessageToPCBNEW( EDA_ITEM* objectToSync, SCH_COMPONENT* LibItem )
{
{
    if( objectToSync == NULL )
    if( objectToSync == NULL )
+18 −10
Original line number Original line Diff line number Diff line
@@ -17,31 +17,39 @@
#include <wx/fdrepdlg.h>          // Use the wxFindReplaceDialog events, data, and enums.
#include <wx/fdrepdlg.h>          // Use the wxFindReplaceDialog events, data, and enums.




/* Define schematic specific find and replace dialog flags based on the enum entries
/**
 * Define schematic specific find and replace dialog flags based on the enum entries
 * in wxFindReplaceFlags.   These flags are intended to be used as bit masks in the
 * in wxFindReplaceFlags.   These flags are intended to be used as bit masks in the
 * wxFindReplaceData::m_Flags member variable.  The varialble is defined as a wxUint32.
 * wxFindReplaceData::m_Flags member variable.  The varialble is defined as a wxUint32.
 */
 */
enum SchematicFindReplaceFlags
enum SchematicFindReplaceFlags
{
{
    /* The last wxFindReplaceFlag enum is wxFR_MATCHCASE. */
    // The last wxFindReplaceFlag enum is wxFR_MATCHCASE.


    /* Search the current sheet only. */
    /// Search the current sheet only.
    FR_CURRENT_SHEET_ONLY    = wxFR_MATCHCASE << 1,
    FR_CURRENT_SHEET_ONLY    = wxFR_MATCHCASE << 1,


    /* Search all fields in component, not just the value and reference fields. */
    /// Search all fields in component, not just the value and reference fields.
    FR_SEARCH_ALL_FIELDS     = wxFR_MATCHCASE << 2,
    FR_SEARCH_ALL_FIELDS     = wxFR_MATCHCASE << 2,


    /* Search texts (name and number (a 4 letters text) )in pins. */
    /// Search texts (name and number (a 4 letters text) )in pins.
    FR_SEARCH_ALL_PINS       = wxFR_MATCHCASE << 3,
    FR_SEARCH_ALL_PINS       = wxFR_MATCHCASE << 3,


    /* Perform search using simple wild card matching (* & ?). */
    /// Perform search using simple wild card matching (* & ?).
    FR_MATCH_WILDCARD        = wxFR_MATCHCASE << 4,
    FR_MATCH_WILDCARD        = wxFR_MATCHCASE << 4,


    /* Wrap around the beginning or end of search list. */
    /// Wrap around the beginning or end of search list.
    FR_SEARCH_WRAP           = wxFR_MATCHCASE << 5,
    FR_SEARCH_WRAP           = wxFR_MATCHCASE << 5,


    /* Don't warp cursor to found item until the dialog is closed. */
    /// Don't warp cursor to found item until the dialog is closed.
    FR_NO_WARP_CURSOR        = wxFR_MATCHCASE << 6
    FR_NO_WARP_CURSOR        = wxFR_MATCHCASE << 6,

    /// Perform a search for a item that has repaceable text.
    FR_SEARCH_REPLACE        = wxFR_MATCHCASE << 7,

    /// Used by the search event handler to let the dialog know that a replaceable
    /// item has been found.
    FR_REPLACE_ITEM_FOUND    = wxFR_MATCHCASE << 8
};
};




+74 −60
Original line number Original line Diff line number Diff line
@@ -110,94 +110,95 @@ void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event )
}
}




SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& component_reference,
SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& aReference,
                                                bool Find_in_hierarchy,
                                                bool            aSearchHierarchy,
                                                int SearchType,
                                                SCH_SEARCH_T    aSearchType,
                                                const wxString& text_to_find,
                                                const wxString& aSearchText,
                                                bool mouseWarp )
                                                bool            aWarpMouse )
{
{
    SCH_SHEET_PATH* sheet;
    SCH_SHEET_PATH* sheet;
    SCH_SHEET_PATH* sheetWithComponentFound = NULL;
    SCH_SHEET_PATH* sheetWithComponentFound = NULL;
    SCH_ITEM*       DrawList     = NULL;
    SCH_ITEM*       item = NULL;
    SCH_COMPONENT*  Component = NULL;
    SCH_COMPONENT*  Component = NULL;
    wxPoint         pos, curpos;
    wxPoint         pos, curpos;
    bool            DoCenterAndRedraw = false;
    bool            centerAndRedraw = false;
    bool            NotFound = true;
    bool            notFound = true;
    wxString        msg;
    wxString        msg;
    LIB_PIN*        pin;
    LIB_PIN*        pin;
    SCH_SHEET_LIST  SheetList;
    SCH_SHEET_LIST  sheetList;


    sheet = SheetList.GetFirst();
    sheet = sheetList.GetFirst();


    if( !Find_in_hierarchy )
    if( !aSearchHierarchy )
        sheet = m_CurrentSheet;
        sheet = m_CurrentSheet;


    for( ; sheet != NULL; sheet = SheetList.GetNext() )
    for( ; sheet != NULL; sheet = sheetList.GetNext() )
    {
    {
        DrawList = (SCH_ITEM*) sheet->LastDrawList();
        item = (SCH_ITEM*) sheet->LastDrawList();


        for( ; ( DrawList != NULL ) && ( NotFound == true ); DrawList = DrawList->Next() )
        for( ; ( item != NULL ) && ( notFound == true ); item = item->Next() )
        {
        {
            if( DrawList->Type() != SCH_COMPONENT_T )
            if( item->Type() != SCH_COMPONENT_T )
                continue;
                continue;


            SCH_COMPONENT* pSch = (SCH_COMPONENT*) DrawList;
            SCH_COMPONENT* pSch = (SCH_COMPONENT*) item;


            if( component_reference.CmpNoCase( pSch->GetRef( sheet ) ) == 0 )
            if( aReference.CmpNoCase( pSch->GetRef( sheet ) ) == 0 )
            {
            {
                Component = pSch;
                Component = pSch;
                sheetWithComponentFound = sheet;
                sheetWithComponentFound = sheet;


                switch( SearchType )
                switch( aSearchType )
                {
                {
                default:
                default:
                case 0:             // Find component only
                case FIND_COMPONENT_ONLY:    // Find component only
                    NotFound = false;
                    notFound = false;
                    pos = pSch->GetPosition();
                    pos = pSch->GetPosition();
                    break;
                    break;


                case 1:                 // find a pin
                case FIND_PIN:               // find a pin
                    pos = pSch->GetPosition();  // temporary: will be changed if the pin is found.
                    pos = pSch->GetPosition();  // temporary: will be changed if the pin is found.
                    pin = pSch->GetPin( text_to_find );
                    pin = pSch->GetPin( aSearchText );


                    if( pin == NULL )
                    if( pin == NULL )
                        break;
                        break;


                    NotFound = false;
                    notFound = false;
                    pos += pin->GetPosition();
                    pos += pin->GetPosition();
                    break;
                    break;


                case 2:     // find reference
                case FIND_REFERENCE:         // find reference
                    NotFound = false;
                    notFound = false;
                    pos = pSch->GetField( REFERENCE )->GetPosition();
                    pos = pSch->GetField( REFERENCE )->GetPosition();
                    break;
                    break;


                case 3:     // find value
                case FIND_VALUE:             // find value
                    pos = pSch->GetPosition();
                    pos = pSch->GetPosition();


                    if( text_to_find.CmpNoCase( pSch->GetField( VALUE )->m_Text ) != 0 )
                    if( aSearchText.CmpNoCase( pSch->GetField( VALUE )->m_Text ) != 0 )
                        break;
                        break;


                    NotFound = false;
                    notFound = false;
                    pos = pSch->GetField( VALUE )->GetPosition();
                    pos = pSch->GetField( VALUE )->GetPosition();
                    break;
                    break;
                }
                }
            }
            }
        }
        }


        if( (Find_in_hierarchy == false) || (NotFound == false) )
        if( (aSearchHierarchy == false) || (notFound == false) )
            break;
            break;
    }
    }


    if( Component )
    if( Component )
    {
    {
        sheet = sheetWithComponentFound;
        sheet = sheetWithComponentFound;

        if( *sheet != *GetSheet() )
        if( *sheet != *GetSheet() )
        {
        {
            sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
            sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
            *m_CurrentSheet = *sheet;
            *m_CurrentSheet = *sheet;
            m_CurrentSheet->UpdateAllScreenReferences();
            m_CurrentSheet->UpdateAllScreenReferences();
            DoCenterAndRedraw = true;
            centerAndRedraw = true;
        }
        }


        wxPoint delta;
        wxPoint delta;
@@ -209,13 +210,13 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& component_refere
        /* There may be need to reframe the drawing */
        /* There may be need to reframe the drawing */
        if( ! DrawPanel->IsPointOnDisplay( pos ) )
        if( ! DrawPanel->IsPointOnDisplay( pos ) )
        {
        {
            DoCenterAndRedraw = true;
            centerAndRedraw = true;
        }
        }


        if( DoCenterAndRedraw )
        if( centerAndRedraw )
        {
        {
            GetScreen()->SetCrossHairPosition(pos);
            GetScreen()->SetCrossHairPosition(pos);
            RedrawScreen( pos, mouseWarp );
            RedrawScreen( pos, aWarpMouse );
        }
        }


        else
        else
@@ -224,7 +225,7 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& component_refere


            DrawPanel->CrossHairOff( &dc );
            DrawPanel->CrossHairOff( &dc );


            if( mouseWarp )
            if( aWarpMouse )
                DrawPanel->MoveCursor( pos );
                DrawPanel->MoveCursor( pos );


            GetScreen()->SetCrossHairPosition(pos);
            GetScreen()->SetCrossHairPosition(pos);
@@ -236,42 +237,44 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& component_refere


    /* Print diag */
    /* Print diag */
    wxString msg_item;
    wxString msg_item;
    msg = component_reference;
    msg = aReference;


    switch( SearchType )
    switch( aSearchType )
    {
    {
    default:
    default:
    case 0:
    case FIND_COMPONENT_ONLY:      // Find component only
        break;      // Find component only
        break;


    case 1:         // find a pin
    case FIND_PIN:                 // find a pin
        msg_item = _( "Pin " ) + text_to_find;
        msg_item = _( "Pin " ) + aSearchText;
        break;
        break;


    case 2:     // find reference
    case FIND_REFERENCE:           // find reference
        msg_item = _( "Ref " ) + text_to_find;
        msg_item = _( "Ref " ) + aSearchText;
        break;
        break;


    case 3:     // find value
    case FIND_VALUE:               // find value
        msg_item = _( "Value " ) + text_to_find;
        msg_item = _( "Value " ) + aSearchText;
        break;
        break;


    case 4:     // find field. todo
    case FIND_FIELD:               // find field. todo
        msg_item = _( "Field " ) + text_to_find;
        msg_item = _( "Field " ) + aSearchText;
        break;
        break;
    }
    }


    if( Component )
    if( Component )
    {
    {
        if( !NotFound )
        if( !notFound )
        {
        {
            if( !msg_item.IsEmpty() )
            if( !msg_item.IsEmpty() )
                msg += wxT( " " ) + msg_item;
                msg += wxT( " " ) + msg_item;

            msg += _( " found" );
            msg += _( " found" );
        }
        }
        else
        else
        {
        {
            msg += _( " found" );
            msg += _( " found" );

            if( !msg_item.IsEmpty() )
            if( !msg_item.IsEmpty() )
            {
            {
                msg += wxT( " but " ) + msg_item + _( " not found" );
                msg += wxT( " but " ) + msg_item + _( " not found" );
@@ -282,12 +285,13 @@ SCH_ITEM* SCH_EDIT_FRAME::FindComponentAndItem( const wxString& component_refere
    {
    {
        if( !msg_item.IsEmpty() )
        if( !msg_item.IsEmpty() )
            msg += wxT( " " ) + msg_item;
            msg += wxT( " " ) + msg_item;

        msg += _( " not found" );
        msg += _( " not found" );
    }
    }


    SetStatusText( msg );
    SetStatusText( msg );


    return DrawList;
    return item;
}
}




@@ -297,11 +301,11 @@ void SCH_EDIT_FRAME::OnFindSchematicItem( wxFindDialogEvent& aEvent )
                                         * note: the actual matched item can be a
                                         * note: the actual matched item can be a
                                         * part of lastItem (for instance a field in a component
                                         * part of lastItem (for instance a field in a component
                                         */
                                         */
    static wxString   sheetFoundIn;
    static wxPoint    lastItemPosition; // the actual position of the matched sub item
    static wxPoint    lastItemPosition; // the actual position of the matched sub item


    SCH_SHEET_LIST    schematic;
    SCH_SHEET_LIST    schematic;
    wxString          msg;
    wxString          msg;
    SCH_SHEET_PATH*   sheetFoundIn = NULL;
    wxFindReplaceData searchCriteria;
    wxFindReplaceData searchCriteria;
    bool              warpCursor = !( aEvent.GetFlags() & FR_NO_WARP_CURSOR );
    bool              warpCursor = !( aEvent.GetFlags() & FR_NO_WARP_CURSOR );


@@ -311,39 +315,49 @@ void SCH_EDIT_FRAME::OnFindSchematicItem( wxFindDialogEvent& aEvent )


    if( aEvent.GetEventType() == wxEVT_COMMAND_FIND_CLOSE )
    if( aEvent.GetEventType() == wxEVT_COMMAND_FIND_CLOSE )
    {
    {
        sheetFoundIn = m_CurrentSheet;
        sheetFoundIn = m_CurrentSheet->PathHumanReadable();
        warpCursor = true;
        warpCursor = true;
    }
    }
    else if( aEvent.GetFlags() & FR_CURRENT_SHEET_ONLY && g_RootSheet->CountSheets() > 1 )
    else if( aEvent.GetFlags() & FR_CURRENT_SHEET_ONLY && g_RootSheet->CountSheets() > 1 )
    {
    {
        sheetFoundIn = m_CurrentSheet;
        sheetFoundIn = m_CurrentSheet->PathHumanReadable();
        lastItem = m_CurrentSheet->MatchNextItem( searchCriteria, lastItem, &lastItemPosition );
        lastItem = m_CurrentSheet->MatchNextItem( searchCriteria, lastItem, &lastItemPosition );
    }
    }
    else
    else
    {
    {
        lastItem = schematic.MatchNextItem( searchCriteria, &sheetFoundIn, lastItem,
        lastItem = schematic.MatchNextItem( searchCriteria, sheetFoundIn, lastItem,
                                            &lastItemPosition );
                                            &lastItemPosition );
    }
    }


    if( lastItem != NULL )
    if( lastItem != NULL )
    {
    {
        if( sheetFoundIn != GetSheet() )
        SCH_SHEET_PATH* sheet = schematic.GetSheet( sheetFoundIn );

        wxCHECK_RET( sheet != NULL, wxT( "Could not find sheet path " + sheetFoundIn ) );

        if( sheet != GetSheet() )
        {
        {
            sheetFoundIn->LastScreen()->SetZoom( GetScreen()->GetZoom() );
            sheet->LastScreen()->SetZoom( GetScreen()->GetZoom() );
            *m_CurrentSheet = *sheetFoundIn;
            *m_CurrentSheet = *sheet;
            m_CurrentSheet->UpdateAllScreenReferences();
            m_CurrentSheet->UpdateAllScreenReferences();
        }
        }


        sheetFoundIn->LastScreen()->SetCrossHairPosition( lastItemPosition );
        sheet->LastScreen()->SetCrossHairPosition( lastItemPosition );


        RedrawScreen( lastItemPosition, warpCursor );
        RedrawScreen( lastItemPosition, warpCursor );


        msg = aEvent.GetFindString() + _( " found in " ) + sheetFoundIn->PathHumanReadable();
        msg = lastItem->GetSelectMenuText() + _( " found in sheet " ) + sheetFoundIn;
        SetStatusText( msg );
    }
    }
    else
    else
    {
    {
        sheetFoundIn = wxEmptyString;
        msg.Printf( _( "No item found matching %s." ), GetChars( aEvent.GetFindString() ) );
        msg.Printf( _( "No item found matching %s." ), GetChars( aEvent.GetFindString() ) );
    }

    SetStatusText( msg );
    SetStatusText( msg );
}
}


void SCH_EDIT_FRAME::OnFindReplace( wxFindDialogEvent& aEvent )
{
}
}
Loading