Comment translations and other minor updates.
* Complete comment translation for all EESchema source files. * Complete comment translation for all 3D viewer source files. * Rename class class_hierarchical_PIN_sheet to SCH_SHEET_PIN. * Rename class DrawSheetStruct to SCH_SHEET. * Tool tip capitalization fixes. * Uncrustify and spell check comments and strings in all modified source files.
This commit is contained in:
parent
a3f48bf241
commit
b2f9d5bd74
|
@ -1,5 +1,4 @@
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Name: 3d_aux.cpp
|
// Name: 3d_aux.cpp
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -23,9 +22,8 @@
|
||||||
#include "3d_viewer.h"
|
#include "3d_viewer.h"
|
||||||
#include "trackball.h"
|
#include "trackball.h"
|
||||||
|
|
||||||
/**************************************************************************/
|
|
||||||
void S3D_MASTER::Set_Object_Coords( S3D_Vertex* coord, int nbcoord )
|
void S3D_MASTER::Set_Object_Coords( S3D_Vertex* coord, int nbcoord )
|
||||||
/**************************************************************************/
|
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
|
|
||||||
|
@ -39,13 +37,13 @@ void S3D_MASTER::Set_Object_Coords( S3D_Vertex* coord, int nbcoord )
|
||||||
/* adjust rotation */
|
/* adjust rotation */
|
||||||
if( m_MatRotation.x )
|
if( m_MatRotation.x )
|
||||||
RotatePoint( &coord[ii].y, &coord[ii].z,
|
RotatePoint( &coord[ii].y, &coord[ii].z,
|
||||||
(int) (m_MatRotation.x * 10) );
|
(int) (m_MatRotation.x * 10) );
|
||||||
if( m_MatRotation.y )
|
if( m_MatRotation.y )
|
||||||
RotatePoint( &coord[ii].z, &coord[ii].x,
|
RotatePoint( &coord[ii].z, &coord[ii].x,
|
||||||
(int) (m_MatRotation.y * 10) );
|
(int) (m_MatRotation.y * 10) );
|
||||||
if( m_MatRotation.z )
|
if( m_MatRotation.z )
|
||||||
RotatePoint( &coord[ii].x, &coord[ii].y,
|
RotatePoint( &coord[ii].x, &coord[ii].y,
|
||||||
(int) (m_MatRotation.z * 10) );
|
(int) (m_MatRotation.z * 10) );
|
||||||
/* adjust offset position (offset is given in UNIT 3D (0.1 inch) */
|
/* adjust offset position (offset is given in UNIT 3D (0.1 inch) */
|
||||||
#define SCALE_3D_CONV (PCB_INTERNAL_UNIT / UNITS3D_TO_UNITSPCB)
|
#define SCALE_3D_CONV (PCB_INTERNAL_UNIT / UNITS3D_TO_UNITSPCB)
|
||||||
coord[ii].x += m_MatPosition.x * SCALE_3D_CONV;
|
coord[ii].x += m_MatPosition.x * SCALE_3D_CONV;
|
||||||
|
@ -55,9 +53,7 @@ void S3D_MASTER::Set_Object_Coords( S3D_Vertex* coord, int nbcoord )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************/
|
|
||||||
void Set_Object_Data( const S3D_Vertex* coord, int nbcoord )
|
void Set_Object_Data( const S3D_Vertex* coord, int nbcoord )
|
||||||
/************************************************************/
|
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
GLfloat ax, ay, az, bx, by, bz, nx, ny, nz, r;
|
GLfloat ax, ay, az, bx, by, bz, nx, ny, nz, r;
|
||||||
|
@ -106,17 +102,15 @@ void Set_Object_Data( const S3D_Vertex* coord, int nbcoord )
|
||||||
for( ii = 0; ii < nbcoord; ii++ )
|
for( ii = 0; ii < nbcoord; ii++ )
|
||||||
{
|
{
|
||||||
glVertex3f( coord[ii].x * DataScale3D,
|
glVertex3f( coord[ii].x * DataScale3D,
|
||||||
coord[ii].y * DataScale3D,
|
coord[ii].y * DataScale3D,
|
||||||
coord[ii].z * DataScale3D );
|
coord[ii].z * DataScale3D );
|
||||||
}
|
}
|
||||||
|
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************/
|
|
||||||
GLuint Pcb3D_GLCanvas::DisplayCubeforTest()
|
GLuint Pcb3D_GLCanvas::DisplayCubeforTest()
|
||||||
/**********************************************/
|
|
||||||
{
|
{
|
||||||
GLuint gllist = glGenLists( 1 );
|
GLuint gllist = glGenLists( 1 );
|
||||||
|
|
||||||
|
@ -158,7 +152,6 @@ GLuint Pcb3D_GLCanvas::DisplayCubeforTest()
|
||||||
/* class Info_3D_Visu */
|
/* class Info_3D_Visu */
|
||||||
/**********************/
|
/**********************/
|
||||||
|
|
||||||
/* Constructor */
|
|
||||||
Info_3D_Visu::Info_3D_Visu()
|
Info_3D_Visu::Info_3D_Visu()
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
|
@ -176,8 +169,8 @@ Info_3D_Visu::Info_3D_Visu()
|
||||||
m_Draw3DZone = TRUE;
|
m_Draw3DZone = TRUE;
|
||||||
m_Draw3DComments = TRUE;
|
m_Draw3DComments = TRUE;
|
||||||
m_Draw3DDrawings = TRUE;
|
m_Draw3DDrawings = TRUE;
|
||||||
m_Draw3DEco1 = TRUE;
|
m_Draw3DEco1 = TRUE;
|
||||||
m_Draw3DEco2 = TRUE;
|
m_Draw3DEco2 = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -186,11 +179,8 @@ Info_3D_Visu::~Info_3D_Visu()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
/* Display and edit a Vertex (triplet of values) in INCHES or MM or without
|
||||||
/* Classe pour afficher et editer un Vertex (triplet de valeurs),*/
|
* units */
|
||||||
/* en INCHES ou MM ou sans unites */
|
|
||||||
/*****************************************************************/
|
|
||||||
|
|
||||||
WinEDA_VertexCtrl::WinEDA_VertexCtrl( wxWindow* parent, const wxString& title,
|
WinEDA_VertexCtrl::WinEDA_VertexCtrl( wxWindow* parent, const wxString& title,
|
||||||
wxBoxSizer* BoxSizer,
|
wxBoxSizer* BoxSizer,
|
||||||
int units, int internal_unit )
|
int units, int internal_unit )
|
||||||
|
@ -207,73 +197,63 @@ WinEDA_VertexCtrl::WinEDA_VertexCtrl( wxWindow* parent, const wxString& title,
|
||||||
text = title;
|
text = title;
|
||||||
text += ReturnUnitSymbol( units );
|
text += ReturnUnitSymbol( units );
|
||||||
|
|
||||||
msgtitle = new wxStaticText( parent, -1, text, wxDefaultPosition, wxSize(
|
msgtitle = new wxStaticText( parent, -1, text, wxDefaultPosition,
|
||||||
-1,
|
wxSize( -1, -1 ), 0 );
|
||||||
-1 ), 0 );
|
|
||||||
|
|
||||||
BoxSizer->Add( msgtitle, wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM | wxADJUST_MINSIZE );
|
BoxSizer->Add(
|
||||||
|
msgtitle,
|
||||||
|
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM |
|
||||||
|
wxADJUST_MINSIZE );
|
||||||
|
|
||||||
wxFlexGridSizer* GridSizer = new wxFlexGridSizer( 3, 2, 0, 0 );
|
wxFlexGridSizer* GridSizer = new wxFlexGridSizer( 3, 2, 0, 0 );
|
||||||
|
|
||||||
BoxSizer->Add( GridSizer, 0, wxGROW | wxALL, 5 );
|
BoxSizer->Add( GridSizer, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
msgtitle = new wxStaticText( parent, -1, wxT( "X:" ) );
|
msgtitle = new wxStaticText( parent, -1, wxT( "X:" ) );
|
||||||
|
|
||||||
GridSizer->Add( msgtitle,
|
GridSizer->Add( msgtitle, 0,
|
||||||
0,
|
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
|
||||||
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxADJUST_MINSIZE,
|
wxLEFT | wxRIGHT | wxADJUST_MINSIZE,
|
||||||
5 );
|
5 );
|
||||||
m_XValueCtrl = new wxTextCtrl( parent,
|
m_XValueCtrl = new wxTextCtrl( parent, -1, wxEmptyString,
|
||||||
-1,
|
wxDefaultPosition, wxSize( -1, -1 ), 0 );
|
||||||
wxEmptyString,
|
|
||||||
wxDefaultPosition,
|
|
||||||
wxSize( -1, -1 ),
|
|
||||||
0 );
|
|
||||||
|
|
||||||
GridSizer->Add( m_XValueCtrl,
|
GridSizer->Add( m_XValueCtrl,
|
||||||
0,
|
0,
|
||||||
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT,
|
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
|
||||||
5 );
|
wxLEFT | wxRIGHT,
|
||||||
|
5 );
|
||||||
|
|
||||||
msgtitle = new wxStaticText( parent, -1, wxT(
|
msgtitle = new wxStaticText( parent, -1, wxT( "Y:" ), wxDefaultPosition,
|
||||||
"Y:" ), wxDefaultPosition, wxSize( -1,
|
wxSize( -1, -1 ), 0 );
|
||||||
-1 ), 0 );
|
|
||||||
|
|
||||||
GridSizer->Add( msgtitle,
|
GridSizer->Add( msgtitle,
|
||||||
0,
|
0,
|
||||||
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxADJUST_MINSIZE,
|
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
|
||||||
5 );
|
wxLEFT | wxRIGHT | wxADJUST_MINSIZE,
|
||||||
m_YValueCtrl = new wxTextCtrl( parent,
|
5 );
|
||||||
-1,
|
m_YValueCtrl = new wxTextCtrl( parent, -1, wxEmptyString,
|
||||||
wxEmptyString,
|
wxDefaultPosition, wxSize( -1, -1 ), 0 );
|
||||||
wxDefaultPosition,
|
|
||||||
wxSize( -1, -1 ),
|
|
||||||
0 );
|
|
||||||
|
|
||||||
GridSizer->Add( m_YValueCtrl,
|
GridSizer->Add( m_YValueCtrl, 0,
|
||||||
0,
|
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
|
||||||
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT,
|
wxLEFT | wxRIGHT,
|
||||||
5 );
|
5 );
|
||||||
|
|
||||||
msgtitle = new wxStaticText( parent, -1, wxT(
|
msgtitle = new wxStaticText( parent, -1, wxT( "Z:" ), wxDefaultPosition,
|
||||||
"Z:" ), wxDefaultPosition, wxSize( -1,
|
wxSize( -1, -1 ), 0 );
|
||||||
-1 ), 0 );
|
|
||||||
|
|
||||||
GridSizer->Add( msgtitle,
|
GridSizer->Add( msgtitle, 0,
|
||||||
0,
|
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
|
||||||
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxADJUST_MINSIZE,
|
wxLEFT | wxRIGHT | wxADJUST_MINSIZE,
|
||||||
5 );
|
5 );
|
||||||
m_ZValueCtrl = new wxTextCtrl( parent,
|
m_ZValueCtrl = new wxTextCtrl( parent, -1, wxEmptyString,
|
||||||
-1,
|
wxDefaultPosition, wxSize( -1, -1 ), 0 );
|
||||||
wxEmptyString,
|
|
||||||
wxDefaultPosition,
|
|
||||||
wxSize( -1, -1 ),
|
|
||||||
0 );
|
|
||||||
|
|
||||||
GridSizer->Add( m_ZValueCtrl,
|
GridSizer->Add( m_ZValueCtrl, 0,
|
||||||
0,
|
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
|
||||||
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT,
|
wxLEFT | wxRIGHT,
|
||||||
5 );
|
5 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -282,12 +262,8 @@ WinEDA_VertexCtrl::~WinEDA_VertexCtrl()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************/
|
/* Returns (in internal units) to coordinate between (in user units) */
|
||||||
S3D_Vertex WinEDA_VertexCtrl::GetValue()
|
S3D_Vertex WinEDA_VertexCtrl::GetValue()
|
||||||
/*******************************************/
|
|
||||||
|
|
||||||
/* Retourne (en unites internes) les coordonnes entrees (en unites utilisateur)
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
S3D_Vertex value;
|
S3D_Vertex value;
|
||||||
double dtmp;
|
double dtmp;
|
||||||
|
@ -302,9 +278,7 @@ S3D_Vertex WinEDA_VertexCtrl::GetValue()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************/
|
|
||||||
void WinEDA_VertexCtrl::SetValue( S3D_Vertex vertex )
|
void WinEDA_VertexCtrl::SetValue( S3D_Vertex vertex )
|
||||||
/**************************************************/
|
|
||||||
{
|
{
|
||||||
wxString text;
|
wxString text;
|
||||||
|
|
||||||
|
@ -322,9 +296,7 @@ void WinEDA_VertexCtrl::SetValue( S3D_Vertex vertex )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************/
|
|
||||||
void WinEDA_VertexCtrl::Enable( bool onoff )
|
void WinEDA_VertexCtrl::Enable( bool onoff )
|
||||||
/*****************************************/
|
|
||||||
{
|
{
|
||||||
m_XValueCtrl->Enable( onoff );
|
m_XValueCtrl->Enable( onoff );
|
||||||
m_YValueCtrl->Enable( onoff );
|
m_YValueCtrl->Enable( onoff );
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Name: 3d_canvas.cpp
|
// Name: 3d_canvas.cpp
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -35,39 +34,38 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE( Pcb3D_GLCanvas, wxGLCanvas )
|
BEGIN_EVENT_TABLE( Pcb3D_GLCanvas, wxGLCanvas )
|
||||||
EVT_PAINT( Pcb3D_GLCanvas::OnPaint )
|
EVT_PAINT( Pcb3D_GLCanvas::OnPaint )
|
||||||
EVT_CHAR( Pcb3D_GLCanvas::OnChar )
|
EVT_CHAR( Pcb3D_GLCanvas::OnChar )
|
||||||
EVT_MOUSE_EVENTS( Pcb3D_GLCanvas::OnMouseEvent )
|
EVT_MOUSE_EVENTS( Pcb3D_GLCanvas::OnMouseEvent )
|
||||||
EVT_ERASE_BACKGROUND( Pcb3D_GLCanvas::OnEraseBackground )
|
EVT_ERASE_BACKGROUND( Pcb3D_GLCanvas::OnEraseBackground )
|
||||||
EVT_MENU_RANGE( ID_POPUP_3D_VIEW_START, ID_POPUP_3D_VIEW_END,
|
EVT_MENU_RANGE( ID_POPUP_3D_VIEW_START, ID_POPUP_3D_VIEW_END,
|
||||||
Pcb3D_GLCanvas::OnPopUpMenu )
|
Pcb3D_GLCanvas::OnPopUpMenu )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
Pcb3D_GLCanvas::Pcb3D_GLCanvas( WinEDA3D_DrawFrame* parent ) :
|
Pcb3D_GLCanvas::Pcb3D_GLCanvas( WinEDA3D_DrawFrame* parent ) :
|
||||||
#if wxCHECK_VERSION( 2, 9, 0 )
|
#if wxCHECK_VERSION( 2, 9, 0 )
|
||||||
wxGLCanvas( parent, -1, NULL, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE )
|
wxGLCanvas( parent, -1, NULL, wxDefaultPosition, wxDefaultSize,
|
||||||
|
wxFULL_REPAINT_ON_RESIZE )
|
||||||
#else
|
#else
|
||||||
wxGLCanvas( parent, -1, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE )
|
wxGLCanvas( parent, -1, wxDefaultPosition, wxDefaultSize,
|
||||||
|
wxFULL_REPAINT_ON_RESIZE )
|
||||||
#endif
|
#endif
|
||||||
/*************************************************************************/
|
|
||||||
{
|
{
|
||||||
m_init = FALSE;
|
m_init = FALSE;
|
||||||
m_gllist = 0;
|
m_gllist = 0;
|
||||||
m_Parent = parent;
|
m_Parent = parent;
|
||||||
|
|
||||||
#if wxCHECK_VERSION( 2, 9, 0 )
|
#if wxCHECK_VERSION( 2, 9, 0 )
|
||||||
|
|
||||||
// Explicitly create a new rendering context instance for this canvas.
|
// Explicitly create a new rendering context instance for this canvas.
|
||||||
m_glRC = new wxGLContext(this);
|
m_glRC = new wxGLContext( this );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DisplayStatus();
|
DisplayStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************/
|
|
||||||
Pcb3D_GLCanvas::~Pcb3D_GLCanvas()
|
Pcb3D_GLCanvas::~Pcb3D_GLCanvas()
|
||||||
/*************************************/
|
|
||||||
{
|
{
|
||||||
ClearLists();
|
ClearLists();
|
||||||
m_init = FALSE;
|
m_init = FALSE;
|
||||||
|
@ -77,9 +75,7 @@ Pcb3D_GLCanvas::~Pcb3D_GLCanvas()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************/
|
|
||||||
void Pcb3D_GLCanvas::ClearLists()
|
void Pcb3D_GLCanvas::ClearLists()
|
||||||
/*************************************/
|
|
||||||
{
|
{
|
||||||
if( m_gllist > 0 )
|
if( m_gllist > 0 )
|
||||||
glDeleteLists( m_gllist, 1 );
|
glDeleteLists( m_gllist, 1 );
|
||||||
|
@ -87,18 +83,14 @@ void Pcb3D_GLCanvas::ClearLists()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************/
|
|
||||||
void Pcb3D_GLCanvas::OnChar( wxKeyEvent& event )
|
void Pcb3D_GLCanvas::OnChar( wxKeyEvent& event )
|
||||||
/*********************************************/
|
|
||||||
{
|
{
|
||||||
SetView3D( event.GetKeyCode() );
|
SetView3D( event.GetKeyCode() );
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************/
|
|
||||||
void Pcb3D_GLCanvas::SetView3D( int keycode )
|
void Pcb3D_GLCanvas::SetView3D( int keycode )
|
||||||
/*********************************************/
|
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
double delta_move = 0.7 * g_Parm_3D_Visu.m_Zoom;
|
double delta_move = 0.7 * g_Parm_3D_Visu.m_Zoom;
|
||||||
|
@ -214,9 +206,7 @@ void Pcb3D_GLCanvas::SetView3D( int keycode )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************/
|
|
||||||
void Pcb3D_GLCanvas::OnMouseEvent( wxMouseEvent& event )
|
void Pcb3D_GLCanvas::OnMouseEvent( wxMouseEvent& event )
|
||||||
/********************************************************/
|
|
||||||
{
|
{
|
||||||
wxSize size( GetClientSize() );
|
wxSize size( GetClientSize() );
|
||||||
double spin_quat[4];
|
double spin_quat[4];
|
||||||
|
@ -286,10 +276,14 @@ void Pcb3D_GLCanvas::OnMouseEvent( wxMouseEvent& event )
|
||||||
else if( event.MiddleIsDown() )
|
else if( event.MiddleIsDown() )
|
||||||
{
|
{
|
||||||
/* middle button drag -> pan */
|
/* middle button drag -> pan */
|
||||||
/* Current zoom and an additional factor are taken into account for the amount of panning. */
|
|
||||||
|
/* Current zoom and an additional factor are taken into account
|
||||||
|
* for the amount of panning. */
|
||||||
const double PAN_FACTOR = 8.0 * g_Parm_3D_Visu.m_Zoom;
|
const double PAN_FACTOR = 8.0 * g_Parm_3D_Visu.m_Zoom;
|
||||||
g_Draw3d_dx -= PAN_FACTOR * ( g_Parm_3D_Visu.m_Beginx - event.GetX() ) / size.x;
|
g_Draw3d_dx -= PAN_FACTOR *
|
||||||
g_Draw3d_dy -= PAN_FACTOR * (event.GetY() - g_Parm_3D_Visu.m_Beginy) / size.y;
|
( g_Parm_3D_Visu.m_Beginx - event.GetX() ) / size.x;
|
||||||
|
g_Draw3d_dy -= PAN_FACTOR *
|
||||||
|
(event.GetY() - g_Parm_3D_Visu.m_Beginy) / size.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* orientation has changed, redraw mesh */
|
/* orientation has changed, redraw mesh */
|
||||||
|
@ -302,80 +296,76 @@ void Pcb3D_GLCanvas::OnMouseEvent( wxMouseEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************/
|
/* Construct and display a popup menu when the right button is clicked.
|
||||||
void Pcb3D_GLCanvas::OnRightClick( wxMouseEvent& event )
|
|
||||||
/*******************************************************/
|
|
||||||
|
|
||||||
/* Construit et affiche un menu Popup lorsque on actionne le bouton droit
|
|
||||||
* de la souris
|
|
||||||
*/
|
*/
|
||||||
|
void Pcb3D_GLCanvas::OnRightClick( wxMouseEvent& event )
|
||||||
{
|
{
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
wxMenu PopUpMenu;
|
wxMenu PopUpMenu;
|
||||||
|
|
||||||
pos.x = event.GetX(); pos.y = event.GetY();
|
pos.x = event.GetX(); pos.y = event.GetY();
|
||||||
wxMenuItem* item = new wxMenuItem( &PopUpMenu, ID_POPUP_ZOOMIN,
|
wxMenuItem* item = new wxMenuItem( &PopUpMenu, ID_POPUP_ZOOMIN,
|
||||||
_( "Zoom +" ) );
|
_( "Zoom +" ) );
|
||||||
item->SetBitmap( zoom_in_xpm );
|
item->SetBitmap( zoom_in_xpm );
|
||||||
PopUpMenu.Append( item );
|
PopUpMenu.Append( item );
|
||||||
|
|
||||||
item = new wxMenuItem( &PopUpMenu, ID_POPUP_ZOOMOUT,
|
item = new wxMenuItem( &PopUpMenu, ID_POPUP_ZOOMOUT,
|
||||||
_( "Zoom -" ) );
|
_( "Zoom -" ) );
|
||||||
item->SetBitmap( zoom_out_xpm );
|
item->SetBitmap( zoom_out_xpm );
|
||||||
PopUpMenu.Append( item );
|
PopUpMenu.Append( item );
|
||||||
|
|
||||||
PopUpMenu.AppendSeparator();
|
PopUpMenu.AppendSeparator();
|
||||||
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_ZPOS,
|
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_ZPOS,
|
||||||
_( "Top View" ) );
|
_( "Top View" ) );
|
||||||
item->SetBitmap( axis3d_top_xpm );
|
item->SetBitmap( axis3d_top_xpm );
|
||||||
PopUpMenu.Append( item );
|
PopUpMenu.Append( item );
|
||||||
|
|
||||||
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_ZNEG,
|
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_ZNEG,
|
||||||
_( "Bottom View" ) );
|
_( "Bottom View" ) );
|
||||||
item->SetBitmap( axis3d_bottom_xpm );
|
item->SetBitmap( axis3d_bottom_xpm );
|
||||||
PopUpMenu.Append( item );
|
PopUpMenu.Append( item );
|
||||||
|
|
||||||
PopUpMenu.AppendSeparator();
|
PopUpMenu.AppendSeparator();
|
||||||
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_XPOS,
|
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_XPOS,
|
||||||
_( "Right View" ) );
|
_( "Right View" ) );
|
||||||
item->SetBitmap( axis3d_right_xpm );
|
item->SetBitmap( axis3d_right_xpm );
|
||||||
PopUpMenu.Append( item );
|
PopUpMenu.Append( item );
|
||||||
|
|
||||||
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_XNEG,
|
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_XNEG,
|
||||||
_( "Left View" ) );
|
_( "Left View" ) );
|
||||||
item->SetBitmap( axis3d_left_xpm );
|
item->SetBitmap( axis3d_left_xpm );
|
||||||
PopUpMenu.Append( item );
|
PopUpMenu.Append( item );
|
||||||
|
|
||||||
|
|
||||||
PopUpMenu.AppendSeparator();
|
PopUpMenu.AppendSeparator();
|
||||||
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_YPOS,
|
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_YPOS,
|
||||||
_( "Front View" ) );
|
_( "Front View" ) );
|
||||||
item->SetBitmap( axis3d_front_xpm );
|
item->SetBitmap( axis3d_front_xpm );
|
||||||
PopUpMenu.Append( item );
|
PopUpMenu.Append( item );
|
||||||
|
|
||||||
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_YNEG,
|
item = new wxMenuItem( &PopUpMenu, ID_POPUP_VIEW_YNEG,
|
||||||
_( "Back View" ) );
|
_( "Back View" ) );
|
||||||
item->SetBitmap( axis3d_back_xpm );
|
item->SetBitmap( axis3d_back_xpm );
|
||||||
PopUpMenu.Append( item );
|
PopUpMenu.Append( item );
|
||||||
|
|
||||||
PopUpMenu.AppendSeparator();
|
PopUpMenu.AppendSeparator();
|
||||||
item = new wxMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_LEFT,
|
item = new wxMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_LEFT,
|
||||||
_( "Move left <-" ) );
|
_( "Move left <-" ) );
|
||||||
item->SetBitmap( left_xpm );
|
item->SetBitmap( left_xpm );
|
||||||
PopUpMenu.Append( item );
|
PopUpMenu.Append( item );
|
||||||
|
|
||||||
item = new wxMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_RIGHT,
|
item = new wxMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_RIGHT,
|
||||||
_( "Move right ->" ) );
|
_( "Move right ->" ) );
|
||||||
item->SetBitmap( right_xpm );
|
item->SetBitmap( right_xpm );
|
||||||
PopUpMenu.Append( item );
|
PopUpMenu.Append( item );
|
||||||
|
|
||||||
item = new wxMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_UP,
|
item = new wxMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_UP,
|
||||||
_( "Move Up ^" ) );
|
_( "Move Up ^" ) );
|
||||||
item->SetBitmap( up_xpm );
|
item->SetBitmap( up_xpm );
|
||||||
PopUpMenu.Append( item );
|
PopUpMenu.Append( item );
|
||||||
|
|
||||||
item = new wxMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_DOWN,
|
item = new wxMenuItem( &PopUpMenu, ID_POPUP_MOVE3D_DOWN,
|
||||||
_( "Move Down" ) );
|
_( "Move Down" ) );
|
||||||
item->SetBitmap( down_xpm );
|
item->SetBitmap( down_xpm );
|
||||||
PopUpMenu.Append( item );
|
PopUpMenu.Append( item );
|
||||||
|
|
||||||
|
@ -383,9 +373,7 @@ void Pcb3D_GLCanvas::OnRightClick( wxMouseEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************/
|
|
||||||
void Pcb3D_GLCanvas::OnPopUpMenu( wxCommandEvent& event )
|
void Pcb3D_GLCanvas::OnPopUpMenu( wxCommandEvent& event )
|
||||||
/*******************************************************/
|
|
||||||
{
|
{
|
||||||
int key = 0;
|
int key = 0;
|
||||||
|
|
||||||
|
@ -447,9 +435,7 @@ void Pcb3D_GLCanvas::OnPopUpMenu( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************/
|
|
||||||
void Pcb3D_GLCanvas::DisplayStatus()
|
void Pcb3D_GLCanvas::DisplayStatus()
|
||||||
/***************************************/
|
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
|
@ -464,30 +450,23 @@ void Pcb3D_GLCanvas::DisplayStatus()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************/
|
|
||||||
void Pcb3D_GLCanvas::OnPaint( wxPaintEvent& event )
|
void Pcb3D_GLCanvas::OnPaint( wxPaintEvent& event )
|
||||||
/*************************************************/
|
|
||||||
{
|
{
|
||||||
wxPaintDC dc( this );
|
wxPaintDC dc( this );
|
||||||
|
|
||||||
Redraw();
|
Redraw();
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
|
||||||
void Pcb3D_GLCanvas::OnEraseBackground( wxEraseEvent& event )
|
void Pcb3D_GLCanvas::OnEraseBackground( wxEraseEvent& event )
|
||||||
/***********************************************************/
|
|
||||||
{
|
{
|
||||||
// Do nothing, to avoid flashing.
|
// Do nothing, to avoid flashing.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************/
|
/* Initialize broad parameters for OpenGL */
|
||||||
void Pcb3D_GLCanvas::InitGL()
|
void Pcb3D_GLCanvas::InitGL()
|
||||||
/****************************/
|
|
||||||
|
|
||||||
/* Int parametres generaux pour OPENGL
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
wxSize size = GetClientSize();
|
wxSize size = GetClientSize();
|
||||||
|
|
||||||
|
@ -517,7 +496,9 @@ void Pcb3D_GLCanvas::InitGL()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set viewing projection */
|
/* set viewing projection */
|
||||||
double ratio_HV = (double) size.x / size.y; // Ratio largeur /hauteur de la fenetre d'affichage
|
|
||||||
|
// Ratio width / height of the window display
|
||||||
|
double ratio_HV = (double) size.x / size.y;
|
||||||
glMatrixMode( GL_PROJECTION );
|
glMatrixMode( GL_PROJECTION );
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
|
@ -541,17 +522,11 @@ void Pcb3D_GLCanvas::InitGL()
|
||||||
|
|
||||||
/* Setup light souces: */
|
/* Setup light souces: */
|
||||||
SetLights();
|
SetLights();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************/
|
/* Initialize OpenGL light sources. */
|
||||||
void Pcb3D_GLCanvas::SetLights()
|
void Pcb3D_GLCanvas::SetLights()
|
||||||
/***********************************/
|
|
||||||
|
|
||||||
/* Init sources lumineuses pour OPENGL
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
double light;
|
double light;
|
||||||
GLfloat light_color[4];
|
GLfloat light_color[4];
|
||||||
|
@ -576,13 +551,10 @@ void Pcb3D_GLCanvas::SetLights()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************/
|
|
||||||
void Pcb3D_GLCanvas::TakeScreenshot( wxCommandEvent& event )
|
|
||||||
/**********************************************************/
|
|
||||||
|
|
||||||
/* Create a Screenshot of the current 3D view.
|
/* Create a Screenshot of the current 3D view.
|
||||||
* Output file format is png or jpeg, or image is copied on clipboard
|
* Output file format is png or jpeg, or image is copied on clipboard
|
||||||
*/
|
*/
|
||||||
|
void Pcb3D_GLCanvas::TakeScreenshot( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxFileName fn( m_Parent->m_Parent->GetScreen()->m_FileName );
|
wxFileName fn( m_Parent->m_Parent->GetScreen()->m_FileName );
|
||||||
wxString FullFileName;
|
wxString FullFileName;
|
||||||
|
@ -599,15 +571,10 @@ void Pcb3D_GLCanvas::TakeScreenshot( wxCommandEvent& event )
|
||||||
fn.SetExt( file_ext );
|
fn.SetExt( file_ext );
|
||||||
|
|
||||||
FullFileName =
|
FullFileName =
|
||||||
EDA_FileSelector( _( "3D Image filename:" ),
|
EDA_FileSelector( _( "3D Image filename:" ), wxEmptyString,
|
||||||
wxEmptyString, /* Chemin par defaut */
|
fn.GetFullName(), file_ext, mask, this,
|
||||||
fn.GetFullName(), /* nom fichier par defaut */
|
wxFD_SAVE, TRUE );
|
||||||
file_ext, /* extension par defaut */
|
|
||||||
mask, /* Masque d'affichage */
|
|
||||||
this,
|
|
||||||
wxFD_SAVE,
|
|
||||||
TRUE
|
|
||||||
);
|
|
||||||
if( FullFileName.IsEmpty() )
|
if( FullFileName.IsEmpty() )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -630,8 +597,9 @@ void Pcb3D_GLCanvas::TakeScreenshot( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
if( !wxTheClipboard->SetData( dobjBmp ) )
|
if( !wxTheClipboard->SetData( dobjBmp ) )
|
||||||
wxLogError( _T( "Failed to copy image to clipboard" ) );
|
wxLogError( _T( "Failed to copy image to clipboard" ) );
|
||||||
wxTheClipboard->Flush(); /* the data on clipboard
|
wxTheClipboard->Flush(); /* the data in clipboard will stay
|
||||||
* will stay available after the application exits */
|
* available after the
|
||||||
|
* application exits */
|
||||||
wxTheClipboard->Close();
|
wxTheClipboard->Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -640,7 +608,8 @@ void Pcb3D_GLCanvas::TakeScreenshot( wxCommandEvent& event )
|
||||||
wxImage image = bitmap.ConvertToImage();
|
wxImage image = bitmap.ConvertToImage();
|
||||||
|
|
||||||
if( !image.SaveFile( FullFileName,
|
if( !image.SaveFile( FullFileName,
|
||||||
fmt_is_jpeg ? wxBITMAP_TYPE_JPEG : wxBITMAP_TYPE_PNG ) )
|
fmt_is_jpeg ? wxBITMAP_TYPE_JPEG :
|
||||||
|
wxBITMAP_TYPE_PNG ) )
|
||||||
wxLogError( wxT( "Can't save file" ) );
|
wxLogError( wxT( "Can't save file" ) );
|
||||||
|
|
||||||
image.Destroy();
|
image.Destroy();
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Name: 3d_class.cpp
|
// Name: 3d_class.cpp
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -14,37 +13,31 @@
|
||||||
#include "3d_viewer.h"
|
#include "3d_viewer.h"
|
||||||
|
|
||||||
|
|
||||||
/****************************/
|
|
||||||
S3D_Vertex::S3D_Vertex()
|
S3D_Vertex::S3D_Vertex()
|
||||||
/****************************/
|
|
||||||
{
|
{
|
||||||
x = y = z = 0.0;
|
x = y = z = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************/
|
|
||||||
S3D_MATERIAL::S3D_MATERIAL( S3D_MASTER* father, const wxString& name ) :
|
S3D_MATERIAL::S3D_MATERIAL( S3D_MASTER* father, const wxString& name ) :
|
||||||
EDA_BaseStruct( father, NOT_USED )
|
EDA_BaseStruct( father, NOT_USED )
|
||||||
/**************************************************************************/
|
|
||||||
{
|
{
|
||||||
m_DiffuseColor.x = m_DiffuseColor.y = m_DiffuseColor.z = 1.0;
|
m_DiffuseColor.x = m_DiffuseColor.y = m_DiffuseColor.z = 1.0;
|
||||||
m_SpecularColor.x = m_SpecularColor.y = m_SpecularColor.z = 1.0;
|
m_SpecularColor.x = m_SpecularColor.y = m_SpecularColor.z = 1.0;
|
||||||
m_AmbientIntensity = 1.0;
|
m_AmbientIntensity = 1.0;
|
||||||
m_Transparency = 0.0;
|
m_Transparency = 0.0;
|
||||||
m_Shininess = 1.0;
|
m_Shininess = 1.0;
|
||||||
m_Name = name;
|
m_Name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************/
|
|
||||||
void S3D_MATERIAL::SetMaterial()
|
void S3D_MATERIAL::SetMaterial()
|
||||||
/***********************************/
|
|
||||||
{
|
{
|
||||||
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
|
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
|
||||||
glColor4f( m_DiffuseColor.x * m_AmbientIntensity,
|
glColor4f( m_DiffuseColor.x * m_AmbientIntensity,
|
||||||
m_DiffuseColor.y * m_AmbientIntensity,
|
m_DiffuseColor.y * m_AmbientIntensity,
|
||||||
m_DiffuseColor.z * m_AmbientIntensity,
|
m_DiffuseColor.z * m_AmbientIntensity,
|
||||||
1.0 - m_Transparency );
|
1.0 - m_Transparency );
|
||||||
#if 0
|
#if 0
|
||||||
glColorMaterial( GL_FRONT_AND_BACK, GL_SPECULAR );
|
glColorMaterial( GL_FRONT_AND_BACK, GL_SPECULAR );
|
||||||
glColor3f( m_SpecularColor.x, m_SpecularColor.y, m_SpecularColor.z );
|
glColor3f( m_SpecularColor.x, m_SpecularColor.y, m_SpecularColor.z );
|
||||||
|
@ -53,9 +46,7 @@ void S3D_MATERIAL::SetMaterial()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************/
|
|
||||||
void S3D_MASTER::Copy( S3D_MASTER* pattern )
|
void S3D_MASTER::Copy( S3D_MASTER* pattern )
|
||||||
/****************************************************/
|
|
||||||
{
|
{
|
||||||
m_Shape3DName = pattern->m_Shape3DName;
|
m_Shape3DName = pattern->m_Shape3DName;
|
||||||
m_MatScale = pattern->m_MatScale;
|
m_MatScale = pattern->m_MatScale;
|
||||||
|
@ -66,10 +57,8 @@ void S3D_MASTER::Copy( S3D_MASTER* pattern )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************/
|
|
||||||
S3D_MASTER::S3D_MASTER( EDA_BaseStruct* aParent ) :
|
S3D_MASTER::S3D_MASTER( EDA_BaseStruct* aParent ) :
|
||||||
EDA_BaseStruct( aParent, NOT_USED )
|
EDA_BaseStruct( aParent, NOT_USED )
|
||||||
/***************************************************************/
|
|
||||||
{
|
{
|
||||||
m_MatScale.x = m_MatScale.y = m_MatScale.z = 1.0;
|
m_MatScale.x = m_MatScale.y = m_MatScale.z = 1.0;
|
||||||
m_3D_Drawings = NULL;
|
m_3D_Drawings = NULL;
|
||||||
|
@ -77,9 +66,7 @@ S3D_MASTER::S3D_MASTER( EDA_BaseStruct* aParent ) :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************/
|
|
||||||
S3D_MASTER:: ~S3D_MASTER()
|
S3D_MASTER:: ~S3D_MASTER()
|
||||||
/***************************************/
|
|
||||||
{
|
{
|
||||||
Struct3D_Shape* next;
|
Struct3D_Shape* next;
|
||||||
S3D_MATERIAL* nextmat;
|
S3D_MATERIAL* nextmat;
|
||||||
|
@ -90,7 +77,7 @@ S3D_MASTER:: ~S3D_MASTER()
|
||||||
delete m_3D_Drawings;
|
delete m_3D_Drawings;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( ; m_Materials != NULL; m_Materials = nextmat )
|
for( ; m_Materials != NULL; m_Materials = nextmat )
|
||||||
{
|
{
|
||||||
nextmat = m_Materials->Next();
|
nextmat = m_Materials->Next();
|
||||||
delete m_Materials;
|
delete m_Materials;
|
||||||
|
@ -98,20 +85,16 @@ S3D_MASTER:: ~S3D_MASTER()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************/
|
|
||||||
Struct3D_Shape::Struct3D_Shape( EDA_BaseStruct* aParent ) :
|
Struct3D_Shape::Struct3D_Shape( EDA_BaseStruct* aParent ) :
|
||||||
EDA_BaseStruct( aParent, NOT_USED )
|
EDA_BaseStruct( aParent, NOT_USED )
|
||||||
/***************************************************************/
|
|
||||||
{
|
{
|
||||||
m_3D_Coord = NULL;
|
m_3D_Coord = NULL;
|
||||||
m_3D_CoordIndex = NULL;
|
m_3D_CoordIndex = NULL;
|
||||||
m_3D_Points = 0;
|
m_3D_Points = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************/
|
|
||||||
Struct3D_Shape:: ~Struct3D_Shape()
|
Struct3D_Shape:: ~Struct3D_Shape()
|
||||||
/***************************************/
|
|
||||||
{
|
{
|
||||||
delete m_3D_Coord;
|
delete m_3D_Coord;
|
||||||
delete m_3D_CoordIndex;
|
delete m_3D_CoordIndex;
|
||||||
|
|
|
@ -19,36 +19,32 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void Draw3D_FilledCircle( double posx, double posy,
|
static void Draw3D_FilledCircle( double posx, double posy, double rayon,
|
||||||
double rayon, double hole_rayon, double zpos );
|
double hole_rayon, double zpos );
|
||||||
static void Draw3D_FilledSegment( double startx, double starty,
|
static void Draw3D_FilledSegment( double startx, double starty,
|
||||||
double endx, double endy, double width, double zpos );
|
double endx, double endy,
|
||||||
static void Draw3D_FilledCylinder( double posx, double posy,
|
double width, double zpos );
|
||||||
double rayon, double height, double zpos );
|
static void Draw3D_FilledCylinder( double posx, double posy, double rayon,
|
||||||
static void Draw3D_FilledSegmentWithHole( double startx,
|
double height, double zpos );
|
||||||
double starty,
|
static void Draw3D_FilledSegmentWithHole( double startx, double starty,
|
||||||
double endx,
|
double endx, double endy,
|
||||||
double endy,
|
double width, double holex,
|
||||||
double width,
|
double holey, double holeradius,
|
||||||
double holex,
|
|
||||||
double holey,
|
|
||||||
double holeradius,
|
|
||||||
double zpos );
|
double zpos );
|
||||||
static void Draw3D_ArcSegment( double startx, double starty,
|
static void Draw3D_ArcSegment( double startx, double starty, double endx,
|
||||||
double endx, double endy, double width, double zpos );
|
double endy, double width, double zpos );
|
||||||
static void Draw3D_CircleSegment( double startx, double starty,
|
static void Draw3D_CircleSegment( double startx, double starty, double endx,
|
||||||
double endx, double endy, double width, double zpos );
|
double endy, double width, double zpos );
|
||||||
static int Get3DLayerEnable( int act_layer );
|
static int Get3DLayerEnable( int act_layer );
|
||||||
static GLfloat Get3DLayerSide( int act_layer );
|
static GLfloat Get3DLayerSide( int act_layer );
|
||||||
|
|
||||||
/******************************************/
|
|
||||||
void Pcb3D_GLCanvas::Redraw( bool finish )
|
void Pcb3D_GLCanvas::Redraw( bool finish )
|
||||||
/******************************************/
|
|
||||||
{
|
{
|
||||||
#if wxCHECK_VERSION( 2, 9, 0 )
|
#if wxCHECK_VERSION( 2, 9, 0 )
|
||||||
SetCurrent(*m_glRC);
|
SetCurrent( *m_glRC );
|
||||||
#else
|
#else
|
||||||
SetCurrent( );
|
SetCurrent();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Set the OpenGL viewport according to the client size of this canvas.
|
// Set the OpenGL viewport according to the client size of this canvas.
|
||||||
|
@ -68,7 +64,7 @@ void Pcb3D_GLCanvas::Redraw( bool finish )
|
||||||
/* transformations */
|
/* transformations */
|
||||||
GLfloat mat[4][4];
|
GLfloat mat[4][4];
|
||||||
|
|
||||||
// Translatory motion first, so rotations don't mess up the orientation...
|
// Translate motion first, so rotations don't mess up the orientation...
|
||||||
glTranslatef( g_Draw3d_dx, g_Draw3d_dy, 0.0F );
|
glTranslatef( g_Draw3d_dx, g_Draw3d_dy, 0.0F );
|
||||||
|
|
||||||
build_rotmatrix( mat, g_Parm_3D_Visu.m_Quat );
|
build_rotmatrix( mat, g_Parm_3D_Visu.m_Quat );
|
||||||
|
@ -92,20 +88,17 @@ void Pcb3D_GLCanvas::Redraw( bool finish )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************/
|
|
||||||
GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
|
|
||||||
/**********************************************/
|
|
||||||
|
|
||||||
/* Create the draw list items
|
/* Create the draw list items
|
||||||
*/
|
*/
|
||||||
|
GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
|
||||||
{
|
{
|
||||||
WinEDA_BasePcbFrame* pcbframe = m_Parent->m_Parent;
|
WinEDA_BasePcbFrame* pcbframe = m_Parent->m_Parent;
|
||||||
BOARD* pcb = pcbframe->GetBoard();
|
BOARD* pcb = pcbframe->GetBoard();
|
||||||
TRACK* track;
|
TRACK* track;
|
||||||
SEGZONE* segzone;
|
SEGZONE* segzone;
|
||||||
int ii;
|
int ii;
|
||||||
|
|
||||||
wxBusyCursor dummy;
|
wxBusyCursor dummy;
|
||||||
|
|
||||||
m_gllist = glGenLists( 1 );
|
m_gllist = glGenLists( 1 );
|
||||||
|
|
||||||
|
@ -116,15 +109,17 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
|
||||||
g_Parm_3D_Visu.m_BoardPos.y = -g_Parm_3D_Visu.m_BoardPos.y;
|
g_Parm_3D_Visu.m_BoardPos.y = -g_Parm_3D_Visu.m_BoardPos.y;
|
||||||
g_Parm_3D_Visu.m_Layers = pcb->m_BoardSettings->GetCopperLayerCount();
|
g_Parm_3D_Visu.m_Layers = pcb->m_BoardSettings->GetCopperLayerCount();
|
||||||
|
|
||||||
// Ensure the board has 2 sides for 3D views, because it is hard to find a *really* single side board in the true life...
|
// Ensure the board has 2 sides for 3D views, because it is hard to find
|
||||||
if ( g_Parm_3D_Visu.m_Layers < 2 )
|
// a *really* single side board in the true life...
|
||||||
|
if( g_Parm_3D_Visu.m_Layers < 2 )
|
||||||
g_Parm_3D_Visu.m_Layers = 2;
|
g_Parm_3D_Visu.m_Layers = 2;
|
||||||
|
|
||||||
g_Parm_3D_Visu.m_BoardScale = 2.0 / MAX( g_Parm_3D_Visu.m_BoardSize.x,
|
g_Parm_3D_Visu.m_BoardScale = 2.0 / MAX( g_Parm_3D_Visu.m_BoardSize.x,
|
||||||
g_Parm_3D_Visu.m_BoardSize.y );
|
g_Parm_3D_Visu.m_BoardSize.y );
|
||||||
|
|
||||||
// @TODO: epoxy_width (board thickness) must be set by user,
|
// @TODO: epoxy_width (board thickness) must be set by user,
|
||||||
// because all boards thickness no not match with this setup:
|
// because all boards thickness no not match with this setup:
|
||||||
//double epoxy_width = 1.6; // epoxy width in mm
|
// double epoxy_width = 1.6; // epoxy width in mm
|
||||||
|
|
||||||
g_Parm_3D_Visu.m_Epoxy_Width = pcb->m_BoardSettings->m_LayerThickness
|
g_Parm_3D_Visu.m_Epoxy_Width = pcb->m_BoardSettings->m_LayerThickness
|
||||||
* g_Parm_3D_Visu.m_BoardScale;
|
* g_Parm_3D_Visu.m_BoardScale;
|
||||||
|
@ -133,8 +128,9 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
|
||||||
for( ii = 0; ii < 32; ii++ )
|
for( ii = 0; ii < 32; ii++ )
|
||||||
{
|
{
|
||||||
if( ii < g_Parm_3D_Visu.m_Layers )
|
if( ii < g_Parm_3D_Visu.m_Layers )
|
||||||
g_Parm_3D_Visu.m_LayerZcoord[ii] = g_Parm_3D_Visu.m_Epoxy_Width * ii
|
g_Parm_3D_Visu.m_LayerZcoord[ii] =
|
||||||
/ (g_Parm_3D_Visu.m_Layers - 1);
|
g_Parm_3D_Visu.m_Epoxy_Width
|
||||||
|
* ii / (g_Parm_3D_Visu.m_Layers - 1);
|
||||||
else
|
else
|
||||||
g_Parm_3D_Visu.m_LayerZcoord[ii] = g_Parm_3D_Visu.m_Epoxy_Width;
|
g_Parm_3D_Visu.m_LayerZcoord[ii] = g_Parm_3D_Visu.m_Epoxy_Width;
|
||||||
}
|
}
|
||||||
|
@ -160,14 +156,14 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
|
||||||
glEnable( GL_COLOR_MATERIAL );
|
glEnable( GL_COLOR_MATERIAL );
|
||||||
SetGLColor( WHITE );
|
SetGLColor( WHITE );
|
||||||
glBegin( GL_LINES );
|
glBegin( GL_LINES );
|
||||||
glNormal3f( 0.0f, 0.0f, 1.0f ); // Normal is Z axis
|
glNormal3f( 0.0f, 0.0f, 1.0f ); // Normal is Z axis
|
||||||
glVertex3f( 0.0f, 0.0f, 0.0f );
|
glVertex3f( 0.0f, 0.0f, 0.0f );
|
||||||
glVertex3f( 1.0f, 0.0f, 0.0f ); // X axis
|
glVertex3f( 1.0f, 0.0f, 0.0f ); // X axis
|
||||||
glVertex3f( 0.0f, 0.0f, 0.0f );
|
glVertex3f( 0.0f, 0.0f, 0.0f );
|
||||||
glVertex3f( 0.0f, -1.0f, 0.0f ); // Y axis
|
glVertex3f( 0.0f, -1.0f, 0.0f ); // Y axis
|
||||||
glNormal3f( 1.0f, 0.0f, 0.0f ); // Normal is Y axis
|
glNormal3f( 1.0f, 0.0f, 0.0f ); // Normal is Y axis
|
||||||
glVertex3f( 0.0f, 0.0f, 0.0f );
|
glVertex3f( 0.0f, 0.0f, 0.0f );
|
||||||
glVertex3f( 0.0f, 0.0f, 0.3f ); // Z axis
|
glVertex3f( 0.0f, 0.0f, 0.3f ); // Z axis
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +200,8 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
|
||||||
glEnd();
|
glEnd();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* move the board in order to draw it with its centre at 0,0 3D coordinates */
|
/* move the board in order to draw it with its center at 0,0 3D
|
||||||
|
* coordinates */
|
||||||
glTranslatef( -g_Parm_3D_Visu.m_BoardPos.x * g_Parm_3D_Visu.m_BoardScale,
|
glTranslatef( -g_Parm_3D_Visu.m_BoardPos.x * g_Parm_3D_Visu.m_BoardScale,
|
||||||
-g_Parm_3D_Visu.m_BoardPos.y * g_Parm_3D_Visu.m_BoardScale,
|
-g_Parm_3D_Visu.m_BoardPos.y * g_Parm_3D_Visu.m_BoardScale,
|
||||||
0.0F );
|
0.0F );
|
||||||
|
@ -239,24 +236,27 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
|
||||||
int imax = zone->m_FilledPolysList.size() - 1;
|
int imax = zone->m_FilledPolysList.size() - 1;
|
||||||
CPolyPt* firstcorner = &zone->m_FilledPolysList[0];
|
CPolyPt* firstcorner = &zone->m_FilledPolysList[0];
|
||||||
CPolyPt* begincorner = firstcorner;
|
CPolyPt* begincorner = firstcorner;
|
||||||
SEGZONE dummysegment(pcb);
|
SEGZONE dummysegment( pcb );
|
||||||
dummysegment.SetLayer( zone->GetLayer() );
|
dummysegment.SetLayer( zone->GetLayer() );
|
||||||
dummysegment.m_Width = zone->m_ZoneMinThickness;
|
dummysegment.m_Width = zone->m_ZoneMinThickness;
|
||||||
for( int ic = 1; ic <= imax; ic++ )
|
for( int ic = 1; ic <= imax; ic++ )
|
||||||
{
|
{
|
||||||
CPolyPt* endcorner = &zone->m_FilledPolysList[ic];
|
CPolyPt* endcorner = &zone->m_FilledPolysList[ic];
|
||||||
if( begincorner->utility == 0 ) // Draw only basic outlines, not extra segments
|
if( begincorner->utility == 0 )
|
||||||
{
|
{
|
||||||
|
// Draw only basic outlines, not extra segments
|
||||||
dummysegment.m_Start.x = begincorner->x;
|
dummysegment.m_Start.x = begincorner->x;
|
||||||
dummysegment.m_Start.y = begincorner->y;
|
dummysegment.m_Start.y = begincorner->y;
|
||||||
dummysegment.m_End.x = endcorner->x;
|
dummysegment.m_End.x = endcorner->x;
|
||||||
dummysegment.m_End.y = endcorner->y;
|
dummysegment.m_End.y = endcorner->y;
|
||||||
Draw3D_Track( &dummysegment );
|
Draw3D_Track( &dummysegment );
|
||||||
}
|
}
|
||||||
if( (endcorner->end_contour) || (ic == imax) ) // the last corner of a filled area is found: draw it
|
if( (endcorner->end_contour) || (ic == imax) )
|
||||||
{
|
{
|
||||||
if( endcorner->utility == 0 ) // Draw only basic outlines, not extra segments
|
// the last corner of a filled area is found: draw it
|
||||||
|
if( endcorner->utility == 0 )
|
||||||
{
|
{
|
||||||
|
// Draw only basic outlines, not extra segments
|
||||||
dummysegment.m_Start.x = endcorner->x;
|
dummysegment.m_Start.x = endcorner->x;
|
||||||
dummysegment.m_Start.y = endcorner->y;
|
dummysegment.m_Start.y = endcorner->y;
|
||||||
dummysegment.m_End.x = firstcorner->x;
|
dummysegment.m_End.x = firstcorner->x;
|
||||||
|
@ -266,18 +266,20 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
|
||||||
}
|
}
|
||||||
ic++;
|
ic++;
|
||||||
if( ic < imax - 1 )
|
if( ic < imax - 1 )
|
||||||
begincorner = firstcorner = &zone->m_FilledPolysList[ic];
|
begincorner = firstcorner =
|
||||||
|
&zone->m_FilledPolysList[ic];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
begincorner = endcorner;
|
begincorner = endcorner;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* draw graphic items */
|
/* draw graphic items */
|
||||||
EDA_BaseStruct* PtStruct;
|
EDA_BaseStruct* PtStruct;
|
||||||
for( PtStruct = pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() )
|
for( PtStruct = pcb->m_Drawings;
|
||||||
|
PtStruct != NULL;
|
||||||
|
PtStruct = PtStruct->Next() )
|
||||||
{
|
{
|
||||||
switch( PtStruct->Type() )
|
switch( PtStruct->Type() )
|
||||||
{
|
{
|
||||||
|
@ -311,9 +313,7 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************/
|
|
||||||
void Pcb3D_GLCanvas::Draw3D_Track( TRACK* track )
|
void Pcb3D_GLCanvas::Draw3D_Track( TRACK* track )
|
||||||
/************************************************/
|
|
||||||
{
|
{
|
||||||
double zpos;
|
double zpos;
|
||||||
int layer = track->GetLayer();
|
int layer = track->GetLayer();
|
||||||
|
@ -323,7 +323,7 @@ void Pcb3D_GLCanvas::Draw3D_Track( TRACK* track )
|
||||||
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
|
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
|
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
|
||||||
|
|
||||||
if( layer == LAST_COPPER_LAYER )
|
if( layer == LAST_COPPER_LAYER )
|
||||||
layer = g_Parm_3D_Visu.m_Layers - 1;
|
layer = g_Parm_3D_Visu.m_Layers - 1;
|
||||||
|
@ -341,12 +341,9 @@ void Pcb3D_GLCanvas::Draw3D_Track( TRACK* track )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************/
|
|
||||||
void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via )
|
|
||||||
/*********************************************/
|
|
||||||
|
|
||||||
/* 3D drawing for a VIA (cylinder + filled circles)
|
/* 3D drawing for a VIA (cylinder + filled circles)
|
||||||
*/
|
*/
|
||||||
|
void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via )
|
||||||
{
|
{
|
||||||
double x, y, r, hole;
|
double x, y, r, hole;
|
||||||
int layer, top_layer, bottom_layer;
|
int layer, top_layer, bottom_layer;
|
||||||
|
@ -367,13 +364,15 @@ void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via )
|
||||||
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
||||||
if( layer < g_Parm_3D_Visu.m_Layers - 1 )
|
if( layer < g_Parm_3D_Visu.m_Layers - 1 )
|
||||||
{
|
{
|
||||||
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
|
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) ==
|
||||||
|
false )
|
||||||
continue;
|
continue;
|
||||||
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
|
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( CMP_N ) == false )
|
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( CMP_N ) ==
|
||||||
|
false )
|
||||||
continue;
|
continue;
|
||||||
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[CMP_N];
|
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[CMP_N];
|
||||||
}
|
}
|
||||||
|
@ -394,14 +393,14 @@ void Pcb3D_GLCanvas::Draw3D_Via( SEGVIA* via )
|
||||||
// Drawing hole:
|
// Drawing hole:
|
||||||
color = g_Parm_3D_Visu.m_BoardSettings->m_ViaColor[via->m_Shape];
|
color = g_Parm_3D_Visu.m_BoardSettings->m_ViaColor[via->m_Shape];
|
||||||
SetGLColor( color );
|
SetGLColor( color );
|
||||||
height = g_Parm_3D_Visu.m_LayerZcoord[top_layer] - g_Parm_3D_Visu.m_LayerZcoord[bottom_layer];
|
height = g_Parm_3D_Visu.m_LayerZcoord[top_layer] -
|
||||||
Draw3D_FilledCylinder( x, -y, hole, height, g_Parm_3D_Visu.m_LayerZcoord[bottom_layer] );
|
g_Parm_3D_Visu.m_LayerZcoord[bottom_layer];
|
||||||
|
Draw3D_FilledCylinder( x, -y, hole, height,
|
||||||
|
g_Parm_3D_Visu.m_LayerZcoord[bottom_layer] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************/
|
|
||||||
void Pcb3D_GLCanvas::Draw3D_DrawSegment( DRAWSEGMENT* segment )
|
void Pcb3D_GLCanvas::Draw3D_DrawSegment( DRAWSEGMENT* segment )
|
||||||
/*************************************************************/
|
|
||||||
{
|
{
|
||||||
double x, y, xf, yf;
|
double x, y, xf, yf;
|
||||||
double zpos, w;
|
double zpos, w;
|
||||||
|
@ -411,7 +410,7 @@ void Pcb3D_GLCanvas::Draw3D_DrawSegment( DRAWSEGMENT* segment )
|
||||||
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
|
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
|
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
|
||||||
|
|
||||||
SetGLColor( color );
|
SetGLColor( color );
|
||||||
w = segment->m_Width * g_Parm_3D_Visu.m_BoardScale;
|
w = segment->m_Width * g_Parm_3D_Visu.m_BoardScale;
|
||||||
|
@ -490,9 +489,7 @@ static void Draw3dTextSegm( int x0, int y0, int xf, int yf )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************/
|
|
||||||
void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text )
|
void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text )
|
||||||
/*************************************************************/
|
|
||||||
{
|
{
|
||||||
int layer = text->GetLayer();
|
int layer = text->GetLayer();
|
||||||
|
|
||||||
|
@ -508,7 +505,7 @@ void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text )
|
||||||
glNormal3f( 0.0, 0.0, Get3DLayerSide( layer ) );
|
glNormal3f( 0.0, 0.0, Get3DLayerSide( layer ) );
|
||||||
wxSize size = text->m_Size;
|
wxSize size = text->m_Size;
|
||||||
if( text->m_Mirror )
|
if( text->m_Mirror )
|
||||||
NEGATE(size.x);
|
NEGATE( size.x );
|
||||||
if( text->m_MultilineAllowed )
|
if( text->m_MultilineAllowed )
|
||||||
{
|
{
|
||||||
wxPoint pos = text->m_Pos;
|
wxPoint pos = text->m_Pos;
|
||||||
|
@ -522,11 +519,10 @@ void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text )
|
||||||
{
|
{
|
||||||
wxString txt = list->Item( i );
|
wxString txt = list->Item( i );
|
||||||
DrawGraphicText( NULL, NULL, pos, (EDA_Colors) color,
|
DrawGraphicText( NULL, NULL, pos, (EDA_Colors) color,
|
||||||
txt, text->m_Orient, size,
|
txt, text->m_Orient, size,
|
||||||
text->m_HJustify, text->m_VJustify,
|
text->m_HJustify, text->m_VJustify,
|
||||||
text->m_Width, text->m_Italic,
|
text->m_Width, text->m_Italic,
|
||||||
true,
|
true, Draw3dTextSegm );
|
||||||
Draw3dTextSegm );
|
|
||||||
pos += offset;
|
pos += offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -534,17 +530,15 @@ void Pcb3D_GLCanvas::Draw3D_DrawText( TEXTE_PCB* text )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
DrawGraphicText( NULL, NULL, text->m_Pos, (EDA_Colors) color,
|
DrawGraphicText( NULL, NULL, text->m_Pos, (EDA_Colors) color,
|
||||||
text->m_Text, text->m_Orient, size,
|
text->m_Text, text->m_Orient, size,
|
||||||
text->m_HJustify, text->m_VJustify,
|
text->m_HJustify, text->m_VJustify,
|
||||||
text->m_Width, text->m_Italic,
|
text->m_Width, text->m_Italic,
|
||||||
true,
|
true,
|
||||||
Draw3dTextSegm );
|
Draw3dTextSegm );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************/
|
|
||||||
void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||||
/*********************************************/
|
|
||||||
{
|
{
|
||||||
D_PAD* pad = m_Pads;
|
D_PAD* pad = m_Pads;
|
||||||
|
|
||||||
|
@ -603,8 +597,9 @@ void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !As3dShape ) // The footprint does not have a 3D shape, draw its 2D shape instead
|
if( !As3dShape )
|
||||||
{
|
{
|
||||||
|
// The footprint does not have a 3D shape, draw its 2D shape instead
|
||||||
EDA_BaseStruct* Struct = m_Drawings;
|
EDA_BaseStruct* Struct = m_Drawings;
|
||||||
glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis
|
glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis
|
||||||
for( ; Struct != NULL; Struct = Struct->Next() )
|
for( ; Struct != NULL; Struct = Struct->Next() )
|
||||||
|
@ -626,9 +621,7 @@ void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************/
|
|
||||||
void EDGE_MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
void EDGE_MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||||
/***************************************************/
|
|
||||||
{
|
{
|
||||||
wxString s;
|
wxString s;
|
||||||
int dx, dy;
|
int dx, dy;
|
||||||
|
@ -637,7 +630,7 @@ void EDGE_MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||||
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( m_Layer ) == false )
|
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( m_Layer ) == false )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[m_Layer];
|
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[m_Layer];
|
||||||
|
|
||||||
|
|
||||||
SetGLColor( color );
|
SetGLColor( color );
|
||||||
|
@ -670,18 +663,14 @@ void EDGE_MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||||
|
|
||||||
default:
|
default:
|
||||||
s.Printf( wxT( "Error: Shape nr %d not implemented!\n" ), m_Shape );
|
s.Printf( wxT( "Error: Shape nr %d not implemented!\n" ), m_Shape );
|
||||||
D(printf( "%s", CONV_TO_UTF8( s ) );)
|
D( printf( "%s", CONV_TO_UTF8( s ) ); )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************/
|
/* Draw 3D pads. */
|
||||||
void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||||
/***********************************************/
|
|
||||||
|
|
||||||
/* Dessin 3D des pads avec leur trou de percage
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
int ii, ll, layer, nlmax;
|
int ii, ll, layer, nlmax;
|
||||||
int ux0, uy0,
|
int ux0, uy0,
|
||||||
|
@ -704,20 +693,20 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||||
holeY = (double) m_Drill.y * scale / 2;
|
holeY = (double) m_Drill.y * scale / 2;
|
||||||
hole = MIN( holeX, holeY );
|
hole = MIN( holeX, holeY );
|
||||||
|
|
||||||
/* calcul du centre des formes des pads : */
|
/* Calculate the center of the pad. */
|
||||||
shape_pos = ReturnShapePos();
|
shape_pos = ReturnShapePos();
|
||||||
ux0 = shape_pos.x;
|
ux0 = shape_pos.x;
|
||||||
uy0 = shape_pos.y;
|
uy0 = shape_pos.y;
|
||||||
xc = ux0;
|
xc = ux0;
|
||||||
yc = uy0;
|
yc = uy0;
|
||||||
|
|
||||||
/* le trace depend de la rotation de l'empreinte */
|
|
||||||
dx = dx0 = m_Size.x >> 1;
|
dx = dx0 = m_Size.x >> 1;
|
||||||
dy = dy0 = m_Size.y >> 1; /* demi dim dx et dy */
|
dy = dy0 = m_Size.y >> 1;
|
||||||
|
|
||||||
angle = m_Orient;
|
angle = m_Orient;
|
||||||
drillx = m_Pos.x * scale;
|
drillx = m_Pos.x * scale;
|
||||||
drilly = m_Pos.y * scale;
|
drilly = m_Pos.y * scale;
|
||||||
|
|
||||||
/* Draw the pad hole (TODO: draw OBLONG hole) */
|
/* Draw the pad hole (TODO: draw OBLONG hole) */
|
||||||
if( holeX && holeY )
|
if( holeX && holeY )
|
||||||
{
|
{
|
||||||
|
@ -746,10 +735,12 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||||
continue;
|
continue;
|
||||||
if( (layer == COPPER_LAYER_N) && !Oncu )
|
if( (layer == COPPER_LAYER_N) && !Oncu )
|
||||||
continue;
|
continue;
|
||||||
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER) && !Both )
|
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER)
|
||||||
|
&& !Both )
|
||||||
continue;
|
continue;
|
||||||
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
|
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
|
||||||
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
|
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) ==
|
||||||
|
false )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SetGLColor( color );
|
SetGLColor( color );
|
||||||
|
@ -765,15 +756,14 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAD_OVAL:
|
case PAD_OVAL:
|
||||||
/* calcul de l'entraxe de l'ellipse */
|
if( dx > dy ) /* Horizontal ellipse */
|
||||||
if( dx > dy ) /* ellipse horizontale */
|
|
||||||
{
|
{
|
||||||
delta_cx = dx - dy;
|
delta_cx = dx - dy;
|
||||||
delta_cy = 0;
|
delta_cy = 0;
|
||||||
w = m_Size.y * scale;
|
w = m_Size.y * scale;
|
||||||
delta_angle = angle + 900;
|
delta_angle = angle + 900;
|
||||||
}
|
}
|
||||||
else /* ellipse verticale */
|
else /* Vertical ellipse */
|
||||||
{
|
{
|
||||||
delta_cx = 0;
|
delta_cx = 0;
|
||||||
delta_cy = dy - dx;
|
delta_cy = dy - dx;
|
||||||
|
@ -787,7 +777,9 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||||
oy = (double) ( uy0 + delta_cy ) * scale;
|
oy = (double) ( uy0 + delta_cy ) * scale;
|
||||||
fx = (double) ( ux0 - delta_cx ) * scale;
|
fx = (double) ( ux0 - delta_cx ) * scale;
|
||||||
fy = (double) ( uy0 - delta_cy ) * scale;
|
fy = (double) ( uy0 - delta_cy ) * scale;
|
||||||
for( layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; layer++ )
|
for( layer = FIRST_COPPER_LAYER;
|
||||||
|
layer <= LAST_COPPER_LAYER;
|
||||||
|
layer++ )
|
||||||
{
|
{
|
||||||
if( layer && (layer == nlmax) )
|
if( layer && (layer == nlmax) )
|
||||||
layer = CMP_N;
|
layer = CMP_N;
|
||||||
|
@ -795,11 +787,13 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||||
continue;
|
continue;
|
||||||
if( (layer == COPPER_LAYER_N) && !Oncu )
|
if( (layer == COPPER_LAYER_N) && !Oncu )
|
||||||
continue;
|
continue;
|
||||||
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER) && !Both )
|
if( (layer > FIRST_COPPER_LAYER)
|
||||||
|
&& (layer < LAST_COPPER_LAYER) && !Both )
|
||||||
continue;
|
continue;
|
||||||
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
|
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
|
||||||
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0 );
|
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0 );
|
||||||
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
|
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) ==
|
||||||
|
false )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SetGLColor( color );
|
SetGLColor( color );
|
||||||
|
@ -808,7 +802,8 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||||
zpos = zpos - 5 * g_Parm_3D_Visu.m_BoardScale;
|
zpos = zpos - 5 * g_Parm_3D_Visu.m_BoardScale;
|
||||||
else
|
else
|
||||||
zpos = zpos + 5 * g_Parm_3D_Visu.m_BoardScale;
|
zpos = zpos + 5 * g_Parm_3D_Visu.m_BoardScale;
|
||||||
Draw3D_FilledSegmentWithHole( ox, -oy, fx, -fy, w, drillx, -drilly, hole, zpos );
|
Draw3D_FilledSegmentWithHole( ox, -oy, fx, -fy, w, drillx,
|
||||||
|
-drilly, hole, zpos );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -819,7 +814,7 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||||
{
|
{
|
||||||
int ddx, ddy;
|
int ddx, ddy;
|
||||||
ddx = m_DeltaSize.x >> 1;
|
ddx = m_DeltaSize.x >> 1;
|
||||||
ddy = m_DeltaSize.y >> 1; /* demi dim dx et dy */
|
ddy = m_DeltaSize.y >> 1;
|
||||||
|
|
||||||
coord[0][0] = -dx - ddy;
|
coord[0][0] = -dx - ddy;
|
||||||
coord[0][1] = +dy + ddx;
|
coord[0][1] = +dy + ddx;
|
||||||
|
@ -839,8 +834,8 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||||
coord[ii][0] += ux0;
|
coord[ii][0] += ux0;
|
||||||
coord[ii][1] += uy0;
|
coord[ii][1] += uy0;
|
||||||
ll = ii * 2;
|
ll = ii * 2;
|
||||||
fcoord[ll][0] = coord[ii][0] *scale;
|
fcoord[ll][0] = coord[ii][0] * scale;
|
||||||
fcoord[ll][1] = coord[ii][1] *scale;
|
fcoord[ll][1] = coord[ii][1] * scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( ii = 0; ii < 7; ii += 2 )
|
for( ii = 0; ii < 7; ii += 2 )
|
||||||
|
@ -870,11 +865,13 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||||
continue;
|
continue;
|
||||||
if( (layer == COPPER_LAYER_N) && !Oncu )
|
if( (layer == COPPER_LAYER_N) && !Oncu )
|
||||||
continue;
|
continue;
|
||||||
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER) && !Both )
|
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER)
|
||||||
|
&& !Both )
|
||||||
continue;
|
continue;
|
||||||
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
|
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
|
||||||
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0 );
|
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0 );
|
||||||
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) == false )
|
if( g_Parm_3D_Visu.m_BoardSettings->IsLayerVisible( layer ) ==
|
||||||
|
false )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SetGLColor( color );
|
SetGLColor( color );
|
||||||
|
@ -903,9 +900,7 @@ void D_PAD::Draw3D( Pcb3D_GLCanvas* glcanvas )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************/
|
|
||||||
void SetGLColor( int color )
|
void SetGLColor( int color )
|
||||||
/*************************/
|
|
||||||
{
|
{
|
||||||
double red, green, blue;
|
double red, green, blue;
|
||||||
StructColors colordata = ColorRefs[color & MASKCOLOR];
|
StructColors colordata = ColorRefs[color & MASKCOLOR];
|
||||||
|
@ -917,10 +912,8 @@ void SetGLColor( int color )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************/
|
|
||||||
static void Draw3D_FilledCircle( double posx, double posy,
|
static void Draw3D_FilledCircle( double posx, double posy,
|
||||||
double rayon, double hole, double zpos )
|
double rayon, double hole, double zpos )
|
||||||
/********************************************************/
|
|
||||||
{
|
{
|
||||||
int ii, slice = 16;
|
int ii, slice = 16;
|
||||||
double x, y;
|
double x, y;
|
||||||
|
@ -942,10 +935,8 @@ static void Draw3D_FilledCircle( double posx, double posy,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************/
|
static void Draw3D_FilledCylinder( double posx, double posy, double rayon,
|
||||||
static void Draw3D_FilledCylinder( double posx, double posy,
|
double height, double zpos )
|
||||||
double rayon, double height, double zpos )
|
|
||||||
/*********************************************************/
|
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
double x, y;
|
double x, y;
|
||||||
|
@ -954,7 +945,7 @@ static void Draw3D_FilledCylinder( double posx, double posy,
|
||||||
S3D_Vertex coords[4];
|
S3D_Vertex coords[4];
|
||||||
double tmp = DataScale3D;
|
double tmp = DataScale3D;
|
||||||
|
|
||||||
DataScale3D = 1.0; // les coord sont deja a l'echelle pour Set_Object_Data();
|
DataScale3D = 1.0; // Coordinate is already in range for Set_Object_Data();
|
||||||
coords[0].x = coords[1].x = posx + rayon;
|
coords[0].x = coords[1].x = posx + rayon;
|
||||||
coords[0].y = coords[1].y = posy;
|
coords[0].y = coords[1].y = posy;
|
||||||
coords[0].z = coords[3].z = zpos;
|
coords[0].z = coords[3].z = zpos;
|
||||||
|
@ -979,31 +970,25 @@ static void Draw3D_FilledCylinder( double posx, double posy,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
/* Draw a polygon similar to a segment has rounded tips */
|
||||||
static void Draw3D_FilledSegment( double startx, double starty,
|
static void Draw3D_FilledSegment( double startx, double starty, double endx,
|
||||||
double endx, double endy, double width, double zpos )
|
double endy, double width, double zpos )
|
||||||
/*****************************************************************/
|
|
||||||
|
|
||||||
/* trace un polygone semblable a un segment a bouts ronds
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
double dx, dy, x, y, firstx = 0, firsty = 0;
|
double dx, dy, x, y, firstx = 0, firsty = 0;
|
||||||
int ii, angle;
|
int ii, angle;
|
||||||
|
|
||||||
// on va calculer les coordonnées du segment supposé horizontal,
|
// Calculate the coordinates of the segment assumed horizontal.
|
||||||
// puis tourner les cordonnes de l'angle voulu
|
// Then turn the strips of the desired angle.
|
||||||
|
|
||||||
dx = endx - startx;
|
dx = endx - startx;
|
||||||
dy = endy - starty;
|
dy = endy - starty;
|
||||||
angle = (int) ( ( atan2( dy, dx ) * 1800 / M_PI ) + 0.5 );
|
angle = (int) ( ( atan2( dy, dx ) * 1800 / M_PI ) + 0.5 );
|
||||||
|
|
||||||
RotatePoint( &dx, &dy, angle ); // apres rotation: dx = longueur du segment
|
RotatePoint( &dx, &dy, angle );
|
||||||
// dy = 0;
|
|
||||||
width /= 2;
|
width /= 2;
|
||||||
|
|
||||||
glBegin( GL_POLYGON );
|
glBegin( GL_POLYGON );
|
||||||
|
|
||||||
// tracé de l'arrondi a droite (1er demi polygone a la fin du segment)
|
// Trace the flare to right (1st half polygon at the end of the segment)
|
||||||
for( ii = 0; ii <= 8; ii++ )
|
for( ii = 0; ii <= 8; ii++ )
|
||||||
{
|
{
|
||||||
x = 0.0;
|
x = 0.0;
|
||||||
|
@ -1019,7 +1004,7 @@ static void Draw3D_FilledSegment( double startx, double starty,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// tracé de l'arrondi a gauche (2ieme demi polygone a l'origine du segment)
|
// Rounding the left (2nd half polygon is the origin of the segment)
|
||||||
for( ii = 0; ii <= 8; ii++ )
|
for( ii = 0; ii <= 8; ii++ )
|
||||||
{
|
{
|
||||||
int jj = ii * 225;
|
int jj = ii * 225;
|
||||||
|
@ -1034,44 +1019,35 @@ static void Draw3D_FilledSegment( double startx, double starty,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
/* Draw a polygon similar to a segment ends with round hole
|
||||||
static void Draw3D_FilledSegmentWithHole( double startx,
|
|
||||||
double starty,
|
|
||||||
double endx,
|
|
||||||
double endy,
|
|
||||||
double width,
|
|
||||||
double holex,
|
|
||||||
double holey,
|
|
||||||
double holeradius,
|
|
||||||
double zpos )
|
|
||||||
/*****************************************************************/
|
|
||||||
|
|
||||||
/* trace un polygone semblable a un segment a bouts ronds avec trou
|
|
||||||
*/
|
*/
|
||||||
|
static void Draw3D_FilledSegmentWithHole( double startx, double starty,
|
||||||
|
double endx, double endy,
|
||||||
|
double width, double holex,
|
||||||
|
double holey, double holeradius,
|
||||||
|
double zpos )
|
||||||
{
|
{
|
||||||
double x, y, xin, yin;
|
double x, y, xin, yin;
|
||||||
double firstx = 0, firsty = 0, firstxin = 0, firstyin = 0;
|
double firstx = 0, firsty = 0, firstxin = 0, firstyin = 0;
|
||||||
int ii, angle, theta;
|
int ii, angle, theta;
|
||||||
|
|
||||||
// on va calculer les coordonnées du segment supposé horizontal,
|
// Calculate the coordinates of the segment assumed horizontal
|
||||||
// puis tourner les cordonnes de l'angle voulu
|
// Then turn the strips of the desired angle
|
||||||
// Tous des calculs se font avec startx, starty comme origine du tracé
|
// All calculations are done with startx, starty as the origin of the route
|
||||||
|
|
||||||
endx -= startx;
|
endx -= startx;
|
||||||
endy -= starty;
|
endy -= starty;
|
||||||
holex -= startx;
|
holex -= startx;
|
||||||
holey -= starty;
|
holey -= starty;
|
||||||
angle = (int) ( ( atan2( endy, endx ) * 1800 / M_PI ) + 0.5 );
|
angle = (int) ( ( atan2( endy, endx ) * 1800 / M_PI ) + 0.5 );
|
||||||
|
|
||||||
RotatePoint( &endx, &endy, angle ); // apres rotation: endx = longueur du segment
|
RotatePoint( &endx, &endy, angle );
|
||||||
// endy = 0;
|
|
||||||
RotatePoint( &holex, &holey, angle );
|
RotatePoint( &holex, &holey, angle );
|
||||||
width /= 2;
|
width /= 2;
|
||||||
|
|
||||||
glBegin( GL_QUAD_STRIP );
|
glBegin( GL_QUAD_STRIP );
|
||||||
|
|
||||||
// tracé de l'arrondi a droite (1er demi polygone a la fin du segment)
|
// Path of the flare to right (1st half polygon at the end of the segment)
|
||||||
// autour du demi-trou de percage
|
// around the half-hole drilling
|
||||||
for( ii = 0; ii <= 8; ii++ )
|
for( ii = 0; ii <= 8; ii++ )
|
||||||
{
|
{
|
||||||
x = 0.0;
|
x = 0.0;
|
||||||
|
@ -1087,7 +1063,7 @@ static void Draw3D_FilledSegmentWithHole( double startx,
|
||||||
RotatePoint( &xin, &yin, -angle );
|
RotatePoint( &xin, &yin, -angle );
|
||||||
glVertex3f( startx + xin, starty + yin, zpos );
|
glVertex3f( startx + xin, starty + yin, zpos );
|
||||||
glVertex3f( startx + x, starty + y, zpos );
|
glVertex3f( startx + x, starty + y, zpos );
|
||||||
if( ii == 0 ) // Memorisation du point de départ du tracé
|
if( ii == 0 )
|
||||||
{
|
{
|
||||||
firstx = startx + x;
|
firstx = startx + x;
|
||||||
firsty = starty + y;
|
firsty = starty + y;
|
||||||
|
@ -1096,7 +1072,8 @@ static void Draw3D_FilledSegmentWithHole( double startx,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// tracé de l'arrondi a gauche (2ieme demi polygone a l'origine du segment)
|
// Layout of the rounded left (2nd half polygon is the origin of the
|
||||||
|
// segment)
|
||||||
for( ii = 0; ii <= 8; ii++ )
|
for( ii = 0; ii <= 8; ii++ )
|
||||||
{
|
{
|
||||||
theta = -ii * 225;
|
theta = -ii * 225;
|
||||||
|
@ -1118,15 +1095,15 @@ static void Draw3D_FilledSegmentWithHole( double startx,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************/
|
static void Draw3D_ArcSegment( double startx, double starty, double endx,
|
||||||
static void Draw3D_ArcSegment( double startx, double starty,
|
double endy, double width, double zpos )
|
||||||
double endx, double endy, double width, double zpos )
|
|
||||||
{
|
{
|
||||||
int ii, slice = 36;
|
int ii, slice = 36;
|
||||||
double x, y, hole, rayon;
|
double x, y, hole, rayon;
|
||||||
int angle;
|
int angle;
|
||||||
|
|
||||||
angle = static_cast<int>(atan2( startx - endx, starty - endy ) * 1800 / M_PI) + 900;
|
angle = static_cast<int>( atan2( startx - endx, starty - endy ) *
|
||||||
|
1800 / M_PI ) + 900;
|
||||||
rayon = hypot( startx - endx, starty - endy ) + ( width / 2);
|
rayon = hypot( startx - endx, starty - endy ) + ( width / 2);
|
||||||
hole = rayon - width;
|
hole = rayon - width;
|
||||||
|
|
||||||
|
@ -1134,10 +1111,10 @@ static void Draw3D_ArcSegment( double startx, double starty,
|
||||||
for( ii = 0; ii <= slice / 4; ii++ )
|
for( ii = 0; ii <= slice / 4; ii++ )
|
||||||
{
|
{
|
||||||
x = hole; y = 0.0;
|
x = hole; y = 0.0;
|
||||||
RotatePoint( &x, &y, angle + (ii * 3600 / slice) );
|
RotatePoint( &x, &y, angle + ( ii * 3600 / slice ) );
|
||||||
glVertex3f( x + startx, y + starty, zpos );
|
glVertex3f( x + startx, y + starty, zpos );
|
||||||
x = rayon; y = 0.0;
|
x = rayon; y = 0.0;
|
||||||
RotatePoint( &x, &y, angle + (ii * 3600 / slice) );
|
RotatePoint( &x, &y, angle + ( ii * 3600 / slice ) );
|
||||||
glVertex3f( x + startx, y + starty, zpos );
|
glVertex3f( x + startx, y + starty, zpos );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1145,10 +1122,8 @@ static void Draw3D_ArcSegment( double startx, double starty,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************/
|
static void Draw3D_CircleSegment( double startx, double starty, double endx,
|
||||||
static void Draw3D_CircleSegment( double startx, double starty,
|
double endy, double width, double zpos )
|
||||||
double endx, double endy, double width, double zpos )
|
|
||||||
/*******************************************************************/
|
|
||||||
{
|
{
|
||||||
int ii, slice = 36;
|
int ii, slice = 36;
|
||||||
double x, y, hole, rayon;
|
double x, y, hole, rayon;
|
||||||
|
@ -1171,9 +1146,7 @@ static void Draw3D_CircleSegment( double startx, double starty,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************/
|
|
||||||
static int Get3DLayerEnable( int act_layer )
|
static int Get3DLayerEnable( int act_layer )
|
||||||
/******************************************/
|
|
||||||
{
|
{
|
||||||
bool enablelayer;
|
bool enablelayer;
|
||||||
|
|
||||||
|
@ -1191,20 +1164,16 @@ static int Get3DLayerEnable( int act_layer )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************/
|
|
||||||
static GLfloat Get3DLayerSide( int act_layer )
|
static GLfloat Get3DLayerSide( int act_layer )
|
||||||
/******************************************/
|
|
||||||
{
|
{
|
||||||
GLfloat nZ;
|
GLfloat nZ;
|
||||||
|
|
||||||
nZ = 1.0;
|
nZ = 1.0;
|
||||||
if(
|
if( ( act_layer <= LAST_COPPER_LAYER - 1 )
|
||||||
(act_layer <= LAST_COPPER_LAYER - 1)
|
|| ( act_layer == ADHESIVE_N_CU )
|
||||||
|| (act_layer == ADHESIVE_N_CU)
|
|| ( act_layer == SOLDERPASTE_N_CU )
|
||||||
|| (act_layer == SOLDERPASTE_N_CU)
|
|| ( act_layer == SILKSCREEN_N_CU )
|
||||||
|| (act_layer == SILKSCREEN_N_CU)
|
|| ( act_layer == SOLDERMASK_N_CU ) )
|
||||||
|| (act_layer == SOLDERMASK_N_CU)
|
|
||||||
)
|
|
||||||
nZ = -1.0;
|
nZ = -1.0;
|
||||||
return nZ;
|
return nZ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Name: 3d_frame.cpp
|
// Name: 3d_frame.cpp
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -26,11 +25,11 @@
|
||||||
#include <wxstruct.h>
|
#include <wxstruct.h>
|
||||||
|
|
||||||
Info_3D_Visu g_Parm_3D_Visu;
|
Info_3D_Visu g_Parm_3D_Visu;
|
||||||
double g_Draw3d_dx;
|
double g_Draw3d_dx;
|
||||||
double g_Draw3d_dy;
|
double g_Draw3d_dy;
|
||||||
double ZBottom;
|
double ZBottom;
|
||||||
double ZTop;
|
double ZTop;
|
||||||
double DataScale3D; // coeff de conversion unites utilsateut -> unites 3D
|
double DataScale3D; // 3D conversion units.
|
||||||
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE( WinEDA3D_DrawFrame, wxFrame )
|
BEGIN_EVENT_TABLE( WinEDA3D_DrawFrame, wxFrame )
|
||||||
|
@ -45,20 +44,18 @@ BEGIN_EVENT_TABLE( WinEDA3D_DrawFrame, wxFrame )
|
||||||
EVT_CLOSE( WinEDA3D_DrawFrame::OnCloseWindow )
|
EVT_CLOSE( WinEDA3D_DrawFrame::OnCloseWindow )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
/*******************************************************************/
|
|
||||||
WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent,
|
WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent,
|
||||||
const wxString& title,
|
const wxString& title,
|
||||||
long style ) :
|
long style ) :
|
||||||
wxFrame( parent, DISPLAY3D_FRAME, title,
|
wxFrame( parent, DISPLAY3D_FRAME, title, wxPoint( -1, -1 ),
|
||||||
wxPoint( -1, -1 ), wxSize( -1, -1 ), style )
|
wxSize( -1, -1 ), style )
|
||||||
/*******************************************************************/
|
|
||||||
{
|
{
|
||||||
m_FrameName = wxT( "Frame3D" );
|
m_FrameName = wxT( "Frame3D" );
|
||||||
m_Canvas = NULL;
|
m_Canvas = NULL;
|
||||||
m_Parent = parent;
|
m_Parent = parent;
|
||||||
m_HToolBar = NULL;
|
m_HToolBar = NULL;
|
||||||
m_VToolBar = NULL;
|
m_VToolBar = NULL;
|
||||||
m_InternalUnits = 10000; // Unites internes = 1/10000 inch
|
m_InternalUnits = 10000; // Internal units = 1/10000 inch
|
||||||
|
|
||||||
// Give it an icon
|
// Give it an icon
|
||||||
SetIcon( wxICON( icon_w3d ) );
|
SetIcon( wxICON( icon_w3d ) );
|
||||||
|
@ -80,44 +77,41 @@ WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent,
|
||||||
|
|
||||||
// Make a Pcb3D_GLCanvas
|
// Make a Pcb3D_GLCanvas
|
||||||
m_Canvas = new Pcb3D_GLCanvas( this );
|
m_Canvas = new Pcb3D_GLCanvas( this );
|
||||||
|
|
||||||
#if KICAD_AUIMANAGER
|
#if KICAD_AUIMANAGER
|
||||||
m_auimgr.SetManagedWindow(this);
|
m_auimgr.SetManagedWindow( this );
|
||||||
|
|
||||||
wxAuiPaneInfo horiz;
|
wxAuiPaneInfo horiz;
|
||||||
horiz.Gripper(false);
|
horiz.Gripper( false );
|
||||||
horiz.DockFixed(true);
|
horiz.DockFixed( true );
|
||||||
horiz.Movable(false);
|
horiz.Movable( false );
|
||||||
horiz.Floatable(false);
|
horiz.Floatable( false );
|
||||||
horiz.CloseButton(false);
|
horiz.CloseButton( false );
|
||||||
horiz.CaptionVisible(false);
|
horiz.CaptionVisible( false );
|
||||||
|
|
||||||
wxAuiPaneInfo vert(horiz);
|
wxAuiPaneInfo vert( horiz );
|
||||||
|
|
||||||
vert.TopDockable(false).BottomDockable(false);
|
vert.TopDockable( false ).BottomDockable( false );
|
||||||
horiz.LeftDockable(false).RightDockable(false);
|
horiz.LeftDockable( false ).RightDockable( false );
|
||||||
|
|
||||||
m_auimgr.AddPane(m_HToolBar,
|
m_auimgr.AddPane( m_HToolBar,
|
||||||
wxAuiPaneInfo(horiz).Name(wxT("m_HToolBar")).Top());
|
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top() );
|
||||||
|
|
||||||
m_auimgr.AddPane(m_Canvas,
|
m_auimgr.AddPane( m_Canvas,
|
||||||
wxAuiPaneInfo().Name(wxT("DrawFrame")).CentrePane());
|
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
|
||||||
|
|
||||||
m_auimgr.Update();
|
m_auimgr.Update();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
|
||||||
void WinEDA3D_DrawFrame::Exit3DFrame( wxCommandEvent& event )
|
void WinEDA3D_DrawFrame::Exit3DFrame( wxCommandEvent& event )
|
||||||
/***********************************************************/
|
|
||||||
{
|
{
|
||||||
Close( TRUE );
|
Close( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
|
||||||
void WinEDA3D_DrawFrame::OnCloseWindow( wxCloseEvent& Event )
|
void WinEDA3D_DrawFrame::OnCloseWindow( wxCloseEvent& Event )
|
||||||
/***********************************************************/
|
|
||||||
{
|
{
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
if( m_Parent )
|
if( m_Parent )
|
||||||
|
@ -128,12 +122,11 @@ void WinEDA3D_DrawFrame::OnCloseWindow( wxCloseEvent& Event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************/
|
|
||||||
void WinEDA3D_DrawFrame::GetSettings()
|
void WinEDA3D_DrawFrame::GetSettings()
|
||||||
/******************************************/
|
|
||||||
{
|
{
|
||||||
wxString text;
|
wxString text;
|
||||||
wxConfig* config = wxGetApp().m_EDA_Config; // Current config used by application
|
wxConfig* config = wxGetApp().m_EDA_Config; // Current config used by
|
||||||
|
// application
|
||||||
|
|
||||||
if( config )
|
if( config )
|
||||||
{
|
{
|
||||||
|
@ -161,12 +154,11 @@ void WinEDA3D_DrawFrame::GetSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************/
|
|
||||||
void WinEDA3D_DrawFrame::SaveSettings()
|
void WinEDA3D_DrawFrame::SaveSettings()
|
||||||
/*******************************************/
|
|
||||||
{
|
{
|
||||||
wxString text;
|
wxString text;
|
||||||
wxConfig* Config = wxGetApp().m_EDA_Config; // Current config used by application
|
wxConfig* Config = wxGetApp().m_EDA_Config; // Current config used by
|
||||||
|
// application
|
||||||
|
|
||||||
if( !Config )
|
if( !Config )
|
||||||
return;
|
return;
|
||||||
|
@ -192,9 +184,7 @@ void WinEDA3D_DrawFrame::SaveSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
|
||||||
void WinEDA3D_DrawFrame::Process_Zoom( wxCommandEvent& event )
|
void WinEDA3D_DrawFrame::Process_Zoom( wxCommandEvent& event )
|
||||||
/***********************************************************/
|
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
|
|
||||||
|
@ -231,40 +221,29 @@ void WinEDA3D_DrawFrame::Process_Zoom( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
|
||||||
void WinEDA3D_DrawFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
void WinEDA3D_DrawFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
/************************************************************************/
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************/
|
void WinEDA3D_DrawFrame::OnRightClick( const wxPoint& MousePos,
|
||||||
void WinEDA3D_DrawFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
|
wxMenu* PopMenu )
|
||||||
/*******************************************************************************/
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************/
|
|
||||||
int WinEDA3D_DrawFrame::BestZoom()
|
int WinEDA3D_DrawFrame::BestZoom()
|
||||||
/************************************/
|
|
||||||
|
|
||||||
// Retourne le meilleur zoom
|
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************/
|
|
||||||
void WinEDA3D_DrawFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
void WinEDA3D_DrawFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
||||||
/*******************************************************************/
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
|
||||||
void WinEDA3D_DrawFrame::Process_Special_Functions( wxCommandEvent& event )
|
void WinEDA3D_DrawFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
/************************************************************************/
|
|
||||||
{
|
{
|
||||||
#define ROT_ANGLE 10.0
|
#define ROT_ANGLE 10.0
|
||||||
|
|
||||||
|
@ -354,8 +333,8 @@ void WinEDA3D_DrawFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wxMessageBox(
|
wxMessageBox( wxT( "WinEDA3D_DrawFrame::Process_Special_Functions() \
|
||||||
wxT( "WinEDA3D_DrawFrame::Process_Special_Functions() error: unknown command" ) );
|
error: unknown command" ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -364,24 +343,20 @@ void WinEDA3D_DrawFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************/
|
|
||||||
void WinEDA3D_DrawFrame::NewDisplay()
|
void WinEDA3D_DrawFrame::NewDisplay()
|
||||||
/*****************************************/
|
|
||||||
{
|
{
|
||||||
m_Canvas->ClearLists();
|
m_Canvas->ClearLists();
|
||||||
m_Canvas->CreateDrawGL_List();
|
m_Canvas->CreateDrawGL_List();
|
||||||
|
|
||||||
// m_Canvas->InitGL();
|
// m_Canvas->InitGL();
|
||||||
m_Canvas->Refresh( true );
|
m_Canvas->Refresh( true );
|
||||||
m_Canvas->DisplayStatus();
|
m_Canvas->DisplayStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************/
|
|
||||||
void WinEDA3D_DrawFrame::Set3DBgColor()
|
|
||||||
/******************************************/
|
|
||||||
|
|
||||||
/* called to set the background color of the 3D scene
|
/* called to set the background color of the 3D scene
|
||||||
*/
|
*/
|
||||||
|
void WinEDA3D_DrawFrame::Set3DBgColor()
|
||||||
{
|
{
|
||||||
S3D_Color color;
|
S3D_Color color;
|
||||||
wxColour newcolor, oldcolor;
|
wxColour newcolor, oldcolor;
|
||||||
|
@ -401,9 +376,7 @@ void WinEDA3D_DrawFrame::Set3DBgColor()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************/
|
|
||||||
void WinEDA3D_DrawFrame::Set3DAxisOnOff()
|
void WinEDA3D_DrawFrame::Set3DAxisOnOff()
|
||||||
/******************************************/
|
|
||||||
{
|
{
|
||||||
if( g_Parm_3D_Visu.m_Draw3DAxis )
|
if( g_Parm_3D_Visu.m_Draw3DAxis )
|
||||||
g_Parm_3D_Visu.m_Draw3DAxis = FALSE;
|
g_Parm_3D_Visu.m_Draw3DAxis = FALSE;
|
||||||
|
@ -413,9 +386,7 @@ void WinEDA3D_DrawFrame::Set3DAxisOnOff()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************/
|
|
||||||
void WinEDA3D_DrawFrame::Set3DModuleOnOff()
|
void WinEDA3D_DrawFrame::Set3DModuleOnOff()
|
||||||
/******************************************/
|
|
||||||
{
|
{
|
||||||
if( g_Parm_3D_Visu.m_Draw3DModule )
|
if( g_Parm_3D_Visu.m_Draw3DModule )
|
||||||
g_Parm_3D_Visu.m_Draw3DModule = FALSE;
|
g_Parm_3D_Visu.m_Draw3DModule = FALSE;
|
||||||
|
@ -425,9 +396,7 @@ void WinEDA3D_DrawFrame::Set3DModuleOnOff()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************/
|
|
||||||
void WinEDA3D_DrawFrame::Set3DZoneOnOff()
|
void WinEDA3D_DrawFrame::Set3DZoneOnOff()
|
||||||
/******************************************/
|
|
||||||
{
|
{
|
||||||
if( g_Parm_3D_Visu.m_Draw3DZone )
|
if( g_Parm_3D_Visu.m_Draw3DZone )
|
||||||
g_Parm_3D_Visu.m_Draw3DZone = FALSE;
|
g_Parm_3D_Visu.m_Draw3DZone = FALSE;
|
||||||
|
@ -437,9 +406,7 @@ void WinEDA3D_DrawFrame::Set3DZoneOnOff()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************/
|
|
||||||
void WinEDA3D_DrawFrame::Set3DCommentsOnOff()
|
void WinEDA3D_DrawFrame::Set3DCommentsOnOff()
|
||||||
/******************************************/
|
|
||||||
{
|
{
|
||||||
if( g_Parm_3D_Visu.m_Draw3DComments )
|
if( g_Parm_3D_Visu.m_Draw3DComments )
|
||||||
g_Parm_3D_Visu.m_Draw3DComments = FALSE;
|
g_Parm_3D_Visu.m_Draw3DComments = FALSE;
|
||||||
|
@ -449,9 +416,7 @@ void WinEDA3D_DrawFrame::Set3DCommentsOnOff()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************/
|
|
||||||
void WinEDA3D_DrawFrame::Set3DDrawingsOnOff()
|
void WinEDA3D_DrawFrame::Set3DDrawingsOnOff()
|
||||||
/******************************************/
|
|
||||||
{
|
{
|
||||||
if( g_Parm_3D_Visu.m_Draw3DDrawings )
|
if( g_Parm_3D_Visu.m_Draw3DDrawings )
|
||||||
g_Parm_3D_Visu.m_Draw3DDrawings = FALSE;
|
g_Parm_3D_Visu.m_Draw3DDrawings = FALSE;
|
||||||
|
@ -461,9 +426,7 @@ void WinEDA3D_DrawFrame::Set3DDrawingsOnOff()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************/
|
|
||||||
void WinEDA3D_DrawFrame::Set3DEco1OnOff()
|
void WinEDA3D_DrawFrame::Set3DEco1OnOff()
|
||||||
/******************************************/
|
|
||||||
{
|
{
|
||||||
if( g_Parm_3D_Visu.m_Draw3DEco1 )
|
if( g_Parm_3D_Visu.m_Draw3DEco1 )
|
||||||
g_Parm_3D_Visu.m_Draw3DEco1 = FALSE;
|
g_Parm_3D_Visu.m_Draw3DEco1 = FALSE;
|
||||||
|
@ -473,9 +436,7 @@ void WinEDA3D_DrawFrame::Set3DEco1OnOff()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************/
|
|
||||||
void WinEDA3D_DrawFrame::Set3DEco2OnOff()
|
void WinEDA3D_DrawFrame::Set3DEco2OnOff()
|
||||||
/******************************************/
|
|
||||||
{
|
{
|
||||||
if( g_Parm_3D_Visu.m_Draw3DEco2 )
|
if( g_Parm_3D_Visu.m_Draw3DEco2 )
|
||||||
g_Parm_3D_Visu.m_Draw3DEco2 = FALSE;
|
g_Parm_3D_Visu.m_Draw3DEco2 = FALSE;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Name: 3d_read_mesh.cpp
|
// Name: 3d_read_mesh.cpp
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -18,9 +17,7 @@
|
||||||
#include "3d_viewer.h"
|
#include "3d_viewer.h"
|
||||||
|
|
||||||
|
|
||||||
/***********************************/
|
int S3D_MASTER::ReadData()
|
||||||
int S3D_MASTER:: ReadData()
|
|
||||||
/************************************/
|
|
||||||
{
|
{
|
||||||
char line[1024], * text;
|
char line[1024], * text;
|
||||||
wxFileName fn;
|
wxFileName fn;
|
||||||
|
@ -34,7 +31,7 @@ int S3D_MASTER:: ReadData()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if( wxFileName::FileExists(m_Shape3DName) )
|
if( wxFileName::FileExists( m_Shape3DName ) )
|
||||||
FullFilename = m_Shape3DName;
|
FullFilename = m_Shape3DName;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -44,7 +41,7 @@ int S3D_MASTER:: ReadData()
|
||||||
if( FullFilename.IsEmpty() )
|
if( FullFilename.IsEmpty() )
|
||||||
{
|
{
|
||||||
wxLogDebug( _( "3D part library <%s> could not be found." ),
|
wxLogDebug( _( "3D part library <%s> could not be found." ),
|
||||||
GetChars( fn.GetFullPath() ) );
|
GetChars( fn.GetFullPath() ) );
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,8 +53,9 @@ int S3D_MASTER:: ReadData()
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switch the locale to standard C (needed to print floating point numbers like 1.3)
|
// Switch the locale to standard C (needed to print floating point
|
||||||
SetLocaleTo_C_standard( );
|
// numbers like 1.3)
|
||||||
|
SetLocaleTo_C_standard();
|
||||||
while( GetLine( file, line, &LineNum, 512 ) )
|
while( GetLine( file, line, &LineNum, 512 ) )
|
||||||
{
|
{
|
||||||
text = strtok( line, " \t\n\r" );
|
text = strtok( line, " \t\n\r" );
|
||||||
|
@ -79,40 +77,36 @@ int S3D_MASTER:: ReadData()
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose( file );
|
fclose( file );
|
||||||
SetLocaleTo_Default( ); // revert to the current locale
|
SetLocaleTo_Default(); // revert to the current locale
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************/
|
|
||||||
int S3D_MASTER:: ReadMaterial( FILE* file, int* LineNum )
|
|
||||||
/*********************************************************/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* analyse la description du type:
|
* Analyzes the description of the type:
|
||||||
* material DEF yellow Material {
|
* DEF yellow material Material (
|
||||||
* diffuseColor 1.00000 1.00000 0.00000e+0
|
* DiffuseColor 1.00000 1.00000 0.00000e 0
|
||||||
* emissiveColor 0.00000e+0 0.00000e+0 0.00000e+0
|
* EmissiveColor 0.00000e 0 0.00000e 0 0.00000e 0
|
||||||
* specularColor 1.00000 1.00000 1.00000
|
* SpecularColor 1.00000 1.00000 1.00000
|
||||||
* ambientIntensity 1.00000
|
* AmbientIntensity 1.00000
|
||||||
* transparency 0.00000e+0
|
* Transparency 0.00000e 0
|
||||||
* shininess 1.00000
|
* Shininess 1.00000
|
||||||
* }
|
*)
|
||||||
* ou du type:
|
* Or type:
|
||||||
* material USE yellow
|
* USE yellow material
|
||||||
*/
|
*/
|
||||||
|
int S3D_MASTER:: ReadMaterial( FILE* file, int* LineNum )
|
||||||
{
|
{
|
||||||
char line[512], * text, * command;
|
char line[512], * text, * command;
|
||||||
wxString mat_name;
|
wxString mat_name;
|
||||||
S3D_MATERIAL* material = NULL;
|
S3D_MATERIAL* material = NULL;
|
||||||
|
|
||||||
// Lecture de la commande:
|
|
||||||
command = strtok( NULL, " \t\n\r" );
|
command = strtok( NULL, " \t\n\r" );
|
||||||
text = strtok( NULL, " \t\n\r" );
|
text = strtok( NULL, " \t\n\r" );
|
||||||
mat_name = CONV_FROM_UTF8( text );
|
mat_name = CONV_FROM_UTF8( text );
|
||||||
if( stricmp( command, "USE" ) == 0 )
|
if( stricmp( command, "USE" ) == 0 )
|
||||||
{
|
{
|
||||||
for( material = m_Materials; material; material = material->Next() )
|
for( material = m_Materials; material; material = material->Next() )
|
||||||
{
|
{
|
||||||
if( material->m_Name == mat_name )
|
if( material->m_Name == mat_name )
|
||||||
{
|
{
|
||||||
|
@ -189,9 +183,7 @@ int S3D_MASTER:: ReadMaterial( FILE* file, int* LineNum )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************/
|
|
||||||
int S3D_MASTER::ReadChildren( FILE* file, int* LineNum )
|
int S3D_MASTER::ReadChildren( FILE* file, int* LineNum )
|
||||||
/***********************************************************/
|
|
||||||
{
|
{
|
||||||
char line[1024], * text;
|
char line[1024], * text;
|
||||||
|
|
||||||
|
@ -218,9 +210,7 @@ int S3D_MASTER::ReadChildren( FILE* file, int* LineNum )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************/
|
|
||||||
int S3D_MASTER::ReadShape( FILE* file, int* LineNum )
|
int S3D_MASTER::ReadShape( FILE* file, int* LineNum )
|
||||||
/********************************************************/
|
|
||||||
{
|
{
|
||||||
char line[1024], * text;
|
char line[1024], * text;
|
||||||
int err = 1;
|
int err = 1;
|
||||||
|
@ -253,9 +243,7 @@ int S3D_MASTER::ReadShape( FILE* file, int* LineNum )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************/
|
|
||||||
int S3D_MASTER::ReadAppearance( FILE* file, int* LineNum )
|
int S3D_MASTER::ReadAppearance( FILE* file, int* LineNum )
|
||||||
/*************************************************************/
|
|
||||||
{
|
{
|
||||||
char line[1024], * text;
|
char line[1024], * text;
|
||||||
int err = 1;
|
int err = 1;
|
||||||
|
@ -285,11 +273,7 @@ int S3D_MASTER::ReadAppearance( FILE* file, int* LineNum )
|
||||||
|
|
||||||
#define BUFSIZE 2000
|
#define BUFSIZE 2000
|
||||||
|
|
||||||
/************************************************************************************/
|
/* Read a coordinate list like:
|
||||||
double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize, int* LineNum )
|
|
||||||
/************************************************************************************/
|
|
||||||
|
|
||||||
/* Read a coordinate liste like:
|
|
||||||
* coord Coordinate { point [
|
* coord Coordinate { point [
|
||||||
* -5.24489 6.57640e-3 -9.42129e-2,
|
* -5.24489 6.57640e-3 -9.42129e-2,
|
||||||
* -5.11821 6.57421e-3 0.542654,
|
* -5.11821 6.57421e-3 0.542654,
|
||||||
|
@ -305,6 +289,8 @@ double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize, int* LineNu
|
||||||
* text_buffer contains the first line of this node :
|
* text_buffer contains the first line of this node :
|
||||||
* "coord Coordinate { point ["
|
* "coord Coordinate { point ["
|
||||||
*/
|
*/
|
||||||
|
double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize,
|
||||||
|
int* LineNum )
|
||||||
{
|
{
|
||||||
double* data_list = NULL;
|
double* data_list = NULL;
|
||||||
unsigned int ii = 0, jj = 0, nn = BUFSIZE;
|
unsigned int ii = 0, jj = 0, nn = BUFSIZE;
|
||||||
|
@ -351,7 +337,8 @@ double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize, int* LineNu
|
||||||
if( ii >= nn )
|
if( ii >= nn )
|
||||||
{
|
{
|
||||||
nn *= 2;
|
nn *= 2;
|
||||||
data_list = (double*) realloc( data_list, ( nn * sizeof(double) ) );
|
data_list =
|
||||||
|
(double*) realloc( data_list, ( nn * sizeof(double) ) );
|
||||||
}
|
}
|
||||||
HasData = FALSE;
|
HasData = FALSE;
|
||||||
if( *text == ']' )
|
if( *text == ']' )
|
||||||
|
@ -384,9 +371,7 @@ double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize, int* LineNu
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
|
||||||
int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
|
int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
|
||||||
/***********************************************************/
|
|
||||||
{
|
{
|
||||||
char line[1024], buffer[1024], * text;
|
char line[1024], buffer[1024], * text;
|
||||||
int err = 1;
|
int err = 1;
|
||||||
|
@ -430,7 +415,8 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
|
||||||
if( stricmp( text, "normal" ) == 0 )
|
if( stricmp( text, "normal" ) == 0 )
|
||||||
{
|
{
|
||||||
int coord_number;
|
int coord_number;
|
||||||
double* buf_points = ReadCoordsList( file, line, &coord_number, LineNum );
|
double* buf_points = ReadCoordsList( file, line, &coord_number,
|
||||||
|
LineNum );
|
||||||
continue;
|
continue;
|
||||||
free( buf_points );
|
free( buf_points );
|
||||||
continue;
|
continue;
|
||||||
|
@ -457,7 +443,8 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
|
||||||
if( stricmp( text, "color" ) == 0 )
|
if( stricmp( text, "color" ) == 0 )
|
||||||
{
|
{
|
||||||
int coord_number;
|
int coord_number;
|
||||||
double* buf_points = ReadCoordsList( file, line, &coord_number, LineNum );
|
double* buf_points = ReadCoordsList( file, line, &coord_number,
|
||||||
|
LineNum );
|
||||||
continue;
|
continue;
|
||||||
free( buf_points );
|
free( buf_points );
|
||||||
continue;
|
continue;
|
||||||
|
@ -544,9 +531,7 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************/
|
|
||||||
int Struct3D_Shape:: ReadData( FILE* file, int* LineNum )
|
int Struct3D_Shape:: ReadData( FILE* file, int* LineNum )
|
||||||
/*********************************************************/
|
|
||||||
{
|
{
|
||||||
char line[512];
|
char line[512];
|
||||||
|
|
||||||
|
|
|
@ -1,37 +1,37 @@
|
||||||
/********************************************************/
|
/*****************/
|
||||||
/* 3d_struct.h : definition des structures de donnees */
|
/* 3d_struct.h */
|
||||||
/* pour la representation 3D des modules */
|
/*****************/
|
||||||
/********************************************************/
|
|
||||||
|
|
||||||
#ifndef STRUCT_3D_H
|
#ifndef STRUCT_3D_H
|
||||||
#define STRUCT_3D_H
|
#define STRUCT_3D_H
|
||||||
|
|
||||||
#include "base_struct.h"
|
#include "base_struct.h"
|
||||||
|
|
||||||
/* 3D modeler units -> PCB units conversion scale:
|
|
||||||
* 1 "3D unit modeler" = 1 unit wings3d = 2,54 mm = 0.1 inch */
|
/* 3D modeling units -> PCB units conversion scale:
|
||||||
|
* 1 "3D model unit" wings3d = 1 unit = 2.54 mm = 0.1 inch
|
||||||
|
*/
|
||||||
#define UNITS3D_TO_UNITSPCB 1000
|
#define UNITS3D_TO_UNITSPCB 1000
|
||||||
|
|
||||||
|
|
||||||
class S3D_MASTER;
|
class S3D_MASTER;
|
||||||
class Struct3D_Shape;
|
class Struct3D_Shape;
|
||||||
|
|
||||||
class S3D_Color /* This is a 3D color (R, G, G) 3 floats range 0 to 1.0*/
|
class S3D_Color /* 3D color (R, G, G) 3 floats range 0 to 1.0*/
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
double m_Red, m_Green, m_Blue;
|
double m_Red, m_Green, m_Blue;
|
||||||
public:
|
public: S3D_Color()
|
||||||
S3D_Color() {
|
{
|
||||||
m_Red = m_Green = m_Blue = 0;
|
m_Red = m_Green = m_Blue = 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class S3D_Vertex /* This is a 3D coordinate (3 float numbers: x,y,z coordinates)*/
|
class S3D_Vertex /* 3D coordinate (3 float numbers: x,y,z coordinates)*/
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
double x, y, z;
|
double x, y, z;
|
||||||
public:
|
public: S3D_Vertex();
|
||||||
S3D_Vertex();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class S3D_MATERIAL : public EDA_BaseStruct /* openGL "material" data*/
|
class S3D_MATERIAL : public EDA_BaseStruct /* openGL "material" data*/
|
||||||
|
@ -45,8 +45,7 @@ public:
|
||||||
float m_Transparency;
|
float m_Transparency;
|
||||||
float m_Shininess;
|
float m_Shininess;
|
||||||
|
|
||||||
public:
|
public: S3D_MATERIAL( S3D_MASTER* father, const wxString& name );
|
||||||
S3D_MATERIAL( S3D_MASTER * father, const wxString &name );
|
|
||||||
|
|
||||||
S3D_MATERIAL* Next() const { return (S3D_MATERIAL*) Pnext; }
|
S3D_MATERIAL* Next() const { return (S3D_MATERIAL*) Pnext; }
|
||||||
S3D_MATERIAL* Back() const { return (S3D_MATERIAL*) Pback; }
|
S3D_MATERIAL* Back() const { return (S3D_MATERIAL*) Pback; }
|
||||||
|
@ -55,10 +54,8 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*******************************************/
|
|
||||||
class S3D_MASTER : public EDA_BaseStruct
|
|
||||||
/*******************************************/
|
|
||||||
/* Master structure for a 3D item description */
|
/* Master structure for a 3D item description */
|
||||||
|
class S3D_MASTER : public EDA_BaseStruct
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxString m_Shape3DName; /* 3D shape name in 3D library */
|
wxString m_Shape3DName; /* 3D shape name in 3D library */
|
||||||
|
@ -68,9 +65,7 @@ public:
|
||||||
Struct3D_Shape* m_3D_Drawings;
|
Struct3D_Shape* m_3D_Drawings;
|
||||||
S3D_MATERIAL* m_Materials;
|
S3D_MATERIAL* m_Materials;
|
||||||
|
|
||||||
public:
|
public: S3D_MASTER( EDA_BaseStruct* aParent );
|
||||||
|
|
||||||
S3D_MASTER( EDA_BaseStruct * aParent );
|
|
||||||
~S3D_MASTER();
|
~S3D_MASTER();
|
||||||
|
|
||||||
S3D_MASTER* Next() const { return (S3D_MASTER*) Pnext; }
|
S3D_MASTER* Next() const { return (S3D_MASTER*) Pnext; }
|
||||||
|
@ -82,30 +77,27 @@ public:
|
||||||
m_Materials = aMaterial;
|
m_Materials = aMaterial;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Copy( S3D_MASTER* pattern );
|
|
||||||
int ReadData();
|
void Copy( S3D_MASTER* pattern );
|
||||||
int ReadMaterial( FILE* file, int* LineNum );
|
int ReadData();
|
||||||
int ReadChildren( FILE* file, int* LineNum );
|
int ReadMaterial( FILE* file, int* LineNum );
|
||||||
int ReadShape( FILE* file, int* LineNum );
|
int ReadChildren( FILE* file, int* LineNum );
|
||||||
int ReadAppearance( FILE* file, int* LineNum );
|
int ReadShape( FILE* file, int* LineNum );
|
||||||
int ReadGeometry( FILE* file, int* LineNum );
|
int ReadAppearance( FILE* file, int* LineNum );
|
||||||
void Set_Object_Coords( S3D_Vertex* coord, int nbcoord );
|
int ReadGeometry( FILE* file, int* LineNum );
|
||||||
|
void Set_Object_Coords( S3D_Vertex* coord, int nbcoord );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*********************************************/
|
/* Describes a complex 3D */
|
||||||
class Struct3D_Shape : public EDA_BaseStruct
|
class Struct3D_Shape : public EDA_BaseStruct
|
||||||
/*********************************************/
|
|
||||||
/* decrit une forme complexe 3D */
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
S3D_Vertex* m_3D_Coord;
|
S3D_Vertex* m_3D_Coord;
|
||||||
int* m_3D_CoordIndex;
|
int* m_3D_CoordIndex;
|
||||||
int m_3D_Points;
|
int m_3D_Points;
|
||||||
|
|
||||||
public:
|
public: Struct3D_Shape( EDA_BaseStruct* aParent );
|
||||||
|
|
||||||
Struct3D_Shape( EDA_BaseStruct * aParent );
|
|
||||||
~Struct3D_Shape();
|
~Struct3D_Shape();
|
||||||
|
|
||||||
Struct3D_Shape* Next() const { return (Struct3D_Shape*) Pnext; }
|
Struct3D_Shape* Next() const { return (Struct3D_Shape*) Pnext; }
|
||||||
|
@ -115,14 +107,11 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
/* Display and edit a Vertex (triplet of values) in INCHES or MM or without
|
||||||
/* Classe pour afficher et editer un Vertex (triplet de valeurs),*/
|
* units.
|
||||||
/* en INCHES ou MM ou sans unites */
|
* internal_unit is the internal unit number by inch:
|
||||||
/*****************************************************************/
|
* - 1000 for EESchema
|
||||||
|
* - 10000 for PcbNew
|
||||||
/* internal_unit is the internal unit number by inch:
|
|
||||||
* - 1000 for EESchema
|
|
||||||
* - 10000 for PcbNew
|
|
||||||
*/
|
*/
|
||||||
class WinEDA_VertexCtrl
|
class WinEDA_VertexCtrl
|
||||||
{
|
{
|
||||||
|
@ -133,18 +122,15 @@ private:
|
||||||
wxStaticText* m_Text;
|
wxStaticText* m_Text;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
WinEDA_VertexCtrl( wxWindow* parent, const wxString& title,
|
||||||
// Constructor and destructor
|
wxBoxSizer* BoxSizer, int units, int internal_unit );
|
||||||
WinEDA_VertexCtrl( wxWindow * parent, const wxString &title,
|
|
||||||
wxBoxSizer * BoxSizer,
|
|
||||||
int units, int internal_unit );
|
|
||||||
|
|
||||||
~WinEDA_VertexCtrl();
|
~WinEDA_VertexCtrl();
|
||||||
|
|
||||||
S3D_Vertex GetValue();
|
S3D_Vertex GetValue();
|
||||||
void SetValue( S3D_Vertex vertex );
|
void SetValue( S3D_Vertex vertex );
|
||||||
void Enable( bool enbl );
|
void Enable( bool enbl );
|
||||||
void SetToolTip( const wxString& text );
|
void SetToolTip( const wxString& text );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*******************************************************************/
|
/********************/
|
||||||
/* 3d_toolbar.cpp: construction des tool bars de la frame visu 3d */
|
/* 3d_toolbar.cpp */
|
||||||
/*******************************************************************/
|
/********************/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
|
@ -9,31 +9,34 @@
|
||||||
#include "3d_viewer.h"
|
#include "3d_viewer.h"
|
||||||
|
|
||||||
|
|
||||||
/*********************************************/
|
|
||||||
void WinEDA3D_DrawFrame::ReCreateHToolbar()
|
void WinEDA3D_DrawFrame::ReCreateHToolbar()
|
||||||
/*********************************************/
|
|
||||||
{
|
{
|
||||||
if( m_HToolBar != NULL )
|
if( m_HToolBar != NULL )
|
||||||
{ // simple mise a jour de la liste des fichiers anciens
|
{
|
||||||
|
// Simple update to the list of old files.
|
||||||
SetToolbars();
|
SetToolbars();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );
|
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );
|
||||||
|
|
||||||
#if !KICAD_AUIMANAGER
|
#if !KICAD_AUIMANAGER
|
||||||
SetToolBar( (wxToolBar*)m_HToolBar );
|
SetToolBar( (wxToolBar*) m_HToolBar );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Set up toolbar
|
// Set up toolbar
|
||||||
m_HToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,
|
m_HToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,
|
||||||
wxBitmap( import3d_xpm ),
|
wxBitmap( import3d_xpm ),
|
||||||
_( "Reload board" ) );
|
_( "Reload board" ) );
|
||||||
#if (defined(__WINDOWS__) || defined(__APPLE__)) // do not work properly under linux
|
#if (defined(__WINDOWS__) || defined(__APPLE__ ) )
|
||||||
m_HToolBar-> AddSeparator();
|
|
||||||
|
// Does not work properly under linux
|
||||||
|
m_HToolBar->AddSeparator();
|
||||||
|
|
||||||
m_HToolBar->AddTool( ID_TOOL_SCREENCOPY_TOCLIBBOARD, wxEmptyString,
|
m_HToolBar->AddTool( ID_TOOL_SCREENCOPY_TOCLIBBOARD, wxEmptyString,
|
||||||
wxBitmap( copy_button ),
|
wxBitmap( copy_button ),
|
||||||
_( "Copy 3D Image to Clipboard" ) );
|
_( "Copy 3D Image to Clipboard" ) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_HToolBar->AddSeparator();
|
m_HToolBar->AddSeparator();
|
||||||
|
@ -85,33 +88,29 @@ void WinEDA3D_DrawFrame::ReCreateHToolbar()
|
||||||
_( "Move right ->" ) );
|
_( "Move right ->" ) );
|
||||||
|
|
||||||
m_HToolBar->AddTool( ID_MOVE3D_UP, wxEmptyString, wxBitmap( up_xpm ),
|
m_HToolBar->AddTool( ID_MOVE3D_UP, wxEmptyString, wxBitmap( up_xpm ),
|
||||||
_( "Move Up ^" ) );
|
_( "Move up ^" ) );
|
||||||
|
|
||||||
m_HToolBar->AddTool( ID_MOVE3D_DOWN, wxEmptyString, wxBitmap( down_xpm ),
|
m_HToolBar->AddTool( ID_MOVE3D_DOWN, wxEmptyString, wxBitmap( down_xpm ),
|
||||||
_( "Move Down" ) );
|
_( "Move down" ) );
|
||||||
|
|
||||||
m_HToolBar->Realize();
|
m_HToolBar->Realize();
|
||||||
|
|
||||||
// SetToolbars();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************/
|
|
||||||
void WinEDA3D_DrawFrame::ReCreateVToolbar()
|
void WinEDA3D_DrawFrame::ReCreateVToolbar()
|
||||||
/*********************************************/
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************/
|
|
||||||
void WinEDA3D_DrawFrame::ReCreateMenuBar()
|
void WinEDA3D_DrawFrame::ReCreateMenuBar()
|
||||||
/**********************************************/
|
|
||||||
{
|
{
|
||||||
bool full_options = true;
|
bool full_options = true;
|
||||||
|
|
||||||
// If called from the display frame of cvpcb, only some options are relevant
|
// If called from the display frame of cvpcb, only some options are
|
||||||
if ( m_Parent->m_FrameName == wxT( "CmpFrame" ) ) // Called from cvpcb !
|
// relevant
|
||||||
full_options = false; // Do not display all options
|
if( m_Parent->m_FrameName == wxT( "CmpFrame" ) ) // Called from cvpcb !
|
||||||
|
full_options = false; // Do not display all
|
||||||
|
// options
|
||||||
|
|
||||||
wxMenuBar* menuBar = new wxMenuBar;
|
wxMenuBar* menuBar = new wxMenuBar;
|
||||||
|
|
||||||
|
@ -119,8 +118,10 @@ bool full_options = true;
|
||||||
|
|
||||||
menuBar->Append( fileMenu, _( "&File" ) );
|
menuBar->Append( fileMenu, _( "&File" ) );
|
||||||
|
|
||||||
fileMenu->Append( ID_MENU_SCREENCOPY_PNG, _( "Create Image (png format)" ) );
|
fileMenu->Append( ID_MENU_SCREENCOPY_PNG,
|
||||||
fileMenu->Append( ID_MENU_SCREENCOPY_JPEG, _( "Create Image (jpeg format)" ) );
|
_( "Create Image (png format)" ) );
|
||||||
|
fileMenu->Append( ID_MENU_SCREENCOPY_JPEG,
|
||||||
|
_( "Create Image (jpeg format)" ) );
|
||||||
fileMenu->AppendSeparator();
|
fileMenu->AppendSeparator();
|
||||||
fileMenu->Append( wxID_EXIT, _( "&Exit" ) );
|
fileMenu->Append( wxID_EXIT, _( "&Exit" ) );
|
||||||
|
|
||||||
|
@ -133,33 +134,31 @@ bool full_options = true;
|
||||||
ADD_MENUITEM( referencesMenu, ID_MENU3D_AXIS_ONOFF,
|
ADD_MENUITEM( referencesMenu, ID_MENU3D_AXIS_ONOFF,
|
||||||
_( "3D Axis On/Off" ), axis3d_front_xpm );
|
_( "3D Axis On/Off" ), axis3d_front_xpm );
|
||||||
|
|
||||||
if ( full_options )
|
if( full_options )
|
||||||
{
|
{
|
||||||
ADD_MENUITEM( referencesMenu, ID_MENU3D_MODULE_ONOFF,
|
ADD_MENUITEM( referencesMenu, ID_MENU3D_MODULE_ONOFF,
|
||||||
_( "3D Footprints Shapes On/Off" ), shape_3d_xpm );
|
_( "3D Footprints Shapes On/Off" ), shape_3d_xpm );
|
||||||
|
|
||||||
ADD_MENUITEM( referencesMenu, ID_MENU3D_ZONE_ONOFF,
|
ADD_MENUITEM( referencesMenu, ID_MENU3D_ZONE_ONOFF,
|
||||||
_( "Zone Filling On/Off" ), add_zone_xpm );
|
_( "Zone Filling On/Off" ), add_zone_xpm );
|
||||||
|
|
||||||
ADD_MENUITEM( referencesMenu, ID_MENU3D_COMMENTS_ONOFF,
|
ADD_MENUITEM( referencesMenu, ID_MENU3D_COMMENTS_ONOFF,
|
||||||
_( "Comments Layer On/Off" ), edit_sheet_xpm );
|
_( "Comments Layer On/Off" ), edit_sheet_xpm );
|
||||||
|
|
||||||
ADD_MENUITEM( referencesMenu, ID_MENU3D_DRAWINGS_ONOFF,
|
ADD_MENUITEM( referencesMenu, ID_MENU3D_DRAWINGS_ONOFF,
|
||||||
_( "Drawings Layer On/Off" ), add_polygon_xpm );
|
_( "Drawings Layer On/Off" ), add_polygon_xpm );
|
||||||
|
|
||||||
ADD_MENUITEM( referencesMenu, ID_MENU3D_ECO1_ONOFF,
|
ADD_MENUITEM( referencesMenu, ID_MENU3D_ECO1_ONOFF,
|
||||||
_( "Eco1 Layer On/Off" ), tools_xpm );
|
_( "Eco1 Layer On/Off" ), tools_xpm );
|
||||||
|
|
||||||
ADD_MENUITEM( referencesMenu, ID_MENU3D_ECO2_ONOFF,
|
ADD_MENUITEM( referencesMenu, ID_MENU3D_ECO2_ONOFF,
|
||||||
_( "Eco2 Layer On/Off" ), tools_xpm );
|
_( "Eco2 Layer On/Off" ), tools_xpm );
|
||||||
}
|
}
|
||||||
|
|
||||||
SetMenuBar( menuBar );
|
SetMenuBar( menuBar );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************/
|
|
||||||
void WinEDA3D_DrawFrame::SetToolbars()
|
void WinEDA3D_DrawFrame::SetToolbars()
|
||||||
/*****************************************/
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,10 +26,10 @@
|
||||||
#include "id.h"
|
#include "id.h"
|
||||||
|
|
||||||
|
|
||||||
#define KICAD_DEFAULT_3D_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE|wxWANTS_CHARS
|
#define KICAD_DEFAULT_3D_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE | wxWANTS_CHARS
|
||||||
|
|
||||||
|
|
||||||
#define LIB3D_PATH wxT("packages3d")
|
#define LIB3D_PATH wxT( "packages3d" )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Command IDs for the 3D viewer.
|
* Command IDs for the 3D viewer.
|
||||||
|
@ -100,104 +100,106 @@ class SEGVIA;
|
||||||
class Info_3D_Visu
|
class Info_3D_Visu
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
double m_Beginx, m_Beginy; /* position of mouse */
|
double m_Beginx, m_Beginy; /* position of mouse */
|
||||||
double m_Quat[4]; /* orientation of object */
|
double m_Quat[4]; /* orientation of object */
|
||||||
double m_Rot[4]; /* man rotation of object */
|
double m_Rot[4]; /* man rotation of object */
|
||||||
double m_Zoom; /* field of view in degrees */
|
double m_Zoom; /* field of view in degrees */
|
||||||
S3D_Color m_BgColor;
|
S3D_Color m_BgColor;
|
||||||
bool m_Draw3DAxis;
|
bool m_Draw3DAxis;
|
||||||
bool m_Draw3DModule;
|
bool m_Draw3DModule;
|
||||||
bool m_Draw3DZone;
|
bool m_Draw3DZone;
|
||||||
bool m_Draw3DComments;
|
bool m_Draw3DComments;
|
||||||
bool m_Draw3DDrawings;
|
bool m_Draw3DDrawings;
|
||||||
bool m_Draw3DEco1;
|
bool m_Draw3DEco1;
|
||||||
bool m_Draw3DEco2;
|
bool m_Draw3DEco2;
|
||||||
wxPoint m_BoardPos;
|
wxPoint m_BoardPos;
|
||||||
wxSize m_BoardSize;
|
wxSize m_BoardSize;
|
||||||
int m_Layers;
|
int m_Layers;
|
||||||
EDA_BoardDesignSettings * m_BoardSettings; // Link to current board design settings
|
EDA_BoardDesignSettings* m_BoardSettings; // Link to current board design
|
||||||
double m_Epoxy_Width; /* Epoxy tickness (normalized) */
|
// settings
|
||||||
|
double m_Epoxy_Width; /* Epoxy thickness (normalized)
|
||||||
|
**/
|
||||||
|
|
||||||
double m_BoardScale; /* Normalisation scale for coordinates:
|
double m_BoardScale; /* Normalization scale for coordinates:
|
||||||
when scaled tey are between -1.0 and +1.0 */
|
* when scaled between -1.0 and +1.0 */
|
||||||
double m_LayerZcoord[32];
|
double m_LayerZcoord[32];
|
||||||
public:
|
public: Info_3D_Visu();
|
||||||
Info_3D_Visu();
|
|
||||||
~Info_3D_Visu();
|
~Info_3D_Visu();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class Pcb3D_GLCanvas: public wxGLCanvas
|
class Pcb3D_GLCanvas : public wxGLCanvas
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WinEDA3D_DrawFrame * m_Parent;
|
WinEDA3D_DrawFrame* m_Parent;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_init;
|
bool m_init;
|
||||||
GLuint m_gllist;
|
GLuint m_gllist;
|
||||||
#if wxCHECK_VERSION( 2, 9, 0 )
|
#if wxCHECK_VERSION( 2, 9, 0 )
|
||||||
wxGLContext* m_glRC;
|
wxGLContext* m_glRC;
|
||||||
#endif
|
#endif
|
||||||
public:
|
public:
|
||||||
Pcb3D_GLCanvas( WinEDA3D_DrawFrame *parent );
|
Pcb3D_GLCanvas( WinEDA3D_DrawFrame* parent );
|
||||||
~Pcb3D_GLCanvas();
|
~Pcb3D_GLCanvas();
|
||||||
|
|
||||||
void ClearLists();
|
void ClearLists();
|
||||||
|
|
||||||
void OnPaint(wxPaintEvent& event);
|
void OnPaint( wxPaintEvent& event );
|
||||||
void OnEraseBackground(wxEraseEvent& event);
|
void OnEraseBackground( wxEraseEvent& event );
|
||||||
void OnChar(wxKeyEvent& event);
|
void OnChar( wxKeyEvent& event );
|
||||||
void OnMouseEvent(wxMouseEvent& event);
|
void OnMouseEvent( wxMouseEvent& event );
|
||||||
void OnRightClick(wxMouseEvent& event);
|
void OnRightClick( wxMouseEvent& event );
|
||||||
void OnPopUpMenu(wxCommandEvent & event);
|
void OnPopUpMenu( wxCommandEvent& event );
|
||||||
void TakeScreenshot(wxCommandEvent & event);
|
void TakeScreenshot( wxCommandEvent& event );
|
||||||
void SetView3D(int keycode);
|
void SetView3D( int keycode );
|
||||||
void DisplayStatus();
|
void DisplayStatus();
|
||||||
void Redraw(bool finish = false);
|
void Redraw( bool finish = false );
|
||||||
GLuint DisplayCubeforTest();
|
GLuint DisplayCubeforTest();
|
||||||
|
|
||||||
void OnEnterWindow( wxMouseEvent& event );
|
void OnEnterWindow( wxMouseEvent& event );
|
||||||
|
|
||||||
void Render();
|
void Render();
|
||||||
GLuint CreateDrawGL_List();
|
GLuint CreateDrawGL_List();
|
||||||
void InitGL();
|
void InitGL();
|
||||||
void SetLights();
|
void SetLights();
|
||||||
void Draw3D_Track(TRACK * track);
|
void Draw3D_Track( TRACK* track );
|
||||||
void Draw3D_Via(SEGVIA * via);
|
void Draw3D_Via( SEGVIA* via );
|
||||||
void Draw3D_DrawSegment(DRAWSEGMENT * segment);
|
void Draw3D_DrawSegment( DRAWSEGMENT* segment );
|
||||||
void Draw3D_DrawText(TEXTE_PCB * text);
|
void Draw3D_DrawText( TEXTE_PCB* text );
|
||||||
|
|
||||||
//int Get3DLayerEnable(int act_layer);
|
//int Get3DLayerEnable(int act_layer);
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class WinEDA3D_DrawFrame: public wxFrame
|
class WinEDA3D_DrawFrame : public wxFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WinEDA_BasePcbFrame * m_Parent;
|
WinEDA_BasePcbFrame* m_Parent;
|
||||||
Pcb3D_GLCanvas * m_Canvas;
|
Pcb3D_GLCanvas* m_Canvas;
|
||||||
WinEDA_Toolbar * m_HToolBar;
|
WinEDA_Toolbar* m_HToolBar;
|
||||||
WinEDA_Toolbar * m_VToolBar;
|
WinEDA_Toolbar* m_VToolBar;
|
||||||
int m_InternalUnits;
|
int m_InternalUnits;
|
||||||
wxPoint m_FramePos;
|
wxPoint m_FramePos;
|
||||||
wxSize m_FrameSize;
|
wxSize m_FrameSize;
|
||||||
|
|
||||||
#if KICAD_AUIMANAGER
|
#if KICAD_AUIMANAGER
|
||||||
wxAuiManager m_auimgr;
|
wxAuiManager m_auimgr;
|
||||||
~WinEDA3D_DrawFrame() { m_auimgr.UnInit(); };
|
~WinEDA3D_DrawFrame() { m_auimgr.UnInit(); };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxString m_FrameName; // name used for writting and reading setup
|
wxString m_FrameName; // name used for writing and reading setup
|
||||||
// It is "Frame3D"
|
// It is "Frame3D"
|
||||||
|
|
||||||
public:
|
public:
|
||||||
WinEDA3D_DrawFrame( WinEDA_BasePcbFrame * parent,
|
WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent, const wxString& title,
|
||||||
const wxString& title,
|
|
||||||
long style = KICAD_DEFAULT_3D_DRAWFRAME_STYLE );
|
long style = KICAD_DEFAULT_3D_DRAWFRAME_STYLE );
|
||||||
|
|
||||||
void Exit3DFrame(wxCommandEvent& event);
|
void Exit3DFrame( wxCommandEvent& event );
|
||||||
void OnCloseWindow(wxCloseEvent & Event);
|
void OnCloseWindow( wxCloseEvent& Event );
|
||||||
void ReCreateMenuBar();
|
void ReCreateMenuBar();
|
||||||
void ReCreateHToolbar();
|
void ReCreateHToolbar();
|
||||||
void ReCreateVToolbar();
|
void ReCreateVToolbar();
|
||||||
|
@ -205,13 +207,13 @@ public:
|
||||||
void GetSettings();
|
void GetSettings();
|
||||||
void SaveSettings();
|
void SaveSettings();
|
||||||
|
|
||||||
void OnLeftClick(wxDC * DC, const wxPoint& MousePos);
|
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
|
||||||
void OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu);
|
void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
|
||||||
void OnKeyEvent(wxKeyEvent& event);
|
void OnKeyEvent( wxKeyEvent& event );
|
||||||
int BestZoom(); // Retourne le meilleur zoom
|
int BestZoom();
|
||||||
void RedrawActiveWindow(wxDC * DC, bool EraseBg);
|
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
|
||||||
void Process_Special_Functions(wxCommandEvent& event);
|
void Process_Special_Functions( wxCommandEvent& event );
|
||||||
void Process_Zoom(wxCommandEvent& event);
|
void Process_Zoom( wxCommandEvent& event );
|
||||||
|
|
||||||
void NewDisplay();
|
void NewDisplay();
|
||||||
void Set3DBgColor();
|
void Set3DBgColor();
|
||||||
|
@ -227,13 +229,13 @@ public:
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
void SetGLColor(int color);
|
void SetGLColor( int color );
|
||||||
void Set_Object_Data(const S3D_Vertex * coord, int nbcoord );
|
void Set_Object_Data( const S3D_Vertex* coord, int nbcoord );
|
||||||
|
|
||||||
extern Info_3D_Visu g_Parm_3D_Visu;
|
extern Info_3D_Visu g_Parm_3D_Visu;
|
||||||
extern double g_Draw3d_dx, g_Draw3d_dy;
|
extern double g_Draw3d_dx, g_Draw3d_dy;
|
||||||
extern double ZBottom, ZTop;
|
extern double ZBottom, ZTop;
|
||||||
extern double DataScale3D; // coeff de conversion unites utilsateut -> unites 3D
|
extern double DataScale3D; // 3D scale units.
|
||||||
extern int gl_attrib[];
|
extern int gl_attrib[];
|
||||||
|
|
||||||
#endif /* __3D_VIEWER_H__ */
|
#endif /* __3D_VIEWER_H__ */
|
||||||
|
|
|
@ -687,13 +687,12 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
|
||||||
if( Struct->Type() == DRAW_SHEET_STRUCT_TYPE )
|
if( Struct->Type() == DRAW_SHEET_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
// Add all pins sheets of a selected hierarchical sheet to the list
|
// Add all pins sheets of a selected hierarchical sheet to the list
|
||||||
Hierarchical_PIN_Sheet_Struct* SLabel =
|
SCH_SHEET_PIN* SLabel = ( (SCH_SHEET*) Struct )->m_Label;
|
||||||
( (DrawSheetStruct*) Struct )->m_Label;
|
|
||||||
while( SLabel )
|
while( SLabel )
|
||||||
{
|
{
|
||||||
if( SLabel->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
|
if( SLabel->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
|
||||||
AddPickedItem( screen, SLabel->m_Pos );
|
AddPickedItem( screen, SLabel->m_Pos );
|
||||||
SLabel = (Hierarchical_PIN_Sheet_Struct*) SLabel->Next();
|
SLabel = (SCH_SHEET_PIN*) SLabel->Next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -300,7 +300,7 @@ static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
|
||||||
/* Fill aList with Glabel info
|
/* Fill aList with Glabel info
|
||||||
*/
|
*/
|
||||||
SCH_ITEM* DrawList;
|
SCH_ITEM* DrawList;
|
||||||
Hierarchical_PIN_Sheet_Struct* PinLabel;
|
SCH_SHEET_PIN* PinLabel;
|
||||||
DrawSheetPath* sheet;
|
DrawSheetPath* sheet;
|
||||||
|
|
||||||
/* Build the sheet list */
|
/* Build the sheet list */
|
||||||
|
@ -327,7 +327,7 @@ static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
|
||||||
|
|
||||||
case DRAW_SHEET_STRUCT_TYPE:
|
case DRAW_SHEET_STRUCT_TYPE:
|
||||||
{
|
{
|
||||||
PinLabel = ( (DrawSheetStruct*) DrawList )->m_Label;
|
PinLabel = ( (SCH_SHEET*) DrawList )->m_Label;
|
||||||
while( PinLabel != NULL )
|
while( PinLabel != NULL )
|
||||||
{
|
{
|
||||||
labet_object.m_LabelType =
|
labet_object.m_LabelType =
|
||||||
|
@ -427,12 +427,12 @@ bool SortLabelsByValue( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
|
||||||
wxString* Text1, * Text2;
|
wxString* Text1, * Text2;
|
||||||
|
|
||||||
if( obj1.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
|
if( obj1.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
|
||||||
Text1 = &( (Hierarchical_PIN_Sheet_Struct*) (obj1.m_Label) )->m_Text;
|
Text1 = &( (SCH_SHEET_PIN*) (obj1.m_Label) )->m_Text;
|
||||||
else
|
else
|
||||||
Text1 = &( (SCH_TEXT*) (obj1.m_Label) )->m_Text;
|
Text1 = &( (SCH_TEXT*) (obj1.m_Label) )->m_Text;
|
||||||
|
|
||||||
if( obj2.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
|
if( obj2.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
|
||||||
Text2 = &( (Hierarchical_PIN_Sheet_Struct*) (obj2.m_Label) )->m_Text;
|
Text2 = &( (SCH_SHEET_PIN*) (obj2.m_Label) )->m_Text;
|
||||||
else
|
else
|
||||||
Text2 = &( (SCH_TEXT*) (obj2.m_Label) )->m_Text;
|
Text2 = &( (SCH_TEXT*) (obj2.m_Label) )->m_Text;
|
||||||
|
|
||||||
|
@ -464,12 +464,12 @@ bool SortLabelsBySheet( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
|
||||||
if( ii == 0 )
|
if( ii == 0 )
|
||||||
{
|
{
|
||||||
if( obj1.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
|
if( obj1.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
|
||||||
Text1 = ( (Hierarchical_PIN_Sheet_Struct*) obj1.m_Label )->m_Text;
|
Text1 = ( (SCH_SHEET_PIN*) obj1.m_Label )->m_Text;
|
||||||
else
|
else
|
||||||
Text1 = ( (SCH_TEXT*) obj1.m_Label )->m_Text;
|
Text1 = ( (SCH_TEXT*) obj1.m_Label )->m_Text;
|
||||||
|
|
||||||
if( obj2.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
|
if( obj2.m_LabelType == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
|
||||||
Text2 = ( (Hierarchical_PIN_Sheet_Struct*) obj2.m_Label )->m_Text;
|
Text2 = ( (SCH_SHEET_PIN*) obj2.m_Label )->m_Text;
|
||||||
else
|
else
|
||||||
Text2 = ( (SCH_TEXT*) obj2.m_Label )->m_Text;
|
Text2 = ( (SCH_TEXT*) obj2.m_Label )->m_Text;
|
||||||
|
|
||||||
|
@ -804,7 +804,7 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
|
||||||
{
|
{
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
SCH_LABEL* DrawTextItem;
|
SCH_LABEL* DrawTextItem;
|
||||||
Hierarchical_PIN_Sheet_Struct* DrawSheetLabel;
|
SCH_SHEET_PIN* DrawSheetLabel;
|
||||||
wxString msg, sheetpath;
|
wxString msg, sheetpath;
|
||||||
wxString labeltype;
|
wxString labeltype;
|
||||||
|
|
||||||
|
@ -835,8 +835,7 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
|
||||||
|
|
||||||
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
|
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
|
||||||
{
|
{
|
||||||
DrawSheetLabel =
|
DrawSheetLabel = (SCH_SHEET_PIN*) aList[ii].m_Label;
|
||||||
(Hierarchical_PIN_Sheet_Struct*) aList[ii].m_Label;
|
|
||||||
int jj = DrawSheetLabel->m_Shape;
|
int jj = DrawSheetLabel->m_Shape;
|
||||||
if( jj < 0 )
|
if( jj < 0 )
|
||||||
jj = NET_TMAX;
|
jj = NET_TMAX;
|
||||||
|
|
|
@ -795,7 +795,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
|
||||||
EDA_BaseStruct* item;
|
EDA_BaseStruct* item;
|
||||||
LIB_PIN* pin;
|
LIB_PIN* pin;
|
||||||
SCH_COMPONENT* LibItem = NULL;
|
SCH_COMPONENT* LibItem = NULL;
|
||||||
Hierarchical_PIN_Sheet_Struct* pinsheet;
|
SCH_SHEET_PIN* pinsheet;
|
||||||
wxPoint itempos;
|
wxPoint itempos;
|
||||||
|
|
||||||
switch( layer )
|
switch( layer )
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Name: class_drawsheet.cpp
|
// Name: class_drawsheet.cpp
|
||||||
// Purpose: member functions for DrawSheetStruct
|
// Purpose: member functions for SCH_SHEET
|
||||||
// header = class_drawsheet.h
|
// header = class_drawsheet.h
|
||||||
// Author: jean-pierre Charras
|
// Author: jean-pierre Charras
|
||||||
// Modified by:
|
// Modified by:
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
DrawSheetStruct::DrawSheetStruct( const wxPoint& pos ) :
|
SCH_SHEET::SCH_SHEET( const wxPoint& pos ) :
|
||||||
SCH_ITEM( NULL, DRAW_SHEET_STRUCT_TYPE )
|
SCH_ITEM( NULL, DRAW_SHEET_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
|
@ -41,10 +41,10 @@ DrawSheetStruct::DrawSheetStruct( const wxPoint& pos ) :
|
||||||
|
|
||||||
|
|
||||||
/**************************************/
|
/**************************************/
|
||||||
DrawSheetStruct::~DrawSheetStruct()
|
SCH_SHEET::~SCH_SHEET()
|
||||||
{
|
{
|
||||||
/**************************************/
|
/**************************************/
|
||||||
Hierarchical_PIN_Sheet_Struct* label = m_Label, * next_label;
|
SCH_SHEET_PIN* label = m_Label, * next_label;
|
||||||
|
|
||||||
while( label )
|
while( label )
|
||||||
{
|
{
|
||||||
|
@ -65,7 +65,7 @@ DrawSheetStruct::~DrawSheetStruct()
|
||||||
|
|
||||||
|
|
||||||
/**********************************************/
|
/**********************************************/
|
||||||
bool DrawSheetStruct::Save( FILE* aFile ) const
|
bool SCH_SHEET::Save( FILE* aFile ) const
|
||||||
/***********************************************/
|
/***********************************************/
|
||||||
/** Function Save
|
/** Function Save
|
||||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
* writes the data structures for this object out to a FILE in "*.brd" format.
|
||||||
|
@ -74,7 +74,7 @@ bool DrawSheetStruct::Save( FILE* aFile ) const
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
bool Success = true;
|
bool Success = true;
|
||||||
Hierarchical_PIN_Sheet_Struct* SheetLabel;
|
SCH_SHEET_PIN* SheetLabel;
|
||||||
|
|
||||||
fprintf( aFile, "$Sheet\n" );
|
fprintf( aFile, "$Sheet\n" );
|
||||||
|
|
||||||
|
@ -128,13 +128,13 @@ bool DrawSheetStruct::Save( FILE* aFile ) const
|
||||||
|
|
||||||
|
|
||||||
/***********************************************/
|
/***********************************************/
|
||||||
DrawSheetStruct* DrawSheetStruct::GenCopy()
|
SCH_SHEET* SCH_SHEET::GenCopy()
|
||||||
{
|
{
|
||||||
/***********************************************/
|
/***********************************************/
|
||||||
/* creates a copy of a sheet
|
/* creates a copy of a sheet
|
||||||
* The linked data itself (EEDrawList) is not duplicated
|
* The linked data itself (EEDrawList) is not duplicated
|
||||||
*/
|
*/
|
||||||
DrawSheetStruct* newitem = new DrawSheetStruct( m_Pos );
|
SCH_SHEET* newitem = new SCH_SHEET( m_Pos );
|
||||||
|
|
||||||
|
|
||||||
newitem->m_Size = m_Size;
|
newitem->m_Size = m_Size;
|
||||||
|
@ -153,7 +153,7 @@ DrawSheetStruct* DrawSheetStruct::GenCopy()
|
||||||
|
|
||||||
newitem->m_Label = NULL;
|
newitem->m_Label = NULL;
|
||||||
|
|
||||||
Hierarchical_PIN_Sheet_Struct* Slabel = NULL, * label = m_Label;
|
SCH_SHEET_PIN* Slabel = NULL, * label = m_Label;
|
||||||
|
|
||||||
if( label )
|
if( label )
|
||||||
{
|
{
|
||||||
|
@ -180,7 +180,7 @@ DrawSheetStruct* DrawSheetStruct::GenCopy()
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************/
|
/**********************************************************/
|
||||||
void DrawSheetStruct::SwapData( DrawSheetStruct* copyitem )
|
void SCH_SHEET::SwapData( SCH_SHEET* copyitem )
|
||||||
{
|
{
|
||||||
/**********************************************************/
|
/**********************************************************/
|
||||||
/* Used if undo / redo command:
|
/* Used if undo / redo command:
|
||||||
|
@ -196,7 +196,7 @@ void DrawSheetStruct::SwapData( DrawSheetStruct* copyitem )
|
||||||
|
|
||||||
// Ensure sheet labels have their .m_Parent member poiuntin really on their
|
// Ensure sheet labels have their .m_Parent member poiuntin really on their
|
||||||
// parent, after swapping.
|
// parent, after swapping.
|
||||||
Hierarchical_PIN_Sheet_Struct* label = m_Label;
|
SCH_SHEET_PIN* label = m_Label;
|
||||||
while( label )
|
while( label )
|
||||||
{
|
{
|
||||||
label->SetParent( this );
|
label->SetParent( this );
|
||||||
|
@ -213,7 +213,7 @@ void DrawSheetStruct::SwapData( DrawSheetStruct* copyitem )
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
void DrawSheetStruct::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
|
void SCH_SHEET::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
|
||||||
{
|
{
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
/* Place list structures for new sheet. */
|
/* Place list structures for new sheet. */
|
||||||
|
@ -241,7 +241,7 @@ void DrawSheetStruct::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
void DrawSheetStruct::CleanupSheet( WinEDA_SchematicFrame* aFrame,
|
void SCH_SHEET::CleanupSheet( WinEDA_SchematicFrame* aFrame,
|
||||||
bool aRedraw )
|
bool aRedraw )
|
||||||
{
|
{
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
|
@ -250,7 +250,7 @@ void DrawSheetStruct::CleanupSheet( WinEDA_SchematicFrame* aFrame,
|
||||||
* @param aRedraw = true to redraw Sheet
|
* @param aRedraw = true to redraw Sheet
|
||||||
* @param aFrame = the schematic frame
|
* @param aFrame = the schematic frame
|
||||||
*/
|
*/
|
||||||
Hierarchical_PIN_Sheet_Struct* Pinsheet, * NextPinsheet;
|
SCH_SHEET_PIN* Pinsheet, * NextPinsheet;
|
||||||
|
|
||||||
if( !IsOK( aFrame, _( "Ok to cleanup this sheet" ) ) )
|
if( !IsOK( aFrame, _( "Ok to cleanup this sheet" ) ) )
|
||||||
return;
|
return;
|
||||||
|
@ -291,16 +291,15 @@ void DrawSheetStruct::CleanupSheet( WinEDA_SchematicFrame* aFrame,
|
||||||
/** Function GetPenSize
|
/** Function GetPenSize
|
||||||
* @return the size of the "pen" that be used to draw or plot this item
|
* @return the size of the "pen" that be used to draw or plot this item
|
||||||
*/
|
*/
|
||||||
int DrawSheetStruct::GetPenSize()
|
int SCH_SHEET::GetPenSize()
|
||||||
{
|
{
|
||||||
return g_DrawDefaultLineThickness;
|
return g_DrawDefaultLineThickness;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void DrawSheetStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
void SCH_SHEET::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
const wxPoint& aOffset,
|
const wxPoint& aOffset, int aDrawMode, int aColor )
|
||||||
int aDrawMode, int aColor )
|
|
||||||
{
|
{
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/** Function Draw
|
/** Function Draw
|
||||||
|
@ -312,7 +311,7 @@ void DrawSheetStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
* @param aColor = color used to draw sheet. Usually -1 to use the normal
|
* @param aColor = color used to draw sheet. Usually -1 to use the normal
|
||||||
* color for sheet items
|
* color for sheet items
|
||||||
*/
|
*/
|
||||||
Hierarchical_PIN_Sheet_Struct* SheetLabelStruct;
|
SCH_SHEET_PIN* SheetLabelStruct;
|
||||||
int txtcolor;
|
int txtcolor;
|
||||||
wxString Text;
|
wxString Text;
|
||||||
int color;
|
int color;
|
||||||
|
@ -366,7 +365,7 @@ void DrawSheetStruct::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
|
|
||||||
|
|
||||||
/*****************************************/
|
/*****************************************/
|
||||||
EDA_Rect DrawSheetStruct::GetBoundingBox()
|
EDA_Rect SCH_SHEET::GetBoundingBox()
|
||||||
{
|
{
|
||||||
/*****************************************/
|
/*****************************************/
|
||||||
/** Function GetBoundingBox
|
/** Function GetBoundingBox
|
||||||
|
@ -391,7 +390,7 @@ EDA_Rect DrawSheetStruct::GetBoundingBox()
|
||||||
|
|
||||||
|
|
||||||
/************************************************/
|
/************************************************/
|
||||||
bool DrawSheetStruct::HitTest( const wxPoint& aPosRef )
|
bool SCH_SHEET::HitTest( const wxPoint& aPosRef )
|
||||||
{
|
{
|
||||||
/************************************************/
|
/************************************************/
|
||||||
/** Function HitTest
|
/** Function HitTest
|
||||||
|
@ -405,7 +404,7 @@ bool DrawSheetStruct::HitTest( const wxPoint& aPosRef )
|
||||||
|
|
||||||
|
|
||||||
/************************************/
|
/************************************/
|
||||||
int DrawSheetStruct::ComponentCount()
|
int SCH_SHEET::ComponentCount()
|
||||||
{
|
{
|
||||||
/************************************/
|
/************************************/
|
||||||
/** Function ComponentCount
|
/** Function ComponentCount
|
||||||
|
@ -427,7 +426,7 @@ int DrawSheetStruct::ComponentCount()
|
||||||
}
|
}
|
||||||
if( bs->Type() == DRAW_SHEET_STRUCT_TYPE )
|
if( bs->Type() == DRAW_SHEET_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
DrawSheetStruct* sheet = (DrawSheetStruct*) bs;
|
SCH_SHEET* sheet = (SCH_SHEET*) bs;
|
||||||
n += sheet->ComponentCount();
|
n += sheet->ComponentCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -437,8 +436,7 @@ int DrawSheetStruct::ComponentCount()
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
bool DrawSheetStruct::SearchHierarchy( wxString aFilename,
|
bool SCH_SHEET::SearchHierarchy( wxString aFilename, SCH_SCREEN** aScreen )
|
||||||
SCH_SCREEN** aScreen )
|
|
||||||
{
|
{
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/** Function SearchHierarchy
|
/** Function SearchHierarchy
|
||||||
|
@ -454,7 +452,7 @@ bool DrawSheetStruct::SearchHierarchy( wxString aFilename,
|
||||||
{
|
{
|
||||||
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
|
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
DrawSheetStruct* ss = (DrawSheetStruct*) strct;
|
SCH_SHEET* ss = (SCH_SHEET*) strct;
|
||||||
if( ss->m_AssociatedScreen
|
if( ss->m_AssociatedScreen
|
||||||
&& ss->m_AssociatedScreen->m_FileName.CmpNoCase( aFilename ) == 0 )
|
&& ss->m_AssociatedScreen->m_FileName.CmpNoCase( aFilename ) == 0 )
|
||||||
{
|
{
|
||||||
|
@ -472,8 +470,7 @@ bool DrawSheetStruct::SearchHierarchy( wxString aFilename,
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************/
|
/*******************************************************************************/
|
||||||
bool DrawSheetStruct::LocatePathOfScreen( SCH_SCREEN* aScreen,
|
bool SCH_SHEET::LocatePathOfScreen( SCH_SCREEN* aScreen, DrawSheetPath* aList )
|
||||||
DrawSheetPath* aList )
|
|
||||||
{
|
{
|
||||||
/*******************************************************************************/
|
/*******************************************************************************/
|
||||||
/** Function LocatePathOfScreen
|
/** Function LocatePathOfScreen
|
||||||
|
@ -496,7 +493,7 @@ bool DrawSheetStruct::LocatePathOfScreen( SCH_SCREEN* aScreen,
|
||||||
{
|
{
|
||||||
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
|
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
DrawSheetStruct* ss = (DrawSheetStruct*) strct;
|
SCH_SHEET* ss = (SCH_SHEET*) strct;
|
||||||
if( ss->LocatePathOfScreen( aScreen, aList ) )
|
if( ss->LocatePathOfScreen( aScreen, aList ) )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -510,7 +507,7 @@ bool DrawSheetStruct::LocatePathOfScreen( SCH_SCREEN* aScreen,
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************/
|
/**********************************************************/
|
||||||
bool DrawSheetStruct::Load( WinEDA_SchematicFrame* aFrame )
|
bool SCH_SHEET::Load( WinEDA_SchematicFrame* aFrame )
|
||||||
{
|
{
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
/** Function Load.
|
/** Function Load.
|
||||||
|
@ -546,7 +543,7 @@ bool DrawSheetStruct::Load( WinEDA_SchematicFrame* aFrame )
|
||||||
{
|
{
|
||||||
if( bs->Type() == DRAW_SHEET_STRUCT_TYPE )
|
if( bs->Type() == DRAW_SHEET_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
DrawSheetStruct* sheetstruct = (DrawSheetStruct*) bs;
|
SCH_SHEET* sheetstruct = (SCH_SHEET*) bs;
|
||||||
if( !sheetstruct->Load( aFrame ) )
|
if( !sheetstruct->Load( aFrame ) )
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
@ -560,7 +557,7 @@ bool DrawSheetStruct::Load( WinEDA_SchematicFrame* aFrame )
|
||||||
|
|
||||||
|
|
||||||
/**********************************/
|
/**********************************/
|
||||||
int DrawSheetStruct::CountSheets()
|
int SCH_SHEET::CountSheets()
|
||||||
{
|
{
|
||||||
/**********************************/
|
/**********************************/
|
||||||
/** Function CountSheets
|
/** Function CountSheets
|
||||||
|
@ -577,7 +574,7 @@ int DrawSheetStruct::CountSheets()
|
||||||
{
|
{
|
||||||
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
|
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
DrawSheetStruct* subsheet = (DrawSheetStruct*) strct;
|
SCH_SHEET* subsheet = (SCH_SHEET*) strct;
|
||||||
count += subsheet->CountSheets();
|
count += subsheet->CountSheets();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -587,7 +584,7 @@ int DrawSheetStruct::CountSheets()
|
||||||
|
|
||||||
|
|
||||||
/******************************************/
|
/******************************************/
|
||||||
wxString DrawSheetStruct::GetFileName( void )
|
wxString SCH_SHEET::GetFileName( void )
|
||||||
{
|
{
|
||||||
/******************************************/
|
/******************************************/
|
||||||
return m_FileName;
|
return m_FileName;
|
||||||
|
@ -595,7 +592,7 @@ wxString DrawSheetStruct::GetFileName( void )
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
bool DrawSheetStruct::ChangeFileName( WinEDA_SchematicFrame* aFrame,
|
bool SCH_SHEET::ChangeFileName( WinEDA_SchematicFrame* aFrame,
|
||||||
const wxString& aFileName )
|
const wxString& aFileName )
|
||||||
{
|
{
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
@ -710,7 +707,7 @@ otherwise delete current sheet data)" );
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
void DrawSheetStruct::DisplayInfo( WinEDA_DrawFrame* frame )
|
void SCH_SHEET::DisplayInfo( WinEDA_DrawFrame* frame )
|
||||||
{
|
{
|
||||||
frame->ClearMsgPanel();
|
frame->ClearMsgPanel();
|
||||||
frame->AppendMsgPanel( _( "Sheet name" ), m_SheetName, CYAN );
|
frame->AppendMsgPanel( _( "Sheet name" ), m_SheetName, CYAN );
|
||||||
|
@ -722,7 +719,7 @@ void DrawSheetStruct::DisplayInfo( WinEDA_DrawFrame* frame )
|
||||||
* mirror item relative to an Y axis
|
* mirror item relative to an Y axis
|
||||||
* @param aYaxis_position = the y axis position
|
* @param aYaxis_position = the y axis position
|
||||||
*/
|
*/
|
||||||
void DrawSheetStruct::Mirror_Y( int aYaxis_position )
|
void SCH_SHEET::Mirror_Y( int aYaxis_position )
|
||||||
{
|
{
|
||||||
m_Pos.x -= aYaxis_position;
|
m_Pos.x -= aYaxis_position;
|
||||||
NEGATE( m_Pos.x );
|
NEGATE( m_Pos.x );
|
||||||
|
@ -730,7 +727,7 @@ void DrawSheetStruct::Mirror_Y( int aYaxis_position )
|
||||||
|
|
||||||
m_Pos.x -= m_Size.x;
|
m_Pos.x -= m_Size.x;
|
||||||
|
|
||||||
Hierarchical_PIN_Sheet_Struct* label = m_Label;
|
SCH_SHEET_PIN* label = m_Label;
|
||||||
while( label != NULL )
|
while( label != NULL )
|
||||||
{
|
{
|
||||||
label->Mirror_Y( aYaxis_position );
|
label->Mirror_Y( aYaxis_position );
|
||||||
|
@ -740,7 +737,7 @@ void DrawSheetStruct::Mirror_Y( int aYaxis_position )
|
||||||
|
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
void DrawSheetStruct::Show( int nestLevel, std::ostream& os )
|
void SCH_SHEET::Show( int nestLevel, std::ostream& os )
|
||||||
{
|
{
|
||||||
// XML output:
|
// XML output:
|
||||||
wxString s = GetClass();
|
wxString s = GetClass();
|
||||||
|
@ -750,7 +747,7 @@ void DrawSheetStruct::Show( int nestLevel, std::ostream& os )
|
||||||
<< '"' << ">\n";
|
<< '"' << ">\n";
|
||||||
|
|
||||||
// show all the pins, and check the linked list integrity
|
// show all the pins, and check the linked list integrity
|
||||||
Hierarchical_PIN_Sheet_Struct* label;
|
SCH_SHEET_PIN* label;
|
||||||
for( label = m_Label; label; label = label->Next() )
|
for( label = m_Label; label; label = label->Next() )
|
||||||
{
|
{
|
||||||
label->Show( nestLevel + 1, os );
|
label->Show( nestLevel + 1, os );
|
||||||
|
|
|
@ -7,17 +7,19 @@
|
||||||
|
|
||||||
#include "base_struct.h"
|
#include "base_struct.h"
|
||||||
|
|
||||||
extern DrawSheetStruct* g_RootSheet;
|
extern SCH_SHEET* g_RootSheet;
|
||||||
|
|
||||||
/* class Hierarchical_PIN_Sheet_Struct
|
/**
|
||||||
* a Hierarchical_PIN_Sheet_Struct is for a hierarchical sheet like a pin for
|
* Pin (label) used in sheets to create hierarchical schematics.
|
||||||
* a component
|
*
|
||||||
* At root level, a Hierarchical_PIN_Sheet_Struct must be connected to a wire,
|
* A SCH_SHEET_PIN is used to create a hierarchical sheet in the same way a
|
||||||
* bus or label
|
* pin is used in a component. It connects the ojects in the sheet object
|
||||||
* A sheet level it corresponds to a hierarchical label.
|
* to the objects in the schecmitic page to the objects in the page that is
|
||||||
|
* represented by the sheet. In a sheet object, a SCH_SHEET_PIN must be
|
||||||
|
* connected to a wire, bus, or label. In the schematic page represented by
|
||||||
|
* the sheet, it corresponds to a hierarchical label.
|
||||||
*/
|
*/
|
||||||
class Hierarchical_PIN_Sheet_Struct : public SCH_ITEM,
|
class SCH_SHEET_PIN : public SCH_ITEM, public EDA_TextStruct
|
||||||
public EDA_TextStruct
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int m_Edge, m_Shape;
|
int m_Edge, m_Shape;
|
||||||
|
@ -26,23 +28,23 @@ public:
|
||||||
// m_Number >= 2
|
// m_Number >= 2
|
||||||
// value 0 is for sheet name and 1 for sheet filename
|
// value 0 is for sheet name and 1 for sheet filename
|
||||||
|
|
||||||
public: Hierarchical_PIN_Sheet_Struct( DrawSheetStruct* parent,
|
public: SCH_SHEET_PIN( SCH_SHEET* parent,
|
||||||
const wxPoint& pos = wxPoint( 0, 0 ),
|
const wxPoint& pos = wxPoint( 0, 0 ),
|
||||||
const wxString& text = wxEmptyString );
|
const wxString& text = wxEmptyString );
|
||||||
|
|
||||||
~Hierarchical_PIN_Sheet_Struct() { }
|
~SCH_SHEET_PIN() { }
|
||||||
|
|
||||||
virtual wxString GetClass() const
|
virtual wxString GetClass() const
|
||||||
{
|
{
|
||||||
return wxT( "Hierarchical_PIN_Sheet_Struct" );
|
return wxT( "SCH_SHEET_PIN" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Hierarchical_PIN_Sheet_Struct* GenCopy();
|
SCH_SHEET_PIN* GenCopy();
|
||||||
|
|
||||||
Hierarchical_PIN_Sheet_Struct* Next()
|
SCH_SHEET_PIN* Next()
|
||||||
{
|
{
|
||||||
return ( Hierarchical_PIN_Sheet_Struct*) Pnext;
|
return ( SCH_SHEET_PIN*) Pnext;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Place( WinEDA_SchematicFrame* frame,
|
void Place( WinEDA_SchematicFrame* frame,
|
||||||
|
@ -108,12 +110,12 @@ public: Hierarchical_PIN_Sheet_Struct( DrawSheetStruct* parent,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* class DrawSheetStruct
|
/* class SCH_SHEET
|
||||||
* This class is the sheet symbol placed in a schematic, and is the entry point
|
* This class is the sheet symbol placed in a schematic, and is the entry point
|
||||||
* for a sub schematic
|
* for a sub schematic
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class DrawSheetStruct : public SCH_ITEM
|
class SCH_SHEET : public SCH_ITEM
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxString m_SheetName; /* this is equivalent to C101 for
|
wxString m_SheetName; /* this is equivalent to C101 for
|
||||||
|
@ -132,22 +134,23 @@ public:
|
||||||
wxPoint m_Pos;
|
wxPoint m_Pos;
|
||||||
wxSize m_Size; /* Position and Size of *sheet symbol */
|
wxSize m_Size; /* Position and Size of *sheet symbol */
|
||||||
int m_Layer;
|
int m_Layer;
|
||||||
Hierarchical_PIN_Sheet_Struct* m_Label; /* Points Be connection, linked
|
SCH_SHEET_PIN* m_Label; /* Points Be connection, linked
|
||||||
* list.*/
|
* list.*/
|
||||||
int m_NbLabel; /* Pins sheet (corresponding to
|
int m_NbLabel; /* Pins sheet (corresponding to
|
||||||
* hierarchical labels) count */
|
* hierarchical labels) count */
|
||||||
SCH_SCREEN* m_AssociatedScreen; /* Associated Screen which
|
SCH_SCREEN* m_AssociatedScreen; /* Associated Screen which
|
||||||
* handle the physical data
|
* handle the physical data
|
||||||
* In complex hierarchies we
|
* In complex hierarchies we
|
||||||
* can have many DrawSheetStruct
|
* can have many SCH_SHEET
|
||||||
* using the same data
|
* using the same data
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
|
public:
|
||||||
~DrawSheetStruct();
|
SCH_SHEET( const wxPoint& pos = wxPoint( 0, 0 ) );
|
||||||
|
~SCH_SHEET();
|
||||||
virtual wxString GetClass() const
|
virtual wxString GetClass() const
|
||||||
{
|
{
|
||||||
return wxT( "DrawSheetStruct" );
|
return wxT( "SCH_SHEET" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -158,23 +161,23 @@ public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
|
||||||
* @param aFile The FILE to write to.
|
* @param aFile The FILE to write to.
|
||||||
* @return bool - true if success writing else false.
|
* @return bool - true if success writing else false.
|
||||||
*/
|
*/
|
||||||
bool Save( FILE* aFile ) const;
|
bool Save( FILE* aFile ) const;
|
||||||
|
|
||||||
void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
|
void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
|
||||||
DrawSheetStruct* GenCopy();
|
SCH_SHEET* GenCopy();
|
||||||
void DisplayInfo( WinEDA_DrawFrame* frame );
|
void DisplayInfo( WinEDA_DrawFrame* frame );
|
||||||
|
|
||||||
/** Function CleanupSheet
|
/** Function CleanupSheet
|
||||||
* Delete pinsheets which are not corresponding to a hierarchical label
|
* Delete pinsheets which are not corresponding to a hierarchical label
|
||||||
* @param aRedraw = true to redraw Sheet
|
* @param aRedraw = true to redraw Sheet
|
||||||
* @param aFrame = the schematic frame
|
* @param aFrame = the schematic frame
|
||||||
*/
|
*/
|
||||||
void CleanupSheet( WinEDA_SchematicFrame* frame, bool aRedraw );
|
void CleanupSheet( WinEDA_SchematicFrame* frame, bool aRedraw );
|
||||||
|
|
||||||
/** Function GetPenSize
|
/** Function GetPenSize
|
||||||
* @return the size of the "pen" that be used to draw or plot this item
|
* @return the size of the "pen" that be used to draw or plot this item
|
||||||
*/
|
*/
|
||||||
virtual int GetPenSize();
|
virtual int GetPenSize();
|
||||||
|
|
||||||
/** Function Draw
|
/** Function Draw
|
||||||
* Draw the hierarchical sheet shape
|
* Draw the hierarchical sheet shape
|
||||||
|
@ -185,11 +188,11 @@ public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
|
||||||
* @param aColor = color used to draw sheet. Usually -1 to use the normal
|
* @param aColor = color used to draw sheet. Usually -1 to use the normal
|
||||||
* color for sheet items
|
* color for sheet items
|
||||||
*/
|
*/
|
||||||
void Draw( WinEDA_DrawPanel* aPanel,
|
void Draw( WinEDA_DrawPanel* aPanel,
|
||||||
wxDC* aDC,
|
wxDC* aDC,
|
||||||
const wxPoint& aOffset,
|
const wxPoint& aOffset,
|
||||||
int aDrawMode,
|
int aDrawMode,
|
||||||
int aColor = -1 );
|
int aColor = -1 );
|
||||||
|
|
||||||
/** Function HitTest
|
/** Function HitTest
|
||||||
* @return true if the point aPosRef is within item area
|
* @return true if the point aPosRef is within item area
|
||||||
|
@ -202,7 +205,7 @@ public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
|
||||||
*/
|
*/
|
||||||
EDA_Rect GetBoundingBox();
|
EDA_Rect GetBoundingBox();
|
||||||
|
|
||||||
void SwapData( DrawSheetStruct* copyitem );
|
void SwapData( SCH_SHEET* copyitem );
|
||||||
|
|
||||||
/** Function ComponentCount
|
/** Function ComponentCount
|
||||||
* count our own components, without the power components.
|
* count our own components, without the power components.
|
||||||
|
@ -277,7 +280,7 @@ public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
|
||||||
bool ChangeFileName( WinEDA_SchematicFrame* aFrame,
|
bool ChangeFileName( WinEDA_SchematicFrame* aFrame,
|
||||||
const wxString& aFileName );
|
const wxString& aFileName );
|
||||||
|
|
||||||
//void RemoveSheet(DrawSheetStruct* sheet);
|
//void RemoveSheet(SCH_SHEET* sheet);
|
||||||
//to remove a sheet, just delete it
|
//to remove a sheet, just delete it
|
||||||
//-- the destructor should take care of everything else.
|
//-- the destructor should take care of everything else.
|
||||||
|
|
||||||
|
@ -290,7 +293,7 @@ public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
|
||||||
virtual void Move( const wxPoint& aMoveVector )
|
virtual void Move( const wxPoint& aMoveVector )
|
||||||
{
|
{
|
||||||
m_Pos += aMoveVector;
|
m_Pos += aMoveVector;
|
||||||
Hierarchical_PIN_Sheet_Struct* label = m_Label;
|
SCH_SHEET_PIN* label = m_Label;
|
||||||
while( label != NULL )
|
while( label != NULL )
|
||||||
{
|
{
|
||||||
label->Move( aMoveVector );
|
label->Move( aMoveVector );
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Name: class_drawsheet.cpp
|
// Name: class_drawsheet.cpp
|
||||||
// Purpose: member functions for DrawSheetStruct
|
// Purpose: member functions for SCH_SHEET
|
||||||
// header = class_drawsheet.h
|
// header = class_drawsheet.h
|
||||||
// Author: jean-pierre Charras
|
// Author: jean-pierre Charras
|
||||||
// Modified by:
|
// Modified by:
|
||||||
|
@ -54,7 +54,7 @@ bool DrawSheetPath::BuildSheetPathInfoFromSheetPathValue(
|
||||||
{
|
{
|
||||||
if( schitem->Type() == DRAW_SHEET_STRUCT_TYPE )
|
if( schitem->Type() == DRAW_SHEET_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
DrawSheetStruct* sheet = (DrawSheetStruct*) schitem;
|
SCH_SHEET* sheet = (SCH_SHEET*) schitem;
|
||||||
Push( sheet );
|
Push( sheet );
|
||||||
if( aPath == Path() )
|
if( aPath == Path() )
|
||||||
return true;
|
return true;
|
||||||
|
@ -102,7 +102,7 @@ int DrawSheetPath::Cmp( const DrawSheetPath& aSheetPathToTest ) const
|
||||||
* returns a pointer to the last sheet of the list
|
* returns a pointer to the last sheet of the list
|
||||||
* One can see the others sheet as the "path" to reach this last sheet
|
* One can see the others sheet as the "path" to reach this last sheet
|
||||||
*/
|
*/
|
||||||
DrawSheetStruct* DrawSheetPath::Last()
|
SCH_SHEET* DrawSheetPath::Last()
|
||||||
{
|
{
|
||||||
if( m_numSheets )
|
if( m_numSheets )
|
||||||
return m_sheets[m_numSheets - 1];
|
return m_sheets[m_numSheets - 1];
|
||||||
|
@ -134,12 +134,12 @@ SCH_ITEM* DrawSheetPath::LastDrawList()
|
||||||
|
|
||||||
|
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
void DrawSheetPath::Push( DrawSheetStruct* aSheet )
|
void DrawSheetPath::Push( SCH_SHEET* aSheet )
|
||||||
{
|
{
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
/** Function Push
|
/** Function Push
|
||||||
* store (push) aSheet in list
|
* store (push) aSheet in list
|
||||||
* @param aSheet = pointer to the DrawSheetStruct to store in list
|
* @param aSheet = pointer to the SCH_SHEET to store in list
|
||||||
*/
|
*/
|
||||||
if( m_numSheets > DSLSZ )
|
if( m_numSheets > DSLSZ )
|
||||||
wxMessageBox( wxT( "DrawSheetPath::Push() error: no room in buffer \
|
wxMessageBox( wxT( "DrawSheetPath::Push() error: no room in buffer \
|
||||||
|
@ -153,11 +153,11 @@ to store sheet" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DrawSheetStruct* DrawSheetPath::Pop()
|
SCH_SHEET* DrawSheetPath::Pop()
|
||||||
{
|
{
|
||||||
/** Function Pop
|
/** Function Pop
|
||||||
* retrieves (pop) the last entered sheet and remove it from list
|
* retrieves (pop) the last entered sheet and remove it from list
|
||||||
* @return a DrawSheetStruct* pointer to the removed sheet in list
|
* @return a SCH_SHEET* pointer to the removed sheet in list
|
||||||
*/
|
*/
|
||||||
if( m_numSheets > 0 )
|
if( m_numSheets > 0 )
|
||||||
{
|
{
|
||||||
|
@ -287,7 +287,7 @@ bool DrawSheetPath::operator!=( const DrawSheetPath& d1 )
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************/
|
/*******************************************************/
|
||||||
EDA_SheetList::EDA_SheetList( DrawSheetStruct* aSheet )
|
EDA_SheetList::EDA_SheetList( SCH_SHEET* aSheet )
|
||||||
{
|
{
|
||||||
/*******************************************************/
|
/*******************************************************/
|
||||||
/* The constructor: build the list of sheets from aSheet.
|
/* The constructor: build the list of sheets from aSheet.
|
||||||
|
@ -347,7 +347,7 @@ DrawSheetPath* EDA_SheetList::GetSheet( int aIndex )
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
void EDA_SheetList::BuildSheetList( DrawSheetStruct* aSheet )
|
void EDA_SheetList::BuildSheetList( SCH_SHEET* aSheet )
|
||||||
{
|
{
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/** Function BuildSheetList
|
/** Function BuildSheetList
|
||||||
|
@ -375,7 +375,7 @@ void EDA_SheetList::BuildSheetList( DrawSheetStruct* aSheet )
|
||||||
{
|
{
|
||||||
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
|
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
DrawSheetStruct* sheet = (DrawSheetStruct*) strct;
|
SCH_SHEET* sheet = (SCH_SHEET*) strct;
|
||||||
BuildSheetList( sheet );
|
BuildSheetList( sheet );
|
||||||
}
|
}
|
||||||
strct = strct->Next();
|
strct = strct->Next();
|
||||||
|
|
|
@ -70,7 +70,7 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
#define DSLSZ 32 // Max number of levels for a sheet path
|
#define DSLSZ 32 // Max number of levels for a sheet path
|
||||||
DrawSheetStruct * m_sheets[DSLSZ];
|
SCH_SHEET * m_sheets[DSLSZ];
|
||||||
|
|
||||||
public: DrawSheetPath();
|
public: DrawSheetPath();
|
||||||
~DrawSheetPath() { };
|
~DrawSheetPath() { };
|
||||||
|
@ -97,7 +97,7 @@ public: DrawSheetPath();
|
||||||
* returns a pointer to the last sheet of the list
|
* returns a pointer to the last sheet of the list
|
||||||
* One can see the others sheet as the "path" to reach this last sheet
|
* One can see the others sheet as the "path" to reach this last sheet
|
||||||
*/
|
*/
|
||||||
DrawSheetStruct* Last();
|
SCH_SHEET* Last();
|
||||||
|
|
||||||
/** Function LastScreen
|
/** Function LastScreen
|
||||||
* @return the SCH_SCREEN relative to the last sheet in list
|
* @return the SCH_SCREEN relative to the last sheet in list
|
||||||
|
@ -112,19 +112,19 @@ public: DrawSheetPath();
|
||||||
|
|
||||||
/** Function Push
|
/** Function Push
|
||||||
* store (push) aSheet in list
|
* store (push) aSheet in list
|
||||||
* @param aSheet = pointer to the DrawSheetStruct to store in list
|
* @param aSheet = pointer to the SCH_SHEET to store in list
|
||||||
* Push is used when entered a sheet to select or analyze it
|
* Push is used when entered a sheet to select or analyze it
|
||||||
* This is like cd <directory> in directories navigation
|
* This is like cd <directory> in directories navigation
|
||||||
*/
|
*/
|
||||||
void Push( DrawSheetStruct* aSheet );
|
void Push( SCH_SHEET* aSheet );
|
||||||
|
|
||||||
/** Function Pop
|
/** Function Pop
|
||||||
* retrieves (pop) the last entered sheet and remove it from list
|
* retrieves (pop) the last entered sheet and remove it from list
|
||||||
* @return a DrawSheetStruct* pointer to the removed sheet in list
|
* @return a SCH_SHEET* pointer to the removed sheet in list
|
||||||
* Pop is used when leaving a sheet after a selection or analyze
|
* Pop is used when leaving a sheet after a selection or analyze
|
||||||
* This is like cd .. in directories navigation
|
* This is like cd .. in directories navigation
|
||||||
*/
|
*/
|
||||||
DrawSheetStruct* Pop();
|
SCH_SHEET* Pop();
|
||||||
|
|
||||||
/** Function Path
|
/** Function Path
|
||||||
* the path uses the time stamps which do not changes even when editing
|
* the path uses the time stamps which do not changes even when editing
|
||||||
|
@ -202,7 +202,7 @@ public:
|
||||||
* If aSheet == NULL (default) build the whole list of sheets in hierarchy
|
* If aSheet == NULL (default) build the whole list of sheets in hierarchy
|
||||||
* So usually call it with no param.
|
* So usually call it with no param.
|
||||||
*/
|
*/
|
||||||
EDA_SheetList( DrawSheetStruct* aSheet = NULL );
|
EDA_SheetList( SCH_SHEET* aSheet = NULL );
|
||||||
|
|
||||||
~EDA_SheetList()
|
~EDA_SheetList()
|
||||||
{
|
{
|
||||||
|
@ -243,7 +243,7 @@ private:
|
||||||
* if aSheet = g_RootSheet, the full sheet path and sheet list is built
|
* if aSheet = g_RootSheet, the full sheet path and sheet list is built
|
||||||
* @param aSheet = the starting sheet from the built is made
|
* @param aSheet = the starting sheet from the built is made
|
||||||
*/
|
*/
|
||||||
void BuildSheetList( DrawSheetStruct* sheet );
|
void BuildSheetList( SCH_SHEET* sheet );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* CLASS_DRAWSHEET_PATH_H */
|
#endif /* CLASS_DRAWSHEET_PATH_H */
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Name: class_hierarchical_PIN_sheet.cpp
|
// Name: class_hierarchical_PIN_sheet.cpp
|
||||||
// Purpose: member functions Hierarchical_PIN_Sheet_Struct
|
// Purpose: member functions SCH_SHEET_PIN
|
||||||
// header = class_drawsheet.h
|
// header = class_drawsheet.h
|
||||||
// Author: jean-pierre Charras
|
// Author: jean-pierre Charras
|
||||||
// Modified by:
|
// Modified by:
|
||||||
|
@ -23,10 +23,9 @@
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
Hierarchical_PIN_Sheet_Struct::Hierarchical_PIN_Sheet_Struct(
|
SCH_SHEET_PIN::SCH_SHEET_PIN( SCH_SHEET* parent,
|
||||||
DrawSheetStruct* parent,
|
const wxPoint& pos,
|
||||||
const wxPoint& pos,
|
const wxString& text ) :
|
||||||
const wxString& text ) :
|
|
||||||
SCH_ITEM( parent, DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ),
|
SCH_ITEM( parent, DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ),
|
||||||
EDA_TextStruct( text )
|
EDA_TextStruct( text )
|
||||||
{
|
{
|
||||||
|
@ -43,12 +42,11 @@ Hierarchical_PIN_Sheet_Struct::Hierarchical_PIN_Sheet_Struct(
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
Hierarchical_PIN_Sheet_Struct* Hierarchical_PIN_Sheet_Struct::GenCopy()
|
SCH_SHEET_PIN* SCH_SHEET_PIN::GenCopy()
|
||||||
{
|
{
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
Hierarchical_PIN_Sheet_Struct* newitem =
|
SCH_SHEET_PIN* newitem =
|
||||||
new Hierarchical_PIN_Sheet_Struct( (DrawSheetStruct*) m_Parent, m_Pos,
|
new SCH_SHEET_PIN( (SCH_SHEET*) m_Parent, m_Pos, m_Text );
|
||||||
m_Text );
|
|
||||||
|
|
||||||
newitem->m_Edge = m_Edge;
|
newitem->m_Edge = m_Edge;
|
||||||
newitem->m_Shape = m_Shape;
|
newitem->m_Shape = m_Shape;
|
||||||
|
@ -61,18 +59,18 @@ Hierarchical_PIN_Sheet_Struct* Hierarchical_PIN_Sheet_Struct::GenCopy()
|
||||||
/** Function GetPenSize
|
/** Function GetPenSize
|
||||||
* @return the size of the "pen" that be used to draw or plot this item
|
* @return the size of the "pen" that be used to draw or plot this item
|
||||||
*/
|
*/
|
||||||
int Hierarchical_PIN_Sheet_Struct::GetPenSize()
|
int SCH_SHEET_PIN::GetPenSize()
|
||||||
{
|
{
|
||||||
return g_DrawDefaultLineThickness;
|
return g_DrawDefaultLineThickness;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void Hierarchical_PIN_Sheet_Struct::Draw( WinEDA_DrawPanel* panel,
|
void SCH_SHEET_PIN::Draw( WinEDA_DrawPanel* panel,
|
||||||
wxDC* DC,
|
wxDC* DC,
|
||||||
const wxPoint& offset,
|
const wxPoint& offset,
|
||||||
int DrawMode,
|
int DrawMode,
|
||||||
int Color )
|
int Color )
|
||||||
{
|
{
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* Routine to create hierarchical labels */
|
/* Routine to create hierarchical labels */
|
||||||
|
@ -124,9 +122,8 @@ void Hierarchical_PIN_Sheet_Struct::Draw( WinEDA_DrawPanel* panel,
|
||||||
* @param aCorner_list = list to fill with polygon corners coordinates
|
* @param aCorner_list = list to fill with polygon corners coordinates
|
||||||
* @param Pos = Position of the shape
|
* @param Pos = Position of the shape
|
||||||
*/
|
*/
|
||||||
void Hierarchical_PIN_Sheet_Struct::CreateGraphicShape(
|
void SCH_SHEET_PIN::CreateGraphicShape( std::vector <wxPoint>& aCorner_list,
|
||||||
std::vector <wxPoint>& aCorner_list,
|
const wxPoint& Pos )
|
||||||
const wxPoint& Pos )
|
|
||||||
{
|
{
|
||||||
wxSize size = m_Size;
|
wxSize size = m_Size;
|
||||||
|
|
||||||
|
@ -184,7 +181,7 @@ void Hierarchical_PIN_Sheet_Struct::CreateGraphicShape(
|
||||||
* @param aFile The FILE to write to.
|
* @param aFile The FILE to write to.
|
||||||
* @return bool - true if success writing else false.
|
* @return bool - true if success writing else false.
|
||||||
*/
|
*/
|
||||||
bool Hierarchical_PIN_Sheet_Struct::Save( FILE* aFile ) const
|
bool SCH_SHEET_PIN::Save( FILE* aFile ) const
|
||||||
{
|
{
|
||||||
int type = 'U', side = 'L';
|
int type = 'U', side = 'L';
|
||||||
|
|
||||||
|
@ -223,7 +220,7 @@ bool Hierarchical_PIN_Sheet_Struct::Save( FILE* aFile ) const
|
||||||
|
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
void Hierarchical_PIN_Sheet_Struct::Show( int nestLevel, std::ostream& os )
|
void SCH_SHEET_PIN::Show( int nestLevel, std::ostream& os )
|
||||||
{
|
{
|
||||||
// XML output:
|
// XML output:
|
||||||
wxString s = GetClass();
|
wxString s = GetClass();
|
||||||
|
|
|
@ -100,8 +100,8 @@ NETLIST_OBJECT::NETLIST_OBJECT()
|
||||||
{
|
{
|
||||||
m_Type = NET_ITEM_UNSPECIFIED; /* Type of this item (see NetObjetType enum) */
|
m_Type = NET_ITEM_UNSPECIFIED; /* Type of this item (see NetObjetType enum) */
|
||||||
m_Comp = NULL; /* Pointer on the library item that created this net object (the parent)*/
|
m_Comp = NULL; /* Pointer on the library item that created this net object (the parent)*/
|
||||||
m_Link = NULL; /* For Hierarchical_PIN_Sheet_Struct:
|
m_Link = NULL; /* For SCH_SHEET_PIN:
|
||||||
* Pointer to the hierarchy sheet that contains this Hierarchical_PIN_Sheet_Struct
|
* Pointer to the hierarchy sheet that contains this SCH_SHEET_PIN
|
||||||
* For Pins: pointer to the component that contains this pin
|
* For Pins: pointer to the component that contains this pin
|
||||||
*/
|
*/
|
||||||
m_Flag = 0; /* flag used in calculations */
|
m_Flag = 0; /* flag used in calculations */
|
||||||
|
|
|
@ -41,8 +41,8 @@ class NETLIST_OBJECT
|
||||||
public:
|
public:
|
||||||
NetObjetType m_Type; /* Type of this item (see NetObjetType enum) */
|
NetObjetType m_Type; /* Type of this item (see NetObjetType enum) */
|
||||||
EDA_BaseStruct* m_Comp; /* Pointer on the library item that created this net object (the parent)*/
|
EDA_BaseStruct* m_Comp; /* Pointer on the library item that created this net object (the parent)*/
|
||||||
SCH_ITEM* m_Link; /* For Hierarchical_PIN_Sheet_Struct:
|
SCH_ITEM* m_Link; /* For SCH_SHEET_PIN:
|
||||||
* Pointer to the hierarchy sheet that contains this Hierarchical_PIN_Sheet_Struct
|
* Pointer to the hierarchy sheet that contains this SCH_SHEET_PIN
|
||||||
* For Pins: pointer to the component that contains this pin
|
* For Pins: pointer to the component that contains this pin
|
||||||
*/
|
*/
|
||||||
int m_Flag; /* flag used in calculations */
|
int m_Flag; /* flag used in calculations */
|
||||||
|
|
|
@ -251,7 +251,7 @@ void EDA_ScreenList::BuildScreenList( EDA_BaseStruct* s )
|
||||||
{
|
{
|
||||||
if( s && s->Type() == DRAW_SHEET_STRUCT_TYPE )
|
if( s && s->Type() == DRAW_SHEET_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
DrawSheetStruct* ds = (DrawSheetStruct*) s;
|
SCH_SHEET* ds = (SCH_SHEET*) s;
|
||||||
s = ds->m_AssociatedScreen;
|
s = ds->m_AssociatedScreen;
|
||||||
}
|
}
|
||||||
if( s && s->Type() == SCREEN_STRUCT_TYPE )
|
if( s && s->Type() == SCREEN_STRUCT_TYPE )
|
||||||
|
|
|
@ -204,7 +204,7 @@ SCH_ITEM* WinEDA_SchematicFrame::SchematicGeneralLocateAndDisplay(
|
||||||
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), SHEETITEM );
|
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), SHEETITEM );
|
||||||
if( DrawStruct )
|
if( DrawStruct )
|
||||||
{
|
{
|
||||||
( (DrawSheetStruct*) DrawStruct )->DisplayInfo( this );
|
( (SCH_SHEET*) DrawStruct )->DisplayInfo( this );
|
||||||
return DrawStruct;
|
return DrawStruct;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -419,8 +419,8 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
|
||||||
|
|
||||||
case DRAW_SHEET_STRUCT_TYPE:
|
case DRAW_SHEET_STRUCT_TYPE:
|
||||||
{
|
{
|
||||||
Hierarchical_PIN_Sheet_Struct* pinsheet;
|
SCH_SHEET_PIN* pinsheet;
|
||||||
for( pinsheet = ( (DrawSheetStruct*) DrawItem )->m_Label;
|
for( pinsheet = ( (SCH_SHEET*) DrawItem )->m_Label;
|
||||||
pinsheet;
|
pinsheet;
|
||||||
pinsheet = pinsheet->Next() )
|
pinsheet = pinsheet->Next() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -389,7 +389,7 @@ bool LocateAndDeleteItem( WinEDA_SchematicFrame* frame, wxDC* DC )
|
||||||
void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
|
void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
|
||||||
{
|
{
|
||||||
EDA_BaseStruct* DrawList;
|
EDA_BaseStruct* DrawList;
|
||||||
Hierarchical_PIN_Sheet_Struct* SheetLabel, * NextLabel;
|
SCH_SHEET_PIN* SheetLabel, * NextLabel;
|
||||||
|
|
||||||
if( DrawStruct == NULL )
|
if( DrawStruct == NULL )
|
||||||
return;
|
return;
|
||||||
|
@ -409,14 +409,14 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* See if our item is in this Sheet */
|
/* See if our item is in this Sheet */
|
||||||
SheetLabel = ( (DrawSheetStruct*) DrawList )->m_Label;
|
SheetLabel = ( (SCH_SHEET*) DrawList )->m_Label;
|
||||||
if( SheetLabel == NULL )
|
if( SheetLabel == NULL )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( SheetLabel == (Hierarchical_PIN_Sheet_Struct*) DrawStruct )
|
if( SheetLabel == (SCH_SHEET_PIN*) DrawStruct )
|
||||||
{
|
{
|
||||||
( (DrawSheetStruct*) DrawList )->m_Label =
|
( (SCH_SHEET*) DrawList )->m_Label =
|
||||||
(Hierarchical_PIN_Sheet_Struct*) SheetLabel->Next();
|
(SCH_SHEET_PIN*) SheetLabel->Next();
|
||||||
|
|
||||||
SAFE_DELETE( DrawStruct );
|
SAFE_DELETE( DrawStruct );
|
||||||
return;
|
return;
|
||||||
|
@ -425,10 +425,9 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
|
||||||
{
|
{
|
||||||
while( SheetLabel->Next() )
|
while( SheetLabel->Next() )
|
||||||
{
|
{
|
||||||
NextLabel =
|
NextLabel = (SCH_SHEET_PIN*) SheetLabel->Next();
|
||||||
(Hierarchical_PIN_Sheet_Struct*) SheetLabel->Next();
|
|
||||||
|
|
||||||
if( NextLabel == (Hierarchical_PIN_Sheet_Struct*) DrawStruct )
|
if( NextLabel == (SCH_SHEET_PIN*) DrawStruct )
|
||||||
{
|
{
|
||||||
SheetLabel->SetNext( (EDA_BaseStruct*) NextLabel->Next() );
|
SheetLabel->SetNext( (EDA_BaseStruct*) NextLabel->Next() );
|
||||||
SAFE_DELETE( DrawStruct );
|
SAFE_DELETE( DrawStruct );
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
void DeleteSubHierarchy( DrawSheetStruct* FirstSheet, bool confirm_deletion )
|
void DeleteSubHierarchy( SCH_SHEET* FirstSheet, bool confirm_deletion )
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
||||||
/* Free (delete) all schematic data (include the sub hierarchy sheets )
|
/* Free (delete) all schematic data (include the sub hierarchy sheets )
|
||||||
|
@ -59,7 +59,7 @@ void DeleteSubHierarchy( DrawSheetStruct* FirstSheet, bool confirm_deletion )
|
||||||
EEDrawList = EEDrawList->Next();
|
EEDrawList = EEDrawList->Next();
|
||||||
if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE )
|
if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
DeleteSubHierarchy( (DrawSheetStruct*) DrawStruct,
|
DeleteSubHierarchy( (SCH_SHEET*) DrawStruct,
|
||||||
confirm_deletion );
|
confirm_deletion );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,7 +273,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel,
|
||||||
|
|
||||||
case DRAW_SHEET_STRUCT_TYPE:
|
case DRAW_SHEET_STRUCT_TYPE:
|
||||||
{
|
{
|
||||||
DrawSheetStruct* Struct = (DrawSheetStruct*) aItem;
|
SCH_SHEET* Struct = (SCH_SHEET*) aItem;
|
||||||
GRRect( &aPanel->m_ClipBox,
|
GRRect( &aPanel->m_ClipBox,
|
||||||
aDC,
|
aDC,
|
||||||
Struct->m_Pos.x + aOffset.x,
|
Struct->m_Pos.x + aOffset.x,
|
||||||
|
|
|
@ -49,7 +49,7 @@ int g_DefaultTextLabelSize = DEFAULT_SIZE_TEXT;
|
||||||
|
|
||||||
HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr;
|
HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr;
|
||||||
|
|
||||||
DrawSheetStruct* g_RootSheet = NULL;
|
SCH_SHEET* g_RootSheet = NULL;
|
||||||
|
|
||||||
wxString g_NetCmpExtBuffer( wxT( "cmp" ) );
|
wxString g_NetCmpExtBuffer( wxT( "cmp" ) );
|
||||||
|
|
||||||
|
|
|
@ -198,17 +198,17 @@ int TestDuplicateSheetNames()
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// We have found a second sheet: compare names
|
// We have found a second sheet: compare names
|
||||||
if( ( (DrawSheetStruct*) ref_item )->m_SheetName.CmpNoCase(
|
if( ( (SCH_SHEET*) ref_item )->m_SheetName.CmpNoCase(
|
||||||
( ( DrawSheetStruct* ) item_to_test )-> m_SheetName )
|
( ( SCH_SHEET* ) item_to_test )-> m_SheetName )
|
||||||
== 0 )
|
== 0 )
|
||||||
{
|
{
|
||||||
/* Create a new marker type ERC error*/
|
/* Create a new marker type ERC error*/
|
||||||
MARKER_SCH* Marker = new MARKER_SCH();
|
MARKER_SCH* Marker = new MARKER_SCH();
|
||||||
Marker->m_TimeStamp = GetTimeStamp();
|
Marker->m_TimeStamp = GetTimeStamp();
|
||||||
Marker->SetData( ERCE_DUPLICATE_SHEET_NAME,
|
Marker->SetData( ERCE_DUPLICATE_SHEET_NAME,
|
||||||
( (DrawSheetStruct*) item_to_test )->m_Pos,
|
( (SCH_SHEET*) item_to_test )->m_Pos,
|
||||||
_( "Duplicate Sheet name" ),
|
_( "Duplicate Sheet name" ),
|
||||||
( (DrawSheetStruct*) item_to_test )->m_Pos );
|
( (SCH_SHEET*) item_to_test )->m_Pos );
|
||||||
Marker->SetMarkerType( MARK_ERC );
|
Marker->SetMarkerType( MARK_ERC );
|
||||||
Marker->SetErrorLevel( ERR );
|
Marker->SetErrorLevel( ERR );
|
||||||
Marker->SetNext( Screen->EEDrawList );
|
Marker->SetNext( Screen->EEDrawList );
|
||||||
|
|
|
@ -15,12 +15,10 @@
|
||||||
#include "class_library.h"
|
#include "class_library.h"
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************/
|
|
||||||
void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
|
|
||||||
/****************************************************************/
|
|
||||||
|
|
||||||
/* Commands to save project or the current page.
|
/* Commands to save project or the current page.
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
int id = event.GetId();
|
int id = event.GetId();
|
||||||
|
|
||||||
|
@ -45,7 +43,7 @@ void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Load an entire project
|
* Load an entire project
|
||||||
*
|
*
|
||||||
* Schematic root file and its subhierarchies, the configuration and the libs
|
* Schematic root file and its subhierarchies, the configuration and the libs
|
||||||
|
@ -60,7 +58,8 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
|
||||||
|
|
||||||
EDA_ScreenList ScreenList;
|
EDA_ScreenList ScreenList;
|
||||||
|
|
||||||
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
|
for( screen = ScreenList.GetFirst(); screen != NULL;
|
||||||
|
screen = ScreenList.GetNext() )
|
||||||
{
|
{
|
||||||
if( screen->IsModify() )
|
if( screen->IsModify() )
|
||||||
break;
|
break;
|
||||||
|
@ -68,7 +67,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
|
||||||
|
|
||||||
if( screen )
|
if( screen )
|
||||||
{
|
{
|
||||||
if( !IsOK( this, _( "Clear Schematic Hierarchy (modified!)?" ) ) )
|
if( !IsOK( this, _( "Clear schematic hierarchy?" ) ) )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if( g_RootSheet->m_AssociatedScreen->m_FileName != m_DefaultSchematicFileName )
|
if( g_RootSheet->m_AssociatedScreen->m_FileName != m_DefaultSchematicFileName )
|
||||||
SetLastProject( g_RootSheet->m_AssociatedScreen->m_FileName );
|
SetLastProject( g_RootSheet->m_AssociatedScreen->m_FileName );
|
||||||
|
@ -126,7 +125,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rechargement de la configuration:
|
// Reloading configuration.
|
||||||
msg = _( "Ready\nWorking dir: \n" ) + wxGetCwd();
|
msg = _( "Ready\nWorking dir: \n" ) + wxGetCwd();
|
||||||
PrintMsg( msg );
|
PrintMsg( msg );
|
||||||
|
|
||||||
|
@ -145,7 +144,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
|
||||||
/* Loading the project library cache
|
/* Loading the project library cache
|
||||||
* until apr 2009 the lib is named <root_name>.cache.lib
|
* until apr 2009 the lib is named <root_name>.cache.lib
|
||||||
* and after (due to code change): <root_name>-cache.lib
|
* and after (due to code change): <root_name>-cache.lib
|
||||||
* so if the <name>-cache.lib is not foun, the od way will be tried
|
* so if the <name>-cache.lib is not found, the old way will be tried
|
||||||
*/
|
*/
|
||||||
bool use_oldcachename = false;
|
bool use_oldcachename = false;
|
||||||
wxFileName fn = g_RootSheet->m_AssociatedScreen->m_FileName;
|
wxFileName fn = g_RootSheet->m_AssociatedScreen->m_FileName;
|
||||||
|
@ -208,11 +207,11 @@ Error: %s" ),
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//load the project.
|
// load the project.
|
||||||
SAFE_DELETE( g_RootSheet->m_AssociatedScreen );
|
SAFE_DELETE( g_RootSheet->m_AssociatedScreen );
|
||||||
bool diag = g_RootSheet->Load( this );
|
bool diag = g_RootSheet->Load( this );
|
||||||
|
|
||||||
/* Reaffichage ecran de base (ROOT) si necessaire */
|
/* Redraw base screen (ROOT) if necessary. */
|
||||||
ActiveScreen = GetScreen();
|
ActiveScreen = GetScreen();
|
||||||
ActiveScreen->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
|
ActiveScreen->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
|
||||||
Zoom_Automatique( FALSE );
|
Zoom_Automatique( FALSE );
|
||||||
|
@ -222,15 +221,13 @@ Error: %s" ),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************/
|
/* Create a new screen
|
||||||
SCH_SCREEN* WinEDA_SchematicFrame::CreateNewScreen(
|
*
|
||||||
SCH_SCREEN* OldScreen, int TimeStamp )
|
* This screen is chained with OldScreen. The timestamp value is assigned to
|
||||||
/**********************************************************/
|
* the parameter NewScreen-> TimeStamp
|
||||||
|
|
||||||
/* Routine de creation ( par allocation memoire ) d'un nouvel ecran
|
|
||||||
* cet ecran est en chainage arriere avec OldScreen
|
|
||||||
* la valeur TimeStamp est attribuee au parametre NewScreen->TimeStamp
|
|
||||||
*/
|
*/
|
||||||
|
SCH_SCREEN* WinEDA_SchematicFrame::CreateNewScreen( SCH_SCREEN* OldScreen,
|
||||||
|
int TimeStamp )
|
||||||
{
|
{
|
||||||
SCH_SCREEN* NewScreen;
|
SCH_SCREEN* NewScreen;
|
||||||
|
|
||||||
|
@ -247,13 +244,12 @@ SCH_SCREEN* WinEDA_SchematicFrame::CreateNewScreen(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************/
|
/**
|
||||||
void WinEDA_SchematicFrame::SaveProject()
|
* Save the entire project and create an archive for components.
|
||||||
/****************************************************/
|
*
|
||||||
|
* The library archive name is <root_name>.cache.lib
|
||||||
/* Saves the entire project and creates an archive for components
|
|
||||||
* the library archive name is <root_name>.cache.lib
|
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_SchematicFrame::SaveProject()
|
||||||
{
|
{
|
||||||
SCH_SCREEN* screen;
|
SCH_SCREEN* screen;
|
||||||
wxFileName fn;
|
wxFileName fn;
|
||||||
|
@ -266,7 +262,7 @@ void WinEDA_SchematicFrame::SaveProject()
|
||||||
SaveEEFile( screen, FILE_SAVE_AS );
|
SaveEEFile( screen, FILE_SAVE_AS );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Creation du fichier d'archivage composants en repertoire courant */
|
/* Archive components in current directory. */
|
||||||
fn = g_RootSheet->GetFileName();
|
fn = g_RootSheet->GetFileName();
|
||||||
wxString cachename = fn.GetName() + wxT("-cache");
|
wxString cachename = fn.GetName() + wxT("-cache");
|
||||||
fn.SetName( cachename );
|
fn.SetName( cachename );
|
||||||
|
@ -275,38 +271,13 @@ void WinEDA_SchematicFrame::SaveProject()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************/
|
/**
|
||||||
int CountCmpNumber()
|
* Return the number of components in the schematic.
|
||||||
/************************/
|
*
|
||||||
|
* Power components are not included.
|
||||||
|
*/
|
||||||
|
|
||||||
/* Routine retournant le nombre de composants dans le schema,
|
int CountCmpNumber()
|
||||||
* powers non comprises */
|
|
||||||
{
|
{
|
||||||
return g_RootSheet->ComponentCount();
|
return g_RootSheet->ComponentCount();
|
||||||
|
|
||||||
/*
|
|
||||||
* BASE_SCREEN* Window;
|
|
||||||
* EDA_BaseStruct* Phead;
|
|
||||||
* int Nb = 0;
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Window = ScreenSch;
|
|
||||||
* while( Window )
|
|
||||||
* {
|
|
||||||
* for( Phead = Window->EEDrawList; Phead != NULL; Phead = Phead->Pnext )
|
|
||||||
* {
|
|
||||||
* if( Phead->Type() == TYPE_SCH_COMPONENT )
|
|
||||||
* {
|
|
||||||
* DrawPartStruct* Cmp = (DrawPartStruct*) Phead;
|
|
||||||
* if( Cmp->m_Field[VALUE].m_Text.GetChar( 0 ) != '#' )
|
|
||||||
* Nb++;
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* Window = (BASE_SCREEN*) Window->Pnext;
|
|
||||||
* }
|
|
||||||
*
|
|
||||||
* return Nb;
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
/***************************************/
|
/***************/
|
||||||
/* GENERAL.H : declarations communes */
|
/* GENERAL.H */
|
||||||
/***************************************/
|
/***************/
|
||||||
|
|
||||||
#ifndef _GENERAL_H_
|
#ifndef _GENERAL_H_
|
||||||
#define _GENERAL_H_
|
#define _GENERAL_H_
|
||||||
|
|
||||||
|
|
||||||
/* Entete des fichiers schematique */
|
|
||||||
#define EESCHEMA_VERSION 2
|
#define EESCHEMA_VERSION 2
|
||||||
|
|
||||||
#define SCHEMATIC_HEAD_STRING "Schematic File Version"
|
#define SCHEMATIC_HEAD_STRING "Schematic File Version"
|
||||||
|
@ -15,12 +14,11 @@
|
||||||
|
|
||||||
#define MAX_PIN_INFO 10
|
#define MAX_PIN_INFO 10
|
||||||
|
|
||||||
#define TXTMARGE 10 /* Decalage (en 1/1000") des textes places
|
#define TXTMARGE 10 /* Offset in mils for placement of labels
|
||||||
* sur fils ( labels, num pins ) */
|
* and pin numbers. */
|
||||||
|
|
||||||
#define HIGHLIGHT_COLOR WHITE
|
#define HIGHLIGHT_COLOR WHITE
|
||||||
|
|
||||||
|
|
||||||
/* Used for EDA_BaseStruct, .m_Select member */
|
/* Used for EDA_BaseStruct, .m_Select member */
|
||||||
#define IS_SELECTED 1
|
#define IS_SELECTED 1
|
||||||
|
|
||||||
|
@ -32,10 +30,9 @@
|
||||||
|
|
||||||
#define DANGLING_SYMBOL_SIZE 12
|
#define DANGLING_SYMBOL_SIZE 12
|
||||||
|
|
||||||
/* Message de presentation */
|
|
||||||
extern wxString g_DefaultSchematicFileName;
|
extern wxString g_DefaultSchematicFileName;
|
||||||
|
|
||||||
/* Masque de recherche pour localisation d'objets a editer */
|
/* Search mask for locating objects in editor. */
|
||||||
#define LIBITEM 1
|
#define LIBITEM 1
|
||||||
#define WIREITEM 2
|
#define WIREITEM 2
|
||||||
#define BUSITEM 4
|
#define BUSITEM 4
|
||||||
|
@ -53,12 +50,13 @@ extern wxString g_DefaultSchematicFileName;
|
||||||
#define EXCLUDE_WIRE_BUS_ENDPOINTS 0x4000
|
#define EXCLUDE_WIRE_BUS_ENDPOINTS 0x4000
|
||||||
#define WIRE_BUS_ENDPOINTS_ONLY 0x8000
|
#define WIRE_BUS_ENDPOINTS_ONLY 0x8000
|
||||||
|
|
||||||
#define SEARCHALL LIBITEM | WIREITEM | BUSITEM | RACCORDITEM | JUNCTIONITEM \
|
#define SEARCHALL ( LIBITEM | WIREITEM | BUSITEM | RACCORDITEM | \
|
||||||
| DRAWITEM | TEXTITEM | LABELITEM | SHEETITEM | MARKERITEM \
|
JUNCTIONITEM | DRAWITEM | TEXTITEM | LABELITEM | \
|
||||||
| NOCONNECTITEM | SEARCH_PINITEM | SHEETLABELITEM
|
SHEETITEM | MARKERITEM | NOCONNECTITEM | \
|
||||||
|
SEARCH_PINITEM | SHEETLABELITEM )
|
||||||
|
|
||||||
/* Numero des couches de travail */
|
typedef enum
|
||||||
typedef enum {
|
{
|
||||||
LAYER_WIRE,
|
LAYER_WIRE,
|
||||||
LAYER_BUS,
|
LAYER_BUS,
|
||||||
LAYER_JUNCTION,
|
LAYER_JUNCTION,
|
||||||
|
@ -84,39 +82,44 @@ typedef enum {
|
||||||
LAYER_ERC_ERR,
|
LAYER_ERC_ERR,
|
||||||
LAYER_DEVICE_BACKGROUND,
|
LAYER_DEVICE_BACKGROUND,
|
||||||
|
|
||||||
MAX_LAYER /* Nombre de couches */
|
MAX_LAYER /* Maximum layers */
|
||||||
} LayerNumber;
|
} LayerNumber;
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
FILE_SAVE_AS,
|
FILE_SAVE_AS,
|
||||||
FILE_SAVE_NEW
|
FILE_SAVE_NEW
|
||||||
} FileSaveType;
|
} FileSaveType;
|
||||||
|
|
||||||
|
|
||||||
/* variables generales */
|
extern int g_OptNetListUseNames; /* TRUE to use names rather than
|
||||||
extern int g_OptNetListUseNames; /* TRUE pour utiliser les noms de net plutot que
|
* net numbers (PSPICE netlist
|
||||||
* les numeros (netlist PSPICE seulement) */
|
* only) */
|
||||||
extern SCH_ITEM* g_ItemToRepeat; /* pointeur sur la derniere structure
|
extern SCH_ITEM* g_ItemToRepeat; /* Pointer to the last structure used
|
||||||
* dessinee pouvant etre dupliquee par la commande
|
* by the repeat command. NULL if no
|
||||||
* Repeat ( NULL si aucune struct existe ) */
|
* item to repeat */
|
||||||
extern wxSize g_RepeatStep;
|
extern wxSize g_RepeatStep;
|
||||||
extern int g_RepeatDeltaLabel;
|
extern int g_RepeatDeltaLabel;
|
||||||
|
|
||||||
extern SCH_ITEM* g_ItemToUndoCopy; /* copy of last modified schematic item
|
extern SCH_ITEM* g_ItemToUndoCopy; /* copy of last modified schematic item
|
||||||
* before it is modified (used for undo managing to restore old values ) */
|
* before it is modified (used for undo
|
||||||
|
* managing to restore old values ) */
|
||||||
|
|
||||||
extern bool g_LastSearchIsMarker; // True if last seach is a marker serach
|
extern bool g_LastSearchIsMarker; /* True if last search is a marker
|
||||||
// False for a schematic item search
|
* search. False for a schematic
|
||||||
// Used for hotkey next search
|
* item search. Used for hotkey
|
||||||
|
* next search. */
|
||||||
|
|
||||||
/* Block operation (copy, paste) */
|
/* Block operation (copy, paste) */
|
||||||
extern BLOCK_SELECTOR g_BlockSaveDataList; // List of items to paste (Created by Block Save)
|
extern BLOCK_SELECTOR g_BlockSaveDataList; /* List of items to paste (Created
|
||||||
|
* by Block Save) */
|
||||||
|
|
||||||
// Gestion d'options
|
// Management options.
|
||||||
extern bool g_HVLines;
|
extern bool g_HVLines;
|
||||||
|
|
||||||
// Gestion de diverses variables, options... devant etre memorisees mais
|
// Management variables, option ... to be stored. Reset to 0 during a
|
||||||
// Remises a 0 lors d'un rechargement de projetc
|
// project reload.
|
||||||
struct EESchemaVariables
|
struct EESchemaVariables
|
||||||
{
|
{
|
||||||
int NbErrorErc;
|
int NbErrorErc;
|
||||||
|
@ -125,40 +128,19 @@ struct EESchemaVariables
|
||||||
|
|
||||||
extern struct EESchemaVariables g_EESchemaVar;
|
extern struct EESchemaVariables g_EESchemaVar;
|
||||||
|
|
||||||
|
|
||||||
/* Variables globales pour Schematic Edit */
|
|
||||||
extern int g_DefaultTextLabelSize;
|
extern int g_DefaultTextLabelSize;
|
||||||
|
|
||||||
|
|
||||||
/********************************************************/
|
|
||||||
/* Description des structures des parametres principaux */
|
|
||||||
/********************************************************/
|
|
||||||
|
|
||||||
/* Gestion des trace sur table tracante */
|
|
||||||
|
|
||||||
/* For HPGL plotting: Pen caract : */
|
|
||||||
struct HPGL_Pen_Descr_Struct
|
struct HPGL_Pen_Descr_Struct
|
||||||
{
|
{
|
||||||
int m_Pen_Num; /* num de plume a charger */
|
int m_Pen_Num; /* Pen number */
|
||||||
int m_Pen_Speed; /* vitesse en cm/s */
|
int m_Pen_Speed; /* Pen speed in cm/s */
|
||||||
int m_Pen_Diam; /* Pen diameter in mils */
|
int m_Pen_Diam; /* Pen diameter in mils */
|
||||||
};
|
};
|
||||||
extern HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr;
|
extern HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr;
|
||||||
|
|
||||||
/* First and main (root) screen */
|
/* First and main (root) screen */
|
||||||
extern DrawSheetStruct* g_RootSheet;
|
extern SCH_SHEET* g_RootSheet;
|
||||||
|
|
||||||
|
|
||||||
/*************************************/
|
|
||||||
/* Gestion de recherche des elements */
|
|
||||||
/*************************************/
|
|
||||||
|
|
||||||
/* valeur de flag indicant si le pointeur de reference pour une localisation
|
|
||||||
* est le curseur sur grille ou le curseur a deplacement fin hors grille */
|
|
||||||
#define CURSEUR_ON_GRILLE 0
|
|
||||||
#define CURSEUR_OFF_GRILLE 1
|
|
||||||
|
|
||||||
/* Gestion des librairies schematiques */
|
|
||||||
extern wxString g_NetCmpExtBuffer;
|
extern wxString g_NetCmpExtBuffer;
|
||||||
|
|
||||||
extern const wxString SymbolFileExtension;
|
extern const wxString SymbolFileExtension;
|
||||||
|
@ -167,23 +149,28 @@ extern const wxString SymbolFileWildcard;
|
||||||
extern const wxString CompLibFileExtension;
|
extern const wxString CompLibFileExtension;
|
||||||
extern const wxString CompLibFileWildcard;
|
extern const wxString CompLibFileWildcard;
|
||||||
|
|
||||||
extern wxString g_SimulatorCommandLine; // ligne de commande pour l'appel au simulateur (gnucap, spice..)
|
extern wxString g_SimulatorCommandLine;
|
||||||
extern wxString g_NetListerCommandLine; // ligne de commande pour l'appel au simulateur (gnucap, spice..)
|
extern wxString g_NetListerCommandLine;
|
||||||
|
|
||||||
extern LayerStruct g_LayerDescr; /* couleurs des couches */
|
extern LayerStruct g_LayerDescr;
|
||||||
|
|
||||||
extern bool g_EditPinByPinIsOn; /* true to do not synchronize pins edition
|
extern bool g_EditPinByPinIsOn; /* True to prevent displacing
|
||||||
* when they are at the same location */
|
* pins, when they are at the
|
||||||
|
* same position. */
|
||||||
|
|
||||||
extern int g_DrawDefaultLineThickness; /* Default line (in EESCHEMA units) thickness
|
extern int g_DrawDefaultLineThickness; /* Default line (in EESCHEMA
|
||||||
* used to draw/plot items having a default thickness line value (i.e. = 0 ).
|
* units) thickness used to
|
||||||
* 0 = single pixel line width
|
* draw/plot items having a
|
||||||
|
* default thickness line
|
||||||
|
* value (i.e. = 0 ).
|
||||||
|
* 0 = single pixel line width
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Color to draw selected items
|
// Color to draw selected items
|
||||||
extern int g_ItemSelectetColor;
|
extern int g_ItemSelectetColor;
|
||||||
|
|
||||||
// Color to draw items flagged invisible, in libedit (they are insisible in eeschema
|
// Color to draw items flagged invisible, in libedit (they are invisible in
|
||||||
|
// eeschema
|
||||||
extern int g_InvisibleItemColor;
|
extern int g_InvisibleItemColor;
|
||||||
|
|
||||||
#endif // _GENERAL_H_
|
#endif // _GENERAL_H_
|
||||||
|
|
|
@ -20,11 +20,9 @@
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
|
|
||||||
/* Routines Locales */
|
|
||||||
static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
||||||
static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC );
|
static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC );
|
||||||
|
|
||||||
/* Variables locales */
|
|
||||||
static int OldTransMat[2][2];
|
static int OldTransMat[2][2];
|
||||||
static wxPoint OldPos;
|
static wxPoint OldPos;
|
||||||
|
|
||||||
|
@ -200,7 +198,8 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
|
||||||
Component = new SCH_COMPONENT( *Entry, GetSheet(), unit, convert,
|
Component = new SCH_COMPONENT( *Entry, GetSheet(), unit, convert,
|
||||||
GetScreen()->m_Curseur, true );
|
GetScreen()->m_Curseur, true );
|
||||||
|
|
||||||
// Set the component value (that can differ from component name in lib, for aliases)
|
// Set the component value (that can differ from component name in lib,
|
||||||
|
// for aliases)
|
||||||
Component->GetField( VALUE )->m_Text = Name;
|
Component->GetField( VALUE )->m_Text = Name;
|
||||||
Component->DisplayInfo( this );
|
Component->DisplayInfo( this );
|
||||||
|
|
||||||
|
@ -210,10 +209,9 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************/
|
/**
|
||||||
/*** Routine de deplacement du composant. ***/
|
* Move a component.
|
||||||
/*** Appele par GeneralControle grace a ActiveScreen->ManageCurseur. ***/
|
*/
|
||||||
/**************************************************************************/
|
|
||||||
static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||||
{
|
{
|
||||||
wxPoint move_vector;
|
wxPoint move_vector;
|
||||||
|
@ -222,7 +220,6 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||||
|
|
||||||
SCH_COMPONENT* Component = (SCH_COMPONENT*) screen->GetCurItem();
|
SCH_COMPONENT* Component = (SCH_COMPONENT*) screen->GetCurItem();
|
||||||
|
|
||||||
/* Effacement du composant */
|
|
||||||
if( erase )
|
if( erase )
|
||||||
{
|
{
|
||||||
DrawStructsInGhost( panel, DC, Component, wxPoint(0,0) );
|
DrawStructsInGhost( panel, DC, Component, wxPoint(0,0) );
|
||||||
|
@ -236,8 +233,9 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Routine permettant les rotations et les miroirs d'un composant
|
* Routine to rotate and mirror a component.
|
||||||
* Si DC = NULL : pas de redessin
|
*
|
||||||
|
** If DC == NULL: no repaint
|
||||||
*/
|
*/
|
||||||
void WinEDA_SchematicFrame::CmpRotationMiroir( SCH_COMPONENT* DrawComponent,
|
void WinEDA_SchematicFrame::CmpRotationMiroir( SCH_COMPONENT* DrawComponent,
|
||||||
wxDC* DC, int type_rotate )
|
wxDC* DC, int type_rotate )
|
||||||
|
@ -245,7 +243,7 @@ void WinEDA_SchematicFrame::CmpRotationMiroir( SCH_COMPONENT* DrawComponent,
|
||||||
if( DrawComponent == NULL )
|
if( DrawComponent == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Efface le trace precedent */
|
/* Deletes the previous component. */
|
||||||
if( DC )
|
if( DC )
|
||||||
{
|
{
|
||||||
DrawPanel->CursorOff( DC );
|
DrawPanel->CursorOff( DC );
|
||||||
|
@ -259,7 +257,7 @@ void WinEDA_SchematicFrame::CmpRotationMiroir( SCH_COMPONENT* DrawComponent,
|
||||||
|
|
||||||
DrawComponent->SetRotationMiroir( type_rotate );
|
DrawComponent->SetRotationMiroir( type_rotate );
|
||||||
|
|
||||||
/* Redessine le composant dans la nouvelle position */
|
/* Redraw the component in the new position. */
|
||||||
if( DC )
|
if( DC )
|
||||||
{
|
{
|
||||||
if( DrawComponent->m_Flags )
|
if( DrawComponent->m_Flags )
|
||||||
|
@ -276,7 +274,7 @@ void WinEDA_SchematicFrame::CmpRotationMiroir( SCH_COMPONENT* DrawComponent,
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Routine de sortie de la fonction de placement de composant
|
* Abort a place component command in progress.
|
||||||
*/
|
*/
|
||||||
static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
|
static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||||
{
|
{
|
||||||
|
@ -284,12 +282,12 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||||
|
|
||||||
SCH_COMPONENT* Component = (SCH_COMPONENT*) screen->GetCurItem();
|
SCH_COMPONENT* Component = (SCH_COMPONENT*) screen->GetCurItem();
|
||||||
|
|
||||||
if( Component->m_Flags & IS_NEW ) /* Nouveau Placement en cours, on l'efface */
|
if( Component->m_Flags & IS_NEW )
|
||||||
{
|
{
|
||||||
Component->m_Flags = 0;
|
Component->m_Flags = 0;
|
||||||
SAFE_DELETE( Component );
|
SAFE_DELETE( Component );
|
||||||
}
|
}
|
||||||
else if( Component ) /* Deplacement ancien composant en cours */
|
else if( Component )
|
||||||
{
|
{
|
||||||
wxPoint move_vector = OldPos - Component->m_Pos;
|
wxPoint move_vector = OldPos - Component->m_Pos;
|
||||||
Component->Move( move_vector );
|
Component->Move( move_vector );
|
||||||
|
@ -305,7 +303,7 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Selection de l'unite dans les boitiers a multiples Parts
|
* Handle select part in multi-part component.
|
||||||
*/
|
*/
|
||||||
void WinEDA_SchematicFrame::SelPartUnit( SCH_COMPONENT* DrawComponent,
|
void WinEDA_SchematicFrame::SelPartUnit( SCH_COMPONENT* DrawComponent,
|
||||||
int unit, wxDC* DC )
|
int unit, wxDC* DC )
|
||||||
|
@ -333,17 +331,16 @@ void WinEDA_SchematicFrame::SelPartUnit( SCH_COMPONENT* DrawComponent,
|
||||||
if( unit > m_UnitCount )
|
if( unit > m_UnitCount )
|
||||||
unit = m_UnitCount;
|
unit = m_UnitCount;
|
||||||
|
|
||||||
/* Efface le trace precedent */
|
|
||||||
if( DrawComponent->m_Flags )
|
if( DrawComponent->m_Flags )
|
||||||
DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) );
|
DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) );
|
||||||
else
|
else
|
||||||
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
|
DrawComponent->Draw( DrawPanel, DC, wxPoint( 0, 0 ), g_XorMode );
|
||||||
|
|
||||||
/* Mise a jour du numero d'unite */
|
/* Update the unit number. */
|
||||||
DrawComponent->SetUnitSelection( GetSheet(), unit );
|
DrawComponent->SetUnitSelection( GetSheet(), unit );
|
||||||
DrawComponent->m_Multi = unit;
|
DrawComponent->m_Multi = unit;
|
||||||
|
|
||||||
/* Redessine le composant dans la nouvelle position */
|
/* Redraw the component in the new position. */
|
||||||
if( DrawComponent->m_Flags )
|
if( DrawComponent->m_Flags )
|
||||||
DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) );
|
DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) );
|
||||||
else
|
else
|
||||||
|
@ -374,7 +371,6 @@ void WinEDA_SchematicFrame::ConvertPart( SCH_COMPONENT* DrawComponent,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Efface le trace precedent */
|
|
||||||
if( DrawComponent->m_Flags )
|
if( DrawComponent->m_Flags )
|
||||||
DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) );
|
DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) );
|
||||||
else
|
else
|
||||||
|
@ -390,7 +386,7 @@ void WinEDA_SchematicFrame::ConvertPart( SCH_COMPONENT* DrawComponent,
|
||||||
if( DrawComponent->m_Convert > 2 )
|
if( DrawComponent->m_Convert > 2 )
|
||||||
DrawComponent->m_Convert = 1;
|
DrawComponent->m_Convert = 1;
|
||||||
|
|
||||||
/* Redessine le composant dans la nouvelle position */
|
/* Redraw the component in the new position. */
|
||||||
if( DrawComponent->m_Flags & IS_MOVED )
|
if( DrawComponent->m_Flags & IS_MOVED )
|
||||||
DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) );
|
DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) );
|
||||||
else
|
else
|
||||||
|
@ -432,9 +428,9 @@ void WinEDA_SchematicFrame::StartMovePart( SCH_COMPONENT* Component,
|
||||||
#if 1
|
#if 1
|
||||||
|
|
||||||
// switch from normal mode to xor mode for the duration of the move, first
|
// switch from normal mode to xor mode for the duration of the move, first
|
||||||
// by erasing fully any "normal drawing mode" primitives with the PostDirtyRect(),
|
// by erasing fully any "normal drawing mode" primitives with the
|
||||||
// then by drawing the first time in xor mode so that subsequent xor
|
// PostDirtyRect(), then by drawing the first time in xor mode so that
|
||||||
// drawing modes will fully erase this first copy.
|
// subsequent xor drawing modes will fully erase this first copy.
|
||||||
|
|
||||||
Component->m_Flags |= IS_MOVED; // omit redrawing the component, erase only
|
Component->m_Flags |= IS_MOVED; // omit redrawing the component, erase only
|
||||||
DrawPanel->PostDirtyRect( Component->GetBoundingBox() );
|
DrawPanel->PostDirtyRect( Component->GetBoundingBox() );
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/************************************************************************/
|
/******************/
|
||||||
/* hierarch.cpp: Gestion de la hierarchie: navigation dans les feuilles */
|
/* hierarch.cpp */
|
||||||
/************************************************************************/
|
/******************/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "gr_basic.h"
|
#include "gr_basic.h"
|
||||||
|
@ -18,15 +18,16 @@
|
||||||
|
|
||||||
static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame );
|
static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame );
|
||||||
|
|
||||||
enum {
|
enum
|
||||||
|
{
|
||||||
ID_TREECTRL_HIERARCHY = 1600
|
ID_TREECTRL_HIERARCHY = 1600
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class WinEDA_HierFrame;
|
class WinEDA_HierFrame;
|
||||||
|
|
||||||
/* This class derived from wxTreeItemData stores the DrawSheetPath of each sheet in hierarcy
|
/* This class derived from wxTreeItemData stores the DrawSheetPath of each
|
||||||
* in each TreeItem, in its associated data buffer
|
* sheet in hierarchy in each TreeItem, in its associated data buffer
|
||||||
*/
|
*/
|
||||||
class TreeItemData : public wxTreeItemData
|
class TreeItemData : public wxTreeItemData
|
||||||
{
|
{
|
||||||
|
@ -38,7 +39,7 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Classe de l'arbre de hierarchie */
|
/* Class to handle hierarchy tree. */
|
||||||
class WinEDA_Tree : public wxTreeCtrl
|
class WinEDA_Tree : public wxTreeCtrl
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
@ -71,7 +72,6 @@ WinEDA_Tree::WinEDA_Tree( WinEDA_HierFrame* parent ) :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Classe definissant la fenetre d'affichage de la hierarchie */
|
|
||||||
class WinEDA_HierFrame : public wxDialog
|
class WinEDA_HierFrame : public wxDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -81,7 +81,7 @@ public:
|
||||||
wxDC* m_DC;
|
wxDC* m_DC;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxSize m_TreeSize; // Taille de l'arbre de hierarchie
|
wxSize m_TreeSize;
|
||||||
int maxposx;
|
int maxposx;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -153,7 +153,7 @@ WinEDA_HierFrame::WinEDA_HierFrame( WinEDA_SchematicFrame* parent, wxDC* DC,
|
||||||
{
|
{
|
||||||
m_Tree->Expand( cellule );
|
m_Tree->Expand( cellule );
|
||||||
|
|
||||||
// Reajustage de la taille de la frame a une valeur optimale
|
// Readjust the size of the frame to an optimal value.
|
||||||
m_TreeSize.y += m_nbsheets * itemrect.GetHeight();
|
m_TreeSize.y += m_nbsheets * itemrect.GetHeight();
|
||||||
m_TreeSize.x = MIN( m_TreeSize.x, 250 );
|
m_TreeSize.x = MIN( m_TreeSize.x, 250 );
|
||||||
m_TreeSize.y = MIN( m_TreeSize.y, 350 );
|
m_TreeSize.y = MIN( m_TreeSize.y, 350 );
|
||||||
|
@ -176,15 +176,13 @@ void WinEDA_HierFrame::OnQuit( wxCommandEvent& WXUNUSED (event) )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************/
|
/* Routine to create the tree in the navigation hierarchy
|
||||||
void WinEDA_HierFrame::BuildSheetsTree( DrawSheetPath* list,
|
* Schematic
|
||||||
wxTreeItemId* previousmenu )
|
* This routine is re-entrant!
|
||||||
/********************************************************************/
|
|
||||||
|
|
||||||
/* Routine de creation de l'arbre de navigation dans la hierarchy
|
|
||||||
* schematique
|
|
||||||
* Cette routine est Reentrante !
|
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_HierFrame::BuildSheetsTree( DrawSheetPath* list,
|
||||||
|
wxTreeItemId* previousmenu )
|
||||||
|
|
||||||
{
|
{
|
||||||
wxTreeItemId menu;
|
wxTreeItemId menu;
|
||||||
|
|
||||||
|
@ -206,7 +204,7 @@ void WinEDA_HierFrame::BuildSheetsTree( DrawSheetPath* list,
|
||||||
{
|
{
|
||||||
if( schitem->Type() == DRAW_SHEET_STRUCT_TYPE )
|
if( schitem->Type() == DRAW_SHEET_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
DrawSheetStruct* sheet = (DrawSheetStruct*) schitem;
|
SCH_SHEET* sheet = (SCH_SHEET*) schitem;
|
||||||
m_nbsheets++;
|
m_nbsheets++;
|
||||||
menu = m_Tree->AppendItem( *previousmenu, sheet->m_SheetName, 0, 1 );
|
menu = m_Tree->AppendItem( *previousmenu, sheet->m_SheetName, 0, 1 );
|
||||||
list->Push( sheet );
|
list->Push( sheet );
|
||||||
|
@ -236,13 +234,11 @@ void WinEDA_HierFrame::BuildSheetsTree( DrawSheetPath* list,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************/
|
|
||||||
void WinEDA_HierFrame::OnSelect( wxTreeEvent& event )
|
|
||||||
/***************************************************/
|
|
||||||
|
|
||||||
/* Called on a double-click on a tree item:
|
/* Called on a double-click on a tree item:
|
||||||
* Open the selected sheet, and display the corresponding screen
|
* Open the selected sheet, and display the corresponding screen
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_HierFrame::OnSelect( wxTreeEvent& event )
|
||||||
|
|
||||||
{
|
{
|
||||||
wxTreeItemId ItemSel = m_Tree->GetSelection();
|
wxTreeItemId ItemSel = m_Tree->GetSelection();
|
||||||
|
|
||||||
|
@ -253,12 +249,10 @@ void WinEDA_HierFrame::OnSelect( wxTreeEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************/
|
/* Set the current screen to display the parent sheet of the current
|
||||||
void WinEDA_SchematicFrame::InstallPreviousSheet()
|
* displayed sheet
|
||||||
/******************************************************/
|
|
||||||
|
|
||||||
/* Set the current screen to display the parent sheet of the current displayed sheet
|
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_SchematicFrame::InstallPreviousSheet()
|
||||||
{
|
{
|
||||||
if( m_CurrentSheet->Last() == g_RootSheet )
|
if( m_CurrentSheet->Last() == g_RootSheet )
|
||||||
return;
|
return;
|
||||||
|
@ -279,16 +273,13 @@ void WinEDA_SchematicFrame::InstallPreviousSheet()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
/* Routine installation of the screen corresponding to the symbol edge Sheet
|
||||||
void WinEDA_SchematicFrame::InstallNextScreen( DrawSheetStruct* Sheet )
|
* Be careful here because the SCH_SHEETs within the EEDrawList
|
||||||
/*********************************************************************/
|
* don't actually have a valid m_AssociatedScreen (on purpose -- you need the
|
||||||
|
* m_SubSheet hierarchy to maintain path info (well, this is but one way to
|
||||||
/* Routine d'installation de l'ecran correspondant au symbole Sheet pointe
|
* maintain path info..)
|
||||||
* par la souris
|
|
||||||
* have to be careful here because the DrawSheetStructs within the EEDrawList
|
|
||||||
* don't actually have a valid m_AssociatedScreen (on purpose -- you need the m_SubSheet hierarchy
|
|
||||||
* to maintain path info (well, this is but one way to maintain path info..)
|
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_SchematicFrame::InstallNextScreen( SCH_SHEET* Sheet )
|
||||||
{
|
{
|
||||||
if( Sheet == NULL )
|
if( Sheet == NULL )
|
||||||
{
|
{
|
||||||
|
@ -301,14 +292,10 @@ void WinEDA_SchematicFrame::InstallNextScreen( DrawSheetStruct* Sheet )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************/
|
/* Find and install the screen on the sheet symbol Sheet.
|
||||||
static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame )
|
* If Sheet == NULL installation of the screen base (Root).
|
||||||
/**************************************************************/
|
|
||||||
|
|
||||||
/* Recherche et installe de l'ecran relatif au sheet symbole Sheet.
|
|
||||||
* Si Sheet == NULL installation de l'ecran de base ( Root ).
|
|
||||||
*/
|
*/
|
||||||
|
static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame )
|
||||||
{
|
{
|
||||||
SCH_SCREEN* NewScreen;
|
SCH_SCREEN* NewScreen;
|
||||||
|
|
||||||
|
@ -319,8 +306,8 @@ static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reinit des parametres d'affichage du nouvel ecran
|
// Reset display settings of the new screen
|
||||||
// assumes m_CurrentSheet has already been updated.
|
// Assumes m_CurrentSheet has already been updated.
|
||||||
frame->ClearMsgPanel();
|
frame->ClearMsgPanel();
|
||||||
frame->DrawPanel->SetScrollbars( NewScreen->m_ZoomScalar,
|
frame->DrawPanel->SetScrollbars( NewScreen->m_ZoomScalar,
|
||||||
NewScreen->m_ZoomScalar,
|
NewScreen->m_ZoomScalar,
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
/* EESchema - lib_export.cpp */
|
/* EESchema - lib_export.cpp */
|
||||||
/*****************************/
|
/*****************************/
|
||||||
|
|
||||||
/* Routines de maintenanace des librariries:
|
/* Library maintenance routines.
|
||||||
* sauvegarde, modification de librairies.
|
* Backup modified libraries.
|
||||||
* creation edition suppression de composants
|
* Create, edit, and delete components.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
|
@ -27,13 +27,11 @@
|
||||||
extern int ExportPartId;
|
extern int ExportPartId;
|
||||||
|
|
||||||
|
|
||||||
/*************************************************/
|
/* Routine to read one part.
|
||||||
/* Routine de lecture de 1 description.
|
* The format is that of libraries, but it loads only 1 component.
|
||||||
* Le format est celui des librairies, mais on ne charge que 1 composant
|
* Or 1 component if there are several.
|
||||||
* ou le 1er composant s'il y en a plusieurs.
|
* If the first component is an alias, it will load the corresponding root.
|
||||||
* Si le premier composant est un alias, on chargera la racine correspondante
|
|
||||||
*/
|
*/
|
||||||
/*************************************************/
|
|
||||||
void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event )
|
void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxString errMsg;
|
wxString errMsg;
|
||||||
|
@ -82,12 +80,12 @@ void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Routine de creation d'une nouvelle librairie et de sauvegarde du
|
/* Routine to create a new library and backup the current component in
|
||||||
* composant courant dans cette librarie
|
* this library.
|
||||||
* si create_lib == TRUE sauvegarde dans le repertoire des libr
|
* Create_lib == TRUE if the backup directory of library.
|
||||||
* sinon: sauvegarde sous le nom demande sans modifications.
|
* If not: backup as the request without modifications.
|
||||||
*
|
*
|
||||||
* Le format du fichier cree est dans tous les cas le meme.
|
* The file format is created in all cases the same.
|
||||||
*/
|
*/
|
||||||
void WinEDA_LibeditFrame::OnExportPart( wxCommandEvent& event )
|
void WinEDA_LibeditFrame::OnExportPart( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/**************************************************************/
|
/*****************************************************/
|
||||||
/* libarch.cc */
|
/* libarch.cpp */
|
||||||
/* Module de generation du fichier d'archivage des composants */
|
/* Module for generation of component archive files. */
|
||||||
/**************************************************************/
|
/*****************************************************/
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "confirm.h"
|
#include "confirm.h"
|
||||||
|
@ -29,7 +29,7 @@ bool LibArchive( wxWindow* frame, const wxString& ArchFullFileName )
|
||||||
libCache = new CMP_LIBRARY( LIBRARY_TYPE_EESCHEMA, ArchFullFileName );
|
libCache = new CMP_LIBRARY( LIBRARY_TYPE_EESCHEMA, ArchFullFileName );
|
||||||
libCache->SetCache();
|
libCache->SetCache();
|
||||||
|
|
||||||
/* examine all screens (not scheets) used and build the list of components
|
/* examine all screens (not sheets) used and build the list of components
|
||||||
* found in lib complex hierarchies are not a problem because we just want
|
* found in lib complex hierarchies are not a problem because we just want
|
||||||
* to know used components in libraries
|
* to know used components in libraries
|
||||||
*/
|
*/
|
||||||
|
@ -52,7 +52,7 @@ bool LibArchive( wxWindow* frame, const wxString& ArchFullFileName )
|
||||||
|
|
||||||
if( !libCache->Save( ArchFullFileName ) )
|
if( !libCache->Save( ArchFullFileName ) )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "An error occurrred attempting to save component \
|
msg.Printf( _( "An error occurred attempting to save component \
|
||||||
library <%s>." ), GetChars( ArchFullFileName ) );
|
library <%s>." ), GetChars( ArchFullFileName ) );
|
||||||
DisplayError( frame, msg );
|
DisplayError( frame, msg );
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -2,11 +2,6 @@
|
||||||
/* EESchema - libedit.cpp */
|
/* EESchema - libedit.cpp */
|
||||||
/****************************/
|
/****************************/
|
||||||
|
|
||||||
/* Routines de maintenanace des librairies:
|
|
||||||
* sauvegarde, modification de librairies.
|
|
||||||
* creation edition suppression de composants
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "gr_basic.h"
|
#include "gr_basic.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
@ -118,11 +113,11 @@ library \"%s\"." ),
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Routine Pour Charger en memoire la copie de 1 libpart.
|
* Routine to load into memory a copy of 1 library part.
|
||||||
* retourne
|
* Returns
|
||||||
* 0 si OK
|
* 0 if OK
|
||||||
* 1 si err
|
* 1 if error
|
||||||
* m_component pointe la copie ainsi creee
|
* m_component advanced copy and created
|
||||||
*/
|
*/
|
||||||
bool WinEDA_LibeditFrame::LoadOneLibraryPartAux( CMP_LIB_ENTRY* LibEntry,
|
bool WinEDA_LibeditFrame::LoadOneLibraryPartAux( CMP_LIB_ENTRY* LibEntry,
|
||||||
CMP_LIBRARY* Library )
|
CMP_LIBRARY* Library )
|
||||||
|
@ -208,7 +203,7 @@ void WinEDA_LibeditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
||||||
DC->SetBackgroundMode( wxTRANSPARENT );
|
DC->SetBackgroundMode( wxTRANSPARENT );
|
||||||
GRResetPenAndBrush( DC );
|
GRResetPenAndBrush( DC );
|
||||||
|
|
||||||
DrawPanel->CursorOff( DC ); // erase cursor
|
DrawPanel->CursorOff( DC );
|
||||||
if( DrawPanel->ManageCurseur )
|
if( DrawPanel->ManageCurseur )
|
||||||
{
|
{
|
||||||
DrawPanel->ManageCurseur( DrawPanel, DC, false );
|
DrawPanel->ManageCurseur( DrawPanel, DC, false );
|
||||||
|
@ -289,8 +284,9 @@ void WinEDA_LibeditFrame::SaveActiveLibrary( wxCommandEvent& event )
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affiche la documentation du composant selectionne
|
* Display the documentation of the selected component.
|
||||||
* Utilisïe lors de l'affichage de la liste des composants en librairie
|
*
|
||||||
|
* Used when displaying the list of library components.
|
||||||
*/
|
*/
|
||||||
void WinEDA_LibeditFrame::DisplayCmpDoc()
|
void WinEDA_LibeditFrame::DisplayCmpDoc()
|
||||||
{
|
{
|
||||||
|
@ -354,16 +350,18 @@ void WinEDA_LibeditFrame::DisplayCmpDoc()
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Routine de suppression d'un composant dans la librairie courante
|
* Delete component in the current library.
|
||||||
* (effacement en memoire uniquement, le fichier n'est pas modifie)
|
*
|
||||||
* Le composant peut etre un alias, ou la definition de base.
|
* (Delete only in memory, the file does not change)
|
||||||
* Si c'est un alias:
|
*
|
||||||
* il est supprime, et la liste des alias de la definition
|
* The entry can be an alias or a component.
|
||||||
* de base est modifiee
|
* If an alias:
|
||||||
* Si c'est le composant de base:
|
* It is removed, and the list of alias is updated.
|
||||||
* Si la liste des alias est nulle, il est supprime
|
*
|
||||||
* Sinon le premier alias devient le composant de base, et les autres
|
* If a component:
|
||||||
* alias deviennent dependants de celui ci.
|
* If the list of aliases is zero, it deletes the component
|
||||||
|
* Otherwise the alias becomes the new component name, and the other
|
||||||
|
* aliases become dependent on newly named component.
|
||||||
*/
|
*/
|
||||||
void WinEDA_LibeditFrame::DeleteOnePart( wxCommandEvent& event )
|
void WinEDA_LibeditFrame::DeleteOnePart( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
|
@ -515,7 +513,7 @@ lost!\n\nClear the current component from the screen?" ) ) )
|
||||||
name = dlg.GetName().MakeUpper();
|
name = dlg.GetName().MakeUpper();
|
||||||
name.Replace( wxT( " " ), wxT( "_" ) );
|
name.Replace( wxT( " " ), wxT( "_" ) );
|
||||||
|
|
||||||
/* Test: y a t-il un composant deja de ce nom */
|
/* Test if there a component with this name already. */
|
||||||
if( m_library && m_library->FindEntry( name ) )
|
if( m_library && m_library->FindEntry( name ) )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
@ -570,11 +568,11 @@ lost!\n\nClear the current component from the screen?" ) ) )
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Routine de sauvegarde de la "partlib" courante dans la librairie courante
|
* Routine backup of "partlib" current in the current library.
|
||||||
*
|
*
|
||||||
* Sauvegarde en memoire uniquement, et PAS sur fichier
|
* Save in memory only and NOT on file.
|
||||||
* La routine efface l'ancien composant ( ou / et les alias ) a remplacer
|
* The routine deletes the old component (and / or aliases) to replace
|
||||||
* s'il existe, et sauve le nouveau et cree les alias correspondants.
|
* If any, and saves the new and creates the corresponding alias.
|
||||||
*/
|
*/
|
||||||
void WinEDA_LibeditFrame::SaveOnePartInMemory()
|
void WinEDA_LibeditFrame::SaveOnePartInMemory()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*********************************************************************/
|
/*****************************************************/
|
||||||
/* EESchema - edition des librairies: Edition des champs ( Fields ) */
|
/* Component library edit field manipulation code. */
|
||||||
/*********************************************************************/
|
/*****************************************************/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "gr_basic.h"
|
#include "gr_basic.h"
|
||||||
|
@ -15,11 +15,9 @@
|
||||||
#include "class_library.h"
|
#include "class_library.h"
|
||||||
|
|
||||||
|
|
||||||
/* Routines locales */
|
|
||||||
static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
||||||
|
|
||||||
|
|
||||||
/* Variables locales */
|
|
||||||
extern int m_unit;
|
extern int m_unit;
|
||||||
static wxPoint StartCursor, LastTextPosition;
|
static wxPoint StartCursor, LastTextPosition;
|
||||||
|
|
||||||
|
@ -49,9 +47,6 @@ static void ExitMoveField( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Initialise le deplacement d'un champ ( ref ou Name )
|
|
||||||
*/
|
|
||||||
void WinEDA_LibeditFrame::StartMoveField( wxDC* DC, LIB_FIELD* field )
|
void WinEDA_LibeditFrame::StartMoveField( wxDC* DC, LIB_FIELD* field )
|
||||||
{
|
{
|
||||||
wxPoint startPos;
|
wxPoint startPos;
|
||||||
|
@ -78,10 +73,10 @@ void WinEDA_LibeditFrame::StartMoveField( wxDC* DC, LIB_FIELD* field )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
/*
|
||||||
/* Routine d'affichage du texte 'Field' en cours de deplacement. */
|
* Routine to display text 'Field' on the move.
|
||||||
/* Routine normalement attachee au curseur */
|
* Normally called by cursor management code.
|
||||||
/*****************************************************************/
|
*/
|
||||||
static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||||
{
|
{
|
||||||
WinEDA_LibeditFrame* parent = (WinEDA_LibeditFrame*) panel->GetParent();
|
WinEDA_LibeditFrame* parent = (WinEDA_LibeditFrame*) panel->GetParent();
|
||||||
|
@ -228,9 +223,10 @@ not conflict with any library entries." ),
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Routine de modification de l'orientation ( Horiz ou Vert. ) du champ.
|
* Rotate a field horizontally or vertically.
|
||||||
* si un champ est en cours d'edition, modif de celui ci.
|
*
|
||||||
* sinon Modif du champ pointe par la souris
|
* If a field is being edited, rotate.
|
||||||
|
* Otherwise rotate the field at the current cursor position.
|
||||||
*/
|
*/
|
||||||
void WinEDA_LibeditFrame::RotateField( wxDC* DC, LIB_FIELD* Field )
|
void WinEDA_LibeditFrame::RotateField( wxDC* DC, LIB_FIELD* Field )
|
||||||
{
|
{
|
||||||
|
|
|
@ -148,30 +148,30 @@ BEGIN_EVENT_TABLE( WinEDA_LibeditFrame, WinEDA_DrawFrame )
|
||||||
|
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
|
||||||
WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
|
|
||||||
const wxString& title,
|
const wxString& title,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
long style ) :
|
long style ) :
|
||||||
WinEDA_DrawFrame( father, LIBEDITOR_FRAME, title, pos, size, style )
|
WinEDA_DrawFrame( father, LIBEDITOR_FRAME, title, pos, size, style )
|
||||||
{
|
{
|
||||||
m_FrameName = wxT( "LibeditFrame" );
|
m_FrameName = wxT( "LibeditFrame" );
|
||||||
m_Draw_Axis = true; // true to draw axis
|
m_Draw_Axis = true; // true to draw axis
|
||||||
m_Draw_Grid = true; // true to draw grid
|
m_Draw_Grid = true; // true to draw grid
|
||||||
m_ConfigPath = wxT( "LibraryEditor" );
|
m_ConfigPath = wxT( "LibraryEditor" );
|
||||||
SetShowDeMorgan( false );
|
SetShowDeMorgan( false );
|
||||||
m_drawSpecificConvert = true;
|
m_drawSpecificConvert = true;
|
||||||
m_drawSpecificUnit = false;
|
m_drawSpecificUnit = false;
|
||||||
|
|
||||||
// Give an icon
|
// Give an icon
|
||||||
SetIcon( wxIcon( libedit_xpm ) );
|
SetIcon( wxIcon( libedit_xpm ) );
|
||||||
SetBaseScreen( new SCH_SCREEN() );
|
SetBaseScreen( new SCH_SCREEN() );
|
||||||
GetScreen()->m_Center = true;
|
GetScreen()->m_Center = true;
|
||||||
LoadSettings();
|
LoadSettings();
|
||||||
|
|
||||||
// Initilialize grid id to a default value if not found in config or bad:
|
// Initilialize grid id to a default value if not found in config or bad:
|
||||||
if( (m_LastGridSizeId <= 0) ||
|
if( (m_LastGridSizeId <= 0)
|
||||||
(m_LastGridSizeId < (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000)) )
|
|| ( m_LastGridSizeId < (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000) ) )
|
||||||
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
|
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
|
||||||
|
|
||||||
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
||||||
|
@ -189,32 +189,33 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
|
||||||
Show( true );
|
Show( true );
|
||||||
|
|
||||||
#if KICAD_AUIMANAGER
|
#if KICAD_AUIMANAGER
|
||||||
m_auimgr.SetManagedWindow(this);
|
m_auimgr.SetManagedWindow( this );
|
||||||
|
|
||||||
wxAuiPaneInfo horiz;
|
wxAuiPaneInfo horiz;
|
||||||
horiz.Gripper(false);
|
horiz.Gripper( false );
|
||||||
horiz.DockFixed(true);
|
horiz.DockFixed( true );
|
||||||
horiz.Movable(false);
|
horiz.Movable( false );
|
||||||
horiz.Floatable(false);
|
horiz.Floatable( false );
|
||||||
horiz.CloseButton(false);
|
horiz.CloseButton( false );
|
||||||
horiz.CaptionVisible(false);
|
horiz.CaptionVisible( false );
|
||||||
|
|
||||||
wxAuiPaneInfo vert(horiz);
|
|
||||||
|
|
||||||
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_VToolBar,
|
|
||||||
wxAuiPaneInfo(vert).Name(wxT("m_VToolBar")).Right());
|
|
||||||
|
|
||||||
m_auimgr.AddPane(DrawPanel,
|
wxAuiPaneInfo vert( horiz );
|
||||||
wxAuiPaneInfo().Name(wxT("DrawFrame")).CentrePane());
|
|
||||||
|
|
||||||
m_auimgr.AddPane(MsgPanel,
|
vert.TopDockable( false ).BottomDockable( false );
|
||||||
wxAuiPaneInfo(horiz).Name(wxT("MsgPanel")).Bottom());
|
horiz.LeftDockable( false ).RightDockable( false );
|
||||||
|
|
||||||
|
m_auimgr.AddPane( m_HToolBar,
|
||||||
|
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().
|
||||||
|
Row( 0 ) );
|
||||||
|
|
||||||
|
m_auimgr.AddPane( m_VToolBar,
|
||||||
|
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );
|
||||||
|
|
||||||
|
m_auimgr.AddPane( DrawPanel,
|
||||||
|
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
|
||||||
|
|
||||||
|
m_auimgr.AddPane( MsgPanel,
|
||||||
|
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
|
||||||
m_auimgr.Update();
|
m_auimgr.Update();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -224,6 +225,7 @@ WinEDA_LibeditFrame::~WinEDA_LibeditFrame()
|
||||||
{
|
{
|
||||||
WinEDA_SchematicFrame* frame =
|
WinEDA_SchematicFrame* frame =
|
||||||
(WinEDA_SchematicFrame*) wxGetApp().GetTopWindow();
|
(WinEDA_SchematicFrame*) wxGetApp().GetTopWindow();
|
||||||
|
|
||||||
frame->m_LibeditFrame = NULL;
|
frame->m_LibeditFrame = NULL;
|
||||||
m_drawItem = m_lastDrawItem = NULL;
|
m_drawItem = m_lastDrawItem = NULL;
|
||||||
}
|
}
|
||||||
|
@ -288,8 +290,7 @@ void WinEDA_LibeditFrame::OnCloseWindow( wxCloseEvent& Event )
|
||||||
GetScreen()->ClrModify();
|
GetScreen()->ClrModify();
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_FOREACH( const CMP_LIBRARY& lib, CMP_LIBRARY::GetLibraryList() )
|
BOOST_FOREACH( const CMP_LIBRARY &lib, CMP_LIBRARY::GetLibraryList() ) {
|
||||||
{
|
|
||||||
if( lib.IsModified() )
|
if( lib.IsModified() )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
@ -351,8 +352,8 @@ int WinEDA_LibeditFrame::BestZoom()
|
||||||
}
|
}
|
||||||
|
|
||||||
size -= wxSize( 25, 25 ); // reserve 100 mils margin
|
size -= wxSize( 25, 25 ); // reserve 100 mils margin
|
||||||
ii = wxRound( ( (double) dx / (double) size.x ) *
|
ii = wxRound( ( (double) dx / (double) size.x ) *
|
||||||
(double) GetScreen()->m_ZoomScalar );
|
(double) GetScreen()->m_ZoomScalar );
|
||||||
jj = wxRound( ( (double) dy / (double) size.y ) *
|
jj = wxRound( ( (double) dy / (double) size.y ) *
|
||||||
(double) GetScreen()->m_ZoomScalar );
|
(double) GetScreen()->m_ZoomScalar );
|
||||||
|
|
||||||
|
@ -495,8 +496,8 @@ void WinEDA_LibeditFrame::OnUpdateDeMorganNormal( wxUpdateUIEvent& event )
|
||||||
if( m_HToolBar == NULL )
|
if( m_HToolBar == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
event.Enable( GetShowDeMorgan() ||
|
event.Enable( GetShowDeMorgan()
|
||||||
(m_component && m_component->HasConversion()) );
|
|| ( m_component && m_component->HasConversion() ) );
|
||||||
m_HToolBar->ToggleTool( event.GetId(), m_convert <= 1 );
|
m_HToolBar->ToggleTool( event.GetId(), m_convert <= 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -506,8 +507,8 @@ void WinEDA_LibeditFrame::OnUpdateDeMorganConvert( wxUpdateUIEvent& event )
|
||||||
if( m_HToolBar == NULL )
|
if( m_HToolBar == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
event.Enable( GetShowDeMorgan() ||
|
event.Enable( GetShowDeMorgan()
|
||||||
(m_component && m_component->HasConversion()) );
|
|| ( m_component && m_component->HasConversion() ) );
|
||||||
m_HToolBar->ToggleTool( event.GetId(), m_convert > 1 );
|
m_HToolBar->ToggleTool( event.GetId(), m_convert > 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -521,7 +522,7 @@ void WinEDA_LibeditFrame::OnUpdateSelectAlias( wxUpdateUIEvent& event )
|
||||||
* so use the pointer to alias combobox to directly enable or disable.
|
* so use the pointer to alias combobox to directly enable or disable.
|
||||||
*/
|
*/
|
||||||
m_SelAliasBox->Enable( m_component != NULL
|
m_SelAliasBox->Enable( m_component != NULL
|
||||||
&& !m_component->m_AliasList.IsEmpty() );
|
&& !m_component->m_AliasList.IsEmpty() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -533,7 +534,8 @@ void WinEDA_LibeditFrame::OnSelectAlias( wxCommandEvent& event )
|
||||||
|
|
||||||
m_lastDrawItem = NULL;
|
m_lastDrawItem = NULL;
|
||||||
|
|
||||||
if( m_SelAliasBox->GetStringSelection().CmpNoCase(m_component->GetName() ) == 0 )
|
if( m_SelAliasBox->GetStringSelection().CmpNoCase( m_component->GetName() )
|
||||||
|
== 0 )
|
||||||
m_aliasName.Empty();
|
m_aliasName.Empty();
|
||||||
else
|
else
|
||||||
m_aliasName = m_SelAliasBox->GetStringSelection();
|
m_aliasName = m_SelAliasBox->GetStringSelection();
|
||||||
|
@ -710,7 +712,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
|
||||||
case ID_LIBEDIT_IMPORT_BODY_BUTT:
|
case ID_LIBEDIT_IMPORT_BODY_BUTT:
|
||||||
SetToolID( id, wxCURSOR_ARROW, _( "Import" ) );
|
SetToolID( id, wxCURSOR_ARROW, _( "Import" ) );
|
||||||
LoadOneSymbol( );
|
LoadOneSymbol();
|
||||||
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -767,6 +769,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
|
||||||
|
|
||||||
case ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT:
|
case ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT:
|
||||||
|
|
||||||
// Delete the last created segment, while creating a polyline draw item
|
// Delete the last created segment, while creating a polyline draw item
|
||||||
if( m_drawItem == NULL )
|
if( m_drawItem == NULL )
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -27,7 +27,7 @@ private:
|
||||||
|
|
||||||
// Flags
|
// Flags
|
||||||
wxSemaphore* m_Semaphore; // != NULL if the frame must emulate a modal dialog
|
wxSemaphore* m_Semaphore; // != NULL if the frame must emulate a modal dialog
|
||||||
wxString m_ConfigPath; // subpath for configuartion
|
wxString m_ConfigPath; // subpath for configuration
|
||||||
|
|
||||||
public:
|
public:
|
||||||
WinEDA_ViewlibFrame( wxWindow* father,
|
WinEDA_ViewlibFrame( wxWindow* father,
|
||||||
|
@ -47,7 +47,7 @@ public:
|
||||||
void ReCreateHToolbar();
|
void ReCreateHToolbar();
|
||||||
void ReCreateVToolbar();
|
void ReCreateVToolbar();
|
||||||
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
|
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
|
||||||
int BestZoom(); // Retourne le meilleur zoom
|
int BestZoom();
|
||||||
void ClickOnLibList( wxCommandEvent& event );
|
void ClickOnLibList( wxCommandEvent& event );
|
||||||
void ClickOnCmpList( wxCommandEvent& event );
|
void ClickOnCmpList( wxCommandEvent& event );
|
||||||
void OnSetRelativeOffset( wxCommandEvent& event );
|
void OnSetRelativeOffset( wxCommandEvent& event );
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/****************************************/
|
/****************************************/
|
||||||
/* Module to load/save EESchema files. */
|
/* Module to load/save EESchema files. */
|
||||||
/****************************************/
|
/****************************************/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
|
@ -29,7 +29,6 @@ extern int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
|
||||||
wxString& aMsgDiag, int* aLineNum,
|
wxString& aMsgDiag, int* aLineNum,
|
||||||
BASE_SCREEN* Window );
|
BASE_SCREEN* Window );
|
||||||
|
|
||||||
/* Fonctions locales */
|
|
||||||
static void LoadLayers( FILE* f, int* linecnt );
|
static void LoadLayers( FILE* f, int* linecnt );
|
||||||
|
|
||||||
|
|
||||||
|
@ -118,7 +117,8 @@ again." );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the rest of a potentially very long line. fgets() puts a '\n' into
|
// Read the rest of a potentially very long line. fgets() puts a '\n' into
|
||||||
// the buffer if the end of line was reached. Read until end of line if necessary.
|
// the buffer if the end of line was reached. Read until end of line if
|
||||||
|
// necessary.
|
||||||
if( Line[ strlen( Line )-1 ] != '\n' )
|
if( Line[ strlen( Line )-1 ] != '\n' )
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
@ -136,7 +136,7 @@ again." );
|
||||||
|
|
||||||
switch( Line[0] )
|
switch( Line[0] )
|
||||||
{
|
{
|
||||||
case '$': /* identification de bloc */
|
case '$': /* identification block */
|
||||||
if( Line[1] == 'C' )
|
if( Line[1] == 'C' )
|
||||||
Failed = ReadPartDescr( this, Line, f, MsgDiag, &LineCount,
|
Failed = ReadPartDescr( this, Line, f, MsgDiag, &LineCount,
|
||||||
screen );
|
screen );
|
||||||
|
@ -148,32 +148,32 @@ again." );
|
||||||
else if( Line[1] == 'D' )
|
else if( Line[1] == 'D' )
|
||||||
Failed = ReadSchemaDescr( this, Line, f, MsgDiag, &LineCount,
|
Failed = ReadSchemaDescr( this, Line, f, MsgDiag, &LineCount,
|
||||||
screen );
|
screen );
|
||||||
else if( Line[1] == 'T' ) //text part
|
else if( Line[1] == 'T' ) //text part
|
||||||
{
|
{
|
||||||
printf("**** TEXT PART\n");
|
printf("**** TEXT PART\n");
|
||||||
SCH_ITEM* Struct;
|
SCH_ITEM* Struct;
|
||||||
Struct = ReadTextDescr( f, MsgDiag, Line, sizeof(Line),
|
Struct = ReadTextDescr( f, MsgDiag, Line, sizeof(Line),
|
||||||
&LineCount, version);
|
&LineCount, version);
|
||||||
if( Struct )
|
if( Struct )
|
||||||
{
|
{
|
||||||
Struct->SetNext( screen->EEDrawList );
|
Struct->SetNext( screen->EEDrawList );
|
||||||
screen->EEDrawList = Struct;
|
screen->EEDrawList = Struct;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Failed = true;
|
Failed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'L': /* Its a library item. */
|
case 'L': /* Its a library item. */
|
||||||
Failed = ReadPartDescr( this, Line, f, MsgDiag, &LineCount, screen );
|
Failed = ReadPartDescr( this, Line, f, MsgDiag, &LineCount, screen );
|
||||||
break; /* Fin lecture 1 composant */
|
break;
|
||||||
|
|
||||||
|
|
||||||
case 'W': /* Its a Segment (WIRE or BUS) item. */
|
case 'W': /* Its a Segment (WIRE or BUS) item. */
|
||||||
if( sscanf( SLine, "%s %s", Name1, Name2 ) != 2 )
|
if( sscanf( SLine, "%s %s", Name1, Name2 ) != 2 )
|
||||||
{
|
{
|
||||||
MsgDiag.Printf( wxT( "EESchema file Segment struct error at line %d, aborted" ),
|
MsgDiag.Printf( wxT( "EESchema file segment error at line %d, aborted" ),
|
||||||
LineCount );
|
LineCount );
|
||||||
MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( Line );
|
MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( Line );
|
||||||
Failed = true;
|
Failed = true;
|
||||||
|
@ -209,7 +209,7 @@ again." );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case 'E': /* Its a Raccord (WIRE or BUS) item. */
|
case 'E': /* Its a WIRE or BUS item. */
|
||||||
if( sscanf( SLine, "%s %s", Name1, Name2 ) != 2 )
|
if( sscanf( SLine, "%s %s", Name1, Name2 ) != 2 )
|
||||||
{
|
{
|
||||||
MsgDiag.Printf( wxT( "EESchema file record struct error at line %d, aborted" ),
|
MsgDiag.Printf( wxT( "EESchema file record struct error at line %d, aborted" ),
|
||||||
|
@ -325,7 +325,8 @@ at line %d, aborted" ),
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'K': /* It is a Marker item. */
|
case 'K': /* It is a Marker item. */
|
||||||
// Markers are no more read from file. they are only created on demand in schematic
|
// Markers are no more read from file. they are only created on
|
||||||
|
// demand in schematic
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'T': /* It is a text item. */
|
case 'T': /* It is a text item. */
|
||||||
|
@ -398,7 +399,7 @@ static void LoadLayers( FILE* f, int* linecnt )
|
||||||
sscanf( Line, "%s %d %d", Name, &Number, &g_LayerDescr.CurrentLayer );
|
sscanf( Line, "%s %d %d", Name, &Number, &g_LayerDescr.CurrentLayer );
|
||||||
if( strcmp( Name, "EELAYER" ) !=0 )
|
if( strcmp( Name, "EELAYER" ) !=0 )
|
||||||
{
|
{
|
||||||
/* error : init par defaut */
|
/* error : init par default */
|
||||||
Number = MAX_LAYER;
|
Number = MAX_LAYER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,9 @@
|
||||||
#include "class_library.h"
|
#include "class_library.h"
|
||||||
|
|
||||||
|
|
||||||
/* Routines Locales */
|
|
||||||
static bool DrawStructInBox( int x1, int y1, int x2, int y2,
|
static bool DrawStructInBox( int x1, int y1, int x2, int y2,
|
||||||
SCH_ITEM *DrawStruct );
|
SCH_ITEM* DrawStruct );
|
||||||
|
|
||||||
static SCH_ITEM* LastSnappedStruct = NULL;
|
static SCH_ITEM* LastSnappedStruct = NULL;
|
||||||
static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1,
|
static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1,
|
||||||
int StartX2, int StartY2, int EndX2, int EndY2 );
|
int StartX2, int StartY2, int EndX2, int EndY2 );
|
||||||
|
@ -43,10 +43,10 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen )
|
||||||
while( DrawList )
|
while( DrawList )
|
||||||
{
|
{
|
||||||
if( ( SnapPoint2( Screen->m_MousePosition, LIBITEM,
|
if( ( SnapPoint2( Screen->m_MousePosition, LIBITEM,
|
||||||
DrawList, Screen->GetZoom() ) ) == FALSE )
|
DrawList, Screen->GetZoom() ) ) == FALSE )
|
||||||
{
|
{
|
||||||
if( ( SnapPoint2( Screen->m_Curseur, LIBITEM,
|
if( ( SnapPoint2( Screen->m_Curseur, LIBITEM,
|
||||||
DrawList, Screen->GetScalingFactor() ) ) == FALSE )
|
DrawList, Screen->GetScalingFactor() ) ) == FALSE )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
component = (SCH_COMPONENT*) LastSnappedStruct;
|
component = (SCH_COMPONENT*) LastSnappedStruct;
|
||||||
|
@ -55,12 +55,14 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen )
|
||||||
{
|
{
|
||||||
lastcomponent = component;
|
lastcomponent = component;
|
||||||
BoundaryBox = lastcomponent->GetBoundaryBox();
|
BoundaryBox = lastcomponent->GetBoundaryBox();
|
||||||
sizeref = ABS( (float) BoundaryBox.GetWidth() * BoundaryBox.GetHeight() );
|
sizeref = ABS( (float) BoundaryBox.GetWidth() *
|
||||||
|
BoundaryBox.GetHeight() );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BoundaryBox = component->GetBoundaryBox();
|
BoundaryBox = component->GetBoundaryBox();
|
||||||
sizecurr = ABS( (float) BoundaryBox.GetWidth() * BoundaryBox.GetHeight() );
|
sizecurr = ABS( (float) BoundaryBox.GetWidth() *
|
||||||
|
BoundaryBox.GetHeight() );
|
||||||
if( sizeref > sizecurr ) // a smallest component is found
|
if( sizeref > sizecurr ) // a smallest component is found
|
||||||
{
|
{
|
||||||
sizeref = sizecurr;
|
sizeref = sizecurr;
|
||||||
|
@ -73,10 +75,12 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************************/
|
|
||||||
SCH_ITEM* PickStruct( const wxPoint& refpos, BASE_SCREEN* screen, int SearchMask )
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
SCH_ITEM* PickStruct( const wxPoint& refpos,
|
||||||
|
BASE_SCREEN* screen,
|
||||||
|
int SearchMask )
|
||||||
|
{
|
||||||
|
/******************************************************************************/
|
||||||
/* Search an item at pos refpos
|
/* Search an item at pos refpos
|
||||||
* SearchMask = (bitwise OR):
|
* SearchMask = (bitwise OR):
|
||||||
* LIBITEM
|
* LIBITEM
|
||||||
|
@ -94,9 +98,9 @@ SCH_ITEM* PickStruct( const wxPoint& refpos, BASE_SCREEN* screen, int SearchMask
|
||||||
* SHEETLABELITEM
|
* SHEETLABELITEM
|
||||||
* FIELDCMPITEM
|
* FIELDCMPITEM
|
||||||
*
|
*
|
||||||
* if EXCLUDE_WIRE_BUS_ENDPOINTS is set, in wire ou bus search and locate,
|
* if EXCLUDE_WIRE_BUS_ENDPOINTS is set, in wire or bus search and locate,
|
||||||
* start and end points are not included in search
|
* start and end points are not included in search
|
||||||
* if WIRE_BUS_ENDPOINTS_ONLY is set, in wire ou bus search and locate,
|
* if WIRE_BUS_ENDPOINTS_ONLY is set, in wire or bus search and locate,
|
||||||
* only start and end points are included in search
|
* only start and end points are included in search
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
@ -104,7 +108,6 @@ SCH_ITEM* PickStruct( const wxPoint& refpos, BASE_SCREEN* screen, int SearchMask
|
||||||
* pointer on item found or NULL
|
* pointer on item found or NULL
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
{
|
|
||||||
bool Snapped;
|
bool Snapped;
|
||||||
|
|
||||||
if( screen == NULL || screen->EEDrawList == NULL )
|
if( screen == NULL || screen->EEDrawList == NULL )
|
||||||
|
@ -120,7 +123,6 @@ SCH_ITEM* PickStruct( const wxPoint& refpos, BASE_SCREEN* screen, int SearchMask
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Function PickStruct
|
/** Function PickStruct
|
||||||
* Search items in a block
|
* Search items in a block
|
||||||
* @return items count
|
* @return items count
|
||||||
|
@ -146,18 +148,19 @@ int PickItemsInBlock( BLOCK_SELECTOR& aBlock, BASE_SCREEN* aScreen )
|
||||||
EXCHG( y, OrigY );
|
EXCHG( y, OrigY );
|
||||||
|
|
||||||
ITEM_PICKER picker;
|
ITEM_PICKER picker;
|
||||||
SCH_ITEM* DrawStruct = aScreen->EEDrawList;
|
SCH_ITEM* DrawStruct = aScreen->EEDrawList;
|
||||||
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
|
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
|
||||||
{
|
{
|
||||||
if( DrawStructInBox( OrigX, OrigY, x, y, DrawStruct ) )
|
if( DrawStructInBox( OrigX, OrigY, x, y, DrawStruct ) )
|
||||||
{
|
{
|
||||||
/* Put this structure in the picked list: */
|
/* Put this structure in the picked list: */
|
||||||
picker.m_PickedItem = DrawStruct;
|
picker.m_PickedItem = DrawStruct;
|
||||||
picker.m_PickedItemType = DrawStruct->Type();
|
picker.m_PickedItemType = DrawStruct->Type();
|
||||||
aBlock.PushItem(picker);
|
aBlock.PushItem( picker );
|
||||||
itemcount++;
|
itemcount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return itemcount;
|
return itemcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,7 +178,7 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
|
||||||
{
|
{
|
||||||
for( ; DrawList != NULL; DrawList = DrawList->Next() )
|
for( ; DrawList != NULL; DrawList = DrawList->Next() )
|
||||||
{
|
{
|
||||||
int hitminDist = MAX( g_DrawDefaultLineThickness, 3 ) ;
|
int hitminDist = MAX( g_DrawDefaultLineThickness, 3 );
|
||||||
switch( DrawList->Type() )
|
switch( DrawList->Type() )
|
||||||
{
|
{
|
||||||
case DRAW_POLYLINE_STRUCT_TYPE:
|
case DRAW_POLYLINE_STRUCT_TYPE:
|
||||||
|
@ -187,7 +190,7 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
|
||||||
for( unsigned i = 0; i < STRUCT->GetCornerCount() - 1; i++ )
|
for( unsigned i = 0; i < STRUCT->GetCornerCount() - 1; i++ )
|
||||||
{
|
{
|
||||||
if( TestSegmentHit( aPosRef, STRUCT->m_PolyPoints[i],
|
if( TestSegmentHit( aPosRef, STRUCT->m_PolyPoints[i],
|
||||||
STRUCT->m_PolyPoints[i + 1], hitminDist ) )
|
STRUCT->m_PolyPoints[i + 1], hitminDist ) )
|
||||||
{
|
{
|
||||||
LastSnappedStruct = DrawList;
|
LastSnappedStruct = DrawList;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -204,14 +207,18 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
|
||||||
|
|
||||||
if( TestSegmentHit( aPosRef, STRUCT->m_Start, STRUCT->m_End, 0 ) )
|
if( TestSegmentHit( aPosRef, STRUCT->m_Start, STRUCT->m_End, 0 ) )
|
||||||
{
|
{
|
||||||
if( ( (SearchMask & DRAWITEM) && (STRUCT->GetLayer() == LAYER_NOTES) )
|
if( ( (SearchMask & DRAWITEM)
|
||||||
|| ( (SearchMask & WIREITEM) && (STRUCT->GetLayer() == LAYER_WIRE) )
|
&& (STRUCT->GetLayer() == LAYER_NOTES) )
|
||||||
|| ( (SearchMask & BUSITEM) && (STRUCT->GetLayer() == LAYER_BUS) )
|
|| ( (SearchMask & WIREITEM)
|
||||||
|
&& (STRUCT->GetLayer() == LAYER_WIRE) )
|
||||||
|
|| ( (SearchMask & BUSITEM)
|
||||||
|
&& (STRUCT->GetLayer() == LAYER_BUS) )
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if( SearchMask & EXCLUDE_WIRE_BUS_ENDPOINTS )
|
if( SearchMask & EXCLUDE_WIRE_BUS_ENDPOINTS )
|
||||||
{
|
{
|
||||||
if( aPosRef == STRUCT->m_Start || aPosRef == STRUCT->m_End )
|
if( aPosRef == STRUCT->m_Start || aPosRef ==
|
||||||
|
STRUCT->m_End )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,7 +241,8 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
|
||||||
if( !( SearchMask & (RACCORDITEM) ) )
|
if( !( SearchMask & (RACCORDITEM) ) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if( TestSegmentHit( aPosRef, STRUCT->m_Pos, STRUCT->m_End(), hitminDist ) )
|
if( TestSegmentHit( aPosRef, STRUCT->m_Pos, STRUCT->m_End(),
|
||||||
|
hitminDist ) )
|
||||||
{
|
{
|
||||||
LastSnappedStruct = DrawList;
|
LastSnappedStruct = DrawList;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -271,7 +279,7 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
|
||||||
#define STRUCT ( (MARKER_SCH*) DrawList )
|
#define STRUCT ( (MARKER_SCH*) DrawList )
|
||||||
if( !(SearchMask & MARKERITEM) )
|
if( !(SearchMask & MARKERITEM) )
|
||||||
break;
|
break;
|
||||||
if( STRUCT->HitTest(aPosRef) )
|
if( STRUCT->HitTest( aPosRef ) )
|
||||||
{
|
{
|
||||||
LastSnappedStruct = DrawList;
|
LastSnappedStruct = DrawList;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -296,7 +304,8 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
|
||||||
case TYPE_SCH_GLOBALLABEL:
|
case TYPE_SCH_GLOBALLABEL:
|
||||||
case TYPE_SCH_HIERLABEL:
|
case TYPE_SCH_HIERLABEL:
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ( (SCH_TEXT*) DrawList ) // SCH_TEXT is the base class of these labels
|
#define STRUCT ( (SCH_TEXT*) DrawList ) // SCH_TEXT is the base
|
||||||
|
// class of these labels
|
||||||
if( !(SearchMask & LABELITEM) )
|
if( !(SearchMask & LABELITEM) )
|
||||||
break;
|
break;
|
||||||
if( STRUCT->HitTest( aPosRef ) )
|
if( STRUCT->HitTest( aPosRef ) )
|
||||||
|
@ -346,7 +355,7 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
|
||||||
|
|
||||||
case DRAW_SHEET_STRUCT_TYPE:
|
case DRAW_SHEET_STRUCT_TYPE:
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ( (DrawSheetStruct*) DrawList )
|
#define STRUCT ( (SCH_SHEET*) DrawList )
|
||||||
if( !(SearchMask & SHEETITEM) )
|
if( !(SearchMask & SHEETITEM) )
|
||||||
break;
|
break;
|
||||||
if( STRUCT->HitTest( aPosRef ) )
|
if( STRUCT->HitTest( aPosRef ) )
|
||||||
|
@ -359,7 +368,8 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf( wxT( "SnapPoint2() error: unexpected struct type %d (" ), DrawList->Type() );
|
msg.Printf( wxT( "SnapPoint2() error: unexpected struct type %d (" ),
|
||||||
|
DrawList->Type() );
|
||||||
msg << DrawList->GetClass() << wxT( ")" );
|
msg << DrawList->GetClass() << wxT( ")" );
|
||||||
wxMessageBox( msg );
|
wxMessageBox( msg );
|
||||||
break;
|
break;
|
||||||
|
@ -389,8 +399,10 @@ bool DrawStructInBox( int x1, int y1, int x2, int y2, SCH_ITEM* DrawStruct )
|
||||||
#define STRUCT ( (DrawPolylineStruct*) DrawStruct )
|
#define STRUCT ( (DrawPolylineStruct*) DrawStruct )
|
||||||
for( unsigned i = 0; i < STRUCT->GetCornerCount(); i++ )
|
for( unsigned i = 0; i < STRUCT->GetCornerCount(); i++ )
|
||||||
{
|
{
|
||||||
if( STRUCT->m_PolyPoints[i].x >= x1 && STRUCT->m_PolyPoints[i].x <= x2
|
if( STRUCT->m_PolyPoints[i].x >= x1
|
||||||
&& STRUCT->m_PolyPoints[i].y >= y1 && STRUCT->m_PolyPoints[i].y <=y2 )
|
&& STRUCT->m_PolyPoints[i].x <= x2
|
||||||
|
&& STRUCT->m_PolyPoints[i].y >= y1
|
||||||
|
&& STRUCT->m_PolyPoints[i].y <=y2 )
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -480,8 +492,10 @@ bool DrawStructInBox( int x1, int y1, int x2, int y2, SCH_ITEM* DrawStruct )
|
||||||
case TYPE_SCH_GLOBALLABEL:
|
case TYPE_SCH_GLOBALLABEL:
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ( (SCH_LABEL*) DrawStruct )
|
#define STRUCT ( (SCH_LABEL*) DrawStruct )
|
||||||
dx = STRUCT->m_Size.x * ( STRUCT->GetLength() + 1); /* total length */
|
dx = STRUCT->m_Size.x * ( STRUCT->GetLength() + 1); /* total length
|
||||||
dy = STRUCT->m_Size.y / 2; /* half height */
|
**/
|
||||||
|
dy = STRUCT->m_Size.y / 2; /* half height
|
||||||
|
**/
|
||||||
xt1 = xt2 = STRUCT->m_Pos.x;
|
xt1 = xt2 = STRUCT->m_Pos.x;
|
||||||
yt1 = yt2 = STRUCT->m_Pos.y;
|
yt1 = yt2 = STRUCT->m_Pos.y;
|
||||||
|
|
||||||
|
@ -524,7 +538,7 @@ bool DrawStructInBox( int x1, int y1, int x2, int y2, SCH_ITEM* DrawStruct )
|
||||||
|
|
||||||
case DRAW_SHEET_STRUCT_TYPE:
|
case DRAW_SHEET_STRUCT_TYPE:
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ( (DrawSheetStruct*) DrawStruct )
|
#define STRUCT ( (SCH_SHEET*) DrawStruct )
|
||||||
/* Recalculate the coordinates of the worksheet component */
|
/* Recalculate the coordinates of the worksheet component */
|
||||||
xt1 = STRUCT->m_Pos.x;
|
xt1 = STRUCT->m_Pos.x;
|
||||||
yt1 = STRUCT->m_Pos.y;
|
yt1 = STRUCT->m_Pos.y;
|
||||||
|
@ -539,9 +553,8 @@ bool DrawStructInBox( int x1, int y1, int x2, int y2, SCH_ITEM* DrawStruct )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
msg.Printf(
|
msg.Printf( wxT( "DrawStructInBox() Err: unexpected StructType %d (" ),
|
||||||
wxT( "DrawStructInBox() Err: unexpected StructType %d (" ),
|
DrawStruct->Type() );
|
||||||
DrawStruct->Type() );
|
|
||||||
msg << DrawStruct->GetClass() << wxT( ")" );
|
msg << DrawStruct->GetClass() << wxT( ")" );
|
||||||
wxMessageBox( msg );
|
wxMessageBox( msg );
|
||||||
break;
|
break;
|
||||||
|
@ -554,8 +567,8 @@ bool DrawStructInBox( int x1, int y1, int x2, int y2, SCH_ITEM* DrawStruct )
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1,
|
static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1,
|
||||||
int StartX2, int StartY2, int EndX2, int EndY2 )
|
int StartX2, int StartY2, int EndX2, int EndY2 )
|
||||||
|
{
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
/* Routine detects that the rectangle 1 (Box1) and the rectangle 2 (Box2) is
|
/* Routine detects that the rectangle 1 (Box1) and the rectangle 2 (Box2) is
|
||||||
* Overlap.
|
* Overlap.
|
||||||
* Returns TRUE or FALSE.
|
* Returns TRUE or FALSE.
|
||||||
|
@ -563,7 +576,6 @@ static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1,
|
||||||
* These assume that there is recovery if at least one corner
|
* These assume that there is recovery if at least one corner
|
||||||
* A 'Box' is included in the other
|
* A 'Box' is included in the other
|
||||||
*/
|
*/
|
||||||
{
|
|
||||||
int cX, cY;
|
int cX, cY;
|
||||||
|
|
||||||
if( StartX1 > EndX1 )
|
if( StartX1 > EndX1 )
|
||||||
|
@ -621,11 +633,10 @@ static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Hierarchical_PIN_Sheet_Struct* LocateSheetLabel( DrawSheetStruct* Sheet,
|
SCH_SHEET_PIN* LocateSheetLabel( SCH_SHEET* Sheet, const wxPoint& pos )
|
||||||
const wxPoint& pos )
|
|
||||||
{
|
{
|
||||||
int size, dy, minx, maxx;
|
int size, dy, minx, maxx;
|
||||||
Hierarchical_PIN_Sheet_Struct* SheetLabel;
|
SCH_SHEET_PIN* SheetLabel;
|
||||||
|
|
||||||
SheetLabel = Sheet->m_Label;
|
SheetLabel = Sheet->m_Label;
|
||||||
while( SheetLabel
|
while( SheetLabel
|
||||||
|
@ -658,7 +669,7 @@ LIB_PIN* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos,
|
||||||
LIB_PIN* Pin = NULL;
|
LIB_PIN* Pin = NULL;
|
||||||
|
|
||||||
for( DrawStruct = DrawList; DrawStruct != NULL;
|
for( DrawStruct = DrawList; DrawStruct != NULL;
|
||||||
DrawStruct = DrawStruct->Next() )
|
DrawStruct = DrawStruct->Next() )
|
||||||
{
|
{
|
||||||
if( DrawStruct->Type() != TYPE_SCH_COMPONENT )
|
if( DrawStruct->Type() != TYPE_SCH_COMPONENT )
|
||||||
continue;
|
continue;
|
||||||
|
@ -667,7 +678,8 @@ LIB_PIN* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos,
|
||||||
|
|
||||||
if( Entry == NULL )
|
if( Entry == NULL )
|
||||||
continue;
|
continue;
|
||||||
/* we use LocateDrawItem to locate pîns. but this function suppose a
|
|
||||||
|
/* we use LocateDrawItem to locate pins. but this function suppose a
|
||||||
* component.
|
* component.
|
||||||
* at 0,0 location
|
* at 0,0 location
|
||||||
* So we must calculate the ref position relative to the component
|
* So we must calculate the ref position relative to the component
|
||||||
|
@ -687,20 +699,18 @@ LIB_PIN* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Hierarchical_PIN_Sheet_Struct* LocateAnyPinSheet( const wxPoint& RefPos,
|
SCH_SHEET_PIN* LocateAnyPinSheet( const wxPoint& RefPos, SCH_ITEM* DrawList )
|
||||||
SCH_ITEM* DrawList )
|
|
||||||
{
|
{
|
||||||
SCH_ITEM* DrawStruct;
|
SCH_ITEM* DrawStruct;
|
||||||
Hierarchical_PIN_Sheet_Struct* PinSheet = NULL;
|
SCH_SHEET_PIN* PinSheet = NULL;
|
||||||
|
|
||||||
for( DrawStruct = DrawList; DrawStruct != NULL;
|
for( DrawStruct = DrawList; DrawStruct != NULL;
|
||||||
DrawStruct = DrawStruct->Next() )
|
DrawStruct = DrawStruct->Next() )
|
||||||
{
|
{
|
||||||
if( DrawStruct->Type() != DRAW_SHEET_STRUCT_TYPE )
|
if( DrawStruct->Type() != DRAW_SHEET_STRUCT_TYPE )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
PinSheet = LocateSheetLabel( (DrawSheetStruct*) DrawStruct,
|
PinSheet = LocateSheetLabel( (SCH_SHEET*) DrawStruct, RefPos );
|
||||||
RefPos );
|
|
||||||
if( PinSheet )
|
if( PinSheet )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*******************************************************/
|
/*****************************/
|
||||||
/* Module de generation de la Netliste , selon Formats */
|
/* Net list generation code. */
|
||||||
/*******************************************************/
|
/*****************************/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "gr_basic.h"
|
#include "gr_basic.h"
|
||||||
|
@ -17,9 +17,8 @@
|
||||||
#include "class_library.h"
|
#include "class_library.h"
|
||||||
|
|
||||||
|
|
||||||
/* Routines locales */
|
|
||||||
static void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
|
static void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
|
||||||
const wxString& FullFileName );
|
const wxString& FullFileName );
|
||||||
static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f,
|
static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f,
|
||||||
bool with_pcbnew );
|
bool with_pcbnew );
|
||||||
static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f );
|
static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f );
|
||||||
|
@ -50,12 +49,11 @@ static wxArrayString s_ReferencesAlreadyFound;
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
void WriteNetList( WinEDA_SchematicFrame* frame, const wxString& FileNameNL,
|
void WriteNetList( WinEDA_SchematicFrame* frame, const wxString& FileNameNL,
|
||||||
bool use_netnames )
|
bool use_netnames )
|
||||||
|
{
|
||||||
/*******************************************************************************/
|
/*******************************************************************************/
|
||||||
|
|
||||||
/* Create the netlist file ( Format is given by frame->m_NetlistFormat )
|
/* Create the netlist file ( Format is given by frame->m_NetlistFormat )
|
||||||
* bool use_netnames is used only for Spice netlist
|
* bool use_netnames is used only for Spice netlist
|
||||||
*/
|
*/
|
||||||
{
|
|
||||||
FILE* f = NULL;
|
FILE* f = NULL;
|
||||||
|
|
||||||
if( frame->m_NetlistFormat < NET_TYPE_CUSTOM1 )
|
if( frame->m_NetlistFormat < NET_TYPE_CUSTOM1 )
|
||||||
|
@ -106,12 +104,13 @@ void WriteNetList( WinEDA_SchematicFrame* frame, const wxString& FileNameNL,
|
||||||
* considered)
|
* considered)
|
||||||
* Must be deallocated by the user
|
* Must be deallocated by the user
|
||||||
*/
|
*/
|
||||||
static SCH_COMPONENT* FindNextComponentAndCreatPinList( EDA_BaseStruct* DrawList,
|
static SCH_COMPONENT* FindNextComponentAndCreatPinList(
|
||||||
DrawSheetPath* sheet )
|
EDA_BaseStruct* DrawList,
|
||||||
|
DrawSheetPath* sheet )
|
||||||
{
|
{
|
||||||
SCH_COMPONENT* Component = NULL;
|
SCH_COMPONENT* Component = NULL;
|
||||||
LIB_COMPONENT* Entry;
|
LIB_COMPONENT* Entry;
|
||||||
LIB_PIN* Pin;
|
LIB_PIN* Pin;
|
||||||
|
|
||||||
s_SortedComponentPinList.clear();
|
s_SortedComponentPinList.clear();
|
||||||
for( ; DrawList != NULL; DrawList = DrawList->Next() )
|
for( ; DrawList != NULL; DrawList = DrawList->Next() )
|
||||||
|
@ -120,8 +119,8 @@ static SCH_COMPONENT* FindNextComponentAndCreatPinList( EDA_BaseStruct* DrawList
|
||||||
continue;
|
continue;
|
||||||
Component = (SCH_COMPONENT*) DrawList;
|
Component = (SCH_COMPONENT*) DrawList;
|
||||||
|
|
||||||
/* Power symbol and other component which have the reference starting by
|
/* Power symbol and other component which have the reference starting
|
||||||
* "#" are not included in netlist (pseudo or virtual components) */
|
* by "#" are not included in netlist (pseudo or virtual components) */
|
||||||
wxString str = Component->GetRef( sheet );
|
wxString str = Component->GetRef( sheet );
|
||||||
if( str[0] == '#' ) // ignore it
|
if( str[0] == '#' ) // ignore it
|
||||||
continue;
|
continue;
|
||||||
|
@ -141,7 +140,9 @@ static SCH_COMPONENT* FindNextComponentAndCreatPinList( EDA_BaseStruct* DrawList
|
||||||
if( Entry->GetPartCount() > 1 )
|
if( Entry->GetPartCount() > 1 )
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for( unsigned jj = 0; jj < s_ReferencesAlreadyFound.GetCount(); jj++ )
|
for( unsigned jj = 0;
|
||||||
|
jj < s_ReferencesAlreadyFound.GetCount();
|
||||||
|
jj++ )
|
||||||
{
|
{
|
||||||
if( str == s_ReferencesAlreadyFound[jj] ) // Already visited
|
if( str == s_ReferencesAlreadyFound[jj] ) // Already visited
|
||||||
{
|
{
|
||||||
|
@ -174,7 +175,8 @@ static SCH_COMPONENT* FindNextComponentAndCreatPinList( EDA_BaseStruct* DrawList
|
||||||
AddPinToComponentPinList( Component, sheet, Pin );
|
AddPinToComponentPinList( Component, sheet, Pin );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // Multiple parts per package: Collect all parts ans pins for this reference
|
else // Multiple parts per package: Collect all parts ans pins for
|
||||||
|
// this reference
|
||||||
FindAllsInstancesOfComponent( Component, Entry, sheet );
|
FindAllsInstancesOfComponent( Component, Entry, sheet );
|
||||||
|
|
||||||
/* Sort Pins in s_SortedComponentPinList by pin number */
|
/* Sort Pins in s_SortedComponentPinList by pin number */
|
||||||
|
@ -191,17 +193,14 @@ static SCH_COMPONENT* FindNextComponentAndCreatPinList( EDA_BaseStruct* DrawList
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************************/
|
|
||||||
static wxString ReturnPinNetName( NETLIST_OBJECT* Pin,
|
|
||||||
const wxString& DefaultFormatNetname )
|
|
||||||
/**************************************************************************************/
|
|
||||||
|
|
||||||
/* Return the net name for the pin Pin.
|
/* Return the net name for the pin Pin.
|
||||||
* Net name is:
|
* Net name is:
|
||||||
* "?" if pin not connected
|
* "?" if pin not connected
|
||||||
* "netname" for global net (like gnd, vcc ..
|
* "netname" for global net (like gnd, vcc ..
|
||||||
* "netname_sheetnumber" for the usual nets
|
* "netname_sheetnumber" for the usual nets
|
||||||
*/
|
*/
|
||||||
|
static wxString ReturnPinNetName( NETLIST_OBJECT* Pin,
|
||||||
|
const wxString& DefaultFormatNetname )
|
||||||
{
|
{
|
||||||
int netcode = Pin->GetNet();
|
int netcode = Pin->GetNet();
|
||||||
wxString NetName;
|
wxString NetName;
|
||||||
|
@ -233,7 +232,7 @@ static wxString ReturnPinNetName( NETLIST_OBJECT* Pin,
|
||||||
wxString lnet = NetName;
|
wxString lnet = NetName;
|
||||||
NetName = g_NetObjectslist[jj]->m_SheetList.PathHumanReadable();
|
NetName = g_NetObjectslist[jj]->m_SheetList.PathHumanReadable();
|
||||||
|
|
||||||
// If sheet path is too long, use the time stamp name insteed
|
// If sheet path is too long, use the time stamp name instead
|
||||||
if( NetName.Length() > 32 )
|
if( NetName.Length() > 32 )
|
||||||
NetName = g_NetObjectslist[jj]->m_SheetList.Path();
|
NetName = g_NetObjectslist[jj]->m_SheetList.Path();
|
||||||
NetName += lnet;
|
NetName += lnet;
|
||||||
|
@ -248,14 +247,11 @@ static wxString ReturnPinNetName( NETLIST_OBJECT* Pin,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
|
|
||||||
const wxString& FullFileName )
|
|
||||||
/***********************************************************************/
|
|
||||||
|
|
||||||
/* Create a generic netlist, and call an external netlister
|
/* Create a generic netlist, and call an external netlister
|
||||||
* to change the netlist syntax and create the file
|
* to change the netlist syntax and create the file
|
||||||
*/
|
*/
|
||||||
|
void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
|
||||||
|
const wxString& FullFileName )
|
||||||
{
|
{
|
||||||
wxString Line, FootprintName;
|
wxString Line, FootprintName;
|
||||||
DrawSheetPath* sheet;
|
DrawSheetPath* sheet;
|
||||||
|
@ -274,21 +270,27 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ClearUsedFlags(); /* Reset the flags FlagControlMulti in all schematic files*/
|
ClearUsedFlags(); /* Reset the flags FlagControlMulti in all schematic
|
||||||
|
* files*/
|
||||||
fprintf( tmpfile, "$BeginNetlist\n" );
|
fprintf( tmpfile, "$BeginNetlist\n" );
|
||||||
|
|
||||||
/* Create netlist module section */
|
/* Create netlist module section */
|
||||||
fprintf( tmpfile, "$BeginComponentList\n" );
|
fprintf( tmpfile, "$BeginComponentList\n" );
|
||||||
EDA_SheetList SheetList;
|
EDA_SheetList SheetList;
|
||||||
|
|
||||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
for( sheet = SheetList.GetFirst();
|
||||||
|
sheet != NULL;
|
||||||
|
sheet = SheetList.GetNext() )
|
||||||
{
|
{
|
||||||
for( SchItem = sheet->LastDrawList(); SchItem != NULL; SchItem = SchItem->Next() )
|
for( SchItem = sheet->LastDrawList();
|
||||||
|
SchItem != NULL;
|
||||||
|
SchItem = SchItem->Next() )
|
||||||
{
|
{
|
||||||
SchItem = Component = FindNextComponentAndCreatPinList( SchItem, sheet );
|
SchItem = Component = FindNextComponentAndCreatPinList( SchItem,
|
||||||
|
sheet );
|
||||||
|
|
||||||
if( Component == NULL )
|
if( Component == NULL )
|
||||||
break; // No component left
|
break; // No component left
|
||||||
|
|
||||||
FootprintName.Empty();
|
FootprintName.Empty();
|
||||||
if( !Component->GetField( FOOTPRINT )->IsVoid() )
|
if( !Component->GetField( FOOTPRINT )->IsVoid() )
|
||||||
|
@ -300,7 +302,8 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
|
||||||
fprintf( tmpfile, "\n$BeginComponent\n" );
|
fprintf( tmpfile, "\n$BeginComponent\n" );
|
||||||
fprintf( tmpfile, "TimeStamp=%8.8lX\n", Component->m_TimeStamp );
|
fprintf( tmpfile, "TimeStamp=%8.8lX\n", Component->m_TimeStamp );
|
||||||
fprintf( tmpfile, "Footprint=%s\n", CONV_TO_UTF8( FootprintName ) );
|
fprintf( tmpfile, "Footprint=%s\n", CONV_TO_UTF8( FootprintName ) );
|
||||||
Line = wxT( "Reference=" ) + Component->GetRef( sheet ) + wxT( "\n" );
|
Line = wxT( "Reference=" ) + Component->GetRef( sheet ) + wxT(
|
||||||
|
"\n" );
|
||||||
Line.Replace( wxT( " " ), wxT( "_" ) );
|
Line.Replace( wxT( " " ), wxT( "_" ) );
|
||||||
fputs( CONV_TO_UTF8( Line ), tmpfile );
|
fputs( CONV_TO_UTF8( Line ), tmpfile );
|
||||||
|
|
||||||
|
@ -357,30 +360,25 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************/
|
|
||||||
static void ClearUsedFlags( void )
|
|
||||||
/*********************************/
|
|
||||||
/* Clear flag list, used in netlist generation */
|
/* Clear flag list, used in netlist generation */
|
||||||
|
static void ClearUsedFlags( void )
|
||||||
{
|
{
|
||||||
s_ReferencesAlreadyFound.Clear();
|
s_ReferencesAlreadyFound.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************/
|
/* Routine generation of the netlist file (Format PSPICE)
|
||||||
|
* = TRUE if use_netnames
|
||||||
|
* Nodes are identified by the netname
|
||||||
|
* If the nodes are identified by the netnumber
|
||||||
|
*
|
||||||
|
* All graphics text commentary by a [.-+] PSpice or [.-+] gnucap
|
||||||
|
* Are considered in placing orders in the netlist
|
||||||
|
* [.-] Or PSpice gnucap are beginning
|
||||||
|
* + + Gnucap and PSpice are ultimately NetList
|
||||||
|
*/
|
||||||
static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
|
static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
|
||||||
bool use_netnames )
|
bool use_netnames )
|
||||||
/*************************************************************/
|
|
||||||
|
|
||||||
/* Routine de generation du fichier netliste ( Format PSPICE )
|
|
||||||
* si use_netnames = TRUE
|
|
||||||
* les nodes sont identifies par le netname
|
|
||||||
* sinon les nodes sont identifies par le netnumber
|
|
||||||
*
|
|
||||||
* tous les textes graphiques commen�ant par [.-+]pspice ou [.-+]gnucap
|
|
||||||
* sont consideres comme des commandes a placer dans la netliste
|
|
||||||
* [.-]pspice ou gnucap sont en debut
|
|
||||||
* +pspice et +gnucap sont en fin de netliste
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
char Line[1024];
|
char Line[1024];
|
||||||
DrawSheetPath* sheet;
|
DrawSheetPath* sheet;
|
||||||
|
@ -395,16 +393,24 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
|
||||||
wxChar bufnum[BUFYPOS_LEN + 1];
|
wxChar bufnum[BUFYPOS_LEN + 1];
|
||||||
|
|
||||||
DateAndTime( Line );
|
DateAndTime( Line );
|
||||||
fprintf( f, "* %s (Spice format) creation date: %s\n\n", NETLIST_HEAD_STRING, Line );
|
fprintf( f,
|
||||||
|
"* %s (Spice format) creation date: %s\n\n",
|
||||||
|
NETLIST_HEAD_STRING,
|
||||||
|
Line );
|
||||||
|
|
||||||
/* Create text list starting by [.-]pspice , or [.-]gnucap (simulator commands) */
|
/* Create text list starting by [.-]pspice , or [.-]gnucap (simulator
|
||||||
/* and create text list starting by [+]pspice , or [+]gnucap (simulator commands) */
|
* commands) and create text list starting by [+]pspice , or [+]gnucap
|
||||||
|
* (simulator commands) */
|
||||||
bufnum[BUFYPOS_LEN] = 0;
|
bufnum[BUFYPOS_LEN] = 0;
|
||||||
EDA_SheetList SheetList;
|
EDA_SheetList SheetList;
|
||||||
|
|
||||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
for( sheet = SheetList.GetFirst();
|
||||||
|
sheet != NULL;
|
||||||
|
sheet = SheetList.GetNext() )
|
||||||
{
|
{
|
||||||
for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Next() )
|
for( DrawList = sheet->LastDrawList();
|
||||||
|
DrawList != NULL;
|
||||||
|
DrawList = DrawList->Next() )
|
||||||
{
|
{
|
||||||
wxChar ident;
|
wxChar ident;
|
||||||
if( DrawList->Type() != TYPE_SCH_TEXT )
|
if( DrawList->Type() != TYPE_SCH_TEXT )
|
||||||
|
@ -415,21 +421,23 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
|
||||||
ident = text.GetChar( 0 );
|
ident = text.GetChar( 0 );
|
||||||
if( ident != '.' && ident != '-' && ident != '+' )
|
if( ident != '.' && ident != '-' && ident != '+' )
|
||||||
continue;
|
continue;
|
||||||
text.Remove( 0, 1 ); //Remove the first char.
|
text.Remove( 0, 1 ); // Remove the first char.
|
||||||
text.Remove( 6 ); //text contains 6 char.
|
text.Remove( 6 ); // text contains 6 char.
|
||||||
text.MakeLower();
|
text.MakeLower();
|
||||||
if( ( text == wxT( "pspice" ) ) || ( text == wxT( "gnucap" ) ) )
|
if( ( text == wxT( "pspice" ) ) || ( text == wxT( "gnucap" ) ) )
|
||||||
{
|
{
|
||||||
/* Put the Y position as an ascii string, for sort by vertical position,
|
/* Put the Y position as an ascii string, for sort by vertical
|
||||||
* using usual sort string by alphabetic value */
|
* position, using usual sort string by alphabetic value */
|
||||||
int ypos = DRAWTEXT->m_Pos.y;
|
int ypos = DRAWTEXT->m_Pos.y;
|
||||||
for( int ii = 0; ii < BUFYPOS_LEN; ii++ )
|
for( int ii = 0; ii < BUFYPOS_LEN; ii++ )
|
||||||
{
|
{
|
||||||
bufnum[BUFYPOS_LEN - 1 - ii] = (ypos & 63) + ' '; ypos >>= 6;
|
bufnum[BUFYPOS_LEN - 1 -
|
||||||
|
ii] = (ypos & 63) + ' '; ypos >>= 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
text = DRAWTEXT->m_Text.AfterFirst( ' ' );
|
text = DRAWTEXT->m_Text.AfterFirst( ' ' );
|
||||||
msg.Printf( wxT( "%s %s" ), bufnum, text.GetData() ); // First BUFYPOS_LEN char are the Y position
|
// First BUFYPOS_LEN char are the Y position.
|
||||||
|
msg.Printf( wxT( "%s %s" ), bufnum, text.GetData() );
|
||||||
if( ident == '+' )
|
if( ident == '+' )
|
||||||
SpiceCommandAtEndFile.Add( msg );
|
SpiceCommandAtEndFile.Add( msg );
|
||||||
else
|
else
|
||||||
|
@ -438,7 +446,8 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print texts starting by [.-]pspice , ou [.-]gnucap (of course, without the Y position string)*/
|
/* Print texts starting by [.-]pspice , ou [.-]gnucap (of course, without
|
||||||
|
* the Y position string)*/
|
||||||
nbitems = SpiceCommandAtBeginFile.GetCount();
|
nbitems = SpiceCommandAtBeginFile.GetCount();
|
||||||
if( nbitems )
|
if( nbitems )
|
||||||
{
|
{
|
||||||
|
@ -455,12 +464,18 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
|
||||||
|
|
||||||
|
|
||||||
/* Create component list */
|
/* Create component list */
|
||||||
ClearUsedFlags(); /* Reset the flags FlagControlMulti in all schematic files*/
|
ClearUsedFlags(); /* Reset the flags FlagControlMulti in all schematic
|
||||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
* files*/
|
||||||
|
for( sheet = SheetList.GetFirst();
|
||||||
|
sheet != NULL;
|
||||||
|
sheet = SheetList.GetNext() )
|
||||||
{
|
{
|
||||||
for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Next() )
|
for( DrawList = sheet->LastDrawList();
|
||||||
|
DrawList != NULL;
|
||||||
|
DrawList = DrawList->Next() )
|
||||||
{
|
{
|
||||||
DrawList = Component = FindNextComponentAndCreatPinList( DrawList, sheet );
|
DrawList = Component = FindNextComponentAndCreatPinList( DrawList,
|
||||||
|
sheet );
|
||||||
if( Component == NULL )
|
if( Component == NULL )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -472,12 +487,13 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
|
||||||
NETLIST_OBJECT* Pin = s_SortedComponentPinList[ii];
|
NETLIST_OBJECT* Pin = s_SortedComponentPinList[ii];
|
||||||
if( !Pin )
|
if( !Pin )
|
||||||
continue;
|
continue;
|
||||||
wxString NetName = ReturnPinNetName( Pin, wxT( "N-%.6d" ) );
|
wxString NetName = ReturnPinNetName( Pin, wxT( "N-%.6d" ) );
|
||||||
if( NetName.IsEmpty() )
|
if( NetName.IsEmpty() )
|
||||||
NetName = wxT( "?" );
|
NetName = wxT( "?" );
|
||||||
if( use_netnames )
|
if( use_netnames )
|
||||||
fprintf( f, " %s", CONV_TO_UTF8( NetName ) );
|
fprintf( f, " %s", CONV_TO_UTF8( NetName ) );
|
||||||
else // Use number for net names (with net number = 0 for "GND"
|
else // Use number for net names (with net number = 0 for
|
||||||
|
// "GND"
|
||||||
{
|
{
|
||||||
// NetName = "0" is "GND" net for Spice
|
// NetName = "0" is "GND" net for Spice
|
||||||
if( NetName == wxT( "0" ) || NetName == wxT( "GND" ) )
|
if( NetName == wxT( "0" ) || NetName == wxT( "GND" ) )
|
||||||
|
@ -487,7 +503,8 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf( f, " %s\n", CONV_TO_UTF8( Component->GetField( VALUE )->m_Text ) );
|
fprintf( f, " %s\n",
|
||||||
|
CONV_TO_UTF8( Component->GetField( VALUE )->m_Text ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -512,16 +529,15 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************************/
|
/* Generate net list file (Format 2 improves ORCAD PCB)
|
||||||
static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with_pcbnew )
|
* = TRUE if with_pcbnew
|
||||||
/*****************************************************************************************/
|
* Format Pcbnew (OrcadPcb2 + reviews and lists of net)
|
||||||
|
* = FALSE if with_pcbnew
|
||||||
/* Routine de generation du fichier netliste ( Format ORCAD PCB 2 ameliore )
|
* Format ORCADPCB2 strict
|
||||||
* si with_pcbnew = TRUE
|
|
||||||
* format PCBNEW (OrcadPcb2 + commentaires et liste des nets)
|
|
||||||
* si with_pcbnew = FALSE
|
|
||||||
* Format ORCADPCB2 strict
|
|
||||||
*/
|
*/
|
||||||
|
static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame,
|
||||||
|
FILE* f,
|
||||||
|
bool with_pcbnew )
|
||||||
{
|
{
|
||||||
wxString Line, FootprintName;
|
wxString Line, FootprintName;
|
||||||
char Buf[256];
|
char Buf[256];
|
||||||
|
@ -539,40 +555,51 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
|
||||||
|
|
||||||
|
|
||||||
/* Create netlist module section */
|
/* Create netlist module section */
|
||||||
ClearUsedFlags(); /* Reset the flags FlagControlMulti in all schematic files*/
|
ClearUsedFlags(); /* Reset the flags FlagControlMulti in all schematic
|
||||||
|
*files*/
|
||||||
|
|
||||||
EDA_SheetList SheetList;
|
EDA_SheetList SheetList;
|
||||||
|
|
||||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
for( sheet = SheetList.GetFirst();
|
||||||
|
sheet != NULL;
|
||||||
|
sheet = SheetList.GetNext() )
|
||||||
{
|
{
|
||||||
for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Next() )
|
for( DrawList = sheet->LastDrawList();
|
||||||
|
DrawList != NULL;
|
||||||
|
DrawList = DrawList->Next() )
|
||||||
{
|
{
|
||||||
DrawList = Component = FindNextComponentAndCreatPinList( DrawList, sheet );
|
DrawList = Component = FindNextComponentAndCreatPinList( DrawList,
|
||||||
|
sheet );
|
||||||
if( Component == NULL )
|
if( Component == NULL )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Get the Component FootprintFilter and put the component in CmpList if filter is not void */
|
/* Get the Component FootprintFilter and put the component in
|
||||||
|
*CmpList if filter is not void */
|
||||||
LIB_COMPONENT* Entry =
|
LIB_COMPONENT* Entry =
|
||||||
CMP_LIBRARY::FindLibraryComponent( Component->m_ChipName );
|
CMP_LIBRARY::FindLibraryComponent( Component->m_ChipName );
|
||||||
|
|
||||||
if( Entry != NULL )
|
if( Entry != NULL )
|
||||||
{
|
{
|
||||||
if( Entry->m_FootprintList.GetCount() != 0 ) /* Put in list */
|
if( Entry->m_FootprintList.GetCount() != 0 ) /* Put in list
|
||||||
|
**/
|
||||||
{
|
{
|
||||||
if( CmpList == NULL )
|
if( CmpList == NULL )
|
||||||
{
|
{
|
||||||
CmpList = (OBJ_CMP_TO_LIST*)
|
CmpList = (OBJ_CMP_TO_LIST*)
|
||||||
MyZMalloc( sizeof(OBJ_CMP_TO_LIST) * CmpListSize );
|
MyZMalloc( sizeof(OBJ_CMP_TO_LIST) *
|
||||||
|
CmpListSize );
|
||||||
}
|
}
|
||||||
if( CmpListCount >= CmpListSize )
|
if( CmpListCount >= CmpListSize )
|
||||||
{
|
{
|
||||||
CmpListSize += 1000;
|
CmpListSize += 1000;
|
||||||
CmpList = (OBJ_CMP_TO_LIST*) realloc(
|
CmpList =
|
||||||
CmpList,
|
(OBJ_CMP_TO_LIST*) realloc( CmpList,
|
||||||
sizeof(OBJ_CMP_TO_LIST) * CmpListSize );
|
sizeof(OBJ_CMP_TO_LIST)
|
||||||
|
* CmpListSize );
|
||||||
}
|
}
|
||||||
CmpList[CmpListCount].m_RootCmp = Component;
|
CmpList[CmpListCount].m_RootCmp = Component;
|
||||||
strcpy( CmpList[CmpListCount].m_Reference, Component->GetRef( sheet ).mb_str() );
|
strcpy( CmpList[CmpListCount].m_Reference,
|
||||||
|
Component->GetRef( sheet ).mb_str() );
|
||||||
CmpListCount++;
|
CmpListCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -587,8 +614,8 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
|
||||||
|
|
||||||
Line = Component->GetRef( sheet );
|
Line = Component->GetRef( sheet );
|
||||||
fprintf( f, " ( %s %s",
|
fprintf( f, " ( %s %s",
|
||||||
CONV_TO_UTF8( Component->GetPath( sheet ) ),
|
CONV_TO_UTF8( Component->GetPath( sheet ) ),
|
||||||
CONV_TO_UTF8( FootprintName ) );
|
CONV_TO_UTF8( FootprintName ) );
|
||||||
fprintf( f, " %s", CONV_TO_UTF8( Line ) );
|
fprintf( f, " %s", CONV_TO_UTF8( Line ) );
|
||||||
|
|
||||||
Line = Component->GetField( VALUE )->m_Text;
|
Line = Component->GetField( VALUE )->m_Text;
|
||||||
|
@ -615,7 +642,7 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
|
||||||
netname.Replace( wxT( " " ), wxT( "_" ) );
|
netname.Replace( wxT( " " ), wxT( "_" ) );
|
||||||
|
|
||||||
fprintf( f, " ( %4.4s %s )\n", (char*) &Pin->m_PinNum,
|
fprintf( f, " ( %4.4s %s )\n", (char*) &Pin->m_PinNum,
|
||||||
CONV_TO_UTF8( netname ) );
|
CONV_TO_UTF8( netname ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf( f, " )\n" );
|
fprintf( f, " )\n" );
|
||||||
|
@ -638,7 +665,10 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
|
||||||
|
|
||||||
//Line.Printf(_("%s"), CmpList[ii].m_Ref);
|
//Line.Printf(_("%s"), CmpList[ii].m_Ref);
|
||||||
//Line.Replace( wxT( " " ), wxT( "_" ) );
|
//Line.Replace( wxT( " " ), wxT( "_" ) );
|
||||||
for( unsigned nn = 0; nn<sizeof(CmpList[ii].m_Reference) && CmpList[ii].m_Reference[nn]; nn++ )
|
for( unsigned nn = 0;
|
||||||
|
nn<sizeof(CmpList[ii].m_Reference)
|
||||||
|
&& CmpList[ii].m_Reference[nn];
|
||||||
|
nn++ )
|
||||||
{
|
{
|
||||||
if( CmpList[ii].m_Reference[nn] == ' ' )
|
if( CmpList[ii].m_Reference[nn] == ' ' )
|
||||||
CmpList[ii].m_Reference[nn] = '_';
|
CmpList[ii].m_Reference[nn] = '_';
|
||||||
|
@ -669,15 +699,13 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************************/
|
/*
|
||||||
|
* Add a new pin description in the pin list s_SortedComponentPinList
|
||||||
|
* a pin description is a pointer to the corresponding structure
|
||||||
|
* created by BuildNetList() in the table g_NetObjectslist
|
||||||
|
*/
|
||||||
static void AddPinToComponentPinList( SCH_COMPONENT* Component,
|
static void AddPinToComponentPinList( SCH_COMPONENT* Component,
|
||||||
DrawSheetPath* sheetlist, LIB_PIN* Pin )
|
DrawSheetPath* sheetlist, LIB_PIN* Pin )
|
||||||
/*************************************************************************************/
|
|
||||||
|
|
||||||
/* Add a new pin description in the pin list s_SortedComponentPinList
|
|
||||||
* a pin description is a pointer to the corresponding structure
|
|
||||||
* created by BuildNetList() in the table g_NetObjectslist
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
/* Search the PIN description for Pin in g_NetObjectslist*/
|
/* Search the PIN description for Pin in g_NetObjectslist*/
|
||||||
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
|
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
|
||||||
|
@ -691,63 +719,70 @@ static void AddPinToComponentPinList( SCH_COMPONENT* Component,
|
||||||
if( g_NetObjectslist[ii]->m_PinNum != Pin->m_PinNum )
|
if( g_NetObjectslist[ii]->m_PinNum != Pin->m_PinNum )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
s_SortedComponentPinList.push_back(g_NetObjectslist[ii]);
|
s_SortedComponentPinList.push_back( g_NetObjectslist[ii] );
|
||||||
if( s_SortedComponentPinList.size() >= MAXPIN )
|
if( s_SortedComponentPinList.size() >= MAXPIN )
|
||||||
{
|
{
|
||||||
/* Log message for Internal error */
|
/* Log message for Internal error */
|
||||||
DisplayError( NULL, wxT( "AddPinToComponentPinList err: MAXPIN reached" ) );
|
DisplayError( NULL,
|
||||||
|
wxT( "AddPinToComponentPinList err: MAXPIN reached" ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************/
|
|
||||||
static void EraseDuplicatePins( NETLIST_OBJECT_LIST& aPinList )
|
|
||||||
/**********************************************************************/
|
|
||||||
|
|
||||||
/** Function EraseDuplicatePins
|
/** Function EraseDuplicatePins
|
||||||
* Function to remove duplicate Pins in the TabPin pin list
|
* Function to remove duplicate Pins in the TabPin pin list
|
||||||
* (This is a list of pins found in the whole schematic, for a given component)
|
* (This is a list of pins found in the whole schematic, for a given
|
||||||
|
* component)
|
||||||
* These duplicate pins were put in list because some pins (powers... )
|
* These duplicate pins were put in list because some pins (powers... )
|
||||||
* are found more than one time when we have a multiple parts per package component
|
* are found more than one time when we have a multiple parts per package
|
||||||
* for instance, a 74ls00 has 4 parts, and therefore the VCC pin and GND pin appears 4 times
|
* component
|
||||||
|
* for instance, a 74ls00 has 4 parts, and therefore the VCC pin and GND pin
|
||||||
|
* appears 4 times
|
||||||
* in the list.
|
* in the list.
|
||||||
* @param aPinList = a NETLIST_OBJECT_LIST that contains the list of pins for a given component.
|
* @param aPinList = a NETLIST_OBJECT_LIST that contains the list of pins for a
|
||||||
|
* given component.
|
||||||
* Note: this list *MUST* be sorted by pin number (.m_PinNum member value)
|
* Note: this list *MUST* be sorted by pin number (.m_PinNum member value)
|
||||||
*/
|
*/
|
||||||
|
static void EraseDuplicatePins( NETLIST_OBJECT_LIST& aPinList )
|
||||||
{
|
{
|
||||||
if ( aPinList.size() == 0 ) // Trivial case: compônent with no pin
|
if( aPinList.size() == 0 ) // Trivial case: component with no pin
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < aPinList.size(); ii++ )
|
for( unsigned ii = 0; ii < aPinList.size(); ii++ )
|
||||||
{
|
{
|
||||||
if( aPinList[ii] == NULL ) /* already deleted */
|
if( aPinList[ii] == NULL ) /* already deleted */
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Search for duplicated pins
|
/* Search for duplicated pins
|
||||||
* If found, remove duplicates. The priority is to keep connected pins and remove unconnected
|
* If found, remove duplicates. The priority is to keep connected pins
|
||||||
|
* and remove unconnected
|
||||||
* - So this allows (for instance when using multi op amps per package
|
* - So this allows (for instance when using multi op amps per package
|
||||||
* - to connect only one op amp to power
|
* - to connect only one op amp to power
|
||||||
* Because the pin list is sorted by m_PinNum value, duplicated pins are necessary successive in list
|
* Because the pin list is sorted by m_PinNum value, duplicated pins
|
||||||
*/
|
* are necessary successive in list
|
||||||
|
*/
|
||||||
int idxref = ii;
|
int idxref = ii;
|
||||||
for( unsigned jj = ii + 1; jj < aPinList.size(); jj++ )
|
for( unsigned jj = ii + 1; jj < aPinList.size(); jj++ )
|
||||||
{
|
{
|
||||||
if ( aPinList[jj] == NULL ) // Already removed
|
if( aPinList[jj] == NULL ) // Already removed
|
||||||
continue;
|
continue;
|
||||||
if( aPinList[idxref]->m_PinNum != aPinList[jj]->m_PinNum ) // other pin num => end of duplicate list
|
// other pin num end of duplicate list.
|
||||||
|
if( aPinList[idxref]->m_PinNum != aPinList[jj]->m_PinNum )
|
||||||
break;
|
break;
|
||||||
if ( aPinList[idxref]->m_FlagOfConnection == PAD_CONNECT )
|
if( aPinList[idxref]->m_FlagOfConnection == PAD_CONNECT )
|
||||||
aPinList[jj] = NULL;
|
aPinList[jj] = NULL;
|
||||||
else
|
else /* the reference pin is not connected: remove this pin if the
|
||||||
{ /* the reference pin is not connected: remove this pin if the other pin is connected */
|
* other pin is connected */
|
||||||
if ( aPinList[jj]->m_FlagOfConnection == PAD_CONNECT )
|
{
|
||||||
|
if( aPinList[jj]->m_FlagOfConnection == PAD_CONNECT )
|
||||||
{
|
{
|
||||||
aPinList[idxref] = NULL;
|
aPinList[idxref] = NULL;
|
||||||
idxref = jj;
|
idxref = jj;
|
||||||
}
|
}
|
||||||
else // the 2 pins are not connected: remove the tested pin, and continue ...
|
else // the 2 pins are not connected: remove the tested pin,
|
||||||
|
// and continue ...
|
||||||
aPinList[jj] = NULL;
|
aPinList[jj] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -798,12 +833,12 @@ static void FindAllsInstancesOfComponent( SCH_COMPONENT* Component_in,
|
||||||
wxASSERT( pin->Type() == COMPONENT_PIN_DRAW_TYPE );
|
wxASSERT( pin->Type() == COMPONENT_PIN_DRAW_TYPE );
|
||||||
|
|
||||||
if( pin->m_Unit
|
if( pin->m_Unit
|
||||||
&& ( pin->m_Unit != Component2->GetUnitSelection( sheet ) ) )
|
&& ( pin->m_Unit != Component2->GetUnitSelection( sheet ) ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( pin->m_Convert
|
if( pin->m_Convert
|
||||||
&& ( pin->m_Convert != Component2->m_Convert ) )
|
&& ( pin->m_Convert != Component2->m_Convert ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// A suitable pin in found: add it to the current list
|
// A suitable pin in found: add it to the current list
|
||||||
AddPinToComponentPinList( Component2, sheet, pin );
|
AddPinToComponentPinList( Component2, sheet, pin );
|
||||||
|
@ -814,16 +849,15 @@ static void FindAllsInstancesOfComponent( SCH_COMPONENT* Component_in,
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Routine de comparaison pour le tri des pins par numero croissant
|
* Comparison routine for sorting by pin numbers.
|
||||||
* du tableau des pins s_SortedComponentPinList par qsort()
|
|
||||||
*/
|
*/
|
||||||
static bool SortPinsByNum( NETLIST_OBJECT* Pin1, NETLIST_OBJECT* Pin2 )
|
static bool SortPinsByNum( NETLIST_OBJECT* Pin1, NETLIST_OBJECT* Pin2 )
|
||||||
{
|
{
|
||||||
int Num1, Num2;
|
int Num1, Num2;
|
||||||
char Line[5];
|
char Line[5];
|
||||||
|
|
||||||
Num1 = Pin1->m_PinNum;
|
Num1 = Pin1->m_PinNum;
|
||||||
Num2 = Pin2->m_PinNum;
|
Num2 = Pin2->m_PinNum;
|
||||||
Line[4] = 0;
|
Line[4] = 0;
|
||||||
memcpy( Line, &Num1, 4 ); Num1 = atoi( Line );
|
memcpy( Line, &Num1, 4 ); Num1 = atoi( Line );
|
||||||
memcpy( Line, &Num2, 4 ); Num2 = atoi( Line );
|
memcpy( Line, &Num2, 4 ); Num2 = atoi( Line );
|
||||||
|
@ -831,13 +865,10 @@ static bool SortPinsByNum( NETLIST_OBJECT* Pin1, NETLIST_OBJECT* Pin2 )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/* Written in the file / net list (ranked by Netcode), and elements that are
|
||||||
static void WriteGENERICListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
|
* connected
|
||||||
/*************************************************************************/
|
|
||||||
|
|
||||||
/* Ecrit dans le fichier f la liste des nets ( classee par NetCodes ), et des
|
|
||||||
* elements qui y sont connectes
|
|
||||||
*/
|
*/
|
||||||
|
static void WriteGENERICListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
|
||||||
{
|
{
|
||||||
int NetCode, LastNetCode = -1;
|
int NetCode, LastNetCode = -1;
|
||||||
int SameNetcodeCount = 0;
|
int SameNetcodeCount = 0;
|
||||||
|
@ -848,12 +879,15 @@ static void WriteGENERICListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < aObjectsList.size(); ii++ )
|
for( unsigned ii = 0; ii < aObjectsList.size(); ii++ )
|
||||||
{
|
{
|
||||||
if( ( NetCode = aObjectsList[ii]->GetNet() ) != LastNetCode ) // New net found, write net id;
|
// New net found, write net id;
|
||||||
|
if( ( NetCode = aObjectsList[ii]->GetNet() ) != LastNetCode )
|
||||||
{
|
{
|
||||||
SameNetcodeCount = 0; // Items count for this net
|
SameNetcodeCount = 0; // Items count for this net
|
||||||
NetName.Empty();
|
NetName.Empty();
|
||||||
unsigned jj;
|
unsigned jj;
|
||||||
for( jj = 0; jj < aObjectsList.size(); jj++ ) // Find a label (if exists) for this net
|
|
||||||
|
// Find a label (if exists) for this net.
|
||||||
|
for( jj = 0; jj < aObjectsList.size(); jj++ )
|
||||||
{
|
{
|
||||||
if( aObjectsList[jj]->GetNet() != NetCode )
|
if( aObjectsList[jj]->GetNet() != NetCode )
|
||||||
continue;
|
continue;
|
||||||
|
@ -873,13 +907,15 @@ static void WriteGENERICListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
|
||||||
if( aObjectsList[jj]->m_Type != NET_PINLABEL )
|
if( aObjectsList[jj]->m_Type != NET_PINLABEL )
|
||||||
{
|
{
|
||||||
// usual net name, prefix it by the sheet path
|
// usual net name, prefix it by the sheet path
|
||||||
NetcodeName += aObjectsList[jj]->m_SheetList.PathHumanReadable();
|
NetcodeName +=
|
||||||
|
aObjectsList[jj]->m_SheetList.PathHumanReadable();
|
||||||
}
|
}
|
||||||
NetcodeName += NetName;
|
NetcodeName += NetName;
|
||||||
}
|
}
|
||||||
NetcodeName += wxT( "\"" );
|
NetcodeName += wxT( "\"" );
|
||||||
|
|
||||||
// Add the netname without prefix, in cases we need only the "short" netname
|
// Add the netname without prefix, in cases we need only the
|
||||||
|
// "short" netname
|
||||||
NetcodeName += wxT( " \"" ) + NetName + wxT( "\"" );
|
NetcodeName += wxT( " \"" ) + NetName + wxT( "\"" );
|
||||||
LastNetCode = NetCode;
|
LastNetCode = NetCode;
|
||||||
}
|
}
|
||||||
|
@ -887,20 +923,26 @@ static void WriteGENERICListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
|
||||||
if( aObjectsList[ii]->m_Type != NET_PIN )
|
if( aObjectsList[ii]->m_Type != NET_PIN )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Cmp = (SCH_COMPONENT*) aObjectsList[ii]->m_Link;
|
Cmp = (SCH_COMPONENT*) aObjectsList[ii]->m_Link;
|
||||||
CmpRef = Cmp->GetRef( &aObjectsList[ii]->m_SheetList ); // Get the reference for thenetname and the main parent component
|
|
||||||
|
// Get the reference for the net name and the main parent component
|
||||||
|
CmpRef = Cmp->GetRef( &aObjectsList[ii]->m_SheetList );
|
||||||
if( CmpRef.StartsWith( wxT( "#" ) ) )
|
if( CmpRef.StartsWith( wxT( "#" ) ) )
|
||||||
continue; // Pseudo component (Like Power symbol)
|
continue; // Pseudo component (Like Power symbol)
|
||||||
|
|
||||||
// Print the pin list for this net, if 2 or more items are connected:
|
// Print the pin list for this net, if 2 or more items are connected:
|
||||||
SameNetcodeCount++;
|
SameNetcodeCount++;
|
||||||
if( SameNetcodeCount == 1 ) /* first item for this net found,
|
if( SameNetcodeCount == 1 ) /* first item for this net found,
|
||||||
* Print this connection, when a second item will be found */
|
* Print this connection, when a
|
||||||
|
* second item will be found */
|
||||||
{
|
{
|
||||||
sprintf( FirstItemInNet, " %s %.4s\n", CONV_TO_UTF8( CmpRef ),
|
sprintf( FirstItemInNet, " %s %.4s\n", CONV_TO_UTF8( CmpRef ),
|
||||||
(const char*) &aObjectsList[ii]->m_PinNum );
|
(const char*) &aObjectsList[ii]->m_PinNum );
|
||||||
}
|
}
|
||||||
if( SameNetcodeCount == 2 ) // Second item for this net found, Print the Net name, and the first item
|
|
||||||
|
// Second item for this net found, Print the Net name, and the
|
||||||
|
// first item
|
||||||
|
if( SameNetcodeCount == 2 )
|
||||||
{
|
{
|
||||||
fprintf( f, "%s\n", CONV_TO_UTF8( NetcodeName ) );
|
fprintf( f, "%s\n", CONV_TO_UTF8( NetcodeName ) );
|
||||||
fputs( FirstItemInNet, f );
|
fputs( FirstItemInNet, f );
|
||||||
|
@ -913,39 +955,37 @@ static void WriteGENERICListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Generation des netlistes au format CadStar */
|
/* Generate CADSTAR net list. */
|
||||||
wxString StartLine( wxT( "." ) );
|
wxString StartLine( wxT( "." ) );
|
||||||
|
|
||||||
/*********************************************************/
|
|
||||||
static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f )
|
|
||||||
/*********************************************************/
|
|
||||||
|
|
||||||
/* Routine de generation du fichier netliste ( Format CADSTAR )
|
/* Routine generation of the netlist file (CADSTAR Format)
|
||||||
* Entete:
|
* Header:
|
||||||
* ..HEA
|
* HEA ..
|
||||||
* ..TIM 2004 07 29 16 22 17
|
* TIM .. 2004 07 29 16 22 17
|
||||||
* ..APP "Cadstar RINF Output - Version 6.0.2.3"
|
* APA .. "Cadstar RINF Output - Version 6.0.2.3"
|
||||||
* ..UNI INCH 1000.0 in
|
* INCH UNI .. 1000.0 in
|
||||||
* ..TYP FULL
|
* FULL TYP ..
|
||||||
*
|
*
|
||||||
* liste des composants:
|
* List of components:
|
||||||
* ..ADD_COM X1 "CNT D41612 (48PTS MC CONTOUR)"
|
* .. ADD_COM X1 "CNT D41612 (48pts CONTOUR TM)"
|
||||||
* ..ADD_COM U2 "74HCT245D" "74HCT245D"
|
* .. ADD_COM U2 "74HCT245D" "74HCT245D"
|
||||||
*
|
*
|
||||||
* Connexions:
|
* Connections:
|
||||||
* ..ADD_TER RR2 6 "$42"
|
* .. ADD_TER RR2 * 6 "$ 42"
|
||||||
* ..TER U1 100
|
* .. B U1 100
|
||||||
* CA 6
|
* 6 CA
|
||||||
*
|
*
|
||||||
* ..ADD_TER U2 6 "$59"
|
* ADD_TER .. U2 * 6 "$ 59"
|
||||||
* ..TER U7 39
|
* .. B * U7 39
|
||||||
* U6 17
|
* U6 17
|
||||||
* U1 122
|
* U1 * 122
|
||||||
*
|
*
|
||||||
* ..ADD_TER P2 1 "$9"
|
* .. ADD_TER P2 * 1 "$ 9"
|
||||||
* ..TER T3 1
|
* .. B * T3 1
|
||||||
* U1 14
|
*U1 * 14
|
||||||
*/
|
*/
|
||||||
|
static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f )
|
||||||
{
|
{
|
||||||
wxString StartCmpDesc = StartLine + wxT( "ADD_COM" );
|
wxString StartCmpDesc = StartLine + wxT( "ADD_COM" );
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
@ -964,14 +1004,20 @@ static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f )
|
||||||
fprintf( f, "\n" );
|
fprintf( f, "\n" );
|
||||||
|
|
||||||
/* Create netlist module section */
|
/* Create netlist module section */
|
||||||
ClearUsedFlags(); /* Reset the flags FlagControlMulti in all schematic files*/
|
ClearUsedFlags(); /* Reset the flags FlagControlMulti in all schematic
|
||||||
|
*files*/
|
||||||
EDA_SheetList SheetList;
|
EDA_SheetList SheetList;
|
||||||
|
|
||||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
for( sheet = SheetList.GetFirst();
|
||||||
|
sheet != NULL;
|
||||||
|
sheet = SheetList.GetNext() )
|
||||||
{
|
{
|
||||||
for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Next() )
|
for( DrawList = sheet->LastDrawList();
|
||||||
|
DrawList != NULL;
|
||||||
|
DrawList = DrawList->Next() )
|
||||||
{
|
{
|
||||||
DrawList = Component = FindNextComponentAndCreatPinList( DrawList, sheet );
|
DrawList = Component = FindNextComponentAndCreatPinList( DrawList,
|
||||||
|
sheet );
|
||||||
if( Component == NULL )
|
if( Component == NULL )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1004,17 +1050,15 @@ static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*
|
||||||
static void WriteListOfNetsCADSTAR( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
|
* Written in the file / net list (ranked by Netcode), and
|
||||||
/*************************************************************************/
|
* Pins connected to it
|
||||||
|
* Format:
|
||||||
/* Ecrit dans le fichier f la liste des nets ( classee par NetCodes ), et des
|
*. ADD_TER RR2 6 "$ 42"
|
||||||
* pins qui y sont connectes
|
*. B U1 100
|
||||||
* format:
|
* 6 CA
|
||||||
* .ADD_TER RR2 6 "$42"
|
|
||||||
* .TER U1 100
|
|
||||||
* CA 6
|
|
||||||
*/
|
*/
|
||||||
|
static void WriteListOfNetsCADSTAR( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
|
||||||
{
|
{
|
||||||
wxString InitNetDesc = StartLine + wxT( "ADD_TER" );
|
wxString InitNetDesc = StartLine + wxT( "ADD_TER" );
|
||||||
wxString StartNetDesc = StartLine + wxT( "TER" );
|
wxString StartNetDesc = StartLine + wxT( "TER" );
|
||||||
|
@ -1052,11 +1096,12 @@ static void WriteListOfNetsCADSTAR( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
|
||||||
NetcodeName += NetName;
|
NetcodeName += NetName;
|
||||||
if( aObjectsList[jj]->m_Type != NET_PINLABEL )
|
if( aObjectsList[jj]->m_Type != NET_PINLABEL )
|
||||||
{
|
{
|
||||||
NetcodeName = aObjectsList[jj]->m_SheetList.PathHumanReadable()
|
NetcodeName =
|
||||||
+ NetcodeName;
|
aObjectsList[jj]->m_SheetList.PathHumanReadable()
|
||||||
|
+ NetcodeName;
|
||||||
|
|
||||||
//NetcodeName << wxT("_") <<
|
//NetcodeName << wxT("_") <<
|
||||||
// g_NetObjectslist[jj].m_SheetList.PathHumanReadable();
|
// g_NetObjectslist[jj].m_SheetList.PathHumanReadable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // this net has no name: create a default name $<net number>
|
else // this net has no name: create a default name $<net number>
|
||||||
|
@ -1076,7 +1121,7 @@ static void WriteListOfNetsCADSTAR( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
|
||||||
Cmp = (SCH_COMPONENT*) aObjectsList[ii]->m_Link;
|
Cmp = (SCH_COMPONENT*) aObjectsList[ii]->m_Link;
|
||||||
wxString refstr = Cmp->GetRef( &(aObjectsList[ii]->m_SheetList) );
|
wxString refstr = Cmp->GetRef( &(aObjectsList[ii]->m_SheetList) );
|
||||||
if( refstr[0] == '#' )
|
if( refstr[0] == '#' )
|
||||||
continue; // Pseudo composant (symboles d'alims)
|
continue; // Power supply symbols.
|
||||||
|
|
||||||
switch( print_ter )
|
switch( print_ter )
|
||||||
{
|
{
|
||||||
|
@ -1085,12 +1130,13 @@ static void WriteListOfNetsCADSTAR( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
|
||||||
char buf[5];
|
char buf[5];
|
||||||
wxString str_pinnum;
|
wxString str_pinnum;
|
||||||
strncpy( buf, (char*) &aObjectsList[ii]->m_PinNum, 4 );
|
strncpy( buf, (char*) &aObjectsList[ii]->m_PinNum, 4 );
|
||||||
buf[4] = 0;
|
buf[4] = 0;
|
||||||
str_pinnum = CONV_FROM_UTF8( buf );
|
str_pinnum = CONV_FROM_UTF8( buf );
|
||||||
InitNetDescLine.Printf( wxT( "\n%s %s %.4s %s" ),
|
InitNetDescLine.Printf( wxT( "\n%s %s %.4s %s" ),
|
||||||
InitNetDesc.GetData(),
|
InitNetDesc.GetData(),
|
||||||
refstr.GetData(),
|
refstr.GetData(),
|
||||||
str_pinnum.GetData(), NetcodeName.GetData() );
|
str_pinnum.GetData(),
|
||||||
|
NetcodeName.GetData() );
|
||||||
}
|
}
|
||||||
print_ter++;
|
print_ter++;
|
||||||
break;
|
break;
|
||||||
|
@ -1113,8 +1159,8 @@ static void WriteListOfNetsCADSTAR( FILE* f, NETLIST_OBJECT_LIST& aObjectsList )
|
||||||
|
|
||||||
aObjectsList[ii]->m_Flag = 1;
|
aObjectsList[ii]->m_Flag = 1;
|
||||||
|
|
||||||
// Recherche des pins redondantes et mise a 1 de m_Flag,
|
// Search for redundant pins to avoid generation the same connection
|
||||||
// pour ne pas generer plusieurs fois la connexion
|
// more than once.
|
||||||
for( jj = ii + 1; jj < aObjectsList.size(); jj++ )
|
for( jj = ii + 1; jj < aObjectsList.size(); jj++ )
|
||||||
{
|
{
|
||||||
if( aObjectsList[jj]->GetNet() != NetCode )
|
if( aObjectsList[jj]->GetNet() != NetCode )
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
/***********************************/
|
/*****************/
|
||||||
/* Module de calcul de la Netliste */
|
/* netlist.cpp */
|
||||||
/***********************************/
|
/*****************/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include "program.h"
|
#include "program.h"
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
#include "netlist.h" /* Definitions generales liees au calcul de netliste */
|
#include "netlist.h"
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
#include "class_library.h"
|
#include "class_library.h"
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@ NETLIST_OBJECT_LIST g_NetObjectslist;
|
||||||
|
|
||||||
//#define NETLIST_DEBUG
|
//#define NETLIST_DEBUG
|
||||||
|
|
||||||
/* Routines locales */
|
|
||||||
static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus );
|
static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus );
|
||||||
static void SheetLabelConnect( NETLIST_OBJECT* SheetLabel );
|
static void SheetLabelConnect( NETLIST_OBJECT* SheetLabel );
|
||||||
static void ListeObjetConnection( DrawSheetPath* sheetlist,
|
static void ListeObjetConnection( DrawSheetPath* sheetlist,
|
||||||
|
@ -35,34 +34,33 @@ static void ConnectBusLabels( NETLIST_OBJECT_LIST& aNetItemBuffer );
|
||||||
static void SetUnconnectedFlag( NETLIST_OBJECT_LIST& aNetItemBuffer );
|
static void SetUnconnectedFlag( NETLIST_OBJECT_LIST& aNetItemBuffer );
|
||||||
|
|
||||||
// Sort functions used here:
|
// Sort functions used here:
|
||||||
static bool SortItemsbyNetcode( const NETLIST_OBJECT* Objet1, const NETLIST_OBJECT* Objet2 );
|
static bool SortItemsbyNetcode( const NETLIST_OBJECT* Objet1,
|
||||||
static bool SortItemsBySheet( const NETLIST_OBJECT* Objet1, const NETLIST_OBJECT* Objet2 );
|
const NETLIST_OBJECT* Objet2 );
|
||||||
|
static bool SortItemsBySheet( const NETLIST_OBJECT* Objet1,
|
||||||
|
const NETLIST_OBJECT* Objet2 );
|
||||||
|
|
||||||
/* Variable locales */
|
|
||||||
static int FirstNumWireBus, LastNumWireBus, RootBusNameLength;
|
static int FirstNumWireBus, LastNumWireBus, RootBusNameLength;
|
||||||
static int LastNetCode, LastBusNetCode;
|
static int LastNetCode, LastBusNetCode;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
void dumpNetTable()
|
void dumpNetTable()
|
||||||
{
|
{
|
||||||
for( unsigned idx = 0; idx < g_NetObjectslist.size(); ++idx )
|
for( unsigned idx = 0; idx < g_NetObjectslist.size(); ++idx )
|
||||||
{
|
{
|
||||||
g_NetObjectslist[idx]->Show( std::cout, idx );
|
g_NetObjectslist[idx]->Show( std::cout, idx );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*********************************************************************/
|
|
||||||
void FreeNetObjectsList( NETLIST_OBJECT_LIST& aNetObjectsBuffer )
|
|
||||||
/*********************************************************************/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Routine de liberation memoire des tableaux utilises pour le calcul
|
* Routine to free memory used to calculate the netlist TabNetItems = pointer
|
||||||
* de la netliste
|
* to the main table (list items)
|
||||||
* TabNetItems = pointeur sur le tableau principal (liste des items )
|
|
||||||
*/
|
*/
|
||||||
|
void FreeNetObjectsList( NETLIST_OBJECT_LIST& aNetObjectsBuffer )
|
||||||
{
|
{
|
||||||
for( unsigned i = 0; i < aNetObjectsBuffer.size(); i++ )
|
for( unsigned i = 0; i < aNetObjectsBuffer.size(); i++ )
|
||||||
delete aNetObjectsBuffer[i];
|
delete aNetObjectsBuffer[i];
|
||||||
|
@ -71,15 +69,13 @@ void FreeNetObjectsList( NETLIST_OBJECT_LIST& aNetObjectsBuffer )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/*
|
||||||
void WinEDA_SchematicFrame::BuildNetListBase()
|
* Build net list connection table.
|
||||||
/************************************************************************/
|
*
|
||||||
|
* Updates:
|
||||||
/* Routine qui construit le tableau des elements connectes du projet
|
* g_NetObjectslist
|
||||||
* met a jour:
|
|
||||||
* g_NetObjectslist
|
|
||||||
* g_NetObjectslist
|
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_SchematicFrame::BuildNetListBase()
|
||||||
{
|
{
|
||||||
int NetNumber;
|
int NetNumber;
|
||||||
int NetCode;
|
int NetCode;
|
||||||
|
@ -104,10 +100,11 @@ void WinEDA_SchematicFrame::BuildNetListBase()
|
||||||
ListeObjetConnection( sheet, g_NetObjectslist );
|
ListeObjetConnection( sheet, g_NetObjectslist );
|
||||||
|
|
||||||
if( g_NetObjectslist.size() == 0 )
|
if( g_NetObjectslist.size() == 0 )
|
||||||
return; // no objects
|
return; // no objects
|
||||||
|
|
||||||
activity.Empty();
|
activity.Empty();
|
||||||
activity << wxT( " " ) << _( "NbItems" ) << wxT( " " ) << g_NetObjectslist.size();
|
activity << wxT( " " ) << _( "NbItems" ) << wxT( " " ) <<
|
||||||
|
g_NetObjectslist.size();
|
||||||
SetStatusText( activity );
|
SetStatusText( activity );
|
||||||
|
|
||||||
/* Sort objects by Sheet */
|
/* Sort objects by Sheet */
|
||||||
|
@ -125,24 +122,25 @@ void WinEDA_SchematicFrame::BuildNetListBase()
|
||||||
NETLIST_OBJECT* net_item = g_NetObjectslist[ii];
|
NETLIST_OBJECT* net_item = g_NetObjectslist[ii];
|
||||||
if( net_item->m_SheetList != *sheet ) // Sheet change
|
if( net_item->m_SheetList != *sheet ) // Sheet change
|
||||||
{
|
{
|
||||||
sheet = &(net_item->m_SheetList);
|
sheet = &(net_item->m_SheetList);
|
||||||
istart = ii;
|
istart = ii;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( net_item->m_Type )
|
switch( net_item->m_Type )
|
||||||
{
|
{
|
||||||
case NET_ITEM_UNSPECIFIED:
|
case NET_ITEM_UNSPECIFIED:
|
||||||
wxMessageBox(wxT("BuildNetListBase() error"));
|
wxMessageBox( wxT( "BuildNetListBase() error" ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NET_PIN:
|
case NET_PIN:
|
||||||
case NET_PINLABEL:
|
case NET_PINLABEL:
|
||||||
case NET_SHEETLABEL:
|
case NET_SHEETLABEL:
|
||||||
case NET_NOCONNECT:
|
case NET_NOCONNECT:
|
||||||
if( net_item->GetNet() != 0 )
|
if( net_item->GetNet() != 0 )
|
||||||
break; /* Deja connecte */
|
break;
|
||||||
|
|
||||||
case NET_SEGMENT:
|
case NET_SEGMENT:
|
||||||
/* Controle des connexions type point a point ( Sans BUS ) */
|
/* Control connections point to point type without bus. */
|
||||||
if( net_item->GetNet() == 0 )
|
if( net_item->GetNet() == 0 )
|
||||||
{
|
{
|
||||||
net_item->SetNet( LastNetCode );
|
net_item->SetNet( LastNetCode );
|
||||||
|
@ -152,7 +150,7 @@ void WinEDA_SchematicFrame::BuildNetListBase()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NET_JONCTION:
|
case NET_JONCTION:
|
||||||
/* Controle des jonction , hors BUS */
|
/* Control of the junction outside BUS. */
|
||||||
if( net_item->GetNet() == 0 )
|
if( net_item->GetNet() == 0 )
|
||||||
{
|
{
|
||||||
net_item->SetNet( LastNetCode );
|
net_item->SetNet( LastNetCode );
|
||||||
|
@ -160,7 +158,7 @@ void WinEDA_SchematicFrame::BuildNetListBase()
|
||||||
}
|
}
|
||||||
SegmentToPointConnect( net_item, 0, istart );
|
SegmentToPointConnect( net_item, 0, istart );
|
||||||
|
|
||||||
/* Controle des jonction , sur BUS */
|
/* Control of the junction, on BUS. */
|
||||||
if( net_item->m_BusNetCode == 0 )
|
if( net_item->m_BusNetCode == 0 )
|
||||||
{
|
{
|
||||||
net_item->m_BusNetCode = LastBusNetCode;
|
net_item->m_BusNetCode = LastBusNetCode;
|
||||||
|
@ -172,7 +170,7 @@ void WinEDA_SchematicFrame::BuildNetListBase()
|
||||||
case NET_LABEL:
|
case NET_LABEL:
|
||||||
case NET_HIERLABEL:
|
case NET_HIERLABEL:
|
||||||
case NET_GLOBLABEL:
|
case NET_GLOBLABEL:
|
||||||
/* Controle des connexions type jonction ( Sans BUS ) */
|
/* Control connections type junction without bus. */
|
||||||
if( net_item->GetNet() == 0 )
|
if( net_item->GetNet() == 0 )
|
||||||
{
|
{
|
||||||
net_item->SetNet( LastNetCode );
|
net_item->SetNet( LastNetCode );
|
||||||
|
@ -183,10 +181,10 @@ void WinEDA_SchematicFrame::BuildNetListBase()
|
||||||
|
|
||||||
case NET_SHEETBUSLABELMEMBER:
|
case NET_SHEETBUSLABELMEMBER:
|
||||||
if( net_item->m_BusNetCode != 0 )
|
if( net_item->m_BusNetCode != 0 )
|
||||||
break; /* Deja connecte */
|
break;
|
||||||
|
|
||||||
case NET_BUS:
|
case NET_BUS:
|
||||||
/* Controle des connexions type point a point mode BUS */
|
/* Control type connections point to point mode bus */
|
||||||
if( net_item->m_BusNetCode == 0 )
|
if( net_item->m_BusNetCode == 0 )
|
||||||
{
|
{
|
||||||
net_item->m_BusNetCode = LastBusNetCode;
|
net_item->m_BusNetCode = LastBusNetCode;
|
||||||
|
@ -198,7 +196,7 @@ void WinEDA_SchematicFrame::BuildNetListBase()
|
||||||
case NET_BUSLABELMEMBER:
|
case NET_BUSLABELMEMBER:
|
||||||
case NET_HIERBUSLABELMEMBER:
|
case NET_HIERBUSLABELMEMBER:
|
||||||
case NET_GLOBBUSLABELMEMBER:
|
case NET_GLOBBUSLABELMEMBER:
|
||||||
/* Controle des connexions semblables a des sur BUS */
|
/* Control connections similar has on BUS */
|
||||||
if( net_item->GetNet() == 0 )
|
if( net_item->GetNet() == 0 )
|
||||||
{
|
{
|
||||||
net_item->m_BusNetCode = LastBusNetCode;
|
net_item->m_BusNetCode = LastBusNetCode;
|
||||||
|
@ -218,14 +216,14 @@ void WinEDA_SchematicFrame::BuildNetListBase()
|
||||||
activity << wxT( " " ) << _( "Done" );
|
activity << wxT( " " ) << _( "Done" );
|
||||||
SetStatusText( activity );
|
SetStatusText( activity );
|
||||||
|
|
||||||
/* Mise a jour des NetCodes des Bus Labels connectes par les Bus */
|
/* Updating the Bus Labels Netcode connected by Bus */
|
||||||
ConnectBusLabels( g_NetObjectslist );
|
ConnectBusLabels( g_NetObjectslist );
|
||||||
|
|
||||||
activity << wxT( "; " ) << _( "Labels" );
|
activity << wxT( "; " ) << _( "Labels" );
|
||||||
SetStatusText( activity );
|
SetStatusText( activity );
|
||||||
|
|
||||||
/* Connections des groupes d'objets par labels identiques */
|
/* Group objects by label. */
|
||||||
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
|
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
|
||||||
{
|
{
|
||||||
switch( g_NetObjectslist[ii]->m_Type )
|
switch( g_NetObjectslist[ii]->m_Type )
|
||||||
{
|
{
|
||||||
|
@ -249,6 +247,7 @@ void WinEDA_SchematicFrame::BuildNetListBase()
|
||||||
case NET_HIERLABEL:
|
case NET_HIERLABEL:
|
||||||
case NET_HIERBUSLABELMEMBER:
|
case NET_HIERBUSLABELMEMBER:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NET_ITEM_UNSPECIFIED:
|
case NET_ITEM_UNSPECIFIED:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -262,7 +261,7 @@ void WinEDA_SchematicFrame::BuildNetListBase()
|
||||||
activity << wxT( " " ) << _( "Done" );
|
activity << wxT( " " ) << _( "Done" );
|
||||||
SetStatusText( activity );
|
SetStatusText( activity );
|
||||||
|
|
||||||
/* Connexion des hierarchies */
|
/* Connection hierarchy. */
|
||||||
activity << wxT( "; " ) << _( "Hierar." );
|
activity << wxT( "; " ) << _( "Hierar." );
|
||||||
SetStatusText( activity );
|
SetStatusText( activity );
|
||||||
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
|
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
|
||||||
|
@ -283,7 +282,7 @@ void WinEDA_SchematicFrame::BuildNetListBase()
|
||||||
activity << wxT( " " ) << _( "Done" );
|
activity << wxT( " " ) << _( "Done" );
|
||||||
SetStatusText( activity );
|
SetStatusText( activity );
|
||||||
|
|
||||||
/* Compression des numeros de NetCode a des valeurs consecutives */
|
/* Compress numbers of Netcode having consecutive values. */
|
||||||
LastNetCode = NetCode = 0;
|
LastNetCode = NetCode = 0;
|
||||||
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
|
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
|
||||||
{
|
{
|
||||||
|
@ -295,42 +294,42 @@ void WinEDA_SchematicFrame::BuildNetListBase()
|
||||||
g_NetObjectslist[ii]->SetNet( NetCode );
|
g_NetObjectslist[ii]->SetNet( NetCode );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Affectation du m_FlagOfConnection en fonction de connection ou non */
|
/* Assignment of m_FlagOfConnection based connection or not. */
|
||||||
SetUnconnectedFlag( g_NetObjectslist );
|
SetUnconnectedFlag( g_NetObjectslist );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************
|
/*
|
||||||
* Routine qui connecte les sous feuilles par les sheetLabels *
|
* Connect sheets by sheetLabels
|
||||||
**************************************************************/
|
*/
|
||||||
static void SheetLabelConnect( NETLIST_OBJECT* SheetLabel )
|
static void SheetLabelConnect( NETLIST_OBJECT* SheetLabel )
|
||||||
{
|
{
|
||||||
if( SheetLabel->GetNet() == 0 )
|
if( SheetLabel->GetNet() == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Calcul du numero de sous feuille correspondante au sheetlabel */
|
/* Calculate the number of nodes in the corresponding sheetlabel */
|
||||||
|
|
||||||
|
/* Comparison with SheetLabel GLABELS sub sheet to group Netcode */
|
||||||
|
|
||||||
/* Comparaison du SheetLabel avec les GLABELS de la sous feuille
|
|
||||||
* pour regroupement des NetCodes */
|
|
||||||
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
|
for( unsigned ii = 0; ii < g_NetObjectslist.size(); ii++ )
|
||||||
{
|
{
|
||||||
NETLIST_OBJECT* ObjetNet = g_NetObjectslist[ii];
|
NETLIST_OBJECT* ObjetNet = g_NetObjectslist[ii];
|
||||||
if( ObjetNet->m_SheetList != SheetLabel->m_SheetListInclude )
|
if( ObjetNet->m_SheetList != SheetLabel->m_SheetListInclude )
|
||||||
continue; //use SheetInclude, not the sheet!!
|
continue; //use SheetInclude, not the sheet!!
|
||||||
|
|
||||||
if( (ObjetNet->m_Type != NET_HIERLABEL )
|
if( (ObjetNet->m_Type != NET_HIERLABEL )
|
||||||
&& (ObjetNet->m_Type != NET_HIERBUSLABELMEMBER ) )
|
&& (ObjetNet->m_Type != NET_HIERBUSLABELMEMBER ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( ObjetNet->GetNet() == SheetLabel->GetNet() )
|
if( ObjetNet->GetNet() == SheetLabel->GetNet() )
|
||||||
continue; //already connected.
|
continue; //already connected.
|
||||||
|
|
||||||
wxASSERT(ObjetNet->m_Label);
|
wxASSERT( ObjetNet->m_Label );
|
||||||
wxASSERT(SheetLabel->m_Label);
|
wxASSERT( SheetLabel->m_Label );
|
||||||
if( ObjetNet->m_Label->CmpNoCase( *SheetLabel->m_Label ) != 0 )
|
if( ObjetNet->m_Label->CmpNoCase( *SheetLabel->m_Label ) != 0 )
|
||||||
continue; //different names.
|
continue; //different names.
|
||||||
|
|
||||||
/* Propagation du Netcode a tous les Objets de meme NetCode */
|
/* Propagate Netcode having all the objects of the same Netcode. */
|
||||||
if( ObjetNet->GetNet() )
|
if( ObjetNet->GetNet() )
|
||||||
PropageNetCode( ObjetNet->GetNet(), SheetLabel->GetNet(), 0 );
|
PropageNetCode( ObjetNet->GetNet(), SheetLabel->GetNet(), 0 );
|
||||||
else
|
else
|
||||||
|
@ -339,35 +338,36 @@ static void SheetLabelConnect( NETLIST_OBJECT* SheetLabel )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************************/
|
/** Function ListeObjetConnection
|
||||||
|
* Creates the list of objects related to connections (pins of components,
|
||||||
|
* wires, labels, junctions ...)
|
||||||
|
*
|
||||||
|
* @param sheetlist: pointer to a sheetlist.
|
||||||
|
* @param aNetItemBuffer: a std::vector to store pointer on NETLIST_OBJECT
|
||||||
|
* created
|
||||||
|
*/
|
||||||
static void ListeObjetConnection( DrawSheetPath* sheetlist,
|
static void ListeObjetConnection( DrawSheetPath* sheetlist,
|
||||||
std::vector<NETLIST_OBJECT*>& aNetItemBuffer )
|
std::vector<NETLIST_OBJECT*>& aNetItemBuffer )
|
||||||
/**************************************************************************************/
|
|
||||||
|
|
||||||
/** Function ListeObjetConnection
|
|
||||||
* Creates the list of objects related to connections (pins of components, wires, labels, junctions ...)
|
|
||||||
* @param sheetlist: pointer to a sheetlist.
|
|
||||||
* @param aNetItemBuffer: a std::vector to store pointer on NETLIST_OBJECT created
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
SCH_ITEM* DrawList;
|
SCH_ITEM* DrawList;
|
||||||
NETLIST_OBJECT* new_item;
|
NETLIST_OBJECT* new_item;
|
||||||
SCH_COMPONENT* DrawLibItem;
|
SCH_COMPONENT* DrawLibItem;
|
||||||
LIB_COMPONENT* Entry;
|
LIB_COMPONENT* Entry;
|
||||||
LIB_PIN* pin;
|
LIB_PIN* pin;
|
||||||
Hierarchical_PIN_Sheet_Struct* SheetLabel;
|
SCH_SHEET_PIN* SheetLabel;
|
||||||
DrawSheetPath list;
|
DrawSheetPath list;
|
||||||
|
|
||||||
DrawList = sheetlist->LastScreen()->EEDrawList;
|
DrawList = sheetlist->LastScreen()->EEDrawList;
|
||||||
for( ; DrawList; DrawList = DrawList->Next() )
|
for( ; DrawList; DrawList = DrawList->Next() )
|
||||||
{
|
{
|
||||||
switch( DrawList->Type() )
|
switch( DrawList->Type() )
|
||||||
{
|
{
|
||||||
case DRAW_SEGMENT_STRUCT_TYPE:
|
case DRAW_SEGMENT_STRUCT_TYPE:
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ( (EDA_DrawLineStruct*) DrawList )
|
#define STRUCT ( (EDA_DrawLineStruct*) DrawList )
|
||||||
if( (STRUCT->GetLayer() != LAYER_BUS) && (STRUCT->GetLayer() != LAYER_WIRE) )
|
if( (STRUCT->GetLayer() != LAYER_BUS)
|
||||||
|
&& (STRUCT->GetLayer() != LAYER_WIRE) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
new_item = new NETLIST_OBJECT();
|
new_item = new NETLIST_OBJECT();
|
||||||
|
@ -381,7 +381,7 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
|
||||||
{
|
{
|
||||||
new_item->m_Type = NET_BUS;
|
new_item->m_Type = NET_BUS;
|
||||||
}
|
}
|
||||||
else /* Cas des WIRE */
|
else /* WIRE */
|
||||||
{
|
{
|
||||||
new_item->m_Type = NET_SEGMENT;
|
new_item->m_Type = NET_SEGMENT;
|
||||||
}
|
}
|
||||||
|
@ -436,7 +436,7 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
|
||||||
new_item->m_Start = new_item->m_End = STRUCT->m_Pos;
|
new_item->m_Start = new_item->m_End = STRUCT->m_Pos;
|
||||||
|
|
||||||
aNetItemBuffer.push_back( new_item );
|
aNetItemBuffer.push_back( new_item );
|
||||||
/* Si c'est un Bus, eclatement en Label */
|
/* If a bus connects to label */
|
||||||
if( ii )
|
if( ii )
|
||||||
ConvertBusToMembers( aNetItemBuffer, *new_item );
|
ConvertBusToMembers( aNetItemBuffer, *new_item );
|
||||||
|
|
||||||
|
@ -454,8 +454,10 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
|
||||||
new_item->m_Comp = STRUCT;
|
new_item->m_Comp = STRUCT;
|
||||||
new_item->m_Type = NET_LABEL;
|
new_item->m_Type = NET_LABEL;
|
||||||
|
|
||||||
if( STRUCT->m_Layer == LAYER_GLOBLABEL ) //this is not the simplest way of doing it
|
// this is not the simplest way of doing it
|
||||||
new_item->m_Type = NET_GLOBLABEL; // (look at the case statement above).
|
// (look at the case statement above).
|
||||||
|
if( STRUCT->m_Layer == LAYER_GLOBLABEL )
|
||||||
|
new_item->m_Type = NET_GLOBLABEL;
|
||||||
if( STRUCT->m_Layer == LAYER_HIERLABEL )
|
if( STRUCT->m_Layer == LAYER_HIERLABEL )
|
||||||
new_item->m_Type = NET_HIERLABEL;
|
new_item->m_Type = NET_HIERLABEL;
|
||||||
|
|
||||||
|
@ -463,7 +465,7 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
|
||||||
new_item->m_Start = new_item->m_End = STRUCT->m_Pos;
|
new_item->m_Start = new_item->m_End = STRUCT->m_Pos;
|
||||||
aNetItemBuffer.push_back( new_item );
|
aNetItemBuffer.push_back( new_item );
|
||||||
|
|
||||||
/* Si c'est un Bus, eclatement en Label */
|
/* If a bus connects to label */
|
||||||
if( ii )
|
if( ii )
|
||||||
ConvertBusToMembers( aNetItemBuffer, *new_item );
|
ConvertBusToMembers( aNetItemBuffer, *new_item );
|
||||||
|
|
||||||
|
@ -480,16 +482,17 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
for( pin = Entry->GetNextPin(); pin != NULL;
|
for( pin = Entry->GetNextPin(); pin != NULL;
|
||||||
pin = Entry->GetNextPin( pin ) )
|
pin = Entry->GetNextPin( pin ) )
|
||||||
{
|
{
|
||||||
wxASSERT( pin->Type() == COMPONENT_PIN_DRAW_TYPE );
|
wxASSERT( pin->Type() == COMPONENT_PIN_DRAW_TYPE );
|
||||||
|
|
||||||
if( pin->m_Unit
|
if( pin->m_Unit
|
||||||
&& ( pin->m_Unit != DrawLibItem->GetUnitSelection( sheetlist ) ) )
|
&& ( pin->m_Unit !=
|
||||||
|
DrawLibItem->GetUnitSelection( sheetlist ) ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( pin->m_Convert
|
if( pin->m_Convert
|
||||||
&& ( pin->m_Convert != DrawLibItem->m_Convert ) )
|
&& ( pin->m_Convert != DrawLibItem->m_Convert ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
wxPoint pos2 =
|
wxPoint pos2 =
|
||||||
|
@ -512,7 +515,7 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
|
||||||
if( ( (int) pin->m_PinType == (int) PIN_POWER_IN )
|
if( ( (int) pin->m_PinType == (int) PIN_POWER_IN )
|
||||||
&& ( pin->m_Attributs & PINNOTDRAW ) )
|
&& ( pin->m_Attributs & PINNOTDRAW ) )
|
||||||
{
|
{
|
||||||
/* Il y a un PIN_LABEL Associe */
|
/* There is an associated PIN_LABEL. */
|
||||||
new_item = new NETLIST_OBJECT();
|
new_item = new NETLIST_OBJECT();
|
||||||
new_item->m_SheetListInclude = *sheetlist;
|
new_item->m_SheetListInclude = *sheetlist;
|
||||||
new_item->m_Comp = NULL;
|
new_item->m_Comp = NULL;
|
||||||
|
@ -536,7 +539,7 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
|
||||||
|
|
||||||
case DRAW_SHEET_STRUCT_TYPE:
|
case DRAW_SHEET_STRUCT_TYPE:
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ( (DrawSheetStruct*) DrawList )
|
#define STRUCT ( (SCH_SHEET*) DrawList )
|
||||||
list = *sheetlist;
|
list = *sheetlist;
|
||||||
list.Push( STRUCT );
|
list.Push( STRUCT );
|
||||||
SheetLabel = STRUCT->m_Label;
|
SheetLabel = STRUCT->m_Label;
|
||||||
|
@ -555,7 +558,6 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
|
||||||
new_item->m_Start = new_item->m_End = SheetLabel->m_Pos;
|
new_item->m_Start = new_item->m_End = SheetLabel->m_Pos;
|
||||||
aNetItemBuffer.push_back( new_item );
|
aNetItemBuffer.push_back( new_item );
|
||||||
|
|
||||||
/* Si c'est un Bus, eclatement en Label */
|
|
||||||
if( ii )
|
if( ii )
|
||||||
ConvertBusToMembers( aNetItemBuffer, *new_item );
|
ConvertBusToMembers( aNetItemBuffer, *new_item );
|
||||||
}
|
}
|
||||||
|
@ -576,16 +578,14 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
/*
|
||||||
static void ConnectBusLabels( NETLIST_OBJECT_LIST& aNetItemBuffer )
|
* Routine that analyzes the type labels xxBUSLABELMEMBER
|
||||||
/************************************************************************/
|
* Propagate Netcode between the corresponding labels (ie when
|
||||||
|
* Their member number is the same) when they are connected
|
||||||
/* Routine qui analyse les labels type xxBUSLABELMEMBER
|
* Generally by their BusNetCode
|
||||||
* Propage les Netcodes entre labels correspondants ( c'est a dire lorsque
|
* Uses and updates the variable LastNetCode
|
||||||
* leur numero de membre est identique) lorsqu'ils sont connectes
|
|
||||||
* globalement par leur BusNetCode
|
|
||||||
* Utilise et met a jour la variable LastNetCode
|
|
||||||
*/
|
*/
|
||||||
|
static void ConnectBusLabels( NETLIST_OBJECT_LIST& aNetItemBuffer )
|
||||||
{
|
{
|
||||||
for( unsigned ii = 0; ii < aNetItemBuffer.size(); ii++ )
|
for( unsigned ii = 0; ii < aNetItemBuffer.size(); ii++ )
|
||||||
{
|
{
|
||||||
|
@ -600,7 +600,7 @@ static void ConnectBusLabels( NETLIST_OBJECT_LIST& aNetItemBuffer )
|
||||||
LastNetCode++;
|
LastNetCode++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( unsigned jj = ii + 1; jj < aNetItemBuffer.size(); jj++ )
|
for( unsigned jj = ii + 1; jj < aNetItemBuffer.size(); jj++ )
|
||||||
{
|
{
|
||||||
NETLIST_OBJECT* LabelInTst = aNetItemBuffer[jj];
|
NETLIST_OBJECT* LabelInTst = aNetItemBuffer[jj];
|
||||||
if( (LabelInTst->m_Type == NET_SHEETBUSLABELMEMBER)
|
if( (LabelInTst->m_Type == NET_SHEETBUSLABELMEMBER)
|
||||||
|
@ -616,7 +616,8 @@ static void ConnectBusLabels( NETLIST_OBJECT_LIST& aNetItemBuffer )
|
||||||
if( LabelInTst->GetNet() == 0 )
|
if( LabelInTst->GetNet() == 0 )
|
||||||
LabelInTst->SetNet( Label->GetNet() );
|
LabelInTst->SetNet( Label->GetNet() );
|
||||||
else
|
else
|
||||||
PropageNetCode( LabelInTst->GetNet(), Label->GetNet(), 0 );
|
PropageNetCode( LabelInTst->GetNet(),
|
||||||
|
Label->GetNet(), 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -624,16 +625,12 @@ static void ConnectBusLabels( NETLIST_OBJECT_LIST& aNetItemBuffer )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************/
|
/* Check if the Label has a bus notation.
|
||||||
int IsBusLabel( const wxString& LabelDrawList )
|
* Returns 0 if not
|
||||||
/**************************************************/
|
* Number of members if yes
|
||||||
|
* Updates FirstNumWireBus, LastNumWireBus and RootBusNameLength
|
||||||
/* Routine qui verifie si le Label a une notation de type Bus
|
|
||||||
* Retourne 0 si non
|
|
||||||
* nombre de membres si oui
|
|
||||||
* met a jour FirstNumWireBus, LastNumWireBus et RootBusNameLength
|
|
||||||
*/
|
*/
|
||||||
|
int IsBusLabel( const wxString& LabelDrawList )
|
||||||
{
|
{
|
||||||
unsigned Num;
|
unsigned Num;
|
||||||
int ii;
|
int ii;
|
||||||
|
@ -672,7 +669,7 @@ int IsBusLabel( const wxString& LabelDrawList )
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !BufLine.ToLong( &tmp ) )
|
if( !BufLine.ToLong( &tmp ) )
|
||||||
error = TRUE;;
|
error = TRUE; ;
|
||||||
LastNumWireBus = tmp;
|
LastNumWireBus = tmp;
|
||||||
|
|
||||||
if( FirstNumWireBus < 0 )
|
if( FirstNumWireBus < 0 )
|
||||||
|
@ -688,21 +685,20 @@ int IsBusLabel( const wxString& LabelDrawList )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************/
|
/*
|
||||||
|
* Routine which breaks a seal Bus type Label in as many members it contains,
|
||||||
|
* And creates structures with type NET_GLOBBUSLABELMEMBER, NET_BUSLABELMEMBER
|
||||||
|
* Or NET_SHEETBUSLABELMEMBER
|
||||||
|
* Entry = pointer to NETLIST_OBJECT initializes the corresp buslabel
|
||||||
|
* Assumes that FirstNumWireBus, LastNumWireBus and RootBusNameLength are up
|
||||||
|
* to date
|
||||||
|
* Amends NETLIST_OBJECT base and meets the following
|
||||||
|
* M_Label is a pointer to a new wxString
|
||||||
|
* M_Label must be deallocated by the user (only for a NET_GLOBBUSLABELMEMBER,
|
||||||
|
* NET_BUSLABELMEMBER gold NET_SHEETBUSLABELMEMBER object type)
|
||||||
|
*/
|
||||||
static int ConvertBusToMembers( NETLIST_OBJECT_LIST& aNetItemBuffer,
|
static int ConvertBusToMembers( NETLIST_OBJECT_LIST& aNetItemBuffer,
|
||||||
NETLIST_OBJECT& BusLabel )
|
NETLIST_OBJECT& BusLabel )
|
||||||
/***************************************************************/
|
|
||||||
|
|
||||||
/* Routine qui eclate un label type Bus en autant de Label qu'il contient de membres,
|
|
||||||
* et qui cree les structures avec le type NET_GLOBBUSLABELMEMBER, NET_BUSLABELMEMBER
|
|
||||||
* ou NET_SHEETBUSLABELMEMBER
|
|
||||||
* entree = pointeur sur l'NETLIST_OBJECT initialise corresp au buslabel
|
|
||||||
* suppose que FirstNumWireBus, LastNumWireBus et RootBusNameLength sont a jour
|
|
||||||
* modifie l'NETLIST_OBJECT de base et remplit les suivants
|
|
||||||
* m_Label is a pointer to a new wxString
|
|
||||||
* m_Label must be deallocated by the user (only for a NET_GLOBBUSLABELMEMBER,
|
|
||||||
* NET_BUSLABELMEMBER or a NET_SHEETBUSLABELMEMBER object type)
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
int NumItem, BusMember;
|
int NumItem, BusMember;
|
||||||
wxString BufLine;
|
wxString BufLine;
|
||||||
|
@ -716,7 +712,7 @@ static int ConvertBusToMembers( NETLIST_OBJECT_LIST& aNetItemBuffer,
|
||||||
else
|
else
|
||||||
BusLabel.m_Type = NET_BUSLABELMEMBER;
|
BusLabel.m_Type = NET_BUSLABELMEMBER;
|
||||||
|
|
||||||
/* Convertion du BusLabel en la racine du Label + le numero du fil */
|
/* Conversion of BusLabel in the root of the Label + the number of wire. */
|
||||||
BufLine = BusLabel.m_Label->Left( RootBusNameLength );
|
BufLine = BusLabel.m_Label->Left( RootBusNameLength );
|
||||||
|
|
||||||
BusMember = FirstNumWireBus;
|
BusMember = FirstNumWireBus;
|
||||||
|
@ -730,7 +726,9 @@ static int ConvertBusToMembers( NETLIST_OBJECT_LIST& aNetItemBuffer,
|
||||||
{
|
{
|
||||||
NETLIST_OBJECT* new_label = new NETLIST_OBJECT( BusLabel );
|
NETLIST_OBJECT* new_label = new NETLIST_OBJECT( BusLabel );
|
||||||
NumItem++;
|
NumItem++;
|
||||||
/* Convertion du BusLabel en la racine du Label + le numero du fil */
|
|
||||||
|
/* Conversion of BusLabel in the root of the Label + the number
|
||||||
|
* of wire */
|
||||||
BufLine = BusLabel.m_Label->Left( RootBusNameLength );
|
BufLine = BusLabel.m_Label->Left( RootBusNameLength );
|
||||||
BufLine << BusMember;
|
BufLine << BusMember;
|
||||||
new_label->m_Label = new wxString( BufLine );
|
new_label->m_Label = new wxString( BufLine );
|
||||||
|
@ -743,21 +741,18 @@ static int ConvertBusToMembers( NETLIST_OBJECT_LIST& aNetItemBuffer,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************/
|
/*
|
||||||
static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus )
|
* PropageNetCode propagates Netcode NewNetCode on all elements
|
||||||
/**********************************************************************/
|
* belonging to the former Netcode OldNetCode
|
||||||
|
* If IsBus == 0; Netcode is the member who is spreading
|
||||||
/* PropageNetCode propage le netcode NewNetCode sur tous les elements
|
* If IsBus! = 0; is the member who is spreading BusNetCode
|
||||||
* appartenant a l'ancien netcode OldNetCode
|
|
||||||
* Si IsBus == 0; c'est le membre NetCode qui est propage
|
|
||||||
* Si IsBus != 0; c'est le membre BusNetCode qui est propage
|
|
||||||
*/
|
*/
|
||||||
|
static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus )
|
||||||
{
|
{
|
||||||
if( OldNetCode == NewNetCode )
|
if( OldNetCode == NewNetCode )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( IsBus == 0 ) /* Propagation du NetCode */
|
if( IsBus == 0 ) /* Propagate NetCode */
|
||||||
{
|
{
|
||||||
for( unsigned jj = 0; jj < g_NetObjectslist.size(); jj++ )
|
for( unsigned jj = 0; jj < g_NetObjectslist.size(); jj++ )
|
||||||
{
|
{
|
||||||
|
@ -768,7 +763,7 @@ static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /* Propagation du BusNetCode */
|
else /* Propagate BusNetCode */
|
||||||
{
|
{
|
||||||
for( unsigned jj = 0; jj < g_NetObjectslist.size(); jj++ )
|
for( unsigned jj = 0; jj < g_NetObjectslist.size(); jj++ )
|
||||||
{
|
{
|
||||||
|
@ -782,32 +777,30 @@ static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
/*
|
||||||
static void PointToPointConnect( NETLIST_OBJECT* Ref, int IsBus, int start )
|
* Check if Ref element is connected to other elements of the list of objects
|
||||||
/***************************************************************************/
|
* in the schematic, by mode point
|
||||||
|
* A point (end superimposed)
|
||||||
/* Routine qui verifie si l'element *Ref est connecte a
|
|
||||||
* d'autres elements de la liste des objets du schema, selon le mode Point
|
|
||||||
* a point ( Extremites superposees )
|
|
||||||
*
|
*
|
||||||
* si IsBus:
|
* If IsBus:
|
||||||
* la connexion ne met en jeu que des elements type bus
|
* The connection involves elements such as bus
|
||||||
* ( BUS ou BUSLABEL ou JONCTION )
|
* (Or BUS or BUSLABEL JUNCTION)
|
||||||
* sinon
|
* Otherwise
|
||||||
* la connexion ne met en jeu que des elements type non bus
|
* The connection involves elements such as non-bus
|
||||||
* ( autres que BUS ou BUSLABEL )
|
* (Other than BUS or BUSLABEL)
|
||||||
*
|
*
|
||||||
* L'objet Ref doit avoir un NetCode valide.
|
* The Ref object must have a valid Netcode.
|
||||||
*
|
*
|
||||||
* La liste des objets est supposee classe par SheetPath Croissants,
|
* The list of objects is SUPPOSED class by SheetPath Croissants,
|
||||||
* et la recherche se fait a partir de l'element start, 1er element
|
* And research is done from the start element, 1st element
|
||||||
* de la feuille de schema
|
* Leaf schema
|
||||||
* ( il ne peut y avoir connexion physique entre elements de differentes sheets)
|
* (There can be no physical connection between elements of different sheets)
|
||||||
*/
|
*/
|
||||||
|
static void PointToPointConnect( NETLIST_OBJECT* Ref, int IsBus, int start )
|
||||||
{
|
{
|
||||||
int netCode;
|
int netCode;
|
||||||
|
|
||||||
if( IsBus == 0 ) /* Objets autres que BUS et BUSLABELS */
|
if( IsBus == 0 ) /* Objects other than BUS and BUSLABELS. */
|
||||||
{
|
{
|
||||||
netCode = Ref->GetNet();
|
netCode = Ref->GetNet();
|
||||||
for( unsigned i = start; i < g_NetObjectslist.size(); i++ )
|
for( unsigned i = start; i < g_NetObjectslist.size(); i++ )
|
||||||
|
@ -849,10 +842,10 @@ static void PointToPointConnect( NETLIST_OBJECT* Ref, int IsBus, int start )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /* Objets type BUS et BUSLABELS ( et JONCTIONS )*/
|
else /* Object type BUS, BUSLABELS, and junctions. */
|
||||||
{
|
{
|
||||||
netCode = Ref->m_BusNetCode;
|
netCode = Ref->m_BusNetCode;
|
||||||
for( unsigned i = start; i<g_NetObjectslist.size(); i++ )
|
for( unsigned i = start; i<g_NetObjectslist.size(); i++ )
|
||||||
{
|
{
|
||||||
NETLIST_OBJECT* item = g_NetObjectslist[i];
|
NETLIST_OBJECT* item = g_NetObjectslist[i];
|
||||||
if( item->m_SheetList != Ref->m_SheetList )
|
if( item->m_SheetList != Ref->m_SheetList )
|
||||||
|
@ -894,20 +887,18 @@ static void PointToPointConnect( NETLIST_OBJECT* Ref, int IsBus, int start )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************/
|
/*
|
||||||
|
* Search if a junction is connected to segments and include the Netcode
|
||||||
|
* objects connect to the junction.
|
||||||
|
* The junction must have a valid Netcode
|
||||||
|
* The list of objects is SUPPOSED class by NumSheet *JP translate*
|
||||||
|
* Croissants,
|
||||||
|
* And research is done from the start element, 1st element
|
||||||
|
* Leaf schema
|
||||||
|
* (There can be no physical connection between elements of different sheets)
|
||||||
|
*/
|
||||||
static void SegmentToPointConnect( NETLIST_OBJECT* Jonction,
|
static void SegmentToPointConnect( NETLIST_OBJECT* Jonction,
|
||||||
int IsBus, int start )
|
int IsBus, int start )
|
||||||
/***************************************************************/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Routine qui recherche si un point (jonction) est connecte a des segments,
|
|
||||||
* et regroupe les NetCodes des objets connectes a la jonction.
|
|
||||||
* Le point de jonction doit avoir un netcode valide
|
|
||||||
* La liste des objets est supposee classe par NumSheet Croissants,
|
|
||||||
* et la recherche se fait a partir de l'element start, 1er element
|
|
||||||
* de la feuille de schema
|
|
||||||
* ( il ne peut y avoir connexion physique entre elements de differentes sheets)
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
for( unsigned i = start; i < g_NetObjectslist.size(); i++ )
|
for( unsigned i = start; i < g_NetObjectslist.size(); i++ )
|
||||||
{
|
{
|
||||||
|
@ -931,7 +922,7 @@ static void SegmentToPointConnect( NETLIST_OBJECT* Jonction,
|
||||||
Segment->m_End.x, Segment->m_End.y,
|
Segment->m_End.x, Segment->m_End.y,
|
||||||
Jonction->m_Start.x, Jonction->m_Start.y ) )
|
Jonction->m_Start.x, Jonction->m_Start.y ) )
|
||||||
{
|
{
|
||||||
/* Propagation du Netcode a tous les Objets de meme NetCode */
|
/* Propagation Netcode has all the objects of the same Netcode. */
|
||||||
if( IsBus == 0 )
|
if( IsBus == 0 )
|
||||||
{
|
{
|
||||||
if( Segment->GetNet() )
|
if( Segment->GetNet() )
|
||||||
|
@ -961,7 +952,7 @@ void LabelConnect( NETLIST_OBJECT* LabelRef )
|
||||||
if( LabelRef->GetNet() == 0 )
|
if( LabelRef->GetNet() == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for( unsigned i = 0; i < g_NetObjectslist.size(); i++ )
|
for( unsigned i = 0; i < g_NetObjectslist.size(); i++ )
|
||||||
{
|
{
|
||||||
if( g_NetObjectslist[i]->GetNet() == LabelRef->GetNet() )
|
if( g_NetObjectslist[i]->GetNet() == LabelRef->GetNet() )
|
||||||
continue;
|
continue;
|
||||||
|
@ -991,12 +982,13 @@ void LabelConnect( NETLIST_OBJECT* LabelRef )
|
||||||
|| ntype == NET_HIERBUSLABELMEMBER
|
|| ntype == NET_HIERBUSLABELMEMBER
|
||||||
|| ntype == NET_PINLABEL )
|
|| ntype == NET_PINLABEL )
|
||||||
{
|
{
|
||||||
if( g_NetObjectslist[i]->m_Label->CmpNoCase( *LabelRef->m_Label ) != 0 )
|
if( g_NetObjectslist[i]->m_Label->CmpNoCase( *LabelRef->m_Label )
|
||||||
|
!= 0 )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Propagation du Netcode a tous les Objets de meme NetCode
|
|
||||||
if( g_NetObjectslist[i]->GetNet() )
|
if( g_NetObjectslist[i]->GetNet() )
|
||||||
PropageNetCode( g_NetObjectslist[i]->GetNet(), LabelRef->GetNet(), 0 );
|
PropageNetCode(
|
||||||
|
g_NetObjectslist[i]->GetNet(), LabelRef->GetNet(), 0 );
|
||||||
else
|
else
|
||||||
g_NetObjectslist[i]->SetNet( LabelRef->GetNet() );
|
g_NetObjectslist[i]->SetNet( LabelRef->GetNet() );
|
||||||
}
|
}
|
||||||
|
@ -1004,37 +996,31 @@ void LabelConnect( NETLIST_OBJECT* LabelRef )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
/* Comparison routine for sorting by increasing Netcode
|
||||||
bool SortItemsbyNetcode( const NETLIST_OBJECT* Objet1, const NETLIST_OBJECT* Objet2 )
|
* table of elements connected (TabPinSort) by qsort ()
|
||||||
/****************************************************************************/
|
|
||||||
|
|
||||||
/* Routine de comparaison pour le tri par NetCode croissant
|
|
||||||
* du tableau des elements connectes ( TabPinSort ) par qsort()
|
|
||||||
*/
|
*/
|
||||||
|
bool SortItemsbyNetcode( const NETLIST_OBJECT* Objet1,
|
||||||
|
const NETLIST_OBJECT* Objet2 )
|
||||||
{
|
{
|
||||||
return Objet1->GetNet() < Objet2->GetNet();
|
return Objet1->GetNet() < Objet2->GetNet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************************/
|
/* Comparison routine for sorting by NumSheet table of elements
|
||||||
bool SortItemsBySheet( const NETLIST_OBJECT* Objet1, const NETLIST_OBJECT* Objet2 )
|
* connected (TabPinSort) by qsort ()
|
||||||
/*****************************************************************************************/
|
*/
|
||||||
|
|
||||||
/* Routine de comparaison pour le tri par NumSheet
|
|
||||||
* du tableau des elements connectes ( TabPinSort ) par qsort() */
|
|
||||||
|
|
||||||
|
bool SortItemsBySheet( const NETLIST_OBJECT* Objet1,
|
||||||
|
const NETLIST_OBJECT* Objet2 )
|
||||||
{
|
{
|
||||||
return Objet1->m_SheetList.Cmp( Objet2->m_SheetList ) < 0;
|
return Objet1->m_SheetList.Cmp( Objet2->m_SheetList ) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************/
|
/* Routine positioning member. FlagNoConnect ELEMENTS
|
||||||
static void SetUnconnectedFlag( NETLIST_OBJECT_LIST& aNetItemBuffer )
|
* List of objects NetList, sorted by order of Netcode
|
||||||
/**********************************************************************/
|
|
||||||
|
|
||||||
/* Routine positionnant le membre .FlagNoConnect des elements de
|
|
||||||
* la liste des objets netliste, tries par ordre de NetCode
|
|
||||||
*/
|
*/
|
||||||
|
static void SetUnconnectedFlag( NETLIST_OBJECT_LIST& aNetItemBuffer )
|
||||||
{
|
{
|
||||||
NETLIST_OBJECT* NetItemRef;
|
NETLIST_OBJECT* NetItemRef;
|
||||||
unsigned NetStart, NetEnd;
|
unsigned NetStart, NetEnd;
|
||||||
|
@ -1048,16 +1034,17 @@ static void SetUnconnectedFlag( NETLIST_OBJECT_LIST& aNetItemBuffer )
|
||||||
if( NetItemRef->m_Type == NET_NOCONNECT && StateFlag != PAD_CONNECT )
|
if( NetItemRef->m_Type == NET_NOCONNECT && StateFlag != PAD_CONNECT )
|
||||||
StateFlag = NOCONNECT_SYMBOL_PRESENT;
|
StateFlag = NOCONNECT_SYMBOL_PRESENT;
|
||||||
|
|
||||||
/* Analyse du net en cours */
|
/* Analysis of current net. */
|
||||||
unsigned idxtoTest = ii + 1;
|
unsigned idxtoTest = ii + 1;
|
||||||
|
|
||||||
if( ( idxtoTest >= aNetItemBuffer.size() )
|
if( ( idxtoTest >= aNetItemBuffer.size() )
|
||||||
|| ( NetItemRef->GetNet() != aNetItemBuffer[idxtoTest]->GetNet() ) )
|
|| ( NetItemRef->GetNet() != aNetItemBuffer[idxtoTest]->GetNet() ) )
|
||||||
{
|
{
|
||||||
/* Net analyse: mise a jour de m_FlagOfConnection */
|
/* Net analysis to update m_FlagOfConnection */
|
||||||
NetEnd = idxtoTest;
|
NetEnd = idxtoTest;
|
||||||
|
|
||||||
/* set m_FlagOfConnection member to StateFlag for all items of this net: */
|
/* set m_FlagOfConnection member to StateFlag for all items of
|
||||||
|
* this net: */
|
||||||
for( unsigned kk = NetStart; kk < NetEnd; kk++ )
|
for( unsigned kk = NetStart; kk < NetEnd; kk++ )
|
||||||
aNetItemBuffer[kk]->m_FlagOfConnection = StateFlag;
|
aNetItemBuffer[kk]->m_FlagOfConnection = StateFlag;
|
||||||
|
|
||||||
|
@ -1070,11 +1057,13 @@ static void SetUnconnectedFlag( NETLIST_OBJECT_LIST& aNetItemBuffer )
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* test the current item: if this is a pin and if the reference item is also a pin,
|
/* test the current item: if this is a pin and if the reference item
|
||||||
* then 2 pins are connected, so set StateFlag to PAD_CONNECT (can be already done)
|
* is also a pin, then 2 pins are connected, so set StateFlag to
|
||||||
* Of course, if the current item is a no connect symbol, set StateFlag to NOCONNECT_SYMBOL_PRESENT
|
* PAD_CONNECT (can be already done) Of course, if the current
|
||||||
* to inhibit error diags. However if StateFlag is already set to PAD_CONNECT
|
* item is a no connect symbol, set StateFlag to
|
||||||
* this state is kept (the no connect symbol was surely an error and an ERC will report this)
|
* NOCONNECT_SYMBOL_PRESENT to inhibit error diags. However if
|
||||||
|
* StateFlag is already set to PAD_CONNECT this state is kept (the
|
||||||
|
* no connect symbol was surely an error and an ERC will report this)
|
||||||
*/
|
*/
|
||||||
for( ; ; idxtoTest++ )
|
for( ; ; idxtoTest++ )
|
||||||
{
|
{
|
||||||
|
@ -1085,8 +1074,9 @@ static void SetUnconnectedFlag( NETLIST_OBJECT_LIST& aNetItemBuffer )
|
||||||
switch( aNetItemBuffer[idxtoTest]->m_Type )
|
switch( aNetItemBuffer[idxtoTest]->m_Type )
|
||||||
{
|
{
|
||||||
case NET_ITEM_UNSPECIFIED:
|
case NET_ITEM_UNSPECIFIED:
|
||||||
wxMessageBox(wxT("BuildNetListBase() error"));
|
wxMessageBox( wxT( "BuildNetListBase() error" ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NET_SEGMENT:
|
case NET_SEGMENT:
|
||||||
case NET_LABEL:
|
case NET_LABEL:
|
||||||
case NET_HIERLABEL:
|
case NET_HIERLABEL:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**********************************************/
|
/***************/
|
||||||
/* Module de calcul de la Netliste: netlist.h */
|
/* netlist.h */
|
||||||
/**********************************************/
|
/***************/
|
||||||
|
|
||||||
#ifndef _NETLIST_H_
|
#ifndef _NETLIST_H_
|
||||||
#define _NETLIST_H_
|
#define _NETLIST_H_
|
||||||
|
@ -37,7 +37,6 @@ enum TypeNetForm {
|
||||||
#define MAXPIN 5000
|
#define MAXPIN 5000
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* object used in annotation to handle a list of components in schematic
|
/* object used in annotation to handle a list of components in schematic
|
||||||
* because in a complex hierarchy, a component is used more than once,
|
* because in a complex hierarchy, a component is used more than once,
|
||||||
* and its reference is depending on the sheet path
|
* and its reference is depending on the sheet path
|
||||||
|
@ -47,16 +46,23 @@ enum TypeNetForm {
|
||||||
class OBJ_CMP_TO_LIST
|
class OBJ_CMP_TO_LIST
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SCH_COMPONENT* m_RootCmp; // the component in schematic
|
SCH_COMPONENT* m_RootCmp; // the component in schematic
|
||||||
LIB_COMPONENT* m_Entry; // the source component in library
|
LIB_COMPONENT* m_Entry; // the source component in library
|
||||||
int m_Unit; /* Selected part (For multi parts per package) depending on sheet path */
|
int m_Unit; /* Selected part (For multi parts per
|
||||||
DrawSheetPath m_SheetPath; /* the sheet path for this component */
|
* package) depending on sheet path */
|
||||||
unsigned long m_TimeStamp; /* unique identification number depending on sheet path */
|
DrawSheetPath m_SheetPath; /* the sheet path for this component */
|
||||||
bool m_IsNew; /* true for not yet annotated components */
|
unsigned long m_TimeStamp; /* unique identification number
|
||||||
wxString* m_Value; /* Component value (same for all instances) */
|
* depending on sheet path */
|
||||||
char m_Reference[32]; /* Component reference prefix, without number (for IC1, this is IC) ) */
|
bool m_IsNew; /* true for not yet annotated
|
||||||
int m_NumRef; /* Reference number (for IC1, this is 1) ) depending on sheet path*/
|
* components */
|
||||||
int m_Flag; /* flag for computations */
|
wxString* m_Value; /* Component value (same for all
|
||||||
|
* instances) */
|
||||||
|
char m_Reference[32]; /* Component reference prefix, without
|
||||||
|
* number (for IC1, this is IC) ) */
|
||||||
|
int m_NumRef; /* Reference number (for IC1, this is
|
||||||
|
* 1) ) depending on sheet path*/
|
||||||
|
int m_Flag; /* flag for computations */
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
OBJ_CMP_TO_LIST()
|
OBJ_CMP_TO_LIST()
|
||||||
|
@ -96,7 +102,7 @@ public:
|
||||||
|
|
||||||
// Buffer to build the list of items used in netlist and erc calculations
|
// Buffer to build the list of items used in netlist and erc calculations
|
||||||
typedef std::vector <NETLIST_OBJECT*> NETLIST_OBJECT_LIST;
|
typedef std::vector <NETLIST_OBJECT*> NETLIST_OBJECT_LIST;
|
||||||
extern NETLIST_OBJECT_LIST g_NetObjectslist;
|
extern NETLIST_OBJECT_LIST g_NetObjectslist;
|
||||||
|
|
||||||
|
|
||||||
/* Prototypes: */
|
/* Prototypes: */
|
||||||
|
@ -110,7 +116,8 @@ void FreeNetObjectsList( std::vector <NETLIST_OBJECT*>& aNetObjectslist );
|
||||||
* @param first = true: return first name of the list, false = return next
|
* @param first = true: return first name of the list, false = return next
|
||||||
* @return a wxString : name of the type netlist or empty string
|
* @return a wxString : name of the type netlist or empty string
|
||||||
* this function must be called first with "first_item" = true
|
* this function must be called first with "first_item" = true
|
||||||
* and after with "first_item" = false to get all the other existing netlist names
|
* and after with "first_item" = false to get all the other existing netlist
|
||||||
|
* names
|
||||||
*/
|
*/
|
||||||
wxString ReturnUserNetlistTypeName( bool first_item );
|
wxString ReturnUserNetlistTypeName( bool first_item );
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
/**********************************/
|
/**********************************/
|
||||||
|
|
||||||
/* Functions relatives to the dialog creating the netlist for pcbnew.
|
/* Functions relatives to the dialog creating the netlist for pcbnew.
|
||||||
* The dialo is a notebook with 4 fixed netlist format:
|
* The dialog is a notebook with 4 fixed netlist format:
|
||||||
* PCBNEW ORCADPCB2 CADSTAR and SPICE
|
* PCBNEW ORCADPCB2 CADSTAR and SPICE
|
||||||
* and up to CUSTOMPANEL_COUNTMAX (see netlist.h) user programmable format
|
* and up to CUSTOMPANEL_COUNTMAX (see netlist.h) user programmable format
|
||||||
* calling an external converter with convert an intermediate format to the
|
* calling an external converter with convert an intermediate format to the
|
||||||
* user specific format.
|
* user specific format.
|
||||||
* these external converters are refered there as plugins,
|
* these external converters are referred there as plugins,
|
||||||
* but there are not really plugins, there are only external binaries
|
* but there are not really plugins, there are only external binaries
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ void WinEDA_NetlistFrame::InstallCustomPages()
|
||||||
selected = m_Parent->m_NetlistFormat == ( NET_TYPE_CUSTOM1 + ii );
|
selected = m_Parent->m_NetlistFormat == ( NET_TYPE_CUSTOM1 + ii );
|
||||||
|
|
||||||
/* Install the panel "Add Plugin" after
|
/* Install the panel "Add Plugin" after
|
||||||
* the last initialised panel */
|
* the last initialized panel */
|
||||||
previoustitle = title;
|
previoustitle = title;
|
||||||
if( title.IsEmpty() )
|
if( title.IsEmpty() )
|
||||||
CurrPage =
|
CurrPage =
|
||||||
|
@ -357,10 +357,10 @@ void WinEDA_NetlistFrame::SetupPluginData( wxCommandEvent& event )
|
||||||
Mask = wxT( "*" );
|
Mask = wxT( "*" );
|
||||||
Path = wxGetApp().m_BinDir;
|
Path = wxGetApp().m_BinDir;
|
||||||
FullFileName = EDA_FileSelector( _( "Plugin files:" ),
|
FullFileName = EDA_FileSelector( _( "Plugin files:" ),
|
||||||
Path, /* Chemin par defaut */
|
Path,
|
||||||
FullFileName, /* nom fichier par defaut */
|
FullFileName,
|
||||||
wxEmptyString, /* extension par defaut */
|
wxEmptyString,
|
||||||
Mask, /* Masque d'affichage */
|
Mask,
|
||||||
this,
|
this,
|
||||||
wxFD_OPEN,
|
wxFD_OPEN,
|
||||||
TRUE
|
TRUE
|
||||||
|
@ -379,7 +379,8 @@ void WinEDA_NetlistFrame::SetupPluginData( wxCommandEvent& event )
|
||||||
wxString title = CurrPage->m_TitleStringCtrl->GetValue();
|
wxString title = CurrPage->m_TitleStringCtrl->GetValue();
|
||||||
if( title.IsEmpty() )
|
if( title.IsEmpty() )
|
||||||
DisplayInfoMessage( this,
|
DisplayInfoMessage( this,
|
||||||
_( "Do not forget to choose a title for this netlist control page" ) );
|
_( "Do not forget to choose a title for this \
|
||||||
|
netlist control page" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -436,7 +437,7 @@ void WinEDA_NetlistFrame::GenNetlist( wxCommandEvent& event )
|
||||||
|
|
||||||
/** Function GenNetlist
|
/** Function GenNetlist
|
||||||
* Create the netlist file:
|
* Create the netlist file:
|
||||||
* calcualte the filename with the suitable extentions
|
* calculate the filename with the suitable extensions
|
||||||
* and run the netlist creator
|
* and run the netlist creator
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/******************************************************/
|
/*******************/
|
||||||
/* schedit.cpp: fonctions generales de la schematique */
|
/* onleftclick.cpp */
|
||||||
/******************************************************/
|
/*******************/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
@ -17,22 +17,20 @@
|
||||||
static wxArrayString s_CmpNameList;
|
static wxArrayString s_CmpNameList;
|
||||||
static wxArrayString s_PowerNameList;
|
static wxArrayString s_PowerNameList;
|
||||||
|
|
||||||
/**********************************************************************************/
|
|
||||||
void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|
||||||
/**********************************************************************************/
|
|
||||||
|
|
||||||
/* Traite les commandes declench<63>e par le bouton gauche de la souris,
|
/* Process the command triggers by the left button of the mouse when a tool
|
||||||
* quand un outil est deja selectionn<EFBFBD>
|
* is already selected.
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
{
|
{
|
||||||
SCH_ITEM* DrawStruct = (SCH_ITEM*) GetScreen()->GetCurItem();
|
SCH_ITEM* DrawStruct = (SCH_ITEM*) GetScreen()->GetCurItem();
|
||||||
|
|
||||||
if( (m_ID_current_state == 0) || ( DrawStruct && DrawStruct->m_Flags ) )
|
if( ( m_ID_current_state == 0 ) || ( DrawStruct && DrawStruct->m_Flags ) )
|
||||||
{
|
{
|
||||||
DrawPanel->m_AutoPAN_Request = FALSE;
|
DrawPanel->m_AutoPAN_Request = FALSE;
|
||||||
g_ItemToRepeat = NULL;
|
g_ItemToRepeat = NULL;
|
||||||
|
|
||||||
if( DrawStruct && DrawStruct->m_Flags ) // Commande "POPUP" en cours
|
if( DrawStruct && DrawStruct->m_Flags )
|
||||||
{
|
{
|
||||||
switch( DrawStruct->Type() )
|
switch( DrawStruct->Type() )
|
||||||
{
|
{
|
||||||
|
@ -48,22 +46,22 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
case DRAW_PART_TEXT_STRUCT_TYPE:
|
case DRAW_PART_TEXT_STRUCT_TYPE:
|
||||||
DrawStruct->Place( this, DC );
|
DrawStruct->Place( this, DC );
|
||||||
GetScreen()->SetCurItem( NULL );
|
GetScreen()->SetCurItem( NULL );
|
||||||
TestDanglingEnds( GetScreen()->EEDrawList, NULL ); // don't draw here
|
TestDanglingEnds( GetScreen()->EEDrawList, NULL );
|
||||||
DrawPanel->Refresh( TRUE );
|
DrawPanel->Refresh( TRUE );
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case SCREEN_STRUCT_TYPE:
|
case SCREEN_STRUCT_TYPE:
|
||||||
DisplayError( this,
|
DisplayError( this,
|
||||||
wxT( "OnLeftClick err: unexpected type for Place" ) );
|
wxT( "OnLeftClick err: unexpected type for Place" ) );
|
||||||
DrawStruct->m_Flags = 0;
|
DrawStruct->m_Flags = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DRAW_SEGMENT_STRUCT_TYPE: // Segment peut-etre en cours de trace
|
case DRAW_SEGMENT_STRUCT_TYPE: // May already be drawing segment.
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DisplayError( this,
|
DisplayError( this,
|
||||||
wxT( "WinEDA_SchematicFrame::OnLeftClick err: m_Flags != 0" ) );
|
wxT( "WinEDA_SchematicFrame::OnLeftClick err: m_Flags != 0" ) );
|
||||||
DrawStruct->m_Flags = 0;
|
DrawStruct->m_Flags = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -86,16 +84,16 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
if( DrawStruct && DrawStruct->m_Flags )
|
if( DrawStruct && DrawStruct->m_Flags )
|
||||||
break;
|
break;
|
||||||
DrawStruct = SchematicGeneralLocateAndDisplay();
|
DrawStruct = SchematicGeneralLocateAndDisplay();
|
||||||
if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) )
|
if( DrawStruct && ( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE ) )
|
||||||
{
|
{
|
||||||
InstallNextScreen( (DrawSheetStruct*) DrawStruct );
|
InstallNextScreen( (SCH_SHEET*) DrawStruct );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
InstallPreviousSheet();
|
InstallPreviousSheet();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_NOCONN_BUTT:
|
case ID_NOCONN_BUTT:
|
||||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
|
||||||
{
|
{
|
||||||
g_ItemToRepeat = CreateNewNoConnectStruct( DC );
|
g_ItemToRepeat = CreateNewNoConnectStruct( DC );
|
||||||
GetScreen()->SetCurItem( g_ItemToRepeat );
|
GetScreen()->SetCurItem( g_ItemToRepeat );
|
||||||
|
@ -111,9 +109,11 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_JUNCTION_BUTT:
|
case ID_JUNCTION_BUTT:
|
||||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
|
||||||
{
|
{
|
||||||
g_ItemToRepeat = CreateNewJunctionStruct( DC, GetScreen()->m_Curseur, TRUE );
|
g_ItemToRepeat = CreateNewJunctionStruct( DC,
|
||||||
|
GetScreen()->m_Curseur,
|
||||||
|
TRUE );
|
||||||
GetScreen()->SetCurItem( g_ItemToRepeat );
|
GetScreen()->SetCurItem( g_ItemToRepeat );
|
||||||
DrawPanel->m_AutoPAN_Request = TRUE;
|
DrawPanel->m_AutoPAN_Request = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
|
|
||||||
case ID_WIRETOBUS_ENTRY_BUTT:
|
case ID_WIRETOBUS_ENTRY_BUTT:
|
||||||
case ID_BUSTOBUS_ENTRY_BUTT:
|
case ID_BUSTOBUS_ENTRY_BUTT:
|
||||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
|
||||||
{
|
{
|
||||||
DrawStruct =
|
DrawStruct =
|
||||||
CreateBusEntry( DC,
|
CreateBusEntry( DC,
|
||||||
|
@ -171,7 +171,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_TEXT_COMMENT_BUTT:
|
case ID_TEXT_COMMENT_BUTT:
|
||||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
|
||||||
{
|
{
|
||||||
GetScreen()->SetCurItem( CreateNewText( DC, LAYER_NOTES ) );
|
GetScreen()->SetCurItem( CreateNewText( DC, LAYER_NOTES ) );
|
||||||
DrawPanel->m_AutoPAN_Request = TRUE;
|
DrawPanel->m_AutoPAN_Request = TRUE;
|
||||||
|
@ -184,7 +184,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_LABEL_BUTT:
|
case ID_LABEL_BUTT:
|
||||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
|
||||||
{
|
{
|
||||||
GetScreen()->SetCurItem( CreateNewText( DC, LAYER_LOCLABEL ) );
|
GetScreen()->SetCurItem( CreateNewText( DC, LAYER_LOCLABEL ) );
|
||||||
DrawPanel->m_AutoPAN_Request = TRUE;
|
DrawPanel->m_AutoPAN_Request = TRUE;
|
||||||
|
@ -232,7 +232,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_SHEET_SYMBOL_BUTT:
|
case ID_SHEET_SYMBOL_BUTT:
|
||||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
|
||||||
{
|
{
|
||||||
GetScreen()->SetCurItem( CreateSheet( DC ) );
|
GetScreen()->SetCurItem( CreateSheet( DC ) );
|
||||||
DrawPanel->m_AutoPAN_Request = TRUE;
|
DrawPanel->m_AutoPAN_Request = TRUE;
|
||||||
|
@ -248,7 +248,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
|
|
||||||
case ID_IMPORT_HLABEL_BUTT:
|
case ID_IMPORT_HLABEL_BUTT:
|
||||||
case ID_SHEET_LABEL_BUTT:
|
case ID_SHEET_LABEL_BUTT:
|
||||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
|
||||||
DrawStruct = SchematicGeneralLocateAndDisplay();
|
DrawStruct = SchematicGeneralLocateAndDisplay();
|
||||||
|
|
||||||
if( DrawStruct == NULL )
|
if( DrawStruct == NULL )
|
||||||
|
@ -259,10 +259,10 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
{
|
{
|
||||||
if( m_ID_current_state == ID_IMPORT_HLABEL_BUTT )
|
if( m_ID_current_state == ID_IMPORT_HLABEL_BUTT )
|
||||||
GetScreen()->SetCurItem(
|
GetScreen()->SetCurItem(
|
||||||
Import_PinSheet( (DrawSheetStruct*) DrawStruct, DC ) );
|
Import_PinSheet( (SCH_SHEET*) DrawStruct, DC ) );
|
||||||
else
|
else
|
||||||
GetScreen()->SetCurItem(
|
GetScreen()->SetCurItem(
|
||||||
Create_PinSheet( (DrawSheetStruct*) DrawStruct, DC ) );
|
Create_PinSheet( (SCH_SHEET*) DrawStruct, DC ) );
|
||||||
}
|
}
|
||||||
else if( (DrawStruct->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE)
|
else if( (DrawStruct->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE)
|
||||||
&& (DrawStruct->m_Flags != 0) )
|
&& (DrawStruct->m_Flags != 0) )
|
||||||
|
@ -277,7 +277,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
||||||
{
|
{
|
||||||
GetScreen()->SetCurItem( Load_Component( DC, wxEmptyString,
|
GetScreen()->SetCurItem( Load_Component( DC, wxEmptyString,
|
||||||
s_CmpNameList, TRUE ) );
|
s_CmpNameList, TRUE ) );
|
||||||
DrawPanel->m_AutoPAN_Request = TRUE;
|
DrawPanel->m_AutoPAN_Request = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -290,7 +290,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_PLACE_POWER_BUTT:
|
case ID_PLACE_POWER_BUTT:
|
||||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
|
||||||
{
|
{
|
||||||
GetScreen()->SetCurItem(
|
GetScreen()->SetCurItem(
|
||||||
Load_Component( DC, wxT( "power" ), s_PowerNameList, FALSE ) );
|
Load_Component( DC, wxT( "power" ), s_PowerNameList, FALSE ) );
|
||||||
|
@ -318,17 +318,15 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
void WinEDA_SchematicFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
|
||||||
/***************************************************************************/
|
|
||||||
|
|
||||||
/** Function OnLeftDClick
|
/** Function OnLeftDClick
|
||||||
* called on a double click event from the drawpanel mouse handler
|
* called on a double click event from the drawpanel mouse handler
|
||||||
* if an editable item is found (text, component)
|
* if an editable item is found (text, component)
|
||||||
* Call the suitable dialog editor.
|
* Call the suitable dialog editor.
|
||||||
* Id a creat command is in progress:
|
* Id a create command is in progress:
|
||||||
* validate and finish the command
|
* validate and finish the command
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_SchematicFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
|
|
||||||
{
|
{
|
||||||
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem();
|
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem();
|
||||||
wxPoint pos = GetPosition();
|
wxPoint pos = GetPosition();
|
||||||
|
@ -336,19 +334,18 @@ void WinEDA_SchematicFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
switch( m_ID_current_state )
|
switch( m_ID_current_state )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags == 0 ) )
|
||||||
{
|
{
|
||||||
DrawStruct = SchematicGeneralLocateAndDisplay();
|
DrawStruct = SchematicGeneralLocateAndDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags != 0) )
|
if( ( DrawStruct == NULL ) || ( DrawStruct->m_Flags != 0 ) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Element localis<69>
|
|
||||||
switch( DrawStruct->Type() )
|
switch( DrawStruct->Type() )
|
||||||
{
|
{
|
||||||
case DRAW_SHEET_STRUCT_TYPE:
|
case DRAW_SHEET_STRUCT_TYPE:
|
||||||
InstallNextScreen( (DrawSheetStruct*) DrawStruct );
|
InstallNextScreen( (SCH_SHEET*) DrawStruct );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_SCH_COMPONENT:
|
case TYPE_SCH_COMPONENT:
|
||||||
|
@ -376,12 +373,12 @@ void WinEDA_SchematicFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
break; // end case 0
|
break;
|
||||||
|
|
||||||
case ID_BUS_BUTT:
|
case ID_BUS_BUTT:
|
||||||
case ID_WIRE_BUTT:
|
case ID_WIRE_BUTT:
|
||||||
case ID_LINE_COMMENT_BUTT:
|
case ID_LINE_COMMENT_BUTT:
|
||||||
if( DrawStruct && (DrawStruct->m_Flags & IS_NEW) )
|
if( DrawStruct && ( DrawStruct->m_Flags & IS_NEW ) )
|
||||||
EndSegment( DC );
|
EndSegment( DC );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
/******************************************************************/
|
/********************/
|
||||||
/* onrightclick.cpp - creation du menu popup appele par le bouton */
|
/* onrightclick.cpp */
|
||||||
/* droit de la souris */
|
/********************/
|
||||||
/******************************************************************/
|
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
@ -18,16 +17,13 @@
|
||||||
#include "class_library.h"
|
#include "class_library.h"
|
||||||
|
|
||||||
|
|
||||||
/* functions to add commands and submenus depending on the item */
|
|
||||||
static void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame );
|
static void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame );
|
||||||
static void AddMenusForWire( wxMenu* PopMenu, EDA_DrawLineStruct* Wire,
|
static void AddMenusForWire( wxMenu* PopMenu, EDA_DrawLineStruct* Wire,
|
||||||
WinEDA_SchematicFrame* frame );
|
WinEDA_SchematicFrame* frame );
|
||||||
static void AddMenusForBus( wxMenu* PopMenu, EDA_DrawLineStruct* Bus,
|
static void AddMenusForBus( wxMenu* PopMenu, EDA_DrawLineStruct* Bus,
|
||||||
WinEDA_SchematicFrame* frame );
|
WinEDA_SchematicFrame* frame );
|
||||||
static void AddMenusForHierchicalSheet( wxMenu* PopMenu,
|
static void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet );
|
||||||
DrawSheetStruct* Sheet );
|
static void AddMenusForPinSheet( wxMenu* PopMenu, SCH_SHEET_PIN* PinSheet );
|
||||||
static void AddMenusForPinSheet( wxMenu* PopMenu,
|
|
||||||
Hierarchical_PIN_Sheet_Struct* PinSheet );
|
|
||||||
static void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text );
|
static void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text );
|
||||||
static void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label );
|
static void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label );
|
||||||
static void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel );
|
static void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel );
|
||||||
|
@ -40,22 +36,19 @@ static void AddMenusForMarkers( wxMenu* aPopMenu, MARKER_SCH* aMarker,
|
||||||
WinEDA_SchematicFrame* aFrame );
|
WinEDA_SchematicFrame* aFrame );
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
/* Prepare context menu when a click on the right mouse button occurs.
|
||||||
|
*
|
||||||
|
* This menu is then added to the list of zoom commands.
|
||||||
|
*/
|
||||||
bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
|
bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
|
||||||
wxMenu* PopMenu )
|
wxMenu* PopMenu )
|
||||||
{
|
{
|
||||||
/*****************************************************************/
|
|
||||||
|
|
||||||
/* Prepare le menu PullUp affich<63> par un click sur le bouton droit
|
|
||||||
* de la souris.
|
|
||||||
* Ce menu est ensuite compl<EFBFBD>t<EFBFBD> par la liste des commandes de ZOOM
|
|
||||||
*/
|
|
||||||
SCH_ITEM* DrawStruct = (SCH_ITEM*) GetScreen()->GetCurItem();
|
SCH_ITEM* DrawStruct = (SCH_ITEM*) GetScreen()->GetCurItem();
|
||||||
bool BlockActive =
|
bool BlockActive =
|
||||||
(GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE);
|
(GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE);
|
||||||
|
|
||||||
|
// Do not start a block command on context menu.
|
||||||
DrawPanel->m_CanStartBlock = -1; // Ne pas engager un debut de bloc sur validation menu
|
DrawPanel->m_CanStartBlock = -1;
|
||||||
|
|
||||||
if( BlockActive )
|
if( BlockActive )
|
||||||
{
|
{
|
||||||
|
@ -64,14 +57,15 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) // Just try to locate items at cursor position
|
// Try to locate items at cursor position.
|
||||||
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
||||||
{
|
{
|
||||||
DrawStruct = SchematicGeneralLocateAndDisplay( false );
|
DrawStruct = SchematicGeneralLocateAndDisplay( false );
|
||||||
if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) )
|
if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) )
|
||||||
{
|
{
|
||||||
Hierarchical_PIN_Sheet_Struct* slabel;
|
SCH_SHEET_PIN* slabel;
|
||||||
slabel = LocateSheetLabel( (DrawSheetStruct*) DrawStruct,
|
slabel = LocateSheetLabel( (SCH_SHEET*) DrawStruct,
|
||||||
GetScreen()->m_Curseur );
|
GetScreen()->m_Curseur );
|
||||||
if( slabel )
|
if( slabel )
|
||||||
DrawStruct = slabel;
|
DrawStruct = slabel;
|
||||||
}
|
}
|
||||||
|
@ -170,9 +164,11 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
|
||||||
if( flags )
|
if( flags )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Many fields are inside a component. If this is the case, add the component menu
|
// Many fields are inside a component. If this is the case, add the
|
||||||
SCH_COMPONENT* Component = LocateSmallestComponent(
|
// component menu
|
||||||
(SCH_SCREEN*) GetScreen() );
|
SCH_COMPONENT* Component =
|
||||||
|
LocateSmallestComponent( (SCH_SCREEN*) GetScreen() );
|
||||||
|
|
||||||
if( Component )
|
if( Component )
|
||||||
{
|
{
|
||||||
PopMenu->AppendSeparator();
|
PopMenu->AppendSeparator();
|
||||||
|
@ -187,7 +183,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
|
||||||
|
|
||||||
case DRAW_SEGMENT_STRUCT_TYPE:
|
case DRAW_SEGMENT_STRUCT_TYPE:
|
||||||
|
|
||||||
// if( !flags ) PopMenu->Append(ID_POPUP_SCH_MOVE_ITEM_REQUEST, "Move");
|
// if( !flags ) PopMenu->Append(ID_POPUP_SCH_MOVE_ITEM_REQUEST, "Move");
|
||||||
switch( DrawStruct->GetLayer() )
|
switch( DrawStruct->GetLayer() )
|
||||||
{
|
{
|
||||||
case LAYER_WIRE:
|
case LAYER_WIRE:
|
||||||
|
@ -210,19 +206,18 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DRAW_SHEET_STRUCT_TYPE:
|
case DRAW_SHEET_STRUCT_TYPE:
|
||||||
AddMenusForHierchicalSheet( PopMenu, (DrawSheetStruct*) DrawStruct );
|
AddMenusForHierchicalSheet( PopMenu, (SCH_SHEET*) DrawStruct );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
|
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
|
||||||
AddMenusForPinSheet( PopMenu,
|
AddMenusForPinSheet( PopMenu, (SCH_SHEET_PIN*) DrawStruct );
|
||||||
(Hierarchical_PIN_Sheet_Struct*) DrawStruct );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf( wxT( "WinEDA_SchematicFrame::OnRightClick Error: unknown \
|
msg.Printf( wxT( "WinEDA_SchematicFrame::OnRightClick Error: unknown \
|
||||||
DrawType %d" ),
|
DrawType %d" ),
|
||||||
DrawStruct->Type() );
|
DrawStruct->Type() );
|
||||||
DisplayError( this, msg );
|
DisplayError( this, msg );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -232,13 +227,8 @@ DrawType %d" ),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
void AddMenusForComponentField( wxMenu* PopMenu, SCH_CMP_FIELD* Field )
|
void AddMenusForComponentField( wxMenu* PopMenu, SCH_CMP_FIELD* Field )
|
||||||
{
|
{
|
||||||
/*************************************************************************/
|
|
||||||
|
|
||||||
/* Add menu commands for a component field (like value, reference)
|
|
||||||
*/
|
|
||||||
if( !Field->m_Flags )
|
if( !Field->m_Flags )
|
||||||
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST,
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST,
|
||||||
_( "Move Field" ), move_text_xpm );
|
_( "Move Field" ), move_text_xpm );
|
||||||
|
@ -249,13 +239,8 @@ void AddMenusForComponentField( wxMenu* PopMenu, SCH_CMP_FIELD* Field )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************/
|
|
||||||
void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
|
void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
|
||||||
{
|
{
|
||||||
/**************************************************************************/
|
|
||||||
|
|
||||||
/* Add menu commands for a component
|
|
||||||
*/
|
|
||||||
if( Component->Type() != TYPE_SCH_COMPONENT )
|
if( Component->Type() != TYPE_SCH_COMPONENT )
|
||||||
{
|
{
|
||||||
wxASSERT( 0 );
|
wxASSERT( 0 );
|
||||||
|
@ -289,7 +274,6 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
|
||||||
msg, move_xpm );
|
msg, move_xpm );
|
||||||
}
|
}
|
||||||
|
|
||||||
// add menu orient et sous menu:
|
|
||||||
wxMenu* orientmenu = new wxMenu;
|
wxMenu* orientmenu = new wxMenu;
|
||||||
msg = AddHotkeyName( _( "Rotate +" ), s_Schematic_Hokeys_Descr,
|
msg = AddHotkeyName( _( "Rotate +" ), s_Schematic_Hokeys_Descr,
|
||||||
HK_ROTATE_COMPONENT );
|
HK_ROTATE_COMPONENT );
|
||||||
|
@ -311,7 +295,8 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
|
||||||
_( "Orient Component" ), orient_xpm );
|
_( "Orient Component" ), orient_xpm );
|
||||||
|
|
||||||
wxMenu* editmenu = new wxMenu;
|
wxMenu* editmenu = new wxMenu;
|
||||||
msg = AddHotkeyName( _( "Edit" ), s_Schematic_Hokeys_Descr, HK_EDIT_COMPONENT );
|
msg = AddHotkeyName( _( "Edit" ), s_Schematic_Hokeys_Descr,
|
||||||
|
HK_EDIT_COMPONENT );
|
||||||
ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_CMP, msg,
|
ADD_MENUITEM( editmenu, ID_POPUP_SCH_EDIT_CMP, msg,
|
||||||
edit_component_xpm );
|
edit_component_xpm );
|
||||||
|
|
||||||
|
@ -369,19 +354,15 @@ void AddMenusForComponent( wxMenu* PopMenu, SCH_COMPONENT* Component )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************/
|
|
||||||
void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel )
|
void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel )
|
||||||
{
|
{
|
||||||
/*******************************************************************/
|
|
||||||
|
|
||||||
/* Add menu commands for a Global Label
|
|
||||||
*/
|
|
||||||
wxMenu* menu_change_type = new wxMenu;
|
wxMenu* menu_change_type = new wxMenu;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
if( !GLabel->m_Flags )
|
if( !GLabel->m_Flags )
|
||||||
{
|
{
|
||||||
msg = AddHotkeyName( _( "Move Global Label" ), s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT );
|
msg = AddHotkeyName( _( "Move Global Label" ),
|
||||||
|
s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT );
|
||||||
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST,
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST,
|
||||||
msg, move_text_xpm );
|
msg, move_text_xpm );
|
||||||
}
|
}
|
||||||
|
@ -405,20 +386,15 @@ void AddMenusForGLabel( wxMenu* PopMenu, SCH_GLOBALLABEL* GLabel )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************/
|
|
||||||
void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* HLabel )
|
void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* HLabel )
|
||||||
{
|
{
|
||||||
/*******************************************************************/
|
|
||||||
|
|
||||||
/* Add menu commands for a hierarchical Label
|
|
||||||
*/
|
|
||||||
wxMenu* menu_change_type = new wxMenu;
|
wxMenu* menu_change_type = new wxMenu;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
if( !HLabel->m_Flags )
|
if( !HLabel->m_Flags )
|
||||||
{
|
{
|
||||||
msg = AddHotkeyName( _(
|
msg = AddHotkeyName( _( "Move Hierarchical Label" ),
|
||||||
"Move Hierarchical Label" ), s_Schematic_Hokeys_Descr,
|
s_Schematic_Hokeys_Descr,
|
||||||
HK_MOVE_COMPONENT );
|
HK_MOVE_COMPONENT );
|
||||||
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST,
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST,
|
||||||
msg, move_text_xpm );
|
msg, move_text_xpm );
|
||||||
|
@ -443,19 +419,15 @@ void AddMenusForHLabel( wxMenu* PopMenu, SCH_HIERLABEL* HLabel )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
|
||||||
void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label )
|
void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label )
|
||||||
{
|
{
|
||||||
/*****************************************************************/
|
|
||||||
|
|
||||||
/* Add menu commands for a Label
|
|
||||||
*/
|
|
||||||
wxMenu* menu_change_type = new wxMenu;
|
wxMenu* menu_change_type = new wxMenu;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
if( !Label->m_Flags )
|
if( !Label->m_Flags )
|
||||||
{
|
{
|
||||||
msg = AddHotkeyName( _( "Move Label" ), s_Schematic_Hokeys_Descr, HK_MOVE_COMPONENT );
|
msg = AddHotkeyName( _( "Move Label" ), s_Schematic_Hokeys_Descr,
|
||||||
|
HK_MOVE_COMPONENT );
|
||||||
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST,
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_ITEM_REQUEST,
|
||||||
msg, move_text_xpm );
|
msg, move_text_xpm );
|
||||||
}
|
}
|
||||||
|
@ -479,13 +451,8 @@ void AddMenusForLabel( wxMenu* PopMenu, SCH_LABEL* Label )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
|
||||||
void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text )
|
void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text )
|
||||||
{
|
{
|
||||||
/*****************************************************************/
|
|
||||||
|
|
||||||
/* Add menu commands for a Text (a comment)
|
|
||||||
*/
|
|
||||||
wxMenu* menu_change_type = new wxMenu;
|
wxMenu* menu_change_type = new wxMenu;
|
||||||
|
|
||||||
if( !Text->m_Flags )
|
if( !Text->m_Flags )
|
||||||
|
@ -519,14 +486,9 @@ void AddMenusForText( wxMenu* PopMenu, SCH_TEXT* Text )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
|
||||||
void AddMenusForJunction( wxMenu* PopMenu, DrawJunctionStruct* Junction,
|
void AddMenusForJunction( wxMenu* PopMenu, DrawJunctionStruct* Junction,
|
||||||
WinEDA_SchematicFrame* frame )
|
WinEDA_SchematicFrame* frame )
|
||||||
{
|
{
|
||||||
/*****************************************************************/
|
|
||||||
|
|
||||||
/* Add menu commands for a junction
|
|
||||||
*/
|
|
||||||
bool is_new = (Junction->m_Flags & IS_NEW) ? TRUE : FALSE;
|
bool is_new = (Junction->m_Flags & IS_NEW) ? TRUE : FALSE;
|
||||||
|
|
||||||
if( !is_new )
|
if( !is_new )
|
||||||
|
@ -551,14 +513,9 @@ void AddMenusForJunction( wxMenu* PopMenu, DrawJunctionStruct* Junction,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
|
||||||
void AddMenusForWire( wxMenu* PopMenu, EDA_DrawLineStruct* Wire,
|
void AddMenusForWire( wxMenu* PopMenu, EDA_DrawLineStruct* Wire,
|
||||||
WinEDA_SchematicFrame* frame )
|
WinEDA_SchematicFrame* frame )
|
||||||
{
|
{
|
||||||
/*****************************************************************/
|
|
||||||
|
|
||||||
/* Add menu commands for a wire
|
|
||||||
*/
|
|
||||||
bool is_new = (Wire->m_Flags & IS_NEW) ? TRUE : FALSE;
|
bool is_new = (Wire->m_Flags & IS_NEW) ? TRUE : FALSE;
|
||||||
wxPoint pos = frame->GetScreen()->m_Curseur;
|
wxPoint pos = frame->GetScreen()->m_Curseur;
|
||||||
|
|
||||||
|
@ -589,7 +546,7 @@ void AddMenusForWire( wxMenu* PopMenu, EDA_DrawLineStruct* Wire,
|
||||||
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_LABEL, _( "Add Label" ),
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_LABEL, _( "Add Label" ),
|
||||||
add_line_label_xpm );
|
add_line_label_xpm );
|
||||||
|
|
||||||
// Place Global label command only if the cursor is over one end of the Wire:
|
// Add global label command only if the cursor is over one end of the wire.
|
||||||
if( ( pos.x == Wire->m_Start.x && pos.y == Wire->m_Start.y)
|
if( ( pos.x == Wire->m_Start.x && pos.y == Wire->m_Start.y)
|
||||||
|| ( pos.x == Wire->m_End.x && pos.y == Wire->m_End.y ) )
|
|| ( pos.x == Wire->m_End.x && pos.y == Wire->m_End.y ) )
|
||||||
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_GLABEL,
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_GLABEL,
|
||||||
|
@ -597,14 +554,9 @@ void AddMenusForWire( wxMenu* PopMenu, EDA_DrawLineStruct* Wire,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
|
||||||
void AddMenusForBus( wxMenu* PopMenu, EDA_DrawLineStruct* Bus,
|
void AddMenusForBus( wxMenu* PopMenu, EDA_DrawLineStruct* Bus,
|
||||||
WinEDA_SchematicFrame* frame )
|
WinEDA_SchematicFrame* frame )
|
||||||
{
|
{
|
||||||
/*****************************************************************/
|
|
||||||
|
|
||||||
/* Add menu commands for a Bus
|
|
||||||
*/
|
|
||||||
bool is_new = (Bus->m_Flags & IS_NEW) ? TRUE : FALSE;
|
bool is_new = (Bus->m_Flags & IS_NEW) ? TRUE : FALSE;
|
||||||
wxPoint pos = frame->GetScreen()->m_Curseur;
|
wxPoint pos = frame->GetScreen()->m_Curseur;
|
||||||
|
|
||||||
|
@ -626,7 +578,7 @@ void AddMenusForBus( wxMenu* PopMenu, EDA_DrawLineStruct* Bus,
|
||||||
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_LABEL, _( "Add Label" ),
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_LABEL, _( "Add Label" ),
|
||||||
add_line_label_xpm );
|
add_line_label_xpm );
|
||||||
|
|
||||||
// Place Global label command only if the cursor is over one end of the Bus:
|
// Add global label command only if the cursor is over one end of the bus.
|
||||||
if( ( pos.x == Bus->m_Start.x && pos.y == Bus->m_Start.y)
|
if( ( pos.x == Bus->m_Start.x && pos.y == Bus->m_Start.y)
|
||||||
|| ( pos.x == Bus->m_End.x && pos.y == Bus->m_End.y ) )
|
|| ( pos.x == Bus->m_End.x && pos.y == Bus->m_End.y ) )
|
||||||
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_GLABEL,
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ADD_GLABEL,
|
||||||
|
@ -634,13 +586,8 @@ void AddMenusForBus( wxMenu* PopMenu, EDA_DrawLineStruct* Bus,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
void AddMenusForHierchicalSheet( wxMenu* PopMenu, SCH_SHEET* Sheet )
|
||||||
void AddMenusForHierchicalSheet( wxMenu* PopMenu, DrawSheetStruct* Sheet )
|
|
||||||
{
|
{
|
||||||
/************************************************************************/
|
|
||||||
|
|
||||||
/* Add menu commands for a Sheet
|
|
||||||
*/
|
|
||||||
if( !Sheet->m_Flags )
|
if( !Sheet->m_Flags )
|
||||||
{
|
{
|
||||||
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ENTER_SHEET,
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_ENTER_SHEET,
|
||||||
|
@ -674,14 +621,8 @@ void AddMenusForHierchicalSheet( wxMenu* PopMenu, DrawSheetStruct* Sheet )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
void AddMenusForPinSheet( wxMenu* PopMenu, SCH_SHEET_PIN* PinSheet )
|
||||||
void AddMenusForPinSheet( wxMenu* PopMenu,
|
|
||||||
Hierarchical_PIN_Sheet_Struct* PinSheet )
|
|
||||||
{
|
{
|
||||||
/************************************************************************/
|
|
||||||
|
|
||||||
/* Add menu commands for a Pin Sheet (or Sheet label)
|
|
||||||
*/
|
|
||||||
if( !PinSheet->m_Flags )
|
if( !PinSheet->m_Flags )
|
||||||
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_PINSHEET,
|
ADD_MENUITEM( PopMenu, ID_POPUP_SCH_MOVE_PINSHEET,
|
||||||
_( "Move PinSheet" ), move_xpm );
|
_( "Move PinSheet" ), move_xpm );
|
||||||
|
@ -695,13 +636,8 @@ void AddMenusForPinSheet( wxMenu* PopMenu,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************/
|
|
||||||
void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame )
|
void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame )
|
||||||
{
|
{
|
||||||
/**********************************************************************/
|
|
||||||
|
|
||||||
/* Add menu commands for block
|
|
||||||
*/
|
|
||||||
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
|
ADD_MENUITEM( PopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND,
|
||||||
_( "Cancel Block" ), cancel_xpm );
|
_( "Cancel Block" ), cancel_xpm );
|
||||||
|
|
||||||
|
@ -713,7 +649,9 @@ void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame )
|
||||||
|
|
||||||
ADD_MENUITEM( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), apply_xpm );
|
ADD_MENUITEM( PopMenu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), apply_xpm );
|
||||||
|
|
||||||
if( frame->GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE ) // After a block move (that is also a block selection) one can reselect a block function:
|
// After a block move (that is also a block selection) one can reselect
|
||||||
|
// a block function.
|
||||||
|
if( frame->GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE )
|
||||||
{
|
{
|
||||||
ADD_MENUITEM( PopMenu, wxID_COPY, _( "Save Block" ), copy_button );
|
ADD_MENUITEM( PopMenu, wxID_COPY, _( "Save Block" ), copy_button );
|
||||||
ADD_MENUITEM( PopMenu, ID_POPUP_COPY_BLOCK, _( "Copy Block" ),
|
ADD_MENUITEM( PopMenu, ID_POPUP_COPY_BLOCK, _( "Copy Block" ),
|
||||||
|
@ -735,11 +673,9 @@ void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************/
|
|
||||||
void AddMenusForMarkers( wxMenu* aPopMenu, MARKER_SCH* aMarker,
|
void AddMenusForMarkers( wxMenu* aPopMenu, MARKER_SCH* aMarker,
|
||||||
WinEDA_SchematicFrame* aFrame )
|
WinEDA_SchematicFrame* aFrame )
|
||||||
{
|
{
|
||||||
/**********************************************************************/
|
|
||||||
ADD_MENUITEM( aPopMenu, ID_POPUP_SCH_DELETE, _( "Delete Marker" ),
|
ADD_MENUITEM( aPopMenu, ID_POPUP_SCH_DELETE, _( "Delete Marker" ),
|
||||||
delete_xpm );
|
delete_xpm );
|
||||||
ADD_MENUITEM( aPopMenu, ID_POPUP_SCH_GETINFO_MARKER,
|
ADD_MENUITEM( aPopMenu, ID_POPUP_SCH_GETINFO_MARKER,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/***************************************************
|
/***************************************************
|
||||||
* operations_on_item_lists.cpp
|
* operations_on_item_lists.cpp
|
||||||
* functions used in block commands, on lists of schematic items:
|
* functions used in block commands, on lists of schematic items:
|
||||||
* move, mirror, delete anc copy
|
* move, mirror, delete anc copy
|
||||||
****************************************************/
|
****************************************************/
|
||||||
|
@ -15,18 +15,14 @@
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
|
|
||||||
/* Exported Functions */
|
|
||||||
void MoveItemsInList( PICKED_ITEMS_LIST& aItemsList, const wxPoint aMoveVector );
|
void MoveItemsInList( PICKED_ITEMS_LIST& aItemsList, const wxPoint aMoveVector );
|
||||||
void MirrorListOfItems( PICKED_ITEMS_LIST& aItemsList, wxPoint& aMirrorPoint );
|
void MirrorListOfItems( PICKED_ITEMS_LIST& aItemsList, wxPoint& aMirrorPoint );
|
||||||
void DeleteItemsInList( WinEDA_DrawPanel* panel,
|
void DeleteItemsInList( WinEDA_DrawPanel* panel,
|
||||||
PICKED_ITEMS_LIST& aItemsList );
|
PICKED_ITEMS_LIST& aItemsList );
|
||||||
void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList,
|
void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList,
|
||||||
const wxPoint aMoveVector );
|
const wxPoint aMoveVector );
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* Routine to Mirror objects. *
|
|
||||||
*****************************************************************************/
|
|
||||||
void MirrorListOfItems( PICKED_ITEMS_LIST& aItemsList, wxPoint& aMirrorPoint )
|
void MirrorListOfItems( PICKED_ITEMS_LIST& aItemsList, wxPoint& aMirrorPoint )
|
||||||
{
|
{
|
||||||
for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
|
for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
|
||||||
|
@ -38,12 +34,11 @@ void MirrorListOfItems( PICKED_ITEMS_LIST& aItemsList, wxPoint& aMirrorPoint )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Function MoveItemsInList
|
/** Function MoveItemsInList
|
||||||
* Move a list of items to a givent move vector
|
* Move a list of items to a givent move vector
|
||||||
* @param aItemsList = list of picked items
|
* @param aItemsList = list of picked items
|
||||||
* @param aMoveVector = the move vector value
|
* @param aMoveVector = the move vector value
|
||||||
*/
|
*/
|
||||||
void MoveItemsInList( PICKED_ITEMS_LIST& aItemsList, const wxPoint aMoveVector )
|
void MoveItemsInList( PICKED_ITEMS_LIST& aItemsList, const wxPoint aMoveVector )
|
||||||
{
|
{
|
||||||
for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
|
for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
|
||||||
|
@ -54,7 +49,6 @@ void MoveItemsInList( PICKED_ITEMS_LIST& aItemsList, const wxPoint aMoveVector )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** function DeleteItemsInList
|
/** function DeleteItemsInList
|
||||||
* delete schematic items in aItemsList
|
* delete schematic items in aItemsList
|
||||||
* deleted items are put in undo list
|
* deleted items are put in undo list
|
||||||
|
@ -69,17 +63,17 @@ void DeleteItemsInList( WinEDA_DrawPanel* panel, PICKED_ITEMS_LIST& aItemsList )
|
||||||
for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
|
for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
SCH_ITEM* item = (SCH_ITEM*) aItemsList.GetPickedItem( ii );
|
SCH_ITEM* item = (SCH_ITEM*) aItemsList.GetPickedItem( ii );
|
||||||
itemWrapper.m_PickedItem = item;
|
itemWrapper.m_PickedItem = item;
|
||||||
itemWrapper.m_UndoRedoStatus = UR_DELETED;
|
itemWrapper.m_UndoRedoStatus = UR_DELETED;
|
||||||
if( item->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
|
if( item->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
/* this item is depending on a sheet, and is not in global list */
|
/* this item is depending on a sheet, and is not in global list */
|
||||||
wxMessageBox( wxT(
|
wxMessageBox( wxT( "DeleteItemsInList() err: unexpected \
|
||||||
"DeleteItemsInList() err: unexpected DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE" ) );
|
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE" ) );
|
||||||
#if 0
|
#if 0
|
||||||
Hierarchical_PIN_Sheet_Struct* pinlabel = (Hierarchical_PIN_Sheet_Struct*) item;
|
SCH_SHEET_PIN* pinlabel = (SCH_SHEET_PIN*) item;
|
||||||
frame->DeleteSheetLabel( false, pinlabel->m_Parent );
|
frame->DeleteSheetLabel( false, pinlabel->m_Parent );
|
||||||
itemWrapper.m_PickedItem = pinlabel->m_Parent;
|
itemWrapper.m_PickedItem = pinlabel->m_Parent;
|
||||||
itemWrapper.m_UndoRedoStatus = UR_CHANGED;
|
itemWrapper.m_UndoRedoStatus = UR_CHANGED;
|
||||||
itemsList.PushItem( itemWrapper );
|
itemsList.PushItem( itemWrapper );
|
||||||
#endif
|
#endif
|
||||||
|
@ -99,13 +93,10 @@ void DeleteItemsInList( WinEDA_DrawPanel* panel, PICKED_ITEMS_LIST& aItemsList )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************************/
|
|
||||||
void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct )
|
|
||||||
/*********************************************************************************/
|
|
||||||
|
|
||||||
/* Routine to delete an object from global drawing object list.
|
/* Routine to delete an object from global drawing object list.
|
||||||
* Object is put in Undo list
|
* Object is put in Undo list
|
||||||
*/
|
*/
|
||||||
|
void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct )
|
||||||
{
|
{
|
||||||
SCH_SCREEN* screen = (SCH_SCREEN*) panel->GetScreen();
|
SCH_SCREEN* screen = (SCH_SCREEN*) panel->GetScreen();
|
||||||
WinEDA_SchematicFrame* frame = (WinEDA_SchematicFrame*) panel->m_Parent;
|
WinEDA_SchematicFrame* frame = (WinEDA_SchematicFrame*) panel->m_Parent;
|
||||||
|
@ -115,17 +106,16 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct )
|
||||||
|
|
||||||
if( DrawStruct->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
|
if( DrawStruct->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
/* Cette stucture est rattachee a une feuille, et n'est pas
|
/* This structure is attached to a node, and is not accessible by
|
||||||
* accessible par la liste globale directement */
|
* the global list directly. */
|
||||||
frame->SaveCopyInUndoList( (SCH_ITEM*)( (Hierarchical_PIN_Sheet_Struct
|
frame->SaveCopyInUndoList(
|
||||||
*) DrawStruct )->GetParent(),
|
(SCH_ITEM*) ( (SCH_SHEET_PIN*) DrawStruct )-> GetParent(),
|
||||||
UR_CHANGED );
|
UR_CHANGED );
|
||||||
frame->DeleteSheetLabel( DC ? true : false,
|
frame->DeleteSheetLabel( DC ? true : false,
|
||||||
(Hierarchical_PIN_Sheet_Struct*) DrawStruct );
|
(SCH_SHEET_PIN*) DrawStruct );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
else /* structure classique */
|
|
||||||
{
|
{
|
||||||
screen->RemoveFromDrawList( DrawStruct );
|
screen->RemoveFromDrawList( DrawStruct );
|
||||||
|
|
||||||
|
@ -140,14 +130,12 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Routine to copy a new entity of an object for each object in list and
|
||||||
/*****************************************************************************/
|
* reposition it.
|
||||||
void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList, const wxPoint aMoveVector )
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
/* Routine to copy a new entity of an object for each object in list and reposition it.
|
|
||||||
* Return the new created object list in aItemsList
|
* Return the new created object list in aItemsList
|
||||||
*/
|
*/
|
||||||
|
void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList,
|
||||||
|
const wxPoint aMoveVector )
|
||||||
{
|
{
|
||||||
SCH_ITEM* newitem;
|
SCH_ITEM* newitem;
|
||||||
|
|
||||||
|
@ -178,7 +166,7 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList, co
|
||||||
|
|
||||||
case DRAW_SHEET_STRUCT_TYPE:
|
case DRAW_SHEET_STRUCT_TYPE:
|
||||||
{
|
{
|
||||||
DrawSheetStruct* sheet = (DrawSheetStruct*) newitem;
|
SCH_SHEET* sheet = (SCH_SHEET*) newitem;
|
||||||
sheet->m_TimeStamp = GetTimeStamp();
|
sheet->m_TimeStamp = GetTimeStamp();
|
||||||
sheet->SetSon( NULL );
|
sheet->SetSon( NULL );
|
||||||
break;
|
break;
|
||||||
|
@ -200,13 +188,10 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList, co
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************/
|
|
||||||
SCH_ITEM* DuplicateStruct( SCH_ITEM* DrawStruct )
|
|
||||||
/************************************************************/
|
|
||||||
|
|
||||||
/* Routine to create a new copy of given struct.
|
/* Routine to create a new copy of given struct.
|
||||||
* The new object is not put in draw list (not linked)
|
* The new object is not put in draw list (not linked)
|
||||||
*/
|
*/
|
||||||
|
SCH_ITEM* DuplicateStruct( SCH_ITEM* DrawStruct )
|
||||||
{
|
{
|
||||||
SCH_ITEM* NewDrawStruct = NULL;
|
SCH_ITEM* NewDrawStruct = NULL;
|
||||||
|
|
||||||
|
@ -263,7 +248,7 @@ SCH_ITEM* DuplicateStruct( SCH_ITEM* DrawStruct )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DRAW_SHEET_STRUCT_TYPE:
|
case DRAW_SHEET_STRUCT_TYPE:
|
||||||
NewDrawStruct = ( (DrawSheetStruct*) DrawStruct )->GenCopy();
|
NewDrawStruct = ( (SCH_SHEET*) DrawStruct )->GenCopy();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -279,5 +264,3 @@ SCH_ITEM* DuplicateStruct( SCH_ITEM* DrawStruct )
|
||||||
NewDrawStruct->m_Image = DrawStruct;
|
NewDrawStruct->m_Image = DrawStruct;
|
||||||
return NewDrawStruct;
|
return NewDrawStruct;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -17,19 +17,13 @@
|
||||||
|
|
||||||
|
|
||||||
/* Local Variables : */
|
/* Local Variables : */
|
||||||
static void Plot_Hierarchical_PIN_Sheet( PLOTTER* plotter,
|
static void Plot_Hierarchical_PIN_Sheet( PLOTTER* plotter,
|
||||||
Hierarchical_PIN_Sheet_Struct* Struct );
|
SCH_SHEET_PIN* Struct );
|
||||||
static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
|
static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
|
||||||
int FieldNumber, int IsMulti, int DrawMode );
|
int FieldNumber, int IsMulti, int DrawMode );
|
||||||
|
|
||||||
/***/
|
|
||||||
|
|
||||||
/**********************************************************/
|
|
||||||
static void PlotNoConnectStruct( PLOTTER* plotter, DrawNoConnectStruct* Struct )
|
static void PlotNoConnectStruct( PLOTTER* plotter, DrawNoConnectStruct* Struct )
|
||||||
/**********************************************************/
|
|
||||||
|
|
||||||
/* Routine de dessin des symboles de "No Connexion" ..
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
#define DELTA (DRAWNOCONNECT_SIZE / 2)
|
#define DELTA (DRAWNOCONNECT_SIZE / 2)
|
||||||
int pX, pY;
|
int pX, pY;
|
||||||
|
@ -44,10 +38,7 @@ static void PlotNoConnectStruct( PLOTTER* plotter, DrawNoConnectStruct* Struct )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************/
|
|
||||||
static void PlotLibPart( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem )
|
static void PlotLibPart( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem )
|
||||||
/*************************************************/
|
|
||||||
/* Polt a component */
|
|
||||||
{
|
{
|
||||||
LIB_COMPONENT* Entry;
|
LIB_COMPONENT* Entry;
|
||||||
int TransMat[2][2];
|
int TransMat[2][2];
|
||||||
|
@ -69,21 +60,17 @@ static void PlotLibPart( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************/
|
/* Plot field text.
|
||||||
|
* Input:
|
||||||
|
* DrawLibItem: pointer to the component
|
||||||
|
* FieldNumber: Number Field
|
||||||
|
* IsMulti: No Null flag if there are several sides by housing.
|
||||||
|
* Only useful for the field to add a reference to this one
|
||||||
|
* The identification from (A, B ...)
|
||||||
|
* DrawMode: trace mode
|
||||||
|
*/
|
||||||
static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
|
static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
|
||||||
int FieldNumber, int IsMulti, int DrawMode )
|
int FieldNumber, int IsMulti, int DrawMode )
|
||||||
/**************************************************************/
|
|
||||||
|
|
||||||
/* Routine de trace des textes type Field du composant.
|
|
||||||
* entree:
|
|
||||||
* DrawLibItem: pointeur sur le composant
|
|
||||||
* FieldNumber: Numero du champ
|
|
||||||
* IsMulti: flag Non Null si il y a plusieurs parts par boitier.
|
|
||||||
* n'est utile que pour le champ reference pour ajouter a celui ci
|
|
||||||
* l'identification de la part ( A, B ... )
|
|
||||||
* DrawMode: mode de trace
|
|
||||||
*/
|
|
||||||
|
|
||||||
{
|
{
|
||||||
SCH_CMP_FIELD* field = DrawLibItem->GetField( FieldNumber );
|
SCH_CMP_FIELD* field = DrawLibItem->GetField( FieldNumber );
|
||||||
EDA_Colors color = UNSPECIFIED_COLOR;
|
EDA_Colors color = UNSPECIFIED_COLOR;
|
||||||
|
@ -96,9 +83,10 @@ static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
|
||||||
if( field->IsVoid() )
|
if( field->IsVoid() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Calculate the text orientation, according to the component orientation/mirror */
|
/* Calculate the text orientation, according to the component
|
||||||
|
* orientation/mirror */
|
||||||
int orient = field->m_Orient;
|
int orient = field->m_Orient;
|
||||||
if( DrawLibItem->m_Transform[0][1] ) // Rotation du composant de 90deg
|
if( DrawLibItem->m_Transform[0][1] ) // Rotate component 90 deg.
|
||||||
{
|
{
|
||||||
if( orient == TEXT_ORIENT_HORIZ )
|
if( orient == TEXT_ORIENT_HORIZ )
|
||||||
orient = TEXT_ORIENT_VERT;
|
orient = TEXT_ORIENT_VERT;
|
||||||
|
@ -106,16 +94,17 @@ static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
|
||||||
orient = TEXT_ORIENT_HORIZ;
|
orient = TEXT_ORIENT_HORIZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Calculate the text justification, according to the component orientation/mirror
|
/* Calculate the text justification, according to the component
|
||||||
|
* orientation/mirror
|
||||||
* this is a bit complicated due to cumulative calculations:
|
* this is a bit complicated due to cumulative calculations:
|
||||||
* - numerous cases (mirrored or not, rotation)
|
* - numerous cases (mirrored or not, rotation)
|
||||||
* - the DrawGraphicText function recalculate also H and H vustifications
|
* - the DrawGraphicText function recalculate also H and H justifications
|
||||||
* according to the text orienation.
|
* according to the text orientation.
|
||||||
* - When a component is mirrored, the text is not mirrored and justifications
|
* - When a component is mirrored, the text is not mirrored and
|
||||||
* are complicated to calculate
|
* justifications are complicated to calculate
|
||||||
* so the more easily way is to use no justifications ( Centered text )
|
* so the more easily way is to use no justifications ( Centered text )
|
||||||
* and use GetBoundaryBox to know the text coordinate considered as centered
|
* and use GetBoundaryBox to know the text coordinate considered as centered
|
||||||
*/
|
*/
|
||||||
EDA_Rect BoundaryBox = field->GetBoundaryBox();
|
EDA_Rect BoundaryBox = field->GetBoundaryBox();
|
||||||
GRTextHorizJustifyType hjustify = GR_TEXT_HJUSTIFY_CENTER;
|
GRTextHorizJustifyType hjustify = GR_TEXT_HJUSTIFY_CENTER;
|
||||||
GRTextVertJustifyType vjustify = GR_TEXT_VJUSTIFY_CENTER;
|
GRTextVertJustifyType vjustify = GR_TEXT_VJUSTIFY_CENTER;
|
||||||
|
@ -131,7 +120,7 @@ static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
|
||||||
hjustify, vjustify,
|
hjustify, vjustify,
|
||||||
thickness, field->m_Italic, field->m_Bold );
|
thickness, field->m_Italic, field->m_Bold );
|
||||||
}
|
}
|
||||||
else /* We plt the reference, for a multiple parts per package */
|
else /* We plot the reference, for a multiple parts per package */
|
||||||
{
|
{
|
||||||
/* Adding A, B ... to the reference */
|
/* Adding A, B ... to the reference */
|
||||||
wxString Text;
|
wxString Text;
|
||||||
|
@ -152,13 +141,8 @@ static void PlotTextField( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************/
|
|
||||||
void PlotPinSymbol( PLOTTER* plotter, const wxPoint& pos,
|
void PlotPinSymbol( PLOTTER* plotter, const wxPoint& pos,
|
||||||
int len, int orient, int Shape )
|
int len, int orient, int Shape )
|
||||||
/**************************************************************************/
|
|
||||||
|
|
||||||
/* Trace la pin du symbole en cours de trace
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
int MapX1, MapY1, x1, y1;
|
int MapX1, MapY1, x1, y1;
|
||||||
EDA_Colors color = UNSPECIFIED_COLOR;
|
EDA_Colors color = UNSPECIFIED_COLOR;
|
||||||
|
@ -226,14 +210,16 @@ void PlotPinSymbol( PLOTTER* plotter, const wxPoint& pos,
|
||||||
{
|
{
|
||||||
if( MapY1 == 0 ) /* MapX1 = +- 1 */
|
if( MapY1 == 0 ) /* MapX1 = +- 1 */
|
||||||
{
|
{
|
||||||
plotter->move_to( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, y1 ) );
|
plotter->move_to( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2,
|
||||||
|
y1 ) );
|
||||||
plotter->line_to( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2,
|
plotter->line_to( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2,
|
||||||
y1 - IEEE_SYMBOL_PIN_DIM ) );
|
y1 - IEEE_SYMBOL_PIN_DIM ) );
|
||||||
plotter->finish_to( wxPoint( x1, y1 ) );
|
plotter->finish_to( wxPoint( x1, y1 ) );
|
||||||
}
|
}
|
||||||
else /* MapX1 = 0 */
|
else /* MapX1 = 0 */
|
||||||
{
|
{
|
||||||
plotter->move_to( wxPoint( x1, y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ) );
|
plotter->move_to( wxPoint( x1,
|
||||||
|
y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ) );
|
||||||
plotter->line_to( wxPoint( x1 - IEEE_SYMBOL_PIN_DIM,
|
plotter->line_to( wxPoint( x1 - IEEE_SYMBOL_PIN_DIM,
|
||||||
y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ) );
|
y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ) );
|
||||||
plotter->finish_to( wxPoint( x1, y1 ) );
|
plotter->finish_to( wxPoint( x1, y1 ) );
|
||||||
|
@ -246,25 +232,20 @@ void PlotPinSymbol( PLOTTER* plotter, const wxPoint& pos,
|
||||||
if( MapY1 == 0 ) /* MapX1 = +- 1 */
|
if( MapY1 == 0 ) /* MapX1 = +- 1 */
|
||||||
{
|
{
|
||||||
plotter->move_to( wxPoint( x1, y1 - IEEE_SYMBOL_PIN_DIM ) );
|
plotter->move_to( wxPoint( x1, y1 - IEEE_SYMBOL_PIN_DIM ) );
|
||||||
plotter->finish_to( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, y1 ) );
|
plotter->finish_to( wxPoint( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2,
|
||||||
|
y1 ) );
|
||||||
}
|
}
|
||||||
else /* MapX1 = 0 */
|
else /* MapX1 = 0 */
|
||||||
{
|
{
|
||||||
plotter->move_to( wxPoint( x1 - IEEE_SYMBOL_PIN_DIM, y1 ) );
|
plotter->move_to( wxPoint( x1 - IEEE_SYMBOL_PIN_DIM, y1 ) );
|
||||||
plotter->finish_to( wxPoint( x1, y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ) );
|
plotter->finish_to( wxPoint( x1,
|
||||||
|
y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************/
|
|
||||||
static void PlotTextStruct( PLOTTER* plotter, SCH_TEXT* aSchText )
|
static void PlotTextStruct( PLOTTER* plotter, SCH_TEXT* aSchText )
|
||||||
/********************************************************************/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Routine de trace des Textes, Labels et Global-Labels.
|
|
||||||
* Les textes peuvent avoir 4 directions.
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
static std::vector <wxPoint> Poly;
|
static std::vector <wxPoint> Poly;
|
||||||
|
|
||||||
|
@ -299,42 +280,39 @@ static void PlotTextStruct( PLOTTER* plotter, SCH_TEXT* aSchText )
|
||||||
for( unsigned i = 0; i<list->Count(); i++ )
|
for( unsigned i = 0; i<list->Count(); i++ )
|
||||||
{
|
{
|
||||||
wxString txt = list->Item( i );
|
wxString txt = list->Item( i );
|
||||||
plotter->text( pos,
|
plotter->text( pos, color, txt, aSchText->m_Orient,
|
||||||
color, txt, aSchText->m_Orient, aSchText->m_Size,
|
aSchText->m_Size, aSchText->m_HJustify,
|
||||||
aSchText->m_HJustify, aSchText->m_VJustify,
|
aSchText->m_VJustify, thickness,
|
||||||
thickness, aSchText->m_Italic, aSchText->m_Bold );
|
aSchText->m_Italic, aSchText->m_Bold );
|
||||||
pos += offset;
|
pos += offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete (list);
|
delete (list);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
plotter->text( textpos,
|
plotter->text( textpos, color, aSchText->m_Text, aSchText->m_Orient,
|
||||||
color, aSchText->m_Text, aSchText->m_Orient, aSchText->m_Size,
|
aSchText->m_Size, aSchText->m_HJustify,
|
||||||
aSchText->m_HJustify, aSchText->m_VJustify,
|
aSchText->m_VJustify, thickness, aSchText->m_Italic,
|
||||||
thickness, aSchText->m_Italic, aSchText->m_Bold );
|
aSchText->m_Bold );
|
||||||
|
|
||||||
/* Draw graphic symbol for global or hierachical labels */
|
/* Draw graphic symbol for global or hierarchical labels */
|
||||||
if( aSchText->Type() == TYPE_SCH_GLOBALLABEL )
|
if( aSchText->Type() == TYPE_SCH_GLOBALLABEL )
|
||||||
{
|
{
|
||||||
( (SCH_GLOBALLABEL*) aSchText )->CreateGraphicShape( Poly, aSchText->m_Pos );
|
( (SCH_GLOBALLABEL*) aSchText )->CreateGraphicShape( Poly,
|
||||||
|
aSchText->m_Pos );
|
||||||
plotter->poly( Poly.size(), &Poly[0].x, NO_FILL );
|
plotter->poly( Poly.size(), &Poly[0].x, NO_FILL );
|
||||||
}
|
}
|
||||||
if( aSchText->Type() == TYPE_SCH_HIERLABEL )
|
if( aSchText->Type() == TYPE_SCH_HIERLABEL )
|
||||||
{
|
{
|
||||||
( (SCH_HIERLABEL*) aSchText )->CreateGraphicShape( Poly, aSchText->m_Pos );
|
( (SCH_HIERLABEL*) aSchText )->CreateGraphicShape( Poly,
|
||||||
|
aSchText->m_Pos );
|
||||||
plotter->poly( Poly.size(), &Poly[0].x, NO_FILL );
|
plotter->poly( Poly.size(), &Poly[0].x, NO_FILL );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************************/
|
static void Plot_Hierarchical_PIN_Sheet( PLOTTER* plotter,
|
||||||
static void Plot_Hierarchical_PIN_Sheet( PLOTTER* plotter,
|
SCH_SHEET_PIN* aHierarchical_PIN )
|
||||||
Hierarchical_PIN_Sheet_Struct* aHierarchical_PIN )
|
|
||||||
/****************************************************************************************/
|
|
||||||
|
|
||||||
/* Plot a Hierarchical_PIN_Sheet
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
EDA_Colors txtcolor = UNSPECIFIED_COLOR;
|
EDA_Colors txtcolor = UNSPECIFIED_COLOR;
|
||||||
int posx, tposx, posy, size;
|
int posx, tposx, posy, size;
|
||||||
|
@ -361,10 +339,10 @@ static void Plot_Hierarchical_PIN_Sheet( PLOTTER* plotter,
|
||||||
int thickness = aHierarchical_PIN->GetPenSize();
|
int thickness = aHierarchical_PIN->GetPenSize();
|
||||||
plotter->set_current_line_width( thickness );
|
plotter->set_current_line_width( thickness );
|
||||||
|
|
||||||
plotter->text( wxPoint( tposx, posy ), txtcolor,
|
plotter->text( wxPoint( tposx, posy ), txtcolor, aHierarchical_PIN->m_Text,
|
||||||
aHierarchical_PIN->m_Text, TEXT_ORIENT_HORIZ, wxSize( size, size ),
|
TEXT_ORIENT_HORIZ, wxSize( size, size ),
|
||||||
side, GR_TEXT_VJUSTIFY_CENTER,
|
side, GR_TEXT_VJUSTIFY_CENTER, thickness,
|
||||||
thickness, aHierarchical_PIN->m_Italic, aHierarchical_PIN->m_Bold );
|
aHierarchical_PIN->m_Italic, aHierarchical_PIN->m_Bold );
|
||||||
|
|
||||||
/* Draw the associated graphic symbol */
|
/* Draw the associated graphic symbol */
|
||||||
aHierarchical_PIN->CreateGraphicShape( Poly, aHierarchical_PIN->m_Pos );
|
aHierarchical_PIN->CreateGraphicShape( Poly, aHierarchical_PIN->m_Pos );
|
||||||
|
@ -373,12 +351,9 @@ static void Plot_Hierarchical_PIN_Sheet( PLOTTER* plotter,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************/
|
static void PlotSheetStruct( PLOTTER* plotter, SCH_SHEET* Struct )
|
||||||
static void PlotSheetStruct( PLOTTER* plotter, DrawSheetStruct* Struct )
|
|
||||||
/*************************************************/
|
|
||||||
/* Routine de dessin du bloc type hierarchie */
|
|
||||||
{
|
{
|
||||||
Hierarchical_PIN_Sheet_Struct* SheetLabelStruct;
|
SCH_SHEET_PIN* SheetLabelStruct;
|
||||||
EDA_Colors txtcolor = UNSPECIFIED_COLOR;
|
EDA_Colors txtcolor = UNSPECIFIED_COLOR;
|
||||||
wxSize size;
|
wxSize size;
|
||||||
wxString Text;
|
wxString Text;
|
||||||
|
@ -424,9 +399,9 @@ static void PlotSheetStruct( PLOTTER* plotter, DrawSheetStruct* Struct )
|
||||||
|
|
||||||
plotter->set_color( ReturnLayerColor( LAYER_SHEETFILENAME ) );
|
plotter->set_color( ReturnLayerColor( LAYER_SHEETFILENAME ) );
|
||||||
|
|
||||||
plotter->text( wxPoint( Struct->m_Pos.x, Struct->m_Pos.y + Struct->m_Size.y + 4 ),
|
plotter->text( wxPoint( Struct->m_Pos.x,
|
||||||
txtcolor,
|
Struct->m_Pos.y + Struct->m_Size.y + 4 ),
|
||||||
Text, TEXT_ORIENT_HORIZ, size,
|
txtcolor, Text, TEXT_ORIENT_HORIZ, size,
|
||||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP,
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP,
|
||||||
thickness, italic, false );
|
thickness, italic, false );
|
||||||
|
|
||||||
|
@ -442,9 +417,7 @@ static void PlotSheetStruct( PLOTTER* plotter, DrawSheetStruct* Struct )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************/
|
|
||||||
void PlotDrawlist( PLOTTER* plotter, SCH_ITEM* aDrawlist )
|
void PlotDrawlist( PLOTTER* plotter, SCH_ITEM* aDrawlist )
|
||||||
/*********************************************************/
|
|
||||||
{
|
{
|
||||||
while( aDrawlist ) /* Plot each item in draw list */
|
while( aDrawlist ) /* Plot each item in draw list */
|
||||||
{
|
{
|
||||||
|
@ -489,7 +462,8 @@ void PlotDrawlist( PLOTTER* plotter, SCH_ITEM* aDrawlist )
|
||||||
#undef STRUCT
|
#undef STRUCT
|
||||||
#define STRUCT ( (DrawJunctionStruct*) aDrawlist )
|
#define STRUCT ( (DrawJunctionStruct*) aDrawlist )
|
||||||
plotter->set_color( ReturnLayerColor( STRUCT->GetLayer() ) );
|
plotter->set_color( ReturnLayerColor( STRUCT->GetLayer() ) );
|
||||||
plotter->circle( STRUCT->m_Pos, DRAWJUNCTION_DIAMETER, FILLED_SHAPE );
|
plotter->circle( STRUCT->m_Pos, DRAWJUNCTION_DIAMETER,
|
||||||
|
FILLED_SHAPE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_SCH_TEXT:
|
case TYPE_SCH_TEXT:
|
||||||
|
@ -514,7 +488,7 @@ void PlotDrawlist( PLOTTER* plotter, SCH_ITEM* aDrawlist )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DRAW_SHEET_STRUCT_TYPE:
|
case DRAW_SHEET_STRUCT_TYPE:
|
||||||
PlotSheetStruct( plotter, (DrawSheetStruct*) aDrawlist );
|
PlotSheetStruct( plotter, (SCH_SHEET*) aDrawlist );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DRAW_NOCONNECT_STRUCT_TYPE:
|
case DRAW_NOCONNECT_STRUCT_TYPE:
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
// Generated by DialogBlocks (unregistered), 01/02/2006 08:37:24
|
// Generated by DialogBlocks (unregistered), 01/02/2006 08:37:24
|
||||||
|
|
||||||
#if defined (__GNUG__) && !defined (NO_GCC_PRAGMA)
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
||||||
#pragma implementation "plotdxf.h"
|
#pragma implementation "plotdxf.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -28,8 +28,7 @@
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
|
|
||||||
/* Variables locales : */
|
static bool Plot_Sheet_Ref = TRUE;
|
||||||
static bool Plot_Sheet_Ref = TRUE;
|
|
||||||
|
|
||||||
#include "plotdxf.h"
|
#include "plotdxf.h"
|
||||||
|
|
||||||
|
@ -37,12 +36,7 @@ static bool Plot_Sheet_Ref = TRUE;
|
||||||
////@end XPM images
|
////@end XPM images
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
|
||||||
void WinEDA_SchematicFrame::ToPlot_DXF( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::ToPlot_DXF( wxCommandEvent& event )
|
||||||
/***********************************************************/
|
|
||||||
|
|
||||||
/* fonction relai de creation de la frame de dialogue pour trace Postscript
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
|
|
||||||
|
@ -71,16 +65,17 @@ IMPLEMENT_DYNAMIC_CLASS( WinEDA_PlotDXFFrame, wxDialog )
|
||||||
BEGIN_EVENT_TABLE( WinEDA_PlotDXFFrame, wxDialog )
|
BEGIN_EVENT_TABLE( WinEDA_PlotDXFFrame, wxDialog )
|
||||||
|
|
||||||
////@begin WinEDA_PlotDXFFrame event table entries
|
////@begin WinEDA_PlotDXFFrame event table entries
|
||||||
EVT_BUTTON( ID_PLOT_DXF_CURRENT_EXECUTE, WinEDA_PlotDXFFrame::OnPlotDXFCurrentExecuteClick )
|
EVT_BUTTON( ID_PLOT_DXF_CURRENT_EXECUTE,
|
||||||
|
WinEDA_PlotDXFFrame::OnPlotDXFCurrentExecuteClick )
|
||||||
|
|
||||||
EVT_BUTTON( ID_PLOT_DXF_ALL_EXECUTE, WinEDA_PlotDXFFrame::OnPlotDXFAllExecuteClick )
|
EVT_BUTTON( ID_PLOT_DXF_ALL_EXECUTE,
|
||||||
|
WinEDA_PlotDXFFrame::OnPlotDXFAllExecuteClick )
|
||||||
|
|
||||||
EVT_BUTTON( wxID_CANCEL, WinEDA_PlotDXFFrame::OnCancelClick )
|
EVT_BUTTON( wxID_CANCEL, WinEDA_PlotDXFFrame::OnCancelClick )
|
||||||
|
|
||||||
////@end WinEDA_PlotDXFFrame event table entries
|
////@end WinEDA_PlotDXFFrame event table entries
|
||||||
|
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* WinEDA_PlotDXFFrame constructors
|
* WinEDA_PlotDXFFrame constructors
|
||||||
*/
|
*/
|
||||||
|
@ -91,11 +86,11 @@ WinEDA_PlotDXFFrame::WinEDA_PlotDXFFrame()
|
||||||
|
|
||||||
|
|
||||||
WinEDA_PlotDXFFrame::WinEDA_PlotDXFFrame( WinEDA_DrawFrame* parent,
|
WinEDA_PlotDXFFrame::WinEDA_PlotDXFFrame( WinEDA_DrawFrame* parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxString& caption,
|
const wxString& caption,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
long style )
|
long style )
|
||||||
{
|
{
|
||||||
m_Parent = parent;
|
m_Parent = parent;
|
||||||
PlotDXFColorOpt = false;
|
PlotDXFColorOpt = false;
|
||||||
|
@ -108,33 +103,36 @@ WinEDA_PlotDXFFrame::WinEDA_PlotDXFFrame( WinEDA_DrawFrame* parent,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool WinEDA_PlotDXFFrame::Create( wxWindow* parent,
|
bool WinEDA_PlotDXFFrame::Create( wxWindow* parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxString& caption,
|
const wxString& caption,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
long style )
|
long style )
|
||||||
{
|
{
|
||||||
////@begin WinEDA_PlotDXFFrame member initialisation
|
////@begin WinEDA_PlotDXFFrame member initialisation
|
||||||
m_PlotDXFColorOption = NULL;
|
m_PlotDXFColorOption = NULL;
|
||||||
m_Plot_Sheet_Ref = NULL;
|
m_Plot_Sheet_Ref = NULL;
|
||||||
m_btClose = NULL;
|
m_btClose = NULL;
|
||||||
m_MsgBox = NULL;
|
m_MsgBox = NULL;
|
||||||
|
|
||||||
////@end WinEDA_PlotDXFFrame member initialisation
|
////@end WinEDA_PlotDXFFrame member initialisation
|
||||||
|
|
||||||
////@begin WinEDA_PlotDXFFrame creation
|
////@begin WinEDA_PlotDXFFrame creation
|
||||||
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
|
SetExtraStyle( wxWS_EX_BLOCK_EVENTS );
|
||||||
wxDialog::Create( parent, id, caption, pos, size, style );
|
wxDialog::Create( parent, id, caption, pos, size, style );
|
||||||
|
|
||||||
CreateControls();
|
CreateControls();
|
||||||
if (GetSizer())
|
if( GetSizer() )
|
||||||
{
|
{
|
||||||
GetSizer()->SetSizeHints(this);
|
GetSizer()->SetSizeHints( this );
|
||||||
}
|
}
|
||||||
Centre();
|
Centre();
|
||||||
|
|
||||||
////@end WinEDA_PlotDXFFrame creation
|
////@end WinEDA_PlotDXFFrame creation
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Control creation for WinEDA_PlotDXFFrame
|
* Control creation for WinEDA_PlotDXFFrame
|
||||||
*/
|
*/
|
||||||
|
@ -146,51 +144,86 @@ void WinEDA_PlotDXFFrame::CreateControls()
|
||||||
|
|
||||||
WinEDA_PlotDXFFrame* itemDialog1 = this;
|
WinEDA_PlotDXFFrame* itemDialog1 = this;
|
||||||
|
|
||||||
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxVERTICAL );
|
||||||
itemDialog1->SetSizer(itemBoxSizer2);
|
|
||||||
|
|
||||||
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
|
itemDialog1->SetSizer( itemBoxSizer2 );
|
||||||
itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
|
|
||||||
|
|
||||||
wxStaticBox* itemStaticBoxSizer6Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Plot Options:"));
|
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer( wxHORIZONTAL );
|
||||||
wxStaticBoxSizer* itemStaticBoxSizer6 = new wxStaticBoxSizer(itemStaticBoxSizer6Static, wxVERTICAL);
|
itemBoxSizer2->Add( itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
|
||||||
itemBoxSizer3->Add(itemStaticBoxSizer6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
|
||||||
|
wxStaticBox* itemStaticBoxSizer6Static =
|
||||||
|
new wxStaticBox( itemDialog1, wxID_ANY, _( "Plot Options:" ) );
|
||||||
|
wxStaticBoxSizer* itemStaticBoxSizer6 =
|
||||||
|
new wxStaticBoxSizer( itemStaticBoxSizer6Static, wxVERTICAL );
|
||||||
|
itemBoxSizer3->Add( itemStaticBoxSizer6,
|
||||||
|
0,
|
||||||
|
wxALIGN_CENTER_VERTICAL | wxALL,
|
||||||
|
5 );
|
||||||
|
|
||||||
wxArrayString m_PlotDXFColorOptionStrings;
|
wxArrayString m_PlotDXFColorOptionStrings;
|
||||||
m_PlotDXFColorOptionStrings.Add(_("B/W"));
|
m_PlotDXFColorOptionStrings.Add( _( "B/W" ) );
|
||||||
m_PlotDXFColorOptionStrings.Add(_("Color"));
|
m_PlotDXFColorOptionStrings.Add( _( "Color" ) );
|
||||||
m_PlotDXFColorOption = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Plot Color:"), wxDefaultPosition, wxDefaultSize, m_PlotDXFColorOptionStrings, 1, wxRA_SPECIFY_COLS );
|
m_PlotDXFColorOption =
|
||||||
m_PlotDXFColorOption->SetSelection(0);
|
new wxRadioBox( itemDialog1, ID_RADIOBOX, _( "Plot Color:" ),
|
||||||
itemStaticBoxSizer6->Add(m_PlotDXFColorOption, 0, wxGROW|wxALL, 5);
|
wxDefaultPosition, wxDefaultSize,
|
||||||
|
m_PlotDXFColorOptionStrings, 1, wxRA_SPECIFY_COLS );
|
||||||
|
m_PlotDXFColorOption->SetSelection( 0 );
|
||||||
|
itemStaticBoxSizer6->Add( m_PlotDXFColorOption, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
m_Plot_Sheet_Ref = new wxCheckBox( itemDialog1, ID_CHECKBOX, _("Print Sheet Ref"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
|
m_Plot_Sheet_Ref =
|
||||||
m_Plot_Sheet_Ref->SetValue(false);
|
new wxCheckBox( itemDialog1, ID_CHECKBOX, _( "Print Sheet Ref" ),
|
||||||
itemStaticBoxSizer6->Add(m_Plot_Sheet_Ref, 0, wxGROW|wxALL, 5);
|
wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
|
||||||
|
m_Plot_Sheet_Ref->SetValue( false );
|
||||||
|
itemStaticBoxSizer6->Add( m_Plot_Sheet_Ref, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
itemBoxSizer3->Add( 5, 5, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
||||||
|
|
||||||
wxBoxSizer* itemBoxSizer10 = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* itemBoxSizer10 = new wxBoxSizer( wxVERTICAL );
|
||||||
itemBoxSizer3->Add(itemBoxSizer10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
itemBoxSizer3->Add( itemBoxSizer10, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
||||||
|
|
||||||
wxButton* itemButton11 = new wxButton( itemDialog1, ID_PLOT_DXF_CURRENT_EXECUTE, _("&Plot Page"), wxDefaultPosition, wxDefaultSize, 0 );
|
wxButton* itemButton11 = new wxButton( itemDialog1,
|
||||||
|
ID_PLOT_DXF_CURRENT_EXECUTE,
|
||||||
|
_( "&Plot Page" ),
|
||||||
|
wxDefaultPosition,
|
||||||
|
wxDefaultSize,
|
||||||
|
0 );
|
||||||
itemButton11->SetDefault();
|
itemButton11->SetDefault();
|
||||||
itemBoxSizer10->Add(itemButton11, 0, wxGROW|wxALL, 5);
|
itemBoxSizer10->Add( itemButton11, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
wxButton* itemButton12 = new wxButton( itemDialog1, ID_PLOT_DXF_ALL_EXECUTE, _("Plot A&LL"), wxDefaultPosition, wxDefaultSize, 0 );
|
wxButton* itemButton12 = new wxButton( itemDialog1,
|
||||||
itemBoxSizer10->Add(itemButton12, 0, wxGROW|wxALL, 5);
|
ID_PLOT_DXF_ALL_EXECUTE,
|
||||||
|
_( "Plot A&LL" ),
|
||||||
|
wxDefaultPosition,
|
||||||
|
wxDefaultSize,
|
||||||
|
0 );
|
||||||
|
itemBoxSizer10->Add( itemButton12, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
m_btClose = new wxButton( itemDialog1, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_btClose = new wxButton( itemDialog1, wxID_CANCEL, _( "Close" ),
|
||||||
itemBoxSizer10->Add(m_btClose, 0, wxGROW|wxALL, 5);
|
wxDefaultPosition, wxDefaultSize,
|
||||||
|
0 );
|
||||||
|
itemBoxSizer10->Add( m_btClose, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1, wxID_STATIC, _("Messages :"), wxDefaultPosition, wxDefaultSize, 0 );
|
wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1,
|
||||||
itemBoxSizer2->Add(itemStaticText15, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
|
wxID_STATIC,
|
||||||
|
_( "Messages :" ),
|
||||||
|
wxDefaultPosition,
|
||||||
|
wxDefaultSize,
|
||||||
|
0 );
|
||||||
|
itemBoxSizer2->Add( itemStaticText15,
|
||||||
|
0,
|
||||||
|
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP |
|
||||||
|
wxADJUST_MINSIZE,
|
||||||
|
5 );
|
||||||
|
|
||||||
m_MsgBox = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxSize(-1, 200), wxTE_MULTILINE );
|
m_MsgBox = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T( "" ),
|
||||||
itemBoxSizer2->Add(m_MsgBox, 0, wxGROW|wxALL|wxFIXED_MINSIZE, 5);
|
wxDefaultPosition, wxSize( -1, 200 ),
|
||||||
|
wxTE_MULTILINE );
|
||||||
|
itemBoxSizer2->Add( m_MsgBox, 0, wxGROW | wxALL | wxFIXED_MINSIZE, 5 );
|
||||||
|
|
||||||
// Set validators
|
// Set validators
|
||||||
m_PlotDXFColorOption->SetValidator( wxGenericValidator(& PlotDXFColorOpt) );
|
m_PlotDXFColorOption->SetValidator( wxGenericValidator( &PlotDXFColorOpt ) );
|
||||||
m_Plot_Sheet_Ref->SetValidator( wxGenericValidator(& Plot_Sheet_Ref) );
|
m_Plot_Sheet_Ref->SetValidator( wxGenericValidator( &Plot_Sheet_Ref ) );
|
||||||
|
|
||||||
////@end WinEDA_PlotDXFFrame content construction
|
////@end WinEDA_PlotDXFFrame content construction
|
||||||
|
|
||||||
SetFocus(); // make the ESC work
|
SetFocus(); // make the ESC work
|
||||||
|
@ -215,8 +248,9 @@ wxBitmap WinEDA_PlotDXFFrame::GetBitmapResource( const wxString& name )
|
||||||
{
|
{
|
||||||
// Bitmap retrieval
|
// Bitmap retrieval
|
||||||
////@begin WinEDA_PlotDXFFrame bitmap retrieval
|
////@begin WinEDA_PlotDXFFrame bitmap retrieval
|
||||||
wxUnusedVar(name);
|
wxUnusedVar( name );
|
||||||
return wxNullBitmap;
|
return wxNullBitmap;
|
||||||
|
|
||||||
////@end WinEDA_PlotDXFFrame bitmap retrieval
|
////@end WinEDA_PlotDXFFrame bitmap retrieval
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,8 +263,9 @@ wxIcon WinEDA_PlotDXFFrame::GetIconResource( const wxString& name )
|
||||||
{
|
{
|
||||||
// Icon retrieval
|
// Icon retrieval
|
||||||
////@begin WinEDA_PlotDXFFrame icon retrieval
|
////@begin WinEDA_PlotDXFFrame icon retrieval
|
||||||
wxUnusedVar(name);
|
wxUnusedVar( name );
|
||||||
return wxNullIcon;
|
return wxNullIcon;
|
||||||
|
|
||||||
////@end WinEDA_PlotDXFFrame icon retrieval
|
////@end WinEDA_PlotDXFFrame icon retrieval
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,35 +311,37 @@ void WinEDA_PlotDXFFrame::OnCancelClick( wxCommandEvent& event )
|
||||||
|
|
||||||
/*****************************************/
|
/*****************************************/
|
||||||
void WinEDA_PlotDXFFrame::InitOptVars()
|
void WinEDA_PlotDXFFrame::InitOptVars()
|
||||||
/*****************************************/
|
|
||||||
{
|
{
|
||||||
Plot_Sheet_Ref = m_Plot_Sheet_Ref->GetValue();
|
/*****************************************/
|
||||||
|
Plot_Sheet_Ref = m_Plot_Sheet_Ref->GetValue();
|
||||||
PlotDXFColorOpt = m_PlotDXFColorOption->GetSelection();
|
PlotDXFColorOpt = m_PlotDXFColorOption->GetSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************/
|
/*************************************************************/
|
||||||
void WinEDA_PlotDXFFrame::CreateDXFFile( int AllPages )
|
void WinEDA_PlotDXFFrame::CreateDXFFile( int AllPages )
|
||||||
/*************************************************************/
|
|
||||||
{
|
{
|
||||||
WinEDA_SchematicFrame* schframe = (WinEDA_SchematicFrame*) m_Parent;
|
/*************************************************************/
|
||||||
SCH_SCREEN* screen = schframe->GetScreen();
|
WinEDA_SchematicFrame* schframe = (WinEDA_SchematicFrame*) m_Parent;
|
||||||
SCH_SCREEN* oldscreen = screen;
|
SCH_SCREEN* screen = schframe->GetScreen();
|
||||||
DrawSheetPath* sheetpath, *oldsheetpath = schframe->GetSheet();
|
SCH_SCREEN* oldscreen = screen;
|
||||||
wxString PlotFileName;
|
DrawSheetPath* sheetpath, * oldsheetpath = schframe->GetSheet();
|
||||||
|
wxString PlotFileName;
|
||||||
Ki_PageDescr* PlotSheet;
|
Ki_PageDescr* PlotSheet;
|
||||||
wxPoint plot_offset;
|
wxPoint plot_offset;
|
||||||
|
|
||||||
/* When printing all pages, the printed page is not the current page.
|
/* When printing all pages, the printed page is not the current page.
|
||||||
* In complex hierarchies, we must setup references and others parameters in the printed SCH_SCREEN
|
* In complex hierarchies, we must setup references and others parameters
|
||||||
|
* in the printed SCH_SCREEN
|
||||||
* because in complex hierarchies a SCH_SCREEN (a schematic drawings)
|
* because in complex hierarchies a SCH_SCREEN (a schematic drawings)
|
||||||
* is shared between many sheets
|
* is shared between many sheets
|
||||||
*/
|
*/
|
||||||
EDA_SheetList SheetList( NULL );
|
EDA_SheetList SheetList( NULL );
|
||||||
|
|
||||||
sheetpath = SheetList.GetFirst();
|
sheetpath = SheetList.GetFirst();
|
||||||
DrawSheetPath list;
|
DrawSheetPath list;
|
||||||
|
|
||||||
while (true)
|
while( true )
|
||||||
{
|
{
|
||||||
if( AllPages )
|
if( AllPages )
|
||||||
{
|
{
|
||||||
|
@ -324,12 +361,13 @@ void WinEDA_PlotDXFFrame::CreateDXFFile( int AllPages )
|
||||||
sheetpath = SheetList.GetNext();
|
sheetpath = SheetList.GetNext();
|
||||||
}
|
}
|
||||||
PlotSheet = screen->m_CurrentSheetDesc;
|
PlotSheet = screen->m_CurrentSheetDesc;
|
||||||
double scale = 10;
|
double scale = 10;
|
||||||
|
|
||||||
plot_offset.x = 0;
|
plot_offset.x = 0;
|
||||||
plot_offset.y = 0;
|
plot_offset.y = 0;
|
||||||
|
|
||||||
PlotFileName = schframe->GetUniqueFilenameForCurrentSheet( ) + wxT( ".dxf" );
|
PlotFileName = schframe->GetUniqueFilenameForCurrentSheet() + wxT(
|
||||||
|
".dxf" );
|
||||||
|
|
||||||
PlotOneSheetDXF( PlotFileName, screen, PlotSheet, plot_offset, scale );
|
PlotOneSheetDXF( PlotFileName, screen, PlotSheet, plot_offset, scale );
|
||||||
|
|
||||||
|
@ -344,20 +382,16 @@ void WinEDA_PlotDXFFrame::CreateDXFFile( int AllPages )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************************/
|
|
||||||
void WinEDA_PlotDXFFrame::PlotOneSheetDXF( const wxString& FileName,
|
void WinEDA_PlotDXFFrame::PlotOneSheetDXF( const wxString& FileName,
|
||||||
SCH_SCREEN* screen,
|
SCH_SCREEN* screen,
|
||||||
Ki_PageDescr* sheet,
|
Ki_PageDescr* sheet,
|
||||||
wxPoint plot_offset,
|
wxPoint plot_offset,
|
||||||
double scale)
|
double scale )
|
||||||
/*****************************************************************************************/
|
|
||||||
|
|
||||||
/* Trace en format DXF. d'une feuille de dessin
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
FILE *output_file = wxFopen( FileName, wxT( "wt" ) );
|
FILE* output_file = wxFopen( FileName, wxT( "wt" ) );
|
||||||
|
|
||||||
if( output_file == NULL )
|
if( output_file == NULL )
|
||||||
{
|
{
|
||||||
msg = wxT( "\n** " );
|
msg = wxT( "\n** " );
|
||||||
|
@ -371,23 +405,23 @@ void WinEDA_PlotDXFFrame::PlotOneSheetDXF( const wxString& FileName,
|
||||||
msg.Printf( _( "Plot: %s\n" ), FileName.GetData() );
|
msg.Printf( _( "Plot: %s\n" ), FileName.GetData() );
|
||||||
m_MsgBox->AppendText( msg );
|
m_MsgBox->AppendText( msg );
|
||||||
|
|
||||||
DXF_PLOTTER *plotter = new DXF_PLOTTER();
|
DXF_PLOTTER* plotter = new DXF_PLOTTER();
|
||||||
plotter->set_paper_size(sheet);
|
plotter->set_paper_size( sheet );
|
||||||
plotter->set_viewport( plot_offset, scale, 0);
|
plotter->set_viewport( plot_offset, scale, 0 );
|
||||||
plotter->set_color_mode(PlotDXFColorOpt);
|
plotter->set_color_mode( PlotDXFColorOpt );
|
||||||
|
|
||||||
/* Init : */
|
/* Init : */
|
||||||
plotter->set_creator(wxT("EESchema-DXF"));
|
plotter->set_creator( wxT( "EESchema-DXF" ) );
|
||||||
plotter->set_filename(FileName);
|
plotter->set_filename( FileName );
|
||||||
plotter->start_plot(output_file);
|
plotter->start_plot( output_file );
|
||||||
|
|
||||||
if( Plot_Sheet_Ref )
|
if( Plot_Sheet_Ref )
|
||||||
{
|
{
|
||||||
plotter->set_color( BLACK );
|
plotter->set_color( BLACK );
|
||||||
m_Parent->PlotWorkSheet( plotter, screen );
|
m_Parent->PlotWorkSheet( plotter, screen );
|
||||||
}
|
}
|
||||||
|
|
||||||
PlotDrawlist(plotter, screen->EEDrawList);
|
PlotDrawlist( plotter, screen->EEDrawList );
|
||||||
|
|
||||||
/* fin */
|
/* fin */
|
||||||
plotter->end_plot();
|
plotter->end_plot();
|
||||||
|
|
|
@ -7,12 +7,12 @@
|
||||||
// Created: 04/02/2006 16:54:19
|
// Created: 04/02/2006 16:54:19
|
||||||
// RCS-ID:
|
// RCS-ID:
|
||||||
// Copyright: License GNU
|
// Copyright: License GNU
|
||||||
// Licence:
|
// License:
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Generated by DialogBlocks (unregistered), 04/02/2006 16:54:19
|
// Generated by DialogBlocks (unregistered), 04/02/2006 16:54:19
|
||||||
|
|
||||||
#if defined (__GNUG__) && !defined (NO_GCC_PRAGMA)
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
||||||
#pragma implementation "plothpgl.h"
|
#pragma implementation "plothpgl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -35,11 +35,11 @@
|
||||||
////@begin XPM images
|
////@begin XPM images
|
||||||
////@end XPM images
|
////@end XPM images
|
||||||
|
|
||||||
/* Variables locales : */
|
FILE* PlotOutput;
|
||||||
FILE* PlotOutput; /* exportee dans printps.cc */
|
int HPGL_SizeSelect;
|
||||||
int HPGL_SizeSelect;
|
|
||||||
|
|
||||||
enum PageFormatReq {
|
enum PageFormatReq
|
||||||
|
{
|
||||||
PAGE_DEFAULT = 0,
|
PAGE_DEFAULT = 0,
|
||||||
PAGE_SIZE_A4,
|
PAGE_SIZE_A4,
|
||||||
PAGE_SIZE_A3,
|
PAGE_SIZE_A3,
|
||||||
|
@ -70,13 +70,11 @@ static Ki_PageDescr* Plot_sheet_list[] =
|
||||||
&g_Sheet_user
|
&g_Sheet_user
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Routines Locales */
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
void WinEDA_SchematicFrame::ToPlot_HPGL( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::ToPlot_HPGL( wxCommandEvent& event )
|
||||||
/**************************************************************/
|
|
||||||
{
|
{
|
||||||
|
/**************************************************************/
|
||||||
WinEDA_PlotHPGLFrame* HPGL_frame = new WinEDA_PlotHPGLFrame( this );
|
WinEDA_PlotHPGLFrame* HPGL_frame = new WinEDA_PlotHPGLFrame( this );
|
||||||
|
|
||||||
HPGL_frame->ShowModal();
|
HPGL_frame->ShowModal();
|
||||||
|
@ -99,24 +97,29 @@ BEGIN_EVENT_TABLE( WinEDA_PlotHPGLFrame, wxDialog )
|
||||||
////@begin WinEDA_PlotHPGLFrame event table entries
|
////@begin WinEDA_PlotHPGLFrame event table entries
|
||||||
EVT_RADIOBOX( ID_RADIOBOX, WinEDA_PlotHPGLFrame::OnRadioboxSelected )
|
EVT_RADIOBOX( ID_RADIOBOX, WinEDA_PlotHPGLFrame::OnRadioboxSelected )
|
||||||
|
|
||||||
EVT_SPINCTRL( ID_PEN_WIDTH_UPDATED, WinEDA_PlotHPGLFrame::OnPenWidthUpdatedUpdated )
|
EVT_SPINCTRL( ID_PEN_WIDTH_UPDATED,
|
||||||
|
WinEDA_PlotHPGLFrame::OnPenWidthUpdatedUpdated )
|
||||||
|
|
||||||
EVT_SPINCTRL( ID_PEN_SPEED_UPDATED, WinEDA_PlotHPGLFrame::OnPenSpeedUpdatedUpdated )
|
EVT_SPINCTRL( ID_PEN_SPEED_UPDATED,
|
||||||
|
WinEDA_PlotHPGLFrame::OnPenSpeedUpdatedUpdated )
|
||||||
|
|
||||||
EVT_SPINCTRL( ID_PEN_NUMBER_UPDATED, WinEDA_PlotHPGLFrame::OnPenNumberUpdatedUpdated )
|
EVT_SPINCTRL( ID_PEN_NUMBER_UPDATED,
|
||||||
|
WinEDA_PlotHPGLFrame::OnPenNumberUpdatedUpdated )
|
||||||
|
|
||||||
EVT_BUTTON( ID_PLOT_HPGL_CURRENT_EXECUTE, WinEDA_PlotHPGLFrame::OnPlotHpglCurrentExecuteClick )
|
EVT_BUTTON( ID_PLOT_HPGL_CURRENT_EXECUTE,
|
||||||
|
WinEDA_PlotHPGLFrame::OnPlotHpglCurrentExecuteClick )
|
||||||
|
|
||||||
EVT_BUTTON( ID_PLOT_HPGL_ALL_EXECUTE, WinEDA_PlotHPGLFrame::OnPlotHpglAllExecuteClick )
|
EVT_BUTTON( ID_PLOT_HPGL_ALL_EXECUTE,
|
||||||
|
WinEDA_PlotHPGLFrame::OnPlotHpglAllExecuteClick )
|
||||||
|
|
||||||
EVT_BUTTON( wxID_CANCEL, WinEDA_PlotHPGLFrame::OnCancelClick )
|
EVT_BUTTON( wxID_CANCEL, WinEDA_PlotHPGLFrame::OnCancelClick )
|
||||||
|
|
||||||
EVT_BUTTON( ID_PLOT_ACCEPT_OFFSET, WinEDA_PlotHPGLFrame::OnPlotAcceptOffsetClick )
|
EVT_BUTTON( ID_PLOT_ACCEPT_OFFSET,
|
||||||
|
WinEDA_PlotHPGLFrame::OnPlotAcceptOffsetClick )
|
||||||
|
|
||||||
////@end WinEDA_PlotHPGLFrame event table entries
|
////@end WinEDA_PlotHPGLFrame event table entries
|
||||||
|
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* WinEDA_PlotHPGLFrame constructors
|
* WinEDA_PlotHPGLFrame constructors
|
||||||
*/
|
*/
|
||||||
|
@ -150,27 +153,29 @@ bool WinEDA_PlotHPGLFrame::Create( wxWindow* parent,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
long style )
|
long style )
|
||||||
{
|
{
|
||||||
////@begin WinEDA_PlotHPGLFrame member initialisation
|
////@begin WinEDA_PlotHPGLFrame member initialization
|
||||||
m_SizeOption = NULL;
|
m_SizeOption = NULL;
|
||||||
m_ButtPenWidth = NULL;
|
m_ButtPenWidth = NULL;
|
||||||
m_ButtPenSpeed = NULL;
|
m_ButtPenSpeed = NULL;
|
||||||
m_ButtPenNum = NULL;
|
m_ButtPenNum = NULL;
|
||||||
m_PlotOrgPosition_X = NULL;
|
m_PlotOrgPosition_X = NULL;
|
||||||
m_PlotOrgPosition_Y = NULL;
|
m_PlotOrgPosition_Y = NULL;
|
||||||
m_btClose = NULL;
|
m_btClose = NULL;
|
||||||
m_MsgBox = NULL;
|
m_MsgBox = NULL;
|
||||||
////@end WinEDA_PlotHPGLFrame member initialisation
|
|
||||||
|
////@end WinEDA_PlotHPGLFrame member initialization
|
||||||
|
|
||||||
////@begin WinEDA_PlotHPGLFrame creation
|
////@begin WinEDA_PlotHPGLFrame creation
|
||||||
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
|
SetExtraStyle( wxWS_EX_BLOCK_EVENTS );
|
||||||
wxDialog::Create( parent, id, caption, pos, size, style );
|
wxDialog::Create( parent, id, caption, pos, size, style );
|
||||||
|
|
||||||
CreateControls();
|
CreateControls();
|
||||||
if (GetSizer())
|
if( GetSizer() )
|
||||||
{
|
{
|
||||||
GetSizer()->SetSizeHints(this);
|
GetSizer()->SetSizeHints( this );
|
||||||
}
|
}
|
||||||
Centre();
|
Centre();
|
||||||
|
|
||||||
////@end WinEDA_PlotHPGLFrame creation
|
////@end WinEDA_PlotHPGLFrame creation
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -187,100 +192,212 @@ void WinEDA_PlotHPGLFrame::CreateControls()
|
||||||
|
|
||||||
WinEDA_PlotHPGLFrame* itemDialog1 = this;
|
WinEDA_PlotHPGLFrame* itemDialog1 = this;
|
||||||
|
|
||||||
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxVERTICAL );
|
||||||
itemDialog1->SetSizer(itemBoxSizer2);
|
|
||||||
|
|
||||||
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
|
itemDialog1->SetSizer( itemBoxSizer2 );
|
||||||
itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
|
|
||||||
|
|
||||||
wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer( wxHORIZONTAL );
|
||||||
itemBoxSizer3->Add(itemBoxSizer4, 0, wxGROW|wxALL, 5);
|
itemBoxSizer2->Add( itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
|
||||||
|
|
||||||
|
wxBoxSizer* itemBoxSizer4 = new wxBoxSizer( wxVERTICAL );
|
||||||
|
itemBoxSizer3->Add( itemBoxSizer4, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
wxArrayString m_SizeOptionStrings;
|
wxArrayString m_SizeOptionStrings;
|
||||||
m_SizeOptionStrings.Add(_("Sheet Size"));
|
m_SizeOptionStrings.Add( _( "Sheet Size" ) );
|
||||||
m_SizeOptionStrings.Add(_("Page Size A4"));
|
m_SizeOptionStrings.Add( _( "Page Size A4" ) );
|
||||||
m_SizeOptionStrings.Add(_("Page Size A3"));
|
m_SizeOptionStrings.Add( _( "Page Size A3" ) );
|
||||||
m_SizeOptionStrings.Add(_("Page Size A2"));
|
m_SizeOptionStrings.Add( _( "Page Size A2" ) );
|
||||||
m_SizeOptionStrings.Add(_("Page Size A1"));
|
m_SizeOptionStrings.Add( _( "Page Size A1" ) );
|
||||||
m_SizeOptionStrings.Add(_("Page Size A0"));
|
m_SizeOptionStrings.Add( _( "Page Size A0" ) );
|
||||||
m_SizeOptionStrings.Add(_("Page Size A"));
|
m_SizeOptionStrings.Add( _( "Page Size A" ) );
|
||||||
m_SizeOptionStrings.Add(_("Page Size B"));
|
m_SizeOptionStrings.Add( _( "Page Size B" ) );
|
||||||
m_SizeOptionStrings.Add(_("Page Size C"));
|
m_SizeOptionStrings.Add( _( "Page Size C" ) );
|
||||||
m_SizeOptionStrings.Add(_("Page Size D"));
|
m_SizeOptionStrings.Add( _( "Page Size D" ) );
|
||||||
m_SizeOptionStrings.Add(_("Page Size E"));
|
m_SizeOptionStrings.Add( _( "Page Size E" ) );
|
||||||
m_SizeOption = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Plot page size:"), wxDefaultPosition, wxDefaultSize, m_SizeOptionStrings, 1, wxRA_SPECIFY_COLS );
|
m_SizeOption =
|
||||||
m_SizeOption->SetSelection(0);
|
new wxRadioBox( itemDialog1, ID_RADIOBOX, _( "Plot page size:" ),
|
||||||
itemBoxSizer4->Add(m_SizeOption, 0, wxALIGN_LEFT|wxALL, 5);
|
wxDefaultPosition, wxDefaultSize, m_SizeOptionStrings,
|
||||||
|
1, wxRA_SPECIFY_COLS );
|
||||||
|
m_SizeOption->SetSelection( 0 );
|
||||||
|
itemBoxSizer4->Add( m_SizeOption, 0, wxALIGN_LEFT | wxALL, 5 );
|
||||||
|
|
||||||
wxBoxSizer* itemBoxSizer6 = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* itemBoxSizer6 = new wxBoxSizer( wxVERTICAL );
|
||||||
itemBoxSizer3->Add(itemBoxSizer6, 0, wxALIGN_TOP|wxALL, 5);
|
itemBoxSizer3->Add( itemBoxSizer6, 0, wxALIGN_TOP | wxALL, 5 );
|
||||||
|
|
||||||
wxStaticBox* itemStaticBoxSizer7Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Pen control:"));
|
wxStaticBox* itemStaticBoxSizer7Static = new wxStaticBox(
|
||||||
wxStaticBoxSizer* itemStaticBoxSizer7 = new wxStaticBoxSizer(itemStaticBoxSizer7Static, wxVERTICAL);
|
itemDialog1, wxID_ANY, _( "Pen control:" ) );
|
||||||
itemBoxSizer6->Add(itemStaticBoxSizer7, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
|
wxStaticBoxSizer* itemStaticBoxSizer7 = new wxStaticBoxSizer(
|
||||||
|
itemStaticBoxSizer7Static,
|
||||||
|
wxVERTICAL );
|
||||||
|
itemBoxSizer6->Add( itemStaticBoxSizer7,
|
||||||
|
0,
|
||||||
|
wxALIGN_CENTER_HORIZONTAL | wxALL,
|
||||||
|
5 );
|
||||||
|
|
||||||
wxStaticText* itemStaticText8 = new wxStaticText( itemDialog1, wxID_STATIC, _("Pen Width ( mils )"), wxDefaultPosition, wxDefaultSize, 0 );
|
wxStaticText* itemStaticText8 = new wxStaticText( itemDialog1,
|
||||||
itemStaticBoxSizer7->Add(itemStaticText8, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
|
wxID_STATIC,
|
||||||
|
_( "Pen Width ( mils )" ),
|
||||||
|
wxDefaultPosition,
|
||||||
|
wxDefaultSize,
|
||||||
|
0 );
|
||||||
|
itemStaticBoxSizer7->Add(
|
||||||
|
itemStaticText8,
|
||||||
|
0,
|
||||||
|
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP |
|
||||||
|
wxADJUST_MINSIZE,
|
||||||
|
5 );
|
||||||
|
|
||||||
m_ButtPenWidth = new wxSpinCtrl( itemDialog1, ID_PEN_WIDTH_UPDATED, _T("1"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, 1, 100, 1 );
|
m_ButtPenWidth =
|
||||||
itemStaticBoxSizer7->Add(m_ButtPenWidth, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5);
|
new wxSpinCtrl( itemDialog1, ID_PEN_WIDTH_UPDATED, _T( "1" ),
|
||||||
|
wxDefaultPosition, wxDefaultSize,
|
||||||
|
wxSP_ARROW_KEYS | wxSP_WRAP, 1, 100, 1 );
|
||||||
|
itemStaticBoxSizer7->Add( m_ButtPenWidth,
|
||||||
|
0,
|
||||||
|
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM,
|
||||||
|
5 );
|
||||||
|
|
||||||
wxStaticText* itemStaticText10 = new wxStaticText( itemDialog1, wxID_STATIC, _("Pen Speed ( cm/s )"), wxDefaultPosition, wxDefaultSize, 0 );
|
wxStaticText* itemStaticText10 = new wxStaticText( itemDialog1,
|
||||||
itemStaticBoxSizer7->Add(itemStaticText10, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
|
wxID_STATIC,
|
||||||
|
_( "Pen Speed ( cm/s )" ),
|
||||||
|
wxDefaultPosition,
|
||||||
|
wxDefaultSize,
|
||||||
|
0 );
|
||||||
|
itemStaticBoxSizer7->Add( itemStaticText10,
|
||||||
|
0,
|
||||||
|
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP |
|
||||||
|
wxADJUST_MINSIZE,
|
||||||
|
5 );
|
||||||
|
|
||||||
m_ButtPenSpeed = new wxSpinCtrl( itemDialog1, ID_PEN_SPEED_UPDATED, _T("1"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 100, 1 );
|
m_ButtPenSpeed =
|
||||||
itemStaticBoxSizer7->Add(m_ButtPenSpeed, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
|
new wxSpinCtrl( itemDialog1, ID_PEN_SPEED_UPDATED, _T( "1" ),
|
||||||
|
wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS,
|
||||||
|
1, 100, 1 );
|
||||||
|
itemStaticBoxSizer7->Add( m_ButtPenSpeed,
|
||||||
|
0,
|
||||||
|
wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT |
|
||||||
|
wxBOTTOM,
|
||||||
|
5 );
|
||||||
|
|
||||||
wxStaticText* itemStaticText12 = new wxStaticText( itemDialog1, wxID_STATIC, _("Pen Number"), wxDefaultPosition, wxDefaultSize, 0 );
|
wxStaticText* itemStaticText12 = new wxStaticText( itemDialog1,
|
||||||
itemStaticBoxSizer7->Add(itemStaticText12, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
|
wxID_STATIC,
|
||||||
|
_( "Pen Number" ),
|
||||||
|
wxDefaultPosition,
|
||||||
|
wxDefaultSize,
|
||||||
|
0 );
|
||||||
|
itemStaticBoxSizer7->Add( itemStaticText12,
|
||||||
|
0,
|
||||||
|
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP |
|
||||||
|
wxADJUST_MINSIZE,
|
||||||
|
5 );
|
||||||
|
|
||||||
m_ButtPenNum = new wxSpinCtrl( itemDialog1, ID_PEN_NUMBER_UPDATED, _T("1"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 8, 1 );
|
m_ButtPenNum = new wxSpinCtrl( itemDialog1, ID_PEN_NUMBER_UPDATED,
|
||||||
itemStaticBoxSizer7->Add(m_ButtPenNum, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
|
_T( "1" ), wxDefaultPosition, wxDefaultSize,
|
||||||
|
wxSP_ARROW_KEYS, 1, 8, 1 );
|
||||||
|
itemStaticBoxSizer7->Add( m_ButtPenNum,
|
||||||
|
0,
|
||||||
|
wxALIGN_CENTER_HORIZONTAL | wxLEFT | wxRIGHT |
|
||||||
|
wxBOTTOM,
|
||||||
|
5 );
|
||||||
|
|
||||||
wxStaticBox* itemStaticBoxSizer14Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Page offset:"));
|
wxStaticBox* itemStaticBoxSizer14Static =
|
||||||
wxStaticBoxSizer* itemStaticBoxSizer14 = new wxStaticBoxSizer(itemStaticBoxSizer14Static, wxVERTICAL);
|
new wxStaticBox( itemDialog1, wxID_ANY, _( "Page offset:" ) );
|
||||||
itemBoxSizer6->Add(itemStaticBoxSizer14, 0, wxALIGN_LEFT|wxALL, 5);
|
wxStaticBoxSizer* itemStaticBoxSizer14 =
|
||||||
|
new wxStaticBoxSizer( itemStaticBoxSizer14Static, wxVERTICAL );
|
||||||
|
itemBoxSizer6->Add( itemStaticBoxSizer14, 0, wxALIGN_LEFT | wxALL, 5 );
|
||||||
|
|
||||||
wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1, wxID_STATIC, _("Plot Offset X"), wxDefaultPosition, wxDefaultSize, 0 );
|
wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1,
|
||||||
itemStaticBoxSizer14->Add(itemStaticText15, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
|
wxID_STATIC,
|
||||||
|
_( "Plot Offset X" ),
|
||||||
|
wxDefaultPosition,
|
||||||
|
wxDefaultSize,
|
||||||
|
0 );
|
||||||
|
itemStaticBoxSizer14->Add( itemStaticText15,
|
||||||
|
0,
|
||||||
|
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP |
|
||||||
|
wxADJUST_MINSIZE,
|
||||||
|
5 );
|
||||||
|
|
||||||
m_PlotOrgPosition_X = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
|
m_PlotOrgPosition_X = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1,
|
||||||
itemStaticBoxSizer14->Add(m_PlotOrgPosition_X, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5);
|
_T( "" ), wxDefaultPosition,
|
||||||
|
wxDefaultSize, 0 );
|
||||||
|
itemStaticBoxSizer14->Add( m_PlotOrgPosition_X,
|
||||||
|
0,
|
||||||
|
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM,
|
||||||
|
5 );
|
||||||
|
|
||||||
wxStaticText* itemStaticText17 = new wxStaticText( itemDialog1, wxID_STATIC, _("Plot Offset Y"), wxDefaultPosition, wxDefaultSize, 0 );
|
wxStaticText* itemStaticText17 = new wxStaticText( itemDialog1,
|
||||||
itemStaticBoxSizer14->Add(itemStaticText17, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
|
wxID_STATIC,
|
||||||
|
_( "Plot Offset Y" ),
|
||||||
|
wxDefaultPosition,
|
||||||
|
wxDefaultSize,
|
||||||
|
0 );
|
||||||
|
itemStaticBoxSizer14->Add( itemStaticText17,
|
||||||
|
0,
|
||||||
|
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP |
|
||||||
|
wxADJUST_MINSIZE,
|
||||||
|
5 );
|
||||||
|
|
||||||
m_PlotOrgPosition_Y = new wxTextCtrl( itemDialog1, ID_TEXTCTRL2, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
|
m_PlotOrgPosition_Y = new wxTextCtrl( itemDialog1, ID_TEXTCTRL2, _T( "" ),
|
||||||
itemStaticBoxSizer14->Add(m_PlotOrgPosition_Y, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxBOTTOM, 5);
|
wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
itemStaticBoxSizer14->Add( m_PlotOrgPosition_Y,
|
||||||
|
0,
|
||||||
|
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM,
|
||||||
|
5 );
|
||||||
|
|
||||||
itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
itemBoxSizer3->Add( 5, 5, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
||||||
|
|
||||||
wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* itemBoxSizer20 = new wxBoxSizer( wxVERTICAL );
|
||||||
itemBoxSizer3->Add(itemBoxSizer20, 0, wxALIGN_TOP|wxLEFT|wxTOP|wxBOTTOM, 5);
|
itemBoxSizer3->Add( itemBoxSizer20,
|
||||||
|
0,
|
||||||
|
wxALIGN_TOP | wxLEFT | wxTOP | wxBOTTOM,
|
||||||
|
5 );
|
||||||
|
|
||||||
wxButton* itemButton21 = new wxButton( itemDialog1, ID_PLOT_HPGL_CURRENT_EXECUTE, _("&Plot Page"), wxDefaultPosition, wxDefaultSize, 0 );
|
wxButton* itemButton21 = new wxButton( itemDialog1,
|
||||||
|
ID_PLOT_HPGL_CURRENT_EXECUTE,
|
||||||
|
_( "&Plot Page" ),
|
||||||
|
wxDefaultPosition,
|
||||||
|
wxDefaultSize,
|
||||||
|
0 );
|
||||||
itemButton21->SetDefault();
|
itemButton21->SetDefault();
|
||||||
itemBoxSizer20->Add(itemButton21, 0, wxGROW|wxALL, 5);
|
itemBoxSizer20->Add( itemButton21, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
wxButton* itemButton22 = new wxButton( itemDialog1, ID_PLOT_HPGL_ALL_EXECUTE, _("Plot A&LL"), wxDefaultPosition, wxDefaultSize, 0 );
|
wxButton* itemButton22 = new wxButton( itemDialog1,
|
||||||
itemBoxSizer20->Add(itemButton22, 0, wxGROW|wxALL, 5);
|
ID_PLOT_HPGL_ALL_EXECUTE,
|
||||||
|
_( "Plot A&LL" ),
|
||||||
|
wxDefaultPosition,
|
||||||
|
wxDefaultSize,
|
||||||
|
0 );
|
||||||
|
itemBoxSizer20->Add( itemButton22, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
m_btClose = new wxButton( itemDialog1, wxID_CANCEL, _("&Close"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_btClose = new wxButton( itemDialog1, wxID_CANCEL, _( "&Close" ),
|
||||||
itemBoxSizer20->Add(m_btClose, 0, wxGROW|wxALL, 5);
|
wxDefaultPosition, wxDefaultSize,
|
||||||
|
0 );
|
||||||
|
itemBoxSizer20->Add( m_btClose, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
itemBoxSizer20->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
|
itemBoxSizer20->Add( 5, 5, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
|
||||||
|
|
||||||
wxButton* itemButton25 = new wxButton( itemDialog1, ID_PLOT_ACCEPT_OFFSET, _("&Accept Offset"), wxDefaultPosition, wxDefaultSize, 0 );
|
wxButton* itemButton25 = new wxButton( itemDialog1,
|
||||||
itemBoxSizer20->Add(itemButton25, 0, wxGROW|wxALL, 5);
|
ID_PLOT_ACCEPT_OFFSET,
|
||||||
|
_( "&Accept Offset" ),
|
||||||
|
wxDefaultPosition,
|
||||||
|
wxDefaultSize,
|
||||||
|
0 );
|
||||||
|
itemBoxSizer20->Add( itemButton25, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
m_MsgBox = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxSize(-1, 110), wxTE_MULTILINE );
|
m_MsgBox = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T( "" ),
|
||||||
itemBoxSizer2->Add(m_MsgBox, 0, wxGROW|wxALL, 5);
|
wxDefaultPosition, wxSize( -1, 110 ),
|
||||||
|
wxTE_MULTILINE );
|
||||||
|
itemBoxSizer2->Add( m_MsgBox, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
// Set validators
|
// Set validators
|
||||||
m_SizeOption->SetValidator( wxGenericValidator(& HPGL_SizeSelect) );
|
m_SizeOption->SetValidator( wxGenericValidator( &HPGL_SizeSelect ) );
|
||||||
m_ButtPenWidth->SetValidator( wxGenericValidator(& g_HPGL_Pen_Descr.m_Pen_Diam) );
|
m_ButtPenWidth->SetValidator( wxGenericValidator( &g_HPGL_Pen_Descr.
|
||||||
m_ButtPenSpeed->SetValidator( wxGenericValidator(& g_HPGL_Pen_Descr.m_Pen_Speed) );
|
m_Pen_Diam ) );
|
||||||
m_ButtPenNum->SetValidator( wxGenericValidator(& g_HPGL_Pen_Descr.m_Pen_Num) );
|
m_ButtPenSpeed->SetValidator( wxGenericValidator( &g_HPGL_Pen_Descr.
|
||||||
|
m_Pen_Speed ) );
|
||||||
|
m_ButtPenNum->SetValidator( wxGenericValidator( &g_HPGL_Pen_Descr.
|
||||||
|
m_Pen_Num ) );
|
||||||
|
|
||||||
////@end WinEDA_PlotHPGLFrame content construction
|
////@end WinEDA_PlotHPGLFrame content construction
|
||||||
SetFocus(); // Make ESC key working
|
SetFocus(); // Make ESC key working
|
||||||
}
|
}
|
||||||
|
@ -290,7 +407,8 @@ void WinEDA_PlotHPGLFrame::CreateControls()
|
||||||
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLOT_HPGL_CURRENT_EXECUTE
|
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLOT_HPGL_CURRENT_EXECUTE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void WinEDA_PlotHPGLFrame::OnPlotHpglCurrentExecuteClick( wxCommandEvent& event )
|
void WinEDA_PlotHPGLFrame::OnPlotHpglCurrentExecuteClick(
|
||||||
|
wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
HPGL_Plot( event );
|
HPGL_Plot( event );
|
||||||
}
|
}
|
||||||
|
@ -312,10 +430,13 @@ void WinEDA_PlotHPGLFrame::OnPlotHpglAllExecuteClick( wxCommandEvent& event )
|
||||||
|
|
||||||
void WinEDA_PlotHPGLFrame::OnCancelClick( wxCommandEvent& event )
|
void WinEDA_PlotHPGLFrame::OnCancelClick( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_PlotHPGLFrame.
|
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in
|
||||||
|
// WinEDA_PlotHPGLFrame.
|
||||||
// Before editing this code, remove the block markers.
|
// Before editing this code, remove the block markers.
|
||||||
event.Skip();
|
event.Skip();
|
||||||
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_PlotHPGLFrame.
|
|
||||||
|
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in
|
||||||
|
// WinEDA_PlotHPGLFrame.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -347,8 +468,9 @@ wxBitmap WinEDA_PlotHPGLFrame::GetBitmapResource( const wxString& name )
|
||||||
{
|
{
|
||||||
// Bitmap retrieval
|
// Bitmap retrieval
|
||||||
////@begin WinEDA_PlotHPGLFrame bitmap retrieval
|
////@begin WinEDA_PlotHPGLFrame bitmap retrieval
|
||||||
wxUnusedVar(name);
|
wxUnusedVar( name );
|
||||||
return wxNullBitmap;
|
return wxNullBitmap;
|
||||||
|
|
||||||
////@end WinEDA_PlotHPGLFrame bitmap retrieval
|
////@end WinEDA_PlotHPGLFrame bitmap retrieval
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,15 +483,14 @@ wxIcon WinEDA_PlotHPGLFrame::GetIconResource( const wxString& name )
|
||||||
{
|
{
|
||||||
// Icon retrieval
|
// Icon retrieval
|
||||||
////@begin WinEDA_PlotHPGLFrame icon retrieval
|
////@begin WinEDA_PlotHPGLFrame icon retrieval
|
||||||
wxUnusedVar(name);
|
wxUnusedVar( name );
|
||||||
return wxNullIcon;
|
return wxNullIcon;
|
||||||
|
|
||||||
////@end WinEDA_PlotHPGLFrame icon retrieval
|
////@end WinEDA_PlotHPGLFrame icon retrieval
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************/
|
|
||||||
void WinEDA_PlotHPGLFrame::SetPageOffsetValue()
|
void WinEDA_PlotHPGLFrame::SetPageOffsetValue()
|
||||||
/***************************************************/
|
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
|
@ -380,7 +501,7 @@ void WinEDA_PlotHPGLFrame::SetPageOffsetValue()
|
||||||
EESCHEMA_INTERNAL_UNIT );
|
EESCHEMA_INTERNAL_UNIT );
|
||||||
m_PlotOrgPosition_X->SetValue( msg );
|
m_PlotOrgPosition_X->SetValue( msg );
|
||||||
msg = ReturnStringFromValue( g_UnitMetric,
|
msg = ReturnStringFromValue( g_UnitMetric,
|
||||||
Plot_sheet_list[HPGL_SizeSelect]->m_Offset.y,
|
Plot_sheet_list[HPGL_SizeSelect]-> m_Offset.y,
|
||||||
EESCHEMA_INTERNAL_UNIT );
|
EESCHEMA_INTERNAL_UNIT );
|
||||||
m_PlotOrgPosition_Y->SetValue( msg );
|
m_PlotOrgPosition_Y->SetValue( msg );
|
||||||
|
|
||||||
|
@ -395,9 +516,7 @@ void WinEDA_PlotHPGLFrame::SetPageOffsetValue()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
|
||||||
void WinEDA_PlotHPGLFrame::AcceptPlotOffset( wxCommandEvent& event )
|
void WinEDA_PlotHPGLFrame::AcceptPlotOffset( wxCommandEvent& event )
|
||||||
/*****************************************************************/
|
|
||||||
{
|
{
|
||||||
int ii = m_SizeOption->GetSelection();
|
int ii = m_SizeOption->GetSelection();
|
||||||
|
|
||||||
|
@ -418,9 +537,7 @@ void WinEDA_PlotHPGLFrame::AcceptPlotOffset( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************/
|
|
||||||
void WinEDA_PlotHPGLFrame::SetPenWidth( wxSpinEvent& event )
|
void WinEDA_PlotHPGLFrame::SetPenWidth( wxSpinEvent& event )
|
||||||
/************************************************************/
|
|
||||||
{
|
{
|
||||||
g_HPGL_Pen_Descr.m_Pen_Diam = m_ButtPenWidth->GetValue();
|
g_HPGL_Pen_Descr.m_Pen_Diam = m_ButtPenWidth->GetValue();
|
||||||
if( g_HPGL_Pen_Descr.m_Pen_Diam > 100 )
|
if( g_HPGL_Pen_Descr.m_Pen_Diam > 100 )
|
||||||
|
@ -430,9 +547,7 @@ void WinEDA_PlotHPGLFrame::SetPenWidth( wxSpinEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************/
|
|
||||||
void WinEDA_PlotHPGLFrame::SetPenSpeed( wxSpinEvent& event )
|
void WinEDA_PlotHPGLFrame::SetPenSpeed( wxSpinEvent& event )
|
||||||
/*********************************************************/
|
|
||||||
{
|
{
|
||||||
g_HPGL_Pen_Descr.m_Pen_Speed = m_ButtPenSpeed->GetValue();
|
g_HPGL_Pen_Descr.m_Pen_Speed = m_ButtPenSpeed->GetValue();
|
||||||
if( g_HPGL_Pen_Descr.m_Pen_Speed > 40 )
|
if( g_HPGL_Pen_Descr.m_Pen_Speed > 40 )
|
||||||
|
@ -442,9 +557,7 @@ void WinEDA_PlotHPGLFrame::SetPenSpeed( wxSpinEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************/
|
|
||||||
void WinEDA_PlotHPGLFrame::SetPenNum( wxSpinEvent& event )
|
void WinEDA_PlotHPGLFrame::SetPenNum( wxSpinEvent& event )
|
||||||
/*******************************************************/
|
|
||||||
{
|
{
|
||||||
g_HPGL_Pen_Descr.m_Pen_Num = m_ButtPenNum->GetValue();
|
g_HPGL_Pen_Descr.m_Pen_Num = m_ButtPenNum->GetValue();
|
||||||
if( g_HPGL_Pen_Descr.m_Pen_Num > 8 )
|
if( g_HPGL_Pen_Descr.m_Pen_Num > 8 )
|
||||||
|
@ -454,9 +567,7 @@ void WinEDA_PlotHPGLFrame::SetPenNum( wxSpinEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
|
||||||
void WinEDA_PlotHPGLFrame::HPGL_Plot( wxCommandEvent& event )
|
void WinEDA_PlotHPGLFrame::HPGL_Plot( wxCommandEvent& event )
|
||||||
/***********************************************************/
|
|
||||||
{
|
{
|
||||||
int Select_PlotAll = FALSE;
|
int Select_PlotAll = FALSE;
|
||||||
|
|
||||||
|
@ -477,14 +588,12 @@ void WinEDA_PlotHPGLFrame::HPGL_Plot( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************/
|
/* Function calculates the offsets and dimensions of any trace of the
|
||||||
void WinEDA_PlotHPGLFrame::ReturnSheetDims( BASE_SCREEN* screen,
|
* selected sheet
|
||||||
wxSize& SheetSize, wxPoint& SheetOffset )
|
|
||||||
/*******************************************************************/
|
|
||||||
|
|
||||||
/* Fonction calculant les dims et offsets de trace de la feuille selectionnee
|
|
||||||
* retourne:
|
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_PlotHPGLFrame::ReturnSheetDims( BASE_SCREEN* screen,
|
||||||
|
wxSize& SheetSize,
|
||||||
|
wxPoint& SheetOffset )
|
||||||
{
|
{
|
||||||
Ki_PageDescr* PlotSheet;
|
Ki_PageDescr* PlotSheet;
|
||||||
|
|
||||||
|
@ -498,29 +607,30 @@ void WinEDA_PlotHPGLFrame::ReturnSheetDims( BASE_SCREEN* screen,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************************/
|
void WinEDA_PlotHPGLFrame::Plot_Schematic_HPGL( int Select_PlotAll,
|
||||||
void WinEDA_PlotHPGLFrame::Plot_Schematic_HPGL( int Select_PlotAll, int HPGL_SheetSize )
|
int HPGL_SheetSize )
|
||||||
/***********************************************************************************/
|
|
||||||
{
|
{
|
||||||
WinEDA_SchematicFrame* schframe = (WinEDA_SchematicFrame*) m_Parent;
|
WinEDA_SchematicFrame* schframe = (WinEDA_SchematicFrame*) m_Parent;
|
||||||
wxString PlotFileName;
|
wxString PlotFileName;
|
||||||
SCH_SCREEN* screen = schframe->GetScreen();
|
SCH_SCREEN* screen = schframe->GetScreen();
|
||||||
SCH_SCREEN* oldscreen = screen;
|
SCH_SCREEN* oldscreen = screen;
|
||||||
DrawSheetPath* sheetpath, * oldsheetpath = schframe->GetSheet();
|
DrawSheetPath* sheetpath, * oldsheetpath = schframe->GetSheet();
|
||||||
Ki_PageDescr* PlotSheet;
|
Ki_PageDescr* PlotSheet;
|
||||||
wxSize SheetSize;
|
wxSize SheetSize;
|
||||||
wxPoint SheetOffset, PlotOffset;
|
wxPoint SheetOffset, PlotOffset;
|
||||||
|
|
||||||
/* When printing all pages, the printed page is not the current page.
|
/* When printing all pages, the printed page is not the current page.
|
||||||
* In complex hierarchies, we must setup references and others parameters in the printed SCH_SCREEN
|
* In complex hierarchies, we must setup references and others parameters
|
||||||
|
* in the printed SCH_SCREEN
|
||||||
* because in complex hierarchies a SCH_SCREEN (a schematic drawings)
|
* because in complex hierarchies a SCH_SCREEN (a schematic drawings)
|
||||||
* is shared between many sheets
|
* is shared between many sheets
|
||||||
*/
|
*/
|
||||||
EDA_SheetList SheetList( NULL );
|
EDA_SheetList SheetList( NULL );
|
||||||
|
|
||||||
sheetpath = SheetList.GetFirst();
|
sheetpath = SheetList.GetFirst();
|
||||||
DrawSheetPath list;
|
DrawSheetPath list;
|
||||||
|
|
||||||
while (true)
|
while( true )
|
||||||
{
|
{
|
||||||
if( Select_PlotAll )
|
if( Select_PlotAll )
|
||||||
{
|
{
|
||||||
|
@ -540,22 +650,25 @@ void WinEDA_PlotHPGLFrame::Plot_Schematic_HPGL( int Select_PlotAll, int HPGL_She
|
||||||
sheetpath = SheetList.GetNext();
|
sheetpath = SheetList.GetNext();
|
||||||
}
|
}
|
||||||
ReturnSheetDims( screen, SheetSize, SheetOffset );
|
ReturnSheetDims( screen, SheetSize, SheetOffset );
|
||||||
/* Calcul des echelles de conversion */
|
/* Calculation of conversion scales. */
|
||||||
if (HPGL_SheetSize)
|
if( HPGL_SheetSize )
|
||||||
PlotSheet = Plot_sheet_list[HPGL_SheetSize];
|
PlotSheet = Plot_sheet_list[HPGL_SheetSize];
|
||||||
else
|
else
|
||||||
PlotSheet = screen->m_CurrentSheetDesc;
|
PlotSheet = screen->m_CurrentSheetDesc;
|
||||||
/* 10x because eeschema works in mils, not decimils */
|
/* 10x because eeschema works in mils, not decimals */
|
||||||
double plot_scale = 10 * (double)PlotSheet->m_Size.x / (double)SheetSize.x;
|
double plot_scale = 10 * (double) PlotSheet->m_Size.x /
|
||||||
|
(double) SheetSize.x;
|
||||||
|
|
||||||
/* calcul des offsets */
|
/* Calculate offsets */
|
||||||
PlotOffset.x = -SheetOffset.x;
|
PlotOffset.x = -SheetOffset.x;
|
||||||
PlotOffset.y = -SheetOffset.y;
|
PlotOffset.y = -SheetOffset.y;
|
||||||
|
|
||||||
PlotFileName = schframe->GetUniqueFilenameForCurrentSheet() + wxT( ".plt" );
|
PlotFileName = schframe->GetUniqueFilenameForCurrentSheet() +
|
||||||
|
wxT( ".plt" );
|
||||||
|
|
||||||
SetLocaleTo_C_standard();
|
SetLocaleTo_C_standard();
|
||||||
Plot_1_Page_HPGL( PlotFileName, screen, PlotSheet, PlotOffset, plot_scale );
|
Plot_1_Page_HPGL( PlotFileName, screen, PlotSheet, PlotOffset,
|
||||||
|
plot_scale );
|
||||||
SetLocaleTo_Default();
|
SetLocaleTo_Default();
|
||||||
|
|
||||||
if( !Select_PlotAll )
|
if( !Select_PlotAll )
|
||||||
|
@ -569,17 +682,16 @@ void WinEDA_PlotHPGLFrame::Plot_Schematic_HPGL( int Select_PlotAll, int HPGL_She
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************/
|
|
||||||
void WinEDA_PlotHPGLFrame::Plot_1_Page_HPGL( const wxString& FileName,
|
void WinEDA_PlotHPGLFrame::Plot_1_Page_HPGL( const wxString& FileName,
|
||||||
SCH_SCREEN* screen,
|
SCH_SCREEN* screen,
|
||||||
Ki_PageDescr* sheet,
|
Ki_PageDescr* sheet,
|
||||||
wxPoint &offset,
|
wxPoint& offset,
|
||||||
double plot_scale)
|
double plot_scale )
|
||||||
/**************************************************************************/
|
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
|
FILE* output_file = wxFopen( FileName, wxT( "wt" ) );
|
||||||
|
|
||||||
FILE *output_file = wxFopen( FileName, wxT( "wt" ) );
|
|
||||||
if( output_file == NULL )
|
if( output_file == NULL )
|
||||||
{
|
{
|
||||||
msg = wxT( "\n** " );
|
msg = wxT( "\n** " );
|
||||||
|
@ -593,25 +705,24 @@ void WinEDA_PlotHPGLFrame::Plot_1_Page_HPGL( const wxString& FileName,
|
||||||
msg.Printf( _( "Plot: %s\n" ), FileName.GetData() );
|
msg.Printf( _( "Plot: %s\n" ), FileName.GetData() );
|
||||||
m_MsgBox->AppendText( msg );
|
m_MsgBox->AppendText( msg );
|
||||||
|
|
||||||
HPGL_PLOTTER *plotter = new HPGL_PLOTTER();
|
HPGL_PLOTTER* plotter = new HPGL_PLOTTER();
|
||||||
plotter->set_paper_size(sheet);
|
plotter->set_paper_size( sheet );
|
||||||
plotter->set_viewport( offset, plot_scale, 0);
|
plotter->set_viewport( offset, plot_scale, 0 );
|
||||||
plotter->set_default_line_width( g_DrawDefaultLineThickness );
|
plotter->set_default_line_width( g_DrawDefaultLineThickness );
|
||||||
/* Init : */
|
/* Init : */
|
||||||
plotter->set_creator(wxT("EESchema-HPGL"));
|
plotter->set_creator( wxT( "EESchema-HPGL" ) );
|
||||||
plotter->set_filename(FileName);
|
plotter->set_filename( FileName );
|
||||||
plotter->set_pen_speed(g_HPGL_Pen_Descr.m_Pen_Speed);
|
plotter->set_pen_speed( g_HPGL_Pen_Descr.m_Pen_Speed );
|
||||||
plotter->set_pen_number(g_HPGL_Pen_Descr.m_Pen_Num);
|
plotter->set_pen_number( g_HPGL_Pen_Descr.m_Pen_Num );
|
||||||
plotter->set_pen_diameter(g_HPGL_Pen_Descr.m_Pen_Diam);
|
plotter->set_pen_diameter( g_HPGL_Pen_Descr.m_Pen_Diam );
|
||||||
plotter->set_pen_overlap(g_HPGL_Pen_Descr.m_Pen_Diam/2);
|
plotter->set_pen_overlap( g_HPGL_Pen_Descr.m_Pen_Diam / 2 );
|
||||||
plotter->start_plot( output_file );
|
plotter->start_plot( output_file );
|
||||||
|
|
||||||
plotter->set_color( BLACK );
|
plotter->set_color( BLACK );
|
||||||
m_Parent->PlotWorkSheet( plotter, screen );
|
m_Parent->PlotWorkSheet( plotter, screen );
|
||||||
|
|
||||||
PlotDrawlist(plotter, screen->EEDrawList);
|
PlotDrawlist( plotter, screen->EEDrawList );
|
||||||
|
|
||||||
/* fin */
|
|
||||||
plotter->end_plot();
|
plotter->end_plot();
|
||||||
delete plotter;
|
delete plotter;
|
||||||
SetLocaleTo_Default();
|
SetLocaleTo_Default();
|
||||||
|
@ -619,6 +730,7 @@ void WinEDA_PlotHPGLFrame::Plot_1_Page_HPGL( const wxString& FileName,
|
||||||
m_MsgBox->AppendText( wxT( "Ok\n" ) );
|
m_MsgBox->AppendText( wxT( "Ok\n" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_RADIOBOX
|
* wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_RADIOBOX
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -7,12 +7,12 @@
|
||||||
// Created: 01/02/2006 08:37:24
|
// Created: 01/02/2006 08:37:24
|
||||||
// RCS-ID:
|
// RCS-ID:
|
||||||
// Copyright: GNU License
|
// Copyright: GNU License
|
||||||
// Licence:
|
// License:
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Generated by DialogBlocks (unregistered), 01/02/2006 08:37:24
|
// Generated by DialogBlocks (unregistered), 01/02/2006 08:37:24
|
||||||
|
|
||||||
#if defined (__GNUG__) && !defined (NO_GCC_PRAGMA)
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
||||||
#pragma implementation "plotps.h"
|
#pragma implementation "plotps.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -34,8 +34,8 @@ enum PageFormatReq {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Variables locales : */
|
/* Variables locales : */
|
||||||
static int PS_SizeSelect = PAGE_SIZE_AUTO;
|
static int PS_SizeSelect = PAGE_SIZE_AUTO;
|
||||||
static bool Plot_Sheet_Ref = TRUE;
|
static bool Plot_Sheet_Ref = TRUE;
|
||||||
|
|
||||||
#include "plotps.h"
|
#include "plotps.h"
|
||||||
|
|
||||||
|
@ -43,12 +43,7 @@ static bool Plot_Sheet_Ref = TRUE;
|
||||||
////@end XPM images
|
////@end XPM images
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
|
||||||
void WinEDA_SchematicFrame::ToPlot_PS( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::ToPlot_PS( wxCommandEvent& event )
|
||||||
/***********************************************************/
|
|
||||||
|
|
||||||
/* fonction relai de creation de la frame de dialogue pour trace Postscript
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
|
|
||||||
|
@ -77,16 +72,17 @@ IMPLEMENT_DYNAMIC_CLASS( WinEDA_PlotPSFrame, wxDialog )
|
||||||
BEGIN_EVENT_TABLE( WinEDA_PlotPSFrame, wxDialog )
|
BEGIN_EVENT_TABLE( WinEDA_PlotPSFrame, wxDialog )
|
||||||
|
|
||||||
////@begin WinEDA_PlotPSFrame event table entries
|
////@begin WinEDA_PlotPSFrame event table entries
|
||||||
EVT_BUTTON( ID_PLOT_PS_CURRENT_EXECUTE, WinEDA_PlotPSFrame::OnPlotPsCurrentExecuteClick )
|
EVT_BUTTON( ID_PLOT_PS_CURRENT_EXECUTE,
|
||||||
|
WinEDA_PlotPSFrame::OnPlotPsCurrentExecuteClick )
|
||||||
|
|
||||||
EVT_BUTTON( ID_PLOT_PS_ALL_EXECUTE, WinEDA_PlotPSFrame::OnPlotPsAllExecuteClick )
|
EVT_BUTTON( ID_PLOT_PS_ALL_EXECUTE,
|
||||||
|
WinEDA_PlotPSFrame::OnPlotPsAllExecuteClick )
|
||||||
|
|
||||||
EVT_BUTTON( wxID_CANCEL, WinEDA_PlotPSFrame::OnCancelClick )
|
EVT_BUTTON( wxID_CANCEL, WinEDA_PlotPSFrame::OnCancelClick )
|
||||||
|
|
||||||
////@end WinEDA_PlotPSFrame event table entries
|
////@end WinEDA_PlotPSFrame event table entries
|
||||||
|
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* WinEDA_PlotPSFrame constructors
|
* WinEDA_PlotPSFrame constructors
|
||||||
*/
|
*/
|
||||||
|
@ -120,25 +116,27 @@ bool WinEDA_PlotPSFrame::Create( wxWindow* parent,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
long style )
|
long style )
|
||||||
{
|
{
|
||||||
////@begin WinEDA_PlotPSFrame member initialisation
|
////@begin WinEDA_PlotPSFrame member initialization
|
||||||
m_SizeOption = NULL;
|
m_SizeOption = NULL;
|
||||||
m_PlotPSColorOption = NULL;
|
m_PlotPSColorOption = NULL;
|
||||||
m_Plot_Sheet_Ref = NULL;
|
m_Plot_Sheet_Ref = NULL;
|
||||||
m_btClose = NULL;
|
m_btClose = NULL;
|
||||||
m_DefaultLineSizeCtrlSizer = NULL;
|
m_DefaultLineSizeCtrlSizer = NULL;
|
||||||
m_MsgBox = NULL;
|
m_MsgBox = NULL;
|
||||||
|
|
||||||
////@end WinEDA_PlotPSFrame member initialisation
|
////@end WinEDA_PlotPSFrame member initialisation
|
||||||
|
|
||||||
////@begin WinEDA_PlotPSFrame creation
|
////@begin WinEDA_PlotPSFrame creation
|
||||||
SetExtraStyle(wxWS_EX_BLOCK_EVENTS);
|
SetExtraStyle( wxWS_EX_BLOCK_EVENTS );
|
||||||
wxDialog::Create( parent, id, caption, pos, size, style );
|
wxDialog::Create( parent, id, caption, pos, size, style );
|
||||||
|
|
||||||
CreateControls();
|
CreateControls();
|
||||||
if (GetSizer())
|
if( GetSizer() )
|
||||||
{
|
{
|
||||||
GetSizer()->SetSizeHints(this);
|
GetSizer()->SetSizeHints( this );
|
||||||
}
|
}
|
||||||
Centre();
|
Centre();
|
||||||
|
|
||||||
////@end WinEDA_PlotPSFrame creation
|
////@end WinEDA_PlotPSFrame creation
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -155,72 +153,110 @@ void WinEDA_PlotPSFrame::CreateControls()
|
||||||
|
|
||||||
WinEDA_PlotPSFrame* itemDialog1 = this;
|
WinEDA_PlotPSFrame* itemDialog1 = this;
|
||||||
|
|
||||||
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxVERTICAL );
|
||||||
itemDialog1->SetSizer(itemBoxSizer2);
|
|
||||||
|
|
||||||
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
|
itemDialog1->SetSizer( itemBoxSizer2 );
|
||||||
itemBoxSizer2->Add(itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
|
|
||||||
|
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
itemBoxSizer2->Add( itemBoxSizer3, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
|
||||||
|
|
||||||
wxArrayString m_SizeOptionStrings;
|
wxArrayString m_SizeOptionStrings;
|
||||||
m_SizeOptionStrings.Add(_("Auto"));
|
m_SizeOptionStrings.Add( _( "Auto" ) );
|
||||||
m_SizeOptionStrings.Add(_("Page Size A4"));
|
m_SizeOptionStrings.Add( _( "Page Size A4" ) );
|
||||||
m_SizeOptionStrings.Add(_("Page Size A"));
|
m_SizeOptionStrings.Add( _( "Page Size A" ) );
|
||||||
m_SizeOption = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _("Plot page size:"), wxDefaultPosition, wxDefaultSize, m_SizeOptionStrings, 1, wxRA_SPECIFY_COLS );
|
m_SizeOption =
|
||||||
m_SizeOption->SetSelection(0);
|
new wxRadioBox( itemDialog1, ID_RADIOBOX1, _( "Plot page size:" ),
|
||||||
itemBoxSizer3->Add(m_SizeOption, 0, wxGROW|wxALL, 5);
|
wxDefaultPosition, wxDefaultSize, m_SizeOptionStrings,
|
||||||
|
1, wxRA_SPECIFY_COLS );
|
||||||
|
m_SizeOption->SetSelection( 0 );
|
||||||
|
itemBoxSizer3->Add( m_SizeOption, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
itemBoxSizer3->Add( 5, 5, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
||||||
|
|
||||||
wxStaticBox* itemStaticBoxSizer6Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Plot Options:"));
|
wxStaticBox* itemStaticBoxSizer6Static =
|
||||||
wxStaticBoxSizer* itemStaticBoxSizer6 = new wxStaticBoxSizer(itemStaticBoxSizer6Static, wxVERTICAL);
|
new wxStaticBox( itemDialog1, wxID_ANY, _( "Plot Options:" ) );
|
||||||
itemBoxSizer3->Add(itemStaticBoxSizer6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
wxStaticBoxSizer* itemStaticBoxSizer6 =
|
||||||
|
new wxStaticBoxSizer( itemStaticBoxSizer6Static, wxVERTICAL );
|
||||||
|
itemBoxSizer3->Add( itemStaticBoxSizer6,
|
||||||
|
0,
|
||||||
|
wxALIGN_CENTER_VERTICAL | wxALL,
|
||||||
|
5 );
|
||||||
|
|
||||||
wxArrayString m_PlotPSColorOptionStrings;
|
wxArrayString m_PlotPSColorOptionStrings;
|
||||||
m_PlotPSColorOptionStrings.Add(_("B/W"));
|
m_PlotPSColorOptionStrings.Add( _( "B/W" ) );
|
||||||
m_PlotPSColorOptionStrings.Add(_("Color"));
|
m_PlotPSColorOptionStrings.Add( _( "Color" ) );
|
||||||
m_PlotPSColorOption = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Plot Color:"), wxDefaultPosition, wxDefaultSize, m_PlotPSColorOptionStrings, 1, wxRA_SPECIFY_COLS );
|
m_PlotPSColorOption =
|
||||||
m_PlotPSColorOption->SetSelection(0);
|
new wxRadioBox( itemDialog1, ID_RADIOBOX, _( "Plot Color:" ),
|
||||||
itemStaticBoxSizer6->Add(m_PlotPSColorOption, 0, wxGROW|wxALL, 5);
|
wxDefaultPosition, wxDefaultSize,
|
||||||
|
m_PlotPSColorOptionStrings, 1, wxRA_SPECIFY_COLS );
|
||||||
|
m_PlotPSColorOption->SetSelection( 0 );
|
||||||
|
itemStaticBoxSizer6->Add( m_PlotPSColorOption, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
m_Plot_Sheet_Ref = new wxCheckBox( itemDialog1, ID_CHECKBOX, _("Print Sheet Ref"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
|
m_Plot_Sheet_Ref =
|
||||||
m_Plot_Sheet_Ref->SetValue(false);
|
new wxCheckBox( itemDialog1, ID_CHECKBOX, _( "Print Sheet Ref" ),
|
||||||
itemStaticBoxSizer6->Add(m_Plot_Sheet_Ref, 0, wxGROW|wxALL, 5);
|
wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
|
||||||
|
m_Plot_Sheet_Ref->SetValue( false );
|
||||||
|
itemStaticBoxSizer6->Add( m_Plot_Sheet_Ref, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
itemBoxSizer3->Add( 5, 5, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
||||||
|
|
||||||
wxBoxSizer* itemBoxSizer10 = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* itemBoxSizer10 = new wxBoxSizer( wxVERTICAL );
|
||||||
itemBoxSizer3->Add(itemBoxSizer10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
itemBoxSizer3->Add( itemBoxSizer10, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
||||||
|
|
||||||
wxButton* itemButton11 = new wxButton( itemDialog1, ID_PLOT_PS_CURRENT_EXECUTE, _("&Plot Page"), wxDefaultPosition, wxDefaultSize, 0 );
|
wxButton* itemButton11 = new wxButton( itemDialog1,
|
||||||
|
ID_PLOT_PS_CURRENT_EXECUTE,
|
||||||
|
_( "&Plot Page" ),
|
||||||
|
wxDefaultPosition,
|
||||||
|
wxDefaultSize,
|
||||||
|
0 );
|
||||||
itemButton11->SetDefault();
|
itemButton11->SetDefault();
|
||||||
itemBoxSizer10->Add(itemButton11, 0, wxGROW|wxALL, 5);
|
itemBoxSizer10->Add( itemButton11, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
wxButton* itemButton12 = new wxButton( itemDialog1, ID_PLOT_PS_ALL_EXECUTE, _("Plot A&LL"), wxDefaultPosition, wxDefaultSize, 0 );
|
wxButton* itemButton12 = new wxButton( itemDialog1,
|
||||||
itemBoxSizer10->Add(itemButton12, 0, wxGROW|wxALL, 5);
|
ID_PLOT_PS_ALL_EXECUTE,
|
||||||
|
_( "Plot A&LL" ),
|
||||||
|
wxDefaultPosition,
|
||||||
|
wxDefaultSize,
|
||||||
|
0 );
|
||||||
|
itemBoxSizer10->Add( itemButton12, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
m_btClose = new wxButton( itemDialog1, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_btClose = new wxButton( itemDialog1, wxID_CANCEL, _( "Close" ),
|
||||||
itemBoxSizer10->Add(m_btClose, 0, wxGROW|wxALL, 5);
|
wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
itemBoxSizer10->Add( m_btClose, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
m_DefaultLineSizeCtrlSizer = new wxBoxSizer(wxVERTICAL);
|
m_DefaultLineSizeCtrlSizer = new wxBoxSizer( wxVERTICAL );
|
||||||
itemBoxSizer2->Add(m_DefaultLineSizeCtrlSizer, 0, wxGROW|wxALL, 5);
|
itemBoxSizer2->Add( m_DefaultLineSizeCtrlSizer, 0, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1, wxID_STATIC, _("Messages :"), wxDefaultPosition, wxDefaultSize, 0 );
|
wxStaticText* itemStaticText15 = new wxStaticText( itemDialog1,
|
||||||
itemBoxSizer2->Add(itemStaticText15, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
|
wxID_STATIC,
|
||||||
|
_( "Messages :" ),
|
||||||
|
wxDefaultPosition,
|
||||||
|
wxDefaultSize,
|
||||||
|
0 );
|
||||||
|
itemBoxSizer2->Add( itemStaticText15,
|
||||||
|
0,
|
||||||
|
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP |
|
||||||
|
wxADJUST_MINSIZE,
|
||||||
|
5 );
|
||||||
|
|
||||||
m_MsgBox = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxSize(-1, 200), wxTE_MULTILINE );
|
m_MsgBox = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T( "" ),
|
||||||
itemBoxSizer2->Add(m_MsgBox, 0, wxGROW|wxALL|wxFIXED_MINSIZE, 5);
|
wxDefaultPosition, wxSize( -1, 200 ),
|
||||||
|
wxTE_MULTILINE );
|
||||||
|
itemBoxSizer2->Add( m_MsgBox, 0, wxGROW | wxALL | wxFIXED_MINSIZE, 5 );
|
||||||
|
|
||||||
// Set validators
|
// Set validators
|
||||||
m_SizeOption->SetValidator( wxGenericValidator(& PS_SizeSelect) );
|
m_SizeOption->SetValidator( wxGenericValidator( &PS_SizeSelect ) );
|
||||||
m_PlotPSColorOption->SetValidator( wxGenericValidator(& PlotPSColorOpt) );
|
m_PlotPSColorOption->SetValidator( wxGenericValidator( &PlotPSColorOpt ) );
|
||||||
m_Plot_Sheet_Ref->SetValidator( wxGenericValidator(& Plot_Sheet_Ref) );
|
m_Plot_Sheet_Ref->SetValidator( wxGenericValidator( &Plot_Sheet_Ref ) );
|
||||||
|
|
||||||
////@end WinEDA_PlotPSFrame content construction
|
////@end WinEDA_PlotPSFrame content construction
|
||||||
|
|
||||||
SetFocus(); // make the ESC work
|
SetFocus(); // make the ESC work
|
||||||
m_DefaultLineSizeCtrl = new WinEDA_ValueCtrl( this, _(
|
m_DefaultLineSizeCtrl = new WinEDA_ValueCtrl( this,
|
||||||
"Default Line Width" ),
|
_( "Default Line Width" ),
|
||||||
g_DrawDefaultLineThickness,
|
g_DrawDefaultLineThickness,
|
||||||
g_UnitMetric, m_DefaultLineSizeCtrlSizer,
|
g_UnitMetric,
|
||||||
|
m_DefaultLineSizeCtrlSizer,
|
||||||
EESCHEMA_INTERNAL_UNIT );
|
EESCHEMA_INTERNAL_UNIT );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,8 +279,9 @@ wxBitmap WinEDA_PlotPSFrame::GetBitmapResource( const wxString& name )
|
||||||
{
|
{
|
||||||
// Bitmap retrieval
|
// Bitmap retrieval
|
||||||
////@begin WinEDA_PlotPSFrame bitmap retrieval
|
////@begin WinEDA_PlotPSFrame bitmap retrieval
|
||||||
wxUnusedVar(name);
|
wxUnusedVar( name );
|
||||||
return wxNullBitmap;
|
return wxNullBitmap;
|
||||||
|
|
||||||
////@end WinEDA_PlotPSFrame bitmap retrieval
|
////@end WinEDA_PlotPSFrame bitmap retrieval
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,8 +294,9 @@ wxIcon WinEDA_PlotPSFrame::GetIconResource( const wxString& name )
|
||||||
{
|
{
|
||||||
// Icon retrieval
|
// Icon retrieval
|
||||||
////@begin WinEDA_PlotPSFrame icon retrieval
|
////@begin WinEDA_PlotPSFrame icon retrieval
|
||||||
wxUnusedVar(name);
|
wxUnusedVar( name );
|
||||||
return wxNullIcon;
|
return wxNullIcon;
|
||||||
|
|
||||||
////@end WinEDA_PlotPSFrame icon retrieval
|
////@end WinEDA_PlotPSFrame icon retrieval
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -302,41 +340,39 @@ void WinEDA_PlotPSFrame::OnCancelClick( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************/
|
|
||||||
void WinEDA_PlotPSFrame::InitOptVars()
|
void WinEDA_PlotPSFrame::InitOptVars()
|
||||||
/*****************************************/
|
|
||||||
{
|
{
|
||||||
Plot_Sheet_Ref = m_Plot_Sheet_Ref->GetValue();
|
Plot_Sheet_Ref = m_Plot_Sheet_Ref->GetValue();
|
||||||
PlotPSColorOpt = m_PlotPSColorOption->GetSelection();
|
PlotPSColorOpt = m_PlotPSColorOption->GetSelection();
|
||||||
PS_SizeSelect = m_SizeOption->GetSelection();
|
PS_SizeSelect = m_SizeOption->GetSelection();
|
||||||
g_DrawDefaultLineThickness = m_DefaultLineSizeCtrl->GetValue();
|
g_DrawDefaultLineThickness = m_DefaultLineSizeCtrl->GetValue();
|
||||||
if( g_DrawDefaultLineThickness < 1 )
|
if( g_DrawDefaultLineThickness < 1 )
|
||||||
g_DrawDefaultLineThickness = 1;
|
g_DrawDefaultLineThickness = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************/
|
|
||||||
void WinEDA_PlotPSFrame::CreatePSFile( int AllPages, int pagesize )
|
void WinEDA_PlotPSFrame::CreatePSFile( int AllPages, int pagesize )
|
||||||
/*************************************************************/
|
|
||||||
{
|
{
|
||||||
WinEDA_SchematicFrame* schframe = (WinEDA_SchematicFrame*) m_Parent;
|
WinEDA_SchematicFrame* schframe = (WinEDA_SchematicFrame*) m_Parent;
|
||||||
SCH_SCREEN* screen = schframe->GetScreen();
|
SCH_SCREEN* screen = schframe->GetScreen();
|
||||||
SCH_SCREEN* oldscreen = screen;
|
SCH_SCREEN* oldscreen = screen;
|
||||||
DrawSheetPath* sheetpath, *oldsheetpath = schframe->GetSheet();
|
DrawSheetPath* sheetpath, * oldsheetpath = schframe->GetSheet();
|
||||||
wxString PlotFileName;
|
wxString PlotFileName;
|
||||||
Ki_PageDescr* PlotSheet, *RealSheet;
|
Ki_PageDescr* PlotSheet, * RealSheet;
|
||||||
wxPoint plot_offset;
|
wxPoint plot_offset;
|
||||||
|
|
||||||
/* When printing all pages, the printed page is not the current page.
|
/* When printing all pages, the printed page is not the current page.
|
||||||
* In complex hierarchies, we must setup references and others parameters in the printed SCH_SCREEN
|
* In complex hierarchies, we must setup references and others parameters
|
||||||
|
* in the printed SCH_SCREEN
|
||||||
* because in complex hierarchies a SCH_SCREEN (a schematic drawings)
|
* because in complex hierarchies a SCH_SCREEN (a schematic drawings)
|
||||||
* is shared between many sheets
|
* is shared between many sheets
|
||||||
*/
|
*/
|
||||||
EDA_SheetList SheetList( NULL );
|
EDA_SheetList SheetList( NULL );
|
||||||
|
|
||||||
sheetpath = SheetList.GetFirst();
|
sheetpath = SheetList.GetFirst();
|
||||||
DrawSheetPath list;
|
DrawSheetPath list;
|
||||||
|
|
||||||
while (true)
|
while( true )
|
||||||
{
|
{
|
||||||
if( AllPages )
|
if( AllPages )
|
||||||
{
|
{
|
||||||
|
@ -356,28 +392,31 @@ void WinEDA_PlotPSFrame::CreatePSFile( int AllPages, int pagesize )
|
||||||
sheetpath = SheetList.GetNext();
|
sheetpath = SheetList.GetNext();
|
||||||
}
|
}
|
||||||
PlotSheet = screen->m_CurrentSheetDesc;
|
PlotSheet = screen->m_CurrentSheetDesc;
|
||||||
switch (pagesize)
|
switch( pagesize )
|
||||||
{
|
{
|
||||||
case PAGE_SIZE_A:
|
case PAGE_SIZE_A:
|
||||||
RealSheet = &g_Sheet_A;
|
RealSheet = &g_Sheet_A;
|
||||||
break;
|
break;
|
||||||
case PAGE_SIZE_A4:
|
|
||||||
RealSheet = &g_Sheet_A4;
|
case PAGE_SIZE_A4:
|
||||||
break;
|
RealSheet = &g_Sheet_A4;
|
||||||
case PAGE_SIZE_AUTO:
|
break;
|
||||||
default:
|
|
||||||
|
case PAGE_SIZE_AUTO:
|
||||||
|
default:
|
||||||
RealSheet = PlotSheet;
|
RealSheet = PlotSheet;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
double scalex = (double) RealSheet->m_Size.x / PlotSheet->m_Size.x;
|
double scalex = (double) RealSheet->m_Size.x / PlotSheet->m_Size.x;
|
||||||
double scaley = (double) RealSheet->m_Size.y / PlotSheet->m_Size.y;
|
double scaley = (double) RealSheet->m_Size.y / PlotSheet->m_Size.y;
|
||||||
double scale = 10 * MIN(scalex, scaley);
|
double scale = 10 * MIN( scalex, scaley );
|
||||||
|
|
||||||
plot_offset.x = 0;
|
plot_offset.x = 0;
|
||||||
plot_offset.y = 0;
|
plot_offset.y = 0;
|
||||||
|
|
||||||
PlotFileName = schframe->GetUniqueFilenameForCurrentSheet( ) + wxT( ".ps" );
|
PlotFileName = schframe->GetUniqueFilenameForCurrentSheet() + wxT(
|
||||||
|
".ps" );
|
||||||
|
|
||||||
PlotOneSheetPS( PlotFileName, screen, RealSheet, plot_offset, scale );
|
PlotOneSheetPS( PlotFileName, screen, RealSheet, plot_offset, scale );
|
||||||
|
|
||||||
|
@ -392,20 +431,16 @@ void WinEDA_PlotPSFrame::CreatePSFile( int AllPages, int pagesize )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************************/
|
|
||||||
void WinEDA_PlotPSFrame::PlotOneSheetPS( const wxString& FileName,
|
void WinEDA_PlotPSFrame::PlotOneSheetPS( const wxString& FileName,
|
||||||
SCH_SCREEN* screen,
|
SCH_SCREEN* screen,
|
||||||
Ki_PageDescr* sheet,
|
Ki_PageDescr* sheet,
|
||||||
wxPoint plot_offset,
|
wxPoint plot_offset,
|
||||||
double scale)
|
double scale )
|
||||||
/*****************************************************************************************/
|
|
||||||
|
|
||||||
/* Trace en format PS. d'une feuille de dessin
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
FILE *output_file = wxFopen( FileName, wxT( "wt" ) );
|
FILE* output_file = wxFopen( FileName, wxT( "wt" ) );
|
||||||
|
|
||||||
if( output_file == NULL )
|
if( output_file == NULL )
|
||||||
{
|
{
|
||||||
msg = wxT( "\n** " );
|
msg = wxT( "\n** " );
|
||||||
|
@ -419,26 +454,25 @@ void WinEDA_PlotPSFrame::PlotOneSheetPS( const wxString& FileName,
|
||||||
msg.Printf( _( "Plot: %s\n" ), FileName.GetData() );
|
msg.Printf( _( "Plot: %s\n" ), FileName.GetData() );
|
||||||
m_MsgBox->AppendText( msg );
|
m_MsgBox->AppendText( msg );
|
||||||
|
|
||||||
PS_PLOTTER *plotter = new PS_PLOTTER();
|
PS_PLOTTER* plotter = new PS_PLOTTER();
|
||||||
plotter->set_paper_size(sheet);
|
plotter->set_paper_size( sheet );
|
||||||
plotter->set_viewport( plot_offset, scale, 0);
|
plotter->set_viewport( plot_offset, scale, 0 );
|
||||||
plotter->set_default_line_width( g_DrawDefaultLineThickness );
|
plotter->set_default_line_width( g_DrawDefaultLineThickness );
|
||||||
plotter->set_color_mode(PlotPSColorOpt);
|
plotter->set_color_mode( PlotPSColorOpt );
|
||||||
|
|
||||||
/* Init : */
|
/* Init : */
|
||||||
plotter->set_creator(wxT("EESchema-PS"));
|
plotter->set_creator( wxT( "EESchema-PS" ) );
|
||||||
plotter->set_filename(FileName);
|
plotter->set_filename( FileName );
|
||||||
plotter->start_plot(output_file);
|
plotter->start_plot( output_file );
|
||||||
|
|
||||||
if( Plot_Sheet_Ref )
|
if( Plot_Sheet_Ref )
|
||||||
{
|
{
|
||||||
plotter->set_color( BLACK );
|
plotter->set_color( BLACK );
|
||||||
m_Parent->PlotWorkSheet( plotter, screen );
|
m_Parent->PlotWorkSheet( plotter, screen );
|
||||||
}
|
}
|
||||||
|
|
||||||
PlotDrawlist(plotter, screen->EEDrawList);
|
PlotDrawlist( plotter, screen->EEDrawList );
|
||||||
|
|
||||||
/* fin */
|
|
||||||
plotter->end_plot();
|
plotter->end_plot();
|
||||||
delete plotter;
|
delete plotter;
|
||||||
SetLocaleTo_Default();
|
SetLocaleTo_Default();
|
||||||
|
|
|
@ -12,9 +12,9 @@ class SCH_COMPONENT;
|
||||||
class BASE_SCREEN;
|
class BASE_SCREEN;
|
||||||
class SCH_SCREEN;
|
class SCH_SCREEN;
|
||||||
class SCH_ITEM;
|
class SCH_ITEM;
|
||||||
class Hierarchical_PIN_Sheet_Struct;
|
class SCH_SHEET_PIN;
|
||||||
class PLOTTER;
|
class PLOTTER;
|
||||||
class DrawSheetStruct;
|
class SCH_SHEET;
|
||||||
class LIB_PIN;
|
class LIB_PIN;
|
||||||
|
|
||||||
|
|
||||||
|
@ -121,14 +121,13 @@ SCH_ITEM* PickStruct( const wxPoint& refpos,
|
||||||
int SearchMask );
|
int SearchMask );
|
||||||
|
|
||||||
|
|
||||||
Hierarchical_PIN_Sheet_Struct* LocateSheetLabel( DrawSheetStruct* Sheet,
|
SCH_SHEET_PIN* LocateSheetLabel( SCH_SHEET* Sheet, const wxPoint& pos );
|
||||||
const wxPoint& pos );
|
|
||||||
LIB_PIN* LocateAnyPin( SCH_ITEM* DrawList,
|
LIB_PIN* LocateAnyPin( SCH_ITEM* DrawList,
|
||||||
const wxPoint& RefPos,
|
const wxPoint& RefPos,
|
||||||
SCH_COMPONENT** libpart = NULL );
|
SCH_COMPONENT** libpart = NULL );
|
||||||
|
|
||||||
Hierarchical_PIN_Sheet_Struct* LocateAnyPinSheet( const wxPoint& RefPos,
|
SCH_SHEET_PIN* LocateAnyPinSheet( const wxPoint& RefPos,
|
||||||
SCH_ITEM* DrawList );
|
SCH_ITEM* DrawList );
|
||||||
|
|
||||||
|
|
||||||
/***************/
|
/***************/
|
||||||
|
@ -192,7 +191,7 @@ void PlotDrawlist( PLOTTER* plotter, SCH_ITEM* drawlist );
|
||||||
/***************/
|
/***************/
|
||||||
/* DELSHEET.CPP */
|
/* DELSHEET.CPP */
|
||||||
/***************/
|
/***************/
|
||||||
void DeleteSubHierarchy( DrawSheetStruct* Sheet, bool confirm_deletion );
|
void DeleteSubHierarchy( SCH_SHEET* Sheet, bool confirm_deletion );
|
||||||
bool ClearProjectDrawList( SCH_SCREEN* FirstWindow, bool confirm_deletion );
|
bool ClearProjectDrawList( SCH_SCREEN* FirstWindow, bool confirm_deletion );
|
||||||
|
|
||||||
/* free the draw list screen->EEDrawList and the subhierarchies
|
/* free the draw list screen->EEDrawList and the subhierarchies
|
||||||
|
|
|
@ -23,12 +23,12 @@ SCH_ITEM* ReadTextDescr( FILE* aFile,
|
||||||
/**
|
/**
|
||||||
* Function ReadTextDescr
|
* Function ReadTextDescr
|
||||||
* Reads the data structures for a Text (Comment, label, Hlabel and Hlabel
|
* Reads the data structures for a Text (Comment, label, Hlabel and Hlabel
|
||||||
* from a FILE in "*.brd" format.
|
* from a FILE in "*.sch" format.
|
||||||
* @param aFile The FILE to read.
|
* @param aFile The FILE to read.
|
||||||
* @param aLine The buffer used to read the first line of description.
|
* @param aLine The buffer used to read the first line of description.
|
||||||
* @param aBufsize The size of aLine.
|
* @param aBufsize The size of aLine.
|
||||||
* @param aLineNum a pointer to the line count.
|
* @param aLineNum a pointer to the line count.
|
||||||
* @return a poiner to the new created obect if success reading else NULL.
|
* @return a poiner to the new created object if success reading else NULL.
|
||||||
*/
|
*/
|
||||||
SCH_ITEM* Struct = NULL;
|
SCH_ITEM* Struct = NULL;
|
||||||
char Name1[256];
|
char Name1[256];
|
||||||
|
@ -71,8 +71,7 @@ SCH_ITEM* ReadTextDescr( FILE* aFile,
|
||||||
|
|
||||||
if( Name1[0] == 'L' ) // Reading a simple label (SCH_LABEL item)
|
if( Name1[0] == 'L' ) // Reading a simple label (SCH_LABEL item)
|
||||||
{
|
{
|
||||||
SCH_LABEL* TextStruct =
|
SCH_LABEL* TextStruct = new SCH_LABEL( pos, CONV_FROM_UTF8( text ) );
|
||||||
new SCH_LABEL( pos, CONV_FROM_UTF8( text ) );
|
|
||||||
|
|
||||||
TextStruct->m_Size.x = TextStruct->m_Size.y = size;
|
TextStruct->m_Size.x = TextStruct->m_Size.y = size;
|
||||||
TextStruct->SetSchematicTextOrientation( orient );
|
TextStruct->SetSchematicTextOrientation( orient );
|
||||||
|
@ -80,14 +79,16 @@ SCH_ITEM* ReadTextDescr( FILE* aFile,
|
||||||
{
|
{
|
||||||
thickness = atol( Name3 );
|
thickness = atol( Name3 );
|
||||||
TextStruct->m_Bold = (thickness != 0);
|
TextStruct->m_Bold = (thickness != 0);
|
||||||
TextStruct->m_Width = TextStruct->m_Bold ? GetPenSizeForBold( size ) : 0;
|
TextStruct->m_Width =
|
||||||
|
TextStruct->m_Bold ? GetPenSizeForBold( size ) : 0;
|
||||||
}
|
}
|
||||||
Struct = TextStruct;
|
Struct = TextStruct;
|
||||||
if( stricmp( Name2, "Italic" ) == 0 )
|
if( stricmp( Name2, "Italic" ) == 0 )
|
||||||
TextStruct->m_Italic = 1;
|
TextStruct->m_Italic = 1;
|
||||||
}
|
}
|
||||||
else if( Name1[0] == 'G' && aSchematicFileVersion > '1' ) // Reading a global label (SCH_GLOBALLABEL item)
|
else if( Name1[0] == 'G' && aSchematicFileVersion > '1' )
|
||||||
{
|
{
|
||||||
|
// Reading a global label (SCH_GLOBALLABEL item).
|
||||||
SCH_GLOBALLABEL* TextStruct =
|
SCH_GLOBALLABEL* TextStruct =
|
||||||
new SCH_GLOBALLABEL( pos, CONV_FROM_UTF8( text ) );
|
new SCH_GLOBALLABEL( pos, CONV_FROM_UTF8( text ) );
|
||||||
|
|
||||||
|
@ -96,7 +97,8 @@ SCH_ITEM* ReadTextDescr( FILE* aFile,
|
||||||
TextStruct->SetSchematicTextOrientation( orient );
|
TextStruct->SetSchematicTextOrientation( orient );
|
||||||
TextStruct->m_Shape = NET_INPUT;
|
TextStruct->m_Shape = NET_INPUT;
|
||||||
TextStruct->m_Bold = (thickness != 0);
|
TextStruct->m_Bold = (thickness != 0);
|
||||||
TextStruct->m_Width = TextStruct->m_Bold ? GetPenSizeForBold( size ) : 0;
|
TextStruct->m_Width =
|
||||||
|
TextStruct->m_Bold ? GetPenSizeForBold( size ) : 0;
|
||||||
|
|
||||||
if( stricmp( Name2, SheetLabelType[NET_OUTPUT] ) == 0 )
|
if( stricmp( Name2, SheetLabelType[NET_OUTPUT] ) == 0 )
|
||||||
TextStruct->m_Shape = NET_OUTPUT;
|
TextStruct->m_Shape = NET_OUTPUT;
|
||||||
|
@ -109,18 +111,22 @@ SCH_ITEM* ReadTextDescr( FILE* aFile,
|
||||||
if( stricmp( Name3, "Italic" ) == 0 )
|
if( stricmp( Name3, "Italic" ) == 0 )
|
||||||
TextStruct->m_Italic = 1;
|
TextStruct->m_Italic = 1;
|
||||||
}
|
}
|
||||||
else if( (Name1[0] == 'H') // Reading a hierarchical label (SCH_HIERLABEL item)
|
else if( (Name1[0] == 'H')
|
||||||
|| (Name1[0] == 'G' && aSchematicFileVersion == '1') ) //in schematic file version 1, glabels were actually hierarchal labels.
|
|| (Name1[0] == 'G' && aSchematicFileVersion == '1') )
|
||||||
{
|
{
|
||||||
SCH_HIERLABEL* TextStruct =
|
// Reading a hierarchical label (SCH_HIERLABEL item).
|
||||||
new SCH_HIERLABEL( pos, CONV_FROM_UTF8( text ) );
|
// In schematic file version 1, glabels were actually hierarchical
|
||||||
|
// labels.
|
||||||
|
SCH_HIERLABEL* TextStruct = new SCH_HIERLABEL( pos,
|
||||||
|
CONV_FROM_UTF8( text ) );
|
||||||
|
|
||||||
Struct = TextStruct;
|
Struct = TextStruct;
|
||||||
TextStruct->m_Size.x = TextStruct->m_Size.y = size;
|
TextStruct->m_Size.x = TextStruct->m_Size.y = size;
|
||||||
TextStruct->SetSchematicTextOrientation( orient );
|
TextStruct->SetSchematicTextOrientation( orient );
|
||||||
TextStruct->m_Shape = NET_INPUT;
|
TextStruct->m_Shape = NET_INPUT;
|
||||||
TextStruct->m_Bold = (thickness != 0);
|
TextStruct->m_Bold = (thickness != 0);
|
||||||
TextStruct->m_Width = TextStruct->m_Bold ? GetPenSizeForBold( size ) : 0;
|
TextStruct->m_Width =
|
||||||
|
TextStruct->m_Bold ? GetPenSizeForBold( size ) : 0;
|
||||||
|
|
||||||
if( stricmp( Name2, SheetLabelType[NET_OUTPUT] ) == 0 )
|
if( stricmp( Name2, SheetLabelType[NET_OUTPUT] ) == 0 )
|
||||||
TextStruct->m_Shape = NET_OUTPUT;
|
TextStruct->m_Shape = NET_OUTPUT;
|
||||||
|
@ -156,7 +162,8 @@ SCH_ITEM* ReadTextDescr( FILE* aFile,
|
||||||
{
|
{
|
||||||
thickness = atol( Name3 );
|
thickness = atol( Name3 );
|
||||||
TextStruct->m_Bold = (thickness != 0);
|
TextStruct->m_Bold = (thickness != 0);
|
||||||
TextStruct->m_Width = TextStruct->m_Bold ? GetPenSizeForBold( size ) : 0;
|
TextStruct->m_Width =
|
||||||
|
TextStruct->m_Bold ? GetPenSizeForBold( size ) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( strnicmp( Name2, "Italic", 6 ) == 0 )
|
if( strnicmp( Name2, "Italic", 6 ) == 0 )
|
||||||
|
@ -168,30 +175,30 @@ SCH_ITEM* ReadTextDescr( FILE* aFile,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Fonction utilisee par LoadEEFile().
|
/* Function used by LoadEEFile().
|
||||||
* Lit les lignes relatives a la description d'une feuille de hierarchie
|
* Get the lines for a description of a piece of hierarchy.
|
||||||
*/
|
*/
|
||||||
int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
|
int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
|
||||||
int* aLineNum, BASE_SCREEN* Window )
|
int* aLineNum, BASE_SCREEN* Window )
|
||||||
{
|
{
|
||||||
int ii, fieldNdx, size;
|
int ii, fieldNdx, size;
|
||||||
char Name1[256], Char1[256], Char2[256];
|
char Name1[256], Char1[256], Char2[256];
|
||||||
DrawSheetStruct* SheetStruct;
|
SCH_SHEET* SheetStruct;
|
||||||
Hierarchical_PIN_Sheet_Struct* SheetLabelStruct, * OldSheetLabel = NULL;
|
SCH_SHEET_PIN* SheetLabelStruct, * OldSheetLabel = NULL;
|
||||||
int Failed = FALSE;
|
int Failed = FALSE;
|
||||||
char* ptcar;
|
char* ptcar;
|
||||||
|
|
||||||
SheetStruct = new DrawSheetStruct();
|
SheetStruct = new SCH_SHEET();
|
||||||
|
|
||||||
SheetStruct->m_TimeStamp = GetTimeStamp();
|
SheetStruct->m_TimeStamp = GetTimeStamp();
|
||||||
|
|
||||||
//sheets are added to the EEDrawList like other schematic components.
|
// sheets are added to the EEDrawList like other schematic components.
|
||||||
//however, in order to preserve the hierarchy (through m_Parent pointers),
|
// however, in order to preserve the hierarchy (through m_Parent pointers),
|
||||||
//a duplicate of the sheet is added to m_SubSheet array.
|
// a duplicate of the sheet is added to m_SubSheet array.
|
||||||
//must be a duplicate, references just work for a two-layer structure.
|
// must be a duplicate, references just work for a two-layer structure.
|
||||||
//this is accomplished through the Sync() function.
|
// this is accomplished through the Sync() function.
|
||||||
|
|
||||||
if( Line[0] == '$' ) /* Ligne doit etre "$Sheet" */
|
if( Line[0] == '$' ) /* Line should be "$Sheet" */
|
||||||
{
|
{
|
||||||
*aLineNum++;
|
*aLineNum++;
|
||||||
if( fgets( Line, 256 - 1, f ) == 0 )
|
if( fgets( Line, 256 - 1, f ) == 0 )
|
||||||
|
@ -217,7 +224,7 @@ int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read fields */
|
/* Read fields */
|
||||||
for( ; ; ) /* Analyse des lignes "Fn "texte" .." */
|
for( ; ; ) /* Analysis of lines "Fn" text. */
|
||||||
{
|
{
|
||||||
*aLineNum++;
|
*aLineNum++;
|
||||||
if( fgets( Line, 256 - 1, f ) == NULL )
|
if( fgets( Line, 256 - 1, f ) == NULL )
|
||||||
|
@ -233,11 +240,12 @@ int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
|
||||||
break;
|
break;
|
||||||
sscanf( Line + 1, "%d", &fieldNdx );
|
sscanf( Line + 1, "%d", &fieldNdx );
|
||||||
|
|
||||||
/* Lecture du champ :
|
|
||||||
* si fieldNdx >= 2 : Fn "texte" t s posx posy
|
|
||||||
* sinon F0 "texte" pour sheetname
|
|
||||||
* et F1 "texte" pour filename */
|
|
||||||
|
|
||||||
|
/* Read the field:
|
||||||
|
* If fieldNdx> = 2: Fn "text" t s posx posy
|
||||||
|
* If F0 "text" for SheetName
|
||||||
|
* F1 and "text" for filename
|
||||||
|
*/
|
||||||
ptcar = Line; while( *ptcar && (*ptcar != '"') )
|
ptcar = Line; while( *ptcar && (*ptcar != '"') )
|
||||||
ptcar++;
|
ptcar++;
|
||||||
|
|
||||||
|
@ -297,9 +305,8 @@ error line %d, aborted\n" ),
|
||||||
|
|
||||||
if( fieldNdx > 1 )
|
if( fieldNdx > 1 )
|
||||||
{
|
{
|
||||||
SheetLabelStruct =
|
SheetLabelStruct = new SCH_SHEET_PIN( SheetStruct, wxPoint( 0, 0 ),
|
||||||
new Hierarchical_PIN_Sheet_Struct( SheetStruct, wxPoint( 0, 0 ),
|
CONV_FROM_UTF8( Name1 ) );
|
||||||
CONV_FROM_UTF8( Name1 ) );
|
|
||||||
|
|
||||||
if( SheetStruct->m_Label == NULL )
|
if( SheetStruct->m_Label == NULL )
|
||||||
OldSheetLabel = SheetStruct->m_Label = SheetLabelStruct;
|
OldSheetLabel = SheetStruct->m_Label = SheetLabelStruct;
|
||||||
|
@ -307,7 +314,7 @@ error line %d, aborted\n" ),
|
||||||
OldSheetLabel->SetNext( (EDA_BaseStruct*) SheetLabelStruct );
|
OldSheetLabel->SetNext( (EDA_BaseStruct*) SheetLabelStruct );
|
||||||
OldSheetLabel = SheetLabelStruct;
|
OldSheetLabel = SheetLabelStruct;
|
||||||
|
|
||||||
/* Lecture des coordonnees */
|
/* Read coordinates. */
|
||||||
if( sscanf( ptcar, "%s %s %d %d %d", Char1, Char2,
|
if( sscanf( ptcar, "%s %s %d %d %d", Char1, Char2,
|
||||||
&SheetLabelStruct->m_Pos.x, &SheetLabelStruct->m_Pos.y,
|
&SheetLabelStruct->m_Pos.x, &SheetLabelStruct->m_Pos.y,
|
||||||
&size ) != 5 )
|
&size ) != 5 )
|
||||||
|
@ -324,23 +331,27 @@ error line %d, aborted\n" ),
|
||||||
size = DEFAULT_SIZE_TEXT;
|
size = DEFAULT_SIZE_TEXT;
|
||||||
SheetLabelStruct->m_Size.x = SheetLabelStruct->m_Size.y = size;
|
SheetLabelStruct->m_Size.x = SheetLabelStruct->m_Size.y = size;
|
||||||
|
|
||||||
/* Mise a jour des cadrage et type */
|
|
||||||
switch( Char1[0] )
|
switch( Char1[0] )
|
||||||
{
|
{
|
||||||
case 'I':
|
case 'I':
|
||||||
SheetLabelStruct->m_Shape = NET_INPUT; break;
|
SheetLabelStruct->m_Shape = NET_INPUT;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'O':
|
case 'O':
|
||||||
SheetLabelStruct->m_Shape = NET_OUTPUT; break;
|
SheetLabelStruct->m_Shape = NET_OUTPUT;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'B':
|
case 'B':
|
||||||
SheetLabelStruct->m_Shape = NET_BIDI; break;
|
SheetLabelStruct->m_Shape = NET_BIDI;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'T':
|
case 'T':
|
||||||
SheetLabelStruct->m_Shape = NET_TRISTATE; break;
|
SheetLabelStruct->m_Shape = NET_TRISTATE;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'U':
|
case 'U':
|
||||||
SheetLabelStruct->m_Shape = NET_UNSPECIFIED; break;
|
SheetLabelStruct->m_Shape = NET_UNSPECIFIED;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Char2[0] == 'R' )
|
if( Char2[0] == 'R' )
|
||||||
|
@ -361,14 +372,12 @@ error line %d, aborted\n" ),
|
||||||
Window->EEDrawList = SheetStruct;
|
Window->EEDrawList = SheetStruct;
|
||||||
SheetStruct->SetParent( Window );
|
SheetStruct->SetParent( Window );
|
||||||
}
|
}
|
||||||
return Failed; /* Fin lecture 1 composant */
|
|
||||||
|
return Failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************/
|
/* Read the schematic header. */
|
||||||
/* Analyse de l'entete du schema ( dims feuille, cartouche..)
|
|
||||||
*/
|
|
||||||
/******************************************************************/
|
|
||||||
bool ReadSchemaDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
|
bool ReadSchemaDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
|
||||||
int* aLineNum, BASE_SCREEN* Window )
|
int* aLineNum, BASE_SCREEN* Window )
|
||||||
{
|
{
|
||||||
|
@ -384,7 +393,7 @@ bool ReadSchemaDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
|
||||||
wxSize PageSize;
|
wxSize PageSize;
|
||||||
|
|
||||||
sscanf( Line, "%s %s %d %d", Text, Text, &PageSize.x, &PageSize.y );
|
sscanf( Line, "%s %s %d %d", Text, Text, &PageSize.x, &PageSize.y );
|
||||||
/* Recherche de la descr correspondante: */
|
|
||||||
wxString pagename = CONV_FROM_UTF8( Text );
|
wxString pagename = CONV_FROM_UTF8( Text );
|
||||||
for( ii = 0; SheetFormatList[ii] != NULL; ii++ )
|
for( ii = 0; SheetFormatList[ii] != NULL; ii++ )
|
||||||
{
|
{
|
||||||
|
@ -402,17 +411,15 @@ bool ReadSchemaDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
|
||||||
|
|
||||||
if( SheetFormatList[ii] == NULL )
|
if( SheetFormatList[ii] == NULL )
|
||||||
{
|
{
|
||||||
/* Erreur ici: descr non trouvee */
|
aMsgDiag.Printf( wxT( "EESchema file dimension definition error \
|
||||||
aMsgDiag.Printf( wxT( "EESchema file Dims Caract error line %d, \aborted\n" ),
|
line %d, \aAbort reading file.\n" ),
|
||||||
*aLineNum );
|
*aLineNum );
|
||||||
aMsgDiag << CONV_FROM_UTF8( Line );
|
aMsgDiag << CONV_FROM_UTF8( Line );
|
||||||
DisplayError( frame, aMsgDiag );
|
DisplayError( frame, aMsgDiag );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ajuste ecran */
|
|
||||||
Window->m_CurrentSheetDesc = wsheet;
|
Window->m_CurrentSheetDesc = wsheet;
|
||||||
|
|
||||||
/* Recheche suite et fin de descr */
|
|
||||||
for( ; ; )
|
for( ; ; )
|
||||||
{
|
{
|
||||||
if( GetLine( f, Line, aLineNum, 1024 ) == NULL )
|
if( GetLine( f, Line, aLineNum, 1024 ) == NULL )
|
||||||
|
@ -485,8 +492,8 @@ bool ReadSchemaDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Fonction utilisee par LoadEEFile().
|
/* Function used by LoadEEFile ().
|
||||||
* Lit les lignes relatives a la description d'un composant en schema
|
* Get the lines for a description of a schematic component.
|
||||||
*/
|
*/
|
||||||
int ReadPartDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
|
int ReadPartDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
|
||||||
int* aLineNum, BASE_SCREEN* Window )
|
int* aLineNum, BASE_SCREEN* Window )
|
||||||
|
@ -512,7 +519,6 @@ int ReadPartDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Traitement de la 1ere ligne de description */
|
|
||||||
if( sscanf( &Line[1], "%s %s", Name1, Name2 ) != 2 )
|
if( sscanf( &Line[1], "%s %s", Name1, Name2 ) != 2 )
|
||||||
{
|
{
|
||||||
aMsgDiag.Printf(
|
aMsgDiag.Printf(
|
||||||
|
@ -585,24 +591,21 @@ int ReadPartDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
|
||||||
component->GetField( REFERENCE )->m_Attributs = TEXT_NO_VISIBLE;
|
component->GetField( REFERENCE )->m_Attributs = TEXT_NO_VISIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Traitement des autres lignes de description */
|
/* Parse component description
|
||||||
|
* These lines begin with:
|
||||||
/* Ces lignes commencent par:
|
* "P" = Position
|
||||||
* "P " = position
|
* U = Num Unit and Conversion
|
||||||
* "U " = Num Unit, et Conversion
|
* "Fn" = Fields (0 .. n = = number of field)
|
||||||
* "Fn" = Champs ( n = 0.. = numero de champ )
|
* "Ar" = Alternate reference in the case of multiple sheets referring to
|
||||||
* "Ar" = AlternateReference, in the case of multiple sheets
|
* one schematic file.
|
||||||
* referring to one schematic file.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Lecture des champs */
|
|
||||||
for( ; ; )
|
for( ; ; )
|
||||||
{
|
{
|
||||||
*aLineNum++;
|
*aLineNum++;
|
||||||
if( fgets( Line, 256 - 1, f ) == NULL )
|
if( fgets( Line, 256 - 1, f ) == NULL )
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if( Line[0] == 'U' ) /* Lecture num multi, conversion et time stamp */
|
if( Line[0] == 'U' )
|
||||||
{
|
{
|
||||||
sscanf( Line + 1, "%d %d %lX",
|
sscanf( Line + 1, "%d %d %lX",
|
||||||
&component->m_Multi, &component->m_Convert,
|
&component->m_Multi, &component->m_Convert,
|
||||||
|
@ -613,8 +616,9 @@ int ReadPartDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
|
||||||
sscanf( Line + 1, "%d %d",
|
sscanf( Line + 1, "%d %d",
|
||||||
&component->m_Pos.x, &component->m_Pos.y );
|
&component->m_Pos.x, &component->m_Pos.y );
|
||||||
|
|
||||||
// Set fields position to a default position (that is the component position
|
// Set fields position to a default position (that is the
|
||||||
// For existing fields, the real position will be set later
|
// component position. For existing fields, the real position
|
||||||
|
// will be set later
|
||||||
for( int i = 0; i<component->GetFieldCount(); ++i )
|
for( int i = 0; i<component->GetFieldCount(); ++i )
|
||||||
{
|
{
|
||||||
if( component->GetField( i )->m_Text.IsEmpty() )
|
if( component->GetField( i )->m_Text.IsEmpty() )
|
||||||
|
@ -662,7 +666,6 @@ int ReadPartDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
|
||||||
|
|
||||||
FieldUserName[0] = 0;
|
FieldUserName[0] = 0;
|
||||||
|
|
||||||
/* Lecture du champ */
|
|
||||||
ptcar = Line;
|
ptcar = Line;
|
||||||
|
|
||||||
while( *ptcar && (*ptcar != '"') )
|
while( *ptcar && (*ptcar != '"') )
|
||||||
|
@ -780,7 +783,6 @@ int ReadPartDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lecture multi et position du composant */
|
|
||||||
if( sscanf( Line, "%d %d %d", &component->m_Multi,
|
if( sscanf( Line, "%d %d %d", &component->m_Multi,
|
||||||
&component->m_Pos.x, &component->m_Pos.y ) != 3 )
|
&component->m_Pos.x, &component->m_Pos.y ) != 3 )
|
||||||
{
|
{
|
||||||
|
@ -791,7 +793,6 @@ int ReadPartDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
|
||||||
return Failed;
|
return Failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lecture de la matrice de miroir / rotation */
|
|
||||||
*aLineNum++;
|
*aLineNum++;
|
||||||
if( (fgets( Line, 256 - 1, f ) == NULL)
|
if( (fgets( Line, 256 - 1, f ) == NULL)
|
||||||
|| (sscanf( Line, "%d %d %d %d",
|
|| (sscanf( Line, "%d %d %d %d",
|
||||||
|
@ -828,5 +829,5 @@ int ReadPartDescr( wxWindow* frame, char* Line, FILE* f, wxString& aMsgDiag,
|
||||||
component->SetParent( Window );
|
component->SetParent( Window );
|
||||||
}
|
}
|
||||||
|
|
||||||
return Failed; /* Fin lecture 1 composant */
|
return Failed;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*********************************************/
|
/*********************************************/
|
||||||
/* eesave.cpp Module to Save EESchema files */
|
/* eesave.cpp Module to Save EESchema files */
|
||||||
/*********************************************/
|
/*********************************************/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
|
@ -18,15 +18,13 @@
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
|
|
||||||
/* Fonctions Locales */
|
|
||||||
static void SaveLayers( FILE* f );
|
static void SaveLayers( FILE* f );
|
||||||
|
|
||||||
/* Variables locales */
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Routine to save an EESchema file. *
|
* Routine to save an EESchema file. *
|
||||||
* FileSave controls how the file is to be saved - under what name. *
|
* FileSave controls how the file is to be saved - under what name. *
|
||||||
* Returns TRUE if the file has been saved. *
|
* Returns TRUE if the file has been saved. *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
bool WinEDA_SchematicFrame::SaveEEFile( SCH_SCREEN* screen, int FileSave )
|
bool WinEDA_SchematicFrame::SaveEEFile( SCH_SCREEN* screen, int FileSave )
|
||||||
{
|
{
|
||||||
|
@ -106,16 +104,13 @@ bool WinEDA_SchematicFrame::SaveEEFile( SCH_SCREEN* screen, int FileSave )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************/
|
|
||||||
bool SCH_SCREEN::Save( FILE* aFile ) const
|
|
||||||
/*****************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Save
|
* Function Save
|
||||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
* writes the data structures for this object out to a FILE in "*.sch" format.
|
||||||
* @param aFile The FILE to write to.
|
* @param aFile The FILE to write to.
|
||||||
* @return bool - true if success writing else false.
|
* @return bool - true if success writing else false.
|
||||||
*/
|
*/
|
||||||
|
bool SCH_SCREEN::Save( FILE* aFile ) const
|
||||||
{
|
{
|
||||||
wxString Name, msg;
|
wxString Name, msg;
|
||||||
Ki_PageDescr* PlotSheet;
|
Ki_PageDescr* PlotSheet;
|
||||||
|
@ -145,9 +140,10 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
|
||||||
fprintf( aFile, "$Descr %s %d %d\n", CONV_TO_UTF8( PlotSheet->m_Name ),
|
fprintf( aFile, "$Descr %s %d %d\n", CONV_TO_UTF8( PlotSheet->m_Name ),
|
||||||
PlotSheet->m_Size.x, PlotSheet->m_Size.y );
|
PlotSheet->m_Size.x, PlotSheet->m_Size.y );
|
||||||
|
|
||||||
/* Write ScreenNumber and NumberOfScreen; not very meaningfull for SheetNumber and Sheet Count
|
/* Write ScreenNumber and NumberOfScreen; not very meaningfull for
|
||||||
* in a complex hierarchy, but usefull in simple hierarchy and flat hierarchy
|
* SheetNumber and Sheet Countin a complex hierarchy, but usefull in
|
||||||
* Used also to serach the root sheet ( ScreenNumber = 1 ) withing the files
|
* simple hierarchy and flat hierarchy. Used also to serach the root
|
||||||
|
* sheet ( ScreenNumber = 1 ) within the files
|
||||||
*/
|
*/
|
||||||
fprintf( aFile, "Sheet %d %d\n", m_ScreenNumber, m_NumberOfScreen );
|
fprintf( aFile, "Sheet %d %d\n", m_ScreenNumber, m_NumberOfScreen );
|
||||||
fprintf( aFile, "Title \"%s\"\n", CONV_TO_UTF8( m_Title ) );
|
fprintf( aFile, "Title \"%s\"\n", CONV_TO_UTF8( m_Title ) );
|
||||||
|
@ -177,14 +173,12 @@ bool SCH_SCREEN::Save( FILE* aFile ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************/
|
|
||||||
static void SaveLayers( FILE* f )
|
|
||||||
/****************************/
|
|
||||||
|
|
||||||
/* Save a Layer Structure to a file
|
/* Save a Layer Structure to a file
|
||||||
* theses infos are not used in eeschema
|
* theses infos are not used in eeschema
|
||||||
*/
|
*/
|
||||||
|
static void SaveLayers( FILE* f )
|
||||||
{
|
{
|
||||||
fprintf( f, "EELAYER %2d %2d\n", g_LayerDescr.NumberOfLayers, g_LayerDescr.CurrentLayer );
|
fprintf( f, "EELAYER %2d %2d\n", g_LayerDescr.NumberOfLayers,
|
||||||
|
g_LayerDescr.CurrentLayer );
|
||||||
fprintf( f, "EELAYER END\n" );
|
fprintf( f, "EELAYER END\n" );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/******************************************************/
|
/*****************/
|
||||||
/* schedit.cpp: fonctions generales de la schematique */
|
/* schedit.cpp */
|
||||||
/******************************************************/
|
/*****************/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "gr_basic.h"
|
#include "gr_basic.h"
|
||||||
|
@ -18,11 +18,6 @@
|
||||||
#include "class_library.h"
|
#include "class_library.h"
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
*
|
|
||||||
* Traite les selections d'outils et les commandes appelees du menu POPUP
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
int id = event.GetId();
|
int id = event.GetId();
|
||||||
|
@ -118,9 +113,9 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
case ID_POPUP_SCH_ADD_LABEL:
|
case ID_POPUP_SCH_ADD_LABEL:
|
||||||
case ID_POPUP_SCH_GETINFO_MARKER:
|
case ID_POPUP_SCH_GETINFO_MARKER:
|
||||||
|
|
||||||
/* At this point: Do nothing. these commands do not need to stop the current command
|
/* At this point: Do nothing. these commands do not need to stop the
|
||||||
* (mainly a block command) or reset the current state
|
* current command (mainly a block command) or reset the current state
|
||||||
* They will be executed later, in next switch structure.
|
* They will be executed later, in next switch structure.
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -134,7 +129,8 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
||||||
}
|
}
|
||||||
/* ne devrait pas etre execute, sauf bug: */
|
|
||||||
|
/* Should not be executed, except bug. */
|
||||||
if( screen->m_BlockLocate.m_Command != BLOCK_IDLE )
|
if( screen->m_BlockLocate.m_Command != BLOCK_IDLE )
|
||||||
{
|
{
|
||||||
screen->m_BlockLocate.m_Command = BLOCK_IDLE;
|
screen->m_BlockLocate.m_Command = BLOCK_IDLE;
|
||||||
|
@ -144,14 +140,16 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_SCH_DELETE_CMP:
|
case ID_POPUP_SCH_DELETE_CMP:
|
||||||
case ID_POPUP_SCH_DELETE: // Stop the, current command, keep the current tool
|
case ID_POPUP_SCH_DELETE:
|
||||||
|
// Stop the current command but keep the current tool
|
||||||
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
|
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
|
||||||
{
|
{
|
||||||
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: // Stop the current command, and deselect the current tool
|
default:
|
||||||
|
// Stop the current command and deselect the current tool
|
||||||
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
|
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
|
||||||
{
|
{
|
||||||
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
|
||||||
|
@ -162,9 +160,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// End switch commande en cours
|
switch( id )
|
||||||
|
|
||||||
switch( id ) // Command execution:
|
|
||||||
{
|
{
|
||||||
case ID_HIERARCHY:
|
case ID_HIERARCHY:
|
||||||
InstallHierarchyFrame( &dc, pos );
|
InstallHierarchyFrame( &dc, pos );
|
||||||
|
@ -380,32 +376,34 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
|
|
||||||
case ID_POPUP_SCH_RESIZE_SHEET:
|
case ID_POPUP_SCH_RESIZE_SHEET:
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
ReSizeSheet( (DrawSheetStruct*) screen->GetCurItem(), &dc );
|
ReSizeSheet( (SCH_SHEET*) screen->GetCurItem(), &dc );
|
||||||
TestDanglingEnds( screen->EEDrawList, &dc );
|
TestDanglingEnds( screen->EEDrawList, &dc );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_SCH_EDIT_SHEET:
|
case ID_POPUP_SCH_EDIT_SHEET:
|
||||||
EditSheet( (DrawSheetStruct*) screen->GetCurItem(), &dc );
|
EditSheet( (SCH_SHEET*) screen->GetCurItem(), &dc );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_IMPORT_GLABEL:
|
case ID_POPUP_IMPORT_GLABEL:
|
||||||
if ( screen->GetCurItem() && screen->GetCurItem()->Type() == DRAW_SHEET_STRUCT_TYPE )
|
if ( screen->GetCurItem()
|
||||||
GetScreen()->SetCurItem( Import_PinSheet( (DrawSheetStruct*)screen->GetCurItem(), &dc ) );
|
&& screen->GetCurItem()->Type() == DRAW_SHEET_STRUCT_TYPE )
|
||||||
|
GetScreen()->SetCurItem(
|
||||||
|
Import_PinSheet( (SCH_SHEET*)screen->GetCurItem(), &dc ) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_SCH_CLEANUP_SHEET:
|
case ID_POPUP_SCH_CLEANUP_SHEET:
|
||||||
if ( screen->GetCurItem() && screen->GetCurItem()->Type() == DRAW_SHEET_STRUCT_TYPE )
|
if ( screen->GetCurItem()
|
||||||
( (DrawSheetStruct*) screen->GetCurItem() )->CleanupSheet( this, true );
|
&& screen->GetCurItem()->Type() == DRAW_SHEET_STRUCT_TYPE )
|
||||||
|
( (SCH_SHEET*) screen->GetCurItem() )->CleanupSheet( this, true );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_SCH_EDIT_PINSHEET:
|
case ID_POPUP_SCH_EDIT_PINSHEET:
|
||||||
Edit_PinSheet( (Hierarchical_PIN_Sheet_Struct*) screen->GetCurItem(), &dc );
|
Edit_PinSheet( (SCH_SHEET_PIN*) screen->GetCurItem(), &dc );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_SCH_MOVE_PINSHEET:
|
case ID_POPUP_SCH_MOVE_PINSHEET:
|
||||||
DrawPanel->MouseToCursorSchema();
|
DrawPanel->MouseToCursorSchema();
|
||||||
StartMove_PinSheet( (Hierarchical_PIN_Sheet_Struct*)
|
StartMove_PinSheet( (SCH_SHEET_PIN*)screen->GetCurItem(), &dc );
|
||||||
screen->GetCurItem(), &dc );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_SCH_DRAG_CMP_REQUEST:
|
case ID_POPUP_SCH_DRAG_CMP_REQUEST:
|
||||||
|
@ -446,12 +444,13 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
if( !HandleBlockBegin( &dc, BLOCK_DRAG,
|
if( !HandleBlockBegin( &dc, BLOCK_DRAG,
|
||||||
screen->m_Curseur ) )
|
screen->m_Curseur ) )
|
||||||
break;
|
break;
|
||||||
// Ensure the block selection contains the segment, or one end of the segment
|
// Ensure the block selection contains the segment, or one end of
|
||||||
// the initial rect is only one point (w = h = 0)
|
// the segment. The initial rect is only one point (w = h = 0)
|
||||||
// The rect must contains one or 2 ends.
|
// The rect must contains one or 2 ends.
|
||||||
// If only one end is selected, this is a drag Node
|
// If only one end is selected, this is a drag Node
|
||||||
// if no ends selected, we adjust the rect area to contain the whole segment
|
// if no ends selected, we adjust the rect area to contain the
|
||||||
// This works fine only for H and V segments and only if they do not cross a component
|
// whole segment. This works fine only for H and V segments and
|
||||||
|
// only if they do not cross a component
|
||||||
// TODO: a better way to drag only wires
|
// TODO: a better way to drag only wires
|
||||||
EDA_DrawLineStruct* segm = (EDA_DrawLineStruct*)screen->GetCurItem();
|
EDA_DrawLineStruct* segm = (EDA_DrawLineStruct*)screen->GetCurItem();
|
||||||
if( !screen->m_BlockLocate.Inside(segm->m_Start) &&
|
if( !screen->m_BlockLocate.Inside(segm->m_Start) &&
|
||||||
|
@ -664,7 +663,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
EDA_BaseStruct* DrawStruct = screen->GetCurItem();
|
EDA_BaseStruct* DrawStruct = screen->GetCurItem();
|
||||||
if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) )
|
if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) )
|
||||||
{
|
{
|
||||||
InstallNextScreen( (DrawSheetStruct*) DrawStruct );
|
InstallNextScreen( (SCH_SHEET*) DrawStruct );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -741,13 +740,14 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_POPUP_SCH_GETINFO_MARKER:
|
case ID_POPUP_SCH_GETINFO_MARKER:
|
||||||
if( screen->GetCurItem() && screen->GetCurItem()->Type() == TYPE_MARKER_SCH )
|
if( screen->GetCurItem()
|
||||||
|
&& screen->GetCurItem()->Type() == TYPE_MARKER_SCH )
|
||||||
((MARKER_SCH*)screen->GetCurItem())->DisplayMarkerInfo( this );
|
((MARKER_SCH*)screen->GetCurItem())->DisplayMarkerInfo( this );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: // Log error:
|
default: // Log error:
|
||||||
DisplayError( this,
|
DisplayError( this,
|
||||||
wxT( "WinEDA_SchematicFrame::Process_Special_Functions error" ) );
|
wxT( "WinEDA_SchematicFrame::Process_Special_Functions error" ) );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -759,9 +759,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************************/
|
|
||||||
void WinEDA_SchematicFrame::Process_Move_Item( SCH_ITEM* DrawStruct, wxDC* DC )
|
void WinEDA_SchematicFrame::Process_Move_Item( SCH_ITEM* DrawStruct, wxDC* DC )
|
||||||
/*************************************************************************************/
|
|
||||||
{
|
{
|
||||||
if( DrawStruct == NULL )
|
if( DrawStruct == NULL )
|
||||||
return;
|
return;
|
||||||
|
@ -792,7 +790,7 @@ void WinEDA_SchematicFrame::Process_Move_Item( SCH_ITEM* DrawStruct, wxDC* DC )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DRAW_SHEET_STRUCT_TYPE:
|
case DRAW_SHEET_STRUCT_TYPE:
|
||||||
StartMoveSheet( (DrawSheetStruct*) DrawStruct, DC );
|
StartMoveSheet( (SCH_SHEET*) DrawStruct, DC );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DRAW_NOCONNECT_STRUCT_TYPE:
|
case DRAW_NOCONNECT_STRUCT_TYPE:
|
||||||
|
|
|
@ -138,8 +138,8 @@ void SwapData( EDA_BaseStruct* aItem, EDA_BaseStruct* aImage )
|
||||||
case DRAW_SHEET_STRUCT_TYPE:
|
case DRAW_SHEET_STRUCT_TYPE:
|
||||||
#undef SOURCE
|
#undef SOURCE
|
||||||
#undef DEST
|
#undef DEST
|
||||||
#define SOURCE ( (DrawSheetStruct*) aItem )
|
#define SOURCE ( (SCH_SHEET*) aItem )
|
||||||
#define DEST ( (DrawSheetStruct*) aImage )
|
#define DEST ( (SCH_SHEET*) aImage )
|
||||||
DEST->SwapData( SOURCE );
|
DEST->SwapData( SOURCE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -154,8 +154,8 @@ void SwapData( EDA_BaseStruct* aItem, EDA_BaseStruct* aImage )
|
||||||
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
|
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
|
||||||
#undef SOURCE
|
#undef SOURCE
|
||||||
#undef DEST
|
#undef DEST
|
||||||
#define SOURCE ( (Hierarchical_PIN_Sheet_Struct*) aItem )
|
#define SOURCE ( (SCH_SHEET_PIN*) aItem )
|
||||||
#define DEST ( (Hierarchical_PIN_Sheet_Struct*) aImage )
|
#define DEST ( (SCH_SHEET_PIN*) aImage )
|
||||||
EXCHG( SOURCE->m_Edge, DEST->m_Edge );
|
EXCHG( SOURCE->m_Edge, DEST->m_Edge );
|
||||||
EXCHG( SOURCE->m_Shape, DEST->m_Shape );
|
EXCHG( SOURCE->m_Shape, DEST->m_Shape );
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/******************************************************************/
|
/******************/
|
||||||
/* schframe.cpp - fonctions des classes du type WinEDA_DrawFrame */
|
/* schframe.cpp */
|
||||||
/******************************************************************/
|
/******************/
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation
|
#pragma implementation
|
||||||
|
@ -84,8 +84,10 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame )
|
||||||
EVT_TOOL( wxID_CUT, WinEDA_SchematicFrame::Process_Special_Functions )
|
EVT_TOOL( wxID_CUT, WinEDA_SchematicFrame::Process_Special_Functions )
|
||||||
EVT_TOOL( wxID_COPY, WinEDA_SchematicFrame::Process_Special_Functions )
|
EVT_TOOL( wxID_COPY, WinEDA_SchematicFrame::Process_Special_Functions )
|
||||||
EVT_TOOL( wxID_PASTE, WinEDA_SchematicFrame::Process_Special_Functions )
|
EVT_TOOL( wxID_PASTE, WinEDA_SchematicFrame::Process_Special_Functions )
|
||||||
EVT_TOOL( ID_SCHEMATIC_UNDO, WinEDA_SchematicFrame::GetSchematicFromUndoList )
|
EVT_TOOL( ID_SCHEMATIC_UNDO,
|
||||||
EVT_TOOL( ID_SCHEMATIC_REDO, WinEDA_SchematicFrame::GetSchematicFromRedoList )
|
WinEDA_SchematicFrame::GetSchematicFromUndoList )
|
||||||
|
EVT_TOOL( ID_SCHEMATIC_REDO,
|
||||||
|
WinEDA_SchematicFrame::GetSchematicFromRedoList )
|
||||||
EVT_TOOL( ID_GET_ANNOTATE, WinEDA_SchematicFrame::OnAnnotate )
|
EVT_TOOL( ID_GET_ANNOTATE, WinEDA_SchematicFrame::OnAnnotate )
|
||||||
EVT_TOOL( ID_GEN_PRINT, WinEDA_SchematicFrame::ToPrinter )
|
EVT_TOOL( ID_GEN_PRINT, WinEDA_SchematicFrame::ToPrinter )
|
||||||
EVT_TOOL( ID_GET_ERC, WinEDA_SchematicFrame::OnErc )
|
EVT_TOOL( ID_GET_ERC, WinEDA_SchematicFrame::OnErc )
|
||||||
|
@ -99,7 +101,7 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame )
|
||||||
EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp )
|
EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp )
|
||||||
EVT_MENU( ID_KICAD_ABOUT, WinEDA_DrawFrame::GetKicadAbout )
|
EVT_MENU( ID_KICAD_ABOUT, WinEDA_DrawFrame::GetKicadAbout )
|
||||||
|
|
||||||
// Tools et boutons de Schematique, Vertical toolbar:
|
// Tools and buttons for vertical toolbar.
|
||||||
EVT_TOOL_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START,
|
EVT_TOOL_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START,
|
||||||
ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
|
ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
|
||||||
WinEDA_SchematicFrame::Process_Special_Functions )
|
WinEDA_SchematicFrame::Process_Special_Functions )
|
||||||
|
@ -107,7 +109,8 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame )
|
||||||
EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE,
|
EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE,
|
||||||
WinEDA_SchematicFrame::Process_Special_Functions )
|
WinEDA_SchematicFrame::Process_Special_Functions )
|
||||||
|
|
||||||
// Tools et boutons de Schematique, Options toolbar:
|
|
||||||
|
// Tools and buttons options toolbar
|
||||||
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
|
EVT_TOOL_RANGE( ID_TB_OPTIONS_START, ID_TB_OPTIONS_END,
|
||||||
WinEDA_SchematicFrame::OnSelectOptionToolbar )
|
WinEDA_SchematicFrame::OnSelectOptionToolbar )
|
||||||
|
|
||||||
|
@ -135,7 +138,6 @@ BEGIN_EVENT_TABLE( WinEDA_SchematicFrame, WinEDA_DrawFrame )
|
||||||
WinEDA_SchematicFrame::OnUpdateUnits )
|
WinEDA_SchematicFrame::OnUpdateUnits )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
/****************/
|
/****************/
|
||||||
/* Constructor */
|
/* Constructor */
|
||||||
/****************/
|
/****************/
|
||||||
|
@ -157,7 +159,7 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
|
||||||
m_LibeditFrame = NULL; // Component editor frame.
|
m_LibeditFrame = NULL; // Component editor frame.
|
||||||
m_ViewlibFrame = NULL; // Frame for browsing component libraries
|
m_ViewlibFrame = NULL; // Frame for browsing component libraries
|
||||||
m_DefaultSchematicFileName = wxT( "noname.sch" );
|
m_DefaultSchematicFileName = wxT( "noname.sch" );
|
||||||
m_ShowAllPins = false;
|
m_ShowAllPins = false;
|
||||||
|
|
||||||
CreateScreens();
|
CreateScreens();
|
||||||
|
|
||||||
|
@ -172,10 +174,10 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
|
||||||
|
|
||||||
/* Get config */
|
/* Get config */
|
||||||
LoadSettings();
|
LoadSettings();
|
||||||
|
|
||||||
// Initilialize grid id to a default value if not found in config or bad:
|
// Internalize grid id to a default value if not found in config or bad:
|
||||||
if( (m_LastGridSizeId <= 0) ||
|
if( (m_LastGridSizeId <= 0)
|
||||||
(m_LastGridSizeId < (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000)) )
|
|| ( m_LastGridSizeId < (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000) ) )
|
||||||
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
|
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
|
||||||
|
|
||||||
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
||||||
|
@ -189,39 +191,39 @@ WinEDA_SchematicFrame::WinEDA_SchematicFrame( wxWindow* father,
|
||||||
ReCreateOptToolbar();
|
ReCreateOptToolbar();
|
||||||
|
|
||||||
#if KICAD_AUIMANAGER
|
#if KICAD_AUIMANAGER
|
||||||
m_auimgr.SetManagedWindow(this);
|
m_auimgr.SetManagedWindow( this );
|
||||||
|
|
||||||
wxAuiPaneInfo horiz;
|
wxAuiPaneInfo horiz;
|
||||||
horiz.Gripper(false);
|
horiz.Gripper( false );
|
||||||
horiz.DockFixed(true);
|
horiz.DockFixed( true );
|
||||||
horiz.Movable(false);
|
horiz.Movable( false );
|
||||||
horiz.Floatable(false);
|
horiz.Floatable( false );
|
||||||
horiz.CloseButton(false);
|
horiz.CloseButton( false );
|
||||||
horiz.CaptionVisible(false);
|
horiz.CaptionVisible( false );
|
||||||
|
|
||||||
wxAuiPaneInfo vert(horiz);
|
wxAuiPaneInfo vert( horiz );
|
||||||
|
|
||||||
vert.TopDockable(false).BottomDockable(false);
|
vert.TopDockable( false ).BottomDockable( false );
|
||||||
horiz.LeftDockable(false).RightDockable(false);
|
horiz.LeftDockable( false ).RightDockable( false );
|
||||||
|
|
||||||
m_auimgr.AddPane(m_HToolBar,
|
m_auimgr.AddPane( m_HToolBar,
|
||||||
wxAuiPaneInfo(horiz).Name(wxT("m_HToolBar")).Top().Row(0));
|
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().
|
||||||
|
Row( 0 ) );
|
||||||
|
|
||||||
m_auimgr.AddPane(m_VToolBar,
|
m_auimgr.AddPane( m_VToolBar,
|
||||||
wxAuiPaneInfo(vert).Name(wxT("m_VToolBar")).Right());
|
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );
|
||||||
|
|
||||||
m_auimgr.AddPane(m_OptionsToolBar,
|
m_auimgr.AddPane( m_OptionsToolBar,
|
||||||
wxAuiPaneInfo(vert).Name(wxT("m_OptionsToolBar")).Left());
|
wxAuiPaneInfo( vert ).Name( wxT( "m_OptionsToolBar" ) ).Left() );
|
||||||
|
|
||||||
m_auimgr.AddPane(DrawPanel,
|
m_auimgr.AddPane( DrawPanel,
|
||||||
wxAuiPaneInfo().Name(wxT("DrawFrame")).CentrePane());
|
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
|
||||||
|
|
||||||
m_auimgr.AddPane(MsgPanel,
|
m_auimgr.AddPane( MsgPanel,
|
||||||
wxAuiPaneInfo(horiz).Name(wxT("MsgPanel")).Bottom());
|
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
|
||||||
|
|
||||||
m_auimgr.Update();
|
m_auimgr.Update();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -254,33 +256,36 @@ DrawSheetPath* WinEDA_SchematicFrame::GetSheet()
|
||||||
|
|
||||||
/****************************************************/
|
/****************************************************/
|
||||||
void WinEDA_SchematicFrame::SetSheetNumberAndCount()
|
void WinEDA_SchematicFrame::SetSheetNumberAndCount()
|
||||||
|
{
|
||||||
/****************************************************/
|
/****************************************************/
|
||||||
|
|
||||||
/** Function SetSheetNumberAndCount
|
/** Function SetSheetNumberAndCount
|
||||||
* Set the m_ScreenNumber and m_NumberOfScreen members for screens
|
* Set the m_ScreenNumber and m_NumberOfScreen members for screens
|
||||||
* must be called after a delete or add sheet command, and when entering a sheet
|
* must be called after a delete or add sheet command, and when entering a
|
||||||
|
* sheet
|
||||||
*/
|
*/
|
||||||
{
|
|
||||||
SCH_SCREEN* screen = GetScreen();
|
SCH_SCREEN* screen = GetScreen();
|
||||||
EDA_ScreenList s_list;
|
EDA_ScreenList s_list;
|
||||||
|
|
||||||
/* Set the sheet count, and the sheet number (1 for root sheet)
|
/* Set the sheet count, and the sheet number (1 for root sheet)
|
||||||
*/
|
*/
|
||||||
int sheet_count = g_RootSheet->CountSheets();
|
int sheet_count = g_RootSheet->CountSheets();
|
||||||
int SheetNumber = 1;
|
int SheetNumber = 1;
|
||||||
wxString current_sheetpath = m_CurrentSheet->Path();
|
wxString current_sheetpath = m_CurrentSheet->Path();
|
||||||
EDA_SheetList SheetList;
|
EDA_SheetList SheetList;
|
||||||
|
|
||||||
// Examine all sheets path to find the current sheets path,
|
// Examine all sheets path to find the current sheets path,
|
||||||
// and count them from root to the current scheet path:
|
// and count them from root to the current sheet path:
|
||||||
DrawSheetPath* sheet;
|
DrawSheetPath* sheet;
|
||||||
|
|
||||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
for( sheet = SheetList.GetFirst(); sheet != NULL;
|
||||||
|
sheet = SheetList.GetNext() )
|
||||||
{
|
{
|
||||||
wxString sheetpath = sheet->Path();
|
wxString sheetpath = sheet->Path();
|
||||||
if( sheetpath == current_sheetpath ) // Current sheet path found
|
if( sheetpath == current_sheetpath ) // Current sheet path found
|
||||||
break;
|
break;
|
||||||
SheetNumber++; // not found, increment sheet number before this current path
|
SheetNumber++; /* Not found, increment sheet
|
||||||
|
* number before this current
|
||||||
|
* path */
|
||||||
}
|
}
|
||||||
|
|
||||||
for( screen = s_list.GetFirst(); screen != NULL; screen = s_list.GetNext() )
|
for( screen = s_list.GetFirst(); screen != NULL; screen = s_list.GetNext() )
|
||||||
|
@ -310,10 +315,9 @@ wxString WinEDA_SchematicFrame::GetScreenDesc()
|
||||||
|
|
||||||
void WinEDA_SchematicFrame::CreateScreens()
|
void WinEDA_SchematicFrame::CreateScreens()
|
||||||
{
|
{
|
||||||
/* creation des ecrans Sch , Lib */
|
|
||||||
if( g_RootSheet == NULL )
|
if( g_RootSheet == NULL )
|
||||||
{
|
{
|
||||||
g_RootSheet = new DrawSheetStruct();
|
g_RootSheet = new SCH_SHEET();
|
||||||
}
|
}
|
||||||
if( g_RootSheet->m_AssociatedScreen == NULL )
|
if( g_RootSheet->m_AssociatedScreen == NULL )
|
||||||
{
|
{
|
||||||
|
@ -334,8 +338,8 @@ void WinEDA_SchematicFrame::CreateScreens()
|
||||||
|
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
|
void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
|
||||||
/*****************************************************************/
|
|
||||||
{
|
{
|
||||||
|
/*****************************************************************/
|
||||||
DrawSheetPath* sheet;
|
DrawSheetPath* sheet;
|
||||||
|
|
||||||
if( m_LibeditFrame ) // Can close component editor ?
|
if( m_LibeditFrame ) // Can close component editor ?
|
||||||
|
@ -346,7 +350,8 @@ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
|
||||||
|
|
||||||
EDA_SheetList SheetList;
|
EDA_SheetList SheetList;
|
||||||
|
|
||||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
for( sheet = SheetList.GetFirst(); sheet != NULL;
|
||||||
|
sheet = SheetList.GetNext() )
|
||||||
{
|
{
|
||||||
if( sheet->LastScreen() && sheet->LastScreen()->IsModify() )
|
if( sheet->LastScreen() && sheet->LastScreen()->IsModify() )
|
||||||
break;
|
break;
|
||||||
|
@ -375,7 +380,9 @@ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
|
for( sheet = SheetList.GetFirst();
|
||||||
|
sheet != NULL;
|
||||||
|
sheet = SheetList.GetNext() )
|
||||||
{
|
{
|
||||||
if( sheet->LastScreen() )
|
if( sheet->LastScreen() )
|
||||||
{
|
{
|
||||||
|
@ -384,12 +391,12 @@ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !g_RootSheet->m_AssociatedScreen->m_FileName.IsEmpty()
|
if( !g_RootSheet->m_AssociatedScreen->m_FileName.IsEmpty()
|
||||||
&& (g_RootSheet->m_AssociatedScreen->EEDrawList != NULL) )
|
&& (g_RootSheet->m_AssociatedScreen->EEDrawList != NULL) )
|
||||||
SetLastProject( g_RootSheet->m_AssociatedScreen->m_FileName );
|
SetLastProject( g_RootSheet->m_AssociatedScreen->m_FileName );
|
||||||
|
|
||||||
ClearProjectDrawList( g_RootSheet->m_AssociatedScreen, TRUE );
|
ClearProjectDrawList( g_RootSheet->m_AssociatedScreen, TRUE );
|
||||||
|
|
||||||
/* allof sub sheets are deleted, only the main sheet is useable */
|
/* all sub sheets are deleted, only the main sheet is usable */
|
||||||
m_CurrentSheet->Clear();
|
m_CurrentSheet->Clear();
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
Destroy();
|
Destroy();
|
||||||
|
@ -398,8 +405,8 @@ void WinEDA_SchematicFrame::OnCloseWindow( wxCloseEvent& Event )
|
||||||
|
|
||||||
/************************************/
|
/************************************/
|
||||||
int WinEDA_SchematicFrame::BestZoom()
|
int WinEDA_SchematicFrame::BestZoom()
|
||||||
/************************************/
|
|
||||||
{
|
{
|
||||||
|
/************************************/
|
||||||
int dx, dy;
|
int dx, dy;
|
||||||
wxSize size;
|
wxSize size;
|
||||||
double zoom;
|
double zoom;
|
||||||
|
@ -409,7 +416,7 @@ int WinEDA_SchematicFrame::BestZoom()
|
||||||
|
|
||||||
size = DrawPanel->GetClientSize();
|
size = DrawPanel->GetClientSize();
|
||||||
zoom = MAX( (double) dx / (double) size.x,
|
zoom = MAX( (double) dx / (double) size.x,
|
||||||
(double) dy / (double) size.y );
|
(double) dy / (double) size.y );
|
||||||
|
|
||||||
GetScreen()->m_Curseur.x = dx / 2;
|
GetScreen()->m_Curseur.x = dx / 2;
|
||||||
GetScreen()->m_Curseur.y = dy / 2;
|
GetScreen()->m_Curseur.y = dy / 2;
|
||||||
|
@ -417,24 +424,27 @@ int WinEDA_SchematicFrame::BestZoom()
|
||||||
return wxRound( zoom * (double) GetScreen()->m_ZoomScalar );
|
return wxRound( zoom * (double) GetScreen()->m_ZoomScalar );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
wxString WinEDA_SchematicFrame::GetUniqueFilenameForCurrentSheet( )
|
wxString WinEDA_SchematicFrame::GetUniqueFilenameForCurrentSheet()
|
||||||
|
{
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
/** Function GetUniqueFilenameForCurrentSheet
|
/** Function GetUniqueFilenameForCurrentSheet
|
||||||
* @return a filename that can be used in plot and print functions
|
* @return a filename that can be used in plot and print functions
|
||||||
* for the current screen anad sheet path.
|
* for the current screen and sheet path.
|
||||||
* This filename is unique and must be used insteed of the screen filename
|
* This filename is unique and must be used insteed of the screen filename
|
||||||
* (or scheen filename) when one must creates file for each sheet in the heierarchy.
|
* (or sheet filename) when one must creates file for each sheet in the
|
||||||
* because in complex hierarchies a sheet and a SCH_SCREEN is used more than once
|
* heierarchy.
|
||||||
|
* because in complex hierarchies a sheet and a SCH_SCREEN is used more than
|
||||||
|
* once
|
||||||
* Name is <root sheet filename>-<sheet path>
|
* Name is <root sheet filename>-<sheet path>
|
||||||
* and has no extension.
|
* and has no extension.
|
||||||
* However if filename is too long name is <sheet filename>-<sheet number>
|
* However if filename is too long name is <sheet filename>-<sheet number>
|
||||||
*/
|
*/
|
||||||
{
|
|
||||||
wxFileName fn = g_RootSheet->GetFileName();
|
wxFileName fn = g_RootSheet->GetFileName();
|
||||||
wxString filename = fn.GetName();
|
wxString filename = fn.GetName();
|
||||||
|
|
||||||
if ( (filename.Len() + m_CurrentSheet->PathHumanReadable().Len() ) < 50 )
|
if( ( filename.Len() + m_CurrentSheet->PathHumanReadable().Len() ) < 50 )
|
||||||
{
|
{
|
||||||
filename += m_CurrentSheet->PathHumanReadable();
|
filename += m_CurrentSheet->PathHumanReadable();
|
||||||
filename.Replace( wxT( "/" ), wxT( "-" ) );
|
filename.Replace( wxT( "/" ), wxT( "-" ) );
|
||||||
|
@ -442,78 +452,92 @@ wxString WinEDA_SchematicFrame::GetUniqueFilenameForCurrentSheet( )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
filename << wxT("-") << GetScreen()->m_ScreenNumber;
|
filename << wxT( "-" ) << GetScreen()->m_ScreenNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Enable or disable menu entry and toolbar buttons according to current
|
* Enable or disable menu entry and toolbar buttons according to current
|
||||||
* conditions.
|
* conditions.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
void WinEDA_SchematicFrame::OnUpdateBlockSelected( wxUpdateUIEvent& event )
|
void WinEDA_SchematicFrame::OnUpdateBlockSelected( wxUpdateUIEvent& event )
|
||||||
{
|
{
|
||||||
bool enable = ( GetScreen() &&
|
bool enable = ( GetScreen()
|
||||||
GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE );
|
&& GetScreen()->m_BlockLocate.m_Command == BLOCK_MOVE );
|
||||||
event.Enable(enable);
|
|
||||||
|
event.Enable( enable );
|
||||||
m_HToolBar->EnableTool( wxID_CUT, enable );
|
m_HToolBar->EnableTool( wxID_CUT, enable );
|
||||||
m_HToolBar->EnableTool( wxID_COPY, enable );
|
m_HToolBar->EnableTool( wxID_COPY, enable );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WinEDA_SchematicFrame::OnUpdatePaste( wxUpdateUIEvent& event )
|
void WinEDA_SchematicFrame::OnUpdatePaste( wxUpdateUIEvent& event )
|
||||||
{
|
{
|
||||||
event.Enable( g_BlockSaveDataList.GetCount() > 0 );
|
event.Enable( g_BlockSaveDataList.GetCount() > 0 );
|
||||||
m_HToolBar->EnableTool( wxID_PASTE, g_BlockSaveDataList.GetCount() > 0 );
|
m_HToolBar->EnableTool( wxID_PASTE, g_BlockSaveDataList.GetCount() > 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WinEDA_SchematicFrame::OnUpdateSchematicUndo( wxUpdateUIEvent& event )
|
void WinEDA_SchematicFrame::OnUpdateSchematicUndo( wxUpdateUIEvent& event )
|
||||||
{
|
{
|
||||||
if ( GetScreen() )
|
if( GetScreen() )
|
||||||
event.Enable( GetScreen()->GetUndoCommandCount() > 0 );
|
event.Enable( GetScreen()->GetUndoCommandCount() > 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WinEDA_SchematicFrame::OnUpdateSchematicRedo( wxUpdateUIEvent& event )
|
void WinEDA_SchematicFrame::OnUpdateSchematicRedo( wxUpdateUIEvent& event )
|
||||||
{
|
{
|
||||||
if ( GetScreen() )
|
if( GetScreen() )
|
||||||
event.Enable( GetScreen()->GetRedoCommandCount() > 0 );
|
event.Enable( GetScreen()->GetRedoCommandCount() > 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WinEDA_SchematicFrame::OnUpdateBusOrientation( wxUpdateUIEvent& event )
|
void WinEDA_SchematicFrame::OnUpdateBusOrientation( wxUpdateUIEvent& event )
|
||||||
{
|
{
|
||||||
wxString tool_tip = g_HVLines ?
|
wxString tool_tip = g_HVLines ?
|
||||||
_( "Draw wires and busses in any direction" ) :
|
_( "Draw wires and busses in any direction" ) :
|
||||||
_( "Draw horizontal and vertical wires and busses only" );
|
_( "Draw horizontal and vertical wires and busses only" );
|
||||||
|
|
||||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_BUS_WIRES_ORIENT, g_HVLines );
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_BUS_WIRES_ORIENT, g_HVLines );
|
||||||
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_BUS_WIRES_ORIENT,
|
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_BUS_WIRES_ORIENT,
|
||||||
tool_tip );
|
tool_tip );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WinEDA_SchematicFrame::OnUpdateHiddenPins( wxUpdateUIEvent& event )
|
void WinEDA_SchematicFrame::OnUpdateHiddenPins( wxUpdateUIEvent& event )
|
||||||
{
|
{
|
||||||
wxString tool_tip = m_ShowAllPins ? _( "Do not show hidden pins" ) :
|
wxString tool_tip = m_ShowAllPins ? _( "Do not show hidden pins" ) :
|
||||||
_( "Show hidden pins" );
|
_( "Show hidden pins" );
|
||||||
|
|
||||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_HIDDEN_PINS, m_ShowAllPins );
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_HIDDEN_PINS, m_ShowAllPins );
|
||||||
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_HIDDEN_PINS, tool_tip );
|
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_HIDDEN_PINS, tool_tip );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WinEDA_SchematicFrame::OnUpdateSelectCursor( wxUpdateUIEvent& event )
|
void WinEDA_SchematicFrame::OnUpdateSelectCursor( wxUpdateUIEvent& event )
|
||||||
{
|
{
|
||||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR, m_CursorShape );
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR, m_CursorShape );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WinEDA_SchematicFrame::OnUpdateUnits( wxUpdateUIEvent& event )
|
void WinEDA_SchematicFrame::OnUpdateUnits( wxUpdateUIEvent& event )
|
||||||
{
|
{
|
||||||
bool is_metric = g_UnitMetric == MILLIMETRE ? true : false;
|
bool is_metric = g_UnitMetric == MILLIMETRE ? true : false;
|
||||||
|
|
||||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM, is_metric );
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM, is_metric );
|
||||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, !is_metric );
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, !is_metric );
|
||||||
DisplayUnitsMsg();
|
DisplayUnitsMsg();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WinEDA_SchematicFrame::OnUpdateGrid( wxUpdateUIEvent& event )
|
void WinEDA_SchematicFrame::OnUpdateGrid( wxUpdateUIEvent& event )
|
||||||
{
|
{
|
||||||
wxString tool_tip = m_Draw_Grid ? _( "Hide grid" ) : _( "Show grid" );
|
wxString tool_tip = m_Draw_Grid ? _( "Hide grid" ) : _( "Show grid" );
|
||||||
|
|
||||||
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID, m_Draw_Grid );
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID, m_Draw_Grid );
|
||||||
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID, tool_tip );
|
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID, tool_tip );
|
||||||
}
|
}
|
||||||
|
@ -521,8 +545,8 @@ void WinEDA_SchematicFrame::OnUpdateGrid( wxUpdateUIEvent& event )
|
||||||
|
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
void WinEDA_SchematicFrame::OnAnnotate( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::OnAnnotate( wxCommandEvent& event )
|
||||||
/**************************************************************/
|
|
||||||
{
|
{
|
||||||
|
/**************************************************************/
|
||||||
DIALOG_ANNOTATE* dlg = new DIALOG_ANNOTATE( this );
|
DIALOG_ANNOTATE* dlg = new DIALOG_ANNOTATE( this );
|
||||||
|
|
||||||
dlg->ShowModal();
|
dlg->ShowModal();
|
||||||
|
@ -532,8 +556,8 @@ void WinEDA_SchematicFrame::OnAnnotate( wxCommandEvent& event )
|
||||||
|
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
void WinEDA_SchematicFrame::OnErc( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::OnErc( wxCommandEvent& event )
|
||||||
/*********************************************************/
|
|
||||||
{
|
{
|
||||||
|
/*********************************************************/
|
||||||
DIALOG_ERC* dlg = new DIALOG_ERC( this );
|
DIALOG_ERC* dlg = new DIALOG_ERC( this );
|
||||||
|
|
||||||
dlg->ShowModal();
|
dlg->ShowModal();
|
||||||
|
@ -543,8 +567,8 @@ void WinEDA_SchematicFrame::OnErc( wxCommandEvent& event )
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
void WinEDA_SchematicFrame::OnCreateNetlist( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::OnCreateNetlist( wxCommandEvent& event )
|
||||||
/*******************************************************************/
|
|
||||||
{
|
{
|
||||||
|
/*******************************************************************/
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if( m_NetlistFormat < NET_TYPE_PCBNEW )
|
if( m_NetlistFormat < NET_TYPE_PCBNEW )
|
||||||
|
@ -563,8 +587,8 @@ void WinEDA_SchematicFrame::OnCreateNetlist( wxCommandEvent& event )
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
void WinEDA_SchematicFrame::OnCreateBillOfMaterials( wxCommandEvent& )
|
void WinEDA_SchematicFrame::OnCreateBillOfMaterials( wxCommandEvent& )
|
||||||
/**********************************************************************/
|
|
||||||
{
|
{
|
||||||
|
/**********************************************************************/
|
||||||
DIALOG_BUILD_BOM* dlg = new DIALOG_BUILD_BOM( this );
|
DIALOG_BUILD_BOM* dlg = new DIALOG_BUILD_BOM( this );
|
||||||
|
|
||||||
dlg->ShowModal();
|
dlg->ShowModal();
|
||||||
|
@ -574,8 +598,8 @@ void WinEDA_SchematicFrame::OnCreateBillOfMaterials( wxCommandEvent& )
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
void WinEDA_SchematicFrame::OnFindItems( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::OnFindItems( wxCommandEvent& event )
|
||||||
/*******************************************************************/
|
|
||||||
{
|
{
|
||||||
|
/*******************************************************************/
|
||||||
this->DrawPanel->m_IgnoreMouseEvents = TRUE;
|
this->DrawPanel->m_IgnoreMouseEvents = TRUE;
|
||||||
WinEDA_FindFrame* dlg = new WinEDA_FindFrame( this );
|
WinEDA_FindFrame* dlg = new WinEDA_FindFrame( this );
|
||||||
dlg->ShowModal();
|
dlg->ShowModal();
|
||||||
|
@ -586,8 +610,8 @@ void WinEDA_SchematicFrame::OnFindItems( wxCommandEvent& event )
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
void WinEDA_SchematicFrame::OnLoadFile( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::OnLoadFile( wxCommandEvent& event )
|
||||||
/***************************************************************/
|
|
||||||
{
|
{
|
||||||
|
/***************************************************************/
|
||||||
wxString fn;
|
wxString fn;
|
||||||
|
|
||||||
fn = GetFileFromHistory( event.GetId(), _( "Schematic" ) );
|
fn = GetFileFromHistory( event.GetId(), _( "Schematic" ) );
|
||||||
|
@ -602,8 +626,8 @@ void WinEDA_SchematicFrame::OnLoadFile( wxCommandEvent& event )
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
void WinEDA_SchematicFrame::OnLoadStuffFile( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::OnLoadStuffFile( wxCommandEvent& event )
|
||||||
/*******************************************************************/
|
|
||||||
{
|
{
|
||||||
|
/*******************************************************************/
|
||||||
ReadInputStuffFile();
|
ReadInputStuffFile();
|
||||||
DrawPanel->Refresh();
|
DrawPanel->Refresh();
|
||||||
}
|
}
|
||||||
|
@ -611,24 +635,24 @@ void WinEDA_SchematicFrame::OnLoadStuffFile( wxCommandEvent& event )
|
||||||
|
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
void WinEDA_SchematicFrame::OnNewProject( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::OnNewProject( wxCommandEvent& event )
|
||||||
/****************************************************************/
|
|
||||||
{
|
{
|
||||||
|
/****************************************************************/
|
||||||
LoadOneEEProject( wxEmptyString, true );
|
LoadOneEEProject( wxEmptyString, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
void WinEDA_SchematicFrame::OnLoadProject( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::OnLoadProject( wxCommandEvent& event )
|
||||||
/*****************************************************************/
|
|
||||||
{
|
{
|
||||||
|
/*****************************************************************/
|
||||||
LoadOneEEProject( wxEmptyString, false );
|
LoadOneEEProject( wxEmptyString, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
void WinEDA_SchematicFrame::OnOpenPcbnew( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::OnOpenPcbnew( wxCommandEvent& event )
|
||||||
/****************************************************************/
|
|
||||||
{
|
{
|
||||||
|
/****************************************************************/
|
||||||
wxFileName fn = g_RootSheet->m_AssociatedScreen->m_FileName;
|
wxFileName fn = g_RootSheet->m_AssociatedScreen->m_FileName;
|
||||||
|
|
||||||
if( fn.IsOk() )
|
if( fn.IsOk() )
|
||||||
|
@ -643,9 +667,10 @@ void WinEDA_SchematicFrame::OnOpenPcbnew( wxCommandEvent& event )
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
void WinEDA_SchematicFrame::OnOpenCvpcb( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::OnOpenCvpcb( wxCommandEvent& event )
|
||||||
/***************************************************************/
|
|
||||||
{
|
{
|
||||||
|
/***************************************************************/
|
||||||
wxFileName fn = g_RootSheet->m_AssociatedScreen->m_FileName;
|
wxFileName fn = g_RootSheet->m_AssociatedScreen->m_FileName;
|
||||||
|
|
||||||
fn.SetExt( NetlistFileExtension );
|
fn.SetExt( NetlistFileExtension );
|
||||||
|
|
||||||
if( fn.IsOk() && fn.FileExists() )
|
if( fn.IsOk() && fn.FileExists() )
|
||||||
|
@ -659,8 +684,8 @@ void WinEDA_SchematicFrame::OnOpenCvpcb( wxCommandEvent& event )
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
void WinEDA_SchematicFrame::OnOpenLibraryViewer( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::OnOpenLibraryViewer( wxCommandEvent& event )
|
||||||
/*************************************************************************/
|
|
||||||
{
|
{
|
||||||
|
/*************************************************************************/
|
||||||
if( m_ViewlibFrame )
|
if( m_ViewlibFrame )
|
||||||
{
|
{
|
||||||
m_ViewlibFrame->Show( TRUE );
|
m_ViewlibFrame->Show( TRUE );
|
||||||
|
@ -675,8 +700,8 @@ void WinEDA_SchematicFrame::OnOpenLibraryViewer( wxCommandEvent& event )
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
void WinEDA_SchematicFrame::OnOpenLibraryEditor( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::OnOpenLibraryEditor( wxCommandEvent& event )
|
||||||
/*************************************************************************/
|
|
||||||
{
|
{
|
||||||
|
/*************************************************************************/
|
||||||
if( m_LibeditFrame )
|
if( m_LibeditFrame )
|
||||||
{
|
{
|
||||||
m_LibeditFrame->Show( TRUE );
|
m_LibeditFrame->Show( TRUE );
|
||||||
|
|
|
@ -7,12 +7,12 @@
|
||||||
// Created: 08/02/2006 18:37:02
|
// Created: 08/02/2006 18:37:02
|
||||||
// RCS-ID:
|
// RCS-ID:
|
||||||
// Copyright: License GNU
|
// Copyright: License GNU
|
||||||
// Licence:
|
// License:
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// Generated by DialogBlocks (unregistered), 08/02/2006 18:37:02
|
// Generated by DialogBlocks (unregistered), 08/02/2006 18:37:02
|
||||||
|
|
||||||
#if defined (__GNUG__) && !defined (NO_GCC_PRAGMA)
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
||||||
#pragma implementation "sheet.h"
|
#pragma implementation "sheet.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -31,13 +31,12 @@
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
|
|
||||||
/* Routines Locales */
|
|
||||||
static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC );
|
static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC );
|
||||||
static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
||||||
|
|
||||||
/* Variables locales */
|
|
||||||
static int s_SheetMindx, s_SheetMindy;
|
static int s_SheetMindx, s_SheetMindy;
|
||||||
static wxPoint s_OldPos; /* Ancienne pos pour annulation ReSize ou move */
|
static wxPoint s_OldPos; /* Former position for cancellation or move ReSize */
|
||||||
|
|
||||||
|
|
||||||
#include "sheet.h"
|
#include "sheet.h"
|
||||||
|
@ -65,7 +64,6 @@ EVT_BUTTON( wxID_OK, WinEDA_SheetPropertiesFrame::OnOkClick )
|
||||||
////@end WinEDA_SheetPropertiesFrame event table entries
|
////@end WinEDA_SheetPropertiesFrame event table entries
|
||||||
|
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* WinEDA_SheetPropertiesFrame constructors
|
* WinEDA_SheetPropertiesFrame constructors
|
||||||
*/
|
*/
|
||||||
|
@ -75,13 +73,14 @@ WinEDA_SheetPropertiesFrame::WinEDA_SheetPropertiesFrame()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WinEDA_SheetPropertiesFrame::WinEDA_SheetPropertiesFrame( WinEDA_SchematicFrame* parent,
|
WinEDA_SheetPropertiesFrame::WinEDA_SheetPropertiesFrame(
|
||||||
DrawSheetStruct* currentsheet,
|
WinEDA_SchematicFrame* parent,
|
||||||
wxWindowID id,
|
SCH_SHEET* currentsheet,
|
||||||
const wxString& caption,
|
wxWindowID id,
|
||||||
const wxPoint& pos,
|
const wxString& caption,
|
||||||
const wxSize& size,
|
const wxPoint& pos,
|
||||||
long style )
|
const wxSize& size,
|
||||||
|
long style )
|
||||||
{
|
{
|
||||||
m_Parent = parent;
|
m_Parent = parent;
|
||||||
m_CurrentSheet = currentsheet;
|
m_CurrentSheet = currentsheet;
|
||||||
|
@ -101,8 +100,12 @@ WinEDA_SheetPropertiesFrame::WinEDA_SheetPropertiesFrame( WinEDA_SchematicFrame*
|
||||||
* WinEDA_SheetPropertiesFrame creator
|
* WinEDA_SheetPropertiesFrame creator
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool WinEDA_SheetPropertiesFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption,
|
bool WinEDA_SheetPropertiesFrame::Create( wxWindow* parent,
|
||||||
const wxPoint& pos, const wxSize& size, long style )
|
wxWindowID id,
|
||||||
|
const wxString& caption,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
|
long style )
|
||||||
{
|
{
|
||||||
////@begin WinEDA_SheetPropertiesFrame member initialisation
|
////@begin WinEDA_SheetPropertiesFrame member initialisation
|
||||||
m_FileNameWin = NULL;
|
m_FileNameWin = NULL;
|
||||||
|
@ -152,74 +155,103 @@ void WinEDA_SheetPropertiesFrame::CreateControls()
|
||||||
wxBoxSizer* itemBoxSizer4 = new wxBoxSizer( wxVERTICAL );
|
wxBoxSizer* itemBoxSizer4 = new wxBoxSizer( wxVERTICAL );
|
||||||
itemBoxSizer3->Add( itemBoxSizer4, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
itemBoxSizer3->Add( itemBoxSizer4, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
||||||
|
|
||||||
wxStaticText* itemStaticText5 = new wxStaticText( itemDialog1, wxID_STATIC, _(
|
wxStaticText* itemStaticText5 = new wxStaticText( itemDialog1,
|
||||||
"Filename:" ), wxDefaultPosition,
|
wxID_STATIC,
|
||||||
wxDefaultSize, 0 );
|
_( "Filename:" ),
|
||||||
|
wxDefaultPosition,
|
||||||
|
wxDefaultSize,
|
||||||
|
0 );
|
||||||
itemBoxSizer4->Add( itemStaticText5,
|
itemBoxSizer4->Add( itemStaticText5,
|
||||||
0,
|
0,
|
||||||
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
|
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP |
|
||||||
|
wxADJUST_MINSIZE,
|
||||||
5 );
|
5 );
|
||||||
|
|
||||||
m_FileNameWin =
|
m_FileNameWin =
|
||||||
new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T( "" ), wxDefaultPosition, wxSize( 300,
|
new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T( "" ), wxDefaultPosition,
|
||||||
-1 ),
|
wxSize( 300, - 1 ), wxTE_PROCESS_ENTER );
|
||||||
wxTE_PROCESS_ENTER );
|
itemBoxSizer4->Add( m_FileNameWin,
|
||||||
itemBoxSizer4->Add( m_FileNameWin, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
0,
|
||||||
|
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM,
|
||||||
|
5 );
|
||||||
|
|
||||||
wxStaticText* itemStaticText7 = new wxStaticText( itemDialog1, wxID_STATIC, _(
|
wxStaticText* itemStaticText7 = new wxStaticText( itemDialog1,
|
||||||
"Sheetname:" ), wxDefaultPosition,
|
wxID_STATIC,
|
||||||
wxDefaultSize, 0 );
|
_( "Sheetname:" ),
|
||||||
|
wxDefaultPosition,
|
||||||
|
wxDefaultSize,
|
||||||
|
0 );
|
||||||
itemBoxSizer4->Add( itemStaticText7,
|
itemBoxSizer4->Add( itemStaticText7,
|
||||||
0,
|
0,
|
||||||
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
|
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP |
|
||||||
|
wxADJUST_MINSIZE,
|
||||||
5 );
|
5 );
|
||||||
|
|
||||||
m_SheetNameWin =
|
m_SheetNameWin =
|
||||||
new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T( "" ), wxDefaultPosition, wxSize( 300,
|
new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T( "" ), wxDefaultPosition,
|
||||||
-1 ), 0 );
|
wxSize( 300, -1 ), 0 );
|
||||||
itemBoxSizer4->Add( m_SheetNameWin, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
itemBoxSizer4->Add( m_SheetNameWin,
|
||||||
|
0,
|
||||||
|
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM,
|
||||||
|
5 );
|
||||||
|
|
||||||
wxBoxSizer* itemBoxSizer9 = new wxBoxSizer( wxVERTICAL );
|
wxBoxSizer* itemBoxSizer9 = new wxBoxSizer( wxVERTICAL );
|
||||||
itemBoxSizer3->Add( itemBoxSizer9, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
itemBoxSizer3->Add( itemBoxSizer9, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
||||||
|
|
||||||
m_FileNameTextSize = new wxStaticText( itemDialog1, wxID_STATIC, _(
|
m_FileNameTextSize = new wxStaticText( itemDialog1, wxID_STATIC,
|
||||||
"Size" ), wxDefaultPosition, wxDefaultSize, 0 );
|
_( "Size" ), wxDefaultPosition,
|
||||||
|
wxDefaultSize, 0 );
|
||||||
itemBoxSizer9->Add( m_FileNameTextSize,
|
itemBoxSizer9->Add( m_FileNameTextSize,
|
||||||
0,
|
0,
|
||||||
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
|
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP |
|
||||||
|
wxADJUST_MINSIZE,
|
||||||
5 );
|
5 );
|
||||||
|
|
||||||
m_FileNameSize = new wxTextCtrl( itemDialog1, ID_TEXTCTRL2, _T(
|
m_FileNameSize = new wxTextCtrl( itemDialog1, ID_TEXTCTRL2, _T( "" ),
|
||||||
"" ), wxDefaultPosition, wxDefaultSize, 0 );
|
wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
itemBoxSizer9->Add( m_FileNameSize, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
itemBoxSizer9->Add( m_FileNameSize,
|
||||||
|
0,
|
||||||
|
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM,
|
||||||
|
5 );
|
||||||
|
|
||||||
m_SheetNameTextSize = new wxStaticText( itemDialog1, wxID_STATIC, _(
|
m_SheetNameTextSize = new wxStaticText( itemDialog1, wxID_STATIC,
|
||||||
"Size" ), wxDefaultPosition, wxDefaultSize, 0 );
|
_( "Size" ), wxDefaultPosition,
|
||||||
|
wxDefaultSize, 0 );
|
||||||
itemBoxSizer9->Add( m_SheetNameTextSize,
|
itemBoxSizer9->Add( m_SheetNameTextSize,
|
||||||
0,
|
0,
|
||||||
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
|
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP |
|
||||||
|
wxADJUST_MINSIZE,
|
||||||
5 );
|
5 );
|
||||||
|
|
||||||
m_SheetNameSize = new wxTextCtrl( itemDialog1, ID_TEXTCTRL3, _T(
|
m_SheetNameSize = new wxTextCtrl( itemDialog1, ID_TEXTCTRL3, _T( "" ),
|
||||||
"" ), wxDefaultPosition, wxDefaultSize, 0 );
|
wxDefaultPosition,
|
||||||
itemBoxSizer9->Add( m_SheetNameSize, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
wxDefaultSize, 0 );
|
||||||
|
itemBoxSizer9->Add( m_SheetNameSize,
|
||||||
|
0,
|
||||||
|
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM,
|
||||||
|
5 );
|
||||||
|
|
||||||
itemBoxSizer2->Add( 5, 5, 1, wxGROW | wxALL, 5 );
|
itemBoxSizer2->Add( 5, 5, 1, wxGROW | wxALL, 5 );
|
||||||
|
|
||||||
wxBoxSizer* itemBoxSizer15 = new wxBoxSizer( wxHORIZONTAL );
|
wxBoxSizer* itemBoxSizer15 = new wxBoxSizer( wxHORIZONTAL );
|
||||||
itemBoxSizer2->Add( itemBoxSizer15, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
|
itemBoxSizer2->Add( itemBoxSizer15,
|
||||||
|
0,
|
||||||
|
wxALIGN_CENTER_HORIZONTAL | wxALL,
|
||||||
|
5 );
|
||||||
|
|
||||||
m_btClose = new wxButton( itemDialog1, wxID_CANCEL, _(
|
m_btClose = new wxButton( itemDialog1, wxID_CANCEL, _( "&Cancel" ),
|
||||||
"&Cancel" ), wxDefaultPosition, wxDefaultSize, 0 );
|
wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
itemBoxSizer15->Add( m_btClose, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
itemBoxSizer15->Add( m_btClose, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
||||||
|
|
||||||
wxButton* itemButton17 = new wxButton( itemDialog1, wxID_OK, _(
|
wxButton* itemButton17 = new wxButton( itemDialog1, wxID_OK,
|
||||||
"&OK" ), wxDefaultPosition, wxDefaultSize, 0 );
|
_( "&OK" ), wxDefaultPosition,
|
||||||
|
wxDefaultSize, 0 );
|
||||||
itemButton17->SetDefault();
|
itemButton17->SetDefault();
|
||||||
itemBoxSizer15->Add( itemButton17, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
itemBoxSizer15->Add( itemButton17, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
||||||
|
|
||||||
// Set validators
|
// Set validators
|
||||||
m_SheetNameWin->SetValidator( wxTextValidator( wxFILTER_NONE, &m_CurrentSheet->m_SheetName ) );
|
m_SheetNameWin->SetValidator( wxTextValidator( wxFILTER_NONE,
|
||||||
|
&m_CurrentSheet->m_SheetName ) );
|
||||||
|
|
||||||
////@end WinEDA_SheetPropertiesFrame content construction
|
////@end WinEDA_SheetPropertiesFrame content construction
|
||||||
|
|
||||||
|
@ -268,14 +300,11 @@ wxIcon WinEDA_SheetPropertiesFrame::GetIconResource( const wxString& name )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
void WinEDA_SheetPropertiesFrame::SheetPropertiesAccept( wxCommandEvent& event )
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
/** Function SheetPropertiesAccept
|
/** Function SheetPropertiesAccept
|
||||||
* Set the new sheets properties:
|
* Set the new sheets properties:
|
||||||
* sheetname and filename (text and size)
|
* sheetname and filename (text and size)
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_SheetPropertiesFrame::SheetPropertiesAccept( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxFileName fn;
|
wxFileName fn;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
@ -291,23 +320,28 @@ void WinEDA_SheetPropertiesFrame::SheetPropertiesAccept( wxCommandEvent& event )
|
||||||
|
|
||||||
fn.SetExt( SchematicFileExtension );
|
fn.SetExt( SchematicFileExtension );
|
||||||
|
|
||||||
/* m_CurrentSheet->m_AssociatedScreen must be a valide screen, and the sheet must have a valid associated filename,
|
/* m_CurrentSheet->m_AssociatedScreen must be a valide screen, and the
|
||||||
|
* sheet must have a valid associated filename,
|
||||||
* so we must call m_CurrentSheet->ChangeFileName to set a filename,
|
* so we must call m_CurrentSheet->ChangeFileName to set a filename,
|
||||||
* AND always when a new sheet is created ( when m_CurrentSheet->m_AssociatedScreen is null ),
|
* AND always when a new sheet is created ( when
|
||||||
|
* m_CurrentSheet->m_AssociatedScreen is null ),
|
||||||
* to create or set an Associated Screen
|
* to create or set an Associated Screen
|
||||||
*/
|
*/
|
||||||
if( ( fn.GetFullPath() != m_CurrentSheet->GetFileName() )
|
if( ( fn.GetFullPath() != m_CurrentSheet->GetFileName() )
|
||||||
|| ( m_CurrentSheet->m_AssociatedScreen == NULL) )
|
|| ( m_CurrentSheet->m_AssociatedScreen == NULL) )
|
||||||
{
|
{
|
||||||
msg = _(
|
msg = _( "Changing a Filename can change all the schematic \
|
||||||
"Changing a Filename can change all the schematic \
|
structures and cannot be undone.\nOk to continue renaming?" );
|
||||||
structures and cannot be undone.\nOk to continue renaming?" );
|
|
||||||
|
|
||||||
if( m_CurrentSheet->m_AssociatedScreen == NULL || IsOK( NULL, msg ) )
|
if( m_CurrentSheet->m_AssociatedScreen == NULL || IsOK( NULL, msg ) )
|
||||||
{ //do not prompt on a new sheet. in fact, we should not allow a sheet to be created
|
{
|
||||||
//without a valid associated filename to be read from.
|
// do not prompt on a new sheet. in fact, we should not allow a
|
||||||
|
// sheet to be created without a valid associated filename to be
|
||||||
|
// read from.
|
||||||
m_Parent->GetScreen()->ClearUndoRedoList();
|
m_Parent->GetScreen()->ClearUndoRedoList();
|
||||||
m_CurrentSheet->ChangeFileName( m_Parent, fn.GetFullPath() ); // set filename and the associated screen
|
|
||||||
|
// set filename and the associated screen
|
||||||
|
m_CurrentSheet->ChangeFileName( m_Parent, fn.GetFullPath() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,7 +359,7 @@ structures and cannot be undone.\nOk to continue renaming?"
|
||||||
if( ( m_CurrentSheet->m_SheetName.IsEmpty() ) )
|
if( ( m_CurrentSheet->m_SheetName.IsEmpty() ) )
|
||||||
{
|
{
|
||||||
m_CurrentSheet->m_SheetName.Printf( wxT( "Sheet%8.8lX" ),
|
m_CurrentSheet->m_SheetName.Printf( wxT( "Sheet%8.8lX" ),
|
||||||
GetTimeStamp() );
|
GetTimeStamp() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -333,10 +367,8 @@ structures and cannot be undone.\nOk to continue renaming?"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
bool WinEDA_SchematicFrame::EditSheet( DrawSheetStruct* Sheet, wxDC* DC )
|
|
||||||
/*************************************************************************/
|
|
||||||
/* Routine to edit the SheetName and the FileName for the sheet "Sheet" */
|
/* Routine to edit the SheetName and the FileName for the sheet "Sheet" */
|
||||||
|
bool WinEDA_SchematicFrame::EditSheet( SCH_SHEET* Sheet, wxDC* DC )
|
||||||
{
|
{
|
||||||
WinEDA_SheetPropertiesFrame* frame;
|
WinEDA_SheetPropertiesFrame* frame;
|
||||||
bool edit = TRUE;
|
bool edit = TRUE;
|
||||||
|
@ -360,14 +392,13 @@ bool WinEDA_SchematicFrame::EditSheet( DrawSheetStruct* Sheet, wxDC* DC )
|
||||||
|
|
||||||
#define SHEET_MIN_WIDTH 500
|
#define SHEET_MIN_WIDTH 500
|
||||||
#define SHEET_MIN_HEIGHT 150
|
#define SHEET_MIN_HEIGHT 150
|
||||||
/****************************************************************/
|
|
||||||
DrawSheetStruct* WinEDA_SchematicFrame::CreateSheet( wxDC* DC )
|
/* Create hierarchy sheet. */
|
||||||
/****************************************************************/
|
SCH_SHEET* WinEDA_SchematicFrame::CreateSheet( wxDC* DC )
|
||||||
/* Routine de Creation d'une feuille de hierarchie (Sheet) */
|
|
||||||
{
|
{
|
||||||
g_ItemToRepeat = NULL;
|
g_ItemToRepeat = NULL;
|
||||||
|
|
||||||
DrawSheetStruct* Sheet = new DrawSheetStruct( GetScreen()->m_Curseur );
|
SCH_SHEET* Sheet = new SCH_SHEET( GetScreen()->m_Curseur );
|
||||||
|
|
||||||
Sheet->m_Flags = IS_NEW | IS_RESIZED;
|
Sheet->m_Flags = IS_NEW | IS_RESIZED;
|
||||||
Sheet->m_TimeStamp = GetTimeStamp();
|
Sheet->m_TimeStamp = GetTimeStamp();
|
||||||
|
@ -390,11 +421,9 @@ DrawSheetStruct* WinEDA_SchematicFrame::CreateSheet( wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************/
|
void WinEDA_SchematicFrame::ReSizeSheet( SCH_SHEET* Sheet, wxDC* DC )
|
||||||
void WinEDA_SchematicFrame::ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC )
|
|
||||||
/*******************************************************************************/
|
|
||||||
{
|
{
|
||||||
Hierarchical_PIN_Sheet_Struct* sheetlabel;
|
SCH_SHEET_PIN* sheetlabel;
|
||||||
|
|
||||||
if( Sheet == NULL )
|
if( Sheet == NULL )
|
||||||
return;
|
return;
|
||||||
|
@ -403,26 +432,25 @@ void WinEDA_SchematicFrame::ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC )
|
||||||
|
|
||||||
if( Sheet->Type() != DRAW_SHEET_STRUCT_TYPE )
|
if( Sheet->Type() != DRAW_SHEET_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
DisplayError( this, wxT( "WinEDA_SchematicFrame::ReSizeSheet: Bad SructType" ) );
|
DisplayError( this,
|
||||||
|
wxT( "WinEDA_SchematicFrame::ReSizeSheet: Bad SructType" ) );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
Sheet->m_Flags |= IS_RESIZED;
|
Sheet->m_Flags |= IS_RESIZED;
|
||||||
|
|
||||||
/* sauvegarde des anciennes valeurs */
|
|
||||||
s_OldPos.x = Sheet->m_Size.x;
|
s_OldPos.x = Sheet->m_Size.x;
|
||||||
s_OldPos.y = Sheet->m_Size.y;
|
s_OldPos.y = Sheet->m_Size.y;
|
||||||
|
|
||||||
/* Recalcul des dims min de la sheet */
|
|
||||||
s_SheetMindx = SHEET_MIN_WIDTH;
|
s_SheetMindx = SHEET_MIN_WIDTH;
|
||||||
s_SheetMindy = SHEET_MIN_HEIGHT;
|
s_SheetMindy = SHEET_MIN_HEIGHT;
|
||||||
sheetlabel = Sheet->m_Label;
|
sheetlabel = Sheet->m_Label;
|
||||||
while( sheetlabel )
|
while( sheetlabel )
|
||||||
{
|
{
|
||||||
s_SheetMindx = MAX( s_SheetMindx,
|
s_SheetMindx = MAX( s_SheetMindx,
|
||||||
(int) ( (sheetlabel->GetLength() +
|
(int) ( ( sheetlabel->GetLength() + 1 ) *
|
||||||
1) * sheetlabel->m_Size.x ) );
|
sheetlabel->m_Size.x ) );
|
||||||
s_SheetMindy = MAX( s_SheetMindy, sheetlabel->m_Pos.y - Sheet->m_Pos.y );
|
s_SheetMindy = MAX( s_SheetMindy, sheetlabel->m_Pos.y - Sheet->m_Pos.y );
|
||||||
sheetlabel = sheetlabel->Next();
|
sheetlabel = sheetlabel->Next();
|
||||||
}
|
}
|
||||||
|
@ -433,11 +461,9 @@ void WinEDA_SchematicFrame::ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************************/
|
void WinEDA_SchematicFrame::StartMoveSheet( SCH_SHEET* Sheet, wxDC* DC )
|
||||||
void WinEDA_SchematicFrame::StartMoveSheet( DrawSheetStruct* Sheet, wxDC* DC )
|
|
||||||
/*********************************************************************************/
|
|
||||||
{
|
{
|
||||||
if( (Sheet == NULL) || ( Sheet->Type() != DRAW_SHEET_STRUCT_TYPE) )
|
if( ( Sheet == NULL ) || ( Sheet->Type() != DRAW_SHEET_STRUCT_TYPE ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DrawPanel->CursorOff( DC );
|
DrawPanel->CursorOff( DC );
|
||||||
|
@ -454,27 +480,26 @@ void WinEDA_SchematicFrame::StartMoveSheet( DrawSheetStruct* Sheet, wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************/
|
/* Move selected sheet with the cursor.
|
||||||
/* Routine de deplacement (move) Sheet, lie au curseur.*/
|
* Callback function use by ManageCurseur.
|
||||||
/* Appele par GeneralControle grace a ManageCurseur. */
|
*/
|
||||||
/********************************************************/
|
|
||||||
static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||||
{
|
{
|
||||||
wxPoint move_vector;
|
wxPoint move_vector;
|
||||||
Hierarchical_PIN_Sheet_Struct* SheetLabel;
|
SCH_SHEET_PIN* SheetLabel;
|
||||||
BASE_SCREEN* screen = panel->GetScreen();
|
BASE_SCREEN* screen = panel->GetScreen();
|
||||||
|
|
||||||
DrawSheetStruct* Sheet = (DrawSheetStruct*)
|
SCH_SHEET* Sheet = (SCH_SHEET*) screen->GetCurItem();
|
||||||
screen->GetCurItem();
|
|
||||||
|
|
||||||
/* Effacement du composant: tj apres depl curseur */
|
|
||||||
if( erase )
|
if( erase )
|
||||||
RedrawOneStruct( panel, DC, Sheet, g_XorMode );
|
RedrawOneStruct( panel, DC, Sheet, g_XorMode );
|
||||||
|
|
||||||
if( Sheet->m_Flags & IS_RESIZED )
|
if( Sheet->m_Flags & IS_RESIZED )
|
||||||
{
|
{
|
||||||
Sheet->m_Size.x = MAX( s_SheetMindx, screen->m_Curseur.x - Sheet->m_Pos.x );
|
Sheet->m_Size.x =
|
||||||
Sheet->m_Size.y = MAX( s_SheetMindy, screen->m_Curseur.y - Sheet->m_Pos.y );
|
MAX( s_SheetMindx, screen->m_Curseur.x - Sheet->m_Pos.x );
|
||||||
|
Sheet->m_Size.y =
|
||||||
|
MAX( s_SheetMindy, screen->m_Curseur.y - Sheet->m_Pos.y );
|
||||||
SheetLabel = Sheet->m_Label;
|
SheetLabel = Sheet->m_Label;
|
||||||
while( SheetLabel )
|
while( SheetLabel )
|
||||||
{
|
{
|
||||||
|
@ -493,32 +518,30 @@ static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************/
|
/* Complete sheet move. */
|
||||||
/* Routine de sortie du Menu de Sheet */
|
|
||||||
/****************************************/
|
|
||||||
static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
|
static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||||
{
|
{
|
||||||
SCH_SCREEN* Screen = (SCH_SCREEN*) Panel->GetScreen();
|
SCH_SCREEN* Screen = (SCH_SCREEN*) Panel->GetScreen();
|
||||||
DrawSheetStruct* Sheet = (DrawSheetStruct*) Screen->GetCurItem();
|
SCH_SHEET* Sheet = (SCH_SHEET*) Screen->GetCurItem();
|
||||||
|
|
||||||
if( Sheet == NULL )
|
if( Sheet == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Deplacement composant en cours */
|
if( Sheet->m_Flags & IS_NEW )
|
||||||
if( Sheet->m_Flags & IS_NEW ) /* Nouveau Placement en cours, on l'efface */
|
|
||||||
{
|
{
|
||||||
RedrawOneStruct( Panel, DC, Sheet, g_XorMode );
|
RedrawOneStruct( Panel, DC, Sheet, g_XorMode );
|
||||||
SAFE_DELETE( Sheet );
|
SAFE_DELETE( Sheet );
|
||||||
}
|
}
|
||||||
else if( Sheet->m_Flags & IS_RESIZED ) /* resize en cours: on l'annule */
|
else if( Sheet->m_Flags & IS_RESIZED )
|
||||||
{
|
{
|
||||||
|
/* Resize in progress, cancel move. */
|
||||||
RedrawOneStruct( Panel, DC, Sheet, g_XorMode );
|
RedrawOneStruct( Panel, DC, Sheet, g_XorMode );
|
||||||
Sheet->m_Size.x = s_OldPos.x;
|
Sheet->m_Size.x = s_OldPos.x;
|
||||||
Sheet->m_Size.y = s_OldPos.y;
|
Sheet->m_Size.y = s_OldPos.y;
|
||||||
RedrawOneStruct( Panel, DC, Sheet, GR_DEFAULT_DRAWMODE );
|
RedrawOneStruct( Panel, DC, Sheet, GR_DEFAULT_DRAWMODE );
|
||||||
Sheet->m_Flags = 0;
|
Sheet->m_Flags = 0;
|
||||||
}
|
}
|
||||||
else if( Sheet->m_Flags & IS_MOVED ) /* move en cours: on l'annule */
|
else if( Sheet->m_Flags & IS_MOVED )
|
||||||
{
|
{
|
||||||
wxPoint curspos = Screen->m_Curseur;
|
wxPoint curspos = Screen->m_Curseur;
|
||||||
Panel->GetScreen()->m_Curseur = s_OldPos;
|
Panel->GetScreen()->m_Curseur = s_OldPos;
|
||||||
|
|
|
@ -71,7 +71,7 @@ public:
|
||||||
/// Constructors
|
/// Constructors
|
||||||
WinEDA_SheetPropertiesFrame( );
|
WinEDA_SheetPropertiesFrame( );
|
||||||
WinEDA_SheetPropertiesFrame( WinEDA_SchematicFrame* parent,
|
WinEDA_SheetPropertiesFrame( WinEDA_SchematicFrame* parent,
|
||||||
DrawSheetStruct * currentsheet,
|
SCH_SHEET * currentsheet,
|
||||||
wxWindowID id = SYMBOL_WINEDA_SHEETPROPERTIESFRAME_IDNAME,
|
wxWindowID id = SYMBOL_WINEDA_SHEETPROPERTIESFRAME_IDNAME,
|
||||||
const wxString& caption = SYMBOL_WINEDA_SHEETPROPERTIESFRAME_TITLE,
|
const wxString& caption = SYMBOL_WINEDA_SHEETPROPERTIESFRAME_TITLE,
|
||||||
const wxPoint& pos = SYMBOL_WINEDA_SHEETPROPERTIESFRAME_POSITION,
|
const wxPoint& pos = SYMBOL_WINEDA_SHEETPROPERTIESFRAME_POSITION,
|
||||||
|
@ -118,7 +118,7 @@ public:
|
||||||
////@end WinEDA_SheetPropertiesFrame member variables
|
////@end WinEDA_SheetPropertiesFrame member variables
|
||||||
|
|
||||||
WinEDA_SchematicFrame * m_Parent;
|
WinEDA_SchematicFrame * m_Parent;
|
||||||
DrawSheetStruct* m_CurrentSheet;
|
SCH_SHEET* m_CurrentSheet;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**************************************************************************/
|
/**********************************************************/
|
||||||
/* sheetlab.cpp create and edit the Hierarchical_PIN_Sheet_Struct items */
|
/* sheetlab.cpp create and edit the SCH_SHEET_PIN items */
|
||||||
/**************************************************************************/
|
/**********************************************************/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "gr_basic.h"
|
#include "gr_basic.h"
|
||||||
|
@ -13,12 +13,11 @@
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
|
|
||||||
/* Routines Locales */
|
|
||||||
static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC );
|
static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC );
|
||||||
static void Move_PinSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
static void Move_PinSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
||||||
|
|
||||||
/* Variables locales */
|
|
||||||
static int CurrentTypeLabel = NET_INPUT;
|
static int CurrentTypeLabel = NET_INPUT;
|
||||||
static wxSize NetSheetTextSize( DEFAULT_SIZE_TEXT, DEFAULT_SIZE_TEXT );
|
static wxSize NetSheetTextSize( DEFAULT_SIZE_TEXT, DEFAULT_SIZE_TEXT );
|
||||||
|
|
||||||
/****************************************/
|
/****************************************/
|
||||||
|
@ -26,30 +25,25 @@ static wxSize NetSheetTextSize( DEFAULT_SIZE_TEXT, DEFAULT_SIZE_TEXT );
|
||||||
/****************************************/
|
/****************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************/
|
|
||||||
class WinEDA_PinSheetPropertiesFrame : public wxDialog
|
class WinEDA_PinSheetPropertiesFrame : public wxDialog
|
||||||
/*****************************************************/
|
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
WinEDA_SchematicFrame* m_Parent;
|
WinEDA_SchematicFrame* m_Parent;
|
||||||
Hierarchical_PIN_Sheet_Struct* m_CurrentPinSheet;
|
SCH_SHEET_PIN* m_CurrentPinSheet;
|
||||||
wxRadioBox* m_PinSheetType;
|
wxRadioBox* m_PinSheetType;
|
||||||
wxRadioBox* m_PinSheetShape;
|
wxRadioBox* m_PinSheetShape;
|
||||||
WinEDA_GraphicTextCtrl* m_TextWin;
|
WinEDA_GraphicTextCtrl* m_TextWin;
|
||||||
|
|
||||||
public:
|
public: WinEDA_PinSheetPropertiesFrame( WinEDA_SchematicFrame* parent,
|
||||||
|
SCH_SHEET_PIN* curr_pinsheet,
|
||||||
// Constructor and destructor
|
const wxPoint& framepos =
|
||||||
WinEDA_PinSheetPropertiesFrame( WinEDA_SchematicFrame* parent,
|
wxPoint( -1, -1 ) );
|
||||||
Hierarchical_PIN_Sheet_Struct* curr_pinsheet,
|
|
||||||
const wxPoint& framepos = wxPoint( -1, -1 ) );
|
|
||||||
~WinEDA_PinSheetPropertiesFrame() { };
|
~WinEDA_PinSheetPropertiesFrame() { };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnOkClick( wxCommandEvent& event );
|
void OnOkClick( wxCommandEvent& event );
|
||||||
void OnCancelClick( wxCommandEvent& event );
|
void OnCancelClick( wxCommandEvent& event );
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
@ -60,14 +54,12 @@ BEGIN_EVENT_TABLE( WinEDA_PinSheetPropertiesFrame, wxDialog )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************************/
|
WinEDA_PinSheetPropertiesFrame::WinEDA_PinSheetPropertiesFrame(
|
||||||
WinEDA_PinSheetPropertiesFrame::WinEDA_PinSheetPropertiesFrame(
|
WinEDA_SchematicFrame* parent,
|
||||||
WinEDA_SchematicFrame* parent,
|
SCH_SHEET_PIN* curr_pinsheet,
|
||||||
Hierarchical_PIN_Sheet_Struct* curr_pinsheet,
|
const wxPoint& framepos ) :
|
||||||
const wxPoint& framepos ) :
|
wxDialog( parent, -1, _( "PinSheet Properties:" ), framepos,
|
||||||
wxDialog( parent, -1, _( "PinSheet Properties:" ), framepos,
|
wxSize( 340, 220 ), DIALOG_STYLE )
|
||||||
wxSize( 340, 220 ), DIALOG_STYLE )
|
|
||||||
/**********************************************************************************/
|
|
||||||
{
|
{
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
wxString number;
|
wxString number;
|
||||||
|
@ -101,7 +93,8 @@ WinEDA_PinSheetPropertiesFrame::WinEDA_PinSheetPropertiesFrame(
|
||||||
#define NBSHAPES 5
|
#define NBSHAPES 5
|
||||||
wxString shape_list[NBSHAPES] =
|
wxString shape_list[NBSHAPES] =
|
||||||
{
|
{
|
||||||
_( "Input" ), _( "Output" ), _( "Bidi" ), _( "TriState" ), _( "Passive" )
|
_( "Input" ), _( "Output" ), _( "Bidi" ), _( "TriState" ),
|
||||||
|
_( "Passive" )
|
||||||
};
|
};
|
||||||
m_PinSheetShape = new wxRadioBox( this, -1, _( "PinSheet Shape:" ),
|
m_PinSheetShape = new wxRadioBox( this, -1, _( "PinSheet Shape:" ),
|
||||||
wxDefaultPosition, wxSize( -1, -1 ),
|
wxDefaultPosition, wxSize( -1, -1 ),
|
||||||
|
@ -114,38 +107,34 @@ WinEDA_PinSheetPropertiesFrame::WinEDA_PinSheetPropertiesFrame(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
void WinEDA_PinSheetPropertiesFrame::OnCancelClick( wxCommandEvent& WXUNUSED(
|
||||||
void WinEDA_PinSheetPropertiesFrame::OnCancelClick( wxCommandEvent& WXUNUSED (event) )
|
event ) )
|
||||||
/************************************************************************/
|
|
||||||
{
|
{
|
||||||
EndModal( -1 );
|
EndModal( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************************/
|
|
||||||
void WinEDA_PinSheetPropertiesFrame::OnOkClick( wxCommandEvent& event )
|
void WinEDA_PinSheetPropertiesFrame::OnOkClick( wxCommandEvent& event )
|
||||||
/***********************************************************************************/
|
|
||||||
{
|
{
|
||||||
m_CurrentPinSheet->m_Text = m_TextWin->GetText();
|
m_CurrentPinSheet->m_Text = m_TextWin->GetText();
|
||||||
m_CurrentPinSheet->m_Size.x = m_CurrentPinSheet->m_Size.y = m_TextWin->GetTextSize();
|
m_CurrentPinSheet->m_Size.x = m_CurrentPinSheet->m_Size.y =
|
||||||
|
m_TextWin->GetTextSize();
|
||||||
|
|
||||||
m_CurrentPinSheet->m_Shape = m_PinSheetShape->GetSelection();
|
m_CurrentPinSheet->m_Shape = m_PinSheetShape->GetSelection();
|
||||||
EndModal( 0 );
|
EndModal( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
|
||||||
static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
|
static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||||
/*****************************************************************/
|
|
||||||
{
|
{
|
||||||
Hierarchical_PIN_Sheet_Struct* SheetLabel = (Hierarchical_PIN_Sheet_Struct*)
|
SCH_SHEET_PIN* SheetLabel =
|
||||||
Panel->GetScreen()->GetCurItem();
|
(SCH_SHEET_PIN*) Panel->GetScreen()->GetCurItem();
|
||||||
|
|
||||||
if( SheetLabel == NULL )
|
if( SheetLabel == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( SheetLabel->m_Flags & IS_NEW )
|
if( SheetLabel->m_Flags & IS_NEW )
|
||||||
{ /* Nouveau Placement en cours, on l'efface */
|
{
|
||||||
RedrawOneStruct( Panel, DC, SheetLabel, g_XorMode );
|
RedrawOneStruct( Panel, DC, SheetLabel, g_XorMode );
|
||||||
SAFE_DELETE( SheetLabel );
|
SAFE_DELETE( SheetLabel );
|
||||||
}
|
}
|
||||||
|
@ -161,21 +150,17 @@ static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Cette routine place un nouveau NetSheet ou place un ancien en cours
|
void SCH_SHEET_PIN::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
|
||||||
* de deplacement
|
|
||||||
* Si le NetSheet est nouveau, il est pointe par NewSheetLabel
|
|
||||||
*/
|
|
||||||
void Hierarchical_PIN_Sheet_Struct::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
|
|
||||||
{
|
{
|
||||||
DrawSheetStruct* Sheet = (DrawSheetStruct*) GetParent();
|
SCH_SHEET* Sheet = (SCH_SHEET*) GetParent();
|
||||||
|
|
||||||
if( m_Flags & IS_NEW ) /* ajout a la liste des structures */
|
if( m_Flags & IS_NEW )
|
||||||
{
|
{
|
||||||
if( Sheet->m_Label == NULL )
|
if( Sheet->m_Label == NULL )
|
||||||
Sheet->m_Label = this;
|
Sheet->m_Label = this;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Hierarchical_PIN_Sheet_Struct* pinsheet = Sheet->m_Label;
|
SCH_SHEET_PIN* pinsheet = Sheet->m_Label;
|
||||||
while( pinsheet )
|
while( pinsheet )
|
||||||
{
|
{
|
||||||
if( pinsheet->Next() == NULL )
|
if( pinsheet->Next() == NULL )
|
||||||
|
@ -191,7 +176,9 @@ void Hierarchical_PIN_Sheet_Struct::Place( WinEDA_SchematicFrame* frame, wxDC* D
|
||||||
m_Flags = 0;
|
m_Flags = 0;
|
||||||
m_Pos.x = Sheet->m_Pos.x;
|
m_Pos.x = Sheet->m_Pos.x;
|
||||||
m_Edge = 0;
|
m_Edge = 0;
|
||||||
if( frame->GetScreen()->m_Curseur.x > ( Sheet->m_Pos.x + (Sheet->m_Size.x / 2) ) )
|
|
||||||
|
if( frame->GetScreen()->m_Curseur.x
|
||||||
|
> ( Sheet->m_Pos.x + (Sheet->m_Size.x / 2) ) )
|
||||||
{
|
{
|
||||||
m_Edge = 1;
|
m_Edge = 1;
|
||||||
m_Pos.x = Sheet->m_Pos.x + Sheet->m_Size.x;
|
m_Pos.x = Sheet->m_Pos.x + Sheet->m_Size.x;
|
||||||
|
@ -210,11 +197,8 @@ void Hierarchical_PIN_Sheet_Struct::Place( WinEDA_SchematicFrame* frame, wxDC* D
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************/
|
void WinEDA_SchematicFrame::StartMove_PinSheet( SCH_SHEET_PIN* SheetLabel,
|
||||||
void WinEDA_SchematicFrame::StartMove_PinSheet( Hierarchical_PIN_Sheet_Struct* SheetLabel,
|
wxDC* DC )
|
||||||
wxDC* DC )
|
|
||||||
/*******************************************************************************/
|
|
||||||
/* Initialise un deplacement de NetSheet */
|
|
||||||
{
|
{
|
||||||
NetSheetTextSize = SheetLabel->m_Size;
|
NetSheetTextSize = SheetLabel->m_Size;
|
||||||
CurrentTypeLabel = SheetLabel->m_Shape;
|
CurrentTypeLabel = SheetLabel->m_Shape;
|
||||||
|
@ -226,19 +210,15 @@ void WinEDA_SchematicFrame::StartMove_PinSheet( Hierarchical_PIN_Sheet_Struct* S
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************/
|
|
||||||
/* Routine de deplacement du NetSheet actif selon la position souris */
|
|
||||||
/**********************************************************************/
|
|
||||||
|
|
||||||
static void Move_PinSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
static void Move_PinSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||||
{
|
{
|
||||||
Hierarchical_PIN_Sheet_Struct* SheetLabel = (Hierarchical_PIN_Sheet_Struct*)
|
SCH_SHEET_PIN* SheetLabel =
|
||||||
panel->GetScreen()->GetCurItem();
|
(SCH_SHEET_PIN*) panel->GetScreen()->GetCurItem();
|
||||||
|
|
||||||
if( SheetLabel == NULL )
|
if( SheetLabel == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DrawSheetStruct* Sheet = (DrawSheetStruct*) SheetLabel->GetParent();
|
SCH_SHEET* Sheet = (SCH_SHEET*) SheetLabel->GetParent();
|
||||||
|
|
||||||
if( Sheet == NULL )
|
if( Sheet == NULL )
|
||||||
return;
|
return;
|
||||||
|
@ -247,7 +227,9 @@ static void Move_PinSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||||
|
|
||||||
SheetLabel->m_Edge = 0;
|
SheetLabel->m_Edge = 0;
|
||||||
SheetLabel->m_Pos.x = Sheet->m_Pos.x;
|
SheetLabel->m_Pos.x = Sheet->m_Pos.x;
|
||||||
if( panel->GetScreen()->m_Curseur.x > ( Sheet->m_Pos.x + (Sheet->m_Size.x / 2) ) )
|
|
||||||
|
if( panel->GetScreen()->m_Curseur.x
|
||||||
|
> ( Sheet->m_Pos.x + (Sheet->m_Size.x / 2) ) )
|
||||||
{
|
{
|
||||||
SheetLabel->m_Edge = 1;
|
SheetLabel->m_Edge = 1;
|
||||||
SheetLabel->m_Pos.x = Sheet->m_Pos.x + Sheet->m_Size.x;
|
SheetLabel->m_Pos.x = Sheet->m_Pos.x + Sheet->m_Size.x;
|
||||||
|
@ -263,11 +245,8 @@ static void Move_PinSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
void WinEDA_SchematicFrame::Edit_PinSheet( SCH_SHEET_PIN* SheetLabel,
|
||||||
void WinEDA_SchematicFrame::Edit_PinSheet( Hierarchical_PIN_Sheet_Struct* SheetLabel,
|
wxDC* DC )
|
||||||
wxDC* DC )
|
|
||||||
/***************************************************************************/
|
|
||||||
/* Modification du texte d'un net sheet */
|
|
||||||
{
|
{
|
||||||
if( SheetLabel == NULL )
|
if( SheetLabel == NULL )
|
||||||
return;
|
return;
|
||||||
|
@ -283,17 +262,13 @@ void WinEDA_SchematicFrame::Edit_PinSheet( Hierarchical_PIN_Sheet_Struct* SheetL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************/
|
/* Add a new sheet pin to the sheet at the current cursor position.
|
||||||
Hierarchical_PIN_Sheet_Struct* WinEDA_SchematicFrame::Create_PinSheet(
|
|
||||||
DrawSheetStruct* Sheet, wxDC* DC )
|
|
||||||
/**************************************************************/
|
|
||||||
|
|
||||||
/* Addition d'un nouveau PinSheet sur la feuille selectionnee, a l'endroit
|
|
||||||
* pointe par la souris
|
|
||||||
*/
|
*/
|
||||||
|
SCH_SHEET_PIN* WinEDA_SchematicFrame::Create_PinSheet( SCH_SHEET* Sheet,
|
||||||
|
wxDC* DC )
|
||||||
{
|
{
|
||||||
wxString Line, Text;
|
wxString Line, Text;
|
||||||
Hierarchical_PIN_Sheet_Struct* NewSheetLabel;
|
SCH_SHEET_PIN* NewSheetLabel;
|
||||||
|
|
||||||
switch( CurrentTypeLabel )
|
switch( CurrentTypeLabel )
|
||||||
{
|
{
|
||||||
|
@ -321,14 +296,13 @@ Hierarchical_PIN_Sheet_Struct* WinEDA_SchematicFrame::Create_PinSheet(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Get_Message( Text, _("PinSheet"), Line, this );
|
Get_Message( Text, _( "PinSheet" ), Line, this );
|
||||||
if( Line.IsEmpty() )
|
if( Line.IsEmpty() )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
|
|
||||||
/* Creation en memoire */
|
NewSheetLabel = new SCH_SHEET_PIN( Sheet, wxPoint( 0, 0 ), Line );
|
||||||
NewSheetLabel = new Hierarchical_PIN_Sheet_Struct( Sheet, wxPoint( 0, 0 ), Line );
|
|
||||||
NewSheetLabel->m_Flags = IS_NEW;
|
NewSheetLabel->m_Flags = IS_NEW;
|
||||||
NewSheetLabel->m_Size = NetSheetTextSize;
|
NewSheetLabel->m_Size = NetSheetTextSize;
|
||||||
NewSheetLabel->m_Shape = CurrentTypeLabel;
|
NewSheetLabel->m_Shape = CurrentTypeLabel;
|
||||||
|
@ -343,28 +317,28 @@ Hierarchical_PIN_Sheet_Struct* WinEDA_SchematicFrame::Create_PinSheet(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/* Automatically create a sheet labels from global labels for each node in
|
||||||
Hierarchical_PIN_Sheet_Struct* WinEDA_SchematicFrame::Import_PinSheet( DrawSheetStruct* Sheet, wxDC* DC )
|
* the corresponding hierarchy.
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
/* Permet de creer automatiquement les Sheet Labels a partir des Labels Globaux
|
|
||||||
* de la feuille de sous hierarchie correspondante
|
|
||||||
*/
|
*/
|
||||||
|
SCH_SHEET_PIN* WinEDA_SchematicFrame::Import_PinSheet( SCH_SHEET* Sheet,
|
||||||
|
wxDC* DC )
|
||||||
{
|
{
|
||||||
EDA_BaseStruct* DrawStruct;
|
EDA_BaseStruct* DrawStruct;
|
||||||
Hierarchical_PIN_Sheet_Struct* NewSheetLabel, * SheetLabel = NULL;
|
SCH_SHEET_PIN* NewSheetLabel, * SheetLabel = NULL;
|
||||||
SCH_HIERLABEL* HLabel = NULL;
|
SCH_HIERLABEL* HLabel = NULL;
|
||||||
|
|
||||||
if(!Sheet->m_AssociatedScreen) return NULL;
|
if( !Sheet->m_AssociatedScreen )
|
||||||
|
return NULL;
|
||||||
DrawStruct = Sheet->m_AssociatedScreen->EEDrawList;
|
DrawStruct = Sheet->m_AssociatedScreen->EEDrawList;
|
||||||
HLabel = NULL;
|
HLabel = NULL;
|
||||||
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
|
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
|
||||||
{
|
{
|
||||||
if( DrawStruct->Type() != TYPE_SCH_HIERLABEL )
|
if( DrawStruct->Type() != TYPE_SCH_HIERLABEL )
|
||||||
continue;
|
continue;
|
||||||
HLabel = (SCH_HIERLABEL*) DrawStruct;
|
HLabel = (SCH_HIERLABEL*) DrawStruct;
|
||||||
|
|
||||||
/* Ici un G-Label a ete trouve: y a t-il un SheetLabel correspondant */
|
/* A global label has been found: check is there a corresponding
|
||||||
|
* sheet label. */
|
||||||
SheetLabel = Sheet->m_Label;
|
SheetLabel = Sheet->m_Label;
|
||||||
for( ; SheetLabel != NULL; SheetLabel = SheetLabel->Next() )
|
for( ; SheetLabel != NULL; SheetLabel = SheetLabel->Next() )
|
||||||
{
|
{
|
||||||
|
@ -374,22 +348,19 @@ Hierarchical_PIN_Sheet_Struct* WinEDA_SchematicFrame::Import_PinSheet( DrawSheet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ici si SheetLabel == NULL le G-Label n'a pas de SheetLabel corresp */
|
|
||||||
if( SheetLabel == NULL )
|
if( SheetLabel == NULL )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( (HLabel == NULL ) || SheetLabel )
|
if( (HLabel == NULL ) || SheetLabel )
|
||||||
{
|
{
|
||||||
DisplayError( this, _( "No New Hierarchal Label found" ), 10 );
|
DisplayError( this, _( "No new hierarchical labels found" ), 10 );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ici H-Label n'a pas de SheetLabel corresp, on va le creer */
|
|
||||||
|
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
/* Creation en memoire */
|
|
||||||
NewSheetLabel = new Hierarchical_PIN_Sheet_Struct( Sheet, wxPoint( 0, 0 ), HLabel->m_Text );
|
NewSheetLabel = new SCH_SHEET_PIN( Sheet, wxPoint( 0, 0 ), HLabel->m_Text );
|
||||||
NewSheetLabel->m_Flags = IS_NEW;
|
NewSheetLabel->m_Flags = IS_NEW;
|
||||||
NewSheetLabel->m_Size = NetSheetTextSize;
|
NewSheetLabel->m_Size = NetSheetTextSize;
|
||||||
CurrentTypeLabel = NewSheetLabel->m_Shape = HLabel->m_Shape;
|
CurrentTypeLabel = NewSheetLabel->m_Shape = HLabel->m_Shape;
|
||||||
|
@ -403,19 +374,16 @@ Hierarchical_PIN_Sheet_Struct* WinEDA_SchematicFrame::Import_PinSheet( DrawSheet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************/
|
|
||||||
void WinEDA_SchematicFrame::DeleteSheetLabel( bool aRedraw,
|
|
||||||
Hierarchical_PIN_Sheet_Struct* aSheetLabelToDel )
|
|
||||||
/**************************************************************/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Routine de suppression de 1 Structure type (Hierarchical_PIN_Sheet_Struct.
|
* Remove sheet label.
|
||||||
* Cette Structure ne peut etre mise en pile "undelete" car il ne serait pas
|
*
|
||||||
* possible de la rattacher a la 'DrawSheetStruct' d'origine
|
* This sheet label can not be put in a pile "undelete" because it would not
|
||||||
* si aRedraw == true, effacement a l'ecran du dessin
|
* Possible to link it back it's 'SCH_SHEET' parent.
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_SchematicFrame::DeleteSheetLabel( bool aRedraw,
|
||||||
|
SCH_SHEET_PIN* aSheetLabelToDel )
|
||||||
{
|
{
|
||||||
DrawSheetStruct* parent = (DrawSheetStruct*) aSheetLabelToDel->GetParent();
|
SCH_SHEET* parent = (SCH_SHEET*) aSheetLabelToDel->GetParent();
|
||||||
|
|
||||||
wxASSERT( parent );
|
wxASSERT( parent );
|
||||||
wxASSERT( parent->Type() == DRAW_SHEET_STRUCT_TYPE );
|
wxASSERT( parent->Type() == DRAW_SHEET_STRUCT_TYPE );
|
||||||
|
@ -426,10 +394,10 @@ void WinEDA_SchematicFrame::DeleteSheetLabel( bool aRedraw,
|
||||||
std::cout << "\n\n\n" << std::flush;
|
std::cout << "\n\n\n" << std::flush;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Hierarchical_PIN_Sheet_Struct* prev = NULL;
|
SCH_SHEET_PIN* prev = NULL;
|
||||||
|
SCH_SHEET_PIN* label = parent->m_Label;
|
||||||
|
|
||||||
Hierarchical_PIN_Sheet_Struct* label = parent->m_Label;
|
for( ; label; prev = label, label = label->Next() )
|
||||||
for( ; label; prev=label, label=label->Next() )
|
|
||||||
{
|
{
|
||||||
if( label == aSheetLabelToDel )
|
if( label == aSheetLabelToDel )
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,14 +21,13 @@
|
||||||
#include "dialog_lib_edit_draw_item.h"
|
#include "dialog_lib_edit_draw_item.h"
|
||||||
|
|
||||||
|
|
||||||
/* Routines locales */
|
|
||||||
static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
|
||||||
static void ComputeArc( LIB_ARC* DrawItem, wxPoint ArcCentre );
|
static void ComputeArc( LIB_ARC* DrawItem, wxPoint ArcCentre );
|
||||||
static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel,
|
static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel,
|
||||||
wxDC* DC,
|
wxDC* DC,
|
||||||
bool erase );
|
bool erase );
|
||||||
|
|
||||||
/* Variables locales */
|
|
||||||
static int StateDrawArc, ArcStartX, ArcStartY, ArcEndX, ArcEndY;
|
static int StateDrawArc, ArcStartX, ArcStartY, ArcEndX, ArcEndY;
|
||||||
static wxPoint InitPosition, StartCursor, ItemPreviousPos;
|
static wxPoint InitPosition, StartCursor, ItemPreviousPos;
|
||||||
|
|
||||||
|
@ -264,8 +263,7 @@ error" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/* Create new library component graphic object.
|
||||||
* Routine de creation d'un nouvel element type LibraryDrawStruct
|
|
||||||
*/
|
*/
|
||||||
void WinEDA_LibeditFrame::GraphicItemBeginDraw( wxDC* DC )
|
void WinEDA_LibeditFrame::GraphicItemBeginDraw( wxDC* DC )
|
||||||
{
|
{
|
||||||
|
@ -313,7 +311,7 @@ void WinEDA_LibeditFrame::GraphicItemBeginDraw( wxDC* DC )
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Redraw the graphoc shape while moving
|
* Redraw the graphic shape while moving
|
||||||
*/
|
*/
|
||||||
static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel,
|
static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel,
|
||||||
wxDC* DC,
|
wxDC* DC,
|
||||||
|
@ -329,7 +327,7 @@ static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel,
|
||||||
BASE_SCREEN* Screen = panel->GetScreen();
|
BASE_SCREEN* Screen = panel->GetScreen();
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
|
|
||||||
/* Erase shape in the old positon*/
|
/* Erase shape in the old position*/
|
||||||
if( erase )
|
if( erase )
|
||||||
{
|
{
|
||||||
pos = ItemPreviousPos - StartCursor;
|
pos = ItemPreviousPos - StartCursor;
|
||||||
|
@ -361,10 +359,7 @@ void WinEDA_LibeditFrame::StartMoveDrawSymbol( wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************/
|
/* Manage mouse events when creating new graphic object. */
|
||||||
/* Routine de Gestion des evenements souris lors de la creation */
|
|
||||||
/* d'un nouvel element type LibraryDrawStruct */
|
|
||||||
/****************************************************************/
|
|
||||||
static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||||
{
|
{
|
||||||
int dx, dy;
|
int dx, dy;
|
||||||
|
@ -453,7 +448,7 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||||
( (LIB_SEGMENT*) item )->m_End = curr_pos;
|
( (LIB_SEGMENT*) item )->m_End = curr_pos;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: /* Traite par des routines specifiques */
|
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -488,11 +483,7 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Place la structure courante en liste des structures du composant
|
* Place the new graphic object in the list of component drawing objects.
|
||||||
* courant, si elle existe et redessine toujours celle ci
|
|
||||||
* Parametres: (tous globaux)
|
|
||||||
* m_drawItem
|
|
||||||
* m_component
|
|
||||||
*/
|
*/
|
||||||
void WinEDA_LibeditFrame::EndDrawGraphicItem( wxDC* DC )
|
void WinEDA_LibeditFrame::EndDrawGraphicItem( wxDC* DC )
|
||||||
{
|
{
|
||||||
|
@ -501,7 +492,7 @@ void WinEDA_LibeditFrame::EndDrawGraphicItem( wxDC* DC )
|
||||||
|
|
||||||
if( m_drawItem->Type() == COMPONENT_ARC_DRAW_TYPE )
|
if( m_drawItem->Type() == COMPONENT_ARC_DRAW_TYPE )
|
||||||
{
|
{
|
||||||
if( StateDrawArc == 1 ) /* Trace d'arc en cours: doit etre termine */
|
if( StateDrawArc == 1 ) /* Trace arc under way must be completed. */
|
||||||
{
|
{
|
||||||
DisplayError( this, wxT( "Arc in progress.." ) );
|
DisplayError( this, wxT( "Arc in progress.." ) );
|
||||||
return;
|
return;
|
||||||
|
@ -575,36 +566,35 @@ void WinEDA_LibeditFrame::EndDrawGraphicItem( wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************/
|
/*
|
||||||
static void ComputeArc( LIB_ARC* DrawItem, wxPoint ArcCentre )
|
* Routine for adjusting the parameters of the arc currently being drawn.
|
||||||
/***************************************************************/
|
* Calculates the center, radius, angles for the arc current
|
||||||
|
* Passes through the points ArcStartX, ArcEndX Y and Y with the nearest center
|
||||||
/* routine d'ajustage des parametres de l'arc en cours de trace
|
* of the mouse position.
|
||||||
* calcule le centre, rayon, angles pour que l'arc en cours
|
* Note: The center is obviously not on the grid
|
||||||
* passe par les points ArcStartX,Y et ArcEndX,Y avec le centre le plus proche
|
|
||||||
* de la pos souris
|
|
||||||
* Remarque: le centre n'est evidemment pas sur la grille
|
|
||||||
*/
|
*/
|
||||||
|
static void ComputeArc( LIB_ARC* DrawItem, wxPoint ArcCentre )
|
||||||
{
|
{
|
||||||
int dx, dy;
|
int dx, dy;
|
||||||
int cX, cY; /* Coord centre de l'arc */
|
int cX, cY;
|
||||||
int angle;
|
int angle;
|
||||||
|
|
||||||
cX = ArcCentre.x;
|
cX = ArcCentre.x;
|
||||||
cY = ArcCentre.y;
|
cY = ArcCentre.y;
|
||||||
|
|
||||||
cY = -cY; /* Attention a l'orientation de l'axe Y */
|
cY = -cY; /* Attention to the orientation of the axis Y. */
|
||||||
|
|
||||||
/* calcul de cX et cY pour que l'arc passe par ArcStartX,Y et ArcEndX,Y */
|
/* Calculating cX and cY for the arc passes through ArcStartX, ArcEndX,
|
||||||
|
* X and Y */
|
||||||
dx = ArcEndX - ArcStartX;
|
dx = ArcEndX - ArcStartX;
|
||||||
dy = ArcEndY - ArcStartY;
|
dy = ArcEndY - ArcStartY;
|
||||||
cX -= ArcStartX;
|
cX -= ArcStartX;
|
||||||
cY -= ArcStartY;
|
cY -= ArcStartY;
|
||||||
angle = (int) ( atan2( (double) dy, (double) dx ) * 1800 / M_PI );
|
angle = (int) ( atan2( (double) dy, (double) dx ) * 1800 / M_PI );
|
||||||
RotatePoint( &dx, &dy, angle ); /* Le segment dx, dy est horizontal */
|
RotatePoint( &dx, &dy, angle ); /* The segment dx, dy is horizontal
|
||||||
/* -> dx = longueur, dy = 0 */
|
* -> Length = dx, dy = 0 */
|
||||||
RotatePoint( &cX, &cY, angle );
|
RotatePoint( &cX, &cY, angle );
|
||||||
cX = dx / 2; /* cX, cY est sur la mediane du segment 0,0 a dx,0 */
|
cX = dx / 2; /* cX, cY is on the median segment 0.0 a dx, 0 */
|
||||||
|
|
||||||
RotatePoint( &cX, &cY, -angle );
|
RotatePoint( &cX, &cY, -angle );
|
||||||
cX += ArcStartX;
|
cX += ArcStartX;
|
||||||
|
@ -633,9 +623,9 @@ static void ComputeArc( LIB_ARC* DrawItem, wxPoint ArcCentre )
|
||||||
NORMALIZE_ANGLE( DrawItem->m_t1 );
|
NORMALIZE_ANGLE( DrawItem->m_t1 );
|
||||||
NORMALIZE_ANGLE( DrawItem->m_t2 ); // angles = 0 .. 3600
|
NORMALIZE_ANGLE( DrawItem->m_t2 ); // angles = 0 .. 3600
|
||||||
|
|
||||||
// limitation val abs a < 1800 (1/2 cercle) pour eviter Pbs d'affichage en miroir
|
// Restrict angle to less than 180 to avoid PBS display mirror
|
||||||
// car en trace on suppose que l'arc fait moins de 180 deg pour trouver
|
// Trace because it is assumed that the arc is less than 180 deg to find
|
||||||
// son orientation apres rot, miroir...
|
// orientation after rotate or mirror.
|
||||||
if( (DrawItem->m_t2 - DrawItem->m_t1) > 1800 )
|
if( (DrawItem->m_t2 - DrawItem->m_t1) > 1800 )
|
||||||
DrawItem->m_t2 -= 3600;
|
DrawItem->m_t2 -= 3600;
|
||||||
else if( (DrawItem->m_t2 - DrawItem->m_t1) <= -1800 )
|
else if( (DrawItem->m_t2 - DrawItem->m_t1) <= -1800 )
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
/*************************************************/
|
/*************************************************/
|
||||||
/* Functions to Load from file and save to file */
|
/* Functions to Load from file and save to file */
|
||||||
/* the graphic shapes used to draw a component */
|
/* the graphic shapes used to draw a component */
|
||||||
/* When using the import/export symbol options */
|
/* When using the import/export symbol options */
|
||||||
/* files are the *.sym files */
|
/* files are the *.sym files */
|
||||||
/*************************************************/
|
/*************************************************/
|
||||||
|
|
||||||
/* fichier symbedit.cpp */
|
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "appl_wxstruct.h"
|
#include "appl_wxstruct.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
@ -25,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read a component shape file (a symbol file *.sym )and add data (graphic
|
* Read a component shape file (symbol file *.sym ) and add data (graphic
|
||||||
* items) to the current component.
|
* items) to the current component.
|
||||||
*
|
*
|
||||||
* A symbol file *.sym has the same format as a library, and contains only
|
* A symbol file *.sym has the same format as a library, and contains only
|
||||||
|
@ -144,7 +142,6 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
|
||||||
if( m_component->GetDrawItemList().empty() )
|
if( m_component->GetDrawItemList().empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Creation du fichier symbole */
|
|
||||||
wxString default_path = wxGetApp().ReturnLastVisitedLibraryPath();
|
wxString default_path = wxGetApp().ReturnLastVisitedLibraryPath();
|
||||||
|
|
||||||
wxFileDialog dlg( this, _( "Export Symbol Drawings" ), default_path,
|
wxFileDialog dlg( this, _( "Export Symbol Drawings" ), default_path,
|
||||||
|
@ -176,17 +173,15 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
|
||||||
msg.Printf( _( "Save Symbol in [%s]" ), GetChars( fn.GetPath() ) );
|
msg.Printf( _( "Save Symbol in [%s]" ), GetChars( fn.GetPath() ) );
|
||||||
Affiche_Message( msg );
|
Affiche_Message( msg );
|
||||||
|
|
||||||
/* Creation de l'entete de la librairie */
|
|
||||||
char Line[256];
|
char Line[256];
|
||||||
fprintf( ExportFile, "%s %d.%d %s Date: %s\n", LIBFILE_IDENT,
|
fprintf( ExportFile, "%s %d.%d %s Date: %s\n", LIBFILE_IDENT,
|
||||||
LIB_VERSION_MAJOR, LIB_VERSION_MINOR,
|
LIB_VERSION_MAJOR, LIB_VERSION_MINOR,
|
||||||
"SYMBOL", DateAndTime( Line ) );
|
"SYMBOL", DateAndTime( Line ) );
|
||||||
|
|
||||||
/* Creation du commentaire donnant le nom du composant */
|
/* Component name. */
|
||||||
fprintf( ExportFile, "# SYMBOL %s\n#\n",
|
fprintf( ExportFile, "# SYMBOL %s\n#\n",
|
||||||
CONV_TO_UTF8( m_component->GetName() ) );
|
CONV_TO_UTF8( m_component->GetName() ) );
|
||||||
|
|
||||||
/* Generation des lignes utiles */
|
|
||||||
fprintf( ExportFile, "DEF %s",
|
fprintf( ExportFile, "DEF %s",
|
||||||
CONV_TO_UTF8( m_component->GetName() ) );
|
CONV_TO_UTF8( m_component->GetName() ) );
|
||||||
if( !m_component->GetReferenceField().m_Text.IsEmpty() )
|
if( !m_component->GetReferenceField().m_Text.IsEmpty() )
|
||||||
|
@ -202,7 +197,6 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
|
||||||
m_component->m_DrawPinName ? 'Y' : 'N',
|
m_component->m_DrawPinName ? 'Y' : 'N',
|
||||||
1, 0 /* unused */, 'N' );
|
1, 0 /* unused */, 'N' );
|
||||||
|
|
||||||
/* Position / orientation / visibilite des champs */
|
|
||||||
m_component->GetReferenceField().Save( ExportFile );
|
m_component->GetReferenceField().Save( ExportFile );
|
||||||
m_component->GetValueField().Save( ExportFile );
|
m_component->GetValueField().Save( ExportFile );
|
||||||
|
|
||||||
|
@ -229,13 +223,11 @@ void WinEDA_LibeditFrame::SaveOneSymbol()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
/*
|
||||||
/* Routine de placement du point d'ancrage ( reference des coordonnes pour */
|
* Place anchor reference coordinators for current component
|
||||||
/* le trace) du composant courant */
|
*
|
||||||
/* Toutes les coord apparaissant dans les structures sont modifiees */
|
* All coordinates of the object are offset to the cursor position * /
|
||||||
/* pour repositionner le point repere par le curseur souris au point */
|
*/
|
||||||
/* d'ancrage ( coord 0,0 ). */
|
|
||||||
/***************************************************************************/
|
|
||||||
void WinEDA_LibeditFrame::PlaceAncre()
|
void WinEDA_LibeditFrame::PlaceAncre()
|
||||||
{
|
{
|
||||||
if( m_component == NULL )
|
if( m_component == NULL )
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/********************************************/
|
/******************/
|
||||||
/* tool_lib.cpp: construction des toolbars */
|
/* tool_lib.cpp */
|
||||||
/********************************************/
|
/******************/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
@ -154,7 +154,8 @@ void WinEDA_LibeditFrame::ReCreateHToolbar()
|
||||||
|
|
||||||
m_HToolBar->AddSeparator();
|
m_HToolBar->AddSeparator();
|
||||||
m_HToolBar->AddTool( ID_LIBEDIT_CHECK_PART, wxEmptyString,
|
m_HToolBar->AddTool( ID_LIBEDIT_CHECK_PART, wxEmptyString,
|
||||||
wxBitmap( erc_xpm ), _( "Test for duplicate pins and off grid pins" ) );
|
wxBitmap( erc_xpm ),
|
||||||
|
_( "Test for duplicate pins and off grid pins" ) );
|
||||||
|
|
||||||
m_HToolBar->AddSeparator();
|
m_HToolBar->AddSeparator();
|
||||||
msg = AddHotkeyName( _( "Zoom in" ), s_Libedit_Hokeys_Descr, HK_ZOOM_IN );
|
msg = AddHotkeyName( _( "Zoom in" ), s_Libedit_Hokeys_Descr, HK_ZOOM_IN );
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*****************************************************/
|
/******************/
|
||||||
/* toolsch.cpp; vreate toolbars for schematic frame */
|
/* tool_sch.cpp */
|
||||||
/*****************************************************/
|
/******************/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
@ -15,21 +15,20 @@
|
||||||
#include "eeschema_id.h"
|
#include "eeschema_id.h"
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************/
|
|
||||||
void WinEDA_SchematicFrame::ReCreateHToolbar()
|
|
||||||
/**************************************************************/
|
|
||||||
|
|
||||||
/* Create the main Horizontal Toolbar for the schematic editor
|
/* Create the main Horizontal Toolbar for the schematic editor
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_SchematicFrame::ReCreateHToolbar()
|
||||||
{
|
{
|
||||||
if( m_HToolBar != NULL )
|
if( m_HToolBar != NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );
|
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );
|
||||||
|
|
||||||
#if !KICAD_AUIMANAGER
|
#if !KICAD_AUIMANAGER
|
||||||
SetToolBar( (wxToolBar*)m_HToolBar );
|
SetToolBar( (wxToolBar*)m_HToolBar );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Set up toolbar
|
// Set up toolbar
|
||||||
m_HToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString, wxBitmap( new_xpm ),
|
m_HToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString, wxBitmap( new_xpm ),
|
||||||
_( "New schematic project" ) );
|
_( "New schematic project" ) );
|
||||||
|
@ -37,7 +36,8 @@ void WinEDA_SchematicFrame::ReCreateHToolbar()
|
||||||
m_HToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString, wxBitmap( open_xpm ),
|
m_HToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString, wxBitmap( open_xpm ),
|
||||||
_( "Open schematic project" ) );
|
_( "Open schematic project" ) );
|
||||||
|
|
||||||
m_HToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString, wxBitmap( save_project_xpm ),
|
m_HToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString,
|
||||||
|
wxBitmap( save_project_xpm ),
|
||||||
_( "Save schematic project" ) );
|
_( "Save schematic project" ) );
|
||||||
|
|
||||||
m_HToolBar->AddSeparator();
|
m_HToolBar->AddSeparator();
|
||||||
|
@ -48,12 +48,14 @@ void WinEDA_SchematicFrame::ReCreateHToolbar()
|
||||||
m_HToolBar->AddTool( ID_TO_LIBRARY, wxEmptyString, wxBitmap( libedit_xpm ),
|
m_HToolBar->AddTool( ID_TO_LIBRARY, wxEmptyString, wxBitmap( libedit_xpm ),
|
||||||
_( "Library editor" ) );
|
_( "Library editor" ) );
|
||||||
|
|
||||||
m_HToolBar->AddTool( ID_TO_LIBVIEW, wxEmptyString, wxBitmap( library_browse_xpm ),
|
m_HToolBar->AddTool( ID_TO_LIBVIEW, wxEmptyString,
|
||||||
|
wxBitmap( library_browse_xpm ),
|
||||||
_( "Library browser" ) );
|
_( "Library browser" ) );
|
||||||
|
|
||||||
m_HToolBar->AddSeparator();
|
m_HToolBar->AddSeparator();
|
||||||
m_HToolBar->AddTool( ID_HIERARCHY, wxEmptyString, wxBitmap( hierarchy_nav_xpm ),
|
m_HToolBar->AddTool( ID_HIERARCHY, wxEmptyString,
|
||||||
_( "Schematic hierarchy navigator" ) );
|
wxBitmap( hierarchy_nav_xpm ),
|
||||||
|
_( "Navigate schematic hierarchy" ) );
|
||||||
|
|
||||||
m_HToolBar->AddSeparator();
|
m_HToolBar->AddSeparator();
|
||||||
|
|
||||||
|
@ -67,11 +69,15 @@ void WinEDA_SchematicFrame::ReCreateHToolbar()
|
||||||
_( "Paste" ) );
|
_( "Paste" ) );
|
||||||
|
|
||||||
m_HToolBar->AddSeparator();
|
m_HToolBar->AddSeparator();
|
||||||
msg = AddHotkeyName( _( "Undo last edition" ), s_Schematic_Hokeys_Descr, HK_UNDO );
|
msg = AddHotkeyName( _( "Undo last edition" ), s_Schematic_Hokeys_Descr,
|
||||||
m_HToolBar->AddTool( ID_SCHEMATIC_UNDO, wxEmptyString, wxBitmap( undo_xpm ), msg );
|
HK_UNDO );
|
||||||
|
m_HToolBar->AddTool( ID_SCHEMATIC_UNDO, wxEmptyString,
|
||||||
|
wxBitmap( undo_xpm ), msg );
|
||||||
|
|
||||||
msg = AddHotkeyName( _( "Redo the last undo command" ), s_Schematic_Hokeys_Descr, HK_REDO );
|
msg = AddHotkeyName( _( "Redo the last undo command" ),
|
||||||
m_HToolBar->AddTool( ID_SCHEMATIC_REDO, wxEmptyString, wxBitmap( redo_xpm ), msg );
|
s_Schematic_Hokeys_Descr, HK_REDO );
|
||||||
|
m_HToolBar->AddTool( ID_SCHEMATIC_REDO, wxEmptyString,
|
||||||
|
wxBitmap( redo_xpm ), msg );
|
||||||
|
|
||||||
m_HToolBar->AddSeparator();
|
m_HToolBar->AddSeparator();
|
||||||
m_HToolBar->AddTool( ID_GEN_PRINT, wxEmptyString, wxBitmap( print_button ),
|
m_HToolBar->AddTool( ID_GEN_PRINT, wxEmptyString, wxBitmap( print_button ),
|
||||||
|
@ -89,15 +95,18 @@ void WinEDA_SchematicFrame::ReCreateHToolbar()
|
||||||
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, wxBitmap( zoom_in_xpm ),
|
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, wxBitmap( zoom_in_xpm ),
|
||||||
msg );
|
msg );
|
||||||
|
|
||||||
msg = AddHotkeyName( _( "Zoom out" ), s_Schematic_Hokeys_Descr, HK_ZOOM_OUT );
|
msg = AddHotkeyName( _( "Zoom out" ), s_Schematic_Hokeys_Descr,
|
||||||
|
HK_ZOOM_OUT );
|
||||||
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, wxBitmap( zoom_out_xpm ),
|
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, wxBitmap( zoom_out_xpm ),
|
||||||
msg );
|
msg );
|
||||||
|
|
||||||
msg = AddHotkeyName( _( "Redraw view" ), s_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW );
|
msg = AddHotkeyName( _( "Redraw view" ), s_Schematic_Hokeys_Descr,
|
||||||
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, wxBitmap( zoom_redraw_xpm ),
|
HK_ZOOM_REDRAW );
|
||||||
msg );
|
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
|
||||||
|
wxBitmap( zoom_redraw_xpm ), msg );
|
||||||
|
|
||||||
msg = AddHotkeyName( _( "Zoom auto" ), s_Schematic_Hokeys_Descr, HK_ZOOM_AUTO );
|
msg = AddHotkeyName( _( "Zoom auto" ), s_Schematic_Hokeys_Descr,
|
||||||
|
HK_ZOOM_AUTO );
|
||||||
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, wxBitmap( zoom_auto_xpm ),
|
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, wxBitmap( zoom_auto_xpm ),
|
||||||
msg );
|
msg );
|
||||||
|
|
||||||
|
@ -109,30 +118,30 @@ void WinEDA_SchematicFrame::ReCreateHToolbar()
|
||||||
m_HToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, wxBitmap( netlist_xpm ),
|
m_HToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, wxBitmap( netlist_xpm ),
|
||||||
_( "Netlist generation" ) );
|
_( "Netlist generation" ) );
|
||||||
|
|
||||||
m_HToolBar->AddTool( ID_GET_ANNOTATE, wxEmptyString, wxBitmap( annotate_xpm ),
|
m_HToolBar->AddTool( ID_GET_ANNOTATE, wxEmptyString,
|
||||||
_( "Schematic Annotation" ) );
|
wxBitmap( annotate_xpm ),
|
||||||
|
_( "Annotate schematic" ) );
|
||||||
|
|
||||||
m_HToolBar->AddTool( ID_GET_ERC, wxEmptyString, wxBitmap( erc_xpm ),
|
m_HToolBar->AddTool( ID_GET_ERC, wxEmptyString, wxBitmap( erc_xpm ),
|
||||||
_( "Schematic Electric Rules Check" ) );
|
_( "Schematic Electric Rules Check" ) );
|
||||||
|
|
||||||
m_HToolBar->AddTool( ID_GET_TOOLS, wxEmptyString, wxBitmap( tools_xpm ),
|
m_HToolBar->AddTool( ID_GET_TOOLS, wxEmptyString, wxBitmap( tools_xpm ),
|
||||||
_( "Bill of material and/or Crossreferences" ) );
|
_( "Bill of material and/or Cross references" ) );
|
||||||
|
|
||||||
m_HToolBar->AddTool( ID_BACKANNO_ITEMS, wxEmptyString, wxBitmap( backanno_xpm ),
|
m_HToolBar->AddTool( ID_BACKANNO_ITEMS, wxEmptyString,
|
||||||
|
wxBitmap( backanno_xpm ),
|
||||||
_( "Backannotate footprint" ) );
|
_( "Backannotate footprint" ) );
|
||||||
|
|
||||||
// after adding the tools to the toolbar, must call Realize() to reflect the changes
|
// after adding the tools to the toolbar, must call Realize() to
|
||||||
|
// reflect the changes
|
||||||
m_HToolBar->Realize();
|
m_HToolBar->Realize();
|
||||||
SetToolbars();
|
SetToolbars();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************/
|
|
||||||
void WinEDA_SchematicFrame::ReCreateVToolbar()
|
|
||||||
/*************************************************/
|
|
||||||
|
|
||||||
/* Create Vertical Right Toolbar
|
/* Create Vertical Right Toolbar
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_SchematicFrame::ReCreateVToolbar()
|
||||||
{
|
{
|
||||||
if( m_VToolBar )
|
if( m_VToolBar )
|
||||||
return;
|
return;
|
||||||
|
@ -185,17 +194,17 @@ void WinEDA_SchematicFrame::ReCreateVToolbar()
|
||||||
m_VToolBar->AddTool( ID_GLABEL_BUTT, wxEmptyString,
|
m_VToolBar->AddTool( ID_GLABEL_BUTT, wxEmptyString,
|
||||||
wxBitmap( add_glabel_xpm ),
|
wxBitmap( add_glabel_xpm ),
|
||||||
_( "Place a global label.\nWarning: all global labels with the same name are connected in whole hierarchy" ),
|
_( "Place a global label.\nWarning: all global labels with the same name are connected in whole hierarchy" ),
|
||||||
wxITEM_CHECK );
|
wxITEM_CHECK );
|
||||||
|
|
||||||
m_VToolBar->AddTool( ID_JUNCTION_BUTT, wxEmptyString,
|
m_VToolBar->AddTool( ID_JUNCTION_BUTT, wxEmptyString,
|
||||||
wxBitmap( add_junction_xpm ),
|
wxBitmap( add_junction_xpm ),
|
||||||
_( "Place a junction" ), wxITEM_CHECK );
|
_( "Place a junction" ), wxITEM_CHECK );
|
||||||
|
|
||||||
m_VToolBar->AddSeparator();
|
m_VToolBar->AddSeparator();
|
||||||
m_VToolBar->AddTool( ID_HIERLABEL_BUTT, wxEmptyString,
|
m_VToolBar->AddTool( ID_HIERLABEL_BUTT, wxEmptyString,
|
||||||
wxBitmap( add_hierarchical_label_xpm ),
|
wxBitmap( add_hierarchical_label_xpm ),
|
||||||
_( "Place a hierarchical label. This label will be seen as a pin sheet in the sheet symbol" ),
|
_( "Place a hierarchical label. This label will be seen as a pin sheet in the sheet symbol" ),
|
||||||
wxITEM_CHECK );
|
wxITEM_CHECK );
|
||||||
|
|
||||||
m_VToolBar->AddTool( ID_SHEET_SYMBOL_BUTT, wxEmptyString,
|
m_VToolBar->AddTool( ID_SHEET_SYMBOL_BUTT, wxEmptyString,
|
||||||
wxBitmap( add_hierarchical_subsheet_xpm ),
|
wxBitmap( add_hierarchical_subsheet_xpm ),
|
||||||
|
@ -203,8 +212,8 @@ void WinEDA_SchematicFrame::ReCreateVToolbar()
|
||||||
|
|
||||||
m_VToolBar->AddTool( ID_IMPORT_HLABEL_BUTT, wxEmptyString,
|
m_VToolBar->AddTool( ID_IMPORT_HLABEL_BUTT, wxEmptyString,
|
||||||
wxBitmap( import_hierarchical_label_xpm ),
|
wxBitmap( import_hierarchical_label_xpm ),
|
||||||
_( "Place a pin sheet , imported from the corresponding hierarchical label in sheet" ),
|
_( "Place a pin sheet, imported from the corresponding hierarchical label in sheet" ),
|
||||||
wxITEM_CHECK );
|
wxITEM_CHECK );
|
||||||
|
|
||||||
m_VToolBar->AddTool( ID_SHEET_LABEL_BUTT, wxEmptyString,
|
m_VToolBar->AddTool( ID_SHEET_LABEL_BUTT, wxEmptyString,
|
||||||
wxBitmap( add_hierar_pin_xpm ),
|
wxBitmap( add_hierar_pin_xpm ),
|
||||||
|
@ -229,22 +238,19 @@ void WinEDA_SchematicFrame::ReCreateVToolbar()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************/
|
|
||||||
void WinEDA_SchematicFrame::ReCreateOptToolbar()
|
|
||||||
/****************************************************************/
|
|
||||||
|
|
||||||
/* Create Vertical Left Toolbar (Option Toolbar)
|
/* Create Vertical Left Toolbar (Option Toolbar)
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_SchematicFrame::ReCreateOptToolbar()
|
||||||
{
|
{
|
||||||
if( m_OptionsToolBar )
|
if( m_OptionsToolBar )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// creation du tool bar options
|
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this,
|
||||||
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this, ID_OPT_TOOLBAR, FALSE );
|
ID_OPT_TOOLBAR, FALSE );
|
||||||
|
|
||||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString,
|
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString,
|
||||||
wxBitmap( grid_xpm ),
|
wxBitmap( grid_xpm ),
|
||||||
_( "Display Grid OFF" ), wxITEM_CHECK );
|
_( "Turn grid off" ), wxITEM_CHECK );
|
||||||
|
|
||||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
|
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
|
||||||
wxBitmap( unit_inch_xpm ),
|
wxBitmap( unit_inch_xpm ),
|
||||||
|
@ -256,17 +262,18 @@ void WinEDA_SchematicFrame::ReCreateOptToolbar()
|
||||||
|
|
||||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
|
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
|
||||||
wxBitmap( cursor_shape_xpm ),
|
wxBitmap( cursor_shape_xpm ),
|
||||||
_( "Change Cursor Shape" ), wxITEM_CHECK );
|
_( "Change cursor shape" ), wxITEM_CHECK );
|
||||||
|
|
||||||
m_OptionsToolBar->AddSeparator();
|
m_OptionsToolBar->AddSeparator();
|
||||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_HIDDEN_PINS, wxEmptyString,
|
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_HIDDEN_PINS, wxEmptyString,
|
||||||
wxBitmap( hidden_pin_xpm ),
|
wxBitmap( hidden_pin_xpm ),
|
||||||
_( "Show Hidden Pins" ), wxITEM_CHECK );
|
_( "Show hidden pins" ), wxITEM_CHECK );
|
||||||
|
|
||||||
m_OptionsToolBar->AddSeparator();
|
m_OptionsToolBar->AddSeparator();
|
||||||
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_BUS_WIRES_ORIENT, wxEmptyString,
|
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_BUS_WIRES_ORIENT, wxEmptyString,
|
||||||
wxBitmap( lines90_xpm ),
|
wxBitmap( lines90_xpm ),
|
||||||
_( "HV orientation for Wires and Bus" ), wxITEM_CHECK );
|
_( "HV orientation for wires and bus" ),
|
||||||
|
wxITEM_CHECK );
|
||||||
|
|
||||||
m_OptionsToolBar->Realize();
|
m_OptionsToolBar->Realize();
|
||||||
|
|
||||||
|
@ -274,9 +281,7 @@ void WinEDA_SchematicFrame::ReCreateOptToolbar()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************************/
|
|
||||||
void WinEDA_SchematicFrame::OnSelectOptionToolbar( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::OnSelectOptionToolbar( wxCommandEvent& event )
|
||||||
/*******************************************************************************************/
|
|
||||||
{
|
{
|
||||||
if( DrawPanel == NULL )
|
if( DrawPanel == NULL )
|
||||||
return;
|
return;
|
||||||
|
@ -295,13 +300,13 @@ void WinEDA_SchematicFrame::OnSelectOptionToolbar( wxCommandEvent& event )
|
||||||
|
|
||||||
case ID_TB_OPTIONS_SELECT_UNIT_MM:
|
case ID_TB_OPTIONS_SELECT_UNIT_MM:
|
||||||
g_UnitMetric = MILLIMETRE;
|
g_UnitMetric = MILLIMETRE;
|
||||||
UpdateStatusBar(); /* Reaffichage des coord curseur */
|
UpdateStatusBar();
|
||||||
DrawPanel->Refresh();
|
DrawPanel->Refresh();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_TB_OPTIONS_SELECT_UNIT_INCH:
|
case ID_TB_OPTIONS_SELECT_UNIT_INCH:
|
||||||
g_UnitMetric = INCHES;
|
g_UnitMetric = INCHES;
|
||||||
UpdateStatusBar(); /* Reaffichage des coord curseur */
|
UpdateStatusBar();
|
||||||
DrawPanel->Refresh();
|
DrawPanel->Refresh();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -51,19 +51,23 @@ void WinEDA_ViewlibFrame::ReCreateHToolbar()
|
||||||
_( "Display next part" ) );
|
_( "Display next part" ) );
|
||||||
|
|
||||||
m_HToolBar->AddSeparator();
|
m_HToolBar->AddSeparator();
|
||||||
msg = AddHotkeyName( _( "Zoom in" ), s_Viewlib_Hokeys_Descr, HK_ZOOM_IN );
|
msg = AddHotkeyName( _( "Zoom in" ), s_Viewlib_Hokeys_Descr,
|
||||||
|
HK_ZOOM_IN );
|
||||||
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString,
|
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString,
|
||||||
wxBitmap( zoom_in_xpm ), msg );
|
wxBitmap( zoom_in_xpm ), msg );
|
||||||
|
|
||||||
msg = AddHotkeyName( _( "Zoom out" ), s_Viewlib_Hokeys_Descr, HK_ZOOM_OUT );
|
msg = AddHotkeyName( _( "Zoom out" ), s_Viewlib_Hokeys_Descr,
|
||||||
|
HK_ZOOM_OUT );
|
||||||
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
|
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
|
||||||
wxBitmap( zoom_out_xpm ), msg );
|
wxBitmap( zoom_out_xpm ), msg );
|
||||||
|
|
||||||
msg = AddHotkeyName( _( "Redraw view" ), s_Viewlib_Hokeys_Descr, HK_ZOOM_REDRAW );
|
msg = AddHotkeyName( _( "Redraw view" ), s_Viewlib_Hokeys_Descr,
|
||||||
|
HK_ZOOM_REDRAW );
|
||||||
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
|
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
|
||||||
wxBitmap( zoom_redraw_xpm ), msg );
|
wxBitmap( zoom_redraw_xpm ), msg );
|
||||||
|
|
||||||
msg = AddHotkeyName( _( "Zoom auto" ), s_Viewlib_Hokeys_Descr, HK_ZOOM_AUTO );
|
msg = AddHotkeyName( _( "Zoom auto" ), s_Viewlib_Hokeys_Descr,
|
||||||
|
HK_ZOOM_AUTO );
|
||||||
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
|
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
|
||||||
wxBitmap( zoom_auto_xpm ), msg );
|
wxBitmap( zoom_auto_xpm ), msg );
|
||||||
|
|
||||||
|
@ -91,12 +95,12 @@ void WinEDA_ViewlibFrame::ReCreateHToolbar()
|
||||||
_( "View component documents" ) );
|
_( "View component documents" ) );
|
||||||
m_HToolBar->EnableTool( ID_LIBVIEW_VIEWDOC, false );
|
m_HToolBar->EnableTool( ID_LIBVIEW_VIEWDOC, false );
|
||||||
|
|
||||||
if( m_Semaphore ) // The lib browser is called from a "load component" command
|
if( m_Semaphore )
|
||||||
{
|
{
|
||||||
|
// The library browser is called from a "load component" command
|
||||||
m_HToolBar->AddSeparator();
|
m_HToolBar->AddSeparator();
|
||||||
m_HToolBar->AddTool( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
|
m_HToolBar->AddTool( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
|
||||||
wxEmptyString,
|
wxEmptyString, wxBitmap( export_xpm ),
|
||||||
wxBitmap( export_xpm ),
|
|
||||||
_( "Insert component in schematic" ) );
|
_( "Insert component in schematic" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*************************************************************************/
|
/***********************/
|
||||||
/* viewlib_frame.cpp - fonctions des classes du type WinEDA_ViewlibFrame */
|
/* viewlib_frame.cpp */
|
||||||
/*************************************************************************/
|
/***********************/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "appl_wxstruct.h"
|
#include "appl_wxstruct.h"
|
||||||
|
@ -102,11 +102,12 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
|
||||||
SetWindowStyle( GetWindowStyle() | wxSTAY_ON_TOP );
|
SetWindowStyle( GetWindowStyle() | wxSTAY_ON_TOP );
|
||||||
|
|
||||||
SetBaseScreen( new SCH_SCREEN() );
|
SetBaseScreen( new SCH_SCREEN() );
|
||||||
GetScreen()->m_Center = true; // set to true to have the coordinates origine -0,0) centered on screen
|
GetScreen()->m_Center = true; // Center coordinate origins on screen.
|
||||||
LoadSettings();
|
LoadSettings();
|
||||||
// Initilialize grid id to a default value if not found in config or bad:
|
|
||||||
if( (m_LastGridSizeId <= 0) ||
|
// Initialize grid id to a default value if not found in config or bad:
|
||||||
(m_LastGridSizeId < (ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000)) )
|
if( ( m_LastGridSizeId <= 0 ) ||
|
||||||
|
( m_LastGridSizeId < ( ID_POPUP_GRID_USER - ID_POPUP_GRID_LEVEL_1000 ) ) )
|
||||||
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
|
m_LastGridSizeId = ID_POPUP_GRID_LEVEL_50 - ID_POPUP_GRID_LEVEL_1000;
|
||||||
|
|
||||||
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
||||||
|
@ -121,6 +122,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
|
||||||
m_LibListSize.y = size.y;
|
m_LibListSize.y = size.y;
|
||||||
|
|
||||||
wxPoint win_pos( 0, 0 );
|
wxPoint win_pos( 0, 0 );
|
||||||
|
|
||||||
#if !KICAD_AUIMANAGER
|
#if !KICAD_AUIMANAGER
|
||||||
if( Library == NULL )
|
if( Library == NULL )
|
||||||
{
|
{
|
||||||
|
@ -190,6 +192,7 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
|
||||||
0, NULL, wxLB_HSCROLL );
|
0, NULL, wxLB_HSCROLL );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( m_LibList )
|
if( m_LibList )
|
||||||
ReCreateListLib();
|
ReCreateListLib();
|
||||||
DisplayLibInfos();
|
DisplayLibInfos();
|
||||||
|
@ -199,35 +202,35 @@ WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father,
|
||||||
Show( TRUE );
|
Show( TRUE );
|
||||||
|
|
||||||
#if KICAD_AUIMANAGER
|
#if KICAD_AUIMANAGER
|
||||||
m_auimgr.SetManagedWindow(this);
|
m_auimgr.SetManagedWindow( this );
|
||||||
|
|
||||||
wxAuiPaneInfo horiz;
|
wxAuiPaneInfo horiz;
|
||||||
horiz.Gripper(false);
|
horiz.Gripper( false );
|
||||||
horiz.DockFixed(true);
|
horiz.DockFixed( true );
|
||||||
horiz.Movable(false);
|
horiz.Movable( false );
|
||||||
horiz.Floatable(false);
|
horiz.Floatable( false );
|
||||||
horiz.CloseButton(false);
|
horiz.CloseButton( false );
|
||||||
horiz.CaptionVisible(false);
|
horiz.CaptionVisible( false );
|
||||||
|
|
||||||
wxAuiPaneInfo vert(horiz);
|
wxAuiPaneInfo vert( horiz );
|
||||||
|
|
||||||
vert.TopDockable(false).BottomDockable(false);
|
vert.TopDockable( false ).BottomDockable( false );
|
||||||
horiz.LeftDockable(false).RightDockable(false);
|
horiz.LeftDockable( false ).RightDockable( false );
|
||||||
|
|
||||||
m_auimgr.AddPane(m_HToolBar,
|
m_auimgr.AddPane( m_HToolBar,
|
||||||
wxAuiPaneInfo(horiz).Name(wxT("m_HToolBar")).Top().Row(0));
|
wxAuiPaneInfo( horiz ).Name( wxT ("m_HToolBar" ) ).Top().Row( 0 ) );
|
||||||
|
|
||||||
m_auimgr.AddPane(m_LibList,
|
m_auimgr.AddPane( m_LibList,
|
||||||
wxAuiPaneInfo(vert).Name(wxT("m_LibList")).Left().Row(0));
|
wxAuiPaneInfo( vert ).Name( wxT( "m_LibList" ) ).Left().Row( 0 ) );
|
||||||
|
|
||||||
m_auimgr.AddPane(m_CmpList,
|
m_auimgr.AddPane( m_CmpList,
|
||||||
wxAuiPaneInfo(vert).Name(wxT("m_CmpList")).Left().Row(1));
|
wxAuiPaneInfo( vert ).Name( wxT( "m_CmpList" ) ).Left().Row( 1 ) );
|
||||||
|
|
||||||
m_auimgr.AddPane(DrawPanel,
|
m_auimgr.AddPane( DrawPanel,
|
||||||
wxAuiPaneInfo(vert).Name(wxT("DrawFrame")).Center());
|
wxAuiPaneInfo( vert ).Name( wxT( "DrawFrame" ) ).Center() );
|
||||||
|
|
||||||
m_auimgr.AddPane(MsgPanel,
|
m_auimgr.AddPane( MsgPanel,
|
||||||
wxAuiPaneInfo(horiz).Name(wxT("MsgPanel")).Bottom());
|
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
|
||||||
|
|
||||||
m_auimgr.Update();
|
m_auimgr.Update();
|
||||||
#endif
|
#endif
|
||||||
|
@ -339,10 +342,12 @@ void WinEDA_ViewlibFrame::OnSize( wxSizeEvent& SizeEv )
|
||||||
m_CmpList->SetSize( m_CmpListWindow->GetClientSize() -
|
m_CmpList->SetSize( m_CmpListWindow->GetClientSize() -
|
||||||
wxSize( EXTRA_BORDER_SIZE * 2, 0 ) );
|
wxSize( EXTRA_BORDER_SIZE * 2, 0 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if KICAD_AUIMANAGER
|
#if KICAD_AUIMANAGER
|
||||||
if(m_auimgr.GetManagedWindow())
|
if( m_auimgr.GetManagedWindow() )
|
||||||
m_auimgr.Update();
|
m_auimgr.Update();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SizeEv.Skip();
|
SizeEv.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -567,7 +572,7 @@ void WinEDA_ViewlibFrame::LoadSettings( )
|
||||||
cfg->Read( LIBLIST_WIDTH_KEY, &m_LibListSize.x );
|
cfg->Read( LIBLIST_WIDTH_KEY, &m_LibListSize.x );
|
||||||
cfg->Read( CMPLIST_WIDTH_KEY, &m_CmpListSize.x );
|
cfg->Read( CMPLIST_WIDTH_KEY, &m_CmpListSize.x );
|
||||||
|
|
||||||
// set parameters to a resonnable value
|
// Set parameters to a reasonable value.
|
||||||
if ( m_LibListSize.x > m_FrameSize.x/2 )
|
if ( m_LibListSize.x > m_FrameSize.x/2 )
|
||||||
m_LibListSize.x = m_FrameSize.x/2;
|
m_LibListSize.x = m_FrameSize.x/2;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
/* wxEeschemaStruct.h: */
|
/* wxEeschemaStruct.h: */
|
||||||
/* descriptions des principales classes derivees utilisees */
|
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
|
|
||||||
#ifndef WX_EESCHEMA_STRUCT_H
|
#ifndef WX_EESCHEMA_STRUCT_H
|
||||||
|
@ -27,9 +26,9 @@ class DrawBusEntryStruct;
|
||||||
class SCH_GLOBALLABEL;
|
class SCH_GLOBALLABEL;
|
||||||
class SCH_TEXT;
|
class SCH_TEXT;
|
||||||
class EDA_DrawLineStruct;
|
class EDA_DrawLineStruct;
|
||||||
class DrawSheetStruct;
|
class SCH_SHEET;
|
||||||
class DrawSheetPath;
|
class DrawSheetPath;
|
||||||
class Hierarchical_PIN_Sheet_Struct;
|
class SCH_SHEET_PIN;
|
||||||
class SCH_COMPONENT;
|
class SCH_COMPONENT;
|
||||||
class SCH_CMP_FIELD;
|
class SCH_CMP_FIELD;
|
||||||
class LIB_PIN;
|
class LIB_PIN;
|
||||||
|
@ -38,19 +37,19 @@ class DrawJunctionStruct;
|
||||||
/* enum used in RotationMiroir() */
|
/* enum used in RotationMiroir() */
|
||||||
enum fl_rot_cmp
|
enum fl_rot_cmp
|
||||||
{
|
{
|
||||||
CMP_NORMAL, // orientation normale (O, pas de miroir)
|
CMP_NORMAL, // Normal orientation, no rotation or mirror
|
||||||
CMP_ROTATE_CLOCKWISE, // nouvelle rotation de -90
|
CMP_ROTATE_CLOCKWISE, // Rotate -90
|
||||||
CMP_ROTATE_COUNTERCLOCKWISE, // nouvelle rotation de +90
|
CMP_ROTATE_COUNTERCLOCKWISE, // Rotate +90
|
||||||
CMP_ORIENT_0, // orientation 0, pas de miroir, id CMP_NORMAL
|
CMP_ORIENT_0, // No rotation and no mirror id CMP_NORMAL
|
||||||
CMP_ORIENT_90, // orientation 90, pas de miroir
|
CMP_ORIENT_90, // Rotate 90, no mirror
|
||||||
CMP_ORIENT_180, // orientation 180, pas de miroir
|
CMP_ORIENT_180, // Rotate 180, no mirror
|
||||||
CMP_ORIENT_270, // orientation -90, pas de miroir
|
CMP_ORIENT_270, // Rotate -90, no mirror
|
||||||
CMP_MIROIR_X = 0x100, // miroir selon axe X
|
CMP_MIROIR_X = 0x100, // Mirror around X axis
|
||||||
CMP_MIROIR_Y = 0x200 // miroir selon axe Y
|
CMP_MIROIR_Y = 0x200 // Mirror around Y axis
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schemitic editor (EESchema) main window.
|
* Schematic editor (EESchema) main window.
|
||||||
*/
|
*/
|
||||||
class WinEDA_SchematicFrame : public WinEDA_DrawFrame
|
class WinEDA_SchematicFrame : public WinEDA_DrawFrame
|
||||||
{
|
{
|
||||||
|
@ -131,7 +130,7 @@ public:
|
||||||
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
|
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
|
||||||
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
|
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
|
||||||
void OnSelectOptionToolbar( wxCommandEvent& event );
|
void OnSelectOptionToolbar( wxCommandEvent& event );
|
||||||
int BestZoom(); // Retourne le meilleur zoom
|
int BestZoom();
|
||||||
|
|
||||||
SCH_ITEM* SchematicGeneralLocateAndDisplay( bool IncludePin = TRUE );
|
SCH_ITEM* SchematicGeneralLocateAndDisplay( bool IncludePin = TRUE );
|
||||||
SCH_ITEM* SchematicGeneralLocateAndDisplay( const wxPoint& refpoint,
|
SCH_ITEM* SchematicGeneralLocateAndDisplay( const wxPoint& refpoint,
|
||||||
|
@ -141,8 +140,8 @@ public:
|
||||||
* Function FillFootprintFieldForAllInstancesofComponent
|
* Function FillFootprintFieldForAllInstancesofComponent
|
||||||
* searches for component "aReference", and places a Footprint in
|
* searches for component "aReference", and places a Footprint in
|
||||||
* Footprint field
|
* Footprint field
|
||||||
* @param aReference = reference of the component to initialise
|
* @param aReference = reference of the component to initialize
|
||||||
* @param aFootPrint = new value for the filed Fottprint component
|
* @param aFootPrint = new value for the filed Footprint component
|
||||||
* @param aSetVisible = true to have the field visible, false to set the
|
* @param aSetVisible = true to have the field visible, false to set the
|
||||||
* invisible flag
|
* invisible flag
|
||||||
* @return true if the given component is found
|
* @return true if the given component is found
|
||||||
|
@ -181,14 +180,14 @@ public:
|
||||||
|
|
||||||
// Functions used for hierarchy handling
|
// Functions used for hierarchy handling
|
||||||
void InstallPreviousSheet();
|
void InstallPreviousSheet();
|
||||||
void InstallNextScreen( DrawSheetStruct* Sheet );
|
void InstallNextScreen( SCH_SHEET* Sheet );
|
||||||
|
|
||||||
/** Function GetUniqueFilenameForCurrentSheet
|
/** Function GetUniqueFilenameForCurrentSheet
|
||||||
* @return a filename that can be used in plot and print functions
|
* @return a filename that can be used in plot and print functions
|
||||||
* for the current screen anad sheet path.
|
* for the current screen and sheet path.
|
||||||
* This filename is unique and must be used insteed of the sreen filename
|
* This filename is unique and must be used instead of the screen filename
|
||||||
* (or scheen filename) when one must creates file for each sheet in the
|
* (or screen filename) when one must creates file for each sheet in the
|
||||||
* heierarchy. because in complex hierarchies a sheet and a SCH_SCREEN is
|
* hierarchy. because in complex hierarchies a sheet and a SCH_SCREEN is
|
||||||
* used more than once
|
* used more than once
|
||||||
* Name is <root sheet filename>-<sheet path>
|
* Name is <root sheet filename>-<sheet path>
|
||||||
* and has no extension.
|
* and has no extension.
|
||||||
|
@ -316,8 +315,8 @@ private:
|
||||||
|
|
||||||
// Hierarchical Sheet & PinSheet
|
// Hierarchical Sheet & PinSheet
|
||||||
void InstallHierarchyFrame( wxDC* DC, wxPoint& pos );
|
void InstallHierarchyFrame( wxDC* DC, wxPoint& pos );
|
||||||
DrawSheetStruct* CreateSheet( wxDC* DC );
|
SCH_SHEET* CreateSheet( wxDC* DC );
|
||||||
void ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC );
|
void ReSizeSheet( SCH_SHEET* Sheet, wxDC* DC );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use the component viewer to select component to import into schematic.
|
* Use the component viewer to select component to import into schematic.
|
||||||
|
@ -325,7 +324,7 @@ private:
|
||||||
wxString SelectFromLibBrowser( void );
|
wxString SelectFromLibBrowser( void );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool EditSheet( DrawSheetStruct* Sheet, wxDC* DC );
|
bool EditSheet( SCH_SHEET* Sheet, wxDC* DC );
|
||||||
|
|
||||||
/** Function UpdateSheetNumberAndDate
|
/** Function UpdateSheetNumberAndDate
|
||||||
* Set a sheet number, the sheet count for sheets in the whole schematic
|
* Set a sheet number, the sheet count for sheets in the whole schematic
|
||||||
|
@ -334,20 +333,18 @@ public:
|
||||||
void UpdateSheetNumberAndDate();
|
void UpdateSheetNumberAndDate();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void StartMoveSheet( DrawSheetStruct* sheet, wxDC* DC );
|
void StartMoveSheet( SCH_SHEET* sheet, wxDC* DC );
|
||||||
Hierarchical_PIN_Sheet_Struct* Create_PinSheet( DrawSheetStruct* Sheet, wxDC* DC );
|
SCH_SHEET_PIN* Create_PinSheet( SCH_SHEET* Sheet, wxDC* DC );
|
||||||
void Edit_PinSheet( Hierarchical_PIN_Sheet_Struct* SheetLabel,
|
void Edit_PinSheet( SCH_SHEET_PIN* SheetLabel, wxDC* DC );
|
||||||
wxDC* DC );
|
void StartMove_PinSheet( SCH_SHEET_PIN* SheetLabel,
|
||||||
void StartMove_PinSheet( Hierarchical_PIN_Sheet_Struct* SheetLabel,
|
wxDC* DC );
|
||||||
wxDC* DC );
|
void Place_PinSheet( SCH_SHEET_PIN* SheetLabel,
|
||||||
void Place_PinSheet( Hierarchical_PIN_Sheet_Struct* SheetLabel,
|
wxDC* DC );
|
||||||
wxDC* DC );
|
SCH_SHEET_PIN* Import_PinSheet( SCH_SHEET* Sheet, wxDC* DC );
|
||||||
Hierarchical_PIN_Sheet_Struct* Import_PinSheet( DrawSheetStruct* Sheet,
|
|
||||||
wxDC* DC );
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void DeleteSheetLabel( bool aRedraw,
|
void DeleteSheetLabel( bool aRedraw,
|
||||||
Hierarchical_PIN_Sheet_Struct* aSheetLabelToDel );
|
SCH_SHEET_PIN* aSheetLabelToDel );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -376,7 +373,6 @@ private:
|
||||||
void EditCmpFieldText( SCH_CMP_FIELD* Field, wxDC* DC );
|
void EditCmpFieldText( SCH_CMP_FIELD* Field, wxDC* DC );
|
||||||
void RotateCmpField( SCH_CMP_FIELD* Field, wxDC* DC );
|
void RotateCmpField( SCH_CMP_FIELD* Field, wxDC* DC );
|
||||||
|
|
||||||
/* Operations sur bloc */
|
|
||||||
void PasteListOfItems( wxDC* DC );
|
void PasteListOfItems( wxDC* DC );
|
||||||
|
|
||||||
/* Undo - redo */
|
/* Undo - redo */
|
||||||
|
@ -410,7 +406,7 @@ private:
|
||||||
/** Function PutDataInPreviousState()
|
/** Function PutDataInPreviousState()
|
||||||
* Used in undo or redo command.
|
* Used in undo or redo command.
|
||||||
* Put data pointed by List in the previous state, i.e. the state
|
* Put data pointed by List in the previous state, i.e. the state
|
||||||
* memorised by List
|
* memorized by List
|
||||||
* @param aList = a PICKED_ITEMS_LIST pointer to the list of items to
|
* @param aList = a PICKED_ITEMS_LIST pointer to the list of items to
|
||||||
* undo/redo
|
* undo/redo
|
||||||
* @param aRedoCommand = a bool: true for redo, false for undo
|
* @param aRedoCommand = a bool: true for redo, false for undo
|
||||||
|
@ -437,17 +433,15 @@ private:
|
||||||
public:
|
public:
|
||||||
void Key( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
|
void Key( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
|
||||||
|
|
||||||
/* Gestion generale des operations sur block */
|
/* Block operations. */
|
||||||
int ReturnBlockCommand( int key );
|
int ReturnBlockCommand( int key );
|
||||||
void InitBlockPasteInfos();
|
void InitBlockPasteInfos();
|
||||||
void HandleBlockPlace( wxDC* DC );
|
void HandleBlockPlace( wxDC* DC );
|
||||||
int HandleBlockEnd( wxDC* DC );
|
int HandleBlockEnd( wxDC* DC );
|
||||||
void HandleBlockEndByPopUp( int Command, wxDC* DC );
|
void HandleBlockEndByPopUp( int Command, wxDC* DC );
|
||||||
|
|
||||||
// Repetition automatique de placements
|
|
||||||
void RepeatDrawItem( wxDC* DC );
|
void RepeatDrawItem( wxDC* DC );
|
||||||
|
|
||||||
// Test des points de connexion en l'air (dangling ends)
|
|
||||||
void TestDanglingEnds( SCH_ITEM* DrawList, wxDC* DC );
|
void TestDanglingEnds( SCH_ITEM* DrawList, wxDC* DC );
|
||||||
LIB_PIN* LocatePinEnd( SCH_ITEM* DrawList, const wxPoint& pos );
|
LIB_PIN* LocatePinEnd( SCH_ITEM* DrawList, const wxPoint& pos );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue