Esempio n. 1
0
ProcessModel::ProcessModel(
        const TimeValue& duration,
        const Id<Process::ProcessModel>& id,
        QObject* parent) :
    Curve::CurveProcessModel {duration, id, Metadata<ObjectKey_k, ProcessModel>::get(), parent}
{
    pluginModelList = new iscore::ElementPluginModelList{iscore::IDocument::documentContext(*parent), this};
    setUseParentDuration(true);
    // Named shall be enough ?
    setCurve(new Curve::Model{Id<Curve::Model>(45345), this});

    auto s1 = new Curve::DefaultCurveSegmentModel(Id<Curve::SegmentModel>(1), m_curve);
    s1->setStart({0., 0.0});
    s1->setEnd({1., 1.});

    m_curve->addSegment(s1);
    connect(m_curve, &Curve::Model::changed,
            this, &ProcessModel::curveChanged);

    metadata.setName(QString("Mapping.%1").arg(*this->id().val()));
}
Esempio n. 2
0
static RefPtr<Range> makeSearchRange(const Position& position)
{
    auto* node = position.deprecatedNode();
    if (!node)
        return nullptr;
    auto* boundary = deprecatedEnclosingBlockFlowElement(node);
    if (!boundary)
        return nullptr;

    auto searchRange = Range::create(node->document());

    auto result = searchRange->selectNodeContents(*boundary);
    if (result.hasException())
        return nullptr;
    Position start { position.parentAnchoredEquivalent() };
    result = searchRange->setStart(*start.containerNode(), start.offsetInContainerNode());
    if (result.hasException())
        return nullptr;

    return WTFMove(searchRange);
}
Esempio n. 3
0
void Line3DOverlay::setProperties(const QVariantMap& properties) {
    Base3DOverlay::setProperties(properties);

    auto start = properties["start"];
    // if "start" property was not there, check to see if they included aliases: startPoint
    if (!start.isValid()) {
        start = properties["startPoint"];
    }
    if (start.isValid()) {
        setStart(vec3FromVariant(start));
    }

    auto end = properties["end"];
    // if "end" property was not there, check to see if they included aliases: endPoint
    if (!end.isValid()) {
        end = properties["endPoint"];
    }
    if (end.isValid()) {
        setEnd(vec3FromVariant(end));
    }
}
Esempio n. 4
0
void Line3DOverlay::setProperties(const QScriptValue& properties) {
    Base3DOverlay::setProperties(properties);

    QScriptValue start = properties.property("start");
    // if "start" property was not there, check to see if they included aliases: startPoint
    if (!start.isValid()) {
        start = properties.property("startPoint");
    }
    if (start.isValid()) {
        QScriptValue x = start.property("x");
        QScriptValue y = start.property("y");
        QScriptValue z = start.property("z");
        if (x.isValid() && y.isValid() && z.isValid()) {
            glm::vec3 newStart;
            newStart.x = x.toVariant().toFloat();
            newStart.y = y.toVariant().toFloat();
            newStart.z = z.toVariant().toFloat();
            setStart(newStart);
        }
    }

    QScriptValue end = properties.property("end");
    // if "end" property was not there, check to see if they included aliases: endPoint
    if (!end.isValid()) {
        end = properties.property("endPoint");
    }
    if (end.isValid()) {
        QScriptValue x = end.property("x");
        QScriptValue y = end.property("y");
        QScriptValue z = end.property("z");
        if (x.isValid() && y.isValid() && z.isValid()) {
            glm::vec3 newEnd;
            newEnd.x = x.toVariant().toFloat();
            newEnd.y = y.toVariant().toFloat();
            newEnd.z = z.toVariant().toFloat();
            setEnd(newEnd);
        }
    }
}
void TMXLayer::updatePrimitives()
{
    for(const auto& iter : _indicesVertexZNumber)
    {
        int start = _indicesVertexZOffsets.at(iter.first);
        
        auto primitiveIter= _primitives.find(iter.first);
        if(primitiveIter == _primitives.end())
        {
            auto primitive = Primitive::create(_vData, _indexBuffer, GL_TRIANGLES);
            primitive->setCount(iter.second * 6);
            primitive->setStart(start * 6);
            
            _primitives.insert(iter.first, primitive);
        }
        else
        {
            primitiveIter->second->setCount(iter.second * 6);
            primitiveIter->second->setStart(start * 6);
        }
    }
}
Esempio n. 6
0
static void scroll( HWND hwnd, int direction, int timeOut ) {

    LONG page_size = getEnd( hwnd ) - getStart( hwnd );
    if ( page_size <= getGranularity( hwnd ) ) {
        page_size = getGranularity( hwnd );
    }
    if ( page_size <= 0 ) {
        page_size = 1;
    }

    LONG delta = 0;
    if ( -1 == direction ) {
        delta = -page_size;
        if ( getStart( hwnd ) + delta < getLower( hwnd ) ) {
            delta = getLower( hwnd ) - getStart( hwnd );
        }
    } else {
        delta = page_size;
        if ( getUpper( hwnd ) < getEnd( hwnd ) + delta ) {
            delta = getUpper( hwnd ) - getEnd( hwnd );
        }
    }

    int start = adjust( hwnd, getStart( hwnd ) + delta );
    int end   = adjust( hwnd, getEnd  ( hwnd ) + delta );
    if ( start != getStart( hwnd ) || end != getEnd( hwnd ) ) {
        setStart( hwnd, start );
        setEnd  ( hwnd, end   );
        invalidateRect( hwnd );
        invalidateCursor();
        notifyParent( hwnd );
    }

    // TODO: discuss SPI_GETKEYBOARDDELAY
    if ( 0 < timeOut ) {
        SetTimer( hwnd, 1, timeOut, 0 );
    }
}
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: on_actionChangeMode_triggered(); break;
        case 1: on_actionSair_triggered(); break;
        case 2: on_actionConfigura_o_triggered(); break;
        case 3: mInitialH(); break;
        case 4: pInitialH(); break;
        case 5: mFinalH(); break;
        case 6: pFinalH(); break;
        case 7: mInitialS(); break;
        case 8: pInitialS(); break;
        case 9: mFinalS(); break;
        case 10: pFinalS(); break;
        case 11: mInitialV(); break;
        case 12: pInitialV(); break;
        case 13: mFinalV(); break;
        case 14: pFinalV(); break;
        case 15: resetColor(); break;
        case 16: setStart(); break;
        case 17: bMoveF(); break;
        case 18: bMoveB(); break;
        case 19: bMoveL(); break;
        case 20: bMoveR(); break;
        case 21: bRotL(); break;
        case 22: bRotR(); break;
        case 23: bStop(); break;
        default: ;
        }
        _id -= 24;
    }
    return _id;
}
int main(){

    NME player;
    NME dumbOgres[MAX_NMES];
    int numNMES;
    int inp;
    char level[MAX_H][MAX_W];

    player.x = 19;
    player.y = 24;

    //making window large enough
    HWND console = GetConsoleWindow();
    RECT r;
    GetWindowRect(console, &r);
    MoveWindow(console, r.left, r.top, 1280, 720, TRUE);

    genNewLvl();
    readLevel (level);
    writeToFile(level);
    setStart (&player, level);
    numNMES = setNMES (dumbOgres, level);

    do{
        printf("Past Here");
        getch();
		drawBoard(level, player, dumbOgres, numNMES);
        inp=getch();
        useInp(&player, inp, level);
        movNMES(dumbOgres, numNMES, &player, level);


    }while(inp!=27);


return 0;
}
Esempio n. 9
0
void CurvePresenter::updateSegmentsType(const QString& segmentName)
{
    // They keep their start / end and previous / following but change type.
    // TODO maybe it would be better to encapsulate this ?
    auto factory = SingletonCurveSegmentList::instance().get(segmentName);

    QVector<QByteArray> newSegments;
    newSegments.resize(m_model->segments().size());
    int i = 0;
    for(CurveSegmentModel* segment : m_model->segments())
    {
        CurveSegmentModel* current;
        if(segment->selection.get())
        {
            auto ns = factory->make(segment->id(), nullptr);
            ns->setStart(segment->start());
            ns->setEnd(segment->end());
            ns->setPrevious(segment->previous());
            ns->setFollowing(segment->following());

            current = ns;
        }
        else
        {
            current = segment;
        }

        Serializer<DataStream> s{&newSegments[i++]};
        s.readFrom(*current);
    }

    m_commandDispatcher.submitCommand(
                new UpdateCurve{
                    iscore::IDocument::path(m_model),
                    std::move(newSegments)
                });
}
Esempio n. 10
0
void SpellChecker::advanceToNextMisspelling(bool startBeforeSelection)
{
    // The basic approach is to search in two phases - from the selection end to the end of the doc, and
    // then we wrap and search from the doc start to (approximately) where we started.

    // Start at the end of the selection, search to edge of document. Starting at the selection end makes
    // repeated "check spelling" commands work.
    VisibleSelection selection(m_frame.selection().selection());
    RefPtr<Range> spellingSearchRange(rangeOfContents(m_frame.document()));

    bool startedWithSelection = false;
    if (selection.start().deprecatedNode()) {
        startedWithSelection = true;
        if (startBeforeSelection) {
            VisiblePosition start(selection.visibleStart());
            // We match AppKit's rule: Start 1 character before the selection.
            VisiblePosition oneBeforeStart = start.previous();
            setStart(spellingSearchRange.get(), oneBeforeStart.isNotNull() ? oneBeforeStart : start);
        } else {
            setStart(spellingSearchRange.get(), selection.visibleEnd());
        }
    }

    Position position = spellingSearchRange->startPosition();
    if (!isEditablePosition(position)) {
        // This shouldn't happen in very often because the Spelling menu items aren't enabled unless the
        // selection is editable.
        // This can happen in Mail for a mix of non-editable and editable content (like Stationary),
        // when spell checking the whole document before sending the message.
        // In that case the document might not be editable, but there are editable pockets that need to be spell checked.

        position = firstEditableVisiblePositionAfterPositionInRoot(position, m_frame.document()).deepEquivalent();
        if (position.isNull())
            return;

        Position rangeCompliantPosition = position.parentAnchoredEquivalent();
        spellingSearchRange->setStart(rangeCompliantPosition.deprecatedNode(), rangeCompliantPosition.deprecatedEditingOffset(), IGNORE_EXCEPTION);
        startedWithSelection = false; // won't need to wrap
    }

    // topNode defines the whole range we want to operate on
    ContainerNode* topNode = highestEditableRoot(position);
    // FIXME: lastOffsetForEditing() is wrong here if editingIgnoresContent(highestEditableRoot()) returns true (e.g. a <table>)
    spellingSearchRange->setEnd(topNode, lastOffsetForEditing(topNode), IGNORE_EXCEPTION);

    // If spellingSearchRange starts in the middle of a word, advance to the next word so we start checking
    // at a word boundary. Going back by one char and then forward by a word does the trick.
    if (startedWithSelection) {
        VisiblePosition oneBeforeStart = startVisiblePosition(spellingSearchRange.get(), DOWNSTREAM).previous();
        if (oneBeforeStart.isNotNull())
            setStart(spellingSearchRange.get(), endOfWord(oneBeforeStart));
        // else we were already at the start of the editable node
    }

    if (spellingSearchRange->collapsed())
        return; // nothing to search in

    // We go to the end of our first range instead of the start of it, just to be sure
    // we don't get foiled by any word boundary problems at the start. It means we might
    // do a tiny bit more searching.
    Node* searchEndNodeAfterWrap = spellingSearchRange->endContainer();
    int searchEndOffsetAfterWrap = spellingSearchRange->endOffset();

    int misspellingOffset = 0;
    GrammarDetail grammarDetail;
    int grammarPhraseOffset = 0;
    RefPtr<Range> grammarSearchRange = nullptr;
    String badGrammarPhrase;
    String misspelledWord;

    bool isSpelling = true;
    int foundOffset = 0;
    String foundItem;
    RefPtr<Range> firstMisspellingRange = nullptr;
    if (unifiedTextCheckerEnabled()) {
        grammarSearchRange = spellingSearchRange->cloneRange();
        foundItem = TextCheckingHelper(spellCheckerClient(), spellingSearchRange).findFirstMisspellingOrBadGrammar(isGrammarCheckingEnabled(), isSpelling, foundOffset, grammarDetail);
        if (isSpelling) {
            misspelledWord = foundItem;
            misspellingOffset = foundOffset;
        } else {
            badGrammarPhrase = foundItem;
            grammarPhraseOffset = foundOffset;
        }
    } else {
        misspelledWord = TextCheckingHelper(spellCheckerClient(), spellingSearchRange).findFirstMisspelling(misspellingOffset, false, firstMisspellingRange);
        grammarSearchRange = spellingSearchRange->cloneRange();
        if (!misspelledWord.isEmpty()) {
            // Stop looking at start of next misspelled word
            CharacterIterator chars(grammarSearchRange.get());
            chars.advance(misspellingOffset);
            grammarSearchRange->setEnd(chars.range()->startContainer(), chars.range()->startOffset(), IGNORE_EXCEPTION);
        }

        if (isGrammarCheckingEnabled())
            badGrammarPhrase = TextCheckingHelper(spellCheckerClient(), grammarSearchRange).findFirstBadGrammar(grammarDetail, grammarPhraseOffset, false);
    }

    // If we found neither bad grammar nor a misspelled word, wrap and try again (but don't bother if we started at the beginning of the
    // block rather than at a selection).
    if (startedWithSelection && !misspelledWord && !badGrammarPhrase) {
        spellingSearchRange->setStart(topNode, 0, IGNORE_EXCEPTION);
        // going until the end of the very first chunk we tested is far enough
        spellingSearchRange->setEnd(searchEndNodeAfterWrap, searchEndOffsetAfterWrap, IGNORE_EXCEPTION);

        if (unifiedTextCheckerEnabled()) {
            grammarSearchRange = spellingSearchRange->cloneRange();
            foundItem = TextCheckingHelper(spellCheckerClient(), spellingSearchRange).findFirstMisspellingOrBadGrammar(isGrammarCheckingEnabled(), isSpelling, foundOffset, grammarDetail);
            if (isSpelling) {
                misspelledWord = foundItem;
                misspellingOffset = foundOffset;
            } else {
                badGrammarPhrase = foundItem;
                grammarPhraseOffset = foundOffset;
            }
        } else {
            misspelledWord = TextCheckingHelper(spellCheckerClient(), spellingSearchRange).findFirstMisspelling(misspellingOffset, false, firstMisspellingRange);
            grammarSearchRange = spellingSearchRange->cloneRange();
            if (!misspelledWord.isEmpty()) {
                // Stop looking at start of next misspelled word
                CharacterIterator chars(grammarSearchRange.get());
                chars.advance(misspellingOffset);
                grammarSearchRange->setEnd(chars.range()->startContainer(), chars.range()->startOffset(), IGNORE_EXCEPTION);
            }

            if (isGrammarCheckingEnabled())
                badGrammarPhrase = TextCheckingHelper(spellCheckerClient(), grammarSearchRange).findFirstBadGrammar(grammarDetail, grammarPhraseOffset, false);
        }
    }

    if (!badGrammarPhrase.isEmpty()) {
        // We found bad grammar. Since we only searched for bad grammar up to the first misspelled word, the bad grammar
        // takes precedence and we ignore any potential misspelled word. Select the grammar detail, update the spelling
        // panel, and store a marker so we draw the green squiggle later.

        ASSERT(badGrammarPhrase.length() > 0);
        ASSERT(grammarDetail.location != -1 && grammarDetail.length > 0);

        // FIXME 4859190: This gets confused with doubled punctuation at the end of a paragraph
        RefPtr<Range> badGrammarRange = TextIterator::subrange(grammarSearchRange.get(), grammarPhraseOffset + grammarDetail.location, grammarDetail.length);
        m_frame.selection().setSelection(VisibleSelection(badGrammarRange.get(), SEL_DEFAULT_AFFINITY));
        m_frame.selection().revealSelection();

        m_frame.document()->markers().addMarker(badGrammarRange.get(), DocumentMarker::Grammar, grammarDetail.userDescription);
    } else if (!misspelledWord.isEmpty()) {
        // We found a misspelling, but not any earlier bad grammar. Select the misspelling, update the spelling panel, and store
        // a marker so we draw the red squiggle later.

        RefPtr<Range> misspellingRange = TextIterator::subrange(spellingSearchRange.get(), misspellingOffset, misspelledWord.length());
        m_frame.selection().setSelection(VisibleSelection(misspellingRange.get(), DOWNSTREAM));
        m_frame.selection().revealSelection();

        spellCheckerClient().updateSpellingUIWithMisspelledWord(misspelledWord);
        m_frame.document()->markers().addMarker(misspellingRange.get(), DocumentMarker::Spelling);
    }
}
Esempio n. 11
0
void Life::react_Key(VKey vkey,KeyMod kmod)
{
    Used(kmod);

    switch( vkey )
    {
    case VKey_Space :
    {
        running=!running;

        if( running && has_focus ) setStart();
    }
    break;

    case VKey_NumPlus :
    {
        divider.dec();
    }
    break;

    case VKey_NumMinus :
    {
        divider.inc();
    }
    break;

    case VKey_Enter :
    {
        if( !running )
        {
            if( sec_scope.nextScope_skip() )
            {
                speed=Diff(step_number,map.getStepNumber());
            }

            map.step();

            redraw();
        }
    }
    break;

    case VKey_F5 :
    {
        map.reset();

        running=false;

        redraw();
    }
    break;

#if 0

    case VKey_F10 :
    {
        if( kmod&KeyMod_Alt )
        {
            Printf(Exception,"test");
        }
    }
    break;

#endif
    }
}
Esempio n. 12
0
/**
  *	We use the creation function merely to set up the
  *	user interface and make the connections between the
  *	gui elements and the handling agents. All real action
  *	is embedded in actions, initiated by gui buttons
  */
    RadioInterface::RadioInterface (QSettings	*Si, QQmlApplicationEngine *engine,
                                    QObject		*parent): QObject (parent) {
int16_t	latency;

	dabSettings		= Si;
    this->engine    = engine;
//
//	Before printing anything, we set
	setlocale (LC_ALL, "");
///	The default, most likely to be overruled
//
//	One can imagine that a particular version is created
//	for a specific device. In that case the class
//	handling the device can be instantiated here
	inputDevice		= new virtualInput ();
	running			= false;
	
/**	threshold is used in the phaseReference class 
  *	as threshold for checking the validity of the correlation result
  */
	threshold	=
               dabSettings -> value ("threshold", 3). toInt ();

	isSynced		= UNSYNCED;
//
//	latency is used to allow different settings for different
//	situations wrt the output buffering
	latency			=
	           dabSettings -> value ("latency", 1). toInt ();
/**
  *	The current setup of the audio output is that
  *	you have a choice, take one of (soundcard, tcp streamer or rtp streamer)
  */
	audioBuffer		= new RingBuffer<int16_t>(2 * 32768);
	ipAddress		= dabSettings -> value ("ipAddress", "127.0.0.1"). toString ();
	port			= dabSettings -> value ("port", 8888). toInt ();
//
//	show_crcErrors can be ignored in other GUI's, the
//	value is passed on though
	show_crcErrors		= dabSettings -> value ("show_crcErrors", 0). toInt () != 0;
	autoStart		= dabSettings -> value ("autoStart", 0). toInt () != 0;
//
//	In this version, the default is sending the resulting PCM samples to the
//	soundcard. However, defining either TCP_STREAMER or RTP_STREAMER will
//	cause the PCM samples to be send through a different medium
    QStringList AudioInterfaces;
    soundOut = new audioSink (latency, &AudioInterfaces, audioBuffer);
/**
  *	By default we select Band III and Mode 1 or whatever the use
  *	has specified
  */
	dabBand		= dabSettings	-> value ("dabBand", BAND_III). toInt ();
    //setupChannels	(channelSelector, dabBand);

	uint8_t dabMode	= dabSettings	-> value ("dabMode", 1). toInt ();
	setModeParameters (dabMode);
/**
  *	The actual work is done elsewhere: in ofdmProcessor
  *	and ofdmDecoder for the ofdm related part, ficHandler
  *	for the FIC's and mscHandler for the MSC.
  *	The ficHandler shares information with the mscHandler
  *	but the handlers do not change each others modes.
  */
	my_mscHandler		= new mscHandler	(this,
                                             &dabModeParameters,
                                             audioBuffer,
                                             show_crcErrors);
	my_ficHandler		= new ficHandler	(this);
//
/**
  *	The default for the ofdmProcessor depends on
  *	the input device, so changing the selection for an input device
  *	requires changing the ofdmProcessor.
  */
	my_ofdmProcessor = new ofdmProcessor   (inputDevice,
	                                        &dabModeParameters,
	                                        this,
	                                        my_mscHandler,
	                                        my_ficHandler,
	                                        threshold);
	init_your_gui ();		// gui specific stuff

    if (autoStart)
       setStart ();

    // Read channels from the settings
    dabSettings->beginGroup("channels");
    int channelcount = dabSettings->value("channelcout").toInt();

    for(int i=1;i<=channelcount;i++)
    {
        QStringList SaveChannel = dabSettings->value("channel/"+QString::number(i)).toStringList();
        stationList.append(SaveChannel.first(), SaveChannel.last());
    }
    dabSettings->endGroup();

    // Sort stations
    stationList.sort();

    // Set timer
    connect(&CheckFICTimer, SIGNAL(timeout()),this, SLOT(CheckFICTimerTimeout()));
    connect(&ScanChannelTimer, SIGNAL(timeout()),this, SLOT(scanChannelTimerTimeout()));

    // Reset
    isSignalPresent = false;
    isFICCRC = false;

    // Main entry to the QML GUI
    QQmlContext *rootContext = engine->rootContext();

    // Set the stations
    rootContext->setContextProperty("stationModel", QVariant::fromValue(stationList.getList()));
    rootContext->setContextProperty("cppGUI", this);

    // Set working directory
    QString workingDir = QDir::currentPath() + "/";
    rootContext->setContextProperty("workingDir", workingDir);

    // Take the root object
    QObject *rootObject = engine->rootObjects().first();

    // Restore windows properties
    int WindowHeight = dabSettings	-> value ("WindowHeight", 0).toInt();
    if(WindowHeight)
        rootObject->setProperty("height", WindowHeight);

    int WindowWidth = dabSettings	-> value ("WindowWidth", 0).toInt();
    if(WindowWidth)
        rootObject->setProperty("width", WindowWidth);

    // Restore the full screen property
    bool isFullscreen = dabSettings	-> value ("StartInFullScreen", false).toBool();
    QObject *enableFullScreenObject = rootObject->findChild<QObject*>("enableFullScreen");
    if(enableFullScreenObject)
        enableFullScreenObject->setProperty("checked", isFullscreen);

    // Restore the show channel names property
    bool isShowChannelNames = dabSettings-> value ("ShowChannelNames", false).toBool();
    QObject *showChannelObject = rootObject->findChild<QObject*>("showChannel");
    if(showChannelObject)
        showChannelObject->setProperty("checked", isShowChannelNames);

    // Restore expert mode
    bool isExpertMode = dabSettings-> value ("EnableExpertMode", false).toBool();
    QObject *expertModeObject = rootObject->findChild<QObject*>("enableExpertMode");
    if(expertModeObject)
        expertModeObject->setProperty("checked", isExpertMode);

    // Connect signals
    connect(rootObject, SIGNAL(stationClicked(QString,QString)),this, SLOT(channelClick(QString,QString)));
    connect(rootObject, SIGNAL(startChannelScanClicked()),this, SLOT(startChannelScanClick()));
    connect(rootObject, SIGNAL(stopChannelScanClicked()),this, SLOT(stopChannelScanClick()));
    connect(rootObject, SIGNAL(exitApplicationClicked()),this, SLOT(TerminateProcess()));
    connect(rootObject, SIGNAL(exitSettingsClicked()),this, SLOT(saveSettings()));
}
Esempio n. 13
0
void	RadioInterface::scanChannelTimerTimeout(void)
{
    static int Timeout = 0;

    // **** The channel scan is done by a simple state machine ***

    // State ScanStart
    if(ScanChannelState == ScanStart)
    {
        //fprintf(stderr,"State: ScanStart\n");

        // Open and start the radio
        setStart ();

        // Reset the station list
        stationList.reset();

        ScanChannelState = ScanTunetoChannel;
    }

    // State ScanTunetoChannel
    if(ScanChannelState == ScanTunetoChannel)
    {
        //fprintf(stderr,"State: ScanTunetoChannel\n");

        // Select channel
        if(BandIIIChannelIt < 38) // 38 band III frequencies
        {
            CurrentChannel = bandIII_frequencies [BandIIIChannelIt]. key;
            dabBand	= BAND_III;
            fprintf(stderr,"Scan channel: %s, %d kHz\n", bandIII_frequencies [BandIIIChannelIt]. key, bandIII_frequencies [BandIIIChannelIt].fKHz);
            emit channelScanProgress(BandIIIChannelIt + 1);

            // Tune to channel
            set_channelSelect (CurrentChannel);

            /*if(BandIIIChannelIt == 0)
                BandIIIChannelIt = 1;
            if(BandIIIChannelIt == 2)
                BandIIIChannelIt = 26;*/
            BandIIIChannelIt ++;
            Timeout = 0;
            ScanChannelState = ScanCheckSignal;
        }
        /*else if(BandLChannelIt < 16) // 16 L band frequencies
        {
            CurrentChannel = Lband_frequencies [BandLChannelIt]. key;
            dabBand	= L_BAND;
            fprintf(stderr,"Scan channel: %s, %d kHz\n", Lband_frequencies [BandLChannelIt]. key, Lband_frequencies [BandLChannelIt].fKHz);
            BandLChannelIt++;
            emit channelScanProgress(BandIIIChannelIt + BandLChannelIt);

            // Tune to channel
            set_channelSelect (CurrentChannel);

            Timeout = 0;
            ScanChannelState = ScanCheckSignal;
        }*/
        else
        {
            ScanChannelState = ScanDone;
        }

        emit currentStation("Scanning " + CurrentChannel + " ...");
    }

    // State ScanCheckSignal
    if(ScanChannelState == ScanCheckSignal)
    {
        //fprintf(stderr,"State: ScanCheckSignal\n");

        if(isSignalPresent)
        {
            Timeout = 0;
            ScanChannelState = ScanWaitForFIC;
        }
        else
        {
            Timeout++;
        }

        // 2 s timeout
        if(Timeout >= 2)
        {
            //fprintf(stderr,"ScanCheckSignal Timeout\n");
            ScanChannelState = ScanTunetoChannel;
        }
    }

    // State ScanWaitForFIC
    if(ScanChannelState == ScanWaitForFIC)
    {
        //fprintf(stderr,"State: ScanWaitForFIC\n");

        if(isFICCRC)
        {
            fprintf(stderr,"Found channel %s\n", CurrentChannel.toStdString().c_str());

            Timeout = 0;
            ScanChannelState = ScanWaitForChannelNames;
        }
        else
        {
            Timeout++;
        }

        // 30 s timeout
        if(Timeout >= 30)
        {
            //fprintf(stderr,"ScanWaitForFIC Timeout\n");
            ScanChannelState = ScanTunetoChannel;
        }
    }

    // State ScanWaitForChannelNames
    if(ScanChannelState == ScanWaitForChannelNames)
    {
        Timeout++;

        // 30 s timeout
        if(Timeout >= 30)
            ScanChannelState = ScanTunetoChannel;
    }

    // State ScanDone
    if(ScanChannelState == ScanDone)
    {
        //fprintf(stderr,"Stop channel scan\n");
        ScanChannelTimer.stop();
        emit channelScanStopped();
        emit currentStation("No Station");

        /*StationList.sort();
        for(int i=0;i<StationList.count();i++)
        {
            QString Station = StationList.at(i);
            fprintf(stderr,"Station: %s\n",Station.toStdString().c_str());
        }*/

        // Sort stations
        stationList.sort();

        // Load stations into GUI
        QQmlContext *rootContext = engine->rootContext();
        rootContext->setContextProperty("stationModel", QVariant::fromValue(stationList.getList()));
    }
}
Esempio n. 14
0
void Clock::start() {
	setStart(clock());
}
Esempio n. 15
0
Clock::Clock(clock_t s) {
	setStart(s);
}
Esempio n. 16
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    m_server(new NetworkServer(this)),
    m_ipList(),
    m_bgm(this)
{
    ui->setupUi(this);
    m_bgm.setMedia(QUrl::fromLocalFile("./Music/thestonemasons.wav"));
    m_bgm.setVolume(50);
    m_bgm.play();
    connect(&m_bgm, SIGNAL(stateChanged(QMediaPlayer::State)), &m_bgm, SLOT(play()));
    setFixedSize(width(), height());
    m_gobang = new Gobang(this);
    m_startMenu = new StartMenu(this);
    m_waitWidget = new waitWidget(this);
    setCursor(QCursor(QPixmap(":/Pic/arrows.png"), 1, 1));
    m_gobang->hide();
    m_waitWidget->hide();
    m_startMenu->show();
    currentWidget = m_startMenu;
    m_server->listen();
    m_server->getIP();
    m_waitWidget->ui->ipLabel->setText("您的IP是:" + m_server->Sadress);
    m_timer.setInterval(1000);
    currentState = m_server->readWriteSocket->state();
    m_time1.setInterval(200); m_time1.start();
    connect(&m_time1, SIGNAL(timeout()), this, SLOT(checkState()));
    m_timer.start();
    connect(&m_timer, SIGNAL(timeout()), this, SLOT(checkUnactive()));

    connect(m_startMenu->ui->startServer, SIGNAL(clicked()), this, SLOT(setWaiting()));
    connect(m_startMenu->ui->startServer, SIGNAL(clicked()), m_gobang, SLOT(setHost()));
    connect(m_startMenu->ui->startServer, SIGNAL(clicked()), m_server, SLOT(closeListen()));
    connect(m_startMenu->ui->startServer, SIGNAL(clicked()), m_server, SLOT(initServer()));

    connect(m_startMenu->ui->startClient, SIGNAL(clicked()), this, SLOT(connectHost()));
    connect(m_startMenu->ui->startClient, SIGNAL(clicked()), m_server, SLOT(closeListen()));

    connect(m_waitWidget->ui->ok, SIGNAL(clicked()), this, SLOT(broadcast()));
    connect(m_waitWidget->ui->ok, SIGNAL(clicked()), m_waitWidget->ui->setBox, SLOT(hide()));
    connect(m_waitWidget->ui->ok, SIGNAL(clicked()), m_waitWidget->ui->waitLabel, SLOT(show()));
    connect(m_waitWidget->ui->back, SIGNAL(clicked()), m_server, SLOT(closeWrite()));
    connect(m_waitWidget->ui->back, SIGNAL(clicked()), m_server, SLOT(listen()));
    connect(m_waitWidget->ui->back, SIGNAL(clicked()), this, SLOT(setStart()));

    connect(m_gobang, SIGNAL(sendSignal(int, Step)), m_server, SLOT(sendMessage(int, Step)));

    connect(m_server, SIGNAL(setPieces(Step)), m_gobang, SLOT(setPieces(const Step&)));
    connect(m_server, SIGNAL(findPlayer(QString)), this, SLOT(findPlayer(QString)));
    connect(m_server, SIGNAL(changeCamp(int)), m_gobang, SLOT(changeCamp(int)));
    connect(m_server, SIGNAL(recall(int)), m_gobang, SLOT(recallDone(int)));
    connect(m_server, SIGNAL(reStart()), m_gobang, SLOT(reStart()));
    connect(m_server, SIGNAL(agreeRecall()), m_gobang, SLOT(on_recall()));
    connect(m_server, SIGNAL(askForRecall()), m_gobang, SLOT(forRecall()));
    connect(m_server, SIGNAL(agreeExit()), this, SLOT(setStart()));
    connect(m_server, SIGNAL(agreeExit()), m_gobang, SLOT(on_exit()));
    connect(m_server, SIGNAL(refuse()), m_gobang, SLOT(on_refuse()));
    connect(m_server, SIGNAL(agreeExit()), m_server, SLOT(listen()));
    connect(m_server, SIGNAL(askForExit()), m_gobang, SLOT(forExit()));
    connect(m_server, SIGNAL(changeState(int, int, int)), m_gobang, SLOT(changeCurrentState(int, int, int)));
    connect(m_server->listenSocket, SIGNAL(newConnection()), this, SLOT(setGobang()));
    connect(m_server->listenSocket, SIGNAL(newConnection()), m_server, SLOT(closeWrite()));
    connect(m_server->listenSocket, SIGNAL(newConnection()), m_server, SLOT(closeListen()));

}
Esempio n. 17
0
void Labyrinth::setStart(pos p) {
	setStart(p.x, p.y);
}
Esempio n. 18
0
/*!
    Adjusts start to \a start.
 */
void QUmlExecutionSpecification::setStart(QUmlOccurrenceSpecification *start)
{
    // This is a read-write association end

    if (_start != start) {
        _start = start;
        if (start && start->asQModelingObject() && this->asQModelingObject())
            QObject::connect(start->asQModelingObject(), SIGNAL(destroyed()), this->asQModelingObject(), SLOT(setStart()));
    }
}
Esempio n. 19
0
String TextCheckingHelper::findFirstMisspellingOrBadGrammar(bool checkGrammar, bool& outIsSpelling, int& outFirstFoundOffset, GrammarDetail& outGrammarDetail)
{
    if (!unifiedTextCheckerEnabled())
        return "";

    String firstFoundItem;
    String misspelledWord;
    String badGrammarPhrase;
    
    // Initialize out parameters; these will be updated if we find something to return.
    outIsSpelling = true;
    outFirstFoundOffset = 0;
    outGrammarDetail.location = -1;
    outGrammarDetail.length = 0;
    outGrammarDetail.guesses.clear();
    outGrammarDetail.userDescription = "";
    
    // Expand the search range to encompass entire paragraphs, since text checking needs that much context.
    // Determine the character offset from the start of the paragraph to the start of the original search range,
    // since we will want to ignore results in this area.
    RefPtr<Range> paragraphRange = m_range->cloneRange(IGNORE_EXCEPTION);
    setStart(paragraphRange.get(), startOfParagraph(m_range->startPosition()));
    int totalRangeLength = TextIterator::rangeLength(paragraphRange.get());
    setEnd(paragraphRange.get(), endOfParagraph(m_range->startPosition()));
    
    RefPtr<Range> offsetAsRange = Range::create(paragraphRange->startContainer()->document(), paragraphRange->startPosition(), m_range->startPosition());
    int rangeStartOffset = TextIterator::rangeLength(offsetAsRange.get());
    int totalLengthProcessed = 0;
    
    bool firstIteration = true;
    bool lastIteration = false;
    while (totalLengthProcessed < totalRangeLength) {
        // Iterate through the search range by paragraphs, checking each one for spelling and grammar.
        int currentLength = TextIterator::rangeLength(paragraphRange.get());
        int currentStartOffset = firstIteration ? rangeStartOffset : 0;
        int currentEndOffset = currentLength;
        if (inSameParagraph(paragraphRange->startPosition(), m_range->endPosition())) {
            // Determine the character offset from the end of the original search range to the end of the paragraph,
            // since we will want to ignore results in this area.
            RefPtr<Range> endOffsetAsRange = Range::create(paragraphRange->startContainer()->document(), paragraphRange->startPosition(), m_range->endPosition());
            currentEndOffset = TextIterator::rangeLength(endOffsetAsRange.get());
            lastIteration = true;
        }
        if (currentStartOffset < currentEndOffset) {
            String paragraphString = plainText(paragraphRange.get());
            if (paragraphString.length() > 0) {
                bool foundGrammar = false;
                int spellingLocation = 0;
                int grammarPhraseLocation = 0;
                int grammarDetailLocation = 0;
                unsigned grammarDetailIndex = 0;
                
                Vector<TextCheckingResult> results;
                TextCheckingTypeMask checkingTypes = checkGrammar ? (TextCheckingTypeSpelling | TextCheckingTypeGrammar) : TextCheckingTypeSpelling;
                checkTextOfParagraph(m_client->textChecker(), paragraphString.characters(), paragraphString.length(), checkingTypes, results);
                
                for (unsigned i = 0; i < results.size(); i++) {
                    const TextCheckingResult* result = &results[i];
                    if (result->type == TextCheckingTypeSpelling && result->location >= currentStartOffset && result->location + result->length <= currentEndOffset) {
                        ASSERT(result->length > 0 && result->location >= 0);
                        spellingLocation = result->location;
                        misspelledWord = paragraphString.substring(result->location, result->length);
                        ASSERT(misspelledWord.length());
                        break;
                    }
                    if (checkGrammar && result->type == TextCheckingTypeGrammar && result->location < currentEndOffset && result->location + result->length > currentStartOffset) {
                        ASSERT(result->length > 0 && result->location >= 0);
                        // We can't stop after the first grammar result, since there might still be a spelling result after
                        // it begins but before the first detail in it, but we can stop if we find a second grammar result.
                        if (foundGrammar)
                            break;
                        for (unsigned j = 0; j < result->details.size(); j++) {
                            const GrammarDetail* detail = &result->details[j];
                            ASSERT(detail->length > 0 && detail->location >= 0);
                            if (result->location + detail->location >= currentStartOffset && result->location + detail->location + detail->length <= currentEndOffset && (!foundGrammar || result->location + detail->location < grammarDetailLocation)) {
                                grammarDetailIndex = j;
                                grammarDetailLocation = result->location + detail->location;
                                foundGrammar = true;
                            }
                        }
                        if (foundGrammar) {
                            grammarPhraseLocation = result->location;
                            outGrammarDetail = result->details[grammarDetailIndex];
                            badGrammarPhrase = paragraphString.substring(result->location, result->length);
                            ASSERT(badGrammarPhrase.length());
                        }
                    }
                }

                if (!misspelledWord.isEmpty() && (!checkGrammar || badGrammarPhrase.isEmpty() || spellingLocation <= grammarDetailLocation)) {
                    int spellingOffset = spellingLocation - currentStartOffset;
                    if (!firstIteration) {
                        RefPtr<Range> paragraphOffsetAsRange = Range::create(paragraphRange->startContainer()->document(), m_range->startPosition(), paragraphRange->startPosition());
                        spellingOffset += TextIterator::rangeLength(paragraphOffsetAsRange.get());
                    }
                    outIsSpelling = true;
                    outFirstFoundOffset = spellingOffset;
                    firstFoundItem = misspelledWord;
                    break;
                }
                if (checkGrammar && !badGrammarPhrase.isEmpty()) {
                    int grammarPhraseOffset = grammarPhraseLocation - currentStartOffset;
                    if (!firstIteration) {
                        RefPtr<Range> paragraphOffsetAsRange = Range::create(paragraphRange->startContainer()->document(), m_range->startPosition(), paragraphRange->startPosition());
                        grammarPhraseOffset += TextIterator::rangeLength(paragraphOffsetAsRange.get());
                    }
                    outIsSpelling = false;
                    outFirstFoundOffset = grammarPhraseOffset;
                    firstFoundItem = badGrammarPhrase;
                    break;
                }
            }
        }
        if (lastIteration || totalLengthProcessed + currentLength >= totalRangeLength)
            break;
        VisiblePosition newParagraphStart = startOfNextParagraph(paragraphRange->endPosition());
        setStart(paragraphRange.get(), newParagraphStart);
        setEnd(paragraphRange.get(), endOfParagraph(newParagraphStart));
        firstIteration = false;
        totalLengthProcessed += currentLength;
    }
    return firstFoundItem;
}
Esempio n. 20
0
Edge::Edge(Vertex *start) :
    LineGraphicsItem(start)
{
    setStart(start);
    veigth = GlobalSettings::getEdgeVeight();
}
Esempio n. 21
0
/***********************************************************************
     * MapGenerator
     * genForestPlayer

***********************************************************************/
void fired::MapGenerator::genForestPlayer() {
	setStart(0, 37, 5, 5);
}
CanopyFractal::CanopyFractal(int iterations, double x, double y, double start_length, double angle_degrees) {
    setStart(x, y);
    startnode = new CanopyNode();
    generateFractal(startnode, iterations, start_length, angle_degrees);
};
Esempio n. 23
0
/***********************************************************************
     * MapGenerator
     * genSewersPlayer

***********************************************************************/
void fired::MapGenerator::genSewersPlayer() {
	setStart(sizeX / 2, 36, 10, 5);
}
Esempio n. 24
0
void GfxPalette32::kernelPalVarySetStart(const GuiResourceId paletteId) {
	const Palette palette = getPaletteFromResource(paletteId);
	setStart(palette);
}
Esempio n. 25
0
 void Interval::setInterval(Domain start, Domain stop, int str){
   assert(inRange(start, stop));
   setStart(start);
   setStop(stop);
   setStrand(str);
 }
Esempio n. 26
0
int main()
{
	int argc, hist_count, dir, pipeCount, x;	
 	char **argv = NULL, s[MAX];
  	int preCount = 0, postCount = 0;
  	int * execute;// (int *)calloc(2, sizeof(int));
  	char ** prePipe = NULL, ** postPipe = NULL, **preRedir = NULL, ** postRedir = NULL;
	char * path = NULL;
	LinkedList * hist_list = linkedList(); //--This will store history of size 100
	LinkedList * alias_list = linkedList(); //--This will hold our history file data

//////////--Begin initialization
	//  check for .msshrc, if it's there
	//  open it, otherwise create
	if( access( ".msshrc", F_OK ) != -1 ) //--.msshrc does exist
	{
		//--Since the file exists we are guarenteed
		//  at least the HISTCOUNT and HISTFILECOUNT
		FILE * mssh_fin = fopen( ".msshrc", "r" );
		init_boot( mssh_fin, alias_list, &path );
		printf( ".msshrc successfully loaded.\n" );
		printf("histcount: %d\nhistfilecount: %d\nPath: %s\n", HISTCOUNT, HISTFILECOUNT, path);
		
	}//end if
	else //--.msshrc does NOT exist
	{
		printf( ".msshrc not found, setting globals...\n" );

		HISTCOUNT = 100;
		HISTFILECOUNT = 1000;
	}//end else
	//
	//--Check for history files 
	if( access( ".mssh_history", F_OK ) != -1 ) //--.mssh_history does exist
	{
		FILE * hist_fin = fopen( ".mssh_history", "r" );
		//--Fill our history list
		//
		//hist_count = read_hist_file( hist_fin, hist_list);
		printf( ".mssh_history successfully loaded.\n" );
		
	}//end if
	else //--.mssh_history does NOT exist
	{
		printf( ".mssh_history not found.\n" );
	}//end else
//////////--End initialization




	printf( "Welcome to MSSH!\n\n" );

	printf( "command?: " );
  	fgets( s, MAX, stdin );
  	strip( s );

  	while( strcmp( s, "exit" ) != 0 )
  	{
		int function_flag = 0;
		argc = makeargs( s, &argv, " \t\n" );
		pipeCount = containsPipe( s ); // count pipes present
		int leftRedirCount = containsLeftRedir( s );
		int rightRedirCount = containsRightRedir( s );		

		// Whatever the command may be, must be added to history
		if(strlen( s ) > 0)
		{
			argc = makeargs( s, &argv, " \t\n" );
			addLast( hist_list, buildNode_hist( buildType_hist( argc, argv, hist_list->size + 1 )));
		}//end if

		if( strcmp( s, "history" ) == 0 ) // History command check
      		{
				setStart( hist_list, 0 );
        			printSection( hist_list, printType_hist, 0 );
				//printList( hist_list, printType_hist );
		}//end if

		if(leftRedirCount > 0 || rightRedirCount > 0 || pipeCount > 0) // contains redir or pipe
		{
			function_flag++;

			if( pipeCount > 0 ) // contains a pipe
			{
				if( leftRedirCount > 0 ) // contains pipe and a left redir '<'
				{
					if( leftRedirCount > 0 ) // contains all 3
					{
						
					}//end if
				}//end if
				if( leftRedirCount > 0 ) // contains a pipe right redir '>'
				{

				}//end if
				else // contains only a pipe
				{
					prePipe = parsePrePipe( s, &preCount, '|');
					postPipe = parsePostPipe( s, &postCount, '|');
					pipeIt( prePipe, postPipe );
					clean( preCount, prePipe );
        				clean( postCount, postPipe );
				}//end else
			}//end if
			else if( leftRedirCount > 0 ) // contains a left redir '<'
			{
				if( rightRedirCount > 0 ) // contains a left and right redir '<' & '>'
				{
					
				}//end if
				else // only contains a left redir '<'
				{

					preRedir = parsePrePipe( s, &preCount, '<');
					postRedir = parsePostPipe( s, &postCount, '<' );
					executeRedir(preRedir, postRedir, '<');
					clean( preCount, preRedir );
      				clean( postCount, postRedir );
				}//end else
			}//end if
			else // only contains a right redir '>'
			{
				preRedir = parsePrePipe( s, &preCount, '>');
				postRedir = parsePostPipe( s, &postCount, '>' );
				executeRedir(preRedir, postRedir, '>');
				clean( preCount, preRedir );
        		clean( postCount, postRedir );
			}//end else
		}//end if



		
		// If none of cases hit, just make args and run it
		if( function_flag == 0 )
		{
			argc = makeargs( s, &argv, " \t\n" );
			if( strcmp(argv[0], "alias") == 0)
			{
				argc = makeargs( s, &argv, " ");
				Node * newAlias = buildNode_alias( buildType_alias( s ));
				addLast( alias_list, newAlias);
				printf("Current list of Alias's:\n");
				printList( alias_list, printType_alias ); //See list of alias's
			}//end if
			
			
			
			
/* --was using for alias structure, currently broken, causes a segfault.
			else
			{
				//checkAlias( s, alias_list, &execute ); // lastly we should check for an alias call
				//return value of 1 will execute the alias
				
				Node * cur = alias_list->head->next;
				Alias * run_al;
				if(*(execute + 0) == 1)
				{
					for( x = 0; x < *(execute + 1); x++ )
					cur = cur->next;
				
					run_al = convert_data_Alias( cur->data );
					forkIt( run_al->command );
				}//end if
			}//end else
*/
				
			if ( strcmp( argv[0], "cd" ) == 0 )
				dir = chdir( argv[1] );

	  		if( argc != -1 )
	  			forkIt( argv );
	  
	  		clean( argc, argv );
	  		argv = NULL;
		}//end else

//////////////////////////////////////////////////////////////////////////////////////////
		
			
		
		// Re-prompt for input
		printf( "command?: " );
		fgets( s, MAX, stdin );
      		strip( s );

  	}// end while

	//--Write .mssh_history file
	setStart( hist_list, 1 );
        printSection( hist_list, printType_histfile, 1 );

	//--Clean: history
	clearList( hist_list, cleanType_hist );
   	free( hist_list );
   	hist_list = NULL;
	//
	//--Clean: alias
	clearList( alias_list, cleanType_alias );
	free( alias_list );
	alias_list = NULL;
	//free( execute );
	//
	//  Finished cleaning up memory
	//  Safe to return.

  	return 0;

}// end main
Esempio n. 27
0
static void onKey(
    HWND hwnd, UINT vk, BOOL fDown, int cRepeat, UINT flags )
{
    long start = getStart( hwnd );
    long end   = getEnd( hwnd );

    const BOOL controlKey = GetAsyncKeyState( VK_CONTROL ) < 0;

    if ( VK_ESCAPE == vk ) {
        if ( htNone != getHTCode( hwnd ) ) {
            setHTCode( hwnd, htNone );
            const LONG oldStart = getSaveStart( hwnd );
            const LONG oldEnd   = getSaveEnd  ( hwnd );
            setStart( hwnd, oldStart );
            setEnd  ( hwnd, oldEnd   );
            invalidateRect( hwnd );
            //onLButtonUp( hwnd, 0, 0, 0 ); // TODO retain capture anyway?
            // TODO notify parent
            return; //** FUNCTION EXIT POINT
        }
    }

    const UINT left_key  = isVertical( hwnd ) ? VK_UP   : VK_LEFT ;
    const UINT right_key = isVertical( hwnd ) ? VK_DOWN : VK_RIGHT;

    long granularity = getGranularity( hwnd );
    if ( granularity <= 0 ) {
        granularity = 1;
    }

    if ( left_key == vk ) {
        if ( controlKey ) {
            if ( getMinRange( hwnd ) < end - start ) {
                end -= granularity;
            }
        } else if ( getLower( hwnd ) < start ) {
            start -= granularity;
            end   -= granularity;
        }
    } else if ( right_key == vk ) {
        if ( end < getUpper( hwnd ) ) {
            end += granularity;
            if ( !controlKey ) {
                start += granularity;
            }
        }
    } else if ( VK_PRIOR == vk ) {
        scroll( hwnd, -1, 0 );
        return; //*** FUNCTION EXIT POINT
    } else if ( VK_NEXT == vk ) {
        scroll( hwnd, 1, 0 );
        return; //*** FUNCTION EXIT POINT
    } else if ( VK_HOME == vk ) {
        const long range = abs( getLower( hwnd ) - start );
        start -= range;
        end   -= range;
    } else if ( VK_END == vk ) {
        const long range = abs( getUpper( hwnd ) - end );
        start += range;
        end   += range;
    }

    start = adjust( hwnd, start );
    end   = adjust( hwnd, end   );
    if ( start != getStart( hwnd ) || end != getEnd( hwnd ) ) {
        setStart( hwnd, start );
        setEnd  ( hwnd, end );
        invalidateRect( hwnd );
        invalidateCursor();
        notifyParent( hwnd );
    }
}
Esempio n. 28
0
Clock::Clock() { setStart(0); }
Esempio n. 29
0
main(){
  int events=10; // number of events to generate
  int n, i;

  char *options[]={
    "-seed=1 -user -sdec -raw -rw=0",
    "-seed=1 -user -Emu=1.e7 -Enm=1.e6 -Ene=1.e6 -sdec -raw",
    "-seed=1 -user -sdec -raw -prop"
  };

  double r, z1=0, z2=0, h1=0, h2=0, nx=0, ny=0, nz=0, e1=0, e2=0, ec=0;

  initJre();

  // setStderr("mmc.log");
  printf("\nRunning %s\n", "tfa/Amanda (1)");
  initMMC(options[0], 1);

  for(n=0; n<events; n++){
    printf("Event %i\n", n);
    setStart(1);
    name="mu-";
    x=1;    // [m]
    y=2;    // [m]
    z=1000; // [m]
    theta=0;
    phi=0;
    e=2000; // [GeV]
    t=0;    // [s]
    propagate(name, x*1.e2, y*1.e2, z*1.e2, 180-theta, phi<180?phi+180:phi-180, e*1.e3, t);

    resultsOut();

    r=getDouble("r", 1);
    e=getDouble("e", 1);
    z1=getDouble("z1", 2);
    z2=getDouble("z2", 2);
    h1=getDouble("h1", 2);
    h2=getDouble("h2", 2);
    nx=getDouble("nx", 2);
    ny=getDouble("ny", 2);
    nz=getDouble("nz", 2);
    e1=getDouble("e1", 2);
    e2=getDouble("e2", 2);
    ec=getDouble("ec", 2);

    r*=1.e-2; e*=1.e-3;
    printf("%g %g %g %g %g %g %g %g %g %g %g %g\n", r, e, z1, z2, h1, h2, nx, ny, nz, e1, e2, ec);
    setStart(0);
    printf("EVENT WEIGHT = %g at %g\n", getDouble("fw", 2), getDouble("hw", 2));
    endProp();
  }
  deleteMMC();

  printf("\nRunning %s\n", "gen/AtmFlux (2)");
  initMMC(options[1], 2);
  for(n=0; n<events; n++){
    createNext();
    resultsOut();
    endProp();
  }
  deleteMMC();

  printf("\nRunning %s\n", "gen/AtmFlux (3)");
  initMMC(options[2], 3);
  for(n=0; n<events; n++){
    printf("Event %i\n", n);

    name="nu_tau";
    x=1;    // [m]
    y=2;    // [m]
    z=-5e6; // [m]
    theta=180;
    phi=0;
    e=1.e8; // [GeV]
    t=0;    // [s]
    propagate(name, x*1.e2, y*1.e2, z*1.e2, 180-theta, phi<180?phi+180:phi-180, e*1.e3, t);

    resultsOut();
    endProp();
  }
  deleteMMC();

  stopJre();
}
Esempio n. 30
0
void PrimeSieve::sieve(uint64_t start, uint64_t stop)
{
  setStart(start);
  setStop(stop);
  sieve();
}