Add some more stuff to ephoto including directory viewing now.
The old edit view has become single view, and there is a completely new edit view that is much more editing specific. SVN revision: 29592
This commit is contained in:
parent
077cfd531f
commit
4fbb26010d
|
@ -16,6 +16,7 @@ ephoto_SOURCES = ephoto.c \
|
|||
ephoto_main.c \
|
||||
ephoto_nls.c \
|
||||
ephoto_normal_view.c \
|
||||
ephoto_single_view.c \
|
||||
ephoto_slideshow.c \
|
||||
ephoto_utils.c
|
||||
|
||||
|
|
|
@ -266,9 +266,6 @@ int main(int argc, char **argv)
|
|||
bind_textdomain_codeset(PACKAGE, "UTF-8");
|
||||
textdomain(PACKAGE);
|
||||
#endif
|
||||
/*Use our own theme*/
|
||||
ewl_theme_theme_set(PACKAGE_DATA_DIR "/themes/ephoto.edj");
|
||||
|
||||
/*Start the GUI*/
|
||||
create_main_gui();
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ void ephoto_db_close(sqlite3 *db);
|
|||
Ewl_Widget *add_box(Ewl_Widget *c, Ewl_Orientation orientation, int spacing);
|
||||
Ewl_Widget *add_button(Ewl_Widget *c, const char *txt, const char *img, void *cb, void *data);
|
||||
Ewl_Widget *add_entry(Ewl_Widget *c, const char *txt, void *cb, void *data);
|
||||
Ewl_Widget *add_icon(Ewl_Widget *c, const char *lbl, const char *img, int thumbnail, void *cb, void *data);
|
||||
Ewl_Widget *add_image(Ewl_Widget *c, const char *img, int thumbnail, void *cb, void *data);
|
||||
Ewl_Widget *add_label(Ewl_Widget *c, const char *lbl);
|
||||
Ewl_Widget *add_menubar(Ewl_Widget *c);
|
||||
|
@ -86,7 +87,6 @@ void update_image(Ewl_Widget *image, int w, int h, unsigned int *data);
|
|||
|
||||
/* Ephoto Edit View */
|
||||
Ewl_Widget *add_edit_view(Ewl_Widget *c);
|
||||
void add_edit_tools(Ewl_Widget *c);
|
||||
|
||||
/* Ephoto List View */
|
||||
Ewl_Widget *add_list_view(Ewl_Widget *c);
|
||||
|
@ -96,6 +96,9 @@ Ewl_Widget *add_ltree(Ewl_Widget *c);
|
|||
Ewl_Widget *add_normal_view(Ewl_Widget *c);
|
||||
void freebox_image_clicked(Ewl_Widget *w, void *event, void *data);
|
||||
|
||||
/* Ephoto Single View */
|
||||
Ewl_Widget *add_single_view(Ewl_Widget *c);
|
||||
|
||||
/* Ephoto Slideshow */
|
||||
void start_slideshow(Ewl_Widget *w, void *event, void *data);
|
||||
|
||||
|
@ -104,27 +107,39 @@ const char *file_size_get(int size);
|
|||
const char *image_pixels_string_get(const char *file);
|
||||
void image_pixels_int_get(const char *file, int *width, int *height);
|
||||
|
||||
/* Ephoto Views */
|
||||
void show_normal_view(Ewl_Widget *w, void *event, void *data);
|
||||
/* Ephoto Main View */
|
||||
void show_main_view(Ewl_Widget *w, void *event, void *data);
|
||||
void show_edit_view(Ewl_Widget *w, void *event, void *data);
|
||||
|
||||
/* Ephoto Viewer Views */
|
||||
void show_normal_view(Ewl_Widget *w, void *event, void *data);
|
||||
void show_list_view(Ewl_Widget *w, void *event, void *data);
|
||||
void show_single_view(Ewl_Widget *w, void *event, void *data);
|
||||
|
||||
/* Ephoto Global Variables */
|
||||
typedef struct _Ephoto_Main Ephoto_Main;
|
||||
|
||||
struct _Ephoto_Main
|
||||
{
|
||||
char *current_directory;
|
||||
Ecore_List *albums;
|
||||
Ecore_List *directories;
|
||||
Ecore_List *images;
|
||||
Ewl_Widget *atree;
|
||||
Ewl_Widget *edit_tools;
|
||||
Ewl_Widget *browser;
|
||||
Ewl_Widget *dtree;
|
||||
Ewl_Widget *edit_vbox;
|
||||
Ewl_Widget *eimage;
|
||||
Ewl_Widget *fbox_vbox;
|
||||
Ewl_Widget *fbox;
|
||||
Ewl_Widget *list_vbox;
|
||||
Ewl_Widget *ltree;
|
||||
Ewl_Widget *main_nb;
|
||||
Ewl_Widget *main_vbox;
|
||||
Ewl_Widget *simage;
|
||||
Ewl_Widget *single_vbox;
|
||||
Ewl_Widget *toolbar;
|
||||
Ewl_Widget *view;
|
||||
Ewl_Widget *view_box;
|
||||
Ewl_Widget *win;
|
||||
sqlite3 *db;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "ephoto.h"
|
||||
|
||||
/*Ephoto Image Manipulation*/
|
||||
static void add_standard_edit_tools(Ewl_Widget *c);
|
||||
static void previous_image(Ewl_Widget *w, void *event, void *data);
|
||||
static void next_image(Ewl_Widget *w, void *event, void *data);
|
||||
static void flip_image_horizontal(Ewl_Widget *w, void *event, void *data);
|
||||
|
@ -11,72 +12,104 @@ static void rotate_image_right(Ewl_Widget *w, void *event, void *data);
|
|||
/*Add the edit view*/
|
||||
Ewl_Widget *add_edit_view(Ewl_Widget *c)
|
||||
{
|
||||
em->edit_vbox = add_box(c, EWL_ORIENTATION_VERTICAL, 5);
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(em->edit_vbox), EWL_FLAG_FILL_ALL);
|
||||
ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(c), em->edit_vbox, "Edit");
|
||||
Ewl_Widget *button, *vbox, *hbox, *nb, *standard, *enhance, *advanced;
|
||||
|
||||
em->eimage = add_image(em->edit_vbox, NULL, 0, NULL, NULL);
|
||||
vbox = add_box(c, EWL_ORIENTATION_VERTICAL, 5);
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_ALL);
|
||||
|
||||
hbox = add_box(vbox, EWL_ORIENTATION_HORIZONTAL, 2);
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_ALL);
|
||||
|
||||
nb = ewl_notebook_new();
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(nb), EWL_FLAG_FILL_VFILL | EWL_FLAG_FILL_HSHRINK);
|
||||
ewl_container_child_append(EWL_CONTAINER(hbox), nb);
|
||||
ewl_widget_show(nb);
|
||||
|
||||
standard = add_box(nb, EWL_ORIENTATION_VERTICAL, 2);
|
||||
ewl_object_maximum_w_set(EWL_OBJECT(standard), 172);
|
||||
ewl_object_minimum_w_set(EWL_OBJECT(standard), 172);
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(standard), EWL_FLAG_FILL_VFILL);
|
||||
ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(nb), standard, "Standard Tools");
|
||||
|
||||
add_standard_edit_tools(standard);
|
||||
|
||||
enhance = add_box(nb, EWL_ORIENTATION_VERTICAL, 2);
|
||||
ewl_object_maximum_w_set(EWL_OBJECT(enhance), 172);
|
||||
ewl_object_minimum_w_set(EWL_OBJECT(enhance), 172);
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(enhance), EWL_FLAG_FILL_VFILL);
|
||||
ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(nb), enhance, "Enhancing Tools");
|
||||
|
||||
advanced = add_box(nb, EWL_ORIENTATION_VERTICAL, 2);
|
||||
ewl_object_maximum_w_set(EWL_OBJECT(advanced), 172);
|
||||
ewl_object_minimum_w_set(EWL_OBJECT(advanced), 172);
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(advanced), EWL_FLAG_FILL_VFILL);
|
||||
ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(nb), advanced, "Advanced Tools");
|
||||
|
||||
em->eimage = add_image(hbox, NULL, 0, NULL, NULL);
|
||||
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);
|
||||
hbox = add_box(vbox, EWL_ORIENTATION_HORIZONTAL, 2);
|
||||
ewl_object_alignment_set(EWL_OBJECT(hbox), EWL_FLAG_ALIGN_CENTER);
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_SHRINK);
|
||||
|
||||
return em->edit_vbox;
|
||||
button = add_button(hbox, "Return to main view", NULL, show_main_view, NULL);
|
||||
|
||||
button = add_button(hbox, NULL, PACKAGE_DATA_DIR "/images/media-seek-backward.png", previous_image, NULL);
|
||||
ewl_button_image_size_set(EWL_BUTTON(button), 25, 25);
|
||||
ewl_attach_tooltip_text_set(button, "Previous Image");
|
||||
|
||||
button = add_button(hbox, NULL, PACKAGE_DATA_DIR "/images/media-seek-forward.png", next_image, NULL);
|
||||
ewl_button_image_size_set(EWL_BUTTON(button), 25, 25);
|
||||
ewl_attach_tooltip_text_set(button, "Next Image");
|
||||
|
||||
return vbox;
|
||||
}
|
||||
|
||||
/*Show the edit view*/
|
||||
void show_edit_view(Ewl_Widget *w, void *event, void *data)
|
||||
{
|
||||
ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->view_box), em->edit_vbox);
|
||||
ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->main_nb), em->edit_vbox);
|
||||
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*/
|
||||
void add_edit_tools(Ewl_Widget *c)
|
||||
static void add_standard_edit_tools(Ewl_Widget *c)
|
||||
{
|
||||
Ewl_Widget *image, *sep;
|
||||
Ewl_Widget *button;
|
||||
|
||||
image = add_image(c, PACKAGE_DATA_DIR "/images/get_exif.png", 0, NULL, NULL);
|
||||
ewl_image_constrain_set(EWL_IMAGE(image), 30);
|
||||
ewl_attach_tooltip_text_set(image, "You do not have libexif 0.6.13");
|
||||
button = add_button(c, "Get Exif", PACKAGE_DATA_DIR "/images/get_exif.png", NULL, NULL);
|
||||
ewl_button_image_size_set(EWL_BUTTON(button), 30, 30);
|
||||
ewl_button_label_set(EWL_BUTTON(button), "You do not have libexif 0.6.13");
|
||||
ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_LEFT);
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_HFILL);
|
||||
#ifdef BUILD_EXIF_SUPPORT
|
||||
ewl_callback_append(image, EWL_CALLBACK_CLICKED, display_exif_dialog, NULL);
|
||||
ewl_attach_tooltip_text_set(image, "View Exif Data");
|
||||
ewl_callback_append(button, EWL_CALLBACK_CLICKED, display_exif_dialog, NULL);
|
||||
ewl_button_label_set(EWL_BUTTON(button), "View Exif Data");
|
||||
#endif
|
||||
|
||||
image = add_image(c, PACKAGE_DATA_DIR "/images/undo.png", 0, rotate_image_left, NULL);
|
||||
ewl_image_constrain_set(EWL_IMAGE(image), 30);
|
||||
ewl_attach_tooltip_text_set(image, "Rotate Image Left");
|
||||
button = add_button(c, "Rotate Left", PACKAGE_DATA_DIR "/images/undo.png", rotate_image_left, NULL);
|
||||
ewl_button_image_size_set(EWL_BUTTON(button), 30, 30);
|
||||
ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_LEFT);
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_HFILL);
|
||||
|
||||
image = add_image(c, PACKAGE_DATA_DIR "/images/redo.png", 0, rotate_image_right, NULL);
|
||||
ewl_image_constrain_set(EWL_IMAGE(image), 30);
|
||||
ewl_attach_tooltip_text_set(image, "Rotate Image Right");
|
||||
button = add_button(c, "Rotate Right", PACKAGE_DATA_DIR "/images/redo.png", rotate_image_right, NULL);
|
||||
ewl_button_image_size_set(EWL_BUTTON(button), 30, 30);
|
||||
ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_LEFT);
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_HFILL);
|
||||
|
||||
image = add_image(c, PACKAGE_DATA_DIR "/images/go-next.png", 0, flip_image_horizontal, NULL);
|
||||
ewl_image_constrain_set(EWL_IMAGE(image), 30);
|
||||
ewl_attach_tooltip_text_set(image, "Flip Image Horizontally");
|
||||
button = add_button(c, "Flip Horizontally", PACKAGE_DATA_DIR "/images/go-next.png", flip_image_horizontal, NULL);
|
||||
ewl_button_image_size_set(EWL_BUTTON(button), 30, 30);
|
||||
ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_LEFT);
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_HFILL);
|
||||
|
||||
image = add_image(c, PACKAGE_DATA_DIR "/images/go-down.png", 0, flip_image_vertical, NULL);
|
||||
ewl_image_constrain_set(EWL_IMAGE(image), 30);
|
||||
ewl_attach_tooltip_text_set(image, "Flip Image Vertically");
|
||||
button = add_button(c, "Flip Vertically", PACKAGE_DATA_DIR "/images/go-down.png", flip_image_vertical, NULL);
|
||||
ewl_button_image_size_set(EWL_BUTTON(button), 30, 30);
|
||||
ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_LEFT);
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_HFILL);
|
||||
|
||||
sep = ewl_vseparator_new();
|
||||
ewl_container_child_append(EWL_CONTAINER(c), sep);
|
||||
ewl_widget_show(sep);
|
||||
|
||||
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_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_attach_tooltip_text_set(image, "Next Image");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,22 @@ Ewl_Widget *add_entry(Ewl_Widget *c, const char *txt, void *cb, void *data)
|
|||
return entry;
|
||||
}
|
||||
|
||||
/*Create and add an icon to the container c*/
|
||||
Ewl_Widget *add_icon(Ewl_Widget *c, const char *lbl, const char *img, int thumbnail, void *cb, void *data)
|
||||
{
|
||||
Ewl_Widget *icon;
|
||||
|
||||
icon = ewl_icon_new();
|
||||
if(!thumbnail) ewl_icon_thumbnailing_set(EWL_ICON(icon), FALSE);
|
||||
if (lbl) ewl_icon_label_set(EWL_ICON(icon), lbl);
|
||||
if (img) ewl_icon_image_set(EWL_ICON(icon), img, NULL);
|
||||
if (c) ewl_container_child_append(EWL_CONTAINER(c), icon);
|
||||
if (cb) ewl_callback_append(icon, EWL_CALLBACK_CLICKED, cb, data);
|
||||
ewl_widget_show(icon);
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
/*Create and Add an Image to the Container c*/
|
||||
Ewl_Widget *add_image(Ewl_Widget *c, const char *img, int thumbnail, void *cb, void *data)
|
||||
{
|
||||
|
|
|
@ -2,17 +2,23 @@
|
|||
|
||||
/*Ewl Callbacks*/
|
||||
static void destroy(Ewl_Widget *w, void *event, void *data);
|
||||
static void populate(Ewl_Widget *w, void *event, void *data);
|
||||
static void populate_albums(Ewl_Widget *w, void *event, void *data);
|
||||
static void populate_directories(Ewl_Widget *w, void *event, void *data);
|
||||
static void window_fullscreen(Ewl_Widget *w, void *event, void *data);
|
||||
|
||||
/*Ephoto Create Callbacks*/
|
||||
static Ewl_Widget *add_atree(Ewl_Widget *c);
|
||||
static Ewl_Widget *add_dtree(Ewl_Widget *c);
|
||||
|
||||
/*Ephoto MVC Callbacks*/
|
||||
static Ewl_Widget *album_view_new(void *data, unsigned int row, unsigned int column);
|
||||
static Ewl_Widget *directory_view_new(void *data, unsigned int row, unsigned int column);
|
||||
static Ewl_Widget *album_header_fetch(void *data, unsigned int column);
|
||||
static Ewl_Widget *directory_header_fetch(void *data, unsigned int column);
|
||||
static void *album_data_fetch(void *data, unsigned int row, unsigned int column);
|
||||
static void *directory_data_fetch(void *data, unsigned int row, unsigned int column);
|
||||
static unsigned int album_data_count(void *data);
|
||||
static unsigned int directory_data_count(void *data);
|
||||
|
||||
/*Ephoto Global Variables*/
|
||||
Ephoto_Main *em;
|
||||
|
@ -23,7 +29,8 @@ static void destroy(Ewl_Widget *w, void *event, void *data)
|
|||
ephoto_db_close(em->db);
|
||||
ewl_widget_destroy(em->win);
|
||||
ecore_list_destroy(em->albums);
|
||||
ecore_list_destroy(em->images);
|
||||
ecore_list_destroy(em->directories);
|
||||
ecore_dlist_destroy(em->images);
|
||||
free(em);
|
||||
ewl_main_quit();
|
||||
return;
|
||||
|
@ -45,15 +52,23 @@ static void window_fullscreen(Ewl_Widget *w, void *event, void *data)
|
|||
return;
|
||||
}
|
||||
|
||||
/*Show the main view*/
|
||||
void show_main_view(Ewl_Widget *c, void *event, void *data)
|
||||
{
|
||||
ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->main_nb), em->main_vbox);
|
||||
ecore_dlist_goto_first(em->images);
|
||||
}
|
||||
|
||||
/*Create the Main Ephoto Window*/
|
||||
void create_main_gui(void)
|
||||
{
|
||||
Ewl_Widget *vbox, *hbox, *hsep, *vsep, *button;
|
||||
Ewl_Widget *vbox, *hbox, *vsep, *button;
|
||||
Ewl_Widget *mb, *menu, *mi;
|
||||
|
||||
em = NULL;
|
||||
em = calloc(1, sizeof(Ephoto_Main));
|
||||
em->albums = ecore_list_new();
|
||||
em->directories = ecore_list_new();
|
||||
em->images = ecore_dlist_new();
|
||||
|
||||
em->win = add_window("Ephoto!", 775, 540, destroy, NULL);
|
||||
|
@ -68,53 +83,100 @@ void create_main_gui(void)
|
|||
hbox = add_box(vbox, EWL_ORIENTATION_HORIZONTAL, 2);
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_ALL);
|
||||
|
||||
em->atree = add_atree(hbox);
|
||||
em->main_nb = ewl_notebook_new();
|
||||
ewl_notebook_tabbar_visible_set(EWL_NOTEBOOK(em->main_nb), 0);
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(em->main_nb), EWL_FLAG_FILL_ALL);
|
||||
ewl_container_child_append(EWL_CONTAINER(hbox), em->main_nb);
|
||||
ewl_widget_show(em->main_nb);
|
||||
|
||||
em->main_vbox = add_box(em->main_nb, EWL_ORIENTATION_VERTICAL, 2);
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(em->main_vbox), EWL_FLAG_FILL_ALL);
|
||||
|
||||
em->edit_vbox = add_box(em->main_nb, EWL_ORIENTATION_VERTICAL, 2);
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(em->edit_vbox), EWL_FLAG_FILL_ALL);
|
||||
|
||||
add_edit_view(em->edit_vbox);
|
||||
|
||||
em->view = add_box(em->main_vbox, EWL_ORIENTATION_HORIZONTAL, 2);
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(em->view), EWL_FLAG_FILL_ALL);
|
||||
|
||||
em->browser = ewl_notebook_new();
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(em->browser), EWL_FLAG_FILL_VFILL);
|
||||
ewl_container_child_append(EWL_CONTAINER(em->view), em->browser);
|
||||
ewl_widget_show(em->browser);
|
||||
|
||||
em->atree = add_atree(em->browser);
|
||||
ewl_object_minimum_w_set(EWL_OBJECT(em->atree), 172);
|
||||
ewl_object_maximum_w_set(EWL_OBJECT(em->atree), 172);
|
||||
ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(em->browser), em->atree, "Albums");
|
||||
|
||||
em->dtree = add_dtree(em->browser);
|
||||
ewl_object_minimum_w_set(EWL_OBJECT(em->dtree), 172);
|
||||
ewl_object_maximum_w_set(EWL_OBJECT(em->dtree), 172);
|
||||
ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(em->browser), em->dtree, "File System");
|
||||
|
||||
em->view_box = ewl_notebook_new();
|
||||
ewl_notebook_tabbar_visible_set(EWL_NOTEBOOK(em->view_box), 0);
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(em->view_box), EWL_FLAG_FILL_ALL);
|
||||
ewl_container_child_append(EWL_CONTAINER(hbox), em->view_box);
|
||||
ewl_container_child_append(EWL_CONTAINER(em->view), em->view_box);
|
||||
ewl_widget_show(em->view_box);
|
||||
|
||||
add_normal_view(em->view_box);
|
||||
|
||||
add_edit_view(em->view_box);
|
||||
add_single_view(em->view_box);
|
||||
|
||||
add_list_view(em->view_box);
|
||||
|
||||
hsep = ewl_hseparator_new();
|
||||
ewl_container_child_append(EWL_CONTAINER(vbox), hsep);
|
||||
ewl_widget_show(hsep);
|
||||
|
||||
em->toolbar = add_box(vbox, EWL_ORIENTATION_HORIZONTAL, 1);
|
||||
ewl_object_minimum_h_set(EWL_OBJECT(em->toolbar), 30);
|
||||
em->toolbar = ewl_hbox_new();
|
||||
ewl_box_spacing_set(EWL_BOX(em->toolbar), 5);
|
||||
ewl_object_alignment_set(EWL_OBJECT(em->toolbar), EWL_FLAG_ALIGN_CENTER);
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(em->toolbar), EWL_FLAG_FILL_SHRINK);
|
||||
ewl_container_child_append(EWL_CONTAINER(em->main_vbox), em->toolbar);
|
||||
ewl_widget_show(em->toolbar);
|
||||
|
||||
button = add_button(em->toolbar, NULL, PACKAGE_DATA_DIR "/images/normal_view.png", show_normal_view, NULL);
|
||||
ewl_image_size_set(EWL_IMAGE(EWL_BUTTON(button)->image_object), 30, 30);
|
||||
ewl_button_image_size_set(EWL_BUTTON(button), 30, 30);
|
||||
ewl_attach_tooltip_text_set(button, "Normal View");
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK);
|
||||
ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_CENTER);
|
||||
|
||||
button = add_button(em->toolbar, NULL, PACKAGE_DATA_DIR "/images/list_view.png", show_list_view, NULL);
|
||||
ewl_image_size_set(EWL_IMAGE(EWL_BUTTON(button)->image_object), 30, 30);
|
||||
ewl_button_image_size_set(EWL_BUTTON(button), 30, 30);
|
||||
ewl_attach_tooltip_text_set(button, "List View");
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK);
|
||||
ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_CENTER);
|
||||
|
||||
button = add_button(em->toolbar, NULL, PACKAGE_DATA_DIR "/images/edit_view.png", show_edit_view, NULL);
|
||||
ewl_image_size_set(EWL_IMAGE(EWL_BUTTON(button)->image_object), 30, 30);
|
||||
button = add_button(em->toolbar, NULL, PACKAGE_DATA_DIR "/images/image.png", show_single_view, NULL);
|
||||
ewl_button_image_size_set(EWL_BUTTON(button), 30, 30);
|
||||
ewl_attach_tooltip_text_set(button, "Single View");
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK);
|
||||
ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_CENTER);
|
||||
|
||||
vsep = ewl_vseparator_new();
|
||||
ewl_container_child_append(EWL_CONTAINER(em->toolbar), vsep);
|
||||
ewl_widget_show(vsep);
|
||||
|
||||
button = add_button(em->toolbar, NULL, PACKAGE_DATA_DIR "/images/stock_fullscreen.png", window_fullscreen, NULL);
|
||||
ewl_image_size_set(EWL_IMAGE(EWL_BUTTON(button)->image_object), 30, 30);
|
||||
ewl_button_image_size_set(EWL_BUTTON(button), 30, 30);
|
||||
ewl_attach_tooltip_text_set(button, "Toggle Fullscreen");
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK);
|
||||
ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_CENTER);
|
||||
|
||||
button = add_button(em->toolbar, NULL, PACKAGE_DATA_DIR "/images/x-office-presentation.png", start_slideshow, NULL);
|
||||
ewl_image_size_set(EWL_IMAGE(EWL_BUTTON(button)->image_object), 30, 30);
|
||||
ewl_button_image_size_set(EWL_BUTTON(button), 30, 30);
|
||||
ewl_attach_tooltip_text_set(button, "Start a Slideshow");
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK);
|
||||
ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_CENTER);
|
||||
|
||||
vsep = ewl_vseparator_new();
|
||||
ewl_container_child_append(EWL_CONTAINER(em->toolbar), vsep);
|
||||
ewl_widget_show(vsep);
|
||||
|
||||
button = add_button(em->toolbar, NULL, PACKAGE_DATA_DIR "/images/edit_view.png", show_edit_view, NULL);
|
||||
ewl_button_image_size_set(EWL_BUTTON(button), 30, 30);
|
||||
ewl_attach_tooltip_text_set(button, "Move to edit view");
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(button), EWL_FLAG_FILL_SHRINK);
|
||||
ewl_object_alignment_set(EWL_OBJECT(button), EWL_FLAG_ALIGN_CENTER);
|
||||
|
||||
em->albums = ecore_list_new();
|
||||
em->db = ephoto_db_init();
|
||||
|
@ -122,13 +184,14 @@ void create_main_gui(void)
|
|||
|
||||
ewl_mvc_data_set(EWL_MVC(em->atree), em->albums);
|
||||
|
||||
populate(NULL, NULL, "Complete Library");
|
||||
populate_albums(NULL, NULL, "Complete Library");
|
||||
populate_directories(NULL, NULL, getenv("HOME"));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*Update the Image List*/
|
||||
static void populate(Ewl_Widget *w, void *event, void *data)
|
||||
static void populate_albums(Ewl_Widget *w, void *event, void *data)
|
||||
{
|
||||
const char *album;
|
||||
char *imagef;
|
||||
|
@ -136,7 +199,7 @@ static void populate(Ewl_Widget *w, void *event, void *data)
|
|||
|
||||
if (w)
|
||||
{
|
||||
album = (char *)ewl_widget_name_get(w);
|
||||
album = ewl_widget_name_get(w);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -165,6 +228,7 @@ static void populate(Ewl_Widget *w, void *event, void *data)
|
|||
ecore_dlist_next(em->images);
|
||||
}
|
||||
ecore_dlist_goto_first(em->images);
|
||||
ewl_image_file_path_set(EWL_IMAGE(em->simage), ecore_dlist_current(em->images));
|
||||
|
||||
ewl_mvc_data_set(EWL_MVC(em->ltree), em->images);
|
||||
ewl_mvc_dirty_set(EWL_MVC(em->ltree), 1);
|
||||
|
@ -172,6 +236,68 @@ static void populate(Ewl_Widget *w, void *event, void *data)
|
|||
return;
|
||||
}
|
||||
|
||||
/*Update the Image List*/
|
||||
static void populate_directories(Ewl_Widget *w, void *event, void *data)
|
||||
{
|
||||
const char *directory;
|
||||
char *imagef;
|
||||
Ewl_Widget *thumb;
|
||||
|
||||
if (w)
|
||||
{
|
||||
directory = ewl_widget_name_get(w);
|
||||
}
|
||||
else
|
||||
{
|
||||
directory = data;
|
||||
}
|
||||
if (!ecore_list_is_empty(em->directories))
|
||||
{
|
||||
ecore_list_destroy(em->directories);
|
||||
}
|
||||
|
||||
if(em->current_directory) free(em->current_directory);
|
||||
em->current_directory = strdup(directory);
|
||||
|
||||
em->directories = ecore_list_new();
|
||||
em->directories = get_directories(directory);
|
||||
|
||||
ecore_dlist_goto_first(em->directories);
|
||||
ewl_mvc_data_set(EWL_MVC(em->dtree), em->directories);
|
||||
ewl_mvc_dirty_set(EWL_MVC(em->dtree), 1);
|
||||
|
||||
if (w)
|
||||
{
|
||||
if (!ecore_list_is_empty(em->images))
|
||||
{
|
||||
ecore_dlist_destroy(em->images);
|
||||
}
|
||||
|
||||
em->images = ecore_dlist_new();
|
||||
em->images = get_images(directory);
|
||||
|
||||
ecore_dlist_goto_first(em->images);
|
||||
|
||||
ewl_container_reset(EWL_CONTAINER(em->fbox));
|
||||
while (ecore_dlist_current(em->images))
|
||||
{
|
||||
imagef = ecore_dlist_current(em->images);
|
||||
|
||||
thumb = add_image(em->fbox, imagef, 1, freebox_image_clicked, NULL);
|
||||
ewl_image_constrain_set(EWL_IMAGE(thumb), 64);
|
||||
ewl_object_alignment_set(EWL_OBJECT(thumb), EWL_FLAG_ALIGN_CENTER);
|
||||
ewl_widget_name_set(thumb, imagef);
|
||||
|
||||
ecore_dlist_next(em->images);
|
||||
}
|
||||
ecore_dlist_goto_first(em->images);
|
||||
ewl_image_file_path_set(EWL_IMAGE(em->simage), ecore_dlist_current(em->images));
|
||||
ewl_mvc_data_set(EWL_MVC(em->ltree), em->images);
|
||||
ewl_mvc_dirty_set(EWL_MVC(em->ltree), 1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/*Create and Add a Tree to the Container c*/
|
||||
static Ewl_Widget *add_atree(Ewl_Widget *c)
|
||||
{
|
||||
|
@ -201,6 +327,34 @@ static Ewl_Widget *add_atree(Ewl_Widget *c)
|
|||
return tree;
|
||||
}
|
||||
|
||||
/*Create and Add a Tree to the Container c*/
|
||||
static Ewl_Widget *add_dtree(Ewl_Widget *c)
|
||||
{
|
||||
Ewl_Widget *tree;
|
||||
Ewl_Model *model;
|
||||
Ewl_View *view;
|
||||
|
||||
model = ewl_model_new();
|
||||
ewl_model_data_fetch_set(model, directory_data_fetch);
|
||||
ewl_model_data_count_set(model, directory_data_count);
|
||||
|
||||
view = ewl_view_new();
|
||||
ewl_view_widget_fetch_set(view, directory_view_new);
|
||||
ewl_view_header_fetch_set(view, directory_header_fetch);
|
||||
|
||||
tree = ewl_tree2_new();
|
||||
ewl_tree2_headers_visible_set(EWL_TREE2(tree), 0);
|
||||
ewl_tree2_fixed_rows_set(EWL_TREE2(tree), 1);
|
||||
ewl_tree2_column_count_set(EWL_TREE2(tree), 1);
|
||||
ewl_mvc_model_set(EWL_MVC(tree), model);
|
||||
ewl_mvc_view_set(EWL_MVC(tree), view);
|
||||
ewl_mvc_selection_mode_set(EWL_MVC(tree), EWL_SELECTION_MODE_SINGLE);
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(tree), EWL_FLAG_FILL_ALL);
|
||||
ewl_container_child_append(EWL_CONTAINER(c), tree);
|
||||
ewl_widget_show(tree);
|
||||
|
||||
return tree;
|
||||
}
|
||||
|
||||
/* The view of the users albums */
|
||||
static Ewl_Widget *album_view_new(void *data, unsigned int row, unsigned int column)
|
||||
|
@ -210,31 +364,64 @@ static Ewl_Widget *album_view_new(void *data, unsigned int row, unsigned int col
|
|||
|
||||
album = data;
|
||||
|
||||
icon = ewl_icon_new();
|
||||
ewl_icon_thumbnailing_set(EWL_ICON(icon), FALSE);
|
||||
ewl_icon_image_set(EWL_ICON(icon), PACKAGE_DATA_DIR "/images/image.png", NULL);
|
||||
ewl_icon_label_set(EWL_ICON(icon), album);
|
||||
icon = add_icon(NULL, album, PACKAGE_DATA_DIR "/images/image.png", 0, populate_albums, NULL);
|
||||
|
||||
ewl_icon_constrain_set(EWL_ICON(icon), 25);
|
||||
ewl_box_orientation_set(EWL_BOX(icon), EWL_ORIENTATION_HORIZONTAL);
|
||||
ewl_object_alignment_set(EWL_OBJECT(icon), EWL_FLAG_ALIGN_LEFT);
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(icon), EWL_FLAG_FILL_ALL);
|
||||
ewl_callback_append(icon, EWL_CALLBACK_CLICKED, populate, NULL);
|
||||
ewl_widget_name_set(icon, album);
|
||||
ewl_widget_show(icon);
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
/* The view of the users directories */
|
||||
static Ewl_Widget *directory_view_new(void *data, unsigned int row, unsigned int column)
|
||||
{
|
||||
const char *directory;
|
||||
Ewl_Widget *icon;
|
||||
|
||||
directory = data;
|
||||
|
||||
icon = add_icon(NULL, basename((char *)directory), PACKAGE_DATA_DIR "/images/folder.png", 0, populate_directories, NULL);
|
||||
|
||||
ewl_icon_constrain_set(EWL_ICON(icon), 25);
|
||||
ewl_box_orientation_set(EWL_BOX(icon), EWL_ORIENTATION_HORIZONTAL);
|
||||
ewl_object_alignment_set(EWL_OBJECT(icon), EWL_FLAG_ALIGN_LEFT);
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(icon), EWL_FLAG_FILL_ALL);
|
||||
if (!strncmp(directory, "..", 2))
|
||||
{
|
||||
ewl_widget_name_set(icon, dirname(em->current_directory));
|
||||
}
|
||||
else
|
||||
{
|
||||
ewl_widget_name_set(icon, directory);
|
||||
}
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
|
||||
/* The header for the tree */
|
||||
static Ewl_Widget *album_header_fetch(void *data, unsigned int column)
|
||||
{
|
||||
Ewl_Widget *label;
|
||||
|
||||
label = add_label(NULL, "Browser");
|
||||
label = add_label(NULL, "Albums");
|
||||
|
||||
return label;
|
||||
}
|
||||
|
||||
/* The header for the tree */
|
||||
static Ewl_Widget *directory_header_fetch(void *data, unsigned int column)
|
||||
{
|
||||
Ewl_Widget *label;
|
||||
|
||||
label = add_label(NULL, "Directories");
|
||||
|
||||
return label;
|
||||
}
|
||||
|
||||
/* The albums that will be displayed*/
|
||||
static void *album_data_fetch(void *data, unsigned int row, unsigned int column)
|
||||
{
|
||||
|
@ -250,6 +437,21 @@ static void *album_data_fetch(void *data, unsigned int row, unsigned int column)
|
|||
return val;
|
||||
}
|
||||
|
||||
/* The directories that will be displayed*/
|
||||
static void *directory_data_fetch(void *data, unsigned int row, unsigned int column)
|
||||
{
|
||||
const char *directory;
|
||||
void *val = NULL;
|
||||
|
||||
directory = ecore_list_goto_index(em->directories, row);
|
||||
if (directory)
|
||||
{
|
||||
val = (void *)directory;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
/* The number of albums the view is displaying */
|
||||
static unsigned int album_data_count(void *data)
|
||||
{
|
||||
|
@ -260,3 +462,13 @@ static unsigned int album_data_count(void *data)
|
|||
return val;
|
||||
}
|
||||
|
||||
/* The number of directories the view is displaying */
|
||||
static unsigned int directory_data_count(void *data)
|
||||
{
|
||||
int val;
|
||||
|
||||
val = ecore_list_nodes(em->directories);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
#include "ephoto.h"
|
||||
|
||||
/*Ephoto Image Changing*/
|
||||
static void previous_image(Ewl_Widget *w, void *event, void *data);
|
||||
static void next_image(Ewl_Widget *w, void *event, void *data);
|
||||
|
||||
/*Add the single view*/
|
||||
Ewl_Widget *add_single_view(Ewl_Widget *c)
|
||||
{
|
||||
Ewl_Widget *hbox, *button;
|
||||
|
||||
em->single_vbox = add_box(c, EWL_ORIENTATION_VERTICAL, 5);
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(em->single_vbox), EWL_FLAG_FILL_ALL);
|
||||
ewl_notebook_page_tab_text_set(EWL_NOTEBOOK(c), em->single_vbox, "Single");
|
||||
|
||||
em->simage = add_image(em->single_vbox, NULL, 0, NULL, NULL);
|
||||
ewl_object_alignment_set(EWL_OBJECT(em->simage), EWL_FLAG_ALIGN_CENTER);
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(em->simage), EWL_FLAG_FILL_SHRINK);
|
||||
|
||||
hbox = add_box(em->single_vbox, EWL_ORIENTATION_HORIZONTAL, 2);
|
||||
ewl_object_alignment_set(EWL_OBJECT(hbox), EWL_FLAG_ALIGN_CENTER);
|
||||
ewl_object_fill_policy_set(EWL_OBJECT(hbox), EWL_FLAG_FILL_SHRINK);
|
||||
|
||||
button = add_button(hbox, NULL, PACKAGE_DATA_DIR "/images/media-seek-backward.png", previous_image, NULL);
|
||||
ewl_button_image_size_set(EWL_BUTTON(button), 25, 25);
|
||||
ewl_attach_tooltip_text_set(button, "Previous Image");
|
||||
|
||||
button = add_button(hbox, NULL, PACKAGE_DATA_DIR "/images/media-seek-forward.png", next_image, NULL);
|
||||
ewl_button_image_size_set(EWL_BUTTON(button), 25, 25);
|
||||
ewl_attach_tooltip_text_set(button, "Next Image");
|
||||
|
||||
return em->single_vbox;
|
||||
}
|
||||
|
||||
/*Show the single view*/
|
||||
void show_single_view(Ewl_Widget *w, void *event, void *data)
|
||||
{
|
||||
ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->view_box), em->single_vbox);
|
||||
ecore_dlist_goto_first(em->images);
|
||||
ewl_image_file_path_set(EWL_IMAGE(em->simage), ecore_dlist_current(em->images));
|
||||
return;
|
||||
}
|
||||
|
||||
/*Go to the previous image*/
|
||||
static void previous_image(Ewl_Widget *w, void *event, void *data)
|
||||
{
|
||||
char *image;
|
||||
|
||||
ecore_dlist_previous(em->images);
|
||||
image = ecore_dlist_current(em->images);
|
||||
if(!image)
|
||||
{
|
||||
ecore_dlist_goto_last(em->images);
|
||||
image = ecore_dlist_current(em->images);
|
||||
}
|
||||
ewl_image_file_path_set(EWL_IMAGE(em->simage), image);
|
||||
ewl_widget_configure(em->simage->parent);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*Go to the next image*/
|
||||
static void next_image(Ewl_Widget *w, void *event, void *data)
|
||||
{
|
||||
char *image;
|
||||
|
||||
ecore_dlist_next(em->images);
|
||||
image = ecore_dlist_current(em->images);
|
||||
if(!image)
|
||||
{
|
||||
ecore_dlist_goto_first(em->images);
|
||||
image = ecore_dlist_current(em->images);
|
||||
}
|
||||
ewl_image_file_path_set(EWL_IMAGE(em->simage), image);
|
||||
ewl_widget_configure(em->simage->parent);
|
||||
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue