Commit 4a8bf70d authored by dickelbeck's avatar dickelbeck

tweaks

parent 9fba83b5
...@@ -11,12 +11,12 @@ ...@@ -11,12 +11,12 @@
#define CONV_FROM_UTF8(utf8string) (utf8string) #define CONV_FROM_UTF8(utf8string) (utf8string)
#endif #endif
/* violation of C++ standard, cannot use MIN() and MAX() /* violation of C++ standard, cannot use min() and max(), i.e. in lowercase
#ifndef min #ifndef min
#define MIN(x, y) ((x) > (y) ? (y) : (x)) #define min(x, y) ((x) > (y) ? (y) : (x))
#endif #endif
#ifndef max #ifndef max
#define MAX(x, y) ((x) > (y) ? (x) : (y)) #define max(x, y) ((x) > (y) ? (x) : (y))
#endif #endif
*/ */
......
...@@ -325,11 +325,19 @@ public: ...@@ -325,11 +325,19 @@ public:
public: public:
PCB_SCREEN( int idscreen ); PCB_SCREEN( int idscreen );
~PCB_SCREEN(); ~PCB_SCREEN();
PCB_SCREEN* Next() { return (PCB_SCREEN*) Pnext; } PCB_SCREEN* Next() { return (PCB_SCREEN*) Pnext; }
void Init(); void Init();
void SetNextZoom(); void SetNextZoom();
void SetPreviousZoom(); void SetPreviousZoom();
void SetLastZoom(); void SetLastZoom();
/**
* Function GetCurItem
* returns the currently selected BOARD_ITEM, overriding BASE_SCREEN::GetCurItem().
* @return BOARD_ITEM* - the one selected, or NULL.
*/
BOARD_ITEM* GetCurItem() const { return (BOARD_ITEM*) BASE_SCREEN::GetCurItem(); }
}; };
/***************************/ /***************************/
......
...@@ -210,8 +210,8 @@ public: ...@@ -210,8 +210,8 @@ public:
BASE_SCREEN* m_CurrentScreen; // SCREEN en cours BASE_SCREEN* m_CurrentScreen; // SCREEN en cours
int m_CurrentCursorShape; // shape for cursor (0 = default cursor) int m_CurrentCursorShape; // shape for cursor (0 = default cursor)
int m_ID_current_state; // Id du bouton actif du tool bar vertical int m_ID_current_state; ///< Id of active button on the vertical toolbar
int m_HTOOL_current_state; // Id du bouton actif du tool bar horizontal int m_HTOOL_current_state; ///< Id of active button on horizontal toolbar
int m_InternalUnits; // nombre d'unites internes pour 1 pouce int m_InternalUnits; // nombre d'unites internes pour 1 pouce
// = 1000 pour schema, = 10000 pour PCB // = 1000 pour schema, = 10000 pour PCB
...@@ -394,6 +394,7 @@ public: ...@@ -394,6 +394,7 @@ public:
bool Clear_Pcb( wxDC* DC, bool query ); bool Clear_Pcb( wxDC* DC, bool query );
BOARD_ITEM* PcbGeneralLocateAndDisplay(); BOARD_ITEM* PcbGeneralLocateAndDisplay();
BOARD_ITEM* Locate( int typeloc, int LayerSearch ); BOARD_ITEM* Locate( int typeloc, int LayerSearch );
#if defined(DEBUG) #if defined(DEBUG)
/** /**
...@@ -562,7 +563,16 @@ public: ...@@ -562,7 +563,16 @@ public:
void PrepareLayerIndicator(); void PrepareLayerIndicator();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
/**
* Function OnRightClick
* populates a popup menu with the choices appropriate for the current context.
* The caller will add the ZOOM menu choices afterwards.
* @param aMousePos The current mouse position
* @param aPopMenu The menu to add to.
*/
void OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu );
void OnSelectOptionToolbar( wxCommandEvent& event ); void OnSelectOptionToolbar( wxCommandEvent& event );
void ToolOnRightClick( wxCommandEvent& event ); void ToolOnRightClick( wxCommandEvent& event );
......
...@@ -47,6 +47,19 @@ const KICAD_T GENERAL_COLLECTOR::AllBoardItems[] = { ...@@ -47,6 +47,19 @@ const KICAD_T GENERAL_COLLECTOR::AllBoardItems[] = {
}; };
const KICAD_T GENERAL_COLLECTOR::PrimaryItems[] = {
TYPETEXTE,
TYPEDRAWSEGMENT,
TYPECOTATION,
TYPEVIA,
TYPETRACK,
// TYPEPAD, TYPEPAD and TYPETEXTEMODULE are handled in a subsearch
// TYPETEXTEMODULE,
TYPEMODULE,
EOT
};
/** /**
* Function Inspect * Function Inspect
* is the examining function within the INSPECTOR which is passed to the * is the examining function within the INSPECTOR which is passed to the
...@@ -223,42 +236,8 @@ exit: ...@@ -223,42 +236,8 @@ exit:
} }
// see collectors.h
/*
void GENERAL_COLLECTOR::Collect( BOARD* board, const wxPoint& refPos,
int aPreferredLayer, int aLayerMask )
{
Empty(); // empty the collection, primary criteria list
Empty2nd(); // empty the collection, secondary criteria list
SetPreferredLayer( aPreferredLayer );
SetLayerMask( aLayerMask );
// remember refPos, pass to Inspect()
SetRefPos( refPos );
#if defined(DEBUG)
std::cout << '\n';
#endif
// visit the board with the INSPECTOR (me).
board->Visit( this, // INSPECTOR* inspector
NULL, // const void* testData, not used here
m_ScanTypes);
SetTimeNow(); // when snapshot was taken
// append 2nd list onto end of the first "list"
for( unsigned i=0; i<list2nd.size(); ++i )
Append( list2nd[i] );
Empty2nd();
}
*/
// see collectors.h // see collectors.h
void GENERAL_COLLECTOR::Collect( BOARD_ITEM* aItem, const wxPoint& refPos, void GENERAL_COLLECTOR::Collect( BOARD_ITEM* aItem, const wxPoint& aRefPos,
const COLLECTORS_GUIDE* aGuide ) const COLLECTORS_GUIDE* aGuide )
{ {
Empty(); // empty the collection, primary criteria list Empty(); // empty the collection, primary criteria list
...@@ -269,9 +248,9 @@ void GENERAL_COLLECTOR::Collect( BOARD_ITEM* aItem, const wxPoint& refPos, ...@@ -269,9 +248,9 @@ void GENERAL_COLLECTOR::Collect( BOARD_ITEM* aItem, const wxPoint& refPos,
// remember where the snapshot was taken from and pass refPos to // remember where the snapshot was taken from and pass refPos to
// the Inspect() function. // the Inspect() function.
SetRefPos( refPos ); SetRefPos( aRefPos );
// visit the board with the INSPECTOR (me). // visit the board or module with the INSPECTOR (me).
aItem->Visit( this, // INSPECTOR* inspector aItem->Visit( this, // INSPECTOR* inspector
NULL, // const void* testData, not used here NULL, // const void* testData, not used here
m_ScanTypes); m_ScanTypes);
......
...@@ -192,6 +192,13 @@ public: ...@@ -192,6 +192,13 @@ public:
static const KICAD_T AllBoardItems[]; static const KICAD_T AllBoardItems[];
/**
* A scan list for all primary board items, omitting items which are subsidiary to
* a MODULE, such as D_PAD and TEXTEMODULE.
*/
static const KICAD_T PrimaryItems[];
/** /**
* Constructor GENERALCOLLECTOR * Constructor GENERALCOLLECTOR
*/ */
......
...@@ -351,6 +351,10 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -351,6 +351,10 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->CursorOff( &dc ); DrawPanel->CursorOff( &dc );
DrawPanel->PrepareGraphicContext( &dc ); DrawPanel->PrepareGraphicContext( &dc );
#if defined(DEBUG)
std::cout << "GetString=" << event.GetString().mb_str() << '\n';
#endif
wxGetMousePosition( &pos.x, &pos.y ); wxGetMousePosition( &pos.x, &pos.y );
......
...@@ -121,67 +121,63 @@ static wxMenu* Append_Track_Width_List() ...@@ -121,67 +121,63 @@ static wxMenu* Append_Track_Width_List()
} }
/****************************************************************************/ /******************************************************************************/
void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
/****************************************************************************/ /******************************************************************************/
/* Create the PopUp menu (click on right mouse button)
* de la souris.
* The ZOOM menu is added to this menu
*/
{ {
EDA_BaseStruct* DrawStruct = m_CurrentScreen->GetCurItem();
wxString msg; wxString msg;
int flags = 0; int flags = 0;
bool locate_track = FALSE; bool locate_track = FALSE;
bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE); bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE);
wxClientDC dc( DrawPanel ); wxClientDC dc( DrawPanel );
BOARD_ITEM* item = GetScreen()->GetCurItem();
DrawPanel->CursorOff( &dc ); DrawPanel->CursorOff( &dc );
DrawPanel->m_CanStartBlock = -1; // Ne pas engager un debut de bloc sur validation menu DrawPanel->m_CanStartBlock = -1; // Ne pas engager un debut de bloc sur validation menu
// Simple localisation des elements si possible // Simple localisation des elements si possible
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( item == NULL || item->m_Flags == 0 )
{ {
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOPLACE ) if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOPLACE )
{ {
DrawStruct = Locate_Prefered_Module( m_Pcb, CURSEUR_OFF_GRILLE | VISIBLE_ONLY ); item = Locate_Prefered_Module( m_Pcb, CURSEUR_OFF_GRILLE | VISIBLE_ONLY );
if( DrawStruct ) if( item )
( (MODULE*) DrawStruct )->Display_Infos( this ); item->Display_Infos( this );
else else
DrawStruct = PcbGeneralLocateAndDisplay(); item = PcbGeneralLocateAndDisplay();
} }
else else
DrawStruct = PcbGeneralLocateAndDisplay(); item = PcbGeneralLocateAndDisplay();
} }
// If command in progress: Put the Cancel command (if needed) and End command // If command in progress: Put the Cancel command (if needed) and End command
if( m_ID_current_state ) if( m_ID_current_state )
{ {
if( DrawStruct && DrawStruct->m_Flags ) if( item && item->m_Flags )
{ {
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, ADD_MENUITEM( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
_( "Cancel" ), cancel_xpm ); _( "Cancel" ), cancel_xpm );
} }
else else
{ {
ADD_MENUITEM( PopMenu, ID_POPUP_CLOSE_CURRENT_TOOL, ADD_MENUITEM( aPopMenu, ID_POPUP_CLOSE_CURRENT_TOOL,
_( "End Tool" ), cancel_tool_xpm ); _( "End Tool" ), cancel_tool_xpm );
} }
PopMenu->AppendSeparator(); aPopMenu->AppendSeparator();
} }
else else
{ {
if( (DrawStruct && DrawStruct->m_Flags) || BlockActive ) if( (item && item->m_Flags) || BlockActive )
{ {
if( BlockActive ) if( BlockActive )
CreatePopUpBlockMenu( PopMenu ); CreatePopUpBlockMenu( aPopMenu );
else else
{ {
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, ADD_MENUITEM( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
_( "Cancel" ), cancel_xpm ); _( "Cancel" ), cancel_xpm );
} }
PopMenu->AppendSeparator(); aPopMenu->AppendSeparator();
} }
} }
...@@ -191,65 +187,65 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) ...@@ -191,65 +187,65 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
return; return;
} }
m_CurrentScreen->SetCurItem( DrawStruct ); m_CurrentScreen->SetCurItem( item );
if( DrawStruct ) if( item )
flags = DrawStruct->m_Flags; flags = item->m_Flags;
else else
flags = 0; flags = 0;
if( !flags ) if( !flags )
{ {
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST,
_( "Get and Move Footprint" ), Move_Module_xpm ); _( "Get and Move Footprint" ), Move_Module_xpm );
} }
if( DrawStruct ) if( item )
{ {
switch( DrawStruct->Type() ) switch( item->Type() )
{ {
case TYPEMODULE: case TYPEMODULE:
if( !flags ) if( !flags )
CreatePopUpMenuForFootprints( (MODULE*) DrawStruct, PopMenu, TRUE ); CreatePopUpMenuForFootprints( (MODULE*) item, aPopMenu, TRUE );
else else
CreatePopUpMenuForFootprints( (MODULE*) DrawStruct, PopMenu, FALSE ); CreatePopUpMenuForFootprints( (MODULE*) item, aPopMenu, FALSE );
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOPLACE ) if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOPLACE )
{ {
PopMenu->AppendSeparator(); aPopMenu->AppendSeparator();
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_AUTOPLACE_FIXE_MODULE, _( "Lock Module" ), ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_AUTOPLACE_FIXE_MODULE, _( "Lock Module" ),
Locked_xpm ); Locked_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_AUTOPLACE_FREE_MODULE, _( "Unlock Module" ), ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_AUTOPLACE_FREE_MODULE, _( "Unlock Module" ),
Unlocked_xpm ); Unlocked_xpm );
if( !flags ) if( !flags )
PopMenu->Append( ID_POPUP_PCB_AUTOPLACE_CURRENT_MODULE, aPopMenu->Append( ID_POPUP_PCB_AUTOPLACE_CURRENT_MODULE,
_( "Auto place Module" ) ); _( "Auto place Module" ) );
} }
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOROUTE ) if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOROUTE )
{ {
if( !flags ) if( !flags )
PopMenu->Append( ID_POPUP_PCB_AUTOROUTE_MODULE, _( "Autoroute" ) ); aPopMenu->Append( ID_POPUP_PCB_AUTOROUTE_MODULE, _( "Autoroute" ) );
} }
break; break;
case TYPEPAD: case TYPEPAD:
if( !flags ) if( !flags )
{ {
MODULE* Module = (MODULE*) DrawStruct->m_Parent; MODULE* module = (MODULE*) item->m_Parent;
if( Module ) if( module )
{ {
CreatePopUpMenuForFootprints( Module, PopMenu, TRUE ); CreatePopUpMenuForFootprints( module, aPopMenu, TRUE );
PopMenu->AppendSeparator(); aPopMenu->AppendSeparator();
} }
} }
CreatePopUpMenuForPads( (D_PAD*) DrawStruct, PopMenu ); CreatePopUpMenuForPads( (D_PAD*) item, aPopMenu );
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOROUTE ) if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOROUTE )
{ {
if( !flags ) if( !flags )
{ {
PopMenu->Append( ID_POPUP_PCB_AUTOROUTE_PAD, _( "Autoroute Pad" ) ); aPopMenu->Append( ID_POPUP_PCB_AUTOROUTE_PAD, _( "Autoroute Pad" ) );
PopMenu->Append( ID_POPUP_PCB_AUTOROUTE_NET, _( "Autoroute Net" ) ); aPopMenu->Append( ID_POPUP_PCB_AUTOROUTE_NET, _( "Autoroute Net" ) );
} }
} }
break; break;
...@@ -257,83 +253,83 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) ...@@ -257,83 +253,83 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
case TYPETEXTEMODULE: case TYPETEXTEMODULE:
if( !flags ) if( !flags )
{ {
MODULE* Module = (MODULE*) DrawStruct->m_Parent; MODULE* module = (MODULE*) item->m_Parent;
if( Module ) if( module )
{ {
CreatePopUpMenuForFootprints( Module, PopMenu, TRUE ); CreatePopUpMenuForFootprints( module, aPopMenu, TRUE );
PopMenu->AppendSeparator(); aPopMenu->AppendSeparator();
} }
} }
CreatePopUpMenuForFpTexts( (TEXTE_MODULE*) DrawStruct, PopMenu ); CreatePopUpMenuForFpTexts( (TEXTE_MODULE*) item, aPopMenu );
break; break;
case TYPEDRAWSEGMENT: case TYPEDRAWSEGMENT:
if( !flags ) if( !flags )
{ {
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_DRAWING_REQUEST, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_MOVE_DRAWING_REQUEST,
_( "Move Drawing" ), move_xpm ); _( "Move Drawing" ), move_xpm );
} }
if( flags & IS_NEW ) if( flags & IS_NEW )
{ {
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_STOP_CURRENT_DRAWING, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_STOP_CURRENT_DRAWING,
_( "End Drawing" ), apply_xpm ); _( "End Drawing" ), apply_xpm );
} }
PopMenu->Append( ID_POPUP_PCB_EDIT_DRAWING, _( "Edit Drawing" ) ); aPopMenu->Append( ID_POPUP_PCB_EDIT_DRAWING, _( "Edit Drawing" ) );
PopMenu->Append( ID_POPUP_PCB_DELETE_DRAWING, _( "Delete Drawing" ) ); aPopMenu->Append( ID_POPUP_PCB_DELETE_DRAWING, _( "Delete Drawing" ) );
break; break;
case TYPEEDGEZONE: case TYPEEDGEZONE:
if( flags & IS_NEW ) if( flags & IS_NEW )
{ {
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE,
_( "End edge zone" ), apply_xpm ); _( "End edge zone" ), apply_xpm );
} }
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DELETE_EDGE_ZONE, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_EDGE_ZONE,
_( "Delete edge zone" ), delete_xpm ); _( "Delete edge zone" ), delete_xpm );
break; break;
case TYPETEXTE: case TYPETEXTE:
CreatePopUpMenuForTexts( (TEXTE_PCB*) DrawStruct, PopMenu ); CreatePopUpMenuForTexts( (TEXTE_PCB*) item, aPopMenu );
break; break;
case TYPETRACK: case TYPETRACK:
case TYPEVIA: case TYPEVIA:
locate_track = TRUE; locate_track = TRUE;
CreatePopupMenuForTracks( (TRACK*) DrawStruct, GetScreen()->m_Curseur, CreatePopupMenuForTracks( (TRACK*) item, GetScreen()->m_Curseur,
PopMenu ); aPopMenu );
break; break;
case TYPEZONE: case TYPEZONE:
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_ZONE, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_ZONE,
_( "Edit Zone" ), edit_xpm ); _( "Edit Zone" ), edit_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DELETE_ZONE, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_ZONE,
_( "Delete Zone" ), delete_xpm ); _( "Delete Zone" ), delete_xpm );
break; break;
case TYPEMARQUEUR: case TYPEMARQUEUR:
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DELETE_MARKER, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_MARKER,
_( "Delete Marker" ), delete_xpm ); _( "Delete Marker" ), delete_xpm );
break; break;
case TYPECOTATION: case TYPECOTATION:
if( !flags ) if( !flags )
{ {
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_COTATION, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_COTATION,
_( "Edit Cotation" ), edit_xpm ); _( "Edit Cotation" ), edit_xpm );
} }
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DELETE_COTATION, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_COTATION,
_( "Delete Cotation" ), delete_xpm ); _( "Delete Cotation" ), delete_xpm );
break; break;
case TYPEMIRE: case TYPEMIRE:
if( !flags ) if( !flags )
{ {
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_MIRE_REQUEST, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_MOVE_MIRE_REQUEST,
_( "Move Mire" ), move_xpm ); _( "Move Mire" ), move_xpm );
} }
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_MIRE, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_MIRE,
_( "Edit Mire" ), edit_xpm ); _( "Edit Mire" ), edit_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DELETE_MIRE, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_MIRE,
_( "Delete Mire" ), delete_xpm ); _( "Delete Mire" ), delete_xpm );
break; break;
...@@ -344,19 +340,19 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) ...@@ -344,19 +340,19 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
case PCB_EQUIPOT_STRUCT_TYPE: case PCB_EQUIPOT_STRUCT_TYPE:
msg.Printf( msg.Printf(
wxT( "WinEDA_PcbFrame::OnRightClick() Error: illegal DrawType %d" ), wxT( "WinEDA_PcbFrame::OnRightClick() Error: illegal DrawType %d" ),
DrawStruct->Type() ); item->Type() );
DisplayError( this, msg ); DisplayError( this, msg );
break; break;
default: default:
msg.Printf( msg.Printf(
wxT( "WinEDA_PcbFrame::OnRightClick() Error: unknown DrawType %d" ), wxT( "WinEDA_PcbFrame::OnRightClick() Error: unknown DrawType %d" ),
DrawStruct->Type() ); item->Type() );
DisplayError( this, msg ); DisplayError( this, msg );
break; break;
} }
PopMenu->AppendSeparator(); aPopMenu->AppendSeparator();
} }
/* Traitement des fonctions specifiques */ /* Traitement des fonctions specifiques */
...@@ -365,39 +361,39 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) ...@@ -365,39 +361,39 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
case ID_PCB_ZONES_BUTT: case ID_PCB_ZONES_BUTT:
{ {
bool add_separator = FALSE; bool add_separator = FALSE;
PopMenu->Append( ID_POPUP_PCB_FILL_ZONE, _( "Fill zone" ) ); aPopMenu->Append( ID_POPUP_PCB_FILL_ZONE, _( "Fill zone" ) );
if( DrawStruct if( item
&& ( (DrawStruct->Type() == TYPEPAD) && ( (item->Type() == TYPEPAD)
|| (DrawStruct->Type() == TYPETRACK) || (item->Type() == TYPETRACK)
|| (DrawStruct->Type() == TYPEVIA) ) ) || (item->Type() == TYPEVIA) ) )
{ {
add_separator = TRUE; add_separator = TRUE;
PopMenu->Append( ID_POPUP_PCB_SELECT_NET_ZONE, _( "Select Net" ) ); aPopMenu->Append( ID_POPUP_PCB_SELECT_NET_ZONE, _( "Select Net" ) );
} }
if( m_Pcb->m_CurrentLimitZone ) if( m_Pcb->m_CurrentLimitZone )
{ {
add_separator = TRUE; add_separator = TRUE;
PopMenu->Append( ID_POPUP_PCB_DELETE_ZONE_LIMIT, _( "Delete Zone Limit" ) ); aPopMenu->Append( ID_POPUP_PCB_DELETE_ZONE_LIMIT, _( "Delete Zone Limit" ) );
} }
if( add_separator ) if( add_separator )
PopMenu->AppendSeparator(); aPopMenu->AppendSeparator();
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_SELECT_LAYER, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_SELECT_LAYER,
_( "Select Working Layer" ), Select_W_Layer_xpm ); _( "Select Working Layer" ), Select_W_Layer_xpm );
PopMenu->AppendSeparator(); aPopMenu->AppendSeparator();
} }
break; break;
case ID_TRACK_BUTT: case ID_TRACK_BUTT:
{ {
ADD_MENUITEM_WITH_SUBMENU( PopMenu, Append_Track_Width_List(), ADD_MENUITEM_WITH_SUBMENU( aPopMenu, Append_Track_Width_List(),
ID_POPUP_PCB_SELECT_WIDTH, ID_POPUP_PCB_SELECT_WIDTH,
_( "Select Track Width" ), width_track_xpm ); _( "Select Track Width" ), width_track_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_SELECT_CU_LAYER, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_SELECT_CU_LAYER,
_( "Select Working Layer" ), Select_W_Layer_xpm ); _( "Select Working Layer" ), Select_W_Layer_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_SELECT_LAYER_PAIR, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_SELECT_LAYER_PAIR,
_( "Select layer pair for vias" ), select_layer_pair_xpm ); _( "Select layer pair for vias" ), select_layer_pair_xpm );
PopMenu->AppendSeparator(); aPopMenu->AppendSeparator();
} }
break; break;
...@@ -406,28 +402,28 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) ...@@ -406,28 +402,28 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
case ID_TEXT_COMMENT_BUTT: case ID_TEXT_COMMENT_BUTT:
case ID_LINE_COMMENT_BUTT: case ID_LINE_COMMENT_BUTT:
case ID_PCB_COTATION_BUTT: case ID_PCB_COTATION_BUTT:
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_SELECT_NO_CU_LAYER, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_SELECT_NO_CU_LAYER,
_( "Select Working Layer" ), Select_W_Layer_xpm ); _( "Select Working Layer" ), Select_W_Layer_xpm );
PopMenu->AppendSeparator(); aPopMenu->AppendSeparator();
break; break;
case ID_COMPONENT_BUTT: case ID_COMPONENT_BUTT:
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC,
_( "Footprint documentation" ), book_xpm ); _( "Footprint documentation" ), book_xpm );
PopMenu->AppendSeparator(); aPopMenu->AppendSeparator();
break; break;
case 0: case 0:
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOPLACE ) if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOPLACE )
{ {
wxMenu* commands = new wxMenu; wxMenu* commands = new wxMenu;
ADD_MENUITEM_WITH_SUBMENU( PopMenu, commands, ADD_MENUITEM_WITH_SUBMENU( aPopMenu, commands,
ID_POPUP_PCB_AUTOPLACE_COMMANDS, _( ID_POPUP_PCB_AUTOPLACE_COMMANDS, _(
"Glob Move and Place" ), move_xpm ); "Glob Move and Place" ), move_xpm );
ADD_MENUITEM( commands, ID_POPUP_PCB_AUTOPLACE_FREE_ALL_MODULES, ADD_MENUITEM( commands, ID_POPUP_PCB_AUTOPLACE_FREE_ALL_MODULES,
_( "Free All Modules" ), Unlocked_xpm ); _( "Unlock All Modules" ), Unlocked_xpm );
ADD_MENUITEM( commands, ID_POPUP_PCB_AUTOPLACE_FIXE_ALL_MODULES, ADD_MENUITEM( commands, ID_POPUP_PCB_AUTOPLACE_FIXE_ALL_MODULES,
_( "Fixe All Modules" ), Locked_xpm ); _( "Lock All Modules" ), Locked_xpm );
commands->AppendSeparator(); commands->AppendSeparator();
ADD_MENUITEM( commands, ID_POPUP_PCB_AUTOMOVE_ALL_MODULES, ADD_MENUITEM( commands, ID_POPUP_PCB_AUTOMOVE_ALL_MODULES,
_( "Move All Modules" ), move_xpm ); _( "Move All Modules" ), move_xpm );
...@@ -439,12 +435,13 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) ...@@ -439,12 +435,13 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
commands->AppendSeparator(); commands->AppendSeparator();
ADD_MENUITEM( commands, ID_POPUP_PCB_REORIENT_ALL_MODULES, ADD_MENUITEM( commands, ID_POPUP_PCB_REORIENT_ALL_MODULES,
_( "Orient All Modules" ), rotate_module_pos_xpm ); _( "Orient All Modules" ), rotate_module_pos_xpm );
PopMenu->AppendSeparator(); aPopMenu->AppendSeparator();
} }
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOROUTE ) if( m_HTOOL_current_state == ID_TOOLBARH_PCB_AUTOROUTE )
{ {
wxMenu* commands = new wxMenu; wxMenu* commands = new wxMenu;
PopMenu->Append( ID_POPUP_PCB_AUTOROUTE_COMMANDS, _( "Global Autoroute" ), commands ); aPopMenu->Append( ID_POPUP_PCB_AUTOROUTE_COMMANDS, _( "Global Autoroute" ), commands );
ADD_MENUITEM( commands, ID_POPUP_PCB_SELECT_LAYER_PAIR, ADD_MENUITEM( commands, ID_POPUP_PCB_SELECT_LAYER_PAIR,
_( "Select layer pair" ), select_layer_pair_xpm ); _( "Select layer pair" ), select_layer_pair_xpm );
commands->AppendSeparator(); commands->AppendSeparator();
...@@ -459,16 +456,16 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) ...@@ -459,16 +456,16 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
commands->Append( ID_POPUP_PCB_AUTOROUTE_GET_AUTOROUTER_DATA, commands->Append( ID_POPUP_PCB_AUTOROUTE_GET_AUTOROUTER_DATA,
_( "Read Global AutoRouter Data" ) ); _( "Read Global AutoRouter Data" ) );
} }
PopMenu->AppendSeparator(); aPopMenu->AppendSeparator();
} }
if( locate_track ) if( locate_track )
ADD_MENUITEM_WITH_SUBMENU( PopMenu, Append_Track_Width_List(), ADD_MENUITEM_WITH_SUBMENU( aPopMenu, Append_Track_Width_List(),
ID_POPUP_PCB_SELECT_WIDTH, _( "Select Track Width" ), ID_POPUP_PCB_SELECT_WIDTH, _( "Select Track Width" ),
width_track_xpm ); width_track_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_SELECT_LAYER, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_SELECT_LAYER,
_( "Select Working Layer" ), Select_W_Layer_xpm ); _( "Select Working Layer" ), Select_W_Layer_xpm );
PopMenu->AppendSeparator(); aPopMenu->AppendSeparator();
break; break;
} }
...@@ -631,7 +628,7 @@ void CreatePopupMenuForTracks( TRACK* Track, wxPoint CursorPosition, ...@@ -631,7 +628,7 @@ void CreatePopupMenuForTracks( TRACK* Track, wxPoint CursorPosition,
/*********************************************************************************/ /*********************************************************************************/
void CreatePopUpMenuForFootprints( MODULE* Module, wxMenu* menu, bool full_menu ) void CreatePopUpMenuForFootprints( MODULE* aModule, wxMenu* menu, bool full_menu )
/*********************************************************************************/ /*********************************************************************************/
/* Create the wxMenuitem list for footprint editing /* Create the wxMenuitem list for footprint editing
...@@ -639,10 +636,10 @@ void CreatePopUpMenuForFootprints( MODULE* Module, wxMenu* menu, bool full_menu ...@@ -639,10 +636,10 @@ void CreatePopUpMenuForFootprints( MODULE* Module, wxMenu* menu, bool full_menu
{ {
wxMenu* sub_menu_footprint; wxMenu* sub_menu_footprint;
wxString msg; wxString msg;
int flags = Module->m_Flags; int flags = aModule->m_Flags;
msg = _( "Footprint" ); msg = _( "Footprint" );
msg << wxT( " " ) << Module->m_Reference->m_Text; msg << wxT( " " ) << aModule->GetReference();
sub_menu_footprint = new wxMenu; sub_menu_footprint = new wxMenu;
...@@ -741,6 +738,7 @@ void CreatePopUpMenuForPads( D_PAD* Pad, wxMenu* menu ) ...@@ -741,6 +738,7 @@ void CreatePopUpMenuForPads( D_PAD* Pad, wxMenu* menu )
} }
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_EDIT_PAD, _( "Edit Pad" ), options_pad_xpm ); ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_EDIT_PAD, _( "Edit Pad" ), options_pad_xpm );
sub_menu_Pad->AppendSeparator(); sub_menu_Pad->AppendSeparator();
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_IMPORT_PAD_SETTINGS, ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_IMPORT_PAD_SETTINGS,
_( "New Pad Settings" ), options_new_pad_xpm ); _( "New Pad Settings" ), options_new_pad_xpm );
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_EXPORT_PAD_SETTINGS, ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_EXPORT_PAD_SETTINGS,
...@@ -751,6 +749,7 @@ void CreatePopUpMenuForPads( D_PAD* Pad, wxMenu* menu ) ...@@ -751,6 +749,7 @@ void CreatePopUpMenuForPads( D_PAD* Pad, wxMenu* menu )
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS, ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS,
_( "Global Pad Settings" ), global_options_pad_xpm ); _( "Global Pad Settings" ), global_options_pad_xpm );
sub_menu_Pad->AppendSeparator(); sub_menu_Pad->AppendSeparator();
ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_DELETE_PAD, ADD_MENUITEM( sub_menu_Pad, ID_POPUP_PCB_DELETE_PAD,
_( "delete" ), Delete_Pad_xpm ); _( "delete" ), Delete_Pad_xpm );
} }
......
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
BEGIN_EVENT_TABLE( WinEDA_PcbFrame, wxFrame ) BEGIN_EVENT_TABLE( WinEDA_PcbFrame, wxFrame )
COMMON_EVENTS_DRAWFRAME EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV, WinEDA_PcbFrame::OnSockRequestServer ) COMMON_EVENTS_DRAWFRAME
EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV, WinEDA_PcbFrame::OnSockRequestServer )
EVT_SOCKET( ID_EDA_SOCKET_EVENT, WinEDA_PcbFrame::OnSockRequest ) EVT_SOCKET( ID_EDA_SOCKET_EVENT, WinEDA_PcbFrame::OnSockRequest )
EVT_KICAD_CHOICEBOX( ID_ON_ZOOM_SELECT, WinEDA_PcbFrame::OnSelectZoom ) EVT_KICAD_CHOICEBOX( ID_ON_ZOOM_SELECT, WinEDA_PcbFrame::OnSelectZoom )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment