Add functionality to go to single view when an image from normal view or list view is clicked.

Also add functionality to keep the current image when moving to edit view.


SVN revision: 29594
This commit is contained in:
titan 2007-04-19 04:09:15 +00:00 committed by titan
parent 4fbb26010d
commit bbc54e284e
5 changed files with 50 additions and 6 deletions

View File

@ -70,7 +70,6 @@ Ewl_Widget *add_edit_view(Ewl_Widget *c)
void show_edit_view(Ewl_Widget *w, void *event, void *data)
{
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;
}

View File

@ -2,7 +2,9 @@
static Ewl_Widget *list_view_new(void *data, unsigned int row, unsigned int column);
static Ewl_Widget *list_header_fetch(void *data, unsigned int column);
static void iterate(char *point2);
static void *list_data_fetch(void *data, unsigned int row, unsigned int column);
static void list_item_clicked(Ewl_Widget *w, void *event, void *data);
static unsigned int list_data_count(void *data);
/*Add the list view*/
@ -23,6 +25,32 @@ void show_list_view(Ewl_Widget *w, void *event, void *data)
ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->view_box), em->list_vbox);
}
/*Iterate the list to our spot*/
static void iterate(char *point2)
{
char *point1;
ecore_dlist_goto_first(em->images);
while(ecore_dlist_current(em->images))
{
point1 = ecore_dlist_current(em->images);
if (!strcmp(point1, point2)) return;
ecore_dlist_next(em->images);
}
}
/*Go to single view*/
static void list_item_clicked(Ewl_Widget *w, void *event, void *data)
{
char *image;
image = data;
iterate(image);
show_single_view(NULL, NULL, NULL);
free(image);
}
/*Create and Add a Tree to the Container c*/
Ewl_Widget *add_ltree(Ewl_Widget *c)
{
@ -71,7 +99,7 @@ static Ewl_Widget *list_view_new(void *data, unsigned int row, unsigned int colu
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, list_item_clicked, strdup(image));
ewl_widget_name_set(hbox, image);
img = add_image(hbox, image, 1, NULL, NULL);

View File

@ -221,7 +221,7 @@ static void populate_albums(Ewl_Widget *w, void *event, void *data)
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_image_constrain_set(EWL_IMAGE(thumb), 81);
ewl_object_alignment_set(EWL_OBJECT(thumb), EWL_FLAG_ALIGN_CENTER);
ewl_widget_name_set(thumb, imagef);
@ -284,7 +284,7 @@ static void populate_directories(Ewl_Widget *w, void *event, void *data)
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_image_constrain_set(EWL_IMAGE(thumb), 81);
ewl_object_alignment_set(EWL_OBJECT(thumb), EWL_FLAG_ALIGN_CENTER);
ewl_widget_name_set(thumb, imagef);

View File

@ -1,5 +1,7 @@
#include "ephoto.h"
static void iterate(char *point2);
/*Add the normal view*/
Ewl_Widget *add_normal_view(Ewl_Widget *c)
{
@ -28,13 +30,29 @@ void show_normal_view(Ewl_Widget *w, void *event, void *data)
ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->view_box), em->fbox_vbox);
}
/*Find our spot in the list*/
static void iterate(char *point2)
{
char *point1;
ecore_dlist_goto_first(em->images);
while(ecore_dlist_current(em->images))
{
point1 = ecore_dlist_current(em->images);
if (!strcmp(point1, point2)) return;
ecore_dlist_next(em->images);
}
}
/*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));
iterate(strdup(path));
show_single_view(NULL, NULL, NULL);
return;
}

View File

@ -36,7 +36,6 @@ Ewl_Widget *add_single_view(Ewl_Widget *c)
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;
}