int ExpiresCtrl::config(const XmlNode *pExpires, const ExpiresCtrl *pDefault, HttpContext *pContext) { const char *pValue; if (!pDefault) pDefault = this; pValue = pExpires->getChildValue("enableExpires"); char enabled = pDefault->isEnabled(); if (pValue) { enabled = pExpires->getLongValue("enableExpires" , 0, 1, enabled); if (pContext) pContext->setConfigBit(BIT_ENABLE_EXPIRES, 1); } enable(enabled); pValue = pExpires->getChildValue("expiresDefault"); if (pValue) { parse(pValue); if (pContext) pContext->setConfigBit(BIT_EXPIRES_DEFAULT, 1); } else { setBase(pDefault->getBase()); setAge(pDefault->getAge()); } return 0; }
bool RealFormat::setValue(int idx, const Variant& val) { bool result; int tmp; switch (idx) { case 0: result = setInt(tmp, val) && setMode((FmtMode)tmp); break; case 1: result = setInt(tmp, val) && setBase(tmp); break; case 2: result = setInt(tmp, val) && setSignificandBase(tmp); break; case 3: result = setInt(tmp, val) && setScaleBase(tmp); break; case 4: result = setInt(tmp, val) && setPrecision(tmp); break; // result = setChar(dot, val); break; default: result = false; } return result; }
/** * ReCalculates the remaining build-time of all queued buildings. */ void BaseView::reCalcQueuedBuildings() { setBase(_base); std::vector<BaseFacility*> facilities; for (std::vector<BaseFacility*>::iterator i = _base->getFacilities()->begin(); i != _base->getFacilities()->end(); ++i) if ((*i)->getBuildTime() > 0) { // Set all queued buildings to infinite. if ((*i)->getBuildTime() > (*i)->getRules()->getBuildTime()) (*i)->setBuildTime(std::numeric_limits<int>::max()); facilities.push_back(*i); } // Applying a simple Dijkstra Algorithm while (!facilities.empty()) { std::vector<BaseFacility*>::iterator min = facilities.begin(); for (std::vector<BaseFacility*>::iterator i = facilities.begin(); i != facilities.end(); ++i) if ((*i)->getBuildTime() < (*min)->getBuildTime()) min=i; BaseFacility* facility=(*min); facilities.erase(min); RuleBaseFacility *rule=facility->getRules(); int x=facility->getX(), y=facility->getY(); for (int i = 0; i < rule->getSize(); ++i) { if (x > 0) updateNeighborFacilityBuildTime(facility,_facilities[x - 1][y + i]); if (y > 0) updateNeighborFacilityBuildTime(facility,_facilities[x + i][y - 1]); if (x + rule->getSize() < BASE_SIZE) updateNeighborFacilityBuildTime(facility,_facilities[x + rule->getSize()][y + i]); if (y + rule->getSize() < BASE_SIZE) updateNeighborFacilityBuildTime(facility,_facilities[x + i][y + rule->getSize()]); } } }
boolean JListBox::action(JEvent& e, JObject* arg) { if (e.target == scroller) { setBase(e.key); return true; } return false; }
ScrollBar::ScrollBar(double minBase, double maxBase, Qt::Orientation o, QWidget *parent): QScrollBar(o, parent) { init(); setBase(minBase, maxBase); moveSlider(minBase, maxBase); }
// // ----- InsideBase ----- // InsideBase::InsideBase( QObject * parent, GenericBase * base ) : QGraphicsScene( parent ) { setSceneRect( 0,0, 960, 720 ); _background = 0; if( base ) setBase( base ); }
//Our array requires at least one element: log(0)==1 // You can instruct it to initialize more elements if you want. fast_log(T baseVal, size_t numInitialElements=1) { setBase(baseVal); T next = 1; while (lookup.size()<numInitialElements) { next = next*baseVal; lookup.append(next); } }
worldContainer::worldContainer(coord Location, coord Goal, double Charge, double Base, double HitPoints) { setLocation(Location); setGoal(Goal); setCharge(Charge); setBase(Base); setHitPoints(HitPoints); }
//-------------------------------------------------------------- void testApp::update() { kinect.update(); if(kinect.isOpened()){ depthImage.setFromPixels(kinect.getDepthPixels()); /*thresholdedImage = depthImage; thresholdedImage.threshold(threshold); contourFinderDepth.findContours(thresholdedImage, 20, (320*240)/3, 10, true); */ ////// You can skip copying to thresholdedImage if you don't need depth draw // depthImage.threshold(threshold); // contourFinderDepth.findContours(depthImage, 20, (320*240)/3, 10, true); /* added code for my rgb colour image */ rgbImage.setFromPixels(kinect.getDepthPixels()); if (bAutoSetBase) setBase(0.8); unsigned char * pix = depthImage.getPixels(); unsigned char * blpix = blImage.getPixels(); int numPixels = depthImage.getWidth() * depthImage.getHeight(); for(int i = 0; i < numPixels; i++) { int delta = abs(pix[i]-blpix[i])/layerDensity; if ( delta >= 3 ) pix[i] = delta; else pix[i] = 0; } cvCvtColor(depthImage.getCvImage(), rgbImage.getCvImage(), CV_GRAY2BGR); //Grayscale to RGB conversion similar to Photoshops RGB Mode to Grayscale Mode conversion //app. 30% Red, 59% Green, 11% Blue int w = rgbImage.width; int h = rgbImage.height; int bpp = 3; unsigned char * pixels = rgbImage.getPixels(); for (int i = 0; i < w; i++){ for (int j = 0; j < h; j++){ pixels[(j*w+i)*bpp+0] = pixels[(j*w+i)*bpp+0] * (0.3*255); pixels[(j*w+i)*bpp+1] = pixels[(j*w+i)*bpp+1] * (0.59*255); pixels[(j*w+i)*bpp+2] = pixels[(j*w+i)*bpp+2] * (0.11*255); } } /* color image with labels */ /*colorImage.setFromPixels(kinect.getLabelPixels()); for(int i = 0; i < ofxKinectNui::KINECT_PLAYERS_INDEX_NUM; i++){ labelImages[i].setFromPixels(kinect.getLabelPixelsCv(i)); if(i > 0){ contourFinders[i - 1].findContours(labelImages[i], 20, (320*240)/3, 10, true); } }*/ } }
ScrollBar::ScrollBar(double minBase, double maxBase, bool logscale, Qt::Orientation o, QWidget *parent): QScrollBar(o, parent), mLogScale(logscale) { init(); setBase(minBase, maxBase); moveSlider(minBase, maxBase); }
void ChordEdit::setHarmony(const Harmony* h) { _harmony = h->clone(); setRoot(h->rootTpc()); setBase(h->baseTpc()); setExtension(h->id()); for (int i = 0; i < h->numberOfDegrees(); ++i) addDegree(h->degree(i)); }
pxError pxOffscreen::term() { if (bitmap) { DeleteObject(bitmap); setBase(NULL); } return PX_OK; }
/** * create a new node n */ Node *newNode(NodeType type, char* text, Label * eloc, Region *r) { Node *node = (Node *)region_alloc(r, sizeof(Node)); if(node == NULL) return NULL; memset(node, 0, sizeof(Node)); setNodeType(node, type); if(text!=NULL) { node->text = (char *)region_alloc(r,(strlen(text) + 1) * sizeof(char)); strcpy(node->text, text); } else { node->text = NULL; } NODE_EXPR_POS(node) = eloc == NULL? 0 : eloc->exprloc; setIOType(node, IO_TYPE_INPUT); if(eloc!=NULL) { setBase(node, eloc->base, r); } else { setBase(node, "", r); } return node; }
/** * Initializes a craft of the specified type and * assigns it the latest craft ID available. * @param rules Pointer to ruleset. * @param base Pointer to base of origin. * @param id ID to assign to the craft (0 to not assign). */ Craft::Craft(RuleCraft *rules, Base *base, int id) : MovingTarget(), _rules(rules), _base(base), _id(0), _fuel(0), _damage(0), _interceptionOrder(0), _takeoff(0), _weapons(), _status("STR_READY"), _lowFuel(false), _mission(false), _inBattlescape(false), _inDogfight(false), _name(L"") { _items = new ItemContainer(); if (id != 0) { _id = id; } for (unsigned int i = 0; i < _rules->getWeapons(); ++i) { _weapons.push_back(0); } setBase(base); }
worldContainer::worldContainer() { coord temp; temp.x = 0; temp.y = 0; temp.z = 0; setLocation(temp); setGoal(temp); setHitPoints(0); setCharge(0); setBase(0); }
UnitTracker::UnitTracker( guint bases ) : _active(0), _isUpdating(false), _activeUnit(0), _store(0), _unitList(0), _actionList(0), _adjList(0), _priorValues() { _store = gtk_list_store_new( N_COLUMNS, G_TYPE_STRING, G_TYPE_POINTER ); setBase( bases ); }
AboutWarehouse::AboutWarehouse(Widget* parent, PlayerCityPtr city, const Tile& tile ) : AboutConstruction( parent, Rect( 0, 0, 510, 360 ), Rect( 16, 225, 510 - 16, 225 + 62 ) ) { setupUI( ":/gui/warehouseinfo.gui" ); _warehouse = ptr_cast<Warehouse>( tile.overlay() ); setBase( ptr_cast<Construction>( _warehouse ) ); _setWorkingVisible( true ); /*StringArray warnings; if( _warehouse->onlyDispatchGoods() ) { warnings << "##warehouse_low_personal_warning##"; } if( _warehouse->getGoodStore().freeQty() == 0 ) { warnings << "##warehouse_full_warning##"; } if( !warnings.empty() ) { Label* lb = new Label( this, Rect( 20, height() - 54, width() - 20, height() - 34 ), _(warnings.rand()) ); lb->setTextAlignment( alignCenter, alignCenter ); }*/ PushButton* btnOrders; GET_WIDGET_FROM_UI( btnOrders ); CONNECT( btnOrders, onClicked(), this, AboutWarehouse::showSpecialOrdersWindow ); std::string title = MetaDataHolder::findPrettyName( _warehouse->type() ); setTitle( _(title) ); // summary: total stock, free capacity int _paintY = _lbTitleRef() ? _lbTitleRef()->bottom() : 50; drawGood(good::wheat, 0, _paintY+0); drawGood(good::vegetable, 0, _paintY+25); drawGood(good::fruit, 0, _paintY+50); drawGood(good::olive, 0, _paintY+75); drawGood(good::grape, 0, _paintY+100); drawGood(good::fish, 0, _paintY+125); drawGood(good::meat, 1, _paintY+0); drawGood(good::wine, 1, _paintY+25); drawGood(good::oil, 1, _paintY+50); drawGood(good::iron, 1, _paintY+75); drawGood(good::timber, 1, _paintY+100); drawGood(good::clay, 2, _paintY+0); drawGood(good::marble, 2, _paintY+25); drawGood(good::weapon, 2, _paintY+50); drawGood(good::furniture, 2, _paintY+75); drawGood(good::pottery, 2, _paintY+100); _updateWorkersLabel( Point( 20, 10 ), 542, _warehouse->maximumWorkers(), _warehouse->numberWorkers() ); }
//------------------------------------------------------------------------------------- void ScriptDefModule::autoMatchCompOwn() { setClient(false); setBase(false); setCell(false); std::string fmodule = "scripts/client/" + name_ + ".py"; std::string fmodule_pyc = "scripts/client/"SCRIPT_BIN_CACHEDIR"/" + name_ + "."SCRIPT_BIN_TAG".pyc"; if(Resmgr::matchRes(fmodule) != fmodule || Resmgr::matchRes(fmodule_pyc) != fmodule_pyc) { setClient(true); } if(g_componentType == CLIENT_TYPE) { setBase(true); setCell(true); return; } fmodule = "scripts/base/" + name_ + ".py"; fmodule_pyc = "scripts/base/"SCRIPT_BIN_CACHEDIR"/" + name_ + "."SCRIPT_BIN_TAG".pyc"; if(Resmgr::matchRes(fmodule) != fmodule || Resmgr::matchRes(fmodule_pyc) != fmodule_pyc) { setBase(true); } fmodule = "scripts/cell/" + name_ + ".py"; fmodule_pyc = "scripts/cell/"SCRIPT_BIN_CACHEDIR"/" + name_ + "."SCRIPT_BIN_TAG".pyc"; if(Resmgr::matchRes(fmodule) != fmodule || Resmgr::matchRes(fmodule_pyc) != fmodule_pyc) { setCell(true); } }
Face::Face(const Transformation3D &inbase, const vector<Vector2D> &list_of_vertex ) { setBase(inbase); for(unsigned int i=0;i<list_of_vertex.size();i++){ vertex.push_back(Vector3D(list_of_vertex[i].x,list_of_vertex[i].y)); } absVertex=vertex; updateData(); baseUpdated(); r=defaultR; g=defaultG; b=defaultB; alfa=defaultAlfa; }
//------------------------------------------------------------------------------------- bool ScriptDefModule::addBaseMethodDescription(const char* attrName, MethodDescription* methodDescription) { MethodDescription* f_methodDescription = findBaseMethodDescription(attrName); if(f_methodDescription) { ERROR_MSG("ScriptDefModule::addBaseMethodDescription: [%s] is exist!\n", attrName); return false; } setBase(true); methodBaseDescr_[attrName] = methodDescription; methodBaseDescr_uidmap_[methodDescription->getUType()] = methodDescription; return true; }
Face::Face(const Transformation3D &inbase, double x_min,double y_min, double x_max, double y_max) { setBase(inbase); vertex.push_back(Vector3D(x_min,y_min)); vertex.push_back(Vector3D(x_max,y_min)); vertex.push_back(Vector3D(x_max,y_max)); vertex.push_back(Vector3D(x_min,y_max)); absVertex=vertex; updateData(); baseUpdated(); r=defaultR; g=defaultG; b=defaultB; alfa=defaultAlfa; }
void DesktopTracker::connect(GtkWidget *widget) { disconnect(); this->widget = widget; // Use C/gobject callbacks to avoid gtkmm rewrap-during-destruct issues: hierID = g_signal_connect( G_OBJECT(widget), "hierarchy-changed", G_CALLBACK(hierarchyChangeCB), this ); inkID = g_signal_connect( G_OBJECT(INKSCAPE), "activate_desktop", G_CALLBACK(activateDesktopCB), this ); GtkWidget *wdgt = gtk_widget_get_ancestor(widget, SP_TYPE_DESKTOP_WIDGET); if (wdgt && !base) { SPDesktopWidget *dtw = SP_DESKTOP_WIDGET(wdgt); if (dtw && dtw->desktop) { setBase(dtw->desktop); // may also set desktop } } }
int ScrollBar::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QScrollBar::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: sliderMoved((*reinterpret_cast< Qt::Orientation(*)>(_a[1])),(*reinterpret_cast< double(*)>(_a[2])),(*reinterpret_cast< double(*)>(_a[3]))); break; case 1: valueChanged((*reinterpret_cast< Qt::Orientation(*)>(_a[1])),(*reinterpret_cast< double(*)>(_a[2])),(*reinterpret_cast< double(*)>(_a[3]))); break; case 2: setBase((*reinterpret_cast< double(*)>(_a[1])),(*reinterpret_cast< double(*)>(_a[2]))); break; case 3: moveSlider((*reinterpret_cast< double(*)>(_a[1])),(*reinterpret_cast< double(*)>(_a[2]))); break; case 4: catchValueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; case 5: catchSliderMoved((*reinterpret_cast< int(*)>(_a[1]))); break; default: ; } _id -= 6; } return _id; }
void DesktopTracker::handleHierarchyChange() { GtkWidget *wdgt = gtk_widget_get_ancestor(widget, SP_TYPE_DESKTOP_WIDGET); bool newFlag = (wdgt == 0); // true means not in an SPDesktopWidget, thus floating. if (wdgt && !base) { SPDesktopWidget *dtw = SP_DESKTOP_WIDGET(wdgt); if (dtw && dtw->desktop) { setBase(dtw->desktop); // may also set desktop } } if (newFlag != trackActive) { trackActive = newFlag; if (trackActive) { setDesktop(SP_ACTIVE_DESKTOP); } else if (desktop != base) { setDesktop(getBase()); } } }
pxError pxOffscreen::init(int32_t width, int32_t height) { term(); pxError e = PX_FAIL; data = (char*) new unsigned char[width * height * 4]; if (data) { setBase(data); setWidth(width); setHeight(height); setStride(width*4); setUpsideDown(false); e = PX_OK; } return e; }
RoboMiner::RoboMiner(int cy, int cx, Frame *fr) : cell_y(cy), cell_x(cx), frame(fr), destCell(nullptr), lastMinedOre(nullptr), drillCell(nullptr), energy(2000), max_cargo(1000), exploring(false), ascending(false), drillCount(0), ascendCount(0) { Cell *startCell = &(frame->getGround()->getCell(cy, cx)); setCell(startCell); startCell->setDrilled(true); startCell->hasMiner(this); // setDestination(160, 128); setBase(frame->getSurface()->getBase()); }
//------------------------------------------------------------------------------------- bool ScriptDefModule::addBaseMethodDescription(const char* attrName, MethodDescription* methodDescription) { MethodDescription* f_methodDescription = findBaseMethodDescription(attrName); if(f_methodDescription) { ERROR_MSG(boost::format("ScriptDefModule::addBaseMethodDescription: [%1%] is exist!\n") % attrName); return false; } setBase(true); methodBaseDescr_[attrName] = methodDescription; methodBaseDescr_uidmap_[methodDescription->getUType()] = methodDescription; if(methodDescription->isExposed()) methodBaseExposedDescr_[attrName] = methodDescription; return true; }
void MM_TLHAllocationSupport::setupTLH(MM_EnvironmentBase *env, void *addrBase, void *addrTop, MM_MemorySubSpace *memorySubSpace, MM_MemoryPool *memoryPool) { MM_GCExtensionsBase *extensions = env->getExtensions(); if (extensions->doFrequentObjectAllocationSampling){ updateFrequentObjectsStats(env); } /* Set the new TLH values */ setBase(addrBase); setAlloc(addrBase); setTop(addrTop); if (NULL != memorySubSpace) { setObjectFlags(memorySubSpace->getObjectFlags()); } setMemoryPool(memoryPool); setMemorySubSpace(memorySubSpace); #if defined(OMR_GC_TLH_PREFETCH_FTA) *_pointerToTlhPrefetchFTA = 0; #endif /* OMR_GC_TLH_PREFETCH_FTA */ }
AboutGranary::AboutGranary(Widget* parent, PlayerCityPtr city, const Tile& tile ) : AboutConstruction( parent, Rect( 0, 0, 510, 280 ), Rect( 16, 130, 510 - 16, 130 + 62) ) { setupUI( ":/gui/granaryinfo.gui" ); _granary = ptr_cast<Granary>( tile.overlay() ); setBase( ptr_cast<Construction>( _granary ) ); _setWorkingVisible( true ); PushButton* btnOrders; Label* lbUnits; GET_WIDGET_FROM_UI( btnOrders ) GET_WIDGET_FROM_UI( lbUnits ) CONNECT( btnOrders, onClicked(), this, AboutGranary::showSpecialOrdersWindow ); std::string title = MetaDataHolder::findPrettyName( _granary->type() ); setTitle( _(title) ); if( lbUnits ) { // summary: total stock, free capacity std::string desc = utils::format( 0xff, "%d %s, %s %d", _granary->store().qty(), _("##units_in_stock##"), _("##freespace_for##"), _granary->store().freeQty() ); lbUnits->setPosition( _lbTitleRef()->leftbottom() + Point( 0, 5 ) ); lbUnits->setText( desc ); drawGood(good::wheat, 0, lbUnits->bottom() ); drawGood(good::meat, 0, lbUnits->bottom() + 25); drawGood(good::fruit, 1, lbUnits->bottom() ); drawGood(good::vegetable, 1, lbUnits->bottom() + 25); } _updateWorkersLabel( Point( 32, lbUnits->bottom() + 60 ), 542, _granary->maximumWorkers(), _granary->numberWorkers() ); }
/** * The player can change the selected base * or change info on other screens. */ void BasescapeState::init() { State::init(); setBase(_base); _view->setBase(_base); _mini->draw(); _edtBase->setText(_base->getName()); // Get area for (std::vector<Region*>::iterator i = _game->getSavedGame()->getRegions()->begin(); i != _game->getSavedGame()->getRegions()->end(); ++i) { if ((*i)->getRules()->insideRegion(_base->getLongitude(), _base->getLatitude())) { _txtLocation->setText(tr((*i)->getRules()->getType())); break; } } _txtFunds->setText(tr("STR_FUNDS").arg(Text::formatFunding(_game->getSavedGame()->getFunds()))); _btnNewBase->setVisible(_game->getSavedGame()->getBases()->size() < MiniBaseView::MAX_BASES); }