Beispiel #1
0
int
query_user_menu(char *title, char *message)
{
	int key;
	char *dup = strdup(message);

	curr_stats.errmsg_shown = 2;

	redraw_error_msg(title, message, 0);

	do
	{
		key = wgetch(error_win);
	}
	while(key != 'y' && key != 'n' && key != ERR);

	free(dup);

	curr_stats.errmsg_shown = 0;

	werase(error_win);
	wrefresh(error_win);

	touchwin(stdscr);

	update_all_windows();

	if(curr_stats.need_update != UT_NONE)
		update_screen(UT_FULL);

	return key == 'y';
}
Beispiel #2
0
/* Internal function for displaying error messages to a user.  Automatically
 * skips whitespace in front of the message and does nothing for empty messages
 * (due to skipping whitespace-only are counted as empty). When the prompt_skip
 * isn't zero, asks user about successive messages.  Returns non-zero if all
 * successive messages should be skipped, otherwise zero is returned. */
static int
prompt_error_msg_internal(const char title[], const char message[],
		int prompt_skip)
{
	static int skip_until_started;

	if(curr_stats.load_stage == 0)
		return 1;
	if(curr_stats.load_stage < 2 && skip_until_started)
		return 1;

	message = skip_whitespace(message);
	if(*message == '\0')
	{
		return 0;
	}

	msg_kind = D_ERROR;

	redraw_error_msg(title, message, prompt_skip, 0);

	enter(MASK(R_OK) | (prompt_skip ? MASK(R_CANCEL) : 0));

	if(curr_stats.load_stage < 2)
		skip_until_started = (result == R_CANCEL);

	modes_update();
	if(curr_stats.need_update != UT_NONE)
		modes_redraw();

	return result == R_CANCEL;
}
Beispiel #3
0
/* Common implementation of prompt message.  The variants can be NULL. */
static void
prompt_msg_internal(const char title[], const char message[],
		const response_variant variants[])
{
	responses = variants;
	msg_kind = D_QUERY;

	redraw_error_msg(title, message, 0, 0);

	enter(variants == NULL ? MASK(R_YES, R_NO) : 0);

	modes_redraw();
}
Beispiel #4
0
/* Common implementation of prompt message.  The variants can be NULL. */
static void
prompt_msg_internal(const char title[], const char message[],
		const response_variant variants[])
{
	responses = variants;
	msg_kind = D_QUERY;

	redraw_error_msg(title, message, 0, 0);

	enter(MASK(R_YES, R_NO));

	touchwin(stdscr);

	update_all_windows();

	if(curr_stats.need_update != UT_NONE)
	{
		update_screen(UT_FULL);
	}
}
Beispiel #5
0
/* Internal function for displaying error messages to a user.  Automatically
 * skips whitespace in front of the message and does nothing for empty messages
 * (due to skipping whitespace-only are counted as empty). When the prompt_skip
 * isn't zero, asks user about successive messages.  Returns non-zero if all
 * successive messages should be skipped, otherwise zero is returned. */
static int
prompt_error_msg_internal(const char title[], const char message[],
		int prompt_skip)
{
	static int skip_until_started;
	int key;

	if(curr_stats.load_stage == 0)
		return 1;
	if(curr_stats.load_stage < 2 && skip_until_started)
		return 1;

	message = skip_whitespace(message);
	if(*message == '\0')
	{
		return 0;
	}

	curr_stats.errmsg_shown = 1;

	redraw_error_msg(title, message, prompt_skip);

	do
		key = wgetch(error_win);
	while(key != 13 && (!prompt_skip || key != 3)); /* ascii Return, Ctrl-c */

	if(curr_stats.load_stage < 2)
		skip_until_started = key == 3;

	werase(error_win);
	wrefresh(error_win);

	curr_stats.errmsg_shown = 0;

	modes_update();
	if(curr_stats.need_update != UT_NONE)
		modes_redraw();

	return key == 3;
}
Beispiel #6
0
void
redraw_error_msg_window(void)
{
	redraw_error_msg(NULL, NULL, 0);
}
Beispiel #7
0
void
redraw_msg_dialog(int lazy)
{
	redraw_error_msg(NULL, NULL, 0, lazy);
}