2013-07-20 01:51:56 -07:00
|
|
|
#include <Elementary.h>
|
|
|
|
#include "common.h"
|
|
|
|
|
2014-02-04 05:45:41 -08:00
|
|
|
typedef struct statusbar_s
|
2013-07-20 01:51:56 -07:00
|
|
|
{
|
|
|
|
Evas_Object *layout;
|
2013-09-18 09:43:10 -07:00
|
|
|
Eina_Stringshare *group_name;
|
2013-09-23 10:29:46 -07:00
|
|
|
int cur_line;
|
|
|
|
int max_line;
|
2014-02-04 05:45:41 -08:00
|
|
|
} stats_data;
|
|
|
|
|
|
|
|
stats_data *g_sd = NULL;
|
2013-07-20 01:51:56 -07:00
|
|
|
|
|
|
|
void
|
2014-02-04 05:45:41 -08:00
|
|
|
stats_line_num_update(int cur_line, int max_line)
|
2013-07-20 01:51:56 -07:00
|
|
|
{
|
2014-02-04 05:45:41 -08:00
|
|
|
stats_data *sd = g_sd;
|
|
|
|
|
2013-07-20 01:51:56 -07:00
|
|
|
char buf[128];
|
2013-10-17 21:41:47 -07:00
|
|
|
snprintf(buf, sizeof(buf),
|
|
|
|
"<align=right>Line [<style=glow><color=#3399ff>%d</color></style>:<style=glow><color=#3399ff>%d</color></style>]</align>", cur_line, max_line);
|
2013-07-20 01:51:56 -07:00
|
|
|
elm_object_part_text_set(sd->layout, "elm.text.line", buf);
|
2013-09-23 10:29:46 -07:00
|
|
|
sd->cur_line = cur_line;
|
|
|
|
sd->max_line = max_line;
|
2013-07-20 01:51:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-02-17 21:42:30 -08:00
|
|
|
stats_edc_group_update(Eina_Stringshare *group_name)
|
2013-07-20 01:51:56 -07:00
|
|
|
{
|
2014-02-04 05:45:41 -08:00
|
|
|
stats_data *sd = g_sd;
|
|
|
|
|
2014-02-04 00:55:56 -08:00
|
|
|
char buf[1028];
|
2014-02-04 02:18:43 -08:00
|
|
|
snprintf(buf, sizeof(buf), "<align=right>Group [<style=glow><color=#3399ff>%s</color></style></align>", group_name);
|
|
|
|
elm_object_part_text_set(sd->layout, "elm.text.group_name", buf);
|
2013-09-18 09:43:10 -07:00
|
|
|
sd->group_name = eina_stringshare_add(group_name);
|
2013-07-20 01:51:56 -07:00
|
|
|
}
|
|
|
|
|
2014-02-04 05:45:41 -08:00
|
|
|
Evas_Object *
|
2014-01-29 09:45:10 -08:00
|
|
|
stats_init(Evas_Object *parent)
|
2013-07-20 01:51:56 -07:00
|
|
|
{
|
|
|
|
stats_data *sd = calloc(1, sizeof(stats_data));
|
2014-07-27 21:40:58 -07:00
|
|
|
if (!sd)
|
|
|
|
{
|
|
|
|
EINA_LOG_ERR("Failed to allocate Memory!");
|
|
|
|
return NULL;
|
|
|
|
}
|
2014-02-04 05:45:41 -08:00
|
|
|
g_sd = sd;
|
2013-07-20 01:51:56 -07:00
|
|
|
|
|
|
|
Evas_Object *layout = elm_layout_add(parent);
|
|
|
|
elm_layout_file_set(layout, EDJE_PATH, "statusbar_layout");
|
|
|
|
|
|
|
|
sd->layout = layout;
|
|
|
|
|
2014-02-04 05:45:41 -08:00
|
|
|
stats_cursor_pos_update(0, 0, 0, 0);
|
2014-02-17 21:42:30 -08:00
|
|
|
stats_edc_group_update(NULL);
|
2013-07-20 01:51:56 -07:00
|
|
|
|
2014-02-04 05:45:41 -08:00
|
|
|
return layout;
|
2013-07-20 01:51:56 -07:00
|
|
|
}
|
|
|
|
|
2014-02-04 05:45:41 -08:00
|
|
|
Eina_Stringshare *stats_group_name_get()
|
2013-09-18 09:43:10 -07:00
|
|
|
{
|
2014-02-04 05:45:41 -08:00
|
|
|
stats_data *sd = g_sd;
|
2013-09-18 09:43:10 -07:00
|
|
|
return sd->group_name;
|
|
|
|
}
|
|
|
|
|
2013-07-20 01:51:56 -07:00
|
|
|
void
|
2014-02-04 05:45:41 -08:00
|
|
|
stats_term()
|
2013-07-20 01:51:56 -07:00
|
|
|
{
|
2014-02-04 05:45:41 -08:00
|
|
|
stats_data *sd = g_sd;
|
2013-09-18 09:43:10 -07:00
|
|
|
eina_stringshare_del(sd->group_name);
|
2013-07-20 01:51:56 -07:00
|
|
|
free(sd);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-02-04 05:45:41 -08:00
|
|
|
stats_info_msg_update(const char *msg)
|
2013-07-20 01:51:56 -07:00
|
|
|
{
|
2014-01-29 09:45:10 -08:00
|
|
|
if (!config_stats_bar_get()) return;
|
2013-07-20 13:30:49 -07:00
|
|
|
|
2014-02-04 05:45:41 -08:00
|
|
|
stats_data *sd = g_sd;
|
2013-07-20 01:51:56 -07:00
|
|
|
elm_object_part_text_set(sd->layout, "elm.text.info_msg", msg);
|
|
|
|
elm_object_signal_emit(sd->layout, "elm,action,info_msg,show", "");
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-02-04 05:45:41 -08:00
|
|
|
stats_view_size_update()
|
2013-07-20 01:51:56 -07:00
|
|
|
{
|
2014-02-04 05:45:41 -08:00
|
|
|
stats_data *sd = g_sd;
|
|
|
|
|
2013-07-20 01:51:56 -07:00
|
|
|
Evas_Coord w, h;
|
2014-01-29 09:45:10 -08:00
|
|
|
config_view_size_get(&w, &h);
|
2013-07-20 01:51:56 -07:00
|
|
|
|
|
|
|
char buf[128];
|
2013-10-17 21:41:47 -07:00
|
|
|
snprintf(buf, sizeof(buf),
|
|
|
|
"Size [<style=glow><color=#3399ff>%d</color></style>x<style=glow><color=#3399ff>%d</color></style>]", w, h);
|
2013-09-20 04:20:26 -07:00
|
|
|
|
2013-07-20 01:51:56 -07:00
|
|
|
elm_object_part_text_set(sd->layout, "elm.text.view_size", buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2014-02-04 05:45:41 -08:00
|
|
|
stats_cursor_pos_update(Evas_Coord x, Evas_Coord y, float rel_x, float rel_y)
|
2013-07-20 01:51:56 -07:00
|
|
|
{
|
2014-02-04 05:45:41 -08:00
|
|
|
stats_data *sd = g_sd;
|
2013-09-20 09:33:42 -07:00
|
|
|
char buf[250];
|
2013-10-17 21:41:47 -07:00
|
|
|
snprintf(buf, sizeof(buf),
|
|
|
|
"Cursor [<style=glow><color=#3399ff>%d</color></style>,<style=glow><color=#3399ff>%d</color></style>] [<style=glow><color=#3399ff>%0.2f</color></style>,<style=glow><color=#3399ff>%0.2f</color></style>]", x, y, rel_x, rel_y);
|
2013-09-20 04:20:26 -07:00
|
|
|
|
2013-07-20 01:51:56 -07:00
|
|
|
elm_object_part_text_set(sd->layout, "elm.text.cur_pos", buf);
|
|
|
|
}
|