28 bool complete_rebuild:1;
37 bool face_column_resizes:1;
52 gint row, gint column,
53 GdkEventButton *
event,
60 GtkWidget * scroll_window;
62 gchar *titles[] = {
"?",
"Name",
"Weight"};
64 scroll_window = gtk_scrolled_window_new (0,0);
66 list = gtk_clist_new_with_titles(3, titles);
68 g_assert(list != NULL);
69 gtk_clist_set_column_width (GTK_CLIST(list), 0,
image_size);
70 gtk_clist_set_column_width (GTK_CLIST(list), 1, 150);
71 gtk_clist_set_column_width (GTK_CLIST(list), 2, 50);
73 gtk_clist_set_selection_mode (GTK_CLIST(list) , GTK_SELECTION_SINGLE);
74 gtk_clist_set_row_height (GTK_CLIST(list),
image_size);
76 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(scroll_window),
77 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
79 liststyle = gtk_rc_get_style (list);
81 liststyle->bg[GTK_STATE_SELECTED] =
gdk_grey;
82 liststyle->fg[GTK_STATE_SELECTED] =
gdk_black;
83 gtk_widget_set_style (list, liststyle);
86 gtk_widget_show(list);
88 gtk_container_add(GTK_CONTAINER(scroll_window), list);
89 gtk_widget_show(scroll_window);
95 ret->
cont = container;
103 views = g_list_first(g_list_append(
views, ret));
105 gtk_clist_set_button_actions(GTK_CLIST(list),
106 1, GTK_BUTTON_SELECTS);
107 gtk_clist_set_button_actions(GTK_CLIST(list),
108 2, GTK_BUTTON_SELECTS);
109 gtk_signal_connect(GTK_OBJECT(list),
"select_row",
149 for (p = g_list_first(
item_to_widgets); p != NULL; p = g_list_next(p) ) {
154 if (record->
it == op) {
180 if (g_list_find(x->
viewers, view) == NULL) {
203 item_and_widgets->
viewers = g_list_remove(item_and_widgets->
viewers, view_x);
211 item * op_mangled = op;
212 GList * search_return = NULL;
215 GList * victim_link = NULL;
230 if (victim != NULL) {
231 g_assert(victim_link != NULL);
244 g_assert(search_return == NULL);
261 gtk_clist_set_pixmap(GTK_CLIST(view->
list),
262 gtk_clist_find_row_from_data(GTK_CLIST(view->
list), item_x), 0,
322 gtk_clist_set_background (GTK_CLIST(list), row,
325 gtk_clist_set_background (GTK_CLIST(list), row,
330 gtk_clist_set_background (GTK_CLIST(list), row,
335 #define FMT_WEIGHT(buf, buf_size, it) snprintf(buf, buf_size, "%6.1f" , it->nrof * it->weight)
341 gfloat scrollbar_pos;
342 GtkWidget * scroll_window = NULL;
343 GtkWidget *
list = NULL;
346 g_assert(view != NULL);
354 gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(scroll_window))->value;
355 gtk_clist_freeze(GTK_CLIST(list));
356 gtk_clist_clear(GTK_CLIST(list));
358 columns[0] = buffer[0];
359 columns[1] = buffer[1];
361 for (it = view->
cont->
inv; it != NULL; it = it->
next) {
365 if (!view->
shows(it))
continue;
373 strcpy (buffer[0],
" ");
374 strcpy (buffer[1], it->
d_name);
377 strcat (buffer[1], it->
flags);
382 columns[2] = buffer[2];
387 row = gtk_clist_append(GTK_CLIST(list), columns);
390 gtk_clist_set_pixmap (GTK_CLIST (list), row, 0,
394 gtk_clist_set_row_data (GTK_CLIST(list), row, it);
405 gtk_clist_set_column_width(GTK_CLIST(list), 0, mw);
409 gtk_clist_set_row_height(GTK_CLIST(list), mh);
415 gtk_adjustment_set_value(
417 gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(scroll_window))
420 gtk_clist_thaw(GTK_CLIST(list));
497 gint row = gtk_clist_find_row_from_data(GTK_CLIST(
spellinventory), op);
499 gtk_clist_set_text(GTK_CLIST(
spellinventory), row, 1, op->d_name);
511 if (view->
cont == it) {
566 for (tmp_item = view->
cont->
inv; tmp_item != NULL; tmp_item = tmp_item->
next) {
567 if (tmp_item == it)
continue;
569 if (!view->
shows(it))
continue;
580 gtk_clist_set_column_width(GTK_CLIST(view->
list), 0, mw);
584 gtk_clist_set_row_height(GTK_CLIST(view->
list), mh);
591 gtk_clist_remove(GTK_CLIST(view->
list),
592 gtk_clist_find_row_from_data(GTK_CLIST(view->
list), op_x)
603 gint row = gtk_clist_find_row_from_data(GTK_CLIST(
spellinventory), op);
645 if (view->
cont == new_cont)
return;
648 view->
cont = new_cont;
660 gint row, gint column,
661 GdkEventButton *
event,
665 it = gtk_clist_get_row_data (GTK_CLIST(gtklist), row);
666 gtk_clist_unselect_row (GTK_CLIST(gtklist), row, 0);
668 if (event->button==1) {
669 if (event->state & GDK_SHIFT_MASK)
675 if (event->button==2) {
676 if (event->state & GDK_SHIFT_MASK)
681 if (event->button==3) {
683 draw_info (
"This item is locked. To drop it, first unlock by shift+leftclicking on it.",
689 gtk_spin_button_set_value(GTK_SPIN_BUTTON(
counttext),0.0);
715 #include "pixmaps/all.xpm"
716 #include "pixmaps/hand.xpm"
717 #include "pixmaps/hand2.xpm"
718 #include "pixmaps/coin.xpm"
719 #include "pixmaps/skull.xpm"
720 #include "pixmaps/mag.xpm"
721 #include "pixmaps/nonmag.xpm"
722 #include "pixmaps/lock.xpm"
723 #include "pixmaps/unlock.xpm"
777 GList ** victim_views_p = (GList **) victim_views_p_x;
778 if (g_list_find(*victim_views_p, view) == NULL) {
779 *victim_views_p = g_list_prepend(*victim_views_p, view);
783 static void nuke_view(gpointer view_x, gpointer notused) {
791 GList * victim_views = NULL;
804 g_list_foreach(victim_views,
nuke_view, NULL);
805 g_list_free(victim_views);
822 gint total_width = GPOINTER_TO_INT(total_width_x);
831 gtk_clist_set_column_width(GTK_CLIST(view->
list),
844 #define MAGIC_SAFE_WIDTH 75
847 static gint old_total_width = 0;
855 if (look_viewer == NULL)
return;
861 if (old_total_width == total_width)
return;
862 old_total_width = total_width;
879 if (view == look_viewer)
return TRUE;
882 for(i =
inv_viewers; i != NULL; i = g_list_next(i)) {
883 if (i->data == view) {
886 gtk_notebook_get_current_page(GTK_NOTEBOOK(
inv_notebook)));
923 GdkPixmap *labelgdkpixmap;
924 GdkBitmap *labelgdkmask;
933 gtk_notebook_set_tab_pos (GTK_NOTEBOOK (
inv_notebook), GTK_POS_TOP );
935 for (i = fixed_tabs; i - fixed_tabs <
TYPE_LISTS; i++) {
938 labelgdkpixmap = gdk_pixmap_create_from_xpm_d(
941 &tabstyle->bg[GTK_STATE_NORMAL],
944 tablabel = gtk_pixmap_new (labelgdkpixmap, labelgdkmask);
945 gtk_widget_show (tablabel);
963 gtk_signal_connect(GTK_OBJECT(view->
list),
972 gtk_clist_set_column_resizeable(GTK_CLIST(view->
list), 0,
FALSE);
973 gtk_clist_set_column_resizeable(GTK_CLIST(view->
list), 1,
FALSE);
974 gtk_clist_set_column_resizeable(GTK_CLIST(view->
list), 2,
FALSE);
979 gtk_signal_connect(GTK_OBJECT(view->
list),
980 "visibility-notify-event",
984 gtk_widget_add_events(view->
list, GDK_VISIBILITY_NOTIFY_MASK);
1027 strcpy (look_list.
title,
"You see:");
1035 vbox1 = gtk_vbox_new(
FALSE, 0);
1036 gtk_container_add (GTK_CONTAINER(frame), vbox1);
1038 hbox1 = gtk_hbox_new(
FALSE, 2);
1039 gtk_box_pack_start (GTK_BOX(vbox1),hbox1,
FALSE,
FALSE, 0);
1040 gtk_widget_show (hbox1);
1042 closebutton = gtk_button_new_with_label (
"Close");
1043 gtk_signal_connect_object (GTK_OBJECT (
closebutton),
"clicked",
1050 "This will close an item if you have one open.",
1053 look_list.
label = gtk_label_new (
"You see:");
1054 gtk_box_pack_start (GTK_BOX(hbox1),look_list.
label,
TRUE,
FALSE, 2);
1055 gtk_widget_show (look_list.
label);
1067 gtk_widget_show (vbox1);
1076 const gchar *count_text;
1079 count_text = gtk_entry_get_text(GTK_ENTRY(
counttext));
1081 gtk_widget_grab_focus (GTK_WIDGET(gtkwin_info_text));
1088 GtkWidget *invlabel;
1091 strcpy (inv_list.
title,
"Inventory:");
1099 vbox2 = gtk_vbox_new(
FALSE, 0);
1101 gtk_container_add (GTK_CONTAINER(frame), vbox2);
1103 hbox1 = gtk_hbox_new(
FALSE, 2);
1104 gtk_box_pack_start (GTK_BOX(vbox2),hbox1,
FALSE,
FALSE, 0);
1105 gtk_widget_show (hbox1);
1108 inv_list.
label = gtk_label_new (
"Inventory:");
1109 gtk_box_pack_start (GTK_BOX(hbox1),inv_list.
label,
TRUE,
FALSE, 2);
1110 gtk_widget_show (inv_list.
label);
1121 invlabel = gtk_label_new (
"Count:");
1122 gtk_box_pack_start (GTK_BOX(hbox1),invlabel,
FALSE,
FALSE, 5);
1123 gtk_widget_show (invlabel);
1125 adj = (GtkAdjustment *) gtk_adjustment_new (0.0, 0.0, 100000.0, 1.0,
1127 counttext = gtk_spin_button_new (adj, 1.0, 0);
1130 gtk_widget_set_usize (
counttext, 65, 0);
1131 gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (
counttext),
1133 gtk_signal_connect(GTK_OBJECT(
counttext),
"activate",
1142 "This sets the number of items you wish to pickup or drop. You can also use the keys 0-9 to set it.",
1146 gtk_widget_show (vbox2);
1156 if(params == NULL) {
1170 if (!strncmp(params, fixed_tabs[i].
name, strlen(params))) {
1191 strcpy(weight,l->
title);
1192 gtk_label_set (GTK_LABEL(l->
label), weight);
1193 gtk_widget_draw (l->
label, NULL);
1197 strcpy(weight,
" ");
1198 strcpy(max_weight,
" ");
1201 sprintf (weight,
"%6.1f",l->
env->
weight);
1202 strcpy (max_weight,
" ");
1204 sprintf (weight,
"%6.1f",l->
env->
weight);
1210 gtk_label_set (GTK_LABEL(l->
weightlabel), weight);
1260 if (s == NULL || *s == 0 || strncmp (
"inventory", s, strlen(s)) == 0) {
1264 }
else if (strncmp (
"look", s, strlen(s)) == 0) {
1289 if (l->
show_icon == new_setting)
return;
1292 if (l == &inv_list) {
1294 }
else if (l == &look_list) {
1297 g_assert(l == &inv_list || l == &look_list);
1305 if (s == NULL || *s == 0 || strncmp (
"inventory", s, strlen(s)) == 0) {
1307 }
else if (strncmp (
"look", s, strlen(s)) == 0) {
1317 item * new_look = (
item *)new_look_x;
1324 if (look_list.
env == op)
return;
1348 strcpy (look_list.
title,
"You see:");
1364 strcpy (look_list.
title,
"You see:");
char last_weight[MAX_BUF]
GtkWidget * scroll_window
Animations animations[MAXANIM]
static void redraw_on_show(GtkWidget *a, GdkEventVisibility *event, gpointer view_x)
static void set_look_list_env_one(gpointer view_x, gpointer new_look_x)
static GList * inv_viewers
static void close_container_callback(item *op)
static void set_show_weight_inv_one(gpointer view_x, gpointer new_setting)
static void item_tick_per_view(gpointer data, gpointer user_data_ignored)
static void highlight_item(GtkWidget *list, item *it, gint row)
static GList * animated_items
int can_write_spell_on(item *it)
void item_event_item_changed(item *op)
void set_look_list_env(item *op)
void set_show_icon(const char *s)
static bool show_unapplied(item *it)
void command_show(const char *params)
static void set_flags_one(gpointer view_x, gpointer show_flags)
static GtkWidget * get_look_widget(void)
static GtkWidget * get_inv_widget(void)
static GList * highlit_inv_viewers
char last_maxweight[MAX_BUF]
static void item_to_widget_remove_widget(inventory_viewer *view)
snd_pcm_hw_params_t * params
static inventory_viewer * new_inventory_viewer(item *container, itemfilter filter, item *move_dest)
#define CONFIG_APPLY_CONTAINER
void inventory_tick(void)
static GList * item_to_widgets
static void set_inv_flags(bool show_flags)
static inventory_viewer * look_viewer
struct item_struct * next
void update_list_labels(itemlist *l)
static void resize_left_widgets(GtkWidget *widget, GtkAllocation *event)
static void item_to_widget_remove_item(item *const op)
static bool show_unlocked(item *it)
void item_event_item_deleting(item *op)
static void item_changed_one(gpointer view_x, gpointer op_x)
static void inventory_viewer_set_show_flags(inventory_viewer *view, bool show_flags)
static bool show_unpaid(item *it)
PixmapInfo * pixmaps[MAXPIXMAPNUM]
static item_delete * item_to_widget_retrieve(item *op)
static void set_look_flags(bool show_flags)
static void count_callback(GtkWidget *widget, GtkWidget *entry)
static void item_to_widget_store(item *op, inventory_viewer *view)
GtkWidget * gtkwin_info_text
static void update_lists_labels(void)
void client_send_apply(int tag)
void set_show_weight(const char *s)
static GList * item_to_widget_retrieve_viewers(item *op)
static void container_clearing_one(gpointer view_x, gpointer op_x)
static void animate_items(void)
static bool view_visible(inventory_viewer *view)
static void list_button_event(GtkWidget *gtklist, gint row, gint column, GdkEventButton *event, inventory_viewer *view)
void set_weight_limit(uint32 wlim)
void close_container(item *op)
sint16 use_config[CONFIG_NUMS]
static void rebuild_our_widget(inventory_viewer *view)
void item_event_container_clearing(item *op)
void client_send_move(int loc, int tag, int nrof)
static void remove_widget_one(gpointer item_and_widget_x, gpointer view_x)
static bool show_locked(item *it)
static void inventory_viewer_set_show_weight(inventory_viewer *view, bool show_weight)
static bool show_nonmagical(item *it)
GtkWidget * maxweightlabel
static bool show_cursed(item *it)
void send_mark_obj(item *op)
void toggle_locked(item *op)
static void resize_left_widget_one(gpointer view_x, gpointer total_width_x)
void inventory_splitwin_toggling(void)
static GtkWidget * look_widget
GtkWidget * spellinventory
static fixed_tab_init fixed_tabs[TYPE_LISTS]
bool(* itemfilter)(item *it)
void get_look_display(GtkWidget *frame)
static void animate_item(gpointer view_x, gpointer item_x)
static GtkWidget * inv_notebook
static void inventory_viewer_set_container(inventory_viewer *view, item *new_cont)
static void item_deleting_one(gpointer view_x, gpointer op_x)
void client_send_examine(int tag)
void draw_info(const char *str, int color)
static void item_changed_anim_hook(item *op)
static bool show_applied(item *it)
void open_container(item *op)
static void nuke_view(gpointer view_x, gpointer notused)
static bool show_all(item *ignored)
static bool show_magical(item *it)
#define FMT_WEIGHT(buf, buf_size, it)
void get_inv_display(GtkWidget *frame)
static void itemview_tick(void)
static void animate_one_item(gpointer item_x, gpointer ignored)
static void add_removal_victim(gpointer view_x, gpointer victim_views_p_x)
static void inventory_viewer_set_highlight(inventory_viewer *view, bool highlight)
void itemlist_set_show_icon(itemlist *l, int new_setting)