From 0069fe6eab494e886f48f0b6856da1c07864362e Mon Sep 17 00:00:00 2001 From: Jisung Ahn Date: Fri, 5 Apr 2013 17:21:46 +0900 Subject: [PATCH] add public result at crop Change-Id: I52d32b0f38783ba4f87a7e6edc725e88dbc079d1 --- main/src/control/ivug-crop-ug.cpp | 9 +++++---- main/src/control/ivug-parameter.c | 32 +++++++++++++++++++++++++++++++ main/src/view/ivug-setas-view.c | 40 ++++++++++++++++++++++++++++++++++++--- 3 files changed, 74 insertions(+), 7 deletions(-) diff --git a/main/src/control/ivug-crop-ug.cpp b/main/src/control/ivug-crop-ug.cpp index 1bcf371..03b2d24 100755 --- a/main/src/control/ivug-crop-ug.cpp +++ b/main/src/control/ivug-crop-ug.cpp @@ -75,7 +75,7 @@ static void _ivug_crop_view_ok_clicked_cb(void *data, Evas_Object *obj, void *e ivug_db_destroy_file_handle(m_handle); } - _send_result(gGetUGHandle(), "crop_image_path", path, NULL, NULL); + _send_result(gGetUGHandle(), "crop_image_path", path, "http://tizen.org/appcontrol/data/selected", path); MSG_HIGH("Start destroy ug"); ug_destroy_me(gGetUGHandle()); @@ -104,7 +104,8 @@ static void _ivug_setas_crop_view_ok_clicked_cb(void *data, Evas_Object *obj, vo if(mode == IVUG_SETAS_CROP) { ivug_copy_file(path, appsvc_home_path); - _send_result(gGetUGHandle(), "crop_image_path", appsvc_home_path, NULL, NULL); + _send_result(gGetUGHandle(), "crop_image_path", appsvc_home_path, + "http://tizen.org/appcontrol/data/selected", appsvc_home_path); } else { @@ -141,7 +142,7 @@ static void _ivug_crop_view_cancel_clicked_cb(void *data, Evas_Object *obj, voi evas_object_smart_callback_del(obj, "cancel,clicked", _ivug_crop_view_cancel_clicked_cb); - _send_result(gGetUGHandle(), "crop_image_path", NULL, NULL, NULL); + _send_result(gGetUGHandle(), "crop_image_path", NULL, "http://tizen.org/appcontrol/data/selected", NULL); MSG_HIGH("Start destroy ug"); ug_destroy_me(gGetUGHandle()); @@ -164,7 +165,7 @@ static void on_crop_view_btn_back_clicked(void *data, Evas_Object *obj, void *ev crop_ug->crop_view = NULL; - _send_result(gGetUGHandle(), "crop_image_path", NULL, NULL, NULL); + _send_result(gGetUGHandle(), "crop_image_path", NULL, "http://tizen.org/appcontrol/data/selected", NULL); MSG_HIGH("Start destroy ug"); ug_destroy_me(gGetUGHandle()); diff --git a/main/src/control/ivug-parameter.c b/main/src/control/ivug-parameter.c index 7cef9d3..34eff35 100755 --- a/main/src/control/ivug-parameter.c +++ b/main/src/control/ivug-parameter.c @@ -47,6 +47,10 @@ #define IVUG_BUNDLE_KEY_RESOLUTION "Resolution" #define IVUG_BUNDLE_KEY_FIXED_RATIO "Fixed ratio" +#define IVUG_BUNDLE_KEY_CROP_MODE "http://tizen.org/appcontrol/data/image/crop_mode" +#define IVUG_BUNDLE_VALUE_CROP_MODE_AUTO "auto" +#define IVUG_BUNDLE_VALUE_CROP_MODE_FIT_TO_SCREEN "fit_to_screen" + #define IVUG_BUNDLE_KEY_MEDIA_TYPE "Media type" #define IVUG_BUNDLE_KEY_STANDALONE "Standalone" @@ -625,6 +629,34 @@ ivug_param_create_from_bundle(service_h service) } _ivug_free(&bRatioFix); } + + char* crop_mode = NULL; + service_get_extra_data (service, IVUG_BUNDLE_KEY_CROP_MODE, &crop_mode); + if(crop_mode) + { + MSG_IVUG_MED("Crop mode=%s", crop_mode); + if(strcmp(crop_mode, IVUG_BUNDLE_VALUE_CROP_MODE_FIT_TO_SCREEN) == 0) + { + int lcd_x = 0; + int lcd_y = 0; + int lcd_w = 0; + int lcd_h = 0; + int rot = 0; + evas_object_geometry_get((Evas_Object *)ug_get_window(), &lcd_x, &lcd_y, &lcd_w, &lcd_h); + rot = gGetRotationDegree(); + if(rot == 90 || rot == 270) + { + int temp = lcd_w; + lcd_w = lcd_h; + lcd_h = temp; + } + data->width = lcd_w; + data->height = lcd_h; + data->bRatioFix = true; + } + _ivug_free(&crop_mode); + } + _ivug_free(&val); } diff --git a/main/src/view/ivug-setas-view.c b/main/src/view/ivug-setas-view.c index ac33040..2355d0b 100755 --- a/main/src/view/ivug-setas-view.c +++ b/main/src/view/ivug-setas-view.c @@ -66,6 +66,8 @@ static void _OnOK(Ivug_SetAsView *pSetAsView); static void _OnCancel(Ivug_SetAsView *pSetAsView); static Evas_Object*_show_exit_popup( Evas_Object *parent, const char *title, const char *desc, void *data); static void _send_result(ui_gadget_h ug, const char *key1, const char *val1, const char *key2, const char *val2); +static void _send_result2(ui_gadget_h ug, const char *key1, const char *val1, + const char *key2, const char *val2, const char *key3, const char *val3); static void @@ -222,7 +224,35 @@ _send_result(ui_gadget_h ug, const char *key1, const char *val1, const char *key service_destroy(service); } +static void +_send_result2(ui_gadget_h ug, const char *key1, const char *val1, + const char *key2, const char *val2, const char *key3, const char *val3) +{ + ivug_ret_if(!ug); + + service_h service; + service_create(&service); + if(key1 && val1) + { + MSG_SETAS_HIGH("Bundle 1 : [%s = %s]", key1, val1); + service_add_extra_data(service, key1, val1); + } + if(key2 && val2) + { + MSG_SETAS_HIGH("Bundle 2 : [%s = %s]", key2, val2); + service_add_extra_data(service, key2, val2); + } + + if(key3 && val3) + { + MSG_SETAS_HIGH("Bundle 3 : [%s = %s]", key3, val3); + service_add_extra_data(service, key3, val3); + } + + ug_send_result(ug, service); + service_destroy(service); +} static void _on_setas_homescreen(Ivug_SetAsView *pSetAsView) { @@ -272,7 +302,8 @@ static void _on_setas_homescreen(Ivug_SetAsView *pSetAsView) else // IVUG_SETAS_CROP { _show_exit_popup(pSetAsView->content, IDS_HOME_SCREEN_WALLPAPER, IDS_SUCCESS, (void *)pSetAsView); - _send_result(gGetUGHandle(), "crop_image_path", homescreen_path, NULL, NULL); + _send_result(gGetUGHandle(), "crop_image_path", homescreen_path, + "http://tizen.org/appcontrol/data/selected", homescreen_path); MSG_SETAS_HIGH("Set Home screen: %s", homescreen_path); } @@ -417,7 +448,9 @@ static void _on_setas_callerid(Ivug_SetAsView *pSetAsView) if(pSetAsView->Mode != IVUG_SETAS_NORMAL) { - _send_result(gGetUGHandle(), "crop_image_path", SET_AS_CALL_ID_PATH, "image_path", SET_AS_CALL_ID_LCD_PATH); + //_send_result(gGetUGHandle(), "crop_image_path", SET_AS_CALL_ID_PATH, "image_path", SET_AS_CALL_ID_LCD_PATH); + _send_result2(gGetUGHandle(), "crop_image_path", SET_AS_CALL_ID_PATH, + "image_path", SET_AS_CALL_ID_LCD_PATH, "http://tizen.org/appcontrol/data/selected", SET_AS_CALL_ID_PATH); _show_exit_popup(pSetAsView->content, title, IDS_SUCCESS, pSetAsView); } @@ -457,7 +490,8 @@ static void _on_setas_video_call_id(Ivug_SetAsView *pSetAsView) if(pSetAsView->Mode != IVUG_SETAS_NORMAL) { - _send_result(gGetUGHandle(), "crop_image_path", SET_AS_VIDEO_CALL_ID_PATH, NULL, NULL); + _send_result(gGetUGHandle(), "crop_image_path", SET_AS_VIDEO_CALL_ID_PATH, + "http://tizen.org/appcontrol/data/selected", SET_AS_VIDEO_CALL_ID_PATH); } _show_exit_popup(pSetAsView->content, title, IDS_SUCCESS, pSetAsView); -- 2.7.4