More comment translation and capitalization fixes.
This commit is contained in:
parent
0acb404fcf
commit
1a139a7fe7
|
@ -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 "common.h"
|
||||
|
@ -13,80 +13,74 @@
|
|||
#include "pcbnew_id.h"
|
||||
|
||||
|
||||
|
||||
/***********************************************/
|
||||
void WinEDA_ModuleEditFrame::ReCreateMenuBar()
|
||||
/***********************************************/
|
||||
|
||||
/* Cree ou reinitialise le menu du haut d'ecran
|
||||
*/
|
||||
{
|
||||
wxMenuBar * menuBar = GetMenuBar();
|
||||
wxMenuItem * item;
|
||||
wxMenuBar* menuBar = GetMenuBar();
|
||||
wxMenuItem* item;
|
||||
|
||||
if( ! menuBar )
|
||||
{
|
||||
menuBar = new wxMenuBar();
|
||||
if( !menuBar )
|
||||
{
|
||||
menuBar = new wxMenuBar();
|
||||
|
||||
/////////////////////////////
|
||||
// Ajustage de dimensions: //
|
||||
/////////////////////////////
|
||||
wxMenu * sizes_menu = new wxMenu;
|
||||
wxMenu* sizes_menu = new wxMenu;
|
||||
|
||||
item = new wxMenuItem(sizes_menu, ID_PCB_DRAWINGS_WIDTHS_SETUP,
|
||||
_("Sizes and Widths"),
|
||||
_("Adjust width for texts and drawings"));
|
||||
item->SetBitmap(options_text_xpm);
|
||||
sizes_menu->Append(item);
|
||||
item = new wxMenuItem( sizes_menu, ID_PCB_DRAWINGS_WIDTHS_SETUP,
|
||||
_( "Sizes and Widths" ),
|
||||
_( "Adjust width for texts and drawings" ) );
|
||||
item->SetBitmap( options_text_xpm );
|
||||
sizes_menu->Append( item );
|
||||
|
||||
item = new wxMenuItem(sizes_menu, ID_PCB_PAD_SETUP, _("Pad Settings"),
|
||||
_("Adjust size,shape,layers... for Pads"));
|
||||
item->SetBitmap(pad_xpm);
|
||||
sizes_menu->Append(item);
|
||||
item = new wxMenuItem( sizes_menu, ID_PCB_PAD_SETUP, _( "Pad Settings" ),
|
||||
_( "Adjust size, shape, layers... for pads" ) );
|
||||
item->SetBitmap( pad_xpm );
|
||||
sizes_menu->Append( item );
|
||||
|
||||
item = new wxMenuItem(sizes_menu, ID_PCB_USER_GRID_SETUP, _("User Grid Size"),
|
||||
_("Adjust User Grid"));
|
||||
item->SetBitmap(grid_xpm);
|
||||
sizes_menu->Append(item);
|
||||
item =
|
||||
new wxMenuItem( sizes_menu, ID_PCB_USER_GRID_SETUP,
|
||||
_( "User Grid Size" ),
|
||||
_( "Adjust user grid" ) );
|
||||
item->SetBitmap( grid_xpm );
|
||||
sizes_menu->Append( item );
|
||||
|
||||
|
||||
////////////////
|
||||
// Menu Help: //
|
||||
////////////////
|
||||
wxMenu *helpMenu = new wxMenu;
|
||||
////////////////
|
||||
// Menu Help: //
|
||||
////////////////
|
||||
wxMenu* helpMenu = new wxMenu;
|
||||
|
||||
// Contents
|
||||
item = new wxMenuItem(helpMenu ,
|
||||
ID_GENERAL_HELP,
|
||||
_("&Contents"), // Menu entry name
|
||||
_("Open the pcbnew manual")); // Statusbar message
|
||||
item->SetBitmap(help_xpm);
|
||||
helpMenu->Append(item);
|
||||
// Contents
|
||||
item = new wxMenuItem( helpMenu,
|
||||
ID_GENERAL_HELP,
|
||||
_( "&Contents" ),
|
||||
_( "Open the pcbnew manual" ) );
|
||||
item->SetBitmap( help_xpm );
|
||||
helpMenu->Append( item );
|
||||
|
||||
|
||||
// About pcbnew
|
||||
item = new wxMenuItem(helpMenu ,
|
||||
ID_KICAD_ABOUT,
|
||||
_("&About pcbnew"), // Menu entry name
|
||||
_("About pcbnew PCB designer")); // Statusbar message
|
||||
item->SetBitmap(info_xpm);
|
||||
helpMenu->Append(item);
|
||||
// About pcbnew
|
||||
item = new wxMenuItem( helpMenu,
|
||||
ID_KICAD_ABOUT,
|
||||
_( "&About pcbnew" ),
|
||||
_( "About pcbnew PCB designer" ) );
|
||||
item->SetBitmap( info_xpm );
|
||||
helpMenu->Append( item );
|
||||
|
||||
//////////////////////
|
||||
// Menu Display 3D: //
|
||||
//////////////////////
|
||||
wxMenu *Display3DMenu = new wxMenu;
|
||||
item = new wxMenuItem(Display3DMenu , ID_MENU_PCB_SHOW_3D_FRAME, _("3D Display"), _("Show board in 3D viewer"));
|
||||
item->SetBitmap(show_3d_xpm);
|
||||
Display3DMenu->Append(item);
|
||||
//////////////////////
|
||||
// Menu Display 3D: //
|
||||
//////////////////////
|
||||
wxMenu* Display3DMenu = new wxMenu;
|
||||
item = new wxMenuItem( Display3DMenu,
|
||||
ID_MENU_PCB_SHOW_3D_FRAME,
|
||||
_( "3D Display" ),
|
||||
_( "Show board in 3D viewer" ) );
|
||||
item->SetBitmap( show_3d_xpm );
|
||||
Display3DMenu->Append( item );
|
||||
|
||||
menuBar->Append(sizes_menu, _("&Dimensions"));
|
||||
menuBar->Append(Display3DMenu, _("&3D Display"));
|
||||
menuBar->Append(helpMenu, _("&Help"));
|
||||
menuBar->Append( sizes_menu, _( "&Dimensions" ) );
|
||||
menuBar->Append( Display3DMenu, _( "&3D Display" ) );
|
||||
menuBar->Append( helpMenu, _( "&Help" ) );
|
||||
|
||||
// Associate the menu bar with the frame
|
||||
SetMenuBar(menuBar);
|
||||
}
|
||||
// Associate the menu bar with the frame
|
||||
SetMenuBar( menuBar );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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 "appl_wxstruct.h"
|
||||
#include "common.h"
|
||||
|
@ -11,12 +11,8 @@
|
|||
#include "hotkeys.h"
|
||||
#include "pcbnew_id.h"
|
||||
|
||||
/***********************************************/
|
||||
void WinEDA_PcbFrame::ReCreateMenuBar()
|
||||
/***********************************************/
|
||||
|
||||
/* Cree ou reinitialise le menu du haut d'ecran
|
||||
*/
|
||||
void WinEDA_PcbFrame::ReCreateMenuBar()
|
||||
{
|
||||
wxMenuItem* item;
|
||||
wxMenuBar* menuBar = GetMenuBar();
|
||||
|
@ -62,7 +58,8 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
|
|||
// Add save menu
|
||||
filesMenu->AppendSeparator();
|
||||
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 );
|
||||
filesMenu->Append( item );
|
||||
|
||||
|
@ -86,7 +83,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
|
|||
|
||||
// Add plot menu
|
||||
item = new wxMenuItem( filesMenu, ID_GEN_PLOT, _( "&Plot" ),
|
||||
_( "Plot (HPGL, PostScript, or Gerber format)" ) );
|
||||
_( "Plot (HPGL, PostScript, or Gerber format)" ) );
|
||||
item->SetBitmap( plot_xpm );
|
||||
filesMenu->Append( item );
|
||||
|
||||
|
@ -96,7 +93,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
|
|||
|
||||
item = new wxMenuItem( submenuexport, ID_GEN_EXPORT_SPECCTRA,
|
||||
_( "&Specctra DSN" ),
|
||||
_( "Export the current board to a \"Specctra DSN\" file" ) );
|
||||
_( "Export the current board to a \"Specctra DSN\" file" ) );
|
||||
item->SetBitmap( export_xpm );
|
||||
submenuexport->Append( item );
|
||||
|
||||
|
@ -125,7 +122,8 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
|
|||
item->SetBitmap( import_xpm ); // @todo need better bitmap
|
||||
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,
|
||||
* _("&Specctra Design"), _("Import a \"Specctra Design\" (*.dsn) file") );
|
||||
* item->SetBitmap(export_xpm); // @todo need better bitmap
|
||||
|
@ -167,7 +165,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
|
|||
wxGetApp().m_fileHistory.AddFilesToMenu( filesMenu );
|
||||
|
||||
///////////////////////////////////
|
||||
// Preferences an configuration //
|
||||
// Preferences and configuration //
|
||||
///////////////////////////////////
|
||||
wxMenu* configmenu = new wxMenu;
|
||||
item = new wxMenuItem( configmenu, ID_CONFIG_REQ, _( "&Library" ),
|
||||
|
@ -175,8 +173,9 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
|
|||
item->SetBitmap( library_xpm );
|
||||
configmenu->Append( item );
|
||||
|
||||
item = new wxMenuItem( configmenu, ID_COLORS_SETUP, _( "&Colors and Visibility" ),
|
||||
_( "Select colors and visibilty of layers and some items" ) );
|
||||
item = new wxMenuItem( configmenu, ID_COLORS_SETUP,
|
||||
_( "&Colors and Visibility" ),
|
||||
_( "Select colors and visibility of layers and some items" ) );
|
||||
item->SetBitmap( palette_xpm );
|
||||
configmenu->Append( item );
|
||||
|
||||
|
@ -185,7 +184,8 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
|
|||
item->SetBitmap( preference_xpm );
|
||||
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" ) );
|
||||
item->SetBitmap( display_options_xpm );
|
||||
configmenu->Append( item );
|
||||
|
@ -206,13 +206,13 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
|
|||
configmenu->Append( item );
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Add access to the Design Rules Dialog and layers setup //
|
||||
////////////////////////////////////////////////////////////
|
||||
wxMenu* designRulesMenu = new wxMenu;
|
||||
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 );
|
||||
designRulesMenu->Append( item );
|
||||
|
||||
|
@ -255,9 +255,6 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
|
|||
item->SetBitmap( save_xpm );
|
||||
sizes_menu->Append( item );
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Menu postprocess ( generation fichiers percage, placement... //
|
||||
//////////////////////////////////////////////////////////////////
|
||||
wxMenu* postprocess_menu = new wxMenu;
|
||||
item = new wxMenuItem( postprocess_menu, ID_PCB_GEN_POS_MODULES_FILE,
|
||||
_( "Generate &Modules Position" ),
|
||||
|
@ -283,9 +280,6 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
|
|||
item->SetBitmap( tools_xpm );
|
||||
postprocess_menu->Append( item );
|
||||
|
||||
//////////////////////////
|
||||
// Menu d'outils divers //
|
||||
//////////////////////////
|
||||
wxMenu* miscellaneous_menu = new wxMenu;
|
||||
item = new wxMenuItem( miscellaneous_menu, ID_PCB_GLOBAL_DELETE,
|
||||
_( "Global &Deletions" ),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*********************************************/
|
||||
/* Functions to edite targets (class MIRE) */
|
||||
/*********************************************/
|
||||
/********************************************/
|
||||
/* Functions to edit targets (class MIRE) */
|
||||
/********************************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "common.h"
|
||||
|
@ -15,12 +15,16 @@
|
|||
|
||||
/* Routines Locales */
|
||||
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 : */
|
||||
static int MireDefaultSize = 5000;
|
||||
static MIREPCB s_TargetCopy( NULL ); /* Used to store "old" values of the current item
|
||||
* parameters before edition (used in undo/redo or cancel operations)
|
||||
static MIREPCB s_TargetCopy( NULL ); /* Used to store "old" values of the
|
||||
* current item parameters before
|
||||
* edition (used in undo/redo or
|
||||
* cancel operations)
|
||||
*/
|
||||
|
||||
/************************************/
|
||||
|
@ -38,11 +42,10 @@ private:
|
|||
WinEDA_ValueCtrl* m_MireSizeCtrl;
|
||||
wxRadioBox* m_MireShape;
|
||||
|
||||
public:
|
||||
|
||||
// Constructor and destructor
|
||||
WinEDA_MirePropertiesFrame( WinEDA_PcbFrame* parent,
|
||||
MIREPCB* Mire, wxDC* DC, const wxPoint& pos );
|
||||
public: WinEDA_MirePropertiesFrame( WinEDA_PcbFrame* parent,
|
||||
MIREPCB* Mire,
|
||||
wxDC* DC,
|
||||
const wxPoint& pos );
|
||||
~WinEDA_MirePropertiesFrame() { }
|
||||
|
||||
private:
|
||||
|
@ -53,27 +56,26 @@ private:
|
|||
};
|
||||
|
||||
BEGIN_EVENT_TABLE( WinEDA_MirePropertiesFrame, wxDialog )
|
||||
EVT_BUTTON( wxID_OK, WinEDA_MirePropertiesFrame::OnOkClick )
|
||||
EVT_BUTTON( wxID_CANCEL, WinEDA_MirePropertiesFrame::OnCancelClick )
|
||||
EVT_BUTTON( wxID_OK, WinEDA_MirePropertiesFrame::OnOkClick )
|
||||
EVT_BUTTON( wxID_CANCEL, WinEDA_MirePropertiesFrame::OnCancelClick )
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
void WinEDA_PcbFrame::InstallMireOptionsFrame( MIREPCB* MirePcb,
|
||||
wxDC* DC, const wxPoint& pos )
|
||||
/***************************************************************/
|
||||
{
|
||||
WinEDA_MirePropertiesFrame* frame = new WinEDA_MirePropertiesFrame( this,
|
||||
MirePcb, DC, pos );
|
||||
WinEDA_MirePropertiesFrame* frame =
|
||||
new WinEDA_MirePropertiesFrame( this, MirePcb, DC, pos );
|
||||
|
||||
frame->ShowModal();
|
||||
frame->Destroy();
|
||||
}
|
||||
|
||||
|
||||
WinEDA_MirePropertiesFrame::WinEDA_MirePropertiesFrame( WinEDA_PcbFrame* parent,
|
||||
MIREPCB* Mire, wxDC* DC,
|
||||
const wxPoint& framepos ) :
|
||||
WinEDA_MirePropertiesFrame::WinEDA_MirePropertiesFrame(
|
||||
WinEDA_PcbFrame* parent,
|
||||
MIREPCB* Mire, wxDC* DC,
|
||||
const wxPoint& framepos ) :
|
||||
wxDialog( parent, -1, _( "Target Properties" ), framepos, wxSize( 270, 210 ),
|
||||
DIALOG_STYLE )
|
||||
{
|
||||
|
@ -93,7 +95,7 @@ WinEDA_MirePropertiesFrame::WinEDA_MirePropertiesFrame( WinEDA_PcbFrame* parent,
|
|||
MainBoxSizer->Add( LeftBoxSizer, 0, wxGROW | 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" ) );
|
||||
RightBoxSizer->Add( Button, 0, wxGROW | wxALL, 5 );
|
||||
|
||||
|
@ -103,12 +105,14 @@ WinEDA_MirePropertiesFrame::WinEDA_MirePropertiesFrame( WinEDA_PcbFrame* parent,
|
|||
// Size:
|
||||
m_MireSizeCtrl = new WinEDA_ValueCtrl( this, _( "Size" ),
|
||||
m_MirePcb->m_Size,
|
||||
g_UnitMetric, LeftBoxSizer, m_Parent->m_InternalUnits );
|
||||
g_UnitMetric, LeftBoxSizer,
|
||||
m_Parent->m_InternalUnits );
|
||||
|
||||
// Width:
|
||||
m_MireWidthCtrl = new WinEDA_ValueCtrl( this, _( "Width" ),
|
||||
m_MirePcb->m_Width,
|
||||
g_UnitMetric, LeftBoxSizer, m_Parent->m_InternalUnits );
|
||||
g_UnitMetric, LeftBoxSizer,
|
||||
m_Parent->m_InternalUnits );
|
||||
|
||||
// Shape
|
||||
wxString shape_list[2] = { _( "shape +" ), _( "shape X" ) };
|
||||
|
@ -124,44 +128,42 @@ WinEDA_MirePropertiesFrame::WinEDA_MirePropertiesFrame( WinEDA_PcbFrame* parent,
|
|||
}
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
void WinEDA_MirePropertiesFrame::OnCancelClick( wxCommandEvent& WXUNUSED (event) )
|
||||
/**********************************************************************/
|
||||
void WinEDA_MirePropertiesFrame::OnCancelClick( wxCommandEvent& WXUNUSED(
|
||||
event ) )
|
||||
{
|
||||
EndModal( -1 );
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
void WinEDA_MirePropertiesFrame::OnOkClick( wxCommandEvent& event )
|
||||
/**************************************************************************/
|
||||
|
||||
/* Met a jour les differents parametres pour le composant en cours d'édition
|
||||
/* Updates the different parameters for the component being edited
|
||||
*/
|
||||
void WinEDA_MirePropertiesFrame::OnOkClick( wxCommandEvent& event )
|
||||
{
|
||||
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 )
|
||||
m_Parent->SaveCopyInUndoList( m_MirePcb, UR_CHANGED );
|
||||
|
||||
if( m_MirePcb->m_Flags != 0) // other edition in progress (MOVE, NEW ..)
|
||||
m_MirePcb->m_Flags |= IN_EDIT; // set flag in edit to force undo/redo/abort proper operation
|
||||
if( m_MirePcb->m_Flags != 0 ) // other edition in progress (MOVE,
|
||||
// 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();
|
||||
MireDefaultSize = m_MirePcb->m_Size = m_MireSizeCtrl->GetValue();
|
||||
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();
|
||||
EndModal( 1 );
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************/
|
||||
void WinEDA_PcbFrame::Delete_Mire( MIREPCB* MirePcb, wxDC* DC )
|
||||
/**************************************************************/
|
||||
{
|
||||
if( MirePcb == NULL )
|
||||
return;
|
||||
|
@ -172,16 +174,14 @@ void WinEDA_PcbFrame::Delete_Mire( MIREPCB* MirePcb, wxDC* DC )
|
|||
}
|
||||
|
||||
|
||||
/**********************************************************/
|
||||
static void AbortMoveAndEditTarget( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||
/**********************************************************/
|
||||
{
|
||||
BASE_SCREEN* screen = Panel->GetScreen();
|
||||
MIREPCB* MirePcb = (MIREPCB*) screen->GetCurItem();
|
||||
|
||||
Panel->ManageCurseur = NULL;
|
||||
Panel->ForceCloseManageCurseur = NULL;
|
||||
((WinEDA_PcbFrame*)Panel->m_Parent)->SetCurItem( NULL );
|
||||
( (WinEDA_PcbFrame*) Panel->m_Parent )->SetCurItem( NULL );
|
||||
|
||||
if( MirePcb == NULL )
|
||||
return;
|
||||
|
@ -196,9 +196,9 @@ static void AbortMoveAndEditTarget( WinEDA_DrawPanel* Panel, wxDC* DC )
|
|||
}
|
||||
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_Size = s_TargetCopy.m_Size;
|
||||
MirePcb->m_Shape = s_TargetCopy.m_Shape;
|
||||
|
@ -209,12 +209,9 @@ static void AbortMoveAndEditTarget( WinEDA_DrawPanel* Panel, wxDC* DC )
|
|||
}
|
||||
|
||||
|
||||
/*****************************************************/
|
||||
MIREPCB* WinEDA_PcbFrame::Create_Mire( wxDC* DC )
|
||||
/*****************************************************/
|
||||
|
||||
/* Routine de creation d'un Draw Symbole Pcb type MIRE
|
||||
/* Draw Symbol PCB type MIRE.
|
||||
*/
|
||||
MIREPCB* WinEDA_PcbFrame::Create_Mire( wxDC* DC )
|
||||
{
|
||||
MIREPCB* MirePcb = new MIREPCB( GetBoard() );
|
||||
|
||||
|
@ -232,17 +229,14 @@ MIREPCB* WinEDA_PcbFrame::Create_Mire( wxDC* DC )
|
|||
}
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
void WinEDA_PcbFrame::StartMove_Mire( MIREPCB* MirePcb, wxDC* DC )
|
||||
/**********************************************************************/
|
||||
|
||||
/* Routine d'initialisation du deplacement d'une mire
|
||||
/* Routine to initialize the displacement of a focal
|
||||
*/
|
||||
void WinEDA_PcbFrame::StartMove_Mire( MIREPCB* MirePcb, wxDC* DC )
|
||||
{
|
||||
if( MirePcb == NULL )
|
||||
return;
|
||||
|
||||
s_TargetCopy = *MirePcb;
|
||||
s_TargetCopy = *MirePcb;
|
||||
MirePcb->m_Flags |= IS_MOVED;
|
||||
DrawPanel->ManageCurseur = ShowTargetShapeWhileMovingMouse;
|
||||
DrawPanel->ForceCloseManageCurseur = AbortMoveAndEditTarget;
|
||||
|
@ -250,9 +244,7 @@ void WinEDA_PcbFrame::StartMove_Mire( MIREPCB* MirePcb, wxDC* DC )
|
|||
}
|
||||
|
||||
|
||||
/**************************************************************/
|
||||
void WinEDA_PcbFrame::Place_Mire( MIREPCB* MirePcb, wxDC* DC )
|
||||
/**************************************************************/
|
||||
{
|
||||
if( MirePcb == NULL )
|
||||
return;
|
||||
|
@ -273,7 +265,9 @@ void WinEDA_PcbFrame::Place_Mire( MIREPCB* MirePcb, wxDC* DC )
|
|||
|
||||
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;
|
||||
return;
|
||||
}
|
||||
|
@ -288,10 +282,10 @@ void WinEDA_PcbFrame::Place_Mire( MIREPCB* MirePcb, wxDC* DC )
|
|||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
static void ShowTargetShapeWhileMovingMouse( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||
/*********************************************************************************/
|
||||
/* redessin du contour de la piste lors des deplacements de la souris */
|
||||
/* Redraw the contour of the track while moving the mouse */
|
||||
static void ShowTargetShapeWhileMovingMouse( WinEDA_DrawPanel* panel,
|
||||
wxDC* DC,
|
||||
bool erase )
|
||||
{
|
||||
BASE_SCREEN* screen = panel->GetScreen();
|
||||
MIREPCB* MirePcb = (MIREPCB*) screen->GetCurItem();
|
||||
|
@ -299,12 +293,10 @@ static void ShowTargetShapeWhileMovingMouse( WinEDA_DrawPanel* panel, wxDC* DC,
|
|||
if( MirePcb == NULL )
|
||||
return;
|
||||
|
||||
/* efface ancienne position */
|
||||
if( erase )
|
||||
MirePcb->Draw( panel, DC, GR_XOR );
|
||||
|
||||
MirePcb->m_Pos = screen->m_Curseur;
|
||||
|
||||
// Reaffichage
|
||||
MirePcb->Draw( panel, DC, GR_XOR );
|
||||
}
|
||||
|
|
|
@ -21,9 +21,8 @@
|
|||
|
||||
#include "collectors.h"
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode )
|
||||
/****************************************************************************/
|
||||
{
|
||||
BOARD_ITEM* item = GetCurItem();
|
||||
|
||||
|
@ -38,22 +37,23 @@ BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode )
|
|||
|
||||
if( aHotKeyCode )
|
||||
{
|
||||
// @todo: add switch here and add calls to PcbGeneralLocateAndDisplay( int aHotKeyCode )
|
||||
// when searching is needed from a hotkey handler
|
||||
// @todo: add switch here and add calls to PcbGeneralLocateAndDisplay(
|
||||
// int aHotKeyCode ) when searching is needed from a hotkey handler
|
||||
}
|
||||
else
|
||||
{
|
||||
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
|
||||
* module from list
|
||||
*/
|
||||
if( m_Collector->GetCount() > 1 )
|
||||
{
|
||||
for( int ii = 0; ii < m_Collector->GetCount(); ii++ )
|
||||
for( int ii = 0; ii < m_Collector->GetCount(); ii++ )
|
||||
{
|
||||
item = (*m_Collector)[ii];
|
||||
if( item->Type() != TYPE_MODULE )
|
||||
|
@ -68,12 +68,15 @@ BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode )
|
|||
item = (*m_Collector)[0];
|
||||
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;
|
||||
|
||||
/* Give a title to the selection menu. This is also a cancel menu item */
|
||||
wxMenuItem* item_title = new wxMenuItem( &itemMenu, -1, _( "Selection Clarification" ) );
|
||||
/* Give a title to the selection menu. This is also a cancel
|
||||
* menu item **/
|
||||
wxMenuItem* item_title =
|
||||
new wxMenuItem( &itemMenu, -1, _( "Selection Clarification" ) );
|
||||
#ifdef __WINDOWS__
|
||||
wxFont bold_font( *wxNORMAL_FONT );
|
||||
bold_font.SetWeight( wxFONTWEIGHT_BOLD );
|
||||
|
@ -85,7 +88,7 @@ BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode )
|
|||
|
||||
int limit = MIN( MAX_ITEMS_IN_PICKER, m_Collector->GetCount() );
|
||||
|
||||
for( int ii = 0; ii<limit; ++ii )
|
||||
for( int ii = 0; ii<limit; ++ii )
|
||||
{
|
||||
wxString text;
|
||||
const char** xpm;
|
||||
|
@ -95,19 +98,26 @@ BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode )
|
|||
text = item->MenuText( GetBoard() );
|
||||
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()
|
||||
// and it calls SetCurItem() which in turn calls DisplayInfo() on the item.
|
||||
// this menu's handler is void
|
||||
// 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
|
||||
PopupMenu( &itemMenu ); // m_AbortRequest = false if an item is selected
|
||||
PopupMenu( &itemMenu ); // m_AbortRequest = false if an
|
||||
// item is selected
|
||||
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -131,25 +141,20 @@ void WinEDA_ModuleEditFrame::LoadModuleFromBoard( 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();
|
||||
wxPoint pos;
|
||||
bool redraw = false;
|
||||
int id = event.GetId();
|
||||
wxPoint pos;
|
||||
bool redraw = false;
|
||||
|
||||
wxClientDC dc( DrawPanel );
|
||||
|
||||
DrawPanel->PrepareGraphicContext( &dc );
|
||||
wxGetMousePosition( &pos.x, &pos.y );
|
||||
|
||||
pos.y += 20;
|
||||
|
||||
switch( id ) // Arret eventuel de la commande de d<>placement en cours
|
||||
switch( id )
|
||||
{
|
||||
case wxID_CUT:
|
||||
case wxID_COPY:
|
||||
|
@ -182,10 +187,9 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
||||
default:
|
||||
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
|
||||
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
|
||||
{
|
||||
// for all other commands: stop the move in progress
|
||||
SET_DC;
|
||||
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
||||
}
|
||||
if( id != ID_POPUP_CANCEL_CURRENT_COMMAND )
|
||||
|
@ -193,7 +197,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
}
|
||||
|
||||
switch( id ) // Traitement des commandes
|
||||
switch( id )
|
||||
{
|
||||
case ID_EXIT:
|
||||
Close( true );
|
||||
|
@ -223,8 +227,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
MODULE* module = Create_1_Module( NULL, wxEmptyString );
|
||||
if( module ) // i.e. if create module command not aborted
|
||||
{
|
||||
// Initialize data relative to nets and netclasses (for a new module
|
||||
// the defaults are used)
|
||||
// Initialize data relative to nets and netclasses (for a new
|
||||
// module the defaults are used)
|
||||
// This is mandatory to handle and draw pads
|
||||
GetBoard()->m_NetInfo->BuildListOfNets();
|
||||
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 ...
|
||||
{
|
||||
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 )
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
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
|
||||
{
|
||||
// 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
|
||||
PICKED_ITEMS_LIST pickList;
|
||||
pcbframe->Exchange_Module( source_module, newmodule, &pickList );
|
||||
|
@ -403,7 +412,9 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
if( 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();
|
||||
GetScreen()->GetCurItem()->m_Flags = 0;
|
||||
if( ret > 0 )
|
||||
|
@ -461,7 +472,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
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();
|
||||
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:
|
||||
{
|
||||
SET_DC;
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
StartMovePad( (D_PAD*) GetScreen()->GetCurItem(), &dc );
|
||||
}
|
||||
|
@ -481,9 +492,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
case ID_POPUP_PCB_EDIT_PAD:
|
||||
{
|
||||
SET_DC;
|
||||
InstallPadOptionsFrame( (D_PAD*) GetScreen()->GetCurItem(),
|
||||
&dc, pos );
|
||||
&dc, pos );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
}
|
||||
break;
|
||||
|
@ -514,15 +524,14 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
case ID_POPUP_PCB_EDIT_TEXTMODULE:
|
||||
{
|
||||
SET_DC;
|
||||
InstallTextModOptionsFrame( (TEXTE_MODULE*) GetScreen()->GetCurItem(), &dc );
|
||||
InstallTextModOptionsFrame(
|
||||
(TEXTE_MODULE*) GetScreen()->GetCurItem(), &dc );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
}
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST:
|
||||
{
|
||||
SET_DC;
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
StartMoveTexteModule( (TEXTE_MODULE*) GetScreen()->GetCurItem(), &dc );
|
||||
}
|
||||
|
@ -530,7 +539,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
case ID_POPUP_PCB_ROTATE_TEXTMODULE:
|
||||
{
|
||||
SET_DC;
|
||||
RotateTextModule( (TEXTE_MODULE*) GetScreen()->GetCurItem(), &dc );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
}
|
||||
|
@ -545,7 +553,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
|
||||
case ID_POPUP_PCB_MOVE_EDGE:
|
||||
{
|
||||
SET_DC;
|
||||
Start_Move_EdgeMod( (EDGE_MODULE*) GetScreen()->GetCurItem(), &dc );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
}
|
||||
|
@ -555,7 +562,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
DrawPanel->MouseToCursorSchema();
|
||||
if( (GetScreen()->GetCurItem()->m_Flags & IS_NEW) )
|
||||
{
|
||||
SET_DC;
|
||||
End_Edge_Module( (EDGE_MODULE*) GetScreen()->GetCurItem(), &dc );
|
||||
SetCurItem( NULL );
|
||||
}
|
||||
|
@ -565,12 +571,11 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
{
|
||||
EDGE_MODULE* edge = NULL;
|
||||
if( GetScreen()->GetCurItem()
|
||||
&& ( GetScreen()->GetCurItem()->m_Flags & IS_NEW)
|
||||
&& (GetScreen()->GetCurItem()->Type() == TYPE_EDGE_MODULE) )
|
||||
&& ( GetScreen()->GetCurItem()->m_Flags & IS_NEW )
|
||||
&& ( GetScreen()->GetCurItem()->Type() == TYPE_EDGE_MODULE ) )
|
||||
{
|
||||
edge = (EDGE_MODULE*) GetScreen()->GetCurItem();
|
||||
}
|
||||
SET_DC;
|
||||
Enter_Edge_Width( edge, &dc );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
}
|
||||
|
@ -622,7 +627,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
if( item->Type() != TYPE_PAD )
|
||||
item = NULL;
|
||||
}
|
||||
SET_DC;
|
||||
InstallPadOptionsFrame( (D_PAD*) item, &dc, pos );
|
||||
}
|
||||
break;
|
||||
|
@ -634,61 +638,43 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
case ID_POPUP_PLACE_BLOCK:
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_MOVE;
|
||||
DrawPanel->m_AutoPAN_Request = FALSE;
|
||||
{
|
||||
SET_DC;
|
||||
HandleBlockPlace( &dc );
|
||||
}
|
||||
HandleBlockPlace( &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_COPY_BLOCK:
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_COPY;
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
DrawPanel->m_AutoPAN_Request = FALSE;
|
||||
{
|
||||
SET_DC;
|
||||
HandleBlockPlace( &dc );
|
||||
}
|
||||
HandleBlockPlace( &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_ZOOM_BLOCK:
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_ZOOM;
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
{
|
||||
SET_DC;
|
||||
HandleBlockEnd( &dc );
|
||||
}
|
||||
HandleBlockEnd( &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_DELETE_BLOCK:
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_DELETE;
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
{
|
||||
SET_DC;
|
||||
HandleBlockEnd( &dc );
|
||||
}
|
||||
HandleBlockEnd( &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_ROTATE_BLOCK:
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_ROTATE;
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
{
|
||||
SET_DC;
|
||||
HandleBlockEnd( &dc );
|
||||
}
|
||||
HandleBlockEnd( &dc );
|
||||
break;
|
||||
|
||||
case ID_POPUP_MIRROR_X_BLOCK:
|
||||
GetScreen()->m_BlockLocate.m_Command = BLOCK_MIRROR_X;
|
||||
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
||||
{
|
||||
SET_DC;
|
||||
HandleBlockEnd( &dc );
|
||||
}
|
||||
HandleBlockEnd( &dc );
|
||||
break;
|
||||
|
||||
default:
|
||||
DisplayError( this,
|
||||
wxT( "WinEDA_ModuleEditFrame::Process_Special_Functions error" ) );
|
||||
wxT( "WinEDA_ModuleEditFrame::Process_Special_Functions error" ) );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
* 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
|
||||
* orientation 0, component side.
|
||||
*/
|
||||
void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
|
||||
{
|
||||
D_PAD* pad = module->m_Pads;
|
||||
EDA_BaseStruct* PtStruct = module->m_Drawings;
|
||||
TEXTE_MODULE* textmod;
|
||||
EDGE_MODULE* edgemod;
|
||||
int angle = 900; // NECESSAIREMENT +- 900 (+- 90 degres) )
|
||||
int angle = 900; // Necessary +- 900 (+- 90 degrees) )
|
||||
|
||||
switch( transform )
|
||||
{
|
||||
|
@ -737,7 +721,6 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
|
|||
if( 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() )
|
||||
{
|
||||
if( PtStruct->Type() == TYPE_EDGE_MODULE )
|
||||
|
@ -748,7 +731,6 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
|
|||
}
|
||||
if( PtStruct->Type() == TYPE_TEXTE_MODULE )
|
||||
{
|
||||
/* deplacement des inscriptions : */
|
||||
textmod = (TEXTE_MODULE*) PtStruct;
|
||||
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;
|
||||
}
|
||||
|
||||
/* Inversion miroir de la Reference */
|
||||
/* Reverse mirror of reference. */
|
||||
textmod = module->m_Reference;
|
||||
NEGATE( textmod->m_Pos.y );
|
||||
NEGATE( textmod->m_Pos0.y );
|
||||
if( textmod->m_Orient )
|
||||
textmod->m_Orient = 3600 - textmod->m_Orient;
|
||||
|
||||
/* Inversion miroir de la Valeur */
|
||||
/* Reverse mirror of value. */
|
||||
textmod = module->m_Value;
|
||||
NEGATE( textmod->m_Pos.y );
|
||||
NEGATE( textmod->m_Pos0.y );
|
||||
if( 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;
|
||||
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
||||
{
|
||||
|
@ -792,13 +774,13 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
|
|||
edgemod = (EDGE_MODULE*) PtStruct;
|
||||
NEGATE( edgemod->m_Start.y );
|
||||
NEGATE( edgemod->m_End.y );
|
||||
/* inversion des coords locales */
|
||||
/* Invert local coordinates */
|
||||
NEGATE( edgemod->m_Start0.y );
|
||||
NEGATE( edgemod->m_End0.y );
|
||||
break;
|
||||
|
||||
case TYPE_TEXTE_MODULE:
|
||||
/* Inversion miroir de la position et mise en miroir : */
|
||||
/* Reverse mirror position and mirror. */
|
||||
textmod = (TEXTE_MODULE*) PtStruct;
|
||||
NEGATE( textmod->m_Pos.y );
|
||||
NEGATE( textmod->m_Pos0.y );
|
||||
|
@ -807,7 +789,7 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
|
|||
break;
|
||||
|
||||
default:
|
||||
DisplayError( this, wxT( "Type Draw Indefini" ) );
|
||||
DisplayError( this, wxT( "Draw type undefined" ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -815,7 +797,7 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
|
|||
break;
|
||||
|
||||
default:
|
||||
DisplayInfoMessage( this, wxT( "Not availlable" ) );
|
||||
DisplayInfoMessage( this, wxT( "Not available" ) );
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,12 +16,10 @@
|
|||
#include "protos.h"
|
||||
#include "pcbnew_id.h"
|
||||
|
||||
/*************************************************************************/
|
||||
void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||
/*************************************************************************/
|
||||
|
||||
/* Handle the left click in footprint editor
|
||||
*/
|
||||
void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||
{
|
||||
BOARD_ITEM* DrawStruct = GetCurItem();
|
||||
|
||||
|
@ -48,10 +46,10 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
default:
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf(
|
||||
wxT(
|
||||
"WinEDA_ModEditFrame::OnLeftClick err: m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
|
||||
DrawStruct, DrawStruct->Type(), DrawStruct->m_Flags );
|
||||
msg.Printf( wxT( "WinEDA_ModEditFrame::OnLeftClick err: \
|
||||
m_Flags != 0\nStruct @%p, type %d m_Flag %X" ),
|
||||
DrawStruct, DrawStruct->Type(),
|
||||
DrawStruct->m_Flags );
|
||||
DisplayError( this, msg );
|
||||
DrawStruct->m_Flags = 0;
|
||||
break;
|
||||
|
@ -109,18 +107,22 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
Begin_Edge_Module( (EDGE_MODULE*) DrawStruct, DC, 0 ) );
|
||||
}
|
||||
else
|
||||
DisplayError( this, wxT( "ProcessCommand error: DrawStruct/ flags error" ) );
|
||||
DisplayError( this,
|
||||
wxT( "ProcessCommand error: DrawStruct flags error" ) );
|
||||
}
|
||||
break;
|
||||
|
||||
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;
|
||||
DrawStruct = ModeditLocateAndDisplay();
|
||||
if( DrawStruct == NULL || (DrawStruct->m_Flags != 0) )
|
||||
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 );
|
||||
RemoveStruct( DrawStruct );
|
||||
DrawStruct = NULL;
|
||||
|
@ -133,11 +135,13 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
MODULE* module = GetBoard()->m_Modules;
|
||||
module->m_Flags = 0;
|
||||
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 );
|
||||
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 ) );
|
||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||
SetCurItem( NULL );
|
||||
|
@ -160,7 +164,8 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
|
||||
default:
|
||||
DrawPanel->SetCursor( wxCURSOR_ARROW );
|
||||
DisplayError( this, wxT( "WinEDA_ModuleEditFrame::ProcessCommand error" ) );
|
||||
DisplayError( this,
|
||||
wxT( "WinEDA_ModuleEditFrame::ProcessCommand error" ) );
|
||||
m_ID_current_state = 0;
|
||||
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:
|
||||
* 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();
|
||||
wxString msg;
|
||||
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
|
||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
||||
// Simple location of elements where possible.
|
||||
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
|
||||
{
|
||||
SetCurItem( DrawStruct = ModeditLocateAndDisplay() );
|
||||
}
|
||||
|
||||
// Si commande en cours: affichage fin de commande
|
||||
// End command in progress.
|
||||
if( m_ID_current_state )
|
||||
{
|
||||
if( DrawStruct && DrawStruct->m_Flags )
|
||||
|
@ -207,23 +210,28 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
|
|||
{
|
||||
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,
|
||||
_( "Cancel Block" ), cancel_xpm );
|
||||
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();
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PLACE_BLOCK,
|
||||
_( "Place Block" ), apply_xpm );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_COPY_BLOCK,
|
||||
_( "Copy Block (shift + drag mouse)" ), copyblock_xpm );
|
||||
_( "Copy Block (shift + drag mouse)" ),
|
||||
copyblock_xpm );
|
||||
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,
|
||||
_( "Rotate Block (ctrl + drag mouse)" ), rotate_pos_xpm );
|
||||
_( "Rotate Block (ctrl + drag mouse)" ),
|
||||
rotate_pos_xpm );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_DELETE_BLOCK,
|
||||
_( "Delete Block (shift+ctrl + drag mouse)" ), delete_xpm );
|
||||
_( "Delete Block (shift+ctrl + drag mouse)" ),
|
||||
delete_xpm );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -262,7 +270,8 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
|
|||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_PAD_REQUEST,
|
||||
_( "Move Pad" ), move_pad_xpm );
|
||||
}
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_PAD, _( "Edit Pad" ), options_pad_xpm );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_PAD, _( "Edit Pad" ),
|
||||
options_pad_xpm );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_IMPORT_PAD_SETTINGS,
|
||||
_( "New Pad Settings" ), options_new_pad_xpm );
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EXPORT_PAD_SETTINGS,
|
||||
|
@ -308,7 +317,8 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
|
|||
_( "Place edge" ), apply_xpm );
|
||||
wxMenu* edit_mnu = new wxMenu;
|
||||
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,
|
||||
_( "Edit Width (Current)" ), width_segment_xpm );
|
||||
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_NOT_INIT:
|
||||
case TYPE_PCB:
|
||||
msg.Printf(
|
||||
wxT( "WinEDA_ModuleEditFrame::OnRightClick Error: illegal DrawType %d" ),
|
||||
msg.Printf( wxT( "WinEDA_ModuleEditFrame::OnRightClick Error: illegal DrawType %d" ),
|
||||
DrawStruct->Type() );
|
||||
DisplayError( this, msg );
|
||||
break;
|
||||
|
||||
default:
|
||||
msg.Printf(
|
||||
wxT( "WinEDA_ModuleEditFrame::OnRightClick Error: unknown DrawType %d" ),
|
||||
msg.Printf( wxT( "WinEDA_ModuleEditFrame::OnRightClick Error: unknown DrawType %d" ),
|
||||
DrawStruct->Type() );
|
||||
DisplayError( this, msg );
|
||||
break;
|
||||
|
@ -353,9 +361,10 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
|
|||
PopMenu->AppendSeparator();
|
||||
|
||||
if( append_set_width
|
||||
|| ( m_ID_current_state && ( (m_ID_current_state == ID_PCB_ADD_LINE_BUTT)
|
||||
|| (m_ID_current_state == ID_PCB_CIRCLE_BUTT)
|
||||
|| (m_ID_current_state == ID_PCB_ARC_BUTT) ) ) )
|
||||
|| ( m_ID_current_state
|
||||
&& ( ( m_ID_current_state == ID_PCB_ADD_LINE_BUTT )
|
||||
|| ( m_ID_current_state == ID_PCB_CIRCLE_BUTT )
|
||||
|| ( m_ID_current_state == ID_PCB_ARC_BUTT ) ) ) )
|
||||
{
|
||||
ADD_MENUITEM( PopMenu, ID_POPUP_PCB_ENTER_EDGE_WIDTH,
|
||||
_( "Set Width" ), width_segment_xpm );
|
||||
|
@ -366,13 +375,10 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
|
|||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||
/****************************************************************************/
|
||||
|
||||
/* Handle the double click in the footprin editor:
|
||||
/* Handle the double click in the footprint 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();
|
||||
wxPoint pos = GetPosition();
|
||||
|
@ -383,12 +389,12 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
|||
switch( m_ID_current_state )
|
||||
{
|
||||
case 0:
|
||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
||||
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
|
||||
{
|
||||
DrawStruct = ModeditLocateAndDisplay();
|
||||
}
|
||||
|
||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags != 0) )
|
||||
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags != 0 ) )
|
||||
break;
|
||||
|
||||
// Item found
|
||||
|
@ -397,8 +403,7 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
|||
switch( DrawStruct->Type() )
|
||||
{
|
||||
case TYPE_PAD:
|
||||
InstallPadOptionsFrame(
|
||||
(D_PAD*) DrawStruct, &dc, pos );
|
||||
InstallPadOptionsFrame( (D_PAD*) DrawStruct, &dc, pos );
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
break;
|
||||
|
||||
|
@ -427,7 +432,7 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
|||
|
||||
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 );
|
||||
SetCurItem( NULL );
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
/*******************************************************/
|
||||
/* PCBNEW - Gestion des Options et Reglages de modeedit*/
|
||||
/*******************************************************/
|
||||
|
||||
/* Fichier modeditoptions.cpp */
|
||||
|
||||
/*
|
||||
Affichage et modifications des parametres de travail de Modedit
|
||||
*/
|
||||
/***********************************************/
|
||||
/* PCBNEW - Footprint (module) editor options. */
|
||||
/***********************************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "common.h"
|
||||
|
@ -21,70 +15,68 @@
|
|||
#include "protos.h"
|
||||
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
void WinEDA_ModuleEditFrame::OnSelectOptionToolbar(wxCommandEvent& event)
|
||||
/***********************************************************************/
|
||||
void WinEDA_ModuleEditFrame::OnSelectOptionToolbar( wxCommandEvent& event )
|
||||
{
|
||||
int id = event.GetId();
|
||||
wxClientDC dc(DrawPanel);
|
||||
int id = event.GetId();
|
||||
wxClientDC dc( DrawPanel );
|
||||
|
||||
DrawPanel->CursorOff( &dc);
|
||||
DrawPanel->PrepareGraphicContext(&dc);
|
||||
switch ( id )
|
||||
{
|
||||
case ID_TB_OPTIONS_SHOW_GRID:
|
||||
m_Draw_Grid = m_OptionsToolBar->GetToolState(id);
|
||||
DrawPanel->ReDraw(&dc, TRUE);
|
||||
break;
|
||||
DrawPanel->CursorOff( &dc );
|
||||
DrawPanel->PrepareGraphicContext( &dc );
|
||||
switch( id )
|
||||
{
|
||||
case ID_TB_OPTIONS_SHOW_GRID:
|
||||
m_Draw_Grid = m_OptionsToolBar->GetToolState( id );
|
||||
DrawPanel->ReDraw( &dc, TRUE );
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SELECT_UNIT_MM:
|
||||
g_UnitMetric = MILLIMETRE;
|
||||
case ID_TB_OPTIONS_SELECT_UNIT_INCH:
|
||||
if ( id == ID_TB_OPTIONS_SELECT_UNIT_INCH )
|
||||
g_UnitMetric = INCHES;
|
||||
UpdateStatusBar(); /* Reaffichage des coord curseur */
|
||||
ReCreateAuxiliaryToolbar();
|
||||
break;
|
||||
case ID_TB_OPTIONS_SELECT_UNIT_MM:
|
||||
g_UnitMetric = MILLIMETRE;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_POLAR_COORD:
|
||||
Affiche_Message(wxEmptyString);
|
||||
DisplayOpt.DisplayPolarCood = m_OptionsToolBar->GetToolState(id);
|
||||
UpdateStatusBar(); /* Reaffichage des coord curseur */
|
||||
break;
|
||||
case ID_TB_OPTIONS_SELECT_UNIT_INCH:
|
||||
if( id == ID_TB_OPTIONS_SELECT_UNIT_INCH )
|
||||
g_UnitMetric = INCHES;
|
||||
UpdateStatusBar();
|
||||
ReCreateAuxiliaryToolbar();
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SELECT_CURSOR:
|
||||
m_CursorShape = m_OptionsToolBar->GetToolState(id);
|
||||
break;
|
||||
case ID_TB_OPTIONS_SHOW_POLAR_COORD:
|
||||
Affiche_Message( wxEmptyString );
|
||||
DisplayOpt.DisplayPolarCood = m_OptionsToolBar->GetToolState( id );
|
||||
UpdateStatusBar();
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_PADS_SKETCH:
|
||||
m_DisplayPadFill = ! m_OptionsToolBar->GetToolState(id);
|
||||
DrawPanel->ReDraw(&dc, TRUE);
|
||||
break;
|
||||
case ID_TB_OPTIONS_SELECT_CURSOR:
|
||||
m_CursorShape = m_OptionsToolBar->GetToolState( id );
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
|
||||
m_DisplayViaFill = ! m_OptionsToolBar->GetToolState(id);
|
||||
DrawPanel->ReDraw(&dc, TRUE);
|
||||
break;
|
||||
case ID_TB_OPTIONS_SHOW_PADS_SKETCH:
|
||||
m_DisplayPadFill = !m_OptionsToolBar->GetToolState( id );
|
||||
DrawPanel->ReDraw( &dc, TRUE );
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH:
|
||||
m_DisplayModText =
|
||||
m_OptionsToolBar->GetToolState(id) ? SKETCH : FILLED;
|
||||
DrawPanel->ReDraw(&dc, TRUE);
|
||||
break;
|
||||
case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
|
||||
m_DisplayViaFill = !m_OptionsToolBar->GetToolState( id );
|
||||
DrawPanel->ReDraw( &dc, TRUE );
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH:
|
||||
m_DisplayModEdge =
|
||||
m_OptionsToolBar->GetToolState(id) ? SKETCH : FILLED;
|
||||
DrawPanel->ReDraw(&dc, TRUE);
|
||||
break;
|
||||
case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH:
|
||||
m_DisplayModText =
|
||||
m_OptionsToolBar->GetToolState( id ) ? SKETCH : FILLED;
|
||||
DrawPanel->ReDraw( &dc, TRUE );
|
||||
break;
|
||||
|
||||
default:
|
||||
DisplayError(this, wxT("WinEDA_ModuleEditFrame::OnSelectOptionToolbar error") );
|
||||
break;
|
||||
}
|
||||
case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH:
|
||||
m_DisplayModEdge =
|
||||
m_OptionsToolBar->GetToolState( id ) ? SKETCH : FILLED;
|
||||
DrawPanel->ReDraw( &dc, TRUE );
|
||||
break;
|
||||
|
||||
SetToolbars();
|
||||
DrawPanel->CursorOn(&dc);
|
||||
default:
|
||||
DisplayError( this,
|
||||
wxT( "WinEDA_ModuleEditFrame::OnSelectOptionToolbar error" ) );
|
||||
break;
|
||||
}
|
||||
|
||||
SetToolbars();
|
||||
DrawPanel->CursorOn( &dc );
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/***************************************************************************/
|
||||
/* moduleframe.cpp - fonctions de base de la classe WinEDA_ModuleEditFrame */
|
||||
/***************************************************************************/
|
||||
/************************************************************/
|
||||
/* moduleframe.cpp - Footprint (module) editor main window. */
|
||||
/************************************************************/
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
|
@ -20,132 +20,129 @@
|
|||
#include "3d_viewer.h"
|
||||
|
||||
|
||||
// local variables:
|
||||
static PCB_SCREEN* s_screenModule = NULL; // the PCB_SCREEN used by the footprint editor
|
||||
static PCB_SCREEN* s_screenModule = NULL; // the PCB_SCREEN used by the
|
||||
// footprint editor
|
||||
|
||||
|
||||
/********************************/
|
||||
/* class WinEDA_ModuleEditFrame */
|
||||
/********************************/
|
||||
BEGIN_EVENT_TABLE( WinEDA_ModuleEditFrame, WinEDA_BasePcbFrame )
|
||||
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START,
|
||||
ID_POPUP_PCB_ITEM_SELECTION_END,
|
||||
WinEDA_BasePcbFrame::ProcessItemSelection )
|
||||
EVT_CLOSE( WinEDA_ModuleEditFrame::OnCloseWindow )
|
||||
EVT_SIZE( WinEDA_ModuleEditFrame::OnSize )
|
||||
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START,
|
||||
ID_POPUP_PCB_ITEM_SELECTION_END,
|
||||
WinEDA_BasePcbFrame::ProcessItemSelection )
|
||||
EVT_CLOSE( WinEDA_ModuleEditFrame::OnCloseWindow )
|
||||
EVT_SIZE( WinEDA_ModuleEditFrame::OnSize )
|
||||
|
||||
EVT_KICAD_CHOICEBOX( ID_ON_ZOOM_SELECT, WinEDA_ModuleEditFrame::OnSelectZoom )
|
||||
EVT_KICAD_CHOICEBOX( ID_ON_GRID_SELECT, WinEDA_ModuleEditFrame::OnSelectGrid )
|
||||
EVT_KICAD_CHOICEBOX( ID_ON_ZOOM_SELECT,
|
||||
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,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_SAVE_LIBMODULE,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_DELETE_PART,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_NEW_MODULE,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_LOAD_MODULE,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_IMPORT_PART,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_EXPORT_PART,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_SHEET_SET,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_GEN_PRINT, WinEDA_ModuleEditFrame::ToPrinter )
|
||||
EVT_TOOL( ID_MODEDIT_LOAD_MODULE,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_CHECK,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_PAD_SETTINGS,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_LOAD_MODULE_FROM_BOARD,
|
||||
WinEDA_ModuleEditFrame::LoadModuleFromBoard )
|
||||
EVT_TOOL( ID_MODEDIT_INSERT_MODULE_IN_BOARD,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_UPDATE_MODULE_IN_BOARD,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_EDIT_MODULE_PROPERTIES,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_UNDO,
|
||||
WinEDA_ModuleEditFrame::GetComponentFromUndoList )
|
||||
EVT_TOOL( ID_MODEDIT_REDO,
|
||||
WinEDA_ModuleEditFrame::GetComponentFromRedoList )
|
||||
EVT_TOOL( ID_MODEDIT_SELECT_CURRENT_LIB,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_SAVE_LIBMODULE,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_DELETE_PART,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_NEW_MODULE,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_LOAD_MODULE,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_IMPORT_PART,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_EXPORT_PART,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_SHEET_SET,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_GEN_PRINT, WinEDA_ModuleEditFrame::ToPrinter )
|
||||
EVT_TOOL( ID_MODEDIT_LOAD_MODULE,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_CHECK,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_PAD_SETTINGS,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_LOAD_MODULE_FROM_BOARD,
|
||||
WinEDA_ModuleEditFrame::LoadModuleFromBoard )
|
||||
EVT_TOOL( ID_MODEDIT_INSERT_MODULE_IN_BOARD,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_UPDATE_MODULE_IN_BOARD,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_EDIT_MODULE_PROPERTIES,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_UNDO,
|
||||
WinEDA_ModuleEditFrame::GetComponentFromUndoList )
|
||||
EVT_TOOL( ID_MODEDIT_REDO,
|
||||
WinEDA_ModuleEditFrame::GetComponentFromRedoList )
|
||||
|
||||
// Vertical toolbar (left click):
|
||||
EVT_TOOL( ID_NO_SELECT_BUTT,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_ADD_PAD,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_PCB_ARC_BUTT,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_PCB_CIRCLE_BUTT,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_PCB_ADD_TEXT_BUTT,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_PCB_ADD_LINE_BUTT,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_DELETE_ITEM_BUTT,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_PLACE_ANCHOR,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
// Vertical toolbar (left click):
|
||||
EVT_TOOL( ID_NO_SELECT_BUTT,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_ADD_PAD,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_PCB_ARC_BUTT,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_PCB_CIRCLE_BUTT,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_PCB_ADD_TEXT_BUTT,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_PCB_ADD_LINE_BUTT,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_DELETE_ITEM_BUTT,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_MODEDIT_PLACE_ANCHOR,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
|
||||
// Vertical toolbar (right click):
|
||||
EVT_TOOL_RCLICKED( ID_MODEDIT_ADD_PAD,
|
||||
WinEDA_ModuleEditFrame::ToolOnRightClick )
|
||||
EVT_TOOL_RCLICKED( ID_TRACK_BUTT,
|
||||
WinEDA_ModuleEditFrame::ToolOnRightClick )
|
||||
EVT_TOOL_RCLICKED( ID_PCB_CIRCLE_BUTT,
|
||||
WinEDA_ModuleEditFrame::ToolOnRightClick )
|
||||
EVT_TOOL_RCLICKED( ID_PCB_ARC_BUTT,
|
||||
WinEDA_ModuleEditFrame::ToolOnRightClick )
|
||||
EVT_TOOL_RCLICKED( ID_PCB_ADD_TEXT_BUTT,
|
||||
WinEDA_ModuleEditFrame::ToolOnRightClick )
|
||||
EVT_TOOL_RCLICKED( ID_PCB_ADD_LINE_BUTT,
|
||||
WinEDA_ModuleEditFrame::ToolOnRightClick )
|
||||
EVT_TOOL_RCLICKED( ID_PCB_COTATION_BUTT,
|
||||
WinEDA_ModuleEditFrame::ToolOnRightClick )
|
||||
// Vertical toolbar (right click):
|
||||
EVT_TOOL_RCLICKED( ID_MODEDIT_ADD_PAD,
|
||||
WinEDA_ModuleEditFrame::ToolOnRightClick )
|
||||
EVT_TOOL_RCLICKED( ID_TRACK_BUTT,
|
||||
WinEDA_ModuleEditFrame::ToolOnRightClick )
|
||||
EVT_TOOL_RCLICKED( ID_PCB_CIRCLE_BUTT,
|
||||
WinEDA_ModuleEditFrame::ToolOnRightClick )
|
||||
EVT_TOOL_RCLICKED( ID_PCB_ARC_BUTT,
|
||||
WinEDA_ModuleEditFrame::ToolOnRightClick )
|
||||
EVT_TOOL_RCLICKED( ID_PCB_ADD_TEXT_BUTT,
|
||||
WinEDA_ModuleEditFrame::ToolOnRightClick )
|
||||
EVT_TOOL_RCLICKED( ID_PCB_ADD_LINE_BUTT,
|
||||
WinEDA_ModuleEditFrame::ToolOnRightClick )
|
||||
EVT_TOOL_RCLICKED( ID_PCB_COTATION_BUTT,
|
||||
WinEDA_ModuleEditFrame::ToolOnRightClick )
|
||||
|
||||
// Options Toolbar
|
||||
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
|
||||
WinEDA_ModuleEditFrame::OnSelectOptionToolbar )
|
||||
// Options Toolbar
|
||||
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
|
||||
WinEDA_ModuleEditFrame::OnSelectOptionToolbar )
|
||||
|
||||
// popup commands
|
||||
EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
// popup commands
|
||||
EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
|
||||
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
|
||||
// Transformations du module
|
||||
EVT_MENU( ID_MODEDIT_MODULE_ROTATE,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_MENU( ID_MODEDIT_MODULE_MIRROR,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
// Module transformations
|
||||
EVT_MENU( ID_MODEDIT_MODULE_ROTATE,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_MENU( ID_MODEDIT_MODULE_MIRROR,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
|
||||
EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_MENU( ID_PCB_PAD_SETUP,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_MENU( ID_PCB_USER_GRID_SETUP,
|
||||
WinEDA_PcbFrame::Process_Special_Functions )
|
||||
EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_MENU( ID_PCB_PAD_SETUP,
|
||||
WinEDA_ModuleEditFrame::Process_Special_Functions )
|
||||
EVT_MENU( ID_PCB_USER_GRID_SETUP,
|
||||
WinEDA_PcbFrame::Process_Special_Functions )
|
||||
|
||||
// Menu 3D Frame
|
||||
EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, WinEDA_ModuleEditFrame::Show3D_Frame )
|
||||
// Menu 3D 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()
|
||||
|
||||
|
||||
/****************/
|
||||
/* Constructeur */
|
||||
/****************/
|
||||
|
||||
WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
|
||||
const wxString& title,
|
||||
const wxPoint& pos,
|
||||
|
@ -189,54 +186,56 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
|
|||
if( DrawPanel )
|
||||
DrawPanel->m_Block_Enable = TRUE;
|
||||
#if defined(KICAD_AUIMANAGER)
|
||||
m_auimgr.SetManagedWindow(this);
|
||||
m_auimgr.SetManagedWindow( this );
|
||||
|
||||
wxAuiPaneInfo horiz;
|
||||
horiz.Gripper(false);
|
||||
horiz.DockFixed(true);
|
||||
horiz.Movable(false);
|
||||
horiz.Floatable(false);
|
||||
horiz.CloseButton(false);
|
||||
horiz.CaptionVisible(false);
|
||||
horiz.Gripper( false );
|
||||
horiz.DockFixed( true );
|
||||
horiz.Movable( false );
|
||||
horiz.Floatable( false );
|
||||
horiz.CloseButton( false );
|
||||
horiz.CaptionVisible( false );
|
||||
|
||||
wxAuiPaneInfo vert(horiz);
|
||||
wxAuiPaneInfo vert( horiz );
|
||||
|
||||
vert.TopDockable(false).BottomDockable(false);
|
||||
horiz.LeftDockable(false).RightDockable(false);
|
||||
vert.TopDockable( false ).BottomDockable( false );
|
||||
horiz.LeftDockable( false ).RightDockable( false );
|
||||
|
||||
m_auimgr.AddPane(m_HToolBar,
|
||||
wxAuiPaneInfo(horiz).Name(wxT("m_HToolBar")).Top().Row(0));
|
||||
m_auimgr.AddPane( m_HToolBar,
|
||||
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().
|
||||
Row( 0 ) );
|
||||
|
||||
m_auimgr.AddPane(m_AuxiliaryToolBar,
|
||||
wxAuiPaneInfo(horiz).Name(wxT("m_AuxiliaryToolBar")).Top().Row(1));
|
||||
m_auimgr.AddPane( m_AuxiliaryToolBar,
|
||||
wxAuiPaneInfo( horiz ).Name( wxT( "m_AuxiliaryToolBar" ) ).
|
||||
Top().Row( 1 ) );
|
||||
|
||||
m_auimgr.AddPane(m_VToolBar,
|
||||
wxAuiPaneInfo(vert).Name(wxT("m_VToolBar")).Right());
|
||||
m_auimgr.AddPane( m_VToolBar,
|
||||
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );
|
||||
|
||||
m_auimgr.AddPane(m_OptionsToolBar,
|
||||
wxAuiPaneInfo(vert).Name(wxT("m_OptionsToolBar")).Left());
|
||||
m_auimgr.AddPane( m_OptionsToolBar,
|
||||
wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).
|
||||
Left() );
|
||||
|
||||
m_auimgr.AddPane(DrawPanel,
|
||||
wxAuiPaneInfo().Name(wxT("DrawFrame")).CentrePane());
|
||||
m_auimgr.AddPane( DrawPanel,
|
||||
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
|
||||
|
||||
m_auimgr.AddPane(MsgPanel,
|
||||
wxAuiPaneInfo(horiz).Name(wxT("MsgPanel")).Bottom());
|
||||
m_auimgr.AddPane( MsgPanel,
|
||||
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
|
||||
|
||||
m_auimgr.Update();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
/****************************************************/
|
||||
WinEDA_ModuleEditFrame::~WinEDA_ModuleEditFrame()
|
||||
/****************************************************/
|
||||
{
|
||||
/* g_ModuleEditor_Pcb and its correspondinf PCB_SCREEN are not deleted here,
|
||||
* because if we reopen the Footprint editor, we expect to find the last edited item
|
||||
/* g_ModuleEditor_Pcb and its corresponding PCB_SCREEN are not deleted
|
||||
* 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)
|
||||
* the PCB_SCREEN handling g_ModuleEditor_Pcb
|
||||
SetBaseScreen( NULL ); /* Do not delete (by the destructor of
|
||||
* WinEDA_DrawFrame) the PCB_SCREEN handling
|
||||
* g_ModuleEditor_Pcb
|
||||
*/
|
||||
|
||||
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) GetParent();
|
||||
|
@ -245,9 +244,7 @@ WinEDA_ModuleEditFrame::~WinEDA_ModuleEditFrame()
|
|||
}
|
||||
|
||||
|
||||
/**************************************************************/
|
||||
void WinEDA_ModuleEditFrame::OnCloseWindow( wxCloseEvent& Event )
|
||||
/**************************************************************/
|
||||
{
|
||||
if( GetScreen()->IsModify() )
|
||||
{
|
||||
|
@ -286,7 +283,8 @@ void WinEDA_ModuleEditFrame::SetToolbars()
|
|||
active );
|
||||
m_HToolBar->EnableTool( ID_MODEDIT_SAVE_LIBMODULE, active && islib );
|
||||
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();
|
||||
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_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_UPDATE_MODULE_IN_BOARD, false );
|
||||
|
@ -317,8 +316,10 @@ void WinEDA_ModuleEditFrame::SetToolbars()
|
|||
|
||||
if( GetScreen() )
|
||||
{
|
||||
m_HToolBar->EnableTool( ID_MODEDIT_UNDO, GetScreen()->GetUndoCommandCount()>0 && active );
|
||||
m_HToolBar->EnableTool( ID_MODEDIT_REDO, GetScreen()->GetRedoCommandCount()>0 && active );
|
||||
m_HToolBar->EnableTool( ID_MODEDIT_UNDO,
|
||||
GetScreen()->GetUndoCommandCount()>0 && active );
|
||||
m_HToolBar->EnableTool( ID_MODEDIT_REDO,
|
||||
GetScreen()->GetRedoCommandCount()>0 && active );
|
||||
}
|
||||
|
||||
if( frame->GetBoard()->m_Modules )
|
||||
|
@ -344,22 +345,26 @@ void WinEDA_ModuleEditFrame::SetToolbars()
|
|||
|
||||
if( m_OptionsToolBar )
|
||||
{
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM,
|
||||
g_UnitMetric == MILLIMETRE ? TRUE : false );
|
||||
m_OptionsToolBar->ToggleTool(
|
||||
ID_TB_OPTIONS_SELECT_UNIT_MM,
|
||||
g_UnitMetric ==
|
||||
MILLIMETRE ? TRUE : false );
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH,
|
||||
g_UnitMetric == INCHES ? TRUE : false );
|
||||
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_POLAR_COORD,
|
||||
DisplayOpt.DisplayPolarCood );
|
||||
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_POLAR_COORD,
|
||||
DisplayOpt.DisplayPolarCood ?
|
||||
_( "Polar Coords not show" ) :
|
||||
_( "Display Polar Coords" ) );
|
||||
DisplayOpt.DisplayPolarCood ?
|
||||
_( "Display rectangular coordinates" ) :
|
||||
_( "Display polar coordinates" ) );
|
||||
|
||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID,
|
||||
m_Draw_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,
|
||||
|
@ -370,9 +375,9 @@ void WinEDA_ModuleEditFrame::SetToolbars()
|
|||
!m_DisplayPadFill );
|
||||
|
||||
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
|
||||
m_DisplayPadFill ?
|
||||
_( "Show Pads Sketch mode" ) :
|
||||
_( "Show pads filled mode" ) );
|
||||
m_DisplayPadFill ?
|
||||
_( "Show pads in sketch mode" ) :
|
||||
_( "Show pads in filled mode" ) );
|
||||
}
|
||||
|
||||
if( m_AuxiliaryToolBar )
|
||||
|
@ -401,7 +406,7 @@ void WinEDA_ModuleEditFrame::SetToolbars()
|
|||
|
||||
DisplayUnitsMsg();
|
||||
#if defined(KICAD_AUIMANAGER)
|
||||
if(m_auimgr.GetManagedWindow())
|
||||
if( m_auimgr.GetManagedWindow() )
|
||||
m_auimgr.Update();
|
||||
#endif
|
||||
}
|
||||
|
@ -456,25 +461,25 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
|||
|
||||
switch( g_KeyPressed )
|
||||
{
|
||||
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
|
||||
case WXK_NUMPAD8:
|
||||
case WXK_UP:
|
||||
Mouse.y -= wxRound( delta.y );
|
||||
DrawPanel->MouseTo( Mouse );
|
||||
break;
|
||||
|
||||
case WXK_NUMPAD2: /* Deplacement curseur vers le bas */
|
||||
case WXK_NUMPAD2:
|
||||
case WXK_DOWN:
|
||||
Mouse.y += wxRound( delta.y );
|
||||
DrawPanel->MouseTo( Mouse );
|
||||
break;
|
||||
|
||||
case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */
|
||||
case WXK_NUMPAD4:
|
||||
case WXK_LEFT:
|
||||
Mouse.x -= wxRound( delta.x );
|
||||
DrawPanel->MouseTo( Mouse );
|
||||
break;
|
||||
|
||||
case WXK_NUMPAD6: /* Deplacement curseur vers la droite */
|
||||
case WXK_NUMPAD6:
|
||||
case WXK_RIGHT:
|
||||
Mouse.x += wxRound( delta.x );
|
||||
DrawPanel->MouseTo( Mouse );
|
||||
|
@ -485,10 +490,7 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
|||
break;
|
||||
}
|
||||
|
||||
/* Recalcul de la position du curseur schema */
|
||||
GetScreen()->m_Curseur = curpos;
|
||||
|
||||
/* Placement sur la grille generale */
|
||||
PutOnGrid( &GetScreen()->m_Curseur );
|
||||
|
||||
if( oldpos != GetScreen()->m_Curseur )
|
||||
|
@ -517,5 +519,5 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
|||
}
|
||||
|
||||
SetToolbars();
|
||||
UpdateStatusBar(); /* Affichage des coord curseur */
|
||||
UpdateStatusBar();
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
/********************************************************/
|
||||
/* Modification de la place, orient, nombre des MODULES */
|
||||
/********************************************************/
|
||||
|
||||
/* Fichier MODULES.Cpp */
|
||||
/***************/
|
||||
/* modules.cpp */
|
||||
/***************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
|
@ -18,24 +16,20 @@
|
|||
|
||||
#include "drag.h"
|
||||
|
||||
/* fonctions externes */
|
||||
|
||||
/* Fonctions locales */
|
||||
static void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC );
|
||||
|
||||
/* Variables locales : */
|
||||
static MODULE* s_ModuleInitialCopy = NULL; // Copy of module for abort/undo command
|
||||
static PICKED_ITEMS_LIST s_PickedList; // a picked list to save initial module and dragged tracks
|
||||
|
||||
static MODULE* s_ModuleInitialCopy = NULL; // Copy of module for
|
||||
// abort/undo command
|
||||
static PICKED_ITEMS_LIST s_PickedList; // a picked list to
|
||||
// save initial module
|
||||
// and dragged tracks
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
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
|
||||
/* Show or hide module pads.
|
||||
*/
|
||||
void Show_Pads_On_Off( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module )
|
||||
{
|
||||
D_PAD* pt_pad;
|
||||
bool pad_fill_tmp;
|
||||
|
@ -55,11 +49,8 @@ void Show_Pads_On_Off( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module )
|
|||
}
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
/* Fonction appelee lors de l'activation/desactivation de la visualisation */
|
||||
/* du rastnest du module en deplacement */
|
||||
/* Effacement ou visu du rastnest selon conditions initiales */
|
||||
/***************************************************************************/
|
||||
/* Show or hide ratsnest
|
||||
*/
|
||||
void Rastnest_On_Off( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module )
|
||||
{
|
||||
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
|
||||
*/
|
||||
MODULE* WinEDA_BasePcbFrame::GetModuleByName()
|
||||
{
|
||||
wxString modulename;
|
||||
MODULE* module = NULL;
|
||||
|
||||
Get_Message( _( "Name:" ), _("Search footprint"), modulename, this );
|
||||
Get_Message( _( "Name:" ), _( "Search footprint" ), modulename, this );
|
||||
if( !modulename.IsEmpty() )
|
||||
{
|
||||
module = GetBoard()->m_Modules;
|
||||
|
@ -94,11 +82,8 @@ MODULE* WinEDA_BasePcbFrame::GetModuleByName()
|
|||
}
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
|
||||
/**********************************************************************/
|
||||
{
|
||||
|
||||
if( module == NULL )
|
||||
return;
|
||||
|
||||
|
@ -106,8 +91,8 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
|
|||
delete s_ModuleInitialCopy;
|
||||
|
||||
s_PickedList.ClearItemsList(); // Should be empty, but...
|
||||
// Creates a copy of the cuttent module, for abort and undo commands
|
||||
s_ModuleInitialCopy = new MODULE( GetBoard());
|
||||
// Creates a copy of the current module, for abort and undo commands
|
||||
s_ModuleInitialCopy = new MODULE( GetBoard() );
|
||||
s_ModuleInitialCopy->Copy( module );
|
||||
s_ModuleInitialCopy->m_Flags = 0;
|
||||
|
||||
|
@ -118,7 +103,7 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
|
|||
GetScreen()->m_Curseur = module->m_Pos;
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
|
||||
/* Effacement chevelu general si necessaire */
|
||||
/* Show ratsnest. */
|
||||
if( g_Show_Ratsnest )
|
||||
DrawGeneralRatsnest( DC );
|
||||
|
||||
|
@ -130,23 +115,25 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
|
|||
if( g_Drag_Pistes_On )
|
||||
{
|
||||
Build_Drag_Liste( DrawPanel, DC, module );
|
||||
ITEM_PICKER itemWrapper(NULL, UR_CHANGED);
|
||||
for( DRAG_SEGM* pt_drag = g_DragSegmentList; pt_drag != NULL; pt_drag = pt_drag->Pnext )
|
||||
ITEM_PICKER itemWrapper( NULL, UR_CHANGED );
|
||||
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_Link = segm->Copy();
|
||||
itemWrapper.m_Link->SetState( EDIT, OFF );
|
||||
s_PickedList.PushItem(itemWrapper);
|
||||
s_PickedList.PushItem( itemWrapper );
|
||||
}
|
||||
}
|
||||
|
||||
GetBoard()->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST;
|
||||
DrawPanel->ManageCurseur = Montre_Position_Empreinte;
|
||||
GetBoard()->m_Status_Pcb |= DO_NOT_SHOW_GENERAL_RASTNEST;
|
||||
DrawPanel->ManageCurseur = Montre_Position_Empreinte;
|
||||
DrawPanel->ForceCloseManageCurseur = Abort_MoveOrCopyModule;
|
||||
DrawPanel->m_AutoPAN_Request = TRUE;
|
||||
|
||||
// effacement module a l'ecran:
|
||||
// Erase the module.
|
||||
if( DC )
|
||||
{
|
||||
int tmp = module->m_Flags;
|
||||
|
@ -155,22 +142,18 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
|
|||
module->m_Flags = tmp;
|
||||
}
|
||||
|
||||
// Reaffichage
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************/
|
||||
void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||
/****************************************************************/
|
||||
|
||||
/* Called on a move or copy module command abort
|
||||
*/
|
||||
void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||
{
|
||||
DRAG_SEGM* pt_drag;
|
||||
TRACK* pt_segm;
|
||||
MODULE* module;
|
||||
WinEDA_PcbFrame* pcbframe = (WinEDA_PcbFrame*) Panel->m_Parent;
|
||||
DRAG_SEGM* pt_drag;
|
||||
TRACK* pt_segm;
|
||||
MODULE* module;
|
||||
WinEDA_PcbFrame* pcbframe = (WinEDA_PcbFrame*) Panel->m_Parent;
|
||||
|
||||
module = (MODULE*) pcbframe->GetScreen()->GetCurItem();
|
||||
pcbframe->GetBoard()->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK;
|
||||
|
@ -181,7 +164,7 @@ void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC )
|
|||
DrawModuleOutlines( Panel, DC, module );
|
||||
|
||||
/* If a move command: return to old position
|
||||
* If a copy command, delete the new footprint
|
||||
* If a copy command, delete the new footprint
|
||||
*/
|
||||
if( module->m_Flags & IS_MOVED ) // Move command
|
||||
{
|
||||
|
@ -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( 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() )
|
||||
pcbframe->Change_Side_Module( module, NULL );
|
||||
module->Draw( Panel, DC, GR_OR );
|
||||
|
@ -236,22 +222,20 @@ void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC )
|
|||
s_ModuleInitialCopy = NULL;
|
||||
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 )
|
||||
pcbframe->DrawGeneralRatsnest( DC );
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************/
|
||||
MODULE* WinEDA_BasePcbFrame::Copie_Module( MODULE* module )
|
||||
/**********************************************************/
|
||||
|
||||
/**
|
||||
* Function Copie_Module
|
||||
* Copy an existing footprint. The ne footprint is added in module list
|
||||
* Function Copie_Module
|
||||
* Copy an existing footprint. The new footprint is added in module list
|
||||
* @param module = footprint to copy
|
||||
* @return a pointer on the new footprint (the copy of the existing footprint)
|
||||
*/
|
||||
MODULE* WinEDA_BasePcbFrame::Copie_Module( MODULE* module )
|
||||
{
|
||||
MODULE* newmodule;
|
||||
|
||||
|
@ -260,7 +244,7 @@ MODULE* WinEDA_BasePcbFrame::Copie_Module( MODULE* module )
|
|||
|
||||
GetScreen()->SetModify();
|
||||
|
||||
/* Duplication du module */
|
||||
/* Duplicate module */
|
||||
GetBoard()->m_Status_Pcb = 0;
|
||||
newmodule = new MODULE( GetBoard() );
|
||||
newmodule->Copy( module );
|
||||
|
@ -277,25 +261,22 @@ MODULE* WinEDA_BasePcbFrame::Copie_Module( MODULE* module )
|
|||
}
|
||||
|
||||
|
||||
/**********************************************************************************/
|
||||
void Montre_Position_Empreinte( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||
/**********************************************************************************/
|
||||
|
||||
/* redessin du contour de l'empreinte lors des deplacements de la souris
|
||||
/* Redraw the footprint when moving the mouse.
|
||||
*/
|
||||
void Montre_Position_Empreinte( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||
{
|
||||
MODULE* module = (MODULE*) panel->GetScreen()->GetCurItem();
|
||||
|
||||
if( module == NULL )
|
||||
return;
|
||||
|
||||
/* efface ancienne position */
|
||||
/* Erase current footprint. */
|
||||
if( erase )
|
||||
{
|
||||
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;
|
||||
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
|
||||
* Remove a footprint from m_Modules linked list and put it in undelete buffer
|
||||
* The rastnest and pad list are recalcualed
|
||||
* Function Delete Module
|
||||
* Remove a footprint from m_Modules linked list and put it in undelete buffer
|
||||
* The ratsnest and pad list are recalculated
|
||||
* @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
|
||||
*/
|
||||
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 )
|
||||
return FALSE;
|
||||
|
||||
/* Confirmation de l'effacement */
|
||||
module->DisplayInfo( this );
|
||||
|
||||
/* Confirm module delete. */
|
||||
if( aAskBeforeDeleting )
|
||||
{
|
||||
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();
|
||||
|
||||
/* Erase rastnest if needed
|
||||
* Dirty rectangle is not used here because usually using a XOR draw mode gives good results (very few artefacts) for ratsnest
|
||||
/* Erase ratsnest if needed
|
||||
* 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 )
|
||||
DrawGeneralRatsnest( DC );
|
||||
|
@ -354,36 +335,34 @@ bool WinEDA_PcbFrame::Delete_Module( MODULE* module, wxDC* DC, bool aAskBeforeDe
|
|||
// redraw the area where the module was
|
||||
if( DC )
|
||||
DrawPanel->PostDirtyRect( module->GetBoundingBox() );
|
||||
RedrawActiveWindow( DC, TRUE);
|
||||
RedrawActiveWindow( DC, TRUE );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
void WinEDA_PcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
|
||||
/****************************************************************************/
|
||||
|
||||
/**
|
||||
* 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
|
||||
* 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)
|
||||
* @param Module the footprint to flip
|
||||
* @param DC Current Device Context. if NULL, no redraw
|
||||
*/
|
||||
void WinEDA_PcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
|
||||
{
|
||||
|
||||
if( Module == NULL )
|
||||
return;
|
||||
if( (Module->GetLayer() != CMP_N) && (Module->GetLayer() != COPPER_LAYER_N) )
|
||||
if( ( Module->GetLayer() != CMP_N )
|
||||
&& ( Module->GetLayer() != COPPER_LAYER_N ) )
|
||||
return;
|
||||
|
||||
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 )
|
||||
{
|
||||
int tmp = Module->m_Flags;
|
||||
|
@ -392,17 +371,16 @@ void WinEDA_PcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
|
|||
Module->m_Flags = tmp;
|
||||
}
|
||||
|
||||
/* Effacement chevelu general si necessaire */
|
||||
/* Show ratsnest if necessary. */
|
||||
if( DC && g_Show_Ratsnest )
|
||||
DrawGeneralRatsnest( DC );
|
||||
|
||||
/* Init des variables utilisees dans la routine Dessine_Drag_segment() */
|
||||
g_Offset_Module.x = 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 )
|
||||
{
|
||||
DrawModuleOutlines( DrawPanel, DC, Module );
|
||||
|
@ -415,13 +393,11 @@ void WinEDA_PcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
|
|||
|
||||
Module->DisplayInfo( this );
|
||||
|
||||
if( !(Module->m_Flags & IS_MOVED) ) /* Inversion simple */
|
||||
if( !( Module->m_Flags & IS_MOVED ) ) /* Inversion simple */
|
||||
{
|
||||
if( DC )
|
||||
{
|
||||
Module->Draw( DrawPanel, DC, GR_OR );
|
||||
|
||||
/* affichage chevelu general si necessaire */
|
||||
Compile_Ratsnest( DC, true );
|
||||
}
|
||||
}
|
||||
|
@ -437,21 +413,17 @@ void WinEDA_PcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
|
|||
}
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
void WinEDA_BasePcbFrame::Place_Module( MODULE* module, wxDC* DC, bool aDoNotRecreateRatsnest )
|
||||
/*****************************************************************/
|
||||
|
||||
/* 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
|
||||
/* Place module at cursor position.
|
||||
*
|
||||
* DC (if NULL: no display screen has the output.
|
||||
* Update module coordinates with the new position.
|
||||
*/
|
||||
void WinEDA_BasePcbFrame::Place_Module( MODULE* module,
|
||||
wxDC* DC,
|
||||
bool aDoNotRecreateRatsnest )
|
||||
{
|
||||
TRACK* pt_segm;
|
||||
wxPoint newpos;
|
||||
TRACK* pt_segm;
|
||||
wxPoint newpos;
|
||||
|
||||
if( module == 0 )
|
||||
return;
|
||||
|
@ -459,41 +431,45 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module, wxDC* DC, bool aDoNotRec
|
|||
GetScreen()->SetModify();
|
||||
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 ) )
|
||||
{
|
||||
ITEM_PICKER picker(module, UR_CHANGED);
|
||||
ITEM_PICKER picker( module, UR_CHANGED );
|
||||
picker.m_Link = s_ModuleInitialCopy;
|
||||
s_PickedList.PushItem(picker);
|
||||
s_ModuleInitialCopy = NULL; // the picker is now owner of s_ModuleInitialCopy.
|
||||
s_PickedList.PushItem( picker );
|
||||
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,
|
||||
// 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();
|
||||
}
|
||||
|
||||
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 );
|
||||
|
||||
newpos = GetScreen()->m_Curseur;
|
||||
|
||||
module->SetPosition( newpos );
|
||||
|
||||
if( DC )
|
||||
module->Draw( DrawPanel, DC, GR_OR );
|
||||
|
||||
|
||||
if( g_DragSegmentList )
|
||||
{
|
||||
/* 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->SetState( EDIT, OFF );
|
||||
|
@ -508,7 +484,7 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module, wxDC* DC, bool aDoNotRec
|
|||
Compile_Ratsnest( DC, true );
|
||||
|
||||
if( DC )
|
||||
RedrawActiveWindow( DC, TRUE);
|
||||
RedrawActiveWindow( DC, TRUE );
|
||||
|
||||
module->DisplayInfo( this );
|
||||
|
||||
|
@ -522,41 +498,37 @@ 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,
|
||||
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 )
|
||||
return;
|
||||
|
||||
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
|
||||
{
|
||||
int tmp = module->m_Flags;
|
||||
module->m_Flags |= DO_NOT_DRAW;
|
||||
DrawPanel->PostDirtyRect( module->GetBoundingBox() );
|
||||
module->m_Flags = tmp;
|
||||
|
||||
/* Reaffichage chevelu general si necessaire */
|
||||
if( g_Show_Ratsnest )
|
||||
DrawGeneralRatsnest( DC );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* reaffiche module en mouvement */
|
||||
if( DC )
|
||||
{
|
||||
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 )
|
||||
module->SetOrientation( module->m_Orient + angle );
|
||||
|
@ -575,28 +547,25 @@ void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module,
|
|||
|
||||
if( DC )
|
||||
{
|
||||
if( !(module->m_Flags & IS_MOVED) ) /* Rotation simple */
|
||||
if( !( module->m_Flags & IS_MOVED ) ) /* Rotation simple */
|
||||
{
|
||||
module->Draw( DrawPanel, DC, GR_OR );
|
||||
|
||||
/* Reaffichage chevelu general si necessaire */
|
||||
Compile_Ratsnest( DC, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* reaffiche module en mouvement */
|
||||
DrawModuleOutlines( DrawPanel, DC, module );
|
||||
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 )
|
||||
{
|
||||
int pad_fill_tmp;
|
||||
|
@ -610,7 +579,7 @@ void DrawModuleOutlines( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module )
|
|||
{
|
||||
pad_fill_tmp = DisplayOpt.DisplayPadFill;
|
||||
#ifndef __WXMAC__
|
||||
DisplayOpt.DisplayPadFill = true; /* Trace en SKETCH en deplacement */
|
||||
DisplayOpt.DisplayPadFill = true;
|
||||
#else
|
||||
DisplayOpt.DisplayPadFill = false;
|
||||
#endif
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*************************/
|
||||
/* Edition des Pastilles */
|
||||
/*************************/
|
||||
/************************/
|
||||
/* Edit footprint pads. */
|
||||
/************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
|
@ -15,21 +15,14 @@
|
|||
|
||||
#include "protos.h"
|
||||
|
||||
/* Routines Locales */
|
||||
|
||||
/* Variables locales */
|
||||
static D_PAD* s_CurrentSelectedPad; /* pointeur sur le pad selecte pour edition */
|
||||
static D_PAD* s_CurrentSelectedPad;
|
||||
static wxPoint Pad_OldPos;
|
||||
|
||||
|
||||
/************************************************************/
|
||||
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
|
||||
/* Cancel move pad command.
|
||||
*/
|
||||
static void Exit_Move_Pad( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||
{
|
||||
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_Pos = Pad_OldPos;
|
||||
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 )
|
||||
{
|
||||
/* Effacement des segments dragges */
|
||||
DRAG_SEGM* pt_drag = g_DragSegmentList;
|
||||
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 )
|
||||
/*************************************************************************/
|
||||
/* Affiche le pad et les pistes en mode drag lors des deplacements du pad */
|
||||
{
|
||||
TRACK* Track;
|
||||
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 )
|
||||
return;
|
||||
|
||||
/* Tracage des segments dragges */
|
||||
pt_drag = g_DragSegmentList;
|
||||
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 )
|
|||
}
|
||||
|
||||
|
||||
/*************************************************************/
|
||||
void WinEDA_BasePcbFrame::Export_Pad_Settings( D_PAD* pt_pad )
|
||||
/*************************************************************/
|
||||
|
||||
/* Charge en liste des caracteristiques par defaut celles du pad selecte
|
||||
/* Load list of features for default pad selection.
|
||||
*/
|
||||
void WinEDA_BasePcbFrame::Export_Pad_Settings( D_PAD* pt_pad )
|
||||
{
|
||||
MODULE* Module;
|
||||
|
||||
|
@ -133,15 +121,12 @@ void WinEDA_BasePcbFrame::Export_Pad_Settings( D_PAD* pt_pad )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
void WinEDA_BasePcbFrame::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
|
||||
/***********************************************************************/
|
||||
|
||||
/* 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
|
||||
/* Imports the new values of dimensions of the pad edge by pt_pad
|
||||
* - Source: selected values of general characteristics
|
||||
* - Measurements are modified
|
||||
* - The position, names, and keys are not.
|
||||
*/
|
||||
void WinEDA_BasePcbFrame::Import_Pad_Settings( D_PAD* aPad, bool 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_DrillShape = g_Pad_Master.m_DrillShape;
|
||||
|
||||
/* Traitement des cas particuliers : */
|
||||
switch( g_Pad_Master.m_PadShape )
|
||||
{
|
||||
case PAD_TRAPEZOID:
|
||||
|
@ -186,14 +170,14 @@ void WinEDA_BasePcbFrame::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
|
|||
|
||||
if( aDraw )
|
||||
DrawPanel->PostDirtyRect( aPad->GetBoundingBox() );
|
||||
|
||||
( (MODULE*) aPad->GetParent() )->m_LastEdit_Time = time( NULL );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************/
|
||||
/* Add a pad on the selected module.
|
||||
*/
|
||||
void WinEDA_BasePcbFrame::AddPad( MODULE* Module, bool draw )
|
||||
/***********************************************************/
|
||||
/* Routine d'ajout d'un pad sur l'module selectionnee */
|
||||
{
|
||||
D_PAD* Pad;
|
||||
int rX, rY;
|
||||
|
@ -203,10 +187,10 @@ void WinEDA_BasePcbFrame::AddPad( MODULE* Module, bool draw )
|
|||
|
||||
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 );
|
||||
|
||||
/* Mise a jour des caract de la pastille : */
|
||||
/* Update the pad properties. */
|
||||
Import_Pad_Settings( Pad, false );
|
||||
Pad->SetNetname( wxEmptyString );
|
||||
|
||||
|
@ -220,12 +204,14 @@ void WinEDA_BasePcbFrame::AddPad( MODULE* Module, bool draw )
|
|||
Pad->m_Pos0.x = rX;
|
||||
Pad->m_Pos0.y = rY;
|
||||
|
||||
/* Increment automatique de la reference courante Current_PadName */
|
||||
long num = 0; int ponder = 1;
|
||||
/* Automatically increment the current pad number and name. */
|
||||
long num = 0;
|
||||
int ponder = 1;
|
||||
|
||||
while( g_Current_PadName.Len() && g_Current_PadName.Last() >= '0'
|
||||
&& g_Current_PadName.Last() <= '9' )
|
||||
{
|
||||
num += (g_Current_PadName.Last() - '0') * ponder;
|
||||
num += ( g_Current_PadName.Last() - '0' ) * ponder;
|
||||
g_Current_PadName.RemoveLast();
|
||||
ponder *= 10;
|
||||
}
|
||||
|
@ -234,7 +220,6 @@ void WinEDA_BasePcbFrame::AddPad( MODULE* Module, bool draw )
|
|||
g_Current_PadName << num;
|
||||
Pad->SetPadName( g_Current_PadName );
|
||||
|
||||
/* Redessin du module */
|
||||
Module->Set_Rectangle_Encadrement();
|
||||
Pad->DisplayInfo( this );
|
||||
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 )
|
||||
/*********************************************************/
|
||||
/* Function to delete the pad "pad" */
|
||||
{
|
||||
MODULE* Module;
|
||||
wxString line;
|
||||
|
@ -257,8 +240,8 @@ void WinEDA_BasePcbFrame::DeletePad( D_PAD* Pad )
|
|||
Module->m_LastEdit_Time = time( NULL );
|
||||
|
||||
line.Printf( _( "Delete Pad (module %s %s) " ),
|
||||
GetChars( Module->m_Reference->m_Text ),
|
||||
GetChars( Module->m_Value->m_Text ) );
|
||||
GetChars( Module->m_Reference->m_Text ),
|
||||
GetChars( Module->m_Value->m_Text ) );
|
||||
if( !IsOK( this, line ) )
|
||||
return;
|
||||
|
||||
|
@ -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 )
|
||||
/*************************************************************/
|
||||
/* Function to initialise the "move pad" command */
|
||||
{
|
||||
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 )
|
||||
/*********************************************************/
|
||||
/* Routine to Place a moved pad */
|
||||
{
|
||||
int dX, dY;
|
||||
TRACK* Track;
|
||||
|
@ -322,8 +301,10 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
|
|||
ITEM_PICKER picker( NULL, UR_CHANGED );
|
||||
PICKED_ITEMS_LIST pickList;
|
||||
|
||||
/* Save dragged track segments in undo list */
|
||||
for( DRAG_SEGM* pt_drag = g_DragSegmentList; pt_drag; pt_drag = pt_drag->Pnext )
|
||||
/* Save dragged track segments in undo list */
|
||||
for( DRAG_SEGM* pt_drag = g_DragSegmentList;
|
||||
pt_drag;
|
||||
pt_drag = pt_drag->Pnext )
|
||||
{
|
||||
Track = pt_drag->m_Segm;
|
||||
|
||||
|
@ -355,13 +336,13 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
|
|||
if( g_DragSegmentList )
|
||||
SaveCopyInUndoList( pickList, UR_CHANGED );
|
||||
|
||||
/* Placement du pad */
|
||||
Pad->m_Pos = pad_curr_position;
|
||||
|
||||
Pad->Draw( DrawPanel, DC, GR_XOR );
|
||||
|
||||
/* 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;
|
||||
|
||||
|
@ -376,7 +357,8 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
|
|||
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;
|
||||
dY = Pad->m_Pos.y - Pad_OldPos.y;
|
||||
RotatePoint( &dX, &dY, -Module->m_Orient );
|
||||
|
@ -392,23 +374,18 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
|
|||
Module->Set_Rectangle_Encadrement();
|
||||
Module->m_LastEdit_Time = time( NULL );
|
||||
|
||||
|
||||
EraseDragListe();
|
||||
|
||||
GetScreen()->SetModify();
|
||||
DrawPanel->ManageCurseur = 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 );
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************/
|
||||
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
|
||||
/* Rotate selected pad 90 degrees.
|
||||
*/
|
||||
void WinEDA_BasePcbFrame::RotatePad( D_PAD* Pad, wxDC* DC )
|
||||
{
|
||||
MODULE* Module;
|
||||
|
||||
|
@ -429,12 +406,10 @@ void WinEDA_BasePcbFrame::RotatePad( D_PAD* Pad, wxDC* DC )
|
|||
Pad->m_Offset.y = -Pad->m_Offset.y;
|
||||
|
||||
EXCHG( Pad->m_DeltaSize.x, Pad->m_DeltaSize.y );
|
||||
Pad->m_DeltaSize.x = -Pad->m_DeltaSize.x; /* ceci est la variation
|
||||
* de la dim Y sur l'axe X */
|
||||
|
||||
Pad->m_DeltaSize.x = -Pad->m_DeltaSize.x;
|
||||
Module->Set_Rectangle_Encadrement();
|
||||
|
||||
Pad->DisplayInfo( this );
|
||||
|
||||
if( DC )
|
||||
Module->Draw( DrawPanel, DC, GR_OR );
|
||||
}
|
||||
|
|
|
@ -18,37 +18,39 @@
|
|||
#include "protos.h"
|
||||
|
||||
|
||||
/* local functions */
|
||||
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 bool InitialiseDragParameters();
|
||||
|
||||
/* variables locales */
|
||||
|
||||
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 Old_HightLigth_NetCode;
|
||||
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_MovingSegment_Yorg; //slope and intercept parameters of lines
|
||||
bool s_StartPointVertical, s_EndPointVertical,
|
||||
s_MovingSegmentVertical, s_MovingSegmentHorizontal,
|
||||
s_StartPointHorizontal, s_EndPointHorizontal; // vertical or horizontal line indicators
|
||||
bool s_StartSegmentPresent, s_EndSegmentPresent;
|
||||
bool s_StartPointVertical, s_EndPointVertical,
|
||||
s_MovingSegmentVertical, s_MovingSegmentHorizontal,
|
||||
s_StartPointHorizontal, s_EndPointHorizontal; // vertical or
|
||||
// horizontal line
|
||||
// indicators
|
||||
bool s_StartSegmentPresent, s_EndSegmentPresent;
|
||||
|
||||
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;
|
||||
int ii;
|
||||
int ii;
|
||||
|
||||
/* Erase the current drawings */
|
||||
wxPoint oldpos = Panel->GetScreen()->m_Curseur;
|
||||
|
@ -60,9 +62,10 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
|
|||
|
||||
Panel->GetScreen()->m_Curseur = oldpos;
|
||||
g_HightLigt_Status = FALSE;
|
||||
( (WinEDA_PcbFrame*) Panel->m_Parent )->GetBoard()->DrawHighLight( Panel,
|
||||
DC,
|
||||
g_HightLigth_NetCode );
|
||||
( (WinEDA_PcbFrame*) Panel->m_Parent )->GetBoard()->DrawHighLight(
|
||||
Panel,
|
||||
DC,
|
||||
g_HightLigth_NetCode );
|
||||
|
||||
if( NewTrack )
|
||||
{
|
||||
|
@ -77,7 +80,7 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
|
|||
delete NewTrack;
|
||||
}
|
||||
}
|
||||
else /* Move : remise en ancienne position */
|
||||
else /* Move existing trace. */
|
||||
{
|
||||
TRACK* Track = NewTrack;
|
||||
int dx = s_LastPos.x - PosInit.x;
|
||||
|
@ -106,7 +109,7 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
|
|||
Panel->ForceCloseManageCurseur = 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;
|
||||
for( ; pt_drag != NULL; pt_drag = pt_drag->Pnext )
|
||||
{
|
||||
|
@ -123,21 +126,20 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
|
|||
g_HightLigth_NetCode = Old_HightLigth_NetCode;
|
||||
g_HightLigt_Status = Old_HightLigt_Status;
|
||||
if( g_HightLigt_Status )
|
||||
( (WinEDA_PcbFrame*) Panel->m_Parent )->GetBoard()->DrawHighLight( Panel,
|
||||
DC,
|
||||
g_HightLigth_NetCode );
|
||||
( (WinEDA_PcbFrame*) Panel->m_Parent )->GetBoard()->DrawHighLight(
|
||||
Panel,
|
||||
DC,
|
||||
g_HightLigth_NetCode );
|
||||
|
||||
EraseDragListe();
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
static void Show_MoveNode( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||
/*************************************************************************/
|
||||
/* Redraw the moved node according to the mouse cursor position */
|
||||
static void Show_MoveNode( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||
{
|
||||
int ii;
|
||||
wxPoint moveVector;
|
||||
wxPoint moveVector;
|
||||
TRACK* Track;
|
||||
BASE_SCREEN* screen = panel->GetScreen();
|
||||
int track_fill_copy = DisplayOpt.DisplayPcbTrackFill;
|
||||
|
@ -158,7 +160,7 @@ static void Show_MoveNode( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
|||
wxPoint Pos = screen->m_Curseur;
|
||||
|
||||
moveVector = Pos - s_LastPos;
|
||||
s_LastPos = Pos;
|
||||
s_LastPos = Pos;
|
||||
|
||||
ii = NbPtNewTrack;
|
||||
Track = NewTrack;
|
||||
|
@ -190,21 +192,19 @@ static void Show_MoveNode( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
|||
}
|
||||
|
||||
DisplayOpt.DisplayPcbTrackFill = track_fill_copy;
|
||||
|
||||
// Display track length
|
||||
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->m_Parent;
|
||||
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->m_Parent;
|
||||
Track->DisplayInfo( frame );
|
||||
}
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
|
||||
wxDC* DC, bool erase )
|
||||
/*************************************************************************/
|
||||
|
||||
/* drawing the track segment movement
|
||||
* > s_MovingSegmentSlope slope = moving track segment slope
|
||||
* > s_StartSegmentSlope slope = slope of the segment connected to the start point of the moving segment
|
||||
* > s_EndSegmentSlope slope = slope of the segment connected to the end point of the moving segment
|
||||
* > s_StartSegmentSlope slope = slope of the segment connected to the start
|
||||
* point of the moving segment
|
||||
* > s_EndSegmentSlope slope = slope of the segment connected to the end point
|
||||
* of the moving segment
|
||||
*
|
||||
* moved segment function :
|
||||
* yt=s_MovingSegmentSlope * x + s_MovingSegment_Yorg
|
||||
|
@ -217,13 +217,15 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
|
|||
*
|
||||
* first intersection point will be located at
|
||||
* 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
|
||||
* or yi1=s_StartSegmentSlope*xi1+s_MovingSegment_Yorg
|
||||
*
|
||||
* second intersection point
|
||||
* 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
|
||||
* 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
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
*
|
||||
* Slope parametres are computed once, because they can become undetermined when moving segments
|
||||
* (i.e. when a segment lenght is 0) and we want keep them constant
|
||||
* Slope parameters are computed once, because they can become undetermined
|
||||
* 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 tx1, tx2, ty1, ty2; // temporary storage of points
|
||||
double xi1 = 0, yi1 = 0, xi2 = 0, yi2 = 0; // calculated
|
||||
// intersection points
|
||||
double tx1, tx2, ty1, ty2; // temporary storage of
|
||||
// points
|
||||
int dx, dy;
|
||||
BASE_SCREEN* screen = panel->GetScreen();
|
||||
bool update = true;
|
||||
|
@ -259,13 +265,17 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
|
|||
{
|
||||
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;
|
||||
}
|
||||
if( s_StartSegmentPresent )
|
||||
{
|
||||
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
|
||||
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 -
|
||||
s_EndSegment_Yorg) / (s_EndSegmentSlope - s_MovingSegmentSlope);
|
||||
xi2 = ( s_MovingSegment_Yorg - s_EndSegment_Yorg )
|
||||
/ ( s_EndSegmentSlope - s_MovingSegmentSlope );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -329,13 +339,13 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
|
|||
|
||||
if( !s_MovingSegmentVertical )
|
||||
{
|
||||
yi2 = s_MovingSegmentSlope * (xi2) + s_MovingSegment_Yorg;
|
||||
yi2 = s_MovingSegmentSlope * ( xi2 ) + s_MovingSegment_Yorg;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !s_EndPointVertical )
|
||||
{
|
||||
yi2 = s_EndSegmentSlope * (xi2) + s_EndSegment_Yorg;
|
||||
yi2 = s_EndSegmentSlope * ( xi2 ) + s_EndSegment_Yorg;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -345,15 +355,15 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
|
|||
}
|
||||
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 -
|
||||
s_StartSegment_Yorg) / (s_StartSegmentSlope - s_MovingSegmentSlope);
|
||||
xi1 = ( s_MovingSegment_Yorg - s_StartSegment_Yorg )
|
||||
/ ( s_StartSegmentSlope - s_MovingSegmentSlope );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -380,13 +390,13 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
|
|||
|
||||
if( !s_MovingSegmentVertical )
|
||||
{
|
||||
yi1 = s_MovingSegmentSlope * (xi1) + s_MovingSegment_Yorg;
|
||||
yi1 = s_MovingSegmentSlope * ( xi1 ) + s_MovingSegment_Yorg;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( !s_StartPointVertical )
|
||||
{
|
||||
yi1 = s_StartSegmentSlope * (xi1) + s_StartSegment_Yorg;
|
||||
yi1 = s_StartSegmentSlope * ( xi1 ) + s_StartSegment_Yorg;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -396,7 +406,7 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
|
|||
}
|
||||
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 );
|
||||
if( tSegmentToEnd )
|
||||
tSegmentToEnd->Draw( panel, DC, draw_mode );
|
||||
|
||||
// Display track length
|
||||
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->m_Parent;
|
||||
WinEDA_BasePcbFrame* frame = (WinEDA_BasePcbFrame*) panel->m_Parent;
|
||||
Track->DisplayInfo( frame );
|
||||
}
|
||||
|
||||
|
||||
/**********************************/
|
||||
bool InitialiseDragParameters()
|
||||
/**********************************/
|
||||
|
||||
/* Init variables (slope, Y intersect point, flags) for 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
|
||||
* (2 colinear segments)
|
||||
*/
|
||||
bool InitialiseDragParameters()
|
||||
{
|
||||
double tx1, tx2, ty1, ty2; // temporary storage of points
|
||||
TRACK* Track;
|
||||
|
@ -473,27 +482,31 @@ bool InitialiseDragParameters()
|
|||
{
|
||||
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;
|
||||
}
|
||||
if( s_StartSegmentPresent )
|
||||
{
|
||||
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
|
||||
//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_EndPointVertical = false;
|
||||
s_EndPointVertical = false;
|
||||
s_MovingSegmentVertical = false;
|
||||
s_StartPointHorizontal = false;
|
||||
s_EndPointHorizontal = false;
|
||||
s_MovingSegmentHorizontal = false;
|
||||
|
||||
|
||||
// Init parameters for the starting point of the moved segment
|
||||
if( tSegmentToStart )
|
||||
{
|
||||
|
@ -512,7 +525,8 @@ bool InitialiseDragParameters()
|
|||
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;
|
||||
ty1 = (double) Track->m_Start.y;
|
||||
|
@ -520,16 +534,16 @@ bool InitialiseDragParameters()
|
|||
ty2 = (double) Track->m_End.y;
|
||||
RotatePoint( &tx2, &ty2, tx1, ty1, 900 );
|
||||
}
|
||||
if( tx1!=tx2 )
|
||||
if( tx1 != tx2 )
|
||||
{
|
||||
s_StartSegmentSlope = (ty2 - ty1) / (tx2 - tx1);
|
||||
s_StartSegment_Yorg = ty1 - (ty2 - ty1) * tx1 / (tx2 - tx1);
|
||||
s_StartSegmentSlope = ( ty2 - ty1 ) / ( tx2 - tx1 );
|
||||
s_StartSegment_Yorg = ty1 - ( ty2 - ty1 ) * tx1 / ( tx2 - tx1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
s_StartPointVertical = true; //signal first segment vertical
|
||||
}
|
||||
if( ty1==ty2 )
|
||||
if( ty1 == ty2 )
|
||||
{
|
||||
s_StartPointHorizontal = true;
|
||||
}
|
||||
|
@ -554,7 +568,8 @@ bool InitialiseDragParameters()
|
|||
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;
|
||||
ty1 = (double) Track->m_End.y;
|
||||
|
@ -563,36 +578,35 @@ bool InitialiseDragParameters()
|
|||
RotatePoint( &tx2, &ty2, tx1, ty1, -900 );
|
||||
}
|
||||
|
||||
if( tx2!=tx1 )
|
||||
if( tx2 != tx1 )
|
||||
{
|
||||
s_EndSegmentSlope = (ty2 - ty1) / (tx2 - tx1);
|
||||
s_EndSegment_Yorg = ty1 - (ty2 - ty1) * tx1 / (tx2 - tx1);
|
||||
s_EndSegmentSlope = ( ty2 - ty1 ) / ( tx2 - tx1 );
|
||||
s_EndSegment_Yorg = ty1 - ( ty2 - ty1 ) * tx1 / ( tx2 - tx1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
s_EndPointVertical = true; //signal second segment vertical
|
||||
}
|
||||
if( ty1==ty2 )
|
||||
if( ty1 == ty2 )
|
||||
{
|
||||
s_EndPointHorizontal = true;
|
||||
}
|
||||
|
||||
|
||||
// Init parameters for the moved segment
|
||||
|
||||
tx1 = (double) Track->m_Start.x;
|
||||
ty1 = (double) Track->m_Start.y;
|
||||
tx2 = (double) Track->m_End.x;
|
||||
ty2 = (double) Track->m_End.y;
|
||||
|
||||
if( tx2 != tx1 )
|
||||
{
|
||||
s_MovingSegmentSlope = (ty2 - ty1) / (tx2 - tx1);
|
||||
s_MovingSegmentSlope = ( ty2 - ty1 ) / ( tx2 - tx1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
s_MovingSegmentVertical = true; //signal vertical line
|
||||
}
|
||||
if( ty1==ty2 )
|
||||
if( ty1 == ty2 )
|
||||
{
|
||||
s_MovingSegmentHorizontal = true;
|
||||
}
|
||||
|
@ -605,9 +619,11 @@ bool InitialiseDragParameters()
|
|||
}
|
||||
else
|
||||
{
|
||||
if( !s_EndPointVertical && (s_MovingSegmentSlope == s_EndSegmentSlope) )
|
||||
if( !s_EndPointVertical
|
||||
&& ( s_MovingSegmentSlope == s_EndSegmentSlope ) )
|
||||
return false;
|
||||
if( !s_StartPointVertical && (s_MovingSegmentSlope == s_StartSegmentSlope) )
|
||||
if( !s_StartPointVertical
|
||||
&& ( s_MovingSegmentSlope == s_StartSegmentSlope ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -615,14 +631,13 @@ bool InitialiseDragParameters()
|
|||
}
|
||||
|
||||
|
||||
/*************************************************************************************/
|
||||
void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int command )
|
||||
/*************************************************************************************/
|
||||
|
||||
/* Init parametres to move one node:
|
||||
/* Init parameters to move one node:
|
||||
* a via or/and a terminal point of a track segment
|
||||
* 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 )
|
||||
return;
|
||||
|
@ -631,7 +646,7 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int co
|
|||
NbPtNewTrack = 0;
|
||||
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_HightLigth_NetCode = g_HightLigth_NetCode;
|
||||
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 )
|
||||
{
|
||||
Collect_TrackSegmentsToDrag( DrawPanel, DC, track->m_Start,
|
||||
track->ReturnMaskLayer(), track->GetNet() );
|
||||
track->ReturnMaskLayer(),
|
||||
track->GetNet() );
|
||||
}
|
||||
NewTrack = track;
|
||||
NbPtNewTrack = 1;
|
||||
|
@ -665,35 +681,39 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int co
|
|||
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT:
|
||||
pos = track->m_Start;
|
||||
Collect_TrackSegmentsToDrag( DrawPanel, DC, pos,
|
||||
track->ReturnMaskLayer(), track->GetNet() );
|
||||
track->ReturnMaskLayer(),
|
||||
track->GetNet() );
|
||||
pos = track->m_End;
|
||||
track->m_Flags |= IS_DRAGGED | ENDPOINT | STARTPOINT;
|
||||
Collect_TrackSegmentsToDrag( DrawPanel, DC, pos,
|
||||
track->ReturnMaskLayer(), track->GetNet() );
|
||||
track->ReturnMaskLayer(),
|
||||
track->GetNet() );
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_MOVE_TRACK_NODE:
|
||||
pos = (diag & STARTPOINT) ? track->m_Start : track->m_End;
|
||||
Collect_TrackSegmentsToDrag( DrawPanel, DC, pos,
|
||||
track->ReturnMaskLayer(), track->GetNet() );
|
||||
track->ReturnMaskLayer(),
|
||||
track->GetNet() );
|
||||
PosInit = pos;
|
||||
break;
|
||||
}
|
||||
|
||||
track->m_Flags |= IS_DRAGGED;
|
||||
}
|
||||
|
||||
// Prepare the Undo command
|
||||
ITEM_PICKER picker( track, UR_CHANGED );
|
||||
picker.m_Link = track->Copy();
|
||||
s_ItemsListPicker.PushItem( picker );
|
||||
DRAG_SEGM* pt_drag = g_DragSegmentList;
|
||||
DRAG_SEGM* pt_drag = g_DragSegmentList;
|
||||
for( ; pt_drag != NULL; pt_drag = pt_drag->Pnext )
|
||||
{
|
||||
TRACK* draggedtrack = pt_drag->m_Segm;
|
||||
picker.m_PickedItem = draggedtrack;
|
||||
picker.m_Link = draggedtrack->Copy();
|
||||
s_ItemsListPicker.PushItem( picker );
|
||||
draggedtrack = (TRACK*)picker.m_Link;
|
||||
draggedtrack = (TRACK*) picker.m_Link;
|
||||
draggedtrack->SetStatus( 0 );
|
||||
draggedtrack->m_Flags = 0;
|
||||
}
|
||||
|
@ -707,46 +727,49 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int co
|
|||
|
||||
GetBoard()->DrawHighLight( DrawPanel, DC, g_HightLigth_NetCode );
|
||||
DrawPanel->ManageCurseur( DrawPanel, DC, true );
|
||||
|
||||
}
|
||||
|
||||
|
||||
#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 )
|
||||
{
|
||||
//sort the track endpoints -- should not matter in terms of drawing
|
||||
//or producing the pcb -- but makes doing comparisons easier.
|
||||
int dx = track->m_End.x - track->m_Start.x;
|
||||
int dx = track->m_End.x - track->m_Start.x;
|
||||
|
||||
if( dx )
|
||||
{
|
||||
if( track->m_Start.x > track->m_End.x )
|
||||
{
|
||||
EXCHG(track->m_Start, track->m_End);
|
||||
EXCHG( track->m_Start, track->m_End );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
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.
|
||||
* 2 collinear segments can be merged only in no other segment or via is connected to the common point
|
||||
* @todo: this function is broken, because it merge segments having different
|
||||
* 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 consider Marque_Une_Piste() to locate segments that can be merged
|
||||
*/
|
||||
|
||||
testtrack = (TRACK*) Locate_Piste_Connectee( track, GetBoard()->m_Track, NULL, end );
|
||||
bool WinEDA_PcbFrame::MergeCollinearTracks( TRACK* track, wxDC* DC, int end )
|
||||
{
|
||||
testtrack = (TRACK*) Locate_Piste_Connectee( track,
|
||||
GetBoard()->m_Track, NULL,
|
||||
end );
|
||||
if( testtrack )
|
||||
{
|
||||
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 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*/
|
||||
|| (dy == 0 && tdy == 0 && dx * tdx ) /*horizontal*/
|
||||
|| (dx == 0 && tdx == 0 && dy * tdy ) /*vertical*/ )
|
||||
if( ( dy * tdx == dx * tdy && dy != 0 && dx != 0 && tdy != 0 && tdx !=
|
||||
0 ) /* angle, same slope */
|
||||
|| ( 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 )
|
||||
||( 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;
|
||||
}
|
||||
}
|
||||
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 )
|
||||
||( 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;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
/***********************************************************************************/
|
||||
void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC )
|
||||
/***********************************************************************************/
|
||||
|
||||
void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track,
|
||||
wxDC* DC )
|
||||
{
|
||||
TRACK* TrackToStartPoint = NULL;
|
||||
TRACK* TrackToEndPoint = NULL;
|
||||
|
@ -801,57 +831,66 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
|
|||
|
||||
|
||||
#if 0
|
||||
|
||||
// Broken functions: see comments
|
||||
while( MergeCollinearTracks( track, DC, START ) )
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
;
|
||||
while( MergeCollinearTracks( track, DC, END ) )
|
||||
{
|
||||
};
|
||||
}
|
||||
|
||||
;
|
||||
#endif
|
||||
|
||||
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,
|
||||
GetBoard()->m_Track, NULL, START );
|
||||
GetBoard()->m_Track, NULL,
|
||||
START );
|
||||
|
||||
// Test if more than one segment is connected to this point
|
||||
if( TrackToStartPoint )
|
||||
{
|
||||
TrackToStartPoint->SetState( BUSY, ON );
|
||||
if( (TrackToStartPoint->Type() == TYPE_VIA) ||
|
||||
Locate_Piste_Connectee( track, GetBoard()->m_Track, NULL, START ) )
|
||||
if( ( TrackToStartPoint->Type() == TYPE_VIA )
|
||||
|| Locate_Piste_Connectee( track, GetBoard()->m_Track, NULL, START ) )
|
||||
error = true;
|
||||
TrackToStartPoint->SetState( BUSY, OFF );
|
||||
}
|
||||
|
||||
if( (track->end == NULL) || (track->end->Type() == TYPE_TRACK) )
|
||||
TrackToEndPoint = Locate_Piste_Connectee( track, GetBoard()->m_Track, NULL, END );
|
||||
if( ( track->end == NULL ) || ( track->end->Type() == TYPE_TRACK ) )
|
||||
TrackToEndPoint = Locate_Piste_Connectee( track,
|
||||
GetBoard()->m_Track, NULL,
|
||||
END );
|
||||
|
||||
// Test if more than one segment is connected to this point
|
||||
if( TrackToEndPoint )
|
||||
{
|
||||
TrackToEndPoint->SetState( BUSY, ON );
|
||||
if( (TrackToEndPoint->Type() == TYPE_VIA) ||
|
||||
Locate_Piste_Connectee( track, GetBoard()->m_Track, NULL, END ) )
|
||||
if( (TrackToEndPoint->Type() == TYPE_VIA)
|
||||
|| Locate_Piste_Connectee( track, GetBoard()->m_Track, NULL, END ) )
|
||||
error = true;
|
||||
TrackToEndPoint->SetState( BUSY, OFF );
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if( !TrackToStartPoint || (TrackToStartPoint->Type() != TYPE_TRACK) )
|
||||
if( !TrackToStartPoint || ( TrackToStartPoint->Type() != TYPE_TRACK ) )
|
||||
s_StartSegmentPresent = FALSE;
|
||||
|
||||
if( !TrackToEndPoint || (TrackToEndPoint->Type() != TYPE_TRACK) )
|
||||
if( !TrackToEndPoint || ( TrackToEndPoint->Type() != TYPE_TRACK ) )
|
||||
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_HightLigth_NetCode = g_HightLigth_NetCode;
|
||||
if( g_HightLigt_Status )
|
||||
|
@ -894,7 +933,7 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
|
|||
GetBoard()->DrawHighLight( DrawPanel, DC, g_HightLigth_NetCode );
|
||||
|
||||
// Prepare the Undo command
|
||||
DRAG_SEGM* pt_drag = g_DragSegmentList;
|
||||
DRAG_SEGM* pt_drag = g_DragSegmentList;
|
||||
ITEM_PICKER picker( NULL, UR_CHANGED );
|
||||
for( ; pt_drag != NULL; pt_drag = pt_drag->Pnext )
|
||||
{
|
||||
|
@ -902,14 +941,15 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
|
|||
picker.m_PickedItem = draggedtrack;
|
||||
picker.m_Link = draggedtrack->Copy();
|
||||
s_ItemsListPicker.PushItem( picker );
|
||||
draggedtrack = (TRACK*)picker.m_Link;
|
||||
draggedtrack = (TRACK*) picker.m_Link;
|
||||
draggedtrack->SetStatus( 0 );
|
||||
draggedtrack->m_Flags = 0;
|
||||
}
|
||||
|
||||
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;
|
||||
Abort_MoveTrack( DrawPanel, DC );
|
||||
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 */
|
||||
bool WinEDA_PcbFrame::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
|
||||
{
|
||||
int errdrc;
|
||||
DRAG_SEGM* pt_drag;
|
||||
|
@ -963,16 +1001,20 @@ bool WinEDA_PcbFrame::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
|
|||
Track->Draw( DrawPanel, DC, draw_mode );
|
||||
|
||||
/* 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()];
|
||||
Track->start = Fast_Locate_Pad_Connecte( GetBoard(), Track->m_Start, masque_layer );
|
||||
Track->end = Fast_Locate_Pad_Connecte( GetBoard(), Track->m_End, masque_layer );
|
||||
Track->start = Fast_Locate_Pad_Connecte(
|
||||
GetBoard(), Track->m_Start, masque_layer );
|
||||
Track->end = Fast_Locate_Pad_Connecte(
|
||||
GetBoard(), Track->m_End, masque_layer );
|
||||
}
|
||||
|
||||
EraseDragListe();
|
||||
|
||||
SaveCopyInUndoList(s_ItemsListPicker, UR_UNSPECIFIED);
|
||||
s_ItemsListPicker.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items
|
||||
SaveCopyInUndoList( s_ItemsListPicker, UR_UNSPECIFIED );
|
||||
s_ItemsListPicker.ClearItemsList(); // s_ItemsListPicker is no more owner
|
||||
// of picked items
|
||||
|
||||
GetScreen()->SetModify();
|
||||
DrawPanel->ManageCurseur = NULL;
|
||||
|
@ -985,30 +1027,26 @@ bool WinEDA_PcbFrame::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
|
|||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
BOARD_ITEM* LocateLockPoint( BOARD* Pcb, wxPoint pos, int LayerMask )
|
||||
/************************************************************************/
|
||||
|
||||
/* Routine trouvant le point "d'accrochage" d'une extremite de piste.
|
||||
* Ce point peut etre un PAD ou un autre segment de piste
|
||||
* Retourne:
|
||||
* - pointeur sur ce PAD ou:
|
||||
* - pointeur sur le segment ou:
|
||||
* - NULL
|
||||
* Parametres d'appel:
|
||||
* coord pX, pY du point tst
|
||||
* masque des couches a tester
|
||||
/* Find the point "attachment" of the end of a trace.
|
||||
* This may be a TBP or another segment of the trace
|
||||
* Returns:
|
||||
* - Pointer to the PAD or:
|
||||
* - Pointer to the segment or:
|
||||
* - NULL
|
||||
* Parameters:
|
||||
* - position to test
|
||||
* - 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() )
|
||||
{
|
||||
D_PAD* pad = Locate_Pads( module, pos, LayerMask );
|
||||
if( 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 );
|
||||
if( ptsegm == NULL )
|
||||
ptsegm = Locate_Pistes( Pcb->m_Track, pos, LayerMask );
|
||||
|
@ -1017,25 +1055,26 @@ BOARD_ITEM* LocateLockPoint( BOARD* Pcb, wxPoint pos, int LayerMask )
|
|||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
TRACK* CreateLockPoint( wxPoint & aRefPoint, TRACK* aSegm, TRACK* aRefSegm, PICKED_ITEMS_LIST* aItemsListPicker )
|
||||
/******************************************************************************/
|
||||
|
||||
/* Routine de creation d'un point intermediaire sur un segment
|
||||
* le segment aSegm est casse en 2 segments se raccordant au point pX, pY
|
||||
* retourne:
|
||||
* NULL si pas de nouveau point ( c.a.d si aRefPoint correspondait deja
|
||||
* a une extremite ou:
|
||||
* pointeur sur le segment cree
|
||||
* et le point cree est l'intersection des 2 axes des segments aSegm et refsegm
|
||||
* retourne la valeur exacte de aRefPoint
|
||||
* Si aSegm pointe sur une via:
|
||||
* retourne la valeur exacte de aRefPoint et ptsegm,
|
||||
* mais ne cree pas de point supplementaire
|
||||
/* Create an intermediate point on a segment
|
||||
* ASegm segment is broken into 2 segments connecting point pX, pY
|
||||
* Returns:
|
||||
* NULL if no new point (ie if aRefPoint already corresponded
|
||||
* At one end where:
|
||||
* Pointer to the segment created
|
||||
* Created and the point is the intersection of 2 lines segments aSegm and
|
||||
* refsegm
|
||||
* Returns the exact value of aRefPoint
|
||||
* If aSegm points to a via:
|
||||
* Returns the exact value of aRefPoint and ptsegm,
|
||||
* But does not create extra point
|
||||
*/
|
||||
TRACK* CreateLockPoint( wxPoint& aRefPoint,
|
||||
TRACK* aSegm,
|
||||
TRACK* aRefSegm,
|
||||
PICKED_ITEMS_LIST* aItemsListPicker )
|
||||
{
|
||||
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 )
|
||||
return NULL;
|
||||
|
@ -1047,18 +1086,18 @@ TRACK* CreateLockPoint( wxPoint & aRefPoint, TRACK* aSegm, TRACK* aRefSegm, PICK
|
|||
return aSegm;
|
||||
}
|
||||
|
||||
/* calcul des coord vraies du point intermediaire dans le repere d'origine
|
||||
* = origine de ptsegm
|
||||
/* Calculation coordinate of intermediate point in the coordinate origin
|
||||
* = Original ptsegm
|
||||
*/
|
||||
cX = aRefPoint.x - aSegm->m_Start.x;
|
||||
cY = aRefPoint.y - aSegm->m_Start.y;
|
||||
|
||||
dx = aSegm->m_End.x - aSegm->m_Start.x;
|
||||
dy = aSegm->m_End.y - aSegm->m_Start.y;
|
||||
|
||||
// Not yet used:
|
||||
#if 0
|
||||
int ox, oy, fx, fy; /* coord de refsegm / origine de prsegm */
|
||||
int ox, oy, fx, fy;
|
||||
|
||||
if( aRefSegm )
|
||||
{
|
||||
ox = aRefSegm->m_Start.x - aSegm->m_Start.x;
|
||||
|
@ -1068,24 +1107,23 @@ TRACK* CreateLockPoint( wxPoint & aRefPoint, TRACK* aSegm, TRACK* aRefSegm, PICK
|
|||
}
|
||||
#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 )
|
||||
cX = 0; /* segm horizontal */
|
||||
else
|
||||
cY = (cX * dy) / dx;
|
||||
cY = ( cX * dy ) / dx;
|
||||
|
||||
/* creation du point intermediaire ( c'est a dire creation d'un nouveau
|
||||
* segment, debutant au point intermediaire
|
||||
/* Create the intermediate point (that is to say creation of a new
|
||||
* segment, beginning at the intermediate point.
|
||||
*/
|
||||
|
||||
cX += aSegm->m_Start.x;
|
||||
cY += aSegm->m_Start.y;
|
||||
|
||||
TRACK* newTrack = aSegm->Copy();
|
||||
TRACK* newTrack = aSegm->Copy();
|
||||
if( aItemsListPicker )
|
||||
{
|
||||
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 );
|
||||
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;
|
||||
|
||||
/* le segment primitif finit au nouveau point : */
|
||||
/* Segment ends at new point. */
|
||||
if( aItemsListPicker )
|
||||
{
|
||||
ITEM_PICKER picker( aSegm, UR_CHANGED );
|
||||
picker.m_Link = aSegm->Copy();
|
||||
aItemsListPicker->PushItem(picker);
|
||||
aItemsListPicker->PushItem( picker );
|
||||
}
|
||||
aSegm->m_End.x = cX;
|
||||
aSegm->m_End.y = cY;
|
||||
|
||||
aSegm->SetState( END_ONPAD, OFF );
|
||||
|
||||
/* le nouveau segment debute au nouveau point : */
|
||||
/* The next segment begins at the new point. */
|
||||
aSegm = newTrack;;
|
||||
aSegm->m_Start.x = cX;
|
||||
aSegm->m_Start.y = cY;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************/
|
||||
/* muwave_command.cpp: micro wave functions commands */
|
||||
/*****************************************************/
|
||||
/*****************************************************/
|
||||
/* muwave_command.cpp: micro wave functions commands */
|
||||
/*****************************************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "common.h"
|
||||
|
@ -14,108 +14,103 @@
|
|||
#include "protos.h"
|
||||
|
||||
|
||||
/*********************************************************************/
|
||||
void WinEDA_PcbFrame::ProcessMuWaveFunctions(wxCommandEvent& event)
|
||||
/*********************************************************************/
|
||||
/* Traite les selections d'outils et les commandes appelees du menu POPUP
|
||||
*/
|
||||
/* Handle microwave commands.
|
||||
*/
|
||||
void WinEDA_PcbFrame::ProcessMuWaveFunctions( wxCommandEvent& event )
|
||||
{
|
||||
int id = event.GetId();
|
||||
wxPoint pos;
|
||||
wxClientDC dc(DrawPanel);
|
||||
int id = event.GetId();
|
||||
wxPoint pos;
|
||||
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
|
||||
{
|
||||
case ID_POPUP_COPY_BLOCK:
|
||||
break;
|
||||
switch( id ) // End any command in progress.
|
||||
{
|
||||
case ID_POPUP_COPY_BLOCK:
|
||||
break;
|
||||
|
||||
default: // Arret de la commande de déplacement en cours
|
||||
if( DrawPanel->ManageCurseur &&
|
||||
DrawPanel->ForceCloseManageCurseur )
|
||||
{
|
||||
DrawPanel->ForceCloseManageCurseur(DrawPanel, &dc);
|
||||
}
|
||||
SetToolID(0, wxCURSOR_ARROW,wxEmptyString);
|
||||
break;
|
||||
}
|
||||
default: // End block command in progress.
|
||||
if( DrawPanel->ManageCurseur
|
||||
&& DrawPanel->ForceCloseManageCurseur )
|
||||
{
|
||||
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
||||
}
|
||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||
break;
|
||||
}
|
||||
|
||||
switch ( id ) // Traitement des commandes
|
||||
{
|
||||
switch( id )
|
||||
{
|
||||
case ID_PCB_MUWAVE_TOOL_SELF_CMD:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add Line" ) );
|
||||
break;
|
||||
|
||||
case ID_PCB_MUWAVE_TOOL_SELF_CMD:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _("Add Line"));
|
||||
break;
|
||||
case ID_PCB_MUWAVE_TOOL_GAP_CMD:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add Gap" ) );
|
||||
break;
|
||||
|
||||
case ID_PCB_MUWAVE_TOOL_GAP_CMD:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _("Add Gap"));
|
||||
break;
|
||||
case ID_PCB_MUWAVE_TOOL_STUB_CMD:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add Stub" ) );
|
||||
break;
|
||||
|
||||
case ID_PCB_MUWAVE_TOOL_STUB_CMD:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _("Add Stub"));
|
||||
break;
|
||||
case ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add Arc Stub" ) );
|
||||
break;
|
||||
|
||||
case ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _("Add Arc Stub"));
|
||||
break;
|
||||
case ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _( "Add Polynomial Shape" ) );
|
||||
break;
|
||||
|
||||
case ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD:
|
||||
SetToolID( id, wxCURSOR_PENCIL, _("Add Polynomial Shape"));
|
||||
break;
|
||||
default:
|
||||
DisplayError( this,
|
||||
wxT( "WinEDA_PcbFrame::ProcessMuWaveFunctions() id error" ) );
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
DisplayError(this, wxT("WinEDA_PcbFrame::ProcessMuWaveFunctions() id error"));
|
||||
break;
|
||||
}
|
||||
|
||||
SetToolbars();
|
||||
SetToolbars();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
void WinEDA_PcbFrame::MuWaveCommand(wxDC * DC, const wxPoint& MousePos)
|
||||
/***************************************************************************/
|
||||
void WinEDA_PcbFrame::MuWaveCommand( wxDC* DC, const wxPoint& MousePos )
|
||||
{
|
||||
MODULE* module = NULL;
|
||||
switch ( m_ID_current_state )
|
||||
{
|
||||
case ID_PCB_MUWAVE_TOOL_SELF_CMD:
|
||||
Begin_Self(DC);
|
||||
break;
|
||||
|
||||
case ID_PCB_MUWAVE_TOOL_GAP_CMD:
|
||||
module = Create_MuWaveComponent( 0);
|
||||
break;
|
||||
switch( m_ID_current_state )
|
||||
{
|
||||
case ID_PCB_MUWAVE_TOOL_SELF_CMD:
|
||||
Begin_Self( DC );
|
||||
break;
|
||||
|
||||
case ID_PCB_MUWAVE_TOOL_STUB_CMD:
|
||||
module = Create_MuWaveComponent( 1);
|
||||
break;
|
||||
case ID_PCB_MUWAVE_TOOL_GAP_CMD:
|
||||
module = Create_MuWaveComponent( 0 );
|
||||
break;
|
||||
|
||||
case ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD:
|
||||
module = Create_MuWaveComponent( 2);
|
||||
break;
|
||||
case ID_PCB_MUWAVE_TOOL_STUB_CMD:
|
||||
module = Create_MuWaveComponent( 1 );
|
||||
break;
|
||||
|
||||
case ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD:
|
||||
module = Create_MuWavePolygonShape();
|
||||
break;
|
||||
case ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD:
|
||||
module = Create_MuWaveComponent( 2 );
|
||||
break;
|
||||
|
||||
default :
|
||||
DrawPanel->SetCursor(wxCURSOR_ARROW);
|
||||
DisplayError(this, wxT("WinEDA_PcbFrame::MuWaveCommand() id error"));
|
||||
SetToolID(0, wxCURSOR_ARROW,wxEmptyString);
|
||||
break;
|
||||
}
|
||||
case ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD:
|
||||
module = Create_MuWavePolygonShape();
|
||||
break;
|
||||
|
||||
if ( module )
|
||||
default:
|
||||
DrawPanel->SetCursor( wxCURSOR_ARROW );
|
||||
DisplayError( this, wxT( "WinEDA_PcbFrame::MuWaveCommand() id error" ) );
|
||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||
break;
|
||||
}
|
||||
|
||||
if( module )
|
||||
{
|
||||
StartMove_Module( module, DC );
|
||||
}
|
||||
DrawPanel->MouseToCursorSchema();
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
* - Initialise net info
|
||||
* - Initialize net info
|
||||
* - Test for missing or extra footprints
|
||||
* - Recalculate ratsnest
|
||||
*
|
||||
* 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:
|
||||
* - 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.
|
||||
* 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
|
||||
* 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)
|
||||
* 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 "common.h"
|
||||
|
@ -39,7 +44,7 @@
|
|||
#define TESTONLY 1
|
||||
#define READMODULE 0
|
||||
|
||||
/* Structures locales */
|
||||
|
||||
class MODULEtoLOAD
|
||||
{
|
||||
public:
|
||||
|
@ -48,10 +53,9 @@ public:
|
|||
wxString m_TimeStampPath;
|
||||
MODULEtoLOAD* m_Next;
|
||||
|
||||
public:
|
||||
MODULEtoLOAD( const wxString& libname,
|
||||
const wxString& cmpname,
|
||||
const wxString& timestamp_path )
|
||||
public: MODULEtoLOAD( const wxString& libname,
|
||||
const wxString& cmpname,
|
||||
const wxString& timestamp_path )
|
||||
{
|
||||
m_LibName = libname;
|
||||
m_CmpName = cmpname;
|
||||
|
@ -66,10 +70,11 @@ public:
|
|||
void SetNext( MODULEtoLOAD* next ) { m_Next = next; }
|
||||
};
|
||||
|
||||
/* Fonctions locales : */
|
||||
|
||||
static void SortListModulesToLoadByLibname( int NbModules );
|
||||
static int BuildFootprintsListFromNetlistFile( const wxString& aNetlistFullFilename,
|
||||
wxArrayString& aBufName );
|
||||
static int BuildFootprintsListFromNetlistFile(
|
||||
const wxString& aNetlistFullFilename,
|
||||
wxArrayString& aBufName );
|
||||
static bool OpenNetlistFile( const wxString& aFullFileName );
|
||||
static void AddToList( const wxString& NameLibCmp,
|
||||
const wxString& NameCmp,
|
||||
|
@ -93,28 +98,25 @@ static MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
|
|||
static void LoadListeModules( WinEDA_PcbFrame* aPcbFrame );
|
||||
|
||||
|
||||
/* Variables locales */
|
||||
static int s_NbNewModules;
|
||||
static MODULEtoLOAD* s_ModuleToLoad_List;
|
||||
FILE* source;
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
bool OpenNetlistFile( const wxString& aFullFileName )
|
||||
/************************************************************************/
|
||||
|
||||
/** function OpenNetlistFile
|
||||
* used to open a netlist file
|
||||
*/
|
||||
bool OpenNetlistFile( const wxString& aFullFileName )
|
||||
{
|
||||
if( aFullFileName.IsEmpty() )
|
||||
return FALSE; /* No filename: exit */
|
||||
return FALSE; /* No filename: exit */
|
||||
|
||||
source = wxFopen( aFullFileName, wxT( "rt" ) );
|
||||
if( source == 0 )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Netlist file %s not found" ), GetChars( aFullFileName ) );
|
||||
msg.Printf( _( "Netlist file %s not found" ),
|
||||
GetChars( aFullFileName ) );
|
||||
DisplayError( NULL, msg );
|
||||
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
|
||||
* 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 Reference, value and "TIME STAMP"
|
||||
* @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:
|
||||
# EESchema Netlist Version 1.0 generee le 18/5/2005-12:30:22
|
||||
|
@ -155,6 +148,14 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
|
|||
* }
|
||||
* #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;
|
||||
MODULE* Module = NULL;
|
||||
|
@ -169,7 +170,8 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
|
|||
if( aMessageWindow )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Reading Netlist \"%s\"" ), GetChars( aNetlistFullFilename ) );
|
||||
msg.Printf( _( "Reading Netlist \"%s\"" ),
|
||||
GetChars( aNetlistFullFilename ) );
|
||||
aMessageWindow->AppendText( msg + wxT( "\n" ) );
|
||||
}
|
||||
|
||||
|
@ -183,7 +185,8 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
|
|||
|
||||
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 ) )
|
||||
{
|
||||
|
@ -221,7 +224,7 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
|
|||
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--;
|
||||
}
|
||||
|
@ -243,15 +246,18 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
|
|||
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;
|
||||
while( GetLine( source, Line, &LineNum ) )
|
||||
{
|
||||
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;
|
||||
Comment = 0;
|
||||
}
|
||||
|
@ -277,7 +283,8 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
|
|||
READMODULE,
|
||||
aSelect_By_Timestamp,
|
||||
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;
|
||||
}
|
||||
|
@ -309,9 +316,9 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
|
|||
{
|
||||
wxArrayString ModuleListFromNetlist;
|
||||
/* Build list of modules in the netlist */
|
||||
int NbModulesNetListe = BuildFootprintsListFromNetlistFile(
|
||||
aNetlistFullFilename,
|
||||
ModuleListFromNetlist );
|
||||
int NbModulesNetListe =
|
||||
BuildFootprintsListFromNetlistFile( aNetlistFullFilename,
|
||||
ModuleListFromNetlist );
|
||||
if( NbModulesNetListe )
|
||||
{
|
||||
MODULE* NextModule;
|
||||
|
@ -321,23 +328,25 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
|
|||
{
|
||||
int ii;
|
||||
NextModule = Module->Next();
|
||||
if( (Module->m_ModuleStatus & MODULE_is_LOCKED) )
|
||||
if( Module->m_ModuleStatus & MODULE_is_LOCKED )
|
||||
continue;
|
||||
for( ii = 0; ii < NbModulesNetListe; ii++ )
|
||||
{
|
||||
if( Module->m_Reference->m_Text.CmpNoCase(
|
||||
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 )
|
||||
{
|
||||
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;
|
||||
}
|
||||
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,
|
||||
wxTextCtrl* aMessageWindow,
|
||||
const wxString& aCmpFullFileName,
|
||||
|
@ -372,24 +396,6 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
|
|||
int TstOnly,
|
||||
bool aSelect_By_Timestamp,
|
||||
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;
|
||||
char* text;
|
||||
|
@ -429,7 +435,7 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
|
|||
if( Error > 0 )
|
||||
return NULL;
|
||||
|
||||
/* Tst si composant deja charge */
|
||||
/* Test if module is already loaded. */
|
||||
Module = aFrame->GetBoard()->m_Modules;
|
||||
MODULE* NextModule;
|
||||
|
||||
|
@ -446,7 +452,8 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
|
|||
if( TextCmpName.CmpNoCase( Module->m_Reference->m_Text ) == 0 )
|
||||
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 )
|
||||
{
|
||||
|
@ -468,13 +475,20 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
|
|||
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 =
|
||||
aFrame->Get_Librairie_Module( wxEmptyString, NameLibCmp, true );
|
||||
if( NewModule ) /* Change old module to the new module (and delete the old one)*/
|
||||
aFrame->Get_Librairie_Module( wxEmptyString,
|
||||
NameLibCmp,
|
||||
true );
|
||||
if( NewModule ) /* Change old module to the new module
|
||||
* (and delete the old one) */
|
||||
{
|
||||
aFrame->Exchange_Module( Module, NewModule, NULL );
|
||||
Module = NewModule;
|
||||
|
@ -483,18 +497,18 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
|
|||
else
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf(
|
||||
_(
|
||||
"Component \"%s\": Mismatch! module is [%s] and netlist said [%s]\n" ),
|
||||
GetChars( TextCmpName ),
|
||||
GetChars( Module->m_LibRef ),
|
||||
GetChars( NameLibCmp ) );
|
||||
msg.Printf( _( "Component \"%s\": Mismatch! module \
|
||||
is [%s] and netlist said [%s]\n" ),
|
||||
GetChars( TextCmpName ),
|
||||
GetChars( Module->m_LibRef ),
|
||||
GetChars( NameLibCmp ) );
|
||||
|
||||
if( aMessageWindow )
|
||||
aMessageWindow->AppendText( msg );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -505,11 +519,17 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
|
|||
{
|
||||
if( aSelect_By_Timestamp == 1 )
|
||||
{
|
||||
*UseFichCmp = ReadListeModules( aCmpFullFileName, NULL, &TimeStampPath, NameLibCmp );
|
||||
*UseFichCmp = ReadListeModules( aCmpFullFileName,
|
||||
NULL,
|
||||
&TimeStampPath,
|
||||
NameLibCmp );
|
||||
}
|
||||
else
|
||||
{
|
||||
*UseFichCmp = ReadListeModules( aCmpFullFileName, &TextCmpName, NULL, NameLibCmp );
|
||||
*UseFichCmp = ReadListeModules( aCmpFullFileName,
|
||||
&TextCmpName,
|
||||
NULL,
|
||||
NameLibCmp );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -521,11 +541,12 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
|
|||
if( aMessageWindow )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Component [%s] not found" ), GetChars( TextCmpName ) );
|
||||
msg.Printf( _( "Component [%s] not found" ),
|
||||
GetChars( TextCmpName ) );
|
||||
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") */
|
||||
|
@ -533,20 +554,21 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
|
|||
Module->m_Value->m_Text = TextValeur;
|
||||
Module->m_Path = TimeStampPath;
|
||||
|
||||
return Module; /* composant trouve */
|
||||
return Module;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************************/
|
||||
int SetPadNetName( wxWindow* frame, char* Text, MODULE* Module, wxTextCtrl* aMessageWindow )
|
||||
/*******************************************************************************************/
|
||||
|
||||
/** Function SetPadNetName
|
||||
* Update a pad netname in a given footprint
|
||||
* @param Text = Text from netlist (format: (pad = net) )
|
||||
* @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;
|
||||
char* TextPinName, * TextNetName;
|
||||
|
@ -567,11 +589,10 @@ int SetPadNetName( wxWindow* frame, char* Text, MODULE* Module, wxTextCtrl* aMes
|
|||
if( Error )
|
||||
return 0;
|
||||
|
||||
/* recherche du pad */
|
||||
pad = Module->m_Pads; trouve = FALSE;
|
||||
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;
|
||||
if( *TextNetName != '?' )
|
||||
|
@ -587,8 +608,8 @@ int SetPadNetName( wxWindow* frame, char* Text, MODULE* Module, wxTextCtrl* aMes
|
|||
{
|
||||
wxString pin_name = CONV_FROM_UTF8( TextPinName );
|
||||
Msg.Printf( _( "Module [%s]: Pad [%s] not found" ),
|
||||
GetChars( Module->m_Reference->m_Text ),
|
||||
GetChars( pin_name ) );
|
||||
GetChars( Module->m_Reference->m_Text ),
|
||||
GetChars( pin_name ) );
|
||||
aMessageWindow->AppendText( Msg + wxT( "\n" ) );
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
* 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
|
||||
*/
|
||||
MODULE* WinEDA_PcbFrame::ListAndSelectModuleName( void )
|
||||
{
|
||||
int ii, jj;
|
||||
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
|
||||
* Build a list from the given board and netlist :
|
||||
* 1 - for duplicate footprints on board
|
||||
|
@ -658,9 +670,12 @@ void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
|
|||
* @param aNetlistFullFilename = the given netlist
|
||||
* @param aPcb = the given board
|
||||
*/
|
||||
void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
|
||||
const wxString& aNetlistFullFilename,
|
||||
BOARD* aPcb )
|
||||
#define MAX_LEN_TXT 32
|
||||
{
|
||||
int ii;
|
||||
int ii;
|
||||
MODULE* Module, * pt_aux;
|
||||
int NbModulesNetListe, nberr = 0;
|
||||
WinEDA_TextFrame* List;
|
||||
|
@ -668,32 +683,38 @@ void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
|
|||
|
||||
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 */
|
||||
NbModulesNetListe = BuildFootprintsListFromNetlistFile( aNetlistFullFilename,
|
||||
ModuleListFromNetlist );
|
||||
/* Build the list of references of the net list modules. */
|
||||
|
||||
NbModulesNetListe =
|
||||
BuildFootprintsListFromNetlistFile( aNetlistFullFilename,
|
||||
ModuleListFromNetlist );
|
||||
if( NbModulesNetListe < 0 )
|
||||
return; /* File not found */
|
||||
return; /* File not found */
|
||||
|
||||
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" ) );
|
||||
|
||||
/* recherche des doubles */
|
||||
/* Search for duplicate footprints. */
|
||||
List->Append( _( "Duplicates" ) );
|
||||
|
||||
Module = aPcb->m_Modules;
|
||||
|
||||
for( ; Module != NULL; Module = Module->Next() )
|
||||
{
|
||||
pt_aux = Module->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 );
|
||||
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:" ) );
|
||||
|
||||
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:" ) );
|
||||
|
||||
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(
|
||||
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
|
||||
* Fill BufName with footprints names read from the netlist.
|
||||
* @param aNetlistFullFilename = netlist file name
|
||||
* @param BufName = wxArrayString to fill with footprint names
|
||||
* @return Footprint count, or -1 if netlist file cannot opened
|
||||
*/
|
||||
int BuildFootprintsListFromNetlistFile( const wxString& aNetlistFullFilename,
|
||||
wxArrayString& aBufName )
|
||||
{
|
||||
int textlen;
|
||||
int nb_modules_lus;
|
||||
|
@ -777,13 +795,13 @@ int BuildFootprintsListFromNetlistFile( const wxString& aNetlistFullFilename,
|
|||
while( GetLine( source, Line, &LineNum ) )
|
||||
{
|
||||
Text = StrPurge( Line );
|
||||
if( Comment ) /* Commentaires en cours */
|
||||
if( Comment )
|
||||
{
|
||||
if( ( Text = strchr( Text, '}' ) ) == NULL )
|
||||
continue;
|
||||
Comment = 0;
|
||||
}
|
||||
if( *Text == '{' ) /* Commentaires */
|
||||
if( *Text == '{' ) /* Comments. */
|
||||
{
|
||||
Comment = 1;
|
||||
if( ( Text = strchr( Text, '}' ) ) == NULL )
|
||||
|
@ -801,8 +819,8 @@ int BuildFootprintsListFromNetlistFile( const wxString& aNetlistFullFilename,
|
|||
if( strtok( Line, " ()\t\n" ) == NULL )
|
||||
Error = 1; /* TimeStamp */
|
||||
if( ( LibModName = strtok( NULL, " ()\t\n" ) ) == NULL )
|
||||
Error = 1; /* nom Lib */
|
||||
/* Lecture du nom (reference) du composant: */
|
||||
Error = 1;
|
||||
/* Load the name of the component. */
|
||||
if( ( Text = strtok( NULL, " ()\t\n" ) ) == NULL )
|
||||
Error = 1;
|
||||
nb_modules_lus++;
|
||||
|
@ -812,37 +830,32 @@ int BuildFootprintsListFromNetlistFile( const wxString& aNetlistFullFilename,
|
|||
|
||||
if( State >= 3 )
|
||||
{
|
||||
State--; /* Lecture 1 ligne relative au Pad */
|
||||
State--;
|
||||
}
|
||||
}
|
||||
|
||||
fclose( source );
|
||||
|
||||
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
|
||||
* Retourne:
|
||||
* Si ce fichier existe retourne :
|
||||
* 1 et le nom module dans NameModule
|
||||
* -1 si module non trouve en fichier
|
||||
* sinon 0;
|
||||
* Get the file CMP giving the equivalence modules / components
|
||||
* Returns:
|
||||
* If this file exists returns:
|
||||
* 1 and the module name in NameModule
|
||||
* -1 If not found in module file
|
||||
* Otherwise 0;
|
||||
*
|
||||
* parametres d'appel:
|
||||
* RefCmp (NULL si selection par TimeStamp)
|
||||
* TimeStamp (signature temporelle si elle existe, NULL sinon)
|
||||
* pointeur sur le buffer recevant le nom du module
|
||||
* Call settings:
|
||||
* RefCmp (NULL if selection by TimeStamp)
|
||||
* TimeStamp (time signature if it exists, NULL otherwise)
|
||||
* Pointer to the buffer receiving the name of the module
|
||||
*
|
||||
* Exemple de fichier:
|
||||
*
|
||||
* Cmp-Mod V01 Genere par PcbNew le 29/10/2003-13:11:6
|
||||
* Example file:
|
||||
*
|
||||
* Cmp-Mod V01 Genere by Pcbnew 29/10/2003-13: 11:6 *
|
||||
* BeginCmp
|
||||
* TimeStamp = /322D3011;
|
||||
* Reference = BUS1;
|
||||
|
@ -858,6 +871,8 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
|
|||
* EndCmp
|
||||
*
|
||||
*/
|
||||
int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
|
||||
const wxString* TimeStamp, wxString& NameModule )
|
||||
{
|
||||
wxString refcurrcmp, timestamp, idmod;
|
||||
char ia[1024];
|
||||
|
@ -872,7 +887,7 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
|
|||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "File <%s> not found, use Netlist for lib module selection" ),
|
||||
GetChars( CmpFullFileName ) );
|
||||
GetChars( CmpFullFileName ) );
|
||||
DisplayError( NULL, msg, 20 );
|
||||
return 0;
|
||||
}
|
||||
|
@ -882,7 +897,7 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
|
|||
if( strnicmp( ia, "BeginCmp", 8 ) != 0 )
|
||||
continue;
|
||||
|
||||
/* Ici une description de 1 composant commence */
|
||||
/* Begin component description. */
|
||||
refcurrcmp.Empty();
|
||||
idmod.Empty();
|
||||
timestamp.Empty();
|
||||
|
@ -917,12 +932,10 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
|
|||
}
|
||||
}
|
||||
|
||||
/* Fin lecture 1 descr composant */
|
||||
|
||||
/* Test du Composant lu en fichier: est-il le bon */
|
||||
/* Check if component read is valid. */
|
||||
if( RefCmp )
|
||||
{
|
||||
if( RefCmp->CmpNoCase( refcurrcmp ) == 0 ) //Found!
|
||||
if( RefCmp->CmpNoCase( refcurrcmp ) == 0 ) // Found!
|
||||
{
|
||||
fclose( FichCmp );
|
||||
NameModule = idmod;
|
||||
|
@ -931,7 +944,8 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
|
|||
}
|
||||
else if( TimeStamp )
|
||||
{
|
||||
if( TimeStamp->CmpNoCase( timestamp ) == 0 && !timestamp.IsEmpty() ) //Found
|
||||
if( TimeStamp->CmpNoCase( timestamp ) == 0
|
||||
&& !timestamp.IsEmpty() ) // Found
|
||||
{
|
||||
fclose( FichCmp );
|
||||
NameModule = idmod;
|
||||
|
@ -945,13 +959,12 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************************/
|
||||
void AddToList( const wxString& NameLibCmp, const wxString& CmpName, const wxString& path )
|
||||
/************************************************************************************/
|
||||
|
||||
/* Fontion copiant en memoire de travail les caracteristiques
|
||||
/* ??? Fontion copiant en memoire de travail les caracteristiques
|
||||
* des nouveaux modules
|
||||
*/
|
||||
void AddToList( const wxString& NameLibCmp,
|
||||
const wxString& CmpName,
|
||||
const wxString& path )
|
||||
{
|
||||
MODULEtoLOAD* NewMod;
|
||||
|
||||
|
@ -962,15 +975,11 @@ void AddToList( const wxString& NameLibCmp, const wxString& CmpName, const wxStr
|
|||
}
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
void LoadListeModules( WinEDA_PcbFrame* aPcbFrame )
|
||||
/***************************************************************/
|
||||
|
||||
/* 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
|
||||
/* Load new modules from library.
|
||||
* If a module is being loaded it is duplicated, which avoids reading
|
||||
* unnecessary library.
|
||||
*/
|
||||
void LoadListeModules( WinEDA_PcbFrame* aPcbFrame )
|
||||
{
|
||||
MODULEtoLOAD* ref, * cmp;
|
||||
int ii;
|
||||
|
@ -986,8 +995,10 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame )
|
|||
// Calculate the footprint "best" position:
|
||||
if( aPcbFrame->SetBoardBoundaryBoxFromEdgesOnly() )
|
||||
{
|
||||
ModuleBestPosition.x = aPcbFrame->GetBoard()->m_BoundaryBox.GetRight() + 5000;
|
||||
ModuleBestPosition.y = aPcbFrame->GetBoard()->m_BoundaryBox.GetBottom() + 10000;
|
||||
ModuleBestPosition.x =
|
||||
aPcbFrame->GetBoard()->m_BoundaryBox.GetRight() + 5000;
|
||||
ModuleBestPosition.y =
|
||||
aPcbFrame->GetBoard()->m_BoundaryBox.GetBottom() + 10000;
|
||||
}
|
||||
else
|
||||
ModuleBestPosition = wxPoint( 0, 0 );
|
||||
|
@ -997,30 +1008,34 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame )
|
|||
if( (ii == 0) || ( ref->m_LibName != cmp->m_LibName) )
|
||||
{
|
||||
/* 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;
|
||||
if( Module == NULL )
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf( _( "Component [%s]: footprint <%s> not found" ),
|
||||
GetChars( cmp->m_CmpName ),
|
||||
GetChars( cmp->m_LibName ) );
|
||||
GetChars( cmp->m_CmpName ),
|
||||
GetChars( cmp->m_LibName ) );
|
||||
DisplayError( NULL, msg );
|
||||
continue;
|
||||
}
|
||||
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_TimeStamp = GetTimeStamp();
|
||||
Module->m_Path = cmp->m_TimeStampPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Footprint already loaded from a library, duplicate it (faster) */
|
||||
/* Footprint already loaded from a library, duplicate it (faster)
|
||||
*/
|
||||
MODULE* newmodule;
|
||||
if( Module == NULL )
|
||||
continue; /* module non existant en libr */
|
||||
continue; /* Module does not exist in library. */
|
||||
|
||||
newmodule = new MODULE( aPcbFrame->GetBoard() );
|
||||
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 )
|
||||
{
|
||||
int ii = (*ref)->m_LibName.CmpNoCase( (*cmp)->m_LibName );
|
||||
|
@ -1046,12 +1060,9 @@ static int SortByLibName( MODULEtoLOAD** ref, MODULEtoLOAD** cmp )
|
|||
}
|
||||
|
||||
|
||||
/*************************************************/
|
||||
void SortListModulesToLoadByLibname( int NbModules )
|
||||
/**************************************************/
|
||||
|
||||
/* Rearrage la liste des modules List par ordre alphabetique des noms lib des modules
|
||||
/* Sort the module list in alphabetical order by module name.
|
||||
*/
|
||||
void SortListModulesToLoadByLibname( int NbModules )
|
||||
{
|
||||
MODULEtoLOAD** base_list, * item;
|
||||
int ii;
|
||||
|
@ -1065,17 +1076,16 @@ void SortListModulesToLoadByLibname( int NbModules )
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
for( ii = 0; ii < NbModules - 1; ii++ )
|
||||
{
|
||||
item = base_list[ii];
|
||||
item->SetNext( base_list[ii + 1] );
|
||||
}
|
||||
|
||||
// Dernier item: Pnext = NULL:
|
||||
item = base_list[ii];
|
||||
item->SetNext( NULL );
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************/
|
||||
/* pcbframe.cpp - fonctions des classes du type WinEDA_PcbFrame */
|
||||
/****************************************************************/
|
||||
/******************************************/
|
||||
/* pcbframe.cpp - PCB editor main window. */
|
||||
/******************************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "appl_wxstruct.h"
|
||||
|
@ -25,191 +25,188 @@
|
|||
#define SHOW_MICROWAVE_TOOLS wxT( "ShowMicrowaveTools" )
|
||||
|
||||
|
||||
/*******************************/
|
||||
/* class WinEDA_PcbFrame */
|
||||
/*******************************/
|
||||
|
||||
BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
|
||||
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_SERV, WinEDA_PcbFrame::OnSockRequestServer )
|
||||
EVT_SOCKET( ID_EDA_SOCKET_EVENT, WinEDA_PcbFrame::OnSockRequest )
|
||||
|
||||
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_ZOOM_SELECT, WinEDA_PcbFrame::OnSelectZoom )
|
||||
EVT_KICAD_CHOICEBOX( ID_ON_GRID_SELECT, WinEDA_PcbFrame::OnSelectGrid )
|
||||
|
||||
EVT_CLOSE( WinEDA_PcbFrame::OnCloseWindow )
|
||||
EVT_SIZE( WinEDA_PcbFrame::OnSize )
|
||||
EVT_CLOSE( WinEDA_PcbFrame::OnCloseWindow )
|
||||
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_MENU_READ_LAST_SAVED_VERSION_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_SAVE_BOARD, WinEDA_PcbFrame::Files_io )
|
||||
EVT_TOOL( ID_OPEN_MODULE_EDITOR, WinEDA_PcbFrame::Process_Special_Functions )
|
||||
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_RECOVER_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_OPEN_MODULE_EDITOR,
|
||||
WinEDA_PcbFrame::Process_Special_Functions )
|
||||
|
||||
// Menu Files:
|
||||
EVT_MENU( ID_MAIN_MENUBAR, WinEDA_PcbFrame::Process_Special_Functions )
|
||||
// Menu Files:
|
||||
EVT_MENU( ID_MAIN_MENUBAR, WinEDA_PcbFrame::Process_Special_Functions )
|
||||
|
||||
EVT_MENU( ID_LOAD_FILE, 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_APPEND_FILE, 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( ID_LOAD_FILE, 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_APPEND_FILE, 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( 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_FILE_GENCADFORMAT, WinEDA_PcbFrame::ExportToGenCAD )
|
||||
EVT_MENU( ID_GEN_EXPORT_FILE_MODULE_REPORT,
|
||||
WinEDA_PcbFrame::GenModuleReport )
|
||||
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_MODULE_REPORT,
|
||||
WinEDA_PcbFrame::GenModuleReport )
|
||||
|
||||
EVT_MENU( ID_GEN_IMPORT_SPECCTRA_SESSION,
|
||||
WinEDA_PcbFrame::ImportSpecctraSession )
|
||||
EVT_MENU( ID_GEN_IMPORT_SPECCTRA_DESIGN,
|
||||
WinEDA_PcbFrame::ImportSpecctraDesign )
|
||||
EVT_MENU( ID_GEN_IMPORT_SPECCTRA_SESSION,
|
||||
WinEDA_PcbFrame::ImportSpecctraSession )
|
||||
EVT_MENU( ID_GEN_IMPORT_SPECCTRA_DESIGN,
|
||||
WinEDA_PcbFrame::ImportSpecctraDesign )
|
||||
|
||||
EVT_MENU( ID_MENU_ARCHIVE_NEW_MODULES,
|
||||
WinEDA_PcbFrame::Process_Special_Functions )
|
||||
EVT_MENU( ID_MENU_ARCHIVE_ALL_MODULES,
|
||||
WinEDA_PcbFrame::Process_Special_Functions )
|
||||
EVT_MENU( ID_MENU_ARCHIVE_NEW_MODULES,
|
||||
WinEDA_PcbFrame::Process_Special_Functions )
|
||||
EVT_MENU( ID_MENU_ARCHIVE_ALL_MODULES,
|
||||
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
|
||||
EVT_MENU_RANGE( ID_CONFIG_AND_PREFERENCES_START,
|
||||
ID_CONFIG_AND_PREFERENCES_END,
|
||||
WinEDA_PcbFrame::Process_Config )
|
||||
// menu Config
|
||||
EVT_MENU_RANGE( ID_CONFIG_AND_PREFERENCES_START,
|
||||
ID_CONFIG_AND_PREFERENCES_END,
|
||||
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_PCB_LAYERS_SETUP, 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_PAD_SETUP, 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_PCB_DISPLAY_OPTIONS_SETUP, WinEDA_PcbFrame::InstallDisplayOptionsDialog )
|
||||
EVT_MENU( ID_COLORS_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_MASK_CLEARANCE, 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_CONFIG_SAVE, 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_USER_GRID_SETUP,
|
||||
WinEDA_PcbFrame::Process_Special_Functions )
|
||||
|
||||
EVT_MENU( ID_PCB_USER_GRID_SETUP,
|
||||
WinEDA_PcbFrame::Process_Special_Functions )
|
||||
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END,
|
||||
WinEDA_DrawFrame::SetLanguage )
|
||||
|
||||
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END,
|
||||
WinEDA_DrawFrame::SetLanguage )
|
||||
// menu Postprocess
|
||||
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_CMP_FILE, WinEDA_PcbFrame::RecreateCmpFileFromBoard )
|
||||
EVT_MENU( ID_PCB_GEN_BOM_FILE_FROM_BOARD,
|
||||
WinEDA_PcbFrame::RecreateBOMFileFromBoard )
|
||||
|
||||
// menu Postprocess
|
||||
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_CMP_FILE, WinEDA_PcbFrame::RecreateCmpFileFromBoard )
|
||||
EVT_MENU( ID_PCB_GEN_BOM_FILE_FROM_BOARD, WinEDA_PcbFrame::RecreateBOMFileFromBoard )
|
||||
// menu Miscellaneous
|
||||
EVT_MENU( ID_MENU_LIST_NETS, WinEDA_PcbFrame::ListNetsAndSelect )
|
||||
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_SWAP_LAYERS,
|
||||
WinEDA_PcbFrame::Process_Special_Functions )
|
||||
|
||||
// menu Miscellaneous
|
||||
EVT_MENU( ID_MENU_LIST_NETS, WinEDA_PcbFrame::ListNetsAndSelect )
|
||||
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_SWAP_LAYERS,
|
||||
WinEDA_PcbFrame::Process_Special_Functions )
|
||||
// Menu Help
|
||||
EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp )
|
||||
EVT_MENU( ID_KICAD_ABOUT, WinEDA_BasicFrame::GetKicadAbout )
|
||||
|
||||
// Menu Help
|
||||
EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp )
|
||||
EVT_MENU( ID_KICAD_ABOUT, WinEDA_BasicFrame::GetKicadAbout )
|
||||
// Menu 3D Frame
|
||||
EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, WinEDA_PcbFrame::Show3D_Frame )
|
||||
|
||||
// Menu 3D Frame
|
||||
EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, WinEDA_PcbFrame::Show3D_Frame )
|
||||
// Menu Get Design Rules Editor
|
||||
EVT_MENU( ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG,
|
||||
WinEDA_PcbFrame::ShowDesignRulesEditor )
|
||||
|
||||
// Menu Get Design Rules Editor
|
||||
EVT_MENU( ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG, WinEDA_PcbFrame::ShowDesignRulesEditor )
|
||||
// Horizontal toolbar
|
||||
EVT_TOOL( ID_TO_LIBRARY, WinEDA_PcbFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_SHEET_SET, WinEDA_DrawFrame::Process_PageSettings )
|
||||
EVT_TOOL( wxID_CUT, 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( ID_UNDO_BUTT, WinEDA_PcbFrame::GetBoardFromUndoList )
|
||||
EVT_TOOL( ID_REDO_BUTT, WinEDA_PcbFrame::GetBoardFromRedoList )
|
||||
EVT_TOOL( ID_GEN_PRINT, WinEDA_DrawFrame::ToPrinter )
|
||||
EVT_TOOL( ID_GEN_PLOT_SVG, WinEDA_DrawFrame::SVG_Print )
|
||||
EVT_TOOL( ID_GEN_PLOT, 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_DRC_CONTROL, WinEDA_PcbFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR,
|
||||
WinEDA_PcbFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
|
||||
WinEDA_PcbFrame::Tracks_and_Vias_Size_Event )
|
||||
EVT_KICAD_CHOICEBOX( ID_TOOLBARH_PCB_SELECT_LAYER,
|
||||
WinEDA_PcbFrame::Process_Special_Functions )
|
||||
EVT_KICAD_CHOICEBOX( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
|
||||
WinEDA_PcbFrame::Tracks_and_Vias_Size_Event )
|
||||
EVT_KICAD_CHOICEBOX( ID_AUX_TOOLBAR_PCB_VIA_SIZE,
|
||||
WinEDA_PcbFrame::Tracks_and_Vias_Size_Event )
|
||||
EVT_TOOL( ID_TOOLBARH_PCB_AUTOPLACE, WinEDA_PcbFrame::AutoPlace )
|
||||
EVT_TOOL( ID_TOOLBARH_PCB_AUTOROUTE, WinEDA_PcbFrame::AutoPlace )
|
||||
EVT_TOOL( ID_TOOLBARH_PCB_FREEROUTE_ACCESS,
|
||||
WinEDA_PcbFrame::Access_to_External_Tool )
|
||||
|
||||
// Horizontal toolbar
|
||||
EVT_TOOL( ID_TO_LIBRARY, WinEDA_PcbFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_SHEET_SET, WinEDA_DrawFrame::Process_PageSettings )
|
||||
EVT_TOOL( wxID_CUT, 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( ID_UNDO_BUTT, WinEDA_PcbFrame::GetBoardFromUndoList )
|
||||
EVT_TOOL( ID_REDO_BUTT, WinEDA_PcbFrame::GetBoardFromRedoList )
|
||||
EVT_TOOL( ID_GEN_PRINT, WinEDA_DrawFrame::ToPrinter )
|
||||
EVT_TOOL( ID_GEN_PLOT_SVG, WinEDA_DrawFrame::SVG_Print )
|
||||
EVT_TOOL( ID_GEN_PLOT, 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_DRC_CONTROL, WinEDA_PcbFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR,
|
||||
WinEDA_PcbFrame::Process_Special_Functions )
|
||||
EVT_TOOL( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
|
||||
WinEDA_PcbFrame::Tracks_and_Vias_Size_Event )
|
||||
EVT_KICAD_CHOICEBOX( ID_TOOLBARH_PCB_SELECT_LAYER,
|
||||
WinEDA_PcbFrame::Process_Special_Functions )
|
||||
EVT_KICAD_CHOICEBOX( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
|
||||
WinEDA_PcbFrame::Tracks_and_Vias_Size_Event )
|
||||
EVT_KICAD_CHOICEBOX( ID_AUX_TOOLBAR_PCB_VIA_SIZE,
|
||||
WinEDA_PcbFrame::Tracks_and_Vias_Size_Event )
|
||||
EVT_TOOL( ID_TOOLBARH_PCB_AUTOPLACE, WinEDA_PcbFrame::AutoPlace )
|
||||
EVT_TOOL( ID_TOOLBARH_PCB_AUTOROUTE, WinEDA_PcbFrame::AutoPlace )
|
||||
EVT_TOOL( ID_TOOLBARH_PCB_FREEROUTE_ACCESS,
|
||||
WinEDA_PcbFrame::Access_to_External_Tool )
|
||||
// Option toolbar
|
||||
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
|
||||
WinEDA_PcbFrame::OnSelectOptionToolbar )
|
||||
|
||||
// Option toolbar
|
||||
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
|
||||
WinEDA_PcbFrame::OnSelectOptionToolbar )
|
||||
// Vertical toolbar:
|
||||
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_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 )
|
||||
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 )
|
||||
|
||||
// Vertical toolbar:
|
||||
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_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 )
|
||||
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 )
|
||||
EVT_TOOL_RANGE( ID_PCB_MUWAVE_START_CMD, ID_PCB_MUWAVE_END_CMD,
|
||||
WinEDA_PcbFrame::ProcessMuWaveFunctions )
|
||||
|
||||
EVT_TOOL_RANGE( ID_PCB_MUWAVE_START_CMD, ID_PCB_MUWAVE_END_CMD,
|
||||
WinEDA_PcbFrame::ProcessMuWaveFunctions )
|
||||
EVT_TOOL_RCLICKED( ID_TRACK_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_ADD_TEXT_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_TRACK_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_ADD_TEXT_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_MENU_RANGE( ID_POPUP_PCB_AUTOPLACE_START_RANGE,
|
||||
ID_POPUP_PCB_AUTOPLACE_END_RANGE,
|
||||
WinEDA_PcbFrame::AutoPlace )
|
||||
|
||||
EVT_MENU_RANGE( ID_POPUP_PCB_AUTOPLACE_START_RANGE,
|
||||
ID_POPUP_PCB_AUTOPLACE_END_RANGE,
|
||||
WinEDA_PcbFrame::AutoPlace )
|
||||
EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE,
|
||||
WinEDA_PcbFrame::Process_Special_Functions )
|
||||
|
||||
EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE,
|
||||
WinEDA_PcbFrame::Process_Special_Functions )
|
||||
// Tracks and vias sizes general options
|
||||
EVT_MENU_RANGE( ID_POPUP_PCB_SELECT_WIDTH_START_RANGE,
|
||||
ID_POPUP_PCB_SELECT_WIDTH_END_RANGE,
|
||||
WinEDA_PcbFrame::Tracks_and_Vias_Size_Event )
|
||||
|
||||
// Tracks and vias sizes general options
|
||||
EVT_MENU_RANGE( ID_POPUP_PCB_SELECT_WIDTH_START_RANGE, ID_POPUP_PCB_SELECT_WIDTH_END_RANGE,
|
||||
WinEDA_PcbFrame::Tracks_and_Vias_Size_Event )
|
||||
// popup menus
|
||||
EVT_MENU( ID_POPUP_PCB_DELETE_TRACKSEG,
|
||||
WinEDA_PcbFrame::Process_Special_Functions )
|
||||
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
|
||||
WinEDA_PcbFrame::Process_Special_Functions )
|
||||
|
||||
// popup menus
|
||||
EVT_MENU( ID_POPUP_PCB_DELETE_TRACKSEG, WinEDA_PcbFrame::Process_Special_Functions )
|
||||
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
|
||||
WinEDA_PcbFrame::Process_Special_Functions )
|
||||
|
||||
// PopUp Menus pour Zooms traites dans drawpanel.cpp
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
||||
///////****************************///////////:
|
||||
|
||||
/****************/
|
||||
/* Constructeur */
|
||||
/****************/
|
||||
|
||||
WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
|
||||
const wxString& title,
|
||||
const wxPoint& pos, const wxSize& size,
|
||||
|
@ -261,50 +258,49 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
|
|||
ReCreateAuxVToolbar();
|
||||
|
||||
#if defined(KICAD_AUIMANAGER)
|
||||
m_auimgr.SetManagedWindow(this);
|
||||
m_auimgr.SetManagedWindow( this );
|
||||
|
||||
wxAuiPaneInfo horiz;
|
||||
horiz.Gripper(false);
|
||||
horiz.DockFixed(true);
|
||||
horiz.Movable(false);
|
||||
horiz.Floatable(false);
|
||||
horiz.CloseButton(false);
|
||||
horiz.CaptionVisible(false);
|
||||
horiz.Gripper( false );
|
||||
horiz.DockFixed( true );
|
||||
horiz.Movable( false );
|
||||
horiz.Floatable( false );
|
||||
horiz.CloseButton( false );
|
||||
horiz.CaptionVisible( false );
|
||||
|
||||
wxAuiPaneInfo vert(horiz);
|
||||
wxAuiPaneInfo vert( horiz );
|
||||
|
||||
vert.TopDockable(false).BottomDockable(false);
|
||||
horiz.LeftDockable(false).RightDockable(false);
|
||||
vert.TopDockable( false ).BottomDockable( false );
|
||||
horiz.LeftDockable( false ).RightDockable( false );
|
||||
|
||||
m_auimgr.AddPane(m_HToolBar,
|
||||
wxAuiPaneInfo(horiz).Name(wxT("m_HToolBar")).Top().Row(0));
|
||||
m_auimgr.AddPane( m_HToolBar,
|
||||
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().
|
||||
Row( 0 ) );
|
||||
|
||||
m_auimgr.AddPane(m_AuxiliaryToolBar,
|
||||
wxAuiPaneInfo(horiz).Name(wxT("m_AuxiliaryToolBar")).Top().Row(1));
|
||||
m_auimgr.AddPane( m_AuxiliaryToolBar,
|
||||
wxAuiPaneInfo( horiz ).Name( wxT( "m_AuxiliaryToolBar" ) ).Top().Row( 1 ) );
|
||||
|
||||
m_auimgr.AddPane(m_AuxVToolBar,
|
||||
wxAuiPaneInfo(vert).Name(wxT("m_AuxVToolBar")).Right().Row(1).Hide());
|
||||
m_auimgr.AddPane( m_AuxVToolBar,
|
||||
wxAuiPaneInfo( vert ).Name( wxT( "m_AuxVToolBar" ) ).Right().Row( 1 ).Hide() );
|
||||
|
||||
m_auimgr.AddPane(m_VToolBar,
|
||||
wxAuiPaneInfo(vert).Name(wxT("m_VToolBar")).Right());
|
||||
m_auimgr.AddPane( m_VToolBar,
|
||||
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );
|
||||
|
||||
m_auimgr.AddPane(m_OptionsToolBar,
|
||||
wxAuiPaneInfo(vert).Name(wxT("m_OptionsToolBar")).Left());
|
||||
m_auimgr.AddPane( m_OptionsToolBar,
|
||||
wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left() );
|
||||
|
||||
m_auimgr.AddPane(DrawPanel,
|
||||
wxAuiPaneInfo().Name(wxT("DrawFrame")).CentrePane());
|
||||
m_auimgr.AddPane( DrawPanel,
|
||||
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
|
||||
|
||||
m_auimgr.AddPane(MsgPanel,
|
||||
wxAuiPaneInfo(horiz).Name(wxT("MsgPanel")).Bottom());
|
||||
m_auimgr.AddPane( MsgPanel,
|
||||
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
|
||||
|
||||
m_auimgr.Update();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/************************************/
|
||||
WinEDA_PcbFrame::~WinEDA_PcbFrame()
|
||||
/************************************/
|
||||
{
|
||||
extern PARAM_CFG_BASE* ParamCfgList[];
|
||||
|
||||
|
@ -313,9 +309,7 @@ WinEDA_PcbFrame::~WinEDA_PcbFrame()
|
|||
}
|
||||
|
||||
|
||||
/********************************************************/
|
||||
void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event )
|
||||
/********************************************************/
|
||||
{
|
||||
DrawPanel->m_AbortRequest = true;
|
||||
|
||||
|
@ -347,7 +341,8 @@ void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event )
|
|||
|
||||
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 );
|
||||
ActiveScreen = ScreenPcb;
|
||||
Destroy();
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
/***********************************/
|
||||
/** pcbcfg() : configuration **/
|
||||
/***********************************/
|
||||
|
||||
/* lit ou met a jour la configuration de PCBNEW */
|
||||
/****************************************/
|
||||
/** pcbnew_config.cpp : configuration **/
|
||||
/****************************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "appl_wxstruct.h"
|
||||
|
@ -24,12 +22,10 @@
|
|||
#include "dialog_general_options.h"
|
||||
|
||||
|
||||
|
||||
#define HOTKEY_FILENAME wxT( "pcbnew" )
|
||||
|
||||
/***********************************************************/
|
||||
|
||||
void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event )
|
||||
/***********************************************************/
|
||||
{
|
||||
int id = event.GetId();
|
||||
wxPoint pos;
|
||||
|
@ -54,7 +50,7 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event )
|
|||
DisplayDialogLayerSetup( this );
|
||||
break;
|
||||
|
||||
case ID_CONFIG_REQ: // Creation de la fenetre de configuration
|
||||
case ID_CONFIG_REQ:
|
||||
InstallConfigFrame( pos );
|
||||
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
|
||||
*/
|
||||
bool Read_Hotkey_Config( WinEDA_DrawFrame* frame, bool verbose )
|
||||
{
|
||||
wxString FullFileName = ReturnHotkeyConfigFilePath(
|
||||
g_ConfigFileLocationChoice );
|
||||
|
@ -183,7 +176,7 @@ bool WinEDA_PcbFrame::Read_Config( const wxString& projectFileName )
|
|||
|
||||
wxGetApp().RemoveLibraryPath( g_UserLibDirBuffer );
|
||||
|
||||
/* Init des valeurs par defaut */
|
||||
/* Initialize default values. */
|
||||
g_LibName_List.Clear();
|
||||
|
||||
wxGetApp().ReadProjectConfig( fn.GetFullPath(),
|
||||
|
@ -217,10 +210,7 @@ bool WinEDA_PcbFrame::Read_Config( const wxString& projectFileName )
|
|||
}
|
||||
|
||||
|
||||
/**********************************************************/
|
||||
void WinEDA_PcbFrame::Update_config( wxWindow* displayframe )
|
||||
/***********************************************************/
|
||||
/* enregistrement de la config */
|
||||
{
|
||||
wxFileName fn;
|
||||
|
||||
|
@ -234,7 +224,6 @@ void WinEDA_PcbFrame::Update_config( wxWindow* displayframe )
|
|||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
return;
|
||||
|
||||
/* ecriture de la configuration */
|
||||
wxGetApp().WriteProjectConfig( fn.GetFullPath(), wxT( "/pcbnew" ),
|
||||
ParamCfgList );
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
/***********************/
|
||||
/* fichier pcbplot.cpp */
|
||||
/***********************/
|
||||
/***************/
|
||||
/* pcbplot.cpp */
|
||||
/***************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "appl_wxstruct.h"
|
||||
|
@ -25,7 +25,7 @@
|
|||
#define OPTKEY_ALWAYS_PRINT_PADS wxT( "PlotAlwaysPads" )
|
||||
#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 MAX_SCALE 100.0
|
||||
|
||||
|
@ -130,15 +130,15 @@ public:
|
|||
|
||||
// change the A4 to the simple postscript, according to the
|
||||
// PlotFormat enum
|
||||
switch (radioNdx)
|
||||
{
|
||||
case 3:
|
||||
switch (radioNdx)
|
||||
{
|
||||
case 3:
|
||||
radioNdx = PLOT_FORMAT_POST;
|
||||
break;
|
||||
case 4:
|
||||
radioNdx = PLOT_FORMAT_DXF;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
radioNdx = PLOT_FORMAT_DXF;
|
||||
break;
|
||||
}
|
||||
|
||||
return PlotFormat( radioNdx );
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ void WinEDA_PlotFrame::OnInitDialog( wxInitDialogEvent& event )
|
|||
wxT( "Gerber" ),
|
||||
wxT( "Postscript" ),
|
||||
wxT( "Postscript A4" ),
|
||||
wxT( "DXF Export" )
|
||||
wxT( "DXF Export" )
|
||||
};
|
||||
|
||||
m_PlotFormatOpt = new wxRadioBox( this, ID_SEL_PLOT_FORMAT,
|
||||
|
@ -231,25 +231,24 @@ void WinEDA_PlotFrame::OnInitDialog( wxInitDialogEvent& event )
|
|||
if( config )
|
||||
{
|
||||
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 );
|
||||
|
||||
|
||||
// Creation des menus d'option du format HPGL
|
||||
m_HPGL_OptionsBox = new wxStaticBox( this, wxID_ANY, _( "HPGL Options:" ) );
|
||||
wxStaticBoxSizer* HPGL_OptionsBoxSizer =
|
||||
new wxStaticBoxSizer( m_HPGL_OptionsBox, wxVERTICAL );
|
||||
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_UnitMetric,
|
||||
HPGL_OptionsBoxSizer,
|
||||
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)" ),
|
||||
g_pcb_plot_options.HPGL_Pen_Speed, CENTIMETRE,
|
||||
HPGL_OptionsBoxSizer, 1 );
|
||||
|
@ -257,14 +256,14 @@ void WinEDA_PlotFrame::OnInitDialog( wxInitDialogEvent& event )
|
|||
m_HPGLPenSpeedOpt->SetToolTip( _( "Set pen speed in cm/s" ) );
|
||||
|
||||
m_HPGLPenOverlayOpt = new WinEDA_ValueCtrl( this, _( "Pen ovr" ),
|
||||
g_pcb_plot_options.HPGL_Pen_Recouvrement,
|
||||
g_UnitMetric,
|
||||
HPGL_OptionsBoxSizer,
|
||||
UNITS_MILS );
|
||||
g_pcb_plot_options.HPGL_Pen_Recouvrement,
|
||||
g_UnitMetric,
|
||||
HPGL_OptionsBoxSizer,
|
||||
UNITS_MILS );
|
||||
|
||||
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_UnitMetric,
|
||||
MidRightBoxSizer,
|
||||
|
@ -300,7 +299,7 @@ mode and plot pads outlines on silk screen layers" ) );
|
|||
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
|
||||
|| m_XScaleAdjust > MAX_SCALE || m_YScaleAdjust > MAX_SCALE )
|
||||
m_XScaleAdjust = m_YScaleAdjust = 1.0;
|
||||
|
@ -338,7 +337,7 @@ scale plotting" ) );
|
|||
button = new wxButton( this, wxID_CANCEL, _( "Close" ) );
|
||||
RightBoxSizer->Add( button, 0, wxGROW | wxALL, 5 );
|
||||
|
||||
// Creation de la liste des layers
|
||||
// Create layer list.
|
||||
wxBoxSizer* OneColumnLayerBoxSizer = new wxBoxSizer( wxVERTICAL );
|
||||
LayersBoxSizer->Add( OneColumnLayerBoxSizer, 0, wxGROW | wxALL, 5 );
|
||||
|
||||
|
@ -381,18 +380,18 @@ scale plotting" ) );
|
|||
|
||||
m_Exclude_Edges_Pcb = new wxCheckBox( this,
|
||||
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->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 );
|
||||
|
||||
// Option to plot page references:
|
||||
if( m_Parent->m_Print_Sheet_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 );
|
||||
LeftBoxSizer->Add( m_Plot_Sheet_Ref, 0, wxGROW | wxALL, 1 );
|
||||
|
@ -406,7 +405,8 @@ scale plotting" ) );
|
|||
_( "Print pads on silkscreen" ) );
|
||||
|
||||
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->SetToolTip(
|
||||
|
@ -416,7 +416,8 @@ scale plotting" ) );
|
|||
m_Force_Plot_Pads = new wxCheckBox( this, ID_FORCE_PRINT_PAD,
|
||||
_( "Always print pads" ) );
|
||||
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->SetToolTip( _( "Force print/plot pads on ALL layers" ) );
|
||||
|
@ -488,8 +489,8 @@ scale plotting" ) );
|
|||
m_Scale_Opt->SetSelection( g_pcb_plot_options.PlotScaleOpt );
|
||||
MidLeftBoxSizer->Add( m_Scale_Opt, 0, wxGROW | wxALL, 5 );
|
||||
|
||||
static const wxString list_opt3[3] = { _( "Line" ), _( "Filled" ), _(
|
||||
"Sketch" ) };
|
||||
static const wxString list_opt3[3] = { _( "Line" ), _( "Filled" ),
|
||||
_( "Sketch" ) };
|
||||
|
||||
m_PlotModeOpt = new wxRadioBox( this, ID_PLOT_MODE_OPT, _( "Plot Mode" ),
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
|
@ -545,10 +546,11 @@ void WinEDA_PlotFrame::CreateDrillFile( wxCommandEvent& event )
|
|||
void WinEDA_PlotFrame::OnSetScaleOpt( wxCommandEvent& event )
|
||||
{
|
||||
/* 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 );
|
||||
if (!scale1)
|
||||
m_Plot_Sheet_Ref->SetValue(false);
|
||||
|
||||
if ( !scale1 )
|
||||
m_Plot_Sheet_Ref->SetValue( false );
|
||||
}
|
||||
|
||||
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.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();
|
||||
if( g_pcb_plot_options.Plot_Set_MIROIR )
|
||||
g_pcb_plot_options.PlotOrient = PLOT_MIROIR;
|
||||
|
@ -682,16 +685,19 @@ void WinEDA_PlotFrame::SaveOptPlot( wxCommandEvent& event )
|
|||
|
||||
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_YFINESCALE_ADJ, m_YScaleAdjust );
|
||||
config->Write( OPTKEY_PADS_ON_SILKSCREEN, g_pcb_plot_options.PlotPadsOnSilkLayer );
|
||||
config->Write( OPTKEY_ALWAYS_PRINT_PADS, g_pcb_plot_options.Plot_Pads_All_Layers );
|
||||
config->Write( OPTKEY_PADS_ON_SILKSCREEN,
|
||||
g_pcb_plot_options.PlotPadsOnSilkLayer );
|
||||
config->Write( OPTKEY_ALWAYS_PRINT_PADS,
|
||||
g_pcb_plot_options.Plot_Pads_All_Layers );
|
||||
|
||||
int formatNdx = m_PlotFormatOpt->GetSelection();
|
||||
config->Write( OPTKEY_OUTPUT_FORMAT, formatNdx );
|
||||
|
||||
config->Write( OPTKEY_PLOT_LINEWIDTH_VALUE, g_pcb_plot_options.PlotLine_Width );
|
||||
config->Write( OPTKEY_PLOT_LINEWIDTH_VALUE,
|
||||
g_pcb_plot_options.PlotLine_Width );
|
||||
|
||||
wxString layerKey;
|
||||
for( int layer = 0; layer<NB_LAYERS; ++layer )
|
||||
|
@ -774,13 +780,13 @@ void WinEDA_PlotFrame::Plot( wxCommandEvent& event )
|
|||
break;
|
||||
}
|
||||
|
||||
// Test for a reasonnable scale value
|
||||
// Test for a reasonable scale value
|
||||
if( g_pcb_plot_options.Scale < MIN_SCALE )
|
||||
DisplayInfoMessage( this,
|
||||
_( "Warning: Scale option set to a very small value" ) );
|
||||
if( g_pcb_plot_options.Scale > MAX_SCALE )
|
||||
DisplayInfoMessage( this,
|
||||
_( "Warning: Scale option set to a very large value" ) );
|
||||
_( "Warning: Scale option set to a very large value" ) );
|
||||
|
||||
int mask = 1;
|
||||
s_SelectedLayers = 0;
|
||||
|
@ -795,7 +801,7 @@ void WinEDA_PlotFrame::Plot( wxCommandEvent& event )
|
|||
|
||||
fn = m_Parent->GetScreen()->m_FileName;
|
||||
|
||||
// Calcul du nom du fichier
|
||||
// Create file name.
|
||||
fn.SetName( fn.GetName() + wxT( "-" ) +
|
||||
board->GetLayerName( layer_to_plot ) );
|
||||
fn.SetExt( ext );
|
||||
|
@ -804,23 +810,23 @@ void WinEDA_PlotFrame::Plot( wxCommandEvent& event )
|
|||
{
|
||||
case PLOT_FORMAT_POST:
|
||||
m_Parent->Genere_PS( fn.GetFullPath(), layer_to_plot, useA4(),
|
||||
g_pcb_plot_options.Trace_Mode );
|
||||
g_pcb_plot_options.Trace_Mode );
|
||||
break;
|
||||
|
||||
case PLOT_FORMAT_GERBER:
|
||||
m_Parent->Genere_GERBER( fn.GetFullPath(), layer_to_plot,
|
||||
s_PlotOriginIsAuxAxis,
|
||||
g_pcb_plot_options.Trace_Mode );
|
||||
g_pcb_plot_options.Trace_Mode );
|
||||
break;
|
||||
|
||||
case PLOT_FORMAT_HPGL:
|
||||
m_Parent->Genere_HPGL( fn.GetFullPath(), layer_to_plot,
|
||||
g_pcb_plot_options.Trace_Mode );
|
||||
g_pcb_plot_options.Trace_Mode );
|
||||
break;
|
||||
|
||||
case PLOT_FORMAT_DXF:
|
||||
m_Parent->Genere_DXF( fn.GetFullPath(), layer_to_plot,
|
||||
g_pcb_plot_options.Trace_Mode );
|
||||
g_pcb_plot_options.Trace_Mode );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue