]> O.S.I.I.S - jp/crow.git/commitdiff
add Caching property to Group, to allow disabling caching for very often updated...
authorjpbruyere <jp.bruyere@hotmail.com>
Fri, 5 Feb 2016 09:17:21 +0000 (10:17 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Fri, 5 Feb 2016 09:17:21 +0000 (10:17 +0100)
Crow.userprefs
Tests/Interfaces/4.crow
src/GraphicObjects/GraphicObject.cs
src/GraphicObjects/Group.cs

index a89a8f1f7be11402a66266f6545454a02da085d1..1119c3997d3b428111069ee604aa33c7964e186a 100644 (file)
@@ -1,17 +1,11 @@
 <Properties GitUserInfo="UsingGIT" StartupItem="Tests/Tests.csproj">
   <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|Linux_x86" />
-  <MonoDevelop.Ide.Workbench ActiveDocument="Tests/GOLIBTests.cs">
+  <MonoDevelop.Ide.Workbench ActiveDocument="src/GraphicObjects/Group.cs">
     <Files>
-      <File FileName="Tests/GOLIBTests.cs" Line="98" Column="2" />
-      <File FileName="src/GraphicObjects/GraphicObject.cs" Line="538" Column="3" />
-      <File FileName="src/GraphicObjects/Group.cs" Line="197" Column="1" />
-      <File FileName="src/GraphicObjects/PrivateContainer.cs" Line="127" Column="1" />
-      <File FileName="src/OpenTKGameWindow.cs" Line="328" Column="10" />
-      <File FileName="src/Rectangles.cs" Line="90" Column="21" />
-      <File FileName="src/GraphicObjects/Scroller.cs" Line="196" Column="1" />
-      <File FileName="src/LayoutingQueue.cs" Line="30" Column="4" />
-      <File FileName="src/Interface.cs" Line="56" Column="1" />
-      <File FileName="UnitTest/NUnitCrowWindow.cs" Line="163" Column="1" />
+      <File FileName="Tests/Interfaces/4.crow" Line="371" Column="19" />
+      <File FileName="Tests/GOLIBTests.cs" Line="40" Column="6" />
+      <File FileName="src/GraphicObjects/Group.cs" Line="247" Column="31" />
+      <File FileName="src/GraphicObjects/GraphicObject.cs" Line="462" Column="22" />
     </Files>
   </MonoDevelop.Ide.Workbench>
   <MonoDevelop.Ide.DebuggingService.Breakpoints>
index 833e2bcebeeb70f2fcdd699e722a7994b8623df5..ba7cb110a739942248f0242ce75b0f1b84a376c2 100755 (executable)
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <HorizontalStack Fit="true">
-       <VerticalStack Fit="true" Name="vsFps"  Spacing="10" >
+       <VerticalStack Fit="true" Spacing="10" Caching="false">
                <HorizontalStack Fit="true">
                        <Label Text="Update:" Width="50" TextAlignment="RightCenter"/>
                        <Label Name="labUpdate" Text="{update}" Font="droid,12" Width="80" TextAlignment="Center"
@@ -92,7 +92,7 @@
                                Background="vgradient|0:AoEnglish|1:Black"/>
                </HorizontalStack>
        </VerticalStack>
-       <VerticalStack Fit="true" Name="vsFps"  Spacing="10" >
+       <VerticalStack Fit="true" Spacing="10" Caching="false">
                <HorizontalStack Fit="true">
                        <Label Text="Update:" Width="50" TextAlignment="RightCenter"/>
                        <Label Name="labUpdate" Text="{update}" Font="droid,12" Width="80" TextAlignment="Center"
                                Background="vgradient|0:AoEnglish|1:Black"/>
                </HorizontalStack>
        </VerticalStack>
-       <VerticalStack Fit="true" Name="vsFps"  Spacing="10" >
+       <VerticalStack Fit="true" Spacing="10" Caching="false">
                <HorizontalStack Fit="true">
                        <Label Text="Update:" Width="50" TextAlignment="RightCenter"/>
                        <Label Name="labUpdate" Text="{update}" Font="droid,12" Width="80" TextAlignment="Center"
                                Background="vgradient|0:AoEnglish|1:Black"/>
                </HorizontalStack>
        </VerticalStack>
-       <VerticalStack Fit="true" Name="vsFps"  Spacing="10" >
+       <VerticalStack Fit="true" Spacing="10" Caching="false">
                <HorizontalStack Fit="true">
                        <Label Text="Update:" Width="50" TextAlignment="RightCenter"/>
                        <Label Name="labUpdate" Text="{update}" Font="droid,12" Width="80" TextAlignment="Center"
index b9b142c08ca261b888b1a68727c17ca94ca5e16b..140e591728acabcf48f80b0a830305ea3fda0cac 100644 (file)
@@ -79,6 +79,7 @@ namespace Crow
                HorizontalAlignment _horizontalAlignment = HorizontalAlignment.Center;
                Size _maximumSize = "0;0";
                Size _minimumSize = "0;0";
+               bool isRegisteredForRepaint = false;
                #endregion
 
                #region public fields
@@ -459,11 +460,16 @@ namespace Crow
                        //test if this speed up a lot to cancel clipping for an uncached group
                        Group p = Parent as Group;
                        if (p != null) {
-                               if (p.bmp == null)
+                               if (p.bmp == null || !p.Caching) {
+                                       p.RegisterForRedraw (); 
                                        return;
+                               }
                        }
-                       if (HostContainer != null)
-                               HostContainer.gobjsToRedraw.Add (this);
+                       if (HostContainer == null || isRegisteredForRepaint)
+                               return;
+
+                       HostContainer.gobjsToRedraw.Add (this);
+                       isRegisteredForRepaint = true;
                }
 
                /// <summary>
@@ -485,6 +491,7 @@ namespace Crow
                        //this clipping should take only last painted slots in ancestor tree which
                        //is not the case for now.
                        HostContainer.redrawClip.AddRectangle (ScreenCoordinates(LastPaintedSlot));
+                       isRegisteredForRepaint = false;
                }
                /// <summary> return size of content + margins </summary>
                protected virtual Size measureRawSize ()
index 5107ccc5da620484188acfbb706ab857a61c057a..a6dfd0c2c7895da66875ecc4fb5c56ac016039f7 100644 (file)
@@ -27,10 +27,14 @@ namespace Crow
                internal int maxChildrenHeight = 0;
 
         bool _multiSelect = false;
+               bool _caching = false;
                List<GraphicObject> children = new List<GraphicObject>();
 
         public GraphicObject activeWidget;
 
+
+
+
         public virtual List<GraphicObject> Children {
                        get { return children; }
                        set { children = value; }
@@ -39,9 +43,23 @@ namespace Crow
         public bool MultiSelect
         {
             get { return _multiSelect; }
-            set { _multiSelect = value; }
+            set { 
+                               if (value == _multiSelect)
+                                       return;
+                               _multiSelect = value; 
+                               NotifyValueChanged ("MultiSelect", _multiSelect);
+                       }
         }
-                       
+               [XmlAttributeAttribute()][DefaultValue(true)]
+               public bool Caching {
+                       get { return _caching; }
+                       set {
+                               if (value == _caching)
+                                       return;
+                               _caching = value; 
+                               NotifyValueChanged ("Caching", _multiSelect);
+                       }
+               }                       
                        
         public virtual T addChild<T>(T child)
         {