summaryrefslogtreecommitdiff
path: root/sys/src/cmd/spred/dat.h
blob: df20ee4639958f715a66bd7a53cb6135dcc7ac60 (plain)
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
95
96
97
98
typedef struct Ident Ident;
typedef struct Win Win;
typedef struct Wintab Wintab;
typedef struct Pal Pal;
typedef struct Spr Spr;
typedef struct File File;

enum {
	BORDSIZ = 5,
	MINSIZ = 3 * BORDSIZ,
	SELSIZ = 2,
	SCRBSIZ = 11,
	SCRTSIZ = 14,
	RUNEBLK = 4096,
};

enum {
	DISB = NCOL,
	NCOLS
};

enum {
	CMD,
	PAL,
	SPR,
	NTYPES
};

struct Wintab {
	int (*init)(Win *);
	void (*die)(Win *);
	void (*click)(Win *, Mousectl *);
	void (*menu)(Win *, Mousectl *);
	int (*rmb)(Win *, Mousectl *);
	void (*key)(Win *, Rune);
	void (*draw)(Win *);
	void (*zerox)(Win *, Win *);
	u32int hexcols[NCOLS];
	Image *cols[NCOLS];
};

struct Win {
	Rectangle entire;
	Rectangle inner;
	Image *im;
	Win *next, *prev;
	Win *wnext, *wprev;
	int type;
	Wintab *tab;
	
	Frame fr;
	Rune *runes;
	int nrunes, arunes, opoint;
	int toprune;
	
	int zoom;
	Point scr;
	File *f;
	Rectangle sprr;
};

struct Ident {
	uint type, dev;
	Qid;
};

struct File {
	int type;
	Ref;
	File *next, *prev;
	char *name;
	int change;
	Ident id;
	Win wins;
};

struct Pal {
	File;
	int ncol;
	u32int *cols;
	Image **ims;
	int sel;
};

struct Spr {	
	File;
	Pal *pal;
	int w, h;
	u32int *data;
	char *palfile;
};

extern Win wlist;
extern File flist;
extern Win *actw, *actf, *cmdw;
extern Screen *scr;
extern Image *invcol;
extern int quitok;