|
|
#1 |
|
Member
Join Date: Jun 2003
Location: Lima
Posts: 51
|
I am trying to place a centered graphic title on top of the components based on standard frame (Playlist Editor, Media Library, etc.). So I embedded the components into redefined containers, like this:
Example: avs.xml (referenced in skin.xml) <elements> <bitmap id="avs.frametitle" file="titles/avs_title.png" gammagroup="frames1color" /> </elements> <groupdef id="avs.content.group"> <component x="10" y="0" w="-15" relatw="1" h="0" relath="1" noshowcmdbar="1" autoopen="1" autoclose="1" param="guid:avs" /> </groupdef> <groupdef id="avs.frametitle.group"> <layer id="frametitle" image="avs.frametitle" x="0" y="0" /> <script id="centertitle" file="scripts/centertitle.maki" /> </groupdef> <container id="avs" name="AVS" component="guid:avs" default_x="0" default_y="0" default_visible="1"> <layout id="normal" minimum_h="116" minimum_w="275" default_h="154"> <Wasabi:StandardFrame:Status x="0" y="0" w="0" h="0" relatw="1" relath="1" content="avs.content.group" padtitleright="18" /> <group id="avs.frametitle.group" x="0" y="4" /> </layout> </container> I wrote the script "centertitle.m" to center the layer with the id "frametitle". The code of the script is the following: #include "../../../lib/std.mi" Function resizeObjects(); Global Group tgroup; Global Layout tlayout; Global Layer tlayer; System.onScriptLoaded() { tgroup = getScriptGroup(); tlayout = tgroup.getParentLayout(); tlayer = tgroup.getObject("frametitle"); } resizeObjects() { int layout_w = tlayout.getWidth(); int title_w = tlayer.getWidth(); int title_h = tlayer.getHeight(); int x = tlayer.getLeft(); int y = tlayer.getTop(); x = (layout_w - title_w)/2; tlayer.resize(x, y, title_w, title_h); } tlayout.onResize(int new_x, int new_y, int new_w, int new_h) { resizeObjects(); } Unfortunately, the damn layer does not move to the center. I don't know where is the mistake, despite I checked it again and again, if it is in the syntax or maybe an error in the concept itself of the script. Any help is very welcomed. P.D. By the way, I have not yet seen any skin with this feature, only text titles. |
|
|
|
|
|
#2 |
|
Sunshine
(Major Dude) Join Date: Jan 2003
Location: Brisvegas, Australia
Posts: 1,248
|
y not embed the layer into the frame or is it like telling u what window it is?
-matt |
|
|
|
|
|
#3 |
|
Forum Pirate
Beta Team Join Date: Oct 2001
Posts: 2,032
|
you should move to
((windowH/2) - (layerH/2)) and ((windowW/2) - (layerW/2)) you need to do it this way to get the exact center [edit] i just noticed, you wanna add a title. just the use the width one and set your Y to enough to have it at the top [/edit] |
|
|
|
|
|
#4 |
|
Member
Join Date: Jun 2003
Location: Lima
Posts: 51
|
The fact is that the layer doesn´t move
No, no, the fact is that the layer "frametitle" doesn´t move at all. It remains in the left side of the frame, it is not moving ever near the center.
Answering to matt_69, I don´t embed the layer into the frame in standardframe.xml for two reasons: - I don´t want the layer to shrink when the frame resizes, as I get when I put the image in the bitmap with the id="component.top.middle" of standardframe.xml. - The layer "frametitle" will contain a graphical label of the name of the component, so it must be different from component to component. I guess that getting this goal will be challenging, but the challenge is what moved me to start this... P.D. Sorry if my English is not perfect. My native language is Spanish. |
|
|
|
|
|
#5 |
|
Forum Pirate
Beta Team Join Date: Oct 2001
Posts: 2,032
|
cheat.. use a timer on 50ms delay
also, your component titles are only gonna show for the ones you make em for.. 3rd party components are gonna be blank |
|
|
|
|
|
#6 |
|
Member
Join Date: Jun 2003
Location: Lima
Posts: 51
|
I´m gonna try this cheat. If I understood well, I must place the delay at the end of the function resizeObjects().
By the way, for the 3th party components, the skin will only show the standard text title. For the customized components, the graphic layer must cover the text title. |
|
|
|
|
|
#7 |
|
Sunshine
(Major Dude) Join Date: Jan 2003
Location: Brisvegas, Australia
Posts: 1,248
|
could u post a pic of the standard frame for me? i have an idea that might work..
-matt |
|
|
|
|
|
#8 |
|
Member
Join Date: Jun 2003
Location: Lima
Posts: 51
|
OK, here you have a glance of the Media Library for Winamp 3. It was resampled at low quality so I can attach it to the reply.
As you can see, the graphic title in italics remains at x=81, despite the script that I wrote, that should make that the layer covers the text title at the center. I preferred not to use text labels for this title because I didn´t know how to break the lines under the text title. |
|
|
|
|
|
#9 |
|
Sunshine
(Major Dude) Join Date: Jan 2003
Location: Brisvegas, Australia
Posts: 1,248
|
what i was thinking is y can't u make a bitmap font in italics and have a grayish background..wouldn't that work? i was thinking that u had the text morphing into the bg sumhow but now it doesn't look like that.
-matt |
|
|
|
|
|
#10 |
|
Member
Join Date: Jun 2003
Location: Lima
Posts: 51
|
Finally, I decided to use a centered text with a TrueType font. But the font I chose was Arial Italic and the titles show only the first letter in uppercase. Is there a XML tag that converts the string to all caps (maybe upcase="1" or something else) ? Or should I write a script to upcase "window.titlebar.title" using the function strupper() ?
Part of standardframe.xml: <groupdef id="wasabi.titlebar" xuitag="Wasabi:TitleBar" embed_xui="window.titlebar.title"> <text id="window.titlebar.title" x="0" y="1" w="0" relatw="1" antialias="1" align="center" fontsize="18" bold="0" color="40,40,40" default=":componentname" font="stdframe.titlefont" ghost="1" /> <layer id="mousetrap" x="60" y="0" w="-120" h="0" relatw="1" relath="1" move="1"/> </groupdef> If you know about a TrueType font similar to Arial, in italics and only uppercase, I would like to know. |
|
|
|
|
|
#11 |
|
Winamp Addict
(Major Dude) |
forceuppercase="1" when i'm not mistaking
|
|
|
|
|
|
#12 |
|
Member
Join Date: Jun 2003
Location: Lima
Posts: 51
|
Thanks, UUL. You did it again, like when I posted a thread for the equalizer. I guess this is an undocumented parameter, because I have not found yet a skin using it. By the way, I found the XML tag for italics. It is simply: italic="1".
|
|
|
|
|
|
#13 |
|
Winamp Addict
(Major Dude) |
i saw it on a tutorial site somewhere
|
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|