Commit b2f9d5bd authored by stambaughw's avatar stambaughw

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.
parent a3f48bf2
/////////////////////////////////////////////////////////////////////////////
// Name: 3d_aux.cpp
/////////////////////////////////////////////////////////////////////////////
......@@ -23,9 +22,8 @@
#include "3d_viewer.h"
#include "trackball.h"
/**************************************************************************/
void S3D_MASTER::Set_Object_Coords( S3D_Vertex* coord, int nbcoord )
/**************************************************************************/
{
int ii;
......@@ -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 )
/************************************************************/
{
int ii;
GLfloat ax, ay, az, bx, by, bz, nx, ny, nz, r;
......@@ -114,9 +110,7 @@ void Set_Object_Data( const S3D_Vertex* coord, int nbcoord )
}
/**********************************************/
GLuint Pcb3D_GLCanvas::DisplayCubeforTest()
/**********************************************/
{
GLuint gllist = glGenLists( 1 );
......@@ -158,7 +152,6 @@ GLuint Pcb3D_GLCanvas::DisplayCubeforTest()
/* class Info_3D_Visu */
/**********************/
/* Constructor */
Info_3D_Visu::Info_3D_Visu()
{
int ii;
......@@ -186,11 +179,8 @@ Info_3D_Visu::~Info_3D_Visu()
}
/*****************************************************************/
/* Classe pour afficher et editer un Vertex (triplet de valeurs),*/
/* en INCHES ou MM ou sans unites */
/*****************************************************************/
/* Display and edit a Vertex (triplet of values) in INCHES or MM or without
* units */
WinEDA_VertexCtrl::WinEDA_VertexCtrl( wxWindow* parent, const wxString& title,
wxBoxSizer* BoxSizer,
int units, int internal_unit )
......@@ -207,11 +197,13 @@ WinEDA_VertexCtrl::WinEDA_VertexCtrl( wxWindow* parent, const wxString& title,
text = title;
text += ReturnUnitSymbol( units );
msgtitle = new wxStaticText( parent, -1, text, wxDefaultPosition, wxSize(
-1,
-1 ), 0 );
msgtitle = new wxStaticText( parent, -1, text, wxDefaultPosition,
wxSize( -1, -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 );
......@@ -219,60 +211,48 @@ WinEDA_VertexCtrl::WinEDA_VertexCtrl( wxWindow* parent, const wxString& title,
msgtitle = new wxStaticText( parent, -1, wxT( "X:" ) );
GridSizer->Add( msgtitle,
0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxADJUST_MINSIZE,
GridSizer->Add( msgtitle, 0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
wxLEFT | wxRIGHT | wxADJUST_MINSIZE,
5 );
m_XValueCtrl = new wxTextCtrl( parent,
-1,
wxEmptyString,
wxDefaultPosition,
wxSize( -1, -1 ),
0 );
m_XValueCtrl = new wxTextCtrl( parent, -1, wxEmptyString,
wxDefaultPosition, wxSize( -1, -1 ), 0 );
GridSizer->Add( m_XValueCtrl,
0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
wxLEFT | wxRIGHT,
5 );
msgtitle = new wxStaticText( parent, -1, wxT(
"Y:" ), wxDefaultPosition, wxSize( -1,
-1 ), 0 );
msgtitle = new wxStaticText( parent, -1, wxT( "Y:" ), wxDefaultPosition,
wxSize( -1, -1 ), 0 );
GridSizer->Add( msgtitle,
0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxADJUST_MINSIZE,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
wxLEFT | wxRIGHT | wxADJUST_MINSIZE,
5 );
m_YValueCtrl = new wxTextCtrl( parent,
-1,
wxEmptyString,
wxDefaultPosition,
wxSize( -1, -1 ),
0 );
GridSizer->Add( m_YValueCtrl,
0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT,
m_YValueCtrl = new wxTextCtrl( parent, -1, wxEmptyString,
wxDefaultPosition, wxSize( -1, -1 ), 0 );
GridSizer->Add( m_YValueCtrl, 0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
wxLEFT | wxRIGHT,
5 );
msgtitle = new wxStaticText( parent, -1, wxT(
"Z:" ), wxDefaultPosition, wxSize( -1,
-1 ), 0 );
msgtitle = new wxStaticText( parent, -1, wxT( "Z:" ), wxDefaultPosition,
wxSize( -1, -1 ), 0 );
GridSizer->Add( msgtitle,
0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT | wxADJUST_MINSIZE,
GridSizer->Add( msgtitle, 0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
wxLEFT | wxRIGHT | wxADJUST_MINSIZE,
5 );
m_ZValueCtrl = new wxTextCtrl( parent,
-1,
wxEmptyString,
wxDefaultPosition,
wxSize( -1, -1 ),
0 );
GridSizer->Add( m_ZValueCtrl,
0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT,
m_ZValueCtrl = new wxTextCtrl( parent, -1, wxEmptyString,
wxDefaultPosition, wxSize( -1, -1 ), 0 );
GridSizer->Add( m_ZValueCtrl, 0,
wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL |
wxLEFT | wxRIGHT,
5 );
}
......@@ -282,12 +262,8 @@ WinEDA_VertexCtrl::~WinEDA_VertexCtrl()
}
/*******************************************/
/* Returns (in internal units) to coordinate between (in user units) */
S3D_Vertex WinEDA_VertexCtrl::GetValue()
/*******************************************/
/* Retourne (en unites internes) les coordonnes entrees (en unites utilisateur)
*/
{
S3D_Vertex value;
double dtmp;
......@@ -302,9 +278,7 @@ S3D_Vertex WinEDA_VertexCtrl::GetValue()
}
/**************************************************/
void WinEDA_VertexCtrl::SetValue( S3D_Vertex vertex )
/**************************************************/
{
wxString text;
......@@ -322,9 +296,7 @@ void WinEDA_VertexCtrl::SetValue( S3D_Vertex vertex )
}
/*****************************************/
void WinEDA_VertexCtrl::Enable( bool onoff )
/*****************************************/
{
m_XValueCtrl->Enable( onoff );
m_YValueCtrl->Enable( onoff );
......
/////////////////////////////////////////////////////////////////////////////
// Name: 3d_canvas.cpp
/////////////////////////////////////////////////////////////////////////////
......@@ -35,39 +34,38 @@
*/
BEGIN_EVENT_TABLE( Pcb3D_GLCanvas, wxGLCanvas )
EVT_PAINT( Pcb3D_GLCanvas::OnPaint )
EVT_CHAR( Pcb3D_GLCanvas::OnChar )
EVT_MOUSE_EVENTS( Pcb3D_GLCanvas::OnMouseEvent )
EVT_ERASE_BACKGROUND( Pcb3D_GLCanvas::OnEraseBackground )
EVT_MENU_RANGE( ID_POPUP_3D_VIEW_START, ID_POPUP_3D_VIEW_END,
EVT_PAINT( Pcb3D_GLCanvas::OnPaint )
EVT_CHAR( Pcb3D_GLCanvas::OnChar )
EVT_MOUSE_EVENTS( Pcb3D_GLCanvas::OnMouseEvent )
EVT_ERASE_BACKGROUND( Pcb3D_GLCanvas::OnEraseBackground )
EVT_MENU_RANGE( ID_POPUP_3D_VIEW_START, ID_POPUP_3D_VIEW_END,
Pcb3D_GLCanvas::OnPopUpMenu )
END_EVENT_TABLE()
/*************************************************************************/
Pcb3D_GLCanvas::Pcb3D_GLCanvas( WinEDA3D_DrawFrame* parent ) :
#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
wxGLCanvas( parent, -1, wxDefaultPosition, wxDefaultSize, wxFULL_REPAINT_ON_RESIZE )
wxGLCanvas( parent, -1, wxDefaultPosition, wxDefaultSize,
wxFULL_REPAINT_ON_RESIZE )
#endif
/*************************************************************************/
{
m_init = FALSE;
m_gllist = 0;
m_Parent = parent;
#if wxCHECK_VERSION( 2, 9, 0 )
// Explicitly create a new rendering context instance for this canvas.
m_glRC = new wxGLContext(this);
m_glRC = new wxGLContext( this );
#endif
DisplayStatus();
}
/*************************************/
Pcb3D_GLCanvas::~Pcb3D_GLCanvas()
/*************************************/
{
ClearLists();
m_init = FALSE;
......@@ -77,9 +75,7 @@ Pcb3D_GLCanvas::~Pcb3D_GLCanvas()
}
/*************************************/
void Pcb3D_GLCanvas::ClearLists()
/*************************************/
{
if( m_gllist > 0 )
glDeleteLists( m_gllist, 1 );
......@@ -87,18 +83,14 @@ void Pcb3D_GLCanvas::ClearLists()
}
/*********************************************/
void Pcb3D_GLCanvas::OnChar( wxKeyEvent& event )
/*********************************************/
{
SetView3D( event.GetKeyCode() );
event.Skip();
}
/*********************************************/
void Pcb3D_GLCanvas::SetView3D( int keycode )
/*********************************************/
{
int ii;
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 )
/********************************************************/
{
wxSize size( GetClientSize() );
double spin_quat[4];
......@@ -286,10 +276,14 @@ void Pcb3D_GLCanvas::OnMouseEvent( wxMouseEvent& event )
else if( event.MiddleIsDown() )
{
/* 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;
g_Draw3d_dx -= PAN_FACTOR * ( 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;
g_Draw3d_dx -= PAN_FACTOR *
( 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 */
......@@ -302,13 +296,9 @@ void Pcb3D_GLCanvas::OnMouseEvent( wxMouseEvent& event )
}
/*******************************************************/
void Pcb3D_GLCanvas::OnRightClick( wxMouseEvent& event )
/*******************************************************/
/* Construit et affiche un menu Popup lorsque on actionne le bouton droit
* de la souris
/* Construct and display a popup menu when the right button is clicked.
*/
void Pcb3D_GLCanvas::OnRightClick( wxMouseEvent& event )
{
wxPoint pos;
wxMenu PopUpMenu;
......@@ -383,9 +373,7 @@ void Pcb3D_GLCanvas::OnRightClick( wxMouseEvent& event )
}
/*******************************************************/
void Pcb3D_GLCanvas::OnPopUpMenu( wxCommandEvent& event )
/*******************************************************/
{
int key = 0;
......@@ -447,9 +435,7 @@ void Pcb3D_GLCanvas::OnPopUpMenu( wxCommandEvent& event )
}
/***************************************/
void Pcb3D_GLCanvas::DisplayStatus()
/***************************************/
{
wxString msg;
......@@ -464,30 +450,23 @@ void Pcb3D_GLCanvas::DisplayStatus()
}
/*************************************************/
void Pcb3D_GLCanvas::OnPaint( wxPaintEvent& event )
/*************************************************/
{
wxPaintDC dc( this );
Redraw();
event.Skip();
}
/***********************************************************/
void Pcb3D_GLCanvas::OnEraseBackground( wxEraseEvent& event )
/***********************************************************/
{
// Do nothing, to avoid flashing.
}
/****************************/
/* Initialize broad parameters for OpenGL */
void Pcb3D_GLCanvas::InitGL()
/****************************/
/* Int parametres generaux pour OPENGL
*/
{
wxSize size = GetClientSize();
......@@ -517,7 +496,9 @@ void Pcb3D_GLCanvas::InitGL()
}
/* 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 );
glLoadIdentity();
......@@ -541,17 +522,11 @@ void Pcb3D_GLCanvas::InitGL()
/* Setup light souces: */
SetLights();
}
/***********************************/
/* Initialize OpenGL light sources. */
void Pcb3D_GLCanvas::SetLights()
/***********************************/
/* Init sources lumineuses pour OPENGL
*/
{
double light;
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.
* 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 );
wxString FullFileName;
......@@ -599,15 +571,10 @@ void Pcb3D_GLCanvas::TakeScreenshot( wxCommandEvent& event )
fn.SetExt( file_ext );
FullFileName =
EDA_FileSelector( _( "3D Image filename:" ),
wxEmptyString, /* Chemin par defaut */
fn.GetFullName(), /* nom fichier par defaut */
file_ext, /* extension par defaut */
mask, /* Masque d'affichage */
this,
wxFD_SAVE,
TRUE
);
EDA_FileSelector( _( "3D Image filename:" ), wxEmptyString,
fn.GetFullName(), file_ext, mask, this,
wxFD_SAVE, TRUE );
if( FullFileName.IsEmpty() )
return;
}
......@@ -630,8 +597,9 @@ void Pcb3D_GLCanvas::TakeScreenshot( wxCommandEvent& event )
{
if( !wxTheClipboard->SetData( dobjBmp ) )
wxLogError( _T( "Failed to copy image to clipboard" ) );
wxTheClipboard->Flush(); /* the data on clipboard
* will stay available after the application exits */
wxTheClipboard->Flush(); /* the data in clipboard will stay
* available after the
* application exits */
wxTheClipboard->Close();
}
}
......@@ -640,7 +608,8 @@ void Pcb3D_GLCanvas::TakeScreenshot( wxCommandEvent& event )
wxImage image = bitmap.ConvertToImage();
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" ) );
image.Destroy();
......
/////////////////////////////////////////////////////////////////////////////
// Name: 3d_class.cpp
/////////////////////////////////////////////////////////////////////////////
......@@ -14,18 +13,14 @@
#include "3d_viewer.h"
/****************************/
S3D_Vertex::S3D_Vertex()
/****************************/
{
x = y = z = 0.0;
}
/**************************************************************************/
S3D_MATERIAL::S3D_MATERIAL( S3D_MASTER* father, const wxString& name ) :
EDA_BaseStruct( father, NOT_USED )
/**************************************************************************/
{
m_DiffuseColor.x = m_DiffuseColor.y = m_DiffuseColor.z = 1.0;
m_SpecularColor.x = m_SpecularColor.y = m_SpecularColor.z = 1.0;
......@@ -36,9 +31,7 @@ S3D_MATERIAL::S3D_MATERIAL( S3D_MASTER* father, const wxString& name ) :
}
/***********************************/
void S3D_MATERIAL::SetMaterial()
/***********************************/
{
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
glColor4f( m_DiffuseColor.x * m_AmbientIntensity,
......@@ -53,9 +46,7 @@ void S3D_MATERIAL::SetMaterial()
}
/****************************************************/
void S3D_MASTER::Copy( S3D_MASTER* pattern )
/****************************************************/
{
m_Shape3DName = pattern->m_Shape3DName;
m_MatScale = pattern->m_MatScale;
......@@ -66,10 +57,8 @@ void S3D_MASTER::Copy( S3D_MASTER* pattern )
}
/***************************************************************/
S3D_MASTER::S3D_MASTER( EDA_BaseStruct* aParent ) :
EDA_BaseStruct( aParent, NOT_USED )
/***************************************************************/
{
m_MatScale.x = m_MatScale.y = m_MatScale.z = 1.0;
m_3D_Drawings = NULL;
......@@ -77,9 +66,7 @@ S3D_MASTER::S3D_MASTER( EDA_BaseStruct* aParent ) :
}
/***************************************/
S3D_MASTER:: ~S3D_MASTER()
/***************************************/
{
Struct3D_Shape* next;
S3D_MATERIAL* nextmat;
......@@ -98,10 +85,8 @@ S3D_MASTER:: ~S3D_MASTER()
}
/***************************************************************/
Struct3D_Shape::Struct3D_Shape( EDA_BaseStruct* aParent ) :
EDA_BaseStruct( aParent, NOT_USED )
/***************************************************************/
{
m_3D_Coord = NULL;
m_3D_CoordIndex = NULL;
......@@ -109,9 +94,7 @@ Struct3D_Shape::Struct3D_Shape( EDA_BaseStruct* aParent ) :
}
/***************************************/
Struct3D_Shape:: ~Struct3D_Shape()
/***************************************/
{
delete m_3D_Coord;
delete m_3D_CoordIndex;
......
This diff is collapsed.
/////////////////////////////////////////////////////////////////////////////
// Name: 3d_frame.cpp
/////////////////////////////////////////////////////////////////////////////
......@@ -30,7 +29,7 @@ double g_Draw3d_dx;
double g_Draw3d_dy;
double ZBottom;
double ZTop;
double DataScale3D; // coeff de conversion unites utilsateut -> unites 3D
double DataScale3D; // 3D conversion units.
BEGIN_EVENT_TABLE( WinEDA3D_DrawFrame, wxFrame )
......@@ -45,20 +44,18 @@ BEGIN_EVENT_TABLE( WinEDA3D_DrawFrame, wxFrame )
EVT_CLOSE( WinEDA3D_DrawFrame::OnCloseWindow )
END_EVENT_TABLE()
/*******************************************************************/
WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent,
const wxString& title,
long style ) :
wxFrame( parent, DISPLAY3D_FRAME, title,
wxPoint( -1, -1 ), wxSize( -1, -1 ), style )
/*******************************************************************/
wxFrame( parent, DISPLAY3D_FRAME, title, wxPoint( -1, -1 ),
wxSize( -1, -1 ), style )
{
m_FrameName = wxT( "Frame3D" );
m_Canvas = NULL;
m_Parent = parent;
m_HToolBar = NULL;
m_VToolBar = NULL;
m_InternalUnits = 10000; // Unites internes = 1/10000 inch
m_InternalUnits = 10000; // Internal units = 1/10000 inch
// Give it an icon
SetIcon( wxICON( icon_w3d ) );
......@@ -80,44 +77,41 @@ WinEDA3D_DrawFrame::WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent,
// Make a Pcb3D_GLCanvas
m_Canvas = new Pcb3D_GLCanvas( this );
#if KICAD_AUIMANAGER
m_auimgr.SetManagedWindow(this);
m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz;
horiz.Gripper(false);
horiz.DockFixed(true);
horiz.Movable(false);
horiz.Floatable(false);
horiz.CloseButton(false);
horiz.CaptionVisible(false);
horiz.Gripper( false );
horiz.DockFixed( true );
horiz.Movable( false );
horiz.Floatable( false );
horiz.CloseButton( false );
horiz.CaptionVisible( false );
wxAuiPaneInfo vert(horiz);
wxAuiPaneInfo vert( horiz );
vert.TopDockable(false).BottomDockable(false);
horiz.LeftDockable(false).RightDockable(false);
vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false );
m_auimgr.AddPane(m_HToolBar,
wxAuiPaneInfo(horiz).Name(wxT("m_HToolBar")).Top());
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top() );
m_auimgr.AddPane(m_Canvas,
wxAuiPaneInfo().Name(wxT("DrawFrame")).CentrePane());
m_auimgr.AddPane( m_Canvas,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
m_auimgr.Update();
#endif
}
/***********************************************************/
void WinEDA3D_DrawFrame::Exit3DFrame( wxCommandEvent& event )
/***********************************************************/
{
Close( TRUE );
}
/***********************************************************/
void WinEDA3D_DrawFrame::OnCloseWindow( wxCloseEvent& Event )
/***********************************************************/
{
SaveSettings();
if( m_Parent )
......@@ -128,12 +122,11 @@ void WinEDA3D_DrawFrame::OnCloseWindow( wxCloseEvent& Event )
}
/******************************************/
void WinEDA3D_DrawFrame::GetSettings()
/******************************************/
{
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 )
{
......@@ -161,12 +154,11 @@ void WinEDA3D_DrawFrame::GetSettings()
}
/*******************************************/
void WinEDA3D_DrawFrame::SaveSettings()
/*******************************************/
{
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 )
return;
......@@ -192,9 +184,7 @@ void WinEDA3D_DrawFrame::SaveSettings()
}
/***********************************************************/
void WinEDA3D_DrawFrame::Process_Zoom( wxCommandEvent& event )
/***********************************************************/
{
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::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu )
/*******************************************************************************/
void WinEDA3D_DrawFrame::OnRightClick( const wxPoint& MousePos,
wxMenu* PopMenu )
{
}
/************************************/
int WinEDA3D_DrawFrame::BestZoom()
/************************************/
// Retourne le meilleur zoom
{
return 1;
}
/*******************************************************************/
void WinEDA3D_DrawFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
/*******************************************************************/
{
}
/************************************************************************/
void WinEDA3D_DrawFrame::Process_Special_Functions( wxCommandEvent& event )
/************************************************************************/
{
#define ROT_ANGLE 10.0
......@@ -354,8 +333,8 @@ void WinEDA3D_DrawFrame::Process_Special_Functions( wxCommandEvent& event )
return;
default:
wxMessageBox(
wxT( "WinEDA3D_DrawFrame::Process_Special_Functions() error: unknown command" ) );
wxMessageBox( wxT( "WinEDA3D_DrawFrame::Process_Special_Functions() \
error: unknown command" ) );
return;
}
......@@ -364,24 +343,20 @@ void WinEDA3D_DrawFrame::Process_Special_Functions( wxCommandEvent& event )
}
/*****************************************/
void WinEDA3D_DrawFrame::NewDisplay()
/*****************************************/
{
m_Canvas->ClearLists();
m_Canvas->CreateDrawGL_List();
// m_Canvas->InitGL();
m_Canvas->Refresh( true );
m_Canvas->DisplayStatus();
}
/******************************************/
void WinEDA3D_DrawFrame::Set3DBgColor()
/******************************************/
/* called to set the background color of the 3D scene
*/
void WinEDA3D_DrawFrame::Set3DBgColor()
{
S3D_Color color;
wxColour newcolor, oldcolor;
......@@ -401,9 +376,7 @@ void WinEDA3D_DrawFrame::Set3DBgColor()
}
/******************************************/
void WinEDA3D_DrawFrame::Set3DAxisOnOff()
/******************************************/
{
if( g_Parm_3D_Visu.m_Draw3DAxis )
g_Parm_3D_Visu.m_Draw3DAxis = FALSE;
......@@ -413,9 +386,7 @@ void WinEDA3D_DrawFrame::Set3DAxisOnOff()
}
/******************************************/
void WinEDA3D_DrawFrame::Set3DModuleOnOff()
/******************************************/
{
if( g_Parm_3D_Visu.m_Draw3DModule )
g_Parm_3D_Visu.m_Draw3DModule = FALSE;
......@@ -425,9 +396,7 @@ void WinEDA3D_DrawFrame::Set3DModuleOnOff()
}
/******************************************/
void WinEDA3D_DrawFrame::Set3DZoneOnOff()
/******************************************/
{
if( g_Parm_3D_Visu.m_Draw3DZone )
g_Parm_3D_Visu.m_Draw3DZone = FALSE;
......@@ -437,9 +406,7 @@ void WinEDA3D_DrawFrame::Set3DZoneOnOff()
}
/******************************************/
void WinEDA3D_DrawFrame::Set3DCommentsOnOff()
/******************************************/
{
if( g_Parm_3D_Visu.m_Draw3DComments )
g_Parm_3D_Visu.m_Draw3DComments = FALSE;
......@@ -449,9 +416,7 @@ void WinEDA3D_DrawFrame::Set3DCommentsOnOff()
}
/******************************************/
void WinEDA3D_DrawFrame::Set3DDrawingsOnOff()
/******************************************/
{
if( g_Parm_3D_Visu.m_Draw3DDrawings )
g_Parm_3D_Visu.m_Draw3DDrawings = FALSE;
......@@ -461,9 +426,7 @@ void WinEDA3D_DrawFrame::Set3DDrawingsOnOff()
}
/******************************************/
void WinEDA3D_DrawFrame::Set3DEco1OnOff()
/******************************************/
{
if( g_Parm_3D_Visu.m_Draw3DEco1 )
g_Parm_3D_Visu.m_Draw3DEco1 = FALSE;
......@@ -473,9 +436,7 @@ void WinEDA3D_DrawFrame::Set3DEco1OnOff()
}
/******************************************/
void WinEDA3D_DrawFrame::Set3DEco2OnOff()
/******************************************/
{
if( g_Parm_3D_Visu.m_Draw3DEco2 )
g_Parm_3D_Visu.m_Draw3DEco2 = FALSE;
......
/////////////////////////////////////////////////////////////////////////////
// Name: 3d_read_mesh.cpp
/////////////////////////////////////////////////////////////////////////////
......@@ -18,9 +17,7 @@
#include "3d_viewer.h"
/***********************************/
int S3D_MASTER:: ReadData()
/************************************/
int S3D_MASTER::ReadData()
{
char line[1024], * text;
wxFileName fn;
......@@ -34,7 +31,7 @@ int S3D_MASTER:: ReadData()
}
if( wxFileName::FileExists(m_Shape3DName) )
if( wxFileName::FileExists( m_Shape3DName ) )
FullFilename = m_Shape3DName;
else
{
......@@ -56,8 +53,9 @@ int S3D_MASTER:: ReadData()
return -1;
}
// Switch the locale to standard C (needed to print floating point numbers like 1.3)
SetLocaleTo_C_standard( );
// Switch the locale to standard C (needed to print floating point
// numbers like 1.3)
SetLocaleTo_C_standard();
while( GetLine( file, line, &LineNum, 512 ) )
{
text = strtok( line, " \t\n\r" );
......@@ -79,34 +77,30 @@ int S3D_MASTER:: ReadData()
}
fclose( file );
SetLocaleTo_Default( ); // revert to the current locale
SetLocaleTo_Default(); // revert to the current locale
return 0;
}
/*********************************************************/
int S3D_MASTER:: ReadMaterial( FILE* file, int* LineNum )
/*********************************************************/
/*
* analyse la description du type:
* material DEF yellow Material {
* diffuseColor 1.00000 1.00000 0.00000e+0
* emissiveColor 0.00000e+0 0.00000e+0 0.00000e+0
* specularColor 1.00000 1.00000 1.00000
* ambientIntensity 1.00000
* transparency 0.00000e+0
* shininess 1.00000
* }
* ou du type:
* material USE yellow
* Analyzes the description of the type:
* DEF yellow material Material (
* DiffuseColor 1.00000 1.00000 0.00000e 0
* EmissiveColor 0.00000e 0 0.00000e 0 0.00000e 0
* SpecularColor 1.00000 1.00000 1.00000
* AmbientIntensity 1.00000
* Transparency 0.00000e 0
* Shininess 1.00000
*)
* Or type:
* USE yellow material
*/
int S3D_MASTER:: ReadMaterial( FILE* file, int* LineNum )
{
char line[512], * text, * command;
wxString mat_name;
S3D_MATERIAL* material = NULL;
// Lecture de la commande:
command = strtok( NULL, " \t\n\r" );
text = strtok( NULL, " \t\n\r" );
mat_name = CONV_FROM_UTF8( text );
......@@ -189,9 +183,7 @@ int S3D_MASTER:: ReadMaterial( FILE* file, int* LineNum )
}
/**********************************************************/
int S3D_MASTER::ReadChildren( FILE* file, int* LineNum )
/***********************************************************/
{
char line[1024], * text;
......@@ -218,9 +210,7 @@ int S3D_MASTER::ReadChildren( FILE* file, int* LineNum )
}
/********************************************************/
int S3D_MASTER::ReadShape( FILE* file, int* LineNum )
/********************************************************/
{
char line[1024], * text;
int err = 1;
......@@ -253,9 +243,7 @@ int S3D_MASTER::ReadShape( FILE* file, int* LineNum )
}
/*************************************************************/
int S3D_MASTER::ReadAppearance( FILE* file, int* LineNum )
/*************************************************************/
{
char line[1024], * text;
int err = 1;
......@@ -285,11 +273,7 @@ int S3D_MASTER::ReadAppearance( FILE* file, int* LineNum )
#define BUFSIZE 2000
/************************************************************************************/
double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize, int* LineNum )
/************************************************************************************/
/* Read a coordinate liste like:
/* Read a coordinate list like:
* coord Coordinate { point [
* -5.24489 6.57640e-3 -9.42129e-2,
* -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 :
* "coord Coordinate { point ["
*/
double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize,
int* LineNum )
{
double* data_list = NULL;
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 )
{
nn *= 2;
data_list = (double*) realloc( data_list, ( nn * sizeof(double) ) );
data_list =
(double*) realloc( data_list, ( nn * sizeof(double) ) );
}
HasData = FALSE;
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 )
/***********************************************************/
{
char line[1024], buffer[1024], * text;
int err = 1;
......@@ -430,7 +415,8 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
if( stricmp( text, "normal" ) == 0 )
{
int coord_number;
double* buf_points = ReadCoordsList( file, line, &coord_number, LineNum );
double* buf_points = ReadCoordsList( file, line, &coord_number,
LineNum );
continue;
free( buf_points );
continue;
......@@ -457,7 +443,8 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
if( stricmp( text, "color" ) == 0 )
{
int coord_number;
double* buf_points = ReadCoordsList( file, line, &coord_number, LineNum );
double* buf_points = ReadCoordsList( file, line, &coord_number,
LineNum );
continue;
free( buf_points );
continue;
......@@ -544,9 +531,7 @@ int S3D_MASTER::ReadGeometry( FILE* file, int* LineNum )
}
/*********************************************************/
int Struct3D_Shape:: ReadData( FILE* file, int* LineNum )
/*********************************************************/
{
char line[512];
......
/********************************************************/
/* 3d_struct.h : definition des structures de donnees */
/* pour la representation 3D des modules */
/********************************************************/
/*****************/
/* 3d_struct.h */
/*****************/
#ifndef STRUCT_3D_H
#define STRUCT_3D_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
class S3D_MASTER;
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:
double m_Red, m_Green, m_Blue;
public:
S3D_Color() {
public: S3D_Color()
{
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:
double x, y, z;
public:
S3D_Vertex();
public: S3D_Vertex();
};
class S3D_MATERIAL : public EDA_BaseStruct /* openGL "material" data*/
......@@ -45,8 +45,7 @@ public:
float m_Transparency;
float m_Shininess;
public:
S3D_MATERIAL( S3D_MASTER * father, const wxString &name );
public: S3D_MATERIAL( S3D_MASTER* father, const wxString& name );
S3D_MATERIAL* Next() const { return (S3D_MATERIAL*) Pnext; }
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 */
class S3D_MASTER : public EDA_BaseStruct
{
public:
wxString m_Shape3DName; /* 3D shape name in 3D library */
......@@ -68,9 +65,7 @@ public:
Struct3D_Shape* m_3D_Drawings;
S3D_MATERIAL* m_Materials;
public:
S3D_MASTER( EDA_BaseStruct * aParent );
public: S3D_MASTER( EDA_BaseStruct* aParent );
~S3D_MASTER();
S3D_MASTER* Next() const { return (S3D_MASTER*) Pnext; }
......@@ -82,6 +77,7 @@ public:
m_Materials = aMaterial;
}
void Copy( S3D_MASTER* pattern );
int ReadData();
int ReadMaterial( FILE* file, int* LineNum );
......@@ -93,19 +89,15 @@ public:
};
/*********************************************/
/* Describes a complex 3D */
class Struct3D_Shape : public EDA_BaseStruct
/*********************************************/
/* decrit une forme complexe 3D */
{
public:
S3D_Vertex* m_3D_Coord;
int* m_3D_CoordIndex;
int m_3D_Points;
public:
Struct3D_Shape( EDA_BaseStruct * aParent );
public: Struct3D_Shape( EDA_BaseStruct* aParent );
~Struct3D_Shape();
Struct3D_Shape* Next() const { return (Struct3D_Shape*) Pnext; }
......@@ -115,12 +107,9 @@ public:
};
/*****************************************************************/
/* Classe pour afficher et editer un Vertex (triplet de valeurs),*/
/* en INCHES ou MM ou sans unites */
/*****************************************************************/
/* internal_unit is the internal unit number by inch:
/* Display and edit a Vertex (triplet of values) in INCHES or MM or without
* units.
* internal_unit is the internal unit number by inch:
* - 1000 for EESchema
* - 10000 for PcbNew
*/
......@@ -133,11 +122,8 @@ private:
wxStaticText* m_Text;
public:
// Constructor and destructor
WinEDA_VertexCtrl( wxWindow * parent, const wxString &title,
wxBoxSizer * BoxSizer,
int units, int internal_unit );
WinEDA_VertexCtrl( wxWindow* parent, const wxString& title,
wxBoxSizer* BoxSizer, int units, int internal_unit );
~WinEDA_VertexCtrl();
......
/*******************************************************************/
/* 3d_toolbar.cpp: construction des tool bars de la frame visu 3d */
/*******************************************************************/
/********************/
/* 3d_toolbar.cpp */
/********************/
#include "fctsys.h"
#include "macros.h"
......@@ -9,27 +9,30 @@
#include "3d_viewer.h"
/*********************************************/
void WinEDA3D_DrawFrame::ReCreateHToolbar()
/*********************************************/
{
if( m_HToolBar != NULL )
{ // simple mise a jour de la liste des fichiers anciens
{
// Simple update to the list of old files.
SetToolbars();
return;
}
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );
#if !KICAD_AUIMANAGER
SetToolBar( (wxToolBar*)m_HToolBar );
SetToolBar( (wxToolBar*) m_HToolBar );
#endif
// Set up toolbar
m_HToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,
wxBitmap( import3d_xpm ),
_( "Reload board" ) );
#if (defined(__WINDOWS__) || defined(__APPLE__)) // do not work properly under linux
m_HToolBar-> AddSeparator();
#if (defined(__WINDOWS__) || defined(__APPLE__ ) )
// Does not work properly under linux
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_TOOL_SCREENCOPY_TOCLIBBOARD, wxEmptyString,
wxBitmap( copy_button ),
......@@ -85,33 +88,29 @@ void WinEDA3D_DrawFrame::ReCreateHToolbar()
_( "Move right ->" ) );
m_HToolBar->AddTool( ID_MOVE3D_UP, wxEmptyString, wxBitmap( up_xpm ),
_( "Move Up ^" ) );
_( "Move up ^" ) );
m_HToolBar->AddTool( ID_MOVE3D_DOWN, wxEmptyString, wxBitmap( down_xpm ),
_( "Move Down" ) );
_( "Move down" ) );
m_HToolBar->Realize();
// SetToolbars();
}
/*********************************************/
void WinEDA3D_DrawFrame::ReCreateVToolbar()
/*********************************************/
{
}
/**********************************************/
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 ( m_Parent->m_FrameName == wxT( "CmpFrame" ) ) // Called from cvpcb !
full_options = false; // Do not display all options
// If called from the display frame of cvpcb, only some options are
// relevant
if( m_Parent->m_FrameName == wxT( "CmpFrame" ) ) // Called from cvpcb !
full_options = false; // Do not display all
// options
wxMenuBar* menuBar = new wxMenuBar;
......@@ -119,8 +118,10 @@ bool full_options = true;
menuBar->Append( fileMenu, _( "&File" ) );
fileMenu->Append( ID_MENU_SCREENCOPY_PNG, _( "Create Image (png format)" ) );
fileMenu->Append( ID_MENU_SCREENCOPY_JPEG, _( "Create Image (jpeg format)" ) );
fileMenu->Append( ID_MENU_SCREENCOPY_PNG,
_( "Create Image (png format)" ) );
fileMenu->Append( ID_MENU_SCREENCOPY_JPEG,
_( "Create Image (jpeg format)" ) );
fileMenu->AppendSeparator();
fileMenu->Append( wxID_EXIT, _( "&Exit" ) );
......@@ -133,7 +134,7 @@ bool full_options = true;
ADD_MENUITEM( referencesMenu, ID_MENU3D_AXIS_ONOFF,
_( "3D Axis On/Off" ), axis3d_front_xpm );
if ( full_options )
if( full_options )
{
ADD_MENUITEM( referencesMenu, ID_MENU3D_MODULE_ONOFF,
_( "3D Footprints Shapes On/Off" ), shape_3d_xpm );
......@@ -158,8 +159,6 @@ bool full_options = true;
}
/*****************************************/
void WinEDA3D_DrawFrame::SetToolbars()
/*****************************************/
{
}
......@@ -26,10 +26,10 @@
#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.
......@@ -115,22 +115,23 @@ public:
wxPoint m_BoardPos;
wxSize m_BoardSize;
int m_Layers;
EDA_BoardDesignSettings * m_BoardSettings; // Link to current board design settings
double m_Epoxy_Width; /* Epoxy tickness (normalized) */
EDA_BoardDesignSettings* m_BoardSettings; // Link to current board design
// settings
double m_Epoxy_Width; /* Epoxy thickness (normalized)
**/
double m_BoardScale; /* Normalisation scale for coordinates:
when scaled tey are between -1.0 and +1.0 */
double m_BoardScale; /* Normalization scale for coordinates:
* when scaled between -1.0 and +1.0 */
double m_LayerZcoord[32];
public:
Info_3D_Visu();
public: Info_3D_Visu();
~Info_3D_Visu();
};
class Pcb3D_GLCanvas: public wxGLCanvas
class Pcb3D_GLCanvas : public wxGLCanvas
{
public:
WinEDA3D_DrawFrame * m_Parent;
WinEDA3D_DrawFrame* m_Parent;
private:
bool m_init;
......@@ -139,21 +140,21 @@ private:
wxGLContext* m_glRC;
#endif
public:
Pcb3D_GLCanvas( WinEDA3D_DrawFrame *parent );
Pcb3D_GLCanvas( WinEDA3D_DrawFrame* parent );
~Pcb3D_GLCanvas();
void ClearLists();
void OnPaint(wxPaintEvent& event);
void OnEraseBackground(wxEraseEvent& event);
void OnChar(wxKeyEvent& event);
void OnMouseEvent(wxMouseEvent& event);
void OnRightClick(wxMouseEvent& event);
void OnPopUpMenu(wxCommandEvent & event);
void TakeScreenshot(wxCommandEvent & event);
void SetView3D(int keycode);
void OnPaint( wxPaintEvent& event );
void OnEraseBackground( wxEraseEvent& event );
void OnChar( wxKeyEvent& event );
void OnMouseEvent( wxMouseEvent& event );
void OnRightClick( wxMouseEvent& event );
void OnPopUpMenu( wxCommandEvent& event );
void TakeScreenshot( wxCommandEvent& event );
void SetView3D( int keycode );
void DisplayStatus();
void Redraw(bool finish = false);
void Redraw( bool finish = false );
GLuint DisplayCubeforTest();
void OnEnterWindow( wxMouseEvent& event );
......@@ -162,23 +163,24 @@ public:
GLuint CreateDrawGL_List();
void InitGL();
void SetLights();
void Draw3D_Track(TRACK * track);
void Draw3D_Via(SEGVIA * via);
void Draw3D_DrawSegment(DRAWSEGMENT * segment);
void Draw3D_DrawText(TEXTE_PCB * text);
void Draw3D_Track( TRACK* track );
void Draw3D_Via( SEGVIA* via );
void Draw3D_DrawSegment( DRAWSEGMENT* segment );
void Draw3D_DrawText( TEXTE_PCB* text );
//int Get3DLayerEnable(int act_layer);
DECLARE_EVENT_TABLE()
DECLARE_EVENT_TABLE()
};
class WinEDA3D_DrawFrame: public wxFrame
class WinEDA3D_DrawFrame : public wxFrame
{
public:
WinEDA_BasePcbFrame * m_Parent;
Pcb3D_GLCanvas * m_Canvas;
WinEDA_Toolbar * m_HToolBar;
WinEDA_Toolbar * m_VToolBar;
WinEDA_BasePcbFrame* m_Parent;
Pcb3D_GLCanvas* m_Canvas;
WinEDA_Toolbar* m_HToolBar;
WinEDA_Toolbar* m_VToolBar;
int m_InternalUnits;
wxPoint m_FramePos;
wxSize m_FrameSize;
......@@ -187,17 +189,17 @@ public:
wxAuiManager m_auimgr;
~WinEDA3D_DrawFrame() { m_auimgr.UnInit(); };
#endif
private:
wxString m_FrameName; // name used for writting and reading setup
wxString m_FrameName; // name used for writing and reading setup
// It is "Frame3D"
public:
WinEDA3D_DrawFrame( WinEDA_BasePcbFrame * parent,
const wxString& title,
WinEDA3D_DrawFrame( WinEDA_BasePcbFrame* parent, const wxString& title,
long style = KICAD_DEFAULT_3D_DRAWFRAME_STYLE );
void Exit3DFrame(wxCommandEvent& event);
void OnCloseWindow(wxCloseEvent & Event);
void Exit3DFrame( wxCommandEvent& event );
void OnCloseWindow( wxCloseEvent& Event );
void ReCreateMenuBar();
void ReCreateHToolbar();
void ReCreateVToolbar();
......@@ -205,13 +207,13 @@ public:
void GetSettings();
void SaveSettings();
void OnLeftClick(wxDC * DC, const wxPoint& MousePos);
void OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu);
void OnKeyEvent(wxKeyEvent& event);
int BestZoom(); // Retourne le meilleur zoom
void RedrawActiveWindow(wxDC * DC, bool EraseBg);
void Process_Special_Functions(wxCommandEvent& event);
void Process_Zoom(wxCommandEvent& event);
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void OnKeyEvent( wxKeyEvent& event );
int BestZoom();
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void Process_Special_Functions( wxCommandEvent& event );
void Process_Zoom( wxCommandEvent& event );
void NewDisplay();
void Set3DBgColor();
......@@ -227,13 +229,13 @@ public:
DECLARE_EVENT_TABLE()
};
void SetGLColor(int color);
void Set_Object_Data(const S3D_Vertex * coord, int nbcoord );
void SetGLColor( int color );
void Set_Object_Data( const S3D_Vertex* coord, int nbcoord );
extern Info_3D_Visu g_Parm_3D_Visu;
extern double g_Draw3d_dx, g_Draw3d_dy;
extern double ZBottom, ZTop;
extern double DataScale3D; // coeff de conversion unites utilsateut -> unites 3D
extern double DataScale3D; // 3D scale units.
extern int gl_attrib[];
#endif /* __3D_VIEWER_H__ */
......@@ -687,13 +687,12 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
if( Struct->Type() == DRAW_SHEET_STRUCT_TYPE )
{
// Add all pins sheets of a selected hierarchical sheet to the list
Hierarchical_PIN_Sheet_Struct* SLabel =
( (DrawSheetStruct*) Struct )->m_Label;
SCH_SHEET_PIN* SLabel = ( (SCH_SHEET*) Struct )->m_Label;
while( SLabel )
{
if( SLabel->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE )
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
*/
SCH_ITEM* DrawList;
Hierarchical_PIN_Sheet_Struct* PinLabel;
SCH_SHEET_PIN* PinLabel;
DrawSheetPath* sheet;
/* Build the sheet list */
......@@ -327,7 +327,7 @@ static void GenListeGLabels( std::vector <LABEL_OBJECT>& aList )
case DRAW_SHEET_STRUCT_TYPE:
{
PinLabel = ( (DrawSheetStruct*) DrawList )->m_Label;
PinLabel = ( (SCH_SHEET*) DrawList )->m_Label;
while( PinLabel != NULL )
{
labet_object.m_LabelType =
......@@ -427,12 +427,12 @@ bool SortLabelsByValue( const LABEL_OBJECT& obj1, const LABEL_OBJECT& obj2 )
wxString* Text1, * Text2;
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
Text1 = &( (SCH_TEXT*) (obj1.m_Label) )->m_Text;
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
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( 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
Text1 = ( (SCH_TEXT*) obj1.m_Label )->m_Text;
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
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;
Hierarchical_PIN_Sheet_Struct* DrawSheetLabel;
SCH_SHEET_PIN* DrawSheetLabel;
wxString msg, sheetpath;
wxString labeltype;
......@@ -835,8 +835,7 @@ static int PrintListeGLabel( FILE* f, std::vector <LABEL_OBJECT>& aList )
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
{
DrawSheetLabel =
(Hierarchical_PIN_Sheet_Struct*) aList[ii].m_Label;
DrawSheetLabel = (SCH_SHEET_PIN*) aList[ii].m_Label;
int jj = DrawSheetLabel->m_Shape;
if( jj < 0 )
jj = NET_TMAX;
......
......@@ -795,7 +795,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
EDA_BaseStruct* item;
LIB_PIN* pin;
SCH_COMPONENT* LibItem = NULL;
Hierarchical_PIN_Sheet_Struct* pinsheet;
SCH_SHEET_PIN* pinsheet;
wxPoint itempos;
switch( layer )
......
This diff is collapsed.
......@@ -7,17 +7,19 @@
#include "base_struct.h"
extern DrawSheetStruct* g_RootSheet;
/* class Hierarchical_PIN_Sheet_Struct
* a Hierarchical_PIN_Sheet_Struct is for a hierarchical sheet like a pin for
* a component
* At root level, a Hierarchical_PIN_Sheet_Struct must be connected to a wire,
* bus or label
* A sheet level it corresponds to a hierarchical label.
extern SCH_SHEET* g_RootSheet;
/**
* Pin (label) used in sheets to create hierarchical schematics.
*
* A SCH_SHEET_PIN is used to create a hierarchical sheet in the same way a
* pin is used in a component. It connects the ojects in the sheet object
* 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,
public EDA_TextStruct
class SCH_SHEET_PIN : public SCH_ITEM, public EDA_TextStruct
{
public:
int m_Edge, m_Shape;
......@@ -26,23 +28,23 @@ public:
// m_Number >= 2
// 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 wxString& text = wxEmptyString );
~Hierarchical_PIN_Sheet_Struct() { }
~SCH_SHEET_PIN() { }
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,
......@@ -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
* for a sub schematic
*/
class DrawSheetStruct : public SCH_ITEM
class SCH_SHEET : public SCH_ITEM
{
public:
wxString m_SheetName; /* this is equivalent to C101 for
......@@ -132,22 +134,23 @@ public:
wxPoint m_Pos;
wxSize m_Size; /* Position and Size of *sheet symbol */
int m_Layer;
Hierarchical_PIN_Sheet_Struct* m_Label; /* Points Be connection, linked
SCH_SHEET_PIN* m_Label; /* Points Be connection, linked
* list.*/
int m_NbLabel; /* Pins sheet (corresponding to
* hierarchical labels) count */
SCH_SCREEN* m_AssociatedScreen; /* Associated Screen which
* handle the physical data
* In complex hierarchies we
* can have many DrawSheetStruct
* can have many SCH_SHEET
* using the same data
*/
public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
~DrawSheetStruct();
public:
SCH_SHEET( const wxPoint& pos = wxPoint( 0, 0 ) );
~SCH_SHEET();
virtual wxString GetClass() const
{
return wxT( "DrawSheetStruct" );
return wxT( "SCH_SHEET" );
}
......@@ -161,7 +164,7 @@ public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
bool Save( FILE* aFile ) const;
void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
DrawSheetStruct* GenCopy();
SCH_SHEET* GenCopy();
void DisplayInfo( WinEDA_DrawFrame* frame );
/** Function CleanupSheet
......@@ -202,7 +205,7 @@ public: DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
*/
EDA_Rect GetBoundingBox();
void SwapData( DrawSheetStruct* copyitem );
void SwapData( SCH_SHEET* copyitem );
/** Function ComponentCount
* 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,
const wxString& aFileName );
//void RemoveSheet(DrawSheetStruct* sheet);
//void RemoveSheet(SCH_SHEET* sheet);
//to remove a sheet, just delete it
//-- 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 )
{
m_Pos += aMoveVector;
Hierarchical_PIN_Sheet_Struct* label = m_Label;
SCH_SHEET_PIN* label = m_Label;
while( label != NULL )
{
label->Move( aMoveVector );
......
/////////////////////////////////////////////////////////////////////////////
// Name: class_drawsheet.cpp
// Purpose: member functions for DrawSheetStruct
// Purpose: member functions for SCH_SHEET
// header = class_drawsheet.h
// Author: jean-pierre Charras
// Modified by:
......@@ -54,7 +54,7 @@ bool DrawSheetPath::BuildSheetPathInfoFromSheetPathValue(
{
if( schitem->Type() == DRAW_SHEET_STRUCT_TYPE )
{
DrawSheetStruct* sheet = (DrawSheetStruct*) schitem;
SCH_SHEET* sheet = (SCH_SHEET*) schitem;
Push( sheet );
if( aPath == Path() )
return true;
......@@ -102,7 +102,7 @@ int DrawSheetPath::Cmp( const DrawSheetPath& aSheetPathToTest ) const
* returns a pointer to the last sheet of the list
* One can see the others sheet as the "path" to reach this last sheet
*/
DrawSheetStruct* DrawSheetPath::Last()
SCH_SHEET* DrawSheetPath::Last()
{
if( m_numSheets )
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
* 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 )
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
* 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 )
{
......@@ -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.
......@@ -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
......@@ -375,7 +375,7 @@ void EDA_SheetList::BuildSheetList( DrawSheetStruct* aSheet )
{
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
{
DrawSheetStruct* sheet = (DrawSheetStruct*) strct;
SCH_SHEET* sheet = (SCH_SHEET*) strct;
BuildSheetList( sheet );
}
strct = strct->Next();
......
......@@ -70,7 +70,7 @@ private:
public:
#define DSLSZ 32 // Max number of levels for a sheet path
DrawSheetStruct * m_sheets[DSLSZ];
SCH_SHEET * m_sheets[DSLSZ];
public: DrawSheetPath();
~DrawSheetPath() { };
......@@ -97,7 +97,7 @@ public: DrawSheetPath();
* returns a pointer to the last sheet of the list
* One can see the others sheet as the "path" to reach this last sheet
*/
DrawSheetStruct* Last();
SCH_SHEET* Last();
/** Function LastScreen
* @return the SCH_SCREEN relative to the last sheet in list
......@@ -112,19 +112,19 @@ public: DrawSheetPath();
/** Function Push
* 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
* This is like cd <directory> in directories navigation
*/
void Push( DrawSheetStruct* aSheet );
void Push( SCH_SHEET* aSheet );
/** Function Pop
* 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
* This is like cd .. in directories navigation
*/
DrawSheetStruct* Pop();
SCH_SHEET* Pop();
/** Function Path
* 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
* So usually call it with no param.
*/
EDA_SheetList( DrawSheetStruct* aSheet = NULL );
EDA_SheetList( SCH_SHEET* aSheet = NULL );
~EDA_SheetList()
{
......@@ -243,7 +243,7 @@ private:
* if aSheet = g_RootSheet, the full sheet path and sheet list is built
* @param aSheet = the starting sheet from the built is made
*/
void BuildSheetList( DrawSheetStruct* sheet );
void BuildSheetList( SCH_SHEET* sheet );
};
#endif /* CLASS_DRAWSHEET_PATH_H */
/////////////////////////////////////////////////////////////////////////////
// Name: class_hierarchical_PIN_sheet.cpp
// Purpose: member functions Hierarchical_PIN_Sheet_Struct
// Purpose: member functions SCH_SHEET_PIN
// header = class_drawsheet.h
// Author: jean-pierre Charras
// Modified by:
......@@ -23,8 +23,7 @@
/*******************************************************************/
Hierarchical_PIN_Sheet_Struct::Hierarchical_PIN_Sheet_Struct(
DrawSheetStruct* parent,
SCH_SHEET_PIN::SCH_SHEET_PIN( SCH_SHEET* parent,
const wxPoint& pos,
const wxString& text ) :
SCH_ITEM( parent, DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ),
......@@ -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 =
new Hierarchical_PIN_Sheet_Struct( (DrawSheetStruct*) m_Parent, m_Pos,
m_Text );
SCH_SHEET_PIN* newitem =
new SCH_SHEET_PIN( (SCH_SHEET*) m_Parent, m_Pos, m_Text );
newitem->m_Edge = m_Edge;
newitem->m_Shape = m_Shape;
......@@ -61,14 +59,14 @@ Hierarchical_PIN_Sheet_Struct* Hierarchical_PIN_Sheet_Struct::GenCopy()
/** Function GetPenSize
* @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;
}
/*****************************************************************************/
void Hierarchical_PIN_Sheet_Struct::Draw( WinEDA_DrawPanel* panel,
void SCH_SHEET_PIN::Draw( WinEDA_DrawPanel* panel,
wxDC* DC,
const wxPoint& offset,
int DrawMode,
......@@ -124,8 +122,7 @@ void Hierarchical_PIN_Sheet_Struct::Draw( WinEDA_DrawPanel* panel,
* @param aCorner_list = list to fill with polygon corners coordinates
* @param Pos = Position of the shape
*/
void Hierarchical_PIN_Sheet_Struct::CreateGraphicShape(
std::vector <wxPoint>& aCorner_list,
void SCH_SHEET_PIN::CreateGraphicShape( std::vector <wxPoint>& aCorner_list,
const wxPoint& Pos )
{
wxSize size = m_Size;
......@@ -184,7 +181,7 @@ void Hierarchical_PIN_Sheet_Struct::CreateGraphicShape(
* @param aFile The FILE to write to.
* @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';
......@@ -223,7 +220,7 @@ bool Hierarchical_PIN_Sheet_Struct::Save( FILE* aFile ) const
#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:
wxString s = GetClass();
......
......@@ -100,8 +100,8 @@ NETLIST_OBJECT::NETLIST_OBJECT()
{
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_Link = NULL; /* For Hierarchical_PIN_Sheet_Struct:
* Pointer to the hierarchy sheet that contains this Hierarchical_PIN_Sheet_Struct
m_Link = NULL; /* For SCH_SHEET_PIN:
* Pointer to the hierarchy sheet that contains this SCH_SHEET_PIN
* For Pins: pointer to the component that contains this pin
*/
m_Flag = 0; /* flag used in calculations */
......
......@@ -41,8 +41,8 @@ class NETLIST_OBJECT
public:
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)*/
SCH_ITEM* m_Link; /* For Hierarchical_PIN_Sheet_Struct:
* Pointer to the hierarchy sheet that contains this Hierarchical_PIN_Sheet_Struct
SCH_ITEM* m_Link; /* For SCH_SHEET_PIN:
* Pointer to the hierarchy sheet that contains this SCH_SHEET_PIN
* For Pins: pointer to the component that contains this pin
*/
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 )
{
DrawSheetStruct* ds = (DrawSheetStruct*) s;
SCH_SHEET* ds = (SCH_SHEET*) s;
s = ds->m_AssociatedScreen;
}
if( s && s->Type() == SCREEN_STRUCT_TYPE )
......
......@@ -204,7 +204,7 @@ SCH_ITEM* WinEDA_SchematicFrame::SchematicGeneralLocateAndDisplay(
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), SHEETITEM );
if( DrawStruct )
{
( (DrawSheetStruct*) DrawStruct )->DisplayInfo( this );
( (SCH_SHEET*) DrawStruct )->DisplayInfo( this );
return DrawStruct;
}
......
......@@ -419,8 +419,8 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
case DRAW_SHEET_STRUCT_TYPE:
{
Hierarchical_PIN_Sheet_Struct* pinsheet;
for( pinsheet = ( (DrawSheetStruct*) DrawItem )->m_Label;
SCH_SHEET_PIN* pinsheet;
for( pinsheet = ( (SCH_SHEET*) DrawItem )->m_Label;
pinsheet;
pinsheet = pinsheet->Next() )
{
......
......@@ -389,7 +389,7 @@ bool LocateAndDeleteItem( WinEDA_SchematicFrame* frame, wxDC* DC )
void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
{
EDA_BaseStruct* DrawList;
Hierarchical_PIN_Sheet_Struct* SheetLabel, * NextLabel;
SCH_SHEET_PIN* SheetLabel, * NextLabel;
if( DrawStruct == NULL )
return;
......@@ -409,14 +409,14 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
continue;
/* See if our item is in this Sheet */
SheetLabel = ( (DrawSheetStruct*) DrawList )->m_Label;
SheetLabel = ( (SCH_SHEET*) DrawList )->m_Label;
if( SheetLabel == NULL )
continue;
if( SheetLabel == (Hierarchical_PIN_Sheet_Struct*) DrawStruct )
if( SheetLabel == (SCH_SHEET_PIN*) DrawStruct )
{
( (DrawSheetStruct*) DrawList )->m_Label =
(Hierarchical_PIN_Sheet_Struct*) SheetLabel->Next();
( (SCH_SHEET*) DrawList )->m_Label =
(SCH_SHEET_PIN*) SheetLabel->Next();
SAFE_DELETE( DrawStruct );
return;
......@@ -425,10 +425,9 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
{
while( SheetLabel->Next() )
{
NextLabel =
(Hierarchical_PIN_Sheet_Struct*) SheetLabel->Next();
NextLabel = (SCH_SHEET_PIN*) SheetLabel->Next();
if( NextLabel == (Hierarchical_PIN_Sheet_Struct*) DrawStruct )
if( NextLabel == (SCH_SHEET_PIN*) DrawStruct )
{
SheetLabel->SetNext( (EDA_BaseStruct*) NextLabel->Next() );
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 )
......@@ -59,7 +59,7 @@ void DeleteSubHierarchy( DrawSheetStruct* FirstSheet, bool confirm_deletion )
EEDrawList = EEDrawList->Next();
if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE )
{
DeleteSubHierarchy( (DrawSheetStruct*) DrawStruct,
DeleteSubHierarchy( (SCH_SHEET*) DrawStruct,
confirm_deletion );
}
}
......
......@@ -273,7 +273,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* aPanel,
case DRAW_SHEET_STRUCT_TYPE:
{
DrawSheetStruct* Struct = (DrawSheetStruct*) aItem;
SCH_SHEET* Struct = (SCH_SHEET*) aItem;
GRRect( &aPanel->m_ClipBox,
aDC,
Struct->m_Pos.x + aOffset.x,
......
......@@ -49,7 +49,7 @@ int g_DefaultTextLabelSize = DEFAULT_SIZE_TEXT;
HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr;
DrawSheetStruct* g_RootSheet = NULL;
SCH_SHEET* g_RootSheet = NULL;
wxString g_NetCmpExtBuffer( wxT( "cmp" ) );
......
......@@ -198,17 +198,17 @@ int TestDuplicateSheetNames()
continue;
// We have found a second sheet: compare names
if( ( (DrawSheetStruct*) ref_item )->m_SheetName.CmpNoCase(
( ( DrawSheetStruct* ) item_to_test )-> m_SheetName )
if( ( (SCH_SHEET*) ref_item )->m_SheetName.CmpNoCase(
( ( SCH_SHEET* ) item_to_test )-> m_SheetName )
== 0 )
{
/* Create a new marker type ERC error*/
MARKER_SCH* Marker = new MARKER_SCH();
Marker->m_TimeStamp = GetTimeStamp();
Marker->SetData( ERCE_DUPLICATE_SHEET_NAME,
( (DrawSheetStruct*) item_to_test )->m_Pos,
( (SCH_SHEET*) item_to_test )->m_Pos,
_( "Duplicate Sheet name" ),
( (DrawSheetStruct*) item_to_test )->m_Pos );
( (SCH_SHEET*) item_to_test )->m_Pos );
Marker->SetMarkerType( MARK_ERC );
Marker->SetErrorLevel( ERR );
Marker->SetNext( Screen->EEDrawList );
......
......@@ -15,12 +15,10 @@
#include "class_library.h"
/****************************************************************/
void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
/****************************************************************/
/* Commands to save project or the current page.
*/
void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
{
int id = event.GetId();
......@@ -45,7 +43,7 @@ void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
}
/*
/**
* Load an entire project
*
* 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;
for( screen = ScreenList.GetFirst(); screen != NULL; screen = ScreenList.GetNext() )
for( screen = ScreenList.GetFirst(); screen != NULL;
screen = ScreenList.GetNext() )
{
if( screen->IsModify() )
break;
......@@ -68,7 +67,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
if( screen )
{
if( !IsOK( this, _( "Clear Schematic Hierarchy (modified!)?" ) ) )
if( !IsOK( this, _( "Clear schematic hierarchy?" ) ) )
return FALSE;
if( g_RootSheet->m_AssociatedScreen->m_FileName != m_DefaultSchematicFileName )
SetLastProject( g_RootSheet->m_AssociatedScreen->m_FileName );
......@@ -126,7 +125,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
return 1;
}
// Rechargement de la configuration:
// Reloading configuration.
msg = _( "Ready\nWorking dir: \n" ) + wxGetCwd();
PrintMsg( msg );
......@@ -145,7 +144,7 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
/* Loading the project library cache
* until apr 2009 the lib is named <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;
wxFileName fn = g_RootSheet->m_AssociatedScreen->m_FileName;
......@@ -208,11 +207,11 @@ Error: %s" ),
return -1;
}
//load the project.
// load the project.
SAFE_DELETE( g_RootSheet->m_AssociatedScreen );
bool diag = g_RootSheet->Load( this );
/* Reaffichage ecran de base (ROOT) si necessaire */
/* Redraw base screen (ROOT) if necessary. */
ActiveScreen = GetScreen();
ActiveScreen->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
Zoom_Automatique( FALSE );
......@@ -222,15 +221,13 @@ Error: %s" ),
}
/**********************************************************/
SCH_SCREEN* WinEDA_SchematicFrame::CreateNewScreen(
SCH_SCREEN* OldScreen, int 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
/* Create a new screen
*
* This screen is chained with OldScreen. The timestamp value is assigned to
* the parameter NewScreen-> TimeStamp
*/
SCH_SCREEN* WinEDA_SchematicFrame::CreateNewScreen( SCH_SCREEN* OldScreen,
int TimeStamp )
{
SCH_SCREEN* NewScreen;
......@@ -247,13 +244,12 @@ SCH_SCREEN* WinEDA_SchematicFrame::CreateNewScreen(
}
/****************************************************/
void WinEDA_SchematicFrame::SaveProject()
/****************************************************/
/* Saves the entire project and creates an archive for components
* the library archive name is <root_name>.cache.lib
/**
* Save the entire project and create an archive for components.
*
* The library archive name is <root_name>.cache.lib
*/
void WinEDA_SchematicFrame::SaveProject()
{
SCH_SCREEN* screen;
wxFileName fn;
......@@ -266,7 +262,7 @@ void WinEDA_SchematicFrame::SaveProject()
SaveEEFile( screen, FILE_SAVE_AS );
}
/* Creation du fichier d'archivage composants en repertoire courant */
/* Archive components in current directory. */
fn = g_RootSheet->GetFileName();
wxString cachename = fn.GetName() + wxT("-cache");
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,
* powers non comprises */
int CountCmpNumber()
{
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;
*/
}
/***************************************/
/* GENERAL.H : declarations communes */
/***************************************/
/***************/
/* GENERAL.H */
/***************/
#ifndef _GENERAL_H_
#define _GENERAL_H_
/* Entete des fichiers schematique */
#define EESCHEMA_VERSION 2
#define SCHEMATIC_HEAD_STRING "Schematic File Version"
......@@ -15,12 +14,11 @@
#define MAX_PIN_INFO 10
#define TXTMARGE 10 /* Decalage (en 1/1000") des textes places
* sur fils ( labels, num pins ) */
#define TXTMARGE 10 /* Offset in mils for placement of labels
* and pin numbers. */
#define HIGHLIGHT_COLOR WHITE
/* Used for EDA_BaseStruct, .m_Select member */
#define IS_SELECTED 1
......@@ -32,10 +30,9 @@
#define DANGLING_SYMBOL_SIZE 12
/* Message de presentation */
extern wxString g_DefaultSchematicFileName;
/* Masque de recherche pour localisation d'objets a editer */
/* Search mask for locating objects in editor. */
#define LIBITEM 1
#define WIREITEM 2
#define BUSITEM 4
......@@ -53,12 +50,13 @@ extern wxString g_DefaultSchematicFileName;
#define EXCLUDE_WIRE_BUS_ENDPOINTS 0x4000
#define WIRE_BUS_ENDPOINTS_ONLY 0x8000
#define SEARCHALL LIBITEM | WIREITEM | BUSITEM | RACCORDITEM | JUNCTIONITEM \
| DRAWITEM | TEXTITEM | LABELITEM | SHEETITEM | MARKERITEM \
| NOCONNECTITEM | SEARCH_PINITEM | SHEETLABELITEM
#define SEARCHALL ( LIBITEM | WIREITEM | BUSITEM | RACCORDITEM | \
JUNCTIONITEM | DRAWITEM | TEXTITEM | LABELITEM | \
SHEETITEM | MARKERITEM | NOCONNECTITEM | \
SEARCH_PINITEM | SHEETLABELITEM )
/* Numero des couches de travail */
typedef enum {
typedef enum
{
LAYER_WIRE,
LAYER_BUS,
LAYER_JUNCTION,
......@@ -84,39 +82,44 @@ typedef enum {
LAYER_ERC_ERR,
LAYER_DEVICE_BACKGROUND,
MAX_LAYER /* Nombre de couches */
MAX_LAYER /* Maximum layers */
} LayerNumber;
typedef enum {
typedef enum
{
FILE_SAVE_AS,
FILE_SAVE_NEW
} FileSaveType;
/* variables generales */
extern int g_OptNetListUseNames; /* TRUE pour utiliser les noms de net plutot que
* les numeros (netlist PSPICE seulement) */
extern SCH_ITEM* g_ItemToRepeat; /* pointeur sur la derniere structure
* dessinee pouvant etre dupliquee par la commande
* Repeat ( NULL si aucune struct existe ) */
extern int g_OptNetListUseNames; /* TRUE to use names rather than
* net numbers (PSPICE netlist
* only) */
extern SCH_ITEM* g_ItemToRepeat; /* Pointer to the last structure used
* by the repeat command. NULL if no
* item to repeat */
extern wxSize g_RepeatStep;
extern int g_RepeatDeltaLabel;
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
// False for a schematic item search
// Used for hotkey next search
extern bool g_LastSearchIsMarker; /* True if last search is a marker
* search. False for a schematic
* item search. Used for hotkey
* next search. */
/* 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;
// Gestion de diverses variables, options... devant etre memorisees mais
// Remises a 0 lors d'un rechargement de projetc
// Management variables, option ... to be stored. Reset to 0 during a
// project reload.
struct EESchemaVariables
{
int NbErrorErc;
......@@ -125,40 +128,19 @@ struct EESchemaVariables
extern struct EESchemaVariables g_EESchemaVar;
/* Variables globales pour Schematic Edit */
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
{
int m_Pen_Num; /* num de plume a charger */
int m_Pen_Speed; /* vitesse en cm/s */
int m_Pen_Num; /* Pen number */
int m_Pen_Speed; /* Pen speed in cm/s */
int m_Pen_Diam; /* Pen diameter in mils */
};
extern HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr;
/* First and main (root) screen */
extern DrawSheetStruct* 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
extern SCH_SHEET* g_RootSheet;
/* Gestion des librairies schematiques */
extern wxString g_NetCmpExtBuffer;
extern const wxString SymbolFileExtension;
......@@ -167,23 +149,28 @@ extern const wxString SymbolFileWildcard;
extern const wxString CompLibFileExtension;
extern const wxString CompLibFileWildcard;
extern wxString g_SimulatorCommandLine; // ligne de commande pour l'appel au simulateur (gnucap, spice..)
extern wxString g_NetListerCommandLine; // ligne de commande pour l'appel au simulateur (gnucap, spice..)
extern wxString g_SimulatorCommandLine;
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
* when they are at the same location */
extern bool g_EditPinByPinIsOn; /* True to prevent displacing
* pins, when they are at the
* same position. */
extern int g_DrawDefaultLineThickness; /* Default line (in EESCHEMA units) thickness
* used to draw/plot items having a default thickness line value (i.e. = 0 ).
extern int g_DrawDefaultLineThickness; /* Default line (in EESCHEMA
* units) thickness used to
* draw/plot items having a
* default thickness line
* value (i.e. = 0 ).
* 0 = single pixel line width
*/
// Color to draw selected items
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;
#endif // _GENERAL_H_
......@@ -20,11 +20,9 @@
#include <boost/foreach.hpp>
/* Routines Locales */
static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC );
/* Variables locales */
static int OldTransMat[2][2];
static wxPoint OldPos;
......@@ -200,7 +198,8 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
Component = new SCH_COMPONENT( *Entry, GetSheet(), unit, convert,
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->DisplayInfo( this );
......@@ -210,10 +209,9 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
}
/**************************************************************************/
/*** Routine de deplacement du composant. ***/
/*** Appele par GeneralControle grace a ActiveScreen->ManageCurseur. ***/
/**************************************************************************/
/**
* Move a component.
*/
static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{
wxPoint move_vector;
......@@ -222,7 +220,6 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
SCH_COMPONENT* Component = (SCH_COMPONENT*) screen->GetCurItem();
/* Effacement du composant */
if( erase )
{
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
* Si DC = NULL : pas de redessin
* Routine to rotate and mirror a component.
*
** If DC == NULL: no repaint
*/
void WinEDA_SchematicFrame::CmpRotationMiroir( SCH_COMPONENT* DrawComponent,
wxDC* DC, int type_rotate )
......@@ -245,7 +243,7 @@ void WinEDA_SchematicFrame::CmpRotationMiroir( SCH_COMPONENT* DrawComponent,
if( DrawComponent == NULL )
return;
/* Efface le trace precedent */
/* Deletes the previous component. */
if( DC )
{
DrawPanel->CursorOff( DC );
......@@ -259,7 +257,7 @@ void WinEDA_SchematicFrame::CmpRotationMiroir( SCH_COMPONENT* DrawComponent,
DrawComponent->SetRotationMiroir( type_rotate );
/* Redessine le composant dans la nouvelle position */
/* Redraw the component in the new position. */
if( DC )
{
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 )
{
......@@ -284,12 +282,12 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
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;
SAFE_DELETE( Component );
}
else if( Component ) /* Deplacement ancien composant en cours */
else if( Component )
{
wxPoint move_vector = OldPos - Component->m_Pos;
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,
int unit, wxDC* DC )
......@@ -333,17 +331,16 @@ void WinEDA_SchematicFrame::SelPartUnit( SCH_COMPONENT* DrawComponent,
if( unit > m_UnitCount )
unit = m_UnitCount;
/* Efface le trace precedent */
if( DrawComponent->m_Flags )
DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) );
else
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->m_Multi = unit;
/* Redessine le composant dans la nouvelle position */
/* Redraw the component in the new position. */
if( DrawComponent->m_Flags )
DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) );
else
......@@ -374,7 +371,6 @@ void WinEDA_SchematicFrame::ConvertPart( SCH_COMPONENT* DrawComponent,
return;
}
/* Efface le trace precedent */
if( DrawComponent->m_Flags )
DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) );
else
......@@ -390,7 +386,7 @@ void WinEDA_SchematicFrame::ConvertPart( SCH_COMPONENT* DrawComponent,
if( DrawComponent->m_Convert > 2 )
DrawComponent->m_Convert = 1;
/* Redessine le composant dans la nouvelle position */
/* Redraw the component in the new position. */
if( DrawComponent->m_Flags & IS_MOVED )
DrawStructsInGhost( DrawPanel, DC, DrawComponent, wxPoint( 0, 0 ) );
else
......@@ -432,9 +428,9 @@ void WinEDA_SchematicFrame::StartMovePart( SCH_COMPONENT* Component,
#if 1
// 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(),
// then by drawing the first time in xor mode so that subsequent xor
// drawing modes will fully erase this first copy.
// by erasing fully any "normal drawing mode" primitives with the
// PostDirtyRect(), then by drawing the first time in xor mode so that
// subsequent xor drawing modes will fully erase this first copy.
Component->m_Flags |= IS_MOVED; // omit redrawing the component, erase only
DrawPanel->PostDirtyRect( Component->GetBoundingBox() );
......
/************************************************************************/
/* hierarch.cpp: Gestion de la hierarchie: navigation dans les feuilles */
/************************************************************************/
/******************/
/* hierarch.cpp */
/******************/
#include "fctsys.h"
#include "gr_basic.h"
......@@ -18,15 +18,16 @@
static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame );
enum {
enum
{
ID_TREECTRL_HIERARCHY = 1600
};
class WinEDA_HierFrame;
/* This class derived from wxTreeItemData stores the DrawSheetPath of each sheet in hierarcy
* in each TreeItem, in its associated data buffer
/* This class derived from wxTreeItemData stores the DrawSheetPath of each
* sheet in hierarchy in each TreeItem, in its associated data buffer
*/
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
{
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
{
public:
......@@ -81,7 +81,7 @@ public:
wxDC* m_DC;
private:
wxSize m_TreeSize; // Taille de l'arbre de hierarchie
wxSize m_TreeSize;
int maxposx;
public:
......@@ -153,7 +153,7 @@ WinEDA_HierFrame::WinEDA_HierFrame( WinEDA_SchematicFrame* parent, wxDC* DC,
{
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.x = MIN( m_TreeSize.x, 250 );
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
* Schematic
* This routine is re-entrant!
*/
void WinEDA_HierFrame::BuildSheetsTree( DrawSheetPath* list,
wxTreeItemId* previousmenu )
/********************************************************************/
/* Routine de creation de l'arbre de navigation dans la hierarchy
* schematique
* Cette routine est Reentrante !
*/
{
wxTreeItemId menu;
......@@ -206,7 +204,7 @@ void WinEDA_HierFrame::BuildSheetsTree( DrawSheetPath* list,
{
if( schitem->Type() == DRAW_SHEET_STRUCT_TYPE )
{
DrawSheetStruct* sheet = (DrawSheetStruct*) schitem;
SCH_SHEET* sheet = (SCH_SHEET*) schitem;
m_nbsheets++;
menu = m_Tree->AppendItem( *previousmenu, sheet->m_SheetName, 0, 1 );
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:
* Open the selected sheet, and display the corresponding screen
*/
void WinEDA_HierFrame::OnSelect( wxTreeEvent& event )
{
wxTreeItemId ItemSel = m_Tree->GetSelection();
......@@ -253,12 +249,10 @@ void WinEDA_HierFrame::OnSelect( wxTreeEvent& event )
}
/******************************************************/
void WinEDA_SchematicFrame::InstallPreviousSheet()
/******************************************************/
/* Set the current screen to display the parent sheet of the current 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 )
return;
......@@ -279,16 +273,13 @@ void WinEDA_SchematicFrame::InstallPreviousSheet()
}
/*********************************************************************/
void WinEDA_SchematicFrame::InstallNextScreen( DrawSheetStruct* Sheet )
/*********************************************************************/
/* Routine d'installation de l'ecran correspondant au symbole Sheet pointe
* 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..)
/* Routine installation of the screen corresponding to the symbol edge 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
* maintain path info..)
*/
void WinEDA_SchematicFrame::InstallNextScreen( SCH_SHEET* Sheet )
{
if( Sheet == NULL )
{
......@@ -301,14 +292,10 @@ void WinEDA_SchematicFrame::InstallNextScreen( DrawSheetStruct* Sheet )
}
/**************************************************************/
static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame )
/**************************************************************/
/* Recherche et installe de l'ecran relatif au sheet symbole Sheet.
* Si Sheet == NULL installation de l'ecran de base ( Root ).
/* Find and install the screen on the sheet symbol Sheet.
* If Sheet == NULL installation of the screen base (Root).
*/
static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame )
{
SCH_SCREEN* NewScreen;
......@@ -319,8 +306,8 @@ static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame )
return false;
}
// Reinit des parametres d'affichage du nouvel ecran
// assumes m_CurrentSheet has already been updated.
// Reset display settings of the new screen
// Assumes m_CurrentSheet has already been updated.
frame->ClearMsgPanel();
frame->DrawPanel->SetScrollbars( NewScreen->m_ZoomScalar,
NewScreen->m_ZoomScalar,
......
......@@ -2,9 +2,9 @@
/* EESchema - lib_export.cpp */
/*****************************/
/* Routines de maintenanace des librariries:
* sauvegarde, modification de librairies.
* creation edition suppression de composants
/* Library maintenance routines.
* Backup modified libraries.
* Create, edit, and delete components.
*/
#include "fctsys.h"
......@@ -27,13 +27,11 @@
extern int ExportPartId;
/*************************************************/
/* Routine de lecture de 1 description.
* Le format est celui des librairies, mais on ne charge que 1 composant
* ou le 1er composant s'il y en a plusieurs.
* Si le premier composant est un alias, on chargera la racine correspondante
/* Routine to read one part.
* The format is that of libraries, but it loads only 1 component.
* Or 1 component if there are several.
* If the first component is an alias, it will load the corresponding root.
*/
/*************************************************/
void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event )
{
wxString errMsg;
......@@ -82,12 +80,12 @@ void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event )
}
/* Routine de creation d'une nouvelle librairie et de sauvegarde du
* composant courant dans cette librarie
* si create_lib == TRUE sauvegarde dans le repertoire des libr
* sinon: sauvegarde sous le nom demande sans modifications.
/* Routine to create a new library and backup the current component in
* this library.
* Create_lib == TRUE if the backup directory of library.
* 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 )
{
......
/**************************************************************/
/* libarch.cc */
/* Module de generation du fichier d'archivage des composants */
/**************************************************************/
/*****************************************************/
/* libarch.cpp */
/* Module for generation of component archive files. */
/*****************************************************/
#include "fctsys.h"
#include "common.h"
#include "confirm.h"
......@@ -29,7 +29,7 @@ bool LibArchive( wxWindow* frame, const wxString& ArchFullFileName )
libCache = new CMP_LIBRARY( LIBRARY_TYPE_EESCHEMA, ArchFullFileName );
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
* to know used components in libraries
*/
......@@ -52,7 +52,7 @@ bool LibArchive( wxWindow* frame, const wxString& 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 ) );
DisplayError( frame, msg );
return false;
......
......@@ -2,11 +2,6 @@
/* EESchema - libedit.cpp */
/****************************/
/* Routines de maintenanace des librairies:
* sauvegarde, modification de librairies.
* creation edition suppression de composants
*/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
......@@ -118,11 +113,11 @@ library \"%s\"." ),
/*
* Routine Pour Charger en memoire la copie de 1 libpart.
* retourne
* 0 si OK
* 1 si err
* m_component pointe la copie ainsi creee
* Routine to load into memory a copy of 1 library part.
* Returns
* 0 if OK
* 1 if error
* m_component advanced copy and created
*/
bool WinEDA_LibeditFrame::LoadOneLibraryPartAux( CMP_LIB_ENTRY* LibEntry,
CMP_LIBRARY* Library )
......@@ -208,7 +203,7 @@ void WinEDA_LibeditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
DC->SetBackgroundMode( wxTRANSPARENT );
GRResetPenAndBrush( DC );
DrawPanel->CursorOff( DC ); // erase cursor
DrawPanel->CursorOff( DC );
if( DrawPanel->ManageCurseur )
{
DrawPanel->ManageCurseur( DrawPanel, DC, false );
......@@ -289,8 +284,9 @@ void WinEDA_LibeditFrame::SaveActiveLibrary( wxCommandEvent& event )
/*
* Affiche la documentation du composant selectionne
* Utilise lors de l'affichage de la liste des composants en librairie
* Display the documentation of the selected component.
*
* Used when displaying the list of library components.
*/
void WinEDA_LibeditFrame::DisplayCmpDoc()
{
......@@ -354,16 +350,18 @@ void WinEDA_LibeditFrame::DisplayCmpDoc()
/*
* Routine de suppression d'un composant dans la librairie courante
* (effacement en memoire uniquement, le fichier n'est pas modifie)
* Le composant peut etre un alias, ou la definition de base.
* Si c'est un alias:
* il est supprime, et la liste des alias de la definition
* de base est modifiee
* Si c'est le composant de base:
* Si la liste des alias est nulle, il est supprime
* Sinon le premier alias devient le composant de base, et les autres
* alias deviennent dependants de celui ci.
* Delete component in the current library.
*
* (Delete only in memory, the file does not change)
*
* The entry can be an alias or a component.
* If an alias:
* It is removed, and the list of alias is updated.
*
* If a component:
* 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 )
{
......@@ -515,7 +513,7 @@ lost!\n\nClear the current component from the screen?" ) ) )
name = dlg.GetName().MakeUpper();
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 ) )
{
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
* La routine efface l'ancien composant ( ou / et les alias ) a remplacer
* s'il existe, et sauve le nouveau et cree les alias correspondants.
* Save in memory only and NOT on file.
* The routine deletes the old component (and / or aliases) to replace
* If any, and saves the new and creates the corresponding alias.
*/
void WinEDA_LibeditFrame::SaveOnePartInMemory()
{
......
/*********************************************************************/
/* EESchema - edition des librairies: Edition des champs ( Fields ) */
/*********************************************************************/
/*****************************************************/
/* Component library edit field manipulation code. */
/*****************************************************/
#include "fctsys.h"
#include "gr_basic.h"
......@@ -15,11 +15,9 @@
#include "class_library.h"
/* Routines locales */
static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
/* Variables locales */
extern int m_unit;
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 )
{
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 normalement attachee au curseur */
/*****************************************************************/
/*
* Routine to display text 'Field' on the move.
* Normally called by cursor management code.
*/
static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{
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.
* si un champ est en cours d'edition, modif de celui ci.
* sinon Modif du champ pointe par la souris
* Rotate a field horizontally or vertically.
*
* 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 )
{
......
......@@ -148,7 +148,6 @@ BEGIN_EVENT_TABLE( WinEDA_LibeditFrame, WinEDA_DrawFrame )
END_EVENT_TABLE()
WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
const wxString& title,
const wxPoint& pos,
......@@ -169,9 +168,10 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father,
SetBaseScreen( new SCH_SCREEN() );
GetScreen()->m_Center = true;
LoadSettings();
// Initilialize grid id to a default value if not found in config or bad:
if( (m_LastGridSizeId <= 0) ||
(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;
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 );
#if KICAD_AUIMANAGER
m_auimgr.SetManagedWindow(this);
m_auimgr.SetManagedWindow( this );
wxAuiPaneInfo horiz;
horiz.Gripper(false);
horiz.DockFixed(true);
horiz.Movable(false);
horiz.Floatable(false);
horiz.CloseButton(false);
horiz.CaptionVisible(false);
horiz.Gripper( false );
horiz.DockFixed( true );
horiz.Movable( false );
horiz.Floatable( false );
horiz.CloseButton( false );
horiz.CaptionVisible( false );
wxAuiPaneInfo vert(horiz);
wxAuiPaneInfo vert( horiz );
vert.TopDockable(false).BottomDockable(false);
horiz.LeftDockable(false).RightDockable(false);
vert.TopDockable( false ).BottomDockable( false );
horiz.LeftDockable( false ).RightDockable( false );
m_auimgr.AddPane(m_HToolBar,
wxAuiPaneInfo(horiz).Name(wxT("m_HToolBar")).Top().Row(0));
m_auimgr.AddPane( m_HToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().
Row( 0 ) );
m_auimgr.AddPane(m_VToolBar,
wxAuiPaneInfo(vert).Name(wxT("m_VToolBar")).Right());
m_auimgr.AddPane( m_VToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() );
m_auimgr.AddPane(DrawPanel,
wxAuiPaneInfo().Name(wxT("DrawFrame")).CentrePane());
m_auimgr.AddPane( DrawPanel,
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
m_auimgr.AddPane(MsgPanel,
wxAuiPaneInfo(horiz).Name(wxT("MsgPanel")).Bottom());
m_auimgr.AddPane( MsgPanel,
wxAuiPaneInfo( horiz ).Name( wxT( "MsgPanel" ) ).Bottom() );
m_auimgr.Update();
#endif
}
......@@ -224,6 +225,7 @@ WinEDA_LibeditFrame::~WinEDA_LibeditFrame()
{
WinEDA_SchematicFrame* frame =
(WinEDA_SchematicFrame*) wxGetApp().GetTopWindow();
frame->m_LibeditFrame = NULL;
m_drawItem = m_lastDrawItem = NULL;
}
......@@ -288,8 +290,7 @@ void WinEDA_LibeditFrame::OnCloseWindow( wxCloseEvent& Event )
GetScreen()->ClrModify();
}
BOOST_FOREACH( const CMP_LIBRARY& lib, CMP_LIBRARY::GetLibraryList() )
{
BOOST_FOREACH( const CMP_LIBRARY &lib, CMP_LIBRARY::GetLibraryList() ) {
if( lib.IsModified() )
{
wxString msg;
......@@ -495,8 +496,8 @@ void WinEDA_LibeditFrame::OnUpdateDeMorganNormal( wxUpdateUIEvent& event )
if( m_HToolBar == NULL )
return;
event.Enable( GetShowDeMorgan() ||
(m_component && m_component->HasConversion()) );
event.Enable( GetShowDeMorgan()
|| ( m_component && m_component->HasConversion() ) );
m_HToolBar->ToggleTool( event.GetId(), m_convert <= 1 );
}
......@@ -506,8 +507,8 @@ void WinEDA_LibeditFrame::OnUpdateDeMorganConvert( wxUpdateUIEvent& event )
if( m_HToolBar == NULL )
return;
event.Enable( GetShowDeMorgan() ||
(m_component && m_component->HasConversion()) );
event.Enable( GetShowDeMorgan()
|| ( m_component && m_component->HasConversion() ) );
m_HToolBar->ToggleTool( event.GetId(), m_convert > 1 );
}
......@@ -533,7 +534,8 @@ void WinEDA_LibeditFrame::OnSelectAlias( wxCommandEvent& event )
m_lastDrawItem = NULL;
if( m_SelAliasBox->GetStringSelection().CmpNoCase(m_component->GetName() ) == 0 )
if( m_SelAliasBox->GetStringSelection().CmpNoCase( m_component->GetName() )
== 0 )
m_aliasName.Empty();
else
m_aliasName = m_SelAliasBox->GetStringSelection();
......@@ -710,7 +712,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_LIBEDIT_IMPORT_BODY_BUTT:
SetToolID( id, wxCURSOR_ARROW, _( "Import" ) );
LoadOneSymbol( );
LoadOneSymbol();
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break;
......@@ -767,6 +769,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_LIBEDIT_DELETE_CURRENT_POLY_SEGMENT:
// Delete the last created segment, while creating a polyline draw item
if( m_drawItem == NULL )
break;
......
......@@ -27,7 +27,7 @@ private:
// Flags
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:
WinEDA_ViewlibFrame( wxWindow* father,
......@@ -47,7 +47,7 @@ public:
void ReCreateHToolbar();
void ReCreateVToolbar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
int BestZoom(); // Retourne le meilleur zoom
int BestZoom();
void ClickOnLibList( wxCommandEvent& event );
void ClickOnCmpList( wxCommandEvent& event );
void OnSetRelativeOffset( wxCommandEvent& event );
......
......@@ -29,7 +29,6 @@ extern int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
wxString& aMsgDiag, int* aLineNum,
BASE_SCREEN* Window );
/* Fonctions locales */
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
// 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' )
{
int c;
......@@ -136,7 +136,7 @@ again." );
switch( Line[0] )
{
case '$': /* identification de bloc */
case '$': /* identification block */
if( Line[1] == 'C' )
Failed = ReadPartDescr( this, Line, f, MsgDiag, &LineCount,
screen );
......@@ -167,13 +167,13 @@ again." );
case 'L': /* Its a library item. */
Failed = ReadPartDescr( this, Line, f, MsgDiag, &LineCount, screen );
break; /* Fin lecture 1 composant */
break;
case 'W': /* Its a Segment (WIRE or BUS) item. */
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 );
MsgDiag << wxT( "\n" ) << CONV_FROM_UTF8( Line );
Failed = true;
......@@ -209,7 +209,7 @@ again." );
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 )
{
MsgDiag.Printf( wxT( "EESchema file record struct error at line %d, aborted" ),
......@@ -325,7 +325,8 @@ at line %d, aborted" ),
break;
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;
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 );
if( strcmp( Name, "EELAYER" ) !=0 )
{
/* error : init par defaut */
/* error : init par default */
Number = MAX_LAYER;
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -138,8 +138,8 @@ void SwapData( EDA_BaseStruct* aItem, EDA_BaseStruct* aImage )
case DRAW_SHEET_STRUCT_TYPE:
#undef SOURCE
#undef DEST
#define SOURCE ( (DrawSheetStruct*) aItem )
#define DEST ( (DrawSheetStruct*) aImage )
#define SOURCE ( (SCH_SHEET*) aItem )
#define DEST ( (SCH_SHEET*) aImage )
DEST->SwapData( SOURCE );
break;
......@@ -154,8 +154,8 @@ void SwapData( EDA_BaseStruct* aItem, EDA_BaseStruct* aImage )
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
#undef SOURCE
#undef DEST
#define SOURCE ( (Hierarchical_PIN_Sheet_Struct*) aItem )
#define DEST ( (Hierarchical_PIN_Sheet_Struct*) aImage )
#define SOURCE ( (SCH_SHEET_PIN*) aItem )
#define DEST ( (SCH_SHEET_PIN*) aImage )
EXCHG( SOURCE->m_Edge, DEST->m_Edge );
EXCHG( SOURCE->m_Shape, DEST->m_Shape );
break;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment