Blob


1 typedef struct Frbox Frbox;
2 typedef struct Frame Frame;
4 enum{
5 BACK,
6 HIGH,
7 BORD,
8 TEXT,
9 HTEXT,
10 NCOL
11 };
13 #define FRTICKW 3
15 struct Frbox
16 {
17 long wid; /* in pixels */
18 long nrune; /* <0 ==> negate and treat as break char */
19 uchar *ptr;
20 short bc; /* break char */
21 short minwid;
22 };
24 struct Frame
25 {
26 Font *font; /* of chars in the frame */
27 Display *display; /* on which frame appears */
28 Image *b; /* on which frame appears */
29 Image *cols[NCOL]; /* text and background colors */
30 Rectangle r; /* in which text appears */
31 Rectangle entire; /* of full frame */
32 void (*scroll)(Frame*, int); /* scroll function provided by application */
33 Frbox *box;
34 ulong p0, p1; /* selection */
35 ushort nbox, nalloc;
36 ushort maxtab; /* max size of tab, in pixels */
37 ushort nchars; /* # runes in frame */
38 ushort nlines; /* # lines with text */
39 ushort maxlines; /* total # lines in frame */
40 ushort lastlinefull; /* last line fills frame */
41 ushort modified; /* changed since frselect() */
42 Image *tick; /* typing tick */
43 Image *tickback; /* saved image under tick */
44 int ticked; /* flag: is tick onscreen? */
45 };
47 ulong frcharofpt(Frame*, Point);
48 Point frptofchar(Frame*, ulong);
49 int frdelete(Frame*, ulong, ulong);
50 void frinsert(Frame*, Rune*, Rune*, ulong);
51 void frselect(Frame*, Mousectl*);
52 void frselectpaint(Frame*, Point, Point, Image*);
53 void frdrawsel(Frame*, Point, ulong, ulong, int);
54 void frdrawsel0(Frame*, Point, ulong, ulong, Image*, Image*);
55 void frinit(Frame*, Rectangle, Font*, Image*, Image**);
56 void frsetrects(Frame*, Rectangle, Image*);
57 void frclear(Frame*, int);
59 uchar *_frallocstr(Frame*, unsigned);
60 void _frinsure(Frame*, int, unsigned);
61 Point _frdraw(Frame*, Point);
62 void _frgrowbox(Frame*, int);
63 void _frfreebox(Frame*, int, int);
64 void _frmergebox(Frame*, int);
65 void _frdelbox(Frame*, int, int);
66 void _frsplitbox(Frame*, int, int);
67 int _frfindbox(Frame*, int, ulong, ulong);
68 void _frclosebox(Frame*, int, int);
69 int _frcanfit(Frame*, Point, Frbox*);
70 void _frcklinewrap(Frame*, Point*, Frbox*);
71 void _frcklinewrap0(Frame*, Point*, Frbox*);
72 void _fradvance(Frame*, Point*, Frbox*);
73 int _frnewwid(Frame*, Point, Frbox*);
74 int _frnewwid0(Frame*, Point, Frbox*);
75 void _frclean(Frame*, Point, int, int);
76 void _frredraw(Frame*, Point);
77 void _fraddbox(Frame*, int, int);
78 Point _frptofcharptb(Frame*, ulong, Point, int);
79 Point _frptofcharnb(Frame*, ulong, int);
80 int _frstrlen(Frame*, int);
81 void frtick(Frame*, Point, int);
82 void frinittick(Frame*);
84 #define NRUNE(b) ((b)->nrune<0? 1 : (b)->nrune)
85 #define NBYTE(b) strlen((char*)(b)->ptr)