void ArtisticTextToolSelection::selectText(int from, int to) { if (!m_currentShape) return; repaintDecoration(); const int textCount = m_currentShape->plainText().count(); m_selectionStart = qBound(0, from, textCount-1); m_selectionCount = qBound(from, to, textCount) - m_selectionStart; repaintDecoration(); }
void CJabberCore::innerEventLoop() { repaintDecoration(); int c; bool end = invalidRC; string buffer = ""; stringstream bufferToSend; int bufferLength = 0; int cursorPosition = 0; printInfo(); while(!end) { c = wgetch(inputWindow); switch(c) { case ESC: end = true; wclear(inputWindow); wrefresh(inputWindow); wmove(inputWindow, 0, 0); break; case ENTER: wclear(inputWindow); wmove(inputWindow, 0, 0); wrefresh(inputWindow); if (buffer.length() > 0) { if (jid == true && buffer.at(0) != '/') { bufferToSend << "ja: " << buffer; MessageWindow::getInstance().printWin(bufferToSend, Me); xmpp->sendMessage(jid, buffer.c_str()); } else { Command c = getCommand(buffer); if (c == Quit) { end = true; } } } bufferToSend.str(""); bufferToSend.clear(); buffer.clear(); cursorPosition = 0; repaintDecoration(); break; case BACKSPACE: if (cursorPosition > 0) { cursorPosition--; buffer.erase(cursorPosition); wclear(inputWindow); wprintw(inputWindow, "%s", buffer.c_str()); wrefresh(inputWindow); } break; default: buffer += (char)c; cursorPosition++; } } }
void ArtisticTextToolSelection::clear() { repaintDecoration(); m_selectionStart = -1; m_selectionCount = 0; }