diff options
Diffstat (limited to 'main/src/core/MonoDevelop.Ide')
15 files changed, 919 insertions, 190 deletions
diff --git a/main/src/core/MonoDevelop.Ide/Makefile.am b/main/src/core/MonoDevelop.Ide/Makefile.am index 6e96c86e57..22346ed026 100644 --- a/main/src/core/MonoDevelop.Ide/Makefile.am +++ b/main/src/core/MonoDevelop.Ide/Makefile.am @@ -75,6 +75,7 @@ FILES = \ gtk-gui/MonoDevelop.Ide.Projects.IncludeNewFilesDialog.cs \ gtk-gui/MonoDevelop.Ide.Projects.NewConfigurationDialog.cs \ gtk-gui/MonoDevelop.Ide.Projects.NewFileDialog.cs \ + gtk-gui/MonoDevelop.Ide.Projects.NewPolicySetDialog.cs \ gtk-gui/MonoDevelop.Ide.Projects.NewProjectDialog.cs \ gtk-gui/MonoDevelop.Ide.Projects.OptionPanels.BaseDirectoryPanelWidget.cs \ gtk-gui/MonoDevelop.Ide.Projects.OptionPanels.CodeFormattingPanelWidget.cs \ @@ -611,6 +612,7 @@ FILES = \ MonoDevelop.Ide.Projects/IncludeNewFilesDialog.cs \ MonoDevelop.Ide.Projects/NewConfigurationDialog.cs \ MonoDevelop.Ide.Projects/NewFileDialog.cs \ + MonoDevelop.Ide.Projects/NewPolicySetDialog.cs \ MonoDevelop.Ide.Projects/NewProjectDialog.cs \ MonoDevelop.Ide.Projects/ProjectFileSelectorDialog.cs \ MonoDevelop.Ide.Projects/ProjectOptionsDialog.cs \ diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MimeTypePolicyOptionsPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MimeTypePolicyOptionsPanel.cs index 7e6dde666b..9e2e662fc9 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MimeTypePolicyOptionsPanel.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MimeTypePolicyOptionsPanel.cs @@ -46,13 +46,15 @@ namespace MonoDevelop.Ide.Gui.Dialogs void LoadCurrentPolicy (); void LoadParentPolicy (); - void LoadSetPolicy (PolicySet pset); + void LoadSetPolicy (PolicyContainer pset); void StorePolicy (); bool HasCustomPolicy { get; } void RemovePolicy (PolicyContainer bag); IEnumerable<PolicySet> GetPolicySets (); - PolicySet GetMatchingSet (); + PolicySet GetMatchingSet (IEnumerable<PolicySet> candidateSets); + bool Modified { get; } + bool HandlesPolicyType (Type type, string scope); } public abstract class MimeTypePolicyOptionsPanel<T>: ItemOptionsPanel, IMimeTypePolicyOptionsPanel where T : class, IEquatable<T>, new () @@ -128,7 +130,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs return PolicyService.GetDefaultPolicy<T>(scopes); } - void IMimeTypePolicyOptionsPanel.LoadSetPolicy (PolicySet pset) + void IMimeTypePolicyOptionsPanel.LoadSetPolicy (PolicyContainer pset) { object selected = pset.Get<T> (mimeTypeScopes); if (selected == null) @@ -157,10 +159,13 @@ namespace MonoDevelop.Ide.Gui.Dialogs return PolicyService.GetPolicySets<T> (mimeTypeScopes); } - PolicySet IMimeTypePolicyOptionsPanel.GetMatchingSet () + PolicySet IMimeTypePolicyOptionsPanel.GetMatchingSet (IEnumerable<PolicySet> candidateSets) { T pol = GetCurrentPolicy (); - return PolicyService.GetMatchingSet (pol, mimeTypeScopes); + if (candidateSets != null) + return PolicyService.GetMatchingSet (pol, candidateSets, mimeTypeScopes, false); + else + return PolicyService.GetMatchingSet (pol, mimeTypeScopes, false); } void IMimeTypePolicyOptionsPanel.RemovePolicy (PolicyContainer bag) @@ -168,6 +173,12 @@ namespace MonoDevelop.Ide.Gui.Dialogs bag.Remove<T> (mimeType); } + bool IMimeTypePolicyOptionsPanel.HandlesPolicyType (Type type, string scope) + { + return type == typeof(T) && scope == mimeType; + } + + T GetDirectInherited (PolicyContainer initialContainer) { if (initialContainer == policyContainer && !loaded && hasCachedPolicy) @@ -259,7 +270,13 @@ namespace MonoDevelop.Ide.Gui.Dialogs panelWidget.Show (); return box; } - + + public bool Modified { + get { + T pol = policyContainer.Get<T> (mimeTypeScopes) ?? PolicyService.GetDefaultPolicy<T> (mimeTypeScopes); + return !pol.Equals (GetCurrentPolicy ()); + } + } protected abstract void LoadFrom (T policy); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MimeTypePolicyOptionsSection.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MimeTypePolicyOptionsSection.cs index 6fb4e7a2da..4d0328f4e7 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MimeTypePolicyOptionsSection.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MimeTypePolicyOptionsSection.cs @@ -50,6 +50,9 @@ namespace MonoDevelop.Ide.Gui.Dialogs MimeTypePanelData panelData; Notebook notebook; bool isRoot; + HBox warningMessage; + bool isGlobalPolicy; + List<PolicySet> setsInCombo = new List<PolicySet> (); public MimeTypePolicyOptionsSection () { @@ -60,16 +63,19 @@ namespace MonoDevelop.Ide.Gui.Dialogs base.Initialize (dialog, dataObject); panelData = (MimeTypePanelData) dataObject; - if (panelData.DataObject is SolutionItem) { - bag = ((SolutionItem)panelData.DataObject).Policies; - } else if (panelData.DataObject is Solution) { - bag = ((Solution)panelData.DataObject).Policies; - } else if (panelData.DataObject is PolicySet) { - polSet = ((PolicySet)panelData.DataObject); + IPolicyProvider provider = panelData.DataObject as IPolicyProvider; + if (provider == null) { + provider = PolicyService.GetUserDefaultPolicySet (); + isGlobalPolicy = true; } + + bag = provider.Policies as PolicyBag; + polSet = provider.Policies as PolicySet; mimeType = panelData.MimeType; panelData.SectionPanel = this; isRoot = polSet != null || bag.IsRoot; + if (IsCustomUserPolicy) + isRoot = false; } public override Widget CreatePanelWidget () @@ -94,6 +100,22 @@ namespace MonoDevelop.Ide.Gui.Dialogs vbox.PackStart (hbox, false, false, 0); vbox.ShowAll (); + // Warning message to be shown when the user modifies the default policy + + warningMessage = new HBox (); + warningMessage.Spacing = 6; + Image img = new Image (Gtk.Stock.DialogWarning, IconSize.LargeToolbar); + warningMessage.PackStart (img, false, false, 0); + Label wl = new Label (GettextCatalog.GetString ("Changes done in this section will only be applied to new projects. " + + "Settings for existing projects can be modified in the project (or solution) options dialog.")); + wl.Xalign = 0; + wl.Wrap = true; + wl.WidthRequest = 450; + warningMessage.PackStart (wl, true, true, 0); + warningMessage.ShowAll (); + warningMessage.Visible = false; + vbox.PackEnd (warningMessage, false, false, 0); + notebook = new Notebook (); // Get the panels for all mime types @@ -160,20 +182,27 @@ namespace MonoDevelop.Ide.Gui.Dialogs loading = false; } - void FillPolicies () + public void FillPolicies () { - if (!isRoot) { + ((ListStore)store).Clear (); + + if (IsCustomUserPolicy) { + store.AppendValues (GettextCatalog.GetString ("System Default"), null); + store.AppendValues ("--", null); + } else if (!isRoot) { store.AppendValues (GettextCatalog.GetString ("Inherited Policy"), null); store.AppendValues ("--", null); } - bool added = false; + setsInCombo.Clear (); foreach (PolicySet set in panelData.GetSupportedPolicySets ()) { + if (polSet != null && polSet.Name == set.Name) + continue; store.AppendValues (set.Name, set); - added = true; + setsInCombo.Add (set); } - if (added) + if (setsInCombo.Count > 0) store.AppendValues ("--", null); store.AppendValues (GettextCatalog.GetString ("Custom"), null); @@ -191,7 +220,9 @@ namespace MonoDevelop.Ide.Gui.Dialogs return; } - PolicySet matchedSet = panelData.GetMatchingSet (); + int active = -1; + + PolicySet matchedSet = panelData.GetMatchingSet (setsInCombo); TreeIter iter; int i = 0; @@ -199,14 +230,22 @@ namespace MonoDevelop.Ide.Gui.Dialogs do { PolicySet s2 = store.GetValue (iter, 1) as PolicySet; if (s2 != null && s2.Id == matchedSet.Id) { - policyCombo.Active = i; - return; + active = i; + break; } i++; } while (store.IterNext (ref iter)); } + if (active != -1) + policyCombo.Active = active; + else + policyCombo.Active = store.IterNChildren () - 1; - policyCombo.Active = store.IterNChildren () - 1; + warningMessage.Visible = isGlobalPolicy && panelData.Modified; + } + + bool IsCustomUserPolicy { + get { return ParentDialog is MonoDevelop.Ide.Projects.DefaultPolicyOptionsDialog; } } public override bool IsVisible () @@ -254,14 +293,14 @@ namespace MonoDevelop.Ide.Gui.Dialogs } } - public PolicySet GetMatchingSet () + public PolicySet GetMatchingSet (IEnumerable<PolicySet> candidateSets) { // Find a policy set which is common to all policy types PolicySet matchedSet = null; bool firstMatch = true; foreach (IMimeTypePolicyOptionsPanel panel in Panels) { - PolicySet s = panel.GetMatchingSet (); + PolicySet s = panel.GetMatchingSet (candidateSets); if (firstMatch) { matchedSet = s; firstMatch = false; @@ -274,6 +313,12 @@ namespace MonoDevelop.Ide.Gui.Dialogs return matchedSet; } + public bool Modified { + get { + return Panels.Any (p => p.Modified); + } + } + public IEnumerable<PolicySet> GetSupportedPolicySets () { HashSet<PolicySet> commonSets = null; @@ -316,8 +361,10 @@ namespace MonoDevelop.Ide.Gui.Dialogs useParentPolicy = false; foreach (IMimeTypePolicyOptionsPanel panel in Panels) panel.LoadSetPolicy (pset); - if (SectionLoaded) + if (SectionLoaded) { + SectionPanel.FillPolicies (); SectionPanel.UpdateSelectedNamedPolicy (); + } } } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsDialog.cs index 564fe43fc6..7cc4882c64 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsDialog.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsDialog.cs @@ -110,6 +110,10 @@ namespace MonoDevelop.Ide.Gui.Dialogs this.DefaultResponse = Gtk.ResponseType.Ok; } + protected Alignment MainBox { + get { return alignment; } + } + protected void ExpandCategories () { TreeIter it; @@ -137,9 +141,13 @@ namespace MonoDevelop.Ide.Gui.Dialogs protected override void OnDestroyed() { - foreach (PanelInstance pi in panels.Values) + foreach (PanelInstance pi in panels.Values) { if (pi.Widget != null) pi.Widget.Destroy (); + IDisposable disp = pi.Panel as IDisposable; + if (disp != null) + disp.Dispose (); + } base.OnDestroyed (); } @@ -195,8 +203,12 @@ namespace MonoDevelop.Ide.Gui.Dialogs if (section != null) { SectionPage page; if (pages.TryGetValue (section, out page)) { - foreach (PanelInstance pi in page.Panels) + foreach (PanelInstance pi in page.Panels) { panels.Remove (pi.Node); + IDisposable d = pi.Panel as IDisposable; + if (d != null) + d.Dispose (); + } pages.Remove (section); if (page.Widget != null) page.Widget.Destroy (); @@ -402,6 +414,9 @@ namespace MonoDevelop.Ide.Gui.Dialogs panels.Remove (node); if (pi.Widget != null) pi.Widget.Destroy (); + IDisposable d = pi.Panel as IDisposable; + if (d != null) + d.Dispose (); pi = null; } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsPanel.cs index a3aaa9ebad..629f8e80b3 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsPanel.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/OptionsPanel.cs @@ -30,7 +30,7 @@ using Gtk; namespace MonoDevelop.Ide.Gui.Dialogs { - public abstract class OptionsPanel: IOptionsPanel + public abstract class OptionsPanel: IOptionsPanel, IDisposable { OptionsDialog dlg; object dataObject; @@ -62,5 +62,9 @@ namespace MonoDevelop.Ide.Gui.Dialogs public object DataObject { get { return dataObject; } } + + public virtual void Dispose () + { + } } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/PolicyOptionsPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/PolicyOptionsPanel.cs index 164d990808..bedc42dc55 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/PolicyOptionsPanel.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/PolicyOptionsPanel.cs @@ -46,6 +46,11 @@ namespace MonoDevelop.Ide.Gui.Dialogs PolicySet polSet; PolicyContainer policyContainer; bool loading = true; + HBox warningMessage; + bool isGlobalPolicy; + Widget policyPanel; + bool policyUndefined; + List<PolicySet> setsInCombo = new List<PolicySet> (); public PolicyOptionsPanel () { @@ -76,14 +81,31 @@ namespace MonoDevelop.Ide.Gui.Dialogs FillPolicies (); policyCombo.Active = 0; + + // Message to be shown when the user changes default policies + + warningMessage = new HBox (); + warningMessage.Spacing = 6; + Image img = new Image (Gtk.Stock.DialogWarning, IconSize.LargeToolbar); + warningMessage.PackStart (img, false, false, 0); + Label wl = new Label (GettextCatalog.GetString ("Changes done in this section will only be applied to new projects. " + + "Settings for existing projects can be modified in the project (or solution) options dialog.")); + wl.Xalign = 0; + wl.Wrap = true; + wl.WidthRequest = 450; + warningMessage.PackStart (wl, true, true, 0); + warningMessage.ShowAll (); + warningMessage.Visible = false; + vbox.PackEnd (warningMessage, false, false, 0); - Widget child = CreatePanelWidget (); + policyPanel = CreatePanelWidget (); //HACK: work around bug 469427 - broken themes match on widget names - if (child.Name.IndexOf ("Panel") > 0) - child.Name = child.Name.Replace ("Panel", "_"); - vbox.PackEnd (child, true, true, 0); + if (policyPanel.Name.IndexOf ("Panel") > 0) + policyPanel.Name = policyPanel.Name.Replace ("Panel", "_"); + vbox.PackEnd (policyPanel, true, true, 0); - LoadFrom (GetCurrentValue ()); + InitializePolicy (); + loading = false; if (!IsRoot && !policyContainer.DirectHas<T> ()) { @@ -97,20 +119,34 @@ namespace MonoDevelop.Ide.Gui.Dialogs return vbox; } + + void LoadPolicy (T policy) + { + if (policy == null) { + policyPanel.Sensitive = false; + return; + } + policyPanel.Sensitive = true; + LoadFrom (policy); + } void HandlePolicyComboChanged (object sender, EventArgs e) { + policyPanel.Sensitive = true; T selected = GetSelectedPolicy (); - if (selected != null) { + policyUndefined = IsCustomUserPolicy && policyCombo.Active == 0; + if (selected != null || policyUndefined) { loading = true; - LoadFrom (selected); + LoadPolicy (selected); loading = false; } } T GetCurrentValue () { - if (polSet != null) + if (policyUndefined) + return null; + else if (polSet != null) return polSet.Get<T> () ?? new T (); else return bag.Get<T> (); @@ -118,18 +154,26 @@ namespace MonoDevelop.Ide.Gui.Dialogs void FillPolicies () { - if (!IsRoot) { + ((ListStore)store).Clear (); + + if (IsCustomUserPolicy) { + store.AppendValues (GettextCatalog.GetString ("System Default"), null); + store.AppendValues ("--", null); + } + else if (!IsRoot) { store.AppendValues (GettextCatalog.GetString ("Parent Policy"), null); store.AppendValues ("--", null); } - bool added = false; + setsInCombo.Clear (); foreach (PolicySet set in PolicyService.GetPolicySets<T> ()) { + if (polSet != null && set.Name == polSet.Name) + continue; store.AppendValues (set.Name, set); - added = true; + setsInCombo.Add (set); } - if (added) + if (setsInCombo.Count > 0) store.AppendValues ("--", null); store.AppendValues (GettextCatalog.GetString ("Custom"), null); @@ -141,6 +185,8 @@ namespace MonoDevelop.Ide.Gui.Dialogs if (active == 0 && !IsRoot) return bag.Owner.ParentFolder.Policies.Get<T> (); + if (active == 0 && IsCustomUserPolicy) + return null; TreeIter iter; int i = 0; @@ -164,24 +210,34 @@ namespace MonoDevelop.Ide.Gui.Dialogs if (loading) return; + if (policyUndefined) { + policyCombo.Active = 0; + return; + } + T pol = GetPolicy (); - PolicySet s = PolicyService.GetMatchingSet (pol); + PolicySet s = PolicyService.GetMatchingSet (pol, setsInCombo, false); + int active = -1; TreeIter iter; int i = 0; if (s != null && store.GetIterFirst (out iter)) { do { PolicySet s2 = store.GetValue (iter, 1) as PolicySet; - if (s2 != null && s2.Id == s.Id) { - policyCombo.Active = i; - return; + if (s2 == s) { + active = i; + break; } i++; } while (store.IterNext (ref iter)); } - policyCombo.Active = store.IterNChildren () - 1; + if (active != -1) + policyCombo.Active = active; + else + policyCombo.Active = store.IterNChildren () - 1; + warningMessage.Visible = isGlobalPolicy && !((IEquatable<T>)pol).Equals (GetCurrentValue ()); } protected abstract string PolicyTitleWithMnemonic { get; } @@ -201,33 +257,69 @@ namespace MonoDevelop.Ide.Gui.Dialogs get { return !IsRoot && policyCombo.Active == 0; } } + bool IsCustomUserPolicy { + get { return ParentDialog is MonoDevelop.Ide.Projects.DefaultPolicyOptionsDialog; } + } + protected abstract void LoadFrom (T policy); protected abstract T GetPolicy (); public override void Initialize (MonoDevelop.Ide.Gui.Dialogs.OptionsDialog dialog, object dataObject) { base.Initialize (dialog, dataObject); - if (dataObject is SolutionItem) { - policyContainer = bag = ((SolutionItem)dataObject).Policies; - } else if (dataObject is Solution) { - policyContainer = bag = ((Solution)dataObject).Policies; - } else if (dataObject is PolicySet) { - policyContainer = polSet = ((PolicySet)dataObject); + IPolicyProvider provider = dataObject as IPolicyProvider; + if (provider == null) { + provider = PolicyService.GetUserDefaultPolicySet (); + isGlobalPolicy = true; } + policyContainer = provider.Policies; + bag = policyContainer as PolicyBag; + polSet = policyContainer as PolicySet; + + policyContainer.PolicyChanged += HandlePolicyContainerPolicyChanged; + } + + public override void Dispose () + { + base.Dispose (); + policyContainer.PolicyChanged -= HandlePolicyContainerPolicyChanged; + } + + void HandlePolicyContainerPolicyChanged (object sender, PolicyChangedEventArgs e) + { + if (!loading && e.PolicyType == typeof(T)) { + FillPolicies (); + InitializePolicy (); + UpdateSelectedNamedPolicy (); + } + } + + void InitializePolicy () + { + policyUndefined = IsCustomUserPolicy && !polSet.DirectHas<T> (); + LoadPolicy (GetCurrentValue ()); } public override void ApplyChanges () { - if (polSet != null) { - polSet.Set (GetPolicy ()); - return; + loading = true; + try { + if (polSet != null) { + if (IsCustomUserPolicy && policyUndefined) + polSet.Remove<T> (); + else + polSet.Set (GetPolicy ()); + return; + } + + if (UseParentPolicy) { + bag.Remove<T> (); + } else { + bag.Set (GetPolicy ()); + } + } finally { + loading = false; } - - if (UseParentPolicy) { - bag.Remove<T> (); - } else { - bag.Set (GetPolicy ()); - } } } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CodeFormattingPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CodeFormattingPanel.cs index 30179fde58..4a55041b9b 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CodeFormattingPanel.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/CodeFormattingPanel.cs @@ -44,6 +44,8 @@ namespace MonoDevelop.Ide.Projects.OptionPanels Dictionary<string,MimeTypePanelData> typeSections = new Dictionary<string, MimeTypePanelData> (); List<string> globalMimeTypes; HashSet<string> mimeTypesWithPolicies = new HashSet<string> (); + bool internalPolicyUpdate; + CodeFormattingPanelWidget widget; public override void Initialize (MonoDevelop.Ide.Gui.Dialogs.OptionsDialog dialog, object dataObject) { @@ -52,12 +54,12 @@ namespace MonoDevelop.Ide.Projects.OptionPanels foreach (MimeTypeOptionsPanelNode node in AddinManager.GetExtensionNodes ("/MonoDevelop/ProjectModel/Gui/MimeTypePolicyPanels")) mimeTypesWithPolicies.Add (node.MimeType); - if (dataObject is SolutionItem) { - policyContainer = ((SolutionItem)dataObject).Policies; - } else if (dataObject is Solution) { - policyContainer = ((Solution)dataObject).Policies; - } else if (dataObject is PolicySet) { - policyContainer = ((PolicySet)dataObject); + var provider = dataObject as IPolicyProvider; + if (provider == null) + provider = PolicyService.GetUserDefaultPolicySet (); + + policyContainer = provider.Policies; + if (!(dataObject is SolutionItem) && !(dataObject is Solution)) { globalMimeTypes = new List<string> (); string userTypes = PropertyService.Get<string> ("MonoDevelop.Projects.GlobalPolicyMimeTypes", ""); globalMimeTypes.AddRange (userTypes.Split (new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries)); @@ -65,6 +67,40 @@ namespace MonoDevelop.Ide.Projects.OptionPanels foreach (string mt in GetItemMimeTypes ()) AddPanel (mt); + + policyContainer.PolicyChanged += HandlePolicyContainerPolicyChanged; + } + + public override void Dispose () + { + base.Dispose (); + policyContainer.PolicyChanged -= HandlePolicyContainerPolicyChanged; + } + + void HandlePolicyContainerPolicyChanged (object sender, PolicyChangedEventArgs e) + { + if (internalPolicyUpdate) + return; + + // The policy container has changed externally. The panel data has to be reloaded + + foreach (MimeTypePanelData pd in typeSections.Values) { + bool useParentPolicy = false; + bool modified = false; + foreach (IMimeTypePolicyOptionsPanel panel in pd.Panels) { + // Reload the panel if it is handling the modified policy + if (panel.HandlesPolicyType (e.PolicyType, e.Scope)) { + panel.LoadSetPolicy (policyContainer); + modified = true; + } + if (!panel.HasCustomPolicy) + useParentPolicy = true; + } + if (modified) + pd.UseParentPolicy = useParentPolicy; + } + if (widget != null) + widget.Refresh (); } MimeTypePanelData AddPanel (string mt) @@ -144,13 +180,13 @@ namespace MonoDevelop.Ide.Projects.OptionPanels panels.Add (panel); } data.Panels = panels; - if (!policyContainer.IsRoot) + if (!policyContainer.IsRoot || ParentDialog is DefaultPolicyOptionsDialog) data.UseParentPolicy = useParentPolicy; } public override Gtk.Widget CreatePanelWidget () { - return new CodeFormattingPanelWidget (this, ParentDialog); + return widget = new CodeFormattingPanelWidget (this, ParentDialog); } public override void ApplyChanges () @@ -159,10 +195,15 @@ namespace MonoDevelop.Ide.Projects.OptionPanels string types = string.Join (";", globalMimeTypes.ToArray ()); PropertyService.Set ("MonoDevelop.Projects.GlobalPolicyMimeTypes", types); } - // If a section is already loaded, changes will be committed in the panel - foreach (MimeTypePanelData pd in typeSections.Values) { - if (!pd.SectionLoaded) - pd.ApplyChanges (); + try { + internalPolicyUpdate = true; + // If a section is already loaded, changes will be committed in the panel + foreach (MimeTypePanelData pd in typeSections.Values) { + if (!pd.SectionLoaded) + pd.ApplyChanges (); + } + } finally { + internalPolicyUpdate = false; } } @@ -267,7 +308,7 @@ namespace MonoDevelop.Ide.Projects.OptionPanels if (mt.UseParentPolicy) selection = parentPolicyText; else { - PolicySet matchingSet = mt.GetMatchingSet (); + PolicySet matchingSet = mt.GetMatchingSet (null); if (matchingSet != null) selection = matchingSet.Name; else @@ -316,6 +357,11 @@ namespace MonoDevelop.Ide.Projects.OptionPanels store.AppendValues (mt, DesktopService.GetPixbufForType (mt.MimeType, Gtk.IconSize.Menu), mt.TypeDescription); } } + + public void Refresh () + { + tree.QueueDraw (); + } protected void OnButtonEditClicked (object sender, System.EventArgs e) { diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/NamespaceSynchronisationPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/NamespaceSynchronisationPanel.cs index 41b82c5c4d..cfee3ab4b0 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/NamespaceSynchronisationPanel.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects.OptionPanels/NamespaceSynchronisationPanel.cs @@ -51,7 +51,8 @@ namespace MonoDevelop.Ide.Projects.OptionPanels if (slnFolder != null) return slnFolder.GetAllItems<DotNetProject> ().Any (); - return false; + // Global options case + return !(item is IWorkspaceObject); } public override Widget CreatePanelWidget () diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/DefaultPolicyOptionsDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/DefaultPolicyOptionsDialog.cs index ac5e0e001e..3e559767e9 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/DefaultPolicyOptionsDialog.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/DefaultPolicyOptionsDialog.cs @@ -27,21 +27,213 @@ // using System; +using System.Collections.Generic; using Mono.Addins; using MonoDevelop.Ide.Projects.OptionPanels; using MonoDevelop.Core; using MonoDevelop.Ide.Gui.Dialogs; using MonoDevelop.Projects.Policies; +using MonoDevelop.Components; +using Gtk; namespace MonoDevelop.Ide.Projects { public class DefaultPolicyOptionsDialog : OptionsDialog { + ComboBox policiesCombo; + Button newButton; + Button deleteButton; + List<PolicySet> sets = new List<PolicySet> (); + Dictionary<PolicySet,PolicySet> originalSets = new Dictionary<PolicySet, PolicySet> (); + + PolicySet editingSet; + PolicySet currentSet; + bool loading; + public DefaultPolicyOptionsDialog (Gtk.Window parentWindow) - : base (parentWindow, PolicyService.GetUserDefaultPolicySet (), + : base (parentWindow, new PolicySet (), "/MonoDevelop/ProjectModel/Gui/DefaultPolicyPanels") { - this.Title = GettextCatalog.GetString ("Default Policies"); + this.Title = GettextCatalog.GetString ("Custom Policies"); + editingSet = (PolicySet) DataObject; + + HBox topBar = new HBox (); + topBar.Spacing = 3; + topBar.PackStart (new Label (GettextCatalog.GetString ("Editing Policy:")), false, false, 0); + + policiesCombo = ComboBox.NewText (); + topBar.PackStart (policiesCombo, false, false, 0); + + newButton = new Button (GettextCatalog.GetString ("Add Policy")); + topBar.PackEnd (newButton, false, false, 0); + + deleteButton = new Button (GettextCatalog.GetString ("Delete Policy")); + topBar.PackEnd (deleteButton, false, false, 0); + + Alignment align = new Alignment (0f, 0f, 1f, 1f); + align.LeftPadding = 12; + align.TopPadding = 12; + align.RightPadding = 12; + align.BottomPadding = 12; + align.Add (topBar); + + EventBox ebox = new EventBox (); + ebox.Add (align); + + ebox.ShowAll (); + ebox.ModifyBg (StateType.Normal, ebox.Style.Background (StateType.Normal).AddLight (-0.2)); + + VBox.PackStart (ebox, false, false, 0); + Box.BoxChild c = (Box.BoxChild) VBox [ebox]; + c.Position = 0; + + foreach (PolicySet ps in PolicyService.GetUserPolicySets ()) { + PolicySet copy = ps.Clone (); + originalSets [copy] = ps; + sets.Add (copy); + } + FillPolicySets (); + + policiesCombo.Changed += HandlePoliciesComboChanged; + newButton.Clicked += HandleNewButtonClicked; + deleteButton.Clicked += HandleDeleteButtonClicked; + } + + protected override void ApplyChanges () + { + base.ApplyChanges (); + ApplyPolicyChanges (); + + HashSet<PolicySet> usets = new HashSet<PolicySet> (PolicyService.GetUserPolicySets ()); + foreach (PolicySet ps in sets) { + PolicySet orig; + if (originalSets.TryGetValue (ps, out orig)) { + orig.CopyFrom (ps); + usets.Remove (orig); + } else { + orig = ps.Clone (); + PolicyService.AddUserPolicySet (orig); + originalSets [ps] = orig; + } + } + foreach (PolicySet ps in usets) + PolicyService.RemoveUserPolicySet (ps); + + PolicyService.SaveDefaultPolicies (); + } + + void HandleDeleteButtonClicked (object sender, EventArgs e) + { + if (!MessageService.Confirm (GettextCatalog.GetString ("Are you sure you want to delete the policy '{0}'?", currentSet.Name), AlertButton.Delete)) + return; + + sets.Remove (currentSet); + currentSet = null; + FillPolicySets (); + } + + void HandleNewButtonClicked (object sender, EventArgs e) + { + HashSet<PolicySet> esets = new HashSet<PolicySet> (PolicyService.GetPolicySets ()); + esets.ExceptWith (PolicyService.GetUserPolicySets ()); + esets.UnionWith (sets); + esets.RemoveWhere (p => !p.Visible); + + NewPolicySetDialog dlg = new NewPolicySetDialog (new List<PolicySet> (esets)); + if (dlg.Run () == (int) Gtk.ResponseType.Ok) { + PolicySet pset = new PolicySet (); + pset.CopyFrom (dlg.SourceSet); + pset.Name = dlg.PolicyName; + sets.Add (pset); + FillPolicySets (); + policiesCombo.Active = sets.IndexOf (pset); + } + dlg.Destroy (); + } + + void FillPolicySets () + { + loading = true; + int current = policiesCombo.Active; + + ((ListStore)policiesCombo.Model).Clear (); + policiesCombo.WidthRequest = -1; + + sets.Sort ((p1,p2) => p1.Name.CompareTo(p2.Name)); + + foreach (PolicySet pset in sets) { + policiesCombo.AppendText (pset.Name ?? ""); + } + if (current == -1 && sets.Count > 0) + policiesCombo.Active = 0; + else if (current >= sets.Count) + policiesCombo.Active = sets.Count - 1; + else + policiesCombo.Active = current; + + if (policiesCombo.SizeRequest ().Width < 200) + policiesCombo.WidthRequest = 200; + + loading = false; + + if (policiesCombo.Active != -1 && sets [policiesCombo.Active] != currentSet) { + currentSet = sets [policiesCombo.Active]; + editingSet.Name = currentSet.Name; + editingSet.CopyFrom (currentSet); + } + UpdateStatus (); + } + + void UpdateStatus () + { + if (sets.Count == 0) { + deleteButton.Sensitive = false; + MainBox.Sensitive = false; + ((ListStore)policiesCombo.Model).Clear (); + policiesCombo.Sensitive = false; + policiesCombo.AppendText (GettextCatalog.GetString ("No Selection")); + policiesCombo.Active = 0; + } + else { + deleteButton.Sensitive = true; + MainBox.Sensitive = true; + policiesCombo.Sensitive = true; + } + } + + void HandlePoliciesComboChanged (object sender, EventArgs e) + { + if (!loading) { + if (currentSet != null) { + // Save current values + if (ValidateChanges ()) { + base.ApplyChanges (); + currentSet.CopyFrom (editingSet); + } else { + // There are validation errors. Cancel the policy switch + int last = policiesCombo.Active; + Application.Invoke (delegate { + loading = true; + policiesCombo.Active = last; + loading = false; + }); + return; + } + } + + if (policiesCombo.Active != -1 && policiesCombo.Active < sets.Count) { + // Load the new values + currentSet = sets [policiesCombo.Active]; + editingSet.Name = currentSet.Name; + editingSet.CopyFrom (currentSet); + } + } + } + + void ApplyPolicyChanges () + { + if (policiesCombo.Active != -1 && sets.Count > 0) + sets [policiesCombo.Active].CopyFrom (editingSet); } } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewPolicySetDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewPolicySetDialog.cs new file mode 100644 index 0000000000..ba0451c16e --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewPolicySetDialog.cs @@ -0,0 +1,56 @@ +// +// NewPolicySetDialog.cs +// +// Author: +// Lluis Sanchez Gual <lluis@novell.com> +// +// Copyright (c) 2011 Novell, Inc (http://www.novell.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System; +using System.Collections.Generic; +using MonoDevelop.Projects.Policies; + +namespace MonoDevelop.Ide.Projects +{ + public partial class NewPolicySetDialog : Gtk.Dialog + { + List<PolicySet> sets; + + public NewPolicySetDialog (List<PolicySet> sets) + { + this.Build (); + this.sets = sets; + foreach (var ps in sets) + comboSets.AppendText (ps.Name); + comboSets.Active = 0; + } + + public string PolicyName { + get { return entryName.Text; } + } + + public PolicySet SourceSet { + get { + return sets [comboSets.Active]; + } + } + } +} + diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.addin.xml b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.addin.xml index 5091f47144..3b5027a782 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.addin.xml +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.addin.xml @@ -647,21 +647,6 @@ </Section> </Extension> - <Extension path = "/MonoDevelop/ProjectModel/Gui/DefaultPolicyPanels"> - <Section id="Common" _label="General"> - </Section> - <Section id="Build" _label="Build"> - </Section> - <Section id="Run" _label="Run"> - </Section> - <Section id="SourceCode" _label="Source Code"> - <Section id="DefaultDotNetNamingPolicies" _label=".NET Naming Policies"> - <Panel id = "NamespaceSynchronisationPanel" class = "MonoDevelop.Ide.Projects.OptionPanels.NamespaceSynchronisationPanel" /> - </Section> - <Section id="CodeFormattingPolicies" _label="Code Formatting" icon="md-formatting" fill = "true" class="MonoDevelop.Ide.Projects.OptionPanels.CodeFormattingPanel" /> - </Section> - </Extension> - <Extension path = "/MonoDevelop/Ide/DisplayBindings"> <DisplayBinding id = "DefaultDisplayBinding" class = "MonoDevelop.Ide.Gui.DefaultDisplayBinding"/> @@ -798,8 +783,8 @@ </Condition> <Command id = "MonoDevelop.Ide.Commands.EditCommands.DefaultPolicies" defaultHandler = "MonoDevelop.Ide.Commands.DefaultPoliciesHandler" - _label = "Default Po_licies..." - _description = "Edit the default policies that are applied to new projects" /> + _label = "Custom Po_licies..." + _description = "Edit custom sets of policies which can be applied to solutions" /> <Command id = "MonoDevelop.Ide.Commands.EditCommands.InsertStandardHeader" _label = "_Insert Standard Header" defaultHandler = "MonoDevelop.Ide.Commands.InsertStandardHeaderHandler" @@ -1866,6 +1851,14 @@ <Section id = "CodeTemplates" icon="md-code-template" _label = "Code Templates" fill="true" class = "MonoDevelop.Ide.CodeTemplates.CodeTemplatePane"/> </Section> + <Section id="SourceCode" _label="Source Code"> + <Section id="DefaultDotNetNamingPolicies" _label=".NET Naming Policies"> + <Panel id = "NamespaceSynchronisationPanel" class = "MonoDevelop.Ide.Projects.OptionPanels.NamespaceSynchronisationPanel" /> + </Section> + <Section id="CodeFormattingPolicies" _label="Code Formatting" icon="md-formatting" fill = "true" class="MonoDevelop.Ide.Projects.OptionPanels.CodeFormattingPanel" /> + <Section id="DefaultStandardHeader" _label = "Standard Header" fill="true" class = "MonoDevelop.Ide.StandardHeader.StandardHeaderPolicyPanel" /> + </Section> + <Section id = "VersionControl" _label = "Version Control" /> <Section id = "Other" _label = "Other"> @@ -1873,20 +1866,29 @@ </Section> </Extension> + <Extension path = "/MonoDevelop/ProjectModel/Gui/DefaultPolicyPanels"> + <Section id="Common" _label="General"> + </Section> + <Section id="Build" _label="Build"> + </Section> + <Section id="Run" _label="Run"> + </Section> + <Section id="SourceCode" _label="Source Code"> + <Section id="DefaultDotNetNamingPolicies" _label=".NET Naming Policies"> + <Panel id = "NamespaceSynchronisationPanel" class = "MonoDevelop.Ide.Projects.OptionPanels.NamespaceSynchronisationPanel" /> + </Section> + <Section id="CodeFormattingPolicies" _label="Code Formatting" icon="md-formatting" fill = "true" class="MonoDevelop.Ide.Projects.OptionPanels.CodeFormattingPanel" /> + <Section id="DefaultStandardHeader" _label = "Standard Header" fill="true" class = "MonoDevelop.Ide.StandardHeader.StandardHeaderPolicyPanel" /> + </Section> + <Section id="VersionControl" _label="Version Control" /> + </Extension> + <Extension path = "/MonoDevelop/ProjectModel/Gui/ItemOptionPanels/Common"> <Condition id="ItemType" value="Solution"> <Section id = "AuthorInfo" _label = "Author Information" fill="true" class = "MonoDevelop.Ide.Gui.OptionPanels.AuthorInformationPanel" /> </Condition> </Extension> - <Extension path = "/MonoDevelop/ProjectModel/Gui/ItemOptionPanels/SourceCode"> - <Section id = "ProjectStandardHeader" _label = "Standard Header" fill="true" class = "MonoDevelop.Ide.StandardHeader.StandardHeaderPolicyPanel" /> - </Extension> - - <Extension path = "/MonoDevelop/ProjectModel/Gui/DefaultPolicyPanels/SourceCode"> - <Section id = "DefaultStandardHeader" _label = "Standard Header" fill="true" class = "MonoDevelop.Ide.StandardHeader.StandardHeaderPolicyPanel" /> - </Extension> - <Extension path = "/MonoDevelop/ProjectModel/Gui/MimeTypePolicyPanels"> <Panel id = "TextStylePolicy" mimeType="text/plain" _label = "Text Style" class = "MonoDevelop.Ide.Gui.OptionPanels.TextStylePolicyPanel" /> </Extension> diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj index 9da732a4ca..02b9f0f828 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj @@ -1374,6 +1374,8 @@ <Compile Include="MonoDevelop.Ide.CodeFormatting\CodeFormatterExtensionNode.cs" /> <Compile Include="MonoDevelop.Ide.CodeFormatting\CodeFormatter.cs" /> <Compile Include="MonoDevelop.Ide.Gui\GtkSynchronizationContext.cs" /> + <Compile Include="MonoDevelop.Ide.Projects\NewPolicySetDialog.cs" /> + <Compile Include="gtk-gui\MonoDevelop.Ide.Projects.NewPolicySetDialog.cs" /> </ItemGroup> <ItemGroup> <None Include="ChangeLog" /> diff --git a/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.Gui.Dialogs.OptionsDialog.cs b/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.Gui.Dialogs.OptionsDialog.cs index 41048a157d..ee10c1c930 100644 --- a/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.Gui.Dialogs.OptionsDialog.cs +++ b/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.Gui.Dialogs.OptionsDialog.cs @@ -4,7 +4,8 @@ namespace MonoDevelop.Ide.Gui.Dialogs { public partial class OptionsDialog { - private global::Gtk.HBox hbox1; + private global::Gtk.Alignment alignment; + private global::Gtk.HBox mainHBox; private global::Gtk.ScrolledWindow GtkScrolledWindow; private global::Gtk.TreeView tree; private global::Gtk.VBox vbox3; @@ -29,11 +30,18 @@ namespace MonoDevelop.Ide.Gui.Dialogs w1.Name = "dialog1_VBox"; w1.BorderWidth = ((uint)(2)); // Container child dialog1_VBox.Gtk.Box+BoxChild - this.hbox1 = new global::Gtk.HBox (); - this.hbox1.Name = "hbox1"; - this.hbox1.Spacing = 6; - this.hbox1.BorderWidth = ((uint)(12)); - // Container child hbox1.Gtk.Box+BoxChild + this.alignment = new global::Gtk.Alignment (0.5F, 0.5F, 1F, 1F); + this.alignment.Name = "alignment"; + this.alignment.LeftPadding = ((uint)(6)); + this.alignment.TopPadding = ((uint)(6)); + this.alignment.RightPadding = ((uint)(6)); + this.alignment.BottomPadding = ((uint)(6)); + this.alignment.BorderWidth = ((uint)(6)); + // Container child alignment.Gtk.Container+ContainerChild + this.mainHBox = new global::Gtk.HBox (); + this.mainHBox.Name = "mainHBox"; + this.mainHBox.Spacing = 6; + // Container child mainHBox.Gtk.Box+BoxChild this.GtkScrolledWindow = new global::Gtk.ScrolledWindow (); this.GtkScrolledWindow.Name = "GtkScrolledWindow"; this.GtkScrolledWindow.HscrollbarPolicy = ((global::Gtk.PolicyType)(2)); @@ -43,11 +51,11 @@ namespace MonoDevelop.Ide.Gui.Dialogs this.tree.CanFocus = true; this.tree.Name = "tree"; this.GtkScrolledWindow.Add (this.tree); - this.hbox1.Add (this.GtkScrolledWindow); - global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.GtkScrolledWindow])); + this.mainHBox.Add (this.GtkScrolledWindow); + global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.mainHBox [this.GtkScrolledWindow])); w3.Position = 0; w3.Expand = false; - // Container child hbox1.Gtk.Box+BoxChild + // Container child mainHBox.Gtk.Box+BoxChild this.vbox3 = new global::Gtk.VBox (); this.vbox3.Name = "vbox3"; this.vbox3.Spacing = 9; @@ -93,19 +101,20 @@ namespace MonoDevelop.Ide.Gui.Dialogs this.vbox3.Add (this.pageFrame); global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.pageFrame])); w8.Position = 2; - this.hbox1.Add (this.vbox3); - global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.vbox3])); + this.mainHBox.Add (this.vbox3); + global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.mainHBox [this.vbox3])); w9.Position = 1; w9.Padding = ((uint)(6)); - w1.Add (this.hbox1); - global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(w1 [this.hbox1])); - w10.Position = 0; + this.alignment.Add (this.mainHBox); + w1.Add (this.alignment); + global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(w1 [this.alignment])); + w11.Position = 0; // Internal child MonoDevelop.Ide.Gui.Dialogs.OptionsDialog.ActionArea - global::Gtk.HButtonBox w11 = this.ActionArea; - w11.Name = "dialog1_ActionArea"; - w11.Spacing = 6; - w11.BorderWidth = ((uint)(5)); - w11.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4)); + global::Gtk.HButtonBox w12 = this.ActionArea; + w12.Name = "dialog1_ActionArea"; + w12.Spacing = 6; + w12.BorderWidth = ((uint)(5)); + w12.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4)); // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild this.buttonCancel = new global::Gtk.Button (); this.buttonCancel.CanDefault = true; @@ -115,9 +124,9 @@ namespace MonoDevelop.Ide.Gui.Dialogs this.buttonCancel.UseUnderline = true; this.buttonCancel.Label = "gtk-cancel"; this.AddActionWidget (this.buttonCancel, -6); - global::Gtk.ButtonBox.ButtonBoxChild w12 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w11 [this.buttonCancel])); - w12.Expand = false; - w12.Fill = false; + global::Gtk.ButtonBox.ButtonBoxChild w13 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w12 [this.buttonCancel])); + w13.Expand = false; + w13.Fill = false; // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild this.buttonOk = new global::Gtk.Button (); this.buttonOk.CanDefault = true; @@ -126,11 +135,11 @@ namespace MonoDevelop.Ide.Gui.Dialogs this.buttonOk.UseStock = true; this.buttonOk.UseUnderline = true; this.buttonOk.Label = "gtk-ok"; - w11.Add (this.buttonOk); - global::Gtk.ButtonBox.ButtonBoxChild w13 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w11 [this.buttonOk])); - w13.Position = 1; - w13.Expand = false; - w13.Fill = false; + w12.Add (this.buttonOk); + global::Gtk.ButtonBox.ButtonBoxChild w14 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w12 [this.buttonOk])); + w14.Position = 1; + w14.Expand = false; + w14.Fill = false; if ((this.Child != null)) { this.Child.ShowAll (); } diff --git a/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.Projects.NewPolicySetDialog.cs b/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.Projects.NewPolicySetDialog.cs new file mode 100644 index 0000000000..8b85614e8a --- /dev/null +++ b/main/src/core/MonoDevelop.Ide/gtk-gui/MonoDevelop.Ide.Projects.NewPolicySetDialog.cs @@ -0,0 +1,114 @@ + +// This file has been generated by the GUI designer. Do not modify. +namespace MonoDevelop.Ide.Projects +{ + public partial class NewPolicySetDialog + { + private global::Gtk.VBox vbox2; + private global::Gtk.Label label1; + private global::Gtk.Entry entryName; + private global::Gtk.Label label2; + private global::Gtk.ComboBox comboSets; + private global::Gtk.Button buttonCancel; + private global::Gtk.Button buttonOk; + + protected virtual void Build () + { + global::Stetic.Gui.Initialize (this); + // Widget MonoDevelop.Ide.Projects.NewPolicySetDialog + this.Name = "MonoDevelop.Ide.Projects.NewPolicySetDialog"; + this.Title = global::MonoDevelop.Core.GettextCatalog.GetString ("New Policy"); + this.WindowPosition = ((global::Gtk.WindowPosition)(4)); + // Internal child MonoDevelop.Ide.Projects.NewPolicySetDialog.VBox + global::Gtk.VBox w1 = this.VBox; + w1.Name = "dialog1_VBox"; + w1.BorderWidth = ((uint)(2)); + // Container child dialog1_VBox.Gtk.Box+BoxChild + this.vbox2 = new global::Gtk.VBox (); + this.vbox2.Name = "vbox2"; + this.vbox2.Spacing = 6; + this.vbox2.BorderWidth = ((uint)(12)); + // Container child vbox2.Gtk.Box+BoxChild + this.label1 = new global::Gtk.Label (); + this.label1.Name = "label1"; + this.label1.Xalign = 0F; + this.label1.LabelProp = global::MonoDevelop.Core.GettextCatalog.GetString ("Policy Name:"); + this.vbox2.Add (this.label1); + global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.label1])); + w2.Position = 0; + w2.Expand = false; + w2.Fill = false; + // Container child vbox2.Gtk.Box+BoxChild + this.entryName = new global::Gtk.Entry (); + this.entryName.CanFocus = true; + this.entryName.Name = "entryName"; + this.entryName.IsEditable = true; + this.entryName.InvisibleChar = '●'; + this.vbox2.Add (this.entryName); + global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.entryName])); + w3.Position = 1; + w3.Expand = false; + w3.Fill = false; + // Container child vbox2.Gtk.Box+BoxChild + this.label2 = new global::Gtk.Label (); + this.label2.Name = "label2"; + this.label2.Xalign = 0F; + this.label2.LabelProp = global::MonoDevelop.Core.GettextCatalog.GetString ("Copy Settings From:"); + this.vbox2.Add (this.label2); + global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.label2])); + w4.Position = 2; + w4.Expand = false; + w4.Fill = false; + // Container child vbox2.Gtk.Box+BoxChild + this.comboSets = global::Gtk.ComboBox.NewText (); + this.comboSets.Name = "comboSets"; + this.vbox2.Add (this.comboSets); + global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.comboSets])); + w5.Position = 3; + w5.Expand = false; + w5.Fill = false; + w1.Add (this.vbox2); + global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(w1 [this.vbox2])); + w6.Position = 0; + w6.Expand = false; + w6.Fill = false; + // Internal child MonoDevelop.Ide.Projects.NewPolicySetDialog.ActionArea + global::Gtk.HButtonBox w7 = this.ActionArea; + w7.Name = "dialog1_ActionArea"; + w7.Spacing = 10; + w7.BorderWidth = ((uint)(5)); + w7.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4)); + // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild + this.buttonCancel = new global::Gtk.Button (); + this.buttonCancel.CanDefault = true; + this.buttonCancel.CanFocus = true; + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.UseStock = true; + this.buttonCancel.UseUnderline = true; + this.buttonCancel.Label = "gtk-cancel"; + this.AddActionWidget (this.buttonCancel, -6); + global::Gtk.ButtonBox.ButtonBoxChild w8 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w7 [this.buttonCancel])); + w8.Expand = false; + w8.Fill = false; + // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild + this.buttonOk = new global::Gtk.Button (); + this.buttonOk.CanDefault = true; + this.buttonOk.CanFocus = true; + this.buttonOk.Name = "buttonOk"; + this.buttonOk.UseStock = true; + this.buttonOk.UseUnderline = true; + this.buttonOk.Label = "gtk-ok"; + this.AddActionWidget (this.buttonOk, -5); + global::Gtk.ButtonBox.ButtonBoxChild w9 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w7 [this.buttonOk])); + w9.Position = 1; + w9.Expand = false; + w9.Fill = false; + if ((this.Child != null)) { + this.Child.ShowAll (); + } + this.DefaultWidth = 429; + this.DefaultHeight = 200; + this.Show (); + } + } +} diff --git a/main/src/core/MonoDevelop.Ide/gtk-gui/gui.stetic b/main/src/core/MonoDevelop.Ide/gtk-gui/gui.stetic index 18a29831fb..da6ca813a8 100644 --- a/main/src/core/MonoDevelop.Ide/gtk-gui/gui.stetic +++ b/main/src/core/MonoDevelop.Ide/gtk-gui/gui.stetic @@ -7476,41 +7476,68 @@ All solutions</property> <property name="MemberName" /> <property name="BorderWidth">2</property> <child> - <widget class="Gtk.HBox" id="hbox1"> + <widget class="Gtk.Alignment" id="alignment"> <property name="MemberName" /> - <property name="Spacing">6</property> - <property name="BorderWidth">12</property> + <property name="LeftPadding">6</property> + <property name="TopPadding">6</property> + <property name="RightPadding">6</property> + <property name="BottomPadding">6</property> + <property name="BorderWidth">6</property> <child> - <widget class="Gtk.ScrolledWindow" id="GtkScrolledWindow"> + <widget class="Gtk.HBox" id="mainHBox"> <property name="MemberName" /> - <property name="HscrollbarPolicy">Never</property> - <property name="ShadowType">In</property> + <property name="Spacing">6</property> <child> - <widget class="Gtk.TreeView" id="tree"> + <widget class="Gtk.ScrolledWindow" id="GtkScrolledWindow"> <property name="MemberName" /> - <property name="CanFocus">True</property> - <property name="ShowScrollbars">True</property> + <property name="HscrollbarPolicy">Never</property> + <property name="ShadowType">In</property> + <child> + <widget class="Gtk.TreeView" id="tree"> + <property name="MemberName" /> + <property name="CanFocus">True</property> + <property name="ShowScrollbars">True</property> + </widget> + </child> </widget> + <packing> + <property name="Position">0</property> + <property name="AutoSize">False</property> + <property name="Expand">False</property> + </packing> </child> - </widget> - <packing> - <property name="Position">0</property> - <property name="AutoSize">False</property> - <property name="Expand">False</property> - </packing> - </child> - <child> - <widget class="Gtk.VBox" id="vbox3"> - <property name="MemberName" /> - <property name="Spacing">9</property> <child> - <widget class="Gtk.HBox" id="hbox2"> + <widget class="Gtk.VBox" id="vbox3"> <property name="MemberName" /> - <property name="Spacing">6</property> + <property name="Spacing">9</property> <child> - <widget class="Gtk.Image" id="image"> + <widget class="Gtk.HBox" id="hbox2"> <property name="MemberName" /> - <property name="Pixbuf">stock:gtk-preferences LargeToolbar</property> + <property name="Spacing">6</property> + <child> + <widget class="Gtk.Image" id="image"> + <property name="MemberName" /> + <property name="Pixbuf">stock:gtk-preferences LargeToolbar</property> + </widget> + <packing> + <property name="Position">0</property> + <property name="AutoSize">True</property> + <property name="Expand">False</property> + <property name="Fill">False</property> + </packing> + </child> + <child> + <widget class="Gtk.Label" id="labelTitle"> + <property name="MemberName" /> + <property name="Xalign">0</property> + <property name="LabelProp" translatable="yes"><span weight="bold" size="x-large">Title</span></property> + <property name="UseMarkup">True</property> + </widget> + <packing> + <property name="Position">1</property> + <property name="AutoSize">False</property> + </packing> + </child> </widget> <packing> <property name="Position">0</property> @@ -7520,58 +7547,40 @@ All solutions</property> </packing> </child> <child> - <widget class="Gtk.Label" id="labelTitle"> + <widget class="Gtk.HSeparator" id="hseparator1"> <property name="MemberName" /> - <property name="Xalign">0</property> - <property name="LabelProp" translatable="yes"><span weight="bold" size="x-large">Title</span></property> - <property name="UseMarkup">True</property> </widget> <packing> <property name="Position">1</property> - <property name="AutoSize">False</property> + <property name="AutoSize">True</property> + <property name="Expand">False</property> + <property name="Fill">False</property> </packing> </child> - </widget> - <packing> - <property name="Position">0</property> - <property name="AutoSize">True</property> - <property name="Expand">False</property> - <property name="Fill">False</property> - </packing> - </child> - <child> - <widget class="Gtk.HSeparator" id="hseparator1"> - <property name="MemberName" /> - </widget> - <packing> - <property name="Position">1</property> - <property name="AutoSize">True</property> - <property name="Expand">False</property> - <property name="Fill">False</property> - </packing> - </child> - <child> - <widget class="Gtk.HBox" id="pageFrame"> - <property name="MemberName" /> - <property name="Spacing">6</property> - <child> - <placeholder /> - </child> <child> - <placeholder /> + <widget class="Gtk.HBox" id="pageFrame"> + <property name="MemberName" /> + <property name="Spacing">6</property> + <child> + <placeholder /> + </child> + <child> + <placeholder /> + </child> + </widget> + <packing> + <property name="Position">2</property> + <property name="AutoSize">True</property> + </packing> </child> </widget> <packing> - <property name="Position">2</property> - <property name="AutoSize">True</property> + <property name="Position">1</property> + <property name="AutoSize">False</property> + <property name="Padding">6</property> </packing> </child> </widget> - <packing> - <property name="Position">1</property> - <property name="AutoSize">False</property> - <property name="Padding">6</property> - </packing> </child> </widget> <packing> @@ -11749,4 +11758,125 @@ please quit MonoDevelop before installing them.</property> </widget> </child> </widget> + <widget class="Gtk.Dialog" id="MonoDevelop.Ide.Projects.NewPolicySetDialog" design-size="429 200"> + <property name="MemberName" /> + <property name="Title" translatable="yes">New Policy</property> + <property name="WindowPosition">CenterOnParent</property> + <property name="Buttons">2</property> + <property name="HelpButton">False</property> + <child internal-child="VBox"> + <widget class="Gtk.VBox" id="dialog1_VBox"> + <property name="MemberName" /> + <property name="BorderWidth">2</property> + <child> + <widget class="Gtk.VBox" id="vbox2"> + <property name="MemberName" /> + <property name="Spacing">6</property> + <property name="BorderWidth">12</property> + <child> + <widget class="Gtk.Label" id="label1"> + <property name="MemberName" /> + <property name="Xalign">0</property> + <property name="LabelProp" translatable="yes">Policy Name:</property> + </widget> + <packing> + <property name="Position">0</property> + <property name="AutoSize">True</property> + <property name="Expand">False</property> + <property name="Fill">False</property> + </packing> + </child> + <child> + <widget class="Gtk.Entry" id="entryName"> + <property name="MemberName" /> + <property name="CanFocus">True</property> + <property name="IsEditable">True</property> + <property name="InvisibleChar">●</property> + </widget> + <packing> + <property name="Position">1</property> + <property name="AutoSize">True</property> + <property name="Expand">False</property> + <property name="Fill">False</property> + </packing> + </child> + <child> + <widget class="Gtk.Label" id="label2"> + <property name="MemberName" /> + <property name="Xalign">0</property> + <property name="LabelProp" translatable="yes">Copy Settings From:</property> + </widget> + <packing> + <property name="Position">2</property> + <property name="AutoSize">True</property> + <property name="Expand">False</property> + <property name="Fill">False</property> + </packing> + </child> + <child> + <widget class="Gtk.ComboBox" id="comboSets"> + <property name="MemberName" /> + <property name="IsTextCombo">True</property> + <property name="Items" translatable="yes" /> + </widget> + <packing> + <property name="Position">3</property> + <property name="AutoSize">True</property> + <property name="Expand">False</property> + <property name="Fill">False</property> + </packing> + </child> + </widget> + <packing> + <property name="Position">0</property> + <property name="AutoSize">True</property> + <property name="Expand">False</property> + <property name="Fill">False</property> + </packing> + </child> + </widget> + </child> + <child internal-child="ActionArea"> + <widget class="Gtk.HButtonBox" id="dialog1_ActionArea"> + <property name="MemberName" /> + <property name="Spacing">10</property> + <property name="BorderWidth">5</property> + <property name="Size">2</property> + <property name="LayoutStyle">End</property> + <child> + <widget class="Gtk.Button" id="buttonCancel"> + <property name="MemberName" /> + <property name="CanDefault">True</property> + <property name="CanFocus">True</property> + <property name="UseStock">True</property> + <property name="Type">StockItem</property> + <property name="StockId">gtk-cancel</property> + <property name="ResponseId">-6</property> + <property name="label">gtk-cancel</property> + </widget> + <packing> + <property name="Expand">False</property> + <property name="Fill">False</property> + </packing> + </child> + <child> + <widget class="Gtk.Button" id="buttonOk"> + <property name="MemberName" /> + <property name="CanDefault">True</property> + <property name="CanFocus">True</property> + <property name="UseStock">True</property> + <property name="Type">StockItem</property> + <property name="StockId">gtk-ok</property> + <property name="ResponseId">-5</property> + <property name="label">gtk-ok</property> + </widget> + <packing> + <property name="Position">1</property> + <property name="Expand">False</property> + <property name="Fill">False</property> + </packing> + </child> + </widget> + </child> + </widget> </stetic-interface>
\ No newline at end of file |