[dia] We always have a config.h
- From: Zander <zbrown src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] We always have a config.h
- Date: Tue, 14 May 2019 17:01:35 +0000 (UTC)
commit ddc1c7070e93aeaa16703e1764c96b07599d3dae
Author: Zander Brown <zbrown gnome org>
Date: Tue May 14 17:48:46 2019 +0100
We always have a config.h
app/autosave.c | 6 +-
app/dia-colour-area.c | 2 -
app/dia-line-width-area.c | 2 -
app/dia-palette.c | 56 ++++++
app/dia-props.c | 30 ++-
app/diapagelayout.c | 2 -
app/disp_callbacks.c | 2 -
app/display.c | 2 -
app/grid.c | 28 ++-
app/layer_dialog.c | 2 -
app/menus.c | 2 -
app/object_ops.c | 42 ++--
app/pagesetup.c | 10 +-
app/plugin-manager.c | 32 ++-
app/properties-dialog.c | 2 -
app/recent_files.c | 24 +--
app/sheets_dialog.c | 4 +-
app/sheets_dialog_callbacks.c | 106 +++++-----
lib/create.c | 52 +++--
lib/diagramdata.c | 100 +++++----
lib/dialinechooser.c | 2 -
lib/dialogs.c | 6 +-
lib/filter.c | 26 ++-
lib/font-height.c | 18 +-
lib/font.c | 152 +++++++-------
lib/geometry.h | 30 ++-
lib/layer.c | 46 ++---
lib/prefs.c | 8 +-
lib/prefs.h | 2 -
lib/prop_attr.c | 100 +++++----
lib/prop_basic.c | 190 +++++++++--------
lib/prop_dict.c | 60 +++---
lib/prop_geomtypes.c | 258 ++++++++++++------------
lib/prop_inttypes.c | 2 -
lib/prop_sdarray.c | 68 +++----
lib/prop_sdarray_widget.c | 52 +++--
lib/prop_text.c | 102 +++++-----
lib/prop_widgets.c | 140 +++++++------
lib/propdesc.c | 26 ++-
lib/propdialogs.c | 56 +++---
lib/properties.c | 6 +-
lib/proplist.c | 58 +++---
lib/propobject.c | 28 ++-
lib/propregistry.c | 8 +-
meson.build | 4 -
objects/AADL/aadl.c | 4 +-
objects/AADL/aadl.h | 18 +-
objects/Database/compound.c | 8 +-
objects/Database/database.c | 4 +-
objects/Database/reference.c | 6 +-
objects/Database/table.c | 50 +++--
objects/ER/attribute.c | 40 ++--
objects/ER/entity.c | 58 +++---
objects/ER/er.c | 2 -
objects/ER/participation.c | 42 ++--
objects/ER/relationship.c | 70 ++++---
objects/FS/flow-ortho.c | 56 +++---
objects/FS/flow.c | 66 +++---
objects/FS/fs.c | 2 -
objects/FS/function.c | 58 +++---
objects/GRAFCET/action.c | 54 +++--
objects/GRAFCET/condition.c | 46 ++---
objects/GRAFCET/grafcet.c | 10 +-
objects/GRAFCET/step.c | 84 ++++----
objects/GRAFCET/transition.c | 62 +++---
objects/GRAFCET/vector.c | 34 ++--
objects/GRAFCET/vergent.c | 70 ++++---
objects/Istar/actor.c | 8 +-
objects/Istar/goal.c | 2 -
objects/Istar/istar.c | 4 +-
objects/Istar/link.c | 12 +-
objects/Istar/other.c | 2 -
objects/Jackson/domain.c | 2 -
objects/Jackson/jackson.c | 4 +-
objects/Jackson/phenomenon.c | 4 +-
objects/Jackson/requirement.c | 4 +-
objects/KAOS/goal.c | 2 -
objects/KAOS/kaos.c | 4 +-
objects/KAOS/metaandorrel.c | 2 -
objects/KAOS/metabinrel.c | 2 -
objects/KAOS/other.c | 4 +-
objects/Misc/analog_clock.c | 66 +++---
objects/Misc/grid_object.c | 44 ++--
objects/Misc/libmisc.c | 8 +-
objects/Misc/tree.c | 62 +++---
objects/SADT/annotation.c | 54 +++--
objects/SADT/arrow.c | 52 +++--
objects/SADT/box.c | 56 +++---
objects/SADT/sadt.c | 4 +-
objects/UML/activity.c | 28 ++-
objects/UML/actor.c | 46 ++---
objects/UML/association.c | 128 ++++++------
objects/UML/branch.c | 32 ++-
objects/UML/class.c | 254 ++++++++++++-----------
objects/UML/classicon.c | 52 +++--
objects/UML/component.c | 38 ++--
objects/UML/component_feature.c | 10 +-
objects/UML/constraint.c | 54 +++--
objects/UML/dependency.c | 42 ++--
objects/UML/fork.c | 34 ++--
objects/UML/generalization.c | 48 +++--
objects/UML/implements.c | 40 ++--
objects/UML/large_package.c | 36 ++--
objects/UML/lifeline.c | 106 +++++-----
objects/UML/message.c | 62 +++---
objects/UML/node.c | 34 ++--
objects/UML/note.c | 30 ++-
objects/UML/object.c | 62 +++---
objects/UML/realizes.c | 46 ++---
objects/UML/small_package.c | 44 ++--
objects/UML/state.c | 62 +++---
objects/UML/state_term.c | 36 ++--
objects/UML/transition.c | 136 ++++++-------
objects/UML/uml.c | 12 +-
objects/UML/umlattribute.c | 16 +-
objects/UML/umlformalparameter.c | 4 +-
objects/UML/umloperation.c | 44 ++--
objects/UML/umlparameter.c | 14 +-
objects/UML/usecase.c | 58 +++---
objects/chronogram/chronogram.c | 6 +-
objects/chronogram/chronoline.c | 94 +++++----
objects/chronogram/chronoref.c | 64 +++---
objects/custom/custom_object.c | 90 ++++-----
objects/flowchart/box.c | 40 ++--
objects/flowchart/diamond.c | 42 ++--
objects/flowchart/ellipse.c | 40 ++--
objects/flowchart/flowchart.c | 2 -
objects/flowchart/parallelogram.c | 34 ++--
objects/network/basestation.c | 2 -
objects/network/bus.c | 62 +++---
objects/network/network.c | 2 -
objects/network/radiocell.c | 2 -
objects/standard/bezier.c | 2 -
objects/standard/beziergon.c | 2 -
objects/standard/box.c | 2 -
objects/standard/ellipse.c | 2 -
objects/standard/line.c | 2 -
objects/standard/polygon.c | 2 -
objects/standard/polyline.c | 2 -
objects/standard/standard.c | 2 -
objects/standard/textobj.c | 2 -
objects/standard/zigzagline.c | 2 -
plug-ins/cgm/cgm.c | 104 +++++-----
plug-ins/dxf/dxf-export.c | 64 +++---
plug-ins/dxf/dxf-import.c | 358 ++++++++++++++++-----------------
plug-ins/hpgl/hpgl.c | 78 ++++---
plug-ins/postscript/paginate_psprint.c | 2 -
plug-ins/python/python.c | 14 +-
plug-ins/svg/svg-import.c | 74 ++++---
plug-ins/vdx/vdx-export.c | 196 +++++++++---------
plug-ins/vdx/vdx-import.c | 8 +-
plug-ins/xfig/xfig-common.c | 4 +-
plug-ins/xfig/xfig-export.c | 296 ++++++++++++++-------------
plug-ins/xfig/xfig-import.c | 98 +++++----
154 files changed, 3175 insertions(+), 3429 deletions(-)
---
diff --git a/app/autosave.c b/app/autosave.c
index 308c9583..f28e83ff 100644
--- a/app/autosave.c
+++ b/app/autosave.c
@@ -19,16 +19,14 @@
/* Autosave */
/* Automatically save a copy with the .autosave extension after idle time.
- * Don't autosave unmodified diagrams, and remove the autosave file when
+ * Don't autosave unmodified diagrams, and remove the autosave file when
* the diagram is saved successfully. Also remove autosave file when the
* diagram is closed, even if it was modified.
* If (auto)saving crashes you, this will really fuck you over!
*
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include "autosave.h"
#include "diagram.h"
@@ -57,7 +55,7 @@ autosave_check_autosave(gpointer data)
while (diagrams != NULL) {
diagram = (Diagram *)diagrams->data;
- if (diagram_is_modified(diagram) &&
+ if (diagram_is_modified(diagram) &&
!diagram->autosaved) {
/* Diagram has been modified. At next idleness, save it */
g_idle_add ((GSourceFunc)autosave_save_diagram, diagram);
diff --git a/app/dia-colour-area.c b/app/dia-colour-area.c
index eba2a221..1f6683ff 100644
--- a/app/dia-colour-area.c
+++ b/app/dia-colour-area.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <stdio.h>
diff --git a/app/dia-line-width-area.c b/app/dia-line-width-area.c
index d38a9141..07f72d2f 100644
--- a/app/dia-line-width-area.c
+++ b/app/dia-line-width-area.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include "dia-line-width-area.h"
#include "attributes.h"
diff --git a/app/dia-palette.c b/app/dia-palette.c
new file mode 100644
index 00000000..53a770c5
--- /dev/null
+++ b/app/dia-palette.c
@@ -0,0 +1,56 @@
+/* Dia -- an diagram creation/manipulation program
+ * Copyright © 2019 Zander Brown <zbrown gnome org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+
+#include "dia-palette.h"
+
+struct _DiaPalette
+{
+ GtkGrid parent;
+
+ int active;
+ GtkWidget *dialog;
+ GtkWidget *button;
+};
+
+
+G_DEFINE_TYPE (DiaPalette, dia_palette, GTK_TYPE_GRID)
+
+static void
+dia_palette_dialog_ok (GtkWidget *widget, DiaPalette *self)
+{
+ gtk_dialog_response (GTK_DIALOG (self->dialog), GTK_RESPONSE_OK);
+}
+
+static void
+dia_palette_class_init (DiaPaletteClass *class)
+{
+}
+
+static void
+dia_palette_init (DiaPalette *self)
+{
+}
+
+
+GtkWidget *
+dia_palette_new ()
+{
+ return g_object_new (DIA_TYPE_PALETTE, NULL);
+}
diff --git a/app/dia-props.c b/app/dia-props.c
index 49aa6ff0..41697732 100644
--- a/app/dia-props.c
+++ b/app/dia-props.c
@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
#include "dia-props.h"
@@ -53,7 +51,7 @@ diagram_properties_update_sensitivity(GtkToggleButton *widget,
if (!dia)
return; /* safety first */
-
+
dia->grid.dynamic =
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dynamic_check));
dyn_grid = dia->grid.dynamic;
@@ -120,9 +118,9 @@ create_diagram_properties_dialog(Diagram *dia)
dynamic_check = gtk_check_button_new_with_label(_("Dynamic grid"));
gtk_table_attach(GTK_TABLE(table), dynamic_check, 1,2, 0,1,
GTK_FILL, GTK_FILL, 0, 0);
- g_signal_connect(G_OBJECT(dynamic_check), "toggled",
+ g_signal_connect(G_OBJECT(dynamic_check), "toggled",
G_CALLBACK(diagram_properties_update_sensitivity), NULL);
-
+
gtk_widget_show(dynamic_check);
label = gtk_label_new(_("x"));
@@ -178,9 +176,9 @@ create_diagram_properties_dialog(Diagram *dia)
hex_check = gtk_check_button_new_with_label(_("Hex grid"));
gtk_table_attach(GTK_TABLE(table), hex_check, 1,2, 4,5,
GTK_FILL, GTK_FILL, 0, 0);
- g_signal_connect(G_OBJECT(hex_check), "toggled",
+ g_signal_connect(G_OBJECT(hex_check), "toggled",
G_CALLBACK(diagram_properties_update_sensitivity), NULL);
-
+
gtk_widget_show(hex_check);
label = gtk_label_new(_("Hex grid size"));
@@ -284,7 +282,7 @@ diagram_properties_retrieve(Diagram *dia)
&dia->data->bg_color);
dia_color_selector_set_color(grid_colour,
&dia->grid.colour);
- dia_color_selector_set_color(pagebreak_colour,
+ dia_color_selector_set_color(pagebreak_colour,
&dia->pagebreak_color);
diagram_properties_update_sensitivity(GTK_TOGGLE_BUTTON(dynamic_check), dia);
@@ -299,11 +297,11 @@ diagram_properties_show(Diagram *dia)
gtk_widget_destroy(dialog);
dialog = NULL;
}
-
+
create_diagram_properties_dialog(dia);
-
+
diagram_properties_retrieve(dia);
-
+
gtk_window_set_transient_for(GTK_WINDOW(dialog),
GTK_WINDOW (ddisplay_active()->shell));
gtk_widget_show(dialog);
@@ -319,13 +317,13 @@ diagram_properties_respond(GtkWidget *widget,
if (response_id == GTK_RESPONSE_OK ||
response_id == GTK_RESPONSE_APPLY) {
if (active_diagram) {
- /* we do not bother for the actual change, just record the
+ /* we do not bother for the actual change, just record the
* whole possible change */
- undo_change_memswap (active_diagram,
+ undo_change_memswap (active_diagram,
&active_diagram->grid, sizeof(active_diagram->grid));
- undo_change_memswap (active_diagram,
+ undo_change_memswap (active_diagram,
&active_diagram->data->bg_color, sizeof(active_diagram->data->bg_color));
- undo_change_memswap (active_diagram,
+ undo_change_memswap (active_diagram,
&active_diagram->pagebreak_color, sizeof(active_diagram->pagebreak_color));
undo_set_transactionpoint(active_diagram->undo);
diff --git a/app/diapagelayout.c b/app/diapagelayout.c
index 59c00c66..9141acf4 100644
--- a/app/diapagelayout.c
+++ b/app/diapagelayout.c
@@ -21,9 +21,7 @@
/*#define PAGELAYOUT_TEST*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include "diapagelayout.h"
#include "widgets.h"
diff --git a/app/disp_callbacks.c b/app/disp_callbacks.c
index 1b020049..ad856d7c 100644
--- a/app/disp_callbacks.c
+++ b/app/disp_callbacks.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <stdio.h>
#include <string.h>
diff --git a/app/display.c b/app/display.c
index 91a131be..3aabc807 100644
--- a/app/display.c
+++ b/app/display.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <string.h>
#include <stdio.h>
diff --git a/app/grid.c b/app/grid.c
index 7ac60c0f..16c9264d 100644
--- a/app/grid.c
+++ b/app/grid.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <stdio.h>
#include <stdlib.h>
@@ -82,7 +80,7 @@ grid_step (DDisplay *ddisp, GtkOrientation orientation,
}
static void
-grid_draw_horizontal_lines(DDisplay *ddisp, Rectangle *update, real length)
+grid_draw_horizontal_lines(DDisplay *ddisp, Rectangle *update, real length)
{
int x, y;
real pos;
@@ -131,7 +129,7 @@ grid_draw_horizontal_lines(DDisplay *ddisp, Rectangle *update, real length)
}
static void
-grid_draw_vertical_lines(DDisplay *ddisp, Rectangle *update, real length)
+grid_draw_vertical_lines(DDisplay *ddisp, Rectangle *update, real length)
{
int x = 0, y = 0;
real pos;
@@ -185,13 +183,13 @@ grid_draw_hex(DDisplay *ddisp, Rectangle *update, real length)
while (horiz_pos <= update->right) {
ddisplay_transform_coords(ddisp, horiz_pos, vert_pos, &x, &y);
ddisplay_transform_coords(ddisp, horiz_pos + length, vert_pos, &to_x, &y);
-
+
irenderer->draw_pixel_line(renderer,
x, y, to_x, y,
&ddisp->diagram->grid.colour);
horiz_pos += 3 * length;
}
-
+
vert_pos += sqrt(3) * length;
}
@@ -202,13 +200,13 @@ grid_draw_hex(DDisplay *ddisp, Rectangle *update, real length)
while (horiz_pos <= update->right) {
ddisplay_transform_coords(ddisp, horiz_pos, vert_pos, &x, &y);
ddisplay_transform_coords(ddisp, horiz_pos+length, vert_pos, &to_x, &y);
-
+
irenderer->draw_pixel_line(renderer,
x, y, to_x, y,
&ddisp->diagram->grid.colour);
horiz_pos += 3 * length;
}
-
+
vert_pos += sqrt(3) * length;
}
@@ -219,20 +217,20 @@ grid_draw_hex(DDisplay *ddisp, Rectangle *update, real length)
while (horiz_pos <= update->right) {
ddisplay_transform_coords(ddisp, horiz_pos + length, vert_pos, &x, &y);
ddisplay_transform_coords(ddisp, horiz_pos + 1.5 * length, vert_pos + length * sqrt(3) * 0.5, &to_x,
&to_y);
-
+
irenderer->draw_pixel_line(renderer,
x, y, to_x, to_y,
&ddisp->diagram->grid.colour);
ddisplay_transform_coords(ddisp, horiz_pos, vert_pos, &x, &y);
ddisplay_transform_coords(ddisp, horiz_pos - 0.5 * length, vert_pos + length * sqrt(3) * 0.5, &to_x,
&to_y);
-
+
irenderer->draw_pixel_line(renderer,
x, y, to_x, to_y,
&ddisp->diagram->grid.colour);
horiz_pos += 3 * length;
}
-
+
vert_pos += sqrt(3) * length;
}
@@ -243,14 +241,14 @@ grid_draw_hex(DDisplay *ddisp, Rectangle *update, real length)
while (horiz_pos <= update->right) {
ddisplay_transform_coords(ddisp, horiz_pos, vert_pos, &x, &y);
ddisplay_transform_coords(ddisp, horiz_pos - 0.5 * length, vert_pos + 0.5 * sqrt(3) * length, &to_x,
&to_y);
-
+
irenderer->draw_pixel_line(renderer,
x, y, to_x, to_y,
&ddisp->diagram->grid.colour);
ddisplay_transform_coords(ddisp, horiz_pos + length, vert_pos, &x, &y);
ddisplay_transform_coords(ddisp, horiz_pos + 1.5 * length, vert_pos + 0.5 * sqrt(3) * length, &to_x,
&to_y);
-
+
irenderer->draw_pixel_line(renderer,
x, y, to_x, to_y,
&ddisp->diagram->grid.colour);
@@ -283,7 +281,7 @@ grid_draw(DDisplay *ddisp, Rectangle *update)
}
DIA_RENDERER_GET_CLASS(renderer)->set_linewidth(renderer, 0.0);
-
+
if (ddisp->diagram->grid.hex) {
grid_draw_hex(ddisp, update, width_w);
} else {
@@ -306,7 +304,7 @@ pagebreak_draw(DDisplay *ddisp, Rectangle *update)
int width = dia_renderer_get_width_pixels(ddisp->renderer);
int height = dia_renderer_get_height_pixels(ddisp->renderer);
-
+
irenderer = DIA_GET_INTERACTIVE_RENDERER_INTERFACE (renderer);
if (prefs.pagebreak.visible) {
Diagram *dia = ddisp->diagram;
diff --git a/app/layer_dialog.c b/app/layer_dialog.c
index 359db1ef..d957186a 100644
--- a/app/layer_dialog.c
+++ b/app/layer_dialog.c
@@ -22,9 +22,7 @@
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <string.h>
diff --git a/app/menus.c b/app/menus.c
index 8b690134..7401b3d9 100644
--- a/app/menus.c
+++ b/app/menus.c
@@ -17,9 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
diff --git a/app/object_ops.c b/app/object_ops.c
index 3d4f0497..952eb83c 100644
--- a/app/object_ops.c
+++ b/app/object_ops.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <stdlib.h>
@@ -58,12 +56,12 @@ void
object_add_updates_list(GList *list, Diagram *dia)
{
DiaObject *obj;
-
+
while (list != NULL) {
obj = (DiaObject *)list->data;
object_add_updates(obj, dia);
-
+
list = g_list_next(list);
}
}
@@ -78,7 +76,7 @@ object_add_updates_list(GList *list, Diagram *dia)
* in this call (anded to the display-wide setting).
*/
ConnectionPoint *
-object_find_connectpoint_display(DDisplay *ddisp, Point *pos,
+object_find_connectpoint_display(DDisplay *ddisp, Point *pos,
DiaObject *notthis, gboolean snap_to_objects)
{
real distance;
@@ -87,7 +85,7 @@ object_find_connectpoint_display(DDisplay *ddisp, Point *pos,
DiaObject *obj_here;
distance =
- diagram_find_closest_connectionpoint(ddisp->diagram, &connectionpoint,
+ diagram_find_closest_connectionpoint(ddisp->diagram, &connectionpoint,
pos, notthis);
distance = ddisplay_transform_length(ddisp, distance);
@@ -130,7 +128,7 @@ object_connect_display(DDisplay *ddisp, DiaObject *obj, Handle *handle,
if (handle->connected_to == NULL) {
connectionpoint = object_find_connectpoint_display(ddisp, &handle->pos,
obj, snap_to_objects);
-
+
if (connectionpoint != NULL) {
Change *change = undo_connect(ddisp->diagram, obj, handle,
connectionpoint);
@@ -153,7 +151,7 @@ object_list_corner(GList *list)
p.y = obj->bounding_box.top;
list = g_list_next(list);
-
+
while (list != NULL) {
obj = (DiaObject *)list->data;
@@ -161,7 +159,7 @@ object_list_corner(GList *list)
p.x = obj->bounding_box.left;
if (p.y > obj->bounding_box.top)
p.y = obj->bounding_box.top;
-
+
list = g_list_next(list);
}
@@ -199,7 +197,7 @@ filter_connected (const GList *objects,
GList **unconnected)
{
const GList *list;
-
+
for (list = objects; list != NULL; list = g_list_next (list)) {
DiaObject *obj = list->data;
gboolean is_connected = 0;
@@ -319,7 +317,7 @@ object_list_align_v(GList *objects, Diagram *dia, int align)
default:
message_warning("Wrong argument to object_list_align_v()\n");
}
-
+
dest_pos = g_new(Point, nobjs);
orig_pos = g_new(Point, nobjs);
@@ -329,7 +327,7 @@ object_list_align_v(GList *objects, Diagram *dia, int align)
obj = (DiaObject *) list->data;
pos.x = obj->position.x;
-
+
switch (align) {
case DIA_ALIGN_TOP: /* TOP */
pos.y = y_pos + obj->position.y - obj->bounding_box.top;
@@ -357,20 +355,20 @@ object_list_align_v(GList *objects, Diagram *dia, int align)
orig_pos[i] = obj->position;
dest_pos[i] = pos;
-
+
obj->ops->move(obj, &pos);
i++;
list = g_list_next(list);
}
-
+
undo_move_objects(dia, orig_pos, dest_pos, g_list_copy(objects));
g_list_free (unconnected);
}
static int
-object_list_sort_horizontal(const void *o1, const void *o2)
+object_list_sort_horizontal(const void *o1, const void *o2)
{
DiaObject *obj1 = *(DiaObject **)o1;
DiaObject *obj2 = *(DiaObject **)o2;
@@ -509,9 +507,9 @@ object_list_align_h(GList *objects, Diagram *dia, int align)
x_pos += obj->bounding_box.right - obj->bounding_box.left;
break;
}
-
+
pos.y = obj->position.y;
-
+
orig_pos[i] = obj->position;
dest_pos[i] = pos;
@@ -520,8 +518,8 @@ object_list_align_h(GList *objects, Diagram *dia, int align)
i++;
list = g_list_next(list);
}
-
- undo_move_objects(dia, orig_pos, dest_pos, g_list_copy(objects));
+
+ undo_move_objects(dia, orig_pos, dest_pos, g_list_copy(objects));
g_list_free (unconnected);
}
@@ -565,7 +563,7 @@ object_list_align_connected (GList *objects, Diagram *dia, int align)
/* for every connection check:
* - "matching" directions of both object connection points (this also gives
* the direction of the move of the second object)
- * -
+ * -
* - move every object only once
*/
nobjs = g_list_length (to_be_moved);
@@ -655,7 +653,7 @@ object_list_align_connected (GList *objects, Diagram *dia, int align)
}
}
}
-
+
list = g_list_next (list);
}
@@ -701,7 +699,7 @@ object_list_nudge(GList *objects, Diagram *dia, Direction dir, real step)
list = objects;
while (list != NULL) {
obj = (DiaObject *) list->data;
-
+
orig_pos[i] = obj->position;
dest_pos[i].x = orig_pos[i].x + inc_x;
dest_pos[i].y = orig_pos[i].y + inc_y;
diff --git a/app/pagesetup.c b/app/pagesetup.c
index 0a6ed2ac..8b76f424 100644
--- a/app/pagesetup.c
+++ b/app/pagesetup.c
@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <gtk/gtk.h>
@@ -44,13 +42,13 @@ static void pagesetup_changed (GtkWidget *wid, PageSetup *ps);
static void pagesetup_apply (GtkWidget *wid, PageSetup *ps);
static gint
-pagesetup_respond(GtkWidget *widget,
+pagesetup_respond(GtkWidget *widget,
gint response_id,
gpointer data)
{
PageSetup *ps = (PageSetup *)data;
- if ( response_id == GTK_RESPONSE_APPLY
+ if ( response_id == GTK_RESPONSE_APPLY
|| response_id == GTK_RESPONSE_OK) {
if (ps->changed)
pagesetup_apply(widget, ps);
@@ -181,7 +179,7 @@ pagesetup_apply(GtkWidget *wid, PageSetup *ps)
&ps->dia->data->paper.bmargin,
&ps->dia->data->paper.lmargin,
&ps->dia->data->paper.rmargin);
-
+
ps->dia->data->paper.is_portrait =
dia_page_layout_get_orientation(DIA_PAGE_LAYOUT(ps->paper)) ==
DIA_PAGE_ORIENT_PORTRAIT;
@@ -202,7 +200,7 @@ pagesetup_apply(GtkWidget *wid, PageSetup *ps)
gtk_dialog_set_response_sensitive(GTK_DIALOG(ps->window), GTK_RESPONSE_APPLY, FALSE);
ps->changed = FALSE;
-
+
/* update diagram -- this is needed to reposition page boundaries */
diagram_set_modified(ps->dia, TRUE);
diagram_add_update_all(ps->dia);
diff --git a/app/plugin-manager.c b/app/plugin-manager.c
index d9000f70..0de8fdab 100644
--- a/app/plugin-manager.c
+++ b/app/plugin-manager.c
@@ -5,7 +5,7 @@
* Copyright (C) 2000 James Henstridge
* almost complete rewrite for gtk2
* Copyright (C) 2002 Hans Breuer
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -21,9 +21,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
#include <string.h>
@@ -72,9 +70,9 @@ toggle_loaded_callback (GtkCellRendererToggle *celltoggle,
}
gtk_tree_path_free (path);
- gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
LOADED_COLUMN, &loaded, -1);
- gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
PLUGIN_COLUMN, &info, -1);
if (loaded && dia_plugin_can_unload(info))
@@ -89,7 +87,7 @@ toggle_loaded_callback (GtkCellRendererToggle *celltoggle,
}
else
message_notice("Can't unload plugin '%s'!", dia_plugin_get_name(info));
- gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
LOADED_COLUMN, loaded, -1);
}
@@ -103,13 +101,13 @@ can_unload (GtkTreeViewColumn *tree_column,
PluginInfo *info;
gboolean loaded;
- gtk_tree_model_get(tree_model, iter,
+ gtk_tree_model_get(tree_model, iter,
PLUGIN_COLUMN, &info, -1);
- gtk_tree_model_get(tree_model, iter,
+ gtk_tree_model_get(tree_model, iter,
LOADED_COLUMN, &loaded, -1);
if (!loaded || (loaded && dia_plugin_can_unload(info)))
{
- g_object_set (cell,
+ g_object_set (cell,
"mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE,
"activatable", TRUE,
NULL);
@@ -142,9 +140,9 @@ toggle_autoload_callback (GtkCellRendererToggle *celltoggle,
}
gtk_tree_path_free (path);
- gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
AUTOLOAD_COLUMN, &load, -1);
- gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
PLUGIN_COLUMN, &info, -1);
/* Disabling 'Standard' is fatal at next startup, while
@@ -156,7 +154,7 @@ toggle_autoload_callback (GtkCellRendererToggle *celltoggle,
"of plugin '%s'!", dia_plugin_get_name(info));
else {
dia_plugin_set_inhibit_load(info, load);
- gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter,
AUTOLOAD_COLUMN, !load, -1);
}
}
@@ -170,7 +168,7 @@ can_inhibit (GtkTreeViewColumn *tree_column,
{
PluginInfo *info;
- gtk_tree_model_get(tree_model, iter,
+ gtk_tree_model_get(tree_model, iter,
PLUGIN_COLUMN, &info, -1);
if ( 0 == strcmp(dia_plugin_get_name(info), "Standard")
|| 0 == strcmp(dia_plugin_get_name(info), "Internal"))
@@ -182,7 +180,7 @@ can_inhibit (GtkTreeViewColumn *tree_column,
}
else
{
- g_object_set (cell,
+ g_object_set (cell,
"mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE,
"activatable", TRUE,
NULL);
@@ -231,8 +229,8 @@ get_plugin_manager(void)
/* create the TreeStore */
store = gtk_list_store_new (NUM_COLUMNS,
- G_TYPE_BOOLEAN,
- G_TYPE_STRING,
+ G_TYPE_BOOLEAN,
+ G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_BOOLEAN,
diff --git a/app/properties-dialog.c b/app/properties-dialog.c
index a9adc70a..d9a0fd8e 100644
--- a/app/properties-dialog.c
+++ b/app/properties-dialog.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <string.h>
diff --git a/app/recent_files.c b/app/recent_files.c
index d8a5e0cd..d51c6e1f 100644
--- a/app/recent_files.c
+++ b/app/recent_files.c
@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <gdk/gdkkeysyms.h>
@@ -52,7 +50,7 @@ recent_file_history_clear_menu()
menus_clear_recent ();
}
-/**
+/**
* Build and insert the recent files menu.
*/
static void
@@ -70,8 +68,8 @@ recent_file_history_make_menu()
group = gtk_action_group_new ("recent-files");
gtk_action_group_set_translation_domain (group, NULL);
- for (i = 0;
- items != NULL && i < prefs.recent_documents_list_size;
+ for (i = 0;
+ items != NULL && i < prefs.recent_documents_list_size;
items = g_list_next(items), i++) {
gchar *name = g_strdup_printf ("FileRecent_%d", i);
@@ -81,10 +79,10 @@ recent_file_history_make_menu()
gchar *label = g_strdup_printf ("_%d. %s", i + 1, file_escaped);
gchar *accel = g_strdup_printf ("<control>%d", i + 1);
- action = gtk_action_new (name, label,
+ action = gtk_action_new (name, label,
(const gchar *) items->data,
NULL);
- g_signal_connect (G_OBJECT (action), "activate",
+ g_signal_connect (G_OBJECT (action), "activate",
G_CALLBACK (open_recent_file_callback),
items->data);
@@ -113,16 +111,16 @@ recent_file_history_add(const char *fname)
persistent_list_add("recent-files", filename);
g_free(absname);
g_free(filename);
-
+
recent_file_history_make_menu();
}
/* load the recent file history */
void
-recent_file_history_init()
+recent_file_history_init()
{
prefs.recent_documents_list_size = CLAMP(prefs.recent_documents_list_size, 0, 16);
-
+
persistence_register_list("recent-files");
recent_file_history_make_menu();
@@ -131,11 +129,11 @@ recent_file_history_init()
/* remove a broken file from the history and update menu accordingly
* Xing Wang, 2002.06 */
void
-recent_file_history_remove (const char *fname)
+recent_file_history_remove (const char *fname)
{
gchar *absname = dia_get_absolute_filename(fname);
gchar *filename = g_filename_to_utf8(absname, -1, NULL, NULL, NULL);
-
+
recent_file_history_clear_menu();
persistent_list_remove("recent-files", filename);
@@ -144,7 +142,7 @@ recent_file_history_remove (const char *fname)
recent_file_history_make_menu();
}
-
+
static void
open_recent_file_callback(GtkWidget *widget, gpointer data)
{
diff --git a/app/sheets_dialog.c b/app/sheets_dialog.c
index e018e9ae..be437e88 100644
--- a/app/sheets_dialog.c
+++ b/app/sheets_dialog.c
@@ -26,9 +26,7 @@
* for accelerated buttons.
*/
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/app/sheets_dialog_callbacks.c b/app/sheets_dialog_callbacks.c
index b21042ae..06397d2f 100644
--- a/app/sheets_dialog_callbacks.c
+++ b/app/sheets_dialog_callbacks.c
@@ -21,9 +21,7 @@
*
*/
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
#include <errno.h>
#include <string.h>
@@ -84,12 +82,12 @@ on_sheets_main_dialog_delete_event (GtkWidget *widget,
gpointer user_data)
{
sheets_dialog_hide();
- return TRUE;
+ return TRUE;
}
static void
-sheets_dialog_up_down_set_sensitive(GList *wrapbox_button_list,
+sheets_dialog_up_down_set_sensitive(GList *wrapbox_button_list,
GtkToggleButton *togglebutton)
{
GtkWidget *button;
@@ -302,10 +300,10 @@ sheets_dialog_object_set_tooltip(SheetObjectMod *som, GtkWidget *button)
case OBJECT_TYPE_SVG:
tip = g_strdup_printf(_("%s\nShape"), som->sheet_object.description);
break;
- case OBJECT_TYPE_PROGRAMMED:
+ case OBJECT_TYPE_PROGRAMMED:
tip = g_strdup_printf(_("%s\nObject"), som->sheet_object.description);
break;
- default:
+ default:
tip = g_strdup_printf(_("%s\nUnassigned type"), som->sheet_object.description);
break;
}
@@ -358,7 +356,7 @@ on_sheets_dialog_optionmenu_activate (GtkMenuItem *menuitem,
GList *button_list;
sheet = &(((SheetMod *)(user_data))->sheet);
-
+
wrapbox = g_object_get_data(G_OBJECT(menuitem), "wrapbox");
g_assert(wrapbox);
@@ -414,7 +412,7 @@ on_sheets_dialog_optionmenu_activate (GtkMenuItem *menuitem,
sheets_dialog_wrapbox_add_line_break(wrapbox);
button = sheets_dialog_create_object_button(som, user_data, wrapbox);
-
+
gtk_wrap_box_pack_wrapped(GTK_WRAP_BOX(wrapbox), button,
FALSE, TRUE, FALSE, TRUE, som->sheet_object.line_break);
@@ -456,14 +454,14 @@ SheetsDialogMoveDir;
SHEETS_DIALOG_MOVE_NONE SHEETS_DIALOG_MOVE_UP
static void
-_gtk_wrap_box_set_child_forced_break (GtkWrapBox* box, GtkWidget* child,
+_gtk_wrap_box_set_child_forced_break (GtkWrapBox* box, GtkWidget* child,
gboolean wrapped)
{
gboolean hexpand, hfill, vexpand, vfill, dummy;
- gtk_wrap_box_query_child_packing (box, child, &hexpand, &hfill,
+ gtk_wrap_box_query_child_packing (box, child, &hexpand, &hfill,
&vexpand, &vfill, &dummy);
- gtk_wrap_box_set_child_packing (box, child, hexpand, hfill,
+ gtk_wrap_box_set_child_packing (box, child, hexpand, hfill,
vexpand, vfill, wrapped);
}
static void
@@ -608,12 +606,12 @@ sheets_dialog_move_up_or_down(SheetsDialogMoveDir dir)
som_next = g_object_get_data(G_OBJECT(next_button_list->data),
"sheet_object_mod");
else
- som_next = NULL; /* either 1) no button after 'active_button'
+ som_next = NULL; /* either 1) no button after 'active_button'
or 2) button after 'active_button' is line break */
/* This is all a little hairy, but the idea is that we don't need
to reorder the backing store if the button was moved to the other
- side of a line break button since a line break button doesn't
+ side of a line break button since a line break button doesn't
exist in the backing store. Starting to look a little like lisp... */
if (som && (((dir == SHEETS_DIALOG_MOVE_DOWN)
@@ -630,7 +628,7 @@ sheets_dialog_move_up_or_down(SheetsDialogMoveDir dir)
sm = g_object_get_data(G_OBJECT(active_button), "sheet_mod");
if (sm->mod == SHEETMOD_MOD_NONE)
sm->mod = SHEETMOD_MOD_CHANGED;
-
+
object_list = g_slist_find(sm->sheet.objects, som);
g_assert(object_list);
@@ -668,7 +666,7 @@ on_sheets_dialog_button_close_clicked (GtkButton *button,
static GtkWidget *sheets_new_dialog;
-typedef enum
+typedef enum
{
SHEETS_NEW_DIALOG_TYPE_SVG_SHAPE = 1, /* allows g_assert() */
SHEETS_NEW_DIALOG_TYPE_LINE_BREAK,
@@ -782,7 +780,7 @@ on_sheets_new_dialog_button_ok_clicked (GtkButton *button,
if (g_stat(file_name, &stat_buf) == -1)
{
- message_error(_("Error examining %s: %s"),
+ message_error(_("Error examining %s: %s"),
dia_message_filename(file_name), strerror(errno));
g_free(file_name);
return;
@@ -794,7 +792,7 @@ on_sheets_new_dialog_button_ok_clicked (GtkButton *button,
{
PluginInfo *info = plugin_list->data;
- custom_object_load_fn =
+ custom_object_load_fn =
(CustomObjectLoadFunc)dia_plugin_get_symbol (info, "custom_object_load");
if (custom_object_load_fn)
break;
@@ -805,8 +803,8 @@ on_sheets_new_dialog_button_ok_clicked (GtkButton *button,
{
xmlDoc *doc = NULL;
xmlNode *root_element = NULL;
-
- /* See if the user tries to open a diagram as a shape */
+
+ /* See if the user tries to open a diagram as a shape */
doc = xmlReadFile(file_name, NULL, 0);
if(doc != NULL)
{
@@ -816,7 +814,7 @@ on_sheets_new_dialog_button_ok_clicked (GtkButton *button,
_("Please export the diagram as a shape."));
xmlFreeDoc(doc);
}
- message_error(_("Could not interpret shape file: '%s'"),
+ message_error(_("Could not interpret shape file: '%s'"),
dia_message_filename(file_name));
g_free(file_name);
return;
@@ -863,13 +861,13 @@ on_sheets_new_dialog_button_ok_clicked (GtkButton *button,
->data), TRUE);
gtk_wrap_box_reorder_child(GTK_WRAP_BOX(wrapbox),
g_list_last(button_list)->data, pos + 1);
-
+
sheets_dialog_normalize_line_breaks(wrapbox, SHEETS_DIALOG_MOVE_NONE);
sm = g_object_get_data(G_OBJECT(wrapbox), "sheet_mod");
if (sm->mod == SHEETMOD_MOD_NONE)
sm->mod = SHEETMOD_MOD_CHANGED;
-
+
g_list_free(button_list);
break;
@@ -983,13 +981,13 @@ on_sheets_dialog_button_edit_clicked (GtkButton *button,
descrip = som->sheet_object.description;
type = sheet_object_mod_get_type_string(som);
}
-
+
entry = lookup_widget(sheets_edit_dialog, "entry_object_description");
if (som)
gtk_entry_set_text(GTK_ENTRY(entry), descrip);
- else
+ else
gtk_widget_set_sensitive(entry, FALSE);
-
+
entry = lookup_widget(sheets_edit_dialog, "entry_object_type");
if (som)
gtk_entry_set_text(GTK_ENTRY(entry), type);
@@ -1049,7 +1047,7 @@ on_sheets_dialog_button_remove_clicked (GtkButton *button,
active_button = sheets_dialog_get_active_button(&wrapbox, &button_list);
g_assert(active_button);
-
+
/* Force a change in state in the radio button for set sensitive */
radio_button = lookup_widget(sheets_remove_dialog, "radiobutton_sheet");
@@ -1065,7 +1063,7 @@ on_sheets_dialog_button_remove_clicked (GtkButton *button,
else
{
SheetObjectMod *som;
-
+
som = g_object_get_data(G_OBJECT(active_button), "sheet_object_mod");
if (!som)
gtk_entry_set_text(GTK_ENTRY(entry), _("Line Break"));
@@ -1095,7 +1093,7 @@ on_sheets_dialog_button_remove_clicked (GtkButton *button,
gtk_widget_set_sensitive(entry, FALSE);
}
gtk_entry_set_text(GTK_ENTRY(entry), sm->sheet.name);
-
+
gtk_widget_show(sheets_remove_dialog);
}
@@ -1157,12 +1155,12 @@ on_sheets_new_dialog_radiobutton_sheet_toggled
{
"entry_sheet_name",
"entry_sheet_description",
- "label_description",
+ "label_description",
NULL
};
sheets_dialog_togglebutton_set_sensitive(togglebutton, sheets_new_dialog,
- widget_names,
+ widget_names,
SHEETS_NEW_DIALOG_TYPE_SHEET);
}
@@ -1254,7 +1252,7 @@ on_sheets_remove_dialog_button_ok_clicked
type = (SheetsRemoveDialogType)g_object_get_data(G_OBJECT(button),
"active_type");
-
+
active_button = sheets_dialog_get_active_button(&wrapbox, &button_list);
switch (type)
@@ -1266,7 +1264,7 @@ on_sheets_remove_dialog_button_ok_clicked
GtkWidget *optionmenu;
case SHEETS_REMOVE_DIALOG_TYPE_OBJECT:
-
+
som = g_object_get_data(G_OBJECT(active_button), "sheet_object_mod");
if (som)
{
@@ -1281,7 +1279,7 @@ on_sheets_remove_dialog_button_ok_clicked
sheets_dialog_normalize_line_breaks(wrapbox, SHEETS_DIALOG_MOVE_NONE);
break;
-
+
case SHEETS_REMOVE_DIALOG_TYPE_SHEET:
sm = g_object_get_data(G_OBJECT(active_button), "sheet_mod");
@@ -1330,7 +1328,7 @@ on_sheets_edit_dialog_button_ok_clicked
SheetObjectMod *som;
som = g_object_get_data(G_OBJECT(active_button), "sheet_object_mod");
- som->sheet_object.description =
+ som->sheet_object.description =
gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1);
sheets_dialog_object_set_tooltip(som, active_button);
@@ -1339,7 +1337,7 @@ on_sheets_edit_dialog_button_ok_clicked
sm = g_object_get_data(G_OBJECT(active_button), "sheet_mod");
if (sm->mod == SHEETMOD_MOD_NONE)
sm->mod = SHEETMOD_MOD_CHANGED;
-
+
something_changed = TRUE;
}
@@ -1349,17 +1347,17 @@ on_sheets_edit_dialog_button_ok_clicked
SheetMod *sm;
sm = g_object_get_data(G_OBJECT(active_button), "sheet_mod");
- sm->sheet.description =
+ sm->sheet.description =
gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1);
if (sm->mod == SHEETMOD_MOD_NONE)
sm->mod = SHEETMOD_MOD_CHANGED;
something_changed = TRUE;
}
-
+
#ifdef CAN_EDIT_SHEET_NAME
/* This must be last because we reload the sheets if changed */
-
+
entry = lookup_widget(sheets_edit_dialog, "entry_sheet_name");
if ((gboolean)g_object_get_data(G_OBJECT(entry), "changed") == TRUE)
{
@@ -1376,7 +1374,7 @@ on_sheets_edit_dialog_button_ok_clicked
optionmenu = g_object_get_data(G_OBJECT(table_sheets),
"active_optionmenu");
sheets_optionmenu_create(optionmenu, wrapbox, NULL);
-
+
something_changed = TRUE;
}
#endif
@@ -1560,7 +1558,7 @@ on_sheets_dialog_button_move_all_clicked
/* MCNFIXME: do we have to resanitize the radio_group? */
}
-
+
/* Force the 1st button in the target wrapbox to be active after moving */
button_list = gtk_container_get_children(GTK_CONTAINER(target_wrapbox));
@@ -1576,14 +1574,14 @@ copy_file(gchar *src, gchar *dst)
if ((fp_src = g_fopen(src, "rb")) == NULL)
{
- message_error(_("Couldn't open '%s': %s"),
+ message_error(_("Couldn't open '%s': %s"),
dia_message_filename(src), strerror(errno));
return FALSE;
}
-
+
if ((fp_dst = g_fopen(dst, "wb")) == NULL)
{
- message_error(_("Couldn't open '%s': %s"),
+ message_error(_("Couldn't open '%s': %s"),
dia_message_filename(dst), strerror(errno));
return FALSE;
}
@@ -1615,7 +1613,7 @@ write_user_sheet(Sheet *sheet)
gchar *filename;
SheetObject *sheetobject;
GSList *sheet_objects;
-
+
dir_user_sheets = dia_config_filename("sheets");
if (!*(sheet->filename)) {
gchar *basename;
@@ -1634,10 +1632,10 @@ write_user_sheet(Sheet *sheet)
g_free(basename);
}
file = g_fopen(filename, "w");
-
+
if (file==NULL)
{
- message_error(_("Couldn't open: '%s' for writing"),
+ message_error(_("Couldn't open: '%s' for writing"),
dia_message_filename(filename));
g_free(filename);
return FALSE;
@@ -1688,7 +1686,7 @@ write_user_sheet(Sheet *sheet)
xmlAddChild(node, xmlNewText((const xmlChar *)"\n"));
/* objects */
- for (sheet_objects = sheet->objects; sheet_objects;
+ for (sheet_objects = sheet->objects; sheet_objects;
sheet_objects = g_slist_next(sheet_objects))
{
SheetObjectMod *som;
@@ -1700,7 +1698,7 @@ write_user_sheet(Sheet *sheet)
/* If its a new shape, then copy the .shape and .xpm files from
their current location to ~/.dia/shapes/ */
-
+
if (som->mod == SHEET_OBJECT_MOD_NEW)
{
gchar *dia_user_shapes;
@@ -1727,9 +1725,9 @@ write_user_sheet(Sheet *sheet)
sheetobject = &som->sheet_object;
object_node = xmlNewChild(node, NULL, (const xmlChar *)"object", NULL);
-
+
xmlSetProp(object_node, (const xmlChar *)"name", (xmlChar *)sheetobject->object_type);
-
+
if (sheetobject->user_data_type == USER_DATA_IS_INTDATA)
{
gchar *user_data;
@@ -1738,7 +1736,7 @@ write_user_sheet(Sheet *sheet)
xmlSetProp(object_node, (const xmlChar *)"intdata", (xmlChar *) user_data);
g_free(user_data);
}
-
+
xmlAddChild(object_node, xmlNewText((const xmlChar *)"\n"));
desc_node = xmlNewChild(object_node, NULL, (const xmlChar *)"description", NULL);
xmlAddChild(desc_node, xmlNewText((xmlChar *) sheetobject->description));
@@ -1760,7 +1758,7 @@ write_user_sheet(Sheet *sheet)
if(g_str_has_prefix(icon, canonical_user_sheets))
icon += strlen(canonical_user_sheets) + 1;
if(g_str_has_prefix(icon, canonical_sheets))
- icon += strlen(canonical_sheets) + 1;
+ icon += strlen(canonical_sheets) + 1;
xmlAddChild(icon_node, xmlNewText((xmlChar *) icon));
xmlAddChild(object_node, xmlNewText((const xmlChar *)"\n"));
g_free(canonical_icon);
@@ -1841,7 +1839,7 @@ on_sheets_dialog_button_apply_clicked (GtkButton *button,
sheet_append_sheet_obj(new_sheet, new_object);
}
- dia_sort_sheets();
+ dia_sort_sheets();
fill_sheet_menu();
break;
diff --git a/lib/create.c b/lib/create.c
index 66bcc079..e7a1575f 100644
--- a/lib/create.c
+++ b/lib/create.c
@@ -20,12 +20,8 @@
* standard objects.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
-#include <string.h>
-#include <math.h>
#include <glib.h>
#include <stdlib.h>
@@ -56,7 +52,7 @@ create_standard_text(real xpos, real ypos) {
new_obj = otype->ops->create(&point, otype->default_user_data,
&h1, &h2);
-
+
return new_obj;
}
@@ -67,7 +63,7 @@ static PropDescription create_element_prop_descs[] = {
PROP_DESC_END};
static GPtrArray *make_element_props(real xpos, real ypos,
- real width, real height)
+ real width, real height)
{
GPtrArray *props;
PointProperty *pprop;
@@ -75,7 +71,7 @@ static GPtrArray *make_element_props(real xpos, real ypos,
props = prop_list_from_descs(create_element_prop_descs,pdtpp_true);
g_assert(props->len == 3);
-
+
pprop = g_ptr_array_index(props,0);
pprop->point_data.x = xpos;
pprop->point_data.y = ypos;
@@ -83,7 +79,7 @@ static GPtrArray *make_element_props(real xpos, real ypos,
rprop->real_data = width;
rprop = g_ptr_array_index(props,2);
rprop->real_data = height;
-
+
return props;
}
@@ -92,7 +88,7 @@ create_standard_ellipse(real xpos, real ypos, real width, real height) {
DiaObjectType *otype = object_get_type("Standard - Ellipse");
DiaObject *new_obj;
Handle *h1, *h2;
-
+
GPtrArray *props;
Point point;
@@ -106,7 +102,7 @@ create_standard_ellipse(real xpos, real ypos, real width, real height) {
new_obj = otype->ops->create(&point, otype->default_user_data,
&h1, &h2);
-
+
props = make_element_props(xpos,ypos,width,height);
new_obj->ops->set_props(new_obj, props);
prop_list_free(props);
@@ -133,7 +129,7 @@ create_standard_box(real xpos, real ypos, real width, real height) {
new_obj = otype->ops->create(&point, otype->default_user_data,
&h1, &h2);
-
+
props = make_element_props(xpos,ypos,width,height);
new_obj->ops->set_props(new_obj, props);
prop_list_free(props);
@@ -168,7 +164,7 @@ create_standard_zigzagline(int num_points, const Point *points,
props = prop_list_from_descs(create_line_prop_descs,pdtpp_true);
g_assert(props->len == 2);
-
+
if (start_arrow != NULL)
((ArrowProperty *)g_ptr_array_index(props, 0))->arrow_data = *start_arrow;
if (end_arrow != NULL)
@@ -176,12 +172,12 @@ create_standard_zigzagline(int num_points, const Point *points,
new_obj->ops->set_props(new_obj, props);
prop_list_free(props);
-
+
return new_obj;
}
DiaObject *
-create_standard_polyline(int num_points,
+create_standard_polyline(int num_points,
Point *points,
Arrow *end_arrow,
Arrow *start_arrow)
@@ -204,7 +200,7 @@ create_standard_polyline(int num_points,
props = prop_list_from_descs(create_line_prop_descs,pdtpp_true);
g_assert(props->len == 2);
-
+
if (start_arrow != NULL)
((ArrowProperty *)g_ptr_array_index(props, 0))->arrow_data = *start_arrow;
if (end_arrow != NULL)
@@ -212,12 +208,12 @@ create_standard_polyline(int num_points,
new_obj->ops->set_props(new_obj, props);
prop_list_free(props);
-
+
return new_obj;
}
DiaObject *
-create_standard_polygon(int num_points,
+create_standard_polygon(int num_points,
Point *points) {
DiaObjectType *otype = object_get_type("Standard - Polygon");
DiaObject *new_obj;
@@ -233,12 +229,12 @@ create_standard_polygon(int num_points,
pcd.points = points;
new_obj = otype->ops->create(NULL, &pcd, &h1, &h2);
-
+
return new_obj;
}
DiaObject *
-create_standard_bezierline(int num_points,
+create_standard_bezierline(int num_points,
BezPoint *points,
Arrow *end_arrow,
Arrow *start_arrow) {
@@ -260,7 +256,7 @@ create_standard_bezierline(int num_points,
props = prop_list_from_descs(create_line_prop_descs,pdtpp_true);
g_assert(props->len == 2);
-
+
if (start_arrow != NULL)
((ArrowProperty *)g_ptr_array_index(props, 0))->arrow_data = *start_arrow;
if (end_arrow != NULL)
@@ -268,12 +264,12 @@ create_standard_bezierline(int num_points,
new_obj->ops->set_props(new_obj, props);
prop_list_free(props);
-
+
return new_obj;
}
DiaObject *
-create_standard_beziergon(int num_points,
+create_standard_beziergon(int num_points,
BezPoint *points) {
DiaObjectType *otype = object_get_type("Standard - Beziergon");
DiaObject *new_obj;
@@ -289,7 +285,7 @@ create_standard_beziergon(int num_points,
bcd.points = points;
new_obj = otype->ops->create(NULL, &bcd, &h1, &h2);
-
+
return new_obj;
}
@@ -310,7 +306,7 @@ create_standard_path(int num_points, BezPoint *points)
bcd.points = points;
new_obj = otype->ops->create(NULL, &bcd, &h1, &h2);
-
+
return new_obj;
}
@@ -322,7 +318,7 @@ static PropDescription create_arc_prop_descs[] = {
DiaObject *
create_standard_arc(real x1, real y1, real x2, real y2,
- real distance,
+ real distance,
Arrow *end_arrow,
Arrow *start_arrow) {
DiaObjectType *otype = object_get_type("Standard - Arc");
@@ -347,7 +343,7 @@ create_standard_arc(real x1, real y1, real x2, real y2,
new_obj->ops->move_handle(new_obj, h2, &p2, NULL, HANDLE_MOVE_USER_FINAL,0);
props = prop_list_from_descs(create_arc_prop_descs,pdtpp_true);
g_assert(props->len == 3);
-
+
((RealProperty *)g_ptr_array_index(props,0))->real_data = distance;
if (start_arrow != NULL)
((ArrowProperty *)g_ptr_array_index(props, 1))->arrow_data = *start_arrow;
@@ -384,14 +380,14 @@ create_standard_image(real xpos, real ypos, real width, real height,
new_obj = otype->ops->create(&point, otype->default_user_data,
&h1, &h2);
-
+
props = make_element_props(xpos,ypos,width,height);
new_obj->ops->set_props(new_obj, props);
prop_list_free(props);
props = prop_list_from_descs(create_file_prop_descs,pdtpp_true);
- g_assert(props->len == 1);
+ g_assert(props->len == 1);
sprop = g_ptr_array_index(props,0);
g_free(sprop->string_data);
sprop->string_data = g_strdup(file);
diff --git a/lib/diagramdata.c b/lib/diagramdata.c
index d031f5d2..88d67bf2 100644
--- a/lib/diagramdata.c
+++ b/lib/diagramdata.c
@@ -20,9 +20,7 @@
* data global to a diagram.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include "intl.h"
#include "diagramdata.h"
@@ -81,7 +79,7 @@ diagram_data_get_type(void)
"DiagramData",
&object_info, 0);
}
-
+
return object_type;
}
@@ -111,17 +109,17 @@ diagram_data_init(DiagramData *data)
gboolean compress = persistence_register_boolean ("compress_save", TRUE);
Layer *first_layer;
- data->extents.left = 0.0;
- data->extents.right = 10.0;
- data->extents.top = 0.0;
- data->extents.bottom = 10.0;
-
+ data->extents.left = 0.0;
+ data->extents.right = 10.0;
+ data->extents.top = 0.0;
+ data->extents.bottom = 10.0;
+
data->bg_color = *color;
get_paper_info (&data->paper, -1, NULL);
first_layer = new_layer(g_strdup(_("Background")),data);
-
+
data->layers = g_ptr_array_new ();
g_ptr_array_add (data->layers, first_layer);
data->active_layer = first_layer;
@@ -130,7 +128,7 @@ diagram_data_init(DiagramData *data)
data->selected = NULL;
data->highlighted = NULL;
-
+
data->is_compressed = compress; /* Overridden by doc */
data->text_edits = NULL;
@@ -177,22 +175,22 @@ diagram_data_clone (DiagramData *data)
{
DiagramData *clone;
guint i;
-
+
clone = g_object_new (DIA_TYPE_DIAGRAM_DATA, NULL);
-
+
clone->extents = data->extents;
clone->bg_color = data->bg_color;
clone->paper = data->paper; /* so ugly */
clone->paper.name = g_strdup (data->paper.name);
clone->is_compressed = data->is_compressed;
-
+
layer_destroy(g_ptr_array_index(clone->layers, 0));
g_ptr_array_remove(clone->layers, clone->active_layer);
for (i=0; i < data->layers->len; ++i) {
Layer *src_layer = g_ptr_array_index(data->layers, i);
Layer *dest_layer = new_layer (layer_get_name (src_layer), clone);
-
+
/* copy layer, init the active one */
dest_layer->extents = src_layer->extents;
dest_layer->objects = object_copy_list (src_layer->objects);
@@ -201,11 +199,11 @@ diagram_data_clone (DiagramData *data)
g_ptr_array_add (clone->layers, dest_layer);
if (src_layer == data->active_layer)
clone->active_layer = dest_layer;
-
+
/* the rest should be initialized by construction */
}
- return clone;
+ return clone;
}
/*!
@@ -220,7 +218,7 @@ diagram_data_clone_selected (DiagramData *data)
GList *sorted;
clone = g_object_new (DIA_TYPE_DIAGRAM_DATA, NULL);
-
+
clone->extents = data->extents;
clone->bg_color = data->bg_color;
clone->paper = data->paper; /* so ugly */
@@ -237,9 +235,9 @@ diagram_data_clone_selected (DiagramData *data)
g_list_free (sorted);
dest_layer->visible = data->active_layer->visible;
dest_layer->connectable = data->active_layer->connectable;
-
+
data_update_extents (clone);
-
+
return clone;
}
@@ -260,11 +258,11 @@ diagram_data_class_init(DiagramDataClass *klass)
G_STRUCT_OFFSET (DiagramDataClass, object_add),
NULL, NULL,
dia_marshal_VOID__POINTER_POINTER,
- G_TYPE_NONE,
+ G_TYPE_NONE,
2,
G_TYPE_POINTER,
G_TYPE_POINTER);
-
+
diagram_data_signals[OBJECT_REMOVE] =
g_signal_new ("object_remove",
G_TYPE_FROM_CLASS (klass),
@@ -272,7 +270,7 @@ diagram_data_class_init(DiagramDataClass *klass)
G_STRUCT_OFFSET (DiagramDataClass, object_remove),
NULL, NULL,
dia_marshal_VOID__POINTER_POINTER,
- G_TYPE_NONE,
+ G_TYPE_NONE,
2,
G_TYPE_POINTER,
G_TYPE_POINTER);
@@ -305,7 +303,7 @@ data_raise_layer(DiagramData *data, Layer *layer)
guint i;
guint layer_nr = 0;
Layer *tmp;
-
+
for (i=0;i<data->layers->len;i++) {
if (g_ptr_array_index(data->layers, i)==layer)
layer_nr = i;
@@ -331,7 +329,7 @@ data_lower_layer(DiagramData *data, Layer *layer)
guint i;
int layer_nr = -1;
Layer *tmp;
-
+
for (i=0;i<data->layers->len;i++) {
if (g_ptr_array_index(data->layers, i)==layer)
layer_nr = i;
@@ -378,7 +376,7 @@ data_add_layer_at(DiagramData *data, Layer *layer, int pos)
{
int len;
int i;
-
+
g_ptr_array_add(data->layers, layer);
len = data->layers->len;
@@ -388,7 +386,7 @@ data_add_layer_at(DiagramData *data, Layer *layer, int pos)
}
g_ptr_array_index(data->layers, pos) = layer;
}
-
+
layer->parent_diagram = data;
data_emit (data, layer, NULL, "object_add");
layer_update_extents(layer);
@@ -409,7 +407,7 @@ data_layer_get_index (const DiagramData *data, const Layer *layer)
{
int len;
int i;
-
+
len = data->layers->len;
for (i=0;i<len;++i) {
if (layer == g_ptr_array_index(data->layers, i))
@@ -433,7 +431,7 @@ data_layer_get_nth (const DiagramData *data, guint index)
return g_ptr_array_index(data->layers, index);
return NULL;
}
-int
+int
data_layer_count(const DiagramData *data)
{
return data->layers->len;
@@ -490,7 +488,7 @@ find_object_highlight(GList *list, DiaObject *obj)
return NULL;
}
-void
+void
data_highlight_add(DiagramData *data, DiaObject *obj, DiaHighlightType type)
{
ObjectHighlight *oh;
@@ -502,7 +500,7 @@ data_highlight_add(DiagramData *data, DiaObject *obj, DiaHighlightType type)
data->highlighted = g_list_prepend(data->highlighted, oh);
}
-void
+void
data_highlight_remove(DiagramData *data, DiaObject *obj)
{
ObjectHighlight *oh;
@@ -512,7 +510,7 @@ data_highlight_remove(DiagramData *data, DiaObject *obj)
g_free(oh);
}
-DiaHighlightType
+DiaHighlightType
data_object_get_highlight(DiagramData *data, DiaObject *obj)
{
ObjectHighlight *oh;
@@ -606,9 +604,9 @@ data_get_layers_extents_union(DiagramData *data)
Rectangle new_extents;
for ( i = 0 ; i<data->layers->len; i++) {
- Layer *layer = g_ptr_array_index(data->layers, i);
+ Layer *layer = g_ptr_array_index(data->layers, i);
if (!layer->visible) continue;
-
+
layer_update_extents(layer);
if (first) {
@@ -639,7 +637,7 @@ data_adapt_scaling_to_extents(DiagramData *data)
(data->extents.right - data->extents.left);
gdouble yscale = data->paper.fitheight * pheight /
(data->extents.bottom - data->extents.top);
-
+
data->paper.scaling = (float)MIN(xscale, yscale);
data->paper.width = (float)(pwidth / data->paper.scaling);
data->paper.height = (float)(pheight / data->paper.scaling);
@@ -656,11 +654,11 @@ data_compute_extents(DiagramData *data)
{
Rectangle old_extents = data->extents;
- if (!data_has_visible_layers(data)) {
+ if (!data_has_visible_layers(data)) {
if (data->layers->len > 0) {
- Layer *layer = g_ptr_array_index(data->layers, 0);
+ Layer *layer = g_ptr_array_index(data->layers, 0);
layer_update_extents(layer);
-
+
data->extents = layer->extents;
} else {
data->extents = invalid_extents;
@@ -714,7 +712,7 @@ data_get_sorted_selected(DiagramData *data)
g_assert (g_list_length (data->selected) == data->selected_count_private);
if (data->selected_count_private == 0)
return NULL;
-
+
sorted_list = NULL;
list = g_list_last(data->active_layer->objects);
while (list != NULL) {
@@ -746,11 +744,11 @@ data_get_sorted_selected_remove(DiagramData *data)
GList *sorted_list;
GList *found;
DiaObject *obj;
-
+
g_assert (g_list_length (data->selected) == data->selected_count_private);
if (data->selected_count_private == 0)
return NULL;
-
+
sorted_list = NULL;
list = g_list_last(data->active_layer->objects);
while (list != NULL) {
@@ -780,17 +778,17 @@ data_get_sorted_selected_remove(DiagramData *data)
* @param signal_name The name of the signal.
* \memberof _DiagramData
*/
-void
-data_emit(DiagramData *data, Layer *layer, DiaObject* obj,
- const char *signal_name)
+void
+data_emit(DiagramData *data, Layer *layer, DiaObject* obj,
+ const char *signal_name)
{
/* check what signal it is */
if (strcmp("object_add",signal_name) == 0)
g_signal_emit(data, diagram_data_signals[OBJECT_ADD], 0, layer, obj);
-
+
if (strcmp("object_remove",signal_name) == 0)
g_signal_emit(data, diagram_data_signals[OBJECT_REMOVE], 0, layer, obj);
-
+
}
@@ -810,9 +808,9 @@ data_render(DiagramData *data, DiaRenderer *renderer, Rectangle *update,
Layer *layer;
guint i, active_layer;
- if (!renderer->is_interactive)
+ if (!renderer->is_interactive)
(DIA_RENDERER_GET_CLASS(renderer)->begin_render)(renderer, update);
-
+
for (i=0; i<data->layers->len; i++) {
layer = (Layer *) g_ptr_array_index(data->layers, i);
active_layer = (layer == data->active_layer);
@@ -823,8 +821,8 @@ data_render(DiagramData *data, DiaRenderer *renderer, Rectangle *update,
(DIA_RENDERER_GET_CLASS(renderer)->draw_layer)(renderer, layer, active_layer, update);
}
}
-
- if (!renderer->is_interactive)
+
+ if (!renderer->is_interactive)
(DIA_RENDERER_GET_CLASS(renderer)->end_render)(renderer);
}
@@ -885,7 +883,7 @@ data_render_paginated (DiagramData *data, DiaRenderer *renderer, gpointer user_d
* @param user_data data passed to the callback function
* \memberof _DiagramData
*/
-void
+void
data_foreach_object (DiagramData *data, GFunc func, gpointer user_data)
{
Layer *layer;
@@ -893,5 +891,5 @@ data_foreach_object (DiagramData *data, GFunc func, gpointer user_data)
for (i=0; i<data->layers->len; i++) {
layer = (Layer *) g_ptr_array_index(data->layers, i);
g_list_foreach (layer->objects, func, user_data);
- }
+ }
}
diff --git a/lib/dialinechooser.c b/lib/dialinechooser.c
index 5ccb2796..65c4012a 100644
--- a/lib/dialinechooser.c
+++ b/lib/dialinechooser.c
@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include "intl.h"
#include "widgets.h"
diff --git a/lib/dialogs.c b/lib/dialogs.c
index 1f2cc368..3e73a828 100644
--- a/lib/dialogs.c
+++ b/lib/dialogs.c
@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include "intl.h"
#include <gtk/gtk.h>
@@ -51,9 +49,9 @@ dialog_make(char *title, char *okay_text, char *cancel_text,
*okay_button = gtk_button_new_with_label((okay_text!=NULL?okay_text:_("OK")));
*cancel_button = gtk_button_new_with_label((cancel_text!=NULL?cancel_text:_("Cancel")));
- gtk_container_add(GTK_CONTAINER(gtk_dialog_get_action_area(GTK_DIALOG(dialog))),
+ gtk_container_add(GTK_CONTAINER(gtk_dialog_get_action_area(GTK_DIALOG(dialog))),
*okay_button);
- gtk_container_add(GTK_CONTAINER(gtk_dialog_get_action_area(GTK_DIALOG(dialog))),
+ gtk_container_add(GTK_CONTAINER(gtk_dialog_get_action_area(GTK_DIALOG(dialog))),
*cancel_button);
return dialog;
diff --git a/lib/filter.c b/lib/filter.c
index fc6644e7..4b69119f 100644
--- a/lib/filter.c
+++ b/lib/filter.c
@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include "filter.h"
#include "intl.h"
@@ -89,7 +87,7 @@ GList *
filter_get_unique_export_names(const char *ext)
{
GList *tmp, *res = NULL;
-
+
for (tmp = export_filters; tmp != NULL; tmp = tmp->next) {
DiaExportFilter *ef = tmp->data;
gint i;
@@ -105,18 +103,18 @@ filter_get_unique_export_names(const char *ext)
static GHashTable *_favored_hash = NULL;
/* Set the favorit 'guess' */
-void
+void
filter_set_favored_export(const char *ext, const char *name)
{
if (!_favored_hash)
_favored_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
-
+
g_hash_table_insert(_favored_hash, g_ascii_strdown(ext, -1), g_strdup(name));
}
-/* Guess the filter for a given filename.
+/* Guess the filter for a given filename.
* Returns the first filter found that matches the extension on the filename,
- * or NULL if none such are found.
+ * or NULL if none such are found.
* If there are multiple filters registered for the same extension some are
* excluded from being returned here by the hint FILTER_DONT_GUESS.
*/
@@ -134,7 +132,7 @@ filter_guess_export_filter(const gchar *filename)
ext++;
else
ext = "";
-
+
/* maybe ther is no need to guess? */
unique_name = _favored_hash ? g_hash_table_lookup(_favored_hash, ext) : NULL;
if (unique_name) {
@@ -164,7 +162,7 @@ filter_guess_export_filter(const gchar *filename)
/** Get an export filter by unique name.
*/
DiaExportFilter *
-filter_export_get_by_name(const gchar *name)
+filter_export_get_by_name(const gchar *name)
{
GList *tmp;
DiaExportFilter *filter = NULL;
@@ -173,7 +171,7 @@ filter_export_get_by_name(const gchar *name)
DiaExportFilter *ef = tmp->data;
if (ef->unique_name != NULL) {
if (!g_ascii_strcasecmp(ef->unique_name, name)) {
- if (filter)
+ if (filter)
g_warning(_("Multiple export filters with unique name %s"), name);
filter = ef;
}
@@ -182,7 +180,7 @@ filter_export_get_by_name(const gchar *name)
return filter;
}
DiaImportFilter *
-filter_import_get_by_name(const gchar *name)
+filter_import_get_by_name(const gchar *name)
{
GList *tmp;
DiaImportFilter *filter = NULL;
@@ -191,7 +189,7 @@ filter_import_get_by_name(const gchar *name)
DiaImportFilter *af = tmp->data;
if (af->unique_name != NULL) {
if (!g_ascii_strcasecmp(af->unique_name, name)) {
- if (filter)
+ if (filter)
g_warning(_("Multiple import filters with unique name %s"), name);
filter = af;
}
@@ -253,7 +251,7 @@ filter_get_import_filter_label(DiaImportFilter *ifilter)
return ret;
}
-/* guess the filter for a given filename.
+/* guess the filter for a given filename.
* If there are multiple filters registered for the same extension some are
* excluded from being returned here by the hint FILTER_DONT_GUESS.
*/
@@ -290,7 +288,7 @@ filter_guess_import_filter(const gchar *filename)
}
/* register a new callback from a plug-in */
-void
+void
filter_register_callback(DiaCallbackFilter *cbfilter)
{
/* sanity check */
diff --git a/lib/font-height.c b/lib/font-height.c
index d1593bf2..4efb58b0 100644
--- a/lib/font-height.c
+++ b/lib/font-height.c
@@ -18,9 +18,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <pango/pango.h>
#ifdef HAVE_FREETYPE
@@ -60,12 +58,12 @@ dump_font_sizes (PangoContext *context, FILE *f, guint flags)
PangoFontDescription *pfd;
int nf;
real height;
-
+
fprintf (f, "height/cm");
for (nf = 0; test_families[nf] != NULL; ++nf)
fprintf (f, "\t%s", test_families[nf]);
fprintf (f, "\n");
-
+
for (height = 0.1; height <= 10.0; height += 0.1) {
fprintf (f, "%g", height);
for (nf = 0; test_families[nf] != NULL; ++nf) {
@@ -76,12 +74,12 @@ dump_font_sizes (PangoContext *context, FILE *f, guint flags)
pango_font_description_set_absolute_size (pfd, height * pixels_per_cm * PANGO_SCALE);
else
pango_font_description_set_size (pfd, height * pixels_per_cm * PANGO_SCALE);
-
+
font = pango_context_load_font (context, pfd);
if (font) {
PangoFontMetrics *metrics = pango_font_get_metrics (font, NULL);
/* now make a font-size where the font/line-height matches the given pixel size */
- real total = ((double)pango_font_metrics_get_ascent (metrics)
+ real total = ((double)pango_font_metrics_get_ascent (metrics)
+ pango_font_metrics_get_descent (metrics)) / PANGO_SCALE;
real factor = height*pixels_per_cm/total;
real line_height;
@@ -92,11 +90,11 @@ dump_font_sizes (PangoContext *context, FILE *f, guint flags)
pango_font_description_set_size (pfd, factor * height * pixels_per_cm * PANGO_SCALE);
pango_font_metrics_unref (metrics);
g_object_unref (font);
-
+
font = pango_context_load_font (context, pfd);
metrics = pango_font_get_metrics (font, NULL);
- line_height = ((double)pango_font_metrics_get_ascent (metrics)
+ line_height = ((double)pango_font_metrics_get_ascent (metrics)
+ pango_font_metrics_get_descent (metrics)) / PANGO_SCALE;
fprintf (f, "\t%.3g", flags & DUMP_FACTORS ? factor : line_height);
g_object_unref (font);
@@ -107,13 +105,13 @@ dump_font_sizes (PangoContext *context, FILE *f, guint flags)
}
}
-int
+int
main (int argc, char **argv)
{
guint flags = DUMP_ABSOLUTE;
int i;
PangoContext *context;
-
+
for (i = 1; i < argc; ++i) {
if (strcmp (argv[i], "--factors") == 0)
flags |= DUMP_FACTORS;
diff --git a/lib/font.c b/lib/font.c
index fa3c75c6..fbce7955 100644
--- a/lib/font.c
+++ b/lib/font.c
@@ -1,7 +1,7 @@
/* Dia -- an diagram creation/manipulation program
* Copyright (C) 1998 Alexander Larsson
* Font code completely reworked for the Pango conversion
- * Copyright (C) 2002 Cyrille Chepelov
+ * Copyright (C) 2002 Cyrille Chepelov
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -18,9 +18,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <stdio.h>
#include <stdlib.h>
@@ -52,11 +50,11 @@ static PangoContext* pango_context = NULL;
* \brief Opaque type to represent a font
* \ingroup ObjectFonts
*/
-struct _DiaFont
+struct _DiaFont
{
GObject parent_instance;
- PangoFontDescription* pfd;
+ PangoFontDescription* pfd;
/* mutable */ char* legacy_name;
/* there is a difference between Pango's font size and Dia's font height */
@@ -77,7 +75,7 @@ struct _DiaFont
static real global_zoom_factor = 20.0;
static void
-dia_font_check_for_font(int font)
+dia_font_check_for_font(int font)
{
DiaFont *check;
PangoFont *loaded;
@@ -108,7 +106,7 @@ static GList *pango_contexts = NULL;
/*! DEPRECATED: there should be only one "measure context" */
void
-dia_font_push_context(PangoContext *pcontext)
+dia_font_push_context(PangoContext *pcontext)
{
pango_contexts = g_list_prepend(pango_contexts, pango_context);
pango_context = pcontext;
@@ -126,12 +124,12 @@ dia_font_pop_context() {
}
PangoContext *
-dia_font_get_context()
+dia_font_get_context()
{
if (pango_context == NULL) {
/* Maybe this one with pangocairo
dia_font_push_context (pango_cairo_font_map_create_context (pango_cairo_font_map_get_default()));
- * but it gives:
+ * but it gives:
(lt-dia:30476): Pango-CRITICAL **: pango_renderer_draw_layout: assertion `PANGO_IS_RENDERER (renderer)'
failed
*/
#ifdef HAVE_FREETYPE
@@ -192,7 +190,7 @@ dia_font_get_type (void)
object_type = g_type_register_static (G_TYPE_OBJECT,
"DiaFont",
&object_info, 0);
- }
+ }
return object_type;
}
static gpointer parent_class;
@@ -205,15 +203,15 @@ dia_font_class_init(DiaFontClass* klass)
object_class->finalize = dia_font_finalize;
}
-static void
+static void
dia_font_init_instance(DiaFont* font)
{
/*GObject *gobject = G_OBJECT(font); */
}
-static void
+static void
dia_pfd_set_height(PangoFontDescription* pfd, real height)
-{
+{
/* ONLY place for the magic factor! */
g_return_if_fail (height > 0.0);
pango_font_description_set_absolute_size(pfd, dcm_to_pdu(height) * 0.8);
@@ -222,14 +220,14 @@ dia_pfd_set_height(PangoFontDescription* pfd, real height)
/*!
* In Dia a font is usually referred to by it's (line-) height, not it's size.
*
- * This methods "calculates" the latter from the former. This used to be some magic factor of 0.7 which did
not
+ * This methods "calculates" the latter from the former. This used to be some magic factor of 0.7 which did
not
* solve the resolution dependencance of the former calculation. In fact there is new magic factor now
because
* really calculating the font size from the height would involve two font loads which seem to be two
expensive.
*/
static void
_dia_font_adjust_size (DiaFont *font, real height, gboolean recalc_alwways)
{
-
+
if (font->height != height || !font->metrics || recalc_alwways) {
PangoFont *loaded;
@@ -263,7 +261,7 @@ dia_font_new(const char *family, DiaFontStyle style, real height)
}
static void
-dia_pfd_set_family(PangoFontDescription* pfd, DiaFontFamily fam)
+dia_pfd_set_family(PangoFontDescription* pfd, DiaFontFamily fam)
{
switch (fam) {
case DIA_FONT_SANS :
@@ -283,7 +281,7 @@ dia_pfd_set_family(PangoFontDescription* pfd, DiaFontFamily fam)
}
static void
-dia_pfd_set_weight(PangoFontDescription* pfd, DiaFontWeight fw)
+dia_pfd_set_weight(PangoFontDescription* pfd, DiaFontWeight fw)
{
switch (fw) {
case DIA_FONT_ULTRALIGHT :
@@ -295,7 +293,7 @@ dia_pfd_set_weight(PangoFontDescription* pfd, DiaFontWeight fw)
case DIA_FONT_WEIGHT_NORMAL :
pango_font_description_set_weight(pfd, PANGO_WEIGHT_NORMAL);
break;
- case DIA_FONT_MEDIUM : /* Pango doesn't have this, but
+ case DIA_FONT_MEDIUM : /* Pango doesn't have this, but
'intermediate values are possible' */
pango_font_description_set_weight(pfd, 500);
break;
@@ -317,7 +315,7 @@ dia_pfd_set_weight(PangoFontDescription* pfd, DiaFontWeight fw)
}
static void
-dia_pfd_set_slant(PangoFontDescription* pfd, DiaFontSlant fo)
+dia_pfd_set_slant(PangoFontDescription* pfd, DiaFontSlant fo)
{
switch (fo) {
case DIA_FONT_NORMAL :
@@ -347,7 +345,7 @@ dia_font_new_from_style(DiaFontStyle style, real height)
dia_pfd_set_weight(pfd,DIA_FONT_STYLE_GET_WEIGHT(style));
dia_pfd_set_slant(pfd,DIA_FONT_STYLE_GET_SLANT(style));
dia_pfd_set_height(pfd,height);
-
+
retval = DIA_FONT(g_object_new(DIA_TYPE_FONT, NULL));
retval->pfd = pfd;
_dia_font_adjust_size (retval, height, FALSE);
@@ -357,7 +355,7 @@ dia_font_new_from_style(DiaFontStyle style, real height)
DiaFont* dia_font_copy(const DiaFont* font)
{
- if (!font)
+ if (!font)
return NULL;
return dia_font_new(dia_font_get_family(font),
dia_font_get_style(font),
@@ -368,14 +366,14 @@ void
dia_font_finalize(GObject* object)
{
DiaFont* font = DIA_FONT(object);
-
+
if (font->pfd)
pango_font_description_free(font->pfd);
font->pfd = NULL;
if (font->metrics)
pango_font_metrics_unref(font->metrics);
font->metrics = NULL;
- if (font->loaded)
+ if (font->loaded)
g_object_unref(font->loaded);
font->loaded = NULL;
G_OBJECT_CLASS(parent_class)->finalize(object);
@@ -388,13 +386,13 @@ dia_font_ref(DiaFont* font)
return font;
}
-void
+void
dia_font_unref(DiaFont* font)
-{
+{
g_object_unref(G_OBJECT(font));
}
-DiaFontStyle
+DiaFontStyle
dia_font_get_style(const DiaFont* font)
{
guint style;
@@ -409,7 +407,7 @@ dia_font_get_style(const DiaFont* font)
PangoStyle pango_style = pango_font_description_get_style(font->pfd);
PangoWeight pango_weight = pango_font_description_get_weight(font->pfd);
- g_assert(PANGO_WEIGHT_ULTRALIGHT <= pango_weight && pango_weight <= PANGO_WEIGHT_HEAVY);
+ g_assert(PANGO_WEIGHT_ULTRALIGHT <= pango_weight && pango_weight <= PANGO_WEIGHT_HEAVY);
g_assert(PANGO_WEIGHT_ULTRALIGHT == 200);
g_assert(PANGO_WEIGHT_NORMAL == 400);
g_assert(PANGO_WEIGHT_BOLD == 700);
@@ -472,17 +470,17 @@ dia_font_get_psfontname(const DiaFont *font)
return "NewCenturySchlbk-Bold";
else if (strcmp(fontname, "NewCenturySchoolbook-BoldItalic") == 0)
return "NewCenturySchlbk-BoldItalic";
-
+
return fontname;
}
-void
+void
dia_font_set_any_family(DiaFont* font, const char* family)
{
gboolean changed;
-
+
g_return_if_fail(font != NULL);
-
+
changed = strcmp (pango_font_description_get_family(font->pfd), family) != 0;
pango_font_description_set_family(font->pfd, family);
if (changed) /* force recalculation on name change */
@@ -493,42 +491,42 @@ dia_font_set_any_family(DiaFont* font, const char* family)
}
}
-void
+void
dia_font_set_family(DiaFont* font, DiaFontFamily family)
{
g_return_if_fail(font != NULL);
- dia_pfd_set_family(font->pfd,family);
+ dia_pfd_set_family(font->pfd,family);
if (font->legacy_name) {
g_free(font->legacy_name);
font->legacy_name = NULL;
}
}
-void
+void
dia_font_set_weight(DiaFont* font, DiaFontWeight weight)
{
DiaFontWeight old_weight = DIA_FONT_STYLE_GET_WEIGHT(dia_font_get_style(font));
- g_return_if_fail(font != NULL);
+ g_return_if_fail(font != NULL);
dia_pfd_set_weight(font->pfd,weight);
if (old_weight != weight)
_dia_font_adjust_size (font, font->height, TRUE);
}
-void
+void
dia_font_set_slant(DiaFont* font, DiaFontSlant slant)
{
DiaFontSlant old_slant = DIA_FONT_STYLE_GET_SLANT(dia_font_get_style(font));
- g_return_if_fail(font != NULL);
+ g_return_if_fail(font != NULL);
dia_pfd_set_slant(font->pfd,slant);
if (slant != old_slant)
_dia_font_adjust_size (font, font->height, TRUE);
}
-typedef struct _WeightName {
- DiaFontWeight fw;
- const char *name;
+typedef struct _WeightName {
+ DiaFontWeight fw;
+ const char *name;
} WeightName;
static const WeightName weight_names[] = {
{DIA_FONT_ULTRALIGHT, "200"},
@@ -548,15 +546,15 @@ dia_font_get_weight_string(const DiaFont* font)
{
const WeightName* p;
DiaFontWeight fw = DIA_FONT_STYLE_GET_WEIGHT(dia_font_get_style(font));
-
+
for (p = weight_names; p->name != NULL; ++p) {
if (p->fw == fw) return p->name;
}
return "normal";
}
-void
-dia_font_set_weight_from_string(DiaFont* font, const char* weight)
+void
+dia_font_set_weight_from_string(DiaFont* font, const char* weight)
{
DiaFontWeight fw = DIA_FONT_WEIGHT_NORMAL;
const WeightName* p;
@@ -572,15 +570,15 @@ dia_font_set_weight_from_string(DiaFont* font, const char* weight)
}
-typedef struct _SlantName {
- DiaFontSlant fo;
- const char *name;
+typedef struct _SlantName {
+ DiaFontSlant fo;
+ const char *name;
} SlantName;
static const SlantName slant_names[] = {
{ DIA_FONT_NORMAL, "normal" },
{ DIA_FONT_OBLIQUE, "oblique" },
{ DIA_FONT_ITALIC, "italic" },
- { 0, NULL}
+ { 0, NULL}
};
const char *
@@ -589,20 +587,20 @@ dia_font_get_slant_string(const DiaFont* font)
const SlantName* p;
DiaFontSlant fo =
DIA_FONT_STYLE_GET_SLANT(dia_font_get_style(font));
-
+
for (p = slant_names; p->name != NULL; ++p) {
- if (p->fo == fo)
+ if (p->fo == fo)
return p->name;
}
return "normal";
}
-void
-dia_font_set_slant_from_string(DiaFont* font, const char* obli)
+void
+dia_font_set_slant_from_string(DiaFont* font, const char* obli)
{
DiaFontSlant fo = DIA_FONT_NORMAL;
const SlantName* p;
-
+
for (p = slant_names; p->name != NULL; ++p) {
if (0 == strncmp(obli,p->name,8)) {
fo = p->fo;
@@ -644,7 +642,7 @@ dia_font_ascent(const char* string, DiaFont* font, real height)
}
}
-real
+real
dia_font_descent(const char* string, DiaFont* font, real height)
{
if (font->metrics) {
@@ -674,7 +672,7 @@ dia_font_build_layout(const char* string, DiaFont* font, real height)
length = string ? strlen(string) : 0;
pango_layout_set_text(layout, string, length);
-
+
list = pango_attr_list_new();
pfd = pango_font_description_copy (font->pfd);
@@ -687,14 +685,14 @@ dia_font_build_layout(const char* string, DiaFont* font, real height)
attr->start_index = 0;
attr->end_index = length;
pango_attr_list_insert(list,attr); /* eats attr */
-
+
pango_layout_set_attributes(layout,list);
pango_attr_list_unref(list);
pango_layout_set_indent(layout,0);
pango_layout_set_justify(layout,FALSE);
pango_layout_set_alignment(layout,PANGO_ALIGN_LEFT);
-
+
return layout;
}
@@ -726,7 +724,7 @@ get_string_offsets(PangoLayoutIter *iter, real** offsets, int* n_offsets)
for (i = 0; i < string->num_glyphs; i++) {
PangoGlyphGeometry geom = string->glyphs[i].geometry;
-
+
(*offsets)[i] = pdu_to_dcm(geom.width) / global_zoom_factor;
}
}
@@ -755,12 +753,12 @@ get_layout_offsets(PangoLayoutLine *line, PangoLayoutLine **layout_line)
/* Make single pointer */
PangoGlyphString *glyph_string = run->glyphs;
PangoGlyphString *layout_glyph_string;
-
+
layout_run->glyphs = g_new0(PangoGlyphString, 1);
layout_glyph_string = layout_run->glyphs;
layout_glyph_string->num_glyphs = glyph_string->num_glyphs;
- layout_glyph_string->glyphs =
+ layout_glyph_string->glyphs =
g_new0(PangoGlyphInfo, glyph_string->num_glyphs);
for (j = 0; j < layout_glyph_string->num_glyphs; j++) {
PangoGlyphInfo *info = &glyph_string->glyphs[j];
@@ -797,7 +795,7 @@ dia_font_get_sizes(const char* string, DiaFont *font, real height,
non_empty_string = string;
}
layout = dia_font_build_layout(non_empty_string, font, height * global_zoom_factor);
-
+
/* Only one line here ? */
iter = pango_layout_get_iter(layout);
@@ -814,7 +812,7 @@ dia_font_get_sizes(const char* string, DiaFont *font, real height,
* to avoid text overflowing its box, like in bug #482585 */
while (pango_layout_iter_next_line (iter)) {
PangoRectangle more_ink_rect, more_logical_rect;
-
+
pango_layout_iter_get_line_extents(iter, &more_ink_rect, &more_logical_rect);
if (more_logical_rect.width > logical_rect.width)
logical_rect.width = more_logical_rect.width;
@@ -841,16 +839,16 @@ dia_font_get_sizes(const char* string, DiaFont *font, real height,
/**
- * Compatibility with older files out of pre Pango Time.
+ * Compatibility with older files out of pre Pango Time.
* Make old files look as similar as possible
* List should be kept alphabetically sorted by oldname, in case of
* duplicates the one with the preferred newname comes first.
*
* FIXME: DIA_FONT_FAMILY_ANY in the list below does mean noone knows better
*
- * The PostScript names can be found on page 139 of
+ * The PostScript names can be found on page 139 of
* http://partners.adobe.com/public/developer/en/ps/PS3010and3011.Supplement.pdf
- *
+ *
* Note that these are not strictly the Adobe names, as a few were used
* incorrectly and are kept for backwards compatibility. The latin-1
* postscript renderer mangles these.
@@ -881,9 +879,9 @@ static struct _legacy_font {
{ "Courier-Oblique", "monospace", DIA_FONT_MONOSPACE | DIA_FONT_ITALIC},
{ "Courier-Oblique", "Courier New", DIA_FONT_MONOSPACE | DIA_FONT_ITALIC },
{ "Dotum", "Dotum", DIA_FONT_FAMILY_ANY },
- { "GBZenKai-Medium", "GBZenKai-Medium", DIA_FONT_FAMILY_ANY },
+ { "GBZenKai-Medium", "GBZenKai-Medium", DIA_FONT_FAMILY_ANY },
{ "GothicBBB-Medium", "GothicBBB-Medium", DIA_FONT_FAMILY_ANY },
- { "Gulim", "Gulim", DIA_FONT_FAMILY_ANY },
+ { "Gulim", "Gulim", DIA_FONT_FAMILY_ANY },
{ "Headline", "Headline", DIA_FONT_FAMILY_ANY },
{ "Helvetica", "sans", DIA_FONT_SANS },
{ "Helvetica", "Arial", DIA_FONT_SANS },
@@ -902,22 +900,22 @@ static struct _legacy_font {
{ "NewCenturySchoolbook-BoldItalic", "Century Schoolbook SWA", DIA_FONT_SERIF | DIA_FONT_BOLD |
DIA_FONT_ITALIC },
{ "NewCenturySchoolbook-Italic", "Century Schoolbook SWA", DIA_FONT_SERIF | DIA_FONT_ITALIC },
{ "NewCenturySchoolbook-Roman", "Century Schoolbook SWA", DIA_FONT_SERIF },
- { "Palatino-Bold", "Palatino", DIA_FONT_FAMILY_ANY | DIA_FONT_BOLD },
- { "Palatino-BoldItalic", "Palatino", DIA_FONT_FAMILY_ANY | DIA_FONT_BOLD | DIA_FONT_ITALIC },
- { "Palatino-Italic", "Palatino", DIA_FONT_FAMILY_ANY | DIA_FONT_ITALIC },
+ { "Palatino-Bold", "Palatino", DIA_FONT_FAMILY_ANY | DIA_FONT_BOLD },
+ { "Palatino-BoldItalic", "Palatino", DIA_FONT_FAMILY_ANY | DIA_FONT_BOLD | DIA_FONT_ITALIC },
+ { "Palatino-Italic", "Palatino", DIA_FONT_FAMILY_ANY | DIA_FONT_ITALIC },
{ "Palatino-Roman", "Palatino", DIA_FONT_FAMILY_ANY },
{ "Ryumin-Light", "Ryumin", DIA_FONT_FAMILY_ANY | DIA_FONT_LIGHT },
{ "ShanHeiSun-Light", "ShanHeiSun", DIA_FONT_FAMILY_ANY | DIA_FONT_LIGHT },
{ "Song-Medium", "Song-Medium", DIA_FONT_FAMILY_ANY | DIA_FONT_MEDIUM },
{ "Symbol", "Symbol", DIA_FONT_SANS | DIA_FONT_MEDIUM },
- { "Times-Bold", "serif", DIA_FONT_SERIF | DIA_FONT_BOLD },
+ { "Times-Bold", "serif", DIA_FONT_SERIF | DIA_FONT_BOLD },
{ "Times-Bold", "Times New Roman", DIA_FONT_SERIF | DIA_FONT_BOLD },
- { "Times-BoldItalic", "serif", DIA_FONT_SERIF | DIA_FONT_ITALIC | DIA_FONT_BOLD },
+ { "Times-BoldItalic", "serif", DIA_FONT_SERIF | DIA_FONT_ITALIC | DIA_FONT_BOLD },
{ "Times-BoldItalic", "Times New Roman", DIA_FONT_SERIF | DIA_FONT_ITALIC | DIA_FONT_BOLD },
- { "Times-Italic", "serif", DIA_FONT_SERIF | DIA_FONT_ITALIC },
+ { "Times-Italic", "serif", DIA_FONT_SERIF | DIA_FONT_ITALIC },
{ "Times-Italic", "Times New Roman", DIA_FONT_SERIF | DIA_FONT_ITALIC },
- { "Times-Roman", "serif", DIA_FONT_SERIF },
- { "Times-Roman", "Times New Roman", DIA_FONT_SERIF },
+ { "Times-Roman", "serif", DIA_FONT_SERIF },
+ { "Times-Roman", "Times New Roman", DIA_FONT_SERIF },
{ "ZapfChancery-MediumItalic", "Zapf Calligraphic 801 SWA", DIA_FONT_SERIF | DIA_FONT_MEDIUM },
{ "ZapfDingbats", "Zapf Calligraphic 801 SWA", DIA_FONT_SERIF },
{ "ZenKai-Medium", "ZenKai", DIA_FONT_FAMILY_ANY | DIA_FONT_MEDIUM },
@@ -946,12 +944,12 @@ dia_font_new_from_legacy_name(const char* name)
if (found) {
retval = dia_font_new (found->newname, found->style, height);
retval->legacy_name = found->oldname;
- } else {
+ } else {
/* We tried our best, let Pango complain */
retval = dia_font_new (name, DIA_FONT_WEIGHT_NORMAL, height);
retval->legacy_name = NULL;
}
-
+
return retval;
}
@@ -963,7 +961,7 @@ dia_font_get_legacy_name(const DiaFont *font)
DiaFontStyle style;
int i;
- /* if we have loaded it from an old file, use the old name */
+ /* if we have loaded it from an old file, use the old name */
if (font->legacy_name)
return font->legacy_name;
diff --git a/lib/geometry.h b/lib/geometry.h
index 9b507b78..1a669e60 100644
--- a/lib/geometry.h
+++ b/lib/geometry.h
@@ -20,9 +20,7 @@
#ifndef GEOMETRY_H
#define GEOMETRY_H
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include "diatypes.h"
@@ -42,7 +40,7 @@
# endif
#endif
-#ifdef _MSC_VER
+#ifdef _MSC_VER
/* #ifdef G_OS_WIN32 apparently _MSC_VER and mingw */
/* there are some things more in the gcc headers */
# include <float.h>
@@ -102,7 +100,7 @@ struct _IntRectangle {
int bottom; /*!< y2 */
};
-/*!
+/*!
* \brief BezPoint is a bezier point forming _Bezierline or _Beziergon
* \ingroup ObjectParts
*/
@@ -186,11 +184,11 @@ point_normalize(Point *p)
real len;
len = sqrt(p->x*p->x + p->y*p->y);
-
+
/* One could call it a bug to try normalizing a vector with
* len 0 and the result at least requires definition. But
* this is what makes the beziergon bounding box calculation
- * work. What's the mathematical correct result of 0.0/0.0 ?
+ * work. What's the mathematical correct result of 0.0/0.0 ?
*/
if (len > 0.0) {
p->x /= len;
@@ -214,7 +212,7 @@ point_get_normed(Point *dst, const Point *src)
real len;
len = sqrt(src->x*src->x + src->y*src->y);
-
+
dst->x = src->x / len;
dst->y = src->y / len;
}
@@ -222,25 +220,25 @@ point_get_normed(Point *dst, const Point *src)
static inline void
point_get_perp(Point *dst, const Point *src)
{
- /* dst = the src vector, rotated 90deg counter clowkwise. src *must* be
+ /* dst = the src vector, rotated 90deg counter clowkwise. src *must* be
normalized before. */
dst->y = src->x;
dst->x = -src->y;
}
-static inline void
+static inline void
point_copy(Point *dst, const Point *src)
{
/* Unfortunately, the compiler is not clever enough. And copying using
ints is faster if we don't computer based on the copied values, but
- is slower if we have to make a FP reload afterwards.
- point_copy() is meant for the latter case : then, the compiler is
+ is slower if we have to make a FP reload afterwards.
+ point_copy() is meant for the latter case : then, the compiler is
able to shuffle and merge the FP loads. */
dst->x = src->x;
dst->y = src->y;
}
-static inline void
+static inline void
point_add_scaled(Point *dst, const Point *src, real alpha)
{
/* especially useful if src is a normed vector... */
@@ -248,8 +246,8 @@ point_add_scaled(Point *dst, const Point *src, real alpha)
dst->y += alpha * src->y;
}
-static inline void
-point_copy_add_scaled(Point *dst, const Point *src,
+static inline void
+point_copy_add_scaled(Point *dst, const Point *src,
const Point *vct, real alpha)
{
/* especially useful if vct is a normed vector... */
@@ -267,13 +265,13 @@ int point_in_rectangle(const Rectangle* r, const Point *p);
int rectangle_in_rectangle(const Rectangle* outer, const Rectangle *inner);
void rectangle_add_point(Rectangle *r, const Point *p);
-static inline gboolean
+static inline gboolean
rectangle_equals(const Rectangle *r1, const Rectangle *r2)
{
return ( (r2->left == r1->left) &&
(r2->right == r1->right) &&
(r2->top == r1->top) &&
- (r2->bottom == r1->bottom) );
+ (r2->bottom == r1->bottom) );
}
static inline real
diff --git a/lib/layer.c b/lib/layer.c
index e1a9636b..7dacb2ca 100644
--- a/lib/layer.c
+++ b/lib/layer.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include "intl.h"
#include "diagramdata.h"
@@ -84,7 +82,7 @@ layer_render(Layer *layer, DiaRenderer *renderer, Rectangle *update,
if (obj_renderer == NULL)
obj_renderer = normal_render;
-
+
/* Draw all objects: */
list = layer->objects;
while (list!=NULL) {
@@ -108,7 +106,7 @@ layer_render(Layer *layer, DiaRenderer *renderer, Rectangle *update,
}
(*obj_renderer)(obj, renderer, active_layer, data);
}
-
+
list = g_list_next(list);
}
}
@@ -135,11 +133,11 @@ new_layer(gchar *name, DiagramData *parent)
layer->objects = NULL;
- layer->extents.left = 0.0;
- layer->extents.right = 10.0;
- layer->extents.top = 0.0;
- layer->extents.bottom = 10.0;
-
+ layer->extents.left = 0.0;
+ layer->extents.right = 10.0;
+ layer->extents.top = 0.0;
+ layer->extents.bottom = 10.0;
+
return layer;
}
@@ -163,10 +161,10 @@ layer_destroy(Layer *layer)
* \protected \memberof _Layer
*/
static void
-set_parent_layer(gpointer element, gpointer user_data)
+set_parent_layer(gpointer element, gpointer user_data)
{
((DiaObject*)element)->parent_layer = (Layer*)user_data;
- /* FIXME: even group members need a parent_layer and what about parent objects ???
+ /* FIXME: even group members need a parent_layer and what about parent objects ???
* Now I know again why I always try to avoid back-pointers )-; --hb.
* If the group objects didn't actually leave the diagram, this wouldn't
* be a problem. --LC */
@@ -264,7 +262,7 @@ layer_add_objects(Layer *layer, GList *obj_list)
DiaObject *obj = (DiaObject *)list->data;
/* send a signal that we have added a object to the diagram */
data_emit (layer_get_parent_diagram(layer), layer, obj, "object_add");
-
+
list = g_list_next(list);
}
}
@@ -280,7 +278,7 @@ void
layer_add_objects_first(Layer *layer, GList *obj_list)
{
GList *list = obj_list;
-
+
layer->objects = g_list_concat(obj_list, layer->objects);
g_list_foreach(obj_list, set_parent_layer, layer);
@@ -290,7 +288,7 @@ layer_add_objects_first(Layer *layer, GList *obj_list)
DiaObject *obj = (DiaObject *)list->data;
/* send a signal that we have added a object to the diagram */
data_emit (layer_get_parent_diagram(layer), layer, obj, "object_add");
-
+
list = g_list_next(list);
}
@@ -392,7 +390,7 @@ layer_find_objects_in_rectangle(Layer *layer, Rectangle *rect)
selected_list = g_list_prepend(selected_list, obj);
}
}
-
+
list = g_list_next(list);
}
@@ -426,7 +424,7 @@ layer_find_objects_containing_rectangle(Layer *layer, Rectangle *rect)
selected_list = g_list_prepend(selected_list, obj);
}
}
-
+
list = g_list_next(list);
}
@@ -458,7 +456,7 @@ layer_find_closest_object_except(Layer *layer, Point *pos,
GList *avoid_tmp;
closest = NULL;
-
+
for (l = layer->objects; l!=NULL; l = g_list_next(l)) {
obj = (DiaObject *) l->data;
@@ -505,7 +503,7 @@ layer_find_closest_object(Layer *layer, Point *pos, real maxdist)
* @return the distance of the connection point and pos
* \memberof _Layer
*/
-real
+real
layer_find_closest_connectionpoint(Layer *layer,
ConnectionPoint **closest,
Point *pos,
@@ -518,9 +516,9 @@ layer_find_closest_connectionpoint(Layer *layer,
int i;
mindist = 1000000.0; /* Realy big value... */
-
+
*closest = NULL;
-
+
for (l = layer->objects; l!=NULL; l = g_list_next(l) ) {
obj = (DiaObject *) l->data;
@@ -535,7 +533,7 @@ layer_find_closest_connectionpoint(Layer *layer,
*closest = cp;
}
}
-
+
}
return mindist;
@@ -551,13 +549,13 @@ layer_update_extents(Layer *layer)
GList *l;
DiaObject *obj;
Rectangle new_extents;
-
+
l = layer->objects;
if (l!=NULL) {
obj = (DiaObject *) l->data;
new_extents = obj->bounding_box;
l = g_list_next(l);
-
+
while(l!=NULL) {
const Rectangle *bbox;
obj = (DiaObject *) l->data;
@@ -629,7 +627,7 @@ layer_remove_dynobj(gpointer obj, gpointer userdata)
dynobj_list_remove_object((DiaObject*)obj);
}
-void
+void
layer_set_object_list(Layer *layer, GList *list)
{
GList *ol;
diff --git a/lib/prefs.c b/lib/prefs.c
index 2ee42c89..32b14bbb 100644
--- a/lib/prefs.c
+++ b/lib/prefs.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <string.h>
#include "prefs.h"
@@ -27,7 +25,7 @@
DiaUnit length_unit = DIA_UNIT_CENTIMETER;
DiaUnit fontsize_unit = DIA_UNIT_POINT;
-void
+void
prefs_set_length_unit(gchar* unit) {
GList *name_list = get_units_name_list();
int i;
@@ -56,13 +54,13 @@ prefs_set_fontsize_unit(gchar* unit) {
}
DiaUnit
-prefs_get_length_unit(void)
+prefs_get_length_unit(void)
{
return length_unit;
}
DiaUnit
-prefs_get_fontsize_unit(void)
+prefs_get_fontsize_unit(void)
{
return fontsize_unit;
}
diff --git a/lib/prefs.h b/lib/prefs.h
index 29d35dc8..21ba4bac 100644
--- a/lib/prefs.h
+++ b/lib/prefs.h
@@ -21,9 +21,7 @@
#ifndef PREFS_H
#define PREFS_H
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include "diatypes.h"
#include "widgets.h"
diff --git a/lib/prop_attr.c b/lib/prop_attr.c
index 3da4ec8e..d9a4e60d 100644
--- a/lib/prop_attr.c
+++ b/lib/prop_attr.c
@@ -22,9 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <gtk/gtk.h>
#include "dia_xml.h"
@@ -39,7 +37,7 @@
/***************************/
static LinestyleProperty *
-linestyleprop_new(const PropDescription *pdesc,
+linestyleprop_new(const PropDescription *pdesc,
PropDescToPropPredicate reason)
{
LinestyleProperty *prop = g_new0(LinestyleProperty,1);
@@ -50,9 +48,9 @@ linestyleprop_new(const PropDescription *pdesc,
}
static LinestyleProperty *
-linestyleprop_copy(LinestyleProperty *src)
+linestyleprop_copy(LinestyleProperty *src)
{
- LinestyleProperty *prop =
+ LinestyleProperty *prop =
(LinestyleProperty *)src->common.ops->new_prop(src->common.descr,
src->common.reason);
copy_init_property(&prop->common,&src->common);
@@ -69,7 +67,7 @@ linestyleprop_get_widget(LinestyleProperty *prop, PropDialog *dialog)
return ret;
}
-static void
+static void
linestyleprop_reset_widget(LinestyleProperty *prop, WIDGET *widget)
{
dia_line_style_selector_set_linestyle(DIALINESTYLESELECTOR(widget),
@@ -77,15 +75,15 @@ linestyleprop_reset_widget(LinestyleProperty *prop, WIDGET *widget)
prop->dash);
}
-static void
-linestyleprop_set_from_widget(LinestyleProperty *prop, WIDGET *widget)
+static void
+linestyleprop_set_from_widget(LinestyleProperty *prop, WIDGET *widget)
{
dia_line_style_selector_get_linestyle(DIALINESTYLESELECTOR(widget),
&prop->style,
&prop->dash);
}
-static void
+static void
linestyleprop_load(LinestyleProperty *prop, AttributeNode attr, DataNode data, DiaContext *ctx)
{
prop->style = data_enum(data, ctx);
@@ -105,22 +103,22 @@ linestyleprop_load(LinestyleProperty *prop, AttributeNode attr, DataNode data, D
}
}
-static void
-linestyleprop_save(LinestyleProperty *prop, AttributeNode attr, DiaContext *ctx)
+static void
+linestyleprop_save(LinestyleProperty *prop, AttributeNode attr, DiaContext *ctx)
{
data_add_enum(attr, prop->style, ctx);
data_add_real(attr, prop->dash, ctx);
}
-static void
+static void
linestyleprop_get_from_offset(LinestyleProperty *prop,
- void *base, guint offset, guint offset2)
+ void *base, guint offset, guint offset2)
{
prop->style = struct_member(base, offset, LineStyle);
prop->dash = struct_member(base, offset2, real);
}
-static void
+static void
linestyleprop_set_from_offset(LinestyleProperty *prop,
void *base, guint offset, guint offset2)
{
@@ -159,9 +157,9 @@ arrowprop_new(const PropDescription *pdesc, PropDescToPropPredicate reason)
}
static ArrowProperty *
-arrowprop_copy(ArrowProperty *src)
+arrowprop_copy(ArrowProperty *src)
{
- ArrowProperty *prop =
+ ArrowProperty *prop =
(ArrowProperty *)src->common.ops->new_prop(src->common.descr,
src->common.reason);
copy_init_property(&prop->common,&src->common);
@@ -177,20 +175,20 @@ arrowprop_get_widget(ArrowProperty *prop, PropDialog *dialog)
return ret;
}
-static void
+static void
arrowprop_reset_widget(ArrowProperty *prop, WIDGET *widget)
{
dia_arrow_selector_set_arrow(DIA_ARROW_SELECTOR(widget),
prop->arrow_data);
}
-static void
-arrowprop_set_from_widget(ArrowProperty *prop, WIDGET *widget)
+static void
+arrowprop_set_from_widget(ArrowProperty *prop, WIDGET *widget)
{
prop->arrow_data = dia_arrow_selector_get_arrow(DIA_ARROW_SELECTOR(widget));
}
-static void
+static void
arrowprop_load(ArrowProperty *prop, AttributeNode attr, DataNode data, DiaContext *ctx)
{
/* Maybe it would be better to store arrows as a single composite
@@ -214,8 +212,8 @@ arrowprop_load(ArrowProperty *prop, AttributeNode attr, DataNode data, DiaContex
}
}
-static void
-arrowprop_save(ArrowProperty *prop, AttributeNode attr, DiaContext *ctx)
+static void
+arrowprop_save(ArrowProperty *prop, AttributeNode attr, DiaContext *ctx)
{
data_add_enum(attr, prop->arrow_data.type, ctx);
if (prop->arrow_data.type != ARROW_NONE) {
@@ -231,14 +229,14 @@ arrowprop_save(ArrowProperty *prop, AttributeNode attr, DiaContext *ctx)
}
}
-static void
+static void
arrowprop_get_from_offset(ArrowProperty *prop,
- void *base, guint offset, guint offset2)
+ void *base, guint offset, guint offset2)
{
prop->arrow_data = struct_member(base,offset,Arrow);
}
-static void
+static void
arrowprop_set_from_offset(ArrowProperty *prop,
void *base, guint offset, guint offset2)
{
@@ -277,9 +275,9 @@ colorprop_new(const PropDescription *pdesc, PropDescToPropPredicate reason)
}
static ColorProperty *
-colorprop_copy(ColorProperty *src)
+colorprop_copy(ColorProperty *src)
{
- ColorProperty *prop =
+ ColorProperty *prop =
(ColorProperty *)src->common.ops->new_prop(src->common.descr,
src->common.reason);
copy_init_property(&prop->common,&src->common);
@@ -289,42 +287,42 @@ colorprop_copy(ColorProperty *src)
static WIDGET *
colorprop_get_widget(ColorProperty *prop, PropDialog *dialog)
-{
+{
GtkWidget *ret = dia_color_selector_new();
dia_color_selector_set_use_alpha (ret, TRUE);
prophandler_connect(&prop->common, G_OBJECT(ret), "value-changed");
return ret;
}
-static void
+static void
colorprop_reset_widget(ColorProperty *prop, WIDGET *widget)
{
dia_color_selector_set_color(widget,
&prop->color_data);
}
-static void
-colorprop_set_from_widget(ColorProperty *prop, WIDGET *widget)
+static void
+colorprop_set_from_widget(ColorProperty *prop, WIDGET *widget)
{
dia_color_selector_get_color(widget,
&prop->color_data);
}
-static void
+static void
colorprop_load(ColorProperty *prop, AttributeNode attr, DataNode data, DiaContext *ctx)
{
data_color(data,&prop->color_data, ctx);
}
-static void
-colorprop_save(ColorProperty *prop, AttributeNode attr, DiaContext *ctx)
+static void
+colorprop_save(ColorProperty *prop, AttributeNode attr, DiaContext *ctx)
{
data_add_color(attr,&prop->color_data, ctx);
}
-static void
+static void
colorprop_get_from_offset(ColorProperty *prop,
- void *base, guint offset, guint offset2)
+ void *base, guint offset, guint offset2)
{
if (offset2 == 0) {
prop->color_data = struct_member(base,offset,Color);
@@ -335,7 +333,7 @@ colorprop_get_from_offset(ColorProperty *prop,
}
}
-static void
+static void
colorprop_set_from_offset(ColorProperty *prop,
void *base, guint offset, guint offset2)
{
@@ -388,9 +386,9 @@ fontprop_free(FontProperty *prop)
}
static FontProperty *
-fontprop_copy(FontProperty *src)
+fontprop_copy(FontProperty *src)
{
- FontProperty *prop =
+ FontProperty *prop =
(FontProperty *)src->common.ops->new_prop(src->common.descr,
src->common.reason);
copy_init_property(&prop->common,&src->common);
@@ -404,26 +402,26 @@ fontprop_copy(FontProperty *src)
static WIDGET *
fontprop_get_widget(FontProperty *prop, PropDialog *dialog)
-{
+{
GtkWidget *ret = dia_font_selector_new();
prophandler_connect(&prop->common, G_OBJECT(ret), "value-changed");
return ret;
}
-static void
+static void
fontprop_reset_widget(FontProperty *prop, WIDGET *widget)
{
dia_font_selector_set_font(DIAFONTSELECTOR(widget),
prop->font_data);
}
-static void
-fontprop_set_from_widget(FontProperty *prop, WIDGET *widget)
+static void
+fontprop_set_from_widget(FontProperty *prop, WIDGET *widget)
{
prop->font_data = dia_font_selector_get_font(DIAFONTSELECTOR(widget));
}
-static void
+static void
fontprop_load(FontProperty *prop, AttributeNode attr, DataNode data, DiaContext *ctx)
{
if (prop->font_data)
@@ -431,15 +429,15 @@ fontprop_load(FontProperty *prop, AttributeNode attr, DataNode data, DiaContext
prop->font_data = data_font(data, ctx);
}
-static void
-fontprop_save(FontProperty *prop, AttributeNode attr, DiaContext *ctx)
+static void
+fontprop_save(FontProperty *prop, AttributeNode attr, DiaContext *ctx)
{
data_add_font(attr,prop->font_data, ctx);
}
-static void
+static void
fontprop_get_from_offset(FontProperty *prop,
- void *base, guint offset, guint offset2)
+ void *base, guint offset, guint offset2)
{
/* if we get the same font dont unref before reuse */
DiaFont *old_font = prop->font_data;
@@ -454,7 +452,7 @@ fontprop_get_from_offset(FontProperty *prop,
dia_font_unref(old_font);
}
-static void
+static void
fontprop_set_from_offset(FontProperty *prop,
void *base, guint offset, guint offset2)
{
@@ -492,9 +490,9 @@ static const PropertyOps fontprop_ops = {
(PropertyType_SetFromOffset) fontprop_set_from_offset
};
-/* ************************************************************** */
+/* ************************************************************** */
-void
+void
prop_attr_register(void)
{
prop_type_register(PROP_TYPE_LINESTYLE,&linestyleprop_ops);
diff --git a/lib/prop_basic.c b/lib/prop_basic.c
index 495b6627..206b3414 100644
--- a/lib/prop_basic.c
+++ b/lib/prop_basic.c
@@ -6,7 +6,7 @@
* Copyright (C) 2001 Cyrille Chepelov
* Major restructuration done in August 2001 by C. Chepelov
*
- * Basic Property types definition.
+ * Basic Property types definition.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,9 +23,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <string.h>
@@ -40,24 +38,24 @@ typedef struct {
const gchar *type;
} PropMoniker;
-static guint
+static guint
desc_hash_hash(const PropMoniker *desc)
{
guint name_hash = g_str_hash(desc->name);
guint type_hash = g_str_hash(desc->type);
- return (name_hash ^ ((type_hash & 0xFFFF0000) >> 16) ^
+ return (name_hash ^ ((type_hash & 0xFFFF0000) >> 16) ^
((type_hash & 0x0000FFFF) << 16) ^ (type_hash));
}
-static guint
+static guint
desc_hash_compare(const PropMoniker *a, const PropMoniker *b)
{
return ((0 == strcmp(a->name,b->name)) && (0 == strcmp(a->type,b->type)));
}
Property *
-make_new_prop(const char *name, PropertyType type, guint flags)
+make_new_prop(const char *name, PropertyType type, guint flags)
{
static GHashTable *hash = NULL;
PropMoniker *moniker = g_new0(PropMoniker, 1);
@@ -79,11 +77,11 @@ make_new_prop(const char *name, PropertyType type, guint flags)
descr->flags = flags;
descr->quark = g_quark_from_static_string(descr->name);
descr->type_quark = g_quark_from_static_string(descr->type);
- descr->ops = prop_type_get_ops(type);
+ descr->ops = prop_type_get_ops(type);
g_hash_table_insert(hash,moniker,descr);
- /* we don't ever free anything allocated here. */
+ /* we don't ever free anything allocated here. */
}
- return descr->ops->new_prop(descr,pdtpp_synthetic);
+ return descr->ops->new_prop(descr,pdtpp_synthetic);
}
@@ -102,14 +100,14 @@ commonprop_new(const PropDescription *pdesc, PropDescToPropPredicate reason)
return pdesc->ops->new_prop(pdesc,reason);
}
-static void
-commonprop_free(Property *prop)
+static void
+commonprop_free(Property *prop)
{
prop->real_ops->free(prop);
}
static Property *
-commonprop_copy(Property *src)
+commonprop_copy(Property *src)
{
Property *prop = src->real_ops->copy(src);
src->experience |= PXP_COPIED;
@@ -118,14 +116,14 @@ commonprop_copy(Property *src)
}
static WIDGET *
-commonprop_get_widget(Property *prop, PropDialog *dialog)
-{
+commonprop_get_widget(Property *prop, PropDialog *dialog)
+{
WIDGET *wid = prop->real_ops->get_widget(prop,dialog);
prop->experience |= PXP_GET_WIDGET;
return wid;
}
-static void
+static void
commonprop_reset_widget(Property *prop, WIDGET *widget)
{
prop->real_ops->reset_widget(prop,widget);
@@ -135,42 +133,42 @@ commonprop_reset_widget(Property *prop, WIDGET *widget)
prop->experience |= PXP_RESET_WIDGET;
}
-static void
-commonprop_set_from_widget(Property *prop, WIDGET *widget)
+static void
+commonprop_set_from_widget(Property *prop, WIDGET *widget)
{
prop->real_ops->set_from_widget(prop,widget);
prop->experience |= PXP_SET_FROM_WIDGET;
}
-static void
+static void
commonprop_load(Property *prop, AttributeNode attr, DataNode data, DiaContext *ctx)
{
prop->real_ops->load(prop,attr,data,ctx);
prop->experience |= PXP_LOADED;
}
-static void
-commonprop_save(Property *prop, AttributeNode attr, DiaContext *ctx)
+static void
+commonprop_save(Property *prop, AttributeNode attr, DiaContext *ctx)
{
prop->real_ops->save(prop,attr,ctx);
prop->experience |= PXP_SAVED;
}
-static gboolean
+static gboolean
commonprop_can_merge(const PropDescription *pd1, const PropDescription *pd2)
-{
+{
return pd1->ops->can_merge(pd1,pd2);
}
-static void
+static void
commonprop_get_from_offset(const Property *prop,
- void *base, guint offset, guint offset2)
+ void *base, guint offset, guint offset2)
{
prop->real_ops->get_from_offset(prop,base,offset,offset2);
((Property *)prop)->experience |= PXP_GFO;
}
-static void
+static void
commonprop_set_from_offset(Property *prop,
void *base, guint offset, guint offset2)
{
@@ -188,7 +186,7 @@ static const PropertyOps commonprop_ops = {
(PropertyType_ResetWidget) commonprop_reset_widget,
(PropertyType_SetFromWidget) commonprop_set_from_widget,
- (PropertyType_CanMerge) commonprop_can_merge,
+ (PropertyType_CanMerge) commonprop_can_merge,
(PropertyType_GetFromOffset) commonprop_get_from_offset,
(PropertyType_SetFromOffset) commonprop_set_from_offset
};
@@ -238,68 +236,68 @@ noopprop_new(const PropDescription *pdesc, PropDescToPropPredicate reason)
return prop;
}
-void
-noopprop_free(NoopProperty *prop)
+void
+noopprop_free(NoopProperty *prop)
{
g_free(prop);
}
NoopProperty *
-noopprop_copy(NoopProperty *src)
+noopprop_copy(NoopProperty *src)
{
- NoopProperty *prop =
+ NoopProperty *prop =
(NoopProperty *)src->common.ops->new_prop(src->common.descr,
src->common.reason);
copy_init_property(&prop->common,&src->common);
- return prop; /* Yes, this one could be just be _new().
+ return prop; /* Yes, this one could be just be _new().
It's actually a placeholder. */
}
WIDGET *
-noopprop_get_widget(NoopProperty *prop, PropDialog *dialog)
-{
+noopprop_get_widget(NoopProperty *prop, PropDialog *dialog)
+{
return NULL;
}
-void
+void
noopprop_reset_widget(NoopProperty *prop, WIDGET *widget)
{
}
-void
-noopprop_set_from_widget(NoopProperty *prop, WIDGET *widget)
+void
+noopprop_set_from_widget(NoopProperty *prop, WIDGET *widget)
{
}
-void
+void
noopprop_load(NoopProperty *prop, AttributeNode attr, DataNode data, DiaContext *ctx)
{
}
-void
-noopprop_save(NoopProperty *prop, AttributeNode attr, DiaContext *ctx)
+void
+noopprop_save(NoopProperty *prop, AttributeNode attr, DiaContext *ctx)
{
}
-gboolean
+gboolean
noopprop_can_merge(const PropDescription *pd1, const PropDescription *pd2)
-{
- return TRUE;
+{
+ return TRUE;
}
-gboolean
+gboolean
noopprop_cannot_merge(const PropDescription *pd1, const PropDescription *pd2)
-{
- return TRUE;
+{
+ return TRUE;
}
-void
+void
noopprop_get_from_offset(const NoopProperty *prop,
- void *base, guint offset, guint offset2)
+ void *base, guint offset, guint offset2)
{
}
-void
+void
noopprop_set_from_offset(NoopProperty *prop,
void *base, guint offset, guint offset2)
{
@@ -324,17 +322,17 @@ static const PropertyOps noopprop_ops = {
/* The INVALID property type. It is mostly useful to serve a library. */
/* Each time its code is executed, a g_assert_not_reached() will be run... */
/***************************************************************************/
-
+
InvalidProperty *
-invalidprop_new(const PropDescription *pdesc,
+invalidprop_new(const PropDescription *pdesc,
PropDescToPropPredicate reason)
{
g_assert_not_reached();
return NULL;
}
-void
-invalidprop_free(InvalidProperty *prop)
+void
+invalidprop_free(InvalidProperty *prop)
{
g_assert_not_reached();
}
@@ -353,45 +351,45 @@ invalidprop_get_widget(InvalidProperty *prop, PropDialog *dialog)
return NULL;
}
-void
+void
invalidprop_reset_widget(InvalidProperty *prop, WIDGET *widget)
{
g_assert_not_reached();
}
-void
+void
invalidprop_set_from_widget(InvalidProperty *prop, WIDGET *widget)
{
g_assert_not_reached();
}
-void
+void
invalidprop_load(InvalidProperty *prop, AttributeNode attr, DataNode data, DiaContext *ctx)
-{
+{
g_assert_not_reached();
}
-void
+void
invalidprop_save(InvalidProperty *prop, AttributeNode attr, DiaContext *ctx)
{
g_assert_not_reached();
}
-gboolean
+gboolean
invalidprop_can_merge(const PropDescription *pd1, const PropDescription *pd2)
-{
+{
g_assert_not_reached();
- return TRUE;
+ return TRUE;
}
-void
+void
invalidprop_get_from_offset(const InvalidProperty *prop,
- void *base, guint offset, guint offset2)
+ void *base, guint offset, guint offset2)
{
g_assert_not_reached();
}
-void
+void
invalidprop_set_from_offset(InvalidProperty *prop,
void *base, guint offset, guint offset2)
{
@@ -417,80 +415,80 @@ static const PropertyOps invalidprop_ops = {
/* The UNIMPLEMENTED property type. It is mostly useful to serve a library */
/* for unfinished property types. */
/***************************************************************************/
-
+
UnimplementedProperty *
-unimplementedprop_new(const PropDescription *pdesc,
- PropDescToPropPredicate reason)
+unimplementedprop_new(const PropDescription *pdesc,
+ PropDescToPropPredicate reason)
{
- g_warning("%s: for property %s",G_STRFUNC,pdesc->name);
+ g_warning("%s: for property %s",G_STRFUNC,pdesc->name);
return NULL;
}
-void
-unimplementedprop_free(UnimplementedProperty *prop)
+void
+unimplementedprop_free(UnimplementedProperty *prop)
{
- g_warning("%s: for property %s",G_STRFUNC,prop->common.descr->name);
+ g_warning("%s: for property %s",G_STRFUNC,prop->common.descr->name);
}
UnimplementedProperty *
-unimplementedprop_copy(UnimplementedProperty *src)
+unimplementedprop_copy(UnimplementedProperty *src)
{
- g_warning("%s: for property %s",G_STRFUNC,src->common.descr->name);
+ g_warning("%s: for property %s",G_STRFUNC,src->common.descr->name);
return NULL;
}
WIDGET *
unimplementedprop_get_widget(UnimplementedProperty *prop, PropDialog *dialog)
-{
- g_warning("%s: for property %s",G_STRFUNC,prop->common.descr->name);
+{
+ g_warning("%s: for property %s",G_STRFUNC,prop->common.descr->name);
return NULL;
}
-void
-unimplementedprop_reset_widget(UnimplementedProperty *prop, WIDGET *widget)
+void
+unimplementedprop_reset_widget(UnimplementedProperty *prop, WIDGET *widget)
{
- g_warning("%s: for property %s",G_STRFUNC,prop->common.descr->name);
+ g_warning("%s: for property %s",G_STRFUNC,prop->common.descr->name);
}
-void
-unimplementedprop_set_from_widget(UnimplementedProperty *prop, WIDGET *widget)
+void
+unimplementedprop_set_from_widget(UnimplementedProperty *prop, WIDGET *widget)
{
- g_warning("%s: for property %s",G_STRFUNC,prop->common.descr->name);
+ g_warning("%s: for property %s",G_STRFUNC,prop->common.descr->name);
}
-void
-unimplementedprop_load(UnimplementedProperty *prop,
+void
+unimplementedprop_load(UnimplementedProperty *prop,
AttributeNode attr, DataNode data,
- DiaContext *ctx)
+ DiaContext *ctx)
{
- g_warning("%s: for property %s",G_STRFUNC,prop->common.descr->name);
+ g_warning("%s: for property %s",G_STRFUNC,prop->common.descr->name);
}
-void
-unimplementedprop_save(UnimplementedProperty *prop, AttributeNode attr, DiaContext *ctx)
+void
+unimplementedprop_save(UnimplementedProperty *prop, AttributeNode attr, DiaContext *ctx)
{
- g_warning("%s: for property %s",G_STRFUNC,prop->common.descr->name);
+ g_warning("%s: for property %s",G_STRFUNC,prop->common.descr->name);
}
-gboolean
+gboolean
unimplementedprop_can_merge(const PropDescription *pd1, const PropDescription *pd2)
{
- g_warning("%s: for property %s/%s",G_STRFUNC,pd1->name,pd2->name);
+ g_warning("%s: for property %s/%s",G_STRFUNC,pd1->name,pd2->name);
return FALSE;
}
void
unimplementedprop_get_from_offset(const UnimplementedProperty *prop,
- void *base, guint offset, guint offset2)
+ void *base, guint offset, guint offset2)
{
- g_warning("%s: for property %s",G_STRFUNC,prop->common.descr->name);
+ g_warning("%s: for property %s",G_STRFUNC,prop->common.descr->name);
}
-void
+void
unimplementedprop_set_from_offset(UnimplementedProperty *prop,
void *base, guint offset, guint offset2)
{
- g_warning("%s: for property %s",G_STRFUNC,prop->common.descr->name);
+ g_warning("%s: for property %s",G_STRFUNC,prop->common.descr->name);
}
static const PropertyOps unimplementedprop_ops = {
@@ -508,9 +506,9 @@ static const PropertyOps unimplementedprop_ops = {
(PropertyType_SetFromOffset) unimplementedprop_set_from_offset
};
-/* ************************************************************** */
+/* ************************************************************** */
-void
+void
prop_basic_register(void)
{
prop_type_register(PROP_TYPE_NOOP,&noopprop_ops);
diff --git a/lib/prop_dict.c b/lib/prop_dict.c
index eada7d16..60efddbd 100644
--- a/lib/prop_dict.c
+++ b/lib/prop_dict.c
@@ -23,9 +23,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <gtk/gtk.h>
#define WIDGET GtkWidget
@@ -47,24 +45,24 @@ static WellKnownKeys _well_known[] = {
{ "url", N_("URL") },
{ NULL, NULL }
};
-
+
static DictProperty *
dictprop_new(const PropDescription *pdesc, PropDescToPropPredicate reason)
{
DictProperty *prop = g_new0(DictProperty,1);
- initialize_property(&prop->common, pdesc, reason);
+ initialize_property(&prop->common, pdesc, reason);
prop->dict = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
return prop;
}
static void
-dictprop_free(DictProperty *prop)
+dictprop_free(DictProperty *prop)
{
if (prop->dict)
g_hash_table_destroy(prop->dict);
g_free(prop);
-}
+}
static void
_keyvalue_copy (gpointer key,
@@ -74,22 +72,22 @@ _keyvalue_copy (gpointer key,
gchar *name = (gchar *)key;
gchar *val = (gchar *)value;
GHashTable *dest = (GHashTable *)user_data;
-
+
g_hash_table_insert (dest, g_strdup (name), g_strdup (val));
}
static DictProperty *
-dictprop_copy(DictProperty *src)
+dictprop_copy(DictProperty *src)
{
- DictProperty *prop =
+ DictProperty *prop =
(DictProperty *)src->common.ops->new_prop(src->common.descr,
src->common.reason);
if (src->dict)
g_hash_table_foreach (src->dict, _keyvalue_copy, prop->dict);
-
+
return prop;
}
-static void
+static void
dictprop_load(DictProperty *prop, AttributeNode attr, DataNode data, DiaContext *ctx)
{
DataNode kv;
@@ -121,7 +119,7 @@ _hash_dup (const GHashTable *src)
dest = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
g_hash_table_foreach ((GHashTable *)src, _keyvalue_copy, dest);
}
- return dest;
+ return dest;
}
typedef struct
{
@@ -141,24 +139,24 @@ _keyvalue_save (gpointer key,
data_add_string(new_attribute(node, name), val, ctx);
}
-static void
-dictprop_save(DictProperty *prop, AttributeNode attr, DiaContext *ctx)
+static void
+dictprop_save(DictProperty *prop, AttributeNode attr, DiaContext *ctx)
{
DictUserData ud;
ud.node = data_add_composite(attr, "dict", ctx);
ud.ctx = ctx;
if (prop->dict)
- g_hash_table_foreach (prop->dict, _keyvalue_save, &ud);
+ g_hash_table_foreach (prop->dict, _keyvalue_save, &ud);
}
-static void
+static void
dictprop_get_from_offset(DictProperty *prop,
- void *base, guint offset, guint offset2)
+ void *base, guint offset, guint offset2)
{
prop->dict = _hash_dup (struct_member(base,offset,GHashTable *));
}
-static void
+static void
dictprop_set_from_offset(DictProperty *prop,
void *base, guint offset, guint offset2)
{
@@ -230,7 +228,7 @@ _create_view (GtkTreeModel *model)
GtkWidget *tree_view;
GtkTreeViewColumn *col;
GtkCellRenderer *renderer;
-
+
widget = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_ETCHED_IN);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (widget), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
@@ -238,7 +236,7 @@ _create_view (GtkTreeModel *model)
tree_view = gtk_tree_view_new_with_model (model);
gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (tree_view), TRUE);
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_view), TRUE);
-
+
col = gtk_tree_view_column_new_with_attributes(
_("Key"), gtk_cell_renderer_text_new (),
"text", KEY_COLUMN, NULL);
@@ -262,8 +260,8 @@ _create_view (GtkTreeModel *model)
return widget;
}
static GtkWidget *
-dictprop_get_widget (DictProperty *prop, PropDialog *dialog)
-{
+dictprop_get_widget (DictProperty *prop, PropDialog *dialog)
+{
GtkWidget *ret;
ret = _create_view (_create_model (prop));
gtk_widget_show_all (ret);
@@ -272,7 +270,7 @@ dictprop_get_widget (DictProperty *prop, PropDialog *dialog)
*/
return ret;
}
-static void
+static void
dictprop_reset_widget(DictProperty *prop, GtkWidget *widget)
{
GtkTreeModel *model = g_object_get_data (G_OBJECT (widget), TREE_MODEL_KEY);
@@ -305,19 +303,19 @@ dictprop_reset_widget(DictProperty *prop, GtkWidget *widget)
-1);
}
}
-static void
-dictprop_set_from_widget(DictProperty *prop, GtkWidget *widget)
+static void
+dictprop_set_from_widget(DictProperty *prop, GtkWidget *widget)
{
GtkTreeModel *model = g_object_get_data (G_OBJECT (widget), TREE_MODEL_KEY);
GtkTreeIter iter;
-
+
if (gtk_tree_model_get_iter_first (model, &iter)) {
gchar *key, *val;
-
+
do {
- gtk_tree_model_get (model, &iter,
+ gtk_tree_model_get (model, &iter,
KEY_COLUMN, &key,
- VALUE_COLUMN, &val,
+ VALUE_COLUMN, &val,
-1);
if (key && val) {
@@ -350,7 +348,7 @@ static const PropertyOps dictprop_ops = {
(PropertyType_SetFromOffset) dictprop_set_from_offset
};
-void
+void
prop_dicttypes_register(void)
{
prop_type_register(PROP_TYPE_DICT, &dictprop_ops);
@@ -361,7 +359,7 @@ data_dict (DataNode data, DiaContext *ctx)
{
GHashTable *ht = NULL;
int nvals = attribute_num_data (data);
-
+
if (nvals) {
DataNode kv = attribute_first_data (data);
gchar *val = NULL;
diff --git a/lib/prop_geomtypes.c b/lib/prop_geomtypes.c
index 81c4fe00..9a517c68 100644
--- a/lib/prop_geomtypes.c
+++ b/lib/prop_geomtypes.c
@@ -22,9 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <string.h>
@@ -54,9 +52,9 @@ realprop_new(const PropDescription *pdesc, PropDescToPropPredicate reason)
}
static RealProperty *
-realprop_copy(RealProperty *src)
+realprop_copy(RealProperty *src)
{
- RealProperty *prop =
+ RealProperty *prop =
(RealProperty *)src->common.ops->new_prop(src->common.descr,
src->common.reason);
copy_init_property(&prop->common,&src->common);
@@ -65,20 +63,20 @@ realprop_copy(RealProperty *src)
}
static WIDGET *
-realprop_get_widget(RealProperty *prop, PropDialog *dialog)
-{
+realprop_get_widget(RealProperty *prop, PropDialog *dialog)
+{
GtkAdjustment *adj = GTK_ADJUSTMENT(gtk_adjustment_new(prop->real_data,
- G_MINFLOAT,
+ G_MINFLOAT,
G_MAXFLOAT,
0.1, 1.0, 0));
GtkWidget *ret = gtk_spin_button_new(adj, 1.0, 2);
gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(ret),TRUE);
prophandler_connect(&prop->common, G_OBJECT(ret), "value_changed");
-
+
return ret;
}
-static void
+static void
realprop_reset_widget(RealProperty *prop, WIDGET *widget)
{
GtkAdjustment *adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON(widget));
@@ -94,39 +92,39 @@ realprop_reset_widget(RealProperty *prop, WIDGET *widget)
}
}
-static void
-realprop_set_from_widget(RealProperty *prop, WIDGET *widget)
+static void
+realprop_set_from_widget(RealProperty *prop, WIDGET *widget)
{
prop->real_data = gtk_spin_button_get_value(GTK_SPIN_BUTTON(widget));
}
-static void
+static void
realprop_load(RealProperty *prop, AttributeNode attr, DataNode data, DiaContext *ctx)
{
prop->real_data = data_real(data, ctx);
}
-static void
-realprop_save(RealProperty *prop, AttributeNode attr, DiaContext *ctx)
+static void
+realprop_save(RealProperty *prop, AttributeNode attr, DiaContext *ctx)
{
data_add_real(attr, prop->real_data, ctx);
}
-static void
+static void
realprop_get_from_offset(RealProperty *prop,
- void *base, guint offset, guint offset2)
+ void *base, guint offset, guint offset2)
{
prop->real_data = struct_member(base,offset,real);
}
-static void
+static void
realprop_set_from_offset(RealProperty *prop,
void *base, guint offset, guint offset2)
{
struct_member(base,offset,real) = prop->real_data;
}
-static int
+static int
realprop_get_data_size(RealProperty *prop)
{
return sizeof (prop->real_data);
@@ -162,9 +160,9 @@ lengthprop_new(const PropDescription *pdesc, PropDescToPropPredicate reason)
}
static LengthProperty *
-lengthprop_copy(LengthProperty *src)
+lengthprop_copy(LengthProperty *src)
{
- LengthProperty *prop =
+ LengthProperty *prop =
(LengthProperty *)src->common.ops->new_prop(src->common.descr,
src->common.reason);
copy_init_property(&prop->common,&src->common);
@@ -173,58 +171,58 @@ lengthprop_copy(LengthProperty *src)
}
static WIDGET *
-lengthprop_get_widget(LengthProperty *prop, PropDialog *dialog)
-{
+lengthprop_get_widget(LengthProperty *prop, PropDialog *dialog)
+{
GtkAdjustment *adj = GTK_ADJUSTMENT(gtk_adjustment_new(prop->length_data,
- G_MINFLOAT,
+ G_MINFLOAT,
G_MAXFLOAT,
0.1, 1.0, 0));
GtkWidget *ret = dia_unit_spinner_new(adj, prefs_get_length_unit());
/* gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(ret),TRUE);*/
prophandler_connect(&prop->common, G_OBJECT(ret), "value-changed");
-
+
return ret;
}
-static void
+static void
lengthprop_reset_widget(LengthProperty *prop, WIDGET *widget)
{
dia_unit_spinner_set_value(DIA_UNIT_SPINNER(widget), prop->length_data);
}
-static void
-lengthprop_set_from_widget(LengthProperty *prop, WIDGET *widget)
+static void
+lengthprop_set_from_widget(LengthProperty *prop, WIDGET *widget)
{
prop->length_data = dia_unit_spinner_get_value(DIA_UNIT_SPINNER(widget));
}
-static void
+static void
lengthprop_load(LengthProperty *prop, AttributeNode attr, DataNode data, DiaContext *ctx)
{
prop->length_data = data_real(data, ctx);
}
-static void
-lengthprop_save(LengthProperty *prop, AttributeNode attr, DiaContext *ctx)
+static void
+lengthprop_save(LengthProperty *prop, AttributeNode attr, DiaContext *ctx)
{
data_add_real(attr, prop->length_data, ctx);
}
-static void
+static void
lengthprop_get_from_offset(LengthProperty *prop,
- void *base, guint offset, guint offset2)
+ void *base, guint offset, guint offset2)
{
prop->length_data = struct_member(base,offset,real);
}
-static void
+static void
lengthprop_set_from_offset(LengthProperty *prop,
void *base, guint offset, guint offset2)
{
struct_member(base,offset,real) = prop->length_data;
}
-static int
+static int
lengthprop_get_data_size(LengthProperty *prop)
{
return sizeof (prop->length_data);
@@ -260,9 +258,9 @@ fontsizeprop_new(const PropDescription *pdesc, PropDescToPropPredicate reason)
}
static FontsizeProperty *
-fontsizeprop_copy(FontsizeProperty *src)
+fontsizeprop_copy(FontsizeProperty *src)
{
- FontsizeProperty *prop =
+ FontsizeProperty *prop =
(FontsizeProperty *)src->common.ops->new_prop(src->common.descr,
src->common.reason);
copy_init_property(&prop->common,&src->common);
@@ -271,10 +269,10 @@ fontsizeprop_copy(FontsizeProperty *src)
}
static WIDGET *
-fontsizeprop_get_widget(FontsizeProperty *prop, PropDialog *dialog)
-{
+fontsizeprop_get_widget(FontsizeProperty *prop, PropDialog *dialog)
+{
GtkAdjustment *adj = GTK_ADJUSTMENT(gtk_adjustment_new(prop->fontsize_data,
- G_MINFLOAT,
+ G_MINFLOAT,
G_MAXFLOAT,
0.1, 1.0, 0));
GtkWidget *ret = dia_unit_spinner_new(adj, prefs_get_fontsize_unit());
@@ -282,19 +280,19 @@ fontsizeprop_get_widget(FontsizeProperty *prop, PropDialog *dialog)
return ret;
}
-static void
+static void
fontsizeprop_reset_widget(FontsizeProperty *prop, WIDGET *widget)
{
dia_unit_spinner_set_value(DIA_UNIT_SPINNER(widget), prop->fontsize_data);
}
-static void
-fontsizeprop_set_from_widget(FontsizeProperty *prop, WIDGET *widget)
+static void
+fontsizeprop_set_from_widget(FontsizeProperty *prop, WIDGET *widget)
{
prop->fontsize_data = dia_unit_spinner_get_value(DIA_UNIT_SPINNER(widget));
}
-static void
+static void
fontsizeprop_load(FontsizeProperty *prop, AttributeNode attr, DataNode data, DiaContext *ctx)
{
PropNumData *numdata = prop->common.descr->extra_data;
@@ -309,15 +307,15 @@ fontsizeprop_load(FontsizeProperty *prop, AttributeNode attr, DataNode data, Dia
prop->fontsize_data = value;
}
-static void
-fontsizeprop_save(FontsizeProperty *prop, AttributeNode attr, DiaContext *ctx)
+static void
+fontsizeprop_save(FontsizeProperty *prop, AttributeNode attr, DiaContext *ctx)
{
data_add_real(attr, prop->fontsize_data, ctx);
}
-static void
+static void
fontsizeprop_get_from_offset(FontsizeProperty *prop,
- void *base, guint offset, guint offset2)
+ void *base, guint offset, guint offset2)
{
if (offset2 == 0) {
prop->fontsize_data = struct_member(base,offset,real);
@@ -327,7 +325,7 @@ fontsizeprop_get_from_offset(FontsizeProperty *prop,
}
}
-static void
+static void
fontsizeprop_set_from_offset(FontsizeProperty *prop,
void *base, guint offset, guint offset2)
{
@@ -350,7 +348,7 @@ fontsizeprop_set_from_offset(FontsizeProperty *prop,
}
}
-static int
+static int
fontsizeprop_get_data_size(FontsizeProperty *prop)
{
return sizeof (prop->fontsize_data);
@@ -387,9 +385,9 @@ pointprop_new(const PropDescription *pdesc, PropDescToPropPredicate reason)
}
static PointProperty *
-pointprop_copy(PointProperty *src)
+pointprop_copy(PointProperty *src)
{
- PointProperty *prop =
+ PointProperty *prop =
(PointProperty *)src->common.ops->new_prop(src->common.descr,
src->common.reason);
copy_init_property(&prop->common,&src->common);
@@ -397,26 +395,26 @@ pointprop_copy(PointProperty *src)
return prop;
}
-static void
+static void
pointprop_load(PointProperty *prop, AttributeNode attr, DataNode data, DiaContext *ctx)
{
data_point(data,&prop->point_data, ctx);
}
-static void
-pointprop_save(PointProperty *prop, AttributeNode attr, DiaContext *ctx)
+static void
+pointprop_save(PointProperty *prop, AttributeNode attr, DiaContext *ctx)
{
data_add_point(attr, &prop->point_data, ctx);
}
-static void
+static void
pointprop_get_from_offset(PointProperty *prop,
- void *base, guint offset, guint offset2)
+ void *base, guint offset, guint offset2)
{
prop->point_data = struct_member(base,offset,Point);
}
-static void
+static void
pointprop_set_from_offset(PointProperty *prop,
void *base, guint offset, guint offset2)
{
@@ -443,7 +441,7 @@ static const PropertyOps pointprop_ops = {
/********************************/
static PointarrayProperty *
-pointarrayprop_new(const PropDescription *pdesc,
+pointarrayprop_new(const PropDescription *pdesc,
PropDescToPropPredicate reason)
{
PointarrayProperty *prop = g_new0(PointarrayProperty,1);
@@ -452,63 +450,63 @@ pointarrayprop_new(const PropDescription *pdesc,
return prop;
}
-static void
-pointarrayprop_free(PointarrayProperty *prop)
+static void
+pointarrayprop_free(PointarrayProperty *prop)
{
g_array_free(prop->pointarray_data,TRUE);
g_free(prop);
}
static PointarrayProperty *
-pointarrayprop_copy(PointarrayProperty *src)
+pointarrayprop_copy(PointarrayProperty *src)
{
guint i;
- PointarrayProperty *prop =
+ PointarrayProperty *prop =
(PointarrayProperty *)src->common.ops->new_prop(src->common.descr,
src->common.reason);
copy_init_property(&prop->common,&src->common);
g_array_set_size(prop->pointarray_data,src->pointarray_data->len);
- for (i = 0 ; i < src->pointarray_data->len; i++)
- g_array_index(prop->pointarray_data,Point,i) =
+ for (i = 0 ; i < src->pointarray_data->len; i++)
+ g_array_index(prop->pointarray_data,Point,i) =
g_array_index(src->pointarray_data,Point,i);
return prop;
}
-static void
+static void
pointarrayprop_load(PointarrayProperty *prop, AttributeNode attr, DataNode data, DiaContext *ctx)
{
guint nvals = attribute_num_data(attr);
guint i;
g_array_set_size(prop->pointarray_data,nvals);
- for (i=0; (i < nvals) && data; i++, data = data_next(data))
+ for (i=0; (i < nvals) && data; i++, data = data_next(data))
data_point(data,&g_array_index(prop->pointarray_data,Point,i),ctx);
- if (i != nvals)
+ if (i != nvals)
g_warning("attribute_num_data() and actual data count mismatch "
"(shouldn't happen)");
}
-static void
-pointarrayprop_save(PointarrayProperty *prop, AttributeNode attr, DiaContext *ctx)
+static void
+pointarrayprop_save(PointarrayProperty *prop, AttributeNode attr, DiaContext *ctx)
{
guint i;
for (i = 0; i < prop->pointarray_data->len; i++)
data_add_point(attr, &g_array_index(prop->pointarray_data,Point,i), ctx);
}
-static void
+static void
pointarrayprop_get_from_offset(PointarrayProperty *prop,
- void *base, guint offset, guint offset2)
+ void *base, guint offset, guint offset2)
{
guint nvals = struct_member(base,offset2,guint);
guint i;
void *ofs_val = struct_member(base,offset,void *);
g_array_set_size(prop->pointarray_data,nvals);
for (i = 0; i < nvals; i++)
- g_array_index(prop->pointarray_data,Point,i) =
+ g_array_index(prop->pointarray_data,Point,i) =
struct_member(ofs_val,i * sizeof(Point),Point);
}
-static void
+static void
pointarrayprop_set_from_offset(PointarrayProperty *prop,
void *base, guint offset, guint offset2)
{
@@ -541,7 +539,7 @@ static const PropertyOps pointarrayprop_ops = {
/********************************/
static BezPointProperty *
-bezpointprop_new(const PropDescription *pdesc,
+bezpointprop_new(const PropDescription *pdesc,
PropDescToPropPredicate reason)
{
BezPointProperty *prop = g_new0(BezPointProperty,1);
@@ -551,9 +549,9 @@ bezpointprop_new(const PropDescription *pdesc,
}
static BezPointProperty *
-bezpointprop_copy(BezPointProperty *src)
+bezpointprop_copy(BezPointProperty *src)
{
- BezPointProperty *prop =
+ BezPointProperty *prop =
(BezPointProperty *)src->common.ops->new_prop(src->common.descr,
src->common.reason);
copy_init_property(&prop->common,&src->common);
@@ -561,26 +559,26 @@ bezpointprop_copy(BezPointProperty *src)
return prop;
}
-static void
+static void
bezpointprop_load(BezPointProperty *prop, AttributeNode attr, DataNode data, DiaContext *ctx)
{
data_bezpoint(data,&prop->bezpoint_data,ctx);
}
-static void
-bezpointprop_save(BezPointProperty *prop, AttributeNode attr, DiaContext *ctx)
+static void
+bezpointprop_save(BezPointProperty *prop, AttributeNode attr, DiaContext *ctx)
{
data_add_bezpoint(attr, &prop->bezpoint_data, ctx);
}
-static void
+static void
bezpointprop_get_from_offset(BezPointProperty *prop,
- void *base, guint offset, guint offset2)
+ void *base, guint offset, guint offset2)
{
prop->bezpoint_data = struct_member(base,offset,BezPoint);
}
-static void
+static void
bezpointprop_set_from_offset(BezPointProperty *prop,
void *base, guint offset, guint offset2)
{
@@ -607,7 +605,7 @@ static const PropertyOps bezpointprop_ops = {
/*************************************/
static BezPointarrayProperty *
-bezpointarrayprop_new(const PropDescription *pdesc,
+bezpointarrayprop_new(const PropDescription *pdesc,
PropDescToPropPredicate reason)
{
BezPointarrayProperty *prop = g_new0(BezPointarrayProperty,1);
@@ -616,30 +614,30 @@ bezpointarrayprop_new(const PropDescription *pdesc,
return prop;
}
-static void
-bezpointarrayprop_free(BezPointarrayProperty *prop)
+static void
+bezpointarrayprop_free(BezPointarrayProperty *prop)
{
g_array_free(prop->bezpointarray_data,TRUE);
g_free(prop);
}
static BezPointarrayProperty *
-bezpointarrayprop_copy(BezPointarrayProperty *src)
+bezpointarrayprop_copy(BezPointarrayProperty *src)
{
guint i;
- BezPointarrayProperty *prop =
+ BezPointarrayProperty *prop =
(BezPointarrayProperty *)src->common.ops->new_prop(src->common.descr,
src->common.reason);
copy_init_property(&prop->common,&src->common);
g_array_set_size(prop->bezpointarray_data,src->bezpointarray_data->len);
- for (i = 0 ; i < src->bezpointarray_data->len; i++)
- g_array_index(prop->bezpointarray_data,BezPoint,i) =
+ for (i = 0 ; i < src->bezpointarray_data->len; i++)
+ g_array_index(prop->bezpointarray_data,BezPoint,i) =
g_array_index(src->bezpointarray_data,BezPoint,i);
return prop;
}
-static void
-bezpointarrayprop_load(BezPointarrayProperty *prop,
+static void
+bezpointarrayprop_load(BezPointarrayProperty *prop,
AttributeNode attr, DataNode data,
DiaContext *ctx)
{
@@ -648,36 +646,36 @@ bezpointarrayprop_load(BezPointarrayProperty *prop,
g_array_set_size(prop->bezpointarray_data,nvals);
- for (i=0; (i < nvals) && data; i++, data = data_next(data))
+ for (i=0; (i < nvals) && data; i++, data = data_next(data))
data_bezpoint(data,&g_array_index(prop->bezpointarray_data,BezPoint,i),ctx);
- if (i != nvals)
+ if (i != nvals)
g_warning("attribute_num_data() and actual data count mismatch "
"(shouldn't happen)");
}
-static void
-bezpointarrayprop_save(BezPointarrayProperty *prop, AttributeNode attr, DiaContext *ctx)
+static void
+bezpointarrayprop_save(BezPointarrayProperty *prop, AttributeNode attr, DiaContext *ctx)
{
guint i;
for (i = 0; i < prop->bezpointarray_data->len; i++)
- data_add_bezpoint(attr,
+ data_add_bezpoint(attr,
&g_array_index(prop->bezpointarray_data,BezPoint,i), ctx);
}
-static void
+static void
bezpointarrayprop_get_from_offset(BezPointarrayProperty *prop,
- void *base, guint offset, guint offset2)
+ void *base, guint offset, guint offset2)
{
guint nvals = struct_member(base,offset2,guint);
guint i;
void *ofs_val = struct_member(base,offset,void *);
g_array_set_size(prop->bezpointarray_data,nvals);
for (i = 0; i < nvals; i++)
- g_array_index(prop->bezpointarray_data,BezPoint,i) =
+ g_array_index(prop->bezpointarray_data,BezPoint,i) =
struct_member(ofs_val,i * sizeof(BezPoint),BezPoint);
}
-static void
+static void
bezpointarrayprop_set_from_offset(BezPointarrayProperty *prop,
void *base, guint offset, guint offset2)
{
@@ -719,9 +717,9 @@ rectprop_new(const PropDescription *pdesc, PropDescToPropPredicate reason)
}
static RectProperty *
-rectprop_copy(RectProperty *src)
+rectprop_copy(RectProperty *src)
{
- RectProperty *prop =
+ RectProperty *prop =
(RectProperty *)src->common.ops->new_prop(src->common.descr,
src->common.reason);
copy_init_property(&prop->common,&src->common);
@@ -729,26 +727,26 @@ rectprop_copy(RectProperty *src)
return prop;
}
-static void
+static void
rectprop_load(RectProperty *prop, AttributeNode attr, DataNode data, DiaContext *ctx)
{
data_rectangle(data,&prop->rect_data,ctx);
}
-static void
-rectprop_save(RectProperty *prop, AttributeNode attr, DiaContext *ctx)
+static void
+rectprop_save(RectProperty *prop, AttributeNode attr, DiaContext *ctx)
{
data_add_rectangle(attr, &prop->rect_data, ctx);
}
-static void
+static void
rectprop_get_from_offset(RectProperty *prop,
- void *base, guint offset, guint offset2)
+ void *base, guint offset, guint offset2)
{
prop->rect_data = struct_member(base,offset,Rectangle);
}
-static void
+static void
rectprop_set_from_offset(RectProperty *prop,
void *base, guint offset, guint offset2)
{
@@ -775,7 +773,7 @@ static const PropertyOps rectprop_ops = {
/*********************************/
static EndpointsProperty *
-endpointsprop_new(const PropDescription *pdesc,
+endpointsprop_new(const PropDescription *pdesc,
PropDescToPropPredicate reason)
{
EndpointsProperty *prop = g_new0(EndpointsProperty,1);
@@ -785,9 +783,9 @@ endpointsprop_new(const PropDescription *pdesc,
}
static EndpointsProperty *
-endpointsprop_copy(EndpointsProperty *src)
+endpointsprop_copy(EndpointsProperty *src)
{
- EndpointsProperty *prop =
+ EndpointsProperty *prop =
(EndpointsProperty *)src->common.ops->new_prop(src->common.descr,
src->common.reason);
copy_init_property(&prop->common,&src->common);
@@ -797,7 +795,7 @@ endpointsprop_copy(EndpointsProperty *src)
return prop;
}
-static void
+static void
endpointsprop_load(EndpointsProperty *prop, AttributeNode attr, DataNode data, DiaContext *ctx)
{
data_point(data,&prop->endpoints_data[0], ctx);
@@ -805,23 +803,23 @@ endpointsprop_load(EndpointsProperty *prop, AttributeNode attr, DataNode data, D
data_point(data,&prop->endpoints_data[1], ctx);
}
-static void
-endpointsprop_save(EndpointsProperty *prop, AttributeNode attr, DiaContext *ctx)
+static void
+endpointsprop_save(EndpointsProperty *prop, AttributeNode attr, DiaContext *ctx)
{
data_add_point(attr, &prop->endpoints_data[0], ctx);
data_add_point(attr, &prop->endpoints_data[1], ctx);
}
-static void
+static void
endpointsprop_get_from_offset(EndpointsProperty *prop,
- void *base, guint offset, guint offset2)
+ void *base, guint offset, guint offset2)
{
memcpy(&prop->endpoints_data,
&struct_member(base,offset,Point),
sizeof(prop->endpoints_data));
}
-static void
+static void
endpointsprop_set_from_offset(EndpointsProperty *prop,
void *base, guint offset, guint offset2)
{
@@ -850,7 +848,7 @@ static const PropertyOps endpointsprop_ops = {
/***************************/
static Connpoint_LineProperty *
-connpoint_lineprop_new(const PropDescription *pdesc,
+connpoint_lineprop_new(const PropDescription *pdesc,
PropDescToPropPredicate reason)
{
Connpoint_LineProperty *prop = g_new0(Connpoint_LineProperty,1);
@@ -860,9 +858,9 @@ connpoint_lineprop_new(const PropDescription *pdesc,
}
static Connpoint_LineProperty *
-connpoint_lineprop_copy(Connpoint_LineProperty *src)
+connpoint_lineprop_copy(Connpoint_LineProperty *src)
{
- Connpoint_LineProperty *prop =
+ Connpoint_LineProperty *prop =
(Connpoint_LineProperty *)src->common.ops->new_prop(src->common.descr,
src->common.reason);
copy_init_property(&prop->common,&src->common);
@@ -870,28 +868,28 @@ connpoint_lineprop_copy(Connpoint_LineProperty *src)
return prop;
}
-static void
-connpoint_lineprop_load(Connpoint_LineProperty *prop, AttributeNode attr,
+static void
+connpoint_lineprop_load(Connpoint_LineProperty *prop, AttributeNode attr,
DataNode data, DiaContext *ctx)
{
prop->connpoint_line_data = data_int(data,ctx);
}
-static void
-connpoint_lineprop_save(Connpoint_LineProperty *prop, AttributeNode attr, DiaContext *ctx)
+static void
+connpoint_lineprop_save(Connpoint_LineProperty *prop, AttributeNode attr, DiaContext *ctx)
{
data_add_int(attr, prop->connpoint_line_data, ctx);
}
-static void
+static void
connpoint_lineprop_get_from_offset(Connpoint_LineProperty *prop,
- void *base, guint offset, guint offset2)
+ void *base, guint offset, guint offset2)
{
- prop->connpoint_line_data =
+ prop->connpoint_line_data =
struct_member(base,offset,ConnPointLine *)->num_connections;
}
-static void
+static void
connpoint_lineprop_set_from_offset(Connpoint_LineProperty *prop,
void *base, guint offset, guint offset2)
{
@@ -916,9 +914,9 @@ static const PropertyOps connpoint_lineprop_ops = {
};
-/* ************************************************************** */
+/* ************************************************************** */
-void
+void
prop_geomtypes_register(void)
{
prop_type_register(PROP_TYPE_REAL,&realprop_ops);
diff --git a/lib/prop_inttypes.c b/lib/prop_inttypes.c
index 5cecf9da..1bf1eee9 100644
--- a/lib/prop_inttypes.c
+++ b/lib/prop_inttypes.c
@@ -23,9 +23,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <stdlib.h> /* strtol */
diff --git a/lib/prop_sdarray.c b/lib/prop_sdarray.c
index 5995820f..be8c422c 100644
--- a/lib/prop_sdarray.c
+++ b/lib/prop_sdarray.c
@@ -24,9 +24,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <gtk/gtk.h>
#define WIDGET GtkWidget
@@ -45,7 +43,7 @@ arrayprop_new(const PropDescription *pdesc, PropDescToPropPredicate reason)
ArrayProperty *prop = g_new0(ArrayProperty,1);
const PropDescCommonArrayExtra *extra = pdesc->extra_data;
- initialize_property(&prop->common, pdesc, reason);
+ initialize_property(&prop->common, pdesc, reason);
prop->ex_props = prop_list_from_descs(extra->record,reason);
prop->records = g_ptr_array_new();
return prop;
@@ -56,22 +54,22 @@ arrayprop_freerecords(ArrayProperty *prop) /* but not the array itself. */
{
guint i;
- for (i=0; i < prop->records->len; i++)
+ for (i=0; i < prop->records->len; i++)
prop_list_free(g_ptr_array_index(prop->records,i));
}
static void
-arrayprop_free(ArrayProperty *prop)
+arrayprop_free(ArrayProperty *prop)
{
arrayprop_freerecords(prop);
g_ptr_array_free(prop->records,TRUE);
g_free(prop);
-}
+}
static ArrayProperty *
-arrayprop_copy(ArrayProperty *src)
+arrayprop_copy(ArrayProperty *src)
{
- ArrayProperty *prop =
+ ArrayProperty *prop =
(ArrayProperty *)src->common.ops->new_prop(src->common.descr,
src->common.reason);
guint i;
@@ -85,7 +83,7 @@ arrayprop_copy(ArrayProperty *src)
return prop;
}
-static void
+static void
arrayprop_load(ArrayProperty *prop, AttributeNode attr, DataNode data, DiaContext *ctx)
{
const PropDescCommonArrayExtra *extra = prop->common.descr->extra_data;
@@ -94,8 +92,8 @@ arrayprop_load(ArrayProperty *prop, AttributeNode attr, DataNode data, DiaContex
arrayprop_freerecords(prop);
g_ptr_array_set_size(prop->records,0);
- for (composite = data;
- composite != NULL;
+ for (composite = data;
+ composite != NULL;
composite = data_next(composite)) {
GPtrArray *record = prop_list_from_descs(extra->record,
prop->common.reason);
@@ -106,21 +104,21 @@ arrayprop_load(ArrayProperty *prop, AttributeNode attr, DataNode data, DiaContex
}
}
-static void
-arrayprop_save(ArrayProperty *prop, AttributeNode attr, DiaContext *ctx)
+static void
+arrayprop_save(ArrayProperty *prop, AttributeNode attr, DiaContext *ctx)
{
guint i;
const PropDescCommonArrayExtra *extra = prop->common.descr->extra_data;
-
+
for (i = 0; i < prop->records->len; i++) {
prop_list_save(g_ptr_array_index(prop->records,i),
data_add_composite(attr, extra->composite_type, ctx), ctx);
}
}
-static void
+static void
sarrayprop_get_from_offset(ArrayProperty *prop,
- void *base, guint offset, guint offset2)
+ void *base, guint offset, guint offset2)
{
const PropDescSArrayExtra *extra = prop->common.descr->extra_data;
PropOffset *suboffsets = extra->common.offsets;
@@ -137,13 +135,13 @@ sarrayprop_get_from_offset(ArrayProperty *prop,
char);
GPtrArray *subprops = prop_list_copy(prop->ex_props);
- do_get_props_from_offsets(rec_in_obj,subprops,suboffsets);
+ do_get_props_from_offsets(rec_in_obj,subprops,suboffsets);
g_ptr_array_index(prop->records,i) = subprops;
}
}
-static void
+static void
sarrayprop_set_from_offset(ArrayProperty *prop,
void *base, guint offset, guint offset2)
{
@@ -165,9 +163,9 @@ sarrayprop_set_from_offset(ArrayProperty *prop,
}
}
-static void
+static void
darrayprop_get_from_offset(ArrayProperty *prop,
- void *base, guint offset, guint offset2)
+ void *base, guint offset, guint offset2)
{
/* This sucks. We do almost exactly like in sarrayprop_get_from_offset(). */
const PropDescSArrayExtra *extra = prop->common.descr->extra_data;
@@ -181,12 +179,12 @@ darrayprop_get_from_offset(ArrayProperty *prop,
g_ptr_array_set_size(prop->records,0);
for (obj_rec = g_list_first(obj_rec), i = 0;
- obj_rec != NULL;
+ obj_rec != NULL;
obj_rec = g_list_next(obj_rec), i++) {
void *rec_in_obj = obj_rec->data;
GPtrArray *subprops = prop_list_copy(prop->ex_props);
- do_get_props_from_offsets(rec_in_obj,subprops,suboffsets);
+ do_get_props_from_offsets(rec_in_obj,subprops,suboffsets);
g_ptr_array_add(prop->records,subprops);
}
@@ -211,7 +209,7 @@ darrayprop_adjust_object_records(ArrayProperty *prop,
return obj_rec;
}
-static void
+static void
darrayprop_set_from_offset(ArrayProperty *prop,
void *base, guint offset, guint offset2)
{
@@ -227,7 +225,7 @@ darrayprop_set_from_offset(ArrayProperty *prop,
struct_member(base,offset,GList *) = obj_rec;
for (obj_rec = g_list_first(obj_rec), i = 0;
- obj_rec != NULL;
+ obj_rec != NULL;
obj_rec = g_list_next(obj_rec), i++) {
void *rec_in_obj = obj_rec->data;
GPtrArray *subprops = g_ptr_array_index(prop->records,i);
@@ -240,27 +238,27 @@ darrayprop_set_from_offset(ArrayProperty *prop,
* Create a dialog containing the list of array properties
*/
static WIDGET *
-arrayprop_get_widget(ArrayProperty *prop, PropDialog *dialog)
+arrayprop_get_widget(ArrayProperty *prop, PropDialog *dialog)
{
GtkWidget *ret = _arrayprop_get_widget (prop, dialog);
- return ret;
+ return ret;
}
-static void
+static void
arrayprop_reset_widget(ArrayProperty *prop, WIDGET *widget)
{
_arrayprop_reset_widget (prop, widget);
}
-static void
-arrayprop_set_from_widget(ArrayProperty *prop, WIDGET *widget)
+static void
+arrayprop_set_from_widget(ArrayProperty *prop, WIDGET *widget)
{
_arrayprop_set_from_widget (prop, widget);
}
-static gboolean
-arrayprop_can_merge(const PropDescription *pd1, const PropDescription *pd2)
+static gboolean
+arrayprop_can_merge(const PropDescription *pd1, const PropDescription *pd2)
{
if (pd1->extra_data != pd2->extra_data) return FALSE;
return TRUE;
@@ -277,7 +275,7 @@ static const PropertyOps sarrayprop_ops = {
(PropertyType_ResetWidget) arrayprop_reset_widget,
(PropertyType_SetFromWidget) arrayprop_set_from_widget,
- (PropertyType_CanMerge) arrayprop_can_merge,
+ (PropertyType_CanMerge) arrayprop_can_merge,
(PropertyType_GetFromOffset) sarrayprop_get_from_offset,
(PropertyType_SetFromOffset) sarrayprop_set_from_offset
};
@@ -293,14 +291,14 @@ static const PropertyOps darrayprop_ops = {
(PropertyType_ResetWidget) arrayprop_reset_widget,
(PropertyType_SetFromWidget) arrayprop_set_from_widget,
- (PropertyType_CanMerge) noopprop_can_merge,
+ (PropertyType_CanMerge) noopprop_can_merge,
(PropertyType_GetFromOffset) darrayprop_get_from_offset,
(PropertyType_SetFromOffset) darrayprop_set_from_offset
};
-/* ************************************************************** */
+/* ************************************************************** */
-void
+void
prop_sdarray_register(void)
{
prop_type_register(PROP_TYPE_SARRAY,&sarrayprop_ops);
diff --git a/lib/prop_sdarray_widget.c b/lib/prop_sdarray_widget.c
index 683aab3c..b6d34240 100644
--- a/lib/prop_sdarray_widget.c
+++ b/lib/prop_sdarray_widget.c
@@ -24,38 +24,36 @@
*/
/*
- The basic idea is to register *every* Dia property within the GType system.
+ The basic idea is to register *every* Dia property within the GType system.
Thus we could just put these into e.g. a list-store, but some range checking
may also be possible for load/bindings/etc.
-
- The registered type could replace the type quark as it would give a fast
+
+ The registered type could replace the type quark as it would give a fast
unique number as well.
-
- Prop names with namespces like UML? No. they would by nothing new, a simple
- 'dia__' should be enough to make them unique. Also the basic idea of Dia's
- property type system always was: same name, same type.
+
+ Prop names with namespces like UML? No. they would by nothing new, a simple
+ 'dia__' should be enough to make them unique. Also the basic idea of Dia's
+ property type system always was: same name, same type.
Stuff like 'line_width' should mean the same everywhere ...
*BUT* does the same assumption hold for 'attributes (UML::Class|Database::Table)' ??
-
+
First iteration:
- dia prop type (PROP_TYPE_*) plus member name ('line_width') give a unique GType
+ PROP_TYPE_INT also may include a range
+ PROP_TYPE_ENUM
- -
-
+ -
+
WHEN TO REGISTER?
- during prop_desc_list_calculate_quarks() that is on firts access of *_describe_props()
- - (eralier?) during object_register_type() -
+ - (eralier?) during object_register_type() -
SO MUCH FOR THE ORIGINAL IDEA.
what's been implemented below is something a lot simpler, just enough to
support exisiting ArrayProp usage ;)
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include "properties.h"
#include "propinternals.h"
@@ -84,7 +82,7 @@ _cell_renderer_real_new (const Property *p)
/* must be non NULL to make it editable */
adj = GTK_ADJUSTMENT (gtk_adjustment_new (prop->real_data,
numdata->min, numdata->max,
- numdata->step,
+ numdata->step,
10.0 * numdata->step, 0));
g_object_set (G_OBJECT (cren), "adjustment", adj, NULL);
@@ -113,9 +111,9 @@ _toggle_callback (GtkCellRendererToggle *renderer,
column = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (renderer), COLUMN_KEY));
- gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
column, &value, -1);
- gtk_tree_store_set (GTK_TREE_STORE (model), &iter,
+ gtk_tree_store_set (GTK_TREE_STORE (model), &iter,
column, !value, -1);
g_object_set_data (G_OBJECT (model), "modified", GINT_TO_POINTER (1));
}
@@ -124,7 +122,7 @@ _cell_renderer_toggle_new (const Property *p, GtkTreeView *view)
{
GtkCellRenderer *cren = gtk_cell_renderer_toggle_new ();
- g_object_set (G_OBJECT (cren),
+ g_object_set (G_OBJECT (cren),
"mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE,
"activatable", TRUE,
NULL);
@@ -155,10 +153,10 @@ _text_edited (GtkCellRenderer *renderer,
column = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (renderer), COLUMN_KEY));
- gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (model), &iter,
column, &value, -1);
g_free (value);
- gtk_tree_store_set (GTK_TREE_STORE (model), &iter,
+ gtk_tree_store_set (GTK_TREE_STORE (model), &iter,
column, g_strdup (new_text), -1);
g_object_set_data (G_OBJECT (model), "modified", GINT_TO_POINTER (1));
}
@@ -585,7 +583,7 @@ _write_store (GtkTreeStore *store, GtkTreeIter *parent_iter, ArrayProperty *prop
for (j = 0; j < rows; ++j) {
GtkTreeIter iter;
GPtrArray *r = g_ptr_array_index(prop->records, j);
-
+
gtk_tree_store_append (store, &iter, parent_iter);
for (i = 0; i < cols; ++i) {
@@ -621,7 +619,7 @@ _write_store (GtkTreeStore *store, GtkTreeIter *parent_iter, ArrayProperty *prop
}
}
-/*!
+/*!
* PropertyType_ResetWidget: get the value of the property into the widget
*/
void
@@ -680,7 +678,7 @@ _array_prop_adjust_len (ArrayProperty *prop, guint len)
return TRUE;
}
/*!
- * \brief Transfer from the view model to the property
+ * \brief Transfer from the view model to the property
*/
static void
_read_store (GtkTreeStore *store, GtkTreeIter *iter, ArrayProperty *prop)
@@ -691,7 +689,7 @@ _read_store (GtkTreeStore *store, GtkTreeIter *iter, ArrayProperty *prop)
gboolean modified;
cols = prop->ex_props->len;
-
+
if (gtk_tree_model_iter_parent (model, &parent_iter, iter))
modified = _array_prop_adjust_len (prop, gtk_tree_model_iter_n_children (model, &parent_iter));
else
@@ -747,12 +745,12 @@ _read_store (GtkTreeStore *store, GtkTreeIter *iter, ArrayProperty *prop)
}
}
-/*!
- * PropertyType_SetFromWidget: set the value of the property from the
+/*!
+ * PropertyType_SetFromWidget: set the value of the property from the
* current value of the widget
*/
-void
-_arrayprop_set_from_widget(ArrayProperty *prop, WIDGET *widget)
+void
+_arrayprop_set_from_widget(ArrayProperty *prop, WIDGET *widget)
{
GtkWidget *view = widget;
GtkTreeView *tree_view = g_object_get_data (G_OBJECT (view), "tree-view");
diff --git a/lib/prop_text.c b/lib/prop_text.c
index 5a4ff904..1828b49a 100644
--- a/lib/prop_text.c
+++ b/lib/prop_text.c
@@ -23,9 +23,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <gtk/gtk.h>
#include <gdk/gdk.h>
@@ -52,7 +50,7 @@ stringprop_new(const PropDescription *pdesc, PropDescToPropPredicate reason)
}
static StringProperty *
-multistringprop_new(const PropDescription *pdesc,
+multistringprop_new(const PropDescription *pdesc,
PropDescToPropPredicate reason)
{
StringProperty *prop = g_new0(StringProperty,1);
@@ -63,9 +61,9 @@ multistringprop_new(const PropDescription *pdesc,
}
static StringProperty *
-stringprop_copy(StringProperty *src)
+stringprop_copy(StringProperty *src)
{
- StringProperty *prop =
+ StringProperty *prop =
(StringProperty *)src->common.ops->new_prop(src->common.descr,
src->common.reason);
copy_init_property(&prop->common,&src->common);
@@ -77,31 +75,31 @@ stringprop_copy(StringProperty *src)
return prop;
}
-static void
-stringprop_free(StringProperty *prop)
+static void
+stringprop_free(StringProperty *prop)
{
g_free(prop->string_data);
g_free(prop);
}
static GtkWidget *
-stringprop_get_widget(StringProperty *prop, PropDialog *dialog)
-{
+stringprop_get_widget(StringProperty *prop, PropDialog *dialog)
+{
GtkWidget *ret = gtk_entry_new();
gtk_entry_set_activates_default(GTK_ENTRY(ret), TRUE);
prophandler_connect(&prop->common, G_OBJECT(ret), "changed");
return ret;
}
-static void
+static void
stringprop_reset_widget(StringProperty *prop, GtkWidget *widget)
{
gtk_entry_set_text(GTK_ENTRY(widget),
prop->string_data ? prop->string_data : "");
}
-static void
-stringprop_set_from_widget(StringProperty *prop, GtkWidget *widget)
+static void
+stringprop_set_from_widget(StringProperty *prop, GtkWidget *widget)
{
g_free(prop->string_data);
prop->string_data =
@@ -115,27 +113,27 @@ multistringprop_handle_key(GtkWidget *wid, GdkEventKey *event)
/** Actually, this doesn't seem to work -- I guess the dialog closes
* becore this is called :(
*/
- if (event->keyval == GDK_Return)
+ if (event->keyval == GDK_Return)
return TRUE;
return FALSE;
}
static GtkWidget *
-multistringprop_get_widget(StringProperty *prop, PropDialog *dialog)
-{
+multistringprop_get_widget(StringProperty *prop, PropDialog *dialog)
+{
GtkWidget *ret = gtk_text_view_new();
GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(ret));
GtkWidget *frame = gtk_frame_new(NULL);
gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
gtk_container_add(GTK_CONTAINER(frame), ret);
- g_signal_connect(G_OBJECT(ret), "key-release-event",
+ g_signal_connect(G_OBJECT(ret), "key-release-event",
G_CALLBACK(multistringprop_handle_key), NULL);
gtk_widget_show(ret);
prophandler_connect(&prop->common, G_OBJECT(buffer), "changed");
return frame;
}
-static void
+static void
multistringprop_reset_widget(StringProperty *prop, GtkWidget *widget)
{
GtkWidget *textview = gtk_bin_get_child(GTK_BIN(widget));
@@ -157,8 +155,8 @@ multistringprop_set_from_widget(StringProperty *prop, GtkWidget *widget) {
}
static GtkWidget *
-fileprop_get_widget(StringProperty *prop, PropDialog *dialog)
-{
+fileprop_get_widget(StringProperty *prop, PropDialog *dialog)
+{
GtkWidget *ret = dia_file_selector_new();
if (prop->common.descr->extra_data)
dia_file_selector_set_extensions (DIAFILESELECTOR(ret), prop->common.descr->extra_data);
@@ -166,22 +164,22 @@ fileprop_get_widget(StringProperty *prop, PropDialog *dialog)
return ret;
}
-static void
+static void
fileprop_reset_widget(StringProperty *prop, GtkWidget *widget)
{
if (prop->string_data)
dia_file_selector_set_file(DIAFILESELECTOR(widget),prop->string_data);
}
-static void
-fileprop_set_from_widget(StringProperty *prop, GtkWidget *widget)
+static void
+fileprop_set_from_widget(StringProperty *prop, GtkWidget *widget)
{
g_free(prop->string_data);
- prop->string_data =
+ prop->string_data =
g_strdup(dia_file_selector_get_file(DIAFILESELECTOR(widget)));
}
-static void
+static void
stringprop_load(StringProperty *prop, AttributeNode attr, DataNode data, DiaContext *ctx)
{
g_free(prop->string_data);
@@ -191,21 +189,21 @@ stringprop_load(StringProperty *prop, AttributeNode attr, DataNode data, DiaCont
}
}
-static void
-stringprop_save(StringProperty *prop, AttributeNode attr, DiaContext *ctx)
+static void
+stringprop_save(StringProperty *prop, AttributeNode attr, DiaContext *ctx)
{
data_add_string(attr, prop->string_data, ctx);
}
-static void
+static void
stringprop_get_from_offset(StringProperty *prop,
- void *base, guint offset, guint offset2)
+ void *base, guint offset, guint offset2)
{
g_free(prop->string_data);
prop->string_data = g_strdup(struct_member(base,offset,gchar *));
}
-static void
+static void
stringprop_set_from_offset(StringProperty *prop,
void *base, guint offset, guint offset2)
{
@@ -213,7 +211,7 @@ stringprop_set_from_offset(StringProperty *prop,
struct_member(base,offset,gchar *) = g_strdup(prop->string_data);
}
-static int
+static int
stringprop_get_data_size(StringProperty *prop)
{
return sizeof (prop->string_data); /* only the pointer */
@@ -229,7 +227,7 @@ stringlistprop_new(const PropDescription *pdesc, PropDescToPropPredicate reason)
}
static void
-stringlistprop_free(StringListProperty *prop)
+stringlistprop_free(StringListProperty *prop)
{
g_list_foreach(prop->string_list, (GFunc)g_free, NULL);
g_list_free(prop->string_list);
@@ -237,9 +235,9 @@ stringlistprop_free(StringListProperty *prop)
}
static StringListProperty *
-stringlistprop_copy(StringListProperty *src)
+stringlistprop_copy(StringListProperty *src)
{
- StringListProperty *prop =
+ StringListProperty *prop =
(StringListProperty *)src->common.ops->new_prop(src->common.descr,
src->common.reason);
copy_init_property(&prop->common,&src->common);
@@ -254,21 +252,21 @@ stringlistprop_copy(StringListProperty *src)
return prop;
}
-static void
+static void
stringlistprop_load(StringListProperty *prop, AttributeNode attr, DataNode data, DiaContext *ctx)
{
g_warning("stringlistprop_load not implemented");
}
-static void
-stringlistprop_save(StringProperty *prop, AttributeNode attr)
+static void
+stringlistprop_save(StringProperty *prop, AttributeNode attr)
{
g_warning("stringlistprop_save not implemented");
}
-static void
+static void
stringlistprop_get_from_offset(StringListProperty *prop,
- void *base, guint offset, guint offset2)
+ void *base, guint offset, guint offset2)
{
GList *tmp, *lst = prop->string_list;
@@ -279,7 +277,7 @@ stringlistprop_get_from_offset(StringListProperty *prop,
prop->string_list = lst;
}
-static void
+static void
stringlistprop_set_from_offset(StringListProperty *prop,
void *base, guint offset, guint offset2)
{
@@ -373,9 +371,9 @@ textprop_new(const PropDescription *pdesc, PropDescToPropPredicate reason)
}
static TextProperty *
-textprop_copy(TextProperty *src)
+textprop_copy(TextProperty *src)
{
- TextProperty *prop =
+ TextProperty *prop =
(TextProperty *)src->common.ops->new_prop(src->common.descr,
src->common.reason);
copy_init_property(&prop->common,&src->common);
@@ -386,8 +384,8 @@ textprop_copy(TextProperty *src)
return prop;
}
-static void
-textprop_free(TextProperty *prop)
+static void
+textprop_free(TextProperty *prop)
{
if (prop->attr.font)
dia_font_unref(prop->attr.font);
@@ -395,7 +393,7 @@ textprop_free(TextProperty *prop)
g_free(prop);
}
-static void
+static void
textprop_load(TextProperty *prop, AttributeNode attr, DataNode data, DiaContext *ctx)
{
Text *text;
@@ -406,8 +404,8 @@ textprop_load(TextProperty *prop, AttributeNode attr, DataNode data, DiaContext
text_destroy(text);
}
-static void
-textprop_save(TextProperty *prop, AttributeNode attr, DiaContext *ctx)
+static void
+textprop_save(TextProperty *prop, AttributeNode attr, DiaContext *ctx)
{
Text *text = new_text(prop->text_data,
prop->attr.font,
@@ -419,9 +417,9 @@ textprop_save(TextProperty *prop, AttributeNode attr, DiaContext *ctx)
text_destroy(text);
}
-static void
+static void
textprop_get_from_offset(TextProperty *prop,
- void *base, guint offset, guint offset2)
+ void *base, guint offset, guint offset2)
{
Text *text = struct_member(base,offset,Text *);
g_free(prop->text_data);
@@ -429,7 +427,7 @@ textprop_get_from_offset(TextProperty *prop,
text_get_attributes(text,&prop->attr);
}
-static void
+static void
textprop_set_from_offset(TextProperty *prop,
void *base, guint offset, guint offset2)
{
@@ -454,9 +452,9 @@ static const PropertyOps textprop_ops = {
(PropertyType_SetFromOffset) textprop_set_from_offset
};
-/* ************************************************************** */
+/* ************************************************************** */
-void
+void
prop_text_register(void)
{
prop_type_register(PROP_TYPE_STRING,&stringprop_ops);
@@ -477,7 +475,7 @@ object_get_displayname (DiaObject* object)
if (!object)
return g_strdup ("<null>"); /* should not happen */
-
+
if (IS_GROUP(object)) {
guint num = g_list_length(group_objects(object));
name = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE,
diff --git a/lib/prop_widgets.c b/lib/prop_widgets.c
index 4d2a12ff..71b5dd9c 100644
--- a/lib/prop_widgets.c
+++ b/lib/prop_widgets.c
@@ -22,9 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <glib.h>
#undef GTK_DISABLE_DEPRECATED /* GtkList */
@@ -39,8 +37,8 @@
/******************************/
static WIDGET *
-staticprop_get_widget(StaticProperty *prop, PropDialog *dialog)
-{
+staticprop_get_widget(StaticProperty *prop, PropDialog *dialog)
+{
GtkWidget *ret = NULL;
if (!prop->common.descr) return NULL;
@@ -59,7 +57,7 @@ static const PropertyOps staticprop_ops = {
(PropertyType_ResetWidget) noopprop_reset_widget,
(PropertyType_SetFromWidget) noopprop_set_from_widget,
- (PropertyType_CanMerge) noopprop_can_merge,
+ (PropertyType_CanMerge) noopprop_can_merge,
(PropertyType_GetFromOffset) noopprop_get_from_offset,
(PropertyType_SetFromOffset) noopprop_set_from_offset
};
@@ -70,8 +68,8 @@ static const PropertyOps staticprop_ops = {
/******************************/
static WIDGET *
-buttonprop_get_widget(ButtonProperty *prop, PropDialog *dialog)
-{
+buttonprop_get_widget(ButtonProperty *prop, PropDialog *dialog)
+{
GtkWidget *ret = NULL;
if (!prop->common.descr) return NULL;
@@ -91,7 +89,7 @@ static const PropertyOps buttonprop_ops = {
(PropertyType_ResetWidget) noopprop_reset_widget,
(PropertyType_SetFromWidget) noopprop_set_from_widget,
- (PropertyType_CanMerge) noopprop_can_merge,
+ (PropertyType_CanMerge) noopprop_can_merge,
(PropertyType_GetFromOffset) noopprop_get_from_offset,
(PropertyType_SetFromOffset) noopprop_set_from_offset
};
@@ -109,7 +107,7 @@ static void
frame_fold_unfold(GtkWidget *button1, gpointer userdata)
{
struct FoldButtonInfo *info = (struct FoldButtonInfo *)userdata;
-
+
if (button1 == info->unfoldbutton) {
gtk_widget_set_sensitive (info->unfoldbutton, FALSE);
gtk_widget_hide(info->unfoldbutton);
@@ -122,15 +120,15 @@ frame_fold_unfold(GtkWidget *button1, gpointer userdata)
}
static WIDGET *
-frame_beginprop_get_widget(FrameProperty *prop, PropDialog *dialog)
-{
+frame_beginprop_get_widget(FrameProperty *prop, PropDialog *dialog)
+{
gchar *foldstring = g_strdup_printf("%s <<<", _(prop->common.descr->description));
gchar *unfoldstring = g_strdup_printf("%s >>>", _(prop->common.descr->description));
GtkWidget *frame = gtk_frame_new(NULL);
GtkWidget *vbox = gtk_vbox_new(FALSE,2);
GtkWidget *foldbutton = gtk_button_new_with_label(foldstring);
GtkWidget *unfoldbutton = gtk_button_new_with_label(unfoldstring);
-
+
struct FoldButtonInfo *info = g_new(struct FoldButtonInfo, 1);
g_free(foldstring);
@@ -147,12 +145,12 @@ frame_beginprop_get_widget(FrameProperty *prop, PropDialog *dialog)
gtk_widget_show(foldbutton);
gtk_widget_show(frame);
gtk_widget_show(vbox);
-
+
prop_dialog_add_raw(dialog, frame);
prop_dialog_add_raw_with_flags(dialog, unfoldbutton, FALSE, FALSE);
-
- g_signal_connect(G_OBJECT (foldbutton), "clicked",
+
+ g_signal_connect(G_OBJECT (foldbutton), "clicked",
G_CALLBACK (frame_fold_unfold), info);
g_signal_connect(G_OBJECT (unfoldbutton), "clicked",
G_CALLBACK (frame_fold_unfold), info);
@@ -163,8 +161,8 @@ frame_beginprop_get_widget(FrameProperty *prop, PropDialog *dialog)
}
static WIDGET *
-frame_endprop_get_widget(FrameProperty *prop, PropDialog *dialog)
-{
+frame_endprop_get_widget(FrameProperty *prop, PropDialog *dialog)
+{
prop_dialog_container_pop(dialog);
return NULL;
}
@@ -179,7 +177,7 @@ static const PropertyOps frame_beginprop_ops = {
(PropertyType_ResetWidget) noopprop_reset_widget,
(PropertyType_SetFromWidget) noopprop_set_from_widget,
- (PropertyType_CanMerge) noopprop_can_merge,
+ (PropertyType_CanMerge) noopprop_can_merge,
(PropertyType_GetFromOffset) noopprop_get_from_offset,
(PropertyType_SetFromOffset) noopprop_set_from_offset
};
@@ -194,7 +192,7 @@ static const PropertyOps frame_endprop_ops = {
(PropertyType_ResetWidget) noopprop_reset_widget,
(PropertyType_SetFromWidget) noopprop_set_from_widget,
- (PropertyType_CanMerge) noopprop_can_merge,
+ (PropertyType_CanMerge) noopprop_can_merge,
(PropertyType_GetFromOffset) noopprop_get_from_offset,
(PropertyType_SetFromOffset) noopprop_set_from_offset
};
@@ -204,15 +202,15 @@ static const PropertyOps frame_endprop_ops = {
/*********************************************************/
static WIDGET *
-multicol_beginprop_get_widget(MulticolProperty *prop, PropDialog *dialog)
-{
+multicol_beginprop_get_widget(MulticolProperty *prop, PropDialog *dialog)
+{
GtkWidget *multicol = gtk_hbox_new(FALSE,1);
-
+
gtk_container_set_border_width (GTK_CONTAINER(multicol), 2);
gtk_widget_show(multicol);
-
+
prop_dialog_add_raw(dialog,multicol);
-
+
prop_dialog_container_push(dialog,multicol);
prop_dialog_container_push(dialog,NULL); /* there must be a _COLUMN soon */
@@ -220,26 +218,26 @@ multicol_beginprop_get_widget(MulticolProperty *prop, PropDialog *dialog)
}
static WIDGET *
-multicol_columnprop_get_widget(MulticolProperty *prop, PropDialog *dialog)
-{
+multicol_columnprop_get_widget(MulticolProperty *prop, PropDialog *dialog)
+{
GtkWidget *col = gtk_vbox_new(FALSE,1);
-
+
gtk_container_set_border_width (GTK_CONTAINER(col), 2);
gtk_widget_show(col);
-
+
prop_dialog_container_pop(dialog); /* NULL or the previous column */
-
+
gtk_box_pack_start(GTK_BOX(dialog->lastcont),col,TRUE,TRUE,0);
- prop_dialog_add_raw(dialog,NULL); /* to reset the internal table system */
+ prop_dialog_add_raw(dialog,NULL); /* to reset the internal table system */
prop_dialog_container_push(dialog,col);
- return NULL;
+ return NULL;
}
static WIDGET *
-multicol_endprop_get_widget(MulticolProperty *prop, PropDialog *dialog)
-{
+multicol_endprop_get_widget(MulticolProperty *prop, PropDialog *dialog)
+{
prop_dialog_container_pop(dialog); /* the column */
prop_dialog_container_pop(dialog); /* the multicol */
return NULL;
@@ -255,7 +253,7 @@ static const PropertyOps multicol_beginprop_ops = {
(PropertyType_ResetWidget) noopprop_reset_widget,
(PropertyType_SetFromWidget) noopprop_set_from_widget,
- (PropertyType_CanMerge) noopprop_can_merge,
+ (PropertyType_CanMerge) noopprop_can_merge,
(PropertyType_GetFromOffset) noopprop_get_from_offset,
(PropertyType_SetFromOffset) noopprop_set_from_offset
};
@@ -270,7 +268,7 @@ static const PropertyOps multicol_columnprop_ops = {
(PropertyType_ResetWidget) noopprop_reset_widget,
(PropertyType_SetFromWidget) noopprop_set_from_widget,
- (PropertyType_CanMerge) noopprop_can_merge,
+ (PropertyType_CanMerge) noopprop_can_merge,
(PropertyType_GetFromOffset) noopprop_get_from_offset,
(PropertyType_SetFromOffset) noopprop_set_from_offset
};
@@ -285,7 +283,7 @@ static const PropertyOps multicol_endprop_ops = {
(PropertyType_ResetWidget) noopprop_reset_widget,
(PropertyType_SetFromWidget) noopprop_set_from_widget,
- (PropertyType_CanMerge) noopprop_can_merge,
+ (PropertyType_CanMerge) noopprop_can_merge,
(PropertyType_GetFromOffset) noopprop_get_from_offset,
(PropertyType_SetFromOffset) noopprop_set_from_offset
};
@@ -295,16 +293,16 @@ static const PropertyOps multicol_endprop_ops = {
/*********************************************************/
static WIDGET *
-notebook_beginprop_get_widget(NotebookProperty *prop, PropDialog *dialog)
-{
+notebook_beginprop_get_widget(NotebookProperty *prop, PropDialog *dialog)
+{
GtkWidget *notebook = gtk_notebook_new();
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook),GTK_POS_TOP);
gtk_container_set_border_width (GTK_CONTAINER(notebook), 1);
gtk_widget_show(notebook);
-
+
prop_dialog_add_raw(dialog,notebook);
-
+
prop_dialog_container_push(dialog,notebook);
prop_dialog_container_push(dialog,NULL); /* there must be a _PAGE soon */
@@ -312,28 +310,28 @@ notebook_beginprop_get_widget(NotebookProperty *prop, PropDialog *dialog)
}
static WIDGET *
-notebook_pageprop_get_widget(NotebookProperty *prop, PropDialog *dialog)
-{
+notebook_pageprop_get_widget(NotebookProperty *prop, PropDialog *dialog)
+{
GtkWidget *page = gtk_vbox_new(FALSE,1);
GtkWidget *label = gtk_label_new(_(prop->common.descr->description));
-
+
gtk_container_set_border_width (GTK_CONTAINER(page), 2);
gtk_widget_show(page);
gtk_widget_show(label);
-
+
prop_dialog_container_pop(dialog); /* NULL or the previous page */
-
+
gtk_notebook_append_page(GTK_NOTEBOOK(dialog->lastcont),page,label);
- prop_dialog_add_raw(dialog,NULL); /* to reset the internal table system */
+ prop_dialog_add_raw(dialog,NULL); /* to reset the internal table system */
prop_dialog_container_push(dialog,page);
- return NULL;
+ return NULL;
}
static WIDGET *
-notebook_endprop_get_widget(NotebookProperty *prop, PropDialog *dialog)
-{
+notebook_endprop_get_widget(NotebookProperty *prop, PropDialog *dialog)
+{
prop_dialog_container_pop(dialog); /* the page */
prop_dialog_container_pop(dialog); /* the notebook */
return NULL;
@@ -364,7 +362,7 @@ static const PropertyOps notebook_pageprop_ops = {
(PropertyType_ResetWidget) noopprop_reset_widget,
(PropertyType_SetFromWidget) noopprop_set_from_widget,
- (PropertyType_CanMerge) noopprop_can_merge,
+ (PropertyType_CanMerge) noopprop_can_merge,
(PropertyType_GetFromOffset) noopprop_get_from_offset,
(PropertyType_SetFromOffset) noopprop_set_from_offset
};
@@ -379,7 +377,7 @@ static const PropertyOps notebook_endprop_ops = {
(PropertyType_ResetWidget) noopprop_reset_widget,
(PropertyType_SetFromWidget) noopprop_set_from_widget,
- (PropertyType_CanMerge) noopprop_can_merge,
+ (PropertyType_CanMerge) noopprop_can_merge,
(PropertyType_GetFromOffset) noopprop_get_from_offset,
(PropertyType_SetFromOffset) noopprop_set_from_offset
};
@@ -392,19 +390,19 @@ static void
listprop_emptylines_realloc(ListProperty *prop,guint new_size) {
guint i;
- for (i = 0; i < prop->lines->len; i++)
+ for (i = 0; i < prop->lines->len; i++)
g_free(g_ptr_array_index(prop->lines,i));
g_ptr_array_set_size(prop->lines,new_size);
}
-static void
+static void
listprop_copylines(ListProperty *prop, GPtrArray *src) {
guint i;
listprop_emptylines_realloc(prop,src->len);
-
+
for (i = 0; i < src->len; i++)
- g_ptr_array_index(prop->lines,i) = g_strdup(g_ptr_array_index(src,i));
+ g_ptr_array_index(prop->lines,i) = g_strdup(g_ptr_array_index(src,i));
}
static ListProperty *
@@ -419,16 +417,16 @@ listprop_new(const PropDescription *pdesc, PropDescToPropPredicate reason)
}
static void
-listprop_free(ListProperty *prop)
+listprop_free(ListProperty *prop)
{
listprop_emptylines_realloc(prop,-1);
g_ptr_array_free(prop->lines,TRUE);
}
static ListProperty *
-listprop_copy(ListProperty *src)
+listprop_copy(ListProperty *src)
{
- ListProperty *prop =
+ ListProperty *prop =
(ListProperty *)src->common.ops->new_prop(src->common.descr,
src->common.reason);
@@ -440,7 +438,7 @@ listprop_copy(ListProperty *src)
return prop;
}
-static void
+static void
listprop_select_child_signal(GtkList *list,
GtkWidget *child,
ListProperty *prop)
@@ -449,13 +447,13 @@ listprop_select_child_signal(GtkList *list,
}
static WIDGET *
-listprop_get_widget(ListProperty *prop, PropDialog *dialog)
-{
+listprop_get_widget(ListProperty *prop, PropDialog *dialog)
+{
GtkWidget *ret = gtk_list_new();
gtk_list_set_selection_mode(GTK_LIST(ret),GTK_SELECTION_BROWSE);
gtk_list_unselect_all(GTK_LIST(ret));
-
+
g_signal_connect(G_OBJECT(ret), "select-child",
G_CALLBACK (listprop_select_child_signal), prop);
@@ -470,7 +468,7 @@ make_item(const gchar *line) {
return item;
}
-static void
+static void
listprop_reset_widget(ListProperty *prop, WIDGET *widget)
{
guint i;
@@ -485,21 +483,21 @@ listprop_reset_widget(ListProperty *prop, WIDGET *widget)
gtk_list_select_item(GTK_LIST(widget),prop->selected);
}
-static void
-listprop_set_from_widget(ListProperty *prop, WIDGET *widget)
+static void
+listprop_set_from_widget(ListProperty *prop, WIDGET *widget)
{
prop->selected = prop->w_selected;
}
-static void
+static void
listprop_get_from_offset(ListProperty *prop,
- void *base, guint offset, guint offset2)
+ void *base, guint offset, guint offset2)
{
listprop_copylines(prop,struct_member(base,offset, GPtrArray *));
prop->selected = struct_member(base,offset2,gint);
}
-static void
+static void
listprop_set_from_offset(ListProperty *prop,
void *base, guint offset, guint offset2)
{
@@ -518,14 +516,14 @@ static const PropertyOps listprop_ops = {
(PropertyType_ResetWidget) listprop_reset_widget,
(PropertyType_SetFromWidget) listprop_set_from_widget,
- (PropertyType_CanMerge) noopprop_can_merge,
+ (PropertyType_CanMerge) noopprop_can_merge,
(PropertyType_GetFromOffset) listprop_get_from_offset,
(PropertyType_SetFromOffset) listprop_set_from_offset
};
-/* ************************************************************** */
+/* ************************************************************** */
-void
+void
prop_widgets_register(void)
{
prop_type_register(PROP_TYPE_STATIC,&staticprop_ops);
diff --git a/lib/propdesc.c b/lib/propdesc.c
index b6f529b5..dcb7cfdf 100644
--- a/lib/propdesc.c
+++ b/lib/propdesc.c
@@ -6,9 +6,9 @@
* Copyright (C) 2001 Cyrille Chepelov
* Major restructuration done in August 2001 by C. Chepelov
*
- * propdesc.c: This module handles operations on property descriptors and
+ * propdesc.c: This module handles operations on property descriptors and
* property descriptor lists.
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -24,9 +24,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <glib.h>
@@ -43,7 +41,7 @@ prop_desc_list_calculate_quarks(PropDescription *plist)
plist[i].quark = g_quark_from_static_string(plist[i].name);
if (plist[i].type_quark == 0)
plist[i].type_quark = g_quark_from_static_string(plist[i].type);
- if (!plist[i].ops)
+ if (!plist[i].ops)
plist[i].ops = prop_type_get_ops(plist[i].type);
}
}
@@ -63,7 +61,7 @@ prop_desc_list_find_prop(const PropDescription *plist, const gchar *name)
}
/* finds the real handler in case there are several levels of indirection */
-PropEventHandler
+PropEventHandler
prop_desc_find_real_handler(const PropDescription *pdesc)
{
PropEventHandler ret = pdesc->event_handler;
@@ -77,7 +75,7 @@ prop_desc_find_real_handler(const PropDescription *pdesc)
}
/* free a handler indirection list */
-void
+void
prop_desc_free_handler_chain(PropDescription *pdesc)
{
if (pdesc) {
@@ -86,15 +84,15 @@ prop_desc_free_handler_chain(PropDescription *pdesc)
PropEventHandlerChain *next = chain->chain;
g_free(chain);
chain = next;
- }
+ }
pdesc->chain_handler.chain = NULL;
pdesc->chain_handler.handler = NULL;
}
}
/* free a handler indirection list in a list of descriptors */
-void
-prop_desc_list_free_handler_chain(PropDescription *pdesc)
+void
+prop_desc_list_free_handler_chain(PropDescription *pdesc)
{
if (!pdesc) return;
while (pdesc->name) {
@@ -104,8 +102,8 @@ prop_desc_list_free_handler_chain(PropDescription *pdesc)
}
/* insert an event handler */
-void
-prop_desc_insert_handler(PropDescription *pdesc,
+void
+prop_desc_insert_handler(PropDescription *pdesc,
PropEventHandler handler)
{
if ((pdesc->chain_handler.handler) || (pdesc->chain_handler.chain)) {
@@ -162,7 +160,7 @@ prop_desc_lists_union(GList *plists)
return ret;
}
-gboolean
+gboolean
propdescs_can_be_merged(const PropDescription *p1,
const PropDescription *p2) {
PropEventHandler peh1 = prop_desc_find_real_handler(p1);
@@ -173,7 +171,7 @@ propdescs_can_be_merged(const PropDescription *p1,
if (peh1 != peh2) return FALSE;
if ((p1->ops->can_merge && !(p1->ops->can_merge(p1,p2))) ||
(p2->ops->can_merge && !(p2->ops->can_merge(p2,p1)))) return FALSE;
-
+
return TRUE;
}
diff --git a/lib/propdialogs.c b/lib/propdialogs.c
index b6856750..f405beab 100644
--- a/lib/propdialogs.c
+++ b/lib/propdialogs.c
@@ -22,9 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <string.h>
@@ -41,7 +39,7 @@ static void prop_dialog_signal_destroy(GtkWidget *dialog_widget);
static void prop_dialog_fill(PropDialog *dialog, GList *objects, gboolean is_default);
PropDialog *
-prop_dialog_new(GList *objects, gboolean is_default)
+prop_dialog_new(GList *objects, gboolean is_default)
{
PropDialog *dialog = g_new0(PropDialog,1);
dialog->props = NULL;
@@ -78,7 +76,7 @@ prop_dialog_from_widget(GtkWidget *dialog_widget)
return g_object_get_data (G_OBJECT (dialog_widget), prop_dialogdata_key);
}
-static void
+static void
prop_dialog_signal_destroy(GtkWidget *dialog_widget)
{
prop_dialog_destroy(prop_dialog_from_widget(dialog_widget));
@@ -90,7 +88,7 @@ prop_dialog_get_widget(const PropDialog *dialog)
return dialog->widget;
}
-void
+void
prop_dialog_add_raw(PropDialog *dialog, GtkWidget *widget)
{
dialog->curtable = NULL;
@@ -98,7 +96,7 @@ prop_dialog_add_raw(PropDialog *dialog, GtkWidget *widget)
gtk_container_add(GTK_CONTAINER(dialog->lastcont),widget);
}
-void
+void
prop_dialog_add_raw_with_flags(PropDialog *dialog, GtkWidget *widget,
gboolean expand, gboolean fill)
{
@@ -110,9 +108,9 @@ prop_dialog_add_raw_with_flags(PropDialog *dialog, GtkWidget *widget,
}
static void
-prop_dialog_make_curtable(PropDialog *dialog)
+prop_dialog_make_curtable(PropDialog *dialog)
{
- GtkWidget *table = gtk_table_new(1,2,FALSE);
+ GtkWidget *table = gtk_table_new(1,2,FALSE);
gtk_table_set_row_spacings(GTK_TABLE(table), 2);
gtk_table_set_col_spacings(GTK_TABLE(table), 5);
gtk_widget_show(table);
@@ -128,12 +126,12 @@ prop_dialog_add_widget(PropDialog *dialog, GtkWidget *label, GtkWidget *widget)
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
if (!dialog->curtable) prop_dialog_make_curtable(dialog);
- gtk_table_attach(GTK_TABLE(dialog->curtable),label,
+ gtk_table_attach(GTK_TABLE(dialog->curtable),label,
0,1,
dialog->currow, dialog->currow+1,
GTK_FILL, GTK_FILL|GTK_EXPAND,
0,0);
- gtk_table_attach(GTK_TABLE(dialog->curtable),widget,
+ gtk_table_attach(GTK_TABLE(dialog->curtable),widget,
1,2,
dialog->currow, dialog->currow+1,
GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND,
@@ -144,7 +142,7 @@ prop_dialog_add_widget(PropDialog *dialog, GtkWidget *label, GtkWidget *widget)
}
/* Register a new container widget (which won't be automatically added) */
-void
+void
prop_dialog_container_push(PropDialog *dialog, GtkWidget *container)
{
g_ptr_array_add(dialog->containers,container);
@@ -165,7 +163,7 @@ prop_dialog_container_pop(PropDialog *dialog)
return res;
}
-static void
+static void
property_signal_handler(GObject *obj,
gpointer func_data)
{
@@ -198,9 +196,9 @@ property_signal_handler(GObject *obj,
}
for (j = 0; j < dialog->prop_widgets->len; j++) {
- PropWidgetAssoc *pwa =
+ PropWidgetAssoc *pwa =
&g_array_index(dialog->prop_widgets,PropWidgetAssoc,j);
- /* The event handler above might have changed every property
+ /* The event handler above might have changed every property
* so we would have to mark them all as set (aka. to be applied).
* But doing so would not work well with multiple/grouped objects
* with unchanged and unequal object properties. Idea: keep as
@@ -222,7 +220,7 @@ property_signal_handler(GObject *obj,
}
}
-void
+void
prophandler_connect(const Property *prop,
GObject *object,
const gchar *signal)
@@ -231,7 +229,7 @@ prophandler_connect(const Property *prop,
g_warning("signal type unknown for this kind of property (name is %s), \n"
"handler ignored.",prop->descr->name);
return;
- }
+ }
g_signal_connect (G_OBJECT (object),
signal,
@@ -239,7 +237,7 @@ prophandler_connect(const Property *prop,
(gpointer)(&prop->self_event_data));
}
-void
+void
prop_dialog_add_property(PropDialog *dialog, Property *prop)
{
GtkWidget *widget = NULL;
@@ -249,18 +247,18 @@ prop_dialog_add_property(PropDialog *dialog, Property *prop)
prop->self_event_data.dialog = dialog;
prop->self_event_data.self = prop;
- if (prop->ops->get_widget)
- widget = prop->ops->get_widget(prop,dialog);
- if (!widget)
+ if (prop->ops->get_widget)
+ widget = prop->ops->get_widget(prop,dialog);
+ if (!widget)
return; /* either property has no widget or it's a container */
prop->self_event_data.widget = widget;
if (prop->ops->reset_widget) prop->ops->reset_widget(prop,widget);
prop->experience |= PXP_NOTSET;
-
+
pwa.prop = prop;
- pwa.widget = widget;
- g_array_append_val(dialog->prop_widgets,pwa);
+ pwa.widget = widget;
+ g_array_append_val(dialog->prop_widgets,pwa);
/* Don't let gettext translate the empty string (it would give po-info).
* Admitted it is a hack the string is empty for meta info, but the
@@ -275,14 +273,14 @@ prop_dialog_add_property(PropDialog *dialog, Property *prop)
prop_dialog_add_widget(dialog, label, widget);
}
-static void
+static void
prop_dialog_add_properties(PropDialog *dialog, GPtrArray *props)
{
guint i;
gboolean scrollable = (props->len > 16);
if (scrollable) {
- GtkWidget *swin = gtk_scrolled_window_new (NULL, NULL);
+ GtkWidget *swin = gtk_scrolled_window_new (NULL, NULL);
GtkWidget *vbox = gtk_vbox_new(FALSE,2);
gtk_box_pack_start(GTK_BOX (dialog->widget), swin, TRUE, TRUE, 0);
gtk_widget_show (swin);
@@ -309,11 +307,11 @@ prop_dialog_add_properties(PropDialog *dialog, GPtrArray *props)
gtk_widget_size_request (vbox, &requisition);
/* I'd say default size calculation for scrollable is quite broken */
- gtk_widget_set_size_request (swin, -1, requisition.height > sheight ? sheight : requisition.height);
+ gtk_widget_set_size_request (swin, -1, requisition.height > sheight ? sheight : requisition.height);
}
}
-void
+void
prop_get_data_from_widgets(PropDialog *dialog)
{
guint i;
@@ -321,7 +319,7 @@ prop_get_data_from_widgets(PropDialog *dialog)
PropWidgetAssoc *pwa = &g_array_index(dialog->prop_widgets,
PropWidgetAssoc,i);
pwa->prop->ops->set_from_widget(pwa->prop,pwa->widget);
-
+
}
}
@@ -369,7 +367,7 @@ _prop_list_extend_for_meta (GPtrArray *props)
g_ptr_array_free (pex, FALSE);
}
-static void
+static void
prop_dialog_fill(PropDialog *dialog, GList *objects, gboolean is_default)
{
const PropDescription *pdesc;
diff --git a/lib/properties.c b/lib/properties.c
index 34a92bb3..249557e8 100644
--- a/lib/properties.c
+++ b/lib/properties.c
@@ -6,7 +6,7 @@
* Copyright (C) 2001 Cyrille Chepelov
* Major restructuration done in August 2001 by C. Chepelov
*
- * properties.c: initialisation routines and stuff that didn't fit anywhere
+ * properties.c: initialisation routines and stuff that didn't fit anywhere
* else. Most of what used to be here has been moved elsewhere !
*
* This program is free software; you can redistribute it and/or modify
@@ -24,9 +24,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include "geometry.h"
#include "properties.h"
@@ -34,7 +32,7 @@
/* --------------------------------------- */
-void
+void
stdprops_init(void)
{
prop_basic_register();
diff --git a/lib/proplist.c b/lib/proplist.c
index e47ba2f9..099076f1 100644
--- a/lib/proplist.c
+++ b/lib/proplist.c
@@ -23,9 +23,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include "properties.h"
#include "propinternals.h"
@@ -36,33 +34,33 @@
/* Construction of a list of properties from a filtered list of descriptors. */
/* This is a little halfway between properties and property descriptor */
/* lists... */
-gboolean pdtpp_true(const PropDescription *pdesc)
+gboolean pdtpp_true(const PropDescription *pdesc)
{ return TRUE; }
-gboolean pdtpp_synthetic(const PropDescription *pdesc)
+gboolean pdtpp_synthetic(const PropDescription *pdesc)
{ return TRUE; }
-gboolean pdtpp_from_object(const PropDescription *pdesc)
+gboolean pdtpp_from_object(const PropDescription *pdesc)
{ return TRUE; }
-gboolean pdtpp_is_visible(const PropDescription *pdesc)
-{ return (pdesc->flags & PROP_FLAG_VISIBLE) != 0; }
-gboolean pdtpp_is_visible_no_standard(const PropDescription *pdesc)
+gboolean pdtpp_is_visible(const PropDescription *pdesc)
+{ return (pdesc->flags & PROP_FLAG_VISIBLE) != 0; }
+gboolean pdtpp_is_visible_no_standard(const PropDescription *pdesc)
{ return (pdesc->flags & PROP_FLAG_VISIBLE) != 0 &&
- (pdesc->flags & PROP_FLAG_STANDARD) == 0; }
-gboolean pdtpp_is_not_visible(const PropDescription *pdesc)
-{ return (pdesc->flags & PROP_FLAG_VISIBLE) == 0; }
+ (pdesc->flags & PROP_FLAG_STANDARD) == 0; }
+gboolean pdtpp_is_not_visible(const PropDescription *pdesc)
+{ return (pdesc->flags & PROP_FLAG_VISIBLE) == 0; }
gboolean pdtpp_do_save(const PropDescription *pdesc)
-{ return (pdesc->flags & (PROP_FLAG_DONT_SAVE|PROP_FLAG_LOAD_ONLY)) == 0; }
+{ return (pdesc->flags & (PROP_FLAG_DONT_SAVE|PROP_FLAG_LOAD_ONLY)) == 0; }
gboolean pdtpp_do_save_no_standard(const PropDescription *pdesc)
-{ return (pdesc->flags & (PROP_FLAG_DONT_SAVE|PROP_FLAG_LOAD_ONLY|PROP_FLAG_STANDARD)) == 0; }
+{ return (pdesc->flags & (PROP_FLAG_DONT_SAVE|PROP_FLAG_LOAD_ONLY|PROP_FLAG_STANDARD)) == 0; }
gboolean pdtpp_do_load(const PropDescription *pdesc)
{ return (((pdesc->flags & PROP_FLAG_DONT_SAVE) == 0) ||
- ((pdesc->flags & PROP_FLAG_LOAD_ONLY) != 0)); }
+ ((pdesc->flags & PROP_FLAG_LOAD_ONLY) != 0)); }
gboolean pdtpp_defaults(const PropDescription *pdesc)
-{ return (pdesc->flags & PROP_FLAG_NO_DEFAULTS) == 0; }
+{ return (pdesc->flags & PROP_FLAG_NO_DEFAULTS) == 0; }
gboolean pdtpp_do_not_save(const PropDescription *pdesc)
-{ return (pdesc->flags & PROP_FLAG_DONT_SAVE) != 0; }
+{ return (pdesc->flags & PROP_FLAG_DONT_SAVE) != 0; }
GPtrArray *
-prop_list_from_descs(const PropDescription *plist,
+prop_list_from_descs(const PropDescription *plist,
PropDescToPropPredicate pred)
{
GPtrArray *ret;
@@ -82,16 +80,16 @@ prop_list_from_descs(const PropDescription *plist,
g_message("about to append property %s/%s to list"
"predicate is %s %d %d",plist[i].type,plist[i].name,
pred(&plist[i])?"TRUE":"FALSE",
- plist[i].flags,plist[i].flags & PROP_FLAG_DONT_SAVE);
-#endif
- if (pred(&plist[i])) {
- Property *prop = plist[i].ops->new_prop(&plist[i],pred);
+ plist[i].flags,plist[i].flags & PROP_FLAG_DONT_SAVE);
+#endif
+ if (pred(&plist[i])) {
+ Property *prop = plist[i].ops->new_prop(&plist[i],pred);
g_ptr_array_index(ret,count++) = prop;
}
}
-
+
return ret;
-}
+}
void
prop_list_free(GPtrArray *plist)
@@ -112,7 +110,7 @@ prop_list_copy(GPtrArray *src)
{
guint i;
GPtrArray *dest;
-
+
dest = g_ptr_array_new();
g_ptr_array_set_size(dest, src->len);
@@ -130,7 +128,7 @@ prop_list_copy_empty(GPtrArray *plist)
{
guint i;
GPtrArray *dest;
-
+
dest = g_ptr_array_new();
g_ptr_array_set_size(dest, plist->len);
@@ -142,7 +140,7 @@ prop_list_copy_empty(GPtrArray *plist)
return dest;
}
-gboolean
+gboolean
prop_list_load(GPtrArray *props, DataNode data_node, DiaContext *ctx)
{
guint i;
@@ -188,7 +186,7 @@ prop_list_save(GPtrArray *props, DataNode data, DiaContext *ctx)
* called prop_list_find_prop_by_name()
*/
Property *
-find_prop_by_name(const GPtrArray *props, const gchar *name)
+find_prop_by_name(const GPtrArray *props, const gchar *name)
{
guint i;
GQuark prop_quark = g_quark_from_string(name);
@@ -209,10 +207,10 @@ find_prop_by_name_and_type(const GPtrArray *props, const gchar *name,
if (!ret) return NULL;
if (type_quark != ret->type_quark) return NULL;
return ret;
-}
+}
void
-prop_list_add_list (GPtrArray *props, const GPtrArray *ptoadd)
+prop_list_add_list (GPtrArray *props, const GPtrArray *ptoadd)
{
guint i;
for (i = 0 ; i < ptoadd->len; i++) {
@@ -359,4 +357,4 @@ prop_list_add_matrix (GPtrArray *plist, const DiaMatrix *m)
g_free (((MatrixProperty *)prop)->matrix);
(( MatrixProperty *)prop)->matrix = g_memdup (m, sizeof(DiaMatrix));
g_ptr_array_add (plist, prop);
-}
\ No newline at end of file
+}
diff --git a/lib/propobject.c b/lib/propobject.c
index 2e3f5f67..bb4d8fd6 100644
--- a/lib/propobject.c
+++ b/lib/propobject.c
@@ -6,10 +6,10 @@
* Copyright (C) 2001 Cyrille Chepelov
* Major restructuration done in August 2001 by C. Chepelov
*
- * Propobject.c: routines which deal with Dia Objects and affect their
+ * Propobject.c: routines which deal with Dia Objects and affect their
* properties.
*
- * Most of these routines used to exist in code before the restructuration.
+ * Most of these routines used to exist in code before the restructuration.
* They've lost most of their meat, in favour for more modularity.
*
* This program is free software; you can redistribute it and/or modify
@@ -27,9 +27,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <string.h>
@@ -178,7 +176,7 @@ object_toggle_prop (DiaObject *obj, const char *pname, gboolean val)
{
Property *prop = make_new_prop (pname, PROP_TYPE_BOOL, 0);
GPtrArray *plist = prop_list_from_single (prop);
-
+
((BoolProperty *)prop)->bool_data = val;
return object_apply_props (obj, plist);
}
@@ -266,8 +264,8 @@ objects_comply_with_stdprop(GList *objects)
return TRUE;
}
-gboolean
-object_complies_with_stdprop(const DiaObject *obj)
+gboolean
+object_complies_with_stdprop(const DiaObject *obj)
{
if (obj->ops->set_props == NULL) {
g_warning("No set_props !");
@@ -305,7 +303,7 @@ pdtpp_do_save_no_standard_default (const PropDescription *pdesc)
return pdtpp_do_save_no_standard(pdesc) && pdtpp_defaults (pdesc);
}
-void
+void
object_copy_props(DiaObject *dest, const DiaObject *src, gboolean is_default)
{
GPtrArray *props;
@@ -326,7 +324,7 @@ object_copy_props(DiaObject *dest, const DiaObject *src, gboolean is_default)
a (const DiaObject *) */
dest->ops->set_props(dest, props);
- prop_list_free(props);
+ prop_list_free(props);
}
void
@@ -339,7 +337,7 @@ object_load_props(DiaObject *obj, ObjectNode obj_node, DiaContext *ctx)
g_return_if_fail(object_complies_with_stdprop(obj));
props = prop_list_from_descs(object_get_prop_descriptions(obj),
- pdtpp_do_load);
+ pdtpp_do_load);
if (!prop_list_load(props,obj_node, ctx)) {
/* context already has the message */
@@ -359,7 +357,7 @@ object_save_props(DiaObject *obj, ObjectNode obj_node, DiaContext *ctx)
g_return_if_fail(object_complies_with_stdprop(obj));
props = prop_list_from_descs(object_get_prop_descriptions(obj),
- pdtpp_do_save);
+ pdtpp_do_save);
obj->ops->get_props(obj, props);
prop_list_save(props,obj_node,ctx);
@@ -380,9 +378,9 @@ object_prop_by_name_type(DiaObject *obj, const char *name, const char *type)
if (name_quark == 0 || (pdesc->quark == name_quark)) {
Property *prop;
static GPtrArray *plist = NULL;
-
+
if (type && (0 != strcmp(pdesc->type,type))) continue;
-
+
if (!plist) {
plist = g_ptr_array_new();
g_ptr_array_set_size(plist,1);
@@ -424,7 +422,7 @@ dia_object_set_pixbuf (DiaObject *object,
GPtrArray *props;
PixbufProperty *pp;
Property *prop = object_prop_by_name_type (object, "pixbuf", PROP_TYPE_PIXBUF);
-
+
if (!prop)
return NULL;
pp = (PixbufProperty *)prop;
@@ -461,7 +459,7 @@ dia_object_set_pattern (DiaObject *object,
GPtrArray *props;
PatternProperty *pp;
Property *prop = object_prop_by_name_type (object, "pattern", PROP_TYPE_PATTERN);
-
+
if (!prop)
return NULL;
pp = (PatternProperty *)prop;
diff --git a/lib/propregistry.c b/lib/propregistry.c
index 4bfe839e..a9dd1160 100644
--- a/lib/propregistry.c
+++ b/lib/propregistry.c
@@ -22,9 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <gtk/gtk.h>
#include "properties.h"
@@ -32,14 +30,14 @@
static GHashTable *props_hash = NULL;
-static void check_props_hash(void)
+static void check_props_hash(void)
{
if (!props_hash) {
props_hash = g_hash_table_new(g_str_hash,g_str_equal);
}
}
-void
+void
prop_type_register(PropertyType type, const PropertyOps *ops)
{
check_props_hash();
@@ -47,7 +45,7 @@ prop_type_register(PropertyType type, const PropertyOps *ops)
}
const PropertyOps *
-prop_type_get_ops(PropertyType type)
+prop_type_get_ops(PropertyType type)
{
check_props_hash();
return g_hash_table_lookup(props_hash,type);
diff --git a/meson.build b/meson.build
index 1f475389..0353491d 100644
--- a/meson.build
+++ b/meson.build
@@ -68,10 +68,6 @@ configuration_inc = include_directories('.')
config_h_in = configure_file(output: 'config.h.in', configuration: conf)
config_h = vcs_tag(input: config_h_in, output: 'config.h')
-# TODO: Remove this once we remove autotools and
-# remove `#ifdef HAVE_CONFIG_H` checks from all source files.
-add_project_arguments('-DHAVE_CONFIG_H', language: 'c')
-
subdir('po')
subdir('lib')
subdir('objects')
diff --git a/objects/AADL/aadl.c b/objects/AADL/aadl.c
index 40a5b1db..eddf2e6d 100644
--- a/objects/AADL/aadl.c
+++ b/objects/AADL/aadl.c
@@ -19,9 +19,7 @@
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include "object.h"
@@ -64,7 +62,7 @@ dia_plugin_init(PluginInfo *info)
object_register_type(&aadlbus_type);
object_register_type(&aadlmemory_type);
object_register_type(&aadlpackage_type);
-
+
return DIA_PLUGIN_INIT_OK;
}
diff --git a/objects/AADL/aadl.h b/objects/AADL/aadl.h
index 2247f3ef..124dd798 100644
--- a/objects/AADL/aadl.h
+++ b/objects/AADL/aadl.h
@@ -19,9 +19,7 @@
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -72,7 +70,7 @@ struct _Aadlbox
Element element;
gchar *declaration;
-
+
Text *name;
int num_ports;
@@ -98,7 +96,7 @@ typedef enum {
SYSTEM,
THREAD,
THREAD_GROUP,
-
+
ACCESS_PROVIDER,
ACCESS_REQUIRER,
IN_DATA_PORT,
@@ -110,7 +108,7 @@ typedef enum {
IN_OUT_DATA_PORT,
IN_OUT_EVENT_PORT,
IN_OUT_EVENT_DATA_PORT,
-
+
PORT_GROUP
} Aadl_type;
@@ -131,8 +129,8 @@ typedef void (*AadlDrawFunc) (Aadlbox* obj, DiaRenderer* ddisp);
typedef void (*AadlTextPosFunc) (Aadlbox* obj, Point *p);
typedef void (*AadlSizeFunc) (Aadlbox* obj, Point *size);
-/* In the abstract class system (see aadlbox.c), these are the
- functions an inherited class *must* define, because they are
+/* In the abstract class system (see aadlbox.c), these are the
+ functions an inherited class *must* define, because they are
used by aadlbox_ functions */
struct _Aadlbox_specific
@@ -179,7 +177,7 @@ void aadlbox_select(Aadlbox *aadlbox, Point *clicked_point,
DiaRenderer *interactive_renderer);
ObjectChange* aadlbox_move_handle(Aadlbox *aadlbox, Handle *handle,
Point *to, ConnectionPoint *cp,
- HandleMoveReason reason,
+ HandleMoveReason reason,
ModifierKeys modifiers);
ObjectChange* aadlbox_move(Aadlbox *aadlbox, Point *to);
void aadlbox_draw(Aadlbox *aadlbox, DiaRenderer *renderer);
@@ -198,8 +196,8 @@ void aadlbox_load(ObjectNode obj_node, int version, DiaContext *ctx,
/* aadldata.c */
void aadlbox_project_point_on_rectangle(Rectangle *rectangle,
Point *p,real *angle);
- void aadldata_project_point_on_nearest_border(Aadlbox *aadlbox,
- Point *p,real *angle);
+ void aadldata_project_point_on_nearest_border(Aadlbox *aadlbox,
+ Point *p,real *angle);
/* aadlprocess.c */
diff --git a/objects/Database/compound.c b/objects/Database/compound.c
index 524b1a06..19571bf6 100644
--- a/objects/Database/compound.c
+++ b/objects/Database/compound.c
@@ -22,9 +22,7 @@
* and many arms going from the connnection point.
*/
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
#include <gtk/gtk.h> /* because of GtkWidgket */
#include "pixmaps/compound.xpm"
@@ -749,7 +747,7 @@ compound_get_props (Compound * comp, GPtrArray * props)
/**
* Everything I know about is initialize so that this function get called
- * only when the user is applying the default dialog.
+ * only when the user is applying the default dialog.
*/
static void
compound_set_props (Compound * comp, GPtrArray * props)
@@ -893,7 +891,7 @@ setup_handle (Handle *h, HandleId id, HandleType type, HandleConnectType ctype)
h->connected_to = NULL;
}
-/*
+/*
* Update the directions fields of our mount point, so that when an
* object is connected to it, let's say an OrthConn object, the
* connected object will automatically be placed at that side which
diff --git a/objects/Database/database.c b/objects/Database/database.c
index 74106e3c..9b70df2f 100644
--- a/objects/Database/database.c
+++ b/objects/Database/database.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
#include "intl.h"
#include "object.h"
diff --git a/objects/Database/reference.c b/objects/Database/reference.c
index f85b6ef4..8bb2dc6f 100644
--- a/objects/Database/reference.c
+++ b/objects/Database/reference.c
@@ -21,9 +21,7 @@
* code.
*/
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
#include "database.h"
#include "arrows.h"
@@ -332,7 +330,7 @@ reference_get_props (TableReference *ref, GPtrArray *props)
static void
reference_set_props (TableReference *ref, GPtrArray *props)
{
- object_set_props_from_offsets(&ref->orth.object,
+ object_set_props_from_offsets(&ref->orth.object,
reference_offsets,
props);
reference_update_data (ref);
diff --git a/objects/Database/table.c b/objects/Database/table.c
index 67f85f26..8c0197b9 100644
--- a/objects/Database/table.c
+++ b/objects/Database/table.c
@@ -17,7 +17,7 @@
*
* File: table.c
*
- * Purpose: This file contains implementation of the "table" code.
+ * Purpose: This file contains implementation of the "table" code.
*/
/*
@@ -26,9 +26,7 @@
* template. -- pn
*/
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
+#include <config.h>
#include <assert.h>
#include <string.h>
@@ -93,16 +91,16 @@ static void table_update_primary_key_font (Table *);
static gchar * create_documentation_tag (gchar * comment,
gboolean tagging,
- gint WrapPoint,
+ gint WrapPoint,
gint *NumberOfLines);
-static void draw_comments(DiaRenderer *renderer,
+static void draw_comments(DiaRenderer *renderer,
DiaFont *font,
real font_height,
Color *text_color,
gchar *comment,
gboolean comment_tagging,
- gint Comment_line_length,
- Point *p,
+ gint Comment_line_length,
+ Point *p,
gint alignment);
/* ----------------------------------------------------------------------- */
@@ -594,7 +592,7 @@ table_draw_namebox (Table * table, DiaRenderer * renderer, Element * elem)
* @param renderer The Renderer on which the comment is being drawn
* @param font The font to render the comment in.
* @param font_height The Y size of the font used to render the comment
- * @param text_color A pointer to the color to use to render the comment
+ * @param text_color A pointer to the color to use to render the comment
* @param comment The comment string to render
* @param comment_tagging If the {documentation = } tag should be enforced
* @param Comment_line_length The maximum length of any one line in the comment
@@ -603,14 +601,14 @@ table_draw_namebox (Table * table, DiaRenderer * renderer, Element * elem)
* @see uml_create_documentation
*/
static void
-draw_comments(DiaRenderer *renderer,
+draw_comments(DiaRenderer *renderer,
DiaFont *font,
real font_height,
Color *text_color,
gchar *comment,
gboolean comment_tagging,
- gint Comment_line_length,
- Point *p,
+ gint Comment_line_length,
+ Point *p,
gint alignment)
{
gint NumberOfLines = 0;
@@ -618,12 +616,12 @@ draw_comments(DiaRenderer *renderer,
gchar *CommentString = 0;
gchar *NewLineP= NULL;
gchar *RenderP;
-
+
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
-
- CommentString =
+
+ CommentString =
create_documentation_tag(comment, comment_tagging, Comment_line_length, &NumberOfLines);
- RenderP = CommentString;
+ RenderP = CommentString;
renderer_ops->set_font(renderer, font, font_height);
for ( Index=0; Index < NumberOfLines; Index++)
{
@@ -1028,7 +1026,7 @@ table_init_attributesbox_height (Table * table)
}
static void
-underline_table_attribute(DiaRenderer * renderer,
+underline_table_attribute(DiaRenderer * renderer,
Point StartPoint,
TableAttribute * attr,
Table * table)
@@ -1085,7 +1083,7 @@ underline_table_attribute(DiaRenderer * renderer,
* made to rejoin any of the segments, that is all New Lines
* are treated as hard newlines. No syllable matching is done
* either so breaks in words will sometimes not make real
- * sense.
+ * sense.
* <p>
* Finally, since this function returns newly created dynamic
* memory the caller must free the memory to prevent memory
@@ -1103,12 +1101,12 @@ underline_table_attribute(DiaRenderer * renderer,
static gchar *
create_documentation_tag (gchar * comment,
gboolean tagging,
- gint WrapPoint,
+ gint WrapPoint,
gint *NumberOfLines)
{
gchar *CommentTag = tagging ? "{documentation = " : "";
gint TagLength = strlen(CommentTag);
- /* Make sure that there is at least some value greater then zero for the WrapPoint to
+ /* Make sure that there is at least some value greater then zero for the WrapPoint to
* support diagrams from earlier versions of Dia. So if the WrapPoint is zero then use
* the taglength as the WrapPoint. If the Tag has been changed such that it has a length
* of 0 then use 1.
@@ -1130,7 +1128,7 @@ create_documentation_tag (gchar * comment,
while ( *comment ) {
/* Skip spaces */
while ( *comment && g_unichar_isspace(g_utf8_get_char(comment)) ) {
- comment = g_utf8_next_char(comment);
+ comment = g_utf8_next_char(comment);
}
/* Copy chars */
if ( *comment ){
@@ -1139,13 +1137,13 @@ create_documentation_tag (gchar * comment,
BreakCandidate = NULL;
while ( *Scan && *Scan != '\n' && AvailSpace > 0 ) {
ScanChar = g_utf8_get_char(Scan);
- /* We known, that g_unichar_isspace() is not recommended for word breaking;
+ /* We known, that g_unichar_isspace() is not recommended for word breaking;
* but Pango usage seems too complex.
*/
if ( g_unichar_isspace(ScanChar) )
BreakCandidate = Scan;
AvailSpace--; /* not valid for nonspacing marks */
- Scan = g_utf8_next_char(Scan);
+ Scan = g_utf8_next_char(Scan);
}
if ( AvailSpace==0 && BreakCandidate != NULL )
Scan = BreakCandidate;
@@ -1324,7 +1322,7 @@ table_update_connectionpoints (Table * table)
if (num_connections != obj->num_connections)
{
obj->num_connections = num_connections;
- obj->connections =
+ obj->connections =
g_realloc (obj->connections,
num_connections * sizeof (ConnectionPoint *));
}
@@ -1499,7 +1497,7 @@ table_change_revert (TableChange *change, DiaObject *obj)
old_state = table_state_new(change->obj);
table_state_set(change->saved_state, change->obj);
-
+
list = change->disconnected;
while (list) {
Disconnect *dis = (Disconnect *)list->data;
@@ -1508,7 +1506,7 @@ table_change_revert (TableChange *change, DiaObject *obj)
list = g_list_next(list);
}
-
+
change->saved_state = old_state;
change->applied = FALSE;
}
diff --git a/objects/ER/attribute.c b/objects/ER/attribute.c
index 61651c3a..21a8e0fb 100644
--- a/objects/ER/attribute.c
+++ b/objects/ER/attribute.c
@@ -18,9 +18,7 @@
/* DO NOT USE THIS OBJECT AS A BASIS FOR A NEW OBJECT. */
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -89,7 +87,7 @@ static void attribute_select(Attribute *attribute, Point *clicked_point,
DiaRenderer *interactive_renderer);
static ObjectChange* attribute_move_handle(Attribute *attribute, Handle *handle,
Point *to, ConnectionPoint *cp,
- HandleMoveReason reason,
+ HandleMoveReason reason,
ModifierKeys modifiers);
static ObjectChange* attribute_move(Attribute *attribute, Point *to);
static void attribute_draw(Attribute *attribute, DiaRenderer *renderer);
@@ -193,14 +191,14 @@ static PropOffset attribute_offsets[] = {
static void
attribute_get_props(Attribute *attribute, GPtrArray *props)
{
- object_get_props_from_offsets(&attribute->element.object,
+ object_get_props_from_offsets(&attribute->element.object,
attribute_offsets, props);
}
static void
attribute_set_props(Attribute *attribute, GPtrArray *props)
{
- object_set_props_from_offsets(&attribute->element.object,
+ object_set_props_from_offsets(&attribute->element.object,
attribute_offsets, props);
attribute_update_data(attribute);
}
@@ -235,7 +233,7 @@ attribute_move_handle(Attribute *attribute, Handle *handle,
assert(to!=NULL);
assert(handle->id < 8);
- element_move_handle(&attribute->element, handle->id, to, cp,
+ element_move_handle(&attribute->element, handle->id, to, cp,
reason, modifiers);
attribute_update_data(attribute);
@@ -260,7 +258,7 @@ attribute_draw(Attribute *attribute, DiaRenderer *renderer)
Point p;
Element *elem;
real width;
-
+
assert(attribute != NULL);
assert(renderer != NULL);
@@ -268,7 +266,7 @@ attribute_draw(Attribute *attribute, DiaRenderer *renderer)
center.x = elem->corner.x + elem->width/2;
center.y = elem->corner.y + elem->height/2;
-
+
renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID);
renderer_ops->draw_ellipse (renderer, ¢er,
elem->width, elem->height,
@@ -298,8 +296,8 @@ attribute_draw(Attribute *attribute, DiaRenderer *renderer)
attribute->font, attribute->font_height);
renderer_ops->set_font(renderer, attribute->font, attribute->font_height);
- renderer_ops->draw_string(renderer, attribute->name,
- &p, ALIGN_CENTER,
+ renderer_ops->draw_string(renderer, attribute->name,
+ &p, ALIGN_CENTER,
&color_black);
if (attribute->key || attribute->weakkey) {
@@ -336,10 +334,10 @@ attribute_update_data(Attribute *attribute)
center.x = elem->corner.x + elem->width / 2.0;
center.y = elem->corner.y + elem->height / 2.0;
-
+
half_x = elem->width * M_SQRT1_2 / 2.0;
half_y = elem->height * M_SQRT1_2 / 2.0;
-
+
/* Update connections: */
connpoint_update(&attribute->connections[0],
center.x - half_x,
@@ -384,7 +382,7 @@ attribute_update_data(Attribute *attribute)
obj->position = elem->corner;
element_update_handles(elem);
-
+
}
static DiaObject *
@@ -401,7 +399,7 @@ attribute_create(Point *startpoint,
attribute = g_malloc0(sizeof(Attribute));
elem = &attribute->element;
obj = &elem->object;
-
+
obj->type = &attribute_type;
obj->ops = &attribute_ops;
@@ -459,9 +457,9 @@ attribute_copy(Attribute *attribute)
Attribute *newattribute;
Element *elem, *newelem;
DiaObject *newobj;
-
+
elem = &attribute->element;
-
+
newattribute = g_malloc0(sizeof(Attribute));
newelem = &newattribute->element;
newobj = &newelem->object;
@@ -479,7 +477,7 @@ attribute_copy(Attribute *attribute)
newattribute->connections[i].pos = attribute->connections[i].pos;
newattribute->connections[i].flags = attribute->connections[i].flags;
}
-
+
newattribute->font = dia_font_ref(attribute->font);
newattribute->font_height = attribute->font_height;
newattribute->name = g_strdup(attribute->name);
@@ -534,7 +532,7 @@ attribute_load(ObjectNode obj_node, int version,DiaContext *ctx)
attribute = g_malloc0(sizeof(Attribute));
elem = &attribute->element;
obj = &elem->object;
-
+
obj->type = &attribute_type;
obj->ops = &attribute_ops;
@@ -549,12 +547,12 @@ attribute_load(ObjectNode obj_node, int version,DiaContext *ctx)
attr = object_find_attribute(obj_node, "border_color");
if (attr != NULL)
data_color(attribute_first_data(attr), &attribute->border_color, ctx);
-
+
attribute->inner_color = color_white;
attr = object_find_attribute(obj_node, "inner_color");
if (attr != NULL)
data_color(attribute_first_data(attr), &attribute->inner_color, ctx);
-
+
attribute->name = NULL;
attr = object_find_attribute(obj_node, "name");
if (attr != NULL)
@@ -567,7 +565,7 @@ attribute_load(ObjectNode obj_node, int version,DiaContext *ctx)
attr = object_find_attribute(obj_node, "weak_key");
if (attr != NULL)
attribute->weakkey = data_boolean(attribute_first_data(attr), ctx);
-
+
attr = object_find_attribute(obj_node, "derived");
if (attr != NULL)
attribute->derived = data_boolean(attribute_first_data(attr), ctx);
diff --git a/objects/ER/entity.c b/objects/ER/entity.c
index 999d9d5e..6a02ed6e 100644
--- a/objects/ER/entity.c
+++ b/objects/ER/entity.c
@@ -18,9 +18,7 @@
/* DO NOT USE THIS OBJECT AS A BASIS FOR A NEW OBJECT. */
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -56,16 +54,16 @@ struct _Entity {
real border_width;
Color border_color;
Color inner_color;
-
+
gboolean associative;
-
+
DiaFont *font;
real font_height;
char *name;
real name_width;
-
+
int weak;
-
+
};
static real entity_distance_from(Entity *entity, Point *point);
@@ -169,14 +167,14 @@ static PropOffset entity_offsets[] = {
static void
entity_get_props(Entity *entity, GPtrArray *props)
{
- object_get_props_from_offsets(&entity->element.object,
+ object_get_props_from_offsets(&entity->element.object,
entity_offsets, props);
}
static void
entity_set_props(Entity *entity, GPtrArray *props)
{
- object_set_props_from_offsets(&entity->element.object,
+ object_set_props_from_offsets(&entity->element.object,
entity_offsets, props);
entity_update_data(entity);
}
@@ -221,7 +219,7 @@ static ObjectChange*
entity_move(Entity *entity, Point *to)
{
entity->element.corner = *to;
-
+
entity_update_data(entity);
return NULL;
@@ -245,26 +243,26 @@ entity_draw(Entity *entity, DiaRenderer *renderer)
ul_corner.y = elem->corner.y;
lr_corner.x = elem->corner.x + elem->width;
lr_corner.y = elem->corner.y + elem->height;
-
+
renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID);
-
+
renderer_ops->set_linewidth(renderer, entity->border_width);
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID, 0.0);
renderer_ops->set_linejoin(renderer, LINEJOIN_MITER);
- renderer_ops->draw_rect(renderer,
+ renderer_ops->draw_rect(renderer,
&ul_corner,
- &lr_corner,
+ &lr_corner,
&entity->inner_color,
&entity->border_color);
if(entity->weak) {
diff = WEAK_BORDER_WIDTH/*MIN(elem->width / 2.0 * 0.20, elem->height / 2.0 * 0.20)*/;
- ul_corner.x += diff;
+ ul_corner.x += diff;
ul_corner.y += diff;
lr_corner.x -= diff;
lr_corner.y -= diff;
- renderer_ops->draw_rect(renderer,
+ renderer_ops->draw_rect(renderer,
&ul_corner, &lr_corner,
NULL,
&entity->border_color);
@@ -294,9 +292,9 @@ entity_draw(Entity *entity, DiaRenderer *renderer)
p.y = elem->corner.y + (elem->height - entity->font_height)/2.0 +
dia_font_ascent(entity->name,entity->font, entity->font_height);
renderer_ops->set_font(renderer, entity->font, entity->font_height);
- renderer_ops->draw_string(renderer,
- entity->name,
- &p, ALIGN_CENTER,
+ renderer_ops->draw_string(renderer,
+ entity->name,
+ &p, ALIGN_CENTER,
&color_black);
}
@@ -359,9 +357,9 @@ entity_update_data(Entity *entity)
extra->border_trans = entity->border_width/2.0;
element_update_boundingbox(elem);
-
+
obj->position = elem->corner;
-
+
element_update_handles(elem);
}
@@ -379,7 +377,7 @@ entity_create(Point *startpoint,
entity = g_malloc0(sizeof(Entity));
elem = &entity->element;
obj = &elem->object;
-
+
obj->type = &entity_type;
obj->ops = &entity_ops;
@@ -391,7 +389,7 @@ entity_create(Point *startpoint,
entity->border_width = attributes_get_default_linewidth();
entity->border_color = attributes_get_foreground();
entity->inner_color = attributes_get_background();
-
+
element_init(elem, 8, NUM_CONNECTIONS);
for (i=0;i<NUM_CONNECTIONS;i++) {
@@ -408,7 +406,7 @@ entity_create(Point *startpoint,
entity->name_width =
dia_font_string_width(entity->name, entity->font, entity->font_height);
-
+
entity_update_data(entity);
for (i=0;i<8;i++) {
@@ -416,7 +414,7 @@ entity_create(Point *startpoint,
}
*handle1 = NULL;
- *handle2 = obj->handles[0];
+ *handle2 = obj->handles[0];
return &entity->element.object;
}
@@ -435,9 +433,9 @@ entity_copy(Entity *entity)
Entity *newentity;
Element *elem, *newelem;
DiaObject *newobj;
-
+
elem = &entity->element;
-
+
newentity = g_malloc0(sizeof(Entity));
newelem = &newentity->element;
newobj = &newelem->object;
@@ -447,7 +445,7 @@ entity_copy(Entity *entity)
newentity->border_width = entity->border_width;
newentity->border_color = entity->border_color;
newentity->inner_color = entity->inner_color;
-
+
for (i=0;i<NUM_CONNECTIONS;i++) {
newobj->connections[i] = &newentity->connections[i];
newentity->connections[i].object = newobj;
@@ -501,7 +499,7 @@ entity_load(ObjectNode obj_node, int version,DiaContext *ctx)
entity = g_malloc0(sizeof(Entity));
elem = &entity->element;
obj = &elem->object;
-
+
obj->type = &entity_type;
obj->ops = &entity_ops;
@@ -516,12 +514,12 @@ entity_load(ObjectNode obj_node, int version,DiaContext *ctx)
attr = object_find_attribute(obj_node, "border_color");
if (attr != NULL)
data_color(attribute_first_data(attr), &entity->border_color, ctx);
-
+
entity->inner_color = color_white;
attr = object_find_attribute(obj_node, "inner_color");
if (attr != NULL)
data_color(attribute_first_data(attr), &entity->inner_color, ctx);
-
+
entity->name = NULL;
attr = object_find_attribute(obj_node, "name");
if (attr != NULL)
diff --git a/objects/ER/er.c b/objects/ER/er.c
index 31e56c35..83c0eeb5 100644
--- a/objects/ER/er.c
+++ b/objects/ER/er.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <string.h>
#include <stdio.h>
diff --git a/objects/ER/participation.c b/objects/ER/participation.c
index 71ccf3b3..4f57c8fc 100644
--- a/objects/ER/participation.c
+++ b/objects/ER/participation.c
@@ -18,9 +18,7 @@
/* DO NOT USE THIS OBJECT AS A BASIS FOR A NEW OBJECT. */
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -135,14 +133,14 @@ static PropOffset participation_offsets[] = {
static void
participation_get_props(Participation *participation, GPtrArray *props)
{
- object_get_props_from_offsets(&participation->orth.object,
+ object_get_props_from_offsets(&participation->orth.object,
participation_offsets, props);
}
static void
participation_set_props(Participation *participation, GPtrArray *props)
{
- object_set_props_from_offsets(&participation->orth.object,
+ object_set_props_from_offsets(&participation->orth.object,
participation_offsets, props);
participation_update_data(participation);
}
@@ -171,8 +169,8 @@ participation_move_handle(Participation *participation, Handle *handle,
assert(participation!=NULL);
assert(handle!=NULL);
assert(to!=NULL);
-
- change = orthconn_move_handle(&participation->orth, handle, to, cp,
+
+ change = orthconn_move_handle(&participation->orth, handle, to, cp,
reason, modifiers);
participation_update_data(participation);
@@ -200,13 +198,13 @@ participation_draw(Participation *participation, DiaRenderer *renderer)
Point *right_points;
int i, n;
real last_left, last_right;
-
+
points = &orth->points[0];
n = orth->numpoints;
last_left = 0.0;
last_right = 0.0;
-
+
renderer_ops->set_linewidth(renderer, PARTICIPATION_WIDTH);
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID, 0.0);
renderer_ops->set_linejoin(renderer, LINEJOIN_MITER);
@@ -261,7 +259,7 @@ participation_draw(Participation *participation, DiaRenderer *renderer)
right_points[i].x = points[i].x + last_right;
right_points[i].y = points[i].y;
}
-
+
renderer_ops->draw_polyline(renderer, left_points, n, &color_black);
renderer_ops->draw_polyline(renderer, right_points, n, &color_black);
g_free(left_points);
@@ -277,7 +275,7 @@ participation_update_data(Participation *participation)
OrthConn *orth = &participation->orth;
PolyBBExtras *extra = &orth->extra_spacing;
real extra_width;
-
+
orthconn_update_data(orth);
if (participation->total) {
@@ -285,12 +283,12 @@ participation_update_data(Participation *participation)
} else {
extra_width = 0.0;
}
- extra->middle_trans =
- extra->start_trans =
- extra->end_trans =
- extra->start_long =
+ extra->middle_trans =
+ extra->start_trans =
+ extra->end_trans =
+ extra->start_long =
extra->end_long = PARTICIPATION_WIDTH/2.0 + extra_width;
-
+
orthconn_update_boundingbox(orth);
}
@@ -303,11 +301,11 @@ participation_create(Point *startpoint,
Participation *participation;
OrthConn *orth;
DiaObject *obj;
-
+
participation = g_malloc0(sizeof(Participation));
orth = &participation->orth;
obj = &orth->object;
-
+
obj->type = &participation_type;
obj->ops = &participation_ops;
@@ -317,7 +315,7 @@ participation_create(Point *startpoint,
participation_update_data(participation);
participation->total = FALSE;
-
+
*handle1 = orth->handles[0];
*handle2 = orth->handles[orth->numpoints-2];
@@ -329,18 +327,18 @@ participation_copy(Participation *participation)
{
Participation *newparticipation;
OrthConn *orth, *neworth;
-
+
orth = &participation->orth;
-
+
newparticipation = g_malloc0(sizeof(Participation));
neworth = &newparticipation->orth;
orthconn_copy(orth, neworth);
newparticipation->total = participation->total;
-
+
participation_update_data(newparticipation);
-
+
return &newparticipation->orth.object;
}
diff --git a/objects/ER/relationship.c b/objects/ER/relationship.c
index 1f89c566..e59a43ea 100644
--- a/objects/ER/relationship.c
+++ b/objects/ER/relationship.c
@@ -18,9 +18,7 @@
/* DO NOT USE THIS OBJECT AS A BASIS FOR A NEW OBJECT. */
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -180,14 +178,14 @@ static PropOffset relationship_offsets[] = {
static void
relationship_get_props(Relationship *relationship, GPtrArray *props)
{
- object_get_props_from_offsets(&relationship->element.object,
+ object_get_props_from_offsets(&relationship->element.object,
relationship_offsets, props);
}
static void
relationship_set_props(Relationship *relationship, GPtrArray *props)
{
- object_set_props_from_offsets(&relationship->element.object,
+ object_set_props_from_offsets(&relationship->element.object,
relationship_offsets, props);
relationship_update_data(relationship);
}
@@ -233,7 +231,7 @@ static ObjectChange*
relationship_move(Relationship *relationship, Point *to)
{
relationship->element.corner = *to;
-
+
relationship_update_data(relationship);
return NULL;
@@ -273,7 +271,7 @@ relationship_draw(Relationship *relationship, DiaRenderer *renderer)
renderer_ops->draw_polygon(renderer, corners, 4,
&relationship->inner_color,
&relationship->border_color);
-
+
if (relationship->rotate) {
lc.x = corners[1].x + 0.2;
lc.y = corners[1].y - 0.3;
@@ -290,7 +288,7 @@ relationship_draw(Relationship *relationship, DiaRenderer *renderer)
if (relationship->identifying) {
diff = IDENTIFYING_BORDER_WIDTH;
- corners[0].x += diff;
+ corners[0].x += diff;
corners[1].y += diff*DIAMOND_RATIO;
corners[2].x -= diff;
corners[3].y -= diff*DIAMOND_RATIO;
@@ -313,10 +311,10 @@ relationship_draw(Relationship *relationship, DiaRenderer *renderer)
p.y = elem->corner.y + (elem->height - relationship->font_height)/2.0 +
dia_font_ascent(relationship->name,
relationship->font, relationship->font_height);
-
- renderer_ops->draw_string(renderer,
- relationship->name,
- &p, ALIGN_CENTER,
+
+ renderer_ops->draw_string(renderer,
+ relationship->name,
+ &p, ALIGN_CENTER,
&color_black);
}
@@ -338,20 +336,20 @@ relationship_update_data(Relationship *relationship)
elem->height = elem->width * DIAMOND_RATIO;
/* Update connections: */
- /*
+ /*
2
- *
+ *
1 / \ 3
- * *
- / \
+ * *
+ / \
0 * * 8 * 4
- \ /
- * *
+ \ /
+ * *
7 \ / 5
- *
- 6
+ *
+ 6
*/
-
+
connpoint_update(&relationship->connections[0],
elem->corner.x,
elem->corner.y + elem->height / 2.0,
@@ -366,12 +364,12 @@ relationship_update_data(Relationship *relationship)
elem->corner.x + elem->width / 2.0,
elem->corner.y,
DIR_NORTH);
-
+
connpoint_update(&relationship->connections[3],
elem->corner.x + 3.0 * elem->width / 4.0,
elem->corner.y + elem->height / 4.0,
DIR_NORTHEAST);
-
+
connpoint_update(&relationship->connections[4],
elem->corner.x + elem->width,
elem->corner.y + elem->height / 2.0,
@@ -381,7 +379,7 @@ relationship_update_data(Relationship *relationship)
elem->corner.x + 3.0 * elem->width / 4.0,
elem->corner.y + 3.0 * elem->height / 4.0,
DIR_SOUTHEAST);
-
+
connpoint_update(&relationship->connections[6],
elem->corner.x + elem->width / 2.0,
elem->corner.y + elem->height,
@@ -399,7 +397,7 @@ relationship_update_data(Relationship *relationship)
extra->border_trans = relationship->border_width / 2.0;
element_update_boundingbox(elem);
-
+
/* fix boundingrelationship for line_width: */
if(relationship->rotate) {
obj->bounding_box.top -= relationship->font_height + CARDINALITY_DISTANCE;
@@ -410,7 +408,7 @@ relationship_update_data(Relationship *relationship)
obj->bounding_box.right += CARDINALITY_DISTANCE + relationship->right_card_width;
}
obj->position = elem->corner;
-
+
element_update_handles(elem);
}
@@ -428,7 +426,7 @@ relationship_create(Point *startpoint,
relationship = g_malloc0(sizeof(Relationship));
elem = &relationship->element;
obj = &elem->object;
-
+
obj->type = &relationship_type;
obj->ops = &relationship_ops;
@@ -439,7 +437,7 @@ relationship_create(Point *startpoint,
relationship->border_width = attributes_get_default_linewidth();
relationship->border_color = attributes_get_foreground();
relationship->inner_color = attributes_get_background();
-
+
element_init(elem, 8, NUM_CONNECTIONS);
for (i=0;i<NUM_CONNECTIONS;i++) {
@@ -464,14 +462,14 @@ relationship_create(Point *startpoint,
}
*handle1 = NULL;
- *handle2 = obj->handles[0];
+ *handle2 = obj->handles[0];
return &relationship->element.object;
}
static void
relationship_destroy(Relationship *relationship)
{
- dia_font_unref(relationship->font);
+ dia_font_unref(relationship->font);
element_destroy(&relationship->element);
g_free(relationship->name);
g_free(relationship->left_cardinality);
@@ -485,9 +483,9 @@ relationship_copy(Relationship *relationship)
Relationship *newrelationship;
Element *elem, *newelem;
DiaObject *newobj;
-
+
elem = &relationship->element;
-
+
newrelationship = g_malloc0(sizeof(Relationship));
newelem = &newrelationship->element;
newobj = &newelem->object;
@@ -497,7 +495,7 @@ relationship_copy(Relationship *relationship)
newrelationship->border_width = relationship->border_width;
newrelationship->border_color = relationship->border_color;
newrelationship->inner_color = relationship->inner_color;
-
+
for (i=0;i<NUM_CONNECTIONS;i++) {
newobj->connections[i] = &newrelationship->connections[i];
newrelationship->connections[i].object = newobj;
@@ -518,7 +516,7 @@ relationship_copy(Relationship *relationship)
newrelationship->identifying = relationship->identifying;
newrelationship->rotate = relationship->rotate;
-
+
return &newrelationship->element.object;
}
@@ -562,12 +560,12 @@ relationship_load(ObjectNode obj_node, int version,DiaContext *ctx)
relationship = g_malloc0(sizeof(Relationship));
elem = &relationship->element;
obj = &elem->object;
-
+
obj->type = &relationship_type;
obj->ops = &relationship_ops;
element_load(elem, obj_node, ctx);
-
+
relationship->border_width = 0.1;
attr = object_find_attribute(obj_node, "border_width");
if (attr != NULL)
@@ -577,7 +575,7 @@ relationship_load(ObjectNode obj_node, int version,DiaContext *ctx)
attr = object_find_attribute(obj_node, "border_color");
if (attr != NULL)
data_color(attribute_first_data(attr), &relationship->border_color, ctx);
-
+
relationship->inner_color = color_white;
attr = object_find_attribute(obj_node, "inner_color");
if (attr != NULL)
diff --git a/objects/FS/flow-ortho.c b/objects/FS/flow-ortho.c
index 06bd337c..6b2a2f4e 100644
--- a/objects/FS/flow-ortho.c
+++ b/objects/FS/flow-ortho.c
@@ -20,9 +20,7 @@
* please send e-mail to David Thompson <dcthomp mail utexas edu>
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -92,7 +90,7 @@ Color orthflow_color_signal = { 0.0f, 0.0f, 1.0f, 1.0f };
static ObjectChange* orthflow_move_handle(Orthflow *orthflow, Handle *handle,
Point *to, ConnectionPoint *cp,
- HandleMoveReason reason,
+ HandleMoveReason reason,
ModifierKeys modifiers);
static ObjectChange* orthflow_move(Orthflow *orthflow, Point *to);
static void orthflow_select(Orthflow *orthflow, Point *clicked_point,
@@ -124,7 +122,7 @@ static ObjectTypeOps orthflow_type_ops =
(SaveFunc) orthflow_save,
(GetDefaultsFunc) NULL,
(ApplyDefaultsFunc) NULL,
-
+
} ;
DiaObjectType orthflow_type =
@@ -158,7 +156,7 @@ static PropEnumData prop_orthflow_type_data[] = {
{ N_("Energy"),ORTHFLOW_ENERGY },
{ N_("Material"),ORTHFLOW_MATERIAL },
{ N_("Signal"),ORTHFLOW_SIGNAL },
- { NULL, 0 }
+ { NULL, 0 }
};
static PropDescription orthflow_props[] = {
@@ -197,14 +195,14 @@ static PropOffset orthflow_offsets[] = {
static void
orthflow_get_props(Orthflow * orthflow, GPtrArray *props)
{
- object_get_props_from_offsets(&orthflow->orth.object,
+ object_get_props_from_offsets(&orthflow->orth.object,
orthflow_offsets, props);
}
static void
orthflow_set_props(Orthflow *orthflow, GPtrArray *props)
{
- object_set_props_from_offsets(&orthflow->orth.object,
+ object_set_props_from_offsets(&orthflow->orth.object,
orthflow_offsets, props);
orthflow_update_data(orthflow);
}
@@ -267,12 +265,12 @@ orthflow_distance_from(Orthflow *orthflow, Point *point)
real linedist;
real textdist;
- linedist = orthconn_distance_from( &orthflow->orth, point,
- orthflow->type == ORTHFLOW_MATERIAL ?
- ORTHFLOW_MATERIAL_WIDTH :
+ linedist = orthconn_distance_from( &orthflow->orth, point,
+ orthflow->type == ORTHFLOW_MATERIAL ?
+ ORTHFLOW_MATERIAL_WIDTH :
ORTHFLOW_WIDTH ) ;
textdist = text_distance_from( orthflow->text, point ) ;
-
+
return linedist > textdist ? textdist : linedist ;
}
@@ -304,7 +302,7 @@ orthflow_move_handle(Orthflow *orthflow, Handle *handle,
along = orthflow->textpos ;
point_sub( &along, &(orthconn_get_middle_handle(&orthflow->orth)->pos) ) ;
- change = orthconn_move_handle( &orthflow->orth, handle, to, cp,
+ change = orthconn_move_handle( &orthflow->orth, handle, to, cp,
reason, modifiers);
orthconn_update_data( &orthflow->orth ) ;
@@ -322,7 +320,7 @@ orthflow_move(Orthflow *orthflow, Point *to)
{
ObjectChange *change;
- Point *points = &orthflow->orth.points[0];
+ Point *points = &orthflow->orth.points[0];
Point delta;
delta = *to;
@@ -352,7 +350,7 @@ orthflow_draw(Orthflow *orthflow, DiaRenderer *renderer)
arrow.type = ARROW_FILLED_TRIANGLE;
arrow.width = ORTHFLOW_ARROWWIDTH;
arrow.length = ORTHFLOW_ARROWLEN;
-
+
points = &orthflow->orth.points[0];
renderer_ops->set_linecaps(renderer, LINECAPS_BUTT);
@@ -382,7 +380,7 @@ orthflow_draw(Orthflow *orthflow, DiaRenderer *renderer)
renderer_ops->draw_polyline_with_arrows(renderer, points, n,
ORTHFLOW_WIDTH,
render_color,
- NULL, &arrow);
+ NULL, &arrow);
text_draw(orthflow->text, renderer);
}
@@ -403,10 +401,10 @@ orthflow_create(Point *startpoint,
orthflow = g_new0(Orthflow,1);
orth = &orthflow->orth ;
orthconn_init( orth, startpoint ) ;
-
+
obj = &orth->object;
extra = &orth->extra_spacing;
-
+
obj->type = &orthflow_type;
obj->ops = &orthflow_ops;
@@ -417,7 +415,7 @@ orthflow_create(Point *startpoint,
font = dia_font_new_from_style(DIA_FONT_SANS, ORTHFLOW_FONTHEIGHT);
orthflow->text = new_text("", font, ORTHFLOW_FONTHEIGHT, &p, &color_black, ALIGN_CENTER);
- dia_font_unref(font);
+ dia_font_unref(font);
#if 0
if ( orthflow_default_label ) {
@@ -447,12 +445,12 @@ orthflow_create(Point *startpoint,
orthflow->text_handle.connected_to = NULL;
object_add_handle( obj, &orthflow->text_handle ) ;
- extra->start_long =
- extra->start_trans =
+ extra->start_long =
+ extra->start_trans =
extra->middle_trans = ORTHFLOW_WIDTH/2.0;
- extra->end_long =
+ extra->end_long =
extra->end_trans = ORTHFLOW_WIDTH/2 + ORTHFLOW_ARROWLEN;
-
+
orthflow_update_data(orthflow);
/*obj->handles[1] = orth->handles[2] ;*/
@@ -477,7 +475,7 @@ orthflow_copy(Orthflow *orthflow)
DiaObject *newobj;
orth = &orthflow->orth;
-
+
neworthflow = g_malloc0(sizeof(Orthflow));
neworth = &neworthflow->orth;
newobj = &neworth->object;
@@ -503,7 +501,7 @@ orthflow_update_data(Orthflow *orthflow)
DiaObject *obj = &orth->object;
Rectangle rect;
Color* color = &orthflow_color_signal;
-
+
switch (orthflow->type) {
case ORTHFLOW_ENERGY:
color = &orthflow_color_energy ;
@@ -557,7 +555,7 @@ orthflow_load(ObjectNode obj_node, int version, DiaContext *ctx)
orth = &orthflow->orth;
obj = &orth->object;
extra = &orth->extra_spacing;
-
+
obj->type = &orthflow_type;
obj->ops = &orthflow_ops;
@@ -586,15 +584,15 @@ orthflow_load(ObjectNode obj_node, int version, DiaContext *ctx)
object_add_handle(obj, &orthflow->text_handle);
obj->handles[orth->numpoints-1] = &orthflow->text_handle;
- extra->start_long =
- extra->start_trans =
+ extra->start_long =
+ extra->start_trans =
extra->middle_trans = ORTHFLOW_WIDTH/2.0;
- extra->end_long =
+ extra->end_long =
extra->end_trans = ORTHFLOW_WIDTH/2 + ORTHFLOW_ARROWLEN;
orthflow->textpos = orthflow->text->position;
orthflow_update_data(orthflow);
-
+
return &orthflow->orth.object;
}
diff --git a/objects/FS/flow.c b/objects/FS/flow.c
index 07086e85..60aeae4a 100644
--- a/objects/FS/flow.c
+++ b/objects/FS/flow.c
@@ -18,9 +18,7 @@
/* DO NOT USE THIS OBJECT AS A BASIS FOR A NEW OBJECT. */
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -60,7 +58,7 @@ struct _Flow {
FlowType type;
Point textpos; /* This is the master position, but overridden in load */
};
-
+
#define FLOW_WIDTH 0.1
#define FLOW_MATERIAL_WIDTH 0.2
#define FLOW_DASHLEN 0.4
@@ -71,7 +69,7 @@ struct _Flow {
static ObjectChange* flow_move_handle(Flow *flow, Handle *handle,
Point *to, ConnectionPoint *cp,
- HandleMoveReason reason,
+ HandleMoveReason reason,
ModifierKeys modifiers);
static ObjectChange* flow_move(Flow *flow, Point *to);
static void flow_select(Flow *flow, Point *clicked_point,
@@ -135,7 +133,7 @@ static PropEnumData prop_flow_type_data[] = {
{ N_("Energy"),FLOW_ENERGY },
{ N_("Material"),FLOW_MATERIAL },
{ N_("Signal"),FLOW_SIGNAL },
- { NULL, 0 }
+ { NULL, 0 }
};
static PropDescription flow_props[] = {
@@ -174,14 +172,14 @@ static PropOffset flow_offsets[] = {
static void
flow_get_props(Flow * flow, GPtrArray *props)
{
- object_get_props_from_offsets(&flow->connection.object,
+ object_get_props_from_offsets(&flow->connection.object,
flow_offsets, props);
}
static void
flow_set_props(Flow *flow, GPtrArray *props)
{
- object_set_props_from_offsets(&flow->connection.object,
+ object_set_props_from_offsets(&flow->connection.object,
flow_offsets, props);
flow_update_data(flow);
}
@@ -193,14 +191,14 @@ flow_distance_from(Flow *flow, Point *point)
Point *endpoints;
real linedist;
real textdist;
-
+
endpoints = &flow->connection.endpoints[0];
-
- linedist = distance_line_point(&endpoints[0], &endpoints[1],
- flow->type == FLOW_MATERIAL ? FLOW_MATERIAL_WIDTH : FLOW_WIDTH,
+
+ linedist = distance_line_point(&endpoints[0], &endpoints[1],
+ flow->type == FLOW_MATERIAL ? FLOW_MATERIAL_WIDTH : FLOW_WIDTH,
point);
textdist = text_distance_from( flow->text, point ) ;
-
+
return linedist > textdist ? textdist : linedist ;
}
@@ -221,7 +219,7 @@ flow_move_handle(Flow *flow, Handle *handle,
{
Point p1, p2;
Point *endpoints;
-
+
assert(flow!=NULL);
assert(handle!=NULL);
assert(to!=NULL);
@@ -234,7 +232,7 @@ flow_move_handle(Flow *flow, Handle *handle,
real along_mag, norm_mag ;
Point along ;
- endpoints = &flow->connection.endpoints[0];
+ endpoints = &flow->connection.endpoints[0];
p1 = flow->textpos ;
point_sub( &p1, &endpoints[0] ) ;
@@ -255,7 +253,7 @@ flow_move_handle(Flow *flow, Handle *handle,
norm_mag = (real)sqrt( (double) point_dot( &p1, &p1 ) ) ;
}
- connection_move_handle(&flow->connection, handle->id, to, cp,
+ connection_move_handle(&flow->connection, handle->id, to, cp,
reason, modifiers);
connection_adjust_for_autogap(&flow->connection);
@@ -269,7 +267,7 @@ flow_move_handle(Flow *flow, Handle *handle,
if ( dest_length > 1e-5 ) {
point_normalize( &p2 ) ;
} else {
- p2.x = 0.0 ; p2.y = -1.0 ;
+ p2.x = 0.0 ; p2.y = -1.0 ;
}
point_scale( &p2, norm_mag ) ;
point_scale( &along, along_mag ) ;
@@ -286,12 +284,12 @@ static ObjectChange*
flow_move(Flow *flow, Point *to)
{
Point start_to_end;
- Point *endpoints = &flow->connection.endpoints[0];
+ Point *endpoints = &flow->connection.endpoints[0];
Point delta;
delta = *to;
point_sub(&delta, &endpoints[0]);
-
+
start_to_end = endpoints[1];
point_sub(&start_to_end, &endpoints[0]);
@@ -320,9 +318,9 @@ flow_draw(Flow *flow, DiaRenderer *renderer)
arrow.type = ARROW_FILLED_TRIANGLE;
arrow.width = FLOW_ARROWWIDTH;
arrow.length = FLOW_ARROWLEN;
-
+
endpoints = &flow->connection.endpoints[0];
-
+
renderer_ops->set_linewidth(renderer, FLOW_WIDTH);
renderer_ops->set_linecaps(renderer, LINECAPS_BUTT);
@@ -349,7 +347,7 @@ flow_draw(Flow *flow, DiaRenderer *renderer)
&p1, &p2,
FLOW_WIDTH,
render_color,
- &arrow, NULL);
+ &arrow, NULL);
text_draw(flow->text, renderer);
}
@@ -374,13 +372,13 @@ flow_create(Point *startpoint,
conn->endpoints[0] = *startpoint;
conn->endpoints[1] = *startpoint;
conn->endpoints[1].x += 1.5;
-
+
obj = &conn->object;
extra = &conn->extra_spacing;
obj->type = &flow_type;
obj->ops = &flow_ops;
-
+
connection_init(conn, 3, 0);
p = conn->endpoints[1] ;
@@ -403,7 +401,7 @@ flow_create(Point *startpoint,
font = dia_font_new_from_style(DIA_FONT_SANS, FLOW_FONTHEIGHT);
flow->text = new_text("", font, FLOW_FONTHEIGHT, &p, &color_black, ALIGN_CENTER);
- dia_font_unref(font);
+ dia_font_unref(font);
flow->text_handle.id = HANDLE_MOVE_TEXT;
flow->text_handle.type = HANDLE_MINOR_CONTROL;
@@ -412,14 +410,14 @@ flow_create(Point *startpoint,
flow->text_handle.pos = p;
obj->handles[2] = &flow->text_handle;
- extra->start_long =
+ extra->start_long =
extra->end_long =
extra->start_trans = FLOW_WIDTH/2.0;
extra->end_trans = MAX(FLOW_WIDTH, FLOW_ARROWLEN) / 2.0;
flow_update_data(flow);
*handle1 = obj->handles[0];
*handle2 = obj->handles[1];
-
+
return &flow->connection.object;
}
@@ -437,9 +435,9 @@ flow_copy(Flow *flow)
Flow *newflow;
Connection *conn, *newconn;
DiaObject *newobj;
-
+
conn = &flow->connection;
-
+
newflow = g_malloc0(sizeof(Flow));
newconn = &newflow->connection;
newobj = &newconn->object;
@@ -465,7 +463,7 @@ flow_update_data(Flow *flow)
DiaObject *obj = &conn->object;
Rectangle rect;
Color* color = NULL;
-
+
if (connpoint_is_autogap(flow->connection.endpoint_handles[0].connected_to) ||
connpoint_is_autogap(flow->connection.endpoint_handles[1].connected_to)) {
connection_adjust_for_autogap(conn);
@@ -529,7 +527,7 @@ flow_load(ObjectNode obj_node, int version, DiaContext *ctx)
obj->ops = &flow_ops;
connection_load(conn, obj_node, ctx);
-
+
connection_init(conn, 3, 0);
flow->text = NULL;
@@ -540,7 +538,7 @@ flow_load(ObjectNode obj_node, int version, DiaContext *ctx)
DiaFont *font = dia_font_new_from_style(DIA_FONT_SANS, FLOW_FONTHEIGHT);
flow->text = new_text("", font, FLOW_FONTHEIGHT, &obj->position, &color_black, ALIGN_CENTER);
- dia_font_unref(font);
+ dia_font_unref(font);
}
attr = object_find_attribute(obj_node, "type");
@@ -554,14 +552,14 @@ flow_load(ObjectNode obj_node, int version, DiaContext *ctx)
flow->text_handle.pos = flow->text->position;
obj->handles[2] = &flow->text_handle;
- extra->start_long =
+ extra->start_long =
extra->end_long =
extra->start_trans = FLOW_WIDTH/2.0;
extra->end_trans = MAX(FLOW_WIDTH, FLOW_ARROWLEN) / 2.0;
-
+
flow->textpos = flow->text->position;
flow_update_data(flow);
-
+
return &flow->connection.object;
}
diff --git a/objects/FS/fs.c b/objects/FS/fs.c
index 2030fca3..ff59d05d 100644
--- a/objects/FS/fs.c
+++ b/objects/FS/fs.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <string.h>
#include <stdio.h>
diff --git a/objects/FS/function.c b/objects/FS/function.c
index 3376455c..1c49537a 100644
--- a/objects/FS/function.c
+++ b/objects/FS/function.c
@@ -18,9 +18,7 @@
/* DO NOT USE THIS OBJECT AS A BASIS FOR A NEW OBJECT. */
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -47,11 +45,11 @@ struct _Function {
Element element;
ConnectionPoint connections[NUM_CONNECTIONS];
-
+
Text *text;
int is_wish;
- int is_user;
+ int is_user;
};
enum FuncChangeType {
@@ -171,14 +169,14 @@ static PropOffset function_offsets[] = {
static void
function_get_props(Function * function, GPtrArray *props)
{
- object_get_props_from_offsets(&function->element.object,
+ object_get_props_from_offsets(&function->element.object,
function_offsets, props);
}
static void
function_set_props(Function *function, GPtrArray *props)
{
- object_set_props_from_offsets(&function->element.object,
+ object_set_props_from_offsets(&function->element.object,
function_offsets, props);
function_update_data(function);
}
@@ -238,7 +236,7 @@ function_create_change( Function* fcn, enum FuncChangeType change_type )
change->text = text_get_string_copy( fcn->text ) ;
return (ObjectChange*) change ;
}
-
+
static real
function_distance_from(Function *pkg, Point *point)
{
@@ -286,7 +284,7 @@ function_draw(Function *pkg, DiaRenderer *renderer)
real x, y, w, h;
Point p1, p2;
real font_height ;
-
+
assert(pkg != NULL);
assert(pkg->text != NULL);
assert(renderer != NULL);
@@ -311,7 +309,7 @@ function_draw(Function *pkg, DiaRenderer *renderer)
p2.x = x+w; p2.y = y+h;
if (pkg->is_user) {
- renderer_ops->draw_rect(renderer,
+ renderer_ops->draw_rect(renderer,
&p1, &p2,
&color_white,
&color_black);
@@ -321,12 +319,12 @@ function_draw(Function *pkg, DiaRenderer *renderer)
p2.x -= font_height / FUNCTION_MARGIN_SCALE;
/* y += FUNCTION_MARGIN_M; */
}
- renderer_ops->draw_rect(renderer,
+ renderer_ops->draw_rect(renderer,
&p1, &p2,
&color_white,
&color_black);
-
+
text_draw(pkg->text, renderer);
}
@@ -338,7 +336,7 @@ function_update_data(Function *pkg)
DiaObject *obj = &elem->object;
Point p1;
real h, w = 0, font_height;
-
+
text_calc_boundingbox(pkg->text, NULL) ;
font_height = pkg->text->height ;
pkg->element.extra_spacing.border_trans = (font_height / FUNCTION_BORDERWIDTH_SCALE) / 2.0;
@@ -347,7 +345,7 @@ function_update_data(Function *pkg)
if (pkg->is_user) {
h += 2*font_height/FUNCTION_MARGIN_SCALE;
}
-
+
w = MAX(w, pkg->text->max_width);
p1.y = h + pkg->text->ascent - ( pkg->is_user ? font_height/FUNCTION_MARGIN_SCALE : 0 ); /* position of
text */
@@ -355,15 +353,15 @@ function_update_data(Function *pkg)
h += font_height/FUNCTION_MARGIN_Y;
- w += 2*font_height/FUNCTION_MARGIN_X;
+ w += 2*font_height/FUNCTION_MARGIN_X;
p1.x = elem->corner.x + w/2.0 + ( pkg->is_user ? font_height/FUNCTION_MARGIN_SCALE : 0 );
text_set_position(pkg->text, &p1);
-
+
if (pkg->is_user) {
w += 2*font_height/FUNCTION_MARGIN_SCALE;
}
-
+
elem->width = w;
elem->height = h - elem->corner.y;
@@ -404,7 +402,7 @@ function_update_data(Function *pkg)
elem->corner.x + elem->width / 2.0,
elem->corner.y + elem->height / 2.0,
DIR_SOUTHEAST);
-
+
element_update_boundingbox(elem);
obj->position = elem->corner;
@@ -424,11 +422,11 @@ function_create(Point *startpoint,
Point p;
DiaFont *font;
int i;
-
+
pkg = g_malloc0(sizeof(Function));
elem = &pkg->element;
obj = &elem->object;
-
+
obj->type = &function_type;
obj->ops = &function_ops;
@@ -436,7 +434,7 @@ function_create(Point *startpoint,
elem->corner = *startpoint;
font = dia_font_new_from_style (DIA_FONT_SANS,FUNCTION_FONTHEIGHT);
-
+
pkg->is_wish = FALSE;
pkg->is_user = FALSE;
@@ -446,9 +444,9 @@ function_create(Point *startpoint,
pkg->text = new_text("", font, FUNCTION_FONTHEIGHT, &p, &color_black,
ALIGN_CENTER);
dia_font_unref(font);
-
+
element_init(elem, 8, NUM_CONNECTIONS);
-
+
for (i=0;i<NUM_CONNECTIONS;i++) {
obj->connections[i] = &pkg->connections[i];
pkg->connections[i].object = obj;
@@ -484,9 +482,9 @@ function_copy(Function *pkg)
Function *newpkg;
Element *elem, *newelem;
DiaObject *newobj;
-
+
elem = &pkg->element;
-
+
newpkg = g_malloc0(sizeof(Function));
newelem = &newpkg->element;
newobj = &newelem->object;
@@ -494,7 +492,7 @@ function_copy(Function *pkg)
element_copy(elem, newelem);
newpkg->text = text_copy(pkg->text);
-
+
for (i=0;i<NUM_CONNECTIONS;i++) {
newobj->connections[i] = &newpkg->connections[i];
newpkg->connections[i].object = newobj;
@@ -508,7 +506,7 @@ function_copy(Function *pkg)
newpkg->element.extra_spacing.border_trans = pkg->element.extra_spacing.border_trans ;
function_update_data(newpkg);
-
+
return &newpkg->element.object;
}
@@ -536,16 +534,16 @@ function_load(ObjectNode obj_node, int version, DiaContext *ctx)
Element *elem;
DiaObject *obj;
int i;
-
+
pkg = g_malloc0(sizeof(Function));
elem = &pkg->element;
obj = &elem->object;
-
+
obj->type = &function_type;
obj->ops = &function_ops;
element_load(elem, obj_node, ctx);
-
+
pkg->text = NULL;
attr = object_find_attribute(obj_node, "text");
if (attr != NULL)
@@ -652,7 +650,7 @@ struct _IndentedMenus {
; Elisp functions to generate comments:)
(setq q nil)
(defun q-pop () (setq q (cdr q)))
- (defun q-push ()
+ (defun q-push ()
(re-search-forward "(\"\\([^\"]*\\)\")" (+ (point) 30))
(setq word (buffer-substring (match-beginning 1) (match-end 1)))
(setq q (cons word q)))
diff --git a/objects/GRAFCET/action.c b/objects/GRAFCET/action.c
index 54d7068a..4503ec42 100644
--- a/objects/GRAFCET/action.c
+++ b/objects/GRAFCET/action.c
@@ -1,7 +1,7 @@
/* Dia -- an diagram creation/manipulation program
* Copyright (C) 1998 Alexander Larsson
*
- * GRAFCET chart support
+ * GRAFCET chart support
* Copyright(C) 2000,2001 Cyrille Chepelov
*
* This program is free software; you can redistribute it and/or modify
@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -50,7 +48,7 @@
typedef struct _Action {
Connection connection;
-
+
Text *text;
gboolean macro_call;
@@ -80,9 +78,9 @@ static void action_update_data(Action *action);
static void action_destroy(Action *action);
static DiaObject *action_load(ObjectNode obj_node, int version,DiaContext *ctx);
static PropDescription *action_describe_props(Action *action);
-static void action_get_props(Action *action,
+static void action_get_props(Action *action,
GPtrArray *props);
-static void action_set_props(Action *action,
+static void action_set_props(Action *action,
GPtrArray *props);
@@ -91,7 +89,7 @@ static ObjectTypeOps action_type_ops =
(CreateFunc)action_create, /* create */
(LoadFunc) action_load,/*using_properties*/ /* load */
(SaveFunc) object_save_using_properties, /* save */
- (GetDefaultsFunc) NULL,
+ (GetDefaultsFunc) NULL,
(ApplyDefaultsFunc) NULL
};
@@ -134,13 +132,13 @@ static PropDescription action_props[] = {
};
static PropDescription *
-action_describe_props(Action *action)
+action_describe_props(Action *action)
{
if (action_props[0].quark == 0) {
prop_desc_list_calculate_quarks(action_props);
}
return action_props;
-}
+}
static PropOffset action_offsets[] = {
CONNECTION_COMMON_PROPERTIES_OFFSETS,
@@ -209,11 +207,11 @@ action_move_handle(Action *action, Handle *handle,
to2 = *to;
point_sub(&to2,&action->connection.endpoints[0]);
point_add(&to2,&action->connection.endpoints[1]);
- connection_move_handle(&action->connection, HANDLE_MOVE_ENDPOINT,
+ connection_move_handle(&action->connection, HANDLE_MOVE_ENDPOINT,
to, NULL, reason, 0);
}
#endif
- connection_move_handle(&action->connection, handle->id, to, cp,
+ connection_move_handle(&action->connection, handle->id, to, cp,
reason, modifiers);
action_update_data(action);
@@ -225,7 +223,7 @@ static ObjectChange*
action_move(Action *action, Point *to)
{
Point start_to_end;
- Point *endpoints = &action->connection.endpoints[0];
+ Point *endpoints = &action->connection.endpoints[0];
start_to_end = endpoints[1];
point_sub(&start_to_end, &endpoints[0]);
@@ -257,7 +255,7 @@ action_update_data(Action *action)
action->labelstart = conn->endpoints[1];
action->labelbb.left = action->labelstart.x;
- action->labelstart.y += .3 * action->text->height;
+ action->labelstart.y += .3 * action->text->height;
action->labelstart.x = action->labelbb.left + action->space_width;
if (action->macro_call) {
action->labelstart.x += 2.0 * action->space_width;
@@ -271,21 +269,21 @@ action_update_data(Action *action)
}
action->labelbb.top = conn->endpoints[1].y - .5*ACTION_HEIGHT;
action->labelbb.bottom = action->labelstart.y + .5*ACTION_HEIGHT;
-
- action->label_width = action->labelbb.right -
+
+ action->label_width = action->labelbb.right -
action->labelbb.left;
/* Adjust the count and positions of the condition connection points. */
-
-
+
+
left = x = conn->endpoints[1].x;
right = left + action->label_width;
p1.x = conn->endpoints[1].x;
p1.y = conn->endpoints[1].y - .5 * ACTION_HEIGHT;
p2.y = p1.y + ACTION_HEIGHT;
connpointline_adjust_count(action->cps,2+(2 * action->text->numlines), &p1);
-
+
for (i=0; i<action->text->numlines; i++) {
chunksize = text_get_line_width(action->text, i);
x1 = x + 1.0;
@@ -299,7 +297,7 @@ action_update_data(Action *action)
obj->connections[(2*i) + 3]->pos = p2;
obj->connections[(2*i) + 3]->directions = DIR_SOUTH;
- x = x + chunksize + 2 * action->space_width;
+ x = x + chunksize + 2 * action->space_width;
}
p1.y = p2.y = conn->endpoints[1].y;
p1.x = left; p2.x = right;
@@ -319,7 +317,7 @@ action_update_data(Action *action)
}
-static void
+static void
action_draw(Action *action, DiaRenderer *renderer)
{
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
@@ -346,7 +344,7 @@ action_draw(Action *action, DiaRenderer *renderer)
pts[1].y = pts[0].y;
pts[2].y = pts[3].y;
pts[1].x = pts[2].x = .5 * (pts[0].x + pts[3].x);
-
+
renderer_ops->draw_polyline(renderer,
pts,sizeof(pts)/sizeof(pts[0]),
&color_black);
@@ -362,7 +360,7 @@ action_draw(Action *action, DiaRenderer *renderer)
action_text_draw(action->text,renderer);
- p1.x = p2.x = ul.x;
+ p1.x = p2.x = ul.x;
p1.y = ul.y; p2.y = br.y;
for (i=0; i<action->text->numlines-1; i++) {
@@ -395,15 +393,15 @@ action_create(Point *startpoint,
Point defaultlen = {1.0,0.0}, pos;
DiaFont* action_font;
-
+
action = g_malloc0(sizeof(Action));
conn = &action->connection;
obj = &conn->object;
extra = &conn->extra_spacing;
-
+
obj->type = &action_type;
obj->ops = &action_ops;
-
+
conn->endpoints[0] = *startpoint;
conn->endpoints[1] = *startpoint;
point_add(&conn->endpoints[1], &defaultlen);
@@ -412,7 +410,7 @@ action_create(Point *startpoint,
action->cps = connpointline_create(obj,0);
pos = conn->endpoints[1];
- action_font = dia_font_new_from_style(ACTION_FONT,ACTION_FONT_HEIGHT);
+ action_font = dia_font_new_from_style(ACTION_FONT,ACTION_FONT_HEIGHT);
action->text = new_text("",action_font, ACTION_FONT_HEIGHT,
&pos, /* never used */
&color_black, ALIGN_LEFT);
@@ -421,7 +419,7 @@ action_create(Point *startpoint,
action->macro_call = FALSE;
extra->start_long =
- extra->start_trans =
+ extra->start_trans =
extra->end_trans =
extra->end_long = ACTION_LINE_WIDTH/2.0;
@@ -442,7 +440,7 @@ action_destroy(Action *action)
connpointline_destroy(action->cps);
connection_destroy(&action->connection);
}
-
+
static DiaObject *
action_load(ObjectNode obj_node, int version,DiaContext *ctx)
{
diff --git a/objects/GRAFCET/condition.c b/objects/GRAFCET/condition.c
index 49876c5b..3a066f51 100644
--- a/objects/GRAFCET/condition.c
+++ b/objects/GRAFCET/condition.c
@@ -1,7 +1,7 @@
/* Dia -- an diagram creation/manipulation program
* Copyright (C) 1998 Alexander Larsson
*
- * GRAFCET chart support
+ * GRAFCET chart support
* Copyright (C) 2000,2001 Cyrille Chepelov
*
* This program is free software; you can redistribute it and/or modify
@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -52,7 +50,7 @@
typedef struct _Condition {
Connection connection;
-
+
Boolequation *cond;
gchar *cond_value;
@@ -81,9 +79,9 @@ static void condition_destroy(Condition *condition);
static DiaObject *condition_load(ObjectNode obj_node, int version,
DiaContext *context);
static PropDescription *condition_describe_props(Condition *condition);
-static void condition_get_props(Condition *condition,
+static void condition_get_props(Condition *condition,
GPtrArray *props);
-static void condition_set_props(Condition *condition,
+static void condition_set_props(Condition *condition,
GPtrArray *props);
static ObjectTypeOps condition_type_ops =
@@ -138,7 +136,7 @@ static PropDescription condition_props[] = {
};
static PropDescription *
-condition_describe_props(Condition *condition)
+condition_describe_props(Condition *condition)
{
if (condition_props[0].quark == 0) {
prop_desc_list_calculate_quarks(condition_props);
@@ -157,7 +155,7 @@ static PropOffset condition_offsets[] = {
static void
condition_get_props(Condition *condition, GPtrArray *props)
-{
+{
object_get_props_from_offsets(&condition->connection.object,
condition_offsets,props);
}
@@ -167,7 +165,7 @@ condition_set_props(Condition *condition, GPtrArray *props)
{
object_set_props_from_offsets(&condition->connection.object,
condition_offsets,props);
-
+
boolequation_set_value(condition->cond,condition->cond_value);
dia_font_unref(condition->cond->font);
condition->cond->font = dia_font_ref(condition->cond_font);
@@ -180,7 +178,7 @@ static real
condition_distance_from(Condition *condition, Point *point)
{
Connection *conn = &condition->connection;
- real dist;
+ real dist;
dist = distance_rectangle_point(&condition->labelbb,point);
dist = MIN(dist,distance_line_point(&conn->endpoints[0],
&conn->endpoints[1],
@@ -206,14 +204,14 @@ condition_move_handle(Condition *condition, Handle *handle,
g_assert(condition!=NULL);
g_assert(handle!=NULL);
g_assert(to!=NULL);
-
+
switch (handle->id) {
case HANDLE_MOVE_STARTPOINT:
point_copy(&s,to);
point_copy(&e,&condition->connection.endpoints[1]);
point_copy(&v,&e);
point_sub(&v,&s);
-
+
horiz = ABS(v.x) > ABS(v.y);
if (horiz) {
v.y = 0.0;
@@ -225,7 +223,7 @@ condition_move_handle(Condition *condition, Handle *handle,
point_sub(&s,&v);
/* XXX: fix e to make it look good (what's good ?) V is a good hint ? */
connection_move_handle(&condition->connection, HANDLE_MOVE_STARTPOINT,
- &s, cp, reason, modifiers);
+ &s, cp, reason, modifiers);
break;
case HANDLE_MOVE_ENDPOINT:
point_copy(&s,&condition->connection.endpoints[0]);
@@ -237,7 +235,7 @@ condition_move_handle(Condition *condition, Handle *handle,
point_copy(&s,to);
point_sub(&s,&v);
connection_move_handle(&condition->connection, HANDLE_MOVE_STARTPOINT,
- &s, NULL, reason, 0);
+ &s, NULL, reason, 0);
break;
default:
g_assert_not_reached();
@@ -252,7 +250,7 @@ static ObjectChange*
condition_move(Condition *condition, Point *to)
{
Point start_to_end;
- Point *endpoints = &condition->connection.endpoints[0];
+ Point *endpoints = &condition->connection.endpoints[0];
start_to_end = endpoints[1];
point_sub(&start_to_end, &endpoints[0]);
@@ -275,11 +273,11 @@ condition_update_data(Condition *condition)
connection_update_boundingbox(conn);
/* compute the label's width and bounding box */
- condition->cond->pos.x = conn->endpoints[0].x +
+ condition->cond->pos.x = conn->endpoints[0].x +
(.5 * dia_font_string_width("a", condition->cond->font,
condition->cond->fontheight));
condition->cond->pos.y = conn->endpoints[0].y + condition->cond->fontheight;
-
+
boolequation_calc_boundingbox(condition->cond, &condition->labelbb);
rectangle_union(&obj->bounding_box,&condition->labelbb);
@@ -287,7 +285,7 @@ condition_update_data(Condition *condition)
}
-static void
+static void
condition_draw(Condition *condition, DiaRenderer *renderer)
{
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
@@ -328,7 +326,7 @@ condition_create(Point *startpoint,
DiaObject *obj;
Point defaultlen = {0.0,CONDITION_ARROW_SIZE};
- DiaFont *default_font;
+ DiaFont *default_font;
real default_fontheight;
Color fg_color;
@@ -339,7 +337,7 @@ condition_create(Point *startpoint,
obj->type = &condition_type;
obj->ops = &condition_ops;
-
+
point_copy(&conn->endpoints[0],startpoint);
point_copy(&conn->endpoints[1],startpoint);
point_add(&conn->endpoints[1], &defaultlen);
@@ -349,7 +347,7 @@ condition_create(Point *startpoint,
default_font = NULL;
attributes_get_default_font(&default_font,&default_fontheight);
fg_color = attributes_get_foreground();
-
+
condition->cond = boolequation_create("",default_font,default_fontheight,
&fg_color);
condition->cond_value = g_strdup("");
@@ -357,8 +355,8 @@ condition_create(Point *startpoint,
condition->cond_fontheight = default_fontheight;
condition->cond_color = fg_color;
- extra->start_trans =
- extra->start_long =
+ extra->start_trans =
+ extra->start_long =
extra->end_long = CONDITION_LINE_WIDTH/2.0;
extra->end_trans = MAX(CONDITION_LINE_WIDTH,CONDITION_ARROW_SIZE) / 2.0;
@@ -376,7 +374,7 @@ condition_create(Point *startpoint,
static void
condition_destroy(Condition *condition)
{
- dia_font_unref(condition->cond_font);
+ dia_font_unref(condition->cond_font);
boolequation_destroy(condition->cond);
g_free(condition->cond_value);
connection_destroy(&condition->connection);
diff --git a/objects/GRAFCET/grafcet.c b/objects/GRAFCET/grafcet.c
index 4add6d4e..f031fd6a 100644
--- a/objects/GRAFCET/grafcet.c
+++ b/objects/GRAFCET/grafcet.c
@@ -1,6 +1,6 @@
/* Dia -- an diagram creation/manipulation program
* Copyright (C) 1998 Alexander Larsson
- *
+ *
* GRAFCET charts support
* Copyright (C) 2000 Cyrille Chepelov
*
@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include "object.h"
@@ -32,7 +30,7 @@
extern DiaObjectType step_type;
extern DiaObjectType action_type;
extern DiaObjectType transition_type;
-extern DiaObjectType vergent_type;
+extern DiaObjectType vergent_type;
extern DiaObjectType grafcet_arc_type;
extern DiaObjectType old_arc_type;
extern DiaObjectType condition_type;
@@ -49,9 +47,9 @@ dia_plugin_init(PluginInfo *info)
object_register_type(&step_type);
object_register_type(&action_type);
object_register_type(&transition_type);
- object_register_type(&vergent_type);
+ object_register_type(&vergent_type);
object_register_type(&grafcet_arc_type);
- object_register_type(&old_arc_type);
+ object_register_type(&old_arc_type);
object_register_type(&condition_type);
return DIA_PLUGIN_INIT_OK;
diff --git a/objects/GRAFCET/step.c b/objects/GRAFCET/step.c
index 5de8f85c..940a8d72 100644
--- a/objects/GRAFCET/step.c
+++ b/objects/GRAFCET/step.c
@@ -1,7 +1,7 @@
/* Dia -- an diagram creation/manipulation program
* Copyright (C) 1998 Alexander Larsson
*
- * GRAFCET charts support for Dia
+ * GRAFCET charts support for Dia
* Copyright (C) 2000, 2001 Cyrille Chepelov
*
* This program is free software; you can redistribute it and/or modify
@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -43,7 +41,7 @@
#define STEP_FONT (DIA_FONT_SANS|DIA_FONT_BOLD)
#define STEP_FONT_HEIGHT 1
-#define STEP_LINE_WIDTH GRAFCET_GENERAL_LINE_WIDTH
+#define STEP_LINE_WIDTH GRAFCET_GENERAL_LINE_WIDTH
#define STEP_WIDTH 3.0
#define STEP_DECLAREDWIDTH 4.0
#define STEP_HEIGHT 4.0
@@ -77,7 +75,7 @@ typedef struct _Step {
Handle north,south;
Point SD1,SD2,NU1,NU2;
- /* These are useful points for drawing.
+ /* These are useful points for drawing.
Must be in sequence, A first, Z last. */
Point A,B,C,D,E,F,G,H,I,J,Z;
} Step;
@@ -102,9 +100,9 @@ static void step_been_renamed(const gchar *sid);
static DiaObject *step_load(ObjectNode obj_node, int version,
DiaContext *ctx);
static PropDescription *step_describe_props(Step *step);
-static void step_get_props(Step *step,
+static void step_get_props(Step *step,
GPtrArray *props);
-static void step_set_props(Step *step,
+static void step_set_props(Step *step,
GPtrArray *props);
static ObjectTypeOps step_type_ops =
@@ -156,7 +154,7 @@ static PropDescription step_props[] = {
{ "id", PROP_TYPE_STRING,
PROP_FLAG_VISIBLE|PROP_FLAG_NO_DEFAULTS|PROP_FLAG_DONT_MERGE,
N_("Step name"),N_("The name of the step")},
- { "type", PROP_TYPE_ENUM,
+ { "type", PROP_TYPE_ENUM,
PROP_FLAG_VISIBLE|PROP_FLAG_NO_DEFAULTS|PROP_FLAG_DONT_MERGE,
N_("Step type"),N_("The kind of step"),step_style},
{ "active", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE,
@@ -173,13 +171,13 @@ static PropDescription step_props[] = {
};
static PropDescription *
-step_describe_props(Step *step)
+step_describe_props(Step *step)
{
if (step_props[0].quark == 0) {
prop_desc_list_calculate_quarks(step_props);
}
return step_props;
-}
+}
static PropOffset step_offsets[] = {
ELEMENT_COMMON_PROPERTIES_OFFSETS,
@@ -190,13 +188,13 @@ static PropOffset step_offsets[] = {
{ "font_size", PROP_TYPE_FONTSIZE, offsetof(Step,font_size)},
{ "font_color", PROP_TYPE_COLOUR, offsetof(Step,font_color)},
{ "north_pos", PROP_TYPE_POINT, offsetof(Step,north.pos)},
- { "south_pos", PROP_TYPE_POINT, offsetof(Step,south.pos)},
+ { "south_pos", PROP_TYPE_POINT, offsetof(Step,south.pos)},
{ NULL,0,0 }
};
static void
step_get_props(Step *step, GPtrArray *props)
-{
+{
object_get_props_from_offsets(&step->element.object,
step_offsets,props);
}
@@ -210,23 +208,23 @@ step_set_props(Step *step, GPtrArray *props)
step_update_data(step);
}
-/* the following two functions try to be clever when allocating
+/* the following two functions try to be clever when allocating
step numbers */
static int __stepnum = 0;
static int __Astyle = 0;
-static gchar *new_step_name()
+static gchar *new_step_name()
{
char snum[16];
char *p = snum;
-
+
if (__Astyle) *p++ = 'A';
-
+
g_snprintf(p,sizeof(snum)-2,"%d",__stepnum++);
return g_strdup(snum);
}
-static void step_been_renamed(const gchar *sid)
+static void step_been_renamed(const gchar *sid)
{
gchar *endptr;
long int snum;
@@ -239,7 +237,7 @@ static void step_been_renamed(const gchar *sid)
}
endptr = NULL;
snum = strtol(sid,&endptr,10);
- if (*endptr == '\0') __stepnum = snum + 1;
+ if (*endptr == '\0') __stepnum = snum + 1;
}
static Color color_red = { 1.0f, 0.0f, 0.0f, 1.0f };
@@ -314,7 +312,7 @@ step_move(Step *step, Point *to)
step->element.corner = *to;
point_add(&step->north.pos,&delta);
point_add(&step->south.pos,&delta);
-
+
step_update_data(step);
return NULL;
@@ -355,19 +353,19 @@ step_draw(Step *step, DiaRenderer *renderer)
} else {
renderer_ops->draw_rect(renderer, &step->E, &step->F, &color_white, &color_black);
}
-
+
if (step->type != STEP_MACROENTRY)
renderer_ops->draw_line(renderer,&step->A,&step->B,&color_black);
if (step->type != STEP_MACROEXIT)
renderer_ops->draw_line(renderer,&step->C,&step->D,&color_black);
-
+
renderer_ops->set_font(renderer, step->font, step->font_size);
- renderer_ops->draw_string(renderer,
- step->id,
- &step->G, ALIGN_CENTER,
+ renderer_ops->draw_string(renderer,
+ step->id,
+ &step->G, ALIGN_CENTER,
&step->font_color);
- if (step->active)
+ if (step->active)
renderer_ops->draw_ellipse(renderer,
&step->H,
STEP_DOT_RADIUS,STEP_DOT_RADIUS,
@@ -391,12 +389,12 @@ step_update_data(Step *step)
step->E.x = 0.0; step->E.y = 0.5;
step->F.x = STEP_WIDTH; step->F.y = STEP_HEIGHT- 0.5;
-
+
switch(step->type) {
case STEP_INITIAL:
- step->I.x = step->E.x - 2 * STEP_LINE_WIDTH;
+ step->I.x = step->E.x - 2 * STEP_LINE_WIDTH;
step->I.y = step->E.y - 2 * STEP_LINE_WIDTH;
- step->J.x = step->F.x + 2 * STEP_LINE_WIDTH;
+ step->J.x = step->F.x + 2 * STEP_LINE_WIDTH;
step->J.y = step->F.y + 2 * STEP_LINE_WIDTH;
step->B.x = step->A.x; step->B.y = step->I.y;
@@ -404,9 +402,9 @@ step_update_data(Step *step)
step->Z.x = step->J.x; step->Z.y = STEP_HEIGHT / 2;
break;
case STEP_MACROCALL:
- step->I.x = step->E.x;
+ step->I.x = step->E.x;
step->I.y = step->E.y - 2 * STEP_LINE_WIDTH;
- step->J.x = step->F.x;
+ step->J.x = step->F.x;
step->J.y = step->F.y + 2 * STEP_LINE_WIDTH;
step->B.x = step->A.x; step->B.y = step->I.y;
@@ -414,9 +412,9 @@ step_update_data(Step *step)
step->Z.x = step->J.x; step->Z.y = STEP_HEIGHT / 2;
break;
case STEP_SUBPCALL:
- step->I.x = step->E.x - 2 * STEP_LINE_WIDTH;
+ step->I.x = step->E.x - 2 * STEP_LINE_WIDTH;
step->I.y = step->E.y;
- step->J.x = step->F.x + 2 * STEP_LINE_WIDTH;
+ step->J.x = step->F.x + 2 * STEP_LINE_WIDTH;
step->J.y = step->F.y;
step->B.x = step->A.x; step->B.y = step->I.y;
@@ -428,12 +426,12 @@ step_update_data(Step *step)
step->C.x = step->D.x; step->C.y = step->F.y;
step->Z.x = step->F.x; step->Z.y = STEP_HEIGHT / 2;
}
-
+
step->G.x = step->A.x;
step->G.y = (STEP_HEIGHT / 2) + (.3 * step->font_size);
step->H.x = step->E.x + (1.2 * STEP_DOT_RADIUS);
step->H.y = step->F.y - (1.2 * STEP_DOT_RADIUS);
-
+
for (p=&(step->A); p<=&(step->Z) ; p++)
point_add(p,&ulc);
@@ -465,13 +463,13 @@ step_update_data(Step *step)
} else {
extra->border_trans = STEP_LINE_WIDTH / 2;
}
-
+
element_update_boundingbox(elem);
rectangle_add_point(&obj->bounding_box,&step->north.pos);
rectangle_add_point(&obj->bounding_box,&step->south.pos);
obj->position = elem->corner;
-
+
element_update_handles(elem);
}
@@ -486,11 +484,11 @@ step_create(Point *startpoint,
DiaObject *obj;
int i;
int type;
-
+
step = g_new0(Step,1);
elem = &step->element;
obj = &elem->object;
-
+
obj->type = &step_type;
obj->ops = &step_ops;
@@ -511,7 +509,7 @@ step_create(Point *startpoint,
step->font = dia_font_new_from_style (STEP_FONT,STEP_FONT_HEIGHT);
step->font_size = STEP_FONT_HEIGHT;
step->font_color = color_black;
-
+
type = GPOINTER_TO_INT(user_data);
switch(type) {
case STEP_NORMAL:
@@ -525,7 +523,7 @@ step_create(Point *startpoint,
default:
step->type = STEP_NORMAL;
}
-
+
for (i=0;i<8;i++) {
obj->handles[i]->type = HANDLE_NON_MOVABLE;
@@ -543,14 +541,14 @@ step_create(Point *startpoint,
step_update_data(step);
*handle1 = NULL;
- *handle2 = obj->handles[0];
+ *handle2 = obj->handles[0];
return &step->element.object;
}
static void
step_destroy(Step *step)
{
- dia_font_unref(step->font);
+ dia_font_unref(step->font);
g_free(step->id);
element_destroy(&step->element);
}
@@ -561,7 +559,7 @@ step_load(ObjectNode obj_node, int version, DiaContext *ctx)
return object_load_using_properties(&step_type,
obj_node,version,ctx);
}
-
+
diff --git a/objects/GRAFCET/transition.c b/objects/GRAFCET/transition.c
index 152f7c9c..602e2021 100644
--- a/objects/GRAFCET/transition.c
+++ b/objects/GRAFCET/transition.c
@@ -1,7 +1,7 @@
/* Dia -- an diagram creation/manipulation program
* Copyright (C) 1998 Alexander Larsson
*
- * GRAFCET chart support
+ * GRAFCET chart support
* Copyright(C) 2000,2001 Cyrille Chepelov
*
* This program is free software; you can redistribute it and/or modify
@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -58,7 +56,7 @@
typedef struct _Transition {
Element element;
-
+
Boolequation *receptivity;
DiaFont *rcep_font;
real rcep_fontheight;
@@ -68,7 +66,7 @@ typedef struct _Transition {
ConnectionPoint connections[2];
Handle north,south;
Point SD1,SD2,NU1,NU2;
-
+
/* computed values : */
Rectangle rceptbb; /* The bounding box of the receptivity */
Point A,B,C,D,Z;
@@ -92,9 +90,9 @@ static void transition_destroy(Transition *transition);
static DiaObject *transition_load(ObjectNode obj_node, int version,
DiaContext *ctx);
static PropDescription *transition_describe_props(Transition *transition);
-static void transition_get_props(Transition *transition,
+static void transition_get_props(Transition *transition,
GPtrArray *props);
-static void transition_set_props(Transition *transition,
+static void transition_set_props(Transition *transition,
GPtrArray *props);
static ObjectTypeOps transition_type_ops =
@@ -146,17 +144,17 @@ static PropDescription transition_props[] = {
N_("Color"),N_("The receptivity's color")},
{ "north_pos",PROP_TYPE_POINT,0,N_("North point"),NULL },
{ "south_pos",PROP_TYPE_POINT,0,N_("South point"),NULL },
- PROP_DESC_END
+ PROP_DESC_END
};
static PropDescription *
-transition_describe_props(Transition *transition)
+transition_describe_props(Transition *transition)
{
if (transition_props[0].quark == 0) {
prop_desc_list_calculate_quarks(transition_props);
}
return transition_props;
-}
+}
static PropOffset transition_offsets[] = {
ELEMENT_COMMON_PROPERTIES_OFFSETS,
@@ -171,7 +169,7 @@ static PropOffset transition_offsets[] = {
static void
transition_get_props(Transition *transition, GPtrArray *props)
-{
+{
object_get_props_from_offsets(&transition->element.object,
transition_offsets,props);
}
@@ -206,22 +204,22 @@ transition_update_data(Transition *transition)
/* compute the useful points' positions : */
transition->A.x = transition->B.x = (TRANSITION_DECLAREDWIDTH / 2.0);
- transition->A.y = (TRANSITION_DECLAREDHEIGHT / 2.0)
+ transition->A.y = (TRANSITION_DECLAREDHEIGHT / 2.0)
- (TRANSITION_HEIGHT / 2.0);
transition->B.y = transition->A.y + TRANSITION_HEIGHT;
transition->C.y = transition->D.y = (TRANSITION_DECLAREDHEIGHT / 2.0);
- transition->C.x =
+ transition->C.x =
(TRANSITION_DECLAREDWIDTH / 2.0) - (TRANSITION_WIDTH / 2.0);
transition->D.x = transition->C.x + TRANSITION_WIDTH;
-
- transition->Z.y = (TRANSITION_DECLAREDHEIGHT / 2.0)
+
+ transition->Z.y = (TRANSITION_DECLAREDHEIGHT / 2.0)
+ (.3 * transition->receptivity->fontheight);
- transition->Z.x = transition->D.x +
+ transition->Z.x = transition->D.x +
dia_font_string_width("_",transition->receptivity->font,
transition->receptivity->fontheight);
- for (p = &transition->A; p <= &transition->Z; p++)
+ for (p = &transition->A; p <= &transition->Z; p++)
point_add(p,&elem->corner);
transition->receptivity->pos = transition->Z;
@@ -234,11 +232,11 @@ transition_update_data(Transition *transition)
}
transition->NU1.x = transition->north.pos.x;
transition->NU2.x = transition->A.x;
- transition->NU1.y = transition->NU2.y =
+ transition->NU1.y = transition->NU2.y =
(transition->north.pos.y + transition->A.y) / 2.0;
transition->SD1.x = transition->B.x;
transition->SD2.x = transition->south.pos.x;
- transition->SD1.y = transition->SD2.y =
+ transition->SD1.y = transition->SD2.y =
(transition->south.pos.y + transition->B.y) / 2.0;
obj->connections[0]->pos = transition->A;
@@ -291,7 +289,7 @@ transition_select(Transition *transition, Point *clicked_point,
static ObjectChange*
transition_move_handle(Transition *transition, Handle *handle,
Point *to, ConnectionPoint *cp,
- HandleMoveReason reason,
+ HandleMoveReason reason,
ModifierKeys modifiers)
{
g_assert(transition!=NULL);
@@ -301,16 +299,16 @@ transition_move_handle(Transition *transition, Handle *handle,
switch(handle->id) {
case HANDLE_NORTH:
transition->north.pos = *to;
- if (transition->north.pos.y > transition->A.y)
+ if (transition->north.pos.y > transition->A.y)
transition->north.pos.y = transition->A.y;
break;
case HANDLE_SOUTH:
transition->south.pos = *to;
- if (transition->south.pos.y < transition->B.y)
+ if (transition->south.pos.y < transition->B.y)
transition->south.pos.y = transition->B.y;
break;
default:
- element_move_handle(&transition->element, handle->id, to, cp,
+ element_move_handle(&transition->element, handle->id, to, cp,
reason, modifiers);
}
@@ -337,7 +335,7 @@ transition_move(Transition *transition, Point *to)
}
-static void
+static void
transition_draw(Transition *transition, DiaRenderer *renderer)
{
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
@@ -358,7 +356,7 @@ transition_draw(Transition *transition, DiaRenderer *renderer)
renderer_ops->draw_line(renderer,
&transition->C,&transition->D,
&color_black);
-
+
boolequation_draw(transition->receptivity,renderer);
}
@@ -372,17 +370,17 @@ transition_create(Point *startpoint,
DiaObject *obj;
int i;
Element *elem;
- DiaFont *default_font = NULL;
+ DiaFont *default_font = NULL;
real default_fontheight;
Color fg_color;
transition = g_malloc0(sizeof(Transition));
elem = &transition->element;
obj = &elem->object;
-
+
obj->type = &transition_type;
obj->ops = &transition_ops;
-
+
elem->corner = *startpoint;
elem->width = TRANSITION_DECLAREDWIDTH;
elem->height = TRANSITION_DECLAREDHEIGHT;
@@ -391,8 +389,8 @@ transition_create(Point *startpoint,
attributes_get_default_font(&default_font,&default_fontheight);
fg_color = attributes_get_foreground();
-
- transition->receptivity =
+
+ transition->receptivity =
boolequation_create("",
default_font,
default_fontheight,
@@ -404,7 +402,7 @@ transition_create(Point *startpoint,
transition->rcep_color = fg_color;
dia_font_unref(default_font);
-
+
for (i=0;i<8;i++) {
obj->handles[i]->type = HANDLE_NON_MOVABLE;
@@ -428,7 +426,7 @@ transition_create(Point *startpoint,
transition_update_data(transition);
*handle1 = NULL;
- *handle2 = obj->handles[0];
+ *handle2 = obj->handles[0];
return &transition->element.object;
}
diff --git a/objects/GRAFCET/vector.c b/objects/GRAFCET/vector.c
index a23bb782..6d420c2f 100644
--- a/objects/GRAFCET/vector.c
+++ b/objects/GRAFCET/vector.c
@@ -1,7 +1,7 @@
/* Dia -- an diagram creation/manipulation program
* Copyright (C) 1998 Alexander Larsson
*
- * GRAFCET charts support for Dia
+ * GRAFCET charts support for Dia
* Copyright (C) 2000 Cyrille Chepelov
*
* This file is derived from objects/standard/zigzag.c
@@ -21,9 +21,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -71,9 +69,9 @@ static DiaMenu *arc_get_object_menu(Arc *arc,
static DiaObject *arc_load(ObjectNode obj_node, int version,DiaContext *ctx);
static PropDescription *arc_describe_props(Arc *arc);
-static void arc_get_props(Arc *arc,
+static void arc_get_props(Arc *arc,
GPtrArray *props);
-static void arc_set_props(Arc *arc,
+static void arc_set_props(Arc *arc,
GPtrArray *props);
static ObjectTypeOps arc_type_ops =
@@ -128,13 +126,13 @@ static PropDescription arc_props[] = {
};
static PropDescription *
-arc_describe_props(Arc *arc)
+arc_describe_props(Arc *arc)
{
if (arc_props[0].quark == 0) {
prop_desc_list_calculate_quarks(arc_props);
}
return arc_props;
-}
+}
static PropOffset arc_offsets[] = {
ORTHCONN_COMMON_PROPERTIES_OFFSETS,
@@ -144,7 +142,7 @@ static PropOffset arc_offsets[] = {
static void
arc_get_props(Arc *arc, GPtrArray *props)
-{
+{
object_get_props_from_offsets(&arc->orth.object,
arc_offsets,props);
}
@@ -202,10 +200,10 @@ arc_draw(Arc *arc, DiaRenderer *renderer)
OrthConn *orth = &arc->orth;
Point *points;
int n,i;
-
+
points = &orth->points[0];
n = orth->numpoints;
-
+
renderer_ops->set_linewidth(renderer, ARC_LINE_WIDTH);
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID, 0.0);
renderer_ops->set_linejoin(renderer, LINEJOIN_MITER);
@@ -244,16 +242,16 @@ arc_create(Point *startpoint,
arc = g_malloc0(sizeof(Arc));
orth = &arc->orth;
obj = &orth->object;
-
+
obj->type = &grafcet_arc_type;
obj->ops = &arc_ops;
-
+
orthconn_init(orth, startpoint);
-
+
arc->uparrow = TRUE;
arc_update_data(arc);
-
+
*handle1 = orth->handles[0];
*handle2 = orth->handles[orth->numhandles-1];
return &arc->orth.object;
@@ -272,17 +270,17 @@ arc_update_data(Arc *arc)
PolyBBExtras *extra = &orth->extra_spacing;
orthconn_update_data(&arc->orth);
-
- extra->start_trans =
+
+ extra->start_trans =
extra->start_long =
- extra->end_long =
+ extra->end_long =
extra->end_trans = ARC_LINE_WIDTH/2.0;
if (arc->uparrow) {
extra->middle_trans = (ARC_LINE_WIDTH + ARC_ARROW_WIDTH)/2.0;
} else {
extra->middle_trans = ARC_LINE_WIDTH/2.0;
}
-
+
orthconn_update_boundingbox(orth);
}
diff --git a/objects/GRAFCET/vergent.c b/objects/GRAFCET/vergent.c
index 4bd2771c..bca8a51f 100644
--- a/objects/GRAFCET/vergent.c
+++ b/objects/GRAFCET/vergent.c
@@ -1,7 +1,7 @@
/* Dia -- an diagram creation/manipulation program
* Copyright (C) 1998 Alexander Larsson
*
- * GRAFCET chart support
+ * GRAFCET chart support
* Copyright(C) 2000 Cyrille Chepelov
*
* This program is free software; you can redistribute it and/or modify
@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -47,7 +45,7 @@ typedef enum { VERGENT_OR, VERGENT_AND } VergentType;
typedef struct _Vergent {
Connection connection;
-
+
ConnectionPoint northeast,northwest,southwest,southeast;
ConnPointLine *north,*south;
@@ -56,7 +54,7 @@ typedef struct _Vergent {
static ObjectChange* vergent_move_handle(Vergent *vergent, Handle *handle,
Point *to, ConnectionPoint *cp,
- HandleMoveReason reason,
+ HandleMoveReason reason,
ModifierKeys modifiers);
static ObjectChange* vergent_move(Vergent *vergent, Point *to);
static void vergent_select(Vergent *vergent, Point *clicked_point,
@@ -71,9 +69,9 @@ static void vergent_update_data(Vergent *vergent);
static void vergent_destroy(Vergent *vergent);
static DiaObject *vergent_load(ObjectNode obj_node, int version,DiaContext *ctx);
static PropDescription *vergent_describe_props(Vergent *vergent);
-static void vergent_get_props(Vergent *vergent,
+static void vergent_get_props(Vergent *vergent,
GPtrArray *props);
-static void vergent_set_props(Vergent *vergent,
+static void vergent_set_props(Vergent *vergent,
GPtrArray *props);
static DiaMenu *vergent_get_object_menu(Vergent *vergent,
@@ -84,8 +82,8 @@ static ObjectTypeOps vergent_type_ops =
(CreateFunc)vergent_create, /* create */
(LoadFunc) vergent_load,/*using properties*/ /* load */
(SaveFunc) object_save_using_properties, /* save */
- (GetDefaultsFunc) NULL,
- (ApplyDefaultsFunc) NULL
+ (GetDefaultsFunc) NULL,
+ (ApplyDefaultsFunc) NULL
};
DiaObjectType vergent_type =
@@ -134,7 +132,7 @@ static PropDescription vergent_props[] = {
};
static PropDescription *
-vergent_describe_props(Vergent *vergent)
+vergent_describe_props(Vergent *vergent)
{
if (vergent_props[0].quark == 0) {
prop_desc_list_calculate_quarks(vergent_props);
@@ -152,7 +150,7 @@ static PropOffset vergent_offsets[] = {
static void
vergent_get_props(Vergent *vergent, GPtrArray *props)
-{
+{
object_get_props_from_offsets(&vergent->connection.object,
vergent_offsets,props);
}
@@ -161,7 +159,7 @@ static void
vergent_set_props(Vergent *vergent, GPtrArray *props)
{
object_set_props_from_offsets(&vergent->connection.object,
- vergent_offsets,props);
+ vergent_offsets,props);
vergent_update_data(vergent);
}
@@ -209,7 +207,7 @@ vergent_move_handle(Vergent *vergent, Handle *handle,
to2.x = to->x;
to2.y = vergent->connection.endpoints[0].y;
- connection_move_handle(&vergent->connection, HANDLE_MOVE_ENDPOINT,
+ connection_move_handle(&vergent->connection, HANDLE_MOVE_ENDPOINT,
&to2, NULL, reason, 0);
}
connection_move_handle(&vergent->connection, handle->id, to, cp,
@@ -224,7 +222,7 @@ static ObjectChange*
vergent_move(Vergent *vergent, Point *to)
{
Point start_to_end;
- Point *endpoints = &vergent->connection.endpoints[0];
+ Point *endpoints = &vergent->connection.endpoints[0];
start_to_end = endpoints[1];
point_sub(&start_to_end, &endpoints[0]);
@@ -238,7 +236,7 @@ vergent_move(Vergent *vergent, Point *to)
}
-static void
+static void
vergent_draw(Vergent *vergent, DiaRenderer *renderer)
{
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
@@ -246,7 +244,7 @@ vergent_draw(Vergent *vergent, DiaRenderer *renderer)
Point p1,p2;
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID, 0.0);
-
+
switch(vergent->type) {
case VERGENT_OR:
renderer_ops->set_linewidth(renderer, VERGENT_LINE_WIDTH);
@@ -277,9 +275,9 @@ vergent_update_data(Vergent *vergent)
LineBBExtras *extra = &conn->extra_spacing;
DiaObject *obj = &conn->object;
Point p0,p1;
-
+
conn->endpoints[1].y = conn->endpoints[0].y;
- if (ABS(conn->endpoints[1].x-conn->endpoints[0].x) < 3.0)
+ if (ABS(conn->endpoints[1].x-conn->endpoints[0].x) < 3.0)
conn->endpoints[1].x = conn->endpoints[0].x + 3.0;
obj->position = conn->endpoints[0];
@@ -290,8 +288,8 @@ vergent_update_data(Vergent *vergent)
switch(vergent->type) {
case VERGENT_OR:
- extra->start_trans =
- extra->start_long =
+ extra->start_trans =
+ extra->start_long =
extra->end_trans =
extra->end_long = VERGENT_LINE_WIDTH/2.0;
connection_update_boundingbox(conn);
@@ -307,17 +305,17 @@ vergent_update_data(Vergent *vergent)
connpointline_putonaline(vergent->south,&p0,&p1,DIR_SOUTH);
vergent->southwest.pos = p0;
vergent->southwest.directions = DIR_SOUTH;
- vergent->southeast.pos = p1;
+ vergent->southeast.pos = p1;
vergent->southeast.directions = DIR_SOUTH;
break;
case VERGENT_AND:
- extra->start_trans =
+ extra->start_trans =
extra->end_trans = (3 * VERGENT_LINE_WIDTH)/2.0;
- extra->start_long =
+ extra->start_long =
extra->end_long = VERGENT_LINE_WIDTH/2.0;
connection_update_boundingbox(conn);
connection_update_boundingbox(conn);
-
+
/* place the connection point lines */
p0.y = p1.y = p0.y - VERGENT_LINE_WIDTH;
connpointline_update(vergent->north);
@@ -342,7 +340,7 @@ vergent_update_data(Vergent *vergent)
typedef struct {
ObjectChange obj_change;
-
+
ObjectChange *north,*south;
} VergentChange;
@@ -358,7 +356,7 @@ static void vergent_change_revert(VergentChange *change, DiaObject *obj)
change->south->revert(change->south,obj);
}
-static void vergent_change_free(VergentChange *change)
+static void vergent_change_free(VergentChange *change)
{
if (change->north->free) change->north->free(change->north);
g_free(change->north);
@@ -367,15 +365,15 @@ static void vergent_change_free(VergentChange *change)
}
static ObjectChange *
-vergent_create_change(Vergent *vergent, int add, Point *clicked)
+vergent_create_change(Vergent *vergent, int add, Point *clicked)
{
VergentChange *vc;
-
+
vc = g_new0(VergentChange,1);
vc->obj_change.apply = (ObjectChangeApplyFunc)vergent_change_apply;
vc->obj_change.revert = (ObjectChangeRevertFunc)vergent_change_revert;
vc->obj_change.free = (ObjectChangeFreeFunc)vergent_change_free;
-
+
if (add) {
vc->north = connpointline_add_point(vergent->north,clicked);
vc->south = connpointline_add_point(vergent->south,clicked);
@@ -395,8 +393,8 @@ vergent_add_cp_callback(DiaObject *obj, Point *clicked, gpointer data)
static ObjectChange *
vergent_delete_cp_callback(DiaObject *obj, Point *clicked, gpointer data)
-{
- return vergent_create_change((Vergent *)obj,0,clicked);
+{
+ return vergent_create_change((Vergent *)obj,0,clicked);
}
static DiaMenuItem object_menu_items[] = {
@@ -438,10 +436,10 @@ vergent_create(Point *startpoint,
vergent = g_malloc0(sizeof(Vergent));
conn = &vergent->connection;
obj = &conn->object;
-
+
obj->type = &vergent_type;
obj->ops = &vergent_ops;
-
+
conn->endpoints[0] = *startpoint;
conn->endpoints[1] = *startpoint;
point_add(&conn->endpoints[1], &defaultlen);
@@ -456,10 +454,10 @@ vergent_create(Point *startpoint,
obj->connections[i]->object = obj;
obj->connections[i]->connected = NULL;
}
-
+
vergent->north = connpointline_create(obj,1);
vergent->south = connpointline_create(obj,1);
-
+
switch(GPOINTER_TO_INT(user_data)) {
case VERGENT_OR:
case VERGENT_AND:
@@ -469,7 +467,7 @@ vergent_create(Point *startpoint,
g_warning("in vergent_create(): incorrect user_data %p",user_data);
vergent->type = VERGENT_OR;
}
-
+
vergent_update_data(vergent);
*handle1 = &conn->endpoint_handles[0];
diff --git a/objects/Istar/actor.c b/objects/Istar/actor.c
index 75f26093..b1fb7b45 100644
--- a/objects/Istar/actor.c
+++ b/objects/Istar/actor.c
@@ -22,9 +22,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -207,7 +205,7 @@ actor_select(Actor *actor, Point *clicked_point,
static ObjectChange*
actor_move_handle(Actor *actor, Handle *handle,
- Point *to, ConnectionPoint *cp,
+ Point *to, ConnectionPoint *cp,
HandleMoveReason reason, ModifierKeys modifiers)
{
AnchorShape horiz = ANCHOR_MIDDLE, vert = ANCHOR_MIDDLE;
@@ -340,11 +338,11 @@ actor_update_data(Actor *actor, AnchorShape horiz, AnchorShape vert)
mradius=width;
if (mradius<height) mradius=height;
if (mradius<ACTOR_RADIUS) mradius=ACTOR_RADIUS;
-
+
/* radius */
radius=elem->width;
if (radius<elem->height) radius=elem->height;
-
+
/* enforce (minimal or resized) radius */
if (radius<mradius) radius=mradius;
elem->width=elem->height=radius;
diff --git a/objects/Istar/goal.c b/objects/Istar/goal.c
index 04338535..27d388ba 100644
--- a/objects/Istar/goal.c
+++ b/objects/Istar/goal.c
@@ -26,9 +26,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
diff --git a/objects/Istar/istar.c b/objects/Istar/istar.c
index 7d2f9c5f..5728833b 100644
--- a/objects/Istar/istar.c
+++ b/objects/Istar/istar.c
@@ -21,10 +21,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-
-#ifdef HAVE_CONFIG_H
+
#include <config.h>
-#endif
#include "object.h"
diff --git a/objects/Istar/link.c b/objects/Istar/link.c
index 340f90f1..42e0c1a5 100644
--- a/objects/Istar/link.c
+++ b/objects/Istar/link.c
@@ -20,9 +20,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -212,7 +210,7 @@ link_select(Link *link, Point *clicked_point,
static ObjectChange*
link_move_handle(Link *link, Handle *handle,
- Point *to, ConnectionPoint *cp,
+ Point *to, ConnectionPoint *cp,
HandleMoveReason reason, ModifierKeys modifiers)
{
Point p1, p2;
@@ -261,8 +259,8 @@ link_move(Link *link, Point *to)
return NULL;
}
-static Point
-bezier_line_eval(BezPoint *line,int p,real u)
+static Point
+bezier_line_eval(BezPoint *line,int p,real u)
{
real bx[4],by[4];
Point res;
@@ -289,8 +287,8 @@ bezier_line_eval(BezPoint *line,int p,real u)
d is lateral offset
cx,cy are text width/height
*/
-static Point
-compute_annot(Point* p1, Point* p2, Point* pm, double f, double d)
+static Point
+compute_annot(Point* p1, Point* p2, Point* pm, double f, double d)
{
Point res;
double dx,dy,k;
diff --git a/objects/Istar/other.c b/objects/Istar/other.c
index df32736a..9344bbda 100644
--- a/objects/Istar/other.c
+++ b/objects/Istar/other.c
@@ -25,9 +25,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
diff --git a/objects/Jackson/domain.c b/objects/Jackson/domain.c
index b961c375..878b81d2 100644
--- a/objects/Jackson/domain.c
+++ b/objects/Jackson/domain.c
@@ -25,9 +25,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <stdio.h>
#include <assert.h>
diff --git a/objects/Jackson/jackson.c b/objects/Jackson/jackson.c
index 33614c2f..d2e52493 100644
--- a/objects/Jackson/jackson.c
+++ b/objects/Jackson/jackson.c
@@ -24,10 +24,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-
-#ifdef HAVE_CONFIG_H
+
#include <config.h>
-#endif
#include "object.h"
diff --git a/objects/Jackson/phenomenon.c b/objects/Jackson/phenomenon.c
index 9f7075c9..14808d43 100644
--- a/objects/Jackson/phenomenon.c
+++ b/objects/Jackson/phenomenon.c
@@ -25,9 +25,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -358,7 +356,7 @@ message_create(Point *startpoint,
case 2: message->type=MSG_REQ; break;
default: message->type=MSG_SHARED; break;
}
-
+
if (GPOINTER_TO_INT(user_data)!=0) message->init=-1; else message->init=0;
return &message->connection.object;
}
diff --git a/objects/Jackson/requirement.c b/objects/Jackson/requirement.c
index 9498f86c..416df574 100644
--- a/objects/Jackson/requirement.c
+++ b/objects/Jackson/requirement.c
@@ -25,9 +25,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -186,7 +184,7 @@ req_select(Requirement *req, Point *clicked_point,
element_update_handles(&req->element);
}
-static ObjectChange*
+static ObjectChange*
req_move_handle(Requirement *req, Handle *handle,
Point *to, ConnectionPoint *cp,
HandleMoveReason reason, ModifierKeys modifiers)
diff --git a/objects/KAOS/goal.c b/objects/KAOS/goal.c
index 403b4402..36ac79ac 100644
--- a/objects/KAOS/goal.c
+++ b/objects/KAOS/goal.c
@@ -26,9 +26,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
diff --git a/objects/KAOS/kaos.c b/objects/KAOS/kaos.c
index fc23a07a..4e2aae56 100644
--- a/objects/KAOS/kaos.c
+++ b/objects/KAOS/kaos.c
@@ -25,10 +25,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-
-#ifdef HAVE_CONFIG_H
+
#include <config.h>
-#endif
#include "object.h"
diff --git a/objects/KAOS/metaandorrel.c b/objects/KAOS/metaandorrel.c
index 510f53da..68a7a94c 100644
--- a/objects/KAOS/metaandorrel.c
+++ b/objects/KAOS/metaandorrel.c
@@ -26,9 +26,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
diff --git a/objects/KAOS/metabinrel.c b/objects/KAOS/metabinrel.c
index b8c96a18..bdaa31d8 100644
--- a/objects/KAOS/metabinrel.c
+++ b/objects/KAOS/metabinrel.c
@@ -26,9 +26,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
diff --git a/objects/KAOS/other.c b/objects/KAOS/other.c
index 8d4fac27..a28648f2 100644
--- a/objects/KAOS/other.c
+++ b/objects/KAOS/other.c
@@ -26,9 +26,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -290,7 +288,7 @@ static void compute_agent(Other *other, Point *pl) {
pl[5].y=ry+h;
}
-static void
+static void
draw_agent_icon(Other *other, DiaRenderer *renderer)
{
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
diff --git a/objects/Misc/analog_clock.c b/objects/Misc/analog_clock.c
index 51cd651a..433f1161 100644
--- a/objects/Misc/analog_clock.c
+++ b/objects/Misc/analog_clock.c
@@ -2,7 +2,7 @@
* Copyright (C) 1998 Alexander Larsson
*
* Analog clock object
- * Copyright (C) 2002 Cyrille Chepelov
+ * Copyright (C) 2002 Cyrille Chepelov
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -47,7 +45,7 @@ typedef struct _Chronoline {
ConnectionPoint hours[12];
ConnectionPoint hour_tip, min_tip, sec_tip;
ConnectionPoint center_cp;
-
+
Color border_color;
real border_line_width;
Color inner_color;
@@ -70,8 +68,8 @@ static void analog_clock_select(Analog_Clock *analog_clock,
Point *clicked_point,
DiaRenderer *interactive_renderer);
static ObjectChange* analog_clock_move_handle(Analog_Clock *analog_clock,
- Handle *handle, Point *to,
- ConnectionPoint *cp, HandleMoveReason reason,
+ Handle *handle, Point *to,
+ ConnectionPoint *cp, HandleMoveReason reason,
ModifierKeys modifiers);
static ObjectChange* analog_clock_move(Analog_Clock *analog_clock, Point *to);
static void analog_clock_draw(Analog_Clock *analog_clock, DiaRenderer *renderer);
@@ -81,13 +79,13 @@ static DiaObject *analog_clock_create(Point *startpoint,
Handle **handle1,
Handle **handle2);
static void analog_clock_destroy(Analog_Clock *analog_clock);
-static DiaObject *analog_clock_load(ObjectNode obj_node, int version,
+static DiaObject *analog_clock_load(ObjectNode obj_node, int version,
DiaContext *ctx);
static PropDescription *analog_clock_describe_props(
Analog_Clock *analog_clock);
-static void analog_clock_get_props(Analog_Clock *analog_clock,
+static void analog_clock_get_props(Analog_Clock *analog_clock,
GPtrArray *props);
-static void analog_clock_set_props(Analog_Clock *analog_clock,
+static void analog_clock_set_props(Analog_Clock *analog_clock,
GPtrArray *props);
static ObjectTypeOps analog_clock_type_ops =
@@ -142,18 +140,18 @@ static PropDescription analog_clock_props[] = {
N_("Seconds arrow line width"), NULL,NULL },
{ "show_ticks", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE,
N_("Show hours"), NULL, NULL },
-
+
{NULL}
};
static PropDescription *
-analog_clock_describe_props(Analog_Clock *analog_clock)
+analog_clock_describe_props(Analog_Clock *analog_clock)
{
if (analog_clock_props[0].quark == 0) {
prop_desc_list_calculate_quarks(analog_clock_props);
}
return analog_clock_props;
-}
+}
static PropOffset analog_clock_offsets[] = {
ELEMENT_COMMON_PROPERTIES_OFFSETS,
@@ -170,13 +168,13 @@ static PropOffset analog_clock_offsets[] = {
offsetof(Analog_Clock, sec_arrow_line_width) },
{ "show_ticks", PROP_TYPE_BOOL,offsetof(Analog_Clock,show_ticks) },
-
+
{NULL}
};
static void
analog_clock_get_props(Analog_Clock *analog_clock, GPtrArray *props)
-{
+{
object_get_props_from_offsets(&analog_clock->element.object,
analog_clock_offsets,props);
}
@@ -205,14 +203,14 @@ analog_clock_select(Analog_Clock *analog_clock, Point *clicked_point,
static ObjectChange*
analog_clock_move_handle(Analog_Clock *analog_clock, Handle *handle,
- Point *to, ConnectionPoint *cp,
+ Point *to, ConnectionPoint *cp,
HandleMoveReason reason, ModifierKeys modifiers)
{
g_assert(analog_clock!=NULL);
g_assert(handle!=NULL);
g_assert(to!=NULL);
- element_move_handle(&analog_clock->element, handle->id, to, cp,
+ element_move_handle(&analog_clock->element, handle->id, to, cp,
reason, modifiers);
analog_clock_update_data(analog_clock);
@@ -240,7 +238,7 @@ static void make_hours(const Point *centre, unsigned hours, unsigned minutes, re
Point *pt)
{
while (hours > 11) hours -= 12;
-
+
make_angle(centre,((real)hours) * 360.0 / 12.0 + ((real)minutes) * 360.0 / 12.0 / 60.0 ,radius,pt);
}
@@ -253,7 +251,7 @@ static void make_minutes(const Point *centre, unsigned minutes,
static void
analog_clock_update_arrow_tips(Analog_Clock *analog_clock)
{
- time_t now;
+ time_t now;
struct tm *local;
now = time(NULL);
@@ -261,7 +259,7 @@ analog_clock_update_arrow_tips(Analog_Clock *analog_clock)
analog_clock->hour_tip.directions = DIR_ALL;
analog_clock->min_tip.directions = DIR_ALL;
analog_clock->sec_tip.directions = DIR_ALL;
- if (local) {
+ if (local) {
make_hours(&analog_clock->centre,local->tm_hour,local->tm_min,
0.50 * analog_clock->radius, &analog_clock->hour_tip.pos);
make_minutes(&analog_clock->centre,local->tm_min,
@@ -287,16 +285,16 @@ analog_clock_update_data(Analog_Clock *analog_clock)
extra->border_trans = analog_clock->border_line_width / 2;
element_update_boundingbox(elem);
-
+
obj->position = elem->corner;
-
+
element_update_handles(elem);
analog_clock->centre.x = obj->position.x + elem->width/2;
analog_clock->centre.y = obj->position.y + elem->height/2;
analog_clock->radius = MIN(elem->width/2,elem->height/2);
-
+
/* Update connections: */
for (i = 0; i < 12; ++i)
{
@@ -308,13 +306,13 @@ analog_clock_update_data(Analog_Clock *analog_clock)
analog_clock->center_cp.pos.y = elem->corner.y + elem->height/2;
analog_clock_update_arrow_tips(analog_clock);
-}
+}
static void
analog_clock_draw(Analog_Clock *analog_clock, DiaRenderer *renderer)
{
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
-
+
g_assert(analog_clock != NULL);
g_assert(renderer != NULL);
@@ -330,8 +328,8 @@ analog_clock_draw(Analog_Clock *analog_clock, DiaRenderer *renderer)
{
Point out, in;
unsigned i;
-
- for (i = 0; i < 12; ++i) {
+
+ for (i = 0; i < 12; ++i) {
real ticklen;
switch(i) {
case 0:
@@ -350,7 +348,7 @@ analog_clock_draw(Analog_Clock *analog_clock, DiaRenderer *renderer)
}
analog_clock_update_arrow_tips(analog_clock);
-
+
renderer_ops->set_linewidth(renderer, analog_clock->arrow_line_width);
renderer_ops->draw_line(renderer,
&analog_clock->hour_tip.pos, &analog_clock->centre,
@@ -358,7 +356,7 @@ analog_clock_draw(Analog_Clock *analog_clock, DiaRenderer *renderer)
renderer_ops->draw_line(renderer,
&analog_clock->min_tip.pos, &analog_clock->centre,
&analog_clock->arrow_color);
-
+
renderer_ops->set_linewidth(renderer, analog_clock->sec_arrow_line_width);
renderer_ops->draw_line(renderer,
&analog_clock->sec_tip.pos, &analog_clock->centre,
@@ -381,7 +379,7 @@ analog_clock_create(Point *startpoint,
Element *elem;
DiaObject *obj;
unsigned i;
-
+
analog_clock = g_new0(Analog_Clock,1);
elem = &(analog_clock->element);
@@ -430,7 +428,7 @@ analog_clock_create(Point *startpoint,
analog_clock->center_cp.object = obj;
analog_clock->center_cp.connected = NULL;
analog_clock->center_cp.flags = CP_FLAGS_MAIN;
-
+
analog_clock->hours[0].directions = DIR_NORTH;
analog_clock->hours[1].directions = DIR_NORTH|DIR_EAST;
analog_clock->hours[2].directions = DIR_NORTH|DIR_EAST;
@@ -446,9 +444,9 @@ analog_clock_create(Point *startpoint,
analog_clock->center_cp.directions = DIR_ALL;
analog_clock_update_data(analog_clock);
-
+
*handle1 = NULL;
- *handle2 = obj->handles[7];
+ *handle2 = obj->handles[7];
/* We are an animated object -- special case ! */
dynobj_list_add_object(&analog_clock->element.object,1000);
@@ -456,7 +454,7 @@ analog_clock_create(Point *startpoint,
return &analog_clock->element.object;
}
-static void
+static void
analog_clock_destroy(Analog_Clock *analog_clock)
{
/* We are an animated object -- special case ! */
@@ -468,5 +466,5 @@ static DiaObject *
analog_clock_load(ObjectNode obj_node, int version, DiaContext *ctx)
{
return object_load_using_properties(&analog_clock_type,
- obj_node,version,ctx);
+ obj_node,version,ctx);
}
diff --git a/objects/Misc/grid_object.c b/objects/Misc/grid_object.c
index c572d970..257dec6b 100644
--- a/objects/Misc/grid_object.c
+++ b/objects/Misc/grid_object.c
@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -50,7 +48,7 @@ typedef struct _Grid_Object {
gint cells_rows;
gint cells_cols;
ConnectionPoint *cells;
-
+
Color border_color;
real border_line_width;
Color inner_color;
@@ -68,8 +66,8 @@ static void grid_object_select(Grid_Object *grid_object,
Point *clicked_point,
DiaRenderer *interactive_renderer);
static ObjectChange* grid_object_move_handle(Grid_Object *grid_object,
- Handle *handle, Point *to,
- ConnectionPoint *cp, HandleMoveReason reason,
+ Handle *handle, Point *to,
+ ConnectionPoint *cp, HandleMoveReason reason,
ModifierKeys modifiers);
static ObjectChange* grid_object_move(Grid_Object *grid_object, Point *to);
static void grid_object_draw(Grid_Object *grid_object, DiaRenderer *renderer);
@@ -80,13 +78,13 @@ static DiaObject *grid_object_create(Point *startpoint,
Handle **handle2);
static void grid_object_reallocate_cells (Grid_Object* grid_object);
static void grid_object_destroy(Grid_Object *grid_object);
-static DiaObject *grid_object_load(ObjectNode obj_node, int version,
+static DiaObject *grid_object_load(ObjectNode obj_node, int version,
DiaContext *ctx);
static PropDescription *grid_object_describe_props(
Grid_Object *grid_object);
-static void grid_object_get_props(Grid_Object *grid_object,
+static void grid_object_get_props(Grid_Object *grid_object,
GPtrArray *props);
-static void grid_object_set_props(Grid_Object *grid_object,
+static void grid_object_set_props(Grid_Object *grid_object,
GPtrArray *props);
static ObjectTypeOps grid_object_type_ops =
@@ -141,18 +139,18 @@ static PropDescription grid_object_props[] = {
N_("Grid line color"), NULL, NULL },
{ "gridline_width", PROP_TYPE_REAL, PROP_FLAG_VISIBLE,
N_("Grid line width"), NULL, &prop_std_line_width_data },
-
+
{NULL}
};
static PropDescription *
-grid_object_describe_props(Grid_Object *grid_object)
+grid_object_describe_props(Grid_Object *grid_object)
{
if (grid_object_props[0].quark == 0) {
prop_desc_list_calculate_quarks(grid_object_props);
}
return grid_object_props;
-}
+}
static PropOffset grid_object_offsets[] = {
ELEMENT_COMMON_PROPERTIES_OFFSETS,
@@ -165,13 +163,13 @@ static PropOffset grid_object_offsets[] = {
{ "gridline_colour", PROP_TYPE_COLOUR, offsetof(Grid_Object, gridline_color) },
{ "gridline_width", PROP_TYPE_REAL, offsetof(Grid_Object,
gridline_width) },
-
+
{NULL}
};
static void
grid_object_get_props(Grid_Object *grid_object, GPtrArray *props)
-{
+{
object_get_props_from_offsets(&grid_object->element.object,
grid_object_offsets,props);
}
@@ -204,14 +202,14 @@ grid_object_select(Grid_Object *grid_object, Point *clicked_point,
static ObjectChange*
grid_object_move_handle(Grid_Object *grid_object, Handle *handle,
- Point *to, ConnectionPoint *cp,
+ Point *to, ConnectionPoint *cp,
HandleMoveReason reason, ModifierKeys modifiers)
{
g_assert(grid_object!=NULL);
g_assert(handle!=NULL);
g_assert(to!=NULL);
- element_move_handle(&grid_object->element, handle->id, to, cp,
+ element_move_handle(&grid_object->element, handle->id, to, cp,
reason, modifiers);
grid_object_update_data(grid_object);
@@ -263,9 +261,9 @@ grid_object_update_data(Grid_Object *grid_object)
grid_object->cells[cell].pos.y =
top + inset + j*cell_height + cell_height/2.0;
}
-}
+}
-static void
+static void
grid_object_draw_gridlines (Grid_Object *grid_object, DiaRenderer *renderer,
Point* lr_corner)
{
@@ -322,7 +320,7 @@ grid_object_draw(Grid_Object *grid_object, DiaRenderer *renderer)
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
Element *elem;
Point lr_corner;
-
+
g_assert(grid_object != NULL);
g_assert(renderer != NULL);
@@ -337,7 +335,7 @@ grid_object_draw(Grid_Object *grid_object, DiaRenderer *renderer)
/* draw gridlines */
renderer_ops->set_linewidth(renderer, grid_object->gridline_width);
grid_object_draw_gridlines(grid_object, renderer, &lr_corner);
-
+
/* draw outline */
renderer_ops->set_linewidth(renderer, grid_object->border_line_width);
renderer_ops->draw_rect(renderer,&elem->corner,
@@ -397,9 +395,9 @@ grid_object_create(Point *startpoint,
grid_object_reallocate_cells(grid_object);
grid_object_update_data(grid_object);
-
+
*handle1 = NULL;
- *handle2 = obj->handles[7];
+ *handle2 = obj->handles[7];
return &grid_object->element.object;
}
@@ -502,7 +500,7 @@ grid_object_reallocate_cells (Grid_Object* grid_object)
grid_object->cells_cols = new_cols;
}
-static void
+static void
grid_object_destroy(Grid_Object *grid_object)
{
element_destroy(&grid_object->element);
@@ -513,5 +511,5 @@ static DiaObject *
grid_object_load(ObjectNode obj_node, int version, DiaContext *ctx)
{
return object_load_using_properties(&grid_object_type,
- obj_node,version,ctx);
+ obj_node,version,ctx);
}
diff --git a/objects/Misc/libmisc.c b/objects/Misc/libmisc.c
index 09049f07..6c61ec90 100644
--- a/objects/Misc/libmisc.c
+++ b/objects/Misc/libmisc.c
@@ -1,6 +1,6 @@
/* Dia -- an diagram creation/manipulation program
* Copyright (C) 1998 Alexander Larsson
- *
+ *
* Miscellaneous objects
* Copyright (C) 2002 Cyrille Chépélov
*
@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include "object.h"
@@ -44,8 +42,8 @@ dia_plugin_init(PluginInfo *info)
NULL, NULL))
return DIA_PLUGIN_INIT_ERROR;
- object_register_type(&analog_clock_type);
- object_register_type(&grid_object_type);
+ object_register_type(&analog_clock_type);
+ object_register_type(&grid_object_type);
object_register_type(&tree_type);
object_register_type(&measure_type);
object_register_type(&diagram_as_element_type);
diff --git a/objects/Misc/tree.c b/objects/Misc/tree.c
index 3fcd258e..298088b5 100644
--- a/objects/Misc/tree.c
+++ b/objects/Misc/tree.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -60,7 +58,7 @@ struct PointChange {
enum change_type type;
int applied;
-
+
Point point;
Handle *handle; /* owning ref when not applied for ADD_POINT
owning ref when applied for REMOVE_POINT */
@@ -172,7 +170,7 @@ tree_distance_from(Tree *tree, Point *point)
Point *endpoints;
real min_dist;
int i;
-
+
endpoints = &tree->real_ends[0];
min_dist = distance_line_point( &endpoints[0], &endpoints[1],
LINE_WIDTH, point);
@@ -223,7 +221,7 @@ tree_move_handle(Tree *tree, Handle *handle,
}
vlen = sqrt(point_dot(&vhat, &vhat));
point_scale(&vhat, 1.0/vlen);
-
+
vhatperp.y = -vhat.x;
vhatperp.x = vhat.y;
for (i=0;i<num_handles;i++) {
@@ -232,8 +230,8 @@ tree_move_handle(Tree *tree, Handle *handle,
parallel[i] = point_dot(&vhat, &u);
perp[i] = point_dot(&vhatperp, &u);
}
-
- connection_move_handle(&tree->connection, handle->id, to, cp,
+
+ connection_move_handle(&tree->connection, handle->id, to, cp,
reason, modifiers);
vhat = endpoints[1];
@@ -269,10 +267,10 @@ static ObjectChange*
tree_move(Tree *tree, Point *to)
{
Point delta;
- Point *endpoints = &tree->connection.endpoints[0];
+ Point *endpoints = &tree->connection.endpoints[0];
DiaObject *obj = &tree->connection.object;
int i;
-
+
delta = *to;
point_sub(&delta, &obj->position);
@@ -298,12 +296,12 @@ tree_draw(Tree *tree, DiaRenderer *renderer)
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
Point *endpoints;
int i;
-
+
assert(tree != NULL);
assert(renderer != NULL);
endpoints = &tree->real_ends[0];
-
+
renderer_ops->set_linewidth(renderer, LINE_WIDTH);
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID, 0.0);
renderer_ops->set_linecaps(renderer, LINECAPS_BUTT);
@@ -339,7 +337,7 @@ tree_create(Point *startpoint,
conn->endpoints[0] = *startpoint;
conn->endpoints[1] = *startpoint;
point_add(&conn->endpoints[1], &defaultlen);
-
+
obj = &conn->object;
extra = &conn->extra_spacing;
@@ -364,10 +362,10 @@ tree_create(Point *startpoint,
obj->handles[2+i] = tree->handles[i];
}
- extra->start_trans =
- extra->end_trans =
+ extra->start_trans =
+ extra->end_trans =
extra->start_long =
- extra->end_long = LINE_WIDTH/2.0;
+ extra->end_long = LINE_WIDTH/2.0;
tree_update_data(tree);
*handle1 = obj->handles[0];
@@ -393,13 +391,13 @@ tree_copy(Tree *tree)
Connection *conn, *newconn;
DiaObject *newobj;
int i;
-
+
conn = &tree->connection;
-
+
newtree = g_malloc0(sizeof(Tree));
newconn = &newtree->connection;
newobj = &newconn->object;
-
+
connection_copy(conn, newconn);
newtree->num_handles = tree->num_handles;
@@ -407,7 +405,7 @@ tree_copy(Tree *tree)
newtree->handles = g_malloc(sizeof(Handle *)*newtree->num_handles);
newtree->parallel_points = g_malloc(sizeof(Point)*newtree->num_handles);
-
+
for (i=0;i<newtree->num_handles;i++) {
newtree->handles[i] = g_new0(Handle,1);
*newtree->handles[i] = *tree->handles[i];
@@ -437,13 +435,13 @@ tree_update_data(Tree *tree)
/*
* This seems to break stuff wildly.
*/
-/*
+/*
if (connpoint_is_autogap(conn->endpoint_handles[0].connected_to) ||
connpoint_is_autogap(conn->endpoint_handles[1].connected_to)) {
connection_adjust_for_autogap(conn);
}
*/
- endpoints = &conn->endpoints[0];
+ endpoints = &conn->endpoints[0];
obj->position = endpoints[0];
v = endpoints[1];
@@ -465,7 +463,7 @@ tree_update_data(Tree *tree)
point_scale(&tree->parallel_points[i], ulen);
point_add(&tree->parallel_points[i], &endpoints[0]);
}
-
+
min_par -= LINE_WIDTH/2.0;
max_par += LINE_WIDTH/2.0;
@@ -490,7 +488,7 @@ static void
tree_add_handle(Tree *tree, Point *p, Handle *handle)
{
int i;
-
+
tree->num_handles++;
/* Allocate more handles */
@@ -500,7 +498,7 @@ tree_add_handle(Tree *tree, Point *p, Handle *handle)
sizeof(Point)*tree->num_handles);
i = tree->num_handles - 1;
-
+
tree->handles[i] = handle;
tree->handles[i]->id = HANDLE_BUS;
tree->handles[i]->type = HANDLE_MINOR_CONTROL;
@@ -514,7 +512,7 @@ static void
tree_remove_handle(Tree *tree, Handle *handle)
{
int i, j;
-
+
for (i=0;i<tree->num_handles;i++) {
if (tree->handles[i] == handle) {
object_remove_handle(&tree->connection.object, handle);
@@ -586,7 +584,7 @@ tree_delete_handle_callback (DiaObject *obj, Point *clicked, gpointer data)
handle = tree->handles[handle_num];
p = handle->pos;
connectionpoint = handle->connected_to;
-
+
object_unconnect(obj, handle);
tree_remove_handle(tree, handle );
tree_update_data(tree);
@@ -623,11 +621,11 @@ tree_save(Tree *tree, ObjectNode obj_node, DiaContext *ctx)
AttributeNode attr;
connection_save(&tree->connection, obj_node, ctx);
-
+
data_add_color( new_attribute(obj_node, "line_color"), &tree->line_color, ctx);
attr = new_attribute(obj_node, "tree_handles");
-
+
for (i=0;i<tree->num_handles;i++) {
data_add_point(attr, &tree->handles[i]->pos, ctx);
}
@@ -662,7 +660,7 @@ tree_load(ObjectNode obj_node, int version,DiaContext *ctx)
tree->num_handles = attribute_num_data(attr);
connection_init(conn, 2 + tree->num_handles, 0);
-
+
data = attribute_first_data(attr);
tree->handles = g_malloc(sizeof(Handle *)*tree->num_handles);
tree->parallel_points = g_malloc(sizeof(Point)*tree->num_handles);
@@ -683,10 +681,10 @@ tree_load(ObjectNode obj_node, int version,DiaContext *ctx)
if (attr != NULL)
data_color(attribute_first_data(attr), &tree->line_color, ctx);
- extra->start_trans =
- extra->end_trans =
+ extra->start_trans =
+ extra->end_trans =
extra->start_long =
- extra->end_long = LINE_WIDTH/2.0;
+ extra->end_long = LINE_WIDTH/2.0;
tree_update_data(tree);
return &tree->connection.object;
diff --git a/objects/SADT/annotation.c b/objects/SADT/annotation.c
index 1464b08a..c9265f47 100644
--- a/objects/SADT/annotation.c
+++ b/objects/SADT/annotation.c
@@ -1,9 +1,9 @@
/* Dia -- an diagram creation/manipulation program
* Copyright (C) 1998 Alexander Larsson
*
- * SADT diagram support
+ * SADT diagram support
* Copyright (C) 2000 Cyrille Chepelov
- *
+ *
* This file has been forked from Alexander Larsson's objects/UML/constraint.c
*
* This program is free software; you can redistribute it and/or modify
@@ -21,9 +21,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -51,7 +49,7 @@ typedef struct _Annotation {
Color line_color;
} Annotation;
-
+
#define ANNOTATION_LINE_WIDTH 0.05
#define ANNOTATION_BORDER 0.2
#define ANNOTATION_FONTHEIGHT 0.8
@@ -75,9 +73,9 @@ static void annotation_update_data(Annotation *annotation);
static void annotation_destroy(Annotation *annotation);
static DiaObject *annotation_load(ObjectNode obj_node, int version,DiaContext *ctx);
static PropDescription *annotation_describe_props(Annotation *annotation);
-static void annotation_get_props(Annotation *annotation,
+static void annotation_get_props(Annotation *annotation,
GPtrArray *props);
-static void annotation_set_props(Annotation *annotation,
+static void annotation_set_props(Annotation *annotation,
GPtrArray *props);
static ObjectTypeOps annotation_type_ops =
@@ -118,7 +116,7 @@ static ObjectOps annotation_ops = {
#undef TEMPORARY_EVENT_TEST
#ifdef TEMPORARY_EVENT_TEST
-static gboolean
+static gboolean
handle_btn1(Annotation *annotation, Property *prop) {
Color col;
col = annotation->text->color;
@@ -138,8 +136,8 @@ handle_btn1(Annotation *annotation, Property *prop) {
static PropDescription annotation_props[] = {
CONNECTION_COMMON_PROPERTIES,
#ifdef TEMPORARY_EVENT_TEST
- {"btn1", PROP_TYPE_BUTTON, PROP_FLAG_VISIBLE|PROP_FLAG_DONT_SAVE,
- NULL, "Click Me !", NULL,
+ {"btn1", PROP_TYPE_BUTTON, PROP_FLAG_VISIBLE|PROP_FLAG_DONT_SAVE,
+ NULL, "Click Me !", NULL,
(PropEventHandler)handle_btn1},
#endif
{ "text", PROP_TYPE_TEXT, 0,NULL,NULL},
@@ -153,13 +151,13 @@ static PropDescription annotation_props[] = {
};
static PropDescription *
-annotation_describe_props(Annotation *annotation)
+annotation_describe_props(Annotation *annotation)
{
if (annotation_props[0].quark == 0) {
prop_desc_list_calculate_quarks(annotation_props);
}
return annotation_props;
-}
+}
static PropOffset annotation_offsets[] = {
CONNECTION_COMMON_PROPERTIES_OFFSETS,
@@ -194,9 +192,9 @@ annotation_distance_from(Annotation *annotation, Point *point)
Point *endpoints;
Rectangle bbox;
endpoints = &annotation->connection.endpoints[0];
-
+
text_calc_boundingbox(annotation->text,&bbox);
- return MIN(distance_line_point(&endpoints[0], &endpoints[1],
+ return MIN(distance_line_point(&endpoints[0], &endpoints[1],
ANNOTATION_LINE_WIDTH, point),
distance_rectangle_point(&bbox,point));
}
@@ -207,7 +205,7 @@ annotation_select(Annotation *annotation, Point *clicked_point,
{
text_set_cursor(annotation->text, clicked_point, interactive_renderer);
text_grab_focus(annotation->text, &annotation->connection.object);
-
+
connection_update_handles(&annotation->connection);
}
@@ -227,7 +225,7 @@ annotation_move_handle(Annotation *annotation, Handle *handle,
if (handle->id == HANDLE_MOVE_TEXT) {
annotation->text->position = *to;
} else {
- endpoints = &(conn->endpoints[0]);
+ endpoints = &(conn->endpoints[0]);
if (handle->id == HANDLE_MOVE_STARTPOINT) {
p1 = endpoints[0];
connection_move_handle(conn, handle->id, to, cp, reason, modifiers);
@@ -237,7 +235,7 @@ annotation_move_handle(Annotation *annotation, Handle *handle,
point_add(&annotation->text->position, &p2);
point_add(&p2,&(endpoints[1]));
connection_move_handle(conn, HANDLE_MOVE_ENDPOINT, &p2, NULL, reason, 0);
- } else {
+ } else {
p1 = endpoints[1];
connection_move_handle(conn, handle->id, to, cp, reason, modifiers);
connection_adjust_for_autogap(conn);
@@ -255,12 +253,12 @@ static ObjectChange*
annotation_move(Annotation *annotation, Point *to)
{
Point start_to_end;
- Point *endpoints = &annotation->connection.endpoints[0];
+ Point *endpoints = &annotation->connection.endpoints[0];
Point delta;
delta = *to;
point_sub(&delta, &endpoints[0]);
-
+
start_to_end = endpoints[1];
point_sub(&start_to_end, &endpoints[0]);
@@ -268,7 +266,7 @@ annotation_move(Annotation *annotation, Point *to)
point_add(&endpoints[1], &start_to_end);
point_add(&annotation->text->position, &delta);
-
+
annotation_update_data(annotation);
return NULL;
@@ -298,7 +296,7 @@ annotation_draw(Annotation *annotation, DiaRenderer *renderer)
point_scale(&vect,1/vlen);
rvect.y = vect.x;
rvect.x = -vect.y;
-
+
pts[0] = annotation->connection.endpoints[0];
pts[1] = annotation->connection.endpoints[0];
v1 = vect;
@@ -330,7 +328,7 @@ annotation_create(Point *startpoint,
Annotation *annotation;
Connection *conn;
LineBBExtras *extra;
- DiaObject *obj;
+ DiaObject *obj;
Point offs;
Point defaultlen = { 1.0, 1.0 };
DiaFont* font;
@@ -341,13 +339,13 @@ annotation_create(Point *startpoint,
conn->endpoints[0] = *startpoint;
conn->endpoints[1] = *startpoint;
point_add(&conn->endpoints[1], &defaultlen);
-
+
obj = &conn->object;
extra = &conn->extra_spacing;
obj->type = &sadtannotation_type;
obj->ops = &annotation_ops;
-
+
connection_init(conn, 3, 0);
annotation->line_color = color_black;
@@ -366,16 +364,16 @@ annotation_create(Point *startpoint,
else
offs.y = -.3 * ANNOTATION_FONTHEIGHT;
point_add(&annotation->text->position,&offs);
-
+
annotation->text_handle.id = HANDLE_MOVE_TEXT;
annotation->text_handle.type = HANDLE_MINOR_CONTROL;
annotation->text_handle.connect_type = HANDLE_NONCONNECTABLE;
annotation->text_handle.connected_to = NULL;
obj->handles[2] = &annotation->text_handle;
- extra->start_trans =
+ extra->start_trans =
extra->end_trans = ANNOTATION_ZLEN;
- extra->start_long =
+ extra->start_long =
extra->end_long = ANNOTATION_LINE_WIDTH/2.0;
annotation_update_data(annotation);
@@ -399,7 +397,7 @@ annotation_update_data(Annotation *annotation)
Connection *conn = &annotation->connection;
DiaObject *obj = &conn->object;
Rectangle textrect;
-
+
if (connpoint_is_autogap(conn->endpoint_handles[0].connected_to) ||
connpoint_is_autogap(conn->endpoint_handles[1].connected_to)) {
connection_adjust_for_autogap(conn);
diff --git a/objects/SADT/arrow.c b/objects/SADT/arrow.c
index f59d3de0..4f2d096e 100644
--- a/objects/SADT/arrow.c
+++ b/objects/SADT/arrow.c
@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -64,7 +62,7 @@ typedef struct _Sadtarrow {
Sadtarrow_style style;
gboolean autogray;
-
+
Color line_color;
} Sadtarrow;
@@ -88,9 +86,9 @@ static DiaMenu *sadtarrow_get_object_menu(Sadtarrow *sadtarrow,
static DiaObject *sadtarrow_load(ObjectNode obj_node, int version,
DiaContext *ctx);
static PropDescription *sadtarrow_describe_props(Sadtarrow *sadtarrow);
-static void sadtarrow_get_props(Sadtarrow *sadtarrow,
+static void sadtarrow_get_props(Sadtarrow *sadtarrow,
GPtrArray *props);
-static void sadtarrow_set_props(Sadtarrow *sadtarrow,
+static void sadtarrow_set_props(Sadtarrow *sadtarrow,
GPtrArray *props);
@@ -153,13 +151,13 @@ static PropDescription sadtarrow_props[] = {
};
static PropDescription *
-sadtarrow_describe_props(Sadtarrow *sadtarrow)
+sadtarrow_describe_props(Sadtarrow *sadtarrow)
{
if (sadtarrow_props[0].quark == 0) {
prop_desc_list_calculate_quarks(sadtarrow_props);
}
return sadtarrow_props;
-}
+}
static PropOffset sadtarrow_offsets[] = {
ORTHCONN_COMMON_PROPERTIES_OFFSETS,
@@ -171,7 +169,7 @@ static PropOffset sadtarrow_offsets[] = {
static void
sadtarrow_get_props(Sadtarrow *sadtarrow, GPtrArray *props)
-{
+{
object_get_props_from_offsets(&sadtarrow->orth.object,
sadtarrow_offsets,props);
}
@@ -209,7 +207,7 @@ sadtarrow_move_handle(Sadtarrow *sadtarrow, Handle *handle,
assert(handle!=NULL);
assert(to!=NULL);
- change = orthconn_move_handle(&sadtarrow->orth, handle, to, cp,
+ change = orthconn_move_handle(&sadtarrow->orth, handle, to, cp,
reason, modifiers);
sadtarrow_update_data(sadtarrow);
@@ -248,14 +246,14 @@ sadtarrow_draw(Sadtarrow *sadtarrow, DiaRenderer *renderer)
points = &orth->points[0];
n = orth->numpoints;
-
+
renderer_ops->set_linewidth(renderer, ARROW_LINE_WIDTH);
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID, 0);
renderer_ops->set_linecaps(renderer, LINECAPS_BUTT);
-
+
col = sadtarrow->line_color;
- if (sadtarrow->autogray &&
- (orth->orientation[0] == VERTICAL) &&
+ if (sadtarrow->autogray &&
+ (orth->orientation[0] == VERTICAL) &&
(orth->orientation[orth->numpoints-2] == VERTICAL)) {
col.red = GBASE + (GMULT*col.red);
col.green = GBASE + (GMULT*col.green);
@@ -312,7 +310,7 @@ static void draw_dot(DiaRenderer *renderer,
vt = vv;
point_scale(&vt,-ARROW_DOT_LOFFSET);
point_add(&pt,&vt);
-
+
renderer_ops->set_fillstyle(renderer,FILLSTYLE_SOLID);
renderer_ops->draw_ellipse(renderer,&pt,
ARROW_DOT_RADIUS,ARROW_DOT_RADIUS,
@@ -340,7 +338,7 @@ static void draw_tunnel(DiaRenderer *renderer,
curve1[0].p1 = curve2[0].p1 = *end;
vt1 = vv;
point_scale(&vt1,-ARROW_PARENS_LOFFSET - (.5*ARROW_PARENS_LENGTH));
- point_add(&curve1[0].p1,&vt1); point_add(&curve2[0].p1,&vt1);
+ point_add(&curve1[0].p1,&vt1); point_add(&curve2[0].p1,&vt1);
/* gcc, work for me, please. */
vt2 = vp;
point_scale(&vt2,ARROW_PARENS_WOFFSET);
@@ -352,13 +350,13 @@ static void draw_tunnel(DiaRenderer *renderer,
point_scale(&vt2,ARROW_PARENS_LENGTH / 6.0);
curve1[1].type = curve2[1].type = BEZ_CURVE_TO;
curve1[1].p1 = curve1[0].p1; curve2[1].p1 = curve2[0].p1;
- point_add(&curve1[1].p1,&vt1); point_add(&curve2[1].p1,&vt1);
- point_add(&curve1[1].p1,&vt2); point_sub(&curve2[1].p1,&vt2);
+ point_add(&curve1[1].p1,&vt1); point_add(&curve2[1].p1,&vt1);
+ point_add(&curve1[1].p1,&vt2); point_sub(&curve2[1].p1,&vt2);
curve1[1].p2 = curve1[1].p1; curve2[1].p2 = curve2[1].p1;
- point_add(&curve1[1].p2,&vt1); point_add(&curve2[1].p2,&vt1);
+ point_add(&curve1[1].p2,&vt1); point_add(&curve2[1].p2,&vt1);
curve1[1].p3 = curve1[1].p2; curve2[1].p3 = curve2[1].p2;
- point_add(&curve1[1].p3,&vt1); point_add(&curve2[1].p3,&vt1);
- point_sub(&curve1[1].p3,&vt2); point_add(&curve2[1].p3,&vt2);
+ point_add(&curve1[1].p3,&vt1); point_add(&curve2[1].p3,&vt1);
+ point_sub(&curve1[1].p3,&vt2); point_add(&curve2[1].p3,&vt2);
renderer_ops->draw_bezier(renderer,curve1,2,col);
renderer_ops->draw_bezier(renderer,curve2,2,col);
@@ -381,7 +379,7 @@ sadtarrow_create(Point *startpoint,
obj->type = &sadtarrow_type;
obj->ops = &sadtarrow_ops;
-
+
orthconn_init(orth, startpoint);
sadtarrow_update_data(sadtarrow);
@@ -409,14 +407,14 @@ sadtarrow_update_data(Sadtarrow *sadtarrow)
orthconn_update_data(&sadtarrow->orth);
- extra->start_long =
+ extra->start_long =
extra->middle_trans = ARROW_LINE_WIDTH / 2.0;
-
+
extra->end_long = MAX(ARROW_HEAD_LENGTH,ARROW_LINE_WIDTH/2.0);
-
+
extra->start_trans = ARROW_LINE_WIDTH / 2.0;
extra->end_trans = MAX(ARROW_LINE_WIDTH/2.0,ARROW_HEAD_WIDTH/2.0);
-
+
switch(sadtarrow->style) {
case SADT_ARROW_IMPORTED:
extra->start_trans = MAX(ARROW_LINE_WIDTH/2.0,
@@ -429,12 +427,12 @@ sadtarrow_update_data(Sadtarrow *sadtarrow)
break;
case SADT_ARROW_DOTTED:
extra->start_long = extra->end_long;
- extra->end_trans =
+ extra->end_trans =
extra->start_trans = MAX(MAX(MAX(ARROW_HEAD_WIDTH,ARROW_HEAD_LENGTH),
ARROW_LINE_WIDTH/2.0),
ARROW_DOT_WOFFSET+ARROW_DOT_RADIUS);
break;
- default:
+ default:
break;
}
orthconn_update_boundingbox(orth);
diff --git a/objects/SADT/box.c b/objects/SADT/box.c
index 1981db41..14bb2b64 100644
--- a/objects/SADT/box.c
+++ b/objects/SADT/box.c
@@ -3,7 +3,7 @@
*
* SADT Activity/Data box -- objects for drawing SADT diagrams.
* Copyright (C) 2000, 2001 Cyrille Chepelov
- *
+ *
* Forked from Flowchart toolbox -- objects for drawing flowcharts.
* Copyright (C) 1999 James Henstridge.
*
@@ -22,9 +22,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -74,7 +72,7 @@ static void sadtbox_select(Box *box, Point *clicked_point,
DiaRenderer *interactive_renderer);
static ObjectChange* sadtbox_move_handle(Box *box, Handle *handle,
Point *to, ConnectionPoint *cp,
- HandleMoveReason reason,
+ HandleMoveReason reason,
ModifierKeys modifiers);
static ObjectChange* sadtbox_move(Box *box, Point *to);
static void sadtbox_draw(Box *box, DiaRenderer *renderer);
@@ -84,7 +82,7 @@ static DiaObject *sadtbox_create(Point *startpoint,
Handle **handle1,
Handle **handle2);
static void sadtbox_destroy(Box *box);
-static DiaObject *sadtbox_load(ObjectNode obj_node, int version,
+static DiaObject *sadtbox_load(ObjectNode obj_node, int version,
DiaContext *ctx);
static DiaMenu *sadtbox_get_object_menu(Box *box, Point *clickedpoint);
@@ -151,13 +149,13 @@ static PropDescription box_props[] = {
};
static PropDescription *
-sadtbox_describe_props(Box *box)
+sadtbox_describe_props(Box *box)
{
if (box_props[0].quark == 0) {
prop_desc_list_calculate_quarks(box_props);
}
return box_props;
-}
+}
static PropOffset box_offsets[] = {
ELEMENT_COMMON_PROPERTIES_OFFSETS,
@@ -256,7 +254,7 @@ static ObjectChange*
sadtbox_move(Box *box, Point *to)
{
box->element.corner = *to;
-
+
sadtbox_update_data(box, ANCHOR_MIDDLE, ANCHOR_MIDDLE);
return NULL;
@@ -283,9 +281,9 @@ sadtbox_draw(Box *box, DiaRenderer *renderer)
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID, 0.0);
renderer_ops->set_linejoin(renderer, LINEJOIN_MITER);
- renderer_ops->draw_rect(renderer,
+ renderer_ops->draw_rect(renderer,
&elem->corner,
- &lr_corner,
+ &lr_corner,
&box->fill_color,
&box->line_color);
@@ -354,9 +352,9 @@ sadtbox_update_data(Box *box, AnchorShape horiz, AnchorShape vert)
extra->border_trans = SADTBOX_LINE_WIDTH / 2.0;
element_update_boundingbox(elem);
-
+
obj->position = elem->corner;
-
+
element_update_handles(elem);
/* Update connections: */
@@ -368,7 +366,7 @@ sadtbox_update_data(Box *box, AnchorShape horiz, AnchorShape vert)
ne.y = nw.y;
sw.y = se.y;
sw.x = nw.x;
-
+
connpointline_update(box->north);
connpointline_putonaline(box->north,&ne,&nw,DIR_NORTH);
connpointline_update(box->west);
@@ -413,7 +411,7 @@ sadtbox_create_change(Box *box, ObjectChange *inner, ConnPointLine *cpl) {
}
static ObjectChange *
-sadtbox_add_connpoint_callback(DiaObject *obj, Point *clicked, gpointer data)
+sadtbox_add_connpoint_callback(DiaObject *obj, Point *clicked, gpointer data)
{
ObjectChange *change;
ConnPointLine *cpl;
@@ -426,7 +424,7 @@ sadtbox_add_connpoint_callback(DiaObject *obj, Point *clicked, gpointer data)
}
static ObjectChange *
-sadtbox_remove_connpoint_callback(DiaObject *obj, Point *clicked, gpointer data)
+sadtbox_remove_connpoint_callback(DiaObject *obj, Point *clicked, gpointer data)
{
ObjectChange *change;
ConnPointLine *cpl;
@@ -440,7 +438,7 @@ sadtbox_remove_connpoint_callback(DiaObject *obj, Point *clicked, gpointer data)
static DiaMenuItem object_menu_items[] = {
{ N_("Add connection point"), sadtbox_add_connpoint_callback, NULL, 1 },
- { N_("Delete connection point"), sadtbox_remove_connpoint_callback,
+ { N_("Delete connection point"), sadtbox_remove_connpoint_callback,
NULL, 1 },
};
@@ -475,11 +473,11 @@ sadtbox_create(Point *startpoint,
DiaObject *obj;
Point p;
DiaFont* font;
-
+
box = g_malloc0(sizeof(Box));
elem = &box->element;
obj = &elem->object;
-
+
obj->type = &sadtbox_type;
obj->ops = &sadtbox_ops;
@@ -489,37 +487,37 @@ sadtbox_create(Point *startpoint,
elem->height = DEFAULT_HEIGHT;
box->padding = 0.5; /* default_values.padding; */
-
+
box->line_color = color_black;
box->fill_color = color_white;
-
+
p = *startpoint;
p.x += elem->width / 2.0;
p.y += elem->height / 2.0 + /*default_properties.font_size*/ 0.8 / 2;
font = dia_font_new_from_style( DIA_FONT_SANS|DIA_FONT_BOLD ,0.8);
-
+
box->text = new_text("", font,
- 0.8, &p,
+ 0.8, &p,
&color_black,
ALIGN_CENTER);
dia_font_unref(font);
-
- box->id = g_strdup("A0"); /* should be made better.
+
+ box->id = g_strdup("A0"); /* should be made better.
Automatic counting ? */
element_init(elem, 8, 0);
box->north = connpointline_create(obj,4);
- box->west = connpointline_create(obj,3);
- box->south = connpointline_create(obj,1);
+ box->west = connpointline_create(obj,3);
+ box->south = connpointline_create(obj,1);
box->east = connpointline_create(obj,3);
box->element.extra_spacing.border_trans = SADTBOX_LINE_WIDTH/2.0;
sadtbox_update_data(box, ANCHOR_MIDDLE, ANCHOR_MIDDLE);
*handle1 = NULL;
- *handle2 = obj->handles[7];
+ *handle2 = obj->handles[7];
return &box->element.object;
}
@@ -527,12 +525,12 @@ static void
sadtbox_destroy(Box *box)
{
text_destroy(box->text);
-
+
connpointline_destroy(box->east);
connpointline_destroy(box->south);
connpointline_destroy(box->west);
connpointline_destroy(box->north);
-
+
g_free(box->id);
element_destroy(&box->element);
diff --git a/objects/SADT/sadt.c b/objects/SADT/sadt.c
index b87e9113..3868e670 100644
--- a/objects/SADT/sadt.c
+++ b/objects/SADT/sadt.c
@@ -1,6 +1,6 @@
/* Dia -- an diagram creation/manipulation program
* Copyright (C) 1998 Alexander Larsson
- *
+ *
* SADT diagrams support
* Copyright (C) 2000 Cyrille Chepelov
*
@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include "object.h"
diff --git a/objects/UML/activity.c b/objects/UML/activity.c
index 79301873..632e99e1 100644
--- a/objects/UML/activity.c
+++ b/objects/UML/activity.c
@@ -3,7 +3,7 @@
*
* Activity type for UML diagrams
* Copyright (C) 2002 Alejandro Sierra <asierra servidor unam mx>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -94,7 +92,7 @@ DiaObjectType activity_type =
"UML - Activity", /* name */
0, /* version */
activity_xpm, /* pixmap */
-
+
&activity_type_ops /* ops */
};
@@ -121,13 +119,13 @@ static ObjectOps state_ops = {
static PropDescription activity_props[] = {
ELEMENT_COMMON_PROPERTIES,
- PROP_STD_LINE_COLOUR_OPTIONAL,
- PROP_STD_FILL_COLOUR_OPTIONAL,
+ PROP_STD_LINE_COLOUR_OPTIONAL,
+ PROP_STD_FILL_COLOUR_OPTIONAL,
PROP_STD_TEXT_FONT,
PROP_STD_TEXT_HEIGHT,
PROP_STD_TEXT_COLOUR_OPTIONAL,
- { "text", PROP_TYPE_TEXT, 0, N_("Text"), NULL, NULL },
-
+ { "text", PROP_TYPE_TEXT, 0, N_("Text"), NULL, NULL },
+
PROP_DESC_END
};
@@ -222,7 +220,7 @@ state_draw(State *state, DiaRenderer *renderer)
y = elem->corner.y;
w = elem->width;
h = elem->height;
-
+
renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID);
renderer_ops->set_linewidth(renderer, STATE_LINEWIDTH);
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID, 0.0);
@@ -246,7 +244,7 @@ state_update_data(State *state)
ElementBBExtras *extra = &elem->extra_spacing;
DiaObject *obj = &elem->object;
Point p;
-
+
text_calc_boundingbox(state->text, NULL);
w = state->text->max_width + 2*STATE_MARGIN_X;
h = state->text->height*state->text->numlines +2*STATE_MARGIN_Y;
@@ -262,7 +260,7 @@ state_update_data(State *state)
/* Update connections: */
element_update_connections_rectangle (elem, state->connections);
-
+
element_update_boundingbox(elem);
obj->position = elem->corner;
@@ -283,11 +281,11 @@ state_create_activity(Point *startpoint,
Point p;
DiaFont *font;
int i;
-
+
state = g_malloc0(sizeof(State));
elem = &state->element;
obj = &elem->object;
-
+
obj->type = &activity_type;
obj->ops = &state_ops;
elem->corner = *startpoint;
@@ -301,11 +299,11 @@ state_create_activity(Point *startpoint,
p = *startpoint;
p.x += STATE_WIDTH/2.0;
p.y += STATE_HEIGHT/2.0;
-
+
state->text = new_text("", font, 0.8, &p, &color_black, ALIGN_CENTER);
dia_font_unref(font);
element_init(elem, 8, NUM_CONNECTIONS);
-
+
for (i=0;i<NUM_CONNECTIONS;i++) {
obj->connections[i] = &state->connections[i];
state->connections[i].object = obj;
diff --git a/objects/UML/actor.c b/objects/UML/actor.c
index a65d7c15..39d8e2ca 100644
--- a/objects/UML/actor.c
+++ b/objects/UML/actor.c
@@ -15,9 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -82,7 +80,7 @@ static ObjectTypeOps actor_type_ops =
(CreateFunc) actor_create,
(LoadFunc) actor_load,/*using_properties*/ /* load */
(SaveFunc) object_save_using_properties, /* save */
- (GetDefaultsFunc) NULL,
+ (GetDefaultsFunc) NULL,
(ApplyDefaultsFunc) NULL
};
@@ -119,8 +117,8 @@ static PropDescription actor_props[] = {
PROP_STD_TEXT_COLOUR_OPTIONAL,
{ "text", PROP_TYPE_TEXT, 0, N_("Text"), NULL, NULL },
PROP_STD_LINE_WIDTH_OPTIONAL,
- PROP_STD_LINE_COLOUR_OPTIONAL,
- PROP_STD_FILL_COLOUR_OPTIONAL,
+ PROP_STD_LINE_COLOUR_OPTIONAL,
+ PROP_STD_FILL_COLOUR_OPTIONAL,
PROP_DESC_END
};
@@ -182,7 +180,7 @@ actor_move_handle(Actor *actor, Handle *handle,
HandleMoveReason reason, ModifierKeys modifiers)
{
ObjectChange* oc;
-
+
assert(actor!=NULL);
assert(handle!=NULL);
assert(to!=NULL);
@@ -198,7 +196,7 @@ static ObjectChange*
actor_move(Actor *actor, Point *to)
{
Element *elem = &actor->element;
-
+
elem->corner = *to;
elem->corner.x -= elem->width/2.0;
elem->corner.y -= elem->height / 2.0;
@@ -214,7 +212,7 @@ actor_draw(Actor *actor, DiaRenderer *renderer)
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
Element *elem;
real x, y, w;
- real r, r1;
+ real r, r1;
Point ch, cb, p1, p2;
real actor_height;
@@ -227,7 +225,7 @@ actor_draw(Actor *actor, DiaRenderer *renderer)
y = elem->corner.y;
w = elem->width;
actor_height = elem->height - actor->text->height;
-
+
renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID);
renderer_ops->set_linewidth(renderer, actor->line_width);
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID, 0.0);
@@ -238,9 +236,9 @@ actor_draw(Actor *actor, DiaRenderer *renderer)
ch.y = y + r + ACTOR_MARGIN_Y;
cb.x = ch.x;
cb.y = ch.y + r1 + r;
-
+
/* head */
- renderer_ops->draw_ellipse(renderer,
+ renderer_ops->draw_ellipse(renderer,
&ch,
r, r,
&actor->fill_color, &actor->line_color);
@@ -249,28 +247,28 @@ actor_draw(Actor *actor, DiaRenderer *renderer)
p1.x = ch.x - r1;
p2.x = ch.x + r1;
p1.y = p2.y = ch.y + r;
- renderer_ops->draw_line(renderer,
+ renderer_ops->draw_line(renderer,
&p1, &p2,
&actor->line_color);
p1.x = ch.x;
p1.y = ch.y + r*0.5;
/* body & legs */
- renderer_ops->draw_line(renderer,
+ renderer_ops->draw_line(renderer,
&p1, &cb,
&actor->line_color);
p2.x = ch.x - r1;
p2.y = y + ACTOR_BODY(actor_height);
- renderer_ops->draw_line(renderer,
+ renderer_ops->draw_line(renderer,
&cb, &p2,
&actor->line_color);
-
+
p2.x = ch.x + r1;
- renderer_ops->draw_line(renderer,
+ renderer_ops->draw_line(renderer,
&cb, &p2,
&actor->line_color);
-
+
text_draw(actor->text, renderer);
}
@@ -282,7 +280,7 @@ actor_update_data(Actor *actor)
Rectangle text_box;
Point p;
real actor_height;
-
+
text_calc_boundingbox(actor->text, &text_box);
/* minimum size */
@@ -294,7 +292,7 @@ actor_update_data(Actor *actor)
/* Update connections: */
element_update_connections_rectangle(elem, actor->connections);
-
+
element_update_boundingbox(elem);
p = elem->corner;
@@ -326,11 +324,11 @@ actor_create(Point *startpoint,
Point p;
DiaFont *font;
int i;
-
+
actor = g_malloc0(sizeof(Actor));
elem = &actor->element;
obj = &elem->object;
-
+
obj->type = &actor_type;
obj->ops = &actor_ops;
elem->corner = *startpoint;
@@ -346,12 +344,12 @@ actor_create(Point *startpoint,
p.x += ACTOR_MARGIN_X;
p.y += ACTOR_HEIGHT - dia_font_descent(_("Actor"),font, 0.8);
- actor->text = new_text(_("Actor"),
+ actor->text = new_text(_("Actor"),
font, 0.8, &p, &color_black, ALIGN_CENTER);
dia_font_unref(font);
-
+
element_init(elem, 8, NUM_CONNECTIONS);
-
+
for (i=0;i<NUM_CONNECTIONS;i++) {
obj->connections[i] = &actor->connections[i];
actor->connections[i].object = obj;
diff --git a/objects/UML/association.c b/objects/UML/association.c
index 95356990..14fd4c8a 100644
--- a/objects/UML/association.c
+++ b/objects/UML/association.c
@@ -48,9 +48,7 @@
/* DO NOT USE THIS OBJECT AS A BASIS FOR A NEW OBJECT. */
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -98,7 +96,7 @@ typedef struct _AssociationEnd {
real multi_descent;
Alignment text_align;
UMLVisibility visibility; /* This value is only relevant if role is not null */
-
+
int arrow;
AggregateType aggregate; /* Note: Can only be != NONE on ONE side! */
} AssociationEnd;
@@ -128,18 +126,18 @@ struct _Association {
real text_width;
real ascent;
real descent;
-
+
gchar *name;
AssociationDirection direction;
AggregateType assoc_type;
-
+
gboolean show_direction;
AssociationEnd end[2];
-
+
Color text_color;
Color line_color;
-
+
DiaFont *font;
real font_height;
real line_width;
@@ -234,35 +232,35 @@ static PropDescription association_props[] = {
PROP_NOTEBOOK_PAGE("assoc", PROP_FLAG_DONT_MERGE, N_("General")),
ORTHCONN_COMMON_PROPERTIES,
{ "name", PROP_TYPE_STRING, PROP_FLAG_VISIBLE, N_("Name"), NULL, NULL },
- { "direction", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE,
+ { "direction", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE,
N_("Direction"), NULL, prop_assoc_direction_data },
- { "show_direction", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE|PROP_FLAG_OPTIONAL|PROP_FLAG_NO_DEFAULTS,
+ { "show_direction", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE|PROP_FLAG_OPTIONAL|PROP_FLAG_NO_DEFAULTS,
N_("Show direction"), N_("Show the small arrow denoting the reading direction"), 0 },
- { "assoc_type", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE|PROP_FLAG_OPTIONAL|PROP_FLAG_NO_DEFAULTS,
+ { "assoc_type", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE|PROP_FLAG_OPTIONAL|PROP_FLAG_NO_DEFAULTS,
N_("Type"), NULL, prop_assoc_type_data },
PROP_MULTICOL_BEGIN("sides"),
PROP_MULTICOL_COLUMN("side_a"),
{ "help", PROP_TYPE_STATIC, PROP_FLAG_VISIBLE|PROP_FLAG_DONT_SAVE|PROP_FLAG_DONT_MERGE,
N_(" "), N_("Side A") },
- { "role_a", PROP_TYPE_STRING, PROP_FLAG_VISIBLE|PROP_FLAG_OPTIONAL,
+ { "role_a", PROP_TYPE_STRING, PROP_FLAG_VISIBLE|PROP_FLAG_OPTIONAL,
N_("Role"), NULL, NULL },
- { "multipicity_a", PROP_TYPE_STRING, PROP_FLAG_VISIBLE|PROP_FLAG_OPTIONAL,
+ { "multipicity_a", PROP_TYPE_STRING, PROP_FLAG_VISIBLE|PROP_FLAG_OPTIONAL,
N_("Multiplicity"), NULL, NULL },
- { "visibility_a", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE|PROP_FLAG_OPTIONAL,
+ { "visibility_a", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE|PROP_FLAG_OPTIONAL,
N_("Visibility"), NULL, _uml_visibilities },
- { "show_arrow_a", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE|PROP_FLAG_OPTIONAL,
+ { "show_arrow_a", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE|PROP_FLAG_OPTIONAL,
N_("Show arrow"), NULL, 0 },
PROP_MULTICOL_COLUMN("side_b"),
{ "help", PROP_TYPE_STATIC, PROP_FLAG_VISIBLE|PROP_FLAG_DONT_SAVE|PROP_FLAG_DONT_MERGE,
N_(" "), N_("Side B") },
- { "role_b", PROP_TYPE_STRING, PROP_FLAG_VISIBLE|PROP_FLAG_OPTIONAL,
+ { "role_b", PROP_TYPE_STRING, PROP_FLAG_VISIBLE|PROP_FLAG_OPTIONAL,
N_(" "), NULL, NULL },
- { "multipicity_b", PROP_TYPE_STRING, PROP_FLAG_VISIBLE|PROP_FLAG_OPTIONAL,
+ { "multipicity_b", PROP_TYPE_STRING, PROP_FLAG_VISIBLE|PROP_FLAG_OPTIONAL,
N_(" "), NULL, NULL },
- { "visibility_b", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE|PROP_FLAG_OPTIONAL,
+ { "visibility_b", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE|PROP_FLAG_OPTIONAL,
N_(" "), NULL, _uml_visibilities },
- { "show_arrow_b", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE|PROP_FLAG_OPTIONAL,
+ { "show_arrow_b", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE|PROP_FLAG_OPTIONAL,
N_(" "), NULL, 0 },
PROP_MULTICOL_END("sides"),
@@ -272,7 +270,7 @@ static PropDescription association_props[] = {
PROP_STD_TEXT_HEIGHT_OPTIONS(PROP_FLAG_VISIBLE|PROP_FLAG_STANDARD|PROP_FLAG_OPTIONAL),
PROP_STD_TEXT_COLOUR_OPTIONS(PROP_FLAG_VISIBLE|PROP_FLAG_STANDARD|PROP_FLAG_OPTIONAL),
PROP_STD_LINE_WIDTH_OPTIONAL,
- PROP_STD_LINE_COLOUR_OPTIONAL,
+ PROP_STD_LINE_COLOUR_OPTIONAL,
PROP_STD_NOTEBOOK_END,
PROP_DESC_END
@@ -287,13 +285,13 @@ static PropOffset association_offsets[] = {
PROP_OFFSET_MULTICOL_BEGIN("sides"),
PROP_OFFSET_MULTICOL_COLUMN("side_a"),
{ "role_a", PROP_TYPE_STRING, offsetof(Association, end[0].role) },
- { "multipicity_a", PROP_TYPE_STRING, offsetof(Association, end[0].multiplicity) },
+ { "multipicity_a", PROP_TYPE_STRING, offsetof(Association, end[0].multiplicity) },
{ "visibility_a", PROP_TYPE_ENUM, offsetof(Association, end[0].visibility) },
{ "show_arrow_a", PROP_TYPE_BOOL, offsetof(Association, end[0].arrow) },
PROP_OFFSET_MULTICOL_COLUMN("side_b"),
{ "role_b", PROP_TYPE_STRING, offsetof(Association, end[1].role) },
- { "multipicity_b", PROP_TYPE_STRING, offsetof(Association, end[1].multiplicity) },
+ { "multipicity_b", PROP_TYPE_STRING, offsetof(Association, end[1].multiplicity) },
{ "visibility_b", PROP_TYPE_ENUM, offsetof(Association, end[1].visibility) },
{ "show_arrow_b", PROP_TYPE_BOOL, offsetof(Association, end[1].arrow) },
PROP_OFFSET_MULTICOL_END("sides"),
@@ -326,7 +324,7 @@ association_get_props(Association *assoc, GPtrArray *props)
static void
association_set_props(Association *assoc, GPtrArray *props)
{
- object_set_props_from_offsets(&assoc->orth.object,
+ object_set_props_from_offsets(&assoc->orth.object,
association_offsets, props);
/* force an internal state update after changing properties */
association_set_state(assoc, association_get_state(assoc));
@@ -356,7 +354,7 @@ association_move_handle(Association *assoc, Handle *handle,
assert(assoc!=NULL);
assert(handle!=NULL);
assert(to!=NULL);
-
+
change = orthconn_move_handle(&assoc->orth, handle, to, cp, reason, modifiers);
association_update_data(assoc);
@@ -414,15 +412,15 @@ association_draw(Association *assoc, DiaRenderer *renderer)
int n,i;
Point pos;
Arrow startarrow, endarrow;
-
+
points = &orth->points[0];
n = orth->numpoints;
-
+
renderer_ops->set_linewidth(renderer, assoc->line_width);
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID, 0.0);
renderer_ops->set_linejoin(renderer, LINEJOIN_MITER);
renderer_ops->set_linecaps(renderer, LINECAPS_BUTT);
-
+
startarrow.length = ASSOCIATION_TRIANGLESIZE;
startarrow.width = ASSOCIATION_TRIANGLESIZE;
if (assoc->end[0].arrow) {
@@ -454,7 +452,7 @@ association_draw(Association *assoc, DiaRenderer *renderer)
/* Name: */
renderer_ops->set_font(renderer, assoc->font, assoc->font_height);
-
+
if (assoc->name != NULL) {
pos = assoc->text_pos;
renderer_ops->draw_string(renderer, assoc->name,
@@ -474,9 +472,9 @@ association_draw(Association *assoc, DiaRenderer *renderer)
if (end->role != NULL && *end->role) {
gchar *role_name = g_strdup_printf ("%c%s", visible_char[(int) end->visibility], end->role);
- renderer_ops->draw_string(renderer,
+ renderer_ops->draw_string(renderer,
role_name,
- &pos,
+ &pos,
end->text_align,
&assoc->text_color);
g_free (role_name);
@@ -515,7 +513,7 @@ association_get_state(Association *assoc)
state->name = g_strdup(assoc->name);
state->direction = assoc->direction;
-
+
for (i=0;i<2;i++) {
end = &assoc->end[i];
state->end[i].role = g_strdup(end->role);
@@ -533,7 +531,7 @@ association_set_state(Association *assoc, AssociationState *state)
{
int i;
AssociationEnd *end;
-
+
g_free(assoc->name);
assoc->name = state->name;
assoc->text_width = 0.0;
@@ -542,14 +540,14 @@ association_set_state(Association *assoc, AssociationState *state)
if (assoc->name != NULL) {
assoc->text_width =
dia_font_string_width(assoc->name, assoc->font, assoc->font_height);
- assoc->ascent =
+ assoc->ascent =
dia_font_ascent(assoc->name, assoc->font, assoc->font_height);
- assoc->descent =
+ assoc->descent =
dia_font_descent(assoc->name, assoc->font, assoc->font_height);
- }
-
+ }
+
assoc->direction = state->direction;
-
+
for (i=0;i<2;i++) {
end = &assoc->end[i];
g_free(end->role);
@@ -566,12 +564,12 @@ association_set_state(Association *assoc, AssociationState *state)
end->multi_ascent = 0.0;
end->multi_descent = 0.0;
if (end->role != NULL && *end->role) {
- end->text_width =
+ end->text_width =
dia_font_string_width(end->role, assoc->font, assoc->font_height);
end->role_ascent =
dia_font_ascent(end->role, assoc->font, assoc->font_height);
end->role_descent =
- dia_font_ascent(end->role, assoc->font, assoc->font_height);
+ dia_font_ascent(end->role, assoc->font, assoc->font_height);
}
if (end->multiplicity != NULL) {
end->text_width = MAX(end->text_width,
@@ -586,7 +584,7 @@ association_set_state(Association *assoc, AssociationState *state)
}
g_free(state);
-
+
association_update_data(assoc);
}
@@ -622,7 +620,7 @@ association_update_data_end(Association *assoc, int endnum)
sp = n;
if (points[fp].y != points[sp].y)
dir = VERTICAL;
- else
+ else
dir = HORIZONTAL;
}
@@ -636,7 +634,7 @@ association_update_data_end(Association *assoc, int endnum)
end->text_align = ALIGN_LEFT;
end->text_pos.x += (get_aggregate_pos_diff(end, assoc) + ASSOCIATION_END_SPACE);
} else {
- end->text_align = ALIGN_RIGHT;
+ end->text_align = ALIGN_RIGHT;
end->text_pos.x -= (get_aggregate_pos_diff(end, assoc) + ASSOCIATION_END_SPACE);
}
break;
@@ -662,9 +660,9 @@ association_update_data_end(Association *assoc, int endnum)
rect.right = rect.left + end->text_width;
rect.top = end->text_pos.y - end->role_ascent;
rect.bottom = rect.top + 2*assoc->font_height;
-
+
rectangle_union(&obj->bounding_box, &rect);
-
+
if (assoc_get_direction_poly (assoc, dir_poly)) {
int i;
for (i = 0; i < 3; ++i)
@@ -685,8 +683,8 @@ association_update_data(Association *assoc)
Point *points;
Rectangle rect;
Orientation dir;
-
- orthconn_update_data(orth);
+
+ orthconn_update_data(orth);
/* translate new assoc state to old assoc ends */
if (assoc->direction == ASSOC_NODIR) {
@@ -700,13 +698,13 @@ association_update_data(Association *assoc)
assoc->end[1].aggregate = assoc->assoc_type;
assoc->end[0].aggregate = AGGREGATE_NONE;
}
-
- extra->start_trans =
+
+ extra->start_trans =
extra->start_long = (assoc->end[0].aggregate == AGGREGATE_NONE?
assoc->line_width/2.0:
(assoc->line_width + ASSOCIATION_DIAMONDLEN)/2.0);
extra->middle_trans = assoc->line_width/2.0;
- extra->end_trans =
+ extra->end_trans =
extra->end_long = (assoc->end[1].aggregate == AGGREGATE_NONE?
assoc->line_width/2.0:
(assoc->line_width + ASSOCIATION_DIAMONDLEN)/2.0);
@@ -717,12 +715,12 @@ association_update_data(Association *assoc)
extra->end_trans = MAX(extra->end_trans, ASSOCIATION_TRIANGLESIZE);
orthconn_update_boundingbox(orth);
-
+
/* Calc text pos: */
num_segm = assoc->orth.numpoints - 1;
points = assoc->orth.points;
i = num_segm / 2;
-
+
if ((num_segm % 2) == 0) { /* If no middle segment, use horizontal */
if (assoc->orth.orientation[i]==VERTICAL)
i--;
@@ -761,7 +759,7 @@ association_update_data(Association *assoc)
association_update_data_end(assoc, 1);
}
-static coord
+static coord
get_aggregate_pos_diff(AssociationEnd *end, const Association *assoc)
{
coord width=0;
@@ -800,7 +798,7 @@ association_create(Point *startpoint,
obj->ops = &association_ops;
orthconn_init(orth, startpoint);
-
+
/* old defaults */
assoc->font_height = 0.8;
assoc->font = dia_font_new_from_style(DIA_FONT_MONOSPACE, assoc->font_height);
@@ -820,7 +818,7 @@ association_create(Point *startpoint,
assoc->end[i].text_width = 0.0;
assoc->end[i].visibility = UML_IMPLEMENTATION;
}
-
+
assoc->text_width = 0.0;
user_d = GPOINTER_TO_INT(user_data);
@@ -836,7 +834,7 @@ association_create(Point *startpoint,
}
association_update_data(assoc);
-
+
*handle1 = orth->handles[0];
*handle2 = orth->handles[orth->numpoints-2];
@@ -892,7 +890,7 @@ static void
association_destroy(Association *assoc)
{
int i;
-
+
orthconn_destroy(&assoc->orth);
dia_font_unref(assoc->font);
g_free(assoc->name);
@@ -909,9 +907,9 @@ association_copy(Association *assoc)
Association *newassoc;
OrthConn *orth, *neworth;
int i;
-
+
orth = &assoc->orth;
-
+
newassoc = g_malloc0(sizeof(Association));
neworth = &newassoc->orth;
@@ -935,9 +933,9 @@ association_copy(Association *assoc)
}
newassoc->text_width = assoc->text_width;
-
+
association_update_data(newassoc);
-
+
return &newassoc->orth.object;
}
@@ -950,7 +948,7 @@ association_load(ObjectNode obj_node, int version, DiaContext *ctx)
OrthConn *orth;
DiaObject *obj;
int i;
-
+
/* first calls our _create() method */
obj = object_load_using_properties(&association_type, obj_node, version, ctx);
assoc = (Association *)obj;
@@ -974,12 +972,12 @@ association_load(ObjectNode obj_node, int version, DiaContext *ctx)
if (attr != NULL) {
assoc->end[i].role = data_string(attribute_first_data(attr), ctx);
}
- if ( assoc->end[i].role != NULL
+ if ( assoc->end[i].role != NULL
&& 0 == strcmp(assoc->end[i].role, "")) {
g_free(assoc->end[i].role);
assoc->end[i].role = NULL;
}
-
+
assoc->end[i].multiplicity = NULL;
attr = composite_find_attribute(composite, "multiplicity");
if (attr != NULL) {
@@ -990,7 +988,7 @@ association_load(ObjectNode obj_node, int version, DiaContext *ctx)
g_free(assoc->end[i].multiplicity);
assoc->end[i].multiplicity = NULL;
}
-
+
assoc->end[i].arrow = FALSE;
attr = composite_find_attribute(composite, "arrow");
if (attr != NULL)
@@ -1008,7 +1006,7 @@ association_load(ObjectNode obj_node, int version, DiaContext *ctx)
assoc->end[i].text_width = 0.0;
if (assoc->end[i].role != NULL) {
- assoc->end[i].text_width =
+ assoc->end[i].text_width =
dia_font_string_width(assoc->end[i].role, assoc->font,
assoc->font_height);
}
@@ -1036,7 +1034,7 @@ association_load(ObjectNode obj_node, int version, DiaContext *ctx)
assoc->direction = ASSOC_LEFT;
}
} /* version < 2 */
-
+
association_set_state(assoc, association_get_state(assoc));
return &assoc->orth.object;
diff --git a/objects/UML/branch.c b/objects/UML/branch.c
index cd56026d..cf15a981 100644
--- a/objects/UML/branch.c
+++ b/objects/UML/branch.c
@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -81,7 +79,7 @@ static ObjectTypeOps branch_type_ops =
(CreateFunc) branch_create,
(LoadFunc) branch_load,/*using_properties*/ /* load */
(SaveFunc) object_save_using_properties, /* save */
- (GetDefaultsFunc) NULL,
+ (GetDefaultsFunc) NULL,
(ApplyDefaultsFunc) NULL
};
@@ -114,9 +112,9 @@ static ObjectOps branch_ops =
static PropDescription branch_props[] = {
ELEMENT_COMMON_PROPERTIES,
- PROP_STD_LINE_COLOUR_OPTIONAL,
- PROP_STD_FILL_COLOUR_OPTIONAL,
-
+ PROP_STD_LINE_COLOUR_OPTIONAL,
+ PROP_STD_FILL_COLOUR_OPTIONAL,
+
PROP_DESC_END
};
@@ -139,14 +137,14 @@ static PropOffset branch_offsets[] = {
static void
branch_get_props(Branch * branch, GPtrArray *props)
{
- object_get_props_from_offsets(&branch->element.object,
+ object_get_props_from_offsets(&branch->element.object,
branch_offsets, props);
}
static void
branch_set_props(Branch *branch, GPtrArray *props)
{
- object_set_props_from_offsets(&branch->element.object,
+ object_set_props_from_offsets(&branch->element.object,
branch_offsets, props);
branch_update_data(branch);
}
@@ -174,11 +172,11 @@ branch_move_handle(Branch *branch, Handle *handle,
assert(to!=NULL);
assert(handle->id < 8);
-
+
/* It smashes size info in update_data anyway. And none of its siblings
* resizable, so until that changes, this should be properly unresizable
*/
-
+
/*
element_move_handle(&branch->element, handle->id, to, cp, reason, modifiers);
branch_update_data(branch);
@@ -202,7 +200,7 @@ static void branch_draw(Branch *branch, DiaRenderer *renderer)
Element *elem;
real w, h;
Point points[4];
-
+
assert(branch != NULL);
assert(renderer != NULL);
@@ -213,7 +211,7 @@ static void branch_draw(Branch *branch, DiaRenderer *renderer)
points[1].x = elem->corner.x + w, points[1].y = elem->corner.y;
points[2].x = elem->corner.x + 2*w, points[2].y = elem->corner.y + h;
points[3].x = elem->corner.x + w, points[3].y = elem->corner.y + 2*h;
-
+
renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID);
renderer_ops->set_linewidth(renderer, BRANCH_BORDERWIDTH);
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID, 0.0);
@@ -226,10 +224,10 @@ static void branch_update_data(Branch *branch)
Element *elem = &branch->element;
ElementBBExtras *extra = &elem->extra_spacing;
DiaObject *obj = &elem->object;
-
+
elem->width = BRANCH_WIDTH;
elem->height = BRANCH_HEIGHT;
-
+
/* Update connections: */
branch->connections[0].pos.x = elem->corner.x;
branch->connections[0].pos.y = elem->corner.y + elem->height / 2.;
@@ -244,7 +242,7 @@ static void branch_update_data(Branch *branch)
branch->connections[3].pos.y = elem->corner.y + elem->height;
branch->connections[3].directions = DIR_SOUTH;
- extra->border_trans = BRANCH_BORDERWIDTH / 1.4142; /* not 2.0, it is rotated 45� */
+ extra->border_trans = BRANCH_BORDERWIDTH / 1.4142; /* not 2.0, it is rotated 45� */
element_update_boundingbox(elem);
obj->position = elem->corner;
@@ -258,11 +256,11 @@ branch_create(Point *startpoint, void *user_data, Handle **handle1, Handle **han
Element *elem;
DiaObject *obj;
int i;
-
+
branch = g_malloc0(sizeof(Branch));
elem = &branch->element;
obj = &elem->object;
-
+
obj->type = &branch_type;
obj->ops = &branch_ops;
diff --git a/objects/UML/class.c b/objects/UML/class.c
index 5cd7cdb2..5bd37a96 100644
--- a/objects/UML/class.c
+++ b/objects/UML/class.c
@@ -17,14 +17,12 @@
*
* File: class.c
*
- * Purpose: This file contains implementation of the "class" code.
+ * Purpose: This file contains implementation of the "class" code.
*/
/** \file objects/UML/class.c Implementation of the 'UML - Class' type */
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <gtk/gtk.h>
@@ -99,7 +97,7 @@ DiaObjectType umlclass_type =
"UML - Class", /* name */
0, /* version */
umlclass_xpm, /* pixmap */
-
+
¨class_type_ops, /* ops */
NULL,
(void*)0
@@ -261,7 +259,7 @@ umlclass_describe_props(UMLClass *umlclass)
prop_desc_list_calculate_quarks(umlclass_props);
while (umlclass_props[i].name != NULL) {
- /* can't do this static, at least not on win32
+ /* can't do this static, at least not on win32
* due to relocation (initializer not a constant)
*/
if (0 == strcmp(umlclass_props[i].name, "attributes"))
@@ -339,14 +337,14 @@ static PropOffset umlclass_offsets[] = {
static void
umlclass_get_props(UMLClass * umlclass, GPtrArray *props)
{
- object_get_props_from_offsets(¨class->element.object,
+ object_get_props_from_offsets(¨class->element.object,
umlclass_offsets, props);
}
static DiaMenuItem umlclass_menu_items[] = {
- { N_("Show comments"), umlclass_show_comments_callback, NULL,
+ { N_("Show comments"), umlclass_show_comments_callback, NULL,
DIAMENU_ACTIVE|DIAMENU_TOGGLE },
- { N_("Allow resizing"), umlclass_allow_resizing_callback, NULL,
+ { N_("Allow resizing"), umlclass_allow_resizing_callback, NULL,
DIAMENU_ACTIVE|DIAMENU_TOGGLE },
};
@@ -402,11 +400,11 @@ umlclass_show_comments_callback(DiaObject *obj, Point *pos, gpointer data)
}
static ObjectChange *
-umlclass_allow_resizing_callback(DiaObject *obj,
- Point *pos G_GNUC_UNUSED,
+umlclass_allow_resizing_callback(DiaObject *obj,
+ Point *pos G_GNUC_UNUSED,
gpointer data G_GNUC_UNUSED)
{
- return object_toggle_prop(obj, "allow_resizing", !((UMLClass *)obj)->allow_resizing);
+ return object_toggle_prop(obj, "allow_resizing", !((UMLClass *)obj)->allow_resizing);
}
static void
@@ -418,7 +416,7 @@ umlclass_reflect_resizing(UMLClass *umlclass)
g_assert (elem->resize_handles[3].id == HANDLE_RESIZE_W);
g_assert (elem->resize_handles[4].id == HANDLE_RESIZE_E);
-
+
elem->resize_handles[3].type = umlclass->allow_resizing ? HANDLE_MAJOR_CONTROL : HANDLE_NON_MOVABLE;
elem->resize_handles[4].type = umlclass->allow_resizing ? HANDLE_MAJOR_CONTROL : HANDLE_NON_MOVABLE;
}
@@ -426,7 +424,7 @@ umlclass_reflect_resizing(UMLClass *umlclass)
static void
umlclass_set_props(UMLClass *umlclass, GPtrArray *props)
{
- /* now that operations/attributes can be set here as well we need to
+ /* now that operations/attributes can be set here as well we need to
* take for the number of connections update as well
* Note that due to a hack in umlclass_load, this is called before
* the normal connection points are set up.
@@ -439,7 +437,7 @@ umlclass_set_props(UMLClass *umlclass, GPtrArray *props)
props);
num = UMLCLASS_CONNECTIONPOINTS + umlclass_num_dynamic_connectionpoints(umlclass);
-
+
#ifdef UML_MAINPOINT
obj->num_connections = num + 1;
#else
@@ -447,7 +445,7 @@ umlclass_set_props(UMLClass *umlclass, GPtrArray *props)
#endif
obj->connections = g_realloc(obj->connections, obj->num_connections*sizeof(ConnectionPoint *));
-
+
/* Update data: */
if (num > UMLCLASS_CONNECTIONPOINTS) {
int i;
@@ -567,12 +565,12 @@ umlclass_move(UMLClass *umlclass, Point *to)
*
*/
static void
-uml_underline_text(DiaRenderer *renderer,
+uml_underline_text(DiaRenderer *renderer,
Point StartPoint,
DiaFont *font,
real font_height,
gchar *string,
- Color *color,
+ Color *color,
real line_width,
real underline_width)
{
@@ -617,7 +615,7 @@ uml_underline_text(DiaRenderer *renderer,
* made to rejoin any of the segments, that is all New Lines
* are treated as hard newlines. No syllable matching is done
* either so breaks in words will sometimes not make real
- * sense.
+ * sense.
* <p>
* Finally, since this function returns newly created dynamic
* memory the caller must free the memory to prevent memory
@@ -635,12 +633,12 @@ uml_underline_text(DiaRenderer *renderer,
static gchar *
uml_create_documentation_tag (gchar * comment,
gboolean tagging,
- gint WrapPoint,
+ gint WrapPoint,
gint *NumberOfLines)
{
gchar *CommentTag = tagging ? "{documentation = " : "";
gint TagLength = strlen(CommentTag);
- /* Make sure that there is at least some value greater then zero for the WrapPoint to
+ /* Make sure that there is at least some value greater then zero for the WrapPoint to
* support diagrams from earlier versions of Dia. So if the WrapPoint is zero then use
* the taglength as the WrapPoint. If the Tag has been changed such that it has a length
* of 0 then use 1.
@@ -662,7 +660,7 @@ uml_create_documentation_tag (gchar * comment,
while ( *comment ) {
/* Skip spaces */
while ( *comment && g_unichar_isspace(g_utf8_get_char(comment)) ) {
- comment = g_utf8_next_char(comment);
+ comment = g_utf8_next_char(comment);
}
/* Copy chars */
if ( *comment ){
@@ -671,13 +669,13 @@ uml_create_documentation_tag (gchar * comment,
BreakCandidate = NULL;
while ( *Scan && *Scan != '\n' && AvailSpace > 0 ) {
ScanChar = g_utf8_get_char(Scan);
- /* We known, that g_unichar_isspace() is not recommended for word breaking;
+ /* We known, that g_unichar_isspace() is not recommended for word breaking;
* but Pango usage seems too complex.
*/
if ( g_unichar_isspace(ScanChar) )
BreakCandidate = Scan;
AvailSpace--; /* not valid for nonspacing marks */
- Scan = g_utf8_next_char(Scan);
+ Scan = g_utf8_next_char(Scan);
}
if ( AvailSpace==0 && BreakCandidate != NULL )
Scan = BreakCandidate;
@@ -708,7 +706,7 @@ uml_create_documentation_tag (gchar * comment,
* @param renderer The Renderer on which the comment is being drawn
* @param font The font to render the comment in.
* @param font_height The Y size of the font used to render the comment
- * @param text_color A pointer to the color to use to render the comment
+ * @param text_color A pointer to the color to use to render the comment
* @param comment The comment string to render
* @param comment_tagging If the {documentation = } tag should be enforced
* @param Comment_line_length The maximum length of any one line in the comment
@@ -717,14 +715,14 @@ uml_create_documentation_tag (gchar * comment,
* @see uml_create_documentation
*/
static void
-uml_draw_comments(DiaRenderer *renderer,
+uml_draw_comments(DiaRenderer *renderer,
DiaFont *font,
real font_height,
Color *text_color,
gchar *comment,
gboolean comment_tagging,
- gint Comment_line_length,
- Point *p,
+ gint Comment_line_length,
+ Point *p,
gint alignment)
{
gint NumberOfLines = 0;
@@ -733,12 +731,12 @@ uml_draw_comments(DiaRenderer *renderer,
gchar *CommentString = 0;
gchar *NewLineP= NULL;
gchar *RenderP;
-
+
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
-
- CommentString =
+
+ CommentString =
uml_create_documentation_tag(comment, comment_tagging, Comment_line_length, &NumberOfLines);
- RenderP = CommentString;
+ RenderP = CommentString;
renderer_ops->set_font(renderer, font, font_height);
ascent = dia_font_ascent(RenderP, font, font_height);
for ( Index=0; Index < NumberOfLines; Index++)
@@ -775,9 +773,9 @@ uml_draw_comments(DiaRenderer *renderer,
* the {documentation = } tag.
* <p>
* Because the start point is the upper left of the class box, templates
- * tend to get lost when created. By applying an offset, they will not be
+ * tend to get lost when created. By applying an offset, they will not be
* lost. The offset should only be added if the elem->corner.y = 0.
- *
+ *
* @param umlclass The pointer to the class being drawn
* @param renderer The pointer to the rendering object used to draw
* @param elem The pointer to the element within the class to be drawn
@@ -796,18 +794,18 @@ umlclass_draw_namebox(UMLClass *umlclass, DiaRenderer *renderer, Element *elem )
Point LowerRightPoint;
real Yoffset;
Color *text_color = ¨class->text_color;
-
-
+
+
StartPoint.x = elem->corner.x;
StartPoint.y = elem->corner.y;
Yoffset = elem->corner.y + umlclass->namebox_height;
-
+
LowerRightPoint = StartPoint;
LowerRightPoint.x += elem->width;
LowerRightPoint.y = Yoffset;
-
+
/* First draw the outer box and fill color for the class name object */
renderer_ops->draw_rect(renderer, &StartPoint, &LowerRightPoint,
¨class->fill_color, ¨class->line_color);
@@ -845,14 +843,14 @@ umlclass_draw_namebox(UMLClass *umlclass, DiaRenderer *renderer, Element *elem )
/* comment */
if (umlclass->visible_comments && umlclass->comment != NULL && umlclass->comment[0] != '\0'){
- uml_draw_comments(renderer, umlclass->comment_font ,umlclass->comment_font_height,
- ¨class->text_color, umlclass->comment, umlclass->comment_tagging,
+ uml_draw_comments(renderer, umlclass->comment_font ,umlclass->comment_font_height,
+ ¨class->text_color, umlclass->comment, umlclass->comment_tagging,
umlclass->comment_line_length, &StartPoint, ALIGN_CENTER);
}
return Yoffset;
}
-/**
+/**
* Draw the attribute box.
* This attribute box follows the name box in the class icon. If the
* attributes are not suppress, draw each of the attributes following the
@@ -862,12 +860,12 @@ umlclass_draw_namebox(UMLClass *umlclass, DiaRenderer *renderer, Element *elem )
* using the abstract font otherwise it will be rendered using the normal
* font. If the attribute is of class scope, static in C++, then it will be
* underlined. If there is a comment associated with the attribute, that is
- * within the class description, it will be rendered as a uml comment.
+ * within the class description, it will be rendered as a uml comment.
*
* @param umlclass The pointer to the class being drawn
* @param renderer The pointer to the rendering object used to draw
* @param elem The pointer to the element within the class to be drawn
- * @param Yoffset The Y offset from the start of the class at which to draw the attributebox
+ * @param Yoffset The Y offset from the start of the class at which to draw the attributebox
* @return The offset from the start of the class to the bottom of the attributebox
* @see uml_draw_comments
*/
@@ -921,12 +919,12 @@ umlclass_draw_attributebox(UMLClass *umlclass, DiaRenderer *renderer, Element *e
StartPoint.y += font_height - ascent;
if (attr->class_scope) {
- uml_underline_text(renderer, StartPoint, font, font_height, attstr, line_color,
+ uml_underline_text(renderer, StartPoint, font, font_height, attstr, line_color,
umlclass->line_width, UMLCLASS_UNDERLINEWIDTH );
}
if (umlclass->visible_comments && attr->comment != NULL && attr->comment[0] != '\0') {
- uml_draw_comments(renderer, umlclass->comment_font ,umlclass->comment_font_height,
+ uml_draw_comments(renderer, umlclass->comment_font ,umlclass->comment_font_height,
¨class->text_color, attr->comment, umlclass->comment_tagging,
umlclass->comment_line_length, &StartPoint, ALIGN_LEFT);
StartPoint.y += umlclass->comment_font_height/2;
@@ -954,7 +952,7 @@ umlclass_draw_attributebox(UMLClass *umlclass, DiaRenderer *renderer, Element *e
* @param umlclass The pointer to the class being drawn
* @param renderer The pointer to the rendering object used to draw
* @param elem The pointer to the element within the class to be drawn
- * @param Yoffset The Y offset from the start of the class at which to draw the operationbox
+ * @param Yoffset The Y offset from the start of the class at which to draw the operationbox
* @return The offset from the start of the class to the bottom of the operationbox
*
*/
@@ -1056,7 +1054,7 @@ umlclass_draw_operationbox(UMLClass *umlclass, DiaRenderer *renderer, Element *e
}
renderer_ops->draw_string(renderer, part_opstr, &StartPoint, ALIGN_LEFT, text_color);
if (op->class_scope) {
- uml_underline_text(renderer, StartPoint, font, font_height, part_opstr, line_color,
+ uml_underline_text(renderer, StartPoint, font, font_height, part_opstr, line_color,
umlclass->line_width, UMLCLASS_UNDERLINEWIDTH );
}
last_wrap_pos = wrap_pos;
@@ -1068,7 +1066,7 @@ umlclass_draw_operationbox(UMLClass *umlclass, DiaRenderer *renderer, Element *e
StartPoint.y += ascent;
renderer_ops->draw_string(renderer, opstr, &StartPoint, ALIGN_LEFT, text_color);
if (op->class_scope) {
- uml_underline_text(renderer, StartPoint, font, font_height, opstr, line_color,
+ uml_underline_text(renderer, StartPoint, font, font_height, opstr, line_color,
umlclass->line_width, UMLCLASS_UNDERLINEWIDTH );
}
}
@@ -1077,7 +1075,7 @@ umlclass_draw_operationbox(UMLClass *umlclass, DiaRenderer *renderer, Element *e
StartPoint.y += font_height - ascent;
if (umlclass->visible_comments && op->comment != NULL && op->comment[0] != '\0'){
- uml_draw_comments(renderer, umlclass->comment_font ,umlclass->comment_font_height,
+ uml_draw_comments(renderer, umlclass->comment_font ,umlclass->comment_font_height,
¨class->text_color, op->comment, umlclass->comment_tagging,
umlclass->comment_line_length, &StartPoint, ALIGN_LEFT);
StartPoint.y += umlclass->comment_font_height/2;
@@ -1097,11 +1095,11 @@ umlclass_draw_operationbox(UMLClass *umlclass, DiaRenderer *renderer, Element *e
/**
* Draw the template parameters box in the upper right hand corner of the
* class box for paramertize classes (aka template classes). Fill in this
- * box with the parameters for the class.
+ * box with the parameters for the class.
* <p>
* At this time there is no provision for adding comments or documentation
* to the display.
- *
+ *
* @param umlclass The pointer to the class being drawn
* @param renderer The pointer to the rendering object used to draw
* @param elem The pointer to the element within the class to be drawn
@@ -1145,7 +1143,7 @@ umlclass_draw_template_parameters_box(UMLClass *umlclass, DiaRenderer *renderer,
while (list != NULL)
{
gchar *paramstr = uml_get_formalparameter_string((UMLFormalParameter *)list->data);
-
+
ascent = dia_font_ascent(paramstr, font, font_height);
TextInsert.y += ascent;
renderer_ops->draw_string(renderer, paramstr, &TextInsert, ALIGN_LEFT, text_color);
@@ -1163,26 +1161,26 @@ umlclass_draw_template_parameters_box(UMLClass *umlclass, DiaRenderer *renderer,
* line width. The object is drawn by the umlclass_draw_namebox,
* umlclass_draw_attributebox, umlclass_draw_operationbox and
* umlclass_draw_template_parameters_box.
- *
+ *
* @param umlclass object based on the uml class that is being rendered
* @param DiaRenderer renderer used to draw the object
*
*/
-
+
static void
umlclass_draw(UMLClass *umlclass, DiaRenderer *renderer)
{
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
real y = 0.0;
Element *elem;
-
+
assert(umlclass != NULL);
assert(renderer != NULL);
renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID);
renderer_ops->set_linewidth(renderer, umlclass->line_width);
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID, 0.0);
-
+
elem = ¨class->element;
y = umlclass_draw_namebox(umlclass, renderer, elem);
@@ -1211,7 +1209,7 @@ umlclass_update_data(UMLClass *umlclass)
x = elem->corner.x;
y = elem->corner.y;
-
+
/* Update connections: */
umlclass->connections[0].pos = elem->corner;
umlclass->connections[0].directions = DIR_NORTH|DIR_WEST;
@@ -1268,7 +1266,7 @@ umlclass_update_data(UMLClass *umlclass)
i = UMLCLASS_CONNECTIONPOINTS;
umlclass->connections[i].pos.x = x + elem->width / 2;
umlclass->connections[i].pos.y = y + elem->height / 2;
- umlclass->connections[i].directions = DIR_ALL;
+ umlclass->connections[i].directions = DIR_ALL;
umlclass->connections[i].flags = CP_FLAGS_MAIN;
#endif
@@ -1290,7 +1288,7 @@ umlclass_update_data(UMLClass *umlclass)
gint NumberOfLines = 0;
gchar *CommentString = 0;
- CommentString =
+ CommentString =
uml_create_documentation_tag(attr->comment, umlclass->comment_tagging,
umlclass->comment_line_length, &NumberOfLines);
g_free(CommentString);
y += umlclass->comment_font_height*NumberOfLines + umlclass->comment_font_height/2;
@@ -1303,7 +1301,7 @@ umlclass_update_data(UMLClass *umlclass)
if (umlclass->visible_attributes) {
y += umlclass->attributesbox_height;
}
-
+
list = (!umlclass->visible_operations || umlclass->suppress_operations) ? NULL : umlclass->operations;
while (list != NULL) {
UMLOperation *op = (UMLOperation *)list->data;
@@ -1325,24 +1323,24 @@ umlclass_update_data(UMLClass *umlclass)
gint NumberOfLines = 0;
gchar *CommentString = 0;
- CommentString =
+ CommentString =
uml_create_documentation_tag(op->comment, umlclass->comment_tagging, umlclass->comment_line_length,
&NumberOfLines);
g_free(CommentString);
y += umlclass->comment_font_height*NumberOfLines + umlclass->comment_font_height/2;
}
list = g_list_next(list);
}
-
+
element_update_boundingbox(elem);
if (umlclass->template) {
/* fix boundingumlclass for templates: */
obj->bounding_box.top -= (umlclass->templates_height - UMLCLASS_TEMPLATE_OVERLAY_Y) ;
obj->bounding_box.right += (umlclass->templates_width - UMLCLASS_TEMPLATE_OVERLAY_X);
- obj->bounding_box.left -= (elem->width < UMLCLASS_TEMPLATE_OVERLAY_X) ?
+ obj->bounding_box.left -= (elem->width < UMLCLASS_TEMPLATE_OVERLAY_X) ?
(UMLCLASS_TEMPLATE_OVERLAY_X - elem->width) : 0;
}
-
+
obj->position = elem->corner;
element_update_handles(elem);
@@ -1357,7 +1355,7 @@ umlclass_update_data(UMLClass *umlclass)
* The height is stored in the class structure. When calculating the
* comment, if any, the comment is word wrapped and the resulting number of
* lines is then used to calculate the height of the bounding box.
- *
+ *
* @param umlclass pointer to the object of UMLClass to calculate
* @return the horizontal size of the name box.
*
@@ -1371,11 +1369,11 @@ umlclass_calculate_name_data(UMLClass *umlclass)
/* name box: */
if (umlclass->name != NULL && umlclass->name[0] != '\0') {
- if (umlclass->abstract) {
+ if (umlclass->abstract) {
maxwidth = dia_font_string_width(umlclass->name,
umlclass->abstract_classname_font,
umlclass->abstract_classname_font_height);
- } else {
+ } else {
maxwidth = dia_font_string_width(umlclass->name,
umlclass->classname_font,
umlclass->classname_font_height);
@@ -1406,12 +1404,12 @@ umlclass_calculate_name_data(UMLClass *umlclass)
int NumberOfLines = 0;
gchar *CommentString = uml_create_documentation_tag (umlclass->comment,
umlclass->comment_tagging,
- umlclass->comment_line_length,
+ umlclass->comment_line_length,
&NumberOfLines);
- width = dia_font_string_width (CommentString,
+ width = dia_font_string_width (CommentString,
umlclass->comment_font,
umlclass->comment_font_height);
-
+
g_free(CommentString);
umlclass->namebox_height += umlclass->comment_font_height * NumberOfLines;
maxwidth = MAX(width, maxwidth);
@@ -1427,7 +1425,7 @@ umlclass_calculate_name_data(UMLClass *umlclass)
*/
static real
-umlclass_calculate_attribute_data(UMLClass *umlclass)
+umlclass_calculate_attribute_data(UMLClass *umlclass)
{
int i;
real maxwidth = 0.0;
@@ -1466,7 +1464,7 @@ umlclass_calculate_attribute_data(UMLClass *umlclass)
int NumberOfLines = 0;
gchar *CommentString = uml_create_documentation_tag(attr->comment,
umlclass->comment_tagging,
- umlclass->comment_line_length,
+ umlclass->comment_line_length,
&NumberOfLines);
width = dia_font_string_width(CommentString,
umlclass->comment_font,
@@ -1496,7 +1494,7 @@ umlclass_calculate_attribute_data(UMLClass *umlclass)
* @return the horizontial size of the operations box
*
*/
-
+
static real
umlclass_calculate_operation_data(UMLClass *umlclass)
{
@@ -1533,7 +1531,7 @@ umlclass_calculate_operation_data(UMLClass *umlclass)
g_list_free(op->wrappos);
}
op->wrappos = NULL;
-
+
switch(op->inheritance_type)
{
case UML_ABSTRACT:
@@ -1559,9 +1557,9 @@ umlclass_calculate_operation_data(UMLClass *umlclass)
op->needs_wrapping = TRUE;
/* count maximal line width to create a secure buffer (part_opstr)
- and build the sublist with the wrapping data for the current operation, which will be used by
umlclass_draw(), too.
+ and build the sublist with the wrapping data for the current operation, which will be used by
umlclass_draw(), too.
*/
- pos_brace = wrap_pos = offset
+ pos_brace = wrap_pos = offset
= maxlinewidth = umlclass->max_wrapped_line_width = 0;
while( wrap_pos + offset < length)
{
@@ -1569,14 +1567,14 @@ umlclass_calculate_operation_data(UMLClass *umlclass)
{
int pos_next_comma = strcspn( (const gchar*)opstr + wrap_pos + offset, ",");
wrap_pos += pos_next_comma + 1;
- } while( wrap_pos < umlclass->wrap_after_char - pos_brace
+ } while( wrap_pos < umlclass->wrap_after_char - pos_brace
&& wrap_pos + offset < length);
if( offset == 0){
pos_brace = strcspn( opstr, "(");
op->wrap_indent = pos_brace + 1;
}
- op->wrappos = g_list_append(op->wrappos,
+ op->wrappos = g_list_append(op->wrappos,
GINT_TO_POINTER(wrap_pos + offset));
maxlinewidth = MAX(maxlinewidth, wrap_pos);
@@ -1645,7 +1643,7 @@ umlclass_calculate_operation_data(UMLClass *umlclass)
int NumberOfLines = 0;
gchar *CommentString = uml_create_documentation_tag(op->comment,
umlclass->comment_tagging,
- umlclass->comment_line_length,
+ umlclass->comment_line_length,
&NumberOfLines);
width = dia_font_string_width(CommentString,
umlclass->comment_font,
@@ -1683,7 +1681,7 @@ umlclass_calculate_operation_data(UMLClass *umlclass)
* the resulting number of lines is used to calculate the size of the
* comment within the box. The various font settings with in the class
* properties contribute to the overall size of the resulting bounding box.
- *
+ *
* @param umlclass a pointer to an object of UMLClass
*
* @return the horizontial size of the box
@@ -1735,7 +1733,7 @@ umlclass_calculate_data(UMLClass *umlclass)
{
UMLFormalParameter *param = (UMLFormalParameter *) list->data;
gchar *paramstr = uml_get_formalparameter_string(param);
-
+
width = dia_font_string_width(paramstr,
umlclass->normal_font,
umlclass->font_height);
@@ -1759,22 +1757,22 @@ fill_in_fontdata(UMLClass *umlclass)
}
if (umlclass->abstract_font == NULL) {
umlclass->abstract_font_height = 0.8;
- umlclass->abstract_font =
+ umlclass->abstract_font =
dia_font_new_from_style(DIA_FONT_MONOSPACE | DIA_FONT_ITALIC | DIA_FONT_BOLD, 0.8);
}
if (umlclass->polymorphic_font == NULL) {
umlclass->polymorphic_font_height = 0.8;
- umlclass->polymorphic_font =
+ umlclass->polymorphic_font =
dia_font_new_from_style(DIA_FONT_MONOSPACE | DIA_FONT_ITALIC, 0.8);
}
if (umlclass->classname_font == NULL) {
umlclass->classname_font_height = 1.0;
- umlclass->classname_font =
+ umlclass->classname_font =
dia_font_new_from_style(DIA_FONT_SANS | DIA_FONT_BOLD, 1.0);
}
if (umlclass->abstract_classname_font == NULL) {
umlclass->abstract_classname_font_height = 1.0;
- umlclass->abstract_classname_font =
+ umlclass->abstract_classname_font =
dia_font_new_from_style(DIA_FONT_SANS | DIA_FONT_BOLD | DIA_FONT_ITALIC, 1.0);
}
if (umlclass->comment_font == NULL) {
@@ -1816,7 +1814,7 @@ umlclass_create(Point *startpoint,
umlclass = g_malloc0(sizeof(UMLClass));
elem = ¨class->element;
obj = &elem->object;
-
+
elem->corner = *startpoint;
@@ -1830,9 +1828,9 @@ umlclass_create(Point *startpoint,
fill_in_fontdata(umlclass);
- /*
- * The following block of code may need to be converted to a switch statement if more than
- * two types of objects can be made - Dave Klotzbach
+ /*
+ * The following block of code may need to be converted to a switch statement if more than
+ * two types of objects can be made - Dave Klotzbach
*/
umlclass->template = (GPOINTER_TO_INT(user_data)==1);
@@ -1863,18 +1861,18 @@ umlclass_create(Point *startpoint,
umlclass->attributes = NULL;
umlclass->operations = NULL;
-
+
umlclass->formal_params = NULL;
-
+
umlclass->stereotype_string = NULL;
-
+
umlclass->line_width = attributes_get_default_linewidth();
umlclass->text_color = color_black;
umlclass->line_color = attributes_get_foreground();
umlclass->fill_color = attributes_get_background();
umlclass_calculate_data(umlclass);
-
+
for (i=0;i<UMLCLASS_CONNECTIONPOINTS;i++) {
obj->connections[i] = ¨class->connections[i];
umlclass->connections[i].object = obj;
@@ -1922,8 +1920,8 @@ umlclass_destroy(UMLClass *umlclass)
dia_font_unref(umlclass->abstract_classname_font);
dia_font_unref(umlclass->comment_font);
- element_destroy(¨class->element);
-
+ element_destroy(¨class->element);
+
g_free(umlclass->name);
g_free(umlclass->stereotype);
g_free(umlclass->comment);
@@ -1937,7 +1935,7 @@ umlclass_destroy(UMLClass *umlclass)
list = g_list_next(list);
}
g_list_free(umlclass->attributes);
-
+
list = umlclass->operations;
while (list != NULL) {
op = (UMLOperation *)list->data;
@@ -1974,9 +1972,9 @@ umlclass_copy(UMLClass *umlclass)
DiaObject *newobj;
GList *list;
UMLFormalParameter *param;
-
+
elem = ¨class->element;
-
+
newumlclass = g_malloc0(sizeof(UMLClass));
newelem = &newumlclass->element;
newobj = &newelem->object;
@@ -2039,7 +2037,7 @@ umlclass_copy(UMLClass *umlclass)
/* not copying the connection, if there was one */
UMLAttribute *newattr = uml_attribute_copy(attr);
uml_attribute_ensure_connection_points (newattr, newobj);
-
+
newumlclass->attributes = g_list_append(newumlclass->attributes,
newattr);
list = g_list_next(list);
@@ -2058,7 +2056,7 @@ umlclass_copy(UMLClass *umlclass)
}
newumlclass->template = umlclass->template;
-
+
newumlclass->formal_params = NULL;
list = umlclass->formal_params;
while (list != NULL) {
@@ -2070,7 +2068,7 @@ umlclass_copy(UMLClass *umlclass)
}
newumlclass->properties_dialog = NULL;
-
+
newumlclass->stereotype_string = NULL;
for (i=0;i<UMLCLASS_CONNECTIONPOINTS;i++) {
@@ -2090,11 +2088,11 @@ umlclass_copy(UMLClass *umlclass)
UMLAttribute *attr = (UMLAttribute *)list->data;
newobj->connections[i++] = attr->left_connection;
newobj->connections[i++] = attr->right_connection;
-
+
list = g_list_next(list);
}
}
-
+
if ( (newumlclass->visible_operations) &&
(!newumlclass->suppress_operations)) {
list = newumlclass->operations;
@@ -2102,7 +2100,7 @@ umlclass_copy(UMLClass *umlclass)
UMLOperation *op = (UMLOperation *)list->data;
newobj->connections[i++] = op->left_connection;
newobj->connections[i++] = op->right_connection;
-
+
list = g_list_next(list);
}
}
@@ -2111,9 +2109,9 @@ umlclass_copy(UMLClass *umlclass)
newobj->connections[i] = &newumlclass->connections[UMLCLASS_CONNECTIONPOINTS];
newumlclass->connections[UMLCLASS_CONNECTIONPOINTS].object = newobj;
newumlclass->connections[UMLCLASS_CONNECTIONPOINTS].connected = NULL;
- newumlclass->connections[UMLCLASS_CONNECTIONPOINTS].pos =
+ newumlclass->connections[UMLCLASS_CONNECTIONPOINTS].pos =
umlclass->connections[UMLCLASS_CONNECTIONPOINTS].pos;
- newumlclass->connections[UMLCLASS_CONNECTIONPOINTS].flags =
+ newumlclass->connections[UMLCLASS_CONNECTIONPOINTS].flags =
umlclass->connections[UMLCLASS_CONNECTIONPOINTS].flags;
#endif
@@ -2122,7 +2120,7 @@ umlclass_copy(UMLClass *umlclass)
#ifdef DEBUG
umlclass_sanity_check(newumlclass, "Copied");
#endif
-
+
return &newumlclass->element.object;
}
@@ -2136,7 +2134,7 @@ umlclass_save(UMLClass *umlclass, ObjectNode obj_node,
UMLFormalParameter *formal_param;
GList *list;
AttributeNode attr_node;
-
+
#ifdef DEBUG
umlclass_sanity_check(umlclass, "Saving");
#endif
@@ -2172,13 +2170,13 @@ umlclass_save(UMLClass *umlclass, ObjectNode obj_node,
umlclass->comment_tagging, ctx);
data_add_boolean(new_attribute(obj_node, "allow_resizing"),
umlclass->allow_resizing, ctx);
- data_add_real(new_attribute(obj_node, PROP_STDNAME_LINE_WIDTH),
+ data_add_real(new_attribute(obj_node, PROP_STDNAME_LINE_WIDTH),
umlclass->line_width, ctx);
- data_add_color(new_attribute(obj_node, "line_color"),
+ data_add_color(new_attribute(obj_node, "line_color"),
¨class->line_color, ctx);
- data_add_color(new_attribute(obj_node, "fill_color"),
+ data_add_color(new_attribute(obj_node, "fill_color"),
¨class->fill_color, ctx);
- data_add_color(new_attribute(obj_node, "text_color"),
+ data_add_color(new_attribute(obj_node, "text_color"),
¨class->text_color, ctx);
data_add_font (new_attribute (obj_node, "normal_font"),
umlclass->normal_font, ctx);
@@ -2213,7 +2211,7 @@ umlclass_save(UMLClass *umlclass, ObjectNode obj_node,
uml_attribute_write(attr_node, attr, ctx);
list = g_list_next(list);
}
-
+
/* Operations info: */
attr_node = new_attribute(obj_node, "operations");
list = umlclass->operations;
@@ -2226,7 +2224,7 @@ umlclass_save(UMLClass *umlclass, ObjectNode obj_node,
/* Template info: */
data_add_boolean(new_attribute(obj_node, "template"),
umlclass->template, ctx);
-
+
attr_node = new_attribute(obj_node, "templates");
list = umlclass->formal_params;
while (list != NULL) {
@@ -2245,12 +2243,12 @@ umlclass_load(ObjectNode obj_node, int version, DiaContext *ctx)
AttributeNode attr_node;
int i;
GList *list;
-
+
umlclass = g_malloc0(sizeof(UMLClass));
elem = ¨class->element;
obj = &elem->object;
-
+
obj->type = ¨class_type;
obj->ops = ¨class_ops;
@@ -2271,13 +2269,13 @@ umlclass_load(ObjectNode obj_node, int version, DiaContext *ctx)
}
fill_in_fontdata(umlclass);
-
+
/* kind of dirty, object_load_props() may leave us in an inconsistent state --hb */
object_load_props(obj,obj_node, ctx);
- /* parameters loaded via StdProp dont belong here anymore. In case of strings they
- * will produce leaks. Otherwise they are just wasting time (at runtime and while
- * reading the code). Except maybe for some compatibility stuff.
+ /* parameters loaded via StdProp dont belong here anymore. In case of strings they
+ * will produce leaks. Otherwise they are just wasting time (at runtime and while
+ * reading the code). Except maybe for some compatibility stuff.
* Although that *could* probably done via StdProp too. --hb
*/
@@ -2286,7 +2284,7 @@ umlclass_load(ObjectNode obj_node, int version, DiaContext *ctx)
attr_node = object_find_attribute(obj_node, "wrap_operations");
if (attr_node != NULL)
umlclass->wrap_operations = data_boolean(attribute_first_data(attr_node), ctx);
-
+
umlclass->wrap_after_char = UMLCLASS_WRAP_AFTER_CHAR;
attr_node = object_find_attribute(obj_node, "wrap_after_char");
if (attr_node != NULL)
@@ -2306,7 +2304,7 @@ umlclass_load(ObjectNode obj_node, int version, DiaContext *ctx)
attr_node = object_find_attribute(obj_node, "comment_tagging");
if (attr_node != NULL)
umlclass->comment_tagging = data_boolean(attribute_first_data(attr_node), ctx);
-
+
/* Loads the line width */
umlclass->line_width = UMLCLASS_BORDER;
attr_node = object_find_attribute(obj_node, PROP_STDNAME_LINE_WIDTH);
@@ -2322,7 +2320,7 @@ umlclass_load(ObjectNode obj_node, int version, DiaContext *ctx)
/* ... but prefer the new one */
attr_node = object_find_attribute(obj_node, "line_color");
if(attr_node != NULL)
- data_color(attribute_first_data(attr_node), ¨class->line_color, ctx);
+ data_color(attribute_first_data(attr_node), ¨class->line_color, ctx);
attr_node = object_find_attribute(obj_node, "text_color");
if(attr_node != NULL)
data_color(attribute_first_data(attr_node), ¨class->text_color, ctx);
@@ -2364,18 +2362,18 @@ umlclass_load(ObjectNode obj_node, int version, DiaContext *ctx)
umlclass->template = data_boolean(attribute_first_data(attr_node), ctx);
fill_in_fontdata(umlclass);
-
+
umlclass->stereotype_string = NULL;
umlclass_calculate_data(umlclass);
elem->extra_spacing.border_trans = umlclass->line_width/2.0;
umlclass_update_data(umlclass);
-
+
for (i=0;i<8;i++) {
obj->handles[i]->type = HANDLE_NON_MOVABLE;
}
- umlclass_reflect_resizing(umlclass);
+ umlclass_reflect_resizing(umlclass);
#ifdef DEBUG
umlclass_sanity_check(umlclass, "Loaded class");
@@ -2385,7 +2383,7 @@ umlclass_load(ObjectNode obj_node, int version, DiaContext *ctx)
}
/** Returns the number of connection points used by the attributes and
- * connections in the current state of the object.
+ * connections in the current state of the object.
*/
static int
umlclass_num_dynamic_connectionpoints(UMLClass *umlclass) {
@@ -2395,7 +2393,7 @@ umlclass_num_dynamic_connectionpoints(UMLClass *umlclass) {
GList *list = umlclass->attributes;
num += 2 * g_list_length(list);
}
-
+
if ( (umlclass->visible_operations) &&
(!umlclass->suppress_operations)) {
GList *list = umlclass->operations;
@@ -2424,7 +2422,7 @@ umlclass_sanity_check(UMLClass *c, gchar *msg)
"%s: Class %p has %d connections, but %d fixed and %d dynamic\n",
msg, c, obj->num_connections, num_fixed_connections,
umlclass_num_dynamic_connectionpoints(c));
-
+
for (i = 0; i < UMLCLASS_CONNECTIONPOINTS; i++) {
dia_assert_true(&c->connections[i] == obj->connections[i],
"%s: Class %p connection mismatch at %d: %p != %p\n",
diff --git a/objects/UML/classicon.c b/objects/UML/classicon.c
index f6dd9b92..0d92edcd 100644
--- a/objects/UML/classicon.c
+++ b/objects/UML/classicon.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -45,13 +43,13 @@ struct _Classicon {
Element element;
ConnectionPoint connections[NUM_CONNECTIONS];
-
+
int stereotype;
int is_object;
Text *text;
Color line_color;
Color fill_color;
-
+
real line_width;
};
@@ -93,7 +91,7 @@ static ObjectTypeOps classicon_type_ops =
(CreateFunc) classicon_create,
(LoadFunc) classicon_load,/*using_properties*/ /* load */
(SaveFunc) object_save_using_properties, /* save */
- (GetDefaultsFunc) NULL,
+ (GetDefaultsFunc) NULL,
(ApplyDefaultsFunc) NULL
};
@@ -144,9 +142,9 @@ static PropDescription classicon_props[] = {
PROP_STD_TEXT_COLOUR_OPTIONAL,
{ "text", PROP_TYPE_TEXT, 0, N_("Text"), NULL, NULL },
PROP_STD_LINE_WIDTH_OPTIONAL,
- PROP_STD_LINE_COLOUR_OPTIONAL,
- PROP_STD_FILL_COLOUR_OPTIONAL,
-
+ PROP_STD_LINE_COLOUR_OPTIONAL,
+ PROP_STD_FILL_COLOUR_OPTIONAL,
+
PROP_DESC_END
};
@@ -225,9 +223,9 @@ static ObjectChange*
classicon_move(Classicon *cicon, Point *to)
{
Element *elem = &cicon->element;
-
+
elem->corner = *to;
- elem->corner.x -= elem->width/2.0;
+ elem->corner.x -= elem->width/2.0;
elem->corner.y -= CLASSICON_RADIOUS + CLASSICON_ARROW;
if (cicon->stereotype==CLASSICON_BOUNDARY)
@@ -246,7 +244,7 @@ classicon_draw(Classicon *icon, DiaRenderer *renderer)
real r, x, y, w;
Point center, p1, p2;
int i;
-
+
assert(icon != NULL);
assert(renderer != NULL);
@@ -314,7 +312,7 @@ classicon_draw(Classicon *icon, DiaRenderer *renderer)
&icon->line_color);
break;
}
-
+
text_draw(icon->text, renderer);
if (icon->is_object) {
@@ -322,7 +320,7 @@ classicon_draw(Classicon *icon, DiaRenderer *renderer)
if (icon->stereotype==CLASSICON_BOUNDARY)
x += r/2.0;
p1.y = p2.y = icon->text->position.y + text_get_descent(icon->text);
- for (i=0; i<icon->text->numlines; i++) {
+ for (i=0; i<icon->text->numlines; i++) {
p1.x = x + (w - text_get_line_width(icon->text, i))/2;
p2.x = p1.x + text_get_line_width(icon->text, i);
renderer_ops->draw_line(renderer,
@@ -341,7 +339,7 @@ classicon_update_data(Classicon *cicon)
Point p1;
real h, wt, w = 0;
int is_boundary = (cicon->stereotype==CLASSICON_BOUNDARY);
-
+
text_calc_boundingbox(cicon->text, NULL);
h = CLASSICON_AIR + CLASSICON_MARGIN + CLASSICON_ARROW + 2*CLASSICON_RADIOUS;
@@ -355,18 +353,18 @@ classicon_update_data(Classicon *cicon)
w = MAX(w, wt) + CLASSICON_AIR;
- p1.y = h + elem->corner.y;
+ p1.y = h + elem->corner.y;
h += cicon->text->height*cicon->text->numlines + CLASSICON_AIR;
-
+
p1.y += cicon->text->ascent;
p1.x = elem->corner.x + w/2.0;
if (cicon->stereotype==CLASSICON_BOUNDARY)
p1.x += CLASSICON_RADIOUS/2.0;
text_set_position(cicon->text, &p1);
-
+
elem->width = w;
elem->height = h;
-
+
p1.x = elem->corner.x + elem->width / 2.0;
p1.y = elem->corner.y + CLASSICON_RADIOUS + CLASSICON_ARROW;
w = CLASSICON_RADIOUS + CLASSICON_ARROW;
@@ -374,7 +372,7 @@ classicon_update_data(Classicon *cicon)
if (is_boundary)
p1.x += CLASSICON_RADIOUS/2.0;
-
+
/* Update connections: */
cicon->connections[0].pos.x = (is_boundary) ? p1.x-2*w: p1.x - h;
cicon->connections[0].pos.y = (is_boundary) ? elem->corner.y: p1.y - h;
@@ -383,9 +381,9 @@ classicon_update_data(Classicon *cicon)
cicon->connections[1].pos.y = p1.y - w;
cicon->connections[1].directions = DIR_NORTH;
cicon->connections[2].pos.x = p1.x + h;
- cicon->connections[2].pos.y = p1.y - h;
+ cicon->connections[2].pos.y = p1.y - h;
cicon->connections[2].directions = DIR_NORTH|DIR_EAST;
-
+
cicon->connections[3].pos.x = (is_boundary) ? p1.x-2*w: p1.x - w;
cicon->connections[3].pos.y = p1.y;
cicon->connections[3].directions = DIR_WEST;
@@ -404,7 +402,7 @@ classicon_update_data(Classicon *cicon)
cicon->connections[8].pos.x = elem->corner.x + elem->width/2;
cicon->connections[8].pos.y = elem->corner.y + elem->height/2;
cicon->connections[8].directions = DIR_ALL;
-
+
element_update_boundingbox(elem);
obj->position = elem->corner;
@@ -426,7 +424,7 @@ classicon_create(Point *startpoint,
Point p;
DiaFont *font;
int i;
-
+
cicon = g_malloc0(sizeof(Classicon));
/* old default */
@@ -434,7 +432,7 @@ classicon_create(Point *startpoint,
elem = &cicon->element;
obj = &elem->object;
-
+
obj->type = &classicon_type;
obj->ops = &classicon_ops;
@@ -444,7 +442,7 @@ classicon_create(Point *startpoint,
cicon->fill_color = attributes_get_background();
font = dia_font_new_from_style (DIA_FONT_SANS, 0.8);
-
+
cicon->stereotype = 0;
cicon->is_object = 0;
@@ -454,9 +452,9 @@ classicon_create(Point *startpoint,
cicon->text = new_text("", font, 0.8, &p, &color_black, ALIGN_CENTER);
dia_font_unref(font);
-
+
element_init(elem, 8, NUM_CONNECTIONS);
-
+
for (i=0;i<NUM_CONNECTIONS;i++) {
obj->connections[i] = &cicon->connections[i];
cicon->connections[i].object = obj;
diff --git a/objects/UML/component.c b/objects/UML/component.c
index fe5b9437..e6f2391e 100644
--- a/objects/UML/component.c
+++ b/objects/UML/component.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -85,7 +83,7 @@ static ObjectTypeOps component_type_ops =
(CreateFunc) component_create,
(LoadFunc) component_load,/*using_properties*/ /* load */
(SaveFunc) object_save_using_properties, /* save */
- (GetDefaultsFunc) NULL,
+ (GetDefaultsFunc) NULL,
(ApplyDefaultsFunc) NULL
};
@@ -123,14 +121,14 @@ static ObjectOps component_ops = {
static PropDescription component_props[] = {
ELEMENT_COMMON_PROPERTIES,
- PROP_STD_LINE_COLOUR_OPTIONAL,
- PROP_STD_FILL_COLOUR_OPTIONAL,
+ PROP_STD_LINE_COLOUR_OPTIONAL,
+ PROP_STD_FILL_COLOUR_OPTIONAL,
{ "stereotype", PROP_TYPE_STRING, PROP_FLAG_VISIBLE,
N_("Stereotype"), NULL, NULL },
PROP_STD_TEXT_FONT,
PROP_STD_TEXT_HEIGHT,
PROP_STD_TEXT_COLOUR,
- { "text", PROP_TYPE_TEXT, 0, N_("Text"), NULL, NULL },
+ { "text", PROP_TYPE_TEXT, 0, N_("Text"), NULL, NULL },
PROP_DESC_END
};
@@ -151,7 +149,7 @@ static PropOffset component_offsets[] = {
{"text",PROP_TYPE_TEXT,offsetof(Component,text)},
{"text_font",PROP_TYPE_FONT,offsetof(Component,text),offsetof(Text,font)},
{PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Component,text),offsetof(Text,height)},
- {"text_colour",PROP_TYPE_COLOUR,offsetof(Component,text),offsetof(Text,color)},
+ {"text_colour",PROP_TYPE_COLOUR,offsetof(Component,text),offsetof(Text,color)},
{ NULL, 0, 0 },
};
@@ -166,7 +164,7 @@ component_get_props(Component * component, GPtrArray *props)
static void
component_set_props(Component *component, GPtrArray *props)
{
- object_set_props_from_offsets(&component->element.object,
+ object_set_props_from_offsets(&component->element.object,
component_offsets, props);
g_free(component->st_stereotype);
component->st_stereotype = NULL;
@@ -230,7 +228,7 @@ component_draw(Component *cmp, DiaRenderer *renderer)
Element *elem;
real x, y, w, h;
Point p1, p2;
-
+
assert(cmp != NULL);
assert(renderer != NULL);
@@ -240,7 +238,7 @@ component_draw(Component *cmp, DiaRenderer *renderer)
y = elem->corner.y;
w = elem->width;
h = elem->height;
-
+
renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID);
renderer_ops->set_linewidth(renderer, COMPONENT_BORDERWIDTH);
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID, 0.0);
@@ -248,7 +246,7 @@ component_draw(Component *cmp, DiaRenderer *renderer)
p1.x = x + COMPONENT_CWIDTH/2; p1.y = y;
p2.x = x+w; p2.y = y+h;
- renderer_ops->draw_rect(renderer,
+ renderer_ops->draw_rect(renderer,
&p1, &p2,
&cmp->fill_color,
&cmp->line_color);
@@ -256,15 +254,15 @@ component_draw(Component *cmp, DiaRenderer *renderer)
p1.x= x; p1.y = y +(h - 3*COMPONENT_CHEIGHT)/2.0;
p2.x = x+COMPONENT_CWIDTH; p2.y = p1.y + COMPONENT_CHEIGHT;
- renderer_ops->draw_rect(renderer,
+ renderer_ops->draw_rect(renderer,
&p1, &p2,
&cmp->fill_color,
&cmp->line_color);
-
+
p1.y = p2.y + COMPONENT_CHEIGHT;
p2.y = p1.y + COMPONENT_CHEIGHT;
- renderer_ops->draw_rect(renderer,
+ renderer_ops->draw_rect(renderer,
&p1, &p2,
&cmp->fill_color,
&cmp->line_color);
@@ -274,7 +272,7 @@ component_draw(Component *cmp, DiaRenderer *renderer)
p1 = cmp->text->position;
p1.y -= cmp->text->height;
renderer_ops->set_font(renderer, cmp->text->font, cmp->text->height);
- renderer_ops->draw_string(renderer, cmp->st_stereotype, &p1,
+ renderer_ops->draw_string(renderer, cmp->st_stereotype, &p1,
ALIGN_LEFT, &cmp->text->color);
}
@@ -388,11 +386,11 @@ component_create(Point *startpoint,
Point p;
DiaFont *font;
int i;
-
+
cmp = g_malloc0(sizeof(Component));
elem = &cmp->element;
obj = &elem->object;
-
+
obj->type = &component_type;
obj->ops = &component_ops;
@@ -405,13 +403,13 @@ component_create(Point *startpoint,
p = *startpoint;
p.x += COMPONENT_CWIDTH + COMPONENT_MARGIN_X;
p.y += 2*COMPONENT_CHEIGHT;
-
+
cmp->text = new_text("", font, 0.8, &p, &color_black, ALIGN_LEFT);
dia_font_unref(font);
-
+
element_init(elem, 8, NUM_CONNECTIONS);
-
+
for (i=0;i<NUM_CONNECTIONS;i++) {
obj->connections[i] = &cmp->connections[i];
cmp->connections[i].object = obj;
diff --git a/objects/UML/component_feature.c b/objects/UML/component_feature.c
index 49a75ec7..6114d2a0 100644
--- a/objects/UML/component_feature.c
+++ b/objects/UML/component_feature.c
@@ -22,9 +22,7 @@
* 2003-08-13, 2003-08-15: W. Borgert <debacle debian org>
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -70,7 +68,7 @@ struct _Compfeat {
Text *text;
Point text_pos;
Handle text_handle;
-
+
Color line_color;
real line_width;
};
@@ -161,8 +159,8 @@ static PropDescription compfeat_props[] = {
PROP_STD_TEXT_COLOUR,
PROP_STD_TEXT_ALIGNMENT,
{ "text_pos", PROP_TYPE_POINT, 0, NULL, NULL, NULL },
- PROP_STD_LINE_WIDTH_OPTIONAL,
- PROP_STD_LINE_COLOUR_OPTIONAL,
+ PROP_STD_LINE_WIDTH_OPTIONAL,
+ PROP_STD_LINE_COLOUR_OPTIONAL,
PROP_DESC_END
};
@@ -287,7 +285,7 @@ compfeat_move_handle(Compfeat *compfeat, Handle *handle,
text_set_position(compfeat->text, to);
change = NULL;
} else {
- change = orthconn_move_handle(&compfeat->orth, handle, to, cp,
+ change = orthconn_move_handle(&compfeat->orth, handle, to, cp,
reason, modifiers);
}
compfeat_update_data(compfeat);
diff --git a/objects/UML/constraint.c b/objects/UML/constraint.c
index 9f853394..7bd9a886 100644
--- a/objects/UML/constraint.c
+++ b/objects/UML/constraint.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -50,13 +48,13 @@ struct _Constraint {
Color text_color;
Color line_color;
-
+
DiaFont *font;
real font_height;
real line_width;
};
-
+
#define CONSTRAINT_DASHLEN 0.4
#define CONSTRAINT_ARROWLEN (constraint->font_height)
#define CONSTRAINT_ARROWWIDTH (constraint->font_height*5./8.)
@@ -90,7 +88,7 @@ static ObjectTypeOps constraint_type_ops =
(CreateFunc) constraint_create,
(LoadFunc) constraint_load,/*using_properties*/ /* load */
(SaveFunc) object_save_using_properties, /* save */
- (GetDefaultsFunc) NULL,
+ (GetDefaultsFunc) NULL,
(ApplyDefaultsFunc) NULL
};
@@ -158,14 +156,14 @@ static PropOffset constraint_offsets[] = {
static void
constraint_get_props(Constraint * constraint, GPtrArray *props)
{
- object_get_props_from_offsets(&constraint->connection.object,
+ object_get_props_from_offsets(&constraint->connection.object,
constraint_offsets, props);
}
static void
constraint_set_props(Constraint *constraint, GPtrArray *props)
{
- object_set_props_from_offsets(&constraint->connection.object,
+ object_set_props_from_offsets(&constraint->connection.object,
constraint_offsets, props);
g_free(constraint->brtext);
constraint->brtext = NULL;
@@ -177,11 +175,11 @@ constraint_distance_from(Constraint *constraint, Point *point)
{
Point *endpoints;
real dist;
-
+
endpoints = &constraint->connection.endpoints[0];
-
- dist = distance_line_point(&endpoints[0], &endpoints[1],
- constraint->line_width, point);
+
+ dist = distance_line_point(&endpoints[0], &endpoints[1],
+ constraint->line_width, point);
return dist;
}
@@ -199,7 +197,7 @@ constraint_move_handle(Constraint *constraint, Handle *handle,
{
Point p1, p2;
Point *endpoints;
-
+
assert(constraint!=NULL);
assert(handle!=NULL);
assert(to!=NULL);
@@ -207,10 +205,10 @@ constraint_move_handle(Constraint *constraint, Handle *handle,
if (handle->id == HANDLE_MOVE_TEXT) {
constraint->text_pos = *to;
} else {
- endpoints = &constraint->connection.endpoints[0];
+ endpoints = &constraint->connection.endpoints[0];
p1.x = 0.5*(endpoints[0].x + endpoints[1].x);
p1.y = 0.5*(endpoints[0].y + endpoints[1].y);
- connection_move_handle(&constraint->connection, handle->id, to, cp,
+ connection_move_handle(&constraint->connection, handle->id, to, cp,
reason, modifiers);
connection_adjust_for_autogap(&constraint->connection);
p2.x = 0.5*(endpoints[0].x + endpoints[1].x);
@@ -228,12 +226,12 @@ static ObjectChange*
constraint_move(Constraint *constraint, Point *to)
{
Point start_to_end;
- Point *endpoints = &constraint->connection.endpoints[0];
+ Point *endpoints = &constraint->connection.endpoints[0];
Point delta;
delta = *to;
point_sub(&delta, &endpoints[0]);
-
+
start_to_end = endpoints[1];
point_sub(&start_to_end, &endpoints[0]);
@@ -241,7 +239,7 @@ constraint_move(Constraint *constraint, Point *to)
point_add(&endpoints[1], &start_to_end);
point_add(&constraint->text_pos, &delta);
-
+
constraint_update_data(constraint);
return NULL;
@@ -258,7 +256,7 @@ constraint_draw(Constraint *constraint, DiaRenderer *renderer)
assert(renderer != NULL);
endpoints = &constraint->connection.endpoints[0];
-
+
renderer_ops->set_linewidth(renderer, constraint->line_width);
renderer_ops->set_linestyle(renderer, LINESTYLE_DASHED, CONSTRAINT_DASHLEN);
renderer_ops->set_linecaps(renderer, LINECAPS_BUTT);
@@ -272,7 +270,7 @@ constraint_draw(Constraint *constraint, DiaRenderer *renderer)
constraint->line_width,
&constraint->line_color,
NULL, &arrow);
-
+
renderer_ops->set_font(renderer, constraint->font,
constraint->font_height);
renderer_ops->draw_string(renderer,
@@ -309,7 +307,7 @@ constraint_create(Point *startpoint,
obj->type = &constraint_type;
obj->ops = &constraint_ops;
-
+
connection_init(conn, 3, 0);
constraint->text_color = color_black;
@@ -323,7 +321,7 @@ constraint_create(Point *startpoint,
constraint->text_handle.connect_type = HANDLE_NONCONNECTABLE;
constraint->text_handle.connected_to = NULL;
obj->handles[2] = &constraint->text_handle;
-
+
constraint->brtext = NULL;
constraint_update_data(constraint);
@@ -358,17 +356,17 @@ constraint_update_data(Constraint *constraint)
} else if (!constraint->brtext) {
constraint->brtext = string_to_bracketted(constraint->text, "{", "}");
}
-
+
if (connpoint_is_autogap(conn->endpoint_handles[0].connected_to) ||
connpoint_is_autogap(conn->endpoint_handles[1].connected_to)) {
connection_adjust_for_autogap(conn);
}
obj->position = conn->endpoints[0];
- constraint->text_width = dia_font_string_width(constraint->brtext,
- constraint->font,
+ constraint->text_width = dia_font_string_width(constraint->brtext,
+ constraint->font,
constraint->font_height);
-
+
constraint->text_handle.pos = constraint->text_pos;
connection_update_handles(conn);
@@ -376,11 +374,11 @@ constraint_update_data(Constraint *constraint)
/* Boundingbox: */
extra = &conn->extra_spacing;
- extra->start_long =
- extra->start_trans =
+ extra->start_long =
+ extra->start_trans =
extra->end_long = constraint->line_width/2.0;
extra->end_trans = MAX(constraint->line_width,CONSTRAINT_ARROWLEN)/2.0;
-
+
connection_update_boundingbox(conn);
/* Add boundingbox for text: */
diff --git a/objects/UML/dependency.c b/objects/UML/dependency.c
index f5cdd892..91f23381 100644
--- a/objects/UML/dependency.c
+++ b/objects/UML/dependency.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -46,7 +44,7 @@ struct _Dependency {
Point text_pos;
Alignment text_align;
real text_width;
-
+
Color text_color;
Color line_color;
@@ -93,7 +91,7 @@ static ObjectTypeOps dependency_type_ops =
(CreateFunc) dependency_create,
(LoadFunc) dependency_load,/*using_properties*/ /* load */
(SaveFunc) object_save_using_properties, /* save */
- (GetDefaultsFunc) NULL,
+ (GetDefaultsFunc) NULL,
(ApplyDefaultsFunc) NULL
};
@@ -139,7 +137,7 @@ static PropDescription dependency_props[] = {
PROP_STD_TEXT_HEIGHT_OPTIONS(PROP_FLAG_VISIBLE|PROP_FLAG_STANDARD|PROP_FLAG_OPTIONAL),
PROP_STD_TEXT_COLOUR_OPTIONS(PROP_FLAG_VISIBLE|PROP_FLAG_STANDARD|PROP_FLAG_OPTIONAL),
PROP_STD_LINE_WIDTH_OPTIONAL,
- PROP_STD_LINE_COLOUR_OPTIONAL,
+ PROP_STD_LINE_COLOUR_OPTIONAL,
PROP_DESC_END
};
@@ -175,7 +173,7 @@ dependency_get_props(Dependency * dependency, GPtrArray *props)
static void
dependency_set_props(Dependency *dependency, GPtrArray *props)
{
- object_set_props_from_offsets(&dependency->orth.object,
+ object_set_props_from_offsets(&dependency->orth.object,
dependency_offsets, props);
g_free(dependency->st_stereotype);
dependency->st_stereotype = NULL;
@@ -205,7 +203,7 @@ dependency_move_handle(Dependency *dep, Handle *handle,
assert(dep!=NULL);
assert(handle!=NULL);
assert(to!=NULL);
-
+
change = orthconn_move_handle(&dep->orth, handle, to, cp, reason, modifiers);
dependency_update_data(dep);
@@ -235,7 +233,7 @@ dependency_draw(Dependency *dep, DiaRenderer *renderer)
points = &orth->points[0];
n = orth->numpoints;
-
+
renderer_ops->set_linewidth(renderer, dep->line_width);
renderer_ops->set_linestyle(renderer, LINESTYLE_DASHED, DEPENDENCY_DASHLEN);
renderer_ops->set_linejoin(renderer, LINEJOIN_MITER);
@@ -253,7 +251,7 @@ dependency_draw(Dependency *dep, DiaRenderer *renderer)
renderer_ops->set_font(renderer, dep->font, dep->font_height);
pos = dep->text_pos;
-
+
if (dep->st_stereotype != NULL && dep->st_stereotype[0] != '\0') {
renderer_ops->draw_string(renderer,
dep->st_stereotype,
@@ -262,14 +260,14 @@ dependency_draw(Dependency *dep, DiaRenderer *renderer)
pos.y += dep->font_height;
}
-
+
if (dep->name != NULL && dep->name[0] != '\0') {
renderer_ops->draw_string(renderer,
dep->name,
&pos, dep->text_align,
&dep->text_color);
}
-
+
}
static void
@@ -281,7 +279,7 @@ dependency_update_data(Dependency *dep)
int num_segm, i;
Point *points;
Rectangle rect;
-
+
orthconn_update_data(orth);
dep->stereotype = remove_stereotype_from_string(dep->stereotype);
@@ -297,23 +295,23 @@ dependency_update_data(Dependency *dep)
dep->text_width = MAX(dep->text_width,
dia_font_string_width(dep->stereotype, dep->font,
dep->font_height));
-
- extra->start_trans =
- extra->start_long =
+
+ extra->start_trans =
+ extra->start_long =
extra->middle_trans = dep->line_width/2.0;
-
- extra->end_trans =
+
+ extra->end_trans =
extra->end_long = (dep->draw_arrow?
(dep->line_width + DEPENDENCY_ARROWLEN)/2.0:
dep->line_width/2.0);
orthconn_update_boundingbox(orth);
-
+
/* Calc text pos: */
num_segm = dep->orth.numpoints - 1;
points = dep->orth.points;
i = num_segm / 2;
-
+
if ((num_segm % 2) == 0) { /* If no middle segment, use horizontal */
if (dep->orth.orientation[i]==VERTICAL)
i--;
@@ -411,7 +409,7 @@ dependency_create(Point *startpoint,
Dependency *dep;
OrthConn *orth;
DiaObject *obj;
-
+
dep = g_new0(Dependency, 1);
/* old defaults */
@@ -421,7 +419,7 @@ dependency_create(Point *startpoint,
orth = &dep->orth;
obj = (DiaObject *)dep;
-
+
obj->type = &dependency_type;
obj->ops = &dependency_ops;
@@ -437,7 +435,7 @@ dependency_create(Point *startpoint,
dep->text_width = 0;
dependency_update_data(dep);
-
+
*handle1 = orth->handles[0];
*handle2 = orth->handles[orth->numpoints-2];
diff --git a/objects/UML/fork.c b/objects/UML/fork.c
index 8669b339..4f5a1a56 100644
--- a/objects/UML/fork.c
+++ b/objects/UML/fork.c
@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -81,7 +79,7 @@ static ObjectTypeOps fork_type_ops =
(CreateFunc) fork_create,
(LoadFunc) fork_load,/*using_properties*/ /* load */
(SaveFunc) object_save_using_properties, /* save */
- (GetDefaultsFunc) NULL,
+ (GetDefaultsFunc) NULL,
(ApplyDefaultsFunc) NULL
};
@@ -114,7 +112,7 @@ static ObjectOps fork_ops =
static PropDescription fork_props[] = {
ELEMENT_COMMON_PROPERTIES,
- PROP_STD_FILL_COLOUR_OPTIONAL,
+ PROP_STD_FILL_COLOUR_OPTIONAL,
PROP_DESC_END
};
@@ -136,14 +134,14 @@ static PropOffset fork_offsets[] = {
static void
fork_get_props(Fork * branch, GPtrArray *props)
{
- object_get_props_from_offsets(&branch->element.object,
+ object_get_props_from_offsets(&branch->element.object,
fork_offsets, props);
}
static void
fork_set_props(Fork *branch, GPtrArray *props)
{
- object_set_props_from_offsets(&branch->element.object,
+ object_set_props_from_offsets(&branch->element.object,
fork_offsets, props);
fork_update_data(branch);
}
@@ -168,15 +166,15 @@ fork_move_handle(Fork *branch, Handle *handle,
{
coord dx;
Point c;
-
+
assert(branch!=NULL);
assert(handle!=NULL);
assert(to!=NULL);
assert(handle->id < 8);
-
+
/* Only orizontal E/W movement are allowed */
- if (handle->id==3 || handle->id==4) {
+ if (handle->id==3 || handle->id==4) {
c.y = to->y;
c.x = branch->element.corner.x + branch->element.width / 2.;
dx = fabs(to->x - c.x);
@@ -185,7 +183,7 @@ fork_move_handle(Fork *branch, Handle *handle,
to->x = c.x + dx;
element_move_handle(&branch->element, 4, to, cp, reason, modifiers);
fork_update_data(branch);
- }
+ }
return NULL;
}
@@ -206,7 +204,7 @@ fork_draw(Fork *branch, DiaRenderer *renderer)
Element *elem;
real w, h;
Point p1, p2;
-
+
assert(branch != NULL);
assert(renderer != NULL);
@@ -222,8 +220,8 @@ fork_draw(Fork *branch, DiaRenderer *renderer)
p1.y = elem->corner.y;
p2.x = elem->corner.x + w;
p2.y = elem->corner.y + h;
-
- renderer_ops->draw_rect(renderer,
+
+ renderer_ops->draw_rect(renderer,
&p1, &p2,
&branch->fill_color, NULL);
}
@@ -233,7 +231,7 @@ fork_update_data(Fork *branch)
{
Element *elem = &branch->element;
DiaObject *obj = &elem->object;
-
+
/* Update connections: */
branch->connections[0].pos.x = elem->corner.x + FORK_MARGIN*elem->width;
branch->connections[0].pos.y = elem->corner.y;
@@ -261,11 +259,11 @@ fork_create(Point *startpoint, void *user_data, Handle **handle1, Handle **handl
Element *elem;
DiaObject *obj;
int i;
-
+
branch = g_malloc0(sizeof(Fork));
elem = &branch->element;
obj = &elem->object;
-
+
obj->type = &fork_type;
obj->ops = &fork_ops;
@@ -288,12 +286,12 @@ fork_create(Point *startpoint, void *user_data, Handle **handle1, Handle **handl
}
elem->extra_spacing.border_trans = FORK_BORDERWIDTH / 2.0;
fork_update_data(branch);
-
+
for (i=0;i<8;i++) {
if (i!=3 && i!=4)
obj->handles[i]->type = HANDLE_NON_MOVABLE;
}
-
+
*handle1 = NULL;
*handle2 = obj->handles[0];
return &branch->element.object;
diff --git a/objects/UML/generalization.c b/objects/UML/generalization.c
index 21c762c6..f4bbd19e 100644
--- a/objects/UML/generalization.c
+++ b/objects/UML/generalization.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -45,7 +43,7 @@ struct _Generalization {
Point text_pos;
Alignment text_align;
real text_width;
-
+
DiaFont *font;
real font_height;
Color text_color;
@@ -90,7 +88,7 @@ static ObjectTypeOps generalization_type_ops =
(CreateFunc) generalization_create,
(LoadFunc) generalization_load,/*using_properties*/ /* load */
(SaveFunc) object_save_using_properties, /* save */
- (GetDefaultsFunc) NULL,
+ (GetDefaultsFunc) NULL,
(ApplyDefaultsFunc) NULL
};
@@ -134,7 +132,7 @@ static PropDescription generalization_props[] = {
PROP_STD_TEXT_HEIGHT_OPTIONS(PROP_FLAG_VISIBLE|PROP_FLAG_STANDARD|PROP_FLAG_OPTIONAL),
PROP_STD_TEXT_COLOUR_OPTIONS(PROP_FLAG_VISIBLE|PROP_FLAG_STANDARD|PROP_FLAG_OPTIONAL),
PROP_STD_LINE_WIDTH_OPTIONAL,
- PROP_STD_LINE_COLOUR_OPTIONAL,
+ PROP_STD_LINE_COLOUR_OPTIONAL,
PROP_DESC_END
};
@@ -169,7 +167,7 @@ generalization_get_props(Generalization * generalization, GPtrArray *props)
static void
generalization_set_props(Generalization *generalization, GPtrArray *props)
{
- object_set_props_from_offsets(&generalization->orth.object,
+ object_set_props_from_offsets(&generalization->orth.object,
generalization_offsets, props);
g_free(generalization->st_stereotype);
generalization->st_stereotype = NULL;
@@ -199,7 +197,7 @@ generalization_move_handle(Generalization *genlz, Handle *handle,
assert(genlz!=NULL);
assert(handle!=NULL);
assert(to!=NULL);
-
+
change = orthconn_move_handle(&genlz->orth, handle, to, cp, reason, modifiers);
generalization_update_data(genlz);
@@ -226,10 +224,10 @@ generalization_draw(Generalization *genlz, DiaRenderer *renderer)
int n;
Point pos;
Arrow arrow;
-
+
points = &orth->points[0];
n = orth->numpoints;
-
+
renderer_ops->set_linewidth(renderer, genlz->line_width);
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID, 0.0);
renderer_ops->set_linejoin(renderer, LINEJOIN_MITER);
@@ -247,7 +245,7 @@ generalization_draw(Generalization *genlz, DiaRenderer *renderer)
renderer_ops->set_font(renderer, genlz->font, genlz->font_height);
pos = genlz->text_pos;
-
+
if (genlz->st_stereotype != NULL && genlz->st_stereotype[0] != '\0') {
renderer_ops->draw_string(renderer,
genlz->st_stereotype,
@@ -256,14 +254,14 @@ generalization_draw(Generalization *genlz, DiaRenderer *renderer)
pos.y += genlz->font_height;
}
-
+
if (genlz->name != NULL && genlz->name[0] != '\0') {
renderer_ops->draw_string(renderer,
genlz->name,
&pos, genlz->text_align,
&genlz->text_color);
}
-
+
}
static void
@@ -277,9 +275,9 @@ generalization_update_data(Generalization *genlz)
PolyBBExtras *extra;
real descent;
real ascent;
-
+
orthconn_update_data(orth);
-
+
genlz->stereotype = remove_stereotype_from_string(genlz->stereotype);
if (!genlz->st_stereotype) {
genlz->st_stereotype = string_to_stereotype(genlz->stereotype);
@@ -288,8 +286,8 @@ generalization_update_data(Generalization *genlz)
genlz->text_width = 0.0;
descent = 0.0;
ascent = 0.0;
-
- if (genlz->name) {
+
+ if (genlz->name) {
genlz->text_width = dia_font_string_width(genlz->name, genlz->font,
genlz->font_height);
descent = dia_font_descent(genlz->name,
@@ -309,22 +307,22 @@ generalization_update_data(Generalization *genlz)
ascent = dia_font_ascent(genlz->stereotype,
genlz->font,genlz->font_height);
}
-
+
extra = &orth->extra_spacing;
-
+
extra->start_trans = genlz->line_width/2.0 + GENERALIZATION_TRIANGLESIZE;
- extra->start_long =
- extra->middle_trans =
- extra->end_trans =
+ extra->start_long =
+ extra->middle_trans =
+ extra->end_trans =
extra->end_long = genlz->line_width/2.0;
-
+
orthconn_update_boundingbox(orth);
/* Calc text pos: */
num_segm = genlz->orth.numpoints - 1;
points = genlz->orth.points;
i = num_segm / 2;
-
+
if ((num_segm % 2) == 0) { /* If no middle segment, use horizontal */
if (genlz->orth.orientation[i]==VERTICAL)
i--;
@@ -392,7 +390,7 @@ generalization_get_object_menu(Generalization *genlz, Point *clickedpoint)
OrthConn *orth;
orth = &genlz->orth;
-
+
/* Set entries sensitive/selected etc here */
object_menu_items[0].active = orthconn_can_add_segment(orth, clickedpoint);
object_menu_items[1].active = orthconn_can_delete_segment(orth, clickedpoint);
@@ -434,7 +432,7 @@ generalization_create(Point *startpoint,
genlz->st_stereotype = NULL;
generalization_update_data(genlz);
-
+
*handle1 = orth->handles[0];
*handle2 = orth->handles[orth->numpoints-2];
diff --git a/objects/UML/implements.c b/objects/UML/implements.c
index 4475f0e1..adb9f5cd 100644
--- a/objects/UML/implements.c
+++ b/objects/UML/implements.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -58,7 +56,7 @@ struct _Implements {
real text_width;
};
-
+
#define IMPLEMENTS_WIDTH 0.1
#define HANDLE_CIRCLE_SIZE (HANDLE_CUSTOM1)
@@ -91,7 +89,7 @@ static ObjectTypeOps implements_type_ops =
(CreateFunc) implements_create,
(LoadFunc) implements_load,/*using_properties*/ /* load */
(SaveFunc) object_save_using_properties, /* save */
- (GetDefaultsFunc) NULL,
+ (GetDefaultsFunc) NULL,
(ApplyDefaultsFunc) NULL
};
@@ -163,14 +161,14 @@ static PropOffset implements_offsets[] = {
static void
implements_get_props(Implements * implements, GPtrArray *props)
{
- object_get_props_from_offsets(&implements->connection.object,
+ object_get_props_from_offsets(&implements->connection.object,
implements_offsets, props);
}
static void
implements_set_props(Implements *implements, GPtrArray *props)
{
- object_set_props_from_offsets(&implements->connection.object,
+ object_set_props_from_offsets(&implements->connection.object,
implements_offsets, props);
implements_update_data(implements);
}
@@ -180,7 +178,7 @@ implements_distance_from(Implements *implements, Point *point)
{
Point *endpoints;
real dist1, dist2;
-
+
endpoints = &implements->connection.endpoints[0];
dist1 = distance_line_point( &endpoints[0], &endpoints[1],
implements->line_width, point);
@@ -188,7 +186,7 @@ implements_distance_from(Implements *implements, Point *point)
- implements->circle_diameter/2.0;
if (dist2<0)
dist2 = 0;
-
+
return MIN(dist1, dist2);
}
@@ -205,7 +203,7 @@ implements_move_handle(Implements *implements, Handle *handle,
HandleMoveReason reason, ModifierKeys modifiers)
{
Point v1, v2;
-
+
assert(implements!=NULL);
assert(handle!=NULL);
assert(to!=NULL);
@@ -223,7 +221,7 @@ implements_move_handle(Implements *implements, Handle *handle,
implements->circle_diameter = 0.03;
} else {
v1 = implements->connection.endpoints[1];
- connection_move_handle(&implements->connection, handle->id, to, cp,
+ connection_move_handle(&implements->connection, handle->id, to, cp,
reason, modifiers);
connection_adjust_for_autogap(&implements->connection);
point_sub(&v1, &implements->connection.endpoints[1]);
@@ -240,11 +238,11 @@ implements_move(Implements *implements, Point *to)
{
Point start_to_end;
Point delta;
- Point *endpoints = &implements->connection.endpoints[0];
+ Point *endpoints = &implements->connection.endpoints[0];
delta = *to;
point_sub(&delta, &endpoints[0]);
-
+
start_to_end = endpoints[1];
point_sub(&start_to_end, &endpoints[0]);
@@ -252,7 +250,7 @@ implements_move(Implements *implements, Point *to)
point_add(&endpoints[1], &start_to_end);
point_add(&implements->text_pos, &delta);
-
+
implements_update_data(implements);
return NULL;
@@ -263,12 +261,12 @@ implements_draw(Implements *implements, DiaRenderer *renderer)
{
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
Point *endpoints;
-
+
assert(implements != NULL);
assert(renderer != NULL);
endpoints = &implements->connection.endpoints[0];
-
+
renderer_ops->set_linewidth(renderer, implements->line_width);
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID, 0.0);
renderer_ops->set_linecaps(renderer, LINECAPS_BUTT);
@@ -313,12 +311,12 @@ implements_create(Point *startpoint,
conn->endpoints[0] = *startpoint;
conn->endpoints[1] = *startpoint;
point_add(&conn->endpoints[1], &defaultlen);
-
+
obj = &conn->object;
obj->type = &implements_type;
obj->ops = &implements_ops;
-
+
connection_init(conn, 4, 0);
implements->line_color = attributes_get_foreground();
@@ -334,7 +332,7 @@ implements_create(Point *startpoint,
implements->text_handle.connect_type = HANDLE_NONCONNECTABLE;
implements->text_handle.connected_to = NULL;
obj->handles[2] = &implements->text_handle;
-
+
implements->circle_handle.id = HANDLE_CIRCLE_SIZE;
implements->circle_handle.type = HANDLE_MINOR_CONTROL;
implements->circle_handle.connect_type = HANDLE_NONCONNECTABLE;
@@ -401,11 +399,11 @@ implements_update_data(Implements *implements)
connection_update_handles(conn);
/* Boundingbox: */
- extra->start_long =
- extra->start_trans =
+ extra->start_long =
+ extra->start_trans =
extra->end_long = implements->line_width/2.0;
extra->end_trans = (implements->line_width + implements->circle_diameter)/2.0;
-
+
connection_update_boundingbox(conn);
/* Add boundingbox for text: */
diff --git a/objects/UML/large_package.c b/objects/UML/large_package.c
index c7206b0d..8269ca00 100644
--- a/objects/UML/large_package.c
+++ b/objects/UML/large_package.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -48,7 +46,7 @@ struct _LargePackage {
char *name;
char *stereotype; /* Can be NULL, including << and >> */
- char *st_stereotype;
+ char *st_stereotype;
DiaFont *font;
@@ -95,7 +93,7 @@ static ObjectTypeOps largepackage_type_ops =
(CreateFunc) largepackage_create,
(LoadFunc) largepackage_load,/*using_properties*/ /* load */
(SaveFunc) object_save_using_properties, /* save */
- (GetDefaultsFunc) NULL,
+ (GetDefaultsFunc) NULL,
(ApplyDefaultsFunc) NULL
};
@@ -141,8 +139,8 @@ static PropDescription largepackage_props[] = {
PROP_STD_TEXT_HEIGHT_OPTIONS(PROP_FLAG_VISIBLE|PROP_FLAG_STANDARD|PROP_FLAG_OPTIONAL),
PROP_STD_TEXT_COLOUR_OPTIONS(PROP_FLAG_VISIBLE|PROP_FLAG_STANDARD|PROP_FLAG_OPTIONAL),
PROP_STD_LINE_WIDTH_OPTIONAL,
- PROP_STD_LINE_COLOUR_OPTIONAL,
- PROP_STD_FILL_COLOUR_OPTIONAL,
+ PROP_STD_LINE_COLOUR_OPTIONAL,
+ PROP_STD_FILL_COLOUR_OPTIONAL,
PROP_DESC_END
};
@@ -172,14 +170,14 @@ static PropOffset largepackage_offsets[] = {
static void
largepackage_get_props(LargePackage * largepackage, GPtrArray *props)
{
- object_get_props_from_offsets(&largepackage->element.object,
+ object_get_props_from_offsets(&largepackage->element.object,
largepackage_offsets, props);
}
static void
largepackage_set_props(LargePackage *largepackage, GPtrArray *props)
{
- object_set_props_from_offsets(&largepackage->element.object,
+ object_set_props_from_offsets(&largepackage->element.object,
largepackage_offsets, props);
g_free(largepackage->st_stereotype);
largepackage->st_stereotype = NULL;
@@ -221,7 +219,7 @@ largepackage_move_handle(LargePackage *pkg, Handle *handle,
assert(to!=NULL);
assert(handle->id < 8);
-
+
element_move_handle(&pkg->element, handle->id, to, cp, reason, modifiers);
largepackage_update_data(pkg);
@@ -245,7 +243,7 @@ largepackage_draw(LargePackage *pkg, DiaRenderer *renderer)
Element *elem;
real x, y, w, h;
Point p1, p2;
-
+
assert(pkg != NULL);
assert(renderer != NULL);
@@ -255,7 +253,7 @@ largepackage_draw(LargePackage *pkg, DiaRenderer *renderer)
y = elem->corner.y;
w = elem->width;
h = elem->height;
-
+
renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID);
renderer_ops->set_linewidth(renderer, pkg->line_width);
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID, 0.0);
@@ -263,14 +261,14 @@ largepackage_draw(LargePackage *pkg, DiaRenderer *renderer)
p1.x = x; p1.y = y;
p2.x = x+w; p2.y = y+h;
- renderer_ops->draw_rect (renderer,
+ renderer_ops->draw_rect (renderer,
&p1, &p2,
&pkg->fill_color,
&pkg->line_color);
p1.x= x; p1.y = y - pkg->topheight;
p2.x = x + pkg->topwidth; p2.y = y;
- renderer_ops->draw_rect (renderer,
+ renderer_ops->draw_rect (renderer,
&p1, &p2,
&pkg->fill_color,
&pkg->line_color);
@@ -305,7 +303,7 @@ largepackage_update_data(LargePackage *pkg)
if (!pkg->st_stereotype) {
pkg->st_stereotype = string_to_stereotype(pkg->stereotype);
}
-
+
pkg->topheight = pkg->font_height + 0.1*2;
pkg->topwidth = 2.0;
@@ -324,7 +322,7 @@ largepackage_update_data(LargePackage *pkg)
elem->width = pkg->topwidth + 0.2;
if (elem->height < 1.0)
elem->height = 1.0;
-
+
/* Update connections: */
element_update_connections_rectangle(elem, pkg->connections);
@@ -347,11 +345,11 @@ largepackage_create(Point *startpoint,
Element *elem;
DiaObject *obj;
int i;
-
+
pkg = g_malloc0(sizeof(LargePackage));
elem = &pkg->element;
obj = &elem->object;
-
+
obj->type = &largepackage_type;
obj->ops = &largepackage_ops;
@@ -362,7 +360,7 @@ largepackage_create(Point *startpoint,
elem->width = 4.0;
elem->height = 4.0;
-
+
pkg->line_width = attributes_get_default_linewidth();
pkg->text_color = color_black;
pkg->line_color = attributes_get_foreground();
@@ -400,7 +398,7 @@ largepackage_destroy(LargePackage *pkg)
g_free(pkg->stereotype);
g_free(pkg->st_stereotype);
g_free(pkg->name);
-
+
element_destroy(&pkg->element);
}
diff --git a/objects/UML/lifeline.c b/objects/UML/lifeline.c
index c110a2bb..357f5bc0 100644
--- a/objects/UML/lifeline.c
+++ b/objects/UML/lifeline.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -40,11 +38,11 @@ typedef struct _Lifeline Lifeline;
#define LIFELINE_NUM_HANDLES 5
#define LIFELINE_NUM_STD_CPS 7
-
+
struct _Lifeline {
- Connection connection;
+ Connection connection;
- ConnectionPoint connections[LIFELINE_NUM_STD_CPS]; /* 7°th cp position is at rbot handle location
+ ConnectionPoint connections[LIFELINE_NUM_STD_CPS]; /* 7°th cp position is at rbot handle location
(this is useful to attach another lifeline
just below this one in case of an object
activated more than once in a sequence diagram.)*/
@@ -55,19 +53,19 @@ struct _Lifeline {
/* these are _relative_ to endpoints[0] */
real rtop, rbot;
real cp_distance;
-
+
int draw_focuscontrol;
int draw_cross;
-
+
Color line_color;
Color fill_color;
ConnPointLine *northwest,*southwest,*northeast,*southeast;
- /* we're (almost) obliged to do this stupid gymnastic with twin
- connpoint_lines, because we really do want to reload older objects
- (those created before we had the CPLs) without funny side effects. And
- we don't want to have two connection points (one static, one dynamic) in
+ /* we're (almost) obliged to do this stupid gymnastic with twin
+ connpoint_lines, because we really do want to reload older objects
+ (those created before we had the CPLs) without funny side effects. And
+ we don't want to have two connection points (one static, one dynamic) in
the same place either.
*/
};
@@ -89,7 +87,7 @@ struct _Lifeline {
static ObjectChange* lifeline_move_handle(Lifeline *lifeline, Handle *handle,
Point *to, ConnectionPoint *cp,
- HandleMoveReason reason,
+ HandleMoveReason reason,
ModifierKeys modifiers);
static ObjectChange* lifeline_move(Lifeline *lifeline, Point *to);
static void lifeline_select(Lifeline *lifeline, Point *clicked_point,
@@ -156,7 +154,7 @@ static ObjectOps lifeline_ops = {
static PropDescription lifeline_props[] = {
CONNECTION_COMMON_PROPERTIES,
- PROP_STD_LINE_COLOUR_OPTIONAL,
+ PROP_STD_LINE_COLOUR_OPTIONAL,
PROP_STD_FILL_COLOUR_OPTIONAL,
{ "rtop", PROP_TYPE_REAL, PROP_FLAG_NO_DEFAULTS, NULL,NULL,NULL},
{ "rbot", PROP_TYPE_REAL, PROP_FLAG_NO_DEFAULTS, NULL,NULL,NULL},
@@ -197,14 +195,14 @@ static PropOffset lifeline_offsets[] = {
static void
lifeline_get_props(Lifeline * lifeline, GPtrArray *props)
{
- object_get_props_from_offsets(&lifeline->connection.object,
+ object_get_props_from_offsets(&lifeline->connection.object,
lifeline_offsets, props);
}
static void
lifeline_set_props(Lifeline *lifeline, GPtrArray *props)
{
- object_set_props_from_offsets(&lifeline->connection.object,
+ object_set_props_from_offsets(&lifeline->connection.object,
lifeline_offsets, props);
/* This magic is necessary to correctly load data
@@ -213,7 +211,7 @@ lifeline_set_props(Lifeline *lifeline, GPtrArray *props)
num of cp.
( It's just the inverse of lifeline_rect_size :)
*/
- lifeline->cp_distance = (lifeline->rbot - lifeline->rtop)
+ lifeline->cp_distance = (lifeline->rbot - lifeline->rtop)
/ (lifeline->northwest->num_connections + 1 +
lifeline->southwest->num_connections + 1);
lifeline_update_data(lifeline);
@@ -224,12 +222,12 @@ lifeline_distance_from(Lifeline *lifeline, Point *point)
{
Point *endpoints;
real dist1, dist2;
-
+
endpoints = &lifeline->connection.endpoints[0];
dist1 = distance_line_point( &endpoints[0], &endpoints[1],
LIFELINE_WIDTH, point);
dist2 = dist1;
-
+
return MIN(dist1, dist2);
}
@@ -260,7 +258,7 @@ lifeline_point_above_mid (Lifeline *lifeline,
* - the top handle is usually connected to an object, when moved connected
* the whole lifeline is moved horizontally (but may not any longer vertically).
* - the top box handle is used to move the whole box vertically.
- * - the bottom box handle should maybe resize the box without changing the
+ * - the bottom box handle should maybe resize the box without changing the
* connection point distance, i.e. adding/removing some (maybe limited
* by connected points)
* - the bottom handle just move itself, not beyond the lower box handle
@@ -284,13 +282,13 @@ lifeline_move_handle(Lifeline *lifeline, Handle *handle,
if (dy > lifeline_rect_size(lifeline)) {
real dist = dy - lifeline->rbot;
real di;
-
+
modf (dist, &di);
/* the integer part gives the number of points to add or remove */
if (fabs (di) > 0) {
int ni = (int)di;
- if (lifeline_point_above_mid (lifeline, to) ?
+ if (lifeline_point_above_mid (lifeline, to) ?
lifeline->northeast->num_connections + ni > 0 :
lifeline->southeast->num_connections + ni > 0)
return lifeline_create_change (lifeline, ni > 0 ? LIFELINE_CHANGE_ADD : LIFELINE_CHANGE_DEL, to);
@@ -310,7 +308,7 @@ lifeline_move_handle(Lifeline *lifeline, Handle *handle,
/* Distance between upper handle and boxtop must not be smaller than zero,
* Same for boxbot and lower handle */
dy = to->y - conn->endpoints[0].y;
- if (dy > 0 &&
+ if (dy > 0 &&
dy + lifeline_rect_size(lifeline) < conn->endpoints[1].y) {
lifeline->rtop = dy;
}
@@ -322,11 +320,11 @@ lifeline_move_handle(Lifeline *lifeline, Handle *handle,
to->x = conn->endpoints[0].x;
}
/* If connected don't change size */
- dy = (reason==HANDLE_MOVE_CONNECTED) ?
+ dy = (reason==HANDLE_MOVE_CONNECTED) ?
conn->endpoints[1].y - conn->endpoints[0].y : lifeline->rbot;
connection_move_handle(conn, handle->id, to, cp, reason, modifiers);
s = conn->endpoints[1].y - conn->endpoints[0].y;
- if (handle->id==HANDLE_MOVE_ENDPOINT && s < dy &&
+ if (handle->id==HANDLE_MOVE_ENDPOINT && s < dy &&
s > lifeline->rtop + LIFELINE_BOXMINHEIGHT)
lifeline->rbot = s;
else if (reason==HANDLE_MOVE_CONNECTED || s < dy)
@@ -343,17 +341,17 @@ lifeline_move(Lifeline *lifeline, Point *to)
{
Point start_to_end;
Point delta;
- Point *endpoints = &lifeline->connection.endpoints[0];
+ Point *endpoints = &lifeline->connection.endpoints[0];
delta = *to;
point_sub(&delta, &endpoints[0]);
-
+
start_to_end = endpoints[1];
point_sub(&start_to_end, &endpoints[0]);
endpoints[1] = endpoints[0] = *to;
point_add(&endpoints[1], &start_to_end);
-
+
lifeline_update_data(lifeline);
return NULL;
@@ -364,13 +362,13 @@ lifeline_draw(Lifeline *lifeline, DiaRenderer *renderer)
{
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
Point *endpoints, p1, p2;
-
+
assert(lifeline != NULL);
assert(renderer != NULL);
endpoints = &lifeline->connection.endpoints[0];
-
- renderer_ops->set_linewidth(renderer, LIFELINE_LINEWIDTH);
+
+ renderer_ops->set_linewidth(renderer, LIFELINE_LINEWIDTH);
renderer_ops->set_linestyle(renderer, LINESTYLE_DASHED, LIFELINE_DASHLEN);
/* Ok, instead rendering one big line between two endpoints we just
@@ -398,13 +396,13 @@ lifeline_draw(Lifeline *lifeline, DiaRenderer *renderer)
p2.y = endpoints[0].y + lifeline->rbot;
if (lifeline->draw_focuscontrol) {
- renderer_ops->draw_rect(renderer,
+ renderer_ops->draw_rect(renderer,
&p1, &p2,
&lifeline->fill_color,
&lifeline->line_color);
}
-
- if (lifeline->draw_cross) {
+
+ if (lifeline->draw_cross) {
renderer_ops->set_linewidth(renderer, LIFELINE_CROSSWIDTH);
p1.x = endpoints[1].x + LIFELINE_CROSSLEN;
p2.x = endpoints[1].x - LIFELINE_CROSSLEN;
@@ -418,7 +416,7 @@ lifeline_draw(Lifeline *lifeline, DiaRenderer *renderer)
renderer_ops->draw_line(renderer,
&p1, &p2,
&lifeline->line_color);
-
+
}
}
@@ -426,7 +424,7 @@ lifeline_draw(Lifeline *lifeline, DiaRenderer *renderer)
/* DiaObject menu handling */
typedef struct {
ObjectChange obj_change;
-
+
ObjectChange *east, *west;
real cp_distance_change;
LifelineChangeType type;
@@ -441,7 +439,7 @@ lifeline_change_apply(LifelineChange *change, DiaObject *obj)
} else {
((Lifeline*)obj)->cp_distance += change->cp_distance_change;
}
-
+
}
static void
@@ -456,31 +454,31 @@ lifeline_change_revert(LifelineChange *change, DiaObject *obj)
}
static void
-lifeline_change_free(LifelineChange *change)
+lifeline_change_free(LifelineChange *change)
{
if( change->type == LIFELINE_CHANGE_ADD || change->type == LIFELINE_CHANGE_DEL ) {
if (change->east->free)
change->east->free(change->east);
g_free(change->east);
- if (change->west->free)
+ if (change->west->free)
change->west->free(change->west);
g_free(change->west);
}
}
static ObjectChange *
-lifeline_create_change(Lifeline *lifeline, LifelineChangeType changetype, Point *clicked)
+lifeline_create_change(Lifeline *lifeline, LifelineChangeType changetype, Point *clicked)
{
LifelineChange *vc;
-
+
vc = g_new0(LifelineChange,1);
vc->obj_change.apply = (ObjectChangeApplyFunc)lifeline_change_apply;
vc->obj_change.revert = (ObjectChangeRevertFunc)lifeline_change_revert;
vc->obj_change.free = (ObjectChangeFreeFunc)lifeline_change_free;
vc->type = changetype;
-
- switch( vc->type )
+
+ switch( vc->type )
{
case LIFELINE_CHANGE_ADD:
if (lifeline_point_above_mid (lifeline, clicked)) {
@@ -543,9 +541,9 @@ static DiaMenu *
lifeline_get_object_menu(Lifeline *lifeline, Point *clickedpoint)
{
/* Set entries sensitive/selected etc here */
- g_assert( (lifeline->northwest->num_connections ==
- lifeline->northeast->num_connections) ||
- (lifeline->southwest->num_connections ==
+ g_assert( (lifeline->northwest->num_connections ==
+ lifeline->northeast->num_connections) ||
+ (lifeline->southwest->num_connections ==
lifeline->southeast->num_connections) );
object_menu_items[0].active = 1;
@@ -577,9 +575,9 @@ lifeline_create(Point *startpoint,
conn->endpoints[0].x += LIFELINE_WIDTH/2;
conn->endpoints[1] = conn->endpoints[0];
conn->endpoints[1].y = conn->endpoints[0].y + 6.0*lifeline->cp_distance;
-
+
obj = &conn->object;
-
+
obj->type = &lifeline_type;
obj->ops = &lifeline_ops;
@@ -592,13 +590,13 @@ lifeline_create(Point *startpoint,
lifeline->rtop = lifeline->cp_distance;
lifeline->draw_focuscontrol = 1;
lifeline->draw_cross = 0;
-
+
lifeline->boxbot_handle.id = HANDLE_BOXBOT;
lifeline->boxbot_handle.type = HANDLE_MINOR_CONTROL;
lifeline->boxbot_handle.connect_type = HANDLE_NONCONNECTABLE;
lifeline->boxbot_handle.connected_to = NULL;
obj->handles[2] = &lifeline->boxbot_handle;
-
+
lifeline->boxtop_handle.id = HANDLE_BOXTOP;
lifeline->boxtop_handle.type = HANDLE_MINOR_CONTROL;
lifeline->boxtop_handle.connect_type = HANDLE_NONCONNECTABLE;
@@ -658,7 +656,7 @@ lifeline_update_data(Lifeline *lifeline)
/* Update lifeline rbot using num. of cp and cp_distance */
lifeline->rbot = lifeline->rtop + lifeline_rect_size( lifeline ) ;
- /* Update conn->endpoints[0].y if rbot is greater */
+ /* Update conn->endpoints[0].y if rbot is greater */
if( conn->endpoints[1].y < conn->endpoints[0].y + lifeline->rbot )
conn->endpoints[1].y = conn->endpoints[0].y + lifeline->rbot + lifeline->cp_distance;
@@ -678,7 +676,7 @@ lifeline_update_data(Lifeline *lifeline)
/* Boundingbox: */
extra->start_trans =
- extra->start_long =
+ extra->start_long =
extra->end_long =
extra->end_trans = LIFELINE_LINEWIDTH/2.0;
if (lifeline->draw_focuscontrol) {
@@ -691,9 +689,9 @@ lifeline_update_data(Lifeline *lifeline)
}
connection_update_boundingbox(conn);
- if (lifeline->draw_focuscontrol) {
+ if (lifeline->draw_focuscontrol) {
p1.x -= LIFELINE_WIDTH/2.0;
- p2.x += LIFELINE_WIDTH/2.0;
+ p2.x += LIFELINE_WIDTH/2.0;
}
/* Update connections: */
pnw.x = p1.x; pnw.y = p1.y;
@@ -702,7 +700,7 @@ lifeline_update_data(Lifeline *lifeline)
pse.x = p2.x; pse.y = p2.y;
pmw.x = pnw.x;
pme.x = pne.x;
-
+
pmw.y = pme.y = (p1.y + lifeline->cp_distance * (lifeline->northwest->num_connections+1));
lifeline->connections[6].pos.x = conn->endpoints[0].x;
diff --git a/objects/UML/message.c b/objects/UML/message.c
index 1e2f9a75..2e29ad80 100644
--- a/objects/UML/message.c
+++ b/objects/UML/message.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -60,7 +58,7 @@ struct _Message {
gchar *text;
Point text_pos;
real text_width;
-
+
Color text_color;
Color line_color;
@@ -102,7 +100,7 @@ static ObjectTypeOps message_type_ops =
(CreateFunc) message_create,
(LoadFunc) message_load,/*using_properties*/ /* load */
(SaveFunc) object_save_using_properties, /* save */
- (GetDefaultsFunc) NULL,
+ (GetDefaultsFunc) NULL,
(ApplyDefaultsFunc) NULL
};
@@ -155,10 +153,10 @@ static PropDescription message_props[] = {
PROP_STD_TEXT_FONT_OPTIONS(PROP_FLAG_VISIBLE|PROP_FLAG_STANDARD|PROP_FLAG_OPTIONAL),
PROP_STD_TEXT_HEIGHT_OPTIONS(PROP_FLAG_VISIBLE|PROP_FLAG_STANDARD|PROP_FLAG_OPTIONAL),
PROP_STD_TEXT_COLOUR_OPTIONS(PROP_FLAG_VISIBLE|PROP_FLAG_STANDARD|PROP_FLAG_OPTIONAL),
- { "text_pos", PROP_TYPE_POINT, 0,
+ { "text_pos", PROP_TYPE_POINT, 0,
"text_pos:", NULL,NULL },
PROP_STD_LINE_WIDTH_OPTIONAL,
- PROP_STD_LINE_COLOUR_OPTIONAL,
+ PROP_STD_LINE_COLOUR_OPTIONAL,
PROP_DESC_END
};
@@ -181,7 +179,7 @@ static PropOffset message_offsets[] = {
{ "text_font", PROP_TYPE_FONT, offsetof(Message, font) },
{ PROP_STDNAME_TEXT_HEIGHT, PROP_STDTYPE_TEXT_HEIGHT, offsetof(Message, font_height) },
{ "text_colour",PROP_TYPE_COLOUR,offsetof(Message,text_color) },
- { "text_pos", PROP_TYPE_POINT, offsetof(Message,text_pos) },
+ { "text_pos", PROP_TYPE_POINT, offsetof(Message,text_pos) },
{ PROP_STDNAME_LINE_WIDTH,PROP_TYPE_LENGTH,offsetof(Message, line_width) },
{ "line_colour",PROP_TYPE_COLOUR,offsetof(Message,line_color) },
{ NULL, 0, 0 }
@@ -190,14 +188,14 @@ static PropOffset message_offsets[] = {
static void
message_get_props(Message * message, GPtrArray *props)
{
- object_get_props_from_offsets(&message->connection.object,
+ object_get_props_from_offsets(&message->connection.object,
message_offsets, props);
}
static void
message_set_props(Message *message, GPtrArray *props)
{
- object_set_props_from_offsets(&message->connection.object,
+ object_set_props_from_offsets(&message->connection.object,
message_offsets, props);
message_update_data(message);
}
@@ -208,11 +206,11 @@ message_distance_from(Message *message, Point *point)
{
Point *endpoints;
real dist;
-
+
endpoints = &message->connection.endpoints[0];
-
+
dist = distance_line_point(&endpoints[0], &endpoints[1], message->line_width, point);
-
+
return dist;
}
@@ -230,7 +228,7 @@ message_move_handle(Message *message, Handle *handle,
{
Point p1, p2;
Point *endpoints;
-
+
assert(message!=NULL);
assert(handle!=NULL);
assert(to!=NULL);
@@ -238,7 +236,7 @@ message_move_handle(Message *message, Handle *handle,
if (handle->id == HANDLE_MOVE_TEXT) {
message->text_pos = *to;
} else {
- endpoints = &message->connection.endpoints[0];
+ endpoints = &message->connection.endpoints[0];
p1.x = 0.5*(endpoints[0].x + endpoints[1].x);
p1.y = 0.5*(endpoints[0].y + endpoints[1].y);
connection_move_handle(&message->connection, handle->id, to, cp, reason, modifiers);
@@ -258,12 +256,12 @@ static ObjectChange*
message_move(Message *message, Point *to)
{
Point start_to_end;
- Point *endpoints = &message->connection.endpoints[0];
+ Point *endpoints = &message->connection.endpoints[0];
Point delta;
delta = *to;
point_sub(&delta, &endpoints[0]);
-
+
start_to_end = endpoints[1];
point_sub(&start_to_end, &endpoints[0]);
@@ -271,7 +269,7 @@ message_move(Message *message, Point *to)
point_add(&endpoints[1], &start_to_end);
point_add(&message->text_pos, &delta);
-
+
message_update_data(message);
return NULL;
@@ -289,17 +287,17 @@ message_draw(Message *message, DiaRenderer *renderer)
assert(message != NULL);
assert(renderer != NULL);
- if (message->type==MESSAGE_SEND)
+ if (message->type==MESSAGE_SEND)
arrow.type = ARROW_HALF_HEAD;
- else if (message->type==MESSAGE_SIMPLE)
+ else if (message->type==MESSAGE_SIMPLE)
arrow.type = ARROW_LINES;
- else
+ else
arrow.type = ARROW_FILLED_TRIANGLE;
arrow.length = MESSAGE_ARROWLEN;
arrow.width = MESSAGE_ARROWWIDTH;
endpoints = &message->connection.endpoints[0];
-
+
renderer_ops->set_linewidth(renderer, message->line_width);
renderer_ops->set_linecaps(renderer, LINECAPS_BUTT);
@@ -330,13 +328,13 @@ message_draw(Message *message, DiaRenderer *renderer)
&px, &p2,
&message->line_color);
p1.y = p2.y;
- }
+ }
renderer_ops->draw_line_with_arrows(renderer,
&p1, &p2,
message->line_width,
&message->line_color,
- &arrow, NULL);
+ &arrow, NULL);
renderer_ops->set_font(renderer, message->font,
message->font_height);
@@ -348,7 +346,7 @@ message_draw(Message *message, DiaRenderer *renderer)
else
mname = message->text;
- if (mname && strlen(mname) != 0)
+ if (mname && strlen(mname) != 0)
renderer_ops->draw_string(renderer,
mname, /*message->text,*/
&message->text_pos, ALIGN_CENTER,
@@ -357,7 +355,7 @@ message_draw(Message *message, DiaRenderer *renderer)
{
g_free(mname);
}
-
+
}
@@ -384,13 +382,13 @@ message_create(Point *startpoint,
conn->endpoints[0] = *startpoint;
conn->endpoints[1] = *startpoint;
conn->endpoints[1].x += 1.5;
-
+
obj = &conn->object;
extra = &conn->extra_spacing;
obj->type = &message_type;
obj->ops = &message_ops;
-
+
connection_init(conn, 3, 0);
message->text_color = color_black;
@@ -405,12 +403,12 @@ message_create(Point *startpoint,
message->text_handle.connect_type = HANDLE_NONCONNECTABLE;
message->text_handle.connected_to = NULL;
obj->handles[2] = &message->text_handle;
-
- extra->start_long =
- extra->start_trans =
+
+ extra->start_long =
+ extra->start_trans =
extra->end_long = message->line_width/2.0;
extra->end_trans = MAX(message->line_width,MESSAGE_ARROWLEN)/2.0;
-
+
message_update_data(message);
*handle1 = obj->handles[0];
@@ -432,7 +430,7 @@ message_update_data(Message *message)
Connection *conn = &message->connection;
DiaObject *obj = &conn->object;
Rectangle rect;
-
+
if (connpoint_is_autogap(conn->endpoint_handles[0].connected_to) ||
connpoint_is_autogap(conn->endpoint_handles[1].connected_to)) {
connection_adjust_for_autogap(conn);
diff --git a/objects/UML/node.c b/objects/UML/node.c
index 10a0c11a..7af92729 100644
--- a/objects/UML/node.c
+++ b/objects/UML/node.c
@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -51,7 +49,7 @@ struct _Node
Color line_color;
Color fill_color;
-
+
real line_width;
};
@@ -87,7 +85,7 @@ static ObjectTypeOps node_type_ops =
(CreateFunc) node_create,
(LoadFunc) node_load,/*using_properties*/ /* load */
(SaveFunc) object_save_using_properties, /* save */
- (GetDefaultsFunc) NULL,
+ (GetDefaultsFunc) NULL,
(ApplyDefaultsFunc) NULL
};
@@ -124,7 +122,7 @@ static PropDescription node_props[] = {
PROP_STD_TEXT_HEIGHT,
PROP_STD_TEXT_COLOUR_OPTIONAL,
/* how it used to be before 0.96+SVN */
- { "name", PROP_TYPE_TEXT, PROP_FLAG_OPTIONAL, N_("Text"), NULL, NULL },
+ { "name", PROP_TYPE_TEXT, PROP_FLAG_OPTIONAL, N_("Text"), NULL, NULL },
/* new name matching "same name, same type" rule */
{ "text", PROP_TYPE_TEXT, PROP_FLAG_NO_DEFAULTS|PROP_FLAG_LOAD_ONLY|PROP_FLAG_OPTIONAL, N_("Text"), NULL,
NULL },
PROP_STD_LINE_WIDTH_OPTIONAL,
@@ -201,7 +199,7 @@ node_move_handle(Node *node, Handle *handle,
assert(to!=NULL);
assert(handle->id < 8);
-
+
element_move_handle(&node->element, handle->id, to, cp, reason, modifiers);
node_update_data(node);
@@ -212,7 +210,7 @@ static ObjectChange*
node_move(Node *node, Point *to)
{
Point p;
-
+
node->element.corner = *to;
p = *to;
@@ -232,7 +230,7 @@ static void node_draw(Node *node, DiaRenderer *renderer)
real x, y, w, h;
Point points[7];
int i;
-
+
assert(node != NULL);
assert(renderer != NULL);
@@ -242,7 +240,7 @@ static void node_draw(Node *node, DiaRenderer *renderer)
y = elem->corner.y;
w = elem->width;
h = elem->height;
-
+
renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID);
renderer_ops->set_linewidth(renderer, node->line_width);
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID, 0.0);
@@ -273,20 +271,20 @@ static void node_draw(Node *node, DiaRenderer *renderer)
/* Draw text */
text_draw(node->name, renderer);
-
+
/* Draw underlines (!) */
renderer_ops->set_linewidth(renderer, NODE_LINEWIDTH);
points[0].x = node->name->position.x;
points[0].y = points[1].y = node->name->position.y + node->name->descent;
for (i = 0; i < node->name->numlines; i++)
- {
+ {
points[1].x = points[0].x + text_get_line_width(node->name, i);
renderer_ops->draw_line(renderer, points, points + 1, &node->name->color);
points[0].y = points[1].y += node->name->height;
}
}
-static void
+static void
node_update_data(Node *node)
{
Element *elem = &node->element;
@@ -304,10 +302,10 @@ node_update_data(Node *node)
elem->width = MAX(elem->width, node->name->max_width + 2*NODE_TEXT_MARGIN);
elem->height = MAX(elem->height, node->name->height * node->name->numlines + 2*NODE_TEXT_MARGIN);
-
+
/* Update connections: */
element_update_connections_rectangle(elem, node->connections);
-
+
element_update_boundingbox(elem);
/* fix boundingbox for depth: */
obj->bounding_box.top -= NODE_DEPTH;
@@ -326,15 +324,15 @@ static DiaObject *node_create(Point *startpoint, void *user_data, Handle **handl
Point p;
DiaFont *font;
int i;
-
+
node = g_malloc0(sizeof(Node));
-
+
/* old defaults */
node->line_width = NODE_BORDERWIDTH;
elem = &node->element;
obj = &elem->object;
-
+
obj->type = &node_type;
obj->ops = &node_ops;
@@ -350,7 +348,7 @@ static DiaObject *node_create(Point *startpoint, void *user_data, Handle **handl
p.y = 0.0;
node->name = new_text("", font, NODE_FONTHEIGHT, &p, &color_black, ALIGN_LEFT);
dia_font_unref(font);
-
+
element_init(elem, 8, NUM_CONNECTIONS);
for (i=0;i<NUM_CONNECTIONS;i++) {
diff --git a/objects/UML/note.c b/objects/UML/note.c
index fa39f2c9..0b32c695 100644
--- a/objects/UML/note.c
+++ b/objects/UML/note.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -80,7 +78,7 @@ static ObjectTypeOps note_type_ops =
(CreateFunc) note_create,
(LoadFunc) note_load,/*using_properties*/ /* load */
(SaveFunc) object_save_using_properties, /* save */
- (GetDefaultsFunc) NULL,
+ (GetDefaultsFunc) NULL,
(ApplyDefaultsFunc) NULL
};
@@ -115,10 +113,10 @@ static PropDescription note_props[] = {
PROP_STD_TEXT_FONT,
PROP_STD_TEXT_HEIGHT,
PROP_STD_TEXT_COLOUR_OPTIONAL,
- { "text", PROP_TYPE_TEXT, 0, N_("Text"), NULL, NULL },
+ { "text", PROP_TYPE_TEXT, 0, N_("Text"), NULL, NULL },
PROP_STD_LINE_WIDTH_OPTIONAL,
- PROP_STD_LINE_COLOUR_OPTIONAL,
- PROP_STD_FILL_COLOUR_OPTIONAL,
+ PROP_STD_LINE_COLOUR_OPTIONAL,
+ PROP_STD_FILL_COLOUR_OPTIONAL,
PROP_DESC_END
};
@@ -217,7 +215,7 @@ note_draw(Note *note, DiaRenderer *renderer)
Element *elem;
real x, y, w, h;
Point poly[5];
-
+
assert(note != NULL);
assert(renderer != NULL);
@@ -227,7 +225,7 @@ note_draw(Note *note, DiaRenderer *renderer)
y = elem->corner.y;
w = elem->width;
h = elem->height;
-
+
renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID);
renderer_ops->set_linewidth(renderer, note->line_width);
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID, 0.0);
@@ -243,7 +241,7 @@ note_draw(Note *note, DiaRenderer *renderer)
poly[4].x = x;
poly[4].y = y+h;
- renderer_ops->draw_polygon(renderer,
+ renderer_ops->draw_polygon(renderer,
poly, 5,
¬e->fill_color,
¬e->line_color);
@@ -252,9 +250,9 @@ note_draw(Note *note, DiaRenderer *renderer)
poly[1].x = x + w - NOTE_CORNER;
poly[1].y = y + NOTE_CORNER;
poly[2] = poly[2];
-
+
renderer_ops->set_linewidth(renderer, note->line_width / 2);
- renderer_ops->draw_polyline(renderer,
+ renderer_ops->draw_polyline(renderer,
poly, 3,
¬e->line_color);
@@ -281,7 +279,7 @@ note_update_data(Note *note)
/* Update connections: */
element_update_connections_rectangle(elem, note->connections);
-
+
element_update_boundingbox(elem);
obj->position = elem->corner;
@@ -300,11 +298,11 @@ note_create(Point *startpoint,
Point p;
DiaFont *font;
int i;
-
+
note = g_malloc0(sizeof(Note));
elem = ¬e->element;
obj = &elem->object;
-
+
obj->type = ¬e_type;
obj->ops = ¬e_ops;
@@ -319,12 +317,12 @@ note_create(Point *startpoint,
p = *startpoint;
p.x += note->line_width/2.0 + NOTE_MARGIN_X;
p.y += note->line_width/2.0 + NOTE_CORNER + dia_font_ascent("A",font, 0.8);
-
+
note->text = new_text("", font, 0.8, &p, &color_black, ALIGN_LEFT);
dia_font_unref(font);
element_init(elem, 8, NUM_CONNECTIONS);
-
+
for (i=0;i<NUM_CONNECTIONS;i++) {
obj->connections[i] = ¬e->connections[i];
note->connections[i].object = obj;
diff --git a/objects/UML/object.c b/objects/UML/object.c
index 2ea38305..b41d6d23 100644
--- a/objects/UML/object.c
+++ b/objects/UML/object.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -46,7 +44,7 @@ struct _Objet {
Element element;
ConnectionPoint connections[NUM_CONNECTIONS];
-
+
char *stereotype;
Text *text;
char *exstate; /* used for explicit state */
@@ -60,10 +58,10 @@ struct _Objet {
Point ex_pos, st_pos;
int is_active;
int show_attributes;
- int is_multiple;
-
+ int is_multiple;
+
char *attrib;
-
+
char *st_stereotype;
};
@@ -98,7 +96,7 @@ static ObjectTypeOps objet_type_ops =
(CreateFunc) objet_create,
(LoadFunc) objet_load,/*using_properties*/ /* load */
(SaveFunc) object_save_using_properties, /* save */
- (GetDefaultsFunc) NULL,
+ (GetDefaultsFunc) NULL,
(ApplyDefaultsFunc) NULL
};
@@ -163,7 +161,7 @@ static PropDescription objet_props[] = {
PROP_STD_TEXT_COLOUR_OPTIONS(PROP_FLAG_VISIBLE|PROP_FLAG_STANDARD|PROP_FLAG_OPTIONAL),
{ "text", PROP_TYPE_TEXT, 0, N_("Text"), NULL, NULL },
PROP_STD_LINE_WIDTH_OPTIONAL,
- PROP_STD_LINE_COLOUR_OPTIONAL,
+ PROP_STD_LINE_COLOUR_OPTIONAL,
PROP_STD_FILL_COLOUR_OPTIONAL,
PROP_STD_NOTEBOOK_END,
PROP_DESC_END
@@ -279,7 +277,7 @@ objet_draw(Objet *ob, DiaRenderer *renderer)
real bw, x, y, w, h;
Point p1, p2;
int i;
-
+
assert(ob != NULL);
assert(renderer != NULL);
@@ -289,7 +287,7 @@ objet_draw(Objet *ob, DiaRenderer *renderer)
y = elem->corner.y;
w = elem->width;
h = elem->height;
-
+
bw = (ob->is_active) ? OBJET_ACTIVEBORDERWIDTH: ob->line_width;
renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID);
@@ -303,7 +301,7 @@ objet_draw(Objet *ob, DiaRenderer *renderer)
if (ob->is_multiple) {
p1.x += OBJET_MARGIN_M(ob);
p2.y -= OBJET_MARGIN_M(ob);
- renderer_ops->draw_rect(renderer,
+ renderer_ops->draw_rect(renderer,
&p1, &p2,
&ob->fill_color,
&ob->line_color);
@@ -313,12 +311,12 @@ objet_draw(Objet *ob, DiaRenderer *renderer)
p2.y += OBJET_MARGIN_M(ob);
}
- renderer_ops->draw_rect(renderer,
+ renderer_ops->draw_rect(renderer,
&p1, &p2,
&ob->fill_color,
&ob->line_color);
-
+
text_draw(ob->text, renderer);
renderer_ops->set_font(renderer, ob->text->font, ob->text->height);
@@ -342,10 +340,10 @@ objet_draw(Objet *ob, DiaRenderer *renderer)
p1.y = ob->text->position.y + text_get_descent(ob->text);
p2.x = p1.x + text_get_max_width(ob->text);
p2.y = p1.y;
-
+
renderer_ops->set_linewidth(renderer, ob->line_width/2);
-
- for (i=0; i<ob->text->numlines; i++) {
+
+ for (i=0; i<ob->text->numlines; i++) {
p1.x = x + (w - text_get_line_width(ob->text, i))/2;
p2.x = p1.x + text_get_line_width(ob->text, i);
renderer_ops->draw_line(renderer,
@@ -357,7 +355,7 @@ objet_draw(Objet *ob, DiaRenderer *renderer)
if (ob->show_attributes) {
p1.x = x; p2.x = x + w;
p1.y = p2.y = ob->attributes->position.y - ob->attributes->ascent - OBJET_MARGIN_Y(ob);
-
+
renderer_ops->set_linewidth(renderer, bw);
renderer_ops->draw_line(renderer,
&p1, &p2,
@@ -375,7 +373,7 @@ objet_update_data(Objet *ob)
DiaFont *font;
Point p1, p2;
real h, w = 0;
-
+
text_calc_boundingbox(ob->text, NULL);
ob->stereotype = remove_stereotype_from_string(ob->stereotype);
if (!ob->st_stereotype) {
@@ -388,7 +386,7 @@ objet_update_data(Objet *ob)
if (ob->is_multiple) {
h += OBJET_MARGIN_M(ob);
}
-
+
if ((ob->stereotype != NULL) && (ob->stereotype[0] != '\0')) {
w = dia_font_string_width(ob->st_stereotype, font, OBJET_FONTHEIGHT(ob));
h += OBJET_FONTHEIGHT(ob);
@@ -406,39 +404,39 @@ objet_update_data(Objet *ob)
h += OBJET_FONTHEIGHT(ob);
ob->ex_pos.y = h;
}
-
+
h += OBJET_MARGIN_Y(ob);
if (ob->show_attributes) {
h += OBJET_MARGIN_Y(ob) + ob->attributes->ascent;
p2.x = elem->corner.x + OBJET_MARGIN_X(ob);
- p2.y = h;
+ p2.y = h;
text_set_position(ob->attributes, &p2);
- h += ob->attributes->height*ob->attributes->numlines;
+ h += ob->attributes->height*ob->attributes->numlines;
text_calc_boundingbox(ob->attributes, NULL);
w = MAX(w, ob->attributes->max_width);
}
- w += 2*OBJET_MARGIN_X(ob);
+ w += 2*OBJET_MARGIN_X(ob);
p1.x = elem->corner.x + w/2.0;
text_set_position(ob->text, &p1);
-
+
ob->ex_pos.x = ob->st_pos.x = p1.x;
-
+
if (ob->is_multiple) {
w += OBJET_MARGIN_M(ob);
}
-
+
elem->width = w;
elem->height = h - elem->corner.y;
/* Update connections: */
element_update_connections_rectangle(elem, ob->connections);
-
+
element_update_boundingbox(elem);
obj->position = elem->corner;
element_update_handles(elem);
@@ -456,11 +454,11 @@ objet_create(Point *startpoint,
Point p;
DiaFont *font;
int i;
-
+
ob = g_malloc0(sizeof(Objet));
elem = &ob->element;
obj = &elem->object;
-
+
obj->type = ¨object_type;
obj->ops = &objet_ops;
@@ -473,7 +471,7 @@ objet_create(Point *startpoint,
ob->fill_color = attributes_get_background();
font = dia_font_new_from_style(DIA_FONT_SANS, 0.8);
-
+
ob->show_attributes = FALSE;
ob->is_active = FALSE;
ob->is_multiple = FALSE;
@@ -491,9 +489,9 @@ objet_create(Point *startpoint,
text_get_attributes(ob->text,&ob->text_attrs);
dia_font_unref(font);
-
+
element_init(elem, 8, NUM_CONNECTIONS);
-
+
for (i=0;i<NUM_CONNECTIONS;i++) {
obj->connections[i] = &ob->connections[i];
ob->connections[i].object = obj;
diff --git a/objects/UML/realizes.c b/objects/UML/realizes.c
index fcb2ede1..9d7c0cfd 100644
--- a/objects/UML/realizes.c
+++ b/objects/UML/realizes.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -47,7 +45,7 @@ struct _Realizes {
Color text_color;
Color line_color;
-
+
DiaFont *font;
real font_height;
real line_width;
@@ -90,7 +88,7 @@ static ObjectTypeOps realizes_type_ops =
(CreateFunc) realizes_create,
(LoadFunc) realizes_load,/*using_properties*/ /* load */
(SaveFunc) object_save_using_properties, /* save */
- (GetDefaultsFunc) NULL,
+ (GetDefaultsFunc) NULL,
(ApplyDefaultsFunc) NULL
};
@@ -128,13 +126,13 @@ static PropDescription realizes_props[] = {
{ "name", PROP_TYPE_STRING, PROP_FLAG_VISIBLE,
N_("Name:"), NULL, NULL },
{ "stereotype", PROP_TYPE_STRING, PROP_FLAG_VISIBLE,
- N_("Stereotype:"), NULL, NULL },
+ N_("Stereotype:"), NULL, NULL },
/* can't use PROP_STD_TEXT_COLOUR_OPTIONAL cause it has PROP_FLAG_DONT_SAVE. It is designed to fill the
Text object - not some subset */
PROP_STD_TEXT_FONT_OPTIONS(PROP_FLAG_VISIBLE|PROP_FLAG_STANDARD|PROP_FLAG_OPTIONAL),
PROP_STD_TEXT_HEIGHT_OPTIONS(PROP_FLAG_VISIBLE|PROP_FLAG_STANDARD|PROP_FLAG_OPTIONAL),
PROP_STD_TEXT_COLOUR_OPTIONS(PROP_FLAG_VISIBLE|PROP_FLAG_STANDARD|PROP_FLAG_OPTIONAL),
PROP_STD_LINE_WIDTH_OPTIONAL,
- PROP_STD_LINE_COLOUR_OPTIONAL,
+ PROP_STD_LINE_COLOUR_OPTIONAL,
PROP_DESC_END
};
@@ -169,7 +167,7 @@ realizes_get_props(Realizes * realizes, GPtrArray *props)
static void
realizes_set_props(Realizes *realizes, GPtrArray *props)
{
- object_set_props_from_offsets(&realizes->orth.object,
+ object_set_props_from_offsets(&realizes->orth.object,
realizes_offsets, props);
g_free(realizes->st_stereotype);
realizes->st_stereotype = NULL;
@@ -200,7 +198,7 @@ realizes_move_handle(Realizes *realize, Handle *handle,
assert(realize!=NULL);
assert(handle!=NULL);
assert(to!=NULL);
-
+
change = orthconn_move_handle(&realize->orth, handle, to, cp, reason, modifiers);
realizes_update_data(realize);
@@ -225,10 +223,10 @@ realizes_draw(Realizes *realize, DiaRenderer *renderer)
int n;
Point pos;
Arrow arrow;
-
+
points = &orth->points[0];
n = orth->numpoints;
-
+
renderer_ops->set_linewidth(renderer, realize->line_width);
renderer_ops->set_linestyle(renderer, LINESTYLE_DASHED, REALIZES_DASHLEN);
renderer_ops->set_linejoin(renderer, LINEJOIN_MITER);
@@ -244,7 +242,7 @@ realizes_draw(Realizes *realize, DiaRenderer *renderer)
renderer_ops->set_font(renderer, realize->font, realize->font_height);
pos = realize->text_pos;
-
+
if (realize->st_stereotype != NULL && realize->st_stereotype[0] != '\0') {
renderer_ops->draw_string(renderer,
realize->st_stereotype,
@@ -253,14 +251,14 @@ realizes_draw(Realizes *realize, DiaRenderer *renderer)
pos.y += realize->font_height;
}
-
+
if (realize->name != NULL && realize->name[0] != '\0') {
renderer_ops->draw_string(renderer,
realize->name,
&pos, realize->text_align,
&realize->text_color);
}
-
+
}
static void
@@ -274,7 +272,7 @@ realizes_update_data(Realizes *realize)
PolyBBExtras *extra;
orthconn_update_data(orth);
-
+
realize->text_width = 0.0;
realize->stereotype = remove_stereotype_from_string(realize->stereotype);
@@ -292,20 +290,20 @@ realizes_update_data(Realizes *realize)
realize->font_height));
extra = &orth->extra_spacing;
-
+
extra->start_trans = realize->line_width/2.0 + REALIZES_TRIANGLESIZE;
- extra->start_long =
- extra->middle_trans =
- extra->end_trans =
+ extra->start_long =
+ extra->middle_trans =
+ extra->end_trans =
extra->end_long = realize->line_width/2.0;
orthconn_update_boundingbox(orth);
-
+
/* Calc text pos: */
num_segm = realize->orth.numpoints - 1;
points = realize->orth.points;
i = num_segm / 2;
-
+
if ((num_segm % 2) == 0) { /* If no middle segment, use horizontal */
if (realize->orth.orientation[i]==VERTICAL)
i--;
@@ -425,13 +423,13 @@ realizes_create(Point *startpoint,
realize->text_width = 0;
extra->start_trans = realize->line_width/2.0 + REALIZES_TRIANGLESIZE;
- extra->start_long =
- extra->middle_trans =
- extra->end_trans =
+ extra->start_long =
+ extra->middle_trans =
+ extra->end_trans =
extra->end_long = realize->line_width/2.0;
realizes_update_data(realize);
-
+
*handle1 = orth->handles[0];
*handle2 = orth->handles[orth->numpoints-2];
return &realize->orth.object;
diff --git a/objects/UML/small_package.c b/objects/UML/small_package.c
index 16d36294..33b885d1 100644
--- a/objects/UML/small_package.c
+++ b/objects/UML/small_package.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -46,7 +44,7 @@ struct _SmallPackage {
char *stereotype;
Text *text;
-
+
char *st_stereotype;
real line_width;
@@ -89,7 +87,7 @@ static ObjectTypeOps smallpackage_type_ops =
(CreateFunc) smallpackage_create,
(LoadFunc) smallpackage_load,/*using_properties*/ /* load */
(SaveFunc) object_save_using_properties, /* save */
- (GetDefaultsFunc) NULL,
+ (GetDefaultsFunc) NULL,
(ApplyDefaultsFunc) NULL
};
@@ -126,9 +124,9 @@ static PropDescription smallpackage_props[] = {
PROP_STD_TEXT_FONT,
PROP_STD_TEXT_HEIGHT,
PROP_STD_TEXT_COLOUR,
- { "text", PROP_TYPE_TEXT, 0, N_("Text"), NULL, NULL },
+ { "text", PROP_TYPE_TEXT, 0, N_("Text"), NULL, NULL },
PROP_STD_LINE_WIDTH_OPTIONAL,
- PROP_STD_LINE_COLOUR_OPTIONAL,
+ PROP_STD_LINE_COLOUR_OPTIONAL,
PROP_STD_FILL_COLOUR_OPTIONAL,
PROP_DESC_END
};
@@ -148,7 +146,7 @@ static PropOffset smallpackage_offsets[] = {
{"text",PROP_TYPE_TEXT,offsetof(SmallPackage,text)},
{"text_font",PROP_TYPE_FONT,offsetof(SmallPackage,text),offsetof(Text,font)},
{PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(SmallPackage,text),offsetof(Text,height)},
- {"text_colour",PROP_TYPE_COLOUR,offsetof(SmallPackage,text),offsetof(Text,color)},
+ {"text_colour",PROP_TYPE_COLOUR,offsetof(SmallPackage,text),offsetof(Text,color)},
{ PROP_STDNAME_LINE_WIDTH, PROP_STDTYPE_LINE_WIDTH, offsetof(SmallPackage, line_width) },
{"line_colour", PROP_TYPE_COLOUR, offsetof(SmallPackage, line_color) },
{"fill_colour", PROP_TYPE_COLOUR, offsetof(SmallPackage, fill_color) },
@@ -156,7 +154,7 @@ static PropOffset smallpackage_offsets[] = {
};
static void
-smallpackage_get_props(SmallPackage * smallpackage,
+smallpackage_get_props(SmallPackage * smallpackage,
GPtrArray *props)
{
object_get_props_from_offsets(&smallpackage->element.object,
@@ -164,10 +162,10 @@ smallpackage_get_props(SmallPackage * smallpackage,
}
static void
-smallpackage_set_props(SmallPackage *smallpackage,
+smallpackage_set_props(SmallPackage *smallpackage,
GPtrArray *props)
{
- object_set_props_from_offsets(&smallpackage->element.object,
+ object_set_props_from_offsets(&smallpackage->element.object,
smallpackage_offsets, props);
g_free(smallpackage->st_stereotype);
smallpackage->st_stereotype = NULL;
@@ -219,14 +217,14 @@ static ObjectChange*
smallpackage_move(SmallPackage *pkg, Point *to)
{
Point p;
-
+
pkg->element.corner = *to;
p = *to;
p.x += SMALLPACKAGE_MARGIN_X;
p.y += pkg->text->ascent + SMALLPACKAGE_MARGIN_Y;
text_set_position(pkg->text, &p);
-
+
smallpackage_update_data(pkg);
return NULL;
@@ -239,7 +237,7 @@ smallpackage_draw(SmallPackage *pkg, DiaRenderer *renderer)
Element *elem;
real x, y, w, h;
Point p1, p2;
-
+
assert(pkg != NULL);
assert(renderer != NULL);
@@ -249,7 +247,7 @@ smallpackage_draw(SmallPackage *pkg, DiaRenderer *renderer)
y = elem->corner.y;
w = elem->width;
h = elem->height;
-
+
renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID);
renderer_ops->set_linewidth(renderer, pkg->line_width);
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID, 0.0);
@@ -257,7 +255,7 @@ smallpackage_draw(SmallPackage *pkg, DiaRenderer *renderer)
p1.x = x; p1.y = y;
p2.x = x+w; p2.y = y+h;
- renderer_ops->draw_rect(renderer,
+ renderer_ops->draw_rect(renderer,
&p1, &p2,
&pkg->fill_color,
&pkg->line_color);
@@ -265,7 +263,7 @@ smallpackage_draw(SmallPackage *pkg, DiaRenderer *renderer)
p1.x= x; p1.y = y-SMALLPACKAGE_TOPHEIGHT;
p2.x = x+SMALLPACKAGE_TOPWIDTH; p2.y = y;
- renderer_ops->draw_rect(renderer,
+ renderer_ops->draw_rect(renderer,
&p1, &p2,
&pkg->fill_color,
&pkg->line_color);
@@ -277,7 +275,7 @@ smallpackage_draw(SmallPackage *pkg, DiaRenderer *renderer)
p1 = pkg->text->position;
p1.y -= pkg->text->height;
- renderer_ops->draw_string(renderer, pkg->st_stereotype, &p1,
+ renderer_ops->draw_string(renderer, pkg->st_stereotype, &p1,
ALIGN_LEFT, &pkg->text->color);
}
}
@@ -341,11 +339,11 @@ smallpackage_create(Point *startpoint,
Point p;
DiaFont *font;
int i;
-
+
pkg = g_malloc0(sizeof(SmallPackage));
elem = &pkg->element;
obj = &elem->object;
-
+
obj->type = &smallpackage_type;
obj->ops = &smallpackage_ops;
@@ -356,12 +354,12 @@ smallpackage_create(Point *startpoint,
p = *startpoint;
p.x += SMALLPACKAGE_MARGIN_X;
p.y += SMALLPACKAGE_MARGIN_Y+ dia_font_ascent("A",font, 0.8);
-
+
pkg->text = new_text("", font, 0.8, &p, &color_black, ALIGN_LEFT);
dia_font_unref(font);
-
+
element_init(elem, 8, NUM_CONNECTIONS);
-
+
for (i=0;i<NUM_CONNECTIONS;i++) {
obj->connections[i] = &pkg->connections[i];
pkg->connections[i].object = obj;
@@ -392,7 +390,7 @@ static void
smallpackage_destroy(SmallPackage *pkg)
{
text_destroy(pkg->text);
-
+
g_free(pkg->stereotype);
g_free(pkg->st_stereotype);
diff --git a/objects/UML/state.c b/objects/UML/state.c
index e1de050a..49a81499 100644
--- a/objects/UML/state.c
+++ b/objects/UML/state.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -63,9 +61,9 @@ struct _State {
Color line_color;
Color fill_color;
-
+
real line_width;
-
+
gchar* entry_action;
gchar* do_action;
gchar* exit_action;
@@ -106,7 +104,7 @@ static ObjectTypeOps state_type_ops =
(CreateFunc) state_create,
(LoadFunc) state_load,/*using_properties*/ /* load */
(SaveFunc) object_save_using_properties, /* save */
- (GetDefaultsFunc) NULL,
+ (GetDefaultsFunc) NULL,
(ApplyDefaultsFunc) NULL
};
@@ -256,8 +254,8 @@ state_draw_action_string(State *state, DiaRenderer *renderer, StateAction action
renderer_ops->set_font(renderer, state->text->font, state->text->height);
renderer_ops->draw_string(renderer,
action_text,
- &pos,
- ALIGN_LEFT,
+ &pos,
+ ALIGN_LEFT,
&state->text->color);
g_free(action_text);
}
@@ -270,7 +268,7 @@ state_draw(State *state, DiaRenderer *renderer)
real x, y, w, h, r;
Point p1, p2, split_line_left, split_line_right;
gboolean has_actions;
-
+
assert(state != NULL);
assert(renderer != NULL);
@@ -280,7 +278,7 @@ state_draw(State *state, DiaRenderer *renderer)
y = elem->corner.y;
w = elem->width;
h = elem->height;
-
+
renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID);
renderer_ops->set_linewidth(renderer, state->line_width);
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID, 0.0);
@@ -290,13 +288,13 @@ state_draw(State *state, DiaRenderer *renderer)
p1.y = y + h/2;
if (state->state_type==STATE_END) {
r = STATE_ENDRATIO;
- renderer_ops->draw_ellipse (renderer,
+ renderer_ops->draw_ellipse (renderer,
&p1,
r, r,
&state->fill_color, &state->line_color);
- }
+ }
r = STATE_RATIO;
- renderer_ops->draw_ellipse (renderer,
+ renderer_ops->draw_ellipse (renderer,
&p1,
r, r,
NULL, &state->line_color);
@@ -327,7 +325,7 @@ state_draw(State *state, DiaRenderer *renderer)
if (has_actions) {
split_line_left.x = x;
split_line_right.x = x+w;
- split_line_left.y = split_line_right.y
+ split_line_left.y = split_line_right.y
= state->element.corner.y + STATE_MARGIN_Y +
state->text->numlines*state->text->height;
renderer_ops->draw_line(renderer, &split_line_left, &split_line_right,
@@ -338,13 +336,13 @@ state_draw(State *state, DiaRenderer *renderer)
static void
-state_update_width_and_height_with_action_text(State* state,
+state_update_width_and_height_with_action_text(State* state,
StateAction action,
real* width,
real* height)
{
gchar* action_text = state_get_action_text(state, action);
- *width = MAX(*width, dia_font_string_width(action_text, state->text->font,
+ *width = MAX(*width, dia_font_string_width(action_text, state->text->font,
state->text->height) + 2*STATE_MARGIN_X);
g_free(action_text);
*height += state->text->height;
@@ -359,7 +357,7 @@ state_update_data(State *state)
ElementBBExtras *extra = &elem->extra_spacing;
DiaObject *obj = &elem->object;
Point p;
-
+
text_calc_boundingbox(state->text, NULL);
if (state->state_type==STATE_NORMAL) {
/* First consider the state description text */
@@ -377,7 +375,7 @@ state_update_data(State *state)
if (state->exit_action && strlen(state->exit_action) != 0) {
state_update_width_and_height_with_action_text(state, EXIT_ACTION, &w, &h);
}
-
+
p.x = elem->corner.x + w/2.0;
p.y = elem->corner.y + STATE_MARGIN_Y + state->text->ascent;
text_set_position(state->text, &p);
@@ -411,7 +409,7 @@ state_create(Point *startpoint,
Point p;
DiaFont *font;
int i;
-
+
state = g_malloc0(sizeof(State));
/* old default */
@@ -419,7 +417,7 @@ state_create(Point *startpoint,
elem = &state->element;
obj = &elem->object;
-
+
obj->type = &state_type;
obj->ops = &state_ops;
elem->corner = *startpoint;
@@ -433,14 +431,14 @@ state_create(Point *startpoint,
p = *startpoint;
p.x += STATE_WIDTH/2.0;
p.y += STATE_HEIGHT/2.0;
-
+
state->text = new_text("", font, 0.8, &p, &color_black, ALIGN_CENTER);
dia_font_unref(font);
-
+
state->state_type = STATE_NORMAL;
element_init(elem, 8, NUM_CONNECTIONS);
-
+
for (i=0;i<NUM_CONNECTIONS;i++) {
obj->connections[i] = &state->connections[i];
state->connections[i].object = obj;
@@ -489,27 +487,27 @@ state_calc_action_text_pos(State* state, StateAction action, Point* pos)
{
int entry_action_valid = state->entry_action && strlen(state->entry_action) != 0;
int do_action_valid = state->do_action && strlen(state->do_action) != 0;
-
- real first_action_y = state->text->numlines*state->text->height +
- state->text->position.y;
-
+
+ real first_action_y = state->text->numlines*state->text->height +
+ state->text->position.y;
+
pos->x = state->element.corner.x + STATE_MARGIN_X;
-
+
switch (action)
{
case ENTRY_ACTION:
pos->y = first_action_y;
break;
-
+
case DO_ACTION:
pos->y = first_action_y;
if (entry_action_valid) pos->y += state->text->height;
break;
-
+
case EXIT_ACTION:
pos->y = first_action_y;
if (entry_action_valid) pos->y += state->text->height;
- if (do_action_valid) pos->y += state->text->height;
+ if (do_action_valid) pos->y += state->text->height;
break;
}
}
@@ -523,11 +521,11 @@ state_get_action_text(State* state, StateAction action)
case ENTRY_ACTION:
return g_strdup_printf("entry/ %s", state->entry_action);
break;
-
+
case DO_ACTION:
return g_strdup_printf("do/ %s", state->do_action);
break;
-
+
case EXIT_ACTION:
return g_strdup_printf("exit/ %s", state->exit_action);
break;
diff --git a/objects/UML/state_term.c b/objects/UML/state_term.c
index fb851d38..7668e3b6 100644
--- a/objects/UML/state_term.c
+++ b/objects/UML/state_term.c
@@ -3,7 +3,7 @@
*
* State terminal type for UML diagrams
* Copyright (C) 2002 Alejandro Sierra <asierra servidor unam mx>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -46,7 +44,7 @@ struct _State {
ConnectionPoint connections[NUM_CONNECTIONS];
int is_final;
-
+
Color line_color;
Color fill_color;
};
@@ -84,7 +82,7 @@ static ObjectTypeOps state_type_ops =
(CreateFunc) state_create,
(LoadFunc) state_load,/*using_properties*/ /* load */
(SaveFunc) object_save_using_properties, /* save */
- (GetDefaultsFunc) NULL,
+ (GetDefaultsFunc) NULL,
(ApplyDefaultsFunc) NULL
};
@@ -116,8 +114,8 @@ static ObjectOps state_ops = {
static PropDescription state_props[] = {
ELEMENT_COMMON_PROPERTIES,
- PROP_STD_LINE_COLOUR_OPTIONAL,
- PROP_STD_FILL_COLOUR_OPTIONAL,
+ PROP_STD_LINE_COLOUR_OPTIONAL,
+ PROP_STD_FILL_COLOUR_OPTIONAL,
{ "is_final", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE,
N_("Is final"), NULL, NULL },
PROP_DESC_END
@@ -137,7 +135,7 @@ static PropOffset state_offsets[] = {
{ "line_colour",PROP_TYPE_COLOUR,offsetof(State, line_color) },
{ "fill_colour",PROP_TYPE_COLOUR,offsetof(State, fill_color) },
{ "is_final", PROP_TYPE_BOOL, offsetof(State, is_final) },
-
+
{ NULL, 0, 0 },
};
@@ -210,7 +208,7 @@ state_draw(State *state, DiaRenderer *renderer)
y = elem->corner.y;
w = elem->width;
h = elem->height;
-
+
renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID);
renderer_ops->set_linewidth(renderer, STATE_LINEWIDTH);
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID, 0);
@@ -218,14 +216,14 @@ state_draw(State *state, DiaRenderer *renderer)
p1.x = x + w/2;
p1.y = y + h/2;
if (state->is_final==1) {
- r = STATE_ENDRATIO;
- renderer_ops->draw_ellipse (renderer,
+ r = STATE_ENDRATIO;
+ renderer_ops->draw_ellipse (renderer,
&p1,
r, r,
&state->fill_color, &state->line_color);
- }
+ }
r = STATE_RATIO;
- renderer_ops->draw_ellipse (renderer,
+ renderer_ops->draw_ellipse (renderer,
&p1,
r, r,
&state->line_color, NULL); /* line_color not a typo! */
@@ -240,9 +238,9 @@ state_update_data(State *state)
Element *elem = &state->element;
ElementBBExtras *extra = &elem->extra_spacing;
DiaObject *obj = &elem->object;
-
+
w = h = (state->is_final) ? STATE_ENDRATIO: STATE_RATIO;
-
+
elem->width = w;
elem->height = h;
extra->border_trans = STATE_LINEWIDTH / 2.0;
@@ -268,11 +266,11 @@ state_create(Point *startpoint,
DiaObject *obj;
Point p;
int i;
-
+
state = g_malloc0(sizeof(State));
elem = &state->element;
obj = &elem->object;
-
+
obj->type = &state_term_type;
obj->ops = &state_ops;
elem->corner = *startpoint;
@@ -282,12 +280,12 @@ state_create(Point *startpoint,
p = *startpoint;
p.x += STATE_WIDTH/2.0;
p.y += STATE_HEIGHT/2.0;
-
+
state->line_color = attributes_get_foreground();
state->fill_color = attributes_get_background();
state->is_final = 0;
element_init(elem, 8, NUM_CONNECTIONS);
-
+
for (i=0;i<NUM_CONNECTIONS;i++) {
obj->connections[i] = &state->connections[i];
state->connections[i].object = obj;
diff --git a/objects/UML/transition.c b/objects/UML/transition.c
index 9ca169c6..1886d283 100644
--- a/objects/UML/transition.c
+++ b/objects/UML/transition.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <string.h>
@@ -37,7 +35,7 @@ typedef struct _Transition Transition;
struct _Transition {
OrthConn orth;
-
+
Color text_color;
Color line_color;
@@ -73,7 +71,7 @@ static void transition_draw(Transition* transition, DiaRenderer* ddisp);
static real transition_distance(Transition* transition, Point* point);
static DiaMenu* transition_get_object_menu(Transition* transition,
Point* clickedpoint);
-static void transition_select(Transition* obj,
+static void transition_select(Transition* obj,
Point* clicked_point,
DiaRenderer* interactive_renderer);
static ObjectChange* transition_move(Transition* transition, Point* pos);
@@ -92,22 +90,22 @@ static ObjectChange* transition_add_segment_cb(DiaObject *obj,
gpointer data);
static ObjectChange* transition_del_segment_cb(DiaObject *obj,
Point *clicked_point,
- gpointer data);
+ gpointer data);
static ObjectTypeOps uml_transition_type_ops = {
(CreateFunc)transition_create,
(LoadFunc)transition_load,
(SaveFunc)object_save_using_properties,
- (GetDefaultsFunc)NULL,
+ (GetDefaultsFunc)NULL,
(ApplyDefaultsFunc)NULL
};
-/* The "uml_" prefix is used to avoid clashing with the
+/* The "uml_" prefix is used to avoid clashing with the
GRAFCET transition */
DiaObjectType uml_transition_type = {
"UML - Transition", /* Name */
/* Version 0 had no autorouting and so shouldn't have it set by default. */
- /* version 0 and 1 expects the arrow to be drawn on the wrong end */
+ /* version 0 and 1 expects the arrow to be drawn on the wrong end */
2, /* version */
transition_xpm, /* Pixmap */
¨_transition_type_ops
@@ -116,7 +114,7 @@ DiaObjectType uml_transition_type = {
/* These methods are described in the object.h file */
static ObjectOps uml_transition_ops = {
- (DestroyFunc) transition_destroy,
+ (DestroyFunc) transition_destroy,
(DrawFunc) transition_draw,
(DistanceFunc) transition_distance,
(SelectFunc) transition_select,
@@ -137,12 +135,12 @@ static PropDescription transition_props[] = {
ORTHCONN_COMMON_PROPERTIES,
/* can't use PROP_STD_TEXT_COLOUR_OPTIONAL cause it has PROP_FLAG_DONT_SAVE. It is designed to fill the
Text object - not some subset */
PROP_STD_TEXT_COLOUR_OPTIONS(PROP_FLAG_VISIBLE|PROP_FLAG_STANDARD|PROP_FLAG_OPTIONAL),
- PROP_STD_LINE_COLOUR_OPTIONAL,
- { "trigger", PROP_TYPE_STRING, PROP_FLAG_VISIBLE, N_("Trigger"),
+ PROP_STD_LINE_COLOUR_OPTIONAL,
+ { "trigger", PROP_TYPE_STRING, PROP_FLAG_VISIBLE, N_("Trigger"),
N_("The event that causes this transition to be taken"), NULL },
{ "action", PROP_TYPE_STRING, PROP_FLAG_VISIBLE, N_("Action"),
N_("Action to perform when this transition is taken"), NULL },
- { "guard", PROP_TYPE_STRING, PROP_FLAG_VISIBLE, N_("Guard"),
+ { "guard", PROP_TYPE_STRING, PROP_FLAG_VISIBLE, N_("Guard"),
N_("Condition for taking this transition when the event is fired"), NULL },
{ "trigger_text_pos", PROP_TYPE_POINT, 0, "trigger_text_pos:", NULL, NULL },
{ "guard_text_pos", PROP_TYPE_POINT, 0, "guard_text_pos:", NULL, NULL },
@@ -165,7 +163,7 @@ static PropOffset transition_offsets[] = {
};
-#define TRANSITION_MENU_ADD_SEGMENT_OFFSET 0
+#define TRANSITION_MENU_ADD_SEGMENT_OFFSET 0
#define TRANSITION_MENU_DEL_SEGMENT_OFFSET 1
#define TRANSITION_MENU_OFFSET_TO_ORTH_COMMON 2
static DiaMenuItem transition_menu_items[] = {
@@ -193,21 +191,21 @@ transition_create(Point *startpoint,
OrthConn *orth;
DiaObject *obj;
Point temp_point;
-
+
if (transition_font == NULL) {
- transition_font =
+ transition_font =
dia_font_new_from_style (DIA_FONT_SANS, TRANSITION_FONTHEIGHT);
}
transition = g_malloc0(sizeof(Transition));
-
+
orth = &transition->orth;
obj = &orth->object;
obj->type = ¨_transition_type;
obj->ops = ¨_transition_ops;
-
+
orthconn_init(orth, startpoint);
-
+
transition->text_color = color_black;
transition->line_color = attributes_get_foreground();
/* Prepare the handles for trigger and guard text */
@@ -219,8 +217,8 @@ transition_create(Point *startpoint,
temp_point.y -= TEXT_HANDLE_DISTANCE_FROM_STARTPOINT;
transition->trigger_text_pos = temp_point;
transition->trigger_text_handle.pos = temp_point;
- object_add_handle(obj, &transition->trigger_text_handle);
-
+ object_add_handle(obj, &transition->trigger_text_handle);
+
transition->guard_text_handle.id = HANDLE_MOVE_GUARD_TEXT;
transition->guard_text_handle.type = HANDLE_MINOR_CONTROL;
transition->guard_text_handle.connect_type = HANDLE_NONCONNECTABLE;
@@ -229,13 +227,13 @@ transition_create(Point *startpoint,
temp_point.y += TEXT_HANDLE_DISTANCE_FROM_STARTPOINT;
transition->guard_text_pos = transition->guard_text_handle.pos = temp_point;
object_add_handle(obj, &transition->guard_text_handle);
-
+
transition->guard_text = NULL;
transition->trigger_text = NULL;
transition->action_text = NULL;
-
+
uml_transition_update_data(transition);
-
+
*handle1 = obj->handles[0];
*handle2 = obj->handles[1];
return obj;
@@ -271,7 +269,7 @@ transition_set_props(Transition *transition, GPtrArray *props)
static void
transition_get_props(Transition *transition, GPtrArray *props)
{
- object_get_props_from_offsets(&transition->orth.object,
+ object_get_props_from_offsets(&transition->orth.object,
transition_offsets, props);
}
@@ -297,21 +295,21 @@ static DiaMenu*
transition_get_object_menu(Transition* transition, Point* clickedpoint)
{
OrthConn *orth = &transition->orth;
- /* Set/clear the active flag of the add/remove segment according to the
+ /* Set/clear the active flag of the add/remove segment according to the
placement of mouse pointer and placement of the transition and its handles */
transition_menu_items[TRANSITION_MENU_ADD_SEGMENT_OFFSET].active =
orthconn_can_add_segment(orth, clickedpoint);
transition_menu_items[TRANSITION_MENU_DEL_SEGMENT_OFFSET].active =
orthconn_can_delete_segment(orth, clickedpoint);
-
- orthconn_update_object_menu(orth, clickedpoint,
+
+ orthconn_update_object_menu(orth, clickedpoint,
&transition_menu_items[TRANSITION_MENU_OFFSET_TO_ORTH_COMMON]);
return &transition_menu;
}
static gchar* create_event_action_text(Transition* transition)
{
- gchar *temp_text;
+ gchar *temp_text;
if (transition->action_text && strlen(transition->action_text) != 0)
{
temp_text = g_strdup_printf("%s/%s", transition->trigger_text,
@@ -326,8 +324,8 @@ static gchar* create_event_action_text(Transition* transition)
static gchar* create_guard_text(Transition* transition)
{
- gchar *temp_text;
- temp_text = g_strdup_printf("[%s]", transition->guard_text);
+ gchar *temp_text;
+ temp_text = g_strdup_printf("[%s]", transition->guard_text);
return temp_text;
}
@@ -348,17 +346,17 @@ static void transition_draw(Transition* transition, DiaRenderer* renderer)
/* Draw the arrow / line */
points = &orth->points[0];
num_points = orth->numpoints;
-
+
arrow.type = ARROW_LINES;
arrow.length = TRANSITION_ARROWLEN;
arrow.width = TRANSITION_ARROWWIDTH;
-
-
+
+
/* Is it necessary to call set_linewidth? The draw_line_with_arrows() method
got a linewidth parameter... */
renderer_ops->set_linewidth(renderer, TRANSITION_WIDTH);
/* TODO, find out about the meaning of this... */
- renderer_ops->set_linecaps(renderer, LINECAPS_BUTT);
+ renderer_ops->set_linecaps(renderer, LINECAPS_BUTT);
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID, 0.0);
if (transition->direction_inverted) {
@@ -377,7 +375,7 @@ static void transition_draw(Transition* transition, DiaRenderer* renderer)
renderer_ops->set_font(renderer, transition_font,
TRANSITION_FONTHEIGHT);
-
+
/* Draw the guard text */
if (transition->guard_text && strlen(transition->guard_text) != 0)
{
@@ -389,7 +387,7 @@ static void transition_draw(Transition* transition, DiaRenderer* renderer)
&transition->text_color);
g_free(text);
}
-
+
/* Draw the trigger text */
if (transition->trigger_text && strlen(transition->trigger_text) != 0)
{
@@ -401,46 +399,46 @@ static void transition_draw(Transition* transition, DiaRenderer* renderer)
&transition->text_color);
g_free(text);
}
-
+
}
-
+
static real
transition_distance(Transition* transition, Point* point)
{
return orthconn_distance_from(&transition->orth, point, TRANSITION_WIDTH);
}
-static void
+static void
transition_select(Transition* transition,
- Point* clicked_point,
+ Point* clicked_point,
DiaRenderer* interactive_renderer)
-{
+{
uml_transition_update_data(transition);
}
-
+
static ObjectChange*
transition_move(Transition* transition, Point* newpos)
{
Point delta;
ObjectChange *change;
-
+
/* Find a delta in order to move the text handles along with the transition */
delta = *newpos;
point_sub(&delta, &transition->orth.points[0]);
-
+
change = orthconn_move(&transition->orth, newpos);
- /* Move the text handles */
+ /* Move the text handles */
point_add(&transition->trigger_text_pos, &delta);
point_add(&transition->guard_text_pos, &delta);
-
+
uml_transition_update_data(transition);
return change;
}
-static ObjectChange*
+static ObjectChange*
transition_move_handle(Transition* transition,
Handle* handle,
Point* newpos,
@@ -449,30 +447,30 @@ transition_move_handle(Transition* transition,
ModifierKeys modifiers)
{
ObjectChange *change = NULL;
-
+
assert(transition != NULL);
assert(handle != NULL);
assert(newpos != NULL);
-
+
switch (handle->id)
{
case HANDLE_MOVE_TRIGGER_TEXT:
/* The trigger text is being moved */
transition->trigger_text_pos = *newpos;
break;
-
+
case HANDLE_MOVE_GUARD_TEXT:
/* The guard text is being moved */
transition->guard_text_pos = *newpos;
break;
-
+
default:
{
int n = transition->orth.numpoints/2;
Point p1, p2;
p1.x = 0.5 * (transition->orth.points[n-1].x + transition->orth.points[n].x);
p1.y = 0.5 * (transition->orth.points[n-1].y + transition->orth.points[n].y);
-
+
/* Tell the connection that one of its handles is being moved */
change = orthconn_move_handle(&transition->orth, handle, newpos, cp, reason, modifiers);
/* with auto-routing the number of points may have changed */
@@ -480,13 +478,13 @@ transition_move_handle(Transition* transition,
p2.x = 0.5 * (transition->orth.points[n-1].x + transition->orth.points[n].x);
p2.y = 0.5 * (transition->orth.points[n-1].y + transition->orth.points[n].y);
point_sub(&p2, &p1);
-
+
point_add(&transition->trigger_text_pos, &p2);
point_add(&transition->guard_text_pos, &p2);
}
break;
}
-
+
/* Update ourselves to reflect the new handle position */
uml_transition_update_data(transition);
@@ -502,11 +500,11 @@ static ObjectChange* transition_add_segment_cb(DiaObject *obj,
uml_transition_update_data((Transition*)obj);
return change;
}
-
-
+
+
static ObjectChange* transition_del_segment_cb(DiaObject *obj,
Point *clickedpoint,
- gpointer data)
+ gpointer data)
{
ObjectChange *change;
change = orthconn_delete_segment((OrthConn*)obj, clickedpoint);
@@ -527,34 +525,34 @@ static void expand_bbox_for_text(Rectangle* bbox,
TRANSITION_FONTHEIGHT);
text_box.left = text_pos->x - text_width/2;
text_box.right = text_box.left + text_width;
- text_box.top = text_pos->y - dia_font_ascent(text, transition_font,
+ text_box.top = text_pos->y - dia_font_ascent(text, transition_font,
TRANSITION_FONTHEIGHT);
text_box.bottom = text_box.top + TRANSITION_FONTHEIGHT;
rectangle_union(bbox, &text_box);
-
+
}
static void
uml_transition_update_data(Transition *transition)
{
- gchar *temp_text;
+ gchar *temp_text;
Point *points;
-
+
/* Setup helpful pointers as shortcuts */
OrthConn *orth = &transition->orth;
DiaObject *obj = &orth->object;
PolyBBExtras *extra = &orth->extra_spacing;
points = &orth->points[0];
-
+
/* Set the transitions position */
obj->position = points[0];
transition->trigger_text_handle.pos = transition->trigger_text_pos;
transition->guard_text_handle.pos = transition->guard_text_pos;
-
+
/* Update the orthogonal connection to match the new data */
orthconn_update_data(orth);
- extra->start_long = extra->end_long
+ extra->start_long = extra->end_long
= extra->middle_trans
= TRANSITION_WIDTH/2.0;
extra->start_trans = extra->end_trans
@@ -563,14 +561,14 @@ uml_transition_update_data(Transition *transition)
/* Update the bounding box to match the new connection data */
orthconn_update_boundingbox(orth);
/* Update the bounding box to match the new trigger text size and position */
- temp_text = create_event_action_text(transition);
- expand_bbox_for_text(&obj->bounding_box, &transition->trigger_text_pos,
+ temp_text = create_event_action_text(transition);
+ expand_bbox_for_text(&obj->bounding_box, &transition->trigger_text_pos,
temp_text);
g_free(temp_text);
/* Update the bounding box to match the new guard text size and position */
- temp_text = g_strdup_printf("[%s]", transition->guard_text ? transition->guard_text : "");
- expand_bbox_for_text(&obj->bounding_box, &transition->guard_text_pos,
- temp_text);
+ temp_text = g_strdup_printf("[%s]", transition->guard_text ? transition->guard_text : "");
+ expand_bbox_for_text(&obj->bounding_box, &transition->guard_text_pos,
+ temp_text);
g_free(temp_text);
}
diff --git a/objects/UML/uml.c b/objects/UML/uml.c
index ccf98ac8..089cf442 100644
--- a/objects/UML/uml.c
+++ b/objects/UML/uml.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <string.h>
#include <stdio.h>
@@ -83,25 +81,25 @@ dia_plugin_init(PluginInfo *info)
object_register_type(&lifeline_type);
object_register_type(&objet_type);
object_register_type(¨object_type);
- object_register_type(&message_type);
+ object_register_type(&message_type);
object_register_type(&component_type);
object_register_type(&classicon_type);
object_register_type(&state_type);
object_register_type(&state_term_type);
object_register_type(&activity_type);
- object_register_type(&node_type);
- object_register_type(&branch_type);
+ object_register_type(&node_type);
+ object_register_type(&branch_type);
object_register_type(&fork_type);
object_register_type(&compfeat_type);
object_register_type(¨_transition_type);
-
+
return DIA_PLUGIN_INIT_OK;
}
PropEnumData _uml_visibilities[] = {
{ N_("Public"), UML_PUBLIC },
- { N_("Private"), UML_PRIVATE },
+ { N_("Private"), UML_PRIVATE },
{ N_("Protected"), UML_PROTECTED },
{ N_("Implementation"), UML_IMPLEMENTATION },
{ NULL, 0 }
diff --git a/objects/UML/umlattribute.c b/objects/UML/umlattribute.c
index 67c61d96..ad98d5e0 100644
--- a/objects/UML/umlattribute.c
+++ b/objects/UML/umlattribute.c
@@ -21,9 +21,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <string.h>
@@ -76,7 +74,7 @@ uml_attribute_new(void)
{
UMLAttribute *attr;
static gint next_id = 1;
-
+
attr = g_new0(UMLAttribute, 1);
attr->internal_id = next_id++;
attr->name = g_strdup("");
@@ -93,7 +91,7 @@ uml_attribute_new(void)
return attr;
}
-/** Copy the data of an attribute into another, but not the connections.
+/** Copy the data of an attribute into another, but not the connections.
* Frees up any strings in the attribute being copied into. */
void
uml_attribute_copy_into(UMLAttribute *attr, UMLAttribute *newattr)
@@ -122,7 +120,7 @@ uml_attribute_copy_into(UMLAttribute *attr, UMLAttribute *newattr)
}
if (attr->comment != NULL)
newattr->comment = g_strdup (attr->comment);
- else
+ else
newattr->comment = NULL;
newattr->visibility = attr->visibility;
@@ -183,7 +181,7 @@ uml_attribute_write(AttributeNode attr_node, UMLAttribute *attr, DiaContext *ctx
attr->class_scope, ctx);
}
-/* Warning, the following *must* be strictly ASCII characters (or fix the
+/* Warning, the following *must* be strictly ASCII characters (or fix the
following code for UTF-8 cleanliness */
char visible_char[] = { '+', '-', '#', ' ' };
@@ -194,7 +192,7 @@ uml_get_attribute_string (UMLAttribute *attribute)
int len;
char *str;
- len = 1 + (attribute->name ? strlen (attribute->name) : 0)
+ len = 1 + (attribute->name ? strlen (attribute->name) : 0)
+ (attribute->type ? strlen (attribute->type) : 0);
if (attribute->name && attribute->name[0] && attribute->type && attribute->type[0]) {
len += 2;
@@ -202,7 +200,7 @@ uml_get_attribute_string (UMLAttribute *attribute)
if (attribute->value != NULL && attribute->value[0] != '\0') {
len += 3 + strlen (attribute->value);
}
-
+
str = g_malloc (sizeof (char) * (len + 1));
str[0] = visible_char[(int) attribute->visibility];
@@ -217,7 +215,7 @@ uml_get_attribute_string (UMLAttribute *attribute)
strcat (str, " = ");
strcat (str, attribute->value);
}
-
+
g_assert (strlen (str) == len);
return str;
diff --git a/objects/UML/umlformalparameter.c b/objects/UML/umlformalparameter.c
index 10224f96..abdcc4c8 100644
--- a/objects/UML/umlformalparameter.c
+++ b/objects/UML/umlformalparameter.c
@@ -21,9 +21,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <string.h>
@@ -111,7 +109,7 @@ uml_get_formalparameter_string (UMLFormalParameter *parameter)
/* Calculate length: */
len = parameter->name ? strlen (parameter->name) : 0;
-
+
if (parameter->type != NULL) {
len += 1 + strlen (parameter->type);
}
diff --git a/objects/UML/umloperation.c b/objects/UML/umloperation.c
index bf7924cc..500d9286 100644
--- a/objects/UML/umloperation.c
+++ b/objects/UML/umloperation.c
@@ -32,7 +32,7 @@ for c in theClasses :
oper, _h1, _h2 = operType.create (0,0)
oper.properties["name"] = f.name
oper.properties["type"] = f.type
-
+
for p in f.parameters :
param, _h1, _h2 = paramType.create(0,0)
param.properties["name"] = p.name
@@ -40,13 +40,11 @@ for c in theClasses :
oper.insert(param, -1)
klass.insert(oper, -1)
- layer.add_object(klass)
+ layer.add_object(klass)
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <math.h>
#include <string.h>
@@ -133,7 +131,7 @@ uml_operation_copy_into(UMLOperation *srcop, UMLOperation *destop)
g_free(destop->name);
}
destop->name = g_strdup(srcop->name);
-
+
if (destop->type != NULL) {
g_free(destop->type);
}
@@ -151,7 +149,7 @@ uml_operation_copy_into(UMLOperation *srcop, UMLOperation *destop)
} else {
destop->stereotype = NULL;
}
-
+
if (destop->comment != NULL) {
g_free(destop->comment);
}
@@ -187,9 +185,9 @@ uml_operation_copy_into(UMLOperation *srcop, UMLOperation *destop)
else
newparam->value = NULL;
newparam->kind = param->kind;
-
+
destop->parameters = g_list_append(destop->parameters, newparam);
-
+
list = g_list_next(list);
}
}
@@ -198,7 +196,7 @@ UMLOperation *
uml_operation_copy(UMLOperation *op)
{
UMLOperation *newop;
-
+
newop = g_new0(UMLOperation, 1);
uml_operation_copy_into(op, newop);
@@ -219,7 +217,7 @@ uml_operation_destroy(UMLOperation *op)
{
GList *list;
UMLParameter *param;
-
+
g_free(op->name);
if (op->type != NULL)
g_free(op->type);
@@ -276,9 +274,9 @@ uml_operation_write(AttributeNode attr_node, UMLOperation *op, DiaContext *ctx)
op->query, ctx);
data_add_boolean(composite_add_attribute(composite, "class_scope"),
op->class_scope, ctx);
-
+
attr_node2 = composite_add_attribute(composite, "parameters");
-
+
list = op->parameters;
while (list != NULL) {
param = (UMLParameter *) list->data;
@@ -313,17 +311,17 @@ uml_get_operation_string (UMLOperation *operation)
len = 1 + (operation->name ? strlen (operation->name) : 0) + 1;
if(operation->stereotype != NULL && operation->stereotype[0] != '\0') {
len += 5 + strlen (operation->stereotype);
- }
-
+ }
+
list = operation->parameters;
while (list != NULL) {
param = (UMLParameter *) list->data;
list = g_list_next (list);
-
+
switch(param->kind)
{
case UML_UNDEF_KIND:
- break;
+ break;
case UML_IN:
len += 3;
break;
@@ -332,7 +330,7 @@ uml_get_operation_string (UMLOperation *operation)
break;
case UML_INOUT:
len += 6;
- break;
+ break;
}
len += (param->name ? strlen (param->name) : 0);
if (param->type != NULL) {
@@ -344,7 +342,7 @@ uml_get_operation_string (UMLOperation *operation)
if (param->value != NULL && param->value[0] != '\0') {
len += 1 + strlen (param->value);
}
-
+
if (list != NULL) {
len += 1; /* ',' */
}
@@ -373,12 +371,12 @@ uml_get_operation_string (UMLOperation *operation)
strcat (str, operation->name ? operation->name : "");
strcat (str, "(");
-
+
list = operation->parameters;
while (list != NULL) {
param = (UMLParameter *) list->data;
list = g_list_next (list);
-
+
switch(param->kind)
{
case UML_UNDEF_KIND:
@@ -401,7 +399,7 @@ uml_get_operation_string (UMLOperation *operation)
}
strcat (str, param->type);
}
-
+
if (param->value != NULL && param->value[0] != '\0') {
strcat (str, "=");
strcat (str, param->value);
@@ -418,13 +416,13 @@ uml_get_operation_string (UMLOperation *operation)
strcat (str, ": ");
strcat (str, operation->type);
}
-
+
if (operation->query != 0) {
strcat(str, " const");
}
g_assert (strlen (str) == len);
-
+
return str;
}
diff --git a/objects/UML/umlparameter.c b/objects/UML/umlparameter.c
index 0fb35221..aea4c7c8 100644
--- a/objects/UML/umlparameter.c
+++ b/objects/UML/umlparameter.c
@@ -21,9 +21,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <string.h>
@@ -88,7 +86,7 @@ uml_parameter_destroy(UMLParameter *param)
{
g_free(param->name);
g_free(param->type);
- if (param->value != NULL)
+ if (param->value != NULL)
g_free(param->value);
g_free(param->comment);
@@ -103,7 +101,7 @@ uml_get_parameter_string (UMLParameter *param)
/* Calculate length: */
len = strlen (param->name) + 1 + strlen (param->type);
-
+
if (param->value != NULL) {
len += 1 + strlen (param->value) ;
}
@@ -120,7 +118,7 @@ uml_get_parameter_string (UMLParameter *param)
break;
case UML_INOUT:
len += 6;
- break;
+ break;
}
/* Generate string: */
@@ -131,7 +129,7 @@ uml_get_parameter_string (UMLParameter *param)
switch(param->kind)
{
case UML_UNDEF_KIND:
- break;
+ break;
case UML_IN:
strcat (str, "in ");
break;
@@ -142,7 +140,7 @@ uml_get_parameter_string (UMLParameter *param)
strcat (str, "inout ");
break;
}
-
+
strcat (str, param->name);
strcat (str, ":");
@@ -151,7 +149,7 @@ uml_get_parameter_string (UMLParameter *param)
strcat (str, "=");
strcat (str, param->value);
}
-
+
g_assert (strlen (str) == len);
return str;
diff --git a/objects/UML/usecase.c b/objects/UML/usecase.c
index c52e8efd..135e86ef 100644
--- a/objects/UML/usecase.c
+++ b/objects/UML/usecase.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -57,7 +55,7 @@ struct _Usecase {
struct _UsecasePropertiesDialog {
GtkWidget *dialog;
-
+
GtkToggleButton *text_out;
GtkToggleButton *collaboration;
};
@@ -94,7 +92,7 @@ static ObjectTypeOps usecase_type_ops =
(CreateFunc) usecase_create,
(LoadFunc) usecase_load,/*using_properties*/ /* load */
(SaveFunc) object_save_using_properties, /* save */
- (GetDefaultsFunc) NULL,
+ (GetDefaultsFunc) NULL,
(ApplyDefaultsFunc) NULL
};
@@ -133,11 +131,11 @@ static PropDescription usecase_props[] = {
PROP_STD_TEXT_FONT,
PROP_STD_TEXT_HEIGHT,
PROP_STD_TEXT_COLOUR_OPTIONAL,
- { "text", PROP_TYPE_TEXT, 0, N_("Text"), NULL, NULL },
+ { "text", PROP_TYPE_TEXT, 0, N_("Text"), NULL, NULL },
PROP_STD_LINE_WIDTH_OPTIONAL,
- PROP_STD_LINE_COLOUR_OPTIONAL,
- PROP_STD_FILL_COLOUR_OPTIONAL,
-
+ PROP_STD_LINE_COLOUR_OPTIONAL,
+ PROP_STD_FILL_COLOUR_OPTIONAL,
+
PROP_DESC_END
};
@@ -214,10 +212,10 @@ usecase_move(Usecase *usecase, Point *to)
{
real h;
Point p;
-
+
usecase->element.corner = *to;
h = usecase->text->height*usecase->text->numlines;
-
+
p = *to;
p.x += usecase->element.width/2.0;
if (usecase->text_outside) {
@@ -251,12 +249,12 @@ usecase_draw(Usecase *usecase, DiaRenderer *renderer)
w = USECASE_WIDTH;
h = USECASE_HEIGHT;
c.x = x + elem->width/2.0;
- c.y = y + USECASE_HEIGHT / 2.0;
+ c.y = y + USECASE_HEIGHT / 2.0;
} else {
w = elem->width;
h = elem->height;
c.x = x + w/2.0;
- c.y = y + h/2.0;
+ c.y = y + h/2.0;
}
@@ -265,14 +263,14 @@ usecase_draw(Usecase *usecase, DiaRenderer *renderer)
if (usecase->collaboration)
renderer_ops->set_linestyle(renderer, LINESTYLE_DASHED, 1.0);
- else
+ else
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID, 0.0);
- renderer_ops->draw_ellipse(renderer,
+ renderer_ops->draw_ellipse(renderer,
&c,
w, h,
- &usecase->fill_color, &usecase->line_color);
-
+ &usecase->fill_color, &usecase->line_color);
+
text_draw(usecase->text, renderer);
}
@@ -282,21 +280,21 @@ usecase_update_data(Usecase *usecase)
{
real w, h, ratio;
Point c, half, r,p;
-
+
Element *elem = &usecase->element;
ElementBBExtras *extra = &elem->extra_spacing;
DiaObject *obj = &elem->object;
-
+
text_calc_boundingbox(usecase->text, NULL);
w = usecase->text->max_width;
h = usecase->text->height*usecase->text->numlines;
- if (!usecase->text_outside) {
+ if (!usecase->text_outside) {
ratio = w/h;
- if (ratio > USECASE_MAX_RATIO)
+ if (ratio > USECASE_MAX_RATIO)
ratio = USECASE_MAX_RATIO;
-
+
if (ratio < USECASE_MIN_RATIO) {
ratio = USECASE_MIN_RATIO;
r.y = w / ratio + h;
@@ -305,7 +303,7 @@ usecase_update_data(Usecase *usecase)
r.x = ratio*h + w;
r.y = r.x / ratio;
}
- if (r.x < USECASE_WIDTH)
+ if (r.x < USECASE_WIDTH)
r.x = USECASE_WIDTH;
if (r.y < USECASE_HEIGHT)
r.y = USECASE_HEIGHT;
@@ -318,7 +316,7 @@ usecase_update_data(Usecase *usecase)
elem->height = r.y;
extra->border_trans = usecase->line_width / 2.0;
- if (usecase->text_outside) {
+ if (usecase->text_outside) {
elem->width = MAX(elem->width, w);
elem->height += h + USECASE_MARGIN_Y;
}
@@ -341,8 +339,8 @@ usecase_update_data(Usecase *usecase)
usecase->connections[3].pos.y = c.y;
usecase->connections[4].pos.x = c.x + r.x;
usecase->connections[4].pos.y = c.y;
-
- if (usecase->text_outside) {
+
+ if (usecase->text_outside) {
usecase->connections[5].pos.x = elem->corner.x;
usecase->connections[5].pos.y = elem->corner.y + elem->height;
usecase->connections[6].pos.x = c.x;
@@ -400,11 +398,11 @@ usecase_create(Point *startpoint,
Point p;
DiaFont *font;
int i;
-
+
usecase = g_malloc0(sizeof(Usecase));
elem = &usecase->element;
obj = &elem->object;
-
+
obj->type = &usecase_type;
obj->ops = &usecase_ops;
elem->corner = *startpoint;
@@ -419,14 +417,14 @@ usecase_create(Point *startpoint,
p = *startpoint;
p.x += USECASE_WIDTH/2.0;
p.y += USECASE_HEIGHT/2.0;
-
+
usecase->text = new_text("", font, 0.8, &p, &color_black, ALIGN_CENTER);
- dia_font_unref(font);
+ dia_font_unref(font);
usecase->text_outside = 0;
usecase->collaboration = 0;
element_init(elem, 8, NUM_CONNECTIONS);
-
+
for (i=0;i<NUM_CONNECTIONS;i++) {
obj->connections[i] = &usecase->connections[i];
usecase->connections[i].object = obj;
diff --git a/objects/chronogram/chronogram.c b/objects/chronogram/chronogram.c
index 994048d5..1f5a0916 100644
--- a/objects/chronogram/chronogram.c
+++ b/objects/chronogram/chronogram.c
@@ -1,6 +1,6 @@
/* Dia -- an diagram creation/manipulation program
* Copyright (C) 1998 Alexander Larsson
- *
+ *
* Chronogram objects support
* Copyright (C) 2000 Cyrille Chepelov
*
@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include "object.h"
@@ -41,7 +39,7 @@ dia_plugin_init(PluginInfo *info)
NULL, NULL))
return DIA_PLUGIN_INIT_ERROR;
- object_register_type(&chronoref_type);
+ object_register_type(&chronoref_type);
object_register_type(&chronoline_type);
return DIA_PLUGIN_INIT_OK;
diff --git a/objects/chronogram/chronoline.c b/objects/chronogram/chronoline.c
index b160bcc0..221da5ae 100644
--- a/objects/chronogram/chronoline.c
+++ b/objects/chronogram/chronoline.c
@@ -2,8 +2,8 @@
* Copyright (C) 1998 Alexander Larsson
*
* Chronogram objects support
- * Copyright (C) 2000, 2001 Cyrille Chepelov
- *
+ * Copyright (C) 2000, 2001 Cyrille Chepelov
+ *
* Ultimately forked from Flowchart toolbox -- objects for drawing flowcharts.
* Copyright (C) 1999 James Henstridge.
*
@@ -22,9 +22,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -67,7 +65,7 @@ typedef struct _Chronoline {
DiaFont *font;
real font_size;
Color font_color;
-
+
/* computed values : */
ConnPointLine *snap; /* not saved ; num_connections derived from
the event string. */
@@ -85,7 +83,7 @@ static void chronoline_select(Chronoline *chronoline, Point *clicked_point,
DiaRenderer *interactive_renderer);
static ObjectChange* chronoline_move_handle(Chronoline *chronoline, Handle *handle,
Point *to, ConnectionPoint *cp,
- HandleMoveReason reason,
+ HandleMoveReason reason,
ModifierKeys modifiers);
static ObjectChange* chronoline_move(Chronoline *chronoline, Point *to);
static void chronoline_draw(Chronoline *chronoline, DiaRenderer *renderer);
@@ -95,12 +93,12 @@ static DiaObject *chronoline_create(Point *startpoint,
Handle **handle1,
Handle **handle2);
static void chronoline_destroy(Chronoline *chronoline);
-static DiaObject *chronoline_load(ObjectNode obj_node, int version,
+static DiaObject *chronoline_load(ObjectNode obj_node, int version,
DiaContext *ctx);
static PropDescription *chronoline_describe_props(Chronoline *chronoline);
-static void chronoline_get_props(Chronoline *chronoline,
+static void chronoline_get_props(Chronoline *chronoline,
GPtrArray *props);
-static void chronoline_set_props(Chronoline *chronoline,
+static void chronoline_set_props(Chronoline *chronoline,
GPtrArray *props);
static ObjectTypeOps chronoline_type_ops =
@@ -154,7 +152,7 @@ static PropDescription chronoline_props[] = {
N_("Event specification"),N_(
"@ time set the pointer to an absolute time.\n"
"( duration set the signal up, then wait 'duration'.\n"
- ") duration set the signal down, then wait 'duration'.\n"
+ ") duration set the signal down, then wait 'duration'.\n"
"u duration set the signal to \"unknown\" state, then wait 'duration'.\n"
"Example: @ 1.0 (2.0)1.0(2.0)\n" )},
@@ -190,13 +188,13 @@ static PropDescription chronoline_props[] = {
};
static PropDescription *
-chronoline_describe_props(Chronoline *chronoline)
+chronoline_describe_props(Chronoline *chronoline)
{
if (chronoline_props[0].quark == 0) {
prop_desc_list_calculate_quarks(chronoline_props);
}
return chronoline_props;
-}
+}
static PropOffset chronoline_offsets[] = {
ELEMENT_COMMON_PROPERTIES_OFFSETS,
@@ -229,7 +227,7 @@ static PropOffset chronoline_offsets[] = {
static void
chronoline_get_props(Chronoline *chronoline, GPtrArray *props)
-{
+{
object_get_props_from_offsets(&chronoline->element.object,
chronoline_offsets,props);
}
@@ -265,7 +263,7 @@ chronoline_move_handle(Chronoline *chronoline, Handle *handle,
g_assert(handle!=NULL);
g_assert(to!=NULL);
- element_move_handle(&chronoline->element, handle->id, to, cp,
+ element_move_handle(&chronoline->element, handle->id, to, cp,
reason, modifiers);
chronoline_update_data(chronoline);
@@ -281,7 +279,7 @@ chronoline_move(Chronoline *chronoline, Point *to)
return NULL;
}
-static void
+static void
cld_onebit(Chronoline *chronoline,
DiaRenderer *renderer,
real x1,CLEventType s1,
@@ -292,7 +290,7 @@ cld_onebit(Chronoline *chronoline,
Point pts[4];
real y_down = chronoline->y_down;
real y_up = chronoline->y_up;
-
+
pts[0].x = pts[1].x = x1;
pts[2].x = pts[3].x = x2;
@@ -307,7 +305,7 @@ cld_onebit(Chronoline *chronoline,
} else {
renderer_ops->draw_polygon(renderer,pts,sizeof(pts)/sizeof(pts[0]),
&color_white, NULL);
- }
+ }
} else {
renderer_ops->draw_line(renderer,&pts[1],&pts[2],
&chronoline->data_color);
@@ -315,7 +313,7 @@ cld_onebit(Chronoline *chronoline,
}
-static void
+static void
cld_multibit(Chronoline *chronoline,
DiaRenderer *renderer,
real x1,CLEventType s1,
@@ -344,7 +342,7 @@ cld_multibit(Chronoline *chronoline,
pts[2].y = y_up;
}
- if (fill) {
+ if (fill) {
if ((s1 == CLE_UNKNOWN) || (s2 == CLE_UNKNOWN)) {
renderer_ops->draw_polygon(renderer,pts,sizeof(pts)/sizeof(pts[0]),
&chronoline->datagray, NULL);
@@ -363,7 +361,7 @@ cld_multibit(Chronoline *chronoline,
inline static void
-chronoline_draw_really(Chronoline *chronoline, DiaRenderer *renderer,
+chronoline_draw_really(Chronoline *chronoline, DiaRenderer *renderer,
gboolean fill)
{
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
@@ -377,7 +375,7 @@ chronoline_draw_really(Chronoline *chronoline, DiaRenderer *renderer,
CLEvent *evt;
real start_time = chronoline->start_time;
real end_time = chronoline->end_time;
-
+
oldx = elem->corner.x;
lst = chronoline->evtlist;
@@ -392,8 +390,8 @@ chronoline_draw_really(Chronoline *chronoline, DiaRenderer *renderer,
if (evt->time <= end_time) {
/* regular point */
newx = evt->x;
-
- if (chronoline->multibit)
+
+ if (chronoline->multibit)
cld_multibit(chronoline,renderer,oldx,state,newx,evt->type,fill);
else
cld_onebit(chronoline,renderer,oldx,state,newx,evt->type,fill);
@@ -401,24 +399,24 @@ chronoline_draw_really(Chronoline *chronoline, DiaRenderer *renderer,
} else {
newx = elem->corner.x + elem->width;
if (!finished) {
- if (chronoline->multibit)
+ if (chronoline->multibit)
cld_multibit(chronoline,renderer,oldx,state,newx,evt->type,fill);
else
cld_onebit(chronoline,renderer,oldx,state,newx,evt->type,fill);
finished = TRUE;
- }
- }
+ }
+ }
}
state = evt->type;
lst = g_slist_next(lst);
}
if (!finished) {
newx = chronoline->element.corner.x+chronoline->element.width;
- if (chronoline->multibit)
+ if (chronoline->multibit)
cld_multibit(chronoline,renderer,oldx,state,newx,state,fill);
else
cld_onebit(chronoline,renderer,oldx,state,newx,state,fill);
- }
+ }
}
static void
@@ -460,9 +458,9 @@ chronoline_draw(Chronoline *chronoline, DiaRenderer *renderer)
p2.y = chronoline->y_up;
renderer_ops->draw_line(renderer,&p1,&p2,&chronoline->color);
- renderer_ops->set_font(renderer, chronoline->font,
+ renderer_ops->set_font(renderer, chronoline->font,
chronoline->font_size);
- p3.y = lr_corner.y - chronoline->font_size
+ p3.y = lr_corner.y - chronoline->font_size
+ dia_font_ascent(chronoline->name,
chronoline->font,chronoline->font_size);
p3.x = p1.x - chronoline->main_lwidth;
@@ -488,7 +486,7 @@ chronoline_update_data(Chronoline *chronoline)
int shouldbe,i;
real realheight;
CLEventList *lst;
- CLEvent *evt;
+ CLEvent *evt;
GSList *conn_elem;
ElementBBExtras *extra = &elem->extra_spacing;
@@ -501,7 +499,7 @@ chronoline_update_data(Chronoline *chronoline)
chronoline->y_up = elem->corner.y;
chronoline->y_down = elem->corner.y + elem->height;
-
+
/* Now, update the drawing helper counters */
time_span = chronoline->end_time - chronoline->start_time;
if (time_span == 0) {
@@ -519,13 +517,13 @@ chronoline_update_data(Chronoline *chronoline)
/* fix boundingbox for special extras: */
realheight = obj->bounding_box.bottom - obj->bounding_box.top;
realheight = MAX(realheight,chronoline->font_size);
-
+
obj->bounding_box.left -= chronoline->labelwidth;
- obj->bounding_box.bottom = obj->bounding_box.top + realheight +
+ obj->bounding_box.bottom = obj->bounding_box.top + realheight +
chronoline->main_lwidth;
-
+
obj->position = elem->corner;
-
+
element_update_handles(elem);
/* Update connections: */
@@ -534,7 +532,7 @@ chronoline_update_data(Chronoline *chronoline)
/* Update the events : count those which fit in [start_time,end_time].
*/
-
+
reparse_clevent(chronoline->events,
&chronoline->evtlist,
&chronoline->checksum,
@@ -546,8 +544,8 @@ chronoline_update_data(Chronoline *chronoline)
while (lst) {
evt = (CLEvent *)lst->data;
-
- if ((evt->time >= chronoline->start_time) &&
+
+ if ((evt->time >= chronoline->start_time) &&
(evt->time <= chronoline->end_time))
shouldbe++;
lst = g_slist_next(lst);
@@ -564,10 +562,10 @@ chronoline_update_data(Chronoline *chronoline)
while (lst && lst->data && conn_elem && conn_elem->data) {
ConnectionPoint *cp = (ConnectionPoint *)(conn_elem->data);
evt = (CLEvent *)lst->data;
-
- if ((evt->time >= chronoline->start_time) &&
+
+ if ((evt->time >= chronoline->start_time) &&
(evt->time <= chronoline->end_time)) {
- evt->x = elem->corner.x +
+ evt->x = elem->corner.x +
elem->width*(evt->time-chronoline->start_time)/time_span;
g_assert(cp);
g_assert(i < chronoline->snap->num_connections);
@@ -583,7 +581,7 @@ chronoline_update_data(Chronoline *chronoline)
i++;
conn_elem = g_slist_next(conn_elem);
} else if (evt->time >= chronoline->start_time) {
- evt->x = elem->corner.x;
+ evt->x = elem->corner.x;
} else if (evt->time <= chronoline->end_time) {
evt->x = elem->corner.x + elem->width;
}
@@ -608,7 +606,7 @@ chronoline_create(Point *startpoint,
obj->type = &chronoline_type;
obj->ops = &chronoline_ops;
- chronoline->snap = connpointline_create(obj,0);
+ chronoline->snap = connpointline_create(obj,0);
elem->corner = *startpoint;
elem->width = 20.0;
@@ -634,16 +632,16 @@ chronoline_create(Point *startpoint,
chronoline->data_color.blue = 0.0;
chronoline->data_color.alpha = 1.0;
chronoline->multibit = FALSE;
-
+
chronoline->evtlist = NULL;
chronoline_update_data(chronoline);
*handle1 = NULL;
- *handle2 = obj->handles[7];
+ *handle2 = obj->handles[7];
return &chronoline->element.object;
}
-static void
+static void
chronoline_destroy(Chronoline *chronoline)
{
g_free(chronoline->name);
@@ -658,5 +656,5 @@ static DiaObject *
chronoline_load(ObjectNode obj_node, int version, DiaContext *ctx)
{
return object_load_using_properties(&chronoline_type,
- obj_node,version,ctx);
+ obj_node,version,ctx);
}
diff --git a/objects/chronogram/chronoref.c b/objects/chronogram/chronoref.c
index a82e532d..68069586 100644
--- a/objects/chronogram/chronoref.c
+++ b/objects/chronogram/chronoref.c
@@ -2,8 +2,8 @@
* Copyright (C) 1998 Alexander Larsson
*
* Chronogram objects support
- * Copyright (C) 2000, 2001 Cyrille Chepelov
- *
+ * Copyright (C) 2000, 2001 Cyrille Chepelov
+ *
* Ultimately forked from Flowchart toolbox -- objects for drawing flowcharts.
* Copyright (C) 1999 James Henstridge.
*
@@ -22,9 +22,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -58,7 +56,7 @@ typedef struct _Chronoref {
real end_time;
real time_step;
real time_lstep;
-
+
DiaFont *font;
real font_size;
Color font_color;
@@ -76,7 +74,7 @@ static void chronoref_select(Chronoref *chronoref, Point *clicked_point,
DiaRenderer *interactive_renderer);
static ObjectChange* chronoref_move_handle(Chronoref *chronoref, Handle *handle,
Point *to, ConnectionPoint *cp,
- HandleMoveReason reason,
+ HandleMoveReason reason,
ModifierKeys modifiers);
static ObjectChange* chronoref_move(Chronoref *chronoref, Point *to);
static void chronoref_draw(Chronoref *chronoref, DiaRenderer *renderer);
@@ -86,12 +84,12 @@ static DiaObject *chronoref_create(Point *startpoint,
Handle **handle1,
Handle **handle2);
static void chronoref_destroy(Chronoref *chronoref);
-static DiaObject *chronoref_load(ObjectNode obj_node, int version,
+static DiaObject *chronoref_load(ObjectNode obj_node, int version,
DiaContext *ctx);
static PropDescription *chronoref_describe_props(Chronoref *chronoref);
-static void chronoref_get_props(Chronoref *chronoref,
+static void chronoref_get_props(Chronoref *chronoref,
GPtrArray *props);
-static void chronoref_set_props(Chronoref *chronoref,
+static void chronoref_set_props(Chronoref *chronoref,
GPtrArray *props);
@@ -172,13 +170,13 @@ static PropDescription chronoref_props[] = {
};
static PropDescription *
-chronoref_describe_props(Chronoref *chronoref)
+chronoref_describe_props(Chronoref *chronoref)
{
if (chronoref_props[0].quark == 0) {
prop_desc_list_calculate_quarks(chronoref_props);
}
return chronoref_props;
-}
+}
static PropOffset chronoref_offsets[] = {
ELEMENT_COMMON_PROPERTIES_OFFSETS,
@@ -208,7 +206,7 @@ static PropOffset chronoref_offsets[] = {
static void
chronoref_get_props(Chronoref *chronoref, GPtrArray *props)
-{
+{
object_get_props_from_offsets(&chronoref->element.object,
chronoref_offsets,props);
}
@@ -244,7 +242,7 @@ chronoref_move_handle(Chronoref *chronoref, Handle *handle,
g_assert(handle!=NULL);
g_assert(to!=NULL);
- element_move_handle(&chronoref->element, handle->id, to, cp,
+ element_move_handle(&chronoref->element, handle->id, to, cp,
reason, modifiers);
chronoref_update_data(chronoref);
@@ -272,7 +270,7 @@ chronoref_draw(Chronoref *chronoref, DiaRenderer *renderer)
assert(renderer != NULL);
elem = &chronoref->element;
-
+
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID, 0.0);
renderer_ops->set_linejoin(renderer, LINEJOIN_MITER);
@@ -283,17 +281,17 @@ chronoref_draw(Chronoref *chronoref, DiaRenderer *renderer)
p1.y = p2.y = elem->corner.y;
renderer_ops->set_font(renderer, chronoref->font, chronoref->font_size);
- p3.y = p2.y + chronoref->majgrad_height +
+ p3.y = p2.y + chronoref->majgrad_height +
dia_font_ascent("1",chronoref->font, chronoref->font_size);
renderer_ops->set_linewidth(renderer, chronoref->light_lwidth);
if (chronoref->time_lstep > 0.0) {
p2.y = p1.y + chronoref->mingrad_height;
- for (t = chronoref->firstmaj, p1.x = chronoref->firstmin_x;
- p1.x <= lr_corner.x;
+ for (t = chronoref->firstmaj, p1.x = chronoref->firstmin_x;
+ p1.x <= lr_corner.x;
t += chronoref->time_lstep, p1.x += chronoref->mingrad) {
p2.x = p1.x;
-
+
renderer_ops->draw_line(renderer,&p1,&p2,&chronoref->color);
}
}
@@ -302,12 +300,12 @@ chronoref_draw(Chronoref *chronoref, DiaRenderer *renderer)
if (chronoref->time_step > 0.0) {
p2.y = p1.y + chronoref->majgrad_height;
- for (t = chronoref->firstmaj, p1.x = chronoref->firstmaj_x;
- p1.x <= lr_corner.x;
+ for (t = chronoref->firstmaj, p1.x = chronoref->firstmaj_x;
+ p1.x <= lr_corner.x;
t += chronoref->time_step, p1.x += chronoref->majgrad) {
char time[10];
p3.x = p2.x = p1.x;
-
+
renderer_ops->draw_line(renderer,&p1,&p2,&chronoref->color);
g_snprintf(time,sizeof(time),"%.*f",chronoref->spec,t);
renderer_ops->draw_string(renderer,time,&p3,ALIGN_CENTER,
@@ -340,7 +338,7 @@ chronoref_update_data(Chronoref *chronoref)
/* build i = -log_{10}(time_step), then make a %.if format out of it. */
t = 1;
i = 0;
-
+
while (t > chronoref->time_step) {
t /= 10;
i++;
@@ -348,7 +346,7 @@ chronoref_update_data(Chronoref *chronoref)
chronoref->spec = i; /* update precision */
g_snprintf(biglabel,sizeof(biglabel),"%.*f", chronoref->spec,
MIN(-ABS(chronoref->start_time),-ABS(chronoref->end_time)));
-
+
labelwidth = dia_font_string_width(biglabel,chronoref->font,
chronoref->font_size);
@@ -363,18 +361,18 @@ chronoref_update_data(Chronoref *chronoref)
chronoref->end_time = chronoref->start_time + time_span;
}
- chronoref->firstmaj = chronoref->time_step *
+ chronoref->firstmaj = chronoref->time_step *
ceil(chronoref->start_time / chronoref->time_step);
if (chronoref->firstmaj < chronoref->start_time)
chronoref->firstmaj += chronoref->time_step;
- chronoref->firstmin = chronoref->time_lstep *
+ chronoref->firstmin = chronoref->time_lstep *
ceil(chronoref->start_time / chronoref->time_lstep);
if (chronoref->firstmin < chronoref->start_time)
chronoref->firstmin += chronoref->time_lstep;
- chronoref->firstmaj_x = elem->corner.x +
+ chronoref->firstmaj_x = elem->corner.x +
elem->width*((chronoref->firstmaj-chronoref->start_time)/time_span);
- chronoref->firstmin_x = elem->corner.x +
+ chronoref->firstmin_x = elem->corner.x +
elem->width*((chronoref->firstmin-chronoref->start_time)/time_span);
chronoref->majgrad = (chronoref->time_step * elem->width) / time_span;
chronoref->mingrad = (chronoref->time_lstep * elem->width) / time_span;
@@ -386,9 +384,9 @@ chronoref_update_data(Chronoref *chronoref)
obj->bounding_box.left -= (chronoref->font_size + labelwidth)/2;
obj->bounding_box.bottom += chronoref->font_size;
obj->bounding_box.right += (chronoref->font_size + labelwidth)/2;
-
+
obj->position = elem->corner;
-
+
element_update_handles(elem);
/* Update connections: */
@@ -406,7 +404,7 @@ chronoref_update_data(Chronoref *chronoref)
point_copy(&p1,&elem->corner); point_copy(&p2,&ur_corner);
p1.x -= chronoref->mingrad;
- p2.x += chronoref->mingrad;
+ p2.x += chronoref->mingrad;
connpointline_putonaline(chronoref->scale,&p1,&p2, DIR_SOUTH);
}
@@ -427,7 +425,7 @@ chronoref_create(Point *startpoint,
obj->type = &chronoref_type;
obj->ops = &chronoref_ops;
- chronoref->scale = connpointline_create(obj,0);
+ chronoref->scale = connpointline_create(obj,0);
elem->corner = *startpoint;
elem->width = 20.0;
@@ -449,7 +447,7 @@ chronoref_create(Point *startpoint,
chronoref_update_data(chronoref);
*handle1 = NULL;
- *handle2 = obj->handles[7];
+ *handle2 = obj->handles[7];
return &chronoref->element.object;
}
@@ -465,5 +463,5 @@ static DiaObject *
chronoref_load(ObjectNode obj_node, int version, DiaContext *ctx)
{
return object_load_using_properties(&chronoref_type,
- obj_node,version,ctx);
+ obj_node,version,ctx);
}
diff --git a/objects/custom/custom_object.c b/objects/custom/custom_object.c
index d22a195d..8508a97c 100644
--- a/objects/custom/custom_object.c
+++ b/objects/custom/custom_object.c
@@ -22,9 +22,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <gmodule.h>
@@ -83,7 +81,7 @@ struct _Custom {
/*!
* The sub-scale variables
- * The old_subscale is used for interactive
+ * The old_subscale is used for interactive
* (shift-pressed) scaling
* @{
*/
@@ -93,8 +91,8 @@ struct _Custom {
/*!
* \brief Pointer changing during the drawing of the display list
* this is sort of a hack, passing a temporary value
- * using this field, but otherwise
- * sub-shapes are going to need major code refactoring:
+ * using this field, but otherwise
+ * sub-shapes are going to need major code refactoring:
*/
GraphicElementSubShape* current_subshape;
/*! Connection points need to be dynamically allocated */
@@ -111,7 +109,7 @@ struct _Custom {
Text *text;
real padding;
-
+
TextFitting text_fitting;
};
@@ -120,17 +118,17 @@ static void custom_select(Custom *custom, Point *clicked_point,
DiaRenderer *interactive_renderer);
static ObjectChange* custom_move_handle(Custom *custom, Handle *handle,
Point *to, ConnectionPoint *cp,
- HandleMoveReason reason,
+ HandleMoveReason reason,
ModifierKeys modifiers);
static ObjectChange* custom_move(Custom *custom, Point *to);
static void custom_draw(Custom *custom, DiaRenderer *renderer);
static void custom_draw_displaylist(GList *display_list, Custom *custom,
DiaRenderer *renderer, GArray *arr, GArray *barr, real* cur_line,
- real* cur_dash, LineCaps* cur_caps, LineJoin* cur_join,
+ real* cur_dash, LineCaps* cur_caps, LineJoin* cur_join,
LineStyle* cur_style);
static void custom_draw_element(GraphicElement* el, Custom *custom,
DiaRenderer *renderer, GArray *arr, GArray *barr, real* cur_line,
- real* cur_dash, LineCaps* cur_caps, LineJoin* cur_join,
+ real* cur_dash, LineCaps* cur_caps, LineJoin* cur_join,
LineStyle* cur_style, Color* fg, Color* bg);
static void custom_update_data(Custom *custom, AnchorShape h, AnchorShape v);
static void custom_reposition_text(Custom *custom, GraphicElementText *text);
@@ -159,7 +157,7 @@ static ObjectTypeOps custom_type_ops =
/* This looks like it could be static, but it can't because we key
on it to determine if an DiaObjectType is a custom/SVG shape */
-G_MODULE_EXPORT
+G_MODULE_EXPORT
DiaObjectType custom_type =
{
"Custom - Generic", /* name */
@@ -198,7 +196,7 @@ static PropDescription custom_props[] = {
N_("Flip horizontal"), NULL, NULL },
{ "flip_vertical", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE|PROP_FLAG_OPTIONAL,
N_("Flip vertical"), NULL, NULL },
-
+
{ "subscale", PROP_TYPE_REAL, PROP_FLAG_OPTIONAL,
N_("Scale of the sub-shapes"), NULL, NULL },
PROP_DESC_END
@@ -220,7 +218,7 @@ static PropDescription custom_props_text[] = {
PROP_STD_TEXT_HEIGHT,
PROP_STD_TEXT_COLOUR,
/* BEWARE: the following makes the whole Text optional during load. Normally this
- * would leave the object in an inconsistent state but here we have a proper default
+ * would leave the object in an inconsistent state but here we have a proper default
* initialization even in the load case. See custom_load_using_properties() --hb
*/
{ "text", PROP_TYPE_TEXT, PROP_FLAG_OPTIONAL,
@@ -231,7 +229,7 @@ static PropDescription custom_props_text[] = {
N_("Flip horizontal"), NULL, NULL },
{ "flip_vertical", PROP_TYPE_BOOL, PROP_FLAG_VISIBLE|PROP_FLAG_OPTIONAL,
N_("Flip vertical"), NULL, NULL },
-
+
{ "subscale", PROP_TYPE_REAL, PROP_FLAG_OPTIONAL,
N_("Scale of the sub-shapes"), NULL, NULL },
PROP_DESC_END
@@ -366,7 +364,7 @@ custom_setup_properties (ShapeInfo *info, xmlNodePtr node)
info->prop_offsets[i].type = info->props[i].type;
info->prop_offsets[i].offset = offs;
/* FIXME:
- custom_object.c:328: warning: passing arg 1 of pointer to function
+ custom_object.c:328: warning: passing arg 1 of pointer to function
from incompatible pointer type
We don't have a Property* here so there is not much we can do about.
Maybe it even works cause the sizeof() in *_get_data_size can be
@@ -418,7 +416,7 @@ transform_subshape_coord(Custom *custom, GraphicElementSubShape* subshape,
real svg_height = info->shape_bounds.bottom - info->shape_bounds.top;
real h_scale = info->default_height / svg_height;
real v_scale = info->default_width / svg_width;
-
+
subshape->default_scale = (v_scale > h_scale ? h_scale : v_scale);
}
@@ -426,7 +424,7 @@ transform_subshape_coord(Custom *custom, GraphicElementSubShape* subshape,
xoffs = custom->xoffs;
yoffs = custom->yoffs;
-
+
/* step 1: calculate boundaries */
orig_bounds = custom->info->shape_bounds;
@@ -454,7 +452,7 @@ transform_subshape_coord(Custom *custom, GraphicElementSubShape* subshape,
cx = new_bounds.left + (subshape->center.x * scale);
}
}
-
+
if (subshape->v_anchor_method == OFFSET_METHOD_PROPORTIONAL) {
/* handle proportional offset in y direction */
cy = subshape->center.y * custom->yscale;
@@ -705,7 +703,7 @@ static void
custom_adjust_scale(Custom *custom, Handle *handle,
Point *to, ConnectionPoint *cp,
HandleMoveReason reason, ModifierKeys modifiers)
-{
+{
static int uniform_scale = FALSE;
static Point orig_pos;
@@ -717,7 +715,7 @@ custom_adjust_scale(Custom *custom, Handle *handle,
orig_pos.x = to->x;
orig_pos.y = to->y;
}
-
+
if ((modifiers & MODIFIER_SHIFT) != 0) {
if (!uniform_scale) /* transition */
custom->old_subscale = MAX(custom->subscale, 0.0);
@@ -727,7 +725,7 @@ custom_adjust_scale(Custom *custom, Handle *handle,
}
delta_max = (to->x - orig_pos.x);
-
+
#ifdef USE_DELTA_MAX
/* This may yield some awkard effects for new-comers.
* Maybe we should make it a configurable option.
@@ -735,7 +733,7 @@ custom_adjust_scale(Custom *custom, Handle *handle,
if (ABS(to->y - orig_pos.y) > ABS(delta_max))
delta_max = (to->y - orig_pos.y);
#endif
-
+
if (uniform_scale)
custom->subscale =
custom->old_subscale + (SUBSCALE_ACCELERATION * delta_max);
@@ -749,7 +747,7 @@ custom_adjust_scale(Custom *custom, Handle *handle,
break;
default:
break;
- }
+ }
}
static ObjectChange*
@@ -778,7 +776,7 @@ custom_move_handle(Custom *custom, Handle *handle,
case HANDLE_MOVE_CREATE_FINAL : /* silence gcc */
custom_adjust_scale(custom, handle, to, cp, reason, modifiers);
}
-
+
element_move_handle(&custom->element, handle->id, to, cp, reason, modifiers);
switch (handle->id) {
@@ -868,7 +866,7 @@ custom_draw(Custom *custom, DiaRenderer *renderer)
renderer_ops->set_linecaps(renderer, cur_caps);
renderer_ops->set_linejoin(renderer, cur_join);
- /*
+ /*
* Because we do not know if any of these values are reused in the loop, we pass
* them all by reference.
* If anyone does know this, please correct/simplify.
@@ -891,8 +889,8 @@ custom_draw_displaylist(GList *display_list, Custom *custom, DiaRenderer *render
GraphicElement *el = tmp->data;
Color fg, bg;
- /*
- * Because we do not know if any of these values are reused in the loop,
+ /*
+ * Because we do not know if any of these values are reused in the loop,
* we pass them all by reference.
* If anyone does know this, please correct/simplify.
*/
@@ -902,7 +900,7 @@ custom_draw_displaylist(GList *display_list, Custom *custom, DiaRenderer *render
}
static void
-custom_draw_element(GraphicElement* el, Custom *custom, DiaRenderer *renderer,
+custom_draw_element(GraphicElement* el, Custom *custom, DiaRenderer *renderer,
GArray *arr, GArray *barr, real* cur_line, real* cur_dash,
LineCaps* cur_caps, LineJoin* cur_join, LineStyle* cur_style,
Color* fg, Color* bg)
@@ -947,7 +945,7 @@ custom_draw_element(GraphicElement* el, Custom *custom, DiaRenderer *renderer,
renderer_ops->set_linestyle(renderer, (*cur_style),
custom->dashlength*(*cur_dash));
}
-
+
(*cur_line) = el->any.s.line_width;
get_colour(custom, fg, el->any.s.stroke, el->any.s.stroke_opacity);
get_colour(custom, bg, el->any.s.fill, el->any.s.fill_opacity);
@@ -1063,7 +1061,7 @@ custom_draw_element(GraphicElement* el, Custom *custom, DiaRenderer *renderer,
case GE_SUBSHAPE:
{
GraphicElementSubShape* subshape = (GraphicElementSubShape*)el;
-
+
custom->current_subshape = subshape;
custom_draw_displaylist(subshape->display_list, custom, renderer, arr, barr, cur_line, cur_dash,
cur_caps, cur_join, cur_style);
custom->current_subshape = NULL;
@@ -1188,14 +1186,14 @@ custom_update_data(Custom *custom, AnchorShape horiz, AnchorShape vert)
info->shape_bounds.top);
/* resize shape if text does not fit inside text_bounds */
- if ( (info->has_text)
+ if ( (info->has_text)
&& (custom->text_fitting != TEXTFIT_NEVER)) {
real text_width, text_height;
real xscale = 0.0, yscale = 0.0;
Rectangle tb;
text_calc_boundingbox(custom->text, NULL);
- text_width =
+ text_width =
custom->text->max_width + 2*custom->padding+custom->border_width;
text_height = custom->text->height * custom->text->numlines +
2 * custom->padding + custom->border_width;
@@ -1342,9 +1340,9 @@ custom_update_data(Custom *custom, AnchorShape horiz, AnchorShape vert)
* in a complex shape (and not break backward compatibility). With
real lwfactor = custom->border_width / 2;
* we get traces in the diagram at high zoom levels, so use something more
- * safe for the bounding box calculation
+ * safe for the bounding box calculation
*/
- real lwfactor = el->any.s.line_width == custom->border_width
+ real lwfactor = el->any.s.line_width == custom->border_width
? 1.0 : custom->border_width;
switch(el->type) {
@@ -1362,13 +1360,13 @@ custom_update_data(Custom *custom, AnchorShape horiz, AnchorShape vert)
transform_coord(custom, &el->line.p2, &p2);
line_bbox(&p1,&p2,&extra,&rect);
- break;
+ break;
}
case GE_POLYGON:
case GE_POLYLINE: {
PolyBBExtras extra;
- extra.start_trans = extra.end_trans = extra.middle_trans =
+ extra.start_trans = extra.end_trans = extra.middle_trans =
el->polyline.s.line_width * lwfactor;
extra.start_long = extra.end_long = 0;
@@ -1384,7 +1382,7 @@ custom_update_data(Custom *custom, AnchorShape horiz, AnchorShape vert)
case GE_SHAPE:
case GE_PATH: {
PolyBBExtras extra;
- extra.start_trans = extra.end_trans = extra.middle_trans =
+ extra.start_trans = extra.end_trans = extra.middle_trans =
el->path.s.line_width * lwfactor;
extra.start_long = extra.end_long = 0;
@@ -1416,7 +1414,7 @@ custom_update_data(Custom *custom, AnchorShape horiz, AnchorShape vert)
el->ellipse.width * fabs(custom->xscale),
el->ellipse.height * fabs(custom->yscale),
&extra,&rect);
- break;
+ break;
}
case GE_RECT: {
ElementBBExtras extra;
@@ -1429,7 +1427,7 @@ custom_update_data(Custom *custom, AnchorShape horiz, AnchorShape vert)
extra.border_trans = el->rect.s.line_width * lwfactor;
rectangle_bbox(&trin,&extra,&rect);
- break;
+ break;
}
case GE_IMAGE: {
Rectangle bounds;
@@ -1474,8 +1472,8 @@ custom_update_data(Custom *custom, AnchorShape horiz, AnchorShape vert)
}
/* reposition the text element to the new text bounding box ... */
-static void
-custom_reposition_text(Custom *custom, GraphicElementText *text)
+static void
+custom_reposition_text(Custom *custom, GraphicElementText *text)
{
Element *elem = &custom->element;
Point p;
@@ -1605,7 +1603,7 @@ custom_create(Point *startpoint,
custom_update_data(custom, ANCHOR_MIDDLE, ANCHOR_MIDDLE);
*handle1 = NULL;
- *handle2 = obj->handles[7];
+ *handle2 = obj->handles[7];
return &custom->element.object;
}
@@ -1617,7 +1615,7 @@ custom_destroy(Custom *custom)
/*
* custom_destroy is called per object. It _must not_ destroy class stuff
- * (ShapeInfo) cause it does not hold a reference to it. Fixes e.g.
+ * (ShapeInfo) cause it does not hold a reference to it. Fixes e.g.
* bug #158288, #160550, ...
* DONT TOUCH : custom->info->display_list
*/
@@ -1638,7 +1636,7 @@ custom_copy(Custom *custom)
DiaObject *newobj;
elem = &custom->element;
- /* can't use object_copy_using_properties() becauses there is no way
+ /* 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;
@@ -1654,7 +1652,7 @@ custom_copy(Custom *custom)
if (custom->info->has_text) {
newcustom->text = text_copy(custom->text);
- }
+ }
newcustom->connections = g_new0(ConnectionPoint, custom->info->nconnections);
for (i = 0; i < custom->info->nconnections; i++) {
@@ -1742,7 +1740,7 @@ custom_flip_h_callback (DiaObject *obj, Point *clicked, gpointer data)
custom->flip_h = !custom->flip_h;
custom_update_data(custom, ANCHOR_MIDDLE, ANCHOR_MIDDLE);
-
+
return &change->objchange;
}
@@ -1779,7 +1777,7 @@ static DiaMenu custom_menu = {
static DiaMenu *
custom_get_object_menu(Custom *custom, Point *clickedpoint)
{
- if (custom_menu.title && custom->info->name &&
+ if (custom_menu.title && custom->info->name &&
(0 != strcmp(custom_menu.title,custom->info->name))) {
if (custom_menu.app_data_free) custom_menu.app_data_free(&custom_menu);
}
diff --git a/objects/flowchart/box.c b/objects/flowchart/box.c
index f9948f1e..f10663d3 100644
--- a/objects/flowchart/box.c
+++ b/objects/flowchart/box.c
@@ -21,9 +21,7 @@
/* DO NOT USE THIS OBJECT AS A BASIS FOR A NEW OBJECT. */
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -84,7 +82,7 @@ static void box_select(Box *box, Point *clicked_point,
DiaRenderer *interactive_renderer);
static ObjectChange* box_move_handle(Box *box, Handle *handle,
Point *to, ConnectionPoint *cp,
- HandleMoveReason reason,
+ HandleMoveReason reason,
ModifierKeys modifiers);
static ObjectChange* box_move(Box *box, Point *to);
static void box_draw(Box *box, DiaRenderer *renderer);
@@ -156,7 +154,7 @@ static PropDescription box_props[] = {
PROP_STD_TEXT_ALIGNMENT,
PROP_STD_TEXT_FITTING,
PROP_STD_SAVED_TEXT,
-
+
{ NULL, 0, 0, NULL, NULL, NULL, 0}
};
@@ -307,7 +305,7 @@ static ObjectChange*
box_move(Box *box, Point *to)
{
box->element.corner = *to;
-
+
box_update_data(box, ANCHOR_MIDDLE, ANCHOR_MIDDLE);
return NULL;
@@ -319,7 +317,7 @@ box_draw(Box *box, DiaRenderer *renderer)
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
Point lr_corner;
Element *elem;
-
+
assert(box != NULL);
assert(renderer != NULL);
elem = &box->element;
@@ -329,7 +327,7 @@ box_draw(Box *box, DiaRenderer *renderer)
if (box->show_background)
renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID);
-
+
renderer_ops->set_linewidth(renderer, box->border_width);
renderer_ops->set_linestyle(renderer, box->line_style, box->dashlength);
renderer_ops->set_linejoin(renderer, LINEJOIN_MITER);
@@ -419,7 +417,7 @@ box_update_data(Box *box, AnchorShape horiz, AnchorShape vert)
radius = MIN(radius, elem->width/2);
radius = MIN(radius, elem->height/2);
radius *= (1-M_SQRT1_2);
-
+
/* Update connections: */
connpoint_update(&box->connections[0],
elem->corner.x + radius,
@@ -492,9 +490,9 @@ box_update_data(Box *box, AnchorShape horiz, AnchorShape vert)
extra->border_trans = box->border_width / 2.0;
element_update_boundingbox(elem);
-
+
obj->position = elem->corner;
-
+
element_update_handles(elem);
if (radius > 0.0) {
@@ -529,7 +527,7 @@ box_create(Point *startpoint,
box = g_malloc0(sizeof(Box));
elem = &box->element;
obj = &elem->object;
-
+
obj->type = &fc_box_type;
obj->ops = &box_ops;
@@ -554,7 +552,7 @@ box_create(Point *startpoint,
box->text = new_text("", font, font_height, &p, &box->border_color,
ALIGN_CENTER);
dia_font_unref(font);
-
+
/* new default: let the user decide the size */
box->text_fitting = TEXTFIT_WHEN_NEEDED;
@@ -571,7 +569,7 @@ box_create(Point *startpoint,
box_update_data(box, ANCHOR_MIDDLE, ANCHOR_MIDDLE);
*handle1 = NULL;
- *handle2 = obj->handles[7];
+ *handle2 = obj->handles[7];
return &box->element.object;
}
@@ -591,22 +589,22 @@ box_save(Box *box, ObjectNode obj_node, DiaContext *ctx)
if (box->border_width != 0.1)
data_add_real(new_attribute(obj_node, "border_width"),
box->border_width, ctx);
-
+
if (!color_equals(&box->border_color, &color_black))
data_add_color(new_attribute(obj_node, "border_color"),
&box->border_color, ctx);
-
+
if (!color_equals(&box->inner_color, &color_white))
data_add_color(new_attribute(obj_node, "inner_color"),
&box->inner_color, ctx);
-
- data_add_boolean(new_attribute(obj_node, "show_background"),
+
+ data_add_boolean(new_attribute(obj_node, "show_background"),
box->show_background, ctx);
if (box->line_style != LINESTYLE_SOLID)
data_add_enum(new_attribute(obj_node, "line_style"),
box->line_style, ctx);
-
+
if (box->line_style != LINESTYLE_SOLID &&
box->dashlength != DEFAULT_LINESTYLE_DASHLEN)
data_add_real(new_attribute(obj_node, "dashlength"),
@@ -636,7 +634,7 @@ box_load(ObjectNode obj_node, int version,DiaContext *ctx)
box = g_malloc0(sizeof(Box));
elem = &box->element;
obj = &elem->object;
-
+
obj->type = &fc_box_type;
obj->ops = &box_ops;
@@ -650,12 +648,12 @@ box_load(ObjectNode obj_node, int version,DiaContext *ctx)
attr = object_find_attribute(obj_node, "border_color");
if (attr != NULL)
data_color(attribute_first_data(attr), &box->border_color, ctx);
-
+
box->inner_color = color_white;
attr = object_find_attribute(obj_node, "inner_color");
if (attr != NULL)
data_color(attribute_first_data(attr), &box->inner_color, ctx);
-
+
box->show_background = TRUE;
attr = object_find_attribute(obj_node, "show_background");
if (attr != NULL)
diff --git a/objects/flowchart/diamond.c b/objects/flowchart/diamond.c
index 9018150d..5bedcd65 100644
--- a/objects/flowchart/diamond.c
+++ b/objects/flowchart/diamond.c
@@ -21,9 +21,7 @@
/* DO NOT USE THIS OBJECT AS A BASIS FOR A NEW OBJECT. */
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -67,7 +65,7 @@ struct _Diamond {
Text *text;
real padding;
-
+
TextFitting text_fitting;
};
@@ -84,7 +82,7 @@ static void diamond_select(Diamond *diamond, Point *clicked_point,
DiaRenderer *interactive_renderer);
static ObjectChange* diamond_move_handle(Diamond *diamond, Handle *handle,
Point *to, ConnectionPoint *cp,
- HandleMoveReason reason,
+ HandleMoveReason reason,
ModifierKeys modifiers);
static ObjectChange* diamond_move(Diamond *diamond, Point *to);
static void diamond_draw(Diamond *diamond, DiaRenderer *renderer);
@@ -154,7 +152,7 @@ static PropDescription diamond_props[] = {
PROP_STD_TEXT_ALIGNMENT,
PROP_STD_TEXT_FITTING,
PROP_STD_SAVED_TEXT,
-
+
{ NULL, 0, 0, NULL, NULL, NULL, 0}
};
@@ -282,7 +280,7 @@ diamond_move_handle(Diamond *diamond, Handle *handle,
width = diamond->element.width;
height = diamond->element.height;
- element_move_handle(&diamond->element, handle->id, to, cp,
+ element_move_handle(&diamond->element, handle->id, to, cp,
reason, modifiers);
switch (handle->id) {
@@ -317,7 +315,7 @@ static ObjectChange*
diamond_move(Diamond *diamond, Point *to)
{
diamond->element.corner = *to;
-
+
diamond_update_data(diamond, ANCHOR_MIDDLE, ANCHOR_MIDDLE);
return NULL;
@@ -329,7 +327,7 @@ diamond_draw(Diamond *diamond, DiaRenderer *renderer)
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
Point pts[4];
Element *elem;
-
+
assert(diamond != NULL);
assert(renderer != NULL);
@@ -350,7 +348,7 @@ diamond_draw(Diamond *diamond, DiaRenderer *renderer)
renderer_ops->set_linestyle(renderer, diamond->line_style, diamond->dashlength);
renderer_ops->set_linejoin(renderer, LINEJOIN_MITER);
- renderer_ops->draw_polygon (renderer,
+ renderer_ops->draw_polygon (renderer,
pts, 4,
(diamond->show_background) ? &diamond->inner_color : NULL,
&diamond->border_color);
@@ -475,9 +473,9 @@ diamond_update_data(Diamond *diamond, AnchorShape horiz, AnchorShape vert)
extra->border_trans = diamond->border_width / 2.0;
element_update_boundingbox(elem);
-
+
obj->position = elem->corner;
-
+
element_update_handles(elem);
}
@@ -500,7 +498,7 @@ diamond_create(Point *startpoint,
diamond = g_malloc0(sizeof(Diamond));
elem = &diamond->element;
obj = &elem->object;
-
+
obj->type = &diamond_type;
obj->ops = &diamond_ops;
@@ -524,7 +522,7 @@ diamond_create(Point *startpoint,
diamond->text = new_text("", font, font_height, &p, &diamond->border_color,
ALIGN_CENTER);
dia_font_unref(font);
-
+
/* new default: let the user decide the size */
diamond->text_fitting = TEXTFIT_WHEN_NEEDED;
@@ -541,7 +539,7 @@ diamond_create(Point *startpoint,
diamond_update_data(diamond, ANCHOR_MIDDLE, ANCHOR_MIDDLE);
*handle1 = NULL;
- *handle2 = obj->handles[7];
+ *handle2 = obj->handles[7];
return &diamond->element.object;
}
@@ -562,15 +560,15 @@ diamond_save(Diamond *diamond, ObjectNode obj_node, DiaContext *ctx)
if (diamond->border_width != 0.1)
data_add_real(new_attribute(obj_node, "border_width"),
diamond->border_width, ctx);
-
+
if (!color_equals(&diamond->border_color, &color_black))
data_add_color(new_attribute(obj_node, "border_color"),
&diamond->border_color, ctx);
-
+
if (!color_equals(&diamond->inner_color, &color_white))
data_add_color(new_attribute(obj_node, "inner_color"),
&diamond->inner_color, ctx);
-
+
data_add_boolean(new_attribute(obj_node, "show_background"),
diamond->show_background, ctx);
@@ -586,7 +584,7 @@ diamond_save(Diamond *diamond, ObjectNode obj_node, DiaContext *ctx)
data_add_real(new_attribute(obj_node, "padding"), diamond->padding, ctx);
data_add_text(new_attribute(obj_node, "text"), diamond->text, ctx);
-
+
if (diamond->text_fitting != TEXTFIT_WHEN_NEEDED)
data_add_enum(new_attribute(obj_node, PROP_STDNAME_TEXT_FITTING),
diamond->text_fitting, ctx);
@@ -604,12 +602,12 @@ diamond_load(ObjectNode obj_node, int version,DiaContext *ctx)
diamond = g_malloc0(sizeof(Diamond));
elem = &diamond->element;
obj = &elem->object;
-
+
obj->type = &diamond_type;
obj->ops = &diamond_ops;
element_load(elem, obj_node, ctx);
-
+
diamond->border_width = 0.1;
attr = object_find_attribute(obj_node, "border_width");
if (attr != NULL)
@@ -624,7 +622,7 @@ diamond_load(ObjectNode obj_node, int version,DiaContext *ctx)
attr = object_find_attribute(obj_node, "inner_color");
if (attr != NULL)
data_color(attribute_first_data(attr), &diamond->inner_color, ctx);
-
+
diamond->show_background = TRUE;
attr = object_find_attribute(obj_node, "show_background");
if (attr != NULL)
@@ -644,7 +642,7 @@ diamond_load(ObjectNode obj_node, int version,DiaContext *ctx)
attr = object_find_attribute(obj_node, "padding");
if (attr != NULL)
diamond->padding = data_real(attribute_first_data(attr), ctx);
-
+
diamond->text = NULL;
attr = object_find_attribute(obj_node, "text");
if (attr != NULL)
diff --git a/objects/flowchart/ellipse.c b/objects/flowchart/ellipse.c
index e3451593..8b3f7d97 100644
--- a/objects/flowchart/ellipse.c
+++ b/objects/flowchart/ellipse.c
@@ -21,9 +21,7 @@
/* DO NOT USE THIS OBJECT AS A BASIS FOR A NEW OBJECT. */
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -83,7 +81,7 @@ static void ellipse_select(Ellipse *ellipse, Point *clicked_point,
DiaRenderer *interactive_renderer);
static ObjectChange* ellipse_move_handle(Ellipse *ellipse, Handle *handle,
Point *to, ConnectionPoint *cp,
- HandleMoveReason reason,
+ HandleMoveReason reason,
ModifierKeys modifiers);
static ObjectChange* ellipse_move(Ellipse *ellipse, Point *to);
static void ellipse_draw(Ellipse *ellipse, DiaRenderer *renderer);
@@ -153,7 +151,7 @@ static PropDescription ellipse_props[] = {
PROP_STD_TEXT_ALIGNMENT,
PROP_STD_TEXT_FITTING,
PROP_STD_SAVED_TEXT,
-
+
{ NULL, 0, 0, NULL, NULL, NULL, 0}
};
@@ -277,7 +275,7 @@ ellipse_move_handle(Ellipse *ellipse, Handle *handle,
width = ellipse->element.width;
height = ellipse->element.height;
- element_move_handle(&ellipse->element, handle->id, to, cp,
+ element_move_handle(&ellipse->element, handle->id, to, cp,
reason, modifiers);
switch (handle->id) {
@@ -312,7 +310,7 @@ static ObjectChange*
ellipse_move(Ellipse *ellipse, Point *to)
{
ellipse->element.corner = *to;
-
+
ellipse_update_data(ellipse, ANCHOR_MIDDLE, ANCHOR_MIDDLE);
return NULL;
@@ -324,7 +322,7 @@ ellipse_draw(Ellipse *ellipse, DiaRenderer *renderer)
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
Element *elem;
Point center;
-
+
assert(ellipse != NULL);
assert(renderer != NULL);
@@ -334,7 +332,7 @@ ellipse_draw(Ellipse *ellipse, DiaRenderer *renderer)
center.y = elem->corner.y + elem->height/2;
if (ellipse->show_background)
- renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID);
+ renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID);
renderer_ops->set_linewidth(renderer, ellipse->border_width);
renderer_ops->set_linestyle(renderer, ellipse->line_style, ellipse->dashlength);
renderer_ops->set_linejoin(renderer, LINEJOIN_MITER);
@@ -385,7 +383,7 @@ ellipse_update_data(Ellipse *ellipse, AnchorShape horiz, AnchorShape vert)
p.y = c.y - height / 2;
radius1 = ellipse_radius(ellipse, p.x, p.y) - ellipse->border_width/2;
radius2 = distance_point_point(&c, &p);
-
+
if ( (radius1 < radius2 && ellipse->text_fitting == TEXTFIT_WHEN_NEEDED)
/* stop infinite resizing with 5% tolerance obsvered with _test_movement */
|| (fabs(1.0 - radius2 / radius1) > 0.05 && ellipse->text_fitting == TEXTFIT_ALWAYS)) {
@@ -450,7 +448,7 @@ ellipse_update_data(Ellipse *ellipse, AnchorShape horiz, AnchorShape vert)
element_update_boundingbox(elem);
obj->position = elem->corner;
-
+
element_update_handles(elem);
}
@@ -473,7 +471,7 @@ ellipse_create(Point *startpoint,
ellipse = g_malloc0(sizeof(Ellipse));
elem = &ellipse->element;
obj = &elem->object;
-
+
obj->type = &fc_ellipse_type;
obj->ops = &ellipse_ops;
@@ -497,7 +495,7 @@ ellipse_create(Point *startpoint,
ellipse->text = new_text("", font, font_height, &p, &ellipse->border_color,
ALIGN_CENTER);
dia_font_unref(font);
-
+
/* new default: let the user decide the size */
ellipse->text_fitting = TEXTFIT_WHEN_NEEDED;
@@ -514,7 +512,7 @@ ellipse_create(Point *startpoint,
ellipse_update_data(ellipse, ANCHOR_MIDDLE, ANCHOR_MIDDLE);
*handle1 = NULL;
- *handle2 = obj->handles[7];
+ *handle2 = obj->handles[7];
return &ellipse->element.object;
}
@@ -534,15 +532,15 @@ ellipse_save(Ellipse *ellipse, ObjectNode obj_node, DiaContext *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);
@@ -576,12 +574,12 @@ ellipse_load(ObjectNode obj_node, int version,DiaContext *ctx)
ellipse = g_malloc0(sizeof(Ellipse));
elem = &ellipse->element;
obj = &elem->object;
-
+
obj->type = &fc_ellipse_type;
obj->ops = &ellipse_ops;
element_load(elem, obj_node, ctx);
-
+
ellipse->border_width = 0.1;
attr = object_find_attribute(obj_node, "border_width");
if (attr != NULL)
@@ -591,12 +589,12 @@ ellipse_load(ObjectNode obj_node, int version,DiaContext *ctx)
attr = object_find_attribute(obj_node, "border_color");
if (attr != NULL)
data_color(attribute_first_data(attr), &ellipse->border_color, ctx);
-
+
ellipse->inner_color = color_white;
attr = object_find_attribute(obj_node, "inner_color");
if (attr != NULL)
data_color(attribute_first_data(attr), &ellipse->inner_color, ctx);
-
+
ellipse->show_background = TRUE;
attr = object_find_attribute(obj_node, "show_background");
if (attr != NULL)
@@ -616,7 +614,7 @@ ellipse_load(ObjectNode obj_node, int version,DiaContext *ctx)
attr = object_find_attribute(obj_node, "padding");
if (attr != NULL)
ellipse->padding = data_real(attribute_first_data(attr), ctx);
-
+
ellipse->text = NULL;
attr = object_find_attribute(obj_node, "text");
if (attr != NULL)
diff --git a/objects/flowchart/flowchart.c b/objects/flowchart/flowchart.c
index d1c05c49..93b7aa9a 100644
--- a/objects/flowchart/flowchart.c
+++ b/objects/flowchart/flowchart.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include "intl.h"
#include "object.h"
diff --git a/objects/flowchart/parallelogram.c b/objects/flowchart/parallelogram.c
index 1da7356c..4514eeaa 100644
--- a/objects/flowchart/parallelogram.c
+++ b/objects/flowchart/parallelogram.c
@@ -21,9 +21,7 @@
/* DO NOT USE THIS OBJECT AS A BASIS FOR A NEW OBJECT. */
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -85,7 +83,7 @@ static void pgram_select(Pgram *pgram, Point *clicked_point,
DiaRenderer *interactive_renderer);
static ObjectChange* pgram_move_handle(Pgram *pgram, Handle *handle,
Point *to, ConnectionPoint *cp,
- HandleMoveReason reason,
+ HandleMoveReason reason,
ModifierKeys modifiers);
static ObjectChange* pgram_move(Pgram *pgram, Point *to);
static void pgram_draw(Pgram *pgram, DiaRenderer *renderer);
@@ -319,7 +317,7 @@ static ObjectChange*
pgram_move(Pgram *pgram, Point *to)
{
pgram->element.corner = *to;
-
+
pgram_update_data(pgram, ANCHOR_MIDDLE, ANCHOR_MIDDLE);
return NULL;
@@ -332,7 +330,7 @@ pgram_draw(Pgram *pgram, DiaRenderer *renderer)
Point pts[4];
Element *elem;
real offs;
-
+
assert(pgram != NULL);
assert(renderer != NULL);
@@ -360,7 +358,7 @@ pgram_draw(Pgram *pgram, DiaRenderer *renderer)
renderer_ops->set_linestyle(renderer, pgram->line_style, pgram->dashlength);
renderer_ops->set_linejoin(renderer, LINEJOIN_MITER);
- renderer_ops->draw_polygon (renderer,
+ renderer_ops->draw_polygon (renderer,
pts, 4,
(pgram->show_background) ? &pgram->inner_color : NULL,
&pgram->border_color);
@@ -415,7 +413,7 @@ pgram_update_data(Pgram *pgram, AnchorShape horiz, AnchorShape vert)
* pgram->text->numlines);
if (width > elem->width) elem->width = width;
*/
-
+
/* move shape if necessary ... */
switch (horiz) {
case ANCHOR_MIDDLE:
@@ -449,7 +447,7 @@ pgram_update_data(Pgram *pgram, AnchorShape horiz, AnchorShape vert)
break;
}
text_set_position(pgram->text, &p);
-
+
/* 1/4 of how much more to the left the bottom line is */
offs = -(elem->height / 4.0 * pgram->shear_grad);
width = elem->width - 4.0*fabs(offs);
@@ -530,9 +528,9 @@ pgram_update_data(Pgram *pgram, AnchorShape horiz, AnchorShape vert)
extra->border_trans = pgram->border_width/2.0;
element_update_boundingbox(elem);
-
+
obj->position = elem->corner;
-
+
element_update_handles(elem);
}
@@ -555,7 +553,7 @@ pgram_create(Point *startpoint,
pgram = g_malloc0(sizeof(Pgram));
elem = &pgram->element;
obj = &elem->object;
-
+
obj->type = &pgram_type;
obj->ops = &pgram_ops;
@@ -581,7 +579,7 @@ pgram_create(Point *startpoint,
pgram->text = new_text("", font, font_height, &p, &pgram->border_color,
ALIGN_CENTER);
dia_font_unref(font);
-
+
/* new default: let the user decide the size */
pgram->text_fitting = TEXTFIT_WHEN_NEEDED;
@@ -598,7 +596,7 @@ pgram_create(Point *startpoint,
pgram_update_data(pgram, ANCHOR_MIDDLE, ANCHOR_MIDDLE);
*handle1 = NULL;
- *handle2 = obj->handles[7];
+ *handle2 = obj->handles[7];
return &pgram->element.object;
}
@@ -662,12 +660,12 @@ pgram_load(ObjectNode obj_node, int version,DiaContext *ctx)
pgram = g_malloc0(sizeof(Pgram));
elem = &pgram->element;
obj = &elem->object;
-
+
obj->type = &pgram_type;
obj->ops = &pgram_ops;
element_load(elem, obj_node, ctx);
-
+
pgram->border_width = 0.1;
attr = object_find_attribute(obj_node, "border_width");
if (attr != NULL)
@@ -677,12 +675,12 @@ pgram_load(ObjectNode obj_node, int version,DiaContext *ctx)
attr = object_find_attribute(obj_node, "border_color");
if (attr != NULL)
data_color(attribute_first_data(attr), &pgram->border_color, ctx);
-
+
pgram->inner_color = color_white;
attr = object_find_attribute(obj_node, "inner_color");
if (attr != NULL)
data_color(attribute_first_data(attr), &pgram->inner_color, ctx);
-
+
pgram->show_background = TRUE;
attr = object_find_attribute(obj_node, "show_background");
if (attr != NULL)
@@ -708,7 +706,7 @@ pgram_load(ObjectNode obj_node, int version,DiaContext *ctx)
attr = object_find_attribute(obj_node, "padding");
if (attr != NULL)
pgram->padding = data_real(attribute_first_data(attr), ctx);
-
+
pgram->text = NULL;
attr = object_find_attribute(obj_node, "text");
if (attr != NULL)
diff --git a/objects/network/basestation.c b/objects/network/basestation.c
index 91d662c7..358d83ed 100644
--- a/objects/network/basestation.c
+++ b/objects/network/basestation.c
@@ -19,9 +19,7 @@
/* Copyright 2003, W. Borgert <debacle debian org>
copied a lot from UML/actor.c */
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
diff --git a/objects/network/bus.c b/objects/network/bus.c
index 1734a31a..fb8ccd6b 100644
--- a/objects/network/bus.c
+++ b/objects/network/bus.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
@@ -60,7 +58,7 @@ struct PointChange {
enum change_type type;
int applied;
-
+
Point point;
Handle *handle; /* owning ref when not applied for ADD_POINT
owning ref when applied for REMOVE_POINT */
@@ -172,7 +170,7 @@ bus_distance_from(Bus *bus, Point *point)
Point *endpoints;
real min_dist;
int i;
-
+
endpoints = &bus->real_ends[0];
min_dist = distance_line_point( &endpoints[0], &endpoints[1],
LINE_WIDTH, point);
@@ -223,7 +221,7 @@ bus_move_handle(Bus *bus, Handle *handle,
}
vlen = sqrt(point_dot(&vhat, &vhat));
point_scale(&vhat, 1.0/vlen);
-
+
vhatperp.x = -vhat.y;
vhatperp.y = vhat.x;
for (i=0;i<num_handles;i++) {
@@ -232,8 +230,8 @@ bus_move_handle(Bus *bus, Handle *handle,
parallel[i] = point_dot(&vhat, &u);
perp[i] = point_dot(&vhatperp, &u);
}
-
- connection_move_handle(&bus->connection, handle->id, to, cp,
+
+ connection_move_handle(&bus->connection, handle->id, to, cp,
reason, modifiers);
vhat = endpoints[1];
@@ -269,10 +267,10 @@ static ObjectChange*
bus_move(Bus *bus, Point *to)
{
Point delta;
- Point *endpoints = &bus->connection.endpoints[0];
+ Point *endpoints = &bus->connection.endpoints[0];
DiaObject *obj = &bus->connection.object;
int i;
-
+
delta = *to;
point_sub(&delta, &obj->position);
@@ -298,12 +296,12 @@ bus_draw(Bus *bus, DiaRenderer *renderer)
DiaRendererClass *renderer_ops = DIA_RENDERER_GET_CLASS (renderer);
Point *endpoints;
int i;
-
+
assert(bus != NULL);
assert(renderer != NULL);
endpoints = &bus->real_ends[0];
-
+
renderer_ops->set_linewidth(renderer, LINE_WIDTH);
renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID, 0.0);
renderer_ops->set_linecaps(renderer, LINECAPS_BUTT);
@@ -339,7 +337,7 @@ bus_create(Point *startpoint,
conn->endpoints[0] = *startpoint;
conn->endpoints[1] = *startpoint;
point_add(&conn->endpoints[1], &defaultlen);
-
+
obj = &conn->object;
extra = &conn->extra_spacing;
@@ -364,10 +362,10 @@ bus_create(Point *startpoint,
obj->handles[2+i] = bus->handles[i];
}
- extra->start_trans =
- extra->end_trans =
+ extra->start_trans =
+ extra->end_trans =
extra->start_long =
- extra->end_long = LINE_WIDTH/2.0;
+ extra->end_long = LINE_WIDTH/2.0;
bus_update_data(bus);
*handle1 = obj->handles[0];
@@ -393,13 +391,13 @@ bus_copy(Bus *bus)
Connection *conn, *newconn;
DiaObject *newobj;
int i;
-
+
conn = &bus->connection;
-
+
newbus = g_malloc0(sizeof(Bus));
newconn = &newbus->connection;
newobj = &newconn->object;
-
+
connection_copy(conn, newconn);
newbus->num_handles = bus->num_handles;
@@ -407,7 +405,7 @@ bus_copy(Bus *bus)
newbus->handles = g_malloc(sizeof(Handle *)*newbus->num_handles);
newbus->parallel_points = g_malloc(sizeof(Point)*newbus->num_handles);
-
+
for (i=0;i<newbus->num_handles;i++) {
newbus->handles[i] = g_new0(Handle,1);
*newbus->handles[i] = *bus->handles[i];
@@ -437,13 +435,13 @@ bus_update_data(Bus *bus)
/*
* This seems to break stuff wildly.
*/
-/*
+/*
if (connpoint_is_autogap(conn->endpoint_handles[0].connected_to) ||
connpoint_is_autogap(conn->endpoint_handles[1].connected_to)) {
connection_adjust_for_autogap(conn);
}
*/
- endpoints = &conn->endpoints[0];
+ endpoints = &conn->endpoints[0];
obj->position = endpoints[0];
v = endpoints[1];
@@ -465,7 +463,7 @@ bus_update_data(Bus *bus)
point_scale(&bus->parallel_points[i], ulen);
point_add(&bus->parallel_points[i], &endpoints[0]);
}
-
+
min_par -= LINE_WIDTH/2.0;
max_par += LINE_WIDTH/2.0;
@@ -490,7 +488,7 @@ static void
bus_add_handle(Bus *bus, Point *p, Handle *handle)
{
int i;
-
+
bus->num_handles++;
/* Allocate more handles */
@@ -500,7 +498,7 @@ bus_add_handle(Bus *bus, Point *p, Handle *handle)
sizeof(Point)*bus->num_handles);
i = bus->num_handles - 1;
-
+
bus->handles[i] = handle;
bus->handles[i]->id = HANDLE_BUS;
bus->handles[i]->type = HANDLE_MINOR_CONTROL;
@@ -514,7 +512,7 @@ static void
bus_remove_handle(Bus *bus, Handle *handle)
{
int i, j;
-
+
for (i=0;i<bus->num_handles;i++) {
if (bus->handles[i] == handle) {
object_remove_handle(&bus->connection.object, handle);
@@ -586,7 +584,7 @@ bus_delete_handle_callback (DiaObject *obj, Point *clicked, gpointer data)
handle = bus->handles[handle_num];
p = handle->pos;
connectionpoint = handle->connected_to;
-
+
object_unconnect(obj, handle);
bus_remove_handle(bus, handle );
bus_update_data(bus);
@@ -623,11 +621,11 @@ bus_save(Bus *bus, ObjectNode obj_node, DiaContext *ctx)
AttributeNode attr;
connection_save(&bus->connection, obj_node, ctx);
-
+
data_add_color( new_attribute(obj_node, "line_color"), &bus->line_color, ctx);
attr = new_attribute(obj_node, "bus_handles");
-
+
for (i=0;i<bus->num_handles;i++) {
data_add_point(attr, &bus->handles[i]->pos, ctx);
}
@@ -662,7 +660,7 @@ bus_load(ObjectNode obj_node, int version,DiaContext *ctx)
bus->num_handles = attribute_num_data(attr);
connection_init(conn, 2 + bus->num_handles, 0);
-
+
data = attribute_first_data(attr);
bus->handles = g_malloc(sizeof(Handle *)*bus->num_handles);
bus->parallel_points = g_malloc(sizeof(Point)*bus->num_handles);
@@ -683,10 +681,10 @@ bus_load(ObjectNode obj_node, int version,DiaContext *ctx)
if (attr != NULL)
data_color(attribute_first_data(attr), &bus->line_color, ctx);
- extra->start_trans =
- extra->end_trans =
+ extra->start_trans =
+ extra->end_trans =
extra->start_long =
- extra->end_long = LINE_WIDTH/2.0;
+ extra->end_long = LINE_WIDTH/2.0;
bus_update_data(bus);
return &bus->connection.object;
diff --git a/objects/network/network.c b/objects/network/network.c
index 2829ada3..5339332b 100644
--- a/objects/network/network.c
+++ b/objects/network/network.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include "object.h"
#include "sheet.h"
diff --git a/objects/network/radiocell.c b/objects/network/radiocell.c
index 39335038..90dc1c26 100644
--- a/objects/network/radiocell.c
+++ b/objects/network/radiocell.c
@@ -19,9 +19,7 @@
/* Copyright 2003, W. Borgert <debacle debian org>
copied a lot from UML/large_package.c and standard/polygon.c */
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
diff --git a/objects/standard/bezier.c b/objects/standard/bezier.c
index 2c4fbf07..7227f9b2 100644
--- a/objects/standard/bezier.c
+++ b/objects/standard/bezier.c
@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
diff --git a/objects/standard/beziergon.c b/objects/standard/beziergon.c
index adda7f2f..2f6c6934 100644
--- a/objects/standard/beziergon.c
+++ b/objects/standard/beziergon.c
@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
diff --git a/objects/standard/box.c b/objects/standard/box.c
index 791d04d3..4b2b0906 100644
--- a/objects/standard/box.c
+++ b/objects/standard/box.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
diff --git a/objects/standard/ellipse.c b/objects/standard/ellipse.c
index 19b4fb15..01a24d20 100644
--- a/objects/standard/ellipse.c
+++ b/objects/standard/ellipse.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
diff --git a/objects/standard/line.c b/objects/standard/line.c
index 1d51780a..85799268 100644
--- a/objects/standard/line.c
+++ b/objects/standard/line.c
@@ -18,9 +18,7 @@
*/
/*! \file line.c -- Implements the "Standard - Line" object */
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
diff --git a/objects/standard/polygon.c b/objects/standard/polygon.c
index d2ff93f2..f03fe53b 100644
--- a/objects/standard/polygon.c
+++ b/objects/standard/polygon.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
diff --git a/objects/standard/polyline.c b/objects/standard/polyline.c
index fae8b520..b9ba8599 100644
--- a/objects/standard/polyline.c
+++ b/objects/standard/polyline.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
diff --git a/objects/standard/standard.c b/objects/standard/standard.c
index 4d1e5c1b..f37f7b9a 100644
--- a/objects/standard/standard.c
+++ b/objects/standard/standard.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include "object.h"
#include "sheet.h"
diff --git a/objects/standard/textobj.c b/objects/standard/textobj.c
index 3a6ea044..c478c866 100644
--- a/objects/standard/textobj.c
+++ b/objects/standard/textobj.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
diff --git a/objects/standard/zigzagline.c b/objects/standard/zigzagline.c
index d88af6a9..7cbd9038 100644
--- a/objects/standard/zigzagline.c
+++ b/objects/standard/zigzagline.c
@@ -16,9 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <assert.h>
#include <math.h>
diff --git a/plug-ins/cgm/cgm.c b/plug-ins/cgm/cgm.c
index a18554f5..ae5c8e27 100644
--- a/plug-ins/cgm/cgm.c
+++ b/plug-ins/cgm/cgm.c
@@ -21,9 +21,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include "cgm.h"
@@ -91,9 +89,9 @@ static void
write_uint32(FILE *fp, guint32 n)
{
putc((n >> 24) & 0xff, fp);
- putc((n >> 16) & 0xff, fp);
- putc((n >> 8) & 0xff, fp);
- putc(n & 0xff, fp);
+ putc((n >> 16) & 0xff, fp);
+ putc((n >> 8) & 0xff, fp);
+ putc(n & 0xff, fp);
}
static void
@@ -120,7 +118,7 @@ write_real(FILE *fp, double x)
guint16 fraction;
wholepart = (gint32)x;
-
+
fraction = (guint16)((x - wholepart) * -65536);
if ( fraction > 0 )
{
@@ -174,18 +172,18 @@ init_fonts(void)
PangoFontFamily **families;
int n_families;
const char *familyname;
-
+
if (alreadyrun) return;
alreadyrun = TRUE;
context = gdk_pango_context_get();
pango_context_list_families(context,&families,&n_families);
-
+
fonthash = g_hash_table_new(g_str_hash, g_str_equal);
str = g_string_new(NULL);
for (i = 0; i < n_families; ++i) {
familyname = pango_font_family_get_name(families[i]);
-
+
g_string_append_c(str, strlen(familyname));
g_string_append(str, familyname);
g_hash_table_insert(fonthash, (gpointer)familyname,
@@ -218,7 +216,7 @@ typedef struct _FillEdgeAttrCGM
int cap; /* Edge cap */
int join; /* Edge join */
int style; /* Edge style */
- real width; /* Edge width */
+ real width; /* Edge width */
Color color; /* Edge color */
} FillEdgeAttrCGM;
@@ -244,7 +242,7 @@ struct _CgmRenderer
DiaFont *font;
- real y0, y1;
+ real y0, y1;
LineAttrCGM lcurrent, linfile;
@@ -301,8 +299,8 @@ init_attributes( CgmRenderer *renderer )
renderer->finfile.fill_color.alpha = 1.0;
renderer->finfile.edgevis = -1;
- renderer->finfile.cap = -1;
- renderer->finfile.join = -1;
+ renderer->finfile.cap = -1;
+ renderer->finfile.join = -1;
renderer->finfile.style = -1;
renderer->finfile.width = -1.;
renderer->finfile.color.red = -1.0;
@@ -325,7 +323,7 @@ init_attributes( CgmRenderer *renderer )
renderer->tinfile.color.alpha = 1.0;
}
-
+
static real
@@ -341,7 +339,7 @@ write_line_attributes( CgmRenderer *renderer, Color *color )
LineAttrCGM *lnew, *lold;
lnew = &renderer->lcurrent;
- lold = &renderer->linfile;
+ lold = &renderer->linfile;
if ( lnew->cap != lold->cap )
{
@@ -355,7 +353,7 @@ LineAttrCGM *lnew, *lold;
{
write_elhead(renderer->file, CGM_ATTRIB, CGM_LINE_JOIN, 2);
write_int16(renderer->file, lnew->join);
- lold->join = lnew->join;
+ lold->join = lnew->join;
}
if ( lnew->style != lold->style )
{
@@ -389,7 +387,7 @@ LineAttrCGM *lnew, *lold;
** fill_color != NULL, style solid, interrior-color is fill_color
** == NULL, style empty
**
-** edge_color != NULL, edge on with the color and the other
+** edge_color != NULL, edge on with the color and the other
** attributes
** == NULL, edge off
*/
@@ -401,7 +399,7 @@ write_filledge_attributes( CgmRenderer *renderer, Color *fill_color,
FillEdgeAttrCGM *fnew, *fold;
fnew = &renderer->fcurrent;
- fold = &renderer->finfile;
+ fold = &renderer->finfile;
/*
** Set the edge attributes
*/
@@ -411,7 +409,7 @@ FillEdgeAttrCGM *fnew, *fold;
fnew->edgevis = 0; /* edge off */
if ( fnew->edgevis != fold->edgevis )
{
- write_elhead(renderer->file, CGM_ATTRIB, CGM_EDGE_VISIBILITY, 2);
+ write_elhead(renderer->file, CGM_ATTRIB, CGM_EDGE_VISIBILITY, 2);
write_int16(renderer->file, fnew->edgevis);
fold->edgevis = fnew->edgevis;
}
@@ -421,7 +419,7 @@ FillEdgeAttrCGM *fnew, *fold;
fnew->edgevis = 1; /* edge on */
if ( fnew->edgevis != fold->edgevis )
{
- write_elhead(renderer->file, CGM_ATTRIB, CGM_EDGE_VISIBILITY, 2);
+ write_elhead(renderer->file, CGM_ATTRIB, CGM_EDGE_VISIBILITY, 2);
write_int16(renderer->file, fnew->edgevis);
fold->edgevis = fnew->edgevis;
}
@@ -469,7 +467,7 @@ FillEdgeAttrCGM *fnew, *fold;
fnew->fill_style = 4; /* empty */
if ( fnew->fill_style != fold->fill_style )
{
- write_elhead(renderer->file, CGM_ATTRIB, CGM_INTERIOR_STYLE, 2);
+ write_elhead(renderer->file, CGM_ATTRIB, CGM_INTERIOR_STYLE, 2);
write_int16(renderer->file, fnew->fill_style);
fold->fill_style = fnew->fill_style;
}
@@ -479,7 +477,7 @@ FillEdgeAttrCGM *fnew, *fold;
fnew->fill_style = 1; /* solid fill */
if ( fnew->fill_style != fold->fill_style )
{
- write_elhead(renderer->file, CGM_ATTRIB, CGM_INTERIOR_STYLE, 2);
+ write_elhead(renderer->file, CGM_ATTRIB, CGM_INTERIOR_STYLE, 2);
write_int16(renderer->file, fnew->fill_style);
fold->fill_style = fnew->fill_style;
}
@@ -506,7 +504,7 @@ TextAttrCGM *tnew, *told;
tnew = &renderer->tcurrent;
- told = &renderer->tinfile;
+ told = &renderer->tinfile;
/*
** Set the text attributes
*/
@@ -521,7 +519,7 @@ TextAttrCGM *tnew, *told;
{
real h_basecap;
- /* in CGM we need the base-cap height, I used the 0.9 to correct */
+ /* in CGM we need the base-cap height, I used the 0.9 to correct */
/* it because it was still to high. There might be a better way */
/* but for now.... */
@@ -580,7 +578,7 @@ set_linecaps(DiaRenderer *self, LineCaps mode)
CgmRenderer *renderer = CGM_RENDERER(self);
int cap;
- switch(mode)
+ switch(mode)
{
case LINECAPS_DEFAULT:
case LINECAPS_BUTT:
@@ -605,7 +603,7 @@ set_linejoin(DiaRenderer *self, LineJoin mode)
CgmRenderer *renderer = CGM_RENDERER(self);
int join;
- switch(mode)
+ switch(mode)
{
case LINEJOIN_DEFAULT:
case LINEJOIN_MITER:
@@ -685,8 +683,8 @@ set_font(DiaRenderer *self, DiaFont *font, real height)
}
static void
-draw_line(DiaRenderer *self,
- Point *start, Point *end,
+draw_line(DiaRenderer *self,
+ Point *start, Point *end,
Color *line_colour)
{
CgmRenderer *renderer = CGM_RENDERER(self);
@@ -701,8 +699,8 @@ draw_line(DiaRenderer *self,
}
static void
-draw_polyline(DiaRenderer *self,
- Point *points, int num_points,
+draw_polyline(DiaRenderer *self,
+ Point *points, int num_points,
Color *line_colour)
{
CgmRenderer *renderer = CGM_RENDERER(self);
@@ -735,7 +733,7 @@ draw_polygon (DiaRenderer *self,
}
static void
-draw_rect(DiaRenderer *self,
+draw_rect(DiaRenderer *self,
Point *ul_corner, Point *lr_corner,
Color *fill, Color *stroke)
{
@@ -797,11 +795,11 @@ write_ellarc (CgmRenderer *renderer,
*/
if ( elemid == CGM_ELLIPTICAL_ARC_CLOSE )
write_int16(renderer->file, 0);
-}
+}
static void
-draw_arc(DiaRenderer *self,
+draw_arc(DiaRenderer *self,
Point *center,
real width, real height,
real angle1, real angle2,
@@ -814,7 +812,7 @@ draw_arc(DiaRenderer *self,
}
static void
-fill_arc(DiaRenderer *self,
+fill_arc(DiaRenderer *self,
Point *center,
real width, real height,
real angle1, real angle2,
@@ -827,7 +825,7 @@ fill_arc(DiaRenderer *self,
}
static void
-draw_ellipse(DiaRenderer *self,
+draw_ellipse(DiaRenderer *self,
Point *center,
real width, real height,
Color *fill, Color *stroke)
@@ -847,10 +845,10 @@ draw_ellipse(DiaRenderer *self,
write_real(renderer->file, ynew + height/2);
}
-static void
-write_bezier(CgmRenderer *renderer,
- BezPoint *points,
- int numpoints)
+static void
+write_bezier(CgmRenderer *renderer,
+ BezPoint *points,
+ int numpoints)
{
int i;
Point current;
@@ -863,7 +861,7 @@ write_bezier(CgmRenderer *renderer,
for (i = 1; i < numpoints; i++)
{
- switch (points[i].type)
+ switch (points[i].type)
{
case BEZ_MOVE_TO:
g_warning("only first BezPoint can be a BEZ_MOVE_TO");
@@ -897,7 +895,7 @@ write_bezier(CgmRenderer *renderer,
static void
-draw_bezier(DiaRenderer *self,
+draw_bezier(DiaRenderer *self,
BezPoint *points,
int numpoints,
Color *colour)
@@ -913,7 +911,7 @@ draw_bezier(DiaRenderer *self,
static void
-draw_beziergon (DiaRenderer *self,
+draw_beziergon (DiaRenderer *self,
BezPoint *points, /* Last point must be same as first point */
int numpoints,
Color *fill,
@@ -959,11 +957,11 @@ draw_string(DiaRenderer *self,
case ALIGN_LEFT:
break;
case ALIGN_CENTER:
- x -= dia_font_string_width(text, renderer->font,
+ x -= dia_font_string_width(text, renderer->font,
renderer->tcurrent.font_height)/2;
break;
case ALIGN_RIGHT:
- x -= dia_font_string_width(text, renderer->font,
+ x -= dia_font_string_width(text, renderer->font,
renderer->tcurrent.font_height);
break;
}
@@ -1004,7 +1002,7 @@ draw_image(DiaRenderer *self,
{
CgmRenderer *renderer = CGM_RENDERER(self);
const gint maxlen = 32767 - 6 * REALSIZE - 4 * 2;
- double x1 = point->x, y1 = swap_y(renderer, point->y),
+ double x1 = point->x, y1 = swap_y(renderer, point->y),
x2 = x1+width, y2 = y1-height;
gint rowlen = dia_image_width(image) * 3;
gint x, y, columns = dia_image_width(image);
@@ -1017,7 +1015,7 @@ draw_image(DiaRenderer *self,
gboolean has_alpha;
if (rowlen > maxlen) {
- dia_context_add_message(renderer->ctx,
+ dia_context_add_message(renderer->ctx,
_("Image row length larger than maximum cell array.\n"
"Image not exported to CGM."));
return;
@@ -1083,7 +1081,7 @@ export_cgm(DiagramData *data, DiaContext *ctx,
file = g_fopen(filename, "wb");
if (file == NULL) {
- dia_context_add_message_with_errno (ctx, errno, _("Can't open output file %s"),
+ dia_context_add_message_with_errno (ctx, errno, _("Can't open output file %s"),
dia_context_get_filename(ctx));
return FALSE;
}
@@ -1139,7 +1137,7 @@ export_cgm(DiagramData *data, DiaContext *ctx,
fwrite(fontlist, sizeof(char), fontlistlen, file);
if (IS_ODD(fontlistlen))
putc(0, file);
-
+
/* begin picture */
len = strlen(diafilename);
write_elhead(file, CGM_DELIM, CGM_BEGIN_PICTURE, len + 1);
@@ -1163,8 +1161,8 @@ export_cgm(DiagramData *data, DiaContext *ctx,
extent = &data->extents;
/*
- ** Change the swap Y-coordinate in the CGM, to get a more
- ** 'portable' CGM
+ ** Change the swap Y-coordinate in the CGM, to get a more
+ ** 'portable' CGM
*/
/* write extents */
write_elhead(file, CGM_PICDESC, CGM_VDC_EXTENT, 4 * REALSIZE);
@@ -1237,7 +1235,7 @@ cgm_renderer_get_type (void)
"CgmRenderer",
&object_info, 0);
}
-
+
return object_type;
}
@@ -1266,10 +1264,10 @@ cgm_renderer_class_init (CgmRendererClass *klass)
renderer_class->set_linestyle = set_linestyle;
renderer_class->set_fillstyle = set_fillstyle;
renderer_class->set_font = set_font;
-
+
renderer_class->draw_line = draw_line;
renderer_class->draw_polyline = draw_polyline;
-
+
renderer_class->draw_polygon = draw_polygon;
renderer_class->draw_rect = draw_rect;
diff --git a/plug-ins/dxf/dxf-export.c b/plug-ins/dxf/dxf-export.c
index b80636fc..3bb882d7 100644
--- a/plug-ins/dxf/dxf-export.c
+++ b/plug-ins/dxf/dxf-export.c
@@ -20,9 +20,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <stdio.h>
#include <string.h>
@@ -81,7 +79,7 @@ typedef struct _FillEdgeAttrdxf
int cap; /* Edge cap */
int join; /* Edge join */
char *style; /* Edge style */
- real width; /* Edge width */
+ real width; /* Edge width */
Color color; /* Edge color */
} FillEdgeAttrdxf;
@@ -107,14 +105,14 @@ struct _DxfRenderer
DiaFont *font;
- real y0, y1;
+ real y0, y1;
LineAttrdxf lcurrent, linfile;
FillEdgeAttrdxf fcurrent, finfile;
TextAttrdxf tcurrent, tinfile;
-
+
char *layername;
};
@@ -147,7 +145,7 @@ dxf_renderer_get_type (void)
"DxfRenderer",
&object_info, 0);
}
-
+
return object_type;
}
@@ -257,8 +255,8 @@ dxf_color (const Color *color)
}
static void
-draw_line(DiaRenderer *self,
- Point *start, Point *end,
+draw_line(DiaRenderer *self,
+ Point *start, Point *end,
Color *line_colour)
{
DxfRenderer *renderer = DXF_RENDERER(self);
@@ -280,8 +278,8 @@ draw_line(DiaRenderer *self,
}
static void
-draw_polyline(DiaRenderer *self,
- Point *points, int num_points,
+draw_polyline(DiaRenderer *self,
+ Point *points, int num_points,
Color *color)
{
DxfRenderer *renderer = DXF_RENDERER(self);
@@ -301,23 +299,23 @@ draw_polyline(DiaRenderer *self,
for (i = 0; i < num_points; ++i)
fprintf(renderer->file, " 0\nVERTEX\n 10\n%s\n 20\n%s\n",
- g_ascii_formatd (buf, sizeof(buf), "%g", points[i].x),
+ g_ascii_formatd (buf, sizeof(buf), "%g", points[i].x),
g_ascii_formatd (buf2, sizeof(buf2), "%g", -points[i].y));
fprintf(renderer->file, " 0\nSEQEND\n");
}
-static void
+static void
draw_polygon (DiaRenderer *self,
Point *points, int num_points,
Color *fill, Color *stroke)
{
Color *color = fill ? fill : stroke;
DxfRenderer *renderer = DXF_RENDERER(self);
- /* We could emulate all polygons with multiple SOLID but it might not be
+ /* We could emulate all polygons with multiple SOLID but it might not be
* worth the effort. Following the easy part of polygons with 3 or 4 points.
*/
- int idx3[4] = {0, 1, 2, 2}; /* repeating last point is by specification
+ int idx3[4] = {0, 1, 2, 2}; /* repeating last point is by specification
and should not be necessary but it helps
limited importers */
int idx4[4] = {0, 1, 3, 2}; /* SOLID point order differs from Dia's */
@@ -338,13 +336,13 @@ draw_polygon (DiaRenderer *self,
fprintf(renderer->file, " 8\n%s\n", renderer->layername);
fprintf(renderer->file, " 62\n%d\n", dxf_color (color));
for (i = 0; i < 4; ++i)
- fprintf(renderer->file, " %d\n%s\n %d\n%s\n",
- 10+i, g_ascii_formatd (buf, sizeof(buf), "%g", points[idx[i]].x),
+ fprintf(renderer->file, " %d\n%s\n %d\n%s\n",
+ 10+i, g_ascii_formatd (buf, sizeof(buf), "%g", points[idx[i]].x),
20+i, g_ascii_formatd (buf2, sizeof(buf2), "%g", -points[idx[i]].y));
}
static void
-draw_arc(DiaRenderer *self,
+draw_arc(DiaRenderer *self,
Point *center,
real width, real height,
real angle1, real angle2,
@@ -378,7 +376,7 @@ draw_arc(DiaRenderer *self,
}
static void
-fill_arc(DiaRenderer *self,
+fill_arc(DiaRenderer *self,
Point *center,
real width, real height,
real angle1, real angle2,
@@ -388,7 +386,7 @@ fill_arc(DiaRenderer *self,
}
static void
-draw_ellipse(DiaRenderer *self,
+draw_ellipse(DiaRenderer *self,
Point *center,
real width, real height,
Color *fill, Color *stroke)
@@ -413,11 +411,11 @@ draw_ellipse(DiaRenderer *self,
fprintf(renderer->file, " 6\n%s\n", renderer->lcurrent.style);
fprintf(renderer->file, " 10\n%s\n", g_ascii_formatd (buf, sizeof(buf), "%g", center->x));
fprintf(renderer->file, " 20\n%s\n", g_ascii_formatd (buf, sizeof(buf), "%g", (-1)*center->y));
- fprintf(renderer->file, " 11\n%s\n", g_ascii_formatd (buf, sizeof(buf), "%g", width/2)); /* Endpoint
major axis relative to center X*/
+ fprintf(renderer->file, " 11\n%s\n", g_ascii_formatd (buf, sizeof(buf), "%g", width/2)); /* Endpoint
major axis relative to center X*/
fprintf(renderer->file, " 40\n%s\n", g_ascii_formatd (buf, sizeof(buf), "%g", height/width));
/*Ratio major/minor axis*/
fprintf(renderer->file, " 39\n%d\n", (int)(MAGIC_THICKNESS_FACTOR*renderer->lcurrent.width)); /*
Thickness */
fprintf(renderer->file, " 41\n%s\n", g_ascii_formatd (buf, sizeof(buf), "%g", 0.0)); /*Start
Parameter full ellipse */
- fprintf(renderer->file, " 42\n%s\n", g_ascii_formatd (buf, sizeof(buf), "%g", 2.0*3.14)); /* End
Parameter full ellipse */
+ fprintf(renderer->file, " 42\n%s\n", g_ascii_formatd (buf, sizeof(buf), "%g", 2.0*3.14)); /* End
Parameter full ellipse */
}
fprintf(renderer->file, " 62\n%d\n", dxf_color (color));
}
@@ -449,7 +447,7 @@ draw_string(DiaRenderer *self,
default:
fprintf(renderer->file, " 72\n%d\n", 1);
break;
- }
+ }
fprintf(renderer->file, " 7\n%s\n", "0"); /* Text style */
fprintf(renderer->file, " 1\n%s\n", text);
fprintf(renderer->file, " 39\n%d\n", (int)(MAGIC_THICKNESS_FACTOR*renderer->lcurrent.width)); /*
Thickness */
@@ -483,7 +481,7 @@ dxf_renderer_class_init (DxfRendererClass *klass)
renderer_class->set_linestyle = set_linestyle;
renderer_class->set_fillstyle = set_fillstyle;
renderer_class->set_font = set_font;
-
+
renderer_class->draw_line = draw_line;
renderer_class->draw_polygon = draw_polygon;
renderer_class->draw_polyline = draw_polyline;
@@ -513,7 +511,7 @@ export_dxf(DiagramData *data, DiaContext *ctx,
file = g_fopen(filename, "w");
if (file == NULL) {
- dia_context_add_message_with_errno (ctx, errno, _("Can't open output file %s"),
+ dia_context_add_message_with_errno (ctx, errno, _("Can't open output file %s"),
dia_context_get_filename(ctx));
return FALSE;
}
@@ -521,16 +519,16 @@ export_dxf(DiagramData *data, DiaContext *ctx,
renderer = g_object_new(DXF_TYPE_RENDERER, NULL);
renderer->file = file;
-
+
/* drawing limits */
fprintf(file, " 0\nSECTION\n 2\nHEADER\n");
- fprintf(file, " 9\n$EXTMIN\n 10\n%s\n 20\n%s\n",
- g_ascii_formatd (buf, sizeof(buf), "%g", data->extents.left),
+ fprintf(file, " 9\n$EXTMIN\n 10\n%s\n 20\n%s\n",
+ g_ascii_formatd (buf, sizeof(buf), "%g", data->extents.left),
g_ascii_formatd (buf2, sizeof(buf2), "%g", -data->extents.bottom));
- fprintf(file, " 9\n$EXTMAX\n 10\n%s\n 20\n%s\n",
+ fprintf(file, " 9\n$EXTMAX\n 10\n%s\n 20\n%s\n",
g_ascii_formatd (buf, sizeof(buf), "%g", data->extents.right),
g_ascii_formatd (buf2, sizeof(buf2), "%g", -data->extents.top));
- fprintf(file, " 0\nENDSEC\n");
+ fprintf(file, " 0\nENDSEC\n");
/* write layer description */
fprintf(file," 0\nSECTION\n 2\nTABLES\n 0\nTABLE\n");
@@ -545,11 +543,11 @@ export_dxf(DiagramData *data, DiaContext *ctx,
else
fprintf(file," 62\n%d\n",(-1)*(i+1));
}
- fprintf(file, " 0\nENDTAB\n 0\nENDSEC\n");
-
+ fprintf(file, " 0\nENDTAB\n 0\nENDSEC\n");
+
/* write graphics */
fprintf(file," 0\nSECTION\n 2\nENTITIES\n");
-
+
init_attributes(renderer);
DIA_RENDERER_GET_CLASS(renderer)->begin_render(DIA_RENDERER(renderer), NULL);
@@ -559,7 +557,7 @@ export_dxf(DiagramData *data, DiaContext *ctx,
renderer->layername = layer->name;
layer_render(layer, DIA_RENDERER(renderer), NULL, NULL, data, 0);
}
-
+
DIA_RENDERER_GET_CLASS(renderer)->end_render(DIA_RENDERER(renderer));
g_object_unref(renderer);
diff --git a/plug-ins/dxf/dxf-import.c b/plug-ins/dxf/dxf-import.c
index 77f82b6b..68e18cd8 100644
--- a/plug-ins/dxf/dxf-import.c
+++ b/plug-ins/dxf/dxf-import.c
@@ -4,7 +4,7 @@
*
* dxf-import.c: dxf import filter for dia
* Copyright (C) 2000 Steffen Macke
- * Copyright (C) 2002 Angus Ainslie
+ * Copyright (C) 2002 Angus Ainslie
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,10 +20,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-
-#ifdef HAVE_CONFIG_H
+
#include <config.h>
-#endif
#include <stdlib.h>
#include <stdio.h>
@@ -57,7 +55,7 @@ Point limit_min, limit_max;
/* maximum line length */
#define DXF_LINE_LENGTH 257
-typedef struct _DxfLayerData
+typedef struct _DxfLayerData
{
char layerName[256];
int acad_colour;
@@ -97,9 +95,9 @@ static void
_dxf_color_set_by_layer (const Layer *layer, int color_index)
{
if (!_color_by_layer_ht) /* lazy creation */
- _color_by_layer_ht = g_hash_table_new (g_direct_hash, g_direct_equal);
+ _color_by_layer_ht = g_hash_table_new (g_direct_hash, g_direct_equal);
g_hash_table_insert (_color_by_layer_ht, (void *)layer, GINT_TO_POINTER (color_index));
-}
+}
static int
_dxf_color_get_by_layer (const Layer *layer)
{
@@ -124,13 +122,13 @@ _color_init_from_rgb (Color *color, RGB_t rgb)
/* returns the layer with the given name */
/* TODO: merge this with other layer code? */
static Layer *
-layer_find_by_name(char *layername, DiagramData *dia)
+layer_find_by_name(char *layername, DiagramData *dia)
{
Layer *matching_layer, *layer;
guint i;
-
+
matching_layer = NULL;
-
+
for (i=0; i<dia->layers->len; i++) {
layer = (Layer *)g_ptr_array_index(dia->layers, i);
if(strcmp(layer->name, layername) == 0) {
@@ -151,7 +149,7 @@ layer_find_by_name(char *layername, DiagramData *dia)
/* returns the matching dia linestyle for a given dxf linestyle */
/* if no matching style is found, LINESTYLE solid is returned as a default */
static LineStyle
-get_dia_linestyle_dxf(char *dxflinestyle)
+get_dia_linestyle_dxf(char *dxflinestyle)
{
if (strcmp(dxflinestyle, "DASHED") == 0)
return LINESTYLE_DASHED;
@@ -171,10 +169,10 @@ read_entity_line_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
{
/* line data */
Point start, end;
-
- DiaObjectType *otype = object_get_type("Standard - Line");
+
+ DiaObjectType *otype = object_get_type("Standard - Line");
Handle *h1, *h2;
-
+
DiaObject *line_obj;
Color line_colour;
RGB_t color = { 0, };
@@ -183,7 +181,7 @@ read_entity_line_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
real line_width = DEFAULT_LINE_WIDTH;
LineStyle style = LINESTYLE_SOLID;
Layer *layer = dia->active_layer;
-
+
end.x=0;
end.y=0;
@@ -195,31 +193,31 @@ read_entity_line_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
}
switch(data->code){
case 6: style = get_dia_linestyle_dxf(data->value);
- break;
- case 8:
+ break;
+ case 8:
layer = layer_find_by_name(data->value, dia);
color = pal_get_rgb (_dxf_color_get_by_layer (layer));
break;
case 10:
start.x = g_ascii_strtod(data->value, NULL) * coord_scale * measure_scale;
break;
- case 11:
+ case 11:
end.x = g_ascii_strtod(data->value, NULL) * coord_scale * measure_scale;
break;
- case 20:
+ case 20:
start.y = (-1)*g_ascii_strtod(data->value, NULL) * coord_scale * measure_scale;
break;
- case 21:
+ case 21:
end.y = (-1)*g_ascii_strtod(data->value, NULL) * coord_scale * measure_scale;
break;
- case 39:
+ case 39:
line_width = g_ascii_strtod(data->value, NULL) * WIDTH_SCALE;
/*printf( "line width %f\n", line_width ); */
break;
case 62 :
color = pal_get_rgb (atoi(data->value));
break;
- }
+ }
} while(data->code != 0);
_color_init_from_rgb (&line_colour, color);
@@ -250,22 +248,22 @@ read_entity_solid_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
{
/* polygon data */
Point p[4];
-
- DiaObjectType *otype = object_get_type("Standard - Polygon");
+
+ DiaObjectType *otype = object_get_type("Standard - Polygon");
Handle *h1, *h2;
-
+
DiaObject *polygon_obj;
MultipointCreateData *pcd;
Color fill_colour;
GPtrArray *props;
-
+
real line_width = 0.001;
LineStyle style = LINESTYLE_SOLID;
Layer *layer = dia->active_layer;
RGB_t color = { 127, 127, 127 };
-
+
/* printf( "Solid " ); */
memset(p, 0, sizeof(p));
@@ -275,10 +273,10 @@ read_entity_solid_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
return( NULL );
}
switch(data->code){
- case 6:
+ case 6:
style = get_dia_linestyle_dxf(data->value);
- break;
- case 8:
+ break;
+ case 8:
layer = layer_find_by_name(data->value, dia);
color = pal_get_rgb (_dxf_color_get_by_layer (layer));
/*printf( "layer: %s ", data->value );*/
@@ -287,7 +285,7 @@ read_entity_solid_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
p[0].x = g_ascii_strtod(data->value, NULL) * coord_scale * measure_scale;
/*printf( "P0.x: %f ", p[0].x );*/
break;
- case 11:
+ case 11:
p[1].x = g_ascii_strtod(data->value, NULL) * coord_scale * measure_scale;
/*printf( "P1.x: %f ", p[1].x );*/
break;
@@ -299,41 +297,41 @@ read_entity_solid_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
p[2].x = g_ascii_strtod(data->value, NULL) * coord_scale * measure_scale;
/*printf( "P3.x: %f ", p[3].x );*/
break;
- case 20:
+ case 20:
p[0].y = (-1)*g_ascii_strtod(data->value, NULL) * coord_scale * measure_scale;
/*printf( "P0.y: %f ", p[0].y );*/
break;
- case 21:
+ case 21:
p[1].y = (-1)*g_ascii_strtod(data->value, NULL) * coord_scale * measure_scale;
/*printf( "P1.y: %f ", p[1].y );*/
break;
- case 22:
+ case 22:
p[2].y = p[3].y = (-1)*g_ascii_strtod(data->value, NULL) * coord_scale * measure_scale;
/*printf( "P2.y: %f ", p[2].y );*/
break;
- case 23:
+ case 23:
p[2].y = (-1)*g_ascii_strtod(data->value, NULL) * coord_scale * measure_scale;
/*printf( "P3.y: %f\n", p[3].y );*/
break;
- case 39:
+ case 39:
line_width = g_ascii_strtod(data->value, NULL) * WIDTH_SCALE;
/*printf( "width %f\n", line_width );*/
break;
- case 62:
+ case 62:
color = pal_get_rgb (atoi(data->value));
break;
- }
+ }
} while(data->code != 0);
pcd = g_new( MultipointCreateData, 1);
-
+
if( p[2].x != p[3].x || p[2].y != p[3].y )
pcd->num_points = 4;
else
pcd->num_points = 3;
-
+
pcd->points = g_new( Point, pcd->num_points );
-
+
memcpy( pcd->points, p, sizeof( Point ) * pcd->num_points );
polygon_obj = otype->ops->create( NULL, pcd, &h1, &h2 );
@@ -364,13 +362,13 @@ static int
is_equal( double a, double b )
{
double epsilon = 0.00001;
-
+
if( a == b )
return( 1 );
-
+
if(( a + epsilon ) > b && ( a - epsilon ) < b )
return( 1 );
-
+
return( 0 );
}
@@ -379,13 +377,13 @@ static DiaObject *
read_entity_polyline_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
{
int i;
-
+
/* polygon data */
Point *p = NULL, start, end, center;
-
+
DiaObjectType *otype = object_get_type("Standard - PolyLine");
Handle *h1, *h2;
-
+
DiaObject *polyline_obj;
MultipointCreateData *pcd;
@@ -413,17 +411,17 @@ read_entity_polyline_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
if( !strcmp( data->value, "VERTEX" ))
{
points++;
-
+
p = g_realloc( p, sizeof( Point ) * points );
-
+
/*printf( "Vertex %d\n", points );*/
-
+
}
- break;
- case 6:
+ break;
+ case 6:
style = get_dia_linestyle_dxf(data->value);
- break;
- case 8:
+ break;
+ case 8:
layer = layer_find_by_name(data->value, dia);
color = pal_get_rgb (_dxf_color_get_by_layer (layer));
/*printf( "layer: %s ", data->value );*/
@@ -436,7 +434,7 @@ read_entity_polyline_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
bulge_x_avail = (bulge_end == points);
}
break;
- case 20:
+ case 20:
if( points != 0 )
{
p[points-1].y = (-1)*g_ascii_strtod(data->value, NULL) * coord_scale * measure_scale;
@@ -444,7 +442,7 @@ read_entity_polyline_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
bulge_y_avail = (bulge_end == points);
}
break;
- case 39:
+ case 39:
line_width = g_ascii_strtod(data->value, NULL) * WIDTH_SCALE;
/*printf( "width %f\n", line_width );*/
break;
@@ -459,7 +457,7 @@ read_entity_polyline_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
bulge_end = points+1;
bulge_x_avail = bulge_y_avail = FALSE;
break;
- case 62:
+ case 62:
color = pal_get_rgb (atoi(data->value));
break;
case 70:
@@ -476,12 +474,12 @@ read_entity_polyline_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
continue;
start = p[points-2];
end = p[points-1];
-
+
radius = sqrt( pow( end.x - start.x, 2 ) + pow( end.y - start.y, 2 ))/2;
center.x = start.x + ( end.x - start.x )/2;
center.y = start.y + ( end.y - start.y )/2;
-
+
if( is_equal( start.x, end.x ))
{
if( is_equal( start.y, end.y ))
@@ -520,11 +518,11 @@ read_entity_polyline_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
{
start_angle = atan( center.y - start.y /center.x - start.x );
}
-
+
/*printf( "start x %f end x %f center x %f\n", start.x, end.x, center.x );
printf( "start y %f end y %f center y %f\n", start.y, end.y, center.y );
printf( "bulge %s %f startx_angle %f\n", data->value, radius, start_angle );*/
-
+
for( i=(points-1); i<(points+9); i++ )
{
p[i].x = center.x + cos( start_angle ) * radius;
@@ -533,30 +531,30 @@ read_entity_polyline_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
/*printf( "i %d x %f y %f\n", i, p[i].x, p[i].y );*/
}
points += 10;
-
+
p[points-1] = end;
-
+
}
} while( strcmp( data->value, "SEQEND" ));
-
+
if( points == 0 )
{
printf( "No vertexes defined\n" );
return( NULL );
}
-
+
pcd = g_new( MultipointCreateData, 1);
-
+
if( closed )
{
otype = object_get_type("Standard - Polygon");
}
-
+
pcd->num_points = points;
pcd->points = g_new( Point, pcd->num_points );
-
+
memcpy( pcd->points, p, sizeof( Point ) * pcd->num_points );
-
+
g_free( p );
polyline_obj = otype->ops->create( NULL, pcd, &h1, &h2 );
@@ -577,7 +575,7 @@ read_entity_polyline_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
layer_add_object( layer, polyline_obj );
else
return polyline_obj;
-
+
return NULL; /* don't add it twice */
}
@@ -588,10 +586,10 @@ read_entity_circle_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
/* circle data */
Point center = {0, 0};
real radius = 1.0;
-
- DiaObjectType *otype = object_get_type("Standard - Ellipse");
+
+ DiaObjectType *otype = object_get_type("Standard - Ellipse");
Handle *h1, *h2;
-
+
DiaObject *ellipse_obj;
RGB_t color = { 0, };
Color line_colour;
@@ -600,40 +598,40 @@ read_entity_circle_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
real line_width = DEFAULT_LINE_WIDTH;
Layer *layer = dia->active_layer;
-
+
do {
if(read_dxf_codes(filedxf, data) == FALSE){
return( NULL );
}
switch(data->code){
- case 8:
+ case 8:
layer = layer_find_by_name(data->value, dia);
color = pal_get_rgb (_dxf_color_get_by_layer (layer));
break;
- case 10:
+ case 10:
center.x = g_ascii_strtod(data->value, NULL) * coord_scale * measure_scale;
break;
- case 20:
+ case 20:
center.y = (-1)*g_ascii_strtod(data->value, NULL) * coord_scale * measure_scale;
break;
- case 39:
+ case 39:
line_width = g_ascii_strtod(data->value, NULL) * WIDTH_SCALE;
break;
- case 40:
+ case 40:
radius = g_ascii_strtod(data->value, NULL) * coord_scale * measure_scale;
break;
case 62 :
color = pal_get_rgb (atoi(data->value));
break;
}
-
+
} while(data->code != 0);
-
+
center.x -= radius;
center.y -= radius;
ellipse_obj = otype->ops->create(¢er, otype->default_user_data,
&h1, &h2);
-
+
_color_init_from_rgb (&line_colour, color);
props = g_ptr_array_new ();
@@ -644,7 +642,7 @@ read_entity_circle_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
prop_list_add_line_colour (props, &line_colour);
prop_list_add_line_width (props, line_width);
prop_list_add_show_background (props, FALSE);
-
+
ellipse_obj->ops->set_props(ellipse_obj, props);
prop_list_free(props);
@@ -666,9 +664,9 @@ read_entity_arc_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
real radius = 1.0, start_angle = 0.0, end_angle=360.0;
real curve_distance;
- DiaObjectType *otype = object_get_type("Standard - Arc");
+ DiaObjectType *otype = object_get_type("Standard - Arc");
Handle *h1, *h2;
-
+
DiaObject *arc_obj;
RGB_t color = { 0, };
Color line_colour;
@@ -676,26 +674,26 @@ read_entity_arc_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
real line_width = DEFAULT_LINE_WIDTH;
Layer *layer = dia->active_layer;
-
+
do {
if(read_dxf_codes(filedxf, data) == FALSE){
return( NULL );
}
switch(data->code){
- case 8:
+ case 8:
layer = layer_find_by_name(data->value, dia);
color = pal_get_rgb (_dxf_color_get_by_layer (layer));
break;
- case 10:
+ case 10:
center.x = g_ascii_strtod(data->value, NULL) * coord_scale * measure_scale;
break;
- case 20:
+ case 20:
center.y = (-1)*g_ascii_strtod(data->value, NULL) * coord_scale * measure_scale;
break;
- case 39:
+ case 39:
line_width = g_ascii_strtod(data->value, NULL) * WIDTH_SCALE;
break;
- case 40:
+ case 40:
radius = g_ascii_strtod(data->value, NULL) * coord_scale * measure_scale;
break;
case 50:
@@ -711,7 +709,7 @@ read_entity_arc_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
} while(data->code != 0);
/* printf("c.x=%f c.y=%f s",center.x,center.y); */
- start.x = center.x + cos(start_angle) * radius;
+ start.x = center.x + cos(start_angle) * radius;
start.y = center.y - sin(start_angle) * radius;
end.x = center.x + cos(end_angle) * radius;
end.y = center.y - sin(end_angle) * radius;
@@ -723,10 +721,10 @@ read_entity_arc_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
/*printf("start_angle: %f end_angle: %f radius:%f curve_distance:%f\n",
start_angle,end_angle,radius,curve_distance);*/
-
+
arc_obj = otype->ops->create(¢er, otype->default_user_data,
&h1, &h2);
-
+
_color_init_from_rgb (&line_colour, color);
props = g_ptr_array_new ();
@@ -735,10 +733,10 @@ read_entity_arc_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
prop_list_add_real (props, "curve_distance", curve_distance);
prop_list_add_line_colour (props, &line_colour);
prop_list_add_line_width (props, line_width);
-
+
arc_obj->ops->set_props(arc_obj, props);
prop_list_free(props);
-
+
if (layer)
layer_add_object(layer, arc_obj);
else
@@ -755,40 +753,40 @@ read_entity_ellipse_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
Point center = {0, 0};
real width = 1.0;
real ratio_width_height = 1.0;
-
+
DiaObjectType *otype = object_get_type("Standard - Ellipse");
Handle *h1, *h2;
-
- DiaObject *ellipse_obj;
+
+ DiaObject *ellipse_obj;
RGB_t color = { 0, };
Color line_colour;
GPtrArray *props;
real line_width = DEFAULT_LINE_WIDTH;
Layer *layer = dia->active_layer;
-
+
do {
if(read_dxf_codes(filedxf, data) == FALSE){
return( NULL );
}
switch(data->code){
- case 8:
+ case 8:
layer = layer_find_by_name(data->value, dia);
color = pal_get_rgb (_dxf_color_get_by_layer (layer));
break;
- case 10:
+ case 10:
center.x = g_ascii_strtod(data->value, NULL) * coord_scale * measure_scale;
break;
- case 11:
+ case 11:
ratio_width_height = g_ascii_strtod(data->value, NULL) * coord_scale * measure_scale;
break;
- case 20:
+ case 20:
center.y = (-1)*g_ascii_strtod(data->value, NULL) * coord_scale * measure_scale;
break;
- case 39:
+ case 39:
line_width = g_ascii_strtod(data->value, NULL) * WIDTH_SCALE;
break;
- case 40:
+ case 40:
width = g_ascii_strtod(data->value, NULL) * WIDTH_SCALE; /* XXX what scale */
break;
case 62 :
@@ -796,7 +794,7 @@ read_entity_ellipse_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
break;
}
} while(data->code != 0);
-
+
center.x -= width;
center.y -= (width*ratio_width_height);
ellipse_obj = otype->ops->create(¢er, otype->default_user_data,
@@ -812,7 +810,7 @@ read_entity_ellipse_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
prop_list_add_line_colour (props, &line_colour);
prop_list_add_line_width (props, line_width);
prop_list_add_show_background (props, FALSE);
-
+
ellipse_obj->ops->set_props(ellipse_obj, props);
prop_list_free(props);
@@ -839,10 +837,10 @@ read_entity_text_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
real y_offset = 0;
Alignment textalignment = ALIGN_LEFT;
char *textvalue = NULL, *textp;
-
+
DiaObjectType *otype = object_get_type("Standard - Text");
Handle *h1, *h2;
-
+
DiaObject *text_obj;
Color text_colour;
@@ -856,11 +854,11 @@ read_entity_text_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
return( NULL );
}
switch (data->code) {
- case 1:
+ case 1:
textvalue = g_strdup(data->value);
textp = textvalue;
/* FIXME - poor tab to space converter */
- do
+ do
{
if( textp[0] == '^' && textp[1] == 'I' )
{
@@ -868,17 +866,17 @@ read_entity_text_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
textp[1] = ' ';
textp++;
}
-
+
}
while( *(++textp) != '\0' );
-
+
/*printf( "Found text: %s\n", textvalue );*/
break;
- case 8:
+ case 8:
layer = layer_find_by_name(data->value, dia);
color = pal_get_rgb (_dxf_color_get_by_layer (layer));
break;
- case 10:
+ case 10:
location.x = g_ascii_strtod(data->value, NULL) * coord_scale * measure_scale;
/*printf( "Found text location x: %f\n", location.x );*/
break;
@@ -895,37 +893,37 @@ read_entity_text_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
/*location.y = (-1)*g_ascii_strtod(data->value, NULL) / text_scale;*/
/*printf( "Found text location y: %f\n", location.y );*/
break;
- case 40:
+ case 40:
height = g_ascii_strtod(data->value, NULL) * text_scale * coord_scale * measure_scale;
/*printf( "text height %f\n", height );*/
break;
- case 62:
+ case 62:
color = pal_get_rgb (atoi(data->value));
break;
- case 72:
+ case 72:
switch(atoi(data->value))
{
case 0:
textalignment = ALIGN_LEFT;
break;
- case 1:
+ case 1:
textalignment = ALIGN_CENTER;
break;
- case 2:
+ case 2:
textalignment = ALIGN_RIGHT;
- break;
+ break;
case 3:
/* FIXME - it's not clear what these are */
break;
- case 4:
+ case 4:
/* FIXME - it's not clear what these are */
- break;
- case 5:
+ break;
+ case 5:
/* FIXME - it's not clear what these are */
- break;
+ break;
}
break;
- case 73:
+ case 73:
switch(atoi(data->value))
{
case 0:
@@ -935,19 +933,19 @@ read_entity_text_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
/* 1 = bottom */
y_offset = 0;
break;
- case 2:
+ case 2:
/* 2 = middle */
y_offset = 0.5;
- break;
+ break;
case 3:
/* 3 = top */
y_offset = 1;
- break;
+ break;
}
break;
}
} while(data->code != 0);
-
+
location.y += y_offset * height;
_color_init_from_rgb (&text_colour, color);
text_obj = otype->ops->create(&location, otype->default_user_data,
@@ -965,10 +963,10 @@ read_entity_text_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
attributes_get_default_font(&tprop->attr.font, &tprop->attr.height);
tprop->attr.color = text_colour;
tprop->attr.height = height;
-
+
text_obj->ops->set_props(text_obj, props);
prop_list_free(props);
-
+
if (layer)
layer_add_object(layer, text_obj);
else
@@ -998,7 +996,7 @@ read_table_layer_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
else
_dxf_color_set_by_layer (layer, color_index);
break;
- }
+ }
} while ((data->code != 0) || (strcmp(data->value, "ENDTAB") != 0));
}
@@ -1011,17 +1009,17 @@ read_entity_scale_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
switch(data->code)
{
- case 40:
+ case 40:
coord_scale = g_ascii_strtod(data->value, NULL);
if (coord_scale > 0.0)
coord_scale = 1.0 / coord_scale;
g_message("Scale: %f", coord_scale );
break;
-
+
default:
break;
- }
-
+ }
+
}
static void
@@ -1034,22 +1032,22 @@ read_entitiy_lengthunit_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
switch(data->code)
{
- case 70:
+ case 70:
/* 1 = Scientific; 2 = Decimal; 3 = Engineering;
- * 4 = Architectural; 5 = Fractional; 6 = Windows desktop
+ * 4 = Architectural; 5 = Fractional; 6 = Windows desktop
*/
e = atoi(data->value);
g_message("LengthUnit: %f:%f", e, coord_scale );
break;
-
+
default:
break;
- }
-
+ }
+
}
/* reads a scale entity from the dxf file */
-static void
+static void
read_entity_measurement_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
{
if(read_dxf_codes(filedxf, data) == FALSE)
@@ -1065,11 +1063,11 @@ read_entity_measurement_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
measure_scale = 1.0;
/*printf( "Measure Scale: %f\n", measure_scale );*/
break;
-
+
default:
break;
- }
-
+ }
+
}
/* reads a textsize entity from the dxf file */
@@ -1078,7 +1076,7 @@ read_entity_textsize_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
{
if(read_dxf_codes(filedxf, data) == FALSE)
return;
-
+
switch(data->code)
{
case 40:
@@ -1086,16 +1084,16 @@ read_entity_textsize_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
if (text_scale > 0.0)
text_scale = 1.0 / text_scale;
/*printf( "Text Size: %f\n", text_scale );*/
- break;
+ break;
default:
break;
- }
+ }
}
/* reads the headers section of the dxf file */
static void
-read_section_header_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
+read_section_header_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
{
if(read_dxf_codes(filedxf, data) == FALSE){
return;
@@ -1114,14 +1112,14 @@ read_section_header_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
if(read_dxf_codes(filedxf, data) == FALSE){
return;
}
-
+
}
} while ((data->code != 0) || (strcmp(data->value, "ENDSEC") != 0));
}
/* reads the classes section of the dxf file */
static void
-read_section_classes_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
+read_section_classes_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
{
if(read_dxf_codes(filedxf, data) == FALSE){
return;
@@ -1135,14 +1133,14 @@ read_section_classes_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
if(read_dxf_codes(filedxf, data) == FALSE){
return;
}
-
+
}
} while ((data->code != 0) || (strcmp(data->value, "ENDSEC") != 0));
}
/* reads the tables section of the dxf file */
static void
-read_section_tables_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
+read_section_tables_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
{
if(read_dxf_codes(filedxf, data) == FALSE){
return;
@@ -1155,18 +1153,18 @@ read_section_tables_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
if(read_dxf_codes(filedxf, data) == FALSE){
return;
}
- }
+ }
} while ((data->code != 0) || (strcmp(data->value, "ENDSEC") != 0));
}
/* reads the entities section of the dxf file */
static void
-read_section_entities_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
+read_section_entities_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
{
if (read_dxf_codes(filedxf, data) == FALSE){
- return;
+ return;
}
- do {
+ do {
if((data->code == 0) && (strcmp(data->value, "LINE") == 0)) {
read_entity_line_dxf(filedxf, data, dia);
} else if((data->code == 0) && (strcmp(data->value, "VERTEX") == 0)) {
@@ -1193,17 +1191,17 @@ read_section_entities_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
/* reads the blocks section of the dxf file */
static void
-read_section_blocks_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
+read_section_blocks_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
{
int group_items = 0, group = 0;
GList *group_list = NULL;
DiaObject *obj = NULL;
Layer *group_layer = NULL;
-
+
if (read_dxf_codes(filedxf, data) == FALSE){
- return;
+ return;
}
- do {
+ do {
if((data->code == 0) && (strcmp(data->value, "LINE") == 0)) {
obj = read_entity_line_dxf(filedxf, data, dia);
} else if((data->code == 0) && (strcmp(data->value, "SOLID") == 0)) {
@@ -1222,12 +1220,12 @@ read_section_blocks_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
obj = read_entity_arc_dxf(filedxf,data,dia);
} else if((data->code == 0) && (strcmp(data->value, "BLOCK") == 0)) {
/* printf("Begin group\n" ); */
-
+
group = TRUE;
group_items = 0;
group_list = NULL;
group_layer = NULL;
-
+
do {
if(read_dxf_codes(filedxf, data) == FALSE)
return;
@@ -1238,7 +1236,7 @@ read_section_blocks_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
}
} while(data->code != 0);
-
+
} else if((data->code == 0) && (strcmp(data->value, "ENDBLK") == 0)) {
/* printf( "End group %d\n", group_items ); */
@@ -1250,30 +1248,30 @@ read_section_blocks_dxf(FILE *filedxf, DxfData *data, DiagramData *dia)
else
layer_add_object( group_layer, obj );
}
-
+
group = FALSE;
group_items = 0;
group_list = NULL;
obj = NULL;
-
+
if(read_dxf_codes(filedxf, data) == FALSE)
return;
-
+
} else {
if(read_dxf_codes(filedxf, data) == FALSE) {
return;
}
}
-
+
if( group && obj != NULL )
{
group_items++;
group_list = g_list_prepend( group_list, obj );
-
+
obj = NULL;
}
-
+
} while((data->code != 0) || (strcmp(data->value, "ENDSEC") != 0));
}
@@ -1283,16 +1281,16 @@ import_dxf(const gchar *filename, DiagramData *dia, DiaContext *ctx, void* user_
{
FILE *filedxf;
DxfData *data;
-
+
filedxf = g_fopen(filename,"r");
if(filedxf == NULL){
dia_context_add_message(ctx, _("Couldn't open: '%s' for reading.\n"),
dia_context_get_filename (ctx));
return FALSE;
}
-
+
data = g_new(DxfData, 1);
-
+
do {
if(read_dxf_codes(filedxf, data) == FALSE) {
g_free(data);
@@ -1349,7 +1347,7 @@ import_dxf(const gchar *filename, DiagramData *dia, DiaContext *ctx, void* user_
g_warning("Unknown dxf code %d", data->code);
}
}while((data->code != 0) || (strcmp(data->value, "EOF") != 0));
-
+
g_free(data);
if (_color_by_layer_ht) {
g_hash_table_destroy (_color_by_layer_ht);
@@ -1359,12 +1357,12 @@ import_dxf(const gchar *filename, DiagramData *dia, DiaContext *ctx, void* user_
}
/* reads a code/value pair from the DXF file */
-static gboolean
+static gboolean
read_dxf_codes(FILE *filedxf, DxfData *data)
{
int i;
char *c;
-
+
if(fgets(data->codeline, DXF_LINE_LENGTH, filedxf) == NULL){
return FALSE;
}
@@ -1373,13 +1371,13 @@ read_dxf_codes(FILE *filedxf, DxfData *data)
return FALSE;
}
c=data->value;
- for(i=0; i < DXF_LINE_LENGTH; i++){
+ for(i=0; i < DXF_LINE_LENGTH; i++){
if((c[i] == '\n')||(c[i] == '\r')){
c[i] = 0;
break;
}
}
- return TRUE;
+ return TRUE;
}
/* interface from filter.h */
diff --git a/plug-ins/hpgl/hpgl.c b/plug-ins/hpgl/hpgl.c
index 208d76de..6ee85f84 100644
--- a/plug-ins/hpgl/hpgl.c
+++ b/plug-ins/hpgl/hpgl.c
@@ -3,8 +3,8 @@
*
* hpgl.c -- HPGL export plugin for dia
* Copyright (C) 2000, Hans Breuer, <Hans Breuer Org>
- * based on dummy.c
- * based on CGM plug-in Copyright (C) 1999 James Henstridge.
+ * based on dummy.c
+ * based on CGM plug-in Copyright (C) 1999 James Henstridge.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -27,9 +27,7 @@
* interested renderers ?
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <stdio.h>
#include <string.h>
@@ -50,8 +48,8 @@
/* format specific */
#define HPGL_MAX_PENS 8
-#define PEN_HAS_COLOR (1 << 0)
-#define PEN_HAS_WIDTH (1 << 1)
+#define PEN_HAS_COLOR (1 << 0)
+#define PEN_HAS_WIDTH (1 << 1)
/* GObject boiler plate */
#define HPGL_TYPE_RENDERER (hpgl_renderer_get_type ())
@@ -118,7 +116,7 @@ hpgl_select_pen(HpglRenderer* renderer, Color* color, real width)
}
}
}
-
+
if (NULL != color) {
for (i = nPen; i < HPGL_MAX_PENS; i++) {
if (!(renderer->pen[i].has_it & PEN_HAS_COLOR)) {
@@ -160,7 +158,7 @@ hpgl_scale(HpglRenderer *renderer, real val)
return (int)((val + renderer->offset) * renderer->scale);
}
-/* render functions */
+/* render functions */
static void
begin_render(DiaRenderer *object, const Rectangle *update)
{
@@ -189,7 +187,7 @@ end_render(DiaRenderer *object)
static void
set_linewidth(DiaRenderer *object, real linewidth)
-{
+{
HpglRenderer *renderer = HPGL_RENDERER (object);
DIAG_NOTE(g_message("set_linewidth %f", linewidth));
@@ -289,36 +287,36 @@ set_font(DiaRenderer *object, DiaFont *font, real height)
}
/* Need to translate coord system:
- *
+ *
* Dia x,y -> Hpgl x,-y
*
* doing it before scaling.
*/
static void
-draw_line(DiaRenderer *object,
- Point *start, Point *end,
+draw_line(DiaRenderer *object,
+ Point *start, Point *end,
Color *line_colour)
{
HpglRenderer *renderer = HPGL_RENDERER (object);
- DIAG_NOTE(g_message("draw_line %f,%f -> %f, %f",
+ DIAG_NOTE(g_message("draw_line %f,%f -> %f, %f",
start->x, start->y, end->x, end->y));
hpgl_select_pen(renderer, line_colour, 0.0);
- fprintf (renderer->file,
+ fprintf (renderer->file,
"PU%d,%d;PD%d,%d;\n",
hpgl_scale(renderer, start->x), hpgl_scale(renderer, -start->y),
hpgl_scale(renderer, end->x), hpgl_scale(renderer, -end->y));
}
static void
-draw_polyline(DiaRenderer *object,
- Point *points, int num_points,
+draw_polyline(DiaRenderer *object,
+ Point *points, int num_points,
Color *line_colour)
{
HpglRenderer *renderer = HPGL_RENDERER (object);
int i;
- DIAG_NOTE(g_message("draw_polyline n:%d %f,%f ...",
+ DIAG_NOTE(g_message("draw_polyline n:%d %f,%f ...",
num_points, points->x, points->y));
g_return_if_fail(1 < num_points);
@@ -339,12 +337,12 @@ draw_polyline(DiaRenderer *object,
}
static void
-draw_polygon(DiaRenderer *object,
- Point *points, int num_points,
+draw_polygon(DiaRenderer *object,
+ Point *points, int num_points,
Color *fill, Color *stroke)
{
Color *color = fill ? fill : stroke;
- DIAG_NOTE(g_message("draw_polygon n:%d %f,%f ...",
+ DIAG_NOTE(g_message("draw_polygon n:%d %f,%f ...",
num_points, points->x, points->y));
g_return_if_fail (color != NULL);
draw_polyline(object,points,num_points, color);
@@ -353,7 +351,7 @@ draw_polygon(DiaRenderer *object,
}
static void
-draw_rect(DiaRenderer *object,
+draw_rect(DiaRenderer *object,
Point *ul_corner, Point *lr_corner,
Color *fill, Color *stroke)
{
@@ -362,7 +360,7 @@ draw_rect(DiaRenderer *object,
g_return_if_fail (colour != NULL);
- DIAG_NOTE(g_message("draw_rect %f,%f -> %f,%f",
+ DIAG_NOTE(g_message("draw_rect %f,%f -> %f,%f",
ul_corner->x, ul_corner->y, lr_corner->x, lr_corner->y));
hpgl_select_pen(renderer, colour, 0.0);
fprintf (renderer->file, "PU%d,%d;PD;EA%d,%d;\n",
@@ -373,7 +371,7 @@ draw_rect(DiaRenderer *object,
}
static void
-draw_arc(DiaRenderer *object,
+draw_arc(DiaRenderer *object,
Point *center,
real width, real height,
real angle1, real angle2,
@@ -382,7 +380,7 @@ draw_arc(DiaRenderer *object,
HpglRenderer *renderer = HPGL_RENDERER (object);
Point start;
- DIAG_NOTE(g_message("draw_arc %fx%f <%f,<%f",
+ DIAG_NOTE(g_message("draw_arc %fx%f <%f,<%f",
width, height, angle1, angle2));
hpgl_select_pen(renderer, colour, 0.0);
@@ -393,7 +391,7 @@ draw_arc(DiaRenderer *object,
angle2 = tmp;
}
/* move to start point */
- start.x = center->x + (width / 2.0) * cos((M_PI / 180.0) * angle1);
+ start.x = center->x + (width / 2.0) * cos((M_PI / 180.0) * angle1);
start.y = - center->y + (height / 2.0) * sin((M_PI / 180.0) * angle1);
fprintf (renderer->file, "PU%d,%d;PD;",
hpgl_scale(renderer, start.x),
@@ -406,7 +404,7 @@ draw_arc(DiaRenderer *object,
}
static void
-fill_arc(DiaRenderer *object,
+fill_arc(DiaRenderer *object,
Point *center,
real width, real height,
real angle1, real angle2,
@@ -414,7 +412,7 @@ fill_arc(DiaRenderer *object,
{
HpglRenderer *renderer = HPGL_RENDERER (object);
- DIAG_NOTE(g_message("fill_arc %fx%f <%f,<%f",
+ DIAG_NOTE(g_message("fill_arc %fx%f <%f,<%f",
width, height, angle1, angle2));
g_assert (width == height);
@@ -430,10 +428,10 @@ fill_arc(DiaRenderer *object,
/* may go into lib/diarenderer.c if another renderer would be interested */
/* Draw an ellipse approximation consisting out of
- * four arcs.
+ * four arcs.
*/
static void
-draw_ellipse_by_arc (DiaRenderer *renderer,
+draw_ellipse_by_arc (DiaRenderer *renderer,
Point *center,
real width, real height,
Color *colour)
@@ -481,7 +479,7 @@ draw_ellipse_by_arc (DiaRenderer *renderer,
}
static void
-draw_ellipse(DiaRenderer *object,
+draw_ellipse(DiaRenderer *object,
Point *center,
real width, real height,
Color *fill, Color *stroke)
@@ -489,13 +487,13 @@ draw_ellipse(DiaRenderer *object,
HpglRenderer *renderer = HPGL_RENDERER (object);
Color *colour = fill ? fill : stroke;
- DIAG_NOTE(g_message("draw_ellipse %fx%f center @ %f,%f",
+ DIAG_NOTE(g_message("draw_ellipse %fx%f center @ %f,%f",
width, height, center->x, center->y));
if (width != height)
{
draw_ellipse_by_arc(object, center, width, height, colour);
- }
+ }
else
{
hpgl_select_pen(renderer, colour, 0.0);
@@ -516,7 +514,7 @@ draw_string(DiaRenderer *object,
HpglRenderer *renderer = HPGL_RENDERER (object);
real width, height;
- DIAG_NOTE(g_message("draw_string %f,%f %s",
+ DIAG_NOTE(g_message("draw_string %f,%f %s",
pos->x, pos->y, text));
/* set position */
@@ -542,9 +540,9 @@ draw_string(DiaRenderer *object,
* set the capital letter box width and height as a percentage of
* P2X-P1X and P2Y-P1Y
*/
- height = (127.999 * renderer->font_height * renderer->scale) / renderer->size.y;
+ height = (127.999 * renderer->font_height * renderer->scale) / renderer->size.y;
width = 0.75 * height; /* FIXME: */
- fprintf(renderer->file, "SR%d.%03d,%d.%03d;",
+ fprintf(renderer->file, "SR%d.%03d,%d.%03d;",
(int)width, (int)((width * 1000) % 1000),
(int)height, (int)((height * 1000) % 1000));
#else
@@ -554,7 +552,7 @@ draw_string(DiaRenderer *object,
*/
width = renderer->font_height * renderer->scale * 0.75 * 0.0025;
height = renderer->font_height * renderer->scale * 0.0025;
- fprintf(renderer->file, "SI%d.%03d,%d.%03d;",
+ fprintf(renderer->file, "SI%d.%03d,%d.%03d;",
(int)width, ((int)(width * 1000) % 1000),
(int)height, ((int)(height * 1000) % 1000));
#endif
@@ -568,7 +566,7 @@ draw_image(DiaRenderer *object,
real width, real height,
DiaImage *image)
{
- DIAG_NOTE(g_message("draw_image %fx%f @%f,%f",
+ DIAG_NOTE(g_message("draw_image %fx%f @%f,%f",
width, height, point->x, point->y));
g_warning("HPGL: images unsupported!");
}
@@ -602,7 +600,7 @@ hpgl_renderer_get_type (void)
"HpglRenderer",
&object_info, 0);
}
-
+
return object_type;
}
@@ -662,7 +660,7 @@ export_data(DiagramData *data, DiaContext *ctx,
file = g_fopen(filename, "w"); /* "wb" for binary! */
if (!file) {
- dia_context_add_message_with_errno(ctx, errno, _("Can't open output file %s."),
+ dia_context_add_message_with_errno(ctx, errno, _("Can't open output file %s."),
dia_context_get_filename(ctx));
return FALSE;
}
@@ -674,7 +672,7 @@ export_data(DiagramData *data, DiaContext *ctx,
extent = &data->extents;
/* use extents */
- DIAG_NOTE(g_message("export_data extents %f,%f -> %f,%f",
+ DIAG_NOTE(g_message("export_data extents %f,%f -> %f,%f",
extent->left, extent->top, extent->right, extent->bottom));
width = extent->right - extent->left;
diff --git a/plug-ins/postscript/paginate_psprint.c b/plug-ins/postscript/paginate_psprint.c
index 321eef47..dd917f11 100644
--- a/plug-ins/postscript/paginate_psprint.c
+++ b/plug-ins/postscript/paginate_psprint.c
@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
/* so we get popen and sigaction even when compiling with -ansi */
#define _POSIX_C_SOURCE 2
diff --git a/plug-ins/python/python.c b/plug-ins/python/python.c
index 54b3e027..7093cca5 100644
--- a/plug-ins/python/python.c
+++ b/plug-ins/python/python.c
@@ -17,9 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <Python.h>
#include <stdio.h>
@@ -61,7 +59,7 @@ on_error_report (void)
return TRUE;
}
else
- return FALSE;
+ return FALSE;
}
static gboolean
@@ -93,7 +91,7 @@ dia_plugin_init(PluginInfo *info)
}
if (!dia_plugin_info_init(info, "Python",
_("Python scripting support"),
- dia_py_plugin_can_unload,
+ dia_py_plugin_can_unload,
dia_py_plugin_unload))
return DIA_PLUGIN_INIT_ERROR;
@@ -130,17 +128,17 @@ dia_plugin_init(PluginInfo *info)
PyObject_SetAttrString(__main__, "__file__", __file__);
Py_DECREF(__file__);
#if defined(G_OS_WIN32) && (PY_VERSION_HEX >= 0x02040000)
- /* this code should work for every supported Python version, but it is needed
+ /* this code should work for every supported Python version, but it is needed
* on win32 since Python 2.4 due to mixed runtime issues, i.e.
- * crashing in PyRun_SimpleFile for python2(5|6)/msvcr(71|90)
- * It is not enabled by default yet, because I could not get PyGtk using
+ * crashing in PyRun_SimpleFile for python2(5|6)/msvcr(71|90)
+ * It is not enabled by default yet, because I could not get PyGtk using
* plug-ins to work at all with 2.5/2.6 */
{
gchar *startup_string = NULL;
gsize i, length = 0;
GError *error = NULL;
if (!g_file_get_contents(startup_file, &startup_string, &length, &error)) {
- g_warning("Python: Couldn't find startup file %s\n%s\n",
+ g_warning("Python: Couldn't find startup file %s\n%s\n",
startup_file, error->message);
g_error_free(error);
g_free(startup_file);
diff --git a/plug-ins/svg/svg-import.c b/plug-ins/svg/svg-import.c
index 0d1ac0ee..039c5e3a 100644
--- a/plug-ins/svg/svg-import.c
+++ b/plug-ins/svg/svg-import.c
@@ -21,9 +21,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <stdio.h>
#include <string.h>
@@ -62,7 +60,7 @@ static gboolean import_svg (xmlDocPtr doc, DiagramData *dia, DiaContext *ctx, vo
static GPtrArray *make_element_props(real xpos, real ypos, real width, real height);
/* TODO: use existing implementation in dia source */
-static Color
+static Color
get_colour(gint32 c, real opacity)
{
Color colour;
@@ -76,7 +74,7 @@ get_colour(gint32 c, real opacity)
/*!
* \brief SVG Default Scale
- * Dia default scale is 20px per cm; the user scale *should* be dynamic but this would
+ * Dia default scale is 20px per cm; the user scale *should* be dynamic but this would
* involve a much more complicated approach than implemented in this importer, e.g.
* full transformations and dynamic scale to view port (viewBox).
* \ingroup SvgImport
@@ -85,8 +83,8 @@ const gdouble DEFAULT_SVG_SCALE = 20.0;
static gdouble user_scale = 20.0;
/*!
- * Read a numeric value from a string taking unit into account.
- * The signature is the same as g_ascii_strtod but also reads
+ * Read a numeric value from a string taking unit into account.
+ * The signature is the same as g_ascii_strtod but also reads
* the unit if there is one
* \ingroup SvgImport
*/
@@ -98,7 +96,7 @@ get_value_as_cm (const gchar *nptr,
gdouble val = 0.0;
g_return_val_if_fail (nptr != NULL, 0.0);
-
+
val = g_ascii_strtod (nptr, &endp);
if (!endp || '\0' == *endp || ' ' == *endp || ',' == *endp || ';' == *endp)
val /= user_scale;
@@ -115,10 +113,10 @@ get_value_as_cm (const gchar *nptr,
else if (strncmp(endp, "pc", 2) == 0)
val *= (2.54/6.0), endp+=2;
/* the rest can't really be resolved here, passing unit to caller (who will just ignore at the moment) */
-
+
if (endptr)
*endptr = endp;
-
+
return val;
}
@@ -126,7 +124,7 @@ static PropDescription svg_line_prop_descs[] = {
{ "start_point", PROP_TYPE_POINT },
{ "end_point", PROP_TYPE_POINT },
PROP_DESC_END};
-
+
static PropDescription svg_rect_prop_descs[] = {
{ "start_point", PROP_TYPE_POINT },
{ "end_point", PROP_TYPE_POINT },
@@ -254,8 +252,8 @@ use_position (DiaObject *obj, xmlNodePtr node, DiaContext *ctx)
RealProperty *pr;
/* setting obj_pos is pointless, it is read-only in all objects */
- prop_list_add_point (props, "obj_pos", &pos);
- prop_list_add_point (props, "elem_corner", &pos);
+ prop_list_add_point (props, "obj_pos", &pos);
+ prop_list_add_point (props, "elem_corner", &pos);
prop_list_add_real (props, "elem_width", 1.0);
prop_list_add_real (props, "elem_height", 1.0);
@@ -332,7 +330,7 @@ _css_parse_style (DiaSvgStyle *s, real user_scale,
style = g_hash_table_lookup (style_ht, key);
g_free (key);
}
- }
+ }
if (!style && klass) {
gchar *key = g_strdup_printf (".%s", klass);
style = g_hash_table_lookup (style_ht, key);
@@ -453,7 +451,7 @@ apply_style(DiaObject *obj, xmlNodePtr node, DiaSvgStyle *parent_style,
dia_svg_parse_style(node, gs, user_scale);
props = prop_list_from_descs(svg_style_prop_descs, pdtpp_true);
g_assert(props->len == 7);
-
+
cprop = g_ptr_array_index(props,0);
if (gs->stroke == DIA_SVG_COLOUR_DEFAULT) {
if (init) /* no stroke */
@@ -471,7 +469,7 @@ apply_style(DiaObject *obj, xmlNodePtr node, DiaSvgStyle *parent_style,
rprop = g_ptr_array_index(props,1);
rprop->real_data = gs->line_width * scale;
-
+
lsprop = g_ptr_array_index(props,2);
if (gs->linestyle != LINESTYLE_DEFAULT)
lsprop->style = gs->linestyle;
@@ -515,7 +513,7 @@ apply_style(DiaObject *obj, xmlNodePtr node, DiaSvgStyle *parent_style,
_set_pattern_from_key (obj, bprop, pattern_ht, key);
g_free (key);
}
- xmlFree(str);
+ xmlFree(str);
} else if (gs->fill == DIA_SVG_COLOUR_NONE) {
/* check the style again, it might contain a pattern */
str = xmlGetProp(node, (const xmlChar*)"style");
@@ -763,7 +761,7 @@ read_text_svg(xmlNodePtr node, DiaSvgStyle *parent_style,
}
/* parse from <text/> before looking at the first <tspan/> */
- dia_svg_parse_style(node, gs, user_scale);
+ dia_svg_parse_style(node, gs, user_scale);
{
xmlNode *tspan = node->children;
@@ -782,7 +780,7 @@ read_text_svg(xmlNodePtr node, DiaSvgStyle *parent_style,
g_string_append(paragraph, (gchar*)line);
xmlFree(line);
any_tspan = TRUE;
- }
+ }
tspan = tspan->next;
}
multiline = paragraph->str;
@@ -815,7 +813,7 @@ read_text_svg(xmlNodePtr node, DiaSvgStyle *parent_style,
prop->attr.alignment = gs->alignment;
prop->attr.position.x = point.x;
prop->attr.position.y = point.y;
- /* FIXME: looks like a leak but without this an imported svg is
+ /* FIXME: looks like a leak but without this an imported svg is
* crashing on release */
prop->attr.font = dia_font_ref (gs->font);
if (font_height > 0.0) {
@@ -866,7 +864,7 @@ read_text_svg(xmlNodePtr node, DiaSvgStyle *parent_style,
static GList *
read_poly_svg(xmlNodePtr node, DiaSvgStyle *parent_style,
GHashTable *style_ht, GHashTable *pattern_ht,
- GList *list, char *object_type)
+ GList *list, char *object_type)
{
DiaObjectType *otype;
DiaObject *new_obj;
@@ -885,7 +883,7 @@ read_poly_svg(xmlNodePtr node, DiaSvgStyle *parent_style,
matrix = dia_svg_parse_transform ((char *)str, user_scale);
xmlFree (str);
}
-
+
/* Uh, oh, no : apparently a fill="" in a group above make this a polygon */
if (_node_closed_by_style (node, parent_style))
otype = object_get_type("Standard - Polygon");
@@ -924,7 +922,7 @@ read_poly_svg(xmlNodePtr node, DiaSvgStyle *parent_style,
g_array_free(arr, TRUE);
if (matrix)
g_free (matrix);
-
+
pcd->points = points;
new_obj = otype->ops->create(NULL, pcd,
&h1, &h2);
@@ -991,7 +989,7 @@ read_ellipse_svg(xmlNodePtr node, DiaSvgStyle *parent_style,
return g_list_append (list, new_obj);
}
-/*!
+/*!
* \brief Read a line element from SVG
* \ingroup SvgImport
*/
@@ -1022,7 +1020,7 @@ read_line_svg(xmlNodePtr node, DiaSvgStyle *parent_style,
new_obj = otype->ops->create(&start, otype->default_user_data,
&h1, &h2);
-
+
props = prop_list_from_descs(svg_line_prop_descs,pdtpp_true);
g_assert(props->len == 2);
@@ -1116,7 +1114,7 @@ read_rect_svg(xmlNodePtr node, DiaSvgStyle *parent_style,
rprop = g_ptr_array_index(props,2);
rprop->real_data = corner_radius;
-
+
new_obj->ops->set_props(new_obj, props);
prop_list_free(props);
props = make_element_props(start.x,start.y,width,height);
@@ -1165,7 +1163,7 @@ read_image_svg(xmlNodePtr node, DiaSvgStyle *parent_style,
if (strncmp ((char *)str, "data:image/", 11) == 0) {
/* inline data - skip format description like: data:image/png;base64, */
const char* data = strchr((char *)str, ',');
-
+
if (data) {
GdkPixbuf *pixbuf = pixbuf_decode_base64 (data+1);
@@ -1186,7 +1184,7 @@ read_image_svg(xmlNodePtr node, DiaSvgStyle *parent_style,
if (!filename || !g_path_is_absolute (filename)) {
/* if image file path is relative use the main path */
gchar *dir = g_path_get_dirname (filename_svg);
- gchar *absfn = g_build_path (G_DIR_SEPARATOR_S,
+ gchar *absfn = g_build_path (G_DIR_SEPARATOR_S,
dir, filename ? filename : (gchar *)str, NULL);
g_free (filename);
@@ -1346,7 +1344,7 @@ read_gradient (xmlNodePtr node, DiaSvgStyle *parent_gs, GHashTable *pattern_ht,
* \brief Parse the CSS style block of the SVG
*
* Extract style information from the given node into a map for later use.
- *
+ *
* @param node containing the style
* @param ht hash table with style key and style string
*
@@ -1431,7 +1429,7 @@ _node_read_viewbox (xmlNodePtr root, DiaMatrix **mat)
gchar *remains = NULL;
gboolean percent;
gchar **vals;
-
+
width = get_value_as_cm ((const char *)swidth, &remains);
percent = (remains && *remains == '%');
height = get_value_as_cm ((const char *)sheight, &remains);
@@ -1455,7 +1453,7 @@ _node_read_viewbox (xmlNodePtr root, DiaMatrix **mat)
} else {
xs = ys = DEFAULT_SVG_SCALE * (100.0 / sqrt(width*height));
}
- /* plausibility check, strictly speaking these are not required to be the same
+ /* plausibility check, strictly speaking these are not required to be the same
* /or/ are they and Dia is writing a bogus viewBox?
*/
if (fabs((fabs (xs/ys) - 1.0) < 0.1) && fabs((fabs (ys/xs) - 1.0) < 0.1)) {
@@ -1488,13 +1486,13 @@ _node_read_viewbox (xmlNodePtr root, DiaMatrix **mat)
/*!
* Fill a GList* with objects which is to be put in a
- * diagram or a group by the caller.
+ * diagram or a group by the caller.
* Can be called recursively to allow groups in groups.
*
* @param startnode the XML node to dive into
* @param parent_gs the graphic style inherited by parent
* @param defs_ht a map of objects filled from 'defs' to use as templates for 'use'
- * @param style_ht map of styles
+ * @param style_ht map of styles
* @param pattern_ht map of patterns
* @param filename_svg SVG filename for better error messages
* @param ctx context to keep error messages grouped
@@ -1503,7 +1501,7 @@ _node_read_viewbox (xmlNodePtr root, DiaMatrix **mat)
* \ingroup SvgImport
*/
static GList*
-read_items (xmlNodePtr startnode,
+read_items (xmlNodePtr startnode,
DiaSvgStyle *parent_gs,
GHashTable *defs_ht,
GHashTable *style_ht,
@@ -1758,7 +1756,7 @@ read_items (xmlNodePtr startnode,
* \ingroup SvgImport
*/
static void
-read_defs (xmlNodePtr startnode,
+read_defs (xmlNodePtr startnode,
DiaSvgStyle *parent_gs,
GHashTable *defs_ht,
GHashTable *style_ht,
@@ -1915,7 +1913,7 @@ import_shape_info (xmlNodePtr start_node, DiagramData *dia, DiaContext *ctx)
Handle *h1, *h2;
const DiaObjectType *ot = is_main ? ot_mp : ot_cp;
DiaObject *o;
-
+
o = ot->ops->create (&pos, ot->default_user_data, &h1, &h2);
if (o) {
@@ -1964,19 +1962,19 @@ import_memory_svg (const guchar *p, guint size, DiagramData *dia,
* \ingroup SvgImport
*/
static gboolean
-import_file_svg(const gchar *filename, DiagramData *dia, DiaContext *ctx, void* user_data)
+import_file_svg(const gchar *filename, DiagramData *dia, DiaContext *ctx, void* user_data)
{
xmlErrorPtr error_xml = NULL;
xmlDocPtr doc = xmlDoParseFile(filename, &error_xml);
if (!doc) {
- dia_context_add_message(ctx, _("SVG parser error for %s\n%s"),
+ dia_context_add_message(ctx, _("SVG parser error for %s\n%s"),
dia_context_get_filename (ctx),
error_xml ? error_xml->message : "");
return FALSE;
} else if (error_xml) {
/* just a warning */
- dia_context_add_message(ctx, _("SVG parser warning for %s\n%s"),
+ dia_context_add_message(ctx, _("SVG parser warning for %s\n%s"),
dia_context_get_filename (ctx),
error_xml ? error_xml->message : "");
}
diff --git a/plug-ins/vdx/vdx-export.c b/plug-ins/vdx/vdx-export.c
index c173ed8e..62cc68ec 100644
--- a/plug-ins/vdx/vdx-export.c
+++ b/plug-ins/vdx/vdx-export.c
@@ -24,9 +24,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <stdio.h>
@@ -104,7 +102,7 @@ static gboolean export_vdx(DiagramData *data, DiaContext *ctx,
void* user_data);
static int
-vdxCheckColor(VDXRenderer *renderer, Color *color);
+vdxCheckColor(VDXRenderer *renderer, Color *color);
static gpointer parent_class = NULL;
@@ -137,7 +135,7 @@ vdx_renderer_get_type (void)
"VDXRenderer",
&object_info, 0);
}
-
+
return object_type;
}
@@ -155,14 +153,14 @@ vdx_renderer_finalize (GObject *object)
* @param self a renderer
*/
-static void
+static void
begin_render(DiaRenderer *self, const Rectangle *update)
{
VDXRenderer *renderer = VDX_RENDERER(self);
Color c;
-
+
renderer->depth = 0;
-
+
renderer->linewidth = 0;
renderer->capsmode = 0;
renderer->joinmode = 0;
@@ -191,8 +189,8 @@ begin_render(DiaRenderer *self, const Rectangle *update)
* @param self a renderer
*/
-static void
-end_render(DiaRenderer *self)
+static void
+end_render(DiaRenderer *self)
{
VDXRenderer *renderer = VDX_RENDERER(self);
@@ -219,8 +217,8 @@ visio_point(Point p)
* @param length a length
* @returns length in Visio space
*/
-
-static double
+
+static double
visio_length(double length)
{
return length/vdx_Point_Scale;
@@ -231,8 +229,8 @@ visio_length(double length)
* @param linewidth new line width
*/
-static void
-set_linewidth(DiaRenderer *self, real linewidth)
+static void
+set_linewidth(DiaRenderer *self, real linewidth)
{
VDXRenderer *renderer = VDX_RENDERER(self);
@@ -244,8 +242,8 @@ set_linewidth(DiaRenderer *self, real linewidth)
* @param mode new line caps
*/
-static void
-set_linecaps(DiaRenderer *self, LineCaps mode)
+static void
+set_linecaps(DiaRenderer *self, LineCaps mode)
{
VDXRenderer *renderer = VDX_RENDERER(self);
@@ -257,8 +255,8 @@ set_linecaps(DiaRenderer *self, LineCaps mode)
* @param mode new line join
*/
-static void
-set_linejoin(DiaRenderer *self, LineJoin mode)
+static void
+set_linejoin(DiaRenderer *self, LineJoin mode)
{
VDXRenderer *renderer = VDX_RENDERER(self);
@@ -270,7 +268,7 @@ set_linejoin(DiaRenderer *self, LineJoin mode)
* @param mode new line style
*/
-static void
+static void
set_linestyle(DiaRenderer *self, LineStyle mode, real dash_length)
{
VDXRenderer *renderer = VDX_RENDERER(self);
@@ -284,8 +282,8 @@ set_linestyle(DiaRenderer *self, LineStyle mode, real dash_length)
* @param mode new file style
*/
-static void
-set_fillstyle(DiaRenderer *self, FillStyle mode)
+static void
+set_fillstyle(DiaRenderer *self, FillStyle mode)
{
VDXRenderer *renderer = VDX_RENDERER(self);
@@ -298,8 +296,8 @@ set_fillstyle(DiaRenderer *self, FillStyle mode)
* @param height new font height
*/
-static void
-set_font(DiaRenderer *self, DiaFont *font, real height)
+static void
+set_font(DiaRenderer *self, DiaFont *font, real height)
{
VDXRenderer *renderer = VDX_RENDERER(self);
@@ -314,12 +312,12 @@ set_font(DiaRenderer *self, DiaFont *font, real height)
*/
static int
-vdxCheckColor(VDXRenderer *renderer, Color *color)
+vdxCheckColor(VDXRenderer *renderer, Color *color)
{
int i;
Color cmp_color;
- for (i = 0; i < renderer->Colors->len; i++)
+ for (i = 0; i < renderer->Colors->len; i++)
{
cmp_color = g_array_index(renderer->Colors, Color, i);
if (color_equals(color, &cmp_color)) return i;
@@ -335,13 +333,13 @@ vdxCheckColor(VDXRenderer *renderer, Color *color)
*/
static int
-vdxCheckFont(VDXRenderer *renderer)
+vdxCheckFont(VDXRenderer *renderer)
{
int i;
const char *cmp_font;
const char *font = dia_font_get_family(renderer->font);
- for (i = 0; i < renderer->Fonts->len; i++)
+ for (i = 0; i < renderer->Fonts->len; i++)
{
cmp_font = g_array_index(renderer->Fonts, char *, i);
if (!strcmp(cmp_font, font))
@@ -360,9 +358,9 @@ vdxCheckFont(VDXRenderer *renderer)
* @param end_arrow optional end arrow
* @todo join, caps, dashlength
*/
-static void
+static void
create_Line(VDXRenderer *renderer, Color *color, struct vdx_Line *Line,
- Arrow *start_arrow, Arrow *end_arrow)
+ Arrow *start_arrow, Arrow *end_arrow)
{
/* A Line (colour etc) */
memset(Line, 0, sizeof(*Line));
@@ -392,7 +390,7 @@ create_Line(VDXRenderer *renderer, Color *color, struct vdx_Line *Line,
/* VDX only has Rounded (0) or Square (1) ends */
if (renderer->capsmode != LINECAPS_ROUND)
Line->LineCap = 1; /* Square */
- if (start_arrow || end_arrow)
+ if (start_arrow || end_arrow)
{
g_debug("create_Line (ARROWS)");
}
@@ -405,7 +403,7 @@ create_Line(VDXRenderer *renderer, Color *color, struct vdx_Line *Line,
* @todo fillstyle
*/
-static void
+static void
create_Fill(VDXRenderer *renderer, Color *color, struct vdx_Fill *Fill)
{
/* A Fill (colour etc) */
@@ -424,8 +422,8 @@ create_Fill(VDXRenderer *renderer, Color *color, struct vdx_Fill *Fill)
* @param color line colour
*/
-static void
-draw_line(DiaRenderer *self, Point *start, Point *end, Color *color)
+static void
+draw_line(DiaRenderer *self, Point *start, Point *end, Color *color)
{
VDXRenderer *renderer = VDX_RENDERER(self);
Point a, b;
@@ -439,14 +437,14 @@ draw_line(DiaRenderer *self, Point *start, Point *end, Color *color)
char NameU[VDX_NAMEU_LEN];
/* First time through, just construct the colour table */
- if (renderer->first_pass)
+ if (renderer->first_pass)
{
vdxCheckColor(renderer, color);
return;
}
-
+
g_debug("draw_line((%f,%f), (%f,%f))", start->x, start->y, end->x, end->y);
-
+
/* Setup the standard shape object */
memset(&Shape, 0, sizeof(Shape));
Shape.any.type = vdx_types_Shape;
@@ -494,7 +492,7 @@ draw_line(DiaRenderer *self, Point *start, Point *end, Color *color)
memset(&LineTo, 0, sizeof(LineTo));
LineTo.any.type = vdx_types_LineTo;
LineTo.IX = 2;
- LineTo.X = b.x-a.x;
+ LineTo.X = b.x-a.x;
LineTo.Y = b.y-a.y;
/* A Line (colour etc) */
@@ -525,7 +523,7 @@ draw_line(DiaRenderer *self, Point *start, Point *end, Color *color)
* @param color line colour
*/
-static void draw_polyline(DiaRenderer *self, Point *points, int num_points,
+static void draw_polyline(DiaRenderer *self, Point *points, int num_points,
Color *color)
{
VDXRenderer *renderer = VDX_RENDERER(self);
@@ -541,14 +539,14 @@ static void draw_polyline(DiaRenderer *self, Point *points, int num_points,
double minX, minY, maxX, maxY;
/* First time through, just construct the colour table */
- if (renderer->first_pass)
+ if (renderer->first_pass)
{
vdxCheckColor(renderer, color);
return;
}
-
+
g_debug("draw_polyline(%d)", num_points);
-
+
/* Setup the standard shape object */
memset(&Shape, 0, sizeof(Shape));
Shape.any.type = vdx_types_Shape;
@@ -566,7 +564,7 @@ static void draw_polyline(DiaRenderer *self, Point *points, int num_points,
a = visio_point(points[0]);
/* Find width and height */
- minX = points[0].x; minY = points[0].y;
+ minX = points[0].x; minY = points[0].y;
maxX = points[0].x; maxY = points[0].y;
for (i=1; i<num_points; i++)
{
@@ -602,7 +600,7 @@ static void draw_polyline(DiaRenderer *self, Point *points, int num_points,
LineTo[i].any.type = vdx_types_LineTo;
LineTo[i].IX = i+2;
b = visio_point(points[i+1]);
- LineTo[i].X = b.x-a.x;
+ LineTo[i].X = b.x-a.x;
LineTo[i].Y = b.y-a.y;
}
@@ -649,7 +647,7 @@ _polygon (DiaRenderer *self,
double minX, minY, maxX, maxY;
/* First time through, just construct the colour table */
- if (renderer->first_pass)
+ if (renderer->first_pass)
{
if (fill)
vdxCheckColor(renderer, fill);
@@ -657,9 +655,9 @@ _polygon (DiaRenderer *self,
vdxCheckColor(renderer, stroke);
return;
}
-
+
g_debug("draw_polygon(%d)", num_points);
-
+
/* Setup the standard shape object */
memset(&Shape, 0, sizeof(Shape));
Shape.any.type = vdx_types_Shape;
@@ -677,7 +675,7 @@ _polygon (DiaRenderer *self,
a = visio_point(points[0]);
/* Find width and height */
- minX = points[0].x; minY = points[0].y;
+ minX = points[0].x; minY = points[0].y;
maxX = points[0].x; maxY = points[0].y;
for (i=1; i<num_points; i++)
{
@@ -714,7 +712,7 @@ _polygon (DiaRenderer *self,
/* Last point = first */
if (i == num_points-1) b = a;
else b = visio_point(points[i+1]);
- LineTo[i].X = b.x-a.x;
+ LineTo[i].X = b.x-a.x;
LineTo[i].Y = b.y-a.y;
}
@@ -791,7 +789,7 @@ draw_rounded_rect (DiaRenderer *self,
* @param color line colour
* @todo Not done yet
*/
-static void draw_arc(DiaRenderer *self,
+static void draw_arc(DiaRenderer *self,
Point *center,
real width, real height,
real angle1, real angle2,
@@ -810,12 +808,12 @@ static void draw_arc(DiaRenderer *self,
float control_angle;
/* First time through, just construct the colour table */
- if (renderer->first_pass)
+ if (renderer->first_pass)
{
vdxCheckColor(renderer, color);
return;
}
-
+
g_debug("draw_arc((%f,%f),%f,%f;%f,%f)", center->x, center->y,
width, height, angle1, angle2);
@@ -928,7 +926,7 @@ static void draw_arc(DiaRenderer *self,
* @todo Not done yet - believe unused
*/
static void
-fill_arc (DiaRenderer *self,
+fill_arc (DiaRenderer *self,
Point *center,
real width, real height,
real angle1, real angle2,
@@ -948,7 +946,7 @@ fill_arc (DiaRenderer *self,
float control_angle;
/* First time through, just construct the colour table */
- if (renderer->first_pass)
+ if (renderer->first_pass)
{
vdxCheckColor(renderer, color);
return;
@@ -1080,7 +1078,7 @@ fill_arc (DiaRenderer *self,
* @param stroke line colour
*/
static void
-draw_ellipse (DiaRenderer *self,
+draw_ellipse (DiaRenderer *self,
Point *center,
real width, real height,
Color *fill, Color *stroke)
@@ -1096,7 +1094,7 @@ draw_ellipse (DiaRenderer *self,
char NameU[VDX_NAMEU_LEN];
/* First time through, just construct the colour table */
- if (renderer->first_pass)
+ if (renderer->first_pass)
{
if (fill)
vdxCheckColor(renderer, fill);
@@ -1104,9 +1102,9 @@ draw_ellipse (DiaRenderer *self,
vdxCheckColor(renderer, stroke);
return;
}
-
+
g_debug("fill_ellipse");
-
+
/* Setup the standard shape object */
memset(&Shape, 0, sizeof(Shape));
Shape.any.type = vdx_types_Shape;
@@ -1200,7 +1198,7 @@ static void draw_string(DiaRenderer *self,
DiaFontStyle font_style;
real text_width;
- if (renderer->first_pass)
+ if (renderer->first_pass)
{
/* Add to colour and font tables */
vdxCheckColor(renderer, color);
@@ -1322,12 +1320,12 @@ static void draw_image(DiaRenderer *self,
struct vdx_text text;
char NameU[VDX_NAMEU_LEN];
- if (renderer->first_pass)
+ if (renderer->first_pass)
{
return;
}
- g_debug("draw_image((%f,%f), %f, %f, %s", point->x, point->y,
+ g_debug("draw_image((%f,%f), %f, %f, %s", point->x, point->y,
width, height, dia_image_filename(image));
/* Setup the standard shape object */
memset(&Shape, 0, sizeof(Shape));
@@ -1413,7 +1411,7 @@ const char *
vdx_string_color(const Color c)
{
static char buf[8];
- sprintf(buf, "#%.2X%.2X%.2X",
+ sprintf(buf, "#%.2X%.2X%.2X",
(int)(c.red*255), (int)(c.green*255), (int)(c.blue*255));
return buf;
}
@@ -1495,7 +1493,7 @@ write_header(DiagramData *data, VDXRenderer *renderer)
fprintf(file, "<!-- Created by Dia -->\n");
if (renderer->version == 2002)
{
- fprintf(file,
+ fprintf(file,
"<VisioDocument "
"xmlns='urn:schemas-microsoft-com:office:visio'>\n");
}
@@ -1514,14 +1512,14 @@ write_header(DiagramData *data, VDXRenderer *renderer)
fprintf(file, "%s\n", data->paper.name);
fprintf(file, "%f\n", data->paper.scaling*100.0);
*/
-
+
/* Colour table */
fprintf(file, " <Colors>\n");
- for (i = 0; i < renderer->Colors->len; i++)
+ for (i = 0; i < renderer->Colors->len; i++)
{
c = g_array_index(renderer->Colors, Color, i);
- fprintf(file, " <ColorEntry IX='%d' RGB='%s'/>\n",
+ fprintf(file, " <ColorEntry IX='%d' RGB='%s'/>\n",
i, vdx_string_color(c));
}
fprintf(file, " </Colors>\n");
@@ -1531,7 +1529,7 @@ write_header(DiagramData *data, VDXRenderer *renderer)
if (renderer->version == 2002)
{
fprintf(file, " <Fonts>\n");
- for (i = 0; i < renderer->Fonts->len; i++)
+ for (i = 0; i < renderer->Fonts->len; i++)
{
struct vdx_FontEntry Font;
memset(&Font, 0, sizeof(Font));
@@ -1568,7 +1566,7 @@ write_header(DiagramData *data, VDXRenderer *renderer)
if (renderer->version == 2003)
{
fprintf(file, " <FaceNames>\n");
- for (i = 0; i < renderer->Fonts->len; i++)
+ for (i = 0; i < renderer->Fonts->len; i++)
{
f = g_array_index(renderer->Fonts, char *, i);
@@ -1576,8 +1574,8 @@ write_header(DiagramData *data, VDXRenderer *renderer)
if (!strcmp(f, "Helvetica")) f = "Arial";
if (!strcmp(f, "Times")) f = "Times New Roman";
- /* Missing attrs UnicodeRanges="31367 -2147483648 8 0"
- CharSets="1073742335 -65536"
+ /* Missing attrs UnicodeRanges="31367 -2147483648 8 0"
+ CharSets="1073742335 -65536"
Panos="2 11 6 4 2 2 2 2 2 4" Flags="325" */
fprintf(file, " <FaceName ID='%d' Name='%s'/>\n",
i, f);
@@ -1601,7 +1599,7 @@ write_header(DiagramData *data, VDXRenderer *renderer)
Line.any.type = vdx_types_Line;
Line.LineWeight = 0.01;
Line.LinePattern = 1;
-
+
memset(&Fill, 0, sizeof(Fill));
Fill.any.type = vdx_types_Fill;
Fill.FillForegnd = color_black;
@@ -1611,12 +1609,12 @@ write_header(DiagramData *data, VDXRenderer *renderer)
TextBlock.any.type = vdx_types_TextBlock;
TextBlock.VerticalAlign = 1;
TextBlock.DefaultTabStop = 0.59055118110236;
-
+
memset(&Char, 0, sizeof(Char));
Char.any.type = vdx_types_Char;
Char.FontScale = 1;
Char.Size = 0.16666666666667;
-
+
memset(&Para, 0, sizeof(Para));
Para.any.type = vdx_types_Para;
Para.SpLine = -1.2;
@@ -1703,7 +1701,7 @@ export_vdx(DiagramData *data, DiaContext *ctx,
file = g_fopen(filename, "w");
if (file == NULL) {
- dia_context_add_message_with_errno (ctx, errno, _("Can't open output file %s"),
+ dia_context_add_message_with_errno (ctx, errno, _("Can't open output file %s"),
dia_context_get_filename(ctx));
return FALSE;
}
@@ -1717,13 +1715,13 @@ export_vdx(DiagramData *data, DiaContext *ctx,
renderer->file = file;
renderer->first_pass = TRUE;
-
+
renderer->version = 2002; /* For now */
DIA_RENDERER_GET_CLASS(renderer)->begin_render(DIA_RENDERER(renderer), NULL);
-
+
/* First run through without drawing to setup tables */
- for (i=0; i<data->layers->len; i++)
+ for (i=0; i<data->layers->len; i++)
{
layer = (Layer *) g_ptr_array_index(data->layers, i);
if (layer->visible)
@@ -1741,7 +1739,7 @@ export_vdx(DiagramData *data, DiaContext *ctx,
/* Now render */
- for (i=0; i<data->layers->len; i++)
+ for (i=0; i<data->layers->len; i++)
{
layer = (Layer *) g_ptr_array_index(data->layers, i);
if (layer->visible)
@@ -1761,7 +1759,7 @@ export_vdx(DiagramData *data, DiaContext *ctx,
setlocale(LC_NUMERIC, old_locale);
if (fclose(file) != 0) {
- dia_context_add_message_with_errno (ctx, errno, _("Saving file '%s' failed."),
+ dia_context_add_message_with_errno (ctx, errno, _("Saving file '%s' failed."),
dia_context_get_filename(ctx));
return FALSE;
}
@@ -1792,8 +1790,8 @@ DiaExportFilter vdx_export_filter = {
* @param end_arrow end arrow
*/
-static void draw_line_with_arrows(DiaRenderer *self,
- Point *start, Point *end,
+static void draw_line_with_arrows(DiaRenderer *self,
+ Point *start, Point *end,
real line_width,
Color *color,
Arrow *start_arrow,
@@ -1811,8 +1809,8 @@ static void draw_line_with_arrows(DiaRenderer *self,
char NameU[VDX_NAMEU_LEN];
/* Exactly as draw_line for now */
-
- if (renderer->first_pass)
+
+ if (renderer->first_pass)
{
vdxCheckColor(renderer, color);
return;
@@ -1861,7 +1859,7 @@ static void draw_line_with_arrows(DiaRenderer *self,
memset(&LineTo, 0, sizeof(LineTo));
LineTo.any.type = vdx_types_LineTo;
LineTo.IX = 2;
- LineTo.X = b.x-a.x;
+ LineTo.X = b.x-a.x;
LineTo.Y = b.y-a.y;
create_Line(renderer, color, &Line, start_arrow, end_arrow);
@@ -1891,16 +1889,16 @@ static void draw_line_with_arrows(DiaRenderer *self,
* @todo Not done yet
*/
-static void draw_polyline_with_arrows(DiaRenderer *self,
- Point *points, int num_points,
+static void draw_polyline_with_arrows(DiaRenderer *self,
+ Point *points, int num_points,
real line_width,
Color *color,
Arrow *start_arrow,
Arrow *end_arrow)
{
VDXRenderer *renderer = VDX_RENDERER(self);
-
- if (renderer->first_pass)
+
+ if (renderer->first_pass)
{
vdxCheckColor(renderer, color);
return;
@@ -1920,7 +1918,7 @@ static void draw_polyline_with_arrows(DiaRenderer *self,
* @todo Not done yet - believe unused
*/
-static void draw_arc_with_arrows(DiaRenderer *self,
+static void draw_arc_with_arrows(DiaRenderer *self,
Point *startpoint,
Point *endpoint,
Point *midpoint,
@@ -1930,8 +1928,8 @@ static void draw_arc_with_arrows(DiaRenderer *self,
Arrow *end_arrow)
{
VDXRenderer *renderer = VDX_RENDERER(self);
-
- if (renderer->first_pass)
+
+ if (renderer->first_pass)
{
vdxCheckColor(renderer, color);
return;
@@ -1947,14 +1945,14 @@ static void draw_arc_with_arrows(DiaRenderer *self,
* @todo Not done yet - either convert to arcs or NURBS (Visio 2003)
*/
-static void draw_bezier(DiaRenderer *self,
+static void draw_bezier(DiaRenderer *self,
BezPoint *points,
int numpoints,
Color *color)
{
VDXRenderer *renderer = VDX_RENDERER(self);
-
- if (renderer->first_pass)
+
+ if (renderer->first_pass)
{
vdxCheckColor(renderer, color);
return;
@@ -1973,7 +1971,7 @@ static void draw_bezier(DiaRenderer *self,
* @todo Not done yet - either convert to arcs or NURBS (Visio 2003)
*/
-static void draw_bezier_with_arrows(DiaRenderer *self,
+static void draw_bezier_with_arrows(DiaRenderer *self,
BezPoint *points,
int numpoints,
real line_width,
@@ -1982,8 +1980,8 @@ static void draw_bezier_with_arrows(DiaRenderer *self,
Arrow *end_arrow)
{
VDXRenderer *renderer = VDX_RENDERER(self);
-
- if (renderer->first_pass)
+
+ if (renderer->first_pass)
{
vdxCheckColor(renderer, color);
return;
@@ -1999,15 +1997,15 @@ static void draw_bezier_with_arrows(DiaRenderer *self,
* @todo Not done yet - either convert to arcs or NURBS (Visio 2003)
*/
static void
-draw_beziergon (DiaRenderer *self,
+draw_beziergon (DiaRenderer *self,
BezPoint *points,
int numpoints,
Color *fill,
Color *stroke)
{
VDXRenderer *renderer = VDX_RENDERER(self);
-
- if (renderer->first_pass)
+
+ if (renderer->first_pass)
{
vdxCheckColor(renderer, color);
return;
@@ -2023,7 +2021,7 @@ draw_beziergon (DiaRenderer *self,
* @note No work done here - perhaps should push/pop renderer state
*/
-static void
+static void
draw_object (DiaRenderer *self,
DiaObject *object,
DiaMatrix *matrix)
diff --git a/plug-ins/vdx/vdx-import.c b/plug-ins/vdx/vdx-import.c
index 9b5d1d59..f7fdfde1 100644
--- a/plug-ins/vdx/vdx-import.c
+++ b/plug-ins/vdx/vdx-import.c
@@ -19,9 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <stdio.h>
#include <errno.h>
@@ -2318,7 +2316,7 @@ plot_text(const struct vdx_Text *Text, const struct vdx_XForm *XForm,
}
}
-#if 0 /* this is not utf-8 safe - see bug 683700 */
+#if 0 /* this is not utf-8 safe - see bug 683700 */
/* Remove trailing line breaks */
while (tprop->text_data[0] &&
isspace(tprop->text_data[strlen(tprop->text_data)-1]))
@@ -2981,7 +2979,7 @@ import_vdx(const gchar *filename, DiagramData *dia, DiaContext *ctx, void* user_
theDoc = g_new0(struct VDXDocument, 1);
theDoc->ok = TRUE;
-
+
/* ugly, but still better than bogus sizes */
old_locale = setlocale(LC_NUMERIC, "C");
@@ -3036,7 +3034,7 @@ import_vdx(const gchar *filename, DiagramData *dia, DiaContext *ctx, void* user_
/* Get rid of internal strings before returning */
vdx_free(theDoc);
xmlFreeDoc(doc);
-
+
/* dont screw Dia's global state */
setlocale(LC_NUMERIC, old_locale);
diff --git a/plug-ins/xfig/xfig-common.c b/plug-ins/xfig/xfig-common.c
index 9ba855a8..9846a18a 100644
--- a/plug-ins/xfig/xfig-common.c
+++ b/plug-ins/xfig/xfig-common.c
@@ -1,6 +1,4 @@
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <stdio.h>
/* Information used here is taken from the FIG Format 3.2 specification
@@ -77,4 +75,4 @@ int
num_fig_fonts (void)
{
return G_N_ELEMENTS(fig_fonts)-1;
-}
\ No newline at end of file
+}
diff --git a/plug-ins/xfig/xfig-export.c b/plug-ins/xfig/xfig-export.c
index 4ea32ba2..3e4607f2 100644
--- a/plug-ins/xfig/xfig-export.c
+++ b/plug-ins/xfig/xfig-export.c
@@ -17,10 +17,8 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-#ifdef HAVE_CONFIG_H
+ */
#include <config.h>
-#endif
#include <stdio.h>
/* Information used here is taken from the FIG Format 3.2 specification
@@ -111,36 +109,36 @@ static void set_linejoin(DiaRenderer *self, LineJoin mode);
static void set_linestyle(DiaRenderer *self, LineStyle mode, real dash_length);
static void set_fillstyle(DiaRenderer *self, FillStyle mode);
static void set_font(DiaRenderer *self, DiaFont *font, real height);
-static void draw_line(DiaRenderer *self,
- Point *start, Point *end,
+static void draw_line(DiaRenderer *self,
+ Point *start, Point *end,
Color *color);
-static void draw_polyline(DiaRenderer *self,
- Point *points, int num_points,
+static void draw_polyline(DiaRenderer *self,
+ Point *points, int num_points,
Color *color);
-static void draw_line_with_arrows(DiaRenderer *self,
- Point *start, Point *end,
+static void draw_line_with_arrows(DiaRenderer *self,
+ Point *start, Point *end,
real line_width,
Color *color,
Arrow *start_arrow,
Arrow *end_arrow);
-static void draw_polyline_with_arrows(DiaRenderer *self,
- Point *points, int num_points,
+static void draw_polyline_with_arrows(DiaRenderer *self,
+ Point *points, int num_points,
real line_width,
Color *color,
Arrow *start_arrow,
Arrow *end_arrow);
-static void draw_polygon(DiaRenderer *self,
- Point *points, int num_points,
+static void draw_polygon(DiaRenderer *self,
+ Point *points, int num_points,
Color *fill, Color *stroke);
-static void draw_rect(DiaRenderer *self,
+static void draw_rect(DiaRenderer *self,
Point *ul_corner, Point *lr_corner,
Color *fill, Color *stroke);
-static void draw_arc(DiaRenderer *self,
+static void draw_arc(DiaRenderer *self,
Point *center,
real width, real height,
real angle1, real angle2,
Color *colour);
-static void draw_arc_with_arrows(DiaRenderer *self,
+static void draw_arc_with_arrows(DiaRenderer *self,
Point *startpoint,
Point *endpoint,
Point *midpoint,
@@ -148,27 +146,27 @@ static void draw_arc_with_arrows(DiaRenderer *self,
Color *colour,
Arrow *start_arrow,
Arrow *end_arrow);
-static void fill_arc(DiaRenderer *self,
+static void fill_arc(DiaRenderer *self,
Point *center,
real width, real height,
real angle1, real angle2,
Color *colour);
-static void draw_ellipse(DiaRenderer *self,
+static void draw_ellipse(DiaRenderer *self,
Point *center,
real width, real height,
Color *fill, Color *stroke);
-static void draw_bezier(DiaRenderer *self,
+static void draw_bezier(DiaRenderer *self,
BezPoint *points,
int numpoints,
Color *colour);
-static void draw_bezier_with_arrows(DiaRenderer *self,
+static void draw_bezier_with_arrows(DiaRenderer *self,
BezPoint *points,
int numpoints,
real line_width,
Color *colour,
Arrow *start_arrow,
Arrow *end_arrow);
-static void draw_beziergon(DiaRenderer *self,
+static void draw_beziergon(DiaRenderer *self,
BezPoint *points, /* Last point must be same as first point */
int numpoints,
Color *fill,
@@ -213,7 +211,7 @@ xfig_renderer_get_type (void)
"XfigRenderer",
&object_info, 0);
}
-
+
return object_type;
}
@@ -242,10 +240,10 @@ xfig_renderer_class_init (XfigRendererClass *klass)
renderer_class->set_linestyle = set_linestyle;
renderer_class->set_fillstyle = set_fillstyle;
renderer_class->set_font = set_font;
-
+
renderer_class->draw_line = draw_line;
renderer_class->draw_polyline = draw_polyline;
-
+
renderer_class->draw_polygon = draw_polygon;
renderer_class->draw_arc = draw_arc;
@@ -269,8 +267,8 @@ xfig_renderer_class_init (XfigRendererClass *klass)
}
/* Helper functions */
-static void
-figWarn(XfigRenderer *renderer, int warning)
+static void
+figWarn(XfigRenderer *renderer, int warning)
{
if (renderer->warnings[warning]) {
message_warning("%s", renderer->warnings[warning]);
@@ -278,8 +276,8 @@ figWarn(XfigRenderer *renderer, int warning)
}
}
-static int
-figLineStyle(XfigRenderer *renderer)
+static int
+figLineStyle(XfigRenderer *renderer)
{
switch (renderer->stylemode) {
case LINESTYLE_SOLID:
@@ -297,8 +295,8 @@ figLineStyle(XfigRenderer *renderer)
}
}
-static int
-figLineWidth(XfigRenderer *renderer)
+static int
+figLineWidth(XfigRenderer *renderer)
{
int width = 0;
/* Minimal line width in fig diagrams. */
@@ -309,10 +307,10 @@ figLineWidth(XfigRenderer *renderer)
/* Must be called before outputting anything that uses this color,
in order to output a color pseudo object.
- The color pseudo object even must be placed first in the xfig file.
+ The color pseudo object even must be placed first in the xfig file.
*/
-static void
-figCheckColor(XfigRenderer *renderer, Color *color)
+static void
+figCheckColor(XfigRenderer *renderer, Color *color)
{
int i;
@@ -327,30 +325,30 @@ figCheckColor(XfigRenderer *renderer, Color *color)
return;
}
renderer->user_colors[renderer->max_user_color] = *color;
- fprintf(renderer->file, "0 %d #%02x%02x%02x\n",
+ fprintf(renderer->file, "0 %d #%02x%02x%02x\n",
renderer->max_user_color + FIG_MAX_DEFAULT_COLORS,
(int)(color->red*255), (int)(color->green*255), (int)(color->blue*255));
renderer->max_user_color++;
}
-static int
-figColor(XfigRenderer *renderer, Color *color)
+static int
+figColor(XfigRenderer *renderer, Color *color)
{
int i;
for (i = 0; i < FIG_MAX_DEFAULT_COLORS; i++) {
- if (color_equals(color, &fig_default_colors[i]))
+ if (color_equals(color, &fig_default_colors[i]))
return i;
}
for (i = 0; i < renderer->max_user_color; i++) {
- if (color_equals(color, &renderer->user_colors[i]))
+ if (color_equals(color, &renderer->user_colors[i]))
return i + FIG_MAX_DEFAULT_COLORS;
}
return 0;
}
-static real
-figCoord(XfigRenderer *renderer, real coord)
+static real
+figCoord(XfigRenderer *renderer, real coord)
{
return (coord/2.54)*1200.0;
}
@@ -361,38 +359,38 @@ figAltCoord(XfigRenderer *renderer, real coord)
return (coord/2.54)*80.0;
}
-static int
-figDepth(XfigRenderer *renderer)
+static int
+figDepth(XfigRenderer *renderer)
{
return renderer->depth;
}
-static real
-figDashLength(XfigRenderer *renderer)
+static real
+figDashLength(XfigRenderer *renderer)
{
return figAltCoord(renderer, renderer->dashlength);
}
-static int
+static int
figJoinStyle(XfigRenderer *renderer)
{
return renderer->joinmode;
}
-static int
-figCapsStyle(XfigRenderer *renderer)
+static int
+figCapsStyle(XfigRenderer *renderer)
{
return renderer->capsmode;
}
-static int
-figAlignment(XfigRenderer *renderer, int alignment)
+static int
+figAlignment(XfigRenderer *renderer, int alignment)
{
return alignment;
}
-static int
-figFont(XfigRenderer *renderer)
+static int
+figFont(XfigRenderer *renderer)
{
int i;
const char *legacy_name;
@@ -407,14 +405,14 @@ figFont(XfigRenderer *renderer)
return -1;
}
-static real
-figFontSize(XfigRenderer *renderer)
+static real
+figFontSize(XfigRenderer *renderer)
{
return (renderer->fontheight/2.54)*72.27;
}
static guchar *
-figText(XfigRenderer *renderer, const guchar *text)
+figText(XfigRenderer *renderer, const guchar *text)
{
int i, j;
int len = strlen((char *) text);
@@ -451,7 +449,7 @@ figArrow(XfigRenderer *renderer, Arrow *arrow, real line_width)
gchar lw_buf[DTOSTR_BUF_SIZE];
gchar aw_buf[DTOSTR_BUF_SIZE];
gchar al_buf[DTOSTR_BUF_SIZE];
-
+
switch (arrow->type) {
case ARROW_NONE:
return;
@@ -462,12 +460,12 @@ figArrow(XfigRenderer *renderer, Arrow *arrow, real line_width)
type = 1; style = 0; break;
case ARROW_FILLED_TRIANGLE: /* {filled arrow} */
type = 1; style = 1; break;
- case ARROW_HOLLOW_DIAMOND:
+ case ARROW_HOLLOW_DIAMOND:
type = 3; style = 0; break;
case ARROW_FILLED_DIAMOND:
type = 3; style = 1; break;
default:
- message_warning(_("Fig format has no equivalent of arrow style %s; using simple arrow.\n"),
+ message_warning(_("Fig format has no equivalent of arrow style %s; using simple arrow.\n"),
arrow_get_name_from_type(arrow->type));
/* Notice fallthrough */
case ARROW_FILLED_CONCAVE:
@@ -477,19 +475,19 @@ figArrow(XfigRenderer *renderer, Arrow *arrow, real line_width)
}
fprintf(renderer->file, " %d %d %s %s %s\n",
type, style,
- xfig_dtostr(lw_buf, figAltCoord(renderer, line_width)),
+ xfig_dtostr(lw_buf, figAltCoord(renderer, line_width)),
xfig_dtostr(aw_buf, figCoord(renderer, arrow->width)),
- xfig_dtostr(al_buf, figCoord(renderer, arrow->length)) );
+ xfig_dtostr(al_buf, figCoord(renderer, arrow->length)) );
}
-static void
-begin_render(DiaRenderer *self, const Rectangle *update)
+static void
+begin_render(DiaRenderer *self, const Rectangle *update)
{
XfigRenderer *renderer = XFIG_RENDERER(self);
if (renderer->color_pass) {
/* Set up warnings */
- renderer->warnings[WARNING_OUT_OF_COLORS] =
+ renderer->warnings[WARNING_OUT_OF_COLORS] =
_("No more user-definable colors - using black");
renderer->max_user_color = 0;
}
@@ -507,36 +505,36 @@ begin_render(DiaRenderer *self, const Rectangle *update)
}
-static void
-end_render(DiaRenderer *renderer)
+static void
+end_render(DiaRenderer *renderer)
{
}
-static void
-set_linewidth(DiaRenderer *self, real linewidth)
+static void
+set_linewidth(DiaRenderer *self, real linewidth)
{
XfigRenderer *renderer = XFIG_RENDERER(self);
renderer->linewidth = linewidth;
}
-static void
-set_linecaps(DiaRenderer *self, LineCaps mode)
+static void
+set_linecaps(DiaRenderer *self, LineCaps mode)
{
XfigRenderer *renderer = XFIG_RENDERER(self);
renderer->capsmode = mode;
}
-static void
-set_linejoin(DiaRenderer *self, LineJoin mode)
+static void
+set_linejoin(DiaRenderer *self, LineJoin mode)
{
XfigRenderer *renderer = XFIG_RENDERER(self);
renderer->joinmode = mode;
}
-static void
+static void
set_linestyle(DiaRenderer *self, LineStyle mode, real dash_length)
{
XfigRenderer *renderer = XFIG_RENDERER(self);
@@ -545,15 +543,15 @@ set_linestyle(DiaRenderer *self, LineStyle mode, real dash_length)
renderer->dashlength = dash_length;
}
-static void
-set_fillstyle(DiaRenderer *self, FillStyle mode)
+static void
+set_fillstyle(DiaRenderer *self, FillStyle mode)
{
XfigRenderer *renderer = XFIG_RENDERER(self);
renderer->fillmode = mode;
}
-static void
-set_font(DiaRenderer *self, DiaFont *font, real height)
+static void
+set_font(DiaRenderer *self, DiaFont *font, real height)
{
XfigRenderer *renderer = XFIG_RENDERER(self);
@@ -561,10 +559,10 @@ set_font(DiaRenderer *self, DiaFont *font, real height)
renderer->fontheight = height;
}
-static void
-draw_line(DiaRenderer *self,
- Point *start, Point *end,
- Color *color)
+static void
+draw_line(DiaRenderer *self,
+ Point *start, Point *end,
+ Color *color)
{
XfigRenderer *renderer = XFIG_RENDERER(self);
gchar d_buf[DTOSTR_BUF_SIZE];
@@ -575,22 +573,22 @@ draw_line(DiaRenderer *self,
}
fprintf(renderer->file, "2 1 %d %d %d 0 %d 0 -1 %s %d %d 0 0 0 2\n",
- figLineStyle(renderer), figLineWidth(renderer),
+ figLineStyle(renderer), figLineWidth(renderer),
figColor(renderer, color), figDepth(renderer),
xfig_dtostr(d_buf, figDashLength(renderer)),
figJoinStyle(renderer), figCapsStyle(renderer) );
fprintf(renderer->file, "\t%d %d %d %d\n",
- (int)figCoord(renderer, start->x), (int)figCoord(renderer, start->y),
+ (int)figCoord(renderer, start->x), (int)figCoord(renderer, start->y),
(int)figCoord(renderer, end->x), (int)figCoord(renderer, end->y));
}
-static void
-draw_line_with_arrows(DiaRenderer *self,
- Point *start, Point *end,
+static void
+draw_line_with_arrows(DiaRenderer *self,
+ Point *start, Point *end,
real line_width,
Color *color,
Arrow *start_arrow,
- Arrow *end_arrow)
+ Arrow *end_arrow)
{
XfigRenderer *renderer = XFIG_RENDERER(self);
gchar d_buf[DTOSTR_BUF_SIZE];
@@ -601,10 +599,10 @@ draw_line_with_arrows(DiaRenderer *self,
}
fprintf(renderer->file, "2 1 %d %d %d 0 %d 0 -1 %s %d %d 0 %d %d 2\n",
- figLineStyle(renderer), figLineWidth(renderer),
+ figLineStyle(renderer), figLineWidth(renderer),
figColor(renderer, color), figDepth(renderer),
xfig_dtostr(d_buf, figDashLength(renderer)),
- figJoinStyle(renderer),
+ figJoinStyle(renderer),
figCapsStyle(renderer),
hasArrow(end_arrow),
hasArrow(start_arrow));
@@ -615,14 +613,14 @@ draw_line_with_arrows(DiaRenderer *self,
figArrow(renderer, start_arrow, line_width);
}
fprintf(renderer->file, "\t%d %d %d %d\n",
- (int)figCoord(renderer, start->x), (int)figCoord(renderer, start->y),
+ (int)figCoord(renderer, start->x), (int)figCoord(renderer, start->y),
(int)figCoord(renderer, end->x), (int)figCoord(renderer, end->y));
}
-static void
-draw_polyline(DiaRenderer *self,
- Point *points, int num_points,
- Color *color)
+static void
+draw_polyline(DiaRenderer *self,
+ Point *points, int num_points,
+ Color *color)
{
int i;
XfigRenderer *renderer = XFIG_RENDERER(self);
@@ -634,7 +632,7 @@ draw_polyline(DiaRenderer *self,
}
fprintf(renderer->file, "2 1 %d %d %d 0 %d 0 -1 %s %d %d 0 0 0 %d\n",
- figLineStyle(renderer), figLineWidth(renderer),
+ figLineStyle(renderer), figLineWidth(renderer),
figColor(renderer, color), figDepth(renderer),
xfig_dtostr(d_buf, figDashLength(renderer)),
figJoinStyle(renderer),
@@ -647,13 +645,13 @@ draw_polyline(DiaRenderer *self,
fprintf(renderer->file, "\n");
}
-static void
-draw_polyline_with_arrows(DiaRenderer *self,
- Point *points, int num_points,
+static void
+draw_polyline_with_arrows(DiaRenderer *self,
+ Point *points, int num_points,
real line_width,
Color *color,
Arrow *start_arrow,
- Arrow *end_arrow)
+ Arrow *end_arrow)
{
int i;
XfigRenderer *renderer = XFIG_RENDERER(self);
@@ -665,7 +663,7 @@ draw_polyline_with_arrows(DiaRenderer *self,
}
fprintf(renderer->file, "2 1 %d %d %d 0 %d 0 -1 %s %d %d 0 %d %d %d\n",
- figLineStyle(renderer), figLineWidth(renderer),
+ figLineStyle(renderer), figLineWidth(renderer),
figColor(renderer, color), figDepth(renderer),
xfig_dtostr(d_buf, figDashLength(renderer)),
figJoinStyle(renderer),
@@ -742,21 +740,21 @@ draw_rect(DiaRenderer *self,
figDepth(renderer),
fill ? 20 : -1,
xfig_dtostr(d_buf, figDashLength(renderer)),
- figJoinStyle(renderer),
+ figJoinStyle(renderer),
figCapsStyle(renderer));
fprintf(renderer->file, "\t%d %d %d %d %d %d %d %d %d %d\n",
- (int)figCoord(renderer, ul_corner->x), (int)figCoord(renderer, ul_corner->y),
- (int)figCoord(renderer, lr_corner->x), (int)figCoord(renderer, ul_corner->y),
- (int)figCoord(renderer, lr_corner->x), (int)figCoord(renderer, lr_corner->y),
- (int)figCoord(renderer, ul_corner->x), (int)figCoord(renderer, lr_corner->y),
+ (int)figCoord(renderer, ul_corner->x), (int)figCoord(renderer, ul_corner->y),
+ (int)figCoord(renderer, lr_corner->x), (int)figCoord(renderer, ul_corner->y),
+ (int)figCoord(renderer, lr_corner->x), (int)figCoord(renderer, lr_corner->y),
+ (int)figCoord(renderer, ul_corner->x), (int)figCoord(renderer, lr_corner->y),
(int)figCoord(renderer, ul_corner->x), (int)figCoord(renderer, ul_corner->y));
}
-static void
-draw_arc(DiaRenderer *self,
+static void
+draw_arc(DiaRenderer *self,
Point *center,
real width, real height,
real angle1, real angle2,
- Color *color)
+ Color *color)
{
Point first, second, last;
int direction = angle2 > angle1 ? 1 : 0; /* Dia not always gives counterclockwise */
@@ -787,16 +785,16 @@ draw_arc(DiaRenderer *self,
last.y -= (height/2.0)*sin(angle2);
fprintf(renderer->file, "5 1 %d %d %d %d %d 0 -1 %s %d %d 0 0 %s %s %d %d %d %d %d %d\n",
- figLineStyle(renderer), figLineWidth(renderer),
+ figLineStyle(renderer), figLineWidth(renderer),
figColor(renderer, color), figColor(renderer, color),
figDepth(renderer),
xfig_dtostr(dl_buf, figDashLength(renderer)),
figCapsStyle(renderer),
direction,
- xfig_dtostr(cx_buf, figCoord(renderer, center->x)),
+ xfig_dtostr(cx_buf, figCoord(renderer, center->x)),
xfig_dtostr(cy_buf, figCoord(renderer, center->y)),
- (int)figCoord(renderer, first.x), (int)figCoord(renderer, first.y),
- (int)figCoord(renderer, second.x), (int)figCoord(renderer, second.y),
+ (int)figCoord(renderer, first.x), (int)figCoord(renderer, first.y),
+ (int)figCoord(renderer, second.x), (int)figCoord(renderer, second.y),
(int)figCoord(renderer, last.x), (int)figCoord(renderer, last.y));
}
@@ -816,15 +814,15 @@ is_right_hand (const Point *a, const Point *b, const Point *c)
return point_cross(&dot1, &dot2) > 0;
}
-static void
-draw_arc_with_arrows(DiaRenderer *self,
+static void
+draw_arc_with_arrows(DiaRenderer *self,
Point *startpoint,
Point *endpoint,
Point *midpoint,
real line_width,
Color *color,
Arrow *start_arrow,
- Arrow *end_arrow)
+ Arrow *end_arrow)
{
Point center;
int direction = 0;
@@ -848,7 +846,7 @@ draw_arc_with_arrows(DiaRenderer *self,
fprintf (renderer->file, "#draw_arc_with_arrows center=(%g,%g) radius=%g\n", center.x, center.y, radius);
fprintf(renderer->file, "5 1 %d %d %d %d %d 0 -1 %s %d %d %d %d %s %s %d %d %d %d %d %d\n",
- figLineStyle(renderer), figLineWidth(renderer),
+ figLineStyle(renderer), figLineWidth(renderer),
figColor(renderer, color), figColor(renderer, color),
figDepth(renderer),
xfig_dtostr(dl_buf, figDashLength(renderer)),
@@ -858,8 +856,8 @@ draw_arc_with_arrows(DiaRenderer *self,
hasArrow(start_arrow),
xfig_dtostr(cx_buf, figCoord(renderer, center.x)),
xfig_dtostr(cy_buf, figCoord(renderer, center.y)),
- (int)figCoord(renderer, startpoint->x), (int)figCoord(renderer, startpoint->y),
- (int)figCoord(renderer, midpoint->x), (int)figCoord(renderer, midpoint->y),
+ (int)figCoord(renderer, startpoint->x), (int)figCoord(renderer, startpoint->y),
+ (int)figCoord(renderer, midpoint->x), (int)figCoord(renderer, midpoint->y),
(int)figCoord(renderer, endpoint->x), (int)figCoord(renderer, endpoint->y));
if (hasArrow(end_arrow)) {
@@ -870,12 +868,12 @@ draw_arc_with_arrows(DiaRenderer *self,
}
}
-static void
-fill_arc(DiaRenderer *self,
+static void
+fill_arc(DiaRenderer *self,
Point *center,
real width, real height,
real angle1, real angle2,
- Color *color)
+ Color *color)
{
Point first, second, last;
XfigRenderer *renderer = XFIG_RENDERER(self);
@@ -906,15 +904,15 @@ fill_arc(DiaRenderer *self,
last.y -= (height/2.0)*sin(angle2);
fprintf(renderer->file, "5 2 %d %d %d %d %d 20 0 %s %d 1 0 0 %s %s %d %d %d %d %d %d\n",
- figLineStyle(renderer), figLineWidth(renderer),
+ figLineStyle(renderer), figLineWidth(renderer),
figColor(renderer, color), figColor(renderer, color),
figDepth(renderer),
xfig_dtostr(dl_buf, figDashLength(renderer)),
figCapsStyle(renderer),
- xfig_dtostr(cx_buf, figCoord(renderer, center->x)),
+ xfig_dtostr(cx_buf, figCoord(renderer, center->x)),
xfig_dtostr(cy_buf, figCoord(renderer, center->y)),
- (int)figCoord(renderer, first.x), (int)figCoord(renderer, first.y),
- (int)figCoord(renderer, second.x), (int)figCoord(renderer, second.y),
+ (int)figCoord(renderer, first.x), (int)figCoord(renderer, first.y),
+ (int)figCoord(renderer, second.x), (int)figCoord(renderer, second.y),
(int)figCoord(renderer, last.x), (int)figCoord(renderer, last.y));
}
@@ -937,7 +935,7 @@ draw_ellipse (DiaRenderer *self,
}
fprintf(renderer->file, "1 1 %d %d %d %d %d 0 %d %s 1 0.0 %d %d %d %d 0 0 0 0\n",
- figLineStyle(renderer),
+ figLineStyle(renderer),
stroke ? figLineWidth(renderer) : 0,
stroke ? figColor(renderer, stroke) : 0,
fill ? figColor(renderer, fill) : 0,
@@ -948,11 +946,11 @@ draw_ellipse (DiaRenderer *self,
(int)figCoord(renderer, width/2), (int)figCoord(renderer, height/2));
}
-static void
-draw_bezier(DiaRenderer *self,
+static void
+draw_bezier(DiaRenderer *self,
BezPoint *points,
int numpoints,
- Color *color)
+ Color *color)
{
XfigRenderer *renderer = XFIG_RENDERER(self);
@@ -964,14 +962,14 @@ draw_bezier(DiaRenderer *self,
DIA_RENDERER_CLASS(parent_class)->draw_bezier(self, points, numpoints, color);
}
-static void
-draw_bezier_with_arrows(DiaRenderer *self,
+static void
+draw_bezier_with_arrows(DiaRenderer *self,
BezPoint *points,
int numpoints,
real line_width,
Color *color,
Arrow *start_arrow,
- Arrow *end_arrow)
+ Arrow *end_arrow)
{
XfigRenderer *renderer = XFIG_RENDERER(self);
@@ -983,12 +981,12 @@ draw_bezier_with_arrows(DiaRenderer *self,
DIA_RENDERER_CLASS(parent_class)->draw_bezier_with_arrows(self, points, numpoints, line_width, color,
start_arrow, end_arrow);
}
-static void
-draw_beziergon (DiaRenderer *self,
+static void
+draw_beziergon (DiaRenderer *self,
BezPoint *points,
int numpoints,
Color *fill,
- Color *stroke)
+ Color *stroke)
{
XfigRenderer *renderer = XFIG_RENDERER(self);
@@ -1003,11 +1001,11 @@ draw_beziergon (DiaRenderer *self,
DIA_RENDERER_CLASS(parent_class)->draw_beziergon(self, points, numpoints, fill, stroke);
}
-static void
+static void
draw_string(DiaRenderer *self,
const char *text,
Point *pos, Alignment alignment,
- Color *color)
+ Color *color)
{
guchar *figtext = NULL;
XfigRenderer *renderer = XFIG_RENDERER(self);
@@ -1022,7 +1020,7 @@ draw_string(DiaRenderer *self,
/* xfig texts are specials */
fprintf(renderer->file, "4 %d %d %d 0 %d %s 0.0 6 0.0 0.0 %d %d %s\\001\n",
figAlignment(renderer, alignment),
- figColor(renderer, color),
+ figColor(renderer, color),
figDepth(renderer),
figFont(renderer),
xfig_dtostr(d_buf, figFontSize(renderer)),
@@ -1032,11 +1030,11 @@ draw_string(DiaRenderer *self,
g_free(figtext);
}
-static void
+static void
draw_image(DiaRenderer *self,
Point *point,
real width, real height,
- DiaImage *image)
+ DiaImage *image)
{
XfigRenderer *renderer = XFIG_RENDERER(self);
gchar d_buf[DTOSTR_BUF_SIZE];
@@ -1047,18 +1045,18 @@ draw_image(DiaRenderer *self,
fprintf(renderer->file, "2 5 %d 0 -1 0 %d 0 -1 %s %d %d 0 0 0 5\n",
figLineStyle(renderer), figDepth(renderer),
xfig_dtostr(d_buf, figDashLength(renderer)),
- figJoinStyle(renderer),
+ figJoinStyle(renderer),
figCapsStyle(renderer));
fprintf(renderer->file, "\t0 %s\n", dia_image_filename(image));
fprintf(renderer->file, "\t%d %d %d %d %d %d %d %d %d %d\n",
- (int)figCoord(renderer, point->x), (int)figCoord(renderer, point->y),
- (int)figCoord(renderer, point->x+width), (int)figCoord(renderer, point->y),
- (int)figCoord(renderer, point->x+width), (int)figCoord(renderer, point->y+height),
- (int)figCoord(renderer, point->x), (int)figCoord(renderer, point->y+height),
+ (int)figCoord(renderer, point->x), (int)figCoord(renderer, point->y),
+ (int)figCoord(renderer, point->x+width), (int)figCoord(renderer, point->y),
+ (int)figCoord(renderer, point->x+width), (int)figCoord(renderer, point->y+height),
+ (int)figCoord(renderer, point->x), (int)figCoord(renderer, point->y+height),
(int)figCoord(renderer, point->x), (int)figCoord(renderer, point->y));
}
-static void
+static void
draw_object(DiaRenderer *self,
DiaObject *object,
DiaMatrix *matrix)
@@ -1095,7 +1093,7 @@ export_fig(DiagramData *data, DiaContext *ctx,
file = g_fopen(filename, "w");
if (file == NULL) {
- dia_context_add_message_with_errno (ctx, errno, _("Can't open output file %s"),
+ dia_context_add_message_with_errno (ctx, errno, _("Can't open output file %s"),
dia_context_get_filename(ctx));
return FALSE;
}
@@ -1117,7 +1115,7 @@ export_fig(DiagramData *data, DiaContext *ctx,
renderer->color_pass = TRUE;
DIA_RENDERER_GET_CLASS(renderer)->begin_render(DIA_RENDERER(renderer), NULL);
-
+
for (i=0; i<data->layers->len; i++) {
layer = (Layer *) g_ptr_array_index(data->layers, i);
if (layer->visible) {
@@ -1125,13 +1123,13 @@ export_fig(DiagramData *data, DiaContext *ctx,
renderer->depth++;
}
}
-
+
DIA_RENDERER_GET_CLASS(renderer)->end_render(DIA_RENDERER(renderer));
renderer->color_pass = FALSE;
DIA_RENDERER_GET_CLASS(renderer)->begin_render(DIA_RENDERER(renderer), NULL);
-
+
for (i=0; i<data->layers->len; i++) {
layer = (Layer *) g_ptr_array_index(data->layers, i);
if (layer->visible) {
@@ -1139,7 +1137,7 @@ export_fig(DiagramData *data, DiaContext *ctx,
renderer->depth++;
}
}
-
+
DIA_RENDERER_GET_CLASS(renderer)->end_render(DIA_RENDERER(renderer));
g_object_unref(renderer);
diff --git a/plug-ins/xfig/xfig-import.c b/plug-ins/xfig/xfig-import.c
index 2798167f..5f8b3fe1 100644
--- a/plug-ins/xfig/xfig-import.c
+++ b/plug-ins/xfig/xfig-import.c
@@ -21,10 +21,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-
-#ifdef HAVE_CONFIG_H
+
#include <config.h>
-#endif
#include <stdio.h>
/* Information used here is taken from the FIG Format 3.2 specification
@@ -82,7 +80,7 @@ skip_comments(FILE *file) {
if ((ch = fgetc(file)) == EOF) {
return FALSE;
}
-
+
if (ch == '\n') continue;
else if (ch == '#') {
eat_line(file);
@@ -98,14 +96,14 @@ skip_comments(FILE *file) {
static Color
fig_color(int color_index, DiaContext *ctx)
{
- if (color_index <= -1)
+ if (color_index <= -1)
return color_black; /* Default color */
- else if (color_index < FIG_MAX_DEFAULT_COLORS)
+ else if (color_index < FIG_MAX_DEFAULT_COLORS)
return fig_default_colors[color_index];
- else if (color_index < FIG_MAX_USER_COLORS)
+ else if (color_index < FIG_MAX_USER_COLORS)
return fig_colors[color_index-FIG_MAX_DEFAULT_COLORS];
else {
- dia_context_add_message(ctx,
+ dia_context_add_message(ctx,
_("Color index %d too high; only 512 colors allowed. Using black instead."),
color_index);
return color_black;
@@ -139,7 +137,7 @@ fig_area_fill_color(int area_fill, int color_index, DiaContext *ctx)
} else {
dia_context_add_message(ctx, _("Patterns are not supported by Dia"));
}
-
+
return col;
}
@@ -150,8 +148,8 @@ static PropDescription xfig_simple_prop_descs_line[] = {
{ "line_colour", PROP_TYPE_COLOUR },
PROP_DESC_END};
-static LineStyle
-fig_line_style_to_dia(int line_style, DiaContext *ctx)
+static LineStyle
+fig_line_style_to_dia(int line_style, DiaContext *ctx)
{
switch (line_style) {
case 0:
@@ -190,17 +188,17 @@ fig_simple_properties(DiaObject *obj,
ColorProperty *cprop;
g_assert(props->len == 2);
-
+
rprop = g_ptr_array_index(props,0);
rprop->real_data = thickness/FIG_ALT_UNIT;
-
+
cprop = g_ptr_array_index(props,1);
cprop->color_data = fig_color(pen_color, ctx);
if (line_style != -1) {
- LinestyleProperty *lsprop =
- (LinestyleProperty *)make_new_prop("line_style",
+ LinestyleProperty *lsprop =
+ (LinestyleProperty *)make_new_prop("line_style",
PROP_TYPE_LINESTYLE,
PROP_FLAG_DONT_SAVE);
lsprop->dash = dash_length/FIG_ALT_UNIT;
@@ -210,14 +208,14 @@ fig_simple_properties(DiaObject *obj,
}
if (area_fill == -1) {
- BoolProperty *bprop =
+ BoolProperty *bprop =
(BoolProperty *)make_new_prop("show_background",
PROP_TYPE_BOOL,PROP_FLAG_DONT_SAVE);
bprop->bool_data = FALSE;
g_ptr_array_add(props,bprop);
} else {
- ColorProperty *cprop =
+ ColorProperty *cprop =
(ColorProperty *)make_new_prop("fill_colour",
PROP_TYPE_COLOUR,
PROP_FLAG_DONT_SAVE);
@@ -388,9 +386,9 @@ add_at_depth(DiaObject *newobj, int depth, DiaContext *ctx)
depth, FIG_MAX_DEPTHS-1);
depth = FIG_MAX_DEPTHS - 1;
}
- if (compound_stack == NULL)
+ if (compound_stack == NULL)
depths[depth] = g_list_append(depths[depth], newobj);
- else
+ else
if (compound_depth > depth) compound_depth = depth;
}
@@ -437,7 +435,7 @@ fig_read_ellipse(FILE *file, DiaContext *ctx)
return NULL;
}
setlocale(LC_NUMERIC, old_locale);
-
+
/* Curiously, the sub_type doesn't matter, as all info can be
extracted this way */
newobj = create_standard_ellipse((center_x-radius_x)/FIG_UNIT,
@@ -460,7 +458,7 @@ fig_read_ellipse(FILE *file, DiaContext *ctx)
}
static DiaObject *
-fig_read_polyline(FILE *file, DiaContext *ctx)
+fig_read_polyline(FILE *file, DiaContext *ctx)
{
int sub_type;
int line_style;
@@ -527,10 +525,10 @@ fig_read_polyline(FILE *file, DiaContext *ctx)
if (!fig_read_n_points(file, npoints, &points, ctx)) {
goto exit;
}
-
+
switch (sub_type) {
case 4: {
- RealProperty *rprop =
+ RealProperty *rprop =
(RealProperty *)make_new_prop("corner_radius",
PROP_TYPE_REAL,PROP_FLAG_DONT_SAVE);
if (radius < 0) {
@@ -567,8 +565,8 @@ fig_read_polyline(FILE *file, DiaContext *ctx)
if (newobj == NULL) goto exit;
break;
case 1: /* polyline */
- newobj = create_standard_polyline(npoints, points,
- forward_arrow_info,
+ newobj = create_standard_polyline(npoints, points,
+ forward_arrow_info,
backward_arrow_info);
if (newobj == NULL) goto exit;
break;
@@ -576,7 +574,7 @@ fig_read_polyline(FILE *file, DiaContext *ctx)
newobj = create_standard_polygon(npoints, points);
if (newobj == NULL) goto exit;
break;
- default:
+ default:
dia_context_add_message(ctx, _("Unknown polyline subtype: %d\n"), sub_type);
goto exit;
}
@@ -587,7 +585,7 @@ fig_read_polyline(FILE *file, DiaContext *ctx)
/* Style_val (size of dots and dashes) in 1/80 inch*/
/* Join style */
/* Cap style */
-
+
/* Depth field */
add_at_depth(newobj, depth, ctx);
exit:
@@ -653,17 +651,17 @@ static BezPoint *transform_spline(int npoints, Point *points, gboolean closed) {
* [ 1 4 1 0]
* [ 0 4 2 0]*1/6
* [ 0 2 4 0]
- * [ 0 1 4 1]
+ * [ 0 1 4 1]
*
* The basis matrix for Catmull-Rom splines (M_c) is:
* [-s 2-s s-2 s]
* [2s s-3 3-2s -s]
* [-s 0 s 0]
* [ 0 1 0 0] where s = (1-t)/2 and t = 0, so s = 1/2:
- * [ -.5 1.5 -1.5 .5]
- * [ 1 -2.5 2 -.5]
- * [ -.5 0 .5 0]
- * [ 0 1 4 1]
+ * [ -.5 1.5 -1.5 .5]
+ * [ 1 -2.5 2 -.5]
+ * [ -.5 0 .5 0]
+ * [ 0 1 4 1]
* Thus, the transformation matrix for the interpolated splines should be
* (M_bez^-1)*M_c
* The conversion matrix should then be:
@@ -744,7 +742,7 @@ fig_read_spline(FILE *file, DiaContext *ctx)
if (!fig_read_n_points(file, npoints, &points, ctx)) {
goto exit;
}
-
+
switch (sub_type) {
case 0: /* Open approximated spline */
case 1: /* Closed approximated spline */
@@ -802,7 +800,7 @@ fig_read_spline(FILE *file, DiaContext *ctx)
}
if (newobj == NULL) goto exit;
break;
- default:
+ default:
dia_context_add_message(ctx, _("Unknown spline subtype: %d\n"), sub_type);
goto exit;
}
@@ -812,7 +810,7 @@ fig_read_spline(FILE *file, DiaContext *ctx)
/* Pen style field (not used) */
/* Style_val (size of dots and dashes) in 1/80 inch*/
/* Cap style */
-
+
/* Depth field */
add_at_depth(newobj, depth, ctx);
exit:
@@ -885,12 +883,12 @@ fig_read_arc(FILE *file, DiaContext *ctx)
distance = distance_point_point (&p2, &pm);
switch (sub_type) {
- case 0:
- case 1:
+ case 0:
+ case 1:
case 2: /* We can't do pie-wedge properly yet */
newobj = create_standard_arc(x1/FIG_UNIT, y1/FIG_UNIT,
x3/FIG_UNIT, y3/FIG_UNIT,
- direction ? distance : -distance,
+ direction ? distance : -distance,
forward_arrow_info,
backward_arrow_info);
if (newobj == NULL) goto exit;
@@ -899,7 +897,7 @@ fig_read_arc(FILE *file, DiaContext *ctx)
dia_context_add_message(ctx, _("Filled arc treated as unfilled"));
}
break;
- default:
+ default:
dia_context_add_message(ctx, _("Unknown polyline arc: %d\n"), sub_type);
goto exit;
}
@@ -911,7 +909,7 @@ fig_read_arc(FILE *file, DiaContext *ctx)
/* Style_val (size of dots and dashes) in 1/80 inch*/
/* Join style */
/* Cap style */
-
+
/* Depth field */
add_at_depth(newobj, depth, ctx);
@@ -1010,7 +1008,7 @@ fig_read_text(FILE *file, DiaContext *ctx)
tprop->attr.height = font_size*2.54/72.0;
tprop->attr.color = fig_color(color, ctx);
newobj->ops->set_props(newobj, props);
-
+
/* Depth field */
add_at_depth(newobj, depth, ctx);
@@ -1244,7 +1242,7 @@ fig_read_meta_data(FILE *file, DiagramData *dia, DiaContext *ctx)
dia_context_add_message_with_errno(ctx, errno, _("Error reading transparent color."));
return FALSE;
}
-
+
/* Don't know what to do with this */
}
@@ -1264,19 +1262,19 @@ fig_read_meta_data(FILE *file, DiagramData *dia, DiaContext *ctx)
dia_context_add_message_with_errno(ctx, errno, _("Error reading resolution."));
return FALSE;
}
-
+
/* Don't know what to do with this */
}
return TRUE;
}
/* imports the given fig-file, returns TRUE if successful */
-static gboolean
+static gboolean
import_fig(const gchar *filename, DiagramData *dia, DiaContext *ctx, void* user_data)
{
FILE *figfile;
char buf[BUFLEN];
- int figmajor, figminor;
+ int figmajor, figminor;
int i;
for (i = 0; i < FIG_MAX_USER_COLORS; i++) {
@@ -1288,11 +1286,11 @@ import_fig(const gchar *filename, DiagramData *dia, DiaContext *ctx, void* user_
figfile = g_fopen(filename,"r");
if (figfile == NULL) {
- dia_context_add_message_with_errno(ctx, errno, _("Couldn't open: '%s' for reading.\n"),
+ dia_context_add_message_with_errno(ctx, errno, _("Couldn't open: '%s' for reading.\n"),
dia_context_get_filename(ctx));
return FALSE;
}
-
+
/* First check magic bytes */
if (fgets(buf, BUFLEN, figfile) == NULL ||
sscanf(buf, "#FIG %d.%d\n", &figmajor, &figminor) != 2)
@@ -1301,9 +1299,9 @@ import_fig(const gchar *filename, DiagramData *dia, DiaContext *ctx, void* user_
fclose(figfile);
return FALSE;
}
-
+
if (figmajor != 3 || figminor != 2) {
- dia_context_add_message(ctx, _("This is a Fig version %d.%d file.\n It may not be importable."),
+ dia_context_add_message(ctx, _("This is a Fig version %d.%d file.\n It may not be importable."),
figmajor, figminor);
}
@@ -1323,7 +1321,7 @@ import_fig(const gchar *filename, DiagramData *dia, DiaContext *ctx, void* user_
fclose(figfile);
return FALSE;
}
-
+
compound_stack = NULL;
do {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]