aboutsummaryrefslogtreecommitdiffstatsci
diff options
context:
space:
mode:
-rw-r--r--Backends/CairoBackend/src/ImageBackend.cs9
-rw-r--r--Backends/CairoBackend/src/Surface.cs2
-rw-r--r--Crow/src/DebugUtils/DebugLogger.cs3
-rw-r--r--Crow/src/Interface.cs22
-rw-r--r--Crow/src/LayoutingQueueItem.cs10
-rw-r--r--Crow/src/Widgets/ILayoutable.cs2
-rw-r--r--Crow/src/Widgets/ScrollBar.cs4
-rw-r--r--Crow/src/Widgets/Scroller.cs4
-rw-r--r--Crow/src/Widgets/Widget.cs10
-rw-r--r--Crow/src/Widgets/Window.cs2
-rw-r--r--Directory.Build.props2
-rw-r--r--Drawing2D/src/DbgEvtType.cs (renamed from Crow/src/DebugUtils/DbgEvtType.cs)1
-rw-r--r--Samples/common/src/SampleBase.cs2
-rw-r--r--Samples/common/ui/Interfaces/Experimental/randomProgress.crow5
-rw-r--r--Samples/common/ui/Interfaces/Experimental/table.crow2
15 files changed, 47 insertions, 33 deletions
diff --git a/Backends/CairoBackend/src/ImageBackend.cs b/Backends/CairoBackend/src/ImageBackend.cs
index a90d275a..97b61e24 100644
--- a/Backends/CairoBackend/src/ImageBackend.cs
+++ b/Backends/CairoBackend/src/ImageBackend.cs
@@ -65,15 +65,22 @@ namespace Crow.CairoBackend
{
IContext ctx = base.PrepareUIFrame (existingContext, clipping);
- clear (ctx);
+ for (int i = 0; i < clipping.NumRectangles; i++)
+ ctx.Rectangle (clipping.GetRectangle (i));
+ ctx.Clip ();
+
ctx.PushGroup ();
return ctx;
}
public override void FlushUIFrame(IContext ctx)
{
+ //clear (ctx);
ctx.PopGroupToSource ();
+ //ctx.Save();
+ //ctx.Operator = Operator.Source;
ctx.Paint ();
+ //ctx.Restore();
surf.Flush ();
diff --git a/Backends/CairoBackend/src/Surface.cs b/Backends/CairoBackend/src/Surface.cs
index 1f44d3ab..413384f0 100644
--- a/Backends/CairoBackend/src/Surface.cs
+++ b/Backends/CairoBackend/src/Surface.cs
@@ -142,7 +142,7 @@ namespace Crow.CairoBackend {
handle = IntPtr.Zero;
}
public virtual void Resize (int width, int height) {
-
+ throw new NotImplementedException();
}
public Status Finish ()
diff --git a/Crow/src/DebugUtils/DebugLogger.cs b/Crow/src/DebugUtils/DebugLogger.cs
index d549e19d..c859fef9 100644
--- a/Crow/src/DebugUtils/DebugLogger.cs
+++ b/Crow/src/DebugUtils/DebugLogger.cs
@@ -15,9 +15,6 @@ namespace Crow
{
public static class DbgLogger
{
- /*public static DbgEvtType IncludeEvents = DbgEvtType.All;
- public static DbgEvtType DiscardEvents = DbgEvtType.Focus;*/
-
public static List<DbgEvtType> IncludedEvents = new List<DbgEvtType> ();
public static bool ConsoleOutput = true;
diff --git a/Crow/src/Interface.cs b/Crow/src/Interface.cs
index 507bed69..ca45a243 100644
--- a/Crow/src/Interface.cs
+++ b/Crow/src/Interface.cs
@@ -1293,7 +1293,7 @@ namespace Crow
[Conditional ("DEBUG_HIGHLIGHT_FOCUS")]
internal void debugRegisterClip (Widget w) {
- RegisterClip (w.ScreenCoordinates (w.Slot));
+ RegisterChildClip (w.ScreenCoordinates (w.Slot));
}
[Conditional ("DEBUG_HIGHLIGHT_FOCUS")]
void debugHighlightFocus (IContext ctx) {
@@ -1328,23 +1328,23 @@ namespace Crow
if (FocusedWidget is IEditableTextWidget lab) {
if (lab.DrawCursor (ctx, out Rectangle c)) {
if (textCursor != null && c != textCursor.Value)
- RegisterClip (textCursor.Value);
+ RegisterChildClip (textCursor.Value);
textCursor = c;
- MainSurface.Flush ();
+ //MainSurface.Flush ();
} else if (textCursor != null)
- RegisterClip (textCursor.Value);
+ RegisterChildClip (textCursor.Value);
}
blinkingCursor.Restart ();
forceTextCursor = false;
} else if (textCursor != null && blinkingCursor.ElapsedMilliseconds > TEXT_CURSOR_BLINK_FREQUENCY) {
- RegisterClip (textCursor.Value);
+ RegisterChildClip (textCursor.Value);
textCursor = null;
blinkingCursor.Restart ();
} else if (FocusedWidget is IEditableTextWidget lab) {
if (blinkingCursor.ElapsedMilliseconds > TEXT_CURSOR_BLINK_FREQUENCY) {
if (lab.DrawCursor (ctx, out Rectangle c)) {
textCursor = c;
- MainSurface.Flush ();
+ //MainSurface.Flush ();
blinkingCursor.Restart ();
}
}
@@ -1384,7 +1384,7 @@ namespace Crow
public void DeleteWidget(Widget g)
{
lock (UpdateMutex) {
- RegisterClip (g.ScreenCoordinates (g.LastPaintedSlot));
+ RegisterChildClip (g.ScreenCoordinates (g.LastPaintedSlot));
GraphicTree.Remove (g);
g.Parent = null;
g.Dispose ();
@@ -1400,7 +1400,7 @@ namespace Crow
// }
// }
lock (UpdateMutex) {
- RegisterClip (g.ScreenCoordinates (g.LastPaintedSlot));
+ RegisterChildClip (g.ScreenCoordinates (g.LastPaintedSlot));
GraphicTree.Remove (g);
g.Parent = null;
}
@@ -1413,7 +1413,7 @@ namespace Crow
//TODO:parent is not reset to null because object will be added
//to ObjectToRedraw list, and without parent, it fails
Widget g = GraphicTree [0];
- RegisterClip (g.ScreenCoordinates (g.LastPaintedSlot));
+ RegisterChildClip (g.ScreenCoordinates (g.LastPaintedSlot));
GraphicTree.RemoveAt (0);
g.Dispose ();
}
@@ -1472,7 +1472,7 @@ namespace Crow
}
}
- protected void registerRefreshClientRectangle () => RegisterClip (clientRectangle);
+ protected void registerRefreshClientRectangle () => RegisterChildClip (clientRectangle);
#region Mouse and Keyboard Handling
MouseCursor cursor = MouseCursor.top_left_arrow;
@@ -2056,7 +2056,7 @@ namespace Crow
#region ILayoutable implementation
public virtual bool PointIsIn (ref Point m) => true;
- public void RegisterClip (Rectangle r)
+ public void RegisterChildClip (Rectangle r)
{
clipping.UnionRectangle (r);
}
diff --git a/Crow/src/LayoutingQueueItem.cs b/Crow/src/LayoutingQueueItem.cs
index 9ce5895b..f7606a6e 100644
--- a/Crow/src/LayoutingQueueItem.cs
+++ b/Crow/src/LayoutingQueueItem.cs
@@ -83,6 +83,16 @@ namespace Crow
}
try {
+ if (go.IsQueueForClipping) {
+ DbgLogger.AddEvent (DbgEvtType.GOProcessLayoutingWhileClipReg, this);
+#if DEBUG_LOG
+ result = Result.Discarded;
+#endif
+ LayoutingTries = 0;
+ DiscardCount++;
+ Layoutable.RegisteredLayoutings |= LayoutType;
+ go.IFace.DiscardQueue.Enqueue (this);
+ }
if (go.Parent == null) {//TODO:improve this
//cancel layouting for object without parent, maybe some were in queue when
//removed from a listbox
diff --git a/Crow/src/Widgets/ILayoutable.cs b/Crow/src/Widgets/ILayoutable.cs
index 6007f023..0e71f056 100644
--- a/Crow/src/Widgets/ILayoutable.cs
+++ b/Crow/src/Widgets/ILayoutable.cs
@@ -25,7 +25,7 @@ namespace Crow
LayoutingType RequiredLayoutings { get; set; }
void ChildrenLayoutingConstraints(ILayoutable layoutable, ref LayoutingType layoutType);
void RegisterForLayouting(LayoutingType layoutType);
- void RegisterClip(Rectangle clip);
+ void RegisterChildClip(Rectangle clip);
bool UpdateLayout(LayoutingType layoutType);
bool PointIsIn(ref Point m);
diff --git a/Crow/src/Widgets/ScrollBar.cs b/Crow/src/Widgets/ScrollBar.cs
index efbf3fb1..99882590 100644
--- a/Crow/src/Widgets/ScrollBar.cs
+++ b/Crow/src/Widgets/ScrollBar.cs
@@ -27,7 +27,7 @@ namespace Crow
set {
if (cursorRatio == value)
return;
- if (double.IsFinite(value))
+ if (double.IsFinite(value) && cursorRatio < 1.0)
cursorRatio = value;
else
cursorRatio = -1;
@@ -36,7 +36,7 @@ namespace Crow
}
void updateCursor () {
- if (cursorRatio < 0 || !double.IsFinite(cursorRatio))
+ if (cursorRatio < 0 || !double.IsFinite(cursorRatio) || cursorRatio > 1.0)
return;
ILayoutable l = cursor?.Parent;
if (l == null)
diff --git a/Crow/src/Widgets/Scroller.cs b/Crow/src/Widgets/Scroller.cs
index db563cb0..a49420aa 100644
--- a/Crow/src/Widgets/Scroller.cs
+++ b/Crow/src/Widgets/Scroller.cs
@@ -174,9 +174,9 @@ namespace Crow
m += new Point (ScrollX, ScrollY);
return true;
}
- public override void RegisterClip (Rectangle clip)
+ public override void RegisterChildClip (Rectangle clip)
{
- base.RegisterClip (clip - new Point(ScrollX,ScrollY));
+ base.RegisterChildClip (clip - new Point(ScrollX,ScrollY));
}
public override void OnLayoutChanges (LayoutingType layoutType)
{
diff --git a/Crow/src/Widgets/Widget.cs b/Crow/src/Widgets/Widget.cs
index c3f08fd4..1165bb7e 100644
--- a/Crow/src/Widgets/Widget.cs
+++ b/Crow/src/Widgets/Widget.cs
@@ -1527,8 +1527,8 @@ namespace Crow
parentRWLock.EnterReadLock ();
if (parent != null) {
- parent.RegisterClip (LastPaintedSlot);
- parent.RegisterClip (Slot);
+ parent.RegisterChildClip (LastPaintedSlot);
+ parent.RegisterChildClip (Slot);
}else {
DbgLogger.SetMsg (DbgEvtType.GOClippingRegistration, "clipping reg canceled (no parent)");
}
@@ -1540,7 +1540,7 @@ namespace Crow
/// Add clip rectangle to this.clipping and propagate up to root
/// </summary>
/// <param name="clip">Clip rectangle</param>
- public virtual void RegisterClip(Rectangle clip){
+ public virtual void RegisterChildClip(Rectangle clip){
if (disposed) {
DbgLogger.AddEvent (DbgEvtType.AlreadyDisposed | DbgEvtType.GORegisterClip, this);
return;
@@ -1573,7 +1573,7 @@ namespace Crow
Console.WriteLine ($"parent.regclip canceled p.Dirty:{p?.IsDirty} Cached:{p?.CacheEnabled}: {this.ToString()}");
return;
}*/
- Parent.RegisterClip (r + Slot.Position);
+ Parent.RegisterChildClip (r + Slot.Position);
} finally {
DbgLogger.EndEvent (DbgEvtType.GORegisterClip);
}
@@ -2297,7 +2297,7 @@ namespace Crow
try
{
if (parent != null)
- parent.RegisterClip (ContextCoordinates(LastPaintedSlot));
+ parent.RegisterChildClip (ContextCoordinates(LastPaintedSlot));
}
catch (System.Exception e)
{
diff --git a/Crow/src/Widgets/Window.cs b/Crow/src/Widgets/Window.cs
index 168fb101..cc7763c9 100644
--- a/Crow/src/Widgets/Window.cs
+++ b/Crow/src/Widgets/Window.cs
@@ -500,7 +500,7 @@ namespace Crow
lock (IFace.UpdateMutex) {
Widget p = Parent as Widget;
if (p is Group g) {
- RegisterClip (p.ScreenCoordinates (p.LastPaintedSlot));
+ RegisterChildClip (p.ScreenCoordinates (p.LastPaintedSlot));
g.DeleteChild (this);
//(Parent as Group).RegisterForRedraw ();
} else if (Parent is Container c)
diff --git a/Directory.Build.props b/Directory.Build.props
index 37361807..d674fd6e 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -15,7 +15,7 @@
<!-- Compile with logging enabled, this will slow down apps, use this only
for debugging purpose-->
- <CrowDebugLogEnabled>true</CrowDebugLogEnabled>
+ <CrowDebugLogEnabled>false</CrowDebugLogEnabled>
<!-- Collect several statistics on widgets-->
<CrowDebugStatsEnabled>false</CrowDebugStatsEnabled>
diff --git a/Crow/src/DebugUtils/DbgEvtType.cs b/Drawing2D/src/DbgEvtType.cs
index ed6bfea2..ff214ec8 100644
--- a/Crow/src/DebugUtils/DbgEvtType.cs
+++ b/Drawing2D/src/DbgEvtType.cs
@@ -71,6 +71,7 @@ namespace Crow
GORegisterLayouting = Widget | Layouting | 0x01,
GOProcessLayouting = Widget | Layouting | 0x02,
GOProcessLayoutingWithNoParent = Widget | Layouting | Warning | 0x01,
+ GOProcessLayoutingWhileClipReg = Widget | Layouting | Warning | 0x02,
GODraw = Widget | Drawing | 0x01,
GORecreateCache = Widget | Drawing | 0x02,
GOUpdateCache = Widget | Drawing | 0x03,
diff --git a/Samples/common/src/SampleBase.cs b/Samples/common/src/SampleBase.cs
index e469016c..2ae28cb5 100644
--- a/Samples/common/src/SampleBase.cs
+++ b/Samples/common/src/SampleBase.cs
@@ -19,7 +19,7 @@ namespace Samples
public class SampleBase : Interface
{
public SampleBase(IntPtr hWin) : base(800, 600, hWin) { }
- public SampleBase() : base (800, 600, true) { }
+ public SampleBase() : base (800, 600, false) { }
public Version CrowVersion => Assembly.GetAssembly(typeof(Widget)).GetName().Version;
diff --git a/Samples/common/ui/Interfaces/Experimental/randomProgress.crow b/Samples/common/ui/Interfaces/Experimental/randomProgress.crow
index 9b63b81a..ae78a76a 100644
--- a/Samples/common/ui/Interfaces/Experimental/randomProgress.crow
+++ b/Samples/common/ui/Interfaces/Experimental/randomProgress.crow
@@ -2,10 +2,9 @@
<VerticalStack Width="Fit" Background="DarkSlateGrey" Margin="10" Height="Fit">
<HorizontalStack Height="Fit" Spacing="10">
<Label Text="Value:"/>
- <Label Text="{../../slider.Value}" Background="Onyx" Margin="1" Width="40" TextAlignment="Right"/>
+ <Spinner Name="slider" Width="100" Background="DarkGrey" LargeIncrement="20" SmallIncrement="5"
+ Minimum="10" Maximum="1000" Value="{²RandomProgressItemCount}"/>
</HorizontalStack>
- <Slider Name="slider" Height="10" Width="200" Background="DarkGrey" LargeIncrement="20" SmallIncrement="5"
- Minimum="10" Maximum="1000" Value="{²RandomProgressItemCount}"/>
</VerticalStack>
<ListBox UseLoadingThread="false" Data="{RandomProgressList}">
<Template>
diff --git a/Samples/common/ui/Interfaces/Experimental/table.crow b/Samples/common/ui/Interfaces/Experimental/table.crow
index b80ee378..53222664 100644
--- a/Samples/common/ui/Interfaces/Experimental/table.crow
+++ b/Samples/common/ui/Interfaces/Experimental/table.crow
@@ -1,6 +1,6 @@
<Table Columns="test,Fit;test,Fit;test,Stretched;test,Fit" Margin="10"
ColumnSpacing="5" Spacing="5"
- Foreground="Red"
+ Foreground="Grey"
RowsMargin="0"
BorderLineWidth="0"
VerticalLineWidth="1"