From 55caff88a18986fe8ad63c40060d8353d97aef8d Mon Sep 17 00:00:00 2001 From: titan Date: Wed, 18 Feb 2009 00:10:56 +0000 Subject: [PATCH] Changes, especially to the single view SVN revision: 39065 --- src/bin/.deps/ephoto-ephoto.Po | 3 - src/bin/.deps/ephoto-ephoto_fsystem.Po | 3 - src/bin/.deps/ephoto-ephoto_global.Po | 3 - src/bin/.deps/ephoto-ephoto_imaging.Po | 3 - src/bin/.deps/ephoto-ephoto_main.Po | 3 - src/bin/.deps/ephoto-ephoto_normal_view.Po | 3 - src/bin/.deps/ephoto-ephoto_single_view.Po | 3 - src/bin/.deps/ephoto-ephoto_utils.Po | 3 - src/bin/ephoto.h | 3 + src/bin/ephoto_global.c | 8 ++ src/bin/ephoto_single_view.c | 154 +++++++++++++++++++-- 11 files changed, 156 insertions(+), 33 deletions(-) diff --git a/src/bin/.deps/ephoto-ephoto.Po b/src/bin/.deps/ephoto-ephoto.Po index 48c59a2..fcaec21 100644 --- a/src/bin/.deps/ephoto-ephoto.Po +++ b/src/bin/.deps/ephoto-ephoto.Po @@ -2,7 +2,6 @@ ephoto-ephoto.o: ephoto.c ephoto.h config.h \ /usr/local/include/Ecore_Data.h /usr/local/include/eina-0/Eina.h \ /usr/local/include/eina-0/eina_config.h \ /usr/local/include/eina-0/eina/eina_types.h \ - /usr/local/include/eina-0/eina/eina_main.h \ /usr/local/include/eina-0/eina/eina_f16p16.h /usr/include/stdint.h \ /usr/include/features.h /usr/include/sys/cdefs.h \ /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ @@ -152,8 +151,6 @@ config.h: /usr/local/include/eina-0/eina/eina_types.h: -/usr/local/include/eina-0/eina/eina_main.h: - /usr/local/include/eina-0/eina/eina_f16p16.h: /usr/include/stdint.h: diff --git a/src/bin/.deps/ephoto-ephoto_fsystem.Po b/src/bin/.deps/ephoto-ephoto_fsystem.Po index 48ef3b2..e547499 100644 --- a/src/bin/.deps/ephoto-ephoto_fsystem.Po +++ b/src/bin/.deps/ephoto-ephoto_fsystem.Po @@ -2,7 +2,6 @@ ephoto-ephoto_fsystem.o: ephoto_fsystem.c ephoto_fsystem.h ephoto_utils.h \ /usr/local/include/Ecore_Data.h /usr/local/include/eina-0/Eina.h \ /usr/local/include/eina-0/eina_config.h \ /usr/local/include/eina-0/eina/eina_types.h \ - /usr/local/include/eina-0/eina/eina_main.h \ /usr/local/include/eina-0/eina/eina_f16p16.h /usr/include/stdint.h \ /usr/include/features.h /usr/include/sys/cdefs.h \ /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ @@ -152,8 +151,6 @@ ephoto_utils.h: /usr/local/include/eina-0/eina/eina_types.h: -/usr/local/include/eina-0/eina/eina_main.h: - /usr/local/include/eina-0/eina/eina_f16p16.h: /usr/include/stdint.h: diff --git a/src/bin/.deps/ephoto-ephoto_global.Po b/src/bin/.deps/ephoto-ephoto_global.Po index 64bda00..6595acb 100644 --- a/src/bin/.deps/ephoto-ephoto_global.Po +++ b/src/bin/.deps/ephoto-ephoto_global.Po @@ -2,7 +2,6 @@ ephoto-ephoto_global.o: ephoto_global.c ephoto.h config.h \ /usr/local/include/Ecore_Data.h /usr/local/include/eina-0/Eina.h \ /usr/local/include/eina-0/eina_config.h \ /usr/local/include/eina-0/eina/eina_types.h \ - /usr/local/include/eina-0/eina/eina_main.h \ /usr/local/include/eina-0/eina/eina_f16p16.h /usr/include/stdint.h \ /usr/include/features.h /usr/include/sys/cdefs.h \ /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ @@ -152,8 +151,6 @@ config.h: /usr/local/include/eina-0/eina/eina_types.h: -/usr/local/include/eina-0/eina/eina_main.h: - /usr/local/include/eina-0/eina/eina_f16p16.h: /usr/include/stdint.h: diff --git a/src/bin/.deps/ephoto-ephoto_imaging.Po b/src/bin/.deps/ephoto-ephoto_imaging.Po index 6dc41a0..359d042 100644 --- a/src/bin/.deps/ephoto-ephoto_imaging.Po +++ b/src/bin/.deps/ephoto-ephoto_imaging.Po @@ -2,7 +2,6 @@ ephoto-ephoto_imaging.o: ephoto_imaging.c ephoto.h config.h \ /usr/local/include/Ecore_Data.h /usr/local/include/eina-0/Eina.h \ /usr/local/include/eina-0/eina_config.h \ /usr/local/include/eina-0/eina/eina_types.h \ - /usr/local/include/eina-0/eina/eina_main.h \ /usr/local/include/eina-0/eina/eina_f16p16.h /usr/include/stdint.h \ /usr/include/features.h /usr/include/sys/cdefs.h \ /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ @@ -154,8 +153,6 @@ config.h: /usr/local/include/eina-0/eina/eina_types.h: -/usr/local/include/eina-0/eina/eina_main.h: - /usr/local/include/eina-0/eina/eina_f16p16.h: /usr/include/stdint.h: diff --git a/src/bin/.deps/ephoto-ephoto_main.Po b/src/bin/.deps/ephoto-ephoto_main.Po index 552ef96..49dc886 100644 --- a/src/bin/.deps/ephoto-ephoto_main.Po +++ b/src/bin/.deps/ephoto-ephoto_main.Po @@ -2,7 +2,6 @@ ephoto-ephoto_main.o: ephoto_main.c ephoto.h config.h \ /usr/local/include/Ecore_Data.h /usr/local/include/eina-0/Eina.h \ /usr/local/include/eina-0/eina_config.h \ /usr/local/include/eina-0/eina/eina_types.h \ - /usr/local/include/eina-0/eina/eina_main.h \ /usr/local/include/eina-0/eina/eina_f16p16.h /usr/include/stdint.h \ /usr/include/features.h /usr/include/sys/cdefs.h \ /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ @@ -152,8 +151,6 @@ config.h: /usr/local/include/eina-0/eina/eina_types.h: -/usr/local/include/eina-0/eina/eina_main.h: - /usr/local/include/eina-0/eina/eina_f16p16.h: /usr/include/stdint.h: diff --git a/src/bin/.deps/ephoto-ephoto_normal_view.Po b/src/bin/.deps/ephoto-ephoto_normal_view.Po index d75413a..fb4ef28 100644 --- a/src/bin/.deps/ephoto-ephoto_normal_view.Po +++ b/src/bin/.deps/ephoto-ephoto_normal_view.Po @@ -2,7 +2,6 @@ ephoto-ephoto_normal_view.o: ephoto_normal_view.c ephoto.h config.h \ /usr/local/include/Ecore_Data.h /usr/local/include/eina-0/Eina.h \ /usr/local/include/eina-0/eina_config.h \ /usr/local/include/eina-0/eina/eina_types.h \ - /usr/local/include/eina-0/eina/eina_main.h \ /usr/local/include/eina-0/eina/eina_f16p16.h /usr/include/stdint.h \ /usr/include/features.h /usr/include/sys/cdefs.h \ /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ @@ -155,8 +154,6 @@ config.h: /usr/local/include/eina-0/eina/eina_types.h: -/usr/local/include/eina-0/eina/eina_main.h: - /usr/local/include/eina-0/eina/eina_f16p16.h: /usr/include/stdint.h: diff --git a/src/bin/.deps/ephoto-ephoto_single_view.Po b/src/bin/.deps/ephoto-ephoto_single_view.Po index 0205ebf..4253e74 100644 --- a/src/bin/.deps/ephoto-ephoto_single_view.Po +++ b/src/bin/.deps/ephoto-ephoto_single_view.Po @@ -2,7 +2,6 @@ ephoto-ephoto_single_view.o: ephoto_single_view.c ephoto.h config.h \ /usr/local/include/Ecore_Data.h /usr/local/include/eina-0/Eina.h \ /usr/local/include/eina-0/eina_config.h \ /usr/local/include/eina-0/eina/eina_types.h \ - /usr/local/include/eina-0/eina/eina_main.h \ /usr/local/include/eina-0/eina/eina_f16p16.h /usr/include/stdint.h \ /usr/include/features.h /usr/include/sys/cdefs.h \ /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ @@ -154,8 +153,6 @@ config.h: /usr/local/include/eina-0/eina/eina_types.h: -/usr/local/include/eina-0/eina/eina_main.h: - /usr/local/include/eina-0/eina/eina_f16p16.h: /usr/include/stdint.h: diff --git a/src/bin/.deps/ephoto-ephoto_utils.Po b/src/bin/.deps/ephoto-ephoto_utils.Po index f350ab9..1dd4ef7 100644 --- a/src/bin/.deps/ephoto-ephoto_utils.Po +++ b/src/bin/.deps/ephoto-ephoto_utils.Po @@ -2,7 +2,6 @@ ephoto-ephoto_utils.o: ephoto_utils.c ephoto_utils.h \ /usr/local/include/Ecore_Data.h /usr/local/include/eina-0/Eina.h \ /usr/local/include/eina-0/eina_config.h \ /usr/local/include/eina-0/eina/eina_types.h \ - /usr/local/include/eina-0/eina/eina_main.h \ /usr/local/include/eina-0/eina/eina_f16p16.h /usr/include/stdint.h \ /usr/include/features.h /usr/include/sys/cdefs.h \ /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \ @@ -66,8 +65,6 @@ ephoto_utils.h: /usr/local/include/eina-0/eina/eina_types.h: -/usr/local/include/eina-0/eina/eina_main.h: - /usr/local/include/eina-0/eina/eina_f16p16.h: /usr/include/stdint.h: diff --git a/src/bin/ephoto.h b/src/bin/ephoto.h index 053da35..5ef72fb 100644 --- a/src/bin/ephoto.h +++ b/src/bin/ephoto.h @@ -16,6 +16,7 @@ typedef struct _Ephoto Ephoto; struct _Ephoto { Ewl_Widget *win; + Ewl_Widget *ewin; Ewl_Widget *view_box; Ewl_Widget *normal_vbox; Ewl_Widget *fbox; @@ -29,6 +30,7 @@ struct _Ephoto { }; void ephoto_set_main_window(Ewl_Widget *w); +void ephoto_set_effects_window(Ewl_Widget *w); void ephoto_set_view_box(Ewl_Widget *w); void ephoto_set_normal_vbox(Ewl_Widget *w); void ephoto_set_fbox(Ewl_Widget *w); @@ -40,6 +42,7 @@ void ephoto_set_images(Ecore_List *l); void ephoto_set_current_directory(char *dir); void ephoto_set_thumb_size(int i); Ewl_Widget *ephoto_get_main_window(void); +Ewl_Widget *ephoto_get_effects_window(void); Ewl_Widget *ephoto_get_view_box(void); Ewl_Widget *ephoto_get_normal_vbox(void); Ewl_Widget *ephoto_get_fbox(void); diff --git a/src/bin/ephoto_global.c b/src/bin/ephoto_global.c index b8ab4a7..d5e2878 100644 --- a/src/bin/ephoto_global.c +++ b/src/bin/ephoto_global.c @@ -8,6 +8,14 @@ Ewl_Widget *ephoto_get_main_window(void) { return em->win; } +void ephoto_set_effects_window(Ewl_Widget *w) { + em->ewin = w; +} + +Ewl_Widget *ephoto_get_effects_window(void) { + return em->ewin; +} + void ephoto_set_view_box(Ewl_Widget *w) { em->view_box = w; } diff --git a/src/bin/ephoto_single_view.c b/src/bin/ephoto_single_view.c index 8c16160..f95f4b2 100644 --- a/src/bin/ephoto_single_view.c +++ b/src/bin/ephoto_single_view.c @@ -1,6 +1,8 @@ #include "ephoto.h" #include "ephoto_imaging.h" +static void show_effects(Ewl_Widget *w, void *event, void *data); +static void destroy_window(Ewl_Widget *w, void *event, void *data); static void return_to_normal(Ewl_Widget *w, void *event, void *data); static void zoom_in(Ewl_Widget *w, void *event, void *data); static void zoom_out(Ewl_Widget *w, void *event, void *data); @@ -8,6 +10,8 @@ static void rotate_image_left(Ewl_Widget *w, void *event, void *data); static void rotate_image_right(Ewl_Widget *w, void *event, void *data); static void flip_horiz(Ewl_Widget *w, void *event, void *data); static void flip_vert(Ewl_Widget *w, void *event, void *data); +static void image_grayscale(Ewl_Widget *w, void *event, void *data); +static void image_sepia(Ewl_Widget *w, void *event, void *data); void add_single_view(Ewl_Widget *c) { Ewl_Widget *sbox, *box, *hbox, *ibox, *image, *button; @@ -52,59 +56,146 @@ void add_single_view(Ewl_Widget *c) { ewl_widget_show(hbox); button = ewl_button_new(); + ewl_button_label_set(EWL_BUTTON(button), "Back"); ewl_button_image_set(EWL_BUTTON(button), PACKAGE_DATA_DIR "/images/media-seek-backward.png", NULL); ewl_button_image_size_set(EWL_BUTTON(button), 18, 18); - ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_NONE); ewl_container_child_append(EWL_CONTAINER(hbox), button); ewl_callback_append(button, EWL_CALLBACK_CLICKED, return_to_normal, NULL); ewl_widget_show(button); + button = ewl_button_new(); + ewl_button_label_set(EWL_BUTTON(button), "Zoom In"); + ewl_button_image_set(EWL_BUTTON(button), + PACKAGE_DATA_DIR "/images/add.png", + NULL); + ewl_button_image_size_set(EWL_BUTTON(button), 18, 18); + ewl_container_child_append(EWL_CONTAINER(hbox), button); + ewl_callback_append(button, EWL_CALLBACK_CLICKED, zoom_in, + NULL); + ewl_widget_show(button); + button = ewl_button_new(); + ewl_button_label_set(EWL_BUTTON(button), "Zoom Out"); + ewl_button_image_set(EWL_BUTTON(button), + PACKAGE_DATA_DIR "/images/remove.png", + NULL); + ewl_button_image_size_set(EWL_BUTTON(button), 18, 18); + ewl_container_child_append(EWL_CONTAINER(hbox), button); + ewl_callback_append(button, EWL_CALLBACK_CLICKED, zoom_out, + NULL); + ewl_widget_show(button); + + button = ewl_button_new(); + ewl_button_label_set(EWL_BUTTON(button), "Effects"); + ewl_button_image_set(EWL_BUTTON(button), + PACKAGE_DATA_DIR "/images/image.png", + NULL); + ewl_button_image_size_set(EWL_BUTTON(button), 18, 18); + ewl_container_child_append(EWL_CONTAINER(hbox), button); + ewl_callback_append(button, EWL_CALLBACK_CLICKED, show_effects, + NULL); + ewl_widget_show(button); +} + +static void destroy_window(Ewl_Widget *w, void *event, void *data) { + ewl_widget_destroy(ephoto_get_effects_window()); + ephoto_set_effects_window(NULL); +} + +static void show_effects(Ewl_Widget *w, void *event, void *data) { + Ewl_Widget *window, *freebox, *button; + + if (ephoto_get_effects_window()) + return; + + window = ewl_window_new(); + ewl_window_dialog_set(EWL_WINDOW(window), TRUE); + ewl_window_title_set(EWL_WINDOW(window), "Ephoto Effects"); + ewl_object_size_request(EWL_OBJECT(window), 370, 100); + ewl_callback_append(window, EWL_CALLBACK_DELETE_WINDOW, + destroy_window, NULL); + ewl_widget_show(window); + ephoto_set_effects_window(window); + + freebox = ewl_hfreebox_new(); + ewl_object_fill_policy_set(EWL_OBJECT(freebox), EWL_FLAG_FILL_ALL); + ewl_container_child_append(EWL_CONTAINER(window), freebox); + ewl_widget_show(freebox); + + button = ewl_button_new(); + ewl_button_label_set(EWL_BUTTON(button), "Rotate Left"); ewl_button_image_set(EWL_BUTTON(button), PACKAGE_DATA_DIR "/images/undo.png", NULL); ewl_button_image_size_set(EWL_BUTTON(button), 18, 18); - ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_NONE); - ewl_container_child_append(EWL_CONTAINER(hbox), button); + ewl_object_minimum_size_set(EWL_OBJECT(button), 85, 20); + ewl_object_maximum_size_set(EWL_OBJECT(button), 85, 20); + ewl_container_child_append(EWL_CONTAINER(freebox), button); ewl_callback_append(button, EWL_CALLBACK_CLICKED, rotate_image_left, NULL); ewl_widget_show(button); button = ewl_button_new(); + ewl_button_label_set(EWL_BUTTON(button), "Rotate Right"); ewl_button_image_set(EWL_BUTTON(button), PACKAGE_DATA_DIR "/images/redo.png", NULL); ewl_button_image_size_set(EWL_BUTTON(button), 18, 18); - ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_NONE); - ewl_container_child_append(EWL_CONTAINER(hbox), button); + ewl_object_minimum_size_set(EWL_OBJECT(button), 85, 20); + ewl_object_maximum_size_set(EWL_OBJECT(button), 85, 20); + ewl_container_child_append(EWL_CONTAINER(freebox), button); ewl_callback_append(button, EWL_CALLBACK_CLICKED, rotate_image_right, NULL); ewl_widget_show(button); button = ewl_button_new(); + ewl_button_label_set(EWL_BUTTON(button), "Flip Horizontal"); ewl_button_image_set(EWL_BUTTON(button), PACKAGE_DATA_DIR "/images/go-next.png", NULL); ewl_button_image_size_set(EWL_BUTTON(button), 18, 18); - ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_NONE); - ewl_container_child_append(EWL_CONTAINER(hbox), button); + ewl_object_minimum_size_set(EWL_OBJECT(button), 85, 20); + ewl_object_maximum_size_set(EWL_OBJECT(button), 85, 20); + ewl_container_child_append(EWL_CONTAINER(freebox), button); ewl_callback_append(button, EWL_CALLBACK_CLICKED, flip_horiz, NULL); ewl_widget_show(button); button = ewl_button_new(); + ewl_button_label_set(EWL_BUTTON(button), "Flip Vertical"); ewl_button_image_set(EWL_BUTTON(button), PACKAGE_DATA_DIR "/images/go-down.png", NULL); ewl_button_image_size_set(EWL_BUTTON(button), 18, 18); - ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_NONE); - ewl_container_child_append(EWL_CONTAINER(hbox), button); + ewl_object_minimum_size_set(EWL_OBJECT(button), 85, 20); + ewl_object_maximum_size_set(EWL_OBJECT(button), 85, 20); + ewl_container_child_append(EWL_CONTAINER(freebox), button); ewl_callback_append(button, EWL_CALLBACK_CLICKED, flip_vert, NULL); ewl_widget_show(button); + + button = ewl_button_new(); + ewl_button_label_set(EWL_BUTTON(button), "Grayscale"); + ewl_button_image_size_set(EWL_BUTTON(button), 18, 18); + ewl_object_minimum_size_set(EWL_OBJECT(button), 85, 20); + ewl_object_maximum_size_set(EWL_OBJECT(button), 85, 20); + ewl_container_child_append(EWL_CONTAINER(freebox), button); + ewl_callback_append(button, EWL_CALLBACK_CLICKED, image_grayscale, + NULL); + ewl_widget_show(button); + + button = ewl_button_new(); + ewl_button_label_set(EWL_BUTTON(button), "Sepia"); + ewl_button_image_size_set(EWL_BUTTON(button), 18, 18); + ewl_object_minimum_size_set(EWL_OBJECT(button), 85, 20); + ewl_object_maximum_size_set(EWL_OBJECT(button), 85, 20); + ewl_container_child_append(EWL_CONTAINER(freebox), button); + ewl_callback_append(button, EWL_CALLBACK_CLICKED, image_sepia, + NULL); + ewl_widget_show(button); } void show_single_view(Ewl_Widget *w, void *event, void *data) { @@ -117,16 +208,29 @@ void show_single_view(Ewl_Widget *w, void *event, void *data) { } static void return_to_normal(Ewl_Widget *w, void *event, void *data) { + destroy_window(NULL, NULL, NULL); ewl_notebook_visible_page_set(EWL_NOTEBOOK(ephoto_get_view_box()), ephoto_get_normal_vbox()); } static void zoom_in(Ewl_Widget *w, void *event, void *data) { + Ewl_Widget *simage; + int wid, h; + simage = ephoto_get_single_image(); + wid = ewl_object_current_w_get(EWL_OBJECT(simage)); + h = ewl_object_current_h_get(EWL_OBJECT(simage)); + ewl_image_size_set(EWL_IMAGE(simage), wid*1.5, h*1.5); } static void zoom_out(Ewl_Widget *w, void *event, void *data) { + Ewl_Widget *simage; + int wid, h; + simage = ephoto_get_single_image(); + wid = ewl_object_current_w_get(EWL_OBJECT(simage)); + h = ewl_object_current_h_get(EWL_OBJECT(simage)); + ewl_image_size_set(EWL_IMAGE(simage), wid/1.5, h/1.5); } static void rotate_image_left(Ewl_Widget *w, void *event, void *data) { @@ -201,3 +305,35 @@ static void flip_vert(Ewl_Widget *w, void *event, void *data) { return; } +static void image_grayscale(Ewl_Widget *w, void *event, void *data) { + unsigned int *image_data; + int nw, nh; + + Ewl_Widget *simage; + + simage = ephoto_get_single_image(); + + image_data = grayscale_image(simage); + evas_object_image_size_get(EWL_IMAGE(simage)->image, &nw, &nh); + update_image(simage, nw, nh, image_data); + ewl_widget_configure(simage->parent); + + return; +} + +static void image_sepia(Ewl_Widget *w, void *event, void *data) { + unsigned int *image_data; + int nw, nh; + + Ewl_Widget *simage; + + simage = ephoto_get_single_image(); + + image_data = sepia_image(simage); + evas_object_image_size_get(EWL_IMAGE(simage)->image, &nw, &nh); + update_image(simage, nw, nh, image_data); + ewl_widget_configure(simage->parent); + + return; +} +