2012-05-18 08:33:57 +00:00
|
|
|
/**
|
2012-09-12 17:28:55 +00:00
|
|
|
* @file dialog_edit_module_for_Modedit.cpp
|
2012-05-18 08:33:57 +00:00
|
|
|
*
|
|
|
|
* @brief Dialog for editing a module properties in module editor (modedit)
|
|
|
|
*/
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2014-02-10 09:30:08 +00:00
|
|
|
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
|
|
|
* Copyright (C) 2014 Dick Hollenbeck, dick@softplc.com
|
|
|
|
* Copyright (C) 2008-2014 Wayne Stambaugh <stambaughw@verizon.net>
|
|
|
|
* Copyright (C) 2004-2014 KiCad Developers, see change_log.txt for contributors.
|
2012-08-21 10:45:54 +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>
|
|
|
|
#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 <kiface_i.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <gestfich.h>
|
|
|
|
#include <3d_struct.h>
|
|
|
|
#include <3d_viewer.h>
|
|
|
|
#include <wxPcbStruct.h>
|
2012-04-13 18:51:24 +00:00
|
|
|
#include <base_units.h>
|
2013-05-02 18:06:58 +00:00
|
|
|
#include <macros.h>
|
2013-11-29 18:29:41 +00:00
|
|
|
#include <validators.h>
|
|
|
|
#include <kicad_string.h>
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_module.h>
|
|
|
|
#include <class_text_mod.h>
|
|
|
|
#include <module_editor_frame.h>
|
|
|
|
#include <dialog_edit_module_for_Modedit.h>
|
2012-03-08 17:47:23 +00:00
|
|
|
#include <wildcards_and_files_ext.h>
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2011-03-14 15:17:18 +00:00
|
|
|
|
2011-08-26 17:01:17 +00:00
|
|
|
DIALOG_MODULE_MODULE_EDITOR::DIALOG_MODULE_MODULE_EDITOR( FOOTPRINT_EDIT_FRAME* aParent,
|
2009-08-11 10:27:21 +00:00
|
|
|
MODULE* aModule ) :
|
|
|
|
DIALOG_MODULE_MODULE_EDITOR_BASE( aParent )
|
|
|
|
{
|
2012-12-10 11:18:42 +00:00
|
|
|
m_parent = aParent;
|
|
|
|
m_currentModule = aModule;
|
2011-09-11 11:38:01 +00:00
|
|
|
|
|
|
|
// Give an icon
|
|
|
|
wxIcon icon;
|
|
|
|
icon.CopyFromBitmap( KiBitmap( icon_modedit_xpm ) );
|
|
|
|
SetIcon( icon );
|
|
|
|
|
2013-11-29 18:29:41 +00:00
|
|
|
m_FootprintNameCtrl->SetValidator( FOOTPRINT_NAME_VALIDATOR() );
|
2012-12-10 11:18:42 +00:00
|
|
|
initModeditProperties();
|
2011-03-14 15:17:18 +00:00
|
|
|
m_sdbSizerStdButtonsOK->SetDefault();
|
2009-08-11 10:27:21 +00:00
|
|
|
GetSizer()->SetSizeHints( this );
|
|
|
|
Centre();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DIALOG_MODULE_MODULE_EDITOR::~DIALOG_MODULE_MODULE_EDITOR()
|
|
|
|
{
|
2012-12-10 11:18:42 +00:00
|
|
|
for( unsigned ii = 0; ii < m_shapes3D_list.size(); ii++ )
|
|
|
|
delete m_shapes3D_list[ii];
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2012-12-10 11:18:42 +00:00
|
|
|
m_shapes3D_list.clear();
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2012-12-10 11:18:42 +00:00
|
|
|
delete m_referenceCopy;
|
|
|
|
delete m_valueCopy;
|
2009-08-11 10:27:21 +00:00
|
|
|
delete m_3D_Scale;
|
|
|
|
delete m_3D_Offset;
|
|
|
|
delete m_3D_Rotation;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-12-10 11:18:42 +00:00
|
|
|
void DIALOG_MODULE_MODULE_EDITOR::initModeditProperties()
|
2009-08-11 10:27:21 +00:00
|
|
|
{
|
|
|
|
SetFocus();
|
|
|
|
|
2014-02-10 09:30:08 +00:00
|
|
|
// Display the default path, given by environment variable KISYS3DMOD
|
|
|
|
wxString default_path;
|
|
|
|
wxGetEnv( wxT( KISYS3DMOD ), &default_path );
|
|
|
|
#ifdef __WINDOWS__
|
|
|
|
default_path.Replace( wxT( "/" ), wxT( "\\" ) );
|
|
|
|
#endif
|
|
|
|
m_textCtrl3DDefaultPath->SetValue( default_path );
|
|
|
|
|
2012-12-10 11:18:42 +00:00
|
|
|
m_lastSelected3DShapeIndex = -1;
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
// Init 3D shape list
|
2013-03-18 19:36:07 +00:00
|
|
|
S3D_MASTER* draw3D = m_currentModule->Models();
|
2009-08-11 10:27:21 +00:00
|
|
|
|
|
|
|
while( draw3D )
|
|
|
|
{
|
2014-01-25 12:23:29 +00:00
|
|
|
if( !draw3D->GetShape3DName().IsEmpty() )
|
2009-08-18 07:54:03 +00:00
|
|
|
{
|
|
|
|
S3D_MASTER* draw3DCopy = new S3D_MASTER(NULL);
|
|
|
|
draw3DCopy->Copy( draw3D );
|
2012-12-10 11:18:42 +00:00
|
|
|
m_shapes3D_list.push_back( draw3DCopy );
|
2014-01-25 12:23:29 +00:00
|
|
|
m_3D_ShapeNameListBox->Append( draw3DCopy->GetShape3DName() );
|
2009-08-18 07:54:03 +00:00
|
|
|
}
|
2009-08-11 10:27:21 +00:00
|
|
|
draw3D = (S3D_MASTER*) draw3D->Next();
|
|
|
|
}
|
|
|
|
|
2013-03-13 18:53:58 +00:00
|
|
|
m_DocCtrl->SetValue( m_currentModule->GetDescription() );
|
|
|
|
m_KeywordCtrl->SetValue( m_currentModule->GetKeywords() );
|
2013-11-29 18:29:41 +00:00
|
|
|
m_referenceCopy = new TEXTE_MODULE( NULL );
|
|
|
|
m_valueCopy = new TEXTE_MODULE( NULL );
|
2013-03-13 18:53:58 +00:00
|
|
|
m_referenceCopy->Copy( &m_currentModule->Reference() );
|
|
|
|
m_valueCopy->Copy( &m_currentModule->Value() );
|
2013-03-18 19:36:07 +00:00
|
|
|
m_ReferenceCtrl->SetValue( m_referenceCopy->GetText() );
|
|
|
|
m_ValueCtrl->SetValue( m_valueCopy->GetText() );
|
|
|
|
m_ValueCtrl->SetValue( m_valueCopy->GetText() );
|
2014-01-02 02:17:07 +00:00
|
|
|
m_FootprintNameCtrl->SetValue( m_currentModule->GetFPID().Format() );
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2013-04-28 13:34:59 +00:00
|
|
|
m_AttributsCtrl->SetItemToolTip( 0, _( "Use this attribute for most non SMD components" ) );
|
2009-08-11 10:27:21 +00:00
|
|
|
m_AttributsCtrl->SetItemToolTip( 1,
|
2013-04-28 13:34:59 +00:00
|
|
|
_( "Use this attribute for SMD components.\nOnly components with this option are put in the footprint position list file" ) );
|
2009-08-11 10:27:21 +00:00
|
|
|
m_AttributsCtrl->SetItemToolTip( 2,
|
2013-03-13 18:53:58 +00:00
|
|
|
_( "Use this attribute for \"virtual\" components drawn on board (like a old ISA PC bus connector)" ) );
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2012-02-19 04:02:19 +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;
|
|
|
|
}
|
|
|
|
|
2013-03-13 18:53:58 +00:00
|
|
|
m_AutoPlaceCtrl->SetSelection( (m_currentModule->IsLocked()) ? 1 : 0 );
|
2009-08-11 10:27:21 +00:00
|
|
|
m_AutoPlaceCtrl->SetItemToolTip( 0, _( "Enable hotkey move commands and Auto Placement" ) );
|
|
|
|
m_AutoPlaceCtrl->SetItemToolTip( 1, _( "Disable hotkey move commands and Auto Placement" ) );
|
2012-05-18 08:33:57 +00:00
|
|
|
|
2013-03-13 18:53:58 +00:00
|
|
|
m_CostRot90Ctrl->SetValue( m_currentModule->GetPlacementCost90() );
|
|
|
|
m_CostRot180Ctrl->SetValue( m_currentModule->GetPlacementCost180() );
|
2009-08-11 10:27:21 +00:00
|
|
|
|
|
|
|
// Initialize 3D parameters
|
2013-08-28 07:23:14 +00:00
|
|
|
m_3D_Scale = new VERTEX_VALUE_CTRL( m_Panel3D, m_bSizerShapeScale );
|
|
|
|
m_3D_Offset = new VERTEX_VALUE_CTRL( m_Panel3D, m_bSizerShapeOffset );
|
|
|
|
m_3D_Rotation = new VERTEX_VALUE_CTRL( m_Panel3D, m_bSizerShapeRotation );
|
2009-11-04 19:08:08 +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
|
|
|
|
|
|
|
wxString msg;
|
2012-12-10 11:18:42 +00:00
|
|
|
PutValueInLocalUnits( *m_NetClearanceValueCtrl, m_currentModule->GetLocalClearance() );
|
|
|
|
PutValueInLocalUnits( *m_SolderMaskMarginCtrl, m_currentModule->GetLocalSolderMaskMargin() );
|
2012-04-17 01:35:43 +00:00
|
|
|
|
2009-11-06 12:55:20 +00:00
|
|
|
// These 2 parameters are usually < 0, so prepare entering a negative value, if current is 0
|
2012-12-10 11:18:42 +00:00
|
|
|
PutValueInLocalUnits( *m_SolderPasteMarginCtrl, m_currentModule->GetLocalSolderPasteMargin() );
|
2012-04-13 18:51:24 +00:00
|
|
|
|
2012-12-10 11:18:42 +00:00
|
|
|
if( m_currentModule->GetLocalSolderPasteMargin() == 0 )
|
2013-11-29 18:29:41 +00:00
|
|
|
m_SolderPasteMarginCtrl->SetValue( wxT( "-" ) + m_SolderPasteMarginCtrl->GetValue() );
|
2012-04-13 18:51:24 +00:00
|
|
|
|
2012-12-10 11:18:42 +00:00
|
|
|
if( m_currentModule->GetLocalSolderPasteMarginRatio() == 0.0 )
|
2013-05-30 19:32:00 +00:00
|
|
|
msg.Printf( wxT( "-%f" ), m_currentModule->GetLocalSolderPasteMarginRatio() * 100.0 );
|
2009-11-06 12:55:20 +00:00
|
|
|
else
|
2013-05-30 19:32:00 +00:00
|
|
|
msg.Printf( wxT( "%f" ), m_currentModule->GetLocalSolderPasteMarginRatio() * 100.0 );
|
2012-04-13 18:51:24 +00:00
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
m_SolderPasteMarginRatioCtrl->SetValue( msg );
|
2011-01-16 12:49:58 +00:00
|
|
|
|
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)
|
2013-11-29 18:29:41 +00:00
|
|
|
msg.Printf( wxT( "%f" ), m_currentModule->GetLocalSolderPasteMarginRatio() * 100.0 );
|
2012-05-18 08:33:57 +00:00
|
|
|
|
2012-12-10 11:18:42 +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)
|
2013-11-29 18:29:41 +00:00
|
|
|
m_SolderPasteMarginRatioCtrl->SetValue( wxT( "-" ) + msg );
|
2012-05-18 08:33:57 +00:00
|
|
|
else
|
|
|
|
m_SolderPasteMarginRatioCtrl->SetValue( msg );
|
|
|
|
|
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 )
|
|
|
|
{
|
2012-12-10 11:18:42 +00:00
|
|
|
m_lastSelected3DShapeIndex = 0;
|
|
|
|
m_3D_ShapeNameListBox->SetSelection( m_lastSelected3DShapeIndex );
|
|
|
|
Transfert3DValuesToDisplay( m_shapes3D_list[m_lastSelected3DShapeIndex] );
|
2011-01-16 12:49:58 +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 initialized before opening the dialog
|
|
|
|
m_Panel3D->GetSizer()->Fit( m_Panel3D );
|
2009-08-11 10:27:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
// Initialize 3D info displayed in dialog box from values in aStruct3DSource
|
2009-08-11 10:27:21 +00:00
|
|
|
void DIALOG_MODULE_MODULE_EDITOR::Transfert3DValuesToDisplay( S3D_MASTER * aStruct3DSource )
|
|
|
|
{
|
|
|
|
if( aStruct3DSource )
|
|
|
|
{
|
|
|
|
m_3D_Scale->SetValue( aStruct3DSource->m_MatScale );
|
|
|
|
m_3D_Offset->SetValue( aStruct3DSource->m_MatPosition );
|
|
|
|
m_3D_Rotation->SetValue( aStruct3DSource->m_MatRotation );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-08-21 10:45:54 +00:00
|
|
|
S3D_VERTEX dummy_vertex;
|
2009-08-11 10:27:21 +00:00
|
|
|
dummy_vertex.x = dummy_vertex.y = dummy_vertex.z = 1.0;
|
|
|
|
m_3D_Scale->SetValue( dummy_vertex );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-11-29 18:29:41 +00:00
|
|
|
|
2012-12-10 11:18:42 +00:00
|
|
|
/** Copy 3D info displayed in dialog box to values in a item in m_shapes3D_list
|
|
|
|
* @param aIndexSelection = item index in m_shapes3D_list
|
2009-08-11 10:27:21 +00:00
|
|
|
*/
|
|
|
|
void DIALOG_MODULE_MODULE_EDITOR::TransfertDisplayTo3DValues( int aIndexSelection )
|
|
|
|
{
|
2012-12-10 11:18:42 +00:00
|
|
|
if( aIndexSelection >= (int)m_shapes3D_list.size() )
|
2009-08-11 10:27:21 +00:00
|
|
|
return;
|
|
|
|
|
2012-12-10 11:18:42 +00:00
|
|
|
S3D_MASTER * struct3DDest = m_shapes3D_list[aIndexSelection];
|
2009-08-11 10:27:21 +00:00
|
|
|
struct3DDest->m_MatScale = m_3D_Scale->GetValue();
|
|
|
|
struct3DDest->m_MatRotation = m_3D_Rotation->GetValue();
|
|
|
|
struct3DDest->m_MatPosition = m_3D_Offset->GetValue();
|
|
|
|
}
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
|
2009-08-11 10:27:21 +00:00
|
|
|
void DIALOG_MODULE_MODULE_EDITOR::On3DShapeNameSelected(wxCommandEvent& event)
|
|
|
|
{
|
2012-12-10 11:18:42 +00:00
|
|
|
if( m_lastSelected3DShapeIndex >= 0 )
|
|
|
|
TransfertDisplayTo3DValues( m_lastSelected3DShapeIndex );
|
2013-11-29 18:29:41 +00:00
|
|
|
|
2012-12-10 11:18:42 +00:00
|
|
|
m_lastSelected3DShapeIndex = m_3D_ShapeNameListBox->GetSelection();
|
2009-08-17 19:04:51 +00:00
|
|
|
|
2012-12-10 11:18:42 +00:00
|
|
|
if( m_lastSelected3DShapeIndex < 0 ) // happens under wxGTK when deleting an item in m_3D_ShapeNameListBox wxListBox
|
2009-08-17 19:04:51 +00:00
|
|
|
return;
|
|
|
|
|
2012-12-10 11:18:42 +00:00
|
|
|
if( m_lastSelected3DShapeIndex >= (int)m_shapes3D_list.size() )
|
2009-08-17 19:04:51 +00:00
|
|
|
{
|
2013-11-29 18:29:41 +00:00
|
|
|
wxMessageBox( wxT( "On3DShapeNameSelected() error" ) );
|
2012-12-10 11:18:42 +00:00
|
|
|
m_lastSelected3DShapeIndex = -1;
|
2009-08-17 19:04:51 +00:00
|
|
|
return;
|
|
|
|
}
|
2013-11-29 18:29:41 +00:00
|
|
|
|
2012-12-10 11:18:42 +00:00
|
|
|
Transfert3DValuesToDisplay( m_shapes3D_list[m_lastSelected3DShapeIndex] );
|
2009-08-11 10:27:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_MODULE_MODULE_EDITOR::Remove3DShape(wxCommandEvent& event)
|
|
|
|
{
|
2012-12-10 11:18:42 +00:00
|
|
|
if( m_lastSelected3DShapeIndex >= 0 )
|
|
|
|
TransfertDisplayTo3DValues( m_lastSelected3DShapeIndex );
|
2009-08-11 10:27:21 +00:00
|
|
|
|
|
|
|
int ii = m_3D_ShapeNameListBox->GetSelection();
|
2013-11-29 18:29:41 +00:00
|
|
|
|
2009-08-11 10:27:21 +00:00
|
|
|
if( ii < 0 )
|
|
|
|
return;
|
|
|
|
|
2013-11-29 18:29:41 +00:00
|
|
|
m_shapes3D_list.erase( m_shapes3D_list.begin() + ii );
|
|
|
|
m_3D_ShapeNameListBox->Delete( ii );
|
2009-08-11 10:27:21 +00:00
|
|
|
|
|
|
|
if( m_3D_ShapeNameListBox->GetCount() == 0)
|
|
|
|
Transfert3DValuesToDisplay( NULL );
|
|
|
|
else
|
|
|
|
{
|
2012-12-10 11:18:42 +00:00
|
|
|
m_lastSelected3DShapeIndex = 0;
|
2013-11-29 18:29:41 +00:00
|
|
|
m_3D_ShapeNameListBox->SetSelection( m_lastSelected3DShapeIndex );
|
2012-12-10 11:18:42 +00:00
|
|
|
Transfert3DValuesToDisplay( m_shapes3D_list[m_lastSelected3DShapeIndex] );
|
2009-08-11 10:27:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-03-01 11:25:08 +00:00
|
|
|
void DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DLib( wxCommandEvent& event )
|
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
|
|
|
PROJECT& prj = Prj();
|
|
|
|
SEARCH_STACK& search = Kiface().KifaceSearch();
|
|
|
|
|
|
|
|
wxString fullpath;
|
|
|
|
wxString kisys3dmod = wxGetenv( wxT( KISYS3DMOD ) );
|
|
|
|
|
|
|
|
if( !kisys3dmod || !wxFileName::IsDirReadable( kisys3dmod ) )
|
|
|
|
{
|
|
|
|
fullpath = search.FindValidPath( LIB3D_PATH );
|
|
|
|
}
|
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
|
|
|
if( !fullpath )
|
|
|
|
fullpath = prj.RPath(PROJECT::VIEWER_3D).LastVisitedPath( search, LIB3D_PATH );
|
2013-11-29 18:29:41 +00:00
|
|
|
|
2009-08-11 10:27:21 +00:00
|
|
|
#ifdef __WINDOWS__
|
|
|
|
fullpath.Replace( wxT( "/" ), wxT( "\\" ) );
|
|
|
|
#endif
|
2013-03-27 18:34:23 +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
|
|
|
wxString fullfilename, shortfilename;
|
|
|
|
wxString fileFilters = wxGetTranslation( Shapes3DFileWildcard );
|
|
|
|
|
2014-01-25 12:23:29 +00:00
|
|
|
fileFilters += wxChar( '|' );
|
|
|
|
fileFilters += wxGetTranslation( IDF3DFileWildcard );
|
|
|
|
|
2009-08-11 10:27:21 +00:00
|
|
|
fullfilename = EDA_FileSelector( _( "3D Shape:" ),
|
2009-11-14 22:15:22 +00:00
|
|
|
fullpath,
|
|
|
|
wxEmptyString,
|
2013-03-27 18:34:23 +00:00
|
|
|
wxEmptyString,
|
2014-01-25 12:23:29 +00:00
|
|
|
wxGetTranslation( fileFilters ),
|
2009-08-11 10:27:21 +00:00
|
|
|
this,
|
|
|
|
wxFD_OPEN,
|
2012-01-22 17:20:22 +00:00
|
|
|
true
|
2009-08-11 10:27:21 +00:00
|
|
|
);
|
|
|
|
|
2013-03-27 18:34:23 +00:00
|
|
|
if( fullfilename.IsEmpty() )
|
2009-08-11 10:27:21 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
wxFileName fn = fullfilename;
|
* 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
|
|
|
|
|
|
|
prj.RPath(PROJECT::VIEWER_3D).SaveLastVisitedPath( fn.GetPath() );
|
2009-08-11 10:27:21 +00:00
|
|
|
|
|
|
|
/* If the file path is already in the library search paths
|
|
|
|
* list, just add the library name to the list. Otherwise, add
|
|
|
|
* the library name with the full or relative path.
|
|
|
|
* the relative path, when possible is preferable,
|
|
|
|
* because it preserve use of default libraries paths, when the path is a sub path of these default paths
|
|
|
|
*/
|
* 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
|
|
|
shortfilename = search.FilenameWithRelativePathInSearchList( fullfilename );
|
2010-01-20 12:43:05 +00:00
|
|
|
|
|
|
|
wxFileName aux = shortfilename;
|
2013-11-29 18:29:41 +00:00
|
|
|
|
2010-01-20 12:43:05 +00:00
|
|
|
if( aux.IsAbsolute() )
|
|
|
|
{ // Absolute path, ask if the user wants a relative one
|
|
|
|
int diag = wxMessageBox(
|
|
|
|
_( "Use a relative path?" ),
|
|
|
|
_( "Path type" ),
|
|
|
|
wxYES_NO | wxICON_QUESTION, this );
|
|
|
|
|
|
|
|
if( diag == wxYES )
|
|
|
|
{ // Make it relative
|
2013-11-29 18:29:41 +00:00
|
|
|
aux.MakeRelativeTo( wxT( "." ) );
|
2010-01-20 12:43:05 +00:00
|
|
|
shortfilename = aux.GetPathWithSep() + aux.GetFullName();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-11 10:27:21 +00:00
|
|
|
S3D_MASTER* new3DShape = new S3D_MASTER(NULL);
|
2013-11-29 18:29:41 +00:00
|
|
|
|
2012-08-21 10:45:54 +00:00
|
|
|
#ifdef __WINDOWS__
|
|
|
|
// Store filename in Unix notation
|
|
|
|
shortfilename.Replace( wxT( "\\" ), wxT( "/" ) );
|
|
|
|
#endif
|
|
|
|
|
2014-01-25 12:23:29 +00:00
|
|
|
new3DShape->SetShape3DName( shortfilename );
|
2012-12-10 11:18:42 +00:00
|
|
|
m_shapes3D_list.push_back( new3DShape );
|
2009-08-11 10:27:21 +00:00
|
|
|
m_3D_ShapeNameListBox->Append( shortfilename );
|
|
|
|
|
2012-12-10 11:18:42 +00:00
|
|
|
if( m_lastSelected3DShapeIndex >= 0 )
|
|
|
|
TransfertDisplayTo3DValues( m_lastSelected3DShapeIndex );
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2012-12-10 11:18:42 +00:00
|
|
|
m_lastSelected3DShapeIndex = m_3D_ShapeNameListBox->GetCount() - 1;
|
2013-11-29 18:29:41 +00:00
|
|
|
m_3D_ShapeNameListBox->SetSelection( m_lastSelected3DShapeIndex );
|
2012-12-10 11:18:42 +00:00
|
|
|
Transfert3DValuesToDisplay( m_shapes3D_list[m_lastSelected3DShapeIndex] );
|
2009-08-11 10:27:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-21 15:13:09 +00:00
|
|
|
void DIALOG_MODULE_MODULE_EDITOR::OnCancelClick( wxCommandEvent& event )
|
2009-08-11 10:27:21 +00:00
|
|
|
{
|
|
|
|
EndModal( -1 );
|
|
|
|
}
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
|
2009-08-11 10:27:21 +00:00
|
|
|
void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event )
|
|
|
|
{
|
2012-12-10 11:18:42 +00:00
|
|
|
// First, test for invalid chars in module name
|
|
|
|
wxString footprintName = m_FootprintNameCtrl->GetValue();
|
2013-11-29 18:29:41 +00:00
|
|
|
|
2012-12-10 11:18:42 +00:00
|
|
|
if( ! footprintName.IsEmpty() )
|
|
|
|
{
|
|
|
|
if( ! MODULE::IsLibNameValid( footprintName ) )
|
|
|
|
{
|
|
|
|
wxString msg;
|
2013-11-29 18:29:41 +00:00
|
|
|
msg.Printf( _( "Error:\none of invalid chars <%s> found\nin <%s>" ),
|
* 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
|
|
|
MODULE::StringLibNameInvalidChars( true ),
|
2012-12-10 11:18:42 +00:00
|
|
|
GetChars( footprintName ) );
|
|
|
|
|
|
|
|
DisplayError( NULL, msg );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_parent->SaveCopyInUndoList( m_currentModule, UR_MODEDIT );
|
2013-03-13 18:53:58 +00:00
|
|
|
m_currentModule->SetLocked( 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() );
|
|
|
|
m_currentModule->SetDescription( m_DocCtrl->GetValue() );
|
|
|
|
m_currentModule->SetKeywords( m_KeywordCtrl->GetValue() );
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2010-05-16 14:05:04 +00:00
|
|
|
// Init footprint name in library
|
2012-12-10 11:18:42 +00:00
|
|
|
if( ! footprintName.IsEmpty() )
|
2013-09-08 18:31:21 +00:00
|
|
|
m_currentModule->SetFPID( FPID( footprintName ) );
|
2010-05-16 14:05:04 +00:00
|
|
|
|
2009-08-11 10:27:21 +00:00
|
|
|
// Init Fields:
|
2013-03-13 18:53:58 +00:00
|
|
|
m_currentModule->Reference().Copy( m_referenceCopy );
|
|
|
|
m_currentModule->Value().Copy( m_valueCopy );
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2009-11-04 19:08:08 +00:00
|
|
|
// Initialize masks clearances
|
* 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->SetLocalClearance( ValueFromTextCtrl( *m_NetClearanceValueCtrl ) );
|
|
|
|
m_currentModule->SetLocalSolderMaskMargin( ValueFromTextCtrl( *m_SolderMaskMarginCtrl ) );
|
|
|
|
m_currentModule->SetLocalSolderPasteMargin( ValueFromTextCtrl( *m_SolderPasteMarginCtrl ) );
|
2009-11-04 19:08:08 +00:00
|
|
|
double dtmp;
|
|
|
|
wxString msg = m_SolderPasteMarginRatioCtrl->GetValue();
|
|
|
|
msg.ToDouble( &dtmp );
|
2012-02-19 04:02:19 +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;
|
2013-11-29 18:29:41 +00:00
|
|
|
|
2012-05-18 08:33:57 +00:00
|
|
|
// A margin ratio is always <= 0
|
|
|
|
if( dtmp > 0.0 )
|
|
|
|
dtmp = 0.0;
|
2009-11-04 19:08:08 +00:00
|
|
|
|
2012-12-10 11:18:42 +00:00
|
|
|
m_currentModule->SetLocalSolderPasteMarginRatio( dtmp / 100 );
|
2012-02-19 04:02:19 +00:00
|
|
|
|
|
|
|
// Update 3D shape list
|
2009-08-11 10:27:21 +00:00
|
|
|
int ii = m_3D_ShapeNameListBox->GetSelection();
|
2013-11-29 18:29:41 +00:00
|
|
|
|
2009-08-11 10:27:21 +00:00
|
|
|
if ( ii >= 0 )
|
2013-11-29 18:29:41 +00:00
|
|
|
TransfertDisplayTo3DValues( ii );
|
|
|
|
|
2013-03-18 19:36:07 +00:00
|
|
|
S3D_MASTER* draw3D = m_currentModule->Models();
|
2013-11-29 18:29:41 +00:00
|
|
|
|
2012-12-10 11:18:42 +00:00
|
|
|
for( unsigned ii = 0; ii < m_shapes3D_list.size(); ii++ )
|
2009-08-11 10:27:21 +00:00
|
|
|
{
|
2012-12-10 11:18:42 +00:00
|
|
|
S3D_MASTER* draw3DCopy = m_shapes3D_list[ii];
|
2013-11-29 18:29:41 +00:00
|
|
|
|
2014-01-25 12:23:29 +00:00
|
|
|
if( draw3DCopy->GetShape3DName().IsEmpty() )
|
2009-08-11 10:27:21 +00:00
|
|
|
continue;
|
2013-11-29 18:29:41 +00:00
|
|
|
|
2009-08-11 10:27:21 +00:00
|
|
|
if( draw3D == NULL )
|
|
|
|
{
|
|
|
|
draw3D = new S3D_MASTER( draw3D );
|
2013-03-18 19:36:07 +00:00
|
|
|
m_currentModule->Models().Append( draw3D );
|
2009-08-11 10:27:21 +00:00
|
|
|
}
|
|
|
|
|
2014-01-25 12:23:29 +00:00
|
|
|
draw3D->SetShape3DName( draw3DCopy->GetShape3DName() );
|
2009-08-11 10:27:21 +00:00
|
|
|
draw3D->m_MatScale = draw3DCopy->m_MatScale;
|
|
|
|
draw3D->m_MatRotation = draw3DCopy->m_MatRotation;
|
|
|
|
draw3D->m_MatPosition = draw3DCopy->m_MatPosition;
|
|
|
|
|
|
|
|
draw3D = draw3D->Next();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Remove old extra 3D shapes
|
|
|
|
S3D_MASTER* nextdraw3D;
|
2013-11-29 18:29:41 +00:00
|
|
|
|
2009-08-11 10:27:21 +00:00
|
|
|
for( ; draw3D != NULL; draw3D = nextdraw3D )
|
|
|
|
{
|
|
|
|
nextdraw3D = (S3D_MASTER*) draw3D->Next();
|
2013-03-18 19:36:07 +00:00
|
|
|
delete m_currentModule->Models().Remove( draw3D );
|
2009-08-11 10:27:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Fill shape list with one void entry, if no entry
|
2013-03-18 19:36:07 +00:00
|
|
|
if( m_currentModule->Models() == NULL )
|
|
|
|
m_currentModule->Models().PushBack( new S3D_MASTER( m_currentModule ) );
|
2009-08-11 10:27:21 +00:00
|
|
|
|
|
|
|
|
2012-12-10 11:18:42 +00:00
|
|
|
m_currentModule->CalculateBoundingBox();
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2012-12-10 11:18:42 +00:00
|
|
|
m_parent->OnModify();
|
2009-08-11 10:27:21 +00:00
|
|
|
|
|
|
|
EndModal( 1 );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DIALOG_MODULE_MODULE_EDITOR::OnEditReference(wxCommandEvent& event)
|
|
|
|
{
|
2013-08-03 05:15:23 +00:00
|
|
|
wxPoint tmp = m_parent->GetCrossHairPosition();
|
|
|
|
m_parent->SetCrossHairPosition( m_referenceCopy->GetTextPosition() );
|
2012-12-10 11:18:42 +00:00
|
|
|
m_parent->InstallTextModOptionsFrame( m_referenceCopy, NULL );
|
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
|
|
|
}
|
|
|
|
|
2013-08-03 05:15:23 +00:00
|
|
|
|
2009-08-11 10:27:21 +00:00
|
|
|
void DIALOG_MODULE_MODULE_EDITOR::OnEditValue(wxCommandEvent& event)
|
|
|
|
{
|
2013-08-03 05:15:23 +00:00
|
|
|
wxPoint tmp = m_parent->GetCrossHairPosition();
|
|
|
|
m_parent->SetCrossHairPosition( m_valueCopy->GetTextPosition() );
|
2012-12-10 11:18:42 +00:00
|
|
|
m_parent->InstallTextModOptionsFrame( m_valueCopy, NULL );
|
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
|
|
|
}
|