+ return gtk_math_view_load_uri(view->control_data->math_view, uri);
+}
+
+static void
+impl_view_unload(PortableServer_Servant servant,
+ CORBA_Environment *ev)
+{
+ View* view = VIEW (bonobo_object (servant));
+ gtk_math_view_unload(view->control_data->math_view);
+}
+
+static void
+impl_view_setIdAttribute (PortableServer_Servant servant,
+ const CORBA_char *ns,
+ const CORBA_char *name,
+ CORBA_Environment *ev)
+{
+ View* view = VIEW (bonobo_object (servant));
+ gtk_math_view_control_data_set_id_attribute(view->control_data, ns, name);
+}
+
+static void
+impl_view_getIdAttribute (PortableServer_Servant servant,
+ CORBA_string *ns,
+ CORBA_string *name,
+ CORBA_Environment *ev)
+{
+ View* view = VIEW (bonobo_object (servant));
+ if (view->control_data->id_ns_uri != NULL)
+ *ns = CORBA_string_dup(view->control_data->id_ns_uri->str);
+ else
+ *ns = NULL;
+
+ if (view->control_data->id_name != NULL)
+ *name = CORBA_string_dup(view->control_data->id_name);
+ else
+ *name = NULL;
+}
+
+static void
+impl_view_select(PortableServer_Servant servant,
+ const CORBA_char *id,
+ CORBA_Environment *ev)
+{
+ View* view = VIEW (bonobo_object (servant));
+ GdomeElement* root = gtk_math_view_get_root_element(view->control_data->math_view);
+ if (root != NULL)
+ {
+ GdomeException exc = 0;
+ GdomeElement* el = find_element_by_id(root,
+ view->control_data->id_ns_uri,
+ view->control_data->id_name,
+ id);
+ if (el != NULL)
+ {
+ gtk_math_view_select(view->control_data->math_view, el);
+ gdome_el_unref(el, &exc);
+ g_assert(exc == 0);
+ }
+ gdome_el_unref(root, &exc);
+ g_assert(exc == 0);
+ }
+}
+
+static void
+impl_view_unselect(PortableServer_Servant servant,
+ const CORBA_char *id,
+ CORBA_Environment *ev)
+{
+ View* view = VIEW (bonobo_object (servant));
+ GdomeElement* root = gtk_math_view_get_root_element(view->control_data->math_view);
+ if (root != NULL)
+ {
+ GdomeException exc = 0;
+ GdomeElement* el = find_element_by_id(root,
+ view->control_data->id_ns_uri,
+ view->control_data->id_name,
+ id);
+ if (el != NULL)
+ {
+ gtk_math_view_unselect(view->control_data->math_view, el);
+ gdome_el_unref(el, &exc);
+ g_assert(exc == 0);
+ }
+ gdome_el_unref(root, &exc);
+ g_assert(exc == 0);
+ }
+}
+
+static CORBA_boolean
+impl_view_isSelected(PortableServer_Servant servant,
+ const CORBA_char *id,
+ CORBA_Environment *ev)
+{
+ View* view = VIEW (bonobo_object (servant));
+ GdomeElement* root = gtk_math_view_get_root_element(view->control_data->math_view);
+ CORBA_boolean res = CORBA_FALSE;
+ if (root != NULL)
+ {
+ GdomeException exc = 0;
+ GdomeElement* el = find_element_by_id(root,
+ view->control_data->id_ns_uri,
+ view->control_data->id_name,
+ id);
+ if (el != NULL)
+ {
+ res = gtk_math_view_is_selected(view->control_data->math_view, el) ? CORBA_TRUE : CORBA_FALSE;
+ gdome_el_unref(el, &exc);
+ g_assert(exc == 0);
+ }
+ gdome_el_unref(root, &exc);
+ g_assert(exc == 0);
+ }
+ return res;
+}
+
+static CORBA_boolean
+impl_view_elementCoords(PortableServer_Servant servant,
+ const CORBA_char *id,
+ CORBA_short *x, CORBA_short *y,
+ CORBA_Environment *ev)
+{
+ View* view = VIEW (bonobo_object (servant));
+ GdomeElement* root = gtk_math_view_get_root_element(view->control_data->math_view);
+ CORBA_boolean res = CORBA_FALSE;
+ if (root != NULL)
+ {
+ GdomeException exc = 0;
+ GdomeElement* el = find_element_by_id(root,
+ view->control_data->id_ns_uri,
+ view->control_data->id_name,
+ id);
+ if (el != NULL)
+ {
+ gint xx;
+ gint yy;
+ res = gtk_math_view_get_element_coords(view->control_data->math_view, el, &xx, &yy) ? CORBA_TRUE : CORBA_FALSE;
+ gdome_el_unref(el, &exc);
+ g_assert(exc == 0);
+ *x = xx;
+ *y = yy;
+ }
+ gdome_el_unref(root, &exc);
+ g_assert(exc == 0);
+ }
+ return res;
+}
+
+static CORBA_boolean
+impl_view_elementBoundingBox(PortableServer_Servant servant,
+ const CORBA_char *id,
+ CORBA_short *width, CORBA_short *height, CORBA_short *depth,
+ CORBA_Environment *ev)
+{
+ View* view = VIEW (bonobo_object (servant));
+ GdomeElement* root = gtk_math_view_get_root_element(view->control_data->math_view);
+ CORBA_boolean res = CORBA_FALSE;
+ if (root != NULL)
+ {
+ GdomeException exc = 0;
+ GdomeElement* el = find_element_by_id(root,
+ view->control_data->id_ns_uri,
+ view->control_data->id_name,
+ id);
+ if (el != NULL)
+ {
+ gint w;
+ gint h;
+ gint d;
+ res = gtk_math_view_get_element_bounding_box(view->control_data->math_view, el, &w, &h, &d) ? CORBA_TRUE : CORBA_FALSE;
+ gdome_el_unref(el, &exc);
+ g_assert(exc == 0);
+ *width = w;
+ *height = h;
+ *depth = d;
+ }
+ gdome_el_unref(root, &exc);
+ g_assert(exc == 0);
+ }
+ return res;
+}
+
+static void
+impl_view_getSize(PortableServer_Servant servant,
+ CORBA_short *width, CORBA_short *height,
+ CORBA_Environment *ev)
+{
+ View* view = VIEW (bonobo_object (servant));
+ *width = gtk_math_view_get_width(view->control_data->math_view);
+ *height = gtk_math_view_get_height(view->control_data->math_view);
+}
+
+static void
+impl_view_getTop(PortableServer_Servant servant,
+ CORBA_short *x, CORBA_short *y,
+ CORBA_Environment *ev)
+{
+ View* view = VIEW (bonobo_object (servant));
+ gint xx;
+ gint yy;
+ gtk_math_view_get_top(view->control_data->math_view, &xx, &yy);
+ *x = xx;
+ *y = yy;
+}
+
+static void
+impl_view_setTop (PortableServer_Servant servant,
+ CORBA_short x, CORBA_short y,
+ CORBA_Environment *ev)
+{
+ View* view = VIEW (bonobo_object (servant));
+ gtk_math_view_set_top(view->control_data->math_view, x, y);
+}
+
+static void
+impl_view_setDefaultFontSize(PortableServer_Servant servant,
+ CORBA_short size,
+ CORBA_Environment *ev)
+{
+ View* view = VIEW (bonobo_object (servant));
+ gtk_math_view_set_font_size(view->control_data->math_view, size);
+}
+
+static short
+impl_view_getDefaultFontSize(PortableServer_Servant servant,
+ CORBA_Environment *ev)
+{
+ View* view = VIEW (bonobo_object (servant));
+ return gtk_math_view_get_font_size(view->control_data->math_view);
+}
+
+static void
+impl_view_setVerbosity(PortableServer_Servant servant,
+ const CORBA_short level,
+ CORBA_Environment *ev)
+{
+ View* view = VIEW (bonobo_object (servant));
+ gtk_math_view_set_log_verbosity(view->control_data->math_view, level);
+}
+
+static short
+impl_view_getVerbosity(PortableServer_Servant servant,
+ CORBA_Environment *ev)
+{
+ View* view = VIEW (bonobo_object (servant));
+ return gtk_math_view_get_log_verbosity(view->control_data->math_view);