|
Crossfire Client, Trunk
R18666
|
#include <gtk/gtk.h>#include <glade/glade.h>#include "client.h"#include "main.h"#include "image.h"#include "gtk2proto.h"#include "../../pixmaps/all.xpm"#include "../../pixmaps/coin.xpm"#include "../../pixmaps/hand.xpm"#include "../../pixmaps/hand2.xpm"#include "../../pixmaps/lock.xpm"#include "../../pixmaps/mag.xpm"#include "../../pixmaps/nonmag.xpm"#include "../../pixmaps/skull.xpm"#include "../../pixmaps/unlock.xpm"#include "../../pixmaps/unidentified.xpm"
Go to the source code of this file.
Data Structures | |
| struct | Notebook_Info |
Defines | |
| #define | MAX_INV_COLUMNS 20 |
| #define | MAX_INV_ROWS 100 |
| #define | NUM_INV_LISTS 11 |
| #define | INV_SHOW_ITEM 0x1 |
| #define | INV_SHOW_COLOR 0x2 |
| #define | ITEM_INVENTORY 0x1 |
| #define | ITEM_GROUND 0x2 |
| #define | ITEM_IN_CONTAINER 0x4 |
| #define | INVHELPTEXT "Left click examines the object. Middle click applies \the object. Right click drops the object. Shift left click locks/unlocks the \object. Shift middle click marks the object" |
Enumerations | |
| enum | Styles { Style_Magical = 0, Style_Cursed, Style_Unpaid, Style_Locked, Style_Applied, Style_Last, Style_Attuned, Style_Repelled, Style_Denied, Style_Normal, Style_Last } |
| enum | { INV_TREE, INV_TABLE } |
| enum | { LIST_NONE, LIST_ICON, LIST_NAME, LIST_WEIGHT, LIST_OBJECT, LIST_BACKGROUND, LIST_TYPE, LIST_BASENAME, LIST_FOREGROUND, LIST_FONT, LIST_NUM_COLUMNS } |
Functions | |
| gboolean | list_selection_func (GtkTreeSelection *selection, GtkTreeModel *model, GtkTreePath *path, gboolean path_currently_selected, gpointer userdata) |
| void | list_row_collapse (GtkTreeView *treeview, GtkTreeIter *iter, GtkTreePath *path, gpointer user_data) |
| void | inventory_get_styles (void) |
| void | inventory_init (GtkWidget *window_root) |
| void | set_show_icon (const char *s) |
| void | set_show_weight (const char *s) |
| void | close_container (item *op) |
| void | open_container (item *op) |
| void | command_show (const char *params) |
| void | set_weight_limit (uint32 wlim) |
| void | item_event_item_deleting (item *it) |
| void | item_event_container_clearing (item *container) |
| void | item_event_item_changed (item *it) |
| void | draw_look_list (void) |
| void | draw_inv_list (int tab) |
| gboolean | drawingarea_inventory_table_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data) |
| gboolean | drawingarea_inventory_table_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data) |
| void | draw_inv_table (int animate) |
| void | draw_inv (int tab) |
| void | draw_lists (void) |
| void | on_notebook_switch_page (GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, gpointer user_data) |
| gboolean | on_inv_table_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer user_data) |
| void | animate_inventory (void) |
| void | animate_look (void) |
| void | inventory_tick (void) |
Variables | |
| const char *const | rcsid_gtk2_inventory_c = "$Id: inventory.c 18546 2012-12-01 10:07:28Z ryo_saeba $" |
| GtkWidget * | inv_notebook |
| GtkWidget * | treeview_look |
| GtkWidget * | encumbrance_current |
| GtkWidget * | encumbrance_max |
| GtkWidget * | inv_table |
| GtkTreeStore * | store_look |
| GtkWidget * | inv_table_children [MAX_INV_ROWS][MAX_INV_COLUMNS] |
| Notebook_Info | inv_notebooks [NUM_INV_LISTS] |
Covers drawing of the inventory and look windows.
Definition in file inventory.c.
| #define INV_SHOW_COLOR 0x2 |
Definition at line 92 of file inventory.c.
| #define INV_SHOW_ITEM 0x1 |
Definition at line 91 of file inventory.c.
| #define INVHELPTEXT "Left click examines the object. Middle click applies \the object. Right click drops the object. Shift left click locks/unlocks the \object. Shift middle click marks the object" |
Definition at line 855 of file inventory.c.
| #define ITEM_GROUND 0x2 |
Definition at line 149 of file inventory.c.
| #define ITEM_IN_CONTAINER 0x4 |
Definition at line 150 of file inventory.c.
| #define ITEM_INVENTORY 0x1 |
Definition at line 148 of file inventory.c.
| #define MAX_INV_COLUMNS 20 |
Definition at line 68 of file inventory.c.
| #define MAX_INV_ROWS 100 |
Definition at line 69 of file inventory.c.
| #define NUM_INV_LISTS 11 |
Definition at line 90 of file inventory.c.
| anonymous enum |
Definition at line 94 of file inventory.c.
| anonymous enum |
| LIST_NONE | |
| LIST_ICON | |
| LIST_NAME | |
| LIST_WEIGHT | |
| LIST_OBJECT | |
| LIST_BACKGROUND | |
| LIST_TYPE | |
| LIST_BASENAME | |
| LIST_FOREGROUND | |
| LIST_FONT | |
| LIST_NUM_COLUMNS |
Definition at line 143 of file inventory.c.
| enum Styles |
| Style_Magical | |
| Style_Cursed | |
| Style_Unpaid | |
| Style_Locked | |
| Style_Applied | |
| Style_Last | |
| Style_Attuned | |
| Style_Repelled | |
| Style_Denied | |
| Style_Normal | |
| Style_Last |
Definition at line 73 of file inventory.c.
| void animate_inventory | ( | void | ) |
Definition at line 1107 of file inventory.c.


| void animate_look | ( | void | ) |
| void close_container | ( | item * | op | ) |
Open and close_container are now no-ops - since these are now drawn inline as treestores, we don't need to update what we are drawing were. and since the activation of a container will cause the list to be redrawn, don't need to worry about making an explicit call here.
| op |
Definition at line 567 of file inventory.c.


| void command_show | ( | const char * | params | ) |
| params |
Definition at line 585 of file inventory.c.

| void draw_inv | ( | int | tab | ) |
Draws the inventory and updates the encumbrance statistics display in the client. Have to determine how to draw it.
| tab |
Definition at line 1022 of file inventory.c.


| void draw_inv_list | ( | int | tab | ) |
Draws the inventory window. tab is the notebook tab we are drawing. Has to be passed in because the callback sets this before the notebook is updated.
| tab |
Definition at line 762 of file inventory.c.

| void draw_inv_table | ( | int | animate | ) |
Draws the table of image icons.
| animate | If non-zero, then this is an animation run - flip the animation state of the objects, and only draw those that need to be drawn. |
Definition at line 865 of file inventory.c.


| void draw_lists | ( | void | ) |
Redraws inventory and look windows when necessary
Definition at line 1040 of file inventory.c.


| void draw_look_list | ( | void | ) |
Draws the objects beneath the player.
Definition at line 726 of file inventory.c.

| gboolean drawingarea_inventory_table_button_press_event | ( | GtkWidget * | widget, |
| GdkEventButton * | event, | ||
| gpointer | user_data | ||
| ) |
| widget | |
| event | |
| user_data |
Definition at line 819 of file inventory.c.

| gboolean drawingarea_inventory_table_expose_event | ( | GtkWidget * | widget, |
| GdkEventExpose * | event, | ||
| gpointer | user_data | ||
| ) |
| widget | |
| event | |
| user_data |
Definition at line 835 of file inventory.c.

| void inventory_get_styles | ( | void | ) |
Gets the style information for the inventory windows. This is a separate function because if the user changes styles, it can be nice to re-load the configuration. The style for the inventory/look is a bit special. That is because with gtk, styles are widget wide - all rows in the widget would use the same style. We want to adjust the styles based on other attributes.
Definition at line 401 of file inventory.c.


| void inventory_init | ( | GtkWidget * | window_root | ) |
Set up the inventory viewer.
| window_root | The client main window. |
Definition at line 428 of file inventory.c.


| void inventory_tick | ( | void | ) |
This is called periodically from main.c - basically a timeout, used to animate the inventory.
Definition at line 1232 of file inventory.c.


| void item_event_container_clearing | ( | item * | container | ) |
| void item_event_item_changed | ( | item * | it | ) |
| void item_event_item_deleting | ( | item * | it | ) |
| void list_row_collapse | ( | GtkTreeView * | treeview, |
| GtkTreeIter * | iter, | ||
| GtkTreePath * | path, | ||
| gpointer | user_data | ||
| ) |
If the player collapses the row with the little icon, we have to unapply the object for things to work 'sanely' (eg, items not go into the container
| treeview | |
| iter | |
| path | |
| user_data |
Definition at line 289 of file inventory.c.


| gboolean list_selection_func | ( | GtkTreeSelection * | selection, |
| GtkTreeModel * | model, | ||
| GtkTreePath * | path, | ||
| gboolean | path_currently_selected, | ||
| gpointer | userdata | ||
| ) |
Used when a button is pressed on the inventory or look list. The parameters are those determined by the callback. Note that this function isn't 100% ideal - some of the events/handling is only relevant for objects in the inventory and not the look window (eg, locking items). OTOH, maybe it is just as well that the behaviour is always consistent.
| selection | |
| model | |
| path | |
| path_currently_selected | |
| userdata |
Definition at line 244 of file inventory.c.

| gboolean on_inv_table_expose_event | ( | GtkWidget * | widget, |
| GdkEventExpose * | event, | ||
| gpointer | user_data | ||
| ) |
| widget | |
| event | |
| user_data |
Definition at line 1096 of file inventory.c.


| void on_notebook_switch_page | ( | GtkNotebook * | notebook, |
| GtkNotebookPage * | page, | ||
| guint | page_num, | ||
| gpointer | user_data | ||
| ) |
People are likely go to the different tabs much less often than their inventory changes. So rather than update all the tabs whenever the players inventory changes, only update the tab the player is viewing, and if they change tabs, draw the new tab and get rid of the old info. Ideally, I'd like to call draw_inv() from this function, but there is some oddity
| notebook | |
| page | |
| page_num | |
| user_data |
Definition at line 1075 of file inventory.c.

| void open_container | ( | item * | op | ) |
| op |
Definition at line 576 of file inventory.c.


| void set_show_icon | ( | const char * | s | ) |
| s |
Definition at line 547 of file inventory.c.
| void set_show_weight | ( | const char * | s | ) |
| s |
Definition at line 555 of file inventory.c.
| void set_weight_limit | ( | uint32 | wlim | ) |
No reason to divide by 1000 everytime we do the display, so do it once and store it here.
| wlim |
Definition at line 617 of file inventory.c.

| GtkWidget* encumbrance_current |
Definition at line 56 of file inventory.c.
| GtkWidget* encumbrance_max |
Definition at line 57 of file inventory.c.
| GtkWidget* inv_notebook |
Definition at line 54 of file inventory.c.
{
{"all", "All Items", all_xpm, show_all, INV_TREE},
{"applied", "Applied Items", hand_xpm, show_applied, INV_TREE},
{"unapplied", "Unapplied Items", hand2_xpm, show_unapplied, INV_TREE},
{"unpaid", "Unpaid items", coin_xpm, show_unpaid, INV_TREE},
{"cursed", "Cursed items", skull_xpm, show_cursed, INV_TREE},
{"magical", "Magical items", mag_xpm, show_magical, INV_TREE},
{"nonmagical", "Nonmagical items", nonmag_xpm, show_nonmagical, INV_TREE},
{"locked", "Inventory locked items", lock_xpm, show_locked, INV_TREE},
{"unlocked", "Inventory unlocked items",unlock_xpm, show_unlocked, INV_TREE},
{"unidentified", "Inventory unidentified items", unidentified_xpm, show_unidentified, INV_TREE},
{"icons", "Quick icon view", NULL, show_all, INV_TABLE}
}
Definition at line 129 of file inventory.c.
| GtkWidget* inv_table |
Definition at line 58 of file inventory.c.
| GtkWidget* inv_table_children[MAX_INV_ROWS][MAX_INV_COLUMNS] |
Definition at line 70 of file inventory.c.
| const char* const rcsid_gtk2_inventory_c = "$Id: inventory.c 18546 2012-12-01 10:07:28Z ryo_saeba $" |
Definition at line 1 of file inventory.c.
| GtkTreeStore* store_look |
Definition at line 59 of file inventory.c.
| GtkWidget* treeview_look |
Definition at line 55 of file inventory.c.
1.7.6.1