ECSRFlipFlop::ECSRFlipFlop( ICNDocument *icnDocument, bool newItem, const char *id ) : Component( icnDocument, newItem, id ? id : "sr_flipflop" ) { m_name = i18n("SR Flip-Flop"); setSize( -24, -24, 48, 48 ); init2PinLeft( -8, 8 ); init2PinRight( -8, 8 ); m_pS = createLogicIn( m_pNNode[0] ); m_pR = createLogicIn( m_pNNode[1] ); m_pQ = createLogicOut( m_pPNode[0], true ); m_pQBar = createLogicOut( m_pPNode[1], false ); old_q1 = true; old_q2 = false; m_pQ->setHigh(old_q1); m_pQBar->setHigh(old_q2); addDisplayText( "S", QRect( -24, -16, 20, 16 ), "S" ); addDisplayText( "R", QRect( -24, 0, 20, 16 ), "R" ); addDisplayText( "Q", QRect( 4, -16, 20, 16 ), "Q" ); addDisplayText( "Q'", QRect( 4, 0, 20, 16 ), "Q'" ); m_pS->setCallback( this, static_cast<CallbackPtr>(&ECSRFlipFlop::inStateChanged) ); m_pR->setCallback( this, static_cast<CallbackPtr>(&ECSRFlipFlop::inStateChanged) ); m_pQ->setCallback( this, static_cast<CallbackPtr>(&ECSRFlipFlop::inStateChanged) ); m_pQBar->setCallback( this, static_cast<CallbackPtr>(&ECSRFlipFlop::inStateChanged) ); }
ECDFlipFlop::ECDFlipFlop( ICNDocument *icnDocument, bool newItem, const char *id ) : ClockedFlipFlop( icnDocument, newItem, id ? id : "d_flipflop" ) { m_name = i18n("D-Type Flip-Flop"); setSize( -32, -24, 64, 48 ); init2PinLeft( -8, 8 ); init2PinRight( -8, 8 ); initSymbolFromTrigger(); m_prevD = false; m_pSimulator = Simulator::self(); m_bPrevClock = false; m_pD = createLogicIn( m_pNNode[0] ); m_pClock = createLogicIn( m_pNNode[1] ); m_pQ = createLogicOut( m_pPNode[0], false ); m_pQBar = createLogicOut( m_pPNode[1], false ); setp = createLogicIn( createPin( 0, -32, 90, "set" ) ); rstp = createLogicIn( createPin( 0, 32, 270, "rst" ) ); // (The display text for D, >, Set, Rst is set in initSymbolFromTrigger addDisplayText( "Q", QRect( 12, -16, 20, 16 ), "Q" ); addDisplayText( "Q'", QRect( 12, 0, 20, 16 ), "Q'" ); m_pD->setCallback( this, static_cast<CallbackPtr>(&ECDFlipFlop::inputChanged) ); m_pClock->setCallback( this, static_cast<CallbackPtr>(&ECDFlipFlop::clockChanged) ); setp->setCallback( this, static_cast<CallbackPtr>(&ECDFlipFlop::asyncChanged) ); rstp->setCallback( this, static_cast<CallbackPtr>(&ECDFlipFlop::asyncChanged) ); inStateChanged(false); }
//BEGIN class DependentSource DependentSource::DependentSource(ICNDocument *icnDocument, bool newItem, const char *id) : SimpleComponent(icnDocument, newItem, id) { setSize(-16, -16, 32, 32); init2PinLeft(); init2PinRight(); m_pNNode[1]->setLength(13); m_pPNode[1]->setLength(13); createProperty("gain", Variant::Type::Double); property("gain")->setCaption(i18n("Gain")); property("gain")->setValue(1.0); addDisplayText("gain", QRect(-16, -32, 32, 16), ""); }