Yattm - unified GTK instant-messaging client logo
   [Generated for version 0.2-17 - Mon Jan 6 19:01:23 GMT+1 2003]

Home - Main Page - Data Structures - File List - Data Fields - Globals

gtk_eb_html.h File Reference

#include <gtk/gtk.h>
#include "extgtktext.h"

Include dependency graph for gtk_eb_html.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

void gtk_eb_html_init (ExtGtkText *widget)
void gtk_eb_html_add (ExtGtkText *widget, char *text, int ignore_bgcolor, int ignore_fgcolor, int ignore_font)


Function Documentation

void gtk_eb_html_add ExtGtkText   widget,
char *    text,
int    ignore_bgcolor,
int    ignore_fgcolor,
int    ignore_font
 

Definition at line 463 of file gtk_eb_html.c.

References _adjust_colors(), _extract_parameter(), _font_stack_init(), _font_stack_pop(), _font_stack_push(), _getcolor(), _getfont(), _unescape_string(), _font_stack::back, DBG_HTML, eb_debug, ext_gtk_text_insert(), ext_gtk_text_insert_data_underlined(), ext_gtk_text_insert_divider(), ext_gtk_text_insert_pixmap(), _font_stack::font_name, _font_stack::font_ptsize, _font_stack::font_size, _font_stack::fore, handle_click(), smiley_struct::name, and smiley_struct::pixmap.

Referenced by eb_chat_room_show_3rdperson(), eb_chat_room_show_message(), eb_chat_window_display_error(), eb_chat_window_display_remote_message(), eb_chat_window_do_timestamp(), eb_info_window_add_info(), eb_restore_last_conv(), send_file(), send_message(), and set_html_text().

00465 {
00466     gchar ** tokens;
00467     int i = 0;
00468 #ifndef HAVE_LIBXFT
00469     GdkFont * font = NULL;
00470 #else
00471     XftFont * font = NULL;
00472 #endif
00473     /*
00474      * these atributes don't go into the font stact because we should not
00475      * allow nesting of these attributes, but allow then to be changed
00476      * independently of the font stact
00477      */
00478 
00479     int font_bold = 0;
00480     int font_italic = 0;
00481     char * url = NULL;
00482 
00483     int first = 0;
00484 
00485 
00486 
00487     /*
00488      * the ignore variable is used so we can ignore any header that may
00489      * be on the html
00490      */
00491 
00492     int ignore = 0;
00493 
00494     font_stack * fs = _font_stack_init();
00495 
00496     fs->fore =  g_new0(GdkColor, 1);
00497     memcpy(fs->fore, &GTK_WIDGET (widget)->style->fg[0],
00498             sizeof(GdkColor));
00499 
00500 //#ifdef HAVE_LIBXFT
00501     font = _getfont(fs->font_name, font_bold, font_italic,
00502         fs->font_size, fs->font_ptsize);
00503 //#endif
00504 
00505 
00506     /*
00507      * Since the first thing in a split list may or may not be starting with a
00508      * < we need to keep track of that manually
00509      */
00510 
00511     if(*text != '<')
00512     {
00513         first = 1;
00514     }
00515 
00516     /*
00517      * a nice heuristic to decide if we should be proper with
00518      * our html and ignore the \n
00519      * or deal with our not-so-fortunate human typers
00520      * that don't do proper html
00521      */
00522 
00523     if(strstr(text, "<br>") || strstr(text, "<BR>"))
00524     {
00525         char * c = text;
00526         while((c = strstr(c, "\n")) != 0)
00527         {
00528             *c = ' ';
00529         }
00530         c = text;
00531         while((c = strstr(c, "\r")) != 0)
00532         {
00533             *c = ' ';
00534         }
00535     }
00536     else if(strstr(text, "\r"))
00537     {   char * c = text;
00538         if(strstr(text, "\n"))
00539         {   /* drop the useless \r's */
00540             while((c = strstr(c,"\r")) != 0)
00541             {
00542                 *c = ' ';
00543             }
00544         }
00545         else
00546         {   /* convert the \r to readable \n */
00547             while((c = strstr(c,"\r")) != 0)
00548             {
00549                 *c = '\n';
00550             }
00551         }
00552     }
00553 
00554     tokens = g_strsplit(text, "<", 0);
00555 
00556 
00557     /*
00558      * if we started with a < then the first thing in the list
00559      * will be a 0 lenght string, so we want to skip that
00560      */
00561 
00562     for( i = first?0:1; tokens[i]; i++ )
00563     {
00564 
00565 
00566         eb_debug(DBG_HTML, "Part %d: %s\n", i, tokens[i]);
00567 
00568         if(!first && strstr(tokens[i], ">"))
00569         {
00570             char * copy = strdup(tokens[i]);
00571 #ifdef __MINGW32__
00572             gchar ** tags = g_strsplit(tokens[i], ">", 2);
00573 #else
00574             gchar ** tags = g_strsplit(tokens[i], ">", 1);
00575 #endif
00576             /*
00577              * Okay, we now know that tags[0] is an html tag because
00578              * there was a < before it and a > after it
00579              */
00580 
00581             /*
00582              * first let's clean it up
00583              */
00584 
00585             eb_debug(DBG_HTML, "\t Part a: %s\n", tags[0]);
00586             eb_debug(DBG_HTML, "\t Part b: %s\n", tags[1]);
00587             g_strstrip(tags[0]);
00588             g_strdown(tags[0]);
00589 
00590             if(!strncmp(tags[0], "font", strlen("font")))
00591             {
00592                 char * data = tags[0] + strlen("font");
00593                 char * parm;
00594 
00595                 fs = _font_stack_push(fs);
00596 
00597                 if((parm = strstr(data, "face=")) != NULL)
00598                 {
00599                     parm += strlen("face=");
00600                     _extract_parameter(parm, fs->font_name, 255);
00601                 }
00602 
00603                 if((parm = strstr(data, "ptsize=")) != NULL)
00604                 {
00605                     char size[25];
00606                     parm += strlen("ptsize=");
00607                     _extract_parameter(parm, size, 25);
00608                     fs->font_size = -1;
00609                     fs->font_ptsize = atoi(size);
00610                     eb_debug(DBG_HTML, "got a ptsize of %d\n", fs->font_ptsize);
00611                 }
00612                 else if((parm = strstr(data, "absz=")) != NULL)
00613                 {
00614                     char size[25];
00615                     parm += strlen("absz=");
00616                     _extract_parameter(parm, size, 25);
00617                     fs->font_size = -1;
00618                     fs->font_ptsize = atoi(size);
00619                     eb_debug(DBG_HTML, "got a ptsize of %d\n", fs->font_ptsize);
00620                 }
00621                 else if((parm = strstr(data, "size=")) != NULL)
00622                 {
00623                     char size[25];
00624                     parm += strlen("size=");
00625                     _extract_parameter(parm, size, 25);
00626 
00627                     if(*size == '+')
00628                     {
00629                         fs->font_size += atoi(size+1);
00630                     }
00631                     else if(*size == '-')
00632                     {
00633                         fs->font_size -= atoi(size+1);
00634                     }
00635                     else
00636                     {
00637                         fs->font_size = atoi(size);
00638                     }
00639                 }
00640                 if((parm = strstr(data, "color=")) != NULL)
00641                 {
00642                     char color[255];
00643                     parm += strlen("color=");
00644                     _extract_parameter(parm, color, 255);
00645                     if(fs->fore)
00646                     {
00647                         g_free(fs->fore);
00648                         fs->fore = NULL;
00649                     }
00650                     if(!ignore_fgcolor)
00651                     {
00652                         //fprintf(stderr, "color: %s\n", color);
00653 
00654 
00655                         if(!fs->back)
00656                         {
00657                             GdkColor * bg = &GTK_WIDGET(widget)->style->base[GTK_STATE_NORMAL];
00658                             int r, g, b;
00659                             char color2[20];
00660                             int fg_r, fg_g, fg_b;
00661                             if(!sscanf(color, "#%02x%02x%02x", &fg_r, &fg_g, &fg_b))
00662                             {
00663                                 GdkColor *tmpColor = _getcolor(gdk_window_get_colormap(GTK_WIDGET(widget)->window), color);
00664                                 fg_r = (tmpColor->red >> 8)&0xFF;
00665                                 fg_g = (tmpColor->green >> 8)&0xFF;
00666                                 fg_b = (tmpColor->blue >> 8)&0xFF;
00667                                 g_free(tmpColor);
00668 
00669                             }
00670 
00671 
00672                             r = (bg->red >> 8)&0xFF;
00673                             g = (bg->green >> 8)&0xFF;
00674                             b = (bg->blue >> 8)&0xFF;
00675 
00676                             _adjust_colors(&fg_r, &fg_g, &fg_b,
00677                                     r, g, b);
00678 
00679                             sprintf(color2, "#%02x%02x%02x",fg_r, fg_g,fg_b);
00680                             //fprintf(stderr, "Result: %s\n", color2);
00681                             fs->fore = _getcolor(gdk_window_get_colormap(GTK_WIDGET(widget)->window), color2);
00682                         }
00683                         else
00684                         {
00685                             fs->fore = _getcolor(gdk_window_get_colormap(GTK_WIDGET(widget)->window), color);
00686                         }
00687                     }
00688                     else
00689                     {
00690                         if(!fs->back && !ignore_bgcolor)
00691                         {
00692                             fs->fore =  g_new0(GdkColor, 1);
00693                             memcpy(fs->fore, &GTK_WIDGET (widget)->style->fg[0],
00694                                     sizeof(GdkColor));
00695                         }
00696                         else
00697                         {
00698                             fs->fore = _getcolor(gdk_window_get_colormap(GTK_WIDGET(widget)->window), "black");
00699                         }
00700                     }
00701 
00702                 }
00703 
00704                 if(!ignore_font)
00705                 {
00706                     font = _getfont(fs->font_name, font_bold, font_italic,
00707                         fs->font_size, fs->font_ptsize);
00708                 }
00709                 else
00710                 {
00711 #ifndef HAVE_LIBXFT
00712                     font = NULL;
00713 #endif
00714                 }
00715             }
00716             else if(!strncmp(tags[0], "img ", strlen("img ")))
00717             {
00718                 char * parm;
00719                 if((parm = strstr(copy, "src=")) != NULL
00720                     ||(parm = strstr(copy, "SRC=")) != NULL)
00721                 {
00722                     char tmp_url[1024];
00723                     GdkPixmap *icon;
00724                     GdkBitmap *mask;
00725                     parm += strlen("src=");
00726 
00727                     _extract_parameter(parm,
00728                             tmp_url, 1024);
00729 
00730                     if(!strcmp(tmp_url, "aol_icon.gif"))
00731                     {
00732                         icon = gdk_pixmap_create_from_xpm_d(GTK_WIDGET(widget)->window, &mask, NULL, aol_icon_xpm);
00733                         ext_gtk_text_insert_pixmap(widget, font, fs->fore, fs->back,
00734                         icon, mask, "aol_icon", 0);
00735 
00736                     }
00737                     else if(!strcmp(tmp_url, "free_icon.gif"))
00738                     {
00739                         icon = gdk_pixmap_create_from_xpm_d(GTK_WIDGET(widget)->window, &mask, NULL, free_icon_xpm);
00740                         ext_gtk_text_insert_pixmap(widget, font, fs->fore, fs->back,
00741                         icon, mask, "free_icon", 0);
00742 
00743                     }
00744                     else if(!strcmp(tmp_url, "dt_icon.gif"))
00745                     {
00746                         icon = gdk_pixmap_create_from_xpm_d(GTK_WIDGET(widget)->window, &mask, NULL, dt_icon_xpm);
00747                         ext_gtk_text_insert_pixmap(widget, font, fs->fore, fs->back,
00748                         icon, mask, "dt_icon", 0);
00749 
00750                     }
00751                     else if(!strcmp(tmp_url, "admin_icon.gif"))
00752                     {
00753                         icon = gdk_pixmap_create_from_xpm_d(GTK_WIDGET(widget)->window, &mask, NULL, admin_icon_xpm);
00754                         ext_gtk_text_insert_pixmap(widget, font, fs->fore, fs->back,
00755                         icon, mask, "admin_icon", 0);
00756 
00757                     }
00758                 }
00759             }
00760             else if(!strncmp(tags[0], "smiley ", strlen("smiley ")))
00761             {
00762                 char * parm;
00763                 if((parm = strstr(copy, "name=")) != NULL
00764                     ||(parm = strstr(copy, "NAME=")) != NULL)
00765                 {
00766                     char tmp_sname[64];
00767                     GdkPixmap *icon;
00768                     GdkBitmap *mask;
00769                                         GList * slist=smileys;
00770                                         smiley * smile;
00771 
00772                     parm += strlen("name=");
00773                                         // here
00774                                         _extract_parameter(parm, tmp_sname, 64);
00775 
00776                                         while(slist!=NULL)
00777                                         {
00778                                                 smile=(smiley *)slist->data;
00779                                                 if(!strcmp(smile->name, tmp_sname))
00780                                                 {
00781                           icon = gdk_pixmap_create_from_xpm_d(GTK_WIDGET(widget)->window, &mask, NULL, smile->pixmap);
00782                           ext_gtk_text_insert_pixmap(widget, font, fs->fore, fs->back,
00783                           icon, mask, "smiley", strlen("smiley"));
00784                                                   break;
00785                                                 }
00786                                                 slist=slist->next;
00787                                         }
00788                                         if(slist==NULL)
00789                                         {
00790                         if((parm = strstr(copy, "alt=")) != NULL
00791                                 || (parm = strstr(copy, "ALT=")) != NULL) 
00792                         {
00793                             parm += strlen("alt=");
00794                             _extract_parameter(parm, tmp_sname, 64);
00795                             ext_gtk_text_insert(widget, font, fs->fore, fs->back,
00796                                     tmp_sname, strlen(tmp_sname));
00797                         }
00798                         else
00799                         {
00800                             icon =gdk_pixmap_create_from_xpm_d(GTK_WIDGET(widget)->window, &mask, NULL, no_such_smiley_xpm);
00801                             ext_gtk_text_insert_pixmap(widget, font, fs->fore, fs->back,
00802                             icon, mask, "smiley", strlen("smiley"));
00803                         }
00804                                         }
00805                                 }
00806                         }
00807             else if(!strncmp(tags[0], "a ", strlen("a ")))
00808             {
00809                 /* UNUSED char * data = tags[0] + strlen("a "); */
00810                 char * parm;
00811 
00812                 fs = _font_stack_push(fs);
00813 
00814                 if((parm = strstr(copy, "href=")) != NULL
00815                     ||(parm = strstr(copy, "HREF=")) != NULL
00816 )
00817                 {
00818                     char tmp_url[1024];
00819                     int r=0, g=0, b=0xFF;
00820                     GdkColor * bg = &GTK_WIDGET(widget)->style->base[GTK_STATE_NORMAL];
00821                     char color[20];
00822                     int bg_r, bg_g, bg_b;
00823 
00824 
00825                     bg_r = (bg->red >> 8)&0xFF;
00826                     bg_g = (bg->green >> 8)&0xFF;
00827                     bg_b = (bg->blue >> 8)&0xFF;
00828 
00829                     _adjust_colors(&r, &g, &b, bg_r, bg_g, bg_b);
00830                     sprintf(color, "#%02x%02x%02x", r, g, b);
00831                     fs->fore = _getcolor(gdk_window_get_colormap(GTK_WIDGET(widget)->window), color);
00832 
00833                     parm += strlen("href=");
00834 
00835                     _extract_parameter(parm, 
00836                             tmp_url, 1024);
00837                     if(url)
00838                     {
00839                         g_free(url);
00840                     }
00841                     url = strdup(tmp_url);
00842 
00843 
00844                 }
00845             }
00846             else if(!strcmp(tags[0], "/a"))
00847             {
00848                 fs = _font_stack_pop(fs);
00849                 if(url)
00850                 {
00851                     g_free(url);
00852                 }
00853                 url = NULL;
00854 
00855                 if(!fs)
00856                 {
00857                     fs = _font_stack_init();
00858                     fs->fore =  g_new0(GdkColor, 1);
00859                     memcpy(fs->fore, &GTK_WIDGET (widget)->style->fg[0],
00860                             sizeof(GdkColor));
00861                 }
00862                 if(!ignore_font)
00863                 {
00864                     font = _getfont(fs->font_name, font_bold, font_italic, 
00865                         fs->font_size, fs->font_ptsize);
00866                 }
00867                 else
00868                 {
00869 #ifndef HAVE_LIBXFT
00870                     font = NULL;
00871 #endif
00872                 }
00873             }
00874             else if(!strcmp(tags[0], "b"))
00875             {
00876                 font_bold = 1;
00877                 if(!ignore_font)
00878                 {
00879                     font = _getfont(fs->font_name, font_bold, font_italic, 
00880                         fs->font_size, fs->font_ptsize);
00881                 }
00882                 else
00883                 {
00884 #ifndef HAVE_LIBXFT
00885                     font = NULL;
00886 #endif
00887                 }
00888                 
00889             }
00890             else if(!strcmp(tags[0], "u"))
00891             {
00892                 eb_debug(DBG_HTML, "Underline tag found\n");
00893                 if(!url)
00894                 {
00895                     url = strdup("");
00896                 }
00897                 else
00898                 {
00899                     eb_debug(DBG_HTML, "Underline tag ignored\n");
00900                 }
00901             }
00902             else if(!strcmp(tags[0], "/u"))
00903             {
00904                 /*
00905                  * the widget stores a copy, so we must free
00906                  * the original
00907                  */
00908                 if(url)
00909                 {
00910                     g_free(url);
00911                     url = NULL;
00912                 }
00913             }
00914             else if(!strcmp(tags[0], "/b"))
00915             {
00916                 font_bold = 0;
00917                 if(!ignore_font)
00918                 {
00919                     font = _getfont(fs->font_name, font_bold, font_italic, 
00920                         fs->font_size, fs->font_ptsize);
00921                 }
00922                 else
00923                 {
00924 #ifndef HAVE_LIBXFT
00925                     font = NULL;
00926 #endif
00927                 }
00928             }
00929             else if(!strcmp(tags[0], "i"))
00930             {
00931                 font_italic = 1;
00932                 if(!ignore_font)
00933                 {
00934                     font = _getfont(fs->font_name, font_bold, font_italic, 
00935                         fs->font_size, fs->font_ptsize);
00936                 }
00937                 else
00938                 {
00939 #ifndef HAVE_LIBXFT
00940                     font = NULL;
00941 #endif
00942                 }
00943             }
00944             else if(!strcmp(tags[0], "/i"))
00945             {
00946                 font_italic = 0;
00947                 if(!ignore_font)
00948                 {
00949                     font = _getfont(fs->font_name, font_bold, font_italic, 
00950                         fs->font_size, fs->font_ptsize);
00951                 }
00952                 else
00953                 {
00954 #ifndef HAVE_LIBXFT
00955                     font = NULL;
00956 #endif
00957                 }
00958             }
00959             else if(!strcmp(tags[0], "br"))
00960             {
00961                 if(url)
00962                 {
00963                     ext_gtk_text_insert_data_underlined(widget, font, fs->fore, fs->back, 
00964                         url, strlen(url)+1, handle_click, "\n", strlen("\n"));
00965                 }
00966                 else
00967                 {
00968                     ext_gtk_text_insert(widget, font, fs->fore, fs->back, 
00969                         "\n", strlen("\n"));
00970                 }
00971             }
00972             else if(!strcmp(tags[0], "html") 
00973                     | !strcmp(tags[0], "/html")
00974                     | !strcmp(tags[0], "/p")
00975                     | !strcmp(tags[0], "p")
00976                     | !strcmp(tags[0], "title")
00977                     | !strcmp(tags[0], "/title")
00978                     | !strcmp(tags[0], "pre")
00979                     | !strcmp(tags[0], "/pre")
00980                     | !strncmp(tags[0], "img", strlen("img")))
00981             {
00982             }
00983             else if(!strcmp(tags[0], "hr") 
00984                     || !strncmp(tags[0], "hr ", strlen("hr ")))
00985             {
00986                 ext_gtk_text_insert(widget, font, fs->fore, fs->back, 
00987                         "\n", strlen("\n"));
00988                 ext_gtk_text_insert_divider(widget, font, fs->fore, fs->back, 
00989                         " \n", strlen(" \n"));
00990 
00991 
00992             }
00993             else if(!strcmp(tags[0], "/font")
00994                     || !strcmp(tags[0], "/body"))
00995             {
00996                 fs = _font_stack_pop(fs);
00997                 
00998             
00999     /*
01000      * we don't want to pop off the very first element in the stack
01001      * because that is the defaults, if we are in a positon of trying
01002      * that means the user tried doing one too many </font>'s
01003      * heh
01004      */
01005                 
01006                 if(!fs)
01007                 {
01008                     fs = _font_stack_init();
01009                     fs->fore =  g_new0(GdkColor, 1);
01010                     memcpy(fs->fore, &GTK_WIDGET (widget)->style->fg[0],
01011                             sizeof(GdkColor));
01012                 }
01013                 if(!ignore_font)
01014                 {
01015                     font = _getfont(fs->font_name, font_bold, font_italic, 
01016                         fs->font_size, fs->font_ptsize);
01017                 }
01018                 else
01019                 {
01020 #ifndef HAVE_LIBXFT
01021                     font = NULL;
01022 #endif
01023                 }
01024             }
01025             else if(!strncmp(tags[0], "head", strlen("head")))
01026             {
01027                 /*
01028                  * we want to ignore the header of an html doc
01029                  */
01030 
01031                 ignore = 1;
01032             }
01033             else if(!strncmp(tags[0], "body", strlen("body")))
01034             {
01035                 char * data = tags[0] + strlen("body");
01036                 char * parm;
01037 
01038                 ignore = 0;
01039 
01040 
01041                 fs = _font_stack_push(fs);
01042 
01043                 if((parm = strstr(data, "bgcolor=")) != NULL)
01044                 {
01045                     char color[255];
01046                     parm += strlen("bgcolor=");
01047                     _extract_parameter(parm, color, 255);
01048                     if(fs->back)
01049                     {
01050                         g_free(fs->back);
01051                     }
01052                     if(!ignore_bgcolor)
01053                     {
01054                         fs->back = _getcolor(gdk_window_get_colormap(GTK_WIDGET(widget)->window), color);
01055                         //fs->fore = _getcolor(gdk_window_get_colormap(GTK_WIDGET(widget)->window), "black");
01056                     }
01057                     else
01058                     {
01059                         fs->back = NULL;
01060                     }
01061                 }
01062             }
01063             else
01064             {
01065                 _unescape_string(copy);
01066                 if(url)
01067                 {
01068                     ext_gtk_text_insert_data_underlined(widget, font, fs->fore, fs->back,
01069                                 url, strlen(url)+1, handle_click, "<", 1);
01070                     ext_gtk_text_insert_data_underlined(widget, font, fs->fore, fs->back,
01071                                 url, strlen(url)+1, handle_click, copy, strlen(copy));
01072                 }
01073                 else
01074                 {
01075                     ext_gtk_text_insert(widget, font, fs->fore, fs->back,
01076                                 "<", 1);
01077                     ext_gtk_text_insert(widget, font, fs->fore, fs->back,
01078                                 copy, strlen(copy));
01079                 }
01080                 g_strfreev(tags);
01081                 free(copy);
01082                 first = 0;
01083                 continue;
01084 
01085             }
01086 
01087             if(tags[1] && !ignore)
01088             {
01089                 _unescape_string(tags[1]);
01090 
01091                 if(url)
01092                 {
01093                     ext_gtk_text_insert_data_underlined(widget, font, fs->fore, fs->back,
01094                                 url, strlen(url)+1, handle_click, tags[1], strlen(tags[1]));
01095                     eb_debug(DBG_HTML, "Underlined text inserted\n");
01096                 }
01097                 else
01098                 {
01099                     ext_gtk_text_insert(widget, font, fs->fore, fs->back,
01100                                 tags[1], strlen(tags[1]));
01101                 }
01102             }
01103             g_strfreev(tags);
01104             free(copy);
01105         }
01106         else
01107         {
01108             /*
01109              * Otherwise then it is all just text
01110              */
01111 
01112             /*
01113              * first we were not supposed to have gotten rid of that < ;P
01114              */
01115 
01116             if(!ignore)
01117             {
01118                 if(!first)
01119                 {
01120                     if(url)
01121                     {
01122                         ext_gtk_text_insert_data_underlined( widget, font, fs->fore, 
01123                                 fs->back, url, strlen(url)+1, handle_click, "<", strlen("<") );
01124                     }
01125                     else
01126                     {
01127                         ext_gtk_text_insert( widget, font, fs->fore, 
01128                                 fs->back, "<", strlen("<") );
01129                     }
01130                 }
01131 
01132                 _unescape_string(tokens[i]);
01133                 if(url)
01134                 {
01135                     ext_gtk_text_insert_data_underlined(widget, font, fs->fore, fs->back,
01136                                     url, strlen(url)+1, handle_click, tokens[i], strlen(tokens[i]));
01137                 }
01138                 else
01139                 {
01140                     ext_gtk_text_insert(widget, font, fs->fore, fs->back,
01141                                     tokens[i], strlen(tokens[i]));
01142                 }
01143             }
01144 
01145         }
01146         first = 0;
01147     }
01148     /*
01149      * we got this quirk of loosing the < if it ends
01150      * with the <
01151      * this is the fix
01152      */
01153 
01154     if(text[strlen(text)-1] == '<')
01155     {
01156         if(url)
01157         {
01158             ext_gtk_text_insert_data_underlined( widget, font, fs->fore, 
01159                 fs->back, url, strlen(url)+1, handle_click, "<", strlen("<") );
01160         }
01161         else
01162         {
01163             ext_gtk_text_insert( widget, font, fs->fore, 
01164                 fs->back, "<", strlen("<") );
01165         }
01166     }
01167         
01168     g_strfreev(tokens);
01169 
01170     while(fs)
01171     {
01172         fs = _font_stack_pop(fs);
01173     }
01174 }

void gtk_eb_html_init ExtGtkText   widget
 

Definition at line 400 of file gtk_eb_html.c.

References EXT_GTK_TEXT, ext_gtk_text_set_editable(), ext_gtk_text_set_line_wrap(), ext_gtk_text_set_word_wrap(), and handle_click().

Referenced by create_html_widget(), eb_chat_window_new(), eb_info_window_new(), and eb_join_chat_room().

00401 {
00402     gtk_signal_connect_after(GTK_OBJECT(widget), "button_press_event",
00403             GTK_SIGNAL_FUNC(handle_click), NULL);
00404     ext_gtk_text_set_editable(EXT_GTK_TEXT(widget), FALSE);
00405     ext_gtk_text_set_line_wrap(EXT_GTK_TEXT(widget), TRUE);
00406     ext_gtk_text_set_word_wrap(EXT_GTK_TEXT(widget), TRUE);
00407 
00408 
00409 
00410 }


Contact: Andy Maloney     [Documentation generated by doxygen]