void consoleDown() { if (historyActive) { historyActive=historyActive->next; if (historyActive) { struct utilStrList *active=historyActive; openConsole(historyActive->str); historyActive=active; } else { openConsole(":"); } drawerInvokeRedisplay(); } }
void KConsole::slotData() { int n; char buffer[1024]; if ((n = read(fd, buffer, sizeof(buffer))) <= 0) { closeConsole(); if (n || !openConsole()) append(i18n("\n*** Lost connection with console log ***")); } else { QString str(QString::fromLocal8Bit(buffer, n).remove('\r')); int pos, opos; for (opos = 0; (pos = str.indexOf('\n', opos)) >= 0; opos = pos + 1) { if (document()->blockCount() == 100) { QTextCursor cur(document()); cur.movePosition(QTextCursor::NextBlock, QTextCursor::KeepAnchor); cur.removeSelectedText(); } if (!leftover.isEmpty()) { append(leftover + str.mid(opos, pos - opos)); leftover.clear(); } else { append(str.mid(opos, pos - opos)); } } leftover += str.mid(opos); } }
void Console::printf(string str, ...) { openConsole(0.1f, 0.1f, 30, 15); va_list args; va_start(args, str); // Fonction spéciale de SCE permettant de construire des wrappers autour du // printf. cellDbgFontConsoleVprintf(consoleId, str.c_str(), args); va_end(args); }
void consoleUp() { if (!historyActive) historyActive=historyLast; else if (historyActive->prev) historyActive=historyActive->prev; if (historyActive) { struct utilStrList *active=historyActive; openConsole(active->str); historyActive=active; drawerInvokeRedisplay(); } }
KConsole::KConsole(QWidget *_parent) : inherited(_parent) , pty(0) , notifier(0) , fd(-1) { setReadOnly(true); setLineWrapMode(NoWrap); if (!openConsole()) append(i18n("*** Cannot connect to console log ***")); }
void consoleKeyPress(char c) { if (!cursorPos) openConsole(""); applyCompletion(); int pos=cursorPos; setCursorPos(0); cmdLineRealloc(1); utilStrInsertChar(consoleLines->str+pos, c); cmdEnd++; updateCompletions(); setCursorPos(pos+1); drawerInvokeRedisplay(); }
void Console::update() { if (visibility > 0) { //Update console font size if needed if (previousFontSize != consoleFontSize) { consoleText->setFont(ginesFontPath, consoleFontSize); for (unsigned i = 0; i < lines.size(); i++) { lines[i]->setFont(ginesFontPath, consoleFontSize); } previousFontSize = consoleFontSize; } if (!open) { visibility -= 20; } } if (!open) { //Console is not open, check opening key combination if (gines::inputManager.isKeyHeld(SDLK_LCTRL) && gines::inputManager.isKeyHeld(SDLK_LALT) && gines::inputManager.isKeyHeld(SDLK_BACKSPACE)) { openConsole(); input = ""; } } else { if (visibility < 255) { visibility += 5; if (visibility > 255) { visibility = 255; } } //Console is open ////Receiving input bool inputReceived = false; //Alphabet unsigned char capital = 0; if (gines::inputManager.isKeyHeld(SDLK_LSHIFT) || gines::inputManager.isKeyHeld(SDLK_RSHIFT)) capital = 32; for (unsigned char i = 61; i <= 122; i++) { if (gines::inputManager.isKeyPressed(i)) { input += i - capital; inputReceived = true; } } //Numbers for (unsigned char i = 48; i <= 57; i++) { if (gines::inputManager.isKeyPressed(i)) { input += i; inputReceived = true; } } //Minus if (gines::inputManager.isKeyPressed(45)) { input += 45; inputReceived = true; } //Period if (gines::inputManager.isKeyPressed(46)) { input += 46; inputReceived = true; } //Space if (gines::inputManager.isKeyPressed(32)) { input += 32; inputReceived = true; } //Backspace if (gines::inputManager.isKeyHeld(8) || gines::inputManager.isKeyPressed(8)) { if (backspaceTimer <= 0) {//Erase one character if (input.size() > 0) { input.pop_back(); if (gines::inputManager.isKeyPressed(8)) { backspaceTimer = BACKSPACE_INITIAL_INTERVAL; } else { backspaceTimer = BACKSPACE_INTERVAL - backspaceAcceleration; backspaceAcceleration += 3; } inputReceived = true; } } else { backspaceTimer -= gines::deltaTime; } } else { backspaceTimer = 0; backspaceAcceleration = 0; } //Enter if (gines::inputManager.isKeyPressed(SDLK_RETURN)) { executeConsole(); closeConsole(); } if (inputReceived) { consoleText->setString('>' + input + '<'); } } }