2007-08-20 01:20:48 +00:00
|
|
|
|
/****************/
|
|
|
|
|
/* modedit.cpp */
|
|
|
|
|
/****************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
|
#pragma implementation
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
2009-04-08 06:05:54 +00:00
|
|
|
|
#include "appl_wxstruct.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
|
#include "class_drawpanel.h"
|
|
|
|
|
#include "confirm.h"
|
|
|
|
|
#include "gestfich.h"
|
2009-04-05 20:49:15 +00:00
|
|
|
|
#include "appl_wxstruct.h"
|
|
|
|
|
#include "bitmaps.h"
|
|
|
|
|
#include "id.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
#include "trigo.h"
|
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
|
#include "3d_viewer.h"
|
|
|
|
|
#include "pcbnew.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
#include "protos.h"
|
|
|
|
|
|
2007-10-27 18:05:50 +00:00
|
|
|
|
#include "collectors.h"
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-10-27 18:05:50 +00:00
|
|
|
|
/****************************************************************************/
|
|
|
|
|
BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode )
|
|
|
|
|
/****************************************************************************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2009-04-06 16:05:25 +00:00
|
|
|
|
BOARD_ITEM* item = GetCurItem();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
|
if( GetBoard()->m_Modules == NULL )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
return NULL;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-10-27 18:05:50 +00:00
|
|
|
|
GENERAL_COLLECTORS_GUIDE guide = GetCollectorsGuide();
|
|
|
|
|
|
|
|
|
|
// Assign to scanList the proper item types desired based on tool type
|
|
|
|
|
// or hotkey that is in play.
|
|
|
|
|
|
|
|
|
|
const KICAD_T* scanList = NULL;
|
|
|
|
|
|
|
|
|
|
if( aHotKeyCode )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{
|
2007-10-27 18:05:50 +00:00
|
|
|
|
// @todo: add switch here and add calls to PcbGeneralLocateAndDisplay( int aHotKeyCode )
|
|
|
|
|
// when searching is needed from a hotkey handler
|
2007-08-20 01:20:48 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
2007-10-27 18:05:50 +00:00
|
|
|
|
{
|
|
|
|
|
scanList = GENERAL_COLLECTOR::ModulesAndTheirItems;
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
|
m_Collector->Collect( GetBoard(), scanList, GetScreen()->RefPos( true ), guide );
|
2007-10-27 18:05:50 +00:00
|
|
|
|
|
|
|
|
|
/* Remove redundancies: when an item is found, we can remove the
|
2007-11-12 05:53:48 +00:00
|
|
|
|
* module from list
|
2007-10-27 18:05:50 +00:00
|
|
|
|
*/
|
2007-11-12 05:53:48 +00:00
|
|
|
|
if( m_Collector->GetCount() > 1 )
|
|
|
|
|
{
|
|
|
|
|
for( int ii = 0; ii < m_Collector->GetCount(); ii++ )
|
|
|
|
|
{
|
|
|
|
|
item = (*m_Collector)[ii];
|
2008-12-04 04:28:11 +00:00
|
|
|
|
if( item->Type() != TYPE_MODULE )
|
2007-11-12 05:53:48 +00:00
|
|
|
|
continue;
|
|
|
|
|
m_Collector->Remove( ii );
|
|
|
|
|
ii--;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-10-27 18:05:50 +00:00
|
|
|
|
|
|
|
|
|
if( m_Collector->GetCount() <= 1 )
|
|
|
|
|
{
|
|
|
|
|
item = (*m_Collector)[0];
|
|
|
|
|
SetCurItem( item );
|
|
|
|
|
}
|
|
|
|
|
else // we can't figure out which item user wants, do popup menu so user can choose
|
|
|
|
|
{
|
2009-04-06 16:05:25 +00:00
|
|
|
|
wxMenu itemMenu;
|
2007-10-27 18:05:50 +00:00
|
|
|
|
|
|
|
|
|
/* Give a title to the selection menu. This is also a cancel menu item */
|
2009-04-06 16:05:25 +00:00
|
|
|
|
wxMenuItem* item_title = new wxMenuItem( &itemMenu, -1, _( "Selection Clarification" ) );
|
2007-10-27 18:05:50 +00:00
|
|
|
|
#ifdef __WINDOWS__
|
2009-04-06 16:05:25 +00:00
|
|
|
|
wxFont bold_font( *wxNORMAL_FONT );
|
|
|
|
|
bold_font.SetWeight( wxFONTWEIGHT_BOLD );
|
|
|
|
|
bold_font.SetStyle( wxFONTSTYLE_ITALIC );
|
|
|
|
|
item_title->SetFont( bold_font );
|
2007-10-27 18:05:50 +00:00
|
|
|
|
#endif
|
2009-04-06 16:05:25 +00:00
|
|
|
|
itemMenu.Append( item_title );
|
2007-10-27 18:05:50 +00:00
|
|
|
|
itemMenu.AppendSeparator();
|
|
|
|
|
|
|
|
|
|
int limit = MIN( MAX_ITEMS_IN_PICKER, m_Collector->GetCount() );
|
|
|
|
|
|
|
|
|
|
for( int ii = 0; ii<limit; ++ii )
|
|
|
|
|
{
|
|
|
|
|
wxString text;
|
|
|
|
|
const char** xpm;
|
|
|
|
|
|
|
|
|
|
item = (*m_Collector)[ii];
|
|
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
|
text = item->MenuText( GetBoard() );
|
2007-10-27 18:05:50 +00:00
|
|
|
|
xpm = item->MenuIcon();
|
|
|
|
|
|
|
|
|
|
ADD_MENUITEM( &itemMenu, ID_POPUP_PCB_ITEM_SELECTION_START + ii, text, xpm );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// this menu's handler is void WinEDA_BasePcbFrame::ProcessItemSelection()
|
2009-04-17 08:51:02 +00:00
|
|
|
|
// and it calls SetCurItem() which in turn calls DisplayInfo() on the item.
|
2007-10-27 18:05:50 +00:00
|
|
|
|
DrawPanel->m_AbortRequest = true; // changed in false if an item
|
2009-04-06 16:05:25 +00:00
|
|
|
|
PopupMenu( &itemMenu ); // m_AbortRequest = false if an item is selected
|
2007-10-27 18:05:50 +00:00
|
|
|
|
|
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
2007-10-27 18:05:50 +00:00
|
|
|
|
DrawPanel->m_IgnoreMouseEvents = FALSE;
|
|
|
|
|
|
|
|
|
|
// The function ProcessItemSelection() has set the current item, return it.
|
|
|
|
|
item = GetCurItem();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( item )
|
|
|
|
|
{
|
2009-04-17 08:51:02 +00:00
|
|
|
|
item->DisplayInfo( this );
|
2007-10-27 18:05:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return item;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-05-21 17:42:42 +00:00
|
|
|
|
void WinEDA_ModuleEditFrame::LoadModuleFromBoard( wxCommandEvent& event )
|
|
|
|
|
{
|
|
|
|
|
GetScreen()->ClearUndoRedoList();
|
2009-06-11 14:26:17 +00:00
|
|
|
|
Load_Module_From_BOARD( NULL );
|
2009-05-21 17:42:42 +00:00
|
|
|
|
GetScreen()->ClrModify();
|
|
|
|
|
|
|
|
|
|
if( m_Draw3DFrame )
|
|
|
|
|
m_Draw3DFrame->NewDisplay();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/****************************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/****************************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* Traite les selections d'outils et les commandes appelees du menu POPUP
|
2007-08-20 01:20:48 +00:00
|
|
|
|
*/
|
2009-05-23 07:16:05 +00:00
|
|
|
|
#define SET_DC wxClientDC dc( DrawPanel ); DrawPanel->PrepareGraphicContext( &dc );
|
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2009-05-23 07:16:05 +00:00
|
|
|
|
int id = event.GetId();
|
|
|
|
|
wxPoint pos;
|
|
|
|
|
bool redraw = false;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wxGetMousePosition( &pos.x, &pos.y );
|
|
|
|
|
|
|
|
|
|
pos.y += 20;
|
|
|
|
|
|
|
|
|
|
switch( id ) // Arret eventuel de la commande de d<>placement en cours
|
|
|
|
|
{
|
|
|
|
|
case wxID_CUT:
|
|
|
|
|
case wxID_COPY:
|
|
|
|
|
case ID_TOOLBARH_PCB_SELECT_LAYER:
|
|
|
|
|
case ID_MODEDIT_PAD_SETTINGS:
|
|
|
|
|
case ID_PCB_USER_GRID_SETUP:
|
|
|
|
|
case ID_POPUP_PCB_ROTATE_TEXTEPCB:
|
|
|
|
|
case ID_POPUP_PCB_EDIT_TEXTEPCB:
|
|
|
|
|
case ID_POPUP_PCB_ROTATE_TEXTMODULE:
|
|
|
|
|
case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE:
|
|
|
|
|
case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE:
|
|
|
|
|
case ID_POPUP_PCB_EDIT_TEXTMODULE:
|
|
|
|
|
case ID_POPUP_PCB_IMPORT_PAD_SETTINGS:
|
|
|
|
|
case ID_POPUP_PCB_EXPORT_PAD_SETTINGS:
|
|
|
|
|
case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
|
|
|
|
|
case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
|
|
|
|
|
case ID_POPUP_PCB_EDIT_EDGE:
|
|
|
|
|
case ID_POPUP_PCB_EDIT_WIDTH_CURRENT_EDGE:
|
|
|
|
|
case ID_POPUP_PCB_EDIT_WIDTH_ALL_EDGE:
|
|
|
|
|
case ID_POPUP_PCB_EDIT_LAYER_CURRENT_EDGE:
|
|
|
|
|
case ID_POPUP_PCB_EDIT_LAYER_ALL_EDGE:
|
|
|
|
|
case ID_POPUP_PCB_ENTER_EDGE_WIDTH:
|
|
|
|
|
case ID_POPUP_DELETE_BLOCK:
|
|
|
|
|
case ID_POPUP_PLACE_BLOCK:
|
|
|
|
|
case ID_POPUP_ZOOM_BLOCK:
|
|
|
|
|
case ID_POPUP_MIRROR_Y_BLOCK:
|
|
|
|
|
case ID_POPUP_MIRROR_X_BLOCK:
|
|
|
|
|
case ID_POPUP_ROTATE_BLOCK:
|
|
|
|
|
case ID_POPUP_COPY_BLOCK:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
2009-05-23 07:16:05 +00:00
|
|
|
|
default:
|
|
|
|
|
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{
|
2009-05-23 07:16:05 +00:00
|
|
|
|
// for all other commands: stop the move in progress
|
|
|
|
|
SET_DC;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
|
|
|
|
}
|
2009-05-23 07:16:05 +00:00
|
|
|
|
if( id != ID_POPUP_CANCEL_CURRENT_COMMAND )
|
|
|
|
|
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch( id ) // Traitement des commandes
|
|
|
|
|
{
|
|
|
|
|
case ID_EXIT:
|
2009-01-15 08:12:03 +00:00
|
|
|
|
Close( true );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_LIBEDIT_SELECT_CURRENT_LIB:
|
|
|
|
|
Select_Active_Library();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_LIBEDIT_DELETE_PART:
|
2009-04-05 20:49:15 +00:00
|
|
|
|
{
|
|
|
|
|
wxFileName fn = wxFileName( wxEmptyString, m_CurrentLib,
|
|
|
|
|
ModuleFileExtension );
|
2009-04-08 18:06:22 +00:00
|
|
|
|
wxString full_libraryfilename = wxGetApp().FindLibraryPath( fn );
|
2009-04-06 16:05:25 +00:00
|
|
|
|
if( wxFileName::FileExists( full_libraryfilename ) )
|
|
|
|
|
Delete_Module_In_Library( full_libraryfilename );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
2009-04-05 20:49:15 +00:00
|
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
case ID_MODEDIT_NEW_MODULE:
|
2009-04-05 20:49:15 +00:00
|
|
|
|
{
|
|
|
|
|
Clear_Pcb( true );
|
|
|
|
|
GetScreen()->ClearUndoRedoList();
|
|
|
|
|
SetCurItem( NULL );
|
|
|
|
|
GetScreen()->m_Curseur = wxPoint( 0, 0 );
|
2008-09-18 12:07:34 +00:00
|
|
|
|
|
2009-05-23 07:16:05 +00:00
|
|
|
|
MODULE* module = Create_1_Module( NULL, wxEmptyString );
|
2009-04-06 16:05:25 +00:00
|
|
|
|
if( module ) // i.e. if create module command not aborted
|
2009-04-05 20:49:15 +00:00
|
|
|
|
{
|
2009-05-23 07:16:05 +00:00
|
|
|
|
redraw = true;
|
2009-04-06 16:05:25 +00:00
|
|
|
|
module->SetPosition( wxPoint( 0, 0 ) );
|
2009-04-05 20:49:15 +00:00
|
|
|
|
if( GetBoard()->m_Modules )
|
|
|
|
|
GetBoard()->m_Modules->m_Flags = 0;
|
|
|
|
|
Zoom_Automatique( true );
|
2008-09-18 12:07:34 +00:00
|
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
2009-04-05 20:49:15 +00:00
|
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
case ID_MODEDIT_SAVE_LIBMODULE:
|
2009-04-05 20:49:15 +00:00
|
|
|
|
{
|
|
|
|
|
wxFileName fn;
|
2009-04-08 06:05:54 +00:00
|
|
|
|
fn = wxFileName( wxEmptyString, m_CurrentLib, ModuleFileExtension );
|
2009-05-23 07:16:05 +00:00
|
|
|
|
wxString full_filename = wxGetApp().FindLibraryPath( fn );
|
2009-04-08 06:05:54 +00:00
|
|
|
|
Save_Module_In_Library( full_filename, GetBoard()->m_Modules,
|
2009-04-05 20:49:15 +00:00
|
|
|
|
true, true, true );
|
|
|
|
|
GetScreen()->ClrModify();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
2009-04-05 20:49:15 +00:00
|
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
case ID_MODEDIT_INSERT_MODULE_IN_BOARD:
|
|
|
|
|
case ID_MODEDIT_UPDATE_MODULE_IN_BOARD:
|
|
|
|
|
{
|
|
|
|
|
// update module in the current board,
|
|
|
|
|
// not just add it to the board with total disregard for the netlist...
|
2009-04-06 16:05:25 +00:00
|
|
|
|
WinEDA_PcbFrame* pcbframe = (WinEDA_PcbFrame*) GetParent();
|
|
|
|
|
BOARD* mainpcb = pcbframe->GetBoard();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
MODULE* source_module = NULL;
|
2009-01-05 05:21:35 +00:00
|
|
|
|
MODULE* module_in_edit = GetBoard()->m_Modules;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
// Search the old module (source) if exists
|
|
|
|
|
// Because this source could be deleted when editing the main board...
|
|
|
|
|
if( module_in_edit->m_Link ) // this is not a new module ...
|
|
|
|
|
{
|
|
|
|
|
source_module = mainpcb->m_Modules;
|
2009-04-06 16:05:25 +00:00
|
|
|
|
for( ; source_module != NULL; source_module = (MODULE*) source_module->Next() )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{
|
|
|
|
|
if( module_in_edit->m_Link == source_module->m_TimeStamp )
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if( (source_module == NULL) && id == (ID_MODEDIT_UPDATE_MODULE_IN_BOARD) ) // source not found
|
|
|
|
|
{
|
|
|
|
|
wxString msg;
|
|
|
|
|
msg.Printf( _( "Unable to find the footprint source on the main board" ) );
|
|
|
|
|
msg << _( "\nCannot update the footprint" );
|
|
|
|
|
DisplayError( this, msg );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( (source_module != NULL) && id == (ID_MODEDIT_INSERT_MODULE_IN_BOARD) ) // source not found
|
|
|
|
|
{
|
|
|
|
|
wxString msg;
|
|
|
|
|
msg.Printf( _( "A footprint source was found on the main board" ) );
|
|
|
|
|
msg << _( "\nCannot insert this footprint" );
|
|
|
|
|
DisplayError( this, msg );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Create the "new" module
|
|
|
|
|
MODULE* newmodule = new MODULE( mainpcb );
|
|
|
|
|
newmodule->Copy( module_in_edit );
|
2009-04-06 16:05:25 +00:00
|
|
|
|
newmodule->m_Link = 0;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
// Put the footprint in the main pcb linked list.
|
2008-12-04 04:28:11 +00:00
|
|
|
|
mainpcb->Add( newmodule );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
if( source_module ) // this is an update command
|
|
|
|
|
{
|
|
|
|
|
// The new module replace the old module (pos, orient, ref, value and connexions are kept)
|
|
|
|
|
// and the source_module (old module) is deleted
|
|
|
|
|
newmodule = pcbframe->Exchange_Module( this, source_module, newmodule );
|
|
|
|
|
newmodule->m_TimeStamp = module_in_edit->m_Link;
|
|
|
|
|
}
|
|
|
|
|
else // This is an insert command
|
|
|
|
|
{
|
|
|
|
|
wxPoint cursor_pos = pcbframe->GetScreen()->m_Curseur;
|
|
|
|
|
pcbframe->GetScreen()->m_Curseur = wxPoint( 0, 0 );
|
|
|
|
|
pcbframe->Place_Module( newmodule, NULL );
|
|
|
|
|
pcbframe->GetScreen()->m_Curseur = cursor_pos;
|
|
|
|
|
newmodule->m_TimeStamp = GetTimeStamp();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
newmodule->m_Flags = 0;
|
|
|
|
|
GetScreen()->ClrModify();
|
2007-09-12 02:14:07 +00:00
|
|
|
|
pcbframe->SetCurItem( NULL );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
mainpcb->m_Status_Pcb = 0;
|
|
|
|
|
}
|
2009-04-06 16:05:25 +00:00
|
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
|
case ID_MODEDIT_IMPORT_PART:
|
2007-08-20 01:20:48 +00:00
|
|
|
|
GetScreen()->ClearUndoRedoList();
|
2007-09-12 02:14:07 +00:00
|
|
|
|
SetCurItem( NULL );
|
2009-01-15 08:12:03 +00:00
|
|
|
|
Clear_Pcb( true );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
GetScreen()->m_Curseur = wxPoint( 0, 0 );
|
2009-05-23 07:16:05 +00:00
|
|
|
|
Import_Module( NULL );
|
|
|
|
|
redraw = true;
|
2009-01-05 05:21:35 +00:00
|
|
|
|
if( GetBoard()->m_Modules )
|
|
|
|
|
GetBoard()->m_Modules->m_Flags = 0;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
GetScreen()->ClrModify();
|
2009-01-15 08:12:03 +00:00
|
|
|
|
Zoom_Automatique( true );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
if( m_Draw3DFrame )
|
|
|
|
|
m_Draw3DFrame->NewDisplay();
|
|
|
|
|
break;
|
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
|
case ID_MODEDIT_EXPORT_PART:
|
2009-01-05 05:21:35 +00:00
|
|
|
|
if( GetBoard()->m_Modules )
|
|
|
|
|
Export_Module( GetBoard()->m_Modules, FALSE );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
|
case ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART:
|
2009-01-05 05:21:35 +00:00
|
|
|
|
if( GetBoard()->m_Modules )
|
2009-01-15 08:12:03 +00:00
|
|
|
|
Export_Module( GetBoard()->m_Modules, true );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_MODEDIT_SHEET_SET:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_MODEDIT_LOAD_MODULE:
|
2009-04-06 16:05:25 +00:00
|
|
|
|
{
|
|
|
|
|
wxString full_libraryfilename;
|
|
|
|
|
if( !m_CurrentLib.IsEmpty() )
|
|
|
|
|
{
|
|
|
|
|
wxFileName fn = wxFileName( wxEmptyString, m_CurrentLib,
|
|
|
|
|
ModuleFileExtension );
|
2009-04-08 18:06:22 +00:00
|
|
|
|
full_libraryfilename = wxGetApp().FindLibraryPath( fn );
|
2009-04-06 16:05:25 +00:00
|
|
|
|
}
|
2009-04-08 18:06:22 +00:00
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
GetScreen()->ClearUndoRedoList();
|
2007-09-12 02:14:07 +00:00
|
|
|
|
SetCurItem( NULL );
|
2009-01-15 08:12:03 +00:00
|
|
|
|
Clear_Pcb( true );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
GetScreen()->m_Curseur = wxPoint( 0, 0 );
|
2009-05-21 12:45:21 +00:00
|
|
|
|
Load_Module_From_Library( full_libraryfilename, NULL );
|
|
|
|
|
redraw = true;
|
2009-04-06 16:05:25 +00:00
|
|
|
|
}
|
2009-01-05 05:21:35 +00:00
|
|
|
|
if( GetBoard()->m_Modules )
|
|
|
|
|
GetBoard()->m_Modules->m_Flags = 0;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
//if either m_Reference or m_Value are gone, reinstate them -
|
|
|
|
|
//otherwise it becomes hard to see what you are working with in the layout!
|
2009-01-05 05:21:35 +00:00
|
|
|
|
if( GetBoard() && GetBoard()->m_Modules )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{
|
2009-01-05 05:21:35 +00:00
|
|
|
|
TEXTE_MODULE* ref = GetBoard()->m_Modules->m_Reference;
|
|
|
|
|
TEXTE_MODULE* val = GetBoard()->m_Modules->m_Value;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
if( val && ref )
|
|
|
|
|
{
|
2009-04-06 16:05:25 +00:00
|
|
|
|
ref->m_Type = TEXT_is_REFERENCE; // just in case ...
|
2007-08-20 01:20:48 +00:00
|
|
|
|
if( ref->m_Text.Length() == 0 )
|
|
|
|
|
ref->m_Text = L"Ref**";
|
2009-04-06 16:05:25 +00:00
|
|
|
|
val->m_Type = TEXT_is_VALUE; // just in case ...
|
2007-08-20 01:20:48 +00:00
|
|
|
|
if( val->m_Text.Length() == 0 )
|
|
|
|
|
val->m_Text = L"Val**";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
GetScreen()->ClrModify();
|
2009-01-15 08:12:03 +00:00
|
|
|
|
Zoom_Automatique( true );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
if( m_Draw3DFrame )
|
|
|
|
|
m_Draw3DFrame->NewDisplay();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_MODEDIT_PAD_SETTINGS:
|
|
|
|
|
InstallPadOptionsFrame( NULL, NULL, wxPoint( -1, -1 ) );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_MODEDIT_CHECK:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_MODEDIT_EDIT_MODULE_PROPERTIES:
|
2009-01-05 05:21:35 +00:00
|
|
|
|
if( GetBoard()->m_Modules )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{
|
2009-05-23 07:16:05 +00:00
|
|
|
|
SET_DC;
|
2009-01-05 05:21:35 +00:00
|
|
|
|
SetCurItem( GetBoard()->m_Modules );
|
2009-05-23 07:16:05 +00:00
|
|
|
|
InstallModuleOptionsFrame( (MODULE*) GetScreen()->GetCurItem(), &dc );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
GetScreen()->GetCurItem()->m_Flags = 0;
|
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add Pad" ) );
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SetToolID( id, wxCURSOR_ARROW, _( "Pad Settings" ) );
|
|
|
|
|
InstallPadOptionsFrame( NULL, NULL, wxPoint( -1, -1 ) );
|
|
|
|
|
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_LINE_COMMENT_BUTT:
|
|
|
|
|
case ID_PCB_ARC_BUTT:
|
|
|
|
|
case ID_PCB_CIRCLE_BUTT:
|
|
|
|
|
case ID_TEXT_COMMENT_BUTT:
|
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add Drawing" ) );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_MODEDIT_PLACE_ANCHOR:
|
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Place anchor" ) );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_NO_SELECT_BUTT:
|
|
|
|
|
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_CLOSE_CURRENT_TOOL:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_MODEDIT_DELETE_ITEM_BUTT:
|
|
|
|
|
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE:
|
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2009-05-21 12:45:21 +00:00
|
|
|
|
Rotate_Module( NULL, (MODULE*) GetScreen()->GetCurItem(), 900, true );
|
2009-05-23 07:16:05 +00:00
|
|
|
|
redraw = true;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE:
|
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2009-05-23 07:16:05 +00:00
|
|
|
|
Rotate_Module( NULL, (MODULE*) GetScreen()->GetCurItem(), -900, true );
|
|
|
|
|
redraw = true;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_MODULE:
|
2009-05-23 07:16:05 +00:00
|
|
|
|
{
|
|
|
|
|
SET_DC;
|
|
|
|
|
InstallModuleOptionsFrame( (MODULE*) GetScreen()->GetCurItem(), &dc );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
GetScreen()->GetCurItem()->m_Flags = 0;
|
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2009-05-23 07:16:05 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_MOVE_PAD_REQUEST:
|
2009-05-23 07:16:05 +00:00
|
|
|
|
{
|
|
|
|
|
SET_DC;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
|
StartMovePad( (D_PAD*) GetScreen()->GetCurItem(), &dc );
|
2009-05-23 07:16:05 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_PAD:
|
2009-05-23 07:16:05 +00:00
|
|
|
|
{
|
|
|
|
|
SET_DC;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
InstallPadOptionsFrame( (D_PAD*) GetScreen()->GetCurItem(),
|
|
|
|
|
&dc, pos );
|
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2009-05-23 07:16:05 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DELETE_PAD:
|
2009-01-05 05:21:35 +00:00
|
|
|
|
SaveCopyInUndoList( GetBoard()->m_Modules );
|
2009-05-21 12:45:21 +00:00
|
|
|
|
DeletePad( (D_PAD*) GetScreen()->GetCurItem() );
|
2007-09-12 02:14:07 +00:00
|
|
|
|
SetCurItem( NULL );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_IMPORT_PAD_SETTINGS:
|
2009-01-05 05:21:35 +00:00
|
|
|
|
SaveCopyInUndoList( GetBoard()->m_Modules );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2008-04-18 13:28:56 +00:00
|
|
|
|
Import_Pad_Settings( (D_PAD*) GetScreen()->GetCurItem(), true );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
|
2009-01-05 05:21:35 +00:00
|
|
|
|
SaveCopyInUndoList( GetBoard()->m_Modules );
|
2008-04-18 13:28:56 +00:00
|
|
|
|
Global_Import_Pad_Settings( (D_PAD*) GetScreen()->GetCurItem(), true );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EXPORT_PAD_SETTINGS:
|
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
|
Export_Pad_Settings( (D_PAD*) GetScreen()->GetCurItem() );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_TEXTMODULE:
|
2009-05-23 07:16:05 +00:00
|
|
|
|
{
|
|
|
|
|
SET_DC;
|
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
InstallTextModOptionsFrame( (TEXTE_MODULE*) GetScreen()->GetCurItem(),
|
|
|
|
|
&dc, pos );
|
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2009-05-23 07:16:05 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST:
|
2009-05-23 07:16:05 +00:00
|
|
|
|
{
|
|
|
|
|
SET_DC;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2009-05-23 07:16:05 +00:00
|
|
|
|
StartMoveTexteModule( (TEXTE_MODULE*) GetScreen()->GetCurItem(), &dc );
|
|
|
|
|
}
|
|
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_ROTATE_TEXTMODULE:
|
2009-05-23 07:16:05 +00:00
|
|
|
|
{
|
|
|
|
|
SET_DC;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
RotateTextModule( (TEXTE_MODULE*) GetScreen()->GetCurItem(),
|
|
|
|
|
&dc );
|
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2009-05-23 07:16:05 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DELETE_TEXTMODULE:
|
2009-01-05 05:21:35 +00:00
|
|
|
|
SaveCopyInUndoList( GetBoard()->m_Modules );
|
2009-05-23 07:16:05 +00:00
|
|
|
|
DeleteTextModule( (TEXTE_MODULE*) GetScreen()->GetCurItem() );
|
2007-09-12 02:14:07 +00:00
|
|
|
|
SetCurItem( NULL );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_MOVE_EDGE:
|
2009-05-23 07:16:05 +00:00
|
|
|
|
{
|
|
|
|
|
SET_DC;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
Start_Move_EdgeMod( (EDGE_MODULE*) GetScreen()->GetCurItem(), &dc );
|
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2009-05-23 07:16:05 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
|
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
|
if( (GetScreen()->GetCurItem()->m_Flags & IS_NEW) )
|
|
|
|
|
{
|
2009-05-23 07:16:05 +00:00
|
|
|
|
SET_DC;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
End_Edge_Module( (EDGE_MODULE*) GetScreen()->GetCurItem(), &dc );
|
2007-09-12 02:14:07 +00:00
|
|
|
|
SetCurItem( NULL );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_ENTER_EDGE_WIDTH:
|
2009-04-06 16:05:25 +00:00
|
|
|
|
{
|
|
|
|
|
EDGE_MODULE* edge = NULL;
|
|
|
|
|
if( GetScreen()->GetCurItem()
|
|
|
|
|
&& ( GetScreen()->GetCurItem()->m_Flags & IS_NEW)
|
|
|
|
|
&& (GetScreen()->GetCurItem()->Type() == TYPE_EDGE_MODULE) )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{
|
2009-04-06 16:05:25 +00:00
|
|
|
|
edge = (EDGE_MODULE*) GetScreen()->GetCurItem();
|
2007-08-20 01:20:48 +00:00
|
|
|
|
}
|
2009-05-23 07:16:05 +00:00
|
|
|
|
SET_DC;
|
2009-04-06 16:05:25 +00:00
|
|
|
|
Enter_Edge_Width( edge, &dc );
|
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
|
}
|
|
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_WIDTH_CURRENT_EDGE:
|
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2009-05-23 07:16:05 +00:00
|
|
|
|
Edit_Edge_Width( (EDGE_MODULE*) GetScreen()->GetCurItem() );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_WIDTH_ALL_EDGE:
|
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2009-05-23 07:16:05 +00:00
|
|
|
|
Edit_Edge_Width( NULL );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_LAYER_CURRENT_EDGE:
|
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2009-05-23 07:16:05 +00:00
|
|
|
|
Edit_Edge_Layer( (EDGE_MODULE*) GetScreen()->GetCurItem() );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_LAYER_ALL_EDGE:
|
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2009-05-23 07:16:05 +00:00
|
|
|
|
Edit_Edge_Layer( NULL );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DELETE_EDGE:
|
2009-01-05 05:21:35 +00:00
|
|
|
|
SaveCopyInUndoList( GetBoard()->m_Modules );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
2009-05-23 07:16:05 +00:00
|
|
|
|
RemoveStruct( GetScreen()->GetCurItem() );
|
2007-09-12 02:14:07 +00:00
|
|
|
|
SetCurItem( NULL );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_MODEDIT_MODULE_ROTATE:
|
|
|
|
|
case ID_MODEDIT_MODULE_MIRROR:
|
|
|
|
|
case ID_MODEDIT_MODULE_SCALE:
|
|
|
|
|
case ID_MODEDIT_MODULE_SCALEX:
|
|
|
|
|
case ID_MODEDIT_MODULE_SCALEY:
|
2009-01-05 05:21:35 +00:00
|
|
|
|
SaveCopyInUndoList( GetBoard()->m_Modules );
|
2009-05-23 07:16:05 +00:00
|
|
|
|
Transform( (MODULE*) GetScreen()->GetCurItem(), id );
|
|
|
|
|
redraw = true;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_PCB_DRAWINGS_WIDTHS_SETUP:
|
|
|
|
|
InstallOptionsFrame( pos );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_PCB_PAD_SETUP:
|
2009-04-06 16:05:25 +00:00
|
|
|
|
{
|
|
|
|
|
BOARD_ITEM* item = GetCurItem();
|
|
|
|
|
if( item )
|
2007-11-12 05:53:48 +00:00
|
|
|
|
{
|
2009-04-06 16:05:25 +00:00
|
|
|
|
if( item->Type() != TYPE_PAD )
|
|
|
|
|
item = NULL;
|
2007-11-12 05:53:48 +00:00
|
|
|
|
}
|
2009-05-23 07:16:05 +00:00
|
|
|
|
SET_DC;
|
2009-04-06 16:05:25 +00:00
|
|
|
|
InstallPadOptionsFrame( (D_PAD*) item, &dc, pos );
|
|
|
|
|
}
|
|
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
|
|
case ID_PCB_USER_GRID_SETUP:
|
|
|
|
|
InstallGridFrame( pos );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_MODEDIT_UNDO:
|
|
|
|
|
GetComponentFromUndoList();
|
2009-05-23 07:16:05 +00:00
|
|
|
|
redraw = true;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_MODEDIT_REDO:
|
|
|
|
|
GetComponentFromRedoList();
|
2009-05-23 07:16:05 +00:00
|
|
|
|
redraw = true;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_PLACE_BLOCK:
|
|
|
|
|
GetScreen()->BlockLocate.m_Command = BLOCK_MOVE;
|
|
|
|
|
DrawPanel->m_AutoPAN_Request = FALSE;
|
2009-05-23 07:16:05 +00:00
|
|
|
|
{
|
|
|
|
|
SET_DC;
|
|
|
|
|
HandleBlockPlace( &dc );
|
|
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_COPY_BLOCK:
|
|
|
|
|
GetScreen()->BlockLocate.m_Command = BLOCK_COPY;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
GetScreen()->BlockLocate.SetMessageBlock( this );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
DrawPanel->m_AutoPAN_Request = FALSE;
|
2009-05-23 07:16:05 +00:00
|
|
|
|
{
|
|
|
|
|
SET_DC;
|
|
|
|
|
HandleBlockPlace( &dc );
|
|
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_ZOOM_BLOCK:
|
|
|
|
|
GetScreen()->BlockLocate.m_Command = BLOCK_ZOOM;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
GetScreen()->BlockLocate.SetMessageBlock( this );
|
2009-05-23 07:16:05 +00:00
|
|
|
|
{
|
|
|
|
|
SET_DC;
|
|
|
|
|
HandleBlockEnd( &dc );
|
|
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_DELETE_BLOCK:
|
|
|
|
|
GetScreen()->BlockLocate.m_Command = BLOCK_DELETE;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
GetScreen()->BlockLocate.SetMessageBlock( this );
|
2009-05-23 07:16:05 +00:00
|
|
|
|
{
|
|
|
|
|
SET_DC;
|
|
|
|
|
HandleBlockEnd( &dc );
|
|
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_ROTATE_BLOCK:
|
|
|
|
|
GetScreen()->BlockLocate.m_Command = BLOCK_ROTATE;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
GetScreen()->BlockLocate.SetMessageBlock( this );
|
2009-05-23 07:16:05 +00:00
|
|
|
|
{
|
|
|
|
|
SET_DC;
|
|
|
|
|
HandleBlockEnd( &dc );
|
|
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_POPUP_MIRROR_X_BLOCK:
|
|
|
|
|
case ID_POPUP_MIRROR_Y_BLOCK:
|
|
|
|
|
case ID_POPUP_INVERT_BLOCK:
|
|
|
|
|
GetScreen()->BlockLocate.m_Command = BLOCK_INVERT;
|
2008-04-17 16:25:29 +00:00
|
|
|
|
GetScreen()->BlockLocate.SetMessageBlock( this );
|
2009-05-23 07:16:05 +00:00
|
|
|
|
{
|
|
|
|
|
SET_DC;
|
|
|
|
|
HandleBlockEnd( &dc );
|
|
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
DisplayError( this,
|
|
|
|
|
wxT( "WinEDA_ModuleEditFrame::Process_Special_Functions error" ) );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SetToolbars();
|
2009-05-23 07:16:05 +00:00
|
|
|
|
if( redraw )
|
2009-05-21 12:45:21 +00:00
|
|
|
|
DrawPanel->Refresh();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************/
|
2009-05-23 07:16:05 +00:00
|
|
|
|
void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/******************************************************************************/
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
2007-06-10 14:27:07 +00:00
|
|
|
|
/* Execute les transformations de la repr<70>sentation des modules.
|
2007-08-20 01:20:48 +00:00
|
|
|
|
* le module, apres transformation est toujours en position de reference:
|
|
|
|
|
* position 0,0
|
|
|
|
|
* orientation 0, cot<EFBFBD> composant.
|
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2009-04-06 16:05:25 +00:00
|
|
|
|
D_PAD* pad = module->m_Pads;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
EDA_BaseStruct* PtStruct = module->m_Drawings;
|
|
|
|
|
TEXTE_MODULE* textmod;
|
|
|
|
|
EDGE_MODULE* edgemod;
|
|
|
|
|
int angle = 900; // NECESSAIREMENT +- 900 (+- 90 degres) )
|
|
|
|
|
|
|
|
|
|
switch( transform )
|
|
|
|
|
{
|
|
|
|
|
case ID_MODEDIT_MODULE_ROTATE:
|
|
|
|
|
module->SetOrientation( angle );
|
|
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
|
for( ; pad != NULL; pad = (D_PAD*) pad->Next() )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{
|
|
|
|
|
pad->m_Pos0 = pad->m_Pos;
|
|
|
|
|
pad->m_Orient -= angle;
|
|
|
|
|
RotatePoint( &pad->m_Offset.x, &pad->m_Offset.y, angle );
|
|
|
|
|
EXCHG( pad->m_Size.x, pad->m_Size.y );
|
|
|
|
|
RotatePoint( &pad->m_DeltaSize.x, &pad->m_DeltaSize.y, -angle );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module->m_Reference->m_Pos0 = module->m_Reference->m_Pos;
|
|
|
|
|
module->m_Reference->m_Orient += angle;
|
|
|
|
|
if( module->m_Reference->m_Orient >= 1800 )
|
|
|
|
|
module->m_Reference->m_Orient -= 1800;
|
|
|
|
|
module->m_Value->m_Pos0 = module->m_Value->m_Pos;
|
|
|
|
|
module->m_Value->m_Orient += angle;
|
|
|
|
|
if( module->m_Value->m_Orient >= 1800 )
|
|
|
|
|
module->m_Value->m_Orient -= 1800;
|
|
|
|
|
|
|
|
|
|
/* Rectification des contours et textes de l'empreinte : */
|
2008-11-24 06:53:43 +00:00
|
|
|
|
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
|
if( PtStruct->Type() == TYPE_EDGE_MODULE )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{
|
|
|
|
|
edgemod = (EDGE_MODULE*) PtStruct;
|
|
|
|
|
edgemod->m_Start0 = edgemod->m_Start;
|
|
|
|
|
edgemod->m_End0 = edgemod->m_End;
|
|
|
|
|
}
|
2008-12-04 04:28:11 +00:00
|
|
|
|
if( PtStruct->Type() == TYPE_TEXTE_MODULE )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{
|
|
|
|
|
/* deplacement des inscriptions : */
|
|
|
|
|
textmod = (TEXTE_MODULE*) PtStruct;
|
|
|
|
|
textmod->m_Pos0 = textmod->m_Pos;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module->m_Orient = 0;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_MODEDIT_MODULE_MIRROR:
|
2008-11-24 06:53:43 +00:00
|
|
|
|
for( ; pad != NULL; pad = (D_PAD*) pad->Next() )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{
|
|
|
|
|
pad->m_Pos.y = -pad->m_Pos.y;
|
|
|
|
|
pad->m_Pos0.y = -pad->m_Pos0.y;
|
|
|
|
|
pad->m_Offset.y = -pad->m_Offset.y;
|
|
|
|
|
pad->m_DeltaSize.y = -pad->m_DeltaSize.y;
|
|
|
|
|
if( pad->m_Orient )
|
|
|
|
|
pad->m_Orient = 3600 - pad->m_Orient;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Inversion miroir de la Reference */
|
|
|
|
|
textmod = module->m_Reference;
|
|
|
|
|
textmod->m_Pos.y = -textmod->m_Pos.y;
|
|
|
|
|
textmod->m_Pos0.y = textmod->m_Pos0.y;
|
|
|
|
|
if( textmod->m_Orient )
|
|
|
|
|
textmod->m_Orient = 3600 - textmod->m_Orient;
|
|
|
|
|
|
|
|
|
|
/* Inversion miroir de la Valeur */
|
|
|
|
|
textmod = module->m_Value;
|
|
|
|
|
textmod->m_Pos.y = -textmod->m_Pos.y;
|
|
|
|
|
textmod->m_Pos0.y = textmod->m_Pos0.y;
|
|
|
|
|
if( textmod->m_Orient )
|
|
|
|
|
textmod->m_Orient = 3600 - textmod->m_Orient;
|
|
|
|
|
|
|
|
|
|
/* Inversion miroir des dessins de l'empreinte : */
|
|
|
|
|
PtStruct = module->m_Drawings;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{
|
2007-09-01 12:00:30 +00:00
|
|
|
|
switch( PtStruct->Type() )
|
2007-08-20 01:20:48 +00:00
|
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
|
case TYPE_EDGE_MODULE:
|
2007-08-20 01:20:48 +00:00
|
|
|
|
edgemod = (EDGE_MODULE*) PtStruct;
|
|
|
|
|
edgemod->m_Start.y = -edgemod->m_Start.y;
|
|
|
|
|
edgemod->m_End.y = -edgemod->m_End.y;
|
|
|
|
|
/* inversion des coords locales */
|
|
|
|
|
edgemod->m_Start0.y = -edgemod->m_Start0.y;
|
|
|
|
|
edgemod->m_End0.y = -edgemod->m_End0.y;
|
|
|
|
|
break;
|
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
|
case TYPE_TEXTE_MODULE:
|
2007-08-20 01:20:48 +00:00
|
|
|
|
/* Inversion miroir de la position et mise en miroir : */
|
|
|
|
|
textmod = (TEXTE_MODULE*) PtStruct;
|
|
|
|
|
textmod->m_Pos.y = -textmod->m_Pos.y;
|
|
|
|
|
textmod->m_Pos0.y = textmod->m_Pos0.y;
|
|
|
|
|
if( textmod->m_Orient )
|
|
|
|
|
textmod->m_Orient = 3600 - textmod->m_Orient;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
DisplayError( this, wxT( "Type Draw Indefini" ) );
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_MODEDIT_MODULE_SCALE:
|
|
|
|
|
case ID_MODEDIT_MODULE_SCALEX:
|
|
|
|
|
case ID_MODEDIT_MODULE_SCALEY:
|
2009-04-17 08:51:02 +00:00
|
|
|
|
DisplayInfoMessage( this, wxT( "Not availlable" ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module->Set_Rectangle_Encadrement();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|