Commit 68199b3c authored by Lars Clausen's avatar Lars Clausen
Browse files

Object flags, adding makefiles, news on 0.95-1

parent 5143260d
2006-05-28 Lars Clausen <lars@raeder.dk>
* lib/parent.c (parent_handle_move_in_check):
* app/create_object.c (create_object_button_press):
* app/diagram.c (diagram_unparent_children_selected):
* app/disp_callbacks.c (ddisplay_drop_object):
* app/load_save.c (write_objects):
* objects/network/radiocell.c (radiocell_create):
* objects/AADL/aadlbox.c (aadlbox_create):
* objects/UML/large_package.c (largepackage_create):
* objects/UML/component.c (component_create):
* lib/object.[ch]: DiaObject API change: DiaObject now has gint
flags rather than gboolean can_parent, and utility function
object_flags_set. Uses of can_parent changed to call to function.
* doc/en/dia.dbk: Removal of obsolete epsi references.
2006-05-27 Hans Breuer <hans@breuer.org>
 
* app/menus.c : listen to Gtk-WARNING **: Unable to parse accelerator
......
dia-0.95-1: 25-May-2006
* Fix of bug #339562 (page margins restriction), #338336 ("query" in
umloperation_offsets), and #334771 (ungroup crashes)
dia-0.95: 19-Apr-2006
* Update of Gane/Sarson sheets.
......
......@@ -102,7 +102,7 @@ How to make a tarball
Script to update version:
find . -name configure.in -o -name config.h.win32 -o -name dia.xml | xargs sed -i 's/0\.95-pre[0-9]*/0.95-pre5/;'
find . -name configure.in -o -name config.h.win32 -o -name dia.xml | xargs sed -i 's/0\.95*/0.95-1/;'
Issues to solve
---------------
......
......@@ -88,7 +88,8 @@ create_object_button_press(CreateObjectTool *tool, GdkEventButton *event,
g_list_free(avoid);
if (parent_obj && parent_obj->can_parent) /* starting point is within another object */
/* starting point is within another object */
if (parent_obj && object_flags_set(parent_obj, DIA_OBJECT_CAN_PARENT))
{
Change *change = undo_parenting(ddisp->diagram, parent_obj, obj, TRUE);
(change->apply)(change, ddisp->diagram);
......
......@@ -371,7 +371,8 @@ diagram_selected_any_parents(Diagram *dia) {
for (selected = dia->data->selected;
selected != NULL; selected = selected->next) {
DiaObject *obj = (DiaObject*)selected->data;
if (obj->can_parent && obj->children != NULL) return TRUE;
if (object_flags_set(obj, DIA_OBJECT_CAN_PARENT) && obj->children != NULL)
return TRUE;
}
return FALSE;
}
......@@ -399,7 +400,7 @@ diagram_selected_can_parent(Diagram *dia) {
for (selected = dia->data->selected;
selected != NULL; selected = selected->next) {
DiaObject *obj = (DiaObject*)selected->data;
if (obj->can_parent) {
if (object_flags_set(obj, DIA_OBJECT_CAN_PARENT)) {
parents = g_list_prepend(parents, obj);
}
}
......@@ -464,9 +465,9 @@ diagram_update_menu_sensitivity (Diagram *dia, UpdatableMenuItems *items)
gtk_action_set_sensitive (items->parent, diagram_selected_can_parent (dia));
gtk_action_set_sensitive (items->unparent,
diagram_selected_any_children (dia));
gtk_action_set_sensitive (items->unparent_children,
diagram_selected_any_parents (dia));
diagram_selected_any_children (dia));
gtk_action_set_sensitive (items->unparent_children,
diagram_selected_any_parents (dia));
gtk_action_set_sensitive (items->group, selected_count > 1);
gtk_action_set_sensitive (items->ungroup, diagram_selected_any_groups (dia));
gtk_action_set_sensitive (items->properties, selected_count > 0);
......@@ -966,7 +967,7 @@ void diagram_parent_selected(Diagram *dia)
for (idx2 = idx + 1; idx2 < length; idx2++)
{
ObjectExtent *oe2 = g_ptr_array_index(extents, idx2);
if (!oe2->object->can_parent)
if (!object_flags_set(oe2->object, DIA_OBJECT_CAN_PARENT))
continue;
if (oe1->extent.right <= oe2->extent.right
......@@ -1032,7 +1033,7 @@ void diagram_unparent_children_selected(Diagram *dia)
for (list = dia->data->selected; list != NULL; list = g_list_next(list))
{
obj = (DiaObject *) list->data;
if (!obj->can_parent || !obj->children)
if (!object_flags_set(obj, DIA_OBJECT_CAN_PARENT) || !obj->children)
continue;
any_unparented = TRUE;
......
......@@ -872,7 +872,8 @@ ddisplay_drop_object(DDisplay *ddisp, gint x, gint y, DiaObjectType *otype,
p_obj = diagram_find_clicked_object(ddisp->diagram, &droppoint_orig,
click_distance);
if (p_obj && p_obj->can_parent) /* the tool was dropped inside an object that takes children*/
if (p_obj && object_flags_set(p_obj, DIA_OBJECT_CAN_PARENT))
/* the tool was dropped inside an object that takes children*/
{
Rectangle p_ext, c_ext;
real parent_height, child_height, parent_width, child_width;
......
......@@ -643,7 +643,7 @@ write_objects(GList *objects, xmlNodePtr objects_node,
(*obj_nr)++;
/*
if (obj->can_parent && obj->children)
if (object_flags_set(obj, DIA_OBJECT_CAN_PARENT) && obj->children)
{
int res;
xmlNodePtr parent_node;
......
......@@ -87,18 +87,16 @@ dxf
\(bu
eps
or
epsi
or
eps\-builtin
or
eps\-pango
(Encapsulated PostScript)
The format specifications
eps,
epsi, and
eps
and
eps\-pango
all use the font renderer of the Pango library, while
both use the font renderer of the Pango library, while
eps\-builtin
uses a dia specific font renderer. If you have problems with Pango rendering, e.g. Unicode, try
eps\-builtin
......
......@@ -228,12 +228,11 @@
</listitem>
<listitem>
<para><literal>eps</literal> or <literal>epsi</literal> or
<para><literal>eps</literal> or
<literal>eps-builtin</literal> or <literal>eps-pango</literal>
(Encapsulated PostScript)</para>
<para>The format specifications <literal>eps</literal>,
<literal>epsi</literal>, and <literal>eps-pango</literal> all
<para>The format specifications <literal>eps</literal> and <literal>eps-pango</literal> both
use the font renderer of the Pango library, while
<literal>eps-builtin</literal> uses a dia specific font
renderer. If you have problems with Pango rendering,
......
......@@ -115,7 +115,7 @@ object_copy(DiaObject *from, DiaObject *to)
to->ops = from->ops;
to->can_parent = from->can_parent;
to->flags = from->flags;
to->parent = from->parent;
to->children = g_list_copy(from->children);
}
......@@ -177,7 +177,8 @@ object_copy_list(GList *list_orig)
if (obj_copy->parent)
obj_copy->parent = g_hash_table_lookup(hash_table, obj_copy->parent);
if (obj_copy->can_parent && obj_copy->children)
if (object_flags_set(obj_copy, DIA_OBJECT_CAN_PARENT)
&& obj_copy->children)
{
GList *child_list = obj_copy->children;
while(child_list)
......@@ -266,7 +267,7 @@ object_list_move_delta_r(GList *objects, Point *delta, gboolean affected)
}
objchange = obj->ops->move(obj, &pos);
if (obj->can_parent && obj->children)
if (object_flags_set(obj, DIA_OBJECT_CAN_PARENT) && obj->children)
objchange = object_list_move_delta_r(obj->children, delta, FALSE);
list = g_list_next(list);
......@@ -710,6 +711,17 @@ object_get_type(char *name)
return (DiaObjectType *) g_hash_table_lookup(object_type_table, name);
}
/** True if all the given flags are set, false otherwise.
* @param obj An object to test.
* @param flags Flags to check if they are set. See definitions in object.h
* @return TRUE if all the flags given are set on the object.
*/
gboolean
object_flags_set(DiaObject *obj, gint flags)
{
return (obj->flags & flags) == flags;
}
/** Utility function that always returns FALSE given any object.
* @param obj Not used.
* @return FALSE
......
......@@ -36,6 +36,17 @@
G_BEGIN_DECLS
/** Flags for DiaObject */
/** Set this if the DiaObject can 'contain' other objects that move with
* it, a.k.a. be a parent. A parent moves its children along and
* constricts its children to live inside its borders.
*/
#define DIA_OBJECT_CAN_PARENT 1
/** Set this if the DiaObject grabs all input destined for its children.
* This is typically used for group-like objects.
*/
#define DIA_OBJECT_GRABS_CHILD_INPUT 2
/** This enumeration gives a bitset of modifier keys currently held down.
*/
typedef enum {
......@@ -356,6 +367,7 @@ void object_register_type(DiaObjectType *type);
void object_registry_foreach(GHFunc func, gpointer user_data);
DiaObjectType *object_get_type(char *name);
gchar *object_get_displayname (DiaObject* obj);
gboolean object_flags_set(DiaObject* obj, gint flags);
int object_return_false(DiaObject *obj); /* Just returns FALSE */
void *object_return_null(DiaObject *obj); /* Just returns NULL */
......@@ -463,7 +475,7 @@ struct _DiaObject {
dia_object_get_parent_layer() */
DiaObject *parent; /*!< Back-pointer to DiaObject which is parenting this object. Can be NULL */
GList *children; /*!< In case this object is a parent of other object the children are listed here */
gboolean can_parent; /*!< Only some object support parenting, i.e. hosting other objects */
gint flags; /*!< Various flags that can be set for this object, see defines above */
Color *highlight_color; /*!< The color that this object is currently
highlighted with, or NULL if it is not
......
......@@ -37,7 +37,7 @@ gboolean parent_list_expand(GList *obj_list)
{
DiaObject *obj = (DiaObject *) list->data;
if (obj->can_parent && obj->children)
if (object_flags_set(obj, DIA_OBJECT_CAN_PARENT) && obj->children)
{
obj_list = g_list_concat(obj_list, g_list_copy(obj->children));
nothing_affected = FALSE;
......@@ -169,7 +169,7 @@ gboolean parent_handle_move_in_check(DiaObject *object, Point *to, Point *start_
Rectangle p_ext;
Point new_delta;
if (!object->can_parent || !object->children)
if (!object_flags_set(object, DIA_OBJECT_CAN_PARENT) || !object->children)
return FALSE;
parent_point_extents(to, &p_ext);
......
......@@ -868,7 +868,7 @@ DiaObject *aadlbox_create(Point *startpoint, void *user_data,
elem = &aadlbox->element;
obj = &elem->object;
obj->can_parent = TRUE;
obj->flags |= DIA_OBJECT_CAN_PARENT;
elem->corner = *startpoint;
......
......@@ -392,7 +392,7 @@ component_create(Point *startpoint,
obj->ops = &component_ops;
obj->can_parent = TRUE;
obj->flags |= DIA_OBJECT_CAN_PARENT;
elem->corner = *startpoint;
cmp->line_color = attributes_get_foreground();
......
......@@ -361,7 +361,7 @@ largepackage_create(Point *startpoint,
obj->ops = &largepackage_ops;
obj->can_parent = TRUE;
obj->flags |= DIA_OBJECT_CAN_PARENT;
elem->corner = *startpoint;
......
......@@ -323,7 +323,7 @@ radiocell_create(Point *startpoint,
obj = &poly->object;
obj->type = &radiocell_type;
obj->ops = &radiocell_ops;
obj->can_parent = TRUE;
obj->flags |= DIA_OBJECT_CAN_PARENT;
radiocell->radius = 4.;
......
SUBDIRS=exports
tests:
for DIR in $(SUBDIRS); do \
cd $$DIR && $(MAKE) tests; \
done
EXPORT_PLUGINS=cgm dxf eps eps-builtin eps-pango fig mp plt hpgl png png-libart pixbuf-png jpg shape svg tex wpg
tests:
for FILTER in $(EXPORT_PLUGINS); do \
for FILE in *.dia; do \
echo -n .; \
OUTPUT=/tmp/`basename $$FILE .dia`.$$FILTER; \
ORIGINAL=$$FILTER/`basename $$FILE .dia`.$$FILTER; \
if ! ../../app/run_dia.sh -t $$FILTER -e $$OUTPUT $$FILE ; then \
echo; \
echo $$FILTER failed for $$FILE; \
elif ! diff $$OUTPUT $$ORIGINAL >/dev/null ; then \
echo; \
echo "$$FILTER output has changed for $$FILE (see $$OUTPUT)"; \
else \
rm $$OUTPUT; \
fi; \
done; \
done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment