void RunEdit::insPrompt () { if (!mNoPrompt) { processText (Event ('!')); processText (Event ('p')); } }
void RunEdit::insImmediateReturn () { if (!mNoPrompt) { processText (Event ('!')); processText (Event ('i')); } }
void RunEdit::insAllFilesQuoted () { if (!mNoPrompt) { processText (Event ('!')); processText (Event ('q')); } }
void RunEdit::insAutoRefresh () { if (!mNoPrompt) { processText (Event ('!')); processText (Event ('a')); } }
void CustomLabel::init() { initFont(); processText(); edit_ = new QLineEdit(this); edit_->hide(); connect(edit_, SIGNAL(editingFinished()), this, SLOT(editingFinished())); }
void GalTextItem::timerEvent(QTimerEvent * /*event*/) { if (processText()) { killTimer(m_iTimerID); } }
/** * Changes the various fonts for the text to use. * The different fonts need to be passed in advance since the * text size can change mid-text. * @param big Pointer to large-size font. * @param small Pointer to small-size font. */ void Text::setFonts(Font *big, Font *small) { _big = big; _small = small; _font = _small; processText(); }
void Misc::limpiarLabeled(const std::string& input, const std::string& output) { std::ifstream labeled(input.c_str()); std::ofstream cleanLabeled(output.c_str()); std::string header, line; std::vector<std::string> lineVec; int bytesLeidos = 0; int bytesTotales = 33556378; // Hardcodeadisimo std::cout << "LIMPIANDO LABELED...\n"; // Header: labeled >> header >> header >> header; labeled.ignore(1,'\n'); while (labeled.peek() != EOF) { std::getline(labeled, line); lineVec = split(line, '\t'); processText(lineVec[2]); removeStopwords(lineVec[2]); cleanLabeled << lineVec[0] + '\t' << lineVec[1] << '\t' << lineVec[2]; labeled.ignore(1, '\n'); bytesLeidos += line.size() + 1; std::cout << "\r" << (int)(bytesLeidos*100.0/bytesTotales) << "%"; if (labeled.peek() != EOF) cleanLabeled << '\n'; } std::cout << "\r100%\n"; }
/** * Changes the various resources needed for text rendering. * The different fonts need to be passed in advance since the * text size can change mid-text, and the language affects * how the text is rendered. * @param big Pointer to large-size font. * @param small Pointer to small-size font. * @param lang Pointer to current language. */ void Text::initText(Font *big, Font *small, Language *lang) { _big = big; _small = small; _lang = lang; _font = _small; processText(); }
/** * Enables/disables text wordwrapping. When enabled, lines of * text are automatically split to ensure they stay within the * drawing area, otherwise they simply go off the edge. * @param wrap Wordwrapping setting. */ void Text::setWordWrap(bool wrap) { if (wrap != _wrap) { _wrap = wrap; processText(); } }
void TextRenderer::renderImmediate(int fbWidth, int fbHeight, float x, float y, const std::string &text, FontType fontType, HAlign hAlign, VAlign vAlign) { if (pixelDensity != targetPixelDensity) { loadFontAtlas(targetPixelDensity); } ASSERT(atlas, "Font atlas not loaded"); if (!atlas) { return; } ASSERT(atlas->fontRangeMap.count(fontType) != 0, "Invalid font type"); if (atlas->fontRangeMap.count(fontType) == 0) { return; } FontRange &fontRange = atlas->fontRangeMap.at(fontType); float width = 0.0f, height = fontRange.fontSize; processText(text, fontRange, atlas->bitmapSize, &width, &height, [](const stbtt_aligned_quad &q){}); float xOffset = 0.0f; if (hAlign == HAlign::Center) { xOffset = -width / 2.0f; } else if (hAlign == HAlign::Right) { xOffset = -width; } float yOffset = 0.0f; if (vAlign == VAlign::Center) { yOffset = height * 0.25f; // Approximate (offset from baseline) } else if (vAlign == VAlign::Top) { yOffset = height; } prepareShaderProgram(*gameObject, fbWidth, fbHeight); glDisable(GL_DEPTH_TEST); float absX = fbWidth * x; float absY = fbHeight * y; processText(text, fontRange, atlas->bitmapSize, &absX, &absY, [&](const stbtt_aligned_quad &q) { renderQuad(*gameObject, *mesh, q, xOffset, yOffset); }); glEnable(GL_DEPTH_TEST); }
/** * Enables/disables text wordwrapping. When enabled, lines of * text are automatically split to ensure they stay within the * drawing area, otherwise they simply go off the edge. * @param wrap Wordwrapping setting. * @param indent Indent wrapped text. */ void Text::setWordWrap(bool wrap, bool indent) { if (wrap != _wrap || indent != _indent) { _wrap = wrap; _indent = indent; processText(); } }
int main(int argc, char **argv) { char textName[MAXPATH]; char symbName[MAXPATH]; fpstream* helpStrm; // Banner messages char initialText[] = "Help Compiler Version 1.0 Copyright (c) 1991" " Borland International.\n"; char helpText[] = "\n Syntax TVHC <Help text>[.TXT] [<Help file>[.HLP] [<Symbol file>[.H]]\n" "\n" " Help text = Help file source\n" " Help file = Compiled help file\n" " Symbol file = An include file containing all the screen names as const's\n"; char bufStr[MAXSTRSIZE]; cout << initialText; if (argc < 2) { cout << helpText; exit(1); } // Calculate file names strcpy(textName,replaceExt(argv[1], ".TXT", False)); if (!fExists(textName)) { strcpy(bufStr,"File "); strcat(bufStr,textName); strcat(bufStr," not found."); error(bufStr); } if (argc >= 3) strcpy(helpName, replaceExt(argv[2], ".HLP", False)); else strcpy(helpName, replaceExt(textName, ".HLP", True)); checkOverwrite( helpName ); if (argc >= 4) strcpy(symbName, replaceExt(argv[3], ".H", False)); else strcpy(symbName, replaceExt(helpName, ".H", True)); checkOverwrite( symbName ); TProtectedStream textStrm(textName, ios::in); TProtectedStream symbStrm(symbName, ios::out); helpStrm = new fpstream(helpName, ios::out|ios::binary); processText(textStrm, *helpStrm, symbStrm); return 0; }
void CMessageTemplate::processMacro( LPCSTR str, int len, int fill, IWriteSink & f ) { if ( FarSF::LStricmp( str, M_SUBJECT ) == 0 ) processSubject( len, fill, f ); else if ( FarSF::LStricmp( str, M_FROM ) == 0 ) processFrom( len, fill, f ); else if ( FarSF::LStricmp( str, M_TO ) == 0 ) processTo( len, fill, f ); else if ( FarSF::LStricmp( str, M_DATE ) == 0 ) processDate( len, fill, f ); else if ( FarSF::LStricmp( str, M_ORGANIZATION ) == 0 ) processOrganization( len, fill, f ); else if ( FarSF::LStricmp( str, M_MAILER ) == 0 ) processMailer( len, fill, f ); else if ( FarSF::LStricmp( str, M_OSUBJECT ) == 0 ) processOSubject( len, fill, f ); else if ( FarSF::LStricmp( str, M_MESSAGEID ) == 0 ) processMessageId( len, fill, f ); else if ( FarSF::LStricmp( str, M_FROM_NAME ) == 0 ) processFromName( len, fill, f ); else if ( FarSF::LStricmp( str, M_FROM_ADDR ) == 0 ) processFromAddr( len, fill, f ); else if ( FarSF::LStricmp( str, M_TO_NAME ) == 0 ) processToName( len, fill, f ); else if ( FarSF::LStricmp( str, M_TO_ADDR ) == 0 ) processToAddr( len, fill, f ); else if ( FarSF::LStricmp( str, M_SENT_DATE ) == 0 ) processSentDate( len, fill, f ); else if ( FarSF::LStricmp( str, M_SENT_TIME ) == 0 ) processSentTime( len, fill, f ); else if ( FarSF::LStricmp( str, M_RECEIVED_DATE ) == 0 ) processReceivedDate( len, fill, f ); else if ( FarSF::LStricmp( str, M_RECEIVED_TIME ) == 0 ) processReceivedTime( len, fill, f ); else if ( FarSF::LStricmp( str, M_TEXT ) == 0 ) processText( len, f ); else if ( FarSF::LStricmp( str, M_HEADERS ) == 0 ) processHeaders( f ); else if ( FarSF::LStrnicmp( str, M_KLUDGE, strlen(M_KLUDGE) ) == 0 ) { str += _countof(M_KLUDGE); while ( *str && ( isspace( (unsigned char)*str ) || *str == '(' || *str == '\"' || *str == '\'' ) ) str ++; if ( *str ) { LPCSTR end = str + 1; while ( *end && !isspace( (unsigned char)*end ) && *end != ')' && *end != '\"' && *end != '\'' ) end ++; processKludge( FarString( str, end - str ), f ); } } }
/** * Changes the string displayed on screen. * @param text Text string. */ void Text::setText(const std::wstring &text) { _text = text; processText(); // If big text won't fit the space, try small text if (_font == _big && getTextWidth() > getWidth() && _text[_text.size()-1] != L'.') { setSmall(); } }
void TextviewView::processLines() { strncpy(_currentLine, _script->readLine().c_str(), 79); if (_script->eos() || _script->err()) error("Attempted to read past end of response file"); while (!_script->eos() && !_script->err()) { // Commented out line, so go loop for another if (_currentLine[0] == '#') { strncpy(_currentLine, _script->readLine().c_str(), 79); continue; } // Process the line char *cStart = strchr(_currentLine, '['); if (cStart) { while (cStart) { // Loop for possible multiple commands on one line char *cEnd = strchr(_currentLine, ']'); if (!cEnd) error("Unterminated command '%s' in response file", _currentLine); *cEnd = '\0'; processCommand(); // Copy rest of line (if any) to start of buffer strcpy(_currentLine, cEnd + 1); cStart = strchr(_currentLine, '['); } if (_currentLine[0]) { processText(); break; } } else { processText(); break; } strncpy(_currentLine, _script->readLine().c_str(), 79); } }
Dialog::Dialog(QWidget *parent) : QDialog(parent), ui(new Ui::Dialog) { ui->setupUi(this); this->setLayout(ui->verticalLayout); connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(processText())); connect(ui->copyAgainPushButton, SIGNAL(clicked()), this, SLOT(copyAgain())); }
SPtr<Texture> TextRenderer::renderToTexture(const std::string &text, Resolution *resolution, FontType fontType) { if (pixelDensity != targetPixelDensity) { loadFontAtlas(targetPixelDensity); } ASSERT(atlas, "Font atlas not loaded"); if (!atlas) { return nullptr; } ASSERT(atlas->fontRangeMap.count(fontType) != 0, "Invalid font type"); if (atlas->fontRangeMap.count(fontType) == 0) { return nullptr; } FontRange &fontRange = atlas->fontRangeMap.at(fontType); float width = 0.0f, height = fontRange.fontSize; processText(text, fontRange, atlas->bitmapSize, &width, &height, [](const stbtt_aligned_quad &q){}); prepareShaderProgram(*gameObject, width, height); framebuffer->init(glm::ceil(width), glm::ceil(height)); framebuffer->use(); glClear(GL_COLOR_BUFFER_BIT); glDisable(GL_DEPTH_TEST); float x = 0.0f, y = 0.0f; processText(text, fontRange, atlas->bitmapSize, &x, &y, [&](const stbtt_aligned_quad &q) { renderQuad(*gameObject, *mesh, q, 0.0f, height * 0.75f); }); glEnable(GL_DEPTH_TEST); framebuffer->disable(); if (resolution) { resolution->width = width; resolution->height = height; } return framebuffer->getTexture(); }
void KernelMessages::update() { uint32 currentTimer = _vm->_game->_scene._frameStartTime; for (uint i = 0; i < _entries.size() && !_vm->_game->_trigger; ++i) { if (_vm->_game->_trigger) break; KernelMessage &msg = _entries[i]; if (((msg._flags & KMSG_ACTIVE) != 0) && (currentTimer >= msg._frameTimer)) processText(i); } }
/** Render a text * * The rect parameter are top, bottom, left right coordonates in pixels * values. * * \param qr The quad renderer use to draw * \param text The text to draw * \param color The color used to draw the text * \param rect The rectangle where the text is drawn * \param wordwrap The word wrap parameter * \param vVertAlign The vertical alignment flag * \param vHorzAlign The horizontal alignment flag * */ void RainbruRPG::OgreGui::Font:: renderAligned( Brush* qr, const std::string& text, const ColourValue& color, const Ogre::Rectangle& rect, bool wordwrap, VerticalAlignType vVertAlign, HorizontalAlignType vHorzAlign) { // Process the text block into lines mLineList.resize( 0 ); float textWidth=rect.right-rect.left; processText( text, textWidth, mLineList, wordwrap ); renderAligned( qr, mLineList, color, rect, vVertAlign, vHorzAlign ); }
void NSRPopplerDocument::renderPage(int page) { double dpix, dpiy; if (_doc == NULL || page > getNumberOfPages() || page < 1) return; _page = _catalog->getPage(page); if (isTextOnly()) { PDFRectangle *rect; GooString *text; TextOutputDev *dev; dev = new TextOutputDev (0, gFalse, gFalse, gFalse); _doc->displayPageSlice(dev, _page->getNum(), 72, 72, 0, gFalse, gTrue, gFalse, -1, -1, -1, -1); rect = _page->getCropBox(); text = dev->getText(rect->x1, rect->y1, rect->x2, rect->y2); _text = processText(QString::fromUtf8(text->getCString())); delete text; delete dev; _readyForLoad = true; return; } if (isZoomToWidth()) { double wZoom = ((double) getScreenWidth() / (double) _page->getCropWidth() * 100.0); setZoomSilent((int) wZoom); } if (getZoom() > getMaxZoom()) setZoomSilent (getMaxZoom()); else if (getZoom() < getMinZoom()) setZoomSilent (getMinZoom()); if (_readyForLoad) _dev->startPage(0, NULL); dpix = _dpix * getZoom() / 100.0; dpiy = _dpiy * getZoom() / 100.0; _page->display(_dev, dpix, dpiy, getRotation(), gFalse, gFalse, gTrue, _catalog); _readyForLoad = true; }
void processPacket(struct packet *p) { if ((p->len==32) && (p->protocol=='G') && (p->id == id || p->id == 0) ){ //check sanity, protocol, id if (p->command=='T'){ struct packet ack; ack.len=sizeof(p); ack.protocol='G'; ack.command='a'; ack.id= id; ack.ctr= p->ctr; ack.c.ack.flags = 0; nrf_snd_pkt_crc(sizeof(ack),(uint8_t*)&ack); processText(&(p->c.text)); } else if (p->command=='N'){ processNickRequest(&(p->c.nickrequest)); } else if (p->command=='A'){ processAnnounce(&(p->c.announce)); } } }
/* Got content <s> of len <l> inside of tag <t>, starting at * global byte position <p> of input (used for error output) */ void gotContent(int t, char* s, int l, long long p) { static int count = 0; static int skipText = 0; int len, ulen; s[l] = 0; if (t == tagTitle) { count++; strncpy(currentTitle, s, TLEN); return; } if (t != tagText) return; // progress if ((count % 1000) == 0) fprintf(stderr, "Art. %d (at %lld, len %5d) [skipped %d]: '%s'\n", count, p, l, skipText, currentTitle); // skip articles with ':' and '/' in title if ((strchr(currentTitle, ':') != 0) || (strchr(currentTitle, '/') != 0)) { skipText++; return; } //printf("%s: %d\n%s\n\n", currentTitle, l, s); len = l; ulen = processText((unsigned char*)s, &len); if ((count % 1000) == 0) { debug("Art. %d ('%s'): Bytelen %d -> %d, UChars %d\n", count, currentTitle, l, len, ulen); } printf("%c\n%s\n%d\n%c\n%s\n%c\n", 1, currentTitle, len, 2, s, 3); }
int PonscripterLabel::textCommand() { if (pretextgosub_label && (line_enter_status == 0 || (line_enter_status == 1 && (script_h.readStrBuf(string_buffer_offset) == '[' || (zenkakko_flag && file_encoding->DecodeChar(script_h.getStrBuf(string_buffer_offset)) == 0x3010 /* left lenticular bracket */))))) { gosubDoPretextgosub(); line_enter_status = 1; return RET_CONTINUE; } int ret = enterTextDisplayMode(); if (ret != RET_NOMATCH) return ret; line_enter_status = 2; ret = processText(); if (ret == RET_CONTINUE) { indent_offset = 0; } return ret; }
/** * Changes the text to use the small-size font. */ void Text::setSmall() { _font = _small; processText(); }
void RunEdit::insPathOnly () { processText (Event ('!')); processText (Event ('t')); }
void RunEdit::insDrive () { processText (Event ('!')); processText (Event ('v')); }
void RunEdit::insDir () { processText (Event ('!')); processText (Event ('d')); }
/** * Changes the text to use the big-size font. */ void Text::setBig() { _font = _big; processText(); }
void RunEdit::insFile () { processText (Event ('!')); processText (Event ('f')); }