Ejemplo n.º 1
0
 protected override Gtk.Widget CreateWidget(WindowContext context)
 {
     Gtk.Toolbar toolbar = new Gtk.Toolbar();
     foreach(IWidgetBuilder builder in Childs)
     {
         toolbar.Add(builder.Build(context));
     }
     return toolbar;
 }
        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 ();
        }
Ejemplo n.º 3
0
        public override void HandleBuildToolBar(Gtk.Toolbar tb)
        {
            base.HandleBuildToolBar(tb);


            #region Show Arrows

            //Arrow separator.

            if (arrowSep == null)
            {
                arrowSep = new Gtk.SeparatorToolItem();

                showOtherArrowOptions = false;
            }

            tb.AppendItem(arrowSep);


            if (arrowLabel == null)
            {
                arrowLabel = new ToolBarLabel(string.Format(" {0}: ", Catalog.GetString("Arrow")));
            }

            tb.AppendItem(arrowLabel);


            //Show arrow 1.

            showArrowOneBox        = new Gtk.CheckButton("1");
            showArrowOneBox.Active = previousSettings1.Show;

            showArrowOneBox.Toggled += (o, e) =>
            {
                //Determine whether to change the visibility of Arrow options in the toolbar based on the updated Arrow showing/hiding.
                if (!showArrowOneBox.Active && !showArrowTwoBox.Active)
                {
                    if (showOtherArrowOptions)
                    {
                        tb.Remove(arrowSizeLabel);
                        tb.Remove(arrowSizeMinus);
                        tb.Remove(arrowSize);
                        tb.Remove(arrowSizePlus);
                        tb.Remove(arrowAngleOffsetLabel);
                        tb.Remove(arrowAngleOffsetMinus);
                        tb.Remove(arrowAngleOffset);
                        tb.Remove(arrowAngleOffsetPlus);
                        tb.Remove(arrowLengthOffsetLabel);
                        tb.Remove(arrowLengthOffsetMinus);
                        tb.Remove(arrowLengthOffset);
                        tb.Remove(arrowLengthOffsetPlus);

                        showOtherArrowOptions = false;
                    }
                }
                else
                {
                    if (!showOtherArrowOptions)
                    {
                        tb.Add(arrowSizeLabel);
                        tb.Add(arrowSizeMinus);
                        tb.Add(arrowSize);
                        tb.Add(arrowSizePlus);
                        tb.Add(arrowAngleOffsetLabel);
                        tb.Add(arrowAngleOffsetMinus);
                        tb.Add(arrowAngleOffset);
                        tb.Add(arrowAngleOffsetPlus);
                        tb.Add(arrowLengthOffsetLabel);
                        tb.Add(arrowLengthOffsetMinus);
                        tb.Add(arrowLengthOffset);
                        tb.Add(arrowLengthOffsetPlus);

                        showOtherArrowOptions = true;
                    }
                }

                LineCurveSeriesEngine activeEngine = (LineCurveSeriesEngine)ActiveShapeEngine;

                if (activeEngine != null)
                {
                    activeEngine.Arrow1.Show = showArrowOneBox.Active;

                    DrawActiveShape(false, false, true, false, false);

                    storePreviousSettings();
                }
            };

            tb.AddWidgetItem(showArrowOneBox);


            //Show arrow 2.

            showArrowTwoBox        = new Gtk.CheckButton("2");
            showArrowTwoBox.Active = previousSettings2.Show;

            showArrowTwoBox.Toggled += (o, e) =>
            {
                //Determine whether to change the visibility of Arrow options in the toolbar based on the updated Arrow showing/hiding.
                if (!showArrowOneBox.Active && !showArrowTwoBox.Active)
                {
                    if (showOtherArrowOptions)
                    {
                        tb.Remove(arrowSizeLabel);
                        tb.Remove(arrowSizeMinus);
                        tb.Remove(arrowSize);
                        tb.Remove(arrowSizePlus);
                        tb.Remove(arrowAngleOffsetLabel);
                        tb.Remove(arrowAngleOffsetMinus);
                        tb.Remove(arrowAngleOffset);
                        tb.Remove(arrowAngleOffsetPlus);
                        tb.Remove(arrowLengthOffsetLabel);
                        tb.Remove(arrowLengthOffsetMinus);
                        tb.Remove(arrowLengthOffset);
                        tb.Remove(arrowLengthOffsetPlus);

                        showOtherArrowOptions = false;
                    }
                }
                else
                {
                    if (!showOtherArrowOptions)
                    {
                        tb.Add(arrowSizeLabel);
                        tb.Add(arrowSizeMinus);
                        tb.Add(arrowSize);
                        tb.Add(arrowSizePlus);
                        tb.Add(arrowAngleOffsetLabel);
                        tb.Add(arrowAngleOffsetMinus);
                        tb.Add(arrowAngleOffset);
                        tb.Add(arrowAngleOffsetPlus);
                        tb.Add(arrowLengthOffsetLabel);
                        tb.Add(arrowLengthOffsetMinus);
                        tb.Add(arrowLengthOffset);
                        tb.Add(arrowLengthOffsetPlus);

                        showOtherArrowOptions = true;
                    }
                }

                LineCurveSeriesEngine activeEngine = (LineCurveSeriesEngine)ActiveShapeEngine;

                if (activeEngine != null)
                {
                    activeEngine.Arrow2.Show = showArrowTwoBox.Active;

                    DrawActiveShape(false, false, true, false, false);

                    storePreviousSettings();
                }
            };

            tb.AddWidgetItem(showArrowTwoBox);

            #endregion Show Arrows


            #region Arrow Size

            if (arrowSizeLabel == null)
            {
                arrowSizeLabel = new ToolBarLabel(string.Format(" {0}: ", Catalog.GetString("Size")));
            }

            if (arrowSizeMinus == null)
            {
                arrowSizeMinus          = new ToolBarButton("Toolbar.MinusButton.png", "", Catalog.GetString("Decrease arrow size"));
                arrowSizeMinus.Clicked += new EventHandler(arrowSizeMinus_Clicked);
            }

            if (arrowSize == null)
            {
                arrowSize = new ToolBarComboBox(65, 7, true,
                                                "3", "4", "5", "6", "7", "8", "9", "10", "12", "15", "18",
                                                "20", "25", "30", "40", "50", "60", "70", "80", "90", "100");

                arrowSize.ComboBox.Changed += (o, e) =>
                {
                    if (arrowSize.ComboBox.ActiveText.Length < 1)
                    {
                        //Ignore the change until the user enters something.
                        return;
                    }
                    else
                    {
                        double newSize = 10d;

                        if (arrowSize.ComboBox.ActiveText == "-")
                        {
                            //The user is trying to enter a negative value: change it to 1.
                            newSize = 1d;
                        }
                        else
                        {
                            if (Double.TryParse(arrowSize.ComboBox.ActiveText, out newSize))
                            {
                                if (newSize < 1d)
                                {
                                    //Less than 1: change it to 1.
                                    newSize = 1d;
                                }
                                else if (newSize > 100d)
                                {
                                    //Greater than 100: change it to 100.
                                    newSize = 100d;
                                }
                            }
                            else
                            {
                                //Not a number: wait until the user enters something.
                                return;
                            }
                        }

                        (arrowSize.ComboBox as Gtk.ComboBoxEntry).Entry.Text = newSize.ToString();

                        LineCurveSeriesEngine activeEngine = (LineCurveSeriesEngine)ActiveShapeEngine;

                        if (activeEngine != null)
                        {
                            activeEngine.Arrow1.ArrowSize = newSize;
                            activeEngine.Arrow2.ArrowSize = newSize;

                            DrawActiveShape(false, false, true, false, false);

                            storePreviousSettings();
                        }
                    }
                };
            }

            if (arrowSizePlus == null)
            {
                arrowSizePlus          = new ToolBarButton("Toolbar.PlusButton.png", "", Catalog.GetString("Increase arrow size"));
                arrowSizePlus.Clicked += new EventHandler(arrowSizePlus_Clicked);
            }

            #endregion Arrow Size


            #region Angle Offset

            if (arrowAngleOffsetLabel == null)
            {
                arrowAngleOffsetLabel = new ToolBarLabel(string.Format(" {0}: ", Catalog.GetString("Angle")));
            }

            if (arrowAngleOffsetMinus == null)
            {
                arrowAngleOffsetMinus          = new ToolBarButton("Toolbar.MinusButton.png", "", Catalog.GetString("Decrease angle offset"));
                arrowAngleOffsetMinus.Clicked += new EventHandler(arrowAngleOffsetMinus_Clicked);
            }

            if (arrowAngleOffset == null)
            {
                arrowAngleOffset = new ToolBarComboBox(65, 9, true,
                                                       "-30", "-25", "-20", "-15", "-10", "-5", "0", "5", "10", "15", "20", "25", "30");

                arrowAngleOffset.ComboBox.Changed += (o, e) =>
                {
                    if (arrowAngleOffset.ComboBox.ActiveText.Length < 1)
                    {
                        //Ignore the change until the user enters something.
                        return;
                    }
                    else if (arrowAngleOffset.ComboBox.ActiveText == "-")
                    {
                        //The user is trying to enter a negative value: ignore the change until the user enters more.
                        return;
                    }
                    else
                    {
                        double newAngle = 15d;

                        if (Double.TryParse(arrowAngleOffset.ComboBox.ActiveText, out newAngle))
                        {
                            if (newAngle < -89d)
                            {
                                //Less than -89: change it to -89.
                                newAngle = -89d;
                            }
                            else if (newAngle > 89d)
                            {
                                //Greater than 89: change it to 89.
                                newAngle = 89d;
                            }
                        }
                        else
                        {
                            //Not a number: wait until the user enters something.
                            return;
                        }

                        (arrowAngleOffset.ComboBox as Gtk.ComboBoxEntry).Entry.Text = newAngle.ToString();

                        LineCurveSeriesEngine activeEngine = (LineCurveSeriesEngine)ActiveShapeEngine;

                        if (activeEngine != null)
                        {
                            activeEngine.Arrow1.AngleOffset = newAngle;
                            activeEngine.Arrow2.AngleOffset = newAngle;

                            DrawActiveShape(false, false, true, false, false);

                            storePreviousSettings();
                        }
                    }
                };
            }

            if (arrowAngleOffsetPlus == null)
            {
                arrowAngleOffsetPlus          = new ToolBarButton("Toolbar.PlusButton.png", "", Catalog.GetString("Increase angle offset"));
                arrowAngleOffsetPlus.Clicked += new EventHandler(arrowAngleOffsetPlus_Clicked);
            }

            #endregion Angle Offset


            #region Length Offset

            if (arrowLengthOffsetLabel == null)
            {
                arrowLengthOffsetLabel = new ToolBarLabel(string.Format(" {0}: ", Catalog.GetString("Length")));
            }

            if (arrowLengthOffsetMinus == null)
            {
                arrowLengthOffsetMinus          = new ToolBarButton("Toolbar.MinusButton.png", "", Catalog.GetString("Decrease length offset"));
                arrowLengthOffsetMinus.Clicked += new EventHandler(arrowLengthOffsetMinus_Clicked);
            }

            if (arrowLengthOffset == null)
            {
                arrowLengthOffset = new ToolBarComboBox(65, 8, true,
                                                        "-30", "-25", "-20", "-15", "-10", "-5", "0", "5", "10", "15", "20", "25", "30");

                arrowLengthOffset.ComboBox.Changed += (o, e) =>
                {
                    if (arrowLengthOffset.ComboBox.ActiveText.Length < 1)
                    {
                        //Ignore the change until the user enters something.
                        return;
                    }
                    else if (arrowLengthOffset.ComboBox.ActiveText == "-")
                    {
                        //The user is trying to enter a negative value: ignore the change until the user enters more.
                        return;
                    }
                    else
                    {
                        double newLength = 10d;

                        if (Double.TryParse(arrowLengthOffset.ComboBox.ActiveText, out newLength))
                        {
                            if (newLength < -100d)
                            {
                                //Less than -100: change it to -100.
                                newLength = -100d;
                            }
                            else if (newLength > 100d)
                            {
                                //Greater than 100: change it to 100.
                                newLength = 100d;
                            }
                        }
                        else
                        {
                            //Not a number: wait until the user enters something.
                            return;
                        }

                        (arrowLengthOffset.ComboBox as Gtk.ComboBoxEntry).Entry.Text = newLength.ToString();

                        LineCurveSeriesEngine activeEngine = (LineCurveSeriesEngine)ActiveShapeEngine;

                        if (activeEngine != null)
                        {
                            activeEngine.Arrow1.LengthOffset = newLength;
                            activeEngine.Arrow2.LengthOffset = newLength;

                            DrawActiveShape(false, false, true, false, false);

                            storePreviousSettings();
                        }
                    }
                };
            }

            if (arrowLengthOffsetPlus == null)
            {
                arrowLengthOffsetPlus          = new ToolBarButton("Toolbar.PlusButton.png", "", Catalog.GetString("Increase length offset"));
                arrowLengthOffsetPlus.Clicked += new EventHandler(arrowLengthOffsetPlus_Clicked);
            }

            #endregion Length Offset


            if (showOtherArrowOptions)
            {
                tb.Add(arrowSizeLabel);
                tb.Add(arrowSizeMinus);
                tb.Add(arrowSize);
                tb.Add(arrowSizePlus);
                tb.Add(arrowAngleOffsetLabel);
                tb.Add(arrowAngleOffsetMinus);
                tb.Add(arrowAngleOffset);
                tb.Add(arrowAngleOffsetPlus);
                tb.Add(arrowLengthOffsetLabel);
                tb.Add(arrowLengthOffsetMinus);
                tb.Add(arrowLengthOffset);
                tb.Add(arrowLengthOffsetPlus);
            }
        }
Ejemplo n.º 4
0
        public static void Main(string[] args)
        {
            Gtk.Application.Init();

            string method;
            if (args.Length < 1)
                method = "train";
            else
                method = args[0];

            StrongClassifier? classifier;
            if (method == "load")
                classifier = StrongClassifier.LoadFromFile(args[1]);
            else if (method == "train") {
                string trainingDir = args[1];

                classifier = StrongClassifier.Train(trainingDir);

                if (args.Length > 2)
                    classifier.Value.Save(args[2]);
            }

            var win = new Gtk.Window("Détecteur de visages");
            win.DefaultHeight = 350;
            win.DefaultWidth = 400;

            var toolbar = new Gtk.Toolbar();
            var openButton = new Gtk.ToolButton(Gtk.Stock.Open);
            toolbar.Add(openButton);

            var image = new Gtk.Image();

            openButton.Clicked += (sender, eventArgs) => {
                var fileDialog = new Gtk.FileChooserDialog("Choisissez une photo", null, Gtk.FileChooserAction.Open,
                                                           "Open", Gtk.ResponseType.Accept);
                fileDialog.Run();

                var photo = new Gdk.Pixbuf(fileDialog.Filename);
                fileDialog.Destroy();

            //				var photo = new Gdk.Pixbuf("/home/rapha/Bureau/300px-Thief_-_Radiohead.jpg");
            //				var photo = new IntegralImage("/home/rapha/Bureau/The_Beatles_Abbey_Road.jpg").Pixbuf;

                var detector = new Detector(photo, classifier.Value);

                foreach (var rect in detector.Detect()) {
                    rect.Draw(photo);
                    Console.WriteLine(rect);
                }

                image.Pixbuf = photo;
            };

            var vbox = new Gtk.VBox();
            vbox.PackStart(toolbar, false, false, 0);
            vbox.PackStart(image, true, true, 0);

            win.Add(vbox);
            win.ShowAll();

            Gtk.Application.Run();
        }
Ejemplo n.º 5
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();
        }
Ejemplo n.º 6
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);
             }
         });
     }
 }
Ejemplo n.º 7
0
        private void ConstructToolbarMain()
        {
            Debug.WriteLine("ConstructToolbarMain");
            ConstructToolButtonNew();
            ConstructToolButtonOpen();
            ConstructToolButtonSave();
            ConstructToolButtonClose();
            ConstructSeparatorToolItem1();
            ConstructToolButtonUndo();
            ConstructToolButtonRedo();
            ConstructSeparatorToolItem2();
            ConstructToolButtonCut();
            ConstructToolButtonCopy();
            ConstructToolButtonPaste();
            ConstructSeparatorToolItem3();
            ConstructToolButtonQuit();

            toolbarMain = new Gtk.Toolbar
            {
                Name = "toolbarMain",
                Visible = true,
                Tooltips = true,
            };

            toolbarMain.Add(toolButtonNew);
            toolbarMain.Add(toolButtonOpen);
            toolbarMain.Add(toolButtonSave);
            toolbarMain.Add(toolButtonClose);
            toolbarMain.Add(separatorToolItem1);
            toolbarMain.Add(toolButtonUndo);
            toolbarMain.Add(toolButtonRedo);
            toolbarMain.Add(separatorToolItem2);
            toolbarMain.Add(toolButtonCut);
            toolbarMain.Add(toolButtonCopy);
            toolbarMain.Add(toolButtonPaste);
            toolbarMain.Add(separatorToolItem3);
            toolbarMain.Add(toolButtonQuit);
        }