Perspective from Japan on whaling and whale meat, a spot of gourmet news, and monthly updates of whale meat stockpile statistics
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: enlightenment