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

Eeschema: fix Bug #1095005

parent aaf6cce6
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -398,7 +398,7 @@ public:
     *
     *
     * @return True if the item is being edited.
     * @return True if the item is being edited.
     */
     */
    bool InEditMode() const { return ( m_Flags & ( IS_NEW | IS_MOVED | IS_RESIZED ) ) != 0; }
    bool InEditMode() const { return ( m_Flags & ( IS_NEW | IS_DRAGGED | IS_MOVED | IS_RESIZED ) ) != 0; }


    void SetEraseLastDrawItem( bool aErase = true ) { m_eraseLastDrawItem = aErase; }
    void SetEraseLastDrawItem( bool aErase = true ) { m_eraseLastDrawItem = aErase; }


+3 −3
Original line number Original line Diff line number Diff line
/*
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 * 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) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
 * Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
 * Copyright (C) 2004-2013 KiCad Developers, see change_log.txt for contributors.
 *
 *
 * This program is free software; you can redistribute it and/or
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * modify it under the terms of the GNU General Public License
+9 −11
Original line number Original line Diff line number Diff line
/*
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 *
 * Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
 * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
 * Copyright (C) 2010 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
 * Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
 *
 *
 * This program is free software; you can redistribute it and/or
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * modify it under the terms of the GNU General Public License
@@ -40,7 +40,10 @@
void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
{
{
    LIB_ITEM* item = m_drawItem;
    LIB_ITEM* item = m_drawItem;
    bool no_item_edited = item == NULL || item->GetFlags() == 0;
    bool item_in_edit = false;
    if( item )
        item_in_edit = item->IsNew() || item->IsMoving() || item->IsDragging();
    bool no_item_edited = !item_in_edit;


    if( m_component == NULL )   // No component loaded !
    if( m_component == NULL )   // No component loaded !
        return;
        return;
@@ -63,7 +66,8 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
    switch( GetToolId() )
    switch( GetToolId() )
    {
    {
    case ID_NO_TOOL_SELECTED:
    case ID_NO_TOOL_SELECTED:
        if( item && item->GetFlags() )   // moved object
        // If an item is currently in edit, finish edit
        if( item_in_edit )
        {
        {
            switch( item->Type() )
            switch( item->Type() )
            {
            {
@@ -80,13 +84,9 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )


    case ID_LIBEDIT_PIN_BUTT:
    case ID_LIBEDIT_PIN_BUTT:
        if( no_item_edited )
        if( no_item_edited )
        {
            CreatePin( DC );
            CreatePin( DC );
        }
        else
        else
        {
            PlacePin( DC );
            PlacePin( DC );
        }
        break;
        break;


    case ID_LIBEDIT_BODY_LINE_BUTT:
    case ID_LIBEDIT_BODY_LINE_BUTT:
@@ -95,9 +95,7 @@ void LIB_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& aPosition )
    case ID_LIBEDIT_BODY_RECT_BUTT:
    case ID_LIBEDIT_BODY_RECT_BUTT:
    case ID_LIBEDIT_BODY_TEXT_BUTT:
    case ID_LIBEDIT_BODY_TEXT_BUTT:
        if( no_item_edited )
        if( no_item_edited )
        {
            m_drawItem = CreateGraphicItem( m_component, DC );
            m_drawItem = CreateGraphicItem( m_component, DC );
        }
        else if( m_drawItem )
        else if( m_drawItem )
        {
        {
            if( m_drawItem->IsNew() )
            if( m_drawItem->IsNew() )
+23 −2
Original line number Original line Diff line number Diff line
/**
/**
 *  @file libedit_onrightclick.cpp
 *  @file libedit_onrightclick.cpp
 *  @brief Library editor: create the pop menus when clicking on mouse right button
 */
 */


/* , In library editor, create the pop menu when clicking on mouse right button
/*
 * This program source code file is part of KiCad, a free EDA CAD application.
 *
 * Copyright (C) 2004-2013 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
 */
 */


#include <fctsys.h>
#include <fctsys.h>
@@ -247,7 +268,7 @@ bool LIB_EDIT_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* PopMenu )
    return true;
    return true;
}
}



// Add menu items for pin edition
void AddMenusForPin( wxMenu* PopMenu, LIB_PIN* Pin, LIB_EDIT_FRAME* frame )
void AddMenusForPin( wxMenu* PopMenu, LIB_PIN* Pin, LIB_EDIT_FRAME* frame )
{
{
    bool selected    = Pin->IsSelected();
    bool selected    = Pin->IsSelected();
+5 −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.
 * 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) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
 * Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
 * Copyright (C) 2004-2013 KiCad Developers, see change_log.txt for contributors.
 *
 *
 * This program is free software; you can redistribute it and/or
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * modify it under the terms of the GNU General Public License
@@ -804,8 +804,9 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
            break;
            break;


        SaveCopyInUndoList( m_component );
        SaveCopyInUndoList( m_component );
        GlobalSetPins( &dc, (LIB_PIN*) m_drawItem, id );
        GlobalSetPins( (LIB_PIN*) m_drawItem, id );
        m_canvas->MoveCursorToCrossHair();
        m_canvas->MoveCursorToCrossHair();
        m_canvas->Refresh();
        break;
        break;


    case ID_POPUP_ZOOM_BLOCK:
    case ID_POPUP_ZOOM_BLOCK:
Loading