Example #1
0
void			ft_moove(t_infos *infos, int key)
{
	int		lid;
	int		value;

	lid = infos->lastid;
	if (key == K_TOP)
		value = ft_top(infos, lid);
	if (key == K_BOTTOM)
		value = ft_bottom(infos, lid);
	else if (key == K_LEFT)
		value = ft_jmp_left(infos, lid);
	else if (key == K_RIGHT)
		value = ft_jmp_right(infos, lid);
	else if (key == K_SPACE)
	{
		ft_selected(infos);
		ft_moove(infos, K_BOTTOM);
	}
	else if (key == K_SELALL)
		ft_select_all(infos, 1);
	else if (key == K_DESELALL)
		ft_select_all(infos, 0);
	if (key == K_RIGHT || key == K_LEFT || key == K_TOP || key == K_BOTTOM)
		ft_calc_val(infos, value, lid);
}
Example #2
0
t_elem	*ft_get_input(char *s, t_elem *l, int *flag)
{
	if (*flag == 1)
		*flag = 0;
	else if (s[0] == 27 && s[2] == 'A')
		ft_up(l);
	else if (s[0] == 27 && s[2] == 'B')
		ft_down(l);
	else if (s[0] == 32)
		ft_space(l);
	else if (s[0] == 1)
		ft_select_all(l);
	else if (s[0] == 24)
		ft_unselect_all(l);
	else if (s[0] == 27 && s[2] == 'F')
		ft_go_toend(l);
	else if (s[0] == 27 && s[2] == 'H')
		ft_go_home(l);
	else if ((s[0] == 27 && s[1] == 0) || s[0] == 4)
		ft_unset_canon();
	else if (s[0] == '\n')
		ft_enter(l);
	else if (s[0] == 8 || s[0] == 127 || (s[0] == 27 && s[2] == '3'))
		l = ft_delete(l);
	return (l);
}