dia r4094 - in trunk: . doc objects/custom
- From: hans svn gnome org
- To: svn-commits-list gnome org
- Subject: dia r4094 - in trunk: . doc objects/custom
- Date: Sun, 20 Jul 2008 18:18:52 +0000 (UTC)
Author: hans
Date: Sun Jul 20 18:18:51 2008
New Revision: 4094
URL: http://svn.gnome.org/viewvc/dia?rev=4094&view=rev
Log:
2008-07-20 Hans Breuer <hans breuer org>
* objects/custom/custom_object.c(custom_copy): use object_copy_props()
instead of memcpy to support extended attribues where copy by reference
is not enough, e.g. <ext_attribute name="Something" type="string">
Simplifies the code and fixes bug #543874
* doc/custom-shapes doc/shapes.dtd : some documentation for subshapes,
ext_attributes and some usefull atrributes on <textbox/>
Modified:
trunk/ChangeLog
trunk/doc/custom-shapes
trunk/doc/shape.dtd
trunk/objects/custom/custom_object.c
Modified: trunk/doc/custom-shapes
==============================================================================
--- trunk/doc/custom-shapes (original)
+++ trunk/doc/custom-shapes Sun Jul 20 18:18:51 2008
@@ -97,10 +97,17 @@
(Only one textbox per shape) Where the attributes give the bounds of
the text box in the same coordinate system as the SVG shape description.
+There are some optional attributes on <textbox/> namely
+ resize="no" : by default the textbox is resized with the text
+ align="center" : "center" is default, also "left" and "right" can be used
+
+
Shapes are given a default size on creation. If that default size does
not fit your needs you can overwrite it by (one or both):
<default-width>1cm</default-width>
<default-height>3cm</default-height>
+The default unit "cm" can be omitted.
+
The svg element describes the shape. The width and height attributes
are ignored, and only given to comply with the SVG specification. For
@@ -178,7 +185,7 @@
lower right corner is (x1+width,y1+height).
Their are two forms of links supported, an absolute filename of the form
"file:///home/user/image.png" or a relative one without the file:// prefix
- like in "image.png". The latter form is preferred cause it is installation
+ like in "image.png". The latter form is preferred because it is installation
independent. The filename is relative to the shape file placement. In the
above example PNG and shape need to be in the same directory.
@@ -224,8 +231,46 @@
style Text formatting options
The following style options are supported:
- font-size: font size in pt
-
+ font-size: font size in pt(?)
+
+Shapes in Shapes aka. Subshapes
+===============================
+Adding indepentently resizable symbols into your custom shapes is possible by
+creating subshapes. This is done by some extra attributes on the group element.
+
+<svg:g
+ dia:subshape="true"
+ dia:v_anchor="fixed.bottom"
+ dia:h_anchor="fixed.left"
+ dia:default_scale="1.0">
+
+ dia:v_anchor The vertical anchoring of the subshape. Supported values are:
+ "fixed.top"
+ "fixed.bottom"
+ "proportional"
+
+ dia:h_anchor The horizontal anchoring of the subshape. Supported values are:
+ "fixed.left"
+ "fixed.right"
+ "proportional"
+ dia:default_scale currently unused
+
+
+Extented Attributes
+===================
+To extend your custom shape with custom attributes you can put something like:
+
+ <ext_attributes>
+ <ext_attribute name="Integer" type="int" />
+ <ext_attribute name="String" type="string" />
+ <ext_attribute name="Float" type="real" />
+ </ext_attributes>
+
+between the <shape></shape> tags. The effect will be some custom properties
+in your object. They are editable by the properties dialog and will be loaded
+and saved with your diagram. To programatically access them use "custom:<name>"
+
+
The Sheet description
=====================
@@ -252,7 +297,8 @@
</object>
</contents>
</sheet>
-
+
+
How Dia helps to create and manage sheets and shapes.
=====================================================
@@ -270,6 +316,7 @@
you can create new sheets; and add, remove and parcially edit shapes;
and copy or move shapes from one sheet to other.
+
Design Notes
============
@@ -291,6 +338,3 @@
James Henstridge <james daa com au>
with some modifications written by
Dolores Alia de Saravia<loli unsa edu ar>
-
-
-
Modified: trunk/doc/shape.dtd
==============================================================================
--- trunk/doc/shape.dtd (original)
+++ trunk/doc/shape.dtd Sun Jul 20 18:18:51 2008
@@ -32,7 +32,15 @@
x1 CDATA #REQUIRED
y1 CDATA #REQUIRED
x2 CDATA #REQUIRED
- y2 CDATA #REQUIRED >
+ y2 CDATA #REQUIRED
+ align (left|center|right) #IMPLIED
+ resize (yes|no) #IMPLIED >
+
+<!ELEMENT ext_attributes (ext_attribute)* >
+<!ELEMENT ext_attribute EMPTY>
+<!ATTLIST ext_attribute
+ name CDATA #REQUIRED
+ type CDATA #REQUIRED >
<!ELEMENT svg:svg (svg:g | svg:line | svg:polyline | svg:polygon | svg:rect |
svg:circle | svg:ellipse | svg:path | svg:text)* >
Modified: trunk/objects/custom/custom_object.c
==============================================================================
--- trunk/objects/custom/custom_object.c (original)
+++ trunk/objects/custom/custom_object.c Sun Jul 20 18:18:51 2008
@@ -1534,7 +1534,7 @@
g_return_val_if_fail(info!=NULL,NULL);
- if (!info->loaded) /* called or it's side effect */
+ if (!info->loaded) /* called for it's side effect */
shape_info_getbyname (info->name);
custom = g_new0_ext (Custom, info->ext_attr_size);
@@ -1629,26 +1629,16 @@
DiaObject *newobj;
elem = &custom->element;
-
+ /* can't use object_copy_using_properties() becauses there is no way
+ * to pass in our creation data (info) ... */
newcustom = g_new0_ext (Custom, custom->info->ext_attr_size);
newelem = &newcustom->element;
newobj = &newcustom->element.object;
element_copy(elem, newelem);
-
newcustom->info = custom->info;
- newcustom->border_width = custom->border_width;
- newcustom->border_color = custom->border_color;
- newcustom->inner_color = custom->inner_color;
- newcustom->show_background = custom->show_background;
- newcustom->line_style = custom->line_style;
- newcustom->dashlength = custom->dashlength;
newcustom->padding = custom->padding;
-
- newcustom->flip_h = custom->flip_h;
- newcustom->flip_v = custom->flip_v;
-
newcustom->current_subshape = custom->current_subshape;
newcustom->old_subscale = custom->old_subscale;
newcustom->subscale = custom->subscale;
@@ -1658,11 +1648,7 @@
text_get_attributes(newcustom->text,&newcustom->attrs);
}
- if (custom->info->ext_attr_size) /* copy ext area past end */
- memcpy (newcustom + 1, custom + 1, custom->info->ext_attr_size);
-
newcustom->connections = g_new0(ConnectionPoint, custom->info->nconnections);
-
for (i = 0; i < custom->info->nconnections; i++) {
newobj->connections[i] = &newcustom->connections[i];
newcustom->connections[i].object = newobj;
@@ -1673,7 +1659,9 @@
newcustom->connections[i].flags = custom->connections[i].flags;
}
- custom_update_data(newcustom, ANCHOR_MIDDLE, ANCHOR_MIDDLE);
+ /* ... but everything mapped to property gets copied by StdProps method
+ * including the extended atrributes properties. A simple memcpy can't copy by refs */
+ object_copy_props (newobj, &custom->element.object, FALSE);
return &newcustom->element.object;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]