diff --git a/src/bin/ephoto.c b/src/bin/ephoto.c index 6e82b0f..d000b2e 100644 --- a/src/bin/ephoto.c +++ b/src/bin/ephoto.c @@ -266,9 +266,9 @@ int main(int argc, char **argv) bind_textdomain_codeset(PACKAGE, "UTF-8"); textdomain(PACKAGE); #endif - /*Use our own custom theme*/ + /*Use our own theme*/ ewl_theme_theme_set(PACKAGE_DATA_DIR "/themes/ephoto.edj"); - + /*Start the GUI*/ create_main_gui(); diff --git a/src/bin/ephoto.h b/src/bin/ephoto.h index 2627f1f..75177f1 100644 --- a/src/bin/ephoto.h +++ b/src/bin/ephoto.h @@ -72,6 +72,7 @@ Ewl_Widget *add_image(Ewl_Widget *c, const char *img, int thumbnail, void *cb, v Ewl_Widget *add_label(Ewl_Widget *c, const char *lbl); Ewl_Widget *add_menubar(Ewl_Widget *c); Ewl_Widget *add_menu(Ewl_Widget *c, const char *lbl); +Ewl_Widget *add_menu_item(Ewl_Widget *c, const char *lbl, const char *img, void *cb, void *data); Ewl_Widget *add_text(Ewl_Widget *c, const char *text); Ewl_Widget *add_shadow(Ewl_Widget *c); Ewl_Widget *add_window(const char *name, int width, int height, void *cb, void *data); diff --git a/src/bin/ephoto_edit_view.c b/src/bin/ephoto_edit_view.c index d565262..7b0af73 100644 --- a/src/bin/ephoto_edit_view.c +++ b/src/bin/ephoto_edit_view.c @@ -19,21 +19,21 @@ Ewl_Widget *add_edit_view(Ewl_Widget *c) ewl_object_alignment_set(EWL_OBJECT(em->eimage), EWL_FLAG_ALIGN_CENTER); ewl_object_fill_policy_set(EWL_OBJECT(em->eimage), EWL_FLAG_FILL_SHRINK); + em->edit_tools = add_box(em->edit_vbox, EWL_ORIENTATION_HORIZONTAL, 3); + ewl_object_alignment_set(EWL_OBJECT(em->edit_tools), EWL_FLAG_ALIGN_CENTER); + ewl_object_fill_policy_set(EWL_OBJECT(em->edit_tools), EWL_FLAG_FILL_SHRINK); + add_edit_tools(em->edit_tools); + return em->edit_vbox; } /*Show the edit view*/ void show_edit_view(Ewl_Widget *w, void *event, void *data) { - char *path = data; - ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->view_box), em->edit_vbox); - if (path) - { - ewl_image_file_path_set(EWL_IMAGE(em->eimage), path); - free(path); - } - else ewl_image_file_path_set(EWL_IMAGE(em->eimage), ecore_dlist_current(em->images)); + ecore_dlist_goto_first(em->images); + ewl_image_file_path_set(EWL_IMAGE(em->eimage), ecore_dlist_current(em->images)); + return; } /*Add edit tools to container c*/ @@ -71,14 +71,12 @@ void add_edit_tools(Ewl_Widget *c) image = add_image(c, PACKAGE_DATA_DIR "/images/media-seek-backward.png", 0, previous_image, NULL); ewl_image_constrain_set(EWL_IMAGE(image), 30); - ewl_object_alignment_set(EWL_OBJECT(image), EWL_FLAG_ALIGN_RIGHT); ewl_attach_tooltip_text_set(image, "Previous Image"); image = add_image(c, PACKAGE_DATA_DIR "/images/media-seek-forward.png", 0, next_image, NULL); ewl_image_constrain_set(EWL_IMAGE(image), 30); - ewl_object_alignment_set(EWL_OBJECT(image), EWL_FLAG_ALIGN_RIGHT); ewl_attach_tooltip_text_set(image, "Next Image"); - + return; } @@ -119,8 +117,6 @@ static void next_image(Ewl_Widget *w, void *event, void *data) return; } - - /*Flip the image 180 degrees horizontally*/ static void flip_image_horizontal(Ewl_Widget *w, void *event, void *data) { diff --git a/src/bin/ephoto_gui.c b/src/bin/ephoto_gui.c index a06ac68..3077ff4 100644 --- a/src/bin/ephoto_gui.c +++ b/src/bin/ephoto_gui.c @@ -115,13 +115,31 @@ Ewl_Widget *add_menu(Ewl_Widget *c, const char *lbl) Ewl_Widget *menu; menu = ewl_menu_new(); - if(lbl) ewl_label_text_set(EWL_LABEL(menu), lbl); + if(lbl) ewl_button_label_set(EWL_BUTTON(menu), lbl); + ewl_object_fill_policy_set(EWL_OBJECT(menu), EWL_FLAG_FILL_NONE); if(c) ewl_container_child_append(EWL_CONTAINER(c), menu); ewl_widget_show(menu); return menu; } +/*Create and Add a Menu Item to the Container c*/ +Ewl_Widget *add_menu_item(Ewl_Widget *c, const char *lbl, const char *img, void *cb, void *data) +{ + Ewl_Widget *mi; + + mi = ewl_menu_item_new(); + if(img) ewl_button_image_set(EWL_BUTTON(mi), img, NULL); + if(lbl) ewl_button_label_set(EWL_BUTTON(mi), lbl); + ewl_object_alignment_set(EWL_OBJECT(mi), EWL_FLAG_ALIGN_CENTER); + ewl_object_fill_policy_set(EWL_OBJECT(mi), EWL_FLAG_FILL_ALL); + if(c) ewl_container_child_append(EWL_CONTAINER(c), mi); + if(cb) ewl_callback_append(mi, EWL_CALLBACK_CLICKED, cb, data); + ewl_widget_show(mi); + + return mi; +} + /*Create and Add a Shadow to the Container c*/ Ewl_Widget *add_shadow(Ewl_Widget *c) { diff --git a/src/bin/ephoto_list_view.c b/src/bin/ephoto_list_view.c index 471deaf..f093cd9 100644 --- a/src/bin/ephoto_list_view.c +++ b/src/bin/ephoto_list_view.c @@ -71,7 +71,7 @@ static Ewl_Widget *list_view_new(void *data, int row, int column) hbox = add_box(NULL, EWL_ORIENTATION_HORIZONTAL, 10); ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_HFILL); - ewl_callback_append(hbox, EWL_CALLBACK_CLICKED, show_edit_view, strdup(image)); +// ewl_callback_append(hbox, EWL_CALLBACK_CLICKED, show_edit_view, strdup(image)); ewl_widget_name_set(hbox, image); img = add_image(hbox, image, 1, NULL, NULL); diff --git a/src/bin/ephoto_main.c b/src/bin/ephoto_main.c index dd4c7af..bf0de89 100644 --- a/src/bin/ephoto_main.c +++ b/src/bin/ephoto_main.c @@ -49,7 +49,7 @@ static void window_fullscreen(Ewl_Widget *w, void *event, void *data) void create_main_gui(void) { Ewl_Widget *vbox, *hbox, *hsep, *vsep, *button; - Ewl_Widget *mb, *menu; + Ewl_Widget *mb, *menu, *mi; em = NULL; em = calloc(1, sizeof(Ephoto_Main)); @@ -63,6 +63,7 @@ void create_main_gui(void) mb = add_menubar(vbox); menu = add_menu(mb, "File"); + mi = add_menu_item(menu, "Exit", PACKAGE_DATA_DIR "/images/exit.png", destroy, NULL); hbox = add_box(vbox, EWL_ORIENTATION_HORIZONTAL, 2); ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_ALL); diff --git a/src/bin/ephoto_normal_view.c b/src/bin/ephoto_normal_view.c index b72d47f..90bca0e 100644 --- a/src/bin/ephoto_normal_view.c +++ b/src/bin/ephoto_normal_view.c @@ -28,13 +28,13 @@ void show_normal_view(Ewl_Widget *w, void *event, void *data) ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->view_box), em->fbox_vbox); } -/*Set the info that is in the info label on normal view*/ +/*Action when an image is clicked*/ void freebox_image_clicked(Ewl_Widget *w, void *event, void *data) { const char *path; path = ewl_widget_name_get(w); - show_edit_view(NULL, NULL, strdup(path)); +// show_edit_view(NULL, NULL, strdup(path)); return; } diff --git a/src/bin/ephoto_slideshow.c b/src/bin/ephoto_slideshow.c index 7aa1eeb..75612a5 100644 --- a/src/bin/ephoto_slideshow.c +++ b/src/bin/ephoto_slideshow.c @@ -52,7 +52,7 @@ void start_slideshow(Ewl_Widget *w, void *event, void *data) { Ewl_Widget *cell, *image; - win = add_window("Ephoto Slideshow!", 600, 400, destroy, NULL); + win = add_window("Ephoto Slideshow!", 0, 0, destroy, NULL); ewl_window_fullscreen_set(EWL_WINDOW(win), 1); ewl_callback_append(win, EWL_CALLBACK_CLICKED, destroy, NULL);