This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository entice.
View the commit online.
commit ae2819ea203a946be932fd4b14f75494ba314c04
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
AuthorDate: Sat May 17 10:22:43 2025 +0100
add smooth scale option + keyboard controlled zooms
smooth scale toggled by 0 key, and 1-8 now zoom in 1x 2x ...7x 8x and
shift +1,2,3///8 zoom oout to 1/1x, 1/2x, 1/3x ... 1/8x etc.
---
data/themes/default.edc | 26 ++++++++++++++++++++++++++
src/bin/entice_controls.c | 17 +++++++++++++++++
src/bin/entice_image.c | 39 +++++++++++++++++++++++++++++++--------
src/bin/entice_image.h | 4 ++++
src/bin/entice_key.c | 36 ++++++++++++++++++++++++++++++++++++
src/bin/entice_win.h | 1 +
6 files changed, 115 insertions(+), 8 deletions(-)
diff --git a/data/themes/default.edc b/data/themes/default.edc
index 711bcb0..625e9e7 100644
--- a/data/themes/default.edc
+++ b/data/themes/default.edc
@@ -217,6 +217,32 @@ collections
// CONTROLS
+ // Smooth icon
+ part
+ {
+ name: "entice.smooth";
+ 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 0.5;
+ offscale;
+ }
+ description { state: "disable" 0.0;
+ inherit: "default" 0.0;
+ visible: 0;
+ }
+ }
+
// Zoom out icon
part
{
diff --git a/src/bin/entice_controls.c b/src/bin/entice_controls.c
index c85652c..954eff2 100644
--- a/src/bin/entice_controls.c
+++ b/src/bin/entice_controls.c
@@ -44,6 +44,21 @@
"image,stopfade," #_action, "entice", \
_entice_ctrl_stopfade_cb, win)
+static void
+_entice_ctrl_smooth_cb(void *win, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ Entice *entice;
+ Eina_Bool smooth;
+
+ INF(" * %s", __FUNCTION__);
+
+ entice = evas_object_data_get(win, "entice");
+ smooth = entice_image_smooth_get(entice->image);
+ if (smooth) smooth = EINA_FALSE;
+ else smooth = EINA_TRUE;
+ entice_image_smooth_set(entice->image, smooth);
+}
+
static void
_entice_ctrl_zoomout_cb(void *win, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
@@ -395,6 +410,8 @@ entice_controls_init(Evas_Object *win)
// initial invalid zoom so we set up ui zoom representation right
entice->zoom = -999;
+ CONTROLS("preferences-scale", smooth);
+
CONTROLS("zoom-out", zoomout);
CONTROLS("zoom-in", zoomin);
CONTROLS("object-rotate-left", rotleft);
diff --git a/src/bin/entice_image.c b/src/bin/entice_image.c
index dfd2114..554497a 100644
--- a/src/bin/entice_image.c
+++ b/src/bin/entice_image.c
@@ -30,7 +30,8 @@ struct Img_
int frame_count;
int loops;
- unsigned int loading: 1;
+ Eina_Bool loading: 1;
+ Eina_Bool smooth : 1;
};
static Evas_Smart *_smart = NULL;
@@ -151,7 +152,7 @@ _entice_image_preloaded(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_U
if ((img_w > 0) && (img_h > 0))
evas_object_show(sd->img);
- sd->loading = 0;
+ sd->loading = EINA_FALSE;
entice_image_update(data);
entice = evas_object_data_get(data, "entice");
@@ -174,13 +175,15 @@ _smart_add(Evas_Object *obj)
_parent_sc.add(obj);
+ sd->zoom_mode = ENTICE_ZOOM_MODE_NORMAL;
+ sd->zoom = 100;
+ sd->smooth = EINA_TRUE;
+
sd->img = evas_object_image_filled_add(evas_object_evas_get(obj));
evas_object_smart_member_add(sd->img, obj);
evas_object_event_callback_add(sd->img, EVAS_CALLBACK_IMAGE_PRELOADED,
_entice_image_preloaded, obj);
-
- sd->zoom_mode = ENTICE_ZOOM_MODE_NORMAL;
- sd->zoom = 100;
+ evas_object_image_smooth_scale_set(sd->img, sd->smooth);
}
static void
@@ -417,7 +420,7 @@ entice_image_file_set(Evas_Object *obj, Eina_List *image)
sd->timer_anim = NULL;
sd->frame = 0;
sd->frame_count = 0;
- sd->loading = 0;
+ sd->loading = EINA_FALSE;
evas_object_hide(sd->img);
evas_object_image_file_set(sd->img, NULL, NULL);
@@ -440,7 +443,7 @@ entice_image_file_set(Evas_Object *obj, Eina_List *image)
return;
}
- sd->loading = 1;
+ sd->loading = EINA_TRUE;
evas_object_image_preload(sd->img, EINA_FALSE);
if (entice->config->best_fit_startup)
@@ -493,7 +496,7 @@ entice_image_memory_set(Evas_Object *obj, unsigned int *img, size_t size)
sd->timer_anim = NULL;
sd->frame = 0;
sd->frame_count = 0;
- sd->loading = 0;
+ sd->loading = EINA_FALSE;
}
void
@@ -548,6 +551,26 @@ entice_image_zoom_mode_get(Evas_Object *obj)
return sd->zoom_mode;
}
+void entice_image_smooth_set(Evas_Object *obj, Eina_Bool smooth)
+{
+ Img *sd;
+
+ sd = evas_object_smart_data_get(obj);
+ EINA_SAFETY_ON_NULL_RETURN(sd);
+ if (sd->smooth == smooth) return;
+ sd->smooth = smooth;
+ evas_object_image_smooth_scale_set(sd->img, sd->smooth);
+}
+
+Eina_Bool entice_image_smooth_get(Evas_Object *obj)
+{
+ Img *sd;
+
+ sd = evas_object_smart_data_get(obj);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(sd, EINA_FALSE);
+ return sd->smooth;
+}
+
void entice_image_zoom_set(Evas_Object *obj, int zoom)
{
Img *sd;
diff --git a/src/bin/entice_image.h b/src/bin/entice_image.h
index 35f6617..02f0893 100644
--- a/src/bin/entice_image.h
+++ b/src/bin/entice_image.h
@@ -27,6 +27,10 @@ void entice_image_zoom_mode_set(Evas_Object *obj, Entice_Zoom_Mode zoom_mode);
Entice_Zoom_Mode entice_image_zoom_mode_get(Evas_Object *obj);
+void entice_image_smooth_set(Evas_Object *obj, Eina_Bool smooth);
+
+Eina_Bool entice_image_smooth_get(Evas_Object *obj);
+
void entice_image_zoom_set(Evas_Object *obj, int zoom);
int entice_image_zoom_get(Evas_Object *obj);
diff --git a/src/bin/entice_key.c b/src/bin/entice_key.c
index 57381c1..7e951b8 100644
--- a/src/bin/entice_key.c
+++ b/src/bin/entice_key.c
@@ -155,6 +155,25 @@ void entice_key_handle(Evas_Object *win, Evas_Event_Key_Down *ev)
{
elm_layout_signal_emit(entice->layout, "state,winlist,show", "entice");
}
+ else if (!strcmp(ev->keyname, "0"))
+ {
+ Eina_Bool smooth;
+
+ smooth = entice_image_smooth_get(entice->image);
+ if (smooth) smooth = EINA_FALSE;
+ else smooth = EINA_TRUE;
+ entice_image_smooth_set(entice->image, smooth);
+ }
+ else if (eina_fnmatch("[1-8]", ev->keyname, 0))
+ {
+ int zoom = atoi(ev->keyname) * 100;
+
+ if (zoom < 100) zoom = 100;
+ else if (zoom > 800) zoom = 800;
+ entice_image_zoom_set(entice->image, zoom);
+ entice_image_update(entice->image);
+ elm_layout_signal_emit(entice->layout, "state,winlist,show", "entice");
+ }
}
/* Control modifier */
@@ -205,4 +224,21 @@ void entice_key_handle(Evas_Object *win, Evas_Event_Key_Down *ev)
entice_image_file_set(entice->image, eina_list_last(entice->images));
}
}
+
+ /* Shift modifier */
+ if (!ctrl && !alt && shift && !winm && !meta && !hyper)
+ {
+ if (eina_fnmatch("[1-8]", ev->keyname, 0))
+ {
+ int zoom = atoi(ev->keyname);
+
+ if ((zoom >= 1) && (zoom <= 8))
+ {
+ zoom = 100 / zoom;
+ entice_image_zoom_set(entice->image, zoom);
+ entice_image_update(entice->image);
+ elm_layout_signal_emit(entice->layout, "state,winlist,show", "entice");
+ }
+ }
+ }
}
diff --git a/src/bin/entice_win.h b/src/bin/entice_win.h
index 95965c9..7848c70 100644
--- a/src/bin/entice_win.h
+++ b/src/bin/entice_win.h
@@ -50,6 +50,7 @@ struct Entice
Evas_Object *zoomin; /* zoom in */
Evas_Object *zoomval; /* button for zoom value */
Evas_Object *zoomout; /* zoom out */
+ Evas_Object *smooth; /* smooth */
Evas_Object *hover_zoom;
Evas_Object *wl_gl; /* winlist genlist */
Elm_Genlist_Item_Class *wl_gl_ic; /* winlist genlist item class */
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.