summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehwan Kim <jae.hwan.kim@samsung.com>2014-09-19 13:45:03 +0900
committerJaehwan Kim <jae.hwan.kim@samsung.com>2014-09-19 13:46:23 +0900
commitf75b121f6428cf6aea7387d8700a887e6ca4a98a (patch)
tree55313dfa2b1bfd0aa7786de7a1927cb6e388c28e
parent343dce1e58fef96eecc1700a5bf573a62b46e517 (diff)
scale: set the base scale of the application.
The scale is used for the application to be scaled. If the application isn't made on the basis of scale 1.0, the application layout will be scaled inappositely. So if the application set the base scale, it is applied when the application is scaled.
-rw-r--r--src/lib/elm_app.h27
-rw-r--r--src/lib/elm_macros.h1
-rw-r--r--src/lib/elm_main.c15
3 files changed, 43 insertions, 0 deletions
diff --git a/src/lib/elm_app.h b/src/lib/elm_app.h
index f08fd1b40..df2a37c96 100644
--- a/src/lib/elm_app.h
+++ b/src/lib/elm_app.h
@@ -266,5 +266,32 @@ EAPI const char *elm_app_data_dir_get(void);
266EAPI const char *elm_app_locale_dir_get(void); 266EAPI const char *elm_app_locale_dir_get(void);
267 267
268/** 268/**
269 * Set the base scale of the application.
270 *
271 * @param base_scale The scale that the application is made on the basis of.
272 *
273 * @note The scale is used for the application to be scaled.
274 * If the application isn't made on the basis of scale 1.0,
275 * the application layout will be scaled inappositely. So if the application set
276 * the base scale, it is applied when the application is scaled.
277 *
278 * @note You should call this function @b before using ELM_SCALE_SIZE macro.
279 *
280 * @ingroup App
281 * @since 1.12
282 */
283EAPI void elm_app_base_scale_set(double base_scale);
284
285/**
286 * Get the base scale of the application.
287 *
288 * @return The base scale which the application sets.
289 *
290 * @ingroup App
291 * @since 1.12
292 */
293EAPI double elm_app_base_scale_get(void);
294
295/**
269 * @} 296 * @}
270 */ 297 */
diff --git a/src/lib/elm_macros.h b/src/lib/elm_macros.h
index c25e95639..05403aef0 100644
--- a/src/lib/elm_macros.h
+++ b/src/lib/elm_macros.h
@@ -1,6 +1,7 @@
1/* handy macros */ 1/* handy macros */
2#define ELM_RECTS_INTERSECT(x, y, w, h, xx, yy, ww, hh) (((x) < ((xx) + (ww))) && ((y) < ((yy) + (hh))) && (((x) + (w)) > (xx)) && (((y) + (h)) > (yy))) 2#define ELM_RECTS_INTERSECT(x, y, w, h, xx, yy, ww, hh) (((x) < ((xx) + (ww))) && ((y) < ((yy) + (hh))) && (((x) + (w)) > (xx)) && (((y) + (h)) > (yy)))
3#define ELM_PI 3.14159265358979323846 3#define ELM_PI 3.14159265358979323846
4#define ELM_SCALE_SIZE(x) x / elm_app_base_scale_get() * elm_config_scale_get()
4 5
5// checks if the point(xx, yy) stays out of the rectangle(x, y, w, h) area. 6// checks if the point(xx, yy) stays out of the rectangle(x, y, w, h) area.
6#define ELM_RECTS_POINT_OUT(x, y, w, h, xx, yy) (((xx) < (x)) || ((yy) < (y)) || ((xx) > ((x) + (w))) || ((yy) > ((y) + (h)))) 7#define ELM_RECTS_POINT_OUT(x, y, w, h, xx, yy) (((xx) < (x)) || ((yy) < (y)) || ((xx) > ((x) + (w))) || ((yy) > ((y) + (h))))
diff --git a/src/lib/elm_main.c b/src/lib/elm_main.c
index 19779946b..9fabd4357 100644
--- a/src/lib/elm_main.c
+++ b/src/lib/elm_main.c
@@ -127,6 +127,7 @@ static const char *app_bin_dir = NULL;
127static const char *app_lib_dir = NULL; 127static const char *app_lib_dir = NULL;
128static const char *app_data_dir = NULL; 128static const char *app_data_dir = NULL;
129static const char *app_locale_dir = NULL; 129static const char *app_locale_dir = NULL;
130static double app_base_scale = 1.0;
130 131
131static Eina_Prefix *app_pfx = NULL; 132static Eina_Prefix *app_pfx = NULL;
132 133
@@ -457,6 +458,20 @@ elm_app_locale_dir_get(void)
457 return app_locale_dir; 458 return app_locale_dir;
458} 459}
459 460
461EAPI void
462elm_app_base_scale_set(double base_scale)
463{
464 if (base_scale <= 0.0) return;
465 app_base_scale = base_scale;
466}
467
468EAPI double
469elm_app_base_scale_get(void)
470{
471 if (app_base_scale) return app_base_scale;
472 return 1.0;
473}
474
460static Eina_Bool _elm_need_e_dbus = EINA_FALSE; 475static Eina_Bool _elm_need_e_dbus = EINA_FALSE;
461static void *e_dbus_handle = NULL; 476static void *e_dbus_handle = NULL;
462 477