Beispiel #1
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);
    }
}
Beispiel #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);
}
Beispiel #3
0
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);
  }
}
Beispiel #4
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);
}
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);
}
Beispiel #6
0
static void
image_save(EImage *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);

  if (image->line_style != LINESTYLE_SOLID &&
      image->dashlength != DEFAULT_LINESTYLE_DASHLEN)
    data_add_real(new_attribute(obj_node, "dashlength"),
		  image->dashlength);
  
  data_add_boolean(new_attribute(obj_node, "draw_border"), image->draw_border);
  data_add_boolean(new_attribute(obj_node, "keep_aspect"), image->keep_aspect);
  data_add_boolean(new_attribute(obj_node, "keep_orig_aspect"), image->keep_orig_aspect);

  data_add_string(new_attribute(obj_node, "embed_id"),
		dtree_conv_longname_to_xml(image->embed_id));

  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_filename(new_attribute(obj_node, "file"), image->file + strlen(diafile_dir) + 1);
      } else {
	/* Save the absolute path: */
	data_add_filename(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_filename(new_attribute(obj_node, "file"), image->file);
    }
    
  }
}
Beispiel #7
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);

}
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);
  }
}
Beispiel #9
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);
}
Beispiel #10
0
static void
box_save(Box *box, ObjectNode obj_node, const char *filename)
{
  element_save(&box->element, obj_node);

  if (box->border_width != 0.1)
    data_add_real(new_attribute(obj_node, "border_width"),
		  box->border_width);
  
  if (!color_equals(&box->border_color, &color_black))
    data_add_color(new_attribute(obj_node, "border_color"),
		   &box->border_color);
  
  if (!color_equals(&box->inner_color, &color_white))
    data_add_color(new_attribute(obj_node, "inner_color"),
		   &box->inner_color);
  
  data_add_boolean(new_attribute(obj_node, "show_background"), box->show_background);

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

  if (box->line_join != LINEJOIN_MITER)
    data_add_enum(new_attribute(obj_node, "line_join"),
		  box->line_join);

  if (box->corner_radius > 0.0)
    data_add_real(new_attribute(obj_node, "corner_radius"),
		  box->corner_radius);

  if (box->aspect != FREE_ASPECT)
    data_add_enum(new_attribute(obj_node, "aspect"),
		  box->aspect);
}
Beispiel #11
0
static void
box_save(Box *box, ObjectNode obj_node, const char *filename)
{
  element_save(&box->element, obj_node);

  if (box->border_width != 0.1)
    data_add_real(new_attribute(obj_node, "border_width"),
		  box->border_width);
  
  if (!color_equals(&box->border_color, &color_black))
    data_add_color(new_attribute(obj_node, "border_color"),
		   &box->border_color);
   
  if (!color_equals(&box->inner_color, &color_white))
    data_add_color(new_attribute(obj_node, "inner_color"),
		   &box->inner_color);
  
  data_add_boolean(new_attribute(obj_node, "show_background"), 
                   box->show_background);

  if (box->line_style != LINESTYLE_SOLID)
    data_add_enum(new_attribute(obj_node, "line_style"),
		  box->line_style);
  
  if (box->line_style != LINESTYLE_SOLID &&
      box->dashlength != DEFAULT_LINESTYLE_DASHLEN)
    data_add_real(new_attribute(obj_node, "dashlength"),
                  box->dashlength);
  if (box->corner_radius > 0.0)
    data_add_real(new_attribute(obj_node, "corner_radius"),
		  box->corner_radius);

  data_add_real(new_attribute(obj_node, "padding"), box->padding);
  
  data_add_text(new_attribute(obj_node, "text"), box->text);

  if (box->text_fitting != TEXTFIT_WHEN_NEEDED)
    data_add_enum(new_attribute(obj_node, PROP_STDNAME_TEXT_FITTING),
		  box->text_fitting);
}
Beispiel #12
0
static void
ellipse_save(Ellipse *ellipse, ObjectNode obj_node, DiaContext *ctx)
{
  element_save(&ellipse->element, obj_node, ctx);

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

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

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

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

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

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

  data_add_real(new_attribute(obj_node, "padding"), ellipse->padding, ctx);

  data_add_text(new_attribute(obj_node, "text"), ellipse->text, ctx);

  if (ellipse->text_fitting != TEXTFIT_WHEN_NEEDED)
    data_add_enum(new_attribute(obj_node, PROP_STDNAME_TEXT_FITTING),
		  ellipse->text_fitting, ctx);
}
Beispiel #13
0
static void
newgroup_save(NewGroup *group, ObjectNode obj_node, const char *filename)
{
  element_save(&group->element, obj_node);
}
Beispiel #14
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);

  if (image->line_style != LINESTYLE_SOLID &&
      image->dashlength != DEFAULT_LINESTYLE_DASHLEN)
    data_add_real(new_attribute(obj_node, "dashlength"),
		  image->dashlength);
  
  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_filename(new_attribute(obj_node, "file"), image->file + strlen(diafile_dir) + 1);
      } else {
	/* Save the absolute path: */
	data_add_filename(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_filename(new_attribute(obj_node, "file"), image->file);
    }
    
  }
  /* only save image_data inline if told to do so */
  if (image->inline_data) {
    GdkPixbuf *pixbuf;
    data_add_boolean (new_attribute(obj_node, "inline_data"), image->inline_data);

    /* just to be sure to get the currently visible */
    pixbuf = (GdkPixbuf *)dia_image_pixbuf (image->image);
    if (pixbuf != image->pixbuf && image->pixbuf != NULL)
      message_warning (_("Inconsistent pixbuf during image save."));
    if (pixbuf)
      data_add_pixbuf (new_attribute(obj_node, "pixbuf"), pixbuf);
  }
}