WSH Panel mod - Scriptbeispiele (Seekbar, Rating, Album-Rating, Coverart & mehr)

Begonnen von TomPro, 16. Juni 2009, 19:24:54

Vorheriges Thema - Nächstes Thema

grimes

Kann man nicht die Variablen, die das Aussehen der buttons ändern, nicht in die JScript-Properties auslagern? Ich finde das so übersichtlicher.

huber71

der buttontest-Ordner liegt im Foobar-Ordner (portable Version)

Wo genau muss das WSH Panel denn hin?  :-\

tedgo

@grimes
Das wollte ich zuerst.
Aber was, wenn man in einem Panel mehrere verschiedene Buttons einbauen will?
Ich hab das bei meinem DarkOne4Mod bemerkt. Hab da ja zwei verschiedene Buttons in einem Panel.
Und dann noch bis zu 10 zusätzliche optionale Buttons mit je vier Einträgen im Properties-Fenster... da ist dann im Fenster mehr Text als im Script... :D

@huber59
Wo du das Panel hinzufügst ist egal, ist ja nur zum Testen ;)
Funktioniert es denn jetzt?
Wenn nicht, was sagt die Console?

grimes

Ich würde das trotzdem machen. Im Script rumpfuschen ist immer gefährlich. (Ich schweige lieber darüber, wie ich Deine Buttons verhunzt habe. :D)

So etwa:
JS-Properties
BUTTON1.style
BUTTON1.align
-----------------
BUTTON2.style
BUTTON2.align


(AFAIK Lässt sich bei vielen Einträgen auch scrollen)

tedgo

Gut, das wäre machbar.
Aber... ich habe in einem Panel 19 Buttons.
Wenn ich jetzt für jeden 26 Optionen übers Panel schalten lasse, sind das allein 494 Einträge...
Zusätzlich noch 40 Einträge der optionalen Buttons.

Okay... ist jetzt ein Extrembeispiel.
Normalerweise langen - da ja nur zwei unterschiedliche Ansichten im Panel sind - 52 Einträge für die Optionen (plus die 40 fürs freischalten der optionalen Buttons).

Es ist im Normalfall auch gar nicht so viel und unübersichtlich, wie das jetzt scheint!
Denn 1. benutzt man in der Regel nicht alle Optionen und 2. dann eben auch oft gemeinsame Optionen für ganze Buttongruppen.

Ich hänge mal die Beispielscripts aus DarkOne4Mod v1.1 an, an dem ich gerade arbeite (einige Detalverbesserungen und Vereinfachungen - gerade auch in Bezug auf die optionalen Buttons).

(Der im ZIP-Ordner enthaltene Ordner cui-configs gehört wieder unter %appdata%\foobar2000 bzw. bei einer portablen Installation in den foobar2000-Ordner. Die zu ladenden Scripts befinden sich unter cui-configs\darkone4mod\jscript\panels. Es sind die beiden Buttonpanel und auch das erneuerte Display - könnt ihr ja gleich mal mittesten ;))

So siehst du mal am praktischen Beispiel, dass es gar nicht so unübersichtlich ist ;)

EDIT: Habe den Upload noch mal hochgeladen... war noch unsinnigerweise die alte Manual4Mod.pdf mit drin...
EDIT2: Noch mal den Upload erneuert...

grimes

Also jetzt nur mal eine Idee. Die properties lassen sich abspeichern (.wsp). Da könnte man doch Button presets kreieren.

tedgo

Hm... das habe ich noch nie gemacht... klingt aber interessant...
Muss ich mir noch mal durch den Kopf gehen lassen.

Was sagst du zum Script?
Gar nicht so unübersichtlich wie du dachtest, oder?

Btw. die optionalen Buttons lassen sich wie folgt aktivieren:
Rechtsklick ins Panel --> Manage optional buttons --> ganz rechts neben dem jeweiligen Button doppelklicken und aus "false" "true" machen --> Apply.
Dann den Befehl bei "... command string" eingeben (fb.... Commands gehen nicht! Nur noch Befehle aus dem Main Menu, z. B. File/Preferences oder Equalizer oder dem Kontextmenü, z. B. Properties, Batch attach pictures usw. funktionieren hier!)
Handelt es sich um ein Befehl aus dem Kontextmenü, dann bei der Frage "context menu command?" auf "true" umstellen und gegebenenfalls noch den Buttonnamen ändern.

huber71


tedgo

Freut mich :)
Hoffentlich macht es Spaß, mal mit den Optionen zu spielen.
Es sollten ja reichlich Anpassungsmöglichkeiten gegeben sein ;)

grimes

Ich bekomme die fcl auf die Schnelle nicht zum Laufen. alle Scripts sind abgestürzt. Das stimmt was mit den Pfaden nicht.

Habe bisher auch nicht mit den Properties gearbeitet. Kann da wenig helfen.

tedgo

Oh... hoppla...
Nicht die FCL laden!

Die ist obsolet... ich war nur zu faul, den Ordner (ist mein momentaner "Arbeitsordner) auseinander zu klamüsern... :D
Nur das benötigte Script aus dem Ordner cui-configs\darkone4mod\jscript\panels in ein WSH/Jscript Panel laden!

EDIT: Hab den Upload noch mal erneuert und diesmal (hoffentlich) nur das drin gelassen, was man für die Scripts braucht.

TomPro

Nach langer langer Zeit mal wieder was kleines. Ein Mitarbeiter ist nun auch auf foobar2000 gestossen und fand schon den Anfang sehr vielversprechend, lediglich eine Uhr, welche die Abgelaufene Playtime Anzeigt, und die man als Panel Integrieren kann fehle ihm. Hier also ein Simpler "Play Time Counter" mit einstelloptionen:


//----------------------------------------------------------------------------
//--- JScript
//----------------------------------------------------------------------------


//--- ---   Preprocessor
// ==PREPROCESSOR==
//
// #### Script Info
// ##
// @name "Play Time Counter"
// @version "2017.04.22"
// @author "TomPro"
//
// ==/PREPROCESSOR==


//--- ---   Properties
var CountDown  = window.GetProperty("*USER.Direction.Countdown", false);
var Direction  = window.GetProperty("*USER.Direction.Show", true);
var BackColor  = Number(window.GetProperty("*USER.Background.Color", "0x2F4F4F"));
var FontColor1 = Number(window.GetProperty("*USER.Font.Color", "0xFFFFFF"));
var FontName   = window.GetProperty("*USER.Font.Name", "Arial");

//--- ---   Check font
if (utils.CheckFont(FontName) == false) {
    FontName    = "Arial";
    window.SetProperty("*USER.Font.Name", FontName);
};

//--- ---   Check colors
var FontColor2, DirColorBack, DirColorFront;

function checkColors() {
    BackColor  = BackColor  | 0xFF000000;
    FontColor1 = FontColor1 | 0x000000;

    var r = 0xFF & (BackColor >> 16);
    var g = 0xFF & (BackColor >>  8);
    var b = 0xFF &  BackColor;

    if (((r << 16) | (g << 8) | (b)) < FontColor1) {
        r = ((r + 0x30) > 0xFF) ? 0xFF : r + 0x30;
        g = ((g + 0x30) > 0xFF) ? 0xFF : g + 0x30;
        b = ((b + 0x30) > 0xFF) ? 0xFF : b + 0x30;
    } else {
        r = ((r - 0x30) < 0x00) ? 0x00 : r - 0x30;
        g = ((g - 0x30) < 0x00) ? 0x00 : g - 0x30;
        b = ((b - 0x30) < 0x00) ? 0x00 : b - 0x30;
    };

    FontColor2    = (r << 16) | (g << 8) | (b);
    DirColorBack  = FontColor2 | 0xFF000000;
    DirColorFront = FontColor1 | 0xFF000000;
};

checkColors();

//--- ---   Size
var ww, wh, fh, f_min, f_sec;
var hMin, hSec, hDir;
var yMin, ySec, yDir;
var wSep, wStd, wMin, wSec, wDir;
var xStd, xSep1, xMin, xSep2, xSec, xDir;

function on_size() {
    ww   = window.Width;
    wh   = window.Height;
    xStd = 3;

    // Create temporary graphic interface
    temp_bmp = gdi.CreateImage(1, 1);
    temp_gr  = temp_bmp.GetGraphics();

    // Get font
    var tw, th;
    fh = 16;
    do {
        fh++;
        f_min = gdi.Font(FontName, fh, 0);
        f_sec = gdi.Font(FontName, Math.round(fh * 0.75), 0);
        tw    = temp_gr.CalcTextWidth( "0:00:", f_min) + temp_gr.CalcTextWidth("00", f_sec) + 2 * xStd;
        th    = temp_gr.CalcTextHeight("0:00:", f_min);
    };
    while (tw < ww && th < wh);
    fh--;
    f_min = gdi.Font(FontName, fh, 0);
    f_sec = gdi.Font(FontName, fh * 0.75, 0);
    tw    = temp_gr.CalcTextWidth( "0:00:", f_min) + temp_gr.CalcTextWidth("00", f_sec) + 2 * xStd;
    th    = temp_gr.CalcTextHeight("0:00:", f_min);

    // Get heights
    hMin  = Math.round(th);
    hSec  = Math.round(th * 0.75);
    hDir  = Math.round(th * 0.10);

    // Get y-positions
    yMin  = Math.floor((wh - hMin) / 2);
    ySec  = yMin + Math.round(th * 0.25);
    yDir  = yMin + hDir;

    // Get widths
    wSep  = temp_gr.CalcTextWidth( ":", f_min);
    wStd  = temp_gr.CalcTextWidth( "0", f_min);
    wMin  = temp_gr.CalcTextWidth("00", f_min);
    wSec  = temp_gr.CalcTextWidth("00", f_sec);
    wDir  = Math.round(wSec / 2);

    // Get x-positions
    xStd  = Math.round((ww - tw) / 2);
    xSep1 = xStd  + wStd;
    xMin  = xSep1 + wSep;
    xSep2 = xMin  + wMin;
    xSec  = xSep2 + wSep;
    xDir  = xSec  + wDir;

    // Dispose temporary graphic interface
    temp_bmp.ReleaseGraphics(temp_gr);
    delete temp_bmp;
    delete temp_gr;

    // Repaint
    window.Repaint();
};

//--- ---   Painting
function on_paint(gr){
    // Background
    gr.FillSolidRect( 0, 0, ww, wh, BackColor);

    // Count direction
    if (Direction == true) {
        gr.FillSolidRect(     xSec, yDir, wSec, hDir, DirColorBack);
        if (CountDown == true) {
            gr.FillSolidRect( xDir, yDir, wDir, hDir, DirColorFront);
        } else {
            gr.FillSolidRect( xSec, yDir, wDir, hDir, DirColorFront);
        };
    };

    // Play time
    if (tStd == 0) {
        gr.GdiDrawText( tStd, f_min, FontColor2, xStd , yMin, wStd, hMin, 2);
        gr.GdiDrawText(  ":", f_min, FontColor2, xSep1, yMin, wSep, hMin, 1);
        gr.GdiDrawText(tMin1, f_min, FontColor2, xMin , yMin, wMin, hMin, 0);
    } else {
        gr.GdiDrawText( tStd, f_min, FontColor1, xStd , yMin, wStd, hMin, 2);
        gr.GdiDrawText(  ":", f_min, FontColor1, xSep1, yMin, wSep, hMin, 1);
        gr.GdiDrawText(tMin1, f_min, FontColor1, xMin , yMin, wMin, hMin, 0);
    };
    gr.GdiDrawText(    tMin2, f_min, FontColor1, xMin , yMin, wMin, hMin, 2);
    gr.GdiDrawText(      ":", f_min, FontColor1, xSep2, yMin, wSep, hMin, 1);
    gr.GdiDrawText(     tSec, f_sec, FontColor1, xSec , ySec, wSec, hSec, 0);
};

//--- ---   Playback
var Time  = fb.PlaybackLength;
var tStd  = 0;
var tMin1 = 0;
var tMin2 = 0;
var tSec  = "00";

function on_playback_stop(reason) {
    Time  = 0;
    tStd  = 0;
    tMin1 = 0;
    tMin2 = 0;
    tSec  = "00";

    // Repaint
    window.Repaint();
};

function on_playback_new_track(metadb) {
    Time = fb.PlaybackLength;
    setTimes();
};

function on_playback_edited(metadb) {
    setTimes();
};

function on_playback_seek(time) {
    setTimes();
};

function on_playback_time(time) {
    setTimes();
};

function setTimes() {
    var tx = (CountDown == true) ? Math.abs(Math.round(Time - fb.PlaybackTime)) : Math.abs(Math.round(fb.PlaybackTime));

    tStd   = Math.floor(tx / (60 * 60));
    tx    -= tStd * 60 * 60;
    tMin2  = Math.floor(tx / 60);
    tMin1  = (tMin2 < 10) ? 0 : "";
    tSec   = tx % 60;
    if (tSec < 10) tSec = "0" + tSec;

    // Repaint
    window.Repaint();
};

setTimes();

//--- ---   Sub Menu
function on_mouse_lbtn_down(x, y, mask) {
    var _Menu = window.CreatePopupMenu();
    var _ColB = window.CreatePopupMenu();
    var _ColF = window.CreatePopupMenu();
    var _Font = window.CreatePopupMenu();

    // Direction
    _Menu.AppendMenuItem(0x00, 11, "Show Direction");
    _Menu.AppendMenuItem(0x00, 12, "Countdown");

    _Menu.CheckMenuItem(11, (Direction == true));
    _Menu.CheckMenuItem(12, (CountDown == true));

    _Menu.AppendMenuSeparator();

    // Colors
    var Split = Math.round(PreColorList.length / 6);
    var cBackNo = 101;
    var cFontNo = 301;

    _ColB.AppendTo(_Menu, 0x00, "Background Color");
    _ColF.AppendTo(_Menu, 0x00, "Font Color");

    var ii;
    for (var i in PreColorList) {
        ii = Number(i);
        // Fill popupmenu
        if ((ii != 0) && (ii % Split == 0)) {
            // New row
            _ColB.AppendMenuItem(0x20, cBackNo + ii, PreColorList[i]);
            _ColF.AppendMenuItem(0x20, cFontNo + ii, PreColorList[i]);
        } else {
            // Fill row
            _ColB.AppendMenuItem(0x00, cBackNo + ii, PreColorList[i]);
            _ColF.AppendMenuItem(0x00, cFontNo + ii, PreColorList[i]);
        };

        // Highlight used color
        _ColB.CheckMenuItem((cBackNo + ii), ((BackColor  & 0xFFFFFF) == (PreColor[PreColorList[i]] & 0xFFFFFF)));
        _ColF.CheckMenuItem((cFontNo + ii), ((FontColor1 & 0xFFFFFF) == (PreColor[PreColorList[i]] & 0xFFFFFF)));
    };

    // Fonts
    var Split = Math.round(FontList.length / 2);
    var FontNo = 501;

    _Font.AppendTo(_Menu, 0x00, "Fonts   (\"" + FontName + "\")");

    for (var i in FontList) {
        ii = Number(i);
        // Fill popupmenu
        if ((ii != 0) && (ii % Split == 0)) {
            // New row
            _Font.AppendMenuItem(0x20, FontNo + ii, FontList[i]);
         } else {
            // Fill row
            _Font.AppendMenuItem(0x00, FontNo + ii, FontList[i]);
        };

        // Highlight used color
        _Font.CheckMenuItem((FontNo + ii), (FontName == FontList[i]));
    };

    // Execute
    var ret = _Menu.TrackPopupMenu(x,y);
    switch (true) {
        // Show direction
        case (ret == 11):;
            // Toggle countdown flag
            Direction = (Direction == true) ? false : true;

            // Write hex string to properties
            window.SetProperty("*USER.Direction.Show", Direction);

            // Repaint
            window.Repaint();
            break;
        // Countdown
        case (ret == 12):;
            // Toggle countdown flag
            CountDown = (CountDown == true) ? false : true;

            // Write hex string to properties
            window.SetProperty("*USER.Direction.Countdown", CountDown);

            // Repaint
            window.Repaint();
            break;
        // Backgroundcolor
        case (cBackNo <= ret && ret <= cBackNo + PreColorList.length):;
            // Get color as hex string
            BackColor = ((PreColor[PreColorList[ret - cBackNo]]) & 0x00FFFFFF).toString(16);

            // Pad hex string up to 6 carachters plus leading "0x"
            BackColor = "0x000000".substr(0, 8 - BackColor.length) + BackColor;

            // Write hex string to properties
            window.SetProperty("*USER.Background.Color", BackColor);

            // Get color and repaint
            BackColor = Number(BackColor);
            checkColors();
            window.Repaint();
            break;
        // Fontcolor
        case (cFontNo <= ret && ret <= cFontNo + PreColorList.length):;
            // Get color as hex string
            FontColor1 = ((PreColor[PreColorList[ret - cFontNo]]) & 0x00FFFFFF).toString(16);

            // Pad hex string up to 6 carachters plus leading "0x"
            FontColor1 = "0x000000".substr(0, 8 - FontColor1.length) + FontColor1;

            // Write hex string to properties
            window.SetProperty("*USER.Font.Color", FontColor1);

            // Get color and repaint
            FontColor1 = Number(FontColor1);
            checkColors();
            window.Repaint();
            break;
        // Font
        case (FontNo  <= ret && ret <= FontNo  + FontList.length):;
            // Get fontname
            FontName = FontList[ret - FontNo];

            // Write fontname to properties
            window.SetProperty("*USER.Font.Name", FontName);

            // Resize window
            on_size();
            break;
        // Nothing
        default:;
            break;
    };

    _ColB.Dispose();
    _ColF.Dispose();
    _Font.Dispose();
    _Menu.Dispose();
};


//--- ---   pre-calculated colors
PreColor = {
AliceBlue : 0xFFF0F8FF,
AntiqueWhite : 0xFFFAEBD7,
Aqua : 0xFF00FFFF,
Aquamarine : 0xFF7FFFD4,
Azure : 0xFFF0FFFF,
Beige : 0xFFF5F5DC,
Bisque : 0xFFFFE4C4,
Black : 0xFF000000,
BlanchedAlmond : 0xFFFFEBCD,
Blue : 0xFF0000FF,
BlueViolet : 0xFF8A2BE2,
Brown : 0xFFA52A2A,
BurlyWood : 0xFFDEB887,
CadetBlue : 0xFF5F9EA0,
Chartreuse : 0xFF7FFF00,
Chocolate : 0xFFD2691E,
Coral : 0xFFFF7F50,
CornflowerBlue : 0xFF6495ED,
Cornsilk : 0xFFFFF8DC,
Crimson : 0xFFDC143C,
Cyan : 0xFF00FFFF,
DarkBlue : 0xFF00008B,
DarkCyan : 0xFF008B8B,
DarkGoldenrod : 0xFFB8860B,
DarkGray : 0xFFA9A9A9,
DarkGreen : 0xFF006400,
DarkKhaki : 0xFFBDB76B,
DarkMagenta : 0xFF8B008B,
DarkOliveGreen : 0xFF556B2F,
DarkOrange : 0xFFFF8C00,
DarkOrchid : 0xFF9932CC,
DarkRed : 0xFF8B0000,
DarkSalmon : 0xFFE9967A,
DarkSeaGreen : 0xFF8FBC8B,
DarkSlateBlue : 0xFF483D8B,
DarkSlateGray : 0xFF2F4F4F,
DarkTurquoise : 0xFF00CED1,
DarkViolet : 0xFF9400D3,
DarkYellow : 0xFFA0A000,
DeepPink : 0xFFFF1493,
DeepSkyBlue : 0xFF00BFFF,
DimGray : 0xFF696969,
DodgerBlue : 0xFF1E90FF,
Firebrick : 0xFFB22222,
FloralWhite : 0xFFFFFAF0,
ForestGreen : 0xFF228B22,
Fuchsia : 0xFFFF00FF,
Gainsboro : 0xFFDCDCDC,
GhostWhite : 0xFFF8F8FF,
Gold : 0xFFFFD700,
Goldenrod : 0xFFDAA520,
Gray : 0xFF808080,
Green : 0xFF008000,
GreenYellow : 0xFFADFF2F,
Honeydew : 0xFFF0FFF0,
HotPink : 0xFFFF69B4,
IndianRed : 0xFFCD5C5C,
Indigo : 0xFF4B0082,
Ivory : 0xFFFFFFF0,
Khaki : 0xFFF0E68C,
Lavender : 0xFFE6E6FA,
LavenderBlush : 0xFFFFF0F5,
LawnGreen : 0xFF7CFC00,
LemonChiffon : 0xFFFFFACD,
LightBlue : 0xFFADD8E6,
LightCoral : 0xFFF08080,
LightCyan : 0xFFE0FFFF,
LightGoldenrodYellow : 0xFFFAFAD2,
LightGray : 0xFFD3D3D3,
LightGreen : 0xFF90EE90,
LightPink : 0xFFFFB6C1,
LightSalmon : 0xFFFFA07A,
LightSeaGreen : 0xFF20B2AA,
LightSkyBlue : 0xFF87CEFA,
LightSlateGray : 0xFF778899,
LightSteelBlue : 0xFFB0C4DE,
LightYellow : 0xFFFFFFE0,
Lime : 0xFF00FF00,
LimeGreen : 0xFF32CD32,
Linen : 0xFFFAF0E6,
Magenta : 0xFFFF00FF,
Maroon : 0xFF800000,
MediumAquamarine : 0xFF66CDAA,
MediumBlue : 0xFF0000CD,
MediumOrchid : 0xFFBA55D3,
MediumPurple : 0xFF9370DB,
MediumSeaGreen : 0xFF3CB371,
MediumSlateBlue : 0xFF7B68EE,
MediumSpringGreen : 0xFF00FA9A,
MediumTurquoise : 0xFF48D1CC,
MediumVioletRed : 0xFFC71585,
MidnightBlue : 0xFF191970,
MintCream : 0xFFF5FFFA,
MistyRose : 0xFFFFE4E1,
Moccasin : 0xFFFFE4B5,
NavajoWhite : 0xFFFFDEAD,
Navy : 0xFF000080,
OldLace : 0xFFFDF5E6,
Olive : 0xFF808000,
OliveDrab : 0xFF6B8E23,
Orange : 0xFFFFA500,
OrangeRed : 0xFFFF4500,
Orchid : 0xFFDA70D6,
PaleGoldenrod : 0xFFEEE8AA,
PaleGreen : 0xFF98FB98,
PaleTurquoise : 0xFFAFEEEE,
PaleVioletRed : 0xFFDB7093,
PapayaWhip : 0xFFFFEFD5,
PeachPuff : 0xFFFFDAB9,
Peru : 0xFFCD853F,
Pink : 0xFFFFC0CB,
Plum : 0xFFDDA0DD,
PowderBlue : 0xFFB0E0E6,
Purple : 0xFF800080,
Red : 0xFFFF0000,
RosyBrown : 0xFFBC8F8F,
RoyalBlue : 0xFF4169E1,
SaddleBrown : 0xFF8B4513,
Salmon : 0xFFFA8072,
SandyBrown : 0xFFF4A460,
SeaGreen : 0xFF2E8B57,
SeaShell : 0xFFFFF5EE,
Sienna : 0xFFA0522D,
Silver : 0xFFC0C0C0,
SkyBlue : 0xFF87CEEB,
SlateBlue : 0xFF6A5ACD,
SlateGray : 0xFF708090,
Snow : 0xFFFFFAFA,
SpringGreen : 0xFF00FF7F,
SteelBlue : 0xFF4682B4,
Tan : 0xFFD2B48C,
Teal : 0xFF008080,
Thistle : 0xFFD8BFD8,
Tomato : 0xFFFF6347,
Turquoise : 0xFF40E0D0,
Violet : 0xFFEE82EE,
Wheat : 0xFFF5DEB3,
White : 0xFFFFFFFF,
WhiteSmoke : 0xFFF5F5F5,
Yellow : 0xFFFFFF00,
YellowGreen : 0xFF9ACD32
};

PreColorList = new Array();

for (var i in PreColor) {
    PreColorList.push(i);
};


//--- ---   pre-selected fonts
PreFontList = new Array(
    "Arial",
    "Calibri",
    "Cambria",
    "Cambria Math",
    "Candara",
    "Comic Sans MS",
    "Consolas",
    "Constantia",
    "Corbel",
    "Courier New",
    "Franklin Gothic Medium",
    "Gabriola",
    "Georgia",
    "Impact",
    "Lucida Console",
    "Lucida Sans Unicode",
    "Microsoft Sans Serif",
    "Palatino Linotype",
    "Script",
    "Segoe Print",
    "Segoe Script",
    "Segoe UI",
    "Segoe UI Symbol",
    "Symbol",
    "Tahoma",
    "Times New Roman",
    "Trebuchet MS",
    "Verdana",
    "Webdings",
    "Wingdings"
    );

FontList = new Array();

for (var i in PreFontList) {
    if (utils.CheckFont(PreFontList[i]) == true) FontList.push(PreFontList[i]);
};


//EOF


Veränderungen an der Darstellung kann man mit Hilfe eines "Left Mousebuton klick" bewerkstelligen. Und wem die Farb- oder Fontauswahl nicht reicht, kann mit der rechten Maustaste auch noch in den Properties entsprechendes Einstellen.

miras


grimes

FooTour Skript

//FooTour v1.0 by grimes
//uses BandsInTown API
//fb2k 1.0+, WSH Panel Mod 1.3.2+ required
//DUI/CUI ready

function RGB(r, g, b) {
    return (0xff000000 | (r << 16) | (g << 8) | (b));
}

var dui = window.InstanceType;
var g_font = dui === 1 ? window.GetFontDUI(0) : window.GetFontCUI(0);
//var color = RGB(200,0,0);
var color = dui === 1 ? window.GetColorDUI(2) : RGB(200, 0, 0);
//var color2 = RGB(0,0,0);
var color2 = dui === 1 ? window.GetColorDUI(0) : window.GetColorCUI(0);

var browser = window.GetProperty("Browser (firefox, iexplore) ", "firefox");
var auto = window.GetProperty("Auto Retrieve ", false);

//map
var worldmap = fb.ProfilePath + "\\pictures\\world-map.jpg";
var footourlogo = fb.ProfilePath + "\\pictures\\footour.png";
var map = window.GetProperty("Show Map ", true);
var homelocation = window.GetProperty("Home Location (City,Country) ", "Frankfurt,Germany");
var homelatitude = window.GetProperty("Home Latitude ", 50.1167);
var homelongitude = window.GetProperty("Home Longitude ", 8.6833);
var radius = window.GetProperty("Radius (miles) ", 100);
var g_img = null;
var ww = 0,
    wh = 0;
var xm;
var ym;
var xp;
var yp;
var scale;
var mlatitude = -91;
var mlongitude = -181;
var mx = 0;
var my = 0;
var line = false;
var square = true;
var longborder = 180;
var latborder = 90;
var d1 = 0;
var d2 = 0;
var d3 = 0;
var d4 = 0;

var xmlhttp = "";
var xmlhttp2 = "";
var xmlhttp3 = "";
var xmlhttp4 = "";
var xmlhttp5 = "";
var xmlhttp6 = "";
var xmltext = "";
var request1 = false;
var request2 = false;
var request3 = false;
var request4 = false;
var request5 = false;
var request6 = false;
var artistname = [];
var venuename = [];
var venuecity = [];
var venueregion = [];
var venuecountry = [];
var venuelatitude = [];
var venuelongitude = [];
var ticketstatus = [];
var datetime = [];
var onsaledatetime = [];
var artisturl = [];
var venueurl = [];
var venueid = [];
var venueidv = "";

var vert = 20;
var artist = "";
var artistold = "";
var artistplaying = "";
var set = 0;

function get_tags() {
    artist = fb.TitleFormat("$replace(%artist%,/,\/)").Eval();
    artistplaying = artist;
}

if (fb.IsPlaying || fb.IsPaused) {
    get_tags();
}

function get_image() {
    g_img = gdi.Image(worldmap);
    g_img2 = gdi.Image(footourlogo);
}

get_image();

function toRad(deg) {
    return deg * Math.PI / 180;
}

//haversine formula
function calc_distance(lat1, lon1, lat2, lon2) {
    var R = 6371; // km
    var dLat = toRad(lat2 - lat1);
    var dLon = toRad(lon2 - lon1);
    var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(toRad(lat1)) * Math.cos(toRad(lat2)) * Math.sin(dLon / 2) * Math.sin(dLon / 2);
    var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
    var d = R * c;
    if (d < radius * 1.60934) {
        return Math.round(d * 10) / 10;
    }
    else {
        return Math.round(d);
    }
}

function get_distance() {
    d2 = calc_distance(venuelatitude[set], venuelongitude[set], homelatitude, homelongitude);
    d3 = calc_distance(venuelatitude[set], venuelongitude[set], venuelatitude[set + 1], venuelongitude[set + 1]);
}

function get_events() {
    xml = new ActiveXObject("microsoft.xmldom");
    xml.async = true;
    if (request1) {
        filled = xml.loadXML(xmlhttp.responseText);
    }
    else if (request2) {
        filled = xml.loadXML(xmlhttp2.responseText);
    }
    else if (request3) {
        filled = xml.loadXML(xmlhttp3.responseText);
    }
    else if (request4) {
        filled = xml.loadXML(xmlhttp4.responseText);
    }
    else if (request5) {
        filled = xml.loadXML(xmlhttp5.responseText);
    }
    else if (request6) {
        filled = xml.loadXML(xmlhttp6.responseText);
    }
    root = xml.documentElement;
    if (filled) {
        try {
            for (i = 0; i < root.getElementsByTagName("city").length; i++) {
                if (i >= 150) {
                    break;
                }
                if (root.getElementsByTagName("artists")[i].firstChild.firstChild && root.getElementsByTagName("artists")[i].firstChild.firstChild.firstChild) {
                    artistname.push(root.getElementsByTagName("artists")[i].firstChild.firstChild.childNodes[0].nodeValue);
                }
                else {
                    artistname.push("N/A");
                }
                if (root.getElementsByTagName("venue")[i] && root.getElementsByTagName("venue")[i].firstChild) {
                    venuename.push(root.getElementsByTagName("venue")[i].firstChild.nextSibling.nextSibling.childNodes[0].nodeValue);
                }
                else {
                    venuename.push("N/A");
                }
                if (root.getElementsByTagName("city")[i] && root.getElementsByTagName("city")[i].firstChild) {
                    venuecity.push(root.getElementsByTagName("city")[i].childNodes[0].nodeValue);
                }
                else {
                    venuecity.push("N/A");
                }
                if (root.getElementsByTagName("region")[i] && root.getElementsByTagName("region")[i].firstChild) {
                    venueregion.push(root.getElementsByTagName("region")[i].childNodes[0].nodeValue);
                }
                else {
                    venueregion.push("N/A");
                }
                if (root.getElementsByTagName("country")[i] && root.getElementsByTagName("country")[i].firstChild) {
                    venuecountry.push(root.getElementsByTagName("country")[i].childNodes[0].nodeValue);
                }
                else {
                    venuecountry.push("N/A");
                }
                if (root.getElementsByTagName("latitude")[i] && root.getElementsByTagName("latitude")[i].firstChild) {
                    venuelatitude.push(root.getElementsByTagName("latitude")[i].childNodes[0].nodeValue);
                }
                else {
                    venuelatitude.push("N/A");
                }
                if (root.getElementsByTagName("longitude")[i] && root.getElementsByTagName("longitude")[i].firstChild) {
                    venuelongitude.push(root.getElementsByTagName("longitude")[i].childNodes[0].nodeValue);
                }
                else {
                    venuelongitude.push("N/A");
                }
                if (root.getElementsByTagName("ticket_status")[i] && root.getElementsByTagName("ticket_status")[i].firstChild) {
                    ticketstatus.push(root.getElementsByTagName("ticket_status")[i].childNodes[0].nodeValue);
                }
                else {
                    ticketstatus.push("N/A");
                }
                if (root.getElementsByTagName("datetime")[i] && root.getElementsByTagName("datetime")[i].firstChild) {
                    datetime.push(root.getElementsByTagName("datetime")[i].childNodes[0].nodeValue);
                }
                else {
                    datetime.push("N/A");
                }
                if (root.getElementsByTagName("on_sale_datetime")[i] && root.getElementsByTagName("on_sale_datetime")[i].firstChild) {
                    onsaledatetime.push(root.getElementsByTagName("on_sale_datetime")[i].childNodes[0].nodeValue);
                }
                else {
                    onsaledatetime.push("N/A");
                }
                if (root.getElementsByTagName("artists")[i] && root.getElementsByTagName("artists")[i].firstChild) {
                    artisturl.push(root.getElementsByTagName("artists")[i].firstChild.firstChild.nextSibling.childNodes[0].nodeValue);
                }
                else {
                    artisturl = "N/A";
                }
                if (root.getElementsByTagName("venue")[i] && root.getElementsByTagName("venue")[i].firstChild) {
                    venueurl.push(root.getElementsByTagName("venue")[i].firstChild.nextSibling.childNodes[0].nodeValue);
                }
                else {
                    venueurl.push("N/A");
                }
                if (root.getElementsByTagName("venue")[i] && root.getElementsByTagName("venue")[i].firstChild) {
                    venueid.push(root.getElementsByTagName("venue")[i].firstChild.childNodes[0].nodeValue);
                }
                else {
                    venueid.push("N/A");
                }
            }
        }
        catch (err) {
            fb.trace("get_events: " + err);
        }
    }
    get_distance();
    d4 = 0;
    for (i = 0; i < venuelatitude.length - 1; i++) {
        d4 = Math.round(d4 + calc_distance(venuelatitude[i], venuelongitude[i], venuelatitude[i + 1], venuelongitude[i + 1]));
    }
    if (!request1 && artistname.length > 0) {
        artist = artistname[set];
    }
    window.Repaint();
}

//global Variables for text field
var DT_TOP = 0x00000000;
var DT_LEFT = 0x00000000;
var DT_CENTER = 0x00000001;
var DT_RIGHT = 0x00000002;
var DT_VCENTER = 0x00000004;
var DT_BOTTOM = 0x00000008;
var DT_WORDBREAK = 0x00000010;
var DT_SINGLELINE = 0x00000020;
var DT_EXPANDTABS = 0x00000040;
var DT_TABSTOP = 0x00000080;
var DT_NOCLIP = 0x00000100;
var DT_EXTERNALLEADING = 0x00000200;
var DT_CALCRECT = 0x00000400;
var DT_NOPREFIX = 0x00000800;
var DT_INTERNAL = 0x00001000;
var DT_EDITCONTROL = 0x00002000;
var DT_PATH_ELLIPSIS = 0x00004000;
var DT_END_ELLIPSIS = 0x00008000;
var DT_MODIFYSTRING = 0x00010000;
var DT_RTLREADING = 0x00020000;
var DT_WORD_ELLIPSIS = 0x00040000;
var DT_NOFULLWIDTHCHARBREAK = 0x00080000;
var DT_HIDEPREFIX = 0x00100000;
var DT_PREFIXONLY = 0x00200000;

function on_paint(gr) {
    gr.FillSolidRect(0, 0, ww, wh, dui === 1 ? window.GetColorDUI(1) : window.GetColorCUI(3));
    if (!map && artistname.length > 0) {
        gr.GdiDrawText("Venue Name: " + venuename[set], g_font, color2, 0, 2 * vert, ww, wh, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        gr.GdiDrawText("Venue City: " + venuecity[set], g_font, color2, 0, 3 * vert, ww, wh, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        gr.GdiDrawText("Venue Region: " + venueregion[set], g_font, color2, 0, 4 * vert, ww, wh, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        gr.GdiDrawText("Venue Country: " + venuecountry[set], g_font, color2, 0, 5 * vert, ww, wh, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        gr.GdiDrawText("Venue Latitude: " + venuelatitude[set], g_font, color2, 0, 6 * vert, ww, wh, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        gr.GdiDrawText("Venue Longitude: " + venuelongitude[set], g_font, color2, 0, 7 * vert, ww, wh, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        gr.GdiDrawText("Ticket Status: " + ticketstatus[set], g_font, color2, 0, 8 * vert, ww, wh, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        gr.GdiDrawText("On Sale Date Time: " + onsaledatetime[set], g_font, color2, 0, 9 * vert, ww, wh, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        gr.GdiDrawText("Artist URL: " + artisturl[set], g_font, color2, 0, 10 * vert, ww, wh, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        gr.GdiDrawText("Venue URL: " + venueurl[set], g_font, color2, 0, 11 * vert, ww, wh, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        gr.GdiDrawText("Event Date: " + datetime[set], g_font, color2, 0, 12 * vert, ww, wh, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        if (venuelongitude.length > 0 && venuelatitude.length > 0) {
            gr.GdiDrawText("Distance Home (km): " + d2, g_font, color2, 0, 13 * vert, ww, wh, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
            gr.GdiDrawText("Distance Stage/Tour (km): " + d3 + "/" + d4, g_font, color2, 0, 14 * vert, ww, wh, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
        }
    }
    if (map) {
        if (g_img) {
            scale = 0;
            xp = 0;
            yp = 0;
            var scale_w = ww / g_img.Width;
            var scale_h = wh / g_img.Height;

            if (scale_w <= scale_h) {
                scale = scale_w;
                yp = (wh - g_img.Height * scale) / 2;
            } else {
                scale = scale_h;
                xp = (ww - g_img.Width * scale) / 2;
            }
            gr.DrawImage(g_img, xp, yp, g_img.Width * scale, g_img.Height * scale, 0, 0, g_img.Width, g_img.Height);
            if (mlongitude > -longborder && mlongitude < longborder && mlatitude > -latborder && mlatitude < latborder) {
                gr.GdiDrawText("Latitude: " + mlatitude, g_font, color, 0, 0, ww, wh, DT_BOTTOM | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
                gr.GdiDrawText("Longitude: " + mlongitude, g_font, color, 0, -15, ww, wh, DT_BOTTOM | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
                gr.GdiDrawText("Distance (km): " + d1, g_font, color, 0, -30, ww, wh, DT_BOTTOM | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
            }
            if (artistname.length > 0) {
                gr.GdiDrawText(venuename[set], g_font, color, ww/2, -15, ww/2, wh, DT_BOTTOM | DT_RIGHT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
            }
            var homelongitude2 = xp + (g_img.Width * scale * (longborder + (homelongitude)) / (2 * longborder));
            var homelatitude2 = yp + (g_img.Height * scale * (latborder - (homelatitude)) / (2 * latborder));
            gr.FillSolidRect(homelongitude2 - 2, homelatitude2 - 2, 5, 5, color2);
            //gr.FillSolidRect(homelongitude2 - 1, homelatitude2 - 1, 3, 3, color);
            if (venuecity.length > 0) {
                gr.GdiDrawText(venuecity[set] + ", " + venueregion[set] + ", " + venuecountry[set], g_font, color, ww/2, 0, ww/2, wh, DT_BOTTOM | DT_RIGHT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
            }
            if (venuelongitude.length > 0 && venuelatitude.length > 0) {
                gr.GdiDrawText("H:"+ d2 + "/S:" + d3 + "/T:" + d4 + "km, " + datetime[set], g_font, color, 0, -30, ww, wh, DT_BOTTOM | DT_RIGHT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
            }
            if (venuelatitude.length > 0 && venuelongitude.length > 0 && line) {
                for (j = 0; j < root.getElementsByTagName("latitude").length - 1; j++) {
                    var xb = xp + (g_img.Width * scale * (longborder + (parseFloat(venuelongitude[j]))) / (2 * longborder));
                    var yb = yp + (g_img.Height * scale * (latborder - (parseFloat(venuelatitude[j]))) / (2 * latborder));
                    var xc = xp + (g_img.Width * scale * (longborder + (parseFloat(venuelongitude[j + 1]))) / (2 * longborder));
                    var yc = yp + (g_img.Height * scale * (latborder - (parseFloat(venuelatitude[j + 1]))) / (2 * latborder));
                    gr.DrawLine(xb, yb, xc, yc, 1, color);
                }
            }
            if (venuelatitude.length > 0 && venuelongitude.length > 0 && square) {
                for (j = 0; j < venuelatitude.length; j++) {
                    var xd = xp + (g_img.Width * scale * (longborder + (parseFloat(venuelongitude[j]))) / (2 * longborder));
                    var yd = yp + (g_img.Height * scale * (latborder - (parseFloat(venuelatitude[j]))) / (2 * latborder));
                    gr.FillSolidRect(xd - 1, yd - 1, 3, 3, color);
                }
            }
            if (venuelongitude[set] && venuelatitude[set] && !line) {
                var xa = xp + (g_img.Width * scale * (longborder + (parseFloat(venuelongitude[set]))) / (2 * longborder));
                var ya = yp + (g_img.Height * scale * (latborder - (parseFloat(venuelatitude[set]))) / (2 * latborder));
                gr.FillSolidRect(xa - 3, ya - 3, 7, 7, color);
                gr.FillSolidRect(xa - 1, ya - 1, 3, 3, color2);
            }
        }
    }
    gr.GdiDrawText("FooTour (BandsInTown)", g_font, color, 0, 0, ww, wh, DT_TOP | DT_RIGHT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
    gr.GdiDrawText("Artist: " + artist, g_font, color, 0, 0, ww - g_img2.Width - 10, wh, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
    if (venuecity.length > 0) {
        gr.GdiDrawText("Set: " + (set + 1) + "/" + venuecity.length + " (lbtn/wheel)", g_font, color, 0, vert, ww, wh, DT_TOP | DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
    }
    gr.DrawImage(g_img2, ww - g_img2.Width, 0, g_img2.Width, g_img2.Height, 0, 0, g_img2.Width, g_img2.Height);
}

function clear_arrays() {
    artistname.splice(0, artistname.length);
    venuecity.splice(0, venuecity.length);
    venueregion.splice(0, venueregion.length);
    venuecountry.splice(0, venuecountry.length);
    venuename.splice(0, venuename.length);
    venuelatitude.splice(0, venuelatitude.length);
    venuelongitude.splice(0, venuelongitude.length);
    ticketstatus.splice(0, ticketstatus.length);
    datetime.splice(0, datetime.length);
    onsaledatetime.splice(0, onsaledatetime.length);
    artisturl.splice(0, artisturl.length);
    venueurl.splice(0, venueurl.length);
    venueid.splice(0, venueid.length);
}

function get_request1() {
    if (artist.length > 1) {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        xmlhttp.open("GET", "http://api.bandsintown.com/artists/" + artist + "/events.xml?app_id=Foobar2000");
        xmlhttp.send();
        xmlhttp.onreadystatechange = function () {
            if (xmlhttp.readyState === 4) {
                get_events();
                set = 0;
                //fb.trace(xmlhttp.responsetext);
            }
        };
    }
    else {
        fb.trace("No Artist");
    }
}

function get_request2() {
    if (artist.length > 1) {
        xmlhttp2 = new ActiveXObject("Microsoft.XMLHTTP");
        xmlhttp2.open("GET", "http://api.bandsintown.com/events/recommended?artists[]=" + artist + "&location=" + homelocation + "&radius=" + radius + "&format=xml&app_id=Foobar2000");
        xmlhttp2.send();
        xmlhttp2.onreadystatechange = function () {
            if (xmlhttp2.readyState === 4) {
                get_events();
                set = 0;
                //fb.trace(xmlhttp2.responsetext);
            }
        };
    }
    else {
        fb.trace("No Artist");
    }
}

function get_request3() {
    xmlhttp3 = new ActiveXObject("Microsoft.XMLHTTP");
    xmlhttp3.open("GET", "http://api.bandsintown.com/events/search?location=" + homelocation + "&radius=" + radius + "&format=xml&app_id=Foobar2000");
    xmlhttp3.send();
    xmlhttp3.onreadystatechange = function () {
        if (xmlhttp3.readyState === 4) {
            get_events();
            set = 0;
            //fb.trace(xmlhttp3.responsetext);
        }
    };
}

function get_request4() {
    xmlhttp4 = new ActiveXObject("Microsoft.XMLHTTP");
    xmlhttp4.open("GET", "http://api.bandsintown.com/events/on_sale_soon.xml?location=" + homelocation + "&radius=" + radius + "&app_id=Foobar2000");
    xmlhttp4.send();
    xmlhttp4.onreadystatechange = function () {
        if (xmlhttp4.readyState === 4) {
            get_events();
            set = 0;
            //fb.trace(xmlhttp4.responsetext);
        }
    };
}

function get_request5() {
    if (artist.length > 1) {
        xmlhttp5 = new ActiveXObject("Microsoft.XMLHTTP");
        xmlhttp5.open("GET", "http://api.bandsintown.com/events/search?artists[]=" + artist + "&location=" + homelocation + "&radius=" + radius + "&format=xml&app_id=Foobar2000");
        xmlhttp5.send();
        xmlhttp5.onreadystatechange = function () {
            if (xmlhttp5.readyState === 4) {
                get_events();
                set = 0;
                //fb.trace(xmlhttp5.responsetext);
            }
        };
    }
}

function get_request6() {
    if (venueidv.length > 1) {
        xmlhttp6 = new ActiveXObject("Microsoft.XMLHTTP");
        xmlhttp6.open("GET", "http://api.bandsintown.com/venues/" + venueidv + "/events.xml?app_id=Foobar2000");
        xmlhttp6.send();
        xmlhttp6.onreadystatechange = function () {
            if (xmlhttp6.readyState === 4) {
                get_events();
                set = 0;
                //fb.trace(xmlhttp6.responsetext);
            }
        };
    }
}

function on_playback_new_track() {
    get_tags();
    if (artistold !== artist && auto) {
        artistold = artist;
        request1 = true;
        request2 = false;
        request3 = false;
        request4 = false;
        request5 = false;
        request6 = false;
        map = true;
        clear_arrays();
        set = 0;
        get_request1();       
    }
    window.Repaint();
}

function on_mouse_lbtn_down(x, y) {
    if (venuecity.length > 0) {
        set++;
        if (set >= venuecity.length) {
            set = 0;
        }
    }
    artist = artistname[set];
    get_distance();   
    window.Repaint();
}

function on_mouse_leave() {
    mlatitude = 91;
    mlongitude = 181;
    window.Repaint();
}

function on_mouse_wheel(delta) {
    for (j = 0; j < delta; j++) {
        if (venuecity.length > 0) {
            set++;
            if (set >= venuecity.length) {
                set = venuecity.length - 1;
            }
        }
        artist = artistname[set];
        get_distance();
        window.Repaint();
    }
    for (j = 0; j < -delta; j++) {
        if (venuecity.length > 1) {
            set--;
            if (set <= 0) {
                set = 0;
            }
        }
        artist = artistname[set];
        get_distance();
        window.Repaint();
    }
}

function on_mouse_move(x, y) {
    if (map) {
        mx = x - xp;
        my = y - yp;
        mlongitude = (mx / (g_img.Width * scale) * (2 * longborder)) - longborder;
        mlatitude = (latborder - (my / (g_img.Height * scale) * (2 * latborder)));
        d1 = calc_distance(mlatitude, mlongitude, homelatitude, homelongitude);
    }
    window.SetCursor(32649);
    window.Repaint();
}

function on_mouse_rbtn_up(x, y) {
    var MF_SEPARATOR = 0x00000800;
    var MF_STRING = 0x00000000;
    var _menu = window.CreatePopupMenu();
    var idx;
    _menu.AppendMenuItem(MF_STRING, 15, "Auto");
    if (!auto) {
        _menu.CheckMenuItem(15, false);
    } else {
        _menu.CheckMenuItem(15, true);
    }
    _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
    _menu.AppendMenuItem(MF_STRING, 1, "Artist Global (Internet)");
    _menu.AppendMenuItem(MF_STRING, 16, "Back (Internet)");
    _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
    _menu.AppendMenuItem(MF_STRING, 13, "Artist Local (Internet)");
    _menu.AppendMenuItem(MF_STRING, 14, "Venue (Internet)");
    _menu.AppendMenuItem(MF_STRING, 10, "Recommended Artists Local (Internet)");
    _menu.AppendMenuItem(MF_STRING, 11, "All Artists Local (Internet)");
    _menu.AppendMenuItem(MF_STRING, 12, "On Sale Soon Local (Internet)");
    _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
    _menu.AppendMenuItem(MF_STRING, 2, "Artist On Tour (Browser/Internet)");
    _menu.AppendMenuItem(MF_STRING, 3, "Venue (Browser/Internet)");
    _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
    _menu.AppendMenuItem(MF_STRING, 4, "Show Map");
    if (!map) {
        _menu.CheckMenuItem(4, false);
    } else {
        _menu.CheckMenuItem(4, true);
    }
    _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
    _menu.AppendMenuItem(MF_STRING, 5, "Square (Event)");
    _menu.AppendMenuItem(MF_STRING, 6, "Square (Tour)");
    _menu.AppendMenuItem(MF_STRING, 7, "Line (Tour)");
    if (!square && !line && map) {
        _menu.CheckMenuRadioItem(5, 7, 5);
    }
    if (square && map) {
        _menu.CheckMenuRadioItem(5, 7, 6);
    } else if (line && map) {
        _menu.CheckMenuRadioItem(5, 7, 7);
    }
    _menu.AppendMenuItem(MF_SEPARATOR, 0, 0);
    _menu.AppendMenuItem(MF_STRING, 8, "Properties");
    _menu.AppendMenuItem(MF_STRING, 9, "Configure...");

    idx = _menu.TrackPopupMenu(x, y);
    switch (idx) {
    case 1:
        if (artistold !== artist) {
            artistold = artist;
            request1 = true;
            request2 = false;
            request3 = false;
            request4 = false;
            request5 = false;
            request6 = false;
            map = true;
            clear_arrays();
            set = 0;
            get_request1();
        }
        break;
    case 2:
        if (venueurl.length > 1) {
            firefox = new ActiveXObject("Shell.Application");
            firefox.ShellExecute(browser, "" + artisturl[set] + "", "", "open", 1);
        }
        break;
    case 3:
        if (venueurl.length > 1) {
            firefox = new ActiveXObject("Shell.Application");
            firefox.ShellExecute(browser, "" + venueurl[set] + "", "", "open", 1);
        }
        break;
    case 4:
        if (!map) {
            map = true;
        } else {
            map = false;
        }
        break;
    case 5:
        square = false;
        line = false;
        break;
    case 6:
        square = true;
        line = false;
        break;
    case 7:
        line = true;
        square = false;
        break;
    case 8:
        window.ShowProperties();
        break;
    case 9:
        window.ShowConfigure();
        break;
    case 10:
        artistold = "";
        request1 = false;
        request2 = true;
        request3 = false;
        request4 = false;
        request5 = false;
        request6 = false;
        map = false;
        set = 0;
        clear_arrays();
        get_request2();
        break;
    case 11:
        artistold = "";
        request1 = false;
        request2 = false;
        request3 = true;
        request4 = false;
        request5 = false;
        request6 = false;
        map = false;
        set = 0;
        clear_arrays();
        get_request3();
        break;
    case 12:
        artistold = "";
        request1 = false;
        request2 = false;
        request3 = false;
        request4 = true;
        request5 = false;
        request6 = false;
        map = false;
        set = 0;
        clear_arrays();
        get_request4();
        break;
    case 13:
        artistold = "";
        request1 = false;
        request2 = false;
        request3 = false;
        request4 = false;
        request5 = true;
        request6 = false;
        map = false;
        set = 0;
        clear_arrays();
        get_request5();
        break;
    case 14:
        artistold = "";
        request1 = false;
        request2 = false;
        request3 = false;
        request4 = false;
        request5 = false;
        request6 = true;
        map = false;
        if (venueid.length > 0) {
            venueidv = venueid[set];
            set = 0;
            clear_arrays();
            get_request6();
        }
        break;
    case 15:
        if (!auto) {
            auto = true;
        }
        else {
            auto = false;
        }
        break;
    case 16:
        artist = artistplaying;
        if (artistold !== artist) {
            artistold = artist;
            request1 = true;
            request2 = false;
            request3 = false;
            request4 = false;
            request5 = false;
            request6 = false;
            map = true;
            clear_arrays();
            set = 0;
            get_request1();
        }
    }
    _menu.Dispose();
    window.Repaint();
    return true;
}

function on_size() {
    ww = window.Width;
    wh = window.Height;
}

function on_colors_changed() {
    window.Repaint();
}

function on_font_changed() {
    window.Repaint();
}