Commit 0aa8ac03 authored by Hans Breuer's avatar Hans Breuer Committed by Hans Breuer

revert changing of Dia's XML namespace #define DIA_XML_NAME_SPACE_BASE

2004-07-04  Hans Breuer  <hans@breuer.org>

	* lib/persistence.c app/load_save.c app/sheet_dialog_callbacks.c
	  lib/object_defaults.c : revert changing of Dia's XML namespace
	* lib/dia_xml.h : #define DIA_XML_NAME_SPACE_BASE with a comment
	about its purpose and relation to real world urls.

	* lib/plug-ins.h : increment DIA_PLUGIN_API_VERSION and
	added comment about when to o so
	[Should have been long time ago and probably multiple times
	to avoid crashing on older plug-ins]
	* RELEASE-PROCESS : mention DIA_PLUGIN_API_VERSION
	* plug-ins/xslt/xslt.c : use DIA_PLUGIN_CHECK_INIT

	* lib/object.c objects/UML/class.c : there are still compilers not
	supporting C99 and other GCCISMs like allocating dynamic sized arrays
	on the stack
	* objects/UML/class.h : there is a differnce between a list pointer
	and a list pointer pointer. We and GLib want the former.

	* plug-ins/pixbuf/pixbuf.c : don't use app_is_interactive () to detect
	if Gtk is initialized. Using gdk_display_get_default () avoids the
	app/* dependency and is also closer to the requirements of the
	plug-ins working.

	* plug-ins/cairo/diacairo.c : initialize "unique name" field. Also
	some #ifdefed support for Cairo backends not public available yet.

	* plug-ins/wmf/wmf.cpp : finally do extended linestyles if the
	windoze platform supports them. This should fix bug #109818, at
	least for the majority running NT or above ...
	* plug-ins/wmf/wmf_gdi.[hc] : portability stuff for the above

	* objects/makefile.msc : build Istar, Jackson and Kaos

	* objects/UML/class.c(umlclass_load) : don't wrap by default to
	keep old diagrams as they were - instead of this nice new effect ;-)
	Also make "wrap_operations" PROP_TYPE_BOOL in PropDescriptions

	* objects/UML/class.c : mark for translation _("Wrap ...

	* objects/UML/class.c : more correct types, also some default properties
	dialog pages adjustment (triggering a bug in lib/prop_widgets.c ?;)

	* objects/UML/activity.c : removed a leftover from the
	use-localization-for-font-substitution-hack

	* shapes/ChemEng shapes/Cybernetic shapes/Map/Isometric :
	'cvs admin -kb *.png' PNG files should already be *added* as binary,
	otherwise they are not readable on line-end-converting-platforms

	* plug-ins/python/use g_new0(Dia<Im|Ex>portFiler), avoids crashing
	filter_get_by_name()

	* plug-ins/python/pydia-property.c : some more g_warnings for
	not implemented conversions

	* plug-ins/python/group_props.py : ensure unique property values
	at the right place. Now something like :
	- load an old UML class diagram
	- change one of the classes to wrap operations
	- select all classes (/Select/Same Type)
	- /Dialogs/Group Properties : check wrap_operations, select '1'
	- Ok, works like a charm :-)
parent a46f7697
2004-07-04 Hans Breuer <hans@breuer.org>
* lib/persistence.c app/load_save.c app/sheet_dialog_callbacks.c
lib/object_defaults.c : revert changing of Dia's XML namespace
* lib/dia_xml.h : #define DIA_XML_NAME_SPACE_BASE with a comment
about its purpose and relation to real world urls.
* lib/plug-ins.h : increment DIA_PLUGIN_API_VERSION and
added comment about when to o so
[Should have been long time ago and probably multiple times
to avoid crashing on older plug-ins]
* RELEASE-PROCESS : mention DIA_PLUGIN_API_VERSION
* plug-ins/xslt/xslt.c : use DIA_PLUGIN_CHECK_INIT
* lib/object.c objects/UML/class.c : there are still compilers not
supporting C99 and other GCCISMs like allocating dynamic sized arrays
on the stack
* objects/UML/class.h : there is a differnce between a list pointer
and a list pointer pointer. We and GLib want the former.
* plug-ins/pixbuf/pixbuf.c : don't use app_is_interactive () to detect
if Gtk is initialized. Using gdk_display_get_default () avoids the
app/* dependency and is also closer to the requirements of the
plug-ins working.
* plug-ins/cairo/diacairo.c : initialize "unique name" field. Also
some #ifdefed support for Cairo backends not public available yet.
* plug-ins/wmf/wmf.cpp : finally do extended linestyles if the
windoze platform supports them. This should fix bug #109818, at
least for the majority running NT or above ...
* plug-ins/wmf/wmf_gdi.[hc] : portability stuff for the above
* objects/makefile.msc : build Istar, Jackson and Kaos
* objects/UML/class.c(umlclass_load) : don't wrap by default to
keep old diagrams as they were - instead of this nice new effect ;-)
Also make "wrap_operations" PROP_TYPE_BOOL in PropDescriptions
* objects/UML/class.c : mark for translation _("Wrap ...
* objects/UML/class.c : more correct types, also some default properties
dialog pages adjustment (triggering a bug in lib/prop_widgets.c ?;)
* objects/UML/activity.c : removed a leftover from the
use-localization-for-font-substitution-hack
* shapes/ChemEng shapes/Cybernetic shapes/Map/Isometric :
'cvs admin -kb *.png' PNG files should already be *added* as binary,
otherwise they are not readable on line-end-converting-platforms
* plug-ins/python/use g_new0(Dia<Im|Ex>portFiler), avoids crashing
filter_get_by_name()
* plug-ins/python/pydia-property.c : some more g_warnings for
not implemented conversions
* plug-ins/python/group_props.py : ensure unique property values
at the right place. Now something like :
- load an old UML class diagram
- change one of the classes to wrap operations
- select all classes (/Select/Same Type)
- /Dialogs/Group Properties : check wrap_operations, select '1'
- Ok, works like a charm :-)
2004-07-04 Lars Clausen <lars@raeder.dk>
* lib/diagdkrenderer.c (draw_string): Don't unref NULL
......
......@@ -25,7 +25,8 @@ When a new version is about to be released:
Make sure to check for open Bugzilla bugs with the PATCH keyword.
1) The core developers agree on the next version number. It's called
$VERSION thereafter.
$VERSION thereafter. They also look if DIA_PLUGIN_API_VERSION needs
to be updated.
2) D+3: a release candidate tarball is made. It is called
$VERSION-pre1. Simultaneously, a CVS branch is made with the name
......
......@@ -747,7 +747,7 @@ diagram_data_write_doc(DiagramData *data, const char *filename)
doc->xmlRootNode = xmlNewDocNode(doc, NULL, "diagram", NULL);
name_space = xmlNewNs(doc->xmlRootNode,
"http://www.gnome.org/projects/dia/",
DIA_XML_NAME_SPACE_BASE,
"dia");
xmlSetNs(doc->xmlRootNode, name_space);
......
......@@ -1664,7 +1664,7 @@ write_user_sheet(Sheet *sheet)
doc->standalone = FALSE;
root = xmlNewDocNode(doc, NULL, "sheet", NULL);
doc->xmlRootNode = root;
xmlSetProp(root, "xmlns", "http://www.lysator.liu.se/~alla/dia/dia-sheet-ns");
xmlSetProp(root, "xmlns", DIA_XML_NAME_SPACE_BASE "/dia-sheet-ns");
/* comments */
xmlAddChild(root, xmlNewText("\n"));
......
......@@ -25,6 +25,19 @@
#include "diavar.h"
#include <libxml/tree.h>
/*
* Though the Dia homepage is now http://www.gnome.org/projects/dia
* Dia's xml namespace definition still needs to point to the
* original site. In fact the xml namespace definition has nothing to do
* with existing website, they just need to be unique to allow to
* differentiate between varying definitions. Changing the namespace
* from the old to the new site would strictly speaking break all
* older diagrams - although some tools may not take the actual
* key into account.
* See also : doc/diagram.dtd
*/
#define DIA_XML_NAME_SPACE_BASE "http://www.lysator.liu.se/~alla/dia"
DIAVAR int pretty_formated_xml;
typedef xmlNodePtr XML_NODE;
......
......@@ -482,6 +482,7 @@ dia_object_is_selected (const DiaObject *obj)
{
Layer *layer = obj->parent_layer;
DiagramData *diagram = layer ? layer->parent_diagram : NULL;
GList * selected;
/* although this is a little bogus, it is better than crashing
* It appears as if neither group members nor "parented" objects do have their
......@@ -492,7 +493,7 @@ dia_object_is_selected (const DiaObject *obj)
if (!diagram)
return FALSE;
GList *selected = diagram->selected;
selected = diagram->selected;
for (; selected != NULL; selected = g_list_next(selected)) {
if (selected->data == obj) return TRUE;
}
......
......@@ -397,7 +397,7 @@ dia_object_defaults_save (const gchar *filename)
doc->xmlRootNode = xmlNewDocNode(doc, NULL, "diagram", NULL);
ni.name_space = xmlNewNs(doc->xmlRootNode,
"http://www.gnome.org/projects/dia",
DIA_XML_NAME_SPACE_BASE,
"dia");
xmlSetNs(doc->xmlRootNode, ni.name_space);
......
......@@ -471,7 +471,7 @@ persistence_save()
doc->xmlRootNode = xmlNewDocNode(doc, NULL, "persistence", NULL);
name_space = xmlNewNs(doc->xmlRootNode,
"http://www.gnome.org/projects/dia",
DIA_XML_NAME_SPACE_BASE,
"dia");
xmlSetNs(doc->xmlRootNode, name_space);
......
......@@ -26,7 +26,27 @@
#include <gmodule.h>
#include "diatypes.h"
#define DIA_PLUGIN_API_VERSION 4
/*
* The api version to ensure dia core and the plug-ins agree on
* talking about the same thing. If some incompatible change is
* made to the interface between plug-ins and core it needs to
* be incremented to allow the core to detect outdated plug-ins
* and avoid to load them - which otherwise would produce strange
* misinterpretations or even crashes.
*
* Some of the things which require a new plug-in api version are :
* - Changes to DiaRenderer's vtable, that is adding new methods,
* especially if they are shifting the placement of previously
* defined ones, see : lib/diarenderer.h
* - Changes to lib/object.h:_ObjectOps
* - Changes to _DiaExportFilter, _DiaImportFilter, lib/filter.h
* - New, incompatibe versions of libraries where both the core
* and the plug-in depend on (Dia >0.90 crashing on pygtk 1.x
* could have been avoided this way)
* The list is by no means complete. If in doubt about your change
* please ask on dia-list or alternative increment ;-) --hb
*/
#define DIA_PLUGIN_API_VERSION 5
typedef enum {
DIA_PLUGIN_INIT_OK,
......
......@@ -210,7 +210,7 @@ load_register_sheet(const gchar *dirname, const gchar *filename,
if (xmlIsBlankNode(root)) return;
if (!(ns = xmlSearchNsByHref(doc,root,
"http://www.lysator.liu.se/~alla/dia/dia-sheet-ns"))) {
DIA_XML_NAME_SPACE_BASE "/dia-sheet-ns"))) {
g_warning("could not find sheet namespace");
xmlFreeDoc(doc);
return;
......
......@@ -310,9 +310,7 @@ state_create_activity(Point *startpoint,
elem->width = STATE_WIDTH;
elem->height = STATE_HEIGHT;
/* choose default font name for your locale. see also font_data structure
in lib/font.c. */
font = dia_font_new_from_legacy_name (_("Helvetica"));
font = dia_font_new_from_style (DIA_FONT_SANS, 0.8);
p = *startpoint;
p.x += STATE_WIDTH/2.0;
p.y += STATE_HEIGHT/2.0;
......
......@@ -66,6 +66,8 @@ static PropDescription *umlclass_describe_props(UMLClass *umlclass);
static void umlclass_get_props(UMLClass *umlclass, GPtrArray *props);
static void umlclass_set_props(UMLClass *umlclass, GPtrArray *props);
static void fill_in_fontdata(UMLClass *umlclass);
static ObjectTypeOps umlclass_type_ops =
{
(CreateFunc) umlclass_create,
......@@ -103,37 +105,74 @@ static PropDescription umlclass_props[] = {
PROP_STD_TEXT_COLOUR_OPTIONAL,
PROP_STD_LINE_COLOUR_OPTIONAL,
PROP_STD_FILL_COLOUR_OPTIONAL,
{ "name", PROP_TYPE_STRING, PROP_FLAG_VISIBLE,
PROP_STD_NOTEBOOK_BEGIN,
PROP_NOTEBOOK_PAGE("class", PROP_FLAG_DONT_MERGE, N_("Class")),
{ "name", PROP_TYPE_STRING, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
N_("Name"), NULL, NULL },
{ "stereotype", PROP_TYPE_STRING, PROP_FLAG_VISIBLE,
{ "stereotype", PROP_TYPE_STRING, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
N_("Stereotype"), NULL, NULL },
{ "comment", PROP_TYPE_STRING, PROP_FLAG_VISIBLE,
{ "comment", PROP_TYPE_STRING, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
N_("Comment"), NULL, NULL },
{ "abstract", PROP_TYPE_INT, PROP_FLAG_VISIBLE,
{ "abstract", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
N_("Abstract"), NULL, NULL },
{ "suppress_attributes", PROP_TYPE_INT, PROP_FLAG_VISIBLE,
{ "template", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
N_("Template"), NULL, NULL },
{ "suppress_attributes", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
N_("Suppress Attributes"), NULL, NULL },
{ "suppress_operations", PROP_TYPE_INT, PROP_FLAG_VISIBLE,
{ "suppress_operations", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
N_("Suppress Operations"), NULL, NULL },
{ "visible_attributes", PROP_TYPE_INT, PROP_FLAG_VISIBLE,
{ "visible_attributes", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
N_("Visible Attributes"), NULL, NULL },
{ "visible_operations", PROP_TYPE_INT, PROP_FLAG_VISIBLE,
{ "visible_operations", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
N_("Visible Operations"), NULL, NULL },
{ "visible_comments", PROP_TYPE_INT, PROP_FLAG_VISIBLE,
{ "visible_comments", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
N_("Visible Comments"), NULL, NULL },
{ "wrap_operations", PROP_TYPE_INT, PROP_FLAG_VISIBLE,
{ "wrap_operations", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
N_("Wrap Operations"), NULL, NULL },
{ "wrap_after_char", PROP_TYPE_INT, PROP_FLAG_VISIBLE,
{ "wrap_after_char", PROP_TYPE_INT, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
N_("Wrap after char"), NULL, NULL },
/* all this just to make the defaults selectable ... */
PROP_NOTEBOOK_PAGE("font", PROP_FLAG_DONT_MERGE, N_("Font")),
PROP_STD_MULTICOL_BEGIN,
PROP_MULTICOL_COLUMN("font"),
/* FIXME: apparently multicol does not work correctly, this should be FIRST column */
{ "normal_font", PROP_TYPE_FONT, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
N_("Normal"), NULL, NULL },
{ "polymorphic_font", PROP_TYPE_FONT, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
N_("Polymorphic"), NULL, NULL },
{ "abstract_font", PROP_TYPE_FONT, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
N_("Abstract"), NULL, NULL },
{ "classname_font", PROP_TYPE_FONT, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
N_("Classname"), NULL, NULL },
{ "abstract_classname_font", PROP_TYPE_FONT, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
N_("Abstract Classname"), NULL, NULL },
{ "comment_font", PROP_TYPE_FONT, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
N_("Comment"), NULL, NULL },
PROP_MULTICOL_COLUMN("height"),
{ "normal_font_height", PROP_TYPE_REAL, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
N_(" "), NULL, NULL },
{ "polymorphic_font_height", PROP_TYPE_REAL, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
N_(" "), NULL, NULL },
{ "abstract_font_height", PROP_TYPE_REAL, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
N_(" "), NULL, NULL },
{ "classname_font_height", PROP_TYPE_REAL, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
N_(" "), NULL, NULL },
{ "abstract_classname_font_height", PROP_TYPE_REAL, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
N_(" "), NULL, NULL },
{ "comment_font_height", PROP_TYPE_REAL, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
N_(" "), NULL, NULL },
PROP_STD_MULTICOL_END,
PROP_STD_NOTEBOOK_END,
{ "attributes", PROP_TYPE_STRINGLIST, PROP_FLAG_DONT_SAVE,
N_("Attributes"), NULL, NULL },
{ "operations", PROP_TYPE_STRINGLIST, PROP_FLAG_DONT_SAVE,
N_("Operations"), NULL, NULL },
{ "template", PROP_TYPE_INT, PROP_FLAG_VISIBLE,
N_("Template"), NULL, NULL },
/* formal_params XXX */
PROP_DESC_END
......@@ -149,20 +188,41 @@ umlclass_describe_props(UMLClass *umlclass)
static PropOffset umlclass_offsets[] = {
ELEMENT_COMMON_PROPERTIES_OFFSETS,
{ "line_colour", PROP_TYPE_COLOUR, offsetof(UMLClass, line_color) },
{ "fill_colour", PROP_TYPE_COLOUR, offsetof(UMLClass, fill_color) },
{ "name", PROP_TYPE_STRING, offsetof(UMLClass, name) },
{ "stereotype", PROP_TYPE_STRING, offsetof(UMLClass, stereotype) },
{ "comment", PROP_TYPE_STRING, offsetof(UMLClass, comment) },
{ "abstract", PROP_TYPE_INT, offsetof(UMLClass , abstract) },
{ "suppress_attributes", PROP_TYPE_INT, offsetof(UMLClass , suppress_attributes) },
{ "visible_attributes", PROP_TYPE_INT, offsetof(UMLClass , visible_attributes) },
{ "visible_comments", PROP_TYPE_INT, offsetof(UMLClass , visible_comments) },
{ "suppress_operations", PROP_TYPE_INT, offsetof(UMLClass , suppress_operations) },
{ "visible_operations", PROP_TYPE_INT, offsetof(UMLClass , visible_operations) },
{ "visible_comments", PROP_TYPE_INT, offsetof(UMLClass , visible_comments) },
{ "wrap_operations", PROP_TYPE_INT, offsetof(UMLClass , wrap_operations) },
{ "abstract", PROP_TYPE_BOOL, offsetof(UMLClass, abstract) },
{ "template", PROP_TYPE_BOOL, offsetof(UMLClass, template) },
{ "suppress_attributes", PROP_TYPE_BOOL, offsetof(UMLClass , suppress_attributes) },
{ "visible_attributes", PROP_TYPE_BOOL, offsetof(UMLClass , visible_attributes) },
{ "visible_comments", PROP_TYPE_BOOL, offsetof(UMLClass , visible_comments) },
{ "suppress_operations", PROP_TYPE_BOOL, offsetof(UMLClass , suppress_operations) },
{ "visible_operations", PROP_TYPE_BOOL, offsetof(UMLClass , visible_operations) },
{ "visible_comments", PROP_TYPE_BOOL, offsetof(UMLClass , visible_comments) },
{ "wrap_operations", PROP_TYPE_BOOL, offsetof(UMLClass , wrap_operations) },
{ "wrap_after_char", PROP_TYPE_INT, offsetof(UMLClass , wrap_after_char) },
/* all this just to make the defaults selectable ... */
PROP_OFFSET_STD_MULTICOL_BEGIN,
PROP_OFFSET_MULTICOL_COLUMN("font"),
{ "normal_font", PROP_TYPE_FONT, offsetof(UMLClass, normal_font) },
{ "abstract_font", PROP_TYPE_FONT, offsetof(UMLClass, abstract_font) },
{ "polymorphic_font", PROP_TYPE_FONT, offsetof(UMLClass, polymorphic_font) },
{ "classname_font", PROP_TYPE_FONT, offsetof(UMLClass, classname_font) },
{ "abstract_classname_font", PROP_TYPE_FONT, offsetof(UMLClass, abstract_classname_font) },
{ "comment_font", PROP_TYPE_FONT, offsetof(UMLClass, comment_font) },
PROP_OFFSET_MULTICOL_COLUMN("height"),
{ "normal_font_height", PROP_TYPE_REAL, offsetof(UMLClass, font_height) },
{ "abstract_font_height", PROP_TYPE_REAL, offsetof(UMLClass, abstract_font_height) },
{ "polymorphic_font_height", PROP_TYPE_REAL, offsetof(UMLClass, polymorphic_font_height) },
{ "classname_font_height", PROP_TYPE_REAL, offsetof(UMLClass, classname_font_height) },
{ "abstract_classname_font_height", PROP_TYPE_REAL, offsetof(UMLClass, abstract_classname_font_height) },
{ "comment_font_height", PROP_TYPE_REAL, offsetof(UMLClass, comment_font_height) },
PROP_OFFSET_STD_MULTICOL_END,
{ "operations", PROP_TYPE_STRINGLIST, offsetof(UMLClass , operations_strings) },
{ "attributes", PROP_TYPE_STRINGLIST, offsetof(UMLClass , attributes_strings) },
......@@ -208,6 +268,8 @@ umlclass_set_props(UMLClass *umlclass, GPtrArray *props)
{
object_set_props_from_offsets(&umlclass->element.object, umlclass_offsets,
props);
/* kind of dirty, object_load_props() may leave us in an inconsistent state --hb */
fill_in_fontdata(umlclass);
/* Update data: */
umlclass_calculate_data(umlclass);
umlclass_update_data(umlclass);
......@@ -439,12 +501,14 @@ umlclass_draw(UMLClass *umlclass, DiaRenderer *renderer)
&p1, &p2,
&umlclass->line_color);
if (!umlclass->suppress_operations) {
GList *wrapsublist = NULL;
gchar *part_opstr;
int wrap_pos, last_wrap_pos, ident, wrapping_needed;
p.x = x + UMLCLASS_BORDER/2.0 + 0.1;
p.y = p1.y + 0.1;
int wrap_pos, last_wrap_pos, ident, wrapping_needed;
GList *wrapsublist = NULL;
gchar part_opstr[umlclass->max_wrapped_line_width];
part_opstr = g_alloca (umlclass->max_wrapped_line_width);
i = 0;
list = umlclass->operations;
......@@ -467,15 +531,15 @@ umlclass_draw(UMLClass *umlclass, DiaRenderer *renderer)
wrapping_needed = 0;
opstr = (gchar*) g_list_nth(umlclass->operations_strings, i)->data;
if( umlclass->wrap_operations == TRUE) {
if( umlclass->wrap_operations ) {
wrapsublist = (GList*)g_list_nth( umlclass->operations_wrappos, i)->data;
wrapping_needed = GPOINTER_TO_INT( wrapsublist->data);
wrapping_needed = GPOINTER_TO_INT( wrapsublist->data );
}
ascent = dia_font_ascent(opstr, font, font_height);
renderer_ops->set_font(renderer, font, font_height);
if( umlclass->wrap_operations == TRUE && wrapping_needed) {
if( umlclass->wrap_operations && wrapping_needed) {
wrapsublist = g_list_next( wrapsublist);
ident = GPOINTER_TO_INT( wrapsublist->data);
......@@ -725,6 +789,9 @@ umlclass_calculate_data(UMLClass *umlclass)
GList *list;
real maxwidth = 0.0;
real width;
int pos_next_comma, pos_brace, wrap_pos, last_wrap_pos, ident, offset, maxlinewidth, length;
GList *sublist, *wrapsublist;
if (umlclass->destroyed) return;
......@@ -830,18 +897,20 @@ umlclass_calculate_data(UMLClass *umlclass)
umlclass->attributesbox_height = 0.4;
/* operations box: */
umlclass->operationsbox_height = 2*0.1;
/* neither leak previously calculated strings ... */
if (umlclass->operations_strings != NULL) {
g_list_foreach(umlclass->operations_strings, (GFunc)g_free, NULL);
g_list_free(umlclass->operations_strings);
umlclass->operations_strings = NULL;
}
/* ... nor their wrappings */
if (umlclass->operations_wrappos != NULL) {
g_list_foreach(umlclass->operations_wrappos, (GFunc)g_list_free, NULL);
g_list_free(umlclass->operations_wrappos);
umlclass->operations_wrappos = NULL;
}
umlclass->operationsbox_height = 2*0.1;
int pos_next_comma, pos_brace, wrap_pos, last_wrap_pos, ident, offset, maxlinewidth, length;
GList *sublist, *wrapsublist;
umlclass->operations_strings = NULL;
umlclass->operations_wrappos = NULL;
if (0 != g_list_length(umlclass->operations)) {
i = 0;
list = umlclass->operations;
......@@ -853,13 +922,14 @@ umlclass_calculate_data(UMLClass *umlclass)
g_list_append(umlclass->operations_strings, opstr);
length = 0;
if( umlclass->wrap_operations == TRUE) {
if( umlclass->wrap_operations ) {
length = strlen( (const gchar*)opstr);
sublist = NULL;
if( length > umlclass->wrap_after_char) {
gchar *part_opstr;
sublist = g_list_append( sublist, GINT_TO_POINTER( 1));
/* count maximal line width to create a secure buffer (part_opstr)
......@@ -888,7 +958,7 @@ umlclass_calculate_data(UMLClass *umlclass)
}
umlclass->max_wrapped_line_width = MAX( umlclass->max_wrapped_line_width, maxlinewidth+1);
gchar part_opstr[umlclass->max_wrapped_line_width];
part_opstr = g_alloca(umlclass->max_wrapped_line_width);
pos_next_comma = pos_brace = wrap_pos = offset = 0;
wrapsublist = g_list_next( sublist);
......@@ -938,26 +1008,26 @@ umlclass_calculate_data(UMLClass *umlclass)
umlclass->operations_wrappos = g_list_append( umlclass->operations_wrappos, sublist);
}
if( umlclass->wrap_operations == FALSE || !(length > umlclass->wrap_after_char)) {
if (op->inheritance_type == UML_ABSTRACT) {
width = dia_font_string_width(opstr,
umlclass->abstract_font,
umlclass->abstract_font_height);
umlclass->operationsbox_height += umlclass->abstract_font_height;
} else if (op->inheritance_type == UML_POLYMORPHIC) {
width = dia_font_string_width(opstr,
umlclass->polymorphic_font,
umlclass->polymorphic_font_height);
umlclass->operationsbox_height += umlclass->polymorphic_font_height;
} else {
width = dia_font_string_width(opstr,
umlclass->normal_font,
umlclass->font_height);
umlclass->operationsbox_height += umlclass->font_height;
}
maxwidth = MAX(width, maxwidth);
if( !umlclass->wrap_operations || !(length > umlclass->wrap_after_char)) {
if (op->inheritance_type == UML_ABSTRACT) {
width = dia_font_string_width(opstr,
umlclass->abstract_font,
umlclass->abstract_font_height);
umlclass->operationsbox_height += umlclass->abstract_font_height;
} else if (op->inheritance_type == UML_POLYMORPHIC) {
width = dia_font_string_width(opstr,
umlclass->polymorphic_font,
umlclass->polymorphic_font_height);
umlclass->operationsbox_height += umlclass->polymorphic_font_height;
} else {
width = dia_font_string_width(opstr,
umlclass->normal_font,
umlclass->font_height);
umlclass->operationsbox_height += umlclass->font_height;
}
maxwidth = MAX(width, maxwidth);
}
......@@ -1509,6 +1579,7 @@ static DiaObject *umlclass_load(ObjectNode obj_node, int version,
int num, num_attr, num_ops;
GList *list;
umlclass = g_malloc0(sizeof(UMLClass));
elem = &umlclass->element;
obj = &elem->object;
......@@ -1517,7 +1588,10 @@ static DiaObject *umlclass_load(ObjectNode obj_node, int version,
obj->ops = &umlclass_ops;
element_load(elem, obj_node);
object_load_props(obj,obj_node);
/* a bunch of properties still need their own special handling */
/* Class info: */
umlclass->name = NULL;
attr_node = object_find_attribute(obj_node, "name");
......@@ -1564,7 +1638,8 @@ static DiaObject *umlclass_load(ObjectNode obj_node, int version,
if (attr_node != NULL)
umlclass->visible_comments = data_boolean(attribute_first_data(attr_node));
umlclass->wrap_operations = TRUE;
/* new since 0.94, don't wrap by default to keep old diagrams intact */
umlclass->wrap_operations = FALSE;
attr_node = object_find_attribute(obj_node, "wrap_operations");
if (attr_node != NULL)
umlclass->wrap_operations = data_boolean(attribute_first_data(attr_node));
......@@ -1599,66 +1674,6 @@ static DiaObject *umlclass_load(ObjectNode obj_node, int version,
if(attr_node != NULL)
data_color(attribute_first_data(attr_node), &umlclass->text_color);
umlclass->normal_font = NULL;
attr_node = object_find_attribute (obj_node, "normal_font");
if (attr_node != NULL)
umlclass->normal_font = data_font (attribute_first_data (attr_node));
umlclass->abstract_font = NULL;
attr_node = object_find_attribute (obj_node, "abstract_font");
if (attr_node != NULL)
umlclass->abstract_font = data_font (attribute_first_data (attr_node));
umlclass->polymorphic_font = NULL;
attr_node = object_find_attribute (obj_node, "polymorphic_font");
if (attr_node != NULL)
umlclass->polymorphic_font = data_font (attribute_first_data (attr_node));
umlclass->classname_font = NULL;
attr_node = object_find_attribute (obj_node, "classname_font");
if (attr_node != NULL)
umlclass->classname_font = data_font (attribute_first_data (attr_node));
umlclass->abstract_classname_font = NULL;
attr_node = object_find_attribute (obj_node, "abstract_classname_font");
if (attr_node != NULL)
umlclass->abstract_classname_font = data_font (attribute_first_data (attr_node));
umlclass->comment_font = NULL;
attr_node = object_find_attribute (obj_node, "comment_font");
if (attr_node != NULL)
umlclass->comment_font = data_font (attribute_first_data (attr_node));
umlclass->font_height = 0.0;
attr_node = object_find_attribute (obj_node, "font_height");
if (attr_node != NULL)
umlclass->font_height = data_real (attribute_first_data (attr_node));
umlclass->abstract_font_height = 0.0;
attr_node = object_find_attribute (obj_node, "abstract_font_height");
if (attr_node != NULL)
umlclass->abstract_font_height = data_real (attribute_first_data (attr_node));
umlclass->polymorphic_font_height = 0.0;
attr_node = object_find_attribute (obj_node, "polymorphic_font_height");
if (attr_node != NULL)
umlclass->polymorphic_font_height = data_real (attribute_first_data (attr_node));
umlclass->classname_font_height = 0.0;
attr_node = object_find_attribute (obj_node, "classname_font_height");
if (attr_node != NULL)
umlclass->classname_font_height = data_real (attribute_first_data (attr_node));
umlclass->abstract_classname_font_height = 0.0;
attr_node = object_find_attribute (obj_node, "abstract_classname_font_height");
if (attr_node != NULL)
umlclass->abstract_classname_font_height = data_real (attribute_first_data (attr_node));
umlclass->comment_font_height = 0.0;
attr_node = object_find_attribute (obj_node, "comment_font_height");
if (attr_node != NULL)
umlclass->comment_font_height = data_real (attribute_first_data (attr_node));
/* Attribute info: */
attr_node = object_find_attribute(obj_node, "attributes");
num_attr = num = attribute_num_data(attr_node);
......
......@@ -89,7 +89,7 @@ struct _UMLClass {
real operationsbox_height;
GList *operations_strings;
GList **operations_wrappos;
GList *operations_wrappos;
int max_wrapped_line_width;
real templates_height;
......
......@@ -325,7 +325,7 @@ class_create_page(GtkNotebook *notebook, UMLClass *umlclass)
prop_dialog->wrap_after_char = GTK_SPIN_BUTTON(gtk_spin_button_new( GTK_ADJUSTMENT( adj), 0.1, 0));
gtk_spin_button_set_numeric( GTK_SPIN_BUTTON( prop_dialog->wrap_after_char), TRUE);
gtk_spin_button_set_snap_to_ticks( GTK_SPIN_BUTTON( prop_dialog->wrap_after_char), TRUE);
prop_dialog->max_length_label = GTK_LABEL( gtk_label_new( "Wrap after this length: "));
prop_dialog->max_length_label = GTK_LABEL( gtk_label_new( _("Wrap after this length: ")));
gtk_box_pack_start (GTK_BOX (hbox2), GTK_WIDGET( prop_dialog->max_length_label), FALSE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox2), GTK_WIDGET( prop_dialog->wrap_after_char), TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET( hbox2), TRUE, TRUE, 0);
......
!IFNDEF PACKAGE
PLUGINS = bondgraph chronogram custom er flowchart fs grafcet \
misc network sadt standard uml
Istar Jackson Kaos misc network sadt standard uml
#outdated: labels
......@@ -15,9 +15,9 @@ sub-all:
for %d in ($(PLUGINS)) do nmake -nologo -f makefile.msc sub-one THIS=%d
sub-one:
cd $(THIS)
nmake -nologo -f ..\makefile.msc $(THIS).dll PACKAGE=$(THIS) OBJ_$(THIS)=1
cd ..
@cd $(THIS)
@nmake -nologo -f ..\makefile.msc $(THIS).dll PACKAGE=$(THIS) OBJ_$(THIS)=1
@cd ..
clean:
for %d in ($(PLUGINS)) do nmake -nologo -f makefile.msc sub-clean THIS=%d
......@@ -120,6 +120,32 @@ OBJECTS = \
vergent.obj
!ENDIF
!IFDEF OBJ_Istar
OBJECTS = \
actor.obj \
goal.obj \
istar.obj \
link.obj \
other.obj
!ENDIF
!IFDEF OBJ_Jackson
OBJECTS = \
domain.obj \
jackson.obj \
phenomenon.obj \
requirement.obj
!ENDIF
!IFDEF OBJ_Kaos
OBJECTS = \
goal.obj \
kaos.obj \
metaandorrel.obj \
metabinrel.obj \
other.obj
!ENDIF
!IFDEF OBJ_labels
OBJECTS = \
labels.obj \
......
......@@ -178,7 +178,13 @@ DIA_PLUGIN_CHECK_INIT
PluginInitResult
dia_plugin_init(PluginInfo *info)
{
if (app_is_interactive()) {
/*
* If GTK is not initialized yet don't register this plug-in. This is
* almost the same as app_is_interactive() but avoids to make plug-ins
* depend on Dia's app core function. Also what we really need is a
* display, not an interactive app ;)
*/
if (gdk_display_get_default ()) {
if (!dia_plugin_info_init(info, "Pixbuf",
_("gdk-pixbuf based bitmap export/import"),
NULL, NULL))
......
......@@ -223,7 +223,7 @@ PyDia_RegisterExport(PyObject *self, PyObject *args)
Py_INCREF(renderer); /* stay alive, where to kill ?? */
filter = g_new (DiaExportFilter, 1);
filter = g_new0 (DiaExportFilter, 1);
filter->description = g_strdup (name);
filter->extensions = g_new (gchar*, 2);
filter->extensions[0] = g_strdup (ext);
......@@ -287,7 +287,7 @@ PyDia_RegisterImport(PyObject *self, PyObject *args)
Py_INCREF(func); /* stay alive, where to kill ?? */
filter = g_new (DiaImportFilter, 1);
filter = g_new0 (DiaImportFilter, 1);
filter->description = g_strdup (name);
filter->extensions = g_new (gchar*, 2);
filter->extensions[0] = g_strdup (ext);
......@@ -354,7 +354,7 @@ PyDia_RegisterCallback(PyObject *self, PyObject *args)
Py_INCREF(func); /* stay alive, where to kill ?? */
filter = g_new (DiaCallbackFilter, 1);
filter = g_new0 (DiaCallbackFilter, 1);
filter->description = g_strdup (desc);
filter->menupath = g_strdup (menupath);
filter->callback = &PyDia_callback_func;
......