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

Fix schematic library pin editing bug. Fixes lp:809506

* Change edit pin per part flag to only have effect when editing
  component with multiple parts or alternate body styles.
* Move global edit pin pert part variable into library editor frame
  object.
* Note that this only fixes the bug when the component does not have
  multiple parts or alternate body styles.
parent 858636fd
Loading
Loading
Loading
Loading
+46 −4
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-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 block_libedit.cpp
 * @file block_libedit.cpp
 */
 */
@@ -99,7 +124,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
        if ( m_component )
        if ( m_component )
            ItemCount = m_component->SelectItems( GetScreen()->m_BlockLocate,
            ItemCount = m_component->SelectItems( GetScreen()->m_BlockLocate,
                                                  m_unit, m_convert,
                                                  m_unit, m_convert,
                                                  g_EditPinByPinIsOn );
                                                  m_editPinsPerPartOrConvert );
        if( ItemCount )
        if( ItemCount )
        {
        {
            nextCmd = true;
            nextCmd = true;
@@ -126,9 +151,10 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
        if ( m_component )
        if ( m_component )
            ItemCount = m_component->SelectItems( GetScreen()->m_BlockLocate,
            ItemCount = m_component->SelectItems( GetScreen()->m_BlockLocate,
                                                  m_unit, m_convert,
                                                  m_unit, m_convert,
                                                  g_EditPinByPinIsOn );
                                                  m_editPinsPerPartOrConvert );
        if( ItemCount )
        if( ItemCount )
            SaveCopyInUndoList( m_component );
            SaveCopyInUndoList( m_component );

        if ( m_component )
        if ( m_component )
        {
        {
            m_component->DeleteSelectedItems();
            m_component->DeleteSelectedItems();
@@ -148,15 +174,18 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
        if ( m_component )
        if ( m_component )
            ItemCount = m_component->SelectItems( GetScreen()->m_BlockLocate,
            ItemCount = m_component->SelectItems( GetScreen()->m_BlockLocate,
                                                  m_unit, m_convert,
                                                  m_unit, m_convert,
                                                  g_EditPinByPinIsOn );
                                                  m_editPinsPerPartOrConvert );
        if( ItemCount )
        if( ItemCount )
            SaveCopyInUndoList( m_component );
            SaveCopyInUndoList( m_component );

        pt = GetScreen()->m_BlockLocate.Centre();
        pt = GetScreen()->m_BlockLocate.Centre();
        pt.y *= -1;
        pt.y *= -1;

        if ( m_component )
        if ( m_component )
        {
        {
            OnModify();
            OnModify();
            int block_cmd = GetScreen()->m_BlockLocate.m_Command;
            int block_cmd = GetScreen()->m_BlockLocate.m_Command;

            if( block_cmd == BLOCK_MIRROR_Y)
            if( block_cmd == BLOCK_MIRROR_Y)
                m_component->MirrorSelectedItemsH( pt );
                m_component->MirrorSelectedItemsH( pt );
            else if( block_cmd == BLOCK_MIRROR_X)
            else if( block_cmd == BLOCK_MIRROR_X)
@@ -164,6 +193,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
            else if( block_cmd == BLOCK_ROTATE)
            else if( block_cmd == BLOCK_ROTATE)
                m_component->RotateSelectedItems( pt );
                m_component->RotateSelectedItems( pt );
        }
        }

        break;
        break;


    case BLOCK_ZOOM:     /* Window Zoom */
    case BLOCK_ZOOM:     /* Window Zoom */
@@ -221,23 +251,31 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
    case BLOCK_MOVE:                /* Move */
    case BLOCK_MOVE:                /* Move */
    case BLOCK_PRESELECT_MOVE:      /* Move with preselection list*/
    case BLOCK_PRESELECT_MOVE:      /* Move with preselection list*/
        GetScreen()->m_BlockLocate.ClearItemsList();
        GetScreen()->m_BlockLocate.ClearItemsList();

        if ( m_component )
        if ( m_component )
            SaveCopyInUndoList( m_component );
            SaveCopyInUndoList( m_component );

        pt = GetScreen()->m_BlockLocate.m_MoveVector;
        pt = GetScreen()->m_BlockLocate.m_MoveVector;
        pt.y *= -1;
        pt.y *= -1;

        if ( m_component )
        if ( m_component )
            m_component->MoveSelectedItems( pt );
            m_component->MoveSelectedItems( pt );

        DrawPanel->Refresh( true );
        DrawPanel->Refresh( true );
        break;
        break;


    case BLOCK_COPY:     /* Copy */
    case BLOCK_COPY:     /* Copy */
        GetScreen()->m_BlockLocate.ClearItemsList();
        GetScreen()->m_BlockLocate.ClearItemsList();

        if ( m_component )
        if ( m_component )
            SaveCopyInUndoList( m_component );
            SaveCopyInUndoList( m_component );

        pt = GetScreen()->m_BlockLocate.m_MoveVector;
        pt = GetScreen()->m_BlockLocate.m_MoveVector;
        pt.y *= -1;
        pt.y *= -1;

        if ( m_component )
        if ( m_component )
            m_component->CopySelectedItems( pt );
            m_component->CopySelectedItems( pt );

        break;
        break;


    case BLOCK_PASTE:     /* Paste (recopy the last block saved) */
    case BLOCK_PASTE:     /* Paste (recopy the last block saved) */
@@ -249,11 +287,14 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
    case BLOCK_MIRROR_Y:    // Invert by popup menu, from block move
    case BLOCK_MIRROR_Y:    // Invert by popup menu, from block move
        if ( m_component )
        if ( m_component )
            SaveCopyInUndoList( m_component );
            SaveCopyInUndoList( m_component );

        pt = GetScreen()->m_BlockLocate.Centre();
        pt = GetScreen()->m_BlockLocate.Centre();
        pt.y *= -1;
        pt.y *= -1;

        if ( m_component )
        if ( m_component )
        {
        {
            int block_cmd = GetScreen()->m_BlockLocate.m_Command;
            int block_cmd = GetScreen()->m_BlockLocate.m_Command;

            if( block_cmd == BLOCK_MIRROR_Y)
            if( block_cmd == BLOCK_MIRROR_Y)
                m_component->MirrorSelectedItemsH( pt );
                m_component->MirrorSelectedItemsH( pt );
            else if( block_cmd == BLOCK_MIRROR_X)
            else if( block_cmd == BLOCK_MIRROR_X)
@@ -261,6 +302,7 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
            else if( block_cmd == BLOCK_ROTATE )
            else if( block_cmd == BLOCK_ROTATE )
                m_component->RotateSelectedItems( pt );
                m_component->RotateSelectedItems( pt );
        }
        }

        break;
        break;


    case BLOCK_ZOOM:        // Handled by HandleBlockEnd
    case BLOCK_ZOOM:        // Handled by HandleBlockEnd
+25 −4
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-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.cpp
 * @file eeschema.cpp
 */
 */
@@ -46,10 +71,6 @@ const wxString CompLibFileWildcard( wxT( "KiCad component library file (*.lib)|*


LayerStruct g_LayerDescr;            /* layer colors. */
LayerStruct g_LayerDescr;            /* layer colors. */


bool        g_EditPinByPinIsOn = false; /* true to do not synchronize pins
                                         * edition  when they are at the
                                         * same location */

int         g_DrawDefaultLineThickness = 6; /* Default line thickness in
int         g_DrawDefaultLineThickness = 6; /* Default line thickness in
                                             * Eeschema units used to
                                             * Eeschema units used to
                                             * draw/plot items having a
                                             * draw/plot items having a
+27 −4
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-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 libedit.cpp
 * @file libedit.cpp
 * @brief Eeschema component library editor.
 * @brief Eeschema component library editor.
@@ -74,8 +99,7 @@ bool LIB_EDIT_FRAME::LoadComponentFromCurrentLib( LIB_ALIAS* aLibEntry )
    if( !LoadOneLibraryPartAux( aLibEntry, m_library ) )
    if( !LoadOneLibraryPartAux( aLibEntry, m_library ) )
        return false;
        return false;


    g_EditPinByPinIsOn = m_component->UnitsLocked() ? true : false;
    m_editPinsPerPartOrConvert = m_component->UnitsLocked() ? true : false;
    m_HToolBar->ToggleTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, g_EditPinByPinIsOn );


    GetScreen()->ClearUndoRedoList();
    GetScreen()->ClearUndoRedoList();
    Zoom_Automatique( false );
    Zoom_Automatique( false );
@@ -539,8 +563,7 @@ lost!\n\nClear the current component from the screen?" ) ) )
    DisplayCmpDoc();
    DisplayCmpDoc();
    UpdateAliasSelectList();
    UpdateAliasSelectList();
    UpdatePartSelectList();
    UpdatePartSelectList();
    g_EditPinByPinIsOn = m_component->UnitsLocked() ? true : false;
    m_editPinsPerPartOrConvert = m_component->UnitsLocked() ? true : false;
    m_HToolBar->ToggleTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, g_EditPinByPinIsOn );
    m_lastDrawItem = NULL;
    m_lastDrawItem = NULL;
    GetScreen()->ClearUndoRedoList();
    GetScreen()->ClearUndoRedoList();
    OnModify();
    OnModify();
+54 −17
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-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 libeditframe.cpp
 * @file libeditframe.cpp
 * @brief LIB_EDIT_FRAME class is the component library editor frame.
 * @brief LIB_EDIT_FRAME class is the component library editor frame.
@@ -66,9 +91,6 @@ int LIB_EDIT_FRAME:: m_drawLineWidth = 0;
FILL_T LIB_EDIT_FRAME::        m_drawFillStyle   = NO_FILL;
FILL_T LIB_EDIT_FRAME::        m_drawFillStyle   = NO_FILL;




/************************/
/* class LIB_EDIT_FRAME */
/************************/
BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
    EVT_CLOSE( LIB_EDIT_FRAME::OnCloseWindow )
    EVT_CLOSE( LIB_EDIT_FRAME::OnCloseWindow )
    EVT_SIZE( LIB_EDIT_FRAME::OnSize )
    EVT_SIZE( LIB_EDIT_FRAME::OnSize )
@@ -120,7 +142,7 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
    EVT_MENU( ID_COLORS_SETUP, LIB_EDIT_FRAME::Process_Config )
    EVT_MENU( ID_COLORS_SETUP, LIB_EDIT_FRAME::Process_Config )
    EVT_MENU( ID_LIBEDIT_DIMENSIONS, LIB_EDIT_FRAME::InstallDimensionsDialog )
    EVT_MENU( ID_LIBEDIT_DIMENSIONS, LIB_EDIT_FRAME::InstallDimensionsDialog )


    // Multple item selection context menu commands.
    // Multiple item selection context menu commands.
    EVT_MENU_RANGE( ID_SELECT_ITEM_START, ID_SELECT_ITEM_END, LIB_EDIT_FRAME::OnSelectItem )
    EVT_MENU_RANGE( ID_SELECT_ITEM_START, ID_SELECT_ITEM_END, LIB_EDIT_FRAME::OnSelectItem )


    EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END,
    EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END,
@@ -179,6 +201,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
    m_drawSpecificUnit    = false;
    m_drawSpecificUnit    = false;
    m_tempCopyComponent   = NULL;
    m_tempCopyComponent   = NULL;
    m_HotkeysZoomAndGridList = s_Libedit_Hokeys_Descr;
    m_HotkeysZoomAndGridList = s_Libedit_Hokeys_Descr;
    m_editPinsPerPartOrConvert = false;


    wxIcon icon;
    wxIcon icon;


@@ -192,7 +215,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,


    LoadSettings();
    LoadSettings();


    // Initilialize grid id to a default value if not found in config or bad:
    // Initialize grid id to a default value if not found in config or bad:
    if( (m_LastGridSizeId <= 0)
    if( (m_LastGridSizeId <= 0)
       || ( m_LastGridSizeId < (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000) ) )
       || ( m_LastGridSizeId < (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000) ) )
        m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
        m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
@@ -215,7 +238,6 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,


    m_auimgr.SetManagedWindow( this );
    m_auimgr.SetManagedWindow( this );



    EDA_PANEINFO horiz;
    EDA_PANEINFO horiz;
    horiz.HorizontalToolbarPane();
    horiz.HorizontalToolbarPane();


@@ -225,8 +247,6 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
    EDA_PANEINFO mesg;
    EDA_PANEINFO mesg;
    mesg.MessageToolbarPane();
    mesg.MessageToolbarPane();




    m_auimgr.AddPane( m_HToolBar,
    m_auimgr.AddPane( m_HToolBar,
                      wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Row( 0 ) );
                      wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Row( 0 ) );


@@ -310,8 +330,10 @@ void LIB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
            return;
            return;
        }
        }
        else
        else
        {
            GetScreen()->ClrModify();
            GetScreen()->ClrModify();
        }
        }
    }


    BOOST_FOREACH( const CMP_LIBRARY &lib, CMP_LIBRARY::GetLibraryList() )
    BOOST_FOREACH( const CMP_LIBRARY &lib, CMP_LIBRARY::GetLibraryList() )
    {
    {
@@ -351,8 +373,7 @@ double LIB_EDIT_FRAME::BestZoom()
        BoundaryBox = m_component->GetBoundingBox( m_unit, m_convert );
        BoundaryBox = m_component->GetBoundingBox( m_unit, m_convert );
        dx = BoundaryBox.GetWidth();
        dx = BoundaryBox.GetWidth();
        dy = BoundaryBox.GetHeight();
        dy = BoundaryBox.GetHeight();
        GetScreen()->SetScrollCenterPosition( wxPoint( 0, 0 )
        GetScreen()->SetScrollCenterPosition( wxPoint( 0, 0 ) );
        );
    }
    }
    else
    else
    {
    {
@@ -483,7 +504,7 @@ void LIB_EDIT_FRAME::OnUpdatePinByPin( wxUpdateUIEvent& event )
    event.Enable( ( m_component != NULL )
    event.Enable( ( m_component != NULL )
                 && ( ( m_component->GetPartCount() > 1 ) || m_showDeMorgan ) );
                 && ( ( m_component->GetPartCount() > 1 ) || m_showDeMorgan ) );


    event.Check( g_EditPinByPinIsOn );
    event.Check( m_editPinsPerPartOrConvert );
}
}




@@ -653,7 +674,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
        break;
        break;


    case ID_LIBEDIT_EDIT_PIN_BY_PIN:
    case ID_LIBEDIT_EDIT_PIN_BY_PIN:
        g_EditPinByPinIsOn = m_HToolBar->GetToolState( ID_LIBEDIT_EDIT_PIN_BY_PIN );
        m_editPinsPerPartOrConvert = m_HToolBar->GetToolState( ID_LIBEDIT_EDIT_PIN_BY_PIN );
        break;
        break;


    case ID_POPUP_LIBEDIT_END_CREATE_ITEM:
    case ID_POPUP_LIBEDIT_END_CREATE_ITEM:
@@ -848,6 +869,7 @@ void LIB_EDIT_FRAME::EnsureActiveLibExists()
        return;
        return;


    bool exists = CMP_LIBRARY::LibraryExists( m_library );
    bool exists = CMP_LIBRARY::LibraryExists( m_library );

    if( exists )
    if( exists )
        return;
        return;
    else
    else
@@ -936,8 +958,9 @@ void LIB_EDIT_FRAME::OnEditComponentProperties( wxCommandEvent& event )


    if( partLocked != GetComponent()->UnitsLocked() )
    if( partLocked != GetComponent()->UnitsLocked() )
    {
    {
        // g_EditPinByPinIsOn is set to the better value, if m_UnitSelectionLocked has changed
        // m_editPinsPerPartOrConvert is set to the better value, if m_UnitSelectionLocked
        g_EditPinByPinIsOn = GetComponent()->UnitsLocked() ? true : false;
        // has changed
        m_editPinsPerPartOrConvert = GetComponent()->UnitsLocked() ? true : false;
    }
    }


    UpdateAliasSelectList();
    UpdateAliasSelectList();
@@ -959,7 +982,7 @@ void LIB_EDIT_FRAME::InstallDimensionsDialog( wxCommandEvent& event )
void LIB_EDIT_FRAME::OnCreateNewPartFromExisting( wxCommandEvent& event )
void LIB_EDIT_FRAME::OnCreateNewPartFromExisting( wxCommandEvent& event )
{
{
    wxCHECK_RET( m_component != NULL,
    wxCHECK_RET( m_component != NULL,
                 wxT( "Cannot create new part from non-existant current part." ) );
                 wxT( "Cannot create new part from non-existent current part." ) );


    INSTALL_UNBUFFERED_DC( dc, DrawPanel );
    INSTALL_UNBUFFERED_DC( dc, DrawPanel );
    DrawPanel->CrossHairOff( &dc );
    DrawPanel->CrossHairOff( &dc );
@@ -1167,7 +1190,7 @@ void LIB_EDIT_FRAME::deleteItem( wxDC* aDC )


        m_component->RemoveDrawItem( (LIB_ITEM*) pin, DrawPanel, aDC );
        m_component->RemoveDrawItem( (LIB_ITEM*) pin, DrawPanel, aDC );


        if( g_EditPinByPinIsOn == false )
        if( SynchronizePins() )
        {
        {
            LIB_PIN* tmp = m_component->GetNextPin();
            LIB_PIN* tmp = m_component->GetNextPin();


@@ -1182,13 +1205,20 @@ void LIB_EDIT_FRAME::deleteItem( wxDC* aDC )
                m_component->RemoveDrawItem( (LIB_ITEM*) pin );
                m_component->RemoveDrawItem( (LIB_ITEM*) pin );
            }
            }
        }
        }

        DrawPanel->Refresh();
    }
    }
    else
    else
    {
    {
        if( DrawPanel->IsMouseCaptured() )
        if( DrawPanel->IsMouseCaptured() )
        {
            DrawPanel->m_endMouseCaptureCallback( DrawPanel, aDC );
            DrawPanel->m_endMouseCaptureCallback( DrawPanel, aDC );
        }
        else
        else
        {
            m_component->RemoveDrawItem( m_drawItem, DrawPanel, aDC );
            m_component->RemoveDrawItem( m_drawItem, DrawPanel, aDC );
            DrawPanel->Refresh();
        }
    }
    }


    m_drawItem = NULL;
    m_drawItem = NULL;
@@ -1211,3 +1241,10 @@ void LIB_EDIT_FRAME::OnSelectItem( wxCommandEvent& aEvent )
        m_drawItem = item;
        m_drawItem = item;
    }
    }
}
}


bool LIB_EDIT_FRAME::SynchronizePins() const
{
    return !m_editPinsPerPartOrConvert && ( m_component && ( m_component->HasConversion() ||
                                                             m_component->IsMulti()) );
}
+57 −2
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-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 libeditframe.h
 * @file libeditframe.h
 * @brief Definition of class LIB_EDIT_FRAME
 * @brief Definition of class LIB_EDIT_FRAME
@@ -62,6 +87,14 @@ public:
    void OnColorConfig( wxCommandEvent& aEvent );
    void OnColorConfig( wxCommandEvent& aEvent );
    void Process_Config( wxCommandEvent& event );
    void Process_Config( wxCommandEvent& event );


    /**
     * Function SycnronizePins
     * @return True if the edit pins per part or convert is false and the current
     *         component has multiple parts or body styles.  Otherwise false is
     *         returned.
     */
    bool SynchronizePins() const;

    /**
    /**
     * Function OnPlotCurrentComponent
     * Function OnPlotCurrentComponent
     * plot the current component in SVG or PNG format.
     * plot the current component in SVG or PNG format.
@@ -371,6 +404,19 @@ private:
    void CreatePin( wxDC* DC );
    void CreatePin( wxDC* DC );
    void StartMovePin( wxDC* DC );
    void StartMovePin( wxDC* DC );


    /**
     * Function CreateImagePins
     * adds copies of \a aPin for \a aUnit in components with multiple parts and
     * \a aConvert for components that have multiple body styles.
     *
     * @param aPin The pin to copy.
     * @param aUnit The unit to add a copy of \a aPin to.
     * @param aConvert The alternate body style to add a copy of \a aPin to.
     * @param aDeMorgan Flag to indicate if \a aPin should be created for the
     *                  alternate body style.
     */
    void CreateImagePins( LIB_PIN* aPin, int aUnit, int aConvert, bool aDeMorgan );

    /**
    /**
     * Function PlaceAnchor
     * Function PlaceAnchor
     * places an  anchor reference coordinate for the current component.
     * places an  anchor reference coordinate for the current component.
@@ -450,6 +496,15 @@ protected:
     */
     */
    bool m_drawSpecificUnit;
    bool m_drawSpecificUnit;


    /**
     * Set to true to not synchronize pins at the same position when editing
     * components with multiple parts or multiple body styles.  Setting this
     * to false allows editing each pin per part or body style individually.
     * This requires the user to open each part or body style to make changes
     * to the pin at the same location.
     */
    bool m_editPinsPerPartOrConvert;

    /** The current draw or edit graphic item fill style. */
    /** The current draw or edit graphic item fill style. */
    static FILL_T m_drawFillStyle;
    static FILL_T m_drawFillStyle;


@@ -493,7 +548,7 @@ protected:
     * Function CreatePNGorJPEGFile
     * Function CreatePNGorJPEGFile
     * creates an image (screenshot) of the current component in PNG or JPEG format.
     * creates an image (screenshot) of the current component in PNG or JPEG format.
     * @param aFileName = the full filename
     * @param aFileName = the full filename
     * @param aFmt_jpeg = true to use JPEG ffile format, false to use PNG file format
     * @param aFmt_jpeg = true to use JPEG file format, false to use PNG file format
     */
     */
    void CreatePNGorJPEGFile( const wxString& aFileName, bool aFmt_jpeg );
    void CreatePNGorJPEGFile( const wxString& aFileName, bool aFmt_jpeg );


Loading