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.
This commit is contained in:
parent
de96452c41
commit
b9b341dce2
|
@ -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 */
|
||||
|
||||
/* PCB file name extension definitions. */
|
||||
|
@ -90,8 +88,6 @@ const wxString ModuleFileWildcard( _( "Kicad footprint library files (*.mod)|*.m
|
|||
int g_CurrentVersionPCB = 1;
|
||||
|
||||
int g_RotationAngle;
|
||||
int g_TimeOut; // Timer for automatic saving
|
||||
int g_SaveTime; // Time for next saving
|
||||
|
||||
int g_AnchorColor = BLUE;
|
||||
int g_ModuleTextCMPColor = LIGHTGRAY;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*************/
|
||||
/* files.cpp */
|
||||
/*************/
|
||||
/**
|
||||
* @file gerbview/files.cpp
|
||||
*/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "common.h"
|
||||
|
@ -13,9 +13,6 @@
|
|||
#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 )
|
||||
{
|
||||
wxString fn;
|
||||
|
@ -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 )
|
||||
{
|
||||
wxString fn;
|
||||
|
@ -180,7 +175,6 @@ bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFullFileName )
|
|||
}
|
||||
|
||||
Zoom_Automatique( false );
|
||||
g_SaveTime = time( NULL );
|
||||
|
||||
// Synchronize layers tools with actual active layer:
|
||||
setActiveLayer( getActiveLayer() );
|
||||
|
@ -265,7 +259,6 @@ bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName )
|
|||
}
|
||||
|
||||
Zoom_Automatique( false );
|
||||
g_SaveTime = time( NULL );
|
||||
|
||||
// Synchronize layers tools with actual active layer:
|
||||
setActiveLayer( getActiveLayer() );
|
||||
|
@ -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 )
|
||||
{
|
||||
wxString wildcard;
|
||||
|
|
|
@ -412,7 +412,19 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
|
|||
GRTraceMode trace_mode );
|
||||
|
||||
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 );
|
||||
|
||||
/**
|
||||
* 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 );
|
||||
|
||||
/**
|
||||
|
|
|
@ -29,8 +29,6 @@ extern int g_TabOneLayerMask[LAYER_COUNT];
|
|||
/* Look up Table for conversion copper layer count -> general copper layer mask: */
|
||||
extern int g_TabAllCopperLayerMask[NB_COPPER_LAYERS];
|
||||
|
||||
|
||||
extern wxArrayString g_LibName_List; // library list to load
|
||||
extern DISPLAY_OPTIONS DisplayOpt;
|
||||
|
||||
extern wxString g_SaveFileName;
|
||||
|
@ -44,10 +42,7 @@ extern wxString g_ViaType_Name[4];
|
|||
|
||||
extern int g_CurrentVersionPCB;
|
||||
|
||||
|
||||
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.
|
||||
extern DLIST<TRACK> g_CurrentTrackList;
|
||||
|
|
|
@ -31,10 +31,10 @@ class GENERAL_COLLECTOR;
|
|||
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
|
||||
{
|
||||
public:
|
||||
|
@ -84,7 +84,6 @@ public:
|
|||
return m_Pcb;
|
||||
}
|
||||
|
||||
|
||||
// General
|
||||
virtual void OnCloseWindow( wxCloseEvent& Event ) = 0;
|
||||
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) { }
|
||||
|
|
|
@ -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
|
||||
{
|
||||
friend class PCB_LAYER_WIDGET;
|
||||
|
@ -59,6 +57,10 @@ class PCB_EDIT_FRAME : public PCB_BASE_FRAME
|
|||
int m_RecordingMacros;
|
||||
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:
|
||||
|
||||
PCB_LAYER_WIDGET* m_Layers;
|
||||
|
@ -227,11 +229,31 @@ public:
|
|||
*/
|
||||
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:
|
||||
void InstallConfigFrame();
|
||||
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();
|
||||
|
||||
void SaveProjectSettings();
|
||||
|
||||
/**
|
||||
|
@ -244,14 +266,28 @@ public:
|
|||
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.
|
||||
*/
|
||||
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
|
||||
* handle settings specific common to the PCB layout application. It
|
||||
|
@ -262,7 +298,8 @@ public:
|
|||
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
|
||||
* save settings specific to the PCB layout application main window. It
|
||||
|
@ -335,7 +372,7 @@ public:
|
|||
* An item can be placed only if there is this item currently edited
|
||||
* Only a footprint, a pad or a track can be placed
|
||||
* @param aDC = current device context
|
||||
* @return true if an item was placedd
|
||||
* @return true if an item was placed
|
||||
*/
|
||||
bool OnHotkeyPlaceItem( wxDC* aDC );
|
||||
|
||||
|
|
|
@ -247,10 +247,10 @@ void PCB_EDIT_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aH
|
|||
if( !GetScreen()->IsModify() || GetScreen()->IsSave() )
|
||||
{
|
||||
/* 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();
|
||||
wxFileName fn = wxFileName( wxEmptyString, g_SaveFileName, PcbFileExtension );
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
Dialog_GeneralOptions::Dialog_GeneralOptions( PCB_EDIT_FRAME* parent ) :
|
||||
DialogGeneralOptionsBoardEditor_base( parent )
|
||||
{
|
||||
m_Parent = parent;
|
||||
init();
|
||||
|
||||
m_buttonOK->SetDefault();
|
||||
|
@ -37,12 +36,12 @@ void Dialog_GeneralOptions::init()
|
|||
{
|
||||
SetFocus();
|
||||
|
||||
m_Board = m_Parent->GetBoard();
|
||||
m_Board = GetParent()->GetBoard();
|
||||
|
||||
/* Set display options */
|
||||
m_PolarDisplay->SetSelection( DisplayOpt.DisplayPolarCood ? 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 )
|
||||
|
@ -50,12 +49,13 @@ void Dialog_GeneralOptions::init()
|
|||
case 450:
|
||||
m_RotationAngle->SetSelection( 0 );
|
||||
break;
|
||||
|
||||
default:
|
||||
m_RotationAngle->SetSelection( 1 );
|
||||
}
|
||||
|
||||
wxString timevalue;
|
||||
timevalue << g_TimeOut / 60;
|
||||
timevalue << GetParent()->GetAutoSaveTimeInterval() / 60;
|
||||
m_SaveTime->SetValue( timevalue );
|
||||
m_MaxShowLinks->SetValue( g_MaxLinksShowed );
|
||||
|
||||
|
@ -65,7 +65,7 @@ void Dialog_GeneralOptions::init()
|
|||
m_TrackAutodel->SetValue( g_AutoDeleteOldTrack );
|
||||
m_Track_45_Only_Ctrl->SetValue( g_Track_45_Only_Allowed );
|
||||
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_Track_DoubleSegm_Ctrl->SetValue( g_TwoSegmentTrackBuild );
|
||||
|
||||
|
@ -90,11 +90,10 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event )
|
|||
g_UserUnit = ( m_UnitsSelection->GetSelection() == 0 ) ? INCHES : MILLIMETRES;
|
||||
|
||||
if( ii != g_UserUnit )
|
||||
m_Parent->ReCreateAuxiliaryToolbar();
|
||||
|
||||
m_Parent->m_CursorShape = m_CursorShape->GetSelection();
|
||||
g_TimeOut = 60 * m_SaveTime->GetValue();
|
||||
GetParent()->ReCreateAuxiliaryToolbar();
|
||||
|
||||
GetParent()->m_CursorShape = m_CursorShape->GetSelection();
|
||||
GetParent()->SetAutoSaveTimeInterval( 60 * m_SaveTime->GetValue() );
|
||||
|
||||
g_RotationAngle = 10 * wxAtoi( m_RotationAngle->GetStringSelection() );
|
||||
|
||||
|
@ -104,15 +103,15 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event )
|
|||
|
||||
if( m_Board->IsElementVisible(RATSNEST_VISIBLE) != m_ShowGlobalRatsnest->GetValue() )
|
||||
{
|
||||
m_Parent->SetElementVisibility(RATSNEST_VISIBLE, m_ShowGlobalRatsnest->GetValue() );
|
||||
m_Parent->DrawPanel->Refresh( );
|
||||
GetParent()->SetElementVisibility(RATSNEST_VISIBLE, m_ShowGlobalRatsnest->GetValue() );
|
||||
GetParent()->DrawPanel->Refresh( );
|
||||
}
|
||||
|
||||
g_Show_Module_Ratsnest = m_ShowModuleRatsnest->GetValue();
|
||||
g_AutoDeleteOldTrack = m_TrackAutodel->GetValue();
|
||||
Segments_45_Only = m_Segments_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_MagneticPadOption = m_MagneticPadOptCtrl->GetSelection();
|
||||
|
@ -134,6 +133,7 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
|
|||
{
|
||||
case ID_TB_OPTIONS_DRC_OFF:
|
||||
Drc_On = !state;
|
||||
|
||||
if( GetToolId() == ID_TRACK_BUTT )
|
||||
{
|
||||
if( Drc_On )
|
||||
|
@ -141,14 +141,17 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
|
|||
else
|
||||
DrawPanel->SetCursor( wxCURSOR_QUESTION_ARROW );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case ID_TB_OPTIONS_SHOW_RATSNEST:
|
||||
SetElementVisibility( RATSNEST_VISIBLE, state );
|
||||
|
||||
if( state && (GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
|
||||
{
|
||||
Compile_Ratsnest( NULL, true );
|
||||
}
|
||||
|
||||
DrawPanel->Refresh();
|
||||
break;
|
||||
|
||||
|
|
|
@ -3,12 +3,9 @@
|
|||
|
||||
#include "dialog_general_options_BoardEditor_base.h"
|
||||
|
||||
/***********************************************************************/
|
||||
class Dialog_GeneralOptions : public DialogGeneralOptionsBoardEditor_base
|
||||
/***********************************************************************/
|
||||
{
|
||||
private:
|
||||
PCB_EDIT_FRAME* m_Parent;
|
||||
BOARD* m_Board;
|
||||
|
||||
void init();
|
||||
|
@ -18,6 +15,8 @@ public:
|
|||
~Dialog_GeneralOptions() {};
|
||||
void OnOkClick( wxCommandEvent& event );
|
||||
void OnCancelClick( wxCommandEvent& event );
|
||||
|
||||
PCB_EDIT_FRAME* GetParent() { return (PCB_EDIT_FRAME*) wxDialog::GetParent(); }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@ void PCB_EDIT_FRAME::InstallConfigFrame( )
|
|||
DIALOG_PCBNEW_CONFIG_LIBS::DIALOG_PCBNEW_CONFIG_LIBS( PCB_EDIT_FRAME* parent ):
|
||||
DIALOG_PCBNEW_CONFIG_LIBS_FBP(parent)
|
||||
{
|
||||
m_Parent = parent;
|
||||
m_Config = wxGetApp().m_EDA_CommonConfig;
|
||||
|
||||
Init( );
|
||||
|
@ -47,9 +46,8 @@ DIALOG_PCBNEW_CONFIG_LIBS::DIALOG_PCBNEW_CONFIG_LIBS( PCB_EDIT_FRAME* parent ):
|
|||
GetSizer()->SetSizeHints( this );
|
||||
}
|
||||
|
||||
/*************************************/
|
||||
|
||||
void DIALOG_PCBNEW_CONFIG_LIBS::Init()
|
||||
/*************************************/
|
||||
{
|
||||
SetFocus();
|
||||
|
||||
|
@ -57,7 +55,7 @@ void DIALOG_PCBNEW_CONFIG_LIBS::Init()
|
|||
m_LibPathChanged = false;
|
||||
m_UserLibDirBufferImg = g_UserLibDirBuffer; // Save the original lib path
|
||||
|
||||
m_ListLibr->InsertItems( g_LibName_List, 0 );
|
||||
m_ListLibr->InsertItems( GetParent()->GetFootprintLibraryNames(), 0 );
|
||||
|
||||
// Display current modules doc file:
|
||||
m_Config->Read( wxT( "module_doc_file" ), g_DocModulesFileName );
|
||||
|
@ -65,9 +63,11 @@ void DIALOG_PCBNEW_CONFIG_LIBS::Init()
|
|||
|
||||
// Load user libs paths:
|
||||
wxStringTokenizer Token( m_UserLibDirBufferImg, wxT( ";\n\r" ) );
|
||||
|
||||
while( Token.HasMoreTokens() )
|
||||
{
|
||||
wxString path = Token.GetNextToken();
|
||||
|
||||
if( wxFileName::DirExists( path ) )
|
||||
m_listUserPaths->Append(path);
|
||||
}
|
||||
|
@ -85,15 +85,14 @@ void DIALOG_PCBNEW_CONFIG_LIBS::Init()
|
|||
}
|
||||
|
||||
|
||||
/******************************************************************/
|
||||
void DIALOG_PCBNEW_CONFIG_LIBS::OnCancelClick( wxCommandEvent& event )
|
||||
/******************************************************************/
|
||||
{
|
||||
// Recreate the user lib path
|
||||
if ( m_LibPathChanged )
|
||||
{
|
||||
for ( unsigned ii = 0; ii < m_ListLibr->GetCount(); ii++ )
|
||||
wxGetApp().RemoveLibraryPath( m_listUserPaths->GetString(ii) );
|
||||
|
||||
wxGetApp().InsertLibraryPath( g_UserLibDirBuffer, 1);
|
||||
}
|
||||
|
||||
|
@ -101,51 +100,46 @@ void DIALOG_PCBNEW_CONFIG_LIBS::OnCancelClick( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
/**************************************************************/
|
||||
void DIALOG_PCBNEW_CONFIG_LIBS::OnOkClick( wxCommandEvent& event )
|
||||
/**************************************************************/
|
||||
{
|
||||
m_Config->Write( wxT( "module_doc_file" ),
|
||||
m_TextHelpModulesFileName->GetValue() );
|
||||
m_Config->Write( wxT( "module_doc_file" ), m_TextHelpModulesFileName->GetValue() );
|
||||
|
||||
// Recreate the user lib path
|
||||
if ( m_LibPathChanged )
|
||||
{
|
||||
g_UserLibDirBuffer.Empty();
|
||||
|
||||
for ( unsigned ii = 0; ii < m_listUserPaths->GetCount(); ii ++ )
|
||||
{
|
||||
if ( ii > 0 )
|
||||
g_UserLibDirBuffer << wxT(";");
|
||||
|
||||
g_UserLibDirBuffer << m_listUserPaths->GetString(ii);
|
||||
}
|
||||
}
|
||||
|
||||
// Set new active library list if the lib list of if default path list
|
||||
// was modified
|
||||
// Set new active library list if the lib list of if default path list was modified
|
||||
if( m_LibListChanged || m_LibPathChanged )
|
||||
{
|
||||
// Recreate lib list
|
||||
g_LibName_List.Clear();
|
||||
GetParent()->GetFootprintLibraryNames().Clear();
|
||||
|
||||
for ( unsigned ii = 0; ii < m_ListLibr->GetCount(); ii ++ )
|
||||
g_LibName_List.Add(m_ListLibr->GetString(ii) );
|
||||
GetParent()->GetFootprintLibraryNames().Add( m_ListLibr->GetString(ii) );
|
||||
}
|
||||
|
||||
m_Parent->SaveProjectSettings();
|
||||
GetParent()->SaveProjectSettings();
|
||||
EndModal( wxID_OK );
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************/
|
||||
void DIALOG_PCBNEW_CONFIG_LIBS::OnCloseWindow( wxCloseEvent& event )
|
||||
/**************************************************************/
|
||||
{
|
||||
EndModal( wxID_CANCEL );
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************/
|
||||
void DIALOG_PCBNEW_CONFIG_LIBS::OnButtonUpClick( wxCommandEvent& event )
|
||||
/********************************************************************/
|
||||
{
|
||||
wxArrayInt selections;
|
||||
|
||||
|
@ -163,6 +157,7 @@ void DIALOG_PCBNEW_CONFIG_LIBS::OnButtonUpClick( wxCommandEvent& event )
|
|||
int jj = selections[ii];
|
||||
EXCHG( libnames[jj], libnames[jj-1]);
|
||||
}
|
||||
|
||||
m_ListLibr->Set(libnames);
|
||||
|
||||
// Reselect previously selected names
|
||||
|
@ -176,13 +171,12 @@ void DIALOG_PCBNEW_CONFIG_LIBS::OnButtonUpClick( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
/*********************************************************************/
|
||||
void DIALOG_PCBNEW_CONFIG_LIBS::OnButtonDownClick( wxCommandEvent& event )
|
||||
/*********************************************************************/
|
||||
{
|
||||
wxArrayInt selections;
|
||||
|
||||
m_ListLibr->GetSelections(selections);
|
||||
|
||||
if ( selections.GetCount() <= 0 ) // No selection.
|
||||
return;
|
||||
|
||||
|
@ -197,6 +191,7 @@ void DIALOG_PCBNEW_CONFIG_LIBS::OnButtonDownClick( wxCommandEvent& event )
|
|||
int jj = selections[ii];
|
||||
EXCHG( libnames[jj], libnames[jj+1] );
|
||||
}
|
||||
|
||||
m_ListLibr->Set(libnames);
|
||||
|
||||
// Reselect previously selected names
|
||||
|
@ -205,20 +200,20 @@ void DIALOG_PCBNEW_CONFIG_LIBS::OnButtonDownClick( wxCommandEvent& event )
|
|||
int jj = selections[ii];
|
||||
m_ListLibr->SetSelection(jj+1);
|
||||
}
|
||||
|
||||
m_LibListChanged = TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************/
|
||||
void DIALOG_PCBNEW_CONFIG_LIBS::OnRemoveLibClick( wxCommandEvent& event )
|
||||
/*********************************************************************/
|
||||
/* Remove a library to the library list.
|
||||
* The real list (g_LibName_List) is not changed, so the change can be canceled
|
||||
*/
|
||||
void DIALOG_PCBNEW_CONFIG_LIBS::OnRemoveLibClick( wxCommandEvent& event )
|
||||
{
|
||||
wxArrayInt selections;
|
||||
|
||||
m_ListLibr->GetSelections( selections );
|
||||
|
||||
for( int ii = selections.GetCount()-1; ii >= 0; ii-- )
|
||||
{
|
||||
m_ListLibr->Delete( selections[ii] );
|
||||
|
@ -227,15 +222,12 @@ void DIALOG_PCBNEW_CONFIG_LIBS::OnRemoveLibClick( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
void DIALOG_PCBNEW_CONFIG_LIBS::OnAddOrInsertLibClick( wxCommandEvent& event )
|
||||
/**************************************************************************/
|
||||
|
||||
/* Insert or add a library to the library list:
|
||||
* The new library is put in list before (insert button) the selection,
|
||||
* or added (add button) to end of list
|
||||
* The real list (g_LibName_List) is not changed, so the change can be canceled
|
||||
*/
|
||||
void DIALOG_PCBNEW_CONFIG_LIBS::OnAddOrInsertLibClick( wxCommandEvent& event )
|
||||
{
|
||||
int ii = 0;
|
||||
wxString libfilename;
|
||||
|
@ -245,6 +237,7 @@ void DIALOG_PCBNEW_CONFIG_LIBS::OnAddOrInsertLibClick( wxCommandEvent& event )
|
|||
m_ListLibr->GetSelections(selections);
|
||||
|
||||
ii = selections.GetCount();
|
||||
|
||||
if( ii > 0 )
|
||||
ii = selections[0];
|
||||
else
|
||||
|
@ -268,6 +261,7 @@ void DIALOG_PCBNEW_CONFIG_LIBS::OnAddOrInsertLibClick( wxCommandEvent& event )
|
|||
for( unsigned jj = 0; jj < Filenames.GetCount(); jj++ )
|
||||
{
|
||||
fn = Filenames[jj];
|
||||
|
||||
if ( jj == 0 )
|
||||
wxGetApp().SaveLastVisitedLibraryPath( fn.GetPath() );
|
||||
|
||||
|
@ -279,6 +273,7 @@ void DIALOG_PCBNEW_CONFIG_LIBS::OnAddOrInsertLibClick( wxCommandEvent& event )
|
|||
* path is a sub path of these default paths
|
||||
*/
|
||||
libfilename = wxGetApp().ReturnFilenameWithRelativePathInLibPath( fn.GetFullPath() );
|
||||
|
||||
// Remove extension:
|
||||
fn = libfilename;
|
||||
fn.SetExt( wxEmptyString );
|
||||
|
@ -288,6 +283,7 @@ void DIALOG_PCBNEW_CONFIG_LIBS::OnAddOrInsertLibClick( wxCommandEvent& event )
|
|||
if( m_ListLibr->FindString( libfilename, fn.IsCaseSensitive() ) == wxNOT_FOUND )
|
||||
{
|
||||
m_LibListChanged = TRUE;
|
||||
|
||||
if( event.GetId() == ID_ADD_LIB )
|
||||
m_ListLibr->Append( libfilename );
|
||||
else
|
||||
|
@ -303,9 +299,7 @@ void DIALOG_PCBNEW_CONFIG_LIBS::OnAddOrInsertLibClick( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
void DIALOG_PCBNEW_CONFIG_LIBS::OnAddOrInsertPath( wxCommandEvent& event )
|
||||
/***********************************************************************/
|
||||
{
|
||||
wxString path = wxGetApp().ReturnLastVisitedLibraryPath();
|
||||
|
||||
|
@ -323,17 +317,20 @@ void DIALOG_PCBNEW_CONFIG_LIBS::OnAddOrInsertPath( wxCommandEvent& event )
|
|||
if( m_listUserPaths->FindString( path ) == wxNOT_FOUND )
|
||||
{
|
||||
int ipos = m_listUserPaths->GetCount();
|
||||
|
||||
if ( event.GetId() == wxID_INSERT_PATH )
|
||||
{
|
||||
if ( ipos ) ipos--;
|
||||
if ( ipos )
|
||||
ipos--;
|
||||
|
||||
int jj = m_listUserPaths->GetSelection();
|
||||
|
||||
if ( jj >= 0 )
|
||||
ipos = jj;
|
||||
}
|
||||
|
||||
// Ask the user if this is a relative path
|
||||
int diag = wxMessageBox(
|
||||
_( "Use a relative path?" ),
|
||||
int diag = wxMessageBox( _( "Use a relative path?" ),
|
||||
_( "Path type" ),
|
||||
wxYES_NO | wxICON_QUESTION, this );
|
||||
|
||||
|
@ -351,26 +348,28 @@ void DIALOG_PCBNEW_CONFIG_LIBS::OnAddOrInsertPath( wxCommandEvent& event )
|
|||
// Display actual libraries paths:
|
||||
wxPathList libpaths = wxGetApp().GetLibraryPathList();
|
||||
m_DefaultLibraryPathslistBox->Clear();
|
||||
|
||||
for( unsigned ii = 0; ii < libpaths.GetCount(); ii++ )
|
||||
{
|
||||
m_DefaultLibraryPathslistBox->Append( libpaths[ii]);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
DisplayError( this, _( "Path already in use" ) );
|
||||
}
|
||||
|
||||
wxGetApp().SaveLastVisitedLibraryPath( path );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
void DIALOG_PCBNEW_CONFIG_LIBS::OnRemoveUserPath( wxCommandEvent& event )
|
||||
/***********************************************************************/
|
||||
{
|
||||
int ii = m_listUserPaths->GetSelection();
|
||||
|
||||
if ( ii < 0 )
|
||||
ii = m_listUserPaths->GetCount()-1;
|
||||
|
||||
if ( ii >= 0 )
|
||||
{
|
||||
wxGetApp().RemoveLibraryPath( m_listUserPaths->GetStringSelection() );
|
||||
|
@ -381,6 +380,7 @@ void DIALOG_PCBNEW_CONFIG_LIBS::OnRemoveUserPath( wxCommandEvent& event )
|
|||
// Display actual libraries paths:
|
||||
wxPathList libpaths = wxGetApp().GetLibraryPathList();
|
||||
m_DefaultLibraryPathslistBox->Clear();
|
||||
|
||||
for( unsigned ii = 0; ii < libpaths.GetCount(); ii++ )
|
||||
{
|
||||
m_DefaultLibraryPathslistBox->Append( libpaths[ii] );
|
||||
|
@ -388,9 +388,7 @@ void DIALOG_PCBNEW_CONFIG_LIBS::OnRemoveUserPath( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
void DIALOG_PCBNEW_CONFIG_LIBS::OnBrowseModDocFile( wxCommandEvent& event )
|
||||
/**************************************************************************/
|
||||
{
|
||||
wxString FullFileName;
|
||||
wxString docpath, filename;
|
||||
|
@ -398,8 +396,7 @@ void DIALOG_PCBNEW_CONFIG_LIBS::OnBrowseModDocFile( wxCommandEvent& event )
|
|||
docpath = wxGetApp().ReturnLastVisitedLibraryPath(wxT( "doc" ));
|
||||
|
||||
wxFileDialog FilesDialog( this, _( "Footprint document file:" ), docpath,
|
||||
wxEmptyString, PdfFileWildcard,
|
||||
wxFD_DEFAULT_STYLE );
|
||||
wxEmptyString, PdfFileWildcard, wxFD_DEFAULT_STYLE );
|
||||
|
||||
if( FilesDialog.ShowModal() != wxID_OK )
|
||||
return;
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
class DIALOG_PCBNEW_CONFIG_LIBS : public DIALOG_PCBNEW_CONFIG_LIBS_FBP
|
||||
{
|
||||
private:
|
||||
PCB_EDIT_FRAME* m_Parent;
|
||||
wxConfig* m_Config;
|
||||
bool m_LibListChanged;
|
||||
bool m_LibPathChanged;
|
||||
|
@ -38,6 +37,8 @@ private:
|
|||
public:
|
||||
DIALOG_PCBNEW_CONFIG_LIBS( PCB_EDIT_FRAME * parent );
|
||||
~DIALOG_PCBNEW_CONFIG_LIBS() {};
|
||||
|
||||
PCB_EDIT_FRAME* GetParent() { return (PCB_EDIT_FRAME*) wxDialog::GetParent(); }
|
||||
};
|
||||
|
||||
#endif // _DIALOG_PCBNEW_CONFIG_LIBS_H_
|
||||
|
|
|
@ -285,7 +285,7 @@ this file again." ) );
|
|||
GetBoard()->DisplayInfo( this );
|
||||
|
||||
/* reset the auto save timer */
|
||||
g_SaveTime = time( NULL );
|
||||
m_lastSaveTime = time( NULL );
|
||||
|
||||
// Refresh the 3D view, if any
|
||||
if( m_Draw3DFrame )
|
||||
|
@ -407,7 +407,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName )
|
|||
ClearMsgPanel();
|
||||
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();
|
||||
return true;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/****************************************/
|
||||
/* Manage module (footprint) libraries. */
|
||||
/****************************************/
|
||||
/**
|
||||
* @file librairi.cpp
|
||||
* @brief Manage module (footprint) libraries.
|
||||
*/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "appl_wxstruct.h"
|
||||
|
@ -238,7 +239,8 @@ void FOOTPRINT_EDIT_FRAME::Delete_Module_In_Library( const wxString& aLibname )
|
|||
{
|
||||
fclose( lib_module );
|
||||
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 );
|
||||
return;
|
||||
}
|
||||
|
@ -324,14 +326,16 @@ void FOOTPRINT_EDIT_FRAME::Delete_Module_In_Library( const wxString& aLibname )
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
/* The temporary file is renamed as the previous library. */
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -498,7 +502,7 @@ bool PCB_BASE_FRAME::Save_Module_In_Library( const wxString& aLibName,
|
|||
if( ! input_lib.IsLibrary() )
|
||||
{
|
||||
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 );
|
||||
return false;
|
||||
}
|
||||
|
@ -616,12 +620,14 @@ bool PCB_BASE_FRAME::Save_Module_In_Library( const wxString& aLibName,
|
|||
wxRemoveFile( 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 */
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -656,6 +662,7 @@ MODULE* PCB_BASE_FRAME::Create_1_Module( const wxString& aModuleName )
|
|||
|
||||
moduleName = dlg.GetValue();
|
||||
}
|
||||
|
||||
moduleName.Trim( true );
|
||||
moduleName.Trim( false );
|
||||
|
||||
|
@ -698,11 +705,13 @@ MODULE* PCB_BASE_FRAME::Create_1_Module( const wxString& aModuleName )
|
|||
void FOOTPRINT_EDIT_FRAME::Select_Active_Library()
|
||||
{
|
||||
wxString msg;
|
||||
PCB_EDIT_FRAME* parent = (PCB_EDIT_FRAME*) GetParent();
|
||||
|
||||
if( g_LibName_List.GetCount() == 0 )
|
||||
if( parent->GetFootprintLibraryNames().GetCount() == 0 || parent == NULL )
|
||||
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 )
|
||||
return;
|
||||
|
@ -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;
|
||||
wxString msg;
|
||||
|
|
|
@ -193,13 +193,15 @@ MODULE* PCB_BASE_FRAME::GetModuleLibrary( const wxString& aLibraryFullFilename,
|
|||
FILE* file = NULL;
|
||||
unsigned ii;
|
||||
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 )
|
||||
fn = aLibraryFullFilename;
|
||||
else
|
||||
fn = wxFileName( wxEmptyString, g_LibName_List[ii], ModuleFileExtension );
|
||||
fn = wxFileName( wxEmptyString, parent->GetFootprintLibraryNames()[ii],
|
||||
ModuleFileExtension );
|
||||
|
||||
tmp = wxGetApp().FindLibraryPath( fn );
|
||||
|
||||
|
@ -300,9 +302,10 @@ wxString PCB_BASE_FRAME::Select_1_Module_From_List( EDA_DRAW_FRAME* aWindow,
|
|||
wxString CmpName;
|
||||
wxString msg;
|
||||
wxArrayString libnames_list;
|
||||
PCB_EDIT_FRAME* parent = (PCB_EDIT_FRAME*) GetParent();
|
||||
|
||||
if( aLibraryFullFilename.IsEmpty() )
|
||||
libnames_list = g_LibName_List;
|
||||
libnames_list = parent->GetFootprintLibraryNames();
|
||||
else
|
||||
libnames_list.Add( aLibraryFullFilename );
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
|
||||
/*****************************************************/
|
||||
/* class FOOTPRINT_EDIT_FRAME: public EDA_DRAW_FRAME */
|
||||
/* Class for the footprint editor */
|
||||
/*****************************************************/
|
||||
/**
|
||||
* @file module_editor_frame.h
|
||||
* @brief Definition of class FOOTPRINT_EDIT_FRAME.
|
||||
*/
|
||||
|
||||
#ifndef _MODULE_EDITOR_FRAME_H_
|
||||
#define _MODULE_EDITOR_FRAME_H_
|
||||
|
@ -30,7 +29,7 @@ public:
|
|||
|
||||
/**
|
||||
* 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 );
|
||||
|
||||
|
@ -76,8 +75,7 @@ public:
|
|||
* case insensitive
|
||||
* </p>
|
||||
*/
|
||||
void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||
EDA_ITEM* aItem = NULL );
|
||||
void OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, EDA_ITEM* aItem = NULL );
|
||||
|
||||
bool OnHotkeyEditItem( int aIdCommand );
|
||||
bool OnHotkeyDeleteItem( int aIdCommand );
|
||||
|
@ -263,7 +261,7 @@ public:
|
|||
|
||||
/**
|
||||
* 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
|
||||
* @return true if a module isloaded, false otherwise.
|
||||
*/
|
||||
|
@ -330,7 +328,7 @@ public:
|
|||
*/
|
||||
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 );
|
||||
|
||||
/* Function to place a graphic item type EDGE_MODULE currently moved */
|
||||
|
@ -338,7 +336,9 @@ public:
|
|||
|
||||
// handlers for libraries:
|
||||
void Delete_Module_In_Library( const wxString& libname );
|
||||
int Create_Librairie( const wxString& LibName );
|
||||
|
||||
int CreateLibrary( const wxString& LibName );
|
||||
|
||||
void Select_Active_Library();
|
||||
|
||||
wxString GetCurrentLib() const { return m_CurrentLib; };
|
||||
|
@ -347,4 +347,3 @@ public:
|
|||
};
|
||||
|
||||
#endif // #define _MODULE_EDITOR_FRAME_H_
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*************************/
|
||||
/* PCBNEW: main program */
|
||||
/*************************/
|
||||
/**
|
||||
* @file pcbnew.cpp
|
||||
* @file PCBNEW: main program.
|
||||
*/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "appl_wxstruct.h"
|
||||
|
@ -48,7 +49,7 @@ int g_MaxLinksShowed;
|
|||
int g_MagneticPadOption = 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
|
||||
const wxString g_FootprintLibFileWildcard( wxT( "Kicad footprint library file (*.mod)|*.mod" ) );
|
||||
|
@ -62,6 +63,7 @@ wxString g_DocModulesFileName = wxT( "footprints_doc/footprints.pdf" );
|
|||
|
||||
IMPLEMENT_APP( EDA_APP )
|
||||
|
||||
|
||||
/* MacOSX: Needed for file association
|
||||
* http://wiki.wxwidgets.org/WxMac-specific_topics
|
||||
*/
|
||||
|
@ -82,11 +84,11 @@ bool EDA_APP::OnInit()
|
|||
wxFileName fn;
|
||||
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( !IsOK( NULL, _( "PCBnew is already running, Continue?" ) ) )
|
||||
if( !IsOK( NULL, _( "PCBNew is already running, Continue?" ) ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -147,7 +149,7 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) );
|
|||
frame->UpdateTitle();
|
||||
frame->UpdateFileHistory( frame->GetScreen()->GetFileName() );
|
||||
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;
|
||||
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() ) );
|
|||
}
|
||||
|
||||
frame->LoadProjectSettings( fn.GetFullPath() );
|
||||
|
||||
// update the layer names in the listbox
|
||||
frame->ReCreateLayerBox( NULL );
|
||||
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
wxFileName fn = aProjectFileName;
|
||||
|
@ -153,17 +145,16 @@ bool PCB_EDIT_FRAME::LoadProjectSettings( const wxString& aProjectFileName )
|
|||
wxGetApp().RemoveLibraryPath( g_UserLibDirBuffer );
|
||||
|
||||
/* Initialize default values. */
|
||||
g_LibName_List.Clear();
|
||||
m_libraryNames.Clear();
|
||||
|
||||
wxGetApp().ReadProjectConfig( fn.GetFullPath(), GROUP, GetProjectFileParameters(), false );
|
||||
|
||||
/* User library path takes precedent over default library search paths. */
|
||||
wxGetApp().InsertLibraryPath( g_UserLibDirBuffer, 1 );
|
||||
|
||||
/* Reset the items visibility flag when loading a new config
|
||||
* Because it could creates SERIOUS mistakes for the user,
|
||||
* if board items are not visible after loading a board...
|
||||
* Grid and ratsnest can be left to their previous state
|
||||
/* Reset the items visibility flag when loading a new configuration because it could
|
||||
* create SERIOUS mistakes for the user f board items are not visible after loading
|
||||
* a board. Grid and ratsnest can be left to their previous state.
|
||||
*/
|
||||
bool showGrid = IsElementVisible( GRID_VISIBLE );
|
||||
bool showRats = IsElementVisible( RATSNEST_VISIBLE );
|
||||
|
@ -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()
|
||||
{
|
||||
if( !m_projectFileParams.empty() )
|
||||
|
@ -207,7 +189,8 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetProjectFileParameters()
|
|||
|
||||
m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "LibDir" ),&g_UserLibDirBuffer,
|
||||
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 ) );
|
||||
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "PadDrlX" ), &g_Pad_Master.m_Drill.x,
|
||||
320, 0, 0x7FFF ) );
|
||||
|
@ -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()
|
||||
{
|
||||
if( !m_configSettings.empty() )
|
||||
|
@ -401,7 +368,7 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings()
|
|||
// Miscellaneous:
|
||||
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "RotationAngle" ), &g_RotationAngle,
|
||||
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 ) );
|
||||
m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "MaxLnkS" ), &g_MaxLinksShowed,
|
||||
3, 0, 15 ) );
|
||||
|
@ -415,8 +382,6 @@ PARAM_CFG_ARRAY& PCB_EDIT_FRAME::GetConfigurationSettings()
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
void PCB_EDIT_FRAME::SaveMacros()
|
||||
{
|
||||
wxFileName fn;
|
||||
|
@ -467,8 +432,6 @@ void PCB_EDIT_FRAME::SaveMacros()
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
void PCB_EDIT_FRAME::ReadMacros()
|
||||
{
|
||||
wxString str;
|
||||
|
|
Loading…
Reference in New Issue