2011-09-23 13:57:12 +00:00
|
|
|
/**
|
|
|
|
* @file modedit_onclick.cpp
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
|
|
|
#include "confirm.h"
|
2009-08-11 10:27:21 +00:00
|
|
|
#include "3d_viewer.h"
|
2009-07-30 11:04:07 +00:00
|
|
|
#include "wxPcbStruct.h"
|
2011-09-23 13:57:12 +00:00
|
|
|
#include "gr_basic.h"
|
|
|
|
|
|
|
|
#include "class_board.h"
|
|
|
|
#include "class_module.h"
|
|
|
|
#include "class_edge_mod.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
#include "pcbnew.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
#include "protos.h"
|
2009-09-22 12:27:57 +00:00
|
|
|
#include "pcbnew_id.h"
|
2010-08-29 17:55:53 +00:00
|
|
|
#include "hotkeys.h"
|
2011-09-23 13:57:12 +00:00
|
|
|
#include "module_editor_frame.h"
|
|
|
|
#include "dialog_edit_module_for_Modedit.h"
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-08-26 17:01:17 +00:00
|
|
|
|
|
|
|
void FOOTPRINT_EDIT_FRAME::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2011-01-26 07:43:59 +00:00
|
|
|
BOARD_ITEM* item = GetCurItem();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->CrossHairOff( DC );
|
2011-02-23 13:48:19 +00:00
|
|
|
|
2011-02-24 20:22:12 +00:00
|
|
|
if( GetToolId() == ID_NO_TOOL_SELECTED )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-12-21 13:42:02 +00:00
|
|
|
if( item && item->GetFlags() ) // Move item command in progress
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-24 12:35:14 +00:00
|
|
|
switch( item->Type() )
|
|
|
|
{
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MODULE_TEXT_T:
|
2011-02-24 12:35:14 +00:00
|
|
|
PlaceTexteModule( (TEXTE_MODULE*) item, DC );
|
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MODULE_EDGE_T:
|
2011-02-24 12:35:14 +00:00
|
|
|
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
|
|
|
|
Place_EdgeMod( (EDGE_MODULE*) item );
|
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_PAD_T:
|
2011-02-24 12:35:14 +00:00
|
|
|
PlacePad( (D_PAD*) item, DC );
|
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-02-24 12:35:14 +00:00
|
|
|
default:
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
msg.Printf( wxT( "WinEDA_ModEditFrame::OnLeftClick err:Struct %d, m_Flag %X" ),
|
2011-12-21 13:42:02 +00:00
|
|
|
item->Type(), item->GetFlags() );
|
2011-02-24 12:35:14 +00:00
|
|
|
DisplayError( this, msg );
|
2011-12-21 13:42:02 +00:00
|
|
|
item->ClearFlags();
|
2011-02-24 12:35:14 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-26 07:43:59 +00:00
|
|
|
item = GetCurItem();
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2011-12-21 13:42:02 +00:00
|
|
|
if( !item || (item->GetFlags() == 0) )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2009-08-11 14:10:34 +00:00
|
|
|
if( !wxGetKeyState( WXK_SHIFT ) && !wxGetKeyState( WXK_ALT )
|
|
|
|
&& !wxGetKeyState( WXK_CONTROL ) )
|
2011-01-26 07:43:59 +00:00
|
|
|
item = ModeditLocateAndDisplay();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-01-26 07:43:59 +00:00
|
|
|
SetCurItem( item );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2011-02-24 20:22:12 +00:00
|
|
|
switch( GetToolId() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-24 20:22:12 +00:00
|
|
|
case ID_NO_TOOL_SELECTED:
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
case ID_MODEDIT_CIRCLE_TOOL:
|
|
|
|
case ID_MODEDIT_ARC_TOOL:
|
|
|
|
case ID_MODEDIT_LINE_TOOL:
|
2011-12-21 13:42:02 +00:00
|
|
|
if( !item || item->GetFlags() == 0 )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
int shape = S_SEGMENT;
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2011-02-24 20:22:12 +00:00
|
|
|
if( GetToolId() == ID_MODEDIT_CIRCLE_TOOL )
|
2007-08-20 01:20:48 +00:00
|
|
|
shape = S_CIRCLE;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-02-24 20:22:12 +00:00
|
|
|
if( GetToolId() == ID_MODEDIT_ARC_TOOL )
|
2007-08-20 01:20:48 +00:00
|
|
|
shape = S_ARC;
|
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
SetCurItem( Begin_Edge_Module( (EDGE_MODULE*) NULL, DC, shape ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2011-02-21 13:54:29 +00:00
|
|
|
else if( item->IsNew() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-12-14 04:29:25 +00:00
|
|
|
if( ( (EDGE_MODULE*) item )->GetShape() == S_CIRCLE )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-01-26 07:43:59 +00:00
|
|
|
End_Edge_Module( (EDGE_MODULE*) item );
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( NULL );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh();
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2011-12-14 04:29:25 +00:00
|
|
|
else if( ( (EDGE_MODULE*) item )->GetShape() == S_ARC )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-01-26 07:43:59 +00:00
|
|
|
End_Edge_Module( (EDGE_MODULE*) item );
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( NULL );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh();
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2011-12-14 04:29:25 +00:00
|
|
|
else if( ( (EDGE_MODULE*) item )->GetShape() == S_SEGMENT )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-21 13:54:29 +00:00
|
|
|
SetCurItem( Begin_Edge_Module( (EDGE_MODULE*) item, DC, 0 ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
else
|
2011-08-26 17:01:17 +00:00
|
|
|
{
|
2011-02-21 13:54:29 +00:00
|
|
|
DisplayError( this, wxT( "ProcessCommand error: item flags error" ) );
|
2011-08-26 17:01:17 +00:00
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
case ID_MODEDIT_DELETE_TOOL:
|
2011-12-21 13:42:02 +00:00
|
|
|
if( item == NULL || // No item to delete
|
|
|
|
(item->GetFlags() != 0) ) // Item in edit, cannot delete it
|
2009-08-04 18:21:32 +00:00
|
|
|
break;
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
if( item->Type() != PCB_MODULE_T ) // Cannot delete the module itself
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2009-08-04 18:21:32 +00:00
|
|
|
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
|
2011-01-26 07:43:59 +00:00
|
|
|
RemoveStruct( item );
|
2009-08-04 18:21:32 +00:00
|
|
|
SetCurItem( NULL );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
case ID_MODEDIT_ANCHOR_TOOL:
|
2009-08-03 18:54:48 +00:00
|
|
|
{
|
2009-08-11 14:10:34 +00:00
|
|
|
MODULE* module = GetBoard()->m_Modules;
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2010-07-29 20:00:24 +00:00
|
|
|
if( module == NULL // No module loaded
|
2011-12-21 13:42:02 +00:00
|
|
|
|| (module->GetFlags() != 0) )
|
2010-07-29 20:00:24 +00:00
|
|
|
break;
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2011-12-21 13:42:02 +00:00
|
|
|
module->ClearFlags();
|
2009-08-03 18:54:48 +00:00
|
|
|
SaveCopyInUndoList( module, UR_MODEDIT );
|
2011-02-11 20:48:13 +00:00
|
|
|
Place_Ancre( module ); // set the new relatives internal coordinates of items
|
|
|
|
RedrawScreen( wxPoint( 0, 0 ), true );
|
2009-08-11 14:10:34 +00:00
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
// Replace the module in position 0, to recalculate absolutes coordinates of items
|
2009-08-11 14:10:34 +00:00
|
|
|
module->SetPosition( wxPoint( 0, 0 ) );
|
2011-12-22 13:28:11 +00:00
|
|
|
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( NULL );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh();
|
2009-08-03 18:54:48 +00:00
|
|
|
}
|
2009-08-11 14:10:34 +00:00
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
case ID_MODEDIT_PLACE_GRID_COORD:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->DrawGridAxis( DC, GR_XOR );
|
2011-02-11 20:48:13 +00:00
|
|
|
GetScreen()->m_GridOrigin = GetScreen()->GetCrossHairPosition();
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->DrawGridAxis( DC, GR_COPY );
|
2010-07-13 10:42:32 +00:00
|
|
|
GetScreen()->SetModify();
|
|
|
|
break;
|
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
case ID_MODEDIT_TEXT_TOOL:
|
2010-07-29 20:00:24 +00:00
|
|
|
if( GetBoard()->m_Modules == NULL )
|
|
|
|
break;
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2009-08-03 18:54:48 +00:00
|
|
|
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
|
2009-01-05 05:21:35 +00:00
|
|
|
CreateTextModule( GetBoard()->m_Modules, DC );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
case ID_MODEDIT_PAD_TOOL:
|
2009-01-05 05:21:35 +00:00
|
|
|
if( GetBoard()->m_Modules )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2009-08-03 18:54:48 +00:00
|
|
|
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
|
2009-01-05 05:21:35 +00:00
|
|
|
AddPad( GetBoard()->m_Modules, true );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2011-08-26 17:01:17 +00:00
|
|
|
DisplayError( this, wxT( "FOOTPRINT_EDIT_FRAME::ProcessCommand error" ) );
|
2011-12-22 13:28:11 +00:00
|
|
|
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->CrossHairOn( DC );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-08-26 17:01:17 +00:00
|
|
|
bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2011-01-26 07:43:59 +00:00
|
|
|
BOARD_ITEM* item = GetCurItem();
|
2009-08-11 14:10:34 +00:00
|
|
|
wxString msg;
|
2011-09-07 19:41:04 +00:00
|
|
|
bool append_set_width = false;
|
2011-01-26 07:43:59 +00:00
|
|
|
bool blockActive = GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2009-11-18 12:52:19 +00:00
|
|
|
// Simple location of elements where possible.
|
2011-12-21 13:42:02 +00:00
|
|
|
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-01-26 07:43:59 +00:00
|
|
|
SetCurItem( item = ModeditLocateAndDisplay() );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2009-11-18 12:52:19 +00:00
|
|
|
// End command in progress.
|
2011-02-24 20:22:12 +00:00
|
|
|
if( GetToolId() != ID_NO_TOOL_SELECTED )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-12-21 13:42:02 +00:00
|
|
|
if( item && item->GetFlags() )
|
|
|
|
AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ),
|
|
|
|
KiBitmap( cancel_xpm ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
else
|
2011-12-21 13:42:02 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_CLOSE_CURRENT_TOOL, _( "End Tool" ),
|
|
|
|
KiBitmap( cancel_tool_xpm ) );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-12-21 13:42:02 +00:00
|
|
|
if( (item && item->GetFlags()) || blockActive )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-01-26 07:43:59 +00:00
|
|
|
if( blockActive ) // Put block commands in list
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "Cancel Block" ), KiBitmap( cancel_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_ZOOM_BLOCK,
|
|
|
|
_( "Zoom Block (drag middle mouse)" ),
|
2011-09-08 05:58:45 +00:00
|
|
|
KiBitmap( zoom_area_xpm ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
PopMenu->AppendSeparator();
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_PLACE_BLOCK,
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "Place Block" ), KiBitmap( apply_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_COPY_BLOCK,
|
|
|
|
_( "Copy Block (shift + drag mouse)" ),
|
2011-09-08 05:58:45 +00:00
|
|
|
KiBitmap( copyblock_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_MIRROR_X_BLOCK,
|
|
|
|
_( "Mirror Block (alt + drag mouse)" ),
|
2011-09-08 05:58:45 +00:00
|
|
|
KiBitmap( mirror_h_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_ROTATE_BLOCK,
|
|
|
|
_( "Rotate Block (ctrl + drag mouse)" ),
|
2011-09-08 05:58:45 +00:00
|
|
|
KiBitmap( rotate_ccw_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_DELETE_BLOCK,
|
|
|
|
_( "Delete Block (shift+ctrl + drag mouse)" ),
|
2011-09-08 05:58:45 +00:00
|
|
|
KiBitmap( delete_xpm ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "Cancel" ), KiBitmap( cancel_xpm ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-26 07:43:59 +00:00
|
|
|
if( (item == NULL) || blockActive )
|
2007-10-07 18:24:15 +00:00
|
|
|
return true;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-12-21 13:42:02 +00:00
|
|
|
int flags = item->GetFlags();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-01-26 07:43:59 +00:00
|
|
|
switch( item->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MODULE_T:
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
wxMenu* transform_choice = new wxMenu;
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( transform_choice, ID_MODEDIT_MODULE_ROTATE, _( "Rotate" ),
|
2011-09-08 05:58:45 +00:00
|
|
|
KiBitmap( rotate_module_pos_xpm ) );
|
2011-12-21 13:42:02 +00:00
|
|
|
AddMenuItem( transform_choice, ID_MODEDIT_MODULE_MIRROR, _( "Mirror" ),
|
|
|
|
KiBitmap( mirror_h_xpm ) );
|
2011-02-21 13:54:29 +00:00
|
|
|
msg = AddHotkeyName( _( "Edit Module" ), g_Module_Editor_Hokeys_Descr, HK_EDIT_ITEM );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_PCB_EDIT_MODULE, msg, KiBitmap( edit_module_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( PopMenu, transform_choice, ID_MODEDIT_TRANSFORM_MODULE,
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "Transform Module" ), KiBitmap( edit_xpm ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_PAD_T:
|
2007-08-20 01:20:48 +00:00
|
|
|
if( !flags )
|
|
|
|
{
|
2011-02-21 13:54:29 +00:00
|
|
|
msg = AddHotkeyName( _("Move Pad" ), g_Module_Editor_Hokeys_Descr, HK_MOVE_ITEM );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_PCB_MOVE_PAD_REQUEST, msg, KiBitmap( move_pad_xpm ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2011-02-21 13:54:29 +00:00
|
|
|
|
|
|
|
msg = AddHotkeyName( _("Edit Pad" ), g_Module_Editor_Hokeys_Descr, HK_EDIT_ITEM );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_PCB_EDIT_PAD, msg, KiBitmap( options_pad_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_PCB_IMPORT_PAD_SETTINGS,
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "New Pad Settings" ), KiBitmap( options_new_pad_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_PCB_EXPORT_PAD_SETTINGS,
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "Export Pad Settings" ), KiBitmap( export_options_pad_xpm ) );
|
2011-02-21 13:54:29 +00:00
|
|
|
msg = AddHotkeyName( _("Delete Pad" ), g_Module_Editor_Hokeys_Descr, HK_DELETE );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_PCB_DELETE_PAD, msg, KiBitmap( delete_pad_xpm ) );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
if( !flags )
|
|
|
|
{
|
|
|
|
PopMenu->AppendSeparator();
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS,
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "Global Pad Settings" ), KiBitmap( global_options_pad_xpm ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MODULE_TEXT_T:
|
2007-08-20 01:20:48 +00:00
|
|
|
if( !flags )
|
|
|
|
{
|
2010-11-24 15:10:33 +00:00
|
|
|
msg = AddHotkeyName( _("Move Text Mod." ), g_Module_Editor_Hokeys_Descr,
|
2010-08-29 17:55:53 +00:00
|
|
|
HK_MOVE_ITEM );
|
2011-10-01 19:24:27 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST, msg,
|
|
|
|
KiBitmap( move_field_xpm ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2010-11-24 15:10:33 +00:00
|
|
|
msg = AddHotkeyName( _("Rotate Text Mod." ), g_Module_Editor_Hokeys_Descr,
|
2010-08-29 17:55:53 +00:00
|
|
|
HK_ROTATE_ITEM );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_PCB_ROTATE_TEXTMODULE, msg, KiBitmap( rotate_field_xpm ) );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2009-08-11 14:10:34 +00:00
|
|
|
if( !flags )
|
|
|
|
{
|
2010-11-24 15:10:33 +00:00
|
|
|
msg = AddHotkeyName( _("Edit Text Mod." ), g_Module_Editor_Hokeys_Descr,
|
2010-08-29 17:55:53 +00:00
|
|
|
HK_EDIT_ITEM );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_PCB_EDIT_TEXTMODULE, msg, KiBitmap( edit_text_xpm ) );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2011-12-12 08:37:05 +00:00
|
|
|
if( ( (TEXTE_MODULE*) item )->GetType() == TEXT_is_DIVERS )
|
2010-08-29 17:55:53 +00:00
|
|
|
{
|
2010-11-24 15:10:33 +00:00
|
|
|
msg = AddHotkeyName( _("Delete Text Mod." ), g_Module_Editor_Hokeys_Descr,
|
2010-08-29 17:55:53 +00:00
|
|
|
HK_DELETE );
|
2011-10-01 19:24:27 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_PCB_DELETE_TEXTMODULE, msg,
|
|
|
|
KiBitmap( delete_text_xpm ) );
|
2010-08-29 17:55:53 +00:00
|
|
|
}
|
2009-08-11 14:10:34 +00:00
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MODULE_EDGE_T:
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
if( (flags & IS_NEW) )
|
2011-10-01 19:24:27 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_PCB_STOP_CURRENT_DRAWING, _( "End edge" ),
|
|
|
|
KiBitmap( apply_xpm ) );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
if( !flags )
|
2010-08-29 17:55:53 +00:00
|
|
|
{
|
2011-02-21 13:54:29 +00:00
|
|
|
msg = AddHotkeyName( _("Move edge" ), g_Module_Editor_Hokeys_Descr, HK_MOVE_ITEM );
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_PCB_MOVE_EDGE, msg, KiBitmap( move_line_xpm ) );
|
2010-08-29 17:55:53 +00:00
|
|
|
}
|
2011-09-01 12:54:34 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
if( ( flags & (IS_NEW | IS_MOVED) ) == IS_MOVED )
|
2011-10-01 19:24:27 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_PCB_PLACE_EDGE, _( "Place edge" ),
|
|
|
|
KiBitmap( apply_xpm ) );
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
wxMenu* edit_mnu = new wxMenu;
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, edit_mnu, ID_POPUP_PCB_EDIT_EDGE, _( "Edit" ), KiBitmap( edit_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( edit_mnu, ID_POPUP_PCB_EDIT_WIDTH_CURRENT_EDGE,
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "Edit Width (Current)" ), KiBitmap( width_segment_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( edit_mnu, ID_POPUP_PCB_EDIT_WIDTH_ALL_EDGE,
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "Edit Width (All)" ), KiBitmap( width_segment_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( edit_mnu, ID_POPUP_PCB_EDIT_LAYER_CURRENT_EDGE,
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "Edit Layer (Current)" ), KiBitmap( select_layer_pair_xpm ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( edit_mnu, ID_POPUP_PCB_EDIT_LAYER_ALL_EDGE,
|
2011-09-08 05:58:45 +00:00
|
|
|
_( "Edit Layer (All)" ), KiBitmap( select_layer_pair_xpm ) );
|
2011-02-21 13:54:29 +00:00
|
|
|
msg = AddHotkeyName( _("Delete edge" ), g_Module_Editor_Hokeys_Descr, HK_DELETE );
|
2011-09-08 06:20:13 +00:00
|
|
|
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_PCB_DELETE_EDGE, msg, KiBitmap( delete_xpm ) );
|
2011-09-07 19:41:04 +00:00
|
|
|
append_set_width = true;
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2009-08-11 14:10:34 +00:00
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_LINE_T:
|
|
|
|
case PCB_TEXT_T:
|
|
|
|
case PCB_VIA_T:
|
|
|
|
case PCB_TRACE_T:
|
|
|
|
case PCB_ZONE_T:
|
|
|
|
case PCB_MARKER_T:
|
|
|
|
case PCB_DIMENSION_T:
|
2011-09-07 19:41:04 +00:00
|
|
|
case PCB_TARGET_T:
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case SCREEN_T:
|
2007-08-20 01:20:48 +00:00
|
|
|
case TYPE_NOT_INIT:
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_T:
|
2011-08-26 17:01:17 +00:00
|
|
|
msg.Printf( wxT( "FOOTPRINT_EDIT_FRAME::OnRightClick Error: illegal DrawType %d" ),
|
|
|
|
item->Type() );
|
2007-08-20 01:20:48 +00:00
|
|
|
DisplayError( this, msg );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2011-08-26 17:01:17 +00:00
|
|
|
msg.Printf( wxT( "FOOTPRINT_EDIT_FRAME::OnRightClick Error: unknown DrawType %d" ),
|
|
|
|
item->Type() );
|
2007-08-20 01:20:48 +00:00
|
|
|
DisplayError( this, msg );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
|
|
|
|
if( append_set_width
|
2011-02-24 20:22:12 +00:00
|
|
|
|| ( ( GetToolId() != ID_NO_TOOL_SELECTED )
|
|
|
|
&& ( ( GetToolId() == ID_PCB_ADD_LINE_BUTT )
|
|
|
|
|| ( GetToolId() == ID_PCB_CIRCLE_BUTT )
|
|
|
|
|| ( GetToolId() == ID_PCB_ARC_BUTT ) ) ) )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-09-08 05:58:45 +00:00
|
|
|
AddMenuItem( PopMenu, ID_POPUP_PCB_ENTER_EDGE_WIDTH, _("Set Width" ), KiBitmap( width_segment_xpm ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
}
|
2008-04-17 16:25:29 +00:00
|
|
|
|
|
|
|
return true;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-08-26 17:01:17 +00:00
|
|
|
void FOOTPRINT_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2011-01-26 07:43:59 +00:00
|
|
|
BOARD_ITEM* item = GetCurItem();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-02-24 20:22:12 +00:00
|
|
|
switch( GetToolId() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-24 20:22:12 +00:00
|
|
|
case ID_NO_TOOL_SELECTED:
|
2011-12-21 13:42:02 +00:00
|
|
|
if( ( item == NULL ) || ( item->GetFlags() == 0 ) )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-01-26 07:43:59 +00:00
|
|
|
item = ModeditLocateAndDisplay();
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
|
2011-12-21 13:42:02 +00:00
|
|
|
if( ( item == NULL ) || ( item->GetFlags() != 0 ) )
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2007-10-16 19:05:33 +00:00
|
|
|
// Item found
|
2011-01-26 07:43:59 +00:00
|
|
|
SetCurItem( item );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-01-26 07:43:59 +00:00
|
|
|
switch( item->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_PAD_T:
|
2011-01-26 07:43:59 +00:00
|
|
|
InstallPadOptionsFrame( (D_PAD*) item );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MODULE_T:
|
2009-08-11 10:27:21 +00:00
|
|
|
{
|
2011-01-26 07:43:59 +00:00
|
|
|
DIALOG_MODULE_MODULE_EDITOR dialog( this, (MODULE*) item );
|
2009-08-11 10:27:21 +00:00
|
|
|
int ret = dialog.ShowModal();
|
2011-12-21 13:42:02 +00:00
|
|
|
GetScreen()->GetCurItem()->ClearFlags();
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2009-08-11 10:27:21 +00:00
|
|
|
if( ret > 0 )
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh();
|
2009-08-11 10:27:21 +00:00
|
|
|
}
|
2009-08-11 14:10:34 +00:00
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
case PCB_MODULE_TEXT_T:
|
2011-01-26 07:43:59 +00:00
|
|
|
InstallTextModOptionsFrame( (TEXTE_MODULE*) item, DC );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
break; // end case 0
|
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
case ID_PCB_ADD_LINE_BUTT:
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-02-21 13:54:29 +00:00
|
|
|
if( item && item->IsNew() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-01-26 07:43:59 +00:00
|
|
|
End_Edge_Module( (EDGE_MODULE*) item );
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( NULL );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh();
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2011-09-01 12:54:34 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|