void DetectorModule::build() { check(); if (!decorated().builtok()) { decorated().store(propertyTree()); decorated().build(); } if (numSensors() > 0) { for (int i = 0; i < numSensors(); i++) { Sensor* s = GeometryFactory::make<Sensor>(); s->parent(this); s->myid(i+1); s->store(propertyTree()); if (sensorNode.count(i+1) > 0) s->store(sensorNode.at(i+1)); s->build(); sensors_.push_back(s); materialObject_.sensorChannels[i+1]=s->numChannels(); } } else { Sensor* s = GeometryFactory::make<Sensor>(); // fake sensor to avoid defensive programming when iterating over the sensors and the module is empty s->parent(this); s->myid(1); s->build(); sensors_.push_back(s); } materialObject_.store(propertyTree()); materialObject_.build(); }
/** Adds window-related hints with default values. */ WindowHints::WindowHints() { // set default values resizable(true); visible(true); decorated(true); }
bool handleUpstreamDamageZoneCreationEvent( const DamageZoneCreationEvent& e, const TeamMembership* actorTeamMembership, ActorStateMachine& stateMachine) { DamageZoneCreationEvent decorated(e.getDamageZoneBounds(), e.getDamageToInflict(), actorTeamMembership); // forward it upstream return stateMachine.distributeEvent(decorated); }
decorated_tuple::cow_ptr decorated_tuple::make(cow_ptr d, vector_type v) { auto ptr = dynamic_cast<const decorated_tuple*>(d.get()); if (ptr) { d = ptr->decorated(); auto& pmap = ptr->mapping(); for (size_t i = 0; i < v.size(); ++i) { v[i] = pmap[v[i]]; } } return make_counted<decorated_tuple>(std::move(d), std::move(v)); }
void vmessage(Severity severity, const char* fmt, va_list ap){ static char buf[255]; /* this isn't thread-safe anyway, might as well make it static */ std::unique_ptr<char, free_delete> content(vasprintf2(fmt, ap)); std::unique_ptr<char, free_delete> decorated(asprintf2("(%s) [%s] %s", severity_string(severity), timestring(buf, 255), content.get())); for ( iterator it = destinations.begin(); it != destinations.end(); ++it ){ if ( severity < it->second ) continue; Destination* dst = it->first; dst->write(content.get(), decorated.get()); } }
void BarrelModule::build() { try { DetectorModule::build(); //myModuleCap_->setCategory(MaterialProperties::b_mod); decorated().rotateY(M_PI/2); rAxis_ = normal(); tiltAngle_ = 0.; skewAngle_ = 0.; } catch (PathfulException& pe) { pe.pushPath(*this, myid()); throw; } cleanup(); builtok(true); }
/* TODO: maybe optimize this */ void WFrame::draw() { WDrawable &d = wm().buffer_pixmap.drawable(); WFrameStyle &style = wm().frame_style; WFrameStyleScheme &scheme = (marked() ? style.marked : style.normal); WFrameStyleSpecialized &substyle = (this == column()->selected_frame() ? (column() == column()->view()->selected_column() ? scheme.active_selected : scheme.inactive_selected) : scheme.inactive); if (decorated() || shaded()) { WRect rect(0, 0, bounds.width, bounds.height); fill_rect(d, substyle.background_color, rect); draw_border(d, substyle.highlight_color, style.highlight_pixels, substyle.shadow_color, style.shadow_pixels, rect); WRect rect2 = rect.inside_tl_br_border(style.highlight_pixels, style.shadow_pixels); draw_border(d, substyle.padding_color, style.padding_pixels, rect2); WRect rect3 = rect2.inside_border(style.padding_pixels + style.spacing); rect3.height = wm().bar_height(); // Draw the tag names utf8_string tags; { std::vector<utf8_string> tag_names; std::transform(client().view_frames().begin(), client().view_frames().end(), std::back_inserter(tag_names), boost::bind(&WView::name, boost::bind(&WClient::ViewFrameMap::value_type::first, _1))); std::sort(tag_names.begin(), tag_names.end()); BOOST_FOREACH(const utf8_string &str, tag_names) { tags += str; if (&str != &tag_names.back()) tags += ' '; } }
WRect WFrame::client_bounds() const { WRect r; if (decorated() || shaded()) { WFrameStyle &style = wm().frame_style; int tl_off = top_left_offset(wm()); int br_off = bottom_right_offset(wm()); r.x = tl_off; r.width = bounds.width - r.x - br_off; r.y = tl_off + wm().bar_height() + style.spacing; r.height = bounds.height - r.y - br_off; } else { r.x = 0; r.y = 0; r.width = bounds.width; r.height = bounds.height; } return r; }