Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: WSH Panel Mod (Read 815113 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

WSH Panel Mod

Reply #775
Oh.. you can use that to set the playlist as well as see which is active.  Thanks, I had no idea.

WSH Panel Mod

Reply #776
WSH Panel 1.3.2 Beta 3 Uploaded:
Changelog delta:
Code: [Select]
- ADD: on_playlists_changed() callback.
- ADD: Properties fb.PlaylistCount, fb.ActivePlaylist and fb.PlayingPlaylist.
- ADD: Methods fb.GetPlaylistName(), fb.CreatePlaylist(), fb.RemovePlaylist(), fb.MovePlaylist() and fb.RenamePlaylist().
- ADD: Sample Themed Progress Bar.txt.
- FIX: Preserve current selection when panel get focus.


is there a way to get the list of all the playlists ? Method requested please

so we could code a selection playlist panel

WSH Panel Mod

Reply #777
^
fb.PlaylistCount
and
fb.GetPlaylistName(id)

WSH Panel Mod

Reply #778
@Falstaff,

I just coded a playlist selector dropdown menu.  The code for my menu:

Code: [Select]
function active_playlist_menu(x, y) {
      var MF_STRING = 0x00000000;
var _menu = window.CreatePopupMenu();
var idx;
menu_count = 0;
while(menu_count < fb.PlaylistCount) {
_menu.AppendMenuItem(MF_STRING, menu_count + 1, fb.GetPlaylistName(menu_count));
menu_count++;
}
idx = _menu.TrackPopupMenu(x, y);
if(idx > 0) fb.ActivePlaylist = idx - 1;
_menu.Dispose();
return true;
}

For the button, I display the current playlist using:

Code: [Select]
fb.GetPlaylistName(fb.ActivePlaylist);

WSH Panel Mod

Reply #779
WSH Panel Mod 1.3.2 Beta 4 Uploaded.

Changelog delta:
Code: [Select]
- ADD: IGdiGraphics.FillPolygon() and IGdiGraphics.DrawPolygon() methods.
- ADD: gdi.LoadImageAsync() method (#Interfaces.txt).
- ADD: on_load_image_done() callback (#Callbacks.txt).
- CHG: on_get_album_art_done() (#Callbacks.txt).
- CHG: Add few optional parameters to ThemeManager.DrawThemeBackground().


WSH Panel Mod

Reply #780
T.P Wang, I had a question which might not make much sense but I am really curious regarding it.
AFAIK the current wsh panel is using Jscript the same engine that is used in IE8 so wouldn't it be better to use another JavaScript engine like V8 in the component which is much faster?

WSH Panel Mod

Reply #781
- ADD: gdi.LoadImageAsync() method (#Interfaces.txt).

Wow, that will help me a lot speeding up my fullscreen configurations when using more images. Thank you so much for this incredibly useful component! Great work!

WSH Panel Mod

Reply #782
Quote
- CHG: on_get_album_art_done()


was removing image_path from this intentional?  i found it quite useful.


WSH Panel Mod

Reply #784
... n/m


WSH Panel Mod

Reply #786
WSH Panel 1.3.2 Beta 3 Uploaded:
Changelog delta:
Code: [Select]
- ADD: on_playlists_changed() callback.
- ADD: Properties fb.PlaylistCount, fb.ActivePlaylist and fb.PlayingPlaylist.
- ADD: Methods fb.GetPlaylistName(), fb.CreatePlaylist(), fb.RemovePlaylist(), fb.MovePlaylist() and fb.RenamePlaylist().
- ADD: Sample Themed Progress Bar.txt.
- FIX: Preserve current selection when panel get focus.


Any chance of adding support for DSP presets access and setting like playlists?

WSH Panel Mod

Reply #787
[!--sizeo:4--][span style=\"font-size:14pt;line-height:100%\"][!--/sizeo--]
Code: [Select]
function RGB(r, g, b) {
    return (0xff000000 | (r << 16) | (g << 8) | (b));
}

ButtonStates = {
    normal: 0,
    hover: 1,
    down: 2,
    hide: 3
}

var DT_TOP = 0x00000000;
var DT_CENTER = 0x00000001;
var DT_VCENTER = 0x00000004;
var DT_WORDBREAK = 0x00000010;
var DT_CALCRECT = 0x00000400;
var DT_NOPREFIX = 0x00000800;

normal =  RGB(120, 120, 120);
hover = RGB(220, 220, 0)
down = RGB(0, 0, 220)

ButtonStates = {
    normal: 0,
    hover: 1,
    down: 2,
    hide: 3
}
var text_color = {normal: normal, hover: hover, down: down}
var text_color_paused = {normal: hover, hover: hover, down: down}

var g_theme = window.CreateThemeManager("Toolbar");
var g_font = gdi.Font("Tahoma", 12);

function SimpleButton(x, y, w, h, text, text_color, fonClick, state) {
    this.state = state ? state : ButtonStates.normal;
    this.x = x;
    this.y = y;
    this.w = w;
    this.h = h;
    this.text = text;
    this.button_normal = text_color.normal;
    this.button_hover = text_color.hover;
    this.button_down = text_color.down;
    this.color = text_color.normal;
    this.fonClick = fonClick;
   
    this.containXY = function (x, y) {
        return (this.x <= x) && (x <= this.x + this.w) && (this.y <= y) && (y <= this.y + this.h);
    }
   
    this.changeState = function (state) {
        var old = this.state;
        this.state = state;
        return old;
    }

    this.draw = function (gr) {
        if (this.state == ButtonStates.hide) return;
       
        switch (this.state)
        {
        case ButtonStates.normal:
            g_theme.SetPartAndStateId(1,2);
            this.color = this.button_normal;
            break;
           
        case ButtonStates.hover:
            g_theme.SetPartAndStateId(1, 2);
            this.color = this.button_hover;
            break;
           
        case ButtonStates.down:
            g_theme.SetPartAndStateId(1, 3);
            this.color = this.button_down;
            break;
           
        case ButtonStates.hide:
            return;
        }

        g_theme.DrawThemeBackground(gr, this.x, this.y, this.w, this.h);
        gr.GdiDrawText(this.text, g_font, this.color, this.x, this.y, this.w, this.h, DT_CENTER| DT_VCENTER | DT_CALCRECT | DT_NOPREFIX);
    }

    this.onClick = function () {
        this.fonClick && this.fonClick();
    }
}

function drawAllButtons(gr) {
    for (var i in $buttons) {
        $buttons[i].draw(gr);
    }
}

function chooseButton(x, y) {
    for (var i in $buttons) {
        if ($buttons[i].containXY(x, y) && $buttons[i].state != ButtonStates.hide) return $buttons[i];
    }

    return null;
}

 function on_size()
{
ww = window.Width;
wh = window.Height;
   
    var x = ww/2-190;
    var y = wh/2-13;
    var w = 80;
    var h = 26;
    var d = 100;
   
$buttons = {
    Stop: new SimpleButton(  x, y, w, h, "STOP", text_color, function () { fb.Stop(); }  ),
    Prev: new SimpleButton(  x+d, y, w, h, "PREV", text_color, function () { fb.Prev(); }  ),
    Play: new SimpleButton(  x+d*2, y, w, h, (fb.IsPlaying&&!fb.IsPaused)?"PAUSE":"PLAY",(fb.IsPlaying&&!fb.IsPaused)? text_color_paused:text_color, function () { fb.PlayOrPause(); }  ),
    Next: new SimpleButton(  x+d*3, y, w, h, "NEXT", text_color, function () { fb.Next(); }  )
}
}

var cur_btn = null;
var g_down = false;

// --- APPLICATION START

function on_playback_pause(is_paused) {

    $buttons.Play.text=is_paused?"PLAY":"PAUSE";
    $buttons.Play.color=is_paused?text_color_paused:text_color;

window.Repaint();
}
function on_playback_stop() {
   
    $buttons.Play.text="PLAY";
    $buttons.Play.color=text_color;

window.Repaint();
}
function on_playback_starting(cmd, is_paused) {
  $buttons.Play.text=is_paused?"PLAY":"PAUSE";
  $buttons.Play.color=is_paused?text_color_paused:text_color;


window.Repaint();
}


function on_paint(gr) {
    gr.FillSolidRect(0, 0, ww, wh, RGB(22,32,41));
    drawAllButtons(gr);
}

function on_mouse_move(x, y) {
    var old = cur_btn;
    cur_btn = chooseButton(x, y);
   
    if (old == cur_btn) {
        if (g_down) return;
    } else if (g_down && cur_btn && cur_btn.state != ButtonStates.down) {
        cur_btn.changeState(ButtonStates.down);
        window.Repaint();
        return;
    }
       
    old && old.changeState(ButtonStates.normal);
    cur_btn && cur_btn.changeState(ButtonStates.hover);
    window.Repaint();
}

function on_mouse_leave() {
    g_down = false;
   
    if (cur_btn) {
        cur_btn.changeState(ButtonStates.normal);
        window.Repaint();
    }
}

function on_mouse_lbtn_down(x, y) {
    g_down = true;
   
    if (cur_btn) {
        cur_btn.changeState(ButtonStates.down);
        window.Repaint();
    }
}

function on_mouse_lbtn_up(x, y) {
    g_down = false;
   
    if (cur_btn) {
        cur_btn.onClick();
        cur_btn.changeState(ButtonStates.hover);
        window.Repaint();
    }
}

// --- APPLICATION END
[/size]

Hi it's me again crying for help! I created simple playback buttons Stop Prev Play/Pause Next using the included sample code "SimpleThemedButton"

The buttons works fine when i click play button the text changes to pause and vice versa, what i can't figure out is how to change text color to hover color when paused etc. The code works when you click pause and resize the window little bit then the color changes, so i think i'm almost there... can somebody please take a look at the code and point me to the right direction.

WSH Panel Mod

Reply #788
Reasonably new to this plugin so please excuse ignorance!

I'm having delay problems with ssenna's biography plugin. When I want it to make %lastfm_bio% available I get a delay between tracks - ssenna could not solve it.

So I have seen some great alternatives here but no mention of making variables available to title formatting ie. %xxxx% variables.

Is this possible, if so how?

Thanks.

WSH Panel Mod

Reply #789
@marc2003:
Well, It will be restored in the next release. 


@ExtremeHunter:
Quick and dirty hack:
Change (2 occurrences)
Code: [Select]
$buttons.Play.color=is_paused?text_color_paused:text_color;

to
Code: [Select]
$buttons.Play.button_normal = is_paused ? normal : hover;




 

WSH Panel Mod

Reply #790
The buttons works fine when i click play button the text changes to pause and vice versa, what i can't figure out is how to change text color to hover color when paused etc. The code works when you click pause and resize the window little bit then the color changes, so i think i'm almost there... can somebody please take a look at the code and point me to the right direction.

You do all you want in on_size();
change:
Code: [Select]
function on_playback_pause() {
on_size();
}
function on_playback_stop() {
on_size();
}
function on_playback_starting() {
on_size();
}

WSH Panel Mod

Reply #791
@marc2003:
Well, It will be restored in the next release. 


thank you. i'd recently added a feature to an artwork panel where double clicking it would open the image in the default image viewer. and of course, i need the path to do this.


WSH Panel Mod

Reply #793
Does anyone know if there is a way I can call the window that appears in Properties > Lyrics > Edit directly?

WSH Panel Mod

Reply #794
WSH Panel Mod 1.3.2 Released

Changelog
Code: [Select]
- ADD: on_key_up() callback.
- ADD: on_char() callback.
- ADD: on_selection_changed() callback.
- ADD: fb.GetSelection() and fb.GetSelectionType() methods.
- ADD: IFbMetadbHandle.Compare() method.
- ADD: window.DlgCode property.
- ADD: on_playlists_changed() callback.
- ADD: IGdiGraphics.FillPolygon() and IGdiGraphics.DrawPolygon() methods.
- ADD: Properties fb.PlaylistCount, fb.ActivePlaylist and fb.PlayingPlaylist.
- ADD: Methods fb.GetPlaylistName(), fb.CreatePlaylist(), fb.RemovePlaylist(), fb.MovePlaylist() and fb.RenamePlaylist().
- ADD: Sample "Themed Seek Bar.txt".
- ADD: gdi.LoadImageAsync() method (#Interfaces.txt).
- ADD: on_load_image_done() callback (#Callbacks.txt).
- CHG: New modes for utils.FileTest()
- CHG: window.NotifyOthers() is changed back to synchronous (since 1.2.1).
- CHG: Add few optional parameters to ThemeManager.DrawThemeBackground().
- FIX: Workaround for FillGradRect() which may draw a black line.
- FIX: Script won't be updated in DUI after importing theme.
- FIX: Rare crash caused by timers.

WSH Panel Mod

Reply #795
You do all you want in on_size();
change:
Code: [Select]
function on_playback_pause() {
on_size();
}
function on_playback_stop() {
on_size();
}
function on_playback_starting() {
on_size();
}



Thanks Andre69. I somehow missed your reply earlier, but your example solved my problem even easier. 


WSH Panel Mod

Reply #797
- ADD: fb.GetSelection() and fb.GetSelectionType() methods.

I can't call the properties dialog (as example) for selected tracks. Dialog is displayed only for the first of the selected tracks.

Code: [Select]
function SomeFunc() {
  var selection = fb.GetSelection();
  if (selection) {
    fb.trace (fb.GetSelectionType());
    fb.RunContextCommandWithMetadb("Properties",selection);
  } else {
    fb.trace ("nothing selected");  
  }
}

What's wrong? I need to display the properties of all selected tracks.
Thanks!

WSH Panel Mod

Reply #798
unfortunately, fb.GetSelection doesn't mean what you think it does. it doesn't get a selection of tracks. WSH panel mod can only deal with one item at a time.

fb.GetSelection relates to the preference set under file>preferences>display>selection viewers.

WSH Panel Mod

Reply #799
I am trying to access menus from foo_lastfm_radio.SOmething like
"File/Open Last.fm Radio Station/Open a custom station..."
But it doesnt seem to work. DOes anyone sees a reason for that?

THanks