dia r4210 - in trunk: . app doc
- From: hans svn gnome org
- To: svn-commits-list gnome org
- Subject: dia r4210 - in trunk: . app doc
- Date: Tue, 20 Jan 2009 23:02:32 +0000 (UTC)
Author: hans
Date: Tue Jan 20 23:02:31 2009
New Revision: 4210
URL: http://svn.gnome.org/viewvc/dia?rev=4210&view=rev
Log:
2009-01-20 Hans Breuer <hans breuer org>
* app/load_save.c doc/diagram.dtd : load, save and document
<layer active="true"/>, fixes bug #568497
Modified:
trunk/ChangeLog
trunk/app/load_save.c
trunk/doc/diagram.dtd
Modified: trunk/app/load_save.c
==============================================================================
--- trunk/app/load_save.c (original)
+++ trunk/app/load_save.c Tue Jan 20 23:02:31 2009
@@ -420,6 +420,7 @@
xmlNsPtr namespace;
gchar firstchar;
Diagram *diagram = DIA_IS_DIAGRAM (data) ? DIA_DIAGRAM (data) : NULL;
+ Layer *active_layer = NULL;
if (g_file_test (filename, G_FILE_TEST_IS_DIR)) {
message_error(_("You must specify a file, not a directory.\n"));
@@ -626,6 +627,7 @@
while (layer_node != NULL) {
gchar *name;
char *visible;
+ char *active;
if (xmlIsBlankNode(layer_node)) {
layer_node = layer_node->next;
@@ -637,16 +639,16 @@
name = (char *)xmlGetProp(layer_node, (const xmlChar *)"name");
if (!name) break; /* name is mandatory */
- visible = (char *)xmlGetProp(layer_node, (const xmlChar *)"visible");
-
layer = new_layer(g_strdup(name), data);
if (name) xmlFree(name);
layer->visible = FALSE;
- if ((visible) && (strcmp(visible, "true")==0))
- layer->visible = TRUE;
- if (visible) xmlFree(visible);
-
+ visible = (char *)xmlGetProp(layer_node, (const xmlChar *)"visible");
+ if (visible) {
+ if (strcmp(visible, "true")==0)
+ layer->visible = TRUE;
+ xmlFree(visible);
+ }
/* Read in all objects: */
list = read_objects(layer_node, objects_hash, filename, NULL);
@@ -655,10 +657,20 @@
data_add_layer(data, layer);
+ active = (char *)xmlGetProp(layer_node, (const xmlChar *)"active");
+ if (active) {
+ if (strcmp(active, "true")==0)
+ active_layer = layer;
+ xmlFree(active);
+ }
+
layer_node = layer_node->next;
}
- data->active_layer = (Layer *) g_ptr_array_index(data->layers, 0);
+ if (!active_layer)
+ data->active_layer = (Layer *) g_ptr_array_index(data->layers, 0);
+ else
+ data_set_active_layer(data, active_layer);
xmlFreeDoc(doc);
@@ -919,7 +931,10 @@
xmlSetProp(layer_node, (const xmlChar *)"visible", (const xmlChar *)"true");
else
xmlSetProp(layer_node, (const xmlChar *)"visible", (const xmlChar *)"false");
-
+
+ if (layer == data->active_layer)
+ xmlSetProp(layer_node, (const xmlChar *)"active", (const xmlChar *)"true");
+
write_objects(layer->objects, layer_node,
objects_hash, &obj_nr, filename);
Modified: trunk/doc/diagram.dtd
==============================================================================
--- trunk/doc/diagram.dtd (original)
+++ trunk/doc/diagram.dtd Tue Jan 20 23:02:31 2009
@@ -7,7 +7,8 @@
<!ELEMENT dia:layer (dia:object | dia:group)*>
<!ATTLIST dia:layer
name CDATA #REQUIRED
- visible (true|false) #REQUIRED >
+ visible (true|false) #REQUIRED
+ active (true|false) #IMPLIED>
<!ELEMENT dia:object ((dia:attribute)*, dia:connections?)>
<!ATTLIST dia:object
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]