14 static SA_Image figures, months, days;
15 static Date_settings date_settings;
16 static AquariumData *ad;
18 static int month_width[]={16,16,20,18,20,16,16,20,17,18,19,18};
20 Date_settings *date_get_settings_ptr(void)
22 return &date_settings;
28 ad = aquarium_get_settings_ptr();
33 if(figures.image!=NULL)
36 load_image("clock/date/figures.png",&figures, NUM_FIGURES);
38 load_image("clock/date/weekdays.png",&days, NUM_DAYS);
40 load_image("clock/date/months.png", &months, NUM_MONTHS);
43 change_colour_to(date_settings.c.r,
47 figures.pixbuf, TRUE);
50 change_colour_to(date_settings.c.r,
56 change_colour_to(date_settings.c.r,
67 if(figures.pixbuf!=NULL)
68 g_object_unref(figures.pixbuf);
70 g_object_unref(days.pixbuf);
71 if(months.pixbuf!=NULL)
72 g_object_unref(months.pixbuf);
74 memset(&figures,0,sizeof(SA_Image));
75 memset(&days,0,sizeof(SA_Image));
76 memset(&months,0,sizeof(SA_Image));
80 void date_update(int beforeorafter)
91 if(beforeorafter==date_settings.draw) {
95 wsize=2*figures.width+days.width+month_width[mt->tm_mon]+1;
98 /* If before day 10 in month */
99 if(mt->tm_mday <10) wsize-=figures.width;
102 switch(date_settings.vert)
108 y=(ad->ymax-figures.height)/2;
111 y=ad->ymax-figures.height-1;
115 switch(date_settings.horz)
121 x=(ad->xmax-wsize)/2;
127 draw_pic_alpha(days.image,
130 x,y,mt->tm_wday,date_settings.c.alpha);
134 draw_pic_alpha(figures.image,
137 x,y,mt->tm_mday/10,date_settings.c.alpha);
140 draw_pic_alpha(figures.image,
143 x,y,mt->tm_mday%10,date_settings.c.alpha);
147 draw_pic_alpha(months.image,
150 x,y,mt->tm_mon,date_settings.c.alpha);