SET(SRCS
src/main.c
src/view/view_base.c
+ src/view/common/view_generic_popup.c
src/view/picture/view_picture_slider_generic.c
src/view/picture/view_picture_mode.c
src/view/picture/view_picture_contrast.c
src/view/picture/view_picture_sharpness.c
src/view/picture/view_picture_color.c
src/view/picture/view_picture_tint.c
+ src/view/picture/view_picture_screen_adj.c
src/view/system/view_clock.c
src/view/system/view_sleep_timer.c
src/view/system/view_wakeup_timer.c
#define PICTURE_MODE_STANDARD_STR "Standard"
#define PICTURE_MODE_MOVIE_STR "Movie"
+#define SCREEN_ADJ_16_9_STR "16:9"
+#define SCREEN_ADJ_4_3_STR "4:3"
+#define SCREEN_ADJ_AUTO_STR "Auto Wide"
+#define SCREEN_ADJ_WIDE_ZOOM_STR "Wide Zoom"
+#define SCREEN_ADJ_FIT_STR "Screen Fit"
+
typedef enum _picture_mode {
PICTURE_MODE_STANDARD = 0,
PICTURE_MODE_MOVIE,
PICTURE_MODE_MAX
} settings_picture_mode;
+#define SCREEN_ADJ_OPTS_COUNT 5
+
+extern const char *screen_adj_names[SCREEN_ADJ_OPTS_COUNT];
+
void settings_picture_set_picture_mode(settings_picture_mode mode_to_set);
void settings_picture_set_contrast(int val);
void settings_picture_set_brightness(int val);
int settings_picture_get_sharpness(void);
int settings_picture_get_color(void);
int settings_picture_get_tint_g(void);
+void settings_picture_set_screen_adjust(int adj);
+int settings_picture_get_screen_adjust(void);
+const char *settings_picture_get_screen_adjust_str(void);
#endif /* __AIR_SETTINGS_PICTURE_H__ */
#define VIEW_PICTURE_SHARPNESS "VIEW_PICTURE_SHARPNESS"
#define VIEW_PICTURE_COLOR "VIEW_PICTURE_COLOR"
#define VIEW_PICTURE_TINT "VIEW_PICTURE_TINT"
+#define VIEW_PICTURE_SCREEN_ADJ "VIEW_PICTURE_SCREEN_ADJ"
/* View ID - System */
#define VIEW_CLOCK "VIEW_CLOCK"
#define GRP_VIEW_WAKEUP_TIMER "grp.view.wakeup_timer"
#define GRP_VIEW_SLEEP_TIMER "grp.view.sleep_timer"
+#define GRP_VIEW_POPUP_BUTTONS_LIST "grp.view.popup_buttons_list"
#define GRP_VIEW_POPUP_2BTNS "grp.view.popup_2btns"
#define GRP_VIEW_GENERIC_SLIDER "grp.view.generic_slider"
#define PART_ENTRY_3 "part.entry3"
#define PART_ENTRY_4 "part.entry4"
+#define PART_POPUP_BUTTON0 "part.popup.btn0"
#define PART_POPUP_BUTTON1 "part.popup.btn1"
#define PART_POPUP_BUTTON2 "part.popup.btn2"
#define PART_POPUP_BUTTON3 "part.popup.btn3"
#define PART_POPUP_BUTTON4 "part.popup.btn4"
#define PART_POPUP_BUTTON5 "part.popup.btn5"
-#define PART_POPUP_BUTTON6 "part.popup.btn6"
#define PART_POPUP_BUTTON_X "part.popup.btn%d"
#define PART_POPUP_NAME "part.popup.name"
#define STR_SHARPNESS "Sharpness"
#define STR_COLOR "Color"
#define STR_TINT "Tint"
+#define STR_SCR_ADJ "Screen Adjustment"
#define STR_LANGUAGE "Language"
#define STR_LOCATION "Location"
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef VIEW_GENERIC_POPUP_H_
+#define VIEW_GENERIC_POPUP_H_
+
+#include "common/viewmgr.h"
+#include "common/inputmgr.h"
+
+/*TODO: make use of it and add more types if necessary:*/
+typedef enum
+{
+ POPUP_TYPE_BUTTONS_LIST = 0
+}popup_type_t;
+
+typedef struct {
+ const char *popup_title; /* in */
+ const char *popup_description; /* in */
+ const char *popup_layout_group; /* in */
+ input_handler *handler; /* in */
+ int buttns_count; /* in - valid for popup with buttons only */
+ const char **btn_texts; /* in - valid for popup with buttons only */
+ int (*ui_id_on_show_focus)(void); /* in */
+ void *generic_popup_data; /* out - to be used by inheriting class */
+} generic_popup_parameter;
+
+view_class *view_generic_popup_get_vclass(void);
+
+#endif /* VIEW_GENERIC_POPUP_H_ */
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef VIEW_PICTURE_SCREEN_ADJ_H_
+#define VIEW_PICTURE_SCREEN_ADJ_H_
+
+#include "view/common/view_generic_popup.h"
+
+view_class *view_picture_screen_adj_get_vclass(void);
+
+#endif /* VIEW_PICTURE_SCREEN_ADJ_H_ */
base_scale: APP_BASE_SCALE;
#include "view/base.edc"
#include "view/common/popup_2btns.edc"
+ #include "view/common/popup_screen_adj.edc"
#include "view/common/generic_slider_view.edc"
#include "view/system/clock.edc"
#include "view/system/sleep_timer.edc"
}
part {
- name, PART_POPUP_BUTTON1;
+ name, PART_POPUP_BUTTON0;
type, SWALLOW;
scale, 1;
description {
description {
state, "default" 0.0;
min, 0 32;
- rel1 { to, PART_POPUP_BUTTON1; relative, 0.0 1.0; }
- rel2.to, PART_POPUP_BUTTON1;
+ rel1 { to, PART_POPUP_BUTTON0; relative, 0.0 1.0; }
+ rel2.to, PART_POPUP_BUTTON0;
align, 0.5 0.0;
fixed, 0 1;
}
}
part {
- name, PART_POPUP_BUTTON2;
+ name, PART_POPUP_BUTTON1;
type, SWALLOW;
scale, 1;
description {
--- /dev/null
+group {
+ name, GRP_VIEW_POPUP_BUTTONS_LIST;
+ parts {
+ part {
+ name, "area";
+ type, RECT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ visible, 0;
+ }
+ }
+
+ part {
+ name, "padding.title";
+ type, SPACER;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 0 24;
+ rel1.to, "area";
+ rel2 { to, "area"; relative, 1.0 0.0; }
+ align, 0.5 0.0;
+ fixed, 0 1;
+ }
+ }
+
+ part {
+ name, PART_POPUP_NAME;
+ type, TEXT;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 0 32;
+ rel1 { to, "padding.title"; relative, 0.0 1.0; }
+ rel2.to, "padding.title";
+ align, 0.5 0.0;
+ fixed, 0 1;
+ color, COLOR_TEXT_POPUP;
+ text {
+ font, FONT_LIGHT;
+ size, 32;
+ }
+ }
+ }
+
+ part {
+ name, "padding.1";
+ type, SPACER;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 0 32;
+ rel1 { to, PART_POPUP_NAME; relative, 0.0 1.0; }
+ rel2.to, PART_POPUP_NAME;
+ align, 0.5 0.0;
+ fixed, 0 1;
+ }
+ }
+
+ part {
+ name, PART_POPUP_BUTTON0;
+ type, SWALLOW;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 488 68;
+ rel1 { to, "padding.1"; relative, 0.5 1.0; }
+ rel2 { to, "padding.1"; relative, 0.5 1.0; }
+ align, 0.5 0.0;
+ fixed, 0 1;
+ color, 0 0 0 255;
+ }
+ }
+
+ part {
+ name, "padding.2";
+ type, SPACER;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 0 32;
+ rel1 { to, PART_POPUP_BUTTON0; relative, 0.0 1.0; }
+ rel2.to, PART_POPUP_BUTTON0;
+ align, 0.5 0.0;
+ fixed, 0 1;
+ }
+ }
+
+ part {
+ name, PART_POPUP_BUTTON1;
+ type, SWALLOW;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 488 68;
+ rel1 { to, "padding.2"; relative, 0.0 1.0; }
+ rel2.to, "padding.2";
+ align, 0.5 0.0;
+ fixed, 0 1;
+ color, 0 0 0 255;
+ }
+ }
+ part {
+ name, "padding.3";
+ type, SPACER;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 0 32;
+ rel1 { to, PART_POPUP_BUTTON1; relative, 0.0 1.0; }
+ rel2.to, PART_POPUP_BUTTON1;
+ align, 0.5 0.0;
+ fixed, 0 1;
+ }
+ }
+ part {
+ name, PART_POPUP_BUTTON2;
+ type, SWALLOW;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 488 68;
+ rel1 { to, "padding.3"; relative, 0.0 1.0; }
+ rel2.to, "padding.3";
+ align, 0.5 0.0;
+ fixed, 0 1;
+ color, 0 0 0 255;
+ }
+ }
+ part {
+ name, "padding.4";
+ type, SPACER;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 0 32;
+ rel1 { to, PART_POPUP_BUTTON2; relative, 0.0 1.0; }
+ rel2.to, PART_POPUP_BUTTON2;
+ align, 0.5 0.0;
+ fixed, 0 1;
+ }
+ }
+ part {
+ name, PART_POPUP_BUTTON3;
+ type, SWALLOW;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 488 68;
+ rel1 { to, "padding.4"; relative, 0.0 1.0; }
+ rel2.to, "padding.4";
+ align, 0.5 0.0;
+ fixed, 0 1;
+ color, 0 0 0 255;
+ }
+ }
+ part {
+ name, "padding.5";
+ type, SPACER;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 0 32;
+ rel1 { to, PART_POPUP_BUTTON3; relative, 0.0 1.0; }
+ rel2.to, PART_POPUP_BUTTON3;
+ align, 0.5 0.0;
+ fixed, 0 1;
+ }
+ }
+ part {
+ name, PART_POPUP_BUTTON4;
+ type, SWALLOW;
+ scale, 1;
+ description {
+ state, "default" 0.0;
+ min, 488 68;
+ rel1 { to, "padding.5"; relative, 0.0 1.0; }
+ rel2.to, "padding.5";
+ align, 0.5 0.0;
+ fixed, 0 1;
+ color, 0 0 0 255;
+ }
+ }
+ }
+}
}
part {
- name, PART_POPUP_BUTTON1;
+ name, PART_POPUP_BUTTON0;
type, SWALLOW;
scale, 1;
description {
description {
state, "default" 0.0;
min, 0 32;
- rel1 { to, PART_POPUP_BUTTON1; relative, 0.0 1.0; }
- rel2.to, PART_POPUP_BUTTON1;
+ rel1 { to, PART_POPUP_BUTTON0; relative, 0.0 1.0; }
+ rel2.to, PART_POPUP_BUTTON0;
align, 0.5 0.0;
fixed, 0 1;
}
}
part {
- name, PART_POPUP_BUTTON2;
+ name, PART_POPUP_BUTTON1;
type, SWALLOW;
scale, 1;
description {
description {
state, "default" 0.0;
min, 0 32;
- rel1 { to, PART_POPUP_BUTTON2; relative, 0.0 1.0; }
- rel2.to, PART_POPUP_BUTTON2;
+ rel1 { to, PART_POPUP_BUTTON1; relative, 0.0 1.0; }
+ rel2.to, PART_POPUP_BUTTON1;
align, 0.5 0.0;
fixed, 0 1;
}
}
part {
- name, PART_POPUP_BUTTON3;
+ name, PART_POPUP_BUTTON2;
type, SWALLOW;
scale, 1;
description {
description {
state, "default" 0.0;
min, 0 32;
- rel1 { to, PART_POPUP_BUTTON3; relative, 0.0 1.0; }
- rel2.to, PART_POPUP_BUTTON3;
+ rel1 { to, PART_POPUP_BUTTON2; relative, 0.0 1.0; }
+ rel2.to, PART_POPUP_BUTTON2;
align, 0.5 0.0;
fixed, 0 1;
}
}
part {
- name, PART_POPUP_BUTTON4;
+ name, PART_POPUP_BUTTON3;
type, SWALLOW;
scale, 1;
description {
description {
state, "default" 0.0;
min, 0 32;
- rel1 { to, PART_POPUP_BUTTON4; relative, 0.0 1.0; }
- rel2.to, PART_POPUP_BUTTON4;
+ rel1 { to, PART_POPUP_BUTTON3; relative, 0.0 1.0; }
+ rel2.to, PART_POPUP_BUTTON3;
align, 0.5 0.0;
fixed, 0 1;
}
}
part {
- name, PART_POPUP_BUTTON5;
+ name, PART_POPUP_BUTTON4;
type, SWALLOW;
scale, 1;
description {
description {
state, "default" 0.0;
min, 0 32;
- rel1 { to, PART_POPUP_BUTTON5; relative, 0.0 1.0; }
- rel2.to, PART_POPUP_BUTTON5;
+ rel1 { to, PART_POPUP_BUTTON4; relative, 0.0 1.0; }
+ rel2.to, PART_POPUP_BUTTON4;
align, 0.5 0.0;
fixed, 0 1;
}
}
part {
- name, PART_POPUP_BUTTON6;
+ name, PART_POPUP_BUTTON5;
type, SWALLOW;
scale, 1;
description {
That's why all device_display_* functions invoked here don't work */
-
-
/* Temporary - until real API is known */
static settings_picture_mode temp_mode = PICTURE_MODE_STANDARD;
static int temp_contrast = DEFAULT_CONTRAST;
static int temp_sharpness = DEFAULT_SHARPNESS;
static int temp_color = DEFAULT_COLOR;
static int temp_tint_g = DEFAULT_TINT_G;
+static int screen_adj = 0;
+
+const char *screen_adj_names[SCREEN_ADJ_OPTS_COUNT] = {
+ SCREEN_ADJ_16_9_STR,
+ SCREEN_ADJ_4_3_STR,
+ SCREEN_ADJ_AUTO_STR,
+ SCREEN_ADJ_WIDE_ZOOM_STR,
+ SCREEN_ADJ_FIT_STR
+};
void settings_picture_set_picture_mode(settings_picture_mode mode_to_set)
{
//@TODO: get tint
return temp_tint_g;
}
+
+void settings_picture_set_screen_adjust(int adj)
+{
+ screen_adj = adj;
+}
+
+int settings_picture_get_screen_adjust(void)
+{
+ return screen_adj;
+}
+
+const char *settings_picture_get_screen_adjust_str(void)
+{
+ return screen_adj_names[screen_adj];
+}
},
{
.id = MENU_SCREEN_ADJ,
- .title = "Screen Adjustment",
+ .title = STR_SCR_ADJ,
.style = STYLE_STATUS_BTN,
- .disabled = EINA_TRUE,
+ .disabled = EINA_FALSE,
.status = _get_screen_adj,
.selected = _selected,
},
static char *_get_screen_adj(void *data, int id)
{
- SETTING_TRACE_BEGIN;
- return NULL;
+ return strdup(settings_picture_get_screen_adjust_str());
}
static void _selected(void *data, int id)
case MENU_TINT:
if (!viewmgr_push_view(VIEW_PICTURE_TINT))
_ERR("Push Picture tint view failed.");
+ break;
+ case MENU_SCREEN_ADJ:
+ if (!viewmgr_show_view(VIEW_PICTURE_SCREEN_ADJ))
+ _ERR("Push Picture screen adjustment view failed.");
break;
}
}
#include "view/picture/view_picture_sharpness.h"
#include "view/picture/view_picture_color.h"
#include "view/picture/view_picture_tint.h"
+#include "view/picture/view_picture_screen_adj.h"
#include "view/system/view_clock.h"
#include "view/system/view_sleep_timer.h"
#include "view/system/view_wakeup_timer.h"
return false;
}
+ if (!viewmgr_add_view(view_picture_screen_adj_get_vclass(), NULL)) {
+ _ERR("Adding picture screen adjustment view failed.");
+ return false;
+ }
+
return true;
}
if (!viewmgr_remove_view(VIEW_PICTURE_TINT))
_ERR("Remove picture tint view failed.");
+
+ if (!viewmgr_remove_view(VIEW_PICTURE_SCREEN_ADJ))
+ _ERR("Remove picture screen adjustment view failed.");
}
static void _destroy_system_ui(void)
if (!viewmgr_remove_view(VIEW_RESET))
_ERR("Remove reset view failed.");
}
+
--- /dev/null
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "view/common/view_generic_popup.h"
+
+#include <app.h>
+#include <Elementary.h>
+
+#include "app_debug.h"
+#include "define.h"
+#include "common/viewmgr.h"
+#include "common/inputmgr.h"
+#include "common/utils.h"
+
+#define GENERIC_POPUP_BTN_NAME_MAX 128
+
+struct _priv {
+ Evas_Object *popup;
+ Evas_Object *layout;
+ int (*ui_id_on_show_focus)(void);
+};
+
+/* View class functions: */
+static Evas_Object *_create(Evas_Object *win, void *data);
+static void _show(void *view_data);
+static void _hide(void *view_data);
+static void _destroy(void *view_data);
+
+/* Helper: */
+static bool _fill_popup_btns(struct _priv *priv, Evas_Object *layout,
+ int btn_count, const char **btn_text, input_handler *handler);
+
+static view_class _vclass = {
+ .view_id = NULL,
+ .create = _create,
+ .show = _show,
+ .hide = _hide,
+ .destroy = _destroy
+};
+
+view_class *view_generic_popup_get_vclass(void)
+{
+ return &_vclass;
+}
+
+static Evas_Object *_create(Evas_Object *win, void *data)
+{
+ struct _priv *priv = NULL;
+ generic_popup_parameter *g_data = (generic_popup_parameter *)data;
+
+ if (!win || !g_data) {
+ _ERR("Invalid arguments");
+ return NULL;
+ }
+
+ priv = calloc(1, sizeof(struct _priv));
+ if (!priv) {
+ _ERR("Calloc failed.");
+ return NULL;
+ }
+
+ priv->popup = utils_add_popup(win, NULL, g_data->popup_title, NULL);
+ if (!priv->popup) {
+ _ERR("Add popup failed");
+ free(priv);
+ return NULL;
+ }
+
+ priv->layout = utils_add_layout(priv->popup, g_data->popup_layout_group, EINA_FALSE);
+ if (!priv->layout) {
+ _ERR("Add layout failed.");
+ evas_object_del(priv->popup);
+ free(priv);
+ return NULL;
+ }
+
+ elm_object_part_text_set(priv->layout, PART_POPUP_NAME, g_data->popup_title);
+
+ if (!_fill_popup_btns(priv, priv->layout, g_data->buttns_count, g_data->btn_texts, g_data->handler)) {
+ evas_object_del(priv->popup);
+ free(priv);
+ return NULL;
+ }
+
+ priv->ui_id_on_show_focus = g_data->ui_id_on_show_focus;
+
+ elm_object_content_set(priv->popup, priv->layout);
+
+ g_data->generic_popup_data = priv;
+
+ return priv->popup;
+}
+
+static void _show(void *data)
+{
+ Evas_Object *ui_element_to_focus = NULL;
+ int ui_id_to_focus = 0;
+ char part_name[GENERIC_POPUP_BTN_NAME_MAX] = {'\0', };
+ struct _priv *priv = (struct _priv *)data;
+
+ if (!priv) {
+ _ERR("Invalid parameter.");
+ return;
+ }
+
+ evas_object_show(priv->popup);
+
+ if(priv->ui_id_on_show_focus) {
+ ui_id_to_focus = priv->ui_id_on_show_focus();
+ snprintf(part_name, sizeof(part_name), PART_POPUP_BUTTON_X, ui_id_to_focus);
+ ui_element_to_focus = elm_layout_content_get(priv->layout, part_name);
+ elm_object_focus_set(ui_element_to_focus, EINA_TRUE);
+ }
+}
+
+static void _hide(void *data)
+{
+ struct _priv *priv = (struct _priv *)data;
+
+ if (!priv) {
+ _ERR("Invalid parameter.");
+ return;
+ }
+
+ evas_object_hide(priv->popup);
+}
+
+static void _destroy(void *data)
+{
+ struct _priv *priv = (struct _priv *)data;
+
+ if (!priv) {
+ _ERR("Invalid parameter.");
+ return;
+ }
+
+ evas_object_del(priv->popup);
+ free(priv);
+}
+
+static bool _fill_popup_btns(struct _priv *priv, Evas_Object *layout,
+ int btn_count, const char **btn_text, input_handler *handler)
+{
+ Evas_Object *btn = NULL;
+ int i = 0;
+
+ for(i = 0; i < btn_count; i++) {
+ char part_name[GENERIC_POPUP_BTN_NAME_MAX] = {'\0', };
+ snprintf(part_name, sizeof(part_name), PART_POPUP_BUTTON_X, i);
+ btn = utils_add_button(layout, part_name, NULL, btn_text[i]);
+ if (!btn) {
+ _ERR("Add button failed.");
+ return false;
+ }
+
+ if (handler)
+ inputmgr_add_callback(btn, i, handler, priv);
+ }
+
+ return true;
+}
for(i = 0; i < btn_count; i++) {
char part_name[PART_POPUP_BUTTON_STR_MAX_L] = {0, };
- snprintf(part_name, sizeof(part_name), btn_part_x, i+1);
+ snprintf(part_name, sizeof(part_name), btn_part_x, i);
btn = utils_add_button(layout, part_name, NULL, btn_text[i]);
if (!btn) {
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "view/picture/view_picture_screen_adj.h"
+#include <app.h>
+#include <Elementary.h>
+#include "app_debug.h"
+#include "define.h"
+#include "common/utils.h"
+#include "view/common/view_generic_popup.h"
+#include "data/settings_picture.h"
+
+struct _priv {
+ Evas_Object *popup;
+ void *base_popup_data;
+ const view_class *base_popup_class;
+};
+
+/* View class functions: */
+static Evas_Object *_create(Evas_Object *win, void *data);
+static void _destroy(void *view_data);
+static void _show(void *view_data);
+static void _hide(void *view_data);
+
+/* Enter button: */
+static void _clicked_cb(int id, void *data, Evas_Object *obj);
+/* */
+static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
+ Evas_Event_Key_Down *ev);
+
+const char *title = "Screen Adjustment";
+const char *description = "Select Screen Adjustment.";
+
+static view_class _vclass = {
+ .view_id = VIEW_PICTURE_SCREEN_ADJ,
+ .create = _create,
+ .show = _show,
+ .hide = _hide,
+ .destroy = _destroy
+};
+
+static input_handler handler = {
+ .key_down = _key_down_cb,
+ .clicked = _clicked_cb
+};
+
+
+view_class *view_picture_screen_adj_get_vclass(void)
+{
+ return &_vclass;
+}
+
+static Evas_Object *_create(Evas_Object *win, void *data)
+{
+ struct _priv *priv = NULL;
+ generic_popup_parameter constructor_param = {0,};
+
+ constructor_param.buttns_count = SCREEN_ADJ_OPTS_COUNT;
+ constructor_param.popup_title = title;
+ constructor_param.popup_description = description;
+ constructor_param.btn_texts = screen_adj_names;
+ constructor_param.popup_layout_group = GRP_VIEW_POPUP_BUTTONS_LIST;
+ constructor_param.handler = &handler;
+ constructor_param.ui_id_on_show_focus = &settings_picture_get_screen_adjust;
+
+ if (!win) {
+ _ERR("Get window object failed.");
+ return NULL;
+ }
+
+ priv = calloc(1, sizeof(struct _priv));
+ if (!priv) {
+ _ERR("Calloc failed.");
+ return NULL;
+ }
+
+ priv->base_popup_class = view_generic_popup_get_vclass();
+
+ if (!priv->base_popup_class || ! priv->base_popup_class->create) {
+ free(priv);
+ return NULL;
+ }
+
+ priv->popup = priv->base_popup_class->create(win, &constructor_param);
+
+ if (!priv->popup) {
+ free(priv);
+ return NULL;
+ }
+
+ priv->base_popup_data = constructor_param.generic_popup_data;
+
+ if (!viewmgr_set_view_data(VIEW_PICTURE_SCREEN_ADJ, priv)) {
+ _ERR("Set view data failed.");
+ _destroy(priv);
+ free(priv);
+ return NULL;
+ }
+
+ return priv->popup;
+}
+
+static void _show(void *data)
+{
+ struct _priv *priv = (struct _priv *)data;
+
+ if (!priv
+ || !priv->base_popup_class
+ || !priv->base_popup_class->show
+ || !priv->base_popup_data) {
+ _ERR("Invalid parameter.");
+ return;
+ }
+
+ priv->base_popup_class->show(priv->base_popup_data);
+}
+
+static void _hide(void *data)
+{
+ struct _priv *priv = (struct _priv *)data;
+
+ if (!priv
+ || !priv->base_popup_class
+ || !priv->base_popup_class->hide
+ || !priv->base_popup_data) {
+ _ERR("Invalid parameter.");
+ return;
+ }
+ priv->base_popup_class->hide(priv->base_popup_data);
+}
+
+static void _destroy(void *data)
+{
+ struct _priv *priv = (struct _priv *)data;
+
+ if (!priv
+ || !priv->base_popup_class
+ || !priv->base_popup_class->destroy
+ || !priv->base_popup_data) {
+ _ERR("Invalid parameter.");
+ return;
+ }
+ priv->base_popup_class->destroy(priv->base_popup_data);
+ free(priv);
+}
+
+static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj,
+ Evas_Event_Key_Down *ev)
+{
+ struct _priv *priv = (struct _priv *)data;
+
+ if (!ev || !priv) {
+ _ERR("Invalid argument.");
+ return;
+ }
+
+ if (!strcmp(ev->keyname, KEY_BACK))
+ viewmgr_pop_view();
+}
+
+static void _clicked_cb(int id, void *data, Evas_Object *obj)
+{
+ struct _priv *priv = (struct _priv *)data;
+
+ if (!priv || !obj) {
+ _ERR("Invalid argument.");
+ return;
+ }
+
+ settings_picture_set_screen_adjust(id);
+ viewmgr_pop_view();
+}
for(i = 0; i < btn_count; i++) {
char part_name[PART_POPUP_BUTTON_STR_MAX_L] = {0, };
- snprintf(part_name, sizeof(part_name), btn_part_x, i+1);
+ snprintf(part_name, sizeof(part_name), btn_part_x, i);
btn = utils_add_button(layout, part_name, NULL, btn_text[i]);
if (!btn) {
for(i = 0; i < btn_count; i++) {
char part_name[PART_POPUP_BUTTON_STR_MAX_L] = {0, };
- snprintf(part_name, sizeof(part_name), btn_part_x, i+1);
+ snprintf(part_name, sizeof(part_name), btn_part_x, i);
btn = utils_add_button(layout, part_name, NULL, btn_text[i]);
if (!btn) {
for(i = 0; i < btn_count; i++) {
char part_name[PART_POPUP_BUTTON_STR_MAX_L] = {0, };
- snprintf(part_name, sizeof(part_name), btn_part_x, i+1);
+ snprintf(part_name, sizeof(part_name), btn_part_x, i);
btn = utils_add_button(layout, part_name, NULL, btn_text[i]);
if (!btn) {