pcbnew's onrightclick behavior
This commit is contained in:
parent
e3e0efa144
commit
ed0677b422
|
@ -4,6 +4,14 @@ Started 2007-June-11
|
||||||
Please add newer entries at the top, list the date and your name with
|
Please add newer entries at the top, list the date and your name with
|
||||||
email address.
|
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>
|
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
|
cross-probing minor bug solved ( due to last modification): pins/pads not probed
|
||||||
|
|
||||||
|
|
||||||
|
>>>>>>> .r316
|
||||||
2007-Oct-08 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
|
2007-Oct-08 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
|
||||||
================================================================================
|
================================================================================
|
||||||
+ gerbview
|
+ gerbview
|
||||||
|
@ -32,7 +41,6 @@ email address.
|
||||||
- definition CUIVRE_N translated into COPPER_LAYER_N
|
- definition CUIVRE_N translated into COPPER_LAYER_N
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
2007-Oct-07 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
|
2007-Oct-07 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
|
||||||
================================================================================
|
================================================================================
|
||||||
+ all
|
+ all
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
/********************************************************/
|
/********************************************************/
|
||||||
/* Routines generales de gestion des commandes usuelles */
|
/* Routines generales de gestion des commandes usuelles */
|
||||||
/********************************************************/
|
/********************************************************/
|
||||||
|
|
||||||
|
/* fichier controle.cpp */
|
||||||
|
|
||||||
/* fichier controle.cpp */
|
|
||||||
/*
|
/*
|
||||||
Routines d'affichage grille, Boite de coordonnees, Curseurs, marqueurs ...
|
* Routines d'affichage grille, Boite de coordonnees, Curseurs, marqueurs ...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
|
|
||||||
|
@ -21,149 +22,150 @@
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
EDA_BaseStruct * WinEDA_GerberFrame::GerberGeneralLocateAndDisplay()
|
EDA_BaseStruct* WinEDA_GerberFrame::GerberGeneralLocateAndDisplay() {
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
{
|
return Locate( CURSEUR_OFF_GRILLE );
|
||||||
return Locate(CURSEUR_OFF_GRILLE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************/
|
||||||
|
void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
||||||
|
/****************************************************************/
|
||||||
|
|
||||||
/****************************************************************/
|
|
||||||
void WinEDA_BasePcbFrame::GeneralControle(wxDC *DC, wxPoint Mouse)
|
|
||||||
/****************************************************************/
|
|
||||||
/* traitement des touches de fonctions utilisees ds tous les menus
|
/* traitement des touches de fonctions utilisees ds tous les menus
|
||||||
Zoom
|
* Zoom
|
||||||
Redessin d'ecran
|
* Redessin d'ecran
|
||||||
Cht Unites
|
* Cht Unites
|
||||||
Cht couches
|
* Cht couches
|
||||||
Remise a 0 de l'origine des coordonnees relatives
|
* Remise a 0 de l'origine des coordonnees relatives
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxSize delta;
|
wxSize delta;
|
||||||
wxPoint curpos, oldpos;
|
wxPoint curpos, oldpos;
|
||||||
int hotkey = 0;
|
int hotkey = 0;
|
||||||
|
|
||||||
if( GetScreen()->IsRefreshReq() )
|
if( GetScreen()->IsRefreshReq() )
|
||||||
{
|
{
|
||||||
RedrawActiveWindow(DC, TRUE);
|
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
|
|
||||||
// during delayed repaint events that occur when
|
|
||||||
// you move the mouse when a message dialog is on
|
|
||||||
// the screen, and then you dismiss the dialog by
|
|
||||||
// typing the Enter key.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
curpos = DrawPanel->CursorRealPosition(Mouse);
|
// We must return here, instead of proceeding.
|
||||||
oldpos = GetScreen()->m_Curseur;
|
// If we let the cursor move during a refresh request,
|
||||||
|
// the cursor be displayed in the wrong place
|
||||||
|
// during delayed repaint events that occur when
|
||||||
|
// you move the mouse when a message dialog is on
|
||||||
|
// the screen, and then you dismiss the dialog by
|
||||||
|
// typing the Enter key.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
delta.x = GetScreen()->GetGrid().x / GetScreen()->GetZoom();
|
curpos = DrawPanel->CursorRealPosition( Mouse );
|
||||||
delta.y = GetScreen()->GetGrid().y / GetScreen()->GetZoom();
|
oldpos = GetScreen()->m_Curseur;
|
||||||
if( delta.x == 0 ) delta.x = 1;
|
|
||||||
if( delta.y == 0 ) delta.y = 1;
|
|
||||||
|
|
||||||
switch(g_KeyPressed)
|
delta.x = GetScreen()->GetGrid().x / GetScreen()->GetZoom();
|
||||||
{
|
delta.y = GetScreen()->GetGrid().y / GetScreen()->GetZoom();
|
||||||
case EDA_PANNING_UP_KEY :
|
if( delta.x == 0 )
|
||||||
OnZoom(ID_ZOOM_PANNING_UP);
|
delta.x = 1;
|
||||||
curpos = m_CurrentScreen->m_Curseur;
|
if( delta.y == 0 )
|
||||||
break;
|
delta.y = 1;
|
||||||
|
|
||||||
case EDA_PANNING_DOWN_KEY :
|
switch( g_KeyPressed )
|
||||||
OnZoom(ID_ZOOM_PANNING_DOWN);
|
{
|
||||||
curpos = m_CurrentScreen->m_Curseur;
|
case EDA_PANNING_UP_KEY:
|
||||||
break;
|
OnZoom( ID_ZOOM_PANNING_UP );
|
||||||
|
curpos = m_CurrentScreen->m_Curseur;
|
||||||
|
break;
|
||||||
|
|
||||||
case EDA_PANNING_LEFT_KEY :
|
case EDA_PANNING_DOWN_KEY:
|
||||||
OnZoom(ID_ZOOM_PANNING_LEFT);
|
OnZoom( ID_ZOOM_PANNING_DOWN );
|
||||||
curpos = m_CurrentScreen->m_Curseur;
|
curpos = m_CurrentScreen->m_Curseur;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EDA_PANNING_RIGHT_KEY :
|
case EDA_PANNING_LEFT_KEY:
|
||||||
OnZoom(ID_ZOOM_PANNING_RIGHT);
|
OnZoom( ID_ZOOM_PANNING_LEFT );
|
||||||
curpos = m_CurrentScreen->m_Curseur;
|
curpos = m_CurrentScreen->m_Curseur;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EDA_ZOOM_IN_FROM_MOUSE :
|
case EDA_PANNING_RIGHT_KEY:
|
||||||
OnZoom(ID_ZOOM_PLUS_KEY);
|
OnZoom( ID_ZOOM_PANNING_RIGHT );
|
||||||
curpos = GetScreen()->m_Curseur;
|
curpos = m_CurrentScreen->m_Curseur;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EDA_ZOOM_OUT_FROM_MOUSE :
|
case EDA_ZOOM_IN_FROM_MOUSE:
|
||||||
OnZoom(ID_ZOOM_MOINS_KEY);
|
OnZoom( ID_ZOOM_PLUS_KEY );
|
||||||
curpos = GetScreen()->m_Curseur;
|
curpos = GetScreen()->m_Curseur;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EDA_ZOOM_CENTER_FROM_MOUSE :
|
case EDA_ZOOM_OUT_FROM_MOUSE:
|
||||||
OnZoom(ID_ZOOM_CENTER_KEY);
|
OnZoom( ID_ZOOM_MOINS_KEY );
|
||||||
curpos = GetScreen()->m_Curseur;
|
curpos = GetScreen()->m_Curseur;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD8 : /* Deplacement curseur vers le haut */
|
case EDA_ZOOM_CENTER_FROM_MOUSE:
|
||||||
case WXK_UP :
|
OnZoom( ID_ZOOM_CENTER_KEY );
|
||||||
Mouse.y -= delta.y;
|
curpos = GetScreen()->m_Curseur;
|
||||||
DrawPanel->MouseTo(Mouse);
|
break;
|
||||||
break ;
|
|
||||||
|
|
||||||
case WXK_NUMPAD2: /* Deplacement curseur vers le bas */
|
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
|
||||||
case WXK_DOWN:
|
case WXK_UP:
|
||||||
Mouse.y += delta.y;
|
Mouse.y -= delta.y;
|
||||||
DrawPanel->MouseTo(Mouse);
|
DrawPanel->MouseTo( Mouse );
|
||||||
break ;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */
|
case WXK_NUMPAD2: /* Deplacement curseur vers le bas */
|
||||||
case WXK_LEFT :
|
case WXK_DOWN:
|
||||||
Mouse.x -= delta.x;
|
Mouse.y += delta.y;
|
||||||
DrawPanel->MouseTo(Mouse);
|
DrawPanel->MouseTo( Mouse );
|
||||||
break ;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD6: /* Deplacement curseur vers la droite */
|
case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */
|
||||||
case WXK_RIGHT :
|
case WXK_LEFT:
|
||||||
Mouse.x += delta.x;
|
Mouse.x -= delta.x;
|
||||||
DrawPanel->MouseTo(Mouse);
|
DrawPanel->MouseTo( Mouse );
|
||||||
break ;
|
break;
|
||||||
|
|
||||||
default: hotkey = g_KeyPressed;
|
case WXK_NUMPAD6: /* Deplacement curseur vers la droite */
|
||||||
break;
|
case WXK_RIGHT:
|
||||||
}
|
Mouse.x += delta.x;
|
||||||
|
DrawPanel->MouseTo( Mouse );
|
||||||
|
break;
|
||||||
|
|
||||||
/* Recalcul de la position du curseur schema */
|
default:
|
||||||
GetScreen()->m_Curseur = curpos;
|
hotkey = g_KeyPressed;
|
||||||
/* Placement sur la grille generale */
|
break;
|
||||||
PutOnGrid( & GetScreen()->m_Curseur);
|
}
|
||||||
|
|
||||||
if ( (oldpos.x != GetScreen()->m_Curseur.x) ||
|
/* Recalcul de la position du curseur schema */
|
||||||
(oldpos.y != GetScreen()->m_Curseur.y) )
|
GetScreen()->m_Curseur = curpos;
|
||||||
{
|
|
||||||
curpos = GetScreen()->m_Curseur;
|
|
||||||
GetScreen()->m_Curseur = oldpos;
|
|
||||||
DrawPanel->CursorOff(DC);
|
|
||||||
|
|
||||||
GetScreen()->m_Curseur = curpos;
|
/* Placement sur la grille generale */
|
||||||
DrawPanel->CursorOn(DC);
|
PutOnGrid( &GetScreen()->m_Curseur );
|
||||||
|
|
||||||
if(DrawPanel->ManageCurseur)
|
if( (oldpos.x != GetScreen()->m_Curseur.x)
|
||||||
{
|
|| (oldpos.y != GetScreen()->m_Curseur.y) )
|
||||||
DrawPanel->ManageCurseur(DrawPanel, DC, TRUE);
|
{
|
||||||
}
|
curpos = GetScreen()->m_Curseur;
|
||||||
}
|
GetScreen()->m_Curseur = oldpos;
|
||||||
|
DrawPanel->CursorOff( DC );
|
||||||
|
|
||||||
if ( hotkey )
|
GetScreen()->m_Curseur = curpos;
|
||||||
{
|
DrawPanel->CursorOn( DC );
|
||||||
OnHotKey(DC, hotkey, NULL);
|
|
||||||
}
|
if( DrawPanel->ManageCurseur )
|
||||||
|
{
|
||||||
|
DrawPanel->ManageCurseur( DrawPanel, DC, TRUE );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( hotkey )
|
||||||
|
{
|
||||||
|
OnHotKey( DC, hotkey, NULL );
|
||||||
|
}
|
||||||
|
|
||||||
if( GetScreen()->IsRefreshReq() )
|
if( GetScreen()->IsRefreshReq() )
|
||||||
{
|
{
|
||||||
RedrawActiveWindow( DC, TRUE );
|
RedrawActiveWindow( DC, TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
SetToolbars();
|
SetToolbars();
|
||||||
Affiche_Status_Box(); /* Affichage des coord curseur */
|
Affiche_Status_Box(); /* Affichage des coord curseur */
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -118,11 +118,9 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
|
||||||
m_Collector->Collect( m_Pcb, scanList, GetScreen()->RefPos( true ), guide );
|
m_Collector->Collect( m_Pcb, scanList, GetScreen()->RefPos( true ), guide );
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
||||||
// debugging: print out the collected items, showing their priority order too.
|
// debugging: print out the collected items, showing their priority order too.
|
||||||
for( int i = 0; i<m_Collector->GetCount(); ++i )
|
for( int i = 0; i<m_Collector->GetCount(); ++i )
|
||||||
(*m_Collector)[i]->Show( 0, std::cout );
|
(*m_Collector)[i]->Show( 0, std::cout );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Remove redundancies: most of time, zones are found twice,
|
/* Remove redundancies: most of time, zones are found twice,
|
||||||
|
@ -170,16 +168,16 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
|
||||||
{
|
{
|
||||||
wxMenu itemMenu;
|
wxMenu itemMenu;
|
||||||
|
|
||||||
/* Give a title to the selection menu. This is also a cancel menu item */
|
/* Give a title to the selection menu. This is also a cancel menu item */
|
||||||
wxMenuItem * item_title = new wxMenuItem(&itemMenu, -1, _( "Selection Clarification" ) );
|
wxMenuItem * item_title = new wxMenuItem(&itemMenu, -1, _( "Selection Clarification" ) );
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
wxFont bold_font(*wxNORMAL_FONT);
|
wxFont bold_font(*wxNORMAL_FONT);
|
||||||
bold_font.SetWeight(wxFONTWEIGHT_BOLD);
|
bold_font.SetWeight(wxFONTWEIGHT_BOLD);
|
||||||
bold_font.SetStyle( wxFONTSTYLE_ITALIC);
|
bold_font.SetStyle( wxFONTSTYLE_ITALIC);
|
||||||
item_title->SetFont(bold_font);
|
item_title->SetFont(bold_font);
|
||||||
#endif
|
#endif
|
||||||
itemMenu.Append(item_title);
|
itemMenu.Append(item_title);
|
||||||
itemMenu.AppendSeparator();
|
itemMenu.AppendSeparator();
|
||||||
|
|
||||||
int limit = MIN( MAX_ITEMS_IN_PICKER, m_Collector->GetCount() );
|
int limit = MIN( MAX_ITEMS_IN_PICKER, m_Collector->GetCount() );
|
||||||
|
|
||||||
|
@ -206,8 +204,8 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay( int aHotKeyCode )
|
||||||
|
|
||||||
// this menu's handler is void WinEDA_BasePcbFrame::ProcessItemSelection()
|
// this menu's handler is void WinEDA_BasePcbFrame::ProcessItemSelection()
|
||||||
// and it calls SetCurItem() which in turn calls Display_Infos() on the item.
|
// and it calls SetCurItem() which in turn calls Display_Infos() on the item.
|
||||||
DrawPanel->m_AbortRequest = true; // changed in false if an item
|
DrawPanel->m_AbortRequest = true; // changed in false if an item
|
||||||
PopupMenu( &itemMenu ); // m_AbortRequest = false if an item is selected
|
PopupMenu( &itemMenu ); // m_AbortRequest = false if an item is selected
|
||||||
|
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
|
|
||||||
|
@ -234,6 +232,7 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
||||||
|
|
||||||
// Save the board after the time out :
|
// Save the board after the time out :
|
||||||
int CurrentTime = time( NULL );
|
int CurrentTime = time( NULL );
|
||||||
|
|
||||||
if( !GetScreen()->IsModify() || GetScreen()->IsSave() )
|
if( !GetScreen()->IsModify() || GetScreen()->IsSave() )
|
||||||
{
|
{
|
||||||
/* If no change, reset the time out */
|
/* If no change, reset the time out */
|
||||||
|
@ -258,10 +257,12 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
||||||
}
|
}
|
||||||
|
|
||||||
curpos = DrawPanel->CursorRealPosition( Mouse );
|
curpos = DrawPanel->CursorRealPosition( Mouse );
|
||||||
|
|
||||||
oldpos = GetScreen()->m_Curseur;
|
oldpos = GetScreen()->m_Curseur;
|
||||||
|
|
||||||
delta.x = (int) round( (double) GetScreen()->GetGrid().x / zoom );
|
delta.x = (int) round( (double) GetScreen()->GetGrid().x / zoom );
|
||||||
delta.y = (int) round( (double) GetScreen()->GetGrid().y / zoom );
|
delta.y = (int) round( (double) GetScreen()->GetGrid().y / zoom );
|
||||||
|
|
||||||
if( delta.x <= 0 )
|
if( delta.x <= 0 )
|
||||||
delta.x = 1;
|
delta.x = 1;
|
||||||
if( delta.y <= 0 )
|
if( delta.y <= 0 )
|
||||||
|
@ -361,6 +362,7 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
||||||
if( (m_ID_current_state != ID_TRACK_BUTT )
|
if( (m_ID_current_state != ID_TRACK_BUTT )
|
||||||
&& (g_MagneticPadOption == capture_cursor_in_track_tool) )
|
&& (g_MagneticPadOption == capture_cursor_in_track_tool) )
|
||||||
pad = NULL;
|
pad = NULL;
|
||||||
|
|
||||||
if( keep_on_grid )
|
if( keep_on_grid )
|
||||||
{
|
{
|
||||||
if( pad ) // Put cursor on the pad
|
if( pad ) // Put cursor on the pad
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "autorout.h"
|
#include "autorout.h"
|
||||||
#include "id.h"
|
#include "id.h"
|
||||||
#include "hotkeys.h"
|
#include "hotkeys.h"
|
||||||
|
#include "collectors.h"
|
||||||
|
|
||||||
/* Bitmaps */
|
/* Bitmaps */
|
||||||
#include "bitmaps.h"
|
#include "bitmaps.h"
|
||||||
|
@ -161,6 +162,32 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
||||||
|
|
||||||
|
|
||||||
/* Select a proper item */
|
/* 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 )
|
if( !item || !item->m_Flags )
|
||||||
{
|
{
|
||||||
DrawPanel->m_AbortRequest = false;
|
DrawPanel->m_AbortRequest = false;
|
||||||
|
@ -173,6 +200,8 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
|
||||||
|
|
||||||
SetCurItem( item );
|
SetCurItem( item );
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
item = GetCurItem();
|
item = GetCurItem();
|
||||||
if( item )
|
if( item )
|
||||||
|
|
Loading…
Reference in New Issue