Global variable unobfuscation, new library path search, and lots of other changes. See CHANGELOG.txt.
This commit is contained in:
parent
7a351249ec
commit
689579bde1
|
@ -21,7 +21,6 @@
|
||||||
#include "wx/dataobj.h"
|
#include "wx/dataobj.h"
|
||||||
#include "wx/clipbrd.h"
|
#include "wx/clipbrd.h"
|
||||||
|
|
||||||
#include "fctsys.h"
|
|
||||||
#include "id.h"
|
#include "id.h"
|
||||||
#include "gestfich.h"
|
#include "gestfich.h"
|
||||||
|
|
||||||
|
@ -620,6 +619,7 @@ void Pcb3D_GLCanvas::TakeScreenshot( wxCommandEvent& event )
|
||||||
* Output file format is png or jpeg, or image is copied on clipboard
|
* Output file format is png or jpeg, or image is copied on clipboard
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
wxFileName fn( m_Parent->m_Parent->GetScreen()->m_FileName );
|
||||||
wxString FullFileName;
|
wxString FullFileName;
|
||||||
wxString file_ext, mask;
|
wxString file_ext, mask;
|
||||||
bool fmt_is_jpeg = FALSE;
|
bool fmt_is_jpeg = FALSE;
|
||||||
|
@ -628,15 +628,15 @@ void Pcb3D_GLCanvas::TakeScreenshot( wxCommandEvent& event )
|
||||||
fmt_is_jpeg = TRUE;
|
fmt_is_jpeg = TRUE;
|
||||||
if( event.GetId() != ID_TOOL_SCREENCOPY_TOCLIBBOARD )
|
if( event.GetId() != ID_TOOL_SCREENCOPY_TOCLIBBOARD )
|
||||||
{
|
{
|
||||||
file_ext = fmt_is_jpeg ? wxT( ".jpg" ) : wxT( ".png"; )
|
file_ext = fmt_is_jpeg ? wxT( "jpg" ) : wxT( "png"; )
|
||||||
mask = wxT( "*" ) + file_ext;
|
mask = wxT( "*." ) + file_ext;
|
||||||
FullFileName = m_Parent->m_Parent->GetScreen()->m_FileName;
|
FullFileName = m_Parent->m_Parent->GetScreen()->m_FileName;
|
||||||
ChangeFileNameExt( FullFileName, file_ext );
|
fn.SetExt( file_ext );
|
||||||
|
|
||||||
FullFileName =
|
FullFileName =
|
||||||
EDA_FileSelector( _( "3D Image filename:" ),
|
EDA_FileSelector( _( "3D Image filename:" ),
|
||||||
wxEmptyString, /* Chemin par defaut */
|
wxEmptyString, /* Chemin par defaut */
|
||||||
FullFileName, /* nom fichier par defaut */
|
fn.GetFullName(), /* nom fichier par defaut */
|
||||||
file_ext, /* extension par defaut */
|
file_ext, /* extension par defaut */
|
||||||
mask, /* Masque d'affichage */
|
mask, /* Masque d'affichage */
|
||||||
this,
|
this,
|
||||||
|
|
|
@ -20,12 +20,24 @@
|
||||||
#include "bitmaps.h"
|
#include "bitmaps.h"
|
||||||
#include "id.h"
|
#include "id.h"
|
||||||
|
|
||||||
#define VIEWER_MAIN
|
|
||||||
#include "3d_viewer.h"
|
#include "3d_viewer.h"
|
||||||
#include "trackball.h"
|
#include "trackball.h"
|
||||||
|
|
||||||
#include <wx/colordlg.h>
|
#include <wx/colordlg.h>
|
||||||
|
|
||||||
|
Info_3D_Visu g_Parm_3D_Visu;
|
||||||
|
double g_Draw3d_dx;
|
||||||
|
double g_Draw3d_dy;
|
||||||
|
double ZBottom;
|
||||||
|
double ZTop;
|
||||||
|
double DataScale3D; // coeff de conversion unites utilsateut -> unites 3D
|
||||||
|
|
||||||
|
int gl_attrib[] =
|
||||||
|
{
|
||||||
|
WX_GL_RGBA, WX_GL_MIN_RED, 8, WX_GL_MIN_GREEN, 8, WX_GL_MIN_BLUE, 8,
|
||||||
|
WX_GL_DEPTH_SIZE, 16, WX_GL_DOUBLEBUFFER, GL_NONE
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE( WinEDA3D_DrawFrame, wxFrame )
|
BEGIN_EVENT_TABLE( WinEDA3D_DrawFrame, wxFrame )
|
||||||
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA3D_DrawFrame::Process_Zoom )
|
EVT_TOOL_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, WinEDA3D_DrawFrame::Process_Zoom )
|
||||||
|
@ -358,9 +370,9 @@ void WinEDA3D_DrawFrame::Set3DBgColor()
|
||||||
S3D_Color color;
|
S3D_Color color;
|
||||||
wxColour newcolor, oldcolor;
|
wxColour newcolor, oldcolor;
|
||||||
|
|
||||||
oldcolor.Set( (int) round( g_Parm_3D_Visu.m_BgColor.m_Red * 255 ),
|
oldcolor.Set( wxRound( g_Parm_3D_Visu.m_BgColor.m_Red * 255 ),
|
||||||
(int) round( g_Parm_3D_Visu.m_BgColor.m_Green * 255 ),
|
wxRound( g_Parm_3D_Visu.m_BgColor.m_Green * 255 ),
|
||||||
(int) round( g_Parm_3D_Visu.m_BgColor.m_Blue * 255 ) );
|
wxRound( g_Parm_3D_Visu.m_BgColor.m_Blue * 255 ) );
|
||||||
|
|
||||||
newcolor = wxGetColourFromUser( this, oldcolor );
|
newcolor = wxGetColourFromUser( this, oldcolor );
|
||||||
if( newcolor != oldcolor )
|
if( newcolor != oldcolor )
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
#include "kicad_string.h"
|
#include "kicad_string.h"
|
||||||
|
#include "appl_wxstruct.h"
|
||||||
|
|
||||||
#include "3d_struct.h"
|
#include "3d_struct.h"
|
||||||
#include "3d_viewer.h"
|
#include "3d_viewer.h"
|
||||||
|
@ -22,30 +23,35 @@
|
||||||
int S3D_MASTER:: ReadData()
|
int S3D_MASTER:: ReadData()
|
||||||
/************************************/
|
/************************************/
|
||||||
{
|
{
|
||||||
char line[1024], * text;
|
char line[1024], * text;
|
||||||
wxString fullfilename;
|
wxFileName fn;
|
||||||
FILE* file;
|
wxString tmp;
|
||||||
int LineNum = 0;
|
FILE* file;
|
||||||
|
int LineNum = 0;
|
||||||
|
|
||||||
if( m_Shape3DName.IsEmpty() )
|
if( m_Shape3DName.IsEmpty() )
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( wxIsAbsolutePath( m_Shape3DName ) )
|
fn = m_Shape3DName;
|
||||||
fullfilename.Empty();
|
|
||||||
else
|
if( !fn.FileExists() )
|
||||||
fullfilename = g_RealLibDirBuffer + LIB3D_PATH;
|
{
|
||||||
fullfilename += m_Shape3DName;
|
tmp = wxGetApp().GetLibraryPathList().FindValidPath( fn.GetFullPath() );
|
||||||
#if defined (__WINDOWS__)
|
|
||||||
fullfilename.Replace( UNIX_STRING_DIR_SEP, WIN_STRING_DIR_SEP );
|
if( !tmp )
|
||||||
#else
|
{
|
||||||
#if defined (__UNIX__)
|
wxLogDebug( _( "3D part library <%s> could not be found." ),
|
||||||
fullfilename.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
fn.GetFullPath().c_str() );
|
||||||
#endif
|
return -1;
|
||||||
#endif
|
}
|
||||||
|
|
||||||
|
fn = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
file = wxFopen( fn.GetFullPath(), wxT( "rt" ) );
|
||||||
|
|
||||||
file = wxFopen( fullfilename, wxT( "rt" ) );
|
|
||||||
if( file == NULL )
|
if( file == NULL )
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
|
|
||||||
#include "id.h"
|
#include "id.h"
|
||||||
|
|
||||||
#define BITMAP wxBitmap
|
|
||||||
#include "3d_viewer.h"
|
#include "3d_viewer.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,62 +28,70 @@ void WinEDA3D_DrawFrame::ReCreateHToolbar()
|
||||||
SetToolBar( m_HToolBar );
|
SetToolBar( m_HToolBar );
|
||||||
|
|
||||||
// Set up toolbar
|
// Set up toolbar
|
||||||
m_HToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString, BITMAP( import3d_xpm ),
|
m_HToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,
|
||||||
_( "Reload board" ) );
|
wxBitmap( import3d_xpm ),
|
||||||
|
_( "Reload board" ) );
|
||||||
#ifdef __WINDOWS__ // do not work properly under linux
|
#ifdef __WINDOWS__ // do not work properly under linux
|
||||||
m_HToolBar-> AddSeparator();
|
m_HToolBar-> AddSeparator();
|
||||||
|
|
||||||
m_HToolBar->AddTool( ID_TOOL_SCREENCOPY_TOCLIBBOARD, wxEmptyString, BITMAP( copy_button ),
|
m_HToolBar->AddTool( ID_TOOL_SCREENCOPY_TOCLIBBOARD, wxEmptyString,
|
||||||
|
wxBitmap( copy_button ),
|
||||||
_( "Copy 3D Image to Clipboard" ) );
|
_( "Copy 3D Image to Clipboard" ) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_HToolBar->AddSeparator();
|
m_HToolBar->AddSeparator();
|
||||||
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, BITMAP( zoom_in_xpm ),
|
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, wxBitmap( zoom_in_xpm ),
|
||||||
_( "Zoom in" ) );
|
_( "Zoom in" ) );
|
||||||
|
|
||||||
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, BITMAP( zoom_out_xpm ),
|
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, wxBitmap( zoom_out_xpm ),
|
||||||
_( "Zoom out" ) );
|
_( "Zoom out" ) );
|
||||||
|
|
||||||
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, BITMAP( zoom_redraw_xpm ),
|
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
|
||||||
_( "Redraw view" ) );
|
wxBitmap( zoom_redraw_xpm ),
|
||||||
|
_( "Redraw view" ) );
|
||||||
|
|
||||||
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, BITMAP( zoom_auto_xpm ),
|
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, wxBitmap( zoom_auto_xpm ),
|
||||||
_( "Zoom auto" ) );
|
_( "Zoom auto" ) );
|
||||||
|
|
||||||
m_HToolBar->AddSeparator();
|
m_HToolBar->AddSeparator();
|
||||||
m_HToolBar->AddTool( ID_ROTATE3D_X_NEG, wxEmptyString, BITMAP( rotate_neg_X_xpm ),
|
m_HToolBar->AddTool( ID_ROTATE3D_X_NEG, wxEmptyString,
|
||||||
_( "Rotate X <-" ) );
|
wxBitmap( rotate_neg_X_xpm ),
|
||||||
|
_( "Rotate X <-" ) );
|
||||||
|
|
||||||
m_HToolBar->AddTool( ID_ROTATE3D_X_POS, wxEmptyString, BITMAP( rotate_pos_X_xpm ),
|
m_HToolBar->AddTool( ID_ROTATE3D_X_POS, wxEmptyString,
|
||||||
_( "Rotate X ->" ) );
|
wxBitmap( rotate_pos_X_xpm ),
|
||||||
|
_( "Rotate X ->" ) );
|
||||||
|
|
||||||
m_HToolBar->AddSeparator();
|
m_HToolBar->AddSeparator();
|
||||||
m_HToolBar->AddTool( ID_ROTATE3D_Y_NEG, wxEmptyString, BITMAP( rotate_neg_Y_xpm ),
|
m_HToolBar->AddTool( ID_ROTATE3D_Y_NEG, wxEmptyString,
|
||||||
_( "Rotate Y <-" ) );
|
wxBitmap( rotate_neg_Y_xpm ),
|
||||||
|
_( "Rotate Y <-" ) );
|
||||||
|
|
||||||
m_HToolBar->AddTool( ID_ROTATE3D_Y_POS, wxEmptyString, BITMAP( rotate_pos_Y_xpm ),
|
m_HToolBar->AddTool( ID_ROTATE3D_Y_POS, wxEmptyString,
|
||||||
_( "Rotate Y ->" ) );
|
wxBitmap( rotate_pos_Y_xpm ),
|
||||||
|
_( "Rotate Y ->" ) );
|
||||||
|
|
||||||
m_HToolBar->AddSeparator();
|
m_HToolBar->AddSeparator();
|
||||||
m_HToolBar->AddTool( ID_ROTATE3D_Z_NEG, wxEmptyString, BITMAP( rotate_neg_Z_xpm ),
|
m_HToolBar->AddTool( ID_ROTATE3D_Z_NEG, wxEmptyString,
|
||||||
_( "Rotate Z <-" ) );
|
wxBitmap( rotate_neg_Z_xpm ),
|
||||||
|
_( "Rotate Z <-" ) );
|
||||||
|
|
||||||
m_HToolBar->AddTool( ID_ROTATE3D_Z_POS, wxEmptyString, BITMAP( rotate_pos_Z_xpm ),
|
m_HToolBar->AddTool( ID_ROTATE3D_Z_POS, wxEmptyString,
|
||||||
_( "Rotate Z ->" ) );
|
wxBitmap( rotate_pos_Z_xpm ),
|
||||||
|
_( "Rotate Z ->" ) );
|
||||||
|
|
||||||
m_HToolBar->AddSeparator();
|
m_HToolBar->AddSeparator();
|
||||||
m_HToolBar->AddTool( ID_MOVE3D_LEFT, wxEmptyString, BITMAP( left_xpm ),
|
m_HToolBar->AddTool( ID_MOVE3D_LEFT, wxEmptyString, wxBitmap( left_xpm ),
|
||||||
_( "Move left <-" ) );
|
_( "Move left <-" ) );
|
||||||
|
|
||||||
m_HToolBar->AddTool( ID_MOVE3D_RIGHT, wxEmptyString, BITMAP( right_xpm ),
|
m_HToolBar->AddTool( ID_MOVE3D_RIGHT, wxEmptyString, wxBitmap( right_xpm ),
|
||||||
_( "Move right ->" ) );
|
_( "Move right ->" ) );
|
||||||
|
|
||||||
m_HToolBar->AddTool( ID_MOVE3D_UP, wxEmptyString, BITMAP( up_xpm ),
|
m_HToolBar->AddTool( ID_MOVE3D_UP, wxEmptyString, wxBitmap( up_xpm ),
|
||||||
_( "Move Up ^" ) );
|
_( "Move Up ^" ) );
|
||||||
|
|
||||||
m_HToolBar->AddTool( ID_MOVE3D_DOWN, wxEmptyString, BITMAP( down_xpm ),
|
|
||||||
_( "Move Down" ) );
|
|
||||||
|
|
||||||
|
m_HToolBar->AddTool( ID_MOVE3D_DOWN, wxEmptyString, wxBitmap( down_xpm ),
|
||||||
|
_( "Move Down" ) );
|
||||||
|
|
||||||
m_HToolBar->Realize();
|
m_HToolBar->Realize();
|
||||||
|
|
||||||
|
|
|
@ -20,12 +20,6 @@
|
||||||
# include <GL/glu.h>
|
# include <GL/glu.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef VIEWER_MAIN
|
|
||||||
#define global_3d
|
|
||||||
#else
|
|
||||||
#define global_3d extern
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "pcbstruct.h"
|
#include "pcbstruct.h"
|
||||||
#include "3d_struct.h"
|
#include "3d_struct.h"
|
||||||
|
|
||||||
|
@ -49,73 +43,73 @@ class SEGVIA;
|
||||||
class Info_3D_Visu
|
class Info_3D_Visu
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
double m_Beginx, m_Beginy; /* position of mouse */
|
double m_Beginx, m_Beginy; /* position of mouse */
|
||||||
double m_Quat[4]; /* orientation of object */
|
double m_Quat[4]; /* orientation of object */
|
||||||
double m_Rot[4]; /* man rotation of object */
|
double m_Rot[4]; /* man rotation of object */
|
||||||
double m_Zoom; /* field of view in degrees */
|
double m_Zoom; /* field of view in degrees */
|
||||||
S3D_Color m_BgColor;
|
S3D_Color m_BgColor;
|
||||||
bool m_Draw3DAxis;
|
bool m_Draw3DAxis;
|
||||||
bool m_Draw3DModule;
|
bool m_Draw3DModule;
|
||||||
bool m_Draw3DZone;
|
bool m_Draw3DZone;
|
||||||
bool m_Draw3DComments;
|
bool m_Draw3DComments;
|
||||||
bool m_Draw3DDrawings;
|
bool m_Draw3DDrawings;
|
||||||
bool m_Draw3DEco1;
|
bool m_Draw3DEco1;
|
||||||
bool m_Draw3DEco2;
|
bool m_Draw3DEco2;
|
||||||
wxPoint m_BoardPos;
|
wxPoint m_BoardPos;
|
||||||
wxSize m_BoardSize;
|
wxSize m_BoardSize;
|
||||||
int m_Layers;
|
int m_Layers;
|
||||||
EDA_BoardDesignSettings * m_BoardSettings; // Link to current board design settings
|
EDA_BoardDesignSettings * m_BoardSettings; // Link to current board design settings
|
||||||
double m_Epoxy_Width; /* Epoxy tickness (normalized) */
|
double m_Epoxy_Width; /* Epoxy tickness (normalized) */
|
||||||
|
|
||||||
double m_BoardScale; /* Normalisation scale for coordinates:
|
double m_BoardScale; /* Normalisation scale for coordinates:
|
||||||
when scaled tey are between -1.0 and +1.0 */
|
when scaled tey are between -1.0 and +1.0 */
|
||||||
double m_LayerZcoord[32];
|
double m_LayerZcoord[32];
|
||||||
public:
|
public:
|
||||||
Info_3D_Visu();
|
Info_3D_Visu();
|
||||||
~Info_3D_Visu();
|
~Info_3D_Visu();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class Pcb3D_GLCanvas: public wxGLCanvas
|
class Pcb3D_GLCanvas: public wxGLCanvas
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WinEDA3D_DrawFrame * m_Parent;
|
WinEDA3D_DrawFrame * m_Parent;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_init;
|
bool m_init;
|
||||||
GLuint m_gllist;
|
GLuint m_gllist;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Pcb3D_GLCanvas(WinEDA3D_DrawFrame *parent, const wxWindowID id = -1,
|
Pcb3D_GLCanvas( WinEDA3D_DrawFrame *parent, const wxWindowID id = -1,
|
||||||
int* gl_attrib = NULL);
|
int* gl_attrib = NULL);
|
||||||
~Pcb3D_GLCanvas();
|
~Pcb3D_GLCanvas();
|
||||||
|
|
||||||
void ClearLists();
|
void ClearLists();
|
||||||
|
|
||||||
void OnPaint(wxPaintEvent& event);
|
void OnPaint(wxPaintEvent& event);
|
||||||
void OnSize(wxSizeEvent& event);
|
void OnSize(wxSizeEvent& event);
|
||||||
void OnEraseBackground(wxEraseEvent& event);
|
void OnEraseBackground(wxEraseEvent& event);
|
||||||
void OnChar(wxKeyEvent& event);
|
void OnChar(wxKeyEvent& event);
|
||||||
void OnMouseEvent(wxMouseEvent& event);
|
void OnMouseEvent(wxMouseEvent& event);
|
||||||
void OnRightClick(wxMouseEvent& event);
|
void OnRightClick(wxMouseEvent& event);
|
||||||
void OnPopUpMenu(wxCommandEvent & event);
|
void OnPopUpMenu(wxCommandEvent & event);
|
||||||
void TakeScreenshot(wxCommandEvent & event);
|
void TakeScreenshot(wxCommandEvent & event);
|
||||||
void SetView3D(int keycode);
|
void SetView3D(int keycode);
|
||||||
void DisplayStatus();
|
void DisplayStatus();
|
||||||
void Redraw(bool finish = false);
|
void Redraw(bool finish = false);
|
||||||
GLuint DisplayCubeforTest();
|
GLuint DisplayCubeforTest();
|
||||||
|
|
||||||
void OnEnterWindow( wxMouseEvent& event );
|
void OnEnterWindow( wxMouseEvent& event );
|
||||||
|
|
||||||
void Render();
|
void Render();
|
||||||
GLuint CreateDrawGL_List();
|
GLuint CreateDrawGL_List();
|
||||||
void InitGL();
|
void InitGL();
|
||||||
void SetLights();
|
void SetLights();
|
||||||
void Draw3D_Track(TRACK * track);
|
void Draw3D_Track(TRACK * track);
|
||||||
void Draw3D_Via(SEGVIA * via);
|
void Draw3D_Via(SEGVIA * via);
|
||||||
void Draw3D_DrawSegment(DRAWSEGMENT * segment);
|
void Draw3D_DrawSegment(DRAWSEGMENT * segment);
|
||||||
void Draw3D_DrawText(TEXTE_PCB * text);
|
void Draw3D_DrawText(TEXTE_PCB * text);
|
||||||
//int Get3DLayerEnable(int act_layer);
|
//int Get3DLayerEnable(int act_layer);
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
@ -124,50 +118,50 @@ DECLARE_EVENT_TABLE()
|
||||||
class WinEDA3D_DrawFrame: public wxFrame
|
class WinEDA3D_DrawFrame: public wxFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
WinEDA_BasePcbFrame * m_Parent;
|
WinEDA_BasePcbFrame * m_Parent;
|
||||||
Pcb3D_GLCanvas * m_Canvas;
|
Pcb3D_GLCanvas * m_Canvas;
|
||||||
wxToolBar * m_HToolBar;
|
wxToolBar * m_HToolBar;
|
||||||
wxToolBar * m_VToolBar;
|
wxToolBar * m_VToolBar;
|
||||||
int m_InternalUnits;
|
int m_InternalUnits;
|
||||||
wxPoint m_FramePos;
|
wxPoint m_FramePos;
|
||||||
wxSize m_FrameSize;
|
wxSize m_FrameSize;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxString m_FrameName; // name used for writting and reading setup
|
wxString m_FrameName; // name used for writting and reading setup
|
||||||
// It is "Frame3D"
|
// It is "Frame3D"
|
||||||
|
|
||||||
public:
|
public:
|
||||||
WinEDA3D_DrawFrame(WinEDA_BasePcbFrame * parent,
|
WinEDA3D_DrawFrame( WinEDA_BasePcbFrame * parent,
|
||||||
const wxString& title,
|
const wxString& title,
|
||||||
long style = KICAD_DEFAULT_3D_DRAWFRAME_STYLE );
|
long style = KICAD_DEFAULT_3D_DRAWFRAME_STYLE );
|
||||||
|
|
||||||
void Exit3DFrame(wxCommandEvent& event);
|
void Exit3DFrame(wxCommandEvent& event);
|
||||||
void OnCloseWindow(wxCloseEvent & Event);
|
void OnCloseWindow(wxCloseEvent & Event);
|
||||||
void ReCreateMenuBar();
|
void ReCreateMenuBar();
|
||||||
void ReCreateHToolbar();
|
void ReCreateHToolbar();
|
||||||
void ReCreateVToolbar();
|
void ReCreateVToolbar();
|
||||||
void SetToolbars();
|
void SetToolbars();
|
||||||
void GetSettings();
|
void GetSettings();
|
||||||
void SaveSettings();
|
void SaveSettings();
|
||||||
|
|
||||||
void OnLeftClick(wxDC * DC, const wxPoint& MousePos);
|
void OnLeftClick(wxDC * DC, const wxPoint& MousePos);
|
||||||
void OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu);
|
void OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu);
|
||||||
void OnKeyEvent(wxKeyEvent& event);
|
void OnKeyEvent(wxKeyEvent& event);
|
||||||
int BestZoom(); // Retourne le meilleur zoom
|
int BestZoom(); // Retourne le meilleur zoom
|
||||||
void RedrawActiveWindow(wxDC * DC, bool EraseBg);
|
void RedrawActiveWindow(wxDC * DC, bool EraseBg);
|
||||||
void Process_Special_Functions(wxCommandEvent& event);
|
void Process_Special_Functions(wxCommandEvent& event);
|
||||||
void Process_Zoom(wxCommandEvent& event);
|
void Process_Zoom(wxCommandEvent& event);
|
||||||
|
|
||||||
void NewDisplay();
|
void NewDisplay();
|
||||||
void Set3DBgColor();
|
void Set3DBgColor();
|
||||||
void Set3DAxisOnOff();
|
void Set3DAxisOnOff();
|
||||||
void Set3DModuleOnOff();
|
void Set3DModuleOnOff();
|
||||||
void Set3DPlaceOnOff();
|
void Set3DPlaceOnOff();
|
||||||
void Set3DZoneOnOff();
|
void Set3DZoneOnOff();
|
||||||
void Set3DCommentsOnOff();
|
void Set3DCommentsOnOff();
|
||||||
void Set3DDrawingsOnOff();
|
void Set3DDrawingsOnOff();
|
||||||
void Set3DEco1OnOff();
|
void Set3DEco1OnOff();
|
||||||
void Set3DEco2OnOff();
|
void Set3DEco2OnOff();
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
@ -175,17 +169,8 @@ public:
|
||||||
void SetGLColor(int color);
|
void SetGLColor(int color);
|
||||||
void Set_Object_Data(const S3D_Vertex * coord, int nbcoord );
|
void Set_Object_Data(const S3D_Vertex * coord, int nbcoord );
|
||||||
|
|
||||||
global_3d Info_3D_Visu g_Parm_3D_Visu;
|
extern Info_3D_Visu g_Parm_3D_Visu;
|
||||||
global_3d double g_Draw3d_dx, g_Draw3d_dy;
|
extern double g_Draw3d_dx, g_Draw3d_dy;
|
||||||
global_3d double ZBottom, ZTop;
|
extern double ZBottom, ZTop;
|
||||||
global_3d double DataScale3D; // coeff de conversion unites utilsateut -> unites 3D
|
extern double DataScale3D; // coeff de conversion unites utilsateut -> unites 3D
|
||||||
global_3d int gl_attrib[]
|
extern int gl_attrib[];
|
||||||
#ifdef VIEWER_MAIN
|
|
||||||
= { WX_GL_RGBA, WX_GL_MIN_RED, 8, WX_GL_MIN_GREEN, 8,
|
|
||||||
WX_GL_MIN_BLUE, 8, WX_GL_DEPTH_SIZE, 16,
|
|
||||||
WX_GL_DOUBLEBUFFER,
|
|
||||||
GL_NONE }
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,56 @@ KiCad ChangeLog 2009
|
||||||
Please add newer entries at the top, list the date and your name with
|
Please add newer entries at the top, list the date and your name with
|
||||||
email address.
|
email address.
|
||||||
|
|
||||||
|
2009-xxx-xx UPDATE Wayne Stambaugh <stambaughw@verizon.net>
|
||||||
|
================================================================================
|
||||||
|
++All
|
||||||
|
* Removed all instances #ifdef eda_global, COMMON_GLOBL, and MAIN in order
|
||||||
|
to unobfuscate global variables.
|
||||||
|
* Moved global variables common to all applications into common.cpp.
|
||||||
|
* Moved global variables common to Pcbnew, Gerbview, and Cvpcb into
|
||||||
|
pcbcommon.cpp.
|
||||||
|
* Create pcbcommon library to prevent compiling shared PCB drawing object
|
||||||
|
files multiple times.
|
||||||
|
* Replaced round() with wxRound and eliminate MSVC specific implementation.
|
||||||
|
* Moved project configuration files into the application class.
|
||||||
|
* Moved editor name global variable into the application class.
|
||||||
|
* Created load and save settings methods for basic frame class and begin
|
||||||
|
putting global variables in the class where they are used.
|
||||||
|
* Start replacing obsolete wxWidgets file functions and redundant Kicad
|
||||||
|
file name manipulation code with wxFileName.
|
||||||
|
* Initial library search path implementation using wxPathList.
|
||||||
|
* Define correct wxFileDialog wild cards.
|
||||||
|
* Apply patch Fix typo in about box to keep MAC folks happy.
|
||||||
|
* Lots of general code clean up, spelling error fixes, and uncrustification.
|
||||||
|
* Renamed Affiche_Status_Box to UpdateStatusBar.
|
||||||
|
++EESchema
|
||||||
|
* Defined Load() method so library file drawing objects can load themselves.
|
||||||
|
* Defined GetBoundingBox() method so library file drawing objects can
|
||||||
|
calculate their own bounding box.
|
||||||
|
* Fix arc library drawing object bounding box calculation.
|
||||||
|
* Remember last import and export library path in library editor.
|
||||||
|
* Add new library search path support.
|
||||||
|
++Kicad
|
||||||
|
* Eliminate the one giant case statement to rule them all command event
|
||||||
|
handler and create per command event handlers.
|
||||||
|
++CvPcb
|
||||||
|
* Add new library search path support.
|
||||||
|
* Add message dialogs to prompt user of library file load errors instead of
|
||||||
|
failing silently.
|
||||||
|
* Fix NULL pointer bug were display frame would crash CvPcb when
|
||||||
|
WinEDA_DisplayFrame::Get_Module() could not find foot print module.
|
||||||
|
++PcbNew
|
||||||
|
* Add new library search path support.
|
||||||
|
* Add message dialogs to prompt user of library file load errors instead of
|
||||||
|
failing silently.
|
||||||
|
|
||||||
|
|
||||||
2009-mar-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
|
2009-mar-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
|
||||||
================================================================================
|
================================================================================
|
||||||
++pcbnew:
|
++pcbnew:
|
||||||
added BOM generator (in postprocess menu)
|
added BOM generator (in postprocess menu)
|
||||||
|
|
||||||
|
|
||||||
2009-mar-28 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
|
2009-mar-28 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
|
||||||
================================================================================
|
================================================================================
|
||||||
++All
|
++All
|
||||||
|
@ -24,7 +69,6 @@ email address.
|
||||||
================================================================================
|
================================================================================
|
||||||
++pcbnew:
|
++pcbnew:
|
||||||
in DRC: added test pads to holes.
|
in DRC: added test pads to holes.
|
||||||
|
|
||||||
++Al:
|
++Al:
|
||||||
minor changes.
|
minor changes.
|
||||||
|
|
||||||
|
@ -66,7 +110,6 @@ email address.
|
||||||
print,plot: error message displayed when no layer selected.
|
print,plot: error message displayed when no layer selected.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
2009-Mar-5 UPDATE Vesa Solonen <vesa.solonen@hut.fi>
|
2009-Mar-5 UPDATE Vesa Solonen <vesa.solonen@hut.fi>
|
||||||
================================================================================
|
================================================================================
|
||||||
++pcbnew:
|
++pcbnew:
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
${Boost_INCLUDE_DIR}
|
${Boost_INCLUDE_DIR}
|
||||||
|
../3d-viewer
|
||||||
../pcbnew
|
../pcbnew
|
||||||
../polygon
|
../polygon
|
||||||
)
|
)
|
||||||
|
@ -41,23 +42,36 @@ set(COMMON_SRCS
|
||||||
worksheet.cpp
|
worksheet.cpp
|
||||||
wxwineda.cpp
|
wxwineda.cpp
|
||||||
zoom.cpp
|
zoom.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(common ${COMMON_SRCS})
|
||||||
|
|
||||||
|
set(PCB_COMMON_SRCS
|
||||||
|
pcbcommon.cpp
|
||||||
../pcbnew/basepcbframe.cpp
|
../pcbnew/basepcbframe.cpp
|
||||||
../pcbnew/class_board.cpp
|
../pcbnew/class_board.cpp
|
||||||
../pcbnew/class_board_connected_item.cpp
|
../pcbnew/class_board_connected_item.cpp
|
||||||
|
../pcbnew/class_board_item.cpp
|
||||||
../pcbnew/class_cotation.cpp
|
../pcbnew/class_cotation.cpp
|
||||||
|
../pcbnew/class_drawsegment.cpp
|
||||||
../pcbnew/class_drc_item.cpp
|
../pcbnew/class_drc_item.cpp
|
||||||
|
../pcbnew/class_edge_mod.cpp
|
||||||
|
../pcbnew/class_equipot.cpp
|
||||||
../pcbnew/class_marker.cpp
|
../pcbnew/class_marker.cpp
|
||||||
../pcbnew/class_mire.cpp
|
../pcbnew/class_mire.cpp
|
||||||
|
../pcbnew/class_module.cpp
|
||||||
../pcbnew/class_pad.cpp
|
../pcbnew/class_pad.cpp
|
||||||
../pcbnew/class_pad_draw_functions.cpp
|
../pcbnew/class_pad_draw_functions.cpp
|
||||||
../pcbnew/class_pcb_text.cpp
|
../pcbnew/class_pcb_text.cpp
|
||||||
|
../pcbnew/class_text_mod.cpp
|
||||||
|
../pcbnew/class_track.cpp
|
||||||
../pcbnew/class_zone.cpp
|
../pcbnew/class_zone.cpp
|
||||||
../pcbnew/class_zone_setting.cpp
|
../pcbnew/class_zone_setting.cpp
|
||||||
../pcbnew/classpcb.cpp
|
../pcbnew/classpcb.cpp
|
||||||
../pcbnew/collectors.cpp
|
../pcbnew/collectors.cpp
|
||||||
../pcbnew/sel_layer.cpp
|
../pcbnew/sel_layer.cpp
|
||||||
|
../pcbnew/tracemod.cpp
|
||||||
../pcbnew/dialog_print_using_printer_base.cpp
|
../pcbnew/dialog_print_using_printer_base.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(common ${COMMON_SRCS})
|
add_library(pcbcommon ${PCB_COMMON_SRCS})
|
||||||
|
|
|
@ -5,8 +5,30 @@
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "appl_wxstruct.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define BUILD_VERSION wxT("(20090325-unstable)")
|
||||||
|
|
||||||
|
wxString g_BuildVersion
|
||||||
|
|
||||||
|
#ifdef HAVE_SVN_VERSION
|
||||||
|
#include "config.h"
|
||||||
|
( wxT( KICAD_SVN_VERSION ) )
|
||||||
|
#else
|
||||||
|
( BUILD_VERSION )
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
|
wxString g_BuildAboutVersion
|
||||||
|
#if defined(HAVE_SVN_VERSION) || defined(HAVE_SVN_REVISION)
|
||||||
|
# include "config.h"
|
||||||
|
( wxT( KICAD_ABOUT_VERSION ) )
|
||||||
|
#else
|
||||||
|
( BUILD_VERSION )
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
extern wxString g_Main_Title; // Import program title
|
|
||||||
|
|
||||||
/**********************************/
|
/**********************************/
|
||||||
wxString SetMsg( const wxString& msg )
|
wxString SetMsg( const wxString& msg )
|
||||||
|
@ -33,7 +55,7 @@ void InitKiCadAbout( wxAboutDialogInfo& info )
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
{
|
{
|
||||||
/* Set name and title */
|
/* Set name and title */
|
||||||
info.SetName( g_Main_Title );
|
info.SetName( wxGetApp().GetTitle() );
|
||||||
|
|
||||||
/* Set description */
|
/* Set description */
|
||||||
wxString description;
|
wxString description;
|
||||||
|
@ -65,7 +87,7 @@ void InitKiCadAbout( wxAboutDialogInfo& info )
|
||||||
|
|
||||||
/* Check for wxMAC */
|
/* Check for wxMAC */
|
||||||
# elif defined __WXMAC__
|
# elif defined __WXMAC__
|
||||||
description << ( wxT( "on Macintosch" ) );
|
description << ( wxT( "on Macintosh" ) );
|
||||||
|
|
||||||
/* Linux 64 bits */
|
/* Linux 64 bits */
|
||||||
# elif defined _LP64 && __LINUX__
|
# elif defined _LP64 && __LINUX__
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <wx/arrimpl.cpp>
|
#include <wx/arrimpl.cpp>
|
||||||
WX_DEFINE_OBJARRAY( GridArray );
|
WX_DEFINE_OBJARRAY( GridArray );
|
||||||
|
|
||||||
|
BASE_SCREEN* ActiveScreen = NULL;
|
||||||
|
|
||||||
/* defines locaux */
|
/* defines locaux */
|
||||||
#define CURSOR_SIZE 12 /* taille de la croix du curseur PCB */
|
#define CURSOR_SIZE 12 /* taille de la croix du curseur PCB */
|
||||||
|
@ -39,6 +40,7 @@ BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_BaseStruct( aType )
|
||||||
m_UserGridIsON = FALSE;
|
m_UserGridIsON = FALSE;
|
||||||
m_Center = true;
|
m_Center = true;
|
||||||
m_CurrentSheetDesc = &g_Sheet_A4;
|
m_CurrentSheetDesc = &g_Sheet_A4;
|
||||||
|
m_IsPrinting = false;
|
||||||
|
|
||||||
InitDatas();
|
InitDatas();
|
||||||
}
|
}
|
||||||
|
@ -165,6 +167,20 @@ int BASE_SCREEN::Scale( int coord )
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double BASE_SCREEN::Scale( double coord )
|
||||||
|
{
|
||||||
|
#ifdef WX_ZOOM
|
||||||
|
return coord;
|
||||||
|
#else
|
||||||
|
if( !m_Zoom )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if( !m_ZoomScalar || !m_Zoom )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return ( coord * (double) m_ZoomScalar ) / (double) m_Zoom;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void BASE_SCREEN::Scale( wxPoint& pt )
|
void BASE_SCREEN::Scale( wxPoint& pt )
|
||||||
{
|
{
|
||||||
|
|
|
@ -77,18 +77,21 @@ WinEDA_BasicFrame::~WinEDA_BasicFrame()
|
||||||
* Virtual function
|
* Virtual function
|
||||||
*/
|
*/
|
||||||
/***********************************/
|
/***********************************/
|
||||||
void
|
void WinEDA_BasicFrame::ReCreateMenuBar()
|
||||||
WinEDA_BasicFrame::ReCreateMenuBar()
|
|
||||||
/***********************************/
|
/***********************************/
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************/
|
/**
|
||||||
void
|
* Load common frame parameters from configuration.
|
||||||
WinEDA_BasicFrame::GetSettings()
|
*
|
||||||
/*******************************/
|
* The method is virtual so you can override it to load frame specific
|
||||||
|
* parameters. Don't forget to call the base method or your frames won't
|
||||||
|
* remember their positions and sizes.
|
||||||
|
*/
|
||||||
|
void WinEDA_BasicFrame::LoadSettings()
|
||||||
{
|
{
|
||||||
wxString text;
|
wxString text;
|
||||||
int Ypos_min;
|
int Ypos_min;
|
||||||
|
@ -121,10 +124,14 @@ WinEDA_BasicFrame::GetSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************/
|
/**
|
||||||
void
|
* Save common frame parameters from configuration.
|
||||||
WinEDA_BasicFrame::SaveSettings()
|
*
|
||||||
/********************************/
|
* The method is virtual so you can override it to save frame specific
|
||||||
|
* parameters. Don't forget to call the base method or your frames won't
|
||||||
|
* remember their positions and sizes.
|
||||||
|
*/
|
||||||
|
void WinEDA_BasicFrame::SaveSettings()
|
||||||
{
|
{
|
||||||
wxString text;
|
wxString text;
|
||||||
wxConfig* config;
|
wxConfig* config;
|
||||||
|
@ -149,8 +156,7 @@ WinEDA_BasicFrame::SaveSettings()
|
||||||
|
|
||||||
|
|
||||||
/******************************************************/
|
/******************************************************/
|
||||||
void
|
void WinEDA_BasicFrame::PrintMsg( const wxString& text )
|
||||||
WinEDA_BasicFrame::PrintMsg( const wxString& text )
|
|
||||||
/******************************************************/
|
/******************************************************/
|
||||||
{
|
{
|
||||||
SetStatusText( text );
|
SetStatusText( text );
|
||||||
|
@ -161,9 +167,7 @@ WinEDA_BasicFrame::PrintMsg( const wxString& text )
|
||||||
* Display a bargraph (0 to 50 point length) for a PerCent value from 0 to 100
|
* Display a bargraph (0 to 50 point length) for a PerCent value from 0 to 100
|
||||||
*/
|
*/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
void
|
void WinEDA_BasicFrame::DisplayActivity( int PerCent, const wxString& Text )
|
||||||
WinEDA_BasicFrame::DisplayActivity( int PerCent,
|
|
||||||
const wxString& Text )
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
{
|
{
|
||||||
wxString Line;
|
wxString Line;
|
||||||
|
@ -184,8 +188,7 @@ WinEDA_BasicFrame::DisplayActivity( int PerCent,
|
||||||
* Met a jour la liste des anciens projets
|
* Met a jour la liste des anciens projets
|
||||||
*/
|
*/
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
void
|
void WinEDA_BasicFrame::SetLastProject( const wxString& FullFileName )
|
||||||
WinEDA_BasicFrame::SetLastProject( const wxString& FullFileName )
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
{
|
{
|
||||||
wxGetApp().m_fileHistory.AddFileToHistory( FullFileName );
|
wxGetApp().m_fileHistory.AddFileToHistory( FullFileName );
|
||||||
|
@ -231,8 +234,7 @@ wxString WinEDA_BasicFrame::GetFileFromHistory( int cmdId,
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
void
|
void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event )
|
||||||
WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event )
|
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
@ -286,8 +288,7 @@ WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event )
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
void
|
void WinEDA_BasicFrame::GetKicadAbout( wxCommandEvent& WXUNUSED(event) )
|
||||||
WinEDA_BasicFrame::GetKicadAbout( wxCommandEvent& WXUNUSED(event) )
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
{
|
{
|
||||||
wxAboutDialogInfo info;
|
wxAboutDialogInfo info;
|
||||||
|
@ -300,8 +301,7 @@ WinEDA_BasicFrame::GetKicadAbout( wxCommandEvent& WXUNUSED(event) )
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
void
|
void WinEDA_BasicFrame::ProcessFontPreferences( int id )
|
||||||
WinEDA_BasicFrame::ProcessFontPreferences( int id )
|
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
{
|
{
|
||||||
wxFont font;
|
wxFont font;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
#include "base_struct.h"
|
#include "base_struct.h"
|
||||||
#include "sch_item_struct.h"
|
#include "class_drawpickedstruct.h"
|
||||||
#include "class_base_screen.h"
|
#include "class_base_screen.h"
|
||||||
#include "class_drawpanel.h"
|
#include "class_drawpanel.h"
|
||||||
#include "confirm.h"
|
#include "confirm.h"
|
||||||
|
|
|
@ -4,29 +4,9 @@
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "base_struct.h"
|
#include "class_drawpickedstruct.h"
|
||||||
#include "sch_item_struct.h"
|
|
||||||
|
|
||||||
|
|
||||||
/* Constructor and destructor for SCH_ITEM */
|
|
||||||
/* They are not inline because this creates problems with gcc at linking time
|
|
||||||
* in debug mode
|
|
||||||
*/
|
|
||||||
|
|
||||||
SCH_ITEM::SCH_ITEM( EDA_BaseStruct* aParent, KICAD_T aType ) :
|
|
||||||
EDA_BaseStruct( aParent, aType )
|
|
||||||
{
|
|
||||||
m_Layer = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
SCH_ITEM::~SCH_ITEM()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**************************/
|
|
||||||
/* class DrawPickedStruct */
|
|
||||||
/**************************/
|
|
||||||
|
|
||||||
/* This class has only one useful member: .m_PickedStruct, used as a link.
|
/* This class has only one useful member: .m_PickedStruct, used as a link.
|
||||||
* It does not describe really an item.
|
* It does not describe really an item.
|
||||||
* It is used to create a linked list of selected items (in block selection).
|
* It is used to create a linked list of selected items (in block selection).
|
||||||
|
@ -35,8 +15,8 @@ SCH_ITEM::~SCH_ITEM()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
DrawPickedStruct::DrawPickedStruct( SCH_ITEM * pickedstruct ) :
|
DrawPickedStruct::DrawPickedStruct( EDA_BaseStruct* pickedstruct ) :
|
||||||
SCH_ITEM( NULL, DRAW_PICK_ITEM_STRUCT_TYPE )
|
EDA_BaseStruct( NULL, DRAW_PICK_ITEM_STRUCT_TYPE )
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
{
|
{
|
||||||
m_PickedStruct = pickedstruct;
|
m_PickedStruct = pickedstruct;
|
||||||
|
@ -68,10 +48,10 @@ EDA_Rect DrawPickedStruct::GetBoundingBox()
|
||||||
|
|
||||||
EDA_Rect DrawPickedStruct::GetBoundingBoxUnion()
|
EDA_Rect DrawPickedStruct::GetBoundingBoxUnion()
|
||||||
{
|
{
|
||||||
EDA_Rect ret;
|
EDA_Rect ret;
|
||||||
|
EDA_BaseStruct* item;
|
||||||
|
DrawPickedStruct* cur = this;
|
||||||
|
|
||||||
DrawPickedStruct* cur = this;
|
|
||||||
SCH_ITEM* item;
|
|
||||||
while( cur && (item = cur->m_PickedStruct) != NULL )
|
while( cur && (item = cur->m_PickedStruct) != NULL )
|
||||||
{
|
{
|
||||||
ret.Merge( item->GetBoundingBox() );
|
ret.Merge( item->GetBoundingBox() );
|
||||||
|
|
|
@ -12,13 +12,124 @@
|
||||||
#include "confirm.h"
|
#include "confirm.h"
|
||||||
#include <wx/process.h>
|
#include <wx/process.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Global variables definitions.
|
||||||
|
*
|
||||||
|
* TODO: All if these variables should be moved into the class were they
|
||||||
|
* are defined and used. Most of them probably belong in the
|
||||||
|
* application class.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Standard page sizes in 1/1000 inch */
|
||||||
|
Ki_PageDescr g_Sheet_A4( wxSize( 11700, 8267 ), wxPoint( 0, 0 ), wxT( "A4" ) );
|
||||||
|
Ki_PageDescr g_Sheet_A3( wxSize( 16535, 11700 ), wxPoint( 0, 0 ), wxT( "A3" ) );
|
||||||
|
Ki_PageDescr g_Sheet_A2( wxSize( 23400, 16535 ), wxPoint( 0, 0 ), wxT( "A2" ) );
|
||||||
|
Ki_PageDescr g_Sheet_A1( wxSize( 33070, 23400 ), wxPoint( 0, 0 ), wxT( "A1" ) );
|
||||||
|
Ki_PageDescr g_Sheet_A0( wxSize( 46800, 33070 ), wxPoint( 0, 0 ), wxT( "A0" ) );
|
||||||
|
Ki_PageDescr g_Sheet_A( wxSize( 11000, 8500 ), wxPoint( 0, 0 ), wxT( "A" ) );
|
||||||
|
Ki_PageDescr g_Sheet_B( wxSize( 17000, 11000 ), wxPoint( 0, 0 ), wxT( "B" ) );
|
||||||
|
Ki_PageDescr g_Sheet_C( wxSize( 22000, 17000 ), wxPoint( 0, 0 ), wxT( "C" ) );
|
||||||
|
Ki_PageDescr g_Sheet_D( wxSize( 34000, 22000 ), wxPoint( 0, 0 ), wxT( "D" ) );
|
||||||
|
Ki_PageDescr g_Sheet_E( wxSize( 44000, 34000 ), wxPoint( 0, 0 ), wxT( "E" ) );
|
||||||
|
Ki_PageDescr g_Sheet_GERBER( wxSize( 32000, 32000 ), wxPoint( 0, 0 ),
|
||||||
|
wxT( "GERBER" ) );
|
||||||
|
Ki_PageDescr g_Sheet_user( wxSize( 17000, 11000 ), wxPoint( 0, 0 ),
|
||||||
|
wxT( "User" ) );
|
||||||
|
|
||||||
|
Ki_PageDescr* g_SheetSizeList[NB_ITEMS + 1] =
|
||||||
|
{
|
||||||
|
&g_Sheet_A4, &g_Sheet_A3, &g_Sheet_A2, &g_Sheet_A1, &g_Sheet_A0,
|
||||||
|
&g_Sheet_A, &g_Sheet_B, &g_Sheet_C, &g_Sheet_D, &g_Sheet_E,
|
||||||
|
&g_Sheet_user, NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* File extension definitions. Please do not changes these. If a different
|
||||||
|
* file extension is needed, create a new definition in the application.
|
||||||
|
* Please note, just because they are defined as const dosen't guarentee
|
||||||
|
* that they cannot be changed. */
|
||||||
|
const wxString ProjectFileExtension( wxT( "pro" ) );
|
||||||
|
const wxString SchematicFileExtension( wxT( "sch" ) );
|
||||||
|
const wxString BoardFileExtension( wxT( "brd" ) );
|
||||||
|
const wxString NetlistFileExtension( wxT( "net" ) );
|
||||||
|
const wxString GerberFileExtension( wxT( "pho" ) );
|
||||||
|
|
||||||
|
/* Proper wxFileDialog wild card definitions. */
|
||||||
|
const wxString ProjectFileWildcard( _( "Kicad project files (*.pro)|*.pro" ) );
|
||||||
|
const wxString BoardFileWildcard( _( "Kicad PCB files (*.brd)|*.brd") );
|
||||||
|
const wxString SchematicFileWildcard( _( "Kicad schematic files (*.sch)|*.sch" ) );
|
||||||
|
const wxString NetlistFileWildcard( _( "Kicad netlist files (*.net)|*.net" ) );
|
||||||
|
const wxString GerberFileWildcard( _( "Gerber files (*.pho)|*.pho" ) );
|
||||||
|
const wxString AllFilesWildcard( _( "All files (*)|*") );
|
||||||
|
|
||||||
|
|
||||||
|
wxString g_ProductName = wxT( "KiCad E.D.A. " );
|
||||||
|
bool g_ShowPageLimits = true;
|
||||||
|
int g_GridColor = DARKGRAY;
|
||||||
|
wxString g_RealLibDirBuffer;
|
||||||
|
wxString g_UserLibDirBuffer;
|
||||||
|
int g_DebugLevel;
|
||||||
|
int g_MouseOldButtons;
|
||||||
|
int g_KeyPressed;
|
||||||
|
wxFont* g_StdFont = NULL;
|
||||||
|
wxFont* g_DialogFont = NULL; /* Normal font used in dialog box */
|
||||||
|
wxFont* g_ItalicFont = NULL; /* Italic font used in dialog box */
|
||||||
|
wxFont* g_MsgFont = NULL; /* Italic font used in message panel */
|
||||||
|
wxFont* g_FixedFont = NULL; /* Affichage de Texte en fenetres de dialogue,
|
||||||
|
* fonte a pas fixe)*/
|
||||||
|
int g_StdFontPointSize; /* taille de la fonte */
|
||||||
|
int g_DialogFontPointSize; /* taille de la fonte */
|
||||||
|
int g_FixedFontPointSize; /* taille de la fonte */
|
||||||
|
int g_MsgFontPointSize; /* taille de la fonte */
|
||||||
|
int g_FontMinPointSize; /* taille minimum des fontes */
|
||||||
|
|
||||||
|
|
||||||
|
// Nom (full file name) du file Configuration par defaut (kicad.pro)
|
||||||
|
wxString g_Prj_Default_Config_FullFilename;
|
||||||
|
|
||||||
|
// Nom du file Configuration local (<curr projet>.pro)
|
||||||
|
wxString g_Prj_Config_LocalFilename;
|
||||||
|
|
||||||
|
// Handle the preferd editor for browsing report files:
|
||||||
|
int g_UnitMetric; // display units mm = 1, inches = 0, cm = 2
|
||||||
|
|
||||||
|
/* Draw color for moving objects: */
|
||||||
|
int g_GhostColor;
|
||||||
|
|
||||||
|
StructColors ColorRefs[NBCOLOR] =
|
||||||
|
{
|
||||||
|
{ 0, 0, 0, BLACK, wxT("BLACK"), DARKDARKGRAY},
|
||||||
|
{ 192, 0, 0, BLUE, wxT("BLUE"), LIGHTBLUE},
|
||||||
|
{ 0, 160, 0, GREEN, wxT("GREEN"), LIGHTGREEN },
|
||||||
|
{ 160, 160, 0, CYAN, wxT("CYAN"), LIGHTCYAN },
|
||||||
|
{ 0, 0, 160, RED, wxT("RED"), LIGHTRED },
|
||||||
|
{ 160, 0, 160, MAGENTA, wxT("MAGENTA"), LIGHTMAGENTA },
|
||||||
|
{ 0, 128, 128, BROWN, wxT("BROWN"), YELLOW },
|
||||||
|
{ 192, 192, 192, LIGHTGRAY, wxT("GRAY"), WHITE },
|
||||||
|
{ 128, 128, 128, DARKGRAY, wxT("DARKGRAY"), LIGHTGRAY },
|
||||||
|
{ 255, 0, 0, LIGHTBLUE, wxT("LIGHTBLUE"), LIGHTBLUE },
|
||||||
|
{ 0, 255, 0, LIGHTGREEN, wxT("LIGHTGREEN"), LIGHTGREEN },
|
||||||
|
{ 255, 255, 0, LIGHTCYAN, wxT("LIGHTCYAN"), LIGHTCYAN },
|
||||||
|
{ 0, 0, 255, LIGHTRED, wxT("LIGHTRED"), LIGHTRED },
|
||||||
|
{ 255, 0, 255, LIGHTMAGENTA, wxT("LIGHTMAGENTA"), LIGHTMAGENTA },
|
||||||
|
{ 0, 255, 255, YELLOW, wxT("YELLOW"), YELLOW },
|
||||||
|
{ 255, 255, 255, WHITE, wxT("WHITE"), WHITE },
|
||||||
|
{ 64, 64, 64, DARKDARKGRAY, wxT("DARKDARKGRAY"), DARKGRAY },
|
||||||
|
{ 64, 0, 0, DARKBLUE, wxT("DARKBLUE"), BLUE },
|
||||||
|
{ 0, 64, 0, DARKGREEN, wxT("DARKGREEN"), GREEN },
|
||||||
|
{ 64, 64, 0, DARKCYAN, wxT("DARKCYAN"), CYAN },
|
||||||
|
{ 0, 0, 80, DARKRED, wxT("DARKRED"), RED },
|
||||||
|
{ 64, 0, 64, DARKMAGENTA, wxT("DARKMAGENTA"), MAGENTA },
|
||||||
|
{ 0, 64, 64, DARKBROWN, wxT("DARKBROWN"), BROWN },
|
||||||
|
{ 128, 255, 255, LIGHTYELLOW, wxT("LIGHTYELLOW"), LIGHTYELLOW }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return the build date
|
* Return the build date
|
||||||
*/
|
*/
|
||||||
/****************/
|
/****************/
|
||||||
wxString
|
wxString GetBuildVersion()
|
||||||
GetBuildVersion()
|
|
||||||
/****************/
|
/****************/
|
||||||
{
|
{
|
||||||
return g_BuildVersion;
|
return g_BuildVersion;
|
||||||
|
@ -28,9 +139,7 @@ GetBuildVersion()
|
||||||
/*
|
/*
|
||||||
* Return custom build date for about dialog
|
* Return custom build date for about dialog
|
||||||
*/
|
*/
|
||||||
wxString
|
wxString GetAboutBuildVersion()
|
||||||
GetAboutBuildVersion()
|
|
||||||
/*********************************************/
|
|
||||||
{
|
{
|
||||||
return g_BuildAboutVersion;
|
return g_BuildAboutVersion;
|
||||||
}
|
}
|
||||||
|
@ -47,9 +156,7 @@ GetAboutBuildVersion()
|
||||||
* but could make more easier an optional use of locale in kicad
|
* but could make more easier an optional use of locale in kicad
|
||||||
*/
|
*/
|
||||||
/********************************/
|
/********************************/
|
||||||
void
|
void SetLocaleTo_C_standard( void )
|
||||||
SetLocaleTo_C_standard( void )
|
|
||||||
/********************************/
|
|
||||||
{
|
{
|
||||||
setlocale( LC_NUMERIC, "C" ); // Switch the locale to standard C
|
setlocale( LC_NUMERIC, "C" ); // Switch the locale to standard C
|
||||||
}
|
}
|
||||||
|
@ -73,9 +180,8 @@ void SetLocaleTo_Default( void )
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
bool
|
bool EnsureTextCtrlWidth(wxTextCtrl* aCtrl,
|
||||||
EnsureTextCtrlWidth(wxTextCtrl* aCtrl,
|
const wxString* aString )
|
||||||
const wxString* aString )
|
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
{
|
{
|
||||||
wxWindow* window = aCtrl->GetParent();
|
wxWindow* window = aCtrl->GetParent();
|
||||||
|
@ -134,8 +240,7 @@ Ki_PageDescr::Ki_PageDescr(const wxSize& size,
|
||||||
|
|
||||||
|
|
||||||
/************************************/
|
/************************************/
|
||||||
wxString
|
wxString ReturnUnitSymbol( int Units )
|
||||||
ReturnUnitSymbol( int Units )
|
|
||||||
/************************************/
|
/************************************/
|
||||||
{
|
{
|
||||||
wxString label;
|
wxString label;
|
||||||
|
@ -158,14 +263,12 @@ ReturnUnitSymbol( int Units )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add string " (mm):" or " ("):" to the static text Stext.
|
* Add string " (mm):" or " ("):" to the static text Stext.
|
||||||
* Used in dialog boxes for entering values depending on selected units
|
* Used in dialog boxes for entering values depending on selected units
|
||||||
*/
|
*/
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
void
|
void AddUnitSymbol( wxStaticText& Stext, int Units )
|
||||||
AddUnitSymbol(wxStaticText& Stext,
|
|
||||||
int Units )
|
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
{
|
{
|
||||||
wxString msg = Stext.GetLabel() + ReturnUnitSymbol( Units );
|
wxString msg = Stext.GetLabel() + ReturnUnitSymbol( Units );
|
||||||
|
@ -174,15 +277,12 @@ AddUnitSymbol(wxStaticText& Stext,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert the number Value in a string according to the internal units
|
* Convert the number Value in a string according to the internal units
|
||||||
* and the selected unit (g_UnitMetric) and put it in the wxTextCtrl TextCtrl
|
* and the selected unit (g_UnitMetric) and put it in the wxTextCtrl TextCtrl
|
||||||
*/
|
*/
|
||||||
/******************************************/
|
/******************************************/
|
||||||
void
|
void PutValueInLocalUnits( wxTextCtrl& TextCtr, int Value, int Internal_Unit )
|
||||||
PutValueInLocalUnits( wxTextCtrl& TextCtr,
|
|
||||||
int Value,
|
|
||||||
int Internal_Unit )
|
|
||||||
/*****************************************/
|
/*****************************************/
|
||||||
{
|
{
|
||||||
wxString msg = ReturnStringFromValue( g_UnitMetric, Value, Internal_Unit );
|
wxString msg = ReturnStringFromValue( g_UnitMetric, Value, Internal_Unit );
|
||||||
|
@ -196,9 +296,7 @@ PutValueInLocalUnits( wxTextCtrl& TextCtr,
|
||||||
* according to the internal units and the selected unit (g_UnitMetric)
|
* according to the internal units and the selected unit (g_UnitMetric)
|
||||||
*/
|
*/
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
int
|
int ReturnValueFromTextCtrl( const wxTextCtrl& TextCtr, int Internal_Unit )
|
||||||
ReturnValueFromTextCtrl( const wxTextCtrl& TextCtr,
|
|
||||||
int Internal_Unit )
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
{
|
{
|
||||||
int value;
|
int value;
|
||||||
|
@ -220,11 +318,8 @@ ReturnValueFromTextCtrl( const wxTextCtrl& TextCtr,
|
||||||
* @return a wxString what contains value and optionnaly the sumbol unit (like 2.000 mm)
|
* @return a wxString what contains value and optionnaly the sumbol unit (like 2.000 mm)
|
||||||
*/
|
*/
|
||||||
/*******************************************/
|
/*******************************************/
|
||||||
wxString
|
wxString ReturnStringFromValue( int aUnits, int aValue, int aInternal_Unit,
|
||||||
ReturnStringFromValue(int aUnits,
|
bool aAdd_unit_symbol )
|
||||||
int aValue,
|
|
||||||
int aInternal_Unit,
|
|
||||||
bool aAdd_unit_symbol)
|
|
||||||
/*******************************************/
|
/*******************************************/
|
||||||
{
|
{
|
||||||
wxString StringValue;
|
wxString StringValue;
|
||||||
|
@ -258,7 +353,7 @@ ReturnStringFromValue(int aUnits,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return the string from Value, according to units (inch, mm ...) for display,
|
* Return the string from Value, according to units (inch, mm ...) for display,
|
||||||
* and the initial unit for value
|
* and the initial unit for value
|
||||||
* Unit = display units (INCH, MM ..)
|
* Unit = display units (INCH, MM ..)
|
||||||
|
@ -266,10 +361,8 @@ ReturnStringFromValue(int aUnits,
|
||||||
* Internal_Unit = units per inch for computed value
|
* Internal_Unit = units per inch for computed value
|
||||||
*/
|
*/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
int
|
int ReturnValueFromString( int Units, const wxString& TextValue,
|
||||||
ReturnValueFromString( int Units,
|
int Internal_Unit )
|
||||||
const wxString& TextValue,
|
|
||||||
int Internal_Unit )
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
{
|
{
|
||||||
int Value;
|
int Value;
|
||||||
|
@ -277,7 +370,7 @@ ReturnValueFromString( int Units,
|
||||||
|
|
||||||
TextValue.ToDouble( &dtmp );
|
TextValue.ToDouble( &dtmp );
|
||||||
if( Units >= CENTIMETRE )
|
if( Units >= CENTIMETRE )
|
||||||
Value = (int) round( dtmp );
|
Value = wxRound( dtmp );
|
||||||
else
|
else
|
||||||
Value = From_User_Unit( Units, dtmp, Internal_Unit );
|
Value = From_User_Unit( Units, dtmp, Internal_Unit );
|
||||||
|
|
||||||
|
@ -286,9 +379,7 @@ ReturnValueFromString( int Units,
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
double To_User_Unit( bool is_metric,
|
double To_User_Unit( bool is_metric, int val, int internal_unit_value )
|
||||||
int val,
|
|
||||||
int internal_unit_value )
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
/**
|
/**
|
||||||
* Function To_User_Unit
|
* Function To_User_Unit
|
||||||
|
@ -339,10 +430,7 @@ double To_User_Unit( bool is_metric,
|
||||||
* Return in internal units the value "val" given in inch or mm
|
* Return in internal units the value "val" given in inch or mm
|
||||||
*/
|
*/
|
||||||
/*****************************************/
|
/*****************************************/
|
||||||
int
|
int From_User_Unit( bool is_metric, double val, int internal_unit_value )
|
||||||
From_User_Unit( bool is_metric,
|
|
||||||
double val,
|
|
||||||
int internal_unit_value )
|
|
||||||
/*****************************************/
|
/*****************************************/
|
||||||
{
|
{
|
||||||
double value;
|
double value;
|
||||||
|
@ -352,7 +440,7 @@ From_User_Unit( bool is_metric,
|
||||||
else
|
else
|
||||||
value = val * internal_unit_value;
|
value = val * internal_unit_value;
|
||||||
|
|
||||||
return (int) round( value );
|
return wxRound( value );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -360,8 +448,7 @@ From_User_Unit( bool is_metric,
|
||||||
* Return the string date "day month year" like "23 jun 2005"
|
* Return the string date "day month year" like "23 jun 2005"
|
||||||
*/
|
*/
|
||||||
/********/
|
/********/
|
||||||
wxString
|
wxString GenDate()
|
||||||
GenDate()
|
|
||||||
/********/
|
/********/
|
||||||
{
|
{
|
||||||
static const wxString mois[12] =
|
static const wxString mois[12] =
|
||||||
|
@ -387,8 +474,7 @@ GenDate()
|
||||||
* My memory allocation
|
* My memory allocation
|
||||||
*/
|
*/
|
||||||
/***********************************/
|
/***********************************/
|
||||||
void*
|
void* MyMalloc( size_t nb_octets )
|
||||||
MyMalloc( size_t nb_octets )
|
|
||||||
/***********************************/
|
/***********************************/
|
||||||
{
|
{
|
||||||
void* pt_mem;
|
void* pt_mem;
|
||||||
|
@ -417,9 +503,7 @@ MyMalloc( size_t nb_octets )
|
||||||
* @return bool - true if success, else false
|
* @return bool - true if success, else false
|
||||||
*/
|
*/
|
||||||
/********************************************/
|
/********************************************/
|
||||||
bool
|
bool ProcessExecute( const wxString& aCommandLine, int aFlags )
|
||||||
ProcessExecute( const wxString& aCommandLine,
|
|
||||||
int aFlags )
|
|
||||||
/********************************************/
|
/********************************************/
|
||||||
{
|
{
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
|
@ -436,8 +520,7 @@ ProcessExecute( const wxString& aCommandLine,
|
||||||
* My memory allocation, memory space is cleared
|
* My memory allocation, memory space is cleared
|
||||||
*/
|
*/
|
||||||
/*****************************/
|
/*****************************/
|
||||||
void*
|
void* MyZMalloc( size_t nb_octets )
|
||||||
MyZMalloc( size_t nb_octets )
|
|
||||||
/*****************************/
|
/*****************************/
|
||||||
{
|
{
|
||||||
void* pt_mem = MyMalloc( nb_octets );
|
void* pt_mem = MyMalloc( nb_octets );
|
||||||
|
@ -449,8 +532,7 @@ MyZMalloc( size_t nb_octets )
|
||||||
|
|
||||||
|
|
||||||
/*******************************/
|
/*******************************/
|
||||||
void
|
void MyFree( void* pt_mem )
|
||||||
MyFree( void* pt_mem )
|
|
||||||
/*******************************/
|
/*******************************/
|
||||||
{
|
{
|
||||||
if( pt_mem )
|
if( pt_mem )
|
||||||
|
@ -464,9 +546,7 @@ MyFree( void* pt_mem )
|
||||||
* (no spaces, replaced by _)
|
* (no spaces, replaced by _)
|
||||||
*/
|
*/
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
wxString
|
wxString ReturnPcbLayerName( int layer_number, bool omitSpacePadding )
|
||||||
ReturnPcbLayerName( int layer_number,
|
|
||||||
bool omitSpacePadding )
|
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
{
|
{
|
||||||
const unsigned LAYER_LIMIT = 29;
|
const unsigned LAYER_LIMIT = 29;
|
||||||
|
@ -527,11 +607,11 @@ WinEDA_TextFrame::WinEDA_TextFrame( wxWindow* parent,
|
||||||
MAYBE_RESIZE_BORDER )
|
MAYBE_RESIZE_BORDER )
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* TODO background and foreground colors of WinEDA_TextFrame should be
|
* TODO background and foreground colors of WinEDA_TextFrame should be
|
||||||
* controllable / settable with project settings or config file and not
|
* controllable / settable with project settings or config file and not
|
||||||
* hardcoded in binairy !
|
* hardcoded in binairy !
|
||||||
*/
|
*/
|
||||||
|
|
||||||
wxSize size;
|
wxSize size;
|
||||||
|
|
||||||
|
@ -547,10 +627,10 @@ WinEDA_TextFrame::WinEDA_TextFrame( wxWindow* parent,
|
||||||
0, NULL,
|
0, NULL,
|
||||||
wxLB_ALWAYS_SB | wxLB_SINGLE );
|
wxLB_ALWAYS_SB | wxLB_SINGLE );
|
||||||
|
|
||||||
/* The color of the text in the wxListBox (black) */
|
/* The color of the text in the wxListBox (black) */
|
||||||
m_List->SetBackgroundColour( wxColour( 255, 255, 255 ) );
|
m_List->SetBackgroundColour( wxColour( 255, 255, 255 ) );
|
||||||
|
|
||||||
/* The foreground color of the wxListBox (white) */
|
/* The foreground color of the wxListBox (white) */
|
||||||
m_List->SetForegroundColour( wxColour( 0, 0, 0 ) );
|
m_List->SetForegroundColour( wxColour( 0, 0, 0 ) );
|
||||||
|
|
||||||
SetReturnCode( -1 );
|
SetReturnCode( -1 );
|
||||||
|
@ -558,8 +638,7 @@ WinEDA_TextFrame::WinEDA_TextFrame( wxWindow* parent,
|
||||||
|
|
||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
void
|
void WinEDA_TextFrame::Append( const wxString& text )
|
||||||
WinEDA_TextFrame::Append( const wxString& text )
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
{
|
{
|
||||||
m_List->Append( text );
|
m_List->Append( text );
|
||||||
|
@ -567,8 +646,7 @@ WinEDA_TextFrame::Append( const wxString& text )
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************/
|
/**********************************************************/
|
||||||
void
|
void WinEDA_TextFrame::D_ClickOnList( wxCommandEvent& event )
|
||||||
WinEDA_TextFrame::D_ClickOnList( wxCommandEvent& event )
|
|
||||||
/**********************************************************/
|
/**********************************************************/
|
||||||
{
|
{
|
||||||
int ii = m_List->GetSelection();
|
int ii = m_List->GetSelection();
|
||||||
|
@ -578,8 +656,7 @@ WinEDA_TextFrame::D_ClickOnList( wxCommandEvent& event )
|
||||||
|
|
||||||
|
|
||||||
/*************************************************/
|
/*************************************************/
|
||||||
void
|
void WinEDA_TextFrame::OnClose( wxCloseEvent& event )
|
||||||
WinEDA_TextFrame::OnClose( wxCloseEvent& event )
|
|
||||||
/*************************************************/
|
/*************************************************/
|
||||||
{
|
{
|
||||||
EndModal( -1 );
|
EndModal( -1 );
|
||||||
|
@ -598,17 +675,12 @@ WinEDA_TextFrame::OnClose( wxCloseEvent& event )
|
||||||
* color = couleur d'affichage
|
* color = couleur d'affichage
|
||||||
*/
|
*/
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void Affiche_1_Parametre( WinEDA_DrawFrame* frame,
|
void Affiche_1_Parametre( WinEDA_DrawFrame* frame, int pos_X,
|
||||||
int pos_X,
|
const wxString& texte_H, const wxString& texte_L,
|
||||||
const wxString& texte_H,
|
|
||||||
const wxString& texte_L,
|
|
||||||
int color )
|
int color )
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
{
|
{
|
||||||
frame->MsgPanel->Affiche_1_Parametre( pos_X,
|
frame->MsgPanel->Affiche_1_Parametre( pos_X, texte_H, texte_L, color );
|
||||||
texte_H,
|
|
||||||
texte_L,
|
|
||||||
color );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -616,8 +688,8 @@ void Affiche_1_Parametre( WinEDA_DrawFrame* frame,
|
||||||
* Routine d'affichage de la documentation associee a un composant
|
* Routine d'affichage de la documentation associee a un composant
|
||||||
*/
|
*/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
void
|
void AfficheDoc( WinEDA_DrawFrame* frame, const wxString& Doc,
|
||||||
AfficheDoc( WinEDA_DrawFrame* frame, const wxString& Doc, const wxString& KeyW )
|
const wxString& KeyW )
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
{
|
{
|
||||||
wxString Line1( wxT( "Doc: " ) ), Line2( wxT( "KeyW: " ) );
|
wxString Line1( wxT( "Doc: " ) ), Line2( wxT( "KeyW: " ) );
|
||||||
|
@ -660,9 +732,7 @@ int GetTimeStamp()
|
||||||
* suivie de " ou mm
|
* suivie de " ou mm
|
||||||
*/
|
*/
|
||||||
/*********************************************/
|
/*********************************************/
|
||||||
const
|
const wxString& valeur_param( int valeur, wxString& buf_texte )
|
||||||
wxString& valeur_param( int valeur,
|
|
||||||
wxString& buf_texte )
|
|
||||||
/*********************************************/
|
/*********************************************/
|
||||||
{
|
{
|
||||||
if( g_UnitMetric )
|
if( g_UnitMetric )
|
||||||
|
@ -682,9 +752,7 @@ wxString& valeur_param( int valeur,
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/**********************************/
|
/**********************************/
|
||||||
wxString&
|
wxString& operator <<( wxString& aString, const wxPoint& aPos )
|
||||||
operator <<( wxString& aString,
|
|
||||||
const wxPoint& aPos )
|
|
||||||
/*********************************/
|
/*********************************/
|
||||||
{
|
{
|
||||||
wxString temp;
|
wxString temp;
|
||||||
|
@ -695,20 +763,3 @@ operator <<( wxString& aString,
|
||||||
|
|
||||||
return aString;
|
return aString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* compilers that does not have the round function (posix) */
|
|
||||||
#ifdef __MSVC__
|
|
||||||
/*
|
|
||||||
* return the nearest rounded ( equivalent to the nearest integer value)
|
|
||||||
* from aNumber
|
|
||||||
*/
|
|
||||||
/**********************/
|
|
||||||
double
|
|
||||||
round( double aNumber )
|
|
||||||
/**********************/
|
|
||||||
{
|
|
||||||
return floor( aNumber + 0.5 );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,7 @@ bool DrawPage( WinEDA_DrawPanel* panel )
|
||||||
int ClipboardSizeX, ClipboardSizeY;
|
int ClipboardSizeX, ClipboardSizeY;
|
||||||
bool DrawBlock = FALSE;
|
bool DrawBlock = FALSE;
|
||||||
wxRect DrawArea;
|
wxRect DrawArea;
|
||||||
|
BASE_SCREEN* screen = panel->GetScreen();
|
||||||
|
|
||||||
/* scale is the ratio resolution/internal units */
|
/* scale is the ratio resolution/internal units */
|
||||||
float scale = 82.0 / panel->m_Parent->m_InternalUnits;
|
float scale = 82.0 / panel->m_Parent->m_InternalUnits;
|
||||||
|
@ -103,7 +104,7 @@ bool DrawPage( WinEDA_DrawPanel* panel )
|
||||||
EDA_Rect tmp = panel->m_ClipBox;
|
EDA_Rect tmp = panel->m_ClipBox;
|
||||||
GRResetPenAndBrush( &dc );
|
GRResetPenAndBrush( &dc );
|
||||||
GRForceBlackPen( s_PlotBlackAndWhite );
|
GRForceBlackPen( s_PlotBlackAndWhite );
|
||||||
g_IsPrinting = TRUE;
|
screen->m_IsPrinting = true;
|
||||||
dc.SetUserScale( scale, scale );
|
dc.SetUserScale( scale, scale );
|
||||||
ClipboardSizeX = dc.MaxX() + 10;
|
ClipboardSizeX = dc.MaxX() + 10;
|
||||||
ClipboardSizeY = dc.MaxY() + 10;
|
ClipboardSizeY = dc.MaxY() + 10;
|
||||||
|
@ -115,7 +116,7 @@ bool DrawPage( WinEDA_DrawPanel* panel )
|
||||||
dc.SetClippingRegion( DrawArea );
|
dc.SetClippingRegion( DrawArea );
|
||||||
}
|
}
|
||||||
panel->PrintPage( &dc, Print_Sheet_Ref, -1, false );
|
panel->PrintPage( &dc, Print_Sheet_Ref, -1, false );
|
||||||
g_IsPrinting = FALSE;
|
screen->m_IsPrinting = false;
|
||||||
panel->m_ClipBox = tmp;
|
panel->m_ClipBox = tmp;
|
||||||
wxMetafile* mf = dc.Close();
|
wxMetafile* mf = dc.Close();
|
||||||
if( mf )
|
if( mf )
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
#define newline wxString( wxT( "\n" ) )
|
#define newline wxString( wxT( "\n" ) )
|
||||||
#define space wxString( wxT( " " ) )
|
#define space wxString( wxT( " " ) )
|
||||||
#define semicolon wxString( wxT( ";" ) )
|
#define semicolon wxString( wxT( ";" ) )
|
||||||
#define wx_round( a ) (int) ( (a) + .5 )
|
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
#pragma warn -rch
|
#pragma warn -rch
|
||||||
|
|
|
@ -21,6 +21,11 @@
|
||||||
#include <wx/fontdlg.h>
|
#include <wx/fontdlg.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* Configuration entry names. */
|
||||||
|
static const wxString CursorShapeEntry( wxT( "CuShape" ) );
|
||||||
|
static const wxString ShowGridEntry( wxT( "ShGrid" ) );
|
||||||
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE( WinEDA_DrawFrame, WinEDA_BasicFrame )
|
BEGIN_EVENT_TABLE( WinEDA_DrawFrame, WinEDA_BasicFrame )
|
||||||
EVT_MOUSEWHEEL( WinEDA_DrawFrame::OnMouseEvent )
|
EVT_MOUSEWHEEL( WinEDA_DrawFrame::OnMouseEvent )
|
||||||
EVT_MENU_OPEN( WinEDA_DrawFrame::OnMenuOpen )
|
EVT_MENU_OPEN( WinEDA_DrawFrame::OnMenuOpen )
|
||||||
|
@ -60,6 +65,7 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
|
||||||
m_Print_Sheet_Ref = TRUE; // TRUE pour avoir le cartouche imprim<69>
|
m_Print_Sheet_Ref = TRUE; // TRUE pour avoir le cartouche imprim<69>
|
||||||
m_Draw_Auxiliary_Axis = FALSE; // TRUE pour avoir les axes auxiliares dessines
|
m_Draw_Auxiliary_Axis = FALSE; // TRUE pour avoir les axes auxiliares dessines
|
||||||
m_UnitType = INTERNAL_UNIT_TYPE; // Internal unit = inch
|
m_UnitType = INTERNAL_UNIT_TYPE; // Internal unit = inch
|
||||||
|
m_CursorShape = 0;
|
||||||
|
|
||||||
// Internal units per inch: = 1000 for schema, = 10000 for PCB
|
// Internal units per inch: = 1000 for schema, = 10000 for PCB
|
||||||
m_InternalUnits = EESCHEMA_INTERNAL_UNIT;
|
m_InternalUnits = EESCHEMA_INTERNAL_UNIT;
|
||||||
|
@ -105,7 +111,7 @@ WinEDA_DrawFrame::~WinEDA_DrawFrame()
|
||||||
{
|
{
|
||||||
if( DrawPanel ) // Required: in WinEDA3D_DrawFrame, DrawPanel == NULL !
|
if( DrawPanel ) // Required: in WinEDA3D_DrawFrame, DrawPanel == NULL !
|
||||||
wxGetApp().m_EDA_Config->Write( wxT( "AutoPAN" ),
|
wxGetApp().m_EDA_Config->Write( wxT( "AutoPAN" ),
|
||||||
DrawPanel->m_AutoPAN_Enable );
|
DrawPanel->m_AutoPAN_Enable );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,7 +119,7 @@ WinEDA_DrawFrame::~WinEDA_DrawFrame()
|
||||||
void WinEDA_DrawFrame::AddFontSelectionMenu( wxMenu* main_menu )
|
void WinEDA_DrawFrame::AddFontSelectionMenu( wxMenu* main_menu )
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
|
|
||||||
/* create the submenu for fonte selection and setup font size
|
/* create the submenu for font selection and setup font size
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxMenu* fontmenu = new wxMenu();
|
wxMenu* fontmenu = new wxMenu();
|
||||||
|
@ -180,7 +186,7 @@ void WinEDA_DrawFrame::Affiche_Message( const wxString& message )
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dispaly the meesage on yhe bottomon the frame
|
* Display the message on the bottom the frame
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
SetStatusText( message );
|
SetStatusText( message );
|
||||||
|
@ -532,7 +538,7 @@ void WinEDA_DrawFrame::SetToolID( int id, int new_cursor_id,
|
||||||
|
|
||||||
|
|
||||||
/*****************************/
|
/*****************************/
|
||||||
/* default virtual fonctions */
|
/* default virtual functions */
|
||||||
/*****************************/
|
/*****************************/
|
||||||
|
|
||||||
void WinEDA_DrawFrame::OnGrid( int grid_type )
|
void WinEDA_DrawFrame::OnGrid( int grid_type )
|
||||||
|
@ -577,11 +583,11 @@ void WinEDA_DrawFrame::AdjustScrollBars()
|
||||||
if( screen == NULL || DrawPanel == NULL )
|
if( screen == NULL || DrawPanel == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// La zone d'affichage est reglee a une taille double de la feuille de travail:
|
// The drawing size is twice the current page size.
|
||||||
draw_size = screen->ReturnPageSize() * 2;
|
draw_size = screen->ReturnPageSize() * 2;
|
||||||
|
|
||||||
// On utilise le centre de l'ecran comme position de reference, donc
|
// Calculate the portion of the drawing that can be displayed in the
|
||||||
// la surface de trace doit etre augmentee
|
// client area at the current zoom level.
|
||||||
panel_size = DrawPanel->GetClientSize();
|
panel_size = DrawPanel->GetClientSize();
|
||||||
screen->Unscale( panel_size );
|
screen->Unscale( panel_size );
|
||||||
|
|
||||||
|
@ -603,8 +609,14 @@ void WinEDA_DrawFrame::AdjustScrollBars()
|
||||||
screen->m_DrawOrg.y = -panel_size.y / 2;
|
screen->m_DrawOrg.y = -panel_size.y / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calcul du nombre de scrolls (en unites de scrool )
|
// Calculate the number of scroll bar units for the given zoom level. */
|
||||||
scrollbar_number = draw_size / screen->Unscale( screen->m_ZoomScalar );
|
scrollbar_number.x =
|
||||||
|
wxRound( (double) draw_size.x /
|
||||||
|
(double) screen->Unscale( screen->m_ZoomScalar ) );
|
||||||
|
scrollbar_number.y =
|
||||||
|
wxRound( (double) draw_size.y /
|
||||||
|
(double) screen->Unscale( screen->m_ZoomScalar ) );
|
||||||
|
|
||||||
xUnit = yUnit = screen->m_ZoomScalar;
|
xUnit = yUnit = screen->m_ZoomScalar;
|
||||||
|
|
||||||
if( xUnit <= 1 )
|
if( xUnit <= 1 )
|
||||||
|
@ -620,16 +632,21 @@ void WinEDA_DrawFrame::AdjustScrollBars()
|
||||||
scrollbar_pos.x -= panel_size.x / 2;
|
scrollbar_pos.x -= panel_size.x / 2;
|
||||||
scrollbar_pos.y -= panel_size.y / 2;
|
scrollbar_pos.y -= panel_size.y / 2;
|
||||||
|
|
||||||
if( scrollbar_pos.x < 0 )
|
if( scrollbar_pos.x <= 0 )
|
||||||
scrollbar_pos.x = 0;
|
scrollbar_pos.x = 0;
|
||||||
if( scrollbar_pos.y < 0 )
|
if( scrollbar_pos.y <= 0 )
|
||||||
scrollbar_pos.y = 0;
|
scrollbar_pos.y = 0;
|
||||||
|
|
||||||
scrollbar_pos.x /= xUnit;
|
scrollbar_pos.x = wxRound( (double) scrollbar_pos.x / (double) xUnit );
|
||||||
scrollbar_pos.y /= yUnit;
|
scrollbar_pos.y = wxRound( (double) scrollbar_pos.y / (double) yUnit );
|
||||||
screen->m_ScrollbarPos = scrollbar_pos;
|
screen->m_ScrollbarPos = scrollbar_pos;
|
||||||
screen->m_ScrollbarNumber = scrollbar_number;
|
screen->m_ScrollbarNumber = scrollbar_number;
|
||||||
|
|
||||||
|
wxLogDebug( wxT( "SetScrollbars(%d, %d, %d, %d, %d, %d)" ),
|
||||||
|
screen->m_ZoomScalar, screen->m_ZoomScalar,
|
||||||
|
screen->m_ScrollbarNumber.x, screen->m_ScrollbarNumber.y,
|
||||||
|
screen->m_ScrollbarPos.x, screen->m_ScrollbarPos.y );
|
||||||
|
|
||||||
DrawPanel->SetScrollbars( screen->m_ZoomScalar,
|
DrawPanel->SetScrollbars( screen->m_ZoomScalar,
|
||||||
screen->m_ZoomScalar,
|
screen->m_ZoomScalar,
|
||||||
screen->m_ScrollbarNumber.x,
|
screen->m_ScrollbarNumber.x,
|
||||||
|
@ -648,7 +665,7 @@ void WinEDA_DrawFrame::SetDrawBgColor( int color_num )
|
||||||
* le parametre XorMode est mis a jour selon la couleur du fond
|
* le parametre XorMode est mis a jour selon la couleur du fond
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
if( (color_num != WHITE) && (color_num != BLACK) )
|
if( ( color_num != WHITE ) && ( color_num != BLACK ) )
|
||||||
color_num = BLACK;
|
color_num = BLACK;
|
||||||
g_DrawBgColor = color_num;
|
g_DrawBgColor = color_num;
|
||||||
if( color_num == WHITE )
|
if( color_num == WHITE )
|
||||||
|
@ -688,11 +705,11 @@ void WinEDA_DrawFrame::SetLanguage( wxCommandEvent& event )
|
||||||
/*
|
/*
|
||||||
* Update the status bar information.
|
* Update the status bar information.
|
||||||
*
|
*
|
||||||
* The base method updates the absolute and relative cooridinates and the
|
* The base method updates the absolute and relative coordinates and the
|
||||||
* zoom information. If you override this virtual method, make sure to call
|
* zoom information. If you override this virtual method, make sure to call
|
||||||
* this subclassed method.
|
* this subclassed method.
|
||||||
*/
|
*/
|
||||||
void WinEDA_DrawFrame::Affiche_Status_Box()
|
void WinEDA_DrawFrame::UpdateStatusBar()
|
||||||
{
|
{
|
||||||
wxString Line;
|
wxString Line;
|
||||||
int dx, dy;
|
int dx, dy;
|
||||||
|
@ -703,7 +720,7 @@ void WinEDA_DrawFrame::Affiche_Status_Box()
|
||||||
|
|
||||||
/* Display Zoom level: zoom = zoom_coeff/ZoomScalar */
|
/* Display Zoom level: zoom = zoom_coeff/ZoomScalar */
|
||||||
if ( (screen->GetZoom() % screen->m_ZoomScalar) == 0 )
|
if ( (screen->GetZoom() % screen->m_ZoomScalar) == 0 )
|
||||||
Line.Printf( wxT( "Z %d" ),screen->GetZoom() / screen->m_ZoomScalar );
|
Line.Printf( wxT( "Z %d" ), screen->GetZoom() / screen->m_ZoomScalar );
|
||||||
else
|
else
|
||||||
Line.Printf( wxT( "Z %.1f" ), (float)screen->GetZoom() / screen->m_ZoomScalar );
|
Line.Printf( wxT( "Z %.1f" ), (float)screen->GetZoom() / screen->m_ZoomScalar );
|
||||||
SetStatusText( Line, 1 );
|
SetStatusText( Line, 1 );
|
||||||
|
@ -726,3 +743,38 @@ void WinEDA_DrawFrame::Affiche_Status_Box()
|
||||||
|
|
||||||
SetStatusText( Line, 3 );
|
SetStatusText( Line, 3 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load draw frame specific configuration settings.
|
||||||
|
*
|
||||||
|
* Don't forget to call this base method from any derived classes or the
|
||||||
|
* settings will not get loaded.
|
||||||
|
*/
|
||||||
|
void WinEDA_DrawFrame::LoadSettings()
|
||||||
|
{
|
||||||
|
wxASSERT( wxGetApp().m_EDA_Config != NULL );
|
||||||
|
|
||||||
|
wxConfig* cfg = wxGetApp().m_EDA_Config;
|
||||||
|
|
||||||
|
WinEDA_BasicFrame::LoadSettings();
|
||||||
|
cfg->Read( m_FrameName + CursorShapeEntry, &m_CursorShape, ( long )0 );
|
||||||
|
cfg->Read( m_FrameName + ShowGridEntry, &m_Draw_Grid, true );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save draw frame specific configuration settings.
|
||||||
|
*
|
||||||
|
* Don't forget to call this base method from any derived classes or the
|
||||||
|
* settings will not get saved.
|
||||||
|
*/
|
||||||
|
void WinEDA_DrawFrame::SaveSettings()
|
||||||
|
{
|
||||||
|
wxASSERT( wxGetApp().m_EDA_Config != NULL );
|
||||||
|
|
||||||
|
wxConfig* cfg = wxGetApp().m_EDA_Config;
|
||||||
|
|
||||||
|
WinEDA_BasicFrame::SaveSettings();
|
||||||
|
cfg->Write( m_FrameName + CursorShapeEntry, m_CursorShape );
|
||||||
|
cfg->Write( m_FrameName + ShowGridEntry, m_Draw_Grid );
|
||||||
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
// Local defines
|
// Local defines
|
||||||
#define CURSOR_SIZE 12 // Cursor size in pixels
|
#define CURSOR_SIZE 12 // Cursor size in pixels
|
||||||
|
|
||||||
// Locad variables
|
// Local variables
|
||||||
|
|
||||||
/* Used to inhibit a response to a mouse left button release, after a double click
|
/* Used to inhibit a response to a mouse left button release, after a double click
|
||||||
* (when releasing the left button at the end of the second click
|
* (when releasing the left button at the end of the second click
|
||||||
|
@ -73,8 +73,7 @@ WinEDA_DrawPanel::WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id,
|
||||||
ForceCloseManageCurseur = NULL;
|
ForceCloseManageCurseur = NULL;
|
||||||
|
|
||||||
if( wxGetApp().m_EDA_Config )
|
if( wxGetApp().m_EDA_Config )
|
||||||
m_AutoPAN_Enable = wxGetApp().m_EDA_Config->Read( wxT( "AutoPAN" ),
|
m_AutoPAN_Enable = wxGetApp().m_EDA_Config->Read( wxT( "AutoPAN" ), true );
|
||||||
TRUE );
|
|
||||||
|
|
||||||
m_AutoPAN_Request = FALSE;
|
m_AutoPAN_Request = FALSE;
|
||||||
m_Block_Enable = FALSE;
|
m_Block_Enable = FALSE;
|
||||||
|
@ -107,7 +106,7 @@ void WinEDA_DrawPanel::Trace_Curseur( wxDC* DC, int color )
|
||||||
wxPoint Cursor = GetScreen()->m_Curseur;
|
wxPoint Cursor = GetScreen()->m_Curseur;
|
||||||
|
|
||||||
GRSetDrawMode( DC, GR_XOR );
|
GRSetDrawMode( DC, GR_XOR );
|
||||||
if( g_CursorShape == 1 ) /* Trace d'un reticule */
|
if( m_Parent->m_CursorShape == 1 ) /* Trace d'un reticule */
|
||||||
{
|
{
|
||||||
int dx = GetScreen()->Unscale( m_ClipBox.GetWidth() );
|
int dx = GetScreen()->Unscale( m_ClipBox.GetWidth() );
|
||||||
int dy = GetScreen()->Unscale( m_ClipBox.GetHeight() );
|
int dy = GetScreen()->Unscale( m_ClipBox.GetHeight() );
|
||||||
|
@ -214,7 +213,7 @@ wxPoint WinEDA_DrawPanel::CursorRealPosition( const wxPoint& ScreenPos )
|
||||||
bool WinEDA_DrawPanel::IsPointOnDisplay( wxPoint ref_pos )
|
bool WinEDA_DrawPanel::IsPointOnDisplay( wxPoint ref_pos )
|
||||||
/********************************************************/
|
/********************************************************/
|
||||||
|
|
||||||
/** Funcion IsPointOnDisplay
|
/** Function IsPointOnDisplay
|
||||||
* @param ref_pos is the position to test in pixels, relative to the panel.
|
* @param ref_pos is the position to test in pixels, relative to the panel.
|
||||||
* @return TRUE if ref_pos is a point currently visible on screen
|
* @return TRUE if ref_pos is a point currently visible on screen
|
||||||
* FALSE if ref_pos is out of screen
|
* FALSE if ref_pos is out of screen
|
||||||
|
@ -312,11 +311,10 @@ wxPoint WinEDA_DrawPanel::CursorScreenPosition()
|
||||||
/********************************************************/
|
/********************************************************/
|
||||||
|
|
||||||
/** Function CursorScreenPosition
|
/** Function CursorScreenPosition
|
||||||
* @return the curseur current position in pixels in the screen draw area
|
* @return the cursor current position in pixels in the screen draw area
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxPoint pos = GetScreen()->m_Curseur;
|
wxPoint pos = GetScreen()->m_Curseur - GetScreen()->m_DrawOrg;
|
||||||
pos -= GetScreen()->m_DrawOrg;
|
|
||||||
GetScreen()->Scale( pos );
|
GetScreen()->Scale( pos );
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
@ -416,7 +414,7 @@ void WinEDA_DrawPanel::OnActivate( wxActivateEvent& event )
|
||||||
/**
|
/**
|
||||||
* Called on window activation.
|
* Called on window activation.
|
||||||
* init the member m_CanStartBlock to avoid a block start command
|
* init the member m_CanStartBlock to avoid a block start command
|
||||||
* on activation (because a left mouse buton can be pressed and no block command wanted
|
* on activation (because a left mouse button can be pressed and no block command wanted
|
||||||
* This happens when enter on a hierarchycat sheet on double click
|
* This happens when enter on a hierarchycat sheet on double click
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
@ -544,7 +542,7 @@ void WinEDA_DrawPanel::EraseScreen( wxDC* DC )
|
||||||
// see setup.h in wx Widgets.
|
// see setup.h in wx Widgets.
|
||||||
// wxWidgets configure can need option --enable-graphics_ctx
|
// wxWidgets configure can need option --enable-graphics_ctx
|
||||||
// Currently, **only for tests**
|
// Currently, **only for tests**
|
||||||
//#define USE_GCDC_IN_KICAD // uncommment it to use wxGCDC
|
//#define USE_GCDC_IN_KICAD // uncomment it to use wxGCDC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/***************************************************/
|
/***************************************************/
|
||||||
|
@ -553,8 +551,8 @@ void WinEDA_DrawPanel::OnPaint( wxPaintEvent& event )
|
||||||
{
|
{
|
||||||
#ifdef USE_GCDC_IN_KICAD
|
#ifdef USE_GCDC_IN_KICAD
|
||||||
wxPaintDC pDC( this );
|
wxPaintDC pDC( this );
|
||||||
wxGCDC paintDC(pDC); // Following line should be disabled on MSW and OS X
|
wxGCDC paintDC(pDC); // Following line should be disabled on MSW and OS X
|
||||||
paintDC.GetGraphicsContext()->Translate(0.5, 0.5); // Fix for pixel offset bug http://trac.wxwidgets.org/ticket/4187
|
paintDC.GetGraphicsContext()->Translate(0.5, 0.5); // Fix for pixel offset bug http://trac.wxwidgets.org/ticket/4187
|
||||||
#else
|
#else
|
||||||
wxPaintDC paintDC( this );
|
wxPaintDC paintDC( this );
|
||||||
#endif
|
#endif
|
||||||
|
@ -703,14 +701,14 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
|
||||||
|
|
||||||
wxRealPoint dgrid = screen_grid_size;
|
wxRealPoint dgrid = screen_grid_size;
|
||||||
screen->Scale( dgrid ); // dgrid = grid size in pixels
|
screen->Scale( dgrid ); // dgrid = grid size in pixels
|
||||||
// if the grid size is sall ( < 5 pixels) do not display all points
|
// if the grid size is small ( < 5 pixels) do not display all points
|
||||||
if( dgrid.x < 5 )
|
if( dgrid.x < 5 )
|
||||||
{
|
{
|
||||||
screen_grid_size.x *= 2;
|
screen_grid_size.x *= 2;
|
||||||
dgrid.x *= 2;
|
dgrid.x *= 2;
|
||||||
}
|
}
|
||||||
if( dgrid.x < 5 )
|
if( dgrid.x < 5 )
|
||||||
drawgrid = FALSE; // The gris is too small: do not show it
|
drawgrid = FALSE; // The grid is too small: do not show it
|
||||||
|
|
||||||
if( dgrid.y < 5 )
|
if( dgrid.y < 5 )
|
||||||
{
|
{
|
||||||
|
@ -718,7 +716,7 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
|
||||||
dgrid.y *= 2;
|
dgrid.y *= 2;
|
||||||
}
|
}
|
||||||
if( dgrid.y < 5 )
|
if( dgrid.y < 5 )
|
||||||
drawgrid = FALSE; // The gris is too small
|
drawgrid = FALSE; // The grid is too small
|
||||||
|
|
||||||
GetViewStart( &org.x, &org.y );
|
GetViewStart( &org.x, &org.y );
|
||||||
GetScrollPixelsPerUnit( &ii, &jj );
|
GetScrollPixelsPerUnit( &ii, &jj );
|
||||||
|
@ -739,12 +737,12 @@ void WinEDA_DrawPanel::DrawBackGround( wxDC* DC )
|
||||||
GRSetColorPen( DC, color );
|
GRSetColorPen( DC, color );
|
||||||
for( ii = 0; ; ii++ )
|
for( ii = 0; ; ii++ )
|
||||||
{
|
{
|
||||||
xg = (int) round(ii * screen_grid_size.x);
|
xg = wxRound(ii * screen_grid_size.x);
|
||||||
int xpos = org.x + xg;
|
int xpos = org.x + xg;
|
||||||
|
|
||||||
for( jj = 0; ; jj++ )
|
for( jj = 0; ; jj++ )
|
||||||
{
|
{
|
||||||
yg = (int) round(jj * screen_grid_size.y);
|
yg = wxRound(jj * screen_grid_size.y);
|
||||||
GRPutPixel( &m_ClipBox, DC, xpos, org.y + yg, color );
|
GRPutPixel( &m_ClipBox, DC, xpos, org.y + yg, color );
|
||||||
if( yg > size.y )
|
if( yg > size.y )
|
||||||
break;
|
break;
|
||||||
|
@ -850,7 +848,7 @@ void WinEDA_DrawPanel::OnMouseLeaving( wxMouseEvent& event )
|
||||||
if( !m_AutoPAN_Enable || !m_AutoPAN_Request || m_IgnoreMouseEvents )
|
if( !m_AutoPAN_Enable || !m_AutoPAN_Request || m_IgnoreMouseEvents )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Auto pan if mouse is leave working aera:
|
// Auto pan if mouse is leave working area:
|
||||||
wxSize size = GetClientSize();
|
wxSize size = GetClientSize();
|
||||||
|
|
||||||
if( ( size.x < event.GetX() ) || ( size.y < event.GetY() )
|
if( ( size.x < event.GetX() ) || ( size.y < event.GetY() )
|
||||||
|
@ -867,17 +865,12 @@ void WinEDA_DrawPanel::OnMouseLeaving( wxMouseEvent& event )
|
||||||
* Handle mouse wheel events.
|
* Handle mouse wheel events.
|
||||||
*
|
*
|
||||||
* The mouse wheel is used to provide support for zooming and panning. This
|
* The mouse wheel is used to provide support for zooming and panning. This
|
||||||
* is accomplished by converting mouse wheel events in psuedo menu command
|
* is accomplished by converting mouse wheel events in pseudo menu command
|
||||||
* events.
|
* events.
|
||||||
*/
|
*/
|
||||||
void WinEDA_DrawPanel::OnMouseWheel( wxMouseEvent& event )
|
void WinEDA_DrawPanel::OnMouseWheel( wxMouseEvent& event )
|
||||||
{
|
{
|
||||||
wxRect rect = GetRect();
|
wxRect rect = wxRect( wxPoint( 0, 0), GetClientSize() );
|
||||||
|
|
||||||
/* This fixes a bad rectangle horizontal position returned by the
|
|
||||||
* schematic library veiwer panel. It may have something to do with
|
|
||||||
* the sash window. */
|
|
||||||
rect.Offset( -rect.x, -rect.y );
|
|
||||||
|
|
||||||
/* Ignore scroll events if the cursor is outside the drawing area. */
|
/* Ignore scroll events if the cursor is outside the drawing area. */
|
||||||
if( event.GetWheelRotation() == 0 || !GetParent()->IsEnabled()
|
if( event.GetWheelRotation() == 0 || !GetParent()->IsEnabled()
|
||||||
|
@ -892,6 +885,9 @@ void WinEDA_DrawPanel::OnMouseWheel( wxMouseEvent& event )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GetScreen()->m_Curseur =
|
||||||
|
CursorRealPosition( CalcUnscrolledPosition( event.GetPosition() ) );
|
||||||
|
|
||||||
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
||||||
cmd.SetEventObject( this );
|
cmd.SetEventObject( this );
|
||||||
|
|
||||||
|
@ -930,12 +926,12 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
||||||
|
|
||||||
if( !screen )
|
if( !screen )
|
||||||
return;
|
return;
|
||||||
#define MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND 5 /* Adjust value to filter mouse deplacement before
|
#define MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND 5 /* Adjust value to filter mouse displacement before
|
||||||
* consider the drag mouse is really a drag command, not just a movement while click
|
* consider the drag mouse is really a drag command, not just a movement while click
|
||||||
*/
|
*/
|
||||||
static int MinDragEventCount; /* counts the drag events.
|
static int MinDragEventCount; /* counts the drag events.
|
||||||
* used to filter mouse moves before starting a block command
|
* used to filter mouse moves before starting a block command
|
||||||
* a block comman can be started only if MinDragEventCount > MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND
|
* a block command can be started only if MinDragEventCount > MIN_DRAG_COUNT_FOR_START_BLOCK_COMMAND
|
||||||
* in order to avoid spurious block commands
|
* in order to avoid spurious block commands
|
||||||
*/
|
*/
|
||||||
if( event.Leaving() || event.Entering() )
|
if( event.Leaving() || event.Entering() )
|
||||||
|
@ -986,7 +982,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
||||||
}
|
}
|
||||||
; // Unused
|
; // Unused
|
||||||
|
|
||||||
localrealbutt |= localbutt; /* compensation defaut wxGTK */
|
localrealbutt |= localbutt; /* compensation default wxGTK */
|
||||||
|
|
||||||
/* Compute absolute m_MousePosition in pixel units: */
|
/* Compute absolute m_MousePosition in pixel units: */
|
||||||
screen->m_MousePositionInPixels = CalcUnscrolledPosition( event.GetPosition() );
|
screen->m_MousePositionInPixels = CalcUnscrolledPosition( event.GetPosition() );
|
||||||
|
@ -1040,7 +1036,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
||||||
|
|
||||||
if( event.ButtonUp( 2 ) && (screen->BlockLocate.m_State == STATE_NO_BLOCK) )
|
if( event.ButtonUp( 2 ) && (screen->BlockLocate.m_State == STATE_NO_BLOCK) )
|
||||||
{
|
{
|
||||||
// The middle button has been relached, with no block command:
|
// The middle button has been released, with no block command:
|
||||||
// We use it for a zoom center at cursor position command
|
// We use it for a zoom center at cursor position command
|
||||||
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED,
|
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED,
|
||||||
ID_POPUP_ZOOM_CENTER );
|
ID_POPUP_ZOOM_CENTER );
|
||||||
|
@ -1049,7 +1045,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Calling the general function on mouse changes (and pseudo key commands) */
|
/* Calling the general function on mouse changes (and pseudo key commands) */
|
||||||
m_Parent->GeneralControle( &DC, screen->m_MousePositionInPixels );
|
m_Parent->GeneralControle( &DC, screen->m_MousePositionInPixels );
|
||||||
|
|
||||||
|
|
||||||
|
@ -1065,9 +1061,9 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A new command block can start after a release buttons
|
/* A new command block can start after a release buttons
|
||||||
* and if the drag is enougth
|
* and if the drag is enough
|
||||||
* This is to avoid a false start block when a dialog box is demiss,
|
* This is to avoid a false start block when a dialog box is demiss,
|
||||||
* or when changing panels in hierachy navigation
|
* or when changing panels in hierarchy navigation
|
||||||
* or when clicking while and moving mouse
|
* or when clicking while and moving mouse
|
||||||
*/
|
*/
|
||||||
if( !event.LeftIsDown() && !event.MiddleIsDown() )
|
if( !event.LeftIsDown() && !event.MiddleIsDown() )
|
||||||
|
@ -1076,8 +1072,8 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
||||||
m_CanStartBlock = 0;
|
m_CanStartBlock = 0;
|
||||||
|
|
||||||
/* remember the last cursor position when a drag mouse starts
|
/* remember the last cursor position when a drag mouse starts
|
||||||
* this is the last postion ** before ** clicking a button
|
* this is the last position ** before ** clicking a button
|
||||||
* this is usefull to start a block command from the point where the mouse was clicked first
|
* this is useful to start a block command from the point where the mouse was clicked first
|
||||||
* (a filter creates a delay for the real block command start, and we must remember this point)
|
* (a filter creates a delay for the real block command start, and we must remember this point)
|
||||||
*/
|
*/
|
||||||
m_CursorStartPos = screen->m_Curseur;
|
m_CursorStartPos = screen->m_Curseur;
|
||||||
|
@ -1111,7 +1107,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
||||||
if( event.MiddleIsDown() )
|
if( event.MiddleIsDown() )
|
||||||
cmd_type |= MOUSE_MIDDLE;
|
cmd_type |= MOUSE_MIDDLE;
|
||||||
|
|
||||||
/* A block command is started if the drag is enought.
|
/* A block command is started if the drag is enough.
|
||||||
* A small drag is ignored (it is certainly a little mouse move when clicking)
|
* A small drag is ignored (it is certainly a little mouse move when clicking)
|
||||||
* not really a drag mouse
|
* not really a drag mouse
|
||||||
*/
|
*/
|
||||||
|
@ -1138,7 +1134,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
|
||||||
{
|
{
|
||||||
/* Release the mouse button: end of block.
|
/* Release the mouse button: end of block.
|
||||||
* The command can finish (DELETE) or have a next command (MOVE, COPY).
|
* The command can finish (DELETE) or have a next command (MOVE, COPY).
|
||||||
* However the block command is cancelled if the block size is small
|
* However the block command is canceled if the block size is small
|
||||||
* Because a block command filtering is already made, this case happens,
|
* Because a block command filtering is already made, this case happens,
|
||||||
* but only when the on grid cursor has not moved.
|
* but only when the on grid cursor has not moved.
|
||||||
*/
|
*/
|
||||||
|
@ -1255,7 +1251,7 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event )
|
||||||
pos = CalcUnscrolledPosition( wxGetMousePosition() - GetScreenPosition() );
|
pos = CalcUnscrolledPosition( wxGetMousePosition() - GetScreenPosition() );
|
||||||
|
|
||||||
/* Compute absolute mouse position in pixel units (i.e. considering the
|
/* Compute absolute mouse position in pixel units (i.e. considering the
|
||||||
current scrool) : */
|
current scroll) : */
|
||||||
Screen->m_MousePositionInPixels = pos;
|
Screen->m_MousePositionInPixels = pos;
|
||||||
|
|
||||||
/* Compute absolute mouse position in user units: */
|
/* Compute absolute mouse position in user units: */
|
||||||
|
|
|
@ -20,13 +20,15 @@ void WinEDA_App::ReadPdfBrowserInfos()
|
||||||
/* Read from Common config the Pdf browser choice
|
/* Read from Common config the Pdf browser choice
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
if( m_EDA_CommonConfig )
|
wxASSERT( m_EDA_CommonConfig != NULL );
|
||||||
{
|
|
||||||
m_PdfBrowserIsDefault = m_EDA_CommonConfig->Read( wxT( "PdfBrowserIsDefault" ), TRUE );
|
m_PdfBrowserIsDefault = m_EDA_CommonConfig->Read( wxT( "PdfBrowserIsDefault" ),
|
||||||
m_PdfBrowser = m_EDA_CommonConfig->Read( wxT( "PdfBrowserName" ), wxEmptyString );
|
true );
|
||||||
}
|
m_PdfBrowser = m_EDA_CommonConfig->Read( wxT( "PdfBrowserName" ),
|
||||||
|
wxEmptyString );
|
||||||
|
|
||||||
if( m_PdfBrowser.IsEmpty() )
|
if( m_PdfBrowser.IsEmpty() )
|
||||||
m_PdfBrowserIsDefault = TRUE;
|
m_PdfBrowserIsDefault = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,11 +39,13 @@ void WinEDA_App::WritePdfBrowserInfos()
|
||||||
/* Write into Common config the Pdf browser choice
|
/* Write into Common config the Pdf browser choice
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
if( !m_EDA_CommonConfig )
|
wxASSERT( m_EDA_CommonConfig != NULL );
|
||||||
return;
|
|
||||||
if( m_PdfBrowser.IsEmpty() )
|
if( m_PdfBrowser.IsEmpty() )
|
||||||
m_PdfBrowserIsDefault = TRUE;
|
m_PdfBrowserIsDefault = true;
|
||||||
m_EDA_CommonConfig->Write( wxT( "PdfBrowserIsDefault" ), m_PdfBrowserIsDefault );
|
|
||||||
|
m_EDA_CommonConfig->Write( wxT( "PdfBrowserIsDefault" ),
|
||||||
|
m_PdfBrowserIsDefault );
|
||||||
m_EDA_CommonConfig->Write( wxT( "PdfBrowserName" ), m_PdfBrowser );
|
m_EDA_CommonConfig->Write( wxT( "PdfBrowserName" ), m_PdfBrowser );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,12 +4,11 @@
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* @file edaapl.cpp
|
* @file edaapl.cpp
|
||||||
* @brief For the main application: init functions, and language selection (locale handling)
|
*
|
||||||
|
* @brief For the main application: init functions, and language selection
|
||||||
|
* (locale handling)
|
||||||
***/
|
***/
|
||||||
|
|
||||||
#define EDA_BASE
|
|
||||||
#define COMMON_GLOBL
|
|
||||||
|
|
||||||
#ifdef KICAD_PYTHON
|
#ifdef KICAD_PYTHON
|
||||||
# include <pyhandler.h>
|
# include <pyhandler.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -37,6 +36,9 @@
|
||||||
#include "gestfich.h"
|
#include "gestfich.h"
|
||||||
|
|
||||||
|
|
||||||
|
static const wxChar* CommonConfigPath = wxT( "kicad_common" );
|
||||||
|
|
||||||
|
|
||||||
#ifdef __UNIX__
|
#ifdef __UNIX__
|
||||||
# define TMP_FILE "/tmp/kicad.tmp"
|
# define TMP_FILE "/tmp/kicad.tmp"
|
||||||
#endif
|
#endif
|
||||||
|
@ -44,7 +46,7 @@
|
||||||
/* Just add new languages to the list. This macro will properly recalculate
|
/* Just add new languages to the list. This macro will properly recalculate
|
||||||
* the size of the array. */
|
* the size of the array. */
|
||||||
#define LANGUAGE_DESCR_COUNT ( sizeof( s_Language_List ) / \
|
#define LANGUAGE_DESCR_COUNT ( sizeof( s_Language_List ) / \
|
||||||
sizeof( struct LANGUAGE_DESCR ) )
|
sizeof( struct LANGUAGE_DESCR ) )
|
||||||
|
|
||||||
/* Default font size */
|
/* Default font size */
|
||||||
#define FONT_DEFAULT_SIZE 10 /* Default font size. */
|
#define FONT_DEFAULT_SIZE 10 /* Default font size. */
|
||||||
|
@ -52,11 +54,11 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The real font size will be computed at run time
|
* The real font size will be computed at run time
|
||||||
* A small class to handle the list od existing translations.
|
* A small class to handle the list on existing translations.
|
||||||
* the locale translation is automatic.
|
* the locale translation is automatic.
|
||||||
* the selection of languages is mainly for mainteners's convenience (tests...)\n
|
* the selection of languages is mainly for maintainer's convenience
|
||||||
* To add a support to a new tranlation:
|
* To add a support to a new translation:
|
||||||
* create a new icon (flag of the country) (see Lang_Fr.xpm as an exemple)
|
* create a new icon (flag of the country) (see Lang_Fr.xpm as an example)
|
||||||
* add a new item to s_Language_List[LANGUAGE_DESCR_COUNT]
|
* add a new item to s_Language_List[LANGUAGE_DESCR_COUNT]
|
||||||
* and set LANGUAGE_DESCR_COUNT to the new value
|
* and set LANGUAGE_DESCR_COUNT to the new value
|
||||||
*/
|
*/
|
||||||
|
@ -117,7 +119,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
||||||
_( "Spanish" )
|
_( "Spanish" )
|
||||||
},
|
},
|
||||||
|
|
||||||
/* Portugese language */
|
/* Portuguese language */
|
||||||
{
|
{
|
||||||
wxLANGUAGE_PORTUGUESE,
|
wxLANGUAGE_PORTUGUESE,
|
||||||
ID_LANGUAGE_PORTUGUESE,
|
ID_LANGUAGE_PORTUGUESE,
|
||||||
|
@ -222,12 +224,13 @@ WinEDA_App::WinEDA_App()
|
||||||
{
|
{
|
||||||
m_Checker = NULL;
|
m_Checker = NULL;
|
||||||
m_HtmlCtrl = NULL;
|
m_HtmlCtrl = NULL;
|
||||||
m_EDA_CommonConfig = NULL;
|
|
||||||
m_EDA_Config = NULL;
|
m_EDA_Config = NULL;
|
||||||
m_Env_Defined = FALSE;
|
m_Env_Defined = FALSE;
|
||||||
m_LanguageId = wxLANGUAGE_DEFAULT;
|
m_LanguageId = wxLANGUAGE_DEFAULT;
|
||||||
m_PdfBrowserIsDefault = TRUE;
|
m_PdfBrowserIsDefault = TRUE;
|
||||||
m_Locale = NULL;
|
m_Locale = NULL;
|
||||||
|
m_ProjectConfig = NULL;
|
||||||
|
m_EDA_CommonConfig = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -239,9 +242,11 @@ WinEDA_App::~WinEDA_App()
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
|
|
||||||
/* delete user datas */
|
/* delete user datas */
|
||||||
delete g_Prj_Config;
|
if( m_ProjectConfig )
|
||||||
|
delete m_ProjectConfig;
|
||||||
|
if( m_EDA_CommonConfig )
|
||||||
|
delete m_EDA_CommonConfig;
|
||||||
delete m_EDA_Config;
|
delete m_EDA_Config;
|
||||||
delete m_EDA_CommonConfig;
|
|
||||||
delete g_StdFont;
|
delete g_StdFont;
|
||||||
delete g_DialogFont;
|
delete g_DialogFont;
|
||||||
delete g_ItalicFont;
|
delete g_ItalicFont;
|
||||||
|
@ -258,11 +263,10 @@ WinEDA_App::~WinEDA_App()
|
||||||
*/
|
*/
|
||||||
void WinEDA_App::InitEDA_Appl( const wxString& name )
|
void WinEDA_App::InitEDA_Appl( const wxString& name )
|
||||||
{
|
{
|
||||||
wxString ident;
|
|
||||||
wxString EnvLang;
|
wxString EnvLang;
|
||||||
|
|
||||||
ident = name + wxT( "-" ) + wxGetUserId();
|
m_Checker = new wxSingleInstanceChecker( name.Lower() + wxT( "-" ) +
|
||||||
m_Checker = new wxSingleInstanceChecker( ident );
|
wxGetUserId() );
|
||||||
|
|
||||||
/* Init kicad environment
|
/* Init kicad environment
|
||||||
* the environment variable KICAD (if exists) gives the kicad path:
|
* the environment variable KICAD (if exists) gives the kicad path:
|
||||||
|
@ -289,8 +293,11 @@ void WinEDA_App::InitEDA_Appl( const wxString& name )
|
||||||
/* Init parameters for configuration */
|
/* Init parameters for configuration */
|
||||||
SetVendorName( wxT( "kicad" ) );
|
SetVendorName( wxT( "kicad" ) );
|
||||||
SetAppName( name.Lower() );
|
SetAppName( name.Lower() );
|
||||||
m_EDA_Config = new wxConfig( name );
|
SetTitle( name );
|
||||||
m_EDA_CommonConfig = new wxConfig( wxT( "kicad_common" ) );
|
m_EDA_Config = new wxConfig( );
|
||||||
|
wxASSERT( m_EDA_Config != NULL );
|
||||||
|
m_EDA_CommonConfig = new wxConfig( CommonConfigPath );
|
||||||
|
wxASSERT( m_EDA_CommonConfig != NULL );
|
||||||
|
|
||||||
/* Create the fonts used in dialogs and messages */
|
/* Create the fonts used in dialogs and messages */
|
||||||
g_StdFontPointSize = FONT_DEFAULT_SIZE;
|
g_StdFontPointSize = FONT_DEFAULT_SIZE;
|
||||||
|
@ -319,13 +326,13 @@ void WinEDA_App::InitEDA_Appl( const wxString& name )
|
||||||
wxImage::AddHandler( new wxJPEGHandler );
|
wxImage::AddHandler( new wxJPEGHandler );
|
||||||
wxFileSystem::AddHandler( new wxZipFSHandler );
|
wxFileSystem::AddHandler( new wxZipFSHandler );
|
||||||
|
|
||||||
// Analyse the command line & init binary path
|
// Analise the command line & init binary path
|
||||||
SetBinDir();
|
SetBinDir();
|
||||||
SetDefaultSearchPaths();
|
SetDefaultSearchPaths();
|
||||||
SetLanguagePath();
|
SetLanguagePath();
|
||||||
ReadPdfBrowserInfos();
|
ReadPdfBrowserInfos();
|
||||||
|
|
||||||
// Internationalisation: loading the kicad suitable Dictionnary
|
// Internationalization: loading the kicad suitable Dictionary
|
||||||
m_EDA_CommonConfig->Read( wxT( "Language" ), &m_LanguageId,
|
m_EDA_CommonConfig->Read( wxT( "Language" ), &m_LanguageId,
|
||||||
wxLANGUAGE_DEFAULT );
|
wxLANGUAGE_DEFAULT );
|
||||||
|
|
||||||
|
@ -345,11 +352,10 @@ void WinEDA_App::InitEDA_Appl( const wxString& name )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init online help
|
* Init online help
|
||||||
|
*
|
||||||
* @return none
|
* @return none
|
||||||
*/
|
*/
|
||||||
/*****************************************/
|
|
||||||
void WinEDA_App::InitOnLineHelp()
|
void WinEDA_App::InitOnLineHelp()
|
||||||
/*****************************************/
|
|
||||||
{
|
{
|
||||||
wxString fullfilename = FindKicadHelpPath();
|
wxString fullfilename = FindKicadHelpPath();
|
||||||
|
|
||||||
|
@ -378,11 +384,10 @@ void WinEDA_App::InitOnLineHelp()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the path to the executable and store it in WinEDA_App::m_BinDir
|
* Find the path to the executable and store it in WinEDA_App::m_BinDir
|
||||||
|
*
|
||||||
* @return TODO
|
* @return TODO
|
||||||
*/
|
*/
|
||||||
/*******************************/
|
|
||||||
bool WinEDA_App::SetBinDir()
|
bool WinEDA_App::SetBinDir()
|
||||||
/*******************************/
|
|
||||||
{
|
{
|
||||||
/* Apple MacOSx */
|
/* Apple MacOSx */
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
@ -459,7 +464,7 @@ bool WinEDA_App::SetBinDir()
|
||||||
wxLogDebug( wxT( "Windows path: " ) + wfn.GetFullPath() );
|
wxLogDebug( wxT( "Windows path: " ) + wfn.GetFullPath() );
|
||||||
wxLogDebug( wxT( "Executable path the Kicad way: " ) + m_BinDir );
|
wxLogDebug( wxT( "Executable path the Kicad way: " ) + m_BinDir );
|
||||||
wxLogDebug( wxT( "Executable path the wxWidgets way: " ) +
|
wxLogDebug( wxT( "Executable path the wxWidgets way: " ) +
|
||||||
GetTraits()->GetStandardPaths().GetExecutablePath() );
|
GetTraits()->GetStandardPaths().GetExecutablePath() );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -474,17 +479,18 @@ void WinEDA_App::SetDefaultSearchPaths( void )
|
||||||
wxString path = m_BinDir;
|
wxString path = m_BinDir;
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
/* m_BinDir path is in unix notation.
|
/* m_BinDir path is in unix notation.
|
||||||
* But wxFileName expect (to work fine) native notation
|
* But wxFileName expect (to work fine) native notation
|
||||||
* specifically when using a path including a server, like \\myserver\local_path .
|
* specifically when using a path including a server, like
|
||||||
*/
|
* \\myserver\local_path .
|
||||||
|
*/
|
||||||
path.Replace( UNIX_STRING_DIR_SEP, WIN_STRING_DIR_SEP );
|
path.Replace( UNIX_STRING_DIR_SEP, WIN_STRING_DIR_SEP );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
wxFileName fn( path, wxEmptyString );
|
wxFileName fn( path, wxEmptyString );
|
||||||
|
|
||||||
|
|
||||||
/* User environment variable path is the first search path. Chances are
|
/* User environment variable path is the first search path. Chances are
|
||||||
* if the user is savvy enough to set an environment variable they know
|
* if the user is savvy enough to set an environment variable they know
|
||||||
* what they are doing. */
|
* what they are doing. */
|
||||||
if( ::wxGetEnv( wxT( "KICAD" ), NULL ) )
|
if( ::wxGetEnv( wxT( "KICAD" ), NULL ) )
|
||||||
|
@ -500,51 +506,85 @@ void WinEDA_App::SetDefaultSearchPaths( void )
|
||||||
m_searchPaths.Add( GetTraits()->GetStandardPaths().GetDataDir() );
|
m_searchPaths.Add( GetTraits()->GetStandardPaths().GetDataDir() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Up on level relative to binary path with "share" appended for Windows. */
|
/* Up one level relative to binary path with "share" appended for Windows. */
|
||||||
fn.RemoveLastDir();
|
fn.RemoveLastDir();
|
||||||
m_searchPaths.Add( fn.GetPath() );
|
m_searchPaths.Add( fn.GetPath() );
|
||||||
|
fn.AppendDir( wxT( "share" ) );
|
||||||
|
m_searchPaths.Add( fn.GetPath() );
|
||||||
|
fn.AppendDir( wxT( "kicad" ) );
|
||||||
|
m_searchPaths.Add( fn.GetPath() );
|
||||||
|
|
||||||
/* Remove all non-existant paths from the list. */
|
/* Remove all non-existent paths from the list. */
|
||||||
for( i = 0; i < m_searchPaths.GetCount(); i++ )
|
for( i = 0; i < m_searchPaths.GetCount(); i++ )
|
||||||
{
|
{
|
||||||
wxLogDebug( wxT( "Checking if search path <" ) +
|
wxLogDebug( wxT( "Checking if search path <" ) +
|
||||||
m_searchPaths[i] + wxT( "> exists." ) );
|
m_searchPaths[i] + wxT( "> exists." ) );
|
||||||
if( !wxFileName::IsDirReadable( m_searchPaths[i] ) )
|
if( !wxFileName::IsDirReadable( m_searchPaths[i] ) )
|
||||||
{
|
{
|
||||||
wxLogDebug( wxT( "Removing non-existant path <" ) +
|
wxLogDebug( wxT( "Removing non-existent path <" ) +
|
||||||
m_searchPaths[i] + wxT( "> from search path list." ) );
|
m_searchPaths[i] + wxT( "> from search path list." ) );
|
||||||
m_searchPaths.RemoveAt( i );
|
m_searchPaths.RemoveAt( i );
|
||||||
i -= 1;
|
i -= 1;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Build schematic, PCB, and 3D module library file search path
|
||||||
|
* list based on the known existing default search paths. */
|
||||||
|
fn.Clear();
|
||||||
|
fn.SetPath( m_searchPaths[i] );
|
||||||
|
fn.AppendDir( wxT( "library") );
|
||||||
|
|
||||||
|
wxLogDebug( wxT( "Checking if search path <%s> exists." ),
|
||||||
|
fn.GetPath().c_str() );
|
||||||
|
|
||||||
|
if( fn.IsDirReadable() )
|
||||||
|
{
|
||||||
|
wxLogDebug( wxT( "Adding <%s> to library search path list" ),
|
||||||
|
fn.GetPath().c_str() );
|
||||||
|
m_libSearchPaths.Add( fn.GetPath() );
|
||||||
|
}
|
||||||
|
fn.RemoveLastDir();
|
||||||
|
fn.AppendDir( wxT( "modules" ) );
|
||||||
|
|
||||||
|
if( fn.IsDirReadable() )
|
||||||
|
{
|
||||||
|
wxLogDebug( wxT( "Adding <%s> to library search path list" ),
|
||||||
|
fn.GetPath().c_str() );
|
||||||
|
m_libSearchPaths.Add( fn.GetPath() );
|
||||||
|
}
|
||||||
|
fn.AppendDir( wxT( "packages3d" ) );
|
||||||
|
|
||||||
|
if( fn.IsDirReadable() )
|
||||||
|
{
|
||||||
|
wxLogDebug( wxT( "Adding <%s> to library search path list" ),
|
||||||
|
fn.GetPath().c_str() );
|
||||||
|
m_libSearchPaths.Add( fn.GetPath() );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get application settings
|
* Get application settings
|
||||||
|
*
|
||||||
* @return none
|
* @return none
|
||||||
*/
|
*/
|
||||||
/*********************************/
|
|
||||||
void WinEDA_App::GetSettings()
|
void WinEDA_App::GetSettings()
|
||||||
/*********************************/
|
|
||||||
{
|
{
|
||||||
|
wxASSERT( m_EDA_Config != NULL && m_EDA_CommonConfig != NULL );
|
||||||
|
|
||||||
wxString Line, entry;
|
wxString Line, entry;
|
||||||
unsigned ii;
|
unsigned ii;
|
||||||
|
|
||||||
m_HelpSize.x = 500;
|
m_HelpSize.x = 500;
|
||||||
m_HelpSize.y = 400;
|
m_HelpSize.y = 400;
|
||||||
|
|
||||||
if( m_EDA_CommonConfig )
|
m_LanguageId = m_EDA_CommonConfig->Read( wxT( "Language" ),
|
||||||
{
|
wxLANGUAGE_DEFAULT );
|
||||||
m_LanguageId = m_EDA_CommonConfig->Read( wxT( "Language" ),
|
m_EditorName = m_EDA_CommonConfig->Read( wxT( "Editor" ) );
|
||||||
wxLANGUAGE_DEFAULT );
|
g_ConfigFileLocationChoice = m_EDA_CommonConfig->Read( HOTKEY_CFG_PATH_OPT,
|
||||||
g_EditorName = m_EDA_CommonConfig->Read( wxT( "Editor" ) );
|
0L );
|
||||||
g_ConfigFileLocationChoice = m_EDA_CommonConfig->Read( HOTKEY_CFG_PATH_OPT,
|
|
||||||
0L );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !m_EDA_Config )
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_fileHistory.Load( *m_EDA_Config );
|
m_fileHistory.Load( *m_EDA_Config );
|
||||||
|
|
||||||
|
@ -579,7 +619,7 @@ void WinEDA_App::GetSettings()
|
||||||
g_FixedFontPointSize = m_EDA_Config->Read( wxT( "FixedFontSize" ),
|
g_FixedFontPointSize = m_EDA_Config->Read( wxT( "FixedFontSize" ),
|
||||||
FONT_DEFAULT_SIZE );
|
FONT_DEFAULT_SIZE );
|
||||||
|
|
||||||
/* Sdt font type */
|
/* Std font type */
|
||||||
Line = m_EDA_Config->Read( wxT( "SdtFontType" ), wxEmptyString );
|
Line = m_EDA_Config->Read( wxT( "SdtFontType" ), wxEmptyString );
|
||||||
if( !Line.IsEmpty() )
|
if( !Line.IsEmpty() )
|
||||||
g_StdFont->SetFaceName( Line );
|
g_StdFont->SetFaceName( Line );
|
||||||
|
@ -622,25 +662,23 @@ void WinEDA_App::GetSettings()
|
||||||
|
|
||||||
m_EDA_Config->Read( wxT( "ShowPageLimits" ), &g_ShowPageLimits );
|
m_EDA_Config->Read( wxT( "ShowPageLimits" ), &g_ShowPageLimits );
|
||||||
|
|
||||||
if( m_EDA_Config->Read( wxT( "WorkingDir" ), &Line ) )
|
if( m_EDA_Config->Read( wxT( "WorkingDir" ), &Line ) && wxDirExists( Line ) )
|
||||||
{
|
{
|
||||||
if( wxDirExists( Line ) )
|
wxSetWorkingDirectory( Line );
|
||||||
wxSetWorkingDirectory( Line );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_EDA_Config->Read( wxT( "BgColor" ), &g_DrawBgColor );
|
m_EDA_Config->Read( wxT( "BgColor" ), &g_DrawBgColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save application settings
|
* Save application settings
|
||||||
|
*
|
||||||
* @return none
|
* @return none
|
||||||
*/
|
*/
|
||||||
/**********************************/
|
|
||||||
void WinEDA_App::SaveSettings()
|
void WinEDA_App::SaveSettings()
|
||||||
/**********************************/
|
|
||||||
{
|
{
|
||||||
if( m_EDA_Config == NULL )
|
wxASSERT( m_EDA_Config != NULL );
|
||||||
return;
|
|
||||||
|
|
||||||
/* Sdt font settings */
|
/* Sdt font settings */
|
||||||
m_EDA_Config->Write( wxT( "SdtFontSize" ), g_StdFontPointSize );
|
m_EDA_Config->Write( wxT( "SdtFontSize" ), g_StdFontPointSize );
|
||||||
|
@ -662,9 +700,7 @@ void WinEDA_App::SaveSettings()
|
||||||
|
|
||||||
/* Misc settings */
|
/* Misc settings */
|
||||||
m_EDA_Config->Write( wxT( "FixedFontSize" ), g_FixedFontPointSize );
|
m_EDA_Config->Write( wxT( "FixedFontSize" ), g_FixedFontPointSize );
|
||||||
|
|
||||||
m_EDA_Config->Write( wxT( "ShowPageLimits" ), g_ShowPageLimits );
|
m_EDA_Config->Write( wxT( "ShowPageLimits" ), g_ShowPageLimits );
|
||||||
|
|
||||||
m_EDA_Config->Write( wxT( "WorkingDir" ), wxGetCwd() );
|
m_EDA_Config->Write( wxT( "WorkingDir" ), wxGetCwd() );
|
||||||
|
|
||||||
/* Save the file history list */
|
/* Save the file history list */
|
||||||
|
@ -674,15 +710,14 @@ void WinEDA_App::SaveSettings()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the dictionary file name for internationalization
|
* Set the dictionary file name for internationalization
|
||||||
* the files are in kicad/internat/xx or kicad/internat/xx_XX
|
* the files are in kicad/internat/xx or kicad/internat/xx_XX
|
||||||
* and are named kicad.mo
|
* and are named kicad.mo
|
||||||
*
|
*
|
||||||
* @param first_time must be set to true the first time this funct is called, false otherwise
|
* @param first_time must be set to true the first time this funct is
|
||||||
|
* called, false otherwise
|
||||||
* @return true if the language can be set (i.e. if the locale is available)
|
* @return true if the language can be set (i.e. if the locale is available)
|
||||||
*/
|
*/
|
||||||
/*********************************************/
|
|
||||||
bool WinEDA_App::SetLanguage( bool first_time )
|
bool WinEDA_App::SetLanguage( bool first_time )
|
||||||
/*********************************************/
|
|
||||||
{
|
{
|
||||||
bool retv = true;
|
bool retv = true;
|
||||||
|
|
||||||
|
@ -705,8 +740,10 @@ bool WinEDA_App::SetLanguage( bool first_time )
|
||||||
retv = false;
|
retv = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !first_time && m_EDA_CommonConfig )
|
if( !first_time )
|
||||||
|
{
|
||||||
m_EDA_CommonConfig->Write( wxT( "Language" ), m_LanguageId );
|
m_EDA_CommonConfig->Write( wxT( "Language" ), m_LanguageId );
|
||||||
|
}
|
||||||
|
|
||||||
if( !m_Locale->IsLoaded( DictionaryName ) )
|
if( !m_Locale->IsLoaded( DictionaryName ) )
|
||||||
m_Locale->AddCatalog( DictionaryName );
|
m_Locale->AddCatalog( DictionaryName );
|
||||||
|
@ -718,15 +755,17 @@ bool WinEDA_App::SetLanguage( bool first_time )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Function SetLanguageIdentifier
|
/**
|
||||||
* Set in .m_LanguageId member the wxWidgets language identifier Id
|
* Function SetLanguageIdentifier
|
||||||
* from the kicad menu id (internal menu identifier)
|
*
|
||||||
* @param menu_id = the kicad menuitem id (returned by Menu Event, when clicking on a menu item)
|
* Set in .m_LanguageId member the wxWidgets language identifier Id from
|
||||||
|
* the kicad menu id (internal menu identifier)
|
||||||
|
*
|
||||||
|
* @param menu_id = the kicad menuitem id (returned by Menu Event, when
|
||||||
|
* clicking on a menu item)
|
||||||
* @return none
|
* @return none
|
||||||
*/
|
*/
|
||||||
/**************************************************/
|
|
||||||
void WinEDA_App::SetLanguageIdentifier( int menu_id )
|
void WinEDA_App::SetLanguageIdentifier( int menu_id )
|
||||||
/**************************************************/
|
|
||||||
{
|
{
|
||||||
unsigned int ii;
|
unsigned int ii;
|
||||||
|
|
||||||
|
@ -761,21 +800,23 @@ void WinEDA_App::SetLanguagePath( void )
|
||||||
if( fn.DirExists() )
|
if( fn.DirExists() )
|
||||||
{
|
{
|
||||||
wxLogDebug( wxT( "Adding locale lookup path: " ) +
|
wxLogDebug( wxT( "Adding locale lookup path: " ) +
|
||||||
fn.GetPath() );
|
fn.GetPath() );
|
||||||
wxLocale::AddCatalogLookupPathPrefix( fn.GetPath() );
|
wxLocale::AddCatalogLookupPathPrefix( fn.GetPath() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append path for unix standard install
|
// Append path for unix standard install
|
||||||
fn.RemoveLastDir();
|
fn.RemoveLastDir();
|
||||||
|
|
||||||
|
// Append path for unix standard install
|
||||||
fn.AppendDir( wxT( "kicad" ) );
|
fn.AppendDir( wxT( "kicad" ) );
|
||||||
fn.AppendDir( wxT( "internat" ) );
|
fn.AppendDir( wxT( "internat" ) );
|
||||||
|
|
||||||
if( fn.DirExists() )
|
if( fn.DirExists() )
|
||||||
{
|
{
|
||||||
wxLogDebug( wxT( "Adding locale lookup path: " ) +
|
wxLogDebug( wxT( "Adding locale lookup path: " ) +
|
||||||
fn.GetPath() );
|
fn.GetPath() );
|
||||||
wxLocale::AddCatalogLookupPathPrefix( fn.GetPath() );
|
wxLocale::AddCatalogLookupPathPrefix( fn.GetPath() );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -783,12 +824,11 @@ void WinEDA_App::SetLanguagePath( void )
|
||||||
|
|
||||||
/** Function AddMenuLanguageList
|
/** Function AddMenuLanguageList
|
||||||
* Create menu list for language choice, and add it as submenu to a main menu
|
* Create menu list for language choice, and add it as submenu to a main menu
|
||||||
* @param MasterMenu : The main menu. The sub menu list will be accessible from the menu item with id ID_LANGUAGE_CHOICE
|
* @param MasterMenu : The main menu. The sub menu list will be accessible
|
||||||
|
* from the menu item with id ID_LANGUAGE_CHOICE
|
||||||
* @return none
|
* @return none
|
||||||
*/
|
*/
|
||||||
/*********************************************************/
|
|
||||||
void WinEDA_App::AddMenuLanguageList( wxMenu* MasterMenu )
|
void WinEDA_App::AddMenuLanguageList( wxMenu* MasterMenu )
|
||||||
/*********************************************************/
|
|
||||||
{
|
{
|
||||||
wxMenu* menu = NULL;
|
wxMenu* menu = NULL;
|
||||||
wxMenuItem* item;
|
wxMenuItem* item;
|
||||||
|
@ -855,7 +895,7 @@ wxString WinEDA_App::FindFileInSearchPaths( const wxString& filename,
|
||||||
if( fn.DirExists() )
|
if( fn.DirExists() )
|
||||||
{
|
{
|
||||||
wxLogDebug( _T( "Adding <" ) + fn.GetPath() + _T( "> to " ) +
|
wxLogDebug( _T( "Adding <" ) + fn.GetPath() + _T( "> to " ) +
|
||||||
_T( "file \"" ) + filename + _T( "\" search path." ) );
|
_T( "file \"" ) + filename + _T( "\" search path." ) );
|
||||||
paths.Add( fn.GetPath() );
|
paths.Add( fn.GetPath() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -884,27 +924,28 @@ wxString WinEDA_App::GetHelpFile( void )
|
||||||
wxString fn;
|
wxString fn;
|
||||||
wxArrayString subdirs, altsubdirs;
|
wxArrayString subdirs, altsubdirs;
|
||||||
|
|
||||||
/* FIXME: This is not the ideal way to handle this. Unfortunely, the
|
/* FIXME: This is not the ideal way to handle this. Unfortunately, the
|
||||||
* CMake install paths seem to be a moving target so this crude
|
* CMake install paths seem to be a moving target so this crude
|
||||||
* hack solve the problem of install path differences between
|
* hack solve the problem of install path differences between
|
||||||
* Windows and non-Windows platforms. */
|
* Windows and non-Windows platforms. */
|
||||||
|
|
||||||
// Partially fixed, but must be enhanced
|
// Partially fixed, but must be enhanced
|
||||||
|
|
||||||
// Create subdir tree for "standard" linux distributions, when kicad comes from a distribution
|
// Create subdir tree for "standard" linux distributions, when kicad comes
|
||||||
// files are in /usr/share/doc/kicad/help
|
// from a distribution files are in /usr/share/doc/kicad/help and binaries
|
||||||
// and binaries in /usr/bin or /usr/local/bin
|
// in /usr/bin or /usr/local/bin
|
||||||
subdirs.Add( wxT( "share" ) );
|
subdirs.Add( wxT( "share" ) );
|
||||||
subdirs.Add( _T( "doc" ) );
|
subdirs.Add( _T( "doc" ) );
|
||||||
subdirs.Add( wxT( "kicad" ) );
|
subdirs.Add( wxT( "kicad" ) );
|
||||||
subdirs.Add( _T( "help" ) );
|
subdirs.Add( _T( "help" ) );
|
||||||
|
|
||||||
// Create subdir tree for linux and Windows kicad pack
|
// Create subdir tree for linux and Windows kicad pack.
|
||||||
// Note the pack form under linux is also useful if an user want to install kicad to a server.
|
// Note the pack form under linux is also useful if a user wants to
|
||||||
// because there is only one path to mount or export (something like /usr/local/kicad).
|
// install kicad to a server because there is only one path to mount
|
||||||
|
// or export (something like /usr/local/kicad).
|
||||||
// files are in <install dir>/kicad/doc/help
|
// files are in <install dir>/kicad/doc/help
|
||||||
// (often /usr/local/kicad/kicad/doc/help)
|
// (often /usr/local/kicad/kicad/doc/help)
|
||||||
// <install dir>/kicad/ is retrievered from m_BinDir
|
// <install dir>/kicad/ is retrieved from m_BinDir
|
||||||
altsubdirs.Add( _T( "doc" ) );
|
altsubdirs.Add( _T( "doc" ) );
|
||||||
altsubdirs.Add( _T( "help" ) );
|
altsubdirs.Add( _T( "help" ) );
|
||||||
|
|
||||||
|
@ -929,8 +970,9 @@ wxString WinEDA_App::GetHelpFile( void )
|
||||||
{
|
{
|
||||||
subdirs.RemoveAt( subdirs.GetCount() - 1 );
|
subdirs.RemoveAt( subdirs.GetCount() - 1 );
|
||||||
altsubdirs.RemoveAt( altsubdirs.GetCount() - 1 );
|
altsubdirs.RemoveAt( altsubdirs.GetCount() - 1 );
|
||||||
subdirs.Add( m_Locale->GetName().BeforeLast( '_' ) ); // GetName( ) does not return always the short name
|
// wxLocale::GetName() does not return always the short name
|
||||||
altsubdirs.Add( m_Locale->GetName().BeforeLast( '_' ) ); // GetName( ) does not return always the short name
|
subdirs.Add( m_Locale->GetName().BeforeLast( '_' ) );
|
||||||
|
altsubdirs.Add( m_Locale->GetName().BeforeLast( '_' ) );
|
||||||
fn = FindFileInSearchPaths( m_HelpFileName, &altsubdirs );
|
fn = FindFileInSearchPaths( m_HelpFileName, &altsubdirs );
|
||||||
if ( ! fn )
|
if ( ! fn )
|
||||||
fn = FindFileInSearchPaths( m_HelpFileName, &subdirs );
|
fn = FindFileInSearchPaths( m_HelpFileName, &subdirs );
|
||||||
|
@ -944,8 +986,8 @@ wxString WinEDA_App::GetHelpFile( void )
|
||||||
subdirs.Add( _T( "en" ) );
|
subdirs.Add( _T( "en" ) );
|
||||||
altsubdirs.Add( _T( "en" ) );
|
altsubdirs.Add( _T( "en" ) );
|
||||||
fn = FindFileInSearchPaths( m_HelpFileName, &altsubdirs );
|
fn = FindFileInSearchPaths( m_HelpFileName, &altsubdirs );
|
||||||
if ( ! fn )
|
if ( ! fn )
|
||||||
fn = FindFileInSearchPaths( m_HelpFileName, &subdirs );
|
fn = FindFileInSearchPaths( m_HelpFileName, &subdirs );
|
||||||
}
|
}
|
||||||
|
|
||||||
return fn;
|
return fn;
|
||||||
|
@ -968,12 +1010,12 @@ wxString WinEDA_App::GetLibraryFile( const wxString& filename )
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run init scripts
|
* Run Python scripts
|
||||||
* @return the default OnRun() value (exit codes not used in kicad, so value has no special mening)
|
*
|
||||||
|
* @return The default OnRun() value (exit codes not used in kicad, so value
|
||||||
|
* has no special meaning)
|
||||||
*/
|
*/
|
||||||
/**********************/
|
|
||||||
int WinEDA_App::OnRun()
|
int WinEDA_App::OnRun()
|
||||||
/**********************/
|
|
||||||
{
|
{
|
||||||
#ifdef KICAD_PYTHON
|
#ifdef KICAD_PYTHON
|
||||||
PyHandler::GetInstance()->RunScripts();
|
PyHandler::GetInstance()->RunScripts();
|
||||||
|
|
|
@ -175,88 +175,6 @@ wxString MakeReducedFileName( const wxString& fullfilename,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
|
||||||
wxString MakeFileName( const wxString& dir,
|
|
||||||
const wxString& shortname, const wxString& ext )
|
|
||||||
/***************************************************************************/
|
|
||||||
|
|
||||||
/** Function MakeFileName
|
|
||||||
* Calculate the full file name from dir, shortname and ext
|
|
||||||
* @param dir = path (can be empty)
|
|
||||||
* @param shortname = filename with or without path and/or extension
|
|
||||||
* @param ext = extension (can be empty)
|
|
||||||
* If shortname has an absolute path, or a path starts by ./ or ../,
|
|
||||||
* the path will not be modified
|
|
||||||
* If shortname has an extension, it will not be modified
|
|
||||||
* @return full filename
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
wxString fullfilename;
|
|
||||||
int ii;
|
|
||||||
|
|
||||||
if( !dir.IsEmpty() )
|
|
||||||
{
|
|
||||||
if( !wxIsAbsolutePath( shortname ) )
|
|
||||||
{
|
|
||||||
if( !shortname.StartsWith( wxT( "./" ) ) && !shortname.StartsWith( wxT( "../" ) ) // under unix
|
|
||||||
&& !shortname.StartsWith( wxT( ".\\" ) ) && !shortname.StartsWith( wxT( "..\\" ) )) // under Windows
|
|
||||||
|
|
||||||
{ /* no absolute path in shortname, add dir to shortname */
|
|
||||||
fullfilename = dir;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fullfilename += shortname; // Add shortname to dir or use shortname only
|
|
||||||
|
|
||||||
fullfilename.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
|
||||||
|
|
||||||
/* Add an extension if shortname has no extension */
|
|
||||||
if( ext.IsEmpty() )
|
|
||||||
return fullfilename;
|
|
||||||
|
|
||||||
/* search for an extension */
|
|
||||||
ii = fullfilename.Length(); /* Get the end of name */
|
|
||||||
for( ; ii >= 0; ii-- )
|
|
||||||
{
|
|
||||||
if( fullfilename.GetChar( ii ) == '/' )
|
|
||||||
{
|
|
||||||
/* not extension: add ext */
|
|
||||||
fullfilename += ext;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if( fullfilename.GetChar( ii ) == '.' ) /* extension exists, do nothing */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return fullfilename;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
void ChangeFileNameExt( wxString& FullFileName, const wxString& NewExt )
|
|
||||||
/**************************************************************************/
|
|
||||||
|
|
||||||
/** Function ChangeFileNameExt
|
|
||||||
* change the extension of FullFileName to NewExt.
|
|
||||||
* @param FullFileName = filename to modify
|
|
||||||
* @param NewExt = new extension for FullFileName
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
wxString FileName;
|
|
||||||
|
|
||||||
FileName = FullFileName.BeforeLast( '.' );
|
|
||||||
if( !FileName.IsEmpty() )
|
|
||||||
FileName += NewExt;
|
|
||||||
else
|
|
||||||
FileName = FullFileName + NewExt;
|
|
||||||
|
|
||||||
if( FileName.StartsWith( wxT( "\"" ) ) && ( FileName.Last() != '"' ) )
|
|
||||||
FileName += wxT( "\"" );
|
|
||||||
FullFileName = FileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************/
|
/*******************************************/
|
||||||
void AddDelimiterString( wxString& string )
|
void AddDelimiterString( wxString& string )
|
||||||
/*******************************************/
|
/*******************************************/
|
||||||
|
@ -504,12 +422,10 @@ wxString FindKicadFile( const wxString& shortname )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************************/
|
|
||||||
int ExecuteFile( wxWindow* frame, const wxString& ExecFile, const wxString& param )
|
|
||||||
/***********************************************************************************/
|
|
||||||
|
|
||||||
/* Call the executable file "ExecFile", with params "param"
|
/* Call the executable file "ExecFile", with params "param"
|
||||||
*/
|
*/
|
||||||
|
int ExecuteFile( wxWindow* frame, const wxString& ExecFile,
|
||||||
|
const wxString& param )
|
||||||
{
|
{
|
||||||
wxString FullFileName;
|
wxString FullFileName;
|
||||||
|
|
||||||
|
@ -525,7 +441,7 @@ int ExecuteFile( wxWindow* frame, const wxString& ExecFile, const wxString& para
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf( wxT( "Command file <%s> not found" ), FullFileName.GetData() );
|
msg.Printf( _( "Command <%s> could not found" ), ExecFile.c_str() );
|
||||||
DisplayError( frame, msg, 20 );
|
DisplayError( frame, msg, 20 );
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -653,16 +569,15 @@ wxString ReturnKicadDatasPath()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************/
|
/*
|
||||||
wxString GetEditorName()
|
* Return the prefered editor name
|
||||||
/***************************/
|
|
||||||
|
|
||||||
/* Return the prefered editor name
|
|
||||||
*/
|
*/
|
||||||
|
wxString& WinEDA_App::GetEditorName()
|
||||||
{
|
{
|
||||||
wxString editorname = g_EditorName;
|
wxString editorname = m_EditorName;
|
||||||
|
|
||||||
if( editorname.IsEmpty() ) // We get the prefered editor name from environment variable
|
// We get the prefered editor name from environment variable first.
|
||||||
|
if( editorname.IsEmpty() )
|
||||||
{
|
{
|
||||||
wxGetEnv( wxT( "EDITOR" ), &editorname );
|
wxGetEnv( wxT( "EDITOR" ), &editorname );
|
||||||
}
|
}
|
||||||
|
@ -674,23 +589,18 @@ wxString GetEditorName()
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
mask += wxT( ".exe" );
|
mask += wxT( ".exe" );
|
||||||
#endif
|
#endif
|
||||||
editorname = EDA_FileSelector( _( "Prefered Editor:" ),
|
editorname = EDA_FileSelector( _( "Prefered Editor:" ), wxEmptyString,
|
||||||
wxEmptyString, /* Default path */
|
wxEmptyString, wxEmptyString, mask,
|
||||||
wxEmptyString, /* default filename */
|
NULL, wxFD_OPEN, true );
|
||||||
wxEmptyString, /* default filename extension */
|
|
||||||
mask, /* filter for filename list */
|
|
||||||
NULL, /* parent frame */
|
|
||||||
wxFD_OPEN, /* wxFD_SAVE, wxFD_OPEN ..*/
|
|
||||||
TRUE /* true = keep the current path */
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( !editorname.IsEmpty() ) && wxGetApp().m_EDA_CommonConfig )
|
if( !editorname.IsEmpty() )
|
||||||
{
|
{
|
||||||
g_EditorName = editorname;
|
m_EditorName = editorname;
|
||||||
wxGetApp().m_EDA_CommonConfig->Write( wxT( "Editor" ), g_EditorName );
|
m_EDA_CommonConfig->Write( wxT( "Editor" ), m_EditorName );
|
||||||
}
|
}
|
||||||
return g_EditorName;
|
|
||||||
|
return m_EditorName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -815,3 +725,9 @@ void OpenFile( const wxString& file )
|
||||||
if( success && !command.IsEmpty() )
|
if( success && !command.IsEmpty() )
|
||||||
ProcessExecute( command );
|
ProcessExecute( command );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxString QuoteFullPath( wxFileName& fn, wxPathFormat format )
|
||||||
|
{
|
||||||
|
return wxT( "\"" ) + fn.GetFullPath() + wxT( "\"" );
|
||||||
|
}
|
||||||
|
|
|
@ -14,240 +14,267 @@
|
||||||
/* to select a component or a module */
|
/* to select a component or a module */
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
static unsigned s_HistoryMaxCount = 8; // Max number of items displayed in history list
|
static unsigned s_HistoryMaxCount = 8; // Max number of items displayed in history list
|
||||||
static wxString s_ItemName;
|
static wxString s_ItemName;
|
||||||
|
|
||||||
|
|
||||||
enum selcmp_id {
|
enum selcmp_id {
|
||||||
ID_ACCEPT_NAME = 3900,
|
ID_ACCEPT_NAME = 3900,
|
||||||
ID_ACCEPT_KEYWORD,
|
ID_ACCEPT_KEYWORD,
|
||||||
ID_ENTER_NAME,
|
ID_ENTER_NAME,
|
||||||
ID_CANCEL,
|
ID_CANCEL,
|
||||||
ID_LIST_ALL,
|
ID_LIST_ALL,
|
||||||
ID_EXTRA_TOOL,
|
ID_EXTRA_TOOL,
|
||||||
ID_SEL_BY_LISTBOX
|
ID_SEL_BY_LISTBOX
|
||||||
};
|
};
|
||||||
|
|
||||||
/***************************************/
|
/***************************************/
|
||||||
class WinEDA_SelectCmp: public wxDialog
|
class WinEDA_SelectCmp : public wxDialog
|
||||||
/***************************************/
|
/***************************************/
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
WinEDA_DrawFrame * m_Parent;
|
WinEDA_DrawFrame* m_Parent;
|
||||||
bool m_AuxTool;
|
bool m_AuxTool;
|
||||||
wxString * m_Text;
|
wxString* m_Text;
|
||||||
wxTextCtrl * m_TextCtrl;
|
wxTextCtrl* m_TextCtrl;
|
||||||
wxListBox * m_List;
|
wxListBox* m_List;
|
||||||
public:
|
public:
|
||||||
bool m_GetExtraFunction;
|
bool m_GetExtraFunction;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructor and destructor
|
// Constructor and destructor
|
||||||
WinEDA_SelectCmp(WinEDA_DrawFrame *parent, const wxPoint& framepos,
|
WinEDA_SelectCmp( WinEDA_DrawFrame* parent, const wxPoint& framepos,
|
||||||
wxArrayString & HistoryList, const wxString & Title,
|
wxArrayString& HistoryList, const wxString& Title,
|
||||||
bool show_extra_tool );
|
bool show_extra_tool );
|
||||||
~WinEDA_SelectCmp() {};
|
~WinEDA_SelectCmp() {};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Accept(wxCommandEvent& event);
|
void Accept( wxCommandEvent& event );
|
||||||
void GetExtraSelection(wxCommandEvent& event);
|
void GetExtraSelection( wxCommandEvent& event );
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
BEGIN_EVENT_TABLE(WinEDA_SelectCmp, wxDialog)
|
|
||||||
EVT_BUTTON(ID_ACCEPT_NAME, WinEDA_SelectCmp::Accept)
|
BEGIN_EVENT_TABLE( WinEDA_SelectCmp, wxDialog )
|
||||||
EVT_BUTTON(ID_ACCEPT_KEYWORD, WinEDA_SelectCmp::Accept)
|
EVT_BUTTON( ID_ACCEPT_NAME, WinEDA_SelectCmp::Accept )
|
||||||
EVT_BUTTON(ID_CANCEL, WinEDA_SelectCmp::Accept)
|
EVT_BUTTON( ID_ACCEPT_KEYWORD, WinEDA_SelectCmp::Accept )
|
||||||
EVT_BUTTON(ID_LIST_ALL, WinEDA_SelectCmp::Accept)
|
EVT_BUTTON( ID_CANCEL, WinEDA_SelectCmp::Accept )
|
||||||
EVT_BUTTON(ID_EXTRA_TOOL, WinEDA_SelectCmp::GetExtraSelection)
|
EVT_BUTTON( ID_LIST_ALL, WinEDA_SelectCmp::Accept )
|
||||||
EVT_LISTBOX(ID_SEL_BY_LISTBOX, WinEDA_SelectCmp::Accept)
|
EVT_BUTTON( ID_EXTRA_TOOL, WinEDA_SelectCmp::GetExtraSelection )
|
||||||
|
EVT_LISTBOX( ID_SEL_BY_LISTBOX, WinEDA_SelectCmp::Accept )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
WinEDA_SelectCmp::WinEDA_SelectCmp(WinEDA_DrawFrame *parent, const wxPoint& framepos,
|
WinEDA_SelectCmp::WinEDA_SelectCmp( WinEDA_DrawFrame* parent,
|
||||||
wxArrayString & HistoryList, const wxString & Title,
|
const wxPoint& framepos,
|
||||||
bool show_extra_tool ):
|
wxArrayString& HistoryList,
|
||||||
wxDialog(parent, -1, Title, framepos,
|
const wxString& Title,
|
||||||
wxDefaultSize, DIALOG_STYLE)
|
bool show_extra_tool ) :
|
||||||
|
wxDialog( parent, -1, Title, framepos, wxDefaultSize, DIALOG_STYLE )
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
/* Dialog frame to choose a component or a footprint
|
/* Dialog frame to choose a component or a footprint
|
||||||
This dialog shows an history of last selected items
|
* This dialog shows an history of last selected items
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxButton * Button;
|
wxButton* Button;
|
||||||
wxStaticText * Text;
|
wxStaticText* Text;
|
||||||
|
|
||||||
m_Parent = parent;
|
|
||||||
m_AuxTool = show_extra_tool;
|
|
||||||
m_GetExtraFunction = FALSE;
|
|
||||||
|
|
||||||
SetFont(*g_DialogFont);
|
|
||||||
s_ItemName.Empty();
|
|
||||||
m_Text = & s_ItemName;
|
|
||||||
|
|
||||||
wxBoxSizer* MainBoxSizer = new wxBoxSizer(wxHORIZONTAL);
|
|
||||||
SetSizer(MainBoxSizer);
|
|
||||||
|
|
||||||
wxBoxSizer* LeftBoxSizer = new wxBoxSizer(wxVERTICAL);
|
m_Parent = parent;
|
||||||
MainBoxSizer->Add(LeftBoxSizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxADJUST_MINSIZE, 5);
|
m_AuxTool = show_extra_tool;
|
||||||
wxBoxSizer* RightBoxSizer = new wxBoxSizer(wxVERTICAL);
|
m_GetExtraFunction = FALSE;
|
||||||
MainBoxSizer->Add(RightBoxSizer, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
|
|
||||||
|
|
||||||
Text = new wxStaticText(this, -1, _("Name:"));
|
|
||||||
LeftBoxSizer->Add(Text, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
|
|
||||||
|
|
||||||
m_TextCtrl = new wxTextCtrl(this, ID_ENTER_NAME, *m_Text);
|
|
||||||
m_TextCtrl->SetInsertionPoint(1);
|
|
||||||
LeftBoxSizer->Add(m_TextCtrl, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM|wxADJUST_MINSIZE, 5);
|
|
||||||
|
|
||||||
Text = new wxStaticText(this, -1, _("History list:"));
|
|
||||||
LeftBoxSizer->Add(Text, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
|
|
||||||
|
|
||||||
m_List = new wxListBox(this, ID_SEL_BY_LISTBOX, wxDefaultPosition,
|
SetFont( *g_DialogFont );
|
||||||
wxSize(220, -1), HistoryList, wxLB_SINGLE );
|
s_ItemName.Empty();
|
||||||
LeftBoxSizer->Add(m_List, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM|wxADJUST_MINSIZE, 5);
|
m_Text = &s_ItemName;
|
||||||
|
|
||||||
Button = new wxButton(this, ID_ACCEPT_NAME, _("OK"));
|
|
||||||
Button->SetForegroundColour(*wxRED);
|
|
||||||
Button->SetDefault();
|
|
||||||
RightBoxSizer->Add(Button, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP|wxBOTTOM, 5);
|
|
||||||
|
|
||||||
Button = new wxButton(this, ID_ACCEPT_KEYWORD, _("Search KeyWord"));
|
wxBoxSizer* MainBoxSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||||
Button->SetForegroundColour(*wxRED);
|
SetSizer( MainBoxSizer );
|
||||||
RightBoxSizer->Add(Button, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
|
|
||||||
|
|
||||||
Button = new wxButton(this, ID_CANCEL, _("Cancel"));
|
wxBoxSizer* LeftBoxSizer = new wxBoxSizer( wxVERTICAL );
|
||||||
Button->SetForegroundColour(*wxBLUE);
|
MainBoxSizer->Add( LeftBoxSizer,
|
||||||
RightBoxSizer->Add(Button, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
|
0,
|
||||||
|
wxALIGN_CENTER_HORIZONTAL | wxALL | wxADJUST_MINSIZE,
|
||||||
|
5 );
|
||||||
|
wxBoxSizer* RightBoxSizer = new wxBoxSizer( wxVERTICAL );
|
||||||
|
MainBoxSizer->Add( RightBoxSizer, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
|
||||||
|
|
||||||
Button = new wxButton(this, ID_LIST_ALL, _("List All"));
|
Text = new wxStaticText( this, -1, _( "Name:" ) );
|
||||||
Button->SetForegroundColour(wxColor(0, 80, 0));
|
LeftBoxSizer->Add( Text, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5 );
|
||||||
RightBoxSizer->Add(Button, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
|
|
||||||
|
m_TextCtrl = new wxTextCtrl( this, ID_ENTER_NAME, *m_Text );
|
||||||
|
m_TextCtrl->SetInsertionPoint( 1 );
|
||||||
|
LeftBoxSizer->Add( m_TextCtrl,
|
||||||
|
0,
|
||||||
|
wxGROW | wxLEFT | wxRIGHT | wxBOTTOM | wxADJUST_MINSIZE,
|
||||||
|
5 );
|
||||||
|
|
||||||
|
Text = new wxStaticText( this, -1, _( "History list:" ) );
|
||||||
|
LeftBoxSizer->Add( Text, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP, 5 );
|
||||||
|
|
||||||
|
m_List = new wxListBox( this, ID_SEL_BY_LISTBOX, wxDefaultPosition,
|
||||||
|
wxSize( 220, -1 ), HistoryList, wxLB_SINGLE );
|
||||||
|
LeftBoxSizer->Add( m_List,
|
||||||
|
0,
|
||||||
|
wxGROW | wxLEFT | wxRIGHT | wxBOTTOM | wxADJUST_MINSIZE,
|
||||||
|
5 );
|
||||||
|
|
||||||
|
Button = new wxButton( this, ID_ACCEPT_NAME, _( "OK" ) );
|
||||||
|
Button->SetForegroundColour( *wxRED );
|
||||||
|
Button->SetDefault();
|
||||||
|
RightBoxSizer->Add( Button,
|
||||||
|
0,
|
||||||
|
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM,
|
||||||
|
5 );
|
||||||
|
|
||||||
|
Button = new wxButton( this, ID_ACCEPT_KEYWORD, _( "Search KeyWord" ) );
|
||||||
|
Button->SetForegroundColour( *wxRED );
|
||||||
|
RightBoxSizer->Add( Button, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
||||||
|
|
||||||
|
Button = new wxButton( this, ID_CANCEL, _( "Cancel" ) );
|
||||||
|
Button->SetForegroundColour( *wxBLUE );
|
||||||
|
RightBoxSizer->Add( Button, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
||||||
|
|
||||||
|
Button = new wxButton( this, ID_LIST_ALL, _( "List All" ) );
|
||||||
|
Button->SetForegroundColour( wxColor( 0, 80, 0 ) );
|
||||||
|
RightBoxSizer->Add( Button, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
||||||
|
|
||||||
#ifndef __WXMAC__
|
#ifndef __WXMAC__
|
||||||
if ( m_AuxTool ) /* The selection can be done by an extra function */
|
if( m_AuxTool ) /* The selection can be done by an extra function */
|
||||||
{
|
{
|
||||||
|
Button = new wxButton( this, ID_EXTRA_TOOL, _( "By Lib Browser" ) );
|
||||||
Button = new wxButton(this, ID_EXTRA_TOOL, _("By Lib Browser"));
|
Button->SetForegroundColour( wxColor( 0, 0, 0 ) ); // Listbox Color
|
||||||
Button->SetForegroundColour(wxColor(0, 0, 0)); // Listbox Color
|
RightBoxSizer->Add( Button, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
||||||
RightBoxSizer->Add(Button, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
|
}
|
||||||
}
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
GetSizer()->Fit(this);
|
GetSizer()->Fit( this );
|
||||||
GetSizer()->SetSizeHints(this);
|
GetSizer()->SetSizeHints( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
void WinEDA_SelectCmp::Accept(wxCommandEvent& event)
|
void WinEDA_SelectCmp::Accept( wxCommandEvent& event )
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
{
|
{
|
||||||
switch (event.GetId() )
|
switch( event.GetId() )
|
||||||
{
|
{
|
||||||
case ID_SEL_BY_LISTBOX:
|
case ID_SEL_BY_LISTBOX:
|
||||||
*m_Text = m_List->GetStringSelection();
|
*m_Text = m_List->GetStringSelection();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_ACCEPT_NAME:
|
case ID_ACCEPT_NAME:
|
||||||
*m_Text = m_TextCtrl->GetValue();
|
*m_Text = m_TextCtrl->GetValue();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_ACCEPT_KEYWORD:
|
case ID_ACCEPT_KEYWORD:
|
||||||
*m_Text = wxT("= ") + m_TextCtrl->GetValue();
|
*m_Text = wxT( "= " ) + m_TextCtrl->GetValue();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_CANCEL:
|
case ID_CANCEL:
|
||||||
*m_Text = wxEmptyString;
|
*m_Text = wxEmptyString;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_LIST_ALL:
|
case ID_LIST_ALL:
|
||||||
*m_Text = wxT("*");
|
*m_Text = wxT( "*" );
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
|
||||||
m_Text->Trim(FALSE); // Remove blanks at beginning
|
m_Text->Trim( FALSE ); // Remove blanks at beginning
|
||||||
m_Text->Trim(TRUE); // Remove blanks at end
|
m_Text->Trim( TRUE ); // Remove blanks at end
|
||||||
Close(TRUE);
|
Close( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
void WinEDA_SelectCmp::GetExtraSelection(wxCommandEvent& event)
|
void WinEDA_SelectCmp::GetExtraSelection( wxCommandEvent& event )
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
|
|
||||||
/* Get the component name by the extra function
|
/* Get the component name by the extra function
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
m_GetExtraFunction = TRUE;
|
m_GetExtraFunction = TRUE;
|
||||||
Close(TRUE);
|
Close( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
wxString GetComponentName(WinEDA_DrawFrame * frame,
|
wxString GetComponentName( WinEDA_DrawFrame* frame,
|
||||||
wxArrayString & HistoryList, const wxString & Title,
|
wxArrayString& HistoryList, const wxString& Title,
|
||||||
wxString(*AuxTool)(WinEDA_DrawFrame *parent))
|
wxString (*AuxTool)( WinEDA_DrawFrame* parent ) )
|
||||||
/*******************************************************************************/
|
/*******************************************************************************/
|
||||||
|
|
||||||
/* Dialog frame to choose a component name
|
/* Dialog frame to choose a component name
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxPoint framepos;
|
wxPoint framepos;
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
bool GetExtraFunction;
|
bool GetExtraFunction;
|
||||||
|
|
||||||
framepos = wxGetMousePosition();
|
framepos = wxGetMousePosition();
|
||||||
wxClientDisplayRect(&x, &y, &w, &h);
|
wxClientDisplayRect( &x, &y, &w, &h );
|
||||||
framepos.x -= 100; framepos.y -= 50;
|
framepos.x -= 100;
|
||||||
if ( framepos.x < x ) framepos.x = x;
|
framepos.y -= 50;
|
||||||
if ( framepos.y < y ) framepos.y = y;
|
if( framepos.x < x )
|
||||||
if ( framepos.x < x ) framepos.x = x;
|
framepos.x = x;
|
||||||
x += w -350; if ( framepos.x > x ) framepos.x = x;
|
if( framepos.y < y )
|
||||||
if ( framepos.y < y ) framepos.y = y;
|
framepos.y = y;
|
||||||
WinEDA_SelectCmp * selframe =
|
if( framepos.x < x )
|
||||||
new WinEDA_SelectCmp(frame, framepos, HistoryList, Title, AuxTool ? TRUE : FALSE);
|
framepos.x = x;
|
||||||
selframe->ShowModal();
|
x += w - 350;
|
||||||
GetExtraFunction = selframe->m_GetExtraFunction;
|
if( framepos.x > x )
|
||||||
selframe->Destroy();
|
framepos.x = x;
|
||||||
|
if( framepos.y < y )
|
||||||
if ( GetExtraFunction ) s_ItemName = AuxTool(frame);
|
framepos.y = y;
|
||||||
return s_ItemName;
|
WinEDA_SelectCmp* selframe =
|
||||||
|
new WinEDA_SelectCmp( frame, framepos, HistoryList, Title,
|
||||||
|
AuxTool ? TRUE : FALSE );
|
||||||
|
selframe->ShowModal();
|
||||||
|
GetExtraFunction = selframe->m_GetExtraFunction;
|
||||||
|
selframe->Destroy();
|
||||||
|
|
||||||
|
if( GetExtraFunction )
|
||||||
|
s_ItemName = AuxTool( frame );
|
||||||
|
return s_ItemName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************/
|
/*******************************************************************************/
|
||||||
void AddHistoryComponentName(wxArrayString & HistoryList, const wxString & Name)
|
void AddHistoryComponentName( wxArrayString& HistoryList, const wxString& Name )
|
||||||
/*******************************************************************************/
|
/*******************************************************************************/
|
||||||
|
|
||||||
/* Add the string "Name" to the history list HistoryList
|
/* Add the string "Name" to the history list HistoryList
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int ii, c_max;
|
int ii, c_max;
|
||||||
|
|
||||||
if ( HistoryList.GetCount() > 0)
|
if( HistoryList.GetCount() > 0 )
|
||||||
{
|
{
|
||||||
if (Name == HistoryList[0] ) return;
|
if( Name == HistoryList[0] )
|
||||||
|
return;
|
||||||
/* remove an old identical selection if exists */
|
|
||||||
for ( ii = 1; (unsigned)ii < HistoryList.GetCount(); ii ++ )
|
/* remove an old identical selection if exists */
|
||||||
{
|
for( ii = 1; (unsigned) ii < HistoryList.GetCount(); ii++ )
|
||||||
if ( Name == HistoryList[ii] )
|
{
|
||||||
{
|
if( Name == HistoryList[ii] )
|
||||||
HistoryList.RemoveAt(ii); ii--;
|
{
|
||||||
}
|
HistoryList.RemoveAt( ii ); ii--;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* shift the list */
|
|
||||||
if ( HistoryList.GetCount() < s_HistoryMaxCount )
|
/* shift the list */
|
||||||
HistoryList.Add(wxT(""));
|
if( HistoryList.GetCount() < s_HistoryMaxCount )
|
||||||
|
HistoryList.Add( wxT( "" ) );
|
||||||
c_max = HistoryList.GetCount() - 2;
|
|
||||||
for ( ii = c_max; ii >= 0 ; ii -- ) HistoryList[ii+1] = HistoryList[ii];
|
c_max = HistoryList.GetCount() - 2;
|
||||||
|
for( ii = c_max; ii >= 0; ii-- )
|
||||||
/* Add the new name at the beginning of the history list */
|
HistoryList[ii + 1] = HistoryList[ii];
|
||||||
HistoryList[0] = Name;
|
|
||||||
}
|
/* Add the new name at the beginning of the history list */
|
||||||
else
|
HistoryList[0] = Name;
|
||||||
HistoryList.Add(Name);
|
}
|
||||||
|
else
|
||||||
|
HistoryList.Add( Name );
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,14 @@
|
||||||
* and remember users can have old versions with bugs
|
* and remember users can have old versions with bugs
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* variables generales */
|
||||||
|
|
||||||
|
// pour les tracés en mode XOR = GR_XOR ou GR_NXOR selon couleur de fond
|
||||||
|
int g_XorMode = GR_NXOR;
|
||||||
|
// couleur de fond de la frame de dessin
|
||||||
|
int g_DrawBgColor = WHITE;
|
||||||
|
|
||||||
|
|
||||||
#define USE_CLIP_FILLED_POLYGONS
|
#define USE_CLIP_FILLED_POLYGONS
|
||||||
|
|
||||||
#ifdef USE_CLIP_FILLED_POLYGONS
|
#ifdef USE_CLIP_FILLED_POLYGONS
|
||||||
|
@ -1480,21 +1488,17 @@ void GRSetTextFgColor( wxDC* DC, int Color )
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
/* Set the foreground color used to draw texts */
|
/* Set the foreground color used to draw texts */
|
||||||
{
|
{
|
||||||
DC->SetTextForeground( wxColour(
|
DC->SetTextForeground( wxColour( ColorRefs[Color].m_Red,
|
||||||
ColorRefs[Color].m_Red,
|
ColorRefs[Color].m_Green,
|
||||||
ColorRefs[Color].m_Green,
|
ColorRefs[Color].m_Blue ) );
|
||||||
ColorRefs[Color].m_Blue )
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GRSetTextFgColor( wxDC* DC, wxFont*, int Color )
|
void GRSetTextFgColor( wxDC* DC, wxFont*, int Color )
|
||||||
{
|
{
|
||||||
DC->SetTextForeground( wxColour(
|
DC->SetTextForeground( wxColour( ColorRefs[Color].m_Red,
|
||||||
ColorRefs[Color].m_Red,
|
ColorRefs[Color].m_Green,
|
||||||
ColorRefs[Color].m_Green,
|
ColorRefs[Color].m_Blue ) );
|
||||||
ColorRefs[Color].m_Blue )
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1533,22 +1537,18 @@ void GRSetTextBgColor( wxDC* DC, int Color )
|
||||||
/* Set the background color used to draw texts */
|
/* Set the background color used to draw texts */
|
||||||
{
|
{
|
||||||
Color &= MASKCOLOR; // keep only the bits used to select the color
|
Color &= MASKCOLOR; // keep only the bits used to select the color
|
||||||
DC->SetTextBackground( wxColour(
|
DC->SetTextBackground( wxColour( ColorRefs[Color].m_Red,
|
||||||
ColorRefs[Color].m_Red,
|
ColorRefs[Color].m_Green,
|
||||||
ColorRefs[Color].m_Green,
|
ColorRefs[Color].m_Blue ) );
|
||||||
ColorRefs[Color].m_Blue )
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GRSetTextBgColor( wxDC* DC, wxFont*, int Color )
|
void GRSetTextBgColor( wxDC* DC, wxFont*, int Color )
|
||||||
{
|
{
|
||||||
Color &= MASKCOLOR; // keep only the bits used to select the color
|
Color &= MASKCOLOR; // keep only the bits used to select the color
|
||||||
DC->SetTextBackground( wxColour(
|
DC->SetTextBackground( wxColour( ColorRefs[Color].m_Red,
|
||||||
ColorRefs[Color].m_Red,
|
ColorRefs[Color].m_Green,
|
||||||
ColorRefs[Color].m_Green,
|
ColorRefs[Color].m_Blue ) );
|
||||||
ColorRefs[Color].m_Blue )
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_CLIP_FILLED_POLYGONS
|
#ifdef USE_CLIP_FILLED_POLYGONS
|
||||||
|
|
|
@ -18,6 +18,19 @@
|
||||||
#include "wxstruct.h"
|
#include "wxstruct.h"
|
||||||
|
|
||||||
|
|
||||||
|
wxString g_CommonSectionTag( wxT( "[common]" ) );
|
||||||
|
wxString g_SchematicSectionTag( wxT( "[eeschema]" ) );
|
||||||
|
wxString g_LibEditSectionTag( wxT( "[libedit]" ) );
|
||||||
|
wxString g_BoardEditorSectionTag( wxT( "[pcbnew]" ) );
|
||||||
|
wxString g_ModuleEditSectionTag( wxT( "[footprinteditor]" ) );
|
||||||
|
|
||||||
|
/* 0 = files are in Home directory (usefull under unix)
|
||||||
|
* 1 = kicad/template ( usefull only under windows )
|
||||||
|
* 2 ... = unused
|
||||||
|
*/
|
||||||
|
int g_ConfigFileLocationChoice;
|
||||||
|
|
||||||
|
|
||||||
/* Class to handle hotkey commnands. hotkeys have a default value
|
/* Class to handle hotkey commnands. hotkeys have a default value
|
||||||
* This class allows the real key code changed by user from a key code list file
|
* This class allows the real key code changed by user from a key code list file
|
||||||
*/
|
*/
|
||||||
|
@ -618,8 +631,7 @@ void AddHotkeyConfigMenu( wxMenu* menu )
|
||||||
|
|
||||||
item = new wxMenuItem( menu, ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST,
|
item = new wxMenuItem( menu, ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST,
|
||||||
_( "Show Current Hotkey List" ),
|
_( "Show Current Hotkey List" ),
|
||||||
_( "Show the current hotkey config" )
|
_( "Show the current hotkey config" ) );
|
||||||
);
|
|
||||||
item->SetBitmap( info_xpm );
|
item->SetBitmap( info_xpm );
|
||||||
menu->Append( item );
|
menu->Append( item );
|
||||||
|
|
||||||
|
@ -631,8 +643,8 @@ void AddHotkeyConfigMenu( wxMenu* menu )
|
||||||
menu->Append( item );
|
menu->Append( item );
|
||||||
|
|
||||||
item = new wxMenuItem( menu, ID_PREFERENCES_READ_CONFIG_HOTKEYS,
|
item = new wxMenuItem( menu, ID_PREFERENCES_READ_CONFIG_HOTKEYS,
|
||||||
_( "Reread Hotkey config file" ),
|
_( "Reread Hotkey config file" ),
|
||||||
_( "Reread the hotkey config file" ) );
|
_( "Reread the hotkey config file" ) );
|
||||||
item->SetBitmap( reload_xpm );
|
item->SetBitmap( reload_xpm );
|
||||||
menu->Append( item );
|
menu->Append( item );
|
||||||
item = new wxMenuItem( menu, ID_PREFERENCES_EDIT_CONFIG_HOTKEYS,
|
item = new wxMenuItem( menu, ID_PREFERENCES_EDIT_CONFIG_HOTKEYS,
|
||||||
|
@ -654,12 +666,11 @@ void AddHotkeyConfigMenu( wxMenu* menu )
|
||||||
wxITEM_CHECK );
|
wxITEM_CHECK );
|
||||||
submenu_hkcfg->Append( item );
|
submenu_hkcfg->Append( item );
|
||||||
|
|
||||||
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( menu, submenu_hkcfg,
|
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( menu, submenu_hkcfg, -1,
|
||||||
-1,
|
|
||||||
_( "Hotkey config location" ),
|
_( "Hotkey config location" ),
|
||||||
_(
|
_( "Hotkey config file location " \
|
||||||
"Hotkey config file location selection (home directory or kicad tree)" ),
|
"selection (home directory or " \
|
||||||
right_xpm );
|
"kicad tree)" ), right_xpm );
|
||||||
submenu_hkcfg->Check( ID_PREFERENCES_HOTKEY_PATH_IS_HOME,
|
submenu_hkcfg->Check( ID_PREFERENCES_HOTKEY_PATH_IS_HOME,
|
||||||
g_ConfigFileLocationChoice == 0 );
|
g_ConfigFileLocationChoice == 0 );
|
||||||
submenu_hkcfg->Check( ID_PREFERENCES_HOTKEY_PATH_IS_KICAD,
|
submenu_hkcfg->Check( ID_PREFERENCES_HOTKEY_PATH_IS_KICAD,
|
||||||
|
@ -678,8 +689,8 @@ void HandleHotkeyConfigMenuSelection( WinEDA_DrawFrame* frame, int id )
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxMenuBar* menu = frame->GetMenuBar();
|
wxMenuBar* menu = frame->GetMenuBar();
|
||||||
wxConfig * config = wxGetApp().m_EDA_CommonConfig;
|
|
||||||
wxASSERT( config != NULL );
|
wxConfig* config = wxGetApp().m_EDA_CommonConfig;
|
||||||
|
|
||||||
switch( id )
|
switch( id )
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,144 @@
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@verizon.net>
|
||||||
|
* Copyright (C) 1992-2008 Kicad Developers, see change_log.txt for contributors.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, you may find one here:
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||||
|
* or you may write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file contains the global constants and variables used in the PCB
|
||||||
|
* applications PCBNEW, CvPcb, and GervView. The goal of this was to
|
||||||
|
* unobfuscate the original header file design that made it very difficult
|
||||||
|
* to figure out where these variables lived. Ideally, they should be pushed
|
||||||
|
* back into the application layer.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "fctsys.h"
|
||||||
|
#include "pcbcommon.h"
|
||||||
|
#include "plot_common.h"
|
||||||
|
#include "class_zone_setting.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* Look up Table for conversion one layer number -> one bit layer mask: */
|
||||||
|
int g_TabOneLayerMask[LAYER_COUNT] = {
|
||||||
|
0x00000001, 0x00000002, 0x00000004, 0x00000008,
|
||||||
|
0x00000010, 0x00000020, 0x00000040, 0x00000080,
|
||||||
|
0x00000100, 0x00000200, 0x00000400, 0x00000800,
|
||||||
|
0x00001000, 0x00002000, 0x00004000, 0x00008000,
|
||||||
|
0x00010000, 0x00020000, 0x00040000, 0x00080000,
|
||||||
|
0x00100000, 0x00200000, 0x00400000, 0x00800000,
|
||||||
|
0x01000000, 0x02000000, 0x04000000, 0x08000000,
|
||||||
|
0x10000000, 0x20000000, 0x40000000, 0x80000000
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Look up Table for conversion copper layer count -> general copper layer
|
||||||
|
* mask: */
|
||||||
|
int g_TabAllCopperLayerMask[NB_COPPER_LAYERS] = {
|
||||||
|
0x0001, 0x8001, 0x8003, 0x8007,
|
||||||
|
0x800F, 0x801F, 0x803F, 0x807F,
|
||||||
|
0x80FF, 0x81FF, 0x83FF, 0x87FF,
|
||||||
|
0x8FFF, 0x9FFF, 0xCFFF, 0xFFFF
|
||||||
|
};
|
||||||
|
|
||||||
|
wxString g_ViaType_Name[4] = {
|
||||||
|
_( "??? Via" ), // Not used yet
|
||||||
|
_( "Micro Via" ), // from external layer (TOP or BOTTOM) from the near neightbour inner layer only
|
||||||
|
_( "Blind/Buried Via" ), // from inner or external to inner or external layer (no restriction)
|
||||||
|
_( "Through Via" ) // Usual via (from TOP to BOTTOM layer only )
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
wxArrayString g_LibName_List; // library list to load
|
||||||
|
|
||||||
|
BOARD_ITEM* g_UnDeleteStack[UNDELETE_STACK_SIZE]; // Linked list of deleted items
|
||||||
|
int g_UnDeleteStackPtr;
|
||||||
|
bool g_ShowGrid = true;
|
||||||
|
|
||||||
|
DISPLAY_OPTIONS DisplayOpt; /* Display options for board items */
|
||||||
|
|
||||||
|
/* PCB file name extension definitions. */
|
||||||
|
wxString PcbExtBuffer( wxT( "brd" ) );
|
||||||
|
wxString g_SaveFileName( wxT( "$savepcb" ) );
|
||||||
|
wxString NetExtBuffer( wxT( "net" ) );
|
||||||
|
wxString NetCmpExtBuffer( wxT( "cmp" ) );
|
||||||
|
wxString g_Shapes3DExtBuffer( wxT( "wrl" ) );
|
||||||
|
const wxString ModuleFileExtension( wxT( "mod" ) );
|
||||||
|
|
||||||
|
/* PCB file name wild card definitions. */
|
||||||
|
const wxString ModuleFileWildcard( _( "Kicad footprint library files " \
|
||||||
|
"(*.mod)|*.mod") );
|
||||||
|
|
||||||
|
int g_CurrentVersionPCB = 1;
|
||||||
|
|
||||||
|
/* variables generales */
|
||||||
|
int g_TimeOut; // Timer for automatic saving
|
||||||
|
int g_SaveTime; // Time for next saving
|
||||||
|
|
||||||
|
int g_AnchorColor = BLUE;
|
||||||
|
int g_ModuleTextCMPColor = LIGHTGRAY;
|
||||||
|
int g_ModuleTextCUColor = MAGENTA;
|
||||||
|
int g_ModuleTextNOVColor = DARKGRAY;
|
||||||
|
int g_PadCUColor = GREEN;
|
||||||
|
int g_PadCMPColor = RED;
|
||||||
|
|
||||||
|
// Current designe settings:
|
||||||
|
class EDA_BoardDesignSettings g_DesignSettings;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used in track creation, a list of track segments currently being created,
|
||||||
|
* with the newest track at the end of the list, sorted by new-ness. e.g. use
|
||||||
|
* TRACK->Back() to get the next older track, TRACK->Next() to get the next
|
||||||
|
* newer track.
|
||||||
|
*/
|
||||||
|
DLIST<TRACK> g_CurrentTrackList;
|
||||||
|
|
||||||
|
PCB_SCREEN* ScreenPcb = NULL;
|
||||||
|
BOARD* g_ModuleEditor_Pcb = NULL;
|
||||||
|
|
||||||
|
int g_GridRoutingSize = 250;
|
||||||
|
|
||||||
|
bool g_Zone_45_Only = FALSE;
|
||||||
|
|
||||||
|
/* HPGL plot settings. */
|
||||||
|
int g_HPGL_Pen_Num = 1; /* num de plume a charger */
|
||||||
|
int g_HPGL_Pen_Speed = 40; /* vitesse en cm/s */
|
||||||
|
int g_HPGL_Pen_Diam; /* diametre en mils */
|
||||||
|
int g_HPGL_Pen_Recouvrement; /* recouvrement en mils ( pour remplissages */
|
||||||
|
|
||||||
|
float Scale_X;
|
||||||
|
float Scale_Y; /* coeff d'agrandissement en X et Y demandes */
|
||||||
|
|
||||||
|
int PlotMarge;
|
||||||
|
int g_PlotLine_Width;
|
||||||
|
int g_PlotFormat = PLOT_FORMAT_GERBER;
|
||||||
|
int g_PlotOrient;
|
||||||
|
|
||||||
|
wxPoint g_PlotOffset;
|
||||||
|
|
||||||
|
FILE* dest = NULL;
|
||||||
|
|
||||||
|
/* id for plot format (see enum PlotFormat in plot_common.h) */
|
||||||
|
int g_PlotScaleOpt;
|
||||||
|
int g_DrillShapeOpt;
|
||||||
|
|
||||||
|
// Default setting used when creating a new zone
|
||||||
|
ZONE_SETTING g_Zone_Default_Setting;
|
||||||
|
|
||||||
|
D_PAD g_Pad_Master( (MODULE*) NULL );
|
|
@ -8,20 +8,17 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "kicad_string.h"
|
#include "kicad_string.h"
|
||||||
#include "gestfich.h"
|
#include "gestfich.h"
|
||||||
|
#include "wxstruct.h"
|
||||||
#include "param_config.h"
|
#include "param_config.h"
|
||||||
|
|
||||||
|
|
||||||
#define CONFIG_VERSION 1
|
#define CONFIG_VERSION 1
|
||||||
|
|
||||||
#define FORCE_LOCAL_CONFIG true
|
#define FORCE_LOCAL_CONFIG true
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
/**
|
||||||
static bool ReCreatePrjConfig( const wxString& local_config_filename,
|
* Cree ou recree la configuration locale de kicad (filename.pro)
|
||||||
const wxString& GroupName,
|
|
||||||
bool ForceUseLocalConfig )
|
|
||||||
/*********************************************************************/
|
|
||||||
|
|
||||||
/* Cree ou recree la configuration locale de kicad (filename.pro)
|
|
||||||
* initialise:
|
* initialise:
|
||||||
* g_Prj_Config
|
* g_Prj_Config
|
||||||
* g_Prj_Config_LocalFilename
|
* g_Prj_Config_LocalFilename
|
||||||
|
@ -30,111 +27,126 @@ static bool ReCreatePrjConfig( const wxString& local_config_filename,
|
||||||
* true si config locale
|
* true si config locale
|
||||||
* false si default config
|
* false si default config
|
||||||
*/
|
*/
|
||||||
|
bool WinEDA_App::ReCreatePrjConfig( const wxString& fileName,
|
||||||
|
const wxString& GroupName,
|
||||||
|
bool ForceUseLocalConfig )
|
||||||
{
|
{
|
||||||
// free old config
|
wxFileName fn = fileName;
|
||||||
if( g_Prj_Config )
|
wxString defaultFileName;
|
||||||
delete g_Prj_Config;
|
|
||||||
g_Prj_Config = NULL;
|
|
||||||
|
|
||||||
// Init local Config filename
|
// Free old config file.
|
||||||
if( local_config_filename.IsEmpty() )
|
if( m_ProjectConfig )
|
||||||
g_Prj_Config_LocalFilename = wxT( "kicad" );
|
{
|
||||||
else
|
delete m_ProjectConfig;
|
||||||
g_Prj_Config_LocalFilename = local_config_filename;
|
m_ProjectConfig = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
ChangeFileNameExt( g_Prj_Config_LocalFilename, g_Prj_Config_Filename_ext );
|
/* Check just in case the file name does not a kicad project extension. */
|
||||||
|
if( fn.GetExt() != ProjectFileExtension )
|
||||||
|
{
|
||||||
|
wxLogDebug( _( "ReCreatePrjConfig() called with project file <%s> " \
|
||||||
|
"which does not have the correct file extension." ),
|
||||||
|
fn.GetFullPath().c_str() );
|
||||||
|
fn.SetExt( ProjectFileExtension );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Update the library search path list if a new project file is loaded. */
|
||||||
|
if( m_projectFileName != fn )
|
||||||
|
{
|
||||||
|
if( m_libSearchPaths.Index( fn.GetPath() ) != wxNOT_FOUND )
|
||||||
|
m_libSearchPaths.Remove( fn.GetPath() );
|
||||||
|
|
||||||
|
m_libSearchPaths.Insert( fn.GetPath(), 0 );
|
||||||
|
m_projectFileName = fn;
|
||||||
|
}
|
||||||
|
|
||||||
// Init local config filename
|
// Init local config filename
|
||||||
if( ForceUseLocalConfig || wxFileExists( g_Prj_Config_LocalFilename ) )
|
if( ForceUseLocalConfig || fn.FileExists() )
|
||||||
{
|
{
|
||||||
g_Prj_Default_Config_FullFilename.Empty();
|
m_ProjectConfig = new wxFileConfig( wxEmptyString, wxEmptyString,
|
||||||
g_Prj_Config = new wxFileConfig( wxEmptyString,
|
fn.GetFullPath(), wxEmptyString );
|
||||||
wxEmptyString,
|
m_ProjectConfig->DontCreateOnDemand();
|
||||||
g_Prj_Config_LocalFilename,
|
|
||||||
wxEmptyString,
|
|
||||||
wxCONFIG_USE_RELATIVE_PATH );
|
|
||||||
|
|
||||||
g_Prj_Config->DontCreateOnDemand();
|
|
||||||
|
|
||||||
if( ForceUseLocalConfig )
|
if( ForceUseLocalConfig )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Test de la bonne version du fichier (ou groupe) de configuration
|
/* Check the application version against the version saved in the
|
||||||
int version = -1, def_version = 0;
|
* project file.
|
||||||
g_Prj_Config->SetPath( GroupName );
|
*
|
||||||
version = g_Prj_Config->Read( wxT( "version" ), def_version );
|
* TODO: Push the version test up the stack so that when one of the
|
||||||
g_Prj_Config->SetPath( UNIX_STRING_DIR_SEP );
|
* Kicad application version changes, the other applications
|
||||||
|
* settings do not get updated. Practically, this can go away.
|
||||||
|
* It isn't used anywhere as far as I know (WLS).
|
||||||
|
*/
|
||||||
|
int version = -1;
|
||||||
|
int def_version = 0;
|
||||||
|
|
||||||
|
m_ProjectConfig->SetPath( GroupName );
|
||||||
|
version = m_ProjectConfig->Read( wxT( "version" ), def_version );
|
||||||
|
m_ProjectConfig->SetPath( wxCONFIG_PATH_SEPARATOR );
|
||||||
|
|
||||||
if( version > 0 )
|
if( version > 0 )
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
delete g_Prj_Config; // Version incorrecte
|
{
|
||||||
|
delete m_ProjectConfig; // Version incorrecte
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Fichier local non trouve ou invalide
|
defaultFileName = ReturnKicadDatasPath() + wxT( "template/kicad" ) +
|
||||||
g_Prj_Config_LocalFilename.Empty();
|
wxT( "." ) + ProjectFileExtension;
|
||||||
g_Prj_Default_Config_FullFilename =
|
|
||||||
ReturnKicadDatasPath() +
|
|
||||||
wxT( "template/kicad" ) +
|
|
||||||
g_Prj_Config_Filename_ext;
|
|
||||||
|
|
||||||
// Recreate new config
|
// Create new project file using the default name.
|
||||||
g_Prj_Config = new wxFileConfig( wxEmptyString,
|
m_ProjectConfig = new wxFileConfig( wxEmptyString, wxEmptyString,
|
||||||
wxEmptyString,
|
wxEmptyString, defaultFileName );
|
||||||
wxEmptyString,
|
m_ProjectConfig->DontCreateOnDemand();
|
||||||
g_Prj_Default_Config_FullFilename,
|
|
||||||
wxCONFIG_USE_RELATIVE_PATH );
|
|
||||||
|
|
||||||
g_Prj_Config->DontCreateOnDemand();
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************************/
|
/**
|
||||||
void WinEDA_App::WriteProjectConfig( const wxString& local_config_filename,
|
* Function WriteProjectConfig
|
||||||
const wxString& GroupName,
|
|
||||||
PARAM_CFG_BASE** List )
|
|
||||||
/***************************************************************************************/
|
|
||||||
|
|
||||||
/** Function WriteProjectConfig
|
|
||||||
* Save the current "projet" parameters
|
* Save the current "projet" parameters
|
||||||
* saved parameters are parameters that have the .m_Setup member set to false
|
* saved parameters are parameters that have the .m_Setup member set to false
|
||||||
* saving file is the .pro file project
|
* saving file is the .pro file project
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_App::WriteProjectConfig( const wxString& fileName,
|
||||||
|
const wxString& GroupName,
|
||||||
|
PARAM_CFG_BASE** List )
|
||||||
{
|
{
|
||||||
PARAM_CFG_BASE* pt_cfg;
|
PARAM_CFG_BASE* pt_cfg;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
ReCreatePrjConfig( local_config_filename, GroupName,
|
ReCreatePrjConfig( fileName, GroupName, FORCE_LOCAL_CONFIG );
|
||||||
FORCE_LOCAL_CONFIG );
|
|
||||||
|
|
||||||
/* Write date ( surtout pour eviter bug de wxFileConfig
|
/* Write date ( surtout pour eviter bug de wxFileConfig
|
||||||
* qui se trompe de rubrique si declaration [xx] en premiere ligne
|
* qui se trompe de rubrique si declaration [xx] en premiere ligne
|
||||||
* (en fait si groupe vide) */
|
* (en fait si groupe vide) */
|
||||||
g_Prj_Config->SetPath( UNIX_STRING_DIR_SEP );
|
m_ProjectConfig->SetPath( wxCONFIG_PATH_SEPARATOR );
|
||||||
|
|
||||||
msg = DateAndTime();
|
msg = DateAndTime();
|
||||||
|
m_ProjectConfig->Write( wxT( "update" ), msg );
|
||||||
|
|
||||||
g_Prj_Config->Write( wxT( "update" ), msg );
|
|
||||||
msg = GetAppName();
|
msg = GetAppName();
|
||||||
|
m_ProjectConfig->Write( wxT( "last_client" ), msg );
|
||||||
g_Prj_Config->Write( wxT( "last_client" ), msg );
|
|
||||||
|
|
||||||
/* Save parameters */
|
/* Save parameters */
|
||||||
g_Prj_Config->DeleteGroup( GroupName ); // Erase all datas
|
m_ProjectConfig->DeleteGroup( GroupName ); // Erase all datas
|
||||||
g_Prj_Config->Flush();
|
m_ProjectConfig->Flush();
|
||||||
|
|
||||||
g_Prj_Config->SetPath( GroupName );
|
m_ProjectConfig->SetPath( GroupName );
|
||||||
g_Prj_Config->Write( wxT( "version" ), CONFIG_VERSION );
|
m_ProjectConfig->Write( wxT( "version" ), CONFIG_VERSION );
|
||||||
g_Prj_Config->SetPath( UNIX_STRING_DIR_SEP );
|
m_ProjectConfig->SetPath( wxCONFIG_PATH_SEPARATOR );
|
||||||
|
|
||||||
for( ; *List != NULL; List++ )
|
for( ; List != NULL && *List != NULL; List++ )
|
||||||
{
|
{
|
||||||
pt_cfg = *List;
|
pt_cfg = *List;
|
||||||
if( pt_cfg->m_Group )
|
if( pt_cfg->m_Group )
|
||||||
g_Prj_Config->SetPath( pt_cfg->m_Group );
|
m_ProjectConfig->SetPath( pt_cfg->m_Group );
|
||||||
else
|
else
|
||||||
g_Prj_Config->SetPath( GroupName );
|
m_ProjectConfig->SetPath( GroupName );
|
||||||
|
|
||||||
if( pt_cfg->m_Setup )
|
if( pt_cfg->m_Setup )
|
||||||
continue;
|
continue;
|
||||||
|
@ -142,18 +154,17 @@ void WinEDA_App::WriteProjectConfig( const wxString& local_config_filename,
|
||||||
if ( pt_cfg->m_Type == PARAM_COMMAND_ERASE ) // Erase all data
|
if ( pt_cfg->m_Type == PARAM_COMMAND_ERASE ) // Erase all data
|
||||||
{
|
{
|
||||||
if( pt_cfg->m_Ident )
|
if( pt_cfg->m_Ident )
|
||||||
g_Prj_Config->DeleteGroup( pt_cfg->m_Ident );
|
m_ProjectConfig->DeleteGroup( pt_cfg->m_Ident );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pt_cfg->SaveParam( g_Prj_Config );
|
pt_cfg->SaveParam( m_ProjectConfig );
|
||||||
}
|
}
|
||||||
|
|
||||||
g_Prj_Config->SetPath( UNIX_STRING_DIR_SEP );
|
m_ProjectConfig->SetPath( UNIX_STRING_DIR_SEP );
|
||||||
delete g_Prj_Config;
|
delete m_ProjectConfig;
|
||||||
g_Prj_Config = NULL;
|
m_ProjectConfig = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
void WinEDA_App::SaveCurrentSetupValues( PARAM_CFG_BASE** aList )
|
void WinEDA_App::SaveCurrentSetupValues( PARAM_CFG_BASE** aList )
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
|
@ -187,13 +198,6 @@ void WinEDA_App::SaveCurrentSetupValues( PARAM_CFG_BASE** aList )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************************/
|
|
||||||
bool WinEDA_App::ReadProjectConfig( const wxString& local_config_filename,
|
|
||||||
const wxString& GroupName,
|
|
||||||
PARAM_CFG_BASE** List,
|
|
||||||
bool Load_Only_if_New )
|
|
||||||
/***************************************************************************************/
|
|
||||||
|
|
||||||
/** Function ReadProjectConfig
|
/** Function ReadProjectConfig
|
||||||
* Read the current "projet" parameters
|
* Read the current "projet" parameters
|
||||||
* Parameters are parameters that have the .m_Setup member set to false
|
* Parameters are parameters that have the .m_Setup member set to false
|
||||||
|
@ -207,52 +211,53 @@ bool WinEDA_App::ReadProjectConfig( const wxString& local_config_filename,
|
||||||
* wxGetApp().m_CurrentOptionFileDateAndTime
|
* wxGetApp().m_CurrentOptionFileDateAndTime
|
||||||
* wxGetApp().m_CurrentOptionFile
|
* wxGetApp().m_CurrentOptionFile
|
||||||
*/
|
*/
|
||||||
|
bool WinEDA_App::ReadProjectConfig( const wxString& local_config_filename,
|
||||||
|
const wxString& GroupName,
|
||||||
|
PARAM_CFG_BASE** List,
|
||||||
|
bool Load_Only_if_New )
|
||||||
{
|
{
|
||||||
PARAM_CFG_BASE* pt_cfg;
|
PARAM_CFG_BASE* pt_cfg;
|
||||||
wxString timestamp;
|
wxString timestamp;
|
||||||
|
|
||||||
if( List == NULL )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
ReCreatePrjConfig( local_config_filename, GroupName, false );
|
ReCreatePrjConfig( local_config_filename, GroupName, false );
|
||||||
|
|
||||||
g_Prj_Config->SetPath( UNIX_STRING_DIR_SEP );
|
m_ProjectConfig->SetPath( wxCONFIG_PATH_SEPARATOR );
|
||||||
timestamp = g_Prj_Config->Read( wxT( "update" ) );
|
timestamp = m_ProjectConfig->Read( wxT( "update" ) );
|
||||||
if( Load_Only_if_New && ( !timestamp.IsEmpty() )
|
if( Load_Only_if_New && ( !timestamp.IsEmpty() )
|
||||||
&& (timestamp == wxGetApp().m_CurrentOptionFileDateAndTime) )
|
&& (timestamp == m_CurrentOptionFileDateAndTime) )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGetApp().m_CurrentOptionFileDateAndTime = timestamp;
|
m_CurrentOptionFileDateAndTime = timestamp;
|
||||||
|
|
||||||
if( !g_Prj_Default_Config_FullFilename.IsEmpty() )
|
if( !g_Prj_Default_Config_FullFilename.IsEmpty() )
|
||||||
wxGetApp().m_CurrentOptionFile = g_Prj_Default_Config_FullFilename;
|
m_CurrentOptionFile = g_Prj_Default_Config_FullFilename;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( wxPathOnly( g_Prj_Config_LocalFilename ).IsEmpty() )
|
if( wxPathOnly( g_Prj_Config_LocalFilename ).IsEmpty() )
|
||||||
wxGetApp().m_CurrentOptionFile =
|
m_CurrentOptionFile = wxGetCwd() + STRING_DIR_SEP +
|
||||||
wxGetCwd() + STRING_DIR_SEP + g_Prj_Config_LocalFilename;
|
g_Prj_Config_LocalFilename;
|
||||||
else
|
else
|
||||||
wxGetApp().m_CurrentOptionFile = g_Prj_Config_LocalFilename;
|
m_CurrentOptionFile = g_Prj_Config_LocalFilename;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( ; *List != NULL; List++ )
|
for( ; List != NULL && *List != NULL; List++ )
|
||||||
{
|
{
|
||||||
pt_cfg = *List;
|
pt_cfg = *List;
|
||||||
if( pt_cfg->m_Group )
|
if( pt_cfg->m_Group )
|
||||||
g_Prj_Config->SetPath( pt_cfg->m_Group );
|
m_ProjectConfig->SetPath( pt_cfg->m_Group );
|
||||||
else
|
else
|
||||||
g_Prj_Config->SetPath( GroupName );
|
m_ProjectConfig->SetPath( GroupName );
|
||||||
|
|
||||||
if( pt_cfg->m_Setup )
|
if( pt_cfg->m_Setup )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pt_cfg->ReadParam( g_Prj_Config );
|
pt_cfg->ReadParam( m_ProjectConfig );
|
||||||
}
|
}
|
||||||
|
|
||||||
delete g_Prj_Config;
|
delete m_ProjectConfig;
|
||||||
g_Prj_Config = NULL;
|
m_ProjectConfig = NULL;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -441,7 +446,7 @@ void PARAM_CFG_DOUBLE::ReadParam( wxConfigBase* aConfig )
|
||||||
return;
|
return;
|
||||||
double ftmp = 0;
|
double ftmp = 0;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg = g_Prj_Config->Read( m_Ident, wxT( "" ) );
|
msg = aConfig->Read( m_Ident, wxT( "" ) );
|
||||||
|
|
||||||
if( msg.IsEmpty() )
|
if( msg.IsEmpty() )
|
||||||
ftmp = m_Default;
|
ftmp = m_Default;
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
/****************************************************/
|
||||||
|
/* class_drawpickedstruct.cpp */
|
||||||
|
/****************************************************/
|
||||||
|
|
||||||
|
#include "fctsys.h"
|
||||||
|
#include "common.h"
|
||||||
|
#include "gr_basic.h"
|
||||||
|
#include "base_struct.h"
|
||||||
|
#include "sch_item_struct.h"
|
||||||
|
#include "class_sch_screen.h"
|
||||||
|
#include "class_drawpanel.h"
|
||||||
|
#include "wxEeschemaStruct.h"
|
||||||
|
|
||||||
|
#include "program.h"
|
||||||
|
#include "general.h"
|
||||||
|
#include "libcmp.h"
|
||||||
|
#include "protos.h"
|
||||||
|
|
||||||
|
/* Constructor and destructor for SCH_ITEM */
|
||||||
|
/* They are not inline because this creates problems with gcc at linking time
|
||||||
|
* in debug mode
|
||||||
|
*/
|
||||||
|
|
||||||
|
SCH_ITEM::SCH_ITEM( EDA_BaseStruct* aParent, KICAD_T aType ) :
|
||||||
|
EDA_BaseStruct( aParent, aType )
|
||||||
|
{
|
||||||
|
m_Layer = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
SCH_ITEM::~SCH_ITEM()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* place the struct in EEDrawList.
|
||||||
|
* if it is a new item, it it also put in undo list
|
||||||
|
* for an "old" item, saving it in undo list must be done before editiing,
|
||||||
|
* and not here!
|
||||||
|
*/
|
||||||
|
void SCH_ITEM::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
|
||||||
|
{
|
||||||
|
if( m_Flags & IS_NEW )
|
||||||
|
{
|
||||||
|
SCH_SCREEN* screen = frame->GetScreen();
|
||||||
|
if( !screen->CheckIfOnDrawList( this ) ) //don't want a loop!
|
||||||
|
screen->AddToDrawList( this );
|
||||||
|
g_ItemToRepeat = this;
|
||||||
|
frame->SaveCopyInUndoList( this, IS_NEW );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Flags = 0;
|
||||||
|
frame->GetScreen()->SetModify();
|
||||||
|
frame->GetScreen()->SetCurItem( NULL );
|
||||||
|
frame->DrawPanel->ManageCurseur = NULL;
|
||||||
|
frame->DrawPanel->ForceCloseManageCurseur = NULL;
|
||||||
|
|
||||||
|
if( DC )
|
||||||
|
{
|
||||||
|
frame->DrawPanel->CursorOff( DC ); // Erase schematic cursor
|
||||||
|
RedrawOneStruct( frame->DrawPanel, DC, this, GR_DEFAULT_DRAWMODE );
|
||||||
|
frame->DrawPanel->CursorOn( DC ); // Display schematic cursor
|
||||||
|
}
|
||||||
|
}
|
|
@ -213,7 +213,7 @@ int ArcTangente( int dy, int dx )
|
||||||
}
|
}
|
||||||
|
|
||||||
fangle = atan2( (double) dy, (double) dx ) / M_PI * 1800;
|
fangle = atan2( (double) dy, (double) dx ) / M_PI * 1800;
|
||||||
return (int) round( fangle );
|
return wxRound( fangle );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -265,8 +265,8 @@ void RotatePoint( int* pX, int* pY, int angle )
|
||||||
fpx = (*pY * fsinus[angle]) + (*pX * fcosinus[angle]);
|
fpx = (*pY * fsinus[angle]) + (*pX * fcosinus[angle]);
|
||||||
fpy = (*pY * fcosinus[angle]) - (*pX * fsinus[angle]);
|
fpy = (*pY * fcosinus[angle]) - (*pX * fsinus[angle]);
|
||||||
|
|
||||||
*pX = (int) round( fpx );
|
*pX = wxRound( fpx );
|
||||||
*pY = (int) round( fpy );
|
*pY = wxRound( fpy );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1278
common/worksheet.cpp
1278
common/worksheet.cpp
File diff suppressed because it is too large
Load Diff
|
@ -51,11 +51,11 @@ void WinEDA_DrawFrame::PutOnGrid( wxPoint* coord )
|
||||||
|
|
||||||
if( !GetBaseScreen()->m_UserGridIsON )
|
if( !GetBaseScreen()->m_UserGridIsON )
|
||||||
{
|
{
|
||||||
int tmp = (int) round( coord->x / grid_size.x );
|
int tmp = wxRound( coord->x / grid_size.x );
|
||||||
coord->x = (int) round( tmp * grid_size.x );
|
coord->x = wxRound( tmp * grid_size.x );
|
||||||
|
|
||||||
tmp = (int) round( coord->y / grid_size.y );
|
tmp = wxRound( coord->y / grid_size.y );
|
||||||
coord->y = (int) round ( tmp * grid_size.y );
|
coord->y = wxRound ( tmp * grid_size.y );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ void WinEDA_DrawFrame::OnZoom( wxCommandEvent& event )
|
||||||
Recadre_Trace( true );
|
Recadre_Trace( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
Affiche_Status_Box();
|
UpdateStatusBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinEDA_DrawPanel::OnPopupGridSelect( wxCommandEvent& event )
|
void WinEDA_DrawPanel::OnPopupGridSelect( wxCommandEvent& event )
|
||||||
|
|
|
@ -29,15 +29,15 @@ set(CVPCB_SRCS
|
||||||
writenetlistpcbnew.cpp)
|
writenetlistpcbnew.cpp)
|
||||||
|
|
||||||
set(CVPCB_EXTRA_SRCS
|
set(CVPCB_EXTRA_SRCS
|
||||||
../pcbnew/class_board_item.cpp
|
# ../pcbnew/class_board_item.cpp
|
||||||
../pcbnew/class_drawsegment.cpp
|
# ../pcbnew/class_drawsegment.cpp
|
||||||
../pcbnew/class_edge_mod.cpp
|
# ../pcbnew/class_edge_mod.cpp
|
||||||
../pcbnew/class_equipot.cpp
|
# ../pcbnew/class_equipot.cpp
|
||||||
../pcbnew/class_module.cpp
|
# ../pcbnew/class_module.cpp
|
||||||
../pcbnew/class_text_mod.cpp
|
# ../pcbnew/class_text_mod.cpp
|
||||||
../pcbnew/class_track.cpp
|
|
||||||
../pcbnew/ioascii.cpp
|
../pcbnew/ioascii.cpp
|
||||||
../pcbnew/tracemod.cpp)
|
# ../pcbnew/tracemod.cpp
|
||||||
|
)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
if(MINGW)
|
if(MINGW)
|
||||||
|
@ -59,7 +59,7 @@ endif(APPLE)
|
||||||
|
|
||||||
add_executable(cvpcb WIN32 MACOSX_BUNDLE ${CVPCB_SRCS} ${CVPCB_EXTRA_SRCS} ${CVPCB_RESOURCES})
|
add_executable(cvpcb WIN32 MACOSX_BUNDLE ${CVPCB_SRCS} ${CVPCB_EXTRA_SRCS} ${CVPCB_RESOURCES})
|
||||||
|
|
||||||
target_link_libraries(cvpcb 3d-viewer common polygon bitmaps kbool ${OPENGL_LIBRARIES} ${wxWidgets_LIBRARIES})
|
target_link_libraries(cvpcb 3d-viewer common pcbcommon polygon bitmaps kbool ${OPENGL_LIBRARIES} ${wxWidgets_LIBRARIES})
|
||||||
|
|
||||||
install(TARGETS cvpcb
|
install(TARGETS cvpcb
|
||||||
DESTINATION ${KICAD_BIN}
|
DESTINATION ${KICAD_BIN}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/**********************/
|
/**********************/
|
||||||
/* CVPCB: autosel.cpp */
|
/* CVPCB: autosel.cpp */
|
||||||
/**********************/
|
/**********************/
|
||||||
|
|
||||||
/* Routines de selection automatique des modules */
|
/* Routines de selection automatique des modules */
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "confirm.h"
|
#include "confirm.h"
|
||||||
#include "gestfich.h"
|
#include "gestfich.h"
|
||||||
|
#include "appl_wxstruct.h"
|
||||||
|
|
||||||
#include "cvpcb.h"
|
#include "cvpcb.h"
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
@ -18,155 +19,184 @@
|
||||||
class AUTOMODULE
|
class AUTOMODULE
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int m_Type;
|
int m_Type;
|
||||||
AUTOMODULE * Pnext;
|
AUTOMODULE* Pnext;
|
||||||
wxString m_Name;
|
wxString m_Name;
|
||||||
wxString m_LibName;
|
wxString m_LibName;
|
||||||
wxString m_Library;
|
wxString m_Library;
|
||||||
|
|
||||||
AUTOMODULE() { m_Type = 0; Pnext = NULL; }
|
AUTOMODULE() { m_Type = 0; Pnext = NULL; }
|
||||||
} ;
|
};
|
||||||
|
|
||||||
|
|
||||||
/* routines locales : */
|
/* routines locales : */
|
||||||
static int auto_select(WinEDA_CvpcbFrame * frame, STORECMP * Cmp, AUTOMODULE * BaseListeMod);
|
static int auto_select( WinEDA_CvpcbFrame* frame,
|
||||||
static void auto_associe(WinEDA_CvpcbFrame * frame);
|
STORECMP* Cmp,
|
||||||
|
AUTOMODULE* BaseListeMod );
|
||||||
|
static void auto_associe( WinEDA_CvpcbFrame* frame );
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************/
|
|
||||||
void WinEDA_CvpcbFrame::AssocieModule(wxCommandEvent& event)
|
|
||||||
/*************************************************************/
|
/*************************************************************/
|
||||||
|
void WinEDA_CvpcbFrame::AssocieModule( wxCommandEvent& event )
|
||||||
|
/*************************************************************/
|
||||||
|
|
||||||
/* Fonction liee au boutton "Auto"
|
/* Fonction liee au boutton "Auto"
|
||||||
Lance l'association automatique modules/composants
|
* Lance l'association automatique modules/composants
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
auto_associe(this);
|
auto_associe( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
static void auto_associe(WinEDA_CvpcbFrame * frame)
|
static void auto_associe( WinEDA_CvpcbFrame* frame )
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
{
|
{
|
||||||
unsigned ii, j, k;
|
wxFileName fn;
|
||||||
wxString EquivFileName, msg;
|
unsigned ii, j, k;
|
||||||
char Line[1024];
|
wxString msg, tmp;
|
||||||
FILE *fichierstf ; /* sert en lecture des differents fichiers *.STF */
|
char Line[1024];
|
||||||
AUTOMODULE * ItemModule,* NextMod;
|
FILE* file;
|
||||||
AUTOMODULE * BaseListeMod = NULL;
|
AUTOMODULE* ItemModule, * NextMod;
|
||||||
STORECMP * Component;
|
AUTOMODULE* BaseListeMod = NULL;
|
||||||
|
STORECMP* Component;
|
||||||
|
int nb_correspondances = 0;
|
||||||
|
|
||||||
int nb_correspondances = 0;
|
if( nbcomp <= 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
if( nbcomp <= 0 ) return;
|
/* recherche des equivalences a travers les fichiers possibles */
|
||||||
|
for( ii = 0; ii < g_ListName_Equ.GetCount(); ii++ )
|
||||||
|
{
|
||||||
|
fn = g_ListName_Equ[ii];
|
||||||
|
fn.SetExt( EquivFileExtension );
|
||||||
|
|
||||||
/* recherche des equivalences a travers les fichiers possibles */
|
tmp = wxGetApp().GetLibraryPathList().FindValidPath( fn.GetFullName() );
|
||||||
for( ii= 0 ; ii < g_ListName_Equ.GetCount(); ii++)
|
|
||||||
{
|
|
||||||
/* Calcul du nom complet avec son chemin */
|
|
||||||
EquivFileName = MakeFileName(g_RealLibDirBuffer,g_ListName_Equ[ii],g_EquivExtBuffer);
|
|
||||||
|
|
||||||
if ( (fichierstf = wxFopen(EquivFileName, wxT("rt"))) == 0)
|
if( !tmp )
|
||||||
{
|
{
|
||||||
msg.Printf( _("Library: <%s> not found"),EquivFileName.GetData());
|
msg.Printf( _( "Footprint alias library file <%s> could not be " \
|
||||||
DisplayError(frame, msg,10);
|
"found in the default search paths." ),
|
||||||
continue ;
|
fn.GetFullName().c_str() );
|
||||||
}
|
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* lecture fichier n */
|
file = wxFopen( tmp, wxT( "rt" ) );
|
||||||
while ( fgets(Line,79,fichierstf) != 0 )
|
|
||||||
{
|
|
||||||
/* elimination des lignes vides */
|
|
||||||
for (j = 0 ; j < 40 ; j++ )
|
|
||||||
{
|
|
||||||
if (Line[j] == 0 ) goto fin_de_while ;
|
|
||||||
if (Line[j] == QUOTE ) break ;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemModule = new AUTOMODULE();
|
if( file == NULL )
|
||||||
ItemModule->Pnext = BaseListeMod;
|
{
|
||||||
BaseListeMod = ItemModule;
|
msg.Printf( _( "Error opening alias library <%s>." ), tmp.c_str() );
|
||||||
|
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* stockage du composant ( 'namecmp' 'namelib')
|
/* lecture fichier n */
|
||||||
name et namelib */
|
while( fgets( Line, 79, file ) != 0 )
|
||||||
for ( j++ ; j < 40 ; j++, k++)
|
{
|
||||||
{
|
/* elimination des lignes vides */
|
||||||
if ( Line[j] == QUOTE) break ;
|
for( j = 0; j < 40; j++ )
|
||||||
ItemModule->m_Name.Append(Line[j]);
|
{
|
||||||
}
|
if( Line[j] == 0 )
|
||||||
j++ ;
|
goto fin_de_while;
|
||||||
for ( ; j < 80 ; ) if (Line[j++] == QUOTE) break ;
|
if( Line[j] == QUOTE )
|
||||||
for (; ; j++)
|
break;
|
||||||
{
|
}
|
||||||
if (Line[j] == QUOTE) break ;
|
|
||||||
ItemModule->m_LibName.Append(Line[j]);
|
|
||||||
}
|
|
||||||
nb_correspondances++ ;
|
|
||||||
fin_de_while:;
|
|
||||||
}
|
|
||||||
fclose(fichierstf) ;
|
|
||||||
|
|
||||||
/* Affichage Statistiques */
|
ItemModule = new AUTOMODULE();
|
||||||
msg.Printf(_("%d equivalences"),nb_correspondances);
|
ItemModule->Pnext = BaseListeMod;
|
||||||
frame->SetStatusText(msg, 0);
|
BaseListeMod = ItemModule;
|
||||||
}
|
|
||||||
|
|
||||||
Component = g_BaseListeCmp;
|
/* stockage du composant ( 'namecmp' 'namelib')
|
||||||
for ( ii = 0; Component != NULL; Component = Component->Pnext, ii++ )
|
* name et namelib */
|
||||||
{
|
for( j++; j < 40; j++, k++ )
|
||||||
frame->m_ListCmp->SetSelection(ii,TRUE);
|
{
|
||||||
if( Component->m_Module.IsEmpty() )
|
if( Line[j] == QUOTE )
|
||||||
auto_select(frame, Component, BaseListeMod);
|
break;
|
||||||
}
|
ItemModule->m_Name.Append( Line[j] );
|
||||||
|
}
|
||||||
|
|
||||||
/* Liberation memoire */
|
j++;
|
||||||
for( ItemModule = BaseListeMod; ItemModule != NULL; ItemModule = NextMod)
|
for( ; j < 80; )
|
||||||
{
|
if( Line[j++] == QUOTE )
|
||||||
NextMod = ItemModule->Pnext; delete ItemModule;
|
break;
|
||||||
}
|
|
||||||
BaseListeMod = NULL;
|
for( ; ; j++ )
|
||||||
|
{
|
||||||
|
if( Line[j] == QUOTE )
|
||||||
|
break;
|
||||||
|
ItemModule->m_LibName.Append( Line[j] );
|
||||||
|
}
|
||||||
|
|
||||||
|
nb_correspondances++;
|
||||||
|
fin_de_while:;
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose( file );
|
||||||
|
|
||||||
|
/* Affichage Statistiques */
|
||||||
|
msg.Printf( _( "%d equivalences" ), nb_correspondances );
|
||||||
|
frame->SetStatusText( msg, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
Component = g_BaseListeCmp;
|
||||||
|
for( ii = 0; Component != NULL; Component = Component->Pnext, ii++ )
|
||||||
|
{
|
||||||
|
frame->m_ListCmp->SetSelection( ii, TRUE );
|
||||||
|
if( Component->m_Module.IsEmpty() )
|
||||||
|
auto_select( frame, Component, BaseListeMod );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Liberation memoire */
|
||||||
|
for( ItemModule = BaseListeMod; ItemModule != NULL; ItemModule = NextMod )
|
||||||
|
{
|
||||||
|
NextMod = ItemModule->Pnext; delete ItemModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseListeMod = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
static int auto_select(WinEDA_CvpcbFrame * frame, STORECMP * Cmp,
|
static int auto_select( WinEDA_CvpcbFrame* frame, STORECMP* Cmp,
|
||||||
AUTOMODULE * BaseListeMod)
|
AUTOMODULE* BaseListeMod )
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
|
|
||||||
/* associe automatiquement composant et Module
|
/* associe automatiquement composant et Module
|
||||||
Retourne;
|
* Retourne;
|
||||||
0 si OK
|
* 0 si OK
|
||||||
1 si module specifie non trouve en liste librairie
|
* 1 si module specifie non trouve en liste librairie
|
||||||
2 si pas de module specifie dans la liste des equivalences
|
* 2 si pas de module specifie dans la liste des equivalences
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
AUTOMODULE * ItemModule;
|
AUTOMODULE* ItemModule;
|
||||||
STOREMOD * Module;
|
STOREMOD* Module;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
/* examen de la liste des correspondances */
|
/* examen de la liste des correspondances */
|
||||||
ItemModule = BaseListeMod;
|
ItemModule = BaseListeMod;
|
||||||
for ( ; ItemModule != NULL; ItemModule = ItemModule->Pnext )
|
for( ; ItemModule != NULL; ItemModule = ItemModule->Pnext )
|
||||||
{
|
{
|
||||||
if ( ItemModule->m_Name.CmpNoCase(Cmp->m_Valeur) != 0) continue;
|
if( ItemModule->m_Name.CmpNoCase( Cmp->m_Valeur ) != 0 )
|
||||||
|
continue;
|
||||||
|
|
||||||
/* Correspondance trouvee, recherche nom module dans la liste des
|
/* Correspondance trouvee, recherche nom module dans la liste des
|
||||||
modules disponibles en librairie */
|
* modules disponibles en librairie */
|
||||||
Module= g_BaseListePkg;
|
Module = g_BaseListePkg;
|
||||||
for ( ;Module != NULL; Module = Module->Pnext )
|
for( ; Module != NULL; Module = Module->Pnext )
|
||||||
{
|
{
|
||||||
|
if( ItemModule->m_LibName.CmpNoCase( Module->m_Module ) == 0 )
|
||||||
|
{
|
||||||
|
frame->SetNewPkg( Module->m_Module );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( ItemModule->m_LibName.CmpNoCase(Module->m_Module) == 0 )
|
msg.Printf( _( "Component %s: Footprint %s not found in libraries" ),
|
||||||
{ /* empreinte trouv‚e */
|
Cmp->m_Valeur.GetData(), ItemModule->m_LibName.GetData() );
|
||||||
frame->SetNewPkg(Module->m_Module);
|
DisplayError( frame, msg, 10 );
|
||||||
return(0);
|
return 2;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
msg.Printf(
|
return 1;
|
||||||
_("Component %s: Footprint %s not found in libraries"),
|
|
||||||
Cmp->m_Valeur.GetData(), ItemModule->m_LibName.GetData());
|
|
||||||
DisplayError(frame, msg, 10);
|
|
||||||
return( 2 );
|
|
||||||
}
|
|
||||||
return(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,20 +30,35 @@ void Read_Config( const wxString& FileName )
|
||||||
* le chemin de l'executable cvpcb.exe doit etre dans BinDir
|
* le chemin de l'executable cvpcb.exe doit etre dans BinDir
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxString FullFileName = FileName;
|
wxFileName fn = FileName;
|
||||||
|
|
||||||
/* Init des valeurs par defaut */
|
/* Init des valeurs par defaut */
|
||||||
g_LibName_List.Clear();
|
g_LibName_List.Clear();
|
||||||
g_ListName_Equ.Clear();
|
g_ListName_Equ.Clear();
|
||||||
|
|
||||||
wxGetApp().ReadProjectConfig( FullFileName,
|
if( fn.GetExt() != ProjectFileExtension )
|
||||||
|
fn.SetExt( ProjectFileExtension );
|
||||||
|
|
||||||
|
if( wxGetApp().GetLibraryPathList().Index( g_UserLibDirBuffer ) != wxNOT_FOUND )
|
||||||
|
{
|
||||||
|
wxLogDebug( wxT( "Removing path <%s> to library path search list." ),
|
||||||
|
g_UserLibDirBuffer.c_str() );
|
||||||
|
wxGetApp().GetLibraryPathList().Remove( g_UserLibDirBuffer );
|
||||||
|
}
|
||||||
|
|
||||||
|
wxGetApp().ReadProjectConfig( fn.GetFullPath(),
|
||||||
GROUP, ParamCfgList, FALSE );
|
GROUP, ParamCfgList, FALSE );
|
||||||
|
|
||||||
if( NetInExtBuffer.IsEmpty() )
|
if( g_NetlistFileExtension.IsEmpty() )
|
||||||
NetInExtBuffer = wxT( ".net" );
|
g_NetlistFileExtension = wxT( "net" );
|
||||||
|
|
||||||
/* Inits autres variables */
|
if( wxFileName::DirExists( g_UserLibDirBuffer )
|
||||||
SetRealLibraryPath( wxT( "modules" ) );
|
&& wxGetApp().GetLibraryPathList().Index( g_UserLibDirBuffer ) == wxNOT_FOUND )
|
||||||
|
{
|
||||||
|
wxLogDebug( wxT( "Adding path <%s> to library path search list." ),
|
||||||
|
g_UserLibDirBuffer.c_str() );
|
||||||
|
wxGetApp().GetLibraryPathList().Add( g_UserLibDirBuffer );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,36 +70,22 @@ void WinEDA_CvpcbFrame::Update_Config( wxCommandEvent& event )
|
||||||
* la vraie fonction de sauvegarde de la config
|
* la vraie fonction de sauvegarde de la config
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
Save_Config( this );
|
Save_Config( this, m_NetlistFileName.GetFullPath() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************/
|
void Save_Config( wxWindow* parent, const wxString& fileName )
|
||||||
void Save_Config( wxWindow* parent )
|
|
||||||
/************************************/
|
|
||||||
/* enregistrement de la config */
|
|
||||||
{
|
{
|
||||||
wxString path, FullFileName;
|
wxFileName fn = fileName;
|
||||||
|
|
||||||
wxString mask( wxT( "*" ) );
|
fn.SetExt( ProjectFileExtension );
|
||||||
|
|
||||||
FullFileName = FFileName;
|
wxFileDialog dlg( parent, _( "Save Project File" ), fn.GetPath(),
|
||||||
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
|
fn.GetFullName(), ProjectFileWildcard, wxFD_SAVE );
|
||||||
|
|
||||||
path = wxGetCwd();
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
FullFileName = EDA_FileSelector( _( "Save preferences" ),
|
|
||||||
path, /* Chemin par defaut */
|
|
||||||
FullFileName, /* nom fichier par defaut */
|
|
||||||
g_Prj_Config_Filename_ext, /* extension par defaut */
|
|
||||||
mask, /* Masque d'affichage */
|
|
||||||
parent,
|
|
||||||
wxFD_SAVE,
|
|
||||||
TRUE
|
|
||||||
);
|
|
||||||
|
|
||||||
if( FullFileName.IsEmpty() )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* ecriture de la configuration */
|
/* ecriture de la configuration */
|
||||||
wxGetApp().WriteProjectConfig( FullFileName, GROUP, ParamCfgList );
|
wxGetApp().WriteProjectConfig( dlg.GetPath(), GROUP, ParamCfgList );
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
/** cfg.h : configuration: definition des structures **/
|
/** cfg.h : configuration: definition des structures **/
|
||||||
/*******************************************************/
|
/*******************************************************/
|
||||||
|
|
||||||
#ifndef eda_global
|
|
||||||
#define eda_global extern
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "param_config.h"
|
#include "param_config.h"
|
||||||
|
|
||||||
#define INSETUP TRUE
|
#define INSETUP TRUE
|
||||||
|
@ -40,7 +36,7 @@ static PARAM_CFG_LIBNAME_LIST EquivNameBufCfg
|
||||||
static PARAM_CFG_WXSTRING NetInExtBufCfg
|
static PARAM_CFG_WXSTRING NetInExtBufCfg
|
||||||
(
|
(
|
||||||
wxT("NetIExt"), /* identification */
|
wxT("NetIExt"), /* identification */
|
||||||
&NetInExtBuffer
|
&g_NetlistFileExtension
|
||||||
);
|
);
|
||||||
|
|
||||||
static PARAM_CFG_WXSTRING NetDirBufCfg
|
static PARAM_CFG_WXSTRING NetDirBufCfg
|
||||||
|
|
|
@ -23,104 +23,6 @@
|
||||||
#define FRAME_MIN_SIZE_X 450
|
#define FRAME_MIN_SIZE_X 450
|
||||||
#define FRAME_MIN_SIZE_Y 300
|
#define FRAME_MIN_SIZE_Y 300
|
||||||
|
|
||||||
/*******************************************************/
|
|
||||||
/* Constructeur de WinEDA_CvpcbFrame: la fenetre generale */
|
|
||||||
/*******************************************************/
|
|
||||||
WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title, long style ) :
|
|
||||||
WinEDA_BasicFrame( NULL, CVPCB_FRAME, title, wxDefaultPosition,
|
|
||||||
wxDefaultSize, style )
|
|
||||||
{
|
|
||||||
m_FrameName = wxT( "CvpcbFrame" );
|
|
||||||
|
|
||||||
//m_AboutTitle = g_CvpcbAboutTitle;
|
|
||||||
m_ListCmp = NULL;
|
|
||||||
m_FootprintList = NULL;
|
|
||||||
DrawFrame = NULL;
|
|
||||||
m_HToolBar = NULL;
|
|
||||||
|
|
||||||
// Give an icon
|
|
||||||
#ifdef __WINDOWS__
|
|
||||||
SetIcon( wxICON( a_icon_cvpcb ) );
|
|
||||||
#else
|
|
||||||
SetIcon( wxICON( icon_cvpcb ) );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SetFont( *g_StdFont );
|
|
||||||
|
|
||||||
SetAutoLayout( TRUE );
|
|
||||||
|
|
||||||
GetSettings();
|
|
||||||
if( m_FrameSize.x < FRAME_MIN_SIZE_X )
|
|
||||||
m_FrameSize.x = FRAME_MIN_SIZE_X;
|
|
||||||
if( m_FrameSize.y < FRAME_MIN_SIZE_Y )
|
|
||||||
m_FrameSize.y = FRAME_MIN_SIZE_Y;
|
|
||||||
|
|
||||||
// create the status bar
|
|
||||||
int dims[3] = { -1, -1, 250 };
|
|
||||||
CreateStatusBar( 3 );
|
|
||||||
SetStatusWidths( 3, dims );
|
|
||||||
ReCreateMenuBar();
|
|
||||||
ReCreateHToolbar();
|
|
||||||
|
|
||||||
// Creation des listes de modules disponibles et des composants du schema
|
|
||||||
// Create child subwindows.
|
|
||||||
BuildCmpListBox();
|
|
||||||
BuildFootprintListBox();
|
|
||||||
|
|
||||||
/* Creation des contraintes de dimension de la fenetre d'affichage des composants
|
|
||||||
* du schema */
|
|
||||||
wxLayoutConstraints* linkpos = new wxLayoutConstraints;
|
|
||||||
linkpos->top.SameAs( this, wxTop );
|
|
||||||
linkpos->bottom.SameAs( this, wxBottom );
|
|
||||||
linkpos->left.SameAs( this, wxLeft );
|
|
||||||
linkpos->width.PercentOf( this, wxWidth, 66 );
|
|
||||||
if( m_ListCmp )
|
|
||||||
m_ListCmp->SetConstraints( linkpos );
|
|
||||||
|
|
||||||
/* Creation des contraintes de dimension de la fenetre d'affichage des modules
|
|
||||||
* de la librairie */
|
|
||||||
linkpos = new wxLayoutConstraints;
|
|
||||||
linkpos->top.SameAs( m_ListCmp, wxTop );
|
|
||||||
linkpos->bottom.SameAs( m_ListCmp, wxBottom );
|
|
||||||
linkpos->right.SameAs( this, wxRight );
|
|
||||||
linkpos->left.SameAs( m_ListCmp, wxRight );
|
|
||||||
if( m_FootprintList )
|
|
||||||
m_FootprintList->SetConstraints( linkpos );
|
|
||||||
|
|
||||||
// Set minimal frame width and height
|
|
||||||
SetSizeHints( FRAME_MIN_SIZE_X,
|
|
||||||
FRAME_MIN_SIZE_Y, -1, -1, -1, -1 );
|
|
||||||
|
|
||||||
// Framesize and position
|
|
||||||
SetSize( m_FramePos.x,
|
|
||||||
m_FramePos.y,
|
|
||||||
m_FrameSize.x,
|
|
||||||
m_FrameSize.y );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************/
|
|
||||||
WinEDA_CvpcbFrame::~WinEDA_CvpcbFrame()
|
|
||||||
/******************************************/
|
|
||||||
{
|
|
||||||
wxConfig* config = wxGetApp().m_EDA_Config;
|
|
||||||
|
|
||||||
if( config )
|
|
||||||
{
|
|
||||||
int state = m_HToolBar->GetToolState(
|
|
||||||
ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST );
|
|
||||||
config->Write( wxT( FILTERFOOTPRINTKEY ), state );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/************************************************/
|
|
||||||
void WinEDA_CvpcbFrame::OnSize( wxSizeEvent& event )
|
|
||||||
/************************************************/
|
|
||||||
{
|
|
||||||
event.Skip();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************/
|
/*************************************/
|
||||||
/* Event table for WinEDA_CvpcbFrame */
|
/* Event table for WinEDA_CvpcbFrame */
|
||||||
|
@ -194,6 +96,98 @@ BEGIN_EVENT_TABLE( WinEDA_CvpcbFrame, wxFrame )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************/
|
||||||
|
/* Constructeur de WinEDA_CvpcbFrame: la fenetre generale */
|
||||||
|
/*******************************************************/
|
||||||
|
WinEDA_CvpcbFrame::WinEDA_CvpcbFrame( const wxString& title, long style ) :
|
||||||
|
WinEDA_BasicFrame( NULL, CVPCB_FRAME, title, wxDefaultPosition,
|
||||||
|
wxDefaultSize, style )
|
||||||
|
{
|
||||||
|
m_FrameName = wxT( "CvpcbFrame" );
|
||||||
|
|
||||||
|
m_ListCmp = NULL;
|
||||||
|
m_FootprintList = NULL;
|
||||||
|
DrawFrame = NULL;
|
||||||
|
m_HToolBar = NULL;
|
||||||
|
|
||||||
|
// Give an icon
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
SetIcon( wxICON( a_icon_cvpcb ) );
|
||||||
|
#else
|
||||||
|
SetIcon( wxICON( icon_cvpcb ) );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
SetAutoLayout( TRUE );
|
||||||
|
|
||||||
|
LoadSettings();
|
||||||
|
if( m_FrameSize.x < FRAME_MIN_SIZE_X )
|
||||||
|
m_FrameSize.x = FRAME_MIN_SIZE_X;
|
||||||
|
if( m_FrameSize.y < FRAME_MIN_SIZE_Y )
|
||||||
|
m_FrameSize.y = FRAME_MIN_SIZE_Y;
|
||||||
|
|
||||||
|
// create the status bar
|
||||||
|
int dims[3] = { -1, -1, 250 };
|
||||||
|
CreateStatusBar( 3 );
|
||||||
|
SetStatusWidths( 3, dims );
|
||||||
|
ReCreateMenuBar();
|
||||||
|
ReCreateHToolbar();
|
||||||
|
|
||||||
|
// Creation des listes de modules disponibles et des composants du schema
|
||||||
|
// Create child subwindows.
|
||||||
|
BuildCmpListBox();
|
||||||
|
BuildFootprintListBox();
|
||||||
|
|
||||||
|
/* Creation des contraintes de dimension de la fenetre d'affichage des composants
|
||||||
|
* du schema */
|
||||||
|
wxLayoutConstraints* linkpos = new wxLayoutConstraints;
|
||||||
|
linkpos->top.SameAs( this, wxTop );
|
||||||
|
linkpos->bottom.SameAs( this, wxBottom );
|
||||||
|
linkpos->left.SameAs( this, wxLeft );
|
||||||
|
linkpos->width.PercentOf( this, wxWidth, 66 );
|
||||||
|
if( m_ListCmp )
|
||||||
|
m_ListCmp->SetConstraints( linkpos );
|
||||||
|
|
||||||
|
/* Creation des contraintes de dimension de la fenetre d'affichage des modules
|
||||||
|
* de la librairie */
|
||||||
|
linkpos = new wxLayoutConstraints;
|
||||||
|
linkpos->top.SameAs( m_ListCmp, wxTop );
|
||||||
|
linkpos->bottom.SameAs( m_ListCmp, wxBottom );
|
||||||
|
linkpos->right.SameAs( this, wxRight );
|
||||||
|
linkpos->left.SameAs( m_ListCmp, wxRight );
|
||||||
|
if( m_FootprintList )
|
||||||
|
m_FootprintList->SetConstraints( linkpos );
|
||||||
|
|
||||||
|
// Set minimal frame width and height
|
||||||
|
SetSizeHints( FRAME_MIN_SIZE_X, FRAME_MIN_SIZE_Y, -1, -1, -1, -1 );
|
||||||
|
|
||||||
|
// Framesize and position
|
||||||
|
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************/
|
||||||
|
WinEDA_CvpcbFrame::~WinEDA_CvpcbFrame()
|
||||||
|
/******************************************/
|
||||||
|
{
|
||||||
|
wxConfig* config = wxGetApp().m_EDA_Config;
|
||||||
|
|
||||||
|
if( config )
|
||||||
|
{
|
||||||
|
int state = m_HToolBar->GetToolState(
|
||||||
|
ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST );
|
||||||
|
config->Write( wxT( FILTERFOOTPRINTKEY ), state );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/************************************************/
|
||||||
|
void WinEDA_CvpcbFrame::OnSize( wxSizeEvent& event )
|
||||||
|
/************************************************/
|
||||||
|
{
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************/
|
/******************************************************/
|
||||||
void WinEDA_CvpcbFrame::OnQuit( wxCommandEvent& event )
|
void WinEDA_CvpcbFrame::OnQuit( wxCommandEvent& event )
|
||||||
/******************************************************/
|
/******************************************************/
|
||||||
|
@ -212,7 +206,7 @@ void WinEDA_CvpcbFrame::OnCloseWindow( wxCloseEvent& Event )
|
||||||
{
|
{
|
||||||
unsigned ii;
|
unsigned ii;
|
||||||
wxMessageDialog dialog( this,
|
wxMessageDialog dialog( this,
|
||||||
_( "Net and component list modified.\n Save before exit ?" ),
|
_( "Net and component list modified.\nSave before exit ?" ),
|
||||||
_( "Confirmation" ),
|
_( "Confirmation" ),
|
||||||
wxYES_NO | wxCANCEL | wxICON_EXCLAMATION | wxYES_DEFAULT );
|
wxYES_NO | wxCANCEL | wxICON_EXCLAMATION | wxYES_DEFAULT );
|
||||||
|
|
||||||
|
@ -252,9 +246,9 @@ void WinEDA_CvpcbFrame::OnCloseWindow( wxCloseEvent& Event )
|
||||||
wxGetApp().m_HtmlCtrl->GetFrame()->Close( TRUE );
|
wxGetApp().m_HtmlCtrl->GetFrame()->Close( TRUE );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !NetInNameBuffer.IsEmpty() )
|
if( m_NetlistFileName.IsOk() )
|
||||||
{
|
{
|
||||||
SetLastProject( NetInNameBuffer );
|
SetLastProject( m_NetlistFileName.GetFullPath() );
|
||||||
}
|
}
|
||||||
|
|
||||||
FreeMemoryModules();
|
FreeMemoryModules();
|
||||||
|
@ -345,7 +339,7 @@ void WinEDA_CvpcbFrame::ToPreviousNA( wxCommandEvent& event )
|
||||||
void WinEDA_CvpcbFrame::SaveQuitCvpcb( wxCommandEvent& event )
|
void WinEDA_CvpcbFrame::SaveQuitCvpcb( wxCommandEvent& event )
|
||||||
/**********************************************************/
|
/**********************************************************/
|
||||||
{
|
{
|
||||||
if( SaveNetList( wxEmptyString ) > 0 )
|
if( SaveNetList( wxEmptyString ) > 0 )
|
||||||
{
|
{
|
||||||
modified = 0;
|
modified = 0;
|
||||||
Close( TRUE );
|
Close( TRUE );
|
||||||
|
@ -384,37 +378,56 @@ void WinEDA_CvpcbFrame::DelAssociations( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
/*
|
||||||
void WinEDA_CvpcbFrame::LoadNetList( wxCommandEvent& event )
|
* Called when click on Load Netlist button or by file history menu entries
|
||||||
/***********************************************************/
|
* Read a netlist slected by user
|
||||||
|
|
||||||
/* Called when click on Load Netlist button or by menu files
|
|
||||||
* Read a netlist slected by user
|
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_CvpcbFrame::LoadNetList( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
bool newfile;
|
wxString oldPath;
|
||||||
wxString oldfilename;
|
wxFileName newFileName;
|
||||||
wxString fullfilename;
|
int id = event.GetId();
|
||||||
int id = event.GetId();
|
|
||||||
|
|
||||||
// Get a filename from history. if fullfilename is void,
|
if ( id >= wxID_FILE1 && id <= wxID_FILE9 )
|
||||||
// a name will be asked to user, later.
|
|
||||||
if ( id >= wxID_FILE1 && id <= wxID_FILE9 ) // Called by clicking on an old filename in file history
|
|
||||||
fullfilename = GetFileFromHistory( event.GetId(), _( "Netlist" ) );
|
|
||||||
|
|
||||||
if( !NetInNameBuffer.IsEmpty() )
|
|
||||||
{
|
{
|
||||||
oldfilename = NetInNameBuffer;
|
newFileName = GetFileFromHistory( id, _( "Netlist" ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newFileName = wxFileName( wxGetCwd(), _( "unnamed" ), wxT( "net" ) );
|
||||||
|
|
||||||
|
wxFileDialog dlg( this, _( "Open Net List" ), newFileName.GetPath(),
|
||||||
|
newFileName.GetFullName(), NetlistFileWildcard,
|
||||||
|
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );
|
||||||
|
|
||||||
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
|
return;
|
||||||
|
|
||||||
|
newFileName = dlg.GetPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the file fullfilename. If fullfilename is void,
|
if( newFileName == m_NetlistFileName )
|
||||||
// The user will be prompted for a filename.
|
return;
|
||||||
// newfile = true if a file is read.
|
|
||||||
newfile = ReadInputNetList( fullfilename );
|
|
||||||
|
|
||||||
if( newfile && !oldfilename.IsEmpty() )
|
if( m_NetlistFileName.DirExists() )
|
||||||
|
oldPath = m_NetlistFileName.GetPath();
|
||||||
|
|
||||||
|
/* Update the library search path list. */
|
||||||
|
if( wxGetApp().GetLibraryPathList().Index( oldPath ) != wxNOT_FOUND )
|
||||||
|
wxGetApp().GetLibraryPathList().Remove( oldPath );
|
||||||
|
wxGetApp().GetLibraryPathList().Insert( newFileName.GetPath(), 0 );
|
||||||
|
m_NetlistFileName = newFileName;
|
||||||
|
|
||||||
|
if( ReadNetList() )
|
||||||
{
|
{
|
||||||
SetLastProject( NetInNameBuffer );
|
SetLastProject( m_NetlistFileName.GetFullPath() );
|
||||||
|
|
||||||
|
SetTitle( wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion() +
|
||||||
|
wxT( " " ) + m_NetlistFileName.GetFullPath() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetTitle( wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion() );
|
||||||
}
|
}
|
||||||
|
|
||||||
ReCreateMenuBar();
|
ReCreateMenuBar();
|
||||||
|
@ -497,11 +510,12 @@ void WinEDA_CvpcbFrame::SetLanguage( wxCommandEvent& event )
|
||||||
void WinEDA_CvpcbFrame::DisplayDocFile( wxCommandEvent& event )
|
void WinEDA_CvpcbFrame::DisplayDocFile( wxCommandEvent& event )
|
||||||
/*************************************************************/
|
/*************************************************************/
|
||||||
{
|
{
|
||||||
wxString DocModuleFileName, fullfilename;
|
wxASSERT( wxGetApp().m_EDA_CommonConfig != NULL );
|
||||||
|
|
||||||
DocModuleFileName = wxGetApp().m_EDA_CommonConfig->Read(
|
wxString DocModuleFileName, fullfilename;
|
||||||
DOC_FOOTPRINTS_LIST_KEY,
|
wxConfig* cfg = wxGetApp().m_EDA_CommonConfig;
|
||||||
DEFAULT_FOOTPRINTS_LIST_FILENAME );
|
DocModuleFileName = cfg->Read( DOC_FOOTPRINTS_LIST_KEY,
|
||||||
|
DEFAULT_FOOTPRINTS_LIST_FILENAME );
|
||||||
if( wxIsAbsolutePath( DocModuleFileName ) )
|
if( wxIsAbsolutePath( DocModuleFileName ) )
|
||||||
fullfilename = DocModuleFileName;
|
fullfilename = DocModuleFileName;
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
/*******************/
|
/*******************/
|
||||||
/* File: cvpcb.cpp */
|
/* File: cvpcb.cpp */
|
||||||
/*******************/
|
/*******************/
|
||||||
#define MAIN
|
|
||||||
#define eda_global
|
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "appl_wxstruct.h"
|
#include "appl_wxstruct.h"
|
||||||
|
@ -19,7 +17,36 @@
|
||||||
|
|
||||||
#include <wx/snglinst.h>
|
#include <wx/snglinst.h>
|
||||||
|
|
||||||
wxString g_Main_Title = wxT( "CVpcb" );
|
|
||||||
|
/* Constant string definitions for CvPcb */
|
||||||
|
const wxString ComponentFileExtension( wxT( "cmp" ) );
|
||||||
|
const wxString RetroFileExtension( wxT( "stf" ) );
|
||||||
|
const wxString EquivFileExtension( wxT( "equ" ) );
|
||||||
|
|
||||||
|
/* TODO: What is a stuff file??? Please fix this wild card in English if
|
||||||
|
* you know. */
|
||||||
|
const wxString RetroFileWildcard( _( "Kicad component list files (*.stf)|*.stf" ) );
|
||||||
|
const wxString EquivFileWildcard( _( "Kicad footprint alias files (*.equ)|*.equ" ) );
|
||||||
|
|
||||||
|
const wxString titleLibLoadError( _( "Library Load Error" ) );
|
||||||
|
|
||||||
|
|
||||||
|
/* Global variables used in CVPcb. */
|
||||||
|
int g_FlagEESchema;
|
||||||
|
int Rjustify;
|
||||||
|
int modified;
|
||||||
|
int nbcomp;
|
||||||
|
int nblib;
|
||||||
|
int composants_non_affectes;
|
||||||
|
|
||||||
|
STOREMOD* g_BaseListePkg = NULL;
|
||||||
|
STORECMP* g_BaseListeCmp = NULL;
|
||||||
|
|
||||||
|
wxString g_UserNetDirBuffer; // Netlist path (void = current working directory)
|
||||||
|
wxString g_NetlistFileExtension;
|
||||||
|
|
||||||
|
wxArrayString g_ListName_Equ; // list of .equ files to load
|
||||||
|
|
||||||
|
|
||||||
// Create a new application object
|
// Create a new application object
|
||||||
IMPLEMENT_APP( WinEDA_App )
|
IMPLEMENT_APP( WinEDA_App )
|
||||||
|
@ -32,11 +59,12 @@ IMPLEMENT_APP( WinEDA_App )
|
||||||
|
|
||||||
bool WinEDA_App::OnInit()
|
bool WinEDA_App::OnInit()
|
||||||
{
|
{
|
||||||
|
wxFileName fn;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
wxString currCWD = wxGetCwd();
|
wxString currCWD = wxGetCwd();
|
||||||
WinEDA_CvpcbFrame* frame = NULL;
|
WinEDA_CvpcbFrame* frame = NULL;
|
||||||
|
|
||||||
InitEDA_Appl( wxT( "cvpcb" ) );
|
InitEDA_Appl( wxT( "CVpcb" ) );
|
||||||
|
|
||||||
if( m_Checker && m_Checker->IsAnotherRunning() )
|
if( m_Checker && m_Checker->IsAnotherRunning() )
|
||||||
{
|
{
|
||||||
|
@ -51,17 +79,14 @@ bool WinEDA_App::OnInit()
|
||||||
|
|
||||||
if( argc > 1 )
|
if( argc > 1 )
|
||||||
{
|
{
|
||||||
NetInNameBuffer = argv[1];
|
wxLogDebug( wxT( "CvPcb opening file <%s>" ), argv[1] );
|
||||||
NetNameBuffer = argv[1];
|
fn = argv[1];
|
||||||
|
wxSetWorkingDirectory( fn.GetPath() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !NetInNameBuffer.IsEmpty() )
|
|
||||||
wxSetWorkingDirectory( wxPathOnly( NetInNameBuffer ) );
|
|
||||||
g_DrawBgColor = BLACK;
|
g_DrawBgColor = BLACK;
|
||||||
|
|
||||||
Read_Config( NetInNameBuffer );
|
wxString Title = GetTitle() + wxT( " " ) + GetBuildVersion();
|
||||||
|
|
||||||
wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
|
|
||||||
frame = new WinEDA_CvpcbFrame( Title );
|
frame = new WinEDA_CvpcbFrame( Title );
|
||||||
|
|
||||||
msg.Printf( wxT( "Modules: %d" ), nblib );
|
msg.Printf( wxT( "Modules: %d" ), nblib );
|
||||||
|
@ -70,25 +95,28 @@ bool WinEDA_App::OnInit()
|
||||||
// Show the frame
|
// Show the frame
|
||||||
SetTopWindow( frame );
|
SetTopWindow( frame );
|
||||||
|
|
||||||
frame->Show( TRUE );
|
Read_Config( fn.GetFullPath() );
|
||||||
|
|
||||||
listlib();
|
frame->Show( TRUE );
|
||||||
frame->BuildFootprintListBox();
|
frame->BuildFootprintListBox();
|
||||||
|
|
||||||
if( !NetInNameBuffer.IsEmpty() ) /* nom de fichier passe a la commande */
|
if( fn.IsOk() && fn.FileExists() )
|
||||||
{
|
{
|
||||||
FFileName = MakeFileName( NetDirBuffer,
|
frame->m_NetlistFileName = fn;
|
||||||
NetInNameBuffer, NetInExtBuffer );
|
|
||||||
|
|
||||||
frame->ReadNetListe();
|
if( frame->ReadNetList() )
|
||||||
}
|
{
|
||||||
else /* Mise a jour du titre de la fenetre principale */
|
g_NetlistFileExtension = fn.GetExt();
|
||||||
{
|
return true;
|
||||||
wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
|
}
|
||||||
msg.Printf( wxT( "%s {%s%c} [no file]" ),
|
|
||||||
Title.GetData(), wxGetCwd().GetData(), DIR_SEP );
|
|
||||||
frame->SetTitle( msg );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
listlib();
|
||||||
|
g_NetlistFileExtension = wxT( "net" );
|
||||||
|
frame->m_NetlistFileName.Clear();
|
||||||
|
frame->SetTitle( GetTitle() + wxT( " " ) + GetBuildVersion() +
|
||||||
|
wxGetCwd() + wxFileName::GetPathSeparator() +
|
||||||
|
_( " [no file]" ) );
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
100
cvpcb/cvpcb.h
100
cvpcb/cvpcb.h
|
@ -2,23 +2,28 @@
|
||||||
/* CVPCB : declaration des variables globales */
|
/* CVPCB : declaration des variables globales */
|
||||||
/**********************************************/
|
/**********************************************/
|
||||||
|
|
||||||
|
#ifndef __CVPCB_H__
|
||||||
|
#define __CVPCB_H__
|
||||||
|
|
||||||
#ifndef eda_global
|
#include "pcbcommon.h"
|
||||||
#define eda_global extern
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "pcbnew.h"
|
|
||||||
|
|
||||||
// config for footprints doc file acces
|
// config for footprints doc file acces
|
||||||
#define DOC_FOOTPRINTS_LIST_KEY wxT("footprints_doc_file")
|
#define DOC_FOOTPRINTS_LIST_KEY wxT("footprints_doc_file")
|
||||||
#define DEFAULT_FOOTPRINTS_LIST_FILENAME wxT("footprints_doc/footprints.pdf")
|
#define DEFAULT_FOOTPRINTS_LIST_FILENAME wxT("footprints_doc/footprints.pdf")
|
||||||
|
|
||||||
|
|
||||||
// Define print format to display a schematic component line
|
// Define print format to display a schematic component line
|
||||||
#define CMP_FORMAT wxT( "%3d %8s - %16s : %-.32s" )
|
#define CMP_FORMAT wxT( "%3d %8s - %16s : %-.32s" )
|
||||||
|
|
||||||
#define FILTERFOOTPRINTKEY "FilterFootprint"
|
#define FILTERFOOTPRINTKEY "FilterFootprint"
|
||||||
|
|
||||||
|
/* Types de netliste: */
|
||||||
|
#define TYPE_NON_SPECIFIE 0
|
||||||
|
#define TYPE_ORCADPCB2 1
|
||||||
|
#define TYPE_PCAD 2
|
||||||
|
#define TYPE_VIEWLOGIC_WIR 3
|
||||||
|
#define TYPE_VIEWLOGIC_NET 4
|
||||||
|
|
||||||
|
|
||||||
enum TypeOfStruct {
|
enum TypeOfStruct {
|
||||||
STRUCT_NOT_INIT,
|
STRUCT_NOT_INIT,
|
||||||
STRUCT_COMPONENT,
|
STRUCT_COMPONENT,
|
||||||
|
@ -79,75 +84,36 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
eda_global STOREMOD* g_BaseListePkg;
|
|
||||||
eda_global STORECMP* g_BaseListeCmp;
|
|
||||||
|
|
||||||
eda_global FILE* source;
|
|
||||||
eda_global FILE* dest;
|
|
||||||
eda_global FILE* libcmp;
|
|
||||||
eda_global FILE* lib_module;
|
|
||||||
|
|
||||||
/* nom des fichiers a traiter */
|
|
||||||
eda_global wxString FFileName;
|
|
||||||
eda_global wxString NetNameBuffer;
|
|
||||||
|
|
||||||
/* Types de netliste: */
|
|
||||||
#define TYPE_NON_SPECIFIE 0
|
|
||||||
#define TYPE_ORCADPCB2 1
|
|
||||||
#define TYPE_PCAD 2
|
|
||||||
#define TYPE_VIEWLOGIC_WIR 3
|
|
||||||
#define TYPE_VIEWLOGIC_NET 4
|
|
||||||
|
|
||||||
/* Gestion des noms des librairies */
|
/* Gestion des noms des librairies */
|
||||||
eda_global wxString g_EquivExtBuffer
|
extern const wxString EquivFileExtension;
|
||||||
#ifdef MAIN
|
extern const wxString RetroFileExtension;
|
||||||
( wxT( ".equ" ) )
|
extern const wxString ComponentFileExtension;
|
||||||
#endif
|
|
||||||
;
|
|
||||||
eda_global wxString g_ExtCmpBuffer
|
|
||||||
#ifdef MAIN
|
|
||||||
( wxT( ".cmp" ) )
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
|
|
||||||
eda_global wxString g_UserNetDirBuffer; // Netlist path (void = current working directory)
|
extern const wxString RetroFileWildcard;
|
||||||
|
extern const wxString EquivFileWildcard;
|
||||||
|
|
||||||
eda_global wxArrayString g_ListName_Equ; // list of .equ files to load
|
extern const wxString titleLibLoadError;
|
||||||
|
|
||||||
eda_global int g_FlagEESchema;
|
/* CvPcb global variable definition references. */
|
||||||
eda_global int Rjustify; /* flag pout troncature des noms de Net:
|
extern STOREMOD* g_BaseListePkg;
|
||||||
* = 0: debut de chaine conservee (->ORCADPCB2)
|
extern STORECMP* g_BaseListeCmp;
|
||||||
* = 1: fin de chaine conservee (->VIEWLOGIC) */
|
|
||||||
eda_global int selection_type; /* 0 pour sel par U??, 1 pour sel par ref ORCADPCB */
|
|
||||||
|
|
||||||
eda_global int modified; /* Flag != 0 si modif attribution des modules */
|
extern wxString g_NetlistFileExtension;
|
||||||
eda_global int ListModIsModified; /* Flag != 0 si modif liste des lib modules */
|
extern wxString g_UserNetDirBuffer;
|
||||||
|
|
||||||
eda_global char alim[1024];
|
extern wxArrayString g_ListName_Equ; // list of .equ files to load
|
||||||
|
|
||||||
eda_global int nbcomp; /* nombre de composants trouves */
|
extern int g_FlagEESchema;
|
||||||
eda_global int nblib; /* nombre d'empreintes trouvees */
|
extern int Rjustify; /* flag pout troncature des noms de Net:
|
||||||
eda_global int composants_non_affectes; /* nbre de composants non affectes */
|
* = 0: debut de chaine conservee (->ORCADPCB2)
|
||||||
|
* = 1: fin de chaine conservee (->VIEWLOGIC) */
|
||||||
|
|
||||||
eda_global wxString NameBuffer;
|
extern int modified; /* Flag != 0 si modif attribution des module. */
|
||||||
eda_global wxString NetInNameBuffer;
|
|
||||||
eda_global wxString NetInExtBuffer;
|
|
||||||
eda_global wxString NetDirBuffer;
|
|
||||||
|
|
||||||
eda_global wxString ExtRetroBuffer
|
extern int nbcomp; /* nombre de composants trouves */
|
||||||
#ifdef MAIN
|
extern int nblib; /* nombre d'empreintes trouvees */
|
||||||
( wxT( ".stf" ) )
|
extern int composants_non_affectes; /* nbre de composants non affectes */
|
||||||
#endif
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
// Variables generales */
|
|
||||||
// Unused, for pcbnew compatibility:
|
|
||||||
eda_global Ki_PageDescr* SheetList[]
|
|
||||||
#ifdef MAIN
|
|
||||||
= { NULL }
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
|
|
||||||
// Unused, for pcbnew compatibility:
|
|
||||||
void Plume( int state );
|
void Plume( int state );
|
||||||
|
|
||||||
|
#endif /* __CVPCB_H__ */
|
||||||
|
|
|
@ -6,12 +6,8 @@
|
||||||
#ifndef CVSTRUCT_H
|
#ifndef CVSTRUCT_H
|
||||||
#define CVSTRUCT_H
|
#define CVSTRUCT_H
|
||||||
|
|
||||||
#ifndef eda_global
|
|
||||||
#define eda_global extern
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#include "wx/listctrl.h"
|
#include "wx/listctrl.h"
|
||||||
|
#include <wx/filename.h>
|
||||||
|
|
||||||
/* Forward declarations of all top-level window classes. */
|
/* Forward declarations of all top-level window classes. */
|
||||||
class FootprintListBox;
|
class FootprintListBox;
|
||||||
|
@ -33,6 +29,7 @@ public:
|
||||||
ListBoxCmp* m_ListCmp;
|
ListBoxCmp* m_ListCmp;
|
||||||
WinEDA_DisplayFrame* DrawFrame;
|
WinEDA_DisplayFrame* DrawFrame;
|
||||||
WinEDA_Toolbar* m_HToolBar; // Toolbar horizontal haut d'ecran
|
WinEDA_Toolbar* m_HToolBar; // Toolbar horizontal haut d'ecran
|
||||||
|
wxFileName m_NetlistFileName;
|
||||||
|
|
||||||
// Constructor and destructor
|
// Constructor and destructor
|
||||||
public:
|
public:
|
||||||
|
@ -73,8 +70,7 @@ public:
|
||||||
void CreateConfigWindow();
|
void CreateConfigWindow();
|
||||||
int SaveNetList( const wxString& FullFileName );
|
int SaveNetList( const wxString& FullFileName );
|
||||||
int SaveComponentList( const wxString& FullFileName );
|
int SaveComponentList( const wxString& FullFileName );
|
||||||
bool ReadInputNetList( const wxString& FullFileName );
|
bool ReadNetList();
|
||||||
void ReadNetListe();
|
|
||||||
int rdpcad();
|
int rdpcad();
|
||||||
int ReadSchematicNetlist();
|
int ReadSchematicNetlist();
|
||||||
int ReadFootprintFilterList( FILE* f );
|
int ReadFootprintFilterList( FILE* f );
|
||||||
|
@ -177,7 +173,7 @@ class WinEDA_DisplayFrame : public WinEDA_BasePcbFrame
|
||||||
public:
|
public:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
WinEDA_DisplayFrame( wxWindow * father,
|
WinEDA_DisplayFrame( WinEDA_CvpcbFrame* father,
|
||||||
const wxString &title,
|
const wxString &title,
|
||||||
const wxPoint &pos, const wxSize &size,
|
const wxPoint &pos, const wxSize &size,
|
||||||
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
|
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
|
||||||
|
|
|
@ -262,7 +262,9 @@ void WinEDA_FootprintDisplayOptionsFrame::UpdateObjectSettings(void)
|
||||||
|
|
||||||
void WinEDA_FootprintDisplayOptionsFrame::OnSaveConfigClick( wxCommandEvent& event )
|
void WinEDA_FootprintDisplayOptionsFrame::OnSaveConfigClick( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
Save_Config(this);
|
WinEDA_CvpcbFrame* parent = ( WinEDA_CvpcbFrame* )GetParent();
|
||||||
|
wxASSERT( parent && parent->IsKindOf( CLASSINFO( WinEDA_CvpcbFrame ) ) );
|
||||||
|
Save_Config( this, parent->m_NetlistFileName.GetFullPath() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "class_drawpanel.h"
|
#include "class_drawpanel.h"
|
||||||
#include "id.h"
|
#include "id.h"
|
||||||
#include "confirm.h"
|
#include "confirm.h"
|
||||||
|
#include "macros.h"
|
||||||
|
|
||||||
#include "3d_viewer.h"
|
#include "3d_viewer.h"
|
||||||
|
|
||||||
|
@ -34,17 +35,14 @@ END_EVENT_TABLE()
|
||||||
/* WinEDA_DisplayFrame: the frame to display the current focused footprint */
|
/* WinEDA_DisplayFrame: the frame to display the current focused footprint */
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
||||||
WinEDA_DisplayFrame::WinEDA_DisplayFrame( wxWindow* father,
|
WinEDA_DisplayFrame::WinEDA_DisplayFrame( WinEDA_CvpcbFrame* father,
|
||||||
const wxString& title,
|
const wxString& title,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size, long style ) :
|
const wxSize& size, long style ) :
|
||||||
WinEDA_BasePcbFrame( father, CVPCB_DISPLAY_FRAME, title, pos,
|
WinEDA_BasePcbFrame( father, CVPCB_DISPLAY_FRAME, title, pos,
|
||||||
size, style )
|
size, style )
|
||||||
{
|
{
|
||||||
m_FrameName = wxT( "CmpFrame" );
|
m_FrameName = wxT( "CmpFrame" );
|
||||||
m_Draw_Axis = TRUE; // TRUE if we want the axis
|
|
||||||
m_Draw_Grid = TRUE; // TRUE if we want the grid
|
|
||||||
m_Draw_Sheet_Ref = FALSE; // TRUE if we want the sheet references
|
|
||||||
|
|
||||||
// Give an icon
|
// Give an icon
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
|
@ -55,10 +53,9 @@ WinEDA_DisplayFrame::WinEDA_DisplayFrame( wxWindow* father,
|
||||||
SetTitle( title );
|
SetTitle( title );
|
||||||
|
|
||||||
SetBoard( new BOARD( NULL, this ) );
|
SetBoard( new BOARD( NULL, this ) );
|
||||||
|
|
||||||
SetBaseScreen( new PCB_SCREEN() );
|
SetBaseScreen( new PCB_SCREEN() );
|
||||||
|
|
||||||
GetSettings();
|
LoadSettings();
|
||||||
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
||||||
ReCreateHToolbar();
|
ReCreateHToolbar();
|
||||||
ReCreateVToolbar();
|
ReCreateVToolbar();
|
||||||
|
@ -234,25 +231,25 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
||||||
|
|
||||||
case WXK_NUMPAD8: /* cursor moved up */
|
case WXK_NUMPAD8: /* cursor moved up */
|
||||||
case WXK_UP:
|
case WXK_UP:
|
||||||
Mouse.y -= (int) round(delta.y);
|
Mouse.y -= wxRound(delta.y);
|
||||||
DrawPanel->MouseTo( Mouse );
|
DrawPanel->MouseTo( Mouse );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD2: /* cursor moved down */
|
case WXK_NUMPAD2: /* cursor moved down */
|
||||||
case WXK_DOWN:
|
case WXK_DOWN:
|
||||||
Mouse.y += (int) round(delta.y);
|
Mouse.y += wxRound(delta.y);
|
||||||
DrawPanel->MouseTo( Mouse );
|
DrawPanel->MouseTo( Mouse );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD4: /* cursor moved left */
|
case WXK_NUMPAD4: /* cursor moved left */
|
||||||
case WXK_LEFT:
|
case WXK_LEFT:
|
||||||
Mouse.x -= (int) round(delta.x);
|
Mouse.x -= wxRound(delta.x);
|
||||||
DrawPanel->MouseTo( Mouse );
|
DrawPanel->MouseTo( Mouse );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD6: /* cursor moved right */
|
case WXK_NUMPAD6: /* cursor moved right */
|
||||||
case WXK_RIGHT:
|
case WXK_RIGHT:
|
||||||
Mouse.x += (int) round(delta.x);
|
Mouse.x += wxRound(delta.x);
|
||||||
DrawPanel->MouseTo( Mouse );
|
DrawPanel->MouseTo( Mouse );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -285,7 +282,7 @@ void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Affiche_Status_Box(); /* Display new cursor coordinates */
|
UpdateStatusBar(); /* Display new cursor coordinates */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "wxstruct.h"
|
#include "wxstruct.h"
|
||||||
#include "confirm.h"
|
#include "confirm.h"
|
||||||
#include "gestfich.h"
|
#include "gestfich.h"
|
||||||
|
#include "macros.h"
|
||||||
|
|
||||||
#include "cvpcb.h"
|
#include "cvpcb.h"
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
@ -18,31 +19,27 @@ void WinEDA_CvpcbFrame::WriteStuffList( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
FILE* FileEquiv;
|
FILE* FileEquiv;
|
||||||
STORECMP* Cmp;
|
STORECMP* Cmp;
|
||||||
wxString Line, FullFileName, Mask;
|
wxString Line;
|
||||||
|
wxFileName fn = m_NetlistFileName;
|
||||||
|
|
||||||
if( nbcomp <= 0 )
|
if( nbcomp <= 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* calcul du nom du fichier */
|
/* calcul du nom du fichier */
|
||||||
Mask = wxT( "*" ) + ExtRetroBuffer;
|
fn.SetExt( RetroFileExtension );
|
||||||
FullFileName = FFileName;
|
|
||||||
ChangeFileNameExt( FullFileName, ExtRetroBuffer );
|
|
||||||
|
|
||||||
FullFileName = EDA_FileSelector( wxT( "Create Stuff File" ),
|
wxFileDialog dlg( this, wxT( "Save Stuff File" ), fn.GetPath(),
|
||||||
wxGetCwd(), /* Chemin par defaut */
|
fn.GetFullName(), RetroFileWildcard,
|
||||||
FullFileName, /* nom fichier par defaut */
|
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||||
ExtRetroBuffer, /* extension par defaut */
|
|
||||||
Mask, /* Masque d'affichage */
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
this,
|
|
||||||
wxFD_SAVE,
|
|
||||||
TRUE );
|
|
||||||
if( FullFileName.IsEmpty() )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
FileEquiv = wxFopen( FullFileName, wxT( "wt" ) );
|
FileEquiv = wxFopen( dlg.GetPath(), wxT( "wt" ) );
|
||||||
|
|
||||||
if( FileEquiv == 0 )
|
if( FileEquiv == 0 )
|
||||||
{
|
{
|
||||||
Line = _( "Unable to create " ) + FullFileName;
|
Line = _( "Unable to create " ) + dlg.GetPath();
|
||||||
DisplayError( this, Line, 30 );
|
DisplayError( this, Line, 30 );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,14 +27,14 @@ int NetNumCode; /* Nombre utilise pour cree des NetNames lors de
|
||||||
|
|
||||||
int genorcad()
|
int genorcad()
|
||||||
{
|
{
|
||||||
char Line[1024];
|
char Line[1024];
|
||||||
STOREPIN * Pin;
|
STOREPIN * Pin;
|
||||||
STORECMP * CurrentCmp;
|
STORECMP * CurrentCmp;
|
||||||
wxString Title = g_Main_Title + wxT(" ") + GetBuildVersion();
|
wxString Title = wxGetApp().GetAppName() + wxT(" ") + GetBuildVersion();
|
||||||
|
|
||||||
NetNumCode = 1; DateAndTime(Line);
|
NetNumCode = 1; DateAndTime(Line);
|
||||||
fprintf(dest,"( { Netlist by %s, date = %s }\n",
|
fprintf(dest,"( { Netlist by %s, date = %s }\n",
|
||||||
CONV_TO_UTF8(Title), Line ) ;
|
CONV_TO_UTF8(Title), Line ) ;
|
||||||
|
|
||||||
/***********************/
|
/***********************/
|
||||||
/* Lecture de la liste */
|
/* Lecture de la liste */
|
||||||
|
|
116
cvpcb/init.cpp
116
cvpcb/init.cpp
|
@ -9,6 +9,7 @@
|
||||||
#include "gr_basic.h"
|
#include "gr_basic.h"
|
||||||
#include "gestfich.h"
|
#include "gestfich.h"
|
||||||
#include "id.h"
|
#include "id.h"
|
||||||
|
#include "appl_wxstruct.h"
|
||||||
|
|
||||||
#include "cvpcb.h"
|
#include "cvpcb.h"
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
@ -77,7 +78,7 @@ void WinEDA_CvpcbFrame::SetNewPkg( const wxString& package )
|
||||||
|
|
||||||
|
|
||||||
/********************************************/
|
/********************************************/
|
||||||
void WinEDA_CvpcbFrame::ReadNetListe()
|
bool WinEDA_CvpcbFrame::ReadNetList()
|
||||||
/*******************************************/
|
/*******************************************/
|
||||||
|
|
||||||
/* Lecture de la netliste selon format, ainsi que du fichier des composants
|
/* Lecture de la netliste selon format, ainsi que du fichier des composants
|
||||||
|
@ -91,18 +92,21 @@ void WinEDA_CvpcbFrame::ReadNetListe()
|
||||||
error_level = ReadSchematicNetlist();
|
error_level = ReadSchematicNetlist();
|
||||||
|
|
||||||
if( error_level < 0 )
|
if( error_level < 0 )
|
||||||
return;
|
{
|
||||||
|
msg.Printf( _( "File <%s> does not appear to be a valid Kicad " \
|
||||||
|
"net list file." ),
|
||||||
|
m_NetlistFileName.GetFullPath().c_str() );
|
||||||
|
::wxMessageBox( msg, _( "File Error" ), wxOK | wxICON_ERROR, this );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/* lecture des correspondances */
|
/* lecture des correspondances */
|
||||||
loadcmp();
|
loadcmp( m_NetlistFileName.GetFullPath() );
|
||||||
|
|
||||||
if( m_ListCmp == NULL )
|
if( m_ListCmp == NULL )
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
if( !NetInNameBuffer.IsEmpty() )
|
Read_Config( m_NetlistFileName.GetFullPath() );
|
||||||
wxSetWorkingDirectory( wxPathOnly( NetInNameBuffer ) );
|
|
||||||
|
|
||||||
Read_Config( NetInNameBuffer ); // relecture de la config (elle peut etre modifiée)
|
|
||||||
|
|
||||||
listlib();
|
listlib();
|
||||||
BuildFootprintListBox();
|
BuildFootprintListBox();
|
||||||
|
@ -130,14 +134,14 @@ void WinEDA_CvpcbFrame::ReadNetListe()
|
||||||
SetStatusText( msg, 1 );
|
SetStatusText( msg, 1 );
|
||||||
|
|
||||||
/* Mise a jour du titre de la fenetre principale */
|
/* Mise a jour du titre de la fenetre principale */
|
||||||
wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
|
SetTitle( wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion() +
|
||||||
msg.Printf( wxT( "%s [%s]" ), Title.GetData(), FFileName.GetData() );
|
wxT( " " ) + m_NetlistFileName.GetFullPath() );
|
||||||
SetTitle( msg );
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
int WinEDA_CvpcbFrame::SaveNetList( const wxString& FullFilename )
|
int WinEDA_CvpcbFrame::SaveNetList( const wxString& fileName )
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
|
|
||||||
/* Sauvegarde des fichiers netliste et cmp
|
/* Sauvegarde des fichiers netliste et cmp
|
||||||
|
@ -145,93 +149,35 @@ int WinEDA_CvpcbFrame::SaveNetList( const wxString& FullFilename )
|
||||||
* Le nom du fichier cmp en est deduit
|
* Le nom du fichier cmp en est deduit
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxString NetlistFullFileName = FullFilename;
|
wxFileName fn;
|
||||||
|
|
||||||
if( NetlistFullFileName.IsEmpty() )
|
if( !fileName && m_NetlistFileName.IsOk() )
|
||||||
{
|
fn = m_NetlistFileName;
|
||||||
wxString Mask = wxT( "*" ) + NetExtBuffer;
|
else
|
||||||
if( !NetNameBuffer.IsEmpty() )
|
fn = wxFileName( wxGetCwd(), _( "unamed" ), NetExtBuffer );
|
||||||
{
|
|
||||||
NetlistFullFileName = NetNameBuffer;
|
|
||||||
ChangeFileNameExt( NetlistFullFileName, NetExtBuffer );
|
|
||||||
}
|
|
||||||
|
|
||||||
NetlistFullFileName =
|
wxFileDialog dlg( this, _( "Save Net and Component List" ), fn.GetPath(),
|
||||||
EDA_FileSelector( _( "Save NetList and Components List files" ),
|
fn.GetFullName(), NetlistFileWildcard,
|
||||||
NetDirBuffer, /* Chemin par defaut */
|
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||||
NetlistFullFileName, /* nom fichier par defaut */
|
|
||||||
NetExtBuffer, /* extension par defaut */
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
Mask, /* Masque d'affichage */
|
|
||||||
this,
|
|
||||||
wxFD_SAVE,
|
|
||||||
TRUE
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if( NetlistFullFileName.IsEmpty() )
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
FFileName = NetlistFullFileName;
|
if( SaveComponentList( dlg.GetPath() ) == 0 )
|
||||||
NetNameBuffer = NetlistFullFileName;
|
|
||||||
if( SaveComponentList( NetlistFullFileName ) == 0 )
|
|
||||||
{
|
{
|
||||||
DisplayError( this, _( "Unable to create component file (.cmp)" ) );
|
DisplayError( this, _( "Unable to create component file (.cmp)" ) );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
dest = wxFopen( NetlistFullFileName, wxT( "wt" ) );
|
FILE* netlist = wxFopen( dlg.GetPath(), wxT( "wt" ) );
|
||||||
if( dest == 0 )
|
|
||||||
|
if( netlist == 0 )
|
||||||
{
|
{
|
||||||
DisplayError( this, _( "Unable to create netlist file" ) );
|
DisplayError( this, _( "Unable to create netlist file" ) );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
GenNetlistPcbnew();
|
GenNetlistPcbnew( netlist );
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************/
|
|
||||||
bool WinEDA_CvpcbFrame::ReadInputNetList( const wxString& FullFileName )
|
|
||||||
/**********************************************************************/
|
|
||||||
|
|
||||||
/* Routine de selection du nom de la netliste d'entree, et de lecure de
|
|
||||||
* celle-ci
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
wxString Mask, Line;
|
|
||||||
|
|
||||||
if( FullFileName.IsEmpty() )
|
|
||||||
{
|
|
||||||
if( !NetInExtBuffer.IsEmpty() )
|
|
||||||
Mask = wxT( "*" ) + NetInExtBuffer;
|
|
||||||
else
|
|
||||||
Mask = wxT( "*.net" );
|
|
||||||
Line = EDA_FileSelector( _( "Open NetList File:" ),
|
|
||||||
NetDirBuffer, /* Chemin par defaut */
|
|
||||||
NetInNameBuffer, /* nom fichier par defaut */
|
|
||||||
NetInExtBuffer, /* extension par defaut */
|
|
||||||
Mask, /* Masque d'affichage */
|
|
||||||
this,
|
|
||||||
0,
|
|
||||||
FALSE
|
|
||||||
);
|
|
||||||
if( Line.IsEmpty() )
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Line = FullFileName;
|
|
||||||
|
|
||||||
NetInNameBuffer = Line;
|
|
||||||
NetNameBuffer = Line;
|
|
||||||
FFileName = NetInNameBuffer;
|
|
||||||
|
|
||||||
/* Mise a jour du titre de la fenetre principale */
|
|
||||||
Line = g_Main_Title + wxT( " " ) + GetBuildVersion();
|
|
||||||
Line += wxT( " " ) + NetInNameBuffer;
|
|
||||||
SetTitle( Line );
|
|
||||||
|
|
||||||
ReadNetListe();
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
|
@ -13,21 +13,20 @@
|
||||||
#include "confirm.h"
|
#include "confirm.h"
|
||||||
#include "kicad_string.h"
|
#include "kicad_string.h"
|
||||||
#include "gestfich.h"
|
#include "gestfich.h"
|
||||||
|
#include "macros.h"
|
||||||
|
#include "appl_wxstruct.h"
|
||||||
|
|
||||||
#include "cvpcb.h"
|
#include "cvpcb.h"
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
FILE* name_libmodules; /* pour lecture librairie */
|
|
||||||
|
|
||||||
/* routines locales : */
|
/* routines locales : */
|
||||||
static void ReadDocLib( const wxString& ModLibName );
|
static void ReadDocLib( const wxString& ModLibName );
|
||||||
static int LibCompare( void* mod1, void* mod2 );
|
static int LibCompare( void* mod1, void* mod2 );
|
||||||
static STOREMOD* TriListeModules( STOREMOD* BaseListe, int nbitems );
|
static STOREMOD* TriListeModules( STOREMOD* BaseListe, int nbitems );
|
||||||
|
|
||||||
/**/
|
|
||||||
|
|
||||||
/*********************/
|
/*********************/
|
||||||
int listlib()
|
bool listlib()
|
||||||
/*********************/
|
/*********************/
|
||||||
|
|
||||||
/* Routine lisant la liste des librairies, et generant la liste chainee
|
/* Routine lisant la liste des librairies, et generant la liste chainee
|
||||||
|
@ -42,13 +41,13 @@ int listlib()
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
char buffer[1024];
|
FILE* file; /* pour lecture librairie */
|
||||||
wxString FullLibName;
|
char buffer[1024];
|
||||||
int errorlevel = 0, end;
|
wxFileName fn;
|
||||||
int flag_librairie;
|
int end;
|
||||||
STOREMOD* ItemLib;
|
STOREMOD* ItemLib;
|
||||||
unsigned ii;
|
unsigned ii;
|
||||||
wxString msg;
|
wxString tmp, msg;
|
||||||
|
|
||||||
if( g_BaseListePkg ) /* Liste Deja existante, a supprimer */
|
if( g_BaseListePkg ) /* Liste Deja existante, a supprimer */
|
||||||
{
|
{
|
||||||
|
@ -57,50 +56,65 @@ int listlib()
|
||||||
}
|
}
|
||||||
|
|
||||||
if( g_LibName_List.GetCount() == 0 )
|
if( g_LibName_List.GetCount() == 0 )
|
||||||
return -4;
|
{
|
||||||
|
wxMessageBox( _( "No PCB foot print libraries are listed in the " \
|
||||||
|
"current project file." ), _( "Project File Error" ),
|
||||||
|
wxOK | wxICON_ERROR );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/* init recherche */
|
|
||||||
SetRealLibraryPath( wxT( "modules" ) );
|
|
||||||
nblib = 0;
|
nblib = 0;
|
||||||
|
|
||||||
/* Lecture des Librairies */
|
/* Lecture des Librairies */
|
||||||
for( ii = 0; ii < g_LibName_List.GetCount(); ii++ )
|
for( ii = 0; ii < g_LibName_List.GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
/* Calcul du nom complet de la librairie */
|
/* Calcul du nom complet de la librairie */
|
||||||
FullLibName = MakeFileName( g_RealLibDirBuffer,
|
fn = g_LibName_List[ii];
|
||||||
g_LibName_List[ii],
|
fn.SetExt( ModuleFileExtension );
|
||||||
LibExtBuffer );
|
|
||||||
/* acces a une librairie */
|
tmp = wxGetApp().GetLibraryPathList().FindValidPath( fn.GetFullName() );
|
||||||
if( ( name_libmodules = wxFopen( FullLibName, wxT( "rt" ) ) ) == NULL )
|
|
||||||
|
if( !tmp )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Library file <%s> not found" ),
|
msg.Printf( _( "PCB foot print library file <%s> could not be " \
|
||||||
FullLibName.GetData() );
|
"found in the default search paths." ),
|
||||||
DisplayError( NULL, msg, 20 );
|
fn.GetFullName().c_str() );
|
||||||
|
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* acces a une librairie */
|
||||||
|
file = wxFopen( tmp, wxT( "rt" ) );
|
||||||
|
|
||||||
|
if( file == NULL )
|
||||||
|
{
|
||||||
|
msg.Printf( _( "Could not open PCB foot print library file <%s>." ),
|
||||||
|
tmp.c_str() );
|
||||||
|
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Controle du type de la librairie : */
|
/* Controle du type de la librairie : */
|
||||||
flag_librairie = 0;
|
fgets( buffer, 32, file );
|
||||||
fgets( buffer, 32, name_libmodules );
|
|
||||||
if( strncmp( buffer, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) != 0 )
|
if( strncmp( buffer, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) != 0 )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Library file <%s> is not a module library" ),
|
msg.Printf( _( "<%s> is not a valid Kicad PCB foot print library" ),
|
||||||
FullLibName.GetData() );
|
tmp.c_str() );
|
||||||
DisplayError( NULL, msg, 20 );
|
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR );
|
||||||
fclose( name_libmodules );
|
fclose( file );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lecture du nombre de composants */
|
/* Lecture du nombre de composants */
|
||||||
fseek( name_libmodules, 0, 0 );
|
fseek( file, 0, 0 );
|
||||||
|
|
||||||
/* lecture nom des composants : */
|
/* lecture nom des composants : */
|
||||||
end = 0;
|
end = 0;
|
||||||
while( !end && fgets( buffer, 255, name_libmodules ) != NULL )
|
while( !end && fgets( buffer, 255, file ) != NULL )
|
||||||
{
|
{
|
||||||
if( strnicmp( buffer, "$INDEX", 6 ) == 0 )
|
if( strnicmp( buffer, "$INDEX", 6 ) == 0 )
|
||||||
{
|
{
|
||||||
while( fgets( buffer, 255, name_libmodules ) != NULL )
|
while( fgets( buffer, 255, file ) != NULL )
|
||||||
{
|
{
|
||||||
if( strnicmp( buffer, "$EndINDEX", 6 ) == 0 )
|
if( strnicmp( buffer, "$EndINDEX", 6 ) == 0 )
|
||||||
{
|
{
|
||||||
|
@ -112,25 +126,29 @@ int listlib()
|
||||||
ItemLib->Pnext = g_BaseListePkg;
|
ItemLib->Pnext = g_BaseListePkg;
|
||||||
g_BaseListePkg = ItemLib;
|
g_BaseListePkg = ItemLib;
|
||||||
ItemLib->m_Module = CONV_FROM_UTF8( StrPurge( buffer ) );
|
ItemLib->m_Module = CONV_FROM_UTF8( StrPurge( buffer ) );
|
||||||
ItemLib->m_LibName = FullLibName;
|
ItemLib->m_LibName = tmp;
|
||||||
|
|
||||||
nblib++;
|
nblib++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !end )
|
if( !end )
|
||||||
errorlevel = -3;
|
{
|
||||||
|
msg.Printf( _( "Unexpected end of file occurred while " \
|
||||||
|
"parsing PCB foot print library <%s>." ),
|
||||||
|
tmp.c_str() );
|
||||||
|
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose( name_libmodules );
|
fclose( file );
|
||||||
ReadDocLib( FullLibName );
|
ReadDocLib( tmp );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* classement alphabetique: */
|
/* classement alphabetique: */
|
||||||
if( g_BaseListePkg )
|
if( g_BaseListePkg )
|
||||||
g_BaseListePkg = TriListeModules( g_BaseListePkg, nblib );
|
g_BaseListePkg = TriListeModules( g_BaseListePkg, nblib );
|
||||||
|
|
||||||
return errorlevel;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -218,18 +236,28 @@ static void ReadDocLib( const wxString& ModLibName )
|
||||||
STOREMOD* NewMod;
|
STOREMOD* NewMod;
|
||||||
char Line[1024];
|
char Line[1024];
|
||||||
wxString ModuleName;
|
wxString ModuleName;
|
||||||
wxString docfilename;
|
wxString msg;
|
||||||
FILE* LibDoc;
|
FILE* LibDoc;
|
||||||
|
wxFileName fn = ModLibName;
|
||||||
|
|
||||||
docfilename = ModLibName;
|
fn.SetExt( wxT( "mdc" ) );
|
||||||
ChangeFileNameExt( docfilename, EXT_DOC );
|
|
||||||
|
|
||||||
if( ( LibDoc = wxFopen( docfilename, wxT( "rt" ) ) ) == NULL )
|
if( ( LibDoc = wxFopen( fn.GetFullPath(), wxT( "rt" ) ) ) == NULL )
|
||||||
|
{
|
||||||
|
msg.Printf( _( "Could not open PCB foot print library document " \
|
||||||
|
"file <%s>." ), fn.GetFullPath().c_str() );
|
||||||
|
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR );
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
GetLine( LibDoc, Line, NULL, sizeof(Line) - 1 );
|
GetLine( LibDoc, Line, NULL, sizeof(Line) - 1 );
|
||||||
if( strnicmp( Line, ENTETE_LIBDOC, L_ENTETE_LIB ) != 0 )
|
if( strnicmp( Line, ENTETE_LIBDOC, L_ENTETE_LIB ) != 0 )
|
||||||
|
{
|
||||||
|
msg.Printf( _( "<%s> is not a valid PCB foot print library " \
|
||||||
|
"document file." ), fn.GetFullPath().c_str() );
|
||||||
|
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR );
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Lecture de la librairie */
|
/* Lecture de la librairie */
|
||||||
while( GetLine( LibDoc, Line, NULL, sizeof(Line) - 1 ) )
|
while( GetLine( LibDoc, Line, NULL, sizeof(Line) - 1 ) )
|
||||||
|
|
|
@ -8,17 +8,16 @@
|
||||||
#include "confirm.h"
|
#include "confirm.h"
|
||||||
#include "kicad_string.h"
|
#include "kicad_string.h"
|
||||||
#include "gestfich.h"
|
#include "gestfich.h"
|
||||||
|
#include "macros.h"
|
||||||
|
#include "appl_wxstruct.h"
|
||||||
|
|
||||||
#include "cvpcb.h"
|
#include "cvpcb.h"
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
#include "cvstruct.h"
|
#include "cvstruct.h"
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
/*****************************************************************
|
||||||
MODULE* WinEDA_DisplayFrame::Get_Module( const wxString& CmpName )
|
*
|
||||||
/*****************************************************************/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Analyse les LIBRAIRIES pour trouver le module demande
|
* Analyse les LIBRAIRIES pour trouver le module demande
|
||||||
* Si ce module est trouve, le copie en memoire, et le
|
* Si ce module est trouve, le copie en memoire, et le
|
||||||
* chaine en fin de liste des modules
|
* chaine en fin de liste des modules
|
||||||
|
@ -26,45 +25,69 @@ MODULE* WinEDA_DisplayFrame::Get_Module( const wxString& CmpName )
|
||||||
* name_cmp = nom du module
|
* name_cmp = nom du module
|
||||||
* - Retour:
|
* - Retour:
|
||||||
* Pointeur sur le nouveau module.
|
* Pointeur sur le nouveau module.
|
||||||
*/
|
*
|
||||||
|
*****************************************************************/
|
||||||
|
MODULE* WinEDA_DisplayFrame::Get_Module( const wxString& CmpName )
|
||||||
{
|
{
|
||||||
int LineNum, Found = 0;
|
int LineNum, Found = 0;
|
||||||
unsigned ii;
|
unsigned ii;
|
||||||
char Line[1024], Name[255];
|
char Line[1024], Name[255];
|
||||||
wxString libname;
|
wxString tmp, msg;
|
||||||
MODULE* Module = NULL;
|
wxFileName fn;
|
||||||
|
MODULE* Module = NULL;
|
||||||
|
FILE* file;
|
||||||
|
|
||||||
for( ii = 0; ii < g_LibName_List.GetCount(); ii++ )
|
for( ii = 0; ii < g_LibName_List.GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
/* Calcul du nom complet de la librairie */
|
/* Calcul du nom complet de la librairie */
|
||||||
libname = MakeFileName( g_RealLibDirBuffer, g_LibName_List[ii], LibExtBuffer );
|
fn = g_LibName_List[ii];
|
||||||
|
fn.SetExt( ModuleFileExtension );
|
||||||
|
|
||||||
if( ( lib_module = wxFopen( libname, wxT( "rt" ) ) ) == NULL )
|
tmp = wxGetApp().GetLibraryPathList().FindValidPath( fn.GetFullName() );
|
||||||
|
|
||||||
|
if( !tmp )
|
||||||
{
|
{
|
||||||
|
msg.Printf( _( "PCB foot print library file <%s> could not be " \
|
||||||
|
"found in the default search paths." ),
|
||||||
|
fn.GetFullName().c_str() );
|
||||||
|
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR, this );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
file = wxFopen( tmp, wxT( "rt" ) );
|
||||||
|
|
||||||
|
if( file == NULL )
|
||||||
|
{
|
||||||
|
msg.Printf( _( "Could not open PCB foot print library file <%s>." ),
|
||||||
|
tmp.c_str() );
|
||||||
|
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR, this );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* lecture entete chaine definie par ENTETE_LIBRAIRIE */
|
/* lecture entete chaine definie par ENTETE_LIBRAIRIE */
|
||||||
LineNum = 0;
|
LineNum = 0;
|
||||||
GetLine( lib_module, Line, &LineNum );
|
GetLine( file, Line, &LineNum );
|
||||||
StrPurge( Line );
|
StrPurge( Line );
|
||||||
|
|
||||||
if( strnicmp( Line, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) != 0 )
|
if( strnicmp( Line, ENTETE_LIBRAIRIE, L_ENTETE_LIB ) != 0 )
|
||||||
{
|
{
|
||||||
DisplayError( this, _( "This file is NOT a library file" ) );
|
msg.Printf( _( "<%s> is not a valid Kicad PCB foot print library." ),
|
||||||
|
tmp.c_str() );
|
||||||
|
wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR, this );
|
||||||
|
fclose( file );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lecture de la liste des composants de la librairie */
|
/* Lecture de la liste des composants de la librairie */
|
||||||
Found = 0;
|
Found = 0;
|
||||||
while( !Found && GetLine( lib_module, Line, &LineNum ) )
|
while( !Found && GetLine( file, Line, &LineNum ) )
|
||||||
{
|
{
|
||||||
if( strncmp( Line, "$MODULE", 6 ) == 0 )
|
if( strncmp( Line, "$MODULE", 6 ) == 0 )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if( strnicmp( Line, "$INDEX", 6 ) == 0 )
|
if( strnicmp( Line, "$INDEX", 6 ) == 0 )
|
||||||
{
|
{
|
||||||
while( GetLine( lib_module, Line, &LineNum ) )
|
while( GetLine( file, Line, &LineNum ) )
|
||||||
{
|
{
|
||||||
if( strnicmp( Line, "$EndINDEX", 9 ) == 0 )
|
if( strnicmp( Line, "$EndINDEX", 9 ) == 0 )
|
||||||
break;
|
break;
|
||||||
|
@ -80,7 +103,7 @@ MODULE* WinEDA_DisplayFrame::Get_Module( const wxString& CmpName )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lecture de la librairie */
|
/* Lecture de la librairie */
|
||||||
while( Found && GetLine( lib_module, Line, &LineNum ) )
|
while( Found && GetLine( file, Line, &LineNum ) )
|
||||||
{
|
{
|
||||||
if( Line[0] != '$' )
|
if( Line[0] != '$' )
|
||||||
continue;
|
continue;
|
||||||
|
@ -99,22 +122,21 @@ MODULE* WinEDA_DisplayFrame::Get_Module( const wxString& CmpName )
|
||||||
|
|
||||||
// Switch the locale to standard C (needed to print floating point numbers like 1.3)
|
// Switch the locale to standard C (needed to print floating point numbers like 1.3)
|
||||||
SetLocaleTo_C_standard();
|
SetLocaleTo_C_standard();
|
||||||
Module->ReadDescr( lib_module, &LineNum );
|
Module->ReadDescr( file, &LineNum );
|
||||||
SetLocaleTo_Default(); // revert to the current locale
|
SetLocaleTo_Default(); // revert to the current locale
|
||||||
Module->SetPosition( wxPoint( 0, 0 ) );
|
Module->SetPosition( wxPoint( 0, 0 ) );
|
||||||
fclose( lib_module );
|
fclose( file );
|
||||||
return Module;
|
return Module;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose( lib_module );
|
fclose( file );
|
||||||
lib_module = 0;
|
file = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( lib_module )
|
if( file )
|
||||||
fclose( lib_module );
|
fclose( file );
|
||||||
|
|
||||||
wxString msg;
|
|
||||||
msg.Printf( _( "Module %s not found" ), CmpName.GetData() );
|
msg.Printf( _( "Module %s not found" ), CmpName.GetData() );
|
||||||
DisplayError( this, msg );
|
DisplayError( this, msg );
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -28,7 +28,8 @@ void WinEDA_CvpcbFrame::CreateConfigWindow()
|
||||||
{
|
{
|
||||||
KiConfigCvpcbFrame* ConfigFrame = new KiConfigCvpcbFrame( this );
|
KiConfigCvpcbFrame* ConfigFrame = new KiConfigCvpcbFrame( this );
|
||||||
|
|
||||||
ConfigFrame->ShowModal(); ConfigFrame->Destroy();
|
ConfigFrame->ShowModal();
|
||||||
|
ConfigFrame->Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,21 +37,21 @@ void WinEDA_CvpcbFrame::CreateConfigWindow()
|
||||||
void KiConfigCvpcbFrame::SetDialogDatas()
|
void KiConfigCvpcbFrame::SetDialogDatas()
|
||||||
/*********************************************/
|
/*********************************************/
|
||||||
{
|
{
|
||||||
|
wxConfig* cfg = wxGetApp().m_EDA_CommonConfig;
|
||||||
|
|
||||||
m_ListLibr->InsertItems( g_LibName_List, 0 );
|
m_ListLibr->InsertItems( g_LibName_List, 0 );
|
||||||
m_ListEquiv->InsertItems( g_ListName_Equ, 0 );
|
m_ListEquiv->InsertItems( g_ListName_Equ, 0 );
|
||||||
|
|
||||||
m_LibDirCtrl = new WinEDA_EnterText( this,
|
m_LibDirCtrl = new WinEDA_EnterText( this, _( "Lib Dir:" ),
|
||||||
_( "Lib Dir:" ), g_UserLibDirBuffer,
|
g_UserLibDirBuffer,
|
||||||
m_RightBoxSizer, wxDefaultSize );
|
m_RightBoxSizer, wxDefaultSize );
|
||||||
|
|
||||||
m_NetInputExtCtrl = new WinEDA_EnterText( this,
|
m_NetInputExtCtrl = new WinEDA_EnterText( this, _( "Net Input Ext:" ),
|
||||||
_( "Net Input Ext:" ),
|
g_NetlistFileExtension,
|
||||||
NetInExtBuffer,
|
|
||||||
m_NetExtBoxSizer, wxDefaultSize );
|
m_NetExtBoxSizer, wxDefaultSize );
|
||||||
|
|
||||||
wxString DocModuleFileName =
|
wxString DocModuleFileName = cfg->Read( DOC_FOOTPRINTS_LIST_KEY,
|
||||||
wxGetApp().m_EDA_CommonConfig->Read( DOC_FOOTPRINTS_LIST_KEY,
|
DEFAULT_FOOTPRINTS_LIST_FILENAME );
|
||||||
DEFAULT_FOOTPRINTS_LIST_FILENAME );
|
|
||||||
m_TextHelpModulesFileName = new WinEDA_EnterText( this,
|
m_TextHelpModulesFileName = new WinEDA_EnterText( this,
|
||||||
_( "Module Doc File:" ),
|
_( "Module Doc File:" ),
|
||||||
DocModuleFileName,
|
DocModuleFileName,
|
||||||
|
@ -60,41 +61,39 @@ void KiConfigCvpcbFrame::SetDialogDatas()
|
||||||
/* Create info on Files ext */
|
/* Create info on Files ext */
|
||||||
wxStaticText* StaticText;
|
wxStaticText* StaticText;
|
||||||
wxString text;
|
wxString text;
|
||||||
text.Printf( wxT( "%s %s" ), _( "Cmp ext:" ), g_ExtCmpBuffer.GetData() );
|
text.Printf( wxT( "%s .%s" ), _( "Cmp ext:" ),
|
||||||
|
ComponentFileExtension.c_str() );
|
||||||
StaticText = new wxStaticText( this, -1, text );
|
StaticText = new wxStaticText( this, -1, text );
|
||||||
m_FileExtList->Add(
|
m_FileExtList->Add( StaticText,
|
||||||
StaticText,
|
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM |
|
||||||
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM |
|
wxADJUST_MINSIZE );
|
||||||
wxADJUST_MINSIZE );
|
|
||||||
|
|
||||||
text.Printf( wxT( "%s %s" ), _( "Lib ext:" ), LibExtBuffer.GetData() );
|
text.Printf( wxT( "%s .%s" ), _( "Lib ext:" ),
|
||||||
|
ModuleFileExtension.c_str() );
|
||||||
StaticText = new wxStaticText( this, -1, text );
|
StaticText = new wxStaticText( this, -1, text );
|
||||||
m_FileExtList->Add(
|
m_FileExtList->Add( StaticText,
|
||||||
StaticText,
|
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM |
|
||||||
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM |
|
wxADJUST_MINSIZE );
|
||||||
wxADJUST_MINSIZE );
|
|
||||||
|
|
||||||
text.Printf( wxT( "%s %s" ), _( "NetOut ext:" ), NetExtBuffer.GetData() );
|
text.Printf( wxT( "%s .%s" ), _( "NetOut ext:" ), NetExtBuffer.c_str() );
|
||||||
StaticText = new wxStaticText( this, -1, text );
|
StaticText = new wxStaticText( this, -1, text );
|
||||||
m_FileExtList->Add(
|
m_FileExtList->Add( StaticText,
|
||||||
StaticText,
|
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM |
|
||||||
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM |
|
wxADJUST_MINSIZE );
|
||||||
wxADJUST_MINSIZE );
|
|
||||||
|
|
||||||
text.Printf( wxT( "%s %s" ), _( "Equiv ext:" ),
|
text.Printf( wxT( "%s .%s" ), _( "Equiv ext:" ),
|
||||||
g_EquivExtBuffer.GetData() );
|
EquivFileExtension.c_str() );
|
||||||
StaticText = new wxStaticText( this, -1, text );
|
StaticText = new wxStaticText( this, -1, text );
|
||||||
m_FileExtList->Add(
|
m_FileExtList->Add( StaticText,
|
||||||
StaticText,
|
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM |
|
||||||
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM |
|
wxADJUST_MINSIZE );
|
||||||
wxADJUST_MINSIZE );
|
|
||||||
|
|
||||||
text.Printf( wxT( "%s %s" ), _( "Retro ext:" ), ExtRetroBuffer.GetData() );
|
text.Printf( wxT( "%s .%s" ), _( "Retro ext:" ),
|
||||||
|
RetroFileExtension.c_str() );
|
||||||
StaticText = new wxStaticText( this, -1, text );
|
StaticText = new wxStaticText( this, -1, text );
|
||||||
m_FileExtList->Add(
|
m_FileExtList->Add( StaticText,
|
||||||
StaticText,
|
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM |
|
||||||
wxGROW | wxLEFT | wxRIGHT | wxTOP | wxBOTTOM |
|
wxADJUST_MINSIZE );
|
||||||
wxADJUST_MINSIZE );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -111,13 +110,15 @@ void KiConfigCvpcbFrame::AcceptCfg( wxCommandEvent& event )
|
||||||
void KiConfigCvpcbFrame::Update()
|
void KiConfigCvpcbFrame::Update()
|
||||||
/**********************************/
|
/**********************************/
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxASSERT( wxGetApp().m_EDA_CommonConfig != NULL );
|
||||||
|
|
||||||
|
wxString msg;
|
||||||
|
wxConfig* cfg = wxGetApp().m_EDA_CommonConfig;
|
||||||
|
|
||||||
if( !m_DoUpdate )
|
if( !m_DoUpdate )
|
||||||
return;
|
return;
|
||||||
NetInExtBuffer = m_NetInputExtCtrl->GetValue();
|
g_NetlistFileExtension = m_NetInputExtCtrl->GetValue();
|
||||||
wxGetApp().m_EDA_CommonConfig->Write( DOC_FOOTPRINTS_LIST_KEY,
|
cfg->Write( DOC_FOOTPRINTS_LIST_KEY, m_TextHelpModulesFileName->GetValue() );
|
||||||
m_TextHelpModulesFileName->GetValue() );
|
|
||||||
|
|
||||||
msg = m_LibDirCtrl->GetValue();
|
msg = m_LibDirCtrl->GetValue();
|
||||||
if( msg != g_UserLibDirBuffer )
|
if( msg != g_UserLibDirBuffer )
|
||||||
|
@ -125,7 +126,6 @@ void KiConfigCvpcbFrame::Update()
|
||||||
g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
|
g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
|
||||||
SetRealLibraryPath( wxT( "modules" ) );
|
SetRealLibraryPath( wxT( "modules" ) );
|
||||||
listlib();
|
listlib();
|
||||||
ListModIsModified = 1;
|
|
||||||
m_Parent->BuildFootprintListBox();
|
m_Parent->BuildFootprintListBox();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,41 +135,31 @@ void KiConfigCvpcbFrame::Update()
|
||||||
void KiConfigCvpcbFrame::SaveCfg( wxCommandEvent& event )
|
void KiConfigCvpcbFrame::SaveCfg( wxCommandEvent& event )
|
||||||
/****************************************************/
|
/****************************************************/
|
||||||
{
|
{
|
||||||
|
WinEDA_CvpcbFrame* parent = ( WinEDA_CvpcbFrame* )GetParent();
|
||||||
|
wxASSERT( parent && parent->IsKindOf( CLASSINFO( WinEDA_CvpcbFrame ) ) );
|
||||||
|
|
||||||
Update();
|
Update();
|
||||||
Save_Config( this );
|
Save_Config( this, parent->m_NetlistFileName.GetFullPath() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************/
|
/******************************************************/
|
||||||
void KiConfigCvpcbFrame::ReadOldCfg( wxCommandEvent& event )
|
void KiConfigCvpcbFrame::ReadOldCfg( wxCommandEvent& event )
|
||||||
/******************************************************/
|
|
||||||
{
|
{
|
||||||
wxString line;
|
WinEDA_CvpcbFrame* parent = ( WinEDA_CvpcbFrame* )GetParent();
|
||||||
|
wxASSERT( parent && parent->IsKindOf( CLASSINFO( WinEDA_CvpcbFrame ) ) );
|
||||||
|
|
||||||
NetInNameBuffer.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
wxFileName fn = parent->m_NetlistFileName;
|
||||||
|
fn.SetExt( ProjectFileExtension );
|
||||||
|
|
||||||
wxString FullFileName = NetInNameBuffer.AfterLast( '/' );
|
wxFileDialog dlg( this, _( "Load Project File" ), fn.GetPath(),
|
||||||
|
fn.GetFullName(), ProjectFileWildcard,
|
||||||
|
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||||
|
|
||||||
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
|
|
||||||
FullFileName = EDA_FileSelector( _( "Read config file" ),
|
|
||||||
wxGetCwd(), /* Chemin par defaut */
|
|
||||||
FullFileName, /* nom fichier par defaut */
|
|
||||||
g_Prj_Config_Filename_ext, /* extension par defaut */
|
|
||||||
FullFileName, /* Masque d'affichage */
|
|
||||||
this,
|
|
||||||
wxFD_OPEN,
|
|
||||||
TRUE /* ne change pas de repertoire courant */
|
|
||||||
);
|
|
||||||
if( FullFileName.IsEmpty() )
|
|
||||||
return;
|
return;
|
||||||
if( !wxFileExists( FullFileName ) )
|
|
||||||
{
|
|
||||||
line.Printf( _( "File %s not found" ), FullFileName.GetData() );
|
|
||||||
DisplayError( this, line ); return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Read_Config( FullFileName );
|
Read_Config( dlg.GetPath() );
|
||||||
m_DoUpdate = FALSE;
|
m_DoUpdate = FALSE;
|
||||||
Close( TRUE );
|
Close( TRUE );
|
||||||
}
|
}
|
||||||
|
@ -185,14 +175,13 @@ void KiConfigCvpcbFrame::LibDelFct( wxCommandEvent& event )
|
||||||
if( ii < 0 )
|
if( ii < 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ListModIsModified = 1;
|
|
||||||
g_LibName_List.RemoveAt( ii );
|
g_LibName_List.RemoveAt( ii );
|
||||||
|
|
||||||
/* suppression de la reference dans la liste des librairies */
|
/* suppression de la reference dans la liste des librairies */
|
||||||
m_ListLibr->Delete( ii );
|
m_ListLibr->Delete( ii );
|
||||||
|
|
||||||
g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
|
g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
|
||||||
SetRealLibraryPath( wxT( "modules" ) );
|
|
||||||
listlib();
|
listlib();
|
||||||
|
|
||||||
m_Parent->BuildFootprintListBox();
|
m_Parent->BuildFootprintListBox();
|
||||||
|
@ -203,8 +192,10 @@ void KiConfigCvpcbFrame::LibDelFct( wxCommandEvent& event )
|
||||||
void KiConfigCvpcbFrame::LibAddFct( wxCommandEvent& event )
|
void KiConfigCvpcbFrame::LibAddFct( wxCommandEvent& event )
|
||||||
/********************************************************/
|
/********************************************************/
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
wxString FullFileName, ShortLibName, mask;
|
wxFileName fn;
|
||||||
|
wxString tmp;
|
||||||
|
wxArrayString Filenames;
|
||||||
|
|
||||||
ii = m_ListLibr->GetSelection();
|
ii = m_ListLibr->GetSelection();
|
||||||
if( event.GetId() == ADD_LIB ) /* Ajout apres selection */
|
if( event.GetId() == ADD_LIB ) /* Ajout apres selection */
|
||||||
|
@ -215,47 +206,47 @@ void KiConfigCvpcbFrame::LibAddFct( wxCommandEvent& event )
|
||||||
ii = 0;
|
ii = 0;
|
||||||
|
|
||||||
Update();
|
Update();
|
||||||
mask = wxT( "*" ) + LibExtBuffer;
|
|
||||||
|
|
||||||
wxFileDialog FilesDialog( this, _( "Library files:" ), g_RealLibDirBuffer,
|
wxFileDialog dlg( this, _( "Foot Print Library Files" ), g_RealLibDirBuffer,
|
||||||
wxEmptyString, mask,
|
wxEmptyString, ModuleFileWildcard,
|
||||||
wxFD_DEFAULT_STYLE | wxFD_MULTIPLE );
|
wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST );
|
||||||
|
|
||||||
FilesDialog.ShowModal();
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
wxArrayString Filenames;
|
return;
|
||||||
FilesDialog.GetPaths( Filenames );
|
|
||||||
|
dlg.GetPaths( Filenames );
|
||||||
|
|
||||||
if( Filenames.GetCount() == 0 )
|
if( Filenames.GetCount() == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for( unsigned jj = 0; jj < Filenames.GetCount(); jj++ )
|
for( unsigned jj = 0; jj < Filenames.GetCount(); jj++ )
|
||||||
{
|
{
|
||||||
FullFileName = Filenames[jj];
|
fn = Filenames[jj];
|
||||||
ShortLibName = MakeReducedFileName( FullFileName,
|
|
||||||
g_RealLibDirBuffer,
|
|
||||||
LibExtBuffer );
|
|
||||||
|
|
||||||
//Add or insert new library name
|
/* If the library path is already in the library search paths
|
||||||
if( g_LibName_List.Index( ShortLibName ) == wxNOT_FOUND )
|
* list, just add the library name to the list. Otherwise, add
|
||||||
{
|
* the library name with the full path. */
|
||||||
ListModIsModified = 1;
|
if( wxGetApp().GetLibraryPathList().Index( fn.GetPath() ) == wxNOT_FOUND )
|
||||||
g_LibName_List.Insert( ShortLibName, ii++ );
|
tmp = fn.GetPathWithSep() + fn.GetName();
|
||||||
|
else
|
||||||
|
tmp = fn.GetName();
|
||||||
|
|
||||||
|
// Add or insert new library name.
|
||||||
|
if( g_LibName_List.Index( tmp ) == wxNOT_FOUND )
|
||||||
|
{
|
||||||
|
g_LibName_List.Insert( tmp, ii++ );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg = wxT( "<" ) + tmp + wxT( "> : " ) +
|
||||||
msg << wxT( "<" ) << ShortLibName << wxT( "> : " ) << _(
|
_( "Library already in use" );
|
||||||
"Library already in use" );
|
|
||||||
DisplayError( this, msg );
|
DisplayError( this, msg );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
|
g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
|
||||||
SetRealLibraryPath( wxT( "modules" ) );
|
|
||||||
listlib();
|
listlib();
|
||||||
|
|
||||||
m_Parent->BuildFootprintListBox();
|
m_Parent->BuildFootprintListBox();
|
||||||
|
|
||||||
m_ListLibr->Clear();
|
m_ListLibr->Clear();
|
||||||
m_ListLibr->InsertItems( g_LibName_List, 0 );
|
m_ListLibr->InsertItems( g_LibName_List, 0 );
|
||||||
}
|
}
|
||||||
|
@ -280,8 +271,9 @@ void KiConfigCvpcbFrame::EquDelFct( wxCommandEvent& event )
|
||||||
void KiConfigCvpcbFrame::EquAddFct( wxCommandEvent& event )
|
void KiConfigCvpcbFrame::EquAddFct( wxCommandEvent& event )
|
||||||
/********************************************************/
|
/********************************************************/
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
wxString FullFileName, ShortLibName, mask;
|
wxFileName fn;
|
||||||
|
wxString libName;
|
||||||
|
|
||||||
ii = m_ListEquiv->GetSelection();
|
ii = m_ListEquiv->GetSelection();
|
||||||
if( event.GetId() == ADD_EQU )
|
if( event.GetId() == ADD_EQU )
|
||||||
|
@ -290,43 +282,48 @@ void KiConfigCvpcbFrame::EquAddFct( wxCommandEvent& event )
|
||||||
ii = 0;
|
ii = 0;
|
||||||
|
|
||||||
Update();
|
Update();
|
||||||
mask = wxT( "*" ) + g_EquivExtBuffer;
|
|
||||||
|
|
||||||
wxFileDialog FilesDialog( this, _( "Equiv Files:" ), g_RealLibDirBuffer,
|
wxFileDialog dlg( this, _( "Open Footprint Alias Files" ),
|
||||||
wxEmptyString, mask,
|
g_RealLibDirBuffer, wxEmptyString, EquivFileWildcard,
|
||||||
wxFD_DEFAULT_STYLE | wxFD_MULTIPLE );
|
wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST );
|
||||||
|
|
||||||
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
|
return;
|
||||||
|
|
||||||
FilesDialog.ShowModal();
|
|
||||||
wxArrayString Filenames;
|
wxArrayString Filenames;
|
||||||
FilesDialog.GetFilenames( Filenames );
|
dlg.GetFilenames( Filenames );
|
||||||
|
|
||||||
if( Filenames.GetCount() == 0 )
|
if( Filenames.GetCount() == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for( unsigned jj = 0; jj < Filenames.GetCount(); jj++ )
|
for( unsigned jj = 0; jj < Filenames.GetCount(); jj++ )
|
||||||
{
|
{
|
||||||
FullFileName = Filenames[jj];
|
fn = Filenames[jj];
|
||||||
ShortLibName = MakeReducedFileName( FullFileName,
|
|
||||||
g_RealLibDirBuffer,
|
/* Use the file name without extension if the library path is
|
||||||
g_EquivExtBuffer );
|
* already in the default library search path. Otherwise, use
|
||||||
|
* the full path and file name without the extension. */
|
||||||
|
if( wxGetApp().GetLibraryPathList().Index( fn.GetPath() ) == wxNOT_FOUND )
|
||||||
|
libName = fn.GetPathWithSep() + fn.GetName();
|
||||||
|
else
|
||||||
|
libName = fn.GetName();
|
||||||
|
|
||||||
//Add or insert new equiv library name
|
//Add or insert new equiv library name
|
||||||
if( g_ListName_Equ.Index( ShortLibName ) == wxNOT_FOUND )
|
if( g_ListName_Equ.Index( libName ) == wxNOT_FOUND )
|
||||||
{
|
{
|
||||||
g_ListName_Equ.Insert( ShortLibName, ii++ );
|
g_ListName_Equ.Insert( libName, ii++ );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg << wxT( "<" ) << ShortLibName << wxT( "> : " ) << _(
|
msg << wxT( "<" ) << libName << wxT( "> : " ) <<
|
||||||
"Library already in use" );
|
_( "Library already in use" );
|
||||||
DisplayError( this, msg );
|
DisplayError( this, msg );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update display list */
|
/* Update display list */
|
||||||
g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
|
g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
|
||||||
SetRealLibraryPath( wxT( "modules" ) );
|
|
||||||
listlib();
|
listlib();
|
||||||
|
|
||||||
m_ListEquiv->Clear();
|
m_ListEquiv->Clear();
|
||||||
|
|
|
@ -5,16 +5,17 @@
|
||||||
#ifndef PROTOS_H
|
#ifndef PROTOS_H
|
||||||
#define PROTOS_H
|
#define PROTOS_H
|
||||||
|
|
||||||
int GenNetlistPcbnew() ;
|
int GenNetlistPcbnew( FILE* f ) ;
|
||||||
int loadcmp() ;
|
bool loadcmp( const wxString& fileName ) ;
|
||||||
int listlib() ;
|
bool listlib() ;
|
||||||
|
|
||||||
STOREMOD * GetModuleDescrByName(const wxString & FootprintName);
|
STOREMOD * GetModuleDescrByName(const wxString & FootprintName);
|
||||||
|
|
||||||
|
|
||||||
/***********/
|
/***********/
|
||||||
/* CFG.CPP */
|
/* CFG.CPP */
|
||||||
/***********/
|
/***********/
|
||||||
void Save_Config(wxWindow * parent);
|
void Save_Config( wxWindow* parent, const wxString& fileName );
|
||||||
void Read_Config( const wxString & FullFileName ); /* lit la configuration */
|
void Read_Config( const wxString & FullFileName ); /* lit la configuration */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "confirm.h"
|
#include "confirm.h"
|
||||||
#include "kicad_string.h"
|
#include "kicad_string.h"
|
||||||
|
#include "macros.h"
|
||||||
|
|
||||||
#include "cvpcb.h"
|
#include "cvpcb.h"
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
@ -22,9 +23,9 @@
|
||||||
|
|
||||||
/* routines locales : */
|
/* routines locales : */
|
||||||
|
|
||||||
static int ReadPinConnection( STORECMP* CurrentCmp );
|
static int ReadPinConnection( FILE* f, STORECMP* CurrentCmp );
|
||||||
static int CmpCompare( void* cmp1, void* cmp2 ); /* routine pour qsort() de tri de liste des composants */
|
static int CmpCompare( void* cmp1, void* cmp2 ); /* routine pour qsort() de tri de liste des composants */
|
||||||
static STORECMP* TriListeComposants( STORECMP* BaseListe, int nbitems );
|
static STORECMP* TriListeComposants( STORECMP* BaseListe, int nbitems );
|
||||||
|
|
||||||
/* Tri la liste des composants par ordre alphabetique et met a jour le nouveau chainage avant/arriere
|
/* Tri la liste des composants par ordre alphabetique et met a jour le nouveau chainage avant/arriere
|
||||||
* retourne un pointeur sur le 1er element de la liste */
|
* retourne un pointeur sur le 1er element de la liste */
|
||||||
|
@ -87,6 +88,7 @@ int WinEDA_CvpcbFrame::ReadSchematicNetlist()
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
|
char alim[1024];
|
||||||
int i, k, l;
|
int i, k, l;
|
||||||
char* LibName;
|
char* LibName;
|
||||||
char Line[BUFFER_CHAR_SIZE + 1];
|
char Line[BUFFER_CHAR_SIZE + 1];
|
||||||
|
@ -96,6 +98,7 @@ int WinEDA_CvpcbFrame::ReadSchematicNetlist()
|
||||||
wxString component_value; /* buffer for component values (470K, 22nF ...) */
|
wxString component_value; /* buffer for component values (470K, 22nF ...) */
|
||||||
char* ptchar;
|
char* ptchar;
|
||||||
STORECMP* Cmp;
|
STORECMP* Cmp;
|
||||||
|
FILE* source;
|
||||||
|
|
||||||
modified = 0;
|
modified = 0;
|
||||||
Rjustify = 0;
|
Rjustify = 0;
|
||||||
|
@ -105,12 +108,13 @@ int WinEDA_CvpcbFrame::ReadSchematicNetlist()
|
||||||
if( g_BaseListeCmp )
|
if( g_BaseListeCmp )
|
||||||
FreeMemoryComponents();
|
FreeMemoryComponents();
|
||||||
|
|
||||||
source = wxFopen( FFileName, wxT( "rt" ) );
|
source = wxFopen( m_NetlistFileName.GetFullPath(), wxT( "rt" ) );
|
||||||
|
|
||||||
if( source == 0 )
|
if( source == 0 )
|
||||||
{
|
{
|
||||||
wxString msg;
|
DisplayError( this, _( "File <" ) + m_NetlistFileName.GetFullPath() +
|
||||||
msg.Printf( _( "File <%s> not found" ), FFileName.GetData() );
|
_( "> not found" ) );
|
||||||
DisplayError( this, msg ); return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the file header (must be "( { OrCAD PCB" or "({ OrCAD PCB" )
|
/* Read the file header (must be "( { OrCAD PCB" or "({ OrCAD PCB" )
|
||||||
|
@ -270,7 +274,7 @@ int WinEDA_CvpcbFrame::ReadSchematicNetlist()
|
||||||
}
|
}
|
||||||
Cmp->m_TimeStamp = schematic_timestamp;
|
Cmp->m_TimeStamp = schematic_timestamp;
|
||||||
|
|
||||||
ReadPinConnection( Cmp );
|
ReadPinConnection( source, Cmp );
|
||||||
|
|
||||||
nbcomp++;
|
nbcomp++;
|
||||||
}
|
}
|
||||||
|
@ -294,7 +298,7 @@ int WinEDA_CvpcbFrame::ReadFootprintFilterList( FILE* f )
|
||||||
|
|
||||||
for( ; ; )
|
for( ; ; )
|
||||||
{
|
{
|
||||||
if( fgets( Line, BUFFER_CHAR_SIZE, source ) == 0 )
|
if( fgets( Line, BUFFER_CHAR_SIZE, f ) == 0 )
|
||||||
break;
|
break;
|
||||||
if( strnicmp( Line, "$endlist", 8 ) == 0 )
|
if( strnicmp( Line, "$endlist", 8 ) == 0 )
|
||||||
{
|
{
|
||||||
|
@ -307,7 +311,8 @@ int WinEDA_CvpcbFrame::ReadFootprintFilterList( FILE* f )
|
||||||
if( strnicmp( Line, "$component", 10 ) == 0 ) // New component ref found
|
if( strnicmp( Line, "$component", 10 ) == 0 ) // New component ref found
|
||||||
{
|
{
|
||||||
CmpRef = CONV_FROM_UTF8( Line + 11 );
|
CmpRef = CONV_FROM_UTF8( Line + 11 );
|
||||||
CmpRef.Trim( TRUE ); CmpRef.Trim( FALSE );
|
CmpRef.Trim( TRUE );
|
||||||
|
CmpRef.Trim( FALSE );
|
||||||
/* Search the new component in list */
|
/* Search the new component in list */
|
||||||
for( Cmp = g_BaseListeCmp; Cmp != NULL; Cmp = Cmp->Pnext )
|
for( Cmp = g_BaseListeCmp; Cmp != NULL; Cmp = Cmp->Pnext )
|
||||||
{
|
{
|
||||||
|
@ -318,7 +323,8 @@ int WinEDA_CvpcbFrame::ReadFootprintFilterList( FILE* f )
|
||||||
else if( Cmp )
|
else if( Cmp )
|
||||||
{
|
{
|
||||||
wxString fp = CONV_FROM_UTF8( Line + 1 );
|
wxString fp = CONV_FROM_UTF8( Line + 1 );
|
||||||
fp.Trim( FALSE ); fp.Trim( TRUE );
|
fp.Trim( FALSE );
|
||||||
|
fp.Trim( TRUE );
|
||||||
Cmp->m_FootprintFilter.Add( fp );
|
Cmp->m_FootprintFilter.Add( fp );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -328,7 +334,7 @@ int WinEDA_CvpcbFrame::ReadFootprintFilterList( FILE* f )
|
||||||
|
|
||||||
|
|
||||||
/***********************************/
|
/***********************************/
|
||||||
int ReadPinConnection( STORECMP* Cmp )
|
int ReadPinConnection( FILE* f, STORECMP* Cmp )
|
||||||
/***********************************/
|
/***********************************/
|
||||||
{
|
{
|
||||||
int i, jj;
|
int i, jj;
|
||||||
|
@ -343,7 +349,7 @@ int ReadPinConnection( STORECMP* Cmp )
|
||||||
/* debut description trouv‚ */
|
/* debut description trouv‚ */
|
||||||
for( ; ; )
|
for( ; ; )
|
||||||
{
|
{
|
||||||
if( fgets( Line, BUFFER_CHAR_SIZE, source ) == 0 )
|
if( fgets( Line, BUFFER_CHAR_SIZE, f ) == 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* remove blanks from the beginning of the line */
|
/* remove blanks from the beginning of the line */
|
||||||
|
@ -387,7 +393,8 @@ int ReadPinConnection( STORECMP* Cmp )
|
||||||
}
|
}
|
||||||
|
|
||||||
Pin = new STOREPIN();
|
Pin = new STOREPIN();
|
||||||
*LastPin = Pin; LastPin = &Pin->Pnext;
|
*LastPin = Pin;
|
||||||
|
LastPin = &Pin->Pnext;
|
||||||
Pin->m_PinNum = numpin;
|
Pin->m_PinNum = numpin;
|
||||||
Pin->m_PinNet = net;
|
Pin->m_PinNet = net;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
#include "confirm.h"
|
#include "confirm.h"
|
||||||
#include "kicad_string.h"
|
#include "kicad_string.h"
|
||||||
#include "gestfich.h"
|
#include "gestfich.h"
|
||||||
|
#include "macros.h"
|
||||||
|
#include "appl_wxstruct.h"
|
||||||
|
|
||||||
#include "cvpcb.h"
|
#include "cvpcb.h"
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
@ -19,25 +21,27 @@
|
||||||
/* Chaines de caractere d'identification */
|
/* Chaines de caractere d'identification */
|
||||||
char EnteteCmpMod[] = { "Cmp-Mod V01" };
|
char EnteteCmpMod[] = { "Cmp-Mod V01" };
|
||||||
|
|
||||||
/****************************************************************************/
|
const wxString titleComponentLibErr( _( "Component Library Error" ) );
|
||||||
int WinEDA_CvpcbFrame::SaveComponentList( const wxString& NetlistFullFileName )
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************/
|
||||||
/* Routine de sauvegarde du fichier des modules
|
/* Routine de sauvegarde du fichier des modules
|
||||||
* Retourne 1 si OK
|
* Retourne 1 si OK
|
||||||
* 0 si ecriture non faite
|
* 0 si ecriture non faite
|
||||||
*/
|
*/
|
||||||
|
/****************************************************************************/
|
||||||
|
int WinEDA_CvpcbFrame::SaveComponentList( const wxString& NetlistFullFileName )
|
||||||
{
|
{
|
||||||
STORECMP* Cmp;
|
STORECMP* Cmp;
|
||||||
wxString FullFileName;
|
FILE* dest;
|
||||||
char Line[1024];
|
wxFileName fn( NetlistFullFileName );
|
||||||
wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
|
char Line[1024];
|
||||||
|
wxString Title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
|
||||||
|
|
||||||
/* calcul du nom du fichier */
|
/* calcul du nom du fichier */
|
||||||
FullFileName = NetlistFullFileName;
|
fn.SetExt( ComponentFileExtension );
|
||||||
ChangeFileNameExt( FullFileName, g_ExtCmpBuffer );
|
|
||||||
|
|
||||||
dest = wxFopen( FullFileName, wxT( "wt" ) );
|
dest = wxFopen( fn.GetFullPath(), wxT( "wt" ) );
|
||||||
if( dest == NULL )
|
if( dest == NULL )
|
||||||
return 0; /* Erreur ecriture */
|
return 0; /* Erreur ecriture */
|
||||||
|
|
||||||
|
@ -62,38 +66,47 @@ int WinEDA_CvpcbFrame::SaveComponentList( const wxString& NetlistFullFileName )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************/
|
|
||||||
int loadcmp()
|
|
||||||
/***************/
|
/***************/
|
||||||
|
|
||||||
/* recupere la liste des associations composants/empreintes
|
/* recupere la liste des associations composants/empreintes
|
||||||
*/
|
*/
|
||||||
|
/****************/
|
||||||
|
bool loadcmp( const wxString& fileName )
|
||||||
{
|
{
|
||||||
wxString timestamp, valeur, ilib, namecmp;
|
wxString timestamp, valeur, ilib, namecmp, msg;
|
||||||
bool read_cmp_data = FALSE, eof = FALSE;
|
bool read_cmp_data = FALSE, eof = FALSE;
|
||||||
STORECMP* Cmp;
|
STORECMP* Cmp;
|
||||||
char Line[1024], * ident, * data;
|
char Line[1024], * ident, * data;
|
||||||
wxString FullFileName;
|
FILE* source;
|
||||||
|
wxFileName fn = fileName;
|
||||||
|
|
||||||
/* calcul du nom du fichier */
|
/* calcul du nom du fichier */
|
||||||
FullFileName = FFileName;
|
fn.SetExt( ComponentFileExtension );
|
||||||
ChangeFileNameExt( FullFileName, g_ExtCmpBuffer );
|
|
||||||
|
|
||||||
source = wxFopen( FullFileName, wxT( "rt" ) );
|
source = wxFopen( fn.GetFullPath(), wxT( "rt" ) );
|
||||||
if( source == NULL )
|
if( source == NULL )
|
||||||
{
|
{
|
||||||
return 0;
|
msg.Printf( _( "Cannot open component library <%s>." ),
|
||||||
|
fn.GetFullPath().c_str() );
|
||||||
|
wxMessageBox( msg, titleComponentLibErr, wxOK | wxICON_ERROR );
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Identification du Type de fichier CmpMod */
|
/* Identification du Type de fichier CmpMod */
|
||||||
if( fgets( Line, 79, source ) == 0 )
|
if( fgets( Line, 79, source ) == 0 )
|
||||||
return 0;
|
{
|
||||||
|
msg.Printf( _( " <%s> does not appear to be a valid Kicad component " \
|
||||||
|
"library." ), fn.GetFullPath().c_str() );
|
||||||
|
wxMessageBox( msg, titleComponentLibErr, wxOK | wxICON_ERROR );
|
||||||
|
fclose( source );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if( strnicmp( Line, EnteteCmpMod, 11 ) != 0 ) /* old file version*/
|
if( strnicmp( Line, EnteteCmpMod, 11 ) != 0 ) /* old file version*/
|
||||||
{
|
{
|
||||||
|
msg.Printf( _( "<%s> is an old version component file." ) );
|
||||||
|
wxMessageBox( msg, titleComponentLibErr, wxOK | wxICON_ERROR );
|
||||||
fclose( source );
|
fclose( source );
|
||||||
DisplayError( NULL,
|
return false;
|
||||||
wxT( "Old version of Componaent file, recreate it!" ) );
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* lecture de la liste */
|
/* lecture de la liste */
|
||||||
|
@ -115,16 +128,19 @@ int loadcmp()
|
||||||
{
|
{
|
||||||
if( fgets( Line, 1024, source ) == 0 )
|
if( fgets( Line, 1024, source ) == 0 )
|
||||||
{
|
{
|
||||||
eof = TRUE; break;
|
eof = TRUE;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( strnicmp( Line, "EndCmp", 6 ) == 0 )
|
if( strnicmp( Line, "EndCmp", 6 ) == 0 )
|
||||||
{
|
{
|
||||||
read_cmp_data = TRUE; break;
|
read_cmp_data = TRUE;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ident = strtok( Line, "=;\n\r" );
|
ident = strtok( Line, "=;\n\r" );
|
||||||
data = strtok( NULL, ";\n\r" );
|
data = strtok( NULL, ";\n\r" );
|
||||||
|
|
||||||
if( strnicmp( ident, "TimeStamp", 9 ) == 0 )
|
if( strnicmp( ident, "TimeStamp", 9 ) == 0 )
|
||||||
{
|
{
|
||||||
timestamp = CONV_FROM_UTF8( data );
|
timestamp = CONV_FROM_UTF8( data );
|
||||||
|
@ -162,14 +178,8 @@ int loadcmp()
|
||||||
* mise a jour de ses parametres */
|
* mise a jour de ses parametres */
|
||||||
for( Cmp = g_BaseListeCmp; Cmp != NULL; Cmp = Cmp->Pnext )
|
for( Cmp = g_BaseListeCmp; Cmp != NULL; Cmp = Cmp->Pnext )
|
||||||
{
|
{
|
||||||
if( selection_type == 1 )
|
if( namecmp != Cmp->m_Reference )
|
||||||
{
|
continue;
|
||||||
if( timestamp != Cmp->m_TimeStamp )
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if( namecmp != Cmp->m_Reference )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* composant identifie , copie du nom du module correspondant */
|
/* composant identifie , copie du nom du module correspondant */
|
||||||
Cmp->m_Module = ilib;
|
Cmp->m_Module = ilib;
|
||||||
|
@ -177,5 +187,5 @@ int loadcmp()
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose( source );
|
fclose( source );
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,9 @@ void WinEDA_CvpcbFrame::CreateScreenCmp()
|
||||||
DrawFrame->GetBoard()->m_Modules.DeleteAll();
|
DrawFrame->GetBoard()->m_Modules.DeleteAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawFrame->GetBoard()->m_Modules.PushBack( DrawFrame->Get_Module( FootprintName ) );
|
MODULE* mod = DrawFrame->Get_Module( FootprintName );
|
||||||
|
if( mod )
|
||||||
|
DrawFrame->GetBoard()->m_Modules.PushBack( mod );
|
||||||
|
|
||||||
DrawFrame->Zoom_Automatique( FALSE );
|
DrawFrame->Zoom_Automatique( FALSE );
|
||||||
if( DrawFrame->m_Draw3DFrame )
|
if( DrawFrame->m_Draw3DFrame )
|
||||||
|
@ -94,7 +96,7 @@ void WinEDA_DisplayFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
||||||
MODULE* Module = GetBoard()->m_Modules;
|
MODULE* Module = GetBoard()->m_Modules;
|
||||||
if ( Module )
|
if ( Module )
|
||||||
Module->Display_Infos( this );
|
Module->Display_Infos( this );
|
||||||
Affiche_Status_Box();
|
UpdateStatusBar();
|
||||||
DrawPanel->Trace_Curseur( DC );
|
DrawPanel->Trace_Curseur( DC );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "confirm.h"
|
#include "confirm.h"
|
||||||
#include "kicad_string.h"
|
#include "kicad_string.h"
|
||||||
|
#include "macros.h"
|
||||||
|
#include "appl_wxstruct.h"
|
||||||
|
|
||||||
#include "cvpcb.h"
|
#include "cvpcb.h"
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
@ -28,20 +30,19 @@ int NetNumCode; /* Nombre utilise pour cree des NetNames lors de
|
||||||
|
|
||||||
|
|
||||||
/*************************/
|
/*************************/
|
||||||
int GenNetlistPcbnew()
|
int GenNetlistPcbnew( FILE* file )
|
||||||
/*************************/
|
|
||||||
{
|
{
|
||||||
#define NETLIST_HEAD_STRING "EESchema Netlist Version 1.1"
|
#define NETLIST_HEAD_STRING "EESchema Netlist Version 1.1"
|
||||||
char Line[1024];
|
char Line[1024];
|
||||||
STOREPIN* Pin;
|
STOREPIN* Pin;
|
||||||
STORECMP* CurrentCmp;
|
STORECMP* CurrentCmp;
|
||||||
wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
|
wxString Title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
|
||||||
|
|
||||||
NetNumCode = 1; DateAndTime( Line );
|
NetNumCode = 1; DateAndTime( Line );
|
||||||
if( g_FlagEESchema )
|
if( g_FlagEESchema )
|
||||||
fprintf( dest, "# %s created %s\n(\n", NETLIST_HEAD_STRING, Line );
|
fprintf( file, "# %s created %s\n(\n", NETLIST_HEAD_STRING, Line );
|
||||||
else
|
else
|
||||||
fprintf( dest, "( { netlist created %s }\n", Line );
|
fprintf( file, "( { netlist created %s }\n", Line );
|
||||||
|
|
||||||
/***********************/
|
/***********************/
|
||||||
/* Lecture de la liste */
|
/* Lecture de la liste */
|
||||||
|
@ -50,18 +51,18 @@ int GenNetlistPcbnew()
|
||||||
CurrentCmp = g_BaseListeCmp;
|
CurrentCmp = g_BaseListeCmp;
|
||||||
for( ; CurrentCmp != NULL; CurrentCmp = CurrentCmp->Pnext )
|
for( ; CurrentCmp != NULL; CurrentCmp = CurrentCmp->Pnext )
|
||||||
{
|
{
|
||||||
fprintf( dest, " ( %s ", CONV_TO_UTF8( CurrentCmp->m_TimeStamp ) );
|
fprintf( file, " ( %s ", CONV_TO_UTF8( CurrentCmp->m_TimeStamp ) );
|
||||||
|
|
||||||
if( !CurrentCmp->m_Module.IsEmpty() )
|
if( !CurrentCmp->m_Module.IsEmpty() )
|
||||||
fprintf( dest, CONV_TO_UTF8( CurrentCmp->m_Module ) );
|
fprintf( file, CONV_TO_UTF8( CurrentCmp->m_Module ) );
|
||||||
|
|
||||||
else
|
else
|
||||||
fprintf( dest, "$noname$" );
|
fprintf( file, "$noname$" );
|
||||||
|
|
||||||
fprintf( dest, " %s ", CONV_TO_UTF8( CurrentCmp->m_Reference ) );
|
fprintf( file, " %s ", CONV_TO_UTF8( CurrentCmp->m_Reference ) );
|
||||||
|
|
||||||
/* placement de la valeur */
|
/* placement de la valeur */
|
||||||
fprintf( dest, "%s\n", CONV_TO_UTF8( CurrentCmp->m_Valeur ) );
|
fprintf( file, "%s\n", CONV_TO_UTF8( CurrentCmp->m_Valeur ) );
|
||||||
|
|
||||||
/* Tri des pins */
|
/* Tri des pins */
|
||||||
TriPinsModule( CurrentCmp );
|
TriPinsModule( CurrentCmp );
|
||||||
|
@ -74,26 +75,28 @@ int GenNetlistPcbnew()
|
||||||
ChangePinNet( Pin->m_PinNet );
|
ChangePinNet( Pin->m_PinNet );
|
||||||
|
|
||||||
if( !Pin->m_PinNet.IsEmpty() )
|
if( !Pin->m_PinNet.IsEmpty() )
|
||||||
fprintf( dest, " ( %s %s )\n",
|
fprintf( file, " ( %s %s )\n",
|
||||||
CONV_TO_UTF8( Pin->m_PinNum ),
|
CONV_TO_UTF8( Pin->m_PinNum ),
|
||||||
CONV_TO_UTF8( Pin->m_PinNet ) );
|
CONV_TO_UTF8( Pin->m_PinNet ) );
|
||||||
else
|
else
|
||||||
fprintf( dest, " ( %s ? )\n", CONV_TO_UTF8( Pin->m_PinNum ) );
|
fprintf( file, " ( %s ? )\n", CONV_TO_UTF8( Pin->m_PinNum ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf( dest, " )\n" );
|
fprintf( file, " )\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf( dest, ")\n*\n" );
|
fprintf( file, ")\n*\n" );
|
||||||
|
|
||||||
if( g_FlagEESchema )
|
if( g_FlagEESchema )
|
||||||
WriteFootprintFilterInfos( dest );
|
WriteFootprintFilterInfos( file );
|
||||||
fclose( dest );
|
|
||||||
|
fclose( file );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************/
|
/******************************************/
|
||||||
void WriteFootprintFilterInfos( FILE* dest )
|
void WriteFootprintFilterInfos( FILE* file )
|
||||||
/******************************************/
|
/******************************************/
|
||||||
/* Write the allowed footprint list for each component */
|
/* Write the allowed footprint list for each component */
|
||||||
{
|
{
|
||||||
|
@ -108,23 +111,23 @@ void WriteFootprintFilterInfos( FILE* dest )
|
||||||
continue;
|
continue;
|
||||||
if( !WriteHeader )
|
if( !WriteHeader )
|
||||||
{
|
{
|
||||||
fprintf( dest, "{ Allowed footprints by component:\n" );
|
fprintf( file, "{ Allowed footprints by component:\n" );
|
||||||
WriteHeader = TRUE;
|
WriteHeader = TRUE;
|
||||||
}
|
}
|
||||||
fprintf( dest, "$component %s\n",
|
fprintf( file, "$component %s\n",
|
||||||
CONV_TO_UTF8( component->m_Reference ) );
|
CONV_TO_UTF8( component->m_Reference ) );
|
||||||
/* Write the footprint list */
|
/* Write the footprint list */
|
||||||
for( unsigned int jj = 0; jj < FilterCount; jj++ )
|
for( unsigned int jj = 0; jj < FilterCount; jj++ )
|
||||||
{
|
{
|
||||||
fprintf( dest, " %s\n",
|
fprintf( file, " %s\n",
|
||||||
CONV_TO_UTF8( component->m_FootprintFilter[jj] ) );
|
CONV_TO_UTF8( component->m_FootprintFilter[jj] ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf( dest, "$endlist\n" );
|
fprintf( file, "$endlist\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( WriteHeader )
|
if( WriteHeader )
|
||||||
fprintf( dest, "$endfootprintlist\n}\n" );
|
fprintf( file, "$endfootprintlist\n}\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
set(EESCHEMA_SRCS
|
set(EESCHEMA_SRCS
|
||||||
affiche.cpp
|
# affiche.cpp
|
||||||
annotate.cpp
|
annotate.cpp
|
||||||
annotate_dialog.cpp
|
annotate_dialog.cpp
|
||||||
backanno.cpp
|
backanno.cpp
|
||||||
|
@ -113,7 +113,9 @@ set(EESCHEMA_SRCS
|
||||||
viewlibs.cpp)
|
viewlibs.cpp)
|
||||||
|
|
||||||
set(EESCHEMA_EXTRA_SRCS
|
set(EESCHEMA_EXTRA_SRCS
|
||||||
../share/setpage.cpp)
|
../common/sch_item_struct.cpp
|
||||||
|
../share/setpage.cpp
|
||||||
|
)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
if(MINGW)
|
if(MINGW)
|
||||||
|
|
|
@ -1,197 +0,0 @@
|
||||||
/**********************************************************/
|
|
||||||
/* Routines d'affichage de parametres et caracteristiques */
|
|
||||||
/**********************************************************/
|
|
||||||
|
|
||||||
/* Fichier AFFICHE.CPP */
|
|
||||||
|
|
||||||
#include "fctsys.h"
|
|
||||||
#include "gr_basic.h"
|
|
||||||
#include "common.h"
|
|
||||||
#include "wxstruct.h"
|
|
||||||
#include "program.h"
|
|
||||||
#include "libcmp.h"
|
|
||||||
#include "general.h"
|
|
||||||
|
|
||||||
#include "protos.h"
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
|
||||||
void DrawSheetStruct::Display_Infos( WinEDA_DrawFrame* frame )
|
|
||||||
/************************************************************/
|
|
||||||
{
|
|
||||||
frame->MsgPanel->EraseMsgBox();
|
|
||||||
Affiche_1_Parametre( frame, 1, _( "Name" ), m_SheetName, CYAN );
|
|
||||||
Affiche_1_Parametre( frame, 30, _( "FileName" ), m_FileName, BROWN );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************/
|
|
||||||
void SCH_COMPONENT::Display_Infos( WinEDA_DrawFrame* frame )
|
|
||||||
/***************************************************************/
|
|
||||||
{
|
|
||||||
EDA_LibComponentStruct* Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT );;
|
|
||||||
|
|
||||||
wxString msg;
|
|
||||||
|
|
||||||
frame->MsgPanel->EraseMsgBox();
|
|
||||||
|
|
||||||
Affiche_1_Parametre( frame, 1, _( "Ref" ),
|
|
||||||
GetRef(((WinEDA_SchematicFrame*)frame)->GetSheet()), DARKCYAN );
|
|
||||||
|
|
||||||
if( Entry && Entry->m_Options == ENTRY_POWER )
|
|
||||||
msg = _( "Pwr Symb" );
|
|
||||||
else
|
|
||||||
msg = _( "Val" );
|
|
||||||
|
|
||||||
Affiche_1_Parametre( frame, 10, msg, GetField(VALUE)->m_Text, DARKCYAN );
|
|
||||||
|
|
||||||
Affiche_1_Parametre( frame, 28, _( "RefLib" ), m_ChipName.GetData(), BROWN );
|
|
||||||
|
|
||||||
msg = FindLibName;
|
|
||||||
Affiche_1_Parametre( frame, 40, _( "Lib" ), msg, DARKRED );
|
|
||||||
|
|
||||||
if( Entry )
|
|
||||||
{
|
|
||||||
Affiche_1_Parametre( frame, 52, Entry->m_Doc, Entry->m_KeyWord, DARKCYAN );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************/
|
|
||||||
void LibDrawPin::Display_Infos( WinEDA_DrawFrame* frame )
|
|
||||||
/*******************************************************/
|
|
||||||
|
|
||||||
/* Affiche en bas d'ecran les caracteristiques de la pin
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
wxString Text;
|
|
||||||
int ii;
|
|
||||||
|
|
||||||
frame->MsgPanel->EraseMsgBox();
|
|
||||||
|
|
||||||
/* Affichage du nom */
|
|
||||||
Affiche_1_Parametre( frame, 30, _( "PinName" ), m_PinName, DARKCYAN );
|
|
||||||
|
|
||||||
/* Affichage du numero */
|
|
||||||
if( m_PinNum == 0 )
|
|
||||||
Text = wxT( "?" );
|
|
||||||
else
|
|
||||||
ReturnPinStringNum( Text );
|
|
||||||
|
|
||||||
Affiche_1_Parametre( frame, 38, _( "PinNum" ), Text, DARKCYAN );
|
|
||||||
|
|
||||||
/* Affichage du type */
|
|
||||||
ii = m_PinType;
|
|
||||||
Affiche_1_Parametre( frame, 44, _( "PinType" ), MsgPinElectricType[ii], RED );
|
|
||||||
|
|
||||||
/* Affichage de la visiblite */
|
|
||||||
ii = m_Attributs;
|
|
||||||
if( ii & 1 )
|
|
||||||
Text = _( "no" );
|
|
||||||
else
|
|
||||||
Text = _( "yes" );
|
|
||||||
Affiche_1_Parametre( frame, 50, _( "Display" ), Text, DARKGREEN );
|
|
||||||
|
|
||||||
/* Display pin length */
|
|
||||||
Text = ReturnStringFromValue( g_UnitMetric, m_PinLen, EESCHEMA_INTERNAL_UNIT, true );
|
|
||||||
Affiche_1_Parametre( frame, 56, _( "Length" ), Text, MAGENTA );
|
|
||||||
|
|
||||||
/* Affichage de l'orientation */
|
|
||||||
switch( m_Orient )
|
|
||||||
{
|
|
||||||
case PIN_UP:
|
|
||||||
Text = _( "Up" ); break;
|
|
||||||
|
|
||||||
case PIN_DOWN:
|
|
||||||
Text = _( "Down" ); break;
|
|
||||||
|
|
||||||
case PIN_LEFT:
|
|
||||||
Text = _( "Left" ); break;
|
|
||||||
|
|
||||||
case PIN_RIGHT:
|
|
||||||
Text = _( "Right" ); break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
Text = wxT( "??" ); break;
|
|
||||||
}
|
|
||||||
|
|
||||||
Affiche_1_Parametre( frame, 62, _( "Orient" ), Text, MAGENTA );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
void LibEDA_BaseStruct::Display_Infos_DrawEntry( WinEDA_DrawFrame* frame )
|
|
||||||
/***********************************************************************/
|
|
||||||
|
|
||||||
/* Affiche en bas d'ecran les caracteristiques de l'element
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
wxString msg;
|
|
||||||
int thickness = 0;
|
|
||||||
|
|
||||||
frame->MsgPanel->EraseMsgBox();
|
|
||||||
|
|
||||||
/* affichage du type */
|
|
||||||
msg = wxT( "??" );
|
|
||||||
|
|
||||||
switch( Type() )
|
|
||||||
{
|
|
||||||
case COMPONENT_ARC_DRAW_TYPE:
|
|
||||||
thickness = ( (LibDrawArc*) this )->m_Width;
|
|
||||||
msg = wxT( "Arc" ); break;
|
|
||||||
|
|
||||||
case COMPONENT_CIRCLE_DRAW_TYPE:
|
|
||||||
thickness = ( (LibDrawCircle*) this )->m_Width;
|
|
||||||
msg = wxT( "Circle" ); break;
|
|
||||||
|
|
||||||
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
|
||||||
thickness = ( (LibDrawText*) this )->m_Width;
|
|
||||||
msg = wxT( "Text" ); break;
|
|
||||||
|
|
||||||
case COMPONENT_RECT_DRAW_TYPE:
|
|
||||||
thickness = ( (LibDrawSquare*) this )->m_Width;
|
|
||||||
msg = wxT( "Rect" ); break;
|
|
||||||
|
|
||||||
case COMPONENT_POLYLINE_DRAW_TYPE:
|
|
||||||
thickness = ( (LibDrawPolyline*) this )->m_Width;
|
|
||||||
msg = wxT( "PolyLine" ); break;
|
|
||||||
|
|
||||||
case COMPONENT_LINE_DRAW_TYPE:
|
|
||||||
thickness = ( (LibDrawSegment*) this )->m_Width;
|
|
||||||
msg = wxT( "Segment" ); break;
|
|
||||||
|
|
||||||
case COMPONENT_PIN_DRAW_TYPE:
|
|
||||||
( (LibDrawPin*) this )->Display_Infos( frame );
|
|
||||||
msg = wxT( "Pin" );
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
Affiche_1_Parametre( frame, 1, wxT( "Type" ), msg, CYAN );
|
|
||||||
|
|
||||||
|
|
||||||
/* Affichage de l'appartenance */
|
|
||||||
if( m_Unit == 0 )
|
|
||||||
msg = _( "All" );
|
|
||||||
else
|
|
||||||
msg.Printf( wxT( "%d" ), m_Unit );
|
|
||||||
Affiche_1_Parametre( frame, 8, _( "Unit" ), msg, BROWN );
|
|
||||||
|
|
||||||
if( m_Convert == 0 )
|
|
||||||
msg = _( "All" );
|
|
||||||
else if( m_Convert == 1 )
|
|
||||||
msg = _( "no" );
|
|
||||||
else if( m_Convert == 2 )
|
|
||||||
msg = _( "yes" );
|
|
||||||
else
|
|
||||||
msg = wxT( "?" );
|
|
||||||
Affiche_1_Parametre( frame, 14, _( "Convert" ), msg, BROWN );
|
|
||||||
|
|
||||||
if( thickness )
|
|
||||||
msg = ReturnStringFromValue( g_UnitMetric, thickness, EESCHEMA_INTERNAL_UNIT, true );
|
|
||||||
else
|
|
||||||
msg = _( "default" );
|
|
||||||
Affiche_1_Parametre( frame, 20, _( "Thickness" ), msg, BLUE );
|
|
||||||
}
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "gestfich.h"
|
#include "gestfich.h"
|
||||||
#include "libcmp.h"
|
#include "libcmp.h"
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
|
#include "appl_wxstruct.h"
|
||||||
|
|
||||||
/* Variables Locales */
|
/* Variables Locales */
|
||||||
|
|
||||||
|
@ -146,7 +147,7 @@ bool WinEDA_SchematicFrame::ReadInputStuffFile()
|
||||||
if( filename.IsEmpty() )
|
if( filename.IsEmpty() )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
Line = g_Main_Title + wxT( " " ) + GetBuildVersion();
|
Line = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
|
||||||
Line += wxT( " " ) + filename;
|
Line += wxT( " " ) + filename;
|
||||||
SetTitle( Line );
|
SetTitle( Line );
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
#include "class_drawpanel.h"
|
#include "class_drawpanel.h"
|
||||||
#include "confirm.h"
|
#include "confirm.h"
|
||||||
#include "block_commande.h"
|
#include "block_commande.h"
|
||||||
|
#include "class_drawpickedstruct.h"
|
||||||
|
|
||||||
#include "program.h"
|
#include "program.h"
|
||||||
#include "libcmp.h"
|
#include "libcmp.h"
|
||||||
|
@ -595,10 +596,11 @@ bool MoveStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct )
|
||||||
if( DC )
|
if( DC )
|
||||||
panel->PostDirtyRect( pickedList->GetBoundingBoxUnion() );
|
panel->PostDirtyRect( pickedList->GetBoundingBoxUnion() );
|
||||||
|
|
||||||
PlaceStruct( panel->GetScreen(), pickedList ); // Place it in its new position.
|
PlaceStruct( panel->GetScreen(), (SCH_ITEM *) pickedList ); // Place it in its new position.
|
||||||
|
|
||||||
if( DC )
|
if( DC )
|
||||||
RedrawStructList( panel, DC, pickedList, GR_DEFAULT_DRAWMODE );
|
RedrawStructList( panel, DC, (SCH_ITEM *) pickedList,
|
||||||
|
GR_DEFAULT_DRAWMODE );
|
||||||
|
|
||||||
// Free the wrapper DrawPickedStruct chain
|
// Free the wrapper DrawPickedStruct chain
|
||||||
pickedList->DeleteWrapperList();
|
pickedList->DeleteWrapperList();
|
||||||
|
@ -808,7 +810,8 @@ bool MirrorStruct( WinEDA_DrawPanel* panel,
|
||||||
}
|
}
|
||||||
|
|
||||||
if( DC )
|
if( DC )
|
||||||
RedrawStructList( panel, DC, pickedList, GR_DEFAULT_DRAWMODE );
|
RedrawStructList( panel, DC, (SCH_ITEM*) pickedList,
|
||||||
|
GR_DEFAULT_DRAWMODE );
|
||||||
|
|
||||||
// Free the wrapper DrawPickedStruct chain
|
// Free the wrapper DrawPickedStruct chain
|
||||||
pickedList->DeleteWrapperList();
|
pickedList->DeleteWrapperList();
|
||||||
|
@ -899,7 +902,7 @@ static SCH_ITEM* CopyStruct( WinEDA_DrawPanel* panel,
|
||||||
while( PickedList )
|
while( PickedList )
|
||||||
{
|
{
|
||||||
PickedList->m_PickedStruct->SetNext( screen->EEDrawList );
|
PickedList->m_PickedStruct->SetNext( screen->EEDrawList );
|
||||||
screen->EEDrawList = PickedList->m_PickedStruct;
|
screen->EEDrawList = (SCH_ITEM*) PickedList->m_PickedStruct;
|
||||||
PickedList = PickedList->Next();
|
PickedList = PickedList->Next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -988,7 +991,7 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct )
|
||||||
cur;
|
cur;
|
||||||
cur = cur->Next() )
|
cur = cur->Next() )
|
||||||
{
|
{
|
||||||
SCH_ITEM* item = cur->m_PickedStruct;
|
SCH_ITEM* item = (SCH_ITEM*)cur->m_PickedStruct;
|
||||||
screen->RemoveFromDrawList( item );
|
screen->RemoveFromDrawList( item );
|
||||||
panel->PostDirtyRect( item->GetBoundingBox() );
|
panel->PostDirtyRect( item->GetBoundingBox() );
|
||||||
item->SetNext( 0 );
|
item->SetNext( 0 );
|
||||||
|
@ -1103,7 +1106,7 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
|
||||||
RedrawStructList( DrawPanel, DC, DrawStruct, GR_DEFAULT_DRAWMODE );
|
RedrawStructList( DrawPanel, DC, DrawStruct, GR_DEFAULT_DRAWMODE );
|
||||||
for( PickedList = (DrawPickedStruct*) DrawStruct; PickedList != NULL; )
|
for( PickedList = (DrawPickedStruct*) DrawStruct; PickedList != NULL; )
|
||||||
{
|
{
|
||||||
SCH_ITEM* Struct = PickedList->m_PickedStruct;
|
SCH_ITEM* Struct = (SCH_ITEM*) PickedList->m_PickedStruct;
|
||||||
Struct->SetNext( GetScreen()->EEDrawList );
|
Struct->SetNext( GetScreen()->EEDrawList );
|
||||||
SetaParent( Struct, GetScreen() );
|
SetaParent( Struct, GetScreen() );
|
||||||
GetScreen()->EEDrawList = Struct;
|
GetScreen()->EEDrawList = Struct;
|
||||||
|
@ -1179,7 +1182,8 @@ bool PlaceStruct( BASE_SCREEN* screen, SCH_ITEM* DrawStruct )
|
||||||
DrawStructs = (DrawPickedStruct*) DrawStruct;
|
DrawStructs = (DrawPickedStruct*) DrawStruct;
|
||||||
while( DrawStructs )
|
while( DrawStructs )
|
||||||
{
|
{
|
||||||
MoveOneStruct( DrawStructs->m_PickedStruct, move_vector );
|
MoveOneStruct( (SCH_ITEM*) DrawStructs->m_PickedStruct,
|
||||||
|
move_vector );
|
||||||
DrawStructs = DrawStructs->Next();
|
DrawStructs = DrawStructs->Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1383,12 +1387,12 @@ SCH_ITEM* DuplicateStruct( SCH_ITEM* DrawStruct )
|
||||||
{
|
{
|
||||||
NewPickedItem = new DrawPickedStruct();
|
NewPickedItem = new DrawPickedStruct();
|
||||||
if( NewDrawStruct == NULL )
|
if( NewDrawStruct == NULL )
|
||||||
NewDrawStruct = NewPickedItem;
|
NewDrawStruct = (SCH_ITEM*) NewPickedItem;
|
||||||
if( LastPickedItem )
|
if( LastPickedItem )
|
||||||
LastPickedItem->SetNext( NewPickedItem );
|
LastPickedItem->SetNext( NewPickedItem );
|
||||||
LastPickedItem = NewPickedItem;
|
LastPickedItem = NewPickedItem;
|
||||||
NewPickedItem->m_PickedStruct =
|
NewPickedItem->m_PickedStruct =
|
||||||
DuplicateStruct( PickedList->m_PickedStruct );
|
DuplicateStruct( (SCH_ITEM*) PickedList->m_PickedStruct );
|
||||||
PickedList = PickedList->Next();
|
PickedList = PickedList->Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1445,7 +1449,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
|
||||||
(DrawPickedStruct*) screen->BlockLocate.m_BlockDrawStruct;
|
(DrawPickedStruct*) screen->BlockLocate.m_BlockDrawStruct;
|
||||||
while( DrawStructs )
|
while( DrawStructs )
|
||||||
{
|
{
|
||||||
Struct = DrawStructs->m_PickedStruct;
|
Struct = (SCH_ITEM*) DrawStructs->m_PickedStruct;
|
||||||
DrawStructs = DrawStructs->Next();
|
DrawStructs = DrawStructs->Next();
|
||||||
Struct->m_Flags = SELECTED;
|
Struct->m_Flags = SELECTED;
|
||||||
}
|
}
|
||||||
|
@ -1481,7 +1485,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
|
||||||
DrawStructs = (DrawPickedStruct*) screen->BlockLocate.m_BlockDrawStruct;
|
DrawStructs = (DrawPickedStruct*) screen->BlockLocate.m_BlockDrawStruct;
|
||||||
while( DrawStructs )
|
while( DrawStructs )
|
||||||
{
|
{
|
||||||
Struct = DrawStructs->m_PickedStruct;
|
Struct = (SCH_ITEM*) DrawStructs->m_PickedStruct;
|
||||||
DrawStructs = DrawStructs->Next();
|
DrawStructs = DrawStructs->Next();
|
||||||
if( Struct->Type() == DRAW_SEGMENT_STRUCT_TYPE )
|
if( Struct->Type() == DRAW_SEGMENT_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
|
@ -1500,11 +1504,10 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
|
||||||
*/
|
*/
|
||||||
|
|
||||||
FirstPicked = DrawStructs =
|
FirstPicked = DrawStructs =
|
||||||
(DrawPickedStruct*) screen->BlockLocate.
|
(DrawPickedStruct*) screen->BlockLocate.m_BlockDrawStruct;
|
||||||
m_BlockDrawStruct;
|
|
||||||
while( DrawStructs )
|
while( DrawStructs )
|
||||||
{
|
{
|
||||||
Struct = DrawStructs->m_PickedStruct;
|
Struct = (SCH_ITEM*) DrawStructs->m_PickedStruct;
|
||||||
DrawStructs = DrawStructs->Next();
|
DrawStructs = DrawStructs->Next();
|
||||||
if( Struct->Type() == TYPE_SCH_COMPONENT )
|
if( Struct->Type() == TYPE_SCH_COMPONENT )
|
||||||
{ // Add all pins of the selected component to list
|
{ // Add all pins of the selected component to list
|
||||||
|
@ -1557,7 +1560,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
|
||||||
DrawStructs = (DrawPickedStruct*) screen->BlockLocate.m_BlockDrawStruct;
|
DrawStructs = (DrawPickedStruct*) screen->BlockLocate.m_BlockDrawStruct;
|
||||||
while( DrawStructs )
|
while( DrawStructs )
|
||||||
{
|
{
|
||||||
Struct = DrawStructs->m_PickedStruct;
|
Struct = (SCH_ITEM*) DrawStructs->m_PickedStruct;
|
||||||
DrawStructs = (DrawPickedStruct*) DrawStructs->Next();
|
DrawStructs = (DrawPickedStruct*) DrawStructs->Next();
|
||||||
|
|
||||||
switch( Struct->Type() )
|
switch( Struct->Type() )
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "confirm.h"
|
#include "confirm.h"
|
||||||
#include "kicad_string.h"
|
#include "kicad_string.h"
|
||||||
#include "gestfich.h"
|
#include "gestfich.h"
|
||||||
|
#include "appl_wxstruct.h"
|
||||||
#include "program.h"
|
#include "program.h"
|
||||||
#include "libcmp.h"
|
#include "libcmp.h"
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
|
@ -47,7 +48,8 @@ public:
|
||||||
|
|
||||||
|
|
||||||
// Filename extension for BOM list
|
// Filename extension for BOM list
|
||||||
#define EXT_LIST wxT( ".lst" )
|
static const wxString BomFileExtension( wxT( "lst" ) );
|
||||||
|
static const wxString BomFileWildcard( wxT( "Bill of Materials file (*.lst)|*.lst" ) );
|
||||||
|
|
||||||
|
|
||||||
/* Local functions */
|
/* Local functions */
|
||||||
|
@ -80,31 +82,23 @@ void DIALOG_BUILD_BOM::Create_BOM_Lists( bool aTypeFileIsExport,
|
||||||
bool aRunBrowser )
|
bool aRunBrowser )
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
{
|
{
|
||||||
|
wxFileName fn;
|
||||||
wxString mask, filename;
|
wxString mask, filename;
|
||||||
|
|
||||||
s_ExportSeparatorSymbol = aExportSeparatorSymbol;
|
s_ExportSeparatorSymbol = aExportSeparatorSymbol;
|
||||||
|
|
||||||
m_ListFileName = g_RootSheet->m_AssociatedScreen->m_FileName;
|
m_ListFileName = g_RootSheet->m_AssociatedScreen->m_FileName;
|
||||||
ChangeFileNameExt( m_ListFileName, EXT_LIST );
|
fn = m_ListFileName;
|
||||||
|
fn.SetExt( BomFileExtension );
|
||||||
|
|
||||||
//need to get rid of the path.
|
wxFileDialog dlg( this, _( "Bill of Materials" ), fn.GetPath(),
|
||||||
m_ListFileName = m_ListFileName.AfterLast( '/' );
|
fn.GetFullName(), BomFileWildcard,
|
||||||
mask = wxT( "*" );
|
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||||
mask += EXT_LIST;
|
|
||||||
|
|
||||||
filename = EDA_FileSelector( _( "Bill of materials:" ),
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
wxEmptyString, /* Chemin par defaut (ici dir courante) */
|
|
||||||
m_ListFileName, /* nom fichier par defaut, et resultat */
|
|
||||||
EXT_LIST, /* extension par defaut */
|
|
||||||
mask, /* Masque d'affichage */
|
|
||||||
this,
|
|
||||||
wxFD_SAVE,
|
|
||||||
TRUE
|
|
||||||
);
|
|
||||||
if( filename.IsEmpty() )
|
|
||||||
return;
|
return;
|
||||||
else
|
|
||||||
m_ListFileName = filename;
|
m_ListFileName = dlg.GetPath();
|
||||||
|
|
||||||
/* Close dialog, then show the list (if so requested) */
|
/* Close dialog, then show the list (if so requested) */
|
||||||
|
|
||||||
|
@ -117,7 +111,7 @@ void DIALOG_BUILD_BOM::Create_BOM_Lists( bool aTypeFileIsExport,
|
||||||
|
|
||||||
if( aRunBrowser )
|
if( aRunBrowser )
|
||||||
{
|
{
|
||||||
wxString editorname = GetEditorName();
|
wxString editorname = wxGetApp().GetEditorName();
|
||||||
AddDelimiterString( filename );
|
AddDelimiterString( filename );
|
||||||
ExecuteFile( this, editorname, filename );
|
ExecuteFile( this, editorname, filename );
|
||||||
}
|
}
|
||||||
|
@ -194,7 +188,8 @@ void DIALOG_BUILD_BOM::GenereListeOfItems( const wxString& aFullFileName,
|
||||||
{
|
{
|
||||||
/* creates the list file */
|
/* creates the list file */
|
||||||
DateAndTime( Line );
|
DateAndTime( Line );
|
||||||
wxString Title = g_Main_Title + wxT( " " ) + GetBuildVersion();
|
wxString Title = wxGetApp().GetAppName() + wxT( " " ) +
|
||||||
|
GetBuildVersion();
|
||||||
fprintf( f, "%s >> Creation date: %s\n", CONV_TO_UTF8( Title ), Line );
|
fprintf( f, "%s >> Creation date: %s\n", CONV_TO_UTF8( Title ), Line );
|
||||||
|
|
||||||
/* sort component list */
|
/* sort component list */
|
||||||
|
|
|
@ -686,6 +686,15 @@ bool DrawSheetStruct::ChangeFileName( WinEDA_SchematicFrame* aFrame,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************/
|
||||||
|
void DrawSheetStruct::Display_Infos( WinEDA_DrawFrame* frame )
|
||||||
|
{
|
||||||
|
frame->MsgPanel->EraseMsgBox();
|
||||||
|
Affiche_1_Parametre( frame, 1, _( "Name" ), m_SheetName, CYAN );
|
||||||
|
Affiche_1_Parametre( frame, 30, _( "FileName" ), m_FileName, BROWN );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
void DrawSheetStruct::Show( int nestLevel, std::ostream& os )
|
void DrawSheetStruct::Show( int nestLevel, std::ostream& os )
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,10 +5,6 @@
|
||||||
#ifndef CLASS_DRAWSHEET_H
|
#ifndef CLASS_DRAWSHEET_H
|
||||||
#define CLASS_DRAWSHEET_H
|
#define CLASS_DRAWSHEET_H
|
||||||
|
|
||||||
#ifndef eda_global
|
|
||||||
#define eda_global extern
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "base_struct.h"
|
#include "base_struct.h"
|
||||||
|
|
||||||
extern DrawSheetStruct* g_RootSheet;
|
extern DrawSheetStruct* g_RootSheet;
|
||||||
|
|
|
@ -5,10 +5,6 @@
|
||||||
#ifndef CLASS_DRAWSHEET_PATH_H
|
#ifndef CLASS_DRAWSHEET_PATH_H
|
||||||
#define CLASS_DRAWSHEET_PATH_H
|
#define CLASS_DRAWSHEET_PATH_H
|
||||||
|
|
||||||
#ifndef eda_global
|
|
||||||
#define eda_global extern
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "base_struct.h"
|
#include "base_struct.h"
|
||||||
|
|
||||||
/** Info about complex hierarchies handling:
|
/** Info about complex hierarchies handling:
|
||||||
|
|
|
@ -1,22 +1,155 @@
|
||||||
/**********************************************************/
|
/**********************************************************/
|
||||||
/* lib_entry.cpp */
|
/* lib_entry.cpp */
|
||||||
/**********************************************************/
|
/**********************************************************/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "kicad_string.h"
|
||||||
|
#include "confirm.h"
|
||||||
|
|
||||||
#include "program.h"
|
#include "program.h"
|
||||||
#include "libcmp.h"
|
#include "libcmp.h"
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
|
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
|
#include <wx/tokenzr.h>
|
||||||
|
#include <wx/txtstrm.h>
|
||||||
|
|
||||||
|
|
||||||
|
int SortItemsFct(const void* ref, const void* item)
|
||||||
|
{
|
||||||
|
#define Ref ( *(LibEDA_BaseStruct**) (ref) )
|
||||||
|
#define Item ( *(LibEDA_BaseStruct**) (item) )
|
||||||
|
#define BEFORE -1
|
||||||
|
#define AFTER 1
|
||||||
|
|
||||||
|
int fill_ref = 0, fill_item = 0;
|
||||||
|
|
||||||
|
switch( Ref->Type() )
|
||||||
|
{
|
||||||
|
case COMPONENT_ARC_DRAW_TYPE:
|
||||||
|
{
|
||||||
|
const LibDrawArc* draw = (const LibDrawArc*) Ref;
|
||||||
|
fill_ref = draw->m_Fill;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case COMPONENT_CIRCLE_DRAW_TYPE:
|
||||||
|
{
|
||||||
|
const LibDrawCircle* draw = (const LibDrawCircle*) Ref;
|
||||||
|
fill_ref = draw->m_Fill;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case COMPONENT_RECT_DRAW_TYPE:
|
||||||
|
{
|
||||||
|
const LibDrawSquare* draw = (const LibDrawSquare*) Ref;
|
||||||
|
fill_ref = draw->m_Fill;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case COMPONENT_POLYLINE_DRAW_TYPE:
|
||||||
|
{
|
||||||
|
const LibDrawPolyline* draw = (const LibDrawPolyline*) Ref;
|
||||||
|
fill_ref = draw->m_Fill;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
||||||
|
if( Item->Type() == COMPONENT_PIN_DRAW_TYPE )
|
||||||
|
return BEFORE;
|
||||||
|
if( Item->Type() == COMPONENT_GRAPHIC_TEXT_DRAW_TYPE )
|
||||||
|
return 0;
|
||||||
|
return 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case COMPONENT_PIN_DRAW_TYPE:
|
||||||
|
if( Item->Type() == COMPONENT_PIN_DRAW_TYPE )
|
||||||
|
{
|
||||||
|
int ii;
|
||||||
|
|
||||||
|
// Sort the pins by orientation
|
||||||
|
ii = ( (LibDrawPin*) Ref )->m_Orient -
|
||||||
|
( (LibDrawPin*) Item )->m_Orient;
|
||||||
|
if( ii )
|
||||||
|
return ii;
|
||||||
|
|
||||||
|
/* We sort the pins by position (x or y).
|
||||||
|
* note: at this point, most of pins have same x pos or y pos,
|
||||||
|
* because they are sorted by orientation and generally are
|
||||||
|
* vertically or horizontally aligned */
|
||||||
|
wxPoint pos_ref, pos_tst;
|
||||||
|
pos_ref = ( (LibDrawPin*) Ref )->m_Pos;
|
||||||
|
pos_tst = ( (LibDrawPin*) Item )->m_Pos;
|
||||||
|
if( (ii = pos_ref.x - pos_tst.x) )
|
||||||
|
return ii;
|
||||||
|
ii = pos_ref.y - pos_tst.y;
|
||||||
|
return ii;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return AFTER;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Test de l'item */
|
||||||
|
switch( Item->Type() )
|
||||||
|
{
|
||||||
|
case COMPONENT_ARC_DRAW_TYPE:
|
||||||
|
{
|
||||||
|
const LibDrawArc* draw = (const LibDrawArc*) Item;
|
||||||
|
fill_item = draw->m_Fill;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case COMPONENT_CIRCLE_DRAW_TYPE:
|
||||||
|
{
|
||||||
|
const LibDrawCircle* draw = (const LibDrawCircle*) Item;
|
||||||
|
fill_item = draw->m_Fill;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case COMPONENT_RECT_DRAW_TYPE:
|
||||||
|
{
|
||||||
|
const LibDrawSquare* draw = (const LibDrawSquare*) Item;
|
||||||
|
fill_item = draw->m_Fill;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case COMPONENT_POLYLINE_DRAW_TYPE:
|
||||||
|
{
|
||||||
|
const LibDrawPolyline* draw = (const LibDrawPolyline*) Item;
|
||||||
|
fill_item = draw->m_Fill;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
||||||
|
return BEFORE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case COMPONENT_PIN_DRAW_TYPE:
|
||||||
|
return BEFORE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( fill_ref & fill_item )
|
||||||
|
return 0;
|
||||||
|
if( fill_ref )
|
||||||
|
return BEFORE;
|
||||||
|
return AFTER;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************/
|
/*********************/
|
||||||
/* class LibCmpEntry */
|
/* class LibCmpEntry */
|
||||||
/*********************/
|
/*********************/
|
||||||
|
|
||||||
/* Basic class for librarty oomponent description
|
/* Basic class for library component description
|
||||||
* Not directly used
|
* Not directly used
|
||||||
* Used to create the 2 derived classes :
|
* Used to create the 2 derived classes :
|
||||||
* - EDA_LibCmpAliasStruct
|
* - EDA_LibCmpAliasStruct
|
||||||
|
@ -26,7 +159,6 @@
|
||||||
/********************************************************************/
|
/********************************************************************/
|
||||||
LibCmpEntry::LibCmpEntry( LibrEntryType CmpType, const wxChar* CmpName ) :
|
LibCmpEntry::LibCmpEntry( LibrEntryType CmpType, const wxChar* CmpName ) :
|
||||||
EDA_BaseStruct( LIBCOMPONENT_STRUCT_TYPE )
|
EDA_BaseStruct( LIBCOMPONENT_STRUCT_TYPE )
|
||||||
/********************************************************************/
|
|
||||||
{
|
{
|
||||||
Type = CmpType;
|
Type = CmpType;
|
||||||
m_Name.m_FieldId = VALUE;
|
m_Name.m_FieldId = VALUE;
|
||||||
|
@ -37,7 +169,6 @@ LibCmpEntry::LibCmpEntry( LibrEntryType CmpType, const wxChar* CmpName ) :
|
||||||
|
|
||||||
/******************************/
|
/******************************/
|
||||||
LibCmpEntry::~LibCmpEntry()
|
LibCmpEntry::~LibCmpEntry()
|
||||||
/******************************/
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,15 +178,16 @@ LibCmpEntry::~LibCmpEntry()
|
||||||
/*******************************/
|
/*******************************/
|
||||||
|
|
||||||
/* Class to define an alias of a component
|
/* Class to define an alias of a component
|
||||||
* An alias uses the component defintion (graphic, pins...)
|
* An alias uses the component definition (graphic, pins...)
|
||||||
* but has its own name and documentation.
|
* but has its own name and documentation.
|
||||||
* Therefore, when the component is modified, alias of this component are modified.
|
* Therefore, when the component is modified, alias of this component are
|
||||||
|
* modified.
|
||||||
* This is a simple method to create components with differs very few
|
* This is a simple method to create components with differs very few
|
||||||
* (like 74LS00, 74HC00 ... and many op amps )
|
* (like 74LS00, 74HC00 ... and many op amps )
|
||||||
*/
|
*/
|
||||||
|
|
||||||
EDA_LibCmpAliasStruct:: EDA_LibCmpAliasStruct( const wxChar* CmpName,
|
EDA_LibCmpAliasStruct::EDA_LibCmpAliasStruct( const wxChar* CmpName,
|
||||||
const wxChar* CmpRootName ) :
|
const wxChar* CmpRootName ) :
|
||||||
LibCmpEntry( ALIAS, CmpName )
|
LibCmpEntry( ALIAS, CmpName )
|
||||||
{
|
{
|
||||||
if( CmpRootName == NULL )
|
if( CmpRootName == NULL )
|
||||||
|
@ -85,19 +217,21 @@ EDA_LibComponentStruct:: EDA_LibComponentStruct( const wxChar* CmpName ) :
|
||||||
m_TextInside = 40;
|
m_TextInside = 40;
|
||||||
m_Options = ENTRY_NORMAL;
|
m_Options = ENTRY_NORMAL;
|
||||||
m_UnitSelectionLocked = FALSE;
|
m_UnitSelectionLocked = FALSE;
|
||||||
m_DrawPinNum = m_DrawPinName = 1;
|
m_DrawPinNum = 1;
|
||||||
|
m_DrawPinName = 1;
|
||||||
m_Prefix.m_FieldId = REFERENCE;
|
m_Prefix.m_FieldId = REFERENCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************/
|
|
||||||
EDA_LibComponentStruct::~EDA_LibComponentStruct()
|
EDA_LibComponentStruct::~EDA_LibComponentStruct()
|
||||||
/******************************************************/
|
|
||||||
{
|
{
|
||||||
LibEDA_BaseStruct* DrawItem, * NextDrawItem;
|
LibEDA_BaseStruct* DrawItem;
|
||||||
|
LibEDA_BaseStruct* NextDrawItem;
|
||||||
|
|
||||||
/* suppression des elements dependants */
|
/* suppression des elements dependants */
|
||||||
DrawItem = m_Drawings; m_Drawings = NULL;
|
DrawItem = m_Drawings;
|
||||||
|
m_Drawings = NULL;
|
||||||
|
|
||||||
while( DrawItem )
|
while( DrawItem )
|
||||||
{
|
{
|
||||||
NextDrawItem = DrawItem->Next();
|
NextDrawItem = DrawItem->Next();
|
||||||
|
@ -107,156 +241,443 @@ EDA_LibComponentStruct::~EDA_LibComponentStruct()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************/
|
/**
|
||||||
EDA_Rect EDA_LibComponentStruct::GetBoundaryBox( int Unit, int Convert )
|
* Function Save
|
||||||
/**********************************************************************/
|
* writes the data structures for this object out to a FILE in "*.brd" format.
|
||||||
|
* @param aFile The FILE to write to.
|
||||||
|
* @return bool - true if success writing else false.
|
||||||
|
*/
|
||||||
|
bool EDA_LibComponentStruct::Save( FILE* aFile )
|
||||||
|
{
|
||||||
|
LibEDA_BaseStruct* DrawEntry;
|
||||||
|
LibDrawField* Field;
|
||||||
|
|
||||||
/* Return the componenty boundary box ( in user coordinates )
|
if( Type != ROOT ) // should not happen, but just in case
|
||||||
|
return false;
|
||||||
|
|
||||||
|
/* First line: it s a comment (component name for readers) */
|
||||||
|
fprintf( aFile, "#\n# %s\n#\n", CONV_TO_UTF8( m_Name.m_Text ) );
|
||||||
|
|
||||||
|
/* Save data */
|
||||||
|
fprintf( aFile, "DEF" );
|
||||||
|
if( (m_Name.m_Attributs & TEXT_NO_VISIBLE) == 0 )
|
||||||
|
fprintf( aFile, " %s", CONV_TO_UTF8( m_Name.m_Text ) );
|
||||||
|
else
|
||||||
|
fprintf( aFile, " ~%s", CONV_TO_UTF8( m_Name.m_Text ) );
|
||||||
|
|
||||||
|
if( !m_Prefix.m_Text.IsEmpty() )
|
||||||
|
fprintf( aFile, " %s", CONV_TO_UTF8( m_Prefix.m_Text ) );
|
||||||
|
else
|
||||||
|
fprintf( aFile, " ~" );
|
||||||
|
fprintf( aFile, " %d %d %c %c %d %c %c\n",
|
||||||
|
0, m_TextInside,
|
||||||
|
m_DrawPinNum ? 'Y' : 'N',
|
||||||
|
m_DrawPinName ? 'Y' : 'N',
|
||||||
|
m_UnitCount, m_UnitSelectionLocked ? 'L' : 'F',
|
||||||
|
m_Options == ENTRY_POWER ? 'P' : 'N' );
|
||||||
|
|
||||||
|
SaveDateAndTime( aFile );
|
||||||
|
|
||||||
|
/* Save fields */
|
||||||
|
m_Prefix.Save( aFile );
|
||||||
|
m_Name.Save( aFile );
|
||||||
|
|
||||||
|
for( Field = m_Fields; Field != NULL; Field = Field->Next() )
|
||||||
|
{
|
||||||
|
if( Field->m_Text.IsEmpty() && Field->m_Name.IsEmpty() )
|
||||||
|
continue;
|
||||||
|
Field->Save( aFile );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Save the alias list: a line starting by "ALIAS" */
|
||||||
|
if( m_AliasList.GetCount() != 0 )
|
||||||
|
{
|
||||||
|
fprintf( aFile, "ALIAS" );
|
||||||
|
unsigned ii;
|
||||||
|
for( ii = 0; ii < m_AliasList.GetCount(); ii++ )
|
||||||
|
fprintf( aFile, " %s", CONV_TO_UTF8( m_AliasList[ii] ) );
|
||||||
|
|
||||||
|
fprintf( aFile, "\n" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Write the footprint filter list */
|
||||||
|
if( m_FootprintList.GetCount() != 0 )
|
||||||
|
{
|
||||||
|
fprintf( aFile, "$FPLIST\n" );
|
||||||
|
unsigned ii;
|
||||||
|
for( ii = 0; ii < m_FootprintList.GetCount(); ii++ )
|
||||||
|
fprintf( aFile, " %s\n", CONV_TO_UTF8( m_FootprintList[ii] ) );
|
||||||
|
|
||||||
|
fprintf( aFile, "$ENDFPLIST\n" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Save graphics items (including pins) */
|
||||||
|
if( m_Drawings )
|
||||||
|
{
|
||||||
|
/* we sort the draw items, in order to have an edition more easy,
|
||||||
|
* when a file editing "by hand" is made */
|
||||||
|
SortDrawItems();
|
||||||
|
|
||||||
|
fprintf( aFile, "DRAW\n" );
|
||||||
|
DrawEntry = m_Drawings;
|
||||||
|
while( DrawEntry )
|
||||||
|
{
|
||||||
|
DrawEntry->Save( aFile );
|
||||||
|
DrawEntry = DrawEntry->Next();
|
||||||
|
}
|
||||||
|
fprintf( aFile, "ENDDRAW\n" );
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf( aFile, "ENDDEF\n" );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EDA_LibComponentStruct::Load( FILE* file, char* line, int* lineNum,
|
||||||
|
wxString& errorMsg )
|
||||||
|
{
|
||||||
|
int unused;
|
||||||
|
char* p;
|
||||||
|
char* name;
|
||||||
|
char* prefix = NULL;
|
||||||
|
|
||||||
|
bool Res;
|
||||||
|
wxString Msg;
|
||||||
|
|
||||||
|
p = strtok( line, " \t\r\n" );
|
||||||
|
|
||||||
|
if( strcmp( p, "DEF" ) != 0 )
|
||||||
|
{
|
||||||
|
errorMsg.Printf( wxT( "DEF command expected in line %d, aborted." ),
|
||||||
|
*lineNum );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Read DEF line: */
|
||||||
|
char drawnum = 0;
|
||||||
|
char drawname = 0;
|
||||||
|
|
||||||
|
if( ( name = strtok( NULL, " \t\n" ) ) == NULL /* Part name: */
|
||||||
|
|| ( prefix = strtok( NULL, " \t\n" ) ) == NULL /* Prefix name: */
|
||||||
|
|| ( p = strtok( NULL, " \t\n" ) ) == NULL /* NumOfPins: */
|
||||||
|
|| sscanf( p, "%d", &unused ) != 1
|
||||||
|
|| ( p = strtok( NULL, " \t\n" ) ) == NULL /* TextInside: */
|
||||||
|
|| sscanf( p, "%d", &m_TextInside ) != 1
|
||||||
|
|| ( p = strtok( NULL, " \t\n" ) ) == NULL /* DrawNums: */
|
||||||
|
|| sscanf( p, "%c", &drawnum ) != 1
|
||||||
|
|| ( p = strtok( NULL, " \t\n" ) ) == NULL /* DrawNums: */
|
||||||
|
|| sscanf( p, "%c", &drawname ) != 1
|
||||||
|
|| ( p = strtok( NULL, " \t\n" ) ) == NULL /* m_UnitCount: */
|
||||||
|
|| sscanf( p, "%d", &m_UnitCount ) != 1 )
|
||||||
|
{
|
||||||
|
errorMsg.Printf( wxT( "Wrong DEF format in line %d, skipped." ),
|
||||||
|
*lineNum );
|
||||||
|
while( GetLine( file, line, lineNum, 1024 ) )
|
||||||
|
{
|
||||||
|
p = strtok( line, " \t\n" );
|
||||||
|
if( stricmp( p, "ENDDEF" ) == 0 )
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_DrawPinNum = (drawnum == 'N') ? FALSE : TRUE;
|
||||||
|
m_DrawPinName = (drawname == 'N') ? FALSE : TRUE;
|
||||||
|
|
||||||
|
/* Copy part name and prefix. */
|
||||||
|
strupper( name );
|
||||||
|
if( name[0] != '~' )
|
||||||
|
m_Name.m_Text = CONV_FROM_UTF8( name );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_Name.m_Text = CONV_FROM_UTF8( &name[1] );
|
||||||
|
m_Name.m_Attributs |= TEXT_NO_VISIBLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( strcmp( prefix, "~" ) == 0 )
|
||||||
|
{
|
||||||
|
m_Prefix.m_Text.Empty();
|
||||||
|
m_Prefix.m_Attributs |= TEXT_NO_VISIBLE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_Prefix.m_Text = CONV_FROM_UTF8( prefix );
|
||||||
|
|
||||||
|
// Copy optional infos
|
||||||
|
if( ( p = strtok( NULL, " \t\n" ) ) != NULL && *p == 'L' )
|
||||||
|
m_UnitSelectionLocked = TRUE;
|
||||||
|
if( ( p = strtok( NULL, " \t\n" ) ) != NULL && *p == 'P' )
|
||||||
|
m_Options = ENTRY_POWER;
|
||||||
|
|
||||||
|
/* Read next lines */
|
||||||
|
while( GetLine( file, line, lineNum, 1024 ) )
|
||||||
|
{
|
||||||
|
p = strtok( line, " \t\n" );
|
||||||
|
|
||||||
|
/* This is the error flag ( if an error occurs, Res = FALSE) */
|
||||||
|
Res = true;
|
||||||
|
|
||||||
|
if( (line[0] == 'T') && (line[1] == 'i') )
|
||||||
|
Res = LoadDateAndTime( line );
|
||||||
|
else if( line[0] == 'F' )
|
||||||
|
Res = LoadField( strcat( p, line ), errorMsg );
|
||||||
|
else if( strcmp( p, "ENDDEF" ) == 0 )
|
||||||
|
break;
|
||||||
|
else if( strcmp( p, "DRAW" ) == 0 )
|
||||||
|
Res = LoadDrawEntries( file, line, lineNum, errorMsg );
|
||||||
|
else if( strncmp( p, "ALIAS", 5 ) == 0 )
|
||||||
|
{
|
||||||
|
p = strtok( NULL, "\r\n" );
|
||||||
|
Res = LoadAliases( p, errorMsg );
|
||||||
|
}
|
||||||
|
else if( strncmp( p, "$FPLIST", 5 ) == 0 )
|
||||||
|
Res = LoadFootprints( file, line, lineNum, errorMsg );
|
||||||
|
|
||||||
|
/* End line or block analysis: test for an error */
|
||||||
|
if( !Res )
|
||||||
|
{
|
||||||
|
Msg.Printf( wxT( "%d " ), *lineNum );
|
||||||
|
|
||||||
|
if( errorMsg.IsEmpty() )
|
||||||
|
errorMsg = wxT( "error at line " ) + Msg;
|
||||||
|
else
|
||||||
|
errorMsg = wxT( "error <" ) + errorMsg +
|
||||||
|
wxT( "> at line " ) + Msg;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If we are here, this part is O.k. - put it in: */
|
||||||
|
SortDrawItems();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool EDA_LibComponentStruct::LoadDrawEntries( FILE* f, char* line,
|
||||||
|
int* lineNum, wxString& errorMsg )
|
||||||
|
{
|
||||||
|
bool entryLoaded;
|
||||||
|
LibEDA_BaseStruct* newEntry = NULL;
|
||||||
|
LibEDA_BaseStruct* headEntry = NULL;
|
||||||
|
LibEDA_BaseStruct* tailEntry = NULL;
|
||||||
|
|
||||||
|
while( true )
|
||||||
|
{
|
||||||
|
if( GetLine( f, line, lineNum, 1024 ) == NULL )
|
||||||
|
{
|
||||||
|
errorMsg = wxT( "File ended prematurely" );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( strncmp( line, "ENDDRAW", 7 ) == 0 )
|
||||||
|
break;
|
||||||
|
|
||||||
|
newEntry = NULL;
|
||||||
|
|
||||||
|
switch( line[0] )
|
||||||
|
{
|
||||||
|
case 'A': /* Arc */
|
||||||
|
newEntry = ( LibEDA_BaseStruct* ) new LibDrawArc();
|
||||||
|
entryLoaded = newEntry->Load( line, errorMsg );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'C': /* Circle */
|
||||||
|
newEntry = ( LibEDA_BaseStruct* ) new LibDrawCircle();
|
||||||
|
entryLoaded = newEntry->Load( line, errorMsg );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'T': /* Text */
|
||||||
|
newEntry = ( LibEDA_BaseStruct* ) new LibDrawText();
|
||||||
|
entryLoaded = newEntry->Load( line, errorMsg );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'S': /* Square */
|
||||||
|
newEntry = ( LibEDA_BaseStruct* ) new LibDrawSquare();
|
||||||
|
entryLoaded = newEntry->Load( line, errorMsg );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'X': /* Pin Description */
|
||||||
|
newEntry = ( LibEDA_BaseStruct* ) new LibDrawPin();
|
||||||
|
entryLoaded = newEntry->Load( line, errorMsg );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'P': /* Polyline */
|
||||||
|
newEntry = ( LibEDA_BaseStruct* ) new LibDrawPolyline();
|
||||||
|
entryLoaded = newEntry->Load( line, errorMsg );
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
errorMsg.Printf( wxT( "Undefined DRAW command in line %d\n" \
|
||||||
|
"%s, aborted." ), *lineNum, line );
|
||||||
|
m_Drawings = headEntry;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !entryLoaded )
|
||||||
|
{
|
||||||
|
errorMsg.Printf( wxT( "> in DRAW command %c in line %d" ), line[0],
|
||||||
|
*lineNum );
|
||||||
|
errorMsg = wxT( "Error <" ) + errorMsg + wxT( ", aborted." );
|
||||||
|
SAFE_DELETE( newEntry );
|
||||||
|
|
||||||
|
/* Flush till end of draw section */
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if( GetLine( f, line, lineNum, 1024 ) == NULL )
|
||||||
|
{
|
||||||
|
errorMsg = wxT( "File ended prematurely while attempting" \
|
||||||
|
"to flush to end of drawing section." );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} while( strncmp( line, "ENDDRAW", 7 ) != 0 );
|
||||||
|
|
||||||
|
|
||||||
|
SAFE_DELETE( headEntry );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( headEntry == NULL )
|
||||||
|
headEntry = tailEntry = newEntry;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tailEntry->SetNext( newEntry );
|
||||||
|
tailEntry = newEntry;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool EDA_LibComponentStruct::LoadAliases( char* line, wxString& errorMsg )
|
||||||
|
{
|
||||||
|
char* text = strtok( line, " \t\r\n" );
|
||||||
|
|
||||||
|
while( text )
|
||||||
|
{
|
||||||
|
m_AliasList.Add( CONV_FROM_UTF8( text ) );
|
||||||
|
text = strtok( NULL, " \t\r\n" );
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool EDA_LibComponentStruct::LoadField( char* line, wxString& errorMsg )
|
||||||
|
{
|
||||||
|
LibDrawField* field = new LibDrawField();
|
||||||
|
|
||||||
|
if ( !field->Load( line, errorMsg ) )
|
||||||
|
{
|
||||||
|
SAFE_DELETE( field );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( field->m_FieldId == REFERENCE )
|
||||||
|
field = &m_Prefix;
|
||||||
|
else if ( field->m_FieldId == VALUE )
|
||||||
|
field = &m_Name;
|
||||||
|
else
|
||||||
|
m_Fields.PushBack( field );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool EDA_LibComponentStruct::LoadFootprints( FILE* file, char* line,
|
||||||
|
int* lineNum, wxString& errorMsg )
|
||||||
|
{
|
||||||
|
while( stricmp( line, "$ENDFPLIST" ) != 0 )
|
||||||
|
{
|
||||||
|
if( GetLine( file, line, lineNum, 1024 ) == NULL )
|
||||||
|
{
|
||||||
|
errorMsg = wxT( "file ended prematurely while loading footprints" );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_FootprintList.Add( CONV_FROM_UTF8( line + 1 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* TODO translate comment to english TODO
|
||||||
|
* Trie les <EFBFBD>l<EFBFBD>ments graphiques d'un composant lib pour am<EFBFBD>liorer
|
||||||
|
* le trac<EFBFBD>:
|
||||||
|
* items remplis en premier, pins en dernier
|
||||||
|
* En cas de superposition d'items, c'est plus lisible
|
||||||
|
*/
|
||||||
|
void EDA_LibComponentStruct::SortDrawItems()
|
||||||
|
{
|
||||||
|
LibEDA_BaseStruct** Bufentry, ** BufentryBase, * Entry = m_Drawings;
|
||||||
|
int ii, nbitems;
|
||||||
|
|
||||||
|
if( Entry == NULL )
|
||||||
|
return; /* Pas d'alias pour ce composant */
|
||||||
|
/* calcul du nombre d'items */
|
||||||
|
for( nbitems = 0; Entry != NULL; Entry = Entry->Next() )
|
||||||
|
nbitems++;
|
||||||
|
|
||||||
|
BufentryBase =
|
||||||
|
(LibEDA_BaseStruct**) MyZMalloc( (nbitems + 1) *
|
||||||
|
sizeof(LibEDA_BaseStruct*) );
|
||||||
|
|
||||||
|
/* memorisation du chainage : */
|
||||||
|
for( Entry = m_Drawings, ii = 0; Entry != NULL; Entry = Entry->Next() )
|
||||||
|
BufentryBase[ii++] = Entry;
|
||||||
|
|
||||||
|
/* Tri du chainage */
|
||||||
|
qsort( BufentryBase, nbitems, sizeof(LibEDA_BaseStruct*), SortItemsFct );
|
||||||
|
|
||||||
|
/* Mise a jour du chainage. Remarque:
|
||||||
|
* le dernier element de BufEntryBase (BufEntryBase[nbitems]) est NULL*/
|
||||||
|
m_Drawings = *BufentryBase;
|
||||||
|
Bufentry = BufentryBase;
|
||||||
|
for( ii = 0; ii < nbitems; ii++ )
|
||||||
|
{
|
||||||
|
(*Bufentry)->SetNext( *(Bufentry + 1) );
|
||||||
|
Bufentry++;
|
||||||
|
}
|
||||||
|
|
||||||
|
MyFree( BufentryBase );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************/
|
||||||
|
/* Return the component boundary box ( in user coordinates )
|
||||||
* The unit Unit, and the shape Convert are considered.
|
* The unit Unit, and the shape Convert are considered.
|
||||||
* If Unit == 0, Unit is not used
|
* If Unit == 0, Unit is not used
|
||||||
* if Convert == 0 Convert is non used
|
* if Convert == 0 Convert is non used
|
||||||
**/
|
**/
|
||||||
|
/**********************************************************************/
|
||||||
|
EDA_Rect EDA_LibComponentStruct::GetBoundaryBox( int Unit, int Convert )
|
||||||
{
|
{
|
||||||
int xmin, xmax, ymin, ymax, x1, y1;
|
|
||||||
LibEDA_BaseStruct* DrawEntry;
|
LibEDA_BaseStruct* DrawEntry;
|
||||||
EDA_Rect BoundaryBox;
|
EDA_Rect bBox( wxPoint( 0, 0 ), wxSize( 0, 0 ) );
|
||||||
|
|
||||||
DrawEntry = m_Drawings;
|
for( DrawEntry = m_Drawings; DrawEntry != NULL;
|
||||||
if( DrawEntry )
|
DrawEntry = DrawEntry->Next() )
|
||||||
{
|
|
||||||
xmin = ymin = 0x7FFFFFFF;
|
|
||||||
xmax = ymax = 0x80000000;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
xmin = ymin = -50;
|
|
||||||
xmax = ymax = 50; // Min size in 1/1000 inch
|
|
||||||
}
|
|
||||||
|
|
||||||
for( ; DrawEntry != NULL; DrawEntry = DrawEntry->Next() )
|
|
||||||
{
|
{
|
||||||
if( DrawEntry->m_Unit > 0 ) // The item is non common to units
|
if( DrawEntry->m_Unit > 0 ) // The item is non common to units
|
||||||
if( (m_UnitCount > 1 ) && (Unit > 0) && (Unit != DrawEntry->m_Unit) )
|
if( ( m_UnitCount > 1 ) && ( Unit > 0 )
|
||||||
|
&& ( Unit != DrawEntry->m_Unit ) )
|
||||||
continue;
|
continue;
|
||||||
if( DrawEntry->m_Convert > 0 ) //The item is not common to alls convert
|
if( DrawEntry->m_Convert > 0 ) // The item is not common to all convert
|
||||||
if( (Convert > 0) && (Convert != DrawEntry->m_Convert) )
|
if( ( Convert > 0 ) && ( Convert != DrawEntry->m_Convert ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
switch( DrawEntry->Type() )
|
bBox.Merge( DrawEntry->GetBoundingBox() );
|
||||||
{
|
|
||||||
case COMPONENT_ARC_DRAW_TYPE:
|
|
||||||
{
|
|
||||||
// Arc is reduced to a line from m_Start to m_End.
|
|
||||||
// TODO better.
|
|
||||||
LibDrawArc* Arc = (LibDrawArc*) DrawEntry;
|
|
||||||
x1 = Arc->m_ArcStart.x;
|
|
||||||
y1 = Arc->m_ArcStart.y;
|
|
||||||
xmin = MIN( xmin, x1 );
|
|
||||||
ymin = MIN( ymin, y1 );
|
|
||||||
xmax = MAX( xmax, x1 );
|
|
||||||
ymax = MAX( ymax, y1 );
|
|
||||||
x1 = Arc->m_ArcEnd.x;
|
|
||||||
y1 = Arc->m_ArcEnd.y;
|
|
||||||
xmin = MIN( xmin, x1 );
|
|
||||||
ymin = MIN( ymin, y1 );
|
|
||||||
xmax = MAX( xmax, x1 );
|
|
||||||
ymax = MAX( ymax, y1 );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COMPONENT_CIRCLE_DRAW_TYPE:
|
|
||||||
{
|
|
||||||
LibDrawCircle* Circle = (LibDrawCircle*) DrawEntry;
|
|
||||||
x1 = Circle->m_Pos.x - Circle->m_Rayon;
|
|
||||||
y1 = Circle->m_Pos.y - Circle->m_Rayon;
|
|
||||||
xmin = MIN( xmin, x1 );
|
|
||||||
ymin = MIN( ymin, y1 );
|
|
||||||
x1 = Circle->m_Pos.x + Circle->m_Rayon;
|
|
||||||
y1 = Circle->m_Pos.y + Circle->m_Rayon;
|
|
||||||
xmax = MAX( xmax, x1 );
|
|
||||||
ymax = MAX( ymax, y1 );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COMPONENT_RECT_DRAW_TYPE:
|
|
||||||
{
|
|
||||||
LibDrawSquare* Square = (LibDrawSquare*) DrawEntry;
|
|
||||||
xmin = MIN( xmin, Square->m_Pos.x );
|
|
||||||
xmin = MIN( xmin, Square->m_End.x );
|
|
||||||
xmax = MAX( xmax, Square->m_Pos.x );
|
|
||||||
xmax = MAX( xmax, Square->m_End.x );
|
|
||||||
ymin = MIN( ymin, Square->m_Pos.y );
|
|
||||||
ymin = MIN( ymin, Square->m_End.y );
|
|
||||||
ymax = MAX( ymax, Square->m_Pos.y );
|
|
||||||
ymax = MAX( ymax, Square->m_End.y );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COMPONENT_PIN_DRAW_TYPE:
|
|
||||||
{
|
|
||||||
LibDrawPin* Pin = (LibDrawPin*) DrawEntry;
|
|
||||||
x1 = Pin->m_Pos.x;
|
|
||||||
y1 = Pin->m_Pos.y;
|
|
||||||
xmin = MIN( xmin, x1 );
|
|
||||||
xmax = MAX( xmax, x1 );
|
|
||||||
ymin = MIN( ymin, y1 );
|
|
||||||
ymax = MAX( ymax, y1 );
|
|
||||||
#if 0
|
|
||||||
// 0 pour englober le point origine de la pin, 1 pour englober toute la pin
|
|
||||||
switch( Pin->Orient )
|
|
||||||
{
|
|
||||||
case PIN_UP:
|
|
||||||
y1 += Pin->Len; break;
|
|
||||||
|
|
||||||
case PIN_DOWN:
|
|
||||||
y1 -= Pin->Len; break;
|
|
||||||
|
|
||||||
case PIN_LEFT:
|
|
||||||
x1 -= Pin->Len; break;
|
|
||||||
|
|
||||||
case PIN_RIGHT:
|
|
||||||
x1 += Pin->Len; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
xmin = MIN( xmin, x1 );
|
|
||||||
xmax = MAX( xmax, x1 );
|
|
||||||
ymin = MIN( ymin, y1 );
|
|
||||||
ymax = MAX( ymax, y1 );
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COMPONENT_POLYLINE_DRAW_TYPE:
|
|
||||||
{
|
|
||||||
EDA_Rect rect = ((LibDrawPolyline*) DrawEntry)->GetBoundaryBox( );
|
|
||||||
xmin = MIN( xmin, rect.GetX() );
|
|
||||||
xmax = MAX( xmax, rect.GetX() );
|
|
||||||
ymin = MIN( ymin, rect.GetY() );
|
|
||||||
ymax = MAX( ymax, rect.GetY() );
|
|
||||||
xmin = MIN( xmin, rect.GetEnd().x );
|
|
||||||
xmax = MAX( xmax, rect.GetEnd().x );
|
|
||||||
ymin = MIN( ymin, rect.GetEnd().y );
|
|
||||||
ymax = MAX( ymax, rect.GetEnd().y );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the BoundaryBox. Remember the fact the screen Y axis is the reverse */
|
wxRect r = bBox;
|
||||||
NEGATE(ymax); NEGATE(ymin); // y coordinates are screen oriented
|
wxLogDebug( wxT( "New boundary box = (%d, %d, %d, %d)" ), r.GetLeft(),
|
||||||
// Ensure H > 0
|
r.GetRight(), r.GetBottom(), r.GetTop() );
|
||||||
if( ymax < ymin )
|
|
||||||
EXCHG( ymax, ymin );
|
|
||||||
BoundaryBox.SetX( xmin ); BoundaryBox.SetWidth( xmax - xmin );
|
|
||||||
BoundaryBox.SetY( ymin ); BoundaryBox.SetHeight( ymax - ymin );
|
|
||||||
|
|
||||||
return BoundaryBox;
|
return bBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -275,26 +696,28 @@ void EDA_LibComponentStruct::SetFields( const std::vector <LibDrawField> aFields
|
||||||
|
|
||||||
for( unsigned ii = FOOTPRINT; ii < aFields.size(); ii++ )
|
for( unsigned ii = FOOTPRINT; ii < aFields.size(); ii++ )
|
||||||
{
|
{
|
||||||
bool create = FALSE;
|
bool create = FALSE;
|
||||||
if( !aFields[ii].m_Text.IsEmpty() )
|
if( !aFields[ii].m_Text.IsEmpty() )
|
||||||
create = TRUE;
|
create = TRUE;
|
||||||
if( !aFields[ii].m_Name.IsEmpty()
|
if( !aFields[ii].m_Name.IsEmpty()
|
||||||
&& ( aFields[ii].m_Name != ReturnDefaultFieldName( ii ) ) )
|
&& ( aFields[ii].m_Name != ReturnDefaultFieldName( ii ) ) )
|
||||||
create = TRUE;
|
create = TRUE;
|
||||||
if( create )
|
if( create )
|
||||||
{
|
{
|
||||||
LibDrawField*Field = new LibDrawField( ii );
|
LibDrawField*Field = new LibDrawField( ii );
|
||||||
aFields[ii].Copy( Field );
|
aFields[ii].Copy( Field );
|
||||||
CurrentLibEntry->m_Fields.PushBack( Field );
|
CurrentLibEntry->m_Fields.PushBack( Field );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* for a user field (FieldId >= FIELD1), if a field value is void,
|
/* for a user field (FieldId >= FIELD1), if a field value is void,
|
||||||
* fill it with "~" because for a library component a void field is not a very good idea
|
* fill it with "~" because for a library component a void field is not
|
||||||
* (we do not see anything...) and in schematic this text is like a void text
|
* a very good idea (we do not see anything...) and in schematic this
|
||||||
* and for non editable names, remove the name (set to the default name)
|
* text is like a void text and for non editable names, remove the name
|
||||||
|
* (set to the default name)
|
||||||
*/
|
*/
|
||||||
for( LibDrawField* Field = CurrentLibEntry->m_Fields; Field; Field = Field->Next() )
|
for( LibDrawField* Field = CurrentLibEntry->m_Fields; Field;
|
||||||
|
Field = Field->Next() )
|
||||||
{
|
{
|
||||||
if( Field->m_FieldId >= FIELD1 )
|
if( Field->m_FieldId >= FIELD1 )
|
||||||
{
|
{
|
||||||
|
@ -305,3 +728,82 @@ void EDA_LibComponentStruct::SetFields( const std::vector <LibDrawField> aFields
|
||||||
Field->m_Name.Empty();
|
Field->m_Name.Empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* lit date et time de modif composant sous le format:
|
||||||
|
* "Ti yy/mm/jj hh:mm:ss"
|
||||||
|
*/
|
||||||
|
bool EDA_LibComponentStruct::SaveDateAndTime( FILE* file )
|
||||||
|
{
|
||||||
|
int year, mon, day, hour, min, sec;
|
||||||
|
|
||||||
|
if( m_LastDate == 0 )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
sec = m_LastDate & 63;
|
||||||
|
min = (m_LastDate >> 6) & 63;
|
||||||
|
hour = (m_LastDate >> 12) & 31;
|
||||||
|
day = (m_LastDate >> 17) & 31;
|
||||||
|
mon = (m_LastDate >> 22) & 15;
|
||||||
|
year = (m_LastDate >> 26) + 1990;
|
||||||
|
|
||||||
|
if ( fprintf( file, "Ti %d/%d/%d %d:%d:%d\n",
|
||||||
|
year, mon, day, hour, min, sec ) == EOF )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* lit date et time de modif composant sous le format:
|
||||||
|
* "Ti yy/mm/jj hh:mm:ss"
|
||||||
|
*/
|
||||||
|
bool EDA_LibComponentStruct::LoadDateAndTime( char* Line )
|
||||||
|
{
|
||||||
|
int year, mon, day, hour, min, sec;
|
||||||
|
char* text;
|
||||||
|
|
||||||
|
year = mon = day = hour = min = sec = 0;
|
||||||
|
text = strtok( Line, " \r\t\n" );
|
||||||
|
text = strtok( NULL, " \r\t\n" ); // text pointe donnees utiles
|
||||||
|
|
||||||
|
if (sscanf( Line, "%d/%d/%d %d:%d:%d",
|
||||||
|
&year, &mon, &day, &hour, &min, &sec ) != 6 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
m_LastDate = ( sec & 63 ) + ( ( min & 63 ) << 6 ) +
|
||||||
|
( ( hour & 31 ) << 12 ) + ( ( day & 31 ) << 17 ) +
|
||||||
|
( ( mon & 15 ) << 22 ) + ( ( year - 1990 ) << 26 );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function SaveDoc
|
||||||
|
* writes the doc info out to a FILE in "*.dcm" format.
|
||||||
|
* Only non empty fields are written.
|
||||||
|
* If all fields are empty, does not write anything
|
||||||
|
* @param aFile The FILE to write to.
|
||||||
|
* @return bool - true if success writing else false.
|
||||||
|
*/
|
||||||
|
bool LibCmpEntry::SaveDoc( FILE* aFile )
|
||||||
|
{
|
||||||
|
if( m_Doc.IsEmpty() && m_KeyWord.IsEmpty() && m_DocFile.IsEmpty() )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
/* Generation des lignes utiles */
|
||||||
|
fprintf( aFile, "#\n$CMP %s\n", CONV_TO_UTF8( m_Name.m_Text ) );
|
||||||
|
|
||||||
|
if( ! m_Doc.IsEmpty() )
|
||||||
|
fprintf( aFile, "D %s\n", CONV_TO_UTF8( m_Doc ) );
|
||||||
|
|
||||||
|
if( ! m_KeyWord.IsEmpty() )
|
||||||
|
fprintf( aFile, "K %s\n", CONV_TO_UTF8( m_KeyWord ) );
|
||||||
|
|
||||||
|
if( ! m_DocFile.IsEmpty() )
|
||||||
|
fprintf( aFile, "F %s\n", CONV_TO_UTF8( m_DocFile ) );
|
||||||
|
|
||||||
|
fprintf( aFile, "$ENDCMP\n" );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
|
@ -25,15 +25,17 @@ enum LibrEntryOptions {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* basic class to describe components in libraries (true component or alias), non used directly */
|
/* basic class to describe components in libraries (true component or alias),
|
||||||
class LibCmpEntry : public EDA_BaseStruct
|
* non used directly */
|
||||||
|
class LibCmpEntry : public EDA_BaseStruct
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LibrEntryType Type; /* Type = ROOT;
|
LibrEntryType Type; /* Type = ROOT;
|
||||||
* = ALIAS pour struct LibraryAliasType */
|
* = ALIAS pour struct LibraryAliasType */
|
||||||
LibDrawField m_Name; // name (74LS00 ..) in lib ( = VALUE )
|
LibDrawField m_Name; // name (74LS00 ..) in lib ( = VALUE )
|
||||||
wxString m_Doc; /* documentation for info */
|
wxString m_Doc; /* documentation for info */
|
||||||
wxString m_KeyWord; /* keyword list (used to select a group of components by keyword) */
|
wxString m_KeyWord; /* keyword list (used to select a group of
|
||||||
|
* components by keyword) */
|
||||||
wxString m_DocFile; /* Associed doc filename */
|
wxString m_DocFile; /* Associed doc filename */
|
||||||
LibrEntryOptions m_Options; // special features (i.e. Entry is a POWER)
|
LibrEntryOptions m_Options; // special features (i.e. Entry is a POWER)
|
||||||
|
|
||||||
|
@ -62,20 +64,27 @@ public:
|
||||||
class EDA_LibComponentStruct : public LibCmpEntry
|
class EDA_LibComponentStruct : public LibCmpEntry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LibDrawField m_Prefix; /* Prefix ( U, IC ... ) = REFERENCE */
|
LibDrawField m_Prefix; /* Prefix ( U, IC ... ) = REFERENCE */
|
||||||
wxArrayString m_AliasList; /* ALIAS list for the component */
|
wxArrayString m_AliasList; /* ALIAS list for the component */
|
||||||
wxArrayString m_FootprintList; /* list of suitable footprint names for the component (wildcard names accepted)*/
|
wxArrayString m_FootprintList; /* list of suitable footprint names
|
||||||
int m_UnitCount; /* Units (or sections) per package */
|
* for the component (wildcard names
|
||||||
bool m_UnitSelectionLocked; // True if units are differents and their selection is locked
|
* accepted) */
|
||||||
// (i.e. if part A cannot be automatically changed in part B
|
int m_UnitCount; /* Units (or sections) per package */
|
||||||
int m_TextInside; /* if 0: pin name drawn on the pin itself
|
bool m_UnitSelectionLocked; /* True if units are differents
|
||||||
* if > 0 pin name drawn inside the component,
|
* and their selection is
|
||||||
* with a distance of m_TextInside in mils */
|
* locked (i.e. if part A cannot
|
||||||
|
* be automatically changed in
|
||||||
|
* part B */
|
||||||
|
int m_TextInside; /* if 0: pin name drawn on the pin
|
||||||
|
* itself if > 0 pin name drawn inside
|
||||||
|
* the component, with a distance of
|
||||||
|
* m_TextInside in mils */
|
||||||
bool m_DrawPinNum;
|
bool m_DrawPinNum;
|
||||||
bool m_DrawPinName;
|
bool m_DrawPinName;
|
||||||
DLIST<LibDrawField> m_Fields; /* Auxiliairy Field list (id >= 2 ) */
|
DLIST<LibDrawField> m_Fields; /* Auxiliairy Field list (id >= 2 ) */
|
||||||
LibEDA_BaseStruct* m_Drawings; /* How to draw this part */
|
LibEDA_BaseStruct* m_Drawings; /* How to draw this part */
|
||||||
long m_LastDate; // Last change Date
|
long m_LastDate; // Last change Date
|
||||||
|
DLIST<LibEDA_BaseStruct> m_DrawItems;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual wxString GetClass() const
|
virtual wxString GetClass() const
|
||||||
|
@ -85,31 +94,54 @@ public:
|
||||||
|
|
||||||
|
|
||||||
EDA_LibComponentStruct( const wxChar* CmpName );
|
EDA_LibComponentStruct( const wxChar* CmpName );
|
||||||
EDA_Rect GetBoundaryBox( int Unit, int Convert ); /* return Box around the part. */
|
|
||||||
|
|
||||||
~EDA_LibComponentStruct();
|
~EDA_LibComponentStruct();
|
||||||
|
|
||||||
|
EDA_Rect GetBoundaryBox( int Unit, int Convert );
|
||||||
|
|
||||||
void SortDrawItems();
|
void SortDrawItems();
|
||||||
|
|
||||||
|
bool SaveDateAndTime( FILE* ExportFile );
|
||||||
|
bool LoadDateAndTime( char* Line );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Save
|
* Function Save
|
||||||
* writes the data structures for this object out to a FILE in "*.lib" format.
|
* writes the data structures for this object out to a FILE in "*.lib"
|
||||||
|
* format.
|
||||||
* @param aFile The FILE to write to.
|
* @param aFile The FILE to write to.
|
||||||
* @return bool - true if success writing else false.
|
* @return bool - true if success writing else false.
|
||||||
*/
|
*/
|
||||||
bool Save( FILE* aFile );
|
bool Save( FILE* aFile );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load component definition from file.
|
||||||
|
*
|
||||||
|
* @param file - File discriptor of file to load form.
|
||||||
|
* @param line - The first line of the component definition.
|
||||||
|
* @param lineNum - The current line number in the file.
|
||||||
|
* @param parent - The parent window for displaying message boxes.
|
||||||
|
*
|
||||||
|
* @return bool - Result of the load, false if there was an error.
|
||||||
|
*/
|
||||||
|
bool Load( FILE* file, char* line, int* lineNum, wxString& errorMsg );
|
||||||
|
bool LoadField( char* line, wxString& errorMsg );
|
||||||
|
bool LoadDrawEntries( FILE* f, char* line,
|
||||||
|
int* lineNum, wxString& errorMsg );
|
||||||
|
bool LoadAliases( char* line, wxString& Error );
|
||||||
|
bool LoadFootprints( FILE* file, char* line,
|
||||||
|
int* lineNum, wxString& errorMsg );
|
||||||
|
|
||||||
/** Function SetFields
|
/** Function SetFields
|
||||||
* initialize fields from a vector of fields
|
* initialize fields from a vector of fields
|
||||||
* @param aFields a std::vector <LibDrawField> to import.
|
* @param aFields a std::vector <LibDrawField> to import.
|
||||||
*/
|
*/
|
||||||
void SetFields( const std::vector <LibDrawField> aFields );
|
void SetFields( const std::vector <LibDrawField> aFields );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/* class to handle an alias of an usual component in lib (root component) */
|
/* class to handle an alias of an usual component in lib (root component) */
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
class EDA_LibCmpAliasStruct : public LibCmpEntry
|
class EDA_LibCmpAliasStruct : public LibCmpEntry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxString m_RootName; /* Root component Part name */
|
wxString m_RootName; /* Root component Part name */
|
||||||
|
|
|
@ -1,40 +1,48 @@
|
||||||
/**********************************************************/
|
/**********************************************************/
|
||||||
/* libclass.cpp */
|
/* libclass.cpp */
|
||||||
/**********************************************************/
|
/**********************************************************/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "gr_basic.h"
|
#include "gr_basic.h"
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "base_struct.h"
|
||||||
|
#include "drawtxt.h"
|
||||||
|
#include "kicad_string.h"
|
||||||
|
|
||||||
#include "program.h"
|
#include "program.h"
|
||||||
#include "libcmp.h"
|
#include "libcmp.h"
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
|
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
|
#include <wx/tokenzr.h>
|
||||||
|
#include <wx/stream.h>
|
||||||
|
#include <wx/txtstrm.h>
|
||||||
|
|
||||||
|
|
||||||
/***************************/
|
/***************************/
|
||||||
/* class LibraryFieldEntry */
|
/* class LibraryFieldEntry */
|
||||||
/***************************/
|
/***************************/
|
||||||
|
|
||||||
/* a Field is a string linked to a component.
|
/**
|
||||||
|
* a Field is a string linked to a component.
|
||||||
* Unlike a pure graphic text, fields can be used in netlist generation
|
* Unlike a pure graphic text, fields can be used in netlist generation
|
||||||
* and other told (BOM).
|
* and other tools (BOM).
|
||||||
*
|
*
|
||||||
* 4 fields have a special meaning:
|
* The first 4 fields have a special meaning:
|
||||||
* REFERENCE
|
*
|
||||||
* VALUE
|
* 0 = REFERENCE
|
||||||
* FOOTPRINT NAME
|
* 1 = VALUE
|
||||||
* DOCUMENTATION LINK (reserved but not used in kicad)
|
* 3 = FOOTPRINT (default Footprint)
|
||||||
|
* 4 = DOCUMENTATION (user doc link)
|
||||||
|
*
|
||||||
|
* others = free fields
|
||||||
*/
|
*/
|
||||||
LibDrawField::LibDrawField( int idfield ) : LibEDA_BaseStruct( COMPONENT_FIELD_DRAW_TYPE )
|
LibDrawField::LibDrawField( int idfield ) :
|
||||||
|
LibEDA_BaseStruct( COMPONENT_FIELD_DRAW_TYPE )
|
||||||
{
|
{
|
||||||
m_FieldId = idfield; /* 0 = REFERENCE
|
m_FieldId = idfield;
|
||||||
* 1 = VALUE
|
m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT;
|
||||||
* 3 = FOOTPRINT (default Footprint)
|
|
||||||
* 4 = DOCUMENTATION (user doc link)
|
|
||||||
* others = free fields
|
|
||||||
*/
|
|
||||||
m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,6 +51,249 @@ LibDrawField::~LibDrawField()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool LibDrawField::Save( FILE* ExportFile ) const
|
||||||
|
{
|
||||||
|
int hjustify, vjustify;
|
||||||
|
wxString text = m_Text;
|
||||||
|
|
||||||
|
hjustify = 'C';
|
||||||
|
if( m_HJustify == GR_TEXT_HJUSTIFY_LEFT )
|
||||||
|
hjustify = 'L';
|
||||||
|
else if( m_HJustify == GR_TEXT_HJUSTIFY_RIGHT )
|
||||||
|
hjustify = 'R';
|
||||||
|
vjustify = 'C';
|
||||||
|
if( m_VJustify == GR_TEXT_VJUSTIFY_BOTTOM )
|
||||||
|
vjustify = 'B';
|
||||||
|
else if( m_VJustify == GR_TEXT_VJUSTIFY_TOP )
|
||||||
|
vjustify = 'T';
|
||||||
|
if( text.IsEmpty() )
|
||||||
|
text = wxT( "~" );
|
||||||
|
fprintf( ExportFile, "F%d \"%s\" %d %d %d %c %c %c %c%c%c",
|
||||||
|
m_FieldId, CONV_TO_UTF8( text ), m_Pos.x, m_Pos.y, m_Size.x,
|
||||||
|
m_Orient == 0 ? 'H' : 'V',
|
||||||
|
(m_Attributs & TEXT_NO_VISIBLE ) ? 'I' : 'V',
|
||||||
|
hjustify, vjustify,
|
||||||
|
m_Italic ? 'I' : 'N',
|
||||||
|
m_Width > 1 ? 'B' : 'N' );
|
||||||
|
|
||||||
|
/* Save field name, if necessary
|
||||||
|
* Field name is saved only if it is not the default name.
|
||||||
|
* Just because default name depends on the language and can change from
|
||||||
|
* a country to an other
|
||||||
|
*/
|
||||||
|
if( m_FieldId >= FIELD1 && !m_Name.IsEmpty()
|
||||||
|
&& m_Name != ReturnDefaultFieldName( m_FieldId ))
|
||||||
|
fprintf( ExportFile, " \"%s\"", CONV_TO_UTF8( m_Name ) );
|
||||||
|
|
||||||
|
fprintf( ExportFile, "\n" );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool LibDrawField::Load( char* line, wxString& errorMsg )
|
||||||
|
{
|
||||||
|
int cnt;
|
||||||
|
char textOrient;
|
||||||
|
char textVisible;
|
||||||
|
char textHJustify;
|
||||||
|
char textVJustify[256];
|
||||||
|
char fieldUserName[1024];
|
||||||
|
char* text;
|
||||||
|
|
||||||
|
if( sscanf( line + 1, "%d", &m_FieldId ) != 1
|
||||||
|
|| m_FieldId < REFERENCE || m_FieldId >= NUMBER_OF_FIELDS )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
/* Recherche du debut des donnees (debut du texte suivant) */
|
||||||
|
while( *line != 0 )
|
||||||
|
line++;
|
||||||
|
|
||||||
|
while( *line == 0 )
|
||||||
|
line++;
|
||||||
|
|
||||||
|
/* recherche du texte */
|
||||||
|
while( *line && (*line != '"') )
|
||||||
|
line++;
|
||||||
|
|
||||||
|
if( *line == 0 )
|
||||||
|
return false;
|
||||||
|
line++;
|
||||||
|
|
||||||
|
text = line;
|
||||||
|
|
||||||
|
/* recherche fin de texte */
|
||||||
|
while( *line && (*line != '"') )
|
||||||
|
line++;
|
||||||
|
|
||||||
|
if( *line == 0 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
*line = 0;
|
||||||
|
line++;
|
||||||
|
|
||||||
|
fieldUserName[0] = 0;
|
||||||
|
memset( textVJustify, 0, sizeof( textVJustify ) );
|
||||||
|
|
||||||
|
cnt = sscanf( line, " %d %d %d %c %c %c %s", &m_Pos.x, &m_Pos.y, &m_Size.y,
|
||||||
|
&textOrient, &textVisible, &textHJustify, textVJustify );
|
||||||
|
|
||||||
|
if( cnt < 5 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
m_Text = CONV_FROM_UTF8( text );
|
||||||
|
m_Size.x = m_Size.y;
|
||||||
|
|
||||||
|
if( textOrient == 'H' )
|
||||||
|
m_Orient = TEXT_ORIENT_HORIZ;
|
||||||
|
else if( textOrient == 'V' )
|
||||||
|
m_Orient = TEXT_ORIENT_VERT;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if( textVisible == 'V' )
|
||||||
|
m_Attributs &= ~TEXT_NO_VISIBLE;
|
||||||
|
else if ( textVisible == 'I' )
|
||||||
|
m_Attributs |= TEXT_NO_VISIBLE;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
|
||||||
|
m_HJustify = GR_TEXT_HJUSTIFY_CENTER;
|
||||||
|
m_VJustify = GR_TEXT_VJUSTIFY_CENTER;
|
||||||
|
|
||||||
|
if( cnt >= 6 )
|
||||||
|
{
|
||||||
|
if( textHJustify == 'C' )
|
||||||
|
m_HJustify = GR_TEXT_HJUSTIFY_CENTER;
|
||||||
|
else if( textHJustify == 'L' )
|
||||||
|
m_HJustify = GR_TEXT_HJUSTIFY_LEFT;
|
||||||
|
else if( textHJustify == 'R' )
|
||||||
|
m_HJustify = GR_TEXT_HJUSTIFY_RIGHT;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if( textVJustify[0] == 'C' )
|
||||||
|
m_VJustify = GR_TEXT_VJUSTIFY_CENTER;
|
||||||
|
else if( textVJustify[0] == 'B' )
|
||||||
|
m_VJustify = GR_TEXT_VJUSTIFY_BOTTOM;
|
||||||
|
else if( textVJustify[0] == 'T' )
|
||||||
|
m_VJustify = GR_TEXT_VJUSTIFY_TOP;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if ( strlen( textVJustify ) >= 2 && textVJustify[1] == 'I' ) // Italic
|
||||||
|
m_Italic = true;
|
||||||
|
if ( strlen( textVJustify ) >= 2 && textVJustify[2] == 'B' ) // Bold
|
||||||
|
m_Width = m_Size.x / 4;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if( m_FieldId >= FIELD1 )
|
||||||
|
{
|
||||||
|
ReadDelimitedText( fieldUserName, line, sizeof( fieldUserName ) );
|
||||||
|
m_Name = CONV_FROM_UTF8( fieldUserName );
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* if aData not NULL, aData must point a wxString which is used instead of
|
||||||
|
* the m_Text
|
||||||
|
*/
|
||||||
|
void LibDrawField::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
|
const wxPoint& aOffset, int aColor, int aDrawMode,
|
||||||
|
void* aData, const int aTransformMatrix[2][2] )
|
||||||
|
{
|
||||||
|
wxPoint text_pos;
|
||||||
|
|
||||||
|
int color = aColor;
|
||||||
|
int linewidth = MAX( m_Width, g_DrawMinimunLineWidth );
|
||||||
|
|
||||||
|
if( aColor < 0 ) // Used normal color or selected color
|
||||||
|
{
|
||||||
|
if( (m_Selected & IS_SELECTED) )
|
||||||
|
color = g_ItemSelectetColor;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
color = aColor;
|
||||||
|
|
||||||
|
if( color < 0 )
|
||||||
|
{
|
||||||
|
switch( m_FieldId )
|
||||||
|
{
|
||||||
|
case REFERENCE:
|
||||||
|
color = ReturnLayerColor( LAYER_REFERENCEPART );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VALUE:
|
||||||
|
color = ReturnLayerColor( LAYER_VALUEPART );
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
color = ReturnLayerColor( LAYER_FIELDS );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
text_pos = TransformCoordinate( aTransformMatrix, m_Pos ) + aOffset;
|
||||||
|
|
||||||
|
wxString* text = aData ? (wxString*) aData : &m_Text;
|
||||||
|
GRSetDrawMode( aDC, aDrawMode );
|
||||||
|
DrawGraphicText( aPanel, aDC, text_pos, (EDA_Colors) color, text->GetData(),
|
||||||
|
m_Orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
|
||||||
|
m_Size, m_HJustify, m_VJustify, linewidth, m_Italic );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function HitTest
|
||||||
|
* tests if the given wxPoint is within the bounds of this object.
|
||||||
|
* @param refPos A wxPoint to test, in Field coordinate system
|
||||||
|
* @return bool - true if a hit, else false
|
||||||
|
*/
|
||||||
|
bool LibDrawField::HitTest( const wxPoint& refPos )
|
||||||
|
{
|
||||||
|
EDA_Rect bbox; // bounding box for the text
|
||||||
|
int dx; // X size for the full text
|
||||||
|
|
||||||
|
bbox.SetOrigin( m_Pos );
|
||||||
|
|
||||||
|
dx = m_Size.x * m_Text.Len();
|
||||||
|
|
||||||
|
// Reference designator text has one additional character (displays U?)
|
||||||
|
if( m_FieldId == REFERENCE )
|
||||||
|
dx += m_Size.x;
|
||||||
|
|
||||||
|
// spacing between characters is 0.1 the character size
|
||||||
|
dx = (int) ( (double) dx * 10.0 / 9 );
|
||||||
|
int dy = m_Size.y;
|
||||||
|
|
||||||
|
if( m_Orient )
|
||||||
|
EXCHG( dx, dy ); // Swap X and Y size for a vertical text
|
||||||
|
|
||||||
|
// adjust position of the left bottom corner according to the justification
|
||||||
|
// pos is at this point correct for a left and top justified text
|
||||||
|
// Horizontal justification
|
||||||
|
if( m_HJustify == GR_TEXT_HJUSTIFY_CENTER )
|
||||||
|
bbox.Offset( -dx / 2, 0 );
|
||||||
|
else if( m_HJustify == GR_TEXT_HJUSTIFY_RIGHT )
|
||||||
|
bbox.Offset( -dx, 0 );
|
||||||
|
|
||||||
|
// Vertical justification
|
||||||
|
if( m_VJustify == GR_TEXT_VJUSTIFY_CENTER )
|
||||||
|
bbox.Offset( 0, -dy / 2 );
|
||||||
|
else if( m_VJustify == GR_TEXT_VJUSTIFY_TOP )
|
||||||
|
bbox.Offset( 0, -dy );
|
||||||
|
|
||||||
|
bbox.SetSize( dx, dy );
|
||||||
|
|
||||||
|
if( bbox.Inside( refPos ) )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Creation et Duplication d'un field
|
// Creation et Duplication d'un field
|
||||||
LibDrawField* LibDrawField::GenCopy()
|
LibDrawField* LibDrawField::GenCopy()
|
||||||
{
|
{
|
||||||
|
@ -73,62 +324,22 @@ void LibDrawField::Copy( LibDrawField* Target ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************/
|
/**
|
||||||
bool LibDrawField::Save( FILE* ExportFile ) const
|
* Function ReturnDefaultFieldName
|
||||||
/**************************************************/
|
|
||||||
{
|
|
||||||
int hjustify, vjustify;
|
|
||||||
wxString text = m_Text;
|
|
||||||
|
|
||||||
hjustify = 'C';
|
|
||||||
if( m_HJustify == GR_TEXT_HJUSTIFY_LEFT )
|
|
||||||
hjustify = 'L';
|
|
||||||
else if( m_HJustify == GR_TEXT_HJUSTIFY_RIGHT )
|
|
||||||
hjustify = 'R';
|
|
||||||
vjustify = 'C';
|
|
||||||
if( m_VJustify == GR_TEXT_VJUSTIFY_BOTTOM )
|
|
||||||
vjustify = 'B';
|
|
||||||
else if( m_VJustify == GR_TEXT_VJUSTIFY_TOP )
|
|
||||||
vjustify = 'T';
|
|
||||||
if( text.IsEmpty() )
|
|
||||||
text = wxT( "~" );
|
|
||||||
fprintf( ExportFile, "F%d \"%s\" %d %d %d %c %c %c %c%c%c",
|
|
||||||
m_FieldId, CONV_TO_UTF8( text ),
|
|
||||||
m_Pos.x, m_Pos.y,
|
|
||||||
m_Size.x,
|
|
||||||
m_Orient == 0 ? 'H' : 'V',
|
|
||||||
(m_Attributs & TEXT_NO_VISIBLE ) ? 'I' : 'V',
|
|
||||||
hjustify, vjustify,
|
|
||||||
m_Italic ? 'I' : 'N',
|
|
||||||
m_Width > 1 ? 'B' : 'N' );
|
|
||||||
|
|
||||||
/* Save field name, if necessary
|
|
||||||
* Field name is saved only if it is not the default name.
|
|
||||||
* Just because default name depends on the language and can change from a country to an other
|
|
||||||
*/
|
|
||||||
if( m_FieldId >= FIELD1 && !m_Name.IsEmpty() && m_Name != ReturnDefaultFieldName( m_FieldId ))
|
|
||||||
fprintf( ExportFile, " \"%s\"", CONV_TO_UTF8( m_Name ) );
|
|
||||||
|
|
||||||
fprintf( ExportFile, "\n" );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************/
|
|
||||||
wxString ReturnDefaultFieldName( int aFieldNdx )
|
|
||||||
/****************************************************************/
|
|
||||||
|
|
||||||
/** Function ReturnDefaultFieldName
|
|
||||||
* Return the default field name from its index (REFERENCE, VALUE ..)
|
* Return the default field name from its index (REFERENCE, VALUE ..)
|
||||||
* FieldDefaultNameList is not static, because we want the text translation for I18n
|
* FieldDefaultNameList is not static, because we want the text translation
|
||||||
|
* for I18n
|
||||||
* @param aFieldNdx = Filed number (>= 0)
|
* @param aFieldNdx = Filed number (>= 0)
|
||||||
*/
|
*/
|
||||||
|
wxString ReturnDefaultFieldName( int aFieldNdx )
|
||||||
{
|
{
|
||||||
// avoid unnecessarily copying wxStrings at runtime.
|
// avoid unnecessarily copying wxStrings at runtime.
|
||||||
static const wxString defaults[] = {
|
static const wxString defaults[] = {
|
||||||
_( "Reference" ), // Reference of part, i.e. "IC21"
|
_( "Reference" ), // Reference of part, i.e. "IC21"
|
||||||
_( "Value" ), // Value of part, i.e. "3.3K" and name in lib for lib entries
|
_( "Value" ), // Value of part, i.e. "3.3K" and name in lib
|
||||||
_( "Footprint" ), // Footprint, used by cvpcb or pcbnew, i.e. "16DIP300"
|
// for lib entries
|
||||||
|
_( "Footprint" ), // Footprint, used by cvpcb or pcbnew, i.e.
|
||||||
|
// "16DIP300"
|
||||||
_( "Datasheet" ), // A link to an user document, if wanted
|
_( "Datasheet" ), // A link to an user document, if wanted
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -142,4 +353,3 @@ wxString ReturnDefaultFieldName( int aFieldNdx )
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,23 +7,26 @@
|
||||||
|
|
||||||
|
|
||||||
/* Fields , same as component fields.
|
/* Fields , same as component fields.
|
||||||
* can be defined in libraries (mandatory for ref and value, ca be useful for footprints)
|
* can be defined in libraries (mandatory for ref and value, ca be useful for
|
||||||
|
* footprints)
|
||||||
* 2 Fields are always defined :
|
* 2 Fields are always defined :
|
||||||
* Prefix (U, IC..) with gives the reference in schematic)
|
* Prefix (U, IC..) with gives the reference in schematic)
|
||||||
* Name (74LS00..) used to find the component in libraries, and give the default value in schematic
|
* Name (74LS00..) used to find the component in libraries, and give the
|
||||||
|
* default value in schematic
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class LibDrawField : public LibEDA_BaseStruct,
|
class LibDrawField : public LibEDA_BaseStruct,
|
||||||
public EDA_TextStruct
|
public EDA_TextStruct
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int m_FieldId; /* 0 = REFERENCE
|
int m_FieldId; /* 0 = REFERENCE
|
||||||
* 1 = VALUE
|
* 1 = VALUE
|
||||||
* 3 = FOOTPRINT (default Footprint)
|
* 3 = FOOTPRINT (default Footprint)
|
||||||
* 4 = DOCUMENTATION (user doc link)
|
* 4 = DOCUMENTATION (user doc link)
|
||||||
* others = free fields
|
* others = free fields
|
||||||
*/
|
*/
|
||||||
wxString m_Name; /* Field Name (not the field text itself, that is .m_Text) */
|
wxString m_Name; /* Field Name (not the field text itself, that is
|
||||||
|
* .m_Text) */
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -41,12 +44,13 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Save
|
* Function Save
|
||||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
* writes the data structures for this object out to a FILE in "*.brd"
|
||||||
|
* format.
|
||||||
* @param aFile The FILE to write to.
|
* @param aFile The FILE to write to.
|
||||||
* @return bool - true if success writing else false.
|
* @return bool - true if success writing else false.
|
||||||
*/
|
*/
|
||||||
virtual bool Save( FILE* aFile ) const;
|
virtual bool Save( FILE* aFile ) const;
|
||||||
|
virtual bool Load( char* line, wxString& errorMsg );
|
||||||
|
|
||||||
LibDrawField* GenCopy();
|
LibDrawField* GenCopy();
|
||||||
|
|
||||||
|
@ -58,8 +62,9 @@ public:
|
||||||
|
|
||||||
void SetFields( const std::vector <LibDrawField> aFields );
|
void SetFields( const std::vector <LibDrawField> aFields );
|
||||||
|
|
||||||
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, int aColor,
|
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset,
|
||||||
int aDrawMode, void* aData, const int aTransformMatrix[2][2] );
|
int aColor, int aDrawMode, void* aData,
|
||||||
|
const int aTransformMatrix[2][2] );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function HitTest
|
* Function HitTest
|
||||||
|
@ -68,6 +73,21 @@ public:
|
||||||
* @return bool - true if a hit, else false
|
* @return bool - true if a hit, else false
|
||||||
*/
|
*/
|
||||||
bool HitTest( const wxPoint& refPos );
|
bool HitTest( const wxPoint& refPos );
|
||||||
|
|
||||||
|
void operator=( const LibDrawField& field )
|
||||||
|
{
|
||||||
|
m_FieldId = field.m_FieldId;
|
||||||
|
m_Text = field.m_Text;
|
||||||
|
m_Pos = field.m_Pos;
|
||||||
|
m_Size = field.m_Size;
|
||||||
|
m_Width = field.m_Width;
|
||||||
|
m_Orient = field.m_Orient;
|
||||||
|
m_Mirror = field.m_Mirror;
|
||||||
|
m_Attributs = field.m_Attributs;
|
||||||
|
m_Italic = field.m_Italic;
|
||||||
|
m_HJustify = field.m_HJustify;
|
||||||
|
m_VJustify = field.m_VJustify;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CLASS_LIBENTRY_FIELDS_H
|
#endif // CLASS_LIBENTRY_FIELDS_H
|
||||||
|
|
|
@ -4,36 +4,56 @@
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "gr_basic.h"
|
#include "gr_basic.h"
|
||||||
|
#include "common.h"
|
||||||
#include "kicad_string.h"
|
#include "kicad_string.h"
|
||||||
|
#include "confirm.h"
|
||||||
|
#include "gestfich.h"
|
||||||
|
|
||||||
#include "program.h"
|
#include "program.h"
|
||||||
#include "libcmp.h"
|
#include "libcmp.h"
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
|
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
#include "class_library.h"
|
||||||
|
|
||||||
/***************************************************************************************/
|
#include <wx/tokenzr.h>
|
||||||
LibraryStruct::LibraryStruct( int type, const wxString& name, const wxString& fullname )
|
#include <wx/wfstream.h>
|
||||||
/***************************************************************************************/
|
#include <wx/txtstrm.h>
|
||||||
|
#include <wx/listimpl.cpp>
|
||||||
|
|
||||||
|
WX_DEFINE_LIST( LIB_CMP_LIST );
|
||||||
|
|
||||||
|
|
||||||
|
LibraryStruct::LibraryStruct( int type, const wxString& name,
|
||||||
|
const wxString& fullname )
|
||||||
{
|
{
|
||||||
m_Type = type; /* type indicator */
|
m_Type = type; /* type indicator */
|
||||||
m_Name = name; /* Name of library loaded. */
|
m_Name = name; /* Name of library loaded. */
|
||||||
m_FullFileName = fullname; /* Full File Name (with path) of library loaded. */
|
m_FullFileName = fullname; /* File name (with path) of library loaded. */
|
||||||
m_NumOfParts = 0; /* Number of parts this library has. */
|
m_NumOfParts = 0; /* Number of parts this library has. */
|
||||||
m_Entries = NULL; /* Parts themselves are saved here. */
|
m_Entries = NULL; /* Parts themselves are saved here. */
|
||||||
m_Pnext = NULL; /* Point on next lib in chain. */
|
m_Pnext = NULL; /* Point to next library in chain. */
|
||||||
m_Modified = FALSE; /* flag indicateur d'edition */
|
m_Modified = FALSE; /* flag indicateur d'edition */
|
||||||
m_TimeStamp = 0;
|
m_TimeStamp = 0;
|
||||||
m_Flags = 0;
|
m_Flags = 0;
|
||||||
m_IsLibCache = FALSE;
|
m_IsLibCache = FALSE;
|
||||||
|
m_DateTime = wxDateTime::Now();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LibraryStruct::LibraryStruct( const wxChar* fileName )
|
||||||
|
{
|
||||||
|
if( fileName == NULL )
|
||||||
|
m_fileName = wxT( "unnamed.lib" );
|
||||||
|
else
|
||||||
|
m_fileName = fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************/
|
/*****************************************/
|
||||||
void FreeLibraryEntry( LibCmpEntry* Entry )
|
|
||||||
/*****************************************/
|
|
||||||
|
|
||||||
/* Used by PQFreeFunc() to delete all entries
|
/* Used by PQFreeFunc() to delete all entries
|
||||||
*/
|
*/
|
||||||
|
/*****************************************/
|
||||||
|
void FreeLibraryEntry( LibCmpEntry* Entry )
|
||||||
{
|
{
|
||||||
SAFE_DELETE( Entry );
|
SAFE_DELETE( Entry );
|
||||||
}
|
}
|
||||||
|
@ -41,27 +61,26 @@ void FreeLibraryEntry( LibCmpEntry* Entry )
|
||||||
|
|
||||||
/******************************/
|
/******************************/
|
||||||
LibraryStruct::~LibraryStruct()
|
LibraryStruct::~LibraryStruct()
|
||||||
/******************************/
|
|
||||||
{
|
{
|
||||||
if( m_Entries )
|
if( m_Entries )
|
||||||
PQFreeFunc( m_Entries, ( void( * ) ( void* ) )FreeLibraryEntry );
|
PQFreeFunc( m_Entries, ( void( * ) ( void* ) )FreeLibraryEntry );
|
||||||
|
|
||||||
|
m_componentList.DeleteContents( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************/
|
/*******************************************/
|
||||||
bool LibraryStruct::WriteHeader( FILE* file )
|
|
||||||
/*******************************************/
|
|
||||||
|
|
||||||
/* Ecrit l'entete du fichier librairie
|
/* Ecrit l'entete du fichier librairie
|
||||||
*/
|
*/
|
||||||
|
/*******************************************/
|
||||||
|
bool LibraryStruct::WriteHeader( FILE* file )
|
||||||
{
|
{
|
||||||
char BufLine[1024];
|
char BufLine[1024];
|
||||||
bool succes = TRUE;
|
bool succes = TRUE;
|
||||||
|
|
||||||
DateAndTime( BufLine );
|
DateAndTime( BufLine );
|
||||||
if( fprintf( file, "%s %d.%d Date: %s\n", LIBFILE_IDENT,
|
if( fprintf( file, "%s %d.%d Date: %s\n", LIBFILE_IDENT,
|
||||||
LIB_VERSION_MAJOR, LIB_VERSION_MINOR,
|
LIB_VERSION_MAJOR, LIB_VERSION_MINOR, BufLine ) != 5 )
|
||||||
BufLine ) != 5 )
|
|
||||||
succes = FALSE;
|
succes = FALSE;
|
||||||
#if 0
|
#if 0
|
||||||
if( fprintf( file, "$HEADER\n" ) != 1 )
|
if( fprintf( file, "$HEADER\n" ) != 1 )
|
||||||
|
@ -78,11 +97,10 @@ bool LibraryStruct::WriteHeader( FILE* file )
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
bool LibraryStruct::ReadHeader( FILE* libfile, int* LineNum )
|
|
||||||
/***********************************************************/
|
|
||||||
|
|
||||||
/* Ecrit l'entete du fichier librairie
|
/* Ecrit l'entete du fichier librairie
|
||||||
*/
|
*/
|
||||||
|
/***********************************************************/
|
||||||
|
bool LibraryStruct::ReadHeader( FILE* libfile, int* LineNum )
|
||||||
{
|
{
|
||||||
char Line[1024], * text, * data;
|
char Line[1024], * text, * data;
|
||||||
|
|
||||||
|
@ -99,3 +117,117 @@ bool LibraryStruct::ReadHeader( FILE* libfile, int* LineNum )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function SaveLibrary
|
||||||
|
* writes the data structures for this object out to 2 file
|
||||||
|
* the library in "*.lib" format.
|
||||||
|
* the doc file in "*.dcm" format.
|
||||||
|
* creates a backup file for each file (.bak and .bck)
|
||||||
|
* @param aFullFileName The full lib filename.
|
||||||
|
* @return bool - true if success writing else false.
|
||||||
|
*/
|
||||||
|
bool LibraryStruct::SaveLibrary( const wxString& FullFileName )
|
||||||
|
{
|
||||||
|
FILE* libfile, *docfile;
|
||||||
|
EDA_LibComponentStruct* LibEntry;
|
||||||
|
wxString msg;
|
||||||
|
wxFileName libFileName = FullFileName;
|
||||||
|
wxFileName backupFileName = FullFileName;
|
||||||
|
wxFileName docFileName = FullFileName;
|
||||||
|
|
||||||
|
/* the old .lib file is renamed .bak */
|
||||||
|
if( libFileName.FileExists() )
|
||||||
|
{
|
||||||
|
backupFileName.SetExt( wxT( "bak" ) );
|
||||||
|
wxRemoveFile( backupFileName.GetFullPath() );
|
||||||
|
|
||||||
|
if( !wxRenameFile( libFileName.GetFullPath(),
|
||||||
|
backupFileName.GetFullPath() ) )
|
||||||
|
{
|
||||||
|
msg = wxT( "Failed to rename old lib file " ) +
|
||||||
|
backupFileName.GetFullPath();
|
||||||
|
DisplayError( NULL, msg, 20 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
docFileName.SetExt( DOC_EXT );
|
||||||
|
/* L'ancien fichier doc lib est renomme en .bck */
|
||||||
|
if( wxFileExists( docFileName.GetFullPath() ) )
|
||||||
|
{
|
||||||
|
backupFileName = docFileName;
|
||||||
|
backupFileName.SetExt( wxT( "bck" ) );
|
||||||
|
wxRemoveFile( backupFileName.GetFullPath() );
|
||||||
|
|
||||||
|
if( !wxRenameFile( docFileName.GetFullPath(),
|
||||||
|
backupFileName.GetFullPath() ) )
|
||||||
|
{
|
||||||
|
msg = wxT( "Failed to save old doc lib file " ) +
|
||||||
|
backupFileName.GetFullPath();
|
||||||
|
DisplayError( NULL, msg, 20 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
libfile = wxFopen( libFileName.GetFullPath(), wxT( "wt" ) );
|
||||||
|
|
||||||
|
if( libfile == NULL )
|
||||||
|
{
|
||||||
|
msg = wxT( "Failed to create Lib File " ) + libFileName.GetFullPath();
|
||||||
|
DisplayError( NULL, msg, 20 );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
docfile = wxFopen( docFileName.GetFullPath(), wxT( "wt" ) );
|
||||||
|
|
||||||
|
if( docfile == NULL )
|
||||||
|
{
|
||||||
|
msg = wxT( "Failed to create DocLib File " ) +
|
||||||
|
docFileName.GetFullPath();
|
||||||
|
DisplayError( NULL, msg, 20 );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Modified = 0;
|
||||||
|
|
||||||
|
/* Creation de l'entete de la librairie */
|
||||||
|
m_TimeStamp = GetTimeStamp();
|
||||||
|
WriteHeader( libfile );
|
||||||
|
|
||||||
|
/* Sauvegarde des composant: */
|
||||||
|
PQCompFunc( (PQCompFuncType) LibraryEntryCompare );
|
||||||
|
LibEntry = (EDA_LibComponentStruct*) PQFirst( &m_Entries, FALSE );
|
||||||
|
char Line[256];
|
||||||
|
fprintf( docfile, "%s Date: %s\n", DOCFILE_IDENT,
|
||||||
|
DateAndTime( Line ) );
|
||||||
|
|
||||||
|
bool success = true;
|
||||||
|
while( LibEntry )
|
||||||
|
{
|
||||||
|
if ( LibEntry->Type == ROOT )
|
||||||
|
{
|
||||||
|
if ( ! LibEntry->Save( libfile ) )
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
if ( docfile )
|
||||||
|
{
|
||||||
|
if ( ! LibEntry->SaveDoc( docfile ) )
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
LibEntry = (EDA_LibComponentStruct*) PQNext( m_Entries,
|
||||||
|
LibEntry, NULL );
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf( libfile, "#\n#End Library\n" );
|
||||||
|
if ( docfile )
|
||||||
|
fprintf( docfile, "#\n#End Doc Library\n" );
|
||||||
|
fclose( libfile );
|
||||||
|
fclose( docfile );
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxString LibraryStruct::GetName()
|
||||||
|
{
|
||||||
|
return m_fileName.GetName();
|
||||||
|
}
|
||||||
|
|
|
@ -5,8 +5,11 @@
|
||||||
#ifndef CLASS_LIBRARY_H
|
#ifndef CLASS_LIBRARY_H
|
||||||
#define CLASS_LIBRARY_H
|
#define CLASS_LIBRARY_H
|
||||||
|
|
||||||
|
|
||||||
#include "class_libentry.h"
|
#include "class_libentry.h"
|
||||||
|
|
||||||
|
WX_DECLARE_LIST( EDA_LibComponentStruct, LIB_CMP_LIST );
|
||||||
|
|
||||||
|
|
||||||
/******************************/
|
/******************************/
|
||||||
/* Classe to handle a library */
|
/* Classe to handle a library */
|
||||||
|
@ -15,23 +18,24 @@
|
||||||
class LibraryStruct
|
class LibraryStruct
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int m_Type; /* type indicator */
|
int m_Type; /* type indicator */
|
||||||
wxString m_Name; /* Short Name of the loaded library (without path). */
|
wxString m_Name; /* Library file name (without path). */
|
||||||
wxString m_FullFileName; /* Full File Name (with path) of library. */
|
wxString m_FullFileName; /* Full File Name (with path) of library. */
|
||||||
wxString m_Header; /* first line of loaded library. */
|
wxString m_Header; /* first line of loaded library. */
|
||||||
int m_NumOfParts; /* Number of parts this library has. */
|
int m_NumOfParts; /* Number of parts this library has. */
|
||||||
PriorQue* m_Entries; /* Parts themselves are saved here. */
|
PriorQue* m_Entries; /* Parts themselves are saved here. */
|
||||||
LibraryStruct* m_Pnext; /* Point on next lib in chain. */
|
LibraryStruct* m_Pnext; /* Point on next lib in chain. */
|
||||||
int m_Modified; /* flag indicateur d'edition */
|
int m_Modified; /* flag indicateur d'edition */
|
||||||
int m_Size; // Size in bytes (for statistics)
|
int m_Size; // Size in bytes (for statistics)
|
||||||
unsigned long m_TimeStamp; // Signature temporelle
|
unsigned long m_TimeStamp; // Signature temporelle
|
||||||
int m_Flags; // variable used in some functions
|
int m_Flags; // variable used in some functions
|
||||||
bool m_IsLibCache; /* False for the "standard" libraries,
|
bool m_IsLibCache; /* False for the "standard" libraries,
|
||||||
* True for the library cache */
|
* True for the library cache */
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LibraryStruct( int type, const wxString& name, const wxString& fullname );
|
LibraryStruct( int type, const wxString& name, const wxString& fullname );
|
||||||
~LibraryStruct();
|
~LibraryStruct();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SaveLibrary
|
* Function SaveLibrary
|
||||||
* writes the data structures for this object out to 2 file
|
* writes the data structures for this object out to 2 file
|
||||||
|
@ -42,11 +46,27 @@ public:
|
||||||
* @return bool - true if success writing else false.
|
* @return bool - true if success writing else false.
|
||||||
*/
|
*/
|
||||||
bool SaveLibrary( const wxString& aFullFileName );
|
bool SaveLibrary( const wxString& aFullFileName );
|
||||||
|
|
||||||
bool ReadHeader( FILE* file, int* LineNum );
|
bool ReadHeader( FILE* file, int* LineNum );
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool WriteHeader( FILE* file );
|
bool WriteHeader( FILE* file );
|
||||||
|
|
||||||
|
/* NOTE: For future expansion, do not delete. */
|
||||||
|
public:
|
||||||
|
LibraryStruct( const wxChar* fileName = NULL );
|
||||||
|
|
||||||
|
bool Save( const wxString& saveAsFile );
|
||||||
|
|
||||||
|
wxString GetName();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
wxFileName m_fileName; /* Library file name. */
|
||||||
|
wxDateTime m_DateTime; /* Library save time and date. */
|
||||||
|
wxString m_Version; /* Library save version. */
|
||||||
|
LIB_CMP_LIST m_componentList; /* List of components in this library. */
|
||||||
|
|
||||||
|
friend class EDA_LibComponentStruct;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CLASS_LIBRARY_H
|
#endif // CLASS_LIBRARY_H
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -11,9 +11,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "gr_basic.h"
|
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "class_drawpanel.h"
|
||||||
|
#include "base_struct.h"
|
||||||
|
#include "gr_basic.h"
|
||||||
|
#include "drawtxt.h"
|
||||||
|
|
||||||
#include "program.h"
|
#include "program.h"
|
||||||
#include "libcmp.h"
|
#include "libcmp.h"
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
|
@ -22,11 +25,10 @@
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************/
|
SCH_CMP_FIELD::SCH_CMP_FIELD( const wxPoint& aPos, int aFieldId,
|
||||||
SCH_CMP_FIELD::SCH_CMP_FIELD( const wxPoint& aPos, int aFieldId, SCH_COMPONENT* aParent, wxString aName ) :
|
SCH_COMPONENT* aParent, wxString aName ) :
|
||||||
SCH_ITEM( aParent, DRAW_PART_TEXT_STRUCT_TYPE ),
|
SCH_ITEM( aParent, DRAW_PART_TEXT_STRUCT_TYPE ),
|
||||||
EDA_TextStruct()
|
EDA_TextStruct()
|
||||||
/***************************************************************************/
|
|
||||||
{
|
{
|
||||||
m_Pos = aPos;
|
m_Pos = aPos;
|
||||||
m_FieldId = aFieldId;
|
m_FieldId = aFieldId;
|
||||||
|
@ -38,13 +40,139 @@ SCH_CMP_FIELD::SCH_CMP_FIELD( const wxPoint& aPos, int aFieldId, SCH_COMPONENT*
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************/
|
|
||||||
SCH_CMP_FIELD::~SCH_CMP_FIELD()
|
SCH_CMP_FIELD::~SCH_CMP_FIELD()
|
||||||
/************************************/
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Function ImportValues
|
|
||||||
|
/**
|
||||||
|
* Routine de trace des textes type Field du composant.
|
||||||
|
* entree:
|
||||||
|
* DrawMode: mode de trace
|
||||||
|
*/
|
||||||
|
void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
|
const wxPoint& offset, int DrawMode, int Color )
|
||||||
|
{
|
||||||
|
int orient;
|
||||||
|
EDA_Colors color;
|
||||||
|
wxPoint pos; /* Position des textes */
|
||||||
|
SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) m_Parent;
|
||||||
|
GRTextHorizJustifyType hjustify;
|
||||||
|
GRTextVertJustifyType vjustify;
|
||||||
|
int LineWidth = MAX( m_Width, g_DrawMinimunLineWidth );
|
||||||
|
|
||||||
|
if( ( m_Attributs & TEXT_NO_VISIBLE ) || IsVoid() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
GRSetDrawMode( DC, DrawMode );
|
||||||
|
|
||||||
|
/* Calcul de la position des textes, selon orientation du composant */
|
||||||
|
orient = m_Orient;
|
||||||
|
hjustify = m_HJustify; vjustify = m_VJustify;
|
||||||
|
pos = m_Pos - DrawLibItem->m_Pos;
|
||||||
|
|
||||||
|
pos = DrawLibItem->GetScreenCoord( pos );
|
||||||
|
pos += DrawLibItem->m_Pos;
|
||||||
|
|
||||||
|
/* Y a t-il rotation (pour l'orientation, la justification)*/
|
||||||
|
if( DrawLibItem->m_Transform[0][1] ) // Rotation du composant de 90deg
|
||||||
|
{
|
||||||
|
if( orient == TEXT_ORIENT_HORIZ )
|
||||||
|
orient = TEXT_ORIENT_VERT;
|
||||||
|
else
|
||||||
|
orient = TEXT_ORIENT_HORIZ;
|
||||||
|
/* Y a t-il rotation, miroir (pour les justifications)*/
|
||||||
|
GRTextHorizJustifyType tmp = hjustify;
|
||||||
|
hjustify = (GRTextHorizJustifyType) vjustify;
|
||||||
|
vjustify = (GRTextVertJustifyType) tmp;
|
||||||
|
if( DrawLibItem->m_Transform[1][0] < 0 )
|
||||||
|
switch ( vjustify )
|
||||||
|
{
|
||||||
|
case GR_TEXT_VJUSTIFY_BOTTOM:
|
||||||
|
vjustify = GR_TEXT_VJUSTIFY_TOP;
|
||||||
|
break;
|
||||||
|
case GR_TEXT_VJUSTIFY_TOP:
|
||||||
|
vjustify = GR_TEXT_VJUSTIFY_BOTTOM;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if( DrawLibItem->m_Transform[1][0] > 0 )
|
||||||
|
switch ( hjustify )
|
||||||
|
{
|
||||||
|
case GR_TEXT_HJUSTIFY_LEFT:
|
||||||
|
hjustify = GR_TEXT_HJUSTIFY_RIGHT;
|
||||||
|
break;
|
||||||
|
case GR_TEXT_HJUSTIFY_RIGHT:
|
||||||
|
hjustify = GR_TEXT_HJUSTIFY_LEFT;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Texte horizontal: Y a t-il miroir (pour les justifications)*/
|
||||||
|
if( DrawLibItem->m_Transform[0][0] < 0 )
|
||||||
|
switch ( hjustify )
|
||||||
|
{
|
||||||
|
case GR_TEXT_HJUSTIFY_LEFT:
|
||||||
|
hjustify = GR_TEXT_HJUSTIFY_RIGHT;
|
||||||
|
break;
|
||||||
|
case GR_TEXT_HJUSTIFY_RIGHT:
|
||||||
|
hjustify = GR_TEXT_HJUSTIFY_LEFT;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if( DrawLibItem->m_Transform[1][1] > 0 )
|
||||||
|
switch ( vjustify )
|
||||||
|
{
|
||||||
|
case GR_TEXT_VJUSTIFY_BOTTOM:
|
||||||
|
vjustify = GR_TEXT_VJUSTIFY_TOP;
|
||||||
|
break;
|
||||||
|
case GR_TEXT_VJUSTIFY_TOP:
|
||||||
|
vjustify = GR_TEXT_VJUSTIFY_BOTTOM;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( m_FieldId == REFERENCE )
|
||||||
|
color = ReturnLayerColor( LAYER_REFERENCEPART );
|
||||||
|
else if( m_FieldId == VALUE )
|
||||||
|
color = ReturnLayerColor( LAYER_VALUEPART );
|
||||||
|
else
|
||||||
|
color = ReturnLayerColor( LAYER_FIELDS );
|
||||||
|
|
||||||
|
if( !m_AddExtraText || (m_FieldId != REFERENCE) )
|
||||||
|
{
|
||||||
|
DrawGraphicText( panel, DC, pos, color, m_Text,
|
||||||
|
orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
|
||||||
|
m_Size, hjustify, vjustify, LineWidth, m_Italic );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* For more than one part per package, we must add the part selection
|
||||||
|
* A, B, ... or 1, 2, .. to the reference. */
|
||||||
|
wxString fulltext = m_Text;
|
||||||
|
#if defined(KICAD_GOST)
|
||||||
|
fulltext.Append( '.');
|
||||||
|
fulltext.Append( '1' - 1 + DrawLibItem->m_Multi );
|
||||||
|
#else
|
||||||
|
fulltext.Append( 'A' - 1 + DrawLibItem->m_Multi );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
DrawGraphicText( panel, DC, pos, color, fulltext,
|
||||||
|
orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
|
||||||
|
m_Size, hjustify, vjustify, LineWidth, m_Italic );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function ImportValues
|
||||||
* copy parameters from a source.
|
* copy parameters from a source.
|
||||||
* Pointers and specific values (position, texts) are not copied
|
* Pointers and specific values (position, texts) are not copied
|
||||||
* used to init a field from the model read from a lib entry
|
* used to init a field from the model read from a lib entry
|
||||||
|
@ -62,13 +190,11 @@ void SCH_CMP_FIELD::ImportValues( const LibDrawField& aSource )
|
||||||
m_Mirror = aSource.m_Mirror;
|
m_Mirror = aSource.m_Mirror;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************/
|
/**
|
||||||
void SCH_CMP_FIELD::SwapData( SCH_CMP_FIELD* copyitem )
|
* Used if undo / redo command:
|
||||||
/**************************************************************************/
|
|
||||||
|
|
||||||
/* Used if undo / redo command:
|
|
||||||
* swap data between this and copyitem
|
* swap data between this and copyitem
|
||||||
*/
|
*/
|
||||||
|
void SCH_CMP_FIELD::SwapData( SCH_CMP_FIELD* copyitem )
|
||||||
{
|
{
|
||||||
EXCHG( m_Text, copyitem->m_Text );
|
EXCHG( m_Text, copyitem->m_Text );
|
||||||
EXCHG( m_Layer, copyitem->m_Layer );
|
EXCHG( m_Layer, copyitem->m_Layer );
|
||||||
|
@ -84,13 +210,11 @@ void SCH_CMP_FIELD::SwapData( SCH_CMP_FIELD* copyitem )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************/
|
/**
|
||||||
bool SCH_CMP_FIELD::IsVoid()
|
* return True if the field is void, i.e.:
|
||||||
/*********************************/
|
|
||||||
|
|
||||||
/* return True if the field is void, i.e.:
|
|
||||||
* contains "~" or ""
|
* contains "~" or ""
|
||||||
*/
|
*/
|
||||||
|
bool SCH_CMP_FIELD::IsVoid()
|
||||||
{
|
{
|
||||||
if( m_Text.IsEmpty() || m_Text == wxT( "~" ) )
|
if( m_Text.IsEmpty() || m_Text == wxT( "~" ) )
|
||||||
return true;
|
return true;
|
||||||
|
@ -98,15 +222,13 @@ bool SCH_CMP_FIELD::IsVoid()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************/
|
/**
|
||||||
EDA_Rect SCH_CMP_FIELD::GetBoundaryBox() const
|
* Function GetBoundaryBox()
|
||||||
/********************************************/
|
* @return an EDA_Rect contains the real (user coordinates) boundary box for
|
||||||
|
* a text field,
|
||||||
/** Function GetBoundaryBox()
|
|
||||||
* @return an EDA_Rect contains the real (user coordinates) boundary box for a text field,
|
|
||||||
* according to the component position, rotation, mirror ...
|
* according to the component position, rotation, mirror ...
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
EDA_Rect SCH_CMP_FIELD::GetBoundaryBox() const
|
||||||
{
|
{
|
||||||
EDA_Rect BoundaryBox;
|
EDA_Rect BoundaryBox;
|
||||||
int hjustify, vjustify;
|
int hjustify, vjustify;
|
||||||
|
@ -125,7 +247,8 @@ EDA_Rect SCH_CMP_FIELD::GetBoundaryBox() const
|
||||||
if( m_FieldId == REFERENCE ) // Real Text can be U1 or U1A
|
if( m_FieldId == REFERENCE ) // Real Text can be U1 or U1A
|
||||||
{
|
{
|
||||||
EDA_LibComponentStruct* Entry =
|
EDA_LibComponentStruct* Entry =
|
||||||
FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
|
FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString,
|
||||||
|
FIND_ROOT );
|
||||||
if( Entry && (Entry->m_UnitCount > 1) )
|
if( Entry && (Entry->m_UnitCount > 1) )
|
||||||
textlen++; // because U1 is show as U1A or U1B ...
|
textlen++; // because U1 is show as U1A or U1B ...
|
||||||
}
|
}
|
||||||
|
@ -143,7 +266,8 @@ EDA_Rect SCH_CMP_FIELD::GetBoundaryBox() const
|
||||||
y2 = pos.y + (DrawLibItem->m_Transform[1][0] * x1)
|
y2 = pos.y + (DrawLibItem->m_Transform[1][0] * x1)
|
||||||
+ (DrawLibItem->m_Transform[1][1] * y1);
|
+ (DrawLibItem->m_Transform[1][1] * y1);
|
||||||
|
|
||||||
/* If the component orientation is +/- 90 deg, the text orientation must be changed */
|
/* If the component orientation is +/- 90 deg, the text orientation must
|
||||||
|
* be changed */
|
||||||
if( DrawLibItem->m_Transform[0][1] )
|
if( DrawLibItem->m_Transform[0][1] )
|
||||||
{
|
{
|
||||||
if( orient == TEXT_ORIENT_HORIZ )
|
if( orient == TEXT_ORIENT_HORIZ )
|
||||||
|
@ -207,9 +331,7 @@ EDA_Rect SCH_CMP_FIELD::GetBoundaryBox() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************/
|
|
||||||
bool SCH_CMP_FIELD::Save( FILE* aFile ) const
|
bool SCH_CMP_FIELD::Save( FILE* aFile ) const
|
||||||
/*********************************************/
|
|
||||||
{
|
{
|
||||||
char hjustify = 'C';
|
char hjustify = 'C';
|
||||||
if( m_HJustify == GR_TEXT_HJUSTIFY_LEFT )
|
if( m_HJustify == GR_TEXT_HJUSTIFY_LEFT )
|
||||||
|
@ -224,15 +346,15 @@ bool SCH_CMP_FIELD::Save( FILE* aFile ) const
|
||||||
vjustify = 'T';
|
vjustify = 'T';
|
||||||
|
|
||||||
if( fprintf( aFile, "F %d \"%s\" %c %-3d %-3d %-3d %4.4X %c %c%c%c",
|
if( fprintf( aFile, "F %d \"%s\" %c %-3d %-3d %-3d %4.4X %c %c%c%c",
|
||||||
m_FieldId,
|
m_FieldId,
|
||||||
CONV_TO_UTF8( m_Text ),
|
CONV_TO_UTF8( m_Text ),
|
||||||
m_Orient == TEXT_ORIENT_HORIZ ? 'H' : 'V',
|
m_Orient == TEXT_ORIENT_HORIZ ? 'H' : 'V',
|
||||||
m_Pos.x, m_Pos.y,
|
m_Pos.x, m_Pos.y,
|
||||||
m_Size.x,
|
m_Size.x,
|
||||||
m_Attributs,
|
m_Attributs,
|
||||||
hjustify, vjustify,
|
hjustify, vjustify,
|
||||||
m_Italic ? 'I' : 'N',
|
m_Italic ? 'I' : 'N',
|
||||||
m_Width > 1 ? 'B' : 'N' ) == EOF )
|
m_Width > 1 ? 'B' : 'N' ) == EOF )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -253,3 +375,42 @@ bool SCH_CMP_FIELD::Save( FILE* aFile ) const
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SCH_CMP_FIELD::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
|
||||||
|
{
|
||||||
|
int fieldNdx;
|
||||||
|
EDA_LibComponentStruct* Entry;
|
||||||
|
|
||||||
|
frame->DrawPanel->ManageCurseur = NULL;
|
||||||
|
frame->DrawPanel->ForceCloseManageCurseur = NULL;
|
||||||
|
|
||||||
|
SCH_COMPONENT* component = (SCH_COMPONENT*) GetParent();
|
||||||
|
|
||||||
|
// save old cmp in undo list
|
||||||
|
if( g_ItemToUndoCopy && ( g_ItemToUndoCopy->Type() == component->Type()) )
|
||||||
|
{
|
||||||
|
component->SwapData( (SCH_COMPONENT*) g_ItemToUndoCopy );
|
||||||
|
frame->SaveCopyInUndoList( component, IS_CHANGED );
|
||||||
|
component->SwapData( (SCH_COMPONENT*) g_ItemToUndoCopy );
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldNdx = m_FieldId;
|
||||||
|
m_AddExtraText = 0;
|
||||||
|
if( fieldNdx == REFERENCE )
|
||||||
|
{
|
||||||
|
Entry = FindLibPart( component->m_ChipName.GetData(), wxEmptyString,
|
||||||
|
FIND_ROOT );
|
||||||
|
if( Entry != NULL )
|
||||||
|
{
|
||||||
|
if( Entry->m_UnitCount > 1 )
|
||||||
|
m_AddExtraText = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Draw( frame->DrawPanel, DC, wxPoint(0,0), GR_DEFAULT_DRAWMODE );
|
||||||
|
m_Flags = 0;
|
||||||
|
frame->GetScreen()->SetCurItem( NULL );
|
||||||
|
frame->GetScreen()->SetModify();
|
||||||
|
frame->SetCurrentField( NULL );
|
||||||
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "gr_basic.h"
|
#include "gr_basic.h"
|
||||||
|
#include "class_drawpanel.h"
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "program.h"
|
#include "program.h"
|
||||||
|
@ -17,11 +18,18 @@
|
||||||
/* class DrawBusEntryStruct */
|
/* class DrawBusEntryStruct */
|
||||||
/***************************/
|
/***************************/
|
||||||
|
|
||||||
|
const wxChar* NameMarqueurType[] =
|
||||||
|
{
|
||||||
|
wxT( "" ),
|
||||||
|
wxT( "ERC" ),
|
||||||
|
wxT( "PCB" ),
|
||||||
|
wxT( "SIMUL" ),
|
||||||
|
wxT( "?????" )
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************/
|
|
||||||
DrawBusEntryStruct::DrawBusEntryStruct( const wxPoint& pos, int shape, int id ) :
|
DrawBusEntryStruct::DrawBusEntryStruct( const wxPoint& pos, int shape, int id ) :
|
||||||
SCH_ITEM( NULL, DRAW_BUSENTRY_STRUCT_TYPE )
|
SCH_ITEM( NULL, DRAW_BUSENTRY_STRUCT_TYPE )
|
||||||
/*******************************************************************/
|
|
||||||
{
|
{
|
||||||
m_Pos = pos;
|
m_Pos = pos;
|
||||||
m_Size.x = 100;
|
m_Size.x = 100;
|
||||||
|
@ -40,19 +48,13 @@ DrawBusEntryStruct::DrawBusEntryStruct( const wxPoint& pos, int shape, int id )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************/
|
|
||||||
wxPoint DrawBusEntryStruct::m_End() const
|
wxPoint DrawBusEntryStruct::m_End() const
|
||||||
/****************************************/
|
|
||||||
|
|
||||||
// retourne la coord de fin du raccord
|
|
||||||
{
|
{
|
||||||
return wxPoint( m_Pos.x + m_Size.x, m_Pos.y + m_Size.y );
|
return wxPoint( m_Pos.x + m_Size.x, m_Pos.y + m_Size.y );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************/
|
|
||||||
DrawBusEntryStruct* DrawBusEntryStruct::GenCopy()
|
DrawBusEntryStruct* DrawBusEntryStruct::GenCopy()
|
||||||
/***************************************************/
|
|
||||||
{
|
{
|
||||||
DrawBusEntryStruct* newitem = new DrawBusEntryStruct( m_Pos, 0, 0 );
|
DrawBusEntryStruct* newitem = new DrawBusEntryStruct( m_Pos, 0, 0 );
|
||||||
|
|
||||||
|
@ -88,8 +90,7 @@ bool DrawBusEntryStruct::Save( FILE* aFile ) const
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
if( fprintf( aFile, "\t%-4d %-4d %-4d %-4d\n",
|
if( fprintf( aFile, "\t%-4d %-4d %-4d %-4d\n",
|
||||||
m_Pos.x, m_Pos.y,
|
m_Pos.x, m_Pos.y, m_End().x, m_End().y ) == EOF )
|
||||||
m_End().x, m_End().y ) == EOF )
|
|
||||||
{
|
{
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
@ -98,9 +99,7 @@ bool DrawBusEntryStruct::Save( FILE* aFile ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************/
|
|
||||||
EDA_Rect DrawBusEntryStruct::GetBoundingBox()
|
EDA_Rect DrawBusEntryStruct::GetBoundingBox()
|
||||||
/*********************************************/
|
|
||||||
{
|
{
|
||||||
int dx = m_Pos.x - m_End().x;
|
int dx = m_Pos.x - m_End().x;
|
||||||
int dy = m_Pos.y - m_End().y;
|
int dy = m_Pos.y - m_End().y;
|
||||||
|
@ -108,19 +107,38 @@ EDA_Rect DrawBusEntryStruct::GetBoundingBox()
|
||||||
|
|
||||||
box.Normalize();
|
box.Normalize();
|
||||||
int width = MAX( m_Width, g_DrawMinimunLineWidth );
|
int width = MAX( m_Width, g_DrawMinimunLineWidth );
|
||||||
box.Inflate(width/2, width/2);
|
box.Inflate( width / 2, width / 2 );
|
||||||
|
|
||||||
return box;
|
return box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DrawBusEntryStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
|
const wxPoint& offset, int DrawMode, int Color )
|
||||||
|
{
|
||||||
|
int color;
|
||||||
|
int width = MAX( m_Width, g_DrawMinimunLineWidth );
|
||||||
|
|
||||||
|
if( Color >= 0 )
|
||||||
|
color = Color;
|
||||||
|
else
|
||||||
|
color = ReturnLayerColor( m_Layer );
|
||||||
|
GRSetDrawMode( DC, DrawMode );
|
||||||
|
|
||||||
|
if( m_Layer == LAYER_BUS )
|
||||||
|
width *= 3;
|
||||||
|
|
||||||
|
GRLine( &panel->m_ClipBox, DC, m_Pos.x + offset.x, m_Pos.y + offset.y,
|
||||||
|
m_End().x + offset.x, m_End().y + offset.y, width, color );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************/
|
/****************************/
|
||||||
/* class DrawJunctionStruct */
|
/* class DrawJunctionStruct */
|
||||||
/***************************/
|
/***************************/
|
||||||
|
|
||||||
/************************************************************/
|
|
||||||
DrawJunctionStruct::DrawJunctionStruct( const wxPoint& pos ) :
|
DrawJunctionStruct::DrawJunctionStruct( const wxPoint& pos ) :
|
||||||
SCH_ITEM( NULL, DRAW_JUNCTION_STRUCT_TYPE )
|
SCH_ITEM( NULL, DRAW_JUNCTION_STRUCT_TYPE )
|
||||||
/************************************************************/
|
|
||||||
{
|
{
|
||||||
m_Pos = pos;
|
m_Pos = pos;
|
||||||
m_Layer = LAYER_JUNCTION;
|
m_Layer = LAYER_JUNCTION;
|
||||||
|
@ -169,19 +187,36 @@ EDA_Rect DrawJunctionStruct::GetBoundingBox()
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*********************************************************/
|
|
||||||
bool DrawJunctionStruct::HitTest( const wxPoint& aPosRef )
|
|
||||||
/*********************************************************/
|
|
||||||
/** Function HitTest
|
/** Function HitTest
|
||||||
* @return true if the point aPosRef is within item area
|
* @return true if the point aPosRef is within item area
|
||||||
* @param aPosRef = a wxPoint to test
|
* @param aPosRef = a wxPoint to test
|
||||||
*/
|
*/
|
||||||
|
bool DrawJunctionStruct::HitTest( const wxPoint& aPosRef )
|
||||||
{
|
{
|
||||||
wxPoint dist = aPosRef - m_Pos;
|
wxPoint dist = aPosRef - m_Pos;
|
||||||
|
|
||||||
if( sqrt( ((double) dist.x * dist.x) + ((double) dist.y * dist.y) ) < DRAWJUNCTION_SIZE )
|
return sqrt( ( (double) ( dist.x * dist.x ) ) +
|
||||||
return true;
|
( (double) ( dist.y * dist.y ) ) ) < DRAWJUNCTION_SIZE;
|
||||||
return false;
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* Routine to redraw connection struct. *
|
||||||
|
*****************************************************************************/
|
||||||
|
void DrawJunctionStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
|
const wxPoint& offset, int DrawMode, int Color )
|
||||||
|
{
|
||||||
|
int color;
|
||||||
|
|
||||||
|
if( Color >= 0 )
|
||||||
|
color = Color;
|
||||||
|
else
|
||||||
|
color = ReturnLayerColor( m_Layer );
|
||||||
|
GRSetDrawMode( DC, DrawMode );
|
||||||
|
|
||||||
|
GRFilledCircle( &panel->m_ClipBox, DC, m_Pos.x + offset.x,
|
||||||
|
m_Pos.y + offset.y, DRAWJUNCTION_SIZE, 0, color, color );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -192,8 +227,7 @@ void DrawJunctionStruct::Show( int nestLevel, std::ostream& os )
|
||||||
wxString s = GetClass();
|
wxString s = GetClass();
|
||||||
|
|
||||||
NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str()
|
NestedSpace( nestLevel, os ) << '<' << s.Lower().mb_str()
|
||||||
<< m_Pos
|
<< m_Pos << "/>\n";
|
||||||
<< "/>\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -219,25 +253,24 @@ DrawNoConnectStruct* DrawNoConnectStruct::GenCopy()
|
||||||
return newitem;
|
return newitem;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************/
|
|
||||||
EDA_Rect DrawNoConnectStruct::GetBoundingBox()
|
EDA_Rect DrawNoConnectStruct::GetBoundingBox()
|
||||||
/*********************************************/
|
|
||||||
{
|
{
|
||||||
const int DELTA = DRAWNOCONNECT_SIZE / 2;
|
const int DELTA = DRAWNOCONNECT_SIZE / 2;
|
||||||
EDA_Rect box( wxPoint( m_Pos.x - DELTA, m_Pos.y - DELTA ), wxSize( 2 * DELTA, 2 * DELTA ) );
|
EDA_Rect box( wxPoint( m_Pos.x - DELTA, m_Pos.y - DELTA ),
|
||||||
|
wxSize( 2 * DELTA, 2 * DELTA ) );
|
||||||
|
|
||||||
box.Normalize();
|
box.Normalize();
|
||||||
return box;
|
return box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************/
|
/**
|
||||||
bool DrawNoConnectStruct::HitTest( const wxPoint& aPosRef )
|
* Function HitTest
|
||||||
/*********************************************************/
|
|
||||||
/** Function HitTest
|
|
||||||
* @return true if the point aPosRef is within item area
|
* @return true if the point aPosRef is within item area
|
||||||
* @param aPosRef = a wxPoint to test
|
* @param aPosRef = a wxPoint to test
|
||||||
*/
|
*/
|
||||||
|
bool DrawNoConnectStruct::HitTest( const wxPoint& aPosRef )
|
||||||
{
|
{
|
||||||
int width = g_DrawMinimunLineWidth;
|
int width = g_DrawMinimunLineWidth;
|
||||||
int delta = ( DRAWNOCONNECT_SIZE + width) / 2;
|
int delta = ( DRAWNOCONNECT_SIZE + width) / 2;
|
||||||
|
@ -268,10 +301,65 @@ bool DrawNoConnectStruct::Save( FILE* aFile ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DrawNoConnectStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
|
const wxPoint& offset, int DrawMode, int Color )
|
||||||
|
{
|
||||||
|
const int DELTA = (DRAWNOCONNECT_SIZE / 2);
|
||||||
|
int pX, pY, color;
|
||||||
|
int width = g_DrawMinimunLineWidth;
|
||||||
|
|
||||||
|
pX = m_Pos.x + offset.x; pY = m_Pos.y + offset.y;
|
||||||
|
|
||||||
|
if( Color >= 0 )
|
||||||
|
color = Color;
|
||||||
|
else
|
||||||
|
color = ReturnLayerColor( LAYER_NOCONNECT );
|
||||||
|
GRSetDrawMode( DC, DrawMode );
|
||||||
|
|
||||||
|
GRLine( &panel->m_ClipBox, DC, pX - DELTA, pY - DELTA, pX + DELTA,
|
||||||
|
pY + DELTA, width, color );
|
||||||
|
GRLine( &panel->m_ClipBox, DC, pX + DELTA, pY - DELTA, pX - DELTA,
|
||||||
|
pY + DELTA, width, color );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************/
|
/**************************/
|
||||||
/* class DrawMarkerStruct */
|
/* class DrawMarkerStruct */
|
||||||
/**************************/
|
/**************************/
|
||||||
|
|
||||||
|
char marq_bitmap[] =
|
||||||
|
{
|
||||||
|
12, 12, 0, 0, /* Dimensions x et y, offsets x et y du bitmap de marqueurs*/
|
||||||
|
YELLOW, /* Couleur */
|
||||||
|
1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, /* bitmap: >= 1 : color, */
|
||||||
|
1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, /* 0 = notrace */
|
||||||
|
1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0,
|
||||||
|
1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0,
|
||||||
|
1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0,
|
||||||
|
1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
char marqERC_bitmap[] =
|
||||||
|
{
|
||||||
|
8, 8, 0, 0, /* Dimensions x et y , offsets x et y du bitmap de marqueurs*/
|
||||||
|
-1, /* Color: -1 = couleur non pr<70>cis<69>e */
|
||||||
|
1, 1, 1, 1, 1, 0, 0, 0,
|
||||||
|
1, 1, 1, 0, 1, 0, 0, 0,
|
||||||
|
1, 1, 1, 1, 0, 0, 0, 0,
|
||||||
|
1, 0, 1, 1, 1, 0, 0, 0,
|
||||||
|
1, 1, 0, 1, 1, 1, 0, 0,
|
||||||
|
0, 0, 0, 0, 1, 1, 1, 0,
|
||||||
|
0, 0, 0, 0, 0, 1, 1, 1,
|
||||||
|
0, 0, 0, 0, 0, 0, 1, 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
DrawMarkerStruct::DrawMarkerStruct( const wxPoint& pos, const wxString& text ) :
|
DrawMarkerStruct::DrawMarkerStruct( const wxPoint& pos, const wxString& text ) :
|
||||||
SCH_ITEM( NULL, DRAW_MARKER_STRUCT_TYPE )
|
SCH_ITEM( NULL, DRAW_MARKER_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
|
@ -332,9 +420,8 @@ bool DrawMarkerStruct::Save( FILE* aFile ) const
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
if( fprintf( aFile, "Kmarq %c %-4d %-4d \"%s\" F=%X\n",
|
if( fprintf( aFile, "Kmarq %c %-4d %-4d \"%s\" F=%X\n",
|
||||||
int( m_Type ) + 'A',
|
int( m_Type ) + 'A', m_Pos.x, m_Pos.y,
|
||||||
m_Pos.x, m_Pos.y,
|
CONV_TO_UTF8( m_Comment ), m_MarkFlags ) == EOF )
|
||||||
CONV_TO_UTF8( m_Comment ), m_MarkFlags ) == EOF )
|
|
||||||
{
|
{
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
@ -343,6 +430,28 @@ bool DrawMarkerStruct::Save( FILE* aFile ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DrawMarkerStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
|
const wxPoint& offset, int DrawMode, int Color )
|
||||||
|
{
|
||||||
|
#define WAR 1 // utilis<69> aussi dans erc.cpp
|
||||||
|
|
||||||
|
if( m_Type == MARQ_ERC )
|
||||||
|
{
|
||||||
|
int color = Color;
|
||||||
|
if( Color <= 0 )
|
||||||
|
{
|
||||||
|
color = (m_MarkFlags == WAR ) ?
|
||||||
|
g_LayerDescr.LayerColor[LAYER_ERC_WARN] :
|
||||||
|
g_LayerDescr.LayerColor[LAYER_ERC_ERR];
|
||||||
|
}
|
||||||
|
|
||||||
|
Draw_Marqueur( panel, DC, m_Pos + offset, marqERC_bitmap, DrawMode,
|
||||||
|
color );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Draw_Marqueur( panel, DC, m_Pos + offset, marq_bitmap, DrawMode, Color );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************/
|
/***************************/
|
||||||
/* Class EDA_DrawLineStruct */
|
/* Class EDA_DrawLineStruct */
|
||||||
|
@ -375,9 +484,7 @@ EDA_DrawLineStruct::EDA_DrawLineStruct( const wxPoint& pos, int layer ) :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************/
|
|
||||||
EDA_DrawLineStruct* EDA_DrawLineStruct::GenCopy()
|
EDA_DrawLineStruct* EDA_DrawLineStruct::GenCopy()
|
||||||
/***************************************************/
|
|
||||||
{
|
{
|
||||||
EDA_DrawLineStruct* newitem = new EDA_DrawLineStruct( m_Start, m_Layer );
|
EDA_DrawLineStruct* newitem = new EDA_DrawLineStruct( m_Start, m_Layer );
|
||||||
|
|
||||||
|
@ -387,12 +494,7 @@ EDA_DrawLineStruct* EDA_DrawLineStruct::GenCopy()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************/
|
|
||||||
bool EDA_DrawLineStruct::IsOneEndPointAt( const wxPoint& pos )
|
bool EDA_DrawLineStruct::IsOneEndPointAt( const wxPoint& pos )
|
||||||
/************************************************************/
|
|
||||||
|
|
||||||
/* Return TRUE if the start or the end point is in position pos
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
if( (pos.x == m_Start.x) && (pos.y == m_Start.y) )
|
if( (pos.x == m_Start.x) && (pos.y == m_Start.y) )
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -423,7 +525,6 @@ void EDA_DrawLineStruct::Show( int nestLevel, std::ostream& os )
|
||||||
"</" << GetClass().Lower().mb_str() << ">\n";
|
"</" << GetClass().Lower().mb_str() << ">\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -438,7 +539,8 @@ EDA_Rect EDA_DrawLineStruct::GetBoundingBox()
|
||||||
int ymax = MAX( m_Start.y, m_End.y ) + width;
|
int ymax = MAX( m_Start.y, m_End.y ) + width;
|
||||||
|
|
||||||
// return a rectangle which is [pos,dim) in nature. therefore the +1
|
// return a rectangle which is [pos,dim) in nature. therefore the +1
|
||||||
EDA_Rect ret( wxPoint( xmin, ymin ), wxSize( xmax - xmin + 1, ymax - ymin + 1 ) );
|
EDA_Rect ret( wxPoint( xmin, ymin ),
|
||||||
|
wxSize( xmax - xmin + 1, ymax - ymin + 1 ) );
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -467,9 +569,8 @@ bool EDA_DrawLineStruct::Save( FILE* aFile ) const
|
||||||
{
|
{
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
if (fprintf( aFile, "\t%-4d %-4d %-4d %-4d\n",
|
if ( fprintf( aFile, "\t%-4d %-4d %-4d %-4d\n", m_Start.x,m_Start.y,
|
||||||
m_Start.x,m_Start.y,
|
m_End.x,m_End.y ) == EOF )
|
||||||
m_End.x,m_End.y) == EOF)
|
|
||||||
{
|
{
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
@ -478,14 +579,46 @@ bool EDA_DrawLineStruct::Save( FILE* aFile ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EDA_DrawLineStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
|
const wxPoint& offset, int DrawMode, int Color )
|
||||||
|
{
|
||||||
|
int color;
|
||||||
|
int width = MAX( m_Width, g_DrawMinimunLineWidth );
|
||||||
|
|
||||||
|
if( Color >= 0 )
|
||||||
|
color = Color;
|
||||||
|
else
|
||||||
|
color = ReturnLayerColor( m_Layer );
|
||||||
|
|
||||||
|
GRSetDrawMode( DC, DrawMode );
|
||||||
|
|
||||||
|
// FIXME: Not compatable with new zoom.
|
||||||
|
if( (m_Layer == LAYER_BUS) && panel->GetScreen()->Scale( width ) <= 1 )
|
||||||
|
width *= 3;
|
||||||
|
|
||||||
|
if( m_Layer == LAYER_NOTES )
|
||||||
|
GRDashedLine( &panel->m_ClipBox, DC, m_Start.x + offset.x,
|
||||||
|
m_Start.y + offset.y, m_End.x + offset.x,
|
||||||
|
m_End.y + offset.y, width, color );
|
||||||
|
else
|
||||||
|
GRLine( &panel->m_ClipBox, DC, m_Start.x + offset.x,
|
||||||
|
m_Start.y + offset.y, m_End.x + offset.x, m_End.y + offset.y,
|
||||||
|
width, color );
|
||||||
|
|
||||||
|
if( m_StartIsDangling )
|
||||||
|
DrawDanglingSymbol( panel, DC, m_Start + offset, color );
|
||||||
|
|
||||||
|
if( m_EndIsDangling )
|
||||||
|
DrawDanglingSymbol( panel, DC, m_End + offset, color );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************/
|
/****************************/
|
||||||
/* Class DrawPolylineStruct */
|
/* Class DrawPolylineStruct */
|
||||||
/****************************/
|
/****************************/
|
||||||
|
|
||||||
/***********************************************************/
|
|
||||||
DrawPolylineStruct::DrawPolylineStruct( int layer ) :
|
DrawPolylineStruct::DrawPolylineStruct( int layer ) :
|
||||||
SCH_ITEM( NULL, DRAW_POLYLINE_STRUCT_TYPE )
|
SCH_ITEM( NULL, DRAW_POLYLINE_STRUCT_TYPE )
|
||||||
/***********************************************************/
|
|
||||||
{
|
{
|
||||||
m_Width = GR_NORM_WIDTH;
|
m_Width = GR_NORM_WIDTH;
|
||||||
|
|
||||||
|
@ -508,19 +641,14 @@ DrawPolylineStruct::DrawPolylineStruct( int layer ) :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************/
|
|
||||||
DrawPolylineStruct::~DrawPolylineStruct()
|
DrawPolylineStruct::~DrawPolylineStruct()
|
||||||
/*********************************************/
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************/
|
|
||||||
DrawPolylineStruct* DrawPolylineStruct::GenCopy()
|
DrawPolylineStruct* DrawPolylineStruct::GenCopy()
|
||||||
/*****************************************************/
|
|
||||||
{
|
{
|
||||||
DrawPolylineStruct* newitem =
|
DrawPolylineStruct* newitem = new DrawPolylineStruct( m_Layer );
|
||||||
new DrawPolylineStruct( m_Layer );
|
|
||||||
newitem->m_PolyPoints = m_PolyPoints; // std::vector copy
|
newitem->m_PolyPoints = m_PolyPoints; // std::vector copy
|
||||||
return newitem;
|
return newitem;
|
||||||
}
|
}
|
||||||
|
@ -546,15 +674,14 @@ bool DrawPolylineStruct::Save( FILE* aFile ) const
|
||||||
if( m_Width != GR_NORM_WIDTH )
|
if( m_Width != GR_NORM_WIDTH )
|
||||||
width = "Bus";
|
width = "Bus";
|
||||||
if( fprintf( aFile, "Poly %s %s %d\n",
|
if( fprintf( aFile, "Poly %s %s %d\n",
|
||||||
width, layer, GetCornerCount() ) == EOF )
|
width, layer, GetCornerCount() ) == EOF )
|
||||||
{
|
{
|
||||||
success = false;
|
return false;
|
||||||
return success;
|
|
||||||
}
|
}
|
||||||
for( unsigned ii = 0; ii < GetCornerCount(); ii++ )
|
for( unsigned ii = 0; ii < GetCornerCount(); ii++ )
|
||||||
{
|
{
|
||||||
if( fprintf( aFile, "\t%-4d %-4d\n",
|
if( fprintf( aFile, "\t%-4d %-4d\n",
|
||||||
m_PolyPoints[ii ].x, m_PolyPoints[ii].y ) == EOF )
|
m_PolyPoints[ii ].x, m_PolyPoints[ii].y ) == EOF )
|
||||||
{
|
{
|
||||||
success = false;
|
success = false;
|
||||||
break;
|
break;
|
||||||
|
@ -563,3 +690,38 @@ bool DrawPolylineStruct::Save( FILE* aFile ) const
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DrawPolylineStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
|
const wxPoint& offset, int DrawMode, int Color )
|
||||||
|
{
|
||||||
|
int color;
|
||||||
|
int width = MAX( m_Width, g_DrawMinimunLineWidth );
|
||||||
|
|
||||||
|
if( Color >= 0 )
|
||||||
|
color = Color;
|
||||||
|
else
|
||||||
|
color = ReturnLayerColor( m_Layer );
|
||||||
|
|
||||||
|
GRSetDrawMode( DC, DrawMode );
|
||||||
|
|
||||||
|
if( m_Layer == LAYER_BUS )
|
||||||
|
{
|
||||||
|
width *= 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
GRMoveTo( m_PolyPoints[0].x, m_PolyPoints[0].y );
|
||||||
|
|
||||||
|
if( m_Layer == LAYER_NOTES )
|
||||||
|
{
|
||||||
|
for( unsigned i = 1; i < GetCornerCount(); i++ )
|
||||||
|
GRDashedLineTo( &panel->m_ClipBox, DC, m_PolyPoints[i].x + offset.x,
|
||||||
|
m_PolyPoints[i].y + offset.y, width, color );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for( unsigned i = 1; i < GetCornerCount(); i++ )
|
||||||
|
GRLineTo( &panel->m_ClipBox, DC, m_PolyPoints[i].x + offset.x,
|
||||||
|
m_PolyPoints[i].y + offset.y, width, color );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -5,10 +5,6 @@
|
||||||
#ifndef CLASS_SCHEMATIC_ITEMS_H
|
#ifndef CLASS_SCHEMATIC_ITEMS_H
|
||||||
#define CLASS_SCHEMATIC_ITEMS_H
|
#define CLASS_SCHEMATIC_ITEMS_H
|
||||||
|
|
||||||
#ifndef eda_global
|
|
||||||
#define eda_global extern
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DRAWJUNCTION_SIZE 16 /* Rayon du symbole connexion */
|
#define DRAWJUNCTION_SIZE 16 /* Rayon du symbole connexion */
|
||||||
#define DRAWMARKER_SIZE 16 /* Rayon du symbole marqueur */
|
#define DRAWMARKER_SIZE 16 /* Rayon du symbole marqueur */
|
||||||
#define DRAWNOCONNECT_SIZE 48 /* Rayon du symbole No Connexion */
|
#define DRAWNOCONNECT_SIZE 48 /* Rayon du symbole No Connexion */
|
||||||
|
@ -28,18 +24,7 @@ enum TypeMarker { /* Type des Marqueurs */
|
||||||
|
|
||||||
|
|
||||||
/* Messages correspondants aux types des marqueurs */
|
/* Messages correspondants aux types des marqueurs */
|
||||||
#ifdef MAIN
|
|
||||||
const wxChar* NameMarqueurType[] =
|
|
||||||
{
|
|
||||||
wxT( "" ),
|
|
||||||
wxT( "ERC" ),
|
|
||||||
wxT( "PCB" ),
|
|
||||||
wxT( "SIMUL" ),
|
|
||||||
wxT( "?????" )
|
|
||||||
};
|
|
||||||
#else
|
|
||||||
extern const wxChar* NameMarqueurType[];
|
extern const wxChar* NameMarqueurType[];
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,7 +40,7 @@ public:
|
||||||
wxPoint m_End; // Line end point
|
wxPoint m_End; // Line end point
|
||||||
|
|
||||||
bool m_StartIsDangling;
|
bool m_StartIsDangling;
|
||||||
bool m_EndIsDangling; // TRUE si Start ou End not connected (wires, tracks...)
|
bool m_EndIsDangling; // TRUE si Start ou End not connected (wires, tracks...)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EDA_DrawLineStruct( const wxPoint& pos, int layer );
|
EDA_DrawLineStruct( const wxPoint& pos, int layer );
|
||||||
|
@ -81,12 +66,13 @@ public:
|
||||||
|
|
||||||
EDA_Rect GetBoundingBox();
|
EDA_Rect GetBoundingBox();
|
||||||
|
|
||||||
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
|
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
||||||
int Color = -1 );
|
int draw_mode, int Color = -1 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Save
|
* Function Save
|
||||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
* writes the data structures for this object out to a FILE in "*.brd"
|
||||||
|
* format.
|
||||||
* @param aFile The FILE to write to.
|
* @param aFile The FILE to write to.
|
||||||
* @return bool - true if success writing else false.
|
* @return bool - true if success writing else false.
|
||||||
*/
|
*/
|
||||||
|
@ -94,12 +80,11 @@ public:
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
void Show( int nestLevel, std::ostream& os );
|
void Show( int nestLevel, std::ostream& os );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class DrawMarkerStruct : public SCH_ITEM /* marqueurs */
|
class DrawMarkerStruct : public SCH_ITEM /* marqueurs */
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxPoint m_Pos; /* XY coordinates of marker. */
|
wxPoint m_Pos; /* XY coordinates of marker. */
|
||||||
|
@ -118,12 +103,14 @@ public:
|
||||||
|
|
||||||
DrawMarkerStruct* GenCopy();
|
DrawMarkerStruct* GenCopy();
|
||||||
wxString GetComment();
|
wxString GetComment();
|
||||||
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
int draw_mode, int Color = -1 );
|
const wxPoint& offset, int draw_mode,
|
||||||
|
int Color = -1 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Save
|
* Function Save
|
||||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
* writes the data structures for this object out to a FILE in "*.brd"
|
||||||
|
* format.
|
||||||
* @param aFile The FILE to write to.
|
* @param aFile The FILE to write to.
|
||||||
* @return bool - true if success writing else false.
|
* @return bool - true if success writing else false.
|
||||||
*/
|
*/
|
||||||
|
@ -131,7 +118,6 @@ public:
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
void Show( int nestLevel, std::ostream& os );
|
void Show( int nestLevel, std::ostream& os );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -151,12 +137,14 @@ public:
|
||||||
|
|
||||||
|
|
||||||
DrawNoConnectStruct* GenCopy();
|
DrawNoConnectStruct* GenCopy();
|
||||||
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
int draw_mode, int Color = -1 );
|
const wxPoint& offset, int draw_mode,
|
||||||
|
int Color = -1 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Save
|
* Function Save
|
||||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
* writes the data structures for this object out to a FILE in "*.brd"
|
||||||
|
* format.
|
||||||
* @param aFile The FILE to write to.
|
* @param aFile The FILE to write to.
|
||||||
* @return bool - true if success writing else false.
|
* @return bool - true if success writing else false.
|
||||||
*/
|
*/
|
||||||
|
@ -195,12 +183,14 @@ public:
|
||||||
|
|
||||||
DrawBusEntryStruct* GenCopy();
|
DrawBusEntryStruct* GenCopy();
|
||||||
wxPoint m_End() const; // retourne la coord de fin du raccord
|
wxPoint m_End() const; // retourne la coord de fin du raccord
|
||||||
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
int draw_mode, int Color = -1 );
|
const wxPoint& offset, int draw_mode,
|
||||||
|
int Color = -1 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Save
|
* Function Save
|
||||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
* writes the data structures for this object out to a FILE in "*.brd"
|
||||||
|
* format.
|
||||||
* @param aFile The FILE to write to.
|
* @param aFile The FILE to write to.
|
||||||
* @return bool - true if success writing else false.
|
* @return bool - true if success writing else false.
|
||||||
*/
|
*/
|
||||||
|
@ -226,12 +216,14 @@ public:
|
||||||
|
|
||||||
|
|
||||||
DrawPolylineStruct* GenCopy();
|
DrawPolylineStruct* GenCopy();
|
||||||
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
int draw_mode, int Color = -1 );
|
const wxPoint& offset, int draw_mode,
|
||||||
|
int Color = -1 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Save
|
* Function Save
|
||||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
* writes the data structures for this object out to a FILE in "*.brd"
|
||||||
|
* format.
|
||||||
* @param aFile The FILE to write to.
|
* @param aFile The FILE to write to.
|
||||||
* @return bool - true if success writing else false.
|
* @return bool - true if success writing else false.
|
||||||
*/
|
*/
|
||||||
|
@ -252,7 +244,8 @@ public:
|
||||||
unsigned GetCornerCount() const { return m_PolyPoints.size(); }
|
unsigned GetCornerCount() const { return m_PolyPoints.size(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
class DrawJunctionStruct : public SCH_ITEM
|
|
||||||
|
class DrawJunctionStruct : public SCH_ITEM
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxPoint m_Pos; /* XY coordinates of connection. */
|
wxPoint m_Pos; /* XY coordinates of connection. */
|
||||||
|
@ -277,8 +270,9 @@ public:
|
||||||
|
|
||||||
DrawJunctionStruct* GenCopy();
|
DrawJunctionStruct* GenCopy();
|
||||||
|
|
||||||
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
int draw_mode, int Color = -1 );
|
const wxPoint& offset, int draw_mode,
|
||||||
|
int Color = -1 );
|
||||||
/**
|
/**
|
||||||
* Function Save
|
* Function Save
|
||||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
* writes the data structures for this object out to a FILE in "*.brd" format.
|
||||||
|
@ -289,7 +283,6 @@ public:
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
void Show( int nestLevel, std::ostream& os );
|
void Show( int nestLevel, std::ostream& os );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -41,40 +41,6 @@ void SetaParent( EDA_BaseStruct* Struct, BASE_SCREEN* Screen )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************/
|
|
||||||
void SCH_ITEM::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
|
|
||||||
/***************************************************************/
|
|
||||||
|
|
||||||
/* place the struct in EEDrawList.
|
|
||||||
* if it is a new item, it it also put in undo list
|
|
||||||
* for an "old" item, saving it in undo list must be done before editiing,
|
|
||||||
* and not here!
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
if( m_Flags & IS_NEW )
|
|
||||||
{
|
|
||||||
SCH_SCREEN* screen = frame->GetScreen();
|
|
||||||
if( !screen->CheckIfOnDrawList( this ) ) //don't want a loop!
|
|
||||||
screen->AddToDrawList( this );
|
|
||||||
g_ItemToRepeat = this;
|
|
||||||
frame->SaveCopyInUndoList( this, IS_NEW );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_Flags = 0;
|
|
||||||
frame->GetScreen()->SetModify();
|
|
||||||
frame->GetScreen()->SetCurItem( NULL );
|
|
||||||
frame->DrawPanel->ManageCurseur = NULL;
|
|
||||||
frame->DrawPanel->ForceCloseManageCurseur = NULL;
|
|
||||||
|
|
||||||
if( DC )
|
|
||||||
{
|
|
||||||
frame->DrawPanel->CursorOff( DC ); // Erase schematic cursor
|
|
||||||
RedrawOneStruct( frame->DrawPanel, DC, this, GR_DEFAULT_DRAWMODE );
|
|
||||||
frame->DrawPanel->CursorOn( DC ); // Display schematic cursor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Class SCH_SCREEN: classe de gestion d'un affichage pour schematique */
|
/* Class SCH_SCREEN: classe de gestion d'un affichage pour schematique */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
|
@ -23,6 +23,52 @@
|
||||||
/* class SCH_HIERLABEL */
|
/* class SCH_HIERLABEL */
|
||||||
/************************/
|
/************************/
|
||||||
|
|
||||||
|
/* Messages correspondants aux types ou forme des labels */
|
||||||
|
const char* SheetLabelType[] =
|
||||||
|
{
|
||||||
|
"Input",
|
||||||
|
"Output",
|
||||||
|
"BiDi",
|
||||||
|
"3State",
|
||||||
|
"UnSpc",
|
||||||
|
"?????"
|
||||||
|
};
|
||||||
|
|
||||||
|
int TemplateIN_HN[] = { 6, 0, 0, -1, -1, -2, -1, -2, 1, -1, 1, 0, 0 };
|
||||||
|
int TemplateIN_HI[] = { 6, 0, 0, 1, 1, 2, 1, 2, -1, 1, -1, 0, 0 };
|
||||||
|
int TemplateIN_BOTTOM[] = { 6, 0, 0, 1, -1, 1, -2, -1, -2, -1, -1, 0, 0 };
|
||||||
|
int TemplateIN_UP[] = { 6, 0, 0, 1, 1, 1, 2, -1, 2, -1, 1, 0, 0 };
|
||||||
|
|
||||||
|
int TemplateOUT_HN[] = { 6, -2, 0, -1, 1, 0, 1, 0, -1, -1, -1, -2, 0 };
|
||||||
|
int TemplateOUT_HI[] = { 6, 2, 0, 1, -1, 0, -1, 0, 1, 1, 1, 2, 0 };
|
||||||
|
int TemplateOUT_BOTTOM[] = { 6, 0, -2, 1, -1, 1, 0, -1, 0, -1, -1, 0, -2 };
|
||||||
|
int TemplateOUT_UP[] = { 6, 0, 2, 1, 1, 1, 0, -1, 0, -1, 1, 0, 2 };
|
||||||
|
|
||||||
|
int TemplateUNSPC_HN[] = { 5, 0, -1, -2, -1, -2, 1, 0, 1, 0, -1 };
|
||||||
|
int TemplateUNSPC_HI[] = { 5, 0, -1, 2, -1, 2, 1, 0, 1, 0, -1 };
|
||||||
|
int TemplateUNSPC_BOTTOM[] = { 5, 1, 0, 1, -2, -1, -2, -1, 0, 1, 0 };
|
||||||
|
int TemplateUNSPC_UP[] = { 5, 1, 0, 1, 2, -1, 2, -1, 0, 1, 0 };
|
||||||
|
|
||||||
|
int TemplateBIDI_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 };
|
||||||
|
int TemplateBIDI_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 };
|
||||||
|
int TemplateBIDI_BOTTOM[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 };
|
||||||
|
int TemplateBIDI_UP[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 };
|
||||||
|
|
||||||
|
int Template3STATE_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 };
|
||||||
|
int Template3STATE_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 };
|
||||||
|
int Template3STATE_BOTTOM[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 };
|
||||||
|
int Template3STATE_UP[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 };
|
||||||
|
|
||||||
|
int* TemplateShape[5][4] =
|
||||||
|
{
|
||||||
|
{ TemplateIN_HN, TemplateIN_UP, TemplateIN_HI, TemplateIN_BOTTOM },
|
||||||
|
{ TemplateOUT_HN, TemplateOUT_UP, TemplateOUT_HI, TemplateOUT_BOTTOM },
|
||||||
|
{ TemplateBIDI_HN, TemplateBIDI_UP, TemplateBIDI_HI, TemplateBIDI_BOTTOM },
|
||||||
|
{ Template3STATE_HN, Template3STATE_UP, Template3STATE_HI, Template3STATE_BOTTOM },
|
||||||
|
{ TemplateUNSPC_HN, TemplateUNSPC_UP, TemplateUNSPC_HI, TemplateUNSPC_BOTTOM }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) :
|
SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) :
|
||||||
SCH_ITEM( NULL, aType )
|
SCH_ITEM( NULL, aType )
|
||||||
|
|
|
@ -5,10 +5,6 @@
|
||||||
#ifndef CLASS_TEXT_LABEL_H
|
#ifndef CLASS_TEXT_LABEL_H
|
||||||
#define CLASS_TEXT_LABEL_H
|
#define CLASS_TEXT_LABEL_H
|
||||||
|
|
||||||
#ifndef eda_global
|
|
||||||
#define eda_global extern
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "macros.h"
|
#include "macros.h"
|
||||||
#include "base_struct.h"
|
#include "base_struct.h"
|
||||||
|
|
||||||
|
@ -23,58 +19,9 @@ typedef enum {
|
||||||
} TypeSheetLabel;
|
} TypeSheetLabel;
|
||||||
|
|
||||||
/* Messages correspondants aux types ou forme des labels */
|
/* Messages correspondants aux types ou forme des labels */
|
||||||
#ifdef MAIN
|
|
||||||
const char* SheetLabelType[] =
|
|
||||||
{
|
|
||||||
"Input",
|
|
||||||
"Output",
|
|
||||||
"BiDi",
|
|
||||||
"3State",
|
|
||||||
"UnSpc",
|
|
||||||
"?????"
|
|
||||||
};
|
|
||||||
#else
|
|
||||||
extern const char* SheetLabelType[];
|
extern const char* SheetLabelType[];
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Description du graphisme des icones associes aux types des Global_Labels */
|
|
||||||
#ifdef MAIN
|
|
||||||
int TemplateIN_HN[] = { 6, 0, 0, -1, -1, -2, -1, -2, 1, -1, 1, 0, 0 };
|
|
||||||
int TemplateIN_HI[] = { 6, 0, 0, 1, 1, 2, 1, 2, -1, 1, -1, 0, 0 };
|
|
||||||
int TemplateIN_BOTTOM[] = { 6, 0, 0, 1, -1, 1, -2, -1, -2, -1, -1, 0, 0 };
|
|
||||||
int TemplateIN_UP[] = { 6, 0, 0, 1, 1, 1, 2, -1, 2, -1, 1, 0, 0 };
|
|
||||||
|
|
||||||
int TemplateOUT_HN[] = { 6, -2, 0, -1, 1, 0, 1, 0, -1, -1, -1, -2, 0 };
|
|
||||||
int TemplateOUT_HI[] = { 6, 2, 0, 1, -1, 0, -1, 0, 1, 1, 1, 2, 0 };
|
|
||||||
int TemplateOUT_BOTTOM[] = { 6, 0, -2, 1, -1, 1, 0, -1, 0, -1, -1, 0, -2 };
|
|
||||||
int TemplateOUT_UP[] = { 6, 0, 2, 1, 1, 1, 0, -1, 0, -1, 1, 0, 2 };
|
|
||||||
|
|
||||||
int TemplateUNSPC_HN[] = { 5, 0, -1, -2, -1, -2, 1, 0, 1, 0, -1 };
|
|
||||||
int TemplateUNSPC_HI[] = { 5, 0, -1, 2, -1, 2, 1, 0, 1, 0, -1 };
|
|
||||||
int TemplateUNSPC_BOTTOM[] = { 5, 1, 0, 1, -2, -1, -2, -1, 0, 1, 0 };
|
|
||||||
int TemplateUNSPC_UP[] = { 5, 1, 0, 1, 2, -1, 2, -1, 0, 1, 0 };
|
|
||||||
|
|
||||||
int TemplateBIDI_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 };
|
|
||||||
int TemplateBIDI_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 };
|
|
||||||
int TemplateBIDI_BOTTOM[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 };
|
|
||||||
int TemplateBIDI_UP[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 };
|
|
||||||
|
|
||||||
int Template3STATE_HN[] = { 5, 0, 0, -1, -1, -2, 0, -1, 1, 0, 0 };
|
|
||||||
int Template3STATE_HI[] = { 5, 0, 0, 1, -1, 2, 0, 1, 1, 0, 0 };
|
|
||||||
int Template3STATE_BOTTOM[] = { 5, 0, 0, -1, -1, 0, -2, 1, -1, 0, 0 };
|
|
||||||
int Template3STATE_UP[] = { 5, 0, 0, -1, 1, 0, 2, 1, 1, 0, 0 };
|
|
||||||
|
|
||||||
int* TemplateShape[5][4] =
|
|
||||||
{
|
|
||||||
{ TemplateIN_HN, TemplateIN_UP, TemplateIN_HI, TemplateIN_BOTTOM },
|
|
||||||
{ TemplateOUT_HN, TemplateOUT_UP, TemplateOUT_HI, TemplateOUT_BOTTOM },
|
|
||||||
{ TemplateBIDI_HN, TemplateBIDI_UP, TemplateBIDI_HI, TemplateBIDI_BOTTOM },
|
|
||||||
{ Template3STATE_HN, Template3STATE_UP, Template3STATE_HI, Template3STATE_BOTTOM },
|
|
||||||
{ TemplateUNSPC_HN, TemplateUNSPC_UP, TemplateUNSPC_HI, TemplateUNSPC_BOTTOM }
|
|
||||||
};
|
|
||||||
#else
|
|
||||||
extern int* TemplateShape[5][4];
|
extern int* TemplateShape[5][4];
|
||||||
#endif
|
|
||||||
|
|
||||||
class SCH_TEXT : public SCH_ITEM
|
class SCH_TEXT : public SCH_ITEM
|
||||||
, public EDA_TextStruct
|
, public EDA_TextStruct
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2,22 +2,23 @@
|
||||||
/* Headers fo library definition and lib component definitions */
|
/* Headers fo library definition and lib component definitions */
|
||||||
/****************************************************************/
|
/****************************************************************/
|
||||||
|
|
||||||
/* Definitions of graphic items used to create shapes of component in libraries (libentry)
|
/* Definitions of graphic items used to create shapes in component libraries.
|
||||||
*/
|
*/
|
||||||
#ifndef CLASSES_BODY_ITEMS_H
|
#ifndef CLASSES_BODY_ITEMS_H
|
||||||
#define CLASSES_BODY_ITEMS_H
|
#define CLASSES_BODY_ITEMS_H
|
||||||
|
|
||||||
#define TARGET_PIN_DIAM 12 /* Circle diameter drawn at the active end of pins */
|
#define TARGET_PIN_DIAM 12 /* Circle diameter drawn at the active end of
|
||||||
|
* pins */
|
||||||
|
|
||||||
#define DEFAULT_TEXT_SIZE 50 /* Default size for field texts */
|
#define DEFAULT_TEXT_SIZE 50 /* Default size for field texts */
|
||||||
#define PART_NAME_LEN 15 /* Maximum length of part name. */
|
#define PART_NAME_LEN 15 /* Maximum length of part name. */
|
||||||
#define PREFIX_NAME_LEN 5 /* Maximum length of prefix (IC, R, SW etc.). */
|
#define PREFIX_NAME_LEN 5 /* Maximum length of prefix (IC, R, SW etc.). */
|
||||||
#define PIN_WIDTH 100 /* Width between 2 pins in internal units. */
|
#define PIN_WIDTH 100 /* Width between 2 pins in internal units. */
|
||||||
#define PIN_LENGTH 300 /* Default Length of each pin to be drawn. */
|
#define PIN_LENGTH 300 /* Default Length of each pin to be drawn. */
|
||||||
|
|
||||||
#define INVERT_PIN_RADIUS 35 /* Radius of inverted pin circle. */
|
#define INVERT_PIN_RADIUS 35 /* Radius of inverted pin circle. */
|
||||||
#define CLOCK_PIN_DIM 40 /* Dim of clock pin symbol. */
|
#define CLOCK_PIN_DIM 40 /* Dim of clock pin symbol. */
|
||||||
#define IEEE_SYMBOL_PIN_DIM 40 /* Dim of special pin symbol. */
|
#define IEEE_SYMBOL_PIN_DIM 40 /* Dim of special pin symbol. */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,12 +26,14 @@
|
||||||
* is the set of fill types used in plotting or drawing enclosed areas.
|
* is the set of fill types used in plotting or drawing enclosed areas.
|
||||||
*/
|
*/
|
||||||
enum FILL_T {
|
enum FILL_T {
|
||||||
NO_FILL, // Poly, Square, Circle, Arc = option No Fill
|
NO_FILL, // Poly, Square, Circle, Arc = option No Fill
|
||||||
FILLED_SHAPE, // Poly, Square, Circle, Arc = option Fill with current color ("Solid shape")
|
FILLED_SHAPE, /* Poly, Square, Circle, Arc = option Fill
|
||||||
FILLED_WITH_BG_BODYCOLOR, /* Poly, Square, Circle, Arc = option Fill with background body color,
|
* with current color ("Solid shape") */
|
||||||
* translucent (texts inside this shape can be seen)
|
FILLED_WITH_BG_BODYCOLOR, /* Poly, Square, Circle, Arc = option Fill
|
||||||
* not filled in B&W mode when plotting or printing
|
* with background body color, translucent
|
||||||
*/
|
* (texts inside this shape can be seen)
|
||||||
|
* not filled in B&W mode when plotting or
|
||||||
|
* printing */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,7 +41,7 @@ enum FILL_T {
|
||||||
* Enum ElectricPinType
|
* Enum ElectricPinType
|
||||||
* is the set of schematic pin types, used in ERC tests.
|
* is the set of schematic pin types, used in ERC tests.
|
||||||
*/
|
*/
|
||||||
enum ElectricPinType { /* Type des Pins. si modif: modifier tableau des mgs suivant */
|
enum ElectricPinType {
|
||||||
PIN_INPUT,
|
PIN_INPUT,
|
||||||
PIN_OUTPUT,
|
PIN_OUTPUT,
|
||||||
PIN_BIDI,
|
PIN_BIDI,
|
||||||
|
@ -54,25 +57,7 @@ enum ElectricPinType { /* Type des Pins. si modif: modifier tableau des mgs
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Messages d'affichage du type electrique */
|
/* Messages d'affichage du type electrique */
|
||||||
eda_global const wxChar* MsgPinElectricType[]
|
extern const wxChar* MsgPinElectricType[];
|
||||||
#ifdef MAIN
|
|
||||||
= {
|
|
||||||
wxT( "input" ),
|
|
||||||
wxT( "output" ),
|
|
||||||
wxT( "BiDi" ),
|
|
||||||
wxT( "3state" ),
|
|
||||||
wxT( "passive" ),
|
|
||||||
wxT( "unspc" ),
|
|
||||||
wxT( "power_in" ),
|
|
||||||
wxT( "power_out" ),
|
|
||||||
wxT( "openCol" ),
|
|
||||||
wxT( "openEm" ),
|
|
||||||
wxT( "?????" )
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
|
|
||||||
/* Autres bits: bits du membre .Flag des Pins */
|
/* Autres bits: bits du membre .Flag des Pins */
|
||||||
#define PINNOTDRAW 1 /* si 1: pin invisible */
|
#define PINNOTDRAW 1 /* si 1: pin invisible */
|
||||||
|
@ -128,11 +113,13 @@ public:
|
||||||
class LibEDA_BaseStruct : public EDA_BaseStruct
|
class LibEDA_BaseStruct : public EDA_BaseStruct
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int m_Unit; /* Unit identification (for multi part per parkage)
|
int m_Unit; /* Unit identification (for multi part per parkage)
|
||||||
* 0 if the item is common to all units */
|
* 0 if the item is common to all units */
|
||||||
int m_Convert; /* Shape identification (for parts which have a convert shape)
|
int m_Convert; /* Shape identification (for parts which have a convert
|
||||||
* 0 if the item is common to all shapes */
|
* shape) 0 if the item is common to all shapes */
|
||||||
FILL_T m_Fill; /* NO_FILL, FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR. has meaning only for some items */
|
FILL_T m_Fill; /* NO_FILL, FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR.
|
||||||
|
* has meaning only for some items */
|
||||||
|
wxString m_typeName; /* Name of object displayed in the message panel. */
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LibEDA_BaseStruct* Next()
|
LibEDA_BaseStruct* Next()
|
||||||
|
@ -146,29 +133,40 @@ public:
|
||||||
|
|
||||||
/** Function Draw (virtual pure)
|
/** Function Draw (virtual pure)
|
||||||
* Draw A body item
|
* Draw A body item
|
||||||
* @param aPanel = DrawPanel to use (can be null) mainly used for clipping purposes
|
* @param aPanel = DrawPanel to use (can be null) mainly used for clipping
|
||||||
|
* purposes
|
||||||
* @param aDC = Device Context (can be null)
|
* @param aDC = Device Context (can be null)
|
||||||
* @param aOffset = offset to draw
|
* @param aOffset = offset to draw
|
||||||
* @param aColor = -1 to use the normal body item color, or use this color if >= 0
|
* @param aColor = -1 to use the normal body item color, or use this color
|
||||||
|
* if >= 0
|
||||||
* @param aDrawMode = GR_OR, GR_XOR, ...
|
* @param aDrawMode = GR_OR, GR_XOR, ...
|
||||||
* @param aData = value or pointer used to pass others parametres, depending on body items.
|
* @param aData = value or pointer used to pass others parametres,
|
||||||
* used for some items to force to force no fill mode
|
* depending on body items. used for some items to force
|
||||||
* ( has meaning only for items what can be filled ). used in printing or moving objects mode
|
* to force no fill mode ( has meaning only for items what
|
||||||
* or to pass refernce to the lib component for pins
|
* can be filled ). used in printing or moving objects mode
|
||||||
|
* or to pass refernce to the lib component for pins
|
||||||
* @param aTransformMatrix = Transform Matrix (rotaion, mirror ..)
|
* @param aTransformMatrix = Transform Matrix (rotaion, mirror ..)
|
||||||
*/
|
*/
|
||||||
virtual void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, int aColor,
|
virtual void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC,
|
||||||
int aDrawMode, void* aData, const int aTransformMatrix[2][2] ) = 0;
|
const wxPoint &aOffset, int aColor, int aDrawMode,
|
||||||
|
void* aData, const int aTransformMatrix[2][2] ) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Save
|
* Function Save
|
||||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
* writes the data structures for this object out to a FILE in "*.brd"
|
||||||
|
* format.
|
||||||
* @param aFile The FILE to write to.
|
* @param aFile The FILE to write to.
|
||||||
* @return bool - true if success writing else false.
|
* @return bool - true if success writing else false.
|
||||||
*/
|
*/
|
||||||
virtual bool Save( FILE* aFile ) const = 0;
|
virtual bool Save( FILE* aFile ) const = 0;
|
||||||
|
virtual bool Load( char* line, wxString& errorMsg ) = 0;
|
||||||
|
|
||||||
void Display_Infos_DrawEntry( WinEDA_DrawFrame* frame );
|
virtual EDA_Rect GetBoundingBox()
|
||||||
|
{
|
||||||
|
return EDA_BaseStruct::GetBoundingBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void DisplayInfo( WinEDA_DrawFrame* frame );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -183,14 +181,17 @@ public:
|
||||||
int m_PinShape; /* Bitwise ORed: Pin shape (see enum DrawPinShape) */
|
int m_PinShape; /* Bitwise ORed: Pin shape (see enum DrawPinShape) */
|
||||||
int m_PinType; /* Electrical pin properties */
|
int m_PinType; /* Electrical pin properties */
|
||||||
int m_Attributs; /* bit 0 != 0: pin invisible */
|
int m_Attributs; /* bit 0 != 0: pin invisible */
|
||||||
long m_PinNum; /* Pin number: 4 Ascii code like "12" or "anod" or "G6"
|
long m_PinNum; /* Pin number: 4 Ascii code like "12" or "anod"
|
||||||
* "12" is stored as "12\0\0" ans does not depend on endian type*/
|
* or "G6" "12" is stored as "12\0\0" ans does not
|
||||||
|
* depend on endian type*/
|
||||||
wxString m_PinName;
|
wxString m_PinName;
|
||||||
int m_PinNumSize, m_PinNameSize; /* Pin num and Pin name sizes */
|
int m_PinNumSize;
|
||||||
|
int m_PinNameSize; /* Pin num and Pin name sizes */
|
||||||
|
|
||||||
// int m_PinNumWidth, m_PinNameWidth; /* (Currently Unused) Pin num and Pin name text width */
|
// int m_PinNumWidth, m_PinNameWidth; /* (Currently Unused) Pin num and Pin name text width */
|
||||||
wxPoint m_Pos; /* Position or centre (Arc and Circle) or start point (segments) */
|
wxPoint m_Pos; /* Position or centre (Arc and Circle) or start
|
||||||
int m_Width; /* Tickness */
|
* point (segments) */
|
||||||
|
int m_Width; /* Line width */
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LibDrawPin();
|
LibDrawPin();
|
||||||
|
@ -207,32 +208,36 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Save
|
* Function Save
|
||||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
* writes the data structures for this object out to a FILE in "*.brd"
|
||||||
|
* format.
|
||||||
* @param aFile The FILE to write to.
|
* @param aFile The FILE to write to.
|
||||||
* @return bool - true if success writing else false.
|
* @return bool - true if success writing else false.
|
||||||
*/
|
*/
|
||||||
virtual bool Save( FILE* aFile ) const;
|
virtual bool Save( FILE* aFile ) const;
|
||||||
|
virtual bool Load( char* line, wxString& errorMsg );
|
||||||
|
|
||||||
|
|
||||||
LibDrawPin* GenCopy();
|
LibDrawPin* GenCopy();
|
||||||
void Display_Infos( WinEDA_DrawFrame* frame );
|
virtual void DisplayInfo( WinEDA_DrawFrame* frame );
|
||||||
|
virtual EDA_Rect GetBoundingBox();
|
||||||
wxPoint ReturnPinEndPoint();
|
wxPoint ReturnPinEndPoint();
|
||||||
|
|
||||||
int ReturnPinDrawOrient( const int TransMat[2][2] );
|
int ReturnPinDrawOrient( const int TransMat[2][2] );
|
||||||
void ReturnPinStringNum( wxString& buffer ) const;
|
void ReturnPinStringNum( wxString& buffer ) const;
|
||||||
void SetPinNumFromString( wxString& buffer );
|
void SetPinNumFromString( wxString& buffer );
|
||||||
|
|
||||||
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, int aColor,
|
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset,
|
||||||
int aDrawMode, void* aData, const int aTransformMatrix[2][2] );
|
int aColor, int aDrawMode, void* aData,
|
||||||
|
const int aTransformMatrix[2][2] );
|
||||||
|
|
||||||
void DrawPinSymbol( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& pin_pos,
|
void DrawPinSymbol( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
int orient,
|
const wxPoint& pin_pos, int orient,
|
||||||
int DrawMode, int Color = -1 );
|
int DrawMode, int Color = -1 );
|
||||||
|
|
||||||
void DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
|
void DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
wxPoint& pin_pos, int orient,
|
wxPoint& pin_pos, int orient,
|
||||||
int TextInside, bool DrawPinNum, bool DrawPinName,
|
int TextInside, bool DrawPinNum,
|
||||||
int Color, int DrawMode );
|
bool DrawPinName, int Color, int DrawMode );
|
||||||
void PlotPinTexts( wxPoint& pin_pos,
|
void PlotPinTexts( wxPoint& pin_pos,
|
||||||
int orient,
|
int orient,
|
||||||
int TextInside,
|
int TextInside,
|
||||||
|
@ -247,14 +252,16 @@ public:
|
||||||
/* Graphic Body Item: Arc */
|
/* Graphic Body Item: Arc */
|
||||||
/**************************/
|
/**************************/
|
||||||
|
|
||||||
class LibDrawArc : public LibEDA_BaseStruct
|
class LibDrawArc : public LibEDA_BaseStruct
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int m_Rayon;
|
int m_Rayon;
|
||||||
int t1, t2; /* position des 2 extremites de l'arc en 0.1 degres */
|
int t1, t2; /* position des 2 extremites de l'arc en 0.1 degres */
|
||||||
wxPoint m_ArcStart, m_ArcEnd; /* position des 2 extremites de l'arc en coord reelles*/
|
wxPoint m_ArcStart;
|
||||||
wxPoint m_Pos; /* Position or centre (Arc and Circle) or start point (segments) */
|
wxPoint m_ArcEnd; /* position des 2 extremites de l'arc en coord reelles*/
|
||||||
int m_Width; /* Tickness */
|
wxPoint m_Pos; /* Position or centre (Arc and Circle) or start point
|
||||||
|
* (segments) */
|
||||||
|
int m_Width; /* Line width */
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LibDrawArc();
|
LibDrawArc();
|
||||||
|
@ -267,28 +274,35 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Save
|
* Function Save
|
||||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
* writes the data structures for this object out to a FILE in "*.brd"
|
||||||
|
* format.
|
||||||
* @param aFile The FILE to write to.
|
* @param aFile The FILE to write to.
|
||||||
* @return bool - true if success writing else false.
|
* @return bool - true if success writing else false.
|
||||||
*/
|
*/
|
||||||
virtual bool Save( FILE* aFile ) const;
|
virtual bool Save( FILE* aFile ) const;
|
||||||
|
virtual bool Load( char* line, wxString& errorMsg );
|
||||||
|
|
||||||
LibDrawArc* GenCopy();
|
LibDrawArc* GenCopy();
|
||||||
|
|
||||||
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, int aColor,
|
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset,
|
||||||
int aDrawMode, void* aData, const int aTransformMatrix[2][2] );
|
int aColor, int aDrawMode, void* aData,
|
||||||
|
const int aTransformMatrix[2][2] );
|
||||||
|
|
||||||
|
virtual EDA_Rect GetBoundingBox();
|
||||||
|
virtual void DisplayInfo( WinEDA_DrawFrame* frame );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*****************************/
|
/*****************************/
|
||||||
/* Graphic Body Item: Circle */
|
/* Graphic Body Item: Circle */
|
||||||
/*****************************/
|
/*****************************/
|
||||||
class LibDrawCircle : public LibEDA_BaseStruct
|
class LibDrawCircle : public LibEDA_BaseStruct
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int m_Rayon;
|
int m_Rayon;
|
||||||
wxPoint m_Pos; /* Position or centre (Arc and Circle) or start point (segments) */
|
wxPoint m_Pos; /* Position or centre (Arc and Circle) or start
|
||||||
int m_Width; /* Tickness */
|
* point (segments) */
|
||||||
|
int m_Width; /* Line width */
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LibDrawCircle();
|
LibDrawCircle();
|
||||||
|
@ -301,17 +315,22 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Save
|
* Function Save
|
||||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
* writes the data structures for this object out to a FILE in "*.brd"
|
||||||
|
* format.
|
||||||
* @param aFile The FILE to write to.
|
* @param aFile The FILE to write to.
|
||||||
* @return bool - true if success writing else false.
|
* @return bool - true if success writing else false.
|
||||||
*/
|
*/
|
||||||
virtual bool Save( FILE* aFile ) const;
|
virtual bool Save( FILE* aFile ) const;
|
||||||
|
virtual bool Load( char* line, wxString& errorMsg );
|
||||||
|
|
||||||
LibDrawCircle* GenCopy();
|
LibDrawCircle* GenCopy();
|
||||||
|
|
||||||
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, int aColor,
|
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset,
|
||||||
int aDrawMode, void* aData, const int aTransformMatrix[2][2] );
|
int aColor, int aDrawMode, void* aData,
|
||||||
|
const int aTransformMatrix[2][2] );
|
||||||
|
|
||||||
|
virtual EDA_Rect GetBoundingBox();
|
||||||
|
virtual void DisplayInfo( WinEDA_DrawFrame* frame );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -321,8 +340,7 @@ public:
|
||||||
/* Fields like Ref , value... are not Text, */
|
/* Fields like Ref , value... are not Text, */
|
||||||
/* they are a separate class */
|
/* they are a separate class */
|
||||||
/*********************************************/
|
/*********************************************/
|
||||||
class LibDrawText : public LibEDA_BaseStruct,
|
class LibDrawText : public LibEDA_BaseStruct, public EDA_TextStruct
|
||||||
public EDA_TextStruct
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LibDrawText();
|
LibDrawText();
|
||||||
|
@ -335,17 +353,21 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Save
|
* Function Save
|
||||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
* writes the data structures for this object out to a FILE in "*.brd"
|
||||||
|
* format.
|
||||||
* @param aFile The FILE to write to.
|
* @param aFile The FILE to write to.
|
||||||
* @return bool - true if success writing else false.
|
* @return bool - true if success writing else false.
|
||||||
*/
|
*/
|
||||||
virtual bool Save( FILE* aFile ) const;
|
virtual bool Save( FILE* aFile ) const;
|
||||||
|
virtual bool Load( char* line, wxString& errorMsg );
|
||||||
|
|
||||||
LibDrawText* GenCopy();
|
LibDrawText* GenCopy();
|
||||||
|
|
||||||
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, int aColor,
|
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset,
|
||||||
int aDrawMode, void* aData, const int aTransformMatrix[2][2] );
|
int aColor, int aDrawMode, void* aData,
|
||||||
|
const int aTransformMatrix[2][2] );
|
||||||
|
|
||||||
|
virtual void DisplayInfo( WinEDA_DrawFrame* frame );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -355,9 +377,9 @@ public:
|
||||||
class LibDrawSquare : public LibEDA_BaseStruct
|
class LibDrawSquare : public LibEDA_BaseStruct
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxPoint m_End;
|
wxPoint m_End; /* Rectangle end point. */
|
||||||
wxPoint m_Pos; /* Position or centre (Arc and Circle) or start point (segments) */
|
wxPoint m_Pos; /* Rectangle start point. */
|
||||||
int m_Width; /* Tickness */
|
int m_Width; /* Line width */
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LibDrawSquare();
|
LibDrawSquare();
|
||||||
|
@ -370,17 +392,22 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Save
|
* Function Save
|
||||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
* writes the data structures for this object out to a FILE in "*.brd"
|
||||||
|
* format.
|
||||||
* @param aFile The FILE to write to.
|
* @param aFile The FILE to write to.
|
||||||
* @return bool - true if success writing else false.
|
* @return bool - true if success writing else false.
|
||||||
*/
|
*/
|
||||||
virtual bool Save( FILE* aFile ) const;
|
virtual bool Save( FILE* aFile ) const;
|
||||||
|
virtual bool Load( char* line, wxString& errorMsg );
|
||||||
|
|
||||||
LibDrawSquare* GenCopy();
|
LibDrawSquare* GenCopy();
|
||||||
|
|
||||||
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, int aColor,
|
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset,
|
||||||
int aDrawMode, void* aData, const int aTransformMatrix[2][2] );
|
int aColor, int aDrawMode, void* aData,
|
||||||
|
const int aTransformMatrix[2][2] );
|
||||||
|
|
||||||
|
virtual EDA_Rect GetBoundingBox();
|
||||||
|
virtual void DisplayInfo( WinEDA_DrawFrame* frame );
|
||||||
};
|
};
|
||||||
|
|
||||||
/**********************************/
|
/**********************************/
|
||||||
|
@ -390,8 +417,9 @@ class LibDrawSegment : public LibEDA_BaseStruct
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxPoint m_End;
|
wxPoint m_End;
|
||||||
wxPoint m_Pos; /* Position or centre (Arc and Circle) or start point (segments) */
|
wxPoint m_Pos; /* Position or centre (Arc and Circle) or start point
|
||||||
int m_Width; /* Tickness */
|
* (segments) */
|
||||||
|
int m_Width; /* Line width */
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LibDrawSegment();
|
LibDrawSegment();
|
||||||
|
@ -404,26 +432,31 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Save
|
* Function Save
|
||||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
* writes the data structures for this object out to a FILE in "*.brd"
|
||||||
|
* format.
|
||||||
* @param aFile The FILE to write to.
|
* @param aFile The FILE to write to.
|
||||||
* @return bool - true if success writing else false.
|
* @return bool - true if success writing else false.
|
||||||
*/
|
*/
|
||||||
virtual bool Save( FILE* aFile ) const;
|
virtual bool Save( FILE* aFile ) const;
|
||||||
|
virtual bool Load( char* line, wxString& errorMsg );
|
||||||
|
|
||||||
LibDrawSegment* GenCopy();
|
LibDrawSegment* GenCopy();
|
||||||
|
|
||||||
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, int aColor,
|
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset,
|
||||||
int aDrawMode, void* aData, const int aTransformMatrix[2][2] );
|
int aColor, int aDrawMode, void* aData,
|
||||||
|
const int aTransformMatrix[2][2] );
|
||||||
|
|
||||||
|
virtual void DisplayInfo( WinEDA_DrawFrame* frame );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************/
|
/**********************************************************/
|
||||||
/* Graphic Body Item: Polygon and polyline (set of lines) */
|
/* Graphic Body Item: Polygon and polyline (set of lines) */
|
||||||
/**********************************************************/
|
/**********************************************************/
|
||||||
class LibDrawPolyline : public LibEDA_BaseStruct
|
class LibDrawPolyline : public LibEDA_BaseStruct
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int m_Width; /* Tickness */
|
int m_Width; /* Line width */
|
||||||
std::vector<wxPoint> m_PolyPoints; // list of points (>= 2)
|
std::vector<wxPoint> m_PolyPoints; // list of points (>= 2)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -438,11 +471,13 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Save
|
* Function Save
|
||||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
* writes the data structures for this object out to a FILE in "*.brd"
|
||||||
|
* format.
|
||||||
* @param aFile The FILE to write to.
|
* @param aFile The FILE to write to.
|
||||||
* @return bool - true if success writing else false.
|
* @return bool - true if success writing else false.
|
||||||
*/
|
*/
|
||||||
virtual bool Save( FILE* aFile ) const;
|
virtual bool Save( FILE* aFile ) const;
|
||||||
|
virtual bool Load( char* line, wxString& errorMsg );
|
||||||
|
|
||||||
LibDrawPolyline* GenCopy();
|
LibDrawPolyline* GenCopy();
|
||||||
void AddPoint( const wxPoint& point );
|
void AddPoint( const wxPoint& point );
|
||||||
|
@ -460,13 +495,16 @@ public:
|
||||||
*/
|
*/
|
||||||
bool HitTest( wxPoint aPosRef, int aThreshold, const int aTransMat[2][2] );
|
bool HitTest( wxPoint aPosRef, int aThreshold, const int aTransMat[2][2] );
|
||||||
|
|
||||||
/** Function GetBoundaryBox
|
/** Function GetBoundingBox
|
||||||
* @return the boundary box for this, in library coordinates
|
* @return the boundary box for this, in library coordinates
|
||||||
*/
|
*/
|
||||||
EDA_Rect GetBoundaryBox();
|
virtual EDA_Rect GetBoundingBox();
|
||||||
|
|
||||||
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, int aColor,
|
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset,
|
||||||
int aDrawMode, void* aData, const int aTransformMatrix[2][2] );
|
int aColor, int aDrawMode, void* aData,
|
||||||
|
const int aTransformMatrix[2][2] );
|
||||||
|
|
||||||
|
virtual void DisplayInfo( WinEDA_DrawFrame* frame );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CLASSES_BODY_ITEMS_H
|
#endif // CLASSES_BODY_ITEMS_H
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "appl_wxstruct.h"
|
#include "appl_wxstruct.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "confirm.h"
|
#include "confirm.h"
|
||||||
|
#include "class_drawpickedstruct.h"
|
||||||
#include "program.h"
|
#include "program.h"
|
||||||
#include "libcmp.h"
|
#include "libcmp.h"
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
|
#include "class_drawpanel.h"
|
||||||
#include "gr_basic.h"
|
#include "gr_basic.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "confirm.h"
|
#include "confirm.h"
|
||||||
|
@ -16,13 +17,141 @@
|
||||||
#include <wx/arrimpl.cpp>
|
#include <wx/arrimpl.cpp>
|
||||||
#include <wx/tokenzr.h>
|
#include <wx/tokenzr.h>
|
||||||
|
|
||||||
|
#include "component_class.h"
|
||||||
|
|
||||||
|
|
||||||
WX_DEFINE_OBJARRAY( ArrayOfSheetLists );
|
WX_DEFINE_OBJARRAY( ArrayOfSheetLists );
|
||||||
|
|
||||||
|
|
||||||
|
/* Local variables */
|
||||||
|
static EDA_LibComponentStruct* DummyCmp;
|
||||||
|
|
||||||
|
/* Descr component <DUMMY> used when a component is not found in library,
|
||||||
|
* to draw a dummy shape
|
||||||
|
* This component is a 400 mils square with the text ??
|
||||||
|
* DEF DUMMY U 0 40 Y Y 1 0 N
|
||||||
|
* F0 "U" 0 -350 60 H V
|
||||||
|
* F1 "DUMMY" 0 350 60 H V
|
||||||
|
* DRAW
|
||||||
|
* T 0 0 0 150 0 0 0 ??
|
||||||
|
* S -200 200 200 -200 0 1 0
|
||||||
|
* ENDDRAW
|
||||||
|
* ENDDEF
|
||||||
|
*/
|
||||||
|
void CreateDummyCmp()
|
||||||
|
{
|
||||||
|
DummyCmp = new EDA_LibComponentStruct( NULL );
|
||||||
|
|
||||||
|
LibDrawSquare* Square = new LibDrawSquare();
|
||||||
|
|
||||||
|
Square->m_Pos = wxPoint( -200, 200 );
|
||||||
|
Square->m_End = wxPoint( 200, -200 );
|
||||||
|
Square->m_Width = 4;
|
||||||
|
|
||||||
|
LibDrawText* Text = new LibDrawText();
|
||||||
|
|
||||||
|
Text->m_Size.x = Text->m_Size.y = 150;
|
||||||
|
Text->m_Text = wxT( "??" );
|
||||||
|
|
||||||
|
DummyCmp->m_Drawings = Square;
|
||||||
|
Square->SetNext( Text );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* Routine to draw the given part at given position, transformed/mirror as
|
||||||
|
* specified, and in the given drawing mode.
|
||||||
|
* if Color < 0: Draw in normal color
|
||||||
|
* else draw in color = Color
|
||||||
|
*****************************************************************************/
|
||||||
|
/* DrawMode = GrXOR, GrOR ..*/
|
||||||
|
void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
|
SCH_COMPONENT* Component,
|
||||||
|
EDA_LibComponentStruct* Entry,
|
||||||
|
const wxPoint& Pos, const int TransMat[2][2],
|
||||||
|
int Multi, int convert, int DrawMode,
|
||||||
|
int Color, bool DrawPinText )
|
||||||
|
{
|
||||||
|
wxPoint pos1, pos2;
|
||||||
|
bool force_nofill;
|
||||||
|
LibEDA_BaseStruct* DEntry;
|
||||||
|
BASE_SCREEN* screen = panel->GetScreen();
|
||||||
|
|
||||||
|
if( Entry->m_Drawings == NULL )
|
||||||
|
return;
|
||||||
|
GRSetDrawMode( DC, DrawMode );
|
||||||
|
|
||||||
|
for( DEntry = Entry->m_Drawings; DEntry != NULL; DEntry = DEntry->Next() )
|
||||||
|
{
|
||||||
|
/* Do not draw items not attached to the current part */
|
||||||
|
if( Multi && DEntry->m_Unit && (DEntry->m_Unit != Multi) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if( convert && DEntry->m_Convert && (DEntry->m_Convert != convert) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Do not draw an item while moving (the cursor handler does that)
|
||||||
|
if( DEntry->m_Flags & IS_MOVED )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
force_nofill = false;
|
||||||
|
|
||||||
|
switch( DEntry->Type() )
|
||||||
|
{
|
||||||
|
case COMPONENT_PIN_DRAW_TYPE:
|
||||||
|
{
|
||||||
|
DrawPinPrms prms( Entry, DrawPinText );
|
||||||
|
DEntry->Draw( panel, DC, Pos, Color, DrawMode, &prms, TransMat );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case COMPONENT_ARC_DRAW_TYPE:
|
||||||
|
case COMPONENT_CIRCLE_DRAW_TYPE:
|
||||||
|
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
||||||
|
case COMPONENT_RECT_DRAW_TYPE:
|
||||||
|
case COMPONENT_POLYLINE_DRAW_TYPE:
|
||||||
|
default:
|
||||||
|
if( screen->m_IsPrinting
|
||||||
|
&& DEntry->m_Fill == FILLED_WITH_BG_BODYCOLOR
|
||||||
|
&& GetGRForceBlackPenState() )
|
||||||
|
force_nofill = true;
|
||||||
|
DEntry->Draw( panel, DC, Pos, Color, DrawMode, (void*) force_nofill,
|
||||||
|
TransMat );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( g_DebugLevel > 4 ) /* Draw the component boundary box */
|
||||||
|
{
|
||||||
|
EDA_Rect BoundaryBox;
|
||||||
|
if( Component )
|
||||||
|
BoundaryBox = Component->GetBoundaryBox();
|
||||||
|
else
|
||||||
|
BoundaryBox = Entry->GetBoundaryBox( Multi, convert );
|
||||||
|
int x1 = BoundaryBox.GetX();
|
||||||
|
int y1 = BoundaryBox.GetY();
|
||||||
|
int x2 = BoundaryBox.GetRight();
|
||||||
|
int y2 = BoundaryBox.GetBottom();
|
||||||
|
GRRect( &panel->m_ClipBox, DC, x1, y1, x2, y2, BROWN );
|
||||||
|
BoundaryBox = Component->GetField( REFERENCE )->GetBoundaryBox();
|
||||||
|
x1 = BoundaryBox.GetX();
|
||||||
|
y1 = BoundaryBox.GetY();
|
||||||
|
x2 = BoundaryBox.GetRight();
|
||||||
|
y2 = BoundaryBox.GetBottom();
|
||||||
|
GRRect( &panel->m_ClipBox, DC, x1, y1, x2, y2, BROWN );
|
||||||
|
BoundaryBox = Component->GetField( VALUE )->GetBoundaryBox();
|
||||||
|
x1 = BoundaryBox.GetX();
|
||||||
|
y1 = BoundaryBox.GetY();
|
||||||
|
x2 = BoundaryBox.GetRight();
|
||||||
|
y2 = BoundaryBox.GetBottom();
|
||||||
|
GRRect( &panel->m_ClipBox, DC, x1, y1, x2, y2, BROWN );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************/
|
/*******************************************************************/
|
||||||
SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos, SCH_ITEM* aParent ) :
|
SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos, SCH_ITEM* aParent ) :
|
||||||
SCH_ITEM( aParent, TYPE_SCH_COMPONENT )
|
SCH_ITEM( aParent, TYPE_SCH_COMPONENT )
|
||||||
/*******************************************************************/
|
|
||||||
{
|
{
|
||||||
m_Multi = 0; /* In multi unit chip - which unit to draw. */
|
m_Multi = 0; /* In multi unit chip - which unit to draw. */
|
||||||
|
|
||||||
|
@ -38,7 +167,7 @@ SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos, SCH_ITEM* aParent ) :
|
||||||
|
|
||||||
m_Fields.reserve( NUMBER_OF_FIELDS );
|
m_Fields.reserve( NUMBER_OF_FIELDS );
|
||||||
|
|
||||||
for( int i = 0; i<NUMBER_OF_FIELDS; ++i )
|
for( int i = 0; i < NUMBER_OF_FIELDS; ++i )
|
||||||
{
|
{
|
||||||
SCH_CMP_FIELD field( aPos, i, this, ReturnDefaultFieldName( i ) );
|
SCH_CMP_FIELD field( aPos, i, this, ReturnDefaultFieldName( i ) );
|
||||||
|
|
||||||
|
@ -60,28 +189,89 @@ SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos, SCH_ITEM* aParent ) :
|
||||||
SCH_COMPONENT::SCH_COMPONENT( const SCH_COMPONENT& aTemplate ) :
|
SCH_COMPONENT::SCH_COMPONENT( const SCH_COMPONENT& aTemplate ) :
|
||||||
SCH_ITEM( NULL, TYPE_SCH_COMPONENT )
|
SCH_ITEM( NULL, TYPE_SCH_COMPONENT )
|
||||||
{
|
{
|
||||||
// assignment of all fields, including field vector elements, and linked list pointers
|
/* assignment of all fields, including field vector elements, and linked
|
||||||
|
* list pointers */
|
||||||
*this = aTemplate;
|
*this = aTemplate;
|
||||||
|
|
||||||
// set linked list pointers to null, before this they were copies of aTemplate's
|
/* set linked list pointers to null, before this they were copies of
|
||||||
|
* aTemplate's */
|
||||||
Pback = NULL;
|
Pback = NULL;
|
||||||
Pnext = NULL;
|
Pnext = NULL;
|
||||||
m_Son = NULL;
|
m_Son = NULL;
|
||||||
|
|
||||||
// Re-parent the fields, which before this had aTemplate as parent
|
// Re-parent the fields, which before this had aTemplate as parent
|
||||||
for( int i=0; i<GetFieldCount(); ++i )
|
for( int i=0; i<GetFieldCount(); ++i )
|
||||||
{
|
{
|
||||||
GetField( i )->SetParent( this );
|
GetField( i )->SetParent( this );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
* Routine to draw the given part at given position, transformed/mirror as *
|
||||||
|
* specified, and in the given drawing mode. Only this one is visible... *
|
||||||
|
*****************************************************************************/
|
||||||
|
void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
|
const wxPoint& offset, int DrawMode, int Color )
|
||||||
|
{
|
||||||
|
EDA_LibComponentStruct* Entry;
|
||||||
|
int ii;
|
||||||
|
bool dummy = FALSE;
|
||||||
|
|
||||||
|
if( ( Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString,
|
||||||
|
FIND_ROOT ) ) == NULL )
|
||||||
|
{
|
||||||
|
/* composant non trouve, on affiche un composant "dummy" */
|
||||||
|
dummy = TRUE;
|
||||||
|
if( DummyCmp == NULL )
|
||||||
|
CreateDummyCmp();
|
||||||
|
Entry = DummyCmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawLibPartAux( panel, DC, this, Entry, m_Pos + offset, m_Transform,
|
||||||
|
dummy ? 0 : m_Multi, dummy ? 0 : m_Convert, DrawMode );
|
||||||
|
|
||||||
|
/* Trace des champs, avec placement et orientation selon orient. du
|
||||||
|
* composant
|
||||||
|
*/
|
||||||
|
|
||||||
|
SCH_CMP_FIELD* field = GetField( REFERENCE );
|
||||||
|
|
||||||
|
if( ( ( field->m_Attributs & TEXT_NO_VISIBLE ) == 0 )
|
||||||
|
&& !( field->m_Flags & IS_MOVED ) )
|
||||||
|
{
|
||||||
|
if( Entry->m_UnitCount > 1 )
|
||||||
|
{
|
||||||
|
field->m_AddExtraText = true;
|
||||||
|
field->Draw( panel, DC, offset, DrawMode );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
field->m_AddExtraText = false;
|
||||||
|
field->Draw( panel, DC, offset, DrawMode );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for( ii = VALUE; ii < GetFieldCount(); ii++ )
|
||||||
|
{
|
||||||
|
field = GetField( ii );
|
||||||
|
|
||||||
|
if( field->m_Flags & IS_MOVED )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
field->Draw( panel, DC, offset, DrawMode );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function AddHierarchicalReference
|
* Function AddHierarchicalReference
|
||||||
* adds a full hierachical reference (path + local reference)
|
* adds a full hierachical reference (path + local reference)
|
||||||
* @param aPath = hierarchical path (/<sheet timestamp>/component timestamp> like /05678E50/A23EF560)
|
* @param aPath = hierarchical path (/<sheet timestamp>/component timestamp>
|
||||||
|
* like /05678E50/A23EF560)
|
||||||
* @param aRef = local reference like C45, R56
|
* @param aRef = local reference like C45, R56
|
||||||
* @param aMulti = part selection, used in multi part per package (0 or 1 for non multi)
|
* @param aMulti = part selection, used in multi part per package (0 or 1 for
|
||||||
|
* non multi)
|
||||||
*/
|
*/
|
||||||
void SCH_COMPONENT::AddHierarchicalReference( const wxString& aPath,
|
void SCH_COMPONENT::AddHierarchicalReference( const wxString& aPath,
|
||||||
const wxString& aRef,
|
const wxString& aRef,
|
||||||
|
@ -92,10 +282,11 @@ void SCH_COMPONENT::AddHierarchicalReference( const wxString& aPath,
|
||||||
wxString separators( wxT( " " ) );
|
wxString separators( wxT( " " ) );
|
||||||
|
|
||||||
// Search for an existing path and remove it if found (should not occur)
|
// Search for an existing path and remove it if found (should not occur)
|
||||||
for( unsigned ii = 0; ii<m_PathsAndReferences.GetCount(); ii++ )
|
for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
tokenizer.SetString( m_PathsAndReferences[ii], separators );
|
tokenizer.SetString( m_PathsAndReferences[ii], separators );
|
||||||
h_path = tokenizer.GetNextToken();
|
h_path = tokenizer.GetNextToken();
|
||||||
|
|
||||||
if( h_path.Cmp( aPath ) == 0 )
|
if( h_path.Cmp( aPath ) == 0 )
|
||||||
{
|
{
|
||||||
m_PathsAndReferences.RemoveAt( ii );
|
m_PathsAndReferences.RemoveAt( ii );
|
||||||
|
@ -104,7 +295,6 @@ void SCH_COMPONENT::AddHierarchicalReference( const wxString& aPath,
|
||||||
}
|
}
|
||||||
|
|
||||||
h_ref = aPath + wxT( " " ) + aRef;
|
h_ref = aPath + wxT( " " ) + aRef;
|
||||||
|
|
||||||
h_ref << wxT( " " ) << aMulti;
|
h_ref << wxT( " " ) << aMulti;
|
||||||
m_PathsAndReferences.Add( h_ref );
|
m_PathsAndReferences.Add( h_ref );
|
||||||
}
|
}
|
||||||
|
@ -148,15 +338,17 @@ const wxString SCH_COMPONENT::GetRef( DrawSheetPath* sheet )
|
||||||
wxStringTokenizer tokenizer;
|
wxStringTokenizer tokenizer;
|
||||||
wxString separators( wxT( " " ) );
|
wxString separators( wxT( " " ) );
|
||||||
|
|
||||||
for( unsigned ii = 0; ii<m_PathsAndReferences.GetCount(); ii++ )
|
for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
tokenizer.SetString( m_PathsAndReferences[ii], separators );
|
tokenizer.SetString( m_PathsAndReferences[ii], separators );
|
||||||
h_path = tokenizer.GetNextToken();
|
h_path = tokenizer.GetNextToken();
|
||||||
|
|
||||||
if( h_path.Cmp( path ) == 0 )
|
if( h_path.Cmp( path ) == 0 )
|
||||||
{
|
{
|
||||||
h_ref = tokenizer.GetNextToken();
|
h_ref = tokenizer.GetNextToken();
|
||||||
|
|
||||||
//printf("GetRef hpath: %s\n",CONV_TO_UTF8(m_PathsAndReferences[ii]));
|
/* printf( "GetRef hpath: %s\n",
|
||||||
|
CONV_TO_UTF8( m_PathsAndReferences[ii] ) ); */
|
||||||
return h_ref;
|
return h_ref;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -188,7 +380,7 @@ void SCH_COMPONENT::SetRef( DrawSheetPath* sheet, const wxString& ref )
|
||||||
wxString separators( wxT( " " ) );
|
wxString separators( wxT( " " ) );
|
||||||
|
|
||||||
//check to see if it is already there before inserting it
|
//check to see if it is already there before inserting it
|
||||||
for( unsigned ii = 0; ii<m_PathsAndReferences.GetCount(); ii++ )
|
for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
tokenizer.SetString( m_PathsAndReferences[ii], separators );
|
tokenizer.SetString( m_PathsAndReferences[ii], separators );
|
||||||
h_path = tokenizer.GetNextToken();
|
h_path = tokenizer.GetNextToken();
|
||||||
|
@ -211,8 +403,8 @@ void SCH_COMPONENT::SetRef( DrawSheetPath* sheet, const wxString& ref )
|
||||||
SCH_CMP_FIELD* rf = GetField( REFERENCE );
|
SCH_CMP_FIELD* rf = GetField( REFERENCE );
|
||||||
|
|
||||||
if( rf->m_Text.IsEmpty()
|
if( rf->m_Text.IsEmpty()
|
||||||
|| ( abs( rf->m_Pos.x - m_Pos.x ) +
|
|| ( abs( rf->m_Pos.x - m_Pos.x ) +
|
||||||
abs( rf->m_Pos.y - m_Pos.y ) > 10000) )
|
abs( rf->m_Pos.y - m_Pos.y ) > 10000 ) )
|
||||||
{
|
{
|
||||||
// move it to a reasonable position
|
// move it to a reasonable position
|
||||||
rf->m_Pos = m_Pos;
|
rf->m_Pos = m_Pos;
|
||||||
|
@ -225,20 +417,20 @@ void SCH_COMPONENT::SetRef( DrawSheetPath* sheet, const wxString& ref )
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
/***********************************************************/
|
||||||
int SCH_COMPONENT::GetUnitSelection( DrawSheetPath* aSheet )
|
|
||||||
/***********************************************************/
|
|
||||||
|
|
||||||
//returns the unit selection, for the given sheet path.
|
//returns the unit selection, for the given sheet path.
|
||||||
|
/***********************************************************/
|
||||||
|
int SCH_COMPONENT::GetUnitSelection( DrawSheetPath* aSheet )
|
||||||
{
|
{
|
||||||
wxString path = GetPath( aSheet );
|
wxString path = GetPath( aSheet );
|
||||||
wxString h_path, h_multi;
|
wxString h_path, h_multi;
|
||||||
wxStringTokenizer tokenizer;
|
wxStringTokenizer tokenizer;
|
||||||
wxString separators( wxT( " " ) );
|
wxString separators( wxT( " " ) );
|
||||||
|
|
||||||
for( unsigned ii = 0; ii<m_PathsAndReferences.GetCount(); ii++ )
|
for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
tokenizer.SetString( m_PathsAndReferences[ii], separators );
|
tokenizer.SetString( m_PathsAndReferences[ii], separators );
|
||||||
h_path = tokenizer.GetNextToken();
|
h_path = tokenizer.GetNextToken();
|
||||||
|
|
||||||
if( h_path.Cmp( path ) == 0 )
|
if( h_path.Cmp( path ) == 0 )
|
||||||
{
|
{
|
||||||
tokenizer.GetNextToken(); // Skip reference
|
tokenizer.GetNextToken(); // Skip reference
|
||||||
|
@ -249,17 +441,16 @@ int SCH_COMPONENT::GetUnitSelection( DrawSheetPath* aSheet )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if it was not found in m_Paths array, then use m_Multi.
|
// if it was not found in m_Paths array, then use m_Multi.
|
||||||
// this will happen if we load a version 1 schematic file.
|
// this will happen if we load a version 1 schematic file.
|
||||||
return m_Multi;
|
return m_Multi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************************/
|
/****************************************************************************/
|
||||||
void SCH_COMPONENT::SetUnitSelection( DrawSheetPath* aSheet, int aUnitSelection )
|
|
||||||
/********************************************************************************/
|
|
||||||
|
|
||||||
//Set the unit selection, for the given sheet path.
|
//Set the unit selection, for the given sheet path.
|
||||||
|
/****************************************************************************/
|
||||||
|
void SCH_COMPONENT::SetUnitSelection( DrawSheetPath* aSheet, int aUnitSelection )
|
||||||
{
|
{
|
||||||
wxString path = GetPath( aSheet );
|
wxString path = GetPath( aSheet );
|
||||||
|
|
||||||
|
@ -270,10 +461,11 @@ void SCH_COMPONENT::SetUnitSelection( DrawSheetPath* aSheet, int aUnitSelection
|
||||||
wxString separators( wxT( " " ) );
|
wxString separators( wxT( " " ) );
|
||||||
|
|
||||||
//check to see if it is already there before inserting it
|
//check to see if it is already there before inserting it
|
||||||
for( unsigned ii = 0; ii<m_PathsAndReferences.GetCount(); ii++ )
|
for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
tokenizer.SetString( m_PathsAndReferences[ii], separators );
|
tokenizer.SetString( m_PathsAndReferences[ii], separators );
|
||||||
h_path = tokenizer.GetNextToken();
|
h_path = tokenizer.GetNextToken();
|
||||||
|
|
||||||
if( h_path.Cmp( path ) == 0 )
|
if( h_path.Cmp( path ) == 0 )
|
||||||
{
|
{
|
||||||
//just update the unit selection.
|
//just update the unit selection.
|
||||||
|
@ -292,9 +484,7 @@ void SCH_COMPONENT::SetUnitSelection( DrawSheetPath* aSheet, int aUnitSelection
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************/
|
|
||||||
SCH_CMP_FIELD* SCH_COMPONENT::GetField( int aFieldNdx ) const
|
SCH_CMP_FIELD* SCH_COMPONENT::GetField( int aFieldNdx ) const
|
||||||
/******************************************************************/
|
|
||||||
{
|
{
|
||||||
const SCH_CMP_FIELD* field;
|
const SCH_CMP_FIELD* field;
|
||||||
|
|
||||||
|
@ -310,19 +500,16 @@ SCH_CMP_FIELD* SCH_COMPONENT::GetField( int aFieldNdx ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************/
|
|
||||||
void SCH_COMPONENT::AddField( const SCH_CMP_FIELD& aField )
|
void SCH_COMPONENT::AddField( const SCH_CMP_FIELD& aField )
|
||||||
/******************************************************************/
|
|
||||||
{
|
{
|
||||||
m_Fields.push_back( aField );
|
m_Fields.push_back( aField );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************/
|
|
||||||
EDA_Rect SCH_COMPONENT::GetBoundaryBox() const
|
EDA_Rect SCH_COMPONENT::GetBoundaryBox() const
|
||||||
/************************************************/
|
|
||||||
{
|
{
|
||||||
EDA_LibComponentStruct* Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
|
EDA_LibComponentStruct* Entry = FindLibPart( m_ChipName.GetData(),
|
||||||
|
wxEmptyString, FIND_ROOT );
|
||||||
EDA_Rect BoundaryBox;
|
EDA_Rect BoundaryBox;
|
||||||
int x0, xm, y0, ym;
|
int x0, xm, y0, ym;
|
||||||
|
|
||||||
|
@ -330,7 +517,8 @@ EDA_Rect SCH_COMPONENT::GetBoundaryBox() const
|
||||||
if( Entry )
|
if( Entry )
|
||||||
{
|
{
|
||||||
BoundaryBox = Entry->GetBoundaryBox( m_Multi, m_Convert );
|
BoundaryBox = Entry->GetBoundaryBox( m_Multi, m_Convert );
|
||||||
x0 = BoundaryBox.GetX(); xm = BoundaryBox.GetRight();
|
x0 = BoundaryBox.GetX();
|
||||||
|
xm = BoundaryBox.GetRight();
|
||||||
|
|
||||||
// We must reverse Y values, because matrix orientation
|
// We must reverse Y values, because matrix orientation
|
||||||
// suppose Y axis normal for the library items coordinates,
|
// suppose Y axis normal for the library items coordinates,
|
||||||
|
@ -346,11 +534,8 @@ EDA_Rect SCH_COMPONENT::GetBoundaryBox() const
|
||||||
|
|
||||||
/* Compute the real Boundary box (rotated, mirrored ...)*/
|
/* Compute the real Boundary box (rotated, mirrored ...)*/
|
||||||
int x1 = m_Transform[0][0] * x0 + m_Transform[0][1] * y0;
|
int x1 = m_Transform[0][0] * x0 + m_Transform[0][1] * y0;
|
||||||
|
|
||||||
int y1 = m_Transform[1][0] * x0 + m_Transform[1][1] * y0;
|
int y1 = m_Transform[1][0] * x0 + m_Transform[1][1] * y0;
|
||||||
|
|
||||||
int x2 = m_Transform[0][0] * xm + m_Transform[0][1] * ym;
|
int x2 = m_Transform[0][0] * xm + m_Transform[0][1] * ym;
|
||||||
|
|
||||||
int y2 = m_Transform[1][0] * xm + m_Transform[1][1] * ym;
|
int y2 = m_Transform[1][0] * xm + m_Transform[1][1] * ym;
|
||||||
|
|
||||||
// H and W must be > 0:
|
// H and W must be > 0:
|
||||||
|
@ -359,7 +544,8 @@ EDA_Rect SCH_COMPONENT::GetBoundaryBox() const
|
||||||
if( y2 < y1 )
|
if( y2 < y1 )
|
||||||
EXCHG( y2, y1 );
|
EXCHG( y2, y1 );
|
||||||
|
|
||||||
BoundaryBox.SetX( x1 ); BoundaryBox.SetY( y1 );
|
BoundaryBox.SetX( x1 );
|
||||||
|
BoundaryBox.SetY( y1 );
|
||||||
BoundaryBox.SetWidth( x2 - x1 );
|
BoundaryBox.SetWidth( x2 - x1 );
|
||||||
BoundaryBox.SetHeight( y2 - y1 );
|
BoundaryBox.SetHeight( y2 - y1 );
|
||||||
|
|
||||||
|
@ -369,12 +555,11 @@ EDA_Rect SCH_COMPONENT::GetBoundaryBox() const
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
void SCH_COMPONENT::SwapData( SCH_COMPONENT* copyitem )
|
|
||||||
/**************************************************************************/
|
|
||||||
|
|
||||||
/* Used if undo / redo command:
|
/* Used if undo / redo command:
|
||||||
* swap data between this and copyitem
|
* swap data between this and copyitem
|
||||||
*/
|
*/
|
||||||
|
/**************************************************************************/
|
||||||
|
void SCH_COMPONENT::SwapData( SCH_COMPONENT* copyitem )
|
||||||
{
|
{
|
||||||
EXCHG( m_ChipName, copyitem->m_ChipName );
|
EXCHG( m_ChipName, copyitem->m_ChipName );
|
||||||
EXCHG( m_Pos, copyitem->m_Pos );
|
EXCHG( m_Pos, copyitem->m_Pos );
|
||||||
|
@ -407,8 +592,8 @@ void SCH_COMPONENT::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
|
||||||
{
|
{
|
||||||
/* save old text in undo list */
|
/* save old text in undo list */
|
||||||
if( g_ItemToUndoCopy
|
if( g_ItemToUndoCopy
|
||||||
&& ( g_ItemToUndoCopy->Type() == Type() )
|
&& ( g_ItemToUndoCopy->Type() == Type() )
|
||||||
&& ( (m_Flags & IS_NEW) == 0 ) )
|
&& ( ( m_Flags & IS_NEW ) == 0 ) )
|
||||||
{
|
{
|
||||||
/* restore old values and save new ones */
|
/* restore old values and save new ones */
|
||||||
SwapData( (SCH_COMPONENT*) g_ItemToUndoCopy );
|
SwapData( (SCH_COMPONENT*) g_ItemToUndoCopy );
|
||||||
|
@ -426,15 +611,12 @@ void SCH_COMPONENT::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************/
|
|
||||||
void SCH_COMPONENT::ClearAnnotation( DrawSheetPath* aSheet )
|
|
||||||
/**********************************************************/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Suppress annotation ( i.i IC23 changed to IC? and part reset to 1)
|
* Suppress annotation ( i.i IC23 changed to IC? and part reset to 1)
|
||||||
* @param aSheet: DrawSheetPath value: if NULL remove all annotations,
|
* @param aSheet: DrawSheetPath value: if NULL remove all annotations,
|
||||||
* else remove annotation relative to this sheetpath
|
* else remove annotation relative to this sheetpath
|
||||||
*/
|
*/
|
||||||
|
void SCH_COMPONENT::ClearAnnotation( DrawSheetPath* aSheet )
|
||||||
{
|
{
|
||||||
wxString defRef = m_PrefixString;
|
wxString defRef = m_PrefixString;
|
||||||
bool KeepMulti = false;
|
bool KeepMulti = false;
|
||||||
|
@ -454,16 +636,18 @@ void SCH_COMPONENT::ClearAnnotation( DrawSheetPath* aSheet )
|
||||||
|
|
||||||
wxString multi = wxT( "1" );
|
wxString multi = wxT( "1" );
|
||||||
|
|
||||||
if( KeepMulti ) // We cannot remove all annotations: part selection must be kept
|
// We cannot remove all annotations: part selection must be kept
|
||||||
|
if( KeepMulti )
|
||||||
{
|
{
|
||||||
wxString NewHref;
|
wxString NewHref;
|
||||||
wxString path;
|
wxString path;
|
||||||
if( aSheet )
|
if( aSheet )
|
||||||
path = GetPath( aSheet );;
|
path = GetPath( aSheet );
|
||||||
for( unsigned int ii = 0; ii< m_PathsAndReferences.GetCount(); ii++ )
|
for( unsigned int ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
// Break hierachical reference in path, ref and multi selection:
|
// Break hierachical reference in path, ref and multi selection:
|
||||||
reference_fields = wxStringTokenize( m_PathsAndReferences[ii], separators );
|
reference_fields = wxStringTokenize( m_PathsAndReferences[ii],
|
||||||
|
separators );
|
||||||
if( aSheet == NULL || reference_fields[0].Cmp( path ) == 0 )
|
if( aSheet == NULL || reference_fields[0].Cmp( path ) == 0 )
|
||||||
{
|
{
|
||||||
if( KeepMulti ) // Get and keep part selection
|
if( KeepMulti ) // Get and keep part selection
|
||||||
|
@ -476,7 +660,9 @@ void SCH_COMPONENT::ClearAnnotation( DrawSheetPath* aSheet )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_PathsAndReferences.Empty(); // Empty strings, but does not free memory because a new annotation will reuse it
|
// Empty strings, but does not free memory because a new annotation
|
||||||
|
// will reuse it
|
||||||
|
m_PathsAndReferences.Empty();
|
||||||
m_Multi = 1;
|
m_Multi = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -489,14 +675,13 @@ void SCH_COMPONENT::ClearAnnotation( DrawSheetPath* aSheet )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************/
|
|
||||||
void SCH_COMPONENT::SetRotationMiroir( int type_rotate )
|
|
||||||
/******************************************************************/
|
/******************************************************************/
|
||||||
|
|
||||||
/* Compute the new matrix transform for a schematic component
|
/* Compute the new matrix transform for a schematic component
|
||||||
* in order to have the requested transform (type_rotate = rot, mirror..)
|
* in order to have the requested transform (type_rotate = rot, mirror..)
|
||||||
* which is applied to the initial transform.
|
* which is applied to the initial transform.
|
||||||
*/
|
*/
|
||||||
|
/*****************************************************************/
|
||||||
|
void SCH_COMPONENT::SetRotationMiroir( int type_rotate )
|
||||||
{
|
{
|
||||||
int TempMat[2][2];
|
int TempMat[2][2];
|
||||||
bool Transform = FALSE;
|
bool Transform = FALSE;
|
||||||
|
@ -603,12 +788,13 @@ void SCH_COMPONENT::SetRotationMiroir( int type_rotate )
|
||||||
if( Transform )
|
if( Transform )
|
||||||
{
|
{
|
||||||
/* The new matrix transform is the old matrix transform modified by the
|
/* The new matrix transform is the old matrix transform modified by the
|
||||||
* requested transformation, which is the TempMat transform (rot, mirror ..)
|
* requested transformation, which is the TempMat transform (rot,
|
||||||
* in order to have (in term of matrix transform):
|
* mirror ..) in order to have (in term of matrix transform):
|
||||||
* transform coord = new_m_Transform * coord
|
* transform coord = new_m_Transform * coord
|
||||||
* where transform coord is the coord modified by new_m_Transform from the initial
|
* where transform coord is the coord modified by new_m_Transform from
|
||||||
* value coord.
|
* the initial value coord.
|
||||||
* new_m_Transform is computed (from old_m_Transform and TempMat) to have:
|
* new_m_Transform is computed (from old_m_Transform and TempMat) to
|
||||||
|
* have:
|
||||||
* transform coord = old_m_Transform * coord * TempMat
|
* transform coord = old_m_Transform * coord * TempMat
|
||||||
*/
|
*/
|
||||||
int NewMatrix[2][2];
|
int NewMatrix[2][2];
|
||||||
|
@ -633,18 +819,16 @@ void SCH_COMPONENT::SetRotationMiroir( int type_rotate )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************/
|
|
||||||
int SCH_COMPONENT::GetRotationMiroir()
|
int SCH_COMPONENT::GetRotationMiroir()
|
||||||
/****************************************************/
|
|
||||||
{
|
{
|
||||||
int type_rotate = CMP_ORIENT_0;
|
int type_rotate = CMP_ORIENT_0;
|
||||||
int TempMat[2][2], MatNormal[2][2];
|
int TempMat[2][2], MatNormal[2][2];
|
||||||
int ii;
|
int ii;
|
||||||
bool found = FALSE;
|
bool found = FALSE;
|
||||||
|
|
||||||
memcpy( TempMat, m_Transform, sizeof(TempMat) );
|
memcpy( TempMat, m_Transform, sizeof( TempMat ) );
|
||||||
SetRotationMiroir( CMP_ORIENT_0 );
|
SetRotationMiroir( CMP_ORIENT_0 );
|
||||||
memcpy( MatNormal, m_Transform, sizeof(MatNormal) );
|
memcpy( MatNormal, m_Transform, sizeof( MatNormal ) );
|
||||||
|
|
||||||
for( ii = 0; ii < 4; ii++ )
|
for( ii = 0; ii < 4; ii++ )
|
||||||
{
|
{
|
||||||
|
@ -663,7 +847,7 @@ int SCH_COMPONENT::GetRotationMiroir()
|
||||||
SetRotationMiroir( CMP_MIROIR_X );
|
SetRotationMiroir( CMP_MIROIR_X );
|
||||||
for( ii = 0; ii < 4; ii++ )
|
for( ii = 0; ii < 4; ii++ )
|
||||||
{
|
{
|
||||||
if( memcmp( TempMat, m_Transform, sizeof(MatNormal) ) == 0 )
|
if( memcmp( TempMat, m_Transform, sizeof( MatNormal ) ) == 0 )
|
||||||
{
|
{
|
||||||
found = TRUE;
|
found = TRUE;
|
||||||
break;
|
break;
|
||||||
|
@ -679,7 +863,7 @@ int SCH_COMPONENT::GetRotationMiroir()
|
||||||
SetRotationMiroir( CMP_MIROIR_Y );
|
SetRotationMiroir( CMP_MIROIR_Y );
|
||||||
for( ii = 0; ii < 4; ii++ )
|
for( ii = 0; ii < 4; ii++ )
|
||||||
{
|
{
|
||||||
if( memcmp( TempMat, m_Transform, sizeof(MatNormal) ) == 0 )
|
if( memcmp( TempMat, m_Transform, sizeof( MatNormal ) ) == 0 )
|
||||||
{
|
{
|
||||||
found = TRUE;
|
found = TRUE;
|
||||||
break;
|
break;
|
||||||
|
@ -688,7 +872,7 @@ int SCH_COMPONENT::GetRotationMiroir()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy( m_Transform, TempMat, sizeof(m_Transform) );
|
memcpy( m_Transform, TempMat, sizeof( m_Transform ) );
|
||||||
|
|
||||||
if( found )
|
if( found )
|
||||||
{
|
{
|
||||||
|
@ -702,14 +886,12 @@ int SCH_COMPONENT::GetRotationMiroir()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/**
|
||||||
wxPoint SCH_COMPONENT::GetScreenCoord( const wxPoint& coord )
|
* Renvoie la coordonn<EFBFBD>e du point coord, en fonction de l'orientation
|
||||||
/***********************************************************************/
|
|
||||||
|
|
||||||
/* Renvoie la coordonn<6E>e du point coord, en fonction de l'orientation
|
|
||||||
* du composant (rotation, miroir).
|
* du composant (rotation, miroir).
|
||||||
* Les coord sont toujours relatives a l'ancre (coord 0,0) du composant
|
* Les coord sont toujours relatives a l'ancre (coord 0,0) du composant
|
||||||
*/
|
*/
|
||||||
|
wxPoint SCH_COMPONENT::GetScreenCoord( const wxPoint& coord )
|
||||||
{
|
{
|
||||||
wxPoint screenpos;
|
wxPoint screenpos;
|
||||||
|
|
||||||
|
@ -732,37 +914,32 @@ void SCH_COMPONENT::Show( int nestLevel, std::ostream& os )
|
||||||
{
|
{
|
||||||
// for now, make it look like XML:
|
// for now, make it look like XML:
|
||||||
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
|
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
|
||||||
" ref=\"" << ReturnFieldName( 0 ) << '"' <<
|
" ref=\"" << ReturnFieldName( 0 ) << '"' << " chipName=\"" <<
|
||||||
" chipName=\"" << m_ChipName.mb_str() << '"' <<
|
m_ChipName.mb_str() << '"' << m_Pos << " layer=\"" << m_Layer <<
|
||||||
m_Pos <<
|
'"' << "/>\n";
|
||||||
" layer=\"" << m_Layer << '"' <<
|
|
||||||
"/>\n";
|
|
||||||
|
|
||||||
// skip the reference, it's been output already.
|
// skip the reference, it's been output already.
|
||||||
for( int i = 1; i<GetFieldCount(); ++i )
|
for( int i = 1; i < GetFieldCount(); ++i )
|
||||||
{
|
{
|
||||||
wxString value = GetField( i )->m_Text;
|
wxString value = GetField( i )->m_Text;
|
||||||
|
|
||||||
if( !value.IsEmpty() )
|
if( !value.IsEmpty() )
|
||||||
{
|
{
|
||||||
NestedSpace( nestLevel + 1, os ) << "<field" <<
|
NestedSpace( nestLevel + 1, os ) << "<field" << " name=\"" <<
|
||||||
" name=\"" << ReturnFieldName( i ).mb_str() << '"' <<
|
ReturnFieldName( i ).mb_str() << '"' << " value=\"" <<
|
||||||
" value=\"" << value.mb_str() << "\"/>\n";
|
value.mb_str() << "\"/>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
|
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/****************************************/
|
|
||||||
bool SCH_COMPONENT::Save( FILE* f ) const
|
bool SCH_COMPONENT::Save( FILE* f ) const
|
||||||
/****************************************/
|
|
||||||
{
|
{
|
||||||
int ii, Success = true;
|
int ii;
|
||||||
char Name1[256], Name2[256];
|
char Name1[256], Name2[256];
|
||||||
wxArrayString reference_fields;
|
wxArrayString reference_fields;
|
||||||
|
|
||||||
|
@ -772,15 +949,17 @@ bool SCH_COMPONENT::Save( FILE* f ) const
|
||||||
//files backwards-compatible.
|
//files backwards-compatible.
|
||||||
if( m_PathsAndReferences.GetCount() > 0 )
|
if( m_PathsAndReferences.GetCount() > 0 )
|
||||||
{
|
{
|
||||||
reference_fields = wxStringTokenize( m_PathsAndReferences[0], delimiters );
|
reference_fields = wxStringTokenize( m_PathsAndReferences[0],
|
||||||
strncpy( Name1, CONV_TO_UTF8( reference_fields[1] ), sizeof(Name1) );
|
delimiters );
|
||||||
|
strncpy( Name1, CONV_TO_UTF8( reference_fields[1] ), sizeof( Name1 ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( GetField( REFERENCE )->m_Text.IsEmpty() )
|
if( GetField( REFERENCE )->m_Text.IsEmpty() )
|
||||||
strncpy( Name1, CONV_TO_UTF8( m_PrefixString ), sizeof(Name1) );
|
strncpy( Name1, CONV_TO_UTF8( m_PrefixString ), sizeof( Name1 ) );
|
||||||
else
|
else
|
||||||
strncpy( Name1, CONV_TO_UTF8( GetField( REFERENCE )->m_Text ), sizeof(Name1) );
|
strncpy( Name1, CONV_TO_UTF8( GetField( REFERENCE )->m_Text ),
|
||||||
|
sizeof( Name1 ) );
|
||||||
}
|
}
|
||||||
for( ii = 0; ii < (int) strlen( Name1 ); ii++ )
|
for( ii = 0; ii < (int) strlen( Name1 ); ii++ )
|
||||||
{
|
{
|
||||||
|
@ -790,35 +969,28 @@ bool SCH_COMPONENT::Save( FILE* f ) const
|
||||||
|
|
||||||
if( !m_ChipName.IsEmpty() )
|
if( !m_ChipName.IsEmpty() )
|
||||||
{
|
{
|
||||||
strncpy( Name2, CONV_TO_UTF8( m_ChipName ), sizeof(Name2) );
|
strncpy( Name2, CONV_TO_UTF8( m_ChipName ), sizeof( Name2 ) );
|
||||||
for( ii = 0; ii < (int) strlen( Name2 ); ii++ )
|
for( ii = 0; ii < (int) strlen( Name2 ); ii++ )
|
||||||
if( Name2[ii] <= ' ' )
|
if( Name2[ii] <= ' ' )
|
||||||
Name2[ii] = '~';
|
Name2[ii] = '~';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
strncpy( Name2, NULL_STRING, sizeof(Name2) );
|
strncpy( Name2, NULL_STRING, sizeof( Name2 ) );
|
||||||
|
|
||||||
fprintf( f, "$Comp\n" );
|
if ( fprintf( f, "$Comp\n" ) == EOF )
|
||||||
|
return false;
|
||||||
|
|
||||||
if( fprintf( f, "L %s %s\n", Name2, Name1 ) == EOF )
|
if( fprintf( f, "L %s %s\n", Name2, Name1 ) == EOF )
|
||||||
{
|
return false;
|
||||||
Success = false;
|
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Generation de numero d'unit, convert et Time Stamp*/
|
/* Generation de numero d'unit, convert et Time Stamp*/
|
||||||
if( fprintf( f, "U %d %d %8.8lX\n", m_Multi, m_Convert, m_TimeStamp ) == EOF )
|
if( fprintf( f, "U %d %d %8.8lX\n", m_Multi, m_Convert,
|
||||||
{
|
m_TimeStamp ) == EOF )
|
||||||
Success = false;
|
return false;
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Save the position */
|
/* Save the position */
|
||||||
if( fprintf( f, "P %d %d\n", m_Pos.x, m_Pos.y ) == EOF )
|
if( fprintf( f, "P %d %d\n", m_Pos.x, m_Pos.y ) == EOF )
|
||||||
{
|
return false;
|
||||||
Success = false;
|
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If this is a complex hierarchy; save hierarchical references.
|
/* If this is a complex hierarchy; save hierarchical references.
|
||||||
* but for simple hierarchies it is not necessary.
|
* but for simple hierarchies it is not necessary.
|
||||||
|
@ -827,7 +999,7 @@ bool SCH_COMPONENT::Save( FILE* f ) const
|
||||||
*/
|
*/
|
||||||
if( m_PathsAndReferences.GetCount() > 1 )
|
if( m_PathsAndReferences.GetCount() > 1 )
|
||||||
{
|
{
|
||||||
for( unsigned int ii = 0; ii< m_PathsAndReferences.GetCount(); ii++ )
|
for( unsigned int ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
/*format:
|
/*format:
|
||||||
* AR Path="/140/2" Ref="C99" Part="1"
|
* AR Path="/140/2" Ref="C99" Part="1"
|
||||||
|
@ -837,23 +1009,19 @@ bool SCH_COMPONENT::Save( FILE* f ) const
|
||||||
* Ref is the conventional component reference for this 'path'
|
* Ref is the conventional component reference for this 'path'
|
||||||
* Part is the conventional component part selection for this 'path'
|
* Part is the conventional component part selection for this 'path'
|
||||||
*/
|
*/
|
||||||
reference_fields = wxStringTokenize( m_PathsAndReferences[ii], delimiters );
|
reference_fields = wxStringTokenize( m_PathsAndReferences[ii],
|
||||||
|
delimiters );
|
||||||
if( fprintf( f, "AR Path=\"%s\" Ref=\"%s\" Part=\"%s\" \n",
|
if( fprintf( f, "AR Path=\"%s\" Ref=\"%s\" Part=\"%s\" \n",
|
||||||
CONV_TO_UTF8( reference_fields[0] ),
|
CONV_TO_UTF8( reference_fields[0] ),
|
||||||
CONV_TO_UTF8( reference_fields[1] ),
|
CONV_TO_UTF8( reference_fields[1] ),
|
||||||
CONV_TO_UTF8( reference_fields[2] )
|
CONV_TO_UTF8( reference_fields[2] ) ) == EOF )
|
||||||
) == EOF )
|
return false;
|
||||||
{
|
|
||||||
Success = false;
|
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int fieldNdx = 0; fieldNdx<GetFieldCount(); ++fieldNdx )
|
for( int fieldNdx = 0; fieldNdx < GetFieldCount(); ++fieldNdx )
|
||||||
{
|
{
|
||||||
SCH_CMP_FIELD* field = GetField( fieldNdx );
|
SCH_CMP_FIELD* field = GetField( fieldNdx );
|
||||||
|
|
||||||
wxString defaultName = ReturnDefaultFieldName( fieldNdx );
|
wxString defaultName = ReturnDefaultFieldName( fieldNdx );
|
||||||
|
|
||||||
// only save the field if there is a value in the field or if field name
|
// only save the field if there is a value in the field or if field name
|
||||||
|
@ -862,34 +1030,22 @@ bool SCH_COMPONENT::Save( FILE* f ) const
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( !field->Save( f ) )
|
if( !field->Save( f ) )
|
||||||
{
|
return false;
|
||||||
Success = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !Success )
|
|
||||||
return Success;
|
|
||||||
|
|
||||||
/* Generation du num unit, position, box ( ancienne norme )*/
|
/* Generation du num unit, position, box ( ancienne norme )*/
|
||||||
if( fprintf( f, "\t%-4d %-4d %-4d\n", m_Multi, m_Pos.x, m_Pos.y ) == EOF )
|
if( fprintf( f, "\t%-4d %-4d %-4d\n", m_Multi, m_Pos.x, m_Pos.y ) == EOF )
|
||||||
{
|
return false;
|
||||||
Success = false;
|
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( fprintf( f, "\t%-4d %-4d %-4d %-4d\n",
|
if( fprintf( f, "\t%-4d %-4d %-4d %-4d\n",
|
||||||
m_Transform[0][0],
|
m_Transform[0][0], m_Transform[0][1],
|
||||||
m_Transform[0][1],
|
m_Transform[1][0], m_Transform[1][1] ) == EOF )
|
||||||
m_Transform[1][0],
|
return false;
|
||||||
m_Transform[1][1] ) == EOF )
|
|
||||||
{
|
|
||||||
Success = false;
|
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf( f, "$EndComp\n" );
|
if( fprintf( f, "$EndComp\n" ) == EOF )
|
||||||
return Success;
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -911,3 +1067,36 @@ EDA_Rect SCH_COMPONENT::GetBoundingBox()
|
||||||
|
|
||||||
return bbox;
|
return bbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SCH_COMPONENT::Display_Infos( WinEDA_DrawFrame* frame )
|
||||||
|
{
|
||||||
|
EDA_LibComponentStruct* Entry = FindLibPart( m_ChipName.GetData(),
|
||||||
|
wxEmptyString, FIND_ROOT );
|
||||||
|
|
||||||
|
wxString msg;
|
||||||
|
|
||||||
|
frame->MsgPanel->EraseMsgBox();
|
||||||
|
|
||||||
|
Affiche_1_Parametre( frame, 1, _( "Ref" ),
|
||||||
|
GetRef(((WinEDA_SchematicFrame*)frame)->GetSheet()),
|
||||||
|
DARKCYAN );
|
||||||
|
|
||||||
|
if( Entry && Entry->m_Options == ENTRY_POWER )
|
||||||
|
msg = _( "Pwr Symb" );
|
||||||
|
else
|
||||||
|
msg = _( "Val" );
|
||||||
|
|
||||||
|
Affiche_1_Parametre( frame, 10, msg, GetField( VALUE )->m_Text, DARKCYAN );
|
||||||
|
|
||||||
|
Affiche_1_Parametre( frame, 28, _( "RefLib" ), m_ChipName.GetData(), BROWN );
|
||||||
|
|
||||||
|
msg = FindLibName;
|
||||||
|
Affiche_1_Parametre( frame, 40, _( "Lib" ), msg, DARKRED );
|
||||||
|
|
||||||
|
if( Entry )
|
||||||
|
{
|
||||||
|
Affiche_1_Parametre( frame, 52, Entry->m_Doc, Entry->m_KeyWord,
|
||||||
|
DARKCYAN );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -5,9 +5,6 @@
|
||||||
#ifndef COMPONENT_CLASS_H
|
#ifndef COMPONENT_CLASS_H
|
||||||
#define COMPONENT_CLASS_H
|
#define COMPONENT_CLASS_H
|
||||||
|
|
||||||
#ifndef eda_global
|
|
||||||
#define eda_global extern
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "base_struct.h"
|
#include "base_struct.h"
|
||||||
#include "class_sch_screen.h"
|
#include "class_sch_screen.h"
|
||||||
|
@ -17,6 +14,14 @@
|
||||||
#include "class_sch_cmp_field.h"
|
#include "class_sch_cmp_field.h"
|
||||||
|
|
||||||
|
|
||||||
|
extern void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
|
SCH_COMPONENT* Component,
|
||||||
|
EDA_LibComponentStruct* Entry,
|
||||||
|
const wxPoint& Pos, const int TransMat[2][2],
|
||||||
|
int Multi, int convert, int DrawMode,
|
||||||
|
int Color = -1, bool DrawPinText = TRUE );
|
||||||
|
|
||||||
|
|
||||||
WX_DECLARE_OBJARRAY( DrawSheetPath, ArrayOfSheetLists );
|
WX_DECLARE_OBJARRAY( DrawSheetPath, ArrayOfSheetLists );
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,23 +81,29 @@ class SCH_COMPONENT : public SCH_ITEM
|
||||||
friend class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC;
|
friend class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int m_Multi; ///< In multi unit chip - which unit to draw.
|
int m_Multi; // In multi unit chip - which unit to draw.
|
||||||
|
|
||||||
wxPoint m_Pos;
|
wxPoint m_Pos;
|
||||||
|
|
||||||
wxString m_ChipName; ///< Key to look for in the library, i.e. "74LS00".
|
wxString m_ChipName; /* Key to look for in the library,
|
||||||
|
* i.e. "74LS00". */
|
||||||
|
|
||||||
wxString m_PrefixString; /* C, R, U, Q etc - the first character which typically indicates what the component is.
|
wxString m_PrefixString; /* C, R, U, Q etc - the first character
|
||||||
* determined, upon placement, from the library component.
|
* which typically indicates what the
|
||||||
* determined, upon file load, by the first non-digits in the reference fields.
|
* component is. Determined, upon
|
||||||
*/
|
* placement, from the library component.
|
||||||
|
* determined, upon file load, by the
|
||||||
|
* first non-digits in the reference
|
||||||
|
* fields. */
|
||||||
|
|
||||||
int m_Convert; /* Handle mutiple shape (for instance De Morgan conversion) */
|
int m_Convert; /* Handle mutiple shape (for instance
|
||||||
int m_Transform[2][2]; /* The rotation/mirror transformation matrix. */
|
* De Morgan conversion) */
|
||||||
|
int m_Transform[2][2]; /* The rotation/mirror transformation
|
||||||
|
* matrix. */
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
SCH_CMP_FIELDS m_Fields; ///< variable length list of fields
|
SCH_CMP_FIELDS m_Fields; ///< variable length list of fields
|
||||||
|
|
||||||
|
|
||||||
/* Hierarchical references.
|
/* Hierarchical references.
|
||||||
|
@ -101,12 +112,14 @@ private:
|
||||||
* with:
|
* with:
|
||||||
* path = /<timestamp1>/<timestamp2> (subsheet path, = / for the root scheet)
|
* path = /<timestamp1>/<timestamp2> (subsheet path, = / for the root scheet)
|
||||||
* reference = reference for this path (C23, R5, U78 ... )
|
* reference = reference for this path (C23, R5, U78 ... )
|
||||||
* multi = part selection in multi parts per package (0 or 1 for àne part per package)
|
* multi = part selection in multi parts per package (0 or 1 for àne part
|
||||||
|
* per package)
|
||||||
*/
|
*/
|
||||||
wxArrayString m_PathsAndReferences;
|
wxArrayString m_PathsAndReferences;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SCH_COMPONENT( const wxPoint& pos = wxPoint( 0, 0 ), SCH_ITEM* aParent = NULL );
|
SCH_COMPONENT( const wxPoint& pos = wxPoint( 0, 0 ),
|
||||||
|
SCH_ITEM* aParent = NULL );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy Constructor
|
* Copy Constructor
|
||||||
|
@ -127,7 +140,8 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Save
|
* Function Save
|
||||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
* writes the data structures for this object out to a FILE in "*.brd"
|
||||||
|
* format.
|
||||||
* @param aFile The FILE to write to.
|
* @param aFile The FILE to write to.
|
||||||
* @return bool - true if success writing else false.
|
* @return bool - true if success writing else false.
|
||||||
*/
|
*/
|
||||||
|
@ -136,8 +150,8 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Load
|
* Function Load
|
||||||
* reads a component in from a file. The file stream must be positioned at the
|
* reads a component in from a file. The file stream must be positioned at
|
||||||
* first field of the file, not at the component tag.
|
* the first field of the file, not at the component tag.
|
||||||
* @param aFile The FILE to read from.
|
* @param aFile The FILE to read from.
|
||||||
* @throw Error containing the error message text if there is a file format
|
* @throw Error containing the error message text if there is a file format
|
||||||
* error or if the disk read has failed.
|
* error or if the disk read has failed.
|
||||||
|
@ -173,7 +187,8 @@ public:
|
||||||
/**
|
/**
|
||||||
* Function ReturnFieldName
|
* Function ReturnFieldName
|
||||||
* returns the Field name given a field index like (REFERENCE, VALUE ..)
|
* returns the Field name given a field index like (REFERENCE, VALUE ..)
|
||||||
* @reeturn wxString - the field name or wxEmptyString if invalid field index.
|
* @reeturn wxString - the field name or wxEmptyString if invalid field
|
||||||
|
* index.
|
||||||
*/
|
*/
|
||||||
wxString ReturnFieldName( int aFieldNdx ) const;
|
wxString ReturnFieldName( int aFieldNdx ) const;
|
||||||
|
|
||||||
|
@ -230,17 +245,22 @@ public:
|
||||||
/**
|
/**
|
||||||
* Function AddHierarchicalReference
|
* Function AddHierarchicalReference
|
||||||
* adds a full hierachical reference (path + local reference)
|
* adds a full hierachical reference (path + local reference)
|
||||||
* @param aPath = hierarchical path (/<sheet timestamp>/component timestamp> like /05678E50/A23EF560)
|
* @param aPath = hierarchical path (/<sheet timestamp>/component
|
||||||
|
* timestamp> like /05678E50/A23EF560)
|
||||||
* @param aRef = local reference like C45, R56
|
* @param aRef = local reference like C45, R56
|
||||||
* @param aMulti = part selection, used in multi part per package (0 or 1 for non multi)
|
* @param aMulti = part selection, used in multi part per package (0 or 1
|
||||||
|
* for non multi)
|
||||||
*/
|
*/
|
||||||
void AddHierarchicalReference( const wxString& aPath, const wxString& aRef, int aMulti );
|
void AddHierarchicalReference( const wxString& aPath,
|
||||||
|
const wxString& aRef,
|
||||||
|
int aMulti );
|
||||||
|
|
||||||
//returns the unit selection, for the given sheet path.
|
//returns the unit selection, for the given sheet path.
|
||||||
int GetUnitSelection( DrawSheetPath* aSheet );
|
int GetUnitSelection( DrawSheetPath* aSheet );
|
||||||
|
|
||||||
//Set the unit selection, for the given sheet path.
|
//Set the unit selection, for the given sheet path.
|
||||||
void SetUnitSelection( DrawSheetPath* aSheet, int aUnitSelection );
|
void SetUnitSelection( DrawSheetPath* aSheet,
|
||||||
|
int aUnitSelection );
|
||||||
|
|
||||||
#if defined (DEBUG)
|
#if defined (DEBUG)
|
||||||
|
|
||||||
|
|
|
@ -223,7 +223,7 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( const wxPoin
|
||||||
void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
|
void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixels )
|
||||||
/*************************************************************************************/
|
/*************************************************************************************/
|
||||||
{
|
{
|
||||||
wxRealPoint delta;
|
wxRealPoint delta;
|
||||||
SCH_SCREEN* screen = GetScreen();
|
SCH_SCREEN* screen = GetScreen();
|
||||||
wxPoint curpos, oldpos;
|
wxPoint curpos, oldpos;
|
||||||
int hotkey = 0;
|
int hotkey = 0;
|
||||||
|
@ -248,25 +248,25 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPi
|
||||||
|
|
||||||
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
|
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
|
||||||
case WXK_UP:
|
case WXK_UP:
|
||||||
MousePositionInPixels.y -= (int) round(delta.y);
|
MousePositionInPixels.y -= wxRound(delta.y);
|
||||||
DrawPanel->MouseTo( MousePositionInPixels );
|
DrawPanel->MouseTo( MousePositionInPixels );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD2: /* Deplacement curseur vers le bas */
|
case WXK_NUMPAD2: /* Deplacement curseur vers le bas */
|
||||||
case WXK_DOWN:
|
case WXK_DOWN:
|
||||||
MousePositionInPixels.y += (int) round(delta.y);
|
MousePositionInPixels.y += wxRound(delta.y);
|
||||||
DrawPanel->MouseTo( MousePositionInPixels );
|
DrawPanel->MouseTo( MousePositionInPixels );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */
|
case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */
|
||||||
case WXK_LEFT:
|
case WXK_LEFT:
|
||||||
MousePositionInPixels.x -= (int) round(delta.x);
|
MousePositionInPixels.x -= wxRound(delta.x);
|
||||||
DrawPanel->MouseTo( MousePositionInPixels );
|
DrawPanel->MouseTo( MousePositionInPixels );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD6: /* Deplacement curseur vers la droite */
|
case WXK_NUMPAD6: /* Deplacement curseur vers la droite */
|
||||||
case WXK_RIGHT:
|
case WXK_RIGHT:
|
||||||
MousePositionInPixels.x += (int) round(delta.x);
|
MousePositionInPixels.x += wxRound(delta.x);
|
||||||
DrawPanel->MouseTo( MousePositionInPixels );
|
DrawPanel->MouseTo( MousePositionInPixels );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -308,7 +308,7 @@ void WinEDA_SchematicFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPi
|
||||||
OnHotKey( DC, hotkey, NULL );
|
OnHotKey( DC, hotkey, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
Affiche_Status_Box(); /* Display cursor coordintes info */
|
UpdateStatusBar(); /* Display cursor coordintes info */
|
||||||
SetToolbars();
|
SetToolbars();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,25 +342,25 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
|
||||||
|
|
||||||
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
|
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
|
||||||
case WXK_UP:
|
case WXK_UP:
|
||||||
MousePositionInPixels.y -= (int) round(delta.y);
|
MousePositionInPixels.y -= wxRound(delta.y);
|
||||||
DrawPanel->MouseTo( MousePositionInPixels );
|
DrawPanel->MouseTo( MousePositionInPixels );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD2: /* Deplacement curseur vers le bas */
|
case WXK_NUMPAD2: /* Deplacement curseur vers le bas */
|
||||||
case WXK_DOWN:
|
case WXK_DOWN:
|
||||||
MousePositionInPixels.y += (int) round(delta.y);
|
MousePositionInPixels.y += wxRound(delta.y);
|
||||||
DrawPanel->MouseTo( MousePositionInPixels );
|
DrawPanel->MouseTo( MousePositionInPixels );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */
|
case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */
|
||||||
case WXK_LEFT:
|
case WXK_LEFT:
|
||||||
MousePositionInPixels.x -= (int) round(delta.x);
|
MousePositionInPixels.x -= wxRound(delta.x);
|
||||||
DrawPanel->MouseTo( MousePositionInPixels );
|
DrawPanel->MouseTo( MousePositionInPixels );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD6: /* Deplacement curseur vers la droite */
|
case WXK_NUMPAD6: /* Deplacement curseur vers la droite */
|
||||||
case WXK_RIGHT:
|
case WXK_RIGHT:
|
||||||
MousePositionInPixels.x += (int) round(delta.x);
|
MousePositionInPixels.x += wxRound(delta.x);
|
||||||
DrawPanel->MouseTo( MousePositionInPixels );
|
DrawPanel->MouseTo( MousePositionInPixels );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -402,7 +402,7 @@ void WinEDA_LibeditFrame::GeneralControle( wxDC* DC, wxPoint MousePositionInPixe
|
||||||
OnHotKey( DC, hotkey, NULL );
|
OnHotKey( DC, hotkey, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
Affiche_Status_Box(); /* Affichage des coord curseur */
|
UpdateStatusBar(); /* Affichage des coord curseur */
|
||||||
SetToolbars();
|
SetToolbars();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -436,25 +436,25 @@ void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC,
|
||||||
|
|
||||||
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
|
case WXK_NUMPAD8: /* Deplacement curseur vers le haut */
|
||||||
case WXK_UP:
|
case WXK_UP:
|
||||||
MousePositionInPixels.y -= (int) round(delta.y);
|
MousePositionInPixels.y -= wxRound(delta.y);
|
||||||
DrawPanel->MouseTo( MousePositionInPixels );
|
DrawPanel->MouseTo( MousePositionInPixels );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD2: /* Deplacement curseur vers le bas */
|
case WXK_NUMPAD2: /* Deplacement curseur vers le bas */
|
||||||
case WXK_DOWN:
|
case WXK_DOWN:
|
||||||
MousePositionInPixels.y += (int) round(delta.y);
|
MousePositionInPixels.y += wxRound(delta.y);
|
||||||
DrawPanel->MouseTo( MousePositionInPixels );
|
DrawPanel->MouseTo( MousePositionInPixels );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */
|
case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */
|
||||||
case WXK_LEFT:
|
case WXK_LEFT:
|
||||||
MousePositionInPixels.x -= (int) round(delta.x);
|
MousePositionInPixels.x -= wxRound(delta.x);
|
||||||
DrawPanel->MouseTo( MousePositionInPixels );
|
DrawPanel->MouseTo( MousePositionInPixels );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WXK_NUMPAD6: /* Deplacement curseur vers la droite */
|
case WXK_NUMPAD6: /* Deplacement curseur vers la droite */
|
||||||
case WXK_RIGHT:
|
case WXK_RIGHT:
|
||||||
MousePositionInPixels.x += (int) round(delta.x);
|
MousePositionInPixels.x += wxRound(delta.x);
|
||||||
DrawPanel->MouseTo( MousePositionInPixels );
|
DrawPanel->MouseTo( MousePositionInPixels );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -496,6 +496,6 @@ void WinEDA_ViewlibFrame::GeneralControle( wxDC* DC,
|
||||||
OnHotKey( DC, hotkey, NULL );
|
OnHotKey( DC, hotkey, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
Affiche_Status_Box(); /* Affichage des coord curseur */
|
UpdateStatusBar(); /* Affichage des coord curseur */
|
||||||
SetToolbars();
|
SetToolbars();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,13 +4,12 @@
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "gr_basic.h"
|
#include "gr_basic.h"
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "class_drawpickedstruct.h"
|
||||||
|
|
||||||
#include "program.h"
|
#include "program.h"
|
||||||
#include "libcmp.h"
|
#include "libcmp.h"
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
|
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -305,7 +304,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
|
||||||
|
|
||||||
if( PickedList )
|
if( PickedList )
|
||||||
{
|
{
|
||||||
DeleteStruct( DrawPanel, DC, PickedList );
|
DeleteStruct( DrawPanel, DC, (SCH_ITEM*) PickedList );
|
||||||
GetScreen()->SetModify();
|
GetScreen()->SetModify();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,11 +130,11 @@ void DIALOG_SVG_PRINT::SetPenWidth()
|
||||||
void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
|
void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
wxFileName fn;
|
||||||
|
|
||||||
SetPenWidth();
|
SetPenWidth();
|
||||||
|
|
||||||
wxString FullFileName;
|
|
||||||
BASE_SCREEN* screen = m_Parent->GetBaseScreen();
|
BASE_SCREEN* screen = m_Parent->GetBaseScreen();
|
||||||
BASE_SCREEN* oldscreen = screen;
|
BASE_SCREEN* oldscreen = screen;
|
||||||
|
|
||||||
|
@ -165,10 +165,11 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
|
||||||
return;
|
return;
|
||||||
sheetpath = SheetList.GetNext();
|
sheetpath = SheetList.GetNext();
|
||||||
|
|
||||||
FullFileName = schframe->GetUniqueFilenameForCurrentSheet( ) + wxT( ".svg" );
|
fn = schframe->GetUniqueFilenameForCurrentSheet( ) + wxT( ".svg" );
|
||||||
|
|
||||||
bool success = DrawPage( FullFileName, schscreen, aPrint_Sheet_Ref );
|
bool success = DrawPage( fn.GetFullPath(), schscreen,
|
||||||
msg = _( "Create file " ) + FullFileName;
|
aPrint_Sheet_Ref );
|
||||||
|
msg = _( "Create file " ) + fn.GetFullPath();
|
||||||
if( !success )
|
if( !success )
|
||||||
msg += _( " error" );
|
msg += _( " error" );
|
||||||
msg += wxT( "\n" );
|
msg += wxT( "\n" );
|
||||||
|
@ -180,16 +181,20 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FullFileName = m_FileNameCtrl->GetValue();
|
fn = m_FileNameCtrl->GetValue();
|
||||||
if( FullFileName.IsEmpty() )
|
|
||||||
|
if( !fn.IsOk() )
|
||||||
{
|
{
|
||||||
FullFileName = screen->m_FileName;
|
fn = screen->m_FileName;
|
||||||
ChangeFileNameExt( FullFileName, wxT( ".svg" ) );
|
fn.SetExt( wxT( "svg" ) );
|
||||||
}
|
}
|
||||||
bool success = DrawPage( FullFileName, screen, aPrint_Sheet_Ref );
|
|
||||||
msg = _( "Create file " ) + FullFileName;
|
bool success = DrawPage( fn.GetFullPath(), screen, aPrint_Sheet_Ref );
|
||||||
|
msg = _( "Create file " ) + fn.GetFullPath();
|
||||||
|
|
||||||
if( !success )
|
if( !success )
|
||||||
msg += _( " error" );
|
msg += _( " error" );
|
||||||
|
|
||||||
msg += wxT( "\n" );
|
msg += wxT( "\n" );
|
||||||
m_MessagesBox->AppendText( msg );
|
m_MessagesBox->AppendText( msg );
|
||||||
}
|
}
|
||||||
|
@ -247,11 +252,11 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, BASE_SCREEN* scre
|
||||||
panel->m_ClipBox.SetX( 0 ); panel->m_ClipBox.SetY( 0 );
|
panel->m_ClipBox.SetX( 0 ); panel->m_ClipBox.SetY( 0 );
|
||||||
panel->m_ClipBox.SetWidth( 0x7FFFFF0 ); panel->m_ClipBox.SetHeight( 0x7FFFFF0 );
|
panel->m_ClipBox.SetWidth( 0x7FFFFF0 ); panel->m_ClipBox.SetHeight( 0x7FFFFF0 );
|
||||||
|
|
||||||
g_IsPrinting = true;
|
screen->m_IsPrinting = true;
|
||||||
SetLocaleTo_C_standard( ); // 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)
|
||||||
panel->PrintPage( &dc, aPrint_Sheet_Ref, 1, false );
|
panel->PrintPage( &dc, aPrint_Sheet_Ref, 1, false );
|
||||||
SetLocaleTo_Default( ); // revert to the current locale
|
SetLocaleTo_Default( ); // revert to the current locale
|
||||||
g_IsPrinting = FALSE;
|
screen->m_IsPrinting = false;
|
||||||
panel->m_ClipBox = tmp;
|
panel->m_ClipBox = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ DIALOG_BUILD_BOM::DIALOG_BUILD_BOM( WinEDA_DrawFrame* parent ):
|
||||||
wxASSERT( m_Config != NULL );
|
wxASSERT( m_Config != NULL );
|
||||||
|
|
||||||
m_Parent = parent;
|
m_Parent = parent;
|
||||||
|
|
||||||
Init( );
|
Init( );
|
||||||
|
|
||||||
if (GetSizer())
|
if (GetSizer())
|
||||||
|
@ -99,7 +99,7 @@ DIALOG_BUILD_BOM::DIALOG_BUILD_BOM( WinEDA_DrawFrame* parent ):
|
||||||
void DIALOG_BUILD_BOM::Init()
|
void DIALOG_BUILD_BOM::Init()
|
||||||
{
|
{
|
||||||
SetFont( *g_DialogFont );
|
SetFont( *g_DialogFont );
|
||||||
|
|
||||||
SetFocus();
|
SetFocus();
|
||||||
|
|
||||||
/* Get options */
|
/* Get options */
|
||||||
|
@ -203,6 +203,9 @@ void DIALOG_BUILD_BOM::OnCancelClick( wxCommandEvent& event )
|
||||||
void DIALOG_BUILD_BOM::SavePreferences()
|
void DIALOG_BUILD_BOM::SavePreferences()
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
{
|
{
|
||||||
|
wxConfig* config = wxGetApp().m_EDA_Config;
|
||||||
|
wxASSERT( config != NULL );
|
||||||
|
|
||||||
// Determine current settings of "List items" and "Options" checkboxes
|
// Determine current settings of "List items" and "Options" checkboxes
|
||||||
// (NOTE: These 6 settings are restored when the dialog box is next
|
// (NOTE: These 6 settings are restored when the dialog box is next
|
||||||
// invoked, but are *not* still saved after EESchema is next shut down.)
|
// invoked, but are *not* still saved after EESchema is next shut down.)
|
||||||
|
|
|
@ -229,11 +229,11 @@ wxString msg = _("Cmp file Ext: ") + g_NetCmpExtBuffer;
|
||||||
wxStaticText * text = new wxStaticText( itemDialog1, -1, msg, wxDefaultPosition, wxDefaultSize, 0 );
|
wxStaticText * text = new wxStaticText( itemDialog1, -1, msg, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_FileExtList->Add(text, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5);
|
m_FileExtList->Add(text, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5);
|
||||||
|
|
||||||
msg = _("Net file Ext: ") + g_NetExtBuffer;
|
msg = _("Net file Ext: ") + NetlistFileExtension;
|
||||||
text = new wxStaticText( itemDialog1, -1, msg, wxDefaultPosition, wxDefaultSize, 0 );
|
text = new wxStaticText( itemDialog1, -1, msg, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_FileExtList->Add(text, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5);
|
m_FileExtList->Add(text, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5);
|
||||||
|
|
||||||
msg = _("Library file Ext: ") + g_LibExtBuffer;
|
msg = _("Library file Ext: ") + CompLibFileExtension;
|
||||||
text = new wxStaticText( itemDialog1, -1, msg, wxDefaultPosition, wxDefaultSize, 0 );
|
text = new wxStaticText( itemDialog1, -1, msg, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_FileExtList->Add(text, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5);
|
m_FileExtList->Add(text, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5);
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ wxString msg = _("Cmp file Ext: ") + g_NetCmpExtBuffer;
|
||||||
text = new wxStaticText( itemDialog1, -1, msg, wxDefaultPosition, wxDefaultSize, 0 );
|
text = new wxStaticText( itemDialog1, -1, msg, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_FileExtList->Add(text, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5);
|
m_FileExtList->Add(text, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5);
|
||||||
|
|
||||||
msg = _("Schematic file Ext: ") + g_SchExtBuffer;
|
msg = _("Schematic file Ext: ") + SchematicFileExtension;
|
||||||
text = new wxStaticText( itemDialog1, -1, msg, wxDefaultPosition, wxDefaultSize, 0 );
|
text = new wxStaticText( itemDialog1, -1, msg, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_FileExtList->Add(text, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5);
|
m_FileExtList->Add(text, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxADJUST_MINSIZE, 5);
|
||||||
|
|
||||||
|
@ -316,7 +316,6 @@ void KiConfigEeschemaFrame::ChangeSetup()
|
||||||
/*********************************************/
|
/*********************************************/
|
||||||
{
|
{
|
||||||
g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
|
g_UserLibDirBuffer = m_LibDirCtrl->GetValue();
|
||||||
SetRealLibraryPath( wxT("library") );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -344,49 +343,58 @@ void KiConfigEeschemaFrame::AddOrInsertLibrary(wxCommandEvent& event)
|
||||||
the selection
|
the selection
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
wxString FullLibName,ShortLibName, Mask;
|
wxString tmp;
|
||||||
|
wxFileName fn;
|
||||||
|
|
||||||
|
/* TODO: Fix this, it's broken. Add should add the new library to the
|
||||||
|
* end of the list and insert should insert the new library ahead
|
||||||
|
* of the selected library in the list or at the beginning if no
|
||||||
|
* library is selected. */
|
||||||
ii = m_ListLibr->GetSelection();
|
ii = m_ListLibr->GetSelection();
|
||||||
if ( ii < 0 ) ii = 0;
|
if ( ii < 0 )
|
||||||
|
ii = 0;
|
||||||
ChangeSetup();
|
ChangeSetup();
|
||||||
if( event.GetId() == ADD_LIB)
|
if( event.GetId() == ADD_LIB)
|
||||||
{
|
{
|
||||||
if( g_LibName_List.GetCount() != 0 ) ii ++; /* Add after selection */
|
if( g_LibName_List.GetCount() != 0 )
|
||||||
|
ii++; /* Add after selection */
|
||||||
}
|
}
|
||||||
|
|
||||||
Mask = wxT("*") + g_LibExtBuffer;
|
wxFileDialog dlg( this, _( "Schematic Component Library Files" ),
|
||||||
|
g_RealLibDirBuffer, wxEmptyString, CompLibFileWildcard,
|
||||||
|
wxFD_OPEN | wxFD_MULTIPLE | wxFD_FILE_MUST_EXIST );
|
||||||
|
|
||||||
wxFileDialog FilesDialog(this, _("Library files:"), g_RealLibDirBuffer,
|
if ( dlg.ShowModal() != wxID_OK )
|
||||||
wxEmptyString, Mask,
|
|
||||||
wxFD_DEFAULT_STYLE | wxFD_MULTIPLE);
|
|
||||||
|
|
||||||
int diag = FilesDialog.ShowModal();
|
|
||||||
if ( diag != wxID_OK )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxArrayString Filenames;
|
wxArrayString Filenames;
|
||||||
FilesDialog.GetPaths(Filenames);
|
dlg.GetPaths(Filenames);
|
||||||
|
|
||||||
for ( unsigned jj = 0; jj < Filenames.GetCount(); jj ++ )
|
for ( unsigned jj = 0; jj < Filenames.GetCount(); jj ++ )
|
||||||
{
|
{
|
||||||
FullLibName = Filenames[jj];
|
fn = Filenames[jj];
|
||||||
ShortLibName = MakeReducedFileName(FullLibName,g_RealLibDirBuffer,g_LibExtBuffer);
|
|
||||||
if ( ShortLibName.IsEmpty() ) //Just in case...
|
/* If the library path is already in the library search paths
|
||||||
continue;
|
* list, just add the library name to the list. Otherwise, add
|
||||||
//Add or insert new library name
|
* the library name with the full path. */
|
||||||
if ( g_LibName_List.Index(ShortLibName) == wxNOT_FOUND)
|
if( wxGetApp().GetLibraryPathList().Index( fn.GetPath() ) == wxNOT_FOUND )
|
||||||
|
tmp = fn.GetPathWithSep() + fn.GetName();
|
||||||
|
else
|
||||||
|
tmp = fn.GetName();
|
||||||
|
|
||||||
|
// Add or insert new library name.
|
||||||
|
if( g_LibName_List.Index( tmp ) == wxNOT_FOUND )
|
||||||
{
|
{
|
||||||
m_LibListChanged = TRUE;
|
m_LibListChanged = TRUE;
|
||||||
g_LibName_List.Insert(ShortLibName, ii);
|
g_LibName_List.Insert( tmp, ii++ );
|
||||||
m_ListLibr->Clear();
|
m_ListLibr->Clear();
|
||||||
m_ListLibr->InsertItems(g_LibName_List, 0);
|
m_ListLibr->InsertItems(g_LibName_List, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg = wxT("<") + tmp + wxT("> : ") +
|
||||||
msg << wxT("<") << ShortLibName << wxT("> : ") << _("Library already in use");
|
_("Library already in use");
|
||||||
DisplayError(this, msg);
|
DisplayError(this, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -439,7 +439,7 @@ void WinEDA_SetOptionsFrame::Accept( wxCommandEvent& event )
|
||||||
else
|
else
|
||||||
g_ShowAllPins = TRUE;
|
g_ShowAllPins = TRUE;
|
||||||
|
|
||||||
g_ShowGrid = m_Parent->m_Draw_Grid = m_ShowGridOpt->GetValue();
|
m_Parent->m_Draw_Grid = m_ShowGridOpt->GetValue();
|
||||||
m_Parent->DrawPanel->m_AutoPAN_Enable = m_AutoPANOpt->GetValue();
|
m_Parent->DrawPanel->m_AutoPAN_Enable = m_AutoPANOpt->GetValue();
|
||||||
|
|
||||||
m_Parent->m_Draw_Grid = m_ShowGridOpt->GetValue();
|
m_Parent->m_Draw_Grid = m_ShowGridOpt->GetValue();
|
||||||
|
|
|
@ -455,21 +455,22 @@ void EDA_Printout::DrawPage()
|
||||||
* in order to keep the requested value */
|
* in order to keep the requested value */
|
||||||
dc->GetUserScale( &xdcscale, &ydcscale );
|
dc->GetUserScale( &xdcscale, &ydcscale );
|
||||||
ftmp /= xdcscale;
|
ftmp /= xdcscale;
|
||||||
SetPenMinWidth( (int) round( ftmp ) );
|
SetPenMinWidth( wxRound( ftmp ) );
|
||||||
|
|
||||||
WinEDA_DrawPanel* panel = m_Parent->DrawPanel;
|
WinEDA_DrawPanel* panel = m_Parent->DrawPanel;
|
||||||
|
BASE_SCREEN* screen = panel->GetScreen();
|
||||||
EDA_Rect tmp = panel->m_ClipBox;
|
EDA_Rect tmp = panel->m_ClipBox;
|
||||||
|
|
||||||
panel->m_ClipBox.SetOrigin( wxPoint( 0, 0 ) );
|
panel->m_ClipBox.SetOrigin( wxPoint( 0, 0 ) );
|
||||||
panel->m_ClipBox.SetSize( wxSize( 0x7FFFFF0, 0x7FFFFF0 ) );
|
panel->m_ClipBox.SetSize( wxSize( 0x7FFFFF0, 0x7FFFFF0 ) );
|
||||||
|
|
||||||
g_IsPrinting = true;
|
screen->m_IsPrinting = true;
|
||||||
int bg_color = g_DrawBgColor;
|
int bg_color = g_DrawBgColor;
|
||||||
|
|
||||||
panel->PrintPage( dc, m_Print_Sheet_Ref, 0xFFFFFFFF, false );
|
panel->PrintPage( dc, m_Print_Sheet_Ref, 0xFFFFFFFF, false );
|
||||||
|
|
||||||
g_DrawBgColor = bg_color;
|
g_DrawBgColor = bg_color;
|
||||||
g_IsPrinting = false;
|
screen->m_IsPrinting = false;
|
||||||
panel->m_ClipBox = tmp;
|
panel->m_ClipBox = tmp;
|
||||||
|
|
||||||
SetPenMinWidth( 1 );
|
SetPenMinWidth( 1 );
|
||||||
|
|
|
@ -287,46 +287,6 @@ void WinEDA_SchematicFrame::RotateCmpField( SCH_CMP_FIELD* Field, wxDC* DC )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
|
||||||
void SCH_CMP_FIELD::Place( WinEDA_SchematicFrame* frame, wxDC* DC )
|
|
||||||
/*********************************************************************/
|
|
||||||
{
|
|
||||||
int fieldNdx;
|
|
||||||
EDA_LibComponentStruct* Entry;
|
|
||||||
|
|
||||||
frame->DrawPanel->ManageCurseur = NULL;
|
|
||||||
frame->DrawPanel->ForceCloseManageCurseur = NULL;
|
|
||||||
|
|
||||||
SCH_COMPONENT* component = (SCH_COMPONENT*) GetParent();
|
|
||||||
|
|
||||||
// save old cmp in undo list
|
|
||||||
if( g_ItemToUndoCopy && ( g_ItemToUndoCopy->Type() == component->Type()) )
|
|
||||||
{
|
|
||||||
component->SwapData( (SCH_COMPONENT*) g_ItemToUndoCopy );
|
|
||||||
frame->SaveCopyInUndoList( component, IS_CHANGED );
|
|
||||||
component->SwapData( (SCH_COMPONENT*) g_ItemToUndoCopy );
|
|
||||||
}
|
|
||||||
|
|
||||||
fieldNdx = m_FieldId;
|
|
||||||
m_AddExtraText = 0;
|
|
||||||
if( fieldNdx == REFERENCE )
|
|
||||||
{
|
|
||||||
Entry = FindLibPart( component->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
|
|
||||||
if( Entry != NULL )
|
|
||||||
{
|
|
||||||
if( Entry->m_UnitCount > 1 )
|
|
||||||
m_AddExtraText = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Draw( frame->DrawPanel, DC, wxPoint(0,0), GR_DEFAULT_DRAWMODE );
|
|
||||||
m_Flags = 0;
|
|
||||||
frame->GetScreen()->SetCurItem( NULL );
|
|
||||||
frame->GetScreen()->SetModify();
|
|
||||||
frame->SetCurrentField( NULL );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************************************/
|
/**************************************************************************************************/
|
||||||
void WinEDA_SchematicFrame::EditComponentReference( SCH_COMPONENT* Cmp, wxDC* DC )
|
void WinEDA_SchematicFrame::EditComponentReference( SCH_COMPONENT* Cmp, wxDC* DC )
|
||||||
/**************************************************************************************************/
|
/**************************************************************************************************/
|
||||||
|
|
|
@ -134,26 +134,25 @@ wxString Line;
|
||||||
Close();
|
Close();
|
||||||
|
|
||||||
if ( CurrentDrawItem )
|
if ( CurrentDrawItem )
|
||||||
CurrentDrawItem->Display_Infos_DrawEntry(m_Parent);
|
CurrentDrawItem->DisplayInfo( m_Parent );
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************/
|
|
||||||
void WinEDA_LibeditFrame::EditSymbolText(wxDC * DC,
|
void WinEDA_LibeditFrame::EditSymbolText(wxDC * DC,
|
||||||
LibEDA_BaseStruct * DrawItem)
|
LibEDA_BaseStruct * DrawItem)
|
||||||
/*******************************************************/
|
|
||||||
{
|
{
|
||||||
int DrawMode = g_XorMode;
|
int DrawMode = g_XorMode;
|
||||||
|
|
||||||
if ( DrawItem == NULL ) return;
|
if ( ( DrawItem == NULL )
|
||||||
if ( DrawItem->Type() != COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ) return;
|
|| ( DrawItem->Type() != COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ) )
|
||||||
|
return;
|
||||||
|
|
||||||
/* Effacement ancien texte */
|
/* Effacement ancien texte */
|
||||||
if( ((LibDrawText*)DrawItem)->m_Text && DC)
|
if( ((LibDrawText*)DrawItem)->m_Text && DC)
|
||||||
DrawLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0),
|
DrawLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0),
|
||||||
DrawItem, DrawMode);
|
DrawItem, DrawMode);
|
||||||
|
|
||||||
|
|
||||||
Dialog_BodyGraphicText_Properties * frame =
|
Dialog_BodyGraphicText_Properties * frame =
|
||||||
|
|
|
@ -29,9 +29,9 @@
|
||||||
void WinEDA_SchematicFrame::Process_Config( wxCommandEvent& event )
|
void WinEDA_SchematicFrame::Process_Config( wxCommandEvent& event )
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
{
|
{
|
||||||
int id = event.GetId();
|
int id = event.GetId();
|
||||||
wxPoint pos;
|
wxPoint pos;
|
||||||
wxString FullFileName;
|
wxFileName fn;
|
||||||
|
|
||||||
wxGetMousePosition( &pos.x, &pos.y );
|
wxGetMousePosition( &pos.x, &pos.y );
|
||||||
|
|
||||||
|
@ -58,35 +58,25 @@ void WinEDA_SchematicFrame::Process_Config( wxCommandEvent& event )
|
||||||
|
|
||||||
case ID_CONFIG_READ:
|
case ID_CONFIG_READ:
|
||||||
{
|
{
|
||||||
wxString mask( wxT( "*" ) ); mask += g_Prj_Config_Filename_ext;
|
fn = g_RootSheet->m_AssociatedScreen->m_FileName;
|
||||||
FullFileName = g_RootSheet->m_AssociatedScreen->m_FileName;
|
fn.SetExt( ProjectFileExtension );
|
||||||
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
|
|
||||||
|
|
||||||
FullFileName = EDA_FileSelector( _( "Read config file" ),
|
wxFileDialog dlg( this, _( "Read Project File" ), fn.GetPath(),
|
||||||
wxGetCwd(), /* Chemin par defaut */
|
fn.GetFullName(), ProjectFileWildcard,
|
||||||
FullFileName, /* nom fichier par defaut */
|
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||||
g_Prj_Config_Filename_ext, /* extension par defaut */
|
|
||||||
mask, /* Masque d'affichage */
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
this,
|
|
||||||
wxFD_OPEN,
|
|
||||||
TRUE /* ne change pas de repertoire courant */
|
|
||||||
);
|
|
||||||
if( FullFileName.IsEmpty() )
|
|
||||||
break;
|
break;
|
||||||
if( !wxFileExists( FullFileName ) )
|
|
||||||
{
|
Read_Config( fn.GetFullPath(), TRUE );
|
||||||
wxString msg = _( "File " ) + FullFileName + _( "not found" );;
|
|
||||||
DisplayError( this, msg ); break;
|
|
||||||
}
|
|
||||||
Read_Config( FullFileName, TRUE );
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_PREFERENCES_CREATE_CONFIG_HOTKEYS:
|
case ID_PREFERENCES_CREATE_CONFIG_HOTKEYS:
|
||||||
FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
|
fn = wxFileName( ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice ),
|
||||||
FullFileName += HOTKEY_FILENAME;
|
HOTKEY_FILENAME,
|
||||||
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
|
DEFAULT_HOTKEY_FILENAME_EXT );
|
||||||
WriteHotkeyConfigFile( FullFileName, s_Eeschema_Hokeys_Descr, true );
|
WriteHotkeyConfigFile( fn.GetFullPath(), s_Eeschema_Hokeys_Descr, true );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_PREFERENCES_READ_CONFIG_HOTKEYS:
|
case ID_PREFERENCES_READ_CONFIG_HOTKEYS:
|
||||||
|
@ -95,13 +85,11 @@ void WinEDA_SchematicFrame::Process_Config( wxCommandEvent& event )
|
||||||
|
|
||||||
case ID_PREFERENCES_EDIT_CONFIG_HOTKEYS:
|
case ID_PREFERENCES_EDIT_CONFIG_HOTKEYS:
|
||||||
{
|
{
|
||||||
FullFileName = ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice );
|
fn = wxFileName( ReturnHotkeyConfigFilePath( g_ConfigFileLocationChoice ),
|
||||||
FullFileName += HOTKEY_FILENAME;
|
HOTKEY_FILENAME, DEFAULT_HOTKEY_FILENAME_EXT );
|
||||||
FullFileName += DEFAULT_HOTKEY_FILENAME_EXT;
|
wxString editorname = wxGetApp().GetEditorName();
|
||||||
AddDelimiterString( FullFileName );
|
|
||||||
wxString editorname = GetEditorName();
|
|
||||||
if( !editorname.IsEmpty() )
|
if( !editorname.IsEmpty() )
|
||||||
ExecuteFile( this, editorname, FullFileName );
|
ExecuteFile( this, editorname, QuoteFullPath( fn ) );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -115,9 +103,8 @@ void WinEDA_SchematicFrame::Process_Config( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DisplayError( this,
|
DisplayError( this, wxT( "WinEDA_SchematicFrame::Process_Config " \
|
||||||
wxT(
|
"internal error" ) );
|
||||||
"WinEDA_SchematicFrame::Process_Config internal error" ) );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +142,7 @@ bool Read_Config( const wxString& CfgFileName, bool ForceRereadConfig )
|
||||||
* Retourne TRUE si lu, FALSE si config non lue
|
* Retourne TRUE si lu, FALSE si config non lue
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxString FullFileName;
|
wxFileName fn;
|
||||||
bool IsRead = TRUE;
|
bool IsRead = TRUE;
|
||||||
wxArrayString liblist_tmp = g_LibName_List;
|
wxArrayString liblist_tmp = g_LibName_List;
|
||||||
WinEDA_SchematicFrame* frame;
|
WinEDA_SchematicFrame* frame;
|
||||||
|
@ -163,21 +150,36 @@ bool Read_Config( const wxString& CfgFileName, bool ForceRereadConfig )
|
||||||
frame = (WinEDA_SchematicFrame*)wxGetApp().GetTopWindow();
|
frame = (WinEDA_SchematicFrame*)wxGetApp().GetTopWindow();
|
||||||
|
|
||||||
if( CfgFileName.IsEmpty() )
|
if( CfgFileName.IsEmpty() )
|
||||||
FullFileName = g_RootSheet->m_AssociatedScreen->m_FileName;
|
fn = g_RootSheet->m_AssociatedScreen->m_FileName;
|
||||||
else
|
else
|
||||||
FullFileName = CfgFileName;
|
fn = CfgFileName;
|
||||||
g_LibName_List.Clear();
|
g_LibName_List.Clear();
|
||||||
|
|
||||||
if( !wxGetApp().ReadProjectConfig( FullFileName,
|
/* Change the schematic file extension (.sch) to the project file
|
||||||
GROUP, ParamCfgList,
|
* extension (.pro). */
|
||||||
ForceRereadConfig ? FALSE : TRUE ) ) // Config non lue
|
fn.SetExt( ProjectFileExtension );
|
||||||
|
|
||||||
|
if( wxGetApp().GetLibraryPathList().Index( g_UserLibDirBuffer ) != wxNOT_FOUND )
|
||||||
|
{
|
||||||
|
wxLogDebug( wxT( "Removing path <%s> to library path search list." ),
|
||||||
|
g_UserLibDirBuffer.c_str() );
|
||||||
|
wxGetApp().GetLibraryPathList().Remove( g_UserLibDirBuffer );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !wxGetApp().ReadProjectConfig( fn.GetFullPath(), GROUP, ParamCfgList,
|
||||||
|
ForceRereadConfig ? FALSE : TRUE ) )
|
||||||
{
|
{
|
||||||
g_LibName_List = liblist_tmp;
|
g_LibName_List = liblist_tmp;
|
||||||
IsRead = FALSE;
|
IsRead = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Traitement des variables particulieres: */
|
if( wxFileName::DirExists( g_UserLibDirBuffer )
|
||||||
SetRealLibraryPath( wxT( "library" ) );
|
&& wxGetApp().GetLibraryPathList().Index( g_UserLibDirBuffer ) == wxNOT_FOUND )
|
||||||
|
{
|
||||||
|
wxLogDebug( wxT( "Adding path <%s> to library path search list." ),
|
||||||
|
g_UserLibDirBuffer.c_str() );
|
||||||
|
wxGetApp().GetLibraryPathList().Add( g_UserLibDirBuffer );
|
||||||
|
}
|
||||||
|
|
||||||
// If the list is void, load the libraries "power.lib" and "device.lib"
|
// If the list is void, load the libraries "power.lib" and "device.lib"
|
||||||
if( g_LibName_List.GetCount() == 0 )
|
if( g_LibName_List.GetCount() == 0 )
|
||||||
|
@ -189,7 +191,6 @@ bool Read_Config( const wxString& CfgFileName, bool ForceRereadConfig )
|
||||||
if( frame )
|
if( frame )
|
||||||
{
|
{
|
||||||
frame->SetDrawBgColor( g_DrawBgColor );
|
frame->SetDrawBgColor( g_DrawBgColor );
|
||||||
frame->m_Draw_Grid = g_ShowGrid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadLibraries( frame );
|
LoadLibraries( frame );
|
||||||
|
@ -202,27 +203,36 @@ bool Read_Config( const wxString& CfgFileName, bool ForceRereadConfig )
|
||||||
void WinEDA_SchematicFrame::Save_Config( wxWindow* displayframe )
|
void WinEDA_SchematicFrame::Save_Config( wxWindow* displayframe )
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
{
|
{
|
||||||
wxString path;
|
wxFileName fn;
|
||||||
wxString FullFileName;
|
|
||||||
wxString mask( wxT( "*" ) );
|
|
||||||
|
|
||||||
mask += g_Prj_Config_Filename_ext;
|
fn = g_RootSheet->m_AssociatedScreen->m_FileName /*ConfigFileName*/;
|
||||||
FullFileName = g_RootSheet->m_AssociatedScreen->m_FileName.AfterLast( '/' ) /*ConfigFileName*/;
|
fn.SetExt( ProjectFileExtension );
|
||||||
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
|
|
||||||
|
|
||||||
path = wxGetCwd();
|
wxFileDialog dlg( this, _( "Save Project Settings" ), wxGetCwd(),
|
||||||
FullFileName = EDA_FileSelector( _( "Save preferences" ),
|
fn.GetFullName(), ProjectFileWildcard,
|
||||||
path, /* Chemin par defaut */
|
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||||
FullFileName, /* nom fichier par defaut */
|
|
||||||
g_Prj_Config_Filename_ext, /* extension par defaut */
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
mask, /* Masque d'affichage */
|
|
||||||
displayframe,
|
|
||||||
wxFD_SAVE,
|
|
||||||
TRUE
|
|
||||||
);
|
|
||||||
if( FullFileName.IsEmpty() )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* ecriture de la configuration */
|
/* ecriture de la configuration */
|
||||||
wxGetApp().WriteProjectConfig( FullFileName, GROUP, ParamCfgList );
|
wxGetApp().WriteProjectConfig( dlg.GetPath(), GROUP, ParamCfgList );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Load the EESchema configuration parameters.
|
||||||
|
*/
|
||||||
|
void WinEDA_SchematicFrame::LoadSettings()
|
||||||
|
{
|
||||||
|
WinEDA_DrawFrame::LoadSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Save the EESchema configuration parameters.
|
||||||
|
*/
|
||||||
|
void WinEDA_SchematicFrame::SaveSettings()
|
||||||
|
{
|
||||||
|
WinEDA_DrawFrame::SaveSettings();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
/** eeconfig.h : configuration: definition des structures **/
|
/** eeconfig.h : configuration: definition des structures **/
|
||||||
/************************************************************/
|
/************************************************************/
|
||||||
|
|
||||||
#ifndef eda_global
|
|
||||||
#define eda_global extern
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "param_config.h"
|
#include "param_config.h"
|
||||||
|
|
||||||
#define GROUP wxT( "/eeschema" )
|
#define GROUP wxT( "/eeschema" )
|
||||||
|
@ -54,24 +50,6 @@ static PARAM_CFG_INT UnitCfg
|
||||||
0, 1 /* Min and Max values for the parameter */
|
0, 1 /* Min and Max values for the parameter */
|
||||||
);
|
);
|
||||||
|
|
||||||
static PARAM_CFG_INT CursorShapeCfg
|
|
||||||
(
|
|
||||||
INSETUP,
|
|
||||||
wxT( "CuShape" ), /* Ident String */
|
|
||||||
&g_CursorShape, /* Parameter address */
|
|
||||||
0, /* Default value */
|
|
||||||
0, 1 /* Min and Max values for the parameter */
|
|
||||||
);
|
|
||||||
|
|
||||||
static PARAM_CFG_INT ShowGridCfg
|
|
||||||
(
|
|
||||||
INSETUP,
|
|
||||||
wxT( "ShGrid" ), /* Ident String */
|
|
||||||
&g_ShowGrid, /* Parameter address */
|
|
||||||
0, 1, /* Min and Max values for the parameter */
|
|
||||||
1 /* Default value */
|
|
||||||
);
|
|
||||||
|
|
||||||
static PARAM_CFG_SETCOLOR DrawBgColorCfg
|
static PARAM_CFG_SETCOLOR DrawBgColorCfg
|
||||||
(
|
(
|
||||||
INSETUP,
|
INSETUP,
|
||||||
|
@ -496,8 +474,6 @@ PARAM_CFG_BASE* ParamCfgList[] =
|
||||||
&NetFormatCfg,
|
&NetFormatCfg,
|
||||||
|
|
||||||
&UnitCfg,
|
&UnitCfg,
|
||||||
&CursorShapeCfg,
|
|
||||||
&ShowGridCfg,
|
|
||||||
&DrawBgColorCfg,
|
&DrawBgColorCfg,
|
||||||
&ColorLayerWireCfg,
|
&ColorLayerWireCfg,
|
||||||
&ColorLayerBusCfg,
|
&ColorLayerBusCfg,
|
||||||
|
|
|
@ -337,12 +337,10 @@ void WinEDA_SetColorsFrame::UpdateLayerSettings()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update whether grid is actually displayed or otherwise
|
// Update whether grid is actually displayed or otherwise
|
||||||
// m_Parent->m_Draw_Grid = g_ShowGrid = m_ShowGrid->GetValue();
|
|
||||||
// The previous command compiles OK, but to prevent a warning
|
// The previous command compiles OK, but to prevent a warning
|
||||||
// from being generated when the Linux version is being compiled,
|
// from being generated when the Linux version is being compiled,
|
||||||
// the next two commands are provided instead.
|
// the next two commands are provided instead.
|
||||||
g_ShowGrid = m_ShowGrid->GetValue();
|
m_Parent->m_Draw_Grid = m_ShowGrid->GetValue();
|
||||||
m_Parent->m_Draw_Grid = g_ShowGrid;
|
|
||||||
|
|
||||||
// Update color of background
|
// Update color of background
|
||||||
if( m_SelBgColor->GetSelection() == 0 )
|
if( m_SelBgColor->GetSelection() == 0 )
|
||||||
|
|
|
@ -14,83 +14,36 @@
|
||||||
#include "trigo.h"
|
#include "trigo.h"
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
//#define DRAW_ARC_WITH_ANGLE // Used to select function to draw arcs
|
//#define DRAW_ARC_WITH_ANGLE // Used to select function to draw arcs
|
||||||
|
|
||||||
|
|
||||||
/* Local functions */
|
/* Local functions */
|
||||||
/* Descr component <DUMMY> used when a component is not found in library,
|
|
||||||
* to draw a dummy shape
|
|
||||||
* This component is a 400 mils square with the text ??
|
|
||||||
* DEF DUMMY U 0 40 Y Y 1 0 N
|
|
||||||
* F0 "U" 0 -350 60 H V
|
|
||||||
* F1 "DUMMY" 0 350 60 H V
|
|
||||||
* DRAW
|
|
||||||
* T 0 0 0 150 0 0 0 ??
|
|
||||||
* S -200 200 200 -200 0 1 0
|
|
||||||
* ENDDRAW
|
|
||||||
* ENDDEF
|
|
||||||
*/
|
|
||||||
static void CreateDummyCmp();
|
|
||||||
static void DrawLibPartAux( WinEDA_DrawPanel * panel, wxDC * DC,
|
|
||||||
SCH_COMPONENT * Component,
|
|
||||||
EDA_LibComponentStruct * Entry,
|
|
||||||
const wxPoint &Pos,
|
|
||||||
const int TransMat[2][2],
|
|
||||||
int Multi, int convert,
|
|
||||||
int DrawMode, int Color = -1, bool DrawPinText = TRUE );
|
|
||||||
|
|
||||||
/* Local variables */
|
|
||||||
static EDA_LibComponentStruct* DummyCmp;
|
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
wxPoint TransformCoordinate( const int aTransformMatrix[2][2], const wxPoint& aPosition )
|
|
||||||
/***************************************************************************/
|
|
||||||
|
|
||||||
/** Function TransformCoordinate
|
/** Function TransformCoordinate
|
||||||
* Calculate the wew coordinate from the old one, according to the transform matrix.
|
* Calculate the wew coordinate from the old one, according to the transform
|
||||||
|
* matrix.
|
||||||
* @param aTransformMatrix = rotation, mirror .. matrix
|
* @param aTransformMatrix = rotation, mirror .. matrix
|
||||||
* @param aPosition = the position to transform
|
* @param aPosition = the position to transform
|
||||||
* @return the new coordinate
|
* @return the new coordinate
|
||||||
*/
|
*/
|
||||||
|
/***************************************************************************/
|
||||||
|
wxPoint TransformCoordinate( const int aTransformMatrix[2][2],
|
||||||
|
const wxPoint& aPosition )
|
||||||
{
|
{
|
||||||
wxPoint new_pos;
|
wxPoint new_pos;
|
||||||
|
|
||||||
new_pos.x = (aTransformMatrix[0][0] * aPosition.x) + (aTransformMatrix[0][1] * aPosition.y);
|
new_pos.x = ( aTransformMatrix[0][0] * aPosition.x ) +
|
||||||
new_pos.y = (aTransformMatrix[1][0] * aPosition.x) + (aTransformMatrix[1][1] * aPosition.y);
|
( aTransformMatrix[0][1] * aPosition.y );
|
||||||
|
new_pos.y = ( aTransformMatrix[1][0] * aPosition.x ) +
|
||||||
|
( aTransformMatrix[1][1] * aPosition.y );
|
||||||
|
|
||||||
return new_pos;
|
return new_pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************/
|
|
||||||
void CreateDummyCmp()
|
|
||||||
/******************************/
|
|
||||||
{
|
|
||||||
DummyCmp = new EDA_LibComponentStruct( NULL );
|
|
||||||
|
|
||||||
LibDrawSquare* Square = new LibDrawSquare();
|
|
||||||
|
|
||||||
Square->m_Pos = wxPoint( -200, 200 );
|
|
||||||
Square->m_End = wxPoint( 200, -200 );
|
|
||||||
Square->m_Width = 4;
|
|
||||||
|
|
||||||
LibDrawText* Text = new LibDrawText();
|
|
||||||
|
|
||||||
Text->m_Size.x = Text->m_Size.y = 150;
|
|
||||||
Text->m_Text = wxT( "??" );
|
|
||||||
|
|
||||||
DummyCmp->m_Drawings = Square;
|
|
||||||
Square->SetNext( Text );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************/
|
|
||||||
void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
|
|
||||||
EDA_LibComponentStruct* LibEntry,
|
|
||||||
const wxPoint & aOffset,
|
|
||||||
int Multi, int convert,
|
|
||||||
int DrawMode, int Color )
|
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
|
|
||||||
/* Routine de dessin d'un composant d'une librairie
|
/* Routine de dessin d'un composant d'une librairie
|
||||||
* LibEntry = pointeur sur la description en librairie
|
* LibEntry = pointeur sur la description en librairie
|
||||||
* posX, posY = position du composant
|
* posX, posY = position du composant
|
||||||
|
@ -101,6 +54,12 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
*
|
*
|
||||||
* Le composant est toujours trace avec orientation 0
|
* Le composant est toujours trace avec orientation 0
|
||||||
*/
|
*/
|
||||||
|
/*************************************************************/
|
||||||
|
void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
|
EDA_LibComponentStruct* LibEntry,
|
||||||
|
const wxPoint& aOffset,
|
||||||
|
int Multi, int convert,
|
||||||
|
int DrawMode, int Color )
|
||||||
{
|
{
|
||||||
int color;
|
int color;
|
||||||
wxString Prefix;
|
wxString Prefix;
|
||||||
|
@ -109,8 +68,8 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
|
|
||||||
|
|
||||||
DrawLibPartAux( panel, DC, NULL, LibEntry, aOffset,
|
DrawLibPartAux( panel, DC, NULL, LibEntry, aOffset,
|
||||||
DefaultTransformMatrix, Multi,
|
DefaultTransformMatrix, Multi,
|
||||||
convert, DrawMode, Color );
|
convert, DrawMode, Color );
|
||||||
|
|
||||||
/* Trace des 2 champs ref et value (Attention aux coord: la matrice
|
/* Trace des 2 champs ref et value (Attention aux coord: la matrice
|
||||||
* de transformation change de signe les coord Y */
|
* de transformation change de signe les coord Y */
|
||||||
|
@ -124,19 +83,25 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
else
|
else
|
||||||
color = g_InvisibleItemColor;
|
color = g_InvisibleItemColor;
|
||||||
}
|
}
|
||||||
else color = Color;
|
else
|
||||||
|
color = Color;
|
||||||
|
|
||||||
if( LibEntry->m_UnitCount > 1 )
|
if( LibEntry->m_UnitCount > 1 )
|
||||||
#if defined(KICAD_GOST)
|
#if defined(KICAD_GOST)
|
||||||
Prefix.Printf( wxT( "%s?.%c" ), LibEntry->m_Prefix.m_Text.GetData(), Multi + '1' - 1);
|
|
||||||
|
Prefix.Printf( wxT( "%s?.%c" ),
|
||||||
|
LibEntry->m_Prefix.m_Text.GetData(), Multi + '1' - 1 );
|
||||||
#else
|
#else
|
||||||
Prefix.Printf( wxT( "%s?%c" ), LibEntry->m_Prefix.m_Text.GetData(), Multi + 'A' - 1 );
|
|
||||||
|
Prefix.Printf( wxT( "%s?%c" ),
|
||||||
|
LibEntry->m_Prefix.m_Text.GetData(), Multi + 'A' - 1 );
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
Prefix = LibEntry->m_Prefix.m_Text + wxT( "?" );
|
Prefix = LibEntry->m_Prefix.m_Text + wxT( "?" );
|
||||||
|
|
||||||
if( (LibEntry->m_Prefix.m_Flags & IS_MOVED) == 0 )
|
if( (LibEntry->m_Prefix.m_Flags & IS_MOVED) == 0 )
|
||||||
LibEntry->m_Prefix.Draw( panel, DC, aOffset, color, DrawMode, &Prefix, DefaultTransformMatrix );
|
LibEntry->m_Prefix.Draw( panel, DC, aOffset, color, DrawMode,
|
||||||
|
&Prefix, DefaultTransformMatrix );
|
||||||
|
|
||||||
if( LibEntry->m_Name.m_Attributs & TEXT_NO_VISIBLE )
|
if( LibEntry->m_Name.m_Attributs & TEXT_NO_VISIBLE )
|
||||||
{
|
{
|
||||||
|
@ -145,10 +110,12 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
else
|
else
|
||||||
color = g_InvisibleItemColor;
|
color = g_InvisibleItemColor;
|
||||||
}
|
}
|
||||||
else color = Color;
|
else
|
||||||
|
color = Color;
|
||||||
|
|
||||||
if( (LibEntry->m_Name.m_Flags & IS_MOVED) == 0 )
|
if( (LibEntry->m_Name.m_Flags & IS_MOVED) == 0 )
|
||||||
LibEntry->m_Name.Draw( panel, DC, aOffset, color, DrawMode, NULL, DefaultTransformMatrix );
|
LibEntry->m_Name.Draw( panel, DC, aOffset, color, DrawMode, NULL,
|
||||||
|
DefaultTransformMatrix );
|
||||||
|
|
||||||
for( Field = LibEntry->m_Fields; Field != NULL; Field = Field->Next() )
|
for( Field = LibEntry->m_Fields; Field != NULL; Field = Field->Next() )
|
||||||
{
|
{
|
||||||
|
@ -163,215 +130,31 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
else
|
else
|
||||||
color = g_InvisibleItemColor;
|
color = g_InvisibleItemColor;
|
||||||
}
|
}
|
||||||
else color = Color;
|
else
|
||||||
Field->Draw( panel, DC, aOffset, color, DrawMode, NULL, DefaultTransformMatrix );
|
color = Color;
|
||||||
|
Field->Draw( panel, DC, aOffset, color, DrawMode, NULL,
|
||||||
|
DefaultTransformMatrix );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trace de l'ancre
|
// Trace de l'ancre
|
||||||
int len = panel->GetScreen()->Unscale( 3 );
|
int len = panel->GetScreen()->Unscale( 3 );
|
||||||
GRLine( &panel->m_ClipBox, DC, aOffset.x, aOffset.y - len, aOffset.x, aOffset.y + len, 0, color );
|
GRLine( &panel->m_ClipBox, DC, aOffset.x, aOffset.y - len, aOffset.x,
|
||||||
GRLine( &panel->m_ClipBox, DC, aOffset.x - len, aOffset.y, aOffset.x + len, aOffset.y, 0, color );
|
aOffset.y + len, 0, color );
|
||||||
}
|
GRLine( &panel->m_ClipBox, DC, aOffset.x - len, aOffset.y, aOffset.x + len,
|
||||||
|
aOffset.y, 0, color );
|
||||||
|
|
||||||
|
/* Enable this to draw the bounding box around the component to validate
|
||||||
/*****************************************************************************
|
* the bounding box calculations. */
|
||||||
* Routine to draw the given part at given position, transformed/mirror as *
|
#if 0
|
||||||
* specified, and in the given drawing mode. Only this one is visible... *
|
EDA_Rect bBox = LibEntry->GetBoundaryBox( Multi, convert );
|
||||||
*****************************************************************************/
|
GRRect( &panel->m_ClipBox, DC, bBox.GetOrigin().x, bBox.GetOrigin().y,
|
||||||
void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA );
|
||||||
const wxPoint& offset, int DrawMode, int Color )
|
|
||||||
{
|
|
||||||
EDA_LibComponentStruct* Entry;
|
|
||||||
int ii;
|
|
||||||
bool dummy = FALSE;
|
|
||||||
|
|
||||||
if( ( Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT ) ) == NULL )
|
|
||||||
{
|
|
||||||
/* composant non trouve, on affiche un composant "dummy" */
|
|
||||||
dummy = TRUE;
|
|
||||||
if( DummyCmp == NULL )
|
|
||||||
CreateDummyCmp();
|
|
||||||
Entry = DummyCmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
DrawLibPartAux( panel, DC, this, Entry, m_Pos + offset,
|
|
||||||
m_Transform,
|
|
||||||
dummy ? 0 : m_Multi,
|
|
||||||
dummy ? 0 : m_Convert,
|
|
||||||
DrawMode );
|
|
||||||
|
|
||||||
/* Trace des champs, avec placement et orientation selon orient. du
|
|
||||||
* composant
|
|
||||||
*/
|
|
||||||
|
|
||||||
SCH_CMP_FIELD* field = GetField( REFERENCE );
|
|
||||||
|
|
||||||
if( ( (field->m_Attributs & TEXT_NO_VISIBLE) == 0 )
|
|
||||||
&& !(field->m_Flags & IS_MOVED) )
|
|
||||||
{
|
|
||||||
if( Entry->m_UnitCount > 1 )
|
|
||||||
{
|
|
||||||
field->m_AddExtraText = true;
|
|
||||||
field->Draw( panel, DC, offset, DrawMode );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
field->m_AddExtraText = false;
|
|
||||||
field->Draw( panel, DC, offset, DrawMode );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for( ii = VALUE; ii < GetFieldCount(); ii++ )
|
|
||||||
{
|
|
||||||
field = GetField( ii );
|
|
||||||
|
|
||||||
if( field->m_Flags & IS_MOVED )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
field->Draw( panel, DC, offset, DrawMode );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************/
|
|
||||||
void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel,
|
|
||||||
wxDC* DC,
|
|
||||||
const wxPoint& offset,
|
|
||||||
int DrawMode,
|
|
||||||
int Color )
|
|
||||||
/***********************************************************/
|
|
||||||
|
|
||||||
/* Routine de trace des textes type Field du composant.
|
|
||||||
* entree:
|
|
||||||
* DrawMode: mode de trace
|
|
||||||
*/
|
|
||||||
{
|
|
||||||
int orient;
|
|
||||||
EDA_Colors color;
|
|
||||||
wxPoint pos; /* Position des textes */
|
|
||||||
SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) m_Parent;
|
|
||||||
GRTextHorizJustifyType hjustify;
|
|
||||||
GRTextVertJustifyType vjustify;
|
|
||||||
int LineWidth = MAX( m_Width, g_DrawMinimunLineWidth );
|
|
||||||
|
|
||||||
if( m_Attributs & TEXT_NO_VISIBLE )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( IsVoid() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
GRSetDrawMode( DC, DrawMode );
|
|
||||||
|
|
||||||
/* Calcul de la position des textes, selon orientation du composant */
|
|
||||||
orient = m_Orient;
|
|
||||||
hjustify = m_HJustify; vjustify = m_VJustify;
|
|
||||||
pos = m_Pos - DrawLibItem->m_Pos;
|
|
||||||
|
|
||||||
pos = DrawLibItem->GetScreenCoord( pos );
|
|
||||||
pos += DrawLibItem->m_Pos;
|
|
||||||
|
|
||||||
/* Y a t-il rotation (pour l'orientation, la justification)*/
|
|
||||||
if( DrawLibItem->m_Transform[0][1] ) // Rotation du composant de 90deg
|
|
||||||
{
|
|
||||||
if( orient == TEXT_ORIENT_HORIZ )
|
|
||||||
orient = TEXT_ORIENT_VERT;
|
|
||||||
else
|
|
||||||
orient = TEXT_ORIENT_HORIZ;
|
|
||||||
/* Y a t-il rotation, miroir (pour les justifications)*/
|
|
||||||
GRTextHorizJustifyType tmp = hjustify;
|
|
||||||
hjustify = (GRTextHorizJustifyType) vjustify;
|
|
||||||
vjustify = (GRTextVertJustifyType) tmp;
|
|
||||||
if( DrawLibItem->m_Transform[1][0] < 0 )
|
|
||||||
switch ( vjustify )
|
|
||||||
{
|
|
||||||
case GR_TEXT_VJUSTIFY_BOTTOM:
|
|
||||||
vjustify = GR_TEXT_VJUSTIFY_TOP;
|
|
||||||
break;
|
|
||||||
case GR_TEXT_VJUSTIFY_TOP:
|
|
||||||
vjustify = GR_TEXT_VJUSTIFY_BOTTOM;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if( DrawLibItem->m_Transform[1][0] > 0 )
|
|
||||||
switch ( hjustify )
|
|
||||||
{
|
|
||||||
case GR_TEXT_HJUSTIFY_LEFT:
|
|
||||||
hjustify = GR_TEXT_HJUSTIFY_RIGHT;
|
|
||||||
break;
|
|
||||||
case GR_TEXT_HJUSTIFY_RIGHT:
|
|
||||||
hjustify = GR_TEXT_HJUSTIFY_LEFT;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Texte horizontal: Y a t-il miroir (pour les justifications)*/
|
|
||||||
if( DrawLibItem->m_Transform[0][0] < 0 )
|
|
||||||
switch ( hjustify )
|
|
||||||
{
|
|
||||||
case GR_TEXT_HJUSTIFY_LEFT:
|
|
||||||
hjustify = GR_TEXT_HJUSTIFY_RIGHT;
|
|
||||||
break;
|
|
||||||
case GR_TEXT_HJUSTIFY_RIGHT:
|
|
||||||
hjustify = GR_TEXT_HJUSTIFY_LEFT;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if( DrawLibItem->m_Transform[1][1] > 0 )
|
|
||||||
switch ( vjustify )
|
|
||||||
{
|
|
||||||
case GR_TEXT_VJUSTIFY_BOTTOM:
|
|
||||||
vjustify = GR_TEXT_VJUSTIFY_TOP;
|
|
||||||
break;
|
|
||||||
case GR_TEXT_VJUSTIFY_TOP:
|
|
||||||
vjustify = GR_TEXT_VJUSTIFY_BOTTOM;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( m_FieldId == REFERENCE )
|
|
||||||
color = ReturnLayerColor( LAYER_REFERENCEPART );
|
|
||||||
else if( m_FieldId == VALUE )
|
|
||||||
color = ReturnLayerColor( LAYER_VALUEPART );
|
|
||||||
else
|
|
||||||
color = ReturnLayerColor( LAYER_FIELDS );
|
|
||||||
|
|
||||||
if( !m_AddExtraText || (m_FieldId != REFERENCE) )
|
|
||||||
{
|
|
||||||
DrawGraphicText( panel, DC, pos, color, m_Text,
|
|
||||||
orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
|
|
||||||
m_Size,
|
|
||||||
hjustify, vjustify, LineWidth, m_Italic );
|
|
||||||
}
|
|
||||||
else // For more than one part per package, we must add the part selection to the reference )
|
|
||||||
{
|
|
||||||
/* Adding A ou B ... or .1 .2 ... to the reference */
|
|
||||||
wxString fulltext = m_Text;
|
|
||||||
#if defined(KICAD_GOST)
|
|
||||||
fulltext.Append( '.');
|
|
||||||
fulltext.Append( '1' - 1 + DrawLibItem->m_Multi );
|
|
||||||
#else
|
|
||||||
fulltext.Append( 'A' - 1 + DrawLibItem->m_Multi );
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DrawGraphicText( panel, DC, pos, color, fulltext,
|
|
||||||
orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
|
|
||||||
m_Size,
|
|
||||||
hjustify, vjustify, LineWidth, m_Italic );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/********************************************************************************/
|
/*****************************************************************************/
|
||||||
EDA_LibComponentStruct* FindLibPart( const wxChar* Name, const wxString& LibName, int Alias )
|
|
||||||
/********************************************************************************/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Routine to find a part in one of the libraries given its name.
|
* Routine to find a part in one of the libraries given its name.
|
||||||
* Name = Name of part.
|
* Name = Name of part.
|
||||||
|
@ -381,10 +164,15 @@ EDA_LibComponentStruct* FindLibPart( const wxChar* Name, const wxString& LibName
|
||||||
* correspond a un alias
|
* correspond a un alias
|
||||||
* Alias = FIND_ROOT, ou Alias = FIND_ALIAS
|
* Alias = FIND_ROOT, ou Alias = FIND_ALIAS
|
||||||
*/
|
*/
|
||||||
|
/*****************************************************************************/
|
||||||
|
EDA_LibComponentStruct* FindLibPart( const wxChar* Name,
|
||||||
|
const wxString& LibName,
|
||||||
|
int Alias )
|
||||||
{
|
{
|
||||||
EDA_LibComponentStruct* Entry;
|
EDA_LibComponentStruct* Entry;
|
||||||
|
|
||||||
static EDA_LibComponentStruct DummyEntry( wxEmptyString ); /* Used only to call PQFind. */
|
/* Used only to call PQFind. */
|
||||||
|
static EDA_LibComponentStruct DummyEntry( wxEmptyString );
|
||||||
|
|
||||||
LibraryStruct* Lib = g_LibraryList;
|
LibraryStruct* Lib = g_LibraryList;
|
||||||
|
|
||||||
|
@ -424,7 +212,8 @@ EDA_LibComponentStruct* FindLibPart( const wxChar* Name, const wxString& LibName
|
||||||
if( Entry )
|
if( Entry )
|
||||||
{
|
{
|
||||||
if( (Entry->Type != ROOT ) && (Alias == FIND_ROOT) )
|
if( (Entry->Type != ROOT ) && (Alias == FIND_ROOT) )
|
||||||
Entry = FindLibPart( ( (EDA_LibCmpAliasStruct*) Entry )->m_RootName.GetData(),
|
Entry = FindLibPart(
|
||||||
|
( (EDA_LibCmpAliasStruct*) Entry )->m_RootName.GetData(),
|
||||||
Lib->m_Name, FIND_ROOT );
|
Lib->m_Name, FIND_ROOT );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -433,104 +222,16 @@ EDA_LibComponentStruct* FindLibPart( const wxChar* Name, const wxString& LibName
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Routine to draw the given part at given position, transformed/mirror as
|
* Routine to rotate the given angular direction by the given Transformation. *
|
||||||
* specified, and in the given drawing mode.
|
* Input (and output) angles must be as follows: *
|
||||||
* if Color < 0: Draw in normal color
|
* Unit is 0.1 degre *
|
||||||
* else draw in color = Color
|
* Angle1 in [0..3600], Angle2 > Angle1 in [0..7200]. Arc is assumed to be *
|
||||||
*****************************************************************************/
|
* less than 180.0 degrees. *
|
||||||
/* DrawMode = GrXOR, GrOR ..*/
|
* Algorithm: *
|
||||||
void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
|
* Map the angles to a point on the unit circle which is mapped using the *
|
||||||
SCH_COMPONENT* Component,
|
* transform (only mirror and rotate so it remains on the unit circle) to *
|
||||||
EDA_LibComponentStruct* Entry,
|
* a new point which is used to detect new angle. *
|
||||||
const wxPoint& Pos,
|
*****************************************************************************/
|
||||||
const int TransMat[2][2],
|
|
||||||
int Multi, int convert, int DrawMode,
|
|
||||||
int Color, bool DrawPinText )
|
|
||||||
{
|
|
||||||
wxPoint pos1, pos2;
|
|
||||||
LibEDA_BaseStruct* DEntry;
|
|
||||||
bool force_nofill;
|
|
||||||
|
|
||||||
if( Entry->m_Drawings == NULL )
|
|
||||||
return;
|
|
||||||
GRSetDrawMode( DC, DrawMode );
|
|
||||||
|
|
||||||
for( DEntry = Entry->m_Drawings; DEntry != NULL; DEntry = DEntry->Next() )
|
|
||||||
{
|
|
||||||
/* Do not draw items not attached to the current part */
|
|
||||||
if( Multi && DEntry->m_Unit && (DEntry->m_Unit != Multi) )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if( convert && DEntry->m_Convert && (DEntry->m_Convert != convert) )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if( DEntry->m_Flags & IS_MOVED )
|
|
||||||
continue; // Do do draw here an item while moving (the cursor handler does that)
|
|
||||||
|
|
||||||
force_nofill = false;
|
|
||||||
|
|
||||||
switch( DEntry->Type() )
|
|
||||||
{
|
|
||||||
case COMPONENT_PIN_DRAW_TYPE:
|
|
||||||
{
|
|
||||||
DrawPinPrms prms( Entry, DrawPinText );
|
|
||||||
DEntry->Draw( panel, DC, Pos, Color, DrawMode, &prms, TransMat );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case COMPONENT_ARC_DRAW_TYPE:
|
|
||||||
case COMPONENT_CIRCLE_DRAW_TYPE:
|
|
||||||
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
|
||||||
case COMPONENT_RECT_DRAW_TYPE:
|
|
||||||
case COMPONENT_POLYLINE_DRAW_TYPE:
|
|
||||||
default:
|
|
||||||
if( g_IsPrinting && DEntry->m_Fill == FILLED_WITH_BG_BODYCOLOR
|
|
||||||
&& GetGRForceBlackPenState() )
|
|
||||||
force_nofill = true;
|
|
||||||
DEntry->Draw( panel, DC, Pos, Color, DrawMode, (void*) force_nofill, TransMat );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( g_DebugLevel > 4 ) /* Draw the component boundary box */
|
|
||||||
{
|
|
||||||
EDA_Rect BoundaryBox;
|
|
||||||
if( Component )
|
|
||||||
BoundaryBox = Component->GetBoundaryBox();
|
|
||||||
else
|
|
||||||
BoundaryBox = Entry->GetBoundaryBox( Multi, convert );
|
|
||||||
int x1 = BoundaryBox.GetX();
|
|
||||||
int y1 = BoundaryBox.GetY();
|
|
||||||
int x2 = BoundaryBox.GetRight();
|
|
||||||
int y2 = BoundaryBox.GetBottom();
|
|
||||||
GRRect( &panel->m_ClipBox, DC, x1, y1, x2, y2, BROWN );
|
|
||||||
BoundaryBox = Component->GetField( REFERENCE )->GetBoundaryBox();
|
|
||||||
x1 = BoundaryBox.GetX();
|
|
||||||
y1 = BoundaryBox.GetY();
|
|
||||||
x2 = BoundaryBox.GetRight();
|
|
||||||
y2 = BoundaryBox.GetBottom();
|
|
||||||
GRRect( &panel->m_ClipBox, DC, x1, y1, x2, y2, BROWN );
|
|
||||||
BoundaryBox = Component->GetField( VALUE )->GetBoundaryBox();
|
|
||||||
x1 = BoundaryBox.GetX();
|
|
||||||
y1 = BoundaryBox.GetY();
|
|
||||||
x2 = BoundaryBox.GetRight();
|
|
||||||
y2 = BoundaryBox.GetBottom();
|
|
||||||
GRRect( &panel->m_ClipBox, DC, x1, y1, x2, y2, BROWN );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* Routine to rotate the given angular direction by the given Transformation. *
|
|
||||||
* Input (and output) angles must be as follows: *
|
|
||||||
* Unit is 0.1 degre *
|
|
||||||
* Angle1 in [0..3600], Angle2 > Angle1 in [0..7200]. Arc is assumed to be less *
|
|
||||||
* than 180.0 degrees. *
|
|
||||||
* Algorithm: *
|
|
||||||
* Map the angles to a point on the unit circle which is mapped using the *
|
|
||||||
* transform (only mirror and rotate so it remains on the unit circle) to *
|
|
||||||
* a new point which is used to detect new angle. *
|
|
||||||
*****************************************************************************/
|
|
||||||
bool MapAngles( int* Angle1, int* Angle2, const int TransMat[2][2] )
|
bool MapAngles( int* Angle1, int* Angle2, const int TransMat[2][2] )
|
||||||
{
|
{
|
||||||
int Angle, Delta;
|
int Angle, Delta;
|
||||||
|
@ -549,22 +250,22 @@ bool MapAngles( int* Angle1, int* Angle2, const int TransMat[2][2] )
|
||||||
t = x * TransMat[0][0] + y * TransMat[0][1];
|
t = x * TransMat[0][0] + y * TransMat[0][1];
|
||||||
y = x * TransMat[1][0] + y * TransMat[1][1];
|
y = x * TransMat[1][0] + y * TransMat[1][1];
|
||||||
x = t;
|
x = t;
|
||||||
*Angle1 = (int) (atan2( y, x ) * 1800.0 / M_PI + 0.5);
|
*Angle1 = (int) ( atan2( y, x ) * 1800.0 / M_PI + 0.5 );
|
||||||
|
|
||||||
x = cos( *Angle2 * M_PI / 1800.0 );
|
x = cos( *Angle2 * M_PI / 1800.0 );
|
||||||
y = sin( *Angle2 * M_PI / 1800.0 );
|
y = sin( *Angle2 * M_PI / 1800.0 );
|
||||||
t = x * TransMat[0][0] + y * TransMat[0][1];
|
t = x * TransMat[0][0] + y * TransMat[0][1];
|
||||||
y = x * TransMat[1][0] + y * TransMat[1][1];
|
y = x * TransMat[1][0] + y * TransMat[1][1];
|
||||||
x = t;
|
x = t;
|
||||||
*Angle2 = (int) (atan2( y, x ) * 1800.0 / M_PI + 0.5);
|
*Angle2 = (int) ( atan2( y, x ) * 1800.0 / M_PI + 0.5 );
|
||||||
|
|
||||||
NORMALIZE_ANGLE( *Angle1 );
|
NORMALIZE_ANGLE( *Angle1 );
|
||||||
NORMALIZE_ANGLE( *Angle2 );
|
NORMALIZE_ANGLE( *Angle2 );
|
||||||
if( *Angle2 < *Angle1 )
|
if( *Angle2 < *Angle1 )
|
||||||
*Angle2 += 3600;
|
*Angle2 += 3600;
|
||||||
|
|
||||||
if( *Angle2 - *Angle1 > 1800 )
|
if( *Angle2 - *Angle1 > 1800 ) /* Need to swap the two angles. */
|
||||||
{ /* Need to swap the two angles. */
|
{
|
||||||
Angle = (*Angle1);
|
Angle = (*Angle1);
|
||||||
*Angle1 = (*Angle2);
|
*Angle1 = (*Angle2);
|
||||||
*Angle2 = Angle;
|
*Angle2 = Angle;
|
||||||
|
@ -587,8 +288,8 @@ bool MapAngles( int* Angle1, int* Angle2, const int TransMat[2][2] )
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Routine to display an outline version of given library entry. *
|
* Routine to display an outline version of given library entry. *
|
||||||
* This routine is applied by the PlaceLibItem routine above. *
|
* This routine is applied by the PlaceLibItem routine above. *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
void DrawingLibInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
|
void DrawingLibInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
EDA_LibComponentStruct* LibEntry,
|
EDA_LibComponentStruct* LibEntry,
|
||||||
|
@ -598,25 +299,25 @@ void DrawingLibInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
int DrawMode = g_XorMode;
|
int DrawMode = g_XorMode;
|
||||||
|
|
||||||
DrawLibPartAux( panel, DC, DrawLibItem, LibEntry, wxPoint( PartX, PartY ),
|
DrawLibPartAux( panel, DC, DrawLibItem, LibEntry, wxPoint( PartX, PartY ),
|
||||||
DrawLibItem->m_Transform,
|
DrawLibItem->m_Transform, multi, convert, DrawMode, Color,
|
||||||
multi, convert, DrawMode, Color, DrawPinText );
|
DrawPinText );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************/
|
/************************************************************/
|
||||||
/* Routine to draw One LibraryDrawStruct at given position, */
|
/* Routine to draw One LibraryDrawStruct at given position, */
|
||||||
/* matrice de transformation 1 0 0 -1 (normale) */
|
/* matrice de transformation 1 0 0 -1 (normale) */
|
||||||
/* DrawMode = GrXOR, GrOR .. */
|
/* DrawMode = GrXOR, GrOR .. */
|
||||||
/************************************************************/
|
/************************************************************/
|
||||||
/* Utilise en LibEdit et Lib Browse */
|
/* Utilise en LibEdit et Lib Browse */
|
||||||
void DrawLibraryDrawStruct( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
void DrawLibraryDrawStruct( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
EDA_LibComponentStruct* aLibEntry,
|
EDA_LibComponentStruct* aLibEntry,
|
||||||
wxPoint aPosition,
|
wxPoint aPosition, LibEDA_BaseStruct* aDrawItem,
|
||||||
LibEDA_BaseStruct* aDrawItem,
|
|
||||||
int aDrawMode, int aColor )
|
int aDrawMode, int aColor )
|
||||||
{
|
{
|
||||||
int TransMat[2][2];
|
int TransMat[2][2];
|
||||||
bool no_fill;
|
bool no_fill;
|
||||||
|
BASE_SCREEN* screen = aPanel->GetScreen();
|
||||||
|
|
||||||
GRSetDrawMode( aDC, aDrawMode );
|
GRSetDrawMode( aDC, aDrawMode );
|
||||||
|
|
||||||
|
@ -631,9 +332,10 @@ void DrawLibraryDrawStruct( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
case COMPONENT_PIN_DRAW_TYPE: /* Trace des Pins */
|
case COMPONENT_PIN_DRAW_TYPE: /* Trace des Pins */
|
||||||
{
|
{
|
||||||
DrawPinPrms prms( aLibEntry, true );
|
DrawPinPrms prms( aLibEntry, true );
|
||||||
aDrawItem->Draw( aPanel, aDC, aPosition, aColor, aDrawMode, &prms, TransMat );
|
aDrawItem->Draw( aPanel, aDC, aPosition, aColor, aDrawMode, &prms,
|
||||||
|
TransMat );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COMPONENT_ARC_DRAW_TYPE:
|
case COMPONENT_ARC_DRAW_TYPE:
|
||||||
case COMPONENT_CIRCLE_DRAW_TYPE:
|
case COMPONENT_CIRCLE_DRAW_TYPE:
|
||||||
|
@ -641,10 +343,12 @@ void DrawLibraryDrawStruct( WinEDA_DrawPanel* aPanel, wxDC* aDC,
|
||||||
case COMPONENT_RECT_DRAW_TYPE:
|
case COMPONENT_RECT_DRAW_TYPE:
|
||||||
case COMPONENT_POLYLINE_DRAW_TYPE:
|
case COMPONENT_POLYLINE_DRAW_TYPE:
|
||||||
default:
|
default:
|
||||||
if( g_IsPrinting && aDrawItem->m_Fill == FILLED_WITH_BG_BODYCOLOR
|
if( screen->m_IsPrinting
|
||||||
&& GetGRForceBlackPenState() )
|
&& aDrawItem->m_Fill == FILLED_WITH_BG_BODYCOLOR
|
||||||
|
&& GetGRForceBlackPenState() )
|
||||||
no_fill = true;
|
no_fill = true;
|
||||||
aDrawItem->Draw( aPanel, aDC, aPosition, aColor, aDrawMode, (void*) no_fill, TransMat );
|
aDrawItem->Draw( aPanel, aDC, aPosition, aColor, aDrawMode,
|
||||||
|
(void*) no_fill, TransMat );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -7,6 +7,8 @@
|
||||||
#include "gr_basic.h"
|
#include "gr_basic.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "class_drawpanel.h"
|
#include "class_drawpanel.h"
|
||||||
|
#include "class_drawpickedstruct.h"
|
||||||
|
#include "appl_wxstruct.h"
|
||||||
|
|
||||||
#include "program.h"
|
#include "program.h"
|
||||||
#include "libcmp.h"
|
#include "libcmp.h"
|
||||||
|
@ -14,47 +16,18 @@
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
|
|
||||||
char marq_bitmap[] =
|
extern char marq_bitmap[];
|
||||||
{
|
|
||||||
12, 12, 0, 0, /* Dimensions x et y, offsets x et y du bitmap de marqueurs*/
|
|
||||||
YELLOW, /* Couleur */
|
|
||||||
1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, /* bitmap: >= 1 : color, 0 = notrace */
|
|
||||||
1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0,
|
|
||||||
1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0,
|
|
||||||
1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0,
|
|
||||||
1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0,
|
|
||||||
1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0
|
|
||||||
};
|
|
||||||
|
|
||||||
char marqERC_bitmap[] =
|
|
||||||
{
|
|
||||||
8, 8, 0, 0, /* Dimensions x et y , offsets x et y du bitmap de marqueurs*/
|
|
||||||
-1, /* Color: -1 = couleur non pr<70>cis<69>e */
|
|
||||||
1, 1, 1, 1, 1, 0, 0, 0,
|
|
||||||
1, 1, 1, 0, 1, 0, 0, 0,
|
|
||||||
1, 1, 1, 1, 0, 0, 0, 0,
|
|
||||||
1, 0, 1, 1, 1, 0, 0, 0,
|
|
||||||
1, 1, 0, 1, 1, 1, 0, 0,
|
|
||||||
0, 0, 0, 0, 1, 1, 1, 0,
|
|
||||||
0, 0, 0, 0, 0, 1, 1, 1,
|
|
||||||
0, 0, 0, 0, 0, 0, 1, 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static EDA_BaseStruct* HighLightStruct = NULL;
|
static EDA_BaseStruct* HighLightStruct = NULL;
|
||||||
|
|
||||||
/************************************************************/
|
|
||||||
void DrawDanglingSymbol( WinEDA_DrawPanel* panel, wxDC* DC,
|
void DrawDanglingSymbol( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
const wxPoint& pos, int Color )
|
const wxPoint& pos, int Color )
|
||||||
/************************************************************/
|
|
||||||
{
|
{
|
||||||
if( !g_IsPrinting ) // Draw but do not print the Dangling Symbol */
|
BASE_SCREEN* screen = panel->GetScreen();
|
||||||
|
|
||||||
|
if( !screen->m_IsPrinting ) /* Draw but do not print the Dangling Symbol */
|
||||||
{
|
{
|
||||||
GRRect( &panel->m_ClipBox, DC,
|
GRRect( &panel->m_ClipBox, DC,
|
||||||
pos.x - DANGLING_SYMBOL_SIZE, pos.y - DANGLING_SYMBOL_SIZE,
|
pos.x - DANGLING_SYMBOL_SIZE, pos.y - DANGLING_SYMBOL_SIZE,
|
||||||
|
@ -64,21 +37,16 @@ void DrawDanglingSymbol( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************/
|
|
||||||
void SetHighLightStruct( EDA_BaseStruct* HighLight )
|
void SetHighLightStruct( EDA_BaseStruct* HighLight )
|
||||||
/*************************************************/
|
|
||||||
{
|
{
|
||||||
HighLightStruct = HighLight;
|
HighLightStruct = HighLight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************/
|
|
||||||
void WinEDA_SchematicFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
|
||||||
/**********************************************************************/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Redraws only the active window which is assumed to be whole visible.
|
* Redraws only the active window which is assumed to be whole visible.
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_SchematicFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
||||||
{
|
{
|
||||||
wxString title;
|
wxString title;
|
||||||
|
|
||||||
|
@ -104,7 +72,8 @@ void WinEDA_SchematicFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
||||||
|
|
||||||
DrawPanel->DrawBackGround( DC );
|
DrawPanel->DrawBackGround( DC );
|
||||||
|
|
||||||
RedrawStructList( DrawPanel, DC, GetScreen()->EEDrawList, GR_DEFAULT_DRAWMODE );
|
RedrawStructList( DrawPanel, DC, GetScreen()->EEDrawList,
|
||||||
|
GR_DEFAULT_DRAWMODE );
|
||||||
|
|
||||||
TraceWorkSheet( DC, GetScreen(), g_DrawMinimunLineWidth );
|
TraceWorkSheet( DC, GetScreen(), g_DrawMinimunLineWidth );
|
||||||
|
|
||||||
|
@ -114,14 +83,15 @@ void WinEDA_SchematicFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
||||||
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
||||||
}
|
}
|
||||||
|
|
||||||
Affiche_Status_Box();
|
UpdateStatusBar();
|
||||||
GetScreen()->ClrRefreshReq();
|
GetScreen()->ClrRefreshReq();
|
||||||
|
|
||||||
// Display the sheet filename, and the sheet path, for non root sheets
|
// Display the sheet filename, and the sheet path, for non root sheets
|
||||||
if( GetScreen()->m_FileName == g_DefaultSchematicFileName ) // This is the root sheet
|
if( GetScreen()->m_FileName == g_DefaultSchematicFileName )
|
||||||
{
|
{
|
||||||
wxString msg = g_Main_Title + wxT( " " ) + GetBuildVersion();
|
wxString msg = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
|
||||||
title.Printf( wxT( "%s [%s]" ), msg.GetData(), GetScreen()->m_FileName.GetData() );
|
title.Printf( wxT( "%s [%s]" ), msg.GetData(),
|
||||||
|
GetScreen()->m_FileName.GetData() );
|
||||||
SetTitle( title );
|
SetTitle( title );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -134,14 +104,8 @@ void WinEDA_SchematicFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************************************/
|
/**
|
||||||
void WinEDA_DrawPanel::PrintPage( wxDC* DC,
|
* PrintPage
|
||||||
bool Print_Sheet_Ref,
|
|
||||||
int PrintMask,
|
|
||||||
bool aPrintMirrorMode )
|
|
||||||
/******************************************************************************************************/
|
|
||||||
|
|
||||||
/** PrintPage
|
|
||||||
* used to print a page.
|
* used to print a page.
|
||||||
* Print the page pointed by ActiveScreen, set by the calling print function
|
* Print the page pointed by ActiveScreen, set by the calling print function
|
||||||
* @param DC = wxDC given by the calling print function
|
* @param DC = wxDC given by the calling print function
|
||||||
|
@ -149,6 +113,8 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC,
|
||||||
* @param PrintMask = not used here
|
* @param PrintMask = not used here
|
||||||
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
|
* @param aPrintMirrorMode = not used here (Set when printing in mirror mode)
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref,
|
||||||
|
int PrintMask, bool aPrintMirrorMode )
|
||||||
{
|
{
|
||||||
wxBeginBusyCursor();
|
wxBeginBusyCursor();
|
||||||
|
|
||||||
|
@ -172,7 +138,8 @@ void RedrawStructList( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
{
|
{
|
||||||
if( Structs->Type() == DRAW_PICK_ITEM_STRUCT_TYPE )
|
if( Structs->Type() == DRAW_PICK_ITEM_STRUCT_TYPE )
|
||||||
{
|
{
|
||||||
SCH_ITEM* item = ( (DrawPickedStruct*) Structs )->m_PickedStruct;
|
SCH_ITEM* item =
|
||||||
|
(SCH_ITEM*) ( (DrawPickedStruct*) Structs )->m_PickedStruct;
|
||||||
|
|
||||||
// uncomment line below when there is a virtual EDA_BaseStruct::GetBoundingBox()
|
// uncomment line below when there is a virtual EDA_BaseStruct::GetBoundingBox()
|
||||||
// if( panel->m_ClipBox.Intersects( item->GetBoundingBox() ) )
|
// if( panel->m_ClipBox.Intersects( item->GetBoundingBox() ) )
|
||||||
|
@ -211,189 +178,14 @@ void RedrawOneStruct( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
|
||||||
/* Draw wires, Bus, and dashed liges.. */
|
|
||||||
/****************************************************************************/
|
|
||||||
void EDA_DrawLineStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
|
||||||
const wxPoint& offset, int DrawMode, int Color )
|
|
||||||
{
|
|
||||||
int color;
|
|
||||||
int width = m_Width;
|
|
||||||
|
|
||||||
if( Color >= 0 )
|
|
||||||
color = Color;
|
|
||||||
else
|
|
||||||
color = ReturnLayerColor( m_Layer );
|
|
||||||
|
|
||||||
GRSetDrawMode( DC, DrawMode );
|
|
||||||
|
|
||||||
// Busses are draw with thick lines
|
|
||||||
if( m_Layer == LAYER_BUS )
|
|
||||||
width = MAX( m_Width, MIN_BUSLINES_THICKNESS );
|
|
||||||
|
|
||||||
width = MAX( width, g_DrawMinimunLineWidth );
|
|
||||||
|
|
||||||
if( m_Layer == LAYER_NOTES )
|
|
||||||
GRDashedLine( &panel->m_ClipBox, DC, m_Start.x + offset.x,
|
|
||||||
m_Start.y + offset.y, m_End.x + offset.x,
|
|
||||||
m_End.y + offset.y, width, color );
|
|
||||||
else
|
|
||||||
GRLine( &panel->m_ClipBox, DC, m_Start.x + offset.x,
|
|
||||||
m_Start.y + offset.y, m_End.x + offset.x, m_End.y + offset.y,
|
|
||||||
width, color );
|
|
||||||
|
|
||||||
if( m_StartIsDangling )
|
|
||||||
DrawDanglingSymbol( panel, DC, m_Start + offset, color );
|
|
||||||
|
|
||||||
if( m_EndIsDangling )
|
|
||||||
DrawDanglingSymbol( panel, DC, m_End + offset, color );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************************/
|
|
||||||
void DrawMarkerStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
|
||||||
int DrawMode, int Color )
|
|
||||||
/****************************************************************************************/
|
|
||||||
{
|
|
||||||
#define WAR 1 // utilis<69> aussi dans erc.cpp
|
|
||||||
|
|
||||||
if( m_Type == MARQ_ERC )
|
|
||||||
{
|
|
||||||
int color = Color;
|
|
||||||
if( Color <= 0 )
|
|
||||||
{
|
|
||||||
color = (m_MarkFlags == WAR ) ?
|
|
||||||
g_LayerDescr.LayerColor[LAYER_ERC_WARN] :
|
|
||||||
g_LayerDescr.LayerColor[LAYER_ERC_ERR];
|
|
||||||
}
|
|
||||||
Draw_Marqueur( panel, DC, m_Pos + offset, marqERC_bitmap, DrawMode, color );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Draw_Marqueur( panel, DC, m_Pos + offset, marq_bitmap, DrawMode, Color );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
void DrawNoConnectStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
|
||||||
int DrawMode, int Color )
|
|
||||||
/*************************************************************************/
|
|
||||||
/* DRaw the "No Connect" symbol.. */
|
|
||||||
{
|
|
||||||
const int DELTA = (DRAWNOCONNECT_SIZE / 2);
|
|
||||||
int pX, pY, color;
|
|
||||||
int width = g_DrawMinimunLineWidth;
|
|
||||||
|
|
||||||
pX = m_Pos.x + offset.x; pY = m_Pos.y + offset.y;
|
|
||||||
|
|
||||||
if( Color >= 0 )
|
|
||||||
color = Color;
|
|
||||||
else
|
|
||||||
color = ReturnLayerColor( LAYER_NOCONNECT );
|
|
||||||
GRSetDrawMode( DC, DrawMode );
|
|
||||||
|
|
||||||
GRLine( &panel->m_ClipBox, DC, pX - DELTA, pY - DELTA, pX + DELTA, pY + DELTA, width, color );
|
|
||||||
GRLine( &panel->m_ClipBox, DC, pX + DELTA, pY - DELTA, pX - DELTA, pY + DELTA, width, color );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************/
|
|
||||||
void DrawBusEntryStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
|
||||||
int DrawMode, int Color )
|
|
||||||
/***************************************************************/
|
|
||||||
|
|
||||||
/* Draw the bus entries .. */
|
|
||||||
|
|
||||||
{
|
|
||||||
int color;
|
|
||||||
int width = m_Width;
|
|
||||||
|
|
||||||
if( Color >= 0 )
|
|
||||||
color = Color;
|
|
||||||
else
|
|
||||||
color = ReturnLayerColor( m_Layer );
|
|
||||||
GRSetDrawMode( DC, DrawMode );
|
|
||||||
|
|
||||||
if( m_Layer == LAYER_BUS )
|
|
||||||
width = MAX( m_Width, MIN_BUSLINES_THICKNESS );
|
|
||||||
|
|
||||||
width = MAX( width, g_DrawMinimunLineWidth );
|
|
||||||
|
|
||||||
GRLine( &panel->m_ClipBox, DC, m_Pos.x + offset.x, m_Pos.y + offset.y,
|
|
||||||
m_End().x + offset.x, m_End().y + offset.y, width, color );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* Routine to redraw polyline struct. *
|
|
||||||
*****************************************************************************/
|
|
||||||
void DrawPolylineStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
|
||||||
int DrawMode, int Color )
|
|
||||||
{
|
|
||||||
int color;
|
|
||||||
int width = m_Width;
|
|
||||||
|
|
||||||
if( Color >= 0 )
|
|
||||||
color = Color;
|
|
||||||
else
|
|
||||||
color = ReturnLayerColor( m_Layer );
|
|
||||||
|
|
||||||
GRSetDrawMode( DC, DrawMode );
|
|
||||||
|
|
||||||
if( m_Layer == LAYER_BUS )
|
|
||||||
width = MAX( m_Width, MIN_BUSLINES_THICKNESS );
|
|
||||||
|
|
||||||
width = MAX( width, g_DrawMinimunLineWidth );
|
|
||||||
|
|
||||||
GRMoveTo( m_PolyPoints[0].x, m_PolyPoints[0].y );
|
|
||||||
if( m_Layer == LAYER_NOTES )
|
|
||||||
{
|
|
||||||
for( unsigned i = 1; i < GetCornerCount(); i++ )
|
|
||||||
GRDashedLineTo( &panel->m_ClipBox, DC, m_PolyPoints[i].x + offset.x,
|
|
||||||
m_PolyPoints[i].y + offset.y, width, color );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for( unsigned i = 1; i < GetCornerCount(); i++ )
|
|
||||||
GRLineTo( &panel->m_ClipBox,
|
|
||||||
DC,
|
|
||||||
m_PolyPoints[i].x + offset.x,
|
|
||||||
m_PolyPoints[i].y + offset.y,
|
|
||||||
width,
|
|
||||||
color );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
* Routine to redraw connection struct. *
|
|
||||||
*****************************************************************************/
|
|
||||||
void DrawJunctionStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
|
|
||||||
int DrawMode, int Color )
|
|
||||||
{
|
|
||||||
int color;
|
|
||||||
|
|
||||||
if( Color >= 0 )
|
|
||||||
color = Color;
|
|
||||||
else
|
|
||||||
color = ReturnLayerColor( m_Layer );
|
|
||||||
GRSetDrawMode( DC, DrawMode );
|
|
||||||
|
|
||||||
GRFilledCircle( &panel->m_ClipBox, DC, m_Pos.x + offset.x, m_Pos.y + offset.y,
|
|
||||||
DRAWJUNCTION_SIZE, 0, color, color );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************/
|
|
||||||
void DrawStructsInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
|
|
||||||
SCH_ITEM* DrawStruct, int dx, int dy )
|
|
||||||
/**********************************************************/
|
|
||||||
|
|
||||||
/* Routine de redessin en mode fantome (Dessin simplifie en g_XorMode et
|
/* Routine de redessin en mode fantome (Dessin simplifie en g_XorMode et
|
||||||
* g_GhostColor
|
* g_GhostColor
|
||||||
* de structures.
|
* de structures.
|
||||||
* Utilisee dans les deplacements de blocs
|
* Utilisee dans les deplacements de blocs
|
||||||
*/
|
*/
|
||||||
|
void DrawStructsInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
|
SCH_ITEM* DrawStruct, int dx, int dy )
|
||||||
{
|
{
|
||||||
int DrawMode = g_XorMode;
|
int DrawMode = g_XorMode;
|
||||||
int width = g_DrawMinimunLineWidth;
|
int width = g_DrawMinimunLineWidth;
|
||||||
|
@ -406,7 +198,8 @@ void DrawStructsInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
case DRAW_POLYLINE_STRUCT_TYPE:
|
case DRAW_POLYLINE_STRUCT_TYPE:
|
||||||
{
|
{
|
||||||
DrawPolylineStruct* Struct = (DrawPolylineStruct*) DrawStruct;
|
DrawPolylineStruct* Struct = (DrawPolylineStruct*) DrawStruct;
|
||||||
GRMoveTo( Struct->m_PolyPoints[0].x + dx, Struct->m_PolyPoints[0].y + dy );
|
GRMoveTo( Struct->m_PolyPoints[0].x + dx,
|
||||||
|
Struct->m_PolyPoints[0].y + dy );
|
||||||
for( unsigned ii = 1; ii < Struct->GetCornerCount(); ii++ )
|
for( unsigned ii = 1; ii < Struct->GetCornerCount(); ii++ )
|
||||||
GRLineTo( &panel->m_ClipBox, DC, Struct->m_PolyPoints[ii].x + dx,
|
GRLineTo( &panel->m_ClipBox, DC, Struct->m_PolyPoints[ii].x + dx,
|
||||||
Struct->m_PolyPoints[ii].y + dy, width, g_GhostColor );
|
Struct->m_PolyPoints[ii].y + dy, width, g_GhostColor );
|
||||||
|
@ -428,16 +221,13 @@ void DrawStructsInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
}
|
}
|
||||||
if( (Struct->m_Flags & ENDPOINT) == 0 )
|
if( (Struct->m_Flags & ENDPOINT) == 0 )
|
||||||
{
|
{
|
||||||
GRLineTo( &panel->m_ClipBox,
|
GRLineTo( &panel->m_ClipBox, DC, Struct->m_End.x + dx,
|
||||||
DC,
|
Struct->m_End.y + dy, width, g_GhostColor );
|
||||||
Struct->m_End.x + dx,
|
|
||||||
Struct->m_End.y + dy,
|
|
||||||
width,
|
|
||||||
g_GhostColor );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GRLineTo( &panel->m_ClipBox, DC, Struct->m_End.x, Struct->m_End.y, width, g_GhostColor );
|
GRLineTo( &panel->m_ClipBox, DC, Struct->m_End.x,
|
||||||
|
Struct->m_End.y, width, g_GhostColor );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -447,12 +237,8 @@ void DrawStructsInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
DrawBusEntryStruct* Struct = (DrawBusEntryStruct*) DrawStruct;
|
DrawBusEntryStruct* Struct = (DrawBusEntryStruct*) DrawStruct;
|
||||||
int xx = Struct->m_Pos.x + dx, yy = Struct->m_Pos.y + dy;
|
int xx = Struct->m_Pos.x + dx, yy = Struct->m_Pos.y + dy;
|
||||||
GRMoveTo( xx, yy );
|
GRMoveTo( xx, yy );
|
||||||
GRLineTo( &panel->m_ClipBox,
|
GRLineTo( &panel->m_ClipBox, DC, Struct->m_Size.x + xx,
|
||||||
DC,
|
Struct->m_Size.y + yy, width, g_GhostColor );
|
||||||
Struct->m_Size.x + xx,
|
|
||||||
Struct->m_Size.y + yy,
|
|
||||||
width,
|
|
||||||
g_GhostColor );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -495,21 +281,21 @@ void DrawStructsInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
EDA_LibComponentStruct* LibEntry;
|
EDA_LibComponentStruct* LibEntry;
|
||||||
SCH_COMPONENT* Struct;
|
SCH_COMPONENT* Struct;
|
||||||
Struct = (SCH_COMPONENT*) DrawStruct;
|
Struct = (SCH_COMPONENT*) DrawStruct;
|
||||||
LibEntry = FindLibPart( Struct->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
|
LibEntry = FindLibPart( Struct->m_ChipName.GetData(), wxEmptyString,
|
||||||
|
FIND_ROOT );
|
||||||
if( LibEntry == NULL )
|
if( LibEntry == NULL )
|
||||||
break;
|
break;
|
||||||
DrawingLibInGhost( panel, DC, LibEntry, Struct, Struct->m_Pos.x + dx,
|
DrawingLibInGhost( panel, DC, LibEntry, Struct, Struct->m_Pos.x + dx,
|
||||||
Struct->m_Pos.y + dy,
|
Struct->m_Pos.y + dy, Struct->m_Multi,
|
||||||
Struct->m_Multi, Struct->m_Convert,
|
Struct->m_Convert, g_GhostColor, FALSE );
|
||||||
g_GhostColor, FALSE );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case DRAW_SHEET_STRUCT_TYPE:
|
case DRAW_SHEET_STRUCT_TYPE:
|
||||||
{
|
{
|
||||||
DrawSheetStruct* Struct = (DrawSheetStruct*) DrawStruct;
|
DrawSheetStruct* Struct = (DrawSheetStruct*) DrawStruct;
|
||||||
GRRect( &panel->m_ClipBox, DC, Struct->m_Pos.x + dx, Struct->m_Pos.y + dy,
|
GRRect( &panel->m_ClipBox, DC, Struct->m_Pos.x + dx,
|
||||||
Struct->m_Pos.x + Struct->m_Size.x + dx,
|
Struct->m_Pos.y + dy, Struct->m_Pos.x + Struct->m_Size.x + dx,
|
||||||
Struct->m_Pos.y + Struct->m_Size.y + dy, width, g_GhostColor );
|
Struct->m_Pos.y + Struct->m_Size.y + dy, width, g_GhostColor );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -524,10 +310,6 @@ void DrawStructsInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************/
|
|
||||||
void Draw_Marqueur( WinEDA_DrawPanel* panel, wxDC* DC,
|
|
||||||
wxPoint pos, char* pt_bitmap, int DrawMode, int Color )
|
|
||||||
/************************************************************/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Place un repere sur l'ecran au point de coordonnees PCB pos_X, pos_Y
|
* Place un repere sur l'ecran au point de coordonnees PCB pos_X, pos_Y
|
||||||
|
@ -538,6 +320,8 @@ void Draw_Marqueur( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
*
|
*
|
||||||
* copie la description du marqueur en current_marqueur (global)
|
* copie la description du marqueur en current_marqueur (global)
|
||||||
*/
|
*/
|
||||||
|
void Draw_Marqueur( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
|
wxPoint pos, char* pt_bitmap, int DrawMode, int Color )
|
||||||
{
|
{
|
||||||
int px, py, color;
|
int px, py, color;
|
||||||
char ii, ii_max, jj, jj_max;
|
char ii, ii_max, jj, jj_max;
|
||||||
|
@ -545,13 +329,16 @@ void Draw_Marqueur( WinEDA_DrawPanel* panel, wxDC* DC,
|
||||||
if( pt_bitmap == NULL )
|
if( pt_bitmap == NULL )
|
||||||
pt_bitmap = marq_bitmap;
|
pt_bitmap = marq_bitmap;
|
||||||
|
|
||||||
px = GRMapX( pos.x ); py = GRMapY( pos.y );
|
px = GRMapX( pos.x );
|
||||||
|
py = GRMapY( pos.y );
|
||||||
|
|
||||||
/* Lecture des dimensions */
|
/* Lecture des dimensions */
|
||||||
ii_max = *(pt_bitmap++); jj_max = *(pt_bitmap++);
|
ii_max = *(pt_bitmap++);
|
||||||
|
jj_max = *(pt_bitmap++);
|
||||||
|
|
||||||
/* lecture des offsets */
|
/* lecture des offsets */
|
||||||
px += *(pt_bitmap++); py += *(pt_bitmap++);
|
px += *(pt_bitmap++);
|
||||||
|
py += *(pt_bitmap++);
|
||||||
|
|
||||||
color = *(pt_bitmap++);
|
color = *(pt_bitmap++);
|
||||||
if( (Color > 0) )
|
if( (Color > 0) )
|
||||||
|
|
|
@ -6,9 +6,6 @@
|
||||||
#pragma implementation
|
#pragma implementation
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define eda_global
|
|
||||||
#define MAIN
|
|
||||||
|
|
||||||
#include "fctsys.h"
|
#include "fctsys.h"
|
||||||
#include "appl_wxstruct.h"
|
#include "appl_wxstruct.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
@ -16,20 +13,122 @@
|
||||||
#include "confirm.h"
|
#include "confirm.h"
|
||||||
#include "gestfich.h"
|
#include "gestfich.h"
|
||||||
#include "program.h"
|
#include "program.h"
|
||||||
#include "libcmp.h"
|
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
#include "netlist.h"
|
|
||||||
#include "worksheet.h"
|
|
||||||
#include "bitmaps.h"
|
#include "bitmaps.h"
|
||||||
#include "eda_dde.h"
|
#include "eda_dde.h"
|
||||||
|
|
||||||
|
#include "libcmp.h"
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
#include <wx/snglinst.h>
|
#include <wx/snglinst.h>
|
||||||
|
|
||||||
|
|
||||||
// Global variables
|
// Global variables
|
||||||
wxString g_Main_Title( wxT( "EESchema" ) );
|
|
||||||
|
wxString g_DefaultSchematicFileName( wxT( "noname.sch" ) );
|
||||||
|
wxArrayString g_LibName_List; // library list (short filenames) to load
|
||||||
|
LibraryStruct* g_LibraryList; // All part libs are saved here.
|
||||||
|
|
||||||
|
int g_NetFormat; /* Numero de reference du type de netliste */
|
||||||
|
int g_OptNetListUseNames; /* TRUE pour utiliser les noms de net plutot que
|
||||||
|
* les numeros (netlist PSPICE seulement) */
|
||||||
|
SCH_ITEM* g_ItemToRepeat; /* pointeur sur la derniere structure
|
||||||
|
* dessinee pouvant etre dupliquee par la commande
|
||||||
|
* Repeat ( NULL si aucune struct existe ) */
|
||||||
|
wxSize g_RepeatStep;
|
||||||
|
int g_RepeatDeltaLabel;
|
||||||
|
|
||||||
|
SCH_ITEM* g_ItemToUndoCopy; /* copy of last modified schematic item
|
||||||
|
* before it is modified (used for undo managing
|
||||||
|
* to restore old values ) */
|
||||||
|
|
||||||
|
bool g_LastSearchIsMarker; /* True if last seach is a marker serach
|
||||||
|
* False for a schematic item search
|
||||||
|
* Used for hotkey next search */
|
||||||
|
|
||||||
|
/* Block operation (copy, paste) */
|
||||||
|
SCH_ITEM* g_BlockSaveDataList; // List of items to paste (Created by Block Save)
|
||||||
|
|
||||||
|
// Gestion d'options
|
||||||
|
int g_ShowAllPins;
|
||||||
|
int g_HVLines = 1; // Bool: force H or V directions (Wires, Bus ..)
|
||||||
|
|
||||||
|
int g_PlotPSColorOpt; // True = plot postcript color (see plotps.cpp)
|
||||||
|
|
||||||
|
struct EESchemaVariables g_EESchemaVar;
|
||||||
|
|
||||||
|
/* Variables globales pour Libview */
|
||||||
|
wxString g_CurrentViewLibraryName; /* nom de la librairie en cours d'examen */
|
||||||
|
wxString g_CurrentViewComponentName; /* nom du le composant en cours d'examen */
|
||||||
|
int g_ViewConvert; /* Vue normal / convert */
|
||||||
|
int g_ViewUnit; /* part a afficher (A, B ..) */
|
||||||
|
|
||||||
|
/* Variables globales pour Schematic Edit */
|
||||||
|
int g_DefaultTextLabelSize = DEFAULT_SIZE_TEXT;
|
||||||
|
|
||||||
|
/* Variables globales pour LibEdit */
|
||||||
|
int g_LastTextSize = DEFAULT_SIZE_TEXT;
|
||||||
|
int g_LastTextOrient = TEXT_ORIENT_HORIZ;
|
||||||
|
|
||||||
|
bool g_FlDrawSpecificUnit = FALSE;
|
||||||
|
bool g_FlDrawSpecificConvert = TRUE;
|
||||||
|
|
||||||
|
int g_PlotFormat; /* flag = TYPE_HPGL, TYPE_PS... */
|
||||||
|
int g_PlotMargin; /* Marge pour traces du cartouche */
|
||||||
|
float g_PlotScaleX;
|
||||||
|
float g_PlotScaleY; /* coeff d'echelle de trace en unites table tracante */
|
||||||
|
|
||||||
|
HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr;
|
||||||
|
|
||||||
|
//SCH_SCREEN * ScreenSch;
|
||||||
|
DrawSheetStruct* g_RootSheet = NULL;
|
||||||
|
SCH_SCREEN* g_ScreenLib = NULL;
|
||||||
|
|
||||||
|
wxString g_NetCmpExtBuffer( wxT( "cmp" ) );
|
||||||
|
wxString g_SymbolExtBuffer( wxT( "sym" ) );
|
||||||
|
|
||||||
|
const wxString CompLibFileExtension( wxT( "lib" ) );
|
||||||
|
|
||||||
|
const wxString CompLibFileWildcard( wxT( "Kicad component library file " \
|
||||||
|
"(*.lib)|*.lib" ) );
|
||||||
|
|
||||||
|
wxString g_SimulatorCommandLine; // ligne de commande pour l'appel au simulateur (gnucap, spice..)
|
||||||
|
wxString g_NetListerCommandLine; // ligne de commande pour l'appel au simulateur (gnucap, spice..)
|
||||||
|
|
||||||
|
LayerStruct g_LayerDescr; /* couleurs des couches */
|
||||||
|
|
||||||
|
/* bool: TRUE si edition des pins pin a pin au lieu */
|
||||||
|
bool g_EditPinByPinIsOn = FALSE;
|
||||||
|
|
||||||
|
int g_LibSymbolDefaultLineWidth; /* default line width (in EESCHEMA units) used when creating a new graphic item in libedit : 0 = default */
|
||||||
|
int g_DrawMinimunLineWidth; /* Minimum line (in EESCHEMA units) thickness used to draw items on screen; 0 = single pixel line width */
|
||||||
|
int g_PlotLine_Width; /* Minimum line (in EESCHEMA units) thickness used to Plot/Print items */
|
||||||
|
// Color to draw selected items
|
||||||
|
int g_ItemSelectetColor = BROWN;
|
||||||
|
// Color to draw items flagged invisible, in libedit (they are insisible in eeschema
|
||||||
|
int g_InvisibleItemColor = DARKGRAY;
|
||||||
|
|
||||||
|
/* Variables used by LibEdit */
|
||||||
|
LibEDA_BaseStruct* LibItemToRepeat = NULL; /* pointer on a graphic item than
|
||||||
|
* can be duplicated by the Ins key
|
||||||
|
* (usually the last created item */
|
||||||
|
LibraryStruct* CurrentLib = NULL; /* Current opened library */
|
||||||
|
EDA_LibComponentStruct* CurrentLibEntry = NULL; /* Current component */
|
||||||
|
LibEDA_BaseStruct* CurrentDrawItem = NULL; /* current edited item */
|
||||||
|
|
||||||
|
// Current selected alias (for components which have aliases)
|
||||||
|
wxString CurrentAliasName;
|
||||||
|
|
||||||
|
// True if the current component has a "De Morgan" representation
|
||||||
|
bool g_AsDeMorgan;
|
||||||
|
int CurrentUnit = 1;
|
||||||
|
int CurrentConvert = 1;
|
||||||
|
|
||||||
|
/* Library (name) containing the last component find by FindLibPart() */
|
||||||
|
wxString FindLibName;
|
||||||
|
|
||||||
|
int DefaultTransformMatrix[2][2] = { { 1, 0 }, { 0, -1 } };
|
||||||
|
|
||||||
|
|
||||||
/************************************/
|
/************************************/
|
||||||
/* Called to initialize the program */
|
/* Called to initialize the program */
|
||||||
|
@ -44,12 +143,12 @@ IMPLEMENT_APP( WinEDA_App )
|
||||||
|
|
||||||
bool WinEDA_App::OnInit()
|
bool WinEDA_App::OnInit()
|
||||||
{
|
{
|
||||||
wxString FFileName;
|
wxFileName fn;
|
||||||
WinEDA_SchematicFrame* frame = NULL;
|
WinEDA_SchematicFrame* frame = NULL;
|
||||||
|
|
||||||
g_DebugLevel = 0; // Debug level */
|
g_DebugLevel = 0; // Debug level */
|
||||||
|
|
||||||
InitEDA_Appl( wxT( "eeschema" ) );
|
InitEDA_Appl( wxT( "EESchema" ) );
|
||||||
|
|
||||||
if( m_Checker && m_Checker->IsAnotherRunning() )
|
if( m_Checker && m_Checker->IsAnotherRunning() )
|
||||||
{
|
{
|
||||||
|
@ -58,10 +157,9 @@ bool WinEDA_App::OnInit()
|
||||||
}
|
}
|
||||||
|
|
||||||
if( argc > 1 )
|
if( argc > 1 )
|
||||||
FFileName = argv[1];
|
fn = argv[1];
|
||||||
|
|
||||||
/* init EESCHEMA */
|
/* init EESCHEMA */
|
||||||
GetSettings(); // read current setup
|
|
||||||
SeedLayers();
|
SeedLayers();
|
||||||
extern PARAM_CFG_BASE* ParamCfgList[];
|
extern PARAM_CFG_BASE* ParamCfgList[];
|
||||||
wxGetApp().ReadCurrentSetupValues( ParamCfgList );
|
wxGetApp().ReadCurrentSetupValues( ParamCfgList );
|
||||||
|
@ -88,17 +186,19 @@ bool WinEDA_App::OnInit()
|
||||||
frame->Zoom_Automatique( TRUE );
|
frame->Zoom_Automatique( TRUE );
|
||||||
|
|
||||||
/* Load file specified in the command line. */
|
/* Load file specified in the command line. */
|
||||||
if( !FFileName.IsEmpty() )
|
if( fn.IsOk() )
|
||||||
{
|
{
|
||||||
ChangeFileNameExt( FFileName, g_SchExtBuffer );
|
if( fn.GetExt() != SchematicFileExtension )
|
||||||
wxSetWorkingDirectory( wxPathOnly( FFileName ) );
|
fn.SetExt( SchematicFileExtension );
|
||||||
if( frame->DrawPanel )
|
wxSetWorkingDirectory( fn.GetPath() );
|
||||||
if( frame->LoadOneEEProject( FFileName, FALSE ) <= 0 )
|
if( frame->DrawPanel
|
||||||
frame->DrawPanel->Refresh( TRUE ); // File not found or error
|
&& frame->LoadOneEEProject( fn.GetFullPath(), false ) <= 0 )
|
||||||
|
frame->DrawPanel->Refresh( true );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Read_Config( wxEmptyString, TRUE ); // Read a default config file if no file to load
|
// Read a default config file if no file to load.
|
||||||
|
Read_Config( wxEmptyString, TRUE );
|
||||||
if( frame->DrawPanel )
|
if( frame->DrawPanel )
|
||||||
frame->DrawPanel->Refresh( TRUE );
|
frame->DrawPanel->Refresh( TRUE );
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "confirm.h"
|
#include "confirm.h"
|
||||||
#include "kicad_string.h"
|
#include "kicad_string.h"
|
||||||
#include "gestfich.h"
|
#include "gestfich.h"
|
||||||
|
#include "appl_wxstruct.h"
|
||||||
|
|
||||||
#include "program.h"
|
#include "program.h"
|
||||||
#include "libcmp.h"
|
#include "libcmp.h"
|
||||||
|
@ -270,6 +271,7 @@ void WinEDA_ErcFrame::ReBuildMatrixPanel()
|
||||||
void WinEDA_ErcFrame::TestErc( wxCommandEvent& event )
|
void WinEDA_ErcFrame::TestErc( wxCommandEvent& event )
|
||||||
/**************************************************/
|
/**************************************************/
|
||||||
{
|
{
|
||||||
|
wxFileName fn;
|
||||||
ObjetNetListStruct* NetItemRef;
|
ObjetNetListStruct* NetItemRef;
|
||||||
ObjetNetListStruct* OldItem;
|
ObjetNetListStruct* OldItem;
|
||||||
ObjetNetListStruct* StartNet;
|
ObjetNetListStruct* StartNet;
|
||||||
|
@ -389,28 +391,21 @@ void WinEDA_ErcFrame::TestErc( wxCommandEvent& event )
|
||||||
/* Generation ouverture fichier diag */
|
/* Generation ouverture fichier diag */
|
||||||
if( WriteFichierERC == TRUE )
|
if( WriteFichierERC == TRUE )
|
||||||
{
|
{
|
||||||
wxString ErcFullFileName;
|
fn = g_RootSheet->m_AssociatedScreen->m_FileName;
|
||||||
ErcFullFileName = g_RootSheet->m_AssociatedScreen->m_FileName;
|
fn.SetExt( wxT( "erc" ) );
|
||||||
ChangeFileNameExt( ErcFullFileName, wxT( ".erc" ) );
|
|
||||||
|
|
||||||
ErcFullFileName = EDA_FileSelector( _( "ERC file:" ),
|
wxFileDialog dlg( this, _( "ERC File" ), fn.GetPath(), fn.GetFullName(),
|
||||||
wxEmptyString, /* Chemin par defaut */
|
_( "Electronic rule check file (.erc)|*.erc" ),
|
||||||
ErcFullFileName, /* nom fichier par defaut */
|
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||||
wxT( ".erc" ), /* extension par defaut */
|
|
||||||
wxT( "*.erc" ), /* Masque d'affichage */
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
this,
|
|
||||||
wxFD_SAVE,
|
|
||||||
TRUE
|
|
||||||
);
|
|
||||||
if( ErcFullFileName.IsEmpty() )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( WriteDiagnosticERC( ErcFullFileName ) )
|
if( WriteDiagnosticERC( dlg.GetPath() ) )
|
||||||
{
|
{
|
||||||
Close( TRUE );
|
Close( TRUE );
|
||||||
wxString editorname = GetEditorName();
|
ExecuteFile( this, wxGetApp().GetEditorName(),
|
||||||
AddDelimiterString( ErcFullFileName );
|
QuoteFullPath( fn ) );
|
||||||
ExecuteFile( this, editorname, ErcFullFileName );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,11 +80,11 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
|
||||||
FullFileName = FileName;
|
FullFileName = FileName;
|
||||||
if( ( FullFileName.IsEmpty() ) && !IsNew )
|
if( ( FullFileName.IsEmpty() ) && !IsNew )
|
||||||
{
|
{
|
||||||
wxString mask = wxT( "*" ) + g_SchExtBuffer;
|
wxString mask = wxT( "*." ) + SchematicFileExtension;
|
||||||
FullFileName = EDA_FileSelector( _( "Schematic files:" ),
|
FullFileName = EDA_FileSelector( _( "Schematic files:" ),
|
||||||
wxEmptyString, /* Chemin par defaut */
|
wxEmptyString, /* Chemin par defaut */
|
||||||
wxEmptyString, /* nom fichier par defaut */
|
wxEmptyString, /* nom fichier par defaut */
|
||||||
g_SchExtBuffer, /* extension par defaut */
|
SchematicFileExtension, /* extension par defaut */
|
||||||
mask, /* Masque d'affichage */
|
mask, /* Masque d'affichage */
|
||||||
this,
|
this,
|
||||||
wxFD_OPEN,
|
wxFD_OPEN,
|
||||||
|
@ -154,18 +154,16 @@ int WinEDA_SchematicFrame::LoadOneEEProject( const wxString& FileName,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loading the project library cache
|
// Loading the project library cache
|
||||||
wxString FullLibName;
|
wxFileName fn = g_RootSheet->m_AssociatedScreen->m_FileName;
|
||||||
wxString shortfilename;
|
fn.SetExt( wxT( "cache.lib" ) );
|
||||||
wxSplitPath( g_RootSheet->m_AssociatedScreen->m_FileName, NULL, &shortfilename, NULL );
|
wxLogDebug( wxT( "Load schematic cache library file <%s>" ),
|
||||||
FullLibName << wxT( "." ) << STRING_DIR_SEP << shortfilename << wxT( ".cache" ) <<
|
fn.GetFullPath().c_str() );
|
||||||
g_LibExtBuffer;
|
|
||||||
if( wxFileExists( FullLibName ) )
|
if( fn.FileExists() )
|
||||||
{
|
{
|
||||||
wxString libname;
|
msg = wxT( "Load " ) + fn.GetFullPath();
|
||||||
libname = FullLibName;
|
LibraryStruct* LibCache = LoadLibraryName( this, fn.GetFullPath(),
|
||||||
ChangeFileNameExt( libname, wxEmptyString );
|
fn.GetName() );
|
||||||
msg = wxT( "Load " ) + FullLibName;
|
|
||||||
LibraryStruct* LibCache = LoadLibraryName( this, FullLibName, libname );
|
|
||||||
if( LibCache )
|
if( LibCache )
|
||||||
{
|
{
|
||||||
LibCache->m_IsLibCache = TRUE;
|
LibCache->m_IsLibCache = TRUE;
|
||||||
|
@ -233,8 +231,7 @@ void WinEDA_SchematicFrame::SaveProject()
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
SCH_SCREEN* screen;
|
SCH_SCREEN* screen;
|
||||||
wxString LibArchiveFileName;
|
wxFileName fn;
|
||||||
|
|
||||||
EDA_ScreenList ScreenList;
|
EDA_ScreenList ScreenList;
|
||||||
|
|
||||||
for( screen = ScreenList.GetFirst(); screen != NULL;
|
for( screen = ScreenList.GetFirst(); screen != NULL;
|
||||||
|
@ -245,12 +242,9 @@ void WinEDA_SchematicFrame::SaveProject()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Creation du fichier d'archivage composants en repertoire courant */
|
/* Creation du fichier d'archivage composants en repertoire courant */
|
||||||
LibArchiveFileName = MakeFileName( wxEmptyString, g_RootSheet->GetFileName(), wxEmptyString );
|
fn = g_RootSheet->GetFileName();
|
||||||
ChangeFileNameExt( LibArchiveFileName, wxEmptyString );
|
fn.SetExt( wxT( "cache." ) + CompLibFileExtension );
|
||||||
|
LibArchive( this, fn.GetFullPath() );
|
||||||
/* mise a jour extension */
|
|
||||||
LibArchiveFileName += wxT( ".cache" ) + g_LibExtBuffer;
|
|
||||||
LibArchive( this, LibArchiveFileName );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -713,9 +713,9 @@ int WinEDA_FindFrame::ExploreAllLibraries( const wxString& wildmask, wxString& F
|
||||||
int nbitems = 0, LineNum = 0;
|
int nbitems = 0, LineNum = 0;
|
||||||
char Line[2048], * name;
|
char Line[2048], * name;
|
||||||
|
|
||||||
FullFileName = MakeFileName( g_RealLibDirBuffer, wxT( "*" ), g_LibExtBuffer );
|
FullFileName = wxFindFirstFile( g_RealLibDirBuffer + wxT( "*." ) +
|
||||||
|
CompLibFileExtension );
|
||||||
|
|
||||||
FullFileName = wxFindFirstFile( FullFileName );
|
|
||||||
while( !FullFileName.IsEmpty() )
|
while( !FullFileName.IsEmpty() )
|
||||||
{
|
{
|
||||||
file = wxFopen( FullFileName, wxT( "rt" ) );
|
file = wxFopen( FullFileName, wxT( "rt" ) );
|
||||||
|
|
|
@ -5,13 +5,6 @@
|
||||||
#ifndef _GENERAL_H_
|
#ifndef _GENERAL_H_
|
||||||
#define _GENERAL_H_
|
#define _GENERAL_H_
|
||||||
|
|
||||||
#ifndef eda_global
|
|
||||||
#define eda_global extern
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define us unsigned short
|
|
||||||
#define uc unsigned char
|
|
||||||
#define ul unsigned long
|
|
||||||
|
|
||||||
/* Entete des fichiers schematique */
|
/* Entete des fichiers schematique */
|
||||||
#define EESCHEMA_VERSION 2
|
#define EESCHEMA_VERSION 2
|
||||||
|
@ -23,7 +16,7 @@
|
||||||
#define MAX_PIN_INFO 10
|
#define MAX_PIN_INFO 10
|
||||||
|
|
||||||
#define TXTMARGE 10 /* Decalage (en 1/1000") des textes places
|
#define TXTMARGE 10 /* Decalage (en 1/1000") des textes places
|
||||||
* sur fils ( labels, num pins ) */
|
* sur fils ( labels, num pins ) */
|
||||||
|
|
||||||
#define HIGHLIGHT_COLOR WHITE
|
#define HIGHLIGHT_COLOR WHITE
|
||||||
|
|
||||||
|
@ -40,12 +33,7 @@
|
||||||
#define DANGLING_SYMBOL_SIZE 12
|
#define DANGLING_SYMBOL_SIZE 12
|
||||||
|
|
||||||
/* Message de presentation */
|
/* Message de presentation */
|
||||||
extern wxString g_Main_Title;
|
extern wxString g_DefaultSchematicFileName;
|
||||||
eda_global wxString g_DefaultSchematicFileName
|
|
||||||
#ifdef MAIN
|
|
||||||
( wxT( "noname.sch" ) )
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
|
|
||||||
/* Masque de recherche pour localisation d'objets a editer */
|
/* Masque de recherche pour localisation d'objets a editer */
|
||||||
#define LIBITEM 1
|
#define LIBITEM 1
|
||||||
|
@ -106,41 +94,33 @@ typedef enum {
|
||||||
|
|
||||||
|
|
||||||
/* variables generales */
|
/* variables generales */
|
||||||
eda_global wxArrayString g_LibName_List; // library list (short filenames) to load
|
extern wxArrayString g_LibName_List; // library list (short filenames) to load
|
||||||
eda_global LibraryStruct* g_LibraryList; // All part libs are saved here.
|
extern LibraryStruct* g_LibraryList; // All part libs are saved here.
|
||||||
|
|
||||||
eda_global int g_NetFormat; /* Numero de reference du type de netliste */
|
extern int g_NetFormat; /* Numero de reference du type de netliste */
|
||||||
eda_global int g_OptNetListUseNames; /* TRUE pour utiliser les noms de net plutot que
|
extern int g_OptNetListUseNames; /* TRUE pour utiliser les noms de net plutot que
|
||||||
* les numeros (netlist PSPICE seulement) */
|
* les numeros (netlist PSPICE seulement) */
|
||||||
eda_global int g_BGColor; /* couleur fond d'ecran (normalement blanc) */
|
extern SCH_ITEM* g_ItemToRepeat; /* pointeur sur la derniere structure
|
||||||
eda_global SCH_ITEM* g_ItemToRepeat; /* pointeur sur la derniere structure
|
|
||||||
* dessinee pouvant etre dupliquee par la commande
|
* dessinee pouvant etre dupliquee par la commande
|
||||||
* Repeat ( NULL si aucune struct existe ) */
|
* Repeat ( NULL si aucune struct existe ) */
|
||||||
eda_global wxSize g_RepeatStep;
|
extern wxSize g_RepeatStep;
|
||||||
eda_global int g_RepeatDeltaLabel;
|
extern int g_RepeatDeltaLabel;
|
||||||
|
|
||||||
eda_global SCH_ITEM* g_ItemToUndoCopy; /* copy of last modified schematic item
|
extern SCH_ITEM* g_ItemToUndoCopy; /* copy of last modified schematic item
|
||||||
* before it is modified (used for undo managing to restore old values ) */
|
* before it is modified (used for undo managing to restore old values ) */
|
||||||
|
|
||||||
eda_global bool g_LastSearchIsMarker; // True if last seach is a marker serach
|
extern bool g_LastSearchIsMarker; // True if last seach is a marker serach
|
||||||
// False for a schematic item search
|
// False for a schematic item search
|
||||||
// Used for hotkey next search
|
// Used for hotkey next search
|
||||||
|
|
||||||
/* Block operation (copy, paste) */
|
/* Block operation (copy, paste) */
|
||||||
eda_global SCH_ITEM* g_BlockSaveDataList; // List of items to paste (Created by Block Save)
|
extern SCH_ITEM* g_BlockSaveDataList; // List of items to paste (Created by Block Save)
|
||||||
|
|
||||||
// Gestion d'options
|
// Gestion d'options
|
||||||
eda_global int g_ShowAllPins;
|
extern int g_ShowAllPins;
|
||||||
eda_global int g_ShowGrid; // Bool: display grid
|
extern int g_HVLines;
|
||||||
#ifdef MAIN
|
|
||||||
wxSize g_User_Grid( 50, 50 );
|
|
||||||
int g_HVLines = 1; // Bool: force H or V directions (Wires, Bus ..)
|
|
||||||
#else
|
|
||||||
extern wxSize g_User_Grid;
|
|
||||||
extern int g_HVLines;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
eda_global int g_PlotPSColorOpt; // True = plot postcript color (see plotps.cpp)
|
extern int g_PlotPSColorOpt; // True = plot postcript color (see plotps.cpp)
|
||||||
|
|
||||||
|
|
||||||
// Gestion de diverses variables, options... devant etre memorisees mais
|
// Gestion de diverses variables, options... devant etre memorisees mais
|
||||||
|
@ -151,43 +131,23 @@ struct EESchemaVariables
|
||||||
int NbWarningErc;
|
int NbWarningErc;
|
||||||
};
|
};
|
||||||
|
|
||||||
eda_global struct EESchemaVariables g_EESchemaVar;
|
extern struct EESchemaVariables g_EESchemaVar;
|
||||||
|
|
||||||
/* Variables globales pour Libview */
|
/* Variables globales pour Libview */
|
||||||
eda_global wxString g_CurrentViewLibraryName; /* nom de la librairie en cours d'examen */
|
extern wxString g_CurrentViewLibraryName; /* nom de la librairie en cours d'examen */
|
||||||
eda_global wxString g_CurrentViewComponentName; /* nom du le composant en cours d'examen */
|
extern wxString g_CurrentViewComponentName; /* nom du le composant en cours d'examen */
|
||||||
eda_global int g_ViewConvert; /* Vue normal / convert */
|
extern int g_ViewConvert; /* Vue normal / convert */
|
||||||
eda_global int g_ViewUnit; /* part a afficher (A, B ..) */
|
extern int g_ViewUnit; /* part a afficher (A, B ..) */
|
||||||
|
|
||||||
/* Variables globales pour Schematic Edit */
|
/* Variables globales pour Schematic Edit */
|
||||||
eda_global int g_DefaultTextLabelSize
|
extern int g_DefaultTextLabelSize;
|
||||||
#ifdef MAIN
|
|
||||||
= DEFAULT_SIZE_TEXT
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
|
|
||||||
/* Variables globales pour LibEdit */
|
/* Variables globales pour LibEdit */
|
||||||
eda_global int g_LastTextSize
|
extern int g_LastTextSize;
|
||||||
#ifdef MAIN
|
extern int g_LastTextOrient;
|
||||||
= DEFAULT_SIZE_TEXT
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
eda_global int g_LastTextOrient
|
|
||||||
#ifdef MAIN
|
|
||||||
= TEXT_ORIENT_HORIZ
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
|
|
||||||
eda_global bool g_FlDrawSpecificUnit
|
extern bool g_FlDrawSpecificUnit;
|
||||||
#ifdef MAIN
|
extern bool g_FlDrawSpecificConvert;
|
||||||
= FALSE
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
eda_global bool g_FlDrawSpecificConvert
|
|
||||||
#ifdef MAIN
|
|
||||||
= TRUE
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
|
|
||||||
/********************************************************/
|
/********************************************************/
|
||||||
/* Description des structures des parametres principaux */
|
/* Description des structures des parametres principaux */
|
||||||
|
@ -195,9 +155,9 @@ eda_global bool g_FlDrawSpecificConvert
|
||||||
|
|
||||||
/* Gestion des trace sur table tracante */
|
/* Gestion des trace sur table tracante */
|
||||||
|
|
||||||
eda_global int g_PlotFormat; /* flag = TYPE_HPGL, TYPE_PS... */
|
extern int g_PlotFormat; /* flag = TYPE_HPGL, TYPE_PS... */
|
||||||
eda_global int g_PlotMargin; /* Marge pour traces du cartouche */
|
extern int g_PlotMargin; /* Marge pour traces du cartouche */
|
||||||
eda_global float g_PlotScaleX, g_PlotScaleY; /* coeff d'echelle de trace en unites table tracante */
|
extern float g_PlotScaleX, g_PlotScaleY; /* coeff d'echelle de trace en unites table tracante */
|
||||||
|
|
||||||
|
|
||||||
/* For HPGL plotting: Pen caract : */
|
/* For HPGL plotting: Pen caract : */
|
||||||
|
@ -207,13 +167,13 @@ struct HPGL_Pen_Descr_Struct
|
||||||
int m_Pen_Speed; /* vitesse en cm/s */
|
int m_Pen_Speed; /* vitesse en cm/s */
|
||||||
int m_Pen_Diam; /* Pen diameter in mils */
|
int m_Pen_Diam; /* Pen diameter in mils */
|
||||||
};
|
};
|
||||||
eda_global HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr;
|
extern HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr;
|
||||||
|
|
||||||
/* Ecrans usuels */
|
/* Ecrans usuels */
|
||||||
|
|
||||||
//eda_global SCH_SCREEN * ScreenSch;
|
//extern SCH_SCREEN * ScreenSch;
|
||||||
eda_global DrawSheetStruct* g_RootSheet;
|
extern DrawSheetStruct* g_RootSheet;
|
||||||
eda_global SCH_SCREEN* g_ScreenLib;
|
extern SCH_SCREEN* g_ScreenLib;
|
||||||
|
|
||||||
/*************************************/
|
/*************************************/
|
||||||
/* Gestion de recherche des elements */
|
/* Gestion de recherche des elements */
|
||||||
|
@ -225,48 +185,28 @@ eda_global SCH_SCREEN* g_ScreenLib;
|
||||||
#define CURSEUR_OFF_GRILLE 1
|
#define CURSEUR_OFF_GRILLE 1
|
||||||
|
|
||||||
/* Gestion des librairies schematiques */
|
/* Gestion des librairies schematiques */
|
||||||
eda_global wxString g_NetNameBuffer;
|
extern wxString g_NetCmpExtBuffer;
|
||||||
|
extern wxString g_SymbolExtBuffer;
|
||||||
|
|
||||||
#ifdef MAIN
|
extern const wxString CompLibFileExtension;
|
||||||
wxString g_NetCmpExtBuffer( wxT( ".cmp" ) );
|
extern const wxString CompLibFileWildcard;
|
||||||
wxString g_SymbolExtBuffer( wxT( ".sym" ) );
|
|
||||||
wxString g_NetExtBuffer( wxT( ".net" ) );
|
|
||||||
wxString g_SchExtBuffer( wxT( ".sch" ) );
|
|
||||||
wxString g_LibExtBuffer( wxT( ".lib" ) );
|
|
||||||
#else
|
|
||||||
eda_global wxString g_NetCmpExtBuffer;
|
|
||||||
eda_global wxString g_SymbolExtBuffer;
|
|
||||||
eda_global wxString g_NetExtBuffer;
|
|
||||||
eda_global wxString g_SchExtBuffer;
|
|
||||||
eda_global wxString g_LibExtBuffer;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
eda_global wxString g_SimulatorCommandLine; // ligne de commande pour l'appel au simulateur (gnucap, spice..)
|
extern wxString g_SimulatorCommandLine; // ligne de commande pour l'appel au simulateur (gnucap, spice..)
|
||||||
eda_global wxString g_NetListerCommandLine; // ligne de commande pour l'appel au simulateur (gnucap, spice..)
|
extern wxString g_NetListerCommandLine; // ligne de commande pour l'appel au simulateur (gnucap, spice..)
|
||||||
|
|
||||||
eda_global LayerStruct g_LayerDescr; /* couleurs des couches */
|
extern LayerStruct g_LayerDescr; /* couleurs des couches */
|
||||||
|
|
||||||
eda_global bool g_EditPinByPinIsOn /* bool: TRUE si edition des pins pin a pin au lieu */
|
/* bool: TRUE si edition des pins pin a pin au lieu */
|
||||||
#ifdef MAIN /* de l'edition simultanee des pins de meme coordonnees */
|
extern bool g_EditPinByPinIsOn;
|
||||||
= FALSE
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
|
|
||||||
eda_global int g_LibSymbolDefaultLineWidth; /* default line width (in EESCHEMA units) used when creating a new graphic item in libedit : 0 = default */
|
extern int g_LibSymbolDefaultLineWidth; /* default line width (in EESCHEMA units) used when creating a new graphic item in libedit : 0 = default */
|
||||||
eda_global int g_DrawMinimunLineWidth; /* Minimum line (in EESCHEMA units) thickness used to draw items on screen; 0 = single pixel line width */
|
extern int g_DrawMinimunLineWidth; /* Minimum line (in EESCHEMA units) thickness used to draw items on screen; 0 = single pixel line width */
|
||||||
eda_global int g_PlotLine_Width; /* Minimum line (in EESCHEMA units) thickness used to Plot/Print items */
|
extern int g_PlotLine_Width; /* Minimum line (in EESCHEMA units) thickness used to Plot/Print items */
|
||||||
|
|
||||||
eda_global int g_ItemSelectetColor // Color to draw selected items
|
// Color to draw selected items
|
||||||
#ifdef MAIN
|
extern int g_ItemSelectetColor;
|
||||||
= BROWN
|
// Color to draw items flagged invisible, in libedit (they are insisible in eeschema
|
||||||
#endif
|
extern int g_InvisibleItemColor;
|
||||||
;
|
|
||||||
|
|
||||||
eda_global int g_InvisibleItemColor // Color to draw items flagged invisible, in libedit (they are insisible in eeschema
|
|
||||||
#ifdef MAIN
|
|
||||||
= DARKGRAY
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
|
|
||||||
/* Config keys */
|
/* Config keys */
|
||||||
#define MINI_DRAW_LINE_WIDTH_KEY wxT( "MinimunDrawLineWidth" )
|
#define MINI_DRAW_LINE_WIDTH_KEY wxT( "MinimunDrawLineWidth" )
|
||||||
|
|
|
@ -22,42 +22,44 @@
|
||||||
|
|
||||||
#include "id.h"
|
#include "id.h"
|
||||||
|
|
||||||
|
#include <wx/filename.h>
|
||||||
|
|
||||||
|
|
||||||
|
extern int ExportPartId;
|
||||||
|
|
||||||
|
|
||||||
/*************************************************/
|
/*************************************************/
|
||||||
void WinEDA_LibeditFrame::ImportOnePart()
|
|
||||||
/*************************************************/
|
|
||||||
|
|
||||||
/* Routine de lecture de 1 description.
|
/* Routine de lecture de 1 description.
|
||||||
* Le format est celui des librairies, mais on ne charge que 1 composant
|
* Le format est celui des librairies, mais on ne charge que 1 composant
|
||||||
* ou le 1er composant s'il y en a plusieurs.
|
* ou le 1er composant s'il y en a plusieurs.
|
||||||
* Si le premier composant est un alias, on chargera la racine correspondante
|
* Si le premier composant est un alias, on chargera la racine correspondante
|
||||||
*/
|
*/
|
||||||
|
/*************************************************/
|
||||||
|
void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxString Name, mask;
|
wxFileName fn;
|
||||||
LibraryStruct* LibTmp;
|
LibraryStruct* LibTmp;
|
||||||
EDA_LibComponentStruct* LibEntry;
|
EDA_LibComponentStruct* LibEntry;
|
||||||
int err = 1;
|
int err = 1;
|
||||||
|
|
||||||
mask = wxT( "*" ) + g_LibExtBuffer;
|
LibItemToRepeat = NULL;
|
||||||
Name = EDA_FileSelector( _( "Import component:" ),
|
|
||||||
wxEmptyString, /* Chemin par defaut */
|
wxFileDialog dlg( this, _( "Import Component" ), m_LastLibImportPath,
|
||||||
wxEmptyString, /* nom fichier par defaut */
|
wxEmptyString, CompLibFileWildcard,
|
||||||
g_LibExtBuffer, /* extension par defaut */
|
wxFD_OPEN | wxFILE_MUST_EXIST );
|
||||||
mask, /* Masque d'affichage */
|
|
||||||
this,
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
0,
|
|
||||||
TRUE
|
|
||||||
);
|
|
||||||
if( Name == wxEmptyString )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LibTmp = g_LibraryList; g_LibraryList = NULL;
|
LibTmp = g_LibraryList;
|
||||||
|
g_LibraryList = NULL;
|
||||||
|
|
||||||
LoadLibraryName( this, Name, wxT( "$tmplib$" ) );
|
LoadLibraryName( this, dlg.GetPath(), wxT( "$tmplib$" ) );
|
||||||
|
|
||||||
if( g_LibraryList )
|
if( g_LibraryList )
|
||||||
{
|
{
|
||||||
LibEntry = (EDA_LibComponentStruct*) PQFirst( &g_LibraryList->m_Entries, FALSE );
|
LibEntry = (EDA_LibComponentStruct*) PQFirst( &g_LibraryList->m_Entries,
|
||||||
|
false );
|
||||||
|
|
||||||
if( LibEntry )
|
if( LibEntry )
|
||||||
err = LoadOneLibraryPartAux( LibEntry, g_LibraryList, 1 );
|
err = LoadOneLibraryPartAux( LibEntry, g_LibraryList, 1 );
|
||||||
|
@ -65,75 +67,73 @@ void WinEDA_LibeditFrame::ImportOnePart()
|
||||||
|
|
||||||
if( err == 0 )
|
if( err == 0 )
|
||||||
{
|
{
|
||||||
|
fn = dlg.GetPath();
|
||||||
|
m_LastLibImportPath = fn.GetPath();
|
||||||
ReCreateHToolbar();
|
ReCreateHToolbar();
|
||||||
DisplayLibInfos();
|
DisplayLibInfos();
|
||||||
|
GetScreen()->ClearUndoRedoList();
|
||||||
DrawPanel->Refresh();
|
DrawPanel->Refresh();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
DisplayError( this, _( "File is empty" ), 30 );
|
||||||
}
|
}
|
||||||
|
|
||||||
g_LibraryList = LibTmp;
|
g_LibraryList = LibTmp;
|
||||||
if( err )
|
|
||||||
DisplayError( this, _( "File is empty" ), 30 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************/
|
|
||||||
void WinEDA_LibeditFrame::ExportOnePart( bool create_lib )
|
|
||||||
/************************************************************/
|
|
||||||
|
|
||||||
/* Routine de creation d'une nouvelle librairie et de sauvegarde du
|
/* Routine de creation d'une nouvelle librairie et de sauvegarde du
|
||||||
* composant courant dans cette librarie
|
* composant courant dans cette librarie
|
||||||
* si create_lib == TRUE sauvegarde dans le repertoire des libr
|
* si create_lib == TRUE sauvegarde dans le repertoire des libr
|
||||||
* sinon: sauvegarde sous le nom demande sans modifications.
|
* sinon: sauvegarde sous le nom demande sans modifications.
|
||||||
*
|
*
|
||||||
* Le format du fichier cree est dans tous les cas le meme.
|
* Le format du fichier cree est dans tous les cas le meme.
|
||||||
*/
|
*/
|
||||||
|
void WinEDA_LibeditFrame::OnExportPart( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxString Name, mask;
|
wxFileName fn;
|
||||||
|
wxString Name, mask, title;
|
||||||
LibraryStruct* NewLib, * LibTmp, * CurLibTmp;
|
LibraryStruct* NewLib, * LibTmp, * CurLibTmp;
|
||||||
|
bool createLib = ( event.GetId() == ExportPartId ) ? false : true;
|
||||||
|
|
||||||
if( CurrentLibEntry == NULL )
|
if( CurrentLibEntry == NULL )
|
||||||
{
|
{
|
||||||
DisplayError( this, _( "No Part to Save" ), 10 ); return;
|
DisplayError( this, _( "No Part to Save" ), 10 );
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Name = CurrentLibEntry->m_Name.m_Text;
|
fn = CurrentLibEntry->m_Name.m_Text.Lower();
|
||||||
Name.MakeLower();
|
fn.SetExt( CompLibFileExtension );
|
||||||
|
|
||||||
mask = wxT( "*" ) + g_LibExtBuffer;
|
title = createLib ? _( "New Library" ) : _( "Export Component" );
|
||||||
wxString def_path;
|
|
||||||
|
|
||||||
if( create_lib )
|
wxFileDialog dlg( this, title, wxGetCwd(), fn.GetFullName(),
|
||||||
def_path = g_RealLibDirBuffer;
|
CompLibFileWildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||||
|
|
||||||
Name = EDA_FileSelector( create_lib ? _( "New Library" ) : _( "Export component:" ),
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
def_path, /* Chemin par defaut */
|
|
||||||
Name, /* nom fichier par defaut */
|
|
||||||
g_LibExtBuffer, /* extension par defaut */
|
|
||||||
mask, /* Masque d'affichage */
|
|
||||||
this,
|
|
||||||
wxFD_SAVE,
|
|
||||||
TRUE
|
|
||||||
);
|
|
||||||
|
|
||||||
if( Name == wxEmptyString )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
fn = dlg.GetPath();
|
||||||
|
|
||||||
/* Creation d'une librairie standard pour sauvegarde */
|
/* Creation d'une librairie standard pour sauvegarde */
|
||||||
ChangeFileNameExt( Name, g_LibExtBuffer );
|
|
||||||
|
|
||||||
LibTmp = g_LibraryList;
|
LibTmp = g_LibraryList;
|
||||||
CurLibTmp = CurrentLib;
|
CurLibTmp = CurrentLib;
|
||||||
|
|
||||||
NewLib = new LibraryStruct( LIBRARY_TYPE_EESCHEMA, wxT( "$libTmp$" ), Name );
|
NewLib = new LibraryStruct( LIBRARY_TYPE_EESCHEMA, wxT( "$libTmp$" ),
|
||||||
|
fn.GetFullName() );
|
||||||
|
|
||||||
g_LibraryList = NewLib;
|
g_LibraryList = NewLib;
|
||||||
|
|
||||||
/* Sauvegarde du composant: */
|
/* Sauvegarde du composant: */
|
||||||
CurrentLib = NewLib;
|
CurrentLib = NewLib;
|
||||||
SaveOnePartInMemory();
|
SaveOnePartInMemory();
|
||||||
bool success = NewLib->SaveLibrary( Name );
|
bool success = NewLib->SaveLibrary( fn.GetFullPath() );
|
||||||
|
|
||||||
|
if( success )
|
||||||
|
{
|
||||||
|
m_LastLibExportPath = fn.GetPath();
|
||||||
|
}
|
||||||
|
|
||||||
/* Suppression de la librarie temporaire */
|
/* Suppression de la librarie temporaire */
|
||||||
FreeCmpLibrary( this, NewLib->m_Name );
|
FreeCmpLibrary( this, NewLib->m_Name );
|
||||||
|
@ -141,13 +141,14 @@ void WinEDA_LibeditFrame::ExportOnePart( bool create_lib )
|
||||||
CurrentLib = CurLibTmp;
|
CurrentLib = CurLibTmp;
|
||||||
|
|
||||||
wxString msg;
|
wxString msg;
|
||||||
if( create_lib && success )
|
if( createLib && success )
|
||||||
{
|
{
|
||||||
msg = Name + _( "Ok" );
|
msg = fn.GetFullPath() + _( " - OK" );
|
||||||
DisplayInfo( this,
|
DisplayInfo( this, _( "Note: this new library will be available " \
|
||||||
_("Note: this new library will be available only if it is loaded by eeschema.\nModify eeschema config if you want use it.") );
|
"only if it is loaded by eeschema.\nModify "
|
||||||
|
"eeschema config if you want use it." ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
msg = _( "Error while create " ) + Name;
|
msg = _( "Error creating " ) + fn.GetFullName();
|
||||||
Affiche_Message( msg );
|
Affiche_Message( msg );
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,8 @@ bool LibArchive( wxWindow* frame, const wxString& ArchFullFileName )
|
||||||
* return true if success
|
* return true if success
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxString DocFileName, msg;
|
wxFileName docFileName;
|
||||||
|
wxString msg;
|
||||||
char Line[256];
|
char Line[256];
|
||||||
FILE* ArchiveFile, * DocFile;
|
FILE* ArchiveFile, * DocFile;
|
||||||
EDA_LibComponentStruct* Entry;
|
EDA_LibComponentStruct* Entry;
|
||||||
|
@ -62,8 +63,8 @@ bool LibArchive( wxWindow* frame, const wxString& ArchFullFileName )
|
||||||
sort( ListEntry.begin(), ListEntry.end(), SortCmpByName );
|
sort( ListEntry.begin(), ListEntry.end(), SortCmpByName );
|
||||||
|
|
||||||
/* calculate the file name for the associated doc file */
|
/* calculate the file name for the associated doc file */
|
||||||
DocFileName = ArchFullFileName;
|
docFileName = ArchFullFileName;
|
||||||
ChangeFileNameExt( DocFileName, DOC_EXT );
|
docFileName.SetExt( DOC_EXT );
|
||||||
|
|
||||||
if( ( ArchiveFile = wxFopen( ArchFullFileName, wxT( "wt" ) ) ) == NULL )
|
if( ( ArchiveFile = wxFopen( ArchFullFileName, wxT( "wt" ) ) ) == NULL )
|
||||||
{
|
{
|
||||||
|
@ -72,9 +73,9 @@ bool LibArchive( wxWindow* frame, const wxString& ArchFullFileName )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( DocFile = wxFopen( DocFileName, wxT( "wt" ) ) ) == NULL )
|
if( ( DocFile = wxFopen( docFileName.GetFullPath(), wxT( "wt" ) ) ) == NULL )
|
||||||
{
|
{
|
||||||
msg = _( "Failed to create doc lib file " ) + DocFileName;
|
msg = _( "Failed to create doc lib file " ) + docFileName.GetFullPath();
|
||||||
DisplayError( frame, msg );
|
DisplayError( frame, msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,17 +5,13 @@
|
||||||
#ifndef LIBCMP_H
|
#ifndef LIBCMP_H
|
||||||
#define LIBCMP_H
|
#define LIBCMP_H
|
||||||
|
|
||||||
#ifndef eda_global
|
|
||||||
#define eda_global extern
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "priorque.h"
|
#include "priorque.h"
|
||||||
|
|
||||||
#define LIB_VERSION_MAJOR 2
|
#define LIB_VERSION_MAJOR 2
|
||||||
#define LIB_VERSION_MINOR 3
|
#define LIB_VERSION_MINOR 3
|
||||||
#define LIBFILE_IDENT "EESchema-LIBRARY Version" /* Must be the first line of lib files. */
|
#define LIBFILE_IDENT "EESchema-LIBRARY Version" /* Must be the first line of lib files. */
|
||||||
#define DOCFILE_IDENT "EESchema-DOCLIB Version 2.0" /* Must be the first line of doc files. */
|
#define DOCFILE_IDENT "EESchema-DOCLIB Version 2.0" /* Must be the first line of doc files. */
|
||||||
#define DOC_EXT wxT( ".dcm" ) /* Ext. of documentation files */
|
#define DOC_EXT wxT( "dcm" ) /* Ext. of documentation files */
|
||||||
|
|
||||||
|
|
||||||
//Offsets used in editing library component, for handle aliad dats
|
//Offsets used in editing library component, for handle aliad dats
|
||||||
|
@ -48,28 +44,20 @@ enum LocateDrawStructType {
|
||||||
|
|
||||||
|
|
||||||
/* Variables */
|
/* Variables */
|
||||||
extern LibraryStruct* LibraryList; /* All part libs are saved here. */
|
extern LibraryStruct* LibraryList; /* All part libs are saved here. */
|
||||||
|
|
||||||
/* Variables used by LibEdit */
|
/* Variables used by LibEdit */
|
||||||
eda_global LibEDA_BaseStruct* LibItemToRepeat; /* pointer on a graphic item than can be duplicated by the Ins key
|
extern LibEDA_BaseStruct* LibItemToRepeat; /* pointer on a graphic item than can be duplicated by the Ins key
|
||||||
* (usually the last created item */
|
* (usually the last created item */
|
||||||
eda_global LibraryStruct* CurrentLib; /* Current opened library */
|
extern LibraryStruct* CurrentLib; /* Current opened library */
|
||||||
eda_global EDA_LibComponentStruct* CurrentLibEntry; /* Current component */
|
extern EDA_LibComponentStruct* CurrentLibEntry; /* Current component */
|
||||||
eda_global LibEDA_BaseStruct* CurrentDrawItem; /* current edited item */
|
extern LibEDA_BaseStruct* CurrentDrawItem; /* current edited item */
|
||||||
|
|
||||||
eda_global wxString CurrentAliasName; // Current selected alias (for components which have aliases)
|
extern wxString CurrentAliasName;
|
||||||
eda_global bool g_AsDeMorgan; // True if the current component has a "De Morgan" representation
|
extern bool g_AsDeMorgan;
|
||||||
eda_global int CurrentUnit // Current selected part
|
extern int CurrentUnit;
|
||||||
#ifdef MAIN
|
extern int CurrentConvert;
|
||||||
= 1
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
eda_global int CurrentConvert /* Convert = 1 .. 255 */
|
|
||||||
#ifdef MAIN
|
|
||||||
= 1
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
|
|
||||||
eda_global wxString FindLibName; /* Library (name) containing the last component find by FindLibPart() */
|
extern wxString FindLibName;
|
||||||
|
|
||||||
#endif // LIBCMP_H
|
#endif // LIBCMP_H
|
||||||
|
|
|
@ -237,7 +237,7 @@ void WinEDA_LibeditFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg )
|
||||||
|
|
||||||
GetScreen()->ClrRefreshReq();
|
GetScreen()->ClrRefreshReq();
|
||||||
DisplayLibInfos();
|
DisplayLibInfos();
|
||||||
Affiche_Status_Box();
|
UpdateStatusBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -249,7 +249,8 @@ void WinEDA_LibeditFrame::SaveActiveLibrary()
|
||||||
* if exists the old file is renamed (.bak)
|
* if exists the old file is renamed (.bak)
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
wxString Name, msg;
|
wxFileName fn;
|
||||||
|
wxString msg;
|
||||||
|
|
||||||
if( CurrentLib == NULL )
|
if( CurrentLib == NULL )
|
||||||
{
|
{
|
||||||
|
@ -257,29 +258,31 @@ void WinEDA_LibeditFrame::SaveActiveLibrary()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Name = MakeFileName( g_RealLibDirBuffer,
|
fn = wxFileName( g_RealLibDirBuffer, CurrentLib->m_Name,
|
||||||
CurrentLib->m_Name,
|
CompLibFileExtension );
|
||||||
g_LibExtBuffer );
|
|
||||||
|
msg = _( "Modify Library File \"" ) + fn.GetFullPath() + _( "\"?" );
|
||||||
|
|
||||||
msg = _( "Modify Library File \"" ) + Name + _( "\"?" );
|
|
||||||
if( !IsOK( this, msg ) )
|
if( !IsOK( this, msg ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool success = CurrentLib->SaveLibrary( Name );
|
bool success = CurrentLib->SaveLibrary( fn.GetFullPath() );
|
||||||
|
|
||||||
MsgPanel->EraseMsgBox();
|
MsgPanel->EraseMsgBox();
|
||||||
|
|
||||||
if( !success )
|
if( !success )
|
||||||
{
|
{
|
||||||
msg = _( "Error while saving Library File \"" ) + Name + _( "\"." );
|
msg = _( "Error while saving Library File \"" ) + fn.GetFullPath() +
|
||||||
|
_( "\"." );
|
||||||
Affiche_1_Parametre( this, 1, wxT( " *** ERROR : **" ), msg, BLUE );
|
Affiche_1_Parametre( this, 1, wxT( " *** ERROR : **" ), msg, BLUE );
|
||||||
DisplayError( this, msg );
|
DisplayError( this, msg );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg = _( "Library File \"" ) + Name + wxT( "\" Ok" );
|
msg = _( "Library File \"" ) + fn.GetFullName() + wxT( "\" Ok" );
|
||||||
ChangeFileNameExt( Name, DOC_EXT );
|
fn.SetExt( DOC_EXT );
|
||||||
wxString msg1 = _( "Document File \"" ) + Name + wxT( "\" Ok" );
|
wxString msg1 = _( "Document File \"" ) + fn.GetFullPath() +
|
||||||
|
wxT( "\" Ok" );
|
||||||
Affiche_1_Parametre( this, 1, msg, msg1, BLUE );
|
Affiche_1_Parametre( this, 1, msg, msg1, BLUE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue