2012-05-09 17:37:25 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
2012-09-11 19:03:21 +00:00
|
|
|
*
|
2012-06-27 21:19:19 +00:00
|
|
|
* Copyright (C) 2012 Miguel Angel Ajo Pelayo <miguelangel@nbee.es>
|
2012-05-09 17:37:25 +00:00
|
|
|
* Copyright (C) 2012 Jean-Pierre Charras, jaen-pierre.charras
|
|
|
|
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
|
|
|
|
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file modview_frame.cpp
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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>
|
2012-05-09 17:37:25 +00:00
|
|
|
#include <class_drawpanel.h>
|
|
|
|
#include <wxPcbStruct.h>
|
|
|
|
#include <3d_viewer.h>
|
|
|
|
#include <pcbcommon.h>
|
2013-01-12 17:32:24 +00:00
|
|
|
#include <msgpanel.h>
|
2013-05-02 18:06:58 +00:00
|
|
|
#include <macros.h>
|
2012-05-09 17:37:25 +00:00
|
|
|
|
|
|
|
#include <class_board.h>
|
|
|
|
#include <class_module.h>
|
2012-09-11 19:03:21 +00:00
|
|
|
#include <module_editor_frame.h>
|
2012-05-09 17:37:25 +00:00
|
|
|
|
|
|
|
#include <pcbnew.h>
|
|
|
|
#include <pcbnew_id.h>
|
|
|
|
#include "footprint_wizard_frame.h"
|
|
|
|
#include <footprint_info.h>
|
2012-05-10 22:30:26 +00:00
|
|
|
#include <wx/grid.h>
|
2012-05-09 17:37:25 +00:00
|
|
|
|
|
|
|
#include <hotkeys.h>
|
|
|
|
#include <wildcards_and_files_ext.h>
|
2012-07-22 22:23:17 +00:00
|
|
|
#include <base_units.h>
|
2012-05-09 17:37:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE( FOOTPRINT_WIZARD_FRAME, EDA_DRAW_FRAME )
|
2014-01-29 17:01:42 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
// Window events
|
2013-03-16 03:27:48 +00:00
|
|
|
EVT_CLOSE( FOOTPRINT_WIZARD_FRAME::OnCloseWindow )
|
|
|
|
EVT_SIZE( FOOTPRINT_WIZARD_FRAME::OnSize )
|
|
|
|
EVT_ACTIVATE( FOOTPRINT_WIZARD_FRAME::OnActivate )
|
2012-05-09 17:37:25 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
// Toolbar events
|
2013-03-16 03:27:48 +00:00
|
|
|
EVT_TOOL( ID_FOOTPRINT_WIZARD_SELECT_WIZARD,
|
|
|
|
FOOTPRINT_WIZARD_FRAME::SelectCurrentWizard )
|
2012-05-09 23:04:08 +00:00
|
|
|
|
2013-03-16 03:27:48 +00:00
|
|
|
EVT_TOOL( ID_FOOTPRINT_WIZARD_NEXT,
|
|
|
|
FOOTPRINT_WIZARD_FRAME::Process_Special_Functions )
|
2012-05-09 23:04:08 +00:00
|
|
|
|
2013-03-16 03:27:48 +00:00
|
|
|
EVT_TOOL( ID_FOOTPRINT_WIZARD_PREVIOUS,
|
|
|
|
FOOTPRINT_WIZARD_FRAME::Process_Special_Functions )
|
2012-08-04 22:15:57 +00:00
|
|
|
|
2013-03-16 03:27:48 +00:00
|
|
|
EVT_TOOL( ID_FOOTPRINT_WIZARD_DONE,
|
|
|
|
FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint )
|
2012-08-04 22:15:57 +00:00
|
|
|
|
2013-03-16 03:27:48 +00:00
|
|
|
EVT_TOOL( ID_FOOTPRINT_WIZARD_SHOW_3D_VIEW,
|
|
|
|
FOOTPRINT_WIZARD_FRAME::Show3D_Frame )
|
2012-05-09 17:37:25 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
// listbox events
|
2013-03-16 03:27:48 +00:00
|
|
|
EVT_LISTBOX( ID_FOOTPRINT_WIZARD_PAGE_LIST, FOOTPRINT_WIZARD_FRAME::ClickOnPageList )
|
2014-01-08 01:34:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
#if wxCHECK_VERSION( 3, 0, 0 )
|
|
|
|
EVT_GRID_CMD_CELL_CHANGED( ID_FOOTPRINT_WIZARD_PARAMETER_LIST,
|
|
|
|
FOOTPRINT_WIZARD_FRAME::ParametersUpdated )
|
|
|
|
#else
|
2013-03-16 03:27:48 +00:00
|
|
|
EVT_GRID_CMD_CELL_CHANGE( ID_FOOTPRINT_WIZARD_PARAMETER_LIST,
|
|
|
|
FOOTPRINT_WIZARD_FRAME::ParametersUpdated )
|
2014-01-08 01:34:04 +00:00
|
|
|
#endif
|
|
|
|
|
2013-03-16 03:27:48 +00:00
|
|
|
EVT_GRID_CMD_EDITOR_HIDDEN( ID_FOOTPRINT_WIZARD_PARAMETER_LIST,
|
|
|
|
FOOTPRINT_WIZARD_FRAME::ParametersUpdated )
|
2012-05-09 17:37:25 +00:00
|
|
|
|
2013-03-16 03:27:48 +00:00
|
|
|
EVT_MENU( ID_SET_RELATIVE_OFFSET, FOOTPRINT_WIZARD_FRAME::OnSetRelativeOffset )
|
2012-05-09 17:37:25 +00:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This emulates the zoom menu entries found in the other KiCad applications.
|
|
|
|
* The library viewer does not have any menus so add an accelerator table to
|
|
|
|
* the main frame.
|
|
|
|
*/
|
|
|
|
static wxAcceleratorEntry accels[] =
|
|
|
|
{
|
2013-03-15 16:35:24 +00:00
|
|
|
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F1, ID_ZOOM_IN ),
|
|
|
|
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F2, ID_ZOOM_OUT ),
|
|
|
|
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F3, ID_ZOOM_REDRAW ),
|
|
|
|
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_F4, ID_POPUP_ZOOM_CENTER ),
|
|
|
|
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_HOME, ID_ZOOM_PAGE ),
|
2012-05-09 17:37:25 +00:00
|
|
|
wxAcceleratorEntry( wxACCEL_NORMAL, WXK_SPACE, ID_SET_RELATIVE_OFFSET )
|
|
|
|
};
|
|
|
|
|
|
|
|
#define ACCEL_TABLE_CNT ( sizeof( accels ) / sizeof( wxAcceleratorEntry ) )
|
|
|
|
|
|
|
|
#define EXTRA_BORDER_SIZE 2
|
|
|
|
|
2012-09-12 09:53:11 +00:00
|
|
|
|
|
|
|
#define FOOTPRINT_WIZARD_FRAME_NAME wxT( "FootprintWizard" )
|
|
|
|
|
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::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway,
|
|
|
|
wxWindow* aParent, FRAME_T aFrameType ) :
|
|
|
|
PCB_BASE_FRAME( aKiway, aParent, aFrameType, _( "Footprint Wizard" ),
|
|
|
|
wxDefaultPosition, wxDefaultSize,
|
|
|
|
KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT,
|
|
|
|
FOOTPRINT_WIZARD_FRAME_NAME )
|
2012-05-09 17:37:25 +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
|
|
|
wxASSERT( aFrameType==FRAME_PCB_FOOTPRINT_WIZARD_MODAL );
|
|
|
|
|
2014-05-04 18:22:27 +00:00
|
|
|
if( aFrameType == FRAME_PCB_FOOTPRINT_WIZARD_MODAL )
|
|
|
|
SetModal( true );
|
|
|
|
|
2012-05-09 17:37:25 +00:00
|
|
|
wxAcceleratorTable table( ACCEL_TABLE_CNT, accels );
|
|
|
|
|
2013-03-15 16:35:24 +00:00
|
|
|
m_FrameName = FOOTPRINT_WIZARD_FRAME_NAME;
|
|
|
|
m_configPath = wxT( "FootprintWizard" );
|
|
|
|
m_showAxis = true; // true to draw axis.
|
2012-05-09 17:37:25 +00:00
|
|
|
|
|
|
|
// Give an icon
|
2013-08-05 13:43:15 +00:00
|
|
|
wxIcon icon;
|
|
|
|
icon.CopyFromBitmap( KiBitmap( module_wizard_xpm) );
|
|
|
|
SetIcon( icon );
|
2012-05-09 17:37:25 +00:00
|
|
|
|
|
|
|
m_HotkeysZoomAndGridList = g_Module_Viewer_Hokeys_Descr;
|
|
|
|
m_wizardName.Empty();
|
|
|
|
|
|
|
|
SetBoard( new BOARD() );
|
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
|
|
|
|
2012-05-09 17:37:25 +00:00
|
|
|
// Ensure all layers and items are visible:
|
|
|
|
GetBoard()->SetVisibleAlls();
|
2013-03-15 16:35:24 +00:00
|
|
|
SetScreen( new PCB_SCREEN( GetPageSizeIU() ) );
|
2012-05-09 17:37:25 +00:00
|
|
|
GetScreen()->m_Center = true; // Center coordinate origins on screen.
|
2014-01-29 17:01:42 +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
|
|
|
LoadSettings( config() );
|
2012-05-09 17:37:25 +00:00
|
|
|
|
|
|
|
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
|
|
|
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
|
|
|
|
|
|
|
|
ReCreateHToolbar();
|
|
|
|
ReCreateVToolbar();
|
|
|
|
|
2014-01-29 17:01:42 +00:00
|
|
|
// Creates the parameter pages list
|
|
|
|
m_pageList = new wxListBox( this, ID_FOOTPRINT_WIZARD_PAGE_LIST,
|
|
|
|
wxDefaultPosition, wxDefaultSize,
|
2013-03-15 16:35:24 +00:00
|
|
|
0, NULL, wxLB_HSCROLL );
|
2012-05-09 17:37:25 +00:00
|
|
|
|
2014-01-29 17:01:42 +00:00
|
|
|
// Creates the The list of parameters for the current parameter page
|
|
|
|
m_parameterGrid = new wxGrid( this, ID_FOOTPRINT_WIZARD_PARAMETER_LIST );
|
2013-03-15 14:50:54 +00:00
|
|
|
|
2014-01-29 17:01:42 +00:00
|
|
|
m_parameterGrid->CreateGrid( 1, 3 );
|
2013-03-15 14:50:54 +00:00
|
|
|
|
|
|
|
// Columns
|
2014-01-29 17:01:42 +00:00
|
|
|
m_parameterGrid->SetColLabelValue( 0, _( "Parameter" ) );
|
|
|
|
m_parameterGrid->SetColLabelValue( 1, _( "Value" ) );
|
|
|
|
m_parameterGrid->SetColLabelValue( 2, _( "Units" ) );
|
|
|
|
m_parameterGrid->SetColLabelAlignment( wxALIGN_LEFT, wxALIGN_CENTRE );
|
|
|
|
m_parameterGrid->AutoSizeColumns();
|
2013-03-15 14:50:54 +00:00
|
|
|
|
2012-05-09 17:37:25 +00:00
|
|
|
ReCreatePageList();
|
|
|
|
|
|
|
|
DisplayWizardInfos();
|
|
|
|
|
|
|
|
if( m_canvas )
|
|
|
|
m_canvas->SetAcceleratorTable( table );
|
|
|
|
|
|
|
|
m_auimgr.SetManagedWindow( this );
|
|
|
|
|
2014-01-29 17:01:42 +00:00
|
|
|
EDA_PANEINFO horiztb;
|
|
|
|
horiztb.HorizontalToolbarPane();
|
2012-05-09 17:37:25 +00:00
|
|
|
|
2013-03-15 16:35:24 +00:00
|
|
|
EDA_PANEINFO info;
|
2012-05-09 17:37:25 +00:00
|
|
|
info.InfoToolbarPane();
|
|
|
|
|
2013-03-15 16:35:24 +00:00
|
|
|
EDA_PANEINFO mesg;
|
2012-05-09 17:37:25 +00:00
|
|
|
mesg.MessageToolbarPane();
|
|
|
|
|
|
|
|
// Manage main toolbal
|
2014-01-29 17:01:42 +00:00
|
|
|
m_auimgr.AddPane( m_mainToolBar, wxAuiPaneInfo( horiztb ).
|
|
|
|
Name( wxT ("m_mainToolBar" ) ).Top().Row( 0 ) );
|
2012-05-09 17:37:25 +00:00
|
|
|
|
2014-01-29 17:01:42 +00:00
|
|
|
// Manage the left window (list of parameter pages)
|
|
|
|
EDA_PANEINFO paneList;
|
|
|
|
paneList.InfoToolbarPane().Name( wxT( "m_pageList" ) ).Left().Row( 0 );
|
|
|
|
m_auimgr.AddPane( m_pageList, wxAuiPaneInfo( paneList ) );
|
2012-05-09 17:37:25 +00:00
|
|
|
|
2014-01-29 17:01:42 +00:00
|
|
|
// Manage the parameters grid editor for the current parameter page
|
|
|
|
EDA_PANEINFO panePrms;
|
|
|
|
panePrms.InfoToolbarPane().Name( wxT( "m_parameterGrid" ) ).Left().Row( 1 );
|
|
|
|
m_auimgr.AddPane( m_parameterGrid, wxAuiPaneInfo( panePrms ) );
|
2012-05-09 17:37:25 +00:00
|
|
|
|
|
|
|
// Manage the draw panel
|
|
|
|
m_auimgr.AddPane( m_canvas,
|
2014-01-29 17:01:42 +00:00
|
|
|
wxAuiPaneInfo().Name( wxT( "DrawFrame" ) ).CentrePane() );
|
2012-05-09 17:37:25 +00:00
|
|
|
|
|
|
|
// Manage the message panel
|
|
|
|
m_auimgr.AddPane( m_messagePanel,
|
2014-01-29 17:01:42 +00:00
|
|
|
wxAuiPaneInfo( mesg ).Name( wxT( "MsgPanel" ) ).Bottom().Layer(1) );
|
2012-05-09 17:37:25 +00:00
|
|
|
|
2014-01-29 17:01:42 +00:00
|
|
|
// Gives a min size and the last saved size to left windows
|
|
|
|
m_auimgr.GetPane( m_pageList ).MinSize( wxSize(60, -1 ) );
|
|
|
|
m_auimgr.GetPane( m_pageList ).BestSize( wxSize(m_pageListWidth, -1) );
|
2013-03-15 16:35:24 +00:00
|
|
|
|
2014-01-29 17:01:42 +00:00
|
|
|
m_auimgr.GetPane( m_parameterGrid ).MinSize( wxSize( 120, -1 ) );
|
|
|
|
m_auimgr.GetPane( m_parameterGrid ).BestSize( wxSize(m_parameterGridWidth, -1) );
|
2012-05-09 17:37:25 +00:00
|
|
|
|
|
|
|
m_auimgr.Update();
|
2012-09-11 19:03:21 +00:00
|
|
|
|
2012-05-09 17:37:25 +00:00
|
|
|
// Now Drawpanel is sized, we can use BestZoom to show the component (if any)
|
|
|
|
#ifdef USE_WX_GRAPHICS_CONTEXT
|
|
|
|
GetScreen()->SetZoom( BestZoom() );
|
|
|
|
#else
|
|
|
|
Zoom_Automatique( false );
|
|
|
|
#endif
|
|
|
|
|
|
|
|
Show( true );
|
2012-09-11 19:03:21 +00:00
|
|
|
|
2012-05-09 23:04:08 +00:00
|
|
|
this->SelectFootprintWizard();
|
2012-05-09 17:37:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FOOTPRINT_WIZARD_FRAME::~FOOTPRINT_WIZARD_FRAME()
|
|
|
|
{
|
|
|
|
if( m_Draw3DFrame )
|
|
|
|
m_Draw3DFrame->Destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FOOTPRINT_WIZARD_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
2012-08-04 22:15:57 +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
|
|
|
if( IsModal() )
|
2012-05-09 17:37:25 +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
|
|
|
// Only dismiss a modal frame once, so that the return values set by
|
|
|
|
// the prior DismissModal() are not bashed for ShowModal().
|
|
|
|
if( !IsDismissed() )
|
|
|
|
DismissModal( false );
|
2012-05-09 17:37:25 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Destroy();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-08-05 13:43:15 +00:00
|
|
|
void FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint( wxCommandEvent& aEvent )
|
|
|
|
{
|
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
|
|
|
DismissModal( true );
|
2013-08-05 13:43:15 +00:00
|
|
|
Close();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-05-09 17:37:25 +00:00
|
|
|
void FOOTPRINT_WIZARD_FRAME::OnSize( wxSizeEvent& SizeEv )
|
|
|
|
{
|
|
|
|
if( m_auimgr.GetManagedWindow() )
|
|
|
|
m_auimgr.Update();
|
|
|
|
|
|
|
|
SizeEv.Skip();
|
|
|
|
}
|
|
|
|
|
2013-03-15 16:35:24 +00:00
|
|
|
|
2012-05-09 17:37:25 +00:00
|
|
|
void FOOTPRINT_WIZARD_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
|
|
|
|
{
|
2013-08-03 05:15:23 +00:00
|
|
|
GetScreen()->m_O_Curseur = GetCrossHairPosition();
|
2012-05-09 17:37:25 +00:00
|
|
|
UpdateStatusBar();
|
|
|
|
}
|
|
|
|
|
2013-03-15 16:35:24 +00:00
|
|
|
|
2012-05-09 17:37:25 +00:00
|
|
|
void FOOTPRINT_WIZARD_FRAME::ReCreatePageList()
|
|
|
|
{
|
2014-01-29 17:01:42 +00:00
|
|
|
if( m_pageList == NULL )
|
2012-05-09 17:37:25 +00:00
|
|
|
return;
|
2012-09-11 19:03:21 +00:00
|
|
|
|
2013-03-16 03:27:48 +00:00
|
|
|
FOOTPRINT_WIZARD* footprintWizard = GetMyWizard();
|
|
|
|
|
|
|
|
if( !footprintWizard )
|
2012-05-09 23:04:08 +00:00
|
|
|
return;
|
2012-05-09 17:37:25 +00:00
|
|
|
|
2014-01-29 17:01:42 +00:00
|
|
|
m_pageList->Clear();
|
2013-03-16 03:27:48 +00:00
|
|
|
int max_page = footprintWizard->GetNumParameterPages();
|
2013-03-15 16:35:24 +00:00
|
|
|
|
|
|
|
for( int i = 0; i<max_page; i++ )
|
2012-05-09 17:37:25 +00:00
|
|
|
{
|
2013-03-16 03:27:48 +00:00
|
|
|
wxString name = footprintWizard->GetParameterPageName( i );
|
2014-01-29 17:01:42 +00:00
|
|
|
m_pageList->Append( name );
|
2012-05-09 17:37:25 +00:00
|
|
|
}
|
2012-09-11 19:03:21 +00:00
|
|
|
|
2014-01-29 17:01:42 +00:00
|
|
|
m_pageList->SetSelection( 0, true );
|
2012-09-11 19:03:21 +00:00
|
|
|
|
2012-05-09 23:04:08 +00:00
|
|
|
ReCreateParameterList();
|
2012-05-09 17:37:25 +00:00
|
|
|
ReCreateHToolbar();
|
|
|
|
DisplayWizardInfos();
|
|
|
|
m_canvas->Refresh();
|
|
|
|
}
|
|
|
|
|
2013-03-15 16:35:24 +00:00
|
|
|
|
2012-05-09 17:37:25 +00:00
|
|
|
void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList()
|
|
|
|
{
|
2014-01-29 17:01:42 +00:00
|
|
|
if( m_parameterGrid == NULL )
|
2012-05-09 17:37:25 +00:00
|
|
|
return;
|
2012-09-11 19:03:21 +00:00
|
|
|
|
2013-03-16 03:27:48 +00:00
|
|
|
FOOTPRINT_WIZARD* footprintWizard = GetMyWizard();
|
|
|
|
|
|
|
|
if( footprintWizard == NULL )
|
2012-05-09 23:04:08 +00:00
|
|
|
return;
|
2012-09-11 19:03:21 +00:00
|
|
|
|
2014-01-29 17:01:42 +00:00
|
|
|
int page = m_pageList->GetSelection();
|
2012-09-11 19:03:21 +00:00
|
|
|
|
2013-03-15 16:35:24 +00:00
|
|
|
if( page<0 )
|
2012-05-09 23:04:08 +00:00
|
|
|
return;
|
2012-05-09 17:37:25 +00:00
|
|
|
|
2014-01-29 17:01:42 +00:00
|
|
|
m_parameterGrid->ClearGrid();
|
2012-09-11 19:03:21 +00:00
|
|
|
|
|
|
|
|
2012-05-10 22:30:26 +00:00
|
|
|
// Rows
|
2014-01-29 17:01:42 +00:00
|
|
|
m_parameterGrid->AutoSizeRows();
|
|
|
|
m_parameterGrid->EnableDragRowSize( true );
|
|
|
|
m_parameterGrid->SetRowLabelSize( 1 );
|
|
|
|
m_parameterGrid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
|
2012-09-11 19:03:21 +00:00
|
|
|
|
2012-07-22 22:23:17 +00:00
|
|
|
// Get the list of names, values, and types
|
2013-03-16 03:27:48 +00:00
|
|
|
wxArrayString fpList = footprintWizard->GetParameterNames( page );
|
|
|
|
wxArrayString fvList = footprintWizard->GetParameterValues( page );
|
|
|
|
wxArrayString ptList = footprintWizard->GetParameterTypes( page );
|
2012-09-11 19:03:21 +00:00
|
|
|
|
|
|
|
// Dimension the wxGrid
|
2014-01-29 17:01:42 +00:00
|
|
|
m_parameterGrid->DeleteRows( 0, m_parameterGrid->GetNumberRows() );
|
|
|
|
m_parameterGrid->AppendRows( fpList.size() );
|
2012-09-11 19:03:21 +00:00
|
|
|
|
2013-08-05 13:43:15 +00:00
|
|
|
wxString name, value, units;
|
2013-03-15 16:35:24 +00:00
|
|
|
for( unsigned int i = 0; i<fpList.size(); i++ )
|
2012-05-10 22:30:26 +00:00
|
|
|
{
|
2013-03-15 16:35:24 +00:00
|
|
|
name = fpList[i];
|
|
|
|
value = fvList[i];
|
2012-09-11 19:03:21 +00:00
|
|
|
|
2014-01-29 17:01:42 +00:00
|
|
|
m_parameterGrid->SetCellValue( i, 0, name );
|
|
|
|
m_parameterGrid->SetReadOnly( i, 0 );
|
2012-09-11 19:03:21 +00:00
|
|
|
|
2013-03-15 16:35:24 +00:00
|
|
|
if( ptList[i]==wxT( "IU" ) )
|
2012-07-22 22:23:17 +00:00
|
|
|
{
|
2013-03-15 16:35:24 +00:00
|
|
|
LOCALE_IO toggle;
|
|
|
|
|
2012-09-11 19:03:21 +00:00
|
|
|
// We are handling internal units, so convert them to the current
|
2012-07-22 22:23:17 +00:00
|
|
|
// system selected units and store into value.
|
|
|
|
double dValue;
|
2013-03-15 16:35:24 +00:00
|
|
|
|
2012-07-31 21:00:33 +00:00
|
|
|
value.ToDouble( &dValue );
|
2012-07-22 22:23:17 +00:00
|
|
|
|
2012-07-31 21:00:33 +00:00
|
|
|
dValue = To_User_Unit( g_UserUnit, dValue );
|
2012-07-22 22:23:17 +00:00
|
|
|
|
2013-03-15 16:35:24 +00:00
|
|
|
if( g_UserUnit==INCHES ) // we convert inches into mils for more detail
|
2012-09-11 19:03:21 +00:00
|
|
|
{
|
2013-03-15 16:35:24 +00:00
|
|
|
dValue = dValue * 1000.0;
|
|
|
|
units = wxT( "mils" );
|
2012-09-11 19:03:21 +00:00
|
|
|
}
|
2013-03-15 16:35:24 +00:00
|
|
|
else if( g_UserUnit==MILLIMETRES )
|
2012-07-22 22:23:17 +00:00
|
|
|
{
|
2012-07-31 21:00:33 +00:00
|
|
|
units = wxT( "mm" );
|
2012-07-22 22:23:17 +00:00
|
|
|
}
|
|
|
|
|
2013-08-05 13:43:15 +00:00
|
|
|
std::string s = Double2Str( dValue );
|
|
|
|
value = FROM_UTF8( s.c_str() );
|
2012-07-22 22:23:17 +00:00
|
|
|
}
|
2013-03-15 16:35:24 +00:00
|
|
|
else if( ptList[i]==wxT( "UNITS" ) ) // 1,2,3,4,5 ... N
|
2012-07-22 22:23:17 +00:00
|
|
|
{
|
2012-07-31 21:00:33 +00:00
|
|
|
units = wxT( "" );
|
2012-07-22 22:23:17 +00:00
|
|
|
}
|
|
|
|
|
2014-01-29 17:01:42 +00:00
|
|
|
m_parameterGrid->SetCellValue( i, 1, value );
|
|
|
|
m_parameterGrid->SetCellValue( i, 2, units );
|
|
|
|
m_parameterGrid->SetReadOnly( i, 2 );
|
2012-05-10 22:30:26 +00:00
|
|
|
}
|
2012-09-11 19:03:21 +00:00
|
|
|
|
2014-01-29 17:01:42 +00:00
|
|
|
m_parameterGrid->AutoSizeColumns();
|
2012-05-09 17:37:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FOOTPRINT_WIZARD_FRAME::ClickOnPageList( wxCommandEvent& event )
|
|
|
|
{
|
2014-01-29 17:01:42 +00:00
|
|
|
int ii = m_pageList->GetSelection();
|
2012-05-09 17:37:25 +00:00
|
|
|
|
|
|
|
if( ii < 0 )
|
2012-09-11 19:03:21 +00:00
|
|
|
return;
|
|
|
|
|
2012-05-09 17:37:25 +00:00
|
|
|
ReCreateParameterList();
|
|
|
|
m_canvas->Refresh();
|
|
|
|
DisplayWizardInfos();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-03-15 16:35:24 +00:00
|
|
|
#define PARTLIST_WIDTH_KEY wxT( "Partlist_width" )
|
2012-05-09 17:37:25 +00:00
|
|
|
#define PARAMLIST_WIDTH_KEY wxT( "Paramlist_width" )
|
|
|
|
|
|
|
|
|
* 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
|
|
|
void FOOTPRINT_WIZARD_FRAME::LoadSettings( wxConfigBase* aCfg )
|
2012-05-09 17:37:25 +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
|
|
|
EDA_DRAW_FRAME::LoadSettings( aCfg );
|
2012-05-09 17:37:25 +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
|
|
|
wxConfigPathChanger cpc( aCfg, m_configPath );
|
2012-05-09 17:37:25 +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
|
|
|
aCfg->Read( PARTLIST_WIDTH_KEY, &m_pageListWidth, 100 );
|
|
|
|
aCfg->Read( PARAMLIST_WIDTH_KEY, &m_parameterGridWidth, 200 );
|
2012-05-09 17:37:25 +00:00
|
|
|
|
|
|
|
// Set parameters to a reasonable value.
|
2014-01-29 17:01:42 +00:00
|
|
|
if( m_pageListWidth > m_FrameSize.x / 3 )
|
|
|
|
m_pageListWidth = m_FrameSize.x / 3;
|
2012-09-11 19:03:21 +00:00
|
|
|
|
2014-01-29 17:01:42 +00:00
|
|
|
if( m_parameterGridWidth > m_FrameSize.x / 2 )
|
|
|
|
m_parameterGridWidth = m_FrameSize.x / 2;
|
2012-05-09 17:37:25 +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
|
|
|
void FOOTPRINT_WIZARD_FRAME::SaveSettings( wxConfigBase* aCfg )
|
2012-05-09 17:37:25 +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
|
|
|
EDA_DRAW_FRAME::SaveSettings( aCfg );
|
2012-05-09 17:37:25 +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
|
|
|
wxConfigPathChanger cpc( aCfg, m_configPath );
|
|
|
|
aCfg->Write( PARTLIST_WIDTH_KEY, m_pageList->GetSize().x );
|
|
|
|
aCfg->Write( PARAMLIST_WIDTH_KEY, m_parameterGrid->GetSize().x );
|
2012-05-09 17:37:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FOOTPRINT_WIZARD_FRAME::OnActivate( wxActivateEvent& event )
|
|
|
|
{
|
|
|
|
EDA_DRAW_FRAME::OnActivate( event );
|
|
|
|
|
|
|
|
// Ensure we do not have old selection:
|
2013-03-15 16:35:24 +00:00
|
|
|
if( !m_FrameIsActive )
|
2012-05-09 17:37:25 +00:00
|
|
|
return;
|
|
|
|
|
2013-03-15 16:35:24 +00:00
|
|
|
bool footprintWizardsChanged = false;
|
|
|
|
|
|
|
|
if( footprintWizardsChanged )
|
2012-05-09 17:37:25 +00:00
|
|
|
{
|
2013-03-15 16:35:24 +00:00
|
|
|
// If we are here, the library list has changed, rebuild it
|
2012-05-09 17:37:25 +00:00
|
|
|
ReCreatePageList();
|
|
|
|
DisplayWizardInfos();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FOOTPRINT_WIZARD_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition, int aHotKey )
|
|
|
|
{
|
2013-03-15 16:35:24 +00:00
|
|
|
wxRealPoint gridSize;
|
|
|
|
wxPoint oldpos;
|
|
|
|
PCB_SCREEN* screen = GetScreen();
|
|
|
|
wxPoint pos = aPosition;
|
|
|
|
|
|
|
|
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
2012-05-09 17:37:25 +00:00
|
|
|
|
|
|
|
cmd.SetEventObject( this );
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
pos = GetNearestGridPosition( pos );
|
|
|
|
oldpos = GetCrossHairPosition();
|
2013-03-16 03:27:48 +00:00
|
|
|
gridSize = screen->GetGridSize();
|
2012-05-09 17:37:25 +00:00
|
|
|
|
|
|
|
switch( aHotKey )
|
|
|
|
{
|
|
|
|
case WXK_F1:
|
|
|
|
cmd.SetId( ID_POPUP_ZOOM_IN );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WXK_F2:
|
|
|
|
cmd.SetId( ID_POPUP_ZOOM_OUT );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WXK_F3:
|
|
|
|
cmd.SetId( ID_ZOOM_REDRAW );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WXK_F4:
|
|
|
|
cmd.SetId( ID_POPUP_ZOOM_CENTER );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case WXK_HOME:
|
|
|
|
cmd.SetId( ID_ZOOM_PAGE );
|
|
|
|
GetEventHandler()->ProcessEvent( cmd );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ' ':
|
2013-08-03 05:15:23 +00:00
|
|
|
screen->m_O_Curseur = GetCrossHairPosition();
|
2012-05-09 17:37:25 +00:00
|
|
|
break;
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
case WXK_NUMPAD8: // cursor moved up
|
2012-05-09 17:37:25 +00:00
|
|
|
case WXK_UP:
|
|
|
|
pos.y -= KiROUND( gridSize.y );
|
|
|
|
m_canvas->MoveCursor( pos );
|
|
|
|
break;
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
case WXK_NUMPAD2: // cursor moved down
|
2012-05-09 17:37:25 +00:00
|
|
|
case WXK_DOWN:
|
|
|
|
pos.y += KiROUND( gridSize.y );
|
|
|
|
m_canvas->MoveCursor( pos );
|
|
|
|
break;
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
case WXK_NUMPAD4: // cursor moved left
|
2012-05-09 17:37:25 +00:00
|
|
|
case WXK_LEFT:
|
|
|
|
pos.x -= KiROUND( gridSize.x );
|
|
|
|
m_canvas->MoveCursor( pos );
|
|
|
|
break;
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
case WXK_NUMPAD6: // cursor moved right
|
2012-05-09 17:37:25 +00:00
|
|
|
case WXK_RIGHT:
|
|
|
|
pos.x += KiROUND( gridSize.x );
|
|
|
|
m_canvas->MoveCursor( pos );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
SetCrossHairPosition( pos );
|
2012-05-09 17:37:25 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
if( oldpos != GetCrossHairPosition() )
|
2012-05-09 17:37:25 +00:00
|
|
|
{
|
2013-08-03 05:15:23 +00:00
|
|
|
pos = GetCrossHairPosition();
|
|
|
|
SetCrossHairPosition( oldpos );
|
2012-05-09 17:37:25 +00:00
|
|
|
m_canvas->CrossHairOff( aDC );
|
2013-08-03 05:15:23 +00:00
|
|
|
SetCrossHairPosition( pos );
|
2012-05-09 17:37:25 +00:00
|
|
|
m_canvas->CrossHairOn( aDC );
|
|
|
|
|
|
|
|
if( m_canvas->IsMouseCaptured() )
|
|
|
|
{
|
|
|
|
m_canvas->CallMouseCapture( aDC, aPosition, 0 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
UpdateStatusBar(); // Display new cursor coordinates
|
2012-05-09 17:37:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FOOTPRINT_WIZARD_FRAME::Show3D_Frame( wxCommandEvent& event )
|
|
|
|
{
|
|
|
|
if( m_Draw3DFrame )
|
|
|
|
{
|
|
|
|
// Raising the window does not show the window on Windows if iconized.
|
|
|
|
// This should work on any platform.
|
|
|
|
if( m_Draw3DFrame->IsIconized() )
|
2013-03-15 16:35:24 +00:00
|
|
|
m_Draw3DFrame->Iconize( false );
|
2012-05-09 17:37:25 +00:00
|
|
|
|
|
|
|
m_Draw3DFrame->Raise();
|
|
|
|
|
|
|
|
// Raising the window does not set the focus on Linux. This should work on any platform.
|
|
|
|
if( wxWindow::FindFocus() != m_Draw3DFrame )
|
|
|
|
m_Draw3DFrame->SetFocus();
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
* 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
|
|
|
m_Draw3DFrame = new EDA_3D_FRAME( &Kiway(), this, wxEmptyString );
|
2012-05-09 17:37:25 +00:00
|
|
|
Update3D_Frame( false );
|
|
|
|
m_Draw3DFrame->Show( true );
|
|
|
|
}
|
|
|
|
|
2013-03-15 16:35:24 +00:00
|
|
|
|
2012-05-09 17:37:25 +00:00
|
|
|
/**
|
|
|
|
* Function Update3D_Frame
|
|
|
|
* must be called after a footprint selection
|
|
|
|
* Updates the 3D view and 3D frame title.
|
|
|
|
*/
|
|
|
|
void FOOTPRINT_WIZARD_FRAME::Update3D_Frame( bool aForceReloadFootprint )
|
|
|
|
{
|
|
|
|
if( m_Draw3DFrame == NULL )
|
|
|
|
return;
|
|
|
|
|
|
|
|
wxString frm3Dtitle;
|
|
|
|
frm3Dtitle.Printf( _( "ModView: 3D Viewer [%s]" ), GetChars( m_wizardName ) );
|
|
|
|
m_Draw3DFrame->SetTitle( frm3Dtitle );
|
|
|
|
|
|
|
|
if( aForceReloadFootprint )
|
|
|
|
{
|
|
|
|
m_Draw3DFrame->ReloadRequest();
|
2013-03-15 16:35:24 +00:00
|
|
|
|
2012-05-09 17:37:25 +00:00
|
|
|
// Force 3D screen refresh immediately
|
|
|
|
if( GetBoard()->m_Modules )
|
|
|
|
m_Draw3DFrame->NewDisplay();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FOOTPRINT_WIZARD_FRAME::ReCreateHToolbar()
|
|
|
|
{
|
|
|
|
wxString msg;
|
|
|
|
|
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
|
|
|
if( !m_mainToolBar )
|
2012-05-09 17:37:25 +00:00
|
|
|
{
|
|
|
|
m_mainToolBar = new wxAuiToolBar( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
|
|
|
|
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT );
|
|
|
|
|
|
|
|
// Set up toolbar
|
|
|
|
m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_SELECT_WIZARD, wxEmptyString,
|
|
|
|
KiBitmap( library_xpm ),
|
|
|
|
_( "Select wizard to use" ) );
|
|
|
|
|
|
|
|
m_mainToolBar->AddSeparator();
|
|
|
|
m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_PREVIOUS, wxEmptyString,
|
|
|
|
KiBitmap( lib_previous_xpm ),
|
2013-08-05 13:43:15 +00:00
|
|
|
_( "Select previous editable item" ) );
|
2012-05-09 17:37:25 +00:00
|
|
|
|
|
|
|
m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_NEXT, wxEmptyString,
|
|
|
|
KiBitmap( lib_next_xpm ),
|
2013-08-05 13:43:15 +00:00
|
|
|
_( "Select next editable item" ) );
|
2012-05-09 17:37:25 +00:00
|
|
|
|
|
|
|
m_mainToolBar->AddSeparator();
|
|
|
|
m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_SHOW_3D_VIEW, wxEmptyString,
|
|
|
|
KiBitmap( three_d_xpm ),
|
|
|
|
_( "Show footprint in 3D viewer" ) );
|
|
|
|
|
|
|
|
m_mainToolBar->AddSeparator();
|
|
|
|
msg = AddHotkeyName( _( "Zoom in" ), g_Module_Editor_Hokeys_Descr,
|
|
|
|
HK_ZOOM_IN, IS_COMMENT );
|
|
|
|
m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString,
|
|
|
|
KiBitmap( zoom_in_xpm ), msg );
|
|
|
|
|
|
|
|
msg = AddHotkeyName( _( "Zoom out" ), g_Module_Editor_Hokeys_Descr,
|
|
|
|
HK_ZOOM_OUT, IS_COMMENT );
|
|
|
|
m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
|
|
|
|
KiBitmap( zoom_out_xpm ), msg );
|
|
|
|
|
|
|
|
msg = AddHotkeyName( _( "Redraw view" ), g_Module_Editor_Hokeys_Descr,
|
|
|
|
HK_ZOOM_REDRAW, IS_COMMENT );
|
|
|
|
m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
|
2013-03-15 16:35:24 +00:00
|
|
|
KiBitmap( zoom_redraw_xpm ), msg );
|
2012-05-09 17:37:25 +00:00
|
|
|
|
|
|
|
msg = AddHotkeyName( _( "Zoom auto" ), g_Module_Editor_Hokeys_Descr,
|
|
|
|
HK_ZOOM_AUTO, IS_COMMENT );
|
|
|
|
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
|
|
|
|
KiBitmap( zoom_fit_in_page_xpm ), msg );
|
2013-03-15 16:35:24 +00:00
|
|
|
|
2014-05-04 18:22:27 +00:00
|
|
|
if( IsModal() )
|
2012-05-09 17:37:25 +00:00
|
|
|
{
|
|
|
|
// The library browser is called from a "load component" command
|
|
|
|
m_mainToolBar->AddSeparator();
|
2012-08-04 22:15:57 +00:00
|
|
|
m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_DONE,
|
2012-05-09 17:37:25 +00:00
|
|
|
wxEmptyString, KiBitmap( export_footprint_names_xpm ),
|
|
|
|
_( "Insert footprint in board" ) );
|
|
|
|
}
|
2012-07-31 21:00:33 +00:00
|
|
|
|
2012-05-09 17:37:25 +00:00
|
|
|
// after adding the buttons to the toolbar, must call Realize() to
|
|
|
|
// reflect the changes
|
|
|
|
m_mainToolBar->Realize();
|
|
|
|
}
|
|
|
|
|
|
|
|
m_mainToolBar->Refresh();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FOOTPRINT_WIZARD_FRAME::ReCreateVToolbar()
|
|
|
|
{
|
|
|
|
}
|