Ejemplo n.º 1
0
void
ui_stat_refresh(void)
{
	ui_stat_job_bar_check_for_updates();

	ui_refresh_win(job_bar);
	ui_refresh_win(stat_win);
}
Ejemplo n.º 2
0
Archivo: menu.c Proyecto: acklinr/vifm
/* Gives menu-specific keyboard routine to process the shortcut.  Returns zero
 * if the shortcut wasn't processed, otherwise non-zero is returned. */
static int
pass_combination_to_khandler(const wchar_t keys[])
{
	KHandlerResponse handler_response;

	if(menu->key_handler == NULL)
	{
		return 0;
	}

	handler_response = menu->key_handler(view, menu, keys);

	switch(handler_response)
	{
		case KHR_REFRESH_WINDOW:
			ui_refresh_win(menu_win);
			return 1;
		case KHR_CLOSE_MENU:
			leave_menu_mode(1);
			return 1;
		case KHR_MORPHED_MENU:
			assert(!vle_mode_is(MENU_MODE) && "Wrong use of KHR_MORPHED_MENU.");
			return 1;
		case KHR_UNHANDLED:
			return 0;

		default:
			assert(0 && "Unknown menu-specific keyboard handler response.");
			return 0;
	}
}
Ejemplo n.º 3
0
Archivo: menu.c Proyecto: acklinr/vifm
static void
cmd_gg(key_info_t key_info, keys_info_t *keys_info)
{
	menus_erase_current(menu->state);
	menus_set_pos(menu->state, def_count(key_info.count) - 1);
	ui_refresh_win(menu_win);
}
Ejemplo n.º 4
0
Archivo: menu.c Proyecto: acklinr/vifm
static void
cmd_L(key_info_t key_info, keys_info_t *keys_info)
{
	int top;
	int off;
	if(menu->key_handler != NULL)
	{
		if(pass_combination_to_khandler(L"L"))
		{
			return;
		}
	}

	off = MAX(cfg.scroll_off, 0);
	if(off > getmaxy(menu_win)/2)
	{
		return;
	}

	top = menu->top + getmaxy(menu_win);
	if(menu->top + getmaxy(menu_win) < menu->len - 1)
	{
		top -= off;
	}

	menus_erase_current(menu->state);
	menus_set_pos(menu->state, top - 3);
	ui_refresh_win(menu_win);
}
Ejemplo n.º 5
0
Archivo: menu.c Proyecto: acklinr/vifm
void
menu_partial_redraw(void)
{
	menus_partial_redraw(menu->state);
	menus_set_pos(menu->state, menu->pos);
	ui_refresh_win(menu_win);
}
Ejemplo n.º 6
0
/* Draws suggestion box and all its items (from completion list). */
static void
draw_suggestion_box(void)
{
	/* TODO: consider possibility of multicolumn display. */

	const vle_compl_t *const items = vle_compl_get_items();
	int height;
	WINDOW *const win = prepare_suggestion_box(&height);
	size_t max_title_width;
	int i;

	max_title_width = 0U;
	for(i = 0; i < height; ++i)
	{
		const size_t width = utf8_strsw(items[i].text);
		if(width > max_title_width)
		{
			max_title_width = width;
		}
	}

	for(i = 0; i < height; ++i)
	{
		checked_wmove(win, i, 0);
		ui_stat_draw_popup_line(win, items[i].text, items[i].descr,
				max_title_width);
	}

	ui_refresh_win(win);
}
Ejemplo n.º 7
0
static void
cmd_h(key_info_t key_info, keys_info_t *keys_info)
{
	descending = !descending;
	clear_at_pos();
	print_at_pos();
	ui_refresh_win(sort_win);
}
Ejemplo n.º 8
0
/* Updates hardware cursor to be on currently active area of the interface,
 * which depends mainly on current mode.. */
static void
update_hardware_cursor(void)
{
	if(ui_sb_multiline())
	{
		checked_wmove(status_bar, 0, 0);
		ui_refresh_win(status_bar);
		return;
	}

	switch(vle_mode_get())
	{
		case MENU_MODE:
		case FILE_INFO_MODE:
		case MORE_MODE: ui_refresh_win(menu_win);       break;
		case CHANGE_MODE:
		case ATTR_MODE: ui_refresh_win(change_win);     break;
		case MSG_MODE:  ui_refresh_win(error_win);      break;
		case VIEW_MODE: ui_refresh_win(curr_view->win); break;
		case SORT_MODE: ui_refresh_win(sort_win);       break;

		case NORMAL_MODE:
		case VISUAL_MODE:
			if(should_check_views_for_changes())
			{
				ui_refresh_win(curr_view->win);
			}
			break;
	}
}
Ejemplo n.º 9
0
void
update_input_buf(void)
{
	if(curr_stats.use_input_bar)
	{
		werase(input_win);
		wprintw(input_win, "%ls", (curr_input_buf == NULL) ? L"" : curr_input_buf);
		ui_refresh_win(input_win);
	}
}
Ejemplo n.º 10
0
Archivo: menu.c Proyecto: acklinr/vifm
static void
cmd_k(key_info_t key_info, keys_info_t *keys_info)
{
	if(menu->pos != 0)
	{
		menus_erase_current(menu->state);
		menu->pos -= def_count(key_info.count);
		menus_set_pos(menu->state, menu->pos);
		ui_refresh_win(menu_win);
	}
}
Ejemplo n.º 11
0
Archivo: menu.c Proyecto: acklinr/vifm
static int
goto_cmd(const cmd_info_t *cmd_info)
{
	if(cmd_info->end != NOT_DEF)
	{
		menus_erase_current(menu->state);
		menus_set_pos(menu->state, cmd_info->end);
		ui_refresh_win(menu_win);
	}
	return 0;
}
Ejemplo n.º 12
0
Archivo: menu.c Proyecto: acklinr/vifm
/* Jump to percent of list. */
static void
cmd_percent(key_info_t key_info, keys_info_t *keys_info)
{
	int line;
	if(key_info.count == NO_COUNT_GIVEN || key_info.count > 100)
	{
		return;
	}
	line = (key_info.count*menu->len)/100;
	menus_set_pos(menu->state, line);
	ui_refresh_win(menu_win);
}
Ejemplo n.º 13
0
/* Refreshes given window, possibly lazily. */
static void
refresh_window(WINDOW *win, int lazily)
{
	if(lazily)
	{
		wnoutrefresh(stat_win);
	}
	else
	{
		ui_refresh_win(stat_win);
	}
}
Ejemplo n.º 14
0
Archivo: menu.c Proyecto: acklinr/vifm
static void
cmd_G(key_info_t key_info, keys_info_t *keys_info)
{
	if(key_info.count == NO_COUNT_GIVEN)
	{
		key_info.count = menu->len;
	}

	menus_erase_current(menu->state);
	menus_set_pos(menu->state, key_info.count - 1);
	ui_refresh_win(menu_win);
}
Ejemplo n.º 15
0
static void
cmd_k(key_info_t key_info, keys_info_t *keys_info)
{
	if(key_info.count == NO_COUNT_GIVEN)
		key_info.count = 1;

	clear_at_pos();
	curr -= key_info.count;
	if(curr < top)
		curr = top;

	print_at_pos();
	ui_refresh_win(sort_win);
}
Ejemplo n.º 16
0
static void
cmd_j(key_info_t key_info, keys_info_t *keys_info)
{
	if(key_info.count == NO_COUNT_GIVEN)
		key_info.count = 1;

	clear_at_pos();
	curr += key_info.count;
	if(curr > bottom)
		curr = bottom;

	print_at_pos();
	ui_refresh_win(sort_win);
}
Ejemplo n.º 17
0
void
redraw_sort_dialog(void)
{
	int x, y, cy;

	y = (getmaxy(stdscr) - ((top + SK_COUNT) - 2 + 3))/2;
	x = (getmaxx(stdscr) - SORT_WIN_WIDTH)/2;
	wresize(sort_win, MIN(getmaxy(stdscr), SK_COUNT + 6), SORT_WIN_WIDTH);
	mvwin(sort_win, MAX(0, y), x);

	werase(sort_win);
	box(sort_win, 0, 0);

	mvwaddstr(sort_win, 0, (getmaxx(sort_win) - 6)/2, " Sort ");
	mvwaddstr(sort_win, top - 2, 2, " Sort files by:");
	cy = top;
	mvwaddstr(sort_win, cy++, 2, " [   ] e Extension");
	mvwaddstr(sort_win, cy++, 2, " [   ] f File Extension");
	mvwaddstr(sort_win, cy++, 2, " [   ] n Name");
	mvwaddstr(sort_win, cy++, 2, " [   ] N Name (ignore case)");
	mvwaddstr(sort_win, cy++, 2, " [   ] t Type");
	mvwaddstr(sort_win, cy++, 2, " [   ] d Dir");
#ifndef _WIN32
	mvwaddstr(sort_win, cy++, 2, " [   ] r Group ID");
	mvwaddstr(sort_win, cy++, 2, " [   ] R Group Name");
	mvwaddstr(sort_win, cy++, 2, " [   ] M Mode");
	mvwaddstr(sort_win, cy++, 2, " [   ] p Permissions");
	mvwaddstr(sort_win, cy++, 2, " [   ] o Owner ID");
	mvwaddstr(sort_win, cy++, 2, " [   ] O Owner Name");
	mvwaddstr(sort_win, cy++, 2, " [   ] L Links Count");
	mvwaddstr(sort_win, cy++, 2, " [   ] I Inode");
#endif
	mvwaddstr(sort_win, cy++, 2, " [   ] s Size");
	mvwaddstr(sort_win, cy++, 2, " [   ] i Item Count");
	mvwaddstr(sort_win, cy++, 2, " [   ] u Groups");
	mvwaddstr(sort_win, cy++, 2, " [   ] T Link Target");
	mvwaddstr(sort_win, cy++, 2, " [   ] a Time Accessed");
#ifndef _WIN32
	mvwaddstr(sort_win, cy++, 2, " [   ] c Time Changed");
#else
	mvwaddstr(sort_win, cy++, 2, " [   ] c Time Created");
#endif
	mvwaddstr(sort_win, cy++, 2, " [   ] m Time Modified");
	mvwaddstr(sort_win, cy++, 2, " [   ] S Star Rating");  //add by sim1
	assert(cy - top == SK_COUNT && "Sort dialog and sort options should not diverge");
	print_at_pos();

	ui_refresh_win(sort_win);
}
Ejemplo n.º 18
0
void
draw_msgf(const char title[], const char ctrl_msg[], int recommended_width,
		const char format[], ...)
{
	char msg[8192];
	va_list pa;

	va_start(pa, format);
	vsnprintf(msg, sizeof(msg), format, pa);
	va_end(pa);

	draw_msg(title, msg, ctrl_msg, 0, recommended_width);
	touch_all_windows();
	ui_refresh_win(error_win);
}
Ejemplo n.º 19
0
Archivo: menu.c Proyecto: acklinr/vifm
static void
cmd_H(key_info_t key_info, keys_info_t *keys_info)
{
	int top;
	int off = MAX(cfg.scroll_off, 0);
	if(off > getmaxy(menu_win)/2)
	{
		return;
	}

	top = (menu->top == 0) ? 0 : (menu->top + off);

	menus_erase_current(menu->state);
	menus_set_pos(menu->state, top);
	ui_refresh_win(menu_win);
}
Ejemplo n.º 20
0
/* Moves cursor to the specified line and updates the dialog. */
static void
goto_line(int line)
{
	if(line > bottom)
	{
		line = bottom;
	}
	if(curr == line)
	{
		return;
	}

	clear_at_pos();
	curr = line;
	print_at_pos();
	ui_refresh_win(sort_win);
}
Ejemplo n.º 21
0
Archivo: menu.c Proyecto: acklinr/vifm
/* Moves cursor to the middle of the window. */
static void
cmd_M(key_info_t key_info, keys_info_t *keys_info)
{
	int new_pos;
	if(menu->len < getmaxy(menu_win))
	{
		new_pos = DIV_ROUND_UP(menu->len, 2);
	}
	else
	{
		new_pos = menu->top + DIV_ROUND_UP(getmaxy(menu_win) - 3, 2);
	}

	menus_erase_current(menu->state);
	menus_set_pos(menu->state, MAX(0, new_pos - 1));
	ui_refresh_win(menu_win);
}
Ejemplo n.º 22
0
/* Draws error message on the screen or redraws the last message when both
 * title_arg and message_arg are NULL. */
static void
redraw_error_msg(const char title_arg[], const char message_arg[],
		int prompt_skip, int lazy)
{
	/* TODO: refactor this function redraw_error_msg() */

	static const char *title;
	static const char *message;
	static int ctrl_c;

	const char *ctrl_msg;
	const int centered = (msg_kind == D_QUERY);

	if(title_arg != NULL && message_arg != NULL)
	{
		title = title_arg;
		message = message_arg;
		ctrl_c = prompt_skip;
	}

	if(title == NULL || message == NULL)
	{
		assert(title != NULL && "Asked to redraw dialog, but no title is set.");
		assert(message != NULL && "Asked to redraw dialog, but no message is set.");
		return;
	}

	ctrl_msg = get_control_msg(msg_kind, ctrl_c);
	draw_msg(title, message, ctrl_msg, centered, 0);

	if(lazy)
	{
		wnoutrefresh(error_win);
	}
	else
	{
		ui_refresh_win(error_win);
	}
}
Ejemplo n.º 23
0
Archivo: menu.c Proyecto: acklinr/vifm
void
menu_pre(void)
{
	touchwin(ruler_win);
	ui_refresh_win(ruler_win);
}