aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects/Image.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-02-02 12:19:06 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2016-02-02 12:19:06 +0100
commit2b087282dd73152d21140ea7312a90e046c84f61 (patch)
tree5d03225090e39c1d14465bdbaf1882e87026402b /src/GraphicObjects/Image.cs
parent73b7c1d82226e4d10708e858a011991e3f598655 (diff)
Fix CRLF
Diffstat (limited to 'src/GraphicObjects/Image.cs')
-rw-r--r--src/GraphicObjects/Image.cs230
1 files changed, 115 insertions, 115 deletions
diff --git a/src/GraphicObjects/Image.cs b/src/GraphicObjects/Image.cs
index e7f75fe8..b8260c55 100644
--- a/src/GraphicObjects/Image.cs
+++ b/src/GraphicObjects/Image.cs
@@ -1,115 +1,115 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Cairo;
-using System.IO;
-using System.Runtime.InteropServices;
-using System.Xml.Serialization;
-using System.ComponentModel;
-using System.Diagnostics;
-
-namespace Crow
-{
- public class Image : GraphicObject
- {
- Picture _pic;
- string _svgSub;
- bool scaled;
- [XmlAttributeAttribute()][DefaultValue(true)]
- public virtual bool Scaled {
- get { return scaled; }
- set {
- if (scaled == value)
- return;
- scaled = value;
- NotifyValueChanged ("Scaled", scaled);
- if (_pic == null)
- return;
- _pic.Scaled = scaled;
- registerForGraphicUpdate ();
- }
- }
- bool keepProps;
- [XmlAttributeAttribute()][DefaultValue(true)]
- public virtual bool KeepProportions {
- get { return keepProps; }
- set {
- if (keepProps == value)
- return;
- keepProps = value;
- NotifyValueChanged ("KeepProportions", keepProps);
- if (_pic == null)
- return;
- _pic.KeepProportions = keepProps;
- registerForGraphicUpdate ();
- }
- }
- [XmlAttributeAttribute("Path")]
- public string Path {
- get { return _pic == null ? null : _pic.Path; }
- set {
- try {
- if (string.IsNullOrEmpty(value)){
- _pic = null;
- return;
- }
- LoadImage (value);
- _pic.Scaled = scaled;
- _pic.KeepProportions = keepProps;
- } catch (Exception ex) {
- Debug.WriteLine (ex.Message);
- _pic = null;
- }
- }
- }
-
- [XmlAttributeAttribute()][DefaultValue(null)]
- public string SvgSub {
- get { return _svgSub; }
- set {
- _svgSub = value;
- registerForGraphicUpdate ();
- }
- }
-
- #region CTOR
- public Image () : base()
- {
- }
- #endregion
-
- #region Image Loading
- public void LoadImage (string path)
- {
-
- if (path.EndsWith (".svg", true, System.Globalization.CultureInfo.InvariantCulture))
- _pic = new SvgPicture ();
- else
- _pic = new BmpPicture ();
-
- _pic.LoadImage (path);
- registerForGraphicUpdate ();
- }
- #endregion
-
- #region GraphicObject overrides
- protected override Size measureRawSize ()
- {
-// if (_pic == null)
-// _pic = "#Crow.Images.Icons.IconAlerte.svg";
-
- return _pic.Dimensions + Margin * 2;
- }
- protected override void onDraw (Context gr)
- {
- base.onDraw (gr);
-
- if (_pic == null)
- return;
-
- _pic.Paint (gr, ClientRectangle, _svgSub);
- }
- #endregion
- }
-}
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Cairo;
+using System.IO;
+using System.Runtime.InteropServices;
+using System.Xml.Serialization;
+using System.ComponentModel;
+using System.Diagnostics;
+
+namespace Crow
+{
+ public class Image : GraphicObject
+ {
+ Picture _pic;
+ string _svgSub;
+ bool scaled;
+ [XmlAttributeAttribute()][DefaultValue(true)]
+ public virtual bool Scaled {
+ get { return scaled; }
+ set {
+ if (scaled == value)
+ return;
+ scaled = value;
+ NotifyValueChanged ("Scaled", scaled);
+ if (_pic == null)
+ return;
+ _pic.Scaled = scaled;
+ registerForGraphicUpdate ();
+ }
+ }
+ bool keepProps;
+ [XmlAttributeAttribute()][DefaultValue(true)]
+ public virtual bool KeepProportions {
+ get { return keepProps; }
+ set {
+ if (keepProps == value)
+ return;
+ keepProps = value;
+ NotifyValueChanged ("KeepProportions", keepProps);
+ if (_pic == null)
+ return;
+ _pic.KeepProportions = keepProps;
+ registerForGraphicUpdate ();
+ }
+ }
+ [XmlAttributeAttribute("Path")]
+ public string Path {
+ get { return _pic == null ? null : _pic.Path; }
+ set {
+ try {
+ if (string.IsNullOrEmpty(value)){
+ _pic = null;
+ return;
+ }
+ LoadImage (value);
+ _pic.Scaled = scaled;
+ _pic.KeepProportions = keepProps;
+ } catch (Exception ex) {
+ Debug.WriteLine (ex.Message);
+ _pic = null;
+ }
+ }
+ }
+
+ [XmlAttributeAttribute()][DefaultValue(null)]
+ public string SvgSub {
+ get { return _svgSub; }
+ set {
+ _svgSub = value;
+ registerForGraphicUpdate ();
+ }
+ }
+
+ #region CTOR
+ public Image () : base()
+ {
+ }
+ #endregion
+
+ #region Image Loading
+ public void LoadImage (string path)
+ {
+
+ if (path.EndsWith (".svg", true, System.Globalization.CultureInfo.InvariantCulture))
+ _pic = new SvgPicture ();
+ else
+ _pic = new BmpPicture ();
+
+ _pic.LoadImage (path);
+ registerForGraphicUpdate ();
+ }
+ #endregion
+
+ #region GraphicObject overrides
+ protected override Size measureRawSize ()
+ {
+// if (_pic == null)
+// _pic = "#Crow.Images.Icons.IconAlerte.svg";
+
+ return _pic.Dimensions + Margin * 2;
+ }
+ protected override void onDraw (Context gr)
+ {
+ base.onDraw (gr);
+
+ if (_pic == null)
+ return;
+
+ _pic.Paint (gr, ClientRectangle, _svgSub);
+ }
+ #endregion
+ }
+}