Add editing tools!

SVN revision: 28386
This commit is contained in:
titan 2007-02-18 01:02:43 +00:00 committed by titan
parent cb1030e8e7
commit 3abc870213
10 changed files with 109 additions and 25 deletions

View File

@ -15,6 +15,8 @@ FILES = add.png \
go-next.png \
image.png \
list_view.png \
media-seek-backward.png \
media-seek-forward.png \
normal_view.png \
preferences-system.png \
redo.png \

Binary file not shown.

Binary file not shown.

View File

@ -28,7 +28,7 @@ group
{
name: "select";
signal: "selected";
source: "*";
source: "EWL";
action: STATE_SET "selected" 0.0;
target: "selection";
}
@ -36,7 +36,7 @@ group
{
name: "unselect";
signal: "unselected";
source: "*";
source: "EWL";
action: STATE_SET "default" 0.0;
target: "selection";
}
@ -73,7 +73,7 @@ group
{
name: "highlighted";
signal: "mouse,in";
source: "*";
source: "EWL";
action: STATE_SET "highlighted" 0.0;
target: "highlight";
}
@ -81,7 +81,7 @@ group
{
name: "default";
signal: "mouse,out";
source: "*";
source: "EWL";
action: STATE_SET "default" 0.0;
target: "highlight";
}

View File

@ -52,6 +52,9 @@ unsigned int *rotate_left(Ewl_Widget *image);
unsigned int *rotate_right(Ewl_Widget *image);
void update_image(Ewl_Widget *image, int w, int h, unsigned int *data);
/* Ephoto Edit View */
void add_edit_tools(Ewl_Widget *c);
/* Ephoto List View */
Ewl_Widget *add_ltree(Ewl_Widget *c);
@ -83,6 +86,8 @@ extern Ewl_Widget *ilabel;
extern Ewl_Widget *currenta;
extern Ewl_Widget *currentf;
extern Ewl_Widget *currenti;
extern Ewl_Widget *toolbar;
extern Ewl_Widget *edit_tools;
extern Ecore_List *images;
/* NLS */

View File

@ -181,7 +181,7 @@ static int list_images(void *notused, int argc, char **argv, char **col)
for(i = 0; i < argc; i++)
{
ecore_list_append(images_list, strdup(argv[i] ? argv[i] : "NULL"));
ecore_dlist_append(images_list, strdup(argv[i] ? argv[i] : "NULL"));
}
return 0;
@ -211,13 +211,13 @@ Ecore_List *ephoto_db_list_images(sqlite3 *db, char *album)
if(images_list)
{
ecore_list_destroy(images_list);
ecore_dlist_destroy(images_list);
}
if(image_ids)
{
ecore_list_destroy(image_ids);
}
images_list = ecore_list_new();
images_list = ecore_dlist_new();
image_ids = ecore_list_new();
snprintf(command, PATH_MAX, "SELECT id FROM albums WHERE name = '%s';", album);

View File

@ -1,6 +1,8 @@
#include "ephoto.h"
/*Ephoto Image Manipulation*/
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);
static void flip_image_vertical(Ewl_Widget *w, void *event, void *data);
static void rotate_image_left(Ewl_Widget *w, void *event, void *data);
@ -10,12 +12,79 @@ static void rotate_image_right(Ewl_Widget *w, void *event, void *data);
void show_edit_view(Ewl_Widget *w, void *event, void *data)
{
ewl_notebook_visible_page_set(EWL_NOTEBOOK(view_box), edit_vbox);
ecore_dlist_goto_first(images);
ewl_widget_show(edit_tools);
ewl_widget_hide(atree);
ewl_widget_hide(tbar);
ewl_widget_hide(ilabel);
ewl_widget_reparent(eimage);
}
/*Add edit tools to container c*/
void add_edit_tools(Ewl_Widget *c)
{
Ewl_Widget *image;
image = add_image(c, PACKAGE_DATA_DIR "/images/media-seek-backward.png", 0, previous_image, NULL);
ewl_image_constrain_set(EWL_IMAGE(image), 30);
image = add_image(c, PACKAGE_DATA_DIR "/images/media-seek-forward.png", 0, next_image, NULL);
ewl_image_constrain_set(EWL_IMAGE(image), 30);
image = add_image(c, PACKAGE_DATA_DIR "/images/undo.png", 0, rotate_image_left, NULL);
ewl_image_constrain_set(EWL_IMAGE(image), 30);
image = add_image(c, PACKAGE_DATA_DIR "/images/redo.png", 0, rotate_image_right, NULL);
ewl_image_constrain_set(EWL_IMAGE(image), 30);
image = add_image(c, PACKAGE_DATA_DIR "/images/go-next.png", 0, flip_image_horizontal, NULL);
ewl_image_constrain_set(EWL_IMAGE(image), 30);
image = add_image(c, PACKAGE_DATA_DIR "/images/go-down.png", 0, flip_image_vertical, NULL);
ewl_image_constrain_set(EWL_IMAGE(image), 30);
return;
}
/*Go to the previous image*/
static void previous_image(Ewl_Widget *w, void *event, void *data)
{
char *image;
ecore_dlist_previous(images);
image = ecore_dlist_current(images);
if(!image)
{
ecore_dlist_goto_last(images);
image = ecore_dlist_current(images);
}
ewl_image_file_path_set(EWL_IMAGE(eimage), image);
ewl_widget_configure(eimage->parent);
return;
}
/*Go to the next image*/
static void next_image(Ewl_Widget *w, void *event, void *data)
{
char *image;
ecore_dlist_next(images);
image = ecore_dlist_current(images);
if(!image)
{
ecore_dlist_goto_first(images);
image = ecore_dlist_current(images);
}
ewl_image_file_path_set(EWL_IMAGE(eimage), image);
ewl_widget_configure(eimage->parent);
return;
}
/*Flip the image 180 degrees horizontally*/
static void flip_image_horizontal(Ewl_Widget *w, void *event, void *data)
{

View File

@ -11,7 +11,8 @@ void show_list_view(Ewl_Widget *w, void *event, void *data)
{
ewl_notebook_visible_page_set(EWL_NOTEBOOK(view_box), list_vbox);
ewl_mvc_dirty_set(EWL_MVC(ltree), 1);
ewl_widget_hide(ilabel);
ewl_widget_hide(edit_tools);
ewl_widget_hide(ilabel);
ewl_widget_show(atree);
ewl_widget_show(tbar);
}

View File

@ -30,8 +30,8 @@ static void *views_data_fetch(void *data, unsigned int row, unsigned int column)
static int views_data_count(void *data);
/*Ephoto Global Variables*/
Ewl_Widget *atree, *tbar, *vcombo, *view_box, *fbox_vbox, *edit_vbox, *list_vbox;
Ewl_Widget *fbox, *eimage, *ltree, *ilabel, *currenta, *currentf, *currenti;
Ewl_Widget *atree, *tbar, *vcombo, *view_box, *fbox_vbox, *edit_vbox, *list_vbox, *fbox;
Ewl_Widget *eimage, *ltree, *ilabel, *currenta, *currentf, *currenti, *toolbar, *edit_tools;
Ecore_List *images;
@ -68,10 +68,8 @@ static void window_fullscreen(Ewl_Widget *w, void *event, void *data)
/*Create the Main Ephoto Window*/
void create_main_gui(void)
{
Ecore_List *images;
Ewl_Widget *win, *vbox, *spacer, *text, *entry, *hbox;
Ewl_Widget *rvbox, *sp, *hsep, *toolbar, *vsep, *image;
Ewl_Widget *rvbox, *sp, *hsep, *vsep, *image;
Ewl_Widget *shbox, *seeker;
win = ewl_window_new();
@ -206,16 +204,24 @@ void create_main_gui(void)
image = add_image(toolbar, PACKAGE_DATA_DIR "/images/get_exif.png", 0, display_exif_dialog, NULL);
ewl_image_constrain_set(EWL_IMAGE(image), 30);
vsep = ewl_vseparator_new();
ewl_container_child_append(EWL_CONTAINER(toolbar), vsep);
ewl_widget_show(vsep);
image = add_image(toolbar, PACKAGE_DATA_DIR "/images/stock_fullscreen.png", 0, window_fullscreen, win);
ewl_image_constrain_set(EWL_IMAGE(image), 30);
image = add_image(toolbar, PACKAGE_DATA_DIR "/images/x-office-presentation.png", 0, NULL, NULL);
ewl_image_constrain_set(EWL_IMAGE(image), 30);
vsep = ewl_vseparator_new();
ewl_container_child_append(EWL_CONTAINER(toolbar), vsep);
ewl_widget_show(vsep);
edit_tools = ewl_hbox_new();
ewl_object_fill_policy_set(EWL_OBJECT(edit_tools), EWL_FLAG_FILL_HFILL);
ewl_container_child_append(EWL_CONTAINER(toolbar), edit_tools);
ewl_widget_show(edit_tools);
add_edit_tools(edit_tools);
ewl_widget_hide(edit_tools);
albums = ecore_list_new();
db = ephoto_db_init();
albums = ephoto_db_list_albums(db);
@ -254,31 +260,31 @@ static void populate(Ewl_Widget *w, void *event, void *data)
if (images)
{
ecore_list_destroy(images);
ecore_dlist_destroy(images);
}
images = ecore_list_new();
images = ecore_dlist_new();
images = ephoto_db_list_images(db, album);
ecore_list_goto_first(images);
ecore_dlist_goto_first(images);
ewl_container_reset(EWL_CONTAINER(fbox));
while (ecore_list_current(images))
while (ecore_dlist_current(images))
{
imagef = ecore_list_current(images);
imagef = ecore_dlist_current(images);
thumb = add_image(fbox, imagef, 1, set_info, NULL);
ewl_object_alignment_set(EWL_OBJECT(thumb), EWL_FLAG_ALIGN_CENTER);
ewl_widget_name_set(thumb, imagef);
ecore_list_next(images);
ecore_dlist_next(images);
}
ecore_list_goto_first(images);
ecore_dlist_goto_first(images);
ewl_mvc_data_set(EWL_MVC(ltree), images);
ewl_mvc_dirty_set(EWL_MVC(ltree), 1);
ewl_image_file_set(EWL_IMAGE(eimage), ecore_list_current(images), NULL);
ewl_image_file_set(EWL_IMAGE(eimage), ecore_dlist_current(images), NULL);
return;
}

View File

@ -7,6 +7,7 @@ void show_normal_view(Ewl_Widget *w, void *event, void *data)
ewl_widget_show(atree);
ewl_widget_show(tbar);
ewl_widget_show(ilabel);
ewl_widget_hide(edit_tools);
ewl_widget_configure(fbox);
}