3 frinit, frsetrects, frinittick, frclear, frcharofpt, frptofchar, frinsert, frdelete, frselect, frtick, frselectpaint, frdrawsel, frdrawsel0, frgetmouse \- frames of text
20 void frinit(Frame *f, Rectangle r, Font *ft, Image *b, Image **cols)
23 void frsetrects(Frame *f, Rectangle r, Image *b)
26 void frinittick(Frame *f)
29 void frclear(Frame *f, int resize)
32 ulong frcharofpt(Frame *f, Point pt)
35 Point frptofchar(Frame *f, ulong p)
38 void frinsert(Frame *f, Rune *r0, Rune *r1, ulong p)
41 int frdelete(Frame *f, ulong p0, ulong p1)
44 void frselect(Frame *f, Mousectl *m)
47 void frtick(Frame *f, Point pt, int up)
50 void frselectpaint(Frame *f, Point p0, Point p1, Image *col)
53 void frdrawsel(Frame *f, Point pt0, ulong p0, ulong p1,
58 void frdrawsel0(Frame *f, Point pt0, ulong p0, ulong p1,
60 Image *back, Image *text)
75 of editable text in a single font on raster displays, such as in
79 Frames may hold any character except NUL (0).
80 Long lines are folded and tabs are at fixed intervals.
82 The user-visible data structure, a
88 .ta 6n +\w'Rectangle 'u +\w'lastlinefull; 'u
89 typedef struct Frame Frame;
92 Font *font; /* of chars in the frame */
93 Display *display; /* on which frame appears */
94 Image *b; /* on which frame appears */
95 Image *cols[NCOL]; /* text and background colors */
96 Rectangle r; /* in which text appears */
97 Rectangle entire; /* of full frame */
99 ulong p0, p1; /* selection */
101 ushort maxtab; /* max size of tab, in pixels */
102 ushort nchars; /* # runes in frame */
103 ushort nlines; /* # lines with text */
104 ushort maxlines; /* total # lines in frame */
105 ushort lastlinefull; /* last line fills frame */
106 ushort modified; /* changed since frselect() */
107 Image *tick; /* typing tick */
108 Image *tickback; /* saved image under tick */
109 int ticked; /* flag: is tick onscreen? */
114 is an internal type and is not used by the interface.
118 may be changed by the application provided the selection routines are called
119 afterwards to maintain a consistent display.
121 determines the size of tab stops.
123 sets it to 8 times the width of a
126 character in the font;
127 it may be changed before any text is added to the frame.
128 The other elements of the structure are maintained by the library and
129 should not be modified directly.
131 The text within frames
132 is not directly addressable;
133 instead frames are designed to work alongside
134 another structure that holds the text.
135 The typical application is to display a section of a longer document such
136 as a text file or terminal session.
137 Usually the program will keep its own copy of the
138 text in the window (probably as
141 and pass components of this text to the frame routines to
142 display the visible portion.
143 Only the text that is visible is held by the
145 the application must check
150 to determine, for example, whether new text needs to be appended
157 There are no routines in the library to allocate
159 instead the interface assumes that
161 will be components of larger structures.
166 so characters drawn in it will appear
174 to initialize the geometry for the
184 defines the limit of the portion of the
186 the text will occupy.
190 may be null, allowing the other routines to be called to maintain the
191 associated data structure in, for example, an obscured window.
195 cols sets the colors in which text and borders will be drawn. The background of the frame will be drawn in
197 the background of highlighted text in
199 borders and scroll bar in
203 and highlighted text in
207 frees the internal structures associated with
215 It does not clear the associated display.
218 is to be deallocated, the associated
222 must be freed separately.
225 argument should be non-zero if the frame is to be redrawn with
226 a different font; otherwise the frame will maintain some
227 data structures associated with the font.
237 (q.v.) to recreate the display.
240 is being moved but not resized, that is, if the shape of its containing
241 rectangle is unchanged, it is sufficient to use
243 to copy the containing rectangle from the old to the new location and then call
245 to establish the new geometry.
246 (It is unnecessary to call
248 unless the font size has changed.)
249 No redrawing is necessary.
255 returns the location of the upper left corner of the
257 rune, starting from 0, in the
266 returns the location of the upper right corner of the last character in
270 returns the index of the closest rune whose image's upper left corner
271 is up and to the left of
278 starting at rune index
284 If a NUL (0) character
285 is inserted, chaos will ensue.
287 are handled by the library, but all other characters,
288 including control characters, are just displayed.
289 For example, backspaces are printed; to erase
301 points at the first rune beyond the deletion.
304 tracks the mouse to select a contiguous string of text in the
306 When called, a mouse button is typically down.
308 will return when the button state has changed (some buttons may
309 still be down) and will set
313 to the selected range of text.
315 Programs that wish to manage the selection themselves have several routines to help.
316 They involve the maintenance of the `tick', the vertical line indicating a null selection
317 between characters, and the colored region representing a non-null selection.
321 is non-zero) or removes (if
323 is zero) the tick at the screen position indicated by
326 repaints a section of the frame, delimited by character positions
330 either with plain background or
331 entirely highlighted, according to the flag
333 managing the tick appropriately.
336 is the geometrical location of
338 on the screen; like all of the selection-helper routines'
340 arguments, it must be a value generated by
343 is a lower-level routine, taking as arguments a background color,
347 It assumes that the tick is being handled (removed beforehand, replaced afterwards, as required)
352 to paint a region of the frame defined by the
358 .B /usr/local/plan9/src/libframe