Skip to content

Commit

Permalink
v.1.1.2 - Bug Fixes and date handling
Browse files Browse the repository at this point in the history
  • Loading branch information
kbuffington committed Aug 28, 2019
1 parent 8c8799e commit 83e6c96
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 67 deletions.
1 change: 1 addition & 0 deletions js/CaTRoX_QWR/Control_Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ Button.prototype.onClick = function () {
fb.RunMainMenuCommand("Playback/Random");
break;
case 'Reload':
art_cache.clear();
window.Reload();
break;
case 'Console':
Expand Down
10 changes: 5 additions & 5 deletions js/CaTRoX_QWR/Panel_Info.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ var g_has_modded_jscript = qwr_utils.has_modded_jscript();
g_properties.track_mode = Math.max(1, Math.min(3, g_properties.track_mode));

if (g_properties.first_launch) {
g_properties.scrollbar_top_pad = 3;
g_properties.list_left_pad = 4;
g_properties.list_top_pad = 4;
g_properties.list_right_pad = 4;
g_properties.list_bottom_pad = 4;
g_properties.scrollbar_top_pad = 0;
g_properties.list_left_pad = 0;
g_properties.list_top_pad = 0;
g_properties.list_right_pad = 0;
g_properties.list_bottom_pad = 15;

g_properties.first_launch = false;
}
Expand Down
8 changes: 4 additions & 4 deletions js/CaTRoX_QWR/Panel_Library.js
Original file line number Diff line number Diff line change
Expand Up @@ -776,11 +776,11 @@ function panel_operations() {
var view_ppt = [
window.GetProperty(prefix + "View 01: Name // Pattern", "View by Artist // %artist%|%album%|[[%discnumber%.]%tracknumber%. ][%track artist% - ]%title%"),
window.GetProperty(prefix + "View 02: Name // Pattern", "View by Album Artist // %album artist%|%album%|[[%discnumber%.]%tracknumber%. ][%track artist% - ]%title%"),
window.GetProperty(prefix + "View 03: Name // Pattern", "View by Album Artist ordered by Date // %album artist%|[$year($if2(%originaldate%,%date%)) - ]%album%|[[%discnumber%.]%tracknumber%. ][%track artist% - ]%title%"),
window.GetProperty(prefix + "View 04: Name // Pattern", "View by Album Artist - Album // [%album artist% - ][$year($if2(%originaldate%,%date%)) - ]%album%|[[%discnumber%.]%tracknumber%. ][%track artist% - ]%title%"),
window.GetProperty(prefix + "View 03: Name // Pattern", "View by Album Artist ordered by Date // %album artist%|[$year($if3(%original release date%,%originaldate%,%date%)) - ]%album%|[[%discnumber%.]%tracknumber%. ][%track artist% - ]%title%"),
window.GetProperty(prefix + "View 04: Name // Pattern", "View by Album Artist - Album // [%album artist% - ][$year($if3(%original release date%,%originaldate%,%date%)) - ]%album%|[[%discnumber%.]%tracknumber%. ][%track artist% - ]%title%"),
window.GetProperty(prefix + "View 05: Name // Pattern", "View by Album // %album%[ '['%album artist%']']|[[%discnumber%.]%tracknumber%. ][%track artist% - ]%title%"),
window.GetProperty(prefix + "View 06: Name // Pattern", "View by Genre // %<genre>%|[%album artist% - ]%album%|[[%discnumber%.]%tracknumber%. ][%track artist% - ]%title%"),
window.GetProperty(prefix + "View 07: Name // Pattern", "View by Year // $year($if2(%originaldate%,%date%))|[%album artist% - ]%album%|[[%discnumber%.]%tracknumber%. ][%track artist% - ]%title%")
window.GetProperty(prefix + "View 07: Name // Pattern", "View by Year // $year($if3(%original release date%,%originaldate%,%date%))|[%album artist% - ]%album%|[[%discnumber%.]%tracknumber%. ][%track artist% - ]%title%")
];
var nm = "",
ppt_l = view_ppt.length + 1;
Expand Down Expand Up @@ -3141,4 +3141,4 @@ window.SetProperty(" Node: Show All Music", null);
window.SetProperty(" Playlist: Play On Send From Menu", null);
window.SetProperty(" Text Single-Click: AutoFill Playlist", null);
window.SetProperty("ADV.Height Auto [Expand/Collapse With All Music]", null);
window.SetProperty("SYSTEM.Zoom Update", true);
window.SetProperty("SYSTEM.Zoom Update", true);
34 changes: 13 additions & 21 deletions js/CaTRoX_QWR/Panel_Playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,12 @@ function rescalePlaylist() {
return; // don't redo fonts
}
createPlaylistFonts();
playlist_geo.row_h = is_4k ? g_properties.row_h * 2 : g_properties.row_h;
playlist_geo.scrollbar_w = is_4k ? g_properties.scrollbar_w * 2 : g_properties.scrollbar_w;
playlist_geo.scrollbar_right_pad = is_4k ? g_properties.scrollbar_right_pad * 2 : g_properties.scrollbar_right_pad;
playlist_geo.scrollbar_top_pad = is_4k ? g_properties.scrollbar_top_pad * 2 : g_properties.scrollbar_top_pad;
playlist_geo.scrollbar_bottom_pad = is_4k ? g_properties.scrollbar_bottom_pad * 2 : g_properties.scrollbar_bottom_pad;
playlist_geo.list_bottom_pad = is_4k ? g_properties.list_bottom_pad * 2 : g_properties.list_bottom_pad;
}

var g_pl_colors = {};
Expand Down Expand Up @@ -724,8 +726,7 @@ function Playlist(x, y) {
}, that);

// Hide rows that shouldn't be visible
gr.FillSolidRect(this.x, this.y, this.w, this.list_y - this.y, g_pl_colors.background);
gr.FillSolidRect(this.x, this.list_y + this.list_h, this.w, (this.y + this.h) - (this.list_y + this.list_h), g_pl_colors.background);
gr.FillSolidRect(this.x-1, this.y + this.h, this.w+1, g_properties.row_h * 2, col.bg);
}
else {
var text;
Expand All @@ -740,12 +741,12 @@ function Playlist(x, y) {
}

if (this.is_scrollbar_available) {
var gradiantHeight = is_4k ? 20 : 10;
var gradiantHeight = Math.ceil(playlist_geo.row_h * 2 / 3);
if (!this.scrollbar.is_scrolled_up) {
gr.FillGradRect(this.list_x, this.list_y - 1, this.list_w, gradiantHeight, 270, _.RGBtoRGBA(g_theme.colors.panel_back, 0), _.RGBtoRGBA(g_theme.colors.panel_back, 200));
gr.FillGradRect(this.x, this.list_y - 1, this.list_w, gradiantHeight, 270, _.RGBtoRGBA(g_theme.colors.panel_back, 0), _.RGBtoRGBA(g_theme.colors.panel_back, 200));
}
if (!this.scrollbar.is_scrolled_down) {
gr.FillGradRect(this.list_x, this.list_y + this.list_h - (gradiantHeight - 1), this.list_w, gradiantHeight, 90, _.RGBtoRGBA(g_theme.colors.panel_back, 0), _.RGBtoRGBA(g_theme.colors.panel_back, 200));
gr.FillGradRect(this.x, this.y + this.h - gradiantHeight, this.w, gradiantHeight, 90, _.RGBtoRGBA(g_theme.colors.panel_back, 0), _.RGBtoRGBA(g_theme.colors.panel_back, 255));
}
}

Expand Down Expand Up @@ -2869,7 +2870,7 @@ PlaylistContent = function () {
return 0;
}

var row_h = is_4k ? g_properties.row_h * 2 : g_properties.row_h;
var row_h = playlist_geo.row_h;
var total_height_in_rows = Math.round(_.head(this.sub_items).h / row_h) * this.sub_items.length;
_.forEach(this.sub_items, function (item) {
if (!item.is_collapsed) {
Expand Down Expand Up @@ -2966,7 +2967,7 @@ PlaylistContent = function () {
function iterate_level(sub_items, start_item) {
var is_cur_level_header = _.isInstanceOf(_.head(sub_items), BaseHeader);
var start_item_used = !start_item;

var leveled_start_item = start_item;
while (leveled_start_item && leveled_start_item.parent !== _.head(sub_items).parent) {
leveled_start_item = leveled_start_item.parent;
Expand Down Expand Up @@ -3337,7 +3338,7 @@ BaseHeader.prototype.get_sub_items_total_h_in_rows = function () {
return this.sub_items.length;
}

var row_h = is_4k ? g_properties.row_h * 2 : g_properties.row_h;
var row_h = playlist_geo.row_h;
var h_in_rows = Math.round(_.head(this.sub_items).h / row_h) * this.sub_items.length;
_.forEach(this.sub_items, function (item) {
if (!item.is_collapsed) {
Expand Down Expand Up @@ -3648,8 +3649,7 @@ function Header(parent, x, y, w, h, idx) {
* @return {Array<DiscHeader>}
*/
function create_cd_headers(prepared_rows, rows_to_proccess_count) {
var row_h = is_4k ? g_properties.row_h * 2 : g_properties.row_h;
return DiscHeader.create_headers(that, that.x, 0, that.w, row_h, prepared_rows, rows_to_proccess_count);
return DiscHeader.create_headers(that, that.x, 0, that.w, playlist_geo.row_h, prepared_rows, rows_to_proccess_count);
}

/** @override */
Expand Down Expand Up @@ -3806,11 +3806,7 @@ function Header(parent, x, y, w, h, idx) {

//---> DATE
if (grouping_handler.show_date()) {
var date_query = '[%date%]';
if (g_properties.show_original_date) {
date_query += '[ \'(\'%original release date%\')\']';
}
date_query = '$year($if2(%original release date%,%date%))'; // Mordred: my date query
var date_query = '[$year($if3(%original release date%,%originaldate%,%date%))]'; // Mordred: my date query

var date_text = _.tf(date_query, metadb);
if (date_text) {
Expand Down Expand Up @@ -4088,10 +4084,7 @@ function Header(parent, x, y, w, h, idx) {

//---> DATE
if (grouping_handler.show_date()) {
var date_query = '[%date%]';
if (g_properties.show_original_date) {
date_query += '[ \'(\'%original release date%\')\']';
}
var date_query = tf.year;

var date_text = _.tf(date_query, metadb);
if (date_text) {
Expand Down Expand Up @@ -4196,7 +4189,7 @@ function Header(parent, x, y, w, h, idx) {
var date_font = g_pl_fonts.date;
var artist_font = g_pl_fonts.artist_normal;

date_query = '$year($if2(%original release date%,%date%))'; // Mordred: my date query
date_query = tf.year; // Mordred: my date query

var date_text = _.tf(date_query, metadb);
if (date_text) {
Expand Down Expand Up @@ -4422,7 +4415,6 @@ function Row(x, y, w, h, metadb, idx, cur_playlist_idx_arg) {
var title_font = g_pl_fonts.title_normal;
var title_color = g_pl_colors.title_normal;
var count_color = g_pl_colors.count_normal;
var row_color_focus = g_pl_colors.row_focus_normal;
var title_artist_font = g_pl_fonts.title_selected;
var title_artist_color = g_pl_colors.title_selected;

Expand Down
48 changes: 25 additions & 23 deletions js/georgia-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ var bandLogoHQ = false; // if true will partially remove the 10 pixel "gutter" a
var t_interval; // milliseconds between screen updates
// var settingsY = 0; // location of settings button
var lastLeftEdge = 0; // the left edge of the record labels. Saved so we don't have to recalculate every on every on_paint unless size has changed
var displayPlaylist = false; //pref.start_Playlist;
var displayPlaylist = false;
var displayLibrary = false;
var displayLyrics = false;
var showLibraryButton = true; // TODO: Remove once library goes live
Expand Down Expand Up @@ -941,6 +941,27 @@ function on_paint(gr) {
gr.DrawString(str.original_artist, ft_lower_orig_artist, col.now_playing, pbLeft + trackNumWidth + titleMeasurements.Width + h_spacing, lowerBarTop + v_spacing, 0.95 * ww - width, titleMeasurements.Height, StringFormat(0, 0, 4, 0x00001000));
}

// Playlist/Library
if (displayPlaylist) {
showExtraDrawTiming && (drawPlaylist = fb.CreateProfiler('on_paint -> playlist'));
if (!pref.darkMode) {
if (!playlist_shadow) {
playlist_shadow = createShadowRect(playlist.w + 2 * geo.aa_shadow, playlist.h); // extend shadow past edge
}
gr.DrawImage(playlist_shadow, playlist.x - geo.aa_shadow, playlist.y - geo.aa_shadow, playlist.w + 2 * geo.aa_shadow, playlist.h + 2 * geo.aa_shadow,
0, 0, playlist_shadow.width, playlist_shadow.height);
} else {
gr.DrawRect(playlist.x - 1, playlist.y - 1, playlist.w + 2, playlist.h + 2, 1, rgb(64,64,64));
}
playlist.on_paint(gr);
showExtraDrawTiming && drawPlaylist.Print();
} else if (displayLibrary) {
libraryPanel.on_paint(gr);
if (pref.darkMode) {
gr.DrawRect(libraryPanel.x - 1, libraryPanel.y - 1, libraryPanel.w + 2, libraryPanel.h + 2, 1, rgb(64,64,64));
}
}

// Progress bar/Seekbar
var pbTop = Math.round(lowerBarTop + titleMeasurements.Height) + (is_4k ? 16 : 8);
gr.SetSmoothingMode(SmoothingMode.None); // disable smoothing
Expand Down Expand Up @@ -996,25 +1017,6 @@ function on_paint(gr) {
}
gr.SetSmoothingMode(SmoothingMode.AntiAlias);

if (displayPlaylist) {
showExtraDrawTiming && (drawPlaylist = fb.CreateProfiler('on_paint -> playlist'));
if (!pref.darkMode) {
if (!playlist_shadow) {
playlist_shadow = createShadowRect(playlist.w + 2 * geo.aa_shadow, playlist.h); // extend shadow past edge
}
gr.DrawImage(playlist_shadow, playlist.x - geo.aa_shadow, playlist.y - geo.aa_shadow, playlist.w + 2 * geo.aa_shadow, playlist.h + 2 * geo.aa_shadow,
0, 0, playlist_shadow.width, playlist_shadow.height);
} else {
gr.DrawRect(playlist.x - 1, playlist.y - 1, playlist.w + 2, playlist.h + 2, 1, rgb(64,64,64));
}
playlist.on_paint(gr);
showExtraDrawTiming && drawPlaylist.Print();
} else if (displayLibrary) {
libraryPanel.on_paint(gr);
if (pref.darkMode) {
gr.DrawRect(libraryPanel.x - 1, libraryPanel.y - 1, libraryPanel.w + 2, libraryPanel.h + 2, 1, rgb(64,64,64));
}
}

if (showDrawTiming) {
drawStuff.Print();
Expand Down Expand Up @@ -1566,7 +1568,6 @@ function on_size() {
ww = window.Width;
wh = window.Height;
console.log('width: ' + ww + ', height: ' + wh);
var count = 0;

if (ww <= 0 || wh <= 0) return;

Expand Down Expand Up @@ -1758,7 +1759,7 @@ function on_metadb_changed(handle_list, fromhook) {
str.title_lower = ' ' + title;
str.original_artist = original_artist;
str.artist = artist;
str.year = $('$year($if2(%original release date%,%date%)))');
str.year = $(tf.year);
str.album = $("[%album%][ '['" + tf.album_trans + "']']");
str.album_subtitle = $("[ '['" + tf.album_subtitle + "']']");
var codec = $("$lower($if2(%codec%,$ext(%path%)))");
Expand Down Expand Up @@ -2658,7 +2659,8 @@ function ResizeArtwork(resetCDPosition) {
var hasArtwork = false;
if (albumart && albumart.Width && albumart.Height) {
// Size for big albumart
var album_scale = Math.min(((displayPlaylist || displayLibrary) ? 0.47 * ww : 0.75 * ww) / albumart.Width, (wh - geo.top_art_spacing - geo.lower_bar_h - 32) / albumart.Height);
var album_scale = Math.min(((displayPlaylist || displayLibrary) ? 0.47 * ww : 0.75 * ww) / albumart.Width,
(wh - geo.top_art_spacing - geo.lower_bar_h - 32) / albumart.Height);
if (displayPlaylist || displayLibrary) {
xCenter = 0.25 * ww;
} else if (ww / wh < 1.40) { // when using a roughly 4:3 display the album art crowds, so move it slightly off center
Expand Down
13 changes: 9 additions & 4 deletions js/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var globals = PanelProperties.get_instance();
var pref = PanelProperties.get_instance(); // preferences
var tf = PanelProperties.get_instance(); // titleformating strings

var currentVersion = '1.1.1';
var currentVersion = '1.1.2';

globals.add_properties({
version: ['_theme_version (do not hand edit!)', 'NONE']
Expand Down Expand Up @@ -62,8 +62,8 @@ tf.add_properties({
artist_country: ['Tag Fields: Country', '%artistcountry%'], // we call meta_num(artistcountry) so don't wrap this in % signs
disc: ['Tag Fields: Disc String', '$ifgreater(%totaldiscs%,1,CD %discnumber%/%totaldiscs%,)'],
disc_subtitle: ['Tag Fields: Disc Subtitle', '%discsubtitle%'],
year: ['Tag Fields: Year', '$puts(d,$if2(%original release date%,%date%))$if($strcmp($year($get(d)),$get(d)),$get(d),)'],
date: ['Tag Fields: Date', '$puts(d,$if2(%original release date%,%date%))$if($strcmp($year($get(d)),$get(d)),,$get(d))'],
year: ['Tag Fields: Year', '$puts(d,$if2(%original release date%,%originaldate%,%date%))$if($strcmp($year($get(d)),$get(d)),$get(d),)'],
date: ['Tag Fields: Date', '$puts(d,$if2(%original release date%,%originaldate%,%date%))$if($strcmp($year($get(d)),$get(d)),,$get(d))'],
last_played: ['Tag Fields: Last Played', '[$if2(%last_played_enhanced%,%last_played%)]'],
title: ['Tag Fields: Song Title String', "%title%[ '['%translation%']']"],
vinyl_side: ['Tag Fields: Vinyl Side', '%vinyl side%'], // the tag used for determining what side a song appears on for vinyl releases - i.e. song A1 has a %vinyl side% of "A"
Expand Down Expand Up @@ -198,10 +198,15 @@ function versionCheck(version, storedVersion) {
window.SetProperty('SYSTEM.Font Size', null);
window.SetProperty('user.row.height', null);

case '1.1.1':
tf.edition = null;

// after all previous versions have fallen through
console.log('Upgrading Georgia Theme settings');
globals.version = currentVersion;
globals.version = currentVersion;
window.Reload();
default:
globals.version = currentVersion;
break;

}
Expand Down
22 changes: 16 additions & 6 deletions js/image-caching.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@ function ArtCache(maxCacheSize) {
var art_cache_max_size = maxCacheSize;
var art_cache = {};
var art_cache_indexes = [];
var max_width = 1200;
var max_height = 1600;
var max_width = 1440;
var max_height = 872;

this.encache = function(img, path) {
try {
var h = img.Height;
var w = img.Width;
if (h > max_width || w > max_height) {
var scale_factor = w / max_width;
if (scale_factor < w / max_height) {
scale_factor = w / max_height;
var max_w = is_4k ? max_width * 2 : max_width;
var max_h = is_4k ? max_height * 2 : max_height;
if (w > max_w || h > max_h) {
var scale_factor = w / max_w;
if (scale_factor < h / max_h) {
scale_factor = h / max_h;
}
h = Math.min(h / scale_factor);
w = Math.min(w / scale_factor);
Expand Down Expand Up @@ -46,4 +48,12 @@ function ArtCache(maxCacheSize) {
}
return null;
}

this.clear = function() {
while (art_cache_indexes.length) {
var remove = art_cache_indexes.shift();
disposeImg(art_cache[remove]);
delete art_cache[remove];
}
}
}
9 changes: 5 additions & 4 deletions js/timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ function Timeline (height) {
Timeline.prototype.draw = function (gr) {
if (this.addedCol && this.playedCol && this.unplayedCol) {
var extraLeftSpace = is_4k ? 6 : 3; // add a little space to the left so songs that were played a long time ago show more in the "added" stage
var lineWidth = is_4k ? 3 : 2;
gr.SetSmoothingMode(SmoothingMode.None); // disable smoothing
width = this.w - extraLeftSpace - 1;
gr.FillSolidRect(0, this.y, width + extraLeftSpace, this.h, this.addedCol);
width = Math.floor(this.w - extraLeftSpace - 1 - lineWidth + lineWidth / 2);

gr.FillSolidRect(0, this.y, width + extraLeftSpace + lineWidth - 1, this.h, this.addedCol);
if (this.firstPlayedPercent >= 0 && this.lastPlayedPercent >= 0) {
x1 = Math.floor(width * this.firstPlayedPercent) + extraLeftSpace;
x2 = Math.floor(width * this.lastPlayedPercent) + extraLeftSpace;
Expand All @@ -47,7 +48,7 @@ Timeline.prototype.draw = function (gr) {
for (i = 0; i < this.playedTimesPercents.length; i++) {
x = Math.floor(width * this.playedTimesPercents[i]) + extraLeftSpace;
if (!isNaN(x)) {
gr.DrawLine(x, this.y, x, this.y + this.h, is_4k ? 3 : 2, this.playCol);
gr.DrawLine(x, this.y, x, this.y + this.h, lineWidth, this.playCol);
} else {
// console.log('Played Times Error! ratio: ' + this.playedTimesPercents[i], 'x: ' + x);
}
Expand Down

0 comments on commit 83e6c96

Please sign in to comment.