From: jpbruyere Date: Mon, 1 Aug 2016 11:50:55 +0000 (+0200) Subject: use RegisterForRedraw when applicable X-Git-Tag: v0.4~21^2~4 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=db2c28d9ca9f69b4bf181d2360df139dcf617324;p=jp%2Fcrow.git use RegisterForRedraw when applicable --- diff --git a/Default.style b/Default.style index 77d281f1..0092f194 100644 --- a/Default.style +++ b/Default.style @@ -37,4 +37,7 @@ Window { MinimumSize=50,50; Width = 150; Height = 150; +} +Border { + Foreground = White; } \ No newline at end of file diff --git a/Tests/BasicTests.cs b/Tests/BasicTests.cs index 231a5afa..e75ed01d 100644 --- a/Tests/BasicTests.cs +++ b/Tests/BasicTests.cs @@ -79,7 +79,7 @@ namespace Tests this.KeyDown += KeyboardKeyDown1; testFiles = new string [] { @"Interfaces/Divers/welcome.crow" }; - //testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Unsorted", "*.crow")).ToArray (); + testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Unsorted", "*.crow")).ToArray (); testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/GraphicObject", "*.crow")).ToArray (); //testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/basicTests", "*.crow")).ToArray (); testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/Container", "*.crow")).ToArray (); @@ -101,16 +101,24 @@ namespace Tests TestList.Add ("new string"); NotifyValueChanged ("TestList", TestList); return; - } else if (e.Key == OpenTK.Input.Key.F2) { + } else if (e.Key == OpenTK.Input.Key.F4) { GraphicObject w = CrowInterface.LoadInterface ("Interfaces/Divers/testWindow.goml"); w.DataSource = this; return; - } else if (e.Key != OpenTK.Input.Key.F3) + } else if (e.Key == OpenTK.Input.Key.F2) + idx--; + else if (e.Key == OpenTK.Input.Key.F3) + idx++; + else return; + CrowInterface.ClearInterface (); - idx++; + if (idx == testFiles.Length) idx = 0; + else if (idx < 0) + idx = testFiles.Length - 1; + this.Title = testFiles [idx] + ". Press to cycle examples."; GraphicObject obj = CrowInterface.LoadInterface(testFiles[idx]); obj.DataSource = this; diff --git a/src/GraphicObjects/Border.cs b/src/GraphicObjects/Border.cs index c6355726..6c1ed6a1 100644 --- a/src/GraphicObjects/Border.cs +++ b/src/GraphicObjects/Border.cs @@ -24,11 +24,6 @@ namespace Crow RegisterForGraphicUpdate (); } } - [XmlAttributeAttribute()][DefaultValue("White")] - public override Fill Foreground { - get { return base.Foreground;} - set {base.Foreground = value;} - } #endregion #region GraphicObject override diff --git a/src/GraphicObjects/GenericStack.cs b/src/GraphicObjects/GenericStack.cs index c0cd7747..efa98d1a 100644 --- a/src/GraphicObjects/GenericStack.cs +++ b/src/GraphicObjects/GenericStack.cs @@ -100,7 +100,7 @@ namespace Crow //if no layouting remains in queue for item, registre for redraw if (RegisteredLayoutings == LayoutingType.None && bmp == null) - RegisterForGraphicUpdate (); + Interface.CurrentInterface.EnqueueForRepaint (this); return true; } diff --git a/src/GraphicObjects/Grid.cs b/src/GraphicObjects/Grid.cs index 92b4f906..525827e0 100644 --- a/src/GraphicObjects/Grid.cs +++ b/src/GraphicObjects/Grid.cs @@ -136,7 +136,7 @@ namespace Crow //if no layouting remains in queue for item, registre for redraw if (RegisteredLayoutings == LayoutingType.None && bmp == null) - this.RegisterForGraphicUpdate (); + Interface.CurrentInterface.EnqueueForRepaint (this); return true; } diff --git a/src/GraphicObjects/Label.cs b/src/GraphicObjects/Label.cs index 6b90b149..a3343232 100644 --- a/src/GraphicObjects/Label.cs +++ b/src/GraphicObjects/Label.cs @@ -101,7 +101,7 @@ namespace Crow if (value == _textAlignment) return; _textAlignment = value; - RegisterForRedraw (); + RegisterForGraphicUpdate (); NotifyValueChanged ("TextAlignment", _textAlignment); } } @@ -147,7 +147,7 @@ namespace Crow lines = getLines; NotifyValueChanged ("Text", _text); - this.RegisterForGraphicUpdate (); + RegisterForGraphicUpdate (); } } [XmlAttributeAttribute][DefaultValue(false)] @@ -596,7 +596,7 @@ namespace Crow SelBegin = new Point(0,0); SelRelease = new Point (lines.LastOrDefault ().Length, lines.Count-1); - RegisterForGraphicUpdate (); + RegisterForRedraw (); } public override void onUnfocused (object sender, EventArgs e) { @@ -604,7 +604,7 @@ namespace Crow SelBegin = -1; SelRelease = -1; - RegisterForGraphicUpdate (); + RegisterForRedraw (); } public override void onMouseMove (object sender, MouseMoveEventArgs e) { @@ -615,7 +615,7 @@ namespace Crow updatemouseLocalPos (e.Position); - RegisterForGraphicUpdate(); + RegisterForRedraw(); } public override void onMouseDown (object sender, MouseButtonEventArgs e) { @@ -624,7 +624,7 @@ namespace Crow SelBegin = -1; SelRelease = -1; SelectionInProgress = true; - RegisterForGraphicUpdate();//TODO:should put it in properties + RegisterForRedraw();//TODO:should put it in properties } //done at the end to set 'hasFocus' value after testing it @@ -639,7 +639,7 @@ namespace Crow updatemouseLocalPos (e.Position); SelectionInProgress = false; - RegisterForGraphicUpdate (); + RegisterForRedraw (); } #endregion diff --git a/src/GraphicObjects/NumericControl.cs b/src/GraphicObjects/NumericControl.cs index 0f74eb2d..b1b097c6 100644 --- a/src/GraphicObjects/NumericControl.cs +++ b/src/GraphicObjects/NumericControl.cs @@ -30,7 +30,7 @@ namespace Crow minValue = value; NotifyValueChanged ("Minimum", minValue); - RegisterForGraphicUpdate (); + RegisterForRedraw (); } } [XmlAttributeAttribute()][DefaultValue(100.0)] @@ -43,7 +43,7 @@ namespace Crow maxValue = value; NotifyValueChanged ("Maximum", maxValue); - RegisterForGraphicUpdate (); + RegisterForRedraw (); } } [XmlAttributeAttribute()][DefaultValue(1.0)] @@ -56,7 +56,7 @@ namespace Crow smallStep = value; NotifyValueChanged ("SmallIncrement", smallStep); - RegisterForGraphicUpdate (); + RegisterForRedraw (); } } [XmlAttributeAttribute()][DefaultValue(5.0)] @@ -69,7 +69,7 @@ namespace Crow bigStep = value; NotifyValueChanged ("LargeIncrement", bigStep); - RegisterForGraphicUpdate (); + RegisterForRedraw (); } } [XmlAttributeAttribute()][DefaultValue(0.0)] diff --git a/src/GraphicObjects/Scroller.cs b/src/GraphicObjects/Scroller.cs index 22b36fd2..0d57cdb3 100644 --- a/src/GraphicObjects/Scroller.cs +++ b/src/GraphicObjects/Scroller.cs @@ -70,7 +70,7 @@ namespace Crow else _scrollX = value; NotifyValueChanged("ScrollX", _scrollX); - RegisterForGraphicUpdate (); + RegisterForRedraw (); Scrolled.Raise (this, new ScrollingEventArgs (Orientation.Horizontal)); } } @@ -89,7 +89,7 @@ namespace Crow else _scrollY = value; NotifyValueChanged("ScrollY", _scrollY); - RegisterForGraphicUpdate (); + RegisterForRedraw (); Scrolled.Raise (this, new ScrollingEventArgs (Orientation.Vertical)); } } diff --git a/src/GraphicObjects/Slider.cs b/src/GraphicObjects/Slider.cs index bce74971..526c2759 100644 --- a/src/GraphicObjects/Slider.cs +++ b/src/GraphicObjects/Slider.cs @@ -65,7 +65,7 @@ namespace Crow if (_cursorColor == value) return; _cursorColor = value; - RegisterForGraphicUpdate (); + RegisterForRedraw (); NotifyValueChanged ("CursorColor", _cursorColor); } } @@ -76,7 +76,6 @@ namespace Crow if (_cursorSize == value) return; _cursorSize = value; - RegisterForLayouting (LayoutingType.Sizing); RegisterForGraphicUpdate (); NotifyValueChanged ("CursorSize", _cursorSize); } diff --git a/src/GraphicObjects/TabView.cs b/src/GraphicObjects/TabView.cs index d5a07e58..d616ffc6 100644 --- a/src/GraphicObjects/TabView.cs +++ b/src/GraphicObjects/TabView.cs @@ -78,7 +78,7 @@ namespace Crow (Children [selectedTab] as TabItem).IsSelected = true; NotifyValueChanged ("SelectedTab", selectedTab); - RegisterForGraphicUpdate (); + RegisterForRedraw (); } } [XmlAttributeAttribute()][DefaultValue(22)] @@ -148,7 +148,7 @@ namespace Crow //if no layouting remains in queue for item, registre for redraw if (RegisteredLayoutings == LayoutingType.None && bmp == null) - RegisterForGraphicUpdate (); + Interface.CurrentInterface.EnqueueForRepaint (this); return true; } diff --git a/src/GraphicObjects/TextBox.cs b/src/GraphicObjects/TextBox.cs index fc02f0d6..5c3772b7 100644 --- a/src/GraphicObjects/TextBox.cs +++ b/src/GraphicObjects/TextBox.cs @@ -49,7 +49,7 @@ namespace Crow set { base.HasFocus = value; - RegisterForGraphicUpdate(); + RegisterForRedraw(); } } @@ -210,10 +210,6 @@ namespace Crow default: break; } - if (Width < 0) - RegisterForLayouting (LayoutingType.Width); - if (Height < 0) - RegisterForLayouting (LayoutingType.Height); RegisterForGraphicUpdate(); } public override void onKeyPress (object sender, KeyPressEventArgs e) @@ -225,10 +221,6 @@ namespace Crow SelRelease = -1; SelBegin = new Point(CurrentColumn, SelBegin.Y); - if (Width < 0) - RegisterForLayouting (LayoutingType.Width); - if (Height < 0) - RegisterForLayouting (LayoutingType.Height); RegisterForGraphicUpdate(); } #endregion diff --git a/src/GraphicObjects/TextRun.cs b/src/GraphicObjects/TextRun.cs index 35b46f18..6b6f7999 100644 --- a/src/GraphicObjects/TextRun.cs +++ b/src/GraphicObjects/TextRun.cs @@ -55,7 +55,7 @@ namespace Crow if (horizontalStretch == value) return; horizontalStretch = value; - RegisterForGraphicUpdate (); + RegisterForRedraw (); NotifyValueChanged ("HorizontalStretch", horizontalStretch); } } @@ -67,8 +67,8 @@ namespace Crow if (verticalStretch == value) return; verticalStretch = value; + RegisterForRedraw (); NotifyValueChanged ("VerticalStretch", verticalStretch); - } } [XmlAttributeAttribute ()] @@ -83,8 +83,6 @@ namespace Crow return; RegisterForGraphicUpdate (); - this.RegisterForLayouting (LayoutingType.Sizing); - _text = value; diff --git a/src/GraphicObjects/Trend.cs b/src/GraphicObjects/Trend.cs index e9ff4c06..fef1e48f 100644 --- a/src/GraphicObjects/Trend.cs +++ b/src/GraphicObjects/Trend.cs @@ -41,7 +41,7 @@ namespace Crow values.Add (_value); while (values.Count > nbValues) values.RemoveAt (0); - RegisterForGraphicUpdate (); + RegisterForRedraw (); } public Trend () @@ -61,7 +61,7 @@ namespace Crow nbValues = value; NotifyValueChanged ("NbValues", minValue); - RegisterForGraphicUpdate (); + RegisterForRedraw (); } } [XmlAttributeAttribute()][DefaultValue(0.0)] @@ -73,7 +73,7 @@ namespace Crow minValue = value; NotifyValueChanged ("Minimum", minValue); - RegisterForGraphicUpdate (); + RegisterForRedraw (); } } [XmlAttributeAttribute()][DefaultValue(100.0)] @@ -86,7 +86,7 @@ namespace Crow maxValue = value; NotifyValueChanged ("Maximum", maxValue); - RegisterForGraphicUpdate (); + RegisterForRedraw (); } } [XmlAttributeAttribute()][DefaultValue(20.0)] @@ -119,7 +119,7 @@ namespace Crow return; lowThresholdFill = value; NotifyValueChanged ("LowThresholdFill", lowThresholdFill); - RegisterForGraphicUpdate (); + RegisterForRedraw (); } } [XmlAttributeAttribute()][DefaultValue("DarkGreen")] @@ -130,7 +130,7 @@ namespace Crow return; highThresholdFill = value; NotifyValueChanged ("HighThresholdFill", highThresholdFill); - RegisterForGraphicUpdate (); + RegisterForRedraw (); } } protected override void onDraw (Cairo.Context gr)