Ejemplo n.º 1
0
        IEnumerable <Widget> IOutlinedDocument.GetToolbarWidgets()
        {
            if (toolbarWidgets != null)
            {
                return(toolbarWidgets);
            }

            var groupToggleButton = new ToggleButton {
                Image       = new ImageView(Ide.Gui.Stock.GroupByCategory, IconSize.Menu),
                TooltipText = GettextCatalog.GetString("Group entries by type"),
                Active      = settings.IsGrouped,
            };

            groupToggleButton.Toggled += delegate {
                if (groupToggleButton.Active == settings.IsGrouped)
                {
                    return;
                }
                settings.IsGrouped = groupToggleButton.Active;
                UpdateSorting();
            };

            var sortAlphabeticallyToggleButton = new ToggleButton {
                Image       = new ImageView(Ide.Gui.Stock.SortAlphabetically, IconSize.Menu),
                TooltipText = GettextCatalog.GetString("Sort entries alphabetically"),
                Active      = settings.IsSorted,
            };

            sortAlphabeticallyToggleButton.Toggled += delegate {
                if (sortAlphabeticallyToggleButton.Active == settings.IsSorted)
                {
                    return;
                }
                settings.IsSorted = sortAlphabeticallyToggleButton.Active;
                UpdateSorting();
            };

            var preferencesButton = new DockToolButton(Ide.Gui.Stock.Options)
            {
                TooltipText = GettextCatalog.GetString("Open preferences dialog"),
            };

            preferencesButton.Clicked += delegate {
                using (var dialog = new OutlineSortingPreferencesDialog(settings)) {
                    if (MonoDevelop.Ide.MessageService.ShowCustomDialog(dialog) == (int)Gtk.ResponseType.Ok)
                    {
                        dialog.SaveSettings();
                        comparer = new OutlineNodeComparer(new AstAmbience(IdeApp.TypeSystemService.Workspace.Options), settings, outlineTreeModelSort);
                        UpdateSorting();
                    }
                }
            };

            return(toolbarWidgets = new Widget [] {
                groupToggleButton,
                sortAlphabeticallyToggleButton,
                new VSeparator(),
                preferencesButton,
            });
        }
		IEnumerable<Widget> IOutlinedDocument.GetToolbarWidgets ()
		{
			if (toolbarWidgets != null)
				return toolbarWidgets;
			
			var groupToggleButton = new ToggleButton {
				Image = new ImageView (Ide.Gui.Stock.GroupByCategory, IconSize.Menu),
				TooltipText = GettextCatalog.GetString ("Group entries by type"),
				Active = settings.IsGrouped,
			};	
			groupToggleButton.Toggled += delegate {
				if (groupToggleButton.Active == settings.IsGrouped)
					return;
				settings.IsGrouped = groupToggleButton.Active;
				UpdateSorting ();
			};

			var sortAlphabeticallyToggleButton = new ToggleButton {
				Image = new ImageView (Ide.Gui.Stock.SortAlphabetically, IconSize.Menu),
				TooltipText = GettextCatalog.GetString ("Sort entries alphabetically"),
				Active = settings.IsSorted,
			};	
			sortAlphabeticallyToggleButton.Toggled += delegate {
				if (sortAlphabeticallyToggleButton.Active == settings.IsSorted)
					return;
				settings.IsSorted = sortAlphabeticallyToggleButton.Active;
				UpdateSorting ();
			};

			var preferencesButton = new DockToolButton (Ide.Gui.Stock.Options) {
				TooltipText = GettextCatalog.GetString ("Open preferences dialog"),
			};
			preferencesButton.Clicked += delegate {
				using (var dialog = new OutlineSortingPreferencesDialog (settings)) {
					if (MonoDevelop.Ide.MessageService.ShowCustomDialog (dialog) == (int)Gtk.ResponseType.Ok) {
						dialog.SaveSettings ();
						comparer = new OutlineNodeComparer (new AstAmbience (TypeSystemService.Workspace.Options), settings, outlineTreeModelSort);
						UpdateSorting ();
					}
				}
			};
			
			return toolbarWidgets = new Widget[] {
				groupToggleButton,
				sortAlphabeticallyToggleButton,
				new VSeparator (),
				preferencesButton,
			};
		}