Skip to main content

Topic: WSH Panel Mod script discussion/help (Read 839354 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • pupil
  • [*]
WSH Panel Mod script discussion/help
Reply #2200
i've updated my now playing script. you can now toggle various elements on or off via the context menu. because displaying an artist bio is now optional, i've ditched the separate script i had for that.

here are 2 instances running side by side: screenshot

https://dl.dropbox.com/u/22801321/samples.zip

files changed:
Code: [Select]
marc2003\common6.js
samples\now playing.txt
samples\now playing with last.fm & wikipedia biography <<deleted


Great scripts, really appreciate your work on these. Could you make the track info and rating elements separate? I'd like to display the track info but I don't use the rating stars and would like to remove these. I do it manually by editing the script already, but it would be easier if it was selectable in the menu. Many thanks.

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2201
the trouble with making the rating separate, is where to put it if people turn the track info off. i'll try and think of something.

  • pupil
  • [*]
WSH Panel Mod script discussion/help
Reply #2202
the trouble with making the rating separate, is where to put it if people turn the track info off. i'll try and think of something.


Thanks Marc, I think the ratings location won't be a problem, it would look fine where it is without the track info. If someone has got to the point where they are using your scripts, they would know what all of the separate elements do, I'm sure.

Thanks again.

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2203
it would look fine where it is without the track info.


it looks ok with CD cover off but not when it's on. it looks stupid sat next to it on it's own.

anyway, rather than make it independent, the script now checks for foo_playcount. if it's missing, the rating will not display.

https://dl.dropbox.com/u/22801321/samples.zip

files changed:
Code: [Select]
marc2003\common6.js
samples\now playing.txt


to make it easier for people to edit the track info display, i've put this at the top of the script.

Code: [Select]
var line1 = {text: "", tf: "%artist%", font: gdi.Font("Segoe UI", 30, 1), colour: RGB(240, 240, 240), y: 0}
var line2 = {text: "", tf: "%title%", font: gdi.Font("Segoe UI", 22, 1), colour: RGB(210, 210, 210), y: 0}
var line3 = {text: "", tf: "[[%album%] '('%date%')']", font: gdi.Font("Segoe UI", 18, 1), colour: RGB(180, 180, 180), y: 0}


leave the text empty. customise title formatting how you like. changing the font is easy too. it's simply font/size/style. the style set to 1 indicates bold text. other values:

Code: [Select]
    Regular: 0,
    Bold: 1,
    Italic: 2,
    BoldItalic: 3,
    Underline: 4,
    Strikeout: 8


colour is straight forward again and you can tweak the value of y. this is used to shift the vertical position from it's default. you might need to do this if changing font sizes.


  • Last Edit: 30 March, 2013, 03:44:35 PM by marc2003

  • pupil
  • [*]
WSH Panel Mod script discussion/help
Reply #2204
it would look fine where it is without the track info.


it looks ok with CD cover off but not when it's on. it looks stupid sat next to it on it's own.

anyway, rather than make it independent, the script now checks for foo_playcount. if it's missing, the rating will not display.


Hi thanks again. This work around wouldn't actually work for me as I do have foo_playcount installed so that I can record a files %added% data, but not for rating the tracks. So, for me, the rating stars will still appear even though I won't be using foo_playcount for that function. Any other way you can think to remove the stars where you'll be happy with the layout?

Really appreciate this, thanks.

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2205
edit line 36:

Code: [Select]
var np_rating_check = utils.CheckComponent("foo_playcount", true);


to become

Code: [Select]
var np_rating_check = false;

  • pupil
  • [*]
WSH Panel Mod script discussion/help
Reply #2206
edit line 36:

Code: [Select]
var np_rating_check = utils.CheckComponent("foo_playcount", true);


to become

Code: [Select]
var np_rating_check = false;


Brilliant, that's perfect, many thanks!

  • FooChick
  • [*]
WSH Panel Mod script discussion/help
Reply #2207
Hello Marc - I really love your scripts.
I would love to edit the width of the biography txt column. Something like this:



Thanx in advance
Natasha




  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2208
line 74 is

Code: [Select]
t.x = p.w - Math.round(p.w / 3);


that represents 1/3 of the panel width. you could try changing it to 4 for a quarter. or you can fix the size in pixels....

Code: [Select]
t.x = p.w - 200;

  • FooChick
  • [*]
WSH Panel Mod script discussion/help
Reply #2209
Marc, - line 74

Beautiful!
4 is fine, and 5 is nice for fullscreen (1920x1080)

Thank you Marc2003!

  • NEMO7538
  • [*][*][*][*][*]
  • Developer
WSH Panel Mod script discussion/help
Reply #2210
Thanks Marc for your nice work
I have tweaked () the NP script, see below (quick and dirty: larger albumart size + placed on top with track info + merged thumbs + large track info fonts)
Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_profile_path%marc2003\common6.js"
// @name "Now Playing"
// @author "marc2003"
// @version "6.2013-03-27.01"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==
var th = new thumbs();
//first argument is any arbitrary text to name the panel. it will use in the console and popup boxes.
//seconds argument is an array of features. i'll post a full list of acceptable/required values at some point. it's mostly for handling right click menus.
var p = new panel("Now Playing", ["remap", "cd", "images", "metadb", "thumbs"]);
//force the panel to always prefer the playing track regardless of selection
p.selection_mode = 1;
//setup a new cd cover: x, y co-ords and width & height
//var c = new cd(10, p.h - 190, 200, 200);
var c = new cd(0, -20, 360, 360);
//setup rating, x, y co-ords and button size
//var r = new rating(220, p.h - 35, 24);
//note that because some co-ords are relative to panel size (p.w is width, p.h is height), we need to update these values in the on_size function later

//setup images, x, y, width, height,
var im = new images(0, 0, p.w, p.h);
//setup buttons
/*
var b = new buttons();
b.buttons = {}
b.update = function() {
//only add web link buttons if we have a valid selection
if (p.metadb) {
var artist = encodeURIComponent(p.eval("%artist%"));
var title = encodeURIComponent(p.eval("%title%"));
var myspace = "http://www.myspace.com/search/music?q=" + artist;
var lastfm = "http://www.last.fm/music/" + artist + "/_/" + title;
var youtube = "http://www.youtube.com/results?search_query=" + artist + "+" + title;
var discogs = "http://www.discogs.com/search?q=" + artist;
var allmusic = "http://www.allmusic.com/search/artists/" + artist;
b.buttons = {
          
           but5: new button(p.w - 163, 0, 32, 32, {normal: "myspace.png", hover: "myspace_h.png"}, function() { p.browser(myspace); }, myspace),
but6: new button(p.w - 131, 0, 32, 32, {normal: "lastfm.png", hover: "lastfm_h.png"}, function() { p.browser(lastfm); }, lastfm),
but7: new button(p.w - 99, 0, 32, 32, {normal: "youtube.png", hover: "youtube_h.png"}, function() { p.browser(youtube); }, youtube),
but8: new button(p.w - 67, 0, 32, 32, {normal: "discogs.png", hover: "discogs_h.png"}, function() { p.browser(discogs); }, discogs),
but9: new button(p.w - 35, 0, 32, 32, {normal: "allmusic.png", hover: "allmusic_h.png"}, function() { p.browser(allmusic); }, allmusic)
   
      
       }
}
window.RepaintRect(0, 0, 160, 32);
}
*/
//setup 3 lines of text for the display. editing this should be self explanaotory. if you change the font sizes, adjustments may need
//to be made to the positions in the on_paint function
var line1 = {text: "", tf: "$if($strcmp($strstr(%artist%,','),0),%artist%,$cut(%artist%,$sub($strstr(%artist%,','),1)))", font: gdi.Font("Segoe UI", 48, 1), colour: RGB(250, 250, 250)}
var line2 = {text: "", tf: "%title%", font: gdi.Font("Segoe UI", 36, 1), colour: RGB(230, 230, 230)}
var line3 = {text: "", tf: "[[%album%] '('%date%')'] ['['# %tracknumber%']']", font: gdi.Font("Segoe UI", 28, 1), colour: RGB(190, 190, 190)}

//startup
on_item_focus_change();
//b.update();

function on_playback_time(time) {
//this function handles the cycling of images if enabled.
im.playback_time(time);
}

function on_size() {
  
//always call p.size to update the values of p.w and p.h
p.size();
//cd case y co-ord updated relative to bottom of panel
//c.y = p.h - 190;
//further updates to co-ords/sizes
//r.y = p.h - 35;
//im.w = p.w;
//im.h = p.h;
   //b.update();
   th.calc();
}

function on_paint(gr) {
//my own helper functions. note some things need to layered on top of each other.
//first draw the background. you'll only see this if there are no images to display
p.draw_background(gr);
//now we draw the background image as everything else goes on top
//im.images is an array of images. im.index is the current image. this value changes when scrolling the mouse or when cycling is enabled
//p.draw_image(gr, im.images[im.index], im.x, im.y, im.w, im.h, im.type);
if (im.images.length > 0) {
th.draw(gr);
if (th.mode == "grid") {
if (th.overlay) p.draw_image(gr, im.images[im.index], im.x, im.y, im.w, im.h, "centre");
} else {
p.draw_image(gr, im.images[im.index], im.x, im.y, im.w, im.h, im.type);
}
} else {
p.centre_text(gr, p.metadb ? "[no image]" : "[no selection]", p.normal_font, p.textcolour, 0, 0, p.w, p.h);
}
   //"crop" can also be "centre" or "stretch"
//this function also takes 2 additional arguments: border colour and alpha eg.
//a red border
//p.draw_image(gr, im.images[im.index], im.x, im.y, im.w, im.h, "crop", RGB(255, 0, 0));
//no border but alpha level of 128. values can be between 0 and 255
//p.draw_image(gr, im.images[im.index], im.x, im.y, im.w, im.h, "crop", null, 128);

   //draw the slightly transparent rectangle at bottom
gr.FillSolidRect(0, 35, p.w, 145, RGBA(0, 0, 0, 156));
//draw the cd cover
c.draw(gr);
//web link buttons
//b.draw(gr);
//draw the rating panel
//r.draw(gr);
//draw the text. the last 4 values are x,y,w,h
p.left_text(gr, line1.text, line1.font, line1.colour, 365, 45, p.w - 365, 40);
p.left_text(gr, line2.text, line2.font, line2.colour, 365, 95, p.w - 365, 32);
p.left_text(gr, line3.text, line3.font, line3.colour, 365, 145, p.w - 365, 20);
}

function on_metadb_changed() {
//call these functions when selection changes/tag updates are made
//buttons. links are based off artist/track metadata
//b.update();
//cd
c.metadb_changed();
//rating
//r.metadb_changed();
//images
im.metadb_changed();
//only update text if we have a valid selection
if (p.metadb) {
line1.text = p.eval(line1.tf);
line2.text = p.eval(line2.tf);
line3.text = p.eval(line3.tf);
}
window.Repaint();
}

//we need to update buttons whenever their state could be changed. as these are playback buttons, we need to call
//updates when this happens.

function on_playback_stop() {
on_item_focus_change();
//b.update();
}

function on_playback_pause() {
//b.update();
}

function on_playback_starting() {
//b.update();
}

function on_get_album_art_done(metadb, art_id, im, ip) {
//used by cd cover for updates
c.get_album_art_done(im, ip);
}

function on_mouse_wheel(step) {
   th.wheel(step);
//this scrolls through multiple images
im.wheel(step);
}

function on_mouse_move(x, y) {
//we only need to call p.move if there elements in our panel which require scrollling as i need to track where the mouse is. do not return after it.
p.move(x, y);
   th.move(x, y);
//if mouse detected over rating, no point in checking the rest
//if (r.move(x, y)) return;
//buttons -update tooltips
//if (b.move(x,y)) return;
//cd - tooltip
if (c.move(x, y)) return;
//note the order. because the buttons are on top of the cd, we need to check that first
}

function on_mouse_lbtn_up(x, y) {
//check for button clicks
//if (b.lbtn_up(x, y)) return;
//check for rating clicks
//if (r.lbtn_up(x, y)) return;
   th.lbtn_up(x, y);
}

function on_mouse_lbtn_dblclk(x, y) {
//double click to open images
//cd
if (c.lbtn_dblclk(x, y)) return;
//image
if (im.lbtn_dblclk(x, y)) return;
//again we need to check order because the image covers the whole panel so we need to return if the cd was double clicked first
}

So here are a few suggestions :
  • Option to put the album art  + track info on top (/bottom)
  • Option to right-justify the weblinks
  • Option to left-justify the bio (above/below album art)
  • Property to control the album art size (and adjust track info placement accordingly)
  • Merge thumbs (as I did), very nice effect when thumbs are right justified
  • Last Edit: 01 April, 2013, 05:01:56 AM by NEMO7538

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2211
i like what you've done. i'll have a go at implementing those things.

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2212
now playing updated: https://dl.dropbox.com/u/22801321/samples.zip

files changed:
Code: [Select]
marc2003\common6.js
samples\now playing.txt


changes:

new common file has broken compatibility with now playing dated the 30th march  people will have to update but older versions should still work because they don't have a context menus like these new ones.
implemented thumbs (off by default)
variable CD art size. just scroll your mouse wheel over it
top/bottom alignment for CD art/track info.
everything can be enabled/disabled from the context menu

a few example layouts here: screenshot

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2213
obviously i didn't test all combinations like i should have. there is a bug with top aligned thumbs and bottom aligned cd/track info.

updated: https://dl.dropbox.com/u/22801321/samples.zip

files changed:
Code: [Select]
samples\now playing.txt

  • Bratman
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #2214
Marc noticed a few bugs in your thumbs script. The cycle of 5 seconds works fine but 10 and 20 are not changing the picture. The crop code isn't working, it does nothing.

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2215
because the context menu is controlled by my common file, you must have updated that but not the script in the panel. i did mention it when i pushed that update a few days back....

and a reminder to anyone using thumbs or any now playing scripts and are finding the new crop/centre/stretch options have no effect. this means you need to download the latest zip and re-import the script.


i know i don't make it easy for people to keep a track of things. 

and cycle works fine for me. due to the way it's coded, if it works for one value, it has to work for others.

  • Bratman
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #2216
Sorry I'm always in a rush when I get time to go on here so overlooked/forgot it.

Actually I updated the script using update script in the context menu, I just pasted the new sample in from the samples zip and it's working now but I thought that's what the update script option does? So it's not actually updating I still need to paste in the updated sample zip?
  • Last Edit: 01 April, 2013, 05:58:58 PM by Bratman

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2217
Sorry I'm always in a rush when I get time to go on here so overlooked/forgot it.


like i said, it's really not your fault -rather it's mine. you can't really be expected to trawl the thread looking for every update. i'll have to try and manage updates better - i have a few ideas.

the vast majority of code is in the common file and updates work well for the most part. this problem occurred because your updated common file had all the code for handling the context menu in it. but the basic layout and positioning of the image happens in the panel. that's why it needed updating - it was hardcoded to crop images and it did not recognise the fact that there were new user settings it could use.

my goal when doing my last major update was not to update panel scripts but i have had to do it far more often than i'd like. i guess that's the price i pay for being an amateur bodger. i never plan anything in advance.
  • Last Edit: 01 April, 2013, 06:42:01 PM by marc2003

  • Bratman
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #2218
Lol well I don't mind keeping an eye on your samples, I guess I better bookmark the download link. Could you not put all the code into the common file that way updating the script will cover all of your new code changes? My apologies if that is a naive suggestion

Also it's a shame the code doesn't retain when importing .flc skins as I share my layout with friends and family who want to use your scripts too.
  • Last Edit: 01 April, 2013, 08:11:03 PM by Bratman

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2219
panel script settings do get properly saved as part of .fcl files. remember you'd have to share the entire marc2003 folder as well for it to work. (and the WSH panel mod component) back when i used to use columns UI, i shared a few themes with no problems at all.

you'll find most themes on deviant art have WSH panels as well.

putting all the code in external files is a nice idea but it doesn't really suit me at the moment. it's something i might think about looking at again. i dunno.
  • Last Edit: 01 April, 2013, 08:45:01 PM by marc2003

  • NEMO7538
  • [*][*][*][*][*]
  • Developer
WSH Panel Mod script discussion/help
Reply #2220
Marc .... I am tweaking the NP script and have this error sometimes ... when changing the rating
Code: [Select]
Error: WSH Panel Mod (Now Playing v6.2013-04-01.03 by marc2003): Erreur d'exécution Microsoft JScript:
Dépassement de capacité (Capacity overflow)
File: C:\Program Files (x86)\foobar 1.2\marc2003\common6.js
Ln: 1328, Col: 3
<source text only available at compile time>
  • Last Edit: 02 April, 2013, 11:33:21 AM by NEMO7538

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2221
reproduced here when using the top style - using bottom, it's fine. i have to say i'm completely stumped. that line is refers to this inside my CD drawing function.

Code: [Select]
window.RepaintRect(this.x, this.y, this.w, this.h);


you could replace it with a simple

Code: [Select]
window.Repaint();


to make it work for now. i'll try and find the cause and a proper solution.

EDIT: i'm finding even more unrelated bugs inside the now playing script now. it's been removed from my samples.zip to stop anyone else stumbling across it. 
  • Last Edit: 02 April, 2013, 12:06:18 PM by marc2003

  • NEMO7538
  • [*][*][*][*][*]
  • Developer
WSH Panel Mod script discussion/help
Reply #2222
Thanks .... it works now, and here is my tweaked script below. I only changed the placement of the rating and the web links.
(Please note the common6b.js at the beginning).
Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_profile_path%marc2003\common6b.js"
// @name "Now Playing"
// @author "marc2003"
// @version "6.2013-04-01.03"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==

var line1 = {text: "", tf: "$if($strcmp($strstr(%artist%,','),0),%artist%,$cut(%artist%,$sub($strstr(%artist%,','),1)))", font: gdi.Font("Segoe UI", 48, 1), colour: RGB(250, 250, 250), y: 0}
var line2 = {text: "", tf: "%title%", font: gdi.Font("Segoe UI", 36, 1), colour: RGB(230, 230, 230), y: 55}
var line3 = {text: "", tf: "[[%album%] '('%date%')']", font: gdi.Font("Segoe UI", 28, 1), colour: RGB(190, 190, 190), y: 100}

/*
leave the text empty. customise tf (title formatting) how you like. changing the font is easy too. it's simply font/size/style.
the style set to 1 indicates bold text. other values:

0: Regular
1: Bold
2: Italic
3: BoldItalic
4: Underline
8: Strikeout

colour is straight forward again and you can tweak the value of y. this is used to shift the vertical position from it's default.
you might need to do this if changing font sizes. negative numbers shift up and postive goes down.
*/

var p = new panel("Now Playing", ["custom_background", "now_playing", "lastfm_bio_mod", "remap"]);
p.selection_mode = 1;

var np_cd = window.GetProperty("np_cd", true);
var np_cd_size = window.GetProperty("np_cd_size", 200);
var np_track = window.GetProperty("np_track", true);
var np_track_top = window.GetProperty("np_track_top", false);
var np_buttons = window.GetProperty("np_buttons", true);
var np_bio = window.GetProperty("np_bio", true);
var np_cd_size = window.GetProperty("np_cd_size", 200);
var np_rating = window.GetProperty("np_rating", true);
window.GetProperty("thumbs_mode", "off");

var c = new cd(0, 0, np_cd_size, np_cd_size);
var r = new rating(0, 0, 24);
var t = new text(0, 0, 0, 0);
var im = new images(0, 0, 0, 0);
var th = new thumbs(0, 0 , 0, 0)
var b = new buttons();
var bar1y = 0;
var bar1h = 0;
var bar2y = 0;
var bar2h = 0;

b.buttons = {}
b.update = function() {
if (p.metadb) {
var artist = encodeURIComponent(p.eval("%artist%"));
var title = encodeURIComponent(p.eval("%title%"));
var myspace = "http://www.myspace.com/search/music?q=" + artist;
var lastfm = "http://www.last.fm/music/" + artist + "/_/" + title;
var youtube = "http://www.youtube.com/results?search_query=" + artist + "+" + title;
var discogs = "http://www.discogs.com/search?q=" + artist;
var allmusic = "http://www.allmusic.com/search/artists/" + artist;
b.buttons = {
           /*
but5: new button(im.x + im.w - 160, bar2y - 1, 32, 32, {normal: "myspace.png", hover: "myspace_h.png"}, function() { p.browser(myspace); }, myspace),
but6: new button(im.x + im.w - 128, bar2y - 1, 32, 32, {normal: "lastfm.png", hover: "lastfm_h.png"}, function() { p.browser(lastfm); }, lastfm),
but7: new button(im.x + im.w - 96, bar2y - 1, 32, 32, {normal: "youtube.png", hover: "youtube_h.png"}, function() { p.browser(youtube); }, youtube),
but8: new button(im.x + im.w - 64, bar2y - 1, 32, 32, {normal: "discogs.png", hover: "discogs_h.png"}, function() { p.browser(discogs); }, discogs),
but9: new button(im.x + im.w - 32, bar2y - 1, 32, 32, {normal: "allmusic.png", hover: "allmusic_h.png"}, function() { p.browser(allmusic); }, allmusic)
           */
          
           but5: new button(im.x + p.w - 160, np_track_top ? -1 : im.y + im.h - 33, 32, 32, {normal: "myspace.png", hover: "myspace_h.png"}, function() { p.browser(myspace); }, myspace),
but6: new button(im.x + p.w - 128, np_track_top ? -1 : im.y + im.h - 33, 32, 32, {normal: "lastfm.png", hover: "lastfm_h.png"}, function() { p.browser(lastfm); }, lastfm),
but7: new button(im.x + p.w - 96,  np_track_top ? -1 : im.y + im.h - 33, 32, 32, {normal: "youtube.png", hover: "youtube_h.png"}, function() { p.browser(youtube); }, youtube),
but8: new button(im.x + p.w - 64,  np_track_top ? -1 : im.y + im.h - 33, 32, 32, {normal: "discogs.png", hover: "discogs_h.png"}, function() { p.browser(discogs); }, discogs),
but9: new button(im.x + p.w - 32,  np_track_top ? -1 : im.y + im.h - 33, 32, 32, {normal: "allmusic.png", hover: "allmusic_h.png"}, function() { p.browser(allmusic); }, allmusic)
          
           /*
           but5: new button(p.w - 163, 0, 32, 32, {normal: "myspace.png", hover: "myspace_h.png"}, function() { p.browser(myspace); }, myspace),
           but6: new button(p.w - 131, 0, 32, 32, {normal: "lastfm.png", hover: "lastfm_h.png"}, function() { p.browser(lastfm); }, lastfm),
           but7: new button(p.w - 99, 0, 32, 32, {normal: "youtube.png", hover: "youtube_h.png"}, function() { p.browser(youtube); }, youtube),
           but8: new button(p.w - 67, 0, 32, 32, {normal: "discogs.png", hover: "discogs_h.png"}, function() { p.browser(discogs); }, discogs),
           but9: new button(p.w - 35, 0, 32, 32, {normal: "allmusic.png", hover: "allmusic_h.png"}, function() { p.browser(allmusic); }, allmusic)
           */
}
}
window.RepaintRect(0, 0, 160, 32);
}

on_item_focus_change();

function on_playback_time(time) {
im.playback_time(time);
}

function on_size() {
p.size();
th.calc();
c.x = im.x;
switch(true) {
case np_track_top:
c.y = im.y - (np_cd_size * 0.05);
           //bar1y = 0;
//bar1h = np_track ? 100 : 0;
           //bar2y = bar1h;
           bar1y = 35;
           bar1h = np_track ? 145 : 0;
bar2y = bar1h + bar1y;
//bar2h = np_buttons || np_rating ? 30 : 0;
           bar2h = 0;
//t.y = bar1h + bar2h;
           t.y = bar1y + bar1h + bar2h;
break;
default:
c.y = im.y + im.h - np_cd_size + (np_cd_size * 0.05);
           //bar1y = im.y + (np_rating || np_buttons ? im.h - 130 : im.h - 100);
bar1y = im.y +  im.h - 180;
bar1h = np_track ? 145 : 0;
bar2y = im.y + im.h - 30;
//bar2h = np_buttons || np_rating ? 30 : 0;
           bar2h = 0;
t.y = im.y;
break;
}
//r.y = bar2y + 3;
   r.y = bar1y + 10;
line1.ny = bar1y + line1.y;
line2.ny = bar1y + line2.y;
line3.ny = bar1y + line3.y;
t.x = im.x + im.w - Math.round(im.w / 3);
t.w = im.x + im.w - t.x - 15;
//t.h = im.h - bar1h - bar2h;
   t.h = im.h - bar1h - 35 - bar2h;
  
t.size();
b.update();
}

function on_paint(gr) {
p.draw_background(gr);
if (im.images.length > 0) {
th.draw(gr);
if (th.mode == "grid") {
if (th.overlay) p.draw_image(gr, im.images[im.index], im.x, im.y, im.w, im.h, "centre");
} else {
p.draw_image(gr, im.images[im.index], im.x, im.y, im.w, im.h, im.type);
}
}
tix = im.x + (np_cd ? np_cd_size : 10);
//r.x = tix;
   r.x = p.w - 130;
if (np_track) {
//gr.FillSolidRect(im.x, bar1y, im.w, bar1h, RGBA(0, 0, 0, 196));
       gr.FillSolidRect(im.x, bar1y, p.w, bar1h, RGBA(0, 0, 0, 156))
//p.left_text(gr, line1.text, line1.font, line1.colour, tix, line1.ny, im.w - tix - 10, line1.font.Height);
//p.left_text(gr, line2.text, line2.font, line2.colour, tix, line2.ny, im.w - tix - 10, line2.font.Height);
//p.left_text(gr, line3.text, line3.font, line3.colour, tix, line3.ny, im.w - tix - 10, line3.font.Height);
       p.left_text(gr, line1.text, line1.font, line1.colour, tix, line1.ny, np_rating ? p.w - tix - 140 : p.w - tix - 10, line1.font.Height);
p.left_text(gr, line2.text, line2.font, line2.colour, tix, line2.ny, p.w - tix - 10, line2.font.Height);
       p.left_text(gr, line3.text, line3.font, line3.colour, tix, line3.ny, p.w - tix - 10, line3.font.Height);
}
if (np_rating || np_buttons) gr.FillSolidRect(im.x, bar2y, im.w, bar2h, RGBA(0, 0, 0, 136));
if (np_cd) c.draw(gr);
if (np_rating) r.draw(gr);
if (np_buttons) b.draw(gr);
if (np_bio) {
       gr.FillSolidRect(t.x - 15, t.y, t.w + 30, t.h, RGBA(0, 0, 0, 156));
t.draw(gr, RGB(240, 240, 240));
}
}

function on_metadb_changed() {
b.update();
c.metadb_changed();
r.metadb_changed();
im.metadb_changed();
t.metadb_changed();
if (p.metadb) {
line1.text = p.eval(line1.tf);
line2.text = p.eval(line2.tf);
line3.text = p.eval(line3.tf);
}
window.Repaint();
}

function on_playback_stop() {
on_item_focus_change();
b.update();
}

function on_playback_pause() {
b.update();
}

function on_playback_starting() {
b.update();
}

function on_get_album_art_done(metadb, art_id, im, ip) {
c.get_album_art_done(im, ip);
}

function on_mouse_wheel(step) {
if (np_cd && c.trace(p.mx, p.my)) {
np_cd_size += step * 25;
if (np_cd_size < 200) np_cd_size = 200;
if (np_cd_size > 400) np_cd_size = 400;
window.SetProperty("np_cd_size", np_cd_size);
c.y = Math.round(np_track_top ? im.y - (np_cd_size * 0.05) : im.y + im.h - np_cd_size + (np_cd_size * 0.05));
c.w = np_cd_size;
c.h = np_cd_size;
window.Repaint();
return;
}
if (th.wheel(step)) return;
if (np_bio && t.wheel(step)) return;
im.wheel(step);
}

function on_mouse_move(x, y) {
p.move(x, y);
   if (np_rating && r.move(x, y)) return;
   if (np_buttons && b.move(x,y)) return;
if (th.move(x, y)) return;
if (np_bio && t.move(x, y)) return;
if (np_cd && c.move(x, y)) return;
}

function on_mouse_lbtn_up(x, y) {
   if (np_rating && r.lbtn_up(x, y)) return;
   if (np_buttons && b.lbtn_up(x, y)) return;
if (th.lbtn_up(x, y)) return;
if (np_bio && t.lbtn_up(x, y)) return;
}

function on_mouse_lbtn_dblclk(x, y) {
if (np_cd && c.lbtn_dblclk(x, y)) return;
if (im.lbtn_dblclk(x, y)) return;
}


  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #2223
samples updated: https://dl.dropbox.com/u/22801321/samples.zip

-major version bumpage meaning full marc2003 folder has be extracted again and all scripts imported again to take advantage of it. all old scripts will continue to work as normal as this does not affect them.
-a changelog which i promise to update 

Code: [Select]
02-04-2013

NEW: Can now check if scripts in panels are current after using "Update script". You will be prompted if they need updating.
NEW: Add "pattern" option to "Background" menu in some scripts such as "Now playing", "Thumbs" and "CD Jewel Case".
FIX: Lots of bugs squished in "Now playing".
CHG: Renamed lots of settings internally for consistency so you might find a few of them have been "forgotten". Just use the right click menu to set them again.
     All important data such as cached images, online feed data, saved autoplaylist queries and last.fm username are untouched.


-using Update script on previous versions now results in nothing happening. because i deleted the online copy, you will see a 404 error from dropbox in the console. i removed the file so you don't get the false impression it's up to date. that's what would happen if i left it there.

edit: and i'm off to a bad start already. found and fixed a few more bugs in now playing since i posted. starting to hate this script now
  • Last Edit: 02 April, 2013, 04:11:57 PM by marc2003

  • Dario
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #2224
Guys, can you please comment on the efficiency of using a shared *.js script and importing it everywhere instead of copy-pasting things (the ones which are needed, obviously).

I currently use these two panels:

http://pastebin.com/Nd81uR23 (used to display CUETools logs named either rip.txt, or rip (%discnumber%).txt for multi-disc albums)
http://pastebin.com/b9M83BxQ (used to display album art)

And I'm wondering if there are ways I could improve them. Huge thanks to marc2003 for the basics + inspiration.
  • Last Edit: 02 April, 2013, 05:41:22 PM by Dario