Commit a93fd711 authored by dickelbeck's avatar dickelbeck
Browse files

more pcbnew's onrightclick behavior

parent b8ae79ed
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -205,13 +205,27 @@ void WinEDA_BasePcbFrame::SetCurItem( BOARD_ITEM* aItem )
/*****************************************************************/
{
    m_CurrentScreen->SetCurItem( aItem );
    
    if( aItem )
    {
        aItem->Display_Infos( this );
        
#if defined(DEBUG)
    aItem->Show( 0, std::cout );
#endif
        
    }
    else
    {
        // we can use either of these:
        // we can use either of these two:
        
        //MsgPanel->EraseMsgBox();
        m_Pcb->Display_Infos( this );
        m_Pcb->Display_Infos( this );       // show the BOARD stuff
        
#if defined(DEBUG)
        std::cout << "SetCurItem(NULL)\n";
#endif

    }
}

+7 −4
Original line number Diff line number Diff line
@@ -37,28 +37,30 @@ static void Exit_Editrack( WinEDA_DrawPanel* Panel, wxDC* DC )
 */
{
    WinEDA_PcbFrame* frame = (WinEDA_PcbFrame*) Panel->m_Parent;
    TRACK*           track = (TRACK*) frame->GetScreen()->GetCurItem();
    TRACK*           track = (TRACK*) frame->GetCurItem();

    if( track != NULL )
    if( track && ( track->Type()==TYPEVIA || track->Type()==TYPETRACK ) )
    {
        /* Erase the current drawing */
        ShowNewTrackWhenMovingCursor( Panel, DC, FALSE );
        if( g_HightLigt_Status )
            frame->Hight_Light( DC );
        
        g_HightLigth_NetCode = OldNetCodeSurbrillance;
        if( OldEtatSurbrillance )
            frame->Hight_Light( DC );

        frame->MsgPanel->EraseMsgBox();
        TRACK* previoustrack;

        // Delete current (new) track
        for(  ; track != NULL; track = previoustrack )
        TRACK* previoustrack;
        for(  ;   track;   track = previoustrack )
        {
            previoustrack = (TRACK*) track->Pback;
            delete track;
        }
    }
    
    Panel->ManageCurseur = NULL;
    Panel->ForceCloseManageCurseur = NULL;
    frame->SetCurItem( NULL );
@@ -273,6 +275,7 @@ int Add_45_degrees_Segment( WinEDA_BasePcbFrame* frame, wxDC* DC, TRACK* pt_segm
    // les segments doivent etre de longueur suffisante:
    if( MAX( abs( dx0 ), abs( dy0 ) ) < (pas_45 * 2) )
        return 0;
    
    if( MAX( abs( dx1 ), abs( dy1 ) ) < (pas_45 * 2) )
        return 0;

+13 −4
Original line number Diff line number Diff line
@@ -13,6 +13,8 @@
#include "id.h"
#include "hotkeys.h"
#include "collectors.h"
#include "protos.h"


/* Bitmaps */
#include "bitmaps.h"
@@ -171,9 +173,16 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
    
    // printf( "cursor=(%d, %d) select=(%d,%d)\n", cursorPos.x, cursorPos.y, selectPos.x, selectPos.y );
    
    // If there is no selected item or the right click happened at a position
    // other than where the selection was made
    if( !item ||  cursorPos != selectPos )
    /*  If not editing a track, and there is no selected item or the right click 
        happened at a position other than where the selection was made.
        We cannot call PcbGeneralLocateAndDisplay() when dragging a track because
        editrack.cpp's void Exit_Editrack( WinEDA_DrawPanel* Panel, wxDC* DC )
        uses GetCurItem(), thinking it is an aborted track, yet after calling
        PcbGeneralLocateAndDisplay(), GetCurItem() is any arbitrary BOARD_ITEM,
        not the aborted track.
    */
    if( ShowNewTrackWhenMovingCursor != DrawPanel->ManageCurseur 
       && ( !item  ||  cursorPos != selectPos )  )
    {
        DrawPanel->m_AbortRequest = false;
        item = PcbGeneralLocateAndDisplay();