Author: mkrueger
Date: 2008-02-17 19:54:13 -0500 (Sun, 17 Feb 2008)
New Revision: 96023

Modified:
   trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/ChangeLog
   
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SearchAndReplaceWidget.cs
   
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SearchWidget.cs
   
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs
   
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/MonoDevelop.SourceEditor.SearchAndReplaceWidget.cs
   
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/MonoDevelop.SourceEditor.SearchWidget.cs
   
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/objects.xml
Log:
* gtk-gui/MonoDevelop.SourceEditor.SearchAndReplaceWidget.cs,
  gtk-gui/MonoDevelop.SourceEditor.SearchWidget.cs,
  MonoDevelop.SourceEditor/SourceEditorWidget.cs,
  MonoDevelop.SourceEditor/SearchAndReplaceWidget.cs,
  MonoDevelop.SourceEditor/SearchWidget.cs: replace/search patterns
  are now static.

Modified: trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/ChangeLog
===================================================================
--- trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/ChangeLog       
2008-02-18 00:51:09 UTC (rev 96022)
+++ trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/ChangeLog       
2008-02-18 00:54:13 UTC (rev 96023)
@@ -1,5 +1,14 @@
 2008-02-18  Mike Krüger <[EMAIL PROTECTED]> 
 
+       * gtk-gui/MonoDevelop.SourceEditor.SearchAndReplaceWidget.cs,
+         gtk-gui/MonoDevelop.SourceEditor.SearchWidget.cs,
+         MonoDevelop.SourceEditor/SourceEditorWidget.cs,
+         MonoDevelop.SourceEditor/SearchAndReplaceWidget.cs,
+         MonoDevelop.SourceEditor/SearchWidget.cs: replace/search patterns are
+         now static.
+
+2008-02-18  Mike Krüger <[EMAIL PROTECTED]> 
+
        * MonoDevelop.SourceEditor/SourceEditorWidget.cs,
          MonoDevelop.SourceEditor/SourceEditorView.cs: Fixed file system 
watcher.
 

Modified: 
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SearchAndReplaceWidget.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SearchAndReplaceWidget.cs
      2008-02-18 00:51:09 UTC (rev 96022)
+++ 
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SearchAndReplaceWidget.cs
      2008-02-18 00:54:13 UTC (rev 96023)
@@ -42,7 +42,7 @@
                SourceEditorWidget widget;
                ListStore searchHistory = new ListStore (typeof (string));
                ListStore replaceHistory = new ListStore (typeof (string));
-               static string replaceText = ""; // used to store the replace 
text between dialogs
+               static string replacePattern = ""; // used to store the replace 
text between dialogs
                
                public string ReplacePattern {
                        get {
@@ -64,11 +64,20 @@
                        this.Build();
                        
                        this.widget = widget;
+                       
+                       #region Cut & Paste from SearchWidget
+                       if (String.IsNullOrEmpty 
(widget.TextEditor.SearchPattern)) {
+                               widget.TextEditor.SearchPattern = 
SearchWidget.searchPattern;
+                       } else if (widget.TextEditor.SearchPattern != 
SearchWidget.searchPattern) {
+                               SearchWidget.searchPattern = 
widget.TextEditor.SearchPattern;
+                               SearchWidget.FireSearchPatternChanged ();
+                       }
                        this.entrySearch.Entry.Text = 
widget.TextEditor.SearchPattern;
                        this.entrySearch.Model = searchHistory;
                        RestoreSearchHistory ();
+                       #endregion
                        
-                       this.entryReplace.Entry.Text = replaceText;
+                       this.entryReplace.Entry.Text = replacePattern;
                        this.entryReplace.Model = replaceHistory;
                        RestoreReplaceHistory ();
                        
@@ -87,9 +96,16 @@
                        this.comboboxSearchAs.AppendText 
(GettextCatalog.GetString ("Text"));
                        this.comboboxSearchAs.AppendText 
(GettextCatalog.GetString ("Regular Expressions"));
                        this.comboboxSearchAs.Active = 0;
+                       ReplacePatternChanged += UpdateReplacePattern;
                        #region Cut & Paste from SearchWidget
+                       SearchWidget.SearchPatternChanged += 
UpdateSearchPattern;
+                       
                        this.entrySearch.Changed += delegate {
                                widget.TextEditor.SearchPattern = SearchPattern;
+                               if (!SearchWidget.inSearchUpdate) {
+                                       SearchWidget.searchPattern = 
SearchPattern;
+                                       SearchWidget.FireSearchPatternChanged 
();
+                               }
                        };
                        this.entrySearch.Entry.Activated += delegate {
                                UpdateSearchHistory (SearchPattern);
@@ -133,7 +149,9 @@
                        #endregion
                        
                        this.entryReplace.Changed += delegate {
-                               replaceText = ReplacePattern;
+                               replacePattern = ReplacePattern;
+                               if (!inReplaceUpdate) 
+                                       FireReplacePatternChanged ();
                        };
                        
                        this.buttonReplace.Clicked += delegate {
@@ -151,6 +169,9 @@
                
                public override void Dispose ()
                {
+                       SearchWidget.SearchPatternChanged -= 
UpdateSearchPattern;
+                       ReplacePatternChanged -= UpdateReplacePattern;
+                       
                        if (searchHistory != null) {
                                searchHistory.Dispose ();
                                searchHistory = null;
@@ -193,6 +214,12 @@
                        PropertyService.Set ("IsWholeWordOnly", value);
                        widget.SetSearchOptions ();
                }
+               
+               void UpdateSearchPattern (object sender, EventArgs args)
+               {
+                       this.entrySearch.Entry.Text = 
SearchWidget.searchPattern;
+               }
+               
                #endregion
                
                void UpdateReplaceHistory (string item)
@@ -209,5 +236,20 @@
                        }
                }
                
+               void UpdateReplacePattern (object sender, EventArgs args)
+               {
+                       this.entryReplace.Entry.Text = replacePattern;
+               }
+               
+               internal static bool inReplaceUpdate = false;
+               internal static void FireReplacePatternChanged ()
+               {
+                       inReplaceUpdate = true;
+                       if (ReplacePatternChanged != null)
+                               ReplacePatternChanged (null, EventArgs.Empty);
+                       inReplaceUpdate = false;
+               }
+               
+               internal static event EventHandler ReplacePatternChanged;
        }
 }

Modified: 
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SearchWidget.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SearchWidget.cs
        2008-02-18 00:51:09 UTC (rev 96022)
+++ 
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SearchWidget.cs
        2008-02-18 00:54:13 UTC (rev 96023)
@@ -42,6 +42,7 @@
                internal const string seachHistoryProperty = 
"MonoDevelop.FindReplaceDialogs.FindHistory";
                ListStore searchHistory = new ListStore (typeof (string));
                SourceEditorWidget widget;
+               internal static string searchPattern = "";
                
                public static bool IsCaseSensitive {
                        get {
@@ -80,6 +81,12 @@
                {
                        this.Build();
                        this.widget = widget;
+                       if (String.IsNullOrEmpty 
(widget.TextEditor.SearchPattern)) {
+                               widget.TextEditor.SearchPattern = 
SearchWidget.searchPattern;
+                       } else if (widget.TextEditor.SearchPattern != 
SearchWidget.searchPattern) {
+                               searchPattern = widget.TextEditor.SearchPattern;
+                               FireSearchPatternChanged ();
+                       }
                        this.entrySearch.Entry.Text = 
widget.TextEditor.SearchPattern;
                        this.entrySearch.Model = searchHistory;
                        RestoreSearchHistory ();
@@ -92,6 +99,8 @@
                        }
                        
                        // if you change something here don"t forget the 
SearchAndReplaceWidget
+                       SearchWidget.SearchPatternChanged += 
UpdateSearchPattern;
+                       
                        this.closeButton.Clicked += delegate {
                                widget.RemoveSearchWidget ();
                        };
@@ -101,6 +110,10 @@
                        
                        this.entrySearch.Changed += delegate {
                                widget.TextEditor.SearchPattern = SearchPattern;
+                               if (!SearchWidget.inSearchUpdate) {
+                                       SearchWidget.searchPattern = 
SearchPattern;
+                                       FireSearchPatternChanged ();
+                               }
                        };
                        this.entrySearch.Entry.Activated += delegate {
                                UpdateSearchHistory (SearchPattern);
@@ -146,6 +159,7 @@
                
                public override void Dispose ()
                {
+                       SearchPatternChanged -= UpdateSearchPattern;
                        if (searchHistory != null) {
                                searchHistory.Dispose ();
                                searchHistory = null;
@@ -192,9 +206,24 @@
                        }
                }
                
+               void UpdateSearchPattern (object sender, EventArgs args)
+               {
+                       this.entrySearch.Entry.Text = 
SearchWidget.searchPattern;
+               }
                public void Focus ()
                {
                        this.entrySearch.GrabFocus ();
                }
+               
+               internal static bool inSearchUpdate = false;
+               internal static void FireSearchPatternChanged ()
+               {
+                       inSearchUpdate = true;
+                       if (SearchPatternChanged != null)
+                               SearchPatternChanged (null, EventArgs.Empty);
+                       inSearchUpdate = false;
+               }
+               
+               internal static event EventHandler SearchPatternChanged;
        }
 }

Modified: 
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs
  2008-02-18 00:51:09 UTC (rev 96022)
+++ 
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorWidget.cs
  2008-02-18 00:54:13 UTC (rev 96023)
@@ -860,6 +860,8 @@
                {
                        if (searchWidget == null) {
                                KillWidgets ();
+                               if (TextEditor.IsSomethingSelected)
+                                       TextEditor.SearchPattern = 
TextEditor.SelectedText;
                                searchWidget = new SearchWidget (this);
                                editorBar.Add (searchWidget);
                                editorBar.SetChildPacking(searchWidget, false, 
true, 0, PackType.End);
@@ -874,6 +876,8 @@
                { 
                        if (searchAndReplaceWidget == null) {
                                KillWidgets ();
+                               if (TextEditor.IsSomethingSelected)
+                                       TextEditor.SearchPattern = 
TextEditor.SelectedText;
                                searchAndReplaceWidget = new 
SearchAndReplaceWidget (this);
                                editorBar.Add (searchAndReplaceWidget);
                                
editorBar.SetChildPacking(searchAndReplaceWidget, false, true, 0, PackType.End);

Modified: 
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/MonoDevelop.SourceEditor.SearchAndReplaceWidget.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/MonoDevelop.SourceEditor.SearchAndReplaceWidget.cs
      2008-02-18 00:51:09 UTC (rev 96022)
+++ 
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/MonoDevelop.SourceEditor.SearchAndReplaceWidget.cs
      2008-02-18 00:54:13 UTC (rev 96023)
@@ -118,14 +118,14 @@
             this.buttonSearchForward.UseUnderline = true;
             // Container child buttonSearchForward.Gtk.Container+ContainerChild
             Gtk.Alignment w5 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
-            // Container child GtkAlignment.Gtk.Container+ContainerChild
+            // Container child GtkAlignment1.Gtk.Container+ContainerChild
             Gtk.HBox w6 = new Gtk.HBox();
             w6.Spacing = 2;
-            // Container child GtkHBox.Gtk.Container+ContainerChild
+            // Container child GtkHBox2.Gtk.Container+ContainerChild
             Gtk.Image w7 = new Gtk.Image();
             w7.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-go-forward", 
Gtk.IconSize.Menu, 16);
             w6.Add(w7);
-            // Container child GtkHBox.Gtk.Container+ContainerChild
+            // Container child GtkHBox2.Gtk.Container+ContainerChild
             Gtk.Label w9 = new Gtk.Label();
             w9.LabelProp = Mono.Unix.Catalog.GetString("_Next");
             w9.UseUnderline = true;
@@ -144,14 +144,14 @@
             this.buttonSearchBackward.UseUnderline = true;
             // Container child 
buttonSearchBackward.Gtk.Container+ContainerChild
             Gtk.Alignment w14 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
-            // Container child GtkAlignment.Gtk.Container+ContainerChild
+            // Container child GtkAlignment2.Gtk.Container+ContainerChild
             Gtk.HBox w15 = new Gtk.HBox();
             w15.Spacing = 2;
-            // Container child GtkHBox.Gtk.Container+ContainerChild
+            // Container child GtkHBox3.Gtk.Container+ContainerChild
             Gtk.Image w16 = new Gtk.Image();
             w16.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-go-back", 
Gtk.IconSize.Menu, 16);
             w15.Add(w16);
-            // Container child GtkHBox.Gtk.Container+ContainerChild
+            // Container child GtkHBox3.Gtk.Container+ContainerChild
             Gtk.Label w18 = new Gtk.Label();
             w18.LabelProp = Mono.Unix.Catalog.GetString("_Previous");
             w18.UseUnderline = true;
@@ -170,14 +170,14 @@
             this.buttonOptions.UseUnderline = true;
             // Container child buttonOptions.Gtk.Container+ContainerChild
             Gtk.Alignment w23 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
-            // Container child GtkAlignment.Gtk.Container+ContainerChild
+            // Container child GtkAlignment3.Gtk.Container+ContainerChild
             Gtk.HBox w24 = new Gtk.HBox();
             w24.Spacing = 2;
-            // Container child GtkHBox.Gtk.Container+ContainerChild
+            // Container child GtkHBox4.Gtk.Container+ContainerChild
             Gtk.Image w25 = new Gtk.Image();
             w25.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-preferences", 
Gtk.IconSize.Menu, 16);
             w24.Add(w25);
-            // Container child GtkHBox.Gtk.Container+ContainerChild
+            // Container child GtkHBox4.Gtk.Container+ContainerChild
             Gtk.Label w27 = new Gtk.Label();
             w27.LabelProp = Mono.Unix.Catalog.GetString("_Options");
             w27.UseUnderline = true;
@@ -209,11 +209,11 @@
             // Container child GtkAlignment.Gtk.Container+ContainerChild
             Gtk.HBox w34 = new Gtk.HBox();
             w34.Spacing = 2;
-            // Container child GtkHBox.Gtk.Container+ContainerChild
+            // Container child GtkHBox1.Gtk.Container+ContainerChild
             Gtk.Image w35 = new Gtk.Image();
             w35.Pixbuf = Stetic.IconLoader.LoadIcon(this, 
"gtk-find-and-replace", Gtk.IconSize.Menu, 16);
             w34.Add(w35);
-            // Container child GtkHBox.Gtk.Container+ContainerChild
+            // Container child GtkHBox1.Gtk.Container+ContainerChild
             Gtk.Label w37 = new Gtk.Label();
             w37.LabelProp = Mono.Unix.Catalog.GetString("_Replace");
             w37.UseUnderline = true;

Modified: 
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/MonoDevelop.SourceEditor.SearchWidget.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/MonoDevelop.SourceEditor.SearchWidget.cs
        2008-02-18 00:51:09 UTC (rev 96022)
+++ 
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/MonoDevelop.SourceEditor.SearchWidget.cs
        2008-02-18 00:54:13 UTC (rev 96023)
@@ -87,11 +87,11 @@
             // Container child GtkAlignment.Gtk.Container+ContainerChild
             Gtk.HBox w6 = new Gtk.HBox();
             w6.Spacing = 2;
-            // Container child GtkHBox.Gtk.Container+ContainerChild
+            // Container child GtkHBox1.Gtk.Container+ContainerChild
             Gtk.Image w7 = new Gtk.Image();
             w7.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-go-forward", 
Gtk.IconSize.Menu, 16);
             w6.Add(w7);
-            // Container child GtkHBox.Gtk.Container+ContainerChild
+            // Container child GtkHBox1.Gtk.Container+ContainerChild
             Gtk.Label w9 = new Gtk.Label();
             w9.LabelProp = Mono.Unix.Catalog.GetString("_Next");
             w9.UseUnderline = true;
@@ -110,14 +110,14 @@
             this.buttonSearchBackward.UseUnderline = true;
             // Container child 
buttonSearchBackward.Gtk.Container+ContainerChild
             Gtk.Alignment w14 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
-            // Container child GtkAlignment.Gtk.Container+ContainerChild
+            // Container child GtkAlignment1.Gtk.Container+ContainerChild
             Gtk.HBox w15 = new Gtk.HBox();
             w15.Spacing = 2;
-            // Container child GtkHBox.Gtk.Container+ContainerChild
+            // Container child GtkHBox2.Gtk.Container+ContainerChild
             Gtk.Image w16 = new Gtk.Image();
             w16.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-go-back", 
Gtk.IconSize.Menu, 16);
             w15.Add(w16);
-            // Container child GtkHBox.Gtk.Container+ContainerChild
+            // Container child GtkHBox2.Gtk.Container+ContainerChild
             Gtk.Label w18 = new Gtk.Label();
             w18.LabelProp = Mono.Unix.Catalog.GetString("_Previous");
             w18.UseUnderline = true;
@@ -136,14 +136,14 @@
             this.buttonOptions.UseUnderline = true;
             // Container child buttonOptions.Gtk.Container+ContainerChild
             Gtk.Alignment w23 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
-            // Container child GtkAlignment.Gtk.Container+ContainerChild
+            // Container child GtkAlignment2.Gtk.Container+ContainerChild
             Gtk.HBox w24 = new Gtk.HBox();
             w24.Spacing = 2;
-            // Container child GtkHBox.Gtk.Container+ContainerChild
+            // Container child GtkHBox3.Gtk.Container+ContainerChild
             Gtk.Image w25 = new Gtk.Image();
             w25.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-preferences", 
Gtk.IconSize.Menu, 16);
             w24.Add(w25);
-            // Container child GtkHBox.Gtk.Container+ContainerChild
+            // Container child GtkHBox3.Gtk.Container+ContainerChild
             Gtk.Label w27 = new Gtk.Label();
             w27.LabelProp = Mono.Unix.Catalog.GetString("_Options");
             w27.UseUnderline = true;

Modified: 
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/objects.xml
===================================================================
--- 
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/objects.xml 
    2008-02-18 00:51:09 UTC (rev 96022)
+++ 
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/gtk-gui/objects.xml 
    2008-02-18 00:54:13 UTC (rev 96023)
@@ -48,6 +48,9 @@
   </object>
   <object type="MonoDevelop.SourceEditor.SearchAndReplaceWidget" 
palette-category="MonoDevelop.SourceEditor2" allow-children="false" 
base-type="Gtk.Bin">
     <itemgroups>
+      <itemgroup label="SearchAndReplaceWidget Properties">
+        <property name="SearchPattern" />
+      </itemgroup>
     </itemgroups>
     <signals />
   </object>

_______________________________________________
Mono-patches maillist  -  Mono-patches@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to