2007-08-20 01:20:48 +00:00
|
|
|
/************************/
|
|
|
|
/* modedit_onclick.cpp */
|
|
|
|
/************************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
|
|
|
|
|
|
|
#include "pcbnew.h"
|
|
|
|
|
|
|
|
#include "bitmaps.h"
|
|
|
|
#include "protos.h"
|
|
|
|
#include "id.h"
|
|
|
|
|
|
|
|
/*************************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
2007-05-06 16:03:28 +00:00
|
|
|
/*************************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2007-10-16 19:05:33 +00:00
|
|
|
/* Handle the left click in footprint editor
|
2007-08-20 01:20:48 +00:00
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-09-12 02:14:07 +00:00
|
|
|
BOARD_ITEM* DrawStruct = GetCurItem();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
DrawPanel->CursorOff( DC );
|
|
|
|
if( m_ID_current_state == 0 )
|
|
|
|
{
|
2007-10-16 19:05:33 +00:00
|
|
|
if( DrawStruct && DrawStruct->m_Flags ) // Command in progress
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2007-09-01 12:00:30 +00:00
|
|
|
switch( DrawStruct->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_TEXTE_MODULE:
|
2009-01-05 05:21:35 +00:00
|
|
|
SaveCopyInUndoList( GetBoard()->m_Modules );
|
2007-08-20 01:20:48 +00:00
|
|
|
PlaceTexteModule( (TEXTE_MODULE*) DrawStruct, DC );
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_EDGE_MODULE:
|
2009-01-05 05:21:35 +00:00
|
|
|
SaveCopyInUndoList( GetBoard()->m_Modules );
|
2007-08-20 01:20:48 +00:00
|
|
|
Place_EdgeMod( (EDGE_MODULE*) DrawStruct, DC );
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_PAD:
|
2007-08-20 01:20:48 +00:00
|
|
|
PlacePad( (D_PAD*) DrawStruct, DC );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
msg.Printf(
|
|
|
|
wxT(
|
|
|
|
"WinEDA_ModEditFrame::ProcessCommand err: m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
|
2007-09-01 12:00:30 +00:00
|
|
|
DrawStruct, DrawStruct->Type(), DrawStruct->m_Flags );
|
2007-08-20 01:20:48 +00:00
|
|
|
DisplayError( this, msg );
|
|
|
|
DrawStruct->m_Flags = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-09-12 02:14:07 +00:00
|
|
|
DrawStruct = GetCurItem();
|
2007-08-20 01:20:48 +00:00
|
|
|
if( !DrawStruct || (DrawStruct->m_Flags == 0) )
|
|
|
|
{
|
2007-10-27 18:05:50 +00:00
|
|
|
if( !wxGetKeyState(WXK_SHIFT) && !wxGetKeyState(WXK_ALT) &&
|
|
|
|
!wxGetKeyState(WXK_CONTROL) )
|
2007-10-16 19:05:33 +00:00
|
|
|
DrawStruct = ModeditLocateAndDisplay();
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( DrawStruct );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch( m_ID_current_state )
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_NO_SELECT_BUTT:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_PCB_CIRCLE_BUTT:
|
|
|
|
case ID_PCB_ARC_BUTT:
|
|
|
|
case ID_LINE_COMMENT_BUTT:
|
|
|
|
if( !DrawStruct || DrawStruct->m_Flags == 0 )
|
|
|
|
{
|
|
|
|
int shape = S_SEGMENT;
|
|
|
|
if( m_ID_current_state == ID_PCB_CIRCLE_BUTT )
|
|
|
|
shape = S_CIRCLE;
|
|
|
|
if( m_ID_current_state == ID_PCB_ARC_BUTT )
|
|
|
|
shape = S_ARC;
|
|
|
|
|
2008-04-17 16:25:29 +00:00
|
|
|
SetCurItem(
|
2007-08-20 01:20:48 +00:00
|
|
|
Begin_Edge_Module( (EDGE_MODULE*) NULL, DC, shape ) );
|
|
|
|
}
|
|
|
|
else if( (DrawStruct->m_Flags & IS_NEW) )
|
|
|
|
{
|
|
|
|
if( ( (EDGE_MODULE*) DrawStruct )->m_Shape == S_CIRCLE )
|
|
|
|
{
|
|
|
|
End_Edge_Module( (EDGE_MODULE*) DrawStruct, DC );
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( NULL );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
else if( ( (EDGE_MODULE*) DrawStruct )->m_Shape == S_ARC )
|
|
|
|
{
|
|
|
|
End_Edge_Module( (EDGE_MODULE*) DrawStruct, DC );
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( NULL );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
else if( ( (EDGE_MODULE*) DrawStruct )->m_Shape == S_SEGMENT )
|
|
|
|
{
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem(
|
2007-08-20 01:20:48 +00:00
|
|
|
Begin_Edge_Module( (EDGE_MODULE*) DrawStruct, DC, 0 ) );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
DisplayError( this, wxT( "ProcessCommand error: DrawStruct/ flags error" ) );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MODEDIT_DELETE_ITEM_BUTT:
|
|
|
|
if( !DrawStruct || (DrawStruct->m_Flags == 0) )
|
|
|
|
{
|
|
|
|
DrawStruct = ModeditLocateAndDisplay();
|
|
|
|
if( DrawStruct && (DrawStruct->m_Flags == 0) )
|
|
|
|
{
|
2009-01-05 05:21:35 +00:00
|
|
|
SaveCopyInUndoList( GetBoard()->m_Modules );
|
2007-08-20 01:20:48 +00:00
|
|
|
RemoveStruct( DrawStruct, DC );
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( DrawStruct = NULL );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MODEDIT_PLACE_ANCHOR:
|
2009-01-05 05:21:35 +00:00
|
|
|
SaveCopyInUndoList( GetBoard()->m_Modules );
|
|
|
|
Place_Ancre( GetBoard()->m_Modules, DC );
|
|
|
|
GetBoard()->m_Modules->m_Flags = 0;
|
2008-04-17 16:25:29 +00:00
|
|
|
GetScreen()->m_Curseur = wxPoint( 0, 0 );
|
2007-08-20 01:20:48 +00:00
|
|
|
Recadre_Trace( TRUE );
|
2009-01-05 05:21:35 +00:00
|
|
|
Place_Module( GetBoard()->m_Modules, DC );
|
2007-08-20 01:20:48 +00:00
|
|
|
RedrawActiveWindow( DC, TRUE );
|
|
|
|
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( NULL );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_TEXT_COMMENT_BUTT:
|
2009-01-05 05:21:35 +00:00
|
|
|
SaveCopyInUndoList( GetBoard()->m_Modules );
|
|
|
|
CreateTextModule( GetBoard()->m_Modules, DC );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MODEDIT_ADD_PAD:
|
2009-01-05 05:21:35 +00:00
|
|
|
if( GetBoard()->m_Modules )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2009-01-05 05:21:35 +00:00
|
|
|
SaveCopyInUndoList( GetBoard()->m_Modules );
|
|
|
|
AddPad( GetBoard()->m_Modules, true );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
DrawPanel->SetCursor( wxCURSOR_ARROW );
|
|
|
|
DisplayError( this, wxT( "WinEDA_ModuleEditFrame::ProcessCommand error" ) );
|
|
|
|
m_ID_current_state = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
DrawPanel->CursorOn( DC );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************************************/
|
2007-10-07 18:24:15 +00:00
|
|
|
bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
|
2007-08-20 01:20:48 +00:00
|
|
|
wxMenu* PopMenu )
|
2007-05-06 16:03:28 +00:00
|
|
|
/*********************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2007-10-16 19:05:33 +00:00
|
|
|
/* Handle the right click in the footprint editor:
|
|
|
|
* Create the pull up menu
|
|
|
|
* After this menu is built, the standart ZOOM menu is added
|
2007-08-20 01:20:48 +00:00
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-09-12 02:14:07 +00:00
|
|
|
BOARD_ITEM* DrawStruct = GetCurItem();
|
2007-08-20 01:20:48 +00:00
|
|
|
wxString msg;
|
|
|
|
bool append_set_width = FALSE;
|
2008-04-17 16:25:29 +00:00
|
|
|
bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE);
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
// Simple localisation des elements si possible
|
|
|
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
|
|
|
{
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( DrawStruct = ModeditLocateAndDisplay() );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Si commande en cours: affichage fin de commande
|
|
|
|
if( m_ID_current_state )
|
|
|
|
{
|
|
|
|
if( DrawStruct && DrawStruct->m_Flags )
|
|
|
|
{
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
|
|
|
|
_( "Cancel" ), cancel_xpm );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_CLOSE_CURRENT_TOOL,
|
|
|
|
_( "End Tool" ), cancel_tool_xpm );
|
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( (DrawStruct && DrawStruct->m_Flags) || BlockActive )
|
|
|
|
{
|
|
|
|
if( BlockActive ) // Put block commnands in list
|
|
|
|
{
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
|
|
|
|
_( "Cancel Block" ), cancel_xpm );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_ZOOM_BLOCK,
|
2008-04-03 19:38:24 +00:00
|
|
|
_( "Zoom Block (drag middle mouse)" ), zoom_selected_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_PLACE_BLOCK,
|
|
|
|
_( "Place Block" ), apply_xpm );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_COPY_BLOCK,
|
|
|
|
_( "Copy Block (shift + drag mouse)" ), copyblock_xpm );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_MIRROR_X_BLOCK,
|
|
|
|
_( "Mirror Block (alt + drag mouse)" ), mirror_H_xpm );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_ROTATE_BLOCK,
|
|
|
|
_( "Rotate Block (ctrl + drag mouse)" ), rotate_pos_xpm );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_DELETE_BLOCK,
|
|
|
|
_( "Delete Block (shift+ctrl + drag mouse)" ), delete_xpm );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
|
|
|
|
_( "Cancel" ), cancel_xpm );
|
|
|
|
}
|
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( DrawStruct == NULL )
|
2007-10-07 18:24:15 +00:00
|
|
|
return true;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
int flags = DrawStruct->m_Flags;
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
switch( DrawStruct->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_MODULE:
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
wxMenu* transform_choice = new wxMenu;
|
|
|
|
ADD_MENUITEM( transform_choice, ID_MODEDIT_MODULE_ROTATE,
|
|
|
|
_( "Rotate" ), rotate_module_pos_xpm );
|
|
|
|
ADD_MENUITEM( transform_choice, ID_MODEDIT_MODULE_MIRROR,
|
|
|
|
_( "Mirror" ), mirror_H_xpm );
|
2007-05-06 16:03:28 +00:00
|
|
|
#if 0
|
2007-08-20 01:20:48 +00:00
|
|
|
transform_choice->Append( ID_MODEDIT_MODULE_SCALE, _( "Scale" ) );
|
|
|
|
transform_choice->Append( ID_MODEDIT_MODULE_SCALE, _( "Scale X" ) );
|
|
|
|
transform_choice->Append( ID_MODEDIT_MODULE_SCALE, _( "Scale Y" ) );
|
2007-05-06 16:03:28 +00:00
|
|
|
#endif
|
2007-08-20 01:20:48 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_MODULE,
|
2008-05-22 14:28:18 +00:00
|
|
|
_( "Edit Module" ), edit_module_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
ADD_MENUITEM_WITH_SUBMENU( PopMenu, transform_choice,
|
|
|
|
ID_MODEDIT_TRANSFORM_MODULE,
|
|
|
|
_( "Transform Module" ), edit_xpm );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_PAD:
|
2007-08-20 01:20:48 +00:00
|
|
|
if( !flags )
|
|
|
|
{
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_PAD_REQUEST,
|
|
|
|
_( "Move Pad" ), move_pad_xpm );
|
|
|
|
}
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_PAD, _( "Edit Pad" ), options_pad_xpm );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_IMPORT_PAD_SETTINGS,
|
|
|
|
_( "New Pad Settings" ), options_new_pad_xpm );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EXPORT_PAD_SETTINGS,
|
2008-05-22 14:28:18 +00:00
|
|
|
_( "Export Pad Settings" ), export_options_pad_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DELETE_PAD,
|
2008-05-22 14:28:18 +00:00
|
|
|
_( "delete Pad" ), delete_pad_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
if( !flags )
|
|
|
|
{
|
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS,
|
|
|
|
_( "Global Pad Settings" ), global_options_pad_xpm );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_TEXTE_MODULE:
|
2007-08-20 01:20:48 +00:00
|
|
|
if( !flags )
|
|
|
|
{
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST,
|
2008-05-05 18:52:43 +00:00
|
|
|
_( "Move Text Mod." ), move_field_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_ROTATE_TEXTMODULE,
|
2008-05-05 18:52:43 +00:00
|
|
|
_( "Rotate Text Mod." ), rotate_field_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TEXTMODULE,
|
|
|
|
_( "Edit Text Mod." ), edit_text_xpm );
|
|
|
|
if( ( (TEXTE_MODULE*) DrawStruct )->m_Type == TEXT_is_DIVERS )
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DELETE_TEXTMODULE,
|
|
|
|
_( "Delete Text Mod." ), delete_text_xpm );
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_EDGE_MODULE:
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
if( (flags & IS_NEW) )
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_STOP_CURRENT_DRAWING,
|
|
|
|
_( "End edge" ), apply_xpm );
|
|
|
|
if( !flags )
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_EDGE,
|
|
|
|
_( "Move edge" ), move_line_xpm );
|
|
|
|
if( ( flags & (IS_NEW | IS_MOVED) ) == IS_MOVED )
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_PLACE_EDGE,
|
|
|
|
_( "Place edge" ), apply_xpm );
|
|
|
|
wxMenu* edit_mnu = new wxMenu;
|
|
|
|
ADD_MENUITEM_WITH_SUBMENU( PopMenu, edit_mnu,
|
|
|
|
ID_POPUP_PCB_EDIT_EDGE, _( "Edit" ), edit_xpm );
|
|
|
|
ADD_MENUITEM( edit_mnu, ID_POPUP_PCB_EDIT_WIDTH_CURRENT_EDGE,
|
|
|
|
_( "Edit Width (Current)" ), width_segment_xpm );
|
|
|
|
ADD_MENUITEM( edit_mnu, ID_POPUP_PCB_EDIT_WIDTH_ALL_EDGE,
|
|
|
|
_( "Edit Width (All)" ), width_segment_xpm );
|
|
|
|
ADD_MENUITEM( edit_mnu, ID_POPUP_PCB_EDIT_LAYER_CURRENT_EDGE,
|
|
|
|
_( "Edit Layer (Current)" ), select_layer_pair_xpm );
|
|
|
|
ADD_MENUITEM( edit_mnu, ID_POPUP_PCB_EDIT_LAYER_ALL_EDGE,
|
|
|
|
_( "Edit Layer (All)" ), select_layer_pair_xpm );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DELETE_EDGE,
|
|
|
|
_( "Delete edge" ), delete_xpm );
|
|
|
|
append_set_width = TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_DRAWSEGMENT:
|
|
|
|
case TYPE_TEXTE:
|
|
|
|
case TYPE_VIA:
|
|
|
|
case TYPE_TRACK:
|
|
|
|
case TYPE_ZONE:
|
|
|
|
case TYPE_MARKER:
|
|
|
|
case TYPE_COTATION:
|
|
|
|
case TYPE_MIRE:
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_SCREEN:
|
2007-08-20 01:20:48 +00:00
|
|
|
case TYPE_NOT_INIT:
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_PCB:
|
|
|
|
case TYPE_EQUIPOT:
|
2007-08-20 01:20:48 +00:00
|
|
|
msg.Printf(
|
|
|
|
wxT( "WinEDA_ModuleEditFrame::OnRightClick Error: illegal DrawType %d" ),
|
2007-09-01 12:00:30 +00:00
|
|
|
DrawStruct->Type() );
|
2007-08-20 01:20:48 +00:00
|
|
|
DisplayError( this, msg );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
msg.Printf(
|
|
|
|
wxT( "WinEDA_ModuleEditFrame::OnRightClick Error: unknown DrawType %d" ),
|
2007-09-01 12:00:30 +00:00
|
|
|
DrawStruct->Type() );
|
2007-08-20 01:20:48 +00:00
|
|
|
DisplayError( this, msg );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
|
|
|
|
if( append_set_width
|
|
|
|
|| ( m_ID_current_state && ( (m_ID_current_state == ID_LINE_COMMENT_BUTT)
|
|
|
|
|| (m_ID_current_state == ID_PCB_CIRCLE_BUTT)
|
|
|
|
|| (m_ID_current_state == ID_PCB_ARC_BUTT) ) ) )
|
|
|
|
{
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_ENTER_EDGE_WIDTH,
|
|
|
|
_( "Set Width" ), width_segment_xpm );
|
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
}
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
|
|
return true;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/****************************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
2007-05-06 16:03:28 +00:00
|
|
|
/****************************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2007-10-16 19:05:33 +00:00
|
|
|
/* Handle the double click in the footprin editor:
|
|
|
|
* If the double clicked item is editable: call the corresponding editor.
|
2007-08-20 01:20:48 +00:00
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-09-12 02:14:07 +00:00
|
|
|
BOARD_ITEM* DrawStruct = GetCurItem();
|
2007-08-20 01:20:48 +00:00
|
|
|
wxPoint pos = GetPosition();
|
|
|
|
wxClientDC dc( DrawPanel );
|
|
|
|
|
|
|
|
DrawPanel->PrepareGraphicContext( &dc );
|
|
|
|
|
|
|
|
switch( m_ID_current_state )
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
|
|
|
{
|
2007-10-16 19:05:33 +00:00
|
|
|
DrawStruct = ModeditLocateAndDisplay();
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags != 0) )
|
|
|
|
break;
|
|
|
|
|
2007-10-16 19:05:33 +00:00
|
|
|
// Item found
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( DrawStruct );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
switch( DrawStruct->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_PAD:
|
2007-08-20 01:20:48 +00:00
|
|
|
InstallPadOptionsFrame(
|
|
|
|
(D_PAD*) DrawStruct, &dc, pos );
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_MODULE:
|
2007-08-20 01:20:48 +00:00
|
|
|
InstallModuleOptionsFrame( (MODULE*) DrawStruct,
|
|
|
|
&dc, pos );
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_TEXTE_MODULE:
|
2007-08-20 01:20:48 +00:00
|
|
|
InstallTextModOptionsFrame( (TEXTE_MODULE*) DrawStruct,
|
|
|
|
&dc, pos );
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
break; // end case 0
|
|
|
|
|
|
|
|
case ID_LINE_COMMENT_BUTT:
|
|
|
|
{
|
|
|
|
if( DrawStruct && (DrawStruct->m_Flags & IS_NEW) )
|
|
|
|
{
|
|
|
|
End_Edge_Module( (EDGE_MODULE*) DrawStruct, DC );
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( NULL );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|