diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2015-06-21 15:39:58 +0200 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2015-06-21 15:39:58 +0200 |
| commit | dc995bd1da98971009454f4efe043d6237d00729 (patch) | |
| tree | 3af8d3a6745e9779edb71de29f3463898a3dedd0 /src | |
| parent | 746f5cfb60c9a798825e31c2e362cfc817e59d44 (diff) | |
* OpenTK:
* OpenTKGameWindow.cs:
* Tests.csproj:
* GOLIBTest_4.cs:
* GOLIBTest_1.cs:
* Window.goml:
* Listbox.goml:
* test4.goml:
* GOLIBTest_Expandable.cs:
* testExpandable.goml: debug and test
* Colors.cs: debug argb->rgba
* CompilerServices.cs: value type conversion
* Border.cs: default border =1
* Checkbox.cs:
* Expandable.cs: changes in update technic
* Group.cs: Clipping debug (need rework)
* Label.cs: debug text positionning
* Slider.cs: debug
* TextBox.cs: selectable=true by default
Diffstat (limited to 'src')
| -rwxr-xr-x | src/Colors.cs | 10 | ||||
| -rw-r--r-- | src/CompilerServices/CompilerServices.cs | 33 | ||||
| -rw-r--r-- | src/GraphicObjects/Border.cs | 2 | ||||
| -rw-r--r-- | src/GraphicObjects/Checkbox.cs | 2 | ||||
| -rw-r--r-- | src/GraphicObjects/Expandable.cs | 8 | ||||
| -rw-r--r-- | src/GraphicObjects/Group.cs | 7 | ||||
| -rwxr-xr-x | src/GraphicObjects/Label.cs | 20 | ||||
| -rw-r--r-- | src/GraphicObjects/Slider.cs | 1 | ||||
| -rw-r--r-- | src/GraphicObjects/TextBox.cs | 5 | ||||
| -rwxr-xr-x | src/OpenTKGameWindow.cs | 2 |
10 files changed, 74 insertions, 16 deletions
diff --git a/src/Colors.cs b/src/Colors.cs index 2d428bae..96d17f2a 100755 --- a/src/Colors.cs +++ b/src/Colors.cs @@ -1021,11 +1021,11 @@ namespace go #region IXmlSerializable
public void ReadXml(System.Xml.XmlReader reader)
{
- string[] c = reader["Color"].Split(new char[] { ';' });
- A = double.Parse(c[0]);
- R = double.Parse(c[1]);
- G = double.Parse(c[2]);
- B = double.Parse(c[3]);
+ string[] c = reader["Color"].Split(new char[] { ';' });
+ R = double.Parse(c[0]);
+ G = double.Parse(c[1]);
+ B = double.Parse(c[2]);
+ A = double.Parse(c[3]);
}
public void WriteXml(System.Xml.XmlWriter writer)
{
diff --git a/src/CompilerServices/CompilerServices.cs b/src/CompilerServices/CompilerServices.cs index d7d19fa1..ae4b700a 100644 --- a/src/CompilerServices/CompilerServices.cs +++ b/src/CompilerServices/CompilerServices.cs @@ -270,8 +270,12 @@ namespace go if (!srcValueType.IsValueType) il.Emit(OpCodes.Castclass, srcValueType); - if (piTarget.PropertyType == typeof(string)) - il.Emit(OpCodes.Callvirt, miToStr); + else + il.Emit( OpCodes.Callvirt, GetConvertMethod( piTarget.PropertyType )); + // if (piTarget.PropertyType == typeof(string)) +// else if ( srcValueType != piTarget.PropertyType) +// + il.Emit(OpCodes.Callvirt, piTarget.GetSetMethod()); } il.MarkLabel(labFailed); @@ -284,6 +288,31 @@ namespace go //Delegate del = dm.CreateDelegate(typeof(System.EventHandler)); addHandler.Invoke(_source, new object[] {del}); } + + #region conversions + + internal static MethodInfo GetConvertMethod( Type targetType ) + { + string name; + + if( targetType == typeof( bool ) ) + name = "ToBoolean"; + else if( targetType == typeof( byte ) ) + name = "ToByte"; + else if( targetType == typeof( short ) ) + name = "ToInt16"; + else if( targetType == typeof( int ) ) + name = "ToInt32"; + else if( targetType == typeof( long ) ) + name = "ToInt64"; + else if (targetType == typeof (string ) ) + return typeof(object).GetMethod("ToString", Type.EmptyTypes); + else + throw new NotImplementedException( string.Format( "Conversion to {0} is not implemented.", targetType.Name ) ); + + return typeof( Convert ).GetMethod( name, BindingFlags.Static | BindingFlags.Public, null, new Type[] { typeof( object ) }, null ); + } + #endregion public static FieldInfo getEventHandlerField(Type type, string eventName) { diff --git a/src/GraphicObjects/Border.cs b/src/GraphicObjects/Border.cs index 352b626a..f2ce01e2 100644 --- a/src/GraphicObjects/Border.cs +++ b/src/GraphicObjects/Border.cs @@ -16,7 +16,7 @@ namespace go #endregion #region public properties - [XmlAttributeAttribute()][DefaultValue(2)] + [XmlAttributeAttribute()][DefaultValue(1)] public virtual int BorderWidth { get { return _borderWidth; } set { diff --git a/src/GraphicObjects/Checkbox.cs b/src/GraphicObjects/Checkbox.cs index 0e20ddb7..30db3849 100644 --- a/src/GraphicObjects/Checkbox.cs +++ b/src/GraphicObjects/Checkbox.cs @@ -62,7 +62,7 @@ namespace go else
_image.SvgSub = "unchecked";
- registerForGraphicUpdate();
+ //registerForGraphicUpdate();
}
}
diff --git a/src/GraphicObjects/Expandable.cs b/src/GraphicObjects/Expandable.cs index 369930a8..8b3f4b1a 100644 --- a/src/GraphicObjects/Expandable.cs +++ b/src/GraphicObjects/Expandable.cs @@ -54,8 +54,8 @@ namespace go return;
_image.SvgSub = "collapsed";
- this.Expand += (object sender, EventArgs e) => {_image.SvgSub = "expanded";};
- this.Collapse += (object sender, EventArgs e) => {_image.SvgSub = "collapsed";};
+// this.Expand += (object sender, EventArgs e) => {};
+// this.Collapse += (object sender, EventArgs e) => {};
}
@@ -86,18 +86,20 @@ namespace go else
onCollapse (this, null);
- registerForGraphicUpdate();
+ //registerForGraphicUpdate();
}
}
public virtual void onExpand(object sender, EventArgs e)
{
_contentContainer.Visible = true;
+ _image.SvgSub = "expanded";
Expand.Raise (this, e);
}
public virtual void onCollapse(object sender, EventArgs e)
{
_contentContainer.Visible = false;
+ _image.SvgSub = "collapsed";
Collapse.Raise (this, e);
}
diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs index f1620a2a..aac566db 100644 --- a/src/GraphicObjects/Group.cs +++ b/src/GraphicObjects/Group.cs @@ -178,8 +178,13 @@ namespace go if (clip != null) {
clip.Rebase (this);
//localClip = clip.intersectingRects (Slot.Size);
- } else
+ } else {
clip = new Rectangles ();
+ //TODO:added lately slot to empty clip,
+ //should rework this precise case causing expandable not
+ //to show image changes
+ clip.AddRectangle (ContextCoordinates (Slot.Size));
+ }
if (!DrawingIsValid || clip != null) {//false when 1 child has changed
//child having their content changed has to be repainted
diff --git a/src/GraphicObjects/Label.cs b/src/GraphicObjects/Label.cs index 27a766d2..e9951862 100755 --- a/src/GraphicObjects/Label.cs +++ b/src/GraphicObjects/Label.cs @@ -287,6 +287,8 @@ namespace go //gr.FontOptions.HintMetrics = HintMetrics.On;
rText = new Rectangle(measureRawSize());
+ rText.Width -= 2 * Margin;
+ rText.Height -= 2 * Margin;
widthRatio = 1f;
heightRatio = 1f;
@@ -479,6 +481,24 @@ namespace go if (string.IsNullOrWhiteSpace (l))
continue;
+// double t = rText.Y;
+// gr.LineWidth = 1;
+// gr.Color = Color.Green;
+// gr.MoveTo (rText.X, t);
+// gr.LineTo (rText.X + rText.Width, t);
+// gr.Stroke ();
+// gr.MoveTo (rText.X, t + rText.Height);
+// gr.LineTo (rText.X + rText.Width, t + rText.Height);
+// gr.Stroke ();
+// gr.Rectangle (rText);
+// gr.Fill ();
+//
+// t += fe.Ascent;
+// gr.Color = Color.Red;
+// gr.MoveTo (rText.X, t);
+// gr.LineTo (rText.X + rText.Width, t);
+// gr.Stroke ();
+
gr.Color = Foreground;
gr.MoveTo (rText.X, rText.Y + fe.Ascent + fe.Height * i);
diff --git a/src/GraphicObjects/Slider.cs b/src/GraphicObjects/Slider.cs index 7a5623f8..25da2241 100644 --- a/src/GraphicObjects/Slider.cs +++ b/src/GraphicObjects/Slider.cs @@ -119,7 +119,6 @@ namespace go cursor.TopLeft = new Point(r.Left + (int)(Value * unity),
(int)(p1.Y - cursor.Height / 2));
- Debug.WriteLine (cursor.TopLeft.ToString ());
}
#region mouse handling
diff --git a/src/GraphicObjects/TextBox.cs b/src/GraphicObjects/TextBox.cs index 28e7c74c..7ba10fe8 100644 --- a/src/GraphicObjects/TextBox.cs +++ b/src/GraphicObjects/TextBox.cs @@ -44,6 +44,11 @@ namespace go get { return base.Focusable; }
set { base.Focusable = value; }
}
+ [XmlAttributeAttribute()][DefaultValue(true)]
+ public override bool Selectable {
+ get { return base.Selectable; }
+ set { base.Selectable = value; }
+ }
[XmlAttributeAttribute()][DefaultValue("White")]
public override Color Background {
get { return base.Background; }
diff --git a/src/OpenTKGameWindow.cs b/src/OpenTKGameWindow.cs index 38d230f7..81fea59d 100755 --- a/src/OpenTKGameWindow.cs +++ b/src/OpenTKGameWindow.cs @@ -1,6 +1,4 @@ // Released to the public domain. Use, modify and relicense at will.
-//#define DEBUG_CLIP_RECTANGLE
-
using System;
using OpenTK;
|