pcb_calculaotr: Change attenuators to only have image name instead of the image
Otherwise regenerating the bitmap for light/dark changes would be more difficult.
This commit is contained in:
parent
4d6b1a4e36
commit
79a1eff988
|
@ -32,11 +32,6 @@ wxString splitter_formula =
|
|||
#include "attenuators/splitter_formula.h"
|
||||
|
||||
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL 0
|
||||
#endif
|
||||
|
||||
ATTENUATOR::ATTENUATOR( ATTENUATORS_TYPE aTopology )
|
||||
{
|
||||
m_Name = wxT("att_base");
|
||||
|
@ -49,8 +44,8 @@ ATTENUATOR::ATTENUATOR( ATTENUATORS_TYPE aTopology )
|
|||
m_Attenuation = 6.0; // dB
|
||||
m_Attenuation_Enable = true;
|
||||
m_MinimumATT = 0.0; // dB
|
||||
m_SchBitMap = NULL;
|
||||
m_FormulaName = NULL;
|
||||
m_SchBitmapName = BITMAPS::INVALID_BITMAP;
|
||||
m_FormulaName = nullptr;
|
||||
|
||||
// Initialize these variables mainly to avoid warnings from a static analyzer
|
||||
m_R1 = 0.0;
|
||||
|
@ -62,7 +57,6 @@ ATTENUATOR::ATTENUATOR( ATTENUATORS_TYPE aTopology )
|
|||
|
||||
ATTENUATOR::~ATTENUATOR()
|
||||
{
|
||||
delete m_SchBitMap;
|
||||
}
|
||||
|
||||
|
||||
|
@ -93,7 +87,7 @@ void ATTENUATOR::WriteConfig()
|
|||
ATTENUATOR_PI::ATTENUATOR_PI() : ATTENUATOR( PI_TYPE )
|
||||
{
|
||||
m_Name = wxT("att_pi");
|
||||
m_SchBitMap = KiBitmapNew( BITMAPS::att_pi );
|
||||
m_SchBitmapName = BITMAPS::att_pi;
|
||||
m_FormulaName = &pi_formula;
|
||||
}
|
||||
|
||||
|
@ -114,7 +108,7 @@ bool ATTENUATOR_PI::Calculate()
|
|||
ATTENUATOR_TEE::ATTENUATOR_TEE() : ATTENUATOR( TEE_TYPE )
|
||||
{
|
||||
m_Name = wxT("att_tee");
|
||||
m_SchBitMap = KiBitmapNew( BITMAPS::att_tee );
|
||||
m_SchBitmapName = BITMAPS::att_tee;
|
||||
m_FormulaName = &tee_formula;
|
||||
}
|
||||
|
||||
|
@ -137,7 +131,7 @@ ATTENUATOR_BRIDGE::ATTENUATOR_BRIDGE() : ATTENUATOR( BRIDGE_TYPE )
|
|||
m_Name = wxT("att_bridge");
|
||||
m_Zin_Enable = false;
|
||||
m_ResultCount = 2;
|
||||
m_SchBitMap = KiBitmapNew( BITMAPS::att_bridge );
|
||||
m_SchBitmapName = BITMAPS::att_bridge;
|
||||
m_FormulaName = &bridget_tee_formula;
|
||||
}
|
||||
|
||||
|
@ -163,7 +157,7 @@ ATTENUATOR_SPLITTER::ATTENUATOR_SPLITTER() : ATTENUATOR( SPLITTER_TYPE )
|
|||
m_Attenuation = 6.0;
|
||||
m_MinimumATT = 6.0;
|
||||
m_Zin_Enable = false;
|
||||
m_SchBitMap = KiBitmapNew( BITMAPS::att_splitter );
|
||||
m_SchBitmapName = BITMAPS::att_splitter;
|
||||
m_FormulaName = &splitter_formula;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
#ifndef ATTENUATORFUNC_H
|
||||
#define ATTENUATORFUNC_H
|
||||
|
||||
class wxBitmap;
|
||||
// Forward declare the bitmaps enum from bitmaps/bitmap_list.h
|
||||
enum class BITMAPS : unsigned int;
|
||||
|
||||
class wxString;
|
||||
|
||||
enum ATTENUATORS_TYPE {
|
||||
|
@ -61,7 +63,7 @@ public:
|
|||
double m_R1; // value of R1
|
||||
double m_R2; // value of R2
|
||||
double m_R3; // value of R3 (if any)
|
||||
wxBitmap* m_SchBitMap; // The schema of this attenuator
|
||||
BITMAPS m_SchBitmapName; // The schema of this attenuator
|
||||
wxString* m_FormulaName; // The HTML/markdown text name of the formula
|
||||
|
||||
protected:
|
||||
|
|
|
@ -67,7 +67,7 @@ PANEL_ATTENUATORS::~PANEL_ATTENUATORS()
|
|||
|
||||
void PANEL_ATTENUATORS::UpdateUI()
|
||||
{
|
||||
m_attenuatorBitmap->SetBitmap( *m_CurrAttenuator->m_SchBitMap );
|
||||
m_attenuatorBitmap->SetBitmap( KiBitmap( m_CurrAttenuator->m_SchBitmapName ) );
|
||||
|
||||
m_attenuatorBitmap->GetParent()->Layout();
|
||||
m_attenuatorBitmap->GetParent()->Refresh();
|
||||
|
@ -142,7 +142,7 @@ void PANEL_ATTENUATORS::TransfPanelDataToAttenuator()
|
|||
|
||||
void PANEL_ATTENUATORS::TransfAttenuatorDataToPanel()
|
||||
{
|
||||
m_attenuatorBitmap->SetBitmap( *m_CurrAttenuator->m_SchBitMap );
|
||||
m_attenuatorBitmap->SetBitmap( KiBitmap( m_CurrAttenuator->m_SchBitmapName ) );
|
||||
|
||||
wxString msg;
|
||||
|
||||
|
|
Loading…
Reference in New Issue