]> O.S.I.I.S - jp/crow.git/commitdiff
* Default.style, Instantiator.cs, MessageBox.goml, ScrollBar.cs, GenericStack.cs...
authorjpbruyere <jp.bruyere@hotmail.com>
Fri, 12 Aug 2016 13:46:38 +0000 (15:46 +0200)
committerjpbruyere <jp.bruyere@hotmail.com>
Fri, 12 Aug 2016 13:46:38 +0000 (15:46 +0200)
  debug, codeclean, slot height and width test in Paint to prevent surface creation hang

* Splitter.cs:
  splitter debug

Default.style
Templates/MessageBox.goml
src/GraphicObjects/GenericStack.cs
src/GraphicObjects/GraphicObject.cs
src/GraphicObjects/ScrollBar.cs
src/GraphicObjects/Splitter.cs
src/Instantiator.cs

index 12f5110e437112c8337140cae95afc41c0e27ae2..247219d7e9ecbd0042cbe4d994b15f63c0dccb62 100644 (file)
@@ -50,6 +50,10 @@ Border {
 ProgressBar {
        Foreground = vgradient|0:BlueCrayola|0.5:SkyBlue|1:BlueCrayola;
 }
+ScrollBar {
+       Maximum = 0;
+       Value = 0;
+}
 Icon {
        Margin=1;
        Width=12;
index f40b5640d06b1fd4d7954cf64e5d52064801a1d5..e9dc5148fc4c03788378801fb8642b153ebc9456 100644 (file)
                                TextAlignment="Left"
                                Multiline="true" />             
                </HorizontalStack>
-               <HorizontalStack Margin="1"  Height="Fit" Width="60%" HorizontalAlignment="Right">
-                       <Button Width="48%" Caption="Ok" MouseClick="./onOkButtonClick" />
-                       <GraphicObject Width="4%" Height="5"/>
-                       <Button Width="48%" Caption="Cancel" MouseClick="./onCancelButtonClick" />
+               <HorizontalStack Margin="1" Spacing="0" Height="Fit" Width="60%" HorizontalAlignment="Right">
+                       <Button Width="50%" Caption="Ok" MouseClick="./onOkButtonClick" />
+                       <Button Width="50%" Caption="Cancel" MouseClick="./onCancelButtonClick" />
                </HorizontalStack>
        </VerticalStack>
 </Border>
index efa98d1a5d532761d3be0889394efd4e33b929c6..fcc90e98e07f7b5d7b21cf3b8013f607818c910a 100644 (file)
@@ -175,7 +175,7 @@ namespace Crow
                                                        stretchedGO.Slot.Height = newH;
                                                        stretchedGO.bmp = null;
 #if DEBUG_LAYOUTING
-                                       Debug.WriteLine ("\tAdjusting Width of " + stretchedGO.ToString());
+                                       Debug.WriteLine ("\tAdjusting Height of " + stretchedGO.ToString());
 #endif
                                                        stretchedGO.LayoutChanged -= OnChildLayoutChanges;
                                                        stretchedGO.OnLayoutChanges (LayoutingType.Height);
index 925f69df0b8c015c5243304e42a53ef2d3b920fa..f8d307ea29512911b2ee12f52c529d2b7a63f958 100644 (file)
@@ -512,6 +512,7 @@ namespace Crow
                }
                #endregion
 
+               #region Default and Style Values loading
                /// <summary> Loads the default values from XML attributes default </summary>
                public void loadDefaultValues()
                {
@@ -664,7 +665,7 @@ namespace Crow
                        }
                        return true;
                }
-
+               #endregion
 
                public virtual GraphicObject FindByName(string nameToFind){
                        return string.Equals(nameToFind, _name, StringComparison.Ordinal) ? this : null;
@@ -988,6 +989,10 @@ namespace Crow
                        if (!Visible)
                                return;
 
+                       //TODO:this test should not be necessary
+                       if (Slot.Height < 0 || Slot.Width < 0)
+                               return;
+
                        LastPaintedSlot = Slot;
                        #if DEBUG_LAYOUTING
                        if (CurrentDrawLQIs != null){
index ea75d6d18c4a63c4219dd97416dc68530105916d..017b50acb10b315eb015fdcd14aacdccbb5b9c23 100644 (file)
@@ -14,11 +14,6 @@ namespace Crow
                public ScrollBar() : base()     {}
                #endregion
 
-               [XmlAttributeAttribute()][DefaultValue(0.0)]
-               public override double Maximum {
-                       get { return base.Maximum; }
-                       set { base.Maximum = value; }
-               }
                [XmlAttributeAttribute()][DefaultValue(Orientation.Vertical)]
                public virtual Orientation Orientation
                {
index f33210654f1f97d13ae3f1f4ad8b555a7f56e491..1a1558af73c195462e85ae63fa7f8984bedf4406 100644 (file)
@@ -78,30 +78,40 @@ namespace Crow
                                return;
 
                        GenericStack gs = Parent as GenericStack;
-                       int ptrThis = gs.Children.IndexOf (this);
+                       int ptrSplit = gs.Children.IndexOf (this);
+
+                       if (ptrSplit == 0 || ptrSplit == gs.Children.Count - 1)
+                               return;
 
                        if (gs.Orientation == Orientation.Horizontal) {
-                               if (ptrThis >= 0){
-                                       if (!gs.Children [ptrThis - 1].Width.IsFixed)
-                                               gs.Children [ptrThis - 1].Width = gs.Children [ptrThis - 1].Slot.Width;
-                                       gs.Children [ptrThis - 1].Width = Math.Max(gs.Children [ptrThis - 1].Width + e.XDelta, 1);
-                               }
-                               if (ptrThis < gs.Children.Count - 1){
-                                       if (!gs.Children [ptrThis + 1].Width.IsFixed)
-                                               gs.Children [ptrThis + 1].Width = gs.Children [ptrThis + 1].Slot.Width;                                 
-                                       gs.Children [ptrThis + 1].Width = Math.Max(gs.Children [ptrThis + 1].Width - e.XDelta, 1);
-                               }
+                               if ((gs.Children [ptrSplit - 1].Width + e.XDelta <
+                                       gs.Children [ptrSplit - 1].MinimumSize.Width) ||
+                                       (gs.Children [ptrSplit + 1].Width - e.XDelta <
+                                               gs.Children [ptrSplit + 1].MinimumSize.Width))
+                                       return;
+                               
+                               if (!gs.Children [ptrSplit - 1].Width.IsFixed)
+                                       gs.Children [ptrSplit - 1].Width = gs.Children [ptrSplit - 1].Slot.Width;                                       
+                               if (!gs.Children [ptrSplit + 1].Width.IsFixed)
+                                       gs.Children [ptrSplit + 1].Width = gs.Children [ptrSplit + 1].Slot.Width;
+                               
+                               gs.Children [ptrSplit - 1].Width = gs.Children [ptrSplit - 1].Width + e.XDelta;
+                               gs.Children [ptrSplit + 1].Width = gs.Children [ptrSplit + 1].Width - e.XDelta;
+
                        } else {
-                               if (ptrThis >= 0) {
-                                       if (!gs.Children [ptrThis - 1].Height.IsFixed)
-                                               gs.Children [ptrThis - 1].Height = gs.Children [ptrThis - 1].Slot.Height;
-                                       gs.Children [ptrThis - 1].Height = Math.Max (gs.Children [ptrThis - 1].Height + e.YDelta, 1);
-                               }
-                               if (ptrThis < gs.Children.Count - 1) {
-                                       if (!gs.Children [ptrThis + 1].Height.IsFixed)
-                                               gs.Children [ptrThis + 1].Height = gs.Children [ptrThis + 1].Slot.Height;
-                                       gs.Children [ptrThis + 1].Height = Math.Max (gs.Children [ptrThis + 1].Height - e.YDelta, 1);
-                               }
+                               if ((gs.Children [ptrSplit - 1].Height + e.YDelta <
+                                       gs.Children [ptrSplit - 1].MinimumSize.Height) ||
+                                       (gs.Children [ptrSplit + 1].Height - e.YDelta <
+                                               gs.Children [ptrSplit + 1].MinimumSize.Height))
+                                       return;
+                               
+                               if (!gs.Children [ptrSplit - 1].Height.IsFixed)
+                                       gs.Children [ptrSplit - 1].Height = gs.Children [ptrSplit - 1].Slot.Height;
+                               if (!gs.Children [ptrSplit + 1].Height.IsFixed)
+                                       gs.Children [ptrSplit + 1].Height = gs.Children [ptrSplit + 1].Slot.Height;
+                               
+                               gs.Children [ptrSplit - 1].Height = gs.Children [ptrSplit - 1].Height + e.YDelta;
+                               gs.Children [ptrSplit + 1].Height = gs.Children [ptrSplit + 1].Height - e.YDelta;
                        }
                }
                public override bool UpdateLayout (LayoutingType layoutType)
index e79988fbec660e9568914923d0d2b9f9fb3f2bea..fc3595f43a68f923d7a2c403975cd6e02a941ed8 100644 (file)
@@ -22,6 +22,7 @@ using System;
 using System.Threading;
 using System.IO;
 using System.Text;
+using System.Diagnostics;
 
 namespace Crow
 {
@@ -76,7 +77,7 @@ namespace Crow
                        #if DEBUG_LOAD
                        loadingTime.Stop ();
                        Debug.WriteLine ("IML Instantiator creation '{2}' : {0} ticks, {1} ms",
-                       loadingTime.ElapsedTicks, loadingTime.ElapsedMilliseconds, path);
+                               loadingTime.ElapsedTicks, loadingTime.ElapsedMilliseconds, imlPath);
                        #endif
                }
                public Instantiator (Type _root, Interface.LoaderInvoker _loader)