Eina_Bool navigator_get_is_text_selection_mode(NavigatorData *nd);
-Eina_Bool navigator_table_has_changed(NavigatorData *nd, gchar *table_unique_id);
-Eina_Bool navigator_table_row_has_changed(NavigatorData *nd, int row);
-Eina_Bool navigator_table_column_has_changed(NavigatorData *nd, int column);
-Eina_Bool navigator_table_cell_has_changed(NavigatorData *nd, int row, int column);
-void navigator_set_last_position_in_table(NavigatorData *nd, int row, int column);
-void navigator_set_last_table_unique_id(NavigatorData *nd, gchar *table_unique_id);
-
#endif //NAVIGATOR_H_
*/
void tw_set_utterance_cb(utterance_cb_t utter_cb, void* user_data, utterance_cb_t deleter);
-/**
- * @brief Checks if the voice is supported
- * @param[in] language Language code (e.g. "en_US")
- * @param[in] voice_type Voice type (as defined by TTS API: 0 - auto, 1 - male, 2 - female, 3 - child)
- * @returns EINA_TRUE if supported, EINA_FALSE otherwise
- */
-Eina_Bool tw_is_voice_supported(const char *language, int voice_type);
-
/**
* @brief Checks if the speed of speaking is in the TTS supported speed range
* @param[in] speed Speed of speaking
#include <stdbool.h>
-typedef Eina_Bool (*TTSVoiceValidatorCb)(const char *tts_language, int tts_voice_type);
-
-/**
- * @brief Registers callback function for TTS Voice validation
- *
- * @param cb pointer to function
- */
-void vc_tts_voice_validator_register(TTSVoiceValidatorCb cb);
-
/**
* @brief Sets callback functions for keys: description, haptic, keyboard_feedback and sound_feedback
*/
*/
bool vc_get_read_description(void);
-bool vc_get_read_list_grid_information(void);
bool vc_get_granularity_enabled(void);
bool vc_get_haptic(void);
bool vc_get_keyboard_feedback(void);
bool vc_get_sound_feedback(void);
int vc_get_lcd_backlight_timeout(void);
-int vc_get_tts_voice_type(void);
int vc_get_tts_speed(void);
-const char *vc_get_tts_language(void);
#endif /* SCREEN_READER_VCONF_H_ */
Eina_Bool object_has_defunct_state(AtspiAccessible *obj);
Eina_Bool object_has_highlighted_state(AtspiAccessible *obj);
Eina_Bool object_get_extents(AtspiAccessible *object, AtspiRect *extents);
-Eina_Bool object_get_position_in_table(AtspiAccessible *object, int *row, int *column, gchar **table_unique_id, int *table_row_count, int *table_column_count, gchar **table_caption);
int get_percent_value(double value, double lower, double upper);
if (!nd) { ERROR("NavigatorData is NULL!"); }
return nd ? nd->is_text_selection_mode : EINA_FALSE;
}
-
-Eina_Bool navigator_table_has_changed(NavigatorData *nd, gchar *table_unique_id) {
- if (!nd) { ERROR("NavigatorData is NULL!"); }
- return nd && !g_strcmp0(nd->last_table_unique_id, table_unique_id) ? EINA_FALSE : EINA_TRUE;
-}
-
-Eina_Bool navigator_table_row_has_changed(NavigatorData *nd, int row) {
- if (!nd) { ERROR("NavigatorData is NULL!"); }
- return nd && nd->last_position_in_table.y == row ? EINA_FALSE : EINA_TRUE;
-}
-
-Eina_Bool navigator_table_column_has_changed(NavigatorData *nd, int column) {
- if (!nd) { ERROR("NavigatorData is NULL!"); }
- return nd && nd->last_position_in_table.x == column ? EINA_FALSE : EINA_TRUE;
-}
-
-Eina_Bool navigator_table_cell_has_changed(NavigatorData *nd, int row, int column) {
- if (!nd) { ERROR("NavigatorData is NULL!"); }
- return navigator_table_row_has_changed(nd, row) || navigator_table_column_has_changed(nd, column);
-}
-
-void navigator_set_last_position_in_table(NavigatorData *nd, int row, int column) {
- if (!nd) { ERROR("NavigatorData is NULL!"); }
- if (nd) {
- nd->last_position_in_table.x = column;
- nd->last_position_in_table.y = row;
- }
-}
-
-void navigator_set_last_table_unique_id(NavigatorData *nd, gchar *table_unique_id) {
- if (!nd) { ERROR("NavigatorData is NULL!"); }
- if (nd) {
- g_free(nd->last_table_unique_id);
- nd->last_table_unique_id = g_strdup(table_unique_id);
- }
-}
-
}
}
-TIZEN_PROD_STATIC Eina_Bool should_add_row_info(int row, int column, gchar *table_unique_id) {
- return navigator_table_has_changed(get_pointer_to_service_data_struct()->navigator_data, table_unique_id) ||
- navigator_table_row_has_changed(get_pointer_to_service_data_struct()->navigator_data, row) ||
- !navigator_table_cell_has_changed(get_pointer_to_service_data_struct()->navigator_data, row, column);
-}
-
-TIZEN_PROD_STATIC Eina_Bool should_add_column_info(int row, int column, gchar *table_unique_id) {
- return navigator_table_has_changed(get_pointer_to_service_data_struct()->navigator_data, table_unique_id) ||
- navigator_table_column_has_changed(get_pointer_to_service_data_struct()->navigator_data, column) ||
- !navigator_table_cell_has_changed(get_pointer_to_service_data_struct()->navigator_data, row, column);
-}
-
-TIZEN_PROD_STATIC void update_position_in_table(int row, int column, gchar *table_unique_id)
-{
- navigator_set_last_position_in_table(get_pointer_to_service_data_struct()->navigator_data, row, column);
- navigator_set_last_table_unique_id(get_pointer_to_service_data_struct()->navigator_data, table_unique_id);
-}
-
-TIZEN_PROD_STATIC void add_position_in_table_text(Eina_Strbuf *buf, int row, int column, Eina_Bool add_row_info, Eina_Bool add_column_info)
-{
- if (add_row_info) {
- if (eina_strbuf_length_get(buf))
- ESAL(buf, " , ");
- ESAF(buf, _("IDS_ACCS_BODY_ROW_P1SD"), row + 1);
- }
- if (add_column_info) {
- if (eina_strbuf_length_get(buf))
- ESAL(buf, " , ");
- ESAF(buf, _("IDS_ACCS_BODY_COLUMN_P1SD"), column + 1);
- }
-}
-
-TIZEN_PROD_STATIC void add_info_about_table_text(Eina_Strbuf *buf, int row_count, int column_count, gchar *table_caption, Eina_Bool add_rows_info, Eina_Bool add_columns_info)
-{
- if (eina_strbuf_length_get(buf))
- ESAL(buf, " , ");
- ESAF(buf, _("IDS_ACCS_BODY_IN_GRID_CAPTION_P1SS"), table_caption);
- if (add_rows_info) {
- if (eina_strbuf_length_get(buf))
- ESAL(buf, " , ");
- ESAF(buf, _("IDS_ACCS_BODY_P1SD_ROWS"), row_count);
- }
- if (add_columns_info) {
- if (eina_strbuf_length_get(buf))
- ESAL(buf, " , ");
- ESAF(buf, _("IDS_ACCS_BODY_P1SD_COLUMNS"), column_count);
- }
-}
-
TIZEN_PROD_STATIC char *generate_role_trait_from_role(AtspiAccessibleReadingMaterial *rm)
{
AtspiRole role = rm->role;
add_name_from_rm(buf, rm);
- int row;
- int column;
- gchar *table_unique_id = NULL;
- if (vc_get_read_list_grid_information()) {
- int row_count;
- int column_count;
- gchar *table_caption = NULL;
- if (object_get_position_in_table(rm->self, &row, &column, &table_unique_id, &row_count, &column_count, &table_caption)) {
- Eina_Bool add_row_info = should_add_row_info(row, column, table_unique_id);
- Eina_Bool add_column_info = should_add_column_info(row, column, table_unique_id);
-
- add_position_in_table_text(buf, row, column, add_row_info, add_column_info);
- add_info_about_table_text(buf, row_count, column_count, table_caption, add_row_info, add_column_info);
- update_position_in_table(row, column, table_unique_id);
- }
- g_free(table_caption);
- } else {
- if (object_get_position_in_table(rm->self, &row, &column, &table_unique_id, NULL, NULL, NULL)) {
- add_position_in_table_text(buf, row, column, should_add_row_info(row, column, table_unique_id), should_add_column_info(row, column, table_unique_id));
- update_position_in_table(row, column, table_unique_id);
- }
- }
- g_free(table_unique_id);
-
if (reading_attribute & ACCESSIBLE_READING_INFO_TYPE_ROLE) {
DEBUG("START : ACCESSIBLE_READING_INFO_TYPE_ROLE");
role_name = generate_role_trait(rm);
INFO("Passing TEXT: %s to TTS", utf8_line);
int utterance_id;
- int ret = tts_add_text(tw->tts, utf8_line, vc_get_tts_language(), vc_get_tts_voice_type(), choose_speed(), &utterance_id);
+ int ret = tts_add_text(tw->tts, utf8_line, NULL, TTS_VOICE_TYPE_AUTO, choose_speed(), &utterance_id);
if (ret) {
tts_state_e state = -1;
switch (ret) {
}
tw->init = 1; // Set now so that the below line does not cause infinite recursion
- vc_tts_voice_validator_register(&tw_is_voice_supported);
INFO("---------------------- TTS_init END ----------------------\n\n");
}
void tw_shutdown(void)
{
- vc_tts_voice_validator_register(NULL);
-
TWData *tw = tw_get_instance();
if (tw) {
stop_speaking(tw);
#endif
#define VCKEY_DESCRIPTION "db/setting/accessibility/screen_reader/description"
-#define VCKEY_LIST_GRID_INFORMATION "db/setting/accessibility/screen_reader/list_grid_information"
#define VCKEY_GRANULARITY "db/setting/accessibility/screen_reader/granularity"
#define VCKEY_HAPTIC "db/setting/accessibility/screen_reader/haptic"
#define VCKEY_KEYBOARD_FEEDBACK "db/setting/accessibility/screen_reader/keyboard_feedback"
#define VCKEY_SOUND_FEEDBACK "db/setting/accessibility/screen_reader/sound_feedback"
-#define VCKEY_TTS_VOICE "db/setting/accessibility/screen_reader/tts_voice"
#define VCKEY_TTS_SPEED "db/setting/accessibility/screen_reader/tts_speed"
#define VCKEY_LCD_BACKLIGHT_NORMAL "db/setting/lcd_backlight_normal"
typedef struct {
bool init;
bool read_description;
- bool read_list_grid_information;
bool granularity_enabled;
bool haptic;
bool keyboard_feedback;
bool sound_feedback;
int lcd_backlight_timeout;
int tts_speed;
- int tts_voice_type;
- char *tts_language;
- TTSVoiceValidatorCb tts_voice_validator_cb;
} VConfData;
static VConfData *vc_get_instance(void);
DEBUG("END");
}
-static void vcwrap_update_derived_fields(void *destination)
-{
- VConfData *vconf_data = vc_get_instance();
- if (destination == &(vconf_data->tts_language)) {
- const char *voice_type = ""; // Pointer to '\0'
- char *separator = vconf_data->tts_language ? strchr(vconf_data->tts_language, ':') : NULL;
- if (separator) {
- *separator = '\0'; // Cut the string short
- voice_type = separator + 1; // Valid even if ':' was the last char -- then points to '\0'
- }
-
- vconf_data->tts_voice_type = atoi(voice_type); // atoi() returns 0 on failure
-
- if (vconf_data->tts_voice_validator_cb && !vconf_data->tts_voice_validator_cb(vconf_data->tts_language, vconf_data->tts_voice_type)) {
- free(vconf_data->tts_language);
- // fallback to auto-selection of platform default language and voice_type in case customized values are not valid
- vconf_data->tts_language = NULL;
- vconf_data->tts_voice_type = 0;
- }
- }
-}
-
static bool vcwrap_get_key_bool(const char *key, bool def)
{
int result = def; // Needs to be 'int' for vconf_get_bool()
return result;
}
-// Note: free() the result in either case
-static char *vcwrap_get_key_str(const char *key, const char *def)
-{
- char *result = vconf_get_str(key); // already strdup()'ed
- if (!result) {
- ERROR("vconf_get_str failed! key=%s", key);
- return def ? strdup(def) : NULL;
- }
- return result;
-}
-
static void vcwrap_field_updater_bool(keynode_t *node, void *destination)
{
if (!destination)
return;
*((bool*)destination) = !!vconf_keynode_get_bool(node);
- vcwrap_update_derived_fields(destination);
}
static void vcwrap_field_updater_int(keynode_t *node, void *destination)
if (!destination)
return;
*((int*)destination) = vconf_keynode_get_int(node);
- vcwrap_update_derived_fields(destination);
-}
-
-static void vcwrap_field_updater_str(keynode_t *node, void *destination)
-{
- if (!destination)
- return;
-
- const char *node_str = vconf_keynode_get_str(node);
- char **dest_ptr = (char **)destination;
-
- free(*dest_ptr);
- *dest_ptr = node_str ? strdup(node_str) : NULL;
- vcwrap_update_derived_fields(destination);
}
static void vcwrap_set_field_updater_bool(const char *key, bool *data)
ERROR("Could not create updater for key=%s", key);
}
-static void vcwrap_set_field_updater_str(const char *key, char **data)
-{
- if (vconf_notify_key_changed(key, vcwrap_field_updater_str, (void *)data))
- ERROR("Could not create updater for key=%s", key);
-}
-
static void vcwrap_unset_field_updater_bool(const char *key)
{
if (vconf_ignore_key_changed(key, vcwrap_field_updater_bool))
DEBUG("Could not delete notify callback for key=%s", key);
}
-static void vcwrap_unset_field_updater_str(const char *key)
-{
- if (vconf_ignore_key_changed(key, vcwrap_field_updater_str))
- DEBUG("Could not delete notify callback for key=%s", key);
-}
-
static VConfData *vc_get_instance(void)
{
static VConfData vconf_data = {0};
vconf_data.init = true;
vconf_data.read_description = vcwrap_get_key_bool(VCKEY_DESCRIPTION, true);
- vconf_data.read_list_grid_information = vcwrap_get_key_bool(VCKEY_LIST_GRID_INFORMATION, true);
vconf_data.granularity_enabled = vcwrap_get_key_bool(VCKEY_GRANULARITY, true);
vconf_data.haptic = vcwrap_get_key_bool(VCKEY_HAPTIC, true);
vconf_data.keyboard_feedback = vcwrap_get_key_bool(VCKEY_KEYBOARD_FEEDBACK, true);
vconf_data.sound_feedback = vcwrap_get_key_bool(VCKEY_SOUND_FEEDBACK, true);
vconf_data.lcd_backlight_timeout = vcwrap_get_key_int(VCKEY_LCD_BACKLIGHT_NORMAL, -1);
vconf_data.tts_speed = vcwrap_get_key_int(VCKEY_TTS_SPEED, 0);
- vconf_data.tts_language = vcwrap_get_key_str(VCKEY_TTS_VOICE, NULL);
- vcwrap_update_derived_fields(&(vconf_data.tts_language));
vc_get_key_values();
appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE, display_language_changed_cb, NULL);
vcwrap_set_field_updater_bool(VCKEY_DESCRIPTION, &(vconf_data.read_description));
- vcwrap_set_field_updater_bool(VCKEY_LIST_GRID_INFORMATION, &(vconf_data.read_list_grid_information));
vcwrap_set_field_updater_bool(VCKEY_GRANULARITY, &(vconf_data.granularity_enabled));
vcwrap_set_field_updater_bool(VCKEY_HAPTIC, &(vconf_data.haptic));
vcwrap_set_field_updater_bool(VCKEY_KEYBOARD_FEEDBACK, &(vconf_data.keyboard_feedback));
vcwrap_set_field_updater_bool(VCKEY_SOUND_FEEDBACK, &(vconf_data.sound_feedback));
vcwrap_set_field_updater_int(VCKEY_LCD_BACKLIGHT_NORMAL, &(vconf_data.lcd_backlight_timeout));
vcwrap_set_field_updater_int(VCKEY_TTS_SPEED, &(vconf_data.tts_speed));
- vcwrap_set_field_updater_str(VCKEY_TTS_VOICE, &(vconf_data.tts_language));
DEBUG("---------------------- VCONF_init END ----------------------\n\n");
vcwrap_unset_field_updater_bool(VCKEY_HAPTIC);
vcwrap_unset_field_updater_bool(VCKEY_GRANULARITY);
vcwrap_unset_field_updater_bool(VCKEY_DESCRIPTION);
- vcwrap_unset_field_updater_bool(VCKEY_LIST_GRID_INFORMATION);
vcwrap_unset_field_updater_bool(VCKEY_SOUND_FEEDBACK);
vcwrap_unset_field_updater_int(VCKEY_LCD_BACKLIGHT_NORMAL);
vcwrap_unset_field_updater_int(VCKEY_TTS_SPEED);
- vcwrap_unset_field_updater_str(VCKEY_TTS_VOICE);
-
- free(vconf_data->tts_language);
- vconf_data->tts_language = NULL;
}
bool vc_get_read_description(void)
return vc_get_instance()->read_description;
}
-bool vc_get_read_list_grid_information(void)
-{
- return vc_get_instance()->read_list_grid_information;
-}
-
bool vc_get_haptic(void)
{
return vc_get_instance()->haptic;
{
return vc_get_instance()->tts_speed;
}
-
-int vc_get_tts_voice_type(void)
-{
- return vc_get_instance()->tts_voice_type;
-}
-
-const char *vc_get_tts_language(void)
-{
- return vc_get_instance()->tts_language;
-}
-
-void vc_tts_voice_validator_register(TTSVoiceValidatorCb cb)
-{
- VConfData *vconf_data = vc_get_instance();
-
- vconf_data->tts_voice_validator_cb = cb;
- if (cb)
- vcwrap_update_derived_fields(&(vconf_data->tts_language));
-}
return mode;
}
-Eina_Bool object_get_position_in_table(AtspiAccessible *object, int *row, int *column, gchar **table_unique_id, int *table_row_count, int *table_column_count, gchar **table_caption)
-{
- if (!object || !row || !column || !table_unique_id)
- return EINA_FALSE;
-
- AtspiTableCell *table_cell = atspi_accessible_get_table_cell(object);
- if (!table_cell) {
- DEBUG("object is not a table cell");
- return EINA_FALSE;
- }
-
- int row_span, column_span;
- GError *err = NULL;
- atspi_table_cell_get_row_column_span(table_cell, row, column, &row_span, &column_span, &err);
-
- Eina_Bool status = EINA_FALSE;
- AtspiAccessible *table_accessible = NULL;
- AtspiTable *table = NULL;
-
- if (err) {
- ERROR("failed to get cell position in table");
- GERROR_CHECK(err);
- goto end;
- }
-
- if (*row < 0 || *column < 0) {
- ERROR("invalid cell position in table");
- goto end;
- }
-
- table_accessible = atspi_table_cell_get_table(table_cell, NULL);
- table = atspi_accessible_get_table_iface(table_accessible); // null is safe
-
- if (!table_accessible || !table) {
- ERROR("table cell object is not in table");
- goto end;
- }
-
- if (table_row_count && table_column_count && table_caption) {
- *table_row_count = atspi_table_get_n_rows(table, NULL);
-
- if (*table_row_count < 0) {
- ERROR("invalid row count in table");
- goto end;
- }
-
- *table_column_count = atspi_table_get_n_columns(table, NULL);
-
- if (*table_column_count < 0) {
- ERROR("invalid column count in table");
- goto end;
- }
-
- AtspiAccessible* caption_object = atspi_table_get_caption(table, NULL);
- if (caption_object) {
- *table_caption = atspi_accessible_get_name(caption_object, NULL);
- g_object_unref(caption_object);
- }
- }
-
- *table_unique_id = atspi_accessible_get_unique_id(table_accessible, NULL);
-
- status = EINA_TRUE;
-
-end:
- if (table) g_object_unref(table);
- if (table_accessible) g_object_unref(table_accessible);
- if (table_cell) g_object_unref(table_cell);
-
- return status;
-}
-
object_state is_object_showing_and_not_defunct(AtspiAccessible *obj, char *object_name)
{
if (!obj) DEBUG("%s is null", object_name);