Ephoto: Add real size label to the cropper so you will know the size of cropped image.
This commit is contained in:
parent
d678d7b45b
commit
ede263f65a
|
@ -125,6 +125,11 @@ collections {
|
|||
set_state_val(PART:"ephoto.swallow.cropper", STATE_REL1_OFFSET, pox, poy);
|
||||
set_state_val(PART:"ephoto.swallow.cropper", STATE_REL2_OFFSET, ppox, ppoy);
|
||||
}
|
||||
if (movetype == 10) {
|
||||
new buf[32];
|
||||
snprintf(buf, sizeof(buf), "%dx%d", cox, coy);
|
||||
set_text(PART:"ephoto.cropper.size", buf);
|
||||
}
|
||||
set_state(PART:"ephoto.swallow.cropper", "custom", 0.0);
|
||||
}
|
||||
}
|
||||
|
@ -156,6 +161,24 @@ collections {
|
|||
rel2.relative: 0.8 0.8;
|
||||
}
|
||||
}
|
||||
part { name: "ephoto.cropper.size";
|
||||
type: TEXT;
|
||||
effect: GLOW;
|
||||
scale: 1;
|
||||
mouse_events: 0;
|
||||
clip_to: "clipper";
|
||||
description { state: "default" 0.0;
|
||||
color: 255 255 255 255;
|
||||
rel1.to: "ephoto.swallow.cropper";
|
||||
rel2.to: "ephoto.swallow.cropper";
|
||||
text {
|
||||
text: "";
|
||||
font: FN;
|
||||
size: 12;
|
||||
align: 0.5 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
part { name: "shader_top";
|
||||
type: RECT;
|
||||
scale: 1;
|
||||
|
|
|
@ -14,6 +14,32 @@ struct _Ephoto_Cropper
|
|||
int resizing;
|
||||
};
|
||||
|
||||
static void
|
||||
_calculate_cropper_size(Ephoto_Cropper *ec)
|
||||
{
|
||||
Edje_Message_Int_Set *msg;
|
||||
int w, h, cw, ch, iw, ih, nw, nh;
|
||||
double scalew, scaleh;
|
||||
|
||||
evas_object_geometry_get(ec->layout, 0, 0, &w, &h);
|
||||
edje_object_part_geometry_get(elm_layout_edje_get(ec->layout),
|
||||
"ephoto.swallow.cropper", 0, 0, &cw, &ch);
|
||||
evas_object_image_size_get(elm_image_object_get(ec->image), &iw, &ih);
|
||||
|
||||
scalew = (double)cw/(double)w;
|
||||
scaleh = (double)ch/(double)h;
|
||||
|
||||
nw = iw*scalew;
|
||||
nh = ih*scaleh;
|
||||
|
||||
msg = alloca(sizeof(Edje_Message_Int_Set) + (3*sizeof(int)));
|
||||
msg->count = 3;
|
||||
msg->val[0] = 10;
|
||||
msg->val[1] = nw;
|
||||
msg->val[2] = nh;
|
||||
edje_object_message_send(elm_layout_edje_get(ec->layout), EDJE_MESSAGE_INT_SET, 1, msg);
|
||||
}
|
||||
|
||||
static void
|
||||
_cropper_both_mouse_move(void *data, Evas_Object *obj EINA_UNUSED, const char *emission EINA_UNUSED, const char *source)
|
||||
{
|
||||
|
@ -53,6 +79,7 @@ _cropper_both_mouse_move(void *data, Evas_Object *obj EINA_UNUSED, const char *e
|
|||
msg->val[1] = nx;
|
||||
msg->val[2] = ny;
|
||||
edje_object_message_send(elm_layout_edje_get(ec->layout), EDJE_MESSAGE_INT_SET, 1, msg);
|
||||
_calculate_cropper_size(ec);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -63,6 +90,7 @@ _cropper_both_mouse_up(void *data, Evas_Object *obj EINA_UNUSED, const char *emi
|
|||
edje_object_signal_callback_del_full(ec->cropper, "mouse,move", source, _cropper_both_mouse_move, ec);
|
||||
edje_object_signal_callback_del_full(ec->cropper, "mouse,up,1", source, _cropper_both_mouse_up, ec);
|
||||
ec->resizing = 0;
|
||||
_calculate_cropper_size(ec);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -111,6 +139,7 @@ _cropper_horiz_mouse_move(void *data, Evas_Object *obj EINA_UNUSED, const char *
|
|||
msg->val[1] = nx;
|
||||
msg->val[2] = 0;
|
||||
edje_object_message_send(elm_layout_edje_get(ec->layout), EDJE_MESSAGE_INT_SET, 1, msg);
|
||||
_calculate_cropper_size(ec);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -121,9 +150,9 @@ _cropper_horiz_mouse_up(void *data, Evas_Object *obj EINA_UNUSED, const char *em
|
|||
edje_object_signal_callback_del_full(ec->cropper, "mouse,move", source, _cropper_horiz_mouse_move, ec);
|
||||
edje_object_signal_callback_del_full(ec->cropper, "mouse,up,1", source, _cropper_horiz_mouse_up, ec);
|
||||
ec->resizing = 0;
|
||||
_calculate_cropper_size(ec);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_cropper_resize_horiz(void *data, Evas_Object *obj EINA_UNUSED, const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
|
||||
{
|
||||
|
@ -170,6 +199,7 @@ _cropper_vert_mouse_move(void *data, Evas_Object *obj EINA_UNUSED, const char *e
|
|||
msg->val[1] = 0;
|
||||
msg->val[2] = ny;
|
||||
edje_object_message_send(elm_layout_edje_get(ec->layout), EDJE_MESSAGE_INT_SET, 1, msg);
|
||||
_calculate_cropper_size(ec);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -180,6 +210,7 @@ _cropper_vert_mouse_up(void *data, Evas_Object *obj EINA_UNUSED, const char *emi
|
|||
edje_object_signal_callback_del_full(ec->cropper, "mouse,move", source, _cropper_vert_mouse_move, ec);
|
||||
edje_object_signal_callback_del_full(ec->cropper, "mouse,up,1", source, _cropper_vert_mouse_up, ec);
|
||||
ec->resizing = 0;
|
||||
_calculate_cropper_size(ec);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -317,6 +348,7 @@ _image_resize(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, voi
|
|||
msg->val[1] = 0;
|
||||
msg->val[2] = 0;
|
||||
edje_object_message_send(elm_layout_edje_get(ec->layout), EDJE_MESSAGE_INT_SET, 1, msg);
|
||||
_calculate_cropper_size(ec);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in New Issue