Commit 9461f162 authored by Wayne Stambaugh's avatar Wayne Stambaugh

Encapsulate SCH_EDIT_FRAME and LIB_EDIT_FRAME classes.

parent 4cb29f61
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_eeschema_config.cpp
// Purpose:
// Author: jean-pierre Charras
// Created: 17/02/2006 21:14:46
// Copyright: KiCad Team
// Licence: GPL
/////////////////////////////////////////////////////////////////////////////
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2006-2011 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
*/
/**
* @file dialog_eeschema_config.cpp
*/
#include "fctsys.h"
#include "appl_wxstruct.h"
......@@ -50,9 +69,9 @@ void DIALOG_EESCHEMA_CONFIG::Init()
m_LibListChanged = false;
m_LibPathChanged = false;
m_UserLibDirBufferImg = m_Parent->m_UserLibraryPath;
m_UserLibDirBufferImg = m_Parent->GetUserLibraryPath();
m_ListLibr->InsertItems( m_Parent->m_ComponentLibFiles, 0 );
m_ListLibr->InsertItems( m_Parent->GetComponentLibraries(), 0 );
// Load user libs paths:
wxStringTokenizer Token( m_UserLibDirBufferImg, wxT( ";\n\r" ) );
......@@ -154,7 +173,8 @@ void DIALOG_EESCHEMA_CONFIG::OnCancelClick( wxCommandEvent& event )
{
for ( unsigned ii = 0; ii < m_ListLibr->GetCount(); ii++ )
wxGetApp().RemoveLibraryPath( m_listUserPaths->GetString(ii) );
wxGetApp().InsertLibraryPath( m_Parent->m_UserLibraryPath, 1);
wxGetApp().InsertLibraryPath( m_Parent->GetUserLibraryPath(), 1);
}
EndModal( wxID_CANCEL );
......@@ -166,15 +186,17 @@ void DIALOG_EESCHEMA_CONFIG::OnOkClick( wxCommandEvent& event )
// Recreate the user lib path
if ( m_LibPathChanged )
{
m_Parent->m_UserLibraryPath.Empty();
wxString path;
for ( unsigned ii = 0; ii < m_listUserPaths->GetCount(); ii++ )
{
if ( ii > 0 )
m_Parent->m_UserLibraryPath << wxT( ";" );
path << wxT( ";" );
m_Parent->m_UserLibraryPath << m_listUserPaths->GetString( ii );
path << m_listUserPaths->GetString( ii );
}
m_Parent->SetUserLibraryPath( path );
}
/* Set new active library list if the lib list of if default path list
......@@ -182,11 +204,13 @@ void DIALOG_EESCHEMA_CONFIG::OnOkClick( wxCommandEvent& event )
*/
if( m_LibListChanged || m_LibPathChanged )
{
// Recreate lib list
m_Parent->m_ComponentLibFiles.Clear();
wxArrayString list;
for ( unsigned ii = 0; ii < m_ListLibr->GetCount(); ii ++ )
m_Parent->m_ComponentLibFiles.Add(m_ListLibr->GetString( ii ) );
list.Add( m_ListLibr->GetString( ii ) );
// Recreate lib list
m_Parent->SetComponentLibraries( list );
// take new list in account
m_Parent->LoadLibraries();
......@@ -298,6 +322,7 @@ void DIALOG_EESCHEMA_CONFIG::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
......
......@@ -34,17 +34,17 @@ void SCH_EDIT_FRAME::LoadLibraries( void )
continue;
}
if( m_ComponentLibFiles.Index( i->GetName(), false ) == wxNOT_FOUND )
if( m_componentLibFiles.Index( i->GetName(), false ) == wxNOT_FOUND )
i = CMP_LIBRARY::GetLibraryList().erase( i );
else
i++;
}
/* Load missing libraries. */
for( ii = 0; ii < m_ComponentLibFiles.GetCount(); ii++ )
for( ii = 0; ii < m_componentLibFiles.GetCount(); ii++ )
{
fn.Clear();
fn.SetName( m_ComponentLibFiles[ii] );
fn.SetName( m_componentLibFiles[ii] );
fn.SetExt( CompLibFileExtension );
/* Skip if the file name is not valid.. */
......
......@@ -191,7 +191,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
dlg.SetRepeatLabel( g_RepeatDeltaLabel );
dlg.SetAutoSaveInterval( GetAutoSaveInterval() / 60 );
dlg.SetShowGrid( IsGridVisible() );
dlg.SetShowHiddenPins( m_ShowAllPins );
dlg.SetShowHiddenPins( m_showAllPins );
dlg.SetEnableAutoPan( DrawPanel->m_AutoPAN_Enable );
dlg.SetEnableHVBusOrientation( g_HVLines );
dlg.SetShowPageLimits( g_ShowPageLimits );
......@@ -222,7 +222,7 @@ void SCH_EDIT_FRAME::OnSetOptions( wxCommandEvent& event )
g_RepeatDeltaLabel = dlg.GetRepeatLabel();
SetAutoSaveInterval( dlg.GetAutoSaveInterval() * 60 );
SetGridVisibility( dlg.GetShowGrid() );
m_ShowAllPins = dlg.GetShowHiddenPins();
m_showAllPins = dlg.GetShowHiddenPins();
DrawPanel->m_AutoPAN_Enable = dlg.GetEnableAutoPan();
g_HVLines = dlg.GetEnableHVBusOrientation();
g_ShowPageLimits = dlg.GetShowPageLimits();
......@@ -258,12 +258,12 @@ PARAM_CFG_ARRAY& SCH_EDIT_FRAME::GetProjectFileParameters()
return m_projectFileParams;
m_projectFileParams.push_back( new PARAM_CFG_FILENAME( wxT( "LibDir" ),
&m_UserLibraryPath ) );
&m_userLibraryPath ) );
m_projectFileParams.push_back( new PARAM_CFG_LIBNAME_LIST( wxT( "LibName" ),
&m_ComponentLibFiles,
&m_componentLibFiles,
GROUPLIB ) );
m_projectFileParams.push_back( new PARAM_CFG_INT( wxT( "NetFmt" ),
&m_NetlistFormat,
&m_netListFormat,
NET_TYPE_PCBNEW,
NET_TYPE_PCBNEW,
NET_TYPE_CUSTOM_MAX ) );
......@@ -340,37 +340,37 @@ bool SCH_EDIT_FRAME::LoadProjectFile( const wxString& aFileName, bool aForceRere
{
wxFileName fn;
bool IsRead = true;
wxArrayString liblist_tmp = m_ComponentLibFiles;
wxArrayString liblist_tmp = m_componentLibFiles;
if( aFileName.IsEmpty() )
fn = g_RootSheet->GetScreen()->GetFileName();
else
fn = aFileName;
m_ComponentLibFiles.Clear();
m_componentLibFiles.Clear();
/* Change the schematic file extension (.sch) to the project file
* extension (.pro). */
fn.SetExt( ProjectFileExtension );
wxGetApp().RemoveLibraryPath( m_UserLibraryPath );
wxGetApp().RemoveLibraryPath( m_userLibraryPath );
if( !wxGetApp().ReadProjectConfig( fn.GetFullPath(), GROUP,
GetProjectFileParameters(),
!aForceReread ) )
{
m_ComponentLibFiles = liblist_tmp;
m_componentLibFiles = liblist_tmp;
IsRead = false;
}
/* User library path takes precedent over default library search paths. */
wxGetApp().InsertLibraryPath( m_UserLibraryPath, 1 );
wxGetApp().InsertLibraryPath( m_userLibraryPath, 1 );
/* If the list is void, force loading the library "power.lib" that is
* the "standard" library for power symbols.
*/
if( m_ComponentLibFiles.GetCount() == 0 )
m_ComponentLibFiles.Add( wxT( "power" ) );
if( m_componentLibFiles.GetCount() == 0 )
m_componentLibFiles.Add( wxT( "power" ) );
LoadLibraries();
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
......@@ -526,7 +526,7 @@ void SCH_EDIT_FRAME::LoadSettings()
m_GridColor = g_LayerDescr.LayerColor[LAYER_GRID];
g_DrawDefaultLineThickness = cfg->Read( DefaultDrawLineWidthEntry,(long) 6 );
cfg->Read( ShowHiddenPinsEntry, &m_ShowAllPins, false );
cfg->Read( ShowHiddenPinsEntry, &m_showAllPins, false );
cfg->Read( HorzVertLinesOnlyEntry, &g_HVLines, true );
/* Load print preview window session settings. */
......@@ -617,7 +617,7 @@ void SCH_EDIT_FRAME::SaveSettings()
wxGetApp().SaveCurrentSetupValues( GetConfigurationSettings() );
cfg->Write( DefaultDrawLineWidthEntry, (long) g_DrawDefaultLineThickness );
cfg->Write( ShowHiddenPinsEntry, m_ShowAllPins );
cfg->Write( ShowHiddenPinsEntry, m_showAllPins );
cfg->Write( HorzVertLinesOnlyEntry, g_HVLines );
/* Save print preview window session settings. */
......
......@@ -58,7 +58,7 @@ void LIB_EDIT_FRAME::OnImportPart( wxCommandEvent& event )
m_lastDrawItem = NULL;
wxFileDialog dlg( this, _( "Import Component" ), m_LastLibImportPath,
wxFileDialog dlg( this, _( "Import Component" ), m_lastLibImportPath,
wxEmptyString, CompLibFileWildcard,
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
......@@ -86,7 +86,7 @@ void LIB_EDIT_FRAME::OnImportPart( wxCommandEvent& event )
if( LoadOneLibraryPartAux( LibEntry, LibTmp ) )
{
fn = dlg.GetPath();
m_LastLibImportPath = fn.GetPath();
m_lastLibImportPath = fn.GetPath();
DisplayLibInfos();
GetScreen()->ClearUndoRedoList();
DrawPanel->Refresh();
......@@ -143,7 +143,7 @@ void LIB_EDIT_FRAME::OnExportPart( wxCommandEvent& event )
bool success = m_library->Save( formatter );
if( success )
m_LastLibExportPath = fn.GetPath();
m_lastLibExportPath = fn.GetPath();
delete m_library;
m_library = CurLibTmp;
......
......@@ -812,16 +812,17 @@ void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel,
{
// Invisible pins are only drawn on request.
// They are drawn in g_InvisibleItemColor.
// in schematic, they are drawn only if m_ShowAllPins is true.
// in schematic, they are drawn only if m_showAllPins is true.
// In other windows, they are always drawn because we must see them.
if( ! IsVisible() )
{
EDA_DRAW_FRAME* frame = NULL;
if( aPanel && aPanel->GetParent() )
frame = (EDA_DRAW_FRAME*)aPanel->GetParent();
if( frame && frame->IsType( SCHEMATIC_FRAME ) &&
! ((SCH_EDIT_FRAME*)frame)->m_ShowAllPins )
! ((SCH_EDIT_FRAME*)frame)->GetShowAllPins() )
return;
aColor = g_InvisibleItemColor;
......
......@@ -195,7 +195,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
m_FrameName = wxT( "LibeditFrame" );
m_Draw_Axis = true; // true to draw axis
m_ConfigPath = wxT( "LibraryEditor" );
m_configPath = wxT( "LibraryEditor" );
SetShowDeMorgan( false );
m_drawSpecificConvert = true;
m_drawSpecificUnit = false;
......@@ -291,11 +291,11 @@ void LIB_EDIT_FRAME::LoadSettings()
EDA_DRAW_FRAME::LoadSettings();
wxConfigPathChanger cpc( wxGetApp().m_EDA_Config, m_ConfigPath );
wxConfigPathChanger cpc( wxGetApp().m_EDA_Config, m_configPath );
cfg = wxGetApp().m_EDA_Config;
m_LastLibExportPath = cfg->Read( lastLibExportPathEntry, ::wxGetCwd() );
m_LastLibImportPath = cfg->Read( lastLibImportPathEntry, ::wxGetCwd() );
m_lastLibExportPath = cfg->Read( lastLibExportPathEntry, ::wxGetCwd() );
m_lastLibImportPath = cfg->Read( lastLibImportPathEntry, ::wxGetCwd() );
}
......@@ -312,11 +312,11 @@ void LIB_EDIT_FRAME::SaveSettings()
EDA_DRAW_FRAME::SaveSettings();
wxConfigPathChanger cpc( wxGetApp().m_EDA_Config, m_ConfigPath );
wxConfigPathChanger cpc( wxGetApp().m_EDA_Config, m_configPath );
cfg = wxGetApp().m_EDA_Config;
cfg->Write( lastLibExportPathEntry, m_LastLibExportPath );
cfg->Write( lastLibImportPathEntry, m_LastLibImportPath );
cfg->Write( lastLibExportPathEntry, m_lastLibExportPath );
cfg->Write( lastLibImportPathEntry, m_lastLibImportPath );
}
......@@ -402,35 +402,35 @@ double LIB_EDIT_FRAME::BestZoom()
void LIB_EDIT_FRAME::UpdateAliasSelectList()
{
if( m_SelAliasBox == NULL )
if( m_aliasSelectBox == NULL )
return;
m_SelAliasBox->Clear();
m_aliasSelectBox->Clear();
if( m_component == NULL )
return;
m_SelAliasBox->Append( m_component->GetAliasNames() );
m_SelAliasBox->SetSelection( 0 );
m_aliasSelectBox->Append( m_component->GetAliasNames() );
m_aliasSelectBox->SetSelection( 0 );
int index = m_SelAliasBox->FindString( m_aliasName );
int index = m_aliasSelectBox->FindString( m_aliasName );
if( index != wxNOT_FOUND )
m_SelAliasBox->SetSelection( index );
m_aliasSelectBox->SetSelection( index );
}
void LIB_EDIT_FRAME::UpdatePartSelectList()
{
if( m_SelpartBox == NULL )
if( m_partSelectBox == NULL )
return;
if( m_SelpartBox->GetCount() != 0 )
m_SelpartBox->Clear();
if( m_partSelectBox->GetCount() != 0 )
m_partSelectBox->Clear();
if( m_component == NULL || m_component->GetPartCount() <= 1 )
{
m_SelpartBox->Append( wxEmptyString );
m_partSelectBox->Append( wxEmptyString );
}
else
{
......@@ -438,11 +438,11 @@ void LIB_EDIT_FRAME::UpdatePartSelectList()
{
wxString msg;
msg.Printf( _( "Part %c" ), 'A' + i );
m_SelpartBox->Append( msg );
m_partSelectBox->Append( msg );
}
}
m_SelpartBox->SetSelection( ( m_unit > 0 ) ? m_unit - 1 : 0 );
m_partSelectBox->SetSelection( ( m_unit > 0 ) ? m_unit - 1 : 0 );
}
......@@ -510,13 +510,13 @@ void LIB_EDIT_FRAME::OnUpdatePinByPin( wxUpdateUIEvent& event )
void LIB_EDIT_FRAME::OnUpdatePartNumber( wxUpdateUIEvent& event )
{
if( m_SelpartBox == NULL )
if( m_partSelectBox == NULL )
return;
/* Using the typical event.Enable() call doesn't seem to work with wxGTK
* so use the pointer to alias combobox to directly enable or disable.
*/
m_SelpartBox->Enable( m_component && m_component->GetPartCount() > 1 );
m_partSelectBox->Enable( m_component && m_component->GetPartCount() > 1 );
}
......@@ -542,24 +542,24 @@ void LIB_EDIT_FRAME::OnUpdateDeMorganConvert( wxUpdateUIEvent& event )
void LIB_EDIT_FRAME::OnUpdateSelectAlias( wxUpdateUIEvent& event )
{
if( m_SelAliasBox == NULL )
if( m_aliasSelectBox == NULL )
return;
/* Using the typical event.Enable() call doesn't seem to work with wxGTK
* so use the pointer to alias combobox to directly enable or disable.
*/
m_SelAliasBox->Enable( m_component != NULL && m_component->GetAliasCount() > 1 );
m_aliasSelectBox->Enable( m_component != NULL && m_component->GetAliasCount() > 1 );
}
void LIB_EDIT_FRAME::OnSelectAlias( wxCommandEvent& event )
{
if( m_SelAliasBox == NULL
|| ( m_SelAliasBox->GetStringSelection().CmpNoCase( m_aliasName ) == 0) )
if( m_aliasSelectBox == NULL
|| ( m_aliasSelectBox->GetStringSelection().CmpNoCase( m_aliasName ) == 0) )
return;
m_lastDrawItem = NULL;
m_aliasName = m_SelAliasBox->GetStringSelection();
m_aliasName = m_aliasSelectBox->GetStringSelection();
DisplayCmpDoc();
DrawPanel->Refresh();
......
......@@ -53,12 +53,73 @@ class LIB_EDIT_FRAME : public EDA_DRAW_FRAME
{
LIB_COMPONENT* m_tempCopyComponent; ///< Temporary copy of current component during edit.
LIB_COLLECTOR m_collectedItems; // Used for hit testing.
wxComboBox* m_partSelectBox; // a Box to select a part to edit (if any)
wxComboBox* m_aliasSelectBox; // a box to select the alias to edit (if any)
LIB_ITEM* locateItem( const wxPoint& aPosition, const KICAD_T aFilterList[] );
wxString m_configPath;
wxString m_lastLibImportPath;
wxString m_lastLibExportPath;
public:
wxComboBox* m_SelpartBox; // a Box to select a part to edit (if any)
wxComboBox* m_SelAliasBox; // a box to select the alias to edit (if any)
/** Convert of the item currently being drawn. */
bool m_drawSpecificConvert;
/**
* Specify which component parts the current draw item applies to.
*
* If true, the item being drawn or edited applies only to the selected
* part. Otherwise it applies to all parts in the component.
*/
bool m_drawSpecificUnit;
/**
* Set to true to not synchronize pins at the same position when editing
* components with multiple parts or multiple body styles. Setting this
* to false allows editing each pin per part or body style individually.
* This requires the user to open each part or body style to make changes
* to the pin at the same location.
*/
bool m_editPinsPerPartOrConvert;
/** The current draw or edit graphic item fill style. */
static FILL_T m_drawFillStyle;
/** Default line width for drawing or editing graphic items. */
static int m_drawLineWidth;
/** The current active library. NULL if no active library is selected. */
static CMP_LIBRARY* m_library;
/** The current component being edited. NULL if no component is selected. */
static LIB_COMPONENT* m_component;
static LIB_ITEM* m_lastDrawItem;
static LIB_ITEM* m_drawItem;
static wxString m_aliasName;
// The unit number to edit and show
static int m_unit;
// Show the normal shape ( m_convert <= 1 ) or the converted shape
// ( m_convert > 1 )
static int m_convert;
// true to force DeMorgan/normal tools selection enabled.
// They are enabled when the loaded component has
// Graphic items for converted shape
// But under some circumstances (New component created)
// these tools must left enable
static bool m_showDeMorgan;
/// The current text size setting.
static int m_textSize;
/// Current text orientation setting.
static int m_textOrientation;
static wxSize m_clientSize;
friend class DIALOG_LIB_EDIT_TEXT;
LIB_ITEM* locateItem( const wxPoint& aPosition, const KICAD_T aFilterList[] );
public:
LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent, const wxString& title,
......@@ -498,70 +559,6 @@ public:
// Automatic placement of pins
void RepeatPinItem( wxDC* DC, LIB_PIN* Pin );
protected:
wxString m_ConfigPath;
wxString m_LastLibImportPath;
wxString m_LastLibExportPath;
/** Convert of the item currently being drawn. */
bool m_drawSpecificConvert;
/**
* Specify which component parts the current draw item applies to.
*
* If true, the item being drawn or edited applies only to the selected
* part. Otherwise it applies to all parts in the component.
*/
bool m_drawSpecificUnit;
/**
* Set to true to not synchronize pins at the same position when editing
* components with multiple parts or multiple body styles. Setting this
* to false allows editing each pin per part or body style individually.
* This requires the user to open each part or body style to make changes
* to the pin at the same location.
*/
bool m_editPinsPerPartOrConvert;
/** The current draw or edit graphic item fill style. */
static FILL_T m_drawFillStyle;
/** Default line width for drawing or editing graphic items. */
static int m_drawLineWidth;
/** The current active library. NULL if no active library is selected. */
static CMP_LIBRARY* m_library;
/** The current component being edited. NULL if no component is selected. */
static LIB_COMPONENT* m_component;
static LIB_ITEM* m_lastDrawItem;
static LIB_ITEM* m_drawItem;
static wxString m_aliasName;
// The unit number to edit and show
static int m_unit;
// Show the normal shape ( m_convert <= 1 ) or the converted shape
// ( m_convert > 1 )
static int m_convert;
// true to force DeMorgan/normal tools selection enabled.
// They are enabled when the loaded component has
// Graphic items for converted shape
// But under some circumstances (New component created)
// these tools must left enable
static bool m_showDeMorgan;
/// The current text size setting.
static int m_textSize;
/// Current text orientation setting.
static int m_textOrientation;
static wxSize m_clientSize;
friend class DIALOG_LIB_EDIT_TEXT;
/**
* Function CreatePNGorJPEGFile
* creates an image (screenshot) of the current component in PNG or JPEG format.
......
......@@ -193,7 +193,7 @@ NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) :
NET_TYPE_PCBNEW,
ID_CURRENT_FORMAT_IS_DEFAULT,
ID_CREATE_NETLIST,
m_Parent->m_NetlistFormat == NET_TYPE_PCBNEW );
m_Parent->GetNetListFormat() == NET_TYPE_PCBNEW );
// Add Panel FORMAT ORCADPCB2
m_PanelNetType[PANELORCADPCB2] =
......@@ -202,7 +202,7 @@ NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) :
NET_TYPE_ORCADPCB2,
ID_CURRENT_FORMAT_IS_DEFAULT,
ID_CREATE_NETLIST,
m_Parent->m_NetlistFormat == NET_TYPE_ORCADPCB2 );
m_Parent->GetNetListFormat() == NET_TYPE_ORCADPCB2 );
// Add Panel FORMAT CADSTAR
m_PanelNetType[PANELCADSTAR] =
......@@ -211,7 +211,7 @@ NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) :
NET_TYPE_CADSTAR,
ID_CURRENT_FORMAT_IS_DEFAULT,
ID_CREATE_NETLIST,
m_Parent->m_NetlistFormat == NET_TYPE_CADSTAR );
m_Parent->GetNetListFormat() == NET_TYPE_CADSTAR );
// Add Panel spice
InstallPageSpice();
......@@ -236,16 +236,16 @@ void NETLIST_DIALOG::InstallPageSpice()
wxT( "Spice" ),
NET_TYPE_SPICE,
0, 0,
m_Parent->m_NetlistFormat == NET_TYPE_SPICE );
m_Parent->GetNetListFormat() == NET_TYPE_SPICE );
page->m_IsCurrentFormat = new wxCheckBox( page, ID_CURRENT_FORMAT_IS_DEFAULT,
_( "Default format" ) );
page->m_IsCurrentFormat->SetValue( m_Parent->m_NetlistFormat == NET_TYPE_SPICE );
page->m_IsCurrentFormat->SetValue( m_Parent->GetNetListFormat() == NET_TYPE_SPICE );
page->m_LeftBoxSizer->Add( page->m_IsCurrentFormat, 1, wxGROW | wxALL, 5 );
page->m_AddSubPrefix = new wxCheckBox( page, ID_ADD_SUBCIRCUIT_PREFIX,
_( "Prefix references 'U' and 'IC' with 'X'" ) );
page->m_AddSubPrefix->SetValue( m_Parent->m_AddSubPrefix );
page->m_AddSubPrefix->SetValue( m_Parent->GetAddReferencePrefix() );
page->m_LeftBoxSizer->Add( page->m_AddSubPrefix, 0, wxGROW | wxALL, 5 );
......@@ -304,12 +304,13 @@ void NETLIST_DIALOG::InstallCustomPages()
if( title.IsEmpty() && previoustitle.IsEmpty() )
break; // No more panel to install
selected = m_Parent->m_NetlistFormat == ( NET_TYPE_CUSTOM1 + ii );
selected = m_Parent->GetNetListFormat() == ( NET_TYPE_CUSTOM1 + ii );
/* Install the panel "Add Plugin" after
* the last initialized panel */
previoustitle = title;
if( title.IsEmpty() )
CurrPage =
m_PanelNetType[PANELCUSTOMBASE + ii] =
......@@ -430,7 +431,7 @@ void NETLIST_DIALOG::SelectNetlistType( wxCommandEvent& event )
if( CurrPage == NULL )
return;
m_Parent->m_NetlistFormat = CurrPage->m_IdNetType;
m_Parent->SetNetListFormat( CurrPage->m_IdNetType );
CurrPage->m_IsCurrentFormat->SetValue( true );
}
......@@ -449,10 +450,7 @@ void NETLIST_DIALOG::EnableSubcircuitPrefix( wxCommandEvent& event )
if( CurrPage == NULL || CurrPage->m_AddSubPrefix == NULL )
return;
if( CurrPage->m_AddSubPrefix->IsChecked() )
m_Parent->m_AddSubPrefix = true;
else
m_Parent->m_AddSubPrefix = false;
m_Parent->SetAddReferencePrefix( CurrPage->m_AddSubPrefix->IsChecked() );
}
void NETLIST_DIALOG::NetlistUpdateOpt()
......@@ -460,7 +458,7 @@ void NETLIST_DIALOG::NetlistUpdateOpt()
int ii;
m_Parent->SetSimulatorCommand( m_PanelNetType[PANELSPICE]->m_CommandStringCtrl->GetValue() );
m_Parent->m_NetlistFormat = NET_TYPE_PCBNEW;
m_Parent->SetNetListFormat( NET_TYPE_PCBNEW );
for( ii = 0; ii < PANELCUSTOMBASE + CUSTOMPANEL_COUNTMAX; ii++ )
{
......@@ -468,7 +466,7 @@ void NETLIST_DIALOG::NetlistUpdateOpt()
break;
if( m_PanelNetType[ii]->m_IsCurrentFormat->GetValue() == true )
m_Parent->m_NetlistFormat = m_PanelNetType[ii]->m_IdNetType;
m_Parent->SetNetListFormat( m_PanelNetType[ii]->m_IdNetType );
}
g_OptNetListUseNames = true; // Used for pspice, gnucap
......
......@@ -194,7 +194,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father,
m_ViewlibFrame = NULL; // Frame for browsing component libraries
m_DefaultSchematicFileName = NAMELESS_PROJECT;
m_DefaultSchematicFileName += wxT( ".sch" );
m_ShowAllPins = false;
m_showAllPins = false;
m_previewPosition = wxDefaultPosition;
m_previewSize = wxDefaultSize;
m_printMonochrome = true;
......@@ -592,10 +592,10 @@ void SCH_EDIT_FRAME::OnUpdateBusOrientation( wxUpdateUIEvent& aEvent )
void SCH_EDIT_FRAME::OnUpdateHiddenPins( wxUpdateUIEvent& aEvent )
{
wxString tool_tip = m_ShowAllPins ? _( "Do not show hidden pins" ) :
wxString tool_tip = m_showAllPins ? _( "Do not show hidden pins" ) :
_( "Show hidden pins" );
aEvent.Check( m_ShowAllPins );
aEvent.Check( m_showAllPins );
m_OptionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_HIDDEN_PINS, tool_tip );
}
......@@ -622,8 +622,8 @@ void SCH_EDIT_FRAME::OnCreateNetlist( wxCommandEvent& event )
{
int i;
if( m_NetlistFormat < NET_TYPE_PCBNEW )
m_NetlistFormat = NET_TYPE_PCBNEW;
if( m_netListFormat < NET_TYPE_PCBNEW )
m_netListFormat = NET_TYPE_PCBNEW;
do
{
......
......@@ -121,7 +121,7 @@ void LIB_EDIT_FRAME::ReCreateHToolbar()
m_HToolBar->AddTool( ID_LIBEDIT_SELECT_PART, wxEmptyString,
KiBitmap( import_cmp_from_lib_xpm ),
_( "Load component to edit from the current lib" ) );
_( "Load component to edit from the current library" ) );
m_HToolBar->AddTool( ID_LIBEDIT_NEW_PART_FROM_EXISTING, wxEmptyString,
KiBitmap( copycomponent_xpm ),
......@@ -181,21 +181,21 @@ void LIB_EDIT_FRAME::ReCreateHToolbar()
_( "Edit document file" ) );
m_HToolBar->AddSeparator();
m_SelpartBox = new wxComboBox( m_HToolBar,
m_partSelectBox = new wxComboBox( m_HToolBar,
ID_LIBEDIT_SELECT_PART_NUMBER,
wxEmptyString,
wxDefaultPosition,
wxSize( LISTBOX_WIDTH, -1 ),
0, NULL, wxCB_READONLY );
m_HToolBar->AddControl( m_SelpartBox );
m_HToolBar->AddControl( m_partSelectBox );
m_SelAliasBox = new wxComboBox( m_HToolBar,
m_aliasSelectBox = new wxComboBox( m_HToolBar,
ID_LIBEDIT_SELECT_ALIAS,
wxEmptyString,
wxDefaultPosition,
wxSize( LISTBOX_WIDTH, -1 ),
0, NULL, wxCB_READONLY );
m_HToolBar->AddControl( m_SelAliasBox );
m_HToolBar->AddControl( m_aliasSelectBox );
m_HToolBar->AddSeparator();
msg = _( "Edit pins per part or body style (Use carefully!)" );
......
......@@ -290,7 +290,7 @@ void SCH_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
switch( id )
{
case ID_TB_OPTIONS_HIDDEN_PINS:
m_ShowAllPins = m_OptionsToolBar->GetToolState( id );
m_showAllPins = m_OptionsToolBar->GetToolState( id );
DrawPanel->Refresh( );
break;
......
......@@ -106,7 +106,7 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, wxSemaph
wxAcceleratorTable table( ACCEL_TABLE_CNT, accels );
m_FrameName = wxT( "ViewlibFrame" );
m_ConfigPath = wxT( "LibraryViewer" );
m_configPath = wxT( "LibraryViewer" );
// Give an icon
wxIcon icon;
......@@ -513,7 +513,7 @@ void LIB_VIEW_FRAME::LoadSettings( )
EDA_DRAW_FRAME::LoadSettings();
wxConfigPathChanger cpc( wxGetApp().m_EDA_Config, m_ConfigPath );
wxConfigPathChanger cpc( wxGetApp().m_EDA_Config, m_configPath );
cfg = wxGetApp().m_EDA_Config;
m_LibListSize.x = 150; // default width of libs list
......@@ -537,7 +537,7 @@ void LIB_VIEW_FRAME::SaveSettings()
EDA_DRAW_FRAME::SaveSettings();
wxConfigPathChanger cpc( wxGetApp().m_EDA_Config, m_ConfigPath );
wxConfigPathChanger cpc( wxGetApp().m_EDA_Config, m_configPath );
cfg = wxGetApp().m_EDA_Config;
if ( m_LibListSize.x )
......
......@@ -63,7 +63,7 @@ private:
// Flags
wxSemaphore* m_Semaphore; // != NULL if the frame must emulate a modal dialog
wxString m_ConfigPath; // subpath for configuration
wxString m_configPath; // subpath for configuration
protected:
static wxString m_libraryName;
......
......@@ -112,13 +112,6 @@ enum SCH_SEARCH_T {
*/
class SCH_EDIT_FRAME : public EDA_DRAW_FRAME
{
public:
int m_NetlistFormat;
int m_AddSubPrefix;
bool m_ShowAllPins;
wxString m_UserLibraryPath;
wxArrayString m_ComponentLibFiles;
private:
SCH_SHEET_PATH* m_CurrentSheet; ///< which sheet we are presently working on.
LIB_VIEW_FRAME* m_ViewlibFrame;
......@@ -154,6 +147,19 @@ private:
/// An index to the last find item in the found items list #m_foundItems.
int m_foundItemIndex;
/// Flag to indicate show hidden pins.
bool m_showAllPins;
/// The format to use when generating a net list.
int m_netListFormat;
/// Add X prefix to componen referencess when generating spice net lists.
bool m_addReferencPrefix;
wxString m_userLibraryPath;
wxArrayString m_componentLibFiles;
static int m_lastSheetPinType; ///< Last sheet pin type.
static wxSize m_lastSheetPinTextSize; ///< Last sheet pin text size.
static wxPoint m_lastSheetPinPosition; ///< Last sheet pin position.
......@@ -190,6 +196,26 @@ public:
void SetLibraryViewerWindow( LIB_VIEW_FRAME* aFrame ) { m_ViewlibFrame = aFrame; }
bool GetShowAllPins() const { return m_showAllPins; }
void SetShowAllPins( bool aEnable ) { m_showAllPins = aEnable; }
int GetNetListFormat() const { return m_netListFormat; }
void SetNetListFormat( int aFormat ) { m_netListFormat = aFormat; }
bool GetAddReferencePrefix() const { return m_addReferencPrefix; }
void SetAddReferencePrefix( bool aEnable ) { m_addReferencPrefix = aEnable; }
wxString GetUserLibraryPath() const { return m_userLibraryPath; }
void SetUserLibraryPath( const wxString& aPath ) { m_userLibraryPath = aPath; }
const wxArrayString& GetComponentLibraries() const { return m_componentLibFiles; }
void SetComponentLibraries( const wxArrayString& aList ) { m_componentLibFiles = aList; }
void Process_Special_Functions( wxCommandEvent& event );
void OnColorConfig( wxCommandEvent& aEvent );
void Process_Config( wxCommandEvent& event );
......
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