Commit 689579bd authored by stambaughw's avatar stambaughw

Global variable unobfuscation, new library path search, and lots of other...

Global variable unobfuscation, new library path search, and lots of other changes.  See CHANGELOG.txt.
parent 7a351249
...@@ -21,7 +21,6 @@ ...@@ -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 ) ...@@ -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 ) ...@@ -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 @@ ...@@ -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() ...@@ -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 @@ ...@@ -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 @@ ...@@ -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 @@ ...@@ -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() ...@@ -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 @@ ...@@ -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; ...@@ -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() ...@@ -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: ...@@ -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 ...@@ -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. ...@@ -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. ...@@ -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:
......
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 ...@@ -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 @@ ...@@ -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 ) ...@@ -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 ) ...@@ -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 @@ ...@@ -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 ) ...@@ -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 ) ...@@ -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() ...@@ -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() ...@@ -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() ...@@ -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 ) ...@@ -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, ...@@ -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, ...@@ -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 ) ...@@ -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) ) ...@@ -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 @@ ...@@ -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 @@ ...@@ -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() ...@@ -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() ...@@ -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() );
......
This diff is collapsed.
...@@ -69,6 +69,7 @@ bool DrawPage( WinEDA_DrawPanel* panel ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 @@ ...@@ -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 @@ ...@@ -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, ...@@ -60,6 +65,7 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
m_Print_Sheet_Ref = TRUE; // TRUE pour avoir le cartouche imprim� m_Print_Sheet_Ref = TRUE; // TRUE pour avoir le cartouche imprim�
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() ...@@ -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() ...@@ -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 ) ...@@ -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, ...@@ -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() ...@@ -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() ...@@ -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() ...@@ -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 ) ...@@ -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 ) ...@@ -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() ...@@ -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() ...@@ -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 );
}
This diff is collapsed.
...@@ -20,13 +20,15 @@ void WinEDA_App::ReadPdfBrowserInfos() ...@@ -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() ...@@ -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 );
} }
......
This diff is collapsed.
...@@ -175,88 +175,6 @@ wxString MakeReducedFileName( const wxString& fullfilename, ...@@ -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 ) ...@@ -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 ...@@ -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() ...@@ -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() ...@@ -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 ) ...@@ -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( "\"" );
}
This diff is collapsed.
...@@ -31,6 +31,14 @@ ...@@ -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 tracs 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 ) ...@@ -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 ) ...@@ -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 @@ ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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 )
{ {
......
/*
* 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 );
This diff is collapsed.
/****************************************************/
/* 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 ) ...@@ -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 ) ...@@ -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 );
} }
} }
......
This diff is collapsed.
...@@ -51,11 +51,11 @@ void WinEDA_DrawFrame::PutOnGrid( wxPoint* coord ) ...@@ -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 ) ...@@ -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 ...@@ -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) ...@@ -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}
......
/**********************/ /**********************/
/* CVPCB: autosel.cpp */ /* CVPCB: autosel.cpp */
/**********************/ /**********************/
/* Routines de selection automatique des modules */ /* Routines de selection automatique des modules */
...@@ -8,6 +8,7 @@ ...@@ -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 @@ ...@@ -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++) /* recherche des equivalences a travers les fichiers possibles */
{ 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); fn = g_ListName_Equ[ii];
fn.SetExt( EquivFileExtension );
if ( (fichierstf = wxFopen(EquivFileName, wxT("rt"))) == 0)
{ tmp = wxGetApp().GetLibraryPathList().FindValidPath( fn.GetFullName() );
msg.Printf( _("Library: <%s> not found"),EquivFileName.GetData());
DisplayError(frame, msg,10); if( !tmp )
continue ; {
} msg.Printf( _( "Footprint alias library file <%s> could not be " \
"found in the default search paths." ),
/* lecture fichier n */ fn.GetFullName().c_str() );
while ( fgets(Line,79,fichierstf) != 0 ) wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR );
{ continue;
/* elimination des lignes vides */ }
for (j = 0 ; j < 40 ; j++ )
{ file = wxFopen( tmp, wxT( "rt" ) );
if (Line[j] == 0 ) goto fin_de_while ;
if (Line[j] == QUOTE ) break ; if( file == NULL )
} {
msg.Printf( _( "Error opening alias library <%s>." ), tmp.c_str() );
ItemModule = new AUTOMODULE(); wxMessageBox( msg, titleLibLoadError, wxOK | wxICON_ERROR );
ItemModule->Pnext = BaseListeMod; continue;
BaseListeMod = ItemModule; }
/* 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]); ItemModule = new AUTOMODULE();
} ItemModule->Pnext = BaseListeMod;
nb_correspondances++ ; BaseListeMod = ItemModule;
fin_de_while:;
} /* stockage du composant ( 'namecmp' 'namelib')
fclose(fichierstf) ; * name et namelib */
for( j++; j < 40; j++, k++ )
/* Affichage Statistiques */ {
msg.Printf(_("%d equivalences"),nb_correspondances); if( Line[j] == QUOTE )
frame->SetStatusText(msg, 0); break;
} ItemModule->m_Name.Append( Line[j] );
}
Component = g_BaseListeCmp;
for ( ii = 0; Component != NULL; Component = Component->Pnext, ii++ ) j++;
{ for( ; j < 80; )
frame->m_ListCmp->SetSelection(ii,TRUE); if( Line[j++] == QUOTE )
if( Component->m_Module.IsEmpty() ) break;
auto_select(frame, Component, BaseListeMod);
} for( ; ; j++ )
{
/* Liberation memoire */ if( Line[j] == QUOTE )
for( ItemModule = BaseListeMod; ItemModule != NULL; ItemModule = NextMod) break;
{ ItemModule->m_LibName.Append( Line[j] );
NextMod = ItemModule->Pnext; delete ItemModule; }
}
BaseListeMod = NULL; 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
modules disponibles en librairie */ /* Correspondance trouvee, recherche nom module dans la liste des
Module= g_BaseListePkg; * modules disponibles en librairie */
for ( ;Module != NULL; Module = Module->Pnext ) Module = g_BaseListePkg;
{ for( ; Module != NULL; Module = Module->Pnext )
{
if( ItemModule->m_LibName.CmpNoCase(Module->m_Module) == 0 ) if( ItemModule->m_LibName.CmpNoCase( Module->m_Module ) == 0 )
{ /* empreinte trouve */ {
frame->SetNewPkg(Module->m_Module); frame->SetNewPkg( Module->m_Module );
return(0); return 0;
} }
} }
msg.Printf(
_("Component %s: Footprint %s not found in libraries"), msg.Printf( _( "Component %s: Footprint %s not found in libraries" ),
Cmp->m_Valeur.GetData(), ItemModule->m_LibName.GetData()); Cmp->m_Valeur.GetData(), ItemModule->m_LibName.GetData() );
DisplayError(frame, msg, 10); DisplayError( frame, msg, 10 );
return( 2 ); return 2;
} }
return(1);
return 1;
} }
...@@ -30,20 +30,35 @@ void Read_Config( const wxString& FileName ) ...@@ -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 ) ...@@ -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( "*" ) );
FullFileName = FFileName; fn.SetExt( ProjectFileExtension );
ChangeFileNameExt( FullFileName, g_Prj_Config_Filename_ext );
path = wxGetCwd(); wxFileDialog dlg( parent, _( "Save Project File" ), fn.GetPath(),
FullFileName = EDA_FileSelector( _( "Save preferences" ), fn.GetFullName(), ProjectFileWildcard, wxFD_SAVE );
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() ) if( dlg.ShowModal() == wxID_CANCEL )
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 @@ ...@@ -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 ...@@ -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
......
This diff is collapsed.
/*******************/ /*******************/
/* 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 @@ ...@@ -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 ) ...@@ -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() ...@@ -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() ...@@ -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;
} }
...@@ -2,23 +2,28 @@ ...@@ -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: ...@@ -79,75 +84,36 @@ public:
}; };
eda_global STOREMOD* g_BaseListePkg; /* Gestion des noms des librairies */
eda_global STORECMP* g_BaseListeCmp; extern const wxString EquivFileExtension;
extern const wxString RetroFileExtension;
extern const wxString ComponentFileExtension;
eda_global FILE* source; extern const wxString RetroFileWildcard;
eda_global FILE* dest; extern const wxString EquivFileWildcard;
eda_global FILE* libcmp;
eda_global FILE* lib_module;
/* nom des fichiers a traiter */ extern const wxString titleLibLoadError;
eda_global wxString FFileName;
eda_global wxString NetNameBuffer;
/* Types de netliste: */ /* CvPcb global variable definition references. */
#define TYPE_NON_SPECIFIE 0 extern STOREMOD* g_BaseListePkg;
#define TYPE_ORCADPCB2 1 extern STORECMP* g_BaseListeCmp;
#define TYPE_PCAD 2
#define TYPE_VIEWLOGIC_WIR 3 extern wxString g_NetlistFileExtension;
#define TYPE_VIEWLOGIC_NET 4 extern wxString g_UserNetDirBuffer;
extern wxArrayString g_ListName_Equ; // list of .equ files to load
extern int g_FlagEESchema;
extern int Rjustify; /* flag pout troncature des noms de Net:
* = 0: debut de chaine conservee (->ORCADPCB2)
* = 1: fin de chaine conservee (->VIEWLOGIC) */
extern int modified; /* Flag != 0 si modif attribution des module. */
extern int nbcomp; /* nombre de composants trouves */
extern int nblib; /* nombre d'empreintes trouvees */
extern int composants_non_affectes; /* nbre de composants non affectes */
/* Gestion des noms des librairies */
eda_global wxString g_EquivExtBuffer
#ifdef MAIN
( wxT( ".equ" ) )
#endif
;
eda_global wxString g_ExtCmpBuffer
#ifdef MAIN
( wxT( ".cmp" ) )
#endif
;
eda_global wxString g_UserNetDirBuffer; // Netlist path (void = current working directory)
eda_global wxArrayString g_ListName_Equ; // list of .equ files to load
eda_global int g_FlagEESchema;
eda_global int Rjustify; /* flag pout troncature des noms de Net:
* = 0: debut de chaine conservee (->ORCADPCB2)
* = 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 */
eda_global int ListModIsModified; /* Flag != 0 si modif liste des lib modules */
eda_global char alim[1024];
eda_global int nbcomp; /* nombre de composants trouves */
eda_global int nblib; /* nombre d'empreintes trouvees */
eda_global int composants_non_affectes; /* nbre de composants non affectes */
eda_global wxString NameBuffer;
eda_global wxString NetInNameBuffer;
eda_global wxString NetInExtBuffer;
eda_global wxString NetDirBuffer;
eda_global wxString ExtRetroBuffer
#ifdef MAIN
( wxT( ".stf" ) )
#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 @@ ...@@ -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: ...@@ -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: ...@@ -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 ...@@ -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) ...@@ -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 @@ ...@@ -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() ...@@ -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, ...@@ -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 ) ...@@ -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 ) ...@@ -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 @@ ...@@ -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 ) ...@@ -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 ); wxFileDialog dlg( this, wxT( "Save Stuff File" ), fn.GetPath(),
fn.GetFullName(), RetroFileWildcard,
FullFileName = EDA_FileSelector( wxT( "Create Stuff File" ), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
wxGetCwd(), /* Chemin par defaut */
FullFileName, /* nom fichier par defaut */ if( dlg.ShowModal() == wxID_CANCEL )
ExtRetroBuffer, /* extension par defaut */
Mask, /* Masque d'affichage */
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 ...@@ -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 */
......
...@@ -9,6 +9,7 @@ ...@@ -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 ) ...@@ -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() ...@@ -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 modifie)
listlib(); listlib();
BuildFootprintListBox(); BuildFootprintListBox();
...@@ -130,14 +134,14 @@ void WinEDA_CvpcbFrame::ReadNetListe() ...@@ -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 ) ...@@ -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; wxFileDialog dlg( this, _( "Save Net and Component List" ), fn.GetPath(),
ChangeFileNameExt( NetlistFullFileName, NetExtBuffer ); fn.GetFullName(), NetlistFileWildcard,
} wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
NetlistFullFileName = if( dlg.ShowModal() == wxID_CANCEL )
EDA_FileSelector( _( "Save NetList and Components List files" ),
NetDirBuffer, /* Chemin par defaut */
NetlistFullFileName, /* nom fichier par defaut */
NetExtBuffer, /* extension par defaut */
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;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment