Commit b9b341dc authored by Wayne Stambaugh's avatar Wayne Stambaugh

PCB common library global variable removal and other minor fixes.

* Move auto save time global variables into PCB_EDIT_FRAME object.
* Move footprint library name list global variable int PCB_EDIT_FRAME
  object.
* Improve library back up and temporary file error message strings and make
  them translatable.
* PCBNew string unification.
* Translate French code names and comments.
* Coding style policy and Doxygen comment fixes.
parent de96452c
...@@ -73,8 +73,6 @@ wxString g_ViaType_Name[4] = { ...@@ -73,8 +73,6 @@ wxString g_ViaType_Name[4] = {
}; };
wxArrayString g_LibName_List; // library list to load
DISPLAY_OPTIONS DisplayOpt; /* Display options for board items */ DISPLAY_OPTIONS DisplayOpt; /* Display options for board items */
/* PCB file name extension definitions. */ /* PCB file name extension definitions. */
...@@ -90,8 +88,6 @@ const wxString ModuleFileWildcard( _( "Kicad footprint library files (*.mod)|*.m ...@@ -90,8 +88,6 @@ const wxString ModuleFileWildcard( _( "Kicad footprint library files (*.mod)|*.m
int g_CurrentVersionPCB = 1; int g_CurrentVersionPCB = 1;
int g_RotationAngle; int g_RotationAngle;
int g_TimeOut; // Timer for automatic saving
int g_SaveTime; // Time for next saving
int g_AnchorColor = BLUE; int g_AnchorColor = BLUE;
int g_ModuleTextCMPColor = LIGHTGRAY; int g_ModuleTextCMPColor = LIGHTGRAY;
......
/*************/ /**
/* files.cpp */ * @file gerbview/files.cpp
/*************/ */
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
...@@ -13,9 +13,6 @@ ...@@ -13,9 +13,6 @@
#include "class_gerbview_layer_widget.h" #include "class_gerbview_layer_widget.h"
/* Load a Gerber file selected from history list on current layer
* Previous data is deleted
*/
void GERBVIEW_FRAME::OnGbrFileHistory( wxCommandEvent& event ) void GERBVIEW_FRAME::OnGbrFileHistory( wxCommandEvent& event )
{ {
wxString fn; wxString fn;
...@@ -29,9 +26,7 @@ void GERBVIEW_FRAME::OnGbrFileHistory( wxCommandEvent& event ) ...@@ -29,9 +26,7 @@ void GERBVIEW_FRAME::OnGbrFileHistory( wxCommandEvent& event )
} }
} }
/* Load a Drll (Excellon) file selected from history list on current layer
* Previous data is deleted
*/
void GERBVIEW_FRAME::OnDrlFileHistory( wxCommandEvent& event ) void GERBVIEW_FRAME::OnDrlFileHistory( wxCommandEvent& event )
{ {
wxString fn; wxString fn;
...@@ -180,7 +175,6 @@ bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFullFileName ) ...@@ -180,7 +175,6 @@ bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFullFileName )
} }
Zoom_Automatique( false ); Zoom_Automatique( false );
g_SaveTime = time( NULL );
// Synchronize layers tools with actual active layer: // Synchronize layers tools with actual active layer:
setActiveLayer( getActiveLayer() ); setActiveLayer( getActiveLayer() );
...@@ -265,7 +259,6 @@ bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName ) ...@@ -265,7 +259,6 @@ bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName )
} }
Zoom_Automatique( false ); Zoom_Automatique( false );
g_SaveTime = time( NULL );
// Synchronize layers tools with actual active layer: // Synchronize layers tools with actual active layer:
setActiveLayer( getActiveLayer() ); setActiveLayer( getActiveLayer() );
...@@ -276,14 +269,6 @@ bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName ) ...@@ -276,14 +269,6 @@ bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName )
} }
/*
* Read a DCode file (not used with RX274X files , just with RS274D old files).
* Note: there is no standard for DCode files.
* Just read a file format created by early versions of Pcbnew.
* Returns:
* false if file not read (cancellation of order ...)
* true if OK
*/
bool GERBVIEW_FRAME::LoadDCodeFile( const wxString& aFullFileName ) bool GERBVIEW_FRAME::LoadDCodeFile( const wxString& aFullFileName )
{ {
wxString wildcard; wxString wildcard;
......
...@@ -412,7 +412,19 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title, ...@@ -412,7 +412,19 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
GRTraceMode trace_mode ); GRTraceMode trace_mode );
void Files_io( wxCommandEvent& event ); void Files_io( wxCommandEvent& event );
/**
* Function OnGbrFileHistory
* deletes the current data and loads a Gerber file selected from history list on
* current layer.
*/
void OnGbrFileHistory( wxCommandEvent& event ); void OnGbrFileHistory( wxCommandEvent& event );
/**
* Function OnDrlFileHistory
* deletes the current data and load a drill file in Excellon format selected from
* history list on current layer.
*/
void OnDrlFileHistory( wxCommandEvent& event ); void OnDrlFileHistory( wxCommandEvent& event );
/** /**
......
...@@ -29,8 +29,6 @@ extern int g_TabOneLayerMask[LAYER_COUNT]; ...@@ -29,8 +29,6 @@ extern int g_TabOneLayerMask[LAYER_COUNT];
/* Look up Table for conversion copper layer count -> general copper layer mask: */ /* Look up Table for conversion copper layer count -> general copper layer mask: */
extern int g_TabAllCopperLayerMask[NB_COPPER_LAYERS]; extern int g_TabAllCopperLayerMask[NB_COPPER_LAYERS];
extern wxArrayString g_LibName_List; // library list to load
extern DISPLAY_OPTIONS DisplayOpt; extern DISPLAY_OPTIONS DisplayOpt;
extern wxString g_SaveFileName; extern wxString g_SaveFileName;
...@@ -44,10 +42,7 @@ extern wxString g_ViaType_Name[4]; ...@@ -44,10 +42,7 @@ extern wxString g_ViaType_Name[4];
extern int g_CurrentVersionPCB; extern int g_CurrentVersionPCB;
extern int g_RotationAngle; extern int g_RotationAngle;
extern int g_TimeOut; // Timer for automatic saving
extern int g_SaveTime; // Time for next saving
/// List of segments of the trace currently being drawn. /// List of segments of the trace currently being drawn.
extern DLIST<TRACK> g_CurrentTrackList; extern DLIST<TRACK> g_CurrentTrackList;
......
...@@ -31,10 +31,10 @@ class GENERAL_COLLECTOR; ...@@ -31,10 +31,10 @@ class GENERAL_COLLECTOR;
class GENERAL_COLLECTORS_GUIDE; class GENERAL_COLLECTORS_GUIDE;
/******************************************************************/ /**
/* class PCB_BASE_FRAME: Basic class for pcbnew and gerbview */ * class PCB_BASE_FRAME
/******************************************************************/ * basic PCB main window class for PCBNew, Gerbview, and CvPcb footprint viewer.
*/
class PCB_BASE_FRAME : public EDA_DRAW_FRAME class PCB_BASE_FRAME : public EDA_DRAW_FRAME
{ {
public: public:
...@@ -84,7 +84,6 @@ public: ...@@ -84,7 +84,6 @@ public:
return m_Pcb; return m_Pcb;
} }
// General // General
virtual void OnCloseWindow( wxCloseEvent& Event ) = 0; virtual void OnCloseWindow( wxCloseEvent& Event ) = 0;
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) { } virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) { }
......
...@@ -42,13 +42,11 @@ class BOARD_ITEM; ...@@ -42,13 +42,11 @@ class BOARD_ITEM;
/** /**
* See also class PCB_BASE_FRAME(): Basic class for pcbnew and gerbview. * class PCB_EDIT_FRAME
* the main frame for PCBNew
*
* See also class PCB_BASE_FRAME(): Basic class for PCBNew and Gerbview.
*/ */
/*****************************************************/
/* class PCB_EDIT_FRAME: the main frame for Pcbnew */
/*****************************************************/
class PCB_EDIT_FRAME : public PCB_BASE_FRAME class PCB_EDIT_FRAME : public PCB_BASE_FRAME
{ {
friend class PCB_LAYER_WIDGET; friend class PCB_LAYER_WIDGET;
...@@ -59,6 +57,10 @@ class PCB_EDIT_FRAME : public PCB_BASE_FRAME ...@@ -59,6 +57,10 @@ class PCB_EDIT_FRAME : public PCB_BASE_FRAME
int m_RecordingMacros; int m_RecordingMacros;
MACROS_RECORDED m_Macros[10]; MACROS_RECORDED m_Macros[10];
int m_saveInterval; ///< Time interval in seconds for automatic saving.
int m_lastSaveTime; ///< Last save time.
wxArrayString m_libraryNames; ///< List of footprint library names to load.
protected: protected:
PCB_LAYER_WIDGET* m_Layers; PCB_LAYER_WIDGET* m_Layers;
...@@ -227,11 +229,31 @@ public: ...@@ -227,11 +229,31 @@ public:
*/ */
virtual void SetGridColor(int aColor); virtual void SetGridColor(int aColor);
void ResetAutoSaveTimeOut() { m_lastSaveTime = time( NULL ); }
int GetAutoSaveTimeInterval() { return m_saveInterval; }
void SetAutoSaveTimeInterval( int aInterval ) { m_saveInterval = aInterval; }
wxArrayString& GetFootprintLibraryNames() { return m_libraryNames; }
// Configurations: // Configurations:
void InstallConfigFrame(); void InstallConfigFrame();
void Process_Config( wxCommandEvent& event ); void Process_Config( wxCommandEvent& event );
/**
* Function GetProjectFileParameters
* returns the project file parameter list for PCBNew.
* <p>
* Populate the project file parameter array specific to PCBNew if it hasn't
* already been populated and return a reference to the array to the caller.
* Creating the parameter list at run time has the advantage of being able
* to define local variables. The old method of statically building the array
* at compile time requiring global variable definitions by design.
* </p>
*/
PARAM_CFG_ARRAY& GetProjectFileParameters(); PARAM_CFG_ARRAY& GetProjectFileParameters();
void SaveProjectSettings(); void SaveProjectSettings();
/** /**
...@@ -244,14 +266,28 @@ public: ...@@ -244,14 +266,28 @@ public:
bool LoadProjectSettings( const wxString& aProjectFileName ); bool LoadProjectSettings( const wxString& aProjectFileName );
/** /**
* Get the list of application specific settings. * Function GetConfigurationSettings
* returns the PCBNew applications settings list.
*
* This replaces the old statically define list that had the project
* file settings and the application settings mixed together. This
* was confusing and caused some settings to get saved and loaded
* incorrectly. Currently, only the settings that are needed at start
* up by the main window are defined here. There are other locally used
* settings are scattered throughout the PCBNew source code. If you need
* to define a configuration setting that need to be loaded at run time,
* this is the place to define it.
* *
* @todo: Define the configuration variables as member variables instead of
* global variables or move them to the object class where they are
* used.
* @return - Reference to the list of applications settings. * @return - Reference to the list of applications settings.
*/ */
PARAM_CFG_ARRAY& GetConfigurationSettings(); PARAM_CFG_ARRAY& GetConfigurationSettings();
/** /**
* Load applications settings specific to PCBNew. * Function LoadSettings
* loads applications settings specific to PCBNew.
* *
* This overrides the base class PCB_BASE_FRAME::LoadSettings() to * This overrides the base class PCB_BASE_FRAME::LoadSettings() to
* handle settings specific common to the PCB layout application. It * handle settings specific common to the PCB layout application. It
...@@ -262,7 +298,8 @@ public: ...@@ -262,7 +298,8 @@ public:
virtual void LoadSettings(); virtual void LoadSettings();
/** /**
* Save applications settings common to PCBNew. * Function SaveSettings
* saves applications settings common to PCBNew.
* *
* This overrides the base class PCB_BASE_FRAME::SaveSettings() to * This overrides the base class PCB_BASE_FRAME::SaveSettings() to
* save settings specific to the PCB layout application main window. It * save settings specific to the PCB layout application main window. It
...@@ -335,7 +372,7 @@ public: ...@@ -335,7 +372,7 @@ public:
* An item can be placed only if there is this item currently edited * An item can be placed only if there is this item currently edited
* Only a footprint, a pad or a track can be placed * Only a footprint, a pad or a track can be placed
* @param aDC = current device context * @param aDC = current device context
* @return true if an item was placedd * @return true if an item was placed
*/ */
bool OnHotkeyPlaceItem( wxDC* aDC ); bool OnHotkeyPlaceItem( wxDC* aDC );
......
...@@ -247,10 +247,10 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH ...@@ -247,10 +247,10 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
if( !GetScreen()->IsModify() || GetScreen()->IsSave() ) if( !GetScreen()->IsModify() || GetScreen()->IsSave() )
{ {
/* If no change, reset the time out */ /* If no change, reset the time out */
g_SaveTime = CurrentTime; m_lastSaveTime = CurrentTime;
} }
if( (CurrentTime - g_SaveTime) > g_TimeOut ) if( (CurrentTime - m_lastSaveTime) > m_saveInterval )
{ {
wxString tmpFileName = GetScreen()->GetFileName(); wxString tmpFileName = GetScreen()->GetFileName();
wxFileName fn = wxFileName( wxEmptyString, g_SaveFileName, PcbFileExtension ); wxFileName fn = wxFileName( wxEmptyString, g_SaveFileName, PcbFileExtension );
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
Dialog_GeneralOptions::Dialog_GeneralOptions( PCB_EDIT_FRAME* parent ) : Dialog_GeneralOptions::Dialog_GeneralOptions( PCB_EDIT_FRAME* parent ) :
DialogGeneralOptionsBoardEditor_base( parent ) DialogGeneralOptionsBoardEditor_base( parent )
{ {
m_Parent = parent;
init(); init();
m_buttonOK->SetDefault(); m_buttonOK->SetDefault();
...@@ -37,12 +36,12 @@ void Dialog_GeneralOptions::init() ...@@ -37,12 +36,12 @@ void Dialog_GeneralOptions::init()
{ {
SetFocus(); SetFocus();
m_Board = m_Parent->GetBoard(); m_Board = GetParent()->GetBoard();
/* Set display options */ /* Set display options */
m_PolarDisplay->SetSelection( DisplayOpt.DisplayPolarCood ? 1 : 0 ); m_PolarDisplay->SetSelection( DisplayOpt.DisplayPolarCood ? 1 : 0 );
m_UnitsSelection->SetSelection( g_UserUnit ? 1 : 0 ); m_UnitsSelection->SetSelection( g_UserUnit ? 1 : 0 );
m_CursorShape->SetSelection( m_Parent->m_CursorShape ? 1 : 0 ); m_CursorShape->SetSelection( GetParent()->m_CursorShape ? 1 : 0 );
switch( g_RotationAngle ) switch( g_RotationAngle )
...@@ -50,22 +49,23 @@ void Dialog_GeneralOptions::init() ...@@ -50,22 +49,23 @@ void Dialog_GeneralOptions::init()
case 450: case 450:
m_RotationAngle->SetSelection( 0 ); m_RotationAngle->SetSelection( 0 );
break; break;
default: default:
m_RotationAngle->SetSelection( 1 ); m_RotationAngle->SetSelection( 1 );
} }
wxString timevalue; wxString timevalue;
timevalue << g_TimeOut / 60; timevalue << GetParent()->GetAutoSaveTimeInterval() / 60;
m_SaveTime->SetValue( timevalue ); m_SaveTime->SetValue( timevalue );
m_MaxShowLinks->SetValue( g_MaxLinksShowed ); m_MaxShowLinks->SetValue( g_MaxLinksShowed );
m_DrcOn->SetValue( Drc_On ); m_DrcOn->SetValue( Drc_On );
m_ShowModuleRatsnest->SetValue( g_Show_Module_Ratsnest ); m_ShowModuleRatsnest->SetValue( g_Show_Module_Ratsnest );
m_ShowGlobalRatsnest->SetValue( m_Board->IsElementVisible(RATSNEST_VISIBLE) ); m_ShowGlobalRatsnest->SetValue( m_Board->IsElementVisible( RATSNEST_VISIBLE ) );
m_TrackAutodel->SetValue( g_AutoDeleteOldTrack ); m_TrackAutodel->SetValue( g_AutoDeleteOldTrack );
m_Track_45_Only_Ctrl->SetValue( g_Track_45_Only_Allowed ); m_Track_45_Only_Ctrl->SetValue( g_Track_45_Only_Allowed );
m_Segments_45_Only_Ctrl->SetValue( Segments_45_Only ); m_Segments_45_Only_Ctrl->SetValue( Segments_45_Only );
m_AutoPANOpt->SetValue( m_Parent->DrawPanel->m_AutoPAN_Enable ); m_AutoPANOpt->SetValue( GetParent()->DrawPanel->m_AutoPAN_Enable );
m_Segments_45_Only_Ctrl->SetValue( Segments_45_Only ); m_Segments_45_Only_Ctrl->SetValue( Segments_45_Only );
m_Track_DoubleSegm_Ctrl->SetValue( g_TwoSegmentTrackBuild ); m_Track_DoubleSegm_Ctrl->SetValue( g_TwoSegmentTrackBuild );
...@@ -90,11 +90,10 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event ) ...@@ -90,11 +90,10 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event )
g_UserUnit = ( m_UnitsSelection->GetSelection() == 0 ) ? INCHES : MILLIMETRES; g_UserUnit = ( m_UnitsSelection->GetSelection() == 0 ) ? INCHES : MILLIMETRES;
if( ii != g_UserUnit ) if( ii != g_UserUnit )
m_Parent->ReCreateAuxiliaryToolbar(); GetParent()->ReCreateAuxiliaryToolbar();
m_Parent->m_CursorShape = m_CursorShape->GetSelection();
g_TimeOut = 60 * m_SaveTime->GetValue();
GetParent()->m_CursorShape = m_CursorShape->GetSelection();
GetParent()->SetAutoSaveTimeInterval( 60 * m_SaveTime->GetValue() );
g_RotationAngle = 10 * wxAtoi( m_RotationAngle->GetStringSelection() ); g_RotationAngle = 10 * wxAtoi( m_RotationAngle->GetStringSelection() );
...@@ -104,15 +103,15 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event ) ...@@ -104,15 +103,15 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event )
if( m_Board->IsElementVisible(RATSNEST_VISIBLE) != m_ShowGlobalRatsnest->GetValue() ) if( m_Board->IsElementVisible(RATSNEST_VISIBLE) != m_ShowGlobalRatsnest->GetValue() )
{ {
m_Parent->SetElementVisibility(RATSNEST_VISIBLE, m_ShowGlobalRatsnest->GetValue() ); GetParent()->SetElementVisibility(RATSNEST_VISIBLE, m_ShowGlobalRatsnest->GetValue() );
m_Parent->DrawPanel->Refresh( ); GetParent()->DrawPanel->Refresh( );
} }
g_Show_Module_Ratsnest = m_ShowModuleRatsnest->GetValue(); g_Show_Module_Ratsnest = m_ShowModuleRatsnest->GetValue();
g_AutoDeleteOldTrack = m_TrackAutodel->GetValue(); g_AutoDeleteOldTrack = m_TrackAutodel->GetValue();
Segments_45_Only = m_Segments_45_Only_Ctrl->GetValue(); Segments_45_Only = m_Segments_45_Only_Ctrl->GetValue();
g_Track_45_Only_Allowed = m_Track_45_Only_Ctrl->GetValue(); g_Track_45_Only_Allowed = m_Track_45_Only_Ctrl->GetValue();
m_Parent->DrawPanel->m_AutoPAN_Enable = m_AutoPANOpt->GetValue(); GetParent()->DrawPanel->m_AutoPAN_Enable = m_AutoPANOpt->GetValue();
g_TwoSegmentTrackBuild = m_Track_DoubleSegm_Ctrl->GetValue(); g_TwoSegmentTrackBuild = m_Track_DoubleSegm_Ctrl->GetValue();
g_MagneticPadOption = m_MagneticPadOptCtrl->GetSelection(); g_MagneticPadOption = m_MagneticPadOptCtrl->GetSelection();
...@@ -134,6 +133,7 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -134,6 +133,7 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
{ {
case ID_TB_OPTIONS_DRC_OFF: case ID_TB_OPTIONS_DRC_OFF:
Drc_On = !state; Drc_On = !state;
if( GetToolId() == ID_TRACK_BUTT ) if( GetToolId() == ID_TRACK_BUTT )
{ {
if( Drc_On ) if( Drc_On )
...@@ -141,14 +141,17 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -141,14 +141,17 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
else else
DrawPanel->SetCursor( wxCURSOR_QUESTION_ARROW ); DrawPanel->SetCursor( wxCURSOR_QUESTION_ARROW );
} }
break; break;
case ID_TB_OPTIONS_SHOW_RATSNEST: case ID_TB_OPTIONS_SHOW_RATSNEST:
SetElementVisibility( RATSNEST_VISIBLE, state ); SetElementVisibility( RATSNEST_VISIBLE, state );
if( state && (GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 ) if( state && (GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
{ {
Compile_Ratsnest( NULL, true ); Compile_Ratsnest( NULL, true );
} }
DrawPanel->Refresh(); DrawPanel->Refresh();
break; break;
...@@ -204,7 +207,7 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) ...@@ -204,7 +207,7 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG, GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
m_show_layer_manager_tools ? m_show_layer_manager_tools ?
_("Hide &Layers Manager" ) : _("Show &Layers Manager" ) ); _( "Hide &Layers Manager" ) : _( "Show &Layers Manager" ) );
break; break;
default: default:
......
...@@ -3,13 +3,10 @@ ...@@ -3,13 +3,10 @@
#include "dialog_general_options_BoardEditor_base.h" #include "dialog_general_options_BoardEditor_base.h"
/***********************************************************************/
class Dialog_GeneralOptions : public DialogGeneralOptionsBoardEditor_base class Dialog_GeneralOptions : public DialogGeneralOptionsBoardEditor_base
/***********************************************************************/
{ {
private: private:
PCB_EDIT_FRAME* m_Parent; BOARD* m_Board;
BOARD * m_Board;
void init(); void init();
...@@ -18,6 +15,8 @@ public: ...@@ -18,6 +15,8 @@ public:
~Dialog_GeneralOptions() {}; ~Dialog_GeneralOptions() {};
void OnOkClick( wxCommandEvent& event ); void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event ); void OnCancelClick( wxCommandEvent& event );
PCB_EDIT_FRAME* GetParent() { return (PCB_EDIT_FRAME*) wxDialog::GetParent(); }
}; };
......
...@@ -12,8 +12,7 @@ ...@@ -12,8 +12,7 @@
class DIALOG_PCBNEW_CONFIG_LIBS : public DIALOG_PCBNEW_CONFIG_LIBS_FBP class DIALOG_PCBNEW_CONFIG_LIBS : public DIALOG_PCBNEW_CONFIG_LIBS_FBP
{ {
private: private:
PCB_EDIT_FRAME* m_Parent; wxConfig* m_Config;
wxConfig * m_Config;
bool m_LibListChanged; bool m_LibListChanged;
bool m_LibPathChanged; bool m_LibPathChanged;
wxString m_UserLibDirBufferImg; // Copy of original g_UserLibDirBuffer wxString m_UserLibDirBufferImg; // Copy of original g_UserLibDirBuffer
...@@ -38,6 +37,8 @@ private: ...@@ -38,6 +37,8 @@ private:
public: public:
DIALOG_PCBNEW_CONFIG_LIBS( PCB_EDIT_FRAME * parent ); DIALOG_PCBNEW_CONFIG_LIBS( PCB_EDIT_FRAME * parent );
~DIALOG_PCBNEW_CONFIG_LIBS() {}; ~DIALOG_PCBNEW_CONFIG_LIBS() {};
PCB_EDIT_FRAME* GetParent() { return (PCB_EDIT_FRAME*) wxDialog::GetParent(); }
}; };
#endif // _DIALOG_PCBNEW_CONFIG_LIBS_H_ #endif // _DIALOG_PCBNEW_CONFIG_LIBS_H_
...@@ -285,7 +285,7 @@ this file again." ) ); ...@@ -285,7 +285,7 @@ this file again." ) );
GetBoard()->DisplayInfo( this ); GetBoard()->DisplayInfo( this );
/* reset the auto save timer */ /* reset the auto save timer */
g_SaveTime = time( NULL ); m_lastSaveTime = time( NULL );
// Refresh the 3D view, if any // Refresh the 3D view, if any
if( m_Draw3DFrame ) if( m_Draw3DFrame )
...@@ -407,7 +407,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName ) ...@@ -407,7 +407,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName )
ClearMsgPanel(); ClearMsgPanel();
AppendMsgPanel( upperTxt, lowerTxt, CYAN ); AppendMsgPanel( upperTxt, lowerTxt, CYAN );
g_SaveTime = time( NULL ); /* Reset timer for the automatic saving */ m_lastSaveTime = time( NULL ); /* Reset timer for the automatic saving */
GetScreen()->ClrModify(); GetScreen()->ClrModify();
return true; return true;
......
/****************************************/ /**
/* Manage module (footprint) libraries. */ * @file librairi.cpp
/****************************************/ * @brief Manage module (footprint) libraries.
*/
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
...@@ -238,7 +239,8 @@ void FOOTPRINT_EDIT_FRAME::Delete_Module_In_Library( const wxString& aLibname ) ...@@ -238,7 +239,8 @@ void FOOTPRINT_EDIT_FRAME::Delete_Module_In_Library( const wxString& aLibname )
{ {
fclose( lib_module ); fclose( lib_module );
wxString msg; wxString msg;
msg.Printf( _( "%s is not a Library file" ), GetChars(oldFileName.GetFullPath()) ); msg.Printf( _( "%s is not a valid footprint library file" ),
GetChars( oldFileName.GetFullPath() ) );
DisplayError( this, msg ); DisplayError( this, msg );
return; return;
} }
...@@ -324,14 +326,16 @@ void FOOTPRINT_EDIT_FRAME::Delete_Module_In_Library( const wxString& aLibname ) ...@@ -324,14 +326,16 @@ void FOOTPRINT_EDIT_FRAME::Delete_Module_In_Library( const wxString& aLibname )
if( !wxRenameFile( oldFileName.GetFullPath(), backupFileName.GetFullPath() ) ) if( !wxRenameFile( oldFileName.GetFullPath(), backupFileName.GetFullPath() ) )
{ {
DisplayError( this, wxT( "Librairi.cpp: rename .bak err" ) ); DisplayError( this, _( "Could not create library back up file <" ) +
backupFileName.GetFullName() + wxT( ">." ) );
return; return;
} }
/* The temporary file is renamed as the previous library. */ /* The temporary file is renamed as the previous library. */
if( !wxRenameFile( newFileName.GetFullPath(), oldFileName.GetFullPath() ) ) if( !wxRenameFile( newFileName.GetFullPath(), oldFileName.GetFullPath() ) )
{ {
DisplayError( this, wxT( "Librairi.cpp: rename err 2" ) ); DisplayError( this, _( "Could not create temporary library file <" ) +
oldFileName.GetFullName() + wxT( ">." ) );
return; return;
} }
...@@ -349,7 +353,7 @@ void PCB_BASE_FRAME::Archive_Modules( const wxString& LibName, bool NewModulesOn ...@@ -349,7 +353,7 @@ void PCB_BASE_FRAME::Archive_Modules( const wxString& LibName, bool NewModulesOn
if( GetBoard()->m_Modules == NULL ) if( GetBoard()->m_Modules == NULL )
{ {
DisplayInfoMessage( this, _( " No modules to archive!" ) ); DisplayInfoMessage( this, _( "No modules to archive!" ) );
return; return;
} }
...@@ -498,7 +502,7 @@ bool PCB_BASE_FRAME::Save_Module_In_Library( const wxString& aLibName, ...@@ -498,7 +502,7 @@ bool PCB_BASE_FRAME::Save_Module_In_Library( const wxString& aLibName,
if( ! input_lib.IsLibrary() ) if( ! input_lib.IsLibrary() )
{ {
fclose( lib_module ); fclose( lib_module );
msg.Printf( _( "File %s is not a eeschema library" ), GetChars( aLibName ) ); msg.Printf( _( "File %s is not an EESchema library" ), GetChars( aLibName ) );
DisplayError( this, msg ); DisplayError( this, msg );
return false; return false;
} }
...@@ -616,12 +620,14 @@ bool PCB_BASE_FRAME::Save_Module_In_Library( const wxString& aLibName, ...@@ -616,12 +620,14 @@ bool PCB_BASE_FRAME::Save_Module_In_Library( const wxString& aLibName,
wxRemoveFile( oldFileName.GetFullPath() ); wxRemoveFile( oldFileName.GetFullPath() );
if( !wxRenameFile( aLibName, oldFileName.GetFullPath() ) ) if( !wxRenameFile( aLibName, oldFileName.GetFullPath() ) )
DisplayError( this, wxT( "Librairi.cpp: rename .bak err" ) ); DisplayError( this, _( "Could not create library back up file <" ) +
oldFileName.GetFullName() + wxT( ">." ) );
/* The new library file is renamed */ /* The new library file is renamed */
if( !wxRenameFile( newFileName.GetFullPath(), aLibName ) ) if( !wxRenameFile( newFileName.GetFullPath(), aLibName ) )
{ {
DisplayError( this, wxT( "Librairi.cpp: rename NewLib err" ) ); DisplayError( this, _( "Could not create temporary library file <" ) +
aLibName + wxT( ">." ) );
return false; return false;
} }
...@@ -656,6 +662,7 @@ MODULE* PCB_BASE_FRAME::Create_1_Module( const wxString& aModuleName ) ...@@ -656,6 +662,7 @@ MODULE* PCB_BASE_FRAME::Create_1_Module( const wxString& aModuleName )
moduleName = dlg.GetValue(); moduleName = dlg.GetValue();
} }
moduleName.Trim( true ); moduleName.Trim( true );
moduleName.Trim( false ); moduleName.Trim( false );
...@@ -698,11 +705,13 @@ MODULE* PCB_BASE_FRAME::Create_1_Module( const wxString& aModuleName ) ...@@ -698,11 +705,13 @@ MODULE* PCB_BASE_FRAME::Create_1_Module( const wxString& aModuleName )
void FOOTPRINT_EDIT_FRAME::Select_Active_Library() void FOOTPRINT_EDIT_FRAME::Select_Active_Library()
{ {
wxString msg; wxString msg;
PCB_EDIT_FRAME* parent = (PCB_EDIT_FRAME*) GetParent();
if( g_LibName_List.GetCount() == 0 ) if( parent->GetFootprintLibraryNames().GetCount() == 0 || parent == NULL )
return; return;
EDA_LIST_DIALOG dlg( this, _( "Select Active Library:" ), g_LibName_List, m_CurrentLib ); EDA_LIST_DIALOG dlg( this, _( "Select Active Library:" ),
parent->GetFootprintLibraryNames(), m_CurrentLib );
if( dlg.ShowModal() != wxID_OK ) if( dlg.ShowModal() != wxID_OK )
return; return;
...@@ -726,7 +735,7 @@ void FOOTPRINT_EDIT_FRAME::Select_Active_Library() ...@@ -726,7 +735,7 @@ void FOOTPRINT_EDIT_FRAME::Select_Active_Library()
} }
int FOOTPRINT_EDIT_FRAME::Create_Librairie( const wxString& aLibName ) int FOOTPRINT_EDIT_FRAME::CreateLibrary( const wxString& aLibName )
{ {
FILE* lib_module; FILE* lib_module;
wxString msg; wxString msg;
......
...@@ -193,13 +193,15 @@ MODULE* PCB_BASE_FRAME::GetModuleLibrary( const wxString& aLibraryFullFilename, ...@@ -193,13 +193,15 @@ MODULE* PCB_BASE_FRAME::GetModuleLibrary( const wxString& aLibraryFullFilename,
FILE* file = NULL; FILE* file = NULL;
unsigned ii; unsigned ii;
bool one_lib = aLibraryFullFilename.IsEmpty() ? false : true; bool one_lib = aLibraryFullFilename.IsEmpty() ? false : true;
PCB_EDIT_FRAME* parent = (PCB_EDIT_FRAME*) GetParent();
for( ii = 0; ii < g_LibName_List.GetCount(); ii++ ) for( ii = 0; ii < parent->GetFootprintLibraryNames().GetCount(); ii++ )
{ {
if( one_lib ) if( one_lib )
fn = aLibraryFullFilename; fn = aLibraryFullFilename;
else else
fn = wxFileName( wxEmptyString, g_LibName_List[ii], ModuleFileExtension ); fn = wxFileName( wxEmptyString, parent->GetFootprintLibraryNames()[ii],
ModuleFileExtension );
tmp = wxGetApp().FindLibraryPath( fn ); tmp = wxGetApp().FindLibraryPath( fn );
...@@ -300,9 +302,10 @@ wxString PCB_BASE_FRAME::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow, ...@@ -300,9 +302,10 @@ wxString PCB_BASE_FRAME::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow,
wxString CmpName; wxString CmpName;
wxString msg; wxString msg;
wxArrayString libnames_list; wxArrayString libnames_list;
PCB_EDIT_FRAME* parent = (PCB_EDIT_FRAME*) GetParent();
if( aLibraryFullFilename.IsEmpty() ) if( aLibraryFullFilename.IsEmpty() )
libnames_list = g_LibName_List; libnames_list = parent->GetFootprintLibraryNames();
else else
libnames_list.Add( aLibraryFullFilename ); libnames_list.Add( aLibraryFullFilename );
......
/**
/*****************************************************/ * @file module_editor_frame.h
/* class FOOTPRINT_EDIT_FRAME: public EDA_DRAW_FRAME */ * @brief Definition of class FOOTPRINT_EDIT_FRAME.
/* Class for the footprint editor */ */
/*****************************************************/
#ifndef _MODULE_EDITOR_FRAME_H_ #ifndef _MODULE_EDITOR_FRAME_H_
#define _MODULE_EDITOR_FRAME_H_ #define _MODULE_EDITOR_FRAME_H_
...@@ -30,7 +29,7 @@ public: ...@@ -30,7 +29,7 @@ public:
/** /**
* Function RedrawActiveWindoow * Function RedrawActiveWindoow
* daws the footprint editor BOARD, and others elements such as axis and grid. * draws the footprint editor BOARD, and others elements such as axis and grid.
*/ */
void RedrawActiveWindow( wxDC* DC, bool EraseBg ); void RedrawActiveWindow( wxDC* DC, bool EraseBg );
...@@ -76,8 +75,7 @@ public: ...@@ -76,8 +75,7 @@ public:
* case insensitive * case insensitive
* </p> * </p>
*/ */
void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
EDA_ITEM* aItem = NULL );
bool OnHotkeyEditItem( int aIdCommand ); bool OnHotkeyEditItem( int aIdCommand );
bool OnHotkeyDeleteItem( int aIdCommand ); bool OnHotkeyDeleteItem( int aIdCommand );
...@@ -263,7 +261,7 @@ public: ...@@ -263,7 +261,7 @@ public:
/** /**
* Function Load_Module_From_BOARD * Function Load_Module_From_BOARD
* load in Modedit a footfrint from the main board * load in Modedit a footprint from the main board
* @param Module = the module to load. If NULL, a module reference will we asked to user * @param Module = the module to load. If NULL, a module reference will we asked to user
* @return true if a module isloaded, false otherwise. * @return true if a module isloaded, false otherwise.
*/ */
...@@ -330,7 +328,7 @@ public: ...@@ -330,7 +328,7 @@ public:
*/ */
void Enter_Edge_Width( EDGE_MODULE* aEdge ); void Enter_Edge_Width( EDGE_MODULE* aEdge );
/* Function to initialise the move function params of a graphic item type DRAWSEGMENT */ /* Function to initialize the move function params of a graphic item type DRAWSEGMENT */
void Start_Move_EdgeMod( EDGE_MODULE* drawitem, wxDC* DC ); void Start_Move_EdgeMod( EDGE_MODULE* drawitem, wxDC* DC );
/* Function to place a graphic item type EDGE_MODULE currently moved */ /* Function to place a graphic item type EDGE_MODULE currently moved */
...@@ -338,7 +336,9 @@ public: ...@@ -338,7 +336,9 @@ public:
// handlers for libraries: // handlers for libraries:
void Delete_Module_In_Library( const wxString& libname ); void Delete_Module_In_Library( const wxString& libname );
int Create_Librairie( const wxString& LibName );
int CreateLibrary( const wxString& LibName );
void Select_Active_Library(); void Select_Active_Library();
wxString GetCurrentLib() const { return m_CurrentLib; }; wxString GetCurrentLib() const { return m_CurrentLib; };
...@@ -347,4 +347,3 @@ public: ...@@ -347,4 +347,3 @@ public:
}; };
#endif // #define _MODULE_EDITOR_FRAME_H_ #endif // #define _MODULE_EDITOR_FRAME_H_
/*************************/ /**
/* PCBNEW: main program */ * @file pcbnew.cpp
/*************************/ * @file PCBNEW: main program.
*/
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
...@@ -48,7 +49,7 @@ int g_MaxLinksShowed; ...@@ -48,7 +49,7 @@ int g_MaxLinksShowed;
int g_MagneticPadOption = capture_cursor_in_track_tool; int g_MagneticPadOption = capture_cursor_in_track_tool;
int g_MagneticTrackOption = capture_cursor_in_track_tool; int g_MagneticTrackOption = capture_cursor_in_track_tool;
wxPoint g_Offset_Module; /* Offset de trace du modul en depl */ wxPoint g_Offset_Module; /* Distance to offset module trace when moving. */
// Wildcard for footprint libraries filesnames // Wildcard for footprint libraries filesnames
const wxString g_FootprintLibFileWildcard( wxT( "Kicad footprint library file (*.mod)|*.mod" ) ); const wxString g_FootprintLibFileWildcard( wxT( "Kicad footprint library file (*.mod)|*.mod" ) );
...@@ -62,6 +63,7 @@ wxString g_DocModulesFileName = wxT( "footprints_doc/footprints.pdf" ); ...@@ -62,6 +63,7 @@ wxString g_DocModulesFileName = wxT( "footprints_doc/footprints.pdf" );
IMPLEMENT_APP( EDA_APP ) IMPLEMENT_APP( EDA_APP )
/* MacOSX: Needed for file association /* MacOSX: Needed for file association
* http://wiki.wxwidgets.org/WxMac-specific_topics * http://wiki.wxwidgets.org/WxMac-specific_topics
*/ */
...@@ -82,11 +84,11 @@ bool EDA_APP::OnInit() ...@@ -82,11 +84,11 @@ bool EDA_APP::OnInit()
wxFileName fn; wxFileName fn;
PCB_EDIT_FRAME* frame = NULL; PCB_EDIT_FRAME* frame = NULL;
InitEDA_Appl( wxT( "PCBnew" ), APP_PCBNEW_T ); InitEDA_Appl( wxT( "PCBNew" ), APP_PCBNEW_T );
if( m_Checker && m_Checker->IsAnotherRunning() ) if( m_Checker && m_Checker->IsAnotherRunning() )
{ {
if( !IsOK( NULL, _( "PCBnew is already running, Continue?" ) ) ) if( !IsOK( NULL, _( "PCBNew is already running, Continue?" ) ) )
return false; return false;
} }
...@@ -113,7 +115,7 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) ); ...@@ -113,7 +115,7 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) );
/* Must be called before creating the main frame in order to /* Must be called before creating the main frame in order to
* display the real hotkeys in menus or tool tips */ * display the real hotkeys in menus or tool tips */
ReadHotkeyConfig( wxT("PcbFrame"), g_Board_Editor_Hokeys_Descr ); ReadHotkeyConfig( wxT( "PcbFrame" ), g_Board_Editor_Hokeys_Descr );
frame = new PCB_EDIT_FRAME( NULL, wxT( "PCBNew" ), wxPoint( 0, 0 ), wxSize( 600, 400 ) ); frame = new PCB_EDIT_FRAME( NULL, wxT( "PCBNew" ), wxPoint( 0, 0 ), wxSize( 600, 400 ) );
frame->UpdateTitle(); frame->UpdateTitle();
...@@ -147,7 +149,7 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) ); ...@@ -147,7 +149,7 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) );
frame->UpdateTitle(); frame->UpdateTitle();
frame->UpdateFileHistory( frame->GetScreen()->GetFileName() ); frame->UpdateFileHistory( frame->GetScreen()->GetFileName() );
frame->OnModify(); // Ready to save the new empty board frame->OnModify(); // Ready to save the new empty board
g_SaveTime = time( NULL ); // Init the time out to save the board frame->ResetAutoSaveTimeOut();
wxString msg; wxString msg;
msg.Printf( _( "File <%s> does not exist.\nThis is normal for a new project" ), msg.Printf( _( "File <%s> does not exist.\nThis is normal for a new project" ),
...@@ -157,6 +159,7 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) ); ...@@ -157,6 +159,7 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) );
} }
frame->LoadProjectSettings( fn.GetFullPath() ); frame->LoadProjectSettings( fn.GetFullPath() );
// update the layer names in the listbox // update the layer names in the listbox
frame->ReCreateLayerBox( NULL ); frame->ReCreateLayerBox( NULL );
......
...@@ -135,14 +135,6 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event ) ...@@ -135,14 +135,6 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
} }
/**
* Read the project configuration file settings.
*
* @param aProjectFileName = The project file name to load. If aProjectFileName
* is not found load the default project file kicad.pro
* and initialize setting to their default value.
* @return Always returns true.
*/
bool PCB_EDIT_FRAME::LoadProjectSettings( const wxString& aProjectFileName ) bool PCB_EDIT_FRAME::LoadProjectSettings( const wxString& aProjectFileName )
{ {
wxFileName fn = aProjectFileName; wxFileName fn = aProjectFileName;
...@@ -153,17 +145,16 @@ bool PCB_EDIT_FRAME::LoadProjectSettings( const wxString& aProjectFileName ) ...@@ -153,17 +145,16 @@ bool PCB_EDIT_FRAME::LoadProjectSettings( const wxString& aProjectFileName )
wxGetApp().RemoveLibraryPath( g_UserLibDirBuffer ); wxGetApp().RemoveLibraryPath( g_UserLibDirBuffer );
/* Initialize default values. */ /* Initialize default values. */
g_LibName_List.Clear(); m_libraryNames.Clear();
wxGetApp().ReadProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters(), false ); wxGetApp().ReadProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters(), false );
/* User library path takes precedent over default library search paths. */ /* User library path takes precedent over default library search paths. */
wxGetApp().InsertLibraryPath( g_UserLibDirBuffer, 1 ); wxGetApp().InsertLibraryPath( g_UserLibDirBuffer, 1 );
/* Reset the items visibility flag when loading a new config /* Reset the items visibility flag when loading a new configuration because it could
* Because it could creates SERIOUS mistakes for the user, * create SERIOUS mistakes for the user f board items are not visible after loading
* if board items are not visible after loading a board... * a board. Grid and ratsnest can be left to their previous state.
* Grid and ratsnest can be left to their previous state
*/ */
bool showGrid = IsElementVisible( GRID_VISIBLE ); bool showGrid = IsElementVisible( GRID_VISIBLE );
bool showRats = IsElementVisible( RATSNEST_VISIBLE ); bool showRats = IsElementVisible( RATSNEST_VISIBLE );
...@@ -191,15 +182,6 @@ void PCB_EDIT_FRAME::SaveProjectSettings() ...@@ -191,15 +182,6 @@ void PCB_EDIT_FRAME::SaveProjectSettings()
} }
/**
* Return project file parameter list for PCBNew.
*
* Populate the project file parameter array specific to PCBNew if it hasn't
* already been populated and return a reference to the array to the caller.
* Creating the parameter list at run time has the advantage of being able
* to define local variables. The old method of statically building the array
* at compile time requiring global variable definitions by design.
*/
PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetProjectFileParameters() PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetProjectFileParameters()
{ {
if( !m_projectFileParams.empty() ) if( !m_projectFileParams.empty() )
...@@ -207,7 +189,8 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetProjectFileParameters() ...@@ -207,7 +189,8 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetProjectFileParameters()
m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "LibDir" ),&g_UserLibDirBuffer, m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "LibDir" ),&g_UserLibDirBuffer,
GROUPLIB ) ); GROUPLIB ) );
m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST( wxT( "LibName" ), &g_LibName_List, m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST( wxT( "LibName" ),
&m_libraryNames,
GROUPLIB ) ); GROUPLIB ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "PadDrlX" ), &g_Pad_Master.m_Drill.x, m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "PadDrlX" ), &g_Pad_Master.m_Drill.x,
320, 0, 0x7FFF ) ); 320, 0, 0x7FFF ) );
...@@ -251,22 +234,6 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetProjectFileParameters() ...@@ -251,22 +234,6 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetProjectFileParameters()
/*
* Return the PCBNew applications settings list.
*
* This replaces the old statically define list that had the project
* file settings and the application settings mixed together. This
* was confusing and caused some settings to get saved and loaded
* incorrectly. Currently, only the settings that are needed at start
* up by the main window are defined here. There are other locally used
* settings are scattered throughout the PCBNew source code. If you need
* to define a configuration setting that need to be loaded at run time,
* this is the place to define it.
*
* @todo: Define the configuration variables as member variables instead of
* global variables or move them to the object class where they are
* used.
*/
PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings() PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings()
{ {
if( !m_configSettings.empty() ) if( !m_configSettings.empty() )
...@@ -401,7 +368,7 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings() ...@@ -401,7 +368,7 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings()
// Miscellaneous: // Miscellaneous:
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "RotationAngle" ), &g_RotationAngle, m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "RotationAngle" ), &g_RotationAngle,
900, 450, 900 ) ); 900, 450, 900 ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "TimeOut" ), &g_TimeOut, m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "TimeOut" ), &m_saveInterval,
600, 0, 60000 ) ); 600, 0, 60000 ) );
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "MaxLnkS" ), &g_MaxLinksShowed, m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "MaxLnkS" ), &g_MaxLinksShowed,
3, 0, 15 ) ); 3, 0, 15 ) );
...@@ -415,8 +382,6 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings() ...@@ -415,8 +382,6 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings()
} }
/**
*/
void PCB_EDIT_FRAME::SaveMacros() void PCB_EDIT_FRAME::SaveMacros()
{ {
wxFileName fn; wxFileName fn;
...@@ -462,13 +427,11 @@ void PCB_EDIT_FRAME::SaveMacros() ...@@ -462,13 +427,11 @@ void PCB_EDIT_FRAME::SaveMacros()
} }
} }
xml.SetFileEncoding( wxT("UTF-8") ); xml.SetFileEncoding( wxT( "UTF-8" ) );
xml.Save( dlg.GetFilename() ); xml.Save( dlg.GetFilename() );
} }
/**
*/
void PCB_EDIT_FRAME::ReadMacros() void PCB_EDIT_FRAME::ReadMacros()
{ {
wxString str; wxString str;
......
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