diff options
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs')
8 files changed, 41 insertions, 66 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/FileSelectorDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/FileSelectorDialog.cs index 2d63a444e0..59b927b4aa 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/FileSelectorDialog.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/FileSelectorDialog.cs @@ -114,11 +114,11 @@ namespace MonoDevelop.Ide.Gui.Dialogs return -1; else if (encodingMenu.History < firstEncIndex || encodingMenu.History == selectOption) return -1; - return SelectedEncodings.ConversionEncodings [encodingMenu.History - firstEncIndex]; + return TextEncoding.ConversionEncodings [encodingMenu.History - firstEncIndex].CodePage; } set { - for (uint n=0; n < SelectedEncodings.ConversionEncodings.Length; n++) { - if (SelectedEncodings.ConversionEncodings [n] == value) { + for (uint n=0; n < TextEncoding.ConversionEncodings.Length; n++) { + if (TextEncoding.ConversionEncodings [n].CodePage == value) { encodingMenu.SetHistory (n + (uint)firstEncIndex); Menu menu = (Menu)encodingMenu.Menu; RadioMenuItem rm = (RadioMenuItem) menu.Children [n + firstEncIndex]; @@ -164,8 +164,8 @@ namespace MonoDevelop.Ide.Gui.Dialogs } else firstEncIndex = 0; - foreach (var codePage in SelectedEncodings.ConversionEncodings) { - var enc = Encoding.GetEncoding (codePage); + foreach (var textEncoding in TextEncoding.ConversionEncodings) { + var enc = Encoding.GetEncoding (textEncoding.CodePage); RadioMenuItem mitem = new RadioMenuItem (enc.EncodingName + " (" + enc.WebName + ")"); menu.Append (mitem); if (defaultActivated == null) { @@ -190,7 +190,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs encodingMenu.SetHistory (0); - selectOption = firstEncIndex + SelectedEncodings.ConversionEncodings.Length + 1; + selectOption = firstEncIndex + TextEncoding.ConversionEncodings.Length + 1; } void EncodingChanged (object s, EventArgs args) diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/GtkAlertDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/GtkAlertDialog.cs index 89f0ef9835..0721f8bff6 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/GtkAlertDialog.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/GtkAlertDialog.cs @@ -100,7 +100,12 @@ namespace MonoDevelop.Ide.Gui.Dialogs primaryText = message.Text; secondaryText = message.SecondaryText; } - + + if (!message.UseMarkup) { + primaryText = GLib.Markup.EscapeText (primaryText); + secondaryText = GLib.Markup.EscapeText (secondaryText); + } + if (!string.IsNullOrEmpty (message.Icon)) { image = new ImageView (); image.Yalign = 0.00f; @@ -110,14 +115,14 @@ namespace MonoDevelop.Ide.Gui.Dialogs } StringBuilder markup = new StringBuilder (@"<span weight=""bold"" size=""larger"">"); - markup.Append (GLib.Markup.EscapeText (primaryText)); + markup.Append (primaryText); markup.Append ("</span>"); if (!String.IsNullOrEmpty (secondaryText)) { if (!String.IsNullOrEmpty (primaryText)) { markup.AppendLine (); markup.AppendLine (); } - markup.Append (GLib.Markup.EscapeText (secondaryText)); + markup.Append (secondaryText); } label.Markup = markup.ToString (); label.Selectable = true; diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ItemOptionsDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ItemOptionsDialog.cs index 43475f204d..2be7c597ce 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ItemOptionsDialog.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ItemOptionsDialog.cs @@ -29,6 +29,7 @@ using System; using Mono.Addins; using MonoDevelop.Projects.Extensions; using MonoDevelop.Ide.Gui.Dialogs; +using MonoDevelop.Projects; namespace MonoDevelop.Ide.Gui.Dialogs { @@ -48,6 +49,8 @@ namespace MonoDevelop.Ide.Gui.Dialogs base.InitializeContext (extensionContext); extensionContext.RegisterCondition ("ItemType", new ItemTypeCondition (DataObject.GetType ())); extensionContext.RegisterCondition ("ActiveLanguage", new ProjectLanguageCondition (DataObject)); + if (DataObject is Project) + extensionContext.RegisterCondition ("ItemType", new FlavorTypeCondition ((Project)DataObject)); } } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ItemOptionsPanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ItemOptionsPanel.cs index f4f9b40ab3..fb478e3985 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ItemOptionsPanel.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ItemOptionsPanel.cs @@ -34,10 +34,10 @@ namespace MonoDevelop.Ide.Gui.Dialogs { public abstract class ItemOptionsPanel: OptionsPanel { - SolutionEntityItem solutionItem; + SolutionItem solutionItem; WorkspaceItem workspaceItem; - public SolutionEntityItem ConfiguredSolutionItem { + public SolutionItem ConfiguredSolutionItem { get { return solutionItem; } @@ -76,7 +76,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs { base.Initialize (dialog, dataObject); - solutionItem = dataObject as SolutionEntityItem; + solutionItem = dataObject as SolutionItem; if (solutionItem != null) workspaceItem = solutionItem.ParentSolution; else diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MultiConfigItemOptionsDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MultiConfigItemOptionsDialog.cs index ff956b9d6f..c59f7092d3 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MultiConfigItemOptionsDialog.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MultiConfigItemOptionsDialog.cs @@ -136,9 +136,9 @@ namespace MonoDevelop.Ide.Gui.Dialogs data.Configurations.Add (copy); } if (entry is Solution) { - foreach (SolutionItem e in ((Solution)entry).Items) { - if (e is SolutionEntityItem) - data.children.Add (ConfigurationData.Build ((SolutionEntityItem) e)); + foreach (SolutionFolderItem e in ((Solution)entry).Items) { + if (e is SolutionItem) + data.children.Add (ConfigurationData.Build ((SolutionItem) e)); } } return data; @@ -177,7 +177,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs data.Update (modifiedObjects); // If configurations have been renamed, update the references in the solution - SolutionEntityItem item = entry as SolutionEntityItem; + SolutionItem item = entry as SolutionItem; if (item != null && renameData.Count > 0) { Solution sol = item.ParentSolution; if (sol != null) { @@ -211,9 +211,9 @@ namespace MonoDevelop.Ide.Gui.Dialogs foreach (ConfigurationData data in children) { SolutionConfigurationEntry ce; if (sourceName != null) - ce = cc.GetEntryForItem ((SolutionEntityItem)data.Entry); + ce = cc.GetEntryForItem ((SolutionItem)data.Entry); else - ce = cc.AddItem ((SolutionEntityItem) data.Entry); + ce = cc.AddItem ((SolutionItem) data.Entry); if (createChildConfigurations) { ce.ItemConfiguration = name; if (data.Configurations [name] == null) diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MultiTaskProgressDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MultiTaskProgressDialog.cs index 8151852824..453fa20070 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MultiTaskProgressDialog.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/MultiTaskProgressDialog.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using Gtk; using MonoDevelop.Core; +using System.Threading; namespace MonoDevelop.Ide.Gui.Dialogs { @@ -46,7 +47,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs int ident = 0; List<TextTag> tags = new List<TextTag> (); Stack<string> indents = new Stack<string> (); - IAsyncOperation asyncOperation; + CancellationTokenSource asyncOperation; CellRendererText textRenderer; CellRendererProgress progressRenderer; @@ -99,7 +100,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs Resize (w, 1); } - public IAsyncOperation AsyncOperation { + public CancellationTokenSource CancellationTokenSource { get { return asyncOperation; } set { asyncOperation = value; } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ProgressDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ProgressDialog.cs index 0d39dfe617..52d41f001d 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ProgressDialog.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/ProgressDialog.cs @@ -28,6 +28,7 @@ using System; using Gtk; using System.Collections.Generic; using MonoDevelop.Core; +using System.Threading; namespace MonoDevelop.Ide.Gui.Dialogs { @@ -40,9 +41,8 @@ namespace MonoDevelop.Ide.Gui.Dialogs int ident = 0; List<TextTag> tags = new List<TextTag> (); Stack<string> indents = new Stack<string> (); - IAsyncOperation asyncOperation; - public event EventHandler OperationCancelled; - + CancellationTokenSource cancellationTokenSource; + public ProgressDialog (bool allowCancel, bool showDetails): this (null, allowCancel, showDetails) { } @@ -74,9 +74,9 @@ namespace MonoDevelop.Ide.Gui.Dialogs tags.Add (tag); } - public IAsyncOperation AsyncOperation { - get { return asyncOperation; } - set { asyncOperation = value; } + public CancellationTokenSource CancellationTokenSource { + get { return cancellationTokenSource; } + set { cancellationTokenSource = value; } } public string Message { @@ -168,11 +168,8 @@ namespace MonoDevelop.Ide.Gui.Dialogs protected void OnBtnCancelClicked (object sender, EventArgs e) { - if (asyncOperation != null) - asyncOperation.Cancel (); - - if (OperationCancelled != null) - OperationCancelled (this, null); + if (cancellationTokenSource != null) + cancellationTokenSource.Cancel (); } bool UpdateSize () diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/SelectEncodingsDialog.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/SelectEncodingsDialog.cs index 1bd10c36ef..7bd95d1488 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/SelectEncodingsDialog.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/SelectEncodingsDialog.cs @@ -32,40 +32,10 @@ using Gtk; using MonoDevelop.Core; using System.Text; using System.Collections.Generic; +using MonoDevelop.Projects.Text; namespace MonoDevelop.Ide { - public static class SelectedEncodings - { - static int[] conversionEncodings = null; - public static int[] ConversionEncodings { - get { - if (conversionEncodings == null) { - string propertyEncodings = PropertyService.Get ("MonoDevelop.Ide.SelectEncodingsDialog.ConversionEncodings", string.Join (",", DefaultEncodings)); - try { - conversionEncodings = propertyEncodings.Split (',').Select (e => int.Parse (e.Trim ())).ToArray (); - } catch (Exception) { - conversionEncodings = DefaultEncodings; - } - } - - return conversionEncodings; - } - set { - conversionEncodings = value; - PropertyService.Set ("MonoDevelop.Ide.SelectEncodingsDialog.ConversionEncodings", string.Join (",", value)); - Console.WriteLine ("set to:" + string.Join (",", value)); - } - } - - const int ISO_8859_15 = 28605; - public readonly static int[] DefaultEncodings = new int[] { - Encoding.UTF8.CodePage, - ISO_8859_15, - Encoding.Unicode.CodePage - }; - } - internal partial class SelectEncodingsDialog: Gtk.Dialog { ListStore storeAvail; @@ -86,13 +56,12 @@ namespace MonoDevelop.Ide listSelected.AppendColumn ("Encoding", new Gtk.CellRendererText (), "text", 1); foreach (var e in Encoding.GetEncodings ()) { - // if (!((IList)TextEncoding.ConversionEncodings).Contains (e)) var enc = e.GetEncoding (); storeAvail.AppendValues (enc.EncodingName, enc.WebName, e.CodePage); } - foreach (var e in SelectedEncodings.ConversionEncodings) { - var enc = Encoding.GetEncoding (e); + foreach (var e in TextEncoding.ConversionEncodings) { + var enc = Encoding.GetEncoding (e.CodePage); storeSelected.AppendValues (enc.EncodingName, enc.WebName, enc.CodePage); } } catch (Exception ex) { @@ -115,7 +84,7 @@ namespace MonoDevelop.Ide list.Add (enc); } while (storeSelected.IterNext (ref iter)); } - SelectedEncodings.ConversionEncodings = list.ToArray (); + TextEncoding.ConversionEncodings = list.Select ((id) => TextEncoding.GetEncoding (id)).ToArray (); } protected void OnAddClicked (object ob, EventArgs args) |