Here's another patch that cleans up the hidden parts using the visible
tag, and changes the background for the digital display to use a white
translucent set of parts akin to the ibar.

The digital part is now overlayed over the bottom of the analog clock,
so that it doesn't go outside the 1.0 1.0 defined by the main part.

This patch also allows the digital part to scale cleanly along with
the main clock.

I've noticed that at some scalings the digital part's text is kind of
'jumpy' as it fits the text into it's part... I can't figure out a
good way to fix it though.

This patch is against CVS as of late this morning.

Anyhow, this should look (176x176 looks good at 1600x1200) and work
much better than the first attempt.

Enjoy,
 Marc

On 7/12/05, Jeremy Kolb <[EMAIL PROTECTED]> wrote:
> Quoting Carsten Haitzler <[EMAIL PROTECTED]>:
> 
> > On Mon, 11 Jul 2005 18:41:47 -0500 Marc McGarry <[EMAIL PROTECTED]>
> > babbled:
> >
> >> Hi all,
> >>
> >> I've created a patch for the clock module that adds a little digital
> >> time display below the analog one. It has a toggle between no digital
> >> display, normal digital display (with am/pm) and 24-hour time.
> >>
> >> It's pretty rough, as I couldn't figure out how to hide elements other
> >> than by creating a state where all of the settings were locked at 0.0
> >> to 0.0.
> >>
> >> I haven't refreshed CVS all weekend, so I hope this patch still applies
> >> cleanly.
> >
> > and i was thinking of this myself the other day too "the clock could do with
> > some numeric digital display too" :)
> >
> > --
> > ------------- Codito, ergo sum - "I code, therefore I am" --------------
> > The Rasterman (Carsten Haitzler)    [EMAIL PROTECTED]
> > 裸好多                              [EMAIL PROTECTED]
> > Tokyo, Japan (東京 日本)
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
> > July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
> > core and dual graphics technology at this free one hour event hosted by HP,
> > AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
> > _______________________________________________
> > enlightenment-devel mailing list
> > enlightenment-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> >
> 
> Woohoo! This makes me very happy.
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
> July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
> core and dual graphics technology at this free one hour event hosted by HP,
> AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> 


-- 
http://www.diadems.com/
1 3 5
2 4 6 R
diff -u -r e/data/themes/default_clock.edc /home/mcgmar0u/source/e/data/themes/default_clock.edc
--- e/data/themes/default_clock.edc	2005-07-12 09:20:37.000000000 -0500
+++ /home/mcgmar0u/source/e/data/themes/default_clock.edc	2005-07-12 12:18:16.000000000 -0500
@@ -1,7 +1,8 @@
 images {
    image: "e17_clock_bg.png" COMP;
    image: "e17_clock_fg.png" COMP;
-   image: "e17_button.png" COMP;
+   image: "e17_ibar_over_h.png" COMP;
+   image: "e17_ibar_bg_h.png" COMP;
    image: "e17_clock_seconds_00.png" COMP;
    image: "e17_clock_seconds_01.png" COMP;
    image: "e17_clock_seconds_02.png" COMP;
@@ -196,11 +197,11 @@
 	 new isAfternoon;
 	 new digiBuf[2];
 	 new digitalStyle;
-	 new DIGITAL_STYLE_NONE, DIGITAL_STYLE_NORMAL, DIGITAL_STYLE_MILITARY;
+	 new DIGITAL_STYLE_NONE, DIGITAL_STYLE_NORMAL, DIGITAL_STYLE_24HOUR;
 
 	DIGITAL_STYLE_NONE = 0;
 	DIGITAL_STYLE_NORMAL = 1;
-	DIGITAL_STYLE_MILITARY = 2;
+	DIGITAL_STYLE_24HOUR = 2;
 
 	 get_text(PART:"digitalStyle", digiBuf, 2);
 
@@ -248,13 +249,17 @@
 	 isAfternoon = 0;
 	 v = hour;
 	 if (hour >= 12 && hour < 24) { isAfternoon = 1; }
-	 if (digitalStyle == DIGITAL_STYLE_MILITARY) {
+	 if (digitalStyle == DIGITAL_STYLE_24HOUR) {
 		 if (v == 0) { v = 24; }
 	 } else {
 		 v = (v % 12);
 		 if (v == 0) { v = 12; }
 	 }
-	 snprintf(buf, 10, "%i", v);
+	 if (digitalStyle == DIGITAL_STYLE_24HOUR && v < 10) {
+		 snprintf(buf, 10, "0%i", v);
+	} else {
+		 snprintf(buf, 10, "%i", v);
+	 }
 	 snprintf(hourStr, 3, "%s", buf);
 
 	buf[0] = 0;
@@ -268,17 +273,19 @@
 	if (digitalStyle != DIGITAL_STYLE_NONE) {
 		if (digitalStyle == DIGITAL_STYLE_NORMAL) {
 			snprintf(digitalVal, 14, "%s:%s:%s %s", hourStr, minuteStr, secondStr, buf);
-		} else if (digitalStyle == DIGITAL_STYLE_MILITARY) {
-			snprintf(digitalVal, 14, "%s:%s:%s", hourStr, minuteStr, secondStr);
+		} else if (digitalStyle == DIGITAL_STYLE_24HOUR) {
+			snprintf(digitalVal, 14, " %s:%s:%s ", hourStr, minuteStr, secondStr);
 		}
 
 		set_text(PART:"digital", digitalVal);
 		set_state(PART:"digital", "digital", 0.0);
 		set_state(PART:"digital_bg", "digital", 0.0);
+		set_state(PART:"digital_bg_overlay", "digital", 0.0);
 	} else {
 		set_text(PART:"digital", "");
 		set_state(PART:"digital", "hidden", 0.0);
 		set_state(PART:"digital_bg", "hidden", 0.0);
+		set_state(PART:"digital_bg_overlay", "hidden", 0.0);
 	}
       }
    }
@@ -588,30 +595,81 @@
 	 }
       }
       part {
-	 name:          "digital_bg";
+	 name:          "digital_bg_area";
+	 type:		"RECT";
 	 mouse_events:  0;
 	 description {
 	    state:    "digital" 0.0;
-	    image {
-	       normal: "e17_button.png";
+	    rel1 {
+	       relative: 0.0 0.8;
 	    }
+	    rel2 {
+	       relative: 1.0 1.0;
+	    }
+	    visible: 0;
+	 }
+      }
+      part {
+	 name:          "digital_bg_overlay";
+	 mouse_events:  0;
+	 description {
+	    state:    "digital" 0.0;
 	    rel1 {
-	       relative: 0.0 1.0;
+	       to: "digital_bg_area";
+	       relative: 0.0 0.0;
 	    }
 	    rel2 {
-	       relative: 1.0 1.2;
+	       to: "digital_bg_area";
+	       relative: 1.0 1.0;
+	    }
+	    image {
+	       normal: "e17_ibar_over_h.png";
+	       border: 13 13 13 13;
+	    }
+	    fill {
+	       smooth: 0;
 	    }
+	    color: 255 255 255 192;
 	 }
 	 description {
 	    state: "hidden" 0.0;
+	    visible: 0;
 	    image {
-	       normal: "e17_button.png";
+	       normal: "e17_ibar_over_h.png";
+	       border: 13 13 13 13;
+	       middle: 0;
 	    }
+	 }
+      }
+      part {
+	 name:          "digital_bg";
+	 mouse_events:  0;
+	 description {
+	    state:    "digital" 0.0;
 	    rel1 {
+	       to: "digital_bg_area";
 	       relative: 0.0 0.0;
 	    }
 	    rel2 {
-	       relative: 0.0 0.0;
+	       to: "digital_bg_area";
+	       relative: 1.0 1.0;
+	    }
+	    image {
+	       normal: "e17_ibar_bg_h.png";
+	       border: 6 6 6 6;
+	    }
+	    fill {
+	       smooth: 0;
+	    }
+	    color: 255 255 255 128;
+	 }
+	 description {
+	    state: "hidden" 0.0;
+	    visible: 0;
+	    image {
+	       normal: "e17_ibar_bg_h.png";
+	       border: 6 6 6 6;
+	       middle: 0;
 	    }
 	 }
       }
@@ -621,33 +679,27 @@
 	 effect:         SOFT_SHADOW;
 	 description {
 	    state: "digital" 0.0;
-	    min: 0 11;
 	    rel1 {
-	       relative: 0.0 0.9;
+	       to: "digital_bg_area";
+	       relative: 0.1 0.1;
 	    }
 	    rel2 {
-	       relative: 1.0 1.0;
+	       to: "digital_bg_area";
+	       relative: 0.9 1.0;
 	    }
 	    color: 255 255 255 255;
 	    color3: 0 0 0 32;
 	    text {
 	       text:     "00:00:00 AM";
 	       font:     "Edje Vera";
-	       size:     7;
-	       min:      1 0;
-	       fit:      0 1;
-	       align:    0.5 1.0;
+	       size:     15;
+	       fit:      1 1;
+	       align:    0.5 0.5;
 	    }
 	 }
 	 description {
 	    state: "hidden" 0.0;
-	    aspect: 0.0 0.0;
-	    rel1 {
-	       relative: 0.0 0.0;
-	    }
-	    rel2 {
-	       relative: 0.0 0.0;
-	    }
+	    visible: 0;
 	 }
       }
       part {
@@ -655,13 +707,7 @@
 	 type:           TEXT;
 	 description {
 	    state: "hidden" 0.0;
-	    aspect: 0.0 0.0;
-	    rel1 {
-	       relative: 0.0 0.0;
-	    }
-	    rel2 {
-	       relative: 0.0 0.0;
-	    }
+	    visible: 0;
 	 }
       }
    }
diff -u -r e/src/modules/clock/e_mod_main.c /home/mcgmar0u/source/e/src/modules/clock/e_mod_main.c
--- e/src/modules/clock/e_mod_main.c	2005-07-12 09:20:46.000000000 -0500
+++ /home/mcgmar0u/source/e/src/modules/clock/e_mod_main.c	2005-07-12 09:39:17.000000000 -0500
@@ -24,7 +24,7 @@
 static void    _clock_face_cb_menu_edit(void *data, E_Menu *m, E_Menu_Item *mi);
 static void    _clock_face_cb_digital_none(void *data, E_Menu *m, E_Menu_Item *mi);
 static void    _clock_face_cb_digital_normal(void *data, E_Menu *m, E_Menu_Item *mi);
-static void    _clock_face_cb_digital_military(void *data, E_Menu *m, E_Menu_Item *mi);
+static void    _clock_face_cb_digital_24hour(void *data, E_Menu *m, E_Menu_Item *mi);
 
 static int _clock_count;
 
@@ -34,7 +34,7 @@
 const int
 	DIGITAL_STYLE_NONE = 0,
 	DIGITAL_STYLE_NORMAL = 1,
-	DIGITAL_STYLE_MILITARY = 2
+	DIGITAL_STYLE_24HOUR = 2
 ;
 
 /* public module routines. all modules must have these */
@@ -338,7 +338,7 @@
 
    /* Show normal time */
    mi = e_menu_item_new(smn);
-   e_menu_item_label_set(mi, _("Normal Time"));
+   e_menu_item_label_set(mi, _("Normal"));
    e_menu_item_radio_set(mi, 1);
    e_menu_item_radio_group_set(mi, 1);
    if (face->conf->digitalStyle == DIGITAL_STYLE_NORMAL) {
@@ -347,16 +347,16 @@
    }
    e_menu_item_callback_set(mi, _clock_face_cb_digital_normal, face);
 
-   /* Show military time */
+   /* Show 24hour time */
    mi = e_menu_item_new(smn);
-   e_menu_item_label_set(mi, _("Military Time"));
+   e_menu_item_label_set(mi, _("24 Hour"));
    e_menu_item_radio_set(mi, 1);
    e_menu_item_radio_group_set(mi, 1);
-   if (face->conf->digitalStyle == DIGITAL_STYLE_MILITARY) {
+   if (face->conf->digitalStyle == DIGITAL_STYLE_24HOUR) {
       e_menu_item_toggle_set(mi, 1);
-      _clock_face_cb_digital_military(face, smn, mi);
+      _clock_face_cb_digital_24hour(face, smn, mi);
    }
-   e_menu_item_callback_set(mi, _clock_face_cb_digital_military, face);
+   e_menu_item_callback_set(mi, _clock_face_cb_digital_24hour, face);
 
    face->digital_menu = smn;
 
@@ -470,7 +470,7 @@
 }
 
 static void
-_clock_face_cb_digital_military(void *data, E_Menu *m, E_Menu_Item *mi)
+_clock_face_cb_digital_24hour(void *data, E_Menu *m, E_Menu_Item *mi)
 {
 	Clock_Face *face;
 	char buf[2];
@@ -479,11 +479,11 @@
 
 	memset(buf, 0, sizeof(buf));
 
-	snprintf(buf, sizeof(buf), "%i", DIGITAL_STYLE_MILITARY);
+	snprintf(buf, sizeof(buf), "%i", DIGITAL_STYLE_24HOUR);
 
 	edje_object_part_text_set(face->clock_object, "digitalStyle", buf);
 
-	face->conf->digitalStyle = DIGITAL_STYLE_MILITARY;
+	face->conf->digitalStyle = DIGITAL_STYLE_24HOUR;
 
 	e_config_save_queue();
 }

Reply via email to