Esempio n. 1
0
void cb_key_down(Ewl_Widget *w, void *ev, void *data)
{
    Ewl_Widget *curwidget;
    Ewl_Event_Key_Down *e;
    e = (Ewl_Event_Key_Down*)ev;
    int k = translate_key(e);
    
    curwidget=ewl_widget_name_find("pdfwidget");
    switch(k)
    {
    case 0:
        ewl_pdf_page_next(EWL_PDF(curwidget));
        resize_and_rescale(curscale);
        fprintf(stderr,"l:%d; r:%d; t:%d; b:%d\n",get_left_margin(),get_right_margin(),get_top_margin(),get_bottom_margin());
        //update_statusbar();
        break;
    case 9:
        ewl_pdf_page_previous(EWL_PDF(curwidget));
        resize_and_rescale(curscale);
        //update_statusbar();
        break;
    case 8:
        curscale+=((double)get_settings()->zoominc)/100.0;
        resize_and_rescale(curscale);
        //update_statusbar();
        break;
    case 7:
        curscale-=((double)get_settings()->zoominc)/100.0;
        resize_and_rescale(curscale);
        //update_statusbar();
        break;
    /*case 6:
        if(ewl_pdf_orientation_get(EWL_PDF(curwidget))==EPDF_PAGE_ORIENTATION_LANDSCAPE)
            ewl_pdf_orientation_set(EWL_PDF(curwidget),EPDF_PAGE_ORIENTATION_PORTRAIT);
        else
            ewl_pdf_orientation_set(EWL_PDF(curwidget),EPDF_PAGE_ORIENTATION_LANDSCAPE);
        resize_and_rescale(curscale);
        //update_statusbar();
        break;*/
    case 1:
        move_hscrollbar(EWL_SCROLLPANE(scrollpane), -get_horizontal_pan_inc());
        break;
    case 2:
        move_hscrollbar(EWL_SCROLLPANE(scrollpane), get_horizontal_pan_inc());
        break;
    case 3:
        move_vscrollbar(EWL_SCROLLPANE(scrollpane), get_vertical_pan_inc());
        break;    
    case 4:
        move_vscrollbar(EWL_SCROLLPANE(scrollpane), -get_vertical_pan_inc());
        break;
    case 5:
        if(fitmode==0)
            fitmode=1;
        else if(fitmode==1)
            fitmode=0;
        calculate_margins();
        resize_and_rescale(curscale);
        break;
    case K_RETURN:
        ewl_widget_show(menu);
        ewl_widget_focus_send(menu);
        break;
    case K_ESCAPE:
        ewl_main_quit();
        break;
    default:
        return;
    }
    
    
    
}
Esempio n. 2
0
File: madpdf.c Progetto: avm/madpdf
void cb_key_down(Ewl_Widget *w, void *ev, void *data)
{
    Ewl_Widget *curwidget;
    Ewl_Event_Key_Down *e;
    e = (Ewl_Event_Key_Down*)ev;
    int k = translate_key(e);
    
    curwidget=ewl_widget_name_find("pdfwidget");
    switch(k)
    {
    case 0:
        ewl_pdf_page_next(EWL_PDF(curwidget));
        resize_and_rescale(curscale);
        break;
    case 9:
        ewl_pdf_page_previous(EWL_PDF(curwidget));
        resize_and_rescale(curscale);
        break;
    case 8:
        curscale+=((double)get_settings()->zoominc)/100.0;
        resize_and_rescale(curscale);
        break;
    case 7:
        curscale-=((double)get_settings()->zoominc)/100.0;
        resize_and_rescale(curscale);
        break;
    case 6:
        change_orientation(curwidget);
        resize_and_rescale(curscale);
        break;
    case 1:
        move_hscrollbar(EWL_SCROLLPANE(scrollpane), -1);
        break;
    case 2:
        move_hscrollbar(EWL_SCROLLPANE(scrollpane),  1);
        break;
    case 3:
        move_vscrollbar(EWL_SCROLLPANE(scrollpane),  1);
        break;    
    case 4:
        move_vscrollbar(EWL_SCROLLPANE(scrollpane), -1);
        break;
    case 5:
        if(fitmode==0)
            fitmode=1;
        else if(fitmode==1)
            fitmode=0;
        calculate_margins();
        resize_and_rescale(curscale);
        break;
    case K_RETURN:
        ewl_widget_show(menu);
        ewl_widget_focus_send(menu);
        break;
    case K_ESCAPE:
        ewl_main_quit();
        break;
    default:
        return;
    }
    
    
    
}