--- /dev/null
+#include "handlers.h"
+
+void
+set_frame(BonoboControl *control,gpointer data)
+{
+ /*Bonobo_UIContainer remote_ui_container;
+ BonoboUIComponent *ui_component;
+ GtkMathViewControlData *control_data;
+ GtkWidget *scrolled_window;
+ Bonobo_ControlFrame frame;
+ control_data = (GtkMathViewControlData *) data;*/
+}
+
+void
+click_cb(GtkMathView* math_view, GdomeElement* elem, gint state, GtkMathViewControlData* control_data)
+{
+ GdomeException exc;
+ GdomeDOMString* name;
+ GdomeDOMString* ns_uri;
+ //GdomeElement* p;
+
+ g_return_if_fail(math_view != NULL);
+
+ printf("*** click signal: %p %x %p\n", elem, state, control_data);
+
+ if (elem != NULL)
+ {
+ GdomeElement* action;
+ GdomeDOMString* href = find_hyperlink(elem);
+ if (href != NULL)
+ {
+ /* printf("hyperlink %s\n", href->str); */
+ gtk_math_view_load_uri(math_view,href->str);
+ gdome_str_unref(href);
+ }
+ else
+ {
+ action = find_self_or_ancestor(elem, MATHML_NS_URI, "maction");
+ /* printf("action? %p\n", action); */
+ if (action != NULL)
+ {
+ gtk_math_view_freeze(math_view);
+ action_toggle(action);
+ gtk_math_view_thaw(math_view);
+ gdome_el_unref(action, &exc);
+ g_assert(exc == 0);
+ return;
+ }
+ }
+ if (control_data->root_selected != NULL)
+ {
+ gtk_math_view_freeze(math_view);
+ gtk_math_view_unselect(math_view, control_data->root_selected);
+ gtk_math_view_thaw(math_view);
+ gdome_el_unref(control_data->root_selected, &exc);
+ g_assert(exc == 0);
+ control_data->root_selected = NULL;
+ }
+ }
+}
+
+void
+select_begin_cb(GtkMathView* math_view, GdomeElement* elem, gint state,GtkMathViewControlData* control_data)
+{
+ g_return_if_fail(math_view != NULL);
+ g_return_if_fail(GTK_IS_MATH_VIEW(math_view));
+ printf("*** select_begin signal: %p %x\n", elem, state);
+ if (elem != NULL)
+ {
+ GdomeException exc = 0;
+ gtk_math_view_freeze(math_view);
+ if (control_data->root_selected != NULL)
+ {
+ gtk_math_view_unselect(math_view,control_data->root_selected);
+ gdome_el_unref(control_data->root_selected, &exc);
+ g_assert(exc == 0);
+ control_data->root_selected = NULL;
+ }
+
+ if (control_data->semantic_selection)
+ {
+ GdomeElement* new_elem = find_xref_element(elem);
+ if (new_elem != NULL)
+ {
+ gdome_el_ref(new_elem, &exc);
+ g_assert(exc == 0);
+ }
+ control_data->first_selected = control_data->root_selected = new_elem;
+ }
+ else
+ {
+ gdome_el_ref(elem, &exc);
+ g_assert(exc == 0);
+ gdome_el_ref(elem, &exc);
+ g_assert(exc == 0);
+ control_data->first_selected = control_data->root_selected = elem;
+ }
+
+ if (control_data->root_selected != NULL)
+ gtk_math_view_select(math_view, control_data->root_selected);
+
+ gtk_math_view_thaw(math_view);
+ }
+}
+
+void
+select_over_cb(GtkMathView* math_view, GdomeElement* elem, gint state,GtkMathViewControlData* control_data)
+{
+ g_return_if_fail(math_view != NULL);
+ g_return_if_fail(GTK_IS_MATH_VIEW(math_view));
+
+ printf("*** select_over signal: %p %x\n", elem, state);
+
+ if (control_data->first_selected != NULL && elem != NULL)
+ {
+ GdomeException exc = 0;
+
+ gtk_math_view_freeze(math_view);
+
+ if (control_data->root_selected != NULL)
+ {
+ gtk_math_view_unselect(math_view, control_data->root_selected);
+ gdome_el_unref(control_data->root_selected, &exc);
+ g_assert(exc == 0);
+ control_data->root_selected = NULL;
+ }
+
+ if (control_data->semantic_selection)
+ {
+ GdomeElement* new_root = find_common_ancestor(control_data->first_selected, elem);
+ if (new_root != NULL)
+ {
+ control_data->root_selected = find_xref_element(new_root);
+ gdome_el_unref(new_root, &exc);
+ g_assert(exc == 0);
+ }
+ else
+ control_data->root_selected = NULL;
+ }
+ else
+ control_data->root_selected = find_common_ancestor(control_data->first_selected, elem);
+
+ if (control_data->root_selected != NULL)
+ gtk_math_view_select(math_view, control_data->root_selected);
+
+ gtk_math_view_thaw(math_view);
+ }
+}
+
+void
+select_end_cb(GtkMathView* math_view, GdomeElement* elem, gint state,GtkMathViewControlData* control_data)
+{
+ g_return_if_fail(math_view != NULL);
+ g_return_if_fail(GTK_IS_MATH_VIEW(math_view));
+
+ printf("*** select_end signal: %p %x\n", elem, state);
+
+ if (control_data->first_selected != NULL)
+ {
+ GdomeException exc = 0;
+ gdome_el_unref(control_data->first_selected, &exc);
+ g_assert(exc == 0);
+ control_data->first_selected = NULL;
+ }
+}
+
+void
+select_abort_cb(GtkMathView* math_view,GtkMathViewControlData* control_data)
+{
+ GdomeException exc = 0;
+
+ g_return_if_fail(math_view != NULL);
+ g_return_if_fail(GTK_IS_MATH_VIEW(math_view));
+
+ printf("*** select_abort signal\n");
+
+ if (control_data->first_selected != NULL)
+ {
+ gdome_el_unref(control_data->first_selected, &exc);
+ g_assert(exc == 0);
+ control_data->first_selected = NULL;
+ }
+ if (control_data->root_selected != NULL)
+ {
+ gtk_math_view_freeze(math_view);
+ gtk_math_view_unselect(math_view, control_data->root_selected);
+ gtk_math_view_thaw(math_view);
+ gdome_el_unref(control_data->root_selected, &exc);
+ g_assert(exc == 0);
+ control_data->root_selected = NULL;
+ }
+}
+