2007-08-20 01:20:48 +00:00
|
|
|
/************************/
|
|
|
|
/* modedit_onclick.cpp */
|
|
|
|
/************************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
|
|
|
#include "confirm.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-08-11 10:27:21 +00:00
|
|
|
#include "3d_viewer.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
#include "pcbnew.h"
|
2009-07-30 11:04:07 +00:00
|
|
|
#include "wxPcbStruct.h"
|
2010-08-10 18:34:26 +00:00
|
|
|
#include "module_editor_frame.h"
|
2009-08-13 10:24:16 +00:00
|
|
|
#include "dialog_edit_module_for_Modedit.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
#include "bitmaps.h"
|
|
|
|
#include "protos.h"
|
2009-09-22 12:27:57 +00:00
|
|
|
#include "pcbnew_id.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2010-08-29 17:55:53 +00:00
|
|
|
#include "hotkeys.h"
|
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
|
|
|
*/
|
2009-11-18 12:52:19 +00:00
|
|
|
void WinEDA_ModuleEditFrame::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
|
|
|
|
|
|
|
DrawPanel->CursorOff( DC );
|
|
|
|
if( m_ID_current_state == 0 )
|
|
|
|
{
|
2011-01-26 07:43:59 +00:00
|
|
|
if( item && item->m_Flags ) // Command in progress
|
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
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_TEXTE_MODULE:
|
2011-01-26 07:43:59 +00:00
|
|
|
PlaceTexteModule( (TEXTE_MODULE*) item, DC );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_EDGE_MODULE:
|
2009-08-03 18:54:48 +00:00
|
|
|
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
|
2011-01-26 07:43:59 +00:00
|
|
|
Place_EdgeMod( (EDGE_MODULE*) item );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_PAD:
|
2011-01-26 07:43:59 +00:00
|
|
|
PlacePad( (D_PAD*) item, DC );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
wxString msg;
|
2009-11-18 12:52:19 +00:00
|
|
|
msg.Printf( wxT( "WinEDA_ModEditFrame::OnLeftClick err: \
|
|
|
|
m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
|
2011-01-26 07:43:59 +00:00
|
|
|
item, item->Type(), item->m_Flags );
|
2007-08-20 01:20:48 +00:00
|
|
|
DisplayError( this, msg );
|
2011-01-26 07:43:59 +00:00
|
|
|
item->m_Flags = 0;
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-26 07:43:59 +00:00
|
|
|
item = GetCurItem();
|
|
|
|
if( !item || (item->m_Flags == 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();
|
|
|
|
SetCurItem( item );
|
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:
|
2009-09-22 12:27:57 +00:00
|
|
|
case ID_PCB_ADD_LINE_BUTT:
|
2011-01-26 07:43:59 +00:00
|
|
|
if( !item || item->m_Flags == 0 )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
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(
|
2009-08-11 14:10:34 +00:00
|
|
|
Begin_Edge_Module( (EDGE_MODULE*) NULL, DC, shape ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2011-01-26 07:43:59 +00:00
|
|
|
else if( (item->m_Flags & IS_NEW) )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2011-01-26 07:43:59 +00:00
|
|
|
if( ( (EDGE_MODULE*) item )->m_Shape == 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 );
|
2010-07-20 18:11:34 +00:00
|
|
|
DrawPanel->Refresh();
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2011-01-26 07:43:59 +00:00
|
|
|
else if( ( (EDGE_MODULE*) item )->m_Shape == 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 );
|
2010-07-20 18:11:34 +00:00
|
|
|
DrawPanel->Refresh();
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2011-01-26 07:43:59 +00:00
|
|
|
else if( ( (EDGE_MODULE*) item )->m_Shape == S_SEGMENT )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem(
|
2011-01-26 07:43:59 +00:00
|
|
|
Begin_Edge_Module( (EDGE_MODULE*) item, DC, 0 ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
else
|
2009-11-18 12:52:19 +00:00
|
|
|
DisplayError( this,
|
2011-01-26 07:43:59 +00:00
|
|
|
wxT( "ProcessCommand error: item flags error" ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MODEDIT_DELETE_ITEM_BUTT:
|
2011-01-26 07:43:59 +00:00
|
|
|
if( item == NULL || // No item to delete
|
|
|
|
(item->m_Flags != 0) ) // Item in edit, cannot delete it
|
2009-08-04 18:21:32 +00:00
|
|
|
break;
|
2011-01-26 07:43:59 +00:00
|
|
|
if( item->Type() != TYPE_MODULE ) // 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
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MODEDIT_PLACE_ANCHOR:
|
2009-08-03 18:54:48 +00:00
|
|
|
{
|
2009-08-11 14:10:34 +00:00
|
|
|
MODULE* module = GetBoard()->m_Modules;
|
2010-07-29 20:00:24 +00:00
|
|
|
if( module == NULL // No module loaded
|
|
|
|
|| (module->m_Flags != 0) )
|
|
|
|
break;
|
2009-08-11 14:10:34 +00:00
|
|
|
module->m_Flags = 0;
|
2009-08-03 18:54:48 +00:00
|
|
|
SaveCopyInUndoList( module, UR_MODEDIT );
|
2009-11-18 12:52:19 +00:00
|
|
|
Place_Ancre( module ); // set the new relatives internal
|
|
|
|
// coordinates of items
|
2008-04-17 16:25:29 +00:00
|
|
|
GetScreen()->m_Curseur = wxPoint( 0, 0 );
|
2011-01-30 22:22:38 +00:00
|
|
|
RedrawScreen( TRUE );
|
2009-08-11 14:10:34 +00:00
|
|
|
|
2009-11-18 12:52:19 +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 ) );
|
2010-07-29 20:00:24 +00:00
|
|
|
SetToolID( 0, 0, wxEmptyString );
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( NULL );
|
2009-08-03 18:54:48 +00:00
|
|
|
DrawPanel->Refresh();
|
|
|
|
}
|
2009-08-11 14:10:34 +00:00
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2010-07-13 10:42:32 +00:00
|
|
|
case ID_PCB_PLACE_GRID_COORD_BUTT:
|
|
|
|
DrawPanel->DrawGridAxis( DC, GR_XOR );
|
|
|
|
GetScreen()->m_GridOrigin = GetScreen()->m_Curseur;
|
|
|
|
DrawPanel->DrawGridAxis( DC, GR_COPY );
|
|
|
|
GetScreen()->SetModify();
|
|
|
|
break;
|
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
case ID_PCB_ADD_TEXT_BUTT:
|
2010-07-29 20:00:24 +00:00
|
|
|
if( GetBoard()->m_Modules == NULL )
|
|
|
|
break;
|
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;
|
|
|
|
|
|
|
|
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-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
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2009-11-18 12:52:19 +00:00
|
|
|
DisplayError( this,
|
|
|
|
wxT( "WinEDA_ModuleEditFrame::ProcessCommand error" ) );
|
2010-07-29 20:00:24 +00:00
|
|
|
SetToolID( 0, 0, wxEmptyString );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
DrawPanel->CursorOn( DC );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-16 19:05:33 +00:00
|
|
|
/* Handle the right click in the footprint editor:
|
|
|
|
* Create the pull up menu
|
2009-11-18 12:52:19 +00:00
|
|
|
* After this menu is built, the standard ZOOM menu is added
|
2007-08-20 01:20:48 +00:00
|
|
|
*/
|
2009-11-18 12:52:19 +00:00
|
|
|
bool WinEDA_ModuleEditFrame::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;
|
|
|
|
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-01-26 07:43:59 +00:00
|
|
|
if( ( item == NULL ) || ( item->m_Flags == 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.
|
2007-08-20 01:20:48 +00:00
|
|
|
if( m_ID_current_state )
|
|
|
|
{
|
2011-01-26 07:43:59 +00:00
|
|
|
if( item && item->m_Flags )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
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
|
|
|
|
{
|
2011-01-26 07:43:59 +00:00
|
|
|
if( (item && item->m_Flags) || 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
|
|
|
{
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
|
|
|
|
_( "Cancel Block" ), cancel_xpm );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_ZOOM_BLOCK,
|
2009-11-18 12:52:19 +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,
|
2009-11-18 12:52:19 +00:00
|
|
|
_( "Copy Block (shift + drag mouse)" ),
|
|
|
|
copyblock_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_MIRROR_X_BLOCK,
|
2009-11-18 12:52:19 +00:00
|
|
|
_( "Mirror Block (alt + drag mouse)" ),
|
|
|
|
mirror_H_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_ROTATE_BLOCK,
|
2009-11-18 12:52:19 +00:00
|
|
|
_( "Rotate Block (ctrl + drag mouse)" ),
|
|
|
|
rotate_pos_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_DELETE_BLOCK,
|
2009-11-18 12:52:19 +00:00
|
|
|
_( "Delete Block (shift+ctrl + drag mouse)" ),
|
|
|
|
delete_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
|
|
|
|
_( "Cancel" ), cancel_xpm );
|
|
|
|
}
|
|
|
|
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-01-26 07:43:59 +00:00
|
|
|
int flags = item->m_Flags;
|
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
|
|
|
{
|
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 );
|
2010-11-24 15:10:33 +00:00
|
|
|
msg = AddHotkeyName( _( "Edit Module" ), g_Module_Editor_Hokeys_Descr,
|
2010-08-29 17:55:53 +00:00
|
|
|
HK_EDIT_ITEM );
|
2007-08-20 01:20:48 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_MODULE,
|
2010-08-29 17:55:53 +00:00
|
|
|
msg, 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 )
|
|
|
|
{
|
2010-11-24 15:10:33 +00:00
|
|
|
msg = AddHotkeyName( _("Move Pad" ), g_Module_Editor_Hokeys_Descr,
|
2010-08-29 17:55:53 +00:00
|
|
|
HK_MOVE_ITEM );
|
2007-08-20 01:20:48 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_PAD_REQUEST,
|
2010-08-29 17:55:53 +00:00
|
|
|
msg, move_pad_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2010-11-24 15:10:33 +00:00
|
|
|
msg = AddHotkeyName( _("Edit Pad" ), g_Module_Editor_Hokeys_Descr,
|
2010-08-29 17:55:53 +00:00
|
|
|
HK_EDIT_ITEM );
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_PAD,
|
|
|
|
msg, options_pad_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
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 );
|
2010-11-24 15:10:33 +00:00
|
|
|
msg = AddHotkeyName( _("Delete Pad" ), g_Module_Editor_Hokeys_Descr,
|
2010-08-29 17:55:53 +00:00
|
|
|
HK_DELETE );
|
2007-08-20 01:20:48 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DELETE_PAD,
|
2010-08-29 17:55:53 +00:00
|
|
|
msg, 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 )
|
|
|
|
{
|
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 );
|
2007-08-20 01:20:48 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST,
|
2010-08-29 17:55:53 +00:00
|
|
|
msg, move_field_xpm );
|
2007-08-20 01:20:48 +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 );
|
2007-08-20 01:20:48 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_ROTATE_TEXTMODULE,
|
2010-08-29 17:55:53 +00:00
|
|
|
msg, rotate_field_xpm );
|
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 );
|
2009-08-11 14:10:34 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TEXTMODULE,
|
2010-08-29 17:55:53 +00:00
|
|
|
msg, edit_text_xpm );
|
2011-01-26 07:43:59 +00:00
|
|
|
if( ( (TEXTE_MODULE*) item )->m_Type == 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 );
|
2009-08-11 14:10:34 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DELETE_TEXTMODULE,
|
2010-08-29 17:55:53 +00:00
|
|
|
msg, delete_text_xpm );
|
|
|
|
}
|
2009-08-11 14:10:34 +00:00
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
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 )
|
2010-08-29 17:55:53 +00:00
|
|
|
{
|
2010-11-24 15:10:33 +00:00
|
|
|
msg = AddHotkeyName( _("Move edge" ), g_Module_Editor_Hokeys_Descr,
|
2010-08-29 17:55:53 +00:00
|
|
|
HK_MOVE_ITEM );
|
2007-08-20 01:20:48 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_EDGE,
|
2010-08-29 17:55:53 +00:00
|
|
|
msg, move_line_xpm );
|
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
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,
|
2009-11-18 12:52:19 +00:00
|
|
|
ID_POPUP_PCB_EDIT_EDGE, _(
|
|
|
|
"Edit" ), edit_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
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 );
|
2010-11-24 15:10:33 +00:00
|
|
|
msg = AddHotkeyName( _("Delete edge" ), g_Module_Editor_Hokeys_Descr,
|
2010-08-29 17:55:53 +00:00
|
|
|
HK_DELETE );
|
2007-08-20 01:20:48 +00:00
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DELETE_EDGE,
|
2010-08-29 17:55:53 +00:00
|
|
|
msg, delete_xpm );
|
2007-08-20 01:20:48 +00:00
|
|
|
append_set_width = TRUE;
|
|
|
|
}
|
2009-08-11 14:10:34 +00:00
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_DRAWSEGMENT:
|
|
|
|
case TYPE_TEXTE:
|
|
|
|
case TYPE_VIA:
|
|
|
|
case TYPE_TRACK:
|
|
|
|
case TYPE_ZONE:
|
2009-08-01 19:26:05 +00:00
|
|
|
case TYPE_MARKER_PCB:
|
2010-04-23 09:54:40 +00:00
|
|
|
case TYPE_DIMENSION:
|
2008-12-04 04:28:11 +00:00
|
|
|
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:
|
2009-11-18 12:52:19 +00:00
|
|
|
msg.Printf( wxT( "WinEDA_ModuleEditFrame::OnRightClick Error: illegal DrawType %d" ),
|
2011-01-26 07:43:59 +00:00
|
|
|
item->Type() );
|
2007-08-20 01:20:48 +00:00
|
|
|
DisplayError( this, msg );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2009-11-18 12:52:19 +00:00
|
|
|
msg.Printf( wxT( "WinEDA_ModuleEditFrame::OnRightClick Error: unknown DrawType %d" ),
|
2011-01-26 07:43:59 +00:00
|
|
|
item->Type() );
|
2007-08-20 01:20:48 +00:00
|
|
|
DisplayError( this, msg );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
PopMenu->AppendSeparator();
|
|
|
|
|
|
|
|
if( append_set_width
|
2009-11-18 12:52:19 +00:00
|
|
|
|| ( m_ID_current_state
|
|
|
|
&& ( ( m_ID_current_state == ID_PCB_ADD_LINE_BUTT )
|
|
|
|
|| ( m_ID_current_state == ID_PCB_CIRCLE_BUTT )
|
|
|
|
|| ( m_ID_current_state == ID_PCB_ARC_BUTT ) ) ) )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_ENTER_EDGE_WIDTH,
|
2010-08-29 17:55:53 +00:00
|
|
|
_("Set Width" ), 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
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-18 12:52:19 +00:00
|
|
|
/* Handle the double click in the footprint editor:
|
2007-10-16 19:05:33 +00:00
|
|
|
* If the double clicked item is editable: call the corresponding editor.
|
2007-08-20 01:20:48 +00:00
|
|
|
*/
|
2009-11-18 12:52:19 +00:00
|
|
|
void WinEDA_ModuleEditFrame::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();
|
2009-08-11 14:10:34 +00:00
|
|
|
wxPoint pos = GetPosition();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
switch( m_ID_current_state )
|
|
|
|
{
|
|
|
|
case 0:
|
2011-01-26 07:43:59 +00:00
|
|
|
if( ( item == NULL ) || ( item->m_Flags == 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-01-26 07:43:59 +00:00
|
|
|
if( ( item == NULL ) || ( item->m_Flags != 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
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_PAD:
|
2011-01-26 07:43:59 +00:00
|
|
|
InstallPadOptionsFrame( (D_PAD*) item );
|
2007-08-20 01:20:48 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
break;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_MODULE:
|
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();
|
|
|
|
GetScreen()->GetCurItem()->m_Flags = 0;
|
2007-08-20 01:20:48 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
2009-08-11 10:27:21 +00:00
|
|
|
if( ret > 0 )
|
|
|
|
DrawPanel->Refresh();
|
|
|
|
}
|
2009-08-11 14:10:34 +00:00
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
case TYPE_TEXTE_MODULE:
|
2011-01-26 07:43:59 +00:00
|
|
|
InstallTextModOptionsFrame( (TEXTE_MODULE*) item, DC );
|
2007-08-20 01:20:48 +00:00
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
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-01-26 07:43:59 +00:00
|
|
|
if( item && ( item->m_Flags & IS_NEW ) )
|
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 );
|
2010-07-20 18:11:34 +00:00
|
|
|
DrawPanel->Refresh();
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|