void KMPropertyPage::reload() { clearPages(); m_widgets.clear(); initialize(); setPrinter(0); }
void BookWindow::open (MWWorld::Ptr book) { mBook = book; clearPages(); mCurrentPage = 0; MWBase::Environment::get().getSoundManager()->playSound ("book open", 1.0, 1.0); MWWorld::LiveCellRef<ESM::Book> *ref = mBook.get<ESM::Book>(); BookTextParser parser; std::vector<std::string> results = parser.split(ref->mBase->mText, mLeftPage->getSize().width, mLeftPage->getSize().height); int i=0; for (std::vector<std::string>::iterator it=results.begin(); it!=results.end(); ++it) { MyGUI::Widget* parent; if (i%2 == 0) parent = mLeftPage; else parent = mRightPage; MyGUI::Widget* pageWidget = parent->createWidgetReal<MyGUI::Widget>("", MyGUI::FloatCoord(0.0,0.0,1.0,1.0), MyGUI::Align::Default, "BookPage" + boost::lexical_cast<std::string>(i)); pageWidget->setNeedMouseFocus(false); parser.parsePage(*it, pageWidget, mLeftPage->getSize().width); mPages.push_back(pageWidget); ++i; } updatePages(); setTakeButtonShow(true); }
Document::~Document() { // We need to emit those manually because init() emits them // and init() calls clearPages() // emitting the signals in clearPages() will cause a double emission of the signals. emit aboutToReset(); clearPages(); clearDocument(); }
void pagesManager::megrePagesToFile( int begin, int end, FILE* tempFptr ) { //get last Page for output Page *lastPage = &pages[ end + 1 ]; lastPage->clearPage(); //keep track of pages int *offsets = new int[end - begin + 1]; memset( offsets, 0, ( end - begin + 1 ) * 4 ); while ( true ) { //when the pages have not been read int min = -1; //find the minimize of the first entry of pages bool first = true; for ( int i = begin ; i <= end; i++ ) { //printPage( pages[i].getData() ); if ( offsets[ i - begin ] < pages[i].getOffset() ) { //if this page is not been read at end if ( first ) { //init the min first = false; min = i; } else if( compare( pages[i].getData() + offsets[i-begin], pages[min].getData() + offsets[min-begin] ) < 0 ) { min = i; } } } //for loop end, min save the value of the pageIndex of min while ( !lastPage->insertDataToPage( pages[min].getData() + offsets[min-begin], 8 ) ) { //insert the min value to the output page //if insert fail //write page to file lastPage->writePageToFile( tempFptr ); lastPage->clearPage(); } offsets[ min - begin ] += 8; //next entry //exam if all pages has been read int i; for ( i = begin ; i <= end; i++ ) { if ( offsets[ i - begin ] < pages[i].getOffset() ) { //if a page is not at the end break; } } if ( i == end + 1 ) { //if all pages has been read, break the loop break; } } //write remain page lastPage->writePageToFile( tempFptr ); clearPages( begin, end + 1 ); }
void Document::init(const QString& filePath, const QString& mimeType) { m_filePath = filePath; emit filePathChanged(); m_mimeType = mimeType; emit mimeTypeChanged(); setState(Document::Loading); if (!m_pages.isEmpty()) { emit aboutToReset(); clearPages(); } clearDocument(); m_loader = new DocumentLoader; QObject::connect(m_loader, SIGNAL(done()), this, SLOT(loaderDone())); QObject::connect(m_loader, SIGNAL(error()), this, SLOT(loaderError())); QObject::connect(m_loader, SIGNAL(locked()), this, SLOT(loaderLocked())); m_loader->start(m_filePath, m_mimeType); }
CoreServer::Result CoreServer::discover() { #ifdef INTEL SystemInformation sysInfo; Size memPerCore = 0; if (m_acpi.initialize() == IntelACPI::Success && m_acpi.discover() == IntelACPI::Success) { NOTICE("using ACPI as CoreManager"); // TODO: hack. Must always call IntelMP::discover() for IntelMP::boot() m_mp.discover(); m_cores = &m_acpi; } else if (m_mp.discover() == IntelMP::Success) { NOTICE("using MPTable as CoreManager"); m_cores = &m_mp; } else { ERROR("no CoreManager found (ACPI or MPTable)"); return NotFound; } List<uint> & cores = m_cores->getCores(); if (cores.count() == 0) { ERROR("no cores found"); return NotFound; } memPerCore = sysInfo.memorySize / cores.count(); memPerCore /= MegaByte(4); memPerCore *= MegaByte(4); NOTICE("found " << cores.count() << " cores -- " << (memPerCore / 1024 / 1024) << "MB per core"); // Allocate CoreInfo for each core m_coreInfo = new Index<CoreInfo>(cores.count()); // Boot each core for (ListIterator<uint> i(cores); i.hasCurrent(); i++) { uint coreId = i.current(); if (coreId != 0) { CoreInfo *info = new CoreInfo; m_coreInfo->insert(coreId, *info); MemoryBlock::set(info, 0, sizeof(CoreInfo)); info->coreId = coreId; info->memory.phys = memPerCore * coreId; info->memory.size = memPerCore - PAGESIZE; info->kernel.phys = info->memory.phys; info->kernel.size = MegaByte(4); info->bootImageAddress = info->kernel.phys + info->kernel.size; info->bootImageSize = sysInfo.bootImageSize; info->coreChannelAddress = info->bootImageAddress + info->bootImageSize; info->coreChannelAddress += PAGESIZE - (info->bootImageSize % PAGESIZE); info->coreChannelSize = PAGESIZE * 4; clearPages(info->coreChannelAddress, info->coreChannelSize); m_kernel->entry(&info->kernelEntry); info->timerCounter = sysInfo.timerCounter; strlcpy(info->kernelCommand, kernelPath, KERNEL_PATHLEN); } } #endif return Success; }
bool AnnotationDocument::close() { clearPages(); path_.clear(); return true; }
void eDemoData::free() { clearPages(); clearSongs(); }
void KCPageManager::layoutPages() { const KCSheet* sheet = d->sheet; const KCPrintSettings settings = d->settings; d->pages.clear(); clearPages(); int pageNumber = 1; preparePage(pageNumber); if (settings.pageOrder() == KCPrintSettings::LeftToRight) { // kDebug() << "processing printRanges" << settings.printRegion(); // iterate over the print ranges KCRegion::ConstIterator end = settings.printRegion().constEnd(); for (KCRegion::ConstIterator it = settings.printRegion().constBegin(); it != end; ++it) { if (!(*it)->isValid()) continue; // limit the print range to the used area const QRect printRange = (*it)->rect() & sheet->usedArea(true); // kDebug() << "processing printRange" << printRange; int rows = 0; double height = 0.0; for (int row = printRange.top(); row <= printRange.bottom(); ++row) { rows++; height += sheet->rowFormat(row)->visibleHeight(); // 1. find the number of rows per page if (row == printRange.bottom()) // always iterate over the last 'page row' ; else if (height + sheet->rowFormat(row + 1)->visibleHeight() <= size(pageNumber).height()) continue; // kDebug() << "1. done: row" << row << "rows" << rows << "height" << height; int columns = 0; double width = 0.0; // 2. iterate over the columns and create the pages for (int col = printRange.left(); col < printRange.right(); ++col) { columns++; width += sheet->columnFormat(col)->visibleWidth(); // Does the next column fit too? if (width + sheet->columnFormat(col + 1)->visibleWidth() <= size(pageNumber).width()) continue; // kDebug() << "col" << col << "columns" << columns << "width" << width; const QRect cellRange(col - columns + 1, row - rows + 1, columns, rows); if (pageNeedsPrinting(cellRange)) { d->pages.append(cellRange); insertPage(pageNumber++); preparePage(pageNumber); // prepare the next page } columns = 0; width = 0.0; } // Always insert a page for the last column columns++; const QRect cellRange(printRange.right() - columns + 1, row - rows + 1, columns, rows); if (pageNeedsPrinting(cellRange)) { d->pages.append(cellRange); insertPage(pageNumber); pageNumber++; } // 3. prepare for the next row of pages if (row != printRange.bottom()) { preparePage(pageNumber); } rows = 0; height = 0.0; } } } else { // if (settings.pageOrder() == KCPrintSettings::TopToBottom) // kDebug() << "processing printRanges" << settings.printRegion(); // iterate over the print ranges KCRegion::ConstIterator end = settings.printRegion().constEnd(); for (KCRegion::ConstIterator it = settings.printRegion().constBegin(); it != end; ++it) { if (!(*it)->isValid()) continue; // limit the print range to the used area const QRect printRange = (*it)->rect() & sheet->usedArea(); kDebug() << "processing printRange" << printRange; int columns = 0; double width = 0.0; for (int col = printRange.left(); col <= printRange.right(); ++col) { columns++; width += sheet->columnFormat(col)->visibleWidth(); // 1. find the number of columns per page if (col == printRange.right()) // always iterate over the last 'page column' ; else if (width + sheet->columnFormat(col + 1)->visibleWidth() <= size(pageNumber).width()) continue; // kDebug() << "1. done: col" << col << "columns" << columns << "width" << width; int rows = 0; double height = 0.0; // 2. iterate over the rows and create the pages for (int row = printRange.top(); row < printRange.bottom(); ++row) { rows++; height += sheet->rowFormat(row)->visibleHeight(); // Does the next row fit too? if (height + sheet->rowFormat(row + 1)->visibleHeight() <= size(pageNumber).height()) continue; // kDebug() << "row" << row << "rows" << rows << "height" << height; const QRect cellRange(col - columns + 1, row - rows + 1, columns, rows); if (pageNeedsPrinting(cellRange)) { d->pages.append(cellRange); insertPage(pageNumber++); preparePage(pageNumber); // prepare the next page } rows = 0; height = 0.0; } // Always insert a page for the last row rows++; const QRect cellRange(col - columns + 1, printRange.bottom() - rows + 1, columns, rows); if (pageNeedsPrinting(cellRange)) { d->pages.append(cellRange); insertPage(pageNumber); pageNumber++; } // 3. prepare for the next column of pages if (col != printRange.right()) { preparePage(pageNumber); } columns = 0; width = 0.0; } } } kDebug() << d->pages.count() << "page(s) created"; }