I have found a way for that, thanks
Eh?
Meaning you found a solution and then signed a NDA with yourself?
Edit: Typo
sorry I don't understand what you mean
doing it top/down is easy enough. but i was thinking it would look better with 1 star at the bottom and working upwards towards 5. that would have required a bit more effort. which way did you do it?
from top to bottom, it's more suitable on my skin.
Since I also use the default horizontal layout, I copy the code from common7.js file, paste it to WSH Panel then edit it.
// ==PREPROCESSOR==
// @import "%fb2k_path%skins\tests\Scripts\common7.js"
// @name "Rating"
// @author "marc2003"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==
function rating(x, y, bs) {
this.draw = function(gr) {
if (!p.metadb) return;
for (i = 1; i < 6; i++) {
this.img = i > (this.hover ? this.lrating : this.rating) ? this.off_img : this.on_img;
p.draw_image(gr, this.img, this.x, this.y + this.bs * (i - 1), this.bs, this.bs, "centre");
}
}
this.metadb_changed = function() {
if (!p.metadb) return false;
this.hover = false;
this.rating = p.eval("$if2(%rating%,0)");
this.tiptext = p.eval(this.tiptext_tf);
this.lrating = this.rating;
window.RepaintRect(this.x, this.y, this.bs, this.w);
return true;
}
this.trace = function(x, y) {
return x > this.x && x < this.x + this.bs && y < this.y + (this.bs * 5) && y > this.y;
}
this.move = function(x, y) {
if (!this.trace(x, y)) {
if (this.hover) this.leave();
return false;
}
if (p.metadb) {
if (y > this.y) p.tt(this.tiptext);
this.hover = true;
this.lrating = Math.ceil((y - this.y) / this.bs);
window.RepaintRect(this.x, this.y, this.bs, this.w);
}
return true;
}
this.lbtn_up = function(x, y) {
if (!this.trace(x, y)) return false;
if (this.check) {
if (this.lrating != this.rating && this.hover == 1) fb.RunContextCommandWithMetadb("Rating/" + (this.lrating == 0 ? "<not set>" : this.lrating), p.metadb, 8);
} else {
p.MsgBox(this.error_text, 0, p.name);
p.browser("http://www.foobar2000.org/components/view/foo_playcount");
}
return true;
}
this.leave = function() {
p.ttd();
this.hover = false;
window.RepaintRect(this.x, this.y, this.bs, this.w);
}
this.x = x;
this.y = y;
this.bs = bs;
this.w = this.bs * 5;
this.hover = false;
this.rating = null;
this.lrating = null;
this.img = null;
this.off_img = gdi.Image(p.images_path + "off.png");
this.on_img = gdi.Image(p.images_path + "on.png");
this.check = utils.CheckComponent("foo_playcount", true);
this.error_text = "This script requires foo_playcount.";
this.tiptext_tf = this.check ? 'Rate "%title%" by "%artist%"' : this.error_text;
}
var p = new panel("Rating", ["custom_background", "metadb"]);
p.version = "7.2013-04-02.01";
p.filename = "rating.txt";
var r = new rating(0, 0, 18);
p.check_version();
on_item_focus_change();
function on_size() {
p.size();
r.x = Math.round((p.w - r.w) / 52);
r.y = Math.round((p.h - r.bs) / 5);
}
function on_paint(gr) {
p.draw_background(gr);
r.draw(gr);
}
function on_metadb_changed() {
r.metadb_changed();
}
function on_mouse_move(x, y) {
r.move(x, y);
}
function on_mouse_lbtn_up(x, y) {
r.lbtn_up(x, y);
}
I need a smaller panel, so I resized it too.