X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=inline;f=helm%2Fgtkmathview-bonobo%2Fsrc%2Fhandlers.c;h=78dc7ee66a4d51a47ba0212bc90db2c40b27c4bc;hb=970ba0021a992efe25ec374875dc127ff236cc74;hp=485ad0183ad1ecadde2f5119e09b01cca7b92eb9;hpb=1053641161be77d31f67e6f9dd9c7f6d25e0b187;p=helm.git diff --git a/helm/gtkmathview-bonobo/src/handlers.c b/helm/gtkmathview-bonobo/src/handlers.c index 485ad0183..78dc7ee66 100644 --- a/helm/gtkmathview-bonobo/src/handlers.c +++ b/helm/gtkmathview-bonobo/src/handlers.c @@ -1,6 +1,38 @@ +/* This file is part of GtkMathView-Bonobo, a Bonobo wrapper for GtkMathView. + * Copyright (C) 2003 Luca Padovani + * Pouria Masoudi + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * For more information, please visit the project's home page + * http://helm.cs.unibo.it/gtkmathview-bonobo + * or send an email to + */ +#include + +#include "aux.h" #include "handlers.h" +static void +set_clipboard(GdomeDOMString* data) +{ + GtkClipboard* clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY); + gtk_clipboard_set_text(clipboard, data->str, gdome_str_length(data)); +} + void set_frame(BonoboControl *control, gpointer data) { @@ -22,7 +54,8 @@ click_cb(GtkMathView* math_view, GdomeElement* elem, gint state, if (href != NULL) { - gtk_math_view_load_uri(math_view,href->str); + /*gtk_math_view_load_uri(math_view,href->str);*/ + set_clipboard(href); gdome_str_unref(href); return; } @@ -71,7 +104,7 @@ select_begin_cb(GtkMathView* math_view, GdomeElement* elem, gint state, if (control_data->semantic_selection) { - 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); @@ -121,7 +154,7 @@ select_over_cb(GtkMathView* math_view, GdomeElement* elem, gint state, 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); } @@ -151,6 +184,18 @@ select_end_cb(GtkMathView* math_view, GdomeElement* elem, gint state, gdome_el_unref(control_data->first_selected, &exc); g_assert(exc == 0); control_data->first_selected = NULL; + + if (control_data->root_selected != NULL && control_data->semantic_selection) + { + GdomeException exc = 0; + GdomeDOMString* id = gdome_el_getAttributeNS(control_data->root_selected, + control_data->id_ns_uri, + control_data->id_name, &exc); + g_assert(exc == 0); + g_assert(id != NULL); + set_clipboard(id); + gdome_str_unref(id); + } } }