/** Draws the page header to the current page */ void MReportEngine::drawPageHeader( MPageCollection * pages ) { if ( pHeader->getHeight() == 0 ) return ; if (( currY + pHeader->getHeight() ) > currHeight ) newPage( pages ); if (( pHeader->printFrequency() == MReportSection::FirstPage && currPage == 1 ) || ( pHeader->printFrequency() == MReportSection::EveryPage ) ) { pHeader->setPageNumber( currPage ); pHeader->setReportDate( currDate ); int sectionHeight = pHeader->getHeight(); pHeader->draw( p, leftMargin, currY, sectionHeight ); currY += sectionHeight; } }
void TopLevel::prevPage() { if(!thispage) return; if (thispage->prev) { thispage = thispage->prev; newPage(); resizeView(); putImage(); } updateGoActions(); }
void TopLevel::nextPage() { if(!thispage) return; if (thispage->next) { thispage = thispage->next; newPage(); resizeView(); putImage(); } updateGoActions(); }
QList<KoPAPage *> KoPADocument::loadOdfPages(const KXmlElement &body, KoPALoadingContext &context) { if (d->masterPages.isEmpty()) { // we require at least one master page. Auto create one if the doc was faulty. d->masterPages << newMasterPage(); } QList<KoPAPage *> pages; KXmlElement element; forEachElement(element, body) { if (element.tagName() == "page" && element.namespaceURI() == KOdfXmlNS::draw) { KoPAPage *page = newPage(static_cast<KoPAMasterPage*>(d->masterPages.first())); page->loadOdf(element, context); pages.append(page); } } return pages; }
shared_ptr<Page> FilePageStore::createPage() { if (_readOnly == true) { throw Tgs::Exception("Error creating page -- index is read only."); } // first create in file char * pData = Page::allocateAligned(_pageSize); _writePage(_pageCount, pData); shared_ptr<Page> newPage(_createPage(this, _pageCount, pData, _pageSize)); _pagesMap[_pageCount] = newPage; _pageCount++; return newPage; }
//------------------------------------------------------------------------------ // onButtonHit() -- handle button hits (with button name) as page change requests //------------------------------------------------------------------------------ bool Page::onButtonHit(const Basic::String* const obhobj) { bool used = false; if (obhobj != 0 && pageChgEvents != 0) { used = true; Basic::Pair* pageEvent = pageChgEvents->findByName(*obhobj); if (pageEvent != 0) { Basic::Identifier* id = dynamic_cast<Basic::Identifier*>(pageEvent->object()); if (id != 0) { // Find our container and the new page ID, then push // current page and go to new page newPage(*id,this); } } } return used; }
void lrubuf::actual_entermgr(LID pageid, iofdctl * disk, int bufid) { getinlru(pageid, disk, bufid); int hashid = pageid % bufsize; npnode * newp = newPage(pageid, bufid, disk); npnode * itp; if(mgr_array[hashid] == NULL) mgr_array[hashid] = newp; else { itp = mgr_array[hashid]; while(itp->next != NULL) itp = itp->next; itp->next = newp; } freebuf--; }
void CharMap::SplitCodePage(wxUint32 splitCodeFirst) { CodePage *page = GetCodePage(splitCodeFirst); if (page == NULL || page->GetRangeStart() == splitCodeFirst) { return; } CodePage oldPage(*page); CodePage newPage(*page, splitCodeFirst, page->GetRangeEnd()); RemoveCodePage(page); // Todo: delete only present glyphs for (wxUint32 i = splitCodeFirst; i <= oldPage.GetRangeEnd(); i++) { oldPage.Remove(i); } oldPage.SetEnd(splitCodeFirst - 1); AddCodePage(oldPage); AddCodePage(newPage); }
void LinearAllocator::ensureNext(size_t size) { if (fitsInCurrentPage(size)) return; if (m_currentPage && m_pageSize < MAX_PAGE_SIZE) { m_pageSize = std::min(MAX_PAGE_SIZE, m_pageSize * 2); m_pageSize = ALIGN(m_pageSize); } m_wastedSpace += m_pageSize; Page* p = newPage(m_pageSize); if (m_currentPage) m_currentPage->setNext(p); m_currentPage = p; if (!m_pages) m_pages = m_currentPage; m_next = start(m_currentPage); }
void TopLevel::firstPage() { if(!thispage) return; if ( thispage->prev ) { while(thispage->prev != NULL) thispage = thispage->prev; newPage(); resizeView(); putImage(); } updateGoActions(); }
void TopLevel::lastPage() { if(!thispage) return; if ( thispage->next ) { while(thispage->next != NULL) thispage = thispage->next; newPage(); resizeView(); putImage(); } updateGoActions(); }
shared_ptr<Page> FilePageStore::getPage(int id) { // If the page does not resides in memory then get it from file and call createPage() if (_pagesMap.find(id) != _pagesMap.end()) { if(_pagesMap[id].expired() != true) { return _pagesMap[id].lock(); } } char * pData = Page::allocateAligned(_pageSize); _readPage(id, pData); shared_ptr<Page> newPage(_createPage(this, id, pData, _pageSize)); _pagesMap[id] = newPage; return newPage; }
void LinearAllocator::ensureNext(size_t size) { if (fitsInCurrentPage(size)) return; if (mCurrentPage && mPageSize < MAX_PAGE_SIZE) { mPageSize = min(MAX_PAGE_SIZE, mPageSize * 2); mPageSize = ALIGN(mPageSize); } mWastedSpace += mPageSize; Page* p = newPage(mPageSize); if (mCurrentPage) { mCurrentPage->setNext(p); } mCurrentPage = p; if (!mPages) { mPages = mCurrentPage; } mNext = start(mCurrentPage); }
void* LinearAllocator::allocImpl(size_t size) { size = ALIGN(size); if (size > mMaxAllocSize && !fitsInCurrentPage(size)) { ALOGV("Exceeded max size %zu > %zu", size, mMaxAllocSize); // Allocation is too large, create a dedicated page for the allocation Page* page = newPage(size); mDedicatedPageCount++; page->setNext(mPages); mPages = page; if (!mCurrentPage) mCurrentPage = mPages; return start(page); } ensureNext(size); void* ptr = mNext; mNext = ((char*)mNext) + size; mWastedSpace -= size; return ptr; }
/** Draws the report footer to the current page */ void MReportEngine::drawReportFooter(MPageCollection *pages) { if (rFooter->getHeight() == 0) return; if ((currY + rFooter->getHeight()) > currHeight) newPage(pages); if ((rFooter->printFrequency() == MReportSection::EveryPage) || (rFooter->printFrequency() == MReportSection::LastPage)) { rFooter->setCalcFieldData(grandTotal); rFooter->setPageNumber(currPage); rFooter->setReportDate(currDate); int sectionHeight = rFooter->getHeight(); rFooter->draw(p, leftMargin, currY, sectionHeight); currY += sectionHeight; } }
void TopLevel::openadd(QString filename) { auxpage = lastpage; loadfile(filename); if( firstpage != lastpage ) { if(auxpage->next) auxpage = auxpage->next; } // auxpage should now point to the first pagenode which was created for // the newly added fax file. have_no_fax = false; thispage = auxpage; newPage(); resizeView(); putImage(); }
void QtRPT::processReport(QPrinter *printer, bool draw, int pageReport) { int y = 0; drawBackground(painter); if (pageReport > 0) { newPage(printer, y, draw); } processRTitle(y,draw); processPHeader(y,draw); processMHeader(y,draw); processPFooter(draw); processMasterData(printer,y,draw,pageReport); processMFooter(printer,y,draw); processRSummary(printer,y,draw); //proccessPFooter(y,draw); }
/* Simulates a random page replacement algorithm. * Uses a vector to maintain the unordered list of pages. * */ void random(int numPFrames) { std::vector<Page> pages(numPFrames); int pageID; while(std::cin >> pageID) { /* Do nothing if page is found. */ if (tableContainsPage(pages, pageID)) continue; /* Else we have a page fault. */ std::cout << pageID << std::endl; Page newPage(pageID); int i = rand() % numPFrames; pages[i] = newPage; //std::cout << "Adding page " << newPage.id << std::endl; //printPages(pages); } }
//------------------------------------------------------------------------------ // onKeyHit() -- handle keyboard inputs as page change requests //------------------------------------------------------------------------------ bool Page::onKeyHit(const int key) { bool used = false; if (pageChgEvents != 0) { char keyName[2]; keyName[0] = char(key); keyName[1] = '\0'; // search for a page change event Basic::Pair*pageEvent = pageChgEvents->findByName(keyName); if (pageEvent != 0) { Basic::Identifier* id = dynamic_cast<Basic::Identifier*>(pageEvent->object()); if (id != 0) { // Find our container and the new page ID, then push // current page and go to new page newPage(*id,this); used = true; } } } return used; }
//copyright : (C) 2002-2004 InfoSiAL S.L. //email : [email protected] void MReportEngine::drawAddOnHeader( MPageCollection * pages, int level, QPtrList < QMemArray < double > > *gDT, QValueVector < QString > *gDTS ) { MReportSection * header = findAddOnHeader( level ); if ( header ) { QDomNode record = records.item( currRecord_ ); if ( !header->mustBeDrawed( &record ) ) return ; header->setPageNumber( currPage ); header->setReportDate( currDate ); if (( currY + header->getHeight() ) > currHeight ) newPage( pages ); QString value; QDomNamedNodeMap fields = record.attributes(); for ( int i = 0; i < header->getFieldCount(); i++ ) { value = fields.namedItem( header->getFieldName( i ) ).nodeValue(); header->setFieldData( i, value ); } if ( level > -1 ) { if ( gDT ) header->setCalcFieldData( gDT, gDTS, &record ); } header->setCalcFieldDataGT( grandTotal, rFooter ); int sectionHeight = header->getHeight(); header->draw( p, leftMargin, currY, sectionHeight ); currY += sectionHeight; } }
void createTableHdr(int objType, int tableType) { int m; char s1[MAXLINE+1]; char s2[MAXLINE+1]; if ( tableType == SERIES_TABLE ) { if ( objType == NODE ) sprintf(TableHdr.Line1, "<<< Node %s >>>", IDname); else sprintf(TableHdr.Line1, "<<< Link %s >>>", IDname); strcpy(TableHdr.Line2, "Time "); strcpy(TableHdr.Line3, "hr:min "); strcpy(TableHdr.Line4, "-------"); } if ( tableType == STATS_TABLE ) { strcpy(TableHdr.Line1, ""); sprintf(TableHdr.Line2, "%-16s", StatsHdrs[tableType]); if ( objType == NODE ) strcpy(TableHdr.Line3, "for Node "); else strcpy(TableHdr.Line3, "for Link "); strcpy(TableHdr.Line4, "----------------"); } for (m=1; m<=MSX.Nobjects[SPECIES]; m++) { if ( !MSX.Species[m].rpt ) continue; if ( objType == NODE && MSX.Species[m].type == WALL ) continue; sprintf(s1, " %10s", MSX.Species[m].id); strcat(TableHdr.Line2, s1); strcat(TableHdr.Line4, " ----------"); MSXinp_getSpeciesUnits(m, s1); sprintf(s2, " %10s", s1); strcat(TableHdr.Line3, s2); } if ( MSX.PageSize > 0 && MSX.PageSize - LineNum < 8 ) newPage(); else writeTableHdr(); }
//copyright : (C) 2002-2004 InfoSiAL S.L. //email : [email protected] void MReportEngine::drawDetailFooter(MPageCollection *pages, int level, QPtrList<QMemArray<double> > *gDT, QValueVector<QString> *gDTS) { MReportSection *footer = findDetailFooter(level); MReportSection *header = findDetailHeader(level); if (footer) { QDomNode record = records.item(currRecord_); if (!footer->mustBeDrawed(&record)) return; footer->setPageNumber(currPage); footer->setReportDate(currDate); if ((currY + footer->getHeight()) > currHeight) { newPage(pages); for (int i = 0; i <= level; i++) { drawAddOnHeader(pages, i, gDTFooters[i], gDTSFooters[i]); } } if (gDT) footer->setCalcFieldData(gDT, gDTS, &record, fillRecords_); if (header) footer->drawHeaderObjects(p, pages, header); int sectionHeight = footer->getHeight(); if (footer->placeAtBottom()) { footer->draw(p, leftMargin, (pageHeight - bottomMargin - pFooter->getHeight()) - footer->getHeight(), sectionHeight); } else footer->draw(p, leftMargin, currY, sectionHeight); currY += sectionHeight; } }
/* * Memory allocate */ static void *_mem_malloc(RAW_U32 size, MACB *macb) { LIST *q; if ( macb->testmode) { chkalloc(0, 0, macb); } /* If smaller than the minimum fragment size, allocate the minimum fragment size */ if ( size > 0 && size < MIN_FRAGMENT ) { size = MIN_FRAGMENT; } size = ROUND(size); if ( size <= 0 ) { return 0; } /* Search free queue */ q = searchFreeArea(size, macb); if ( q != &macb->freeque ) { /* Free space available: first, isolate from free queue */ removeFreeQue(q); q = q - 1; } else { /* No free space, then allocate new page */ q = newPage(size, macb); if ( q == 0 ) { return 0; /* Insufficient memory */ } } /* Allocate memory */ return allocate(q, size, macb); }
PrintSheet::PrintSheet( DigiDoc *doc, QPrinter *printer ) : QPainter( printer ) , p( printer ) { printer->setOrientation( QPrinter::Portrait ); left = p->pageRect().left(); margin = left; right = p->pageRect().right() - 2*margin; top = p->pageRect().top(); bottom = p->pageRect().y() + p->pageRect().height() - 2*margin; #ifdef Q_OS_MAC scale( 0.8, 0.8 ); right /= 0.8; bottom /= 0.8; #endif QFont text = font(); text.setFamily( "Arial, Liberation Sans, Helvetica, sans-serif" ); text.setPixelSize( 12 ); QFont head = text; QFont sHead = text; head.setPixelSize( 28 ); sHead.setPixelSize( 18 ); QPen oPen = pen(); QPen sPen = pen(); QPen hPen = pen(); hPen.setWidth( 2 ); sPen.setWidth( 1 ); sPen.setStyle( Qt::DotLine ); setFont( head ); QRect rect( left, top, right, 60 ); drawText( rect, Qt::TextWordWrap, tr("VALIDITY CONFIRMATION SHEET"), &rect ); setPen( hPen ); drawLine( left, rect.bottom(), right, rect.bottom() ); top += rect.height() + 30; setFont( sHead ); drawText( left, top, tr("SIGNED FILES") ); setPen( sPen ); drawLine( left, top+3, right, top+3 ); top += 30; setFont( text ); setPen( oPen ); drawText( left, top, tr("FILE NAME") ); drawText( right-150, top, tr("FILE SIZE") ); for( int i = 0; i < doc->documentModel()->rowCount(); ++i ) { int fileHeight = drawTextRect( QRect( left, top+5, right - left - 150, 20 ), doc->documentModel()->index( i, 0 ).data().toString() ); drawTextRect( QRect( right-150, top+5, 150, fileHeight ), doc->documentModel()->index( i, 2 ).data().toString() ); top += fileHeight; newPage( 50 ); } top += 35; newPage( 50 ); setFont( sHead ); drawText( left, top, tr("SIGNERS") ); setPen( sPen ); drawLine( left, top+3, right, top+3 ); top += 30; setFont( text ); setPen( oPen ); int i = 1; Q_FOREACH( const DigiDocSignature &sig, doc->signatures() ) { const SslCertificate cert = sig.cert(); bool tempel = cert.isTempel(); newPage( 50 ); drawText( left, top, tr("NO.") ); drawText( left+40, top, tempel ? tr( "COMPANY" ) : tr( "NAME" ) ); drawText( right-300, top, tempel ? tr("REGISTER CODE") : tr("PERSONAL CODE") ); drawText( right-170, top, tr("TIME") ); top += 5; int nameHeight = drawTextRect( QRect( left+40, top, right - left - 340, 20 ), cert.toString( cert.showCN() ? "CN" : "GN SN" ) ); drawTextRect( QRect( left, top, 40, nameHeight ), QString::number( i++ ) ); drawTextRect( QRect( right-300, top, 130, nameHeight ), cert.subjectInfo( "serialNumber" ) ); drawTextRect( QRect( right-170, top, 170, nameHeight ), DateTime( sig.dateTime() ).toStringZ( "dd.MM.yyyy hh:mm:ss" ) ); top += 20 + nameHeight; QString valid; switch( sig.validate() ) { case DigiDocSignature::Valid: valid.append( tr("SIGNATURE IS VALID") ); break; case DigiDocSignature::Invalid: valid.append( tr("SIGNATURE IS NOT VALID") ); break; case DigiDocSignature::Unknown: valid.append( tr("UNKNOWN") ); break; } if( sig.isTest() ) valid += " " + tr("(NB! TEST SIGNATURE)"); customText( tr("VALIDITY OF SIGNATURE"), valid ); customText( tr("ROLE / RESOLUTION"), sig.role() ); customText( tr("PLACE OF CONFIRMATION (CITY, STATE, ZIP, COUNTRY)"), sig.location() ); customText( tr("SERIAL NUMBER OF SIGNER CERTIFICATE"), cert.serialNumber() ); newPage( 50 ); drawText( left, top, tr("ISSUER OF CERTIFICATE") ); drawText( left+207, top, tr("HASH VALUE OF ISSUER'S PUBLIC KEY") ); top += 5; int issuerHeight = drawTextRect( QRect( left, top, 200, 20 ), cert.issuerInfo( QSslCertificate::CommonName ) ); drawTextRect( QRect( left+200, top, right - left - 200, issuerHeight ), cert.toHex( cert.authorityKeyIdentifier() ) ); top += 20 + issuerHeight; customText( tr("HASH VALUE OF VALIDITY CONFIRMATION (OCSP RESPONSE)"), cert.toHex( sig.ocspDigestValue() ) ); top += 15; } save(); newPage( 50 ); QTextDocument textDoc; textDoc.setTextWidth( right - margin ); textDoc.setHtml( tr("The print out of files listed in the section <b>\"Signed Files\"</b> " "are inseparable part of this Validity Confirmation Sheet.") ); translate( QPoint( left, top - 30) ); textDoc.drawContents( this , QRectF( 0, 0, right - margin, 40) ); top += 30; restore(); newPage( 90 ); drawText( left+3, top, tr("NOTES") ); top += 10; drawRect( left, top, right - margin, 80 ); end(); }
// Print a range of lines to a printer. int QsciPrinter::printRange(QsciScintillaBase *qsb, int from, int to) { // Sanity check. if (!qsb) return false; // Setup the printing area. QRect def_area; def_area.setX(0); def_area.setY(0); QPaintDeviceMetrics metrics(this); def_area.setWidth(metrics.width()); def_area.setHeight(metrics.height()); // Get the page range. int pgFrom, pgTo; pgFrom = fromPage(); pgTo = toPage(); // Find the position range. long startPos, endPos; endPos = qsb->SendScintilla(QsciScintillaBase::SCI_GETLENGTH); startPos = (from > 0 ? qsb -> SendScintilla(QsciScintillaBase::SCI_POSITIONFROMLINE,from) : 0); if (to >= 0) { long toPos = qsb -> SendScintilla(QsciScintillaBase::SCI_POSITIONFROMLINE,to + 1); if (endPos > toPos) endPos = toPos; } if (startPos >= endPos) return false; QPainter painter(this); bool reverse = (pageOrder() == LastPageFirst); bool needNewPage = false; qsb -> SendScintilla(QsciScintillaBase::SCI_SETPRINTMAGNIFICATION,mag); qsb -> SendScintilla(QsciScintillaBase::SCI_SETPRINTWRAPMODE,wrap); for (int i = 1; i <= numCopies(); ++i) { // If we are printing in reverse page order then remember the start // position of each page. QValueStack<long> pageStarts; int currPage = 1; long pos = startPos; while (pos < endPos) { // See if we have finished the requested page range. if (pgTo > 0 && pgTo < currPage) break; // See if we are going to render this page, or just see how much // would fit onto it. bool render = false; if (pgFrom == 0 || pgFrom <= currPage) { if (reverse) pageStarts.push(pos); else { render = true; if (needNewPage) { if (!newPage()) return false; } else needNewPage = true; } } QRect area = def_area; formatPage(painter,render,area,currPage); pos = qsb -> SendScintilla(QsciScintillaBase::SCI_FORMATRANGE,render,&painter,area,pos,endPos); ++currPage; } // All done if we are printing in normal page order. if (!reverse) continue; // Now go through each page on the stack and really print it. while (!pageStarts.isEmpty()) { --currPage; long ePos = pos; pos = pageStarts.pop(); if (needNewPage) { if (!newPage()) return false; } else needNewPage = true; QRect area = def_area; formatPage(painter,true,area,currPage); qsb->SendScintilla(QsciScintillaBase::SCI_FORMATRANGE,true,&painter,area,pos,ePos); } } return true; }
bool texLoad(const char *fileName) { char fullPath[PATH_MAX], partialPath[PATH_MAX], *buffer; unsigned int i, j, k, size; int texPage; GLint glval; firstPage = _TEX_INDEX; ASSERT_OR_RETURN(false, _TEX_INDEX < iV_TEX_MAX, "Too many texture pages used"); ASSERT_OR_RETURN(false, MIPMAP_MAX == TILE_WIDTH && MIPMAP_MAX == TILE_HEIGHT, "Bad tile sizes"); // store the filename so we can later determine which tileset we are using if (tileset) free(tileset); tileset = strdup(fileName); // reset defaults mipmap_max = MIPMAP_MAX; mipmap_levels = MIPMAP_LEVELS; glGetIntegerv(GL_MAX_TEXTURE_SIZE, &glval); while (glval < mipmap_max * TILES_IN_PAGE_COLUMN) { mipmap_max /= 2; mipmap_levels--; debug(LOG_ERROR, "Max supported texture size %dx%d is too low - reducing texture detail to %dx%d.", (int)glval, (int)glval, mipmap_max, mipmap_max); ASSERT(mipmap_levels > 0, "Supported texture size %d is too low to load any mipmap levels!", (int)glval); if (mipmap_levels == 0) { exit(1); } } while (maxTextureSize < mipmap_max) { mipmap_max /= 2; mipmap_levels--; debug(LOG_TEXTURE, "Downgrading texture quality to %d due to user setting %d", mipmap_max, maxTextureSize); } /* Get and set radar colours */ sprintf(fullPath, "%s.radar", fileName); if (!loadFile(fullPath, &buffer, &size)) { debug(LOG_FATAL, "texLoad: Could not find radar colours at %s", fullPath); abort(); // cannot recover; we could possibly generate a random palette? } i = 0; // tile j = 0; // place in buffer do { unsigned int r, g, b; int cnt = 0; k = sscanf(buffer + j, "%2x%2x%2x%n", &r, &g, &b, &cnt); j += cnt; if (k >= 3) { radarColour(i, r, g, b); } i++; // next tile } while (k >= 3 && j + 6 < size); free(buffer); /* Now load the actual tiles */ i = mipmap_max; // i is used to keep track of the tile dimensions for (j = 0; j < mipmap_levels; j++) { int xOffset = 0, yOffset = 0; // offsets into the texture atlas int xSize = 1; int ySize = 1; const int xLimit = TILES_IN_PAGE_COLUMN * i; const int yLimit = TILES_IN_PAGE_ROW * i; // pad width and height into ^2 values while (xLimit > (xSize *= 2)) {} while (yLimit > (ySize *= 2)) {} // Generate the empty texture buffer in VRAM texPage = newPage(fileName, j, xSize, ySize, 0); sprintf(partialPath, "%s-%d", fileName, i); // Load until we cannot find anymore of them for (k = 0; k < MAX_TILES; k++) { iV_Image tile; sprintf(fullPath, "%s/tile-%02d.png", partialPath, k); if (PHYSFS_exists(fullPath)) // avoid dire warning { bool retval = iV_loadImage_PNG(fullPath, &tile); ASSERT_OR_RETURN(false, retval, "Could not load %s!", fullPath); } else { // no more textures in this set ASSERT_OR_RETURN(false, k > 0, "Could not find %s", fullPath); break; } // Insert into texture page glTexSubImage2D(GL_TEXTURE_2D, j, xOffset, yOffset, tile.width, tile.height, GL_RGBA, GL_UNSIGNED_BYTE, tile.bmp); free(tile.bmp); if (i == mipmap_max) // dealing with main texture page; so register coordinates { tileTexInfo[k].uOffset = (float)xOffset / (float)xSize; tileTexInfo[k].vOffset = (float)yOffset / (float)ySize; tileTexInfo[k].texPage = texPage; debug(LOG_TEXTURE, " texLoad: Registering k=%d i=%d u=%f v=%f xoff=%d yoff=%d xsize=%d ysize=%d tex=%d (%s)", k, i, tileTexInfo[k].uOffset, tileTexInfo[k].vOffset, xOffset, yOffset, xSize, ySize, texPage, fullPath); } xOffset += i; // i is width of tile if (xOffset + i > xLimit) { yOffset += i; // i is also height of tile xOffset = 0; } if (yOffset + i > yLimit) { /* Change to next texture page */ xOffset = 0; yOffset = 0; debug(LOG_TEXTURE, "texLoad: Extra page added at %d for %s, was page %d, opengl id %u", k, partialPath, texPage, (unsigned int)_TEX_PAGE[texPage].id); texPage = newPage(fileName, j, xSize, ySize, k); } } debug(LOG_TEXTURE, "texLoad: Found %d textures for %s mipmap level %d, added to page %d, opengl id %u", k, partialPath, i, texPage, (unsigned int)_TEX_PAGE[texPage].id); i /= 2; // halve the dimensions for the next series; OpenGL mipmaps start with largest at level zero } return true; }
void PmlReader::processTag(std::string &tagName, const std::string ¶meter) { const char tagDeterminant = *tagName.data(); switch (tagDeterminant) { case 'p': newPage(); break; case 'x': //TODO add close tag processing newPage(); break; case 'B': if (!myState.BoldBlockOn) { processFontProperty(FONT_BOLD); } break; case 'i': processFontProperty(FONT_ITALIC); break; case 'u': processFontProperty(FONT_UNDERLINED); break; case 'v': myState.InvisibleText = !myState.InvisibleText;; break; case 'c': processAlignment(ALIGN_CENTER); break; case 'r': processAlignment(ALIGN_RIGHT); break; case 'n': processFontSize(NORMAL); break; case 'b': myState.BoldBlockOn = !myState.BoldBlockOn; processFontProperty(FONT_BOLD); break; case 's': processFontSize(SMALLER); break; case 'l': processFontSize(LARGER); break; case 'k': myState.SmallCaps = !myState.SmallCaps; processFontSize(SMALLER); break; case 'S': if (tagName == "Sb") { processFontProperty(FONT_SUBSCRIPT); } else if (tagName == "Sp") { processFontProperty(FONT_SUPERSCRIPT); } else if (tagName == "Sd") { //processSidebarLink(); } break; case 't': processIndent(); break; case 'T': processIndent(parameter); myState.IndentBlockOn = false; break; case 'w': //addHorizontalRule(parameter); break; case 'F': processLink(FOOTNOTE, parameter); break; case 'q': processLink(INTERNAL_HYPERLINK, parameter); break; case 'Q': addLinkLabel(parameter); break; case 'm': addImageReference(parameter); break; default: //std::cerr << "PmlReader: unsupported tag: name: " << tagName << " parameter: " << parameter << "\n"; break; } }
int ONScripterLabel::processText() { //printf("textCommand %c %d %d %d\n", script_h.getStringBuffer()[ string_buffer_offset ], string_buffer_offset, event_mode, line_enter_status); char out_text[3]= {'\0', '\0', '\0'}; if ( event_mode & (WAIT_INPUT_MODE | WAIT_SLEEP_MODE) ){ draw_cursor_flag = false; if ( clickstr_state == CLICK_WAIT ){ if (script_h.checkClickstr(script_h.getStringBuffer() + string_buffer_offset) != 1) string_buffer_offset++; string_buffer_offset++; clickstr_state = CLICK_NONE; } else if ( clickstr_state == CLICK_NEWPAGE ){ event_mode = IDLE_EVENT_MODE; if (script_h.checkClickstr(script_h.getStringBuffer() + string_buffer_offset) != 1) string_buffer_offset++; string_buffer_offset++; newPage( true ); clickstr_state = CLICK_NONE; return RET_CONTINUE | RET_NOREAD; } else if ( IS_TWO_BYTE(script_h.getStringBuffer()[ string_buffer_offset ]) ){ string_buffer_offset += 2; } else if ( script_h.getStringBuffer()[ string_buffer_offset ] == '!' ){ string_buffer_offset++; if ( script_h.getStringBuffer()[ string_buffer_offset ] == 'w' || script_h.getStringBuffer()[ string_buffer_offset ] == 'd' ){ string_buffer_offset++; while ( script_h.getStringBuffer()[ string_buffer_offset ] >= '0' && script_h.getStringBuffer()[ string_buffer_offset ] <= '9' ) string_buffer_offset++; while (script_h.getStringBuffer()[ string_buffer_offset ] == ' ' || script_h.getStringBuffer()[ string_buffer_offset ] == '\t') string_buffer_offset++; } } else if ( script_h.getStringBuffer()[ string_buffer_offset + 1 ] && !(script_h.getEndStatus() & ScriptHandler::END_1BYTE_CHAR) ){ string_buffer_offset += 2; } else string_buffer_offset++; event_mode = IDLE_EVENT_MODE; } if (script_h.getStringBuffer()[string_buffer_offset] == 0x0a || script_h.getStringBuffer()[string_buffer_offset] == 0x00){ indent_offset = 0; // redundant return RET_CONTINUE; } new_line_skip_flag = false; //printf("*** textCommand %d (%d,%d)\n", string_buffer_offset, sentence_font.xy[0], sentence_font.xy[1]); while( (!(script_h.getEndStatus() & ScriptHandler::END_1BYTE_CHAR) && script_h.getStringBuffer()[ string_buffer_offset ] == ' ') || script_h.getStringBuffer()[ string_buffer_offset ] == '\t' ) string_buffer_offset ++; char ch = script_h.getStringBuffer()[string_buffer_offset]; if ( IS_TWO_BYTE(ch) ){ // Shift jis /* ---------------------------------------- */ /* Kinsoku process */ if (IS_KINSOKU( script_h.getStringBuffer() + string_buffer_offset + 2)){ int i = 2; while (!sentence_font.isEndOfLine(i) && IS_KINSOKU( script_h.getStringBuffer() + string_buffer_offset + i + 2)){ i += 2; } if (sentence_font.isEndOfLine(i)){ sentence_font.newLine(); for (int i=0 ; i<indent_offset ; i++){ current_page->add(LOC_TWOBYTE_SYMBOL(' ')[0]); current_page->add(LOC_TWOBYTE_SYMBOL(' ')[1]); sentence_font.advanceCharInHankaku(2); } } } out_text[0] = script_h.getStringBuffer()[string_buffer_offset]; out_text[1] = script_h.getStringBuffer()[string_buffer_offset+1]; if ( clickstr_state == CLICK_IGNORE ){ clickstr_state = CLICK_NONE; } else{ if (script_h.checkClickstr(&script_h.getStringBuffer()[string_buffer_offset]) > 0){ if (sentence_font.getRemainingLine() <= clickstr_line) return clickNewPage( out_text ); else return clickWait( out_text ); } else{ clickstr_state = CLICK_NONE; } } if ( skip_flag || draw_one_page_flag || ctrl_pressed_status ){ drawChar( out_text, &sentence_font, false, true, accumulation_surface, &text_info ); num_chars_in_sentence++; string_buffer_offset += 2; return RET_CONTINUE | RET_NOREAD; } else{ drawChar( out_text, &sentence_font, true, true, accumulation_surface, &text_info ); num_chars_in_sentence++; event_mode = WAIT_SLEEP_MODE; if ( sentence_font.wait_time == -1 ) advancePhase( default_text_speed[text_speed_no] ); else advancePhase( sentence_font.wait_time ); return RET_WAIT | RET_NOREAD; } } else if ( ch == '@' ){ // wait for click return clickWait( NULL ); } else if ( ch == '\\' ){ // new page return clickNewPage( NULL ); } else if ( ch == '_' ){ // Ignore following forced return clickstr_state = CLICK_IGNORE; string_buffer_offset++; return RET_CONTINUE | RET_NOREAD; } else if ( ch == '!' && !(script_h.getEndStatus() & ScriptHandler::END_1BYTE_CHAR) ){ string_buffer_offset++; if ( script_h.getStringBuffer()[ string_buffer_offset ] == 's' ){ string_buffer_offset++; if ( script_h.getStringBuffer()[ string_buffer_offset ] == 'd' ){ sentence_font.wait_time = -1; string_buffer_offset++; } else{ int t = 0; while( script_h.getStringBuffer()[ string_buffer_offset ] >= '0' && script_h.getStringBuffer()[ string_buffer_offset ] <= '9' ){ t = t*10 + script_h.getStringBuffer()[ string_buffer_offset ] - '0'; string_buffer_offset++; } sentence_font.wait_time = t; while (script_h.getStringBuffer()[ string_buffer_offset ] == ' ' || script_h.getStringBuffer()[ string_buffer_offset ] == '\t') string_buffer_offset++; } } else if ( script_h.getStringBuffer()[ string_buffer_offset ] == 'w' || script_h.getStringBuffer()[ string_buffer_offset ] == 'd' ){ bool flag = false; if ( script_h.getStringBuffer()[ string_buffer_offset ] == 'd' ) flag = true; string_buffer_offset++; int tmp_string_buffer_offset = string_buffer_offset; int t = 0; while( script_h.getStringBuffer()[ string_buffer_offset ] >= '0' && script_h.getStringBuffer()[ string_buffer_offset ] <= '9' ){ t = t*10 + script_h.getStringBuffer()[ string_buffer_offset ] - '0'; string_buffer_offset++; } while (script_h.getStringBuffer()[ string_buffer_offset ] == ' ' || script_h.getStringBuffer()[ string_buffer_offset ] == '\t') string_buffer_offset++; if ( skip_flag || draw_one_page_flag || ctrl_pressed_status ){ return RET_CONTINUE | RET_NOREAD; } else{ event_mode = WAIT_SLEEP_MODE; if ( flag ) event_mode |= WAIT_INPUT_MODE; key_pressed_flag = false; startTimer( t ); string_buffer_offset = tmp_string_buffer_offset - 2; return RET_WAIT | RET_NOREAD; } } return RET_CONTINUE | RET_NOREAD; } else if ( ch == '#' && !(script_h.getEndStatus() & ScriptHandler::END_1BYTE_CHAR) ){ readColor( &sentence_font.color, script_h.getStringBuffer() + string_buffer_offset ); readColor( &ruby_font.color, script_h.getStringBuffer() + string_buffer_offset ); string_buffer_offset += 7; return RET_CONTINUE | RET_NOREAD; } else if ( ch == '(' && !(script_h.getEndStatus() & ScriptHandler::END_1BYTE_CHAR)){ current_page->add('('); startRuby( script_h.getStringBuffer() + string_buffer_offset + 1, sentence_font ); string_buffer_offset++; return RET_CONTINUE | RET_NOREAD; } else if ( ch == '/' && !(script_h.getEndStatus() & ScriptHandler::END_1BYTE_CHAR) ){ if ( ruby_struct.stage == RubyStruct::BODY ){ current_page->add('/'); sentence_font.addLineOffset(ruby_struct.margin); string_buffer_offset = ruby_struct.ruby_end - script_h.getStringBuffer(); if (*ruby_struct.ruby_end == ')'){ if ( skip_flag || draw_one_page_flag || ctrl_pressed_status ) endRuby(false, true, accumulation_surface, &text_info); else endRuby(true, true, accumulation_surface, &text_info); current_page->add(')'); string_buffer_offset++; } return RET_CONTINUE | RET_NOREAD; } else{ // skip new line new_line_skip_flag = true; string_buffer_offset++; if (script_h.getStringBuffer()[string_buffer_offset] != 0x0a) errorAndExit( "'new line' must follow '/'." ); return RET_CONTINUE; // skip the following eol } } else if ( ch == ')' && !(script_h.getEndStatus() & ScriptHandler::END_1BYTE_CHAR) && ruby_struct.stage == RubyStruct::BODY ){ current_page->add(')'); string_buffer_offset++; ruby_struct.stage = RubyStruct::NONE; return RET_CONTINUE | RET_NOREAD; } else{ out_text[0] = ch; if ( clickstr_state == CLICK_IGNORE ){ clickstr_state = CLICK_NONE; } else{ int matched_len = script_h.checkClickstr(script_h.getStringBuffer() + string_buffer_offset); if (matched_len > 0){ if (matched_len == 2) out_text[1] = script_h.getStringBuffer()[ string_buffer_offset + 1 ]; if (sentence_font.getRemainingLine() <= clickstr_line) return clickNewPage( out_text ); else return clickWait( out_text ); } else if (script_h.getStringBuffer()[ string_buffer_offset + 1 ] && script_h.checkClickstr(&script_h.getStringBuffer()[string_buffer_offset+1]) == 1 && script_h.getEndStatus() & ScriptHandler::END_1BYTE_CHAR){ if ( script_h.getStringBuffer()[ string_buffer_offset + 2 ] && script_h.checkClickstr(&script_h.getStringBuffer()[string_buffer_offset+2]) > 0){ clickstr_state = CLICK_NONE; } else if (script_h.getStringBuffer()[ string_buffer_offset + 1 ] == '@'){ return clickWait( out_text ); } else if (script_h.getStringBuffer()[ string_buffer_offset + 1 ] == '\\'){ return clickNewPage( out_text ); } else{ out_text[1] = script_h.getStringBuffer()[ string_buffer_offset + 1 ]; if (sentence_font.getRemainingLine() <= clickstr_line) return clickNewPage( out_text ); else return clickWait( out_text ); } } else{ clickstr_state = CLICK_NONE; } } bool flush_flag = true; if ( skip_flag || draw_one_page_flag || ctrl_pressed_status ) flush_flag = false; if ( script_h.getStringBuffer()[ string_buffer_offset + 1 ] && script_h.getStringBuffer()[ string_buffer_offset + 1 ] != 0x0a && !(script_h.getEndStatus() & ScriptHandler::END_1BYTE_CHAR)){ out_text[1] = script_h.getStringBuffer()[ string_buffer_offset + 1 ]; drawDoubleChars( out_text, &sentence_font, flush_flag, true, accumulation_surface, &text_info ); num_chars_in_sentence++; } else if (script_h.getEndStatus() & ScriptHandler::END_1BYTE_CHAR){ drawDoubleChars( out_text, &sentence_font, flush_flag, true, accumulation_surface, &text_info ); num_chars_in_sentence++; } if ( skip_flag || draw_one_page_flag || ctrl_pressed_status ){ if ( script_h.getStringBuffer()[ string_buffer_offset + 1 ] && !(script_h.getEndStatus() & ScriptHandler::END_1BYTE_CHAR)) string_buffer_offset++; string_buffer_offset++; return RET_CONTINUE | RET_NOREAD; } else{ event_mode = WAIT_SLEEP_MODE; if ( sentence_font.wait_time == -1 ) advancePhase( default_text_speed[text_speed_no] ); else advancePhase( sentence_font.wait_time ); return RET_WAIT | RET_NOREAD; } } return RET_NOMATCH; }
//copyright : (C) 2002-2004 InfoSiAL S.L. //email : [email protected] void MReportEngine::drawDetail(MPageCollection *pages, int level, uint &currRecord, const int initRow, const int initCol) { currRecord_ = currRecord; QString detailValue; int nextLevel; int detailHeight = 0; MReportSection *detail = findDetail(level); MReportSection *footer; if (detail) detailHeight = detail->getHeight(); if (!canDrawDetailHeader(level, currRecord, currY)) { if (level > 0) drawAddOnFooter(pages, (level - 1), gDTFooters[(level - 1)], gDTSFooters[(level - 1)]); newPage(pages, level); // Sólo dibujamos el detail header si no hemos dibujado ya el addOnHeader if (!findAddOnHeader(level)) drawDetailHeader(pages, level); } else { drawDetailHeader(pages, level); } if (!detail) { drawDetailFooter(pages, level); return; } gDTFooters[level]->clear(); gDTSFooters[level]->clear(); int currLevel; int chkRow = 0; int loops = 0; if (initCol != 0) currX = leftMargin + (detail->getWidth() * (initCol - 1)); if (initRow != 0) currY = topMargin + (detail->getHeight() * (initRow - 1)); currLevel = level; do { QDomNode record = records.item(currRecord); if (record.nodeType() == QDomNode::ElementNode) { if (currLevel == level) { if ((chkRow = (currRecord / 2) % 20) == 0) emit signalRenderStatus(currRecord / 2); if (cancelRender) { MLabelObject lblCancel; lblCancel.setFont("Arial", 20, MLabelObject::Bold, false); lblCancel.setText(tr("INFORME INCOMPLETO\nCANCELADO POR EL USUARIO")); lblCancel.setGeometry(20, pageHeight / 2, 450, 70); lblCancel.setHorizontalAlignment(MLabelObject::Center); lblCancel.setVerticalAlignment(MLabelObject::Middle); lblCancel.draw(p); return; } QDomNamedNodeMap fields = record.attributes(); reserveSizeForCalcFields(&fields, level); detail->setPageNumber(currPage); detail->setReportDate(currDate); if (!canDrawDetail(level, currRecord, currY)) { if (loops) { drawAddOnFooter(pages, level, gDTFooters[level], gDTSFooters[level]); } else { if (level > 0) { drawAddOnFooter(pages, (level - 1), gDTFooters[(level - 1)], gDTSFooters[(level - 1)]); } } newPage(pages, level); } QDomNode record = records.item(currRecord); QDomNode *ptrRecord = &record; setFieldValues(&fields, level, detail, ptrRecord); if (detail->mustBeDrawed(ptrRecord)) { detail->setCalcFieldData(0, 0, ptrRecord, fillRecords_); int sectionHeight = detail->getHeight(); detail->draw(p, currX, currY, sectionHeight); detailHeight = sectionHeight; currX += detail->getWidth(); if (currX >= (pageWidth - rightMargin - leftMargin)) { currX = leftMargin; currY += sectionHeight; } MReportSection *rS = findDetail(level + 1); if (!rS) { for (uint i = 0; i <= level; i++) { rS = findDetailHeader(i); if (rS) csvData_ += rS->csvData(); rS = findDetail(i); if (rS) csvData_ += rS->csvData(); } csvData_ += "\n"; } } ++currRecord; } else { drawDetail(pages, currLevel, currRecord); } if (currRecord < records.count()) { record = records.item(currRecord); QDomNamedNodeMap fields = record.attributes(); detailValue = fields.namedItem("level").nodeValue(); currLevel = detailValue.toInt(); } if (cancelRender) { MLabelObject lblCancel; lblCancel.setFont("Arial", 20, MLabelObject::Bold, false); lblCancel.setText(tr("INFORME INCOMPLETO\nCANCELADO POR EL USUARIO")); lblCancel.setGeometry(20, pageHeight / 2, 450, 70); lblCancel.setHorizontalAlignment(MLabelObject::Center); lblCancel.setVerticalAlignment(MLabelObject::Middle); lblCancel.draw(p); return; } } loops++; } while (level <= currLevel && currRecord < records.count()); drawDetailFooter(pages, level, gDTFooters[level], gDTSFooters[level]); footer = findDetailFooter(level); if (footer && currRecord < records.count()) if (footer->newPage()) newPage(pages); }
int PonscripterLabel::processText() { if (string_buffer_restore > 0) { string_buffer_offset = string_buffer_restore; string_buffer_restore = -1; } if (debug_level > 1) { fprintf(stderr,"processText: %d:'%s", string_buffer_offset, script_h.getStrBuf(string_buffer_offset)); } if (event_mode & (WAIT_INPUT_MODE | WAIT_SLEEP_MODE)) { draw_cursor_flag = false; if (script_h.readStrBuf(string_buffer_offset) == '!') { string_buffer_offset++; if (script_h.readStrBuf(string_buffer_offset) == 'w' || script_h.readStrBuf(string_buffer_offset) == 'd') { ++string_buffer_offset; while (script_h.isadigit(script_h.readStrBuf(string_buffer_offset))) { ++string_buffer_offset; } while (script_h.isawspace(script_h.readStrBuf(string_buffer_offset))) ++string_buffer_offset; } } else if (clickstr_state == CLICK_WAIT) { string_buffer_offset += file_encoding->NextCharSizeWithLigatures (script_h.getStrBuf(string_buffer_offset), &sentence_font); clickstr_state = CLICK_NONE; } else if (clickstr_state == CLICK_NEWPAGE) { event_mode = IDLE_EVENT_MODE; string_buffer_offset += file_encoding->NextCharSizeWithLigatures (script_h.getStrBuf(string_buffer_offset), &sentence_font); newPage(true); clickstr_state = CLICK_NONE; return RET_CONTINUE | RET_NOREAD; } else string_buffer_offset += file_encoding->NextCharSizeWithLigatures (script_h.getStrBuf(string_buffer_offset), &sentence_font); event_mode = IDLE_EVENT_MODE; } if (script_h.readStrBuf(string_buffer_offset) == 0x0a || script_h.readStrBuf(string_buffer_offset) == 0x00) { indent_offset = 0; // redundant skip_to_wait = 0; return RET_CONTINUE; } new_line_skip_flag = false; char ch = script_h.readStrBuf(string_buffer_offset); // Chronotrig, multilang inline command hack, ignore ! and # commands when current language isn't being read if (current_read_language != -1 && current_read_language != current_language) { int startingChar = string_buffer_offset; if (ch == '!') { string_buffer_offset++; if (script_h.readStrBuf(string_buffer_offset) == 'w' || script_h.readStrBuf(string_buffer_offset) == 'd') { ++string_buffer_offset; while (script_h.isadigit(script_h.readStrBuf(string_buffer_offset))) { ++string_buffer_offset; } while (script_h.isawspace(script_h.readStrBuf(string_buffer_offset))) ++string_buffer_offset; } else if (script_h.readStrBuf(string_buffer_offset) == 's') { string_buffer_offset++; if (script_h.readStrBuf(string_buffer_offset) == 'd') { string_buffer_offset++; } else { while (script_h.isadigit(script_h.readStrBuf(string_buffer_offset))) { ++string_buffer_offset; } while (script_h.isawspace(script_h.readStrBuf(string_buffer_offset))) ++string_buffer_offset; } } if (string_buffer_offset - startingChar > 3) { return RET_CONTINUE; } else { string_buffer_offset = startingChar; } } else if (ch == '#') { char hexchecker; bool isValidHex = true; for (int i = 0; i <= 5; ++i) { hexchecker = script_h.readStrBuf(string_buffer_offset + i + 1); if (!script_h.isaxdigit(hexchecker)) { isValidHex = false; } } if (isValidHex) { string_buffer_offset += 7; return RET_CONTINUE; } } } if (ch == '@') { // wait for click return clickWait(false); } else if (ch == '\\') { // new page return clickNewPage(false); } else if (ch == '_') { // Ignore following forced return clickstr_state = CLICK_IGNORE; ++string_buffer_offset; return RET_CONTINUE | RET_NOREAD; } else if (ch == '!') { ++string_buffer_offset; if (script_h.readStrBuf(string_buffer_offset) == 's') { ++string_buffer_offset; bool in_skip = (skip_flag || ctrl_pressed_status); int prev_t = sentence_font.wait_time; if (script_h.readStrBuf(string_buffer_offset) == 'd') { sentence_font.wait_time = -1; ++string_buffer_offset; } else { int t = 0; while (script_h.isadigit(script_h.readStrBuf(string_buffer_offset))) { t = t * 10 + script_h.readStrBuf(string_buffer_offset) -'0'; ++string_buffer_offset; } sentence_font.wait_time = t; while (script_h.isawspace(script_h.readStrBuf(string_buffer_offset))) ++string_buffer_offset; } if (!in_skip && (prev_t == 0) && (sentence_font.wait_time != 0)) flush(refreshMode()); } else if (script_h.readStrBuf(string_buffer_offset) == 'w' || script_h.readStrBuf(string_buffer_offset) == 'd') { bool flag = false; bool in_skip = (skip_flag || draw_one_page_flag || ctrl_pressed_status); if (script_h.readStrBuf(string_buffer_offset) == 'd') flag = true; ++string_buffer_offset; int tmp_string_buffer_offset = string_buffer_offset; int t = 0; while (script_h.isadigit(script_h.readStrBuf(string_buffer_offset))) { t = t * 10 + script_h.readStrBuf(string_buffer_offset) - '0'; ++string_buffer_offset; } while (script_h.isawspace(script_h.readStrBuf(string_buffer_offset))) string_buffer_offset++; flush(refreshMode()); if (flag && in_skip) { skip_to_wait = 0; return RET_CONTINUE | RET_NOREAD; } else { if (!flag && in_skip) { //Mion: instead of skipping entirely, let's do a shortened wait (safer) if (t > 100) { t = t / 10; } else if (t > 10) { t = 10; } } skip_to_wait = 0; event_mode = WAIT_SLEEP_MODE; if (flag) event_mode |= WAIT_INPUT_MODE; key_pressed_flag = false; startTimer(t); string_buffer_offset = tmp_string_buffer_offset - 2; return RET_WAIT | RET_NOREAD; } } else { --string_buffer_offset; goto notacommand; } return RET_CONTINUE | RET_NOREAD; } else if (ch == '#') { char hexchecker; for (int i = 0; i <= 5; ++i) { hexchecker = script_h.readStrBuf(string_buffer_offset + i + 1); if (!script_h.isaxdigit(hexchecker)) goto notacommand; } sentence_font.color = readColour(script_h.getStrBuf(string_buffer_offset)); string_buffer_offset += 7; return RET_CONTINUE | RET_NOREAD; } else if (ch == '/') { if (script_h.readStrBuf(string_buffer_offset + 1) != 0x0a) goto notacommand; else { // skip new line new_line_skip_flag = true; string_buffer_offset++; return RET_CONTINUE; // skip the following eol } } else { notacommand: if (clickstr_state == CLICK_IGNORE) { clickstr_state = CLICK_NONE; } else { const char* c = script_h.getStrBuf(string_buffer_offset); if (script_h.checkClickstr(c)) { if (sentence_font.isNoRoomForLines(clickstr_line)) return clickNewPage(true); else return clickWait(true); } } bool flush_flag = !(skip_flag || draw_one_page_flag || skip_to_wait || ctrl_pressed_status || (sentence_font.wait_time == 0) || (current_read_language != -1 && current_read_language != current_language)); drawChar(script_h.getStrBuf(string_buffer_offset), &sentence_font, flush_flag, true, accumulation_surface, &text_info); ++num_chars_in_sentence; if (flush_flag) { event_mode = WAIT_SLEEP_MODE; int wait_time = 0; if ( sentence_font.wait_time == -1 ) wait_time = default_text_speed[text_speed_no]; else wait_time = sentence_font.wait_time; advancePhase(wait_time * 100 / global_speed_modifier); return RET_WAIT | RET_NOREAD; } event_mode = IDLE_EVENT_MODE; //Mion: hack using RET_CONTINUE | RET_WAIT for unflushed text return RET_CONTINUE | RET_WAIT | RET_NOREAD; } return RET_NOMATCH; }