Exemple #1
0
static void pop_future(void)
{
    int here = currentpage;
    push_history();
    while (future_count > 0 && currentpage == here)
        currentpage = future[--future_count];
    push_history();
}
Exemple #2
0
static void jump_to_page(int newpage)
{
    newpage = fz_clampi(newpage, 0, fz_count_pages(ctx, doc) - 1);
    clear_future();
    push_history();
    currentpage = newpage;
    push_history();
}
Exemple #3
0
void
history_cmd (void)
{
    Listbox *listbox;
    GList *current;

    if (cmdline->need_push) {
	if (push_history (cmdline, cmdline->buffer) == 2)
	    cmdline->need_push = 0;
    }
    if (!cmdline->history) {
	message (1, MSG_ERROR, _(" The command history is empty "));
	return;
    }
    current = g_list_first (cmdline->history);
    listbox = create_listbox_window (60, 10, _(" Command history "),
				     "[Command Menu]");
    while (current) {
	LISTBOX_APPEND_TEXT (listbox, 0, (char *) current->data, current);
	current = g_list_next(current);
    }
    run_dlg (listbox->dlg);
    if (listbox->dlg->ret_value == B_CANCEL)
	current = NULL;
    else
	current = listbox->list->current->data;
    destroy_dlg (listbox->dlg);
    g_free (listbox);

    if (!current)
	return;
    cmdline->history = current;
    assign_text (cmdline, (char *) current->data);
    update_input (cmdline, 1);
}
static int previoushistory(lua_State *L)
{
  HIST_ENTRY *hist;
  if (!where_history())
    hist = current_history();
  else
    hist = previous_history();
  push_history(L, hist);
  return 1;
}
Exemple #5
0
static void do_app(void)
{
    if (ui.key == KEY_F4 && ui.mod == GLFW_MOD_ALT)
        quit();

    if (ui.down || ui.middle || ui.right || ui.key)
        showinfo = 0;

    if (!ui.focus && ui.key)
    {
        switch (ui.key)
        {
        case 'q':
            quit();
            break;
        case 'm':
            if (number == 0)
                push_history();
            else if (number > 0 && number < nelem(marks))
                marks[number] = currentpage;
            break;
        case 't':
            if (number == 0)
            {
                if (history_count > 0)
                    pop_history();
            }
            else if (number > 0 && number < nelem(marks))
            {
                jump_to_page(marks[number]);
            }
            break;
        case 'T':
            if (number == 0)
            {
                if (future_count > 0)
                    pop_future();
            }
            break;
        case 'N':
            search_dir = -1;
            if (search_hit_page == currentpage)
                search_page = currentpage + search_dir;
            else
                search_page = currentpage;
            if (search_page >= 0 && search_page < fz_count_pages(ctx, doc))
            {
                search_hit_page = -1;
                if (search_needle)
                    search_active = 1;
            }
            break;
        case 'n':
            search_dir = 1;
            if (search_hit_page == currentpage)
                search_page = currentpage + search_dir;
            else
                search_page = currentpage;
            if (search_page >= 0 && search_page < fz_count_pages(ctx, doc))
            {
                search_hit_page = -1;
                if (search_needle)
                    search_active = 1;
            }
            break;
        case 'f':
            toggle_fullscreen();
            break;
        case 'w':
            shrinkwrap();
            break;
        case 'r':
            reload();
            break;
        case 'o':
            toggle_outline();
            break;
        case 'W':
            auto_zoom_w();
            break;
        case 'H':
            auto_zoom_h();
            break;
        case 'Z':
            auto_zoom();
            break;
        case 'z':
            currentzoom = number > 0 ? number : DEFRES;
            break;
        case '<':
            currentpage -= 10 * fz_maxi(number, 1);
            break;
        case '>':
            currentpage += 10 * fz_maxi(number, 1);
            break;
        case ',':
        case KEY_PAGE_UP:
            currentpage -= fz_maxi(number, 1);
            break;
        case '.':
        case KEY_PAGE_DOWN:
            currentpage += fz_maxi(number, 1);
            break;
        case 'b':
            number = fz_maxi(number, 1);
            while (number--) smart_move_backward();
            break;
        case ' ':
            number = fz_maxi(number, 1);
            while (number--) smart_move_forward();
            break;
        case 'g':
            jump_to_page(number - 1);
            break;
        case 'G':
            jump_to_page(fz_count_pages(ctx, doc) - 1);
            break;
        case '+':
            currentzoom = zoom_in(currentzoom);
            break;
        case '-':
            currentzoom = zoom_out(currentzoom);
            break;
        case '[':
            currentrotate += 90;
            break;
        case ']':
            currentrotate -= 90;
            break;
        case 'l':
            showlinks = !showlinks;
            break;
        case 'i':
            showinfo = !showinfo;
            break;
        case '/':
            search_dir = 1;
            showsearch = 1;
            search_input.p = search_input.text;
            search_input.q = search_input.end;
            break;
        case '?':
            search_dir = -1;
            showsearch = 1;
            search_input.p = search_input.text;
            search_input.q = search_input.end;
            break;
        case KEY_UP:
            scroll_y -= 10;
            break;
        case KEY_DOWN:
            scroll_y += 10;
            break;
        case KEY_LEFT:
            scroll_x -= 10;
            break;
        case KEY_RIGHT:
            scroll_x += 10;
            break;
        }

        if (ui.key >= '0' && ui.key <= '9')
            number = number * 10 + ui.key - '0';
        else
            number = 0;

        currentpage = fz_clampi(currentpage, 0, fz_count_pages(ctx, doc) - 1);
        currentzoom = fz_clamp(currentzoom, MINRES, MAXRES);
        while (currentrotate < 0) currentrotate += 360;
        while (currentrotate >= 360) currentrotate -= 360;

        if (search_hit_page != currentpage)
            search_hit_page = -1; /* clear highlights when navigating */

        ui_needs_update = 1;

        ui.key = 0; /* we ate the key event, so zap it */
    }
}
static int nexthistory(lua_State *L)
{
  HIST_ENTRY *hist = next_history();
  push_history(L, hist);
  return 1;
}