summaryrefslogtreecommitdiffstats
path: root/src/electronics/component.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/electronics/component.cpp')
-rw-r--r--src/electronics/component.cpp114
1 files changed, 57 insertions, 57 deletions
diff --git a/src/electronics/component.cpp b/src/electronics/component.cpp
index f9f3c12..c05993d 100644
--- a/src/electronics/component.cpp
+++ b/src/electronics/component.cpp
@@ -38,10 +38,10 @@
#include <cmath>
#include <kdebug.h>
-#include <qbitarray.h>
-#include <qpainter.h>
-#include <qwidget.h>
-#include <qwmatrix.h>
+#include <tqbitarray.h>
+#include <tqpainter.h>
+#include <tqwidget.h>
+#include <tqwmatrix.h>
const int dipWidth = 112;
const int pairSep = 32;
@@ -49,7 +49,7 @@ const int pairSep = 32;
// Degrees per radian
static const double DPR = 57.29577951308232087665461840231273527024;
-Component::Component( ICNDocument *icnDocument, bool newItem, const QString &id )
+Component::Component( ICNDocument *icnDocument, bool newItem, const TQString &id )
: CNItem( icnDocument, newItem, id ),
m_angleDegrees(0),
b_flipped(false)
@@ -167,7 +167,7 @@ void Component::setNodalCurrents()
}
-void Component::initPainter( QPainter &p )
+void Component::initPainter( TQPainter &p )
{
CNItem::initPainter(p);
@@ -185,7 +185,7 @@ void Component::initPainter( QPainter &p )
}
-void Component::deinitPainter( QPainter &p )
+void Component::deinitPainter( TQPainter &p )
{
if ( !b_flipped && (m_angleDegrees%360 == 0) )
return;
@@ -216,7 +216,7 @@ void Component::setFlipped( bool flipped )
void Component::itemPointsChanged()
{
- QPointArray transformedPoints = transMatrix( m_angleDegrees, b_flipped, 0, 0, false ).map(m_itemPoints);
+ TQPointArray transformedPoints = transMatrix( m_angleDegrees, b_flipped, 0, 0, false ).map(m_itemPoints);
// transformedPoints.translate( int(x()), int(y()) );
setPoints(transformedPoints);
}
@@ -240,9 +240,9 @@ ItemData Component::itemData() const
}
-QWMatrix Component::transMatrix( int angleDegrees, bool flipped, int x, int y, bool inverse )
+TQWMatrix Component::transMatrix( int angleDegrees, bool flipped, int x, int y, bool inverse )
{
- QWMatrix m;
+ TQWMatrix m;
m.translate( x, y );
if (inverse)
{
@@ -257,7 +257,7 @@ QWMatrix Component::transMatrix( int angleDegrees, bool flipped, int x, int y, b
m.rotate(angleDegrees);
}
m.translate( -x, -y );
- m.setTransformationMode( QWMatrix::Areas );
+ m.setTransformationMode( TQWMatrix::Areas );
return m;
}
@@ -305,17 +305,17 @@ void Component::updateAttachedPositioning()
//BEGIN Transform the GuiParts
- QWMatrix m;
+ TQWMatrix m;
if (b_flipped)
m.scale( -1, 1 );
m.rotate(m_angleDegrees);
- m.setTransformationMode( QWMatrix::Areas );
+ m.setTransformationMode( TQWMatrix::Areas );
const TextMap::iterator textMapEnd = m_textMap.end();
for ( TextMap::iterator it = m_textMap.begin(); it != textMapEnd; ++it )
{
- QRect newPos = m.mapRect( it.data()->recommendedRect() );
+ TQRect newPos = m.mapRect( it.data()->recommendedRect() );
it.data()->move( newPos.x() + x(), newPos.y() + y() );
it.data()->setGuiPartSize( newPos.width(), newPos.height() );
it.data()->setAngleDegrees(m_angleDegrees);
@@ -323,7 +323,7 @@ void Component::updateAttachedPositioning()
const WidgetMap::iterator widgetMapEnd = m_widgetMap.end();
for ( WidgetMap::iterator it = m_widgetMap.begin(); it != widgetMapEnd; ++it )
{
- QRect newPos = m.mapRect( it.data()->recommendedRect() );
+ TQRect newPos = m.mapRect( it.data()->recommendedRect() );
it.data()->move( newPos.x() + x(), newPos.y() + y() );
it.data()->setGuiPartSize( newPos.width(), newPos.height() );
it.data()->setAngleDegrees(m_angleDegrees);
@@ -332,7 +332,7 @@ void Component::updateAttachedPositioning()
}
-void Component::drawPortShape( QPainter & p )
+void Component::drawPortShape( TQPainter & p )
{
int h = height();
int w = width() - 1;
@@ -351,7 +351,7 @@ void Component::drawPortShape( QPainter & p )
int outer16 = int(16*outer*DPR);
p.save();
- p.setPen( Qt::NoPen );
+ p.setPen( TQt::NoPen );
p.drawPolygon( areaPoints() );
p.restore();
@@ -388,7 +388,7 @@ void Component::drawPortShape( QPainter & p )
}
-void Component::initDIP( const QStringList & pins )
+void Component::initDIP( const TQStringList & pins )
{
const int numPins = pins.size();
const int numSide = numPins/2 + numPins%2;
@@ -433,15 +433,15 @@ void Component::initDIP( const QStringList & pins )
updateAttachedPositioning();
}
-void Component::initDIPSymbol( const QStringList & pins, int _width )
+void Component::initDIPSymbol( const TQStringList & pins, int _width )
{
const int numPins = pins.size();
const int numSide = numPins/2 + numPins%2;
setSize( -(_width-(_width%16))/2, -(numSide+1)*8, _width, (numSide+1)*16, true );
- QWidget tmpWidget;
- QPainter p(&tmpWidget);
+ TQWidget tmpWidget;
+ TQPainter p(&tmpWidget);
p.setFont(m_font);
@@ -450,14 +450,14 @@ void Component::initDIPSymbol( const QStringList & pins, int _width )
{
if ( !pins[i].isEmpty() )
{
- const QString text = *pins.at(i);
+ const TQString text = *pins.at(i);
const int _top = (i+1)*16-8 + offsetY();
const int _width = width()/2 - 6;
const int _left = 6 + offsetX();
const int _height = 16;
- QRect br = p.boundingRect( QRect( _left, _top, _width, _height ), Qt::AlignLeft, text );
+ TQRect br = p.boundingRect( TQRect( _left, _top, _width, _height ), TQt::AlignLeft, text );
addDisplayText( text, br, text );
}
}
@@ -466,14 +466,14 @@ void Component::initDIPSymbol( const QStringList & pins, int _width )
{
if ( !pins[i].isEmpty() )
{
- const QString text = *pins.at(i);
+ const TQString text = *pins.at(i);
const int _top = (2*numSide-i)*16 - 8 + offsetY();
const int _width = width()/2 - 6;
const int _left = (width()/2) + offsetX();
const int _height = 16;
- QRect br = p.boundingRect( QRect( _left, _top, _width, _height ), Qt::AlignRight, text );
+ TQRect br = p.boundingRect( TQRect( _left, _top, _width, _height ), TQt::AlignRight, text );
addDisplayText( text, br, text );
}
}
@@ -482,7 +482,7 @@ void Component::initDIPSymbol( const QStringList & pins, int _width )
}
-// QString createNode( double _x, double _y, int shape, int orientation, const QString &name, int type, bool isInput = true );
+// TQString createNode( double _x, double _y, int tqshape, int orientation, const TQString &name, int type, bool isInput = true );
void Component::init1PinLeft( int h1 )
{
@@ -566,7 +566,7 @@ void Component::init4PinRight( int h1, int h2, int h3, int h4 )
}
-ECNode* Component::ecNodeWithID( const QString &ecNodeId )
+ECNode* Component::ecNodeWithID( const TQString &ecNodeId )
{
return dynamic_cast<ECNode*>( p_icnDocument->nodeWithID( nodeId(ecNodeId) ) );
}
@@ -627,7 +627,7 @@ BJT* Component::createBJT( Pin *cN, Pin *bN, Pin *eN, bool isNPN )
{
BJT *e = new BJT(isNPN);
- QValueList<Pin*> pins;
+ TQValueList<Pin*> pins;
pins << bN << cN << eN;
ElementMapList::iterator it = handleElement( e, pins );
@@ -639,7 +639,7 @@ Capacitance* Component::createCapacitance( Pin *n0, Pin *n1, double capacitance
{
Capacitance *e = new Capacitance( capacitance, 1./LINEAR_UPDATE_RATE );
- QValueList<Pin*> pins;
+ TQValueList<Pin*> pins;
pins << n0 << n1;
ElementMapList::iterator it = handleElement( e, pins );
@@ -651,7 +651,7 @@ CCCS* Component::createCCCS( Pin *n0, Pin *n1, Pin *n2, Pin *n3, double gain )
{
CCCS *e = new CCCS(gain);
- QValueList<Pin*> pins;
+ TQValueList<Pin*> pins;
pins << n0 << n1 << n2 << n3;
ElementMapList::iterator it = handleElement( e, pins );
@@ -663,7 +663,7 @@ CCVS* Component::createCCVS( Pin *n0, Pin *n1, Pin *n2, Pin *n3, double gain )
{
CCVS *e = new CCVS(gain);
- QValueList<Pin*> pins;
+ TQValueList<Pin*> pins;
pins << n0 << n1 << n2 << n3;
ElementMapList::iterator it = handleElement( e, pins );
@@ -684,7 +684,7 @@ CurrentSignal* Component::createCurrentSignal( Pin *n0, Pin *n1, double current
{
CurrentSignal *e = new CurrentSignal( 1./LINEAR_UPDATE_RATE, current );
- QValueList<Pin*> pins;
+ TQValueList<Pin*> pins;
pins << n0 << n1;
ElementMapList::iterator it = handleElement( e, pins );
@@ -696,7 +696,7 @@ CurrentSource* Component::createCurrentSource( Pin *n0, Pin *n1, double current
{
CurrentSource *e = new CurrentSource(current);
- QValueList<Pin*> pins;
+ TQValueList<Pin*> pins;
pins << n0 << n1;
ElementMapList::iterator it = handleElement( e, pins );
@@ -708,7 +708,7 @@ Diode* Component::createDiode( Pin *n0, Pin *n1 )
{
Diode *e = new Diode();
- QValueList<Pin*> pins;
+ TQValueList<Pin*> pins;
pins << n0 << n1;
ElementMapList::iterator it = handleElement( e, pins );
@@ -720,7 +720,7 @@ Inductance* Component::createInductance( Pin *n0, Pin *n1, double inductance )
{
Inductance *e = new Inductance( inductance, 1./LINEAR_UPDATE_RATE );
- QValueList<Pin*> pins;
+ TQValueList<Pin*> pins;
pins << n0 << n1;
ElementMapList::iterator it = handleElement( e, pins );
@@ -732,7 +732,7 @@ LogicIn *Component::createLogicIn( Pin *node )
{
LogicIn *e = new LogicIn(LogicIn::getConfig());
- QValueList<Pin*> pins;
+ TQValueList<Pin*> pins;
pins << node;
ElementMapList::iterator it = handleElement( e, pins );
@@ -743,7 +743,7 @@ LogicOut *Component::createLogicOut( Pin *node, bool isHigh )
{
LogicOut *e = new LogicOut( LogicIn::getConfig(), isHigh);
- QValueList<Pin*> pins;
+ TQValueList<Pin*> pins;
pins << node;
ElementMapList::iterator it = handleElement( e, pins );
@@ -755,7 +755,7 @@ OpAmp * Component::createOpAmp( Pin * nonInverting, Pin * inverting, Pin * out )
{
OpAmp * e = new OpAmp();
- QValueList<Pin*> pins;
+ TQValueList<Pin*> pins;
pins << nonInverting << inverting << out;
ElementMapList::iterator it = handleElement( e, pins );
@@ -767,7 +767,7 @@ Resistance* Component::createResistance( Pin *n0, Pin *n1, double resistance )
{
Resistance *e = new Resistance(resistance);
- QValueList<Pin*> pins;
+ TQValueList<Pin*> pins;
pins << n0 << n1;
ElementMapList::iterator it = handleElement( e, pins );
@@ -792,7 +792,7 @@ VCCS* Component::createVCCS( Pin *n0, Pin *n1, Pin *n2, Pin *n3, double gain )
{
VCCS *e = new VCCS(gain);
- QValueList<Pin*> pins;
+ TQValueList<Pin*> pins;
pins << n0 << n1 << n2 << n3;
ElementMapList::iterator it = handleElement( e, pins );
@@ -804,7 +804,7 @@ VCVS* Component::createVCVS( Pin *n0, Pin *n1, Pin *n2, Pin *n3, double gain )
{
VCVS *e = new VCVS(gain);
- QValueList<Pin*> pins;
+ TQValueList<Pin*> pins;
pins << n0 << n1 << n2 << n3;
ElementMapList::iterator it = handleElement( e, pins );
@@ -824,7 +824,7 @@ VoltagePoint* Component::createVoltagePoint( Pin *n0, double voltage )
{
VoltagePoint *e = new VoltagePoint(voltage);
- QValueList<Pin*> pins;
+ TQValueList<Pin*> pins;
pins << n0;
ElementMapList::iterator it = handleElement( e, pins );
@@ -836,7 +836,7 @@ VoltageSignal* Component::createVoltageSignal( Pin *n0, Pin *n1, double voltage
{
VoltageSignal *e = new VoltageSignal( 1./LINEAR_UPDATE_RATE, voltage );
- QValueList<Pin*> pins;
+ TQValueList<Pin*> pins;
pins << n0 << n1;
ElementMapList::iterator it = handleElement( e, pins );
@@ -848,7 +848,7 @@ VoltageSource* Component::createVoltageSource( Pin *n0, Pin *n1, double voltage
{
VoltageSource *e = new VoltageSource(voltage);
- QValueList<Pin*> pins;
+ TQValueList<Pin*> pins;
pins << n0 << n1;
ElementMapList::iterator it = handleElement( e, pins );
@@ -857,7 +857,7 @@ VoltageSource* Component::createVoltageSource( Pin *n0, Pin *n1, double voltage
}
-ElementMapList::iterator Component::handleElement( Element *e, const QValueList<Pin*> & pins )
+ElementMapList::iterator Component::handleElement( Element *e, const TQValueList<Pin*> & pins )
{
if (!e)
return m_elementMapList.end();
@@ -865,8 +865,8 @@ ElementMapList::iterator Component::handleElement( Element *e, const QValueList<
ElementMap em;
em.e = e;
int at = 0;
- QValueList<Pin*>::ConstIterator end = pins.end();
- for ( QValueList<Pin*>::ConstIterator it = pins.begin(); it != end; ++it )
+ TQValueList<Pin*>::ConstIterator end = pins.end();
+ for ( TQValueList<Pin*>::ConstIterator it = pins.begin(); it != end; ++it )
{
(*it)->addElement(e);
em.n[at++] = *it;
@@ -879,19 +879,19 @@ ElementMapList::iterator Component::handleElement( Element *e, const QValueList<
}
-void Component::setInterDependent( ElementMapList::iterator it, const QValueList<Pin*> & pins )
+void Component::setInterDependent( ElementMapList::iterator it, const TQValueList<Pin*> & pins )
{
setInterCircuitDependent( it, pins );
setInterGroundDependent( it, pins );
}
-void Component::setInterCircuitDependent( ElementMapList::iterator it, const QValueList<Pin*> & pins )
+void Component::setInterCircuitDependent( ElementMapList::iterator it, const TQValueList<Pin*> & pins )
{
- QValueList<Pin*>::ConstIterator end = pins.end();
- for ( QValueList<Pin*>::ConstIterator it1 = pins.begin(); it1 != end; ++it1 )
+ TQValueList<Pin*>::ConstIterator end = pins.end();
+ for ( TQValueList<Pin*>::ConstIterator it1 = pins.begin(); it1 != end; ++it1 )
{
- for ( QValueList<Pin*>::ConstIterator it2 = pins.begin(); it2 != end; ++it2 )
+ for ( TQValueList<Pin*>::ConstIterator it2 = pins.begin(); it2 != end; ++it2 )
{
(*it1)->addCircuitDependentPin( *it2 );
}
@@ -901,12 +901,12 @@ void Component::setInterCircuitDependent( ElementMapList::iterator it, const QVa
}
-void Component::setInterGroundDependent( ElementMapList::iterator it, const QValueList<Pin*> & pins )
+void Component::setInterGroundDependent( ElementMapList::iterator it, const TQValueList<Pin*> & pins )
{
- QValueList<Pin*>::ConstIterator end = pins.end();
- for ( QValueList<Pin*>::ConstIterator it1 = pins.begin(); it1 != end; ++it1 )
+ TQValueList<Pin*>::ConstIterator end = pins.end();
+ for ( TQValueList<Pin*>::ConstIterator it1 = pins.begin(); it1 != end; ++it1 )
{
- for ( QValueList<Pin*>::ConstIterator it2 = pins.begin(); it2 != end; ++it2 )
+ for ( TQValueList<Pin*>::ConstIterator it2 = pins.begin(); it2 != end; ++it2 )
{
(*it1)->addGroundDependentPin( *it2 );
}
@@ -996,7 +996,7 @@ void Component::initElements( const uint stage )
}
-ECNode * Component::createPin( double x, double y, int orientation, const QString & name )
+ECNode * Component::createPin( double x, double y, int orientation, const TQString & name )
{
return dynamic_cast<ECNode*>( createNode( x, y, orientation, name, Node::ec_pin ) );
}