diff --git a/CUETools/CUETools.csproj b/CUETools/CUETools.csproj
index c8b0c97..8b7855d 100644
--- a/CUETools/CUETools.csproj
+++ b/CUETools/CUETools.csproj
@@ -352,9 +352,7 @@
-
- PreserveNewest
-
+
diff --git a/CUETools/frmCUETools.cs b/CUETools/frmCUETools.cs
index 35381f0..ed60df2 100644
--- a/CUETools/frmCUETools.cs
+++ b/CUETools/frmCUETools.cs
@@ -557,6 +557,7 @@ namespace JDP
this.Invoke((MethodInvoker)delegate()
{
frmChoice dlg = new frmChoice();
+ dlg.config = _profile._config;
if (_choiceWidth != 0 && _choiceHeight != 0)
dlg.Size = new Size(_choiceWidth, _choiceHeight);
if (_choiceMaxed)
@@ -941,6 +942,7 @@ namespace JDP
if (_batchPaths.Count <= 1 && _batchProcessed == 0 && action == CUEAction.Encode && checkBoxEditTags.Checked)
{
frmChoice dlg = new frmChoice();
+ dlg.config = _profile._config;
if (_choiceWidth != 0 && _choiceHeight != 0)
dlg.Size = new Size(_choiceWidth, _choiceHeight);
if (_choiceMaxed)
@@ -971,6 +973,19 @@ namespace JDP
entry.Metadata.CopyMetadata(dlg.ChosenRelease.metadata);
}
}
+ if (dlgRes != DialogResult.Cancel)
+ {
+ if (cueSheet.AlbumArt.Count == 0 && cueSheet.Metadata.AlbumArt.Count > 0)
+ {
+ var ms = new MemoryStream();
+ var image = cueSheet.Metadata.AlbumArt.Find(x => x.primary) ?? cueSheet.Metadata.AlbumArt[0];
+ if (cueSheet.CTDB.FetchFile(image.uri, ms))
+ {
+ var blob = new TagLib.ByteVector(ms.ToArray());
+ cueSheet.AlbumArt.Add(new TagLib.Picture(new TagLib.ByteVector(blob)));
+ }
+ }
+ }
dlg.Close();
}
else if (_profile._config.advanced.CacheMetadata)
@@ -2238,6 +2253,7 @@ namespace JDP
}
CueSheet.UseLocalDB(_localDB);
frmChoice dlg = new frmChoice();
+ dlg.config = _profile._config;
if (_choiceWidth != 0 && _choiceHeight != 0)
dlg.Size = new Size(_choiceWidth, _choiceHeight);
if (_choiceMaxed)
diff --git a/CUETools/frmChoice.Designer.cs b/CUETools/frmChoice.Designer.cs
index fb88ec9..224a6df 100644
--- a/CUETools/frmChoice.Designer.cs
+++ b/CUETools/frmChoice.Designer.cs
@@ -240,11 +240,13 @@ namespace JDP
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.tableLayoutPanel1);
+ this.KeyPreview = true;
this.Name = "frmChoice";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmChoice_FormClosing);
this.Load += new System.EventHandler(this.frmChoice_Load);
+ this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.frmChoice_KeyPress);
this.Resize += new System.EventHandler(this.frmChoice_Resize);
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
diff --git a/CUETools/frmChoice.cs b/CUETools/frmChoice.cs
index 65c4472..5fb63d7 100644
--- a/CUETools/frmChoice.cs
+++ b/CUETools/frmChoice.cs
@@ -12,347 +12,493 @@ using CUETools.CTDB;
namespace JDP
{
- public partial class frmChoice : Form
- {
- public frmChoice()
- {
- InitializeComponent();
- }
+ public partial class frmChoice : Form
+ {
+ public frmChoice()
+ {
+ InitializeComponent();
+ }
- public CUESheet CUE;
+ public CUESheet CUE;
+ public CUEConfig config;
- private bool ctdb;
- private CTDBMetadataSearch metadataSearch;
+ private bool ctdb;
+ private CTDBMetadataSearch metadataSearch;
+ private enum CropAlign
+ {
+ None, TopLeft, BottomRight
+ };
+ private RotateFlipType imageRotation = RotateFlipType.RotateNoneFlipNone;
+ private CropAlign cropAlign = CropAlign.None;
+ private int trimEdge = 0;
- public void LookupAlbumInfo(bool cache, bool cue, bool ctdb, CTDBMetadataSearch metadataSearch)
- {
- this.ctdb = ctdb;
- this.metadataSearch = metadataSearch;
- var releases = CUE.LookupAlbumInfo(cache, cue, false, CTDBMetadataSearch.None);
- this.Choices = releases;
- if (ctdb || metadataSearch != CTDBMetadataSearch.None)
- backgroundWorker1.RunWorkerAsync(null);
- }
+ public void LookupAlbumInfo(bool cache, bool cue, bool ctdb, CTDBMetadataSearch metadataSearch)
+ {
+ this.ctdb = ctdb;
+ this.metadataSearch = metadataSearch;
+ var releases = CUE.LookupAlbumInfo(cache, cue, false, CTDBMetadataSearch.None);
+ this.Choices = releases;
+ if (ctdb || metadataSearch != CTDBMetadataSearch.None)
+ backgroundWorker1.RunWorkerAsync(null);
+ }
- private void frmChoice_Load(object sender, EventArgs e)
- {
- buttonOk.Select();
- }
+ private void frmChoice_Load(object sender, EventArgs e)
+ {
+ buttonOk.Select();
+ }
- private void AddItem(object i)
- {
- if (i is CUEToolsSourceFile)
- {
- CUEToolsSourceFile sf = i as CUEToolsSourceFile;
- ListViewItem item = new ListViewItem(sf.path, 0);
- item.Tag = sf;
- listChoices.Items.Add(item);
- }
- else if (i is TagLib.IPicture)
- {
- TagLib.IPicture pic = i as TagLib.IPicture;
- ListViewItem item = new ListViewItem(pic.Description, -1);
- item.Tag = pic;
- listChoices.Items.Add(item);
- }
- else if (i is CUEMetadataEntry)
- {
- CUEMetadataEntry entry = i as CUEMetadataEntry;
- ListViewItem item = new ListViewItem(entry.ToString(), entry.ImageKey);
- item.Tag = entry;
- listChoices.Items.Add(item);
+ private void AddItem(object i)
+ {
+ if (i is CUEToolsSourceFile)
+ {
+ CUEToolsSourceFile sf = i as CUEToolsSourceFile;
+ ListViewItem item = new ListViewItem(sf.path, 0);
+ item.Tag = sf;
+ listChoices.Items.Add(item);
+ }
+ else if (i is TagLib.IPicture)
+ {
+ TagLib.IPicture pic = i as TagLib.IPicture;
+ ListViewItem item = new ListViewItem(pic.Description, -1);
+ item.Tag = pic;
+ listChoices.Items.Add(item);
+ }
+ else if (i is CUEMetadataEntry)
+ {
+ CUEMetadataEntry entry = i as CUEMetadataEntry;
+ ListViewItem item = new ListViewItem(entry.ToString(), entry.ImageKey);
+ item.Tag = entry;
+ listChoices.Items.Add(item);
- if (entry.ImageKey == "freedb")
- {
- // check if the entry contains non-iso characters,
- // and add a second one if it does
- CUEMetadata copy = new CUEMetadata(entry.metadata);
- if (copy.FreedbToEncoding())
- {
- entry = new CUEMetadataEntry(copy, entry.TOC, entry.ImageKey);
- item = new ListViewItem(entry.ToString(), entry.ImageKey);
- item.Tag = entry;
- listChoices.Items.Add(item);
- }
- }
- }
- else
- {
- ListViewItem item = new ListViewItem(i.ToString(), -1);
- item.Tag = i;
- listChoices.Items.Add(item);
- }
- }
+ if (entry.ImageKey == "freedb")
+ {
+ // check if the entry contains non-iso characters,
+ // and add a second one if it does
+ CUEMetadata copy = new CUEMetadata(entry.metadata);
+ if (copy.FreedbToEncoding())
+ {
+ entry = new CUEMetadataEntry(copy, entry.TOC, entry.ImageKey);
+ item = new ListViewItem(entry.ToString(), entry.ImageKey);
+ item.Tag = entry;
+ listChoices.Items.Add(item);
+ }
+ }
+ }
+ else
+ {
+ ListViewItem item = new ListViewItem(i.ToString(), -1);
+ item.Tag = i;
+ listChoices.Items.Add(item);
+ }
+ }
- public IEnumerable