[dia/dia-next: 48/59] New "formal parameter" editor



commit d87606ef85c102d0ca49f8f35a34a6a18d379326
Author: Zander Brown <zbrown gnome org>
Date:   Wed Jan 2 21:22:50 2019 +0000

    New "formal parameter" editor

 data/dia-uml-class-editor.ui                       |   5 +-
 data/dia-uml-formal-parameter-dialog.ui            | 128 ++++++
 objects/UML/Makefile.am                            |   6 +-
 objects/UML/class.c                                |  35 +-
 objects/UML/class_dialog.c                         |  23 -
 objects/UML/class_dialog.h                         |  12 -
 objects/UML/class_operations_dialog.c              |  18 +
 objects/UML/class_templates_dialog.c               | 476 ---------------------
 objects/UML/dia-uml-class.c                        | 130 ++++--
 objects/UML/dia-uml-class.h                        |  42 +-
 objects/UML/dia-uml-formal-parameter.c             | 230 ++++++++++
 objects/UML/dia-uml-formal-parameter.h             |  27 ++
 objects/UML/editor/dia-uml-class-editor.c          |  60 +++
 .../UML/editor/dia-uml-formal-parameter-dialog.c   | 140 ++++++
 .../UML/editor/dia-uml-formal-parameter-dialog.h   |  18 +
 objects/UML/uml.h                                  |  19 -
 objects/UML/umlformalparameter.c                   | 131 ------
 17 files changed, 774 insertions(+), 726 deletions(-)
---
diff --git a/data/dia-uml-class-editor.ui b/data/dia-uml-class-editor.ui
index 0140bddc..947bad40 100644
--- a/data/dia-uml-class-editor.ui
+++ b/data/dia-uml-class-editor.ui
@@ -172,7 +172,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkSwitch">
+                  <object class="GtkSwitch" id="is_template">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                   </object>
@@ -202,6 +202,7 @@
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="selection_mode">none</property>
+                    <signal name="row-activated" handler="edit_template" object="DiaUmlClassEditor" 
swapped="yes"/>
                   </object>
                 </child>
                 <child type="label_item">
@@ -218,11 +219,11 @@
               <object class="GtkButton">
                 <property name="label" translatable="yes">Add Template</property>
                 <property name="visible">True</property>
-                <property name="sensitive">False</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
                 <property name="halign">end</property>
                 <property name="valign">center</property>
+                <signal name="clicked" handler="add_template" object="DiaUmlClassEditor" swapped="yes"/>
               </object>
               <packing>
                 <property name="expand">False</property>
diff --git a/data/dia-uml-formal-parameter-dialog.ui b/data/dia-uml-formal-parameter-dialog.ui
new file mode 100644
index 00000000..b8efe1ab
--- /dev/null
+++ b/data/dia-uml-formal-parameter-dialog.ui
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface>
+  <requires lib="gtk+" version="3.20"/>
+  <template class="DiaUmlFormalParameterDialog" parent="GtkDialog">
+    <property name="can_focus">False</property>
+    <property name="title" translatable="yes">Attribute</property>
+    <property name="resizable">False</property>
+    <property name="type_hint">dialog</property>
+    <child>
+      <placeholder/>
+    </child>
+    <child internal-child="vbox">
+      <object class="GtkBox">
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">2</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox">
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkGrid">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="margin_left">8</property>
+            <property name="margin_right">8</property>
+            <property name="margin_top">8</property>
+            <property name="margin_bottom">8</property>
+            <property name="row_spacing">8</property>
+            <property name="column_spacing">16</property>
+            <property name="row_homogeneous">True</property>
+            <child>
+              <object class="GtkLabel">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Name</property>
+                <property name="xalign">0</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Type</property>
+                <property name="xalign">0</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="name">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="valign">center</property>
+                <property name="hexpand">True</property>
+                <property name="width_chars">25</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="type">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="valign">center</property>
+                <property name="hexpand">True</property>
+                <property name="width_chars">25</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton">
+                <property name="label" translatable="yes">Delete</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="halign">end</property>
+                <property name="valign">center</property>
+                <signal name="clicked" handler="remove_template" object="DiaUmlFormalParameterDialog" 
swapped="yes"/>
+                <style>
+                  <class name="destructive-action"/>
+                </style>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">2</property>
+              </packing>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </template>
+  <object class="GtkTextBuffer" id="comment"/>
+</interface>
diff --git a/objects/UML/Makefile.am b/objects/UML/Makefile.am
index 794d63fe..498fcbba 100644
--- a/objects/UML/Makefile.am
+++ b/objects/UML/Makefile.am
@@ -8,6 +8,7 @@ libuml_objects_la_SOURCES = \
                        dia-uml-operation.c \
                        dia-uml-parameter.c \
                        dia-uml-attribute.c \
+                       dia-uml-formal-parameter.c \
                        class.c \
                        class.h \
                        class_dialog.h \
@@ -19,8 +20,8 @@ libuml_objects_la_SOURCES = \
                        editor/dia-uml-operation-dialog.c \
                        editor/dia-uml-operation-parameter-row.c \
                        editor/dia-uml-attribute-dialog.c \
+                       editor/dia-uml-formal-parameter-dialog.c \
                        class_operations_dialog.c \
-                       class_templates_dialog.c \
                        note.c \
                        actor.c \
                        usecase.c \
@@ -46,8 +47,7 @@ libuml_objects_la_SOURCES = \
                        fork.c \
                        stereotype.c \
                        stereotype.h \
-                       transition.c \
-                       umlformalparameter.c
+                       transition.c
 
 libuml_objects_la_LDFLAGS = -export-dynamic -module -avoid-version $(NO_UNDEFINED)
 libuml_objects_la_LIBADD = $(CAIRO_LIBS) $(top_builddir)/lib/libdia.la
diff --git a/objects/UML/class.c b/objects/UML/class.c
index 5f7347fe..f650c1b4 100644
--- a/objects/UML/class.c
+++ b/objects/UML/class.c
@@ -45,6 +45,7 @@
 
 #include "dia-uml-attribute.h"
 #include "dia-uml-operation.h"
+#include "dia-uml-formal-parameter.h"
 
 #define UMLCLASS_BORDER 0.1
 #define UMLCLASS_UNDERLINEWIDTH 0.05
@@ -1150,7 +1151,7 @@ umlclass_draw_template_parameters_box(UMLClass *umlclass, DiaRenderer *renderer,
   list = umlclass->formal_params;
   while (list != NULL)
   {
-    gchar *paramstr = uml_get_formalparameter_string((UMLFormalParameter *)list->data);
+    gchar *paramstr = dia_uml_formal_parameter_format ((DiaUmlFormalParameter *) list->data);
     
     ascent = dia_font_ascent(paramstr, font, font_height);
     TextInsert.y += ascent;
@@ -1739,9 +1740,9 @@ umlclass_calculate_data(UMLClass *umlclass)
       list = umlclass->formal_params;
       while (list != NULL)
       {
-        UMLFormalParameter *param = (UMLFormalParameter *) list->data;
-       gchar *paramstr = uml_get_formalparameter_string(param);
-       
+        DiaUmlFormalParameter *param = (DiaUmlFormalParameter *) list->data;
+        gchar *paramstr = dia_uml_formal_parameter_format (param);
+
         width = dia_font_string_width(paramstr,
                                       umlclass->normal_font,
                                       umlclass->font_height);
@@ -1914,7 +1915,7 @@ umlclass_destroy(UMLClass *umlclass)
   GList *list;
   DiaUmlAttribute *attr;
   DiaUmlOperation *op;
-  UMLFormalParameter *param;
+  DiaUmlFormalParameter *param;
 
 #ifdef DEBUG
   umlclass_sanity_check(umlclass, "Destroying");
@@ -1957,8 +1958,8 @@ umlclass_destroy(UMLClass *umlclass)
 
   list = umlclass->formal_params;
   while (list != NULL) {
-    param = (UMLFormalParameter *)list->data;
-    uml_formalparameter_destroy(param);
+    param = (DiaUmlFormalParameter *)list->data;
+    g_object_unref (param);
     list = g_list_next(list);
   }
   g_list_free(umlclass->formal_params);
@@ -1980,7 +1981,7 @@ umlclass_copy(UMLClass *umlclass)
   Element *elem, *newelem;
   DiaObject *newobj;
   GList *list;
-  UMLFormalParameter *param;
+  DiaUmlFormalParameter *param;
   
   elem = &umlclass->element;
   
@@ -2054,12 +2055,11 @@ umlclass_copy(UMLClass *umlclass)
   newumlclass->operations = NULL;
   list = umlclass->operations;
   while (list != NULL) {
-    DiaUmlOperation *op = (DiaUmlOperation *)list->data;
-    DiaUmlOperation *newop = dia_uml_operation_copy(op);
+    DiaUmlOperation *op = (DiaUmlOperation *) list->data;
+    DiaUmlOperation *newop = dia_uml_operation_copy (op);
     dia_uml_operation_ensure_connection_points (newop, newobj);
 
-    newumlclass->operations = g_list_append(newumlclass->operations,
-                                            newop);
+    newumlclass->operations = g_list_append(newumlclass->operations, newop);
     list = g_list_next(list);
   }
 
@@ -2068,10 +2068,9 @@ umlclass_copy(UMLClass *umlclass)
   newumlclass->formal_params = NULL;
   list = umlclass->formal_params;
   while (list != NULL) {
-    param = (UMLFormalParameter *)list->data;
-    newumlclass->formal_params =
-      g_list_append(newumlclass->formal_params,
-                    uml_formalparameter_copy(param));
+    param = (DiaUmlFormalParameter *) list->data;
+    newumlclass->formal_params = g_list_append (newumlclass->formal_params,
+                                                dia_uml_formal_parameter_copy (param));
     list = g_list_next(list);
   }
 
@@ -2144,7 +2143,7 @@ umlclass_save(UMLClass *umlclass, ObjectNode obj_node,
 {
   DiaUmlAttribute *attr;
   DiaUmlOperation *op;
-  UMLFormalParameter *formal_param;
+  DiaUmlFormalParameter *formal_param;
   GList *list;
   AttributeNode attr_node;
   
@@ -2241,7 +2240,7 @@ umlclass_save(UMLClass *umlclass, ObjectNode obj_node,
   attr_node = new_attribute(obj_node, "templates");
   list = umlclass->formal_params;
   while (list != NULL) {
-    formal_param = (UMLFormalParameter *) list->data;
+    formal_param = (DiaUmlFormalParameter *) list->data;
     uml_formalparameter_write(attr_node, formal_param, ctx);
     list = g_list_next(list);
   }
diff --git a/objects/UML/class_dialog.c b/objects/UML/class_dialog.c
index d33e3840..fec82842 100644
--- a/objects/UML/class_dialog.c
+++ b/objects/UML/class_dialog.c
@@ -524,23 +524,6 @@ style_create_page(GtkNotebook *notebook,  UMLClass *umlclass)
  ******************** ALL *****************************
  ******************************************************/
 
-static void
-switch_page_callback(GtkNotebook *notebook,
-                    GtkWidget *page)
-{
-  UMLClass *umlclass;
-  UMLClassDialog *prop_dialog;
-
-  umlclass = (UMLClass *)
-    g_object_get_data(G_OBJECT(notebook), "user_data");
-
-  prop_dialog = umlclass->properties_dialog;
-
-  if (prop_dialog != NULL) {
-    _templates_get_current_values(prop_dialog);
-  }
-}
-
 static void
 destroy_properties_dialog (GtkWidget* widget,
                           gpointer user_data)
@@ -559,7 +542,6 @@ fill_in_dialog(UMLClass *umlclass)
   umlclass_sanity_check(umlclass, "Filling in dialog before attrs");
 #endif
   class_fill_in_dialog(umlclass);
-  _templates_fill_in_dialog(umlclass);
 }
 
 ObjectChange *
@@ -618,7 +600,6 @@ umlclass_apply_props_from_dialog(UMLClass *umlclass, GtkWidget *widget)
   /* ^^^ attribs must be called before ops, to get the right order of the
      connectionpoints. */
   _operations_read_from_dialog(umlclass, prop_dialog, UMLCLASS_CONNECTIONPOINTS);
-  _templates_read_from_dialog(umlclass, prop_dialog);
 
   /* Reestablish mainpoint */
 #ifdef UML_MAINPOINT
@@ -663,7 +644,6 @@ create_dialog_pages(GtkNotebook *notebook, UMLClass *umlclass)
 {
   class_create_page(notebook, umlclass);
   _operations_create_page(notebook, umlclass);
-  _templates_create_page(notebook, umlclass);
   style_create_page(notebook, umlclass);
 }
 
@@ -685,7 +665,6 @@ umlclass_get_properties(UMLClass *umlclass, gboolean is_default)
     g_object_ref_sink(vbox);
     prop_dialog->dialog = vbox;
 
-    prop_dialog->current_templ = NULL;
     prop_dialog->deleted_connections = NULL;
     prop_dialog->added_connections = NULL;
     prop_dialog->disconnected_connections = NULL;
@@ -697,8 +676,6 @@ umlclass_get_properties(UMLClass *umlclass, gboolean is_default)
 
     g_object_set_data(G_OBJECT(notebook), "user_data", (gpointer) umlclass);
     
-    g_signal_connect (G_OBJECT (notebook), "switch_page",
-                     G_CALLBACK(switch_page_callback), umlclass);
     g_signal_connect (G_OBJECT (umlclass->properties_dialog->dialog), "destroy",
                      G_CALLBACK(destroy_properties_dialog), umlclass);
     
diff --git a/objects/UML/class_dialog.h b/objects/UML/class_dialog.h
index d7f0ae8d..3042f44a 100644
--- a/objects/UML/class_dialog.h
+++ b/objects/UML/class_dialog.h
@@ -52,12 +52,6 @@ struct _UMLClassDialog {
   GtkWidget *attr_visible;
 
   GtkWidget *editor;
-
-  DiaList *templates_list;
-  DiaListItem *current_templ;
-  GtkToggleButton *templ_template;
-  GtkEntry *templ_name;
-  GtkEntry *templ_type;
 };
 
 void _umlclass_store_disconnects(UMLClassDialog *prop_dialog, ConnectionPoint *cp);
@@ -65,12 +59,6 @@ void _umlclass_store_disconnects(UMLClassDialog *prop_dialog, ConnectionPoint *c
 const gchar *_class_get_comment(GtkTextView *);
 void _class_set_comment(GtkTextView *, gchar *);
 
-void _templates_get_current_values(UMLClassDialog *prop_dialog);
-
-void _templates_fill_in_dialog(UMLClass *umlclass);
-
 void _operations_read_from_dialog(UMLClass *umlclass, UMLClassDialog *prop_dialog, int connection_index);
-void _templates_read_from_dialog(UMLClass *umlclass, UMLClassDialog *prop_dialog);
 
 void _operations_create_page(GtkNotebook *notebook,  UMLClass *umlclass);
-void _templates_create_page(GtkNotebook *notebook,  UMLClass *umlclass);
diff --git a/objects/UML/class_operations_dialog.c b/objects/UML/class_operations_dialog.c
index f96594ee..9d51f527 100644
--- a/objects/UML/class_operations_dialog.c
+++ b/objects/UML/class_operations_dialog.c
@@ -58,6 +58,10 @@ _operations_read_from_dialog (UMLClass *umlclass,
   g_list_free_full (umlclass->operations, g_object_unref);
   umlclass->operations = NULL;
 
+  /* Free current formal parameters: */
+  g_list_free_full (umlclass->formal_params, g_object_unref);
+  umlclass->formal_params = NULL;
+
   /* If attributes visible and not suppressed */
   attr_visible = ( gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->attr_vis ))) &&
                  (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prop_dialog->attr_supp)));
@@ -131,6 +135,20 @@ _operations_read_from_dialog (UMLClass *umlclass,
 
     i++;
   }
+
+  umlclass->template = dia_uml_class_is_template (editor_state);
+
+  /* Insert new formal params and remove them from gtklist: */
+  i = 0;
+  list_store = dia_uml_class_get_formal_parameters (editor_state);
+  /* Insert new operations and remove them from gtklist: */
+  while ((itm = g_list_model_get_item (list_store, i))) {
+    DiaUmlFormalParameter *param = DIA_UML_FORMAL_PARAMETER (itm);
+
+    umlclass->formal_params = g_list_append(umlclass->formal_params, g_object_ref (param));
+
+    i++;
+  }
 }
 
 void 
diff --git a/objects/UML/dia-uml-class.c b/objects/UML/dia-uml-class.c
index 909a5a45..cbfb00bd 100644
--- a/objects/UML/dia-uml-class.c
+++ b/objects/UML/dia-uml-class.c
@@ -1,6 +1,7 @@
 #include "dia-uml-class.h"
 #include "dia-uml-operation.h"
 #include "dia-uml-attribute.h"
+#include "dia-uml-formal-parameter.h"
 #include "editor/dia-uml-list-store.h"
 
 struct _DiaUmlClass {
@@ -50,17 +51,21 @@ struct _DiaUmlClass {
   DiaUmlListStore *operations;
 
   /* Template: */
-  gboolean template_;
-  GList *formal_params;
+  gboolean is_template;
+  DiaUmlListStore *formal_params;
 };
 
 G_DEFINE_TYPE (DiaUmlClass, dia_uml_class, G_TYPE_OBJECT)
 
+enum {
+  PROP_IS_TEMPLATE = 1,
+  N_PROPS
+};
+static GParamSpec* properties[N_PROPS];
+
 static void
 clear_attrs (DiaUmlClass *self)
 {
-  GList *list;
-
   g_clear_object (&self->normal_font);
   g_clear_object (&self->abstract_font);
   g_clear_object (&self->polymorphic_font);
@@ -74,13 +79,7 @@ clear_attrs (DiaUmlClass *self)
 
   g_clear_object (&self->attributes);
   g_clear_object (&self->operations);
-
-  list = self->formal_params;
-  while (list) {
-    uml_formalparameter_destroy ((UMLFormalParameter *) list->data);
-    list = g_list_next (list);
-  }
-  g_list_free (self->formal_params);
+  g_clear_object (&self->formal_params);
 }
 
 static void
@@ -91,12 +90,60 @@ dia_uml_class_finalize (GObject *object)
   clear_attrs (self);
 }
 
+static void
+dia_uml_class_set_property (GObject      *object,
+                            guint         property_id,
+                            const GValue *value,
+                            GParamSpec   *pspec)
+{
+  DiaUmlClass *self = DIA_UML_CLASS (object);
+
+  switch (property_id) {
+    case PROP_IS_TEMPLATE:
+      self->is_template = g_value_get_boolean (value);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+  }
+}
+
+static void
+dia_uml_class_get_property (GObject    *object,
+                            guint       property_id,
+                            GValue     *value,
+                            GParamSpec *pspec)
+{
+  DiaUmlClass *self = DIA_UML_CLASS (object);
+
+  switch (property_id) {
+    case PROP_IS_TEMPLATE:
+      g_value_set_boolean (value, self->is_template);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+  }
+}
+
 static void
 dia_uml_class_class_init (DiaUmlClassClass *klass)
 {
-  GObjectClass   *object_class = G_OBJECT_CLASS (klass);
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
   object_class->finalize = dia_uml_class_finalize;
+  object_class->set_property = dia_uml_class_set_property;
+  object_class->get_property = dia_uml_class_get_property;
+
+  properties[PROP_IS_TEMPLATE] = g_param_spec_boolean ("is-template",
+                                                       "Is template",
+                                                       "Is a template class",
+                                                       FALSE,
+                                                       G_PARAM_READWRITE);
+
+  g_object_class_install_properties (object_class,
+                                     N_PROPS,
+                                     properties);
 }
 
 static void
@@ -175,7 +222,6 @@ dia_uml_class_load (DiaUmlClass *self,
     list = g_list_next(list);
   }
 
-  /* TODO: Why? */
   list = klass->operations;
   self->operations = dia_uml_list_store_new ();
   while (list != NULL) {
@@ -188,17 +234,15 @@ dia_uml_class_load (DiaUmlClass *self,
     list = g_list_next(list);
   }
 
-  self->template_ = klass->template;
-  
-  self->formal_params = NULL;
+  self->is_template = klass->template;
+
   list = klass->formal_params;
+  self->formal_params = dia_uml_list_store_new ();
   while (list != NULL) {
-    UMLFormalParameter *param = (UMLFormalParameter *) list->data;
-    UMLFormalParameter *param_copy;
-    
-    param_copy = uml_formalparameter_copy (param);
-    self->formal_params = g_list_append (self->formal_params, param_copy);
-    
+    DiaUmlFormalParameter *param = (DiaUmlFormalParameter *)list->data;
+    DiaUmlFormalParameter *copy = dia_uml_formal_parameter_copy (param);
+
+    dia_uml_list_store_add (self->formal_params, DIA_UML_LIST_DATA (copy));
     list = g_list_next(list);
   }
 }
@@ -255,6 +299,7 @@ dia_uml_class_store (DiaUmlClass *self,
 
   /* TODO: List stuff */
   list = NULL;
+  i = 0;
   while ((itm = g_list_model_get_item (G_LIST_MODEL (self->attributes), i))) {
     list = g_list_append (list, itm);
     i++;
@@ -263,14 +308,28 @@ dia_uml_class_store (DiaUmlClass *self,
 
 
   list = NULL;
+  i = 0;
   while ((itm = g_list_model_get_item (G_LIST_MODEL (self->operations), i))) {
     list = g_list_append (list, itm);
     i++;
   }
   klass->operations = list;
 
-  klass->template = self->template_;
-  klass->formal_params = self->formal_params;
+  klass->template = self->is_template;
+
+  list = NULL;
+  i = 0;
+  while ((itm = g_list_model_get_item (G_LIST_MODEL (self->formal_params), i))) {
+    list = g_list_append (list, itm);
+    i++;
+  }
+  klass->formal_params = list;
+}
+
+gboolean
+dia_uml_class_is_template (DiaUmlClass *klass)
+{
+  return klass->is_template;
 }
 
 GListModel *
@@ -285,8 +344,14 @@ dia_uml_class_get_operations (DiaUmlClass *self)
   return G_LIST_MODEL (self->operations);
 }
 
+GListModel *
+dia_uml_class_get_formal_parameters (DiaUmlClass *self)
+{
+  return G_LIST_MODEL (self->formal_params);
+}
+
 /*
- * Don't rely on these four being called!
+ * Don't rely on these six being called!
  * 
  * The DiaUmlListStore can/will be edited directly (e.g. by DiaUmlClassEditor)
  * so connect to items-changed if you want to observe these!
@@ -321,3 +386,18 @@ dia_uml_class_remove_attribute (DiaUmlClass     *self,
 {
   dia_uml_list_store_remove (self->attributes, DIA_UML_LIST_DATA (attribute));
 }
+
+void
+dia_uml_class_insert_formal_parameter (DiaUmlClass           *self,
+                                       DiaUmlFormalParameter *param,
+                                       int                    index)
+{
+  dia_uml_list_store_insert (self->formal_params, DIA_UML_LIST_DATA (param), index);
+}
+
+void
+dia_uml_class_remove_formal_parameter (DiaUmlClass           *self,
+                                       DiaUmlFormalParameter *param)
+{
+  dia_uml_list_store_remove (self->formal_params, DIA_UML_LIST_DATA (param));
+}
diff --git a/objects/UML/dia-uml-class.h b/objects/UML/dia-uml-class.h
index 240762ec..9debbdad 100644
--- a/objects/UML/dia-uml-class.h
+++ b/objects/UML/dia-uml-class.h
@@ -3,6 +3,7 @@
 #include "class.h"
 #include "dia-uml-attribute.h"
 #include "dia-uml-operation.h"
+#include "dia-uml-formal-parameter.h"
 
 #ifndef UML_CLASS_H
 #define UML_CLASS_H
@@ -12,23 +13,30 @@ G_BEGIN_DECLS
 #define DIA_UML_TYPE_CLASS (dia_uml_class_get_type ())
 G_DECLARE_FINAL_TYPE (DiaUmlClass, dia_uml_class, DIA_UML, CLASS, GObject)
 
-DiaUmlClass     *dia_uml_class_new              (UMLClass        *klass);
-void             dia_uml_class_load             (DiaUmlClass     *self,
-                                                 UMLClass        *klass);
-void             dia_uml_class_store            (DiaUmlClass     *self,
-                                                 UMLClass        *klass);
-GListModel      *dia_uml_class_get_attributes   (DiaUmlClass     *self);
-void             dia_uml_class_remove_attribute (DiaUmlClass     *self,
-                                                 DiaUmlAttribute *attribute);
-void             dia_uml_class_insert_attribute (DiaUmlClass     *self,
-                                                 DiaUmlAttribute *attribute,
-                                                 int              index);
-GListModel      *dia_uml_class_get_operations   (DiaUmlClass     *self);
-void             dia_uml_class_remove_operation (DiaUmlClass     *self,
-                                                 DiaUmlOperation *operation);
-void             dia_uml_class_insert_operation (DiaUmlClass     *self,
-                                                 DiaUmlOperation *operation,
-                                                 int              index);
+DiaUmlClass     *dia_uml_class_new                     (UMLClass              *klass);
+void             dia_uml_class_load                    (DiaUmlClass           *self,
+                                                        UMLClass              *klass);
+void             dia_uml_class_store                   (DiaUmlClass           *self,
+                                                        UMLClass              *klass);
+gboolean         dia_uml_class_is_template             (DiaUmlClass           *klass);
+GListModel      *dia_uml_class_get_attributes          (DiaUmlClass           *self);
+void             dia_uml_class_remove_attribute        (DiaUmlClass           *self,
+                                                        DiaUmlAttribute       *attribute);
+void             dia_uml_class_insert_attribute        (DiaUmlClass           *self,
+                                                        DiaUmlAttribute       *attribute,
+                                                        int                    index);
+GListModel      *dia_uml_class_get_operations          (DiaUmlClass           *self);
+void             dia_uml_class_remove_operation        (DiaUmlClass           *self,
+                                                        DiaUmlOperation       *operation);
+void             dia_uml_class_insert_operation        (DiaUmlClass           *self,
+                                                        DiaUmlOperation       *operation,
+                                                        int                    index);
+GListModel      *dia_uml_class_get_formal_parameters   (DiaUmlClass           *self);
+void             dia_uml_class_remove_formal_parameter (DiaUmlClass           *self,
+                                                        DiaUmlFormalParameter *formal);
+void             dia_uml_class_insert_formal_parameter (DiaUmlClass           *self,
+                                                        DiaUmlFormalParameter *formal,
+                                                        int                    index);
 
 G_END_DECLS
 
diff --git a/objects/UML/dia-uml-formal-parameter.c b/objects/UML/dia-uml-formal-parameter.c
new file mode 100644
index 00000000..fae4b1ce
--- /dev/null
+++ b/objects/UML/dia-uml-formal-parameter.c
@@ -0,0 +1,230 @@
+/* Dia -- an diagram creation/manipulation program
+ * Copyright (C) 1998 Alexander Larsson
+ *
+ * umlformalparameter.c : refactored from uml.c, class.c to final use StdProps
+ *                  PROP_TYPE_DARRAY, a list where each element is a set
+ *                  of properies described by the same StdPropDesc
+ * Copyright (C) 2005 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
+ * (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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+
+#include "uml.h"
+#include "properties.h"
+#include "dia-uml-formal-parameter.h"
+#include "editor/dia-uml-list-data.h"
+
+static PropDescription umlformalparameter_props[] = {
+  { "name", PROP_TYPE_STRING, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
+  N_("Name"), NULL, NULL },
+  { "type", PROP_TYPE_STRING, PROP_FLAG_VISIBLE | PROP_FLAG_OPTIONAL,
+  N_("Type"), NULL, NULL },
+
+  PROP_DESC_END
+};
+
+static PropOffset umlformalparameter_offsets[] = {
+  { "name", PROP_TYPE_STRING, offsetof(DiaUmlFormalParameter, name) },
+  { "type", PROP_TYPE_STRING, offsetof(DiaUmlFormalParameter, type) },
+  { NULL, 0, 0 },
+};
+
+PropDescDArrayExtra umlformalparameter_extra = {
+  { umlformalparameter_props, umlformalparameter_offsets, "umlformalparameter" },
+  (NewRecordFunc) dia_uml_formal_parameter_new,
+  (FreeRecordFunc) g_object_unref
+};
+
+
+static void
+dia_uml_formal_parameter_list_data_init (DiaUmlListDataInterface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (DiaUmlFormalParameter, dia_uml_formal_parameter, G_TYPE_OBJECT,
+                         G_IMPLEMENT_INTERFACE (DIA_UML_TYPE_LIST_DATA,
+                                                dia_uml_formal_parameter_list_data_init))
+
+enum {
+  PROP_NAME = 1,
+  PROP_TYPE,
+  N_PROPS
+};
+static GParamSpec* properties[N_PROPS];
+
+
+static void
+dia_uml_formal_parameter_finalize (GObject *object)
+{
+  DiaUmlFormalParameter *self = DIA_UML_FORMAL_PARAMETER (object);
+
+  g_free (self->name);
+  g_free (self->type);
+}
+
+
+static void
+dia_uml_formal_parameter_set_property (GObject      *object,
+                                       guint         property_id,
+                                       const GValue *value,
+                                       GParamSpec   *pspec)
+{
+  DiaUmlFormalParameter *self = DIA_UML_FORMAL_PARAMETER (object);
+
+  switch (property_id) {
+    case PROP_NAME:
+      self->name = g_value_dup_string (value);
+      g_object_notify_by_pspec (object, properties[PROP_NAME]);
+      dia_uml_list_data_changed (DIA_UML_LIST_DATA (self));
+      break;
+    case PROP_TYPE:
+      self->type = g_value_dup_string (value);
+      g_object_notify_by_pspec (object, properties[PROP_TYPE]);
+      dia_uml_list_data_changed (DIA_UML_LIST_DATA (self));
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+  }
+}
+
+static void
+dia_uml_formal_parameter_get_property (GObject    *object,
+                                       guint       property_id,
+                                       GValue     *value,
+                                       GParamSpec *pspec)
+{
+  DiaUmlFormalParameter *self = DIA_UML_FORMAL_PARAMETER (object);
+
+  switch (property_id) {
+    case PROP_NAME:
+      g_value_set_string (value, self->name);
+      break;
+    case PROP_TYPE:
+      g_value_set_string (value, self->type);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+  }
+}
+
+static const gchar *
+format (DiaUmlListData *self)
+{
+  return dia_uml_formal_parameter_format (DIA_UML_FORMAL_PARAMETER (self));
+}
+
+static void
+dia_uml_formal_parameter_list_data_init (DiaUmlListDataInterface *iface)
+{
+  iface->format = format;
+}
+
+static void
+dia_uml_formal_parameter_class_init (DiaUmlFormalParameterClass *klass)
+{
+  GObjectClass   *object_class = G_OBJECT_CLASS (klass);
+
+  object_class->finalize = dia_uml_formal_parameter_finalize;
+  object_class->set_property = dia_uml_formal_parameter_set_property;
+  object_class->get_property = dia_uml_formal_parameter_get_property;
+
+  properties[PROP_NAME] = g_param_spec_string ("name",
+                                               "Name",
+                                               "Parameter name",
+                                               "",
+                                               G_PARAM_READWRITE);
+  properties[PROP_TYPE] = g_param_spec_string ("type",
+                                               "Type",
+                                               "Formal parameter type",
+                                               "",
+                                               G_PARAM_READWRITE);
+
+  g_object_class_install_properties (object_class,
+                                     N_PROPS,
+                                     properties);
+}
+
+static void
+dia_uml_formal_parameter_init (DiaUmlFormalParameter *self)
+{
+  self->name = g_strdup ("");
+  self->type = g_strdup ("");
+}
+
+DiaUmlFormalParameter *
+dia_uml_formal_parameter_new ()
+{
+  return g_object_new (DIA_UML_TYPE_FORMAL_PARAMETER, NULL);
+}
+
+DiaUmlFormalParameter *
+dia_uml_formal_parameter_copy (DiaUmlFormalParameter *param)
+{
+  DiaUmlFormalParameter *newparam;
+
+  newparam = g_object_new (DIA_UML_TYPE_FORMAL_PARAMETER, NULL);
+
+  newparam->name = g_strdup(param->name);
+  newparam->type = g_strdup(param->type);
+
+  return newparam;
+}
+
+void
+uml_formalparameter_write(AttributeNode attr_node, DiaUmlFormalParameter *param,
+                         DiaContext *ctx)
+{
+  DataNode composite;
+
+  composite = data_add_composite(attr_node, "umlformalparameter", ctx);
+
+  data_add_string(composite_add_attribute(composite, "name"),
+                 param->name, ctx);
+  data_add_string(composite_add_attribute(composite, "type"),
+                 param->type, ctx);
+}
+
+gchar *
+dia_uml_formal_parameter_format (DiaUmlFormalParameter *parameter)
+{
+  int len;
+  char *str;
+
+  /* Calculate length: */
+  len = parameter->name ? strlen (parameter->name) : 0;
+  
+  if (strlen (parameter->type) > 0) {
+    len += 1 + strlen (parameter->type);
+  }
+
+  /* Generate string: */
+  str = g_malloc (sizeof (char) * (len + 1));
+  strcpy (str, parameter->name ? parameter->name : "");
+  if (strlen (parameter->type) > 0) {
+    strcat (str, ":");
+    strcat (str, parameter->type);
+  }
+
+  g_assert (strlen (str) == len);
+
+  return str;
+}
+
diff --git a/objects/UML/dia-uml-formal-parameter.h b/objects/UML/dia-uml-formal-parameter.h
new file mode 100644
index 00000000..b9da5ea4
--- /dev/null
+++ b/objects/UML/dia-uml-formal-parameter.h
@@ -0,0 +1,27 @@
+#include <glib-object.h>
+#include "uml.h"
+
+#ifndef UML_FP_H
+#define UML_FP_H
+
+#define DIA_UML_TYPE_FORMAL_PARAMETER (dia_uml_formal_parameter_get_type ())
+G_DECLARE_FINAL_TYPE (DiaUmlFormalParameter, dia_uml_formal_parameter, DIA_UML, FORMAL_PARAMETER, GObject)
+
+/** \brief A list of UMLFormalParameter is contained in DiaUmlOperation
+ * Some would call them template parameters ;)
+ */
+struct _DiaUmlFormalParameter {
+  GObject parent;
+
+  gchar *name; /**< name */
+  gchar *type; /**< Can be NULL => Type parameter */
+};
+
+DiaUmlFormalParameter *dia_uml_formal_parameter_new    ();
+/** calculated the 'formated' representation */
+gchar                 *dia_uml_formal_parameter_format (DiaUmlFormalParameter *self);
+DiaUmlFormalParameter *dia_uml_formal_parameter_copy   (DiaUmlFormalParameter *self);
+
+void uml_formalparameter_write(AttributeNode attr_node, DiaUmlFormalParameter *param, DiaContext *ctx);
+
+#endif
diff --git a/objects/UML/editor/dia-uml-class-editor.c b/objects/UML/editor/dia-uml-class-editor.c
index 2a5e8b6d..ceaf3265 100644
--- a/objects/UML/editor/dia-uml-class-editor.c
+++ b/objects/UML/editor/dia-uml-class-editor.c
@@ -3,6 +3,7 @@
 #include "dia-uml-list-store.h"
 #include "dia-uml-operation-dialog.h"
 #include "dia-uml-attribute-dialog.h"
+#include "dia-uml-formal-parameter-dialog.h"
 #include "dia_dirs.h"
 
 struct _DiaUmlClassEditor {
@@ -11,6 +12,7 @@ struct _DiaUmlClassEditor {
   GtkWidget *attributes;
   GtkWidget *operations;
   GtkWidget *templates;
+  GtkWidget *is_template;
 
   DiaUmlClass *klass;
 };
@@ -37,6 +39,11 @@ build_lists (DiaUmlClassEditor *self)
   gtk_list_box_bind_model (GTK_LIST_BOX (self->operations), store,
                            (GtkListBoxCreateWidgetFunc) dia_uml_list_row_new,
                            store, NULL);
+
+  store = dia_uml_class_get_formal_parameters (self->klass);
+  gtk_list_box_bind_model (GTK_LIST_BOX (self->templates), store,
+                           (GtkListBoxCreateWidgetFunc) dia_uml_list_row_new,
+                           store, NULL);
 }
 
 static void
@@ -127,6 +134,50 @@ edit_attribute (DiaUmlClassEditor *self,
   g_object_unref (attr);
 }
 
+static void
+remove_template (DiaUmlFormalParameterDialog *dlg,
+                 DiaUmlFormalParameter       *param,
+                 DiaUmlClassEditor           *self)
+{
+  dia_uml_class_remove_formal_parameter (self->klass, param);
+}
+
+static void
+add_template (DiaUmlClassEditor *self)
+{
+  DiaUmlFormalParameter *param;
+  GtkWidget *edit;
+  GtkWidget *parent;
+
+  param = dia_uml_formal_parameter_new ();
+  dia_uml_class_insert_formal_parameter (self->klass, param, -1);
+
+  parent = gtk_widget_get_toplevel (GTK_WIDGET (self));
+  edit = dia_uml_formal_parameter_dialog_new (GTK_WINDOW (parent), param);
+  g_signal_connect (edit, "template-deleted", G_CALLBACK (remove_template), self);
+
+  gtk_widget_show (edit);
+}
+
+static void
+edit_template (DiaUmlClassEditor *self,
+               GtkListBoxRow     *row)
+{
+  GtkWidget *dlg;
+  GtkWidget *parent;
+  DiaUmlFormalParameter *param;
+
+  if (!DIA_UML_IS_LIST_ROW (row))
+    return;
+  
+  parent = gtk_widget_get_toplevel (GTK_WIDGET (self));
+  param = DIA_UML_FORMAL_PARAMETER (dia_uml_list_row_get_data (DIA_UML_LIST_ROW (row)));
+  dlg = dia_uml_formal_parameter_dialog_new (GTK_WINDOW (parent), param);
+  g_signal_connect (dlg, "template-deleted", G_CALLBACK (remove_template), self);
+  gtk_widget_show (dlg);
+  g_object_unref (param);
+}
+
 static void
 dia_uml_class_editor_finalize (GObject *object)
 {
@@ -146,6 +197,9 @@ dia_uml_class_editor_set_property (GObject      *object,
   switch (property_id) {
     case UML_CEDIT_PROP_CLASS:
       self->klass = g_value_dup_object (value);
+      g_object_bind_property (G_OBJECT (self->klass), "is-template",
+                              G_OBJECT (self->is_template), "active",
+                              G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
       build_lists (self);
       break;
     default:
@@ -203,13 +257,19 @@ dia_uml_class_editor_class_init (DiaUmlClassEditorClass *klass)
     g_critical ("Failed to load template: %s", err->message);
 
   gtk_widget_class_set_template (widget_class, template);
+
+  gtk_widget_class_bind_template_child (widget_class, DiaUmlClassEditor, is_template);
+
   gtk_widget_class_bind_template_child (widget_class, DiaUmlClassEditor, attributes);
   gtk_widget_class_bind_template_child (widget_class, DiaUmlClassEditor, operations);
   gtk_widget_class_bind_template_child (widget_class, DiaUmlClassEditor, templates);
+
   gtk_widget_class_bind_template_callback (widget_class, add_attribute);
   gtk_widget_class_bind_template_callback (widget_class, edit_attribute);
   gtk_widget_class_bind_template_callback (widget_class, add_operation);
   gtk_widget_class_bind_template_callback (widget_class, edit_operation);
+  gtk_widget_class_bind_template_callback (widget_class, add_template);
+  gtk_widget_class_bind_template_callback (widget_class, edit_template);
 
   g_object_unref (template_file);
 }
diff --git a/objects/UML/editor/dia-uml-formal-parameter-dialog.c 
b/objects/UML/editor/dia-uml-formal-parameter-dialog.c
new file mode 100644
index 00000000..09cd4119
--- /dev/null
+++ b/objects/UML/editor/dia-uml-formal-parameter-dialog.c
@@ -0,0 +1,140 @@
+#include <gtk/gtk.h>
+
+#include "dia-uml-formal-parameter-dialog.h"
+#include "dia_dirs.h"
+#include "uml.h"
+
+G_DEFINE_TYPE (DiaUmlFormalParameterDialog, dia_uml_formal_parameter_dialog, GTK_TYPE_DIALOG)
+
+enum {
+  PROP_FORMAL_PARAMETER = 1,
+  N_PROPS
+};
+static GParamSpec* properties[N_PROPS];
+
+enum {
+  TEMPLATE_DELETED,
+  LAST_SIGNAL
+};
+static guint signals[LAST_SIGNAL] = { 0 };
+
+static void
+dia_uml_formal_parameter_dialog_finalize (GObject *object)
+{
+  DiaUmlFormalParameterDialog *self = DIA_UML_FORMAL_PARAMETER_DIALOG (object);
+
+  g_object_unref (self->parameter);
+}
+
+static void
+dia_uml_formal_parameter_dialog_set_property (GObject      *object,
+                                             guint         property_id,
+                                             const GValue *value,
+                                             GParamSpec   *pspec)
+{
+  DiaUmlFormalParameterDialog *self = DIA_UML_FORMAL_PARAMETER_DIALOG (object);
+
+  switch (property_id) {
+    case PROP_FORMAL_PARAMETER:
+      self->parameter = g_value_dup_object (value);
+      g_object_bind_property (G_OBJECT (self->parameter), "name",
+                              G_OBJECT (self->name), "text",
+                              G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
+      g_object_bind_property (G_OBJECT (self->parameter), "type",
+                              G_OBJECT (self->type), "text",
+                              G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+  }
+}
+
+static void
+dia_uml_formal_parameter_dialog_get_property (GObject    *object,
+                                              guint       property_id,
+                                              GValue     *value,
+                                              GParamSpec *pspec)
+{
+  DiaUmlFormalParameterDialog *self = DIA_UML_FORMAL_PARAMETER_DIALOG (object);
+  switch (property_id) {
+    case PROP_FORMAL_PARAMETER:
+      g_value_set_object (value, self->parameter);
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
+  }
+}
+
+static void
+remove_template (DiaUmlFormalParameterDialog *self)
+{
+  g_signal_emit (G_OBJECT (self),
+                 signals[TEMPLATE_DELETED], 0,
+                 self->parameter);
+  gtk_widget_destroy (GTK_WIDGET (self));
+}
+
+static void
+dia_uml_formal_parameter_dialog_class_init (DiaUmlFormalParameterDialogClass *klass)
+{
+  GFile *template_file;
+  GBytes *template;
+  GError *err = NULL;
+  GObjectClass   *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  object_class->finalize = dia_uml_formal_parameter_dialog_finalize;
+  object_class->set_property = dia_uml_formal_parameter_dialog_set_property;
+  object_class->get_property = dia_uml_formal_parameter_dialog_get_property;
+
+  properties[PROP_FORMAL_PARAMETER] =
+    g_param_spec_object ("formal-parameter",
+                         "Formal parameter",
+                         "Formal parameter this editor controls",
+                         DIA_UML_TYPE_FORMAL_PARAMETER,
+                         G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
+
+  g_object_class_install_properties (object_class,
+                                     N_PROPS,
+                                     properties);
+
+  signals[TEMPLATE_DELETED] = g_signal_new ("template-deleted",
+                                            G_TYPE_FROM_CLASS (klass),
+                                            G_SIGNAL_RUN_FIRST,
+                                            0, NULL, NULL, NULL,
+                                            G_TYPE_NONE, 1,
+                                            DIA_UML_TYPE_FORMAL_PARAMETER);
+
+  /* TODO: Use GResource */
+  template_file = g_file_new_for_path (build_ui_filename ("ui/dia-uml-formal-parameter-dialog.ui"));
+  template = g_file_load_bytes (template_file, NULL, NULL, &err);
+
+  if (err)
+    g_critical ("Failed to load template: %s", err->message);
+
+  gtk_widget_class_set_template (widget_class, template);
+  gtk_widget_class_bind_template_child (widget_class, DiaUmlFormalParameterDialog, name);
+  gtk_widget_class_bind_template_child (widget_class, DiaUmlFormalParameterDialog, type);
+  gtk_widget_class_bind_template_callback (widget_class, remove_template);
+
+  g_object_unref (template_file);
+}
+
+static void
+dia_uml_formal_parameter_dialog_init (DiaUmlFormalParameterDialog *self)
+{
+  gtk_widget_init_template (GTK_WIDGET (self));
+}
+
+GtkWidget *
+dia_uml_formal_parameter_dialog_new (GtkWindow             *parent,
+                                     DiaUmlFormalParameter *param)
+{
+  return g_object_new (DIA_UML_TYPE_FORMAL_PARAMETER_DIALOG,
+                       "formal-parameter", param,
+                       "transient-for", parent,
+                       "modal", TRUE,
+                       NULL);
+}
diff --git a/objects/UML/editor/dia-uml-formal-parameter-dialog.h 
b/objects/UML/editor/dia-uml-formal-parameter-dialog.h
new file mode 100644
index 00000000..88a1c9a6
--- /dev/null
+++ b/objects/UML/editor/dia-uml-formal-parameter-dialog.h
@@ -0,0 +1,18 @@
+#include <gtk/gtk.h>
+#include "uml.h"
+#include "dia-uml-formal-parameter.h"
+
+#define DIA_UML_TYPE_FORMAL_PARAMETER_DIALOG (dia_uml_formal_parameter_dialog_get_type ())
+G_DECLARE_FINAL_TYPE (DiaUmlFormalParameterDialog, dia_uml_formal_parameter_dialog, DIA_UML, 
FORMAL_PARAMETER_DIALOG, GtkDialog)
+
+struct _DiaUmlFormalParameterDialog {
+  GtkDialog parent;
+
+  GtkWidget *name;
+  GtkWidget *type;
+
+  DiaUmlFormalParameter *parameter;
+};
+
+GtkWidget *dia_uml_formal_parameter_dialog_new (GtkWindow             *parent,
+                                                DiaUmlFormalParameter *param);
diff --git a/objects/UML/uml.h b/objects/UML/uml.h
index bb354056..e07f4eaf 100644
--- a/objects/UML/uml.h
+++ b/objects/UML/uml.h
@@ -37,31 +37,12 @@ typedef enum _UMLVisibility {
   UML_IMPLEMENTATION /**< ?What's this? Means implementation decision */
 } UMLVisibility;
 
-typedef struct _UMLFormalParameter UMLFormalParameter;
-
-/** \brief A list of UMLFormalParameter is contained in DiaUmlOperation
- * Some would call them template parameters ;)
- */
-struct _UMLFormalParameter {
-  gchar *name; /**< name */
-  gchar *type; /**< Can be NULL => Type parameter */
-};
-
 /* Characters used to start/end stereotypes: */
 /** start stereotype symbol(like \xab) for local locale */
 #define UML_STEREOTYPE_START _("<<")
 /** end stereotype symbol(like \xbb) for local locale */
 #define UML_STEREOTYPE_END _(">>")
 
-/** calculated the 'formated' representation */
-gchar *uml_get_formalparameter_string(UMLFormalParameter *parameter);
-UMLFormalParameter *uml_formalparameter_copy(UMLFormalParameter *param);
-void uml_formalparameter_destroy(UMLFormalParameter *param);
-
-UMLFormalParameter *uml_formalparameter_new(void);
-
-void uml_formalparameter_write(AttributeNode attr_node, UMLFormalParameter *param, DiaContext *ctx);
-
 void list_box_separators (GtkListBoxRow *row,
                           GtkListBoxRow *before,
                           gpointer       user_data);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]