19a20
> #include <stdlib.h>
39c40
< #define NUMBER_OF_STYLE 4 /* h1 h2 h3 p */
---
> #define NUMBER_OF_STYLE 5 /* h1 h2 h3 p link*/
58a60
>       { "link",  "Serif 16", PANGO_WEIGHT_NORMAL,  GTK_JUSTIFY_LEFT,   30, 3,  3 },
69a72
>       { "link",  "Serif 14", PANGO_WEIGHT_NORMAL,  GTK_JUSTIFY_LEFT,   30, 3,  3 },
80a84
>       { "link",  "Serif 12", PANGO_WEIGHT_NORMAL,  GTK_JUSTIFY_LEFT,   30, 3,  3 },
91a96
>       { "link",  "Serif 12", PANGO_WEIGHT_NORMAL,  GTK_JUSTIFY_LEFT,   30, 3,  3 },
103c108,109
<       { "p",  "Serif 18", PANGO_WEIGHT_NORMAL,     GTK_JUSTIFY_LEFT,   30, 3,  3 }
---
>       { "link",  "Serif 18", PANGO_WEIGHT_NORMAL,  GTK_JUSTIFY_LEFT,   30, 3,  3 },
>       { "p",  "Serif 16", PANGO_WEIGHT_NORMAL,     GTK_JUSTIFY_LEFT,   30, 3,  3 }
105a112
> 
157a165,168
> static void      follow_if_link(GtkWidget *text_view, GtkTextIter *iter);
> static gboolean      event_after (GtkWidget *text_view, GdkEvent *ev);
> static gboolean      motion_notify_event (GtkWidget *text_view, GdkEventMotion *event);
> static void      set_cursor_if_appropriate (GtkTextView *text_view, gint x, gint y);
164a176,178
> static gboolean hovering_over_link = FALSE;
> static GdkCursor *hand_cursor = NULL;
> static GdkCursor *regular_cursor = NULL;
326c340,343
< 
---
>   g_signal_connect (view, "event-after",
>             G_CALLBACK (event_after), NULL);
>   g_signal_connect (view, "motion-notify-event",
>             G_CALLBACK (motion_notify_event), NULL); 
354a372
> //  doctype_list[5] = &type_link;
435c453,454
< 				 NULL, NULL };
---
>                  N_("Hyperlink"), "link",
>                  NULL, NULL};
529,540c548,579
< 
<       tag = gtk_text_buffer_create_tag (buffer, doctype->style[i].name,
< 					"weight", doctype->style[i].weight,
< 					"font", doctype->style[i].font,
< 					"justification", doctype->style[i].justification,
< 					"left-margin", doctype->style[i].left_margin,
< 					"pixels-above-lines", doctype->style[i].pixels_above_lines,
< 					"pixels-below-lines", doctype->style[i].pixels_below_lines,
< 					"foreground",color_style_list[c][i+1],
< 					NULL);
<       tag_list[i] = tag;
<       g_object_set_data (G_OBJECT (tag), "style", &doctype->style[i]);
---
>        /* For the link style an underline and blue color is essential */
>        if (i == 3) 
>         {
>           tag = gtk_text_buffer_create_tag (buffer, doctype->style[i].name,
>                 "weight", doctype->style[i].weight,
>                 "font", doctype->style[i].font,
>                 "justification", doctype->style[i].justification,
>                 "left-margin", doctype->style[i].left_margin,
>                 "pixels-above-lines", doctype->style[i].pixels_above_lines,
>                 "pixels-below-lines", doctype->style[i].pixels_below_lines,
>                 "foreground", "blue",
>                 "underline", PANGO_UNDERLINE_SINGLE,
>                 NULL);
>   
>          tag_list[i] = tag;
>          g_object_set_data (G_OBJECT (tag), "link", &doctype->style[i]);  
>         } 
>  
>        else
>         { 
>          tag = gtk_text_buffer_create_tag (buffer, doctype->style[i].name,
> 				"weight", doctype->style[i].weight,
> 				"font", doctype->style[i].font,
> 				"justification", doctype->style[i].justification,
> 				"left-margin", doctype->style[i].left_margin,
> 				"pixels-above-lines", doctype->style[i].pixels_above_lines,
> 				"pixels-below-lines", doctype->style[i].pixels_below_lines,
> 				"foreground",color_style_list[c][i+1],
> 				NULL);
>          tag_list[i] = tag;
>          g_object_set_data (G_OBJECT (tag), "style", &doctype->style[i]);  
>         }
542c581
< 
---
>     
556a596
>   PangoUnderline *underline;
563a604
>   g_object_get (G_OBJECT (tag), "underline", &underline, NULL);
663a705,819
> /* Links can also be activated by clicking*/
> static void
> follow_if_link (GtkWidget *text_view, GtkTextIter *iter)
> {
>   GSList *tags = NULL, *tagp = NULL;
>   tags = gtk_text_iter_get_tags (iter);
>   for (tagp = tags; tagp != NULL; tagp = tagp->next)
>     {
>       GtkTextTag *tag = tagp->data;
>       gint link = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (tag), "link"));
>       
>       if (link != 0)
>        {
>          /* Do something here to get the text from the iter inorder to pass it as
>          an argument to firefox*/
>          char sys_call[] = "firefox";
>          /* It will also be better to get the name of the default browser by calling 
>          certain in build functions*/
>          int ret = system(sys_call);
>          if (WIFSIGNALED(ret) && (WTERMSIG(ret) == SIGINT || WTERMSIG(ret) == SIGQUIT))
>             break;
>       }  
>     }  
>   if(tags)
>     g_slist_free (tags);  
> }
> 
> /* we shouldn't follow a link if the user has selected something */
> static gboolean
> event_after (GtkWidget *text_view, GdkEvent *ev)
> {
>   GtkTextIter start, end, iter;
>   GtkTextBuffer *buffer;
>   GdkEventButton *event;
>   gint x, y;
>     
>   if (ev->type != GDK_BUTTON_RELEASE)
>     return FALSE;
>      
>   event = (GdkEventButton *)ev;
>   
>   if (event->button != 1)
>     return FALSE;
>      
>   buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
>     
>   gtk_text_buffer_get_selection_bounds (buffer, &start, &end);
>   if (gtk_text_iter_get_offset (&start) != gtk_text_iter_get_offset (&end))
>     return FALSE;
>     
>   gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view),
>   GTK_TEXT_WINDOW_WIDGET, event->x, event->y, &x, &y);
>      
>   gtk_text_view_get_iter_at_location (GTK_TEXT_VIEW (text_view), &iter, x, y);
>   follow_if_link (text_view, &iter);
>   return FALSE;
> }
> 
> /* Update the cursor image if the pointer moved */
> static gboolean
> motion_notify_event (GtkWidget *text_view, GdkEventMotion *event)
> {
>   gint x, y;
>      
>   gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view),
>   GTK_TEXT_WINDOW_WIDGET, event->x, event->y, &x, &y);
>      
>   set_cursor_if_appropriate (GTK_TEXT_VIEW (text_view), x, y);
>      
>   gdk_window_get_pointer (text_view->window, NULL, NULL, NULL);
>   return FALSE;
> }
> 
> /* Looks at all tags covering the position (x, y) in the text view,
>  * and if one of them is a link, change the cursor to the "hands" cursor
>  * typically used by web browsers.
> */
> static void
> set_cursor_if_appropriate (GtkTextView *text_view, gint x, gint y)
> {
>   GSList *tags = NULL, *tagp = NULL;
>   GtkTextIter iter;
>   gboolean hovering = FALSE;
>      
>   gtk_text_view_get_iter_at_location (text_view, &iter, x, y);
>      
>   tags = gtk_text_iter_get_tags (&iter);
>   for (tagp = tags; tagp != NULL; tagp = tagp->next)
>    {
>      GtkTextTag *tag = tagp->data;
>      gint link = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (tag), "link"));
>      
>      if (link != 0)
>      {
>        hovering = TRUE;
>        break;
>      }
>    }
>      
>    if (hovering != hovering_over_link)
>     {
>       hovering_over_link = hovering;
>      
>       if (hovering_over_link)
>       {
>         gdk_window_set_cursor (gtk_text_view_get_window (text_view, GTK_TEXT_WINDOW_TEXT), hand_cursor);
>       }
>       else
>         gdk_window_set_cursor (gtk_text_view_get_window (text_view, GTK_TEXT_WINDOW_TEXT), regular_cursor);
>     }
>      
>    if (tags)
>      g_slist_free (tags);
> }
> 
742,744c898,903
<     g_object_set(tag_list[j],
< 		 "foreground",color_style_list[i][j+1],
< 		 NULL);
---
>    {
>         if(j == 3) /*link style maintains the blue color */
>             g_object_set(tag_list[j], "foreground", "blue", NULL);
>         else
>             g_object_set(tag_list[j], "foreground", color_style_list[i][j+1], NULL);
>    }
746d904
< 
904c1062
<     int font_size[NUMBER_OF_STYLE] = { 28, 22, 16, 12 };
---
>     int font_size[NUMBER_OF_STYLE] = { 28, 22, 16, 14, 12 };
1103a1262
>        g_ascii_strcasecmp((char *)node->name, "link") == 0 ||
