Changeset f4f866c in mainline for uspace/app/edit/edit.c


Ignore:
Timestamp:
2010-04-23T21:42:26Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6c39a907
Parents:
38aaacc2 (diff), 80badbe (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/edit/edit.c

    r38aaacc2 rf4f866c  
    4040#include <vfs/vfs.h>
    4141#include <io/console.h>
    42 #include <io/color.h>
     42#include <io/style.h>
    4343#include <io/keycode.h>
    4444#include <errno.h>
     
    100100static bool cursor_visible;
    101101
    102 static int scr_rows, scr_columns;
     102static ipcarg_t scr_rows;
     103static ipcarg_t scr_columns;
    103104
    104105#define ROW_BUF_SIZE 4096
     
    505506        asprintf(&str, "%s: %s", prompt, init_value);
    506507        status_display(str);
    507         console_goto(con, 1 + str_length(str), scr_rows - 1);
     508        console_set_pos(con, 1 + str_length(str), scr_rows - 1);
    508509        free(str);
    509510
    510         console_set_color(con, COLOR_WHITE, COLOR_BLACK, 0);
     511        console_set_style(con, STYLE_INVERTED);
    511512
    512513        max_len = min(INFNAME_MAX_LEN, scr_columns - 4 - str_length(prompt));
     
    552553        str = wstr_to_astr(buffer);
    553554
    554         console_set_color(con, COLOR_BLACK, COLOR_WHITE, 0);
     555        console_set_style(con, STYLE_NORMAL);
    555556
    556557        return str;
     
    671672{
    672673        int sh_rows, rows;
    673         int i, j;
    674674
    675675        sheet_get_num_rows(&doc.sh, &sh_rows);
     
    678678        /* Draw rows from the sheet. */
    679679
    680         console_goto(con, 0, 0);
     680        console_set_pos(con, 0, 0);
    681681        pane_row_range_display(0, rows);
    682682
    683683        /* Clear the remaining rows if file is short. */
    684 
     684       
     685        int i;
     686        ipcarg_t j;
    685687        for (i = rows; i < pane.rows; ++i) {
    686                 console_goto(con, 0, i);
     688                console_set_pos(con, 0, i);
    687689                for (j = 0; j < scr_columns; ++j)
    688690                        putchar(' ');
     
    736738        /* Draw rows from the sheet. */
    737739
    738         console_goto(con, 0, 0);
     740        console_set_pos(con, 0, 0);
    739741        for (i = r0; i < r1; ++i) {
    740742                /* Starting point for row display */
     
    756758                    coord_cmp(&rbc, &csel_end) < 0) {
    757759                        fflush(stdout);
    758                         console_set_color(con, COLOR_BLACK, COLOR_RED, 0);
     760                        console_set_style(con, STYLE_SELECTED);
    759761                        fflush(stdout);
    760762                }
    761763
    762                 console_goto(con, 0, i);
     764                console_set_pos(con, 0, i);
    763765                size = str_size(row_buf);
    764766                pos = 0;
     
    767769                        if ((csel_start.row == rbc.row) && (csel_start.column == s_column)) {
    768770                                fflush(stdout);
    769                                 console_set_color(con, COLOR_BLACK, COLOR_RED, 0);
     771                                console_set_style(con, STYLE_SELECTED);
    770772                                fflush(stdout);
    771773                        }
     
    773775                        if ((csel_end.row == rbc.row) && (csel_end.column == s_column)) {
    774776                                fflush(stdout);
    775                                 console_set_color(con, COLOR_BLACK, COLOR_WHITE, 0);
     777                                console_set_style(con, STYLE_NORMAL);
    776778                                fflush(stdout);
    777779                        }
     
    793795                if ((csel_end.row == rbc.row) && (csel_end.column == s_column)) {
    794796                        fflush(stdout);
    795                         console_set_color(con, COLOR_BLACK, COLOR_WHITE, 0);
     797                        console_set_style(con, STYLE_NORMAL);
    796798                        fflush(stdout);
    797799                }
     
    807809                        putchar(' ');
    808810                fflush(stdout);
    809                 console_set_color(con, COLOR_BLACK, COLOR_WHITE, 0);
     811                console_set_style(con, STYLE_NORMAL);
    810812        }
    811813
     
    824826        const char *fname = (doc.file_name != NULL) ? doc.file_name : "<unnamed>";
    825827
    826         console_goto(con, 0, scr_rows - 1);
    827         console_set_color(con, COLOR_WHITE, COLOR_BLACK, 0);
     828        console_set_pos(con, 0, scr_rows - 1);
     829        console_set_style(con, STYLE_INVERTED);
    828830        int n = printf(" %d, %d: File '%s'. Ctrl-Q Quit  Ctrl-S Save  "
    829831            "Ctrl-E Save As", coord.row, coord.column, fname);
    830832        printf("%*s", scr_columns - 1 - n, "");
    831833        fflush(stdout);
    832         console_set_color(con, COLOR_BLACK, COLOR_WHITE, 0);
     834        console_set_style(con, STYLE_NORMAL);
    833835
    834836        pane.rflags |= REDRAW_CARET;
     
    844846
    845847        spt_get_coord(&caret_pt, &coord);
    846         console_goto(con, coord.column - pane.sh_column,
     848        console_set_pos(con, coord.column - pane.sh_column,
    847849            coord.row - pane.sh_row);
    848850}
     
    11491151static void status_display(char const *str)
    11501152{
    1151         console_goto(con, 0, scr_rows - 1);
    1152         console_set_color(con, COLOR_WHITE, COLOR_BLACK, 0);
     1153        console_set_pos(con, 0, scr_rows - 1);
     1154        console_set_style(con, STYLE_INVERTED);
    11531155        printf(" %*s ", -(scr_columns - 3), str);
    11541156        fflush(stdout);
    1155         console_set_color(con, COLOR_BLACK, COLOR_WHITE, 0);
     1157        console_set_style(con, STYLE_NORMAL);
    11561158
    11571159        pane.rflags |= REDRAW_CARET;
Note: See TracChangeset for help on using the changeset viewer.