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()); Gdk.Pixbuf pb = new Gdk.Pixbuf(_sheet.imageFullFileName(), 100, 100); _image.Pixbuf = pb; } catch (System.Exception e) { Hyena.Log.Information(e.ToString()); } _store.Clear(); int i, N; for (i = 0, N = _sheet.nEntries(); i < N; i++) { double b = _sheet.entry(i).offset(); int m, s, hs, t; t = (int)(b * 100.0); hs = t % 100; m = t / (100 * 60); s = (t / 100) % 60; 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(), _sheet.entry(i).performer(), _sheet.entry(i).getComposer(), _sheet.entry(i).getPiece(), offset); } }
public void createGui() { basedir_section = new Section("cuesheets-basedir", "CueSheet Music Directory:", 20); source_page.Add(basedir_section); string dir = _source.getCueSheetDir(); Gtk.Label lbl = new Gtk.Label("CueSheet Music Directory:"); Gtk.FileChooserButton btn = new Gtk.FileChooserButton("CueSheet Music Directory:", Gtk.FileChooserAction.SelectFolder); if (dir != null) { btn.SelectFilename(dir); } Gtk.HBox box = new Gtk.HBox(); box.Add(lbl); box.Add(btn); box.ShowAll(); 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); Gtk.VBox vb = new Gtk.VBox(); vb.PackStart(box, false, false, 0); Gtk.Image icn_about = new Gtk.Image(Gtk.Stock.About, Gtk.IconSize.Button); Gtk.Button about = new Gtk.Button(icn_about); about.Clicked += new EventHandler(handleAbout); Gtk.HBox hb = new Gtk.HBox(); Gtk.Label _about = new Gtk.Label("About the CueSheet extension"); hb.PackEnd(about, false, false, 0); hb.PackEnd(_about, false, false, 5); vb.PackStart(hb, false, false, 0); Gtk.HBox hb1 = new Gtk.HBox(); Gtk.Label _info = new Gtk.Label("How to use the Cuesheet extension (opens browser)"); Gtk.Image icn_info = new Gtk.Image(Gtk.Stock.Info, Gtk.IconSize.Button); Gtk.Button btn_info = new Gtk.Button(icn_info); btn_info.Clicked += new EventHandler(handleInfo); hb1.PackEnd(btn_info, false, false, 0); hb1.PackEnd(_info, false, false, 5); vb.PackStart(hb1, false, false, 0); Gtk.HBox hbX = new Gtk.HBox(); vb.PackEnd(hbX, true, true, 0); vb.ShowAll(); source_page.DisplayWidget = vb; }
public void createGui() { basedir_section=new Section("cuesheets-basedir","CueSheet Music Directory:",20); source_page.Add (basedir_section); string dir=_source.getCueSheetDir(); Gtk.Label lbl=new Gtk.Label("CueSheet Music Directory:"); Gtk.FileChooserButton btn=new Gtk.FileChooserButton("CueSheet Music Directory:",Gtk.FileChooserAction.SelectFolder); if (dir!=null) { btn.SelectFilename (dir); } Gtk.HBox box=new Gtk.HBox(); box.Add (lbl); box.Add (btn); box.ShowAll (); 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); Gtk.VBox vb=new Gtk.VBox(); vb.PackStart (box,false,false,0); Gtk.Image icn_about=new Gtk.Image(Gtk.Stock.About,Gtk.IconSize.Button); Gtk.Button about=new Gtk.Button(icn_about); about.Clicked+=new EventHandler(handleAbout); Gtk.HBox hb=new Gtk.HBox(); Gtk.Label _about=new Gtk.Label("About the CueSheet extension"); hb.PackEnd (about,false,false,0); hb.PackEnd (_about,false,false,5); vb.PackStart (hb,false,false,0); Gtk.HBox hb1=new Gtk.HBox(); Gtk.Label _info=new Gtk.Label("How to use the Cuesheet extension (opens browser)"); Gtk.Image icn_info=new Gtk.Image(Gtk.Stock.Info,Gtk.IconSize.Button); Gtk.Button btn_info=new Gtk.Button(icn_info); btn_info.Clicked+=new EventHandler(handleInfo); hb1.PackEnd(btn_info,false,false,0); hb1.PackEnd(_info,false,false,5); vb.PackStart (hb1,false,false,0); Gtk.HBox hbX=new Gtk.HBox(); vb.PackEnd (hbX,true,true,0); vb.ShowAll (); source_page.DisplayWidget = vb; }
private void CreateGui() { Gtk.FileChooserButton fc = new Gtk.FileChooserButton("Choose directory to put your splitted files", Gtk.FileChooserAction.SelectFolder); string fn = Banshee.Configuration.ConfigurationClient.Get <string>("cuesheets_todevice", ""); if (fn != "") { fc.SelectFilename(fn); } fc.FileSet += new EventHandler(delegate(Object sender, EventArgs args) { fn = fc.Filename; Banshee.Configuration.ConfigurationClient.Set <string>("cuesheets_todevice", fn); }); Gtk.Button btn = new Gtk.Button("Split CueSheet Audio File"); Gtk.Button csplit = new Gtk.Button("Cancel"); csplit.Clicked += delegate(object sender, EventArgs args) { _splt.CancelSplit(); }; Gtk.ProgressBar bar = new Gtk.ProgressBar(); Gtk.ProgressBar nr = new Gtk.ProgressBar(); Gtk.Button ok = (Gtk.Button)base.AddButton("OK", 1); Gtk.Label result = new Gtk.Label("-"); btn.Clicked += delegate(object sender, EventArgs args) { btn.Hide(); csplit.Show(); result.Markup = ""; ok.Sensitive = false; fc.Sensitive = false; btn.Sensitive = false; _splt.SplitWithPaths(); bool convert_to_latin1 = true; _splt.SplitToDir(fn, convert_to_latin1); GLib.Timeout.Add(50, delegate() { bar.Fraction = _splt.ProgressOfCurrentTrack; int n = _splt.ProgressNTracks; int i = _splt.ProgressCurrentTrack; double d = ((double)i) / ((double)n); nr.Fraction = d; if (_splt.SplitFinished) { ok.Sensitive = true; btn.Sensitive = true; fc.Sensitive = true; csplit.Hide(); btn.Show(); if (_splt.Cancelled) { result.Markup = "<b>Split Cancelled</b>"; } else { result.Markup = "<b>Finished</b>"; } } return(!_splt.SplitFinished); }); }; fc.Show(); nr.Show(); bar.Show(); btn.Show(); result.Show(); base.VBox.Add(fc); base.VBox.Add(hsep()); base.VBox.Add(nr); base.VBox.Add(bar); base.VBox.Add(hsep()); base.VBox.Add(result); base.VBox.Add(hsep()); base.VBox.Add(btn); base.VBox.Add(csplit); base.VBox.Show(); }
private void CreateGui() { Gtk.FileChooserButton fc=new Gtk.FileChooserButton("Choose directory to put your splitted files",Gtk.FileChooserAction.SelectFolder); string fn=Banshee.Configuration.ConfigurationClient.Get<string>("cuesheets_todevice",""); if (fn!="") { fc.SelectFilename(fn); } fc.FileSet+=new EventHandler(delegate(Object sender,EventArgs args) { fn=fc.Filename; Banshee.Configuration.ConfigurationClient.Set<string>("cuesheets_todevice",fn); }); Gtk.Button btn=new Gtk.Button("Split CueSheet Audio File"); Gtk.Button csplit=new Gtk.Button("Cancel"); csplit.Clicked+=delegate(object sender,EventArgs args) { _splt.CancelSplit(); }; Gtk.ProgressBar bar=new Gtk.ProgressBar(); Gtk.ProgressBar nr=new Gtk.ProgressBar(); Gtk.Button ok=(Gtk.Button) base.AddButton ("OK",1); Gtk.Label result=new Gtk.Label("-"); btn.Clicked+=delegate(object sender,EventArgs args) { btn.Hide (); csplit.Show (); result.Markup=""; ok.Sensitive=false; fc.Sensitive=false; btn.Sensitive=false; _splt.SplitWithPaths (); bool convert_to_latin1=true; _splt.SplitToDir (fn,convert_to_latin1); GLib.Timeout.Add(50,delegate () { bar.Fraction=_splt.ProgressOfCurrentTrack; int n=_splt.ProgressNTracks; int i=_splt.ProgressCurrentTrack; double d=((double) i)/((double) n); nr.Fraction=d; if (_splt.SplitFinished) { ok.Sensitive=true; btn.Sensitive=true; fc.Sensitive=true; csplit.Hide (); btn.Show (); if (_splt.Cancelled) { result.Markup="<b>Split Cancelled</b>"; } else { result.Markup="<b>Finished</b>"; } } return !_splt.SplitFinished; }); }; fc.Show (); nr.Show (); bar.Show (); btn.Show (); result.Show (); base.VBox.Add (fc); base.VBox.Add (hsep()); base.VBox.Add (nr); base.VBox.Add (bar); base.VBox.Add (hsep ()); base.VBox.Add (result); base.VBox.Add (hsep ()); base.VBox.Add (btn); base.VBox.Add (csplit); base.VBox.Show(); }