virtual void execute (CCtrlBase *pCaller, const std::string &/* Params */) { CInterfaceManager *im = CInterfaceManager::getInstance(); CGroupContainer *gc = NULL; CCtrlBase *cb = pCaller; while (cb) { gc = dynamic_cast<CGroupContainer *>(cb); if (gc) break; cb = cb->getParent(); } if (!gc) return; AlphaChooserTarget = gc; if (!_AlphaObserversAdded) { _UiVariableBGAlpha = im->getDbProp("UI:VARIABLES:ALPHA_BG"); _UiVariableContentAlpha = im->getDbProp("UI:VARIABLES:ALPHA_CONTENT"); _UiVariableRolloverAlphaBG = im->getDbProp("UI:VARIABLES:ALPHA_ROLLOVER_BG"); _UiVariableRolloverAlphaContent = im->getDbProp("UI:VARIABLES:ALPHA_ROLLOVER_CONTENT"); ICDBNode::CTextId textIdBGAlpha, textIdContentAlpha, textIdRolloverAlphaBG, textIdRolloverAlphaContent; _UiVariableBGAlpha->addObserver(&_BgAlphaObs, textIdBGAlpha); _UiVariableContentAlpha->addObserver(&_ContentAlphaObs, textIdContentAlpha); _UiVariableRolloverAlphaBG->addObserver(&_RolloverAlphaBGObs, textIdRolloverAlphaBG); _UiVariableRolloverAlphaContent->addObserver(&_RolloverAlphaContentObs, textIdRolloverAlphaContent); _AlphaObserversAdded = true; } // disable observers _ContentAlphaObs.On = false; _BgAlphaObs.On = false; _RolloverAlphaBGObs.On = false; _RolloverAlphaContentObs.On = false; // set alpha of current chosen container _UiVariableBGAlpha->setValue32(gc->getContainerAlpha()); _UiVariableContentAlpha->setValue32(gc->getContentAlpha()); _UiVariableRolloverAlphaBG->setValue32(255 - gc->getRolloverAlphaContainer()); _UiVariableRolloverAlphaContent->setValue32(255 - gc->getRolloverAlphaContent()); // enable observers _ContentAlphaObs.On = true; _BgAlphaObs.On = true; _RolloverAlphaBGObs.On = true; _RolloverAlphaContentObs.On = true; // backup current alpha (if the user cancel) OldContentAlpha = gc->getContentAlpha(); OldBgAlpha = gc->getContainerAlpha(); OldRolloverAlphaBG = gc->getRolloverAlphaContainer(); OldRolloverAlphaContent = gc->getRolloverAlphaContent(); OldUseGlobalAlpha = gc->isUsingGlobalAlpha(); // Enable 'use global alpha' button im->getDbProp("UI:VARIABLES:USER_ALPHA")->setValue64(gc->isUsingGlobalAlpha() ? 0 : 1); // show the modal box im->enableModalWindow(gc, "ui:interface:define_ui_transparency"); }
virtual void execute (CCtrlBase *pCaller, const std::string &/* Params */) { // CInterfaceManager *im = CInterfaceManager::getInstance(); CGroupContainer *gc = NULL; CCtrlBase *cb = pCaller; while (cb) { gc = dynamic_cast<CGroupContainer *>(cb); if (gc) break; cb = cb->getParent(); } if (!gc) return; //gc->setMovable(!gc->isMovable()); gc->setLocked(!gc->isLocked()); }
virtual void execute (CCtrlBase *pCaller, const string &Params) { CInterfaceManager *im = CInterfaceManager::getInstance(); // get the parent container CGroupContainer *gc = NULL; CCtrlBase *cb = pCaller; while (cb) { gc = dynamic_cast<CGroupContainer *>(cb); if (gc) break; cb = cb->getParent(); } // update GC_POPUP flag if (gc) { im->getDbProp("UI:VARIABLES:GC_POPUP")->setValue64((gc->isPopuped() || gc->getLayerSetup() == 0) ? 1 : 0); } else { im->getDbProp("UI:VARIABLES:GC_POPUP")->setValue64(0); } // update GC_HAS_HELP flag if(gc && !gc->getHelpPage().empty()) { im->getDbProp("UI:VARIABLES:GC_HAS_HELP")->setValue64(1); } else { im->getDbProp("UI:VARIABLES:GC_HAS_HELP")->setValue64(0); } // open the menu if (CDBCtrlSheet::getDraggedSheet() == NULL) { CInterfaceManager::getInstance()->enableModalWindow (pCaller, getParam(Params, "menu")); } }
virtual void execute (CCtrlBase *pCaller, const string &Params) { CInterfaceManager *pIM = CInterfaceManager::getInstance(); string dblink = getParam (Params, "dblink"); string property = getParam (Params, "target_property"); string propertyToEval = getParam (Params, "target"); string expr = getParam (Params, "value"); //nlinfo("set %s %s %s %s", dblink.c_str(), property.c_str(), propertyToEval.c_str(), expr.c_str()); CInterfaceExprValue value; if (CInterfaceExpr::eval(expr, value, NULL)) { if (!dblink.empty()) { // Do not allow Write on SERVER: or LOCAL: static const std::string dbServer= "SERVER:"; static const std::string dbLocal= "LOCAL:"; static const std::string dbLocalR2= "LOCAL:R2"; if( (0==dblink.compare(0, dbServer.size(), dbServer)) || (0==dblink.compare(0, dbLocal.size(), dbLocal)) ) { if (0!=dblink.compare(0, dbLocalR2.size(), dbLocalR2)) { //nlwarning("You are not allowed to write on 'SERVER:...' or 'LOCAL:...' database"); nlstop; return; } } string dblinkeval; CInterfaceExpr::unpackDBentry(dblink.c_str(), NULL, dblinkeval); if (!value.toInteger()) { nlwarning("<CAHSet:execute> expression doesn't evaluate to a numerical value"); } CInterfaceProperty ip; if (!value.toInteger()) { nlwarning("<CAHSet:execute> expression doesn't evaluate to a numerical value"); } if (ip.link (dblinkeval.c_str())) { ip.setSInt64(value.getInteger()); } } if (!propertyToEval.empty()) { CInterfaceExprValue res; if (!CInterfaceExpr::eval(propertyToEval, res, NULL)) return; res.toString(); property = res.getString(); } if (!property.empty()) { std::vector<CInterfaceLink::CTargetInfo> targets; // find first enclosing group CCtrlBase *currCtrl = pCaller; CInterfaceGroup *ig = NULL; while (currCtrl) { ig = dynamic_cast<CInterfaceGroup *>(currCtrl); if (ig != NULL) break; currCtrl = currCtrl->getParent(); } if (ig == NULL) { string elt = property.substr(0,property.rfind(':')); CInterfaceElement *pIE = pIM->getElementFromId(elt); ig = dynamic_cast<CInterfaceGroup*>(pIE); if (ig == NULL && pIE != NULL) ig = pIE->getParent(); } if (ig != NULL) { CInterfaceParser::splitLinkTargets(property, ig, targets); for(uint k = 0; k < targets.size(); ++k) { if (targets[k].Elem) targets[k].affect(value); } } } } else { nlwarning("<CAHSet::execute> Couldn't evaluate expression to affect, expr = %s", expr.c_str()); } }