From: Luca Padovani Date: Wed, 10 Sep 2003 07:55:33 +0000 (+0000) Subject: * completed implementation of View interface X-Git-Tag: v0_0_1~6 X-Git-Url: http://matita.cs.unibo.it/gitweb/?p=helm.git;a=commitdiff_plain;h=08642527c1562675c56914193b294a9766ac4e91 * completed implementation of View interface --- diff --git a/helm/gtkmathview-bonobo/src/aux.cc b/helm/gtkmathview-bonobo/src/aux.cc index 6fe151bc1..6ab6f63d4 100644 --- a/helm/gtkmathview-bonobo/src/aux.cc +++ b/helm/gtkmathview-bonobo/src/aux.cc @@ -270,9 +270,14 @@ findElementWithAttributeNS(const DOM::Element& elem, const std::string& ns_uri, } extern "C" GdomeElement* -find_xref_element(GdomeElement* elem) +find_element_with_id(GdomeElement* elem, GdomeDOMString* ns_uri, GdomeDOMString* name) { - DOM::Element el = findElementWithAttribute(DOM::Element(elem), "xref"); + assert(name != NULL); + DOM::Element el; + if (ns_uri != NULL) + el = findElementWithAttributeNS(DOM::Element(elem), DOM::GdomeString(ns_uri), DOM::GdomeString(name)); + else + el = findElementWithAttribute(DOM::Element(elem), DOM::GdomeString(name)); return gdome_cast_el(el.gdome_object()); } diff --git a/helm/gtkmathview-bonobo/src/aux.h b/helm/gtkmathview-bonobo/src/aux.h index a91bf587a..50abcd409 100644 --- a/helm/gtkmathview-bonobo/src/aux.h +++ b/helm/gtkmathview-bonobo/src/aux.h @@ -8,7 +8,8 @@ extern "C" { #endif - GdomeElement* find_xref_element(GdomeElement*); + void action_toggle(GdomeElement*); + GdomeElement* find_element_with_id(GdomeElement*, GdomeDOMString*, GdomeDOMString*); GdomeDOMString* find_hyperlink(GdomeElement*); GdomeElement* find_element_by_id(GdomeElement*, GdomeDOMString*, GdomeDOMString*, const char*); diff --git a/helm/gtkmathview-bonobo/src/control-data.c b/helm/gtkmathview-bonobo/src/control-data.c index 10f06491c..b96e99338 100644 --- a/helm/gtkmathview-bonobo/src/control-data.c +++ b/helm/gtkmathview-bonobo/src/control-data.c @@ -6,7 +6,6 @@ gtk_math_view_control_data_new(GtkMathView *math_view) { GtkMathViewControlData *cd = g_new(GtkMathViewControlData,1); cd->math_view = math_view; - cd->semantic_selection = FALSE; cd->first_selected = NULL; cd->root_selected = NULL; cd->id_ns_uri = NULL; diff --git a/helm/gtkmathview-bonobo/src/control-data.h b/helm/gtkmathview-bonobo/src/control-data.h index f7a95cfab..089ed688f 100644 --- a/helm/gtkmathview-bonobo/src/control-data.h +++ b/helm/gtkmathview-bonobo/src/control-data.h @@ -8,7 +8,6 @@ typedef struct _GtkMathViewControlData { GtkMathView* math_view; - gboolean semantic_selection; GdomeElement* first_selected; GdomeElement* root_selected; GdomeDOMString* id_ns_uri; diff --git a/helm/gtkmathview-bonobo/src/handlers.c b/helm/gtkmathview-bonobo/src/handlers.c index 485ad0183..cca4f1e9e 100644 --- a/helm/gtkmathview-bonobo/src/handlers.c +++ b/helm/gtkmathview-bonobo/src/handlers.c @@ -69,9 +69,9 @@ select_begin_cb(GtkMathView* math_view, GdomeElement* elem, gint state, control_data->root_selected = NULL; } - if (control_data->semantic_selection) + if (control_data->id_ns_uri != NULL || control_data->id_name != NULL) { - GdomeElement* new_elem = find_xref_element(elem); + GdomeElement* new_elem = find_element_with_id(elem, control_data->id_ns_uri, control_data->id_name); if (new_elem != NULL) { gdome_el_ref(new_elem, &exc); @@ -116,12 +116,12 @@ select_over_cb(GtkMathView* math_view, GdomeElement* elem, gint state, control_data->root_selected = NULL; } - if (control_data->semantic_selection) + if (control_data->id_ns_uri != NULL || control_data->id_name != NULL) { GdomeElement* new_root = find_common_ancestor(control_data->first_selected, elem); if (new_root != NULL) { - control_data->root_selected = find_xref_element(new_root); + control_data->root_selected = find_element_with_id(new_root, control_data->id_ns_uri, control_data->id_name); gdome_el_unref(new_root, &exc); g_assert(exc == 0); } diff --git a/helm/gtkmathview-bonobo/src/view.c b/helm/gtkmathview-bonobo/src/view.c index bc0c903ef..b0385a6fe 100644 --- a/helm/gtkmathview-bonobo/src/view.c +++ b/helm/gtkmathview-bonobo/src/view.c @@ -1,6 +1,7 @@ #include +#define HAVE_GMETADOM #include #include "aux.h" @@ -210,7 +211,7 @@ impl_view_elementBoundingBox(PortableServer_Servant servant, gint w; gint h; gint d; - res = gtk_math_view_get_element_coords(view->control_data->math_view, el, &w, &h, &d) ? CORBA_TRUE : CORBA_FALSE; + 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;