コード例 #1
0
ファイル: TextGraphic.cs プロジェクト: olesar/Altaxo
            public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
            {
                TextGraphic s = null != o ? (TextGraphic)o : new TextGraphic(info);

                info.GetBaseValueEmbedded(s, "AltaxoBase,Altaxo.Graph.GraphicsObject,0", parent);

                // we have changed the meaning of rotation in the meantime, This is not handled in GetBaseValueEmbedded,
                // since the former versions did not store the version number of embedded bases
                //s._rotation = -s._rotation;

                s._text      = info.GetString("Text");
                s._font      = (FontX)info.GetValue("Font", s);
                s._textBrush = (BrushX)info.GetValue("Brush", s);
                if (null != s._textBrush)
                {
                    s._textBrush.ParentObject = s;
                }
                s.BackgroundStyleOld = (BackgroundStyle)info.GetValue("BackgroundStyle", s);
                s._lineSpacingFactor = info.GetSingle("LineSpacing");
                info.GetSingle("ShadowLength");
                var xAnchorType = (XAnchorPositionType)info.GetValue("XAnchor", s);
                var yAnchorType = (YAnchorPositionType)info.GetValue("YAnchor", s);

                s._location.LocalAnchorX = RADouble.NewRel(0.5 * (int)xAnchorType);
                s._location.LocalAnchorY = RADouble.NewRel(0.5 * (int)yAnchorType);

                return(s);
            }
コード例 #2
0
ファイル: TextGraphic.cs プロジェクト: olesar/Altaxo
            public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
            {
                TextGraphic s = null != o ? (TextGraphic)o : new TextGraphic(info);

                if (info.CurrentElementName == "BaseType") // that was included since 2006-06-20
                {
                    info.GetBaseValueEmbedded(s, typeof(TextGraphic).BaseType, parent);
                }
                else
                {
                    info.GetBaseValueEmbedded(s, "AltaxoBase,Altaxo.Graph.GraphicsObject,0", parent); // before 2006-06-20, it was version 0 of the GraphicsObject
                }

                s._text      = info.GetString("Text");
                s._font      = (FontX)info.GetValue("Font", s);
                s._textBrush = (BrushX)info.GetValue("Brush", s);
                if (null != s._textBrush)
                {
                    s._textBrush.ParentObject = s;
                }
                s._background = (IBackgroundStyle)info.GetValue("BackgroundStyle", s);
                if (null != s._background)
                {
                    s._background.ParentObject = s;
                }
                s._lineSpacingFactor = info.GetSingle("LineSpacing");
                var xAnchorType = (XAnchorPositionType)info.GetValue("XAnchor", s);
                var yAnchorType = (YAnchorPositionType)info.GetValue("YAnchor", s);

                s._location.LocalAnchorX = RADouble.NewRel(0.5 * (int)xAnchorType);
                s._location.LocalAnchorY = RADouble.NewRel(0.5 * (int)yAnchorType);
                return(s);
            }
コード例 #3
0
ファイル: TextToolMouseHandler.cs プロジェクト: Altaxo/Altaxo
		/// <summary>
		/// Handles the click event by opening the text tool dialog.
		/// </summary>
		/// <param name="e">EventArgs.</param>
		/// <param name="position">Mouse position.</param>
		/// <returns>The mouse state handler for handling the next mouse events.</returns>
		public override void OnClick(PointD2D position, MouseButtonEventArgs e)
		{
			base.OnClick(position, e);

			_cachedActiveLayer = _grac.ActiveLayer;
			_cachedActiveLayerTransformation = _cachedActiveLayer.TransformationFromRootToHere();
			_cachedActiveLayerTransformationGdi = (Matrix)_cachedActiveLayerTransformation;

			// get the page coordinates (in Point (1/72") units)
			var rootLayerCoord = _grac.ConvertMouseToRootLayerCoordinates(_positionLastMouseDownInMouseCoordinates);
			// with knowledge of the current active layer, calculate the layer coordinates from them
			var layerCoord = _cachedActiveLayerTransformation.InverseTransformPoint(rootLayerCoord);

			TextGraphic tgo = new TextGraphic(_grac.Doc.GetPropertyContext());
			tgo.SetParentSize(_grac.ActiveLayer.Size, false);
			tgo.Position = layerCoord;
			tgo.ParentObject = _grac.ActiveLayer;

			// deselect the text tool
			_grac.SetGraphToolFromInternal(GraphToolType.ObjectPointer);

			object tgoo = tgo;
			if (Current.Gui.ShowDialog(ref tgoo, "Text", false))
			{
				tgo = (TextGraphic)tgoo;
				if (tgo != null && !tgo.Empty)
				{
					_grac.ActiveLayer.GraphObjects.Add(tgo);
				}
			}

			/*
			TextControlDialog dlg = new TextControlDialog(_grac.Layers[_grac.CurrentLayerNumber],tgo);
			if(DialogResult.OK==dlg.ShowDialog(_grac.View.Window))
			{
				// add the resulting textgraphobject to the layer
				if(!dlg.SimpleTextGraphics.Empty)
				{
					_grac.Layers[_grac.CurrentLayerNumber].GraphObjects.Add(dlg.SimpleTextGraphics);
					_grac.RefreshGraph();
				}
			}
			*/
			_grac.SetGraphToolFromInternal(GraphToolType.ObjectPointer);
		}
コード例 #4
0
ファイル: TextToolMouseHandler.cs プロジェクト: Altaxo/Altaxo
    /// <summary>
    /// Handles the click event by opening the text tool dialog.
    /// </summary>
    /// <param name="e">EventArgs.</param>
    /// <returns>The mouse state handler for handling the next mouse events.</returns>
    public override void OnClick(System.EventArgs e)
    {
      base.OnClick(e);

      // get the page coordinates (in Point (1/72") units)
      PointF printAreaCoord = _grac.WinFormsController.PixelToPrintableAreaCoordinates(m_LastMouseDown);
      // with knowledge of the current active layer, calculate the layer coordinates from them
      PointF layerCoord = _grac.ActiveLayer.GraphToLayerCoordinates(printAreaCoord);

      TextGraphic tgo = new TextGraphic();
      tgo.Position = layerCoord;
      tgo.ParentObject = _grac.ActiveLayer.GraphObjects;

      // deselect the text tool
			_grac.SetGraphToolFromInternal( Altaxo.Gui.Graph.Viewing.GraphToolType.ObjectPointer);

      object tgoo = tgo;
      if (Current.Gui.ShowDialog(ref tgoo, "Text", false))
      {
        tgo = (TextGraphic)tgoo;
        if (tgo!=null && !tgo.Empty)
        {
          _grac.ActiveLayer.GraphObjects.Add(tgo);
          _grac.WinFormsController.RefreshGraph();
        }
      }

      /*
      TextControlDialog dlg = new TextControlDialog(_grac.Layers[_grac.CurrentLayerNumber],tgo);
      if(DialogResult.OK==dlg.ShowDialog(_grac.View.Window))
      {
        // add the resulting textgraphobject to the layer
        if(!dlg.SimpleTextGraphics.Empty)
        {
          _grac.Layers[_grac.CurrentLayerNumber].GraphObjects.Add(dlg.SimpleTextGraphics);
          _grac.RefreshGraph();
        }
      }
      */
			_grac.SetGraphToolFromInternal( Altaxo.Gui.Graph.Viewing.GraphToolType.ObjectPointer);
    }
コード例 #5
0
ファイル: AxisStyle.cs プロジェクト: xuchuansheng/GenXSource
 /// <summary>
 /// Tries to remove a child object of this collection.
 /// </summary>
 /// <param name="go">The object to remove.</param>
 /// <returns> If the provided object is a child object and
 /// the child object could be removed, the return value is true.</returns>
 public bool Remove(GraphicBase go)
 {
   // test our own objects for removal (only that that _are_ removable)
   if (object.ReferenceEquals(go, this._axisTitle))
   {
     _axisTitle = null;
     return true;
   }
   return false;
 }
コード例 #6
0
ファイル: TextGraphic.cs プロジェクト: Altaxo/Altaxo
		public void CopyFrom(TextGraphic from)
		{
			CopyFrom((GraphicBase)from);
		}
コード例 #7
0
ファイル: TextGraphic.cs プロジェクト: Altaxo/Altaxo
		public TextGraphic(TextGraphic from)
			: base(from) // all is done here, since CopyFrom is virtual!
		{
		}
コード例 #8
0
 public bool InitializeDocument(params object[] args)
 {
   if (args.Length == 0 || !(args[0] is TextGraphic))
     return false;
   _originalDoc = (TextGraphic)args[0];
   _doc = _useDocumentCopy == UseDocument.Directly ? _originalDoc : (TextGraphic)_originalDoc.Clone();
   Initialize(true); // initialize always because we have to update the temporary variables
   return true;
 }
コード例 #9
0
 public TextGraphic(TextGraphic from)
   :
   base(from) // all is done here, since CopyFrom is overridden
 {
 }
コード例 #10
0
ファイル: TextGraphic.cs プロジェクト: olesar/Altaxo
 public void CopyFrom(TextGraphic from)
 {
     CopyFrom((GraphicBase)from);
 }
コード例 #11
0
ファイル: TextGraphic.cs プロジェクト: olesar/Altaxo
 public TextGraphic(TextGraphic from)
     : base(from) // all is done here, since CopyFrom is virtual!
 {
 }
コード例 #12
0
ファイル: AxisStyle.cs プロジェクト: Altaxo/Altaxo
		public void ShowTitle(Altaxo.Main.Properties.IReadOnlyPropertyBag context)
		{
			if (_axisTitle == null)
			{
				Title = new TextGraphic(context);
				Title.Text = "axis title";
			}
		}