Example #1
0
        void OnDeleteButtonClicked(object sender, EventArgs args)
        {
            NoteWidget nWidget = sender as NoteWidget;

            try {
                task.Notes.Remove(nWidget.INote);
                targetVBox.Remove(nWidget);
            } catch (Exception e) {
                Logger.Debug("Unable to delete the note");
                Logger.Debug(e.ToString());
            }
        }
Example #2
0
        public override void SetLayout(Layout inner)
        {
            if (box.Children.Length > 0)
            {
                foreach (Gtk.Widget child in box.Children)
                {
                    box.Remove(child);
                }
            }
            IGtkLayout gtklayout       = (IGtkLayout)inner.Handler;
            var        containerWidget = (Gtk.Widget)gtklayout.ContainerObject;

            box.Add(containerWidget);
            containerWidget.ShowAll();
        }
Example #3
0
        public void SetMainMenu(IMenuBackend menu)
        {
            if (mainMenu != null)
            {
                mainBox.Remove(mainMenu);
            }

            if (menu != null)
            {
                MenuBackend m = (MenuBackend)menu;
                mainMenu = m.MenuBar;
                mainBox.PackStart(mainMenu, false, false, 0);
                ((Gtk.Box.BoxChild)mainBox[mainMenu]).Position = 0;
            }
            else
            {
                mainMenu = null;
            }
        }
        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 ();
        }
Example #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();
        }
Example #6
0
        public override void ApplyConfig(UserConfig config)
        {
            Trace.Call(config);

            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            base.ApplyConfig(config);

            // topic
            _TopicTextView.ApplyConfig(config);
            string topic_pos = (string)config["Interface/Notebook/Channel/TopicPosition"];

            if (_TopicScrolledWindow.IsAncestor(_OutputVBox))
            {
                _OutputVBox.Remove(_TopicScrolledWindow);
            }
            if (OutputScrolledWindow.IsAncestor(_OutputVBox))
            {
                _OutputVBox.Remove(OutputScrolledWindow);
            }
            if (topic_pos == "top")
            {
                _OutputVBox.PackStart(_TopicScrolledWindow, false, false, 2);
                _OutputVBox.PackStart(OutputScrolledWindow, true, true, 0);
            }
            else if (topic_pos == "bottom")
            {
                _OutputVBox.PackStart(OutputScrolledWindow, true, true, 0);
                _OutputVBox.PackStart(_TopicScrolledWindow, false, false, 2);
            }
            else if (topic_pos == "none")
            {
                _OutputVBox.PackStart(OutputScrolledWindow, true, true, 0);
            }
            else
            {
#if LOG4NET
                _Logger.Error("ApplyConfig(): unsupported value in Interface/Notebook/Channel/TopicPosition: " + topic_pos);
#endif
            }
            _OutputVBox.ShowAll();

            // person list
            if (ThemeSettings.BackgroundColor == null)
            {
                _PersonTreeView.ModifyBase(Gtk.StateType.Normal);
            }
            else
            {
                _PersonTreeView.ModifyBase(Gtk.StateType.Normal, ThemeSettings.BackgroundColor.Value);
            }
            if (ThemeSettings.ForegroundColor == null)
            {
                _PersonTreeView.ModifyText(Gtk.StateType.Normal);
            }
            else
            {
                _PersonTreeView.ModifyText(Gtk.StateType.Normal, ThemeSettings.ForegroundColor.Value);
            }
            _PersonTreeView.ModifyFont(ThemeSettings.FontDescription);

            string userlist_pos = (string)config["Interface/Notebook/Channel/UserListPosition"];
            if (userlist_pos == "left")
            {
                userlist_pos = "right";
            }
            if (_PersonTreeViewFrame.IsAncestor(_OutputHPaned))
            {
                _OutputHPaned.Remove(_PersonTreeViewFrame);
            }
            if (_OutputVBox.IsAncestor(_OutputHPaned))
            {
                _OutputHPaned.Remove(_OutputVBox);
            }
            if (userlist_pos == "left")
            {
                _OutputHPaned.Pack1(_PersonTreeViewFrame, false, true);
                _OutputHPaned.Pack2(_OutputVBox, true, true);
            }
            else if (userlist_pos == "right")
            {
                _OutputHPaned.Pack1(_OutputVBox, true, true);
                _OutputHPaned.Pack2(_PersonTreeViewFrame, false, true);
            }
            else if (userlist_pos == "none")
            {
                _OutputHPaned.Pack1(_OutputVBox, true, true);
            }
            else
            {
#if LOG4NET
                _Logger.Error("ApplyConfig(): unsupported value in Interface/Notebook/Channel/UserListPosition: " + userlist_pos);
#endif
            }
            _OutputHPaned.ShowAll();

            NickColors = (bool)config["Interface/Notebook/Channel/NickColors"];
        }
Example #7
0
        public override void ApplyConfig(UserConfig config)
        {
            Trace.Call(config);

            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            base.ApplyConfig(config);

            // topic
            _TopicTextView.ApplyConfig(config);
            // predict and set useful topic heigth
            Pango.Layout layout = _TopicTextView.CreatePangoLayout("Test Topic");
            int          lineWidth, lineHeigth;

            layout.GetPixelSize(out lineWidth, out lineHeigth);
            // use 2 lines + a bit extra as the topic heigth
            int bestHeigth = (lineHeigth * 2) + 5;

            _TopicTextView.HeightRequest       = bestHeigth;
            _TopicScrolledWindow.HeightRequest = bestHeigth;

            string topic_pos = (string)config["Interface/Notebook/Channel/TopicPosition"];

            if (_TopicScrolledWindow.IsAncestor(_OutputVBox))
            {
                _OutputVBox.Remove(_TopicScrolledWindow);
            }
            if (OutputScrolledWindow.IsAncestor(_OutputVBox))
            {
                _OutputVBox.Remove(OutputScrolledWindow);
            }
            if (topic_pos == "top")
            {
                _OutputVBox.PackStart(_TopicScrolledWindow, false, false, 2);
                _OutputVBox.PackStart(OutputScrolledWindow, true, true, 0);
            }
            else if (topic_pos == "bottom")
            {
                _OutputVBox.PackStart(OutputScrolledWindow, true, true, 0);
                _OutputVBox.PackStart(_TopicScrolledWindow, false, false, 2);
            }
            else if (topic_pos == "none")
            {
                _OutputVBox.PackStart(OutputScrolledWindow, true, true, 0);
            }
            else
            {
#if LOG4NET
                _Logger.Error("ApplyConfig(): unsupported value in Interface/Notebook/Channel/TopicPosition: " + topic_pos);
#endif
            }
            _OutputVBox.ShowAll();

            // person list
            if (ThemeSettings.BackgroundColor == null)
            {
                _PersonTreeView.ModifyBase(Gtk.StateType.Normal);
            }
            else
            {
                _PersonTreeView.ModifyBase(Gtk.StateType.Normal, ThemeSettings.BackgroundColor.Value);
            }
            if (ThemeSettings.ForegroundColor == null)
            {
                _PersonTreeView.ModifyText(Gtk.StateType.Normal);
            }
            else
            {
                _PersonTreeView.ModifyText(Gtk.StateType.Normal, ThemeSettings.ForegroundColor.Value);
            }
            _PersonTreeView.ModifyFont(ThemeSettings.FontDescription);

            string userlist_pos = (string)config["Interface/Notebook/Channel/UserListPosition"];
            if (_PersonTreeViewFrame.IsAncestor(_OutputHPaned))
            {
                _OutputHPaned.Remove(_PersonTreeViewFrame);
            }
            if (_OutputVBox.IsAncestor(_OutputHPaned))
            {
                _OutputHPaned.Remove(_OutputVBox);
            }
            if (userlist_pos == "left")
            {
                _OutputHPaned.Pack1(_PersonTreeViewFrame, false, false);
                _OutputHPaned.Pack2(_OutputVBox, true, true);
            }
            else if (userlist_pos == "right")
            {
                _OutputHPaned.Pack1(_OutputVBox, true, true);
                _OutputHPaned.Pack2(_PersonTreeViewFrame, false, false);
            }
            else if (userlist_pos == "none")
            {
                _OutputHPaned.Pack1(_OutputVBox, true, true);
            }
            else
            {
#if LOG4NET
                _Logger.Error("ApplyConfig(): unsupported value in Interface/Notebook/Channel/UserListPosition: " + userlist_pos);
#endif
            }
            _OutputHPaned.ShowAll();

            NickColors = (bool)config["Interface/Notebook/Channel/NickColors"];
        }