#define SLIDER_HEIGHT_ADJUSTMENT 9
#define SLIDER_LAYOUT_WIDTH ELM_SCALE_SIZE(VOLUME_BRIGHTNESS_SLIDER_LAYOUT_W)
#define SLIDER_LAYOUT_HEIGHT ELM_SCALE_SIZE(VOLUME_BRIGHTNESS_SLIDER_LAYOUT_H)
+#define SLIDER_HEIGHT 32
+
typedef struct _brightness_ctrl_obj {
Evas_Coord w, h;
Efl_VG *shape = data;
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
- double radius = w > h ? h/2.0 : w/2.0;
+ double radius = 0.0;
+ int x = 0, y = 0;
+ if(w<=16)
+ {
+ /* We need to calculate the height of slider curve based on width and radius
+ * we are considering radius of curve 16px and based on width we calculate half size of chords in curve.
+ */
+ radius = ((double)SLIDER_HEIGHT)/ 2.0;
+ int h_new = 2*(sqrt(256-((16-w)*(16-w))));
+ y = (SLIDER_HEIGHT-h_new)/2;
+ h = h_new;
+ } else {
+ //radius = w > h ? h/2.0 : w/2.0;
+ radius = ((double)SLIDER_HEIGHT)/ 2.0;
+ }
evas_vg_shape_reset(shape);
- evas_vg_shape_append_rect(shape, 0, 0, w, h, radius, radius);
+ evas_vg_shape_append_rect(shape, x, y, w, h, radius, radius);
}
static Evas_Object* _slider_vg_object_create(Evas_Object *parent, int r, int g, int b, int a)
#include <app_control.h>
#include <tzsh.h>
#include <tzsh_quickpanel_service.h>
+#include <math.h>
#include "common.h"
#include "volume.h"
#define SLIDER_HEIGHT_ADJUSTMENT 9
#define SLIDER_LAYOUT_WIDTH ELM_SCALE_SIZE(VOLUME_BRIGHTNESS_SLIDER_LAYOUT_W)
#define SLIDER_LAYOUT_HEIGHT ELM_SCALE_SIZE(VOLUME_BRIGHTNESS_SLIDER_LAYOUT_H)
+#define SLIDER_HEIGHT 32
+
+#define SLIDER_1_COMPARE 1.000001
+#define SLIDER_9_COMPARE 9.000001
+
#define VCONF_KEY_MUTE_TYPE_SYSTEM VCONF_KEY_MUTE_PREFIX"/system"
static void _volume_register_event_cb(volume_ctrl_obj *ctrl_obj);
static void _volume_deregister_event_cb(volume_ctrl_obj *ctrl_obj);
-static void _volume_set_image(int level);
+static void _volume_set_image(double level);
static void _refresh(void *data);
QP_Module volume_ctrl = {
DBG("*** val == %lf ***",val);
value = (int)(val + 0.5);
DBG("*** value == %d ***",value);
- _volume_set_image(value);
+ _volume_set_image(val);
volume_sound_change_set(value);
}
double val = 0;
val = elm_slider_value_get(slider);
- val += 0.5;
- DBG("**** slider value : %d ***", (int)val);
+ DBG("**** slider value : %f ***", val);
+ int value = (int)(val + 0.5);
_volume_set_image(val);
- volume_sound_change_set((int)val);
+ volume_sound_change_set(value);
}
/*!
return view_wrapper;
}
-static void _volume_set_image(int level)
+static void _volume_set_image(double level)
{
int mapped_level;
DBG("******_volume_set_image level = %d *********",level);
ERR("Ctrl Obj is not defined");
return;
}
- if (level <= 1)
+
+ if (level < SLIDER_1_COMPARE)
mapped_level = 0;
- else if (level > 1 && level <= 9)
+ else if (level > SLIDER_1_COMPARE && level <= SLIDER_9_COMPARE)
mapped_level = 1;
else
Evas_Coord w, h;
Efl_VG *shape = data;
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
- double radius = w > h ? h/2.0 : w/2.0;
+ double radius = 0.0;
+ int x = 0, y = 0;
+ if(w<=16)
+ {
+ /* We need to calculate the height of slider curve based on width and radius
+ * we are considering radius of curve 16px and based on width we calculate half size of chords in curve.
+ */
+ radius = ((double)SLIDER_HEIGHT)/ 2.0;
+ int h_new = 2*(sqrt(256-((16-w)*(16-w))));
+ y = (SLIDER_HEIGHT-h_new)/2;
+ h = h_new;
+ } else {
+ //radius = w > h ? h/2.0 : w/2.0;
+ radius = ((double)SLIDER_HEIGHT)/ 2.0;
+ }
evas_vg_shape_reset(shape);
- evas_vg_shape_append_rect(shape, 0, 0, w, h, radius, radius);
+ evas_vg_shape_append_rect(shape, x, y, w, h, radius, radius);
}
static Evas_Object* _slider_vg_object_create(Evas_Object *parent, int r, int g, int b, int a)