- win->GetEventHandler()->ProcessEvent( event );
- }
-}
-}
-
-#ifdef __WXGTK20__
-// Implementation of wxTE_AUTO_URL for wxGTK2 by Mart Raudsepp,
-
-extern "C" {
-static void
-au_apply_tag_callback(GtkTextBuffer *buffer,
- GtkTextTag *tag,
- GtkTextIter *start,
- GtkTextIter *end,
- gpointer textctrl)
-{
- if(tag == gtk_text_tag_table_lookup(gtk_text_buffer_get_tag_table(buffer), "wxUrl"))
- g_signal_stop_emission_by_name(buffer, "apply_tag");
-}
-}
-
-//-----------------------------------------------------------------------------
-// GtkTextCharPredicates for gtk_text_iter_*_find_char
-//-----------------------------------------------------------------------------
-
-extern "C" {
-static gboolean
-pred_whitespace (gunichar ch, gpointer user_data)
-{
- return g_unichar_isspace(ch);
-}
-}
-
-extern "C" {
-static gboolean
-pred_non_whitespace (gunichar ch, gpointer user_data)
-{
- return !g_unichar_isspace(ch);
-}
-}
-
-extern "C" {
-static gboolean
-pred_nonpunct (gunichar ch, gpointer user_data)
-{
- return !g_unichar_ispunct(ch);
-}
-}
-
-extern "C" {
-static gboolean
-pred_nonpunct_or_slash (gunichar ch, gpointer user_data)
-{
- return !g_unichar_ispunct(ch) || ch == '/';
-}
-}
-
-//-----------------------------------------------------------------------------
-// Check for links between s and e and correct tags as necessary
-//-----------------------------------------------------------------------------
-
-// This function should be made match better while being efficient at one point.
-// Most probably with a row of regular expressions.
-extern "C" {
-static void
-au_check_word( GtkTextIter *s, GtkTextIter *e )
-{
- static const char *URIPrefixes[] =
- {
- "http://",
- "ftp://",
- "www.",
- "ftp.",
- "mailto://",
- "https://",
- "file://",
- "nntp://",
- "news://",
- "telnet://",
- "mms://",
- "gopher://",
- "prospero://",
- "wais://",
- };
-
- GtkTextIter start = *s, end = *e;
- GtkTextBuffer *buffer = gtk_text_iter_get_buffer(s);
-
- // Get our special link tag
- GtkTextTag *tag = gtk_text_tag_table_lookup(gtk_text_buffer_get_tag_table(buffer), "wxUrl");
-
- // Get rid of punctuation from beginning and end.
- // Might want to move this to au_check_range if an improved link checking doesn't
- // use some intelligent punctuation checking itself (beware of undesired iter modifications).
- if(g_unichar_ispunct( gtk_text_iter_get_char( &start ) ) )
- gtk_text_iter_forward_find_char( &start, pred_nonpunct, NULL, e );
-
- gtk_text_iter_backward_find_char( &end, pred_nonpunct_or_slash, NULL, &start );
- gtk_text_iter_forward_char(&end);
-
- gchar* text = gtk_text_iter_get_text( &start, &end );
- size_t len = strlen(text), prefix_len;
- size_t n;
-
- for( n = 0; n < WXSIZEOF(URIPrefixes); ++n )
- {
- prefix_len = strlen(URIPrefixes[n]);
- if((len > prefix_len) && !strncasecmp(text, URIPrefixes[n], prefix_len))
- break;