Exemplo n.º 1
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.º 2
0
void
uml_formalparameter_write(AttributeNode attr_node, UMLFormalParameter *param)
{
  DataNode composite;

  composite = data_add_composite(attr_node, "umlformalparameter");

  data_add_string(composite_add_attribute(composite, "name"),
		  param->name);
  data_add_string(composite_add_attribute(composite, "type"),
		  param->type);
}
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
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.º 5
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.º 6
0
static void 
charprop_save(CharProperty *prop, AttributeNode attr) 
{
  gchar utf[7];
  gint n = g_unichar_to_utf8 (prop->char_data, utf);
  utf[n] = 0;
  data_add_string (attr, utf);
}
Exemplo n.º 7
0
static void
image_save(Image *image, ObjectNode obj_node, const char *filename)
{
  char *diafile_dir;
  
  element_save(&image->element, obj_node);

  if (image->border_width != 0.1)
    data_add_real(new_attribute(obj_node, "border_width"),
		  image->border_width);
  
  if (!color_equals(&image->border_color, &color_black))
    data_add_color(new_attribute(obj_node, "border_color"),
		   &image->border_color);
  
  if (image->line_style != LINESTYLE_SOLID)
    data_add_enum(new_attribute(obj_node, "line_style"),
		  image->line_style);
  
  data_add_boolean(new_attribute(obj_node, "draw_border"), image->draw_border);
  data_add_boolean(new_attribute(obj_node, "keep_aspect"), image->keep_aspect);

  if (image->file != NULL) {
    if (g_path_is_absolute(image->file)) { /* Absolute pathname */
      diafile_dir = get_directory(filename);

      if (strncmp(diafile_dir, image->file, strlen(diafile_dir))==0) {
	/* The image pathname has the dia file pathname in the begining */
	/* Save the relative path: */
	data_add_string(new_attribute(obj_node, "file"), image->file + strlen(diafile_dir));
      } else {
	/* Save the absolute path: */
	data_add_string(new_attribute(obj_node, "file"), image->file);
      }
      
      g_free(diafile_dir);
      
    } else {
      /* Relative path. Must be an erronous filename...
	 Just save the filename. */
      data_add_string(new_attribute(obj_node, "file"), image->file);
    }
    
  }
}
Exemplo n.º 8
0
/** Add filename data to an attribute node.
 * @param attr The attribute node.
 * @param filename The value to set.  This should be n the local filesystem
 *  encoding, not utf-8.
 */
void
data_add_filename(DataNode data, const char *str)
{
  char *utf8 = g_filename_to_utf8(str, -1, NULL, NULL, NULL);

  data_add_string(data, utf8);

  g_free(utf8);
}
Exemplo n.º 9
0
void
uml_attribute_write(AttributeNode attr_node, UMLAttribute *attr)
{
  DataNode composite;

  composite = data_add_composite(attr_node, "umlattribute");

  data_add_string(composite_add_attribute(composite, "name"),
		  attr->name);
  data_add_string(composite_add_attribute(composite, "type"),
		  attr->type);
  data_add_string(composite_add_attribute(composite, "value"),
		  attr->value);
  data_add_enum(composite_add_attribute(composite, "visibility"),
		attr->visibility);
  data_add_boolean(composite_add_attribute(composite, "abstract"),
		  attr->abstract);
  data_add_boolean(composite_add_attribute(composite, "class_scope"),
		  attr->class_scope);
}
Exemplo n.º 10
0
static void
_keyvalue_save (gpointer key,
                gpointer value,
                gpointer user_data)
{
  gchar *name = (gchar *)key;
  gchar *val = (gchar *)value;
  ObjectNode node = (ObjectNode)user_data;

  data_add_string(new_attribute(node, name), val);
}
Exemplo n.º 11
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.º 12
0
void
uml_operation_write(AttributeNode attr_node, UMLOperation *op)
{
  GList *list;
  UMLParameter *param;
  DataNode composite;
  DataNode composite2;
  AttributeNode attr_node2;

  composite = data_add_composite(attr_node, "umloperation");

  data_add_string(composite_add_attribute(composite, "name"),
		  op->name);
  data_add_string(composite_add_attribute(composite, "type"),
		  op->type);
  data_add_enum(composite_add_attribute(composite, "visibility"),
		op->visibility);
  data_add_boolean(composite_add_attribute(composite, "abstract"),
		   op->abstract);
  data_add_boolean(composite_add_attribute(composite, "class_scope"),
		   op->class_scope);
  
  attr_node2 = composite_add_attribute(composite, "parameters");
  
  list = op->parameters;
  while (list != NULL) {
    param = (UMLParameter *) list->data;

    composite2 = data_add_composite(attr_node2, "umlparameter");

    data_add_string(composite_add_attribute(composite2, "name"),
		    param->name);
    data_add_string(composite_add_attribute(composite2, "type"),
		    param->type);
    data_add_string(composite_add_attribute(composite2, "value"),
		    param->value);
    data_add_enum(composite_add_attribute(composite2, "kind"),
		  param->kind);
    list = g_list_next(list);
  }
}
Exemplo n.º 13
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.º 14
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.º 15
0
void
data_add_text(AttributeNode attr, Text *text)
{
  DataNode composite;
  char *str;

  composite = data_add_composite(attr, "text");

  str = text_get_string_copy(text);
  data_add_string(composite_add_attribute(composite, "string"),
		  str);
  g_free(str);
  data_add_font(composite_add_attribute(composite, "font"),
		text->font);
  data_add_real(composite_add_attribute(composite, "height"),
		text->height);
  data_add_point(composite_add_attribute(composite, "pos"),
		    &text->position);
  data_add_color(composite_add_attribute(composite, "color"),
		 &text->color);
  data_add_enum(composite_add_attribute(composite, "alignment"),
		text->alignment);
}
Exemplo n.º 16
0
void save_boolequation(ObjectNode obj_node, const gchar *attrname,
                       Boolequation *booleq)
{
    data_add_string(new_attribute(obj_node,attrname),(gchar *)booleq->value);
}
Exemplo n.º 17
0
static void 
stringprop_save(StringProperty *prop, AttributeNode attr) 
{
  data_add_string(attr, prop->string_data);
}