[mono/monodevelop] 74fef848: [SourceEditor] Added text editor option to change the generation of
Mike Krüger (
[email protected] ) <
[email protected] >
Sat, 12 Oct 2013 03:38:56 +0000
Newsgroups
gmane.comp.gnome.mono.patches
Message-ID
<00000141aabedc09-af5bcb10-ae51-4e2c-aa2c-c9fff08d220f-000000@email.amazonses.com>
Branch: refs/heads/master
Home: https://github.com/mono/monodevelop
Compare: https://github.com/mono/monodevelop/compare/f63fcf020a8f...74fef8480fee
Commit: 74fef8480fee2d62bf928066b27f704470973f8f
Author: Mike Krüger <[email protected] > (mkrueger)
Date: 2013-10-12 03:37:35 GMT
URL: https://github.com/mono/monodevelop/commit/74fef8480fee2d62bf928066b27f704470973f8f
[SourceEditor] Added text editor option to change the generation of
multi level undo steps for editor corrections.
Changed paths:
M main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/BehaviorPanel.cs
M main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs
M main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorOptions.cs
M main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/MonoDevelop.SourceEditor.OptionPanels.BehaviorPanel.cs
M main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/gui.stetic
Modified: main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.OptionPanels/BehaviorPanel.cs
===================================================================
@@ -50,15 +50,17 @@ public BehaviorPanel ()
public virtual Gtk.Widget CreatePanelWidget ()
{
// this.autoInsertTemplateCheckbutton.Active = DefaultSourceEditorOptions.Options.AutoInsertTemplates;
- this.autoInsertBraceCheckbutton.Active = DefaultSourceEditorOptions.Instance.AutoInsertMatchingBracket;
- this.smartSemicolonPlaceCheckbutton.Active = DefaultSourceEditorOptions.Instance.SmartSemicolonPlacement;
-
- this.tabAsReindentCheckbutton.Active = DefaultSourceEditorOptions.Instance.TabIsReindent;
- this.indentationCombobox.Active = (int)DefaultSourceEditorOptions.Instance.IndentStyle;
- this.controlLeftRightCombobox.Active = (int)DefaultSourceEditorOptions.Instance.ControlLeftRightMode;
- this.useViModesCheck.Active = DefaultSourceEditorOptions.Instance.UseViModes;
- this.checkbuttonOnTheFlyFormatting.Active = DefaultSourceEditorOptions.Instance.OnTheFlyFormatting;
+ autoInsertBraceCheckbutton.Active = DefaultSourceEditorOptions.Instance.AutoInsertMatchingBracket;
+ smartSemicolonPlaceCheckbutton.Active = DefaultSourceEditorOptions.Instance.SmartSemicolonPlacement;
+ tabAsReindentCheckbutton.Active = DefaultSourceEditorOptions.Instance.TabIsReindent;
+ indentationCombobox.Active = (int)DefaultSourceEditorOptions.Instance.IndentStyle;
+ controlLeftRightCombobox.Active = (int)DefaultSourceEditorOptions.Instance.ControlLeftRightMode;
+ useViModesCheck.Active = DefaultSourceEditorOptions.Instance.UseViModes;
+ checkbuttonOnTheFlyFormatting.Active = DefaultSourceEditorOptions.Instance.OnTheFlyFormatting;
+ checkbuttonGenerateFormattingUndoStep.Active = DefaultSourceEditorOptions.Instance.GenerateFormattingUndoStep;
+
+
checkbuttonFormatOnSave.Active = PropertyService.Get ("AutoFormatDocumentOnSave", false);
checkbuttonAutoSetSearchPatternCasing.Active = PropertyService.Get ("AutoSetPatternCasing", false);
HandleAutoInsertBraceCheckbuttonToggled (null, null);
@@ -67,19 +69,20 @@ public virtual Gtk.Widget CreatePanelWidget ()
void HandleAutoInsertBraceCheckbuttonToggled (object sender, EventArgs e)
{
- this.smartSemicolonPlaceCheckbutton.Sensitive = this.autoInsertBraceCheckbutton.Active;
+ smartSemicolonPlaceCheckbutton.Sensitive = autoInsertBraceCheckbutton.Active;
}
public virtual void ApplyChanges ()
{
//DefaultSourceEditorOptions.Options.AutoInsertTemplates = this.autoInsertTemplateCheckbutton.Active;
- DefaultSourceEditorOptions.Instance.AutoInsertMatchingBracket = this.autoInsertBraceCheckbutton.Active;
- DefaultSourceEditorOptions.Instance.SmartSemicolonPlacement = this.smartSemicolonPlaceCheckbutton.Active;
- DefaultSourceEditorOptions.Instance.IndentStyle = (IndentStyle)this.indentationCombobox.Active;
- DefaultSourceEditorOptions.Instance.TabIsReindent = this.tabAsReindentCheckbutton.Active;
- DefaultSourceEditorOptions.Instance.ControlLeftRightMode = (ControlLeftRightMode)this.controlLeftRightCombobox.Active;
- DefaultSourceEditorOptions.Instance.UseViModes = this.useViModesCheck.Active;
- DefaultSourceEditorOptions.Instance.OnTheFlyFormatting = this.checkbuttonOnTheFlyFormatting.Active;
+ DefaultSourceEditorOptions.Instance.AutoInsertMatchingBracket = autoInsertBraceCheckbutton.Active;
+ DefaultSourceEditorOptions.Instance.SmartSemicolonPlacement = smartSemicolonPlaceCheckbutton.Active;
+ DefaultSourceEditorOptions.Instance.IndentStyle = (IndentStyle)indentationCombobox.Active;
+ DefaultSourceEditorOptions.Instance.TabIsReindent = tabAsReindentCheckbutton.Active;
+ DefaultSourceEditorOptions.Instance.ControlLeftRightMode = (ControlLeftRightMode)controlLeftRightCombobox.Active;
+ DefaultSourceEditorOptions.Instance.UseViModes = useViModesCheck.Active;
+ DefaultSourceEditorOptions.Instance.OnTheFlyFormatting = checkbuttonOnTheFlyFormatting.Active;
+ DefaultSourceEditorOptions.Instance.GenerateFormattingUndoStep = checkbuttonGenerateFormattingUndoStep.Active;
PropertyService.Set ("AutoSetPatternCasing", checkbuttonAutoSetSearchPatternCasing.Active);
PropertyService.Set ("AutoFormatDocumentOnSave", checkbuttonFormatOnSave.Active);
}
Modified: main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs
===================================================================
@@ -398,8 +398,15 @@ protected override bool OnIMProcessedKeyPressEvent (Gdk.Key key, uint ch, Gdk.Mo
skipChars.Remove (skipChar);
}
if (Extension != null) {
- if (ExtensionKeyPress (key, ch, state))
- result = base.OnIMProcessedKeyPressEvent (key, ch, state);
+ if (!DefaultSourceEditorOptions.Instance.GenerateFormattingUndoStep) {
+ using (var undo = Document.OpenUndoGroup ()) {
+ if (ExtensionKeyPress (key, ch, state))
+ result = base.OnIMProcessedKeyPressEvent (key, ch, state);
+ }
+ } else {
+ if (ExtensionKeyPress (key, ch, state))
+ result = base.OnIMProcessedKeyPressEvent (key, ch, state);
+ }
if (returnBetweenBraces)
HitReturn ();
} else {
Modified: main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorOptions.cs
===================================================================
@@ -231,6 +231,7 @@ void LoadAllPrefs ()
this.EnableHighlightUsages = PropertyService.Get ("EnableHighlightUsages", false);
base.DrawIndentationMarkers = PropertyService.Get ("DrawIndentationMarkers", false);
this.lineEndingConversion = PropertyService.Get ("LineEndingConversion", LineEndingConversion.Ask);
+ this.generateFormattingUndoStep = PropertyService.Get ("GenerateFormattingUndoStep", true);
base.ShowWhitespaces = PropertyService.Get ("ShowWhitespaces", Mono.TextEditor.ShowWhitespaces.Never);
base.IncludeWhitespaces = PropertyService.Get ("IncludeWhitespaces", Mono.TextEditor.IncludeWhitespaces.All);
base.WrapLines = PropertyService.Get ("WrapLines", false);
@@ -412,6 +413,20 @@ void LoadAllPrefs ()
}
}
+
+ bool generateFormattingUndoStep;
+ public bool GenerateFormattingUndoStep {
+ get {
+ return generateFormattingUndoStep;
+ }
+ set {
+ if (value != this.generateFormattingUndoStep) {
+ this.generateFormattingUndoStep = value;
+ PropertyService.Set ("GenerateFormattingUndoStep", value);
+ OnChanged (EventArgs.Empty);
+ }
+ }
+ }
#endregion
bool useViModes = false;
Modified: main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/MonoDevelop.SourceEditor.OptionPanels.BehaviorPanel.cs
===================================================================
@@ -15,6 +15,7 @@ public partial class BehaviorPanel
private global::Gtk.CheckButton checkbuttonOnTheFlyFormatting;
private global::Gtk.CheckButton checkbuttonFormatOnSave;
private global::Gtk.CheckButton checkbuttonAutoSetSearchPatternCasing;
+ private global::Gtk.CheckButton checkbuttonGenerateFormattingUndoStep;
private global::Gtk.Label GtkLabel6;
private global::Gtk.Alignment GtkAlignment;
private global::Gtk.VBox vbox2;
@@ -29,7 +30,7 @@ public partial class BehaviorPanel
private global::Gtk.HBox hbox3;
private global::Gtk.Label label2;
private global::Gtk.ComboBox controlLeftRightCombobox;
-
+
protected virtual void Build ()
{
global::Stetic.Gui.Initialize (this);
@@ -136,12 +137,24 @@ protected virtual void Build ()
w8.Position = 4;
w8.Expand = false;
w8.Fill = false;
+ // Container child vbox4.Gtk.Box+BoxChild
+ this.checkbuttonGenerateFormattingUndoStep = new global::Gtk.CheckButton ();
+ this.checkbuttonGenerateFormattingUndoStep.CanFocus = true;
+ this.checkbuttonGenerateFormattingUndoStep.Name = "checkbuttonGenerateFormattingUndoStep";
+ this.checkbuttonGenerateFormattingUndoStep.Label = global::Mono.Unix.Catalog.GetString ("_Generate additional undo steps for formatting");
+ this.checkbuttonGenerateFormattingUndoStep.DrawIndicator = true;
+ this.checkbuttonGenerateFormattingUndoStep.UseUnderline = true;
+ this.vbox4.Add (this.checkbuttonGenerateFormattingUndoStep);
+ global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.vbox4 [this.checkbuttonGenerateFormattingUndoStep]));
+ w9.Position = 5;
+ w9.Expand = false;
+ w9.Fill = false;
this.alignment3.Add (this.vbox4);
this.vbox1.Add (this.alignment3);
- global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.alignment3]));
- w10.Position = 1;
- w10.Expand = false;
- w10.Fill = false;
+ global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.alignment3]));
+ w11.Position = 1;
+ w11.Expand = false;
+ w11.Fill = false;
// Container child vbox1.Gtk.Box+BoxChild
this.GtkLabel6 = new global::Gtk.Label ();
this.GtkLabel6.Name = "GtkLabel6";
@@ -149,10 +162,10 @@ protected virtual void Build ()
this.GtkLabel6.LabelProp = global::Mono.Unix.Catalog.GetString ("<b>Indentation</b>");
this.GtkLabel6.UseMarkup = true;
this.vbox1.Add (this.GtkLabel6);
- global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.GtkLabel6]));
- w11.Position = 2;
- w11.Expand = false;
- w11.Fill = false;
+ global::Gtk.Box.BoxChild w12 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.GtkLabel6]));
+ w12.Position = 2;
+ w12.Expand = false;
+ w12.Fill = false;
// Container child vbox1.Gtk.Box+BoxChild
this.GtkAlignment = new global::Gtk.Alignment (0F, 0F, 1F, 1F);
this.GtkAlignment.Name = "GtkAlignment";
@@ -171,23 +184,23 @@ protected virtual void Build ()
this.label1.LabelProp = global::Mono.Unix.Catalog.GetString ("_Indentation mode:");
this.label1.UseUnderline = true;
this.hbox1.Add (this.label1);
- global::Gtk.Box.BoxChild w12 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.label1]));
- w12.Position = 0;
- w12.Expand = false;
- w12.Fill = false;
+ global::Gtk.Box.BoxChild w13 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.label1]));
+ w13.Position = 0;
+ w13.Expand = false;
+ w13.Fill = false;
// Container child hbox1.Gtk.Box+BoxChild
this.indentationCombobox = global::Gtk.ComboBox.NewText ();
this.indentationCombobox.Name = "indentationCombobox";
this.hbox1.Add (this.indentationCombobox);
- global::Gtk.Box.BoxChild w13 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.indentationCombobox]));
- w13.Position = 1;
- w13.Expand = false;
- w13.Fill = false;
- this.vbox2.Add (this.hbox1);
- global::Gtk.Box.BoxChild w14 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.hbox1]));
- w14.Position = 0;
+ global::Gtk.Box.BoxChild w14 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.indentationCombobox]));
+ w14.Position = 1;
w14.Expand = false;
w14.Fill = false;
+ this.vbox2.Add (this.hbox1);
+ global::Gtk.Box.BoxChild w15 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.hbox1]));
+ w15.Position = 0;
+ w15.Expand = false;
+ w15.Fill = false;
// Container child vbox2.Gtk.Box+BoxChild
this.tabAsReindentCheckbutton = new global::Gtk.CheckButton ();
this.tabAsReindentCheckbutton.CanFocus = true;
@@ -196,16 +209,16 @@ protected virtual void Build ()
this.tabAsReindentCheckbutton.DrawIndicator = true;
this.tabAsReindentCheckbutton.UseUnderline = true;
this.vbox2.Add (this.tabAsReindentCheckbutton);
- global::Gtk.Box.BoxChild w15 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.tabAsReindentCheckbutton]));
- w15.Position = 1;
- w15.Expand = false;
- w15.Fill = false;
+ global::Gtk.Box.BoxChild w16 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.tabAsReindentCheckbutton]));
+ w16.Position = 1;
+ w16.Expand = false;
+ w16.Fill = false;
this.GtkAlignment.Add (this.vbox2);
this.vbox1.Add (this.GtkAlignment);
- global::Gtk.Box.BoxChild w17 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.GtkAlignment]));
- w17.Position = 3;
- w17.Expand = false;
- w17.Fill = false;
+ global::Gtk.Box.BoxChild w18 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.GtkAlignment]));
+ w18.Position = 3;
+ w18.Expand = false;
+ w18.Fill = false;
// Container child vbox1.Gtk.Box+BoxChild
this.GtkLabel8 = new global::Gtk.Label ();
this.GtkLabel8.Name = "GtkLabel8";
@@ -213,10 +226,10 @@ protected virtual void Build ()
this.GtkLabel8.LabelProp = global::Mono.Unix.Catalog.GetString ("<b>Navigation</b>");
this.GtkLabel8.UseMarkup = true;
this.vbox1.Add (this.GtkLabel8);
- global::Gtk.Box.BoxChild w18 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.GtkLabel8]));
- w18.Position = 4;
- w18.Expand = false;
- w18.Fill = false;
+ global::Gtk.Box.BoxChild w19 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.GtkLabel8]));
+ w19.Position = 4;
+ w19.Expand = false;
+ w19.Fill = false;
// Container child vbox1.Gtk.Box+BoxChild
this.alignment4 = new global::Gtk.Alignment (0.5F, 0.5F, 1F, 1F);
this.alignment4.Name = "alignment4";
@@ -233,10 +246,10 @@ protected virtual void Build ()
this.useViModesCheck.DrawIndicator = true;
this.useViModesCheck.UseUnderline = true;
this.vbox5.Add (this.useViModesCheck);
- global::Gtk.Box.BoxChild w19 = ((global::Gtk.Box.BoxChild)(this.vbox5 [this.useViModesCheck]));
- w19.Position = 0;
- w19.Expand = false;
- w19.Fill = false;
+ global::Gtk.Box.BoxChild w20 = ((global::Gtk.Box.BoxChild)(this.vbox5 [this.useViModesCheck]));
+ w20.Position = 0;
+ w20.Expand = false;
+ w20.Fill = false;
// Container child vbox5.Gtk.Box+BoxChild
this.hbox3 = new global::Gtk.HBox ();
this.hbox3.Name = "hbox3";
@@ -247,29 +260,29 @@ protected virtual void Build ()
this.label2.LabelProp = global::Mono.Unix.Catalog.GetString ("Word _break mode:");
this.label2.UseUnderline = true;
this.hbox3.Add (this.label2);
- global::Gtk.Box.BoxChild w20 = ((global::Gtk.Box.BoxChild)(this.hbox3 [this.label2]));
- w20.Position = 0;
- w20.Expand = false;
- w20.Fill = false;
+ global::Gtk.Box.BoxChild w21 = ((global::Gtk.Box.BoxChild)(this.hbox3 [this.label2]));
+ w21.Position = 0;
+ w21.Expand = false;
+ w21.Fill = false;
// Container child hbox3.Gtk.Box+BoxChild
this.controlLeftRightCombobox = global::Gtk.ComboBox.NewText ();
this.controlLeftRightCombobox.Name = "controlLeftRightCombobox";
this.hbox3.Add (this.controlLeftRightCombobox);
- global::Gtk.Box.BoxChild w21 = ((global::Gtk.Box.BoxChild)(this.hbox3 [this.controlLeftRightCombobox]));
- w21.Position = 1;
- w21.Expand = false;
- w21.Fill = false;
- this.vbox5.Add (this.hbox3);
- global::Gtk.Box.BoxChild w22 = ((global::Gtk.Box.BoxChild)(this.vbox5 [this.hbox3]));
+ global::Gtk.Box.BoxChild w22 = ((global::Gtk.Box.BoxChild)(this.hbox3 [this.controlLeftRightCombobox]));
w22.Position = 1;
w22.Expand = false;
w22.Fill = false;
+ this.vbox5.Add (this.hbox3);
+ global::Gtk.Box.BoxChild w23 = ((global::Gtk.Box.BoxChild)(this.vbox5 [this.hbox3]));
+ w23.Position = 1;
+ w23.Expand = false;
+ w23.Fill = false;
this.alignment4.Add (this.vbox5);
this.vbox1.Add (this.alignment4);
- global::Gtk.Box.BoxChild w24 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.alignment4]));
- w24.Position = 5;
- w24.Expand = false;
- w24.Fill = false;
+ global::Gtk.Box.BoxChild w25 = ((global::Gtk.Box.BoxChild)(this.vbox1 [this.alignment4]));
+ w25.Position = 5;
+ w25.Expand = false;
+ w25.Fill = false;
this.Add (this.vbox1);
if ((this.Child != null)) {
this.Child.ShowAll ();
Modified: main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/gui.stetic
===================================================================
@@ -7,6 +7,7 @@
<import>
<widget-library name="../../../../build/bin/MonoDevelop.Ide.dll" />
<widget-library name="../../../../build/AddIns/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.dll" />
+ <widget-library name="../../../../build/AddIns/MonoDevelop.Debugger/MonoDevelop.Debugger.dll" />
<widget-library name="../../../../build/bin/Mono.TextEditor.dll" />
<widget-library name="../../../../build/AddIns/DisplayBindings/SourceEditor/MonoDevelop.SourceEditor2.dll" internal="true" />
</import>
@@ -717,6 +718,22 @@
<property name="Fill">False</property>
</packing>
</child>
+ <child>
+ <widget class="Gtk.CheckButton" id="checkbuttonGenerateFormattingUndoStep">
+ <property name="MemberName" />
+ <property name="CanFocus">True</property>
+ <property name="Label" translatable="yes">_Generate additional undo steps for formatting</property>
+ <property name="DrawIndicator">True</property>
+ <property name="HasLabel">True</property>
+ <property name="UseUnderline">True</property>
+ </widget>
+ <packing>
+ <property name="Position">5</property>
+ <property name="AutoSize">True</property>
+ <property name="Expand">False</property>
+ <property name="Fill">False</property>
+ </packing>
+ </child>
</widget>
</child>
</widget>
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches