Beispiel #1
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();
        }
        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 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);
         GLib.Timeout.Add(500, delegate() {
             if (_fill_ready || _fill_canceled)
             {
                 try {
                     Hyena.Log.Information("Reload albums");
                     MySource.getAlbumModel().Reload();
                     Hyena.Log.Information(MySource.getAlbumModel().Count.ToString());
                     Hyena.Log.Information("Reload artists");
                     MySource.getArtistModel().Reload();
                     Hyena.Log.Information(MySource.getArtistModel().Count.ToString());
                     Hyena.Log.Information("Reload composers");
                     MySource.getComposerModel().Reload();
                     Hyena.Log.Information(MySource.getComposerModel().Count.ToString());
                     Hyena.Log.Information("Reload genres");
                     MySource.getGenreModel().Reload();
                     Hyena.Log.Information(MySource.getGenreModel().Count.ToString());
                     Hyena.Log.Information("Reload tracks");
                     MySource.getTrackModel().Reload();
                     Hyena.Log.Information("Reload play lists");
                     MySource.getPlayListsModel().Reload();
                     Hyena.Log.Information("Reloaded all");
                 } catch (System.Exception e) {
                     Hyena.Log.Information(e.ToString());
                 }
                 Hyena.Log.Information("Reloaded");
                 filling.Text = "";
                 bar.Remove(sep);
                 bar.Remove(cancel);
                 bar.Hide();
                 FillLibrary();
                 return(false);
             }
             else
             {
                 return(true);
             }
         });
     }
 }