biotext - Create and manipulate a characters matrix renderer widget.
biotext pathName ?options?
See the options manual entry for details on the standard options.
Specifies a non-negative pixel value or list of values indicating the width of the 3-D border to draw on interior table cells (if such a border is being drawn; the relief option typically determines this). If one value is specified, a rectangle of this width will be drawn. If two values are specified, then only the left and right edges of the cell will have borders. If four values are specified, then the values correspond to the {left right top bottom} edges. This can be overridden by the a tag's borderwidth option. It can also be affected by the defined -drawmode for the table. Each value in the list must have one of the forms acceptable to Tk_GetPixels.
Command-Line Name:-heightSpecifies the desired height for the window, in characters. If zero or less, then the desired height for the window is made just large enough to hold all the rows in the table. The height can be further limited by -maxheight.
Command-Line Name:-widthSpecifies the desired width for the window, in columns. If zero or less, then the desired width for the window is made just large enough to hold all the columns in the table. The width can be further limited by -maxwidth.
A biotext widget displays a
matrix of characters and allow that matrix to be edited. Each kind of
character in the matrix can be tagged according to a tag map. A tag
associates a foreground and a background color to a given character.
Some of the widget commands take one or more indices as arguments. An index specifies a particular character in the matrix, in any of the following ways:
number,number
Specifies the character as a
numerical index of row,col.
A mapping is specified as a list of three elements : a character, a pair of two colors, one specifying the foreground, one specifying the background. A mapping is then a list of lists and is passed to the command pathname mapping.
The widget supports a tagging system like the text widget, although far less extended. A tag is defined by its name, the foreground color and the background color.
The biotext command creates a new Tcl command whose name is pathName.
This command may be used to invoke various operations on the widget.
It has the following general form:
pathName command
?arg arg ...?
Command and the args
determine the exact behavior of
the command.
The following commands are possible for biotext widgets:
pathName addseqs seq-list index
Inserts the sequences present in seq-list just below the row
specified by index. If
the widget contains no sequences, the command returns an error. The
inserted sequences should have the same length as the one already
present in the widget.
pathName chars char index ?count? ?last?
Insert count
characters specified by char
at position specified by index
.
pathName copy rowList
Copy each sequence indexed by the row indices of rowList into a temporary buffer. rowList is a Tcl list of integers
corresponding to the row position of the sequence to be copied, first
sequence having the index 0. However the last sequence can be specify
through the position end. Note
that copying sequences into the cut/copy/paste buffer will override the
sequence(s) present in the buffer if any.
pathName cursor ?index?
Sets or retrieves the current cursor position. If index is omitted, the command
returns the cursor postion in the form row,col. If index is a valid index, then the
cursor is set to index.
pathName cut rowList
Cuts each sequence indexed by the row indices of rowList from the widget and stores
them into a temporary buffer. rowList
is a Tcl list of integers corresponding to the row position of the
sequence to be cut, first sequence having the index 0. However the
last sequence can be specify through the position end. Note that cutting sequences
will override the sequence(s) present in the buffer if any.
pathName delchars ?-group?
index ?count?
Deletes count
characters before index. If -group is specified, then deletes
count characters for all sequences belonging to the same group of the
sequence specified by index.
Default count is 1.
pathName delete
option ?arg?
This command is used to delete columns of gaps or
characters depending of the option
flag.
pathName delete
colsgaps
Deletes all columns of the matrix
that contain only gap character.
pathName delete cols index
Deletes the colmn at
position given by index.
index should be an integer or end.
pathName insert option arg ?arg?
This command is used to insert sequences or columns into the
widget.
pathName insert cols colIndex
?count?
Inserts count columns of gaps. Insertion is
done before colIndex if count is negative, after colIndex if count is positive. colIndex should be an integer or
the keyword end. By default, count is set to 1.
pathName insert rows rowIndex
?count?
Inserts count sequences (rows) of gaps.
Insertion is done before rowIndex
if count is negative, after rowIndex if count is positive. rowIndex should be an integer or
the keyword end. By default, count is set to 1.
pathName lock
boolean
Locks or unlocks the character matrix depending
on boolean. If the character
matrix is in lock mode, only gap characters can be deleted.
pathName map
boolean
Enable or disable character mapping depending on boolean. If true, all characters of the widget are redraw using foreground and background colors specified with the mapping
command. If false, all characters are drawn using the -foreground and -background color of the widget.
pathName mapping mapList
Defines the character mapping to be used in the window. mapList is a list of {char foreground background} lists. Each sublist discribes how char should be rendered. Defining a new mapping will erase a previously defined one.
pathName output <all|rowList>
The command returns a Tcl list of all sequences (rows) or sequences with row indices specified in rowList. rowList should be a Tcl list containing integers only.
pathName paste rowIndex
Paste sequences present in the temporary buffer below the row specified by rowIndex. The length of the rows are adjusted to the longest between buffer and widget rows.
pathName push <left|right>
Push contiguous characters starting at the current index to the left or to the right up to the next gap character. If the sequence at the current index belongs to a group, then push all sequences of the group to the next gap character common to all sequences of the group.
pathName see index
Adjust the view in the biotext widget so that the character given by index is
positioned, if possible, in the center of the widget.
pathName sequences sequenceList
Feeds the biotext widget with sequences. sequenceList is a Tcl list of
strings of equal length.
pathName tag configure tagName -foreground fgColor -background bgColor
Define a new tag. All keywords are compulsory for tag definition.
pathName tag add tagName index1 index2 ?index1 index2 ...?
Add the tag defined by tagName to the zones defined by index1 and index2.
pathName tag delete ?tagName?
Delete all, or tagName tag definition, and remove them from the widget.
pathName tag remove ?tagName?
Remove all or tagName tag from the widget.
pathName tag state boolean
Switch the display of all the tags defined and added to the widget.
pathName ungroup rowList
Unset group flag for all sequences whose row index belongs to rowList. rowList should be a Tcl list containing only integers. If a group contains only one sequence, then the group is discarded and the group flag of that sequence is unset.
pathName xview args
This command is used to query and change the
horizontal position
of the information in the widget's window. It can take any of
the following forms:
pathName xview
Returns a list containing two
elements. Each element is
a real fraction between 0 and 1; together they describe
the horizontal span that is visible in the window. For
example, if the first element is .2 and the second element
is .6, 20% of the biotext's matrix is off-screen to the
left, the middle 40% is visible in the window, and 40% of
the matrix is off-screen to the right. These are the same
values passed to scrollbars via the -xscrollcommand
option.
pathName xview index
Adjusts the view in the window so
that the column given
by index is displayed at the left edge of the window.
pathName xview moveto fraction
Adjusts the view in the window so
that fraction of the
total width of the table text is off-screen to the left.
fraction must be a fraction between 0 and 1.
pathName xview scroll number
what
This command shifts the view in
the window left or right
according to number and what. Number must be an
integer.
What must be either units or pages or an
abbreviation of
one of these. If what is units, the view adjusts left
or
right by number cells on the display; if it is pages
then
the view adjusts by number screenfuls. If number is
negative
then cells farther to the left become visible;
if
it is positive then cells farther to the right become
visible.
pathName yview ?args?
This command is used to query and change the
vertical position
of the text in the widget's window. See xview command for an explanation of
the forms this command could take.
The initialization creates class bindings that gives the following default behaviour:
widget, extension