コード例 #1
0
ファイル: madpdf.c プロジェクト: avm/madpdf
static void move_hscrollbar(Ewl_Scrollpane *s, double direction)
{
    double rel, abs;
    get_horizontal_pan_inc(&rel, &abs);
    rel *= direction;
    ewl_scrollpane_hscrollbar_value_set(s,
            scroll_pos_add(ewl_scrollpane_hscrollbar_value_get(s), rel));
    update_statusbar();
}
コード例 #2
0
ファイル: madpdf.c プロジェクト: avm/madpdf
void update_statusbar()
{
    static char statlabel1str[100];
    sprintf(statlabel1str,"MadPDF (OK for Menu)");
    ewl_label_text_set(EWL_LABEL(statlabel1),statlabel1str);
    
    int curpage,totalpage;
    curpage=ewl_pdf_page_get(EWL_PDF(pdfwidget))+1;
    totalpage=epdf_document_page_count_get(ewl_pdf_pdf_document_get(EWL_PDF(pdfwidget)));
    
    static char statlabel2str[100];
    sprintf(statlabel2str,"pg: %d/%d  zoom: %d%%  ",curpage,totalpage,(int)round(curscale*100.0));
    double hpos,vpos;
    int leftarr=0,rightarr=0,downarr=0,uparr=0;
    if(CURRENT_W(trimpane)>CURRENT_W(scrollpane))
    {
        hpos=ewl_scrollpane_hscrollbar_value_get(EWL_SCROLLPANE(scrollpane));
        if(hpos>0.0)
        {
            leftarr=1;
        }
        if(hpos<1.0)
        {
            rightarr=1;    
        }
        
    }
    if(CURRENT_H(trimpane)>CURRENT_H(scrollpane))
    {
        vpos=ewl_scrollpane_vscrollbar_value_get(EWL_SCROLLPANE(scrollpane));
        if(vpos>0.0)
        {
            uparr=1;
        }
        if(vpos<1.0)
        {
            downarr=1;    
        }
        
    }
    if(leftarr||rightarr||downarr||uparr)
        strcat(statlabel2str,"pan: ");
    else
        strcat(statlabel2str,"pan: none");
    if(leftarr)
        strcat(statlabel2str,"←");
    if(rightarr)
        strcat(statlabel2str,"→");
    if(downarr)
        strcat(statlabel2str,"↓");
    if(uparr)
        strcat(statlabel2str,"↑");
    ewl_label_text_set(EWL_LABEL(statlabel2),statlabel2str);
}
コード例 #3
0
ファイル: madpdf.c プロジェクト: avm/madpdf
/* Swap scrollbar values after an orientation change.
 * direction == -1 -> turn clockwise, 1 -> counter-clockwise. */
static void turn_scrollbars(Ewl_Scrollpane *s, int direction)
{
    double h = from_scroll_position(ewl_scrollpane_hscrollbar_value_get(s));
    double v = from_scroll_position(ewl_scrollpane_vscrollbar_value_get(s));

    double new_h =  v * direction;
    double new_v = -h * direction;

    ewl_scrollpane_hscrollbar_value_set(s, to_scroll_position(new_h));
    ewl_scrollpane_vscrollbar_value_set(s, to_scroll_position(new_v));
    update_statusbar();
}
コード例 #4
0
ファイル: madpdf.c プロジェクト: quickhand/madpdf
static void move_hscrollbar(Ewl_Scrollpane *s, double amount)
{
    ewl_scrollpane_hscrollbar_value_set(s,
            clamp(0.0, ewl_scrollpane_hscrollbar_value_get(s) + amount, 1.0));
    update_statusbar();
}