2011-10-13 20:13:11 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2012-02-11 09:04:26 +00:00
|
|
|
* Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras
|
2011-10-13 20:13:11 +00:00
|
|
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
|
|
|
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.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 cvframe.cpp
|
|
|
|
*/
|
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <appl_wxstruct.h>
|
|
|
|
#include <macros.h>
|
|
|
|
#include <confirm.h>
|
|
|
|
#include <eda_doc.h>
|
|
|
|
#include <eda_dde.h>
|
|
|
|
#include <gestfich.h>
|
|
|
|
|
|
|
|
#include <cvpcb_mainframe.h>
|
|
|
|
#include <cvstruct.h>
|
|
|
|
#include <dialog_cvpcb_config.h>
|
|
|
|
#include <class_DisplayFootprintsFrame.h>
|
|
|
|
#include <cvpcb_id.h>
|
|
|
|
#include <html_messagebox.h>
|
2012-02-16 20:03:33 +00:00
|
|
|
#include <wildcards_and_files_ext.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
|
|
|
|
#include <build_version.h>
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
#define FRAME_MIN_SIZE_X 450
|
|
|
|
#define FRAME_MIN_SIZE_Y 300
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2011-09-30 18:15:37 +00:00
|
|
|
// option key to close CvPcb after saving files
|
2009-04-23 15:02:18 +00:00
|
|
|
static const wxString KeepCvpcbOpenEntry( wxT( "KeepCvpcbOpen" ) );
|
|
|
|
static const wxString FootprintDocFileEntry( wxT( "footprints_doc_file" ) );
|
|
|
|
|
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, EDA_BASE_FRAME )
|
2011-08-24 19:44:05 +00:00
|
|
|
EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, CVPCB_MAINFRAME::LoadNetList )
|
|
|
|
|
|
|
|
// Menu events
|
|
|
|
EVT_MENU( ID_LOAD_PROJECT, CVPCB_MAINFRAME::LoadNetList )
|
|
|
|
EVT_MENU( wxID_SAVE, CVPCB_MAINFRAME::SaveQuitCvpcb )
|
|
|
|
EVT_MENU( wxID_SAVEAS, CVPCB_MAINFRAME::SaveQuitCvpcb )
|
|
|
|
EVT_MENU( wxID_EXIT, CVPCB_MAINFRAME::OnQuit )
|
|
|
|
EVT_MENU( wxID_HELP, CVPCB_MAINFRAME::GetKicadHelp )
|
|
|
|
EVT_MENU( wxID_ABOUT, CVPCB_MAINFRAME::GetKicadAbout )
|
|
|
|
EVT_MENU( wxID_PREFERENCES, CVPCB_MAINFRAME::ConfigCvpcb )
|
|
|
|
EVT_MENU( ID_SAVE_PROJECT, CVPCB_MAINFRAME::SaveProjectFile )
|
|
|
|
EVT_MENU( ID_SAVE_PROJECT_AS, CVPCB_MAINFRAME::SaveProjectFile )
|
|
|
|
EVT_MENU( ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, CVPCB_MAINFRAME::OnKeepOpenOnSave )
|
|
|
|
|
|
|
|
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, CVPCB_MAINFRAME::SetLanguage )
|
|
|
|
|
|
|
|
// Toolbar events
|
|
|
|
EVT_TOOL( ID_CVPCB_QUIT, CVPCB_MAINFRAME::OnQuit )
|
|
|
|
EVT_TOOL( ID_CVPCB_READ_INPUT_NETLIST, CVPCB_MAINFRAME::LoadNetList )
|
|
|
|
EVT_TOOL( ID_CVPCB_CREATE_CONFIGWINDOW, CVPCB_MAINFRAME::ConfigCvpcb )
|
|
|
|
EVT_TOOL( ID_CVPCB_CREATE_SCREENCMP, CVPCB_MAINFRAME::DisplayModule )
|
|
|
|
EVT_TOOL( ID_CVPCB_GOTO_FIRSTNA, CVPCB_MAINFRAME::ToFirstNA )
|
|
|
|
EVT_TOOL( ID_CVPCB_GOTO_PREVIOUSNA, CVPCB_MAINFRAME::ToPreviousNA )
|
|
|
|
EVT_TOOL( ID_CVPCB_DEL_ASSOCIATIONS, CVPCB_MAINFRAME::DelAssociations )
|
|
|
|
EVT_TOOL( ID_CVPCB_AUTO_ASSOCIE, CVPCB_MAINFRAME::AssocieModule )
|
|
|
|
EVT_TOOL( ID_PCB_DISPLAY_FOOTPRINT_DOC, CVPCB_MAINFRAME::DisplayDocFile )
|
|
|
|
EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
|
|
|
|
CVPCB_MAINFRAME::OnSelectFilteringFootprint )
|
2012-03-15 18:20:22 +00:00
|
|
|
EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST,
|
|
|
|
CVPCB_MAINFRAME::OnSelectFilteringFootprint )
|
2011-08-24 19:44:05 +00:00
|
|
|
EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST,
|
|
|
|
CVPCB_MAINFRAME::OnSelectFilteringFootprint )
|
|
|
|
|
|
|
|
// Frame events
|
|
|
|
EVT_CHAR( CVPCB_MAINFRAME::OnChar )
|
|
|
|
EVT_CLOSE( CVPCB_MAINFRAME::OnCloseWindow )
|
|
|
|
EVT_SIZE( CVPCB_MAINFRAME::OnSize )
|
|
|
|
|
|
|
|
// List item events
|
|
|
|
EVT_LIST_ITEM_SELECTED( ID_CVPCB_FOOTPRINT_LIST, CVPCB_MAINFRAME::OnLeftClick )
|
|
|
|
EVT_LIST_ITEM_ACTIVATED( ID_CVPCB_FOOTPRINT_LIST, CVPCB_MAINFRAME::OnLeftDClick )
|
|
|
|
EVT_LIST_ITEM_SELECTED( ID_CVPCB_COMPONENT_LIST, CVPCB_MAINFRAME::OnSelectComponent )
|
|
|
|
|
|
|
|
EVT_UPDATE_UI( ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, CVPCB_MAINFRAME::OnUpdateKeepOpenOnSave )
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
2012-09-12 09:53:11 +00:00
|
|
|
#define CVPCB_MAINFRAME_NAME wxT( "CvpcbFrame" )
|
|
|
|
|
2011-08-24 19:44:05 +00:00
|
|
|
CVPCB_MAINFRAME::CVPCB_MAINFRAME( const wxString& title, long style ) :
|
2012-09-12 09:53:11 +00:00
|
|
|
EDA_BASE_FRAME( NULL, CVPCB_FRAME_TYPE, title, wxDefaultPosition,
|
|
|
|
wxDefaultSize, style, CVPCB_MAINFRAME_NAME )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2012-09-12 09:53:11 +00:00
|
|
|
m_FrameName = CVPCB_MAINFRAME_NAME;
|
2008-12-08 15:27:13 +00:00
|
|
|
|
2009-11-05 19:26:52 +00:00
|
|
|
m_ListCmp = NULL;
|
|
|
|
m_FootprintList = NULL;
|
2011-08-04 11:23:19 +00:00
|
|
|
m_DisplayFootprintFrame = NULL;
|
2011-12-16 13:32:23 +00:00
|
|
|
m_mainToolBar = NULL;
|
2011-08-04 11:23:19 +00:00
|
|
|
m_modified = false;
|
2009-04-23 15:02:18 +00:00
|
|
|
m_isEESchemaNetlist = false;
|
|
|
|
m_KeepCvpcbOpen = false;
|
|
|
|
m_undefinedComponentCnt = 0;
|
2012-05-25 06:58:52 +00:00
|
|
|
m_skipComponentSelect = false;
|
2009-04-23 15:02:18 +00:00
|
|
|
|
|
|
|
/* Name of the document footprint list
|
|
|
|
* usually located in share/modules/footprints_doc
|
|
|
|
* this is of the responsibility to users to create this file
|
|
|
|
* if they want to have a list of footprints
|
|
|
|
*/
|
2009-11-05 19:26:52 +00:00
|
|
|
m_DocModulesFileName = DEFAULT_FOOTPRINTS_LIST_FILENAME;
|
2007-12-04 18:23:38 +00:00
|
|
|
|
|
|
|
// Give an icon
|
2011-09-09 19:30:59 +00:00
|
|
|
wxIcon icon;
|
|
|
|
icon.CopyFromBitmap( KiBitmap( icon_cvpcb_xpm ) );
|
|
|
|
SetIcon( icon );
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2011-08-04 11:23:19 +00:00
|
|
|
SetAutoLayout( true );
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
LoadSettings();
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
if( m_FrameSize.x < FRAME_MIN_SIZE_X )
|
|
|
|
m_FrameSize.x = FRAME_MIN_SIZE_X;
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
if( m_FrameSize.y < FRAME_MIN_SIZE_Y )
|
|
|
|
m_FrameSize.y = FRAME_MIN_SIZE_Y;
|
|
|
|
|
2009-11-07 14:36:54 +00:00
|
|
|
// Set minimal frame width and height
|
|
|
|
SetSizeHints( FRAME_MIN_SIZE_X, FRAME_MIN_SIZE_Y, -1, -1, -1, -1 );
|
|
|
|
|
|
|
|
// Framesize and position
|
|
|
|
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
// create the status bar
|
2009-08-07 04:44:42 +00:00
|
|
|
static const int dims[3] = { -1, -1, 250 };
|
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
CreateStatusBar( 3 );
|
|
|
|
SetStatusWidths( 3, dims );
|
2009-08-07 04:44:42 +00:00
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
ReCreateMenuBar();
|
2007-05-06 16:03:28 +00:00
|
|
|
ReCreateHToolbar();
|
|
|
|
|
2009-11-05 19:26:52 +00:00
|
|
|
// Create list of available modules and components of the schematic
|
2007-12-04 18:23:38 +00:00
|
|
|
BuildCmpListBox();
|
2009-08-20 11:44:06 +00:00
|
|
|
BuildFOOTPRINTS_LISTBOX();
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2009-11-05 19:26:52 +00:00
|
|
|
m_auimgr.SetManagedWindow( this );
|
2009-11-05 08:52:41 +00:00
|
|
|
|
|
|
|
|
2011-09-15 18:25:44 +00:00
|
|
|
EDA_PANEINFO horiz;
|
|
|
|
horiz.HorizontalToolbarPane();
|
|
|
|
|
|
|
|
EDA_PANEINFO info;
|
|
|
|
info.InfoToolbarPane();
|
|
|
|
|
2009-11-05 08:52:41 +00:00
|
|
|
|
2011-12-16 13:32:23 +00:00
|
|
|
if( m_mainToolBar )
|
|
|
|
m_auimgr.AddPane( m_mainToolBar,
|
|
|
|
wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top() );
|
2009-11-05 08:52:41 +00:00
|
|
|
|
2010-01-13 21:15:54 +00:00
|
|
|
if( m_ListCmp )
|
|
|
|
m_auimgr.AddPane( m_ListCmp,
|
2011-08-24 19:44:05 +00:00
|
|
|
wxAuiPaneInfo( horiz ).Name( wxT( "m_ListCmp" ) ).CentrePane() );
|
2009-11-07 14:36:54 +00:00
|
|
|
|
2010-01-13 21:15:54 +00:00
|
|
|
if( m_FootprintList )
|
|
|
|
m_auimgr.AddPane( m_FootprintList,
|
2011-09-15 18:25:44 +00:00
|
|
|
wxAuiPaneInfo( info ).Name( wxT( "m_FootprintList" ) ).
|
2011-08-24 19:44:05 +00:00
|
|
|
Right().BestSize( (int) ( m_FrameSize.x * 0.36 ), m_FrameSize.y ) );
|
2009-11-02 22:24:55 +00:00
|
|
|
|
|
|
|
m_auimgr.Update();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
CVPCB_MAINFRAME::~CVPCB_MAINFRAME()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2011-12-16 20:12:49 +00:00
|
|
|
wxConfig* config = wxGetApp().GetSettings();
|
2008-12-08 15:27:13 +00:00
|
|
|
|
|
|
|
if( config )
|
2007-12-04 18:23:38 +00:00
|
|
|
{
|
2012-03-15 18:20:22 +00:00
|
|
|
int state = 0;
|
|
|
|
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) )
|
|
|
|
{
|
|
|
|
state = 1;
|
|
|
|
}
|
|
|
|
else if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST ) )
|
|
|
|
{
|
|
|
|
state = 2;
|
|
|
|
}
|
2008-12-08 15:27:13 +00:00
|
|
|
config->Write( wxT( FILTERFOOTPRINTKEY ), state );
|
2007-12-04 18:23:38 +00:00
|
|
|
}
|
2009-11-02 22:24:55 +00:00
|
|
|
|
|
|
|
m_auimgr.UnInit();
|
2009-04-23 15:02:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::LoadSettings()
|
2009-04-23 15:02:18 +00:00
|
|
|
{
|
2011-12-16 20:12:49 +00:00
|
|
|
wxASSERT( wxGetApp().GetSettings() != NULL );
|
2009-04-23 15:02:18 +00:00
|
|
|
|
2011-12-16 20:12:49 +00:00
|
|
|
wxConfig* cfg = wxGetApp().GetSettings();
|
2009-04-23 15:02:18 +00:00
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
EDA_BASE_FRAME::LoadSettings();
|
2011-10-13 20:13:11 +00:00
|
|
|
cfg->Read( KeepCvpcbOpenEntry, &m_KeepCvpcbOpen, true );
|
2009-04-23 15:02:18 +00:00
|
|
|
cfg->Read( FootprintDocFileEntry, &m_DocModulesFileName,
|
|
|
|
DEFAULT_FOOTPRINTS_LIST_FILENAME );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::SaveSettings()
|
2009-04-23 15:02:18 +00:00
|
|
|
{
|
2011-12-16 20:12:49 +00:00
|
|
|
wxASSERT( wxGetApp().GetSettings() != NULL );
|
2009-04-23 15:02:18 +00:00
|
|
|
|
2011-12-16 20:12:49 +00:00
|
|
|
wxConfig* cfg = wxGetApp().GetSettings();
|
2009-04-23 15:02:18 +00:00
|
|
|
|
2011-01-21 19:30:59 +00:00
|
|
|
EDA_BASE_FRAME::SaveSettings();
|
2009-04-23 15:02:18 +00:00
|
|
|
cfg->Write( KeepCvpcbOpenEntry, m_KeepCvpcbOpen );
|
|
|
|
cfg->Write( FootprintDocFileEntry, m_DocModulesFileName );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::OnSize( wxSizeEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-12-04 18:23:38 +00:00
|
|
|
event.Skip();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::OnQuit( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2011-08-04 11:23:19 +00:00
|
|
|
Close( true );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-12-04 18:23:38 +00:00
|
|
|
int diag;
|
|
|
|
|
2009-04-23 15:02:18 +00:00
|
|
|
if( m_modified )
|
2007-12-04 18:23:38 +00:00
|
|
|
{
|
2012-03-08 17:47:23 +00:00
|
|
|
wxString msg = _( "Component to Footprint links modified.\nSave before exit ?" );
|
|
|
|
int ii = DisplayExitDialog( this, msg );
|
2007-12-04 18:23:38 +00:00
|
|
|
|
|
|
|
switch( ii )
|
|
|
|
{
|
|
|
|
case wxID_CANCEL:
|
|
|
|
Event.Veto();
|
|
|
|
return;
|
|
|
|
|
|
|
|
case wxID_NO:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case wxID_OK:
|
|
|
|
case wxID_YES:
|
2012-02-11 09:04:26 +00:00
|
|
|
diag = SaveCmpLinkFile( m_NetlistFileName.GetFullPath() );
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
if( diag > 0 )
|
2011-08-24 19:44:05 +00:00
|
|
|
{
|
2009-04-23 15:02:18 +00:00
|
|
|
m_modified = false;
|
2011-08-24 19:44:05 +00:00
|
|
|
}
|
2007-12-04 18:23:38 +00:00
|
|
|
else if( diag == 0 )
|
|
|
|
{
|
2012-02-11 09:04:26 +00:00
|
|
|
if( !IsOK( this, _( "Problem when saving file, exit anyway ?" ) ) )
|
2007-12-04 18:23:38 +00:00
|
|
|
{
|
2008-10-29 23:57:35 +00:00
|
|
|
Event.Veto();
|
2008-10-26 12:11:11 +00:00
|
|
|
return;
|
2007-12-04 18:23:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Close the help frame
|
2011-12-16 20:12:49 +00:00
|
|
|
if( wxGetApp().GetHtmlHelpController() )
|
2007-12-04 18:23:38 +00:00
|
|
|
{
|
2011-12-16 20:12:49 +00:00
|
|
|
if( wxGetApp().GetHtmlHelpController()->GetFrame() )// returns NULL if no help frame active
|
|
|
|
wxGetApp().GetHtmlHelpController()->GetFrame()->Close( true );
|
2007-12-04 18:23:38 +00:00
|
|
|
}
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
if( m_NetlistFileName.IsOk() )
|
2007-12-04 18:23:38 +00:00
|
|
|
{
|
2011-03-17 19:14:45 +00:00
|
|
|
UpdateFileHistory( m_NetlistFileName.GetFullPath() );
|
2007-12-04 18:23:38 +00:00
|
|
|
}
|
|
|
|
|
2011-08-04 11:23:19 +00:00
|
|
|
// Close module display frame
|
|
|
|
if( m_DisplayFootprintFrame )
|
|
|
|
m_DisplayFootprintFrame->Close( true );
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2009-04-23 15:02:18 +00:00
|
|
|
m_modified = false;
|
2007-12-04 18:23:38 +00:00
|
|
|
SaveSettings();
|
|
|
|
Destroy();
|
|
|
|
return;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::OnChar( wxKeyEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-08-20 11:44:06 +00:00
|
|
|
switch( event.GetKeyCode() )
|
|
|
|
{
|
2009-11-05 19:26:52 +00:00
|
|
|
case WXK_LEFT:
|
|
|
|
case WXK_NUMPAD_LEFT:
|
|
|
|
m_ListCmp->SetFocus();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WXK_RIGHT:
|
|
|
|
case WXK_NUMPAD_RIGHT:
|
2011-03-03 19:08:13 +00:00
|
|
|
m_FootprintList->SetFocus();
|
2009-11-05 19:26:52 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
event.Skip();
|
|
|
|
break;
|
2009-08-20 11:44:06 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::ToFirstNA( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-11-05 19:26:52 +00:00
|
|
|
int ii = 0;
|
|
|
|
int selection;
|
2009-04-23 15:02:18 +00:00
|
|
|
|
|
|
|
if( m_components.empty() )
|
|
|
|
return;
|
2007-12-04 18:23:38 +00:00
|
|
|
|
|
|
|
selection = m_ListCmp->GetSelection();
|
2009-04-23 15:02:18 +00:00
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
if( selection < 0 )
|
|
|
|
selection = 0;
|
2008-10-29 23:57:35 +00:00
|
|
|
|
2012-02-01 19:49:37 +00:00
|
|
|
BOOST_FOREACH( COMPONENT_INFO & component, m_components )
|
2011-08-24 19:44:05 +00:00
|
|
|
{
|
2012-02-01 19:49:37 +00:00
|
|
|
if( component.m_Footprint.IsEmpty() && ii > selection )
|
2009-04-23 15:02:18 +00:00
|
|
|
{
|
|
|
|
m_ListCmp->SetSelection( ii );
|
2011-10-12 13:09:12 +00:00
|
|
|
SendMessageToEESCHEMA();
|
2009-04-23 15:02:18 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ii++;
|
2007-12-04 18:23:38 +00:00
|
|
|
}
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2009-04-23 15:02:18 +00:00
|
|
|
m_ListCmp->SetSelection( selection );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::ToPreviousNA( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-11-05 19:26:52 +00:00
|
|
|
int ii;
|
|
|
|
int selection;
|
2009-04-23 15:02:18 +00:00
|
|
|
|
|
|
|
if( m_components.empty() )
|
|
|
|
return;
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2009-04-23 15:02:18 +00:00
|
|
|
ii = m_ListCmp->GetCount() - 1;
|
2007-12-04 18:23:38 +00:00
|
|
|
selection = m_ListCmp->GetSelection();
|
2009-04-23 15:02:18 +00:00
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
if( selection < 0 )
|
2009-04-23 15:02:18 +00:00
|
|
|
selection = m_ListCmp->GetCount() - 1;
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2012-02-01 19:49:37 +00:00
|
|
|
BOOST_REVERSE_FOREACH( COMPONENT_INFO & component, m_components )
|
2011-08-24 19:44:05 +00:00
|
|
|
{
|
2012-02-01 19:49:37 +00:00
|
|
|
if( component.m_Footprint.IsEmpty() && ii < selection )
|
2009-04-23 15:02:18 +00:00
|
|
|
{
|
|
|
|
m_ListCmp->SetSelection( ii );
|
2011-10-12 13:09:12 +00:00
|
|
|
SendMessageToEESCHEMA();
|
2009-04-23 15:02:18 +00:00
|
|
|
return;
|
|
|
|
}
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
ii--;
|
|
|
|
}
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2009-04-23 15:02:18 +00:00
|
|
|
m_ListCmp->SetSelection( selection );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-08-24 19:44:05 +00:00
|
|
|
void CVPCB_MAINFRAME::SaveQuitCvpcb( wxCommandEvent& aEvent )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2011-08-24 19:44:05 +00:00
|
|
|
if( aEvent.GetId() == wxID_SAVEAS )
|
|
|
|
m_NetlistFileName.Clear();
|
|
|
|
|
2012-02-11 09:04:26 +00:00
|
|
|
if( SaveCmpLinkFile( m_NetlistFileName.GetFullPath() ) > 0 )
|
2007-12-04 18:23:38 +00:00
|
|
|
{
|
2009-04-23 15:02:18 +00:00
|
|
|
m_modified = false;
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2009-11-05 19:26:52 +00:00
|
|
|
if( !m_KeepCvpcbOpen )
|
2011-08-04 11:23:19 +00:00
|
|
|
Close( true );
|
2007-12-04 18:23:38 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::DelAssociations( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-11-05 19:26:52 +00:00
|
|
|
wxString Line;
|
2007-12-04 18:23:38 +00:00
|
|
|
|
|
|
|
if( IsOK( this, _( "Delete selections" ) ) )
|
|
|
|
{
|
2012-05-25 06:58:52 +00:00
|
|
|
m_skipComponentSelect = true;
|
2009-05-06 11:55:36 +00:00
|
|
|
m_ListCmp->SetSelection( 0 );
|
|
|
|
|
2012-02-01 19:49:37 +00:00
|
|
|
BOOST_FOREACH( COMPONENT_INFO & component, m_components )
|
2011-08-24 19:44:05 +00:00
|
|
|
{
|
2012-02-01 19:49:37 +00:00
|
|
|
component.m_Footprint.Empty();
|
2007-12-04 18:23:38 +00:00
|
|
|
SetNewPkg( wxEmptyString );
|
|
|
|
}
|
|
|
|
|
2012-05-25 06:58:52 +00:00
|
|
|
m_skipComponentSelect = false;
|
2007-12-04 18:23:38 +00:00
|
|
|
m_ListCmp->SetSelection( 0 );
|
2009-05-06 11:55:36 +00:00
|
|
|
m_undefinedComponentCnt = m_components.size();
|
2007-12-04 18:23:38 +00:00
|
|
|
}
|
|
|
|
|
2010-11-07 20:06:07 +00:00
|
|
|
DisplayStatus();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::LoadNetList( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-04-05 20:49:15 +00:00
|
|
|
wxString oldPath;
|
|
|
|
wxFileName newFileName;
|
|
|
|
int id = event.GetId();
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2009-11-05 19:26:52 +00:00
|
|
|
if( id >= wxID_FILE1 && id <= wxID_FILE9 )
|
2009-04-05 20:49:15 +00:00
|
|
|
{
|
|
|
|
newFileName = GetFileFromHistory( id, _( "Netlist" ) );
|
|
|
|
}
|
|
|
|
else
|
2007-12-04 18:23:38 +00:00
|
|
|
{
|
2010-05-17 20:35:46 +00:00
|
|
|
wxFileDialog dlg( this, _( "Open Net List" ), wxGetCwd(),
|
|
|
|
wxEmptyString, NetlistFileWildcard,
|
2009-04-05 20:49:15 +00:00
|
|
|
wxFD_OPEN | wxFD_FILE_MUST_EXIST | wxFD_CHANGE_DIR );
|
|
|
|
|
|
|
|
if( dlg.ShowModal() == wxID_CANCEL )
|
|
|
|
return;
|
|
|
|
|
|
|
|
newFileName = dlg.GetPath();
|
2007-12-04 18:23:38 +00:00
|
|
|
}
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
if( newFileName == m_NetlistFileName )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if( m_NetlistFileName.DirExists() )
|
|
|
|
oldPath = m_NetlistFileName.GetPath();
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
/* Update the library search path list. */
|
|
|
|
if( wxGetApp().GetLibraryPathList().Index( oldPath ) != wxNOT_FOUND )
|
|
|
|
wxGetApp().GetLibraryPathList().Remove( oldPath );
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
wxGetApp().GetLibraryPathList().Insert( newFileName.GetPath(), 0 );
|
|
|
|
m_NetlistFileName = newFileName;
|
2012-02-11 09:04:26 +00:00
|
|
|
ReadNetListAndLinkFiles();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::ConfigCvpcb( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-04-21 17:56:27 +00:00
|
|
|
DIALOG_CVPCB_CONFIG ConfigFrame( this );
|
2009-11-05 19:26:52 +00:00
|
|
|
|
2009-04-21 17:56:27 +00:00
|
|
|
ConfigFrame.ShowModal();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::OnKeepOpenOnSave( wxCommandEvent& event )
|
2009-04-23 15:02:18 +00:00
|
|
|
{
|
|
|
|
m_KeepCvpcbOpen = event.IsChecked();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::DisplayModule( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-12-04 18:23:38 +00:00
|
|
|
CreateScreenCmp();
|
2011-08-04 11:23:19 +00:00
|
|
|
m_DisplayFootprintFrame->RedrawScreen( wxPoint( 0, 0 ), false );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::SetLanguage( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2011-01-21 19:30:59 +00:00
|
|
|
EDA_BASE_FRAME::SetLanguage( event );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::DisplayDocFile( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2011-08-24 19:44:05 +00:00
|
|
|
GetAssociatedDocument( this, m_DocModulesFileName, &wxGetApp().GetLibraryPathList() );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::OnLeftClick( wxListEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-12-04 18:23:38 +00:00
|
|
|
m_FootprintList->OnLeftClick( event );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::OnLeftDClick( wxListEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-12-04 18:23:38 +00:00
|
|
|
m_FootprintList->OnLeftDClick( event );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2011-12-18 20:22:16 +00:00
|
|
|
/* Called when clicking on a component in component list window
|
2012-05-25 06:58:52 +00:00
|
|
|
* * Updates the filtered footprint list, if the filtered list option is selected
|
2011-12-18 20:22:16 +00:00
|
|
|
* * Updates the current selected footprint in footprint list
|
|
|
|
* * Updates the footprint shown in footprint display window (if opened)
|
|
|
|
*/
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2012-05-25 06:58:52 +00:00
|
|
|
if( m_skipComponentSelect )
|
|
|
|
return;
|
|
|
|
|
2011-12-18 20:22:16 +00:00
|
|
|
#define REDRAW_LIST true
|
|
|
|
#define SELECT_FULL_LIST true
|
|
|
|
int selection = -1;
|
2007-12-04 18:23:38 +00:00
|
|
|
|
2012-03-15 18:20:22 +00:00
|
|
|
if( !m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST )
|
2012-05-25 06:58:52 +00:00
|
|
|
&& !m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST )
|
|
|
|
)
|
2011-12-18 20:22:16 +00:00
|
|
|
m_FootprintList->SetActiveFootprintList( SELECT_FULL_LIST, REDRAW_LIST );
|
|
|
|
|
|
|
|
else
|
2007-12-04 18:23:38 +00:00
|
|
|
{
|
2011-12-18 20:22:16 +00:00
|
|
|
selection = m_ListCmp->GetSelection();
|
|
|
|
|
|
|
|
if( selection < 0 )
|
|
|
|
m_FootprintList->SetActiveFootprintList( SELECT_FULL_LIST, REDRAW_LIST );
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( &m_components[ selection ] == NULL )
|
|
|
|
m_FootprintList->SetActiveFootprintList( SELECT_FULL_LIST, REDRAW_LIST );
|
|
|
|
else
|
2012-03-15 18:20:22 +00:00
|
|
|
{
|
|
|
|
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST ) )
|
|
|
|
{
|
|
|
|
m_FootprintList->SetFootprintFilteredByPinCount( &m_components[ selection ],
|
|
|
|
m_footprints );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_FootprintList->SetFootprintFilteredList( &m_components[ selection ],
|
|
|
|
m_footprints );
|
|
|
|
}
|
|
|
|
}
|
2011-12-18 20:22:16 +00:00
|
|
|
}
|
2007-12-04 18:23:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
selection = m_ListCmp->GetSelection();
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
if( selection < 0 )
|
|
|
|
return;
|
2011-12-14 20:23:32 +00:00
|
|
|
|
|
|
|
// Preview of the already assigned footprint.
|
2012-05-25 06:58:52 +00:00
|
|
|
// Find the footprint that was already choosen for this component and select it,
|
|
|
|
// but only if the selection is made from the component list.
|
|
|
|
// If the selection is made from the footprint list, do not change the current selected footprint.
|
2011-12-14 20:23:32 +00:00
|
|
|
|
2012-05-25 06:58:52 +00:00
|
|
|
if( FindFocus() == m_ListCmp )
|
2011-12-14 20:23:32 +00:00
|
|
|
{
|
2012-05-25 06:58:52 +00:00
|
|
|
wxString module = *(&m_components[ selection ].m_Footprint);
|
2011-12-14 20:23:32 +00:00
|
|
|
|
2012-05-25 06:58:52 +00:00
|
|
|
bool found = false;
|
|
|
|
for( int ii = 0; ii < m_FootprintList->GetCount(); ii++ )
|
2011-12-18 20:22:16 +00:00
|
|
|
{
|
2012-05-25 06:58:52 +00:00
|
|
|
wxString footprintName;
|
|
|
|
wxString msg = (*m_FootprintList->m_ActiveFootprintList)[ii];
|
|
|
|
msg.Trim( true );
|
|
|
|
msg.Trim( false );
|
|
|
|
footprintName = msg.AfterFirst( wxChar( ' ' ) );
|
|
|
|
|
|
|
|
if( module.Cmp( footprintName ) == 0 )
|
|
|
|
{
|
|
|
|
m_FootprintList->SetSelection( ii, true );
|
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
2011-12-18 20:22:16 +00:00
|
|
|
}
|
2012-05-25 06:58:52 +00:00
|
|
|
if( ! found )
|
2011-12-18 20:22:16 +00:00
|
|
|
{
|
2012-05-25 06:58:52 +00:00
|
|
|
int ii = m_FootprintList->GetSelection();
|
|
|
|
if ( ii >= 0 )
|
|
|
|
m_FootprintList->SetSelection( ii, false );
|
|
|
|
if( m_DisplayFootprintFrame )
|
|
|
|
{
|
|
|
|
CreateScreenCmp();
|
|
|
|
}
|
2011-12-18 20:22:16 +00:00
|
|
|
}
|
2011-12-14 20:23:32 +00:00
|
|
|
}
|
|
|
|
|
2011-10-12 13:09:12 +00:00
|
|
|
SendMessageToEESCHEMA();
|
2010-11-07 20:06:07 +00:00
|
|
|
DisplayStatus();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::OnSelectFilteringFootprint( wxCommandEvent& event )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2011-08-04 11:23:19 +00:00
|
|
|
switch( event.GetId() )
|
2009-11-07 14:36:54 +00:00
|
|
|
{
|
2012-03-15 18:20:22 +00:00
|
|
|
case ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST:
|
|
|
|
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, false );
|
|
|
|
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, false );
|
|
|
|
break;
|
|
|
|
|
2011-08-04 11:23:19 +00:00
|
|
|
case ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST:
|
2011-12-16 13:32:23 +00:00
|
|
|
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, false );
|
2012-03-15 18:20:22 +00:00
|
|
|
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, false );
|
2011-08-04 11:23:19 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST:
|
2011-12-16 13:32:23 +00:00
|
|
|
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, false );
|
2012-03-15 18:20:22 +00:00
|
|
|
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, false );
|
2011-08-04 11:23:19 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2009-11-07 14:36:54 +00:00
|
|
|
break;
|
|
|
|
}
|
2011-08-04 11:23:19 +00:00
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
wxListEvent l_event;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-12-04 18:23:38 +00:00
|
|
|
OnSelectComponent( l_event );
|
|
|
|
}
|
2009-04-23 15:02:18 +00:00
|
|
|
|
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::OnUpdateKeepOpenOnSave( wxUpdateUIEvent& event )
|
2009-04-23 15:02:18 +00:00
|
|
|
{
|
|
|
|
event.Check( m_KeepCvpcbOpen );
|
|
|
|
}
|
2010-11-07 20:06:07 +00:00
|
|
|
|
|
|
|
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::DisplayStatus()
|
2010-11-07 20:06:07 +00:00
|
|
|
{
|
|
|
|
wxString msg;
|
2011-08-04 11:23:19 +00:00
|
|
|
|
2012-01-04 06:18:38 +00:00
|
|
|
msg.Printf( _( "Components: %d (free: %d)" ), (int) m_components.size(), m_undefinedComponentCnt );
|
2010-11-07 20:06:07 +00:00
|
|
|
SetStatusText( msg, 0 );
|
|
|
|
|
|
|
|
SetStatusText( wxEmptyString, 1 );
|
|
|
|
|
|
|
|
if( m_FootprintList )
|
|
|
|
{
|
|
|
|
if( m_FootprintList->m_UseFootprintFullList )
|
|
|
|
msg.Printf( _( "Footprints (All): %d" ),
|
2012-01-04 06:18:38 +00:00
|
|
|
(int) m_FootprintList->m_ActiveFootprintList->GetCount() );
|
2010-11-07 20:06:07 +00:00
|
|
|
else
|
|
|
|
msg.Printf( _( "Footprints (filtered): %d" ),
|
2012-01-04 06:18:38 +00:00
|
|
|
(int) m_FootprintList->m_ActiveFootprintList->GetCount() );
|
2010-11-07 20:06:07 +00:00
|
|
|
}
|
|
|
|
else
|
2011-08-24 19:44:05 +00:00
|
|
|
{
|
2010-11-07 20:06:07 +00:00
|
|
|
msg.Empty();
|
2011-08-24 19:44:05 +00:00
|
|
|
}
|
|
|
|
|
2010-11-07 20:06:07 +00:00
|
|
|
SetStatusText( msg, 2 );
|
|
|
|
}
|
2011-02-22 17:59:46 +00:00
|
|
|
|
2011-08-04 11:23:19 +00:00
|
|
|
|
|
|
|
bool CVPCB_MAINFRAME::LoadFootprintFiles()
|
2011-02-22 17:59:46 +00:00
|
|
|
{
|
|
|
|
/* Check if there are footprint libraries in project file */
|
|
|
|
if( m_ModuleLibNames.GetCount() == 0 )
|
|
|
|
{
|
|
|
|
wxMessageBox( _( "No PCB footprint libraries are listed in the current project file." ),
|
|
|
|
_( "Project File Error" ), wxOK | wxICON_ERROR );
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-08-04 11:23:19 +00:00
|
|
|
m_footprints.ReadFootprintFiles( m_ModuleLibNames );
|
2011-02-22 17:59:46 +00:00
|
|
|
|
|
|
|
/* Display error messages, if any */
|
|
|
|
if( !m_footprints.m_filesNotFound.IsEmpty() || !m_footprints.m_filesInvalid.IsEmpty() )
|
|
|
|
{
|
2011-09-04 18:35:14 +00:00
|
|
|
HTML_MESSAGE_BOX dialog( this, _("Load Error") );
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2011-02-22 17:59:46 +00:00
|
|
|
if( !m_footprints.m_filesNotFound.IsEmpty() )
|
|
|
|
{
|
2011-08-04 11:23:19 +00:00
|
|
|
wxString message = _( "Some files could not be found!" );
|
|
|
|
dialog.MessageSet( message );
|
|
|
|
dialog.ListSet( m_footprints.m_filesNotFound );
|
2011-02-22 17:59:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Display if there are invalid files */
|
|
|
|
if( !m_footprints.m_filesInvalid.IsEmpty() )
|
|
|
|
{
|
2011-08-04 11:23:19 +00:00
|
|
|
dialog.MessageSet( _( "Some files are invalid!" ) );
|
|
|
|
dialog.ListSet( m_footprints.m_filesInvalid );
|
2011-02-22 17:59:46 +00:00
|
|
|
}
|
2011-08-24 19:44:05 +00:00
|
|
|
|
2011-02-22 17:59:46 +00:00
|
|
|
dialog.ShowModal();
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2011-08-24 19:44:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
void CVPCB_MAINFRAME::UpdateTitle()
|
|
|
|
{
|
|
|
|
wxString title;
|
|
|
|
|
|
|
|
if( m_NetlistFileName.IsOk() && m_NetlistFileName.FileExists() )
|
|
|
|
{
|
|
|
|
title = wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion() +
|
|
|
|
wxT( " " ) + m_NetlistFileName.GetFullPath();
|
|
|
|
|
|
|
|
if( !m_NetlistFileName.IsFileWritable() )
|
|
|
|
title += _( " [Read Only]" );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
title = wxGetApp().GetTitle() + wxT( " " ) + GetBuildVersion() +
|
|
|
|
wxT( " " ) + _( " [no file]" );
|
|
|
|
}
|
|
|
|
|
|
|
|
SetTitle( title );
|
|
|
|
}
|
2011-10-12 13:09:12 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Send a remote command to Eeschema via a socket,
|
|
|
|
* Commands are
|
|
|
|
* $PART: "reference" put cursor on component anchor
|
|
|
|
*/
|
|
|
|
void CVPCB_MAINFRAME::SendMessageToEESCHEMA()
|
|
|
|
{
|
|
|
|
char cmd[1024];
|
|
|
|
int selection;
|
2012-02-01 19:49:37 +00:00
|
|
|
COMPONENT_INFO* Component;
|
2011-10-12 13:09:12 +00:00
|
|
|
|
|
|
|
if( m_components.empty() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
selection = m_ListCmp->GetSelection();
|
|
|
|
|
2011-12-14 20:23:32 +00:00
|
|
|
if ( selection < 0 )
|
|
|
|
selection = 0;
|
2011-10-12 13:09:12 +00:00
|
|
|
|
|
|
|
if( &m_components[ selection ] == NULL )
|
2011-12-14 20:23:32 +00:00
|
|
|
return;
|
2011-10-12 13:09:12 +00:00
|
|
|
|
2011-12-14 20:23:32 +00:00
|
|
|
Component = &m_components[ selection ];
|
2011-10-12 13:09:12 +00:00
|
|
|
|
|
|
|
sprintf( cmd, "$PART: \"%s\"", TO_UTF8( Component->m_Reference ) );
|
|
|
|
|
|
|
|
SendCommand( MSG_TO_SCH, cmd );
|
|
|
|
|
|
|
|
}
|