Exemplo n.º 1
0
void calculate_margins()
{
    int docwidth,docheight;
    double hscale,vscale;
    epdf_page_size_get (EWL_PDF(pdfwidget)->pdf_page,&docwidth,&docheight);
    ewl_pdf_scale_get(EWL_PDF(pdfwidget),&hscale,&vscale);
    leftmarge=((double)get_left_margin())/floor(((double)docwidth)*hscale);
    rightmarge=((double)get_right_margin())/floor(((double)docwidth)*hscale);
    fprintf(stderr,"%f %f",leftmarge,rightmarge);
}
Exemplo n.º 2
0
Arquivo: madpdf.c Projeto: avm/madpdf
void calculate_margins()
{
    int docwidth,docheight;
    double hscale,vscale;
    page_size_get(&docwidth, &docheight);
    page_scale_get(&hscale, &vscale);
    leftmarge=((double)get_left_margin())/floor(((double)docwidth)*hscale);
    rightmarge=((double)get_right_margin())/floor(((double)docwidth)*hscale);
    fprintf(stderr,"%f %f",leftmarge,rightmarge);
}
Exemplo n.º 3
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;
    }
    
    
    
}