2011-08-05 19:53:42 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2011 jean-pierre.charras
|
2021-07-18 14:06:48 +00:00
|
|
|
* Copyright (C) 1992-2021 Kicad Developers, see AUTHORS.txt for contributors.
|
2011-08-05 19:53:42 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
2019-05-01 18:57:59 +00:00
|
|
|
* as published by the Free Software Foundation; either version 3
|
2011-08-05 19:53:42 +00:00
|
|
|
* 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.
|
|
|
|
*
|
2019-05-01 18:57:59 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
2011-08-05 19:53:42 +00:00
|
|
|
*/
|
2021-06-07 22:26:55 +00:00
|
|
|
#include <wx/choicdlg.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <wx/filename.h>
|
2020-08-07 00:09:33 +00:00
|
|
|
#include <wx/settings.h>
|
2011-08-05 19:53:42 +00:00
|
|
|
|
2021-05-04 02:27:54 +00:00
|
|
|
#include <bitmaps.h>
|
2021-10-08 14:44:44 +00:00
|
|
|
#include <calculator_panels/panel_transline.h>
|
|
|
|
#include <common_data.h>
|
2021-10-05 15:32:31 +00:00
|
|
|
#include <widgets/unit_selector.h>
|
2021-02-11 23:43:08 +00:00
|
|
|
|
2011-08-05 19:53:42 +00:00
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
extern double DoubleFromString( const wxString& TextValue );
|
2011-08-05 19:53:42 +00:00
|
|
|
|
|
|
|
|
2019-11-04 11:59:22 +00:00
|
|
|
// Display a selection of usual Er, TanD, Rho values
|
|
|
|
// List format is <value><space><comment>
|
2011-08-05 19:53:42 +00:00
|
|
|
|
|
|
|
|
2019-11-04 10:01:53 +00:00
|
|
|
// A helper function to find the choice in a list of values
|
|
|
|
// return true if a index in aList that matches aValue is found.
|
2021-07-18 14:06:48 +00:00
|
|
|
static bool findMatch( wxArrayString& aList, const wxString& aValue, int& aIdx )
|
2019-11-04 10:01:53 +00:00
|
|
|
{
|
|
|
|
bool success = false;
|
|
|
|
// Find the previous choice index:
|
|
|
|
aIdx = 0;
|
|
|
|
|
|
|
|
// Some countries use comma instead of point as separator.
|
2019-11-04 11:59:22 +00:00
|
|
|
// The value can be enter with pint or comma
|
|
|
|
// use point for string comparisons:
|
2019-11-04 10:01:53 +00:00
|
|
|
wxString cvalue = aValue;
|
|
|
|
cvalue.Replace( ',', '.' );
|
|
|
|
|
|
|
|
// First compare strings:
|
|
|
|
for( wxString& text: aList )
|
|
|
|
{
|
|
|
|
if( text.IsEmpty() ) // No match found: select the empty line choice
|
|
|
|
break;
|
|
|
|
|
|
|
|
wxString val_str = text.BeforeFirst( ' ' );
|
|
|
|
val_str.Replace( ',', '.' );
|
|
|
|
|
|
|
|
// compare string values
|
|
|
|
if( val_str == cvalue )
|
|
|
|
{
|
|
|
|
success = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
aIdx++;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Due to multiple ways to write a double, if string values
|
|
|
|
// do not match, compare double values
|
|
|
|
if( !success )
|
|
|
|
{
|
2019-11-04 11:59:22 +00:00
|
|
|
struct lconv* lc = localeconv();
|
|
|
|
char localeDecimalSeparator = *lc->decimal_point;
|
|
|
|
|
|
|
|
if( localeDecimalSeparator == ',' )
|
|
|
|
cvalue.Replace( '.', ',' );
|
|
|
|
|
|
|
|
double curr_value;
|
|
|
|
cvalue.ToDouble( &curr_value );
|
|
|
|
|
2019-11-04 10:01:53 +00:00
|
|
|
aIdx = 0;
|
|
|
|
|
|
|
|
for( wxString& text: aList )
|
|
|
|
{
|
|
|
|
if( text.IsEmpty() ) // No match found: select the empty line choice
|
|
|
|
break;
|
|
|
|
|
|
|
|
double val;
|
2019-11-04 11:59:22 +00:00
|
|
|
wxString val_str = text.BeforeFirst( ' ' );
|
|
|
|
|
|
|
|
if( localeDecimalSeparator == ',' )
|
|
|
|
val_str.Replace( '.', ',' );
|
|
|
|
|
|
|
|
val_str.ToDouble( &val );;
|
2019-11-04 10:01:53 +00:00
|
|
|
|
|
|
|
if( curr_value == val )
|
|
|
|
{
|
|
|
|
success = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
aIdx++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2021-02-11 23:43:08 +00:00
|
|
|
|
2021-10-05 15:32:31 +00:00
|
|
|
void PANEL_TRANSLINE::OnTranslineEpsilonR_Button( wxCommandEvent& event )
|
2011-08-05 19:53:42 +00:00
|
|
|
{
|
2019-11-02 08:27:50 +00:00
|
|
|
wxArrayString list = StandardRelativeDielectricConstantList();
|
2019-11-04 10:01:53 +00:00
|
|
|
list.Add( "" ); // Add an empty line for no selection
|
|
|
|
|
|
|
|
// Find the previous choice index:
|
|
|
|
wxString prevChoiceStr = m_Value_EpsilonR->GetValue();
|
|
|
|
int prevChoice = 0;
|
|
|
|
findMatch( list, prevChoiceStr, prevChoice );
|
|
|
|
|
2021-02-11 23:43:08 +00:00
|
|
|
int index = wxGetSingleChoiceIndex( wxEmptyString, _( "Relative Dielectric Constants" ),
|
2019-11-04 10:01:53 +00:00
|
|
|
list, prevChoice );
|
|
|
|
|
|
|
|
if( index >= 0 && !list.Item( index ).IsEmpty() ) // i.e. non canceled.
|
2019-11-02 08:27:50 +00:00
|
|
|
m_Value_EpsilonR->SetValue( list.Item( index ).BeforeFirst( ' ' ) );
|
2011-08-05 19:53:42 +00:00
|
|
|
}
|
|
|
|
|
2021-02-11 23:43:08 +00:00
|
|
|
|
2021-10-05 15:32:31 +00:00
|
|
|
void PANEL_TRANSLINE::OnTranslineTanD_Button( wxCommandEvent& event )
|
2011-08-05 19:53:42 +00:00
|
|
|
{
|
2019-11-02 08:27:50 +00:00
|
|
|
wxArrayString list = StandardLossTangentList();
|
2019-11-04 10:01:53 +00:00
|
|
|
list.Add( "" ); // Add an empty line for no selection
|
|
|
|
|
|
|
|
// Find the previous choice index:
|
|
|
|
wxString prevChoiceStr = m_Value_TanD->GetValue();
|
|
|
|
int prevChoice = 0;
|
|
|
|
findMatch( list, prevChoiceStr, prevChoice );
|
|
|
|
|
2021-02-11 23:43:08 +00:00
|
|
|
int index = wxGetSingleChoiceIndex( wxEmptyString, _( "Dielectric Loss Factor" ), list,
|
2021-07-18 14:06:48 +00:00
|
|
|
prevChoice, nullptr );
|
2019-11-04 10:01:53 +00:00
|
|
|
|
|
|
|
if( index >= 0 && !list.Item( index ).IsEmpty() ) // i.e. non canceled.
|
2019-11-02 08:27:50 +00:00
|
|
|
m_Value_TanD->SetValue( list.Item( index ).BeforeFirst( ' ' ) );
|
2011-08-05 19:53:42 +00:00
|
|
|
}
|
|
|
|
|
2021-02-11 23:43:08 +00:00
|
|
|
|
2021-10-05 15:32:31 +00:00
|
|
|
void PANEL_TRANSLINE::OnTranslineRho_Button( wxCommandEvent& event )
|
2011-08-05 19:53:42 +00:00
|
|
|
{
|
2019-11-02 08:27:50 +00:00
|
|
|
wxArrayString list = StandardResistivityList();
|
2019-11-04 10:01:53 +00:00
|
|
|
list.Add( "" ); // Add an empty line for no selection
|
|
|
|
|
|
|
|
// Find the previous choice index:
|
|
|
|
wxString prevChoiceStr = m_Value_Rho->GetValue();
|
|
|
|
int prevChoice = 0;
|
|
|
|
findMatch( list, prevChoiceStr, prevChoice );
|
|
|
|
|
2021-02-11 23:43:08 +00:00
|
|
|
int index = wxGetSingleChoiceIndex( wxEmptyString, _( "Specific Resistance" ), list,
|
2021-07-18 14:06:48 +00:00
|
|
|
prevChoice, nullptr );
|
2019-11-04 10:01:53 +00:00
|
|
|
|
|
|
|
if( index >= 0 && !list.Item( index ).IsEmpty() ) // i.e. non canceled.
|
2019-11-02 08:27:50 +00:00
|
|
|
m_Value_Rho->SetValue( list.Item( index ).BeforeFirst( ' ' ) );
|
2011-08-05 19:53:42 +00:00
|
|
|
}
|
|
|
|
|
2021-02-11 23:43:08 +00:00
|
|
|
|
2011-08-05 19:53:42 +00:00
|
|
|
// Minor helper struct to handle dialog items for a given parameter
|
|
|
|
struct DLG_PRM_DATA
|
|
|
|
{
|
2021-02-11 23:43:08 +00:00
|
|
|
wxStaticText* name;
|
|
|
|
wxTextCtrl* value;
|
|
|
|
UNIT_SELECTOR* unit;
|
2011-08-05 19:53:42 +00:00
|
|
|
};
|
2021-02-11 23:43:08 +00:00
|
|
|
|
|
|
|
|
2021-10-05 15:32:31 +00:00
|
|
|
void PANEL_TRANSLINE::TranslineTypeSelection( enum TRANSLINE_TYPE_ID aType )
|
2011-08-05 19:53:42 +00:00
|
|
|
{
|
|
|
|
m_currTransLineType = aType;
|
|
|
|
|
2014-03-22 08:28:39 +00:00
|
|
|
if( (m_currTransLineType < START_OF_LIST_TYPE )
|
2021-02-11 23:43:08 +00:00
|
|
|
|| ( m_currTransLineType >= END_OF_LIST_TYPE ) )
|
|
|
|
{
|
2014-03-22 08:28:39 +00:00
|
|
|
m_currTransLineType = DEFAULT_TYPE;
|
2021-02-11 23:43:08 +00:00
|
|
|
}
|
|
|
|
|
2021-10-08 16:30:36 +00:00
|
|
|
m_translineBitmap->SetBitmap( KiBitmap( m_transline_list[m_currTransLineType]->m_BitmapName ) );
|
2011-08-05 19:53:42 +00:00
|
|
|
|
2015-08-09 09:03:25 +00:00
|
|
|
// This helper bitmap is shown for coupled microstrip only:
|
|
|
|
m_bmCMicrostripZoddZeven->Show( aType == C_MICROSTRIP_TYPE );
|
2021-05-04 02:27:54 +00:00
|
|
|
m_bmCMicrostripZoddZeven->SetBitmap( KiBitmap( BITMAPS::microstrip_zodd_zeven ) );
|
2015-08-09 09:03:25 +00:00
|
|
|
|
2011-08-05 19:53:42 +00:00
|
|
|
TRANSLINE_IDENT* tr_ident = m_transline_list[m_currTransLineType];
|
|
|
|
m_currTransLine = tr_ident->m_TLine;
|
|
|
|
|
|
|
|
m_radioBtnPrm1->Show( tr_ident->m_HasPrmSelection );
|
|
|
|
m_radioBtnPrm2->Show( tr_ident->m_HasPrmSelection );
|
|
|
|
|
|
|
|
// Setup messages
|
|
|
|
wxStaticText* left_msg_list[] =
|
|
|
|
{
|
2021-02-15 15:59:19 +00:00
|
|
|
m_left_message1, m_left_message2, m_left_message3, m_left_message4, m_left_message5,
|
2021-09-12 01:40:27 +00:00
|
|
|
m_left_message6, m_left_message7, m_left_message8, nullptr
|
2011-08-05 19:53:42 +00:00
|
|
|
};
|
2021-07-18 14:06:48 +00:00
|
|
|
|
2011-08-05 19:53:42 +00:00
|
|
|
wxStaticText* msg_list[] =
|
|
|
|
{
|
2021-09-12 01:40:27 +00:00
|
|
|
m_Message1, m_Message2, m_Message3, m_Message4, m_Message5, m_Message6, m_Message7, m_Message8, nullptr
|
2011-08-05 19:53:42 +00:00
|
|
|
};
|
|
|
|
|
2016-04-16 09:57:42 +00:00
|
|
|
unsigned jj = 0;
|
2021-07-18 14:06:48 +00:00
|
|
|
|
2016-04-16 09:57:42 +00:00
|
|
|
for( ; jj < tr_ident->m_Messages.GetCount(); jj++ )
|
2011-08-05 19:53:42 +00:00
|
|
|
{
|
2021-07-18 14:06:48 +00:00
|
|
|
if( left_msg_list[jj] == nullptr )
|
2011-08-05 19:53:42 +00:00
|
|
|
break;
|
2021-02-15 15:59:19 +00:00
|
|
|
|
2016-04-16 09:57:42 +00:00
|
|
|
left_msg_list[jj]->SetLabel( tr_ident->m_Messages[jj] );
|
|
|
|
msg_list[jj]->SetLabel( wxEmptyString );
|
2011-08-05 19:53:42 +00:00
|
|
|
}
|
|
|
|
|
2016-04-16 09:57:42 +00:00
|
|
|
while( left_msg_list[jj] )
|
2011-08-05 19:53:42 +00:00
|
|
|
{
|
2016-04-16 09:57:42 +00:00
|
|
|
left_msg_list[jj]->SetLabel( wxEmptyString );
|
|
|
|
msg_list[jj]->SetLabel( wxEmptyString );
|
|
|
|
jj++;
|
2011-08-05 19:53:42 +00:00
|
|
|
}
|
|
|
|
|
2021-02-15 15:59:19 +00:00
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
// Init parameters dialog items
|
2011-08-05 19:53:42 +00:00
|
|
|
struct DLG_PRM_DATA substrateprms[] =
|
2021-02-15 15:59:19 +00:00
|
|
|
{
|
2021-07-18 14:06:48 +00:00
|
|
|
{ m_EpsilonR_label, m_Value_EpsilonR, nullptr },
|
|
|
|
{ m_TanD_label, m_Value_TanD, nullptr },
|
|
|
|
{ m_Rho_label, m_Value_Rho, nullptr },
|
2021-02-15 15:59:19 +00:00
|
|
|
{ m_substrate_prm4_label, m_Substrate_prm4_Value, m_SubsPrm4_choiceUnit },
|
|
|
|
{ m_substrate_prm5_label, m_Substrate_prm5_Value, m_SubsPrm5_choiceUnit },
|
|
|
|
{ m_substrate_prm6_label, m_Substrate_prm6_Value, m_SubsPrm6_choiceUnit },
|
|
|
|
{ m_substrate_prm7_label, m_Substrate_prm7_Value, m_SubsPrm7_choiceUnit },
|
|
|
|
{ m_substrate_prm8_label, m_Substrate_prm8_Value, m_SubsPrm8_choiceUnit },
|
|
|
|
{ m_substrate_prm9_label, m_Substrate_prm9_Value, m_SubsPrm9_choiceUnit }
|
|
|
|
};
|
2021-07-18 14:06:48 +00:00
|
|
|
|
|
|
|
#define substrateprms_cnt (sizeof(substrateprms)/sizeof(substrateprms[0]))
|
2011-08-05 19:53:42 +00:00
|
|
|
|
|
|
|
struct DLG_PRM_DATA physprms[] =
|
2021-02-15 15:59:19 +00:00
|
|
|
{
|
|
|
|
{ m_phys_prm1_label, m_Phys_prm1_Value, m_choiceUnit_Param1 },
|
|
|
|
{ m_phys_prm2_label, m_Phys_prm2_Value, m_choiceUnit_Param2 },
|
|
|
|
{ m_phys_prm3_label, m_Phys_prm3_Value, m_choiceUnit_Param3 }
|
|
|
|
};
|
2021-07-18 14:06:48 +00:00
|
|
|
|
|
|
|
#define physprms_cnt (sizeof(physprms)/sizeof(physprms[0]))
|
2011-08-05 19:53:42 +00:00
|
|
|
|
|
|
|
struct DLG_PRM_DATA elecprms[] =
|
2021-02-15 15:59:19 +00:00
|
|
|
{
|
|
|
|
{ m_elec_prm1_label, m_Elec_prm1_Value, m_choiceUnit_ElecPrm1 },
|
|
|
|
{ m_elec_prm2_label, m_Elec_prm2_Value, m_choiceUnit_ElecPrm2 },
|
|
|
|
{ m_elec_prm3_label, m_Elec_prm3_Value, m_choiceUnit_ElecPrm3 }
|
|
|
|
};
|
2021-07-18 14:06:48 +00:00
|
|
|
|
|
|
|
#define elecprms_cnt (sizeof(elecprms)/sizeof(elecprms[0]))
|
2011-08-05 19:53:42 +00:00
|
|
|
|
|
|
|
struct DLG_PRM_DATA frequencyprms[] =
|
|
|
|
{
|
|
|
|
{ m_Frequency_label,m_Value_Frequency_Ctrl, m_choiceUnit_Frequency }
|
|
|
|
};
|
2021-07-18 14:06:48 +00:00
|
|
|
|
|
|
|
#define frequencyprms_cnt (sizeof(frequencyprms)/sizeof(frequencyprms[0]))
|
2011-08-05 19:53:42 +00:00
|
|
|
|
|
|
|
unsigned idxsubs = 0;
|
|
|
|
unsigned idxphys = 0;
|
|
|
|
unsigned idxelec = 0;
|
|
|
|
unsigned idxfreq = 0;
|
|
|
|
|
|
|
|
for( unsigned ii = 0; ii < tr_ident->GetPrmsCount(); ii++ )
|
|
|
|
{
|
|
|
|
TRANSLINE_PRM* prm = tr_ident->GetPrm( ii );
|
2021-07-18 14:06:48 +00:00
|
|
|
struct DLG_PRM_DATA * data = nullptr;
|
|
|
|
|
2011-08-05 19:53:42 +00:00
|
|
|
switch( prm->m_Type )
|
|
|
|
{
|
2021-02-11 23:43:08 +00:00
|
|
|
case PRM_TYPE_SUBS:
|
|
|
|
wxASSERT( idxsubs < substrateprms_cnt );
|
|
|
|
data = &substrateprms[idxsubs];
|
|
|
|
idxsubs++;
|
|
|
|
break;
|
2011-08-05 19:53:42 +00:00
|
|
|
|
2021-02-11 23:43:08 +00:00
|
|
|
case PRM_TYPE_PHYS:
|
|
|
|
wxASSERT( idxphys < physprms_cnt );
|
|
|
|
data = &physprms[idxphys];
|
|
|
|
idxphys++;
|
|
|
|
break;
|
2011-08-05 19:53:42 +00:00
|
|
|
|
2021-02-11 23:43:08 +00:00
|
|
|
case PRM_TYPE_ELEC:
|
|
|
|
wxASSERT( idxelec < elecprms_cnt );
|
|
|
|
data = &elecprms[idxelec];
|
|
|
|
idxelec++;
|
|
|
|
break;
|
2011-08-05 19:53:42 +00:00
|
|
|
|
2021-02-11 23:43:08 +00:00
|
|
|
case PRM_TYPE_FREQUENCY:
|
|
|
|
wxASSERT( idxfreq < frequencyprms_cnt );
|
|
|
|
data = &frequencyprms[idxfreq];
|
|
|
|
idxfreq++;
|
|
|
|
break;
|
2011-08-05 19:53:42 +00:00
|
|
|
}
|
2021-02-11 23:43:08 +00:00
|
|
|
|
2011-08-05 19:53:42 +00:00
|
|
|
wxASSERT ( data );
|
|
|
|
data->name->SetToolTip( prm->m_ToolTip );
|
2020-08-24 11:35:38 +00:00
|
|
|
data->name->SetLabel( prm->m_DlgLabel != "" ? prm->m_DlgLabel + ':' : "" );
|
2011-08-05 19:53:42 +00:00
|
|
|
prm->m_ValueCtrl = data->value;
|
2020-08-24 11:35:38 +00:00
|
|
|
|
2011-08-05 19:53:42 +00:00
|
|
|
if( prm->m_Id != DUMMY_PRM )
|
|
|
|
{
|
2021-02-11 23:43:08 +00:00
|
|
|
data->value->SetValue( wxString::Format( "%g", prm->m_Value ) );
|
2011-08-05 19:53:42 +00:00
|
|
|
data->value->Enable( true );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
data->value->SetValue( wxEmptyString );
|
|
|
|
data->value->Enable( false );
|
|
|
|
}
|
2020-08-24 11:35:38 +00:00
|
|
|
|
2011-08-05 19:53:42 +00:00
|
|
|
if( prm->m_ConvUnit )
|
|
|
|
prm->m_UnitCtrl = data->unit;
|
2020-08-24 11:35:38 +00:00
|
|
|
|
2011-08-05 19:53:42 +00:00
|
|
|
if( data->unit )
|
|
|
|
{
|
|
|
|
data->unit->Show( prm->m_ConvUnit );
|
|
|
|
data->unit->Enable( prm->m_ConvUnit );
|
|
|
|
data->unit->SetSelection( prm->m_UnitSelection );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Clear all unused params
|
|
|
|
for( ; idxsubs < substrateprms_cnt; idxsubs++ )
|
|
|
|
{
|
|
|
|
substrateprms[idxsubs].name->SetLabel(wxEmptyString);
|
|
|
|
substrateprms[idxsubs].name->SetToolTip(wxEmptyString);
|
|
|
|
substrateprms[idxsubs].value->SetValue(wxEmptyString);
|
|
|
|
substrateprms[idxsubs].value->Enable( false );
|
2021-02-11 23:43:08 +00:00
|
|
|
|
2011-08-05 19:53:42 +00:00
|
|
|
if( substrateprms[idxsubs].unit)
|
|
|
|
{
|
|
|
|
substrateprms[idxsubs].unit->Show( false );
|
|
|
|
substrateprms[idxsubs].unit->Enable( false );
|
|
|
|
substrateprms[idxsubs].unit->SetSelection( 0 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for( ; idxphys < physprms_cnt; idxphys++ )
|
|
|
|
{
|
|
|
|
physprms[idxphys].name->SetLabel(wxEmptyString);
|
|
|
|
physprms[idxphys].name->SetToolTip(wxEmptyString);
|
|
|
|
physprms[idxphys].value->SetValue(wxEmptyString);
|
|
|
|
physprms[idxphys].value->Enable( false );
|
2021-02-11 23:43:08 +00:00
|
|
|
|
2011-08-05 19:53:42 +00:00
|
|
|
if( physprms[idxphys].unit)
|
|
|
|
{
|
|
|
|
physprms[idxphys].unit->Show( false );
|
|
|
|
physprms[idxphys].unit->Enable( false );
|
|
|
|
physprms[idxphys].unit->SetSelection( 0 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for( ; idxelec < elecprms_cnt; idxelec++)
|
|
|
|
{
|
|
|
|
elecprms[idxelec].name->SetLabel(wxEmptyString);
|
|
|
|
elecprms[idxelec].name->SetToolTip(wxEmptyString);
|
|
|
|
elecprms[idxelec].value->SetValue(wxEmptyString);
|
|
|
|
elecprms[idxelec].value->Enable( false );
|
2021-02-11 23:43:08 +00:00
|
|
|
|
2011-08-05 19:53:42 +00:00
|
|
|
if( elecprms[idxelec].unit)
|
|
|
|
{
|
|
|
|
elecprms[idxelec].unit->Show( false );
|
|
|
|
elecprms[idxelec].unit->Enable( false );
|
|
|
|
elecprms[idxelec].unit->SetSelection( 0 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for( ; idxfreq < frequencyprms_cnt; idxfreq++ )
|
|
|
|
{
|
|
|
|
frequencyprms[idxfreq].name->SetLabel(wxEmptyString);
|
|
|
|
frequencyprms[idxfreq].name->SetToolTip(wxEmptyString);
|
|
|
|
frequencyprms[idxfreq].value->SetValue(wxEmptyString);
|
|
|
|
frequencyprms[idxfreq].value->Enable( false );
|
2021-02-11 23:43:08 +00:00
|
|
|
|
2011-08-05 19:53:42 +00:00
|
|
|
if( frequencyprms[idxfreq].unit )
|
|
|
|
{
|
|
|
|
frequencyprms[idxfreq].unit->Show( false );
|
|
|
|
frequencyprms[idxfreq].unit->Enable( false );
|
|
|
|
frequencyprms[idxfreq].unit->SetSelection( 0 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
|
2021-10-05 15:32:31 +00:00
|
|
|
void PANEL_TRANSLINE::TransfDlgDataToTranslineParams()
|
2011-08-05 19:53:42 +00:00
|
|
|
{
|
|
|
|
TRANSLINE_IDENT* tr_ident = m_transline_list[m_currTransLineType];
|
2021-02-11 23:43:08 +00:00
|
|
|
|
2011-08-05 19:53:42 +00:00
|
|
|
for( unsigned ii = 0; ii < tr_ident->GetPrmsCount(); ii++ )
|
|
|
|
{
|
|
|
|
TRANSLINE_PRM* prm = tr_ident->GetPrm( ii );
|
|
|
|
wxTextCtrl * value_ctrl = (wxTextCtrl * ) prm->m_ValueCtrl;
|
|
|
|
wxString value_txt = value_ctrl->GetValue();
|
* 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
|
|
|
double value = DoubleFromString(value_txt);
|
2011-08-05 19:53:42 +00:00
|
|
|
prm->m_Value = value;
|
|
|
|
UNIT_SELECTOR * unit_ctrl = (UNIT_SELECTOR * ) prm->m_UnitCtrl;
|
2021-02-11 23:43:08 +00:00
|
|
|
|
2011-08-05 19:53:42 +00:00
|
|
|
if( unit_ctrl )
|
|
|
|
{
|
|
|
|
prm->m_UnitSelection = unit_ctrl->GetSelection();
|
|
|
|
value *= unit_ctrl->GetUnitScale();
|
|
|
|
}
|
2021-02-11 23:43:08 +00:00
|
|
|
|
2011-08-05 19:53:42 +00:00
|
|
|
prm->m_NormalizedValue = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-10-05 15:32:31 +00:00
|
|
|
void PANEL_TRANSLINE::OnTranslineSelection( wxCommandEvent& event )
|
2011-08-05 19:53:42 +00:00
|
|
|
{
|
2014-03-22 08:28:39 +00:00
|
|
|
enum TRANSLINE_TYPE_ID id = (enum TRANSLINE_TYPE_ID) event.GetSelection();
|
2011-08-05 19:53:42 +00:00
|
|
|
|
|
|
|
TranslineTypeSelection( id );
|
|
|
|
|
|
|
|
// Texts and units choice widgets can have their size modified:
|
|
|
|
// The new size must be taken in account
|
2021-10-05 15:32:31 +00:00
|
|
|
GetSizer()->Layout();
|
|
|
|
Refresh();
|
2011-08-05 19:53:42 +00:00
|
|
|
}
|
|
|
|
|
2019-11-02 08:27:50 +00:00
|
|
|
|
2021-10-05 15:32:31 +00:00
|
|
|
void PANEL_TRANSLINE::OnTransLineResetButtonClick( wxCommandEvent& event )
|
2019-11-10 09:36:26 +00:00
|
|
|
{
|
|
|
|
TranslineTypeSelection( DEFAULT_TYPE );
|
|
|
|
m_TranslineSelection->SetSelection( DEFAULT_TYPE );
|
|
|
|
|
2021-10-05 15:32:31 +00:00
|
|
|
GetSizer()->Layout();
|
|
|
|
Refresh();
|
2019-11-10 09:36:26 +00:00
|
|
|
}
|