Are you joking? What are you on about? Changing colours is amazingly cheap. Not a single bit of text is changing so what are you blithering on about regarding row/playlist item init? The mind boggles. :/
Haha, I should be more precise, this is not regarding the original CatRox theme, but my theme =).
I have implemented an additional mouse row hover effect plus checking if background is bright/dark:
// Playlist row hover
this.title_color = g_pl_colors.title_normal;
/** @enum {number} */
var rowState = {
normal: 0,
hovered: 1,
pressed: 2
};
//private:
var that = this;
/**
* @param {rowState} item
*/
this.changeRowState = function(item) {
switch (item) {
case rowState.normal: {
that.title_color = g_pl_colors.title_normal;
break;
}
case rowState.hovered: {
that.title_color = g_pl_colors.title_hovered;
break;
}
case rowState.pressed: {
that.title_color = g_pl_colors.title_selected;
break;
}
}
window.RepaintRect(playlist.x - 1, playlist.y, playlist.w + 1, playlist.h);
}
this.trace = function (x, y) {
return x >= this.x && x < this.x + this.w && y >= this.y && y < this.y + this.h;
};
this.on_mouse_move = function (x, y, m) {
this.changeRowState(this.trace(x, y) ? rowState.hovered : rowState.normal);
};
then I have on_mouse_move() calling changeRowState
var item = this.get_item_under_mouse(x, y);
if (item instanceof Row) {
if (pref.show_tt || pref.show_truncatedText_tt) {
item.title_truncatedText_tt(x, y);
}
if (pref.playlistRowHover) {
try { // Prevent crash when playlist rows are not fully initialized
item.on_mouse_move(x, y, m);
} catch (e) {};
}
}
and on draw(gr):
draw(gr) {
if (pref.playlistRowHover) {
if (needs_rows_repaint) {
repaintPlaylistRows();
needs_rows_repaint = false;
}
} else {
this.title_color = g_pl_colors.title_normal;
}
gr.DrawString(this.title_text, title_font, this.title_color, cur_x, this.y, title_w, this.h, title_text_format);
this.title_color = g_pl_colors.title_normal;
The title_color also changes like mentioned when bg is bright/dark, it's all working on current visible window.Height but I still have ugly title_color repaints when scrolling ( at top/bottom ), because the title_color is one repaint behind ( the not yet visible ( hidden ) rows ).
When calling initialize_rows(playlist_items) I can change title_color in all hidden item rows, but this is not the way.
Well it's not that bad, but sometimes white or black title_color repaints will be visible on different background colors...