mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-22 03:02:06 +03:00
Replaced functions.
attrset() -> tty_setcolor() move() -> tty_gotoyx() getyx() -> tty_getyx()
This commit is contained in:
parent
ea0cb38b9e
commit
ebbf6fbcdc
@ -45,7 +45,7 @@
|
||||
|
||||
#define MAX_LINE_LEN 1024
|
||||
|
||||
#include "../src/tty/tty.h" /* attrset() */
|
||||
#include "../src/tty/tty.h" /* tty_setcolor() */
|
||||
#include "../src/tty/color.h" /* EDITOR_NORMAL_COLOR */
|
||||
#include "../src/tty/key.h" /* is_idle() */
|
||||
|
||||
@ -197,10 +197,10 @@ edit_status (WEdit *edit)
|
||||
}
|
||||
|
||||
widget_move (edit, 0, 0);
|
||||
attrset (SELECTED_COLOR);
|
||||
tty_setcolor (SELECTED_COLOR);
|
||||
printwstr (fname, fname_len + gap);
|
||||
printwstr (status, w - (fname_len + gap));
|
||||
attrset (EDITOR_NORMAL_COLOR);
|
||||
tty_setcolor (EDITOR_NORMAL_COLOR);
|
||||
|
||||
g_free (status);
|
||||
}
|
||||
@ -253,8 +253,6 @@ void edit_scroll_screen_over_cursor (WEdit * edit)
|
||||
edit_update_curs_row (edit);
|
||||
}
|
||||
|
||||
#define set_color(font) attrset (font)
|
||||
|
||||
#define edit_move(x,y) widget_move(edit, y, x);
|
||||
|
||||
struct line_s {
|
||||
@ -273,7 +271,7 @@ print_to_widget (WEdit *edit, long row, int start_col, int start_col_real,
|
||||
int y = row + EDIT_TEXT_VERTICAL_OFFSET;
|
||||
int cols_to_skip = abs (x);
|
||||
unsigned char str[6 + 1];
|
||||
set_color (EDITOR_NORMAL_COLOR);
|
||||
tty_setcolor (EDITOR_NORMAL_COLOR);
|
||||
edit_move (x1, y);
|
||||
hline (' ', end_col + 1 - EDIT_TEXT_HORIZONTAL_OFFSET - x1);
|
||||
|
||||
@ -315,7 +313,7 @@ print_to_widget (WEdit *edit, long row, int start_col, int start_col_real,
|
||||
if (style & MOD_WHITESPACE) {
|
||||
if (style & MOD_MARKED) {
|
||||
textchar = ' ';
|
||||
set_color (EDITOR_MARKED_COLOR);
|
||||
tty_setcolor (EDITOR_MARKED_COLOR);
|
||||
} else {
|
||||
#if 0
|
||||
if (color != EDITOR_NORMAL_COLOR) {
|
||||
@ -323,13 +321,13 @@ print_to_widget (WEdit *edit, long row, int start_col, int start_col_real,
|
||||
tty_lowlevel_setcolor (color);
|
||||
} else
|
||||
#endif
|
||||
set_color (EDITOR_WHITESPACE_COLOR);
|
||||
tty_setcolor (EDITOR_WHITESPACE_COLOR);
|
||||
}
|
||||
} else {
|
||||
if (style & MOD_BOLD) {
|
||||
set_color (EDITOR_BOLD_COLOR);
|
||||
tty_setcolor (EDITOR_BOLD_COLOR);
|
||||
} else if (style & MOD_MARKED) {
|
||||
set_color (EDITOR_MARKED_COLOR);
|
||||
tty_setcolor (EDITOR_MARKED_COLOR);
|
||||
} else {
|
||||
tty_lowlevel_setcolor (color);
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ static void print_flags (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
attrset (COLOR_NORMAL);
|
||||
tty_setcolor (COLOR_NORMAL);
|
||||
|
||||
for (i = 0; i < 3; i++){
|
||||
dlg_move (ch_dlg, BY+1, 9+i);
|
||||
@ -218,7 +218,7 @@ static void print_flags (void)
|
||||
static void update_mode (Dlg_head * h)
|
||||
{
|
||||
print_flags ();
|
||||
attrset (COLOR_NORMAL);
|
||||
tty_setcolor (COLOR_NORMAL);
|
||||
dlg_move (h, BY + 2, 9);
|
||||
tty_printf ("%12o", get_mode ());
|
||||
send_message (h->current, WIDGET_FOCUS, 0);
|
||||
@ -344,7 +344,7 @@ static void chown_refresh (void)
|
||||
{
|
||||
common_dialog_repaint (ch_dlg);
|
||||
|
||||
attrset (COLOR_NORMAL);
|
||||
tty_setcolor (COLOR_NORMAL);
|
||||
|
||||
dlg_move (ch_dlg, BY - 1, 8);
|
||||
addstr (_("owner"));
|
||||
@ -378,7 +378,7 @@ static void chown_refresh (void)
|
||||
static void chown_info_update (void)
|
||||
{
|
||||
/* display file info */
|
||||
attrset (COLOR_NORMAL);
|
||||
tty_setcolor (COLOR_NORMAL);
|
||||
|
||||
/* name && mode */
|
||||
dlg_move (ch_dlg, 3, 8);
|
||||
|
@ -113,7 +113,7 @@ static struct {
|
||||
|
||||
static void chmod_toggle_select (Dlg_head *h, int Id)
|
||||
{
|
||||
attrset (COLOR_NORMAL);
|
||||
tty_setcolor (COLOR_NORMAL);
|
||||
check_perm[Id].selected ^= 1;
|
||||
|
||||
dlg_move (h, PY + PERMISSIONS - Id, PX + 1);
|
||||
@ -125,7 +125,7 @@ static void chmod_refresh (Dlg_head *h)
|
||||
{
|
||||
common_dialog_repaint (h);
|
||||
|
||||
attrset (COLOR_NORMAL);
|
||||
tty_setcolor (COLOR_NORMAL);
|
||||
|
||||
draw_box (h, PY, PX, PERMISSIONS + 2, 33);
|
||||
draw_box (h, FY, FX, 10, 25);
|
||||
@ -148,7 +148,7 @@ static void chmod_refresh (Dlg_head *h)
|
||||
dlg_move (h, TY + 3, TX);
|
||||
addstr (_("and T or INS to mark"));
|
||||
|
||||
attrset (COLOR_HOT_NORMAL);
|
||||
tty_setcolor (COLOR_HOT_NORMAL);
|
||||
|
||||
dlg_move (h, PY, PX + 1);
|
||||
addstr (_(" Permission "));
|
||||
|
@ -101,7 +101,7 @@ chown_refresh (Dlg_head *h)
|
||||
{
|
||||
common_dialog_repaint (h);
|
||||
|
||||
attrset (COLOR_NORMAL);
|
||||
tty_setcolor (COLOR_NORMAL);
|
||||
|
||||
draw_box (h, UY, UX, 12, 21);
|
||||
draw_box (h, GY, GX, 12, 21);
|
||||
@ -118,7 +118,7 @@ chown_refresh (Dlg_head *h)
|
||||
dlg_move (h, TY + 9, TX + 1);
|
||||
addstr (_(" Permission "));
|
||||
|
||||
attrset (COLOR_HOT_NORMAL);
|
||||
tty_setcolor (COLOR_HOT_NORMAL);
|
||||
dlg_move (h, UY, UX + 1);
|
||||
addstr (_(" User name "));
|
||||
dlg_move (h, GY, GX + 1);
|
||||
|
@ -84,7 +84,7 @@ show_console_contents_linux (int starty, unsigned char begin_line,
|
||||
/* Read the bytes and output them */
|
||||
for (i = 0; i < bytes; i++) {
|
||||
if ((i % COLS) == 0)
|
||||
move (starty + (i / COLS), 0);
|
||||
tty_gotoyx (starty + (i / COLS), 0);
|
||||
read (pipefd2[0], &message, 1);
|
||||
addch (message);
|
||||
}
|
||||
@ -332,7 +332,7 @@ show_console_contents_freebsd (int starty, unsigned char begin_line,
|
||||
return;
|
||||
|
||||
for (line = begin_line; line <= end_line; line++) {
|
||||
move (starty + line - begin_line, 0);
|
||||
tty_gotoyx (starty + line - begin_line, 0);
|
||||
for (col = 0; col < min (COLS, screen_info.mv_csz); col++) {
|
||||
c = screen_shot.buf[line * screen_info.mv_csz + col] & 0xFF;
|
||||
addch (c);
|
||||
|
20
src/dialog.c
20
src/dialog.c
@ -43,7 +43,7 @@
|
||||
#include "strutil.h"
|
||||
#include "setup.h" /* mouse_close_dialog */
|
||||
|
||||
#define waddc(w,y1,x1,c) move (w->y+y1, w->x+x1); addch (c)
|
||||
#define waddc(w, y1, x1, c) tty_gotoyx (w->y + y1, w->x + x1); addch (c)
|
||||
|
||||
/* Primitive way to check if the the current dialog is our dialog */
|
||||
/* This is needed by async routines like load_prompt */
|
||||
@ -60,12 +60,12 @@ static void dlg_broadcast_msg_to (Dlg_head * h, widget_msg_t message,
|
||||
|
||||
static void slow_box (Dlg_head *h, int y, int x, int ys, int xs)
|
||||
{
|
||||
move (h->y+y, h->x+x);
|
||||
tty_gotoyx (h->y + y, h->x + x);
|
||||
hline (' ', xs);
|
||||
vline (' ', ys);
|
||||
move (h->y+y, h->x+x+xs-1);
|
||||
tty_gotoyx (h->y + y, h->x + x + xs - 1);
|
||||
vline (' ', ys);
|
||||
move (h->y+y+ys-1, h->x+x);
|
||||
tty_gotoyx (h->y + y + ys - 1, h->x + x);
|
||||
hline (' ', xs);
|
||||
}
|
||||
|
||||
@ -86,12 +86,12 @@ void draw_box (Dlg_head *h, int y, int x, int ys, int xs)
|
||||
waddc (h, y, x + xs - 1, ACS_URCORNER);
|
||||
waddc (h, y + ys - 1, x + xs - 1, ACS_LRCORNER);
|
||||
|
||||
move (h->y+y+1, h->x+x);
|
||||
tty_gotoyx (h->y + y + 1, h->x + x);
|
||||
vline (ACS_VLINE, ys - 2);
|
||||
move (h->y+y+1, h->x+x+xs-1);
|
||||
tty_gotoyx (h->y + y + 1, h->x + x + xs - 1);
|
||||
vline (ACS_VLINE, ys - 2);
|
||||
#else
|
||||
SLsmg_draw_box (h->y+y, h->x+x, ys, xs);
|
||||
SLsmg_draw_box (h->y + y, h->x + x, ys, xs);
|
||||
#endif /* HAVE_SLANG */
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ void dlg_erase (Dlg_head *h)
|
||||
if (h == NULL)
|
||||
return;
|
||||
for (y = 0; y < h->lines; y++){
|
||||
move (y+h->y, h->x); /* FIXME: should test if ERR */
|
||||
tty_gotoyx (y + h->y, h->x); /* FIXME: should test if ERR */
|
||||
for (x = 0; x < h->cols; x++){
|
||||
addch (' ');
|
||||
}
|
||||
@ -174,12 +174,12 @@ common_dialog_repaint (struct Dlg_head *h)
|
||||
|
||||
space = (h->flags & DLG_COMPACT) ? 0 : 1;
|
||||
|
||||
attrset (DLG_NORMALC (h));
|
||||
tty_setcolor (DLG_NORMALC (h));
|
||||
dlg_erase (h);
|
||||
draw_box (h, space, space, h->lines - 2 * space, h->cols - 2 * space);
|
||||
|
||||
if (h->title) {
|
||||
attrset (DLG_HOT_NORMALC (h));
|
||||
tty_setcolor (DLG_HOT_NORMALC (h));
|
||||
dlg_move (h, space, (h->cols - str_term_width1 (h->title)) / 2);
|
||||
addstr (str_term_form (h->title));
|
||||
}
|
||||
|
@ -191,10 +191,8 @@ cb_ret_t default_proc (widget_msg_t msg, int parm);
|
||||
/* Default paint routine for dialogs */
|
||||
void common_dialog_repaint (struct Dlg_head *h);
|
||||
|
||||
#define widget_move(w, _y, _x) move(((Widget *)(w))->y + _y, \
|
||||
((Widget *)(w))->x + _x)
|
||||
#define dlg_move(h, _y, _x) move(((Dlg_head *)(h))->y + _y, \
|
||||
((Dlg_head *)(h))->x + _x)
|
||||
#define widget_move(w, _y, _x) tty_gotoyx (((Widget *)(w))->y + _y, ((Widget *)(w))->x + _x)
|
||||
#define dlg_move(h, _y, _x) tty_gotoyx (((Dlg_head *)(h))->y + _y, ((Dlg_head *)(h))->x + _x)
|
||||
|
||||
extern Dlg_head *current_dlg;
|
||||
|
||||
|
@ -780,7 +780,7 @@ do_search (struct Dlg_head *h)
|
||||
while (!dirp){
|
||||
char *tmp = NULL;
|
||||
|
||||
attrset (REVERSE_COLOR);
|
||||
tty_setcolor (REVERSE_COLOR);
|
||||
while (1) {
|
||||
char *temp_dir = NULL;
|
||||
gboolean found;
|
||||
@ -894,7 +894,7 @@ do_search (struct Dlg_head *h)
|
||||
|
||||
if (verbose){
|
||||
pos = (pos + 1) % 4;
|
||||
attrset (DLG_NORMALC (h));
|
||||
tty_setcolor (DLG_NORMALC (h));
|
||||
dlg_move (h, FIND2_Y - 7, FIND2_X - 4);
|
||||
addch (rotating_dash [pos]);
|
||||
mc_refresh ();
|
||||
|
16
src/help.c
16
src/help.c
@ -351,7 +351,7 @@ static void help_show (Dlg_head *h, const char *paint_start)
|
||||
int active_col, active_line;/* Active link position */
|
||||
static char buff[MB_LEN_MAX + 1];
|
||||
|
||||
attrset (HELP_NORMAL_COLOR);
|
||||
tty_setcolor (HELP_NORMAL_COLOR);
|
||||
do {
|
||||
|
||||
line = col = acs = active_col = active_line = repeat_paint = 0;
|
||||
@ -374,14 +374,14 @@ static void help_show (Dlg_head *h, const char *paint_start)
|
||||
if (selected_item == NULL)
|
||||
selected_item = p;
|
||||
if (p == selected_item){
|
||||
attrset (HELP_SLINK_COLOR);
|
||||
tty_setcolor (HELP_SLINK_COLOR);
|
||||
|
||||
/* Store the coordinates of the link */
|
||||
active_col = col + 2;
|
||||
active_line = line + 2;
|
||||
}
|
||||
else
|
||||
attrset (HELP_LINK_COLOR);
|
||||
tty_setcolor (HELP_LINK_COLOR);
|
||||
start_link_area (col, line, p);
|
||||
break;
|
||||
case CHAR_LINK_POINTER:
|
||||
@ -390,7 +390,7 @@ static void help_show (Dlg_head *h, const char *paint_start)
|
||||
break;
|
||||
case CHAR_LINK_END:
|
||||
painting = 1;
|
||||
attrset (HELP_NORMAL_COLOR);
|
||||
tty_setcolor (HELP_NORMAL_COLOR);
|
||||
break;
|
||||
case CHAR_ALTERNATE:
|
||||
acs = 1;
|
||||
@ -404,13 +404,13 @@ static void help_show (Dlg_head *h, const char *paint_start)
|
||||
col += str_term_width1 (VERSION);
|
||||
break;
|
||||
case CHAR_FONT_BOLD:
|
||||
attrset (HELP_BOLD_COLOR);
|
||||
tty_setcolor (HELP_BOLD_COLOR);
|
||||
break;
|
||||
case CHAR_FONT_ITALIC:
|
||||
attrset (HELP_ITALIC_COLOR);
|
||||
tty_setcolor (HELP_ITALIC_COLOR);
|
||||
break;
|
||||
case CHAR_FONT_NORMAL:
|
||||
attrset (HELP_NORMAL_COLOR);
|
||||
tty_setcolor (HELP_NORMAL_COLOR);
|
||||
break;
|
||||
case '\n':
|
||||
line++;
|
||||
@ -445,7 +445,7 @@ static void help_show (Dlg_head *h, const char *paint_start)
|
||||
}
|
||||
last_shown = p;
|
||||
end_of_node = line < help_lines;
|
||||
attrset (HELP_NORMAL_COLOR);
|
||||
tty_setcolor (HELP_NORMAL_COLOR);
|
||||
if (selected_item >= last_shown){
|
||||
if (link_area != NULL){
|
||||
selected_item = link_area->link_name;
|
||||
|
@ -163,7 +163,7 @@ static void
|
||||
hotlist_refresh (Dlg_head * dlg)
|
||||
{
|
||||
common_dialog_repaint (dlg);
|
||||
attrset (COLOR_NORMAL);
|
||||
tty_setcolor (COLOR_NORMAL);
|
||||
draw_box (dlg, 2, 5, dlg->lines - (hotlist_state.moving ? 6 : 10),
|
||||
dlg->cols - (UX * 2));
|
||||
if (!hotlist_state.moving)
|
||||
@ -484,7 +484,7 @@ hotlist_callback (Dlg_head *h, dlg_msg_t msg, int parm)
|
||||
/* fall through */
|
||||
|
||||
case DLG_INIT:
|
||||
attrset (MENU_ENTRY_COLOR);
|
||||
tty_setcolor (MENU_ENTRY_COLOR);
|
||||
update_path_name ();
|
||||
return MSG_HANDLED;
|
||||
|
||||
@ -1140,7 +1140,7 @@ char *hotlist_cmd (int vfs_or_hotlist)
|
||||
init_hotlist (vfs_or_hotlist);
|
||||
|
||||
/* display file info */
|
||||
attrset (SELECTED_COLOR);
|
||||
tty_setcolor (SELECTED_COLOR);
|
||||
|
||||
hotlist_state.running = 1;
|
||||
run_dlg (hotlist_dlg);
|
||||
|
@ -56,7 +56,7 @@ static struct my_statfs myfs_stats;
|
||||
static void info_box (Dlg_head *h, struct WInfo *info)
|
||||
{
|
||||
standend ();
|
||||
attrset (NORMAL_COLOR);
|
||||
tty_setcolor (NORMAL_COLOR);
|
||||
widget_erase (&info->widget);
|
||||
draw_double_box (h, info->widget.y, info->widget.x,
|
||||
info->widget.lines, info->widget.cols);
|
||||
@ -74,10 +74,10 @@ info_show_info (struct WInfo *info)
|
||||
return;
|
||||
|
||||
info_box (info->widget.parent, info);
|
||||
attrset (MARKED_COLOR);
|
||||
tty_setcolor (MARKED_COLOR);
|
||||
widget_move (&info->widget, 1, 3);
|
||||
tty_printf (_("Midnight Commander %s"), VERSION);
|
||||
attrset (NORMAL_COLOR);
|
||||
tty_setcolor (NORMAL_COLOR);
|
||||
widget_move (&info->widget, 2, 1);
|
||||
hline (ACS_HLINE|NORMAL_COLOR, info->widget.cols-2);
|
||||
if (get_current_type () != view_listing)
|
||||
|
20
src/layout.c
20
src/layout.c
@ -228,7 +228,7 @@ static void update_split (void)
|
||||
old_first_panel_size = _first_panel_size;
|
||||
old_horizontal_split = _horizontal_split;
|
||||
|
||||
attrset (COLOR_NORMAL);
|
||||
tty_setcolor (COLOR_NORMAL);
|
||||
dlg_move (layout_dlg, 6, 6);
|
||||
tty_printf ("%03d", _first_panel_size);
|
||||
dlg_move (layout_dlg, 6, 18);
|
||||
@ -299,14 +299,14 @@ layout_callback (struct Dlg_head *h, dlg_msg_t msg, int parm)
|
||||
old_horizontal_split = -1;
|
||||
old_output_lines = -1;
|
||||
|
||||
attrset (COLOR_HOT_NORMAL);
|
||||
tty_setcolor (COLOR_HOT_NORMAL);
|
||||
update_split ();
|
||||
dlg_move (h, 6, 13);
|
||||
addch ('=');
|
||||
if (console_flag){
|
||||
if (old_output_lines != _output_lines){
|
||||
old_output_lines = _output_lines;
|
||||
attrset (COLOR_NORMAL);
|
||||
tty_setcolor (COLOR_NORMAL);
|
||||
dlg_move (h, LAYOUT_OPTIONS_COUNT, 16 + first_width);
|
||||
addstr (str_term_form (output_lines_label));
|
||||
dlg_move (h, LAYOUT_OPTIONS_COUNT, 10 + first_width);
|
||||
@ -351,7 +351,7 @@ layout_callback (struct Dlg_head *h, dlg_msg_t msg, int parm)
|
||||
if (console_flag){
|
||||
if (old_output_lines != _output_lines){
|
||||
old_output_lines = _output_lines;
|
||||
attrset (COLOR_NORMAL);
|
||||
tty_setcolor (COLOR_NORMAL);
|
||||
dlg_move (h, LAYOUT_OPTIONS_COUNT, 10 + first_width);
|
||||
tty_printf ("%02d", _output_lines);
|
||||
}
|
||||
@ -849,14 +849,14 @@ void print_vfs_message (const char *msg, ...)
|
||||
return;
|
||||
|
||||
/* Preserve current cursor position */
|
||||
getyx (stdscr, row, col);
|
||||
tty_getyx (&row, &col);
|
||||
|
||||
move (0, 0);
|
||||
attrset (NORMAL_COLOR);
|
||||
tty_gotoyx (0, 0);
|
||||
tty_setcolor (NORMAL_COLOR);
|
||||
addstr (str_fit_to_term (str, COLS - 1, J_LEFT));
|
||||
|
||||
/* Restore cursor position */
|
||||
move(row, col);
|
||||
tty_gotoyx (row, col);
|
||||
mc_refresh ();
|
||||
return;
|
||||
}
|
||||
@ -876,8 +876,8 @@ void rotate_dash (void)
|
||||
|
||||
if (pos >= sizeof (rotating_dash)-1)
|
||||
pos = 0;
|
||||
move (0, COLS-1);
|
||||
attrset (NORMAL_COLOR);
|
||||
tty_gotoyx (0, COLS - 1);
|
||||
tty_setcolor (NORMAL_COLOR);
|
||||
addch (rotating_dash [pos]);
|
||||
mc_refresh ();
|
||||
pos++;
|
||||
|
20
src/menu.c
20
src/menu.c
@ -88,7 +88,7 @@ static void menubar_paint_idx (WMenu *menubar, int idx, int color)
|
||||
|
||||
if (entry->text.start == NULL) {
|
||||
/* menu separator */
|
||||
attrset (SELECTED_COLOR);
|
||||
tty_setcolor (SELECTED_COLOR);
|
||||
|
||||
if (!slow_terminal) {
|
||||
widget_move (&menubar->widget, y, x - 1);
|
||||
@ -102,17 +102,17 @@ static void menubar_paint_idx (WMenu *menubar, int idx, int color)
|
||||
tty_print_alt_char (ACS_RTEE);
|
||||
} else {
|
||||
/* menu text */
|
||||
attrset (color);
|
||||
tty_setcolor (color);
|
||||
widget_move (&menubar->widget, y, x);
|
||||
addch ((unsigned char) entry->first_letter);
|
||||
hline (' ', menubar->max_entry_len + 1); /* clear line */
|
||||
addstr (str_term_form (entry->text.start));
|
||||
|
||||
if (entry->text.hotkey != NULL) {
|
||||
attrset (color == MENU_SELECTED_COLOR ?
|
||||
tty_setcolor (color == MENU_SELECTED_COLOR ?
|
||||
MENU_HOTSEL_COLOR : MENU_HOT_COLOR);
|
||||
addstr (str_term_form (entry->text.hotkey));
|
||||
attrset(color);
|
||||
tty_setcolor(color);
|
||||
}
|
||||
|
||||
if (entry->text.end != NULL)
|
||||
@ -132,7 +132,7 @@ static inline void menubar_draw_drop (WMenu *menubar)
|
||||
if (column + menubar->max_entry_len + 4 > menubar->widget.cols)
|
||||
column = menubar->widget.cols - menubar->max_entry_len - 4;
|
||||
|
||||
attrset (SELECTED_COLOR);
|
||||
tty_setcolor (SELECTED_COLOR);
|
||||
draw_box (menubar->widget.parent,
|
||||
menubar->widget.y + 1, menubar->widget.x + column,
|
||||
count + 2, menubar->max_entry_len + 4);
|
||||
@ -152,25 +152,25 @@ static void menubar_draw (WMenu *menubar)
|
||||
int i;
|
||||
|
||||
/* First draw the complete menubar */
|
||||
attrset (SELECTED_COLOR);
|
||||
tty_setcolor (SELECTED_COLOR);
|
||||
widget_move (&menubar->widget, 0, 0);
|
||||
|
||||
hline (' ', menubar->widget.cols);
|
||||
|
||||
attrset (SELECTED_COLOR);
|
||||
tty_setcolor (SELECTED_COLOR);
|
||||
/* Now each one of the entries */
|
||||
for (i = 0; i < items; i++){
|
||||
attrset ((menubar->active && i == menubar->selected) ?
|
||||
tty_setcolor ((menubar->active && i == menubar->selected) ?
|
||||
MENU_SELECTED_COLOR : SELECTED_COLOR);
|
||||
widget_move (&menubar->widget, 0, menubar->menu [i]->start_x);
|
||||
|
||||
addstr (str_term_form (menubar->menu[i]->text.start));
|
||||
|
||||
if (menubar->menu[i]->text.hotkey != NULL) {
|
||||
attrset ((menubar->active && i == menubar->selected) ?
|
||||
tty_setcolor ((menubar->active && i == menubar->selected) ?
|
||||
MENU_HOTSEL_COLOR : COLOR_HOT_FOCUS);
|
||||
addstr (str_term_form (menubar->menu[i]->text.hotkey));
|
||||
attrset ((menubar->active && i == menubar->selected) ?
|
||||
tty_setcolor ((menubar->active && i == menubar->selected) ?
|
||||
MENU_SELECTED_COLOR : SELECTED_COLOR);
|
||||
}
|
||||
if (menubar->menu[i]->text.end != NULL) {
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#include "../src/tty/tty.h" /* attrset() */
|
||||
#include "../src/tty/tty.h" /* tty_setcolor() */
|
||||
#include "../src/tty/color.h"
|
||||
#include "../src/tty/win.h"
|
||||
|
||||
@ -105,14 +105,14 @@ panelize_callback (Dlg_head *h, dlg_msg_t msg, int parm)
|
||||
switch (msg) {
|
||||
case DLG_DRAW:
|
||||
common_dialog_repaint (h);
|
||||
attrset (COLOR_NORMAL);
|
||||
tty_setcolor (COLOR_NORMAL);
|
||||
draw_box (h, UY, UX, h->lines - 10, h->cols - 10);
|
||||
return MSG_HANDLED;
|
||||
|
||||
case DLG_POST_KEY:
|
||||
/* fall */
|
||||
case DLG_INIT:
|
||||
attrset (MENU_ENTRY_COLOR);
|
||||
tty_setcolor (MENU_ENTRY_COLOR);
|
||||
update_command ();
|
||||
return MSG_HANDLED;
|
||||
|
||||
@ -280,7 +280,7 @@ external_panelize (void)
|
||||
init_panelize ();
|
||||
|
||||
/* display file info */
|
||||
attrset (SELECTED_COLOR);
|
||||
tty_setcolor (SELECTED_COLOR);
|
||||
|
||||
run_dlg (panelize_dlg);
|
||||
|
||||
|
36
src/screen.c
36
src/screen.c
@ -118,7 +118,7 @@ set_colors (WPanel *panel)
|
||||
{
|
||||
(void) panel;
|
||||
standend ();
|
||||
attrset (NORMAL_COLOR);
|
||||
tty_setcolor (NORMAL_COLOR);
|
||||
}
|
||||
|
||||
/* Delete format string, it is a linked list */
|
||||
@ -155,11 +155,11 @@ add_permission_string (char *dest, int width, file_entry *fe, int attr, int colo
|
||||
for(i = 0; i < width; i++){
|
||||
if (i >= l && i < r){
|
||||
if (attr == SELECTED || attr == MARKED_SELECTED)
|
||||
attrset (MARKED_SELECTED_COLOR);
|
||||
tty_setcolor (MARKED_SELECTED_COLOR);
|
||||
else
|
||||
attrset (MARKED_COLOR);
|
||||
tty_setcolor (MARKED_COLOR);
|
||||
} else
|
||||
attrset (color);
|
||||
tty_setcolor (color);
|
||||
|
||||
addch (dest[i]);
|
||||
}
|
||||
@ -552,7 +552,7 @@ format_file (char *dest, int limit, WPanel *panel, int file_index, int width, in
|
||||
perm = 2;
|
||||
}
|
||||
|
||||
attrset (color);
|
||||
tty_setcolor (color);
|
||||
|
||||
preperad_text = (char*) str_fit_to_term(txt, len, format->just_mode);
|
||||
if (perm)
|
||||
@ -564,9 +564,9 @@ format_file (char *dest, int limit, WPanel *panel, int file_index, int width, in
|
||||
length+= len;
|
||||
} else {
|
||||
if (attr == SELECTED || attr == MARKED_SELECTED)
|
||||
attrset (SELECTED_COLOR);
|
||||
tty_setcolor (SELECTED_COLOR);
|
||||
else
|
||||
attrset (NORMAL_COLOR);
|
||||
tty_setcolor (NORMAL_COLOR);
|
||||
one_vline ();
|
||||
length++;
|
||||
}
|
||||
@ -619,7 +619,7 @@ repaint_file (WPanel *panel, int file_index, int mv, int attr, int isstatus)
|
||||
if (second_column)
|
||||
addch (' ');
|
||||
else {
|
||||
attrset (NORMAL_COLOR);
|
||||
tty_setcolor (NORMAL_COLOR);
|
||||
one_vline ();
|
||||
}
|
||||
}
|
||||
@ -631,11 +631,11 @@ display_mini_info (WPanel *panel)
|
||||
widget_move (&panel->widget, llines (panel)+3, 1);
|
||||
|
||||
if (panel->searching){
|
||||
attrset (INPUT_COLOR);
|
||||
tty_setcolor (INPUT_COLOR);
|
||||
addstr ("/");
|
||||
addstr (str_fit_to_term (panel->search_buffer,
|
||||
panel->widget.cols - 3, J_LEFT));
|
||||
attrset (NORMAL_COLOR);
|
||||
tty_setcolor (NORMAL_COLOR);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -731,7 +731,7 @@ display_total_marked_size (WPanel *panel, int y, int x, gboolean size_only)
|
||||
* y == panel->widget.lines - 1 for panel bottom frame
|
||||
*/
|
||||
widget_move (&panel->widget, y, x);
|
||||
attrset (MARKED_COLOR);
|
||||
tty_setcolor (MARKED_COLOR);
|
||||
tty_printf (" %s ", buf);
|
||||
}
|
||||
|
||||
@ -742,7 +742,7 @@ mini_info_separator (WPanel *panel)
|
||||
|
||||
standend ();
|
||||
widget_move (&panel->widget, y, 1);
|
||||
attrset (NORMAL_COLOR);
|
||||
tty_setcolor (NORMAL_COLOR);
|
||||
#ifdef HAVE_SLANG
|
||||
hline (ACS_HLINE, panel->widget.cols - 2);
|
||||
#else
|
||||
@ -789,7 +789,7 @@ show_free_space (WPanel *panel)
|
||||
(int)(100 * (double)myfs_stats.avail / myfs_stats.total) : 0);
|
||||
widget_move (&panel->widget, panel->widget.lines - 1,
|
||||
panel->widget.cols - 2 - (int) strlen (tmp));
|
||||
attrset (NORMAL_COLOR);
|
||||
tty_setcolor (NORMAL_COLOR);
|
||||
addstr (tmp);
|
||||
}
|
||||
}
|
||||
@ -813,7 +813,7 @@ show_dir (WPanel *panel)
|
||||
}
|
||||
|
||||
if (panel->active)
|
||||
attrset (REVERSE_COLOR);
|
||||
tty_setcolor (REVERSE_COLOR);
|
||||
|
||||
widget_move (&panel->widget, 0, 3);
|
||||
|
||||
@ -837,7 +837,7 @@ show_dir (WPanel *panel)
|
||||
|
||||
g_snprintf (buffer, sizeof (buffer), " %s ",
|
||||
size_trunc_sep (panel->dir.list [panel->selected].st.st_size));
|
||||
attrset (NORMAL_COLOR);
|
||||
tty_setcolor (NORMAL_COLOR);
|
||||
widget_move (&panel->widget, panel->widget.lines - 1, 2);
|
||||
addstr (buffer);
|
||||
}
|
||||
@ -1223,7 +1223,7 @@ paint_frame (WPanel *panel)
|
||||
format_e *format;
|
||||
|
||||
if (side){
|
||||
attrset (NORMAL_COLOR);
|
||||
tty_setcolor (NORMAL_COLOR);
|
||||
one_vline ();
|
||||
width = panel->widget.cols - panel->widget.cols/2 - 1;
|
||||
} else if (panel->split)
|
||||
@ -1243,12 +1243,12 @@ paint_frame (WPanel *panel)
|
||||
if (header_len > format->field_len)
|
||||
header_len = format->field_len;
|
||||
|
||||
attrset (MARKED_COLOR);
|
||||
tty_setcolor (MARKED_COLOR);
|
||||
addstr (str_fit_to_term (txt, format->field_len, J_CENTER_LEFT));
|
||||
g_free(txt);
|
||||
width -= format->field_len;
|
||||
} else {
|
||||
attrset (NORMAL_COLOR);
|
||||
tty_setcolor (NORMAL_COLOR);
|
||||
one_vline ();
|
||||
width --;
|
||||
continue;
|
||||
|
20
src/tree.c
20
src/tree.c
@ -179,14 +179,14 @@ static void tree_show_mini_info (WTree *tree, int tree_lines, int tree_cols)
|
||||
|
||||
if (tree->searching){
|
||||
/* Show search string */
|
||||
attrset (TREE_NORMALC (h));
|
||||
attrset (DLG_FOCUSC (h));
|
||||
tty_setcolor (TREE_NORMALC (h));
|
||||
tty_setcolor (DLG_FOCUSC (h));
|
||||
addch (PATH_SEP);
|
||||
|
||||
addstr (str_fit_to_term (tree->search_buffer,
|
||||
tree_cols - 2, J_LEFT_FIT));
|
||||
addch (' ');
|
||||
attrset (DLG_FOCUSC (h));
|
||||
tty_setcolor (DLG_FOCUSC (h));
|
||||
} else {
|
||||
/* Show full name of selected directory */
|
||||
addstr (str_fit_to_term (tree->selected_ptr->name,
|
||||
@ -207,7 +207,7 @@ static void show_tree (WTree *tree)
|
||||
tree_lines = tlines (tree);
|
||||
tree_cols = tree->widget.cols;
|
||||
|
||||
attrset (TREE_NORMALC (h));
|
||||
tty_setcolor (TREE_NORMALC (h));
|
||||
widget_move ((Widget*)tree, y, x);
|
||||
if (tree->is_panel){
|
||||
tree_cols -= 2;
|
||||
@ -270,9 +270,9 @@ static void show_tree (WTree *tree)
|
||||
/* Top level directory */
|
||||
if (tree->active && current == tree->selected_ptr) {
|
||||
if (!use_colors && !tree->is_panel)
|
||||
attrset (MARKED_COLOR);
|
||||
tty_setcolor (MARKED_COLOR);
|
||||
else
|
||||
attrset (SELECTED_COLOR);
|
||||
tty_setcolor (SELECTED_COLOR);
|
||||
}
|
||||
|
||||
/* Show full name */
|
||||
@ -303,9 +303,9 @@ static void show_tree (WTree *tree)
|
||||
if (tree->active && current == tree->selected_ptr) {
|
||||
/* Selected directory -> change color */
|
||||
if (!use_colors && !tree->is_panel)
|
||||
attrset (MARKED_COLOR);
|
||||
tty_setcolor (MARKED_COLOR);
|
||||
else
|
||||
attrset (SELECTED_COLOR);
|
||||
tty_setcolor (SELECTED_COLOR);
|
||||
}
|
||||
|
||||
/* Show sub-name */
|
||||
@ -316,7 +316,7 @@ static void show_tree (WTree *tree)
|
||||
addch (' ');
|
||||
|
||||
/* Return to normal color */
|
||||
attrset (TREE_NORMALC (h));
|
||||
tty_setcolor (TREE_NORMALC (h));
|
||||
|
||||
/* Calculate the next value for current */
|
||||
current = current->next;
|
||||
@ -964,7 +964,7 @@ tree_key (WTree *tree, int key)
|
||||
static void
|
||||
tree_frame (Dlg_head *h, WTree *tree)
|
||||
{
|
||||
attrset (NORMAL_COLOR);
|
||||
tty_setcolor (NORMAL_COLOR);
|
||||
widget_erase ((Widget*) tree);
|
||||
if (tree->is_panel)
|
||||
draw_double_box (h, tree->widget.y, tree->widget.x, tree->widget.lines,
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
#include "../../src/global.h"
|
||||
|
||||
#include "../../src/tty/tty.h" /* move, addch */
|
||||
#include "../../src/tty/tty.h" /* tty_gotoyx, addch */
|
||||
|
||||
#include "../../src/cons.saver.h"
|
||||
|
||||
@ -115,7 +115,7 @@ void show_rxvt_contents (int starty, unsigned char y1, unsigned char y2)
|
||||
}
|
||||
for (i = 0; i < j; i++) {
|
||||
if ((i % cols) == 0)
|
||||
move (starty + (i / cols), 0);
|
||||
tty_gotoyx (starty + (i / cols), 0);
|
||||
addch (is_printable (k[i]) ? k[i] : ' ');
|
||||
}
|
||||
g_free (k);
|
||||
|
@ -40,6 +40,12 @@
|
||||
|
||||
/*** public functions **************************************************/
|
||||
|
||||
void
|
||||
tty_setcolor (int color)
|
||||
{
|
||||
attrset (color);
|
||||
}
|
||||
|
||||
void
|
||||
tty_lowlevel_setcolor (int color)
|
||||
{
|
||||
|
@ -363,15 +363,17 @@ vline (int character, int len)
|
||||
last_y = SLsmg_get_row ();
|
||||
|
||||
while (len--) {
|
||||
move (last_y + pos++, last_x);
|
||||
SLsmg_gotorc (last_y + pos, last_x);
|
||||
addch (' ');
|
||||
pos++;
|
||||
}
|
||||
|
||||
SLsmg_gotorc (last_x, last_y);
|
||||
}
|
||||
}
|
||||
|
||||
int has_colors (void)
|
||||
int
|
||||
has_colors (void)
|
||||
{
|
||||
const char *terminal = getenv ("TERM");
|
||||
char *cts = color_terminal_string;
|
||||
@ -426,7 +428,7 @@ int has_colors (void)
|
||||
}
|
||||
|
||||
void
|
||||
attrset (int color)
|
||||
tty_setcolor (int color)
|
||||
{
|
||||
if (!SLtt_Use_Ansi_Colors)
|
||||
SLsmg_set_color (color);
|
||||
@ -475,8 +477,8 @@ tty_gotoyx (int y, int x)
|
||||
void
|
||||
tty_getyx (int *py, int *px)
|
||||
{
|
||||
*px = SLsmg_get_column ();
|
||||
*py = SLsmg_get_row ();
|
||||
*px = SLsmg_get_column ();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -79,7 +79,6 @@ void slang_set_raw_mode (void);
|
||||
#define reset_prog_mode() slang_prog_mode ()
|
||||
#define flushinp()
|
||||
|
||||
void attrset (int color);
|
||||
void set_slang_delay (int);
|
||||
void slang_init (void);
|
||||
void slang_prog_mode (void);
|
||||
@ -91,12 +90,6 @@ void slang_shell_mode (void);
|
||||
void slang_shutdown (void);
|
||||
int has_colors (void);
|
||||
|
||||
#define move(y, x) SLsmg_gotorc (y, x)
|
||||
#define getyx(stdscr, row, col) \
|
||||
do { \
|
||||
row = SLsmg_get_row(); \
|
||||
col = SLsmg_get_column(); \
|
||||
} while (0)
|
||||
#define printw SLsmg_printf
|
||||
#define COLS SLtt_Screen_Cols
|
||||
#define LINES SLtt_Screen_Rows
|
||||
|
@ -107,12 +107,6 @@ tty_got_interrupt(void)
|
||||
return rv;
|
||||
}
|
||||
|
||||
extern void
|
||||
tty_setcolor(int c)
|
||||
{
|
||||
attrset(c);
|
||||
}
|
||||
|
||||
extern void
|
||||
tty_print_one_hline(void)
|
||||
{
|
||||
|
@ -2256,7 +2256,7 @@ view_display_ruler (WView *view)
|
||||
}
|
||||
}
|
||||
}
|
||||
attrset (NORMAL_COLOR);
|
||||
tty_setcolor (NORMAL_COLOR);
|
||||
}
|
||||
|
||||
static void
|
||||
|
40
src/widget.c
40
src/widget.c
@ -77,7 +77,7 @@ widget_selectcolor (Widget *w, gboolean focused, gboolean hotkey)
|
||||
{
|
||||
Dlg_head *h = w->parent;
|
||||
|
||||
attrset (hotkey
|
||||
tty_setcolor (hotkey
|
||||
? (focused
|
||||
? DLG_HOT_FOCUSC (h)
|
||||
: DLG_HOT_NORMALC (h))
|
||||
@ -601,9 +601,9 @@ label_callback (Widget *w, widget_msg_t msg, int parm)
|
||||
return MSG_HANDLED;
|
||||
|
||||
if (l->transparent)
|
||||
attrset (DEFAULT_COLOR);
|
||||
tty_setcolor (DEFAULT_COLOR);
|
||||
else
|
||||
attrset (DLG_NORMALC (h));
|
||||
tty_setcolor (DLG_NORMALC (h));
|
||||
|
||||
for (;;) {
|
||||
q = strchr (p, '\n');
|
||||
@ -701,7 +701,7 @@ gauge_callback (Widget *w, widget_msg_t msg, int parm)
|
||||
|
||||
if (msg == WIDGET_DRAW){
|
||||
widget_move (&g->widget, 0, 0);
|
||||
attrset (DLG_NORMALC (h));
|
||||
tty_setcolor (DLG_NORMALC (h));
|
||||
if (!g->shown)
|
||||
tty_printf ("%*s", gauge_len, "");
|
||||
else {
|
||||
@ -721,9 +721,9 @@ gauge_callback (Widget *w, widget_msg_t msg, int parm)
|
||||
percentage = (200 * done / total + 1) / 2;
|
||||
columns = (2 * (gauge_len - 7) * done / total + 1) / 2;
|
||||
addch ('[');
|
||||
attrset (GAUGE_COLOR);
|
||||
tty_setcolor (GAUGE_COLOR);
|
||||
tty_printf ("%*s", (int) columns, "");
|
||||
attrset (DLG_NORMALC (h));
|
||||
tty_setcolor (DLG_NORMALC (h));
|
||||
tty_printf ("%*s] %3d%%", (int)(gauge_len - 7 - columns), "", (int) percentage);
|
||||
}
|
||||
return MSG_HANDLED;
|
||||
@ -794,14 +794,14 @@ static void draw_history_button (WInput * in)
|
||||
{
|
||||
Dlg_head *h;
|
||||
h = in->widget.parent;
|
||||
attrset (NORMAL_COLOR);
|
||||
tty_setcolor (NORMAL_COLOR);
|
||||
addstr ("[ ]");
|
||||
/* Too distracting: attrset (MARKED_COLOR); */
|
||||
/* Too distracting: tty_setcolor (MARKED_COLOR); */
|
||||
widget_move (&in->widget, 0, in->field_width - HISTORY_BUTTON_WIDTH + 1);
|
||||
addch (c);
|
||||
}
|
||||
#else
|
||||
attrset (MARKED_COLOR);
|
||||
tty_setcolor (MARKED_COLOR);
|
||||
addch (c);
|
||||
#endif
|
||||
}
|
||||
@ -846,7 +846,7 @@ update_input (WInput *in, int clear_first)
|
||||
if (has_history)
|
||||
draw_history_button (in);
|
||||
|
||||
attrset (in->color);
|
||||
tty_setcolor (in->color);
|
||||
|
||||
widget_move (&in->widget, 0, 0);
|
||||
|
||||
@ -1898,9 +1898,9 @@ listbox_draw (WListbox *l, int focused)
|
||||
/* Display the entry */
|
||||
if (e == l->current && sel_line == -1){
|
||||
sel_line = i;
|
||||
attrset (selc);
|
||||
tty_setcolor (selc);
|
||||
} else
|
||||
attrset (normalc);
|
||||
tty_setcolor (normalc);
|
||||
|
||||
widget_move (&l->widget, i, 0);
|
||||
|
||||
@ -1915,7 +1915,7 @@ listbox_draw (WListbox *l, int focused)
|
||||
l->cursor_y = sel_line;
|
||||
if (!l->scrollbar)
|
||||
return;
|
||||
attrset (normalc);
|
||||
tty_setcolor (normalc);
|
||||
listbox_drawscroll (l);
|
||||
}
|
||||
|
||||
@ -2469,19 +2469,19 @@ buttonbar_callback (Widget *w, widget_msg_t msg, int parm)
|
||||
if (!bb->visible)
|
||||
return MSG_HANDLED;
|
||||
widget_move (&bb->widget, 0, 0);
|
||||
attrset (DEFAULT_COLOR);
|
||||
tty_setcolor (DEFAULT_COLOR);
|
||||
bb->btn_width = buttonbat_get_button_width ();
|
||||
tty_printf ("%-*s", bb->widget.cols, "");
|
||||
for (i = 0; i < COLS / bb->btn_width && i < 10; i++) {
|
||||
widget_move (&bb->widget, 0, i * bb->btn_width);
|
||||
attrset (DEFAULT_COLOR);
|
||||
tty_setcolor (DEFAULT_COLOR);
|
||||
tty_printf ("%2d", i + 1);
|
||||
attrset (SELECTED_COLOR);
|
||||
tty_setcolor (SELECTED_COLOR);
|
||||
text = (bb->labels[i].text != NULL) ? bb->labels[i].text : "";
|
||||
addstr (str_fit_to_term (text, bb->btn_width - 2, J_CENTER_LEFT));
|
||||
attrset (DEFAULT_COLOR);
|
||||
tty_setcolor (DEFAULT_COLOR);
|
||||
}
|
||||
attrset (SELECTED_COLOR);
|
||||
tty_setcolor (SELECTED_COLOR);
|
||||
return MSG_HANDLED;
|
||||
|
||||
case WIDGET_DESTROY:
|
||||
@ -2621,12 +2621,12 @@ groupbox_callback (Widget *w, widget_msg_t msg, int parm)
|
||||
return MSG_NOT_HANDLED;
|
||||
|
||||
case WIDGET_DRAW:
|
||||
attrset (COLOR_NORMAL);
|
||||
tty_setcolor (COLOR_NORMAL);
|
||||
draw_box (g->widget.parent, g->widget.y - g->widget.parent->y,
|
||||
g->widget.x - g->widget.parent->x, g->widget.lines,
|
||||
g->widget.cols);
|
||||
|
||||
attrset (COLOR_HOT_NORMAL);
|
||||
tty_setcolor (COLOR_HOT_NORMAL);
|
||||
dlg_move (g->widget.parent, g->widget.y - g->widget.parent->y,
|
||||
g->widget.x - g->widget.parent->x + 1);
|
||||
addstr (str_term_form (g->title));
|
||||
|
Loading…
Reference in New Issue
Block a user