Node* TreeWalker::nextNode(ScriptState* state) { RefPtr<Node> node = m_current; Children: while (Node* firstChild = node->firstChild()) { node = firstChild; short acceptNodeResult = acceptNode(state, node.get()); if (state && state->hadException()) return 0; if (acceptNodeResult == NodeFilter::FILTER_ACCEPT) return setCurrent(node.release()); if (acceptNodeResult == NodeFilter::FILTER_REJECT) break; } while (Node* nextSibling = node->traverseNextSibling(root())) { node = nextSibling; short acceptNodeResult = acceptNode(state, node.get()); if (state && state->hadException()) return 0; if (acceptNodeResult == NodeFilter::FILTER_ACCEPT) return setCurrent(node.release()); if (acceptNodeResult == NodeFilter::FILTER_SKIP) goto Children; } return 0; }
/*\reimp */ void WellArray::keyPressEvent(QKeyEvent* e) { switch(e->key()) { // Look at the key code case Qt::Key_Left: // If 'left arrow'-key, if (curCol > 0) // and cr't not in leftmost col setCurrent(curRow, curCol - 1); // set cr't to next left column break; case Qt::Key_Right: // Correspondingly... if (curCol < numCols()-1) setCurrent(curRow, curCol + 1); break; case Qt::Key_Up: if (curRow > 0) setCurrent(curRow - 1, curCol); break; case Qt::Key_Down: if (curRow < numRows()-1) setCurrent(curRow + 1, curCol); break; case Qt::Key_Space: setSelected(curRow, curCol); break; default: // If not an interesting key, e->ignore(); // we don't accept the event return; } }
ushort TGroup::execView( TView* p) { if( p == 0 ) return cmCancel; ushort saveOptions = p->options; TGroup *saveOwner = p->owner; TView *saveTopView = TheTopView; TView *saveCurrent= current; TCommandSet saveCommands; getCommands( saveCommands ); TheTopView = p; p->options = p->options & ~ofSelectable; p->setState(sfModal, True); setCurrent(p, enterSelect); if( saveOwner == 0 ) insert(p); ushort retval = p->execute(); if( saveOwner == 0 ) remove(p); setCurrent(saveCurrent, leaveSelect); p->setState(sfModal, False); p->options = saveOptions; TheTopView = saveTopView; setCommands(saveCommands); return retval; }
void TeamHolder::load() { QSettings s; m_teams.clear(); if (!s.contains("Teams/Locations")) { addTeam(); setCurrent(0); } else { QStringList l = s.value("Teams/Locations").toStringList(); for (int i = 0; i < l.length(); i++) { addTeam(); team(i).loadFromFile(l[i]); } if (count() == 0) { addTeam(); setCurrent(0); } else { if (currentTeam() >= count()) { setCurrent(count()-1); } } } if (!team().path().isEmpty()) { s.setValue("Teams/Folder", team().folder()); } profile().loadFromFile(s.value("Profile/Current").toString()); }
Node* TreeWalker::nextNode(JSValue*& exception) { exception = 0; RefPtr<Node> node = m_current; Children: while (Node* firstChild = node->firstChild()) { node = firstChild; short acceptNodeResult = acceptNode(node.get(), exception); if (exception) return 0; if (acceptNodeResult == NodeFilter::FILTER_ACCEPT) return setCurrent(node.release()); if (acceptNodeResult == NodeFilter::FILTER_REJECT) break; } while (Node* nextSibling = node->traverseNextSibling(root())) { node = nextSibling; short acceptNodeResult = acceptNode(node.get(), exception); if (exception) return 0; if (acceptNodeResult == NodeFilter::FILTER_ACCEPT) return setCurrent(node.release()); if (acceptNodeResult == NodeFilter::FILTER_SKIP) goto Children; } return 0; }
/** * \brief disable automatic white balance */ void UVCCamera::disableAutoWhiteBalance() { // turn of the white balance temperature control white_balance_temperature_auto_control_t wbtempauto; wbtempauto.bWhiteBalanceTemperatureAuto = 0; if (controlSupported(wbtempauto)) { debug(LOG_DEBUG, DEBUG_LOG, 0, "turn off auto white balance temperature"); setCurrent(wbtempauto); } else { debug(LOG_DEBUG, DEBUG_LOG, 0, "white balance temperature auto control not supported"); } // turn of automatic white balance component adjustmen white_balance_component_auto_control_t wbcompauto; wbcompauto.bWhiteBalanceComponentAuto = 0; if (controlSupported(wbcompauto)) { debug(LOG_DEBUG, DEBUG_LOG, 0, "turn off auto white balance components"); setCurrent(wbcompauto); } else { debug(LOG_DEBUG, DEBUG_LOG, 0, "white balance component auto control not supported"); } // set the white balance temperature white_balance_temperature_control_t wbtemp; if (controlSupported(wbtemp)) { wbtemp = get(GET_DEF, wbtemp); setCurrent(wbtemp); debug(LOG_DEBUG, DEBUG_LOG, 0, "white balance temperature set to %hu", wbtemp.wWhiteBalanceTemperature); return; } else { debug(LOG_DEBUG, DEBUG_LOG, 0, "white balance temperature control not supported"); } // if white balance temperature setting is not supported, try // setting components white_balance_component_control_t wbcomp; if (controlSupported(wbcomp)) { wbcomp = get(GET_CUR, wbcomp); debug(LOG_DEBUG, DEBUG_LOG, 0, "current White Balance components B = %hu, R = %hu", wbcomp.wWhiteBalanceBlue, wbcomp.wWhiteBalanceRed); wbcomp = get(GET_DEF, wbcomp); wbcomp.wWhiteBalanceBlue += 10; setCurrent(wbcomp); debug(LOG_DEBUG, DEBUG_LOG, 0, "white balance components set to B = %hu, R = %hu", wbcomp.wWhiteBalanceBlue, wbcomp.wWhiteBalanceRed); } else { debug(LOG_DEBUG, DEBUG_LOG, 0, "white balance component control not supported"); } }
/******************* Verander de status van de lader. Deze functie moet gebruikt worden aangezien bepaalde combinaties van relaystanden niet goed zijn voor de batterij mogelijke status: USE CHARGING DISCHARGING *******************/ int setState(enum status new_state){ if (new_state == status) return 1; // Huidige status bepaalt overgangsmethode switch (status) { case CHARGING: // Stel stroom in op 0A setCurrent(0); if (new_state == DISCHARGING) { // Ontkoppel de lader turnOff(); // Schakel naar ontladen discharge(); // Koppel lader turnOn(); // Stel stroom in op gewenste waarde // TODO: gewenste stroom instellen }else if (new_state == USE){ // Veilig ontkoppelen na opladen // Schakel naar ontladen discharge(); // Ontkoppel de lader turnOff(); } break; case DISCHARGING: // Stel stroom in op 0A setCurrent(0); // Ontkoppel de lader turnOff(); if (new_state == CHARGING){ // Schakel naar opladen charge(); // Koppel de lader turnOn(); } break; case USE: if (new_state == DISCHARGING) { // Schakel naar ontladen discharge(); //instellen van de stroom setCurrentCharger(0); // Koppel de lader turnOn(); // Stel stroom in // TODO: gewenste stroom instellen }else if (new_state == CHARGING){ // Schakel naar opladen charge(); // Koppel de lader turnOn(); // Stel stroom in // TODO: gewenste stroom instellen } break; default: break; } return 0; }
void evaluate() { if(m_binding) { if(m_binding_init) { m_value = m_binding(); if(m_notifier) { m_notifier(m_value); } } else { // capture inputs for this property m_capture_failed = false; setCurrent(this); m_value = m_binding(); setCurrent(nullptr); if(!m_capture_failed) { m_binding_init = true; if(m_notifier) { m_notifier(m_value); } } else { resetBinding(); } } } }
Node* TreeWalker::nextNode(ExceptionState& exceptionState) { RefPtrWillBeRawPtr<Node> node = m_current; Children: while (Node* firstChild = node->firstChild()) { node = firstChild; unsigned acceptNodeResult = acceptNode(node.get(), exceptionState); if (exceptionState.hadException()) return 0; if (acceptNodeResult == NodeFilter::FILTER_ACCEPT) return setCurrent(node.release()); if (acceptNodeResult == NodeFilter::FILTER_REJECT) break; } while (Node* nextSibling = NodeTraversal::nextSkippingChildren(*node, root())) { node = nextSibling; unsigned acceptNodeResult = acceptNode(node.get(), exceptionState); if (exceptionState.hadException()) return 0; if (acceptNodeResult == NodeFilter::FILTER_ACCEPT) return setCurrent(node.release()); if (acceptNodeResult == NodeFilter::FILTER_SKIP) goto Children; } return 0; }
/** * \brief Set exposure time * * This sets the exposure priority as well */ void UVCCamera::setExposureTime(double exposuretime) { debug(LOG_DEBUG, DEBUG_LOG, 0, "setting auto exposure priority"); // we have to find out whether the auto_exposure_priority_control // is available on this camera astro::usb::uvc::auto_exposure_priority_control_t aeprio; // make sure time has priority // bAutoExposurePriority == 1 means that frame rate may be // altered dynamically aeprio.bAutoExposurePriority = 1; if (controlSupported(aeprio)) { debug(LOG_DEBUG, DEBUG_LOG, 0, "auto exposure priority control supported"); setCurrent(aeprio); } debug(LOG_DEBUG, DEBUG_LOG, 0, "setting auto exposure mode"); // set the auto exposure mode astro::usb::uvc::auto_exposure_mode_control_t aemode; // bAutoExposureMode == 1 means manual mode, manual iris aemode.bAutoExposureMode = 1; if (controlSupported(aemode)) { debug(LOG_DEBUG, DEBUG_LOG, 0, "auto exposure mode control supported"); setCurrent(aemode); } // check allowed min/max values of the exposure time astro::usb::uvc::exposure_time_absolute_control_t exptime; if (controlSupported(exptime)) { debug(LOG_DEBUG, DEBUG_LOG, 0, "exposure time absolute control supported"); // get min and max time exptime = get(GET_MIN, exptime); uint32_t minexp = exptime.dwExposureTimeAbsolute; exptime = get(GET_MAX, exptime); uint32_t maxexp = exptime.dwExposureTimeAbsolute; debug(LOG_DEBUG, DEBUG_LOG, 0, "exposure time min = %u, max = %u", minexp, maxexp); // set exposure time exptime.dwExposureTimeAbsolute = 10000 * exposuretime; if ((exptime.dwExposureTimeAbsolute < minexp) || (maxexp < exptime.dwExposureTimeAbsolute)) { debug(LOG_ERR, DEBUG_LOG, 0, "time %u out of range", exptime.dwExposureTimeAbsolute); throw std::range_error("exposure time not supported"); } else { debug(LOG_DEBUG, DEBUG_LOG, 0, "setting time %u", exptime.dwExposureTimeAbsolute); setCurrent(exptime); } } debug(LOG_DEBUG, DEBUG_LOG, 0, "exposure time set to %fs", exposuretime); }
//---------------------------------------------------------------------------- ctkCmdLineModuleObjectTreeWalker::TokenType ctkCmdLineModuleObjectTreeWalker::readNext() { if (AtEnd) return NoToken; QObject* curr = 0; if (CurrentObject == 0) { curr = RootObject; if (setCurrent(curr)) return CurrentToken; } else { curr = CurrentObject; } while (true) { if (curr) { QObjectList children = curr->children(); QListIterator<QObject*> i(children); i.toBack(); while (i.hasPrevious()) { ObjectStack.push(i.previous()); } if (children.isEmpty()) { curr = 0; } else { curr = ObjectStack.pop(); if (setCurrent(curr)) return CurrentToken; } continue; } if (ObjectStack.isEmpty()) break; curr = ObjectStack.pop(); if (setCurrent(curr)) return CurrentToken; } AtEnd = true; CurrentObject = 0; CurrentToken = NoToken; return NoToken; }
void Properties::setTimeValue( double tv ) { Q_ASSERT( tv <= 1.00001 && tv >= 0. ); _timeValue = tv; emit timeValueChanged( ); if ( qFuzzyCompare( 1. + tv, 1. + 1. ) ) // Force 1. value to _last to avoid rounding problems setCurrent( _last ); else { qint64 startToLastDelay = _first.msecsTo( _last ); Q_ASSERT( startToLastDelay > 0 ); setCurrent( _first.addMSecs( startToLastDelay * tv ) ); } }
void ViewController::addView(ControllableView *view,bool destroyOld) { ControllableView *tmpView = getView(view->type()); if(tmpView == view) return; ControllableView * cView = currentView(); if(tmpView) removeView(tmpView,destroyOld); m_views.append(view); m_currentViewIndex = -1; // reset index because it can be not valid if(cView) setCurrent(cView); // Check if the old current view was replaced by a new one and set new to current if(cView && !currentView()) setCurrent(view); if(view->jsObject()) view->jsObject()->setParent(this); // for javascript access. }
void KbAnimWidget::refreshList(){ noReorder = true; setCurrent(0); ui->animList->clear(); animations.clear(); // Add the animations from the new lighting mode if(!light){ ui->animList->setVisible(false); ui->noAnimLabel->setVisible(true); return; } QList<KbAnim*> newAnimations = light->animList(); if(newAnimations.count() == 0){ ui->animList->setVisible(false); ui->noAnimLabel->setVisible(true); return; } ui->animList->setVisible(true); foreach(KbAnim* anim, newAnimations){ QListWidgetItem* item = new QListWidgetItem(anim->name(), ui->animList); item->setData(Qt::UserRole, anim->guid()); item->setFlags(item->flags() | Qt::ItemIsEditable); animations[anim->guid()] = anim; ui->animList->addItem(item); }
void eListBoxBase::lostFocus() { #ifndef DISABLE_LCD if ( descr ) { delete LCDTmp; LCDTmp=0; delete tmpDescr; tmpDescr=0; } #endif --have_focus; if (entries) if ( newFocus() ) //recalced ? { ePtrList<eListBoxEntry>::iterator it = current; init(); setCurrent(it); } else if ( isVisible() ) { int i = 0; for (ePtrList<eListBoxEntry>::iterator entry(top); entry != bottom; ++i, ++entry) if (entry == current) invalidateEntry(i); } #ifndef DISABLE_LCD if (parent && parent->LCDElement) parent->LCDElement->setText(""); #endif }
int eListBoxBaseExt::keyDown(int key) { if (key >= KEY_ASCII) { browseTimer.start(2*1000,true); // TODO convert browseText to utf8 !! browseText+=(char)key; const char *browseBuf = browseText.c_str(); int len = browseText.length(); for (ePtrList<eListBoxEntry>::iterator it(childs.begin()); it != childs.end(); ++it ) { if ( !strncasecmp(it->getText().c_str(), browseBuf, len) ) { if ( it != current ) { browseHistory.push_front(current); setCurrent(*it,false); } return 1; } } browseText.erase(len-1,1); } return 0; }
void initCredits(SDL_Surface* screen) { msgList=listInit(_freeCreditListItem); listAppendData(msgList, (void*)initMsg("Website","wizznic.org", screen)); listAppendData(msgList, (void*)initMsg("Code/Gfx/Sfx","Jimmy Christensen", screen)); listAppendData(msgList, (void*)initMsg("Gfx","ViperMD", screen)); listAppendData(msgList, (void*)initMsg("Music","Sean Hawk", screen)); listAppendData(msgList, (void*)initMsg("Thx","Qubodup", screen)); listAppendData(msgList, (void*)initMsg("Thx","Farox", screen)); listAppendData(msgList, (void*)initMsg("Thx","bMan", screen)); listAppendData(msgList, (void*)initMsg("Thx","KML", screen)); listAppendData(msgList, (void*)initMsg("Thx","Neil L", screen)); listAppendData(msgList, (void*)initMsg("Thx","Zear", screen)); listAppendData(msgList, (void*)initMsg("Thx","ReactorScram", screen)); listAppendData(msgList, (void*)initMsg("Thx","torpor", screen)); listAppendData(msgList, (void*)initMsg("Thx","klopsi", screen)); listAppendData(msgList, (void*)initMsg("Greetings","GP32X.com", screen)); listAppendData(msgList, (void*)initMsg("Greetings","freegamedev.net", screen)); listAppendData(msgList, (void*)initMsg("Greetings","gcw-zero.com", screen)); //Set current currentMsgIndex=0; setCurrent(); }
void VirtualDesktopManager::handleDesktopsRemoved(uint previousCount) { if (current() > count()) { setCurrent(count()); } emit desktopsRemoved(previousCount); }
void SessionManager::newSession() { // Fetch session name QString name = getSessionName(tr("New Session")); if (name.isEmpty()) { return; } QString theme = m_session->theme(); // Close open documents bool visible = isVisible(); hide(); if (!closeCurrent()) { if (visible) { show(); } return; } accept(); // Create session and make it active { QSettings session(Session::pathFromName(name), QSettings::IniFormat); session.setValue("ThemeManager/Theme", theme); session.setValue("ThemeManager/Size", QSettings().value("ThemeManager/Size")); } setCurrent(name); }
void ColorBox::mousePressEvent(QMouseEvent *e) { // The current cell marker is set to the cell the mouse is pressed in QPoint pos = e->pos(); m_mousePressed = true; setCurrent(pos.x() - 5, pos.y() - 5); }
void *TGroup::read( ipstream& is ) { ushort index; TView::read( is ); clip = getExtent(); TGroup *ownerSave = owner; owner = this; last = 0; phase = TView::phFocused; current = 0; buffer = 0; lockFlag = 0; endState = 0; int count; is >> count; TView *tv; for( int i = 0; i < count; i++ ) { is >> tv; if( tv != 0 ) insertView( tv, 0 ); } owner = ownerSave; TView *current; is >> index; current = at(index); setCurrent( current, TView::normalSelect ); if (ownerGroup == NULL) awaken(); return this; }
QFEvaluationPropertyEditor::QFEvaluationPropertyEditor(QFPluginServices* services, ProgramOptions* set, QFEvaluationItem* current, int id, QWidget* parent, Qt::WindowFlags f): QWidget(parent, f) { p=new QFEvaluationPropertyEditorPrivate(this); setAttribute(Qt::WA_DeleteOnClose, true); //std::cout<<"creating QFEvaluationPropertyEditor ... \n"; p->id=id; this->current=NULL; p->services=services; p->layWidgets=NULL; resultsModel=new QFEvaluationResultsModel(this); resultsModel->init(NULL, "*"); rdrModel=new QFProjectRawDataModel(this, NULL); rdrProxy=new QFEvaluationRawDataModelProxy(rdrModel); rdrProxy->setSourceModel(rdrModel); p->lstRawData=NULL; p->splitMain=NULL; p->filesListFiltered=true; resize(400,300); move(5,5); setSettings(set); //std::cout<<"creating QFEvaluationPropertyEditor ... creating widgets ...\n"; p->createWidgets(); resize(400,300); move(5,5); //std::cout<<"creating QFEvaluationPropertyEditor ... setting current ...\n"; setCurrent(current); //std::cout<<"creating QFEvaluationPropertyEditor ... DONE!\n"; readSettings(); }
void AnimationState::update(float delta) { delta *= timeScale; for (size_t i = 0; i < tracks.size(); ++i) { auto current = tracks[i]; if (!current) continue; current->time += delta * current->timeScale; if (current->previous) { float previousDelta = delta * current->previous->timeScale; current->previous->time += previousDelta; current->mixTime += previousDelta; } if (current->next) { current->next->time = current->lastTime - current->next->delay; if (current->next->time >= 0) { setCurrent(int(i), current->next); } } else { /* End non-looping animation when it reaches its end time and there is no next entry. */ if (!current->loop && current->lastTime >= current->endTime) { clearTrack(int(i)); } } } }
void ColorBox::mouseMoveEvent(QMouseEvent *e) { if (!m_mousePressed) return; QPoint pos = e->pos(); setCurrent(pos.x() - 5, pos.y() - 5); }
void WMenu::insertItem(int index, WMenuItem *item) { item->setParentMenu(this); ul()->insertWidget(index, item); if (contentsStack_) { WWidget *contents = item->contents(); if (contents) { contentsStack_->addWidget(contents); if (contentsStack_->count() == 1) { setCurrent(0); if (contents) contentsStack_->setCurrentWidget(contents); renderSelected(item, true); item->loadContents(); } else renderSelected(item, false); } else renderSelected(item, false); } else renderSelected(item, false); itemPathChanged(item); }
Node* TreeWalker::previousNode() { RefPtr<Node> node = m_current; while (node != root()) { while (Node* previousSibling = node->previousSibling()) { node = previousSibling; short acceptNodeResult = acceptNode(node.get()); if (acceptNodeResult == NodeFilter::FILTER_REJECT) continue; while (Node* lastChild = node->lastChild()) { node = lastChild; acceptNodeResult = acceptNode(node.get()); if (acceptNodeResult == NodeFilter::FILTER_REJECT) break; } if (acceptNodeResult == NodeFilter::FILTER_ACCEPT) { m_current = node.release(); return m_current.get(); } } if (node == root()) return nullptr; ContainerNode* parent = node->parentNode(); if (!parent) return nullptr; node = parent; short acceptNodeResult = acceptNode(node.get()); if (acceptNodeResult == NodeFilter::FILTER_ACCEPT) return setCurrent(WTFMove(node)); } return nullptr; }
void WMenu::select(int index, bool changePath) { int last = current_; setCurrent(index); selectVisual(current_, changePath, true); if (index != -1) { WMenuItem *item = itemAt(index); item->show(); item->loadContents(); DeletionTracker guard(this); if (changePath && emitPathChange_) { WApplication *app = wApp; app->internalPathChanged().emit(app->internalPath()); if (guard.deleted()) return; emitPathChange_ = false; } if (last != index) { item->triggered().emit(item); if (!guard.deleted()) { // item may have been deleted too if (ul()->indexOf(item) != -1) itemSelected_.emit(item); else select(-1); } } } }
virtual void work() { Random random; unsigned delta=0; for(unsigned pos=0; pos<Total ;setCurrent(++pos)) { if( getCancel() ) { setResult("test cancelled"); return; } unsigned sy=random.select(1,10000); unsigned sx=sy+random.select(10000); Replace_max(delta,test1(sx,sy)); } char temp[TextBufLen]; PrintBuf out(Range(temp)); Printf(out,"delta = #;",delta); setResult(out.close()); }
//################################################################# // // void dynamixels::setCurrentALL(uint16_t desired_current) // //################################################################# void dynamixels::setCurrentALL(uint16_t desired_current) { for (int i=0; i<MAXIMUM_NUMBER_DYNAMIXELS && ID_array[i]!= 0; i++) { setCurrent(i, desired_current); } }
/* * Constructor * number_of_steps - the steps per rotation * cs_pin - the SPI client select pin * dir_pin - the pin where the direction pin is connected * step_pin - the pin where the step pin is connected */ TMC26XGenerator::TMC26XGenerator(unsigned int current, unsigned int resistor) { //by default cool step is not enabled cool_step_enabled=false; this->bridges_enabled=true; //store the current sense resistor value for later use this->resistor = resistor; //initialize register values driver_control_register_value=DRIVER_CONTROL_REGISTER | INITIAL_MICROSTEPPING; chopper_config_register=CHOPPER_CONFIG_REGISTER; //setting the default register values driver_control_register_value=DRIVER_CONTROL_REGISTER|INITIAL_MICROSTEPPING; microsteps = (1 << INITIAL_MICROSTEPPING); chopper_config_register=CHOPPER_CONFIG_REGISTER; cool_step_register_value=COOL_STEP_REGISTER; stall_guard2_current_register_value=STALL_GUARD2_LOAD_MEASURE_REGISTER; driver_configuration_register_value = DRIVER_CONFIG_REGISTER | READ_STALL_GUARD_READING; //set the current setCurrent(current); //set to a conservative start value setConstantOffTimeChopper(7, 54, 13,12,1); //set a nice microstepping value setMicrosteps(DEFAULT_MICROSTEPPING_VALUE); }