OSDN Git Service

大量の検索パターンがあると遅くなるのでパターンマッチを行うたびにレイアウトキャッシュを消さないようにした
authorgdkhd812 <test@yahoo.co.jp>
Sat, 22 Apr 2017 07:20:55 +0000 (16:20 +0900)
committergdkhd812 <test@yahoo.co.jp>
Sat, 22 Apr 2017 07:20:55 +0000 (16:20 +0900)
Core/MarkerCollection.cs
Core/WatchDogPattern.cs

index 69b0c4f..a9f697a 100644 (file)
@@ -175,6 +175,7 @@ namespace FooEditEngine
         internal MarkerCollection()
         {
             this.Updated +=new EventHandler((s,e)=>{});
+            this.FireUpdate = true;
         }
 
         /// <summary>
@@ -188,6 +189,15 @@ namespace FooEditEngine
             this.Updated(this, null);
         }
 
+        /// <summary>
+        /// アップデートイベントを発生させるかどうか
+        /// </summary>
+        public bool FireUpdate
+        {
+            get;
+            set;
+        }
+
         void AddImpl(int id, Marker m)
         {
             RangeCollection<Marker> markers;
@@ -208,7 +218,7 @@ namespace FooEditEngine
         {
             foreach (Marker m in collection)
                 this.AddImpl(id, m);
-            this.Updated(this, null);
+            //this.Updated(this, null);
         }
 
         internal void RemoveAll(int id)
@@ -228,7 +238,7 @@ namespace FooEditEngine
             {
                 markers.Remove(start, length);
             }
-            this.Updated(this, null);
+            //this.Updated(this, null);
         }
 
         internal void RemoveAll(int id, HilightType type)
index b5424ee..dc259a9 100644 (file)
@@ -68,7 +68,7 @@ namespace FooEditEngine
     public sealed class MarkerPatternSet
     {
         MarkerCollection markers;
-        Dictionary<int, IMarkerPattern> set = new Dictionary<int, IMarkerPattern>();
+        Dictionary<int, IMarkerPattern> watchDogSet = new Dictionary<int, IMarkerPattern>();
 
         internal MarkerPatternSet(LineToIndexTable lti,MarkerCollection markers)
         {
@@ -79,11 +79,14 @@ namespace FooEditEngine
         void lti_CreateingLayout(object sender, CreateLayoutEventArgs e)
         {
             LineToIndexTable lti = (LineToIndexTable)sender;
-            foreach (int id in this.set.Keys)
+            //\83A\83b\83v\83f\81[\83g\83C\83x\83\93\83g\82ð\8cÄ\82Ñ\8fo\82·\82Æ\8aù\82É\91\8dÝ\82µ\82Ä\82¢\82é\83\8c\83C\83A\83E\83g\83L\83\83\83b\83V\83\85\82ª\8fÁ\82³\82ê\82Ä\82µ\82Ü\82¢\81A\92x\82­\82È\82é
+            this.markers.FireUpdate = false;
+            foreach (int id in this.watchDogSet.Keys)
             {
                 this.markers.RemoveAll(id, e.Index, e.Length);
-                this.markers.AddRange(id, this.set[id].GetMarker(e.Index,e.Content));
+                this.markers.AddRange(id, this.watchDogSet[id].GetMarker(e.Index,e.Content));
             }
+            this.markers.FireUpdate = true;
         }
 
         internal event EventHandler Updated;
@@ -95,7 +98,7 @@ namespace FooEditEngine
         /// <param name="dog">IMarkerPattern\83C\83\93\83^\81[\83t\83F\83C\83X</param>
         public void Add(int id, IMarkerPattern dog)
         {
-            this.set.Add(id, dog);
+            this.watchDogSet.Add(id, dog);
             this.Updated(this, null);
         }
 
@@ -106,7 +109,7 @@ namespace FooEditEngine
         /// <returns>\8aÜ\82Ü\82ê\82Ä\82¢\82ê\82Î\90^\81B\82»\82¤\82Å\82È\82¯\82ê\82Î\8bU</returns>
         public bool Contains(int id)
         {
-            return this.set.ContainsKey(id);
+            return this.watchDogSet.ContainsKey(id);
         }
 
         /// <summary>
@@ -116,7 +119,7 @@ namespace FooEditEngine
         public void Remove(int id)
         {
             this.markers.Clear(id);
-            this.set.Remove(id);
+            this.watchDogSet.Remove(id);
             this.Updated(this, null);
         }
     }