calendar bit of clock moves along quite nicely.

SVN revision: 59961
This commit is contained in:
Carsten Haitzler 2011-06-05 04:30:39 +00:00
parent 2da6a07240
commit 101f8f17d7
2 changed files with 295 additions and 106 deletions

View File

@ -12181,36 +12181,22 @@ collections {
group { name: "e/modules/clock/calendar/dayname"; group { name: "e/modules/clock/calendar/dayname";
parts { parts {
part { name: "day"; type: RECT;
mouse_events: 0;
description { state: "default" 0.0;
color: 255 255 255 128;
}
description { state: "today" 0.0;
color: 0 0 0 128;
}
}
part { name: "e.text.label"; part { name: "e.text.label";
type: TEXT; type: TEXT;
effect: SHADOW;
mouse_events: 0; mouse_events: 0;
description { state: "default" 0.0; description { state: "default" 0.0;
fixed: 0 1;
align: 0.5 0.5; align: 0.5 0.5;
rel1 { color: 0 0 0 64;
relative: 0.0 0.0; color3: 255 255 255 255;
offset: 1 1; rel1.offset: 3 3;
} rel2.offset: -3 -3;
rel2 {
relative: 1.0 1.0;
offset: -2 -2;
}
color: 0 0 0 255;
text { text {
text: "XXX";
font: "Sans"; font: "Sans";
align: 0.5 0.5; align: 0.5 0.5;
ellipsis: 0.0;
size: 8; size: 8;
min: 0 1; min: 1 1;
text_class: "module_small"; text_class: "module_small";
} }
} }
@ -12218,6 +12204,9 @@ collections {
} }
} }
group { name: "e/modules/clock/calendar/day"; group { name: "e/modules/clock/calendar/day";
images {
image: "inset_sunk.png" COMP;
}
parts { parts {
part { name: "hidden"; type: RECT; part { name: "hidden"; type: RECT;
mouse_events: 0; mouse_events: 0;
@ -12225,6 +12214,7 @@ collections {
color: 255 255 255 255; color: 255 255 255 255;
} }
description { state: "hidden" 0.0; description { state: "hidden" 0.0;
inherit: "default" 0.0;
color: 255 255 255 64; color: 255 255 255 64;
} }
} }
@ -12233,47 +12223,61 @@ collections {
clip_to: "hidden"; clip_to: "hidden";
description { state: "default" 0.0; description { state: "default" 0.0;
color: 0 0 0 0; color: 0 0 0 0;
rel1.offset: 1 1;
rel2.offset: -2 -2;
} }
description { state: "weekend" 0.0; description { state: "weekend" 0.0;
color: 255 0 0 128; inherit: "default" 0.0;
color: 255 0 0 64;
} }
} }
part { name: "day"; type: RECT; part { name: "day"; type: RECT;
mouse_events: 0; mouse_events: 0;
clip_to: "hidden"; clip_to: "hidden";
description { state: "default" 0.0; description { state: "default" 0.0;
color: 255 255 255 128; color: 255 255 255 0;
rel1.offset: 1 1;
rel2.offset: -2 -2;
} }
description { state: "today" 0.0; description { state: "today" 0.0;
inherit: "default" 0.0;
color: 0 0 0 128; color: 0 0 0 128;
} }
} }
part { name: "e.text.label"; part { name: "e.text.label";
type: TEXT; type: TEXT;
effect: SOFT_SHADOW;
mouse_events: 0; mouse_events: 0;
clip_to: "hidden"; clip_to: "hidden";
description { state: "default" 0.0; description { state: "default" 0.0;
fixed: 1 1;
align: 0.5 0.5; align: 0.5 0.5;
rel1 { color: 0 0 0 255;
relative: 0.0 0.0;
offset: 1 1;
}
rel2 {
relative: 1.0 1.0;
offset: -2 -2;
}
color: 255 255 255 255;
color3: 0 0 0 32; color3: 0 0 0 32;
rel1.offset: 2 2;
rel2.offset: -3 -3;
text { text {
font: "Sans:style=Bold"; text: "88";
font: "Sans";
align: 0.5 0.5; align: 0.5 0.5;
size: 10; size: 8;
min: 1 1; min: 1 1;
text_class: "module_normal"; text_class: "module_small";
} }
} }
description { state: "today" 0.0;
inherit: "default" 0.0;
color: 255 255 255 255;
}
}
part { name: "inset";
mouse_events: 0;
clip_to: "hidden";
description { state: "default" 0.0;
image.normal: "inset_sunk.png";
image.middle: 0;
image.border: 7 7 7 7;
fill.smooth: 0;
color: 255 255 255 128;
}
} }
} }
programs { programs {
@ -12306,47 +12310,40 @@ collections {
source: "e"; source: "e";
action: STATE_SET "today" 0.0; action: STATE_SET "today" 0.0;
target: "day"; target: "day";
target: "e.text.label";
} }
program { name: "someday"; program { name: "someday";
signal: "e,state,someday"; signal: "e,state,someday";
source: "e"; source: "e";
action: STATE_SET "default" 0.0; action: STATE_SET "default" 0.0;
target: "day"; target: "day";
target: "e.text.label";
} }
} }
} }
group { name: "e/modules/clock/calendar"; group { name: "e/modules/clock/calendar";
images {
image: "arrow_left.png" COMP;
image: "arrow_right.png" COMP;
image: "inset_sunk.png" COMP;
image: "ilist_1.png" COMP;
image: "ilist_2.png" COMP;
image: "ilist_item_shadow.png" COMP;
}
parts { parts {
part { name: "names"; type: RECT;
mouse_events: 0;
description { state: "default" 0.0;
color: 0 0 0 64;
rel1.relative: 0.0 0.10;
rel2.relative: 1.0 0.25;
step: 7 5;
}
}
part { name: "cal"; type: RECT;
mouse_events: 0;
description { state: "default" 0.0;
color: 0 0 0 64;
rel1.to_y: "names";
rel1.relative: 0.0 1.0;
step: 7 5;
}
}
part { name: "e.text.month"; part { name: "e.text.month";
type: TEXT; type: TEXT;
effect: SOFT_SHADOW; effect: SOFT_SHADOW;
mouse_events: 0; mouse_events: 0;
description { state: "default" 0.0; description { state: "default" 0.0;
fixed: 0 1; fixed: 0 1;
align: 0.0 0.5; align: 0.0 0.0;
rel1 { rel1 {
relative: 0.0 0.0; to_x: "prev";
relative: 1.0 0.0;
} }
rel2 { rel2 {
relative: 1.0 0.10; relative: 1.0 0.0;
} }
color: 255 255 255 255; color: 255 255 255 255;
color3: 0 0 0 32; color3: 0 0 0 32;
@ -12365,12 +12362,13 @@ collections {
mouse_events: 0; mouse_events: 0;
description { state: "default" 0.0; description { state: "default" 0.0;
fixed: 0 1; fixed: 0 1;
align: 1.0 0.5; align: 1.0 0.0;
rel1 { rel1 {
relative: 0.0 0.0; relative: 0.0 0.0;
} }
rel2 { rel2 {
relative: 1.0 0.10; to_x: "next";
relative: 0.0 0.0;
} }
color: 255 255 255 255; color: 255 255 255 255;
color3: 0 0 0 32; color3: 0 0 0 32;
@ -12383,14 +12381,154 @@ collections {
} }
} }
} }
part { name: "previm";
mouse_events: 0;
description { state: "default" 0.0;
min: 9 9;
max: 9 9;
rel1.to: "prev";
rel2.to: "prev";
image.normal: "arrow_left.png";
}
description { state: "pressed" 0.0;
inherit: "default" 0.0;
rel1.offset: 0 2;
rel2.offset: -1 1;
}
}
part { name: "prev";
type: RECT;
description { state: "default" 0.0;
align: 0.0 0.5;
color: 0 0 0 0;
aspect: 1.0 1.0;
aspect_preference: VERTICAL;
rel1.to_y: "e.text.month";
rel1.relative: 0.0 0.0;
rel2.to_y: "e.text.month";
rel2.relative: 0.0 1.0;
}
program { name: "prev_down";
signal: "mouse,down,1";
source: "prev";
action: STATE_SET "pressed" 0.0;
target: "previm";
}
program { name: "prev_up";
signal: "mouse,up,1";
source: "prev";
action: STATE_SET "default" 0.0;
target: "previm";
}
program { name: "prev_clicked";
signal: "mouse,clicked,1";
source: "prev";
action: SIGNAL_EMIT "e,action,prev" "";
}
}
part { name: "nextim";
mouse_events: 0;
description { state: "default" 0.0;
min: 9 9;
max: 9 9;
rel1.to: "next";
rel2.to: "next";
image.normal: "arrow_right.png";
}
description { state: "pressed" 0.0;
inherit: "default" 0.0;
rel1.offset: 0 2;
rel2.offset: -1 1;
}
}
part { name: "next";
type: RECT;
description { state: "default" 0.0;
align: 1.0 0.5;
color: 0 0 0 0;
aspect: 1.0 1.0;
aspect_preference: VERTICAL;
rel1.to_y: "e.text.month";
rel1.relative: 1.0 0.0;
rel2.to_y: "e.text.month";
rel2.relative: 1.0 1.0;
}
program { name: "next_down";
signal: "mouse,down,1";
source: "next";
action: STATE_SET "pressed" 0.0;
target: "nextim";
}
program { name: "next_up";
signal: "mouse,up,1";
source: "next";
action: STATE_SET "default" 0.0;
target: "nextim";
}
program { name: "next_clicked";
signal: "mouse,clicked,1";
source: "next";
action: SIGNAL_EMIT "e,action,next" "";
}
}
part { name: "days_bg1";
mouse_events: 0;
description { state: "default" 0.0;
rel1.to: "e.table.days";
rel1.offset: -1 -1;
rel2.to: "e.table.days";
rel2.offset: 0 0;
image.normal: "ilist_2.png";
image.border: 2 2 2 2;
}
}
part { name: "daynames_bg0";
mouse_events: 0;
description { state: "default" 0.0;
fixed: 0 1;
align: 0.0 0.0;
min: 0 10;
rel1 {
to: "daynames_bg1";
relative: 0.0 1.0;
offset: 0 0;
}
rel2 {
to: "daynames_bg1";
relative: 1.0 1.0;
offset: -1 0;
}
image.normal: "ilist_item_shadow.png";
fill.smooth: 0;
}
}
part { name: "daynames_bg1";
mouse_events: 0;
description { state: "default" 0.0;
rel1.to: "e.table.daynames";
rel1.offset: -1 -1;
rel2.to: "e.table.daynames";
rel2.offset: 0 0;
image.normal: "ilist_1.png";
image.border: 2 2 2 2;
}
}
part { name: "e.table.daynames"; type: TABLE; part { name: "e.table.daynames"; type: TABLE;
description { state: "default" 0.0; description { state: "default" 0.0;
rel1.to: "names"; fixed: 0 1;
rel2.to: "names"; align: 0.5 0.0;
rel1.to_y: "e.text.month";
rel1.relative: 0.0 1.0;
rel1.offset: 2 2;
rel2.to_y: "e.text.month";
rel2.relative: 1.0 1.0;
rel2.offset: -3 2;
step: 7 1;
table { table {
homogeneous: TABLE; homogeneous: TABLE;
padding: 1 1; padding: 1 1;
align: 0.5 0.5; align: 0.5 0.5;
min: 1 1;
} }
} }
table { items { table { items {
@ -12413,12 +12551,16 @@ collections {
} }
part { name: "e.table.days"; type: TABLE; part { name: "e.table.days"; type: TABLE;
description { state: "default" 0.0; description { state: "default" 0.0;
rel1.to: "cal"; rel1.to_y: "e.table.daynames";
rel2.to: "cal"; rel1.relative: 0.0 1.0;
rel1.offset: 2 2;
rel2.offset: -3 -3;
step: 7 5;
table { table {
homogeneous: TABLE; homogeneous: TABLE;
padding: 1 1; padding: 1 1;
align: 0.5 0.5; align: 0.5 0.5;
min: 1 1;
} }
} }
table { items { table { items {
@ -12469,8 +12611,29 @@ collections {
DAY(4, 4); DAY(4, 4);
DAY(5, 4); DAY(5, 4);
DAY(6, 4); DAY(6, 4);
DAY(0, 5);
DAY(1, 5);
DAY(2, 5);
DAY(3, 5);
DAY(4, 5);
DAY(5, 5);
DAY(6, 5);
} } } }
} }
part { name: "inset";
mouse_events: 0;
description { state: "default" 0.0;
image.normal: "inset_sunk.png";
image.middle: 0;
image.border: 7 7 7 7;
fill.smooth: 0;
rel1.to: "e.table.daynames";
rel1.offset: -2 -2;
rel2.to: "e.table.days";
rel2.offset: 2 2;
}
}
} }
} }

View File

@ -43,10 +43,10 @@ struct _Instance
char year[8]; char year[8];
char month[32]; char month[32];
const char *daynames[7]; const char *daynames[7];
unsigned char daynums[7][5]; unsigned char daynums[7][6];
Eina_Bool dayweekends[7][5]; Eina_Bool dayweekends[7][6];
Eina_Bool dayvalids[7][5]; Eina_Bool dayvalids[7][6];
Eina_Bool daytoday[7][5]; Eina_Bool daytoday[7][6];
}; };
static E_Module *clock_module = NULL; static E_Module *clock_module = NULL;
@ -89,7 +89,7 @@ _time_eval(Instance *inst)
// tm2 == month baseline @ 1st // tm2 == month baseline @ 1st
memcpy(&tms, tm, sizeof(struct tm)); memcpy(&tms, tm, sizeof(struct tm));
num = 0; num = 0;
for (day = (0 - 6); day < (31 + 6); day++) for (day = (0 - 6); day < (31 + 16); day++)
{ {
memcpy(&tmm, &tms, sizeof(struct tm)); memcpy(&tmm, &tms, sizeof(struct tm));
tmm.tm_sec = 0; tmm.tm_sec = 0;
@ -117,7 +117,7 @@ _time_eval(Instance *inst)
int y = num / 7; int y = num / 7;
int x = num % 7; int x = num % 7;
if (y < 5) if (y < 6)
{ {
inst->daynums[x][y] = tmm.tm_mday; inst->daynums[x][y] = tmm.tm_mday;
@ -174,35 +174,12 @@ _time_eval(Instance *inst)
} }
static void static void
_clock_popup_new(Instance *inst) _clock_moth_update(Instance *inst)
{ {
Evas *evas; Evas_Object *od, *oi;
Evas_Object *o, *oi, *od;
int x, y; int x, y;
if (inst->popup) return;
_time_eval(inst);
inst->popup = e_gadcon_popup_new(inst->gcc);
evas = inst->popup->win->evas;
inst->o_table = e_widget_table_add(evas, 0);
oi = edje_object_add(evas); oi = inst->o_cal;
inst->o_popclock = oi;
e_theme_edje_object_set(oi, "base/theme/modules/clock",
"e/modules/clock/main");
o = e_widget_image_add_from_object(evas, oi, 128, 128);
evas_object_show(oi);
e_widget_table_object_align_append(inst->o_table, o,
0, 0, 1, 1, 0, 0, 0, 0, 0.5, 0.5);
oi = edje_object_add(evas);
inst->o_popclock = oi;
e_theme_edje_object_set(oi, "base/theme/modules/clock",
"e/modules/clock/calendar");
edje_object_part_text_set(oi, "e.text.month", inst->month); edje_object_part_text_set(oi, "e.text.month", inst->month);
edje_object_part_text_set(oi, "e.text.year", inst->year); edje_object_part_text_set(oi, "e.text.year", inst->year);
for (x = 0; x < 7; x++) for (x = 0; x < 7; x++)
@ -211,7 +188,7 @@ _clock_popup_new(Instance *inst)
edje_object_part_text_set(od, "e.text.label", inst->daynames[x]); edje_object_part_text_set(od, "e.text.label", inst->daynames[x]);
} }
for (y = 0; y < 5; y++) for (y = 0; y < 6; y++)
{ {
for (x = 0; x < 7; x++) for (x = 0; x < 7; x++)
{ {
@ -234,14 +211,61 @@ _clock_popup_new(Instance *inst)
edje_object_signal_emit(od, "e,state,someday", "e"); edje_object_signal_emit(od, "e,state,someday", "e");
} }
} }
// FIXME: add next/prev buttons to calendar theme element }
// FIXME: hook up next/prev signals to callbacks
// FIXME: give cal theme 2 tables that it swaps back and forth static void
// when goign next/prev and then update each cal accordingly _clock_month_prev_cb(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
// so u can have a kind of theme-drive slide in/out effect {
// to the left/right for example Instance *inst = data;
// FIXME: hook up signal callbacks to each day and be able to exec inst->madj--;
// something on click and pass in date _time_eval(inst);
_clock_moth_update(inst);
}
static void
_clock_month_next_cb(void *data, Evas_Object *obj __UNUSED__, const char *emission __UNUSED__, const char *source __UNUSED__)
{
Instance *inst = data;
inst->madj++;
_time_eval(inst);
_clock_moth_update(inst);
}
static void
_clock_popup_new(Instance *inst)
{
Evas *evas;
Evas_Object *o, *oi;
Evas_Coord mw = 128, mh = 128;
if (inst->popup) return;
_time_eval(inst);
inst->popup = e_gadcon_popup_new(inst->gcc);
evas = inst->popup->win->evas;
inst->o_table = e_widget_table_add(evas, 0);
oi = edje_object_add(evas);
inst->o_popclock = oi;
e_theme_edje_object_set(oi, "base/theme/modules/clock",
"e/modules/clock/main");
o = e_widget_image_add_from_object(evas, oi, 128, 128);
evas_object_show(oi);
e_widget_table_object_align_append(inst->o_table, o,
0, 0, 1, 1, 0, 0, 0, 0, 0.5, 0.5);
oi = edje_object_add(evas);
inst->o_cal = oi;
e_theme_edje_object_set(oi, "base/theme/modules/clock",
"e/modules/clock/calendar");
_clock_moth_update(inst);
edje_object_signal_callback_add(oi, "e,action,prev", "*",
_clock_month_prev_cb, inst);
edje_object_signal_callback_add(oi, "e,action,next", "*",
_clock_month_next_cb, inst);
// FIXME: add set time/date/timezone button // FIXME: add set time/date/timezone button
// FIXME: add button for settings panel bringup // FIXME: add button for settings panel bringup
// FIXME: add settings panel that can change: // FIXME: add settings panel that can change:
@ -251,8 +275,10 @@ _clock_popup_new(Instance *inst)
// if digital 24h or 12h // if digital 24h or 12h
// app to run when date clicked // app to run when date clicked
// app to run to set time+date+timezone // app to run to set time+date+timezone
evas_object_resize(oi, 500, 500);
edje_object_size_min_restricted_calc(oi, &mw, &mh, 128, 128);
o = e_widget_image_add_from_object(evas, oi, 182, 128); o = e_widget_image_add_from_object(evas, oi, mw, mh);
evas_object_show(oi); evas_object_show(oi);
e_widget_table_object_align_append(inst->o_table, o, e_widget_table_object_align_append(inst->o_table, o,
1, 0, 1, 1, 0, 0, 0, 0, 0.5, 0.5); 1, 0, 1, 1, 0, 0, 0, 0, 0.5, 0.5);