Go Back   Winamp Forums > Skinning and Design > Modern Skins

Reply
Thread Tools Search this Thread Display Modes
Old 7th September 2002, 20:49   #1
Paikan
Member
 
Join Date: May 2002
Location: Paris
Posts: 76
Send a message via ICQ to Paikan
Have you ever experienced this

I have a problem that really annoyed me! When i launch winamp there are some small bugs and problems in my skin (like a layer missing, problem with seeker...) but if i just hit F5 to reload the skin or if i change skin and rechange back everything works fine. It is as if the initialisation were wrong at the launch of wa3.
What can i do?
Paikan is offline   Reply With Quote
Old 7th September 2002, 20:53   #2
Paikan
Member
 
Join Date: May 2002
Location: Paris
Posts: 76
Send a message via ICQ to Paikan
Here is my code if it can help (i know it s a mess maybe i can do things to make it clearer):

misc.m:
/* Misc Stuff: Status control
*
*/

#include "../../../lib/std.mi"
#include "../../../lib/config.mi"

Function GetObjects();
Function setPlayState(int state); // use STATUS_PAUSED, STATUS_STOPPED and STATUS_PLAYING
Function setTempText(string txt);
Function emptyTempText();

Class ConfigAttribute ToggleConfigAttribute;

Global ToggleConfigAttribute attr_repeat, attr_shuffle, attr_crossfade, attr_top;
Global Group Statusgroup, Playback, VisGroup;
Global Layer StatusPlay, StatusPause, StatusStop, StatusRepeat, StatusShuffle, StatusCross, StatusTop, CoverVis;
Global Button Play, Pause, VisBouton;
Global Text SongTicker;
Global Timer Songtickertimer;
Global Vis visdef;

System.onScriptLoaded() {
GetObjects();
ConfigItem item;
Songtickertimer = new Timer;
Songtickertimer.setDelay(1000);
If (visdef.getMode() == 2) {
CoverVis.hide();
}
else
CoverVis.show();
StatusRepeat.hide();
StatusShuffle.hide();
StatusCross.hide();
item = Config.getItem("Playlist editor");
if (item != NULL) {
attr_repeat = item.getAttribute("repeat");
attr_shuffle = item.getAttribute("shuffle");
}
item = Config.getItem("Audio options");
if (item != NULL) {
attr_crossfade = item.getAttribute("Enable crossfading");
}
item = config.getItem("Options");
if (item != NULL) {
attr_top = item.getAttribute("Always on top");
}
if (attr_repeat.getData()=="1")
{
StatusRepeat.show();
}
if (attr_shuffle.getData()=="1")
{
StatusShuffle.show();
}
if (attr_crossfade.getData()=="1")
{
StatusCross.show();
}
if (attr_top.getData()=="1")
{
StatusTop.show();
}
setPlayState(System.getStatus());
Pause.hide();
Play.hide();
if (getplayitemstring() != "") {
Pause.show();
} else {
Play.show();
}
}


ToggleConfigAttribute.onDataChanged() {

if (ToggleConfigAttribute == attr_crossfade)
{
if (attr_crossfade.getData()=="1")
{
StatusCross.show();
setTempText("Crossfade On");
}
else
{
setTempText("Crossfade Off");
StatusCross.hide();
}
}
else if (ToggleConfigAttribute == attr_shuffle)
{
if (attr_shuffle.getData()=="1")
{
StatusShuffle.show();
setTempText("Shuffle On");
}
else
{
StatusShuffle.hide();
setTempText("Shuffle Off");
}
}

else if (ToggleConfigAttribute == attr_repeat)
{
if (attr_repeat.getData()=="1")
{
StatusRepeat.show();
setTempText("Repeat On");
}
else
{
StatusRepeat.hide();
setTempText("Repeat Off");
}
}
else if (ToggleConfigAttribute == attr_top)
{
if (attr_top.getData()=="1")
{
StatusTop.show();
setTempText("Always on top activated");
}
else
{
StatusTop.hide();
setTempText("Always on top disabled");
}
}

}


System.OnPlay(){
If (visdef.getMode() == 2) {
CoverVis.show();
}
setPlayState(STATUS_PLAYING);
Play.hide();
Pause.show();
}

System.OnPause(){
CoverVis.hide();
setPlayState(STATUS_PAUSED);
Play.show();
Pause.hide();
}

System.OnStop(){
CoverVis.hide();
setPlayState(STATUS_STOPPED);
Play.show();
Pause.hide();
}

System.OnResume(){
If (visdef.getMode() == 2) {
CoverVis.show();
}
setPlayState(STATUS_PLAYING);
Play.hide();
Pause.show();
}


setPlayState(int state) {
StatusPause.hide();
StatusPlay.hide();
StatusStop.hide();
if (state==STATUS_PAUSED) StatusPause.show();
else if (state==STATUS_STOPPED) StatusStop.show();
else if (state==STATUS_PLAYING) StatusPlay.show();
}

setTempText(String txt) {
Songtickertimer.stop();
Songticker.setText(txt);
Songtickertimer.start();
}

emptyTempText() {
Songticker.setText("");
Songtickertimer.stop();
}

Songtickertimer.onTimer() {
Songticker.setText("");
stop();
}

VisBouton.OnLeftClick()
{
If (visdef.getMode() == 1) {
CoverVis.hide();
visdef.setMode(2);
setTempText("Oscilliscope enabled");
} else if (visdef.getMode() == 2) {
visdef.setMode(3);
setTempText("Visualisation disabled");
}
else
{
CoverVis.show();
visdef.setMode(1);
setTempText("Spectrum Analizer enabled");
}
}

GetObjects() {
Statusgroup = getContainer("main").getLayout("normal").getObject("player.normal.status");
Playback = getContainer("main").getLayout("normal").getObject("player.normal.playback");
Songticker = getContainer("main").getLayout("normal").getObject("songticker");
VisGroup = getContainer("main").getLayout("normal").getObject("player.normal.vis");
CoverVis = VisGroup.getObject("player.normal.vis.overlay");
visdef = VisGroup.getObject("vis");
VisBouton = VisGroup.getObject("vis.button");
StatusPlay = Statusgroup.getObject("player.normal.status.play");
StatusPause = Statusgroup.getObject("player.normal.status.pause");
StatusStop = Statusgroup.getObject("player.normal.status.stop");
StatusRepeat = Statusgroup.getObject("player.normal.status.repeat");
StatusShuffle = Statusgroup.getObject("player.normal.status.shuffle");
StatusCross = Statusgroup.getObject("player.normal.status.cross");
StatusTop = Statusgroup.getObject("player.normal.status.top");
Play = Playback.getObject("play");
Pause = Playback.getObject("pause");
}


sliders.m:
#include "../../../lib/std.mi"
#include "../../../lib/config.mi"

Function initSeek();
Function initTicker();
Function updateSeeker(int x, int y);
Function setSeekerPosition(int p);

Global AnimatedLayer Seek;
Global Layer SeekInfo;
Global Map seekMap;
Global Text SongTicker;
Global Timer SongTickTimer, SongPlayTimer;
Global Slider HiddenSeek;

Global Int SeekChanging, SeekFrames, LastSeek, TickerExist;

System.onScriptLoaded() {

seekMap = new Map;
seekMap.loadMap("player.Map.Seek");

SongPlayTimer = new Timer;
SongPlayTimer.setDelay(1000);

Seek = System.getContainer("main").getLayout("normal").findObject("SeekAnim");
SeekInfo = System.getContainer("main").getLayout("normal").findObject("seekaniminfo");
HiddenSeek = System.getContainer("main").getLayout("normal").findObject("HiddenSeek");

initSeek();
}

// Initialzes song ticker
initTicker() {
SongTicker = System.getContainer("main").getLayout("normal").findObject("songticker");

SongTickTimer = new Timer;
SongTickTimer.setDelay(1000);
}

// Clears text area
SongTickTimer.onTimer() {
SongTicker.setText("");
SongTickTimer.stop();
}

// Starts a timer to track the seeker position
System.onPlay() {
SongPlayTimer.start();
}

// Updates seeker as song plays
SongPlayTimer.onTimer() {
if (System.getPlayItemLength() > 0) {
float p = System.getPosition();
p = p / System.getPlayItemLength();
p = p * 255;
setSeekerPosition(p);
}

SongPlayTimer.start();
}

// Stops moving seeker
System.onStop() {
SongPlayTimer.stop();
Seek.gotoFrame(0);
}

//Initializes Seeker
initSeek() {

SeekInfo.setAlpha(0);

LastSeek = 0;
SeekChanging = 0;
SeekFrames = Seek.getLength();
SeekFrames = SeekFrames - 1;
TickerExist = SeekInfo.getTop();

if (TickerExist) initTicker();
}

// Reads clicks on seeker
Seek.onLeftButtonDown(int x, int y) {
if (getPlayItemLength() > 0) {
SeekChanging = 1;
updateSeeker(x, y);
}
}

Seek.onLeftButtonUp(int x, int y) {
Float l;
if (SeekChanging) {
l = seekMap.getValue(x - Seek.getLeft(), y - Seek.getTop());

if (l > 0) {
if (System.getPlayItemLength() >= 0) {
l = (l / 255) * System.getPlayItemLength();
System.seekTo(l);
}
}

SeekChanging = 0;
}
}

// Reads mouse movement of seeker
Seek.onMouseMove(int x, int y) {
if (SeekChanging)
updateSeeker(x, y);
}

// Updates seeker
updateSeeker(int x, int y) {
int v = seekMap.getValue(x - Seek.getLeft(), y - Seek.getTop());
if (v > 0) {
setSeekerPosition(v);

if (System.getPlayItemLength() >= 0) {
float len = System.getPlayItemLength();
int p = (v * 100) / 255;
int s = (v * len) / 255;
SongTickTimer.stop();
SongTickTimer.start();
Songticker.setText("Seek To " + System.integerToTime(s) + " / " + System.integerToTime(len) + " (" + System.integerToString(p) + "%)");
}
}
}

// Moves seeker frame position
setSeekerPosition(int p) {
int f = (p * SeekFrames) / 255;
if (p > 0) {
Seek.gotoFrame(f + 1);
}
if (p == 0) {
Seek.gotoFrame(0);
}
}

// Reads system position changes
HiddenSeek.onPostedPosition(int p) {
if (p != LastSeek && !SeekChanging) {
setSeekerPosition(p);
LastSeek = p;
}
}


Really a big thanks in advance in anyone can help me on this
Paikan is offline   Reply With Quote
Old 8th September 2002, 01:07   #3
Paikan
Member
 
Join Date: May 2002
Location: Paris
Posts: 76
Send a message via ICQ to Paikan
Problem fixed
Paikan 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