Browse Source

Replaced functions.

attrset() -> tty_setcolor()
move() -> tty_gotoyx()
getyx() -> tty_getyx()
Andrew Borodin 16 years ago
parent
commit
ebbf6fbcdc
10 changed files with 44 additions and 48 deletions
  1. 8 10
      edit/editdraw.c
  2. 4 4
      src/achown.c
  3. 3 3
      src/chmod.c
  4. 2 2
      src/chown.c
  5. 2 2
      src/cons.handler.c
  6. 10 10
      src/dialog.c
  7. 2 4
      src/dialog.h
  8. 2 2
      src/find.c
  9. 8 8
      src/help.c
  10. 3 3
      src/hotlist.c

+ 8 - 10
edit/editdraw.c

@@ -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);
 	    }

+ 4 - 4
src/achown.c

@@ -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);

+ 3 - 3
src/chmod.c

@@ -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 "));

+ 2 - 2
src/chown.c

@@ -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);

+ 2 - 2
src/cons.handler.c

@@ -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);

+ 10 - 10
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));
     }

+ 2 - 4
src/dialog.h

@@ -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;
 

+ 2 - 2
src/find.c

@@ -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 ();

+ 8 - 8
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;

+ 3 - 3
src/hotlist.c

@@ -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);

Some files were not shown because too many files changed in this diff