Crossfire Client, Branches  R11627
text.c File Reference
#include <config.h>
#include <stdio.h>
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include "client.h"
#include "gx11.h"
#include "gtkproto.h"
#include "pixmaps/sign_flat.xpm"
#include "pixmaps/sign_west.xpm"
#include "pixmaps/sign_east.xpm"
#include "pixmaps/close.xpm"
+ Include dependency graph for text.c:

Go to the source code of this file.

Data Structures

struct  picture_message_struct
 

Macros

#define STYLE_BOLD   1
 
#define STYLE_ITALIC   2
 

Typedefs

typedef struct
picture_message_struct 
picture_message
 

Functions

static void add_book (char *title, char *message)
 
static void admin_callback (int flag, int type, int subtype, char *message)
 
static void book_callback (int flag, int type, int subtype, char *message)
 
void cleanup_textmanagers (void)
 
static GtkWidget * create_text_picture_window (picture_message *layout, char *message)
 
news_entryget_news (void)
 
const char * get_rules (void)
 
const char * getMOTD (void)
 
static void init_fonts (void)
 
static void init_pictures (GtkWidget *refWindow)
 
void init_text_callbacks (void)
 
static GdkFont * load_a_font (const char *const font_list[])
 
static void motd_callback (int flag, int type, int subtype, char *message)
 
static void prepare_book_window (void)
 
static void show_media_message (const char *title, const char *message)
 
static void sign_callback (int color, int type, int subtype, char *message)
 
static void void_callback (int flag, int type, int subtype, char *message)
 
media_state write_media (GtkText *textarea, const char *message)
 
media_state write_media_with_state (GtkText *textarea, const char *message, media_state current_state)
 

Variables

static const char *const arcane_medium_fontname []
 
GtkWidget * book_notes = NULL
 
GtkWidget * book_root = NULL
 
GdkBitmap * btnClose_bm = NULL
 
GdkPixmap * btnClose_pm = NULL
 
news_entryfirst_news = NULL
 
static const char *const fixed_bold_fontname []
 
static const char *const fixed_italic_fontname []
 
static const char *const fixed_italicbold_fontname []
 
static const char *const fixed_medium_fontname []
 
GtkWidget * gtkwin_info_text
 
GtkWidget * gtkwin_info_text2
 
static const char *const hand_medium_fontname []
 
static char * last_motd = NULL
 
static char NO_TITLE [] = "[no title]"
 
static const char *const print_bold_fontname []
 
static const char *const print_italic_fontname []
 
static const char *const print_italicbold_fontname []
 
static const char *const print_medium_fontname []
 
const char *const rcsid_gtk_text_c
 
static char * rules = NULL
 
static picture_message sign_message []
 
static const char *const strange_medium_fontname []
 
static GdkFont * style_arcane [4]
 
static GdkFont * style_fixed [4]
 
static GdkFont * style_hand [4]
 
static int style_inited = 0
 
static GdkFont * style_print [4]
 
static GdkFont * style_strange [4]
 

Macro Definition Documentation

#define STYLE_BOLD   1

Definition at line 255 of file text.c.

Referenced by write_media_with_state().

#define STYLE_ITALIC   2

Definition at line 256 of file text.c.

Referenced by write_media_with_state().

Typedef Documentation

Function Documentation

static void add_book ( char *  title,
char *  message 
)
static

Definition at line 339 of file text.c.

References book_notes, book_root, btnClose_bm, btnClose_pm, FALSE, prepare_book_window(), TRUE, and write_media().

Referenced by book_callback().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void admin_callback ( int  flag,
int  type,
int  subtype,
char *  message 
)
static

Definition at line 465 of file text.c.

References CONFIG_SPLITINFO, draw_info(), first_news, gtkwin_info_text, gtkwin_info_text2, LOG(), LOG_ERROR, MSG_TYPE_ADMIN_NEWS, MSG_TYPE_ADMIN_RULES, rules, use_config, and write_media().

Referenced by init_text_callbacks().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void book_callback ( int  flag,
int  type,
int  subtype,
char *  message 
)
static

Definition at line 391 of file text.c.

References add_book(), CONFIG_POPUPS, CONFIG_SPLITINFO, gtkwin_info_text, gtkwin_info_text2, LOG(), LOG_DEBUG, NO_TITLE, use_config, want_config, and write_media().

Referenced by init_text_callbacks().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void cleanup_textmanagers ( void  )

Definition at line 522 of file text.c.

References news_entry::content, first_news, last_motd, news_entry::next, rules, and news_entry::title.

Referenced by cleanup_connection(), disconnect(), and event_loop().

+ Here is the caller graph for this function:

static GtkWidget* create_text_picture_window ( picture_message layout,
char *  message 
)
static
news_entry* get_news ( void  )

Definition at line 462 of file text.c.

References first_news.

Referenced by buildLoginDialog().

+ Here is the caller graph for this function:

const char* get_rules ( void  )

Definition at line 459 of file text.c.

References rules.

Referenced by buildLoginDialog().

+ Here is the caller graph for this function:

const char* getMOTD ( void  )

Definition at line 454 of file text.c.

References last_motd.

Referenced by buildLoginDialog().

+ Here is the caller graph for this function:

static void init_pictures ( GtkWidget *  refWindow)
static

Definition at line 64 of file text.c.

References btnClose_bm, and btnClose_pm.

Referenced by create_text_picture_window(), and prepare_book_window().

+ Here is the caller graph for this function:

void init_text_callbacks ( void  )

Definition at line 515 of file text.c.

References admin_callback(), book_callback(), motd_callback(), MSG_TYPE_ADMIN, MSG_TYPE_BOOK, MSG_TYPE_MOTD, MSG_TYPE_SIGN, setTextManager(), and sign_callback().

Referenced by main().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static GdkFont* load_a_font ( const char *const  font_list[])
static

Definition at line 238 of file text.c.

References LOG(), and LOG_INFO.

Referenced by init_fonts().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void motd_callback ( int  flag,
int  type,
int  subtype,
char *  message 
)
static

Definition at line 416 of file text.c.

References CONFIG_POPUPS, gtkwin_info_text, last_motd, LOG(), LOG_ERROR, want_config, and write_media().

Referenced by init_text_callbacks().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void prepare_book_window ( void  )
static

Definition at line 70 of file text.c.

References book_notes, book_root, and init_pictures().

Referenced by add_book().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void show_media_message ( const char *  title,
const char *  message 
)
static

Definition at line 135 of file text.c.

References FALSE, TRUE, and write_media().

+ Here is the call graph for this function:

static void sign_callback ( int  color,
int  type,
int  subtype,
char *  message 
)
static

Definition at line 434 of file text.c.

References CONFIG_POPUPS, CONFIG_SIGNPOPUP, CONFIG_SPLITINFO, create_text_picture_window(), gtkwin_info_text, gtkwin_info_text2, gtkwin_root, use_config, want_config, and write_media().

Referenced by init_text_callbacks().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void void_callback ( int  flag,
int  type,
int  subtype,
char *  message 
)
static

Definition at line 429 of file text.c.

References LOG(), and LOG_INFO.

+ Here is the call graph for this function:

media_state write_media ( GtkText *  textarea,
const char *  message 
)

Definition at line 282 of file text.c.

References media_state::flavor, media_state::has_color, media_state::style, style_print, and write_media_with_state().

Referenced by add_book(), admin_callback(), book_callback(), buildLoginDialog(), create_text_picture_window(), fill_news(), motd_callback(), show_media_message(), and sign_callback().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

media_state write_media_with_state ( GtkText *  textarea,
const char *  message,
media_state  current_state 
)

Definition at line 289 of file text.c.

References media_state::flavor, media_state::fore, media_state::has_color, init_fonts(), LOG(), LOG_ERROR, LOG_INFO, media_state::style, style_arcane, STYLE_BOLD, style_fixed, style_hand, STYLE_ITALIC, style_print, and style_strange.

Referenced by fill_news(), and write_media().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

const char* const arcane_medium_fontname[]
static
Initial value:
= {
"-*-cuneifontlight-*-r-*-*-*-120-*-*-*-*-iso8859-*",
"-*-linotext-*-r-*-*-*-120-*-*-*-*-iso8859-*",
"-*-blackforest-*-r-*-*-*-120-*-*-*-*-iso8859-*",
"-*-becker-*-*-*-*-*-120-*-*-*-*-iso8859-*",
"-*-arnoldboecklin-*-r-*-*-*-120-*-*-*-*-iso8859-*",
"-*-caligula-*-*-*-*-*-120-*-*-*-*-iso8859-*",
NULL
}

Parse message, extract multimedia information, and push as appropriate in the GtkText

Definition at line 166 of file text.c.

Referenced by init_fonts().

GtkWidget* book_notes = NULL

Definition at line 42 of file text.c.

Referenced by add_book(), and prepare_book_window().

GtkWidget* book_root = NULL

Definition at line 41 of file text.c.

Referenced by add_book(), and prepare_book_window().

GdkBitmap* btnClose_bm = NULL

Definition at line 43 of file text.c.

Referenced by add_book(), and init_pictures().

GdkPixmap* btnClose_pm = NULL

Definition at line 44 of file text.c.

Referenced by add_book(), and init_pictures().

news_entry* first_news = NULL

Definition at line 458 of file text.c.

Referenced by admin_callback(), cleanup_textmanagers(), and get_news().

const char* const fixed_bold_fontname[]
static
Initial value:
= {
"-*-fixed-bold-r-*-*-*-120-*-*-*-*-iso8859-*",
"-*-courrier-bold-*-*-*-*-120-*-*-*-*-iso8859-*",
"-*-andale mono-medium-*-*-*-*-120-*-*-*-*-iso8859-*",
NULL
}

Definition at line 220 of file text.c.

Referenced by init_fonts().

const char* const fixed_italic_fontname[]
static
Initial value:
= {
"-*-fixed-medium-o-*-*-*-120-*-*-*-*-iso8859-*",
"-*-courrier-medium-o-*-*-*-120-*-*-*-*-iso8859-*",
"-*-andale mono-medium-*-*-*-*-120-*-*-*-*-iso8859-*",
NULL
}

Definition at line 226 of file text.c.

Referenced by init_fonts().

const char* const fixed_italicbold_fontname[]
static
Initial value:
= {
"-*-fixed-bold-i-*-*-*-120-*-*-*-*-iso8859-*",
"-*-courrier-bold-o-*-*-*-120-*-*-*-*-iso8859-*",
"-*-andale mono-*-*-*-*-*-120-*-*-*-*-iso8859-*",
NULL
}

Definition at line 232 of file text.c.

Referenced by init_fonts().

const char* const fixed_medium_fontname[]
static
Initial value:
= {
"-*-fixed-medium-r-*-*-*-120-*-*-*-*-iso8859-*",
"-*-courrier-medium-*-*-*-*-120-*-*-*-*-iso8859-*",
"-*-andale mono-medium-*-*-*-*-120-*-*-*-*-iso8859-*",
NULL
}

Definition at line 214 of file text.c.

Referenced by init_fonts().

GtkWidget* gtkwin_info_text2
const char* const hand_medium_fontname[]
static
Initial value:
= {
"-*-dobkinscript-*-r-*-*-*-120-*-*-*-*-iso8859-*",
"-*-coronetscript-*-r-*-*-*-120-*-*-*-*-iso8859-*",
"-*-muriel-*-r-*-*-*-120-*-*-*-*-iso8859-*",
"-*-genoa-*-r-*-*-*-120-*-*-*-*-iso8859-*",
"-*-parkavenue-*-r-*-*-*-120-*-*-*-*-iso8859-*",
"-*-rechtmanscript-*-r-*-*-*-120-*-*-*-*-iso8859-*",
NULL
}

Definition at line 175 of file text.c.

Referenced by init_fonts().

char* last_motd = NULL
static

Definition at line 415 of file text.c.

Referenced by cleanup_textmanagers(), getMOTD(), and motd_callback().

char NO_TITLE[] = "[no title]"
static

Definition at line 35 of file text.c.

Referenced by book_callback().

const char* const print_bold_fontname[]
static
Initial value:
= {
"-*-arial-bold-r-*-*-*-120-*-*-*-*-iso8859-*",
"-*-bookman-demi-r-*-*-*-120-*-*-*-*-iso8859-*",
"-*-agate-bold-r-*-*-*-120-*-*-*-*-iso8859-*",
NULL
}

Definition at line 196 of file text.c.

Referenced by init_fonts().

const char* const print_italic_fontname[]
static
Initial value:
= {
"-*-arial-medium-i-*-*-*-120-*-*-*-*-iso8859-*",
"-*-bookman-light-i-*-*-*-120-*-*-*-*-iso8859-*",
"-*-agate-normal-i-*-*-*-120-*-*-*-*-iso8859-*",
NULL
}

Definition at line 202 of file text.c.

Referenced by init_fonts().

const char* const print_italicbold_fontname[]
static
Initial value:
= {
"-*-arial-bold-i-*-*-*-120-*-*-*-*-iso8859-*",
"-*-bookman-demi-i-*-*-*-120-*-*-*-*-iso8859-*",
"-*-agate-bold-i-*-*-*-120-*-*-*-*-iso8859-*",
NULL
}

Definition at line 208 of file text.c.

Referenced by init_fonts().

const char* const print_medium_fontname[]
static
Initial value:
= {
"-*-arial-medium-r-*-*-*-120-*-*-*-*-iso8859-*",
"-*-bookman-light-r-*-*-*-120-*-*-*-*-iso8859-*",
"-*-agate-normal-r-*-*-*-120-*-*-*-*-iso8859-*",
NULL
}

Definition at line 190 of file text.c.

Referenced by init_fonts().

const char* const rcsid_gtk_text_c
Initial value:
=
"$Id: text.c 9190 2008-06-01 08:53:05Z anmaster $"

Definition at line 1 of file text.c.

char* rules = NULL
static

Definition at line 457 of file text.c.

Referenced by admin_callback(), cleanup_textmanagers(), and get_rules().

picture_message sign_message[]
static
Initial value:
= {
{"sign",sign_flat_xpm,70,45,390,305,500,500,NULL},
{"left sign",sign_west_xpm,95,85,615,190,750,400,NULL},
{"right sign",sign_east_xpm,45,85,615,190,750,400,NULL},
{"direction sign",sign_flat_xpm,70,45,390,305,500,500,NULL} }

Definition at line 59 of file text.c.

const char* const strange_medium_fontname[]
static
Initial value:
= {
"-*-annstone-*-r-*-*-*-120-*-*-*-*-iso8859-*",
"-*-shalomstick-*-r-*-*-*-120-*-*-*-*-iso8859-*",
NULL
}

Definition at line 184 of file text.c.

Referenced by init_fonts().

GdkFont* style_arcane[4]
static

Definition at line 251 of file text.c.

Referenced by init_fonts(), and write_media_with_state().

GdkFont* style_fixed[4]
static

Definition at line 250 of file text.c.

Referenced by init_fonts(), and write_media_with_state().

GdkFont* style_hand[4]
static

Definition at line 252 of file text.c.

Referenced by init_fonts(), and write_media_with_state().

int style_inited = 0
static

Definition at line 257 of file text.c.

Referenced by init_fonts().

GdkFont* style_print[4]
static

Definition at line 254 of file text.c.

Referenced by init_fonts(), write_media(), and write_media_with_state().

GdkFont* style_strange[4]
static

Definition at line 253 of file text.c.

Referenced by init_fonts(), and write_media_with_state().