more pcbnew's onrightclick behavior

This commit is contained in:
dickelbeck 2007-10-10 12:43:30 +00:00
parent b8ae79ed22
commit a93fd7113e
3 changed files with 36 additions and 10 deletions

View File

@ -205,13 +205,27 @@ void WinEDA_BasePcbFrame::SetCurItem( BOARD_ITEM* aItem )
/*****************************************************************/ /*****************************************************************/
{ {
m_CurrentScreen->SetCurItem( aItem ); m_CurrentScreen->SetCurItem( aItem );
if( aItem ) if( aItem )
{
aItem->Display_Infos( this ); aItem->Display_Infos( this );
#if defined(DEBUG)
aItem->Show( 0, std::cout );
#endif
}
else else
{ {
// we can use either of these: // we can use either of these two:
//MsgPanel->EraseMsgBox(); //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
} }
} }

View File

@ -37,28 +37,30 @@ static void Exit_Editrack( WinEDA_DrawPanel* Panel, wxDC* DC )
*/ */
{ {
WinEDA_PcbFrame* frame = (WinEDA_PcbFrame*) Panel->m_Parent; 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 */ /* Erase the current drawing */
ShowNewTrackWhenMovingCursor( Panel, DC, FALSE ); ShowNewTrackWhenMovingCursor( Panel, DC, FALSE );
if( g_HightLigt_Status ) if( g_HightLigt_Status )
frame->Hight_Light( DC ); frame->Hight_Light( DC );
g_HightLigth_NetCode = OldNetCodeSurbrillance; g_HightLigth_NetCode = OldNetCodeSurbrillance;
if( OldEtatSurbrillance ) if( OldEtatSurbrillance )
frame->Hight_Light( DC ); frame->Hight_Light( DC );
frame->MsgPanel->EraseMsgBox(); frame->MsgPanel->EraseMsgBox();
TRACK* previoustrack;
// Delete current (new) track // Delete current (new) track
for( ; track != NULL; track = previoustrack ) TRACK* previoustrack;
for( ; track; track = previoustrack )
{ {
previoustrack = (TRACK*) track->Pback; previoustrack = (TRACK*) track->Pback;
delete track; delete track;
} }
} }
Panel->ManageCurseur = NULL; Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL; Panel->ForceCloseManageCurseur = NULL;
frame->SetCurItem( 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: // les segments doivent etre de longueur suffisante:
if( MAX( abs( dx0 ), abs( dy0 ) ) < (pas_45 * 2) ) if( MAX( abs( dx0 ), abs( dy0 ) ) < (pas_45 * 2) )
return 0; return 0;
if( MAX( abs( dx1 ), abs( dy1 ) ) < (pas_45 * 2) ) if( MAX( abs( dx1 ), abs( dy1 ) ) < (pas_45 * 2) )
return 0; return 0;

View File

@ -13,6 +13,8 @@
#include "id.h" #include "id.h"
#include "hotkeys.h" #include "hotkeys.h"
#include "collectors.h" #include "collectors.h"
#include "protos.h"
/* Bitmaps */ /* Bitmaps */
#include "bitmaps.h" #include "bitmaps.h"
@ -170,10 +172,17 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
PutOnGrid( &selectPos ); PutOnGrid( &selectPos );
// printf( "cursor=(%d, %d) select=(%d,%d)\n", cursorPos.x, cursorPos.y, selectPos.x, selectPos.y ); // 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 /* If not editing a track, and there is no selected item or the right click
// other than where the selection was made happened at a position other than where the selection was made.
if( !item || cursorPos != selectPos ) 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; DrawPanel->m_AbortRequest = false;
item = PcbGeneralLocateAndDisplay(); item = PcbGeneralLocateAndDisplay();