Enlightenment CVS committal Author : titansoccer15 Project : e17 Module : proto
Dir : e17/proto/ephoto/src Modified Files: ephoto.c Log Message: Adding more command options to ephoto... these are just goodies now :). ephoto --presentation-dir /path/to/dir loads up all the images from a dir into a presentation. ephoto --slideshow-dir /path/to/dir loads up all the images from a dir into a slideshow. =================================================================== RCS file: /cvsroot/enlightenment/e17/proto/ephoto/src/ephoto.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -3 -r1.20 -r1.21 --- ephoto.c 22 Mar 2006 03:17:02 -0000 1.20 +++ ephoto.c 23 Mar 2006 01:46:00 -0000 1.21 @@ -21,6 +21,7 @@ int argloop = 0; int argfit = 0; int argfullscreen = 0; +int argload = 0; char *audios; char buf[PATH_MAX]; char argimage[PATH_MAX]; @@ -63,6 +64,117 @@ mainwin = 0; nopresent = 0; } + if ( argint < argc && !strcmp(argv[argint], "--slideshow-dir") && noslide != 0 ) { + int imageint; + Ecore_List *image_list; + image_list = ecore_list_new(); + imageint = argint; + imageint++; + if ( ecore_file_is_dir(argv[imageint]) ) { + char trues[PATH_MAX]; + if (argv[imageint][strlen(argv[imageint])-1] != '/') { + snprintf(trues, PATH_MAX, "%s/", argv[imageint]); + } + else { + snprintf(trues, PATH_MAX, "%s", argv[imageint]); + } + image_list = ecore_file_ls(argv[imageint]); + while ( !ecore_list_is_empty(image_list) ) { + char *pathi; + char pathw[PATH_MAX]; + pathi = ecore_list_remove_first(image_list); + snprintf(pathw, PATH_MAX, "%s%s", trues, pathi); + if ( fnmatch("*.[Pp][Nn][Gg]", pathw, 0) == 0 ) { + ecore_dlist_append(m->imagelist, strdup(pathw)); + slidenum++; + } + if ( fnmatch("*.[Jj][Pp][Gg]", pathw, 0) == 0 ) { + ecore_dlist_append(m->imagelist, strdup(pathw)); + slidenum++; + } + if ( fnmatch("*.[Jj][Pp][Ee][Gg]", pathw, 0) == 0 ) { + ecore_dlist_append(m->imagelist, strdup(pathw)); + slidenum++; + } + } + mainwin = 0; + nopresent = 0; + } + } + else if ( argint < argc && !strcmp(argv[argint], "--presentation-dir") && nopresent != 0 ) { + int imageint; + Ecore_List *image_list; + image_list = ecore_list_new(); + imageint = argint; + imageint++; + if ( ecore_file_is_dir(argv[imageint]) ) { + char trues[PATH_MAX]; + if (argv[imageint][strlen(argv[imageint])-1] != '/') { + snprintf(trues, PATH_MAX, "%s/", argv[imageint]); + } + else { + snprintf(trues, PATH_MAX, "%s", argv[imageint]); + } + image_list = ecore_file_ls(argv[imageint]); + while ( !ecore_list_is_empty(image_list) ) { + char *pathi; + char pathw[PATH_MAX]; + pathi = ecore_list_remove_first(image_list); + snprintf(pathw, PATH_MAX, "%s%s", trues, pathi); + if ( fnmatch("*.[Pp][Nn][Gg]", pathw, 0) == 0 ) { + ecore_dlist_append(m->imagelist, strdup(pathw)); + slidenum++; + } + if ( fnmatch("*.[Jj][Pp][Gg]", pathw, 0) == 0 ) { + ecore_dlist_append(m->imagelist, strdup(pathw)); + slidenum++; + } + if ( fnmatch("*.[Jj][Pp][Ee][Gg]", pathw, 0) == 0 ) { + ecore_dlist_append(m->imagelist, strdup(pathw)); + slidenum++; + } + } + mainwin = 0; + noslide = 0; + } + + } + else if ( argint < argc && !strcmp(argv[argint], "--load-images") && noslide == 0 && nopresent == 0 ) { + int imageint; + Ecore_List *image_list; + image_list = ecore_list_new(); + imageint = argint; + imageint++; + if ( ecore_file_is_dir(argv[imageint]) ) { + char trues[PATH_MAX]; + if (argv[imageint][strlen(argv[imageint])-1] != '/') { + snprintf(trues, PATH_MAX, "%s/", argv[imageint]); + } + else { + snprintf(trues, PATH_MAX, "%s", argv[imageint]); + } + image_list = ecore_file_ls(argv[imageint]); + while ( !ecore_list_is_empty(image_list) ) { + char *pathi; + char pathw[PATH_MAX]; + pathi = ecore_list_remove_first(image_list); + snprintf(pathw, PATH_MAX, "%s%s", trues, pathi); + if ( fnmatch("*.[Pp][Nn][Gg]", pathw, 0) == 0 ) { + ecore_dlist_append(m->imagelist, strdup(pathw)); + slidenum++; + } + if ( fnmatch("*.[Jj][Pp][Gg]", pathw, 0) == 0 ) { + ecore_dlist_append(m->imagelist, strdup(pathw)); + slidenum++; + } + if ( fnmatch("*.[Jj][Pp][Ee][Gg]", pathw, 0) == 0 ) { + ecore_dlist_append(m->imagelist, strdup(pathw)); + slidenum++; + } + } + argload = 1; + } + } else if ( argint < argc && !strcmp(argv[argint], "--presentation") && nopresent != 0 ) { int imageint; imageint = argint; @@ -119,7 +231,9 @@ printf("ephoto --help displays all available options\n"); printf("ephoto --length slidelength sets the integer slidelength(seconds) as the transition time for slideshow\n"); printf("ephoto --loop sets the slideshow to loop\n"); + printf("ephoto --presentation-dir /path/to/dir loads every image from /path/to/dir into a presentation\n"); printf("ephoto --presentation /path/to/image /path/to/image /path/to/image starts the presentation using the specified images\n"); + printf("ephoto --slideshow-dir /path/to/dir loads every image from /path/to/dir into a slideshow\n"); printf("ephoto --slideshow /path/to/image /path/to/image /path/to/image starts the slideshow using the specified images\n"); printf("ephoto --view-image /path/to/image sets /path/to/image as the default image in the image viewer tab.\n"); printf("ephoto --win-size integer integer sets the first integer as the width and the second integer as the height of the presentation/slideshow window\n"); @@ -467,6 +581,37 @@ ewl_object_fill_policy_set(EWL_OBJECT(m->vbox), EWL_FLAG_FILL_ALL); ewl_object_fill_policy_set(EWL_OBJECT(m->vbox2), EWL_FLAG_FILL_ALL); ewl_object_fill_policy_set(EWL_OBJECT(m->hbox), EWL_FLAG_FILL_ALL); + + if ( argload == 1 ) { + char *first; + char *bname; + char *bname2; + char *next; + first = ecore_dlist_goto_first(m->imagelist); + if ( first != NULL ) { + bname = basename(first); + m->i = ewl_iconbox_icon_add(EWL_ICONBOX(m->ib), bname, first); + ewl_callback_append(m->i, EWL_CALLBACK_CLICKED, iremove_cb, NULL); + ewl_widget_name_set(m->i, first); + + ewl_iconbox_icon_arrange(EWL_ICONBOX(m->ib)); + slidenum++; + printf("%s\n", first); + } + ecore_dlist_next(m->imagelist); + next = ecore_dlist_current(m->imagelist); + while ( next != NULL ) { + bname2 = basename(next); + m->i = ewl_iconbox_icon_add(EWL_ICONBOX(m->ib), bname2, next); + ewl_callback_append(m->i, EWL_CALLBACK_CLICKED, iremove_cb, NULL); + ewl_widget_name_set(m->i, next); + + ewl_iconbox_icon_arrange(EWL_ICONBOX(m->ib)); + slidenum++; + ecore_dlist_next(m->imagelist); + next = ecore_dlist_current(m->imagelist); + } + } /**********************************************************/ /************LETS POPULATE THEM TREES******************/ ewl_callback_call(m->directory, EWL_CALLBACK_VALUE_CHANGED); ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs