.comment-link {margin-left:.6em;}

David @ Tokyo

Perspective from Japan on whaling and whale meat, a spot of gourmet news, and monthly updates of whale meat stockpile statistics

10/22/2005

 

E17: Learnings (4) EDC and alignment

Today: Alignment in EDC

The default clock theme included with e17 has an option to turn on a digital display. I'm pretty useless at looking at the clock hands and figuring out which one is shortest, longest, moving fastest in an instant, so I like the digital option.

However, annoyingly for me, the digital time string is aligned to the left, not to the center. It just doesn't look right on the left :-)

Obviously, we need to modify the EDC group for the clock appropriately. All the EDCs for the enlightenment 17 default themes are stored at e17/apps/e/data/themes. In this case, the file to modify is default_clock.edc.

Way towards to end of the file is the definition for the "digital" TEXT part. This is the part that displays the text string that you see in the clock snapshot to the upper left. Here's how the file looks right now (revision 1.8):

part {
name: "digital";
type: TEXT;
effect: SOFT_SHADOW;
description {
state: "default" 0.0;
rel1 {
to: "digital_bg_area";
offset: 3 4;
}
rel2 {
to: "digital_bg_area";
offset: -2 -2;
}
color: 255 255 255 255;
color3: 0 0 0 32;
text {
text: "00:00:00 AM";
font: "Edje-Vera";
size: 15;
fit: 0 1;
align: 0.0 0.5;
}
}
...
}

Today we want to fix the alignment, so it's obvious at least which line to modify - the one that says "align" - but how? As we can see, the align value for the text time description specifies two values: 0.0 and 0.5.
These alignment values represent how the text part should be aligned with respect to the part it is specified to be positioned relative to. In this case, the "digital" text part is relative to the "digital_bg_area" (see rel1 and rel2). But this post isn't about part relativity, the rel1 / rel2 keywords aren't obvious in meaning, so let's just skip that this time!

The first value, 0.0 here, represents how the text part should be aligned horizontally, and the second, 0.5 is the vertical alignment.
- In the horizontal context (first value) 0.0 means "left aligned", and 1.0 means "right aligned"
- In the vertical context (second value) 0.0 means "top aligned" and 1.0 means "bottom aligned"
- Legal values range between 0.0 and 1.0
- The value represents a ratio for alignment along the respective x and y axises

Thus, what the "align: 0.0 0.5;" means is to left align and vertically center the text part relative to the "digital_bg_area" part (as denoted by the rel1 / rel2 values - a different blog entry as I said)

Back to my problem: I want to horizontally center the text string, not left align it. If I'm any good at all an explaining this, the change we need to make is simply as follows:

diff -u -u -r1.8 default_clock.edc
--- e17/apps/e/data/themes/default_clock.edc 24 Sep 2005 01:15:23 -0000 1.8
+++ e17/apps/e/data/themes/default_clock.edc 21 Oct 2005 18:07:00 -0000
@@ -693,7 +693,7 @@
font: "Edje-Vera";
size: 15;
fit: 0 1;
- align: 0.0 0.5;
+ align: 0.5 0.5;
}
}
description {

And below is the end result (^_^)

This works nicely with both 24 hour and 12 hour + AM/PM format options provided in the clock module configuration.

Finally, as I believe is the case for the the min and max values that I covered last time, the align keyword can be used to align part types other than TEXT.

Labels:


Comments: Post a Comment



<< Home

Archives

June 2004   July 2004   August 2004   September 2004   October 2004   November 2004   December 2004   January 2005   March 2005   April 2005   May 2005   June 2005   July 2005   August 2005   September 2005   October 2005   November 2005   December 2005   January 2006   February 2006   March 2006   April 2006   May 2006   June 2006   July 2006   August 2006   September 2006   October 2006   November 2006   December 2006   January 2007   February 2007   March 2007   April 2007   May 2007   June 2007   July 2007   August 2007   September 2007   October 2007   November 2007   December 2007   January 2008   February 2008   April 2008   May 2008   June 2008   July 2008   August 2008   September 2008   October 2008   November 2008   December 2008   January 2009   February 2009   March 2009   April 2009   May 2009   June 2009   July 2009   August 2009   September 2009   October 2009   November 2009   January 2010   February 2010   April 2010   May 2010   June 2010   July 2010   August 2010   September 2010   February 2011   March 2011   May 2013   June 2013  

This page is powered by Blogger. Isn't yours?