Next Previous Contents

12. Screen Management Module

The slsmg module provides access to SLsmg routines, which is an interface to platform indepented routines for manipulating the display on a terminal. It may be loaded using require("slsmg").

12.1 slsmg_suspend_smg

Synopsis

Suspend screen management

Usage

slsmg_suspend_smg ()

Description

The slsmg_suspend_smg function can be used to suspend the state of the screen management facility during suspension of the program. Use of this function will reset the display back to its default state. The funtion slsmg_resume_smg should be called after suspension.

This function is similar to slsmg_reset_smg except that the state of the display prior to calling slsmg_suspend_smg is saved.

See Also

slsmg_resume_smg, slsmg_reset_smg

12.2 slsmg_resume_smg

Synopsis

Resume screen management

Usage

slsmg_resume_smg ()

Description

The slsmg_resume_smg function should be called after slsmg_suspend_smg to redraw the display exactly like it was before slsmg_suspend_smg was called.

See Also

slsmg_suspend_smg

12.3 slsmg_erase_eol

Synopsis

Erase to the end of the row

Usage

slsmg_erase_eol ()

Description

The slsmg_erase_eol function erases all characters from the current position to the end of the line. The newly created space is given the color of the current color. This function has no effect on the position of the virtual cursor.

See Also

slsmg_gotorc, slsmg_erase_eos, slsmg_fill_region

12.4 slsmg_gotorc

Synopsis

Move the virtual cursor

Usage

slsmg_gotorc (Integer_Type r, c)

Description

The slsmg_gotorc function moves the virtual cursor to the row r and column c. The first row and first column is specified by r = 0 and c = 0.

See Also

slsmg_refresh

12.5 slsmg_erase_eos

Synopsis

Erase to the end of the screen

Usage

slsmg_erase_eos ()

Description

The slsmg_erase_eos function is like slsmg_erase_eol except that it erases all text from the current position to the end of the display. The current color will be used to set the background of the erased area.

See Also

slsmg_erase_eol

12.6 slsmg_reverse_video

Synopsis

Set the current color to 1

Usage

slsmg_reverse_video ()

Description

This function is nothing more than slsmg_set_color(1).

See Also

slsmg_set_color

12.7 slsmg_set_color

Synopsis

Set the current color

Usage

slsmg_set_color (Integer_Type c)

Description

The slsmg_set_color function is used to set the current color. The parameter c is a color object descriptor. Actual foreground and background colors may be associated with a color descriptor via the slsmg_define_color function.

Example

This example defines color 7 to be green foreground on black background and then displays some text in this color:

      require ("slsmg");
      variable
        ref,
        row = SLsmg_Screen_Rows / 2,
        txt = [
          "This should be displayed in green under a black background",
          "Press enter to close this window"];

      slsmg_init_smg ();
      slsmg_define_color (7, "green", "black");
      slsmg_gotorc (row, SLsmg_Screen_Cols / 2 - strlen (txt[0]) / 2);
      slsmg_set_color (7);
      slsmg_write_string (txt[0]);
      row++;
      slsmg_gotorc (row, SLsmg_Screen_Cols / 2 - strlen (txt[1]) / 2);
      slsmg_write_string (txt[1]);
      slsmg_refresh ();

      ()=fgets(&ref, stdin);

12.8 slsmg_normal_video

Synopsis

Set the current color to 0

Usage

slsmg_normal_video ()

Description

The slsmg_normal_video function sets the current color descriptor to 0.

See Also

slsmg_set_color

12.9 slsmg_write_string

Usage

slsmg_write_string (String_Type s)

12.10 slsmg_cls

Synopsis

Clear the virtual display

Usage

slsmg_cls ()

Description

The slsmg_cls function erases the virtual display using the current color. This will cause the physical display to get cleared the next time slsmg_refresh is called.

Notes

This function is not the same as

     slsmg_gotorc (0,0); slsmg_erase_eos ();
since these statements do not guarantee that the physical screen will get cleared.

See Also

slsmg_refresh, slsmg_erase_eos

12.11 slsmg_refresh

Synopsis

Update physical screen

Usage

slsmg_refresh ()

Description

The slsmg_refresh function updates the physical display to look like the virtual display.

See Also

slsmg_suspend_smg, slsmg_init_smg, slsmg_reset_smg

12.12 slsmg_reset_smg

Synopsis

Reset the SLsmg routines

Usage

slsmg_reset_smg ()

Description

The slsmg_reset_smg function resets the SLsmg screen management routines by freeing all memory allocated while it was active and also put the terminal's display in it's default state.

See Also

slsmg_init_smg

12.13 slsmg_init_smg

Synopsis

Initialize the SLsmg routines

Usage

slsmg_init_smg ()

Description

The slsmg_init_smg function initializes the SLsmg screen management routines. Specifically, this function allocates space for the virtual display and puts the terminal's physical display in the proper state.

This function should also be called any time the size of the physical display has changed so that it can reallocate a new virtual display to match the physical display.

See Also

slsmg_reset_smg

12.14 slsmg_write_nstring

Synopsis

Write the first n characters of a string on the display

Usage

slsmg_write_nstring (String_Type s, Integer_Type len)

Description

The slsmg_write_nstring function writes the first n characters of s to this virtual display. If the length of the string s is less than n, the spaces will used until n characters have been written. s can be NULL, in which case n spaces will be written.

See Also

slsmg_write_string

12.15 slsmg_write_wrapped_string

Synopsis

Write a string to the display with wrapping

Usage

slsmg_write_wrapped_string (String_Type s, Integer_Type r, c, dr, dc, fill)

Description

The slsmg_write_wrapped_string function writes the string s to the virtual display. The string will be confined to the rectangular region whose upper right corner is at row r and column c, and consists of nr rows and dc columns. The string will be wrapped at the boundaries of the box. If fill is non-zero, the last line to which characters have been written will get padded with spaces.

Notes

This function does not wrap on word boundaries. However, it will wrap when a newline charater is encountered.

See Also

slsmg_write_string

12.16 slsmg_char_at

Synopsis

Get the character at the current position on the virtual display

Usage

Integer_Type slsmg_char_at ()

Description

The slsmg_char_at function returns the character and its color at the current position on the virtual display.

12.17 slsmg_set_screen_start

Synopsis

Set the origin of the virtual display

Usage

slsmg_set_screen_start (Integer_Type r, c)

Description

The slsmg_set_screen_start function sets the origin of the virtual display to the row r and the column c.

See Also

slsmg_init_smg

12.18 slsmg_draw_hline

Synopsis

Draw a horizontal line

Usage

slsmg_draw_hline (Integer_Type len)

Description

The slsmg_draw_hline function draws a horizontal line of length len on the virtual display. The position of the virtual cursor is left at the end of the line.

See Also

slsmg_draw_vline

12.19 slsmg_draw_vline

Synopsis

Draw a vertical line

Usage

slsmg_draw_vline (Integer_Type len)

Description

The slsmg_draw_vline function draws a vertical line of length len on the virtual display. The position of the virtual cursor is left at the end of the line.

12.20 slsmg_draw_object

Synopsis

Draw an object from the alternate character set

Usage

slsmg_draw_object (Integer_Type r, c, obj)

Description

The slsmg_draw_object function may be used to place the object specified by obj at row r and column c. The object is really a character from the alternate character set and may be specified using one of the following constants:

    SLSMG_HLINE_CHAR         Horizontal line
    SLSMG_VLINE_CHAR         Vertical line
    SLSMG_ULCORN_CHAR        Upper left corner
    SLSMG_URCORN_CHAR        Upper right corner
    SLSMG_LLCORN_CHAR        Lower left corner
    SLSMG_LRCORN_CHAR        Lower right corner
    SLSMG_CKBRD_CHAR         Checkboard character
    SLSMG_RTEE_CHAR          Right Tee
    SLSMG_LTEE_CHAR          Left Tee
    SLSMG_UTEE_CHAR          Up Tee
    SLSMG_DTEE_CHAR          Down Tee
    SLSMG_PLUS_CHAR          Plus or Cross character

See Also

slsmg_draw_vline, slsmg_draw_hline, slsmg_draw_box

12.21 slsmg_draw_box

Synopsis

Draw a box on the virtual display

Usage

slsmg_draw_box (Integer_Type r, c, dr, dc)

Description

The slsmg_draw_box function uses the slsmg_draw_hline and slsmg_draw_vline functions to draw a rectangular box on the virtual display. The box's upper left corner is placed at row r and column c. The length and width of the box is specified by dr and dc, respectively.

See Also

slsmg_draw_vline, slsmg_draw_hline, slsmg_draw_object

12.22 slsmg_get_column

Synopsis

Get the column of the virtual cursor

Usage

Integer_Type slsmg_get_column ()

Description

The slsmg_get_column function returns the current column of the virtual cursor on the virtual display.

See Also

slsmg_get_row, slsmg_gotorc

12.23 slsmg_get_row

Synopsis

Get the row of the virtual cursor

Usage

Integer_Type slsmg_get_row ()

Description

The slsmg_get_row function returns the current row of the virtual cursor on the virtual display.

See Also

slsmg_get_column, slsmg_gotorc

12.24 slsmg_forward

Synopsis

Move the virtual cursor forward n columns

Usage

slsmg_forward (Integer_Type n)

Description

The slsmg_forward function moves the virtual cursor forward n columns.

See Also

slsmg_gotorc

12.25 slsmg_set_color_in_region

Synopsis

Change the color of a specifed region

Usage

slsmg_set_color_in_region (Integer_Type color, r, c, dr, dc)

Description

The slsmg_set_color_in_region function may be used to change the color of a rectangular region whose upper left corner is given by (r,c), and whose height and width is given by dr and dc, respectively. The color of the region is given by the color parameter.

See Also

slsmg_draw_box, slsmg_set_color

12.26 slsmg_define_color

Usage

slsmg_define_color (Integer_Type obj, String_Type fg, bg)

Description

The slsmg_define_color function associates the color descriptor obj with a foreground and a background color. The fg and bg colors can be one of the following strings:

  "color0" or "black",      "color8"  or "gray",
  "color1" or "red",        "color9"  or "brightred",
  "color2" or "green",      "color10" or "brightgreen",
  "color3" or "brown",      "color11" or "yellow",
  "color4" or "blue",       "color12" or "brightblue",
  "color5" or "magenta",    "color13" or "brightmagenta",
  "color6" or "cyan",       "color14" or "brightcyan",
  "color7" or "lightgray",  "color15" or "white"

12.27 slsmg_write_to_status_line

Usage

slsmg_write_to_status_line (String_Type s)


Next Previous Contents