Commit ed0677b4 authored by dickelbeck's avatar dickelbeck
Browse files

pcbnew's onrightclick behavior

parent e3e0efa1
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -4,6 +4,14 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with 
email address.

2007-Oct-9 UPDATE   Dick Hollenbeck <dick@softplc.com>
================================================================================
+ pcbnew
    changed pcbnew/onrightclick.cpp so that a right click only shows the
    Selection Clarification menu if there is no selected object or if the
    click is in a position different from where the selection was previously
    made.

    
2007-Oct-09 UPDATE   Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
@@ -11,6 +19,7 @@ email address.
	cross-probing minor bug solved ( due to last modification): pins/pads not probed


>>>>>>> .r316
2007-Oct-08 UPDATE   Geoff Harland <gharlandau@yahoo.com.au>
================================================================================
+ gerbview
@@ -32,7 +41,6 @@ email address.
	- definition CUIVRE_N translated into COPPER_LAYER_N



2007-Oct-07 UPDATE   Geoff Harland <gharlandau@yahoo.com.au>
================================================================================
+ all
+137 −135
Original line number Diff line number Diff line
@@ -3,8 +3,9 @@
/********************************************************/

/* fichier controle.cpp */

/*
 Routines d'affichage grille, Boite de coordonnees, Curseurs, marqueurs ...
 *  Routines d'affichage grille, Boite de coordonnees, Curseurs, marqueurs ...
 */

#include "fctsys.h"
@@ -21,23 +22,22 @@


/**********************************************************************/
EDA_BaseStruct * WinEDA_GerberFrame::GerberGeneralLocateAndDisplay()
EDA_BaseStruct* WinEDA_GerberFrame::GerberGeneralLocateAndDisplay() {
/**********************************************************************/
{
    return Locate( CURSEUR_OFF_GRILLE );
}



/****************************************************************/
void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
/****************************************************************/

/* traitement des touches de fonctions utilisees ds tous les menus
	Zoom
	Redessin d'ecran
	Cht Unites
	Cht couches
	Remise a 0 de l'origine des coordonnees relatives
 *  Zoom
 *  Redessin d'ecran
 *  Cht Unites
 *  Cht couches
 *  Remise a 0 de l'origine des coordonnees relatives
 */
{
    wxSize  delta;
@@ -47,6 +47,7 @@ int hotkey = 0;
    if( GetScreen()->IsRefreshReq() )
    {
        RedrawActiveWindow( DC, TRUE );

        // We must return here, instead of proceeding.
        // If we let the cursor move during a refresh request,
        // the cursor be displayed in the wrong place
@@ -62,8 +63,10 @@ int hotkey = 0;

    delta.x = GetScreen()->GetGrid().x / GetScreen()->GetZoom();
    delta.y = GetScreen()->GetGrid().y / GetScreen()->GetZoom();
	if( delta.x == 0 ) delta.x = 1;
	if( delta.y == 0 ) delta.y = 1;
    if( delta.x == 0 )
        delta.x = 1;
    if( delta.y == 0 )
        delta.y = 1;

    switch( g_KeyPressed )
    {
@@ -126,17 +129,19 @@ int hotkey = 0;
        DrawPanel->MouseTo( Mouse );
        break;

		default: hotkey = g_KeyPressed;
    default:
        hotkey = g_KeyPressed;
        break;
    }

    /* Recalcul de la position du curseur schema */
    GetScreen()->m_Curseur = curpos;
    
    /* Placement sur la grille generale */
    PutOnGrid( &GetScreen()->m_Curseur );

	if ( (oldpos.x != GetScreen()->m_Curseur.x) ||
		 (oldpos.y != GetScreen()->m_Curseur.y) )
    if( (oldpos.x != GetScreen()->m_Curseur.x)
     || (oldpos.y != GetScreen()->m_Curseur.y) )
    {
        curpos = GetScreen()->m_Curseur;
        GetScreen()->m_Curseur = oldpos;
@@ -163,7 +168,4 @@ int hotkey = 0;

    SetToolbars();
    Affiche_Status_Box();    /* Affichage des coord curseur */

}

+14 −12
Original line number Diff line number Diff line
@@ -118,11 +118,9 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
    m_Collector->Collect( m_Pcb, scanList, GetScreen()->RefPos( true ), guide );

#if 0

    // debugging: print out the collected items, showing their priority order too.
    for( int i = 0; i<m_Collector->GetCount();  ++i )
        (*m_Collector)[i]->Show( 0, std::cout );

#endif

    /* Remove redundancies: most of time, zones are found twice,
@@ -234,6 +232,7 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )

    // Save the board after the time out :
    int CurrentTime = time( NULL );
    
    if( !GetScreen()->IsModify() || GetScreen()->IsSave() )
    {
        /* If no change, reset the time out */
@@ -258,10 +257,12 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
    }

    curpos = DrawPanel->CursorRealPosition( Mouse );
    
    oldpos = GetScreen()->m_Curseur;

    delta.x = (int) round( (double) GetScreen()->GetGrid().x / zoom );
    delta.y = (int) round( (double) GetScreen()->GetGrid().y / zoom );
    
    if( delta.x <= 0 )
        delta.x = 1;
    if( delta.y <= 0 )
@@ -361,6 +362,7 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
        if( (m_ID_current_state != ID_TRACK_BUTT )
           && (g_MagneticPadOption == capture_cursor_in_track_tool) )
            pad = NULL;
            
        if( keep_on_grid )
        {
            if( pad )  // Put cursor on the pad
+30 −1
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@
#include "autorout.h"
#include "id.h"
#include "hotkeys.h"
#include "collectors.h"

/* Bitmaps */
#include "bitmaps.h"
@@ -161,6 +162,32 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )

    
    /* Select a proper item */

#if 1   // try this
    wxPoint cursorPos = GetScreen()->m_Curseur;
    wxPoint selectPos = m_Collector->GetRefPos();
    
    PutOnGrid( &selectPos );    
    
    // 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 )
    {
        DrawPanel->m_AbortRequest = false;
        item = PcbGeneralLocateAndDisplay();
        if( DrawPanel->m_AbortRequest )
        {
            DrawPanel->CursorOn( &dc );
            return false;
        }
        
        // SetCurItem( item );  no, PcbGeneralLocateAndDisplay() does this
    }

#else

    if( !item  || !item->m_Flags )
    {
        DrawPanel->m_AbortRequest = false;
@@ -173,6 +200,8 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )

        SetCurItem( item );
    }
#endif


    item = GetCurItem();
    if( item )