LOCAL_C void doMakeAndStoreL(CStreamStore& aStore,TStreamId& anId) { // Construct an object of type CClassA and put some // data into it _LIT(KTxtForClassA,"Text for CClassA"); CClassA* theA = CClassA::NewLC(); theA->SetTextL(KTxtForClassA); theA->iIntValue = -1; theA->iUintValue = 2; // Construct an object of type CClassB and put some // data into it _LIT(KTxtForClassB,"Text for CClassB"); CClassB* theB = CClassB::NewLC(); theB->iFixBuffer = KTxtForClassB; theB->iIntValue = -3; theB->iUintValue = 4; theB->iRealValue = 5.6; // Show contents of the CClassA object _LIT(KTxtClassAContent,"CClassA content ..."); doShow(KTxtClassAContent,*theA); // Show contents of the CClassB object _LIT(KTxtClassBContent,"CClassB content ..."); doShow(KTxtClassBContent,*theB); // Construct the output stream. // The stream id (there is only one) is kept // in memory. RStoreWriteStream outstream; anId = outstream.CreateLC(aStore); // Stream out the CClassA object first outstream << *theA; // Stream out the CClassB object second outstream << *theB; // Equally we could have done: // outstream << *theA << *theB; // to the same effect // Commit changes to the stream outstream.CommitL(); // Cleanup the stream object. // Destroy the CClassB object, // Destroy the CClassA object, CleanupStack::PopAndDestroy(3); }
LOCAL_C void doInternalizeL(const TDesC& aName) { TParse filestorename; fsSession.Parse(aName,filestorename); // construct file store object - specifying the file // containing the store. CFileStore* store = CDirectFileStore::OpenLC(fsSession,filestorename.FullName(),EFileRead); // Construct a CCompound object // from the root stream created earlier. CCompound* thecompound = CCompound::NewL(*store,store->Root()); // Show contents of the CCompound object (and its // components) _LIT(KTxtRestoredContent,"... Restored CCompound content."); doShow(KTxtRestoredContent,*thecompound); // destroy the store object (this also closes the file // containing the store) CleanupStack::PopAndDestroy(); // Now destroy the CCompound object delete thecompound; }
void doAdmin(int sock, ControlStruct *p) { char *cp, *cp1, tmpBuf[20]; int x; if (dbg) syslog(LOG_DEBUG, "doAdmin():Enter |%s|", p->buf); if (p->passwdMode != 0) { doPrivilege(p, "", sock); } else { for (cp = p->buf; *cp != '\0' && isspace(*cp); cp++); memset(tmpBuf, '\0', sizeof(tmpBuf)); for (x = 0, cp1 = tmpBuf; *cp != '\0' && !isspace(*cp) && (unsigned)x < sizeof(tmpBuf); x++) { *(cp1++) = tolower(*cp++); *cp1 = '\0'; } if (dbg) syslog(LOG_DEBUG, "doAdmin():Command = |%s|", tmpBuf); for (; *cp != '\0' && isspace(*cp); cp++); if (dbg) syslog(LOG_DEBUG, "doAdmin():Remainder Command = |%s|", cp); if (strcmp(tmpBuf, "enable") == 0) doEnable(p, cp); else if (strcmp(tmpBuf, "disable") == 0) doDisable(p, cp); else if (strcmp(tmpBuf, "disconnect") == 0) doDisconnect(p, cp); // else if (strcmp(tmpBuf, "privilege") == 0) // doPrivilege(p, cp, sock); else if (strcmp(tmpBuf, "set") == 0) doSet(p, cp); else if (strcmp(tmpBuf, "help") == 0) doHelp(p, cp); else if (strcmp(tmpBuf, "show") == 0) doShow(p, cp); else if (strcmp(tmpBuf, "verbose") == 0) p->verbose = (p->verbose == 0) ? 1 : 0; else { if (p->verbose) fputs("Error, Command Not recognized\n", p->fp); else fputs("904:Command Not recognized\n", p->fp); } } fflush(p->fp); }
LOCAL_C void doRestoreL(CStreamStore& aStore,const TStreamId& anId) { // Construct "empty" CClassA and CClassB objects CClassA* theA = CClassA::NewLC(); CClassB* theB = CClassB::NewLC(); // Construct and open the input stream. // We want to access the one and only // stream from the in-memory store. RStoreReadStream instream; instream.OpenLC(aStore,anId); // Stream in the CClassA object first and // then stream in the CClassB object. This is the order // in which the objects were streamed out. // // NB the order in which the objects are streamed OUT to // a single stream is arbitrary BUT, whatever the order // chosen, the objects must be streamed in, in the SAME order // // In this example, streaming in has assignment semantics. instream >> *theA; instream >> *theB; // Equally we could have done: // outstream >> *theA >> *theB; // to the same effect // Cleanup the stream object CleanupStack::PopAndDestroy(); // Show restored contents of the CClassA object _LIT(KTxtRestoredClassA,"Restored CClassA content ..."); doShow(KTxtRestoredClassA,*theA); // Show restored contents of the CClassB object _LIT(KTxtRestoredClassB,"Restored CClassB content ..."); doShow(KTxtRestoredClassB,*theB); // Destroy the CClassB object, // Destroy the CClassA object, CleanupStack::PopAndDestroy(2); }
void HippoBubble::setScreenSaverRunning(bool screenSaverRunning) { screenSaverRunning_ = screenSaverRunning; if (shown_) { if (!screenSaverRunning_) doShow(); else doClose(); } }
void HippoBubble::setShown(void) { // If we show the bubble when the screensaver is running, it will pop up // over the screensaver, so we simply remember that the bubble is logically // shown and actually show it when the screensaver deactivates. Our assumption // here is that the screensaver only activates when the user is idle, so we // don't have to worry about explicitely stopping paging in the bubble; // paging doesn't happen when the user is idle anyways. shown_ = TRUE; if (!screenSaverRunning_) doShow(); }
void Tooltip::show() { if (_visible || _empty) return; redoLines(); uint32 delay = ConfigMan.getInt("tooltipdelay", 100); if (delay == 0) doShow(0); else TimerMan.addTimer(delay, _timer, boost::bind(&Tooltip::doShow, this, _1)); _visible = true; }
void Tooltip::show(uint32 delay, uint32 timeOut) { if (_visible || _empty) return; redoLines(); _visible = true; if (delay == 0) doShow(0); if (delay != 0) TimerMan.addTimer(delay , _timerShow, boost::bind(&Tooltip::doShow, this, _1)); if (timeOut != 0) TimerMan.addTimer(delay + timeOut, _timerHide, boost::bind(&Tooltip::doHide, this, _1)); }
LOCAL_C void doMakeAndExternalizeL(const TDesC& aName) { TParse filestorename; fsSession.Parse(aName,filestorename); // construct file store object - the file to contain the // the store replaces any existing file of the same name. CFileStore* store = CDirectFileStore::ReplaceLC(fsSession,filestorename.FullName(),EFileWrite); // Must say what kind of file store store->SetTypeL(KDirectFileStoreLayoutUid); // Construct an object of type CCompound // and put some data into it. CCompound* thecompound = CCompound::NewLC(); _LIT(KTxtClassAText,"CClassA text"); _LIT(KTxtClassBText,"CClassB text"); thecompound->iCa->iBufferA = KTxtClassAText; thecompound->iCa->iXA = -1; thecompound->iCa->iYA = 2; thecompound->iCb->iBufferB = KTxtClassBText; thecompound->iTc.iZC = 3.456; // Show contents of the CCompound object (and its // components) _LIT(KTxtInitialContent,"... Initial content of CCompound"); doShow(KTxtInitialContent,*thecompound); // Store the compound object to a single stream // and save the stream id as the root id. TStreamId id = thecompound->StoreL(*store); // Set the stream id as the root store->SetRootL(id); // Commit changes to the store store->CommitL(); // Destroy: // 1. the CCompound object // 2. the store object (this also closes // the file containing the store) // Remove both from the cleanup stack CleanupStack::PopAndDestroy(2); }
uint32 Tooltip::doShow(uint32 oldInterval) { Common::StackLock lock(_mutex); doShow(); return 0; }
void Tooltip::updatePosition() { if (_empty) return; Common::StackLock lock(_mutex); float pX, pY, pZ; if (!getParentPosition(pX, pY, pZ)) { _offscreen = true; doHide(); return; } else { _offscreen = false; doShow(); } // Set bubble position const bool hasBubble = _showBubble && _bubble; const float bubbleWidth = hasBubble ? (_bubble->getWidth () - 30.0) : _width; const float bubbleHeight = hasBubble ? (_bubble->getHeight() - 8.0) : _height; const float bubbleWantX = pX + _x - (bubbleWidth / 2.0); const float bubbleRight = bubbleWantX + bubbleWidth + 15.0f; const float maxX = _detectEdge ? GfxMan.getScreenWidth() / 2.0 : 0.0; const float overX = _detectEdge ? MAX(0.0f, bubbleRight - maxX) : 0.0; const float bubbleX = bubbleWantX - overX; const float bubbleY = pY + _y; const float bubbleZ = pZ + _z; if (hasBubble) _bubble->setPosition(floorf(bubbleX), floorf(bubbleY), floorf(bubbleZ)); // Set portrait position const bool hasPortrait = _showPortrait && _portrait; const float portraitWidth = hasPortrait ? _portrait->getWidth () : 0.0; const float portraitHeight = hasPortrait ? _portrait->getHeight() : 0.0; const float portraitBorderY = (bubbleHeight - portraitHeight) / 2.0; const float portraitX = bubbleX + 5.0; const float portraitY = bubbleY - bubbleHeight + portraitBorderY + 1.0; const float portraitZ = bubbleZ - 1.0; if (hasPortrait) _portrait->setPosition(floorf(portraitX), floorf(portraitY), floorf(portraitZ)); // Set text position const float portraitSpacerWidth = portraitWidth + (_portrait ? 10.0 : 0.0); const float bubbleTextWidth = bubbleWidth - portraitSpacerWidth; const float textHeight = _lines.size() * _lineHeight + (_lines.size() - 1) * _lineSpacing; const float textBorderY = (bubbleHeight - textHeight) / 2.0; const float textBottomX = bubbleX + portraitSpacerWidth; const float textBottomY = bubbleY - textBorderY + 1.0; const float textBottomZ = bubbleZ - 1.0; float textY = textBottomY; for (std::vector<Line>::reverse_iterator l = _lines.rbegin(); l != _lines.rend(); ++l) { if (l->text) { const float textWidth = l->text->getWidth(); const float textBorderX = (bubbleTextWidth - textWidth) * _align; const float textX = textBottomX + textBorderX; const float lineY = textY - l->text->getHeight(); l->text->setPosition(floorf(textX), floorf(lineY), floorf(textBottomZ)); } textY -= (_lineHeight + _lineSpacing); } }
void Output::show(uint32_t nameId, uint32_t arity, bool s) { showMap_[std::make_pair(nameId, arity)] = s; doShow(nameId, arity, s); }
void Output::show(bool s) { show_ = s; doShow(s); }
KstPulse::KstPulse(QObject *parent, const char *name, const QStringList& l) : KstExtension(parent, name, l), KXMLGUIClient() { new KAction(i18n("Pulse Generator"), 0, 0, this, SLOT(doShow()), actionCollection(), "pulse_show"); setInstance(app()->instance()); setXMLFile("kstextension_pulse.rc", true); app()->guiFactory()->addClient(this); }