Enlightenment CVS committal
Author : zuluone
Project : e17
Module : apps/entice
Dir : e17/apps/entice/src/bin
Modified Files:
event.c fade.c fade.h file.c file.h handler.c image.c main.c
misc.c thumb.c thumb.h
Log Message:
files failing to load (generally because they're not images) are neatly removed from
the image list on access, plus a few minor updates to code; added install instructions
to README
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/event.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- event.c 11 Aug 2003 13:02:18 -0000 1.16
+++ event.c 15 Aug 2003 18:01:43 -0000 1.17
@@ -23,34 +23,32 @@
/* printf("%s()\n",__FUNCTION__);
* printf("%s\n",im->file); */
+ if (!im->o_thumb) {
+ im->o_thumb = evas_object_image_add(evas);
+ evas_object_event_callback_add(im->o_thumb,
+ EVAS_CALLBACK_MOUSE_MOVE,
+ e_list_item_drag, l);
+ evas_object_event_callback_add(im->o_thumb,
+ EVAS_CALLBACK_MOUSE_DOWN,
+ e_list_item_click, l);
+ evas_object_event_callback_add(im->o_thumb,
+ EVAS_CALLBACK_MOUSE_UP,
+ e_list_item_select, l);
+ evas_object_event_callback_add(im->o_thumb,
+ EVAS_CALLBACK_MOUSE_IN,
+ e_list_item_in, l);
+ evas_object_event_callback_add(im->o_thumb,
+ EVAS_CALLBACK_MOUSE_OUT,
+ e_list_item_out, l);
+ }
if ((im->subst) && (im->thumb))
{
int w, h;
-
- evas_object_del(im->o_thumb);
- im->o_thumb = evas_object_image_add(evas);
- if (e_file_is_dir(im->file))
- evas_object_image_file_set(im->o_thumb,
- IM "directory.png", NULL);
- else
- evas_object_image_file_set(im->o_thumb, im->thumb,
+ // printf("%s %s\n", im->file, im->thumb);
+
+ evas_object_image_file_set(im->o_thumb, im->thumb,
NULL);
- evas_object_event_callback_add(im->o_thumb,
- EVAS_CALLBACK_MOUSE_MOVE,
- e_list_item_drag, l);
- evas_object_event_callback_add(im->o_thumb,
- EVAS_CALLBACK_MOUSE_DOWN,
- e_list_item_click, l);
- evas_object_event_callback_add(im->o_thumb,
- EVAS_CALLBACK_MOUSE_UP,
- e_list_item_select, l);
- evas_object_event_callback_add(im->o_thumb,
- EVAS_CALLBACK_MOUSE_IN,
- e_list_item_in, l);
- evas_object_event_callback_add(im->o_thumb,
- EVAS_CALLBACK_MOUSE_OUT,
- e_list_item_out, l);
evas_object_image_size_get(im->o_thumb, &w, &h);
im->subst = 0;
@@ -62,19 +60,18 @@
evas_object_show(im->o_thumb);
im->subst = 0;
}
- if (!im->thumb)
- {
- e_generate_thumb(im);
- doing = 1;
- }
+ if (!im->thumb) {
+ e_generate_thumb(im);
+ doing = 1;
+ }
+ }
+ if (!doing)
+ need_thumbs = 0;
}
- if (!doing)
- need_thumbs = 0;
- }
- e_fix_icons();
- }
- evas_render(evas);
- return 1;
+ e_fix_icons();
+ }
+ evas_render(evas);
+ return 1;
}
void
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/fade.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- fade.c 11 Aug 2003 13:02:18 -0000 1.6
+++ fade.c 15 Aug 2003 18:01:43 -0000 1.7
@@ -151,69 +151,6 @@
return 0;
}
}
-/*
-int
-e_fade_scroller_in(void *data)
-{
- * int i; *
- static int v = 0;
- static double start = 0.0;
- double duration = 0.5;
- double val;
-
- if (v == 0) {
- start = get_time();
- fade_timer = ecore_timer_add(0.05, e_fade_scroller_in, data);
- }
- val = (get_time() - start) / duration;
- if (val > 1.0)
- val = 1.0;
-
- if (o_mini_image)
- evas_object_color_set(o_mini_image, 255, 255, 255, (val * 255));
- evas_object_color_set(o_mini_select, 255, 255, 255, (val * 255));
-
- if (val < 1.0) {
- v++;
- return 1;
- } else {
- v = 0;
- return 0;
- }
- if (data)
- e_fade_scroller_out(NULL);
-}
-
-int
-e_fade_scroller_out(void *data)
-{
- * int i; *
- static int v = 0;
- static double start = 0.0;
- double duration = 2.0;
- double val;
-
- if (v == 0) {
- start = get_time();
- fade_timer = ecore_timer_add(0.05, e_fade_scroller_out, data);
- }
- val = (get_time() - start) / duration;
- if (val > 1.0)
- val = 1.0;
- val = 1.0 - val;
- if (o_mini_image)
- evas_object_color_set(o_mini_image, 255, 255, 255, (val * 255));
- evas_object_color_set(o_mini_select, 255, 255, 255, (val * 255));
-
- if (val > 0.0) {
- v++;
- return 1;
- } else {
- v = 0;
- return 0;
- }
-}
-*/
int
e_fade_scroller_in(void *data) {
@@ -287,27 +224,39 @@
}
int
-e_fade_logo_in(void *data)
+e_fade_logo(void *data)
{
- /* int i; */
- static int v = 0;
static double start = 0.0;
double duration = 1.0;
- double val;
+ double val = 0.0;
+ double delay = 0.05;
+ static enum active_state action;
+ static Ecore_Timer *timer = NULL;
+
+ if (data) { // not called by timer
+ if (!timer) { // we are starting afresh
+ start = get_time();
+ } else { // there is a fade already going on
+ start = 2*get_time() - duration - start;
+ ecore_timer_del(timer);
+ }
+ timer = ecore_timer_add(delay, e_fade_logo, NULL);
+ action = *(enum active_state *)data;
+ return 1;
+ } else
+ val = (get_time() - start) / duration;
- if (v == 0) {
- start = get_time();
- fade_timer = ecore_timer_add(0.05, e_fade_logo_in, data);
+ if (val > 1.0) val = 1.0;
+ if (action == active_in) {
+ evas_object_color_set(o_logo, 255, 255, 255, (val * 255));
+ } else {
+ evas_object_color_set(o_logo, 255, 255, 255, ((1.0 - val) * 255));
}
- val = (get_time() - start) / duration;
- evas_object_color_set(o_logo, 255, 255, 255, (val * 255));
-
- if (val < 1.0) {
- v++;
+ if (val < 0.99) // keep going
return 1;
- } else {
- v = 0;
+ else { // stick a fork in us, we're done
+ timer = NULL;
return 0;
}
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/fade.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- fade.h 11 Aug 2003 13:02:18 -0000 1.5
+++ fade.h 15 Aug 2003 18:01:43 -0000 1.6
@@ -11,7 +11,7 @@
int e_fade_trash_in(void *data);
int e_fade_trash_out(void *data);
-int e_fade_logo_in(void *data);
+int e_fade_logo(void *data);
int e_fade_l_arrow_in(void *data);
int e_fade_l_arrow_out(void *data);
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/file.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- file.c 5 Feb 2003 05:45:45 -0000 1.2
+++ file.c 15 Aug 2003 18:01:43 -0000 1.3
@@ -57,3 +57,16 @@
return 1;
return 0;
}
+
+char *
+e_file_full_name(char *file)
+{
+ char *buf = 0;
+ char *wd = 0;
+
+ if (file[0] == '/') return file;
+ buf = (char *) malloc(4096);
+ wd = getcwd(NULL, 0);
+ snprintf(buf, 4096, "%s/%s", wd, file);
+ return buf;
+}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/file.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- file.h 5 Feb 2003 05:45:45 -0000 1.2
+++ file.h 15 Aug 2003 18:01:43 -0000 1.3
@@ -11,4 +11,6 @@
int e_file_is_dir(char *file);
+char * e_file_full_name(char *file);
+
#endif /* __FILE_H__ */
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/handler.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- handler.c 11 Aug 2003 13:02:18 -0000 1.7
+++ handler.c 15 Aug 2003 18:01:43 -0000 1.8
@@ -196,9 +196,10 @@
}
else
{
+ enum active_state command = active_in;
evas_object_show(o_bg);
evas_object_show(o_logo);
- e_fade_logo_in(NULL);
+ e_fade_logo(&command);
}
evas_object_image_size_get(o_arrow_l, &w, &h);
evas_object_move(o_arrow_l, 0, (win_h - h) / 2);
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/image.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- image.c 11 Aug 2003 13:02:18 -0000 1.15
+++ image.c 15 Aug 2003 18:01:43 -0000 1.16
@@ -54,6 +54,7 @@
{
int i;
if (argc==2 && e_file_is_dir(argv[1])) {
+ printf("taking argument to be directory name: %s\n", argv[1]);
image_create_list_dir(argv[1]);
return;
}
@@ -61,27 +62,13 @@
for (i = 1; i < argc; i++)
{
Image *im;
+ /*
+ char buf[4096];
- if (argv[i][0] == '/')
- {
- /* CS */
- /* printf("%s\n",argv[i]); */
-
- im = e_image_new(argv[i]);
- }
- else
- {
- char buf[4096];
- char wd[4096];
-
- getcwd(wd, sizeof(wd));
- sprintf(buf, "%s/%s", wd, argv[i]);
-
- /* CS */
- /* printf("%s\n",buf); */
-
- im = e_image_new(buf);
- }
+ buf = e_file_full_name(argv[i]);
+ printf("%s\n",buf);
+ */
+ im = e_image_new(e_file_full_name(argv[i]));
images = evas_list_append(images, im);
}
current_image = images;
@@ -94,24 +81,22 @@
struct dirent *dent;
Image *im;
+ dir = e_file_full_name(dir);
+
d = opendir(dir);
while ((dent = readdir(d)) != NULL)
// while( readdir_r(d,dent,&dent) )
{
+ char buf[4096];
/* skip these */
if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..")
|| dent->d_name[0] == '.')
continue;
- /* CS */
- /* printf("%s\n",dent->d_name); */
- if (e_file_is_dir(dent->d_name)) {
- // do nothing for now: FIXME
- } else {
- im = e_image_new(dent->d_name);
- images = evas_list_append(images, im);
- }
+ snprintf(buf, 4096, "%s/%s", dir, dent->d_name);
+ im = e_image_new(buf);
+ images = evas_list_append(images, im);
/* CS */
/* printf("%p\n",images); */
}
@@ -149,6 +134,7 @@
/* CS */
/* printf("%s\n",im->file); */
+ if (im->o_thumb) return;
im->o_thumb = evas_object_image_add(evas);
evas_object_image_file_set(im->o_thumb, IM "thumb.png", NULL);
evas_object_event_callback_add(im->o_thumb, EVAS_CALLBACK_MOUSE_MOVE,
@@ -225,6 +211,15 @@
{
if (im)
{
+ if (current_image && im == current_image->data) {
+ if (current_image->next)
+ current_image = current_image->next;
+ else if (current_image->prev)
+ current_image = current_image->prev;
+ else
+ current_image = NULL;
+ e_display_current_image();
+ }
if (im->o_thumb)
evas_object_del(im->o_thumb);
@@ -343,7 +338,7 @@
w = imlib_image_get_width();
h = imlib_image_get_height();
- /* Get image data from Imblib */
+ /* Get image data from Imlib */
image_data = imlib_image_get_data_for_reading_only();
/* Set Evas Image Data */
@@ -689,11 +684,8 @@
{
char title[4096];
- if (o_image)
+ if (!o_image)
{
- evas_object_del(o_image);
- o_image = NULL;
- }
o_image = evas_object_image_add(evas);
evas_object_image_file_set(o_image,
((Image *) (current_image->data))->file,
@@ -705,8 +697,11 @@
evas_object_event_callback_add(o_image, EVAS_CALLBACK_MOUSE_MOVE,
next_image_move, NULL);
evas_object_show(o_image);
+ }
if (evas_object_image_load_error_get(o_image) != EVAS_LOAD_ERROR_NONE)
{
+ enum active_state command = active_in;
+ e_fade_logo(&command);
sprintf(txt_info[0], "Error LoadingFile: %s",
((Image *) (current_image->data))->file);
*txt_info[1] = '\0';
@@ -735,8 +730,10 @@
{
ecore_evas_title_set(ecore_evas, "Entice (No Image)");
{
+ enum active_state command = active_in;
evas_object_del(o_image);
o_image = NULL;
+ e_fade_logo(&command);
}
}
if ((o_image) && (current_image))
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/main.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- main.c 11 Aug 2003 13:02:18 -0000 1.8
+++ main.c 15 Aug 2003 18:01:43 -0000 1.9
@@ -153,7 +153,7 @@
*/
/*****************************************************************************/
-static int main_signal_exit(void *data, int ev_type, void *ev)
+static int main_signal_exit(void *data, int ev_type, void *ev)
{
ecore_main_loop_quit();
}
@@ -161,6 +161,7 @@
int
main(int argc, char **argv)
{
+ enum active_state command;
/* environment parsing */
render_method = evas_render_method_lookup("software_x11");
if (getenv("ENTICE_RENDERER"))
@@ -262,7 +263,8 @@
icon_x = -100;
e_fix_icons();
/* call the animator once to start it up */
- e_fade_logo_in(NULL);
+ command = active_in;
+ e_fade_logo(&command);
e_fade_scroller_in((void *)1);
/* and now loop forever handling events */
ecore_main_loop_begin();
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/misc.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- misc.c 12 Aug 2003 23:58:55 -0000 1.12
+++ misc.c 15 Aug 2003 18:01:43 -0000 1.13
@@ -34,12 +34,13 @@
/* handler for when the event queue goes idle */
ecore_idle_enterer_add(e_idle, NULL);
+ ecore_event_handler_add(ECORE_EVENT_EXE_EXIT, e_child, NULL);
/* create a 400x300 toplevel window */
ecore_evas = ecore_evas_software_x11_new(NULL, 0, 0, 0, win_w, win_h);
ecore_evas_callback_resize_set(ecore_evas, e_window_resize);
// main_win = ecore_evas_software_x11_window_get(ecore_evas);
ecore_evas_name_class_set(ecore_evas, "Entice", "Main");
- ecore_evas_size_min_set(ecore_evas, 256, 128);
+ ecore_evas_size_min_set(ecore_evas, 288, 128);
ecore_evas_size_max_set(ecore_evas, 8000, 8000);
a_entice = ecore_x_atom_get("_ENTICE_APP_WINDOW");
ecore_evas_title_set(ecore_evas, string);
@@ -313,8 +314,10 @@
{
if (generating_image->generator == e->pid)
{
- generating_image->generator = 0;
- generating_image = NULL;
+ generating_image->generator = 0;
+ if (e->exit_code)
+ image_delete(generating_image);
+ generating_image = NULL;
}
}
return 1;
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/thumb.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- thumb.c 9 Aug 2003 00:50:38 -0000 1.4
+++ thumb.c 15 Aug 2003 18:01:43 -0000 1.5
@@ -1,7 +1,7 @@
#include "entice.h"
#include <limits.h>
-void
+int
e_do_thumb(char *file, char *thumb)
{
Imlib_Image im;
@@ -49,13 +49,14 @@
imlib_image_set_format("png");
e_mkdirs(thumb);
imlib_save_image(thumb);
+ return 1;
}
+ return 0;
}
void
e_generate_thumb(Image * im)
{
- static int initted = 0;
#ifdef PATH_MAX
char buf[PATH_MAX];
#else
@@ -67,11 +68,6 @@
if (im->generator > 0)
return;
- if (!initted)
- {
- ecore_event_handler_add(ECORE_EVENT_EXE_EXIT, e_child, NULL);
- initted = 1;
- }
sprintf(buf, "%s/.entice/thumbs/%s._.png", e_file_home(), im->file);
if (im->thumb)
free(im->thumb);
@@ -79,27 +75,18 @@
im->thumb = strdup(buf);
generating_image = im;
- /* CS */
/*
- * if ((im->thumb) && (im->file))
- * {
- * if( e_file_modified_time(im->thumb) > e_file_modified_time(im->file) )
- * return;
- * e_do_thumb(im->file, im->thumb);
- * }
- */
-
-#if 0
- /* CS */
if ((im->thumb) && (im->file))
{
if (e_file_modified_time(im->thumb) > e_file_modified_time(im->file))
return;
- e_do_thumb(im->file, im->thumb);
+ if (!e_do_thumb(im->file, im->thumb)) {
+ printf("unable to load: %s\n", im->file);
+ image_delete(im);
+ }
}
-#endif
-
- /* CS */
+ */
+
im->generator = fork();
if (im->generator != 0)
{
@@ -112,15 +99,19 @@
}
return;
}
- else /* child */
+ else // child
{
if ((im->thumb) && (im->file))
{
if (e_file_modified_time(im->thumb) >
e_file_modified_time(im->file))
exit(0);
- e_do_thumb(im->file, im->thumb);
+ if (!e_do_thumb(im->file, im->thumb)) {
+ printf("unable to load: %s\n", im->file);
+ exit(1);
+ }
}
exit(0);
}
+
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/entice/src/bin/thumb.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- thumb.h 5 Feb 2003 05:45:45 -0000 1.2
+++ thumb.h 15 Aug 2003 18:01:43 -0000 1.3
@@ -1,7 +1,7 @@
#ifndef __THUMB_H__
#define __THUMB_H__
-void e_do_thumb(char *file, char *thumb);
+int e_do_thumb(char *file, char *thumb);
void e_generate_thumb(Image * im);
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs