More comment translation and capitalization fixes.

This commit is contained in:
stambaughw 2009-11-18 12:52:19 +00:00
parent 0acb404fcf
commit 1a139a7fe7
17 changed files with 1941 additions and 2031 deletions

View File

@ -1,6 +1,6 @@
/***********************************************************************/ /************************************************/
/* menubarmodedit.cpp - creation du menu general de l'editeur de module*/ /* menubarmodedit.cpp - Module editor menu bar. */
/***********************************************************************/ /************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
@ -13,80 +13,74 @@
#include "pcbnew_id.h" #include "pcbnew_id.h"
/***********************************************/
void WinEDA_ModuleEditFrame::ReCreateMenuBar() void WinEDA_ModuleEditFrame::ReCreateMenuBar()
/***********************************************/
/* Cree ou reinitialise le menu du haut d'ecran
*/
{ {
wxMenuBar * menuBar = GetMenuBar(); wxMenuBar* menuBar = GetMenuBar();
wxMenuItem * item; wxMenuItem* item;
if( ! menuBar ) if( !menuBar )
{ {
menuBar = new wxMenuBar(); menuBar = new wxMenuBar();
///////////////////////////// wxMenu* sizes_menu = new wxMenu;
// Ajustage de dimensions: //
/////////////////////////////
wxMenu * sizes_menu = new wxMenu;
item = new wxMenuItem(sizes_menu, ID_PCB_DRAWINGS_WIDTHS_SETUP, item = new wxMenuItem( sizes_menu, ID_PCB_DRAWINGS_WIDTHS_SETUP,
_("Sizes and Widths"), _( "Sizes and Widths" ),
_("Adjust width for texts and drawings")); _( "Adjust width for texts and drawings" ) );
item->SetBitmap(options_text_xpm); item->SetBitmap( options_text_xpm );
sizes_menu->Append(item); sizes_menu->Append( item );
item = new wxMenuItem(sizes_menu, ID_PCB_PAD_SETUP, _("Pad Settings"), item = new wxMenuItem( sizes_menu, ID_PCB_PAD_SETUP, _( "Pad Settings" ),
_("Adjust size,shape,layers... for Pads")); _( "Adjust size, shape, layers... for pads" ) );
item->SetBitmap(pad_xpm); item->SetBitmap( pad_xpm );
sizes_menu->Append(item); sizes_menu->Append( item );
item = new wxMenuItem(sizes_menu, ID_PCB_USER_GRID_SETUP, _("User Grid Size"), item =
_("Adjust User Grid")); new wxMenuItem( sizes_menu, ID_PCB_USER_GRID_SETUP,
item->SetBitmap(grid_xpm); _( "User Grid Size" ),
sizes_menu->Append(item); _( "Adjust user grid" ) );
item->SetBitmap( grid_xpm );
sizes_menu->Append( item );
//////////////// ////////////////
// Menu Help: // // Menu Help: //
//////////////// ////////////////
wxMenu *helpMenu = new wxMenu; wxMenu* helpMenu = new wxMenu;
// Contents // Contents
item = new wxMenuItem(helpMenu , item = new wxMenuItem( helpMenu,
ID_GENERAL_HELP, ID_GENERAL_HELP,
_("&Contents"), // Menu entry name _( "&Contents" ),
_("Open the pcbnew manual")); // Statusbar message _( "Open the pcbnew manual" ) );
item->SetBitmap(help_xpm); item->SetBitmap( help_xpm );
helpMenu->Append(item); helpMenu->Append( item );
// About pcbnew // About pcbnew
item = new wxMenuItem(helpMenu , item = new wxMenuItem( helpMenu,
ID_KICAD_ABOUT, ID_KICAD_ABOUT,
_("&About pcbnew"), // Menu entry name _( "&About pcbnew" ),
_("About pcbnew PCB designer")); // Statusbar message _( "About pcbnew PCB designer" ) );
item->SetBitmap(info_xpm); item->SetBitmap( info_xpm );
helpMenu->Append(item); helpMenu->Append( item );
////////////////////// //////////////////////
// Menu Display 3D: // // Menu Display 3D: //
////////////////////// //////////////////////
wxMenu *Display3DMenu = new wxMenu; wxMenu* Display3DMenu = new wxMenu;
item = new wxMenuItem(Display3DMenu , ID_MENU_PCB_SHOW_3D_FRAME, _("3D Display"), _("Show board in 3D viewer")); item = new wxMenuItem( Display3DMenu,
item->SetBitmap(show_3d_xpm); ID_MENU_PCB_SHOW_3D_FRAME,
Display3DMenu->Append(item); _( "3D Display" ),
_( "Show board in 3D viewer" ) );
item->SetBitmap( show_3d_xpm );
Display3DMenu->Append( item );
menuBar->Append(sizes_menu, _("&Dimensions")); menuBar->Append( sizes_menu, _( "&Dimensions" ) );
menuBar->Append(Display3DMenu, _("&3D Display")); menuBar->Append( Display3DMenu, _( "&3D Display" ) );
menuBar->Append(helpMenu, _("&Help")); menuBar->Append( helpMenu, _( "&Help" ) );
// Associate the menu bar with the frame // Associate the menu bar with the frame
SetMenuBar(menuBar); SetMenuBar( menuBar );
} }
} }

View File

@ -1,6 +1,6 @@
/******************************************************************/ /*****************************************/
/* menubarpcb.cpp - creation du menu general de l'editeur de board*/ /* menubarpcb.cpp - PCB editor menu bar. */
/******************************************************************/ /*****************************************/
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "common.h" #include "common.h"
@ -11,12 +11,8 @@
#include "hotkeys.h" #include "hotkeys.h"
#include "pcbnew_id.h" #include "pcbnew_id.h"
/***********************************************/
void WinEDA_PcbFrame::ReCreateMenuBar()
/***********************************************/
/* Cree ou reinitialise le menu du haut d'ecran void WinEDA_PcbFrame::ReCreateMenuBar()
*/
{ {
wxMenuItem* item; wxMenuItem* item;
wxMenuBar* menuBar = GetMenuBar(); wxMenuBar* menuBar = GetMenuBar();
@ -62,7 +58,8 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
// Add save menu // Add save menu
filesMenu->AppendSeparator(); filesMenu->AppendSeparator();
item = new wxMenuItem( filesMenu, ID_SAVE_BOARD, item = new wxMenuItem( filesMenu, ID_SAVE_BOARD,
_( "&Save Board\tCtrl-S" ), _( "Save current board" ) ); _( "&Save Board\tCtrl-S" ),
_( "Save current board" ) );
item->SetBitmap( save_xpm ); item->SetBitmap( save_xpm );
filesMenu->Append( item ); filesMenu->Append( item );
@ -125,7 +122,8 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
item->SetBitmap( import_xpm ); // @todo need better bitmap item->SetBitmap( import_xpm ); // @todo need better bitmap
submenuImport->Append( item ); submenuImport->Append( item );
/* would be implemented in WinEDA_PcbFrame::ImportSpecctraDesign() in specctra_import.cpp /* would be implemented in WinEDA_PcbFrame::ImportSpecctraDesign() in
* specctra_import.cpp
* item = new wxMenuItem(submenuImport, ID_GEN_IMPORT_SPECCTRA_DESIGN, * item = new wxMenuItem(submenuImport, ID_GEN_IMPORT_SPECCTRA_DESIGN,
* _("&Specctra Design"), _("Import a \"Specctra Design\" (*.dsn) file") ); * _("&Specctra Design"), _("Import a \"Specctra Design\" (*.dsn) file") );
* item->SetBitmap(export_xpm); // @todo need better bitmap * item->SetBitmap(export_xpm); // @todo need better bitmap
@ -167,7 +165,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
wxGetApp().m_fileHistory.AddFilesToMenu( filesMenu ); wxGetApp().m_fileHistory.AddFilesToMenu( filesMenu );
/////////////////////////////////// ///////////////////////////////////
// Preferences an configuration // // Preferences and configuration //
/////////////////////////////////// ///////////////////////////////////
wxMenu* configmenu = new wxMenu; wxMenu* configmenu = new wxMenu;
item = new wxMenuItem( configmenu, ID_CONFIG_REQ, _( "&Library" ), item = new wxMenuItem( configmenu, ID_CONFIG_REQ, _( "&Library" ),
@ -175,8 +173,9 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
item->SetBitmap( library_xpm ); item->SetBitmap( library_xpm );
configmenu->Append( item ); configmenu->Append( item );
item = new wxMenuItem( configmenu, ID_COLORS_SETUP, _( "&Colors and Visibility" ), item = new wxMenuItem( configmenu, ID_COLORS_SETUP,
_( "Select colors and visibilty of layers and some items" ) ); _( "&Colors and Visibility" ),
_( "Select colors and visibility of layers and some items" ) );
item->SetBitmap( palette_xpm ); item->SetBitmap( palette_xpm );
configmenu->Append( item ); configmenu->Append( item );
@ -185,7 +184,8 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
item->SetBitmap( preference_xpm ); item->SetBitmap( preference_xpm );
configmenu->Append( item ); configmenu->Append( item );
item = new wxMenuItem( configmenu, ID_PCB_DISPLAY_OPTIONS_SETUP, _( "&Display" ), item = new wxMenuItem( configmenu, ID_PCB_DISPLAY_OPTIONS_SETUP,
_( "&Display" ),
_( "Select how items (pads, tracks texts ... ) are displayed" ) ); _( "Select how items (pads, tracks texts ... ) are displayed" ) );
item->SetBitmap( display_options_xpm ); item->SetBitmap( display_options_xpm );
configmenu->Append( item ); configmenu->Append( item );
@ -206,13 +206,13 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
configmenu->Append( item ); configmenu->Append( item );
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
// Add access to the Design Rules Dialog and layers setup // // Add access to the Design Rules Dialog and layers setup //
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
wxMenu* designRulesMenu = new wxMenu; wxMenu* designRulesMenu = new wxMenu;
item = new wxMenuItem( designRulesMenu, ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG, item = new wxMenuItem( designRulesMenu, ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG,
_( "Design Rules" ), _( "Open the design rules dialog editor" ) ); _( "Design Rules" ),
_( "Open the design rules dialog editor" ) );
item->SetBitmap( hammer_xpm ); item->SetBitmap( hammer_xpm );
designRulesMenu->Append( item ); designRulesMenu->Append( item );
@ -255,9 +255,6 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
item->SetBitmap( save_xpm ); item->SetBitmap( save_xpm );
sizes_menu->Append( item ); sizes_menu->Append( item );
//////////////////////////////////////////////////////////////////
// Menu postprocess ( generation fichiers percage, placement... //
//////////////////////////////////////////////////////////////////
wxMenu* postprocess_menu = new wxMenu; wxMenu* postprocess_menu = new wxMenu;
item = new wxMenuItem( postprocess_menu, ID_PCB_GEN_POS_MODULES_FILE, item = new wxMenuItem( postprocess_menu, ID_PCB_GEN_POS_MODULES_FILE,
_( "Generate &Modules Position" ), _( "Generate &Modules Position" ),
@ -283,9 +280,6 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
item->SetBitmap( tools_xpm ); item->SetBitmap( tools_xpm );
postprocess_menu->Append( item ); postprocess_menu->Append( item );
//////////////////////////
// Menu d'outils divers //
//////////////////////////
wxMenu* miscellaneous_menu = new wxMenu; wxMenu* miscellaneous_menu = new wxMenu;
item = new wxMenuItem( miscellaneous_menu, ID_PCB_GLOBAL_DELETE, item = new wxMenuItem( miscellaneous_menu, ID_PCB_GLOBAL_DELETE,
_( "Global &Deletions" ), _( "Global &Deletions" ),

View File

@ -1,6 +1,6 @@
/*********************************************/ /********************************************/
/* Functions to edite targets (class MIRE) */ /* Functions to edit targets (class MIRE) */
/*********************************************/ /********************************************/
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
@ -15,12 +15,16 @@
/* Routines Locales */ /* Routines Locales */
static void AbortMoveAndEditTarget( WinEDA_DrawPanel* Panel, wxDC* DC ); static void AbortMoveAndEditTarget( WinEDA_DrawPanel* Panel, wxDC* DC );
static void ShowTargetShapeWhileMovingMouse( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void ShowTargetShapeWhileMovingMouse( WinEDA_DrawPanel* panel,
wxDC* DC,
bool erase );
/* Local variables : */ /* Local variables : */
static int MireDefaultSize = 5000; static int MireDefaultSize = 5000;
static MIREPCB s_TargetCopy( NULL ); /* Used to store "old" values of the current item static MIREPCB s_TargetCopy( NULL ); /* Used to store "old" values of the
* parameters before edition (used in undo/redo or cancel operations) * current item parameters before
* edition (used in undo/redo or
* cancel operations)
*/ */
/************************************/ /************************************/
@ -38,11 +42,10 @@ private:
WinEDA_ValueCtrl* m_MireSizeCtrl; WinEDA_ValueCtrl* m_MireSizeCtrl;
wxRadioBox* m_MireShape; wxRadioBox* m_MireShape;
public: public: WinEDA_MirePropertiesFrame( WinEDA_PcbFrame* parent,
MIREPCB* Mire,
// Constructor and destructor wxDC* DC,
WinEDA_MirePropertiesFrame( WinEDA_PcbFrame* parent, const wxPoint& pos );
MIREPCB* Mire, wxDC* DC, const wxPoint& pos );
~WinEDA_MirePropertiesFrame() { } ~WinEDA_MirePropertiesFrame() { }
private: private:
@ -53,25 +56,24 @@ private:
}; };
BEGIN_EVENT_TABLE( WinEDA_MirePropertiesFrame, wxDialog ) BEGIN_EVENT_TABLE( WinEDA_MirePropertiesFrame, wxDialog )
EVT_BUTTON( wxID_OK, WinEDA_MirePropertiesFrame::OnOkClick ) EVT_BUTTON( wxID_OK, WinEDA_MirePropertiesFrame::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_MirePropertiesFrame::OnCancelClick ) EVT_BUTTON( wxID_CANCEL, WinEDA_MirePropertiesFrame::OnCancelClick )
END_EVENT_TABLE() END_EVENT_TABLE()
/***************************************************************/
void WinEDA_PcbFrame::InstallMireOptionsFrame( MIREPCB* MirePcb, void WinEDA_PcbFrame::InstallMireOptionsFrame( MIREPCB* MirePcb,
wxDC* DC, const wxPoint& pos ) wxDC* DC, const wxPoint& pos )
/***************************************************************/
{ {
WinEDA_MirePropertiesFrame* frame = new WinEDA_MirePropertiesFrame( this, WinEDA_MirePropertiesFrame* frame =
MirePcb, DC, pos ); new WinEDA_MirePropertiesFrame( this, MirePcb, DC, pos );
frame->ShowModal(); frame->ShowModal();
frame->Destroy(); frame->Destroy();
} }
WinEDA_MirePropertiesFrame::WinEDA_MirePropertiesFrame( WinEDA_PcbFrame* parent, WinEDA_MirePropertiesFrame::WinEDA_MirePropertiesFrame(
WinEDA_PcbFrame* parent,
MIREPCB* Mire, wxDC* DC, MIREPCB* Mire, wxDC* DC,
const wxPoint& framepos ) : const wxPoint& framepos ) :
wxDialog( parent, -1, _( "Target Properties" ), framepos, wxSize( 270, 210 ), wxDialog( parent, -1, _( "Target Properties" ), framepos, wxSize( 270, 210 ),
@ -93,7 +95,7 @@ WinEDA_MirePropertiesFrame::WinEDA_MirePropertiesFrame( WinEDA_PcbFrame* parent,
MainBoxSizer->Add( LeftBoxSizer, 0, wxGROW | wxALL, 5 ); MainBoxSizer->Add( LeftBoxSizer, 0, wxGROW | wxALL, 5 );
MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 ); MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
/* Creation des boutons de commande */ /* Create of the command buttons. */
Button = new wxButton( this, wxID_OK, _( "OK" ) ); Button = new wxButton( this, wxID_OK, _( "OK" ) );
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 ); RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
@ -103,12 +105,14 @@ WinEDA_MirePropertiesFrame::WinEDA_MirePropertiesFrame( WinEDA_PcbFrame* parent,
// Size: // Size:
m_MireSizeCtrl = new WinEDA_ValueCtrl( this, _( "Size" ), m_MireSizeCtrl = new WinEDA_ValueCtrl( this, _( "Size" ),
m_MirePcb->m_Size, m_MirePcb->m_Size,
g_UnitMetric, LeftBoxSizer, m_Parent->m_InternalUnits ); g_UnitMetric, LeftBoxSizer,
m_Parent->m_InternalUnits );
// Width: // Width:
m_MireWidthCtrl = new WinEDA_ValueCtrl( this, _( "Width" ), m_MireWidthCtrl = new WinEDA_ValueCtrl( this, _( "Width" ),
m_MirePcb->m_Width, m_MirePcb->m_Width,
g_UnitMetric, LeftBoxSizer, m_Parent->m_InternalUnits ); g_UnitMetric, LeftBoxSizer,
m_Parent->m_InternalUnits );
// Shape // Shape
wxString shape_list[2] = { _( "shape +" ), _( "shape X" ) }; wxString shape_list[2] = { _( "shape +" ), _( "shape X" ) };
@ -124,44 +128,42 @@ WinEDA_MirePropertiesFrame::WinEDA_MirePropertiesFrame( WinEDA_PcbFrame* parent,
} }
/**********************************************************************/ void WinEDA_MirePropertiesFrame::OnCancelClick( wxCommandEvent& WXUNUSED(
void WinEDA_MirePropertiesFrame::OnCancelClick( wxCommandEvent& WXUNUSED (event) ) event ) )
/**********************************************************************/
{ {
EndModal( -1 ); EndModal( -1 );
} }
/**************************************************************************/ /* Updates the different parameters for the component being edited
void WinEDA_MirePropertiesFrame::OnOkClick( wxCommandEvent& event )
/**************************************************************************/
/* Met a jour les differents parametres pour le composant en cours d'édition
*/ */
void WinEDA_MirePropertiesFrame::OnOkClick( wxCommandEvent& event )
{ {
m_MirePcb->Draw( m_Parent->DrawPanel, m_DC, GR_XOR ); m_MirePcb->Draw( m_Parent->DrawPanel, m_DC, GR_XOR );
// Save old item in undo list, if is is not curently edited (will be later if so) // Save old item in undo list, if is is not currently edited (will be later
// if so)
if( m_MirePcb->m_Flags == 0 ) if( m_MirePcb->m_Flags == 0 )
m_Parent->SaveCopyInUndoList( m_MirePcb, UR_CHANGED ); m_Parent->SaveCopyInUndoList( m_MirePcb, UR_CHANGED );
if( m_MirePcb->m_Flags != 0) // other edition in progress (MOVE, NEW ..) if( m_MirePcb->m_Flags != 0 ) // other edition in progress (MOVE,
m_MirePcb->m_Flags |= IN_EDIT; // set flag in edit to force undo/redo/abort proper operation // NEW ..)
m_MirePcb->m_Flags |= IN_EDIT; // set flag in edit to force
// undo/redo/abort proper operation
m_MirePcb->m_Width = m_MireWidthCtrl->GetValue(); m_MirePcb->m_Width = m_MireWidthCtrl->GetValue();
MireDefaultSize = m_MirePcb->m_Size = m_MireSizeCtrl->GetValue(); MireDefaultSize = m_MirePcb->m_Size = m_MireSizeCtrl->GetValue();
m_MirePcb->m_Shape = m_MireShape->GetSelection() ? 1 : 0; m_MirePcb->m_Shape = m_MireShape->GetSelection() ? 1 : 0;
m_MirePcb->Draw( m_Parent->DrawPanel, m_DC, (m_MirePcb->m_Flags & IS_MOVED) ? GR_XOR : GR_OR ); m_MirePcb->Draw( m_Parent->DrawPanel, m_DC,
( m_MirePcb->m_Flags & IS_MOVED ) ? GR_XOR : GR_OR );
m_Parent->GetScreen()->SetModify(); m_Parent->GetScreen()->SetModify();
EndModal( 1 ); EndModal( 1 );
} }
/**************************************************************/
void WinEDA_PcbFrame::Delete_Mire( MIREPCB* MirePcb, wxDC* DC ) void WinEDA_PcbFrame::Delete_Mire( MIREPCB* MirePcb, wxDC* DC )
/**************************************************************/
{ {
if( MirePcb == NULL ) if( MirePcb == NULL )
return; return;
@ -172,16 +174,14 @@ void WinEDA_PcbFrame::Delete_Mire( MIREPCB* MirePcb, wxDC* DC )
} }
/**********************************************************/
static void AbortMoveAndEditTarget( WinEDA_DrawPanel* Panel, wxDC* DC ) static void AbortMoveAndEditTarget( WinEDA_DrawPanel* Panel, wxDC* DC )
/**********************************************************/
{ {
BASE_SCREEN* screen = Panel->GetScreen(); BASE_SCREEN* screen = Panel->GetScreen();
MIREPCB* MirePcb = (MIREPCB*) screen->GetCurItem(); MIREPCB* MirePcb = (MIREPCB*) screen->GetCurItem();
Panel->ManageCurseur = NULL; Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL; Panel->ForceCloseManageCurseur = NULL;
((WinEDA_PcbFrame*)Panel->m_Parent)->SetCurItem( NULL ); ( (WinEDA_PcbFrame*) Panel->m_Parent )->SetCurItem( NULL );
if( MirePcb == NULL ) if( MirePcb == NULL )
return; return;
@ -196,7 +196,7 @@ static void AbortMoveAndEditTarget( WinEDA_DrawPanel* Panel, wxDC* DC )
} }
else /* it is an existing item: retrieve initial values of parameters */ else /* it is an existing item: retrieve initial values of parameters */
{ {
if( (MirePcb->m_Flags & (IN_EDIT |IS_MOVED)) ) if( ( MirePcb->m_Flags & (IN_EDIT | IS_MOVED) ) )
{ {
MirePcb->m_Pos = s_TargetCopy.m_Pos; MirePcb->m_Pos = s_TargetCopy.m_Pos;
MirePcb->m_Width = s_TargetCopy.m_Width; MirePcb->m_Width = s_TargetCopy.m_Width;
@ -209,12 +209,9 @@ static void AbortMoveAndEditTarget( WinEDA_DrawPanel* Panel, wxDC* DC )
} }
/*****************************************************/ /* Draw Symbol PCB type MIRE.
MIREPCB* WinEDA_PcbFrame::Create_Mire( wxDC* DC )
/*****************************************************/
/* Routine de creation d'un Draw Symbole Pcb type MIRE
*/ */
MIREPCB* WinEDA_PcbFrame::Create_Mire( wxDC* DC )
{ {
MIREPCB* MirePcb = new MIREPCB( GetBoard() ); MIREPCB* MirePcb = new MIREPCB( GetBoard() );
@ -232,12 +229,9 @@ MIREPCB* WinEDA_PcbFrame::Create_Mire( wxDC* DC )
} }
/**********************************************************************/ /* Routine to initialize the displacement of a focal
void WinEDA_PcbFrame::StartMove_Mire( MIREPCB* MirePcb, wxDC* DC )
/**********************************************************************/
/* Routine d'initialisation du deplacement d'une mire
*/ */
void WinEDA_PcbFrame::StartMove_Mire( MIREPCB* MirePcb, wxDC* DC )
{ {
if( MirePcb == NULL ) if( MirePcb == NULL )
return; return;
@ -250,9 +244,7 @@ void WinEDA_PcbFrame::StartMove_Mire( MIREPCB* MirePcb, wxDC* DC )
} }
/**************************************************************/
void WinEDA_PcbFrame::Place_Mire( MIREPCB* MirePcb, wxDC* DC ) void WinEDA_PcbFrame::Place_Mire( MIREPCB* MirePcb, wxDC* DC )
/**************************************************************/
{ {
if( MirePcb == NULL ) if( MirePcb == NULL )
return; return;
@ -273,7 +265,9 @@ void WinEDA_PcbFrame::Place_Mire( MIREPCB* MirePcb, wxDC* DC )
if( MirePcb->m_Flags == IS_MOVED ) if( MirePcb->m_Flags == IS_MOVED )
{ {
SaveCopyInUndoList( MirePcb, UR_MOVED, MirePcb->m_Pos - s_TargetCopy.m_Pos ); SaveCopyInUndoList( MirePcb,
UR_MOVED,
MirePcb->m_Pos - s_TargetCopy.m_Pos );
MirePcb->m_Flags = 0; MirePcb->m_Flags = 0;
return; return;
} }
@ -288,10 +282,10 @@ void WinEDA_PcbFrame::Place_Mire( MIREPCB* MirePcb, wxDC* DC )
} }
/******************************************************************************/ /* Redraw the contour of the track while moving the mouse */
static void ShowTargetShapeWhileMovingMouse( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) static void ShowTargetShapeWhileMovingMouse( WinEDA_DrawPanel* panel,
/*********************************************************************************/ wxDC* DC,
/* redessin du contour de la piste lors des deplacements de la souris */ bool erase )
{ {
BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = panel->GetScreen();
MIREPCB* MirePcb = (MIREPCB*) screen->GetCurItem(); MIREPCB* MirePcb = (MIREPCB*) screen->GetCurItem();
@ -299,12 +293,10 @@ static void ShowTargetShapeWhileMovingMouse( WinEDA_DrawPanel* panel, wxDC* DC,
if( MirePcb == NULL ) if( MirePcb == NULL )
return; return;
/* efface ancienne position */
if( erase ) if( erase )
MirePcb->Draw( panel, DC, GR_XOR ); MirePcb->Draw( panel, DC, GR_XOR );
MirePcb->m_Pos = screen->m_Curseur; MirePcb->m_Pos = screen->m_Curseur;
// Reaffichage
MirePcb->Draw( panel, DC, GR_XOR ); MirePcb->Draw( panel, DC, GR_XOR );
} }

View File

@ -21,9 +21,8 @@
#include "collectors.h" #include "collectors.h"
/****************************************************************************/
BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode ) BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode )
/****************************************************************************/
{ {
BOARD_ITEM* item = GetCurItem(); BOARD_ITEM* item = GetCurItem();
@ -38,15 +37,16 @@ BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode )
if( aHotKeyCode ) if( aHotKeyCode )
{ {
// @todo: add switch here and add calls to PcbGeneralLocateAndDisplay( int aHotKeyCode ) // @todo: add switch here and add calls to PcbGeneralLocateAndDisplay(
// when searching is needed from a hotkey handler // int aHotKeyCode ) when searching is needed from a hotkey handler
} }
else else
{ {
scanList = GENERAL_COLLECTOR::ModulesAndTheirItems; scanList = GENERAL_COLLECTOR::ModulesAndTheirItems;
} }
m_Collector->Collect( GetBoard(), scanList, GetScreen()->RefPos( true ), guide ); m_Collector->Collect( GetBoard(), scanList, GetScreen()->RefPos(
true ), guide );
/* Remove redundancies: when an item is found, we can remove the /* Remove redundancies: when an item is found, we can remove the
* module from list * module from list
@ -68,12 +68,15 @@ BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode )
item = (*m_Collector)[0]; item = (*m_Collector)[0];
SetCurItem( item ); SetCurItem( item );
} }
else // we can't figure out which item user wants, do popup menu so user can choose else // we can't figure out which item user wants, do popup menu so user
// can choose
{ {
wxMenu itemMenu; wxMenu itemMenu;
/* Give a title to the selection menu. This is also a cancel menu item */ /* Give a title to the selection menu. This is also a cancel
wxMenuItem* item_title = new wxMenuItem( &itemMenu, -1, _( "Selection Clarification" ) ); * menu item **/
wxMenuItem* item_title =
new wxMenuItem( &itemMenu, -1, _( "Selection Clarification" ) );
#ifdef __WINDOWS__ #ifdef __WINDOWS__
wxFont bold_font( *wxNORMAL_FONT ); wxFont bold_font( *wxNORMAL_FONT );
bold_font.SetWeight( wxFONTWEIGHT_BOLD ); bold_font.SetWeight( wxFONTWEIGHT_BOLD );
@ -95,19 +98,26 @@ BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode )
text = item->MenuText( GetBoard() ); text = item->MenuText( GetBoard() );
xpm = item->MenuIcon(); xpm = item->MenuIcon();
ADD_MENUITEM( &itemMenu, ID_POPUP_PCB_ITEM_SELECTION_START + ii, text, xpm ); ADD_MENUITEM( &itemMenu,
ID_POPUP_PCB_ITEM_SELECTION_START + ii,
text,
xpm );
} }
// this menu's handler is void WinEDA_BasePcbFrame::ProcessItemSelection() // this menu's handler is void
// and it calls SetCurItem() which in turn calls DisplayInfo() on the item. // WinEDA_BasePcbFrame::ProcessItemSelection()
// and it calls SetCurItem() which in turn calls DisplayInfo() on the
// item.
DrawPanel->m_AbortRequest = true; // changed in false if an item DrawPanel->m_AbortRequest = true; // changed in false if an item
PopupMenu( &itemMenu ); // m_AbortRequest = false if an item is selected PopupMenu( &itemMenu ); // m_AbortRequest = false if an
// item is selected
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
DrawPanel->m_IgnoreMouseEvents = FALSE; DrawPanel->m_IgnoreMouseEvents = FALSE;
// The function ProcessItemSelection() has set the current item, return it. // The function ProcessItemSelection() has set the current item, return
// it.
item = GetCurItem(); item = GetCurItem();
} }
@ -131,25 +141,20 @@ void WinEDA_ModuleEditFrame::LoadModuleFromBoard( wxCommandEvent& event )
} }
/****************************************************************************/
void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event ) void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
/****************************************************************************/
/* Traite les selections d'outils et les commandes appelees du menu POPUP
*/
#define SET_DC wxClientDC dc( DrawPanel ); DrawPanel->PrepareGraphicContext( &dc );
{ {
int id = event.GetId(); int id = event.GetId();
wxPoint pos; wxPoint pos;
bool redraw = false; bool redraw = false;
wxClientDC dc( DrawPanel );
DrawPanel->PrepareGraphicContext( &dc );
wxGetMousePosition( &pos.x, &pos.y ); wxGetMousePosition( &pos.x, &pos.y );
pos.y += 20; pos.y += 20;
switch( id ) // Arret eventuel de la commande de d<>placement en cours switch( id )
{ {
case wxID_CUT: case wxID_CUT:
case wxID_COPY: case wxID_COPY:
@ -185,7 +190,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur ) if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
{ {
// for all other commands: stop the move in progress // for all other commands: stop the move in progress
SET_DC;
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc ); DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
} }
if( id != ID_POPUP_CANCEL_CURRENT_COMMAND ) if( id != ID_POPUP_CANCEL_CURRENT_COMMAND )
@ -193,7 +197,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
} }
switch( id ) // Traitement des commandes switch( id )
{ {
case ID_EXIT: case ID_EXIT:
Close( true ); Close( true );
@ -223,8 +227,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
MODULE* module = Create_1_Module( NULL, wxEmptyString ); MODULE* module = Create_1_Module( NULL, wxEmptyString );
if( module ) // i.e. if create module command not aborted if( module ) // i.e. if create module command not aborted
{ {
// Initialize data relative to nets and netclasses (for a new module // Initialize data relative to nets and netclasses (for a new
// the defaults are used) // module the defaults are used)
// This is mandatory to handle and draw pads // This is mandatory to handle and draw pads
GetBoard()->m_NetInfo->BuildListOfNets(); GetBoard()->m_NetInfo->BuildListOfNets();
redraw = true; redraw = true;
@ -262,13 +266,16 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
if( module_in_edit->m_Link ) // this is not a new module ... if( module_in_edit->m_Link ) // this is not a new module ...
{ {
source_module = mainpcb->m_Modules; source_module = mainpcb->m_Modules;
for( ; source_module != NULL; source_module = (MODULE*) source_module->Next() ) for( ;
source_module != NULL;
source_module = (MODULE*) source_module->Next() )
{ {
if( module_in_edit->m_Link == source_module->m_TimeStamp ) if( module_in_edit->m_Link == source_module->m_TimeStamp )
break; break;
} }
} }
if( (source_module == NULL) && id == (ID_MODEDIT_UPDATE_MODULE_IN_BOARD) ) // source not found if( ( source_module == NULL )
&& ( id == ID_MODEDIT_UPDATE_MODULE_IN_BOARD ) ) // source not found
{ {
wxString msg; wxString msg;
msg.Printf( _( "Unable to find the footprint source on the main board" ) ); msg.Printf( _( "Unable to find the footprint source on the main board" ) );
@ -277,7 +284,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
} }
if( (source_module != NULL) && id == (ID_MODEDIT_INSERT_MODULE_IN_BOARD) ) // source not found if( ( source_module != NULL )
&& ( id == ID_MODEDIT_INSERT_MODULE_IN_BOARD ) ) // source not found
{ {
wxString msg; wxString msg;
msg.Printf( _( "A footprint source was found on the main board" ) ); msg.Printf( _( "A footprint source was found on the main board" ) );
@ -297,7 +305,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
if( source_module ) // this is an update command if( source_module ) // this is an update command
{ {
// In the main board, // In the main board,
// the new module replace the old module (pos, orient, ref, value and connexions are kept) // the new module replace the old module (pos, orient, ref, value
// and connexions are kept)
// and the source_module (old module) is deleted // and the source_module (old module) is deleted
PICKED_ITEMS_LIST pickList; PICKED_ITEMS_LIST pickList;
pcbframe->Exchange_Module( source_module, newmodule, &pickList ); pcbframe->Exchange_Module( source_module, newmodule, &pickList );
@ -403,7 +412,9 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
if( GetBoard()->m_Modules ) if( GetBoard()->m_Modules )
{ {
SetCurItem( GetBoard()->m_Modules ); SetCurItem( GetBoard()->m_Modules );
DIALOG_MODULE_MODULE_EDITOR dialog( this, (MODULE*) GetScreen()->GetCurItem() ); DIALOG_MODULE_MODULE_EDITOR dialog( this,
(MODULE*) GetScreen()->
GetCurItem() );
int ret = dialog.ShowModal(); int ret = dialog.ShowModal();
GetScreen()->GetCurItem()->m_Flags = 0; GetScreen()->GetCurItem()->m_Flags = 0;
if( ret > 0 ) if( ret > 0 )
@ -461,7 +472,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_EDIT_MODULE: case ID_POPUP_PCB_EDIT_MODULE:
{ {
DIALOG_MODULE_MODULE_EDITOR dialog( this, (MODULE*) GetScreen()->GetCurItem() ); DIALOG_MODULE_MODULE_EDITOR dialog( this,
(MODULE*) GetScreen()->GetCurItem() );
int ret = dialog.ShowModal(); int ret = dialog.ShowModal();
GetScreen()->GetCurItem()->m_Flags = 0; GetScreen()->GetCurItem()->m_Flags = 0;
GetScreen()->GetCurItem()->m_Flags = 0; GetScreen()->GetCurItem()->m_Flags = 0;
@ -473,7 +485,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_MOVE_PAD_REQUEST: case ID_POPUP_PCB_MOVE_PAD_REQUEST:
{ {
SET_DC;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
StartMovePad( (D_PAD*) GetScreen()->GetCurItem(), &dc ); StartMovePad( (D_PAD*) GetScreen()->GetCurItem(), &dc );
} }
@ -481,7 +492,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_EDIT_PAD: case ID_POPUP_PCB_EDIT_PAD:
{ {
SET_DC;
InstallPadOptionsFrame( (D_PAD*) GetScreen()->GetCurItem(), InstallPadOptionsFrame( (D_PAD*) GetScreen()->GetCurItem(),
&dc, pos ); &dc, pos );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
@ -514,15 +524,14 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_EDIT_TEXTMODULE: case ID_POPUP_PCB_EDIT_TEXTMODULE:
{ {
SET_DC; InstallTextModOptionsFrame(
InstallTextModOptionsFrame( (TEXTE_MODULE*) GetScreen()->GetCurItem(), &dc ); (TEXTE_MODULE*) GetScreen()->GetCurItem(), &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
} }
break; break;
case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST: case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST:
{ {
SET_DC;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
StartMoveTexteModule( (TEXTE_MODULE*) GetScreen()->GetCurItem(), &dc ); StartMoveTexteModule( (TEXTE_MODULE*) GetScreen()->GetCurItem(), &dc );
} }
@ -530,7 +539,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_ROTATE_TEXTMODULE: case ID_POPUP_PCB_ROTATE_TEXTMODULE:
{ {
SET_DC;
RotateTextModule( (TEXTE_MODULE*) GetScreen()->GetCurItem(), &dc ); RotateTextModule( (TEXTE_MODULE*) GetScreen()->GetCurItem(), &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
} }
@ -545,7 +553,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_MOVE_EDGE: case ID_POPUP_PCB_MOVE_EDGE:
{ {
SET_DC;
Start_Move_EdgeMod( (EDGE_MODULE*) GetScreen()->GetCurItem(), &dc ); Start_Move_EdgeMod( (EDGE_MODULE*) GetScreen()->GetCurItem(), &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
} }
@ -555,7 +562,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
if( (GetScreen()->GetCurItem()->m_Flags & IS_NEW) ) if( (GetScreen()->GetCurItem()->m_Flags & IS_NEW) )
{ {
SET_DC;
End_Edge_Module( (EDGE_MODULE*) GetScreen()->GetCurItem(), &dc ); End_Edge_Module( (EDGE_MODULE*) GetScreen()->GetCurItem(), &dc );
SetCurItem( NULL ); SetCurItem( NULL );
} }
@ -565,12 +571,11 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
{ {
EDGE_MODULE* edge = NULL; EDGE_MODULE* edge = NULL;
if( GetScreen()->GetCurItem() if( GetScreen()->GetCurItem()
&& ( GetScreen()->GetCurItem()->m_Flags & IS_NEW) && ( GetScreen()->GetCurItem()->m_Flags & IS_NEW )
&& (GetScreen()->GetCurItem()->Type() == TYPE_EDGE_MODULE) ) && ( GetScreen()->GetCurItem()->Type() == TYPE_EDGE_MODULE ) )
{ {
edge = (EDGE_MODULE*) GetScreen()->GetCurItem(); edge = (EDGE_MODULE*) GetScreen()->GetCurItem();
} }
SET_DC;
Enter_Edge_Width( edge, &dc ); Enter_Edge_Width( edge, &dc );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
} }
@ -622,7 +627,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
if( item->Type() != TYPE_PAD ) if( item->Type() != TYPE_PAD )
item = NULL; item = NULL;
} }
SET_DC;
InstallPadOptionsFrame( (D_PAD*) item, &dc, pos ); InstallPadOptionsFrame( (D_PAD*) item, &dc, pos );
} }
break; break;
@ -634,56 +638,38 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PLACE_BLOCK: case ID_POPUP_PLACE_BLOCK:
GetScreen()->m_BlockLocate.m_Command = BLOCK_MOVE; GetScreen()->m_BlockLocate.m_Command = BLOCK_MOVE;
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
{
SET_DC;
HandleBlockPlace( &dc ); HandleBlockPlace( &dc );
}
break; break;
case ID_POPUP_COPY_BLOCK: case ID_POPUP_COPY_BLOCK:
GetScreen()->m_BlockLocate.m_Command = BLOCK_COPY; GetScreen()->m_BlockLocate.m_Command = BLOCK_COPY;
GetScreen()->m_BlockLocate.SetMessageBlock( this ); GetScreen()->m_BlockLocate.SetMessageBlock( this );
DrawPanel->m_AutoPAN_Request = FALSE; DrawPanel->m_AutoPAN_Request = FALSE;
{
SET_DC;
HandleBlockPlace( &dc ); HandleBlockPlace( &dc );
}
break; break;
case ID_POPUP_ZOOM_BLOCK: case ID_POPUP_ZOOM_BLOCK:
GetScreen()->m_BlockLocate.m_Command = BLOCK_ZOOM; GetScreen()->m_BlockLocate.m_Command = BLOCK_ZOOM;
GetScreen()->m_BlockLocate.SetMessageBlock( this ); GetScreen()->m_BlockLocate.SetMessageBlock( this );
{
SET_DC;
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
}
break; break;
case ID_POPUP_DELETE_BLOCK: case ID_POPUP_DELETE_BLOCK:
GetScreen()->m_BlockLocate.m_Command = BLOCK_DELETE; GetScreen()->m_BlockLocate.m_Command = BLOCK_DELETE;
GetScreen()->m_BlockLocate.SetMessageBlock( this ); GetScreen()->m_BlockLocate.SetMessageBlock( this );
{
SET_DC;
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
}
break; break;
case ID_POPUP_ROTATE_BLOCK: case ID_POPUP_ROTATE_BLOCK:
GetScreen()->m_BlockLocate.m_Command = BLOCK_ROTATE; GetScreen()->m_BlockLocate.m_Command = BLOCK_ROTATE;
GetScreen()->m_BlockLocate.SetMessageBlock( this ); GetScreen()->m_BlockLocate.SetMessageBlock( this );
{
SET_DC;
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
}
break; break;
case ID_POPUP_MIRROR_X_BLOCK: case ID_POPUP_MIRROR_X_BLOCK:
GetScreen()->m_BlockLocate.m_Command = BLOCK_MIRROR_X; GetScreen()->m_BlockLocate.m_Command = BLOCK_MIRROR_X;
GetScreen()->m_BlockLocate.SetMessageBlock( this ); GetScreen()->m_BlockLocate.SetMessageBlock( this );
{
SET_DC;
HandleBlockEnd( &dc ); HandleBlockEnd( &dc );
}
break; break;
default: default:
@ -698,21 +684,19 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
} }
/******************************************************************************/
void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
/******************************************************************************/
/* Execute a geometric transform on the current footprint. /* Execute a geometric transform on the current footprint.
* The footprint, after transform is always in reference position and orientation: * The footprint, after transform is always in reference position and
* orientation:
* position 0,0 * position 0,0
* orientation 0, component side. * orientation 0, component side.
*/ */
void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
{ {
D_PAD* pad = module->m_Pads; D_PAD* pad = module->m_Pads;
EDA_BaseStruct* PtStruct = module->m_Drawings; EDA_BaseStruct* PtStruct = module->m_Drawings;
TEXTE_MODULE* textmod; TEXTE_MODULE* textmod;
EDGE_MODULE* edgemod; EDGE_MODULE* edgemod;
int angle = 900; // NECESSAIREMENT +- 900 (+- 90 degres) ) int angle = 900; // Necessary +- 900 (+- 90 degrees) )
switch( transform ) switch( transform )
{ {
@ -737,7 +721,6 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
if( module->m_Value->m_Orient >= 1800 ) if( module->m_Value->m_Orient >= 1800 )
module->m_Value->m_Orient -= 1800; module->m_Value->m_Orient -= 1800;
/* Rectification des contours et textes de l'empreinte : */
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{ {
if( PtStruct->Type() == TYPE_EDGE_MODULE ) if( PtStruct->Type() == TYPE_EDGE_MODULE )
@ -748,7 +731,6 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
} }
if( PtStruct->Type() == TYPE_TEXTE_MODULE ) if( PtStruct->Type() == TYPE_TEXTE_MODULE )
{ {
/* deplacement des inscriptions : */
textmod = (TEXTE_MODULE*) PtStruct; textmod = (TEXTE_MODULE*) PtStruct;
textmod->m_Pos0 = textmod->m_Pos; textmod->m_Pos0 = textmod->m_Pos;
} }
@ -768,21 +750,21 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
pad->m_Orient = 3600 - pad->m_Orient; pad->m_Orient = 3600 - pad->m_Orient;
} }
/* Inversion miroir de la Reference */ /* Reverse mirror of reference. */
textmod = module->m_Reference; textmod = module->m_Reference;
NEGATE( textmod->m_Pos.y ); NEGATE( textmod->m_Pos.y );
NEGATE( textmod->m_Pos0.y ); NEGATE( textmod->m_Pos0.y );
if( textmod->m_Orient ) if( textmod->m_Orient )
textmod->m_Orient = 3600 - textmod->m_Orient; textmod->m_Orient = 3600 - textmod->m_Orient;
/* Inversion miroir de la Valeur */ /* Reverse mirror of value. */
textmod = module->m_Value; textmod = module->m_Value;
NEGATE( textmod->m_Pos.y ); NEGATE( textmod->m_Pos.y );
NEGATE( textmod->m_Pos0.y ); NEGATE( textmod->m_Pos0.y );
if( textmod->m_Orient ) if( textmod->m_Orient )
textmod->m_Orient = 3600 - textmod->m_Orient; textmod->m_Orient = 3600 - textmod->m_Orient;
/* Inversion miroir des dessins de l'empreinte : */ /* Reverse mirror of footprints. */
PtStruct = module->m_Drawings; PtStruct = module->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{ {
@ -792,13 +774,13 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
edgemod = (EDGE_MODULE*) PtStruct; edgemod = (EDGE_MODULE*) PtStruct;
NEGATE( edgemod->m_Start.y ); NEGATE( edgemod->m_Start.y );
NEGATE( edgemod->m_End.y ); NEGATE( edgemod->m_End.y );
/* inversion des coords locales */ /* Invert local coordinates */
NEGATE( edgemod->m_Start0.y ); NEGATE( edgemod->m_Start0.y );
NEGATE( edgemod->m_End0.y ); NEGATE( edgemod->m_End0.y );
break; break;
case TYPE_TEXTE_MODULE: case TYPE_TEXTE_MODULE:
/* Inversion miroir de la position et mise en miroir : */ /* Reverse mirror position and mirror. */
textmod = (TEXTE_MODULE*) PtStruct; textmod = (TEXTE_MODULE*) PtStruct;
NEGATE( textmod->m_Pos.y ); NEGATE( textmod->m_Pos.y );
NEGATE( textmod->m_Pos0.y ); NEGATE( textmod->m_Pos0.y );
@ -807,7 +789,7 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
break; break;
default: default:
DisplayError( this, wxT( "Type Draw Indefini" ) ); DisplayError( this, wxT( "Draw type undefined" ) );
break; break;
} }
} }
@ -815,7 +797,7 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
break; break;
default: default:
DisplayInfoMessage( this, wxT( "Not availlable" ) ); DisplayInfoMessage( this, wxT( "Not available" ) );
break; break;
} }

View File

@ -16,12 +16,10 @@
#include "protos.h" #include "protos.h"
#include "pcbnew_id.h" #include "pcbnew_id.h"
/*************************************************************************/
void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
/*************************************************************************/
/* Handle the left click in footprint editor /* Handle the left click in footprint editor
*/ */
void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
BOARD_ITEM* DrawStruct = GetCurItem(); BOARD_ITEM* DrawStruct = GetCurItem();
@ -48,10 +46,10 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
default: default:
{ {
wxString msg; wxString msg;
msg.Printf( msg.Printf( wxT( "WinEDA_ModEditFrame::OnLeftClick err: \
wxT( m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
"WinEDA_ModEditFrame::OnLeftClick err: m_Flags != 0\nStruct @%p, type %d m_Flag %X" ), DrawStruct, DrawStruct->Type(),
DrawStruct, DrawStruct->Type(), DrawStruct->m_Flags ); DrawStruct->m_Flags );
DisplayError( this, msg ); DisplayError( this, msg );
DrawStruct->m_Flags = 0; DrawStruct->m_Flags = 0;
break; break;
@ -109,18 +107,22 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
Begin_Edge_Module( (EDGE_MODULE*) DrawStruct, DC, 0 ) ); Begin_Edge_Module( (EDGE_MODULE*) DrawStruct, DC, 0 ) );
} }
else else
DisplayError( this, wxT( "ProcessCommand error: DrawStruct/ flags error" ) ); DisplayError( this,
wxT( "ProcessCommand error: DrawStruct flags error" ) );
} }
break; break;
case ID_MODEDIT_DELETE_ITEM_BUTT: case ID_MODEDIT_DELETE_ITEM_BUTT:
if( DrawStruct && (DrawStruct->m_Flags != 0) ) // Item in edit, cannot delete it
// Item in edit, cannot delete it
if( DrawStruct && (DrawStruct->m_Flags != 0) )
break; break;
DrawStruct = ModeditLocateAndDisplay(); DrawStruct = ModeditLocateAndDisplay();
if( DrawStruct == NULL || (DrawStruct->m_Flags != 0) ) if( DrawStruct == NULL || (DrawStruct->m_Flags != 0) )
break; break;
if( DrawStruct->Type() != TYPE_MODULE ) //GetBoard()->m_Modules ) // Cannot delete the module itself if( DrawStruct->Type() != TYPE_MODULE ) //GetBoard()->m_Modules )
{ {
// Cannot delete the module itself
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT ); SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
RemoveStruct( DrawStruct ); RemoveStruct( DrawStruct );
DrawStruct = NULL; DrawStruct = NULL;
@ -133,11 +135,13 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
MODULE* module = GetBoard()->m_Modules; MODULE* module = GetBoard()->m_Modules;
module->m_Flags = 0; module->m_Flags = 0;
SaveCopyInUndoList( module, UR_MODEDIT ); SaveCopyInUndoList( module, UR_MODEDIT );
Place_Ancre( module ); // set the new relatives internal coordinates of items Place_Ancre( module ); // set the new relatives internal
// coordinates of items
GetScreen()->m_Curseur = wxPoint( 0, 0 ); GetScreen()->m_Curseur = wxPoint( 0, 0 );
Recadre_Trace( TRUE ); Recadre_Trace( TRUE );
// Replace the module in position 0, to recalculate absolutes coordinates of items // Replace the module in position 0, to recalculate absolutes
// coordinates of items
module->SetPosition( wxPoint( 0, 0 ) ); module->SetPosition( wxPoint( 0, 0 ) );
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString ); SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
SetCurItem( NULL ); SetCurItem( NULL );
@ -160,7 +164,8 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
default: default:
DrawPanel->SetCursor( wxCURSOR_ARROW ); DrawPanel->SetCursor( wxCURSOR_ARROW );
DisplayError( this, wxT( "WinEDA_ModuleEditFrame::ProcessCommand error" ) ); DisplayError( this,
wxT( "WinEDA_ModuleEditFrame::ProcessCommand error" ) );
m_ID_current_state = 0; m_ID_current_state = 0;
break; break;
} }
@ -169,28 +174,26 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
} }
/*********************************************************************/
bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
wxMenu* PopMenu )
/*********************************************************************/
/* Handle the right click in the footprint editor: /* Handle the right click in the footprint editor:
* Create the pull up menu * Create the pull up menu
* After this menu is built, the standart ZOOM menu is added * After this menu is built, the standard ZOOM menu is added
*/ */
bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
wxMenu* PopMenu )
{ {
BOARD_ITEM* DrawStruct = GetCurItem(); BOARD_ITEM* DrawStruct = GetCurItem();
wxString msg; wxString msg;
bool append_set_width = FALSE; bool append_set_width = FALSE;
bool BlockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE); bool BlockActive =
( GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE );
// Simple localisation des elements si possible // Simple location of elements where possible.
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
{ {
SetCurItem( DrawStruct = ModeditLocateAndDisplay() ); SetCurItem( DrawStruct = ModeditLocateAndDisplay() );
} }
// Si commande en cours: affichage fin de commande // End command in progress.
if( m_ID_current_state ) if( m_ID_current_state )
{ {
if( DrawStruct && DrawStruct->m_Flags ) if( DrawStruct && DrawStruct->m_Flags )
@ -207,23 +210,28 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
{ {
if( (DrawStruct && DrawStruct->m_Flags) || BlockActive ) if( (DrawStruct && DrawStruct->m_Flags) || BlockActive )
{ {
if( BlockActive ) // Put block commnands in list if( BlockActive ) // Put block commands in list
{ {
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
_( "Cancel Block" ), cancel_xpm ); _( "Cancel Block" ), cancel_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_ZOOM_BLOCK, ADD_MENUITEM( PopMenu, ID_POPUP_ZOOM_BLOCK,
_( "Zoom Block (drag middle mouse)" ), zoom_selected_xpm ); _( "Zoom Block (drag middle mouse)" ),
zoom_selected_xpm );
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
ADD_MENUITEM( PopMenu, ID_POPUP_PLACE_BLOCK, ADD_MENUITEM( PopMenu, ID_POPUP_PLACE_BLOCK,
_( "Place Block" ), apply_xpm ); _( "Place Block" ), apply_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_COPY_BLOCK, ADD_MENUITEM( PopMenu, ID_POPUP_COPY_BLOCK,
_( "Copy Block (shift + drag mouse)" ), copyblock_xpm ); _( "Copy Block (shift + drag mouse)" ),
copyblock_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_MIRROR_X_BLOCK, ADD_MENUITEM( PopMenu, ID_POPUP_MIRROR_X_BLOCK,
_( "Mirror Block (alt + drag mouse)" ), mirror_H_xpm ); _( "Mirror Block (alt + drag mouse)" ),
mirror_H_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_ROTATE_BLOCK, ADD_MENUITEM( PopMenu, ID_POPUP_ROTATE_BLOCK,
_( "Rotate Block (ctrl + drag mouse)" ), rotate_pos_xpm ); _( "Rotate Block (ctrl + drag mouse)" ),
rotate_pos_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_DELETE_BLOCK, ADD_MENUITEM( PopMenu, ID_POPUP_DELETE_BLOCK,
_( "Delete Block (shift+ctrl + drag mouse)" ), delete_xpm ); _( "Delete Block (shift+ctrl + drag mouse)" ),
delete_xpm );
} }
else else
{ {
@ -262,7 +270,8 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_PAD_REQUEST, ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_PAD_REQUEST,
_( "Move Pad" ), move_pad_xpm ); _( "Move Pad" ), move_pad_xpm );
} }
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_PAD, _( "Edit Pad" ), options_pad_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_PAD, _( "Edit Pad" ),
options_pad_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_IMPORT_PAD_SETTINGS, ADD_MENUITEM( PopMenu, ID_POPUP_PCB_IMPORT_PAD_SETTINGS,
_( "New Pad Settings" ), options_new_pad_xpm ); _( "New Pad Settings" ), options_new_pad_xpm );
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EXPORT_PAD_SETTINGS, ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EXPORT_PAD_SETTINGS,
@ -308,7 +317,8 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
_( "Place edge" ), apply_xpm ); _( "Place edge" ), apply_xpm );
wxMenu* edit_mnu = new wxMenu; wxMenu* edit_mnu = new wxMenu;
ADD_MENUITEM_WITH_SUBMENU( PopMenu, edit_mnu, ADD_MENUITEM_WITH_SUBMENU( PopMenu, edit_mnu,
ID_POPUP_PCB_EDIT_EDGE, _( "Edit" ), edit_xpm ); ID_POPUP_PCB_EDIT_EDGE, _(
"Edit" ), edit_xpm );
ADD_MENUITEM( edit_mnu, ID_POPUP_PCB_EDIT_WIDTH_CURRENT_EDGE, ADD_MENUITEM( edit_mnu, ID_POPUP_PCB_EDIT_WIDTH_CURRENT_EDGE,
_( "Edit Width (Current)" ), width_segment_xpm ); _( "Edit Width (Current)" ), width_segment_xpm );
ADD_MENUITEM( edit_mnu, ID_POPUP_PCB_EDIT_WIDTH_ALL_EDGE, ADD_MENUITEM( edit_mnu, ID_POPUP_PCB_EDIT_WIDTH_ALL_EDGE,
@ -336,15 +346,13 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
case TYPE_SCREEN: case TYPE_SCREEN:
case TYPE_NOT_INIT: case TYPE_NOT_INIT:
case TYPE_PCB: case TYPE_PCB:
msg.Printf( msg.Printf( wxT( "WinEDA_ModuleEditFrame::OnRightClick Error: illegal DrawType %d" ),
wxT( "WinEDA_ModuleEditFrame::OnRightClick Error: illegal DrawType %d" ),
DrawStruct->Type() ); DrawStruct->Type() );
DisplayError( this, msg ); DisplayError( this, msg );
break; break;
default: default:
msg.Printf( msg.Printf( wxT( "WinEDA_ModuleEditFrame::OnRightClick Error: unknown DrawType %d" ),
wxT( "WinEDA_ModuleEditFrame::OnRightClick Error: unknown DrawType %d" ),
DrawStruct->Type() ); DrawStruct->Type() );
DisplayError( this, msg ); DisplayError( this, msg );
break; break;
@ -353,9 +361,10 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
PopMenu->AppendSeparator(); PopMenu->AppendSeparator();
if( append_set_width if( append_set_width
|| ( m_ID_current_state && ( (m_ID_current_state == ID_PCB_ADD_LINE_BUTT) || ( m_ID_current_state
|| (m_ID_current_state == ID_PCB_CIRCLE_BUTT) && ( ( m_ID_current_state == ID_PCB_ADD_LINE_BUTT )
|| (m_ID_current_state == ID_PCB_ARC_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, ADD_MENUITEM( PopMenu, ID_POPUP_PCB_ENTER_EDGE_WIDTH,
_( "Set Width" ), width_segment_xpm ); _( "Set Width" ), width_segment_xpm );
@ -366,13 +375,10 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
} }
/****************************************************************************/ /* Handle the double click in the footprint editor:
void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
/****************************************************************************/
/* Handle the double click in the footprin editor:
* If the double clicked item is editable: call the corresponding editor. * If the double clicked item is editable: call the corresponding editor.
*/ */
void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
{ {
BOARD_ITEM* DrawStruct = GetCurItem(); BOARD_ITEM* DrawStruct = GetCurItem();
wxPoint pos = GetPosition(); wxPoint pos = GetPosition();
@ -383,12 +389,12 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
switch( m_ID_current_state ) switch( m_ID_current_state )
{ {
case 0: case 0:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
{ {
DrawStruct = ModeditLocateAndDisplay(); DrawStruct = ModeditLocateAndDisplay();
} }
if( (DrawStruct == NULL) || (DrawStruct->m_Flags != 0) ) if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags != 0 ) )
break; break;
// Item found // Item found
@ -397,8 +403,7 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
switch( DrawStruct->Type() ) switch( DrawStruct->Type() )
{ {
case TYPE_PAD: case TYPE_PAD:
InstallPadOptionsFrame( InstallPadOptionsFrame( (D_PAD*) DrawStruct, &dc, pos );
(D_PAD*) DrawStruct, &dc, pos );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;
@ -427,7 +432,7 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
case ID_PCB_ADD_LINE_BUTT: case ID_PCB_ADD_LINE_BUTT:
{ {
if( DrawStruct && (DrawStruct->m_Flags & IS_NEW) ) if( DrawStruct && ( DrawStruct->m_Flags & IS_NEW ) )
{ {
End_Edge_Module( (EDGE_MODULE*) DrawStruct, DC ); End_Edge_Module( (EDGE_MODULE*) DrawStruct, DC );
SetCurItem( NULL ); SetCurItem( NULL );

View File

@ -1,12 +1,6 @@
/*******************************************************/ /***********************************************/
/* PCBNEW - Gestion des Options et Reglages de modeedit*/ /* PCBNEW - Footprint (module) editor options. */
/*******************************************************/ /***********************************************/
/* Fichier modeditoptions.cpp */
/*
Affichage et modifications des parametres de travail de Modedit
*/
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
@ -21,70 +15,68 @@
#include "protos.h" #include "protos.h"
void WinEDA_ModuleEditFrame::OnSelectOptionToolbar( wxCommandEvent& event )
/***********************************************************************/
void WinEDA_ModuleEditFrame::OnSelectOptionToolbar(wxCommandEvent& event)
/***********************************************************************/
{ {
int id = event.GetId(); int id = event.GetId();
wxClientDC dc(DrawPanel); wxClientDC dc( DrawPanel );
DrawPanel->CursorOff( &dc); DrawPanel->CursorOff( &dc );
DrawPanel->PrepareGraphicContext(&dc); DrawPanel->PrepareGraphicContext( &dc );
switch ( id ) switch( id )
{ {
case ID_TB_OPTIONS_SHOW_GRID: case ID_TB_OPTIONS_SHOW_GRID:
m_Draw_Grid = m_OptionsToolBar->GetToolState(id); m_Draw_Grid = m_OptionsToolBar->GetToolState( id );
DrawPanel->ReDraw(&dc, TRUE); DrawPanel->ReDraw( &dc, TRUE );
break; break;
case ID_TB_OPTIONS_SELECT_UNIT_MM: case ID_TB_OPTIONS_SELECT_UNIT_MM:
g_UnitMetric = MILLIMETRE; g_UnitMetric = MILLIMETRE;
case ID_TB_OPTIONS_SELECT_UNIT_INCH: case ID_TB_OPTIONS_SELECT_UNIT_INCH:
if ( id == ID_TB_OPTIONS_SELECT_UNIT_INCH ) if( id == ID_TB_OPTIONS_SELECT_UNIT_INCH )
g_UnitMetric = INCHES; g_UnitMetric = INCHES;
UpdateStatusBar(); /* Reaffichage des coord curseur */ UpdateStatusBar();
ReCreateAuxiliaryToolbar(); ReCreateAuxiliaryToolbar();
break; break;
case ID_TB_OPTIONS_SHOW_POLAR_COORD: case ID_TB_OPTIONS_SHOW_POLAR_COORD:
Affiche_Message(wxEmptyString); Affiche_Message( wxEmptyString );
DisplayOpt.DisplayPolarCood = m_OptionsToolBar->GetToolState(id); DisplayOpt.DisplayPolarCood = m_OptionsToolBar->GetToolState( id );
UpdateStatusBar(); /* Reaffichage des coord curseur */ UpdateStatusBar();
break; break;
case ID_TB_OPTIONS_SELECT_CURSOR: case ID_TB_OPTIONS_SELECT_CURSOR:
m_CursorShape = m_OptionsToolBar->GetToolState(id); m_CursorShape = m_OptionsToolBar->GetToolState( id );
break; break;
case ID_TB_OPTIONS_SHOW_PADS_SKETCH: case ID_TB_OPTIONS_SHOW_PADS_SKETCH:
m_DisplayPadFill = ! m_OptionsToolBar->GetToolState(id); m_DisplayPadFill = !m_OptionsToolBar->GetToolState( id );
DrawPanel->ReDraw(&dc, TRUE); DrawPanel->ReDraw( &dc, TRUE );
break; break;
case ID_TB_OPTIONS_SHOW_VIAS_SKETCH: case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
m_DisplayViaFill = ! m_OptionsToolBar->GetToolState(id); m_DisplayViaFill = !m_OptionsToolBar->GetToolState( id );
DrawPanel->ReDraw(&dc, TRUE); DrawPanel->ReDraw( &dc, TRUE );
break; break;
case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH: case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH:
m_DisplayModText = m_DisplayModText =
m_OptionsToolBar->GetToolState(id) ? SKETCH : FILLED; m_OptionsToolBar->GetToolState( id ) ? SKETCH : FILLED;
DrawPanel->ReDraw(&dc, TRUE); DrawPanel->ReDraw( &dc, TRUE );
break; break;
case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH: case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH:
m_DisplayModEdge = m_DisplayModEdge =
m_OptionsToolBar->GetToolState(id) ? SKETCH : FILLED; m_OptionsToolBar->GetToolState( id ) ? SKETCH : FILLED;
DrawPanel->ReDraw(&dc, TRUE); DrawPanel->ReDraw( &dc, TRUE );
break; break;
default: default:
DisplayError(this, wxT("WinEDA_ModuleEditFrame::OnSelectOptionToolbar error") ); DisplayError( this,
wxT( "WinEDA_ModuleEditFrame::OnSelectOptionToolbar error" ) );
break; break;
} }
SetToolbars(); SetToolbars();
DrawPanel->CursorOn(&dc); DrawPanel->CursorOn( &dc );
} }

View File

@ -1,6 +1,6 @@
/***************************************************************************/ /************************************************************/
/* moduleframe.cpp - fonctions de base de la classe WinEDA_ModuleEditFrame */ /* moduleframe.cpp - Footprint (module) editor main window. */
/***************************************************************************/ /************************************************************/
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
@ -20,132 +20,129 @@
#include "3d_viewer.h" #include "3d_viewer.h"
// local variables: static PCB_SCREEN* s_screenModule = NULL; // the PCB_SCREEN used by the
static PCB_SCREEN* s_screenModule = NULL; // the PCB_SCREEN used by the footprint editor // footprint editor
/********************************/ /********************************/
/* class WinEDA_ModuleEditFrame */ /* class WinEDA_ModuleEditFrame */
/********************************/ /********************************/
BEGIN_EVENT_TABLE( WinEDA_ModuleEditFrame, WinEDA_BasePcbFrame ) BEGIN_EVENT_TABLE( WinEDA_ModuleEditFrame, WinEDA_BasePcbFrame )
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START, EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START,
ID_POPUP_PCB_ITEM_SELECTION_END, ID_POPUP_PCB_ITEM_SELECTION_END,
WinEDA_BasePcbFrame::ProcessItemSelection ) WinEDA_BasePcbFrame::ProcessItemSelection )
EVT_CLOSE( WinEDA_ModuleEditFrame::OnCloseWindow ) EVT_CLOSE( WinEDA_ModuleEditFrame::OnCloseWindow )
EVT_SIZE( WinEDA_ModuleEditFrame::OnSize ) EVT_SIZE( WinEDA_ModuleEditFrame::OnSize )
EVT_KICAD_CHOICEBOX( ID_ON_ZOOM_SELECT, WinEDA_ModuleEditFrame::OnSelectZoom ) EVT_KICAD_CHOICEBOX( ID_ON_ZOOM_SELECT,
EVT_KICAD_CHOICEBOX( ID_ON_GRID_SELECT, WinEDA_ModuleEditFrame::OnSelectGrid ) WinEDA_ModuleEditFrame::OnSelectZoom )
EVT_KICAD_CHOICEBOX( ID_ON_GRID_SELECT,
WinEDA_ModuleEditFrame::OnSelectGrid )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_ModuleEditFrame::OnZoom ) EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_ModuleEditFrame::OnZoom )
EVT_TOOL( ID_MODEDIT_SELECT_CURRENT_LIB, EVT_TOOL( ID_MODEDIT_SELECT_CURRENT_LIB,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_SAVE_LIBMODULE, EVT_TOOL( ID_MODEDIT_SAVE_LIBMODULE,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_DELETE_PART, EVT_TOOL( ID_MODEDIT_DELETE_PART,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_NEW_MODULE, EVT_TOOL( ID_MODEDIT_NEW_MODULE,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_LOAD_MODULE, EVT_TOOL( ID_MODEDIT_LOAD_MODULE,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_IMPORT_PART, EVT_TOOL( ID_MODEDIT_IMPORT_PART,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_EXPORT_PART, EVT_TOOL( ID_MODEDIT_EXPORT_PART,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, EVT_TOOL( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_SHEET_SET, EVT_TOOL( ID_MODEDIT_SHEET_SET,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_GEN_PRINT, WinEDA_ModuleEditFrame::ToPrinter ) EVT_TOOL( ID_GEN_PRINT, WinEDA_ModuleEditFrame::ToPrinter )
EVT_TOOL( ID_MODEDIT_LOAD_MODULE, EVT_TOOL( ID_MODEDIT_LOAD_MODULE,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_CHECK, EVT_TOOL( ID_MODEDIT_CHECK,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_PAD_SETTINGS, EVT_TOOL( ID_MODEDIT_PAD_SETTINGS,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, EVT_TOOL( ID_MODEDIT_LOAD_MODULE_FROM_BOARD,
WinEDA_ModuleEditFrame::LoadModuleFromBoard ) WinEDA_ModuleEditFrame::LoadModuleFromBoard )
EVT_TOOL( ID_MODEDIT_INSERT_MODULE_IN_BOARD, EVT_TOOL( ID_MODEDIT_INSERT_MODULE_IN_BOARD,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_UPDATE_MODULE_IN_BOARD, EVT_TOOL( ID_MODEDIT_UPDATE_MODULE_IN_BOARD,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_EDIT_MODULE_PROPERTIES, EVT_TOOL( ID_MODEDIT_EDIT_MODULE_PROPERTIES,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_UNDO, EVT_TOOL( ID_MODEDIT_UNDO,
WinEDA_ModuleEditFrame::GetComponentFromUndoList ) WinEDA_ModuleEditFrame::GetComponentFromUndoList )
EVT_TOOL( ID_MODEDIT_REDO, EVT_TOOL( ID_MODEDIT_REDO,
WinEDA_ModuleEditFrame::GetComponentFromRedoList ) WinEDA_ModuleEditFrame::GetComponentFromRedoList )
// Vertical toolbar (left click): // Vertical toolbar (left click):
EVT_TOOL( ID_NO_SELECT_BUTT, EVT_TOOL( ID_NO_SELECT_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_ADD_PAD, EVT_TOOL( ID_MODEDIT_ADD_PAD,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ARC_BUTT, EVT_TOOL( ID_PCB_ARC_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_CIRCLE_BUTT, EVT_TOOL( ID_PCB_CIRCLE_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ADD_TEXT_BUTT, EVT_TOOL( ID_PCB_ADD_TEXT_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ADD_LINE_BUTT, EVT_TOOL( ID_PCB_ADD_LINE_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_DELETE_ITEM_BUTT, EVT_TOOL( ID_MODEDIT_DELETE_ITEM_BUTT,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_PLACE_ANCHOR, EVT_TOOL( ID_MODEDIT_PLACE_ANCHOR,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
// Vertical toolbar (right click): // Vertical toolbar (right click):
EVT_TOOL_RCLICKED( ID_MODEDIT_ADD_PAD, EVT_TOOL_RCLICKED( ID_MODEDIT_ADD_PAD,
WinEDA_ModuleEditFrame::ToolOnRightClick ) WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_TRACK_BUTT, EVT_TOOL_RCLICKED( ID_TRACK_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick ) WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_CIRCLE_BUTT, EVT_TOOL_RCLICKED( ID_PCB_CIRCLE_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick ) WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_ARC_BUTT, EVT_TOOL_RCLICKED( ID_PCB_ARC_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick ) WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_ADD_TEXT_BUTT, EVT_TOOL_RCLICKED( ID_PCB_ADD_TEXT_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick ) WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_ADD_LINE_BUTT, EVT_TOOL_RCLICKED( ID_PCB_ADD_LINE_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick ) WinEDA_ModuleEditFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_COTATION_BUTT, EVT_TOOL_RCLICKED( ID_PCB_COTATION_BUTT,
WinEDA_ModuleEditFrame::ToolOnRightClick ) WinEDA_ModuleEditFrame::ToolOnRightClick )
// Options Toolbar // Options Toolbar
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END, EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
WinEDA_ModuleEditFrame::OnSelectOptionToolbar ) WinEDA_ModuleEditFrame::OnSelectOptionToolbar )
// popup commands // popup commands
EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE, EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE, EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
// Transformations du module // Module transformations
EVT_MENU( ID_MODEDIT_MODULE_ROTATE, EVT_MENU( ID_MODEDIT_MODULE_ROTATE,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_MODEDIT_MODULE_MIRROR, EVT_MENU( ID_MODEDIT_MODULE_MIRROR,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_PCB_PAD_SETUP, EVT_MENU( ID_PCB_PAD_SETUP,
WinEDA_ModuleEditFrame::Process_Special_Functions ) WinEDA_ModuleEditFrame::Process_Special_Functions )
EVT_MENU( ID_PCB_USER_GRID_SETUP, EVT_MENU( ID_PCB_USER_GRID_SETUP,
WinEDA_PcbFrame::Process_Special_Functions ) WinEDA_PcbFrame::Process_Special_Functions )
// Menu 3D Frame // Menu 3D Frame
EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, WinEDA_ModuleEditFrame::Show3D_Frame ) EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, WinEDA_ModuleEditFrame::Show3D_Frame )
// PopUp Menu Zoom trait<69>s dans drawpanel.cpp
END_EVENT_TABLE() END_EVENT_TABLE()
/****************/
/* Constructeur */
/****************/
WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father, WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxPoint& pos,
@ -189,54 +186,56 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
if( DrawPanel ) if( DrawPanel )
DrawPanel->m_Block_Enable = TRUE; DrawPanel->m_Block_Enable = TRUE;
#if defined(KICAD_AUIMANAGER) #if defined(KICAD_AUIMANAGER)
m_auimgr.SetManagedWindow(this); m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz; wxAuiPaneInfo horiz;
horiz.Gripper(false); horiz.Gripper( false );
horiz.DockFixed(true); horiz.DockFixed( true );
horiz.Movable(false); horiz.Movable( false );
horiz.Floatable(false); horiz.Floatable( false );
horiz.CloseButton(false); horiz.CloseButton( false );
horiz.CaptionVisible(false); horiz.CaptionVisible( false );
wxAuiPaneInfo vert(horiz); wxAuiPaneInfo vert( horiz );
vert.TopDockable(false).BottomDockable(false); vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable(false).RightDockable(false); horiz.LeftDockable( false ).RightDockable( false );
m_auimgr.AddPane(m_HToolBar, m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo(horiz).Name(wxT("m_HToolBar")).Top().Row(0)); wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().
Row( 0 ) );
m_auimgr.AddPane(m_AuxiliaryToolBar, m_auimgr.AddPane( m_AuxiliaryToolBar,
wxAuiPaneInfo(horiz).Name(wxT("m_AuxiliaryToolBar")).Top().Row(1)); wxAuiPaneInfo( horiz ).Name( wxT( "m_AuxiliaryToolBar" ) ).
Top().Row( 1 ) );
m_auimgr.AddPane(m_VToolBar, m_auimgr.AddPane( m_VToolBar,
wxAuiPaneInfo(vert).Name(wxT("m_VToolBar")).Right()); wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );
m_auimgr.AddPane(m_OptionsToolBar, m_auimgr.AddPane( m_OptionsToolBar,
wxAuiPaneInfo(vert).Name(wxT("m_OptionsToolBar")).Left()); wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).
Left() );
m_auimgr.AddPane(DrawPanel, m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name(wxT("DrawFrame")).CentrePane()); wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
m_auimgr.AddPane(MsgPanel, m_auimgr.AddPane( MsgPanel,
wxAuiPaneInfo(horiz).Name(wxT("MsgPanel")).Bottom()); wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
m_auimgr.Update(); m_auimgr.Update();
#endif #endif
} }
/****************************************************/
WinEDA_ModuleEditFrame::~WinEDA_ModuleEditFrame() WinEDA_ModuleEditFrame::~WinEDA_ModuleEditFrame()
/****************************************************/
{ {
/* g_ModuleEditor_Pcb and its correspondinf PCB_SCREEN are not deleted here, /* g_ModuleEditor_Pcb and its corresponding PCB_SCREEN are not deleted
* because if we reopen the Footprint editor, we expect to find the last edited item * here, because if we reopen the Footprint editor, we expect to find
* the last edited item
*/ */
SetBaseScreen( NULL ); /* Do not delete (by the destructor of WinEDA_DrawFrame) SetBaseScreen( NULL ); /* Do not delete (by the destructor of
* the PCB_SCREEN handling g_ModuleEditor_Pcb * WinEDA_DrawFrame) the PCB_SCREEN handling
* g_ModuleEditor_Pcb
*/ */
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) GetParent(); WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) GetParent();
@ -245,9 +244,7 @@ WinEDA_ModuleEditFrame::~WinEDA_ModuleEditFrame()
} }
/**************************************************************/
void WinEDA_ModuleEditFrame::OnCloseWindow( wxCloseEvent& Event ) void WinEDA_ModuleEditFrame::OnCloseWindow( wxCloseEvent& Event )
/**************************************************************/
{ {
if( GetScreen()->IsModify() ) if( GetScreen()->IsModify() )
{ {
@ -286,7 +283,8 @@ void WinEDA_ModuleEditFrame::SetToolbars()
active ); active );
m_HToolBar->EnableTool( ID_MODEDIT_SAVE_LIBMODULE, active && islib ); m_HToolBar->EnableTool( ID_MODEDIT_SAVE_LIBMODULE, active && islib );
MODULE* module_in_edit = GetBoard()->m_Modules; MODULE* module_in_edit = GetBoard()->m_Modules;
if( module_in_edit && module_in_edit->m_Link ) // this is not a new module ... if( module_in_edit && module_in_edit->m_Link ) // this is not a new module
// ...
{ {
BOARD* mainpcb = frame->GetBoard(); BOARD* mainpcb = frame->GetBoard();
MODULE* source_module = mainpcb->m_Modules; MODULE* source_module = mainpcb->m_Modules;
@ -303,7 +301,8 @@ void WinEDA_ModuleEditFrame::SetToolbars()
m_HToolBar->EnableTool( ID_MODEDIT_INSERT_MODULE_IN_BOARD, false ); m_HToolBar->EnableTool( ID_MODEDIT_INSERT_MODULE_IN_BOARD, false );
m_HToolBar->EnableTool( ID_MODEDIT_UPDATE_MODULE_IN_BOARD, true ); m_HToolBar->EnableTool( ID_MODEDIT_UPDATE_MODULE_IN_BOARD, true );
} }
else // The source was deleted, therefore we can insert but not update the module else // The source was deleted, therefore we can insert but not
// update the module
{ {
m_HToolBar->EnableTool( ID_MODEDIT_INSERT_MODULE_IN_BOARD, true ); m_HToolBar->EnableTool( ID_MODEDIT_INSERT_MODULE_IN_BOARD, true );
m_HToolBar->EnableTool( ID_MODEDIT_UPDATE_MODULE_IN_BOARD, false ); m_HToolBar->EnableTool( ID_MODEDIT_UPDATE_MODULE_IN_BOARD, false );
@ -317,8 +316,10 @@ void WinEDA_ModuleEditFrame::SetToolbars()
if( GetScreen() ) if( GetScreen() )
{ {
m_HToolBar->EnableTool( ID_MODEDIT_UNDO, GetScreen()->GetUndoCommandCount()>0 && active ); m_HToolBar->EnableTool( ID_MODEDIT_UNDO,
m_HToolBar->EnableTool( ID_MODEDIT_REDO, GetScreen()->GetRedoCommandCount()>0 && active ); GetScreen()->GetUndoCommandCount()>0 && active );
m_HToolBar->EnableTool( ID_MODEDIT_REDO,
GetScreen()->GetRedoCommandCount()>0 && active );
} }
if( frame->GetBoard()->m_Modules ) if( frame->GetBoard()->m_Modules )
@ -344,8 +345,10 @@ void WinEDA_ModuleEditFrame::SetToolbars()
if( m_OptionsToolBar ) if( m_OptionsToolBar )
{ {
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM, m_OptionsToolBar->ToggleTool(
g_UnitMetric == MILLIMETRE ? TRUE : false ); ID_TB_OPTIONS_SELECT_UNIT_MM,
g_UnitMetric ==
MILLIMETRE ? TRUE : false );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH,
g_UnitMetric == INCHES ? TRUE : false ); g_UnitMetric == INCHES ? TRUE : false );
@ -353,13 +356,15 @@ void WinEDA_ModuleEditFrame::SetToolbars()
DisplayOpt.DisplayPolarCood ); DisplayOpt.DisplayPolarCood );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_POLAR_COORD, m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_POLAR_COORD,
DisplayOpt.DisplayPolarCood ? DisplayOpt.DisplayPolarCood ?
_( "Polar Coords not show" ) : _( "Display rectangular coordinates" ) :
_( "Display Polar Coords" ) ); _( "Display polar coordinates" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID,
m_Draw_Grid ); m_Draw_Grid );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID, m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID,
m_Draw_Grid ? _( "Grid not show" ) : _( "Show Grid" ) ); m_Draw_Grid ?
_( "Hide grid" ) :
_( "Show grid" ) );
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR, m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR,
@ -371,8 +376,8 @@ void WinEDA_ModuleEditFrame::SetToolbars()
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_PADS_SKETCH, m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
m_DisplayPadFill ? m_DisplayPadFill ?
_( "Show Pads Sketch mode" ) : _( "Show pads in sketch mode" ) :
_( "Show pads filled mode" ) ); _( "Show pads in filled mode" ) );
} }
if( m_AuxiliaryToolBar ) if( m_AuxiliaryToolBar )
@ -401,7 +406,7 @@ void WinEDA_ModuleEditFrame::SetToolbars()
DisplayUnitsMsg(); DisplayUnitsMsg();
#if defined(KICAD_AUIMANAGER) #if defined(KICAD_AUIMANAGER)
if(m_auimgr.GetManagedWindow()) if( m_auimgr.GetManagedWindow() )
m_auimgr.Update(); m_auimgr.Update();
#endif #endif
} }
@ -456,25 +461,25 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
switch( g_KeyPressed ) switch( g_KeyPressed )
{ {
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */ case WXK_NUMPAD8:
case WXK_UP: case WXK_UP:
Mouse.y -= wxRound( delta.y ); Mouse.y -= wxRound( delta.y );
DrawPanel->MouseTo( Mouse ); DrawPanel->MouseTo( Mouse );
break; break;
case WXK_NUMPAD2: /* Deplacement curseur vers le bas */ case WXK_NUMPAD2:
case WXK_DOWN: case WXK_DOWN:
Mouse.y += wxRound( delta.y ); Mouse.y += wxRound( delta.y );
DrawPanel->MouseTo( Mouse ); DrawPanel->MouseTo( Mouse );
break; break;
case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */ case WXK_NUMPAD4:
case WXK_LEFT: case WXK_LEFT:
Mouse.x -= wxRound( delta.x ); Mouse.x -= wxRound( delta.x );
DrawPanel->MouseTo( Mouse ); DrawPanel->MouseTo( Mouse );
break; break;
case WXK_NUMPAD6: /* Deplacement curseur vers la droite */ case WXK_NUMPAD6:
case WXK_RIGHT: case WXK_RIGHT:
Mouse.x += wxRound( delta.x ); Mouse.x += wxRound( delta.x );
DrawPanel->MouseTo( Mouse ); DrawPanel->MouseTo( Mouse );
@ -485,10 +490,7 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
break; break;
} }
/* Recalcul de la position du curseur schema */
GetScreen()->m_Curseur = curpos; GetScreen()->m_Curseur = curpos;
/* Placement sur la grille generale */
PutOnGrid( &GetScreen()->m_Curseur ); PutOnGrid( &GetScreen()->m_Curseur );
if( oldpos != GetScreen()->m_Curseur ) if( oldpos != GetScreen()->m_Curseur )
@ -517,5 +519,5 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
} }
SetToolbars(); SetToolbars();
UpdateStatusBar(); /* Affichage des coord curseur */ UpdateStatusBar();
} }

View File

@ -1,8 +1,6 @@
/********************************************************/ /***************/
/* Modification de la place, orient, nombre des MODULES */ /* modules.cpp */
/********************************************************/ /***************/
/* Fichier MODULES.Cpp */
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
@ -18,24 +16,20 @@
#include "drag.h" #include "drag.h"
/* fonctions externes */
/* Fonctions locales */
static void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC ); static void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC );
/* Variables locales : */
static MODULE* s_ModuleInitialCopy = NULL; // Copy of module for abort/undo command static MODULE* s_ModuleInitialCopy = NULL; // Copy of module for
static PICKED_ITEMS_LIST s_PickedList; // a picked list to save initial module and dragged tracks // abort/undo command
static PICKED_ITEMS_LIST s_PickedList; // a picked list to
// save initial module
// and dragged tracks
/*************************************************************************/ /* Show or hide module pads.
void Show_Pads_On_Off( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module )
/**************************************************************************/
/* Fonction appelee lors de l'activation/desactivation de la visualisation
* des Pads du module en deplacement
* Effacement ou visu des Pads selon conditions initiales
*/ */
void Show_Pads_On_Off( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module )
{ {
D_PAD* pt_pad; D_PAD* pt_pad;
bool pad_fill_tmp; bool pad_fill_tmp;
@ -55,11 +49,8 @@ void Show_Pads_On_Off( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module )
} }
/***************************************************************************/ /* Show or hide ratsnest
/* Fonction appelee lors de l'activation/desactivation de la visualisation */ */
/* du rastnest du module en deplacement */
/* Effacement ou visu du rastnest selon conditions initiales */
/***************************************************************************/
void Rastnest_On_Off( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module ) void Rastnest_On_Off( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module )
{ {
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->m_Parent; WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->m_Parent;
@ -69,17 +60,14 @@ void Rastnest_On_Off( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module )
} }
/***************************************************/
MODULE* WinEDA_BasePcbFrame::GetModuleByName()
/***************************************************/
/* Get a module name from user and return a pointer to the corresponding module /* Get a module name from user and return a pointer to the corresponding module
*/ */
MODULE* WinEDA_BasePcbFrame::GetModuleByName()
{ {
wxString modulename; wxString modulename;
MODULE* module = NULL; MODULE* module = NULL;
Get_Message( _( "Name:" ), _("Search footprint"), modulename, this ); Get_Message( _( "Name:" ), _( "Search footprint" ), modulename, this );
if( !modulename.IsEmpty() ) if( !modulename.IsEmpty() )
{ {
module = GetBoard()->m_Modules; module = GetBoard()->m_Modules;
@ -94,11 +82,8 @@ MODULE* WinEDA_BasePcbFrame::GetModuleByName()
} }
/**********************************************************************/
void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC ) void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
/**********************************************************************/
{ {
if( module == NULL ) if( module == NULL )
return; return;
@ -106,8 +91,8 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
delete s_ModuleInitialCopy; delete s_ModuleInitialCopy;
s_PickedList.ClearItemsList(); // Should be empty, but... s_PickedList.ClearItemsList(); // Should be empty, but...
// Creates a copy of the cuttent module, for abort and undo commands // Creates a copy of the current module, for abort and undo commands
s_ModuleInitialCopy = new MODULE( GetBoard()); s_ModuleInitialCopy = new MODULE( GetBoard() );
s_ModuleInitialCopy->Copy( module ); s_ModuleInitialCopy->Copy( module );
s_ModuleInitialCopy->m_Flags = 0; s_ModuleInitialCopy->m_Flags = 0;
@ -118,7 +103,7 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
GetScreen()->m_Curseur = module->m_Pos; GetScreen()->m_Curseur = module->m_Pos;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
/* Effacement chevelu general si necessaire */ /* Show ratsnest. */
if( g_Show_Ratsnest ) if( g_Show_Ratsnest )
DrawGeneralRatsnest( DC ); DrawGeneralRatsnest( DC );
@ -130,14 +115,16 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
if( g_Drag_Pistes_On ) if( g_Drag_Pistes_On )
{ {
Build_Drag_Liste( DrawPanel, DC, module ); Build_Drag_Liste( DrawPanel, DC, module );
ITEM_PICKER itemWrapper(NULL, UR_CHANGED); ITEM_PICKER itemWrapper( NULL, UR_CHANGED );
for( DRAG_SEGM* pt_drag = g_DragSegmentList; pt_drag != NULL; pt_drag = pt_drag->Pnext ) for( DRAG_SEGM* pt_drag = g_DragSegmentList;
pt_drag != NULL;
pt_drag = pt_drag->Pnext )
{ {
TRACK * segm = pt_drag->m_Segm; TRACK* segm = pt_drag->m_Segm;
itemWrapper.m_PickedItem = segm; itemWrapper.m_PickedItem = segm;
itemWrapper.m_Link = segm->Copy(); itemWrapper.m_Link = segm->Copy();
itemWrapper.m_Link->SetState( EDIT, OFF ); itemWrapper.m_Link->SetState( EDIT, OFF );
s_PickedList.PushItem(itemWrapper); s_PickedList.PushItem( itemWrapper );
} }
} }
@ -146,7 +133,7 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
DrawPanel->ForceCloseManageCurseur = Abort_MoveOrCopyModule; DrawPanel->ForceCloseManageCurseur = Abort_MoveOrCopyModule;
DrawPanel->m_AutoPAN_Request = TRUE; DrawPanel->m_AutoPAN_Request = TRUE;
// effacement module a l'ecran: // Erase the module.
if( DC ) if( DC )
{ {
int tmp = module->m_Flags; int tmp = module->m_Flags;
@ -155,17 +142,13 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
module->m_Flags = tmp; module->m_Flags = tmp;
} }
// Reaffichage
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
} }
/**************************************************************/
void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC )
/****************************************************************/
/* Called on a move or copy module command abort /* Called on a move or copy module command abort
*/ */
void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC )
{ {
DRAG_SEGM* pt_drag; DRAG_SEGM* pt_drag;
TRACK* pt_segm; TRACK* pt_segm;
@ -218,11 +201,14 @@ void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC )
} }
} }
/* Reaffichage du module a l'ecran */ /* Redraw the module. */
if( module && s_ModuleInitialCopy ) if( module && s_ModuleInitialCopy )
{ {
if( s_ModuleInitialCopy->m_Orient != module->m_Orient ) if( s_ModuleInitialCopy->m_Orient != module->m_Orient )
pcbframe->Rotate_Module( NULL, module, s_ModuleInitialCopy->m_Orient, FALSE ); pcbframe->Rotate_Module( NULL,
module,
s_ModuleInitialCopy->m_Orient,
FALSE );
if( s_ModuleInitialCopy->GetLayer() != module->GetLayer() ) if( s_ModuleInitialCopy->GetLayer() != module->GetLayer() )
pcbframe->Change_Side_Module( module, NULL ); pcbframe->Change_Side_Module( module, NULL );
module->Draw( Panel, DC, GR_OR ); module->Draw( Panel, DC, GR_OR );
@ -236,22 +222,20 @@ void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC )
s_ModuleInitialCopy = NULL; s_ModuleInitialCopy = NULL;
s_PickedList.ClearListAndDeleteItems(); s_PickedList.ClearListAndDeleteItems();
pcbframe->GetBoard()->m_Status_Pcb &= ~DO_NOT_SHOW_GENERAL_RASTNEST; // Display ratsnest is allowed // Display ratsnest is allowed
pcbframe->GetBoard()->m_Status_Pcb &= ~DO_NOT_SHOW_GENERAL_RASTNEST;
if( g_Show_Ratsnest ) if( g_Show_Ratsnest )
pcbframe->DrawGeneralRatsnest( DC ); pcbframe->DrawGeneralRatsnest( DC );
} }
/**********************************************************/
MODULE* WinEDA_BasePcbFrame::Copie_Module( MODULE* module )
/**********************************************************/
/** /**
* Function Copie_Module * Function Copie_Module
* Copy an existing footprint. The ne footprint is added in module list * Copy an existing footprint. The new footprint is added in module list
* @param module = footprint to copy * @param module = footprint to copy
* @return a pointer on the new footprint (the copy of the existing footprint) * @return a pointer on the new footprint (the copy of the existing footprint)
*/ */
MODULE* WinEDA_BasePcbFrame::Copie_Module( MODULE* module )
{ {
MODULE* newmodule; MODULE* newmodule;
@ -260,7 +244,7 @@ MODULE* WinEDA_BasePcbFrame::Copie_Module( MODULE* module )
GetScreen()->SetModify(); GetScreen()->SetModify();
/* Duplication du module */ /* Duplicate module */
GetBoard()->m_Status_Pcb = 0; GetBoard()->m_Status_Pcb = 0;
newmodule = new MODULE( GetBoard() ); newmodule = new MODULE( GetBoard() );
newmodule->Copy( module ); newmodule->Copy( module );
@ -277,25 +261,22 @@ MODULE* WinEDA_BasePcbFrame::Copie_Module( MODULE* module )
} }
/**********************************************************************************/ /* Redraw the footprint when moving the mouse.
void Montre_Position_Empreinte( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/**********************************************************************************/
/* redessin du contour de l'empreinte lors des deplacements de la souris
*/ */
void Montre_Position_Empreinte( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{ {
MODULE* module = (MODULE*) panel->GetScreen()->GetCurItem(); MODULE* module = (MODULE*) panel->GetScreen()->GetCurItem();
if( module == NULL ) if( module == NULL )
return; return;
/* efface ancienne position */ /* Erase current footprint. */
if( erase ) if( erase )
{ {
DrawModuleOutlines( panel, DC, module ); DrawModuleOutlines( panel, DC, module );
} }
/* Redessine le module a la nouvelle place */ /* Redraw the module at the new position. */
g_Offset_Module = module->m_Pos - panel->GetScreen()->m_Curseur; g_Offset_Module = module->m_Pos - panel->GetScreen()->m_Curseur;
DrawModuleOutlines( panel, DC, module ); DrawModuleOutlines( panel, DC, module );
@ -303,28 +284,27 @@ void Montre_Position_Empreinte( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
} }
/*****************************************************************************************/
bool WinEDA_PcbFrame::Delete_Module( MODULE* module, wxDC* DC, bool aAskBeforeDeleting )
/******************************************************************************************/
/** /**
* Function Delete Module * Function Delete Module
* Remove a footprint from m_Modules linked list and put it in undelete buffer * Remove a footprint from m_Modules linked list and put it in undelete buffer
* The rastnest and pad list are recalcualed * The ratsnest and pad list are recalculated
* @param module = footprint to delete * @param module = footprint to delete
* @param DC = currentDevice Context. if NULL: do not redraw new ratsnets and dirty rectange * @param DC = currentDevice Context. if NULL: do not redraw new ratsnest and
* dirty rectangle
* @param aPromptBeforeDeleting : if true: ask for confirmation before deleting * @param aPromptBeforeDeleting : if true: ask for confirmation before deleting
*/ */
bool WinEDA_PcbFrame::Delete_Module( MODULE* module,
wxDC* DC,
bool aAskBeforeDeleting )
{ {
wxString msg; wxString msg;
/* Si l'empreinte est selectee , on ne peut pas l'effacer ! */
if( module == NULL ) if( module == NULL )
return FALSE; return FALSE;
/* Confirmation de l'effacement */
module->DisplayInfo( this ); module->DisplayInfo( this );
/* Confirm module delete. */
if( aAskBeforeDeleting ) if( aAskBeforeDeleting )
{ {
msg << _( "Delete Module" ) << wxT( " " ) << module->m_Reference->m_Text msg << _( "Delete Module" ) << wxT( " " ) << module->m_Reference->m_Text
@ -338,8 +318,9 @@ bool WinEDA_PcbFrame::Delete_Module( MODULE* module, wxDC* DC, bool aAskBeforeDe
GetScreen()->SetModify(); GetScreen()->SetModify();
/* Erase rastnest if needed /* Erase ratsnest if needed
* Dirty rectangle is not used here because usually using a XOR draw mode gives good results (very few artefacts) for ratsnest * Dirty rectangle is not used here because usually using a XOR draw mode
* gives good results (very few artifacts) for ratsnest
*/ */
if( g_Show_Ratsnest ) if( g_Show_Ratsnest )
DrawGeneralRatsnest( DC ); DrawGeneralRatsnest( DC );
@ -354,36 +335,34 @@ bool WinEDA_PcbFrame::Delete_Module( MODULE* module, wxDC* DC, bool aAskBeforeDe
// redraw the area where the module was // redraw the area where the module was
if( DC ) if( DC )
DrawPanel->PostDirtyRect( module->GetBoundingBox() ); DrawPanel->PostDirtyRect( module->GetBoundingBox() );
RedrawActiveWindow( DC, TRUE); RedrawActiveWindow( DC, TRUE );
return TRUE; return TRUE;
} }
/****************************************************************************/
void WinEDA_PcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
/****************************************************************************/
/** /**
* Function Change_Side_Module * Function Change_Side_Module
* Filp a footprint (switch layer from component or component to copper) * Flip a footprint (switch layer from component or component to copper)
* The mirroring is made from X axis * The mirroring is made from X axis
* if a footprint is not on copper or component layer it is not flipped * if a footprint is not on copper or component layer it is not flipped
* (it could be on an adhesive layer, not supported at this time) * (it could be on an adhesive layer, not supported at this time)
* @param Module the footprint to flip * @param Module the footprint to flip
* @param DC Current Device Context. if NULL, no redraw * @param DC Current Device Context. if NULL, no redraw
*/ */
void WinEDA_PcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
{ {
if( Module == NULL ) if( Module == NULL )
return; return;
if( (Module->GetLayer() != CMP_N) && (Module->GetLayer() != COPPER_LAYER_N) ) if( ( Module->GetLayer() != CMP_N )
&& ( Module->GetLayer() != COPPER_LAYER_N ) )
return; return;
GetScreen()->SetModify(); GetScreen()->SetModify();
if( !(Module->m_Flags & IS_MOVED) ) /* This is a simple flip, no other edition in progress */ if( !( Module->m_Flags & IS_MOVED ) ) /* This is a simple flip, no other
*edition in progress */
{ {
GetBoard()->m_Status_Pcb &= ~( LISTE_RATSNEST_ITEM_OK | CONNEXION_OK); GetBoard()->m_Status_Pcb &= ~( LISTE_RATSNEST_ITEM_OK | CONNEXION_OK );
if( DC ) if( DC )
{ {
int tmp = Module->m_Flags; int tmp = Module->m_Flags;
@ -392,17 +371,16 @@ void WinEDA_PcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
Module->m_Flags = tmp; Module->m_Flags = tmp;
} }
/* Effacement chevelu general si necessaire */ /* Show ratsnest if necessary. */
if( DC && g_Show_Ratsnest ) if( DC && g_Show_Ratsnest )
DrawGeneralRatsnest( DC ); DrawGeneralRatsnest( DC );
/* Init des variables utilisees dans la routine Dessine_Drag_segment() */
g_Offset_Module.x = 0; g_Offset_Module.x = 0;
g_Offset_Module.y = 0; g_Offset_Module.y = 0;
} }
else // Module en deplacement else // Module is being moved.
{ {
/* efface empreinte ( vue en contours) si elle a ete deja dessinee */ /* Erase footprint and draw outline if it has been already drawn. */
if( DC ) if( DC )
{ {
DrawModuleOutlines( DrawPanel, DC, Module ); DrawModuleOutlines( DrawPanel, DC, Module );
@ -415,13 +393,11 @@ void WinEDA_PcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
Module->DisplayInfo( this ); Module->DisplayInfo( this );
if( !(Module->m_Flags & IS_MOVED) ) /* Inversion simple */ if( !( Module->m_Flags & IS_MOVED ) ) /* Inversion simple */
{ {
if( DC ) if( DC )
{ {
Module->Draw( DrawPanel, DC, GR_OR ); Module->Draw( DrawPanel, DC, GR_OR );
/* affichage chevelu general si necessaire */
Compile_Ratsnest( DC, true ); Compile_Ratsnest( DC, true );
} }
} }
@ -437,18 +413,14 @@ void WinEDA_PcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
} }
/*****************************************************************/ /* Place module at cursor position.
void WinEDA_BasePcbFrame::Place_Module( MODULE* module, wxDC* DC, bool aDoNotRecreateRatsnest ) *
/*****************************************************************/ * DC (if NULL: no display screen has the output.
* Update module coordinates with the new position.
/* Place a l'endroit pointe par la souris le module deja existant selectionne
* auparavant.
* Entree: module = num du module a replacer
* DC ( si NULL: pas d'affichage a l'ecran
* Sortie :
* mise a jour des nouvelles coord des differents elements du module
* affichage a l'ecran du module
*/ */
void WinEDA_BasePcbFrame::Place_Module( MODULE* module,
wxDC* DC,
bool aDoNotRecreateRatsnest )
{ {
TRACK* pt_segm; TRACK* pt_segm;
wxPoint newpos; wxPoint newpos;
@ -459,41 +431,45 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module, wxDC* DC, bool aDoNotRec
GetScreen()->SetModify(); GetScreen()->SetModify();
GetBoard()->m_Status_Pcb &= ~( LISTE_RATSNEST_ITEM_OK | CONNEXION_OK); GetBoard()->m_Status_Pcb &= ~( LISTE_RATSNEST_ITEM_OK | CONNEXION_OK);
if( (module->m_Flags & IS_NEW ) ) if( module->m_Flags & IS_NEW )
{ {
SaveCopyInUndoList(module, UR_NEW); SaveCopyInUndoList( module, UR_NEW );
} }
else if( (module->m_Flags & IS_MOVED ) ) else if( (module->m_Flags & IS_MOVED ) )
{ {
ITEM_PICKER picker(module, UR_CHANGED); ITEM_PICKER picker( module, UR_CHANGED );
picker.m_Link = s_ModuleInitialCopy; picker.m_Link = s_ModuleInitialCopy;
s_PickedList.PushItem(picker); s_PickedList.PushItem( picker );
s_ModuleInitialCopy = NULL; // the picker is now owner of s_ModuleInitialCopy. s_ModuleInitialCopy = NULL; // the picker is now owner of
// s_ModuleInitialCopy.
} }
if ( s_PickedList.GetCount() ) if( s_PickedList.GetCount() )
{ {
SaveCopyInUndoList(s_PickedList, UR_UNSPECIFIED); SaveCopyInUndoList( s_PickedList, UR_UNSPECIFIED );
// Clear list, but DO NOT delete items, // Clear list, but DO NOT delete items,
// because they are owned by the saved undo list and they therefore in use // because they are owned by the saved undo list and they therefore in
// use
s_PickedList.ClearItemsList(); s_PickedList.ClearItemsList();
} }
if( g_Show_Module_Ratsnest && (GetBoard()->m_Status_Pcb & LISTE_PAD_OK) && DC ) if( g_Show_Module_Ratsnest && ( GetBoard()->m_Status_Pcb & LISTE_PAD_OK )
&& DC )
trace_ratsnest_module( DC ); trace_ratsnest_module( DC );
newpos = GetScreen()->m_Curseur; newpos = GetScreen()->m_Curseur;
module->SetPosition( newpos ); module->SetPosition( newpos );
if( DC ) if( DC )
module->Draw( DrawPanel, DC, GR_OR ); module->Draw( DrawPanel, DC, GR_OR );
if( g_DragSegmentList ) if( g_DragSegmentList )
{ {
/* Redraw dragged track segments */ /* Redraw dragged track segments */
for( DRAG_SEGM* pt_drag = g_DragSegmentList; pt_drag != NULL; pt_drag = pt_drag->Pnext ) for( DRAG_SEGM* pt_drag = g_DragSegmentList;
pt_drag != NULL;
pt_drag = pt_drag->Pnext )
{ {
pt_segm = pt_drag->m_Segm; pt_segm = pt_drag->m_Segm;
pt_segm->SetState( EDIT, OFF ); pt_segm->SetState( EDIT, OFF );
@ -508,7 +484,7 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module, wxDC* DC, bool aDoNotRec
Compile_Ratsnest( DC, true ); Compile_Ratsnest( DC, true );
if( DC ) if( DC )
RedrawActiveWindow( DC, TRUE); RedrawActiveWindow( DC, TRUE );
module->DisplayInfo( this ); module->DisplayInfo( this );
@ -522,25 +498,23 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module, wxDC* DC, bool aDoNotRec
} }
/***********************************************************************/ /*
* Rotate the footprint angle degrees in the direction < 0.
* If incremental == TRUE, the rotation is made from the last orientation,
* If the module is placed in the absolute orientation angle.
* If DC == NULL, the component does not redraw.
* Otherwise, it erases and redraws turns
*/
void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module, void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module,
int angle, bool incremental ) int angle, bool incremental )
/***********************************************************************/
/*
* Fait tourner l'empreinte de angle degres, dans le sens < 0.
* Si incremental == TRUE, la rotation est faite a partir de la derniere orientation,
* sinon le module est mis dans l'orientation absolue angle.
* Si DC == NULL, le composant n'est pas redessine.
* Sinon, il est efface, tourne et redessine
*/
{ {
if( module == NULL ) if( module == NULL )
return; return;
GetScreen()->SetModify(); GetScreen()->SetModify();
if( !(module->m_Flags & IS_MOVED) ) /* This is a simple rotation, no other edition in progress */ if( !( module->m_Flags & IS_MOVED ) ) /* This is a simple rotation, no other
* edition in progress */
{ {
if( DC ) // Erase footprint to screen if( DC ) // Erase footprint to screen
{ {
@ -549,14 +523,12 @@ void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module,
DrawPanel->PostDirtyRect( module->GetBoundingBox() ); DrawPanel->PostDirtyRect( module->GetBoundingBox() );
module->m_Flags = tmp; module->m_Flags = tmp;
/* Reaffichage chevelu general si necessaire */
if( g_Show_Ratsnest ) if( g_Show_Ratsnest )
DrawGeneralRatsnest( DC ); DrawGeneralRatsnest( DC );
} }
} }
else else
{ {
/* reaffiche module en mouvement */
if( DC ) if( DC )
{ {
DrawModuleOutlines( DrawPanel, DC, module ); DrawModuleOutlines( DrawPanel, DC, module );
@ -564,7 +536,7 @@ void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module,
} }
} }
GetBoard()->m_Status_Pcb &= ~(LISTE_RATSNEST_ITEM_OK | CONNEXION_OK); GetBoard()->m_Status_Pcb &= ~( LISTE_RATSNEST_ITEM_OK | CONNEXION_OK );
if( incremental ) if( incremental )
module->SetOrientation( module->m_Orient + angle ); module->SetOrientation( module->m_Orient + angle );
@ -575,28 +547,25 @@ void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module,
if( DC ) if( DC )
{ {
if( !(module->m_Flags & IS_MOVED) ) /* Rotation simple */ if( !( module->m_Flags & IS_MOVED ) ) /* Rotation simple */
{ {
module->Draw( DrawPanel, DC, GR_OR ); module->Draw( DrawPanel, DC, GR_OR );
/* Reaffichage chevelu general si necessaire */
Compile_Ratsnest( DC, true ); Compile_Ratsnest( DC, true );
} }
else else
{ {
/* reaffiche module en mouvement */
DrawModuleOutlines( DrawPanel, DC, module ); DrawModuleOutlines( DrawPanel, DC, module );
Dessine_Segments_Dragges( DrawPanel, DC ); Dessine_Segments_Dragges( DrawPanel, DC );
} }
RedrawActiveWindow( DC, TRUE); RedrawActiveWindow( DC, TRUE );
} }
} }
/*************************************************/ /*************************************************/
/* Redessine en mode XOR la silouhette du module */ /* Redraw mode XOR the silhouette of the module. */
/*************************************************/ /*************************************************/
void DrawModuleOutlines( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module ) void DrawModuleOutlines( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module )
{ {
int pad_fill_tmp; int pad_fill_tmp;
@ -610,7 +579,7 @@ void DrawModuleOutlines( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module )
{ {
pad_fill_tmp = DisplayOpt.DisplayPadFill; pad_fill_tmp = DisplayOpt.DisplayPadFill;
#ifndef __WXMAC__ #ifndef __WXMAC__
DisplayOpt.DisplayPadFill = true; /* Trace en SKETCH en deplacement */ DisplayOpt.DisplayPadFill = true;
#else #else
DisplayOpt.DisplayPadFill = false; DisplayOpt.DisplayPadFill = false;
#endif #endif

View File

@ -1,6 +1,6 @@
/*************************/ /************************/
/* Edition des Pastilles */ /* Edit footprint pads. */
/*************************/ /************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
@ -15,21 +15,14 @@
#include "protos.h" #include "protos.h"
/* Routines Locales */
/* Variables locales */ static D_PAD* s_CurrentSelectedPad;
static D_PAD* s_CurrentSelectedPad; /* pointeur sur le pad selecte pour edition */
static wxPoint Pad_OldPos; static wxPoint Pad_OldPos;
/************************************************************/ /* Cancel move pad command.
static void Exit_Move_Pad( WinEDA_DrawPanel* Panel, wxDC* DC )
/************************************************************/
/* Routine de sortie du menu EDIT PADS.
* Sortie simple si pad de pad en mouvement
* Remise en etat des conditions initiales avant move si move en cours
*/ */
static void Exit_Move_Pad( WinEDA_DrawPanel* Panel, wxDC* DC )
{ {
D_PAD* pad = s_CurrentSelectedPad; D_PAD* pad = s_CurrentSelectedPad;
@ -42,10 +35,10 @@ static void Exit_Move_Pad( WinEDA_DrawPanel* Panel, wxDC* DC )
pad->m_Flags = 0; pad->m_Flags = 0;
pad->m_Pos = Pad_OldPos; pad->m_Pos = Pad_OldPos;
pad->Draw( Panel, DC, GR_XOR ); pad->Draw( Panel, DC, GR_XOR );
/* Pad Move en cours : remise a l'etat d'origine */
/* Pad move in progress: the restore origin. */
if( g_Drag_Pistes_On ) if( g_Drag_Pistes_On )
{ {
/* Effacement des segments dragges */
DRAG_SEGM* pt_drag = g_DragSegmentList; DRAG_SEGM* pt_drag = g_DragSegmentList;
for( ; pt_drag != NULL; pt_drag = pt_drag->Pnext ) for( ; pt_drag != NULL; pt_drag = pt_drag->Pnext )
{ {
@ -63,10 +56,9 @@ static void Exit_Move_Pad( WinEDA_DrawPanel* Panel, wxDC* DC )
} }
/*************************************************************************/ /* Draw in drag mode when moving a pad.
*/
static void Show_Pad_Move( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) static void Show_Pad_Move( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/*************************************************************************/
/* Affiche le pad et les pistes en mode drag lors des deplacements du pad */
{ {
TRACK* Track; TRACK* Track;
DRAG_SEGM* pt_drag; DRAG_SEGM* pt_drag;
@ -82,7 +74,6 @@ static void Show_Pad_Move( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
if( !g_Drag_Pistes_On ) if( !g_Drag_Pistes_On )
return; return;
/* Tracage des segments dragges */
pt_drag = g_DragSegmentList; pt_drag = g_DragSegmentList;
for( ; pt_drag != NULL; pt_drag = pt_drag->Pnext ) for( ; pt_drag != NULL; pt_drag = pt_drag->Pnext )
{ {
@ -102,12 +93,9 @@ static void Show_Pad_Move( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
} }
/*************************************************************/ /* Load list of features for default pad selection.
void WinEDA_BasePcbFrame::Export_Pad_Settings( D_PAD* pt_pad )
/*************************************************************/
/* Charge en liste des caracteristiques par defaut celles du pad selecte
*/ */
void WinEDA_BasePcbFrame::Export_Pad_Settings( D_PAD* pt_pad )
{ {
MODULE* Module; MODULE* Module;
@ -133,15 +121,12 @@ void WinEDA_BasePcbFrame::Export_Pad_Settings( D_PAD* pt_pad )
} }
/***********************************************************************/ /* Imports the new values of dimensions of the pad edge by pt_pad
void WinEDA_BasePcbFrame::Import_Pad_Settings( D_PAD* aPad, bool aDraw ) * - Source: selected values of general characteristics
/***********************************************************************/ * - Measurements are modified
* - The position, names, and keys are not.
/* Met a jour les nouvelles valeurs de dimensions du pad pointe par pt_pad
* - Source : valeurs choisies des caracteristiques generales
* - les dimensions sont modifiees
* - la position et les noms ne sont pas touches
*/ */
void WinEDA_BasePcbFrame::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
{ {
if( aDraw ) if( aDraw )
{ {
@ -161,7 +146,6 @@ void WinEDA_BasePcbFrame::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
aPad->m_Drill = g_Pad_Master.m_Drill; aPad->m_Drill = g_Pad_Master.m_Drill;
aPad->m_DrillShape = g_Pad_Master.m_DrillShape; aPad->m_DrillShape = g_Pad_Master.m_DrillShape;
/* Traitement des cas particuliers : */
switch( g_Pad_Master.m_PadShape ) switch( g_Pad_Master.m_PadShape )
{ {
case PAD_TRAPEZOID: case PAD_TRAPEZOID:
@ -186,14 +170,14 @@ void WinEDA_BasePcbFrame::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
if( aDraw ) if( aDraw )
DrawPanel->PostDirtyRect( aPad->GetBoundingBox() ); DrawPanel->PostDirtyRect( aPad->GetBoundingBox() );
( (MODULE*) aPad->GetParent() )->m_LastEdit_Time = time( NULL ); ( (MODULE*) aPad->GetParent() )->m_LastEdit_Time = time( NULL );
} }
/***********************************************************/ /* Add a pad on the selected module.
*/
void WinEDA_BasePcbFrame::AddPad( MODULE* Module, bool draw ) void WinEDA_BasePcbFrame::AddPad( MODULE* Module, bool draw )
/***********************************************************/
/* Routine d'ajout d'un pad sur l'module selectionnee */
{ {
D_PAD* Pad; D_PAD* Pad;
int rX, rY; int rX, rY;
@ -203,10 +187,10 @@ void WinEDA_BasePcbFrame::AddPad( MODULE* Module, bool draw )
Pad = new D_PAD( Module ); Pad = new D_PAD( Module );
/* Chainage de la structure en fin de liste des pads : */ /* Add the new pad to end of the module pad list. */
Module->m_Pads.PushBack( Pad ); Module->m_Pads.PushBack( Pad );
/* Mise a jour des caract de la pastille : */ /* Update the pad properties. */
Import_Pad_Settings( Pad, false ); Import_Pad_Settings( Pad, false );
Pad->SetNetname( wxEmptyString ); Pad->SetNetname( wxEmptyString );
@ -220,12 +204,14 @@ void WinEDA_BasePcbFrame::AddPad( MODULE* Module, bool draw )
Pad->m_Pos0.x = rX; Pad->m_Pos0.x = rX;
Pad->m_Pos0.y = rY; Pad->m_Pos0.y = rY;
/* Increment automatique de la reference courante Current_PadName */ /* Automatically increment the current pad number and name. */
long num = 0; int ponder = 1; long num = 0;
int ponder = 1;
while( g_Current_PadName.Len() && g_Current_PadName.Last() >= '0' while( g_Current_PadName.Len() && g_Current_PadName.Last() >= '0'
&& g_Current_PadName.Last() <= '9' ) && g_Current_PadName.Last() <= '9' )
{ {
num += (g_Current_PadName.Last() - '0') * ponder; num += ( g_Current_PadName.Last() - '0' ) * ponder;
g_Current_PadName.RemoveLast(); g_Current_PadName.RemoveLast();
ponder *= 10; ponder *= 10;
} }
@ -234,7 +220,6 @@ void WinEDA_BasePcbFrame::AddPad( MODULE* Module, bool draw )
g_Current_PadName << num; g_Current_PadName << num;
Pad->SetPadName( g_Current_PadName ); Pad->SetPadName( g_Current_PadName );
/* Redessin du module */
Module->Set_Rectangle_Encadrement(); Module->Set_Rectangle_Encadrement();
Pad->DisplayInfo( this ); Pad->DisplayInfo( this );
if( draw ) if( draw )
@ -242,10 +227,8 @@ void WinEDA_BasePcbFrame::AddPad( MODULE* Module, bool draw )
} }
/*********************************************************/ /* Function to delete the pad. */
void WinEDA_BasePcbFrame::DeletePad( D_PAD* Pad ) void WinEDA_BasePcbFrame::DeletePad( D_PAD* Pad )
/*********************************************************/
/* Function to delete the pad "pad" */
{ {
MODULE* Module; MODULE* Module;
wxString line; wxString line;
@ -274,10 +257,8 @@ void WinEDA_BasePcbFrame::DeletePad( D_PAD* Pad )
} }
/*************************************************************/ /* Function to initialize the "move pad" command */
void WinEDA_BasePcbFrame::StartMovePad( D_PAD* Pad, wxDC* DC ) void WinEDA_BasePcbFrame::StartMovePad( D_PAD* Pad, wxDC* DC )
/*************************************************************/
/* Function to initialise the "move pad" command */
{ {
MODULE* Module; MODULE* Module;
@ -305,10 +286,8 @@ void WinEDA_BasePcbFrame::StartMovePad( D_PAD* Pad, wxDC* DC )
} }
/*********************************************************/ /* Routine to place a moved pad. */
void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC ) void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
/*********************************************************/
/* Routine to Place a moved pad */
{ {
int dX, dY; int dX, dY;
TRACK* Track; TRACK* Track;
@ -323,7 +302,9 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
PICKED_ITEMS_LIST pickList; PICKED_ITEMS_LIST pickList;
/* Save dragged track segments in undo list */ /* Save dragged track segments in undo list */
for( DRAG_SEGM* pt_drag = g_DragSegmentList; pt_drag; pt_drag = pt_drag->Pnext ) for( DRAG_SEGM* pt_drag = g_DragSegmentList;
pt_drag;
pt_drag = pt_drag->Pnext )
{ {
Track = pt_drag->m_Segm; Track = pt_drag->m_Segm;
@ -355,13 +336,13 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
if( g_DragSegmentList ) if( g_DragSegmentList )
SaveCopyInUndoList( pickList, UR_CHANGED ); SaveCopyInUndoList( pickList, UR_CHANGED );
/* Placement du pad */
Pad->m_Pos = pad_curr_position; Pad->m_Pos = pad_curr_position;
Pad->Draw( DrawPanel, DC, GR_XOR ); Pad->Draw( DrawPanel, DC, GR_XOR );
/* Redraw dragged track segments */ /* Redraw dragged track segments */
for( DRAG_SEGM* pt_drag = g_DragSegmentList; pt_drag; pt_drag = pt_drag->Pnext ) for( DRAG_SEGM* pt_drag = g_DragSegmentList;
pt_drag;
pt_drag = pt_drag->Pnext )
{ {
Track = pt_drag->m_Segm; Track = pt_drag->m_Segm;
@ -376,7 +357,8 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
Track->Draw( DrawPanel, DC, GR_OR ); Track->Draw( DrawPanel, DC, GR_OR );
} }
/* Compute local coordinates (i.e refer to Module position and for Module orient = 0)*/ /* Compute local coordinates (i.e refer to Module position and for Module
* orient = 0) */
dX = Pad->m_Pos.x - Pad_OldPos.x; dX = Pad->m_Pos.x - Pad_OldPos.x;
dY = Pad->m_Pos.y - Pad_OldPos.y; dY = Pad->m_Pos.y - Pad_OldPos.y;
RotatePoint( &dX, &dY, -Module->m_Orient ); RotatePoint( &dX, &dY, -Module->m_Orient );
@ -392,23 +374,18 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
Module->Set_Rectangle_Encadrement(); Module->Set_Rectangle_Encadrement();
Module->m_LastEdit_Time = time( NULL ); Module->m_LastEdit_Time = time( NULL );
EraseDragListe(); EraseDragListe();
GetScreen()->SetModify(); GetScreen()->SetModify();
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
m_Pcb->m_Status_Pcb &= ~( LISTE_RATSNEST_ITEM_OK | CONNEXION_OK); m_Pcb->m_Status_Pcb &= ~( LISTE_RATSNEST_ITEM_OK | CONNEXION_OK );
} }
/**********************************************************/ /* Rotate selected pad 90 degrees.
void WinEDA_BasePcbFrame::RotatePad( D_PAD* Pad, wxDC* DC )
/**********************************************************/
/* Tourne de 90 degres le pad selectionne :
* c.a.d intervertit dim X et Y et offsets
*/ */
void WinEDA_BasePcbFrame::RotatePad( D_PAD* Pad, wxDC* DC )
{ {
MODULE* Module; MODULE* Module;
@ -429,12 +406,10 @@ void WinEDA_BasePcbFrame::RotatePad( D_PAD* Pad, wxDC* DC )
Pad->m_Offset.y = -Pad->m_Offset.y; Pad->m_Offset.y = -Pad->m_Offset.y;
EXCHG( Pad->m_DeltaSize.x, Pad->m_DeltaSize.y ); EXCHG( Pad->m_DeltaSize.x, Pad->m_DeltaSize.y );
Pad->m_DeltaSize.x = -Pad->m_DeltaSize.x; /* ceci est la variation Pad->m_DeltaSize.x = -Pad->m_DeltaSize.x;
* de la dim Y sur l'axe X */
Module->Set_Rectangle_Encadrement(); Module->Set_Rectangle_Encadrement();
Pad->DisplayInfo( this ); Pad->DisplayInfo( this );
if( DC ) if( DC )
Module->Draw( DrawPanel, DC, GR_OR ); Module->Draw( DrawPanel, DC, GR_OR );
} }

View File

@ -18,34 +18,36 @@
#include "protos.h" #include "protos.h"
/* local functions */
static void Show_MoveNode( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void Show_MoveNode( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
wxDC* DC,
bool erase );
static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC ); static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC );
static bool InitialiseDragParameters(); static bool InitialiseDragParameters();
/* variables locales */
static wxPoint PosInit, s_LastPos; static wxPoint PosInit, s_LastPos;
static TRACK* NewTrack; /* Nouvelle piste creee ou piste deplacee */ static TRACK* NewTrack; /* New track or track being moved. */
static int NbPtNewTrack; static int NbPtNewTrack;
static int Old_HightLigth_NetCode; static int Old_HightLigth_NetCode;
static bool Old_HightLigt_Status; static bool Old_HightLigt_Status;
static double s_StartSegmentSlope, s_EndSegmentSlope, s_MovingSegmentSlope, static double s_StartSegmentSlope, s_EndSegmentSlope,
s_MovingSegmentSlope,
s_StartSegment_Yorg, s_EndSegment_Yorg, s_StartSegment_Yorg, s_EndSegment_Yorg,
s_MovingSegment_Yorg; //slope and intercept parameters of lines s_MovingSegment_Yorg; //slope and intercept parameters of lines
bool s_StartPointVertical, s_EndPointVertical, bool s_StartPointVertical, s_EndPointVertical,
s_MovingSegmentVertical, s_MovingSegmentHorizontal, s_MovingSegmentVertical, s_MovingSegmentHorizontal,
s_StartPointHorizontal, s_EndPointHorizontal; // vertical or horizontal line indicators s_StartPointHorizontal, s_EndPointHorizontal; // vertical or
// horizontal line
// indicators
bool s_StartSegmentPresent, s_EndSegmentPresent; bool s_StartSegmentPresent, s_EndSegmentPresent;
static PICKED_ITEMS_LIST s_ItemsListPicker; static PICKED_ITEMS_LIST s_ItemsListPicker;
/**************************************************************/
static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
/***************************************************************/
/** Abort function for commandes drag, copy ou move track /** Abort function for commands drag, copy or move track
*/ */
static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
{ {
TRACK* NextS; TRACK* NextS;
int ii; int ii;
@ -60,7 +62,8 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
Panel->GetScreen()->m_Curseur = oldpos; Panel->GetScreen()->m_Curseur = oldpos;
g_HightLigt_Status = FALSE; g_HightLigt_Status = FALSE;
( (WinEDA_PcbFrame*) Panel->m_Parent )->GetBoard()->DrawHighLight( Panel, ( (WinEDA_PcbFrame*) Panel->m_Parent )->GetBoard()->DrawHighLight(
Panel,
DC, DC,
g_HightLigth_NetCode ); g_HightLigth_NetCode );
@ -77,7 +80,7 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
delete NewTrack; delete NewTrack;
} }
} }
else /* Move : remise en ancienne position */ else /* Move existing trace. */
{ {
TRACK* Track = NewTrack; TRACK* Track = NewTrack;
int dx = s_LastPos.x - PosInit.x; int dx = s_LastPos.x - PosInit.x;
@ -106,7 +109,7 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
Panel->ForceCloseManageCurseur = NULL; Panel->ForceCloseManageCurseur = NULL;
( (WinEDA_PcbFrame*) Panel->m_Parent )->SetCurItem( NULL ); ( (WinEDA_PcbFrame*) Panel->m_Parent )->SetCurItem( NULL );
/* Annulation deplacement et Redessin des segments dragges */ /* Undo move and redraw trace segments. */
DRAG_SEGM* pt_drag = g_DragSegmentList; DRAG_SEGM* pt_drag = g_DragSegmentList;
for( ; pt_drag != NULL; pt_drag = pt_drag->Pnext ) for( ; pt_drag != NULL; pt_drag = pt_drag->Pnext )
{ {
@ -123,7 +126,8 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
g_HightLigth_NetCode = Old_HightLigth_NetCode; g_HightLigth_NetCode = Old_HightLigth_NetCode;
g_HightLigt_Status = Old_HightLigt_Status; g_HightLigt_Status = Old_HightLigt_Status;
if( g_HightLigt_Status ) if( g_HightLigt_Status )
( (WinEDA_PcbFrame*) Panel->m_Parent )->GetBoard()->DrawHighLight( Panel, ( (WinEDA_PcbFrame*) Panel->m_Parent )->GetBoard()->DrawHighLight(
Panel,
DC, DC,
g_HightLigth_NetCode ); g_HightLigth_NetCode );
@ -131,10 +135,8 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
} }
/*************************************************************************/
static void Show_MoveNode( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/*************************************************************************/
/* Redraw the moved node according to the mouse cursor position */ /* Redraw the moved node according to the mouse cursor position */
static void Show_MoveNode( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{ {
int ii; int ii;
wxPoint moveVector; wxPoint moveVector;
@ -190,21 +192,19 @@ static void Show_MoveNode( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
} }
DisplayOpt.DisplayPcbTrackFill = track_fill_copy; DisplayOpt.DisplayPcbTrackFill = track_fill_copy;
// Display track length // Display track length
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->m_Parent; WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->m_Parent;
Track->DisplayInfo( frame ); Track->DisplayInfo( frame );
} }
/*************************************************************************/
static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
wxDC* DC, bool erase )
/*************************************************************************/
/* drawing the track segment movement /* drawing the track segment movement
* > s_MovingSegmentSlope slope = moving track segment slope * > s_MovingSegmentSlope slope = moving track segment slope
* > s_StartSegmentSlope slope = slope of the segment connected to the start point of the moving segment * > s_StartSegmentSlope slope = slope of the segment connected to the start
* > s_EndSegmentSlope slope = slope of the segment connected to the end point of the moving segment * point of the moving segment
* > s_EndSegmentSlope slope = slope of the segment connected to the end point
* of the moving segment
* *
* moved segment function : * moved segment function :
* yt=s_MovingSegmentSlope * x + s_MovingSegment_Yorg * yt=s_MovingSegmentSlope * x + s_MovingSegment_Yorg
@ -217,12 +217,14 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
* *
* first intersection point will be located at * first intersection point will be located at
* y1=yt -> * y1=yt ->
*
* xi1=(s_MovingSegment_Yorg-s_StartSegment_Yorg)/(s_StartSegmentSlope-s_MovingSegmentSlope) * xi1=(s_MovingSegment_Yorg-s_StartSegment_Yorg)/(s_StartSegmentSlope-s_MovingSegmentSlope)
* yi1=s_MovingSegmentSlope*xi1+s_MovingSegment_Yorg * yi1=s_MovingSegmentSlope*xi1+s_MovingSegment_Yorg
* or yi1=s_StartSegmentSlope*xi1+s_MovingSegment_Yorg * or yi1=s_StartSegmentSlope*xi1+s_MovingSegment_Yorg
* *
* second intersection point * second intersection point
* y2=yt -> * y2=yt ->
*
* xi2=(s_MovingSegment_Yorg-s_StartSegment_Yorg)/(s_MovingSegmentSlope-s_MovingSegmentSlope) * xi2=(s_MovingSegment_Yorg-s_StartSegment_Yorg)/(s_MovingSegmentSlope-s_MovingSegmentSlope)
* yi2=s_MovingSegmentSlope*xi2+s_MovingSegment_Yorg * yi2=s_MovingSegmentSlope*xi2+s_MovingSegment_Yorg
* or yi1=s_EndSegmentSlope*xi2+s_MovingSegment_Yorg * or yi1=s_EndSegmentSlope*xi2+s_MovingSegment_Yorg
@ -233,13 +235,17 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
* !!!!! segment intersecting it * !!!!! segment intersecting it
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* *
* Slope parametres are computed once, because they can become undetermined when moving segments * Slope parameters are computed once, because they can become undetermined
* (i.e. when a segment lenght is 0) and we want keep them constant * when moving segments
* (i.e. when a segment length is 0) and we want keep them constant
*/ */
static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
wxDC* DC, bool erase )
{ {
double xi1 = 0, yi1 = 0, xi2 = 0, yi2 = 0; // calculated intersection points double xi1 = 0, yi1 = 0, xi2 = 0, yi2 = 0; // calculated
double tx1, tx2, ty1, ty2; // temporary storage of points // intersection points
double tx1, tx2, ty1, ty2; // temporary storage of
// points
int dx, dy; int dx, dy;
BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = panel->GetScreen();
bool update = true; bool update = true;
@ -259,13 +265,17 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
{ {
if( s_EndSegmentPresent ) if( s_EndSegmentPresent )
{ {
tSegmentToEnd = TrackSegWrapper->m_Segm; // Get the segment connected to the end point tSegmentToEnd = TrackSegWrapper->m_Segm; // Get the segment
// connected to the end
// point
TrackSegWrapper = TrackSegWrapper->Pnext; TrackSegWrapper = TrackSegWrapper->Pnext;
} }
if( s_StartSegmentPresent ) if( s_StartSegmentPresent )
{ {
if( TrackSegWrapper ) if( TrackSegWrapper )
tSegmentToStart = TrackSegWrapper->m_Segm; // Get the segment connected to the start point tSegmentToStart = TrackSegWrapper->m_Segm; // Get the segment
// connected to the
// start point
} }
} }
@ -299,13 +309,13 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
// because we are moving parallel with is initial state // because we are moving parallel with is initial state
if( !s_MovingSegmentVertical ) if( !s_MovingSegmentVertical )
{ {
s_MovingSegment_Yorg = ty1 - (s_MovingSegmentSlope * tx1); s_MovingSegment_Yorg = ty1 - ( s_MovingSegmentSlope * tx1 );
} }
if( (!s_EndPointVertical) && (!s_MovingSegmentVertical) ) if( ( !s_EndPointVertical ) && ( !s_MovingSegmentVertical ) )
{ {
xi2 = (s_MovingSegment_Yorg - xi2 = ( s_MovingSegment_Yorg - s_EndSegment_Yorg )
s_EndSegment_Yorg) / (s_EndSegmentSlope - s_MovingSegmentSlope); / ( s_EndSegmentSlope - s_MovingSegmentSlope );
} }
else else
{ {
@ -329,13 +339,13 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
if( !s_MovingSegmentVertical ) if( !s_MovingSegmentVertical )
{ {
yi2 = s_MovingSegmentSlope * (xi2) + s_MovingSegment_Yorg; yi2 = s_MovingSegmentSlope * ( xi2 ) + s_MovingSegment_Yorg;
} }
else else
{ {
if( !s_EndPointVertical ) if( !s_EndPointVertical )
{ {
yi2 = s_EndSegmentSlope * (xi2) + s_EndSegment_Yorg; yi2 = s_EndSegmentSlope * ( xi2 ) + s_EndSegment_Yorg;
} }
else else
{ {
@ -345,15 +355,15 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
} }
else else
{ {
yi2 = s_MovingSegmentSlope * (xi2) + s_MovingSegment_Yorg; yi2 = s_MovingSegmentSlope * ( xi2 ) + s_MovingSegment_Yorg;
} }
} }
} }
if( (!s_StartPointVertical) && (!s_MovingSegmentVertical) ) if( ( !s_StartPointVertical ) && ( !s_MovingSegmentVertical ) )
{ {
xi1 = (s_MovingSegment_Yorg - xi1 = ( s_MovingSegment_Yorg - s_StartSegment_Yorg )
s_StartSegment_Yorg) / (s_StartSegmentSlope - s_MovingSegmentSlope); / ( s_StartSegmentSlope - s_MovingSegmentSlope );
} }
else else
{ {
@ -380,13 +390,13 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
if( !s_MovingSegmentVertical ) if( !s_MovingSegmentVertical )
{ {
yi1 = s_MovingSegmentSlope * (xi1) + s_MovingSegment_Yorg; yi1 = s_MovingSegmentSlope * ( xi1 ) + s_MovingSegment_Yorg;
} }
else else
{ {
if( !s_StartPointVertical ) if( !s_StartPointVertical )
{ {
yi1 = s_StartSegmentSlope * (xi1) + s_StartSegment_Yorg; yi1 = s_StartSegmentSlope * ( xi1 ) + s_StartSegment_Yorg;
} }
else else
{ {
@ -396,7 +406,7 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
} }
else else
{ {
yi2 = s_MovingSegmentSlope * (xi1) + s_MovingSegment_Yorg; yi2 = s_MovingSegmentSlope * ( xi1 ) + s_MovingSegment_Yorg;
} }
} }
} }
@ -442,20 +452,19 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
tSegmentToStart->Draw( panel, DC, draw_mode ); tSegmentToStart->Draw( panel, DC, draw_mode );
if( tSegmentToEnd ) if( tSegmentToEnd )
tSegmentToEnd->Draw( panel, DC, draw_mode ); tSegmentToEnd->Draw( panel, DC, draw_mode );
// Display track length // Display track length
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->m_Parent; WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->m_Parent;
Track->DisplayInfo( frame ); Track->DisplayInfo( frame );
} }
/**********************************/ /* Init variables (slope, Y intersect point, flags) for
bool InitialiseDragParameters() * Show_Drag_Track_Segment_With_Cte_Slope()
/**********************************/
/* Init variables (slope, Y intersect point, flags) for Show_Drag_Track_Segment_With_Cte_Slope()
* return true if Ok, FALSE if dragging is not possible * return true if Ok, FALSE if dragging is not possible
* (2 colinear segments) * (2 colinear segments)
*/ */
bool InitialiseDragParameters()
{ {
double tx1, tx2, ty1, ty2; // temporary storage of points double tx1, tx2, ty1, ty2; // temporary storage of points
TRACK* Track; TRACK* Track;
@ -473,18 +482,23 @@ bool InitialiseDragParameters()
{ {
if( s_EndSegmentPresent ) if( s_EndSegmentPresent )
{ {
tSegmentToEnd = TrackSegWrapper->m_Segm; // Get the segment connected to the end point tSegmentToEnd = TrackSegWrapper->m_Segm; // Get the segment
// connected to the end
// point
TrackSegWrapper = TrackSegWrapper->Pnext; TrackSegWrapper = TrackSegWrapper->Pnext;
} }
if( s_StartSegmentPresent ) if( s_StartSegmentPresent )
{ {
if( TrackSegWrapper ) if( TrackSegWrapper )
tSegmentToStart = TrackSegWrapper->m_Segm; // Get the segment connected to the start point tSegmentToStart = TrackSegWrapper->m_Segm; // Get the segment
// connected to the
// start point
} }
} }
//would be nice to eliminate collinear segments here, so we don't //would be nice to eliminate collinear segments here, so we don't
//have to deal with that annoying "Unable to drag this segment: two collinear segments" //have to deal with that annoying "Unable to drag this segment: two
// collinear segments"
s_StartPointVertical = false; s_StartPointVertical = false;
s_EndPointVertical = false; s_EndPointVertical = false;
@ -493,7 +507,6 @@ bool InitialiseDragParameters()
s_EndPointHorizontal = false; s_EndPointHorizontal = false;
s_MovingSegmentHorizontal = false; s_MovingSegmentHorizontal = false;
// Init parameters for the starting point of the moved segment // Init parameters for the starting point of the moved segment
if( tSegmentToStart ) if( tSegmentToStart )
{ {
@ -512,7 +525,8 @@ bool InitialiseDragParameters()
ty2 = (double) tSegmentToStart->m_Start.y; ty2 = (double) tSegmentToStart->m_Start.y;
} }
} }
else // move the start point on a line starting at Track->m_Start, and perpendicular to Track else // move the start point on a line starting at Track->m_Start, and
// perpendicular to Track
{ {
tx1 = (double) Track->m_Start.x; tx1 = (double) Track->m_Start.x;
ty1 = (double) Track->m_Start.y; ty1 = (double) Track->m_Start.y;
@ -520,16 +534,16 @@ bool InitialiseDragParameters()
ty2 = (double) Track->m_End.y; ty2 = (double) Track->m_End.y;
RotatePoint( &tx2, &ty2, tx1, ty1, 900 ); RotatePoint( &tx2, &ty2, tx1, ty1, 900 );
} }
if( tx1!=tx2 ) if( tx1 != tx2 )
{ {
s_StartSegmentSlope = (ty2 - ty1) / (tx2 - tx1); s_StartSegmentSlope = ( ty2 - ty1 ) / ( tx2 - tx1 );
s_StartSegment_Yorg = ty1 - (ty2 - ty1) * tx1 / (tx2 - tx1); s_StartSegment_Yorg = ty1 - ( ty2 - ty1 ) * tx1 / ( tx2 - tx1 );
} }
else else
{ {
s_StartPointVertical = true; //signal first segment vertical s_StartPointVertical = true; //signal first segment vertical
} }
if( ty1==ty2 ) if( ty1 == ty2 )
{ {
s_StartPointHorizontal = true; s_StartPointHorizontal = true;
} }
@ -554,7 +568,8 @@ bool InitialiseDragParameters()
ty2 = (double) tSegmentToEnd->m_Start.y; ty2 = (double) tSegmentToEnd->m_Start.y;
} }
} }
else // move the start point on a line starting at Track->m_End, and perpendicular to Track else // move the start point on a line starting at Track->m_End, and
// perpendicular to Track
{ {
tx1 = (double) Track->m_End.x; tx1 = (double) Track->m_End.x;
ty1 = (double) Track->m_End.y; ty1 = (double) Track->m_End.y;
@ -563,36 +578,35 @@ bool InitialiseDragParameters()
RotatePoint( &tx2, &ty2, tx1, ty1, -900 ); RotatePoint( &tx2, &ty2, tx1, ty1, -900 );
} }
if( tx2!=tx1 ) if( tx2 != tx1 )
{ {
s_EndSegmentSlope = (ty2 - ty1) / (tx2 - tx1); s_EndSegmentSlope = ( ty2 - ty1 ) / ( tx2 - tx1 );
s_EndSegment_Yorg = ty1 - (ty2 - ty1) * tx1 / (tx2 - tx1); s_EndSegment_Yorg = ty1 - ( ty2 - ty1 ) * tx1 / ( tx2 - tx1 );
} }
else else
{ {
s_EndPointVertical = true; //signal second segment vertical s_EndPointVertical = true; //signal second segment vertical
} }
if( ty1==ty2 ) if( ty1 == ty2 )
{ {
s_EndPointHorizontal = true; s_EndPointHorizontal = true;
} }
// Init parameters for the moved segment // Init parameters for the moved segment
tx1 = (double) Track->m_Start.x; tx1 = (double) Track->m_Start.x;
ty1 = (double) Track->m_Start.y; ty1 = (double) Track->m_Start.y;
tx2 = (double) Track->m_End.x; tx2 = (double) Track->m_End.x;
ty2 = (double) Track->m_End.y; ty2 = (double) Track->m_End.y;
if( tx2 != tx1 ) if( tx2 != tx1 )
{ {
s_MovingSegmentSlope = (ty2 - ty1) / (tx2 - tx1); s_MovingSegmentSlope = ( ty2 - ty1 ) / ( tx2 - tx1 );
} }
else else
{ {
s_MovingSegmentVertical = true; //signal vertical line s_MovingSegmentVertical = true; //signal vertical line
} }
if( ty1==ty2 ) if( ty1 == ty2 )
{ {
s_MovingSegmentHorizontal = true; s_MovingSegmentHorizontal = true;
} }
@ -605,9 +619,11 @@ bool InitialiseDragParameters()
} }
else else
{ {
if( !s_EndPointVertical && (s_MovingSegmentSlope == s_EndSegmentSlope) ) if( !s_EndPointVertical
&& ( s_MovingSegmentSlope == s_EndSegmentSlope ) )
return false; return false;
if( !s_StartPointVertical && (s_MovingSegmentSlope == s_StartSegmentSlope) ) if( !s_StartPointVertical
&& ( s_MovingSegmentSlope == s_StartSegmentSlope ) )
return false; return false;
} }
@ -615,14 +631,13 @@ bool InitialiseDragParameters()
} }
/*************************************************************************************/ /* Init parameters to move one node:
void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int command )
/*************************************************************************************/
/* Init parametres to move one node:
* a via or/and a terminal point of a track segment * a via or/and a terminal point of a track segment
* The terminal point of other connected segments (if any) are moved too. * The terminal point of other connected segments (if any) are moved too.
*/ */
void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track,
wxDC* DC,
int command )
{ {
if( !track ) if( !track )
return; return;
@ -631,7 +646,7 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int co
NbPtNewTrack = 0; NbPtNewTrack = 0;
EraseDragListe(); EraseDragListe();
/* Change highlighted net: the new one will be hightlighted */ /* Change highlighted net: the new one will be highlighted */
Old_HightLigt_Status = g_HightLigt_Status; Old_HightLigt_Status = g_HightLigt_Status;
Old_HightLigth_NetCode = g_HightLigth_NetCode; Old_HightLigth_NetCode = g_HightLigth_NetCode;
if( g_HightLigt_Status ) if( g_HightLigt_Status )
@ -644,7 +659,8 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int co
if( command != ID_POPUP_PCB_MOVE_TRACK_SEGMENT ) if( command != ID_POPUP_PCB_MOVE_TRACK_SEGMENT )
{ {
Collect_TrackSegmentsToDrag( DrawPanel, DC, track->m_Start, Collect_TrackSegmentsToDrag( DrawPanel, DC, track->m_Start,
track->ReturnMaskLayer(), track->GetNet() ); track->ReturnMaskLayer(),
track->GetNet() );
} }
NewTrack = track; NewTrack = track;
NbPtNewTrack = 1; NbPtNewTrack = 1;
@ -665,23 +681,27 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int co
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT: case ID_POPUP_PCB_DRAG_TRACK_SEGMENT:
pos = track->m_Start; pos = track->m_Start;
Collect_TrackSegmentsToDrag( DrawPanel, DC, pos, Collect_TrackSegmentsToDrag( DrawPanel, DC, pos,
track->ReturnMaskLayer(), track->GetNet() ); track->ReturnMaskLayer(),
track->GetNet() );
pos = track->m_End; pos = track->m_End;
track->m_Flags |= IS_DRAGGED | ENDPOINT | STARTPOINT; track->m_Flags |= IS_DRAGGED | ENDPOINT | STARTPOINT;
Collect_TrackSegmentsToDrag( DrawPanel, DC, pos, Collect_TrackSegmentsToDrag( DrawPanel, DC, pos,
track->ReturnMaskLayer(), track->GetNet() ); track->ReturnMaskLayer(),
track->GetNet() );
break; break;
case ID_POPUP_PCB_MOVE_TRACK_NODE: case ID_POPUP_PCB_MOVE_TRACK_NODE:
pos = (diag & STARTPOINT) ? track->m_Start : track->m_End; pos = (diag & STARTPOINT) ? track->m_Start : track->m_End;
Collect_TrackSegmentsToDrag( DrawPanel, DC, pos, Collect_TrackSegmentsToDrag( DrawPanel, DC, pos,
track->ReturnMaskLayer(), track->GetNet() ); track->ReturnMaskLayer(),
track->GetNet() );
PosInit = pos; PosInit = pos;
break; break;
} }
track->m_Flags |= IS_DRAGGED; track->m_Flags |= IS_DRAGGED;
} }
// Prepare the Undo command // Prepare the Undo command
ITEM_PICKER picker( track, UR_CHANGED ); ITEM_PICKER picker( track, UR_CHANGED );
picker.m_Link = track->Copy(); picker.m_Link = track->Copy();
@ -693,7 +713,7 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int co
picker.m_PickedItem = draggedtrack; picker.m_PickedItem = draggedtrack;
picker.m_Link = draggedtrack->Copy(); picker.m_Link = draggedtrack->Copy();
s_ItemsListPicker.PushItem( picker ); s_ItemsListPicker.PushItem( picker );
draggedtrack = (TRACK*)picker.m_Link; draggedtrack = (TRACK*) picker.m_Link;
draggedtrack->SetStatus( 0 ); draggedtrack->SetStatus( 0 );
draggedtrack->m_Flags = 0; draggedtrack->m_Flags = 0;
} }
@ -707,12 +727,13 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int co
GetBoard()->DrawHighLight( DrawPanel, DC, g_HightLigth_NetCode ); GetBoard()->DrawHighLight( DrawPanel, DC, g_HightLigth_NetCode );
DrawPanel->ManageCurseur( DrawPanel, DC, true ); DrawPanel->ManageCurseur( DrawPanel, DC, true );
} }
#if 0 #if 0
// @todo: This function is broken: does not handle pointers to pads for start and end and flags relative to these pointers
// @todo: This function is broken: does not handle pointers to pads for start
// and end and flags relative to these pointers
void SortTrackEndPoints( TRACK* track ) void SortTrackEndPoints( TRACK* track )
{ {
//sort the track endpoints -- should not matter in terms of drawing //sort the track endpoints -- should not matter in terms of drawing
@ -723,30 +744,32 @@ void SortTrackEndPoints( TRACK* track )
{ {
if( track->m_Start.x > track->m_End.x ) if( track->m_Start.x > track->m_End.x )
{ {
EXCHG(track->m_Start, track->m_End); EXCHG( track->m_Start, track->m_End );
} }
} }
else else
{ {
if( track->m_Start.y > track->m_End.y ) if( track->m_Start.y > track->m_End.y )
{ {
EXCHG(track->m_Start, track->m_End); EXCHG( track->m_Start, track->m_End );
} }
} }
} }
/***********************************************************************************/
bool WinEDA_PcbFrame::MergeCollinearTracks( TRACK* track, wxDC* DC, int end )
/***********************************************************************************/
/** /**
* @todo: this function is broken, because it merge segments having different width or without any connectivity test. * @todo: this function is broken, because it merge segments having different
* 2 collinear segments can be merged only in no other segment or via is connected to the common point * width or without any connectivity test.
* 2 collinear segments can be merged only in no other segment or via is
* connected to the common point
* and if they have the same width. See cleanup.cpp for merge functions, * and if they have the same width. See cleanup.cpp for merge functions,
* and consider Marque_Une_Piste() to locate segments that can be merged * and consider Marque_Une_Piste() to locate segments that can be merged
*/ */
bool WinEDA_PcbFrame::MergeCollinearTracks( TRACK* track, wxDC* DC, int end )
testtrack = (TRACK*) Locate_Piste_Connectee( track, GetBoard()->m_Track, NULL, end ); {
testtrack = (TRACK*) Locate_Piste_Connectee( track,
GetBoard()->m_Track, NULL,
end );
if( testtrack ) if( testtrack )
{ {
SortTrackEndPoints( track ); SortTrackEndPoints( track );
@ -756,11 +779,14 @@ bool WinEDA_PcbFrame::MergeCollinearTracks( TRACK* track, wxDC* DC, int end )
int tdx = testtrack->m_End.x - testtrack->m_Start.x; int tdx = testtrack->m_End.x - testtrack->m_Start.x;
int tdy = testtrack->m_End.y - testtrack->m_Start.y; int tdy = testtrack->m_End.y - testtrack->m_Start.y;
if( (dy * tdx == dx * tdy && dy != 0 && dx != 0 && tdy != 0 && tdx != 0) /*angle, same slope*/ if( ( dy * tdx == dx * tdy && dy != 0 && dx != 0 && tdy != 0 && tdx !=
|| (dy == 0 && tdy == 0 && dx * tdx ) /*horizontal*/ 0 ) /* angle, same slope */
|| (dx == 0 && tdx == 0 && dy * tdy ) /*vertical*/ ) || ( dy == 0 && tdy == 0 && dx * tdx ) /*horizontal */
|| ( dx == 0 && tdx == 0 && dy * tdy ) /*vertical */
)
{ {
if( track->m_Start == testtrack->m_Start || track->m_End == testtrack->m_Start ) if( track->m_Start == testtrack->m_Start || track->m_End ==
testtrack->m_Start )
{ {
if( ( dx * tdx && testtrack->m_End.x > track->m_End.x ) if( ( dx * tdx && testtrack->m_End.x > track->m_End.x )
||( dy * tdy && testtrack->m_End.y > track->m_End.y ) ) ||( dy * tdy && testtrack->m_End.y > track->m_End.y ) )
@ -771,7 +797,8 @@ bool WinEDA_PcbFrame::MergeCollinearTracks( TRACK* track, wxDC* DC, int end )
return true; return true;
} }
} }
if( track->m_Start == testtrack->m_End || track->m_End == testtrack->m_End ) if( track->m_Start == testtrack->m_End || track->m_End ==
testtrack->m_End )
{ {
if( ( dx * tdx && testtrack->m_Start.x < track->m_Start.x ) if( ( dx * tdx && testtrack->m_Start.x < track->m_Start.x )
||( dy * tdy && testtrack->m_Start.y < track->m_Start.y ) ) ||( dy * tdy && testtrack->m_Start.y < track->m_Start.y ) )
@ -784,13 +811,16 @@ bool WinEDA_PcbFrame::MergeCollinearTracks( TRACK* track, wxDC* DC, int end )
} }
} }
} }
return false; return false;
} }
#endif #endif
/***********************************************************************************/
void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC ) void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track,
/***********************************************************************************/ wxDC* DC )
{ {
TRACK* TrackToStartPoint = NULL; TRACK* TrackToStartPoint = NULL;
TRACK* TrackToEndPoint = NULL; TRACK* TrackToEndPoint = NULL;
@ -801,57 +831,66 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
#if 0 #if 0
// Broken functions: see comments // Broken functions: see comments
while( MergeCollinearTracks( track, DC, START ) ) while( MergeCollinearTracks( track, DC, START ) )
{ {
}; }
;
while( MergeCollinearTracks( track, DC, END ) ) while( MergeCollinearTracks( track, DC, END ) )
{ {
}; }
;
#endif #endif
s_StartSegmentPresent = s_EndSegmentPresent = true; s_StartSegmentPresent = s_EndSegmentPresent = true;
if( (track->start == NULL) || (track->start->Type() == TYPE_TRACK) ) if( ( track->start == NULL ) || ( track->start->Type() == TYPE_TRACK ) )
TrackToStartPoint = Locate_Piste_Connectee( track, TrackToStartPoint = Locate_Piste_Connectee( track,
GetBoard()->m_Track, NULL, START ); GetBoard()->m_Track, NULL,
START );
// Test if more than one segment is connected to this point // Test if more than one segment is connected to this point
if( TrackToStartPoint ) if( TrackToStartPoint )
{ {
TrackToStartPoint->SetState( BUSY, ON ); TrackToStartPoint->SetState( BUSY, ON );
if( (TrackToStartPoint->Type() == TYPE_VIA) || if( ( TrackToStartPoint->Type() == TYPE_VIA )
Locate_Piste_Connectee( track, GetBoard()->m_Track, NULL, START ) ) || Locate_Piste_Connectee( track, GetBoard()->m_Track, NULL, START ) )
error = true; error = true;
TrackToStartPoint->SetState( BUSY, OFF ); TrackToStartPoint->SetState( BUSY, OFF );
} }
if( (track->end == NULL) || (track->end->Type() == TYPE_TRACK) ) if( ( track->end == NULL ) || ( track->end->Type() == TYPE_TRACK ) )
TrackToEndPoint = Locate_Piste_Connectee( track, GetBoard()->m_Track, NULL, END ); TrackToEndPoint = Locate_Piste_Connectee( track,
GetBoard()->m_Track, NULL,
END );
// Test if more than one segment is connected to this point // Test if more than one segment is connected to this point
if( TrackToEndPoint ) if( TrackToEndPoint )
{ {
TrackToEndPoint->SetState( BUSY, ON ); TrackToEndPoint->SetState( BUSY, ON );
if( (TrackToEndPoint->Type() == TYPE_VIA) || if( (TrackToEndPoint->Type() == TYPE_VIA)
Locate_Piste_Connectee( track, GetBoard()->m_Track, NULL, END ) ) || Locate_Piste_Connectee( track, GetBoard()->m_Track, NULL, END ) )
error = true; error = true;
TrackToEndPoint->SetState( BUSY, OFF ); TrackToEndPoint->SetState( BUSY, OFF );
} }
if( error ) if( error )
{ {
DisplayError( this, _( "Unable to drag this segment: too many segments connected" ) ); DisplayError( this,
_( "Unable to drag this segment: too many segments connected" ) );
return; return;
} }
if( !TrackToStartPoint || (TrackToStartPoint->Type() != TYPE_TRACK) ) if( !TrackToStartPoint || ( TrackToStartPoint->Type() != TYPE_TRACK ) )
s_StartSegmentPresent = FALSE; s_StartSegmentPresent = FALSE;
if( !TrackToEndPoint || (TrackToEndPoint->Type() != TYPE_TRACK) ) if( !TrackToEndPoint || ( TrackToEndPoint->Type() != TYPE_TRACK ) )
s_EndSegmentPresent = FALSE; s_EndSegmentPresent = FALSE;
/* Change hight light net: the new one will be hightlighted */ /* Change high light net: the new one will be highlighted */
Old_HightLigt_Status = g_HightLigt_Status; Old_HightLigt_Status = g_HightLigt_Status;
Old_HightLigth_NetCode = g_HightLigth_NetCode; Old_HightLigth_NetCode = g_HightLigth_NetCode;
if( g_HightLigt_Status ) if( g_HightLigt_Status )
@ -902,14 +941,15 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
picker.m_PickedItem = draggedtrack; picker.m_PickedItem = draggedtrack;
picker.m_Link = draggedtrack->Copy(); picker.m_Link = draggedtrack->Copy();
s_ItemsListPicker.PushItem( picker ); s_ItemsListPicker.PushItem( picker );
draggedtrack = (TRACK*)picker.m_Link; draggedtrack = (TRACK*) picker.m_Link;
draggedtrack->SetStatus( 0 ); draggedtrack->SetStatus( 0 );
draggedtrack->m_Flags = 0; draggedtrack->m_Flags = 0;
} }
if( !InitialiseDragParameters() ) if( !InitialiseDragParameters() )
{ {
DisplayError( this, _( "Unable to drag this segment: two collinear segments" ) ); DisplayError( this,
_( "Unable to drag this segment: two collinear segments" ) );
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
Abort_MoveTrack( DrawPanel, DC ); Abort_MoveTrack( DrawPanel, DC );
return; return;
@ -917,10 +957,8 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
} }
/**********************************************************************/
bool WinEDA_PcbFrame::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
/**********************************************************************/
/* Place a dragged (or moved) track segment or via */ /* Place a dragged (or moved) track segment or via */
bool WinEDA_PcbFrame::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
{ {
int errdrc; int errdrc;
DRAG_SEGM* pt_drag; DRAG_SEGM* pt_drag;
@ -963,16 +1001,20 @@ bool WinEDA_PcbFrame::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
Track->Draw( DrawPanel, DC, draw_mode ); Track->Draw( DrawPanel, DC, draw_mode );
/* Test the connections modified by the move /* Test the connections modified by the move
* (only pad connection must be tested, track connection will be tested by test_1_net_connexion() ) */ * (only pad connection must be tested, track connection will be
* tested by test_1_net_connexion() ) */
int masque_layer = g_TabOneLayerMask[Track->GetLayer()]; int masque_layer = g_TabOneLayerMask[Track->GetLayer()];
Track->start = Fast_Locate_Pad_Connecte( GetBoard(), Track->m_Start, masque_layer ); Track->start = Fast_Locate_Pad_Connecte(
Track->end = Fast_Locate_Pad_Connecte( GetBoard(), Track->m_End, masque_layer ); GetBoard(), Track->m_Start, masque_layer );
Track->end = Fast_Locate_Pad_Connecte(
GetBoard(), Track->m_End, masque_layer );
} }
EraseDragListe(); EraseDragListe();
SaveCopyInUndoList(s_ItemsListPicker, UR_UNSPECIFIED); SaveCopyInUndoList( s_ItemsListPicker, UR_UNSPECIFIED );
s_ItemsListPicker.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items s_ItemsListPicker.ClearItemsList(); // s_ItemsListPicker is no more owner
// of picked items
GetScreen()->SetModify(); GetScreen()->SetModify();
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
@ -985,20 +1027,17 @@ bool WinEDA_PcbFrame::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
} }
/************************************************************************/ /* Find the point "attachment" of the end of a trace.
BOARD_ITEM* LocateLockPoint( BOARD* Pcb, wxPoint pos, int LayerMask ) * This may be a TBP or another segment of the trace
/************************************************************************/ * Returns:
* - Pointer to the PAD or:
/* Routine trouvant le point "d'accrochage" d'une extremite de piste. * - Pointer to the segment or:
* Ce point peut etre un PAD ou un autre segment de piste
* Retourne:
* - pointeur sur ce PAD ou:
* - pointeur sur le segment ou:
* - NULL * - NULL
* Parametres d'appel: * Parameters:
* coord pX, pY du point tst * - position to test
* masque des couches a tester * - mask layers to be tested
*/ */
BOARD_ITEM* LocateLockPoint( BOARD* Pcb, wxPoint pos, int LayerMask )
{ {
for( MODULE* module = Pcb->m_Modules; module; module = module->Next() ) for( MODULE* module = Pcb->m_Modules; module; module = module->Next() )
{ {
@ -1007,8 +1046,7 @@ BOARD_ITEM* LocateLockPoint( BOARD* Pcb, wxPoint pos, int LayerMask )
return pad; return pad;
} }
/* ici aucun pad n'a ete localise: detection d'un segment de piste */ /* No pad has been located so check for a segment of the trace. */
TRACK* ptsegm = Fast_Locate_Piste( Pcb->m_Track, NULL, pos, LayerMask ); TRACK* ptsegm = Fast_Locate_Piste( Pcb->m_Track, NULL, pos, LayerMask );
if( ptsegm == NULL ) if( ptsegm == NULL )
ptsegm = Locate_Pistes( Pcb->m_Track, pos, LayerMask ); ptsegm = Locate_Pistes( Pcb->m_Track, pos, LayerMask );
@ -1017,25 +1055,26 @@ BOARD_ITEM* LocateLockPoint( BOARD* Pcb, wxPoint pos, int LayerMask )
} }
/******************************************************************************/ /* Create an intermediate point on a segment
TRACK* CreateLockPoint( wxPoint & aRefPoint, TRACK* aSegm, TRACK* aRefSegm, PICKED_ITEMS_LIST* aItemsListPicker ) * ASegm segment is broken into 2 segments connecting point pX, pY
/******************************************************************************/ * Returns:
* NULL if no new point (ie if aRefPoint already corresponded
/* Routine de creation d'un point intermediaire sur un segment * At one end where:
* le segment aSegm est casse en 2 segments se raccordant au point pX, pY * Pointer to the segment created
* retourne: * Created and the point is the intersection of 2 lines segments aSegm and
* NULL si pas de nouveau point ( c.a.d si aRefPoint correspondait deja * refsegm
* a une extremite ou: * Returns the exact value of aRefPoint
* pointeur sur le segment cree * If aSegm points to a via:
* et le point cree est l'intersection des 2 axes des segments aSegm et refsegm * Returns the exact value of aRefPoint and ptsegm,
* retourne la valeur exacte de aRefPoint * But does not create extra point
* Si aSegm pointe sur une via:
* retourne la valeur exacte de aRefPoint et ptsegm,
* mais ne cree pas de point supplementaire
*/ */
TRACK* CreateLockPoint( wxPoint& aRefPoint,
TRACK* aSegm,
TRACK* aRefSegm,
PICKED_ITEMS_LIST* aItemsListPicker )
{ {
int cX, cY; int cX, cY;
int dx, dy; /* Coord de l'extremite du segm ptsegm / origine */ int dx, dy;
if( aSegm->m_Start == aRefPoint || aSegm->m_End == aRefPoint ) if( aSegm->m_Start == aRefPoint || aSegm->m_End == aRefPoint )
return NULL; return NULL;
@ -1047,18 +1086,18 @@ TRACK* CreateLockPoint( wxPoint & aRefPoint, TRACK* aSegm, TRACK* aRefSegm, PICK
return aSegm; return aSegm;
} }
/* calcul des coord vraies du point intermediaire dans le repere d'origine /* Calculation coordinate of intermediate point in the coordinate origin
* = origine de ptsegm * = Original ptsegm
*/ */
cX = aRefPoint.x - aSegm->m_Start.x; cX = aRefPoint.x - aSegm->m_Start.x;
cY = aRefPoint.y - aSegm->m_Start.y; cY = aRefPoint.y - aSegm->m_Start.y;
dx = aSegm->m_End.x - aSegm->m_Start.x; dx = aSegm->m_End.x - aSegm->m_Start.x;
dy = aSegm->m_End.y - aSegm->m_Start.y; dy = aSegm->m_End.y - aSegm->m_Start.y;
// Not yet used: // Not yet used:
#if 0 #if 0
int ox, oy, fx, fy; /* coord de refsegm / origine de prsegm */ int ox, oy, fx, fy;
if( aRefSegm ) if( aRefSegm )
{ {
ox = aRefSegm->m_Start.x - aSegm->m_Start.x; ox = aRefSegm->m_Start.x - aSegm->m_Start.x;
@ -1068,16 +1107,15 @@ TRACK* CreateLockPoint( wxPoint & aRefPoint, TRACK* aSegm, TRACK* aRefSegm, PICK
} }
#endif #endif
/* pour que le point soit sur le segment ptsegm: cY/cX = dy/dx */ /* that the item be on the segment ptsegm: cY/cX = dy/dx */
if( dx == 0 ) if( dx == 0 )
cX = 0; /* segm horizontal */ cX = 0; /* segm horizontal */
else else
cY = (cX * dy) / dx; cY = ( cX * dy ) / dx;
/* creation du point intermediaire ( c'est a dire creation d'un nouveau /* Create the intermediate point (that is to say creation of a new
* segment, debutant au point intermediaire * segment, beginning at the intermediate point.
*/ */
cX += aSegm->m_Start.x; cX += aSegm->m_Start.x;
cY += aSegm->m_Start.y; cY += aSegm->m_Start.y;
@ -1085,7 +1123,7 @@ TRACK* CreateLockPoint( wxPoint & aRefPoint, TRACK* aSegm, TRACK* aRefSegm, PICK
if( aItemsListPicker ) if( aItemsListPicker )
{ {
ITEM_PICKER picker( newTrack, UR_NEW ); ITEM_PICKER picker( newTrack, UR_NEW );
aItemsListPicker->PushItem(picker); aItemsListPicker->PushItem( picker );
} }
@ -1093,22 +1131,22 @@ TRACK* CreateLockPoint( wxPoint & aRefPoint, TRACK* aSegm, TRACK* aRefSegm, PICK
wxASSERT( list ); wxASSERT( list );
list->Insert( newTrack, aSegm->Next() ); list->Insert( newTrack, aSegm->Next() );
/* correction du pointeur de fin du nouveau segment */ /* Correct pointer at the end of the new segment. */
newTrack->end = aSegm->end; newTrack->end = aSegm->end;
/* le segment primitif finit au nouveau point : */ /* Segment ends at new point. */
if( aItemsListPicker ) if( aItemsListPicker )
{ {
ITEM_PICKER picker( aSegm, UR_CHANGED ); ITEM_PICKER picker( aSegm, UR_CHANGED );
picker.m_Link = aSegm->Copy(); picker.m_Link = aSegm->Copy();
aItemsListPicker->PushItem(picker); aItemsListPicker->PushItem( picker );
} }
aSegm->m_End.x = cX; aSegm->m_End.x = cX;
aSegm->m_End.y = cY; aSegm->m_End.y = cY;
aSegm->SetState( END_ONPAD, OFF ); aSegm->SetState( END_ONPAD, OFF );
/* le nouveau segment debute au nouveau point : */ /* The next segment begins at the new point. */
aSegm = newTrack;; aSegm = newTrack;;
aSegm->m_Start.x = cX; aSegm->m_Start.x = cX;
aSegm->m_Start.y = cY; aSegm->m_Start.y = cY;

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
/*****************************************************/ /*****************************************************/
/* muwave_command.cpp: micro wave functions commands */ /* muwave_command.cpp: micro wave functions commands */
/*****************************************************/ /*****************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
@ -14,62 +14,60 @@
#include "protos.h" #include "protos.h"
/*********************************************************************/ /* Handle microwave commands.
void WinEDA_PcbFrame::ProcessMuWaveFunctions(wxCommandEvent& event) */
/*********************************************************************/ void WinEDA_PcbFrame::ProcessMuWaveFunctions( wxCommandEvent& event )
/* Traite les selections d'outils et les commandes appelees du menu POPUP
*/
{ {
int id = event.GetId(); int id = event.GetId();
wxPoint pos; wxPoint pos;
wxClientDC dc(DrawPanel); wxClientDC dc( DrawPanel );
DrawPanel->PrepareGraphicContext(&dc); DrawPanel->PrepareGraphicContext( &dc );
wxGetMousePosition(&pos.x, &pos.y); wxGetMousePosition( &pos.x, &pos.y );
pos.y += 20; pos.y += 20;
switch ( id ) // Arret eventuel de la commande de déplacement en cours switch( id ) // End any command in progress.
{ {
case ID_POPUP_COPY_BLOCK: case ID_POPUP_COPY_BLOCK:
break; break;
default: // Arret de la commande de déplacement en cours default: // End block command in progress.
if( DrawPanel->ManageCurseur && if( DrawPanel->ManageCurseur
DrawPanel->ForceCloseManageCurseur ) && DrawPanel->ForceCloseManageCurseur )
{ {
DrawPanel->ForceCloseManageCurseur(DrawPanel, &dc); DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
} }
SetToolID(0, wxCURSOR_ARROW,wxEmptyString); SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break; break;
} }
switch ( id ) // Traitement des commandes switch( id )
{ {
case ID_PCB_MUWAVE_TOOL_SELF_CMD: case ID_PCB_MUWAVE_TOOL_SELF_CMD:
SetToolID( id, wxCURSOR_PENCIL, _("Add Line")); SetToolID( id, wxCURSOR_PENCIL, _( "Add Line" ) );
break; break;
case ID_PCB_MUWAVE_TOOL_GAP_CMD: case ID_PCB_MUWAVE_TOOL_GAP_CMD:
SetToolID( id, wxCURSOR_PENCIL, _("Add Gap")); SetToolID( id, wxCURSOR_PENCIL, _( "Add Gap" ) );
break; break;
case ID_PCB_MUWAVE_TOOL_STUB_CMD: case ID_PCB_MUWAVE_TOOL_STUB_CMD:
SetToolID( id, wxCURSOR_PENCIL, _("Add Stub")); SetToolID( id, wxCURSOR_PENCIL, _( "Add Stub" ) );
break; break;
case ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD: case ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD:
SetToolID( id, wxCURSOR_PENCIL, _("Add Arc Stub")); SetToolID( id, wxCURSOR_PENCIL, _( "Add Arc Stub" ) );
break; break;
case ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD: case ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD:
SetToolID( id, wxCURSOR_PENCIL, _("Add Polynomial Shape")); SetToolID( id, wxCURSOR_PENCIL, _( "Add Polynomial Shape" ) );
break; break;
default: default:
DisplayError(this, wxT("WinEDA_PcbFrame::ProcessMuWaveFunctions() id error")); DisplayError( this,
wxT( "WinEDA_PcbFrame::ProcessMuWaveFunctions() id error" ) );
break; break;
} }
@ -77,45 +75,42 @@ wxClientDC dc(DrawPanel);
} }
void WinEDA_PcbFrame::MuWaveCommand( wxDC* DC, const wxPoint& MousePos )
/***************************************************************************/
void WinEDA_PcbFrame::MuWaveCommand(wxDC * DC, const wxPoint& MousePos)
/***************************************************************************/
{ {
MODULE* module = NULL; MODULE* module = NULL;
switch ( m_ID_current_state )
switch( m_ID_current_state )
{ {
case ID_PCB_MUWAVE_TOOL_SELF_CMD: case ID_PCB_MUWAVE_TOOL_SELF_CMD:
Begin_Self(DC); Begin_Self( DC );
break; break;
case ID_PCB_MUWAVE_TOOL_GAP_CMD: case ID_PCB_MUWAVE_TOOL_GAP_CMD:
module = Create_MuWaveComponent( 0); module = Create_MuWaveComponent( 0 );
break; break;
case ID_PCB_MUWAVE_TOOL_STUB_CMD: case ID_PCB_MUWAVE_TOOL_STUB_CMD:
module = Create_MuWaveComponent( 1); module = Create_MuWaveComponent( 1 );
break; break;
case ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD: case ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD:
module = Create_MuWaveComponent( 2); module = Create_MuWaveComponent( 2 );
break; break;
case ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD: case ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD:
module = Create_MuWavePolygonShape(); module = Create_MuWavePolygonShape();
break; break;
default : default:
DrawPanel->SetCursor(wxCURSOR_ARROW); DrawPanel->SetCursor( wxCURSOR_ARROW );
DisplayError(this, wxT("WinEDA_PcbFrame::MuWaveCommand() id error")); DisplayError( this, wxT( "WinEDA_PcbFrame::MuWaveCommand() id error" ) );
SetToolID(0, wxCURSOR_ARROW,wxEmptyString); SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break; break;
} }
if ( module ) if( module )
{ {
StartMove_Module( module, DC ); StartMove_Module( module, DC );
} }
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
} }

View File

@ -3,24 +3,29 @@
/***********************/ /***********************/
/* /*
* Function to read a netlist. Whele readint a netlis: * Function to read a netlist. While reading a netlist:
* - Load new footprints * - Load new footprints
* - Initialise net info * - Initialize net info
* - Test for missing or extra footprints * - Test for missing or extra footprints
* - Recalculate ratsnest * - Recalculate ratsnest
* *
* Important remark: * Important remark:
* When reading a netlist Pcbnew must identify existing footprints (link between existing footprints an components in netlist) * When reading a netlist Pcbnew must identify existing footprints (link
* between existing footprints an components in netlist)
* This identification can be from 2 fields: * This identification can be from 2 fields:
* - The reference (U2, R5 ..): this is the normal mode * - The reference (U2, R5 ..): this is the normal mode
* - The Time Stamp (Signature Temporelle), useful after a full schematic reannotation * - The Time Stamp (Signature Temporelle), useful after a full schematic
* reannotation
* because references can be changed for the same schematic. * because references can be changed for the same schematic.
* So when reading a netlist this identification ReadPcbNetlist() has aselection of the way to identify footprints. * So when reading a netlist this identification ReadPcbNetlist() has
* selection of the way to identify footprints.
* If we want to fully reannotate a schematic this sequence must be used * If we want to fully reannotate a schematic this sequence must be used
* SAVE your board !!! * SAVE your board !!!
* Create and read the netlist (to ensure all info is correct, mainly references and time stamp) * Create and read the netlist (to ensure all info is correct, mainly
* references and time stamp)
* Reannotate the schematic (references will be changed, but not time stamp) * Reannotate the schematic (references will be changed, but not time stamp)
* Recreate and read the new netlist using the Time Stamp identification (that reinit the new references) * Recreate and read the new netlist using the Time Stamp identification
* (that reinit the new references)
*/ */
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
@ -39,7 +44,7 @@
#define TESTONLY 1 #define TESTONLY 1
#define READMODULE 0 #define READMODULE 0
/* Structures locales */
class MODULEtoLOAD class MODULEtoLOAD
{ {
public: public:
@ -48,8 +53,7 @@ public:
wxString m_TimeStampPath; wxString m_TimeStampPath;
MODULEtoLOAD* m_Next; MODULEtoLOAD* m_Next;
public: public: MODULEtoLOAD( const wxString& libname,
MODULEtoLOAD( const wxString& libname,
const wxString& cmpname, const wxString& cmpname,
const wxString& timestamp_path ) const wxString& timestamp_path )
{ {
@ -66,9 +70,10 @@ public:
void SetNext( MODULEtoLOAD* next ) { m_Next = next; } void SetNext( MODULEtoLOAD* next ) { m_Next = next; }
}; };
/* Fonctions locales : */
static void SortListModulesToLoadByLibname( int NbModules ); static void SortListModulesToLoadByLibname( int NbModules );
static int BuildFootprintsListFromNetlistFile( const wxString& aNetlistFullFilename, static int BuildFootprintsListFromNetlistFile(
const wxString& aNetlistFullFilename,
wxArrayString& aBufName ); wxArrayString& aBufName );
static bool OpenNetlistFile( const wxString& aFullFileName ); static bool OpenNetlistFile( const wxString& aFullFileName );
static void AddToList( const wxString& NameLibCmp, static void AddToList( const wxString& NameLibCmp,
@ -93,19 +98,15 @@ static MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
static void LoadListeModules( WinEDA_PcbFrame* aPcbFrame ); static void LoadListeModules( WinEDA_PcbFrame* aPcbFrame );
/* Variables locales */
static int s_NbNewModules; static int s_NbNewModules;
static MODULEtoLOAD* s_ModuleToLoad_List; static MODULEtoLOAD* s_ModuleToLoad_List;
FILE* source; FILE* source;
/************************************************************************/
bool OpenNetlistFile( const wxString& aFullFileName )
/************************************************************************/
/** function OpenNetlistFile /** function OpenNetlistFile
* used to open a netlist file * used to open a netlist file
*/ */
bool OpenNetlistFile( const wxString& aFullFileName )
{ {
if( aFullFileName.IsEmpty() ) if( aFullFileName.IsEmpty() )
return FALSE; /* No filename: exit */ return FALSE; /* No filename: exit */
@ -114,7 +115,8 @@ bool OpenNetlistFile( const wxString& aFullFileName )
if( source == 0 ) if( source == 0 )
{ {
wxString msg; wxString msg;
msg.Printf( _( "Netlist file %s not found" ), GetChars( aFullFileName ) ); msg.Printf( _( "Netlist file %s not found" ),
GetChars( aFullFileName ) );
DisplayError( NULL, msg ); DisplayError( NULL, msg );
return FALSE; return FALSE;
} }
@ -123,23 +125,14 @@ bool OpenNetlistFile( const wxString& aFullFileName )
} }
/*******************************************************************************/
void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
const wxString& aNetlistFullFilename,
const wxString& aCmpFullFileName,
wxTextCtrl* aMessageWindow,
bool aChangeFootprint,
bool aDeleteBadTracks,
bool aDeleteExtraFootprints,
bool aSelect_By_Timestamp )
/********************************************************************************/
/** Function ReadPcbNetlist /** Function ReadPcbNetlist
* Update footprints (load missing footprints and delete on request extra footprints) * Update footprints (load missing footprints and delete on request extra
* footprints)
* Update connectivity info ( Net Name list ) * Update connectivity info ( Net Name list )
* Update Reference, value and "TIME STAMP" * Update Reference, value and "TIME STAMP"
* @param aNetlistFullFilename = netlist file name (*.net) * @param aNetlistFullFilename = netlist file name (*.net)
* @param aCmpFullFileName = cmp/footprint list file name (*.cmp) if not found, only the netmist will be used * @param aCmpFullFileName = cmp/footprint list file name (*.cmp) if not found,
* only the netlist will be used
* *
* the format of the netlist is something like: * the format of the netlist is something like:
# EESchema Netlist Version 1.0 generee le 18/5/2005-12:30:22 # EESchema Netlist Version 1.0 generee le 18/5/2005-12:30:22
@ -155,6 +148,14 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
* } * }
* #End * #End
*/ */
void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
const wxString& aNetlistFullFilename,
const wxString& aCmpFullFileName,
wxTextCtrl* aMessageWindow,
bool aChangeFootprint,
bool aDeleteBadTracks,
bool aDeleteExtraFootprints,
bool aSelect_By_Timestamp )
{ {
int LineNum, State, Comment; int LineNum, State, Comment;
MODULE* Module = NULL; MODULE* Module = NULL;
@ -169,7 +170,8 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
if( aMessageWindow ) if( aMessageWindow )
{ {
wxString msg; wxString msg;
msg.Printf( _( "Reading Netlist \"%s\"" ), GetChars( aNetlistFullFilename ) ); msg.Printf( _( "Reading Netlist \"%s\"" ),
GetChars( aNetlistFullFilename ) );
aMessageWindow->AppendText( msg + wxT( "\n" ) ); aMessageWindow->AppendText( msg + wxT( "\n" ) );
} }
@ -183,7 +185,8 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
wxBusyCursor dummy; // Shows an hourglass while calculating wxBusyCursor dummy; // Shows an hourglass while calculating
/* First, read the netlist: Build the list of footprints to load (new footprints) /* First, read the netlist: Build the list of footprints to load (new
* footprints)
*/ */
while( GetLine( source, Line, &LineNum ) ) while( GetLine( source, Line, &LineNum ) )
{ {
@ -221,7 +224,7 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
continue; continue;
} }
if( State >= 3 ) /* la ligne de description d'un pad est ici non analysee */ if( State >= 3 ) /* Do not analyzed pad description here. */
{ {
State--; State--;
} }
@ -243,15 +246,18 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
s_ModuleToLoad_List = NULL; s_ModuleToLoad_List = NULL;
} }
/* Second read , All footprints are on board, one must update the schematic info (pad netnames) */ /* Second read , All footprints are on board, one must update the schematic
* info (pad netnames) */
fseek( source, 0, SEEK_SET ); LineNum = 0; fseek( source, 0, SEEK_SET ); LineNum = 0;
while( GetLine( source, Line, &LineNum ) ) while( GetLine( source, Line, &LineNum ) )
{ {
Text = StrPurge( Line ); Text = StrPurge( Line );
if( Comment ) /* we are reading a commment */ if( Comment ) /* we are reading a
* comment */
{ {
if( ( Text = strchr( Text, '}' ) ) == NULL ) /* this is the end of a comment */ if( ( Text = strchr( Text, '}' ) ) == NULL ) /* this is the end
* of a comment */
continue; continue;
Comment = 0; Comment = 0;
} }
@ -277,7 +283,8 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
READMODULE, READMODULE,
aSelect_By_Timestamp, aSelect_By_Timestamp,
aChangeFootprint ); aChangeFootprint );
if( Module == NULL ) // the module could not be created (perhaps footprint not found in library) if( Module == NULL ) // the module could not be created (perhaps
// footprint not found in library)
{ {
continue; continue;
} }
@ -309,8 +316,8 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
{ {
wxArrayString ModuleListFromNetlist; wxArrayString ModuleListFromNetlist;
/* Build list of modules in the netlist */ /* Build list of modules in the netlist */
int NbModulesNetListe = BuildFootprintsListFromNetlistFile( int NbModulesNetListe =
aNetlistFullFilename, BuildFootprintsListFromNetlistFile( aNetlistFullFilename,
ModuleListFromNetlist ); ModuleListFromNetlist );
if( NbModulesNetListe ) if( NbModulesNetListe )
{ {
@ -321,23 +328,25 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
{ {
int ii; int ii;
NextModule = Module->Next(); NextModule = Module->Next();
if( (Module->m_ModuleStatus & MODULE_is_LOCKED) ) if( Module->m_ModuleStatus & MODULE_is_LOCKED )
continue; continue;
for( ii = 0; ii < NbModulesNetListe; ii++ ) for( ii = 0; ii < NbModulesNetListe; ii++ )
{ {
if( Module->m_Reference->m_Text.CmpNoCase( if( Module->m_Reference->m_Text.CmpNoCase(
ModuleListFromNetlist[ii] ) == 0 ) ModuleListFromNetlist[ii] ) == 0 )
{ {
break; /* Module trouve en netliste */ break; /* Module is already in net list. */
} }
} }
if( ii == NbModulesNetListe ) /* Module not found in netlist */ if( ii == NbModulesNetListe ) /* Module not found in
* net list. */
{ {
if( ask_for_confirmation ) if( ask_for_confirmation )
{ {
ask_for_confirmation = false; ask_for_confirmation = false;
if( !IsOK( NULL, _( "Ok to delete footprints not in netlist ?" ) ) ) if( !IsOK( NULL,
_( "Ok to delete footprints not in netlist?" ) ) )
break; break;
} }
Module->DeleteStructure(); Module->DeleteStructure();
@ -363,7 +372,22 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
} }
/****************************************************************************/ /* Load the description of a footprint, net list type Pcbnew
* and update the corresponding module.
*
* If TstOnly == 0 if the module does not exist, it is responsible
* If TstOnly! = 0 if the module does not exist, it is added to the list
* Load modules has
* Text contains the first line of description
* UseFichCmp is a flag
* If! = 0, file components. CMP will be used
* Is reset to 0 if the file does not exist
*
* Analyze lines like:
* ($ 40C08647 noname R20 4.7 K Lib = (R)
* (1 VCC)
* (2 MODB_1)
*/
MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame, MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
wxTextCtrl* aMessageWindow, wxTextCtrl* aMessageWindow,
const wxString& aCmpFullFileName, const wxString& aCmpFullFileName,
@ -372,24 +396,6 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
int TstOnly, int TstOnly,
bool aSelect_By_Timestamp, bool aSelect_By_Timestamp,
bool aChangeFootprint ) bool aChangeFootprint )
/****************************************************************************/
/* charge la description d'une empreinte, netliste type PCBNEW
* et met a jour le module correspondant
*
* Si TstOnly == 0 si le module n'existe pas, il est charge
* Si TstOnly != 0 si le module n'existe pas, il est ajoute a la liste des
* modules a charger
* Text contient la premiere ligne de la description
* UseFichCmp est un flag
* si != 0, le fichier des composants .CMP sera utilise
* est remis a 0 si le fichier n'existe pas
*
* Analyse les lignes type:
* ( 40C08647 $noname R20 4,7K {Lib=R}
* ( 1 VCC )
* ( 2 MODB_1 )
*/
{ {
MODULE* Module; MODULE* Module;
char* text; char* text;
@ -429,7 +435,7 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
if( Error > 0 ) if( Error > 0 )
return NULL; return NULL;
/* Tst si composant deja charge */ /* Test if module is already loaded. */
Module = aFrame->GetBoard()->m_Modules; Module = aFrame->GetBoard()->m_Modules;
MODULE* NextModule; MODULE* NextModule;
@ -446,7 +452,8 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
if( TextCmpName.CmpNoCase( Module->m_Reference->m_Text ) == 0 ) if( TextCmpName.CmpNoCase( Module->m_Reference->m_Text ) == 0 )
Found = true; Found = true;
} }
if( Found ) // test footprint matching for existing modules: current m_LibRef and module name in netlist must match if( Found ) // test footprint matching for existing modules: current
// m_LibRef and module name in netlist must match
{ {
if( TstOnly != TESTONLY ) if( TstOnly != TESTONLY )
{ {
@ -468,13 +475,20 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
NameLibCmp ); NameLibCmp );
} }
} }
if( Module->m_LibRef.CmpNoCase( NameLibCmp ) != 0 ) // Module Mismatch: Current module and module specified in netlist are different.
/* Module mismatch: current module and module specified in
* net list are different.
*/
if( Module->m_LibRef.CmpNoCase( NameLibCmp ) != 0 )
{ {
if( aChangeFootprint ) // footprint exchange allowed: if( aChangeFootprint ) // footprint exchange allowed.
{ {
MODULE* NewModule = MODULE* NewModule =
aFrame->Get_Librairie_Module( wxEmptyString, NameLibCmp, true ); aFrame->Get_Librairie_Module( wxEmptyString,
if( NewModule ) /* Change old module to the new module (and delete the old one)*/ NameLibCmp,
true );
if( NewModule ) /* Change old module to the new module
* (and delete the old one) */
{ {
aFrame->Exchange_Module( Module, NewModule, NULL ); aFrame->Exchange_Module( Module, NewModule, NULL );
Module = NewModule; Module = NewModule;
@ -483,9 +497,8 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
else else
{ {
wxString msg; wxString msg;
msg.Printf( msg.Printf( _( "Component \"%s\": Mismatch! module \
_( is [%s] and netlist said [%s]\n" ),
"Component \"%s\": Mismatch! module is [%s] and netlist said [%s]\n" ),
GetChars( TextCmpName ), GetChars( TextCmpName ),
GetChars( Module->m_LibRef ), GetChars( Module->m_LibRef ),
GetChars( NameLibCmp ) ); GetChars( NameLibCmp ) );
@ -495,6 +508,7 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
} }
} }
} }
break; break;
} }
} }
@ -505,11 +519,17 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
{ {
if( aSelect_By_Timestamp == 1 ) if( aSelect_By_Timestamp == 1 )
{ {
*UseFichCmp = ReadListeModules( aCmpFullFileName, NULL, &TimeStampPath, NameLibCmp ); *UseFichCmp = ReadListeModules( aCmpFullFileName,
NULL,
&TimeStampPath,
NameLibCmp );
} }
else else
{ {
*UseFichCmp = ReadListeModules( aCmpFullFileName, &TextCmpName, NULL, NameLibCmp ); *UseFichCmp = ReadListeModules( aCmpFullFileName,
&TextCmpName,
NULL,
NameLibCmp );
} }
} }
@ -521,11 +541,12 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
if( aMessageWindow ) if( aMessageWindow )
{ {
wxString msg; wxString msg;
msg.Printf( _( "Component [%s] not found" ), GetChars( TextCmpName ) ); msg.Printf( _( "Component [%s] not found" ),
GetChars( TextCmpName ) );
aMessageWindow->AppendText( msg + wxT( "\n" ) ); aMessageWindow->AppendText( msg + wxT( "\n" ) );
} }
} }
return NULL; /* Le module n'avait pas pu etre charge */ return NULL; /* The module could not be loaded. */
} }
/* Fields update ( reference, value and "Time Stamp") */ /* Fields update ( reference, value and "Time Stamp") */
@ -533,20 +554,21 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
Module->m_Value->m_Text = TextValeur; Module->m_Value->m_Text = TextValeur;
Module->m_Path = TimeStampPath; Module->m_Path = TimeStampPath;
return Module; /* composant trouve */ return Module;
} }
/*******************************************************************************************/
int SetPadNetName( wxWindow* frame, char* Text, MODULE* Module, wxTextCtrl* aMessageWindow )
/*******************************************************************************************/
/** Function SetPadNetName /** Function SetPadNetName
* Update a pad netname in a given footprint * Update a pad netname in a given footprint
* @param Text = Text from netlist (format: (pad = net) ) * @param Text = Text from netlist (format: (pad = net) )
* @param Module = the given footprint * @param Module = the given footprint
* @param aMessageWindow = a wxTextCtrl to print error and warning message (can be NULL) * @param aMessageWindow = a wxTextCtrl to print error and warning message
* (can be NULL)
*/ */
int SetPadNetName( wxWindow* frame,
char* Text,
MODULE* Module,
wxTextCtrl* aMessageWindow )
{ {
D_PAD* pad; D_PAD* pad;
char* TextPinName, * TextNetName; char* TextPinName, * TextNetName;
@ -567,11 +589,10 @@ int SetPadNetName( wxWindow* frame, char* Text, MODULE* Module, wxTextCtrl* aMes
if( Error ) if( Error )
return 0; return 0;
/* recherche du pad */
pad = Module->m_Pads; trouve = FALSE; pad = Module->m_Pads; trouve = FALSE;
for( ; pad != NULL; pad = (D_PAD*) pad->Next() ) for( ; pad != NULL; pad = (D_PAD*) pad->Next() )
{ {
if( strnicmp( TextPinName, pad->m_Padname, 4 ) == 0 ) /* trouve */ if( strnicmp( TextPinName, pad->m_Padname, 4 ) == 0 )
{ {
trouve = true; trouve = true;
if( *TextNetName != '?' ) if( *TextNetName != '?' )
@ -597,15 +618,12 @@ int SetPadNetName( wxWindow* frame, char* Text, MODULE* Module, wxTextCtrl* aMes
} }
/*****************************************************/
MODULE* WinEDA_PcbFrame::ListAndSelectModuleName( void )
/*****************************************************/
/** /**
* build and shows a list of existing modules on board * build and shows a list of existing modules on board
* The user can slect a module from this list * The user can select a module from this list
* @return a pointer to the selected module or NULL * @return a pointer to the selected module or NULL
*/ */
MODULE* WinEDA_PcbFrame::ListAndSelectModuleName( void )
{ {
int ii, jj; int ii, jj;
MODULE* Module; MODULE* Module;
@ -643,12 +661,6 @@ MODULE* WinEDA_PcbFrame::ListAndSelectModuleName( void )
} }
/*****************************************************************************************/
void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
const wxString& aNetlistFullFilename,
BOARD* aPcb )
/******************************************************************************************/
/** Function TestFor_Duplicate_Missing_And_Extra_Footprints /** Function TestFor_Duplicate_Missing_And_Extra_Footprints
* Build a list from the given board and netlist : * Build a list from the given board and netlist :
* 1 - for duplicate footprints on board * 1 - for duplicate footprints on board
@ -658,6 +670,9 @@ void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
* @param aNetlistFullFilename = the given netlist * @param aNetlistFullFilename = the given netlist
* @param aPcb = the given board * @param aPcb = the given board
*/ */
void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
const wxString& aNetlistFullFilename,
BOARD* aPcb )
#define MAX_LEN_TXT 32 #define MAX_LEN_TXT 32
{ {
int ii; int ii;
@ -668,32 +683,38 @@ void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
if( aPcb->m_Modules == NULL ) if( aPcb->m_Modules == NULL )
{ {
DisplayInfoMessage( aFrame, _( "No modules" ), 10 ); return; DisplayInfoMessage( aFrame, _( "No modules" ), 10 );
return;
} }
/* Construction de la liste des references des modules de la netliste */ /* Build the list of references of the net list modules. */
NbModulesNetListe = BuildFootprintsListFromNetlistFile( aNetlistFullFilename,
NbModulesNetListe =
BuildFootprintsListFromNetlistFile( aNetlistFullFilename,
ModuleListFromNetlist ); ModuleListFromNetlist );
if( NbModulesNetListe < 0 ) if( NbModulesNetListe < 0 )
return; /* File not found */ return; /* File not found */
if( NbModulesNetListe == 0 ) if( NbModulesNetListe == 0 )
{ {
DisplayError( aFrame, _( "No modules in NetList" ), 10 ); return; DisplayError( aFrame, _( "No modules in NetList" ), 10 );
return;
} }
List = new WinEDA_TextFrame( aFrame, _( "Check Modules" ) ); List = new WinEDA_TextFrame( aFrame, _( "Check Modules" ) );
/* recherche des doubles */ /* Search for duplicate footprints. */
List->Append( _( "Duplicates" ) ); List->Append( _( "Duplicates" ) );
Module = aPcb->m_Modules; Module = aPcb->m_Modules;
for( ; Module != NULL; Module = Module->Next() ) for( ; Module != NULL; Module = Module->Next() )
{ {
pt_aux = Module->Next(); pt_aux = Module->Next();
for( ; pt_aux != NULL; pt_aux = pt_aux->Next() ) for( ; pt_aux != NULL; pt_aux = pt_aux->Next() )
{ {
if( Module->m_Reference->m_Text.CmpNoCase( pt_aux->m_Reference->m_Text ) == 0 ) if( Module->m_Reference->m_Text.CmpNoCase( pt_aux->m_Reference->
m_Text ) == 0 )
{ {
List->Append( Module->m_Reference->m_Text ); List->Append( Module->m_Reference->m_Text );
nberr++; nberr++;
@ -702,7 +723,7 @@ void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
} }
} }
/* recherche des manquants par rapport a la netliste*/ /* Search for the missing module by the net list. */
List->Append( _( "Lack:" ) ); List->Append( _( "Lack:" ) );
for( ii = 0; ii < NbModulesNetListe; ii++ ) for( ii = 0; ii < NbModulesNetListe; ii++ )
@ -724,7 +745,7 @@ void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
} }
} }
/* recherche des modules supplementaires (i.e. Non en Netliste) */ /* Search for modules not in net list. */
List->Append( _( "Not in Netlist:" ) ); List->Append( _( "Not in Netlist:" ) );
Module = (MODULE*) aPcb->m_Modules; Module = (MODULE*) aPcb->m_Modules;
@ -735,7 +756,7 @@ void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
if( Module->m_Reference->m_Text.CmpNoCase( if( Module->m_Reference->m_Text.CmpNoCase(
ModuleListFromNetlist[ii] ) == 0 ) ModuleListFromNetlist[ii] ) == 0 )
{ {
break; /* Module trouve en netliste */ break; /* Module is in net list. */
} }
} }
@ -750,17 +771,14 @@ void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
} }
/***************************************************************************************/
int BuildFootprintsListFromNetlistFile( const wxString& aNetlistFullFilename,
wxArrayString& aBufName )
/***************************************************************************************/
/** Function BuildFootprintsListFromNetlistFile /** Function BuildFootprintsListFromNetlistFile
* Fill BufName with footprints names read from the netlist. * Fill BufName with footprints names read from the netlist.
* @param aNetlistFullFilename = netlist file name * @param aNetlistFullFilename = netlist file name
* @param BufName = wxArrayString to fill with footprint names * @param BufName = wxArrayString to fill with footprint names
* @return Footprint count, or -1 if netlist file cannot opened * @return Footprint count, or -1 if netlist file cannot opened
*/ */
int BuildFootprintsListFromNetlistFile( const wxString& aNetlistFullFilename,
wxArrayString& aBufName )
{ {
int textlen; int textlen;
int nb_modules_lus; int nb_modules_lus;
@ -777,13 +795,13 @@ int BuildFootprintsListFromNetlistFile( const wxString& aNetlistFullFilename,
while( GetLine( source, Line, &LineNum ) ) while( GetLine( source, Line, &LineNum ) )
{ {
Text = StrPurge( Line ); Text = StrPurge( Line );
if( Comment ) /* Commentaires en cours */ if( Comment )
{ {
if( ( Text = strchr( Text, '}' ) ) == NULL ) if( ( Text = strchr( Text, '}' ) ) == NULL )
continue; continue;
Comment = 0; Comment = 0;
} }
if( *Text == '{' ) /* Commentaires */ if( *Text == '{' ) /* Comments. */
{ {
Comment = 1; Comment = 1;
if( ( Text = strchr( Text, '}' ) ) == NULL ) if( ( Text = strchr( Text, '}' ) ) == NULL )
@ -801,8 +819,8 @@ int BuildFootprintsListFromNetlistFile( const wxString& aNetlistFullFilename,
if( strtok( Line, " ()\t\n" ) == NULL ) if( strtok( Line, " ()\t\n" ) == NULL )
Error = 1; /* TimeStamp */ Error = 1; /* TimeStamp */
if( ( LibModName = strtok( NULL, " ()\t\n" ) ) == NULL ) if( ( LibModName = strtok( NULL, " ()\t\n" ) ) == NULL )
Error = 1; /* nom Lib */ Error = 1;
/* Lecture du nom (reference) du composant: */ /* Load the name of the component. */
if( ( Text = strtok( NULL, " ()\t\n" ) ) == NULL ) if( ( Text = strtok( NULL, " ()\t\n" ) ) == NULL )
Error = 1; Error = 1;
nb_modules_lus++; nb_modules_lus++;
@ -812,37 +830,32 @@ int BuildFootprintsListFromNetlistFile( const wxString& aNetlistFullFilename,
if( State >= 3 ) if( State >= 3 )
{ {
State--; /* Lecture 1 ligne relative au Pad */ State--;
} }
} }
fclose( source ); fclose( source );
return nb_modules_lus; return nb_modules_lus;
} }
/*****************************************************************************************/
int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
const wxString* TimeStamp, wxString& NameModule )
/*****************************************************************************************/
/* /*
* Lit le fichier .CMP donnant l'equivalence Modules / Composants * Get the file CMP giving the equivalence modules / components
* Retourne: * Returns:
* Si ce fichier existe retourne : * If this file exists returns:
* 1 et le nom module dans NameModule * 1 and the module name in NameModule
* -1 si module non trouve en fichier * -1 If not found in module file
* sinon 0; * Otherwise 0;
* *
* parametres d'appel: * Call settings:
* RefCmp (NULL si selection par TimeStamp) * RefCmp (NULL if selection by TimeStamp)
* TimeStamp (signature temporelle si elle existe, NULL sinon) * TimeStamp (time signature if it exists, NULL otherwise)
* pointeur sur le buffer recevant le nom du module * Pointer to the buffer receiving the name of the module
* *
* Exemple de fichier: * Example file:
*
* Cmp-Mod V01 Genere par PcbNew le 29/10/2003-13:11:6
* *
* Cmp-Mod V01 Genere by Pcbnew 29/10/2003-13: 11:6 *
* BeginCmp * BeginCmp
* TimeStamp = /322D3011; * TimeStamp = /322D3011;
* Reference = BUS1; * Reference = BUS1;
@ -858,6 +871,8 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
* EndCmp * EndCmp
* *
*/ */
int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
const wxString* TimeStamp, wxString& NameModule )
{ {
wxString refcurrcmp, timestamp, idmod; wxString refcurrcmp, timestamp, idmod;
char ia[1024]; char ia[1024];
@ -882,7 +897,7 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
if( strnicmp( ia, "BeginCmp", 8 ) != 0 ) if( strnicmp( ia, "BeginCmp", 8 ) != 0 )
continue; continue;
/* Ici une description de 1 composant commence */ /* Begin component description. */
refcurrcmp.Empty(); refcurrcmp.Empty();
idmod.Empty(); idmod.Empty();
timestamp.Empty(); timestamp.Empty();
@ -917,12 +932,10 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
} }
} }
/* Fin lecture 1 descr composant */ /* Check if component read is valid. */
/* Test du Composant lu en fichier: est-il le bon */
if( RefCmp ) if( RefCmp )
{ {
if( RefCmp->CmpNoCase( refcurrcmp ) == 0 ) //Found! if( RefCmp->CmpNoCase( refcurrcmp ) == 0 ) // Found!
{ {
fclose( FichCmp ); fclose( FichCmp );
NameModule = idmod; NameModule = idmod;
@ -931,7 +944,8 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
} }
else if( TimeStamp ) else if( TimeStamp )
{ {
if( TimeStamp->CmpNoCase( timestamp ) == 0 && !timestamp.IsEmpty() ) //Found if( TimeStamp->CmpNoCase( timestamp ) == 0
&& !timestamp.IsEmpty() ) // Found
{ {
fclose( FichCmp ); fclose( FichCmp );
NameModule = idmod; NameModule = idmod;
@ -945,13 +959,12 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
} }
/***********************************************************************************/ /* ??? Fontion copiant en memoire de travail les caracteristiques
void AddToList( const wxString& NameLibCmp, const wxString& CmpName, const wxString& path )
/************************************************************************************/
/* Fontion copiant en memoire de travail les caracteristiques
* des nouveaux modules * des nouveaux modules
*/ */
void AddToList( const wxString& NameLibCmp,
const wxString& CmpName,
const wxString& path )
{ {
MODULEtoLOAD* NewMod; MODULEtoLOAD* NewMod;
@ -962,15 +975,11 @@ void AddToList( const wxString& NameLibCmp, const wxString& CmpName, const wxStr
} }
/***************************************************************/ /* Load new modules from library.
void LoadListeModules( WinEDA_PcbFrame* aPcbFrame ) * If a module is being loaded it is duplicated, which avoids reading
/***************************************************************/ * unnecessary library.
/* Routine de chargement des nouveaux modules en une seule lecture des
* librairies
* Si un module vient d'etre charge il est duplique, ce qui evite une lecture
* inutile de la librairie
*/ */
void LoadListeModules( WinEDA_PcbFrame* aPcbFrame )
{ {
MODULEtoLOAD* ref, * cmp; MODULEtoLOAD* ref, * cmp;
int ii; int ii;
@ -986,8 +995,10 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame )
// Calculate the footprint "best" position: // Calculate the footprint "best" position:
if( aPcbFrame->SetBoardBoundaryBoxFromEdgesOnly() ) if( aPcbFrame->SetBoardBoundaryBoxFromEdgesOnly() )
{ {
ModuleBestPosition.x = aPcbFrame->GetBoard()->m_BoundaryBox.GetRight() + 5000; ModuleBestPosition.x =
ModuleBestPosition.y = aPcbFrame->GetBoard()->m_BoundaryBox.GetBottom() + 10000; aPcbFrame->GetBoard()->m_BoundaryBox.GetRight() + 5000;
ModuleBestPosition.y =
aPcbFrame->GetBoard()->m_BoundaryBox.GetBottom() + 10000;
} }
else else
ModuleBestPosition = wxPoint( 0, 0 ); ModuleBestPosition = wxPoint( 0, 0 );
@ -997,7 +1008,9 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame )
if( (ii == 0) || ( ref->m_LibName != cmp->m_LibName) ) if( (ii == 0) || ( ref->m_LibName != cmp->m_LibName) )
{ {
/* New footprint : must be loaded from a library */ /* New footprint : must be loaded from a library */
Module = aPcbFrame->Get_Librairie_Module( wxEmptyString, cmp->m_LibName, FALSE ); Module = aPcbFrame->Get_Librairie_Module( wxEmptyString,
cmp->m_LibName,
FALSE );
ref = cmp; ref = cmp;
if( Module == NULL ) if( Module == NULL )
{ {
@ -1010,17 +1023,19 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame )
} }
Module->SetPosition( ModuleBestPosition ); Module->SetPosition( ModuleBestPosition );
/* Update schematic links : reference "Time Stamp" and schematic hierarchical path */ /* Update schematic links : reference "Time Stamp" and schematic
*hierarchical path */
Module->m_Reference->m_Text = cmp->m_CmpName; Module->m_Reference->m_Text = cmp->m_CmpName;
Module->m_TimeStamp = GetTimeStamp(); Module->m_TimeStamp = GetTimeStamp();
Module->m_Path = cmp->m_TimeStampPath; Module->m_Path = cmp->m_TimeStampPath;
} }
else else
{ {
/* Footprint already loaded from a library, duplicate it (faster) */ /* Footprint already loaded from a library, duplicate it (faster)
*/
MODULE* newmodule; MODULE* newmodule;
if( Module == NULL ) if( Module == NULL )
continue; /* module non existant en libr */ continue; /* Module does not exist in library. */
newmodule = new MODULE( aPcbFrame->GetBoard() ); newmodule = new MODULE( aPcbFrame->GetBoard() );
newmodule->Copy( Module ); newmodule->Copy( Module );
@ -1036,8 +1051,7 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame )
} }
/* Routine utilisee par qsort pour le tri des modules a charger /* Routines used by qsort to sort a load module. */
*/
static int SortByLibName( MODULEtoLOAD** ref, MODULEtoLOAD** cmp ) static int SortByLibName( MODULEtoLOAD** ref, MODULEtoLOAD** cmp )
{ {
int ii = (*ref)->m_LibName.CmpNoCase( (*cmp)->m_LibName ); int ii = (*ref)->m_LibName.CmpNoCase( (*cmp)->m_LibName );
@ -1046,12 +1060,9 @@ static int SortByLibName( MODULEtoLOAD** ref, MODULEtoLOAD** cmp )
} }
/*************************************************/ /* Sort the module list in alphabetical order by module name.
void SortListModulesToLoadByLibname( int NbModules )
/**************************************************/
/* Rearrage la liste des modules List par ordre alphabetique des noms lib des modules
*/ */
void SortListModulesToLoadByLibname( int NbModules )
{ {
MODULEtoLOAD** base_list, * item; MODULEtoLOAD** base_list, * item;
int ii; int ii;
@ -1065,17 +1076,16 @@ void SortListModulesToLoadByLibname( int NbModules )
} }
qsort( base_list, NbModules, sizeof(MODULEtoLOAD*), qsort( base_list, NbModules, sizeof(MODULEtoLOAD*),
( int( * ) ( const void*, const void* ) )SortByLibName ); ( int ( * )( const void*, const void* ) )SortByLibName );
// Reconstruction du chainage:
s_ModuleToLoad_List = *base_list; s_ModuleToLoad_List = *base_list;
for( ii = 0; ii < NbModules - 1; ii++ ) for( ii = 0; ii < NbModules - 1; ii++ )
{ {
item = base_list[ii]; item = base_list[ii];
item->SetNext( base_list[ii + 1] ); item->SetNext( base_list[ii + 1] );
} }
// Dernier item: Pnext = NULL:
item = base_list[ii]; item = base_list[ii];
item->SetNext( NULL ); item->SetNext( NULL );

View File

@ -1,6 +1,6 @@
/****************************************************************/ /******************************************/
/* pcbframe.cpp - fonctions des classes du type WinEDA_PcbFrame */ /* pcbframe.cpp - PCB editor main window. */
/****************************************************************/ /******************************************/
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
@ -25,191 +25,188 @@
#define SHOW_MICROWAVE_TOOLS wxT( "ShowMicrowaveTools" ) #define SHOW_MICROWAVE_TOOLS wxT( "ShowMicrowaveTools" )
/*******************************/
/* class WinEDA_PcbFrame */
/*******************************/
BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame ) BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV, WinEDA_PcbFrame::OnSockRequestServer ) EVT_SOCKET( ID_EDA_SOCKET_EVENT_SERV, WinEDA_PcbFrame::OnSockRequestServer )
EVT_SOCKET( ID_EDA_SOCKET_EVENT, WinEDA_PcbFrame::OnSockRequest ) EVT_SOCKET( ID_EDA_SOCKET_EVENT, WinEDA_PcbFrame::OnSockRequest )
EVT_KICAD_CHOICEBOX( ID_ON_ZOOM_SELECT, WinEDA_PcbFrame::OnSelectZoom ) EVT_KICAD_CHOICEBOX( ID_ON_ZOOM_SELECT, WinEDA_PcbFrame::OnSelectZoom )
EVT_KICAD_CHOICEBOX( ID_ON_GRID_SELECT, WinEDA_PcbFrame::OnSelectGrid ) EVT_KICAD_CHOICEBOX( ID_ON_GRID_SELECT, WinEDA_PcbFrame::OnSelectGrid )
EVT_CLOSE( WinEDA_PcbFrame::OnCloseWindow ) EVT_CLOSE( WinEDA_PcbFrame::OnCloseWindow )
EVT_SIZE( WinEDA_PcbFrame::OnSize ) EVT_SIZE( WinEDA_PcbFrame::OnSize )
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_PcbFrame::OnZoom ) EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA_PcbFrame::OnZoom )
EVT_TOOL( ID_LOAD_FILE, WinEDA_PcbFrame::Files_io ) EVT_TOOL( ID_LOAD_FILE, WinEDA_PcbFrame::Files_io )
EVT_TOOL( ID_MENU_READ_LAST_SAVED_VERSION_BOARD, WinEDA_PcbFrame::Files_io ) EVT_TOOL( ID_MENU_READ_LAST_SAVED_VERSION_BOARD, WinEDA_PcbFrame::Files_io )
EVT_TOOL( ID_MENU_RECOVER_BOARD, WinEDA_PcbFrame::Files_io ) EVT_TOOL( ID_MENU_RECOVER_BOARD, WinEDA_PcbFrame::Files_io )
EVT_TOOL( ID_NEW_BOARD, WinEDA_PcbFrame::Files_io ) EVT_TOOL( ID_NEW_BOARD, WinEDA_PcbFrame::Files_io )
EVT_TOOL( ID_SAVE_BOARD, WinEDA_PcbFrame::Files_io ) EVT_TOOL( ID_SAVE_BOARD, WinEDA_PcbFrame::Files_io )
EVT_TOOL( ID_OPEN_MODULE_EDITOR, WinEDA_PcbFrame::Process_Special_Functions ) EVT_TOOL( ID_OPEN_MODULE_EDITOR,
WinEDA_PcbFrame::Process_Special_Functions )
// Menu Files: // Menu Files:
EVT_MENU( ID_MAIN_MENUBAR, WinEDA_PcbFrame::Process_Special_Functions ) EVT_MENU( ID_MAIN_MENUBAR, WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU( ID_LOAD_FILE, WinEDA_PcbFrame::Files_io ) EVT_MENU( ID_LOAD_FILE, WinEDA_PcbFrame::Files_io )
EVT_MENU( ID_NEW_BOARD, WinEDA_PcbFrame::Files_io ) EVT_MENU( ID_NEW_BOARD, WinEDA_PcbFrame::Files_io )
EVT_MENU( ID_SAVE_BOARD, WinEDA_PcbFrame::Files_io ) EVT_MENU( ID_SAVE_BOARD, WinEDA_PcbFrame::Files_io )
EVT_MENU( ID_APPEND_FILE, WinEDA_PcbFrame::Files_io ) EVT_MENU( ID_APPEND_FILE, WinEDA_PcbFrame::Files_io )
EVT_MENU( ID_SAVE_BOARD_AS, WinEDA_PcbFrame::Files_io ) EVT_MENU( ID_SAVE_BOARD_AS, WinEDA_PcbFrame::Files_io )
EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, WinEDA_PcbFrame::OnFileHistory ) EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, WinEDA_PcbFrame::OnFileHistory )
EVT_MENU( ID_GEN_PLOT, WinEDA_PcbFrame::ToPlotter ) EVT_MENU( ID_GEN_PLOT, WinEDA_PcbFrame::ToPlotter )
EVT_MENU( ID_GEN_EXPORT_SPECCTRA, WinEDA_PcbFrame::ExportToSpecctra ) EVT_MENU( ID_GEN_EXPORT_SPECCTRA, WinEDA_PcbFrame::ExportToSpecctra )
EVT_MENU( ID_GEN_EXPORT_FILE_GENCADFORMAT, WinEDA_PcbFrame::ExportToGenCAD ) EVT_MENU( ID_GEN_EXPORT_FILE_GENCADFORMAT, WinEDA_PcbFrame::ExportToGenCAD )
EVT_MENU( ID_GEN_EXPORT_FILE_MODULE_REPORT, EVT_MENU( ID_GEN_EXPORT_FILE_MODULE_REPORT,
WinEDA_PcbFrame::GenModuleReport ) WinEDA_PcbFrame::GenModuleReport )
EVT_MENU( ID_GEN_IMPORT_SPECCTRA_SESSION, EVT_MENU( ID_GEN_IMPORT_SPECCTRA_SESSION,
WinEDA_PcbFrame::ImportSpecctraSession ) WinEDA_PcbFrame::ImportSpecctraSession )
EVT_MENU( ID_GEN_IMPORT_SPECCTRA_DESIGN, EVT_MENU( ID_GEN_IMPORT_SPECCTRA_DESIGN,
WinEDA_PcbFrame::ImportSpecctraDesign ) WinEDA_PcbFrame::ImportSpecctraDesign )
EVT_MENU( ID_MENU_ARCHIVE_NEW_MODULES, EVT_MENU( ID_MENU_ARCHIVE_NEW_MODULES,
WinEDA_PcbFrame::Process_Special_Functions ) WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU( ID_MENU_ARCHIVE_ALL_MODULES, EVT_MENU( ID_MENU_ARCHIVE_ALL_MODULES,
WinEDA_PcbFrame::Process_Special_Functions ) WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU( ID_EXIT, WinEDA_PcbFrame::Process_Special_Functions ) EVT_MENU( ID_EXIT, WinEDA_PcbFrame::Process_Special_Functions )
// menu Config // menu Config
EVT_MENU_RANGE( ID_CONFIG_AND_PREFERENCES_START, EVT_MENU_RANGE( ID_CONFIG_AND_PREFERENCES_START,
ID_CONFIG_AND_PREFERENCES_END, ID_CONFIG_AND_PREFERENCES_END,
WinEDA_PcbFrame::Process_Config ) WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_COLORS_SETUP, WinEDA_PcbFrame::Process_Config ) EVT_MENU( ID_COLORS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_OPTIONS_SETUP, WinEDA_PcbFrame::Process_Config ) EVT_MENU( ID_OPTIONS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_LAYERS_SETUP, WinEDA_PcbFrame::Process_Config ) EVT_MENU( ID_PCB_LAYERS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_MASK_CLEARANCE, WinEDA_PcbFrame::Process_Config ) EVT_MENU( ID_PCB_MASK_CLEARANCE, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, WinEDA_PcbFrame::Process_Config ) EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_PAD_SETUP, WinEDA_PcbFrame::Process_Config ) EVT_MENU( ID_PCB_PAD_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_CONFIG_SAVE, WinEDA_PcbFrame::Process_Config ) EVT_MENU( ID_CONFIG_SAVE, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_CONFIG_READ, WinEDA_PcbFrame::Process_Config ) EVT_MENU( ID_CONFIG_READ, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_DISPLAY_OPTIONS_SETUP, WinEDA_PcbFrame::InstallDisplayOptionsDialog ) EVT_MENU( ID_PCB_DISPLAY_OPTIONS_SETUP,
WinEDA_PcbFrame::InstallDisplayOptionsDialog )
EVT_MENU( ID_PCB_USER_GRID_SETUP,
EVT_MENU( ID_PCB_USER_GRID_SETUP,
WinEDA_PcbFrame::Process_Special_Functions ) WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END,
WinEDA_DrawFrame::SetLanguage ) WinEDA_DrawFrame::SetLanguage )
// menu Postprocess // menu Postprocess
EVT_MENU( ID_PCB_GEN_POS_MODULES_FILE, WinEDA_PcbFrame::GenModulesPosition ) EVT_MENU( ID_PCB_GEN_POS_MODULES_FILE, WinEDA_PcbFrame::GenModulesPosition )
EVT_MENU( ID_PCB_GEN_DRILL_FILE, WinEDA_PcbFrame::InstallDrillFrame ) EVT_MENU( ID_PCB_GEN_DRILL_FILE, WinEDA_PcbFrame::InstallDrillFrame )
EVT_MENU( ID_PCB_GEN_CMP_FILE, WinEDA_PcbFrame::RecreateCmpFileFromBoard ) EVT_MENU( ID_PCB_GEN_CMP_FILE, WinEDA_PcbFrame::RecreateCmpFileFromBoard )
EVT_MENU( ID_PCB_GEN_BOM_FILE_FROM_BOARD, WinEDA_PcbFrame::RecreateBOMFileFromBoard ) EVT_MENU( ID_PCB_GEN_BOM_FILE_FROM_BOARD,
WinEDA_PcbFrame::RecreateBOMFileFromBoard )
// menu Miscellaneous // menu Miscellaneous
EVT_MENU( ID_MENU_LIST_NETS, WinEDA_PcbFrame::ListNetsAndSelect ) EVT_MENU( ID_MENU_LIST_NETS, WinEDA_PcbFrame::ListNetsAndSelect )
EVT_MENU( ID_PCB_GLOBAL_DELETE, WinEDA_PcbFrame::Process_Special_Functions ) EVT_MENU( ID_PCB_GLOBAL_DELETE, WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU( ID_MENU_PCB_CLEAN, WinEDA_PcbFrame::Process_Special_Functions ) EVT_MENU( ID_MENU_PCB_CLEAN, WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU( ID_MENU_PCB_SWAP_LAYERS, EVT_MENU( ID_MENU_PCB_SWAP_LAYERS,
WinEDA_PcbFrame::Process_Special_Functions ) WinEDA_PcbFrame::Process_Special_Functions )
// Menu Help // Menu Help
EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp ) EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp )
EVT_MENU( ID_KICAD_ABOUT, WinEDA_BasicFrame::GetKicadAbout ) EVT_MENU( ID_KICAD_ABOUT, WinEDA_BasicFrame::GetKicadAbout )
// Menu 3D Frame // Menu 3D Frame
EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, WinEDA_PcbFrame::Show3D_Frame ) EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, WinEDA_PcbFrame::Show3D_Frame )
// Menu Get Design Rules Editor // Menu Get Design Rules Editor
EVT_MENU( ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG, WinEDA_PcbFrame::ShowDesignRulesEditor ) EVT_MENU( ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG,
WinEDA_PcbFrame::ShowDesignRulesEditor )
// Horizontal toolbar // Horizontal toolbar
EVT_TOOL( ID_TO_LIBRARY, WinEDA_PcbFrame::Process_Special_Functions ) EVT_TOOL( ID_TO_LIBRARY, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_SHEET_SET, WinEDA_DrawFrame::Process_PageSettings ) EVT_TOOL( ID_SHEET_SET, WinEDA_DrawFrame::Process_PageSettings )
EVT_TOOL( wxID_CUT, WinEDA_PcbFrame::Process_Special_Functions ) EVT_TOOL( wxID_CUT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( wxID_COPY, WinEDA_PcbFrame::Process_Special_Functions ) EVT_TOOL( wxID_COPY, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( wxID_PASTE, WinEDA_PcbFrame::Process_Special_Functions ) EVT_TOOL( wxID_PASTE, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_UNDO_BUTT, WinEDA_PcbFrame::GetBoardFromUndoList ) EVT_TOOL( ID_UNDO_BUTT, WinEDA_PcbFrame::GetBoardFromUndoList )
EVT_TOOL( ID_REDO_BUTT, WinEDA_PcbFrame::GetBoardFromRedoList ) EVT_TOOL( ID_REDO_BUTT, WinEDA_PcbFrame::GetBoardFromRedoList )
EVT_TOOL( ID_GEN_PRINT, WinEDA_DrawFrame::ToPrinter ) EVT_TOOL( ID_GEN_PRINT, WinEDA_DrawFrame::ToPrinter )
EVT_TOOL( ID_GEN_PLOT_SVG, WinEDA_DrawFrame::SVG_Print ) EVT_TOOL( ID_GEN_PLOT_SVG, WinEDA_DrawFrame::SVG_Print )
EVT_TOOL( ID_GEN_PLOT, WinEDA_PcbFrame::Process_Special_Functions ) EVT_TOOL( ID_GEN_PLOT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_FIND_ITEMS, WinEDA_PcbFrame::Process_Special_Functions ) EVT_TOOL( ID_FIND_ITEMS, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_GET_NETLIST, WinEDA_PcbFrame::Process_Special_Functions ) EVT_TOOL( ID_GET_NETLIST, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_DRC_CONTROL, WinEDA_PcbFrame::Process_Special_Functions ) EVT_TOOL( ID_DRC_CONTROL, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, EVT_TOOL( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR,
WinEDA_PcbFrame::Process_Special_Functions ) WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH, EVT_TOOL( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
WinEDA_PcbFrame::Tracks_and_Vias_Size_Event ) WinEDA_PcbFrame::Tracks_and_Vias_Size_Event )
EVT_KICAD_CHOICEBOX( ID_TOOLBARH_PCB_SELECT_LAYER, EVT_KICAD_CHOICEBOX( ID_TOOLBARH_PCB_SELECT_LAYER,
WinEDA_PcbFrame::Process_Special_Functions ) WinEDA_PcbFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, EVT_KICAD_CHOICEBOX( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
WinEDA_PcbFrame::Tracks_and_Vias_Size_Event ) WinEDA_PcbFrame::Tracks_and_Vias_Size_Event )
EVT_KICAD_CHOICEBOX( ID_AUX_TOOLBAR_PCB_VIA_SIZE, EVT_KICAD_CHOICEBOX( ID_AUX_TOOLBAR_PCB_VIA_SIZE,
WinEDA_PcbFrame::Tracks_and_Vias_Size_Event ) WinEDA_PcbFrame::Tracks_and_Vias_Size_Event )
EVT_TOOL( ID_TOOLBARH_PCB_AUTOPLACE, WinEDA_PcbFrame::AutoPlace ) EVT_TOOL( ID_TOOLBARH_PCB_AUTOPLACE, WinEDA_PcbFrame::AutoPlace )
EVT_TOOL( ID_TOOLBARH_PCB_AUTOROUTE, WinEDA_PcbFrame::AutoPlace ) EVT_TOOL( ID_TOOLBARH_PCB_AUTOROUTE, WinEDA_PcbFrame::AutoPlace )
EVT_TOOL( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, EVT_TOOL( ID_TOOLBARH_PCB_FREEROUTE_ACCESS,
WinEDA_PcbFrame::Access_to_External_Tool ) WinEDA_PcbFrame::Access_to_External_Tool )
// Option toolbar // Option toolbar
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END, EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
WinEDA_PcbFrame::OnSelectOptionToolbar ) WinEDA_PcbFrame::OnSelectOptionToolbar )
// Vertical toolbar: // Vertical toolbar:
EVT_TOOL( ID_NO_SELECT_BUTT, WinEDA_PcbFrame::Process_Special_Functions ) EVT_TOOL( ID_NO_SELECT_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_HIGHLIGHT_BUTT, WinEDA_PcbFrame::Process_Special_Functions ) EVT_TOOL( ID_PCB_HIGHLIGHT_BUTT,
EVT_TOOL( ID_COMPONENT_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_TRACK_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ZONES_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_MIRE_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ARC_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_CIRCLE_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ADD_TEXT_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ADD_LINE_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_COTATION_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_DELETE_ITEM_BUTT,
WinEDA_PcbFrame::Process_Special_Functions ) WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_SHOW_1_RATSNEST_BUTT, EVT_TOOL( ID_COMPONENT_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_TRACK_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ZONES_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_MIRE_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ARC_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_CIRCLE_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ADD_TEXT_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_ADD_LINE_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_COTATION_BUTT, WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_DELETE_ITEM_BUTT,
WinEDA_PcbFrame::Process_Special_Functions ) WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_PLACE_OFFSET_COORD_BUTT, EVT_TOOL( ID_PCB_SHOW_1_RATSNEST_BUTT,
WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL( ID_PCB_PLACE_OFFSET_COORD_BUTT,
WinEDA_PcbFrame::Process_Special_Functions ) WinEDA_PcbFrame::Process_Special_Functions )
EVT_TOOL_RANGE( ID_PCB_MUWAVE_START_CMD, ID_PCB_MUWAVE_END_CMD, EVT_TOOL_RANGE( ID_PCB_MUWAVE_START_CMD, ID_PCB_MUWAVE_END_CMD,
WinEDA_PcbFrame::ProcessMuWaveFunctions ) WinEDA_PcbFrame::ProcessMuWaveFunctions )
EVT_TOOL_RCLICKED( ID_TRACK_BUTT, WinEDA_PcbFrame::ToolOnRightClick ) EVT_TOOL_RCLICKED( ID_TRACK_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_CIRCLE_BUTT, WinEDA_PcbFrame::ToolOnRightClick ) EVT_TOOL_RCLICKED( ID_PCB_CIRCLE_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_ARC_BUTT, WinEDA_PcbFrame::ToolOnRightClick ) EVT_TOOL_RCLICKED( ID_PCB_ARC_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_ADD_TEXT_BUTT, WinEDA_PcbFrame::ToolOnRightClick ) EVT_TOOL_RCLICKED( ID_PCB_ADD_TEXT_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_ADD_LINE_BUTT, WinEDA_PcbFrame::ToolOnRightClick ) EVT_TOOL_RCLICKED( ID_PCB_ADD_LINE_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_TOOL_RCLICKED( ID_PCB_COTATION_BUTT, WinEDA_PcbFrame::ToolOnRightClick ) EVT_TOOL_RCLICKED( ID_PCB_COTATION_BUTT, WinEDA_PcbFrame::ToolOnRightClick )
EVT_MENU_RANGE( ID_POPUP_PCB_AUTOPLACE_START_RANGE, EVT_MENU_RANGE( ID_POPUP_PCB_AUTOPLACE_START_RANGE,
ID_POPUP_PCB_AUTOPLACE_END_RANGE, ID_POPUP_PCB_AUTOPLACE_END_RANGE,
WinEDA_PcbFrame::AutoPlace ) WinEDA_PcbFrame::AutoPlace )
EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE, EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE,
WinEDA_PcbFrame::Process_Special_Functions ) WinEDA_PcbFrame::Process_Special_Functions )
// Tracks and vias sizes general options // Tracks and vias sizes general options
EVT_MENU_RANGE( ID_POPUP_PCB_SELECT_WIDTH_START_RANGE, ID_POPUP_PCB_SELECT_WIDTH_END_RANGE, EVT_MENU_RANGE( ID_POPUP_PCB_SELECT_WIDTH_START_RANGE,
ID_POPUP_PCB_SELECT_WIDTH_END_RANGE,
WinEDA_PcbFrame::Tracks_and_Vias_Size_Event ) WinEDA_PcbFrame::Tracks_and_Vias_Size_Event )
// popup menus // popup menus
EVT_MENU( ID_POPUP_PCB_DELETE_TRACKSEG, WinEDA_PcbFrame::Process_Special_Functions ) EVT_MENU( ID_POPUP_PCB_DELETE_TRACKSEG,
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE, WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
WinEDA_PcbFrame::Process_Special_Functions ) WinEDA_PcbFrame::Process_Special_Functions )
// PopUp Menus pour Zooms traites dans drawpanel.cpp
END_EVENT_TABLE() END_EVENT_TABLE()
///////****************************///////////: ///////****************************///////////:
/****************/
/* Constructeur */
/****************/
WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
const wxString& title, const wxString& title,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
@ -261,50 +258,49 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
ReCreateAuxVToolbar(); ReCreateAuxVToolbar();
#if defined(KICAD_AUIMANAGER) #if defined(KICAD_AUIMANAGER)
m_auimgr.SetManagedWindow(this); m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz; wxAuiPaneInfo horiz;
horiz.Gripper(false); horiz.Gripper( false );
horiz.DockFixed(true); horiz.DockFixed( true );
horiz.Movable(false); horiz.Movable( false );
horiz.Floatable(false); horiz.Floatable( false );
horiz.CloseButton(false); horiz.CloseButton( false );
horiz.CaptionVisible(false); horiz.CaptionVisible( false );
wxAuiPaneInfo vert(horiz); wxAuiPaneInfo vert( horiz );
vert.TopDockable(false).BottomDockable(false); vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable(false).RightDockable(false); horiz.LeftDockable( false ).RightDockable( false );
m_auimgr.AddPane(m_HToolBar, m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo(horiz).Name(wxT("m_HToolBar")).Top().Row(0)); wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().
Row( 0 ) );
m_auimgr.AddPane(m_AuxiliaryToolBar, m_auimgr.AddPane( m_AuxiliaryToolBar,
wxAuiPaneInfo(horiz).Name(wxT("m_AuxiliaryToolBar")).Top().Row(1)); wxAuiPaneInfo( horiz ).Name( wxT( "m_AuxiliaryToolBar" ) ).Top().Row( 1 ) );
m_auimgr.AddPane(m_AuxVToolBar, m_auimgr.AddPane( m_AuxVToolBar,
wxAuiPaneInfo(vert).Name(wxT("m_AuxVToolBar")).Right().Row(1).Hide()); wxAuiPaneInfo( vert ).Name( wxT( "m_AuxVToolBar" ) ).Right().Row( 1 ).Hide() );
m_auimgr.AddPane(m_VToolBar, m_auimgr.AddPane( m_VToolBar,
wxAuiPaneInfo(vert).Name(wxT("m_VToolBar")).Right()); wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );
m_auimgr.AddPane(m_OptionsToolBar, m_auimgr.AddPane( m_OptionsToolBar,
wxAuiPaneInfo(vert).Name(wxT("m_OptionsToolBar")).Left()); wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left() );
m_auimgr.AddPane(DrawPanel, m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name(wxT("DrawFrame")).CentrePane()); wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
m_auimgr.AddPane(MsgPanel, m_auimgr.AddPane( MsgPanel,
wxAuiPaneInfo(horiz).Name(wxT("MsgPanel")).Bottom()); wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
m_auimgr.Update(); m_auimgr.Update();
#endif #endif
} }
/************************************/
WinEDA_PcbFrame::~WinEDA_PcbFrame() WinEDA_PcbFrame::~WinEDA_PcbFrame()
/************************************/
{ {
extern PARAM_CFG_BASE* ParamCfgList[]; extern PARAM_CFG_BASE* ParamCfgList[];
@ -313,9 +309,7 @@ WinEDA_PcbFrame::~WinEDA_PcbFrame()
} }
/********************************************************/
void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event ) void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event )
/********************************************************/
{ {
DrawPanel->m_AbortRequest = true; DrawPanel->m_AbortRequest = true;
@ -347,7 +341,8 @@ void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event )
SaveSettings(); SaveSettings();
// do not show the window because ScreenPcb will be deleted and we do not want any paint event // do not show the window because ScreenPcb will be deleted and we do not
// want any paint event
Show( false ); Show( false );
ActiveScreen = ScreenPcb; ActiveScreen = ScreenPcb;
Destroy(); Destroy();

View File

@ -1,8 +1,6 @@
/***********************************/ /****************************************/
/** pcbcfg() : configuration **/ /** pcbnew_config.cpp : configuration **/
/***********************************/ /****************************************/
/* lit ou met a jour la configuration de PCBNEW */
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
@ -24,12 +22,10 @@
#include "dialog_general_options.h" #include "dialog_general_options.h"
#define HOTKEY_FILENAME wxT( "pcbnew" ) #define HOTKEY_FILENAME wxT( "pcbnew" )
/***********************************************************/
void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event ) void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event )
/***********************************************************/
{ {
int id = event.GetId(); int id = event.GetId();
wxPoint pos; wxPoint pos;
@ -54,7 +50,7 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event )
DisplayDialogLayerSetup( this ); DisplayDialogLayerSetup( this );
break; break;
case ID_CONFIG_REQ: // Creation de la fenetre de configuration case ID_CONFIG_REQ:
InstallConfigFrame( pos ); InstallConfigFrame( pos );
break; break;
@ -147,13 +143,10 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event )
} }
/***************************************************************/
bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose )
/***************************************************************/
/* /*
* Read the hotkey files config for pcbnew and module_edit * Read the hotkey files config for pcbnew and module_edit
*/ */
bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose )
{ {
wxString FullFileName = ReturnHotkeyConfigFilePath( wxString FullFileName = ReturnHotkeyConfigFilePath(
g_ConfigFileLocationChoice ); g_ConfigFileLocationChoice );
@ -183,7 +176,7 @@ bool WinEDA_PcbFrame::Read_Config( const wxString& projectFileName )
wxGetApp().RemoveLibraryPath( g_UserLibDirBuffer ); wxGetApp().RemoveLibraryPath( g_UserLibDirBuffer );
/* Init des valeurs par defaut */ /* Initialize default values. */
g_LibName_List.Clear(); g_LibName_List.Clear();
wxGetApp().ReadProjectConfig( fn.GetFullPath(), wxGetApp().ReadProjectConfig( fn.GetFullPath(),
@ -217,10 +210,7 @@ bool WinEDA_PcbFrame::Read_Config( const wxString& projectFileName )
} }
/**********************************************************/
void WinEDA_PcbFrame::Update_config( wxWindow* displayframe ) void WinEDA_PcbFrame::Update_config( wxWindow* displayframe )
/***********************************************************/
/* enregistrement de la config */
{ {
wxFileName fn; wxFileName fn;
@ -234,7 +224,6 @@ void WinEDA_PcbFrame::Update_config( wxWindow* displayframe )
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;
/* ecriture de la configuration */
wxGetApp().WriteProjectConfig( fn.GetFullPath(), wxT( "/pcbnew" ), wxGetApp().WriteProjectConfig( fn.GetFullPath(), wxT( "/pcbnew" ),
ParamCfgList ); ParamCfgList );
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
/***********************/ /***************/
/* fichier pcbplot.cpp */ /* pcbplot.cpp */
/***********************/ /***************/
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
@ -25,7 +25,7 @@
#define OPTKEY_ALWAYS_PRINT_PADS wxT( "PlotAlwaysPads" ) #define OPTKEY_ALWAYS_PRINT_PADS wxT( "PlotAlwaysPads" )
#define OPTKEY_OUTPUT_FORMAT wxT( "PlotOutputFormat" ) #define OPTKEY_OUTPUT_FORMAT wxT( "PlotOutputFormat" )
// Define min et max reasonnable values for print scale // Define min and max reasonable values for print scale
#define MIN_SCALE 0.01 #define MIN_SCALE 0.01
#define MAX_SCALE 100.0 #define MAX_SCALE 100.0
@ -231,25 +231,24 @@ void WinEDA_PlotFrame::OnInitDialog( wxInitDialogEvent& event )
if( config ) if( config )
{ {
config->Read( OPTKEY_OUTPUT_FORMAT, &g_pcb_plot_options.PlotFormat ); config->Read( OPTKEY_OUTPUT_FORMAT, &g_pcb_plot_options.PlotFormat );
config->Read( OPTKEY_PLOT_LINEWIDTH_VALUE, &g_pcb_plot_options.PlotLine_Width ); config->Read( OPTKEY_PLOT_LINEWIDTH_VALUE,
&g_pcb_plot_options.PlotLine_Width );
} }
m_PlotFormatOpt->SetSelection( g_pcb_plot_options.PlotFormat ); m_PlotFormatOpt->SetSelection( g_pcb_plot_options.PlotFormat );
// Creation des menus d'option du format HPGL
m_HPGL_OptionsBox = new wxStaticBox( this, wxID_ANY, _( "HPGL Options:" ) ); m_HPGL_OptionsBox = new wxStaticBox( this, wxID_ANY, _( "HPGL Options:" ) );
wxStaticBoxSizer* HPGL_OptionsBoxSizer = wxStaticBoxSizer* HPGL_OptionsBoxSizer =
new wxStaticBoxSizer( m_HPGL_OptionsBox, wxVERTICAL ); new wxStaticBoxSizer( m_HPGL_OptionsBox, wxVERTICAL );
MidRightBoxSizer->Add( HPGL_OptionsBoxSizer, 0, wxGROW | wxALL, 5 ); MidRightBoxSizer->Add( HPGL_OptionsBoxSizer, 0, wxGROW | wxALL, 5 );
m_HPGLPenSizeOpt = new WinEDA_ValueCtrl( this, _( "Pen Size" ), m_HPGLPenSizeOpt = new WinEDA_ValueCtrl( this, _( "Pen size" ),
g_pcb_plot_options.HPGL_Pen_Diam, g_pcb_plot_options.HPGL_Pen_Diam,
g_UnitMetric, g_UnitMetric,
HPGL_OptionsBoxSizer, HPGL_OptionsBoxSizer,
UNITS_MILS ); UNITS_MILS );
// unites standards = cm pour vitesse plume en HPGL // Set units to cm for standard HPGL pen speed.
m_HPGLPenSpeedOpt = new WinEDA_ValueCtrl( this, _( "Pen Speed (cm/s)" ), m_HPGLPenSpeedOpt = new WinEDA_ValueCtrl( this, _( "Pen Speed (cm/s)" ),
g_pcb_plot_options.HPGL_Pen_Speed, CENTIMETRE, g_pcb_plot_options.HPGL_Pen_Speed, CENTIMETRE,
HPGL_OptionsBoxSizer, 1 ); HPGL_OptionsBoxSizer, 1 );
@ -264,7 +263,7 @@ void WinEDA_PlotFrame::OnInitDialog( wxInitDialogEvent& event )
m_HPGLPenOverlayOpt->SetToolTip( _( "Set plot overlay for filling" ) ); m_HPGLPenOverlayOpt->SetToolTip( _( "Set plot overlay for filling" ) );
m_LinesWidth = new WinEDA_ValueCtrl( this, _( "Lines Width" ), m_LinesWidth = new WinEDA_ValueCtrl( this, _( "Line width" ),
g_pcb_plot_options.PlotLine_Width, g_pcb_plot_options.PlotLine_Width,
g_UnitMetric, g_UnitMetric,
MidRightBoxSizer, MidRightBoxSizer,
@ -300,7 +299,7 @@ mode and plot pads outlines on silk screen layers" ) );
config->Read( OPTKEY_YFINESCALE_ADJ, &m_YScaleAdjust ); config->Read( OPTKEY_YFINESCALE_ADJ, &m_YScaleAdjust );
} }
// Test for a reasonnable scale value. Set to 1 if problem // Test for a reasonable scale value. Set to 1 if problem
if( m_XScaleAdjust < MIN_SCALE || m_YScaleAdjust < MIN_SCALE if( m_XScaleAdjust < MIN_SCALE || m_YScaleAdjust < MIN_SCALE
|| m_XScaleAdjust > MAX_SCALE || m_YScaleAdjust > MAX_SCALE ) || m_XScaleAdjust > MAX_SCALE || m_YScaleAdjust > MAX_SCALE )
m_XScaleAdjust = m_YScaleAdjust = 1.0; m_XScaleAdjust = m_YScaleAdjust = 1.0;
@ -338,7 +337,7 @@ scale plotting" ) );
button = new wxButton( this, wxID_CANCEL, _( "Close" ) ); button = new wxButton( this, wxID_CANCEL, _( "Close" ) );
RightBoxSizer->Add( button, 0, wxGROW | wxALL, 5 ); RightBoxSizer->Add( button, 0, wxGROW | wxALL, 5 );
// Creation de la liste des layers // Create layer list.
wxBoxSizer* OneColumnLayerBoxSizer = new wxBoxSizer( wxVERTICAL ); wxBoxSizer* OneColumnLayerBoxSizer = new wxBoxSizer( wxVERTICAL );
LayersBoxSizer->Add( OneColumnLayerBoxSizer, 0, wxGROW | wxALL, 5 ); LayersBoxSizer->Add( OneColumnLayerBoxSizer, 0, wxGROW | wxALL, 5 );
@ -381,18 +380,18 @@ scale plotting" ) );
m_Exclude_Edges_Pcb = new wxCheckBox( this, m_Exclude_Edges_Pcb = new wxCheckBox( this,
ID_EXCLUDE_EDGES_PCB, ID_EXCLUDE_EDGES_PCB,
_( "Exclude Edges_Pcb layer" ) ); _( "Exclude pcb edge layer" ) );
m_Exclude_Edges_Pcb->SetValue( g_pcb_plot_options.Exclude_Edges_Pcb ); m_Exclude_Edges_Pcb->SetValue( g_pcb_plot_options.Exclude_Edges_Pcb );
m_Exclude_Edges_Pcb->SetToolTip( m_Exclude_Edges_Pcb->SetToolTip(
_( "Exclude contents of Edges_Pcb layer from all other layers" ) ); _( "Exclude contents of the pcb edge layer from all other layers" ) );
LeftBoxSizer->Add( m_Exclude_Edges_Pcb, 0, wxGROW | wxALL, 1 ); LeftBoxSizer->Add( m_Exclude_Edges_Pcb, 0, wxGROW | wxALL, 1 );
// Option to plot page references: // Option to plot page references:
if( m_Parent->m_Print_Sheet_Ref ) if( m_Parent->m_Print_Sheet_Ref )
{ {
m_Plot_Sheet_Ref = new wxCheckBox( this, ID_PRINT_REF, m_Plot_Sheet_Ref = new wxCheckBox( this, ID_PRINT_REF,
_( "Print sheet ref" ) ); _( "Print sheet reference" ) );
m_Plot_Sheet_Ref->SetValue( g_pcb_plot_options.Plot_Frame_Ref ); m_Plot_Sheet_Ref->SetValue( g_pcb_plot_options.Plot_Frame_Ref );
LeftBoxSizer->Add( m_Plot_Sheet_Ref, 0, wxGROW | wxALL, 1 ); LeftBoxSizer->Add( m_Plot_Sheet_Ref, 0, wxGROW | wxALL, 1 );
@ -406,7 +405,8 @@ scale plotting" ) );
_( "Print pads on silkscreen" ) ); _( "Print pads on silkscreen" ) );
if( config ) if( config )
config->Read( OPTKEY_PADS_ON_SILKSCREEN, &g_pcb_plot_options.PlotPadsOnSilkLayer ); config->Read( OPTKEY_PADS_ON_SILKSCREEN,
&g_pcb_plot_options.PlotPadsOnSilkLayer );
m_Plot_Pads_on_Silkscreen->SetValue( &g_pcb_plot_options.PlotPadsOnSilkLayer ); m_Plot_Pads_on_Silkscreen->SetValue( &g_pcb_plot_options.PlotPadsOnSilkLayer );
m_Plot_Pads_on_Silkscreen->SetToolTip( m_Plot_Pads_on_Silkscreen->SetToolTip(
@ -416,7 +416,8 @@ scale plotting" ) );
m_Force_Plot_Pads = new wxCheckBox( this, ID_FORCE_PRINT_PAD, m_Force_Plot_Pads = new wxCheckBox( this, ID_FORCE_PRINT_PAD,
_( "Always print pads" ) ); _( "Always print pads" ) );
if( config ) if( config )
config->Read( OPTKEY_ALWAYS_PRINT_PADS, &g_pcb_plot_options.Plot_Pads_All_Layers ); config->Read( OPTKEY_ALWAYS_PRINT_PADS,
&g_pcb_plot_options.Plot_Pads_All_Layers );
m_Force_Plot_Pads->SetValue( g_pcb_plot_options.Plot_Pads_All_Layers ); m_Force_Plot_Pads->SetValue( g_pcb_plot_options.Plot_Pads_All_Layers );
m_Force_Plot_Pads->SetToolTip( _( "Force print/plot pads on ALL layers" ) ); m_Force_Plot_Pads->SetToolTip( _( "Force print/plot pads on ALL layers" ) );
@ -488,8 +489,8 @@ scale plotting" ) );
m_Scale_Opt->SetSelection( g_pcb_plot_options.PlotScaleOpt ); m_Scale_Opt->SetSelection( g_pcb_plot_options.PlotScaleOpt );
MidLeftBoxSizer->Add( m_Scale_Opt, 0, wxGROW | wxALL, 5 ); MidLeftBoxSizer->Add( m_Scale_Opt, 0, wxGROW | wxALL, 5 );
static const wxString list_opt3[3] = { _( "Line" ), _( "Filled" ), _( static const wxString list_opt3[3] = { _( "Line" ), _( "Filled" ),
"Sketch" ) }; _( "Sketch" ) };
m_PlotModeOpt = new wxRadioBox( this, ID_PLOT_MODE_OPT, _( "Plot Mode" ), m_PlotModeOpt = new wxRadioBox( this, ID_PLOT_MODE_OPT, _( "Plot Mode" ),
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
@ -545,10 +546,11 @@ void WinEDA_PlotFrame::CreateDrillFile( wxCommandEvent& event )
void WinEDA_PlotFrame::OnSetScaleOpt( wxCommandEvent& event ) void WinEDA_PlotFrame::OnSetScaleOpt( wxCommandEvent& event )
{ {
/* Disable sheet reference for scale != 1:1 */ /* Disable sheet reference for scale != 1:1 */
bool scale1 = (m_Scale_Opt->GetSelection() == 1); bool scale1 = ( m_Scale_Opt->GetSelection() == 1 );
m_Plot_Sheet_Ref->Enable( scale1 ); m_Plot_Sheet_Ref->Enable( scale1 );
if (!scale1)
m_Plot_Sheet_Ref->SetValue(false); if ( !scale1 )
m_Plot_Sheet_Ref->SetValue( false );
} }
void WinEDA_PlotFrame::SetCommands( wxCommandEvent& event ) void WinEDA_PlotFrame::SetCommands( wxCommandEvent& event )
@ -661,7 +663,8 @@ void WinEDA_PlotFrame::SaveOptPlot( wxCommandEvent& event )
g_pcb_plot_options.Sel_Texte_Invisible = m_Plot_Invisible_Text->GetValue(); g_pcb_plot_options.Sel_Texte_Invisible = m_Plot_Invisible_Text->GetValue();
g_pcb_plot_options.PlotScaleOpt = m_Scale_Opt->GetSelection(); g_pcb_plot_options.PlotScaleOpt = m_Scale_Opt->GetSelection();
g_pcb_plot_options.DrillShapeOpt = (PCB_Plot_Options::DrillShapeOptT) m_Drill_Shape_Opt->GetSelection(); g_pcb_plot_options.DrillShapeOpt =
(PCB_Plot_Options::DrillShapeOptT) m_Drill_Shape_Opt->GetSelection();
g_pcb_plot_options.Plot_Set_MIROIR = m_PlotMirorOpt->GetValue(); g_pcb_plot_options.Plot_Set_MIROIR = m_PlotMirorOpt->GetValue();
if( g_pcb_plot_options.Plot_Set_MIROIR ) if( g_pcb_plot_options.Plot_Set_MIROIR )
g_pcb_plot_options.PlotOrient = PLOT_MIROIR; g_pcb_plot_options.PlotOrient = PLOT_MIROIR;
@ -682,16 +685,19 @@ void WinEDA_PlotFrame::SaveOptPlot( wxCommandEvent& event )
if( config ) if( config )
{ {
config->Write( OPTKEY_EDGELAYER_GERBER, g_pcb_plot_options.Exclude_Edges_Pcb ); config->Write( OPTKEY_EDGELAYER_GERBER,
g_pcb_plot_options.Exclude_Edges_Pcb );
config->Write( OPTKEY_XFINESCALE_ADJ, m_XScaleAdjust ); config->Write( OPTKEY_XFINESCALE_ADJ, m_XScaleAdjust );
config->Write( OPTKEY_YFINESCALE_ADJ, m_YScaleAdjust ); config->Write( OPTKEY_YFINESCALE_ADJ, m_YScaleAdjust );
config->Write( OPTKEY_PADS_ON_SILKSCREEN, g_pcb_plot_options.PlotPadsOnSilkLayer ); config->Write( OPTKEY_PADS_ON_SILKSCREEN,
config->Write( OPTKEY_ALWAYS_PRINT_PADS, g_pcb_plot_options.Plot_Pads_All_Layers ); g_pcb_plot_options.PlotPadsOnSilkLayer );
config->Write( OPTKEY_ALWAYS_PRINT_PADS,
g_pcb_plot_options.Plot_Pads_All_Layers );
int formatNdx = m_PlotFormatOpt->GetSelection(); int formatNdx = m_PlotFormatOpt->GetSelection();
config->Write( OPTKEY_OUTPUT_FORMAT, formatNdx ); config->Write( OPTKEY_OUTPUT_FORMAT, formatNdx );
config->Write( OPTKEY_PLOT_LINEWIDTH_VALUE,
config->Write( OPTKEY_PLOT_LINEWIDTH_VALUE, g_pcb_plot_options.PlotLine_Width ); g_pcb_plot_options.PlotLine_Width );
wxString layerKey; wxString layerKey;
for( int layer = 0; layer<NB_LAYERS; ++layer ) for( int layer = 0; layer<NB_LAYERS; ++layer )
@ -774,7 +780,7 @@ void WinEDA_PlotFrame::Plot( wxCommandEvent& event )
break; break;
} }
// Test for a reasonnable scale value // Test for a reasonable scale value
if( g_pcb_plot_options.Scale < MIN_SCALE ) if( g_pcb_plot_options.Scale < MIN_SCALE )
DisplayInfoMessage( this, DisplayInfoMessage( this,
_( "Warning: Scale option set to a very small value" ) ); _( "Warning: Scale option set to a very small value" ) );
@ -795,7 +801,7 @@ void WinEDA_PlotFrame::Plot( wxCommandEvent& event )
fn = m_Parent->GetScreen()->m_FileName; fn = m_Parent->GetScreen()->m_FileName;
// Calcul du nom du fichier // Create file name.
fn.SetName( fn.GetName() + wxT( "-" ) + fn.SetName( fn.GetName() + wxT( "-" ) +
board->GetLayerName( layer_to_plot ) ); board->GetLayerName( layer_to_plot ) );
fn.SetExt( ext ); fn.SetExt( ext );