void VisusAxisAlignedExtractor::translateRequest(float x, float y) { VisusDataRequest request; VisusBoundingBox bbox; VisusOpenGLState state; VisusTransformation3D acc; std::vector<float> trans; //fprintf(stderr,"VisusAxisAlignedExtractor::translate %f %f \n",x,y); accumulate3D(acc); getValue(request); getValue(bbox); getValue(state); trans = request.transformation().translation(acc,state,x,-y); trans[0] *= (bbox[3] - bbox[0]); trans[1] *= (bbox[4] - bbox[1]); trans[2] *= (bbox[5] - bbox[2]); request.transformation()[12] += trans[0]; request.transformation()[13] += trans[1]; request.transformation()[14] += trans[2]; setValue(request); // St any previous data extraction still running interrupt(); // Indicate that we need to redraw the scenegraph markAsDirty(); }
void EditTextWidget::handleMouseDown(int x, int y, int button, int clickCount) { if (!isEnabled()) return; // First remove caret if (_caretVisible) drawCaret(true); x += _editScrollOffset; int width = 0; uint i; uint last = 0; for (i = 0; i < _editString.size(); ++i) { const uint cur = _editString[i]; width += g_gui.getCharWidth(cur, _font) + g_gui.getKerningOffset(last, cur, _font); if (width >= x) break; last = cur; } if (setCaretPos(i)) markAsDirty(); #ifdef TIZEN // Display the virtual keypad to allow text entry. Samsung app-store testers expected // the keypad to be displayed when clicking the filter edit control in the laucher gui. g_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, true); #endif }
void StaticTextWidget::setAlign(Graphics::TextAlign align) { if (_align != align){ _align = align; markAsDirty(); } }
void StaticTextWidget::setLabel(const Common::String &label) { if (_label != label) { _label = label; markAsDirty(); } }
void CheckboxWidget::setState(bool state) { if (_state != state) { _state = state; //_flags ^= WIDGET_INV_BORDER; markAsDirty(); } sendCommand(_cmd, _state); }
Pdf& Pdf::setResourceFilename(const std::string& filename) { mResourceFilename = filename; mPageSizeCache = ci::Vec2i(0, 0); mHolder.setResourceFilename(filename, mPageSizeMode); mHolder.setScale(mScale); setSize(mHolder.getWidth(), mHolder.getHeight()); markAsDirty(PDF_FN_DIRTY); return *this; }
bool fp_AnnotationRun::_recalcWidth(void) { if(!displayAnnotations()) { if(getWidth() == 0) return false; clearScreen(); markAsDirty(); if(getLine()) { getLine()->setNeedsRedraw(); } if(getBlock()) { getBlock()->setNeedsRedraw(); } _setWidth(0); return true; } if(!m_bIsStart) { _setWidth(0); return false; } UT_sint32 iNewWidth = calcWidth(); m_iRealWidth = iNewWidth; if (iNewWidth != getWidth()) { clearScreen(); markAsDirty(); if(getLine()) { getLine()->setNeedsRedraw(); } if(getBlock()) { getBlock()->setNeedsRedraw(); } _setWidth(iNewWidth); return true; } return false; }
void sakhadb_pager_add_freelist(sakhadb_pager_t pager, sakhadb_page_t page) { SLOG_PAGING_INFO("sakhadb_pager_add_freelist: freeing page [%d]", page->no); Pgno* pNo = (Pgno *)page->data; struct Header* h = pager->dbHeader; *pNo = h->freelist; h->freelist = page->no; markAsDirty(pager->page1); }
void Screen::plotPoint(int x, int y, uint8 color) { byte *buf = _buffer + MENUDEEP * RENDERWIDE; x -= _scrollX; y -= _scrollY; if (x >= 0 && x < RENDERWIDE && y >= 0 && y < RENDERDEEP) { buf[y * RENDERWIDE + x] = color; markAsDirty(x, y + MENUDEEP, x, y + MENUDEEP); } }
void TemplatesEditorWidget::prepareEditor (int index) { disconnect (Ui_.Editor_->GetCurrentEditor ()->GetQObject (), SIGNAL (textChanged ()), this, SLOT (markAsDirty ())); SaveCurrentText (); EditorTypeActions_.value (index)->trigger (); loadTemplate (); }
void RadiobuttonWidget::setState(bool state, bool setGroup) { if (setGroup) { _group->setValue(_value); return; } if (_state != state) { _state = state; //_flags ^= WIDGET_INV_BORDER; markAsDirty(); } sendCommand(_cmd, _state); }
/** Sets image */ void cwImageTexture::setImage(cwImage image) { if(Image != image) { Image = image; if(Image.isValid()) { startLoadingImage(); } else { DeleteTexture = true; markAsDirty(); } emit imageChanged(); } }
/** * Acquire DB header. */ static int acquireHeader( struct Pager* pager ) { /* Page 1 must be loaded before this call */ struct InternalPage* page1 = pager->page1; assert(page1); struct Header *header = (struct Header *)page1->pData; if(pager->dbSize == 1 && pager->fileSize == 0) { // No page on disk. Create header. memset(page1->pData, 0, pager->pageSize); strncpy(header->id, SAKHADB_FILE_HEADER, sizeof(header->id)); header->pageSize = pager->pageSize; header->reserved1[0] = header->reserved1[1] = 0; header->dbVersion = SAKHADB_VERSION_NUMBER; header->freelist = 0; memset(header->reserved2, 0, sizeof(header->reserved2)); markAsDirty(page1); } else { // Compare values if(strncmp(header->id, SAKHADB_FILE_HEADER, sizeof(header->id)) != 0) { SLOG_PAGING_FATAL("acquireHeader: file header do not match"); return SAKHADB_NOTADB; } if(header->dbVersion > SAKHADB_VERSION_NUMBER) { SLOG_PAGING_ERROR("acquireHeader: creator version is higher than reader's."); return SAKHADB_CANTOPEN; } uint16_t pageSize = header->pageSize; if(pageSize != pager->pageSize) { SLOG_PAGING_WARN("acquireHeader: page size do not match."); pager->pageSize = pageSize; fetchPageContent(page1); } } pager->dbHeader = header; return SAKHADB_OK; }
void fp_EmbedRun::_clearScreen(bool /* bFullLineHeightRect */) { // UT_ASSERT(!isDirty()); UT_ASSERT(getGraphics()->queryProperties(GR_Graphics::DGP_SCREEN)); UT_sint32 xoff = 0, yoff = 0; // need to clear full height of line, in case we had a selection getLine()->getScreenOffsets(this, xoff, yoff); UT_sint32 iLineHeight = getLine()->getHeight(); UT_DEBUGMSG(("Clear screen embed top %d \n",yoff)); Fill(getGraphics(),xoff, yoff, getWidth(), iLineHeight); markAsDirty(); setCleared(); }
void SliderWidget::handleMouseMoved(int x, int y, int button) { if (isEnabled() && _isDragging) { int newValue = posToValue(x); if (newValue < _valueMin) newValue = _valueMin; else if (newValue > _valueMax) newValue = _valueMax; if (newValue != _value) { _value = newValue; markAsDirty(); sendCommand(_cmd, _value); // FIXME - hack to allow for "live update" in sound dialog } } }
int sakhadb_pager_request_free_page(sakhadb_pager_t pager, sakhadb_page_t* pPage) { struct Header* h = pager->dbHeader; if(h->freelist == 0) { return sakhadb_pager_request_page(pager, ++pager->dbSize, pPage); } int res = sakhadb_pager_request_page(pager, h->freelist, pPage); if(res == SAKHADB_OK) { h->freelist = *(Pgno*)((*pPage)->data); markAsDirty(pager->page1); } return res; }
void SliderWidget::handleMouseWheel(int x, int y, int direction) { if (isEnabled() && !_isDragging) { // Increment or decrement by one int newValue = _value - direction; if (newValue < _valueMin) newValue = _valueMin; else if (newValue > _valueMax) newValue = _valueMax; if (newValue != _value) { _value = newValue; markAsDirty(); sendCommand(_cmd, _value); // FIXME - hack to allow for "live update" in sound dialog } } }
void RssFeed::saveItemsToDisk() { qDebug() << Q_FUNC_INFO << m_url; if (!m_dirty) return; markAsDirty(false); QIniSettings qBTRSS("qBittorrent", "qBittorrent-rss"); QVariantList old_items; RssArticleHash::ConstIterator it = m_articles.begin(); RssArticleHash::ConstIterator itend = m_articles.end(); for ( ; it != itend; ++it) { old_items << it.value()->toHash(); } qDebug("Saving %d old items for feed %s", old_items.size(), qPrintable(displayName())); QHash<QString, QVariant> all_old_items = qBTRSS.value("old_items", QHash<QString, QVariant>()).toHash(); all_old_items[m_url] = old_items; qBTRSS.setValue("old_items", all_old_items); }
void TemplatesEditorWidget::loadTemplate () { const auto currentType = Ui_.Editor_->GetCurrentEditorType (); const auto msgType = static_cast<MsgType> (Ui_.MessageType_->currentIndex ()); Util::Visit (TemplatesMgr_->GetTemplate (currentType, msgType, nullptr).AsVariant (), [=] (const QString& tpl) { auto editor = Ui_.Editor_->GetCurrentEditor (); editor->SetContents (tpl, currentType); connect (editor->GetQObject (), SIGNAL (textChanged ()), this, SLOT (markAsDirty ())); }, [=] (const auto& err) { QMessageBox::critical (this, "LeechCraft", tr ("Unable to load template: %1.") .arg (err.what ())); }); }
void Circle::setLineWidth(const float lineWidth){ mLineWidth = lineWidth; markAsDirty(LINE_WIDTH_DIRTY); }
void sakhadb_pager_save_page(sakhadb_pager_t pager, sakhadb_page_t page) { markAsDirty((struct InternalPage*)page); }
void ButtonWidget::setUnpressedState() { clearFlags(WIDGET_PRESSED); markAsDirty(); }
void ButtonWidget::setPressedState() { setFlags(WIDGET_PRESSED); clearFlags(WIDGET_HILITED); markAsDirty(); }
void ButtonWidget::setHighLighted(bool enable) { (enable) ? setFlags(WIDGET_HILITED) : clearFlags(WIDGET_HILITED); markAsDirty(); }
Pdf& Pdf::setPageSizeMode(const PageSizeMode& m) { mPageSizeMode = m; mHolder.setPageSizeMode(m); markAsDirty(PDF_PAGEMODE_DIRTY); return *this; }
void Circle::setRadius(const float radius){ mRadius = radius; init(); markAsDirty(RADIUS_DIRTY); }
void fp_EmbedRun::_lookupProperties(const PP_AttrProp * pSpanAP, const PP_AttrProp * /*pBlockAP*/, const PP_AttrProp * /*pSectionAP*/, GR_Graphics * pG) { UT_return_if_fail(pSpanAP != NULL); UT_DEBUGMSG(("fp_EmbedRun _lookupProperties span %p \n",pSpanAP)); m_pSpanAP = pSpanAP; m_bNeedsSnapshot = true; pSpanAP->getAttribute("dataid", m_pszDataID); const gchar * pszEmbedType = NULL; pSpanAP->getProperty("embed-type", pszEmbedType); UT_ASSERT(pszEmbedType); UT_DEBUGMSG(("Embed Type %s \n",pszEmbedType)); bool bFontChanged = false; // Load this into EmbedView // LUCA: chunk of code moved up here from the bottom of the method // 'cause we need to retrieve the font-size const PP_AttrProp * pBlockAP = NULL; const PP_AttrProp * pSectionAP = NULL; FL_DocLayout * pLayout = getBlock()->getDocLayout(); if(pG == NULL && pLayout->isQuickPrint() ) { pG = getGraphics(); if((m_iEmbedUID >= 0) && getEmbedManager()) { getEmbedManager()->releaseEmbedView(m_iEmbedUID); m_iEmbedUID = -1; } m_iEmbedUID = -1; } getBlockAP(pBlockAP); const GR_Font * pFont = pLayout->findFont(pSpanAP,pBlockAP,pSectionAP,pG); if(pLayout->isQuickPrint() && pG->queryProperties(GR_Graphics::DGP_PAPER)) { if(m_iEmbedUID >= 0 ) { getEmbedManager()->releaseEmbedView(m_iEmbedUID); m_iEmbedUID = -1; } m_iEmbedUID = - 1; m_pEmbedManager = m_pDocLayout->getQuickPrintEmbedManager(pszEmbedType); } else { m_pEmbedManager = m_pDocLayout->getEmbedManager(pszEmbedType); } if (pFont != _getFont()) { _setFont(pFont); bFontChanged = true; } if(pG == NULL) pG = getGraphics(); m_iPointHeight = pG->getFontAscent(pFont) + pG->getFontDescent(pFont); const char* pszSize = PP_evalProperty("font-size",pSpanAP,pBlockAP,pSectionAP, getBlock()->getDocument(), true); // LUCA: It is fundamental to do this before the EmbedView object // gets destroyed to avoid resuscitating it UT_sint32 iWidth,iAscent,iDescent=0; if(m_iEmbedUID < 0) { PD_Document * pDoc = getBlock()->getDocument(); m_iEmbedUID = getEmbedManager()->makeEmbedView(pDoc,m_iIndexAP,m_pszDataID); UT_DEBUGMSG((" EmbedRun %p UID is %d \n",this,m_iEmbedUID)); getEmbedManager()->initializeEmbedView(m_iEmbedUID); getEmbedManager()->setRun (m_iEmbedUID, this); getEmbedManager()->loadEmbedData(m_iEmbedUID); } getEmbedManager()->setDefaultFontSize(m_iEmbedUID,atoi(pszSize)); if (bFontChanged) bFontChanged = getEmbedManager()->setFont(m_iEmbedUID,pFont); if(getEmbedManager()->isDefault()) { iWidth = _getLayoutPropFromObject("width"); iAscent = _getLayoutPropFromObject("ascent"); iDescent = _getLayoutPropFromObject("descent"); } else { const char * pszHeight = NULL; bool bFoundHeight = pSpanAP->getProperty("height", pszHeight) && !bFontChanged; const char * pszWidth = NULL; bool bFoundWidth = pSpanAP->getProperty("width", pszWidth) && !bFontChanged; const char * pszAscent = NULL; bool bFoundAscent = pSpanAP->getProperty("ascent", pszAscent); if(!bFoundWidth || pszWidth == NULL) { iWidth = getEmbedManager()->getWidth(m_iEmbedUID); } else { iWidth = UT_convertToLogicalUnits(pszWidth); if(iWidth <= 0) { iWidth = getEmbedManager()->getWidth(m_iEmbedUID); } } if(!bFoundHeight || pszHeight == NULL || !bFoundAscent || pszAscent == NULL) { iAscent = getEmbedManager()->getAscent(m_iEmbedUID); iDescent = getEmbedManager()->getDescent(m_iEmbedUID); } else { iAscent = UT_convertToLogicalUnits(pszAscent); if(iAscent <= 0) { iAscent = getEmbedManager()->getAscent(m_iEmbedUID); iDescent = getEmbedManager()->getDescent(m_iEmbedUID); } else { UT_sint32 iHeight = UT_convertToLogicalUnits(pszHeight); const char * pszDescent = NULL; bool bFoundDescent = pSpanAP->getProperty("descent", pszDescent); if (bFoundDescent && pszDescent != NULL && iHeight >= 0) { iDescent = UT_convertToLogicalUnits(pszDescent); if (iHeight != iAscent + iDescent) iAscent = iHeight * iAscent / (iAscent + iDescent); } iDescent = (iHeight >= iAscent)? iHeight - iAscent: 0; } } } UT_DEBUGMSG(("Width = %d Ascent = %d Descent = %d \n",iWidth,iAscent,iDescent)); fl_DocSectionLayout * pDSL = getBlock()->getDocSectionLayout(); fp_Page * p = NULL; if(pDSL->getFirstContainer()) { p = pDSL->getFirstContainer()->getPage(); } else { p = pDSL->getDocLayout()->getNthPage(0); } UT_sint32 maxW = p->getWidth() - UT_convertToLogicalUnits("0.1in"); UT_sint32 maxH = p->getHeight() - UT_convertToLogicalUnits("0.1in"); maxW -= pDSL->getLeftMargin() + pDSL->getRightMargin(); maxH -= pDSL->getTopMargin() + pDSL->getBottomMargin(); markAsDirty(); if(getLine()) { getLine()->setNeedsRedraw(); } if(iAscent < 0) { iAscent = 0; } if(iDescent < 0) { iDescent = 0; } _setAscent(iAscent); _setDescent(iDescent); _setWidth(iWidth); _setHeight(iAscent+iDescent); _updatePropValuesIfNeeded(); }
void Circle::setFilled(const bool filled){ mFilled = filled; init(); markAsDirty(FILLED_DIRTY); }