Beispiel #1
0
 public void seekSong(int i)
 {
     Hyena.Log.Information("SeekSong called " + i);
     try {
         CueSheet sheet = MySource.getSheet();
         if (sheet.Count == 0)
         {
             if (_selected != null)
             {
                 loadCueSheet(_selected);
             }
         }
         CueSheetEntry e = sheet.entry(i);
         _song_id = e.id();
         if (_song_file != e.file())
         {
             ServiceManager.PlayerEngine.Open(e);
             ServiceManager.PlayerEngine.Play();
             _song_file = e.file();
         }
         double offset = e.offset();
         //ServiceManager.PlayerEngine.SetCurrentTrack(e);
         _position     = (uint)(offset * 1000.0);
         _set_position = true;
         mscount       = chgcount - (1000 / timeout);
     } catch (SystemException ex) {
         Hyena.Log.Information(ex.ToString());
     }
 }
        public CueSheetsView(CueSheetsSource ms)
        {
            MySource=ms;

            basedir=MySource.getCueSheetDir ();

            store = new CS_TrackListModel();
            view  = new CS_TrackListView(this);

            {
                ColumnController colc=view.ColumnController;
                int i,N;
                for(i=0,N=colc.Count;i<N;i++) {
                    CS_Column col=(CS_Column) colc[i];
                    col.WidthChanged+=delegate(object sender,EventArgs args) {
                        Hyena.Log.Information ("set-column-sizes="+_set_column_sizes);
                        if (_set_column_sizes<=0) {
                            _set_column_sizes=0;
                            MySource.setColumnWidth (col.id(),MySource.getSheet ().id (),col.Width);
                        } else {
                            _set_column_sizes-=1;
                        }
                    };
                }
            }

            view.SetModel(store);
            this.setColumnSizes(null);

            Hyena.Log.Information("New albumlist");
            aview=new CS_AlbumListView(this);
            aaview=new CS_ArtistListView();
            ccview=new CS_ComposerListView();
            gview=new CS_GenreListView();
            try {
            plsview=new CS_PlayListsView(this);
            } catch (System.Exception ex) {
                Hyena.Log.Error (ex.ToString ());
            }

            Hyena.Log.Information("init models");
            aview.SetModel (MySource.getAlbumModel ());
            aaview.SetModel (MySource.getArtistModel ());
            gview.SetModel (MySource.getGenreModel ());
            ccview.SetModel (MySource.getComposerModel());
            plsview.SetModel(MySource.getPlayListsModel());

            plsadmin=new CS_PlayListAdmin(plsview,MySource.getPlayListsModel(),MySource.getPlayListCollection());

            MySource.getGenreModel();
            Hyena.Log.Information("model albumlist");
            Hyena.Log.Information("albumlist initialized");

            aview.RowActivated+=new Hyena.Data.Gui.RowActivatedHandler<AlbumInfo>(EvtRowActivated);
            aview.Selection.Changed += HandleAviewSelectionChanged;
            gview.RowActivated+=new Hyena.Data.Gui.RowActivatedHandler<CS_GenreInfo>(EvtGenreActivated);
            aaview.RowActivated+=new Hyena.Data.Gui.RowActivatedHandler<ArtistInfo>(EvtArtistActivated);
            ccview.RowActivated+=new Hyena.Data.Gui.RowActivatedHandler<CS_ComposerInfo>(EvtComposerActivated);
            plsview.RowActivated+=new Hyena.Data.Gui.RowActivatedHandler<CS_PlayList>(EvtPlayListActivated);
            view.RowActivated+=new RowActivatedHandler<CueSheetEntry>(EvtTrackRowActivated);

            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);
            }
            filling=new Gtk.Label();
            bar.Add (filling);

            ascroll=new Gtk.ScrolledWindow();
            ascroll.Add (aview);
            aascroll=new Gtk.ScrolledWindow();
            aascroll.Add (aaview);
            tscroll=new Gtk.ScrolledWindow();
            tscroll.Add (view);
            gscroll=new Gtk.ScrolledWindow();
            gscroll.Add (gview);
            ccscroll=new Gtk.ScrolledWindow();
            ccscroll.Add(ccview);

            bool view_artist=true;
            Gtk.VBox vac=new Gtk.VBox();
            Gtk.Button vab=new Gtk.Button("Artists");
            vab.Clicked+=delegate(object sender,EventArgs args) {
                if (view_artist) {
                    view_artist=false;
                    vab.Label="Composers";
                    vac.Remove (aascroll);
                    vac.PackEnd (ccscroll);
                    ccscroll.ShowAll ();
                } else {
                    view_artist=true;
                    vab.Label="Artists";
                    vac.Remove (ccscroll);
                    vac.PackEnd (aascroll);
                    aascroll.ShowAll ();
                }
            };
            vac.PackStart (vab,false,false,0);
            vac.PackEnd (aascroll);

            hb=new Gtk.HPaned();
            hb.Add(gscroll);
            hb.Add (vac);
            hb1=new Gtk.HPaned();
            hb1.Add (hb);
            hb1.Add (ascroll);

            vp=new Gtk.VPaned();
            vp.Add (hb1);
            vp.Add (tscroll);

            Gtk.HPaned hppls=new Gtk.HPaned();
            hppls.Add1 (vp);
            hppls.Add2 (plsadmin);
            hbpls=hppls;

            {
                int hb_pls,hb_p,hb1_p,vp_p;
                MySource.getPositions (out hb_pls,out hb_p,out hb1_p,out vp_p);
                hppls.Position=hb_pls;
                hb.Position=hb_p;
                hb1.Position=hb1_p;
                vp.Position=vp_p;
            }

            box   = new Gtk.VBox();
            box.PackStart (bar,false,true,0);
            box.PackStart (hppls);
            box.ShowAll();

            GLib.Timeout.Add ((uint) 1000,(GLib.TimeoutHandler) GardDividers);
            GLib.Timeout.Add ((uint) timeout,(GLib.TimeoutHandler) PositionDisplay);

            fill ();
        }
Beispiel #3
0
        public CueSheetsView(CueSheetsSource ms)
        {
            MySource = ms;

            basedir = MySource.getCueSheetDir();

            store = new CS_TrackListModel();
            view  = new CS_TrackListView(this);

            {
                ColumnController colc = view.ColumnController;
                int i, N;
                for (i = 0, N = colc.Count; i < N; i++)
                {
                    CS_Column col = (CS_Column)colc[i];
                    col.WidthChanged += delegate(object sender, EventArgs args) {
                        Hyena.Log.Information("set-column-sizes=" + _set_column_sizes);
                        if (_set_column_sizes <= 0)
                        {
                            _set_column_sizes = 0;
                            MySource.setColumnWidth(col.id(), MySource.getSheet().id(), col.Width);
                        }
                        else
                        {
                            _set_column_sizes -= 1;
                        }
                    };
                }
            }

            view.SetModel(store);
            this.setColumnSizes(null);

            Hyena.Log.Information("New albumlist");
            aview  = new CS_AlbumListView(this);
            aaview = new CS_ArtistListView();
            ccview = new CS_ComposerListView();
            gview  = new CS_GenreListView();
            try {
                plsview = new CS_PlayListsView(this);
            } catch (System.Exception ex) {
                Hyena.Log.Error(ex.ToString());
            }

            Hyena.Log.Information("init models");
            aview.SetModel(MySource.getAlbumModel());
            aaview.SetModel(MySource.getArtistModel());
            gview.SetModel(MySource.getGenreModel());
            ccview.SetModel(MySource.getComposerModel());
            plsview.SetModel(MySource.getPlayListsModel());

            plsadmin = new CS_PlayListAdmin(plsview, MySource.getPlayListsModel(), MySource.getPlayListCollection());

            MySource.getGenreModel();
            Hyena.Log.Information("model albumlist");
            Hyena.Log.Information("albumlist initialized");

            aview.RowActivated      += new Hyena.Data.Gui.RowActivatedHandler <AlbumInfo>(EvtRowActivated);
            aview.Selection.Changed += HandleAviewSelectionChanged;
            gview.RowActivated      += new Hyena.Data.Gui.RowActivatedHandler <CS_GenreInfo>(EvtGenreActivated);
            aaview.RowActivated     += new Hyena.Data.Gui.RowActivatedHandler <ArtistInfo>(EvtArtistActivated);
            ccview.RowActivated     += new Hyena.Data.Gui.RowActivatedHandler <CS_ComposerInfo>(EvtComposerActivated);
            plsview.RowActivated    += new Hyena.Data.Gui.RowActivatedHandler <CS_PlayList>(EvtPlayListActivated);
            view.RowActivated       += new RowActivatedHandler <CueSheetEntry>(EvtTrackRowActivated);

            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);
            }
            filling = new Gtk.Label();
            bar.Add(filling);

            ascroll = new Gtk.ScrolledWindow();
            ascroll.Add(aview);
            aascroll = new Gtk.ScrolledWindow();
            aascroll.Add(aaview);
            tscroll = new Gtk.ScrolledWindow();
            tscroll.Add(view);
            gscroll = new Gtk.ScrolledWindow();
            gscroll.Add(gview);
            ccscroll = new Gtk.ScrolledWindow();
            ccscroll.Add(ccview);

            bool view_artist = true;

            Gtk.VBox   vac = new Gtk.VBox();
            Gtk.Button vab = new Gtk.Button("Artists");
            vab.Clicked += delegate(object sender, EventArgs args) {
                if (view_artist)
                {
                    view_artist = false;
                    vab.Label   = "Composers";
                    vac.Remove(aascroll);
                    vac.PackEnd(ccscroll);
                    ccscroll.ShowAll();
                }
                else
                {
                    view_artist = true;
                    vab.Label   = "Artists";
                    vac.Remove(ccscroll);
                    vac.PackEnd(aascroll);
                    aascroll.ShowAll();
                }
            };
            vac.PackStart(vab, false, false, 0);
            vac.PackEnd(aascroll);

            hb = new Gtk.HPaned();
            hb.Add(gscroll);
            hb.Add(vac);
            hb1 = new Gtk.HPaned();
            hb1.Add(hb);
            hb1.Add(ascroll);

            vp = new Gtk.VPaned();
            vp.Add(hb1);
            vp.Add(tscroll);

            Gtk.HPaned hppls = new Gtk.HPaned();
            hppls.Add1(vp);
            hppls.Add2(plsadmin);
            hbpls = hppls;

            {
                int hb_pls, hb_p, hb1_p, vp_p;
                MySource.getPositions(out hb_pls, out hb_p, out hb1_p, out vp_p);
                hppls.Position = hb_pls;
                hb.Position    = hb_p;
                hb1.Position   = hb1_p;
                vp.Position    = vp_p;
            }


            box = new Gtk.VBox();
            box.PackStart(bar, false, true, 0);
            box.PackStart(hppls);
            box.ShowAll();

            GLib.Timeout.Add((uint)1000, (GLib.TimeoutHandler)GardDividers);
            GLib.Timeout.Add((uint)timeout, (GLib.TimeoutHandler)PositionDisplay);

            fill();
        }