if (wd->overlay)
edje_object_part_swallow(wd->base, "elm.swallow.content", wd->overlay);
-// FIXME: if i don't do this, bg doesnt calc correctly. why?
+ // FIXME: if i don't do this, bg doesnt calc correctly. why?
evas_object_geometry_get(wd->base, NULL, NULL, &w, &h);
evas_object_resize(wd->base, w, h);
}
switch (wd->option)
{
case ELM_BG_OPTION_CENTER:
- fw = nw = iw;
- fh = nh = ih;
- nx = ((bw - fw) / 2);
- ny = ((bh - fh) / 2);
- mw = iw;
- mh = ih;
- break;
+ fw = nw = iw;
+ fh = nh = ih;
+ nx = ((bw - fw) / 2);
+ ny = ((bh - fh) / 2);
+ mw = iw;
+ mh = ih;
+ break;
case ELM_BG_OPTION_SCALE:
- fw = bw;
- fh = ((ih * fw) / iw);
- if (fh < bh)
- {
- fh = bh;
- fw = ((iw * fh) / ih);
- }
- fx = ((bw - fw) / 2);
- fy = ((bh - fh) / 2);
- break;
+ fw = bw;
+ fh = ((ih * fw) / iw);
+ if (fh < bh)
+ {
+ fh = bh;
+ fw = ((iw * fh) / ih);
+ }
+ fx = ((bw - fw) / 2);
+ fy = ((bh - fh) / 2);
+ break;
case ELM_BG_OPTION_TILE:
- fw = iw;
- fh = ih;
- break;
+ fw = iw;
+ fh = ih;
+ break;
case ELM_BG_OPTION_STRETCH:
default:
- fw = bw;
- fh = bh;
- break;
+ fw = bw;
+ fh = bh;
+ break;
}
evas_object_move(wd->img, nx, ny);
Widget_Data *wd;
ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
-
+
ELM_SET_WIDTYPE(widtype, "bg");
elm_widget_type_set(obj, "bg");
elm_widget_sub_object_add(parent, obj);
{
wd->img = evas_object_image_add(evas_object_evas_get(wd->base));
if ((wd->load_opts.w > 0) && (wd->load_opts.h > 0))
- evas_object_image_load_size_set(wd->img, wd->load_opts.w, wd->load_opts.h);
+ evas_object_image_load_size_set(wd->img, wd->load_opts.w, wd->load_opts.h);
evas_object_image_file_set(wd->img, file, group);
}
evas_object_repeat_events_set(wd->img, EINA_TRUE);
if (!wd) return;
if (wd->overlay)
{
- evas_object_del(wd->overlay);
- wd->overlay = NULL;
+ evas_object_del(wd->overlay);
+ wd->overlay = NULL;
}
if (overlay)
{
wd->load_opts.h = h;
if (!wd->img) return;
if (!(((p = strrchr(wd->file, '.'))) && (!strcasecmp(p, ".edj"))))
- evas_object_image_load_size_set(wd->img, w, h);
+ evas_object_image_load_size_set(wd->img, w, h);
}
Ecore_Animator *animator;
struct
- {
- Evas_Object_Box_Layout layout;
- void *data;
- void(*free_data)(void *data);
- } start, end;
+ {
+ Evas_Object_Box_Layout layout;
+ void *data;
+ void(*free_data)(void *data);
+ } start, end;
void(*transition_end_cb)(void *data);
void *transition_end_data;
{
Evas_Object *obj;
struct
- {
- Evas_Coord x, y, w, h;
- } start, end;
+ {
+ Evas_Coord x, y, w, h;
+ } start, end;
};
static const char *widtype = NULL;
static void
_del_pre_hook(Evas_Object *obj)
{
- Widget_Data *wd = elm_widget_data_get(obj);
+ Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
- evas_object_event_callback_del_full
- (wd->box, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
- evas_object_box_remove_all(wd->box, 0);
+ evas_object_event_callback_del_full
+ (wd->box, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
+ evas_object_box_remove_all(wd->box, 0);
}
static void
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
_els_box_layout(o, priv, wd->horizontal, wd->homogeneous,
- elm_widget_mirrored_get(obj));
+ elm_widget_mirrored_get(obj));
}
static Eina_Bool
const double curtime = ecore_loop_time_get();
layout_data->duration =
- layout_data->duration - (curtime - layout_data->initial_time);
+ layout_data->duration - (curtime - layout_data->initial_time);
layout_data->initial_time = curtime;
evas_object_geometry_get(obj, &x, &y, &w, &h);
Transition_Animation_Data *tad;
EINA_LIST_FREE(layout_data->objs, tad)
- free(tad);
+ free(tad);
EINA_LIST_FOREACH(priv->children, l, opt)
{
if (!tad)
{
EINA_LIST_FREE(layout_data->objs, tad)
- free(tad);
+ free(tad);
layout_data->objs = NULL;
return EINA_FALSE;
}
layout_data->initial_time = ecore_loop_time_get();
if (!_transition_layout_load_children_list(priv, layout_data))
- return EINA_FALSE;
+ return EINA_FALSE;
_transition_layout_calculate_coords(obj, priv, layout_data);
evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
evas_object_smart_callback_add(obj, SIG_CHILD_REMOVED,
_transition_layout_child_removed, layout_data);
if (!layout_data->animator)
- layout_data->animator = ecore_animator_add(transition_animation_cb, obj);
+ layout_data->animator = ecore_animator_add(transition_animation_cb, obj);
layout_data->animation_ended = EINA_FALSE;
return EINA_TRUE;
}
}
if (layout_data->transition_end_cb)
- layout_data->transition_end_cb(layout_data->transition_end_data);
+ layout_data->transition_end_cb(layout_data->transition_end_data);
}
static void
Widget_Data *wd;
ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
-
+
ELM_SET_WIDTYPE(widtype, "box");
elm_widget_type_set(obj, "box");
elm_widget_sub_object_add(parent, obj);
wd->box = evas_object_box_add(e);
/*evas_object_box_layout_set(wd->box, evas_object_box_layout_vertical,
- NULL, NULL);*/
+ NULL, NULL);*/
evas_object_box_layout_set(wd->box, _layout, obj, NULL);
evas_object_event_callback_add(wd->box, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints, obj);
+ _changed_size_hints, obj);
elm_widget_resize_object_set(obj, wd->box);
evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
evas_object_smart_calculate(wd->box);
/*if (wd->horizontal)
{
- if (wd->homogeneous)
- evas_object_box_layout_set(wd->box,
- evas_object_box_layout_homogeneous_horizontal, NULL, NULL);
- else
- evas_object_box_layout_set(wd->box, evas_object_box_layout_horizontal,
- NULL, NULL);
+ if (wd->homogeneous)
+ evas_object_box_layout_set(wd->box,
+ evas_object_box_layout_homogeneous_horizontal, NULL, NULL);
+ else
+ evas_object_box_layout_set(wd->box, evas_object_box_layout_horizontal,
+ NULL, NULL);
}
- else
+ else
{
- if (wd->homogeneous)
- evas_object_box_layout_set(wd->box,
- evas_object_box_layout_homogeneous_vertical, NULL, NULL);
- else
- evas_object_box_layout_set(wd->box, evas_object_box_layout_horizontal,
- NULL, NULL);
+ if (wd->homogeneous)
+ evas_object_box_layout_set(wd->box,
+ evas_object_box_layout_homogeneous_vertical, NULL, NULL);
+ else
+ evas_object_box_layout_set(wd->box, evas_object_box_layout_horizontal,
+ NULL, NULL);
}*/
}
evas_object_smart_calculate(wd->box);
/*if (wd->horizontal)
{
- if (wd->homogeneous)
- evas_object_box_layout_set(wd->box,
- evas_object_box_layout_homogeneous_horizontal, NULL, NULL);
- else
- evas_object_box_layout_set(wd->box, evas_object_box_layout_horizontal,
- NULL, NULL);
+ if (wd->homogeneous)
+ evas_object_box_layout_set(wd->box,
+ evas_object_box_layout_homogeneous_horizontal, NULL, NULL);
+ else
+ evas_object_box_layout_set(wd->box, evas_object_box_layout_horizontal,
+ NULL, NULL);
}
- else
+ else
{
- if (wd->homogeneous)
- evas_object_box_layout_set(wd->box,
- evas_object_box_layout_homogeneous_vertical, NULL, NULL);
- else
- evas_object_box_layout_set(wd->box, evas_object_box_layout_horizontal,
- NULL, NULL);
+ if (wd->homogeneous)
+ evas_object_box_layout_set(wd->box,
+ evas_object_box_layout_homogeneous_vertical, NULL, NULL);
+ else
+ evas_object_box_layout_set(wd->box, evas_object_box_layout_horizontal,
+ NULL, NULL);
}*/
}
if (box_data->animation_ended)
{
- box_data->end.layout(obj, priv, box_data->end.data);
- return;
+ box_data->end.layout(obj, priv, box_data->end.data);
+ return;
}
if (!box_data->animator)
{
if (!_transition_layout_animation_start(obj, priv, box_data,
- _transition_animation))
- return;
+ _transition_animation))
+ return;
}
else
{
}
if ((curtime >= box_data->duration + box_data->initial_time))
- _transition_layout_animation_stop(box_data);
+ _transition_layout_animation_stop(box_data);
else
- _transition_layout_animation_exec(obj, priv, box_data, curtime);
+ _transition_layout_animation_exec(obj, priv, box_data, curtime);
}
/**
*/
EAPI Elm_Box_Transition *
elm_box_transition_new(const double duration,
- Evas_Object_Box_Layout start_layout, void *start_layout_data,
- void(*start_layout_free_data)(void *data),
- Evas_Object_Box_Layout end_layout, void *end_layout_data,
- void(*end_layout_free_data)(void *data),
- void(*transition_end_cb)(void *data),
- void *transition_end_data)
+ Evas_Object_Box_Layout start_layout, void *start_layout_data,
+ void(*start_layout_free_data)(void *data),
+ Evas_Object_Box_Layout end_layout, void *end_layout_data,
+ void(*end_layout_free_data)(void *data),
+ void(*transition_end_cb)(void *data),
+ void *transition_end_data)
{
Elm_Box_Transition *box_data;
box_data = calloc(1, sizeof(Elm_Box_Transition));
if (!box_data)
- return NULL;
+ return NULL;
box_data->start.layout = start_layout;
box_data->start.data = start_layout_data;
Transition_Animation_Data *tad;
Elm_Box_Transition *box_data = data;
if ((box_data->start.free_data) && (box_data->start.data))
- box_data->start.free_data(box_data->start.data);
+ box_data->start.free_data(box_data->start.data);
if ((box_data->end.free_data) && (box_data->end.data))
- box_data->end.free_data(box_data->end.data);
+ box_data->end.free_data(box_data->end.data);
EINA_LIST_FREE(box_data->objs, tad)
free(tad);
evas_object_event_callback_del(box_data->box, EVAS_CALLBACK_RESIZE, _transition_layout_obj_resize_cb);
#define SIG_CLICKED "clicked"
static const Evas_Smart_Cb_Description _signals[] =
{
- {SIG_CLICKED, ""},
- {NULL, NULL}
+ {SIG_CLICKED, ""},
+ {NULL, NULL}
};
static void
if (wd->content)
{
edje_object_part_swallow(wd->bbl, "elm.swallow.content", wd->content);
- edje_object_message_signal_process(wd->bbl);
+ edje_object_message_signal_process(wd->bbl);
}
if (wd->icon)
edje_object_signal_emit(wd->bbl, "elm,state,icon,visible", "elm");
Evas_Object *sub = event_info;
if (!wd) return;
evas_object_event_callback_del_full(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints, obj);
+ _changed_size_hints, obj);
if (sub == wd->content) wd->content = NULL;
else if (sub == wd->icon)
{
- edje_object_signal_emit(wd->bbl, "elm,state,icon,hidden", "elm");
- wd->icon = NULL;
- edje_object_message_signal_process(wd->bbl);
+ edje_object_signal_emit(wd->bbl, "elm,state,icon,hidden", "elm");
+ wd->icon = NULL;
+ edje_object_message_signal_process(wd->bbl);
}
_sizing_eval(obj);
}
Widget_Data *wd;
ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
-
+
ELM_SET_WIDTYPE(widtype, "bubble");
elm_widget_type_set(obj, "bubble");
elm_widget_sub_object_add(parent, obj);
wd->content = content;
if (content)
{
- elm_widget_sub_object_add(obj, content);
- evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints, obj);
- edje_object_part_swallow(wd->bbl, "elm.swallow.content", content);
+ elm_widget_sub_object_add(obj, content);
+ evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+ _changed_size_hints, obj);
+ edje_object_part_swallow(wd->bbl, "elm.swallow.content", content);
}
_sizing_eval(obj);
}
wd->icon = icon;
if (icon)
{
- elm_widget_sub_object_add(obj, icon);
- edje_object_part_swallow(wd->bbl, "elm.swallow.icon", icon);
- evas_object_event_callback_add(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints, obj);
- edje_object_signal_emit(wd->bbl, "elm,state,icon,visible", "elm");
- edje_object_message_signal_process(wd->bbl);
+ elm_widget_sub_object_add(obj, icon);
+ edje_object_part_swallow(wd->bbl, "elm.swallow.icon", icon);
+ evas_object_event_callback_add(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+ _changed_size_hints, obj);
+ edje_object_signal_emit(wd->bbl, "elm,state,icon,visible", "elm");
+ edje_object_message_signal_process(wd->bbl);
}
_sizing_eval(obj);
}
Widget_Data *wd;
ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
-
+
ELM_SET_WIDTYPE(widtype, "button");
elm_widget_type_set(obj, "button");
elm_widget_sub_object_add(parent, obj);
typedef enum _Day_Color // EINA_DEPRECATED
{
- DAY_WEEKDAY = 0,
- DAY_SATURDAY = 1,
- DAY_SUNDAY = 2
+ DAY_WEEKDAY = 0,
+ DAY_SATURDAY = 1,
+ DAY_SUNDAY = 2
} Day_Color;
typedef struct _Widget_Data Widget_Data;
static int _days_in_month[2][12] =
{
- {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
- {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
+ {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
+ {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
};
static Elm_Calendar_Mark *
month = time->tm_mon;
year = time->tm_year + 1900;
- return _days_in_month[((!(year % 4)) &&
- ((!(year % 400)) ||
- (year % 100)))]
- [month];
+ return _days_in_month[((!(year % 4)) &&
+ ((!(year % 400)) ||
+ (year % 100)))]
+ [month];
}
static inline void
_text_day_color_update(Widget_Data *wd, int pos)
{
char emission[32];
-
+
switch (wd->day_color[pos])
- {
- case DAY_WEEKDAY:
- snprintf(emission, sizeof(emission), "cit_%i,weekday", pos);
- break;
- case DAY_SATURDAY:
- snprintf(emission, sizeof(emission), "cit_%i,saturday", pos);
- break;
- case DAY_SUNDAY:
- snprintf(emission, sizeof(emission), "cit_%i,sunday", pos);
- break;
- default:
- return;
- }
-
+ {
+ case DAY_WEEKDAY:
+ snprintf(emission, sizeof(emission), "cit_%i,weekday", pos);
+ break;
+ case DAY_SATURDAY:
+ snprintf(emission, sizeof(emission), "cit_%i,saturday", pos);
+ break;
+ case DAY_SUNDAY:
+ snprintf(emission, sizeof(emission), "cit_%i,sunday", pos);
+ break;
+ default:
+ return;
+ }
+
edje_object_signal_emit(wd->calendar, emission, "elm");
}
buf = wd->format_func(&wd->selected_time);
if (buf)
{
- edje_object_part_text_set(wd->calendar, "month_text", buf);
- free(buf);
+ edje_object_part_text_set(wd->calendar, "month_text", buf);
+ free(buf);
}
else
edje_object_part_text_set(wd->calendar, "month_text", "");
// Layout of the calendar is changed for removing the unfilled last row.
wd->first_day_it = first_day.tm_wday;
-
- if ((35 - wd->first_day_it) > (maxdays - 1)) last_row = EINA_FALSE;
-
- if (!last_row)
- {
- char emission[32];
-
- for (i = 0; i < 5; i++)
- {
- snprintf(emission, sizeof(emission), "cseph_%i,row_hide", i);
- edje_object_signal_emit(wd->calendar, emission, "elm");
- }
- snprintf(emission, sizeof(emission), "cseph_%i,row_invisible", 5);
- edje_object_signal_emit(wd->calendar, emission, "elm");
- for (i = 0; i < 35; i++)
- {
- snprintf(emission, sizeof(emission), "cit_%i,cell_expanded", i);
- edje_object_signal_emit(wd->calendar, emission, "elm");
- }
- for (i = 35; i < 42; i++)
- {
- snprintf(emission, sizeof(emission), "cit_%i,cell_invisible", i);
- edje_object_signal_emit(wd->calendar, emission, "elm");
- }
- }
- else
- {
- char emission[32];
-
- for (i = 0; i < 6; i++)
- {
- snprintf(emission, sizeof(emission), "cseph_%i,row_show", i);
- edje_object_signal_emit(wd->calendar, emission, "elm");
- }
- for (i = 0; i < 42; i++)
- {
- snprintf(emission, sizeof(emission), "cit_%i,cell_default", i);
- edje_object_signal_emit(wd->calendar, emission, "elm");
- }
- }
-
+
+ if ((35 - wd->first_day_it) > (maxdays - 1)) last_row = EINA_FALSE;
+
+ if (!last_row)
+ {
+ char emission[32];
+
+ for (i = 0; i < 5; i++)
+ {
+ snprintf(emission, sizeof(emission), "cseph_%i,row_hide", i);
+ edje_object_signal_emit(wd->calendar, emission, "elm");
+ }
+ snprintf(emission, sizeof(emission), "cseph_%i,row_invisible", 5);
+ edje_object_signal_emit(wd->calendar, emission, "elm");
+ for (i = 0; i < 35; i++)
+ {
+ snprintf(emission, sizeof(emission), "cit_%i,cell_expanded", i);
+ edje_object_signal_emit(wd->calendar, emission, "elm");
+ }
+ for (i = 35; i < 42; i++)
+ {
+ snprintf(emission, sizeof(emission), "cit_%i,cell_invisible", i);
+ edje_object_signal_emit(wd->calendar, emission, "elm");
+ }
+ }
+ else
+ {
+ char emission[32];
+
+ for (i = 0; i < 6; i++)
+ {
+ snprintf(emission, sizeof(emission), "cseph_%i,row_show", i);
+ edje_object_signal_emit(wd->calendar, emission, "elm");
+ }
+ for (i = 0; i < 42; i++)
+ {
+ snprintf(emission, sizeof(emission), "cit_%i,cell_default", i);
+ edje_object_signal_emit(wd->calendar, emission, "elm");
+ }
+ }
+
for (i = 0; i < 42; i++)
{
_text_day_color_update(wd, i); // EINA_DEPRECATED
- if ((!day) && (i == first_day.tm_wday)) day = 1;
+ if ((!day) && (i == first_day.tm_wday)) day = 1;
- if ((day == wd->current_time.tm_mday)
- && (mon == wd->current_time.tm_mon)
- && (year == wd->current_time.tm_year))
- _today(wd, i);
+ if ((day == wd->current_time.tm_mday)
+ && (mon == wd->current_time.tm_mon)
+ && (year == wd->current_time.tm_year))
+ _today(wd, i);
- if (day == wd->selected_time.tm_mday)
- {
- if ((wd->selected_it > -1) && (wd->selected_it != i))
- _unselect(wd, wd->selected_it);
+ if (day == wd->selected_time.tm_mday)
+ {
+ if ((wd->selected_it > -1) && (wd->selected_it != i))
+ _unselect(wd, wd->selected_it);
- if (wd->selection_enabled) _select(wd, i);
+ if (wd->selection_enabled) _select(wd, i);
- wd->selected_it = i;
- }
+ wd->selected_it = i;
+ }
- if ((day) && (day <= maxdays))
- snprintf(day_s, sizeof(day_s), "%i", day++);
- else
+ if ((day) && (day <= maxdays))
+ snprintf(day_s, sizeof(day_s), "%i", day++);
+ else
day_s[0] = 0;
- snprintf(part, sizeof(part), "cit_%i.text", i);
- edje_object_part_text_set(wd->calendar, part, day_s);
- /* Clear previous marks */
- _cit_mark(wd->calendar, i, "clear");
+ snprintf(part, sizeof(part), "cit_%i.text", i);
+ edje_object_part_text_set(wd->calendar, part, day_s);
+ /* Clear previous marks */
+ _cit_mark(wd->calendar, i, "clear");
}
/* Set marks */
EINA_LIST_FOREACH(wd->marks, l, mark)
{
- struct tm *mtime = &mark->mark_time;
- int mon = wd->selected_time.tm_mon;
- int year = wd->selected_time.tm_year;
- int mday_it = mtime->tm_mday + wd->first_day_it - 1;
-
- switch (mark->repeat)
- {
- case ELM_CALENDAR_UNIQUE:
- if ((mtime->tm_mon == mon) && (mtime->tm_year == year))
- _cit_mark(wd->calendar, mday_it, mark->mark_type);
- break;
- case ELM_CALENDAR_DAILY:
- if (((mtime->tm_year == year) && (mtime->tm_mon < mon)) ||
- (mtime->tm_year < year))
- day = 1;
- else if ((mtime->tm_year == year) && (mtime->tm_mon == mon))
- day = mtime->tm_mday;
- else
- break;
- for (; day <= maxdays; day++)
- _cit_mark(wd->calendar, day + wd->first_day_it - 1,
- mark->mark_type);
- break;
- case ELM_CALENDAR_WEEKLY:
- if (((mtime->tm_year == year) && (mtime->tm_mon < mon)) ||
- (mtime->tm_year < year))
- day = 1;
- else if ((mtime->tm_year == year) && (mtime->tm_mon == mon))
- day = mtime->tm_mday;
- else
- break;
- for (; day <= maxdays; day++)
- if (mtime->tm_wday == _weekday_get(wd->first_day_it, day))
- _cit_mark(wd->calendar, day + wd->first_day_it - 1,
- mark->mark_type);
- break;
- case ELM_CALENDAR_MONTHLY:
- if (((mtime->tm_year < year) ||
- ((mtime->tm_year == year) && (mtime->tm_mon <= mon))) &&
- (mtime->tm_mday <= maxdays))
- _cit_mark(wd->calendar, mday_it, mark->mark_type);
- break;
- case ELM_CALENDAR_ANNUALLY:
- if ((mtime->tm_year <= year) && (mtime->tm_mon == mon) &&
- (mtime->tm_mday <= maxdays))
- _cit_mark(wd->calendar, mday_it, mark->mark_type);
- break;
- }
+ struct tm *mtime = &mark->mark_time;
+ int mon = wd->selected_time.tm_mon;
+ int year = wd->selected_time.tm_year;
+ int mday_it = mtime->tm_mday + wd->first_day_it - 1;
+
+ switch (mark->repeat)
+ {
+ case ELM_CALENDAR_UNIQUE:
+ if ((mtime->tm_mon == mon) && (mtime->tm_year == year))
+ _cit_mark(wd->calendar, mday_it, mark->mark_type);
+ break;
+ case ELM_CALENDAR_DAILY:
+ if (((mtime->tm_year == year) && (mtime->tm_mon < mon)) ||
+ (mtime->tm_year < year))
+ day = 1;
+ else if ((mtime->tm_year == year) && (mtime->tm_mon == mon))
+ day = mtime->tm_mday;
+ else
+ break;
+ for (; day <= maxdays; day++)
+ _cit_mark(wd->calendar, day + wd->first_day_it - 1,
+ mark->mark_type);
+ break;
+ case ELM_CALENDAR_WEEKLY:
+ if (((mtime->tm_year == year) && (mtime->tm_mon < mon)) ||
+ (mtime->tm_year < year))
+ day = 1;
+ else if ((mtime->tm_year == year) && (mtime->tm_mon == mon))
+ day = mtime->tm_mday;
+ else
+ break;
+ for (; day <= maxdays; day++)
+ if (mtime->tm_wday == _weekday_get(wd->first_day_it, day))
+ _cit_mark(wd->calendar, day + wd->first_day_it - 1,
+ mark->mark_type);
+ break;
+ case ELM_CALENDAR_MONTHLY:
+ if (((mtime->tm_year < year) ||
+ ((mtime->tm_year == year) && (mtime->tm_mon <= mon))) &&
+ (mtime->tm_mday <= maxdays))
+ _cit_mark(wd->calendar, mday_it, mark->mark_type);
+ break;
+ case ELM_CALENDAR_ANNUALLY:
+ if ((mtime->tm_year <= year) && (mtime->tm_mon == mon) &&
+ (mtime->tm_mday <= maxdays))
+ _cit_mark(wd->calendar, mday_it, mark->mark_type);
+ break;
+ }
}
}
for (i = 0; i < 7; i++)
{
- part[3] = i + '0';
- edje_object_part_text_set(wd->calendar, part, wd->weekdays[i]);
+ part[3] = i + '0';
+ edje_object_part_text_set(wd->calendar, part, wd->weekdays[i]);
}
}
if (wd->marks)
{
- EINA_LIST_FREE(wd->marks, mark)
- {
- _mark_free(mark);
- }
+ EINA_LIST_FREE(wd->marks, mark)
+ {
+ _mark_free(mark);
+ }
}
for (i = 0; i < 7; i++)
if (!wd) return;
if (elm_widget_focus_get(obj))
{
- edje_object_signal_emit(wd->calendar, "elm,action,focus", "elm");
- evas_object_focus_set(wd->calendar, EINA_TRUE);
+ edje_object_signal_emit(wd->calendar, "elm,action,focus", "elm");
+ evas_object_focus_set(wd->calendar, EINA_TRUE);
}
else
{
- edje_object_signal_emit(wd->calendar, "elm,action,unfocus", "elm");
- evas_object_focus_set(wd->calendar, EINA_FALSE);
+ edje_object_signal_emit(wd->calendar, "elm,action,unfocus", "elm");
+ evas_object_focus_set(wd->calendar, EINA_FALSE);
}
}
wd->selected_time.tm_mon += delta;
if (wd->selected_time.tm_mon < 0)
{
- if (wd->selected_time.tm_year == wd->year_min)
- {
- wd->selected_time.tm_mon++;
- return EINA_FALSE;
- }
- wd->selected_time.tm_mon = 11;
- wd->selected_time.tm_year--;
+ if (wd->selected_time.tm_year == wd->year_min)
+ {
+ wd->selected_time.tm_mon++;
+ return EINA_FALSE;
+ }
+ wd->selected_time.tm_mon = 11;
+ wd->selected_time.tm_year--;
}
else if (wd->selected_time.tm_mon > 11)
{
- if (wd->selected_time.tm_year == wd->year_max)
- {
- wd->selected_time.tm_mon--;
- return EINA_FALSE;
- }
- wd->selected_time.tm_mon = 0;
- wd->selected_time.tm_year++;
+ if (wd->selected_time.tm_year == wd->year_max)
+ {
+ wd->selected_time.tm_mon--;
+ return EINA_FALSE;
+ }
+ wd->selected_time.tm_mon = 0;
+ wd->selected_time.tm_year++;
}
maxdays = _maxdays_get(&wd->selected_time);
int day;
Widget_Data *wd = elm_widget_data_get(obj);
if ((!wd) || (!wd->selection_enabled))
- return;
+ return;
day = _get_item_day(obj, sel_it);
if (!day)
int sel_it;
Widget_Data *wd = elm_widget_data_get(data);
if ((!wd) || (!wd->selection_enabled))
- return;
+ return;
sel_it = atoi(source);
_update_sel_it(data, sel_it);
static inline int
_time_to_next_day(struct tm *t)
{
- return ((((24 - t->tm_hour) * 60) - t->tm_min) * 60) - t->tm_sec;
+ return ((((24 - t->tm_hour) * 60) - t->tm_min) * 60) - t->tm_sec;
}
static Eina_Bool
ecore_timer_interval_set(wd->update_timer, t);
if ((wd->current_time.tm_mon != wd->selected_time.tm_mon) ||
- (wd->current_time.tm_year!= wd->selected_time.tm_year))
+ (wd->current_time.tm_year!= wd->selected_time.tm_year))
return ECORE_CALLBACK_RENEW;
day = wd->current_time.tm_mday + wd->first_day_it - 1;
Evas *e;
ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
-
+
ELM_SET_WIDTYPE(widtype, "calendar");
elm_widget_type_set(obj, "calendar");
elm_widget_sub_object_add(parent, obj);
/* If we failed getting day, get a default value */
wd->weekdays[i] = _days_abbrev[i];
WRN("Failed getting weekday name for '%s' from locale.",
- _days_abbrev[i]);
+ _days_abbrev[i]);
}
weekday += 86400; /* Advance by a day */
}
/**
* Set a text color to the saturday color.
- *
+ *
* Deprecated. use elm_calendar_mark_add() instead like:
- *
+ *
* @code
* struct tm t = { 0, 0, 12, 6, 0, 0, 5, 5, -1 };
* elm_calendar_mark_add(obj, "sat", &t, ELM_CALENDAR_WEEKLY);
* @endcode
- *
+ *
* @param obj The calendar object
* @param pos The text position
*
EINA_DEPRECATED EAPI void
elm_calendar_text_saturday_color_set(Evas_Object *obj, int pos)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- _text_day_color_set(wd, DAY_SATURDAY, pos);
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ _text_day_color_set(wd, DAY_SATURDAY, pos);
}
/**
* Set a text color to the sunday color.
*
* Deprecated. use elm_calendar_mark_add() instead like:
- *
+ *
* @code
* struct tm t = { 0, 0, 12, 7, 0, 0, 6, 6, -1 };
* elm_calendar_mark_add(obj, "sun", &t, ELM_CALENDAR_WEEKLY);
* @endcode
- *
+ *
* @param obj The calendar object
* @param pos The text position
*
EINA_DEPRECATED EAPI void
elm_calendar_text_sunday_color_set(Evas_Object *obj, int pos)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- _text_day_color_set(wd, DAY_SUNDAY, pos);
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ _text_day_color_set(wd, DAY_SUNDAY, pos);
}
/**
* Set a text color to the weekday color.
*
* Deprecated. use elm_calendar_mark_add() instead like:
- *
+ *
* @code
* struct tm t = { 0, 0, 12, 1, 0, 0, 0, 0, -1 };
- *
+ *
* elm_calendar_mark_add(obj, "week", &t, ELM_CALENDAR_WEEKLY); // monday
* t.tm_tm_mday++; t.tm_wday++; t.tm_yday++;
* elm_calendar_mark_add(obj, "week", &t, ELM_CALENDAR_WEEKLY); // tuesday
* t.tm_tm_mday++; t.tm_wday++; t.tm_yday++;
* elm_calendar_mark_add(obj, "week", &t, ELM_CALENDAR_WEEKLY); // friday
* @endcode
- *
+ *
* @param obj The calendar object
* @param pos The text position
*
EINA_DEPRECATED EAPI void
elm_calendar_text_weekday_color_set(Evas_Object *obj, int pos)
{
- ELM_CHECK_WIDTYPE(obj, widtype);
- Widget_Data *wd = elm_widget_data_get(obj);
- if (!wd) return;
- _text_day_color_set(wd, DAY_WEEKDAY, pos);
+ ELM_CHECK_WIDTYPE(obj, widtype);
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ _text_day_color_set(wd, DAY_WEEKDAY, pos);
}
static const char SIG_CHANGED[] = "changed";
static const Evas_Smart_Cb_Description _signals[] = {
- {SIG_CHANGED, ""},
- {NULL, NULL}
+ {SIG_CHANGED, ""},
+ {NULL, NULL}
};
static Eina_Bool
if (!wd) return;
if (elm_widget_focus_get(obj))
{
- edje_object_signal_emit(wd->chk, "elm,action,focus", "elm");
- evas_object_focus_set(wd->chk, EINA_TRUE);
+ edje_object_signal_emit(wd->chk, "elm,action,focus", "elm");
+ evas_object_focus_set(wd->chk, EINA_TRUE);
}
else
{
- edje_object_signal_emit(wd->chk, "elm,action,unfocus", "elm");
- evas_object_focus_set(wd->chk, EINA_FALSE);
+ edje_object_signal_emit(wd->chk, "elm,action,unfocus", "elm");
+ evas_object_focus_set(wd->chk, EINA_FALSE);
}
}
_mirrored_set(obj, elm_widget_mirrored_get(obj));
_elm_theme_object_set(obj, wd->chk, "check", "base", elm_widget_style_get(obj));
if (wd->icon)
- edje_object_signal_emit(wd->chk, "elm,state,icon,visible", "elm");
+ edje_object_signal_emit(wd->chk, "elm,state,icon,visible", "elm");
else
- edje_object_signal_emit(wd->chk, "elm,state,icon,hidden", "elm");
+ edje_object_signal_emit(wd->chk, "elm,state,icon,hidden", "elm");
if (wd->state)
- edje_object_signal_emit(wd->chk, "elm,state,check,on", "elm");
+ edje_object_signal_emit(wd->chk, "elm,state,check,on", "elm");
else
- edje_object_signal_emit(wd->chk, "elm,state,check,off", "elm");
+ edje_object_signal_emit(wd->chk, "elm,state,check,off", "elm");
if (wd->label)
- edje_object_signal_emit(wd->chk, "elm,state,text,visible", "elm");
+ edje_object_signal_emit(wd->chk, "elm,state,text,visible", "elm");
else
- edje_object_signal_emit(wd->chk, "elm,state,text,hidden", "elm");
+ edje_object_signal_emit(wd->chk, "elm,state,text,hidden", "elm");
edje_object_part_text_set(wd->chk, "elm.text", wd->label);
if (elm_widget_disabled_get(obj))
- edje_object_signal_emit(wd->chk, "elm,state,disabled", "elm");
+ edje_object_signal_emit(wd->chk, "elm,state,disabled", "elm");
edje_object_message_signal_process(wd->chk);
edje_object_scale_set(wd->chk, elm_widget_scale_get(obj) * _elm_config->scale);
_sizing_eval(obj);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if (elm_widget_disabled_get(obj))
- edje_object_signal_emit(wd->chk, "elm,state,disabled", "elm");
+ edje_object_signal_emit(wd->chk, "elm,state,disabled", "elm");
else
- edje_object_signal_emit(wd->chk, "elm,state,enabled", "elm");
+ edje_object_signal_emit(wd->chk, "elm,state,enabled", "elm");
}
static void
if (!wd) return;
if (sub == wd->icon)
{
- edje_object_signal_emit(wd->chk, "elm,state,icon,hidden", "elm");
- evas_object_event_callback_del_full(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints, obj);
- wd->icon = NULL;
- _sizing_eval(obj);
- edje_object_message_signal_process(wd->chk);
+ edje_object_signal_emit(wd->chk, "elm,state,icon,hidden", "elm");
+ evas_object_event_callback_del_full(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+ _changed_size_hints, obj);
+ wd->icon = NULL;
+ _sizing_eval(obj);
+ edje_object_message_signal_process(wd->chk);
}
}
Widget_Data *wd;
ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
-
+
ELM_SET_WIDTYPE(widtype, "check");
elm_widget_type_set(obj, "check");
elm_widget_sub_object_add(parent, obj);
wd->icon = icon;
if (icon)
{
- elm_widget_sub_object_add(obj, icon);
- evas_object_event_callback_add(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _changed_size_hints, obj);
- edje_object_part_swallow(wd->chk, "elm.swallow.content", icon);
- edje_object_signal_emit(wd->chk, "elm,state,icon,visible", "elm");
- edje_object_message_signal_process(wd->chk);
+ elm_widget_sub_object_add(obj, icon);
+ evas_object_event_callback_add(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
+ _changed_size_hints, obj);
+ edje_object_part_swallow(wd->chk, "elm.swallow.content", icon);
+ edje_object_signal_emit(wd->chk, "elm,state,icon,visible", "elm");
+ edje_object_message_signal_process(wd->chk);
}
_sizing_eval(obj);
}
if (!wd) return;
if (state != wd->state)
{
- wd->state = state;
- if (wd->statep) *wd->statep = wd->state;
- if (wd->state)
- edje_object_signal_emit(wd->chk, "elm,state,check,on", "elm");
- else
- edje_object_signal_emit(wd->chk, "elm,state,check,off", "elm");
+ wd->state = state;
+ if (wd->statep) *wd->statep = wd->state;
+ if (wd->state)
+ edje_object_signal_emit(wd->chk, "elm,state,check,on", "elm");
+ else
+ edje_object_signal_emit(wd->chk, "elm,state,check,off", "elm");
}
}
if (!wd) return;
if (statep)
{
- wd->statep = statep;
- if (*wd->statep != wd->state)
- {
- wd->state = *wd->statep;
- if (wd->state)
- edje_object_signal_emit(wd->chk, "elm,state,check,on", "elm");
- else
- edje_object_signal_emit(wd->chk, "elm,state,check,off", "elm");
- }
+ wd->statep = statep;
+ if (*wd->statep != wd->state)
+ {
+ wd->state = *wd->statep;
+ if (wd->state)
+ edje_object_signal_emit(wd->chk, "elm,state,check,on", "elm");
+ else
+ edje_object_signal_emit(wd->chk, "elm,state,check,off", "elm");
+ }
}
else
wd->statep = NULL;
Eina_Bool seconds : 1;
Eina_Bool am_pm : 1;
Eina_Bool edit : 1;
- Elm_Clock_Digedit digedit;
+ Elm_Clock_Digedit digedit;
} cur;
};
int i;
for (i = 0; i < 6; i++)
{
- if (wd->digit[i]) evas_object_del(wd->digit[i]);
+ if (wd->digit[i]) evas_object_del(wd->digit[i]);
}
if (wd->ampm) evas_object_del(wd->ampm);
if (wd->ticker) ecore_timer_del(wd->ticker);
if (!wd) return;
if (elm_widget_focus_get(obj))
{
- edje_object_signal_emit(wd->clk, "elm,action,focus", "elm");
- evas_object_focus_set(wd->clk, EINA_TRUE);
+ edje_object_signal_emit(wd->clk, "elm,action,focus", "elm");
+ evas_object_focus_set(wd->clk, EINA_TRUE);
}
else
{
- edje_object_signal_emit(wd->clk, "elm,action,unfocus", "elm");
- evas_object_focus_set(wd->clk, EINA_FALSE);
+ edje_object_signal_emit(wd->clk, "elm,action,unfocus", "elm");
+ evas_object_focus_set(wd->clk, EINA_FALSE);
}
}
edje_object_signal_emit(wd->clk, emission, source);
for (i = 0; i < 6; i++)
{
- if (wd->digit[i])
- edje_object_signal_emit(wd->digit[i], emission, source);
+ if (wd->digit[i])
+ edje_object_signal_emit(wd->digit[i], emission, source);
}
}
edje_object_signal_callback_add(wd->clk, emission, source, func_cb, data);
for (i = 0; i < 6; i++)
{
- if (wd->digit[i])
- edje_object_signal_callback_add(wd->digit[i], emission, source,
- func_cb, data);
+ if (wd->digit[i])
+ edje_object_signal_callback_add(wd->digit[i], emission, source,
+ func_cb, data);
}
}
int i;
for (i = 0; i < 6; i++)
{
- edje_object_signal_callback_del_full(wd->digit[i], emission, source,
+ edje_object_signal_callback_del_full(wd->digit[i], emission, source,
func_cb, data);
}
edje_object_signal_callback_del_full(wd->clk, emission, source, func_cb,
tzset();
tm = localtime(&tt);
wd->timediff = (((wd->hrs - tm->tm_hour) * 60 +
- wd->min - tm->tm_min) * 60) + wd->sec - tm->tm_sec;
+ wd->min - tm->tm_min) * 60) + wd->sec - tm->tm_sec;
}
static Eina_Bool
wd->ticker = ecore_timer_add(t, _ticker, data);
if (!wd->edit)
{
- tt = (time_t)(timev.tv_sec) + wd->timediff;
- tzset();
- tm = localtime(&tt);
- if (tm)
- {
- wd->hrs = tm->tm_hour;
- wd->min = tm->tm_min;
- wd->sec = tm->tm_sec;
- _time_update(data);
- }
+ tt = (time_t)(timev.tv_sec) + wd->timediff;
+ tzset();
+ tm = localtime(&tt);
+ if (tm)
+ {
+ wd->hrs = tm->tm_hour;
+ wd->min = tm->tm_min;
+ wd->sec = tm->tm_sec;
+ _time_update(data);
+ }
}
return ECORE_CALLBACK_CANCEL;
}
if (!wd->sel_obj) goto clock_val_up_cancel;
if (wd->sel_obj == wd->digit[0])
{
- wd->hrs = wd->hrs + 10;
- if (wd->hrs >= 24) wd->hrs -= 24;
+ wd->hrs = wd->hrs + 10;
+ if (wd->hrs >= 24) wd->hrs -= 24;
}
if (wd->sel_obj == wd->digit[1])
{
- wd->hrs = wd->hrs + 1;
- if (wd->hrs >= 24) wd->hrs -= 24;
+ wd->hrs = wd->hrs + 1;
+ if (wd->hrs >= 24) wd->hrs -= 24;
}
if (wd->sel_obj == wd->digit[2])
{
- wd->min = wd->min + 10;
- if (wd->min >= 60) wd->min -= 60;
+ wd->min = wd->min + 10;
+ if (wd->min >= 60) wd->min -= 60;
}
if (wd->sel_obj == wd->digit[3])
{
- wd->min = wd->min + 1;
- if (wd->min >= 60) wd->min -= 60;
+ wd->min = wd->min + 1;
+ if (wd->min >= 60) wd->min -= 60;
}
if (wd->sel_obj == wd->digit[4])
{
- wd->sec = wd->sec + 10;
- if (wd->sec >= 60) wd->sec -= 60;
+ wd->sec = wd->sec + 10;
+ if (wd->sec >= 60) wd->sec -= 60;
}
if (wd->sel_obj == wd->digit[5])
{
- wd->sec = wd->sec + 1;
- if (wd->sec >= 60) wd->sec -= 60;
+ wd->sec = wd->sec + 1;
+ if (wd->sec >= 60) wd->sec -= 60;
}
if (wd->sel_obj == wd->ampm)
{
- wd->hrs = wd->hrs + 12;
- if (wd->hrs > 23) wd->hrs -= 24;
+ wd->hrs = wd->hrs + 12;
+ if (wd->hrs > 23) wd->hrs -= 24;
}
wd->interval = wd->interval / 1.05;
ecore_timer_interval_set(wd->spin, wd->interval);
if (!wd->sel_obj) goto clock_val_down_cancel;
if (wd->sel_obj == wd->digit[0])
{
- wd->hrs = wd->hrs - 10;
- if (wd->hrs < 0) wd->hrs += 24;
+ wd->hrs = wd->hrs - 10;
+ if (wd->hrs < 0) wd->hrs += 24;
}
if (wd->sel_obj == wd->digit[1])
{
- wd->hrs = wd->hrs - 1;
- if (wd->hrs < 0) wd->hrs += 24;
+ wd->hrs = wd->hrs - 1;
+ if (wd->hrs < 0) wd->hrs += 24;
}
if (wd->sel_obj == wd->digit[2])
{
- wd->min = wd->min - 10;
- if (wd->min < 0) wd->min += 60;
+ wd->min = wd->min - 10;
+ if (wd->min < 0) wd->min += 60;
}
if (wd->sel_obj == wd->digit[3])
{
- wd->min = wd->min - 1;
- if (wd->min < 0) wd->min += 60;
+ wd->min = wd->min - 1;
+ if (wd->min < 0) wd->min += 60;
}
if (wd->sel_obj == wd->digit[4])
{
- wd->sec = wd->sec - 10;
- if (wd->sec < 0) wd->sec += 60;
+ wd->sec = wd->sec - 10;
+ if (wd->sec < 0) wd->sec += 60;
}
if (wd->sel_obj == wd->digit[5])
{
- wd->sec = wd->sec - 1;
- if (wd->sec < 0) wd->sec += 60;
+ wd->sec = wd->sec - 1;
+ if (wd->sec < 0) wd->sec += 60;
}
if (wd->sel_obj == wd->ampm)
{
- wd->hrs = wd->hrs - 12;
- if (wd->hrs < 0) wd->hrs += 24;
+ wd->hrs = wd->hrs - 12;
+ if (wd->hrs < 0) wd->hrs += 24;
}
wd->interval = wd->interval / 1.05;
ecore_timer_interval_set(wd->spin, wd->interval);
if ((wd->cur.seconds != wd->seconds) || (wd->cur.am_pm != wd->am_pm) ||
(wd->cur.edit != wd->edit) || (wd->cur.digedit != wd->digedit))
{
- int i;
- Evas_Coord mw, mh;
-
- for (i = 0; i < 6; i++)
- {
- if (wd->digit[i])
- {
- evas_object_del(wd->digit[i]);
- wd->digit[i] = NULL;
- }
- }
- if (wd->ampm)
- {
- evas_object_del(wd->ampm);
- wd->ampm = NULL;
- }
-
- if ((wd->seconds) && (wd->am_pm))
- _elm_theme_object_set(obj, wd->clk, "clock", "base-all", style);
- else if (wd->seconds)
- _elm_theme_object_set(obj, wd->clk, "clock", "base-seconds", style);
- else if (wd->am_pm)
- _elm_theme_object_set(obj, wd->clk, "clock", "base-am_pm", style);
- else
- _elm_theme_object_set(obj, wd->clk, "clock", "base", style);
- edje_object_scale_set(wd->clk, elm_widget_scale_get(obj) *
+ int i;
+ Evas_Coord mw, mh;
+
+ for (i = 0; i < 6; i++)
+ {
+ if (wd->digit[i])
+ {
+ evas_object_del(wd->digit[i]);
+ wd->digit[i] = NULL;
+ }
+ }
+ if (wd->ampm)
+ {
+ evas_object_del(wd->ampm);
+ wd->ampm = NULL;
+ }
+
+ if ((wd->seconds) && (wd->am_pm))
+ _elm_theme_object_set(obj, wd->clk, "clock", "base-all", style);
+ else if (wd->seconds)
+ _elm_theme_object_set(obj, wd->clk, "clock", "base-seconds", style);
+ else if (wd->am_pm)
+ _elm_theme_object_set(obj, wd->clk, "clock", "base-am_pm", style);
+ else
+ _elm_theme_object_set(obj, wd->clk, "clock", "base", style);
+ edje_object_scale_set(wd->clk, elm_widget_scale_get(obj) *
_elm_config->scale);
- for (i = 0; i < 6; i++)
- {
- char buf[16];
+ for (i = 0; i < 6; i++)
+ {
+ char buf[16];
- if ((!wd->seconds) && (i >= 4)) break;
- wd->digit[i] = edje_object_add(evas_object_evas_get(wd->clk));
- _elm_theme_object_set(obj, wd->digit[i], "clock", "flipdigit", style);
- edje_object_scale_set(wd->digit[i], elm_widget_scale_get(obj) *
+ if ((!wd->seconds) && (i >= 4)) break;
+ wd->digit[i] = edje_object_add(evas_object_evas_get(wd->clk));
+ _elm_theme_object_set(obj, wd->digit[i], "clock", "flipdigit", style);
+ edje_object_scale_set(wd->digit[i], elm_widget_scale_get(obj) *
_elm_config->scale);
- if ((wd->edit) && (wd->digedit & (1 << i)))
- edje_object_signal_emit(wd->digit[i], "elm,state,edit,on", "elm");
- edje_object_signal_callback_add(wd->digit[i], "elm,action,up,start",
- "", _signal_clock_val_up_start, obj);
- edje_object_signal_callback_add(wd->digit[i], "elm,action,up,stop",
- "", _signal_clock_val_change_stop, obj);
- edje_object_signal_callback_add(wd->digit[i], "elm,action,down,start",
- "", _signal_clock_val_down_start, obj);
- edje_object_signal_callback_add(wd->digit[i], "elm,action,down,stop",
- "", _signal_clock_val_change_stop, obj);
- mw = mh = -1;
- elm_coords_finger_size_adjust(1, &mw, 2, &mh);
- edje_object_size_min_restricted_calc(wd->digit[i], &mw, &mh, mw, mh);
- elm_coords_finger_size_adjust(1, &mw, 2, &mh);
- edje_extern_object_min_size_set(wd->digit[i], mw, mh);
- snprintf(buf, sizeof(buf), "d%i", i);
- edje_object_part_swallow(wd->clk , buf, wd->digit[i]);
- evas_object_show(wd->digit[i]);
- }
- if (wd->am_pm)
- {
- wd->ampm = edje_object_add(evas_object_evas_get(wd->clk));
- _elm_theme_object_set(obj, wd->ampm, "clock", "flipampm", style);
- edje_object_scale_set(wd->ampm, elm_widget_scale_get(obj) *
+ if ((wd->edit) && (wd->digedit & (1 << i)))
+ edje_object_signal_emit(wd->digit[i], "elm,state,edit,on", "elm");
+ edje_object_signal_callback_add(wd->digit[i], "elm,action,up,start",
+ "", _signal_clock_val_up_start, obj);
+ edje_object_signal_callback_add(wd->digit[i], "elm,action,up,stop",
+ "", _signal_clock_val_change_stop, obj);
+ edje_object_signal_callback_add(wd->digit[i], "elm,action,down,start",
+ "", _signal_clock_val_down_start, obj);
+ edje_object_signal_callback_add(wd->digit[i], "elm,action,down,stop",
+ "", _signal_clock_val_change_stop, obj);
+ mw = mh = -1;
+ elm_coords_finger_size_adjust(1, &mw, 2, &mh);
+ edje_object_size_min_restricted_calc(wd->digit[i], &mw, &mh, mw, mh);
+ elm_coords_finger_size_adjust(1, &mw, 2, &mh);
+ edje_extern_object_min_size_set(wd->digit[i], mw, mh);
+ snprintf(buf, sizeof(buf), "d%i", i);
+ edje_object_part_swallow(wd->clk , buf, wd->digit[i]);
+ evas_object_show(wd->digit[i]);
+ }
+ if (wd->am_pm)
+ {
+ wd->ampm = edje_object_add(evas_object_evas_get(wd->clk));
+ _elm_theme_object_set(obj, wd->ampm, "clock", "flipampm", style);
+ edje_object_scale_set(wd->ampm, elm_widget_scale_get(obj) *
_elm_config->scale);
- if (wd->edit)
- edje_object_signal_emit(wd->ampm, "elm,state,edit,on", "elm");
- edje_object_signal_callback_add(wd->ampm, "elm,action,up,start",
- "", _signal_clock_val_up_start, obj);
- edje_object_signal_callback_add(wd->ampm, "elm,action,up,stop",
- "", _signal_clock_val_change_stop, obj);
- edje_object_signal_callback_add(wd->ampm, "elm,action,down,start",
- "", _signal_clock_val_down_start, obj);
- edje_object_signal_callback_add(wd->ampm, "elm,action,down,stop",
- "", _signal_clock_val_change_stop, obj);
- mw = mh = -1;
- elm_coords_finger_size_adjust(1, &mw, 2, &mh);
- edje_object_size_min_restricted_calc(wd->ampm, &mw, &mh, mw, mh);
- elm_coords_finger_size_adjust(1, &mw, 2, &mh);
- edje_extern_object_min_size_set(wd->ampm, mw, mh);
- edje_object_part_swallow(wd->clk , "ampm", wd->ampm);
- evas_object_show(wd->ampm);
- }
-
- edje_object_size_min_calc(wd->clk, &mw, &mh);
- evas_object_size_hint_min_set(obj, mw, mh);
-
- wd->cur.hrs = 0;
- wd->cur.min = 0;
- wd->cur.sec = 0;
- wd->cur.ampm = -1;
- wd->cur.seconds = wd->seconds;
- wd->cur.am_pm = wd->am_pm;
- wd->cur.edit = wd->edit;
- wd->cur.digedit = wd->digedit;
+ if (wd->edit)
+ edje_object_signal_emit(wd->ampm, "elm,state,edit,on", "elm");
+ edje_object_signal_callback_add(wd->ampm, "elm,action,up,start",
+ "", _signal_clock_val_up_start, obj);
+ edje_object_signal_callback_add(wd->ampm, "elm,action,up,stop",
+ "", _signal_clock_val_change_stop, obj);
+ edje_object_signal_callback_add(wd->ampm, "elm,action,down,start",
+ "", _signal_clock_val_down_start, obj);
+ edje_object_signal_callback_add(wd->ampm, "elm,action,down,stop",
+ "", _signal_clock_val_change_stop, obj);
+ mw = mh = -1;
+ elm_coords_finger_size_adjust(1, &mw, 2, &mh);
+ edje_object_size_min_restricted_calc(wd->ampm, &mw, &mh, mw, mh);
+ elm_coords_finger_size_adjust(1, &mw, 2, &mh);
+ edje_extern_object_min_size_set(wd->ampm, mw, mh);
+ edje_object_part_swallow(wd->clk , "ampm", wd->ampm);
+ evas_object_show(wd->ampm);
+ }
+
+ edje_object_size_min_calc(wd->clk, &mw, &mh);
+ evas_object_size_hint_min_set(obj, mw, mh);
+
+ wd->cur.hrs = 0;
+ wd->cur.min = 0;
+ wd->cur.sec = 0;
+ wd->cur.ampm = -1;
+ wd->cur.seconds = wd->seconds;
+ wd->cur.am_pm = wd->am_pm;
+ wd->cur.edit = wd->edit;
+ wd->cur.digedit = wd->digedit;
}
if (wd->hrs != wd->cur.hrs)
{
- int hrs;
- int d1, d2, dc1, dc2;
-
- hrs = wd->hrs;
- if (wd->am_pm)
- {
- if (hrs >= 12)
- {
- if (hrs > 12) hrs -= 12;
- ampm = 1;
- }
- else if (!hrs) hrs = 12;
- }
- d1 = hrs / 10;
- d2 = hrs % 10;
- dc1 = wd->cur.hrs / 10;
- dc2 = wd->cur.hrs % 10;
- if (d1 != dc1)
- {
- msg.val = d1;
- edje_object_message_send(wd->digit[0], EDJE_MESSAGE_INT, 1, &msg);
- }
- if (d2 != dc2)
- {
- msg.val = d2;
- edje_object_message_send(wd->digit[1], EDJE_MESSAGE_INT, 1, &msg);
- }
- wd->cur.hrs = hrs;
+ int hrs;
+ int d1, d2, dc1, dc2;
+
+ hrs = wd->hrs;
+ if (wd->am_pm)
+ {
+ if (hrs >= 12)
+ {
+ if (hrs > 12) hrs -= 12;
+ ampm = 1;
+ }
+ else if (!hrs) hrs = 12;
+ }
+ d1 = hrs / 10;
+ d2 = hrs % 10;
+ dc1 = wd->cur.hrs / 10;
+ dc2 = wd->cur.hrs % 10;
+ if (d1 != dc1)
+ {
+ msg.val = d1;
+ edje_object_message_send(wd->digit[0], EDJE_MESSAGE_INT, 1, &msg);
+ }
+ if (d2 != dc2)
+ {
+ msg.val = d2;
+ edje_object_message_send(wd->digit[1], EDJE_MESSAGE_INT, 1, &msg);
+ }
+ wd->cur.hrs = hrs;
}
if (wd->min != wd->cur.min)
{
- int d1, d2, dc1, dc2;
-
- d1 = wd->min / 10;
- d2 = wd->min % 10;
- dc1 = wd->cur.min / 10;
- dc2 = wd->cur.min % 10;
- if (d1 != dc1)
- {
- msg.val = d1;
- edje_object_message_send(wd->digit[2], EDJE_MESSAGE_INT, 1, &msg);
- }
- if (d2 != dc2)
- {
- msg.val = d2;
- edje_object_message_send(wd->digit[3], EDJE_MESSAGE_INT, 1, &msg);
- }
- wd->cur.min = wd->min;
+ int d1, d2, dc1, dc2;
+
+ d1 = wd->min / 10;
+ d2 = wd->min % 10;
+ dc1 = wd->cur.min / 10;
+ dc2 = wd->cur.min % 10;
+ if (d1 != dc1)
+ {
+ msg.val = d1;
+ edje_object_message_send(wd->digit[2], EDJE_MESSAGE_INT, 1, &msg);
+ }
+ if (d2 != dc2)
+ {
+ msg.val = d2;
+ edje_object_message_send(wd->digit[3], EDJE_MESSAGE_INT, 1, &msg);
+ }
+ wd->cur.min = wd->min;
}
if (wd->seconds)
{
- if (wd->sec != wd->cur.sec)
- {
- int d1, d2, dc1, dc2;
-
- d1 = wd->sec / 10;
- d2 = wd->sec % 10;
- dc1 = wd->cur.sec / 10;
- dc2 = wd->cur.sec % 10;
- if (d1 != dc1)
- {
- msg.val = d1;
- edje_object_message_send(wd->digit[4], EDJE_MESSAGE_INT, 1, &msg);
- }
- if (d2 != dc2)
- {
- msg.val = d2;
- edje_object_message_send(wd->digit[5], EDJE_MESSAGE_INT, 1, &msg);
- }
- wd->cur.sec = wd->sec;
- }
+ if (wd->sec != wd->cur.sec)
+ {
+ int d1, d2, dc1, dc2;
+
+ d1 = wd->sec / 10;
+ d2 = wd->sec % 10;
+ dc1 = wd->cur.sec / 10;
+ dc2 = wd->cur.sec % 10;
+ if (d1 != dc1)
+ {
+ msg.val = d1;
+ edje_object_message_send(wd->digit[4], EDJE_MESSAGE_INT, 1, &msg);
+ }
+ if (d2 != dc2)
+ {
+ msg.val = d2;
+ edje_object_message_send(wd->digit[5], EDJE_MESSAGE_INT, 1, &msg);
+ }
+ wd->cur.sec = wd->sec;
+ }
}
else
wd->cur.sec = -1;
if (wd->am_pm)
{
- if (wd->hrs >= 12) ampm = 1;
- if (ampm != wd->cur.ampm)
- {
- if (wd->cur.ampm != ampm)
- {
- msg.val = ampm;
- edje_object_message_send(wd->ampm, EDJE_MESSAGE_INT, 1, &msg);
- }
- wd->cur.ampm = ampm;
- }
+ if (wd->hrs >= 12) ampm = 1;
+ if (ampm != wd->cur.ampm)
+ {
+ if (wd->cur.ampm != ampm)
+ {
+ msg.val = ampm;
+ edje_object_message_send(wd->ampm, EDJE_MESSAGE_INT, 1, &msg);
+ }
+ wd->cur.ampm = ampm;
+ }
}
else
wd->cur.ampm = -1;
Widget_Data *wd;
ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
-
+
ELM_SET_WIDTYPE(widtype, "clock");
elm_widget_type_set(obj, "clock");
elm_widget_sub_object_add(parent, obj);
CNP_ATOM_TEXT,
CNP_ATOM_text_plain_utf8,
CNP_ATOM_text_plain,
-
+
CNP_N_ATOMS,
};
Elm_Sel_Format format;
Ecore_X_Selection ecore_sel;
-
+
Eina_Bool active : 1;
};
/* Optimisation: Turn this into a 256 byte table:
* then can lookup in one index, not N checks */
static const Escape escapes[] = {
- { "<br>", '\n' },
- { "<\t>", '\t' },
- { "gt;", '>' },
- { "lt;", '<' },
- { "amp;", '&' },
- { "quot;", '\'' },
- { "dquot;", '"' }
+ { "<br>", '\n' },
+ { "<\t>", '\t' },
+ { "gt;", '>' },
+ { "lt;", '<' },
+ { "amp;", '&' },
+ { "quot;", '\'' },
+ { "dquot;", '"' }
};
#define N_ESCAPES ((int)(sizeof(escapes) / sizeof(escapes[0])))
static Cnp_Atom atoms[CNP_N_ATOMS] = {
- [CNP_ATOM_TARGETS] = {
- "TARGETS",
- (Elm_Sel_Format) -1, // everything
- targets_converter,
- response_handler_targets,
- notify_handler_targets,
- 0
- },
- [CNP_ATOM_XELM] = {
- "application/x-elementary-markup",
- ELM_SEL_FORMAT_MARKUP,
- edje_converter,
- NULL,
- NULL,
- 0
- },
- [CNP_ATOM_text_uri] = {
- "text/uri",
- ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_IMAGE, /* Either images or entries */
- uri_converter,
- NULL,
- notify_handler_uri,
- 0
- },
- [CNP_ATOM_text_urilist] = {
- "text/uri-list",
- ELM_SEL_FORMAT_IMAGE,
- uri_converter,
- NULL,
- notify_handler_uri,
- 0
- },
- [CNP_ATOM_text_x_vcard] = {
- "text/x-vcard",
- ELM_SEL_FORMAT_VCARD,
- vcard_send, NULL,
- vcard_receive, 0
- },
- [CNP_ATOM_image_png] = {
- "image/png",
- ELM_SEL_FORMAT_IMAGE,
- image_converter,
- NULL,
- notify_handler_image,
- 0
- },
- [CNP_ATOM_image_jpeg] = {
- "image/jpeg",
- ELM_SEL_FORMAT_IMAGE,
- image_converter,
- NULL,
- notify_handler_image,/* Raw image data is the same */
- 0
- },
- [CNP_ATOM_image_bmp] = {
- "image/x-ms-bmp",
- ELM_SEL_FORMAT_IMAGE,
- image_converter,
- NULL,
- notify_handler_image,/* Raw image data is the same */
- 0
- },
- [CNP_ATOM_image_gif] = {
- "image/gif",
- ELM_SEL_FORMAT_IMAGE,
- image_converter,
- NULL,
- notify_handler_image,/* Raw image data is the same */
- 0
- },
- [CNP_ATOM_image_tiff] = {
- "image/tiff",
- ELM_SEL_FORMAT_IMAGE,
- image_converter,
- NULL,
- notify_handler_image,/* Raw image data is the same */
- 0
- },
- [CNP_ATOM_image_svg] = {
- "image/svg+xml",
- ELM_SEL_FORMAT_IMAGE,
- image_converter,
- NULL,
- notify_handler_image,/* Raw image data is the same */
- 0
- },
- [CNP_ATOM_image_xpm] = {
- "image/x-xpixmap",
- ELM_SEL_FORMAT_IMAGE,
- image_converter,
- NULL,
- notify_handler_image,/* Raw image data is the same */
- 0
- },
- [CNP_ATOM_image_tga] = {
- "image/x-tga",
- ELM_SEL_FORMAT_IMAGE,
- image_converter,
- NULL,
- notify_handler_image,/* Raw image data is the same */
- 0
- },
- [CNP_ATOM_image_ppm] = {
- "image/x-portable-pixmap",
- ELM_SEL_FORMAT_IMAGE,
- image_converter,
- NULL,
- notify_handler_image,/* Raw image data is the same */
- 0
- },
- [CNP_ATOM_text_html_utf8] = {
- "text/html;charset=utf-8",
- ELM_SEL_FORMAT_HTML,
- html_converter,
- NULL,
- notify_handler_html,
- 0
- },
- [CNP_ATOM_text_html] = {
- "text/html",
- ELM_SEL_FORMAT_HTML,
- html_converter,
- NULL,
- notify_handler_html, /* No encoding: Webkit only */
- 0
- },
- [CNP_ATOM_UTF8STRING] = {
- "UTF8_STRING",
- ELM_SEL_FORMAT_TEXT | ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_HTML,
- text_converter,
- NULL,
- notify_handler_text,
- 0
- },
- [CNP_ATOM_STRING] = {
- "STRING",
- ELM_SEL_FORMAT_TEXT | ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_HTML,
- text_converter,
- NULL,
- notify_handler_text,
- 0
- },
- [CNP_ATOM_TEXT] = {
- "TEXT",
- ELM_SEL_FORMAT_TEXT | ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_HTML,
- text_converter,
- NULL,
- NULL,
- 0
- },
- [CNP_ATOM_text_plain_utf8] = {
- "text/plain;charset=utf-8",
- ELM_SEL_FORMAT_TEXT | ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_HTML,
- text_converter,
- NULL,
- NULL,
- 0
- },
- [CNP_ATOM_text_plain] = {
- "text/plain",
- ELM_SEL_FORMAT_TEXT | ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_HTML,
- text_converter,
- NULL,
- NULL,
- 0
- },
+ [CNP_ATOM_TARGETS] = {
+ "TARGETS",
+ (Elm_Sel_Format) -1, // everything
+ targets_converter,
+ response_handler_targets,
+ notify_handler_targets,
+ 0
+ },
+ [CNP_ATOM_XELM] = {
+ "application/x-elementary-markup",
+ ELM_SEL_FORMAT_MARKUP,
+ edje_converter,
+ NULL,
+ NULL,
+ 0
+ },
+ [CNP_ATOM_text_uri] = {
+ "text/uri",
+ ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_IMAGE, /* Either images or entries */
+ uri_converter,
+ NULL,
+ notify_handler_uri,
+ 0
+ },
+ [CNP_ATOM_text_urilist] = {
+ "text/uri-list",
+ ELM_SEL_FORMAT_IMAGE,
+ uri_converter,
+ NULL,
+ notify_handler_uri,
+ 0
+ },
+ [CNP_ATOM_text_x_vcard] = {
+ "text/x-vcard",
+ ELM_SEL_FORMAT_VCARD,
+ vcard_send, NULL,
+ vcard_receive, 0
+ },
+ [CNP_ATOM_image_png] = {
+ "image/png",
+ ELM_SEL_FORMAT_IMAGE,
+ image_converter,
+ NULL,
+ notify_handler_image,
+ 0
+ },
+ [CNP_ATOM_image_jpeg] = {
+ "image/jpeg",
+ ELM_SEL_FORMAT_IMAGE,
+ image_converter,
+ NULL,
+ notify_handler_image,/* Raw image data is the same */
+ 0
+ },
+ [CNP_ATOM_image_bmp] = {
+ "image/x-ms-bmp",
+ ELM_SEL_FORMAT_IMAGE,
+ image_converter,
+ NULL,
+ notify_handler_image,/* Raw image data is the same */
+ 0
+ },
+ [CNP_ATOM_image_gif] = {
+ "image/gif",
+ ELM_SEL_FORMAT_IMAGE,
+ image_converter,
+ NULL,
+ notify_handler_image,/* Raw image data is the same */
+ 0
+ },
+ [CNP_ATOM_image_tiff] = {
+ "image/tiff",
+ ELM_SEL_FORMAT_IMAGE,
+ image_converter,
+ NULL,
+ notify_handler_image,/* Raw image data is the same */
+ 0
+ },
+ [CNP_ATOM_image_svg] = {
+ "image/svg+xml",
+ ELM_SEL_FORMAT_IMAGE,
+ image_converter,
+ NULL,
+ notify_handler_image,/* Raw image data is the same */
+ 0
+ },
+ [CNP_ATOM_image_xpm] = {
+ "image/x-xpixmap",
+ ELM_SEL_FORMAT_IMAGE,
+ image_converter,
+ NULL,
+ notify_handler_image,/* Raw image data is the same */
+ 0
+ },
+ [CNP_ATOM_image_tga] = {
+ "image/x-tga",
+ ELM_SEL_FORMAT_IMAGE,
+ image_converter,
+ NULL,
+ notify_handler_image,/* Raw image data is the same */
+ 0
+ },
+ [CNP_ATOM_image_ppm] = {
+ "image/x-portable-pixmap",
+ ELM_SEL_FORMAT_IMAGE,
+ image_converter,
+ NULL,
+ notify_handler_image,/* Raw image data is the same */
+ 0
+ },
+ [CNP_ATOM_text_html_utf8] = {
+ "text/html;charset=utf-8",
+ ELM_SEL_FORMAT_HTML,
+ html_converter,
+ NULL,
+ notify_handler_html,
+ 0
+ },
+ [CNP_ATOM_text_html] = {
+ "text/html",
+ ELM_SEL_FORMAT_HTML,
+ html_converter,
+ NULL,
+ notify_handler_html, /* No encoding: Webkit only */
+ 0
+ },
+ [CNP_ATOM_UTF8STRING] = {
+ "UTF8_STRING",
+ ELM_SEL_FORMAT_TEXT | ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_HTML,
+ text_converter,
+ NULL,
+ notify_handler_text,
+ 0
+ },
+ [CNP_ATOM_STRING] = {
+ "STRING",
+ ELM_SEL_FORMAT_TEXT | ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_HTML,
+ text_converter,
+ NULL,
+ notify_handler_text,
+ 0
+ },
+ [CNP_ATOM_TEXT] = {
+ "TEXT",
+ ELM_SEL_FORMAT_TEXT | ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_HTML,
+ text_converter,
+ NULL,
+ NULL,
+ 0
+ },
+ [CNP_ATOM_text_plain_utf8] = {
+ "text/plain;charset=utf-8",
+ ELM_SEL_FORMAT_TEXT | ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_HTML,
+ text_converter,
+ NULL,
+ NULL,
+ 0
+ },
+ [CNP_ATOM_text_plain] = {
+ "text/plain",
+ ELM_SEL_FORMAT_TEXT | ELM_SEL_FORMAT_MARKUP | ELM_SEL_FORMAT_HTML,
+ text_converter,
+ NULL,
+ NULL,
+ 0
+ },
};
static Cnp_Selection selections[ELM_SEL_MAX] = {
- ARRAYINIT(ELM_SEL_PRIMARY) {
- .debug = "Primary",
- .ecore_sel = ECORE_X_SELECTION_PRIMARY,
- .set = ecore_x_selection_primary_set,
- .clear = ecore_x_selection_primary_clear,
- .request = ecore_x_selection_primary_request,
- },
- ARRAYINIT(ELM_SEL_SECONDARY) {
- .debug = "Secondary",
- .ecore_sel = ECORE_X_SELECTION_SECONDARY,
- .set = ecore_x_selection_secondary_set,
- .clear = ecore_x_selection_secondary_clear,
- .request = ecore_x_selection_secondary_request,
- },
- ARRAYINIT(ELM_SEL_CLIPBOARD) {
- .debug = "Clipboard",
- .ecore_sel = ECORE_X_SELECTION_CLIPBOARD,
- .set = ecore_x_selection_clipboard_set,
- .clear = ecore_x_selection_clipboard_clear,
- .request = ecore_x_selection_clipboard_request,
- },
- ARRAYINIT(ELM_SEL_XDND) {
- .debug = "XDnD",
- .ecore_sel = ECORE_X_SELECTION_XDND,
- .request = ecore_x_selection_xdnd_request,
- },
+ ARRAYINIT(ELM_SEL_PRIMARY) {
+ .debug = "Primary",
+ .ecore_sel = ECORE_X_SELECTION_PRIMARY,
+ .set = ecore_x_selection_primary_set,
+ .clear = ecore_x_selection_primary_clear,
+ .request = ecore_x_selection_primary_request,
+ },
+ ARRAYINIT(ELM_SEL_SECONDARY) {
+ .debug = "Secondary",
+ .ecore_sel = ECORE_X_SELECTION_SECONDARY,
+ .set = ecore_x_selection_secondary_set,
+ .clear = ecore_x_selection_secondary_clear,
+ .request = ecore_x_selection_secondary_request,
+ },
+ ARRAYINIT(ELM_SEL_CLIPBOARD) {
+ .debug = "Clipboard",
+ .ecore_sel = ECORE_X_SELECTION_CLIPBOARD,
+ .set = ecore_x_selection_clipboard_set,
+ .clear = ecore_x_selection_clipboard_clear,
+ .request = ecore_x_selection_clipboard_request,
+ },
+ ARRAYINIT(ELM_SEL_XDND) {
+ .debug = "XDnD",
+ .ecore_sel = ECORE_X_SELECTION_XDND,
+ .request = ecore_x_selection_xdnd_request,
+ },
};
/* Data for DND in progress */
if ((unsigned int)selection >= (unsigned int)ELM_SEL_MAX) return EINA_FALSE;
if (!_elm_cnp_init_count) _elm_cnp_init();
if ((!selbuf) && (format != ELM_SEL_FORMAT_IMAGE))
- return elm_selection_clear(selection, widget);
+ return elm_selection_clear(selection, widget);
sel = selections + selection;
Eina_Bool
elm_selection_get(Elm_Sel_Type selection, Elm_Sel_Format format,
- Evas_Object *widget, Elm_Drop_Cb datacb, void *udata)
+ Evas_Object *widget, Elm_Drop_Cb datacb, void *udata)
{
#ifdef HAVE_ELEMENTARY_X
Evas_Object *top;
_elm_cnp_init(void)
{
int i;
-
+
if (_elm_cnp_init_count++) return EINA_TRUE;
for (i = 0; i < CNP_N_ATOMS; i++)
{
- atoms[i].atom = ecore_x_atom_get(atoms[i].name);
- ecore_x_selection_converter_atom_add(atoms[i].atom,
+ atoms[i].atom = ecore_x_atom_get(atoms[i].name);
+ ecore_x_selection_converter_atom_add(atoms[i].atom,
atoms[i].converter);
}
clipboard_atom = ecore_x_atom_get("CLIPBOARD");
ecore_event_handler_add(ECORE_X_EVENT_SELECTION_CLEAR, selection_clear, NULL);
ecore_event_handler_add(ECORE_X_EVENT_SELECTION_NOTIFY, selection_notify, NULL);
-
+
text_uri = eina_stringshare_add("text/uri-list");
return EINA_TRUE;
}
Ecore_X_Event_Selection_Clear *ev = event;
Cnp_Selection *sel;
int i;
-
+
for (i = 0; i < ELM_SEL_MAX; i++)
{
- if (selections[i].ecore_sel == ev->selection) break;
+ if (selections[i].ecore_sel == ev->selection) break;
}
cnp_debug("selection %d clear\n", i);
/* Not me... Don't care */
Ecore_X_Event_Selection_Notify *ev = event;
Cnp_Selection *sel;
int i;
-
+
cnp_debug("selection notify callback: %d\n",ev->selection);
switch (ev->selection)
{
case ECORE_X_SELECTION_CLIPBOARD:
- sel = selections + ELM_SEL_CLIPBOARD;
- break;
+ sel = selections + ELM_SEL_CLIPBOARD;
+ break;
case ECORE_X_SELECTION_PRIMARY:
- sel = selections + ELM_SEL_PRIMARY;
- break;
+ sel = selections + ELM_SEL_PRIMARY;
+ break;
case ECORE_X_SELECTION_SECONDARY:
- sel = selections + ELM_SEL_SECONDARY;
- break;
+ sel = selections + ELM_SEL_SECONDARY;
+ break;
case ECORE_X_SELECTION_XDND:
- sel = selections + ELM_SEL_XDND;
- break;
+ sel = selections + ELM_SEL_XDND;
+ break;
default:
- return ECORE_CALLBACK_PASS_ON;
+ return ECORE_CALLBACK_PASS_ON;
}
cnp_debug("Target is %s\n", ev->target);
-
+
for (i = 0; i < CNP_N_ATOMS; i++)
{
- if (!strcmp(ev->target, atoms[i].name))
- {
- if (atoms[i].notify)
+ if (!strcmp(ev->target, atoms[i].name))
+ {
+ if (atoms[i].notify)
{
cnp_debug("Found something: %s\n", atoms[i].name);
- atoms[i].notify(sel, ev);
- }
- else
+ atoms[i].notify(sel, ev);
+ }
+ else
{
- cnp_debug("Ignored: No handler!\n");
+ cnp_debug("Ignored: No handler!\n");
}
- }
+ }
}
return ECORE_CALLBACK_PASS_ON;
int i,count;
Ecore_X_Atom *aret;
Cnp_Selection *sel;
-
+
if (!data_ret) return EINA_FALSE;
sel = selections + *((int *)data);
for (i = 0, count = 0; i < CNP_N_ATOMS ; i++)
{
- if (sel->format & atoms[i].formats) count++;
+ if (sel->format & atoms[i].formats) count++;
}
aret = malloc(sizeof(Ecore_X_Atom) * count);
for (i = 0, count = 0; i < CNP_N_ATOMS; i++)
{
- if (sel->format & atoms[i].formats) aret[count ++] = atoms[i].atom;
+ if (sel->format & atoms[i].formats) aret[count ++] = atoms[i].atom;
}
*data_ret = aret;
Cnp_Selection *sel;
cnp_debug("Vcard send called\n");
-
+
sel = selections + *((int *)data);
if (data_ret) *data_ret = strdup(sel->selbuf);
Ecore_X_Selection_Data_Targets *targets;
Ecore_X_Atom *atomlist;
int i, j;
-
+
targets = notify->data;
atomlist = (Ecore_X_Atom *)(targets->data.data);
for (j = 1; j < CNP_N_ATOMS; j++)
{
- cnp_debug("\t%s %d\n", atoms[j].name, atoms[j].atom);
- if (!(atoms[j].formats & sel->requestformat)) continue;
- for (i = 0; i < targets->data.length; i++)
- {
- if ((atoms[j].atom == atomlist[i]) && (atoms[j].notify))
- {
- cnp_debug("Atom %s matches\n",atoms[j].name);
- goto done;
- }
- }
+ cnp_debug("\t%s %d\n", atoms[j].name, atoms[j].atom);
+ if (!(atoms[j].formats & sel->requestformat)) continue;
+ for (i = 0; i < targets->data.length; i++)
+ {
+ if ((atoms[j].atom == atomlist[i]) && (atoms[j].notify))
+ {
+ cnp_debug("Atom %s matches\n",atoms[j].name);
+ goto done;
+ }
+ }
}
cnp_debug("Couldn't find anything that matches\n");
return ECORE_CALLBACK_PASS_ON;
- done:
+done:
cnp_debug("Sending request for %s\n",atoms[j].name);
sel->request(elm_win_xwindow_get(sel->requestwidget), atoms[j].name);
/* Start from 1: Skip targets */
for (j = 1 ; j < CNP_N_ATOMS ; j ++)
{
- if (!(atoms[j].formats & sel->requestformat)) continue;
- for (i = 0 ; i < targets->data.length ; i ++)
- {
- if ((atoms[j].atom == atomlist[i]) && (atoms[j].response))
+ if (!(atoms[j].formats & sel->requestformat)) continue;
+ for (i = 0 ; i < targets->data.length ; i ++)
+ {
+ if ((atoms[j].atom == atomlist[i]) && (atoms[j].response))
{
- /* Found a match: Use it */
- goto found;
+ /* Found a match: Use it */
+ goto found;
}
}
}
found:
if (j == CNP_N_ATOMS)
{
- cnp_debug("No matching type found\n");
- return 0;
+ cnp_debug("No matching type found\n");
+ return 0;
}
-
+
top = elm_widget_top_get(sel->requestwidget);
if (!top) return 0;
-
+
sel->request(elm_win_xwindow_get(top), atoms[j].name);
return 0;
}
{
Ecore_X_Selection_Data *data;
char *str;
-
+
data = notify->data;
cnp_debug("Notify handler text %d %d %p\n", data->format,data->length, data->data);
str = mark_up((char *)data->data, data->length, NULL);
if (sel == (selections + ELM_SEL_XDND))
{
Elm_Selection_Data ddata;
-
+
cnp_debug("drag & drop\n");
/* FIXME: this needs to be generic: Used for all receives */
EINA_LIST_FOREACH(drops, l, dropable)
{
cnp_debug("Paste request\n");
}
-
+
return 0;
}
Ecore_X_Selection_Data *data;
Tmp_Info *tmp;
Paste_Image *pi;
-
+
cnp_debug("got a png (or a jpeg)!\n");
data = notify->data;
-
+
cnp_debug("Size if %d\n", data->length);
if (sel->datacb)
{
Elm_Selection_Data ddata;
-
+
ddata.x = ddata.y = 0;
ddata.format = ELM_SEL_FORMAT_IMAGE;
ddata.data = data->data;
sel->datacb(sel->udata, sel->widget, &ddata);
return 0;
}
-
+
/* generate tmp name */
tmp = elm_cnp_tempfile_create(data->length);
memcpy(tmp->map, data->data, data->length);
munmap(tmp->map,data->length);
-
+
/* FIXME: Add to paste image data to clean up */
pi = pasteimage_alloc(tmp->filename, strlen(tmp->filename));
pasteimage_append(pi, sel->requestwidget);
notify_handler_html(Cnp_Selection *sel, Ecore_X_Event_Selection_Notify *notify)
{
Ecore_X_Selection_Data *data;
-
+
cnp_debug("Got some HTML: Checking encoding is useful\n");
data = notify->data;
-
+
if (sel->datacb)
{
Elm_Selection_Data ddata;
cnp_debug("text converter\n");
sel = selections + *((int *)data);
if (!sel->active) return EINA_TRUE;
-
+
if ((sel->format & ELM_SEL_FORMAT_MARKUP) ||
(sel->format & ELM_SEL_FORMAT_HTML))
{
- *data_ret = remove_tags(sel->selbuf, size_ret);
+ *data_ret = remove_tags(sel->selbuf, size_ret);
}
else if (sel->format & ELM_SEL_FORMAT_TEXT)
{
}
else if (sel->format & ELM_SEL_FORMAT_IMAGE)
{
- cnp_debug("Image %s\n", evas_object_type_get(sel->widget));
- cnp_debug("Elm type: %s\n", elm_object_widget_type_get(sel->widget));
- evas_object_image_file_get(elm_photocam_internal_image_get(sel->widget), (const char **)data_ret, NULL);
- if (!*data_ret) *data_ret = strdup("No file");
- else *data_ret = strdup(*data_ret);
- *size_ret = strlen(*data_ret);
+ cnp_debug("Image %s\n", evas_object_type_get(sel->widget));
+ cnp_debug("Elm type: %s\n", elm_object_widget_type_get(sel->widget));
+ evas_object_image_file_get(elm_photocam_internal_image_get(sel->widget), (const char **)data_ret, NULL);
+ if (!*data_ret) *data_ret = strdup("No file");
+ else *data_ret = strdup(*data_ret);
+ *size_ret = strlen(*data_ret);
}
return EINA_TRUE;
}
static Eina_Bool
uri_converter(char *target __UNUSED__, void *data, int size __UNUSED__, void **data_ret, int *size_ret, Ecore_X_Atom *ttype __UNUSED__, int *typesize __UNUSED__)
{
- Cnp_Selection *sel;
- sel = selections + *((int *)data);
- cnp_debug("Uri converter\n");
- if (data_ret) *data_ret = strdup(sel->selbuf);
- if (size_ret) *size_ret = strlen(sel->selbuf);
- return EINA_TRUE;
+ Cnp_Selection *sel;
+ sel = selections + *((int *)data);
+ cnp_debug("Uri converter\n");
+ if (data_ret) *data_ret = strdup(sel->selbuf);
+ if (size_ret) *size_ret = strlen(sel->selbuf);
+ return EINA_TRUE;
}
/*
cnp_debug("image provider for %s called\n", item);
EINA_LIST_FOREACH(pastedimages, l, pi)
{
- cnp_debug("is it %s?\n",pi->tag);
- if (!strcmp(pi->tag, item))
+ cnp_debug("is it %s?\n",pi->tag);
+ if (!strcmp(pi->tag, item))
{
- /* Found it */
- Evas_Object *o;
- o = evas_object_image_filled_add(evas_object_evas_get(entry));
- /* FIXME: Handle eets */
- cnp_debug("file is %s (object is %p)\n", pi->file, o);
- evas_object_image_file_set(o, pi->file, NULL);
- evas_object_show(o);
- return o;
+ /* Found it */
+ Evas_Object *o;
+ o = evas_object_image_filled_add(evas_object_evas_get(entry));
+ /* FIXME: Handle eets */
+ cnp_debug("file is %s (object is %p)\n", pi->file, o);
+ evas_object_image_file_set(o, pi->file, NULL);
+ evas_object_show(o);
+ return o;
}
}
return NULL;
pi = calloc(1, sizeof(Paste_Image));
if (!pi) return NULL;
-
+
len = snprintf(NULL, 0, "pasteimage-%p", pi);
len++;
buf = malloc(len);
}
snprintf(buf, len, "pasteimage-%p", pi);
pi->tag = buf;
-
+
if (file)
{
if (strstr(file,"file://")) file += prefixlen;
{
void *v;
const char *type;
-
+
if (!entry) return EINA_FALSE;
type = elm_widget_type_get(entry);
cnp_debug("type is %s\n", type);
if ((!type) || (strcmp(type, "entry"))) return EINA_FALSE;
-
+
v = evas_object_data_get(entry, PROVIDER_SET);
if (!v)
{
EINA_LIST_FOREACH_SAFE(pastedimages, l, next, pi)
{
- if (pi->entry == entry)
- pastedimages = eina_list_remove_list(pastedimages, l);
+ if (pi->entry == entry)
+ pastedimages = eina_list_remove_list(pastedimages, l);
}
}
char *q,*ret;
int i;
if (!p) return NULL;
-
+
q = malloc(strlen(p) + 1);
if (!q) return NULL;
ret = q;
while (*p)
{
- if ((*p != '<') && (*p != '&')) *q++ = *p++;
+ if ((*p != '<') && (*p != '&')) *q++ = *p++;
else if (*p == '<')
{
- if ((p[1] == 'b') && (p[2] == 'r') &&
+ if ((p[1] == 'b') && (p[2] == 'r') &&
((p[3] == ' ') || (p[3] == '/') || (p[3] == '>')))
- *q++ = '\n';
- while ((*p) && (*p != '>')) p++;
- p++;
- }
+ *q++ = '\n';
+ while ((*p) && (*p != '>')) p++;
+ p++;
+ }
else if (*p == '&')
{
- p++;
- for (i = 0 ; i < N_ESCAPES ; i++)
+ p++;
+ for (i = 0 ; i < N_ESCAPES ; i++)
{
if (!strncmp(p,escapes[i].escape, strlen(escapes[i].escape)))
{
p += strlen(escapes[i].escape);
- *q = escapes[i].value;
- q++;
- break;
+ *q = escapes[i].value;
+ q++;
+ break;
}
}
- if (i == N_ESCAPES) *q ++= '&';
+ if (i == N_ESCAPES) *q ++= '&';
}
}
*q = 0;
const char *p;
char *q, *ret;
const char *endp = NULL;
-
+
if (!start) return NULL;
if (inlen >= 0) endp = start + inlen;
/* First pass: Count characters */
}
if (i == N_ESCAPES) l++;
}
-
+
q = ret = malloc(l + 1);
-
+
/* Second pass: Change characters */
- for (p = start; *p; )
- {
- for (i = 0; i < N_ESCAPES; i++)
- {
- if (*p == escapes[i].value)
- {
- strcpy(q, escapes[i].escape);
- q += strlen(escapes[i].escape);
- p ++;
- break;
- }
- }
- if (i == N_ESCAPES) *q++ = *p++;
- }
+ for (p = start; *p; )
+ {
+ for (i = 0; i < N_ESCAPES; i++)
+ {
+ if (*p == escapes[i].value)
+ {
+ strcpy(q, escapes[i].escape);
+ q += strlen(escapes[i].escape);
+ p ++;
+ break;
+ }
+ }
+ if (i == N_ESCAPES) *q++ = *p++;
+ }
*q = 0;
-
+
if (lenp) *lenp = l;
return ret;
}
if (savedtypes.types) free(savedtypes.types);
savedtypes.types = malloc(sizeof(char *) * enter->num_types);
if (!savedtypes.types) return EINA_FALSE;
-
+
for (i = 0; i < enter->num_types; i++)
{
savedtypes.types[i] = eina_stringshare_add(enter->types[i]);
ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
savedtypes.x = drop->position.x - x;
savedtypes.y = drop->position.y - y;
-
+
cnp_debug("Drop position is %d,%d\n", savedtypes.x, savedtypes.y);
for (; l; l = l->next)
evas_object_geometry_get(dropable->obj, &x, &y, &w, &h);
if ((savedtypes.x >= x) && (savedtypes.y >= y) &&
(savedtypes.x < x + w) && (savedtypes.y < y + h))
- break; /* found! */
+ break; /* found! */
}
-
+
if (!l) return EINA_TRUE; /* didn't find one */
-
+
evas_object_geometry_get(dropable->obj, &x, &y, NULL, NULL);
savedtypes.x -= x;
savedtypes.y -= y;
-
+
/* Find our type from the previous list */
for (i = 0; i < CNP_N_ATOMS; i++)
{
- for (j = 0; j < savedtypes.ntypes; j++)
+ for (j = 0; j < savedtypes.ntypes; j++)
{
if (!strcmp(savedtypes.types[j], atoms[i].name)) goto found;
}
}
-
+
cnp_debug("Didn't find a target\n");
return EINA_TRUE;
-
+
found:
cnp_debug("Found a target we'd like: %s\n", atoms[i].name);
cnp_debug("0x%x\n",xwin);
-
+
if (i == CNP_ATOM_text_urilist)
{
cnp_debug("We found a URI... (%scached) %s\n",
{
char *entrytag;
static const char *tagstring = "<item absize=240x180 href="
- "file://%s></item>";
+ "file://%s></item>";
ddata.x = savedtypes.x;
ddata.y = savedtypes.y;
/* If it's markup that also supports images */
if ((dropable->types & ELM_SEL_FORMAT_MARKUP) &&
- (dropable->types & ELM_SEL_FORMAT_IMAGE))
+ (dropable->types & ELM_SEL_FORMAT_IMAGE))
{
int len;
ddata.format = ELM_SEL_FORMAT_MARKUP;
struct _Ecore_X_Event_Xdnd_Status *status = ev;
if (!status) return EINA_TRUE;
-
+
/* Only thing we care about: will accept */
if (status->will_accept)
{
xwin = (Ecore_X_Window)ecore_evas_window_get
(ecore_evas_ecore_evas_get(evas_object_evas_get(obj)));
-
+
ecore_x_dnd_aware_set(xwin, EINA_TRUE);
-
+
cnp_debug("Adding drop target calls\n");
handler_enter = ecore_event_handler_add(ECORE_X_EVENT_XDND_ENTER,
_dnd_enter, NULL);
_dnd_position, NULL);
handler_drop = ecore_event_handler_add(ECORE_X_EVENT_XDND_DROP,
_dnd_drop, NULL);
-
+
return EINA_TRUE;
}
Dropable *drop,*del;
Eina_List *item;
Ecore_X_Window xwin;
-
+
del = NULL;
EINA_LIST_FOREACH(drops, item, drop)
{
}
}
if (!del) return EINA_FALSE;
-
+
evas_object_event_callback_del(obj, EVAS_CALLBACK_FREE,
(Evas_Object_Event_Cb)elm_drop_target_del);
free(drop);
/* If still drops there: All fine.. continue */
if (drops) return EINA_TRUE;
-
+
cnp_debug("Disabling DND\n");
xwin = (Ecore_X_Window)ecore_evas_window_get
(ecore_evas_ecore_evas_get(evas_object_evas_get(obj)));
ecore_x_dnd_aware_set(xwin, EINA_FALSE);
-
+
ecore_event_handler_del(handler_pos);
ecore_event_handler_del(handler_drop);
ecore_event_handler_del(handler_enter);
-
+
if (savedtypes.pi)
{
pasteimage_free(savedtypes.pi);
savedtypes.pi = NULL;
}
-
+
return EINA_TRUE;
}
static void
_drag_move(void *data __UNUSED__, Ecore_X_Xdnd_Position *pos)
{
- evas_object_move(dragwin,
- pos->position.x - _dragx,
+ evas_object_move(dragwin,
+ pos->position.x - _dragx,
pos->position.y - _dragy);
}
int x, y, x2, y2, x3, y3;
Evas_Object *icon;
int w, h;
-
+
if (!_elm_cnp_init_count) _elm_cnp_init();
-
+
xwin = elm_win_xwindow_get(obj);
cnp_debug("starting drag...\n");
sel->selbuf = data ? strdup(data) : NULL;
dragdonecb = dragdone;
dragdonedata = donecbdata;
-
+
ecore_x_dnd_callback_pos_update_set(_drag_move, NULL);
ecore_x_dnd_begin(xwin, (unsigned char *)&xdnd, sizeof(Elm_Sel_Type));
evas_object_event_callback_add(obj, EVAS_CALLBACK_MOUSE_UP,
_drag_mouse_up, NULL);
-
+
handler_status = ecore_event_handler_add(ECORE_X_EVENT_XDND_STATUS,
_dnd_status, NULL);
-
+
dragwin = elm_win_add(NULL, "Elm Drag Object", ELM_WIN_UTILITY);
elm_win_override_set(dragwin, 1);
-
+
/* FIXME: Images only */
icon = elm_icon_add(dragwin);
elm_icon_file_set(icon, data + 7, NULL); /* 7!? "file://" */
evas_object_move(dragwin, x, y);
evas_object_resize(icon, w, h);
evas_object_resize(dragwin, w, h);
-
+
evas_object_show(icon);
evas_object_show(dragwin);
Tmp_Info *info;
const char *tmppath;
int len;
-
+
info = malloc(sizeof(Tmp_Info));
if (!info) return NULL;
-
+
tmppath = getenv("TMP");
if (!tmppath) tmppath = P_tmpdir;
if (!tmppath) tmppath = "/tmp";
return NULL;
}
snprintf(info->filename,len,"%s/%sXXXXXX", tmppath, "elmcnpitem-");
-
+
info->fd = mkstemp(info->filename);
-
+
# ifdef __linux__
{
char *tmp;
/* And before someone says anything see POSIX 1003.1-2008 page 400 */
long pid;
-
+
pid = (long)getpid();
/* Use pid instead of /proc/self: That way if can be passed around */
len = snprintf(NULL,0,"/proc/%li/fd/%i", pid, info->fd);
}
}
# endif
-
+
cnp_debug("filename is %s\n", info->filename);
if (size < 1)
{
info->len = 0;
return info;
}
-
+
/* Map it in */
if (ftruncate(info->fd, size))
{
info->len = 0;
return info;
}
-
+
info->map = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED, info->fd, 0);
if (info->map == MAP_FAILED)
{
info->map = NULL;
info->len = 0;
}
-
+
return info;
}
static const Evas_Smart_Cb_Description _signals[] =
{
- {SIG_CHANGED, ""},
- {NULL, NULL}
+ {SIG_CHANGED, ""},
+ {NULL, NULL}
};
static void
switch (i)
{
case 0:
- r = v;
- g = t;
- b = p;
- break;
- case 1:
- r = q;
- g = v;
- b = p;
- break;
- case 2:
- r = p;
- g = v;
- b = t;
- break;
- case 3:
- r = p;
- g = q;
- b = v;
- break;
- case 4:
- r = t;
- g = p;
- b = v;
- break;
- case 5:
- r = v;
- g = p;
- b = q;
- break;
+ r = v;
+ g = t;
+ b = p;
+ break;
+ case 1:
+ r = q;
+ g = v;
+ b = p;
+ break;
+ case 2:
+ r = p;
+ g = v;
+ b = t;
+ break;
+ case 3:
+ r = p;
+ g = q;
+ b = v;
+ break;
+ case 4:
+ r = t;
+ g = p;
+ b = v;
+ break;
+ case 5:
+ r = v;
+ g = p;
+ b = q;
+ break;
}
}
i = (int)(r * 255.0);
switch (cp->color_type)
{
- case HUE:
- wd->h = 360.0 * x;
-
- if (x < one_six)
- {
- wd->er = 255;
- wd->eg = (255.0 * x * 6.0);
- wd->eb = 0;
- }
- else if (x < 2 * one_six)
- {
- wd->er = 255 - (int)(255.0 * (x - one_six) * 6.0);
- wd->eg = 255;
- wd->eb = 0;
- }
- else if (x < 3 * one_six)
- {
- wd->er = 0;
- wd->eg = 255;
- wd->eb = (int)(255.0 * (x - (2.0 * one_six)) * 6.0);
- }
- else if (x < 4 * one_six)
- {
- wd->er = 0;
- wd->eg = 255 - (int)(255.0 * (x - (3.0 * one_six)) * 6.0);
- wd->eb = 255;
- }
- else if (x < 5 * one_six)
- {
- wd->er = 255.0 * (x - (4.0 * one_six)) * 6.0;
- wd->eg = 0;
- wd->eb = 255;
- }
- else
- {
- wd->er = 255;
- wd->eg = 0;
- wd->eb = 255 - (int)(255.0 * (x - (5.0 * one_six)) * 6.0);
- }
-
- evas_object_color_set(wd->cp[0]->arrow, wd->er, wd->eg, wd->eb, 255);
- evas_object_color_set(wd->cp[1]->bg_rect, wd->er, wd->eg, wd->eb, 255);
- evas_object_color_set(wd->cp[2]->bg_rect, wd->er, wd->eg, wd->eb, 255);
- evas_object_color_set(wd->cp[3]->bar, wd->er, wd->eg, wd->eb, 255);
-
- _color_with_saturation(wd);
- evas_object_color_set(wd->cp[1]->arrow, wd->sr, wd->sg, wd->sb, 255);
-
- _color_with_lightness(wd);
- evas_object_color_set(wd->cp[2]->arrow, wd->lr, wd->lg, wd->lb, 255);
-
- evas_object_color_set(wd->cp[3]->arrow,
- (wd->er * wd->a) / 255,
- (wd->eg * wd->a) / 255,
- (wd->eb * wd->a) / 255,
- wd->a);
- break;
- case SATURATION:
- wd->s = 1.0 - x;
- _color_with_saturation(wd);
- evas_object_color_set(wd->cp[1]->arrow, wd->sr, wd->sg, wd->sb, 255);
- break;
- case LIGHTNESS:
- wd->l = x;
- _color_with_lightness(wd);
- evas_object_color_set(wd->cp[2]->arrow, wd->lr, wd->lg, wd->lb, 255);
- break;
- case ALPHA:
- wd->a = 255.0 * x;
- evas_object_color_set(wd->cp[3]->arrow, wd->er, wd->eg, wd->eb, wd->a);
- break;
- default:
- break;
+ case HUE:
+ wd->h = 360.0 * x;
+
+ if (x < one_six)
+ {
+ wd->er = 255;
+ wd->eg = (255.0 * x * 6.0);
+ wd->eb = 0;
+ }
+ else if (x < 2 * one_six)
+ {
+ wd->er = 255 - (int)(255.0 * (x - one_six) * 6.0);
+ wd->eg = 255;
+ wd->eb = 0;
+ }
+ else if (x < 3 * one_six)
+ {
+ wd->er = 0;
+ wd->eg = 255;
+ wd->eb = (int)(255.0 * (x - (2.0 * one_six)) * 6.0);
+ }
+ else if (x < 4 * one_six)
+ {
+ wd->er = 0;
+ wd->eg = 255 - (int)(255.0 * (x - (3.0 * one_six)) * 6.0);
+ wd->eb = 255;
+ }
+ else if (x < 5 * one_six)
+ {
+ wd->er = 255.0 * (x - (4.0 * one_six)) * 6.0;
+ wd->eg = 0;
+ wd->eb = 255;
+ }
+ else
+ {
+ wd->er = 255;
+ wd->eg = 0;
+ wd->eb = 255 - (int)(255.0 * (x - (5.0 * one_six)) * 6.0);
+ }
+
+ evas_object_color_set(wd->cp[0]->arrow, wd->er, wd->eg, wd->eb, 255);
+ evas_object_color_set(wd->cp[1]->bg_rect, wd->er, wd->eg, wd->eb, 255);
+ evas_object_color_set(wd->cp[2]->bg_rect, wd->er, wd->eg, wd->eb, 255);
+ evas_object_color_set(wd->cp[3]->bar, wd->er, wd->eg, wd->eb, 255);
+
+ _color_with_saturation(wd);
+ evas_object_color_set(wd->cp[1]->arrow, wd->sr, wd->sg, wd->sb, 255);
+
+ _color_with_lightness(wd);
+ evas_object_color_set(wd->cp[2]->arrow, wd->lr, wd->lg, wd->lb, 255);
+
+ evas_object_color_set(wd->cp[3]->arrow,
+ (wd->er * wd->a) / 255,
+ (wd->eg * wd->a) / 255,
+ (wd->eb * wd->a) / 255,
+ wd->a);
+ break;
+ case SATURATION:
+ wd->s = 1.0 - x;
+ _color_with_saturation(wd);
+ evas_object_color_set(wd->cp[1]->arrow, wd->sr, wd->sg, wd->sb, 255);
+ break;
+ case LIGHTNESS:
+ wd->l = x;
+ _color_with_lightness(wd);
+ evas_object_color_set(wd->cp[2]->arrow, wd->lr, wd->lg, wd->lb, 255);
+ break;
+ case ALPHA:
+ wd->a = 255.0 * x;
+ evas_object_color_set(wd->cp[3]->arrow, wd->er, wd->eg, wd->eb, wd->a);
+ break;
+ default:
+ break;
}
_hsl_to_rgb(wd);
}
Evas *e;
ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
-
+
ELM_SET_WIDTYPE(widtype, "colorselector");
elm_widget_type_set(obj, "colorselector");
elm_widget_sub_object_add(parent, obj);