23#include <gdk/gdkkeysyms.h>
53#define MAX_CHATLINE_HISTORY 20
74 return gtk_widget_has_focus(
toolkit.entry);
82 gtk_widget_grab_focus(
toolkit.entry);
90 return gtk_widget_get_mapped(
toolkit.entry);
133 if (s[0] ==
'\'' || s[0] ==
'"') {
134 p = strchr(s + 1, s[0]);
148 while (p != NULL && *p !=
'\0') {
165 const char *theinput;
166 GtkEntryBuffer *buffer = gtk_entry_get_buffer(w);
168 theinput = gtk_entry_buffer_get_text(buffer);
194 gtk_entry_buffer_set_text(buffer,
"", -1);
209 return pplayer->
name;
228 const char **matches,
229 const int max_matches)
231 int matches_id[max_matches * 2], ind, num;
237 prefix, &ind, matches_id,
238 max_matches * 2, &num)) {
249 for (i = 0; i < num && c < max_matches; i++) {
251 for (j = 0; j < c; j++) {
284 char *buf,
size_t buf_len)
291 for (i = 1; i < num_prefixes; i++) {
292 for (p = prefixes[i], q = buf; *p !=
'\0' && *q !=
'\0';
293 p = g_utf8_next_char(p), q = g_utf8_next_char(q)) {
294 if (g_unichar_toupper(g_utf8_get_char(p))
295 != g_unichar_toupper(g_utf8_get_char(q))) {
302 return g_utf8_strlen(buf, -1);
311#define MAX_MATCHES 10
315 gchar *chars, *p, *prev;
320 pos = gtk_editable_get_position(editable);
321 chars = gtk_editable_get_chars(editable, 0,
pos);
323 p = chars + strlen(chars);
324 while ((prev = g_utf8_find_prev_char(chars, p))) {
325 if (!g_unichar_isalnum(g_utf8_get_char(prev))) {
332 prefix_len = g_utf8_strlen(p, -1);
333 if (0 == prefix_len) {
342 gtk_editable_delete_text(editable,
pos - prefix_len,
pos);
344 gtk_editable_insert_text(editable,
name[0], strlen(
name[0]), &
pos);
345 gtk_editable_set_position(editable,
pos);
348 }
else if (num > 1) {
350 gtk_editable_delete_text(editable,
pos - prefix_len,
pos);
352 gtk_editable_insert_text(editable, buf, strlen(buf), &
pos);
353 gtk_editable_set_position(editable,
pos);
356 for (i = 1; i < num; i++) {
373 GdkModifierType state,
376 GtkWidget *w = gtk_event_controller_get_widget(GTK_EVENT_CONTROLLER(controller));
378 if ((state & GDK_CONTROL_MASK)) {
408 GtkEntryBuffer *buffer = gtk_entry_get_buffer(GTK_ENTRY(w));
413 gtk_entry_buffer_set_text(buffer,
416 gtk_editable_set_position(GTK_EDITABLE(w), -1);
426 gtk_entry_buffer_set_text(buffer,
430 gtk_entry_buffer_set_text(buffer,
"", -1);
432 gtk_editable_set_position(GTK_EDITABLE(w), -1);
455 GtkEditable *editable = GTK_EDITABLE(
entry);
456 gint start_pos, end_pos;
458 gchar *fg_color_text = NULL, *bg_color_text = NULL;
460 if (!gtk_editable_get_selection_bounds(editable, &start_pos, &end_pos)) {
462 start_pos = end_pos = gtk_editable_get_position(editable);
465 selection = gtk_editable_get_chars(editable, start_pos, end_pos);
469 GdkRGBA *fg_color = g_object_get_data(G_OBJECT(
entry),
"fg_color");
470 GdkRGBA *bg_color = g_object_get_data(G_OBJECT(
entry),
"bg_color");
472 if (!fg_color && !bg_color) {
477 fg_color_text = gdk_rgba_to_string(fg_color);
480 bg_color_text = gdk_rgba_to_string(bg_color);
495 gtk_editable_delete_text(editable, start_pos, end_pos);
497 gtk_editable_insert_text(editable, buf, -1, &end_pos);
498 gtk_editable_select_region(editable, start_pos, end_pos);
502 g_free(fg_color_text);
503 g_free(bg_color_text);
514 GtkEditable *editable = GTK_EDITABLE(
entry);
515 gint start_pos, end_pos;
530 if (gtk_editable_get_selection_bounds(editable, &start_pos, &end_pos)) {
535 chars = gtk_editable_get_chars(editable, start_pos, end_pos);
550 gtk_editable_delete_text(editable, start_pos, end_pos);
552 gtk_editable_insert_text(editable, buf, -1, &end_pos);
553 gtk_widget_grab_focus(
entry);
554 gtk_editable_select_region(editable, start_pos, end_pos);
558 start_pos = gtk_editable_get_position(editable);
560 chars = gtk_editable_get_chars(editable,
MAX(start_pos - 1, 0),
570 if (start_pos > 0 && strlen(chars) > 0 && chars[0] !=
' ') {
572 gtk_editable_insert_text(editable,
" ", 1, &end_pos);
574 gtk_editable_insert_text(editable, buf, -1, &end_pos);
575 if (chars[start_pos > 0 ? 1 : 0] !=
'\0'
576 && chars[start_pos > 0 ? 1 : 0] !=
' ') {
578 gtk_editable_insert_text(editable,
" ", 1, &end_pos);
580 gtk_widget_grab_focus(
entry);
581 gtk_editable_set_position(editable, end_pos);
597 gdouble val, max, upper, page_size;
602 sw = gtk_widget_get_parent(GTK_WIDGET(textview));
606 vadj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(sw));
607 val = gtk_adjustment_get_value(vadj);
608 g_object_get(G_OBJECT(vadj),
"upper", &upper,
609 "page-size", &page_size, NULL);
610 max = upper - page_size;
611 if (max - val < 10.0) {
612 gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(textview), scroll_target,
613 0.0,
TRUE, 1.0, 0.0);
621 double x,
double y, gpointer data)
623 GtkWidget *text_view = gtk_event_controller_get_widget(GTK_EVENT_CONTROLLER(gesture));
624 GtkTextIter start, end, iter;
625 GtkTextBuffer *buffer;
628 struct tile *ptile = NULL;
630 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_view));
633 gtk_text_buffer_get_selection_bounds(buffer, &start, &end);
634 if (gtk_text_iter_get_offset(&start) != gtk_text_iter_get_offset(&end)) {
638 gtk_text_view_window_to_buffer_coords(GTK_TEXT_VIEW (text_view),
639 GTK_TEXT_WINDOW_WIDGET,
642 gtk_text_view_get_iter_at_location(GTK_TEXT_VIEW(text_view), &iter, bx, by);
644 if ((tags = gtk_text_iter_get_tags(&iter))) {
645 for (tagp = tags; tagp; tagp = tagp->next) {
646 GtkTextTag *tag = tagp->data;
648 GPOINTER_TO_INT(g_object_get_data(G_OBJECT(tag),
"type"));
652 int id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(tag),
"id"));
676 _(
"This tile doesn't exist in this game!"));
695 gtk_widget_grab_focus(GTK_WIDGET(
map_canvas));
710 static gboolean hovering_over_link =
FALSE;
711 static GdkCursor *hand_cursor = NULL;
712 static GdkCursor *regular_cursor = NULL;
715 gboolean hovering =
FALSE;
719 hand_cursor = gdk_cursor_new_from_name(
"pointer", NULL);
721 if (!regular_cursor) {
722 regular_cursor = gdk_cursor_new_from_name(
"text", NULL);
725 gtk_text_view_get_iter_at_location(text_view, &iter, x, y);
727 tags = gtk_text_iter_get_tags(&iter);
728 for (tagp = tags; tagp; tagp = tagp->next) {
730 GPOINTER_TO_INT(g_object_get_data(G_OBJECT(tagp->data),
"type"));
738 if (hovering != hovering_over_link) {
739 hovering_over_link = hovering;
741 if (hovering_over_link) {
742 gtk_widget_set_cursor(GTK_WIDGET(text_view), hand_cursor);
744 gtk_widget_set_cursor(GTK_WIDGET(text_view), regular_cursor);
757 gdouble e_x, gdouble e_y, gpointer data)
761 = gtk_event_controller_get_widget(GTK_EVENT_CONTROLLER(controller));
763 gtk_text_view_window_to_buffer_coords(GTK_TEXT_VIEW(text_view),
764 GTK_TEXT_WINDOW_WIDGET,
777 GtkEventController *controller;
779 gesture = gtk_gesture_click_new();
780 controller = GTK_EVENT_CONTROLLER(gesture);
781 g_signal_connect(controller,
"released",
783 gtk_widget_add_controller(
view, controller);
785 controller = GTK_EVENT_CONTROLLER(gtk_event_controller_motion_new());
786 g_signal_connect(controller,
"motion",
788 gtk_widget_add_controller(
view, controller);
798 GtkTextIter start, stop;
801 gtk_text_buffer_create_tag(buf,
"bold",
802 "weight", PANGO_WEIGHT_BOLD, NULL);
803 gtk_text_buffer_create_tag(buf,
"italic",
804 "style", PANGO_STYLE_ITALIC, NULL);
805 gtk_text_buffer_create_tag(buf,
"strike",
806 "strikethrough",
TRUE, NULL);
807 gtk_text_buffer_create_tag(buf,
"underline",
808 "underline", PANGO_UNDERLINE_SINGLE, NULL);
817 gtk_text_buffer_get_iter_at_offset(buf, &start, text_start_offset
818 + g_utf8_pointer_to_offset(text,
821 gtk_text_buffer_get_end_iter(buf, &stop);
823 gtk_text_buffer_get_iter_at_offset(buf, &stop, text_start_offset
824 + g_utf8_pointer_to_offset(text,
830 gtk_text_buffer_apply_tag_by_name(buf,
"bold", &start, &stop);
833 gtk_text_buffer_apply_tag_by_name(buf,
"italic", &start, &stop);
836 gtk_text_buffer_apply_tag_by_name(buf,
"strike", &start, &stop);
839 gtk_text_buffer_apply_tag_by_name(buf,
"underline", &start, &stop);
844 GtkTextTag *tag = NULL;
848 if (foreground && foreground[0]) {
849 if (background && background[0]) {
850 tag = gtk_text_buffer_create_tag(buf, NULL,
851 "foreground", foreground,
852 "background", background,
855 tag = gtk_text_buffer_create_tag(buf, NULL,
856 "foreground", foreground,
859 }
else if (background && background[0]) {
860 tag = gtk_text_buffer_create_tag(buf, NULL,
861 "background", background,
868 gtk_text_buffer_apply_tag(buf, tag, &start, &stop);
892 tag = gtk_text_buffer_create_tag(buf, NULL,
893 "foreground-rgba", &
pcolor->color,
894 "underline", PANGO_UNDERLINE_SINGLE,
899 g_object_set_data(G_OBJECT(tag),
"type",
901 g_object_set_data(G_OBJECT(tag),
"id",
903 gtk_text_buffer_apply_tag(buf, tag, &start, &stop);
914 const struct text_tag_list *tags,
930 gtk_text_buffer_get_end_iter(buf, &iter);
931 gtk_text_buffer_insert(buf, &iter,
"\n", -1);
932 mark = gtk_text_buffer_create_mark(buf, NULL, &iter,
TRUE);
941 strftime(timebuf,
sizeof(timebuf),
"[%H:%M:%S] ", &now_tm);
942 gtk_text_buffer_insert(buf, &iter, timebuf, -1);
945 text_start_offset = gtk_text_iter_get_offset(&iter);
946 gtk_text_buffer_insert(buf, &iter,
astring, -1);
957 gtk_text_buffer_delete_mark(buf, mark);
969 GtkTextIter start, end;
1001 GtkAdjustment *vadj;
1002 gdouble val, max, upper, page_size;
1014 sw = gtk_widget_get_parent(w);
1015 vadj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(sw));
1016 val = gtk_adjustment_get_value(vadj);
1017 g_object_get(G_OBJECT(vadj),
"upper", &upper,
1018 "page-size", &page_size, NULL);
1019 max = upper - page_size;
1022 return max - val < 0.00000001;
1037 *((guint *) data) = 0;
1047 static guint callback_id = 0;
1050 if (callback_id == 0) {
1060 &end, 0.0,
TRUE, 1.0, 0.0);
1064 &end, 0.0,
TRUE, 1.0, 0.0);
1075 GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button),
1082static void color_set(GObject *
object,
const gchar *color_target,
1083 GdkRGBA *
color, GtkButton *button)
1085 GdkRGBA *current_color = g_object_get_data(
object, color_target);
1087 if (NULL ==
color) {
1089 if (NULL != current_color) {
1090 gdk_rgba_free(current_color);
1091 g_object_set_data(
object, color_target, NULL);
1092 if (NULL != button) {
1093 gtk_button_set_child(button, NULL);
1098 if (NULL != current_color) {
1100 *current_color = *
color;
1103 current_color = gdk_rgba_copy(
color);
1104 g_object_set_data(
object, color_target, current_color);
1107 if (NULL != button) {
1112 gtk_button_set_child(button, NULL);
1115 cairo_surface_t *surface = cairo_image_surface_create(
1116 CAIRO_FORMAT_RGB24, 16, 16);
1117 cairo_t *cr = cairo_create(surface);
1118 gdk_cairo_set_source_rgba(cr, current_color);
1121 pixbuf = gdk_pixbuf_get_from_surface(surface, 0, 0, 16, 16);
1122 cairo_surface_destroy(surface);
1124 image = gtk_image_new_from_pixbuf(pixbuf);
1125 gtk_button_set_child(button, image);
1126 gtk_widget_show(image);
1127 g_object_unref(G_OBJECT(pixbuf));
1137 const gchar *color_target =
1138 g_object_get_data(G_OBJECT(data),
"color_target");
1139 GObject *
entry = g_object_get_data(G_OBJECT(data),
"entry");
1141 if (res == GTK_RESPONSE_REJECT) {
1144 }
else if (res == GTK_RESPONSE_OK) {
1146 GtkColorChooser *chooser =
1147 GTK_COLOR_CHOOSER(g_object_get_data(G_OBJECT(dialog),
"chooser"));
1150 gtk_color_chooser_get_rgba(chooser, &new_color);
1154 gtk_window_destroy(GTK_WINDOW(dialog));
1162 GtkWidget *dialog, *chooser;
1164 const gchar *color_target = g_object_get_data(G_OBJECT(button),
1166 GdkRGBA *current_color = g_object_get_data(G_OBJECT(data), color_target);
1169 gchar *buf = g_strdup_printf(
_(
"Select the %s color"),
1170 (
const char *) g_object_get_data(G_OBJECT(button),
1172 dialog = gtk_dialog_new_with_buttons(buf, NULL, GTK_DIALOG_MODAL,
1173 _(
"_Cancel"), GTK_RESPONSE_CANCEL,
1174 _(
"C_lear"), GTK_RESPONSE_REJECT,
1175 _(
"_OK"), GTK_RESPONSE_OK, NULL);
1177 g_object_set_data(G_OBJECT(button),
"entry", data);
1178 g_signal_connect(dialog,
"response", G_CALLBACK(
color_selected), button);
1180 chooser = gtk_color_chooser_widget_new();
1181 gtk_box_insert_child_after(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
1183 g_object_set_data(G_OBJECT(dialog),
"chooser", chooser);
1185 if (current_color != NULL) {
1186 gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(chooser), current_color);
1189 gtk_widget_show(dialog);
1199 GtkWidget *parent = gtk_widget_get_parent(ptoolkit->
main_widget);
1200 GtkWidget *
button_box = GTK_WIDGET(g_object_get_data(G_OBJECT(toolkit_view),
1205 if (parent == toolkit_view) {
1212 gtk_widget_hide(ptoolkit->
toolbar);
1216 gtk_box_remove(GTK_BOX(parent), ptoolkit->
main_widget);
1217 gtk_box_append(GTK_BOX(toolkit_view), ptoolkit->
main_widget);
1220 gtk_widget_show(ptoolkit->
toolbar);
1229 gtk_widget_hide(ptoolkit->
toolbar);
1233 for (iter = gtk_widget_get_first_child(GTK_WIDGET(ptoolkit->
button_box));
1235 iter = gtk_widget_get_next_sibling(iter)) {
1237 gtk_widget_hide(iter);
1243 gtk_box_append(GTK_BOX(toolkit_view), ptoolkit->
main_widget);
1257 GtkToggleButton *button = GTK_TOGGLE_BUTTON(
toolkit.toggle_button);
1260 if (!gtk_toggle_button_get_active(button)) {
1262 gtk_toggle_button_set_active(button,
TRUE);
1265 gtk_widget_show(ptoolkit->
toolbar);
1268 if (gtk_toggle_button_get_active(button)) {
1270 gtk_toggle_button_set_active(button,
FALSE);
1273 gtk_widget_hide(ptoolkit->
toolbar);
1287 if (gtk_toggle_button_get_active(button)) {
1288 gtk_widget_show(ptoolkit->
toolbar);
1295 gtk_widget_hide(ptoolkit->
toolbar);
1309 GtkWidget *toolkit_view, *bbox;
1312 toolkit_view = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
1313 g_signal_connect_after(toolkit_view,
"map",
1317 bbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 12);
1318 g_object_set_data(G_OBJECT(toolkit_view),
"button_box", bbox);
1320 return toolkit_view;
1329 gtk_box_append(GTK_BOX(g_object_get_data(G_OBJECT(toolkit_view),
1330 "button_box")), button);
1338 GtkWidget *vbox, *hgrid, *
entry, *bbox;
1344 GtkEventController *chat_controller;
1345 GtkEventController *focus_controller;
1356 vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 2);
1359 g_signal_connect_after(vbox,
"map",
1362 entry = gtk_entry_new();
1363 gtk_widget_set_margin_bottom(
entry, 2);
1364 gtk_widget_set_margin_end(
entry, 2);
1365 gtk_widget_set_margin_start(
entry, 2);
1366 gtk_widget_set_margin_top(
entry, 2);
1368 focus_controller = GTK_EVENT_CONTROLLER(gtk_event_controller_focus_new());
1369 g_signal_connect(focus_controller,
"enter",
1371 g_signal_connect(focus_controller,
"leave",
1373 gtk_widget_add_controller(
entry, focus_controller);
1376 hgrid = gtk_grid_new();
1377 gtk_grid_set_column_spacing(GTK_GRID(hgrid), 4);
1380 toolbar = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
1381 gtk_box_append(GTK_BOX(vbox),
toolbar);
1385 item = gtk_button_new_from_icon_name(
"format-text-bold");
1390 g_object_set_data(G_OBJECT(
item),
"text_tag_type",
1393 gtk_widget_set_tooltip_text(GTK_WIDGET(
item),
_(
"Bold (Ctrl-B)"));
1396 item = gtk_button_new_from_icon_name(
"format-text-italic");
1401 g_object_set_data(G_OBJECT(
item),
"text_tag_type",
1404 gtk_widget_set_tooltip_text(GTK_WIDGET(
item),
_(
"Italic (Ctrl-I)"));
1407 item = gtk_button_new_from_icon_name(
"format-text-strikethrough");
1411 g_object_set_data(G_OBJECT(
item),
"text_tag_type",
1414 gtk_widget_set_tooltip_text(GTK_WIDGET(
item),
_(
"Strikethrough (Ctrl-S)"));
1417 item = gtk_button_new_from_icon_name(
"format-text-underline");
1421 g_object_set_data(G_OBJECT(
item),
"text_tag_type",
1424 gtk_widget_set_tooltip_text(GTK_WIDGET(
item),
_(
"Underline (Ctrl-U)"));
1426 gtk_box_append(GTK_BOX(
toolbar), gtk_separator_new(GTK_ORIENTATION_HORIZONTAL));
1429 item = gtk_button_new_with_label(
_(
"Color"));
1432 g_object_set_data(G_OBJECT(
item),
"text_tag_type",
1435 gtk_widget_set_tooltip_text(GTK_WIDGET(
item),
_(
"Color (Ctrl-C)"));
1437 gtk_box_append(GTK_BOX(
toolbar), gtk_separator_new(GTK_ORIENTATION_HORIZONTAL));
1440 item = gtk_button_new();
1442 g_object_set_data(G_OBJECT(
item),
"color_target",
fc_strdup(
"fg_color"));
1443 g_object_set_data(G_OBJECT(
item),
"color_info",
1445 g_signal_connect(
item,
"clicked",
1447 gtk_widget_set_tooltip_text(GTK_WIDGET(
item),
_(
"Select the text color"));
1448 if (gdk_rgba_parse(&
color,
"#000000")) {
1452 log_error(
"Failed to set the default foreground color.");
1456 item = gtk_button_new();
1458 g_object_set_data(G_OBJECT(
item),
"color_target",
fc_strdup(
"bg_color"));
1459 g_object_set_data(G_OBJECT(
item),
"color_info",
1461 g_signal_connect(
item,
"clicked",
1463 gtk_widget_set_tooltip_text(GTK_WIDGET(
item),
1464 _(
"Select the background color"));
1465 if (gdk_rgba_parse(&
color,
"#ffffff")) {
1469 log_error(
"Failed to set the default background color.");
1472 gtk_box_append(GTK_BOX(
toolbar), gtk_separator_new(GTK_ORIENTATION_HORIZONTAL));
1475 item = gtk_button_new_with_label(
_(
"OK"));
1477 g_signal_connect_swapped(
item,
"clicked",
1479 gtk_widget_set_tooltip_text(GTK_WIDGET(
item),
1481 _(
"Send the chat (Return)"));
1484 gtk_box_append(GTK_BOX(vbox), hgrid);
1487 button = gtk_toggle_button_new();
1488 gtk_widget_set_margin_bottom(button, 2);
1489 gtk_widget_set_margin_end(button, 2);
1490 gtk_widget_set_margin_start(button, 2);
1491 gtk_widget_set_margin_top(button, 2);
1492 gtk_grid_attach(GTK_GRID(hgrid), button, grid_col++, 0, 1, 1);
1493 gtk_button_set_icon_name(GTK_BUTTON(button),
"insert-link");
1495 gtk_widget_set_tooltip_text(GTK_WIDGET(button),
_(
"Chat tools"));
1496 toolkit.toggle_button = button;
1499 gtk_grid_attach(GTK_GRID(hgrid),
entry, grid_col++, 0, 1, 1);
1502 chat_controller = gtk_event_controller_key_new();
1503 g_signal_connect(chat_controller,
"key-pressed",
1505 gtk_widget_add_controller(
entry, chat_controller);
1508 bbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2);
1509 gtk_grid_attach(GTK_GRID(hgrid), bbox, grid_col++, 0, 1, 1);
1518 char *vertext = (
char *)user_data;
1524 return G_SOURCE_REMOVE;
1532 int len = strlen(vertext) + 1;
struct canvas int int struct sprite bool int int fog_y struct canvas struct sprite struct color * pcolor
#define CHAT_DIRECT_PREFIX
#define CHAT_ALLIES_PREFIX
#define SERVER_COMMAND_PREFIX
int send_chat(const char *message)
void output_window_append(const struct ft_color color, const char *featured_text)
void write_chatline_content(const char *txt)
void output_window_printf(const struct ft_color color, const char *format,...)
enum client_states client_state(void)
struct tile * client_city_tile(const struct city *pcity)
struct color * get_color(const struct tileset *t, enum color_std stdcolor)
struct unit * find_visible_unit(struct tile *ptile)
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
size_t featured_text_apply_tag(const char *text_source, char *featured_text, size_t featured_text_len, enum text_tag_type tag_type, ft_offset_t start_offset, ft_offset_t stop_offset,...)
enum text_link_type text_tag_link_type(const struct text_tag *ptag)
const char * tile_link(const struct tile *ptile)
ft_offset_t text_tag_stop_offset(const struct text_tag *ptag)
const char * text_tag_color_foreground(const struct text_tag *ptag)
const struct ft_color ftc_client
const char * city_link(const struct city *pcity)
int text_tag_link_id(const struct text_tag *ptag)
ft_offset_t text_tag_start_offset(const struct text_tag *ptag)
const char * unit_link(const struct unit *punit)
const char * text_tag_color_background(const struct text_tag *ptag)
#define text_tag_list_iterate_end
#define text_tag_list_iterate(tags, ptag)
static struct ft_color ft_color_construct(const char *foreground, const char *background)
struct unit * game_unit_by_number(int id)
struct city * game_city_by_number(int id)
bool genlist_remove(struct genlist *pgenlist, const void *punlink)
struct genlist * genlist_new(void)
void * genlist_get(const struct genlist *pgenlist, int idx)
void genlist_prepend(struct genlist *pgenlist, void *data)
int genlist_size(const struct genlist *pgenlist)
bool inputline_has_focus(void)
static void set_cursor_if_appropriate(GtkTextView *text_view, gint x, gint y)
static size_t get_common_prefix(const char *const *prefixes, size_t num_prefixes, char *buf, size_t buf_len)
#define MAX_CHATLINE_HISTORY
static gboolean version_message_main_thread(gpointer user_data)
void inputline_toolkit_view_append_button(GtkWidget *toolkit_view, GtkWidget *button)
void version_message(const char *vertext)
static const char * get_player_or_user_name(int id)
GtkWidget * inputline_toolkit_view_new(void)
void log_output_window(void)
static gboolean chatline_scroll_callback(gpointer data)
void set_message_buffer_view_link_handlers(GtkWidget *view)
static void button_toggled(GtkToggleButton *button, gpointer data)
static void select_color_callback(GtkToolButton *button, gpointer data)
void scroll_if_necessary(GtkTextView *textview, GtkTextMark *scroll_target)
bool inputline_is_visible(void)
static void color_selected(GtkDialog *dialog, gint res, gpointer data)
static bool is_plain_public_message(const char *s)
static bool chatline_autocomplete(GtkEditable *editable)
static struct genlist * history_list
void clear_output_window(void)
void apply_text_tag(const struct text_tag *ptag, GtkTextBuffer *buf, ft_offset_t text_start_offset, const char *text)
static void make_tag_callback(GtkToolButton *button, gpointer data)
static int check_player_or_user_name(const char *prefix, const char **matches, const int max_matches)
static struct inputline_toolkit toolkit
void inputline_make_chat_link(struct tile *ptile, bool unit)
bool chatline_is_scrolled_to_bottom(void)
static gboolean event_after(GtkWidget *text_view, GdkEventButton *event)
void real_output_window_append(const char *astring, const struct text_tag_list *tags, int conn_id)
static gboolean set_toolbar_visibility(GtkWidget *w, gpointer data)
static gboolean inputline_handler(GtkWidget *w, GdkEventKey *ev)
static void inputline_return(GtkEntry *w, gpointer data)
void inputline_grab_focus(void)
void chatline_scroll_to_bottom(bool delayed)
static gboolean move_toolkit(GtkWidget *toolkit_view, gpointer data)
static void inputline_make_tag(GtkEntry *entry, enum text_tag_type type)
GtkTextBuffer * message_buffer
GtkTextView * main_message_area
#define GUI_GTK_OPTION(optname)
void setup_dialog(GtkWidget *shell, GtkWidget *parent)
void append_network_statusbar(const char *text, bool force)
GtkWidget * start_message_area
static GtkWidget * persistent
static gboolean il_lost_focus(GtkEventControllerFocus *controller, gpointer data)
static gboolean chat_pointer_motion(GtkEventControllerMotion *controller, gdouble e_x, gdouble e_y, gpointer data)
static gboolean il_gained_focus(GtkEventControllerFocus *controller, gpointer data)
#define set_output_window_text(_pstr_)
#define fc_assert_ret(condition)
#define log_error(message,...)
struct tile * index_to_tile(const struct civ_map *imap, int mindex)
void link_mark_restore(enum text_link_type type, int id)
void center_tile_mapcanvas(const struct tile *ptile)
#define color_set(color_tgt, color)
enum client_pages get_client_page(void)
struct player * player_by_number(const int player_id)
int player_slot_count(void)
enum m_pre_result match_prefix_full(m_pre_accessor_fn_t accessor_fn, size_t n_names, size_t max_len_name, m_pre_strncmp_fn_t cmp_fn, m_strlen_fn_t len_fn, const char *prefix, int *ind_result, int *matches, int max_matches, int *pnum_matches)
struct conn_list * all_connections
int fc_snprintf(char *str, size_t n, const char *format,...)
size_t fc_strlcpy(char *dest, const char *src, size_t n)
struct tm * fc_localtime(const time_t *timep, struct tm *result)
int cat_snprintf(char *str, size_t n, const char *format,...)
int fc_strncasecmp(const char *str0, const char *str1, size_t n)
#define sz_strlcpy(dest, src)
struct city * tile_city(const struct tile *ptile)