File: window_board.h

package info (click to toggle)
tenace 0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 1,440 kB
  • ctags: 543
  • sloc: ansic: 5,303; sh: 3,683; makefile: 98
file content (94 lines) | stat: -rw-r--r-- 2,241 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#ifndef WINDOW_CARD_H
#define WINDOW_CARD_H

#include "../handdisplay/hand_display.h"

#include "bridge.h"

/* defines */

#define CUR_BOARD (win->boards[win->cur])

/* make sure some code is not called twice */
#define PROTECT_BEGIN do { if (protect++) return; } while (0)
#define PROTECT_BEGIN_BOOL do { if (protect++) return FALSE; } while (0)
#define PROTECT_END do { protect = 0; } while (0)
#define PROTECT_RETURN do { protect = 0; return; } while (0)

/* types */

typedef struct _window_board_t {
	/* GTK */
	GtkWidget *window;
	GtkStatusbar *statusbar;
	GtkWidget *board_menu;
	HandDisplay *handdisp[4];
	HandDisplay *table;

	/* bidding display */
	GtkTreeView *bidding;
	GtkListStore *bidding_store;
	GtkTreeViewColumn *bidding_column[4];
	GtkWidget *bidding_header[4];

	/* config */
	GKeyFile *keyfile;
	int show_played_cards;
	seat show_hands;
	seat show_dd_scores;
	int hand_display_style;
	char *svg;
	int card_width;

	/* boards */
	char *filename;
	char *title, *subtitle, *team1, *team2;

	int n_boards;
	int n_boards_alloc;
	int cur;
	board **boards;

	board *cutbuf;

} window_board_t;

typedef enum _redraw_t {
	REDRAW_TITLE		= 1 << 0,
	REDRAW_NAMES		= 1 << 1,
	REDRAW_CONTRACT		= 1 << 2,
	REDRAW_TRICKS		= 1 << 3,
	REDRAW_HANDS		= 1 << 4,
	REDRAW_PAR		= 1 << 5,
	REDRAW_PLAY		= 1 << 6,
	REDRAW_BIDDING		= 1 << 7,
	REDRAW_BOARD		= 0xff, /* everything above */
	REDRAW_BOARD_LIST	= 1 << 8, /* menu */
	REDRAW_FULL		= 0x1ff, /* everything above */
	REDRAW_BIDDING_SCROLL	= 1 << 9,
} redraw_t;

/* global variable */

extern window_board_t *win;
extern int protect; /* inhibit infinite loops in handlers */

/* interface */

void show_board (board *b, redraw_t redraw);
void recently_used_add (char *filename);

int board_window_append_board (window_board_t *win, board *b); /* returns number of appended board */
void board_window_init ();
void board_window_set_style (window_board_t *win, int style);
void board_statusbar(char *text);

/* stubs for calls from gui */
void board_set_declarer (seat declarer);
void board_set_dealer (seat dealer);
void board_set_trumps (suit trumps);
void board_set_level (int level);
void board_set_vuln (int ns, int ew);
void board_set_doubled (int doubled);

#endif /* WINDOW_CARD_H */