Exemplo n.º 1
0
static void
attribute_save(Attribute *attribute, ObjectNode obj_node,
	       const char *filename)
{
  element_save(&attribute->element, obj_node);

  data_add_real(new_attribute(obj_node, "border_width"),
		attribute->border_width);
  data_add_color(new_attribute(obj_node, "border_color"),
		 &attribute->border_color);
  data_add_color(new_attribute(obj_node, "inner_color"),
		 &attribute->inner_color);
  data_add_string(new_attribute(obj_node, "name"),
		  attribute->name);
  data_add_boolean(new_attribute(obj_node, "key"),
		   attribute->key);
  data_add_boolean(new_attribute(obj_node, "weak_key"),
		   attribute->weakkey);
  data_add_boolean(new_attribute(obj_node, "derived"),
		   attribute->derived);
  data_add_boolean(new_attribute(obj_node, "multivalued"),
		   attribute->multivalue);
  data_add_font (new_attribute (obj_node, "font"),
		 attribute->font);
  data_add_real(new_attribute(obj_node, "font_height"),
		attribute->font_height);
}
Exemplo n.º 2
0
static void
attribute_save(Attribute *attribute, ObjectNode obj_node,
	       DiaContext *ctx)
{
  element_save(&attribute->element, obj_node, ctx);

  data_add_real(new_attribute(obj_node, "border_width"),
		attribute->border_width, ctx);
  data_add_color(new_attribute(obj_node, "border_color"),
		 &attribute->border_color, ctx);
  data_add_color(new_attribute(obj_node, "inner_color"),
		 &attribute->inner_color, ctx);
  data_add_string(new_attribute(obj_node, "name"),
		  attribute->name, ctx);
  data_add_boolean(new_attribute(obj_node, "key"),
		   attribute->key, ctx);
  data_add_boolean(new_attribute(obj_node, "weak_key"),
		   attribute->weakkey, ctx);
  data_add_boolean(new_attribute(obj_node, "derived"),
		   attribute->derived, ctx);
  data_add_boolean(new_attribute(obj_node, "multivalued"),
		   attribute->multivalue, ctx);
  data_add_font (new_attribute (obj_node, "font"),
		 attribute->font, ctx);
  data_add_real(new_attribute(obj_node, "font_height"),
		attribute->font_height, ctx);
}
Exemplo n.º 3
0
Arquivo: aadlbox.c Projeto: UIKit0/dia
void
aadlbox_save(Aadlbox *aadlbox, ObjectNode obj_node, DiaContext *ctx)
{
  int i;
  AttributeNode attr;
  DataNode composite;
    
  element_save(&aadlbox->element, obj_node, ctx);
  object_save_props(&aadlbox->element.object, obj_node, ctx);

  attr = new_attribute(obj_node, "aadlbox_ports");
  
  for (i=0;i<aadlbox->num_ports;i++) {
    composite = data_add_composite(attr, "aadlport", ctx);
    data_add_point(composite_add_attribute(composite, "point"), 
		   &aadlbox->ports[i]->handle->pos, ctx);
    data_add_enum(composite_add_attribute(composite, "port_type"), 
		   aadlbox->ports[i]->type, ctx);
    data_add_string(composite_add_attribute(composite, "port_declaration"), 
		    aadlbox->ports[i]->declaration, ctx);
  }
  
  attr = new_attribute(obj_node, "aadlbox_connections");
  
  for (i=0;i<aadlbox->num_connections;i++) {
    data_add_point(attr, &aadlbox->connections[i]->pos, ctx);
  }
}
Exemplo n.º 4
0
Arquivo: flow.c Projeto: brunetton/dia
static void
flow_save(Flow *flow, ObjectNode obj_node, const char *filename)
{
  connection_save(&flow->connection, obj_node);

  data_add_text(new_attribute(obj_node, "text"),
		flow->text) ;
  data_add_int(new_attribute(obj_node, "type"),
	       flow->type);
}
Exemplo n.º 5
0
Arquivo: flow.c Projeto: heshanjse/dia
static void
flow_save(Flow *flow, ObjectNode obj_node, DiaContext *ctx)
{
  connection_save(&flow->connection, obj_node, ctx);

  data_add_text(new_attribute(obj_node, "text"),
		flow->text, ctx) ;
  data_add_int(new_attribute(obj_node, "type"),
	       flow->type, ctx);
}
Exemplo n.º 6
0
static void
constraint_save(Constraint *constraint, ObjectNode obj_node,
		const char *filename)
{
  connection_save(&constraint->connection, obj_node);

  data_add_string(new_attribute(obj_node, "text"),
		  constraint->text);
  data_add_point(new_attribute(obj_node, "text_pos"),
		 &constraint->text_pos);
}
Exemplo n.º 7
0
static void
generalization_save(Generalization *genlz, ObjectNode obj_node,
		    const char *filename)
{
  orthconn_save(&genlz->orth, obj_node);

  data_add_string(new_attribute(obj_node, "name"),
		  genlz->name);
  data_add_string(new_attribute(obj_node, "stereotype"),
		  genlz->stereotype);
}
Exemplo n.º 8
0
static void
state_save(State *state, ObjectNode obj_node, const char *filename)
{
  element_save(&state->element, obj_node);

  data_add_text(new_attribute(obj_node, "text"),
		state->text);

  data_add_int(new_attribute(obj_node, "type"),
	       state->state_type);

}
Exemplo n.º 9
0
static void
message_save(Message *message, ObjectNode obj_node, const char *filename)
{
  connection_save(&message->connection, obj_node);

  data_add_string(new_attribute(obj_node, "text"),
		  message->text);
  data_add_point(new_attribute(obj_node, "text_pos"),
		 &message->text_pos);
  data_add_int(new_attribute(obj_node, "type"),
		   message->type);
}
Exemplo n.º 10
0
void render_object_save(RenderObject *rend_obj, ObjectNode obj_node)
{
  element_save(&rend_obj->element, obj_node);

  data_add_real(new_attribute(obj_node, "magnify"),
		rend_obj->magnify);
  
  if (rend_obj->desc->use_text) {
    data_add_text(new_attribute(obj_node, "text"),
		  rend_obj->text);
  }
}
Exemplo n.º 11
0
static void
implements_save(Implements *implements, ObjectNode obj_node,
		const char *filename)
{
  connection_save(&implements->connection, obj_node);

  data_add_real(new_attribute(obj_node, "diameter"),
		implements->circle_diameter);
  data_add_string(new_attribute(obj_node, "text"),
		  implements->text);
  data_add_point(new_attribute(obj_node, "text_pos"),
		 &implements->text_pos);
}
Exemplo n.º 12
0
static void
wanlink_save(WanLink *wanlink, ObjectNode obj_node,
	     const char *filename)
{
    AttributeNode attr;
  
    connection_save((Connection *)wanlink, obj_node);
    
    attr = new_attribute(obj_node, "width");
    data_add_real(attr, wanlink->width);
    
    data_add_color( new_attribute(obj_node, "line_color"), &wanlink->line_color);
    data_add_color( new_attribute(obj_node, "fill_color"), &wanlink->fill_color);
}
Exemplo n.º 13
0
static void
function_save(Function *pkg, ObjectNode obj_node, const char *filename)
{
  element_save(&pkg->element, obj_node);

  data_add_text(new_attribute(obj_node, "text"),
		pkg->text);

  data_add_boolean(new_attribute(obj_node, "is_wish"),
		   pkg->is_wish);
  
  data_add_boolean(new_attribute(obj_node, "is_user"),
		   pkg->is_user);
}
Exemplo n.º 14
0
static void
textobj_save(Textobj *textobj, ObjectNode obj_node, const char *filename)
{
  object_save(&textobj->object, obj_node);

  data_add_text(new_attribute(obj_node, "text"),
		textobj->text);
  data_add_enum(new_attribute(obj_node, "valign"),
		  textobj->vert_align);

  if (textobj->show_background) {
    data_add_color(new_attribute(obj_node, "fill_color"), &textobj->fill_color);
    data_add_boolean(new_attribute(obj_node, "show_background"), textobj->show_background);
  }
}
Exemplo n.º 15
0
bool StateEvaluationTreePanel::setHoverNode(decltype(Nodes)::iterator const It)
{
  if (It == HoverNodeIt)
    return false;
  
  if (HoverTimer.IsRunning())
    HoverTimer.Stop();
  
  auto const PreviousHadValue = HoverNodeIt != Nodes.end()
                                && HoverNodeIt->Value.get() != nullptr;
  HoverNodeIt = It;
  
  if (Recording) {
    auto const NodeIndex = std::distance(Nodes.cbegin(), HoverNodeIt);
    auto const NodeStmt = It != Nodes.end() ? It->Statement   : nullptr;
    auto const Value    = It != Nodes.end() ? It->Value.get() : nullptr;

    std::vector<std::unique_ptr<IAttributeReadOnly>> Attrs;
    Attrs.emplace_back(new_attribute("node", NodeIndex));
    Attrs.emplace_back(new_attribute("stmt", NodeStmt));

    if (Value)
      addAttributesForValue(Attrs, *Value);

    Recording->recordEventV("StateEvaluationTree.NodeMouseOver", Attrs);
  }
  
  if (HoverNodeIt != Nodes.end())
    HoverTimer.Start(1000, wxTIMER_ONE_SHOT);
  
  if (Notifier) {
    auto const TheStmt = HoverNodeIt != Nodes.end() ? HoverNodeIt->Statement
                                                    : nullptr;
    Notifier->createNotify<ConEvHighlightStmt>(TheStmt);

    if (auto Access = CurrentAccess->getAccess()) {
      if (HoverNodeIt == Nodes.end()) {
        if (PreviousHadValue)
          Notifier->createNotify<ConEvHighlightValue>(nullptr, CurrentAccess);
      }
      else if (auto const TheValue = HoverNodeIt->Value.get()) {
        Notifier->createNotify<ConEvHighlightValue>(TheValue, CurrentAccess);
      }
    }
  }
  
  return true;
}
Exemplo n.º 16
0
static void
bus_save(Bus *bus, ObjectNode obj_node, const char *filename)
{
  int i;
  AttributeNode attr;

  connection_save(&bus->connection, obj_node);
  
  data_add_color( new_attribute(obj_node, "line_color"), &bus->line_color);

  attr = new_attribute(obj_node, "bus_handles");
  
  for (i=0;i<bus->num_handles;i++) {
    data_add_point(attr, &bus->handles[i]->pos);
  }
}
Exemplo n.º 17
0
static struct gatt_db_attribute *
service_insert_descriptor(struct gatt_db_service *service,
					uint16_t handle,
					const bt_uuid_t *uuid,
					uint32_t permissions,
					gatt_db_read_t read_func,
					gatt_db_write_t write_func,
					void *user_data)
{
	int i;

	i = get_attribute_index(service, 0);
	if (!i)
		return NULL;

	/* Check if handle is in within service range */
	if (handle && handle <= service->attributes[0]->handle)
		return NULL;

	if (!handle)
		handle = get_handle_at_index(service, i - 1) + 1;

	service->attributes[i] = new_attribute(service, handle, uuid, NULL, 0);
	if (!service->attributes[i])
		return NULL;

	set_attribute_data(service->attributes[i], read_func, write_func,
							permissions, user_data);

	return service->attributes[i];
}
struct btd_attribute *btd_gatt_add_char_desc(const bt_uuid_t *uuid,
						btd_attr_read_t read_cb,
						btd_attr_write_t write_cb)
{
	struct btd_attribute *attr;

	/*
	 * From Core SPEC 4.1 page 2184:
	 * "Characteristic descriptor declaration permissions are defined by a
	 * higher layer profile or are implementation specific. A client shall
	 * not assume all characteristic descriptor declarations are readable."
	 *
	 * The read/write callbacks presence will define the descriptor
	 * permissions managed directly by the core. The upper layer can define
	 * additional permissions constraints.
	 */

	attr = new_attribute(uuid, read_cb, write_cb);
	if (!attr)
		return NULL;

	if (local_database_add(next_handle, attr) < 0) {
		free(attr);
		return NULL;
	}

	next_handle = next_handle + 1;

	return attr;
}
Exemplo n.º 19
0
static struct gatt_db_service *gatt_db_service_create(const bt_uuid_t *uuid,
							uint16_t handle,
							bool primary,
							uint16_t num_handles)
{
	struct gatt_db_service *service;
	const bt_uuid_t *type;
	uint8_t value[16];
	uint16_t len;

	if (num_handles < 1)
		return NULL;

	service = new0(struct gatt_db_service, 1);
	service->attributes = new0(struct gatt_db_attribute *, num_handles);

	if (primary)
		type = &primary_service_uuid;
	else
		type = &secondary_service_uuid;

	len = uuid_to_le(uuid, value);

	service->attributes[0] = new_attribute(service, handle, type, value,
									len);
	if (!service->attributes[0]) {
		gatt_db_service_destroy(service);
		return NULL;
	}

	return service;
}
Exemplo n.º 20
0
Arquivo: bezier.c Projeto: GNOME/dia
static void
bezierline_save(Bezierline *bezierline, ObjectNode obj_node,
	        DiaContext *ctx)
{
  if (connpoint_is_autogap(bezierline->bez.object.handles[0]->connected_to) ||
      connpoint_is_autogap(bezierline->bez.object.handles[3*(bezierline->bez.bezier.num_points-1)]->connected_to) ||
      bezierline->absolute_start_gap || bezierline->absolute_end_gap) {
    Point gap_points[4];
    compute_gap_points(bezierline, gap_points);
    exchange_bez_gap_points(&bezierline->bez,gap_points);
    bezierconn_update_boundingbox(&bezierline->bez);
    exchange_bez_gap_points(&bezierline->bez,gap_points);
  }
  bezierconn_save(&bezierline->bez, obj_node, ctx);

  if (!color_equals(&bezierline->line_color, &color_black))
    data_add_color(new_attribute(obj_node, "line_color"),
		   &bezierline->line_color, ctx);

  if (bezierline->line_width != 0.1)
    data_add_real(new_attribute(obj_node, PROP_STDNAME_LINE_WIDTH),
		  bezierline->line_width, ctx);

  if (bezierline->line_style != LINESTYLE_SOLID)
    data_add_enum(new_attribute(obj_node, "line_style"),
		  bezierline->line_style, ctx);

  if (bezierline->line_style != LINESTYLE_SOLID &&
      bezierline->dashlength != DEFAULT_LINESTYLE_DASHLEN)
    data_add_real(new_attribute(obj_node, "dashlength"),
		  bezierline->dashlength, ctx);

  if (bezierline->line_join != LINEJOIN_MITER)
    data_add_enum(new_attribute(obj_node, "line_join"),
                  bezierline->line_join, ctx);
  if (bezierline->line_caps != LINECAPS_BUTT)
    data_add_enum(new_attribute(obj_node, "line_caps"),
                  bezierline->line_caps, ctx);

  if (bezierline->start_arrow.type != ARROW_NONE) {
    save_arrow(obj_node, &bezierline->start_arrow, "start_arrow",
	     "start_arrow_length", "start_arrow_width", ctx);
  }

  if (bezierline->end_arrow.type != ARROW_NONE) {
    save_arrow(obj_node, &bezierline->end_arrow, "end_arrow",
	     "end_arrow_length", "end_arrow_width", ctx);
  }

  if (bezierline->absolute_start_gap)
    data_add_real(new_attribute(obj_node, "absolute_start_gap"),
                 bezierline->absolute_start_gap, ctx);
  if (bezierline->absolute_end_gap)
    data_add_real(new_attribute(obj_node, "absolute_end_gap"),
                 bezierline->absolute_end_gap, ctx);
}
Exemplo n.º 21
0
static void
polyline_save(Polyline *polyline, ObjectNode obj_node,
	      DiaContext *ctx)
{
  polyconn_save(&polyline->poly, obj_node, ctx);

  if (!color_equals(&polyline->line_color, &color_black))
    data_add_color(new_attribute(obj_node, "line_color"),
		   &polyline->line_color, ctx);

  if (polyline->line_width != 0.1)
    data_add_real(new_attribute(obj_node, PROP_STDNAME_LINE_WIDTH),
		  polyline->line_width, ctx);
  
  if (polyline->line_style != LINESTYLE_SOLID)
    data_add_enum(new_attribute(obj_node, "line_style"),
		  polyline->line_style, ctx);

  if (polyline->line_style != LINESTYLE_SOLID &&
      polyline->dashlength != DEFAULT_LINESTYLE_DASHLEN)
    data_add_real(new_attribute(obj_node, "dashlength"),
		  polyline->dashlength, ctx);

  if (polyline->line_join != LINEJOIN_MITER)
    data_add_enum(new_attribute(obj_node, "line_join"),
                  polyline->line_join, ctx);
  if (polyline->line_caps != LINECAPS_BUTT)
    data_add_enum(new_attribute(obj_node, "line_caps"),
                  polyline->line_caps, ctx);

  if (polyline->start_arrow.type != ARROW_NONE) {
    save_arrow(obj_node, &polyline->start_arrow, "start_arrow",
	     "start_arrow_length", "start_arrow_width", ctx);
  }

  if (polyline->end_arrow.type != ARROW_NONE) {
    save_arrow(obj_node, &polyline->end_arrow, "end_arrow",
	     "end_arrow_length", "end_arrow_width", ctx);
  }

  if (polyline->absolute_start_gap)
    data_add_real(new_attribute(obj_node, "absolute_start_gap"),
                 polyline->absolute_start_gap, ctx);
  if (polyline->absolute_end_gap)
    data_add_real(new_attribute(obj_node, "absolute_end_gap"),
                 polyline->absolute_end_gap, ctx);

  if (polyline->corner_radius > 0.0)
    data_add_real(new_attribute(obj_node, "corner_radius"),
                  polyline->corner_radius, ctx);
}
Exemplo n.º 22
0
static void
ellipse_save(Ellipse *ellipse, ObjectNode obj_node, const char *filename)
{
    element_save(&ellipse->element, obj_node);

    if (ellipse->border_width != 0.1)
        data_add_real(new_attribute(obj_node, "border_width"),
                      ellipse->border_width);

    if (!color_equals(&ellipse->border_color, &color_black))
        data_add_color(new_attribute(obj_node, "border_color"),
                       &ellipse->border_color);

    if (!color_equals(&ellipse->inner_color, &color_white))
        data_add_color(new_attribute(obj_node, "inner_color"),
                       &ellipse->inner_color);

    if (!ellipse->show_background)
        data_add_boolean(new_attribute(obj_node, "show_background"),
                         ellipse->show_background);

    if (ellipse->aspect != FREE_ASPECT)
        data_add_enum(new_attribute(obj_node, "aspect"),
                      ellipse->aspect);

    if (ellipse->line_style != LINESTYLE_SOLID) {
        data_add_enum(new_attribute(obj_node, "line_style"),
                      ellipse->line_style);

        if (ellipse->dashlength != DEFAULT_LINESTYLE_DASHLEN)
            data_add_real(new_attribute(obj_node, "dashlength"),
                          ellipse->dashlength);
    }
}
Exemplo n.º 23
0
static void
beziergon_save(Beziergon *beziergon, ObjectNode obj_node,
	      const char *filename)
{
  beziershape_save(&beziergon->bezier, obj_node);

  if (!color_equals(&beziergon->line_color, &color_black))
    data_add_color(new_attribute(obj_node, "line_color"),
		   &beziergon->line_color);
  
  if (beziergon->line_width != 0.1)
    data_add_real(new_attribute(obj_node, PROP_STDNAME_LINE_WIDTH),
		  beziergon->line_width);
  
  if (!color_equals(&beziergon->inner_color, &color_white))
    data_add_color(new_attribute(obj_node, "inner_color"),
		   &beziergon->inner_color);
  
  data_add_boolean(new_attribute(obj_node, "show_background"),
		   beziergon->show_background);

  if (beziergon->line_style != LINESTYLE_SOLID)
    data_add_enum(new_attribute(obj_node, "line_style"),
		  beziergon->line_style);

  if (beziergon->line_style != LINESTYLE_SOLID &&
      beziergon->dashlength != DEFAULT_LINESTYLE_DASHLEN)
    data_add_real(new_attribute(obj_node, "dashlength"),
		  beziergon->dashlength);
  
  if (beziergon->line_join != LINEJOIN_MITER)
    data_add_enum(new_attribute(obj_node, "line_join"),
                  beziergon->line_join);

}
Exemplo n.º 24
0
static void
participation_save(Participation *participation, ObjectNode obj_node,
		   DiaContext *ctx)
{
  orthconn_save(&participation->orth, obj_node, ctx);

  data_add_boolean(new_attribute(obj_node, "total"),
		   participation->total, ctx);
}
Exemplo n.º 25
0
//retourne l'identifiant correspondant de la table
att get_ident (symtab s, char * c) {
    int i;
    for(i=0; i<s->current_id; i++)
    {
        if(strcmp(s->table[i]->name, c) == 0)
            return s->table[i];
    }
    return new_attribute(); // n'arrive jamais normalement
}
Exemplo n.º 26
0
static void
participation_save(Participation *participation, ObjectNode obj_node,
		   const char *filename)
{
  orthconn_save(&participation->orth, obj_node);

  data_add_boolean(new_attribute(obj_node, "total"),
		   participation->total);
}
Exemplo n.º 27
0
static void
smallpackage_save(SmallPackage *pkg, ObjectNode obj_node,
		  const char *filename)
{
  element_save(&pkg->element, obj_node);

  data_add_text(new_attribute(obj_node, "text"),
		pkg->text);
}
Exemplo n.º 28
0
void
prop_list_save(GPtrArray *props, DataNode data, DiaContext *ctx)
{
  guint i;
  for (i = 0; i < props->len; i++) {
    Property *prop = g_ptr_array_index(props,i);
    AttributeNode attr = new_attribute(data,prop->descr->name);
    prop->ops->save(prop,attr,ctx);
  }
}
Exemplo n.º 29
0
BoundedAttribute BoundedAttribute::operator+(int arg) {
  int new_value = 0;
  if (value_ + arg > bound_)
    new_value = bound_;
  else
    new_value = value_ + arg;

  BoundedAttribute new_attribute(new_value);
  return new_attribute;
}
Exemplo n.º 30
0
struct gatt_db_attribute *
gatt_db_service_add_included(struct gatt_db_attribute *attrib,
					struct gatt_db_attribute *include)
{
	struct gatt_db_service *service, *included;
	uint8_t value[MAX_INCLUDED_VALUE_LEN];
	uint16_t included_handle, len = 0;
	int index;

	if (!attrib || !include)
		return NULL;

	service = attrib->service;
	included = include->service;

	/* Adjust include to point to the first attribute */
	if (include != included->attributes[0])
		include = included->attributes[0];

	included_handle = include->handle;

	put_le16(included_handle, &value[len]);
	len += sizeof(uint16_t);

	put_le16(included_handle + included->num_handles - 1, &value[len]);
	len += sizeof(uint16_t);

	/* The Service UUID shall only be present when the UUID is a 16-bit
	 * Bluetooth UUID. Vol 2. Part G. 3.2
	 */
	if (include->value_len == sizeof(uint16_t)) {
		memcpy(&value[len], include->value, include->value_len);
		len += include->value_len;
	}

	index = get_attribute_index(service, 0);
	if (!index)
		return NULL;

	service->attributes[index] = new_attribute(service, 0,
							&included_service_uuid,
							value, len);
	if (!service->attributes[index])
		return NULL;

	/* The Attribute Permissions shall be read only and not require
	 * authentication or authorization. Vol 2. Part G. 3.2
	 *
	 * TODO handle permissions
	 */
	set_attribute_data(service->attributes[index], NULL, NULL, 0, NULL);

	return attribute_update(service, index);
}