2013-05-28 16:54:59 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2016-06-08 11:19:53 +00:00
|
|
|
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
2017-05-25 07:05:35 +00:00
|
|
|
* Copyright (C) 2017 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
|
|
|
|
*/
|
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
/**
|
2018-01-31 16:09:26 +00:00
|
|
|
* @file footprint_editor_utils.cpp
|
2011-09-23 13:57:12 +00:00
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
#include <kiface_i.h>
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
#include <kiway.h>
|
2018-08-19 16:53:01 +00:00
|
|
|
#include <kiway_express.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_drawpanel.h>
|
2014-07-09 09:22:43 +00:00
|
|
|
#include <pcb_draw_panel_gal.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <confirm.h>
|
|
|
|
#include <gestfich.h>
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
#include <pgm_base.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <trigo.h>
|
2016-07-19 17:35:25 +00:00
|
|
|
#include <3d_viewer/eda_3d_viewer.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <kicad_device_context.h>
|
|
|
|
#include <macros.h>
|
2014-07-09 13:02:56 +00:00
|
|
|
#include <invoke_pcb_dialog.h>
|
2018-01-31 08:23:20 +00:00
|
|
|
#include <pcb_layer_widget.h>
|
2016-08-17 15:24:04 +00:00
|
|
|
#include <board_commit.h>
|
2018-06-11 13:42:43 +00:00
|
|
|
#include <view/view.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_board.h>
|
|
|
|
#include <class_module.h>
|
|
|
|
#include <class_edge_mod.h>
|
|
|
|
|
2014-07-09 13:10:32 +00:00
|
|
|
#include <ratsnest_data.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <pcbnew.h>
|
|
|
|
#include <protos.h>
|
|
|
|
#include <pcbnew_id.h>
|
2018-01-29 20:58:58 +00:00
|
|
|
#include <footprint_edit_frame.h>
|
2018-01-31 12:37:36 +00:00
|
|
|
#include <footprint_viewer_frame.h>
|
2018-07-29 15:33:58 +00:00
|
|
|
#include <footprint_tree_pane.h>
|
|
|
|
#include <fp_lib_table.h>
|
|
|
|
#include <widgets/lib_tree.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <collectors.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>
|
2012-01-23 04:33:36 +00:00
|
|
|
|
2018-02-16 19:26:55 +00:00
|
|
|
#include <dialog_edit_footprint_for_fp_editor.h>
|
2015-02-12 03:22:24 +00:00
|
|
|
#include <dialog_move_exact.h>
|
2015-02-12 03:22:24 +00:00
|
|
|
#include <dialog_create_array.h>
|
2012-03-08 17:47:23 +00:00
|
|
|
#include <wildcards_and_files_ext.h>
|
2012-04-09 09:16:47 +00:00
|
|
|
#include <menus_helpers.h>
|
2012-05-09 17:37:25 +00:00
|
|
|
#include <footprint_wizard_frame.h>
|
2017-08-04 12:43:02 +00:00
|
|
|
#include <config_params.h>
|
2012-05-09 17:37:25 +00:00
|
|
|
|
2016-06-29 10:23:11 +00:00
|
|
|
#include <functional>
|
|
|
|
using namespace std::placeholders;
|
2014-07-09 13:10:32 +00:00
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2012-02-19 19:53:11 +00:00
|
|
|
// Functions defined in block_module_editor, but used here
|
2015-02-12 03:22:24 +00:00
|
|
|
// These 3 functions are used in modedit to rotate, mirror or move the
|
|
|
|
// whole footprint so they are called with force_all = true
|
2012-02-19 19:53:11 +00:00
|
|
|
void MirrorMarkedItems( MODULE* module, wxPoint offset, bool force_all = false );
|
|
|
|
void RotateMarkedItems( MODULE* module, wxPoint offset, bool force_all = false );
|
2015-02-12 03:22:24 +00:00
|
|
|
void MoveMarkedItemsExactly( MODULE* module, const wxPoint& centre,
|
|
|
|
const wxPoint& translation, double rotation,
|
|
|
|
bool force_all = false );
|
2012-02-19 19:53:11 +00:00
|
|
|
|
2009-11-18 12:52:19 +00:00
|
|
|
|
2011-08-26 17:01:17 +00:00
|
|
|
BOARD_ITEM* FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay( int aHotKeyCode )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-04-06 16:05:25 +00:00
|
|
|
BOARD_ITEM* item = GetCurItem();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
if( GetBoard()->m_Modules == NULL )
|
2007-08-20 01:20:48 +00:00
|
|
|
return NULL;
|
2010-12-08 20:12:46 +00:00
|
|
|
|
2007-10-27 18:05:50 +00:00
|
|
|
GENERAL_COLLECTORS_GUIDE guide = GetCollectorsGuide();
|
|
|
|
|
|
|
|
// Assign to scanList the proper item types desired based on tool type
|
|
|
|
// or hotkey that is in play.
|
|
|
|
|
|
|
|
const KICAD_T* scanList = NULL;
|
|
|
|
|
|
|
|
if( aHotKeyCode )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2009-11-18 12:52:19 +00:00
|
|
|
// @todo: add switch here and add calls to PcbGeneralLocateAndDisplay(
|
|
|
|
// int aHotKeyCode ) when searching is needed from a hotkey handler
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
else
|
2007-10-27 18:05:50 +00:00
|
|
|
{
|
|
|
|
scanList = GENERAL_COLLECTOR::ModulesAndTheirItems;
|
|
|
|
}
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
m_Collector->Collect( GetBoard(), scanList, RefPos( true ), guide );
|
2007-10-27 18:05:50 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
// Remove redundancies: when an item is found, we can remove the module from list
|
2007-11-12 05:53:48 +00:00
|
|
|
if( m_Collector->GetCount() > 1 )
|
|
|
|
{
|
2009-11-18 12:52:19 +00:00
|
|
|
for( int ii = 0; ii < m_Collector->GetCount(); ii++ )
|
2007-11-12 05:53:48 +00:00
|
|
|
{
|
|
|
|
item = (*m_Collector)[ii];
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-10-01 19:24:27 +00:00
|
|
|
if( item->Type() != PCB_MODULE_T )
|
2007-11-12 05:53:48 +00:00
|
|
|
continue;
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-11-12 05:53:48 +00:00
|
|
|
m_Collector->Remove( ii );
|
|
|
|
ii--;
|
|
|
|
}
|
|
|
|
}
|
2007-10-27 18:05:50 +00:00
|
|
|
|
|
|
|
if( m_Collector->GetCount() <= 1 )
|
|
|
|
{
|
|
|
|
item = (*m_Collector)[0];
|
|
|
|
SetCurItem( item );
|
|
|
|
}
|
2011-08-26 17:01:17 +00:00
|
|
|
else // we can't figure out which item user wants, do popup menu so user can choose
|
2007-10-27 18:05:50 +00:00
|
|
|
{
|
2009-04-06 16:05:25 +00:00
|
|
|
wxMenu itemMenu;
|
2007-10-27 18:05:50 +00:00
|
|
|
|
2018-04-08 10:28:57 +00:00
|
|
|
// Give a title to the selection menu. It also allows one to close the popup menu without any action
|
2016-08-15 18:22:54 +00:00
|
|
|
AddMenuItem( &itemMenu, wxID_NONE, _( "Clarify Selection" ),
|
2017-06-02 09:51:11 +00:00
|
|
|
KiBitmap( info_xpm ) );
|
2007-10-27 18:05:50 +00:00
|
|
|
itemMenu.AppendSeparator();
|
|
|
|
|
2012-09-22 11:19:37 +00:00
|
|
|
int limit = std::min( MAX_ITEMS_IN_PICKER, m_Collector->GetCount() );
|
2007-10-27 18:05:50 +00:00
|
|
|
|
2009-11-18 12:52:19 +00:00
|
|
|
for( int ii = 0; ii<limit; ++ii )
|
2007-10-27 18:05:50 +00:00
|
|
|
{
|
|
|
|
item = (*m_Collector)[ii];
|
|
|
|
|
2018-06-13 16:05:43 +00:00
|
|
|
wxString text = item->GetSelectMenuText( GetUserUnits() );
|
2011-09-08 05:58:45 +00:00
|
|
|
BITMAP_DEF xpm = item->GetMenuImage();
|
2007-10-27 18:05:50 +00:00
|
|
|
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( &itemMenu,
|
|
|
|
ID_POPUP_PCB_ITEM_SELECTION_START + ii,
|
|
|
|
text,
|
2011-09-08 05:58:45 +00:00
|
|
|
KiBitmap( xpm ) );
|
2007-10-27 18:05:50 +00:00
|
|
|
}
|
|
|
|
|
2009-11-18 12:52:19 +00:00
|
|
|
// this menu's handler is void
|
2011-03-01 19:26:17 +00:00
|
|
|
// PCB_BASE_FRAME::ProcessItemSelection()
|
2009-11-18 12:52:19 +00:00
|
|
|
// and it calls SetCurItem() which in turn calls DisplayInfo() on the
|
|
|
|
// item.
|
2016-08-15 18:22:54 +00:00
|
|
|
m_canvas->SetAbortRequest( true ); // changed in false if an item is selected
|
2011-12-29 20:11:42 +00:00
|
|
|
PopupMenu( &itemMenu ); // m_AbortRequest = false if an item is selected
|
2007-10-27 18:05:50 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetIgnoreMouseEvents( false );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2011-08-26 17:01:17 +00:00
|
|
|
// The function ProcessItemSelection() has set the current item, return it.
|
2007-10-27 18:05:50 +00:00
|
|
|
item = GetCurItem();
|
|
|
|
}
|
|
|
|
|
|
|
|
if( item )
|
|
|
|
{
|
2013-01-12 17:32:24 +00:00
|
|
|
SetMsgPanel( item );
|
2007-10-27 18:05:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return item;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2011-08-26 17:01:17 +00:00
|
|
|
|
|
|
|
void FOOTPRINT_EDIT_FRAME::LoadModuleFromBoard( wxCommandEvent& event )
|
2009-05-21 17:42:42 +00:00
|
|
|
{
|
2018-10-15 14:28:53 +00:00
|
|
|
Load_Module_From_BOARD( NULL );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FOOTPRINT_EDIT_FRAME::LoadModuleFromLibrary( LIB_ID aFPID)
|
|
|
|
{
|
|
|
|
MODULE* module = LoadFootprint( aFPID );
|
|
|
|
|
|
|
|
if( !module )
|
2010-06-14 20:16:47 +00:00
|
|
|
return;
|
|
|
|
|
2018-10-15 14:28:53 +00:00
|
|
|
if( !Clear_Pcb( true ) )
|
|
|
|
return;
|
|
|
|
|
|
|
|
SetCrossHairPosition( wxPoint( 0, 0 ) );
|
|
|
|
AddModuleToBoard( module );
|
|
|
|
|
|
|
|
if( GetBoard()->m_Modules )
|
|
|
|
{
|
|
|
|
GetBoard()->m_Modules->ClearFlags();
|
|
|
|
|
|
|
|
// if either m_Reference or m_Value are gone, reinstall them -
|
|
|
|
// otherwise you cannot see what you are doing on board
|
|
|
|
TEXTE_MODULE* ref = &GetBoard()->m_Modules->Reference();
|
|
|
|
TEXTE_MODULE* val = &GetBoard()->m_Modules->Value();
|
|
|
|
|
|
|
|
if( val && ref )
|
|
|
|
{
|
|
|
|
ref->SetType( TEXTE_MODULE::TEXT_is_REFERENCE ); // just in case ...
|
|
|
|
|
|
|
|
if( ref->GetLength() == 0 )
|
|
|
|
ref->SetText( wxT( "Ref**" ) );
|
|
|
|
|
|
|
|
val->SetType( TEXTE_MODULE::TEXT_is_VALUE ); // just in case ...
|
|
|
|
|
|
|
|
if( val->GetLength() == 0 )
|
|
|
|
val->SetText( wxT( "Val**" ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Zoom_Automatique( false );
|
2009-05-21 17:42:42 +00:00
|
|
|
|
2018-05-10 10:49:20 +00:00
|
|
|
Update3DView();
|
2018-10-15 14:28:53 +00:00
|
|
|
|
|
|
|
GetScreen()->ClrModify();
|
|
|
|
|
|
|
|
updateView();
|
|
|
|
m_canvas->Refresh();
|
2018-10-24 20:14:36 +00:00
|
|
|
|
|
|
|
m_treePane->GetLibTree()->ExpandLibId( aFPID );
|
|
|
|
m_treePane->GetLibTree()->CenterLibId( aFPID );
|
2018-11-01 23:33:31 +00:00
|
|
|
m_treePane->GetLibTree()->Refresh(); // update highlighting
|
2009-05-21 17:42:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-08-26 17:01:17 +00:00
|
|
|
void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-11-18 12:52:19 +00:00
|
|
|
int id = event.GetId();
|
|
|
|
wxPoint pos;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-12-22 13:28:11 +00:00
|
|
|
INSTALL_UNBUFFERED_DC( dc, m_canvas );
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
wxGetMousePosition( &pos.x, &pos.y );
|
|
|
|
|
|
|
|
pos.y += 20;
|
|
|
|
|
2009-11-18 12:52:19 +00:00
|
|
|
switch( id )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
case wxID_CUT:
|
|
|
|
case wxID_COPY:
|
|
|
|
case ID_TOOLBARH_PCB_SELECT_LAYER:
|
|
|
|
case ID_MODEDIT_PAD_SETTINGS:
|
|
|
|
case ID_POPUP_PCB_ROTATE_TEXTEPCB:
|
|
|
|
case ID_POPUP_PCB_EDIT_TEXTEPCB:
|
|
|
|
case ID_POPUP_PCB_ROTATE_TEXTMODULE:
|
|
|
|
case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE:
|
|
|
|
case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE:
|
|
|
|
case ID_POPUP_PCB_EDIT_TEXTMODULE:
|
2017-02-03 18:56:56 +00:00
|
|
|
case ID_POPUP_PCB_APPLY_PAD_SETTINGS:
|
|
|
|
case ID_POPUP_PCB_COPY_PAD_SETTINGS:
|
2007-08-20 01:20:48 +00:00
|
|
|
case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
|
|
|
|
case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
|
2012-02-12 19:39:37 +00:00
|
|
|
case ID_POPUP_MODEDIT_EDIT_BODY_ITEM:
|
|
|
|
case ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE:
|
|
|
|
case ID_POPUP_MODEDIT_EDIT_LAYER_ALL_EDGE:
|
2012-08-31 19:19:48 +00:00
|
|
|
case ID_POPUP_PCB_DELETE_EDGE:
|
|
|
|
case ID_POPUP_PCB_DELETE_TEXTMODULE:
|
|
|
|
case ID_POPUP_PCB_DELETE_PAD:
|
2007-08-20 01:20:48 +00:00
|
|
|
case ID_POPUP_DELETE_BLOCK:
|
|
|
|
case ID_POPUP_PLACE_BLOCK:
|
|
|
|
case ID_POPUP_ZOOM_BLOCK:
|
|
|
|
case ID_POPUP_MIRROR_X_BLOCK:
|
|
|
|
case ID_POPUP_ROTATE_BLOCK:
|
2017-07-04 08:08:33 +00:00
|
|
|
case ID_POPUP_DUPLICATE_BLOCK:
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
2009-05-23 07:16:05 +00:00
|
|
|
default:
|
2011-12-22 13:28:11 +00:00
|
|
|
if( m_canvas->IsMouseCaptured() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2009-05-23 07:16:05 +00:00
|
|
|
// for all other commands: stop the move in progress
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->CallEndMouseCapture( &dc );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2011-02-11 20:48:13 +00:00
|
|
|
|
2009-05-23 07:16:05 +00:00
|
|
|
if( id != ID_POPUP_CANCEL_CURRENT_COMMAND )
|
2017-06-12 13:10:43 +00:00
|
|
|
SetNoToolSelected();
|
2011-02-11 20:48:13 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2009-11-18 12:52:19 +00:00
|
|
|
switch( id )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
|
|
|
case ID_EXIT:
|
2009-01-15 08:12:03 +00:00
|
|
|
Close( true );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2012-02-09 20:33:38 +00:00
|
|
|
case ID_OPEN_MODULE_VIEWER:
|
2013-05-28 16:54:59 +00:00
|
|
|
{
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
FOOTPRINT_VIEWER_FRAME* viewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_PCB_MODULE_VIEWER, false );
|
2014-06-01 14:58:17 +00:00
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
if( !viewer )
|
2013-08-03 05:15:23 +00:00
|
|
|
{
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
viewer = (FOOTPRINT_VIEWER_FRAME*) Kiway().Player( FRAME_PCB_MODULE_VIEWER, true );
|
2013-08-03 05:15:23 +00:00
|
|
|
viewer->Show( true );
|
|
|
|
viewer->Zoom_Automatique( false );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-07-16 19:29:40 +00:00
|
|
|
// On Windows, Raise() does not bring the window on screen, when iconized
|
|
|
|
if( viewer->IsIconized() )
|
|
|
|
viewer->Iconize( false );
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
viewer->Raise();
|
2012-02-09 20:33:38 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
// Raising the window does not set the focus on Linux. This should work on
|
|
|
|
// any platform.
|
|
|
|
if( wxWindow::FindFocus() != viewer )
|
|
|
|
viewer->SetFocus();
|
|
|
|
}
|
2012-09-12 09:53:11 +00:00
|
|
|
}
|
2013-08-03 05:15:23 +00:00
|
|
|
break;
|
2012-02-09 20:33:38 +00:00
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
case ID_MODEDIT_DELETE_PART:
|
2018-09-13 23:39:40 +00:00
|
|
|
if( DeleteModuleFromLibrary( getTargetFPID(), true ) )
|
2018-07-29 15:33:58 +00:00
|
|
|
{
|
2018-09-13 23:39:40 +00:00
|
|
|
if( getTargetFPID() == GetLoadedFPID() )
|
2018-07-29 15:33:58 +00:00
|
|
|
Clear_Pcb( false );
|
|
|
|
|
2018-08-06 18:33:28 +00:00
|
|
|
SyncLibraryTree( true );
|
2018-07-29 15:33:58 +00:00
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MODEDIT_NEW_MODULE:
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
{
|
2018-07-29 15:33:58 +00:00
|
|
|
LIB_ID selected = m_treePane->GetLibTree()->GetSelectedLibId();
|
2015-01-28 10:00:48 +00:00
|
|
|
MODULE* module = CreateNewModule( wxEmptyString );
|
2011-02-11 20:48:13 +00:00
|
|
|
|
2018-08-11 20:46:03 +00:00
|
|
|
if( !module )
|
|
|
|
break;
|
2018-04-02 21:31:45 +00:00
|
|
|
|
2018-08-11 20:46:03 +00:00
|
|
|
if( !Clear_Pcb( true ) )
|
|
|
|
break;
|
2018-04-02 21:31:45 +00:00
|
|
|
|
2018-08-11 20:46:03 +00:00
|
|
|
SetCrossHairPosition( wxPoint( 0, 0 ) );
|
|
|
|
AddModuleToBoard( module );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2018-08-11 20:46:03 +00:00
|
|
|
// Initialize data relative to nets and netclasses (for a new
|
|
|
|
// module the defaults are used)
|
|
|
|
// This is mandatory to handle and draw pads
|
|
|
|
GetBoard()->BuildListOfNets();
|
|
|
|
module->SetPosition( wxPoint( 0, 0 ) );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2018-08-11 20:46:03 +00:00
|
|
|
if( GetBoard()->m_Modules )
|
|
|
|
GetBoard()->m_Modules->ClearFlags();
|
2018-07-29 15:33:58 +00:00
|
|
|
|
2018-08-11 20:46:03 +00:00
|
|
|
Zoom_Automatique( false );
|
|
|
|
GetScreen()->SetModify();
|
|
|
|
|
|
|
|
// If selected from the library tree then go ahead and save it there
|
|
|
|
if( !selected.GetLibNickname().empty() )
|
|
|
|
{
|
|
|
|
LIB_ID fpid = module->GetFPID();
|
|
|
|
fpid.SetLibNickname( selected.GetLibNickname() );
|
|
|
|
module->SetFPID( fpid );
|
|
|
|
SaveFootprint( module );
|
|
|
|
GetScreen()->ClrModify();
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
}
|
2014-06-02 10:46:29 +00:00
|
|
|
|
2015-02-10 10:38:22 +00:00
|
|
|
updateView();
|
2015-02-10 08:35:17 +00:00
|
|
|
m_canvas->Refresh();
|
2018-07-29 15:33:58 +00:00
|
|
|
Update3DView();
|
2015-02-10 08:35:17 +00:00
|
|
|
|
2018-08-06 18:33:28 +00:00
|
|
|
SyncLibraryTree( false );
|
2008-09-18 12:07:34 +00:00
|
|
|
}
|
2013-08-03 05:15:23 +00:00
|
|
|
break;
|
2012-08-31 19:19:48 +00:00
|
|
|
|
2012-11-19 16:19:38 +00:00
|
|
|
case ID_MODEDIT_NEW_MODULE_FROM_WIZARD:
|
2013-05-28 16:54:59 +00:00
|
|
|
{
|
2018-07-29 15:33:58 +00:00
|
|
|
LIB_ID selected = m_treePane->GetLibTree()->GetSelectedLibId();
|
|
|
|
|
2014-06-01 14:58:17 +00:00
|
|
|
if( GetScreen()->IsModify() && !GetBoard()->IsEmpty() )
|
|
|
|
{
|
2018-08-11 20:46:03 +00:00
|
|
|
if( !HandleUnsavedChanges( this, _( "The current footprint has been modified. Save changes?" ),
|
|
|
|
[&]()->bool { return SaveFootprint( GetBoard()->m_Modules ); } ) )
|
|
|
|
{
|
2014-06-01 14:58:17 +00:00
|
|
|
break;
|
2018-08-11 20:46:03 +00:00
|
|
|
}
|
2014-06-01 14:58:17 +00:00
|
|
|
}
|
|
|
|
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
FOOTPRINT_WIZARD_FRAME* wizard = (FOOTPRINT_WIZARD_FRAME*) Kiway().Player(
|
2018-08-11 16:04:46 +00:00
|
|
|
FRAME_PCB_FOOTPRINT_WIZARD, true, this );
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
|
2014-06-01 14:58:17 +00:00
|
|
|
if( wizard->ShowModal( NULL, this ) )
|
2013-08-03 05:15:23 +00:00
|
|
|
{
|
Modular-Kicad milestone B), major portions:
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
2014-05-03 17:40:19 +00:00
|
|
|
// Creates the new footprint from python script wizard
|
|
|
|
MODULE* module = wizard->GetBuiltFootprint();
|
|
|
|
|
2014-06-01 14:58:17 +00:00
|
|
|
if( module == NULL ) // i.e. if create module command aborted
|
|
|
|
break;
|
|
|
|
|
|
|
|
Clear_Pcb( false );
|
|
|
|
|
|
|
|
SetCrossHairPosition( wxPoint( 0, 0 ) );
|
|
|
|
|
|
|
|
// Add the new object to board
|
2018-09-25 14:23:38 +00:00
|
|
|
AddModuleToBoard( module );
|
2014-06-01 14:58:17 +00:00
|
|
|
|
|
|
|
// Initialize data relative to nets and netclasses (for a new
|
|
|
|
// module the defaults are used)
|
|
|
|
// This is mandatory to handle and draw pads
|
|
|
|
GetBoard()->BuildListOfNets();
|
|
|
|
module->SetPosition( wxPoint( 0, 0 ) );
|
|
|
|
module->ClearFlags();
|
|
|
|
|
|
|
|
Zoom_Automatique( false );
|
2018-07-29 15:33:58 +00:00
|
|
|
GetScreen()->SetModify();
|
|
|
|
|
|
|
|
// If selected from the library tree then go ahead and save it there
|
|
|
|
if( !selected.GetLibNickname().empty() )
|
|
|
|
{
|
|
|
|
LIB_ID fpid = module->GetFPID();
|
|
|
|
fpid.SetLibNickname( selected.GetLibNickname() );
|
|
|
|
module->SetFPID( fpid );
|
|
|
|
SaveFootprint( module );
|
|
|
|
GetScreen()->ClrModify();
|
|
|
|
}
|
|
|
|
|
2015-02-10 08:35:17 +00:00
|
|
|
updateView();
|
|
|
|
m_canvas->Refresh();
|
2018-05-10 10:49:20 +00:00
|
|
|
Update3DView();
|
2014-06-02 10:46:29 +00:00
|
|
|
|
2018-08-06 18:33:28 +00:00
|
|
|
SyncLibraryTree( false );
|
2013-08-03 05:15:23 +00:00
|
|
|
}
|
2013-05-28 16:54:59 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
wizard->Destroy();
|
|
|
|
}
|
2012-05-09 17:37:25 +00:00
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2018-07-29 15:33:58 +00:00
|
|
|
case ID_MODEDIT_SAVE:
|
2018-09-13 23:39:40 +00:00
|
|
|
if( getTargetFPID() == GetLoadedFPID() )
|
2013-11-27 06:04:04 +00:00
|
|
|
{
|
2018-07-29 15:33:58 +00:00
|
|
|
if( SaveFootprint( GetBoard()->m_Modules ) )
|
|
|
|
{
|
|
|
|
m_toolManager->GetView()->Update( GetBoard()->m_Modules );
|
2018-07-26 20:19:46 +00:00
|
|
|
|
2018-07-29 15:33:58 +00:00
|
|
|
if( IsGalCanvasActive() && GetGalCanvas() )
|
|
|
|
GetGalCanvas()->ForceRefresh();
|
|
|
|
else
|
|
|
|
GetCanvas()->Refresh();
|
2018-07-26 20:19:46 +00:00
|
|
|
|
2018-07-29 15:33:58 +00:00
|
|
|
GetScreen()->ClrModify();
|
|
|
|
}
|
2018-07-26 20:19:46 +00:00
|
|
|
}
|
2018-07-29 15:33:58 +00:00
|
|
|
|
|
|
|
m_treePane->GetLibTree()->Refresh();
|
2018-07-26 20:19:46 +00:00
|
|
|
break;
|
|
|
|
|
2018-07-29 15:33:58 +00:00
|
|
|
case ID_MODEDIT_SAVE_AS:
|
2018-09-13 23:39:40 +00:00
|
|
|
if( getTargetFPID().GetLibItemName().empty() )
|
2018-07-26 20:19:46 +00:00
|
|
|
{
|
2018-07-29 15:33:58 +00:00
|
|
|
// Save Library As
|
2018-09-13 23:39:40 +00:00
|
|
|
const wxString& libName = getTargetFPID().GetLibNickname();
|
2018-11-01 23:33:31 +00:00
|
|
|
|
2018-07-29 15:33:58 +00:00
|
|
|
if( SaveLibraryAs( Prj().PcbFootprintLibs()->FindRow( libName )->GetFullURI() ) )
|
2018-08-06 18:33:28 +00:00
|
|
|
SyncLibraryTree( true );
|
2018-07-29 15:33:58 +00:00
|
|
|
}
|
2018-09-13 23:39:40 +00:00
|
|
|
else if( getTargetFPID() == GetLoadedFPID() )
|
2018-07-29 15:33:58 +00:00
|
|
|
{
|
2018-09-12 20:26:37 +00:00
|
|
|
// Save Board Footprint As
|
|
|
|
MODULE* footprint = GetBoard()->m_Modules;
|
|
|
|
|
2018-07-29 15:33:58 +00:00
|
|
|
if( footprint && SaveFootprintAs( footprint ) )
|
|
|
|
{
|
2018-11-01 23:33:31 +00:00
|
|
|
m_footprintNameWhenLoaded = footprint->GetFPID().GetLibItemName();
|
2018-09-12 20:26:37 +00:00
|
|
|
m_toolManager->GetView()->Update( GetBoard()->m_Modules );
|
2018-11-01 23:33:31 +00:00
|
|
|
GetScreen()->ClrModify();
|
2018-06-11 13:42:43 +00:00
|
|
|
|
2018-09-12 20:26:37 +00:00
|
|
|
if( IsGalCanvasActive() && GetGalCanvas() )
|
|
|
|
GetGalCanvas()->ForceRefresh();
|
|
|
|
else
|
|
|
|
GetCanvas()->Refresh();
|
2018-06-11 13:42:43 +00:00
|
|
|
|
2018-11-01 23:33:31 +00:00
|
|
|
SyncLibraryTree( true );
|
2018-07-29 15:33:58 +00:00
|
|
|
}
|
2013-11-27 06:04:04 +00:00
|
|
|
}
|
2018-09-12 20:26:37 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// Save Selected Footprint As
|
2018-09-13 23:39:40 +00:00
|
|
|
MODULE* footprint = LoadFootprint( getTargetFPID() );
|
2018-09-12 20:26:37 +00:00
|
|
|
|
2018-11-01 23:33:31 +00:00
|
|
|
if( footprint && SaveFootprintAs( footprint ) )
|
|
|
|
SyncLibraryTree( true );
|
2018-09-12 20:26:37 +00:00
|
|
|
}
|
2018-07-29 15:33:58 +00:00
|
|
|
|
|
|
|
m_treePane->GetLibTree()->Refresh();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2018-10-03 21:44:17 +00:00
|
|
|
case ID_MODEDIT_REVERT_PART:
|
|
|
|
RevertFootprint();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MODEDIT_CUT_PART:
|
|
|
|
case ID_MODEDIT_COPY_PART:
|
|
|
|
if( getTargetFPID().IsValid() )
|
|
|
|
{
|
|
|
|
LIB_ID fpID = getTargetFPID();
|
|
|
|
m_copiedModule.reset( LoadFootprint( fpID ) );
|
|
|
|
|
|
|
|
if( id == ID_MODEDIT_CUT_PART )
|
|
|
|
DeleteModuleFromLibrary( fpID, false );
|
|
|
|
|
|
|
|
SyncLibraryTree( true );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MODEDIT_PASTE_PART:
|
|
|
|
if( m_copiedModule && !getTargetFPID().GetLibNickname().empty() )
|
|
|
|
{
|
|
|
|
wxString newLib = getTargetFPID().GetLibNickname();
|
|
|
|
MODULE* newModule( m_copiedModule.get() );
|
|
|
|
wxString newName = newModule->GetFPID().GetLibItemName();
|
|
|
|
|
|
|
|
while( Prj().PcbFootprintLibs()->FootprintExists( newLib, newName ) )
|
|
|
|
newName += _( "_copy" );
|
|
|
|
|
|
|
|
newModule->SetFPID( LIB_ID( newLib, newName ) );
|
|
|
|
saveFootprintInLibrary( newModule, newLib );
|
|
|
|
|
|
|
|
SyncLibraryTree( true );
|
|
|
|
m_treePane->GetLibTree()->SelectLibId( newModule->GetFPID() );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
case ID_MODEDIT_INSERT_MODULE_IN_BOARD:
|
2018-08-25 15:12:08 +00:00
|
|
|
SaveFootprintToBoard( true );
|
2013-08-03 05:15:23 +00:00
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
case ID_MODEDIT_IMPORT_PART:
|
2010-06-14 20:16:47 +00:00
|
|
|
if( ! Clear_Pcb( true ) )
|
|
|
|
break; // //this command is aborted
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
SetCrossHairPosition( wxPoint( 0, 0 ) );
|
2011-08-26 17:01:17 +00:00
|
|
|
Import_Module();
|
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
if( GetBoard()->m_Modules )
|
2011-12-21 13:42:02 +00:00
|
|
|
GetBoard()->m_Modules->ClearFlags();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
GetScreen()->ClrModify();
|
2011-03-01 18:45:21 +00:00
|
|
|
Zoom_Automatique( false );
|
2015-02-10 08:35:17 +00:00
|
|
|
m_canvas->Refresh();
|
2018-05-10 10:49:20 +00:00
|
|
|
Update3DView();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
case ID_MODEDIT_EXPORT_PART:
|
2018-09-13 23:39:40 +00:00
|
|
|
if( getTargetFPID() == GetLoadedFPID() )
|
2018-09-12 20:39:26 +00:00
|
|
|
Export_Module( GetBoard()->m_Modules );
|
2018-09-12 20:26:37 +00:00
|
|
|
else
|
2018-09-13 23:39:40 +00:00
|
|
|
Export_Module( LoadFootprint( getTargetFPID() ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2018-07-26 20:19:46 +00:00
|
|
|
case ID_MODEDIT_CREATE_NEW_LIB:
|
2018-07-29 15:33:58 +00:00
|
|
|
{
|
|
|
|
wxFileName fn( CreateNewLibrary() );
|
|
|
|
wxString name = fn.GetName();
|
|
|
|
|
|
|
|
if( !name.IsEmpty() )
|
|
|
|
{
|
|
|
|
LIB_ID newLib( name, wxEmptyString );
|
|
|
|
|
2018-09-13 23:39:40 +00:00
|
|
|
SyncLibraryTree( true );
|
2018-07-29 15:33:58 +00:00
|
|
|
m_treePane->GetLibTree()->SelectLibId( newLib );
|
|
|
|
}
|
|
|
|
}
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2018-10-03 21:44:17 +00:00
|
|
|
case ID_MODEDIT_ADD_LIBRARY:
|
|
|
|
AddLibrary();
|
|
|
|
break;
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
case ID_MODEDIT_SHEET_SET:
|
|
|
|
break;
|
|
|
|
|
2018-07-29 15:33:58 +00:00
|
|
|
case ID_MODEDIT_EDIT_MODULE:
|
2018-10-15 14:28:53 +00:00
|
|
|
LoadModuleFromLibrary( m_treePane->GetLibTree()->GetSelectedLibId() );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MODEDIT_PAD_SETTINGS:
|
2009-12-19 19:24:49 +00:00
|
|
|
InstallPadOptionsFrame( NULL );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MODEDIT_CHECK:
|
2015-04-02 11:18:19 +00:00
|
|
|
// Currently: not implemented
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MODEDIT_EDIT_MODULE_PROPERTIES:
|
2009-01-05 05:21:35 +00:00
|
|
|
if( GetBoard()->m_Modules )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2009-01-05 05:21:35 +00:00
|
|
|
SetCurItem( GetBoard()->m_Modules );
|
2018-09-13 15:39:14 +00:00
|
|
|
editFootprintProperties( (MODULE*) GetScreen()->GetCurItem() );
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2017-04-16 11:53:56 +00:00
|
|
|
m_canvas->Refresh();
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_CLOSE_CURRENT_TOOL:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_CANCEL_CURRENT_COMMAND:
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2009-05-21 12:45:21 +00:00
|
|
|
Rotate_Module( NULL, (MODULE*) GetScreen()->GetCurItem(), 900, true );
|
2015-02-10 08:35:17 +00:00
|
|
|
m_canvas->Refresh();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2009-05-23 07:16:05 +00:00
|
|
|
Rotate_Module( NULL, (MODULE*) GetScreen()->GetCurItem(), -900, true );
|
2015-02-10 08:35:17 +00:00
|
|
|
m_canvas->Refresh();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2013-03-01 19:59:29 +00:00
|
|
|
case ID_POPUP_PCB_EDIT_MODULE_PRMS:
|
2018-09-13 15:39:14 +00:00
|
|
|
editFootprintProperties( (MODULE*) GetScreen()->GetCurItem() );
|
|
|
|
m_canvas->MoveCursorToCrossHair();
|
|
|
|
m_canvas->Refresh();
|
2012-11-19 16:19:38 +00:00
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
case ID_POPUP_PCB_MOVE_PAD_REQUEST:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2012-09-11 07:33:17 +00:00
|
|
|
StartMovePad( (D_PAD*) GetScreen()->GetCurItem(), &dc, false );
|
2012-11-19 16:19:38 +00:00
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_PAD:
|
2009-12-19 19:24:49 +00:00
|
|
|
InstallPadOptionsFrame( (D_PAD*) GetScreen()->GetCurItem() );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2009-05-23 07:16:05 +00:00
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
case ID_POPUP_PCB_DELETE_PAD:
|
2016-05-25 09:52:43 +00:00
|
|
|
SaveCopyInUndoList( GetBoard()->m_Modules, UR_CHANGED );
|
2010-08-11 13:15:30 +00:00
|
|
|
DeletePad( (D_PAD*) GetScreen()->GetCurItem(), false );
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( NULL );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2015-02-12 03:22:24 +00:00
|
|
|
case ID_POPUP_PCB_DUPLICATE_ITEM:
|
|
|
|
duplicateItems( false );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DUPLICATE_ITEM_AND_INCREMENT:
|
|
|
|
duplicateItems( true );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_MOVE_EXACT:
|
2015-02-12 03:22:24 +00:00
|
|
|
moveExact();
|
2015-02-12 03:22:24 +00:00
|
|
|
break;
|
2015-02-12 03:22:24 +00:00
|
|
|
|
2015-02-12 03:22:24 +00:00
|
|
|
case ID_POPUP_PCB_CREATE_ARRAY:
|
2015-02-12 03:22:24 +00:00
|
|
|
createArray();
|
2015-02-12 03:22:24 +00:00
|
|
|
break;
|
2015-02-12 03:22:24 +00:00
|
|
|
|
2017-02-03 18:56:56 +00:00
|
|
|
case ID_POPUP_PCB_APPLY_PAD_SETTINGS:
|
2016-05-25 09:52:43 +00:00
|
|
|
SaveCopyInUndoList( GetBoard()->m_Modules, UR_CHANGED );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2008-04-18 13:28:56 +00:00
|
|
|
Import_Pad_Settings( (D_PAD*) GetScreen()->GetCurItem(), true );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
|
2016-05-25 09:52:43 +00:00
|
|
|
SaveCopyInUndoList( GetBoard()->m_Modules, UR_CHANGED );
|
2011-12-30 12:29:54 +00:00
|
|
|
// Calls the global change dialog:
|
2018-07-05 16:14:19 +00:00
|
|
|
PushPadProperties((D_PAD*) GetScreen()->GetCurItem());
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2017-02-03 18:56:56 +00:00
|
|
|
case ID_POPUP_PCB_COPY_PAD_SETTINGS:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-20 01:20:48 +00:00
|
|
|
Export_Pad_Settings( (D_PAD*) GetScreen()->GetCurItem() );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_EDIT_TEXTMODULE:
|
2018-06-06 10:05:56 +00:00
|
|
|
InstallTextOptionsFrame( GetScreen()->GetCurItem(), &dc );
|
2012-11-19 16:19:38 +00:00
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
case ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2014-09-10 15:18:42 +00:00
|
|
|
StartMoveTexteModule( static_cast<TEXTE_MODULE*>( GetScreen()->GetCurItem() ), &dc );
|
2012-11-19 16:19:38 +00:00
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
case ID_POPUP_PCB_ROTATE_TEXTMODULE:
|
2014-09-10 15:18:42 +00:00
|
|
|
RotateTextModule( static_cast<TEXTE_MODULE*>( GetScreen()->GetCurItem() ), &dc );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2012-11-19 16:19:38 +00:00
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
case ID_POPUP_PCB_DELETE_TEXTMODULE:
|
2016-05-25 09:52:43 +00:00
|
|
|
SaveCopyInUndoList( GetBoard()->m_Modules, UR_CHANGED );
|
2014-09-10 15:18:42 +00:00
|
|
|
DeleteTextModule( static_cast<TEXTE_MODULE*>( GetScreen()->GetCurItem() ) );
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( NULL );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_MOVE_EDGE:
|
2014-09-10 15:18:42 +00:00
|
|
|
Start_Move_EdgeMod( static_cast<EDGE_MODULE*>( GetScreen()->GetCurItem() ), &dc );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2012-11-19 16:19:38 +00:00
|
|
|
break;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
case ID_POPUP_PCB_STOP_CURRENT_DRAWING:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2011-08-26 17:01:17 +00:00
|
|
|
|
2011-12-21 13:42:02 +00:00
|
|
|
if( GetScreen()->GetCurItem()->IsNew() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2010-07-20 18:11:34 +00:00
|
|
|
End_Edge_Module( (EDGE_MODULE*) GetScreen()->GetCurItem() );
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( NULL );
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2012-02-12 19:39:37 +00:00
|
|
|
case ID_POPUP_MODEDIT_EDIT_BODY_ITEM :
|
2018-09-12 19:39:37 +00:00
|
|
|
InstallGraphicItemPropertiesDialog( GetScreen()->GetCurItem() );
|
2012-02-12 19:39:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2009-05-23 07:16:05 +00:00
|
|
|
Edit_Edge_Width( NULL );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2012-02-12 19:39:37 +00:00
|
|
|
case ID_POPUP_MODEDIT_EDIT_LAYER_ALL_EDGE:
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2009-05-23 07:16:05 +00:00
|
|
|
Edit_Edge_Layer( NULL );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->Refresh();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PCB_DELETE_EDGE:
|
2016-05-25 09:52:43 +00:00
|
|
|
SaveCopyInUndoList( GetBoard()->m_Modules, UR_CHANGED );
|
2011-12-22 13:28:11 +00:00
|
|
|
m_canvas->MoveCursorToCrossHair();
|
2009-05-23 07:16:05 +00:00
|
|
|
RemoveStruct( GetScreen()->GetCurItem() );
|
2007-09-12 02:14:07 +00:00
|
|
|
SetCurItem( NULL );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MODEDIT_MODULE_ROTATE:
|
|
|
|
case ID_MODEDIT_MODULE_MIRROR:
|
2015-02-12 03:22:24 +00:00
|
|
|
case ID_MODEDIT_MODULE_MOVE_EXACT:
|
2016-05-25 09:52:43 +00:00
|
|
|
SaveCopyInUndoList( GetBoard()->m_Modules, UR_CHANGED );
|
2009-05-23 07:16:05 +00:00
|
|
|
Transform( (MODULE*) GetScreen()->GetCurItem(), id );
|
2015-02-10 08:35:17 +00:00
|
|
|
m_canvas->Refresh();
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_PLACE_BLOCK:
|
2012-03-26 23:47:08 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetCommand( BLOCK_MOVE );
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetAutoPanRequest( false );
|
2009-11-18 12:52:19 +00:00
|
|
|
HandleBlockPlace( &dc );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2017-07-04 08:08:33 +00:00
|
|
|
case ID_POPUP_DUPLICATE_BLOCK:
|
|
|
|
GetScreen()->m_BlockLocate.SetCommand( BLOCK_DUPLICATE );
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
2011-12-29 20:11:42 +00:00
|
|
|
m_canvas->SetAutoPanRequest( false );
|
2009-11-18 12:52:19 +00:00
|
|
|
HandleBlockPlace( &dc );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_ZOOM_BLOCK:
|
2012-03-26 23:47:08 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetCommand( BLOCK_ZOOM );
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
2009-11-18 12:52:19 +00:00
|
|
|
HandleBlockEnd( &dc );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_DELETE_BLOCK:
|
2012-03-26 23:47:08 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetCommand( BLOCK_DELETE );
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
2009-11-18 12:52:19 +00:00
|
|
|
HandleBlockEnd( &dc );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_ROTATE_BLOCK:
|
2012-03-26 23:47:08 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetCommand( BLOCK_ROTATE );
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
2009-11-18 12:52:19 +00:00
|
|
|
HandleBlockEnd( &dc );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_POPUP_MIRROR_X_BLOCK:
|
2012-03-26 23:47:08 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetCommand( BLOCK_MIRROR_X );
|
2009-07-25 04:53:39 +00:00
|
|
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
2009-11-18 12:52:19 +00:00
|
|
|
HandleBlockEnd( &dc );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2015-02-12 03:22:24 +00:00
|
|
|
case ID_POPUP_MOVE_BLOCK_EXACT:
|
|
|
|
GetScreen()->m_BlockLocate.SetCommand( BLOCK_MOVE_EXACT );
|
|
|
|
GetScreen()->m_BlockLocate.SetMessageBlock( this );
|
|
|
|
HandleBlockEnd( &dc );
|
|
|
|
break;
|
|
|
|
|
2014-07-09 13:02:56 +00:00
|
|
|
case ID_GEN_IMPORT_DXF_FILE:
|
2015-09-13 14:23:01 +00:00
|
|
|
if( GetBoard()->m_Modules )
|
|
|
|
{
|
|
|
|
InvokeDXFDialogModuleImport( this, GetBoard()->m_Modules );
|
|
|
|
m_canvas->Refresh();
|
|
|
|
}
|
2014-07-09 13:02:56 +00:00
|
|
|
break;
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
default:
|
|
|
|
DisplayError( this,
|
2011-08-26 17:01:17 +00:00
|
|
|
wxT( "FOOTPRINT_EDIT_FRAME::Process_Special_Functions error" ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2011-11-24 17:32:51 +00:00
|
|
|
|
2018-09-13 15:39:14 +00:00
|
|
|
void FOOTPRINT_EDIT_FRAME::editFootprintProperties( MODULE* aModule )
|
|
|
|
{
|
|
|
|
LIB_ID oldFPID = aModule->GetFPID();
|
|
|
|
|
|
|
|
DIALOG_FOOTPRINT_FP_EDITOR dialog( this, aModule );
|
|
|
|
dialog.ShowModal();
|
|
|
|
|
|
|
|
GetScreen()->GetCurItem()->ClearFlags();
|
2018-09-13 23:39:40 +00:00
|
|
|
|
|
|
|
updateTitle(); // in case of a name change...
|
2018-09-13 15:39:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-12 03:22:24 +00:00
|
|
|
void FOOTPRINT_EDIT_FRAME::moveExact()
|
|
|
|
{
|
2018-06-12 07:36:35 +00:00
|
|
|
wxPoint translation;
|
|
|
|
double rotation;
|
|
|
|
ROTATION_ANCHOR rotationAnchor = ROTATE_AROUND_ITEM_ANCHOR;
|
2015-02-12 03:22:24 +00:00
|
|
|
|
2018-06-12 07:36:35 +00:00
|
|
|
DIALOG_MOVE_EXACT dialog( this, translation, rotation, rotationAnchor );
|
2015-02-12 03:22:24 +00:00
|
|
|
int ret = dialog.ShowModal();
|
|
|
|
|
2015-02-22 14:43:44 +00:00
|
|
|
if( ret == wxID_OK )
|
2015-02-12 03:22:24 +00:00
|
|
|
{
|
2016-05-25 09:52:43 +00:00
|
|
|
SaveCopyInUndoList( GetBoard()->m_Modules, UR_CHANGED );
|
2015-02-12 03:22:24 +00:00
|
|
|
|
|
|
|
BOARD_ITEM* item = GetScreen()->GetCurItem();
|
|
|
|
|
2018-06-12 07:36:35 +00:00
|
|
|
item->Move( translation );
|
2017-04-22 20:07:29 +00:00
|
|
|
|
2018-06-12 07:36:35 +00:00
|
|
|
switch( rotationAnchor )
|
2017-04-22 20:07:29 +00:00
|
|
|
{
|
2018-06-12 07:36:35 +00:00
|
|
|
case ROTATE_AROUND_ITEM_ANCHOR:
|
|
|
|
item->Rotate( item->GetPosition(), rotation );
|
|
|
|
break;
|
|
|
|
case ROTATE_AROUND_USER_ORIGIN:
|
|
|
|
item->Rotate( GetScreen()->m_O_Curseur, rotation );
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
wxFAIL_MSG( "Rotation choice shouldn't have been available in this context." );
|
2017-04-22 20:07:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-06-12 07:36:35 +00:00
|
|
|
item->Rotate( item->GetPosition(), rotation );
|
2015-02-12 03:22:24 +00:00
|
|
|
m_canvas->Refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
m_canvas->MoveCursorToCrossHair();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FOOTPRINT_EDIT_FRAME::duplicateItems( bool aIncrement )
|
2015-02-12 03:22:24 +00:00
|
|
|
{
|
|
|
|
BOARD_ITEM* item = GetScreen()->GetCurItem();
|
|
|
|
|
2015-03-22 09:42:41 +00:00
|
|
|
PCB_BASE_EDIT_FRAME::duplicateItem( item, aIncrement );
|
2015-02-12 03:22:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-08-26 17:01:17 +00:00
|
|
|
void FOOTPRINT_EDIT_FRAME::Transform( MODULE* module, int transform )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
switch( transform )
|
|
|
|
{
|
|
|
|
case ID_MODEDIT_MODULE_ROTATE:
|
2014-09-10 15:18:42 +00:00
|
|
|
RotateMarkedItems( module, wxPoint(0,0), true );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MODEDIT_MODULE_MIRROR:
|
2012-02-19 19:53:11 +00:00
|
|
|
MirrorMarkedItems( module, wxPoint(0,0), true );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
|
2015-02-12 03:22:24 +00:00
|
|
|
case ID_MODEDIT_MODULE_MOVE_EXACT:
|
|
|
|
{
|
2018-06-12 07:36:35 +00:00
|
|
|
wxPoint translation;
|
|
|
|
double rotation;
|
|
|
|
ROTATION_ANCHOR rotationAnchor = ROTATE_AROUND_ITEM_ANCHOR;
|
2015-02-12 03:22:24 +00:00
|
|
|
|
2018-06-12 07:36:35 +00:00
|
|
|
DIALOG_MOVE_EXACT dialog( this, translation, rotation, rotationAnchor );
|
2015-02-12 03:22:24 +00:00
|
|
|
|
2018-06-12 07:36:35 +00:00
|
|
|
if( dialog.ShowModal() == wxID_OK )
|
2015-02-12 03:22:24 +00:00
|
|
|
{
|
2018-06-12 07:36:35 +00:00
|
|
|
switch( rotationAnchor )
|
|
|
|
{
|
|
|
|
case ROTATE_AROUND_ITEM_ANCHOR:
|
|
|
|
MoveMarkedItemsExactly( module, module->GetPosition() + translation, translation, rotation, true );
|
|
|
|
break;
|
|
|
|
case ROTATE_AROUND_USER_ORIGIN:
|
|
|
|
MoveMarkedItemsExactly( module, GetScreen()->m_O_Curseur, translation, rotation, true );
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
wxFAIL_MSG( "Rotation choice shouldn't have been available in this context." );
|
|
|
|
}
|
2015-02-12 03:22:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2009-08-12 10:40:01 +00:00
|
|
|
default:
|
2009-11-18 12:52:19 +00:00
|
|
|
DisplayInfoMessage( this, wxT( "Not available" ) );
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2011-09-07 19:41:04 +00:00
|
|
|
module->CalculateBoundingBox();
|
2010-05-01 12:46:33 +00:00
|
|
|
OnModify();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
2011-02-21 13:54:29 +00:00
|
|
|
|
|
|
|
|
2011-08-26 17:01:17 +00:00
|
|
|
void FOOTPRINT_EDIT_FRAME::OnVerticalToolbar( wxCommandEvent& aEvent )
|
2011-02-21 13:54:29 +00:00
|
|
|
{
|
|
|
|
int id = aEvent.GetId();
|
2017-06-12 13:10:43 +00:00
|
|
|
int lastToolID = GetToolId();
|
2011-02-21 13:54:29 +00:00
|
|
|
|
2017-06-12 13:10:43 +00:00
|
|
|
// Stop the current command and deselect the current tool.
|
|
|
|
SetNoToolSelected();
|
2011-02-21 13:54:29 +00:00
|
|
|
|
|
|
|
switch( id )
|
|
|
|
{
|
2011-02-24 20:22:12 +00:00
|
|
|
case ID_NO_TOOL_SELECTED:
|
|
|
|
break;
|
|
|
|
|
2016-06-08 11:19:53 +00:00
|
|
|
case ID_ZOOM_SELECTION:
|
2017-06-12 13:10:43 +00:00
|
|
|
// This tool is located on the main toolbar: switch it on or off on click on it
|
|
|
|
if( lastToolID != ID_ZOOM_SELECTION )
|
|
|
|
SetToolID( ID_ZOOM_SELECTION, wxCURSOR_MAGNIFIER, _( "Zoom to selection" ) );
|
|
|
|
else
|
|
|
|
SetNoToolSelected();
|
2016-06-08 11:19:53 +00:00
|
|
|
break;
|
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
case ID_MODEDIT_LINE_TOOL:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add line" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MODEDIT_ARC_TOOL:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add arc" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MODEDIT_CIRCLE_TOOL:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add circle" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MODEDIT_TEXT_TOOL:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add text" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MODEDIT_ANCHOR_TOOL:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Place anchor" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MODEDIT_PLACE_GRID_COORD:
|
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Set grid origin" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MODEDIT_PAD_TOOL:
|
|
|
|
if( GetBoard()->m_Modules )
|
2011-08-26 17:01:17 +00:00
|
|
|
{
|
2011-02-21 13:54:29 +00:00
|
|
|
SetToolID( id, wxCURSOR_PENCIL, _( "Add pad" ) );
|
2011-08-26 17:01:17 +00:00
|
|
|
}
|
2011-02-21 13:54:29 +00:00
|
|
|
else
|
|
|
|
{
|
2018-02-12 23:42:37 +00:00
|
|
|
SetToolID( id, wxCURSOR_ARROW, _( "Pad properties" ) );
|
2011-02-21 13:54:29 +00:00
|
|
|
InstallPadOptionsFrame( NULL );
|
2017-06-12 13:10:43 +00:00
|
|
|
SetNoToolSelected();
|
2011-02-21 13:54:29 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ID_MODEDIT_DELETE_TOOL:
|
|
|
|
SetToolID( id, wxCURSOR_BULLSEYE, _( "Delete item" ) );
|
|
|
|
break;
|
|
|
|
|
2017-03-09 09:09:13 +00:00
|
|
|
case ID_MODEDIT_MEASUREMENT_TOOL:
|
2018-02-19 19:26:02 +00:00
|
|
|
DisplayError( this, wxT( "Measurement Tool not available in Legacy Toolset" ) );
|
2017-06-12 13:10:43 +00:00
|
|
|
SetNoToolSelected();
|
2017-03-09 09:09:13 +00:00
|
|
|
break;
|
|
|
|
|
2011-02-21 13:54:29 +00:00
|
|
|
default:
|
|
|
|
wxFAIL_MSG( wxT( "Unknown command id." ) );
|
2017-06-12 13:10:43 +00:00
|
|
|
SetNoToolSelected();
|
2011-02-21 13:54:29 +00:00
|
|
|
}
|
|
|
|
}
|
2013-04-11 18:29:56 +00:00
|
|
|
|
2013-05-28 16:54:59 +00:00
|
|
|
|
2018-01-31 13:54:31 +00:00
|
|
|
void FOOTPRINT_EDIT_FRAME::RemoveStruct( EDA_ITEM* Item )
|
|
|
|
{
|
|
|
|
if( Item == NULL )
|
|
|
|
return;
|
|
|
|
|
|
|
|
switch( Item->Type() )
|
|
|
|
{
|
|
|
|
case PCB_PAD_T:
|
|
|
|
DeletePad( (D_PAD*) Item, false );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PCB_MODULE_TEXT_T:
|
|
|
|
{
|
|
|
|
TEXTE_MODULE* text = static_cast<TEXTE_MODULE*>( Item );
|
|
|
|
|
|
|
|
switch( text->GetType() )
|
|
|
|
{
|
|
|
|
case TEXTE_MODULE::TEXT_is_REFERENCE:
|
|
|
|
DisplayError( this, _( "Cannot delete REFERENCE!" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TEXTE_MODULE::TEXT_is_VALUE:
|
|
|
|
DisplayError( this, _( "Cannot delete VALUE!" ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TEXTE_MODULE::TEXT_is_DIVERS:
|
|
|
|
DeleteTextModule( text );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PCB_MODULE_EDGE_T:
|
|
|
|
Delete_Edge_Module( (EDGE_MODULE*) Item );
|
|
|
|
m_canvas->Refresh();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PCB_MODULE_T:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
wxString Line;
|
|
|
|
Line.Printf( wxT( " RemoveStruct: item type %d unknown." ), Item->Type() );
|
|
|
|
wxMessageBox( Line );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-04 12:43:02 +00:00
|
|
|
COLOR4D FOOTPRINT_EDIT_FRAME::GetGridColor()
|
2013-04-11 18:29:56 +00:00
|
|
|
{
|
2017-08-04 12:43:02 +00:00
|
|
|
return Settings().Colors().GetItemColor( 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 );
|
|
|
|
|
2015-01-07 19:07:15 +00:00
|
|
|
m_Layers->SelectLayer( GetActiveLayer() );
|
|
|
|
m_Layers->OnLayerSelected();
|
|
|
|
|
2014-07-09 09:59:23 +00:00
|
|
|
if( IsGalCanvasActive() )
|
2017-01-31 08:33:44 +00:00
|
|
|
{
|
|
|
|
GetGalCanvas()->SetHighContrastLayer( aLayer );
|
2014-07-09 09:59:23 +00:00
|
|
|
GetGalCanvas()->Refresh();
|
2017-01-31 08:33:44 +00:00
|
|
|
}
|
2014-07-09 09:59:23 +00:00
|
|
|
}
|
2017-10-19 21:15:48 +00:00
|
|
|
|
|
|
|
bool FOOTPRINT_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl )
|
|
|
|
{
|
|
|
|
if( ! Clear_Pcb( true ) )
|
|
|
|
return false; // //this command is aborted
|
|
|
|
|
|
|
|
SetCrossHairPosition( wxPoint( 0, 0 ) );
|
|
|
|
Import_Module( aFileSet[0] );
|
|
|
|
|
|
|
|
if( GetBoard()->m_Modules )
|
|
|
|
GetBoard()->m_Modules->ClearFlags();
|
|
|
|
|
|
|
|
GetScreen()->ClrModify();
|
|
|
|
Zoom_Automatique( false );
|
|
|
|
m_canvas->Refresh();
|
|
|
|
|
|
|
|
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 );
|
|
|
|
wxString libNickname;
|
|
|
|
wxString msg;
|
|
|
|
|
|
|
|
FP_LIB_TABLE* libTable = Prj().PcbFootprintLibs();
|
|
|
|
const LIB_TABLE_ROW* libTableRow = libTable->FindRowByURI( fpFileName.GetPath() );
|
|
|
|
|
|
|
|
if( !libTableRow )
|
|
|
|
{
|
|
|
|
msg.Printf( _( "The current configuration does not include the footprint library\n"
|
|
|
|
"\"%s\".\nUse Manage Footprint Libraries to edit the configuration." ),
|
|
|
|
fpFileName.GetPath() );
|
|
|
|
DisplayErrorMessage( this, _( "Library not found in footprint library table." ), msg );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
libNickname = libTableRow->GetNickName();
|
|
|
|
|
|
|
|
if( !libTable->HasLibrary( libNickname, true ) )
|
|
|
|
{
|
|
|
|
msg.Printf( _( "The library with the nickname \"%s\" is not enabled\n"
|
|
|
|
"in the current configuration. Use Manage Footprint Libraries to\n"
|
|
|
|
"edit the configuration." ), libNickname );
|
|
|
|
DisplayErrorMessage( this, _( "Footprint library not enabled." ), msg );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
LIB_ID fpId( libNickname, fpFileName.GetName() );
|
|
|
|
|
|
|
|
if( m_treePane )
|
|
|
|
{
|
|
|
|
m_treePane->GetLibTree()->SelectLibId( fpId );
|
|
|
|
wxCommandEvent event( COMPONENT_SELECTED );
|
|
|
|
wxPostEvent( m_treePane, event );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
;
|
|
|
|
}
|
|
|
|
}
|