2013-05-28 16:54:59 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2022-10-17 13:19:39 +00:00
|
|
|
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
2013-05-28 16:54:59 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2021-06-03 17:03:25 +00:00
|
|
|
#include <board_commit.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <confirm.h>
|
2021-04-04 09:41:48 +00:00
|
|
|
#include <dialog_footprint_properties_fp_editor.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <footprint_edit_frame.h>
|
|
|
|
#include <footprint_tree_pane.h>
|
|
|
|
#include <fp_lib_table.h>
|
|
|
|
#include <functional>
|
2018-08-19 16:53:01 +00:00
|
|
|
#include <kiway_express.h>
|
2022-12-15 00:15:40 +00:00
|
|
|
#include <pcb_group.h>
|
2022-08-20 10:44:40 +00:00
|
|
|
#include <pcb_marker.h>
|
2023-03-30 11:49:23 +00:00
|
|
|
#include <pcb_textbox.h>
|
|
|
|
#include <pcb_shape.h>
|
2022-08-20 10:44:40 +00:00
|
|
|
#include <pad.h>
|
|
|
|
#include <zone.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <settings/color_settings.h>
|
2014-07-09 11:50:27 +00:00
|
|
|
#include <tool/tool_manager.h>
|
2017-02-21 12:42:08 +00:00
|
|
|
#include <tools/pcb_actions.h>
|
2022-08-20 10:01:43 +00:00
|
|
|
#include <tools/footprint_editor_control.h>
|
2020-09-30 03:29:58 +00:00
|
|
|
#include <widgets/appearance_controls.h>
|
2020-01-13 01:44:19 +00:00
|
|
|
#include <widgets/lib_tree.h>
|
2021-07-21 23:14:56 +00:00
|
|
|
#include <pcb_layer_box_selector.h>
|
2021-12-04 23:52:00 +00:00
|
|
|
#include <pcb_dimension.h>
|
2023-09-28 03:15:54 +00:00
|
|
|
#include <project_pcb.h>
|
2021-12-04 23:52:00 +00:00
|
|
|
#include <dialogs/dialog_dimension_properties.h>
|
2012-05-09 17:37:25 +00:00
|
|
|
|
2016-06-29 10:23:11 +00:00
|
|
|
using namespace std::placeholders;
|
2014-07-09 13:10:32 +00:00
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2022-01-10 14:03:30 +00:00
|
|
|
void FOOTPRINT_EDIT_FRAME::OnLoadFootprintFromBoard( wxCommandEvent& event )
|
2009-05-21 17:42:42 +00:00
|
|
|
{
|
2021-07-19 23:56:05 +00:00
|
|
|
LoadFootprintFromBoard( nullptr );
|
2018-10-15 14:28:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-01-31 14:08:05 +00:00
|
|
|
void FOOTPRINT_EDIT_FRAME::LoadFootprintFromLibrary( LIB_ID aFPID )
|
2018-10-15 14:28:53 +00:00
|
|
|
{
|
2019-01-18 16:24:40 +00:00
|
|
|
bool is_last_fp_from_brd = IsCurrentFPFromBoard();
|
|
|
|
|
2020-11-13 15:15:52 +00:00
|
|
|
FOOTPRINT* footprint = LoadFootprint( aFPID );
|
2018-10-15 14:28:53 +00:00
|
|
|
|
2020-11-08 21:29:04 +00:00
|
|
|
if( !footprint )
|
2010-06-14 20:16:47 +00:00
|
|
|
return;
|
|
|
|
|
2018-10-15 14:28:53 +00:00
|
|
|
if( !Clear_Pcb( true ) )
|
|
|
|
return;
|
|
|
|
|
2019-06-13 17:28:55 +00:00
|
|
|
GetCanvas()->GetViewControls()->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false );
|
2020-11-10 20:31:52 +00:00
|
|
|
AddFootprintToBoard( footprint );
|
2018-10-15 14:28:53 +00:00
|
|
|
|
2020-11-08 21:29:04 +00:00
|
|
|
footprint->ClearFlags();
|
2019-05-31 00:15:57 +00:00
|
|
|
|
2023-06-06 17:30:03 +00:00
|
|
|
// if either reference or value are missing, reinstall them -
|
2020-11-08 21:29:04 +00:00
|
|
|
// otherwise you cannot see what you are doing on board
|
2023-06-06 17:30:03 +00:00
|
|
|
if( footprint->Reference().GetText().IsEmpty() )
|
|
|
|
footprint->SetReference( wxT( "Ref**" ) );
|
2018-10-15 14:28:53 +00:00
|
|
|
|
2023-06-06 17:30:03 +00:00
|
|
|
if( footprint->Value().GetText().IsEmpty() )
|
|
|
|
footprint->SetValue( wxT( "Val**" ) );
|
2018-10-15 14:28:53 +00:00
|
|
|
|
2022-04-21 07:00:04 +00:00
|
|
|
Zoom_Automatique( false );
|
2009-05-21 17:42:42 +00:00
|
|
|
|
2021-04-09 02:09:06 +00:00
|
|
|
Update3DView( true, true );
|
2018-10-15 14:28:53 +00:00
|
|
|
|
2021-05-28 19:07:04 +00:00
|
|
|
GetScreen()->SetContentModified( false );
|
2018-10-15 14:28:53 +00:00
|
|
|
|
2020-11-10 20:11:53 +00:00
|
|
|
UpdateView();
|
2019-06-13 17:28:55 +00:00
|
|
|
GetCanvas()->Refresh();
|
2018-10-24 20:14:36 +00:00
|
|
|
|
2019-06-03 23:50:44 +00:00
|
|
|
// Update the save items if needed.
|
2019-01-18 16:24:40 +00:00
|
|
|
if( is_last_fp_from_brd )
|
2019-06-03 23:50:44 +00:00
|
|
|
{
|
|
|
|
ReCreateMenuBar();
|
2019-01-18 16:24:40 +00:00
|
|
|
ReCreateHToolbar();
|
2019-06-03 23:50:44 +00:00
|
|
|
}
|
2019-01-18 16:24:40 +00:00
|
|
|
|
2018-10-24 20:14:36 +00:00
|
|
|
m_treePane->GetLibTree()->ExpandLibId( aFPID );
|
2021-10-01 21:45:49 +00:00
|
|
|
|
|
|
|
m_centerItemOnIdle = aFPID;
|
|
|
|
Bind( wxEVT_IDLE, &FOOTPRINT_EDIT_FRAME::centerItemIdleHandler, this );
|
|
|
|
|
2019-11-26 21:38:57 +00:00
|
|
|
m_treePane->GetLibTree()->RefreshLibTree(); // update highlighting
|
2009-05-21 17:42:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-10-01 21:45:49 +00:00
|
|
|
void FOOTPRINT_EDIT_FRAME::centerItemIdleHandler( wxIdleEvent& aEvent )
|
|
|
|
{
|
|
|
|
m_treePane->GetLibTree()->CenterLibId( m_centerItemOnIdle );
|
|
|
|
Unbind( wxEVT_IDLE, &FOOTPRINT_EDIT_FRAME::centerItemIdleHandler, this );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-11-10 20:11:53 +00:00
|
|
|
void FOOTPRINT_EDIT_FRAME::SelectLayer( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2020-11-10 20:11:53 +00:00
|
|
|
SetActiveLayer( ToLAYER_ID( m_selLayerBox->GetLayerSelection() ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2020-11-10 20:11:53 +00:00
|
|
|
if( GetDisplayOptions().m_ContrastModeDisplay != HIGH_CONTRAST_MODE::NORMAL )
|
|
|
|
GetCanvas()->Refresh();
|
|
|
|
}
|
2019-11-03 17:14:21 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2022-01-10 14:03:30 +00:00
|
|
|
void FOOTPRINT_EDIT_FRAME::OnSaveFootprintToBoard( wxCommandEvent& event )
|
2020-11-10 20:11:53 +00:00
|
|
|
{
|
|
|
|
SaveFootprintToBoard( true );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2011-11-24 17:32:51 +00:00
|
|
|
|
2019-09-04 16:18:42 +00:00
|
|
|
class BASIC_FOOTPRINT_INFO : public FOOTPRINT_INFO
|
|
|
|
{
|
|
|
|
public:
|
2020-11-13 15:15:52 +00:00
|
|
|
BASIC_FOOTPRINT_INFO( FOOTPRINT* aFootprint )
|
2019-09-04 16:18:42 +00:00
|
|
|
{
|
2022-10-17 13:19:39 +00:00
|
|
|
wxASSERT( aFootprint );
|
|
|
|
|
2020-11-13 02:09:34 +00:00
|
|
|
m_nickname = aFootprint->GetFPID().GetLibNickname().wx_str();
|
|
|
|
m_fpname = aFootprint->GetFPID().GetLibItemName().wx_str();
|
|
|
|
m_pad_count = aFootprint->GetPadCount( DO_NOT_INCLUDE_NPTH );
|
|
|
|
m_unique_pad_count = aFootprint->GetUniquePadCount( DO_NOT_INCLUDE_NPTH );
|
|
|
|
m_keywords = aFootprint->GetKeywords();
|
2023-06-19 17:08:18 +00:00
|
|
|
m_doc = aFootprint->GetLibDescription();
|
2019-09-04 16:18:42 +00:00
|
|
|
m_loaded = true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2022-04-21 10:57:15 +00:00
|
|
|
void FOOTPRINT_EDIT_FRAME::UpdateLibraryTree( const wxDataViewItem& aTreeItem,
|
|
|
|
FOOTPRINT* aFootprint )
|
2018-09-13 15:39:14 +00:00
|
|
|
{
|
2022-10-26 18:39:44 +00:00
|
|
|
wxCHECK( aFootprint, /* void */ );
|
|
|
|
|
2020-11-13 02:09:34 +00:00
|
|
|
BASIC_FOOTPRINT_INFO footprintInfo( aFootprint );
|
2019-09-06 13:37:26 +00:00
|
|
|
|
2022-04-21 10:57:15 +00:00
|
|
|
if( aTreeItem.IsOk() ) // Can be not found in tree if the current footprint is imported
|
|
|
|
// from file therefore not yet in tree.
|
2019-09-06 13:37:26 +00:00
|
|
|
{
|
2022-04-21 10:57:15 +00:00
|
|
|
static_cast<LIB_TREE_NODE_LIB_ID*>( aTreeItem.GetID() )->Update( &footprintInfo );
|
2019-11-26 21:38:57 +00:00
|
|
|
m_treePane->GetLibTree()->RefreshLibTree();
|
2019-09-06 13:37:26 +00:00
|
|
|
}
|
2022-04-21 10:57:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FOOTPRINT_EDIT_FRAME::editFootprintProperties( FOOTPRINT* aFootprint )
|
|
|
|
{
|
|
|
|
LIB_ID oldFPID = aFootprint->GetFPID();
|
|
|
|
|
|
|
|
DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR dialog( this, aFootprint );
|
|
|
|
dialog.ShowModal();
|
2019-09-04 16:18:42 +00:00
|
|
|
|
2022-04-21 10:57:15 +00:00
|
|
|
// Update library tree and title in case of a name change
|
|
|
|
wxDataViewItem treeItem = m_adapter->FindItem( oldFPID );
|
|
|
|
UpdateLibraryTree( treeItem, aFootprint );
|
|
|
|
UpdateTitle();
|
2019-09-04 16:18:42 +00:00
|
|
|
|
|
|
|
UpdateMsgPanel();
|
2018-09-13 15:39:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-28 23:23:58 +00:00
|
|
|
void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
|
2018-01-31 13:54:31 +00:00
|
|
|
{
|
2019-05-28 00:00:33 +00:00
|
|
|
switch( aItem->Type() )
|
2018-01-31 13:54:31 +00:00
|
|
|
{
|
2023-10-23 17:23:24 +00:00
|
|
|
case PCB_REFERENCE_IMAGE_T:
|
|
|
|
ShowReferenceImagePropertiesDialog( aItem );
|
2022-07-07 14:17:21 +00:00
|
|
|
break;
|
|
|
|
|
2020-11-12 22:30:02 +00:00
|
|
|
case PCB_PAD_T:
|
2020-11-13 15:15:52 +00:00
|
|
|
ShowPadPropertiesDialog( static_cast<PAD*>( aItem ) );
|
2018-01-31 13:54:31 +00:00
|
|
|
break;
|
|
|
|
|
2020-11-13 12:21:02 +00:00
|
|
|
case PCB_FOOTPRINT_T:
|
2020-11-13 15:15:52 +00:00
|
|
|
editFootprintProperties( static_cast<FOOTPRINT*>( aItem ) );
|
2019-06-13 17:28:55 +00:00
|
|
|
GetCanvas()->Refresh();
|
2018-01-31 13:54:31 +00:00
|
|
|
break;
|
|
|
|
|
2023-06-06 15:09:34 +00:00
|
|
|
case PCB_FIELD_T:
|
2023-03-30 11:49:23 +00:00
|
|
|
case PCB_TEXT_T:
|
|
|
|
ShowTextPropertiesDialog( static_cast<PCB_TEXT*>( aItem ) );
|
2019-05-28 00:00:33 +00:00
|
|
|
break;
|
|
|
|
|
2023-03-30 11:49:23 +00:00
|
|
|
case PCB_TEXTBOX_T:
|
|
|
|
ShowTextBoxPropertiesDialog( static_cast<PCB_TEXTBOX*>( aItem ) );
|
2022-01-30 10:52:52 +00:00
|
|
|
break;
|
|
|
|
|
2023-03-30 11:49:23 +00:00
|
|
|
case PCB_SHAPE_T :
|
|
|
|
ShowGraphicItemPropertiesDialog( static_cast<PCB_SHAPE*>( aItem ) );
|
2018-01-31 13:54:31 +00:00
|
|
|
break;
|
|
|
|
|
2023-03-30 11:49:23 +00:00
|
|
|
case PCB_DIM_ALIGNED_T:
|
|
|
|
case PCB_DIM_CENTER_T:
|
|
|
|
case PCB_DIM_RADIAL_T:
|
|
|
|
case PCB_DIM_ORTHOGONAL_T:
|
|
|
|
case PCB_DIM_LEADER_T:
|
2021-12-04 23:52:00 +00:00
|
|
|
{
|
|
|
|
DIALOG_DIMENSION_PROPERTIES dlg( this, static_cast<PCB_DIMENSION_BASE*>( aItem ) );
|
|
|
|
dlg.ShowQuasiModal();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2023-03-30 11:49:23 +00:00
|
|
|
case PCB_ZONE_T:
|
2019-10-26 15:49:29 +00:00
|
|
|
{
|
2020-11-11 23:05:59 +00:00
|
|
|
ZONE* zone = static_cast<ZONE*>( aItem );
|
|
|
|
bool success = false;
|
|
|
|
ZONE_SETTINGS zoneSettings;
|
2020-08-09 11:22:09 +00:00
|
|
|
|
2020-11-11 23:05:59 +00:00
|
|
|
zoneSettings << *static_cast<ZONE*>( aItem );
|
2020-08-09 11:22:09 +00:00
|
|
|
|
2020-09-21 23:32:07 +00:00
|
|
|
if( zone->GetIsRuleArea() )
|
2019-10-26 15:49:29 +00:00
|
|
|
{
|
2021-02-20 18:22:11 +00:00
|
|
|
success = InvokeRuleAreaEditor( this, &zoneSettings ) == wxID_OK;
|
2020-08-09 11:22:09 +00:00
|
|
|
}
|
|
|
|
else if( zone->IsOnCopperLayer() )
|
|
|
|
{
|
2021-02-20 18:22:11 +00:00
|
|
|
success = InvokeCopperZonesEditor( this, &zoneSettings ) == wxID_OK;
|
2020-08-09 11:22:09 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2021-02-20 18:22:11 +00:00
|
|
|
success = InvokeNonCopperZonesEditor( this, &zoneSettings ) == wxID_OK;
|
2020-08-09 11:22:09 +00:00
|
|
|
}
|
2019-10-26 15:49:29 +00:00
|
|
|
|
2020-08-09 11:22:09 +00:00
|
|
|
if( success )
|
|
|
|
{
|
|
|
|
BOARD_COMMIT commit( this );
|
|
|
|
commit.Modify( zone );
|
|
|
|
commit.Push( _( "Edit Zone" ) );
|
2020-11-11 23:05:59 +00:00
|
|
|
zoneSettings.ExportSetting( *static_cast<ZONE*>( aItem ) );
|
2019-10-26 15:49:29 +00:00
|
|
|
}
|
2021-07-19 23:56:05 +00:00
|
|
|
|
|
|
|
break;
|
2019-10-26 15:49:29 +00:00
|
|
|
}
|
|
|
|
|
2020-12-01 23:42:53 +00:00
|
|
|
case PCB_GROUP_T:
|
2023-10-18 16:11:21 +00:00
|
|
|
m_toolManager->RunAction( PCB_ACTIONS::groupProperties, static_cast<PCB_GROUP*>( aItem ) );
|
2020-12-01 23:42:53 +00:00
|
|
|
break;
|
|
|
|
|
2022-08-20 10:01:43 +00:00
|
|
|
case PCB_MARKER_T:
|
|
|
|
m_toolManager->GetTool<FOOTPRINT_EDITOR_CONTROL>()->CrossProbe( static_cast<PCB_MARKER*>( aItem ) );
|
|
|
|
break;
|
|
|
|
|
2018-01-31 13:54:31 +00:00
|
|
|
default:
|
2022-02-04 22:44:59 +00:00
|
|
|
wxFAIL_MSG( wxT( "FOOTPRINT_EDIT_FRAME::OnEditItemRequest: unsupported item type " )
|
2020-12-01 23:42:53 +00:00
|
|
|
+ aItem->GetClass() );
|
2019-05-28 00:00:33 +00:00
|
|
|
break;
|
2018-01-31 13:54:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-28 00:00:33 +00:00
|
|
|
|
2017-08-04 12:43:02 +00:00
|
|
|
COLOR4D FOOTPRINT_EDIT_FRAME::GetGridColor()
|
2013-04-11 18:29:56 +00:00
|
|
|
{
|
2020-05-16 17:15:43 +00:00
|
|
|
return GetColorSettings()->GetColor( LAYER_GRID );
|
2013-04-11 18:29:56 +00:00
|
|
|
}
|
|
|
|
|
2014-07-09 09:22:43 +00:00
|
|
|
|
2017-03-13 03:19:33 +00:00
|
|
|
void FOOTPRINT_EDIT_FRAME::SetActiveLayer( PCB_LAYER_ID aLayer )
|
2014-07-09 09:59:23 +00:00
|
|
|
{
|
|
|
|
PCB_BASE_FRAME::SetActiveLayer( aLayer );
|
|
|
|
|
2020-09-30 03:29:58 +00:00
|
|
|
m_appearancePanel->OnLayerChanged();
|
2015-01-07 19:07:15 +00:00
|
|
|
|
2023-06-26 22:16:51 +00:00
|
|
|
m_toolManager->PostAction( PCB_ACTIONS::layerChanged ); // notify other tools
|
2019-08-28 04:27:39 +00:00
|
|
|
GetCanvas()->SetFocus(); // allow capture of hotkeys
|
2019-06-13 17:28:55 +00:00
|
|
|
GetCanvas()->SetHighContrastLayer( aLayer );
|
|
|
|
GetCanvas()->Refresh();
|
2014-07-09 09:59:23 +00:00
|
|
|
}
|
2017-10-19 21:15:48 +00:00
|
|
|
|
2022-08-20 10:44:40 +00:00
|
|
|
|
2017-10-19 21:15:48 +00:00
|
|
|
bool FOOTPRINT_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
|
|
|
|
{
|
2021-01-31 14:08:05 +00:00
|
|
|
if( !Clear_Pcb( true ) )
|
|
|
|
return false; // this command is aborted
|
2017-10-19 21:15:48 +00:00
|
|
|
|
2019-06-13 17:28:55 +00:00
|
|
|
GetCanvas()->GetViewControls()->SetCrossHairCursorPosition( VECTOR2D( 0, 0 ), false );
|
2020-11-10 20:31:52 +00:00
|
|
|
ImportFootprint( aFileSet[ 0 ] );
|
2017-10-19 21:15:48 +00:00
|
|
|
|
2020-11-08 21:29:04 +00:00
|
|
|
if( GetBoard()->GetFirstFootprint() )
|
|
|
|
GetBoard()->GetFirstFootprint()->ClearFlags();
|
2017-10-19 21:15:48 +00:00
|
|
|
|
2021-05-28 19:07:04 +00:00
|
|
|
GetScreen()->SetContentModified( false );
|
2017-10-19 21:15:48 +00:00
|
|
|
Zoom_Automatique( false );
|
2019-06-13 17:28:55 +00:00
|
|
|
GetCanvas()->Refresh();
|
2017-10-19 21:15:48 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2018-08-19 16:53:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
void FOOTPRINT_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
|
|
|
|
{
|
|
|
|
const std::string& payload = mail.GetPayload();
|
|
|
|
|
|
|
|
switch( mail.Command() )
|
|
|
|
{
|
|
|
|
case MAIL_FP_EDIT:
|
|
|
|
if( !payload.empty() )
|
|
|
|
{
|
|
|
|
wxFileName fpFileName( payload );
|
2020-12-18 00:25:51 +00:00
|
|
|
wxString libNickname;
|
|
|
|
wxString msg;
|
2018-08-19 16:53:01 +00:00
|
|
|
|
2023-09-28 03:15:54 +00:00
|
|
|
FP_LIB_TABLE* libTable = PROJECT_PCB::PcbFootprintLibs( &Prj() );
|
2018-08-19 16:53:01 +00:00
|
|
|
const LIB_TABLE_ROW* libTableRow = libTable->FindRowByURI( fpFileName.GetPath() );
|
|
|
|
|
|
|
|
if( !libTableRow )
|
|
|
|
{
|
2020-12-18 00:25:51 +00:00
|
|
|
msg.Printf( _( "The current configuration does not include a library named '%s'.\n"
|
|
|
|
"Use Manage Footprint Libraries to edit the configuration." ),
|
2018-08-19 16:53:01 +00:00
|
|
|
fpFileName.GetPath() );
|
2021-07-19 23:56:05 +00:00
|
|
|
DisplayErrorMessage( this, _( "Library not found in footprint library table." ),
|
|
|
|
msg );
|
2018-08-19 16:53:01 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
libNickname = libTableRow->GetNickName();
|
|
|
|
|
|
|
|
if( !libTable->HasLibrary( libNickname, true ) )
|
|
|
|
{
|
2020-12-18 00:25:51 +00:00
|
|
|
msg.Printf( _( "The library '%s' is not enabled in the current configuration.\n"
|
|
|
|
"Use Manage Footprint Libraries to edit the configuration." ),
|
|
|
|
libNickname );
|
2018-08-19 16:53:01 +00:00
|
|
|
DisplayErrorMessage( this, _( "Footprint library not enabled." ), msg );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
LIB_ID fpId( libNickname, fpFileName.GetName() );
|
|
|
|
|
|
|
|
if( m_treePane )
|
|
|
|
{
|
|
|
|
m_treePane->GetLibTree()->SelectLibId( fpId );
|
2023-09-28 17:18:19 +00:00
|
|
|
wxCommandEvent event( EVT_LIBITEM_CHOSEN );
|
2018-08-19 16:53:01 +00:00
|
|
|
wxPostEvent( m_treePane, event );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
2023-01-19 00:14:31 +00:00
|
|
|
case MAIL_RELOAD_LIB:
|
|
|
|
SyncLibraryTree( true );
|
|
|
|
RefreshLibraryTree();
|
|
|
|
break;
|
|
|
|
|
2018-08-19 16:53:01 +00:00
|
|
|
default:
|
2022-08-20 10:44:40 +00:00
|
|
|
break;
|
2018-08-19 16:53:01 +00:00
|
|
|
}
|
|
|
|
}
|