2013-12-14 19:03:38 +00:00
|
|
|
/**
|
2018-02-16 19:26:55 +00:00
|
|
|
* Module editor: Dialog for editing footprint properties in the pcb editor.
|
2013-12-14 19:03:38 +00:00
|
|
|
*/
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2012-06-09 09:38:58 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2016-07-19 17:35:25 +00:00
|
|
|
* Copyright (C) 2016 Mario Luzeiro <mrluzeiro@ua.pt>
|
2018-01-14 13:24:58 +00:00
|
|
|
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2015-02-02 16:43:34 +00:00
|
|
|
* Copyright (C) 2015 Dick Hollenbeck, dick@softplc.com
|
2018-01-14 13:24:58 +00:00
|
|
|
* Copyright (C) 2004-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
2012-06-09 09:38:58 +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
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
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>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <gr_basic.h>
|
|
|
|
#include <class_drawpanel.h>
|
|
|
|
#include <confirm.h>
|
|
|
|
#include <pcbnew.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 <gestfich.h>
|
|
|
|
#include <3d_viewer.h>
|
2018-01-29 20:58:58 +00:00
|
|
|
#include <pcb_edit_frame.h>
|
2012-04-13 18:51:24 +00:00
|
|
|
#include <base_units.h>
|
2015-12-08 07:31:57 +00:00
|
|
|
#include <project.h>
|
2016-06-20 13:46:58 +00:00
|
|
|
#include <board_commit.h>
|
2017-02-20 12:20:39 +00:00
|
|
|
#include <bitmaps.h>
|
2018-03-12 22:45:17 +00:00
|
|
|
#include <dialog_text_entry.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
|
|
|
|
#include <class_module.h>
|
|
|
|
#include <class_text_mod.h>
|
2015-02-02 16:43:34 +00:00
|
|
|
#include <validators.h>
|
2017-11-23 13:05:26 +00:00
|
|
|
#include <widgets/text_ctrl_eval.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
|
2018-02-16 16:52:19 +00:00
|
|
|
#include <dialog_edit_footprint_for_BoardEditor.h>
|
2012-03-08 17:47:23 +00:00
|
|
|
#include <wildcards_and_files_ext.h>
|
2016-01-16 06:49:28 +00:00
|
|
|
#include "3d_cache/dialogs/panel_prev_model.h"
|
|
|
|
#include "3d_cache/dialogs/3d_cache_dialogs.h"
|
|
|
|
#include "3d_cache/3d_cache.h"
|
|
|
|
#include "3d_cache/3d_filename_resolver.h"
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2018-02-16 16:52:19 +00:00
|
|
|
#include <dialog_edit_footprint_text.h>
|
2018-01-14 13:24:58 +00:00
|
|
|
|
2018-02-16 19:26:55 +00:00
|
|
|
size_t DIALOG_FOOTPRINT_BOARD_EDITOR::m_page = 0; // remember the last open page during session
|
2015-02-02 16:43:34 +00:00
|
|
|
|
2017-04-04 14:05:01 +00:00
|
|
|
|
2018-02-16 19:26:55 +00:00
|
|
|
DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR( PCB_EDIT_FRAME* aParent,
|
2011-03-01 19:26:17 +00:00
|
|
|
MODULE* aModule,
|
|
|
|
wxDC* aDC ) :
|
2018-02-16 19:26:55 +00:00
|
|
|
DIALOG_FOOTPRINT_BOARD_EDITOR_BASE( aParent ),
|
2016-04-10 12:59:23 +00:00
|
|
|
m_OrientValidator( 1, &m_OrientValue )
|
2009-08-11 10:27:21 +00:00
|
|
|
{
|
2016-07-19 17:35:25 +00:00
|
|
|
wxASSERT( aParent != NULL );
|
|
|
|
wxASSERT( aModule != NULL );
|
|
|
|
|
2009-08-11 10:27:21 +00:00
|
|
|
m_Parent = aParent;
|
2009-11-04 19:08:08 +00:00
|
|
|
m_DC = aDC;
|
|
|
|
m_CurrentModule = aModule;
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2016-07-19 17:35:25 +00:00
|
|
|
m_currentModuleCopy = new MODULE( *aModule );
|
|
|
|
|
2011-09-11 11:38:01 +00:00
|
|
|
// Give an icon
|
|
|
|
wxIcon icon;
|
|
|
|
icon.CopyFromBitmap( KiBitmap( icon_modedit_xpm ) );
|
|
|
|
SetIcon( icon );
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2016-04-10 12:59:23 +00:00
|
|
|
m_OrientValidator.SetRange( -360.0, 360.0 );
|
|
|
|
m_OrientValueCtrl->SetValidator( m_OrientValidator );
|
2016-04-10 22:28:06 +00:00
|
|
|
m_OrientValidator.SetWindow( m_OrientValueCtrl );
|
2016-04-10 12:59:23 +00:00
|
|
|
|
2016-04-17 22:35:32 +00:00
|
|
|
aParent->Prj().Get3DCacheManager()->GetResolver()->SetProgramBase( &Pgm() );
|
2016-08-05 19:30:23 +00:00
|
|
|
|
2016-07-19 17:35:25 +00:00
|
|
|
m_PreviewPane = new PANEL_PREV_3D( m_Panel3D,
|
|
|
|
aParent->Prj().Get3DCacheManager(),
|
|
|
|
m_currentModuleCopy,
|
2017-08-05 14:37:51 +00:00
|
|
|
&aParent->Settings().Colors(),
|
2016-07-19 17:35:25 +00:00
|
|
|
&m_shapes3D_list );
|
|
|
|
|
2015-12-08 07:31:57 +00:00
|
|
|
bLowerSizer3D->Add( m_PreviewPane, 1, wxEXPAND, 5 );
|
|
|
|
|
2018-05-04 16:20:41 +00:00
|
|
|
wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
|
|
|
infoFont.SetSymbolicSize( wxFONTSIZE_X_SMALL );
|
|
|
|
m_staticTextInfoValNeg->SetFont( infoFont );
|
|
|
|
m_staticTextInfoValPos->SetFont( infoFont );
|
|
|
|
m_staticTextInfo2->SetFont( infoFont );
|
|
|
|
|
2015-02-02 16:43:34 +00:00
|
|
|
m_NoteBook->SetSelection( m_page );
|
2011-03-14 15:17:18 +00:00
|
|
|
m_sdbSizerStdButtonsOK->SetDefault();
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2016-05-11 02:36:23 +00:00
|
|
|
m_ReferenceCopy = NULL;
|
|
|
|
m_ValueCopy = NULL;
|
|
|
|
m_LastSelected3DShapeIndex = 0;
|
|
|
|
m_OrientValue = 0;
|
|
|
|
|
2017-04-04 14:05:01 +00:00
|
|
|
// Layout() gets called correctly in TransferDataToWindow().
|
2009-08-11 10:27:21 +00:00
|
|
|
}
|
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2015-02-02 16:43:34 +00:00
|
|
|
|
2018-02-16 19:26:55 +00:00
|
|
|
DIALOG_FOOTPRINT_BOARD_EDITOR::~DIALOG_FOOTPRINT_BOARD_EDITOR()
|
2009-08-11 10:27:21 +00:00
|
|
|
{
|
2016-07-19 17:35:25 +00:00
|
|
|
m_shapes3D_list.clear();
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2016-02-21 00:54:34 +00:00
|
|
|
// free the memory used by all models, otherwise models which were
|
|
|
|
// browsed but not used would consume memory
|
|
|
|
Prj().Get3DCacheManager()->FlushCache( false );
|
|
|
|
|
2016-06-14 10:08:35 +00:00
|
|
|
// the GL canvas has to be visible before it is destroyed
|
|
|
|
m_page = m_NoteBook->GetSelection();
|
|
|
|
m_NoteBook->SetSelection( 1 );
|
|
|
|
|
2009-08-11 10:27:21 +00:00
|
|
|
delete m_ReferenceCopy;
|
2016-07-19 17:35:25 +00:00
|
|
|
m_ReferenceCopy = NULL;
|
|
|
|
|
2009-08-11 10:27:21 +00:00
|
|
|
delete m_ValueCopy;
|
2016-07-19 17:35:25 +00:00
|
|
|
m_ValueCopy = NULL;
|
|
|
|
|
|
|
|
delete m_PreviewPane;
|
|
|
|
m_PreviewPane = NULL; // just in case, to avoid double-free
|
|
|
|
|
|
|
|
// this is already deleted by the board used on preview pane so
|
|
|
|
// no need to delete here
|
|
|
|
// delete m_currentModuleCopy;
|
|
|
|
// m_currentModuleCopy = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
// Creation of the panel properties of the module editor.
|
2018-02-16 19:26:55 +00:00
|
|
|
void DIALOG_FOOTPRINT_BOARD_EDITOR::InitBoardProperties()
|
2009-08-11 10:27:21 +00:00
|
|
|
{
|
2012-04-13 18:51:24 +00:00
|
|
|
PutValueInLocalUnits( *m_ModPositionX, m_CurrentModule->GetPosition().x );
|
2013-03-04 16:39:08 +00:00
|
|
|
m_XPosUnit->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2012-04-13 18:51:24 +00:00
|
|
|
PutValueInLocalUnits( *m_ModPositionY, m_CurrentModule->GetPosition().y );
|
2013-03-04 16:39:08 +00:00
|
|
|
m_YPosUnit->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
m_LayerCtrl->SetSelection(
|
2014-06-24 16:17:18 +00:00
|
|
|
(m_CurrentModule->GetLayer() == B_Cu) ? 1 : 0 );
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2016-04-10 12:59:23 +00:00
|
|
|
bool custom_orientation = false;
|
2013-05-04 11:57:09 +00:00
|
|
|
switch( int( m_CurrentModule->GetOrientation() ) )
|
2009-11-04 19:08:08 +00:00
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
m_OrientCtrl->SetSelection( 0 );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 900:
|
2009-11-14 22:15:22 +00:00
|
|
|
case -2700:
|
2009-11-04 19:08:08 +00:00
|
|
|
m_OrientCtrl->SetSelection( 1 );
|
|
|
|
break;
|
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
case -900:
|
2009-11-04 19:08:08 +00:00
|
|
|
case 2700:
|
|
|
|
m_OrientCtrl->SetSelection( 2 );
|
|
|
|
break;
|
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
case -1800:
|
2009-11-04 19:08:08 +00:00
|
|
|
case 1800:
|
|
|
|
m_OrientCtrl->SetSelection( 3 );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
m_OrientCtrl->SetSelection( 4 );
|
2016-04-10 12:59:23 +00:00
|
|
|
custom_orientation = true;
|
2009-11-04 19:08:08 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2016-04-10 12:59:23 +00:00
|
|
|
m_OrientValueCtrl->Enable( custom_orientation );
|
|
|
|
m_OrientValue = m_CurrentModule->GetOrientation() / 10.0;
|
|
|
|
m_OrientValidator.TransferToWindow();
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2009-11-06 12:55:20 +00:00
|
|
|
// Initialize dialog relative to masks clearances
|
2013-03-04 16:39:08 +00:00
|
|
|
m_NetClearanceUnits->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
|
|
|
|
m_SolderMaskMarginUnits->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
|
|
|
|
m_SolderPasteMarginUnits->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2012-04-17 01:35:43 +00:00
|
|
|
PutValueInLocalUnits( *m_NetClearanceValueCtrl, m_CurrentModule->GetLocalClearance() );
|
|
|
|
PutValueInLocalUnits( *m_SolderMaskMarginCtrl, m_CurrentModule->GetLocalSolderMaskMargin() );
|
2009-11-14 22:15:22 +00:00
|
|
|
|
|
|
|
// These 2 parameters are usually < 0, so prepare entering a negative
|
|
|
|
// value, if current is 0
|
2012-04-13 18:51:24 +00:00
|
|
|
PutValueInLocalUnits( *m_SolderPasteMarginCtrl, m_CurrentModule->GetLocalSolderPasteMargin() );
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
if( m_CurrentModule->GetLocalSolderPasteMargin() == 0 )
|
2009-11-14 22:15:22 +00:00
|
|
|
m_SolderPasteMarginCtrl->SetValue( wxT( "-" ) +
|
|
|
|
m_SolderPasteMarginCtrl->GetValue() );
|
2012-05-18 08:33:57 +00:00
|
|
|
|
|
|
|
// Add solder paste margin ration in per cent
|
|
|
|
// for the usual default value 0.0, display -0.0 (or -0,0 in some countries)
|
2016-04-10 12:59:23 +00:00
|
|
|
wxString msg;
|
2013-05-30 19:32:00 +00:00
|
|
|
msg.Printf( wxT( "%f" ),
|
2012-02-19 04:02:19 +00:00
|
|
|
m_CurrentModule->GetLocalSolderPasteMarginRatio() * 100.0 );
|
2012-05-18 08:33:57 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
if( m_CurrentModule->GetLocalSolderPasteMarginRatio() == 0.0 &&
|
2012-05-18 08:33:57 +00:00
|
|
|
msg[0] == '0') // Sometimes Printf adds a sign if the value is very small (0.0)
|
2010-01-31 20:01:46 +00:00
|
|
|
m_SolderPasteMarginRatioCtrl->SetValue( wxT("-") + msg );
|
2009-11-06 12:55:20 +00:00
|
|
|
else
|
2010-01-31 20:01:46 +00:00
|
|
|
m_SolderPasteMarginRatioCtrl->SetValue( msg );
|
2012-02-24 23:23:46 +00:00
|
|
|
|
|
|
|
switch( m_CurrentModule->GetZoneConnection() )
|
|
|
|
{
|
|
|
|
default:
|
2015-08-18 14:19:17 +00:00
|
|
|
case PAD_ZONE_CONN_INHERITED:
|
2012-02-24 23:23:46 +00:00
|
|
|
m_ZoneConnectionChoice->SetSelection( 0 );
|
|
|
|
break;
|
|
|
|
|
2015-08-18 14:19:17 +00:00
|
|
|
case PAD_ZONE_CONN_FULL:
|
2012-02-24 23:23:46 +00:00
|
|
|
m_ZoneConnectionChoice->SetSelection( 1 );
|
|
|
|
break;
|
|
|
|
|
2015-08-18 14:19:17 +00:00
|
|
|
case PAD_ZONE_CONN_THERMAL:
|
2012-02-24 23:23:46 +00:00
|
|
|
m_ZoneConnectionChoice->SetSelection( 2 );
|
|
|
|
break;
|
|
|
|
|
2015-08-18 14:19:17 +00:00
|
|
|
case PAD_ZONE_CONN_NONE:
|
2012-02-24 23:23:46 +00:00
|
|
|
m_ZoneConnectionChoice->SetSelection( 3 );
|
|
|
|
break;
|
|
|
|
}
|
2009-11-04 19:08:08 +00:00
|
|
|
}
|
2009-08-11 10:27:21 +00:00
|
|
|
|
|
|
|
|
2018-02-16 19:26:55 +00:00
|
|
|
void DIALOG_FOOTPRINT_BOARD_EDITOR::GotoModuleEditor( wxCommandEvent& event )
|
2009-08-11 10:27:21 +00:00
|
|
|
{
|
2011-12-12 08:37:05 +00:00
|
|
|
if( m_CurrentModule->GetTimeStamp() == 0 ) // Module Editor needs a non null timestamp
|
2009-08-11 10:27:21 +00:00
|
|
|
{
|
2011-12-12 08:37:05 +00:00
|
|
|
m_CurrentModule->SetTimeStamp( GetNewTimeStamp() );
|
2010-02-19 13:23:58 +00:00
|
|
|
m_Parent->OnModify();
|
2009-08-11 10:27:21 +00:00
|
|
|
}
|
|
|
|
|
2015-08-20 18:13:18 +00:00
|
|
|
EndModal( PRM_EDITOR_WANT_MODEDIT );
|
2009-08-11 10:27:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-02-16 19:26:55 +00:00
|
|
|
void DIALOG_FOOTPRINT_BOARD_EDITOR::UpdateModule( wxCommandEvent& event )
|
2018-01-12 19:36:15 +00:00
|
|
|
{
|
|
|
|
EndModal( PRM_EDITOR_WANT_UPDATE_FP );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-02-16 19:26:55 +00:00
|
|
|
void DIALOG_FOOTPRINT_BOARD_EDITOR::ExchangeModule( wxCommandEvent& event )
|
2009-08-11 10:27:21 +00:00
|
|
|
{
|
2015-08-20 18:13:18 +00:00
|
|
|
EndModal( PRM_EDITOR_WANT_EXCHANGE_FP );
|
2009-08-11 10:27:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-02-16 19:26:55 +00:00
|
|
|
void DIALOG_FOOTPRINT_BOARD_EDITOR::ModuleOrientEvent( wxCommandEvent& event )
|
2009-08-11 10:27:21 +00:00
|
|
|
{
|
2016-04-10 12:59:23 +00:00
|
|
|
bool custom_orientation = false;
|
|
|
|
|
2009-08-11 10:27:21 +00:00
|
|
|
switch( m_OrientCtrl->GetSelection() )
|
|
|
|
{
|
|
|
|
case 0:
|
2016-04-10 12:59:23 +00:00
|
|
|
m_OrientValue = 0.0;
|
2009-08-11 10:27:21 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
2016-04-10 12:59:23 +00:00
|
|
|
m_OrientValue = 90.0;
|
2009-08-11 10:27:21 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
2016-04-10 12:59:23 +00:00
|
|
|
m_OrientValue = 270.0;
|
2009-08-11 10:27:21 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
2016-04-10 12:59:23 +00:00
|
|
|
m_OrientValue = 180.0;
|
2009-08-11 10:27:21 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2016-04-10 12:59:23 +00:00
|
|
|
custom_orientation = true;
|
2009-08-11 10:27:21 +00:00
|
|
|
break;
|
|
|
|
}
|
2016-04-10 12:59:23 +00:00
|
|
|
|
|
|
|
m_OrientValidator.TransferToWindow();
|
|
|
|
m_OrientValueCtrl->Enable( custom_orientation );
|
2009-08-11 10:27:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-02-16 19:26:55 +00:00
|
|
|
void DIALOG_FOOTPRINT_BOARD_EDITOR::InitModeditProperties()
|
2009-08-11 10:27:21 +00:00
|
|
|
{
|
2014-02-10 09:30:08 +00:00
|
|
|
wxString default_path;
|
2014-08-24 07:05:07 +00:00
|
|
|
wxGetEnv( KISYS3DMOD, &default_path );
|
2014-02-10 09:30:08 +00:00
|
|
|
#ifdef __WINDOWS__
|
|
|
|
default_path.Replace( wxT( "/" ), wxT( "\\" ) );
|
|
|
|
#endif
|
|
|
|
|
2009-08-11 10:27:21 +00:00
|
|
|
m_LastSelected3DShapeIndex = -1;
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
// Init 3D shape list
|
2016-07-04 16:22:18 +00:00
|
|
|
m_3D_ShapeNameListBox->Clear();
|
2017-10-27 14:25:20 +00:00
|
|
|
auto sM = m_CurrentModule->Models().begin();
|
|
|
|
auto eM = m_CurrentModule->Models().end();
|
2016-07-19 17:35:25 +00:00
|
|
|
m_shapes3D_list.clear();
|
|
|
|
|
2016-01-16 06:49:28 +00:00
|
|
|
wxString origPath;
|
|
|
|
wxString alias;
|
|
|
|
wxString shortPath;
|
|
|
|
S3D_FILENAME_RESOLVER* res = Prj().Get3DCacheManager()->GetResolver();
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2016-07-19 17:35:25 +00:00
|
|
|
while( sM != eM )
|
2009-08-11 10:27:21 +00:00
|
|
|
{
|
2016-07-19 17:35:25 +00:00
|
|
|
m_shapes3D_list.push_back( *sM );
|
|
|
|
origPath = sM->m_Filename;
|
|
|
|
|
|
|
|
if( res && res->SplitAlias( origPath, alias, shortPath ) )
|
2009-08-18 07:54:03 +00:00
|
|
|
{
|
2016-07-19 17:35:25 +00:00
|
|
|
origPath = alias;
|
2017-04-04 14:05:01 +00:00
|
|
|
origPath.append( ":" );
|
2016-07-19 17:35:25 +00:00
|
|
|
origPath.append( shortPath );
|
2009-08-18 07:54:03 +00:00
|
|
|
}
|
2016-01-16 06:49:28 +00:00
|
|
|
|
2016-07-19 17:35:25 +00:00
|
|
|
m_3D_ShapeNameListBox->Append( origPath );
|
|
|
|
++sM;
|
|
|
|
|
2009-08-11 10:27:21 +00:00
|
|
|
}
|
|
|
|
|
2016-05-31 08:27:52 +00:00
|
|
|
m_ReferenceCopy = new TEXTE_MODULE( m_CurrentModule->Reference() );
|
|
|
|
m_ReferenceCopy->SetParent( m_CurrentModule );
|
|
|
|
m_ValueCopy = new TEXTE_MODULE( m_CurrentModule->Value() );
|
|
|
|
m_ValueCopy->SetParent( m_CurrentModule );
|
2013-03-18 19:36:07 +00:00
|
|
|
m_ReferenceCtrl->SetValue( m_ReferenceCopy->GetText() );
|
|
|
|
m_ValueCtrl->SetValue( m_ValueCopy->GetText() );
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2013-12-14 19:03:38 +00:00
|
|
|
// Shows the footprint's schematic path.
|
|
|
|
m_textCtrlSheetPath->SetValue( m_CurrentModule->GetPath() );
|
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
m_AttributsCtrl->SetItemToolTip( 0,
|
2017-12-24 15:04:02 +00:00
|
|
|
_( "Use this attribute for most non SMD footprints\n"
|
|
|
|
"Footprints with this option are not put in the footprint position list file" ) );
|
2009-08-11 10:27:21 +00:00
|
|
|
m_AttributsCtrl->SetItemToolTip( 1,
|
2017-12-24 15:04:02 +00:00
|
|
|
_( "Use this attribute for SMD footprints.\n"
|
|
|
|
"Only footprints with this option are put in the footprint position list file" ) );
|
2009-08-11 10:27:21 +00:00
|
|
|
m_AttributsCtrl->SetItemToolTip( 2,
|
2017-12-24 15:04:02 +00:00
|
|
|
_( "Use this attribute for \"virtual\" footprints drawn on board\n"
|
|
|
|
"such as an edge connector (old ISA PC bus for instance)" ) );
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
// Controls on right side of the dialog
|
2013-03-13 18:53:58 +00:00
|
|
|
switch( m_CurrentModule->GetAttributes() & 255 )
|
2009-08-11 10:27:21 +00:00
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
m_AttributsCtrl->SetSelection( 0 );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MOD_CMS:
|
|
|
|
m_AttributsCtrl->SetSelection( 1 );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MOD_VIRTUAL:
|
|
|
|
m_AttributsCtrl->SetSelection( 2 );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
m_AttributsCtrl->SetSelection( 0 );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-02-18 16:53:46 +00:00
|
|
|
if( m_CurrentModule->IsLocked() )
|
2015-02-17 23:58:14 +00:00
|
|
|
m_AutoPlaceCtrl->SetSelection( 2 );
|
2015-02-18 16:53:46 +00:00
|
|
|
else if( m_CurrentModule->PadsLocked() )
|
2015-02-17 23:58:14 +00:00
|
|
|
m_AutoPlaceCtrl->SetSelection( 1 );
|
|
|
|
else
|
|
|
|
m_AutoPlaceCtrl->SetSelection( 0 );
|
2012-08-21 10:45:54 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
m_AutoPlaceCtrl->SetItemToolTip( 0,
|
2017-04-04 14:05:01 +00:00
|
|
|
_( "Component can be freely moved and auto placed. User "
|
|
|
|
"can arbitrarily select and edit component's pads." ) );
|
2009-11-14 22:15:22 +00:00
|
|
|
m_AutoPlaceCtrl->SetItemToolTip( 1,
|
2017-04-04 14:05:01 +00:00
|
|
|
_( "Component can be freely moved and auto placed, but its "
|
|
|
|
"pads cannot be selected or edited." ) );
|
2015-02-17 23:58:14 +00:00
|
|
|
m_AutoPlaceCtrl->SetItemToolTip( 2,
|
2017-04-04 14:05:01 +00:00
|
|
|
_( "Component is locked: it cannot be freely moved or auto "
|
|
|
|
"placed." ) );
|
2012-08-21 10:45:54 +00:00
|
|
|
|
2013-03-13 18:53:58 +00:00
|
|
|
m_CostRot90Ctrl->SetValue( m_CurrentModule->GetPlacementCost90() );
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2013-03-13 18:53:58 +00:00
|
|
|
m_CostRot180Ctrl->SetValue( m_CurrentModule->GetPlacementCost180() );
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2011-01-16 12:49:58 +00:00
|
|
|
// if m_3D_ShapeNameListBox is not empty, preselect first 3D shape
|
|
|
|
if( m_3D_ShapeNameListBox->GetCount() > 0 )
|
|
|
|
{
|
|
|
|
m_LastSelected3DShapeIndex = 0;
|
|
|
|
m_3D_ShapeNameListBox->SetSelection( m_LastSelected3DShapeIndex );
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
if( m_PreviewPane )
|
|
|
|
m_PreviewPane->SetModelDataIdx( m_LastSelected3DShapeIndex, true );
|
2011-01-16 12:49:58 +00:00
|
|
|
}
|
2016-01-23 03:52:54 +00:00
|
|
|
else
|
|
|
|
{
|
2016-07-19 17:35:25 +00:00
|
|
|
if( m_PreviewPane )
|
|
|
|
m_PreviewPane->ResetModelData( true );
|
2016-01-23 03:52:54 +00:00
|
|
|
}
|
2013-03-04 12:08:35 +00:00
|
|
|
|
|
|
|
// We have modified the UI, so call Fit() for m_Panel3D
|
|
|
|
// to be sure the m_Panel3D sizers are initiliazed before opening the dialog
|
|
|
|
m_Panel3D->GetSizer()->Fit( m_Panel3D );
|
2017-04-16 19:48:22 +00:00
|
|
|
|
|
|
|
// For some reason, on Linux, after the call to
|
|
|
|
// m_PreviewPane->SetModelDataIdx( m_LastSelected3DShapeIndex, true )
|
|
|
|
// the dialog has no longer the focus. Force it:
|
|
|
|
m_sdbSizerStdButtonsOK->SetFocus();
|
2009-08-11 10:27:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-02-16 19:26:55 +00:00
|
|
|
void DIALOG_FOOTPRINT_BOARD_EDITOR::On3DShapeNameSelected( wxCommandEvent& event )
|
2009-08-11 10:27:21 +00:00
|
|
|
{
|
|
|
|
m_LastSelected3DShapeIndex = m_3D_ShapeNameListBox->GetSelection();
|
2009-08-17 19:04:51 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
if( m_LastSelected3DShapeIndex < 0 ) // happens under wxGTK when
|
|
|
|
// deleting an item in
|
|
|
|
// m_3D_ShapeNameListBox wxListBox
|
2016-07-19 17:35:25 +00:00
|
|
|
{
|
|
|
|
if( m_PreviewPane )
|
|
|
|
m_PreviewPane->ResetModelData();
|
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
return;
|
2016-07-19 17:35:25 +00:00
|
|
|
}
|
2009-08-17 19:04:51 +00:00
|
|
|
|
2016-07-19 17:35:25 +00:00
|
|
|
if( m_LastSelected3DShapeIndex >= (int) m_shapes3D_list.size() )
|
2009-08-17 19:04:51 +00:00
|
|
|
{
|
2009-11-04 19:08:08 +00:00
|
|
|
wxMessageBox( wxT( "On3DShapeNameSelected() error" ) );
|
2009-08-17 19:04:51 +00:00
|
|
|
m_LastSelected3DShapeIndex = -1;
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
if( m_PreviewPane )
|
|
|
|
m_PreviewPane->ResetModelData();
|
|
|
|
|
2009-08-17 19:04:51 +00:00
|
|
|
return;
|
|
|
|
}
|
2016-01-16 06:49:28 +00:00
|
|
|
|
2016-07-19 17:35:25 +00:00
|
|
|
if( m_PreviewPane )
|
|
|
|
m_PreviewPane->SetModelDataIdx( m_LastSelected3DShapeIndex );
|
2009-08-11 10:27:21 +00:00
|
|
|
}
|
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
|
|
|
|
|
2018-02-16 19:26:55 +00:00
|
|
|
void DIALOG_FOOTPRINT_BOARD_EDITOR::Remove3DShape( wxCommandEvent& event )
|
2009-08-11 10:27:21 +00:00
|
|
|
{
|
|
|
|
int ii = m_3D_ShapeNameListBox->GetSelection();
|
2016-07-19 17:35:25 +00:00
|
|
|
|
2009-08-11 10:27:21 +00:00
|
|
|
if( ii < 0 )
|
2016-07-19 17:35:25 +00:00
|
|
|
{
|
|
|
|
if( m_PreviewPane )
|
|
|
|
m_PreviewPane->ResetModelData( true );
|
|
|
|
|
2009-08-11 10:27:21 +00:00
|
|
|
return;
|
2016-07-19 17:35:25 +00:00
|
|
|
}
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2016-07-19 17:35:25 +00:00
|
|
|
m_shapes3D_list.erase( m_shapes3D_list.begin() + ii );
|
2009-11-04 19:08:08 +00:00
|
|
|
m_3D_ShapeNameListBox->Delete( ii );
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2016-07-19 17:35:25 +00:00
|
|
|
if( m_3D_ShapeNameListBox->GetCount() > 0 )
|
2009-08-11 10:27:21 +00:00
|
|
|
{
|
2015-12-08 07:31:57 +00:00
|
|
|
if( ii > 0 )
|
|
|
|
m_LastSelected3DShapeIndex = ii - 1;
|
|
|
|
else
|
|
|
|
m_LastSelected3DShapeIndex = 0;
|
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
m_3D_ShapeNameListBox->SetSelection( m_LastSelected3DShapeIndex );
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
if( m_PreviewPane )
|
|
|
|
m_PreviewPane->SetModelDataIdx( m_LastSelected3DShapeIndex, true );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( m_PreviewPane )
|
|
|
|
m_PreviewPane->ResetModelData( true );
|
2009-08-11 10:27:21 +00:00
|
|
|
}
|
2015-12-08 07:31:57 +00:00
|
|
|
|
|
|
|
return;
|
2009-08-11 10:27:21 +00:00
|
|
|
}
|
|
|
|
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2018-02-16 19:26:55 +00:00
|
|
|
void DIALOG_FOOTPRINT_BOARD_EDITOR::Edit3DShapeFileName()
|
2015-02-02 16:43:34 +00:00
|
|
|
{
|
|
|
|
int idx = m_3D_ShapeNameListBox->GetSelection();
|
|
|
|
|
|
|
|
if( idx < 0 )
|
|
|
|
return;
|
|
|
|
|
2016-01-23 03:52:54 +00:00
|
|
|
// Edit filename
|
|
|
|
wxString filename = m_3D_ShapeNameListBox->GetStringSelection();
|
2018-03-12 22:45:17 +00:00
|
|
|
WX_TEXT_ENTRY_DIALOG dlg( this, wxEmptyString, wxEmptyString, filename );
|
2016-01-16 06:49:28 +00:00
|
|
|
|
2016-01-23 03:52:54 +00:00
|
|
|
bool hasAlias;
|
|
|
|
S3D_FILENAME_RESOLVER* res = Prj().Get3DCacheManager()->GetResolver();
|
2016-01-16 06:49:28 +00:00
|
|
|
|
2016-01-23 03:52:54 +00:00
|
|
|
if( dlg.ShowModal() != wxID_OK )
|
|
|
|
return;
|
2016-01-16 06:49:28 +00:00
|
|
|
|
2016-01-23 03:52:54 +00:00
|
|
|
filename = dlg.GetValue();
|
2016-01-16 06:49:28 +00:00
|
|
|
|
2016-01-23 03:52:54 +00:00
|
|
|
if( filename.empty() )
|
|
|
|
return;
|
2016-01-16 06:49:28 +00:00
|
|
|
|
2016-01-23 03:52:54 +00:00
|
|
|
if( !res->ValidateFileName( filename, hasAlias ) )
|
2016-01-16 06:49:28 +00:00
|
|
|
{
|
2016-01-23 03:52:54 +00:00
|
|
|
wxString msg = _( "Invalid filename: " );
|
|
|
|
msg.append( filename );
|
2016-09-03 16:10:49 +00:00
|
|
|
wxMessageBox( msg, _( "Edit 3D file name" ) );
|
2016-01-23 03:52:54 +00:00
|
|
|
|
2016-01-16 06:49:28 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-02-02 16:43:34 +00:00
|
|
|
|
2016-01-23 03:52:54 +00:00
|
|
|
m_3D_ShapeNameListBox->SetString( idx, filename );
|
2016-01-16 06:49:28 +00:00
|
|
|
|
2016-01-23 03:52:54 +00:00
|
|
|
// if the user has specified an alias in the name then prepend ':'
|
|
|
|
if( hasAlias )
|
|
|
|
filename.insert( 0, wxT( ":" ) );
|
2016-01-16 06:49:28 +00:00
|
|
|
|
2016-01-23 03:52:54 +00:00
|
|
|
#ifdef __WINDOWS__
|
2016-01-17 21:33:39 +00:00
|
|
|
// In Kicad files, filenames and paths are stored using Unix notation
|
2016-01-23 03:52:54 +00:00
|
|
|
filename.Replace( wxT( "\\" ), wxT( "/" ) );
|
|
|
|
#endif
|
2016-01-17 21:33:39 +00:00
|
|
|
|
2016-07-19 17:35:25 +00:00
|
|
|
m_shapes3D_list[idx].m_Filename = filename;
|
2016-01-17 21:33:39 +00:00
|
|
|
|
2016-07-19 17:35:25 +00:00
|
|
|
// This assumes that the index didn't change and will just update the filename
|
|
|
|
if( m_PreviewPane )
|
|
|
|
m_PreviewPane->UpdateModelName( filename );
|
2015-12-09 05:43:30 +00:00
|
|
|
|
2015-12-08 07:31:57 +00:00
|
|
|
return;
|
2015-02-02 16:43:34 +00:00
|
|
|
}
|
|
|
|
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2018-02-16 19:26:55 +00:00
|
|
|
void DIALOG_FOOTPRINT_BOARD_EDITOR::BrowseAndAdd3DShapeFile()
|
2009-08-11 10:27:21 +00:00
|
|
|
{
|
2016-01-16 06:49:28 +00:00
|
|
|
PROJECT& prj = Prj();
|
2017-10-27 14:25:20 +00:00
|
|
|
MODULE_3D_SETTINGS model;
|
* 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-08-24 07:05:07 +00:00
|
|
|
wxString initialpath = prj.GetRString( PROJECT::VIEWER_3D_PATH );
|
2015-12-08 07:31:57 +00:00
|
|
|
wxString sidx = prj.GetRString( PROJECT::VIEWER_3D_FILTER_INDEX );
|
|
|
|
int filter = 0;
|
* 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
|
|
|
|
2017-12-27 17:43:26 +00:00
|
|
|
// If the PROJECT::VIEWER_3D_PATH hasn't been set yet, use the KISYS3DMOD environment
|
|
|
|
// varaible and fall back to the project path if necessary.
|
|
|
|
if( initialpath.IsEmpty() )
|
|
|
|
{
|
|
|
|
if( !wxGetEnv( "KISYS3DMOD", &initialpath ) || initialpath.IsEmpty() )
|
|
|
|
initialpath = prj.GetProjectPath();
|
|
|
|
}
|
|
|
|
|
2015-12-08 07:31:57 +00:00
|
|
|
if( !sidx.empty() )
|
|
|
|
{
|
|
|
|
long tmp;
|
|
|
|
sidx.ToLong( &tmp );
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2016-08-05 19:30:23 +00:00
|
|
|
if( tmp > 0 && tmp <= INT_MAX )
|
2015-12-08 07:31:57 +00:00
|
|
|
filter = (int) tmp;
|
|
|
|
}
|
2010-01-20 12:43:05 +00:00
|
|
|
|
2015-12-08 07:31:57 +00:00
|
|
|
if( !S3D::Select3DModel( this, Prj().Get3DCacheManager(),
|
2016-07-19 17:35:25 +00:00
|
|
|
initialpath, filter, &model ) || model.m_Filename.empty() )
|
2014-06-10 15:56:43 +00:00
|
|
|
{
|
2015-12-08 07:31:57 +00:00
|
|
|
return;
|
2010-01-20 12:43:05 +00:00
|
|
|
}
|
|
|
|
|
2015-12-08 07:31:57 +00:00
|
|
|
prj.SetRString( PROJECT::VIEWER_3D_PATH, initialpath );
|
|
|
|
sidx = wxString::Format( wxT( "%i" ), filter );
|
|
|
|
prj.SetRString( PROJECT::VIEWER_3D_FILTER_INDEX, sidx );
|
2016-07-19 17:35:25 +00:00
|
|
|
S3D_FILENAME_RESOLVER* res = Prj().Get3DCacheManager()->GetResolver();
|
2016-01-17 21:33:39 +00:00
|
|
|
wxString alias;
|
|
|
|
wxString shortPath;
|
2016-07-19 17:35:25 +00:00
|
|
|
wxString filename = model.m_Filename;
|
2014-08-24 07:05:07 +00:00
|
|
|
|
2016-07-19 17:35:25 +00:00
|
|
|
if( res && res->SplitAlias( filename, alias, shortPath ) )
|
2016-01-17 21:33:39 +00:00
|
|
|
{
|
2016-07-19 17:35:25 +00:00
|
|
|
alias.Append( wxT( ":" ) );
|
|
|
|
alias.Append( shortPath );
|
|
|
|
m_3D_ShapeNameListBox->Append( alias );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_3D_ShapeNameListBox->Append( filename );
|
2016-01-17 21:33:39 +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
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
#ifdef __WINDOWS__
|
2014-08-24 07:05:07 +00:00
|
|
|
// In Kicad files, filenames and paths are stored using Unix notation
|
2017-04-04 14:05:01 +00:00
|
|
|
model.m_Filename.Replace( "\\", "/" );
|
2012-08-21 10:45:54 +00:00
|
|
|
#endif
|
* 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
|
|
|
|
2016-07-19 17:35:25 +00:00
|
|
|
m_shapes3D_list.push_back( model );
|
2009-08-11 10:27:21 +00:00
|
|
|
m_LastSelected3DShapeIndex = m_3D_ShapeNameListBox->GetCount() - 1;
|
2009-11-04 19:08:08 +00:00
|
|
|
m_3D_ShapeNameListBox->SetSelection( m_LastSelected3DShapeIndex );
|
2016-07-19 17:35:25 +00:00
|
|
|
|
|
|
|
if( m_PreviewPane )
|
|
|
|
m_PreviewPane->SetModelDataIdx( m_LastSelected3DShapeIndex, true ) ;
|
2015-12-08 07:31:57 +00:00
|
|
|
|
|
|
|
return;
|
2009-08-11 10:27:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-02-16 19:26:55 +00:00
|
|
|
bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow()
|
2016-04-10 12:59:23 +00:00
|
|
|
{
|
2016-08-24 15:18:51 +00:00
|
|
|
if( !wxDialog::TransferDataToWindow() ||
|
|
|
|
!m_PanelProperties->TransferDataToWindow() )
|
|
|
|
{
|
|
|
|
wxMessageBox( _( "Error: invalid footprint parameter" ) );
|
2016-04-10 12:59:23 +00:00
|
|
|
return false;
|
2016-08-24 15:18:51 +00:00
|
|
|
}
|
2016-04-10 12:59:23 +00:00
|
|
|
|
|
|
|
if( !m_Panel3D->TransferDataToWindow() )
|
2016-08-24 15:18:51 +00:00
|
|
|
{
|
|
|
|
wxMessageBox( _( "Error: invalid 3D parameter" ) );
|
2016-04-10 12:59:23 +00:00
|
|
|
return false;
|
2016-08-24 15:18:51 +00:00
|
|
|
}
|
2016-04-10 12:59:23 +00:00
|
|
|
|
|
|
|
InitModeditProperties();
|
|
|
|
InitBoardProperties();
|
2017-04-04 14:05:01 +00:00
|
|
|
Layout();
|
2016-04-10 12:59:23 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-02-16 19:26:55 +00:00
|
|
|
bool DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow()
|
2009-08-11 10:27:21 +00:00
|
|
|
{
|
2009-11-14 22:15:22 +00:00
|
|
|
wxPoint modpos;
|
2009-11-04 19:08:08 +00:00
|
|
|
wxString msg;
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2018-02-16 19:26:55 +00:00
|
|
|
if( !Validate() || !DIALOG_FOOTPRINT_BOARD_EDITOR_BASE::TransferDataFromWindow() ||
|
2016-08-24 15:18:51 +00:00
|
|
|
!m_PanelProperties->TransferDataFromWindow() )
|
|
|
|
{
|
|
|
|
wxMessageBox( _( "Error: invalid or missing footprint parameter" ) );
|
2016-04-10 12:59:23 +00:00
|
|
|
return false;
|
2016-08-24 15:18:51 +00:00
|
|
|
}
|
2016-04-10 12:59:23 +00:00
|
|
|
|
|
|
|
if( !m_Panel3D->TransferDataFromWindow() )
|
2016-08-24 15:18:51 +00:00
|
|
|
{
|
|
|
|
wxMessageBox( _( "Error: invalid or missing 3D parameter" ) );
|
2016-04-10 12:59:23 +00:00
|
|
|
return false;
|
2016-08-24 15:18:51 +00:00
|
|
|
}
|
2016-04-10 12:59:23 +00:00
|
|
|
|
2018-02-14 16:46:35 +00:00
|
|
|
// Check if footprint local clerance is acceptable (i.e. >= 0 )
|
|
|
|
int localNetClearance = ValueFromTextCtrl( *m_NetClearanceValueCtrl );
|
|
|
|
|
|
|
|
if( localNetClearance < 0 )
|
|
|
|
{
|
|
|
|
wxMessageBox( _( "Error: footprint local net clearance is < 0" ) );
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2009-08-11 10:27:21 +00:00
|
|
|
if( m_DC )
|
|
|
|
{
|
2011-12-22 13:28:11 +00:00
|
|
|
m_Parent->GetCanvas()->CrossHairOff( m_DC );
|
|
|
|
m_CurrentModule->Draw( m_Parent->GetCanvas(), m_DC, GR_XOR );
|
2009-08-11 10:27:21 +00:00
|
|
|
}
|
|
|
|
|
2017-04-16 18:52:41 +00:00
|
|
|
BOARD_COMMIT commit( m_Parent );
|
|
|
|
commit.Modify( m_CurrentModule );
|
|
|
|
|
2012-04-06 18:03:16 +00:00
|
|
|
// Init Fields (should be first, because they can be moved or/and flipped later):
|
2016-05-31 08:27:52 +00:00
|
|
|
TEXTE_MODULE& reference = m_CurrentModule->Reference();
|
|
|
|
reference = *m_ReferenceCopy;
|
|
|
|
TEXTE_MODULE& value = m_CurrentModule->Value();
|
|
|
|
value = *m_ValueCopy;
|
2012-04-06 18:03:16 +00:00
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
// Initialize masks clearances
|
2018-02-14 16:46:35 +00:00
|
|
|
m_CurrentModule->SetLocalClearance( localNetClearance );
|
* 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_CurrentModule->SetLocalSolderMaskMargin( ValueFromTextCtrl( *m_SolderMaskMarginCtrl ) );
|
|
|
|
m_CurrentModule->SetLocalSolderPasteMargin( ValueFromTextCtrl( *m_SolderPasteMarginCtrl ) );
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2010-01-31 20:01:46 +00:00
|
|
|
double dtmp = 0.0;
|
2009-11-04 19:08:08 +00:00
|
|
|
msg = m_SolderPasteMarginRatioCtrl->GetValue();
|
|
|
|
msg.ToDouble( &dtmp );
|
2009-11-14 22:15:22 +00:00
|
|
|
|
2012-05-18 08:33:57 +00:00
|
|
|
// A -50% margin ratio means no paste on a pad, the ratio must be >= -50%
|
|
|
|
if( dtmp < -50.0 )
|
|
|
|
dtmp = -50.0;
|
|
|
|
// A margin ratio is always <= 0
|
|
|
|
// 0 means use full pad copper area
|
|
|
|
if( dtmp > 0.0 )
|
|
|
|
dtmp = 0.0;
|
2011-12-22 13:28:11 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
m_CurrentModule->SetLocalSolderPasteMarginRatio( dtmp / 100 );
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2012-02-24 23:23:46 +00:00
|
|
|
switch( m_ZoneConnectionChoice->GetSelection() )
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
case 0:
|
2015-08-18 14:19:17 +00:00
|
|
|
m_CurrentModule->SetZoneConnection( PAD_ZONE_CONN_INHERITED );
|
2012-02-24 23:23:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
2015-08-18 14:19:17 +00:00
|
|
|
m_CurrentModule->SetZoneConnection( PAD_ZONE_CONN_FULL );
|
2012-02-24 23:23:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
2015-08-18 14:19:17 +00:00
|
|
|
m_CurrentModule->SetZoneConnection( PAD_ZONE_CONN_THERMAL );
|
2012-02-24 23:23:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
2015-08-18 14:19:17 +00:00
|
|
|
m_CurrentModule->SetZoneConnection( PAD_ZONE_CONN_NONE );
|
2012-02-24 23:23:46 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2009-08-11 10:27:21 +00:00
|
|
|
// Set Module Position
|
* 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
|
|
|
modpos.x = ValueFromTextCtrl( *m_ModPositionX );
|
|
|
|
modpos.y = ValueFromTextCtrl( *m_ModPositionY );
|
2009-11-04 19:08:08 +00:00
|
|
|
m_CurrentModule->SetPosition( modpos );
|
2015-02-17 23:58:14 +00:00
|
|
|
m_CurrentModule->SetLocked( m_AutoPlaceCtrl->GetSelection() == 2 );
|
|
|
|
m_CurrentModule->SetPadsLocked( m_AutoPlaceCtrl->GetSelection() == 1 );
|
2009-08-11 10:27:21 +00:00
|
|
|
|
|
|
|
switch( m_AttributsCtrl->GetSelection() )
|
|
|
|
{
|
|
|
|
case 0:
|
2013-03-13 18:53:58 +00:00
|
|
|
m_CurrentModule->SetAttributes( 0 );
|
2009-08-11 10:27:21 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
2013-03-13 18:53:58 +00:00
|
|
|
m_CurrentModule->SetAttributes( MOD_CMS );
|
2009-08-11 10:27:21 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
2013-03-13 18:53:58 +00:00
|
|
|
m_CurrentModule->SetAttributes( MOD_VIRTUAL );
|
2009-08-11 10:27:21 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-03-13 18:53:58 +00:00
|
|
|
m_CurrentModule->SetPlacementCost90( m_CostRot90Ctrl->GetValue() );
|
|
|
|
m_CurrentModule->SetPlacementCost180( m_CostRot180Ctrl->GetValue() );
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2010-05-03 15:24:54 +00:00
|
|
|
/* Now, set orientation. must be made after others changes,
|
|
|
|
* because rotation changes fields positions on board according to the new orientation
|
|
|
|
* (relative positions are not modified)
|
|
|
|
*/
|
2016-04-10 12:59:23 +00:00
|
|
|
int orient = KiROUND( m_OrientValue * 10.0 );
|
2011-12-22 13:28:11 +00:00
|
|
|
|
2013-03-13 18:53:58 +00:00
|
|
|
if( m_CurrentModule->GetOrientation() != orient )
|
|
|
|
m_CurrentModule->Rotate( m_CurrentModule->GetPosition(),
|
|
|
|
orient - m_CurrentModule->GetOrientation() );
|
2010-05-03 15:24:54 +00:00
|
|
|
|
|
|
|
// Set component side, that also have effect on the fields positions on board
|
2012-01-22 17:20:22 +00:00
|
|
|
bool change_layer = false;
|
2010-05-03 15:24:54 +00:00
|
|
|
if( m_LayerCtrl->GetSelection() == 0 ) // layer req = COMPONENT
|
|
|
|
{
|
2014-06-24 16:17:18 +00:00
|
|
|
if( m_CurrentModule->GetLayer() == B_Cu )
|
2012-01-22 17:20:22 +00:00
|
|
|
change_layer = true;
|
2010-05-03 15:24:54 +00:00
|
|
|
}
|
2014-06-24 16:17:18 +00:00
|
|
|
else if( m_CurrentModule->GetLayer() == F_Cu )
|
2012-01-22 17:20:22 +00:00
|
|
|
change_layer = true;
|
2010-05-03 15:24:54 +00:00
|
|
|
|
|
|
|
if( change_layer )
|
2013-03-13 18:53:58 +00:00
|
|
|
m_CurrentModule->Flip( m_CurrentModule->GetPosition() );
|
2010-05-03 15:24:54 +00:00
|
|
|
|
2016-07-19 17:35:25 +00:00
|
|
|
// This will update the S3D_INFO list into the current module
|
2016-08-05 19:30:23 +00:00
|
|
|
msg.Clear();
|
|
|
|
|
2016-09-30 05:51:18 +00:00
|
|
|
if( !m_PreviewPane->ValidateWithMessage( msg ) )
|
2016-08-05 19:30:23 +00:00
|
|
|
{
|
|
|
|
DisplayError( this, msg );
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-10-27 14:25:20 +00:00
|
|
|
std::list<MODULE_3D_SETTINGS>* draw3D = &m_CurrentModule->Models();
|
2016-07-19 17:35:25 +00:00
|
|
|
draw3D->clear();
|
|
|
|
draw3D->insert( draw3D->end(), m_shapes3D_list.begin(), m_shapes3D_list.end() );
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2011-09-07 19:41:04 +00:00
|
|
|
m_CurrentModule->CalculateBoundingBox();
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2016-06-20 13:46:58 +00:00
|
|
|
// This is a simple edition, we must create an undo entry
|
|
|
|
if( m_CurrentModule->GetFlags() == 0 )
|
|
|
|
commit.Push( _( "Modify module properties" ) );
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2016-04-10 12:59:23 +00:00
|
|
|
SetReturnCode( PRM_EDITOR_EDIT_OK );
|
2009-08-11 10:27:21 +00:00
|
|
|
|
|
|
|
if( m_DC )
|
|
|
|
{
|
2011-12-22 13:28:11 +00:00
|
|
|
m_CurrentModule->Draw( m_Parent->GetCanvas(), m_DC, GR_OR );
|
|
|
|
m_Parent->GetCanvas()->CrossHairOn( m_DC );
|
2009-08-11 10:27:21 +00:00
|
|
|
}
|
2016-04-10 12:59:23 +00:00
|
|
|
|
|
|
|
return true;
|
2009-08-11 10:27:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-02-16 19:26:55 +00:00
|
|
|
void DIALOG_FOOTPRINT_BOARD_EDITOR::OnEditReference( wxCommandEvent& event )
|
2009-08-11 10:27:21 +00:00
|
|
|
{
|
2013-08-03 05:15:23 +00:00
|
|
|
wxPoint tmp = m_Parent->GetCrossHairPosition();
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2017-01-23 20:30:11 +00:00
|
|
|
m_Parent->SetCrossHairPosition( m_ReferenceCopy->GetTextPos() );
|
2009-11-04 19:08:08 +00:00
|
|
|
m_ReferenceCopy->SetParent( m_CurrentModule );
|
2018-01-14 13:24:58 +00:00
|
|
|
|
|
|
|
DIALOG_EDIT_FPTEXT dialog( this, m_Parent, m_ReferenceCopy, NULL );
|
|
|
|
dialog.ShowModal();
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
m_Parent->SetCrossHairPosition( tmp );
|
2013-03-18 19:36:07 +00:00
|
|
|
m_ReferenceCtrl->SetValue( m_ReferenceCopy->GetText() );
|
2009-08-11 10:27:21 +00:00
|
|
|
}
|
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2018-02-16 19:26:55 +00:00
|
|
|
void DIALOG_FOOTPRINT_BOARD_EDITOR::OnEditValue( wxCommandEvent& event )
|
2009-08-11 10:27:21 +00:00
|
|
|
{
|
2013-08-03 05:15:23 +00:00
|
|
|
wxPoint tmp = m_Parent->GetCrossHairPosition();
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2017-01-23 20:30:11 +00:00
|
|
|
m_Parent->SetCrossHairPosition( m_ValueCopy->GetTextPos() );
|
2009-11-04 19:08:08 +00:00
|
|
|
m_ValueCopy->SetParent( m_CurrentModule );
|
2018-01-14 13:24:58 +00:00
|
|
|
|
|
|
|
DIALOG_EDIT_FPTEXT dialog( this, m_Parent, m_ValueCopy, NULL );
|
|
|
|
dialog.ShowModal();
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
m_Parent->SetCrossHairPosition( tmp );
|
2013-03-18 19:36:07 +00:00
|
|
|
m_ValueCtrl->SetValue( m_ValueCopy->GetText() );
|
2009-08-11 10:27:21 +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
|
|
|
|
2016-02-27 23:17:58 +00:00
|
|
|
|
2018-02-16 19:26:55 +00:00
|
|
|
void DIALOG_FOOTPRINT_BOARD_EDITOR::Cfg3DPath( wxCommandEvent& event )
|
2016-02-27 23:17:58 +00:00
|
|
|
{
|
2016-07-19 17:35:25 +00:00
|
|
|
if( S3D::Configure3DPaths( this, Prj().Get3DCacheManager()->GetResolver() ) )
|
|
|
|
if( m_LastSelected3DShapeIndex >= 0 )
|
|
|
|
if( m_PreviewPane )
|
|
|
|
m_PreviewPane->SetModelDataIdx( m_LastSelected3DShapeIndex, true );
|
2016-02-27 23:17:58 +00:00
|
|
|
}
|