Ejemplo n.º 1
0
void z_erase_line (void)
{
    zword pixels = zargs[0];
    zword y, x;

    flush_buffer ();

    /* Do nothing if the background is transparent */

    if (hi (cwp->colour) == TRANSPARENT_COLOUR)
        return;

    /* Clipping at the right margin of the current window */

    if (--pixels == 0 || pixels > units_left ())
        pixels = units_left ();

    /* Erase from cursor position */

    y = cwp->y_pos + cwp->y_cursor - 1;
    x = cwp->x_pos + cwp->x_cursor - 1;

    os_erase_area (y, x, y + font_height - 1, x + pixels - 1, -1);

}/* z_erase_line */
Ejemplo n.º 2
0
void screen_char (zchar c)
{
    int width;

    if (discarding) return;

    if (c == ZC_INDENT && cwp->x_cursor != cwp->left + 1)
        c = ' ';

    if (units_left () < (width = os_char_width (c))) {

        if (!enable_wrapping)
        {
            cwp->x_cursor = cwp->x_size - cwp->right;
            return;
        }

        screen_new_line ();

    }

    os_display_char (c);
    cwp->x_cursor += width;

}/* screen_char */
Ejemplo n.º 3
0
void z_erase_line (void)
{
    zword pixels = zargs[0];
    zword y, x;

    flush_buffer ();

    /* Clipping at the right margin of the current window */

    if (--pixels == 0 || pixels > units_left ())
        pixels = units_left ();

    /* Erase from cursor position */

    y = cwp->y_pos + cwp->y_cursor - 1;
    x = cwp->x_pos + cwp->x_cursor - 1;

    os_erase_area (y, x, y + font_height - 1, x + pixels - 1);

}/* z_erase_line */
Ejemplo n.º 4
0
void screen_write_input (const zchar *buf, zchar key)
{
    int width;

    if (units_left () < (width = os_string_width (buf)))
        screen_new_line ();

    os_display_string (buf); cwp->x_cursor += width;

    if (key == ZC_RETURN)
        screen_new_line ();

}/* screen_write_input */
Ejemplo n.º 5
0
static void pad_status_line (int column)
{
    int spaces;

    flush_buffer ();

    spaces = units_left () / os_char_width (' ') - column;

    /* while (spaces--) */
    /* Justin Wesley's fix for narrow displays (Agenda PDA) */
    while (spaces-- > 0)
        screen_char (' ');

}/* pad_status_line */
Ejemplo n.º 6
0
zchar console_read_input (int max, zchar *buf, zword timeout, bool continued)
{
    zchar key;
    int i;

    /* Make sure there is some space for input */

    if (cwin == 0 && units_left () + os_string_width (buf) < 10 * font_width)
        screen_new_line ();

    /* Make sure the input line is visible */

    if (continued && input_redraw)
        screen_write_input (buf, -1);

    input_window = cwin;
    input_redraw = FALSE;

    /* Get input line from IO interface */

    cwp->x_cursor -= os_string_width (buf);
    key = os_read_line (max, buf, timeout, units_left (), continued);
    cwp->x_cursor += os_string_width (buf);

    if (key != ZC_TIME_OUT)
        for (i = 0; i < 8; i++)
            wp[i].line_count = 0;

    /* Add a newline if the input was terminated normally */

    if (key == ZC_RETURN)
        screen_new_line ();

    return key;

}/* console_read_input */
Ejemplo n.º 7
0
/*
 * screen_word
 *
 * Display a string of characters on the screen. If the word doesn't fit
 * then use wrapping or clipping depending on the current setting of the
 * enable_wrapping flag.
 *
 */
void screen_word (const zchar *s)
{
    int width;

    if (discarding) return;

    if (*s == ZC_INDENT && cwp->x_cursor != cwp->left + 1)
        screen_char (*s++);

    if (units_left () < (width = os_string_width (s))) {

        if (!enable_wrapping) {

            zchar c;

            while ((c = *s++) != 0)

                if (c == ZC_NEW_FONT || c == ZC_NEW_STYLE) {

                    int arg = (int) *s++;

                    if (c == ZC_NEW_FONT)
                        os_set_font (arg);
                    if (c == ZC_NEW_STYLE)
                        os_set_text_style (arg);

                } else screen_char (c);

            return;

        }

        if (*s == ' ' || *s == ZC_INDENT || *s == ZC_GAP)
            width = os_string_width (++s);

#ifdef AMIGA
        if (cwin == 0) Justifiable ();
#endif

        screen_new_line ();

    }

    os_display_string (s);
    cwp->x_cursor += width;

}/* screen_word */