Add edit tools back. I really need a better design.

SVN revision: 29235
This commit is contained in:
titan 2007-03-30 02:47:16 +00:00 committed by titan
parent 9c788c1691
commit bb4d112681
8 changed files with 37 additions and 21 deletions

View File

@ -266,9 +266,9 @@ int main(int argc, char **argv)
bind_textdomain_codeset(PACKAGE, "UTF-8"); bind_textdomain_codeset(PACKAGE, "UTF-8");
textdomain(PACKAGE); textdomain(PACKAGE);
#endif #endif
/*Use our own custom theme*/ /*Use our own theme*/
ewl_theme_theme_set(PACKAGE_DATA_DIR "/themes/ephoto.edj"); ewl_theme_theme_set(PACKAGE_DATA_DIR "/themes/ephoto.edj");
/*Start the GUI*/ /*Start the GUI*/
create_main_gui(); create_main_gui();

View File

@ -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_label(Ewl_Widget *c, const char *lbl);
Ewl_Widget *add_menubar(Ewl_Widget *c); Ewl_Widget *add_menubar(Ewl_Widget *c);
Ewl_Widget *add_menu(Ewl_Widget *c, const char *lbl); 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_text(Ewl_Widget *c, const char *text);
Ewl_Widget *add_shadow(Ewl_Widget *c); Ewl_Widget *add_shadow(Ewl_Widget *c);
Ewl_Widget *add_window(const char *name, int width, int height, void *cb, void *data); Ewl_Widget *add_window(const char *name, int width, int height, void *cb, void *data);

View File

@ -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_alignment_set(EWL_OBJECT(em->eimage), EWL_FLAG_ALIGN_CENTER);
ewl_object_fill_policy_set(EWL_OBJECT(em->eimage), EWL_FLAG_FILL_SHRINK); 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; return em->edit_vbox;
} }
/*Show the edit view*/ /*Show the edit view*/
void show_edit_view(Ewl_Widget *w, void *event, void *data) 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); ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->view_box), em->edit_vbox);
if (path) ecore_dlist_goto_first(em->images);
{ ewl_image_file_path_set(EWL_IMAGE(em->eimage), ecore_dlist_current(em->images));
ewl_image_file_path_set(EWL_IMAGE(em->eimage), path); return;
free(path);
}
else ewl_image_file_path_set(EWL_IMAGE(em->eimage), ecore_dlist_current(em->images));
} }
/*Add edit tools to container c*/ /*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); 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_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"); ewl_attach_tooltip_text_set(image, "Previous Image");
image = add_image(c, PACKAGE_DATA_DIR "/images/media-seek-forward.png", 0, next_image, NULL); 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_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"); ewl_attach_tooltip_text_set(image, "Next Image");
return; return;
} }
@ -119,8 +117,6 @@ static void next_image(Ewl_Widget *w, void *event, void *data)
return; return;
} }
/*Flip the image 180 degrees horizontally*/ /*Flip the image 180 degrees horizontally*/
static void flip_image_horizontal(Ewl_Widget *w, void *event, void *data) static void flip_image_horizontal(Ewl_Widget *w, void *event, void *data)
{ {

View File

@ -115,13 +115,31 @@ Ewl_Widget *add_menu(Ewl_Widget *c, const char *lbl)
Ewl_Widget *menu; Ewl_Widget *menu;
menu = ewl_menu_new(); 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); if(c) ewl_container_child_append(EWL_CONTAINER(c), menu);
ewl_widget_show(menu); ewl_widget_show(menu);
return 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*/ /*Create and Add a Shadow to the Container c*/
Ewl_Widget *add_shadow(Ewl_Widget *c) Ewl_Widget *add_shadow(Ewl_Widget *c)
{ {

View File

@ -71,7 +71,7 @@ static Ewl_Widget *list_view_new(void *data, int row, int column)
hbox = add_box(NULL, EWL_ORIENTATION_HORIZONTAL, 10); hbox = add_box(NULL, EWL_ORIENTATION_HORIZONTAL, 10);
ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_HFILL); 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); ewl_widget_name_set(hbox, image);
img = add_image(hbox, image, 1, NULL, NULL); img = add_image(hbox, image, 1, NULL, NULL);

View File

@ -49,7 +49,7 @@ static void window_fullscreen(Ewl_Widget *w, void *event, void *data)
void create_main_gui(void) void create_main_gui(void)
{ {
Ewl_Widget *vbox, *hbox, *hsep, *vsep, *button; Ewl_Widget *vbox, *hbox, *hsep, *vsep, *button;
Ewl_Widget *mb, *menu; Ewl_Widget *mb, *menu, *mi;
em = NULL; em = NULL;
em = calloc(1, sizeof(Ephoto_Main)); em = calloc(1, sizeof(Ephoto_Main));
@ -63,6 +63,7 @@ void create_main_gui(void)
mb = add_menubar(vbox); mb = add_menubar(vbox);
menu = add_menu(mb, "File"); 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); hbox = add_box(vbox, EWL_ORIENTATION_HORIZONTAL, 2);
ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_ALL); ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_ALL);

View File

@ -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); 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) void freebox_image_clicked(Ewl_Widget *w, void *event, void *data)
{ {
const char *path; const char *path;
path = ewl_widget_name_get(w); path = ewl_widget_name_get(w);
show_edit_view(NULL, NULL, strdup(path)); // show_edit_view(NULL, NULL, strdup(path));
return; return;
} }

View File

@ -52,7 +52,7 @@ void start_slideshow(Ewl_Widget *w, void *event, void *data)
{ {
Ewl_Widget *cell, *image; 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_window_fullscreen_set(EWL_WINDOW(win), 1);
ewl_callback_append(win, EWL_CALLBACK_CLICKED, destroy, NULL); ewl_callback_append(win, EWL_CALLBACK_CLICKED, destroy, NULL);