Go Back   Winamp Forums > Skinning and Design > Modern Skins

Reply
Thread Tools Search this Thread Display Modes
Old 14th February 2004, 00:00   #1
avegav2
Member
 
avegav2's Avatar
 
Join Date: Jun 2003
Location: Lima
Posts: 51
Question Cannot center a graphic title in frame

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.
avegav2 is offline   Reply With Quote
Old 14th February 2004, 01:33   #2
matt_69
Sunshine
(Major Dude)
 
matt_69's Avatar
 
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

matt_69 is offline   Reply With Quote
Old 14th February 2004, 14:24   #3
Bizzeh
Forum Pirate
Beta Team
 
Bizzeh's Avatar
 
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]
Bizzeh is offline   Reply With Quote
Old 15th February 2004, 03:45   #4
avegav2
Member
 
avegav2's Avatar
 
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.
avegav2 is offline   Reply With Quote
Old 15th February 2004, 12:58   #5
Bizzeh
Forum Pirate
Beta Team
 
Bizzeh's Avatar
 
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
Bizzeh is offline   Reply With Quote
Old 16th February 2004, 01:13   #6
avegav2
Member
 
avegav2's Avatar
 
Join Date: Jun 2003
Location: Lima
Posts: 51
Exclamation I`m gonna try this cheat.

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.
avegav2 is offline   Reply With Quote
Old 16th February 2004, 05:22   #7
matt_69
Sunshine
(Major Dude)
 
matt_69's Avatar
 
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

matt_69 is offline   Reply With Quote
Old 18th February 2004, 03:22   #8
avegav2
Member
 
avegav2's Avatar
 
Join Date: Jun 2003
Location: Lima
Posts: 51
Cool Here you have a glance

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.
Attached Images
File Type: jpg glance.jpg (28.7 KB, 81 views)
avegav2 is offline   Reply With Quote
Old 18th February 2004, 08:22   #9
matt_69
Sunshine
(Major Dude)
 
matt_69's Avatar
 
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

matt_69 is offline   Reply With Quote
Old 26th February 2004, 03:45   #10
avegav2
Member
 
avegav2's Avatar
 
Join Date: Jun 2003
Location: Lima
Posts: 51
Question How to uppercase the title

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.
avegav2 is offline   Reply With Quote
Old 26th February 2004, 10:44   #11
UUL
Winamp Addict
(Major Dude)
 
UUL's Avatar
 
Join Date: May 2003
Location: Winamp Modern Skinning Forum!
Posts: 868
Send a message via ICQ to UUL Send a message via AIM to UUL Send a message via Yahoo to UUL
forceuppercase="1" when i'm not mistaking
UUL is offline   Reply With Quote
Old 27th February 2004, 04:06   #12
avegav2
Member
 
avegav2's Avatar
 
Join Date: Jun 2003
Location: Lima
Posts: 51
Smile This is the correct tag.

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".
avegav2 is offline   Reply With Quote
Old 27th February 2004, 11:36   #13
UUL
Winamp Addict
(Major Dude)
 
UUL's Avatar
 
Join Date: May 2003
Location: Winamp Modern Skinning Forum!
Posts: 868
Send a message via ICQ to UUL Send a message via AIM to UUL Send a message via Yahoo to UUL
i saw it on a tutorial site somewhere
UUL is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Skinning and Design > Modern Skins

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump