aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/default/e.src2
-rw-r--r--config/mobile/e.src6
-rw-r--r--config/standard/e.src2
-rw-r--r--src/modules/conf_theme/e_int_config_scale.c182
4 files changed, 153 insertions, 39 deletions
diff --git a/config/default/e.src b/config/default/e.src
index c04afc07c..d78889a58 100644
--- a/config/default/e.src
+++ b/config/default/e.src
@@ -492,7 +492,7 @@ group "E_Config" struct {
value "border_keyboard.resize.dx" uchar: 5;
value "border_keyboard.resize.dy" uchar: 5;
value "dbus_desktop" int: 1;
- value "scale.min" double: 1.0;
+ value "scale.min" double: 0.8;
value "scale.max" double: 3.0;
value "scale.factor" double: 1.0;
value "scale.base_dpi" int: 90;
diff --git a/config/mobile/e.src b/config/mobile/e.src
index 6f791e95f..42875bf70 100644
--- a/config/mobile/e.src
+++ b/config/mobile/e.src
@@ -178,9 +178,9 @@ group "E_Config" struct {
value "border_keyboard.move.dy" uchar: 5;
value "border_keyboard.resize.dx" uchar: 5;
value "border_keyboard.resize.dy" uchar: 5;
- value "scale.min" double: 1.0000000000000000000000000;
- value "scale.max" double: 3.0000000000000000000000000;
- value "scale.factor" double: 1.0000000000000000000000000;
+ value "scale.min" double: 0.8;
+ value "scale.max" double: 3.0;
+ value "scale.factor" double: 1.0;
value "scale.base_dpi" int: 90;
value "scale.use_dpi" uchar: 1;
value "scale.use_custom" uchar: 0;
diff --git a/config/standard/e.src b/config/standard/e.src
index 6fdcc1461..d8c067239 100644
--- a/config/standard/e.src
+++ b/config/standard/e.src
@@ -167,7 +167,7 @@ group "E_Config" struct {
value "thumbscroll_threshhold" int: 8;
value "thumbscroll_momentum_threshhold" double: 100.0;
value "thumbscroll_friction" double: 1.0;
- value "scale.min" double: 1.0;
+ value "scale.min" double: 0.8;
value "scale.max" double: 3.0;
value "scale.factor" double: 1.0;
value "scale.base_dpi" int: 90;
diff --git a/src/modules/conf_theme/e_int_config_scale.c b/src/modules/conf_theme/e_int_config_scale.c
index cb5db44bb..821c73e68 100644
--- a/src/modules/conf_theme/e_int_config_scale.c
+++ b/src/modules/conf_theme/e_int_config_scale.c
@@ -7,7 +7,6 @@ static void _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_
static Evas_Object *_basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata);
static int _basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata);
static int _basic_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata);
-static void _basic_use_dpi_changed(void *data, Evas_Object *obj __UNUSED__);
static Evas_Object *_adv_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata);
static int _adv_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata);
static int _adv_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata);
@@ -32,8 +31,123 @@ struct _E_Config_Dialog_Data
Evas_Object *max_lbl, *max_slider;
} adv;
} gui;
+ Eina_List *obs;
};
+static void
+_scale_preview_sel_set(Evas_Object *ob, int sel)
+{
+ Evas_Object *rc, *ob2;
+ double *sc, scl;
+ int v;
+ Eina_List *l;
+ E_Config_Dialog_Data *cfdata;
+
+ cfdata = evas_object_data_get(ob, "cfdata");
+ rc = evas_object_data_get(ob, "rec");
+ if (sel)
+ {
+ evas_object_color_set(rc, 0, 0, 0, 0);
+ sc = evas_object_data_get(ob, "scalep");
+ v = (int)(unsigned long)evas_object_data_get(ob, "scale");
+ scl = (double)v / 1000.0;
+ if (sc) *sc = scl;
+ EINA_LIST_FOREACH(cfdata->obs, l, ob2)
+ {
+ if (ob == ob2) continue;
+ _scale_preview_sel_set(ob2, 0);
+ }
+ if (evas_object_data_get(ob, "dpi"))
+ cfdata->use_dpi = EINA_TRUE;
+ else
+ cfdata->use_dpi = EINA_FALSE;
+ }
+ else evas_object_color_set(rc, 0, 0, 0, 192);
+}
+
+static void
+_scale_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
+{
+ Evas_Object *ob = data;
+
+ _scale_preview_sel_set(ob, 1);
+}
+
+static Evas_Object *
+_scale_preview_new(E_Config_Dialog_Data *cfdata, Evas *e, double sc, double *scp, const char *tit, Eina_Bool dpi)
+{
+ Evas_Object *ob, *bg, *cm, *bd, *wb, *rc;
+ const char *file;
+ char buf[64];
+ int v;
+
+#define SZW 110
+#define SZH 80
+ ob = e_widget_preview_add(e, SZW, SZH);
+ e_widget_preview_vsize_set(ob, SZW, SZH);
+
+ bg = edje_object_add(e_widget_preview_evas_get(ob));
+ file = e_bg_file_get(0, 0, 0, 0);
+ edje_object_file_set(bg, file, "e/desktop/background");
+ evas_object_move(bg, 0, 0);
+ evas_object_resize(bg, 640, 480);
+ evas_object_show(bg);
+
+ cm = edje_object_add(e_widget_preview_evas_get(ob));
+ e_theme_edje_object_set(cm, "base/theme/borders", "e/comp/default");
+ evas_object_move(cm, 16, 16);
+ evas_object_resize(cm, 320, 400);
+ evas_object_show(cm);
+
+ bd = edje_object_add(e_widget_preview_evas_get(ob));
+ e_theme_edje_object_set(bd, "base/theme/borders", "e/widgets/border/default/border");
+ edje_object_part_swallow(cm, "e.swallow.content", bd);
+ evas_object_show(bd);
+
+ wb = edje_object_add(e_widget_preview_evas_get(ob));
+ e_theme_edje_object_set(wb, "base/theme/dialog", "e/widgets/dialog/main");
+ edje_object_part_swallow(bd, "e.swallow.client", wb);
+ evas_object_show(wb);
+
+ rc = evas_object_rectangle_add(e_widget_preview_evas_get(ob));
+ evas_object_move(rc, 0, 0);
+ evas_object_resize(rc, 640, 480);
+ evas_object_color_set(rc, 0, 0, 0, 192);
+ evas_object_show(rc);
+
+ if (!tit)
+ {
+ snprintf(buf, sizeof(buf), "%1.1f %s", sc, _("Factor"));
+ edje_object_part_text_set(bd, "e.text.title", buf);
+ }
+ else
+ edje_object_part_text_set(bd, "e.text.title", tit);
+ edje_object_signal_emit(bd, "e,state,focused", "e");
+
+ edje_object_signal_emit(cm, "e,state,visible,on", "e");
+ edje_object_signal_emit(cm, "e,state,shadow,on", "e");
+ edje_object_signal_emit(cm, "e,state,focus,on", "e");
+
+ edje_object_scale_set(bd, sc);
+ edje_object_scale_set(cm, sc);
+ edje_object_scale_set(bg, sc);
+ edje_object_scale_set(wb, sc);
+
+ evas_object_data_set(ob, "rec", rc);
+ v = sc * 1000;
+ evas_object_data_set(ob, "scale", (void *)(unsigned long)v);
+ evas_object_data_set(ob, "scalep", scp);
+ evas_object_data_set(ob, "dpi", (void *)(unsigned long)dpi);
+ evas_object_data_set(ob, "cfdata", cfdata);
+
+ evas_object_event_callback_add(rc,
+ EVAS_CALLBACK_MOUSE_DOWN,
+ _scale_down, ob);
+ cfdata->obs = eina_list_append(cfdata->obs, ob);
+
+ return ob;
+}
+
E_Config_Dialog *
e_int_config_scale(E_Container *con, const char *params __UNUSED__)
{
@@ -86,35 +200,45 @@ _fill_data(E_Config_Dialog_Data *cfdata)
static void
_free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
{
+ eina_list_free(cfdata->obs);
E_FREE(cfdata);
}
static Evas_Object *
_basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata)
{
- Evas_Object *o, *of, *ow;
- char buff[256];
-
- o = e_widget_list_add(evas, 0, 0);
-
- ow = e_widget_check_add(evas, _("Scale with DPI"), &(cfdata->use_dpi));
- e_widget_on_change_hook_set(ow, _basic_use_dpi_changed, cfdata);
- e_widget_list_object_append(o, ow, 1, 0, 0.5);
-
- of = e_widget_framelist_add(evas, _("Relative"), 0);
- ow = e_widget_label_add(evas, _("Base DPI to scale relative to"));
- cfdata->gui.basic.o_lbl = ow;
- e_widget_framelist_object_append(of, ow);
- ow = e_widget_slider_add(evas, 1, 0, _("%1.0f DPI"), 30, 600, 1, 0,
- NULL, &(cfdata->base_dpi), 100);
- cfdata->gui.basic.o_slider = ow;
- e_widget_framelist_object_append(of, ow);
- snprintf(buff, sizeof(buff), _("Currently %i DPI"), ecore_x_dpi_get());
- ow = e_widget_label_add(evas, buff);
- e_widget_framelist_object_append(of, ow);
- e_widget_list_object_append(o, of, 1, 0, 0.5);
-
- _basic_use_dpi_changed(cfdata, NULL);
+ Evas_Object *o, *ob;
+ double sc = 1.0;
+ int dpi, x = 0, y = 0;
+
+ o = e_widget_table_add(evas, 1);
+
+ dpi = ecore_x_dpi_get();
+ if ((dpi > 0) && (cfdata->base_dpi > 0))
+ sc = (double)dpi / (double)cfdata->base_dpi;
+
+ ob = _scale_preview_new(cfdata, evas, sc, &(cfdata->factor), _("DPI Scaling"), EINA_TRUE);
+ e_widget_table_object_align_append(o, ob, 0, 0, 1, 1, 0, 0, 0, 0, 0.5, 0.5);
+ if (cfdata->use_dpi) _scale_preview_sel_set(ob, 1);
+
+ x = 1;
+
+#define COL 3
+#define SCALE_OP(v) do { \
+ ob = _scale_preview_new(cfdata, evas, v, &(cfdata->factor), NULL, EINA_FALSE); \
+ e_widget_table_object_align_append(o, ob, x, y, 1, 1, 0, 0, 0, 0, 0.5, 0.5); \
+ if (cfdata->factor == v) _scale_preview_sel_set(ob, 1); \
+ x++; if (x >= COL) { x = 0; y++; } \
+} while (0)
+
+ SCALE_OP(0.8);
+ SCALE_OP(1.0);
+ SCALE_OP(1.2);
+ SCALE_OP(1.5);
+ SCALE_OP(1.7);
+ SCALE_OP(1.9);
+ SCALE_OP(2.0);
+ SCALE_OP(2.2);
return o;
}
@@ -146,16 +270,6 @@ _basic_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
(cfdata->base_dpi != e_config->scale.base_dpi);
}
-static void
-_basic_use_dpi_changed(void *data, Evas_Object *obj __UNUSED__)
-{
- E_Config_Dialog_Data *cfdata;
-
- if (!(cfdata = data)) return;
- e_widget_disabled_set(cfdata->gui.basic.o_lbl, !cfdata->use_dpi);
- e_widget_disabled_set(cfdata->gui.basic.o_slider, !cfdata->use_dpi);
-}
-
static Evas_Object *
_adv_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data *cfdata)
{