void TOCDialog(Evas *e, Evas_Object *obj,Ecore_List *list) { int numchoices=ecore_list_count(list); char **initchoices; //char **values; initchoices=(char **)malloc(sizeof(char*)*numchoices); //values=(char **)malloc(sizeof(char*)*numchoices); ecore_list_first_goto(list); int i; for(i=0;i<numchoices;i++) { asprintf(&(initchoices[i]),"%d. %s",(i%8+1),epdf_index_item_title_get((Epdf_Index_Item *)ecore_list_next(list))); } Evas_Object *tocchoicebox=init_choicebox(e,(const char**)initchoices,NULL, numchoices, toc_choicehandler, "Table of Contents",obj,(void *)list, true); for(i=0;i<numchoices;i++) { free(initchoices[i]); } //free(values); free(initchoices); int x,y,w,h; evas_object_geometry_get(tocchoicebox,&x,&y,&w,&h); evas_object_move(tocchoicebox,(int)(((double)get_win_width()-w)/2.0),(int)(((double)get_win_height()-h)/2.0)); }
void TrimmingDialog(Evas *e, Evas_Object *obj) { const char *initchoices[] = { "1. Left Trimming", "2. Right Trimming", "3. Top Trimming", "4. Bottom Trimming", }; char *lefttrim,*righttrim,*toptrim,*bottomtrim; asprintf(&lefttrim,"%dpx",get_lefttrim()); asprintf(&righttrim,"%dpx",get_righttrim()); asprintf(&toptrim,"%dpx",get_toptrim()); asprintf(&bottomtrim,"%dpx",get_bottomtrim()); const char *values[] = { lefttrim, righttrim, toptrim, bottomtrim, }; trimmingchoicebox=init_choicebox(e,initchoices, values, 4, trimming_choicehandler, "Trimming Settings",obj, NULL,true); int x,y,w,h; evas_object_geometry_get(trimmingchoicebox,&x,&y,&w,&h); evas_object_move(trimmingchoicebox,(int)(((double)get_win_width()-w)/2.0),(int)(((double)get_win_height()-h)/2.0)); free(lefttrim); free(righttrim); free(toptrim); free(bottomtrim); }
void FitModeDialog(Evas *e, Evas_Object *obj) { const char *initchoices[] = { "1. Fit Width", "2. Fit Height", "3. Best Fit", "4. Stretch Fit", "5. No Fit", }; const char *values[] = { "", "", "", "", "", }; fitmodechoicebox=init_choicebox(e,initchoices, values, 5, fitmode_choicehandler, "Fit Mode Settings",obj,NULL, true); int x,y,w,h; evas_object_geometry_get(fitmodechoicebox,&x,&y,&w,&h); evas_object_move(fitmodechoicebox,(int)(((double)get_win_width()-w)/2.0),(int)(((double)get_win_height()-h)/2.0)); }
void HPanEntry(Evas *e, Evas_Object *obj,const char *startval) { hpanentrybox=init_entrybox(e,"Hor. Panning Inc.",startval,3,hpan_entryhandler,obj); int x,y,w,h; evas_object_geometry_get(hpanentrybox,&x,&y,&w,&h); evas_object_move(hpanentrybox,(int)(((double)get_win_width()-w)/2.0),(int)(((double)get_win_height()-h)/2.0)); }
void BottomTrimEntry(Evas *e, Evas_Object *obj,const char *startval) { bottomtrimentrybox=init_entrybox(e,"Bottom Trimming.",startval,3,bottomtrim_entryhandler,obj); int x,y,w,h; evas_object_geometry_get(bottomtrimentrybox,&x,&y,&w,&h); evas_object_move(bottomtrimentrybox,(int)(((double)get_win_width()-w)/2.0),(int)(((double)get_win_height()-h)/2.0)); }
void ZoomEntry(Evas *e, Evas_Object *obj,const char *startval) { zoomentrybox=init_entrybox(e,"Zoom Inc.",startval,3,zoom_entryhandler,obj); int x,y,w,h; evas_object_geometry_get(zoomentrybox,&x,&y,&w,&h); evas_object_move(zoomentrybox,(int)(((double)get_win_width()-w)/2.0),(int)(((double)get_win_height()-h)/2.0)); }
void GotoPageEntry(Evas *e, Evas_Object *obj) { char *tempstr; asprintf(&tempstr,"Page? (%d/%d)",get_cur_page()+1,get_num_pages()); gotopageentrybox=init_entrybox(e,tempstr,"",4,goto_page_entryhandler,obj); free(tempstr); int x,y,w,h; evas_object_geometry_get(gotopageentrybox,&x,&y,&w,&h); evas_object_move(gotopageentrybox,(int)(((double)get_win_width()-w)/2.0),(int)(((double)get_win_height()-h)/2.0)); }
void show_progress(int current, int total) { int i,j,c_limit,width; width = get_win_width() - 9; printf("\r"); fflush(stdout); printf("["); c_limit = current * width / total; for (i=0; i<c_limit; ++i) { printf("#"); } for (j=c_limit; j<width; ++j) { printf("-"); } printf("] %.2f%%", (float)current/total * 100); }
void PreferencesDialog(Evas *e, Evas_Object *obj) { const char *initchoices[] = { "1. Hor. Panning", "2. Ver. Panning", "3. Trimming", "4. Zoom Increment", "5. Fit Mode", "6. Antialias", "7. Reader Mode", }; char *zoom; asprintf(&zoom,"%d%%",(int)(get_zoom_inc()*100)); char *hpan; asprintf(&hpan,"%d%%",(int)(get_hpan_inc()*100)); char *vpan; asprintf(&vpan,"%d%%",(int)(get_vpan_inc()*100)); const char *values[] = { hpan, vpan, "", zoom, FIT_STRINGS[get_fit_mode()], OFF_ON_STRINGS[get_antialias_mode()], OFF_ON_STRINGS[get_reader_mode()], }; preferenceschoicebox=init_choicebox(e,initchoices, values, 7, preferences_choicehandler, "LoCoPDF Settings",obj, NULL,true); int x,y,w,h; evas_object_geometry_get(preferenceschoicebox,&x,&y,&w,&h); evas_object_move(preferenceschoicebox,(int)(((double)get_win_width()-w)/2.0),(int)(((double)get_win_height()-h)/2.0)); free(zoom); free(hpan); free(vpan); }