#include <ui-gadget-module.h>
#include <ui-gadget.h>
-#include <vconf.h>
-#include <vconf-keys.h>
-
#include "image-viewer.h"
#define PACKAGE "image-viewer"
return ECORE_CALLBACK_CANCEL;
}
-static void _orient_changed(app_device_orientation_e orientation, void *user_data);
+
+static void
+_rot_changed_cb(void *data, Evas_Object *obj, void *event)
+{
+ appdata_iv *ap = (appdata_iv *)data;
+
+ int changed_ang;
+
+ changed_ang = elm_win_rotation_get(obj);
+
+ IV_MSG_HIGH("Rotation is changed. %d", changed_ang);
+#if 0
+ if (changed_ang != current_ang)
+ {
+ current_ang = changed_ang;
+ // Perform an UI update according to the given rotation angle.
+ // Do not call elm_win_rotation_set / elm_win_rotation_with_resize_set.
+ // ecore_evas has already called elm_win_rotation_set / elm_win_rotation_with_resize_set function.
+ ...
+ }
+#endif
+ int degree = 0;
+ enum ug_event evt = UG_EVENT_NONE;
+
+ switch(changed_ang)
+ {
+ case 0:
+ degree = 0;
+ evt = UG_EVENT_ROTATE_PORTRAIT;
+ break;
+ case 90:
+ degree = 90;
+ evt = UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN;
+ break;
+
+ case 180:
+ degree = 180;
+ evt = UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN;
+ break;
+
+ case 270:
+ evt = UG_EVENT_ROTATE_LANDSCAPE;
+ degree = 270;
+ break;
+ default:
+ IV_MSG_ERROR("Unknown rotation degree. %d", changed_ang);
+ return;
+ break;
+ }
+
+ ug_send_event( evt );
+
+}
/**
{
elm_win_title_set(eo, name);
evas_object_smart_callback_add(eo, "delete,request", _win_del, NULL);
+ int w, h;
+ ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
+ IV_MSG_HIGH("x_window_size %d, %d", w, h);
+ evas_object_resize (eo, w, h);
}
return eo;
}
+Evas_Object* _create_bg(Evas_Object* parent, int r, int g, int b)
+{
+ IV_ASSERT(parent != NULL);
+
+ Evas_Object *bg = elm_bg_add(parent);
+ evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+ elm_win_resize_object_add(parent, bg);
+
+ elm_bg_color_set(bg, r, g, b);
+
+ evas_object_show(bg);
+
+ return bg;
+}
/**
* @brief The layout callback after ug created
{
IV_MSG_HIGH("ug Layout CB. UG=0x%08x Priv=0x%08x Mode=%d", ug, priv, mode);
- Evas_Object *win = NULL;
-
if (!ug || !priv)
{
IV_MSG_ERROR("Abnormal value. UG=0x%08x Priv=0x%08x Mode=%d", ug, priv, mode);
appdata_iv *ap = (appdata_iv *)priv;
+ Evas_Object *win = ap->win_main;
+ IV_ASSERT(win != NULL);
+
ap->lyClient = ug_get_layout(ug);
if (ap->lyClient == NULL)
return;
}
- win = ug_get_window();
- IV_ASSERT(win != NULL);
-
-#ifdef USE_CONFORMANT
if(ap->lyBase == NULL)
{
- if(ap->bUseConforment == true)
- {
- ap->lyBase = elm_layout_add(ap->conformant);
- }
- else
- {
- ap->lyBase = elm_layout_add(win);
- }
-#else
- if(ap->lyBase == NULL)
- {
- ap->lyBase = elm_layout_add(win);
-#endif
+ ap->lyBase = elm_layout_add(ap->conformant);
+
evas_object_name_set(ap->lyBase, "IV Base");
IV_MSG_HIGH("Load edj : %s", PREFIX"/res/edje/iv-main.edj");
{
case UG_MODE_FULLVIEW:
ug_disable_effect(ug);
-#ifdef USE_CONFORMANT
- if(ap->bUseConforment == true)
- {
+
elm_win_conformant_set(win, EINA_TRUE);
evas_object_size_hint_weight_set(ap->conformant, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- elm_win_resize_object_add(win, ap->conformant);
+ elm_object_content_set(ap->conformant, ap->lyBase);
- elm_object_content_set(ap->conformant, ap->lyBase);
+ elm_win_resize_object_add(win, ap->conformant);
evas_object_show(ap->conformant);
- }
- else
- {
- elm_win_resize_object_add(win, ap->lyBase);
-
- evas_object_show(ap->lyBase);
- }
-
-#else
- elm_win_resize_object_add(win, ap->lyBase);
-
- evas_object_show(ap->lyBase);
-#endif
// dump_obj(ap->conformant, 0, 10);
break;
IV_MSG_ERROR("Unknow UG mode : %d", mode);
break;
}
+
+ if(ap->black_obj)
+ {
+ evas_object_del(ap->black_obj);
+ ap->black_obj = NULL;
+ }
}
/**
return ug;
}
-static bool _is_rotation_lock(void)
-{
- int lock = 0;
- int ret = -1;
-
- ret = vconf_get_bool(VCONFKEY_SETAPPL_AUTO_ROTATE_SCREEN_BOOL, &lock);
-
- if ( ret != 0) // Failed
- {
- IV_MSG_HIGH( "Rotation locked state is [%d].", lock);
- return false;
- }
-
- if ( lock == 0)
- {
- IV_MSG_HIGH("Rotation is locked");
- return true;
- }
-
- return false;
-}
-
-static void _on_portrait_lock_changed(keynode_t* node, void *user_data)
-{
- IV_MSG_HIGH("State changed. %s=%d", vconf_keynode_get_name(node), vconf_keynode_get_bool(node));
-
- if ( vconf_keynode_get_bool(node) == true )
- {
- // When Set portrait lock, Set degree as 0.
- _orient_changed(APP_DEVICE_ORIENTATION_0, user_data);
- }
-}
static bool _iter_extra_data_cb(service_h service, const char *key, void *user_data)
{
UG_INIT_EFL(ap->win_main, UG_OPT_INDICATOR_ENABLE); // Init UG module
- int ret = -1;
-
- ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL, _on_portrait_lock_changed, user_data);
-
- if ( ret == -1 )
+ if (elm_win_wm_rotation_supported_get(win) == EINA_TRUE)
{
- IV_MSG_ERROR("Register %s is failed", VCONFKEY_SETAPPL_ROTATE_LOCK_BOOL);
- return false;
+ int rots[4] = { 0, 90, 180, 270 };
+ elm_win_wm_rotation_available_rotations_set(win, &rots, 4);
+ }
+ else
+ {
+ IV_MSG_HIGH("Rotation is not supported. ");
}
- _orient_changed(app_get_device_orientation(), user_data); // Set initial degree
+ evas_object_smart_callback_add(win, "wm,rotation,changed", _rot_changed_cb, user_data);
//create conformant
ap->conformant = elm_conformant_add(win);
goto EXIT;
}
-#ifdef USE_CONFORMANT
- ap->bUseConforment = true;
-#endif
-
if( strcmp(operation, SERVICE_OPERATION_VIEW) == 0 || strcmp(operation, SERVICE_OPERATION_DEFAULT) == 0)
{
if(uri) // uri can entered through argv[1]
UTILX_EFFECT_TYPE_MAP, UTILX_EFFECT_STYLE_NONE);
utilx_set_window_effect_style((Display*)ecore_x_display_get(), elm_win_xwindow_get(ap->win_main),
UTILX_EFFECT_TYPE_UNMAP, UTILX_EFFECT_STYLE_NONE);
- ap->bUseConforment = false;
}
free(szMode);
}
{
// Create Previous UG if exist
IV_MSG_HIGH("Removing previous UG=0x%08x", ap->iv_ug);
+
+ service_h s = NULL;
+ service_create(&s);
+
+ service_add_extra_data(s, "Destroy", "OK");
+
+ ug_send_message(ap->iv_ug, s);
+ service_destroy(s);
+
ug_destroy(ap->iv_ug);
ap->iv_ug = NULL;
}
// Take necessary actions when application becomes invisible.
IV_MSG_HIGH("%s", __func__);
+ appdata_iv *ap = (appdata_iv *)user_data;
+
+ if(ap->black_obj == NULL)
+ {
+ ap->black_obj = evas_object_rectangle_add(evas_object_evas_get(ap->conformant));
+ evas_object_color_set(ap->black_obj, 0, 0, 0, 255); /* black bg */
+ }
+
+ ap->lyBase = elm_object_content_unset(ap->conformant);
+
+ ap->lyClient = elm_object_part_content_unset(ap->lyBase, "elm.swallow.content");
+
+ elm_object_part_content_set(ap->lyBase, "elm.swallow.content", ap->black_obj);
+ evas_object_show(ap->black_obj);
+
+ evas_object_hide(ap->lyClient);
+
ug_pause();
}
// Take necessary actions when application becomes visible.
IV_MSG_HIGH("%s", __func__);
+ appdata_iv *ap = (appdata_iv *)user_data;
+
+ elm_object_part_content_set(ap->lyBase, "elm.swallow.content", ap->lyClient);
+
+ elm_object_content_set(ap->conformant, ap->lyBase);
+
+ evas_object_show(ap->lyClient);
+
+ if(ap->black_obj)
+ {
+ evas_object_del(ap->black_obj);
+ ap->black_obj = NULL;
+ }
+
ug_resume();
}
appdata_iv *ap = (appdata_iv *)user_data;
+ if(ap->black_obj)
+ {
+ evas_object_del(ap->black_obj);
+ ap->black_obj = NULL;
+ }
+
if(ap->service_handle) {
service_destroy(ap->service_handle);
ap->service_handle = NULL;
evas_object_del(ap->lyBase);
ap->lyBase = NULL;
}
-#ifdef USE_CONFORMANT
+
if(ap->conformant)
{
evas_object_del(ap->conformant);
ap->conformant = NULL;
}
-#endif
IV_MSG_HIGH("%s terminated.", __func__);
}
}
-static void _orient_changed(app_device_orientation_e orientation, void *user_data)
-{
- IV_MSG_HIGH("%s. orientation=%d", __func__, orientation);
-
-/*
- enum app_device_orientation_e
-
- APP_DEVICE_ORIENTATION_0 The device is oriented in natural position
-
- APP_DEVICE_ORIENTATION_90 The device's left side is at the top
-
- APP_DEVICE_ORIENTATION_180 The device is upside down
-
- APP_DEVICE_ORIENTATION_270 The device's right side is to the top
-
-*/
- appdata_iv *ap = (appdata_iv *)user_data;
-
- int degree = 0;
- enum ug_event evt = UG_EVENT_NONE;
-
- if ( _is_rotation_lock() == true ) // When rotatation lock is set, show application as portrate mode.
- {
- orientation = APP_DEVICE_ORIENTATION_0;
- }
-
- switch(orientation)
- {
- case APP_DEVICE_ORIENTATION_0:
- degree = 0;
- evt = UG_EVENT_ROTATE_PORTRAIT;
- break;
- case APP_DEVICE_ORIENTATION_90:
- degree = 90;
- evt = UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN;
- break;
-
- case APP_DEVICE_ORIENTATION_180:
- degree = 180;
- evt = UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN;
- break;
-
- case APP_DEVICE_ORIENTATION_270:
- evt = UG_EVENT_ROTATE_LANDSCAPE;
- degree = 270;
- break;
- }
-
- ug_send_event( evt );
-
-// IV_MSG_HIGH( "evt = %d, r = %d", evt, r);
-
- if ( ap->win_main != NULL )
- {
- elm_win_rotation_with_resize_set(ap->win_main, degree);
- }
-}
-
/**
* @brief The main function
event_callback.low_memory = _low_memory;
event_callback.low_battery = _low_battery;
- event_callback.device_orientation = _orient_changed; /* Rotate is not supported in FMRadio */
+
+// event_callback.device_orientation = _orient_changed;
+
event_callback.language_changed = _lang_changed; /* Currently, Application will terminated when change language */
event_callback.region_format_changed = NULL;