Package biotext 0.1

Table of Contents

______________________________________________________________________________

Name

  biotext - Create and manipulate a characters matrix renderer widget.

Synopsis

biotext pathName ?options?

Standard Options

-anchor
-background, -bg 
-cursor
-cursorcolor
-foreground, -fg
-highlightbackground
-highlightcolor 
-highlightthickness
-insertbackground
-insertborderwidth
-insertofftime
-insertontime
-insertwidth
-invetselected
-relief
-takefocus 
-xscrollcommand 
-yscrollcommand

See the options manual entry for details on the standard options.

Widget-specific Options

Command-Line Name:-borderwidth or -bd
Database Name: borderWidth
Database Class: BorderWidth

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:-height
Database Name: height
Database Class: Height

Specifies 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:-width
Database Name: width
Database Class: Width

Specifies 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.

Description

The biotext command creates a new window (given by the pathName argument) and makes it into a character matrix widget. Additional options, described above may be specified on the command line or in the option database to configure aspects of the text such as its default background color and relief. The biotext command returns the path name of the new window.

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.

Indices

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. 

current
       Indicates the character cooresponding to the actual cursor position.

end

       Indicates the bottom right character of the matrix.

@x,y
        Indicates the character that covers the point in the biotext window             specified by x and y (in pixel coordinates). If no character covers that         point, then the closest character to that point is used.

In the widget command descriptions below, arguments named index, first, and last always contain text indices in one of the above forms.

Mappings

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.


Tags

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.


Widget Command

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 cget option   
    Returns the current value of the configuration option given by optionOption may have any of the values accepted by the biotext  command.

pathName chars char index ?count? ?last?
    Insert count characters specified by char at position specified by index

pathName configure ?option? ?value option value ...?
    Query or modify the configuration options of the widget. If no option is specified, returns a list describing all of the available options for pathName (see Tk_ConfigureInfo for information on the format of this list). If option is specified with no value, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no option is specified). If one or more option-value pairs are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the command returns an empty string. Option may have any of the values accepted by the biotext command.

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 delete rows index
       Deletes  the row at position given by index. index should be an integer or end.

pathName
font ?family <family>? ?size <size>? ?weight <weight>?
   
Defines the font to use to display the character matrix. At least one of the family, size, or weight arguement should be present. See the Tk font command for values accepted by these arguements.

pathName font bigger|smaller
   
Increases or decreases the actual font size.

pathName
group ?-merge|-new? group-name rowList  
    All sequences at row indices specified by rowList will be flagged as belonging to the same group named as group-name. group-name should be an integer different from 0.
pathName index index
    Returns the index in a row,col form that corresponds to index

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.


Default Bindings

The initialization creates class bindings that gives the following default behaviour:

[1]
Clicking Button-1 sets the blinking cursor to that position.
[2]
The left, right, up and down arrows move the blinking cursor accordingly.
[3]
<Backspace> deletes the character before the blinking cursor. In lock mode, only gap characters can be deleted. 
[4]
Shift-Right pushes contiguous characters placed at the right of the blinking cursor up to the next gap character.
[5]
Shift-Left pushes contiguous characters placed at the left of the blinking cursor up to the next gap character.

[6]
Pressing KeyPad or keyboard numbers stores the number in a buffer, i.e. pressing "1" then "2" will store number 12 in the buffer. Pressing then the <Left> arrow will move the cursor 12 characters to the left, and will empty the buffer.

Keywords

widget, extension


Top               Luc Moulinier Tcl/Tk