static int chgroup(void) { int p=notAllowed,c; for(;;) { switch(sym) { case SYM_CHR: chkrch(val); case SYM_ESC: c=val; getsym(); if(sym==SYM_CHR&&val=='-') { if(regex[ri]=='[') { p=choice(p,newChar(c)); goto END_OF_GROUP; } else { getsym(); switch(sym) { case SYM_CHR: chkrch(val); case SYM_ESC: p=choice(p,newRange(c,val)); getsym(); break; default: error(RX_ER_BADCH); getsym(); break; } } } else { p=choice(p,newChar(c)); } break; case SYM_CLS: p=choice(p,cls(val)); getsym(); break; case SYM_END: error(RX_ER_NORSQ); goto END_OF_GROUP; default: assert(0); } if(sym==SYM_CHR&&(val==']'||val=='-')) goto END_OF_GROUP; } END_OF_GROUP:; return p; }
range_iterator Group::Delete(Range r, range_iterator range) { for (; range != rangeList.end(); range++) if (r.Intersects(*range) || r.IsBefore(*range)) break; if (range == rangeList.end()) return range; else if (r.Intersects(*range)) { range_iterator savedRange = range; if (r.Splits(*range)) { Range newRange(r.end(), range->end()); *range = Range(range->begin(), r.begin()); range = rangeList.insert(range+1, newRange); return range; } else { while (range != rangeList.end()) { if (r.Contains(*range)) { rangeList.erase(range); } else { *range = range->Difference(r); range++; } } } return savedRange; } else return range; }
LOCAL_C void DistinguishElement(const TPtrC& aElement, RArray<TRange>& aSelectiveCaseRange) { TInt colonOccurance = aElement.FindC(KTEFColon); //we are expecting only a range or a test case ID over here... if( colonOccurance!=KErrNotFound ) { //then this is a range of testcases, split it at the colon TRange newRange(aElement.Left(colonOccurance),aElement.Mid(colonOccurance+1)); aSelectiveCaseRange.Append(newRange); } else { TRange newRange(aElement,aElement); aSelectiveCaseRange.Append(newRange); } }
void KeywordItem::execute(Document* document, const Range& word) { if ( m_flags & ForceLineBeginning ) { Range newRange(Cursor(word.start().line(), 0), word.end()); document->replaceText(newRange, m_keyword); } else { document->replaceText(word, m_keyword); } }
Object * parseRange(Collector * c, Tokenizer * tt, Coord * ref1) { Coord * ref2 = NULL; TokenType t = tokenizerNext(tt); if (t != TOK_CELLID) goto fail; ref2 = parseReference(c, tt); if (!ref2) goto fail; return (Object *) newRange(c, ref1, ref2); fail: return NULL; }
AmEvent* ArpRhythmiCcFilter::HandleToolEvent( AmEvent* event, const am_filter_params* params, const am_tool_filter_params* toolParams) { if (!event || !params || !toolParams || !mMotion || !mHolder) return event; AmRange range(toolParams->start_time, toolParams->end_time); if (!range.IsValid()) return event; #if 0 printf("Create CC's for event at %lld", event->StartTime()); if (params->flags&AMFF_FIRST_EVENT) printf(" (first event)"); if (params->flags&AMFF_LAST_EVENT) printf(" (last event)"); printf("\n"); #endif if (toolParams->flags&AMFF_FIRST_EVENT) { // printf("%d - FIRST EVENT\n", mControlNumber); mLastRange.MakeInvalid(); } if (toolParams->flags&AMFF_LAST_EVENT) { // printf("\t%d - LAST EVENT\n", mControlNumber); AmRange newRange(range); //printf("%d - Last range is %lld to %lld, new range is %lld to %lld\n", mControlNumber, mLastRange.start, //mLastRange.end, newRange.start, newRange.end); if (mLastRange.IsValid() ) { if (mLastRange.Contains(newRange)) newRange.MakeInvalid(); else if (mLastRange.Overlaps(newRange)) newRange -= mLastRange; } if (newRange.IsValid()) { //printf("\t%d - generate events\n", mControlNumber); mLastRange = newRange; float amount = mAmount; float pixels = (float)(toolParams->orig_y_pixel - toolParams->cur_y_pixel) / 100; if (pixels > 1) pixels = 1; else if (pixels < -1) pixels = -1; amount = pixels; return GenerateRhythm(newRange, event, amount, params, toolParams); } } return event; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),ui(new Ui::MainWindow) { ui->setupUi(this); qDebug()<<QApplication::applicationVersion(); music = new MusicControl; netCore = new NetWorker; settings = new QSettings(this); settingsWindow = new PrefWindow(this); settingsWindow->setWindowFlags(Qt::Dialog); ui->lineEdit->setPlaceholderText("Search here"); ui->seekSlider->setRange(0,0); ui->repeatButton->hide(); isUnity = false; ///tray icon setup QAction *next = new QAction(tr("Next"),this); QAction *restore = new QAction(tr("Show window"),this); QAction *prev = new QAction(tr("Previous"),this); QAction *playPause = new QAction(tr("Play/Pause"),this); QAction *close = new QAction(tr("Exit"),this); connect(next,SIGNAL(triggered()),music,SLOT(playNextSong())); connect(prev,SIGNAL(triggered()),music,SLOT(playPrevSong())); connect(playPause,SIGNAL(triggered()),music,SLOT(changeState())); connect(close,SIGNAL(triggered()),qApp,SLOT(quit())); connect(restore,SIGNAL(triggered()),this,SLOT(show())); QMenu *trayIconMenu = new QMenu(this); trayIconMenu->addAction(restore); trayIconMenu->addAction(next); trayIconMenu->addAction(prev); trayIconMenu->addAction(playPause); trayIconMenu->addAction(close); trayIcon = new QSystemTrayIcon(QIcon(":/icons/qvk.svg")); trayIcon->setContextMenu(trayIconMenu); connect(trayIcon,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),this, SLOT(trayHandler(QSystemTrayIcon::ActivationReason))); //trayIcon->setVisible(true); //trayIcon->show(); ///table setting QStringList header; ui->musicWidget->setColumnCount(4); header <<"Artist"<<"Title"<<"Duration"<<"link"; //in case of unsuccesseful update.... ui->musicWidget->hideColumn(3); ui->musicWidget->setHorizontalHeaderLabels(header); ui->musicWidget->verticalHeader()->setVisible(false); ui->musicWidget->setShowGrid(false); ui->musicWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); ui->musicWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); ui->musicWidget->setSelectionBehavior(QAbstractItemView::SelectRows); ui->musicWidget->setSelectionMode(QAbstractItemView::SingleSelection); ////////////////////////////////////////////////Creating actions QAction *login = new QAction(tr("Login"),this); QAction *About = new QAction(tr("About"),this); QAction *refrsh = new QAction(tr("Refresh"),this); QAction *showSettingsWindow = new QAction(tr("Settings"),this); connect(showSettingsWindow, SIGNAL(triggered()),settingsWindow,SLOT(show())); connect(refrsh,SIGNAL(triggered()), netCore, SLOT(getAudioList())); connect(login, SIGNAL(triggered()), netCore, SLOT(loginSlot())); connect(About, SIGNAL(triggered()), this, SLOT(about())); ////////////////////////////////////////////////Creating menu QMenu *gearButtonMenu = new QMenu("Options", ui->toolButton); gearButtonMenu->addAction(refrsh); gearButtonMenu->addAction(login); gearButtonMenu->addAction(showSettingsWindow); gearButtonMenu->addSeparator(); gearButtonMenu->addAction(About); gearButtonMenu->addAction(close); ///////////////////////////////////////////////making menu button ui->toolButton->setMenu(gearButtonMenu); ///connection area connect(this,SIGNAL(setPlayingOrder(QList<QUrl>)),music,SLOT(setPlayList(QList<QUrl>))); connect(ui->volumeSlider,SIGNAL(valueChanged(int)),music,SLOT(volumeSliderSlot(int))); connect(ui->musicWidget,SIGNAL(cellDoubleClicked(int,int)),music,SLOT(playThatSong(int,int))); connect(ui->shuffButton,SIGNAL(toggled(bool)),music,SLOT(shuffleMode(bool))); connect(ui->nextButton,SIGNAL(clicked()),music,SLOT(playNextSong())); connect(music,SIGNAL(setIndexToUi(int,int)),this,SLOT(setSongUi(int,int))); connect(ui->prevButton,SIGNAL(clicked()),music,SLOT(playPrevSong())); connect(ui->tooglePlayingButton,SIGNAL(clicked()),music,SLOT(changeState())); connect(music,SIGNAL(setPlayingUi()),this,SLOT(setPlayingUi())); connect(music,SIGNAL(setPausedUi()),this,SLOT(setPausedUi())); connect(ui->seekSlider,SIGNAL(sliderMoved(int)),music,SLOT(setPosition(int))); connect(music,SIGNAL(newPosition(qint64)),this,SLOT(positionChanged(qint64))); connect(music,SIGNAL(newRange(qint64)),this,SLOT(durationChanged(qint64))); connect(ui->lineEdit,SIGNAL(textChanged(QString)),this,SLOT(currentSearch(QString))); connect(this,SIGNAL(loadToken(QString,QString)),netCore,SLOT(setToken(QString,QString))); connect(netCore,SIGNAL(audioListGet(QList<QUrl>)),music,SLOT(setPlayList(QList<QUrl>))); connect(ui->musicWidget,SIGNAL(cellClicked(int,int)),music,SLOT(setSelectedSong(int,int))); connect(ui->repeatButton,SIGNAL(clicked(bool)),music,SLOT(repeatMode(bool))); connect(netCore,SIGNAL(dataGot()),this,SLOT(setMusicTable())); connect(this,SIGNAL(setPrefWindowsHotkeysUi(bool,bool)),settingsWindow,SLOT(setUseHotkeysUi(bool,bool))); connect(this,SIGNAL(setMinToTray(bool)),settingsWindow,SLOT(setUseMinTray(bool))); connect(settingsWindow,SIGNAL(setNewSettings(bool,bool,bool,QString,bool)), this,SLOT(setNewSettings(bool,bool,bool,QString,bool))); ///connection area ///DBUS setting #ifdef Q_OS_LINUX DBusMethods* demo = new DBusMethods(); new DBusAdaptor(demo); new DBusAdaptor1(demo); QDBusConnection connection = QDBusConnection::sessionBus(); bool ret = connection.registerService("org.mpris.MediaPlayer2.qvkplayer.mainwindow"); ret = connection.registerObject("/org/mpris/MediaPlayer2", demo); connect(demo,SIGNAL(dbusNext()),ui->nextButton,SIGNAL(clicked())); connect(demo,SIGNAL(dbusPlayPause()),ui->tooglePlayingButton,SIGNAL(clicked())); connect(demo,SIGNAL(dbusPrev()),ui->prevButton,SIGNAL(clicked())); connect(demo,SIGNAL(dbusQuit()),qApp,SLOT(quit())); connect(demo,SIGNAL(dbusRaise()),this,SLOT(show())); #endif ///DBUS setting ///CONFIG LOADING================================== this->loadSettings(); }
void ComboChannel::newBandSelected(int item) { QVariant variant = itemData(item); emit newRange(variant.value<QString>()); }
void TimeRange::trim(const TimeRange& limits) { TimeRange newRange(std::max(start, limits.start), std::min(end, limits.end)); resize(newRange); }
int Gui::drawPage( LGraphicsView *view, QGraphicsScene *scene, Steps *steps, int stepNum, QString const &addLine, Where ¤t, QStringList &csiParts, QStringList &pliParts, bool isMirrored, QHash<QString, QStringList> &bfx, bool printing, bool bfxStore2, QStringList &bfxParts, bool calledOut) { bool global = true; QString line; Callout *callout = NULL; Range *range = NULL; Step *step = NULL; bool pliIgnore = false; bool partIgnore = false; bool synthBegin = false; bool multiStep = false; bool partsAdded = false; bool coverPage = false; bool bfxStore1 = false; bool bfxLoad = false; int numLines = ldrawFile.size(current.modelName); bool firstStep = true; steps->isMirrored = isMirrored; QList<InsertMeta> inserts; Where topOfStep = current; Rc gprc = OkRc; Rc rc; statusBar()->showMessage("Processing " + current.modelName); page.coverPage = false; QStringList calloutParts; /* * do until end of page */ for ( ; current <= numLines; current++) { Meta &curMeta = callout ? callout->meta : steps->meta; QStringList tokens; // If we hit end of file we've got to note end of step if (current >= numLines) { line.clear(); gprc = EndOfFileRc; tokens << "0"; // not end of file, so get the next LDraw line } else { line = ldrawFile.readLine(current.modelName,current.lineNumber); split(line,tokens); } if (tokens.size() == 15 && tokens[0] == "1") { QString color = tokens[1]; QString type = tokens[tokens.size()-1]; csiParts << line; partsAdded = true; /* since we have a part usage, we have a valid step */ if (step == NULL) { if (range == NULL) { range = newRange(steps,calledOut); steps->append(range); } step = new Step(topOfStep, range, stepNum, curMeta, calledOut, multiStep); range->append(step); } /* addition of ldraw parts */ if (curMeta.LPub.pli.show.value() && ! pliIgnore && ! partIgnore && ! synthBegin) { QString colorType = color+type; if (! isSubmodel(type) || curMeta.LPub.pli.includeSubs.value()) { if (bfxStore2 && bfxLoad) { bool removed = false; for (int i = 0; i < bfxParts.size(); i++) { if (bfxParts[i] == colorType) { bfxParts.removeAt(i); removed = true; break; } } if ( ! removed) { pliParts << Pli::partLine(line,current,steps->meta); } } else { pliParts << Pli::partLine(line,current,steps->meta); } } if (bfxStore1) { bfxParts << colorType; } } /* if it is a sub-model, then process it */ if (ldrawFile.contains(type) && callout) { /* we are a callout, so gather all the steps within the callout */ /* start with new meta, but no rotation step */ if (callout->bottom.modelName != type) { Where current2(type,0); skipHeader(current2); callout->meta.rotStep.clear(); SubmodelStack tos(current.modelName,current.lineNumber,stepNum); callout->meta.submodelStack << tos; Meta saveMeta = callout->meta; callout->meta.LPub.pli.constrain.resetToDefault(); step->append(callout); calloutParts.clear(); QStringList csiParts2; QHash<QString, QStringList> calloutBfx; int rc; rc = drawPage( view, scene, callout, 1, line, current2, csiParts2, calloutParts, ldrawFile.mirrored(tokens), calloutBfx, printing, bfxStore2, bfxParts, true); callout->meta = saveMeta; if (callout->meta.LPub.pli.show.value() && ! callout->meta.LPub.callout.pli.perStep.value() && ! pliIgnore && ! partIgnore && ! synthBegin) { pliParts += calloutParts; } if (rc != 0) { steps->placement = steps->meta.LPub.assem.placement; return rc; } } else { callout->instances++; pliParts += calloutParts; } /* remind user what file we're working on */ statusBar()->showMessage("Processing " + current.modelName); } } else if (tokens.size() > 0 && (tokens[0] == "2" || tokens[0] == "3" || tokens[0] == "4" || tokens[0] == "5")) { csiParts << line; partsAdded = true; /* we've got a line, triangle or polygon, so add it to the list */ /* and make sure we know we have a step */ if (step == NULL) { if (range == NULL) { range = newRange(steps,calledOut); steps->append(range); } step = new Step(topOfStep, range, stepNum, steps->meta, calledOut, multiStep); range->append(step); } } else if (tokens.size() > 0 && tokens[0] == "0" || gprc == EndOfFileRc) { /* must be meta-command (or comment) */ if (global && tokens.contains("!LPUB") && tokens.contains("GLOBAL")) { topOfStep = current; } else { global = false; } QString part; if (gprc == EndOfFileRc) { rc = gprc; } else { rc = curMeta.parse(line,current,true); } /* handle specific meta-commands */ switch (rc) { /* toss it all out the window, per James' original plan */ case ClearRc: pliParts.clear(); csiParts.clear(); steps->freeSteps(); break; /* Buffer exchange */ case BufferStoreRc: bfx[curMeta.bfx.value()] = csiParts; bfxStore1 = true; bfxParts.clear(); break; case BufferLoadRc: csiParts = bfx[curMeta.bfx.value()]; bfxLoad = true; break; case MLCadGroupRc: csiParts << line; break; case IncludeRc: include(curMeta); break; /* substitute part/parts with this */ case PliBeginSub1Rc: if (pliIgnore) { parseError("Nested PLI BEGIN/ENDS not allowed\n",current); } if (steps->meta.LPub.pli.show.value() && ! pliIgnore && ! partIgnore && ! synthBegin) { SubData subData = curMeta.LPub.pli.begin.sub.value(); QString addPart = QString("1 0 0 0 0 0 0 0 0 0 0 0 0 0 %1") .arg(subData.part); pliParts << Pli::partLine(addPart,current,curMeta); } if (step == NULL) { if (range == NULL) { range = newRange(steps,calledOut); steps->append(range); } step = new Step(topOfStep, range, stepNum, curMeta, calledOut, multiStep); range->append(step); } pliIgnore = true; break; /* substitute part/parts with this */ case PliBeginSub2Rc: if (pliIgnore) { parseError("Nested BEGIN/ENDS not allowed\n",current); } if (steps->meta.LPub.pli.show.value() && ! pliIgnore && ! partIgnore && ! synthBegin) { SubData subData = curMeta.LPub.pli.begin.sub.value(); QString addPart = QString("1 %1 0 0 0 0 0 0 0 0 0 0 0 0 %2") .arg(subData.color) .arg(subData.part); pliParts << Pli::partLine(addPart,current,curMeta); } if (step == NULL) { if (range == NULL) { range = newRange(steps,calledOut); steps->append(range); } step = new Step(topOfStep, range, stepNum, curMeta, calledOut, multiStep); range->append(step); } pliIgnore = true; break; /* do not put subsequent parts into PLI */ case PliBeginIgnRc: if (pliIgnore) { parseError("Nested BEGIN/ENDS not allowed\n",current); } pliIgnore = true; break; case PliEndRc: if ( ! pliIgnore) { parseError("PLI END with no PLI BEGIN",current); } pliIgnore = false; break; /* discard subsequent parts, and don't create CSI's for them */ case PartBeginIgnRc: case MLCadSkipBeginRc: if (partIgnore) { parseError("Nested BEGIN/ENDS not allowed\n",current); } partIgnore = true; break; case PartEndRc: case MLCadSkipEndRc: if (partIgnore) { parseError("Ignore ending with no ignore begin",current); } partIgnore = false; break; case SynthBeginRc: if (synthBegin) { parseError("Nested BEGIN/ENDS not allowed\n",current); } synthBegin = true; break; case SynthEndRc: if ( ! synthBegin) { parseError("Ignore ending with no ignore begin",current); } synthBegin = false; break; /* remove a group or all instances of a part type */ case GroupRemoveRc: case RemoveGroupRc: case RemovePartRc: case RemoveNameRc: { QStringList newCSIParts; if (rc == RemoveGroupRc) { remove_group(csiParts,steps->meta.LPub.remove.group.value(),newCSIParts); } else if (rc == RemovePartRc) { remove_parttype(csiParts, steps->meta.LPub.remove.parttype.value(),newCSIParts); } else { remove_partname(csiParts, steps->meta.LPub.remove.partname.value(),newCSIParts); } csiParts = newCSIParts; if (step == NULL) { if (range == NULL) { range = newRange(steps,calledOut); steps->append(range); } step = new Step(topOfStep, range, stepNum, curMeta, calledOut, multiStep); range->append(step); } } break; case ReserveSpaceRc: /* since we have a part usage, we have a valid step */ if (calledOut || multiStep) { step = NULL; Reserve *reserve = new Reserve(current,steps->meta.LPub); if (range == NULL) { range = newRange(steps,calledOut); steps->append(range); } range->append(reserve); } break; case InsertCoverPageRc: coverPage = true; page.coverPage = true; case InsertPageRc: partsAdded = true; break; case InsertRc: inserts.append(curMeta.LPub.insert); // these are always placed before any parts in step break; case CalloutBeginRc: if (callout) { parseError("Nested CALLOUT not allowed within the same file",current); } else { callout = new Callout(curMeta,view); callout->setTopOfCallout(current); } break; case CalloutDividerRc: if (range) { range->sepMeta = curMeta.LPub.callout.sep; range = NULL; step = NULL; } break; case CalloutPointerRc: if (callout) { callout->appendPointer(current,curMeta.LPub.callout); } break; case CalloutEndRc: if ( ! callout) { parseError("CALLOUT END without a CALLOUT BEGIN",current); } else { callout->parentStep = step; callout->parentRelativeType = step->relativeType; callout->pli.clear(); callout->placement = curMeta.LPub.callout.placement; callout->setBottomOfCallout(current); callout = NULL; } break; case StepGroupBeginRc: if (calledOut) { parseError("MULTI_STEP not allowed inside callout models",current); } else { if (multiStep) { parseError("Nested MULTI_STEP not allowed",current); } multiStep = true; } steps->relativeType = StepGroupType; break; case StepGroupDividerRc: if (range) { range->sepMeta = steps->meta.LPub.multiStep.sep; range = NULL; step = NULL; } break; /* finished off a multiStep */ case StepGroupEndRc: if (multiStep) { // save the current meta as the meta for step group // PLI for non-pli-per-step if (partsAdded) { parseError("Expected STEP before MULTI_STEP END", current); } multiStep = false; if (pliParts.size() && steps->meta.LPub.multiStep.pli.perStep.value() == false) { steps->pli.bom = false; steps->pli.setParts(pliParts,steps->stepGroupMeta); steps->pli.sizePli(&steps->stepGroupMeta, StepGroupType, false); } pliParts.clear(); /* this is a page we're supposed to process */ steps->placement = steps->meta.LPub.multiStep.placement; showLine(steps->topOfSteps()); bool endOfSubmodel = stepNum == ldrawFile.numSteps(current.modelName); int instances = ldrawFile.instances(current.modelName,isMirrored); addGraphicsPageItems(steps, coverPage, endOfSubmodel,instances, view, scene,printing); return HitEndOfPage; } break; /* we're hit some kind of step, or implied step and end of file */ case EndOfFileRc: case RotStepRc: case StepRc: if ( ! partsAdded && bfxLoad) { // special case of no parts added, but BFX load if (step == NULL) { if (range == NULL) { range = newRange(steps,calledOut); steps->append(range); } step = new Step(topOfStep, range, stepNum, curMeta, calledOut, multiStep); range->append(step); } int rc = step->createCsi( isMirrored ? addLine : "1 color 0 0 0 1 0 0 0 1 0 0 0 1 foo.ldr", csiParts, &step->csiPixmap, steps->meta); partsAdded = true; // OK, so this is a lie, but it works } if (partsAdded) { if (firstStep) { steps->stepGroupMeta = curMeta; firstStep = false; } if (pliIgnore) { parseError("PLI BEGIN then STEP. Expected PLI END",current); pliIgnore = false; } if (partIgnore) { parseError("PART BEGIN then STEP. Expected PART END",current); partIgnore = false; } if (synthBegin) { parseError("SYNTH BEGIN then STEP. Expected SYNTH_END",current); synthBegin = false; } bool pliPerStep; if (multiStep && steps->meta.LPub.multiStep.pli.perStep.value()) { pliPerStep = true; } else if (calledOut && steps->meta.LPub.callout.pli.perStep.value()) { pliPerStep = true; } else if ( ! multiStep && ! calledOut) { pliPerStep = true; } else { pliPerStep = false; } if (step) { Page *page = dynamic_cast<Page *>(steps); if (page) { page->inserts = inserts; } if (pliPerStep) { PlacementType relativeType; if (multiStep) { relativeType = StepGroupType; } else if (calledOut) { relativeType = CalloutType; } else { relativeType = SingleStepType; } step->pli.setParts(pliParts,steps->meta); pliParts.clear(); step->pli.sizePli(&steps->meta,relativeType,pliPerStep); } int rc = step->createCsi( isMirrored ? addLine : "1 color 0 0 0 1 0 0 0 1 0 0 0 1 foo.ldr", csiParts, &step->csiPixmap, steps->meta); statusBar()->showMessage("Processing " + current.modelName); if (rc) { return rc; } } else { if (pliPerStep) { pliParts.clear(); } /* * Only pages or step can have inserts.... no callouts */ if ( ! multiStep && ! calledOut) { Page *page = dynamic_cast<Page *>(steps); if (page) { page->inserts = inserts; } } } if ( ! multiStep && ! calledOut) { /* * Simple step */ if (steps->list.size() == 0) { steps->relativeType = PageType; } steps->placement = steps->meta.LPub.assem.placement; showLine(topOfStep); int numSteps = ldrawFile.numSteps(current.modelName); bool endOfSubmodel = numSteps == 0 || stepNum == numSteps; int instances = ldrawFile.instances(current.modelName,isMirrored); addGraphicsPageItems(steps,coverPage,endOfSubmodel,instances,view,scene,printing); stepPageNum += ! coverPage; steps->setBottomOfSteps(current); return HitEndOfPage; } steps->meta.pop(); stepNum += partsAdded; topOfStep = current; partsAdded = false; coverPage = false; step = NULL; bfxStore2 = bfxStore1; bfxStore1 = false; bfxLoad = false; } inserts.clear(); steps->setBottomOfSteps(current); break; case RangeErrorRc: showLine(current); QMessageBox::critical(NULL, QMessageBox::tr("LPub"), QMessageBox::tr("Parameter(s) out of range: %1:%2\n%3") .arg(current.modelName) .arg(current.lineNumber) .arg(line)); return RangeErrorRc; break; default: break; } } else if (line != "") { showLine(current); QMessageBox::critical(NULL, QMessageBox::tr("LPub"), QMessageBox::tr("Invalid LDraw Line Type: %1:%2\n %3") .arg(current.modelName) .arg(current.lineNumber) .arg(line)); return InvalidLDrawLineRc; } } steps->meta.rotStep.clear(); return 0; }
void Channel::frameAssemble( const eq::uint128_t& ) { const bool composeOnly = (_drawRange == eq::Range::ALL); _startAssemble(); const eq::Frames& frames = getInputFrames(); eq::PixelViewport coveredPVP; eq::Frames dbFrames; eq::Zoom zoom( eq::Zoom::NONE ); // Make sure all frames are ready and gather some information on them for( eq::Frames::const_iterator i = frames.begin(); i != frames.end(); ++i ) { eq::Frame* frame = *i; { eq::ChannelStatistics stat( eq::Statistic::CHANNEL_FRAME_WAIT_READY, this ); frame->waitReady( ); } const eq::Range& range = frame->getRange(); if( range == eq::Range::ALL ) // 2D frame, assemble directly eq::Compositor::assembleFrame( frame, this ); else { dbFrames.push_back( frame ); zoom = frame->getZoom(); _expandPVP( coveredPVP, frame->getImages(), frame->getOffset() ); } } coveredPVP.intersect( getPixelViewport( )); if( dbFrames.empty( )) { resetAssemblyState(); return; } // calculate correct frames sequence eq::FrameDataPtr data = _frame.getFrameData(); if( !composeOnly && coveredPVP.hasArea( )) { _frame.clear(); data->setRange( _drawRange ); dbFrames.push_back( &_frame ); } _orderFrames( dbFrames ); // Update range eq::Range newRange( 1.f, 0.f ); for( size_t i = 0; i < dbFrames.size(); ++i ) { const eq::Range range = dbFrames[i]->getRange(); if( newRange.start > range.start ) newRange.start = range.start; if( newRange.end < range.end ) newRange.end = range.end; } _drawRange = newRange; // check if current frame is in proper position, read back if not if( !composeOnly ) { if( _bgColor == eq::Vector3f::ZERO && dbFrames.front() == &_frame ) dbFrames.erase( dbFrames.begin( )); else if( coveredPVP.hasArea()) { eq::util::ObjectManager& glObjects = getObjectManager(); _frame.setOffset( eq::Vector2i( 0, 0 )); _frame.setZoom( zoom ); data->setPixelViewport( coveredPVP ); _frame.readback( glObjects, getDrawableConfig(), getRegions( )); clearViewport( coveredPVP ); // offset for assembly _frame.setOffset( eq::Vector2i( coveredPVP.x, coveredPVP.y )); } } // blend DB frames in order try { eq::Compositor::assembleFramesSorted( dbFrames, this, 0, true /*blendAlpha*/ ); } catch( const co::Exception& e ) { LBWARN << e.what() << std::endl; } resetAssemblyState(); }