calendar bit of clock moves along quite nicely.
authorCarsten Haitzler <raster@rasterman.com>
Sun, 5 Jun 2011 04:30:39 +0000 (04:30 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Sun, 5 Jun 2011 04:30:39 +0000 (04:30 +0000)
SVN revision: 59961

data/themes/default.edc
src/modules/clock/e_mod_main.c

index c83e0e8..1086453 100644 (file)
@@ -12181,36 +12181,22 @@ collections {
 
    group { name: "e/modules/clock/calendar/dayname";
       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";
             type: TEXT;
+            effect: SHADOW;
             mouse_events: 0;
             description { state: "default" 0.0;
-               fixed: 0 1;
                align: 0.5 0.5;
-               rel1 {
-                  relative: 0.0 0.0;
-                  offset: 1 1;
-               }
-               rel2 {
-                  relative: 1.0 1.0;
-                  offset: -2 -2;
-               }
-               color: 0 0 0 255;
+               color: 0 0 0 64;
+               color3: 255 255 255 255;
+               rel1.offset: 3 3;
+               rel2.offset: -3 -3;
                text {
+                  text: "XXX";
                   font: "Sans";
                   align: 0.5 0.5;
-                  ellipsis: 0.0;
                   size: 8;
-                  min: 0 1;
+                  min: 1 1;
                   text_class: "module_small";
                }
             }
@@ -12218,6 +12204,9 @@ collections {
       }
    }
    group { name: "e/modules/clock/calendar/day";
+      images {
+         image: "inset_sunk.png" COMP;
+      }
       parts {
          part { name: "hidden"; type: RECT;
             mouse_events: 0;
@@ -12225,6 +12214,7 @@ collections {
                color: 255 255 255 255;
             }
             description { state: "hidden" 0.0;
+               inherit: "default" 0.0;
                color: 255 255 255 64;
             }
          }
@@ -12233,47 +12223,61 @@ collections {
             clip_to: "hidden";
             description { state: "default" 0.0;
                color: 0 0 0 0;
+               rel1.offset: 1 1;
+               rel2.offset: -2 -2;
             }
             description { state: "weekend" 0.0;
-               color: 255 0 0 128;
+               inherit: "default" 0.0;
+               color: 255 0 0 64;
             }
          }
          part { name: "day"; type: RECT;
             mouse_events: 0;
             clip_to: "hidden";
             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;
+               inherit: "default" 0.0;
                color: 0 0 0 128;
             }
          }
          part { name: "e.text.label";
             type: TEXT;
-            effect: SOFT_SHADOW;
             mouse_events: 0;
             clip_to: "hidden";
             description { state: "default" 0.0;
-               fixed: 1 1;
                align: 0.5 0.5;
-               rel1 {
-                  relative: 0.0 0.0;
-                  offset: 1 1;
-               }
-               rel2 {
-                  relative: 1.0 1.0;
-                  offset: -2 -2;
-               }
-               color: 255 255 255 255;
+               color: 0 0 0 255;
                color3: 0 0 0 32;
+               rel1.offset: 2 2;
+               rel2.offset: -3 -3;
                text {
-                  font: "Sans:style=Bold";
+                  text: "88";
+                  font: "Sans";
                   align: 0.5 0.5;
-                  size: 10;
+                  size: 8;
                   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 {
@@ -12306,47 +12310,40 @@ collections {
             source: "e";
             action: STATE_SET "today" 0.0;
             target: "day";
+            target: "e.text.label";
          }
          program { name: "someday";
             signal: "e,state,someday";
             source: "e";
             action: STATE_SET "default" 0.0;
             target: "day";
+            target: "e.text.label";
          }
       }
    }
    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 {
-         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";
             type: TEXT;
             effect: SOFT_SHADOW;
             mouse_events: 0;
             description { state: "default" 0.0;
                fixed: 0 1;
-               align: 0.0 0.5;
+               align: 0.0 0.0;
                rel1 {
-                  relative: 0.0 0.0;
+                  to_x: "prev";
+                  relative: 1.0 0.0;
                }
                rel2 {
-                  relative: 1.0 0.10;
+                  relative: 1.0 0.0;
                }
                color: 255 255 255 255;
                color3: 0 0 0 32;
@@ -12365,12 +12362,13 @@ collections {
             mouse_events: 0;
             description { state: "default" 0.0;
                fixed: 0 1;
-               align: 1.0 0.5;
+               align: 1.0 0.0;
                rel1 {
                   relative: 0.0 0.0;
                }
                rel2 {
-                  relative: 1.0 0.10;
+                  to_x: "next";
+                  relative: 0.0 0.0;
                }
                color: 255 255 255 255;
                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;
             description { state: "default" 0.0;
-               rel1.to: "names";
-               rel2.to: "names";
+               fixed: 0 1;
+               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 {
                   homogeneous: TABLE;
                   padding: 1 1;
                   align: 0.5 0.5;
+                  min: 1 1;
                }
             }
             table { items {
@@ -12413,12 +12551,16 @@ collections {
          }
          part { name: "e.table.days"; type: TABLE;
             description { state: "default" 0.0;
-               rel1.to: "cal";
-               rel2.to: "cal";
+               rel1.to_y: "e.table.daynames";
+               rel1.relative: 0.0 1.0;
+               rel1.offset: 2 2;
+               rel2.offset: -3 -3;
+               step: 7 5;
                table {
                   homogeneous: TABLE;
                   padding: 1 1;
                   align: 0.5 0.5;
+                  min: 1 1;
                }
             }
             table { items {
@@ -12469,8 +12611,29 @@ collections {
                DAY(4, 4);
                DAY(5, 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;
+            }
+         }
       }
    }
 
index adca604..aa35e02 100644 (file)
@@ -43,10 +43,10 @@ struct _Instance
    char year[8];
    char month[32];
    const char *daynames[7];
-   unsigned char daynums[7][5];
-   Eina_Bool dayweekends[7][5];
-   Eina_Bool dayvalids[7][5];
-   Eina_Bool daytoday[7][5];
+   unsigned char daynums[7][6];
+   Eina_Bool dayweekends[7][6];
+   Eina_Bool dayvalids[7][6];
+   Eina_Bool daytoday[7][6];
 };
 
 static E_Module *clock_module = NULL;
@@ -89,7 +89,7 @@ _time_eval(Instance *inst)
         // tm2 == month baseline @ 1st
         memcpy(&tms, tm, sizeof(struct tm));
         num = 0;
-        for (day = (0 - 6); day < (31 + 6); day++)
+        for (day = (0 - 6); day < (31 + 16); day++)
           {
              memcpy(&tmm, &tms, sizeof(struct tm));
              tmm.tm_sec = 0;
@@ -117,7 +117,7 @@ _time_eval(Instance *inst)
                   int y = num / 7;
                   int x = num % 7;
                   
-                  if (y < 5)
+                  if (y < 6)
                     {
                        inst->daynums[x][y] = tmm.tm_mday;
                        
@@ -174,35 +174,12 @@ _time_eval(Instance *inst)
 }
 
 static void
-_clock_popup_new(Instance *inst)
+_clock_moth_update(Instance *inst)
 {
-   Evas *evas;
-   Evas_Object *o, *oi, *od;
+   Evas_Object *od, *oi;
    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);
-   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");
-   
+   oi = inst->o_cal;
    edje_object_part_text_set(oi, "e.text.month", inst->month);
    edje_object_part_text_set(oi, "e.text.year", inst->year);
    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]);
      }
    
-   for (y = 0; y < 5; y++)
+   for (y = 0; y < 6; y++)
      {
         for (x = 0; x < 7; x++)
           {
@@ -234,14 +211,61 @@ _clock_popup_new(Instance *inst)
                 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
-   //        when goign next/prev and then update each cal accordingly
-   //        so u can have a kind of theme-drive slide in/out effect
-   //        to the left/right for example
-   // FIXME: hook up signal callbacks to each day and be able to exec
-   //        something on click and pass in date
+}
+
+static void
+_clock_month_prev_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_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 button for settings panel bringup
    // FIXME: add settings panel that can change:
@@ -251,8 +275,10 @@ _clock_popup_new(Instance *inst)
    //        if digital 24h or 12h
    //        app to run when date clicked
    //        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);
    e_widget_table_object_align_append(inst->o_table, o, 
                                       1, 0, 1, 1, 0, 0, 0, 0, 0.5, 0.5);