Commit c07b677a authored by Wayne Stambaugh's avatar Wayne Stambaugh
Browse files

Schematic editor locate item changes and other minor fixes.

* Move locate function code into schematic screen object.
* Move test for junction needed into schematic screen object.
* Move test for marking connected items into schematic screen object.
* Move delete item function code into schematic screen object.
* Move delete all markers code into schematic screen object.
* Add method for locating multiple items in schematic screen object.
* Fix minor bug in schematic field object hit test declaration.
* Initial encapsulation work on item picker object.
* Remove duplicate doxygen comments from item picker object source file.
parent 628e5240
Loading
Loading
Loading
Loading
+25 −105
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
 * This program source code file is part of KICAD, a free EDA CAD application.
 *
 * Copyright (C) 2009 jean-pierre.charras@gipsa-lab.inpg.fr
 * Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 2009 Kicad Developers, see change_log.txt for contributors.
 *
 * This program is free software; you can redistribute it and/or
@@ -26,7 +27,6 @@
#include "common.h"
#include "base_struct.h"

//#include "sch_item_struct.h"
#include "base_struct.h"
#include "class_undoredo_container.h"

@@ -51,20 +51,12 @@ PICKED_ITEMS_LIST::~PICKED_ITEMS_LIST()
}


/** PushItem
 * push a picker to the top of the list
 * @param aItem = picker to push
 */
void PICKED_ITEMS_LIST::PushItem( ITEM_PICKER& aItem )
{
    m_ItemsList.push_back( aItem );
}


/** PopItem
 * @return the picker from the top of the list
 * the picker is removed from the list
 */
ITEM_PICKER PICKED_ITEMS_LIST::PopItem()
{
    ITEM_PICKER item;
@@ -74,25 +66,29 @@ ITEM_PICKER PICKED_ITEMS_LIST::PopItem()
        item = m_ItemsList.back();
        m_ItemsList.pop_back();
    }

    return item;
}


/**
 * Function ClearItemsList
 * delete only the list of pickers, NOT the picked data itself
 */
bool PICKED_ITEMS_LIST::ContainsItem( EDA_ITEM* aItem ) const
{
    for( size_t i = 0;  i < m_ItemsList.size();  i++ )
    {
        if( m_ItemsList[ i ].m_PickedItem == aItem )
            return true;
    }

    return false;
}


void PICKED_ITEMS_LIST::ClearItemsList()
{
    m_ItemsList.clear();
}


/**
 * Function ClearListAndDeleteItems
 * delete the list of pickers, AND the data pointed
 * by m_PickedItem or m_PickedItemLink, according to the type of undo/redo command recorded
 */
void PICKED_ITEMS_LIST::ClearListAndDeleteItems()
{
    bool show_error_message = true;
@@ -108,13 +104,14 @@ void PICKED_ITEMS_LIST::ClearListAndDeleteItems()
        case UR_UNSPECIFIED:
            if( show_error_message )
                wxMessageBox( wxT( "ClearUndoORRedoList() error: UR_UNSPECIFIED command type" ) );

            show_error_message = false;
            break;

        case UR_WIRE_IMAGE:
        {
            // Specific to eeschema: a linked list of wires is stored.
            // the wrapper picks only the first item (head of list), and is owner of all picked items
            // Specific to eeschema: a linked list of wires is stored.  The wrapper picks only
            // the first item (head of list), and is owner of all picked items.
            EDA_ITEM* item = wrapper.m_PickedItem;

            while( item )
@@ -144,8 +141,8 @@ void PICKED_ITEMS_LIST::ClearListAndDeleteItems()
        case UR_LIBEDIT:            /* Libedit save always a copy of the current item
                                     *  So, the picker is always owner of the picked item
                                     */
        case UR_MODEDIT:            /* Specific to the module editor
                                     *  (modedit creates a full copy of the current module when changed),
        case UR_MODEDIT:            /* Specific to the module editor (modedit creates a full
                                     * copy of the current module when changed),
                                     * and the picker is owner of this item
                                     */
            delete wrapper.m_PickedItem;
@@ -164,13 +161,6 @@ void PICKED_ITEMS_LIST::ClearListAndDeleteItems()
}


/**
 * Function GetItemWrapper
 * @return the picker of a picked item
 * @param aIdx = index of the picker in the picked list
 * if this picker does not exist, a picker is returned,
 * with its members set to 0 or NULL
 */
ITEM_PICKER PICKED_ITEMS_LIST::GetItemWrapper( unsigned int aIdx )
{
    ITEM_PICKER picker;
@@ -182,11 +172,6 @@ ITEM_PICKER PICKED_ITEMS_LIST::GetItemWrapper( unsigned int aIdx )
}


/**
 * Function GetPickedItem
 * @return a pointer to the picked item, or null if does not exist
 * @param aIdx = index of the picked item in the picked list
 */
EDA_ITEM* PICKED_ITEMS_LIST::GetPickedItem( unsigned int aIdx )
{
    if( aIdx < m_ItemsList.size() )
@@ -196,11 +181,6 @@ EDA_ITEM* PICKED_ITEMS_LIST::GetPickedItem( unsigned int aIdx )
}


/**
 * Function GetPickedItemLink
 * @return link of the picked item, or null if does not exist
 * @param aIdx = index of the picked item in the picked list
 */
EDA_ITEM* PICKED_ITEMS_LIST::GetPickedItemLink( unsigned int aIdx )
{
    if( aIdx < m_ItemsList.size() )
@@ -210,12 +190,6 @@ EDA_ITEM* PICKED_ITEMS_LIST::GetPickedItemLink( unsigned int aIdx )
}


/**
 * Function GetPickedItemStatus
 * @return the type of undo/redo opertaion associated to the picked item,
 *   or UR_UNSPECIFIED if does not exist
 * @param aIdx = index of the picked item in the picked list
 */
UndoRedoOpType PICKED_ITEMS_LIST::GetPickedItemStatus( unsigned int aIdx )
{
    if( aIdx < m_ItemsList.size() )
@@ -224,12 +198,7 @@ UndoRedoOpType PICKED_ITEMS_LIST::GetPickedItemStatus( unsigned int aIdx )
        return UR_UNSPECIFIED;
}

/**
 * Function GetPickerFlags
 * return the value of the picker flag
  * @param aIdx = index of the picker in the picked list
 * @return the value stored in the picker, if the picker exists, or 0 if does not exist
 */

int PICKED_ITEMS_LIST::GetPickerFlags( unsigned aIdx )
{
    if( aIdx < m_ItemsList.size() )
@@ -238,12 +207,7 @@ int PICKED_ITEMS_LIST::GetPickerFlags( unsigned aIdx )
        return 0;
}

/**
 * Function SetPickedItem
 * @param aItem = a pointer to the item to pick
 * @param aIdx = index of the picker in the picked list
 * @return true if the picker exists, or false if does not exist
 */

bool PICKED_ITEMS_LIST::SetPickedItem( EDA_ITEM* aItem, unsigned aIdx )
{
    if( aIdx < m_ItemsList.size() )
@@ -256,13 +220,6 @@ bool PICKED_ITEMS_LIST::SetPickedItem( EDA_ITEM* aItem, unsigned aIdx )
}


/**
 * Function SetPickedItemLink
 * Set the link associated to a given picked item
 * @param aLink = the link to the item associated to the picked item
 * @param aIdx = index of the picker in the picked list
 * @return true if the picker exists, or false if does not exist
 */
bool PICKED_ITEMS_LIST::SetPickedItemLink( EDA_ITEM* aLink, unsigned aIdx )
{
    if( aIdx < m_ItemsList.size() )
@@ -275,13 +232,6 @@ bool PICKED_ITEMS_LIST::SetPickedItemLink( EDA_ITEM* aLink, unsigned aIdx )
}


/**
 * Function SetPickedItem
 * @param aItem = a pointer to the item to pick
 * @param aStatus = the type of undo/redo operation associated to the item to pick
 * @param aIdx = index of the picker in the picked list
 * @return true if the picker exists, or false if does not exist
 */
bool PICKED_ITEMS_LIST::SetPickedItem( EDA_ITEM* aItem, UndoRedoOpType aStatus, unsigned aIdx )
{
    if( aIdx < m_ItemsList.size() )
@@ -295,13 +245,6 @@ bool PICKED_ITEMS_LIST::SetPickedItem( EDA_ITEM* aItem, UndoRedoOpType aStatus,
}


/**
 * Function SetPickedItemStatus
 * Set the the type of undo/redo operation for a given picked item
 * @param aStatus = the type of undo/redo operation associated to the picked item
 * @param aIdx = index of the picker in the picked list
 * @return true if the picker exists, or false if does not exist
 */
bool PICKED_ITEMS_LIST::SetPickedItemStatus( UndoRedoOpType aStatus, unsigned aIdx )
{
    if( aIdx < m_ItemsList.size() )
@@ -312,13 +255,8 @@ bool PICKED_ITEMS_LIST::SetPickedItemStatus( UndoRedoOpType aStatus, unsigned aI
    else
        return false;
}
/**
 * Function SetPickerFlags
 * Set the flags of the picker (usually to the picked item m_Flags value)
 * @param aFlags = the value to save in picker
 * @param aIdx = index of the picker in the picked list
 * @return true if the picker exists, or false if does not exist
 */


bool PICKED_ITEMS_LIST::SetPickerFlags( int aFlags, unsigned aIdx )
{
    if( aIdx < m_ItemsList.size() )
@@ -331,12 +269,6 @@ bool PICKED_ITEMS_LIST::SetPickerFlags( int aFlags, unsigned aIdx )
}


/**
 * Function RemovePicker
 * rem�ove one entry (one picker) from the list of picked items
 * @param aIdx = index of the picker in the picked list
 * @return true if ok, or false if did not exist
 */
bool PICKED_ITEMS_LIST::RemovePicker( unsigned aIdx )
{
    if( aIdx >= m_ItemsList.size() )
@@ -346,24 +278,12 @@ bool PICKED_ITEMS_LIST::RemovePicker( unsigned aIdx )
}


/**
 * Function CopyList
 * copy all data from aSource
 * Picked items are not copied. just pointers on them are copied
 */
void PICKED_ITEMS_LIST::CopyList( const PICKED_ITEMS_LIST& aSource )
{
    m_ItemsList = aSource.m_ItemsList;  // Vector's copy
}

/**
 * Function ReversePickersListOrder
 * reverses the order of pickers stored in this list
 * Useful when pop a list from Undo to Redo (and vice-versa)
 * because sometimes undo (or redo) a command needs to keep the
 * order of successive changes.
 * and obviously, undo and redo are in reverse order
 */

void PICKED_ITEMS_LIST::ReversePickersListOrder()
{
    std::vector <ITEM_PICKER> tmp;
+14 −18
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ extern void MoveItemsInList( PICKED_ITEMS_LIST& aItemsList, const wxPoint aMoveV
extern void RotateListOfItems( PICKED_ITEMS_LIST& aItemsList, wxPoint& Center );
extern void Mirror_X_ListOfItems( PICKED_ITEMS_LIST& aItemsList, wxPoint& aMirrorPoint );
extern void MirrorListOfItems( PICKED_ITEMS_LIST& aItemsList, wxPoint& Center );
extern void DeleteItemsInList( EDA_DRAW_PANEL* panel, PICKED_ITEMS_LIST& aItemsList );
extern void DuplicateItemsInList( SCH_SCREEN*        screen,
                                  PICKED_ITEMS_LIST& aItemsList,
                                  const wxPoint      aMoveVector );
@@ -522,22 +521,19 @@ void SCH_EDIT_FRAME::copyBlockItems( PICKED_ITEMS_LIST& aItemsList )
{
    m_blockItems.ClearListAndDeleteItems();   // delete previous saved list, if exists

    /* save the new list: */
    ITEM_PICKER item;
    for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
    {
        // Clear m_Flag member of selected items:
        aItemsList.GetPickedItem( ii )->ClearFlags();
        /* Make a copy of the original picked item. */
        SCH_ITEM* copy = DuplicateStruct( (SCH_ITEM*) aItemsList.GetPickedItem( ii ) );
        copy->SetParent( NULL );

        // In list the wrapper is owner of the schematic item, we can use the UR_DELETED
        // status for the picker because pickers with this status are owner of the picked item
        // (or TODO ?: create a new status like UR_DUPLICATE)
    item.m_UndoRedoStatus = UR_DELETED;
        ITEM_PICKER item( copy, UR_DELETED );

    for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
    {
        // Clear m_Flag member of selected items:
        aItemsList.GetPickedItem( ii )->m_Flags = 0;
        /* Make a copy of the original picked item. */
        SCH_ITEM* DrawStructCopy = DuplicateStruct( (SCH_ITEM*) aItemsList.GetPickedItem( ii ) );
        DrawStructCopy->SetParent( NULL );
        item.m_PickedItem = DrawStructCopy;
        m_blockItems.PushItem( item );
    }
}
@@ -559,13 +555,12 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC )

    PICKED_ITEMS_LIST picklist;

    // Creates data, and push it as new data in undo item list buffer
    ITEM_PICKER       picker( NULL, UR_NEW );

    for( unsigned ii = 0; ii < m_blockItems.GetCount(); ii++ )
    {
        Struct = DuplicateStruct( (SCH_ITEM*) m_blockItems.m_ItemsSelection.GetPickedItem( ii ) );
        picker.m_PickedItem = Struct;

        // Creates data, and push it as new data in undo item list buffer
        ITEM_PICKER picker( Struct, UR_NEW );
        picklist.PushItem( picker );

        // Clear annotation and init new time stamp for the new components:
@@ -574,6 +569,7 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC )
            ( (SCH_COMPONENT*) Struct )->m_TimeStamp = GetTimeStamp();
            ( (SCH_COMPONENT*) Struct )->ClearAnnotation( NULL );
        }

        SetSchItemParent( Struct, GetScreen() );
        Struct->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
        Struct->SetNext( GetScreen()->GetDrawItems() );
@@ -584,7 +580,7 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC )

    MoveItemsInList( picklist, GetScreen()->m_BlockLocate.m_MoveVector );

    /* clear .m_Flags member for all items */
    // Clear flags for all items.
    GetScreen()->ClearDrawingState();

    OnModify();
+22 −53
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@

static void AbortCreateNewLine( EDA_DRAW_PANEL* Panel, wxDC* DC );
static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer );
static bool IsJunctionNeeded( SCH_EDIT_FRAME* frame, wxPoint& pos );
static void ComputeBreakPoint( SCH_LINE* segment, const wxPoint& new_pos );

SCH_ITEM* s_OldWiresList;
@@ -92,7 +91,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
    SCH_LINE* oldsegment, * newsegment, * nextsegment;
    wxPoint   cursorpos = GetScreen()->GetCrossHairPosition();

    if( GetScreen()->GetCurItem() && (GetScreen()->GetCurItem()->m_Flags == 0) )
    if( GetScreen()->GetCurItem() && (GetScreen()->GetCurItem()->GetFlags() == 0) )
        GetScreen()->SetCurItem( NULL );

    if( GetScreen()->GetCurItem() )
@@ -134,12 +133,12 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
            break;
        }

        newsegment->m_Flags = IS_NEW;
        newsegment->SetFlags( IS_NEW );

        if( g_HVLines ) // We need 2 segments to go from a given start pin to an end point
        {
            nextsegment = new SCH_LINE( *newsegment );
            nextsegment->m_Flags = IS_NEW;
            nextsegment->SetFlags( IS_NEW );
            newsegment->SetNext( nextsegment );
            nextsegment->SetBack( newsegment );
        }
@@ -199,8 +198,9 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
        }

        newsegment->m_End   = cursorpos;
        oldsegment->m_Flags = SELECTED;
        newsegment->m_Flags = IS_NEW;
        oldsegment->ClearFlags( IS_NEW );
        oldsegment->SetFlags( SELECTED );
        newsegment->SetFlags( IS_NEW );
        GetScreen()->SetCurItem( newsegment );
        DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, false );

@@ -210,7 +210,7 @@ void SCH_EDIT_FRAME::BeginSegment( wxDC* DC, int type )
         * (tested when the connection will be finished)*/
        if( oldsegment->m_Start == s_ConnexionStartPoint )
        {
            if( IsJunctionNeeded( this, s_ConnexionStartPoint ) )
            if( GetScreen()->IsJunctionNeeded( s_ConnexionStartPoint ) )
                AddJunction( DC, s_ConnexionStartPoint );
        }
    }
@@ -291,28 +291,28 @@ void SCH_EDIT_FRAME::EndSegment( wxDC* DC )

    while( segment )
    {
        if( segment->m_Flags )
        if( segment->GetFlags() )
        {
            if( !m_itemToRepeat )
                m_itemToRepeat = segment;
        }

        segment->m_Flags = 0;
        segment->ClearFlags();
        segment = segment->Next();
    }

    // Automatic place of a junction on the end point, if needed
    if( lastsegment )
    {
        if( IsJunctionNeeded( this, end_point ) )
        if( GetScreen()->IsJunctionNeeded( end_point ) )
            AddJunction( DC, end_point );
        else if( IsJunctionNeeded( this, alt_end_point ) )
        else if( GetScreen()->IsJunctionNeeded( alt_end_point ) )
            AddJunction( DC, alt_end_point );
    }

    /* Automatic place of a junction on the start point if necessary because
     * the cleanup can suppress intermediate points by merging wire segments */
    if( IsJunctionNeeded( this, s_ConnexionStartPoint ) )
    if( GetScreen()->IsJunctionNeeded( s_ConnexionStartPoint ) )
        AddJunction( DC, s_ConnexionStartPoint );

    GetScreen()->TestDanglingEnds( DrawPanel, DC );
@@ -500,14 +500,8 @@ static void AbortCreateNewLine( EDA_DRAW_PANEL* Panel, wxDC* DC )
        parent->SetRepeatItem( NULL );
    }

    /* Clear m_Flags which is used in edit functions: */
    SCH_ITEM* item = screen->GetDrawItems();

    while( item )
    {
        item->m_Flags = 0;
        item = item->Next();
    }
    // Clear flags used in edit functions.
    screen->ClearDrawingState();
}


@@ -526,7 +520,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
    {
        wxPoint pos = GetScreen()->GetCrossHairPosition() -
            ( (SCH_COMPONENT*) m_itemToRepeat )->m_Pos;
        m_itemToRepeat->m_Flags = IS_NEW;
        m_itemToRepeat->SetFlags( IS_NEW );
        ( (SCH_COMPONENT*) m_itemToRepeat )->m_TimeStamp = GetTimeStamp();
        m_itemToRepeat->Move( pos );
        m_itemToRepeat->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
@@ -546,7 +540,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
        GetScreen()->TestDanglingEnds();
        m_itemToRepeat->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_DEFAULT_DRAWMODE );
        SaveCopyInUndoList( m_itemToRepeat, UR_NEW );
        m_itemToRepeat->m_Flags = 0;
        m_itemToRepeat->ClearFlags();
    }
}

@@ -601,7 +595,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
    switch( layer )
    {
    case LAYER_BUS:
        item = PickStruct( pos, screen, BUS_T );
        item = screen->GetItem( pos, 0, BUS_T );

        if( item )
            return true;
@@ -618,13 +612,14 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
        break;

    case LAYER_NOTES:
        item = PickStruct( pos, screen, DRAW_ITEM_T );
        item = screen->GetItem( pos, 0, DRAW_ITEM_T );
        if( item )
            return true;
        break;

    case LAYER_WIRE:
        item = PickStruct( pos, screen, BUS_ENTRY_T | JUNCTION_T );
        item = screen->GetItem( pos, MAX( g_DrawDefaultLineThickness, 3 ),
                                BUS_ENTRY_T | JUNCTION_T );

        if( item )
            return true;
@@ -643,12 +638,12 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
                return true;
        }

        item = PickStruct( pos, screen, WIRE_T );
        item = screen->GetItem( pos, 0, WIRE_T );

        if( item )
            return true;

        item = PickStruct( pos, screen, LABEL_T );
        item = screen->GetItem( pos, 0, LABEL_T );
        if( item && (item->Type() != SCH_TEXT_T)
           && ( ( (SCH_GLOBALLABEL*) item )->m_Pos.x == pos.x )
           && ( ( (SCH_GLOBALLABEL*) item )->m_Pos.y == pos.y ) )
@@ -672,29 +667,3 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )

    return false;
}


/* Return True when a wire is located at pos "pos" if
 *  - there is no junction.
 *  - The wire has no ends at pos "pos",
 *      and therefore it is considered as no connected.
 *  - One (or more) wire has one end at pos "pos"
 *  or
 *  - a pin is on location pos
 */
bool IsJunctionNeeded( SCH_EDIT_FRAME* frame, wxPoint& pos )
{
    if( PickStruct( pos, frame->GetScreen(), JUNCTION_T ) )
        return false;

    if( PickStruct( pos, frame->GetScreen(), WIRE_T | EXCLUDE_ENDPOINTS_T ) )
    {
        if( PickStruct( pos, frame->GetScreen(), WIRE_T | ENDPOINTS_ONLY_T ) )
            return true;

        if( frame->GetScreen()->GetPin( pos, NULL, true ) )
            return true;
    }

    return false;
}
+17 −13
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateItem( const wxPoint& aPosition, bool aIncludePin
    wxString       Text;
    wxString       msg;

    item = (SCH_ITEM*) PickStruct( aPosition, GetScreen(), MARKER_T );
    item = GetScreen()->GetItem( aPosition, 0, MARKER_T );

    if( item )
    {
@@ -128,7 +128,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateItem( const wxPoint& aPosition, bool aIncludePin
        return item;
    }

    item = (SCH_ITEM*) PickStruct( aPosition, GetScreen(), NO_CONNECT_T );
    item = GetScreen()->GetItem( aPosition, 0, NO_CONNECT_T );

    if( item )
    {
@@ -136,7 +136,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateItem( const wxPoint& aPosition, bool aIncludePin
        return item;
    }

    item = (SCH_ITEM*) PickStruct( aPosition, GetScreen(), JUNCTION_T );
    item = GetScreen()->GetItem( aPosition, 0, JUNCTION_T );

    if( item )
    {
@@ -144,7 +144,8 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateItem( const wxPoint& aPosition, bool aIncludePin
        return item;
    }

    item = (SCH_ITEM*) PickStruct( aPosition, GetScreen(), WIRE_T | BUS_T | BUS_ENTRY_T );
    item = GetScreen()->GetItem( aPosition, MAX( g_DrawDefaultLineThickness, 3 ),
                                 WIRE_T | BUS_T | BUS_ENTRY_T );

    if( item )  // We have found a wire: Search for a connected pin at the same location
    {
@@ -164,17 +165,20 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateItem( const wxPoint& aPosition, bool aIncludePin
        return item;
    }

    item = (SCH_ITEM*) PickStruct( aPosition, GetScreen(), DRAW_ITEM_T );
    item = GetScreen()->GetItem( aPosition, 0, DRAW_ITEM_T );

    if( item )
    {
        ClearMsgPanel();
        return item;
    }

    item = (SCH_ITEM*) PickStruct( aPosition, GetScreen(), FIELD_T );
    item = GetScreen()->GetItem( aPosition, 0, FIELD_T );

    if( item )
    {
        wxASSERT( item->Type() == SCH_FIELD_T );

        SCH_FIELD* Field = (SCH_FIELD*) item;
        LibItem = (SCH_COMPONENT*) Field->GetParent();
        LibItem->DisplayInfo( this );
@@ -182,7 +186,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateItem( const wxPoint& aPosition, bool aIncludePin
        return item;
    }

    item = (SCH_ITEM*) PickStruct( aPosition, GetScreen(), LABEL_T | TEXT_T );
    item = GetScreen()->GetItem( aPosition, 0, LABEL_T | TEXT_T );

    if( item )
    {
@@ -204,7 +208,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateItem( const wxPoint& aPosition, bool aIncludePin
            return LibItem;
    }

    item = (SCH_ITEM*) PickStruct( aPosition, GetScreen(), COMPONENT_T );
    item = GetScreen()->GetItem( aPosition, 0, COMPONENT_T );

    if( item )
    {
@@ -214,7 +218,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateItem( const wxPoint& aPosition, bool aIncludePin
        return item;
    }

    item = (SCH_ITEM*) PickStruct( aPosition, GetScreen(), SHEET_T );
    item = GetScreen()->GetItem( aPosition, 0, SHEET_T );

    if( item )
    {
@@ -222,7 +226,7 @@ SCH_ITEM* SCH_EDIT_FRAME::LocateItem( const wxPoint& aPosition, bool aIncludePin
        return item;
    }

    item = (SCH_ITEM*) PickStruct( aPosition, GetScreen(), NO_FILTER_T );
    item = GetScreen()->GetItem( aPosition );

    if( item )
        return item;
@@ -295,7 +299,7 @@ void SCH_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH

    if( aHotKey )
    {
        if( screen->GetCurItem() && screen->GetCurItem()->m_Flags )
        if( screen->GetCurItem() && screen->GetCurItem()->GetFlags() )
            OnHotKey( aDC, aHotKey, aPosition, screen->GetCurItem() );
        else
            OnHotKey( aDC, aHotKey, aPosition, NULL );
@@ -368,7 +372,7 @@ void LIB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH

    if( aHotKey )
    {
        if( screen->GetCurItem() && screen->GetCurItem()->m_Flags )
        if( screen->GetCurItem() && screen->GetCurItem()->GetFlags() )
            OnHotKey( aDC, aHotKey, aPosition, screen->GetCurItem() );
        else
            OnHotKey( aDC, aHotKey, aPosition, NULL );
@@ -441,7 +445,7 @@ void LIB_VIEW_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH

    if( aHotKey )
    {
        if( screen->GetCurItem() && screen->GetCurItem()->m_Flags )
        if( screen->GetCurItem() && screen->GetCurItem()->GetFlags() )
            OnHotKey( aDC, aHotKey, aPosition, screen->GetCurItem() );
        else
            OnHotKey( aDC, aHotKey, aPosition, NULL );
Loading