add gui controls
This commit is contained in:
parent
30bf1fa9f9
commit
c9199930d8
|
@ -1,28 +1,7 @@
|
|||
#define ICON_PART(_NAME, _OFFX) \
|
||||
part \
|
||||
{ \
|
||||
name: "entice."_NAME; \
|
||||
type: SWALLOW; \
|
||||
clip_to: fader; \
|
||||
scale: 1; \
|
||||
description \
|
||||
{ \
|
||||
state: "default" 0.0; \
|
||||
rel1.relative: 1.0 1.0; \
|
||||
rel2.relative: 1.0 1.0; \
|
||||
rel1.offset: 0 0; \
|
||||
rel2.offset: (-16-_OFFX) -16; \
|
||||
align: 1.0 1.0; \
|
||||
offscale; \
|
||||
} \
|
||||
description { state: "disable" 0.0; \
|
||||
inherit: "default" 0.0; \
|
||||
visible: 0; \
|
||||
} \
|
||||
} \
|
||||
program { signal: "mouse,clicked,1"; source: "entice."_NAME; \
|
||||
action: SIGNAL_EMIT "image,action,"_NAME "entice"; \
|
||||
}
|
||||
#define ICON_SIZE 30
|
||||
|
||||
// padding between icon controls and window border
|
||||
#define GB_PAD 10
|
||||
|
||||
collections
|
||||
{
|
||||
|
@ -71,17 +50,305 @@ collections
|
|||
|
||||
// CONTROLS
|
||||
|
||||
// Zoom best fit checkbox
|
||||
part
|
||||
{
|
||||
name: "entice.zoomcheck";
|
||||
type: SWALLOW;
|
||||
clip_to: fader;
|
||||
scale: 1;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
fixed: 1 1;
|
||||
rel.to: "entice.zoomfit";
|
||||
rel1.relative: 0.0 0.0;
|
||||
rel1.offset: -1 0;
|
||||
rel2.relative: 0.0 1.0;
|
||||
rel2.offset: -1 -1;
|
||||
//min: ICON_SIZE ICON_SIZE;
|
||||
align: 1.0 1.0;
|
||||
offscale;
|
||||
}
|
||||
description { state: "disable" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 0;
|
||||
}
|
||||
}
|
||||
program { signal: "mouse,clicked,1"; source: "entice.zoomcheck";
|
||||
action: SIGNAL_EMIT "image,action,zoomcheck" "entice";
|
||||
}
|
||||
|
||||
// Zoom best fit icon
|
||||
part
|
||||
{
|
||||
name: "entice.zoomfit";
|
||||
type: SWALLOW;
|
||||
clip_to: fader;
|
||||
scale: 1;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
fixed: 1 1;
|
||||
rel.to: "entice.zoomorig";
|
||||
rel1.relative: 0.0 0.0;
|
||||
rel1.offset: -1 0;
|
||||
rel2.relative: 0.0 1.0;
|
||||
rel2.offset: -1 -1;
|
||||
min: ICON_SIZE ICON_SIZE;
|
||||
align: 1.0 1.0;
|
||||
offscale;
|
||||
}
|
||||
description { state: "disable" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 0;
|
||||
}
|
||||
}
|
||||
program { signal: "mouse,clicked,1"; source: "entice.zoomfit";
|
||||
action: SIGNAL_EMIT "image,action,zoomfit" "entice";
|
||||
}
|
||||
|
||||
// Zoom original icon
|
||||
part
|
||||
{
|
||||
name: "entice.zoomorig";
|
||||
type: SWALLOW;
|
||||
clip_to: fader;
|
||||
scale: 1;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
fixed: 1 1;
|
||||
rel.to: "entice.zoomout";
|
||||
rel1.relative: 0.0 0.0;
|
||||
rel1.offset: -1 0;
|
||||
rel2.relative: 0.0 1.0;
|
||||
rel2.offset: -1 -1;
|
||||
min: ICON_SIZE ICON_SIZE;
|
||||
align: 1.0 1.0;
|
||||
offscale;
|
||||
}
|
||||
description { state: "disable" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 0;
|
||||
}
|
||||
}
|
||||
program { signal: "mouse,clicked,1"; source: "entice.zoomorig";
|
||||
action: SIGNAL_EMIT "image,action,zoomorig" "entice";
|
||||
}
|
||||
|
||||
// Zoom out icon
|
||||
part
|
||||
{
|
||||
name: "entice.zoomout";
|
||||
type: SWALLOW;
|
||||
clip_to: fader;
|
||||
scale: 1;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
fixed: 1 1;
|
||||
rel.to: "entice.zoomval";
|
||||
rel1.relative: 0.0 0.0;
|
||||
rel1.offset: -1 0;
|
||||
rel2.relative: 0.0 1.0;
|
||||
rel2.offset: -1 -1;
|
||||
min: ICON_SIZE ICON_SIZE;
|
||||
align: 1.0 1.0;
|
||||
offscale;
|
||||
}
|
||||
description { state: "disable" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 0;
|
||||
}
|
||||
}
|
||||
program { signal: "mouse,clicked,1"; source: "entice.zoomout";
|
||||
action: SIGNAL_EMIT "image,action,zoomout" "entice";
|
||||
}
|
||||
|
||||
// entry
|
||||
part
|
||||
{
|
||||
name: "entice.zoomval";
|
||||
type: SWALLOW;
|
||||
clip_to: fader;
|
||||
scale: 1;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
fixed: 1 1;
|
||||
rel.to: "entice.zoomin";
|
||||
rel1.relative: 0.0 0.0;
|
||||
rel1.offset: -1 0;
|
||||
rel2.relative: 0.0 1.0;
|
||||
rel2.offset: -1 -1;
|
||||
align: 1.0 1.0;
|
||||
offscale;
|
||||
}
|
||||
description { state: "disable" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 0;
|
||||
}
|
||||
}
|
||||
program { signal: "mouse,clicked,1"; source: "entice.zoomval";
|
||||
action: SIGNAL_EMIT "image,action,zoomval" "entice";
|
||||
}
|
||||
|
||||
// Zoom in icon
|
||||
part
|
||||
{
|
||||
name: "entice.zoomin";
|
||||
type: SWALLOW;
|
||||
clip_to: fader;
|
||||
scale: 1;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
fixed: 1 1;
|
||||
rel.to: "entice.rotleft";
|
||||
rel1.relative: 0.0 0.0;
|
||||
rel1.offset: -9 0;
|
||||
rel2.relative: 0.0 1.0;
|
||||
rel2.offset: -9 -1;
|
||||
min: ICON_SIZE ICON_SIZE;
|
||||
align: 1.0 1.0;
|
||||
offscale;
|
||||
}
|
||||
description { state: "disable" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 0;
|
||||
}
|
||||
}
|
||||
program { signal: "mouse,clicked,1"; source: "entice.zoomin";
|
||||
action: SIGNAL_EMIT "image,action,zoomin" "entice";
|
||||
}
|
||||
|
||||
// Rotate left icon
|
||||
part
|
||||
{
|
||||
name: "entice.rotleft";
|
||||
type: SWALLOW;
|
||||
clip_to: fader;
|
||||
scale: 1;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
fixed: 1 1;
|
||||
rel.to: "entice.rotright";
|
||||
rel1.relative: 0.0 0.0;
|
||||
rel1.offset: -1 0;
|
||||
rel2.relative: 0.0 1.0;
|
||||
rel2.offset: -1 -1;
|
||||
min: ICON_SIZE ICON_SIZE;
|
||||
align: 1.0 1.0;
|
||||
offscale;
|
||||
}
|
||||
description { state: "disable" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 0;
|
||||
}
|
||||
}
|
||||
program { signal: "mouse,clicked,1"; source: "entice.rotleft";
|
||||
action: SIGNAL_EMIT "image,action,rotleft" "entice";
|
||||
}
|
||||
|
||||
// Rotate right icon
|
||||
part
|
||||
{
|
||||
name: "entice.rotright";
|
||||
type: SWALLOW;
|
||||
clip_to: fader;
|
||||
scale: 1;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
fixed: 1 1;
|
||||
rel.to: "entice.prev";
|
||||
rel1.relative: 0.0 0.0;
|
||||
rel1.offset: -9 0;
|
||||
rel2.relative: 0.0 1.0;
|
||||
rel2.offset: -9 -1;
|
||||
min: ICON_SIZE ICON_SIZE;
|
||||
align: 1.0 1.0;
|
||||
offscale;
|
||||
}
|
||||
description { state: "disable" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 0;
|
||||
}
|
||||
}
|
||||
program { signal: "mouse,clicked,1"; source: "entice.rotright";
|
||||
action: SIGNAL_EMIT "image,action,rotright" "entice";
|
||||
}
|
||||
|
||||
// Prev icon
|
||||
part
|
||||
{
|
||||
name: "entice.prev";
|
||||
type: SWALLOW;
|
||||
clip_to: fader;
|
||||
scale: 1;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
fixed: 1 1;
|
||||
rel.to: "entice.next";
|
||||
rel1.relative: 0.0 0.0;
|
||||
rel1.offset: -1 0;
|
||||
rel2.relative: 0.0 1.0;
|
||||
rel2.offset: -1 -1;
|
||||
min: ICON_SIZE ICON_SIZE;
|
||||
align: 1.0 1.0;
|
||||
offscale;
|
||||
}
|
||||
description { state: "disable" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 0;
|
||||
}
|
||||
}
|
||||
program { signal: "mouse,clicked,1"; source: "entice.prev";
|
||||
action: SIGNAL_EMIT "image,action,prev" "entice";
|
||||
}
|
||||
|
||||
// Next icon
|
||||
ICON_PART("next", 0)
|
||||
part
|
||||
{
|
||||
name: "entice.next";
|
||||
type: SWALLOW;
|
||||
clip_to: fader;
|
||||
scale: 1;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
fixed: 1 1;
|
||||
rel1.relative: 1.0 1.0;
|
||||
rel1.offset: -GB_PAD -GB_PAD;
|
||||
rel2.relative: 1.0 1.0;
|
||||
rel2.offset: -GB_PAD -GB_PAD;
|
||||
min: ICON_SIZE ICON_SIZE;
|
||||
align: 1.0 1.0;
|
||||
offscale;
|
||||
}
|
||||
description { state: "disable" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 0;
|
||||
}
|
||||
}
|
||||
program { signal: "mouse,clicked,1"; source: "entice.next";
|
||||
action: SIGNAL_EMIT "image,action,next" "entice";
|
||||
}
|
||||
|
||||
// Previous icon: padding of 8
|
||||
ICON_PART("prev", 24)
|
||||
|
||||
// Rotate right icon: padding of 24
|
||||
ICON_PART("rotright", 64)
|
||||
|
||||
// Rotate left icon: padding of 8
|
||||
ICON_PART("rotleft", 88)
|
||||
// event RECT to forbid fade away
|
||||
part { name: "fadenext"; type: RECT;
|
||||
mouse_events: 1;
|
||||
repeat_events: 1;
|
||||
description { state: "default" 0.0;
|
||||
rel.to: "entice.next";
|
||||
rel1.offset: -2 -2;
|
||||
rel2.offset: 2 2;
|
||||
visible: 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Settings icon
|
||||
part
|
||||
|
@ -93,10 +360,13 @@ collections
|
|||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
rel1.relative: 1.0 0.0;
|
||||
rel2.relative: 1.0 0.0;
|
||||
rel1.offset: -16 16;
|
||||
rel2.offset: -16 16;
|
||||
fixed: 1 1;
|
||||
rel.to: "entice.fullscreen";
|
||||
rel1.relative: 0.0 0.0;
|
||||
rel1.offset: -1 0;
|
||||
rel2.relative: 0.0 1.0;
|
||||
rel2.offset: -1 -1;
|
||||
min: ICON_SIZE ICON_SIZE;
|
||||
align: 1.0 0.0;
|
||||
offscale;
|
||||
}
|
||||
|
@ -109,6 +379,64 @@ collections
|
|||
action: SIGNAL_EMIT "image,action,settings" "entice";
|
||||
}
|
||||
|
||||
// Fullscreen icon
|
||||
part
|
||||
{
|
||||
name: "entice.fullscreen";
|
||||
type: SWALLOW;
|
||||
clip_to: fader;
|
||||
scale: 1;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
fixed: 1 1;
|
||||
rel.to: "entice.close";
|
||||
rel1.relative: 0.0 0.0;
|
||||
rel1.offset: -1 0;
|
||||
rel2.relative: 0.0 1.0;
|
||||
rel2.offset: -1 -1;
|
||||
min: ICON_SIZE ICON_SIZE;
|
||||
align: 1.0 0.0;
|
||||
offscale;
|
||||
}
|
||||
description { state: "disable" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 0;
|
||||
}
|
||||
}
|
||||
program { signal: "mouse,clicked,1"; source: "entice.fullscreen";
|
||||
action: SIGNAL_EMIT "image,action,fullscreen" "entice";
|
||||
}
|
||||
|
||||
|
||||
// Close icon
|
||||
part
|
||||
{
|
||||
name: "entice.close";
|
||||
type: SWALLOW;
|
||||
clip_to: fader;
|
||||
scale: 1;
|
||||
description
|
||||
{
|
||||
state: "default" 0.0;
|
||||
fixed: 1 1;
|
||||
rel1.relative: 1.0 0.0;
|
||||
rel1.offset: -GB_PAD GB_PAD;
|
||||
rel2.relative: 1.0 0.0;
|
||||
rel2.offset: -GB_PAD GB_PAD;
|
||||
min: ICON_SIZE ICON_SIZE;
|
||||
align: 1.0 0.0;
|
||||
offscale;
|
||||
}
|
||||
description { state: "disable" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 0;
|
||||
}
|
||||
}
|
||||
program { signal: "mouse,clicked,1"; source: "entice.close";
|
||||
action: SIGNAL_EMIT "image,action,close" "entice";
|
||||
}
|
||||
|
||||
// Fader rectangle
|
||||
part { name: "fader"; type: RECT;
|
||||
mouse_events: 0;
|
||||
|
|
|
@ -101,6 +101,62 @@ _cb_image_rotright(void *win, Evas_Object *obj EINA_UNUSED, const char *emission
|
|||
entice_image_rotate(entice->image, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_image_zoomin(void *win, Evas_Object *obj EINA_UNUSED, const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
|
||||
{
|
||||
Entice *entice;
|
||||
|
||||
entice = evas_object_data_get(win, "entice");
|
||||
//entice_image_rotate(entice->image, 1);
|
||||
printf("zoom in \n");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_image_zoomout(void *win, Evas_Object *obj EINA_UNUSED, const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
|
||||
{
|
||||
Entice *entice;
|
||||
|
||||
entice = evas_object_data_get(win, "entice");
|
||||
//entice_image_rotate(entice->image, 1);
|
||||
printf("zoom out \n");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_image_zoomorig(void *win, Evas_Object *obj EINA_UNUSED, const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
|
||||
{
|
||||
Entice *entice;
|
||||
|
||||
entice = evas_object_data_get(win, "entice");
|
||||
//entice_image_rotate(entice->image, 1);
|
||||
printf("zoom 1:1 \n");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_image_zoomfit(void *win, Evas_Object *obj EINA_UNUSED, const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
|
||||
{
|
||||
Entice *entice;
|
||||
|
||||
entice = evas_object_data_get(win, "entice");
|
||||
//entice_image_rotate(entice->image, 1);
|
||||
printf("zoom fit \n");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_image_close(void *win, Evas_Object *obj EINA_UNUSED, const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
|
||||
{
|
||||
evas_object_del(win);
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_image_fullscreen(void *win, Evas_Object *obj EINA_UNUSED, const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
|
||||
{
|
||||
elm_win_fullscreen_set(win, !elm_win_fullscreen_get(win));
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_image_settings(void *win, Evas_Object *obj EINA_UNUSED, const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
|
||||
{
|
||||
|
@ -132,9 +188,35 @@ entice_controls_init(Evas_Object *win)
|
|||
|
||||
entice = evas_object_data_get(win, "entice");
|
||||
|
||||
CONTROLS("go-previous", prev);
|
||||
CONTROLS("go-next", next);
|
||||
CONTROLS("zoom-fit-best", zoomfit);
|
||||
CONTROLS("zoom-original", zoomorig);
|
||||
CONTROLS("zoom-out", zoomout);
|
||||
CONTROLS("zoom-in", zoomin);
|
||||
CONTROLS("object-rotate-left", rotleft);
|
||||
CONTROLS("object-rotate-right", rotright);
|
||||
CONTROLS("go-previous", prev);
|
||||
CONTROLS("go-next", next);
|
||||
|
||||
o = elm_check_add(win);
|
||||
elm_object_style_set(o, "default");
|
||||
evas_object_show(o);
|
||||
entice->zoomcheck = o;
|
||||
|
||||
elm_object_part_content_set(entice->layout, "entice.zoomcheck", entice->zoomcheck);
|
||||
|
||||
/* zoom entry */
|
||||
o = elm_entry_add(win);
|
||||
elm_scroller_policy_set(o, ELM_SCROLLER_POLICY_OFF,
|
||||
ELM_SCROLLER_POLICY_OFF);
|
||||
elm_object_text_set(o, "2000%");
|
||||
elm_entry_single_line_set(o, EINA_TRUE);
|
||||
//evas_object_smart_callback_add(o, "activated", _entry_activated_cb, NULL);
|
||||
evas_object_show(o);
|
||||
entice->zoomval = o;
|
||||
|
||||
elm_object_part_content_set(entice->layout, "entice.zoomval", entice->zoomval);
|
||||
|
||||
CONTROLS("preferences-system", settings);
|
||||
CONTROLS("view-fullscreen", fullscreen);
|
||||
CONTROLS("window-close", close);
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ struct Img_
|
|||
int fr;
|
||||
int fr_num;
|
||||
int loops;
|
||||
Eina_Bool is_fit;
|
||||
};
|
||||
|
||||
static Evas_Smart *_smart = NULL;
|
||||
|
@ -391,6 +392,8 @@ entice_image_zoom(Evas_Object *obj, double zoom)
|
|||
|
||||
elm_scroller_policy_set(entice->scroller,
|
||||
ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_AUTO);
|
||||
|
||||
sd->is_fit = EINA_FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -410,6 +413,9 @@ entice_image_zoom_fit(Evas_Object *obj)
|
|||
sd = evas_object_smart_data_get(obj);
|
||||
EINA_SAFETY_ON_NULL_RETURN(sd);
|
||||
|
||||
if (sd->is_fit)
|
||||
return;
|
||||
|
||||
win = evas_object_data_get(obj, "win");
|
||||
EINA_SAFETY_ON_NULL_RETURN(win);
|
||||
|
||||
|
@ -446,4 +452,6 @@ entice_image_zoom_fit(Evas_Object *obj)
|
|||
|
||||
elm_scroller_policy_set(entice->scroller,
|
||||
ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF);
|
||||
|
||||
sd->is_fit = EINA_TRUE;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,15 @@ struct Entice
|
|||
Evas_Object *next; /* next image */
|
||||
Evas_Object *rotleft; /* rotate left (counter clock) */
|
||||
Evas_Object *rotright; /* rotate right (clock) */
|
||||
Evas_Object *settings;
|
||||
Evas_Object *zoomin; /* zoom in */
|
||||
Evas_Object *zoomval; /* entry fo zoom value */
|
||||
Evas_Object *zoomout; /* zoom out */
|
||||
Evas_Object *zoomorig; /* zoom 1:1 */
|
||||
Evas_Object *zoomfit; /* zoom best fit */
|
||||
Evas_Object *zoomcheck; /* checkbox for zoom best fit */
|
||||
Evas_Object *settings; /* settings icon */
|
||||
Evas_Object *fullscreen;/* fullscreen icon */
|
||||
Evas_Object *close; /* close icon */
|
||||
Ecore_Timer *controls_timer;
|
||||
Ecore_Timer *settings_timer;
|
||||
Eina_Bool settings_created;
|
||||
|
|
Loading…
Reference in New Issue