diff options
-rw-r--r-- | src/CueSheets/Banshee.CueSheets/CS_AlbumInfo.cs | 10 | ||||
-rw-r--r-- | src/CueSheets/Banshee.CueSheets/CS_AlbumModel.cs | 9 | ||||
-rw-r--r-- | src/CueSheets/Banshee.CueSheets/CS_ArtistInfo.cs | 11 | ||||
-rw-r--r-- | src/CueSheets/Banshee.CueSheets/CS_ArtistModel.cs | 13 | ||||
-rw-r--r-- | src/CueSheets/Banshee.CueSheets/CS_GenreModel.cs | 9 | ||||
-rw-r--r-- | src/CueSheets/Banshee.CueSheets/CueSheet.cs | 203 | ||||
-rw-r--r-- | src/CueSheets/Banshee.CueSheets/CueSheetEditor.cs | 99 | ||||
-rw-r--r-- | src/CueSheets/Banshee.CueSheets/CueSheetEntry.cs | 18 | ||||
-rw-r--r-- | src/CueSheets/Banshee.CueSheets/CueSheetsPrefs.cs | 17 | ||||
-rw-r--r-- | src/CueSheets/Banshee.CueSheets/CueSheetsSource.cs | 379 | ||||
-rw-r--r-- | src/CueSheets/Banshee.CueSheets/GenreInfo.cs | 9 | ||||
-rw-r--r-- | src/CueSheets/CueSheets.csproj | 4 |
12 files changed, 613 insertions, 168 deletions
diff --git a/src/CueSheets/Banshee.CueSheets/CS_AlbumInfo.cs b/src/CueSheets/Banshee.CueSheets/CS_AlbumInfo.cs index add1393..a135afd 100644 --- a/src/CueSheets/Banshee.CueSheets/CS_AlbumInfo.cs +++ b/src/CueSheets/Banshee.CueSheets/CS_AlbumInfo.cs @@ -27,6 +27,8 @@ // using System; using Banshee.Collection; +using System.Collections; +using System.Collections.Generic; namespace Banshee.CueSheets { @@ -34,6 +36,14 @@ namespace Banshee.CueSheets { private CueSheet _sheet; + public class Comparer : IComparer<CS_AlbumInfo> { + private CaseInsensitiveComparer cmp=new CaseInsensitiveComparer(); + public int Compare( CS_AlbumInfo a1,CS_AlbumInfo a2 ) { + return cmp.Compare (a1.Title+a1.ArtistName, + a2.Title+a2.ArtistName); + } + } + public CS_AlbumInfo (CueSheet s) { _sheet=s; if (s==null) { diff --git a/src/CueSheets/Banshee.CueSheets/CS_AlbumModel.cs b/src/CueSheets/Banshee.CueSheets/CS_AlbumModel.cs index effb556..9d24b89 100644 --- a/src/CueSheets/Banshee.CueSheets/CS_AlbumModel.cs +++ b/src/CueSheets/Banshee.CueSheets/CS_AlbumModel.cs @@ -72,6 +72,7 @@ namespace Banshee.CueSheets } } + _filteredList.Sort (new CS_AlbumInfo.Comparer()); base.RaiseReloaded (); } @@ -94,10 +95,18 @@ namespace Banshee.CueSheets } } + public GenreInfo filterGenre() { + return _genre; + } + public void filterArtist(ArtistInfo a) { _artist=a; Reload(); } + + public ArtistInfo filterArtist() { + return _artist; + } public override int Count { get { diff --git a/src/CueSheets/Banshee.CueSheets/CS_ArtistInfo.cs b/src/CueSheets/Banshee.CueSheets/CS_ArtistInfo.cs index 5621e54..99ff628 100644 --- a/src/CueSheets/Banshee.CueSheets/CS_ArtistInfo.cs +++ b/src/CueSheets/Banshee.CueSheets/CS_ArtistInfo.cs @@ -27,6 +27,8 @@ // using System; using Banshee.Collection; +using System.Collections; +using System.Collections.Generic; namespace Banshee.CueSheets { @@ -35,12 +37,19 @@ namespace Banshee.CueSheets private CueSheet _sheet; + public class Comparer : IComparer<CS_ArtistInfo> { + private CaseInsensitiveComparer cmp=new CaseInsensitiveComparer(); + public int Compare( CS_ArtistInfo a1,CS_ArtistInfo a2 ) { + return cmp.Compare (a1.Name,a2.Name); + } + } + public CS_ArtistInfo (CueSheet s) { _sheet=s; if (s!=null) { base.Name=s.performer (); } else { - base.Name="All Artists"; + base.Name="<All Artists>"; } } diff --git a/src/CueSheets/Banshee.CueSheets/CS_ArtistModel.cs b/src/CueSheets/Banshee.CueSheets/CS_ArtistModel.cs index 51639fa..fa6a764 100644 --- a/src/CueSheets/Banshee.CueSheets/CS_ArtistModel.cs +++ b/src/CueSheets/Banshee.CueSheets/CS_ArtistModel.cs @@ -33,15 +33,15 @@ namespace Banshee.CueSheets { public class CS_ArtistModel : BansheeListModel<ArtistInfo> { - private CueSheetsSource MySource; - private List<ArtistInfo> _artists; - private ArtistInfo _nullArtist; - private GenreInfo _genre; + private CueSheetsSource MySource; + private List<CS_ArtistInfo> _artists; + private CS_ArtistInfo _nullArtist; + private GenreInfo _genre; public CS_ArtistModel (CueSheetsSource s) { MySource=s; _nullArtist=new CS_ArtistInfo (null); - _artists=new List<ArtistInfo>(); + _artists=new List<CS_ArtistInfo>(); Selection=new Hyena.Collections.Selection(); } @@ -68,12 +68,13 @@ namespace Banshee.CueSheets if (s[i].genre ()!=_genre.Genre) { do_add=false; } } if (do_add) { - ArtistInfo a=new CS_ArtistInfo (s[i]); + CS_ArtistInfo a=new CS_ArtistInfo (s[i]); _artists.Add (a); added.Add (perf); } } } + _artists.Sort (new CS_ArtistInfo.Comparer()); base.RaiseReloaded (); } diff --git a/src/CueSheets/Banshee.CueSheets/CS_GenreModel.cs b/src/CueSheets/Banshee.CueSheets/CS_GenreModel.cs index 4b48c8a..210b442 100644 --- a/src/CueSheets/Banshee.CueSheets/CS_GenreModel.cs +++ b/src/CueSheets/Banshee.CueSheets/CS_GenreModel.cs @@ -40,13 +40,13 @@ namespace Banshee.CueSheets public CS_GenreModel (CueSheetsSource s) { MySource=s; - _nullGenre=new GenreInfo("All Genres"); + _nullGenre=new GenreInfo("<All Genres>"); _genres=new List<GenreInfo>(); Selection=new Hyena.Collections.Selection(); } public override void Clear () { - Console.WriteLine ("clear"); + Hyena.Log.Information ("clear"); } private bool exists(string s) { @@ -58,19 +58,16 @@ namespace Banshee.CueSheets public override void Reload () { HashSet<string> added=new HashSet<string>(); List<CueSheet> s=MySource.getSheets (); - //Console.WriteLine ("count="+s.Count); _genres.Clear (); _genres.Add (_nullGenre); for(int i=0;i<s.Count;i++) { - //Console.Write(" "+i); string gen=Loosely.prepare (s[i].genre ()); if (!added.Contains (gen)) { - //Console.WriteLine ("genre:"+s[i].genre ()); _genres.Add (new GenreInfo(s[i].genre ())); added.Add (gen); } } - //Console.WriteLine (); + _genres.Sort(new GenreInfo.Comparer()); base.RaiseReloaded (); } diff --git a/src/CueSheets/Banshee.CueSheets/CueSheet.cs b/src/CueSheets/Banshee.CueSheets/CueSheet.cs index d604432..d822c8f 100644 --- a/src/CueSheets/Banshee.CueSheets/CueSheet.cs +++ b/src/CueSheets/Banshee.CueSheets/CueSheet.cs @@ -46,6 +46,16 @@ namespace Banshee.CueSheets private string _directory; private string _basedir; + private string _year; + private string _composer; + private string _subtitle; + private string _cddbId; + + public string id() { + return "title="+_title+";performer="+_performer+ + ";year="+_year+";composer="+_composer; + } + public string genre() { int n=_basedir.Length; string d=_directory.Substring (n); @@ -93,6 +103,22 @@ namespace Banshee.CueSheets return _performer; } + public string composer() { + return _composer; + } + + public string subtitle() { + return _subtitle; + } + + public string year() { + return _year; + } + + public string cddbId() { + return _cddbId; + } + public CueSheetEntry entry(int i) { return _tracks[i]; } @@ -111,13 +137,17 @@ namespace Banshee.CueSheets } public void resetArt() { - string aaid=CoverArtSpec.CreateArtistAlbumId (_performer,_title); - string path=CoverArtSpec.GetPathForNewFile(aaid,_img_full_path); - File.Delete (path); - File.Copy (_img_full_path,path); - int i,N; - for(i=0,N=nEntries ();i<N;i++) { - entry (i).setArtWorkId(aaid); + if (_img_full_path!=null && _img_full_path!="") { + if (File.Exists (_img_full_path)) { + string aaid=CoverArtSpec.CreateArtistAlbumId (_performer,_title); + string path=CoverArtSpec.GetPathForNewFile(aaid,_img_full_path); + File.Delete (path); + File.Copy (_img_full_path,path); + int i,N; + for(i=0,N=nEntries ();i<N;i++) { + entry (i).setArtWorkId(aaid); + } + } } } @@ -157,14 +187,32 @@ namespace Banshee.CueSheets _title=t; } + public void SetComposer(string c) { + _composer=c; + } + + public void SetSubtitle(string s) { + _subtitle=s; + } + + public void SetYear(string y) { + _year=y; + } + + public void SetImagePath(string path) { - string fn=Tools.basename(path); - string fnp=Tools.makefile(_directory,fn); - if (!File.Exists (fnp)) { - File.Copy (path,fnp); + Hyena.Log.Information ("SetImagePath: "+path); + if (path!=null && path!="") { + if (File.Exists (path)) { + string fn=Tools.basename(path); + string fnp=Tools.makefile(_directory,fn); + if (!File.Exists (fnp)) { + File.Copy (path,fnp); + } + _image_file_name=fn; + _img_full_path=fnp; + } } - _image_file_name=fn; - _img_full_path=fnp; } public void ClearTracks() { @@ -172,7 +220,7 @@ namespace Banshee.CueSheets _tracks=null; } - public void AddTrack(string e_title,string e_perf,double e_offset) { + public CueSheetEntry AddTrack(string e_title,string e_perf,double e_offset) { int nr=0; if (_tracks!=null) { nr=_tracks.Length; @@ -183,49 +231,101 @@ namespace Banshee.CueSheets int i,N; for(i=0,N=nEntries ();i<N;i++) { _tracks[i].setNrOfTracks(N); + if (i<N-1) { + _tracks[i].setLength (_tracks[i+1].offset ()-_tracks[i].offset ()); + } else { + _tracks[i].setLength (-1.0); + } } + return e; + } + + private string indent=""; + + private void wrtl(System.IO.StreamWriter wrt,string key,string val,bool rem=false) { + string r=""; + if (rem) { r="REM "; } + wrt.WriteLine (indent+r+key.ToUpper ()+" \""+val+"\""); + } + + private void wrtl_file(System.IO.StreamWriter wrt,string file) { + wrt.WriteLine (indent+"FILE \""+file+"\" WAVE"); + } + + private void wrtl_track(System.IO.StreamWriter wrt,int index) { + wrt.WriteLine (indent+"TRACK "+String.Format ("{0:00}",index)+" AUDIO"); + } + + private void wrtl_index(System.IO.StreamWriter wrt,int inr,double offset) { + int t=(int) (offset*100.0); + int m=t/(100*60); + int s=(t/100)%60; + int hs=t%100; + wrt.WriteLine (indent+"INDEX "+String.Format ("{0:00}",inr)+" "+ + String.Format("{0:00}",m)+":"+ + String.Format ("{0:00}",s)+":"+ + String.Format ("{0:00}",hs) + ); } public void Save() { - //System.IO.StreamWriter wrt=new System.IO.StreamWriter(); if (!File.Exists (_cuefile+".bck")) { File.Copy (_cuefile,_cuefile+".bck"); } resetArt (); System.IO.StreamWriter wrt=new System.IO.StreamWriter(_cuefile); - wrt.WriteLine ("REM Banshee CueSheets Extension "+CS_Info.Version()); - wrt.WriteLine ("REM Banshee AAID : "+getArtId ()); - wrt.WriteLine ("REM IMAGE \""+_image_file_name+"\""); - wrt.WriteLine ("PERFORMER \""+_performer+"\""); - wrt.WriteLine ("TITLE \""+_title+"\""); + indent=""; + wrtl(wrt,"creator","Banshee CueSheets Extension",true); + wrtl (wrt,"creator-version",CS_Info.Version (),true); + wrtl (wrt,"banshee-aaid",getArtId (),true); + wrtl (wrt,"image",_image_file_name,true); + wrtl (wrt,"composer",_composer,true); + wrtl (wrt,"subtitle",_subtitle,true); + wrtl (wrt,"year",_year,true); + wrtl (wrt,"cddbid",_cddbId,true); + wrtl (wrt,"performer",_performer); + wrtl (wrt,"title",_title); string mfn=Tools.basename(_music_file_name); - wrt.WriteLine ("FILE \""+mfn+"\" WAVE"); + wrtl_file (wrt,mfn); int i,N; for(i=0,N=nEntries ();i<N;i++) { CueSheetEntry e=_tracks[i]; - wrt.WriteLine (" TRACK "+String.Format ("{0:00}",i+1)+" AUDIO"); - wrt.WriteLine (" TITLE \""+e.title ()+"\""); - wrt.WriteLine (" PERFORMER \""+e.performer ()+"\""); - int t=(int) (e.offset ()*100.0); - int m=t/(100*60); - int s=(t/100)%60; - int hs=t%100; - wrt.WriteLine (" INDEX 01 "+ String.Format("{0:00}",m)+":"+ - String.Format ("{0:00}",s)+":"+ - String.Format ("{0:00}",hs) - ); + indent=" "; + wrtl_track(wrt,i+1); + indent=" "; + wrtl (wrt,"title",e.title ()); + wrtl (wrt,"performer",e.performer ()); + wrtl (wrt,"piece",e.getPiece (),true); + wrtl (wrt,"composer",e.getComposer (),true); + wrtl_index(wrt,1,e.offset ()); } wrt.Close (); } + static private Regex unq1=new Regex("^[\"]"); + static private Regex unq2=new Regex("[\"]$"); + + private string unquote(string s) { + return unq1.Replace (unq2.Replace (s,""),""); + } + public void iLoad() { + + _composer=""; + _year=""; + _subtitle=""; + _cddbId=""; + + Boolean _in_tracks=false; string e_perf=""; string e_title=""; double e_offset=-1.0; + string e_piece=""; + string e_composer=""; string aaid=""; int nr=0; @@ -240,28 +340,32 @@ namespace Banshee.CueSheets //Console.WriteLine ("it="+_in_tracks+", "+line); if (!_in_tracks) { if (eq(line,"performer")) { - string p=line.Substring (9).Trim (); - p=Regex.Replace (p,"[\"]",""); - _performer=p; + _performer=unquote(line.Substring (9).Trim ()); } else if (eq(line,"title")) { - _title=Regex.Replace (line.Substring (5).Trim (),"[\"]",""); + _title=unquote(line.Substring (5).Trim ()); } else if (eq(line,"file")) { _music_file_name=line.Substring (4).Trim (); Match m=Regex.Match (_music_file_name,"([\"][^\"]+[\"])"); - //Console.WriteLine ("match="+m); _music_file_name=m.ToString (); - //Console.WriteLine ("result="+_music_file_name); - _music_file_name=Regex.Replace (_music_file_name,"[\"]","").Trim (); + _music_file_name=unquote(_music_file_name).Trim (); _music_file_name=Tools.makefile(directory,_music_file_name); - //Console.WriteLine ("music file="+_music_file_name); } else if (line.Substring(0,5).ToLower ()=="track") { _in_tracks=true; } else if (eq(line,"rem")) { + //Hyena.Log.Information (line); line=line.Substring (3).Trim (); if (eq(line,"image")) { _image_file_name=line.Substring (5).Trim (); - _image_file_name=Regex.Replace (_image_file_name,"[\"]","").Trim (); + _image_file_name=unquote(_image_file_name).Trim (); _img_full_path=Tools.makefile(directory,_image_file_name); + } else if (eq (line,"composer")) { + _composer=unquote(line.Substring (8).Trim ()); + } else if (eq (line,"subtitle")) { + _subtitle=unquote(line.Substring (8).Trim ()); + } else if (eq (line,"year")) { + _year=unquote(line.Substring (4).Trim ()); + } else if (eq (line,"cddbid")) { + _cddbId=unquote(line.Substring (6).Trim ()); } } } @@ -275,6 +379,8 @@ namespace Banshee.CueSheets if (e_offset>=0) { nr+=1; CueSheetEntry e=new CueSheetEntry(_music_file_name,aaid,nr,-1,e_title,e_perf,_title,e_offset); + e.setComposer (e_composer); + e.setPiece (e_piece); append (e); if (nr>1) { CueSheetEntry ePrev; @@ -284,16 +390,23 @@ namespace Banshee.CueSheets } e_perf=_performer; e_title=""; + e_composer=_composer; e_offset=-1.0; } else if (eq(line,"title")) { - e_title=Regex.Replace (line.Substring (5).Trim (),"[\"]",""); + e_title=unquote(line.Substring (5).Trim ()); } else if (eq(line,"performer")) { - e_perf=Regex.Replace (line.Substring (9).Trim (),"[\"]",""); + e_perf=unquote(line.Substring (9).Trim ()); + } else if (eq(line,"rem")) { + line=line.Substring (3).Trim (); + if (eq (line,"composer")) { + e_composer=unquote(line.Substring (8).Trim ()); + } else if (eq(line,"piece")) { + e_piece=unquote(line.Substring (5).Trim ()); + } } else if (eq(line,"index")) { string s=line.Substring (5).Trim (); s=Regex.Replace (s,"^\\s*[0-9]+\\s*",""); string []parts=Regex.Split(s,"[:]"); - //Console.WriteLine ("parts="+parts[0]+","+parts[1]+","+parts[2]); int min=Convert.ToInt32(parts[0]); int secs=Convert.ToInt32(parts[1]); int hsecs=Convert.ToInt32(parts[2]); @@ -306,6 +419,8 @@ namespace Banshee.CueSheets if (e_offset>=0) { nr+=1; CueSheetEntry e=new CueSheetEntry(_music_file_name,aaid,nr,-1,e_title,e_perf,_title,e_offset); + e.setComposer (e_composer); + e.setPiece (e_piece); append (e); if (nr>1) { CueSheetEntry ePrev; diff --git a/src/CueSheets/Banshee.CueSheets/CueSheetEditor.cs b/src/CueSheets/Banshee.CueSheets/CueSheetEditor.cs index 57f5596..988f12e 100644 --- a/src/CueSheets/Banshee.CueSheets/CueSheetEditor.cs +++ b/src/CueSheets/Banshee.CueSheets/CueSheetEditor.cs @@ -11,6 +11,9 @@ namespace Banshee.CueSheets private Gtk.FileChooserButton _imagefile; private Gtk.Entry _performer; private Gtk.Entry _title; + private Gtk.Entry _composer; + private Gtk.Entry _subtitle; + private Gtk.Entry _year; private Gtk.TreeView _tracks; private Gtk.ListStore _store; private Gtk.Button _reload; @@ -33,6 +36,9 @@ namespace Banshee.CueSheets public void Reload() { _title.Text=_sheet.title (); _performer.Text=_sheet.performer (); + _composer.Text=_sheet.composer (); + _year.Text=_sheet.year (); + _subtitle.Text=_sheet.subtitle (); try { _imagefile.SelectFilename (_sheet.imageFullFileName()); @@ -53,10 +59,18 @@ namespace Banshee.CueSheets String offset=String.Format ("{0:00}",m)+":"+ String.Format ("{0:00}",s)+"."+ String.Format ("{0:00}",hs); - _store.AppendValues (i+1,_sheet.entry (i).title (),offset); + _store.AppendValues (i+1,_sheet.entry (i).title (),_sheet.entry (i).performer (), + _sheet.entry (i).getComposer (),_sheet.entry (i).getPiece (),offset); } } + private void setCell(int column,string nt,Gtk.TreePath path) { + Gtk.TreeIter iter; + _store.GetIter(out iter,path); + _store.SetValue (iter,column,nt); + Hyena.Log.Information ("Cuesheet editing - data="+nt+", path="+path.Indices[0]); + } + public void CreateGui() { Gtk.Image icn_reload=new Gtk.Image(Gtk.Stock.Refresh,Gtk.IconSize.Button); @@ -67,6 +81,13 @@ namespace Banshee.CueSheets _title=new Gtk.Entry(200); _title.WidthChars=60; _performer.WidthChars=60; + _subtitle=new Gtk.Entry(300); + _subtitle.WidthChars=60; + _composer=new Gtk.Entry(200); + _composer.WidthChars=60; + _year=new Gtk.Entry(20); + _year.WidthChars=20; + _image=new Gtk.Image(); _image.SetSizeRequest (100,100); _imagefile=new Gtk.FileChooserButton("Choose image file",Gtk.FileChooserAction.Open); @@ -84,20 +105,63 @@ namespace Banshee.CueSheets _save=new Gtk.Button(icn_save); _save.Clicked+=OnSave; - _store=new Gtk.ListStore(typeof(int),typeof(string),typeof(string)); + _store=new Gtk.ListStore(typeof(int),typeof(string),typeof(string),typeof(string),typeof(string),typeof(string)); _tracks=new Gtk.TreeView(); - _tracks.AppendColumn ("Nr.", new Gtk.CellRendererText (), "text", 0); - _tracks.AppendColumn ("Title", new Gtk.CellRendererText (), "text", 1); - _tracks.AppendColumn ("Offset", new Gtk.CellRendererText (), "text", 2); + { + Gtk.CellRendererText cr0=new Gtk.CellRendererText(); + cr0.Scale=0.8; + _tracks.AppendColumn ("Nr.", cr0, "text", 0); + + Gtk.CellRendererText cr_title=new Gtk.CellRendererText(); + cr_title.Scale=0.8; + cr_title.Editable=true; + cr_title.Edited+=new Gtk.EditedHandler(delegate(object sender,Gtk.EditedArgs args) { + setCell(1,args.NewText,new Gtk.TreePath(args.Path)); + }); + _tracks.AppendColumn ("Title", cr_title, "text", 1); + + Gtk.CellRendererText cr_artist=new Gtk.CellRendererText(); + cr_artist.Editable=true; + cr_artist.Scale=0.8; + cr_artist.Edited+=new Gtk.EditedHandler(delegate(object sender,Gtk.EditedArgs args) { + setCell(2,args.NewText,new Gtk.TreePath(args.Path)); + }); + _tracks.AppendColumn ("Artist", cr_artist, "text", 2); + + Gtk.CellRendererText cr_composer=new Gtk.CellRendererText(); + cr_composer.Editable=true; + cr_composer.Scale=0.8; + cr_composer.Edited+=new Gtk.EditedHandler(delegate(object sender,Gtk.EditedArgs args) { + setCell(3,args.NewText,new Gtk.TreePath(args.Path)); + }); + _tracks.AppendColumn ("Composer", cr_composer, "text", 3); + + Gtk.CellRendererText cr_piece=new Gtk.CellRendererText(); + cr_piece.Editable=true; + cr_piece.Scale=0.8; + cr_piece.Edited+=new Gtk.EditedHandler(delegate(object sender,Gtk.EditedArgs args) { + setCell(4,args.NewText,new Gtk.TreePath(args.Path)); + }); + _tracks.AppendColumn ("Piece", cr_piece, "text", 4); + + _tracks.AppendColumn ("Offset", cr0, "text", 5); + } + //_tracks.CursorChanged += new EventHandler(EvtCursorChanged); //_tracks.RowActivated += new Gtk.RowActivatedHandler(EvtTrackRowActivated); _tracks.Model = _store; - Gtk.Table tbl=new Gtk.Table(2,2,false); + Gtk.Table tbl=new Gtk.Table(2,5,false); tbl.Attach (new Gtk.Label("Album:"),0,1,0,1); tbl.Attach (_title,1,2,0,1); tbl.Attach (new Gtk.Label("Artist:"),0,1,1,2); tbl.Attach (_performer,1,2,1,2); + tbl.Attach (new Gtk.Label("Composer:"),0,1,2,3); + tbl.Attach (_composer,1,2,2,3); + tbl.Attach (new Gtk.Label("Subtitle:"),0,1,3,4); + tbl.Attach (_subtitle,1,2,3,4); + tbl.Attach (new Gtk.Label("year:"),0,1,4,5); + tbl.Attach (_year,1,2,4,5); Gtk.Frame frm=new Gtk.Frame(); frm.Add (tbl); @@ -120,7 +184,7 @@ namespace Banshee.CueSheets Gtk.ScrolledWindow scroll=new Gtk.ScrolledWindow(); scroll.Add (_tracks); - scroll.SetSizeRequest (-1,300); + scroll.SetSizeRequest (800,300); base.VBox.PackStart(hb,false,false,4); base.VBox.PackStart (_imagefile,false,false,4); @@ -153,22 +217,39 @@ namespace Banshee.CueSheets public void OnSave(object sender,EventArgs args) { string nPerformer=_performer.Text.Trim (); string nTitle=_title.Text.Trim (); + string nComposer=_composer.Text.Trim(); + string nYear=_year.Text.Trim(); + string nSubtitle=_subtitle.Text.Trim(); + _sheet.SetPerformer(nPerformer); _sheet.SetTitle(nTitle); + _sheet.SetComposer(nComposer); + _sheet.SetYear(nYear); + _sheet.SetSubtitle(nSubtitle); _sheet.SetImagePath(_imagefile.Filename); + _sheet.ClearTracks(); + Gtk.TreeIter iter; if (_store.GetIterFirst(out iter)) { do { string title=(string) _store.GetValue (iter,1); - string offset=(string) _store.GetValue (iter,2); + string perf=(string) _store.GetValue (iter,2); + string composer=(string) _store.GetValue (iter,3); + if (composer.Trim ()=="") { composer=nComposer; } + string piece=(string) _store.GetValue (iter,4); + piece=piece.Trim (); + string offset=(string) _store.GetValue (iter,5); string []parts=Regex.Split(offset,"[.:]"); double e_offset; int min=Convert.ToInt32(parts[0]); int secs=Convert.ToInt32(parts[1]); int hsecs=Convert.ToInt32(parts[2]); e_offset=min*60+secs+(hsecs/100.0); - _sheet.AddTrack(title,nPerformer,e_offset); + if (perf.Trim ()=="") { perf=nPerformer; } + CueSheetEntry e=_sheet.AddTrack(title,perf,e_offset); + e.setComposer (composer); + e.setPiece (piece); } while(_store.IterNext (ref iter)); } _sheet.Save(); diff --git a/src/CueSheets/Banshee.CueSheets/CueSheetEntry.cs b/src/CueSheets/Banshee.CueSheets/CueSheetEntry.cs index 32bd18d..2c6a582 100644 --- a/src/CueSheets/Banshee.CueSheets/CueSheetEntry.cs +++ b/src/CueSheets/Banshee.CueSheets/CueSheetEntry.cs @@ -36,6 +36,8 @@ namespace Banshee.CueSheets { double _offset; string _performer; + string _composer=""; + string _piece=""; string _title; string _file; double _length; @@ -73,6 +75,22 @@ namespace Banshee.CueSheets return _length; } + public void setComposer(string c) { + _composer=c; + } + + public void setPiece(string p) { + _piece=p; + } + + public string getPiece() { + return _piece; + } + + public string getComposer() { + return _composer; + } + public void setLength(double l) { _length=l; System.Int64 ticks_100nanosecs=(System.Int64) (l*10000000); // 10 miljoen diff --git a/src/CueSheets/Banshee.CueSheets/CueSheetsPrefs.cs b/src/CueSheets/Banshee.CueSheets/CueSheetsPrefs.cs index bb91bcb..2807783 100644 --- a/src/CueSheets/Banshee.CueSheets/CueSheetsPrefs.cs +++ b/src/CueSheets/Banshee.CueSheets/CueSheetsPrefs.cs @@ -17,7 +17,6 @@ namespace Banshee.CueSheets private SourcePage source_page; private Section basedir_section; private CueSheetsSource _source; - private Gtk.FileChooserButton _btn; public CueSheetsPrefs (CueSheetsSource source) { var service = ServiceManager.Get<PreferenceService>(); @@ -44,8 +43,15 @@ namespace Banshee.CueSheets box.Add (lbl); box.Add (btn); box.ShowAll (); - btn.FileSet+=new EventHandler(EvtDirSet); - _btn=btn; + btn.CurrentFolderChanged+=delegate(object sender,EventArgs args) { + string dir1=btn.Filename; + Hyena.Log.Information ("Folder changed to = "+dir1); + }; + btn.FileSet+=delegate(object sender,EventArgs args) { + string dir1=btn.Filename; + Hyena.Log.Information ("Base directory changed to = "+dir1); + _source.setCueSheetDir(dir1); + }; Console.WriteLine (_source); @@ -78,11 +84,6 @@ namespace Banshee.CueSheets } - public void EvtDirSet(object sender,EventArgs a) { - string dir=_btn.Filename; - _source.setCueSheetDir(dir); - } - public string PageId { get { return source_page.Id; } } diff --git a/src/CueSheets/Banshee.CueSheets/CueSheetsSource.cs b/src/CueSheets/Banshee.CueSheets/CueSheetsSource.cs index 46f241c..7cc4bf9 100644 --- a/src/CueSheets/Banshee.CueSheets/CueSheetsSource.cs +++ b/src/CueSheets/Banshee.CueSheets/CueSheetsSource.cs @@ -52,6 +52,7 @@ using Banshee.Collection.Database; using Hyena.Data.Gui; using Banshee.Gui; using Banshee.I18n; +using Banshee.Configuration; namespace Banshee.CueSheets { @@ -64,14 +65,17 @@ namespace Banshee.CueSheets { // In the sources TreeView, sets the order value for this source, small on top const int sort_order = 50; - CustomView _view; - //TrackListModel _nullModel; - //double pbsize=-1.0; - List<CueSheet> _sheets=new List<CueSheet>(); - CueSheet _sheet=null; - private CueSheetsPrefs preferences; - private Gtk.CheckMenuItem menuItem; - private Gtk.SeparatorMenuItem sep; + + private CustomView _view; + private Gtk.MenuItem _menuItem; + private Gtk.SeparatorMenuItem _sep; + + private List<CueSheet> _sheets=new List<CueSheet>(); + private CueSheet _sheet=null; + private CueSheetsPrefs _preferences; + + private DatabaseConfigurationClient _config; + public CueSheetsSource () : base (AddinManager.CurrentLocalizer.GetString ("CueSheets"), AddinManager.CurrentLocalizer.GetString ("CueSheets"), @@ -79,41 +83,46 @@ namespace Banshee.CueSheets "hod-cuesheets-2013-01-06") { Hyena.Log.Information ("CueSheetsSouce init"); + + _config=ServiceManager.DbConnection.Configuration; + _sheet=new CueSheet(); + _view=new CustomView(this); - Properties.Set<ISourceContents> ("Nereid.SourceContents", _view); + + Properties.Set<ISourceContents> ("Nereid.SourceContents", _view); Properties.SetString ("Icon.Name", "cueplay"); Hyena.Log.Information ("CueSheets source has been instantiated."); InterfaceActionService action_service = ServiceManager.Get<InterfaceActionService> (); - Gtk.Menu viewMenu = (action_service.UIManager.GetWidget ("/MainMenu/ViewMenu") as Gtk.MenuItem).Submenu as Gtk.Menu; - menuItem = new Gtk.CheckMenuItem (Catalog.GetString ("_Albums as list")); - menuItem.Activated += delegate { + + Gtk.Menu viewMenu = (action_service.UIManager.GetWidget ("/MainMenu/ViewMenu") as Gtk.MenuItem).Submenu as Gtk.Menu; + _menuItem = new Gtk.MenuItem (Catalog.GetString ("_Change Album View")); + _menuItem.Activated += delegate { _view.ToggleGrid(); }; - viewMenu.Insert (menuItem, 2); - sep=new Gtk.SeparatorMenuItem(); - viewMenu.Insert (sep,3); - //menuItem.Active=!getGridLayout (); + viewMenu.Insert (_menuItem, 2); + _sep=new Gtk.SeparatorMenuItem(); + viewMenu.Insert (_sep,3); } public override void Activate () { - menuItem.Show (); - sep.Show (); + _menuItem.Show (); + _sep.Show (); } public override void Deactivate() { - menuItem.Hide (); - sep.Hide (); + _menuItem.Hide (); + _sep.Hide (); } public override string PreferencesPageId { get { - if (preferences==null) { preferences=new CueSheetsPrefs(this); } - preferences.createGui(); - return preferences.PageId; + if (_preferences==null) { _preferences=new CueSheetsPrefs(this); } + _preferences.createGui(); + return _preferences.PageId; } } @@ -235,16 +244,29 @@ namespace Banshee.CueSheets vp=Banshee.Configuration.ConfigurationClient.Get<int>("cuesheets_vp",200); } - private bool grid_layout=true; + public bool getGridLayout(string id) { + //bool grid=_config.Get<bool>("cuesheets_grid_"+id,true); + bool grid=true; + if (!_config.TryGet<bool> ("cuesheets_grid",id,out grid)) { grid=true; } + Hyena.Log.Information ("get cuesheets_grid_"+id+"="+grid); + return grid; + } + + public void setGridLayout(string id,bool g) { + Hyena.Log.Information ("setting cuesheets_grid_"+id+" to "+g); + _config.Set<bool>("cuesheets_grid",id,g); + //Banshee.Configuration.ConfigurationClient.Set<bool>("cuesheets_grid_"+id,g); + } - public bool getGridLayout() { - return grid_layout; - //return Banshee.Configuration.ConfigurationClient.Get<bool>("cuesheets_grid",true); + public void setColumnWidth(string type,string albumid,int w) { + _config.Set<int>("cuesheets_col_"+type,albumid,w); } - public void setGridLayout(bool g) { - //Banshee.Configuration.ConfigurationClient.Set<bool>("cuesheets_grid",g); - grid_layout=g; + public int getColumnWidth(string type,string albumid) { + int w=100; + if (!_config.TryGet<int>("cuesheets_col_"+type,albumid,out w)) { w=100; } + Hyena.Log.Information ("columnwidth("+type+","+albumid+")="+w); + return w; } public string getCueSheetDir() { @@ -254,30 +276,34 @@ namespace Banshee.CueSheets } public void setCueSheetDir(string dir) { + Hyena.Log.Information ("Setting cuesheets dir to "+dir); Banshee.Configuration.ConfigurationClient.Set<string>("cuesheets_dir",dir); _view.fill (); } private class CustomView : ISourceContents { - Gtk.ListStore store; - Gtk.VBox box; - string type="directory"; - Gtk.ScrolledWindow ascroll,tscroll,aascroll,gscroll; - int index=-1; - private CueSheetsSource MySource=null; - MyAlbumListView aview; - Gtk.TreeView view; - ArtistListView aaview; - GenreListView gview; - Gtk.HPaned hb; - Gtk.HPaned hb1; - Gtk.VPaned vp; + private Gtk.ListStore store; + private Gtk.VBox box; + private string type="directory"; + private Gtk.ScrolledWindow ascroll,tscroll,aascroll,gscroll; + private int index=-1; + private CueSheetsSource MySource=null; + private MyAlbumListView aview; + private Gtk.TreeView view; + private ArtistListView aaview; + private GenreListView gview; + private Gtk.HPaned hb; + private Gtk.HPaned hb1; + private Gtk.VPaned vp; + private Gtk.Toolbar bar; + private Gtk.Label filling; + private Gtk.TreeViewColumn c_track,c_piece,c_artist,c_composer; - uint _position=0; - bool _set_position=false; - private String basedir=null; - private CueSheet _selected=null; + private uint _position=0; + private bool _set_position=false; + private String basedir=null; + private CueSheet _selected=null; public string cuename(string f) { string cn=Regex.Replace(Tools.basename(f),"[.]cue$",""); @@ -287,50 +313,115 @@ namespace Banshee.CueSheets public List<CueSheet> getSheets() { return MySource.getSheets (); } - + + private bool _fill_ready=true; + private Stack<string> _fill_dirs=new Stack<string>(); + private Stack<string> _fill_cues=new Stack<string>(); + private int _fill_count=0; + private int _fill_dir_count=0; + private bool _fill_canceled=false; private void fill(string cwd) { - //Hyena.Log.Information ("fill:"+cwd); + Hyena.Log.Information ("Scanning directory "+cwd); string [] dirs=Directory.GetDirectories(cwd, "*"); string [] sheets=Directory.GetFiles (cwd,"*.cue"); foreach (string dir in dirs) { - if (dir.Substring (0,1)!=".") { - fill (dir); - } + _fill_dirs.Push (dir); } foreach (string sheet in sheets) { - string bn=Tools.basename (sheet); - if (bn!="") { - if (bn.Substring (0,1)!=".") { - CueSheet cs=new CueSheet(sheet,cwd,basedir); - getSheets().Add (cs); + _fill_cues.Push (sheet); + } + /*if (_fill_cues.Count==0) { + if (_fill_dirs.Count>0) { + fill (_fill_dirs.Pop ()); + } + }*/ + + GLib.Timeout.Add (10,delegate() { + if (_fill_canceled) { + return false; + } + + int i; + while(i<50 && _fill_cues.Count>0) { + string sheet=_fill_cues.Pop (); + string bn=Tools.basename (sheet); + if (bn!="") { + if (bn.Substring (0,1)!=".") { + CueSheet cs=new CueSheet(sheet,cwd,basedir); + getSheets().Add (cs); + } } + i+=1; + _fill_count+=1; } - } + + filling.Text="scanning "+basedir+"..."+_fill_count+" files, "+_fill_dir_count+" directories"; + if (_fill_cues.Count==0) { + if (_fill_dirs.Count>0) { + string dir=_fill_dirs.Pop (); + _fill_dir_count+=1; + fill (dir); + } else { + _fill_ready=true; + } + return false; + } else { + return true; + } + }); } public void fill() { + Gtk.Button cancel=new Gtk.Button("Cancel scan"); + Gtk.VSeparator sep=new Gtk.VSeparator(); + cancel.Clicked+=delegate(object sender,EventArgs args) { + _fill_canceled=true; + }; + bar.Add (sep); + sep.Show (); + bar.Add (cancel); + cancel.Show (); + bar.Show (); getSheets().Clear (); basedir=MySource.getCueSheetDir(); + Hyena.Log.Information ("Base directory="+basedir); if (basedir!=null) { + _fill_ready=false; + _fill_count=0; + _fill_dir_count=0; + _fill_canceled=false; + _fill_cues.Clear (); + _fill_dirs.Clear (); fill (basedir); - try { - Hyena.Log.Information("Reload albums"); - MySource.getAlbumModel ().Reload (); - Hyena.Log.Information("Reload artists"); - MySource.getArtistModel ().Reload (); - Hyena.Log.Information("Reload genres"); - MySource.getGenreModel ().Reload (); - Hyena.Log.Information("Reload tracks"); - MySource.getTrackModel ().Reload (); - Hyena.Log.Information("Reloaded all"); - Hyena.Log.Information(MySource.getAlbumModel ().Count.ToString ()); - Hyena.Log.Information(MySource.getArtistModel ().Count.ToString ()); - Hyena.Log.Information(MySource.getGenreModel ().Count.ToString ()); - } catch(System.Exception e) { - Hyena.Log.Information (e.ToString()); - } - Hyena.Log.Information("Reloaded"); + GLib.Timeout.Add (500,delegate() { + if (_fill_ready || _fill_canceled) { + try { + Hyena.Log.Information("Reload albums"); + MySource.getAlbumModel ().Reload (); + Hyena.Log.Information("Reload artists"); + MySource.getArtistModel ().Reload (); + Hyena.Log.Information("Reload genres"); + MySource.getGenreModel ().Reload (); + Hyena.Log.Information("Reload tracks"); + MySource.getTrackModel ().Reload (); + Hyena.Log.Information("Reloaded all"); + Hyena.Log.Information(MySource.getAlbumModel ().Count.ToString ()); + Hyena.Log.Information(MySource.getArtistModel ().Count.ToString ()); + Hyena.Log.Information(MySource.getGenreModel ().Count.ToString ()); + } catch(System.Exception e) { + Hyena.Log.Information (e.ToString()); + } + Hyena.Log.Information("Reloaded"); + filling.Text=""; + bar.Remove (sep); + bar.Remove (cancel); + bar.Hide (); + return false; + } else { + return true; + } + }); } } @@ -453,7 +544,15 @@ namespace Banshee.CueSheets return true; } + public void setColumnSizes(CueSheet s) { + c_track.FixedWidth=MySource.getColumnWidth("track",s.id ()); + c_piece.FixedWidth=MySource.getColumnWidth("piece",s.id ()); + c_artist.FixedWidth=MySource.getColumnWidth("artist",s.id ()); + c_composer.FixedWidth=MySource.getColumnWidth("composer",s.id ()); + } + public void loadCueSheet(CueSheet s) { //,Gtk.ListStore store) { + setColumnSizes (s); CueSheet sheet=MySource.getSheet (); type="cuesheet"; sheet.Clear (); @@ -461,7 +560,13 @@ namespace Banshee.CueSheets store.Clear (); int i=0; for(i=0;i<sheet.nEntries ();i++) { - store.AppendValues (i+1,sheet.entry (i).title ()); + CueSheetEntry e=sheet.entry (i); + double l=e.length (); + int t=(int) (l*100.0); + int m=t/(60*100); + int secs=(t/100)%60; + string ln=String.Format ("{0:00}:{0:00}",m,secs); + store.AppendValues (i+1,e.title (),e.getPiece (),e.performer (),e.getComposer(),ln); } reLoad (); } @@ -478,29 +583,68 @@ namespace Banshee.CueSheets MySource.getArtistModel ().Reload (); } - public void ToggleGrid() { - bool grid=!MySource.getGridLayout (); + + public void ToggleGrid(string forId) { + Hyena.Log.Information ("ToggleGrid for id "+forId); + bool grid=!MySource.getGridLayout (forId); + Hyena.Log.Information ("Grid = "+grid); if (grid) { aview.EnableGrid (); } else { aview.DisableGrid (); } - MySource.setGridLayout (grid); + MySource.setGridLayout (forId,grid); + } + + public void ToggleGrid() { + ArtistInfo aa=MySource.getAlbumModel().filterArtist(); + GenreInfo gg=MySource.getAlbumModel().filterGenre(); + string a="@@allartist@@"; + if (aa!=null) { a=aa.Name; } + string g="@@allgenre@@"; + if (gg!=null) { g=gg.Genre; } + string id=a+"-"+g; + ToggleGrid(id); + } + + public void SetGrid() { + ArtistInfo aa=MySource.getAlbumModel().filterArtist(); + GenreInfo gg=MySource.getAlbumModel().filterGenre(); + string a="@@allartist@@"; + if (aa!=null) { a=aa.Name; } + string g="@@allgenre@@"; + if (gg!=null) { g=gg.Genre; } + string id=a+"-"+g; + Hyena.Log.Information ("SetGrid for id "+id); + bool grid=MySource.getGridLayout (id); + Hyena.Log.Information ("Grid = "+grid); + if (grid) { aview.EnableGrid (); } + else { aview.DisableGrid (); } } internal class MyAlbumListView : AlbumListView { private CustomView _view; + private bool _gridEnabled=true; public MyAlbumListView(CustomView view) : base() { _view=view; + _gridEnabled=base.GetAlbumGrid(); + Hyena.Log.Information ("grid enabled="+_gridEnabled); + EnableGrid (); } public void DisableGrid() { - base.DisabledAlbumGrid=true; + if (_gridEnabled) { + _gridEnabled=false; + base.SetAlbumGrid (true); + } } public void EnableGrid() { - base.DisabledAlbumGrid=false; + if (!_gridEnabled) { + _gridEnabled=true; + base.SetAlbumGrid (false); + } } protected override bool OnPopupMenu () { @@ -537,28 +681,71 @@ namespace Banshee.CueSheets return false; } } - + public CustomView(CueSheetsSource ms) { MySource=ms; basedir=MySource.getCueSheetDir (); - store = new Gtk.ListStore(typeof(int),typeof(string)); + store = new Gtk.ListStore(typeof(int),typeof(string),typeof(string),typeof(string),typeof(string),typeof(string)); view = new Gtk.TreeView(); - view.AppendColumn ("Nr.", new Gtk.CellRendererText (), "text", 0); - view.AppendColumn ("Track", new Gtk.CellRendererText (), "text", 1); + + Gtk.CellRendererText cr_txt=new Gtk.CellRendererText(); + cr_txt.Scale=0.8; + cr_txt.Ellipsize=Pango.EllipsizeMode.End; + + Gtk.CellRendererText cr_other=new Gtk.CellRendererText(); + cr_other.Scale=0.8; + + { + CueSheet s=MySource.getSheet (); + + view.AppendColumn ("Nr.", cr_other, "text", 0); + c_track=new Gtk.TreeViewColumn("Track",cr_txt,"text",1); + c_track.Sizing=Gtk.TreeViewColumnSizing.Fixed; + c_track.FixedWidth=MySource.getColumnWidth("track",s.id()); + c_track.Resizable=true; + c_track.AddNotification ("width",delegate(object o, GLib.NotifyArgs args) { + MySource.setColumnWidth ("track",s.id(),c_track.Width); + }); + view.AppendColumn (c_track); + + c_piece=new Gtk.TreeViewColumn("Piece",cr_txt,"text",2); + c_piece.FixedWidth=MySource.getColumnWidth("piece",s.id ()); + c_piece.Sizing=Gtk.TreeViewColumnSizing.Fixed; + c_piece.Resizable=true; + c_piece.AddNotification ("width",delegate(object o, GLib.NotifyArgs args) { + MySource.setColumnWidth ("piece",s.id (),c_piece.Width); + }); + view.AppendColumn (c_piece); + + c_artist=new Gtk.TreeViewColumn("Artist",cr_txt,"text",3); + c_artist.Sizing=Gtk.TreeViewColumnSizing.Fixed; + c_artist.FixedWidth=MySource.getColumnWidth("artist",s.id ()); + c_artist.AddNotification("width",delegate(object o, GLib.NotifyArgs args) { + MySource.setColumnWidth ("artist",s.id (),c_artist.Width); + }); + c_artist.Resizable=true; + view.AppendColumn (c_artist); + + c_composer=new Gtk.TreeViewColumn("Composer",cr_txt,"text",4); + c_composer.Sizing=Gtk.TreeViewColumnSizing.Fixed; + c_composer.FixedWidth=MySource.getColumnWidth("composer",s.id ()); + c_composer.AddNotification("width",delegate(object o, GLib.NotifyArgs args) { + MySource.setColumnWidth ("composer",s.id(),c_composer.Width); + }); + c_composer.Resizable=true; + view.AppendColumn (c_composer); + + view.AppendColumn ("length", cr_other, "text", 5); + } + view.CursorChanged += new EventHandler(EvtCursorChanged); view.RowActivated += new Gtk.RowActivatedHandler(EvtTrackRowActivated); view.Model = store; Hyena.Log.Information("New albumlist"); aview=new MyAlbumListView(this); - if (!MySource.getGridLayout ()) { - aview.DisableGrid (); - } else { - aview.EnableGrid (); - } - aaview=new MyArtistListView(); gview=new MyGenreListView(); Hyena.Log.Information("init models"); @@ -574,15 +761,15 @@ namespace Banshee.CueSheets gview.RowActivated+=new Hyena.Data.Gui.RowActivatedHandler<GenreInfo>(EvtGenreActivated); aaview.RowActivated+=new Hyena.Data.Gui.RowActivatedHandler<ArtistInfo>(EvtArtistActivated); - Gtk.Toolbar bar=new Gtk.Toolbar(); + bar=new Gtk.Toolbar(); if (basedir==null) { Hyena.Log.Information("basedir="+basedir); Gtk.Label lbl=new Gtk.Label(); lbl.Markup="<b>You need to configure the CueSheets music directory first, using the right mouse button on the extension</b>"; bar.Add (lbl); } - - fill (); + filling=new Gtk.Label(); + bar.Add (filling); ascroll=new Gtk.ScrolledWindow(); ascroll.Add (aview); @@ -619,6 +806,8 @@ namespace Banshee.CueSheets GLib.Timeout.Add ((uint) 1000,(GLib.TimeoutHandler) GardDividers); GLib.Timeout.Add ((uint) timeout,(GLib.TimeoutHandler) PositionDisplay); + + fill (); } void HandleAviewSelectionChanged (object sender, EventArgs e) { @@ -679,6 +868,7 @@ namespace Banshee.CueSheets if (MySource.getGenreModel ().isNullGenre (g)) { g=null; } MySource.getAlbumModel ().filterGenre(g); MySource.getArtistModel ().filterGenre(g); + SetGrid (); } public void EvtArtistActivated(object sender,RowActivatedArgs<ArtistInfo> args) { @@ -686,6 +876,7 @@ namespace Banshee.CueSheets ArtistInfo a=args.RowValue; if (MySource.getArtistModel ().isNullArtist (a)) { a=null; } MySource.getAlbumModel ().filterArtist(a); + SetGrid (); } public void EvtTrackRowActivated(object sender,Gtk.RowActivatedArgs args) { diff --git a/src/CueSheets/Banshee.CueSheets/GenreInfo.cs b/src/CueSheets/Banshee.CueSheets/GenreInfo.cs index 094d3f3..3e914c0 100644 --- a/src/CueSheets/Banshee.CueSheets/GenreInfo.cs +++ b/src/CueSheets/Banshee.CueSheets/GenreInfo.cs @@ -25,6 +25,8 @@ // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // using System; +using System.Collections.Generic; +using System.Collections; namespace Banshee.CueSheets { @@ -32,6 +34,13 @@ namespace Banshee.CueSheets { private string _genre; + public class Comparer : IComparer<GenreInfo> { + private CaseInsensitiveComparer cmp=new CaseInsensitiveComparer(); + public int Compare( GenreInfo g1,GenreInfo g2 ) { + return cmp.Compare (g1._genre,g2._genre); + } + } + public GenreInfo () { _genre=""; diff --git a/src/CueSheets/CueSheets.csproj b/src/CueSheets/CueSheets.csproj index 5afe470..2012cb0 100644 --- a/src/CueSheets/CueSheets.csproj +++ b/src/CueSheets/CueSheets.csproj @@ -79,6 +79,10 @@ <Private>False</Private> <Package>glib-sharp-2.0</Package> </Reference> + <Reference Include="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f"> + <Private>False</Private> + <Package>gtk-sharp-2.0</Package> + </Reference> </ItemGroup> <ItemGroup> <EmbeddedResource Include="CueSheets.addin.xml"> |