Commit 4cdc2c50 authored by jean-pierre charras's avatar jean-pierre charras
Browse files

Eeschema: added pin names in search function. Fixed minor issues in search...

Eeschema: added pin names in search function. Fixed minor issues in search function. Known bug: "search next"  searches for pins in next component, not the next pin in the same component.
Pcbnew: fixed an old minor issue when moving the layer manager window (not fully fixed, but  wxAuiManager seems have minor bugs and lacks).
parents 91e26fe8 347f32cc
Loading
Loading
Loading
Loading
+66 −12
Original line number Diff line number Diff line
@@ -341,6 +341,45 @@ int SCH_SHEET::GetPenSize()
}


/** function GetSheetNamePosition
 * @return the position of the anchor of sheet name text
 */
wxPoint SCH_SHEET::GetSheetNamePosition()
{
    wxPoint  pos = m_Pos;
    if( IsVerticalOrientation() )
    {
        pos.x -= 8;
        pos.y += m_Size.y;
    }
    else
    {
        pos.y -= 8;
    }

    return pos;
}

/** function GetFileNamePosition
 * @return the position of the anchor of filename text
 */
wxPoint SCH_SHEET::GetFileNamePosition()
{
    wxPoint  pos = m_Pos;
    if( IsVerticalOrientation() )
    {
        pos.x += m_Size.x+4;
        pos.y += m_Size.y;
    }
    else
    {
        pos.y += m_Size.y + 4;
    }

    return pos;
}


/** Function Draw
 *  Draw the hierarchical sheet shape
 *  @param aPanel = the current DrawPanel
@@ -369,18 +408,15 @@ void SCH_SHEET::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,

    GRRect( &aPanel->m_ClipBox, aDC, pos.x, pos.y,
            pos.x + m_Size.x, pos.y + m_Size.y, LineWidth, color );

    pos_sheetname = GetSheetNamePosition() + aOffset;
    pos_filename = GetFileNamePosition() + aOffset;

    if( IsVerticalOrientation() )
    {
        pos_sheetname = wxPoint( pos.x-8, pos.y+m_Size.y );
        pos_filename = wxPoint( pos.x+m_Size.x+4, pos.y+m_Size.y );
        name_orientation = TEXT_ORIENT_VERT;
    }
    else
    {
        pos_sheetname = wxPoint( pos.x, pos.y - 8 );
        pos_filename = wxPoint( pos.x, pos.y + m_Size.y + 4 );
        name_orientation = TEXT_ORIENT_HORIZ;
    }

    /* Draw text : SheetName */
    if( aColor > 0 )
        txtcolor = aColor;
@@ -823,14 +859,32 @@ void SCH_SHEET::Resize( const wxSize& aSize )
}


bool SCH_SHEET::Matches( wxFindReplaceData& aSearchData )
/** Compare schematic sheet entry (filename and sheetname) against search string.
 * @param aSearchData - Criteria to search against.
 * @param aAuxData - a pointer on auxiliary data, not used here.
 * @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL.
 * @return True if this item matches the search criteria.
 */
bool SCH_SHEET::Matches( wxFindReplaceData& aSearchData,
                         void* aAuxData, wxPoint * aFindLocation )
{
    if( SCH_ITEM::Matches( m_FileName, aSearchData ) )
    {
    if( !SCH_ITEM::Matches( m_SheetName, aSearchData ) )
        return SCH_ITEM::Matches( m_FileName, aSearchData );
        if( aFindLocation )
            *aFindLocation = GetFileNamePosition();
        return true;
    }

    if( SCH_ITEM::Matches( m_SheetName, aSearchData ) )
    {
        if( aFindLocation )
            *aFindLocation = GetSheetNamePosition();
        return true;
    }

    return false;
}


void SCH_SHEET::renumberLabels()
{
+24 −4
Original line number Diff line number Diff line
@@ -158,13 +158,18 @@ public:
    virtual void Mirror_X( int aXaxis_position );


    /**
     * Compare schematic sheet entry (pin?) name against search string.
    /** function Matches
     * Compare hierarchical pin name against search string.
     *
     * @param aSearchData - Criteria to search against.
     * @param aAuxData - a pointer on auxiliary data, if needed.
     *        When searching string in REFERENCE field we must know the sheet path
     *          This param is used in this case
     * @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL.
     * @return True if this item matches the search criteria.
     */
    virtual bool Matches( wxFindReplaceData& aSearchData );
    virtual bool Matches( wxFindReplaceData& aSearchData,
                          void* aAuxData, wxPoint * aFindLocation );
};


@@ -425,10 +430,15 @@ public:
     * Compare schematic sheet file and sheet name against search string.
     *
     * @param aSearchData - Criteria to search against.
     * @param aAuxData - a pointer on auxiliary data, if needed.
     *        When searching string in REFERENCE field we must know the sheet path
     *          This param is used in this case
     * @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL.
     *
     * @return True if this item matches the search criteria.
     */
    virtual bool Matches( wxFindReplaceData& aSearchData );
    virtual bool Matches( wxFindReplaceData& aSearchData,
                          void* aAuxData, wxPoint * aFindLocation );

    /**
     * Resize this sheet to aSize and adjust all of the labels accordingly.
@@ -437,6 +447,16 @@ public:
     */
    void         Resize( const wxSize& aSize );

    /** function GetSheetNamePosition
     * @return the position of the anchor of sheet name text
     */
    wxPoint GetSheetNamePosition ();

    /** function GetFileNamePosition
     * @return the position of the anchor of filename text
     */
    wxPoint GetFileNamePosition ();

#if defined(DEBUG)

    // comment inherited by Doxygen from Base_Struct
+6 −4
Original line number Diff line number Diff line
@@ -320,7 +320,8 @@ SCH_ITEM* SCH_SHEET_PATH::FindPreviousItem( KICAD_T aType, SCH_ITEM* aLastItem,


SCH_ITEM* SCH_SHEET_PATH::MatchNextItem( wxFindReplaceData& aSearchData,
                                         SCH_ITEM*          aLastItem )
                                         SCH_ITEM*          aLastItem,
                                         wxPoint * aFindLocation )
{
    bool hasWrapped = false;
    bool firstItemFound = false;
@@ -335,7 +336,7 @@ SCH_ITEM* SCH_SHEET_PATH::MatchNextItem( wxFindReplaceData& aSearchData,
        }
        else
        {
            if( drawItem->Matches( aSearchData, this ) )
            if( drawItem->Matches( aSearchData, this, aFindLocation ) )
                return drawItem;
        }

@@ -618,7 +619,8 @@ SCH_ITEM* SCH_SHEET_LIST::FindPreviousItem( KICAD_T aType, SCH_SHEET_PATH** aShe

SCH_ITEM* SCH_SHEET_LIST::MatchNextItem( wxFindReplaceData& aSearchData,
                                         SCH_SHEET_PATH**   aSheetFoundIn,
                                         SCH_ITEM*          aLastItem )
                                         SCH_ITEM*          aLastItem,
                                         wxPoint * aFindLocation )
{
    bool hasWrapped = false;
    bool firstItemFound = false;
@@ -638,7 +640,7 @@ SCH_ITEM* SCH_SHEET_LIST::MatchNextItem( wxFindReplaceData& aSearchData,
            }
            else
            {
                if( drawItem->Matches( aSearchData, sheet ) )
                if( drawItem->Matches( aSearchData, sheet, aFindLocation ) )
                {
                    if( aSheetFoundIn )
                        *aSheetFoundIn = sheet;
+7 −3
Original line number Diff line number Diff line
@@ -202,9 +202,11 @@ public:
     *
     * @param aSearchData - Criteria to search item against.
     * @param aLastItem - Find next item after aLastItem if not NULL.
     * @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL.
     * @return If found, Returns the next schematic item.  Otherwise, returns NULL.
     */
    SCH_ITEM* MatchNextItem( wxFindReplaceData& aSearchData, SCH_ITEM* aLastItem = NULL );
    SCH_ITEM* MatchNextItem( wxFindReplaceData& aSearchData, SCH_ITEM* aLastItem,
                             wxPoint * aFindLocation  );

    bool operator=( const SCH_SHEET_PATH& d1 );

@@ -338,11 +340,13 @@ public:
     * @param aSheetFound - The sheet the item was found in.  NULL if the next item
     *                      is not found.
     * @param aLastItem - Find next item after aLastItem if not NULL.
     * @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL.
     * @return If found, Returns the next schematic item.  Otherwise, returns NULL.
     */
    SCH_ITEM* MatchNextItem( wxFindReplaceData& aSearchData,
                             SCH_SHEET_PATH**   aSheetFound = NULL,
                             SCH_ITEM*          aLastItem = NULL );
                             SCH_SHEET_PATH**   aSheetFound,
                             SCH_ITEM*          aLastItem,
                             wxPoint * aFindLocation );

private:

+17 −2
Original line number Diff line number Diff line
@@ -259,9 +259,24 @@ bool SCH_SHEET_PIN::Save( FILE* aFile ) const
}


bool SCH_SHEET_PIN::Matches( wxFindReplaceData& aSearchData )
/** function Matches
 * Compare hierarchical pin name against search string.
 * @param aSearchData - Criteria to search against.
 * @param aAuxData - a pointer on auxiliary data, not used here
 * @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL.
 * @return True if this item matches the search criteria.
 */
bool SCH_SHEET_PIN::Matches( wxFindReplaceData& aSearchData,
                             void* aAuxData, wxPoint * aFindLocation )
{
    if( SCH_ITEM::Matches( m_Text, aSearchData ) )
    {
    return SCH_ITEM::Matches( m_Text, aSearchData );
        if( aFindLocation )
            *aFindLocation = m_Pos;
        return true;
    }

    return false;
}


Loading