Add saving images. This works now, but not extensively. *WARNING* Does not carry over exif yet.
SVN revision: 29899
This commit is contained in:
parent
50aeff8dc1
commit
88061e3b04
|
@ -84,7 +84,7 @@ unsigned int *flip_vertical(Ewl_Widget *image);
|
||||||
unsigned int *rotate_left(Ewl_Widget *image);
|
unsigned int *rotate_left(Ewl_Widget *image);
|
||||||
unsigned int *rotate_right(Ewl_Widget *image);
|
unsigned int *rotate_right(Ewl_Widget *image);
|
||||||
void update_image(Ewl_Widget *image, int w, int h, unsigned int *data);
|
void update_image(Ewl_Widget *image, int w, int h, unsigned int *data);
|
||||||
void save_image(Ewl_Widget *image, const char *file);
|
void save_dialog(const char *file);
|
||||||
|
|
||||||
/* Ephoto Edit View */
|
/* Ephoto Edit View */
|
||||||
Ewl_Widget *add_edit_view(Ewl_Widget *c);
|
Ewl_Widget *add_edit_view(Ewl_Widget *c);
|
||||||
|
@ -141,6 +141,7 @@ struct _Ephoto_Main
|
||||||
Ewl_Widget *simage;
|
Ewl_Widget *simage;
|
||||||
Ewl_Widget *single_sp;
|
Ewl_Widget *single_sp;
|
||||||
Ewl_Widget *single_vbox;
|
Ewl_Widget *single_vbox;
|
||||||
|
Ewl_Widget *smi;
|
||||||
Ewl_Widget *toolbar;
|
Ewl_Widget *toolbar;
|
||||||
Ewl_Widget *view;
|
Ewl_Widget *view;
|
||||||
Ewl_Widget *view_box;
|
Ewl_Widget *view_box;
|
||||||
|
|
|
@ -69,6 +69,7 @@ void show_edit_view(Ewl_Widget *w, void *event, void *data)
|
||||||
{
|
{
|
||||||
ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->main_nb), em->edit_vbox);
|
ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->main_nb), em->edit_vbox);
|
||||||
ewl_image_file_path_set(EWL_IMAGE(em->eimage), ecore_dlist_current(em->images));
|
ewl_image_file_path_set(EWL_IMAGE(em->eimage), ecore_dlist_current(em->images));
|
||||||
|
ewl_widget_enable(em->smi);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
#include "ephoto.h"
|
#include "ephoto.h"
|
||||||
|
|
||||||
|
static void close_dialog(Ewl_Widget *w, void *event, void *data);
|
||||||
|
static void save_image(Ewl_Widget *w, void *event, void *data);
|
||||||
|
|
||||||
|
static Ewl_Widget *save_win, *qseek, *cseek;
|
||||||
|
|
||||||
unsigned int *flip_horizontal(Ewl_Widget *image)
|
unsigned int *flip_horizontal(Ewl_Widget *image)
|
||||||
{
|
{
|
||||||
unsigned int *im_data, *im_data_new;
|
unsigned int *im_data, *im_data_new;
|
||||||
|
@ -137,18 +142,81 @@ void update_image(Ewl_Widget *image, int w, int h, unsigned int *data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void save_image(Ewl_Widget *image, const char *file)
|
static void close_dialog(Ewl_Widget *w, void *event, void *data)
|
||||||
{
|
{
|
||||||
|
ewl_widget_destroy(save_win);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void save_image(Ewl_Widget *w, void *event, void *data)
|
||||||
|
{
|
||||||
|
const char *file;
|
||||||
|
char flags[PATH_MAX];
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
||||||
if(image && file)
|
file = ewl_text_text_get(EWL_TEXT(data));
|
||||||
|
snprintf(flags, PATH_MAX, "quality=%f compression=%f", ewl_range_value_get(EWL_RANGE(qseek)),
|
||||||
|
ewl_range_value_get(EWL_RANGE(cseek)));
|
||||||
|
|
||||||
|
if(!file) return;
|
||||||
|
|
||||||
|
if(VISIBLE(em->eimage) && file)
|
||||||
{
|
{
|
||||||
pid = fork();
|
pid = fork();
|
||||||
if(pid == 0)
|
if(pid == 0)
|
||||||
{
|
{
|
||||||
evas_object_image_save(EWL_IMAGE(image)->image, file, NULL, NULL);
|
evas_object_image_save(EWL_IMAGE(em->eimage)->image, file, NULL, flags);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ewl_widget_destroy(save_win);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void save_dialog(const char *file)
|
||||||
|
{
|
||||||
|
Ewl_Widget *vbox, *hbox, *button, *entry;
|
||||||
|
|
||||||
|
save_win = add_window("Save Image", 300, 100, close_dialog, NULL);
|
||||||
|
|
||||||
|
vbox = add_box(save_win, EWL_ORIENTATION_VERTICAL, 5);
|
||||||
|
ewl_object_fill_policy_set(EWL_OBJECT(vbox), EWL_FLAG_FILL_ALL);
|
||||||
|
|
||||||
|
add_label(vbox, "Save As:");
|
||||||
|
|
||||||
|
entry = add_entry(vbox, "default.jpg", NULL, NULL);
|
||||||
|
|
||||||
|
add_label(vbox, "Quality:");
|
||||||
|
|
||||||
|
qseek = ewl_hseeker_new();
|
||||||
|
ewl_range_minimum_value_set(EWL_RANGE(qseek), 0);
|
||||||
|
ewl_range_maximum_value_set(EWL_RANGE(qseek), 100);
|
||||||
|
ewl_range_step_set(EWL_RANGE(qseek), 10);
|
||||||
|
ewl_range_value_set(EWL_RANGE(qseek), 80);
|
||||||
|
ewl_container_child_append(EWL_CONTAINER(vbox), qseek);
|
||||||
|
ewl_widget_show(qseek);
|
||||||
|
|
||||||
|
add_label(vbox, "Compression:");
|
||||||
|
|
||||||
|
cseek = ewl_hseeker_new();
|
||||||
|
ewl_range_minimum_value_set(EWL_RANGE(cseek), 0);
|
||||||
|
ewl_range_maximum_value_set(EWL_RANGE(cseek), 9);
|
||||||
|
ewl_range_step_set(EWL_RANGE(cseek), 1);
|
||||||
|
ewl_range_value_set(EWL_RANGE(cseek), 9);
|
||||||
|
ewl_container_child_append(EWL_CONTAINER(vbox), cseek);
|
||||||
|
ewl_widget_show(cseek);
|
||||||
|
|
||||||
|
hbox = add_box(vbox, EWL_ORIENTATION_HORIZONTAL, 5);
|
||||||
|
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, "Save", PACKAGE_DATA_DIR "/images/stock_save.png", save_image, entry);
|
||||||
|
ewl_button_image_size_set(EWL_BUTTON(button), 25, 25);
|
||||||
|
|
||||||
|
button = add_button(hbox, "Close", PACKAGE_DATA_DIR "/images/dialog-close.png", close_dialog, NULL);
|
||||||
|
ewl_button_image_size_set(EWL_BUTTON(button), 25, 25);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,7 @@ static void window_fullscreen(Ewl_Widget *w, void *event, void *data)
|
||||||
void show_main_view(Ewl_Widget *w, void *event, void *data)
|
void show_main_view(Ewl_Widget *w, void *event, void *data)
|
||||||
{
|
{
|
||||||
ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->main_nb), em->main_vbox);
|
ewl_notebook_visible_page_set(EWL_NOTEBOOK(em->main_nb), em->main_vbox);
|
||||||
|
ewl_widget_disable(em->smi);
|
||||||
ecore_dlist_goto_first(em->images);
|
ecore_dlist_goto_first(em->images);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,6 +142,7 @@ static void add_album(Ewl_Widget *w, void *event, void *data)
|
||||||
|
|
||||||
button = add_button(hbox, "Save", PACKAGE_DATA_DIR "/images/stock_save.png", save, window);
|
button = add_button(hbox, "Save", PACKAGE_DATA_DIR "/images/stock_save.png", save, window);
|
||||||
ewl_button_image_size_set(EWL_BUTTON(button), 25, 25);
|
ewl_button_image_size_set(EWL_BUTTON(button), 25, 25);
|
||||||
|
|
||||||
button = add_button(hbox, "Cancel", PACKAGE_DATA_DIR "/images/dialog-close.png", cancel, window);
|
button = add_button(hbox, "Cancel", PACKAGE_DATA_DIR "/images/dialog-close.png", cancel, window);
|
||||||
ewl_button_image_size_set(EWL_BUTTON(button), 25, 25);
|
ewl_button_image_size_set(EWL_BUTTON(button), 25, 25);
|
||||||
}
|
}
|
||||||
|
@ -164,6 +166,8 @@ void create_main_gui(void)
|
||||||
|
|
||||||
mb = add_menubar(vbox);
|
mb = add_menubar(vbox);
|
||||||
menu = add_menu(mb, "File");
|
menu = add_menu(mb, "File");
|
||||||
|
em->smi = add_menu_item(menu, "Save Image", PACKAGE_DATA_DIR "/images/stock_save.png", save_dialog, NULL);
|
||||||
|
ewl_widget_disable(em->smi);
|
||||||
mi = add_menu_item(menu, "Exit", PACKAGE_DATA_DIR "/images/exit.png", destroy, NULL);
|
mi = add_menu_item(menu, "Exit", PACKAGE_DATA_DIR "/images/exit.png", destroy, NULL);
|
||||||
menu = add_menu(mb, "Albums");
|
menu = add_menu(mb, "Albums");
|
||||||
mi = add_menu_item(menu, "Add Album", PACKAGE_DATA_DIR "/images/add.png", add_album, NULL);
|
mi = add_menu_item(menu, "Add Album", PACKAGE_DATA_DIR "/images/add.png", add_album, NULL);
|
||||||
|
|
Loading…
Reference in New Issue