Ephoto: Work around some bugs with editing.
This commit is contained in:
parent
0bf54e689e
commit
94fddb9f36
|
@ -76,10 +76,10 @@ void ephoto_single_browser_path_pending_set(Evas_Object *obj,
|
|||
void ephoto_single_browser_path_pending_unset(Evas_Object *obj);
|
||||
void ephoto_single_browser_path_created(Evas_Object *obj, Ephoto_Entry *entry);
|
||||
void ephoto_single_browser_image_data_update(Evas_Object *main,
|
||||
Evas_Object *image, Eina_Bool finished, unsigned int *image_data, int w,
|
||||
int h);
|
||||
void ephoto_single_browser_cancel_editing(Evas_Object *main,
|
||||
Evas_Object *image);
|
||||
Evas_Object *image, unsigned int *image_data, int w, int h);
|
||||
void ephoto_single_browser_image_data_done(Evas_Object *main,
|
||||
unsigned int *image_data, int w, int h);
|
||||
void ephoto_single_browser_cancel_editing(Evas_Object *main);
|
||||
/* smart callbacks called: "back" - the user wants to go back to the previous
|
||||
* screen. */
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ _ephoto_bcg_adjust_brightness(Ephoto_BCG *ebcg, int brightness,
|
|||
p1++;
|
||||
}
|
||||
}
|
||||
ephoto_single_browser_image_data_update(ebcg->main, ebcg->image, EINA_FALSE,
|
||||
ephoto_single_browser_image_data_update(ebcg->main, ebcg->image,
|
||||
im_data_new, ebcg->w, ebcg->h);
|
||||
free(im_data);
|
||||
return im_data_new;
|
||||
|
@ -147,7 +147,7 @@ _ephoto_bcg_adjust_contrast(Ephoto_BCG *ebcg, int contrast,
|
|||
p1++;
|
||||
}
|
||||
}
|
||||
ephoto_single_browser_image_data_update(ebcg->main, ebcg->image, EINA_FALSE,
|
||||
ephoto_single_browser_image_data_update(ebcg->main, ebcg->image,
|
||||
im_data_new, ebcg->w, ebcg->h);
|
||||
free(im_data);
|
||||
return im_data_new;
|
||||
|
@ -198,7 +198,7 @@ _ephoto_bcg_adjust_gamma(Ephoto_BCG *ebcg, double gamma,
|
|||
p1++;
|
||||
}
|
||||
}
|
||||
ephoto_single_browser_image_data_update(ebcg->main, ebcg->image, EINA_FALSE,
|
||||
ephoto_single_browser_image_data_update(ebcg->main, ebcg->image,
|
||||
im_data_new, ebcg->w, ebcg->h);
|
||||
free(im_data);
|
||||
return im_data_new;
|
||||
|
@ -278,8 +278,7 @@ _bcg_apply(void *data, int type EINA_UNUSED,
|
|||
evas_object_image_data_get(elm_image_object_get(ebcg->image),
|
||||
EINA_FALSE);
|
||||
evas_object_image_size_get(elm_image_object_get(ebcg->image), &w, &h);
|
||||
ephoto_single_browser_image_data_update(ebcg->main, ebcg->image, EINA_TRUE,
|
||||
image_data, w, h);
|
||||
ephoto_single_browser_image_data_done(ebcg->main, image_data, w, h);
|
||||
ephoto_editor_del(ebcg->editor);
|
||||
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
|
@ -298,7 +297,7 @@ _bcg_cancel(void *data, int type EINA_UNUSED,
|
|||
ebcg->contrast = 0;
|
||||
ebcg->gamma = 1;
|
||||
_brightness_slider_changed(ebcg, ebcg->bslider, NULL);
|
||||
ephoto_single_browser_cancel_editing(ebcg->main, ebcg->image);
|
||||
ephoto_single_browser_cancel_editing(ebcg->main);
|
||||
ephoto_editor_del(ebcg->editor);
|
||||
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
|
|
|
@ -89,7 +89,7 @@ _ephoto_color_adjust_red(Ephoto_Color *eco, int red, unsigned int *image_data)
|
|||
p1++;
|
||||
}
|
||||
}
|
||||
ephoto_single_browser_image_data_update(eco->main, eco->image, EINA_FALSE,
|
||||
ephoto_single_browser_image_data_update(eco->main, eco->image,
|
||||
im_data_new, eco->w, eco->h);
|
||||
free(im_data);
|
||||
return im_data_new;
|
||||
|
@ -138,7 +138,7 @@ _ephoto_color_adjust_green(Ephoto_Color *eco, int green,
|
|||
p1++;
|
||||
}
|
||||
}
|
||||
ephoto_single_browser_image_data_update(eco->main, eco->image, EINA_FALSE,
|
||||
ephoto_single_browser_image_data_update(eco->main, eco->image,
|
||||
im_data_new, eco->w, eco->h);
|
||||
free(im_data);
|
||||
return im_data_new;
|
||||
|
@ -187,7 +187,7 @@ _ephoto_color_adjust_blue(Ephoto_Color *eco, int blue,
|
|||
p1++;
|
||||
}
|
||||
}
|
||||
ephoto_single_browser_image_data_update(eco->main, eco->image, EINA_FALSE,
|
||||
ephoto_single_browser_image_data_update(eco->main, eco->image,
|
||||
im_data_new, eco->w, eco->h);
|
||||
free(im_data);
|
||||
return im_data_new;
|
||||
|
@ -263,8 +263,7 @@ _color_apply(void *data, int type EINA_UNUSED,
|
|||
evas_object_image_data_get(elm_image_object_get(eco->image),
|
||||
EINA_FALSE);
|
||||
evas_object_image_size_get(elm_image_object_get(eco->image), &w, &h);
|
||||
ephoto_single_browser_image_data_update(eco->main, eco->image, EINA_TRUE,
|
||||
image_data, w, h);
|
||||
ephoto_single_browser_image_data_done(eco->main, image_data, w, h);
|
||||
ephoto_editor_del(eco->editor);
|
||||
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
|
@ -283,7 +282,7 @@ _color_cancel(void *data, int type EINA_UNUSED,
|
|||
eco->green = 0;
|
||||
eco->blue = 0;
|
||||
_red_slider_changed(eco, eco->rslider, NULL);
|
||||
ephoto_single_browser_cancel_editing(eco->main, eco->image);
|
||||
ephoto_single_browser_cancel_editing(eco->main);
|
||||
ephoto_editor_del(eco->editor);
|
||||
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
|
|
|
@ -220,7 +220,7 @@ _apply_crop(void *data, Evas_Object *obj EINA_UNUSED,
|
|||
elm_table_unpack(ec->image_parent, ec->box);
|
||||
elm_layout_content_unset(ec->layout, "ephoto.swallow.image");
|
||||
elm_table_pack(ec->image_parent, ec->image, 0, 0, 1, 1);
|
||||
ephoto_single_browser_image_data_update(ec->main, ec->image, EINA_TRUE,
|
||||
ephoto_single_browser_image_data_done(ec->main,
|
||||
idata_new, nw, nh);
|
||||
evas_object_del(ec->cropper);
|
||||
evas_object_del(ec->layout);
|
||||
|
@ -237,7 +237,7 @@ _cancel_crop(void *data, Evas_Object *obj EINA_UNUSED,
|
|||
elm_table_unpack(ec->image_parent, ec->box);
|
||||
elm_layout_content_unset(ec->layout, "ephoto.swallow.image");
|
||||
elm_table_pack(ec->image_parent, ec->image, 0, 0, 1, 1);
|
||||
ephoto_single_browser_cancel_editing(ec->main, ec->image);
|
||||
ephoto_single_browser_cancel_editing(ec->main);
|
||||
evas_object_del(ec->cropper);
|
||||
evas_object_del(ec->layout);
|
||||
evas_object_del(ec->box);
|
||||
|
|
|
@ -120,7 +120,7 @@ ephoto_filter_blur(Evas_Object *main, Evas_Object *image)
|
|||
free(gs);
|
||||
free(bs);
|
||||
|
||||
ephoto_single_browser_image_data_update(main, image, EINA_TRUE, im_data_new,
|
||||
ephoto_single_browser_image_data_update(main, image, im_data_new,
|
||||
w, h);
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ ephoto_filter_sharpen(Evas_Object *main, Evas_Object *image)
|
|||
p1++;
|
||||
}
|
||||
}
|
||||
ephoto_single_browser_image_data_update(main, image, EINA_TRUE, im_data_new,
|
||||
ephoto_single_browser_image_data_update(main, image, im_data_new,
|
||||
w, h);
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@ ephoto_filter_black_and_white(Evas_Object *main, Evas_Object *image)
|
|||
gray = (gray * a) / 255;
|
||||
im_data_new[i] = (a << 24) | (gray << 16) | (gray << 8) | gray;
|
||||
}
|
||||
ephoto_single_browser_image_data_update(main, image, EINA_TRUE, im_data_new,
|
||||
ephoto_single_browser_image_data_update(main, image, im_data_new,
|
||||
w, h);
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,7 @@ ephoto_filter_old_photo(Evas_Object *main, Evas_Object *image)
|
|||
rr = _demul_color_alpha(rr, a);
|
||||
im_data_new[i] = (a << 24) | (rr << 16) | (gg << 8) | bb;
|
||||
}
|
||||
ephoto_single_browser_image_data_update(main, image, EINA_TRUE, im_data_new,
|
||||
ephoto_single_browser_image_data_update(main, image, im_data_new,
|
||||
w, h);
|
||||
}
|
||||
|
||||
|
@ -310,6 +310,6 @@ ephoto_filter_histogram_eq(Evas_Object *main, Evas_Object *image)
|
|||
p1++;
|
||||
}
|
||||
}
|
||||
ephoto_single_browser_image_data_update(main, image, EINA_TRUE, im_data_new,
|
||||
ephoto_single_browser_image_data_update(main, image, im_data_new,
|
||||
w, h);
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ _ephoto_hsv_adjust_hue(Ephoto_HSV *ehsv, double hue, unsigned int *image_data)
|
|||
}
|
||||
}
|
||||
ehsv->hue = hue;
|
||||
ephoto_single_browser_image_data_update(ehsv->main, ehsv->image, EINA_FALSE,
|
||||
ephoto_single_browser_image_data_update(ehsv->main, ehsv->image,
|
||||
im_data_new, ehsv->w, ehsv->h);
|
||||
free(im_data);
|
||||
return im_data_new;
|
||||
|
@ -152,7 +152,7 @@ _ephoto_hsv_adjust_saturation(Ephoto_HSV *ehsv, double saturation,
|
|||
}
|
||||
}
|
||||
ehsv->saturation = saturation;
|
||||
ephoto_single_browser_image_data_update(ehsv->main, ehsv->image, EINA_FALSE,
|
||||
ephoto_single_browser_image_data_update(ehsv->main, ehsv->image,
|
||||
im_data_new, ehsv->w, ehsv->h);
|
||||
free(im_data);
|
||||
return im_data_new;
|
||||
|
@ -208,7 +208,7 @@ _ephoto_hsv_adjust_value(Ephoto_HSV *ehsv, double value,
|
|||
}
|
||||
}
|
||||
ehsv->value = value;
|
||||
ephoto_single_browser_image_data_update(ehsv->main, ehsv->image, EINA_FALSE,
|
||||
ephoto_single_browser_image_data_update(ehsv->main, ehsv->image,
|
||||
im_data_new, ehsv->w, ehsv->h);
|
||||
free(im_data);
|
||||
return im_data_new;
|
||||
|
@ -285,8 +285,7 @@ _hsv_apply(void *data, int type EINA_UNUSED,
|
|||
evas_object_image_data_get(elm_image_object_get(ehsv->image),
|
||||
EINA_FALSE);
|
||||
evas_object_image_size_get(elm_image_object_get(ehsv->image), &w, &h);
|
||||
ephoto_single_browser_image_data_update(ehsv->main, ehsv->image, EINA_TRUE,
|
||||
image_data, w, h);
|
||||
ephoto_single_browser_image_data_done(ehsv->main, image_data, w, h);
|
||||
ephoto_editor_del(ehsv->editor);
|
||||
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
|
@ -305,7 +304,7 @@ _hsv_cancel(void *data, int type EINA_UNUSED,
|
|||
ehsv->saturation = 0;
|
||||
ehsv->value = 0;
|
||||
_hue_slider_changed(ehsv, ehsv->hslider, NULL);
|
||||
ephoto_single_browser_cancel_editing(ehsv->main, ehsv->image);
|
||||
ephoto_single_browser_cancel_editing(ehsv->main);
|
||||
ephoto_editor_del(ehsv->editor);
|
||||
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
|
|
|
@ -113,7 +113,7 @@ _reye_clicked(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
|||
}
|
||||
}
|
||||
er->edited_im_data = im_data_new;
|
||||
ephoto_single_browser_image_data_update(er->main, er->image, EINA_FALSE,
|
||||
ephoto_single_browser_image_data_update(er->main, er->image,
|
||||
im_data_new, er->w, er->h);
|
||||
free(im_data);
|
||||
}
|
||||
|
@ -134,8 +134,12 @@ _reye_reset(void *data, int type EINA_UNUSED,
|
|||
|
||||
elm_slider_value_set(er->rslider, 15);
|
||||
er->rad = 15;
|
||||
|
||||
ephoto_single_browser_image_data_update(er->main, er->image, EINA_FALSE,
|
||||
if (er->edited_im_data)
|
||||
{
|
||||
free(er->edited_im_data);
|
||||
er->edited_im_data = NULL;
|
||||
}
|
||||
ephoto_single_browser_image_data_update(er->main, er->image,
|
||||
er->original_im_data, er->w, er->h);
|
||||
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
|
@ -153,8 +157,7 @@ _reye_apply(void *data, int type EINA_UNUSED,
|
|||
evas_object_image_data_get(elm_image_object_get(er->image),
|
||||
EINA_FALSE);
|
||||
evas_object_image_size_get(elm_image_object_get(er->image), &w, &h);
|
||||
ephoto_single_browser_image_data_update(er->main, er->image, EINA_TRUE,
|
||||
image_data, w, h);
|
||||
ephoto_single_browser_image_data_done(er->main, image_data, w, h);
|
||||
ephoto_editor_del(er->editor);
|
||||
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
|
@ -169,9 +172,12 @@ _reye_cancel(void *data, int type EINA_UNUSED,
|
|||
elm_slider_value_set(er->rslider, 15);
|
||||
er->rad = 15;
|
||||
|
||||
ephoto_single_browser_image_data_update(er->main, er->image, EINA_FALSE,
|
||||
er->original_im_data, er->w, er->h);
|
||||
ephoto_single_browser_cancel_editing(er->main, er->image);
|
||||
ephoto_single_browser_cancel_editing(er->main);
|
||||
if (er->edited_im_data)
|
||||
{
|
||||
free(er->edited_im_data);
|
||||
er->edited_im_data = NULL;
|
||||
}
|
||||
ephoto_editor_del(er->editor);
|
||||
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
|
|
|
@ -1803,23 +1803,35 @@ ephoto_single_browser_path_created(Evas_Object *obj, Ephoto_Entry *entry)
|
|||
|
||||
void
|
||||
ephoto_single_browser_image_data_update(Evas_Object *main, Evas_Object *image,
|
||||
Eina_Bool finished, unsigned int *image_data, int w, int h)
|
||||
unsigned int *image_data, int w, int h)
|
||||
{
|
||||
Ephoto_Single_Browser *sb = evas_object_data_get(main, "single_browser");
|
||||
|
||||
if (sb->editing)
|
||||
{
|
||||
if (sb->cropping)
|
||||
{
|
||||
evas_object_image_size_set(elm_image_object_get(image), w, h);
|
||||
sb->cropping = EINA_FALSE;
|
||||
}
|
||||
evas_object_image_data_set(elm_image_object_get(image), image_data);
|
||||
evas_object_image_data_update_add(elm_image_object_get(image), 0, 0, w,
|
||||
h);
|
||||
}
|
||||
}
|
||||
|
||||
if (finished)
|
||||
void
|
||||
ephoto_single_browser_image_data_done(Evas_Object *main,
|
||||
unsigned int *image_data, int w, int h)
|
||||
{
|
||||
Ephoto_Single_Browser *sb = evas_object_data_get(main, "single_browser");
|
||||
|
||||
if (sb->editing)
|
||||
{
|
||||
_ephoto_single_browser_recalc(sb);
|
||||
Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer");
|
||||
if (sb->cropping)
|
||||
sb->cropping = EINA_FALSE;
|
||||
evas_object_image_size_set(elm_image_object_get(v->image), w, h);
|
||||
evas_object_image_data_set(elm_image_object_get(v->image), image_data);
|
||||
evas_object_image_data_update_add(elm_image_object_get(v->image), 0, 0, w,
|
||||
h);
|
||||
|
||||
_update_bottom_bar(sb);
|
||||
sb->edited_image_data = image_data;
|
||||
sb->ew = w;
|
||||
|
@ -1828,32 +1840,27 @@ ephoto_single_browser_image_data_update(Evas_Object *main, Evas_Object *image,
|
|||
_zoom_fit(sb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ephoto_single_browser_cancel_editing(Evas_Object *main, Evas_Object *image)
|
||||
ephoto_single_browser_cancel_editing(Evas_Object *main)
|
||||
{
|
||||
Ephoto_Single_Browser *sb = evas_object_data_get(main, "single_browser");
|
||||
|
||||
if (sb->editing)
|
||||
{
|
||||
_ephoto_single_browser_recalc(sb);
|
||||
Ephoto_Viewer *v = evas_object_data_get(sb->viewer, "viewer");
|
||||
if (sb->cropping)
|
||||
sb->cropping = EINA_FALSE;
|
||||
if (sb->edited_image_data)
|
||||
{
|
||||
evas_object_image_size_set(elm_image_object_get(image), sb->ew,
|
||||
evas_object_image_size_set(elm_image_object_get(v->image), sb->ew,
|
||||
sb->eh);
|
||||
evas_object_image_data_set(elm_image_object_get(image),
|
||||
evas_object_image_data_set(elm_image_object_get(v->image),
|
||||
sb->edited_image_data);
|
||||
evas_object_image_data_update_add(elm_image_object_get(image), 0,
|
||||
evas_object_image_data_update_add(elm_image_object_get(v->image), 0,
|
||||
0, sb->ew, sb->eh);
|
||||
}
|
||||
else
|
||||
{
|
||||
const char *group = _get_edje_group(sb->entry->path);
|
||||
elm_image_file_set(image, sb->entry->path, group);
|
||||
}
|
||||
|
||||
sb->editing = EINA_FALSE;
|
||||
_zoom_fit(sb);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue