Cursor Transaction::prepare(const AnyString& stmt) { assert(!(!pChannel)); // the adapter ::yn_dbi_adapter& adapter = pChannel->adapter; if (YUNI_UNLIKELY(nullHandle == pTxHandle)) { if (errNone != pChannel->begin(pTxHandle)) return Cursor(adapter, nullptr); } // query handle void* handle = nullptr; if (YUNI_LIKELY(not stmt.empty() and adapter.dbh)) { assert(adapter.query_new != NULL and "invalid adapter query_new"); assert(adapter.query_ref_acquire != NULL and "invalid adapter query_ref_acquire"); assert(adapter.query_ref_release != NULL and "invalid adapter query_ref_release"); adapter.query_new(&handle, adapter.dbh, stmt.c_str(), stmt.size()); } return Cursor(adapter, handle); }
inline void DisplaySensorValues() { if(lcdRefreshCount == 0) // Mitigates screen flicker and time consuming operations { #ifdef DEBUG_MODE // Sensors on top line Cursor(BOTTOM, 0); #ifdef USE_SMART_INTERSECTIONS Print("Signal: ", intersectionTurnFlag); #else Print("Intersection: ", intersectionIndex + 1); #endif #else Cursor(TOP, 0); Print(" "); Cursor(TOP, 0); Print("Time: "); lcd.print(float(lapTime)/10.0); Print("s"); #endif } #ifndef DEBUG_MODE if(batteryCount == 0) { Cursor(BOTTOM, 0); batteryVoltage = float(analogRead(BATTERY_SENSOR)) / 1024.0 * 5.0; Print("Battery: "); lcd.print(batteryVoltage); Print("V"); } #endif }
void TripCodeDataProc() // EEPROM TRIP ERROR DATA LOAD { BUTTON KeyIn; int loopCtrl=1; signed int point = 0; int change=1; LCD_Clear(); strcpy(st, "TRIP [0]"); PrintLCD(0,0,st); strcpy(st, " "); PrintLCD(0,10,st); DisplayChar(1, 0, '1'); strcpy(st, " TRIP DESCIPTION "); PrintLCD(1,2,st); DisplayChar(2, 0, '2'); strcpy(st, " RECORD DATE "); PrintLCD(2,2,st); strcpy(st, "VDC= "); PrintLCD(3,0,st); strcpy(st, "DATA= "); PrintLCD(3,10,st); printTripHystory(0); Cursor(0,6,CURSOR_BLINK); while( loopCtrl){ KeyIn = GetKey(); if( KeyIn == BTN_SET ) printTripHystory( point ); else if( KeyIn == BTN_STOP){ machine_state = STATE_SET_MODE; loopCtrl = 0; return ; } else if( KeyIn == BTN_DOWN) point --; else if( KeyIn == BTN_UP) point++; else change = 0; if (point > 9) point = 0; else if (point < 0 ) point = 9; if(change){ DisplayChar(0,6,point+'0'); Cursor(0,6,CURSOR_BLINK); } else change = 1; } }
// Display the menu on screen void ShowMenu() { // Show menu item on top row Clear(); Cursor(TOP, 0); Print(parameters[menuIndex]->Name); Print(" ", parameters[menuIndex]->Value); // Show sensor info on bottom row. Useful for threshold calibration Cursor(BOTTOM, 0); Print(" ", analogRead(LEFT_SENSOR)); Print(" ", analogRead(RIGHT_SENSOR)); Print(" ", analogRead(CENTER_SENSOR)); Print(" "); lcd.print(float(lapTime)/10.0); Print("s"); switch(ReadButton()) { case UP: // Increase item value holdCounter = (previousButton == UP) ? (holdCounter + 1) : 0; previousButton = UP; parameters[menuIndex]->Value += 1 + (holdCounter / 20); break; case DOWN: // Lower item value holdCounter = (previousButton == DOWN) ? (holdCounter + 1) : 0; previousButton = DOWN; parameters[menuIndex]->Value -= (1 + (holdCounter / 20)); break; case LEFT: // Next menu item menuIndex = (menuIndex > 0) ? (menuIndex - 1) : (PARAMETER_COUNT - 1); break; case RIGHT: // Previous menu item menuIndex = (menuIndex < PARAMETER_COUNT - 1) ? (menuIndex + 1) : 0; break; case SELECT:// Exit menu delay(500); if (ReadButton() == SELECT) { Clear(); Cursor(TOP, 0); Print("Exiting menu"); SaveToEEPROM(); // Save values to EEPROM before exiting delay(750); currentState = moveStraight; intersectionTurnFlag = 0; lapTime = 0; batteryCount = 1; Clear(); return; } break; } delay(150); }
Cursor Cursor::get_definition() const { CXCursor cx_cursor(clang_getCursorDefinition(m_cx_cursor)); if ( is_null(cx_cursor) ) { if ( is_null(m_cx_cursor) ) { CLANGXX_THROW_LogicError("Error retrieving a cursor that points to the definition of that entity."); } return Cursor(); } return Cursor(std::move(cx_cursor), m_translation_unit); }
Range CodeCompletionModel::completionRange(View* view, const Cursor &position) { Range range = KDevelop::CodeCompletionModel::completionRange(view, position); if (range.start().column() > 0) { KTextEditor::Range preRange(Cursor(range.start().line(), range.start().column() - 1), Cursor(range.start().line(), range.start().column())); kDebug() << preRange << view->document()->text(preRange); const QString contents = view->document()->text(preRange); if ( contents == "$" ) { range.expandToRange(preRange); kDebug() << "using custom completion range" << range; } } return range; }
bool Myazo::InitWindowClass(void) { Handle Cursor(LoadCursor(Instance,MAKEINTRESOURCE(IDC_CURSOR1)),[](void* Obj){if(Obj) DestroyCursor((HCURSOR)Obj);}), Icon(LoadImage(Instance,MAKEINTRESOURCE(IDI_ICON1),IMAGE_ICON,32,32,0),[](void* Obj){if(Obj) DeleteObject(Obj);}), IconSmall(LoadImage(Instance,MAKEINTRESOURCE(IDI_ICON1),IMAGE_ICON,16,16,0),[](void* Obj){if(Obj) DeleteObject(Obj);}); WNDCLASSEX WndClass; ZeroMemory(&WndClass,sizeof(WndClass)); WndClass.cbSize=sizeof(WndClass); WndClass.lpfnWndProc=WndProc; WndClass.hInstance=GetModuleHandle(nullptr); WndClass.hIcon=(HICON)Icon.get(); WndClass.hIconSm=(HICON)IconSmall.get(); WndClass.hCursor=(HCURSOR)Cursor.get(); WndClass.lpszClassName=L"MyazoMainWindow"; MainWindow=DialogWindow(WndClass); if(!MainWindow.Register()) return false; WndClass.style=CS_VREDRAW|CS_HREDRAW; WndClass.hbrBackground=CreateSolidBrush(RGB(100,100,100)); WndClass.lpfnWndProc=LayerWndProc; WndClass.lpszClassName=L"MyazoLayerWindow"; LayerWindow=DialogWindow(WndClass); if(!LayerWindow.Register()) return false; WndClass.hbrBackground=(HBRUSH)COLOR_WINDOW; WndClass.lpfnWndProc=AuthWndProc; WndClass.hCursor=LoadCursor(nullptr,IDC_ARROW); WndClass.lpszClassName=L"MyazoAuthWindow"; AuthWindow=DialogWindow(WndClass); if(!AuthWindow.Register()) return false; return true; }
void PSplitter::MouseMoved(BPoint where, uint32 code, const BMessage *a_message) { if (a_message == NULL && Bounds().Contains(where)) be_app->SetCursor(Cursor()); else be_app->SetCursor(B_HAND_CURSOR); } /* PSplitter::MouseMoved */
Cursor CollectionView::get(Flags::Query flags) const { bson_t q; bson_t f; BSON::BSONC bson("$query", _query); if (_sort) { bson.append("$orderby", _sort); } Utils::to_bson_t(bson, &q); if (_fields) { Utils::to_bson_t(_fields, &f); } mongoc_cursor_t *cursor = mongoc_collection_find( _collection->collection.get(), (mongoc_query_flags_t) flags, _skip, _limit, 0, &q, (_fields ? &f : nullptr), nullptr ); return Cursor(std::unique_ptr<CursorImpl>(new CursorImpl(_collection->client, cursor))); }
Input::Input() { if (GetEnginePlatform() == Platform::Windows) { mCursors.Add(Cursor()); mCursors.Last().isPressed = false; } }
void RemoteHWInterface::SetCursor(ServerCursor* cursor) { HWInterface::SetCursor(cursor); RemoteMessage message(NULL, fSendBuffer); message.Start(RP_SET_CURSOR); message.AddCursor(Cursor().Get()); }
void FastCGITransport::onHeader(std::unique_ptr<folly::IOBuf> key_chain, std::unique_ptr<folly::IOBuf> value_chain) { Cursor cursor(key_chain.get()); std::string key = cursor.readFixedString(key_chain->computeChainDataLength()); cursor = Cursor(value_chain.get()); std::string value = cursor.readFixedString( value_chain->computeChainDataLength()); handleHeader(key, value); }
Cursor Cursor::from_result(std::shared_ptr<const TranslationUnit> translation_unit) { CXCursor cx_cursor(clang_getTranslationUnitCursor( translation_unit->native_handle())); if ( is_null(cx_cursor) ) { CLANGXX_THROW_LogicError("Error retrieving the cursor that represents the given translation unit."); } return Cursor(std::move(cx_cursor), translation_unit); }
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); } }
// ESC K is sent on a ESC Z const char* VT52::putChar(char c) { c & 0x7F; switch(_state) { case State::Normal: if(c != ESC) return BasicTerminal::putChar(c); _state = State::InEscape;// escape code break; case State::InEscape: switch(c) { case 'A': if(_cursor.y() > 0) _cursor.moveUp(); break; // Cursor up case 'B': if(_cursor.y() <= (_height-1)) _cursor.moveDown(); break; // Cursor up case 'C': if(_cursor.x() <= (_width-1)) _cursor.moveRight(); break; // Cursor up case 'D': if(_cursor.x() > 0 ) _cursor.moveLeft(); break; // Cursor up case 'F': _graphicsMode = true; break; // enter graphics mode, not supported yet case 'G': _graphicsMode = false; break;// exit graphics mode case 'H': _cursor = Cursor(); break; // set home case 'L': reverseLineFeed(); break; // reverse line feed, not sure if this is right? case 'J': clearScreen(_cursor.y(),_cursor.x()); break; case 'K': clearLine(_cursor.y(),_cursor.x()); break; case 'Y': _state = State::NeedY; return nullptr; case 'Z': // Ident _state = State::Normal; // have to change the state here since we return here return "\033K"; // return for VT52 without copier or printer case 0133: _holdScreen = true; break;// hold screen mode on, not supported right yet case 0134: _holdScreen = false; break;// hold screen mode off, not supported right yet case 075: _altKeypad = true; break; // alternate keypad mode on '=' case 076: _altKeypad = false; break;// alternate keypad mode off '>' } _state = State::Normal; break; case State::NeedY: _posBuffer = c; _state = State::NeedX; break; case State::NeedX: setCursor(Cursor(c - 040,_posBuffer-040)); _state = State::Normal; break; } return nullptr; }
void Input::OnCursorPressedMsgApply(const Vec2F& pos, CursorId id /*= 0*/) { if (id == 0 && o2Config.GetPlatform() == Platform::Windows) { mCursors[0].position = pos; mCursors[0].isPressed = true; mCursors[0].pressedTime = 0.0f; } else mCursors.Add(Cursor(pos, id)); }
void SelectMenuPage1() // System 설정 메뉴 { BUTTON KeyIn; int loopCtrl =1; int selection = 1; LCD_Clear(); strcpy(st, " - MAIN MENU - 1/2"); PrintLCD(0,0,st); DisplayChar(1, 0, '1'); strcpy(st, " EDIT CTRL DATA "); PrintLCD(1,2,st); DisplayChar(2, 0, '2'); strcpy(st, " TRIP RECORD VIEW "); PrintLCD(2,2,st); DisplayChar(3, 0, '3'); strcpy(st, " SYSTEM RESET "); PrintLCD(3,2,st); while( loopCtrl ) { KeyIn = GetKey(); Cursor(selection,0,CURSOR_BLINK); if( KeyIn == BTN_DOWN ){ if(selection >= 3 ){ machine_state = STATE_SET_MODE2; return; } else selection ++; } else if( KeyIn == BTN_UP ){ if(selection > 1 ) selection --; } else if (( KeyIn == BTN_RIGHT)|| (KeyIn == BTN_ESC)){ machine_state = STATE_SET_MODE2; return; } else if ( KeyIn == BTN_STOP){ machine_state = STATE_MONITOR_MODE; return; } else if( KeyIn == BTN_SET){ if( selection == 1) Machine_state = STATE_EDIT_MODE; else if( selection == 2) machine_state = STATE_TRIP_MODE; else machine_state = STATE_RESET_MODE; return; } } }
bool ArgumentCoder<Cursor>::decode(ArgumentDecoder& decoder, Cursor& cursor) { Cursor::Type type; if (!decoder.decodeEnum(type)) return false; if (type > Cursor::Custom) return false; if (type != Cursor::Custom) { const Cursor& cursorReference = Cursor::fromType(type); // Calling platformCursor here will eagerly create the platform cursor for the cursor singletons inside WebCore. // This will avoid having to re-create the platform cursors over and over. (void)cursorReference.platformCursor(); cursor = cursorReference; return true; } bool isValidImagePresent; if (!decoder.decode(isValidImagePresent)) return false; if (!isValidImagePresent) { cursor = Cursor(Image::nullImage(), IntPoint()); return true; } RefPtr<Image> image; if (!decodeImage(decoder, image)) return false; IntPoint hotSpot; if (!decoder.decode(hotSpot)) return false; if (!image->rect().contains(hotSpot)) return false; cursor = Cursor(image.get(), hotSpot); return true; }
// SETUP void setup() { // For algorithm speed checking loopPeriod = 0; lastLoop = micros(); // Lap timer lapTimer.setInterval(100, IncrementTime); lapTimer.disable(0); // Initialize LCD lcd.begin(16, 2); lcd.setCursor(0,0); // Turn signals pinMode(LEFT_TURN_LED, OUTPUT); pinMode(RIGHT_TURN_LED, OUTPUT); digitalWrite(LEFT_TURN_LED, 0); digitalWrite(RIGHT_TURN_LED, 0); turnSignalTimer.setInterval(50, TurnSignal); // Force motors off by default MotorSpeed(LEFT_MOTOR, 0); MotorSpeed(RIGHT_MOTOR, 0); // Parameters need to be loaded from EEPROM LoadFromEEPROM(); // Intro text Clear(); Cursor(TOP, 0); Print("FAST ORANGE"); Cursor(BOTTOM, 0); #ifdef DEBUG_MODE Print("Debug Mode"); #else Print("Race Mode"); #endif delay(1000); currentState = menu; }
static Cursor loadCursorByName(char* name, int x, int y) { IntPoint hotSpot(x, y); Cursor c; OwnPtr<Image> cursorImage(Image::loadPlatformResource(name)); if (cursorImage && !cursorImage->isNull()) c = Cursor(cursorImage.get(), hotSpot); else c = pointerCursor(); return c; }
Cursor TranslationUnit::getCursor(const std::string& filename, unsigned line, unsigned column) const { // get the file CXFile file = clang().getFile(tu_, filename.c_str()); if (file == nullptr) return Cursor(); // get the source location CXSourceLocation sourceLoc = clang().getLocation(tu_, file, line, column); // get the cursor CXCursor cursor = clang().getCursor(tu_, sourceLoc); if (clang().equalCursors(cursor, clang().getNullCursor())) return Cursor(); // return it return Cursor(cursor); }
void FastCGITransport::onHeader(std::unique_ptr<folly::IOBuf> key_chain, std::unique_ptr<folly::IOBuf> value_chain) { Cursor cursor(key_chain.get()); std::string key = cursor.readFixedString(key_chain->computeChainDataLength()); // HTTP has case insensitive header keys boost::to_upper(key); cursor = Cursor(value_chain.get()); std::string value = cursor.readFixedString( value_chain->computeChainDataLength()); m_requestHeaders.insert(std::make_pair(key, value)); }
void SelectMenuPage2() { BUTTON KeyIn; int loopCtrl =1; int selection = 1; LCD_Clear(); strcpy(st, " - MAIN MENU - 2/2"); PrintLCD(0,0,st); DisplayChar(1, 0, '4'); strcpy(st, " DATE & TIME SET "); PrintLCD(1,2,st); DisplayChar(2, 0, '5'); strcpy(st, " RECORD CLEAR ALL "); PrintLCD(2,2,st); DisplayChar(3, 0, '6'); strcpy(st, " SYSTEM INIT "); strcpy(st, " POSION VALUE TEST"); PrintLCD(3,2,st); while( loopCtrl ) { Cursor(selection,0,CURSOR_BLINK); KeyIn = GetKey(); if( KeyIn == BTN_DOWN ){ if(selection >= 3 ){ machine_state = STATE_SET_MODE; return; } else selection ++; } else if( KeyIn == BTN_UP ){ if(selection > 1 ) selection --; } else if ( (KeyIn == BTN_ESC) || (KeyIn == BTN_RIGHT)){ machine_state = STATE_SET_MODE; return; } else if ( KeyIn == BTN_STOP){ machine_state = STATE_MONITOR_MODE; return; } else if( KeyIn == BTN_SET){ if( selection == 1) Machine_state = STATE_TIME_MODE; // else if( selection == 2) machine_state = STATE_TRIP_MODE; // else machine_state = STATE_RESET_MODE; return; } } }
void ImplementFunctionCompletionItem::execute(KTextEditor::Document* document, const KTextEditor::Range& word) { const QString finalText = m_name + "(" + m_arguments.join(", ") + "):"; document->replaceText(word, finalText); // 4 spaces is indentation for python. everyone does it like this. you must, too. // TODO use kate settings document->insertLine(word.start().line() + 1, m_previousIndent + " "); if ( View* view = document->activeView() ) { view->setCursorPosition(Cursor(word.end().line() + 1, m_previousIndent.length() + 4)); } }
void FastCGITransport::onHeader(std::unique_ptr<folly::IOBuf> key_chain, std::unique_ptr<folly::IOBuf> value_chain) { Cursor cursor(key_chain.get()); std::string key = cursor.readFixedString(key_chain->computeChainDataLength()); cursor = Cursor(value_chain.get()); std::string value = cursor.readFixedString( value_chain->computeChainDataLength()); auto it = m_requestHeaders.emplace(key, value); if (!it.second) { it.first->second = value; } }
//-------------------------------------------------------------------------------- bool CRenderedWindowController::SetModel( nsMammut::CModel* pModelItem ) { _WINQ_FCONTEXT( "CRenderedWindowController::SetModel" ); CBaseWindowController::SetModel( pModelItem ); NonClient().SetModel( pModelItem ); NCRendering().SetModel( pModelItem ); Rendering().SetModel( pModelItem ); Iconized().SetModel( pModelItem ); Text().SetModel( pModelItem ); Cursor().SetModel( pModelItem ); return true; }
bool KateViReplaceMode::commandMoveOneWordLeft() { KTextEditor::Cursor c( m_view->cursorPosition() ); c = findPrevWordStart( c.line(), c.column() ); if (!c.isValid()) { c = Cursor(0, 0); } updateCursor( c ); return true; }
MouseCtrl::MouseCtrl(){ cs = Cursor(); //drift的資訊歸零 for(int i=0; i<3 ; i++){ DriftAccl[i] = 0; DriftGyro[i] = 0; TotalAccl[i] = 0; TotalGyro[i] = 0; } DriftRecCounter = 0; posReset(); gyroSensitivity = 225; state = MOUSECTRL_MSSTATE; }
void FastCGITransport::onHeader(std::unique_ptr<folly::IOBuf> key_chain, std::unique_ptr<folly::IOBuf> value_chain) { Cursor cursor(key_chain.get()); std::string key = cursor.readFixedString(key_chain->computeChainDataLength()); // HTTP has case insensitive header keys for (auto& c : key) { c = std::toupper(c); } cursor = Cursor(value_chain.get()); std::string value = cursor.readFixedString( value_chain->computeChainDataLength()); m_requestHeaders.emplace(key, value); }
bool Queue::write(AddressType& Address, uint8_t* FromBuf, AddressType WantedSize) { PageCursor Cursor(this); while (WantedSize) { AddressType FoundSize = writeToPage(Address, WantedSize, Cursor); if (FoundSize == 0) return false; uint8_t* ToBuf = Cursor.getBufferPtr(); memcpy(ToBuf, FromBuf, FoundSize); Address += FoundSize; WantedSize -= FoundSize; } return true; }