void resize_and_rescale(double scale) { int docwidth,docheight; double docscale; int sp_inner; double ltrimpct=0.0,rtrimpct=0.0; //ewl_object_maximum_h_set(EWL_OBJECT(pdfwidget),99999); //ewl_object_minimum_h_set(EWL_OBJECT(pdfwidget),0); sp_inner=CURRENT_W(scrollpane)-INSET_HORIZONTAL(scrollpane)-PADDING_HORIZONTAL(scrollpane); //if(EWL_SCROLLPANE(scrollpane)->vflag) // sp_inner-=CURRENT_W(EWL_OBJECT(EWL_SCROLLPANE(scrollpane)->vscrollbar)); //ewl_pdf_size_get(EWL_PDF(pdfwidget),&docwidth,&docheight); epdf_page_size_get (EWL_PDF(pdfwidget)->pdf_page,&docwidth,&docheight); if(fitmode==0) docscale=((double)sp_inner)/((double)docwidth)*scale; else if(fitmode==1) { ltrimpct=((double)get_settings()->ltrimpad)/((double)docwidth); rtrimpct=((double)get_settings()->rtrimpad)/((double)docwidth); docscale=((double)sp_inner)/((1.0-leftmarge+ltrimpct-rightmarge+rtrimpct)*((double)docwidth))*scale; } ewl_pdf_scale_set(EWL_PDF(pdfwidget),docscale,docscale); //ewl_object_custom_w_set(EWL_OBJECT(pdfwidget),floor(((double)sp_inner)*scale)); //ewl_object_custom_w_set(EWL_OBJECT(pdfwidget),floor(((double)sp_inner)*scale)); //ewl_object_custom_h_set(EWL_OBJECT(pdfwidget),floor(((double)docheight)/((double)docwidth)*((double)sp_inner)*scale)); ewl_object_custom_w_set(EWL_OBJECT(pdfwidget),floor(((double)docwidth)*docscale)); ewl_object_custom_h_set(EWL_OBJECT(pdfwidget),floor(((double)docheight)*docscale)); //ewl_object_position_request(EWL_OBJECT(pdfwidget),0,0); ewl_widget_configure(pdfwidget); //ewl_object_custom_w_set(EWL_OBJECT(trimpane),floor(((double)docwidth)*docscale)); //ewl_object_custom_h_set(EWL_OBJECT(trimpane),floor(((double)docheight)*docscale)); ewl_object_custom_w_set(EWL_OBJECT(trimpane),floor(((double)sp_inner)*scale)); ewl_object_custom_h_set(EWL_OBJECT(trimpane),floor(((double)docheight)*docscale)); ewl_object_position_request(EWL_OBJECT(trimpane),0,0); //ewl_object_place(EWL_OBJECT(pdfwidget),0,0,floor(((double)docwidth)*docscale),floor(((double)docheight)*docscale)); ewl_widget_configure(trimpane); ewl_widget_configure(scrollpane); if(fitmode==0) ewl_scrollpane_hscrollbar_value_set(EWL_SCROLLPANE(trimpane),0.0); else if(fitmode==1) ewl_scrollpane_hscrollbar_value_set(EWL_SCROLLPANE(trimpane),(leftmarge-ltrimpct)/(leftmarge-ltrimpct+rightmarge-rtrimpct)); }
void ewl_entropy_tip_window_display() { Ewl_Widget* tip_window = ewl_window_new(); Ewl_Widget* vbox = ewl_vbox_new(); Ewl_Widget* hbox = ewl_hbox_new(); Ewl_Widget* button; Ewl_Widget* image = ewl_image_new(); ewl_entropy_tip_window_create_tips(); tip_number = 0; ewl_object_alignment_set(EWL_OBJECT(hbox), EWL_FLAG_ALIGN_BOTTOM); ewl_object_alignment_set(EWL_OBJECT(vbox), EWL_FLAG_ALIGN_BOTTOM); ewl_object_alignment_set(EWL_OBJECT(tip_window), EWL_FLAG_ALIGN_BOTTOM); ewl_object_fill_policy_set(EWL_OBJECT(tip_window), EWL_FLAG_FILL_FILL); ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_FILL); ewl_container_child_append(EWL_CONTAINER(tip_window), vbox); ewl_container_child_append(EWL_CONTAINER(vbox), hbox); text_tip = ewl_text_new(); ewl_object_minimum_h_set(EWL_OBJECT(text_tip), 80); ewl_container_child_append(EWL_CONTAINER(hbox), text_tip); ewl_image_file_set(EWL_IMAGE(image), PACKAGE_DATA_DIR "/icons/tip.png", NULL); ewl_container_child_append(EWL_CONTAINER(hbox), image); ewl_widget_show(hbox); hbox = ewl_hbox_new(); ewl_widget_show(hbox); ewl_container_child_append(EWL_CONTAINER(vbox), hbox); button = ewl_button_new(); ewl_button_label_set(EWL_BUTTON(button), "Prev Tip"); ewl_object_custom_h_set(EWL_OBJECT(button), 15); ewl_widget_show(button); ewl_container_child_append(EWL_CONTAINER(hbox), button); button = ewl_button_new(); ewl_button_label_set(EWL_BUTTON(button), "Next Tip"); ewl_object_custom_h_set(EWL_OBJECT(button), 15); ewl_callback_append(button, EWL_CALLBACK_CLICKED, ewl_entropy_tip_window_tip_next_cb, NULL); ewl_widget_show(button); ewl_container_child_append(EWL_CONTAINER(hbox), button); button = ewl_button_new(); ewl_button_label_set(EWL_BUTTON(button), "Close"); ewl_object_custom_h_set(EWL_OBJECT(button), 15); ewl_callback_append(button, EWL_CALLBACK_CLICKED, ewl_entropy_tip_window_destroy_cb, tip_window); ewl_widget_show(button); ewl_container_child_append(EWL_CONTAINER(hbox), button); ewl_callback_append(tip_window, EWL_CALLBACK_DELETE_WINDOW, ewl_entropy_tip_window_destroy_cb, tip_window); ewl_widget_show(tip_window); ewl_widget_show(vbox); ewl_widget_show(text_tip); ewl_widget_show(image); ewl_entropy_tip_window_tip_next_cb(NULL,NULL,NULL); }
void resize_and_rescale(double scale) { int docwidth,docheight; double docscale; double ltrimpct=0.0,rtrimpct=0.0; int sp_inner_w = CURRENT_W(scrollpane) - INSET_HORIZONTAL(scrollpane) - PADDING_HORIZONTAL(scrollpane); int sp_inner_h = CURRENT_H(scrollpane) - INSET_VERTICAL(scrollpane) - PADDING_VERTICAL(scrollpane); hide_hint(NULL); page_size_get(&docwidth, &docheight); int orientation_horizontal; switch(epdf_page_orientation_get(EWL_PDF(pdfwidget)->pdf_page)) { case EPDF_PAGE_ORIENTATION_PORTRAIT: case EPDF_PAGE_ORIENTATION_UPSIDEDOWN: orientation_horizontal = 0; break; case EPDF_PAGE_ORIENTATION_LANDSCAPE: case EPDF_PAGE_ORIENTATION_SEASCAPE: orientation_horizontal = 1; } if(fitmode==0) { if(orientation_horizontal) docscale = ((double)sp_inner_h)/((double)docheight)*scale; else // orientation vertical docscale = ((double)sp_inner_w)/((double)docwidth)*scale; } else if(fitmode==1) { ltrimpct=((double)get_settings()->ltrimpad)/((double)docwidth); rtrimpct=((double)get_settings()->rtrimpad)/((double)docwidth); docscale=((double)sp_inner_w)/((1.0-leftmarge+ltrimpct-rightmarge+rtrimpct)*((double)docwidth))*scale; } ewl_pdf_scale_set(EWL_PDF(pdfwidget),docscale,docscale); ewl_object_custom_w_set(EWL_OBJECT(pdfwidget),floor(((double)docwidth)*docscale)); ewl_object_custom_h_set(EWL_OBJECT(pdfwidget),floor(((double)docheight)*docscale)); ewl_widget_configure(pdfwidget); if(orientation_horizontal) { ewl_object_custom_w_set(EWL_OBJECT(trimpane), floor(((double)docwidth)*docscale)); ewl_object_custom_h_set(EWL_OBJECT(trimpane), floor(((double)sp_inner_h)*scale)); } else { ewl_object_custom_w_set(EWL_OBJECT(trimpane), floor(((double)sp_inner_w)*scale)); ewl_object_custom_h_set(EWL_OBJECT(trimpane), floor(((double)docheight)*docscale)); } ewl_object_position_request(EWL_OBJECT(trimpane),0,0); ewl_widget_configure(trimpane); ewl_widget_configure(scrollpane); if(fitmode==0) ewl_scrollpane_hscrollbar_value_set(EWL_SCROLLPANE(trimpane),0.0); else if(fitmode==1) ewl_scrollpane_hscrollbar_value_set(EWL_SCROLLPANE(trimpane),(leftmarge-ltrimpct)/(leftmarge-ltrimpct+rightmarge-rtrimpct)); }