Example #1
0
        protected override void OnGraphicComplete()
        {
            _textGraphic = this.FindTextGraphic();

            base.OnGraphicComplete();
            this.StartEdit();
        }
            private void Initialize()
            {
                if (_background == null)
                {
                    byte[] pixelData = new byte[4 * _size.Width * _size.Height];
                    for (int n = 0; n < pixelData.Length; n += 4)
                    {
                        byte[] pixel = BitConverter.GetBytes(Color.FromArgb(196, 85, 85, 85).ToArgb());
                        pixelData[n + 0] = pixel[0];
                        pixelData[n + 1] = pixel[1];
                        pixelData[n + 2] = pixel[2];
                        pixelData[n + 3] = pixel[3];
                    }
                    base.Graphics.Add(_background = new ColorImageGraphic(_size.Height, _size.Width, pixelData));
                }

                if (_progressBarGraphic == null)
                {
                    base.Graphics.Add(_progressBarGraphic = ProgressBarGraphic.Create(_style));
                    var offset = Center(_size, _progressBarGraphic.Size) + new Size(0, 10);
                    _progressBarGraphic.SpatialTransform.TranslationX = offset.X;
                    _progressBarGraphic.SpatialTransform.TranslationY = offset.Y;
                }

                if (_progressTextGraphic == null)
                {
                    base.Graphics.Add(_progressTextGraphic = new InvariantTextPrimitive());
                    var offset = Center(_size, new Size(1, 1)) - new Size(0, 15);
                    _progressTextGraphic.SpatialTransform.TranslationX = offset.X;
                    _progressTextGraphic.SpatialTransform.TranslationY = offset.Y;
                }
            }
		protected override void OnGraphicComplete()
		{
			_textGraphic = this.FindTextGraphic();

			base.OnGraphicComplete();
			this.StartEdit();
		}
Example #4
0
 public TextDialog(EditorBindableCollapsiblePanel parent, ISimpleSymbolDefinition sym, ITextGraphic text)
 {
     InitializeComponent();
     _ed = parent;
     _sym = sym;
     _text = text;
 }
 public TextDialog(EditorBindableCollapsiblePanel parent, ISimpleSymbolDefinition sym, ITextGraphic text)
 {
     InitializeComponent();
     _ed   = parent;
     _sym  = sym;
     _text = text;
 }
			private void OnCloneComplete()
			{
				_progressTextGraphic = (ITextGraphic) CollectionUtils.SelectFirst(base.Graphics, g => g is ITextGraphic);
				_progressBarGraphic = (ProgressBarGraphic) CollectionUtils.SelectFirst(base.Graphics, g => g is ProgressBarGraphic);
				_background = (ColorImageGraphic) CollectionUtils.SelectFirst(base.Graphics, g => g is ColorImageGraphic);

				Initialize();
			}
            private void OnCloneComplete()
            {
                _progressTextGraphic = (ITextGraphic)CollectionUtils.SelectFirst(base.Graphics, g => g is ITextGraphic);
                _progressBarGraphic  = (ProgressBarGraphic)CollectionUtils.SelectFirst(base.Graphics, g => g is ProgressBarGraphic);
                _background          = (ColorImageGraphic)CollectionUtils.SelectFirst(base.Graphics, g => g is ColorImageGraphic);

                Initialize();
            }
Example #8
0
        public override void Bind(IEditorService service)
        {
            service.RegisterCustomNotifier(this);
            _init  = true;
            _edSvc = service;
            try
            {
                _wmd = (IWatermarkDefinition)service.GetEditedResource();
                _sym = (ISimpleSymbolDefinition)_wmd.Content;

                //NOTE: We are assuming there is only one graphic element here.
                foreach (var g in _sym.Graphics)
                {
                    if (g.Type == GraphicElementType.Text)
                    {
                        _text = (ITextGraphic)g;
                    }
                    else if (g.Type == GraphicElementType.Image)
                    {
                        _image = (IImageGraphic)g;
                    }
                }

                if (_text != null || _image != null)
                {
                    if (_text != null)
                    {
                        rdText.Checked = true;
                    }
                    else if (_image != null)
                    {
                        rdImage.Checked = true;
                    }

                    CheckEditStates();
                }
                else
                {
                    //Text, I choose you
                    rdText.Checked = true;
                    CheckEditStates();

                    _text  = _sym.CreateTextGraphics();
                    _image = _sym.CreateImageGraphics();
                    SetActiveGraphicElement(_text);
                }
            }
            finally
            {
                _init = false;
            }
        }
Example #9
0
        public override void Bind(IEditorService service)
        {
            service.RegisterCustomNotifier(this);
            _init = true;
            _edSvc = service;
            try
            {
                _wmd = (IWatermarkDefinition)service.GetEditedResource();
                _sym = (ISimpleSymbolDefinition)_wmd.Content;

                //NOTE: We are assuming there is only one graphic element here.
                foreach (var g in _sym.Graphics)
                {
                    if (g.Type == GraphicElementType.Text)
                        _text = (ITextGraphic)g;
                    else if (g.Type == GraphicElementType.Image)
                        _image = (IImageGraphic)g;
                }

                if (_text != null || _image != null)
                {
                    if (_text != null)
                        rdText.Checked = true;
                    else if (_image != null)
                        rdImage.Checked = true;

                    CheckEditStates();
                }
                else
                {
                    //Text, I choose you
                    rdText.Checked = true;
                    CheckEditStates();

                    _text = _sym.CreateTextGraphics();
                    _image = _sym.CreateImageGraphics();
                    SetActiveGraphicElement(_text);
                }
            }
            finally
            {
                _init = false;
            }
        }
            private void Initialize()
            {
                if (_background == null)
                {
                    var pixelCount = _size.Width * _size.Height;
                    var pixelData  = new byte[4 * pixelCount];
                    var fillColor  = Color.FromArgb(196, 85, 85, 85).ToArgb();
                    unsafe
                    {
                        fixed(byte *pPixelBytes = pixelData)
                        {
                            var pPixels = (int *)pPixelBytes;

                            for (var n = 0; n < pixelCount; ++n)
                            {
                                pPixels[n] = fillColor;
                            }
                        }
                    }
                    base.Graphics.Add(_background = new ColorImageGraphic(_size.Height, _size.Width, pixelData));
                }

                if (_progressBarGraphic == null)
                {
                    base.Graphics.Add(_progressBarGraphic = ProgressBarGraphic.Create(_style));
                    var offset = Center(_size, _progressBarGraphic.Size) + new Size(0, 10);
                    _progressBarGraphic.SpatialTransform.TranslationX = offset.X;
                    _progressBarGraphic.SpatialTransform.TranslationY = offset.Y;
                }

                if (_progressTextGraphic == null)
                {
                    base.Graphics.Add(_progressTextGraphic = new InvariantTextPrimitive());
                    var offset = Center(_size, new Size(1, 1)) - new Size(0, 15);
                    _progressTextGraphic.SpatialTransform.TranslationX = offset.X;
                    _progressTextGraphic.SpatialTransform.TranslationY = offset.Y;
                }
            }
Example #11
0
 /// <summary>
 /// Initializes the control chain for the text graphic portion of the callout.
 /// </summary>
 /// <remarks>
 /// The default implementation creates a <see cref="MoveControlGraphic"/> to allow the user to independently control moving the text portion.
 /// </remarks>
 /// <param name="textGraphic">The text graphic to be controlled.</param>
 /// <returns>A control graphic chain controlling the text graphic.</returns>
 protected virtual IControlGraphic InitializeTextControlGraphic(ITextGraphic textGraphic)
 {
     return(new MoveControlGraphic(textGraphic));
 }
Example #12
0
 public InteractiveTextAreaBuilder(ITextGraphic textGraphic) : base(textGraphic)
 {
 }
Example #13
0
			protected override IControlGraphic InitializeTextControlGraphic(ITextGraphic textGraphic)
			{
				return new ControlGraphic(textGraphic);
			}
Example #14
0
 protected override IControlGraphic InitializeTextControlGraphic(ITextGraphic textGraphic)
 {
     return(new ControlGraphic(textGraphic));
 }
		public InteractiveTextAreaBuilder(ITextGraphic textGraphic) : base(textGraphic) {}
			private void Initialize()
			{
				if (_background == null)
				{
					var pixelCount = _size.Width*_size.Height;
					var pixelData = new byte[4*pixelCount];
					var fillColor = Color.FromArgb(196, 85, 85, 85).ToArgb();
					unsafe
					{
						fixed (byte* pPixelBytes = pixelData)
						{
							var pPixels = (int*) pPixelBytes;
							for (var n = 0; n < pixelCount; ++n)
								pPixels[n] = fillColor;
						}
					}
					base.Graphics.Add(_background = new ColorImageGraphic(_size.Height, _size.Width, pixelData));
				}

				if (_progressBarGraphic == null)
				{
					base.Graphics.Add(_progressBarGraphic = ProgressBarGraphic.Create(_style));
					var offset = Center(_size, _progressBarGraphic.Size) + new Size(0, 10);
					_progressBarGraphic.SpatialTransform.TranslationX = offset.X;
					_progressBarGraphic.SpatialTransform.TranslationY = offset.Y;
				}

				if (_progressTextGraphic == null)
				{
					base.Graphics.Add(_progressTextGraphic = new InvariantTextPrimitive());
					var offset = Center(_size, new Size(1, 1)) - new Size(0, 15);
					_progressTextGraphic.SpatialTransform.TranslationX = offset.X;
					_progressTextGraphic.SpatialTransform.TranslationY = offset.Y;
				}
			}
 /// <summary>
 /// Initializes the control chain for the text graphic portion of the callout.
 /// </summary>
 /// <remarks>
 /// This implementation creates a <see cref="TextEditControlGraphic"/> and a <see cref="MoveControlGraphic"/> to allow the
 /// user to interactively edit and move the callout text.
 /// </remarks>
 /// <param name="textGraphic">The text graphic to be controlled.</param>
 /// <returns>A control graphic chain controlling the text graphic.</returns>
 protected override IControlGraphic InitializeTextControlGraphic(ITextGraphic textGraphic)
 {
     return(new TextEditControlGraphic(new TextPlaceholderControlGraphic(base.InitializeTextControlGraphic(textGraphic))));
 }
Example #18
0
		/// <summary>
		/// Initializes the control chain for the text graphic portion of the callout.
		/// </summary>
		/// <remarks>
		/// This implementation creates a <see cref="TextEditControlGraphic"/> and a <see cref="MoveControlGraphic"/> to allow the
		/// user to interactively edit and move the callout text.
		/// </remarks>
		/// <param name="textGraphic">The text graphic to be controlled.</param>
		/// <returns>A control graphic chain controlling the text graphic.</returns>
		protected override IControlGraphic InitializeTextControlGraphic(ITextGraphic textGraphic)
		{
			return new TextEditControlGraphic(new TextPlaceholderControlGraphic(base.InitializeTextControlGraphic(textGraphic)));
		}
Example #19
0
		/// <summary>
		/// Initializes the control chain for the text graphic portion of the callout.
		/// </summary>
		/// <remarks>
		/// The default implementation creates a <see cref="MoveControlGraphic"/> to allow the user to independently control moving the text portion.
		/// </remarks>
		/// <param name="textGraphic">The text graphic to be controlled.</param>
		/// <returns>A control graphic chain controlling the text graphic.</returns>
		protected virtual IControlGraphic InitializeTextControlGraphic(ITextGraphic textGraphic)
		{
			return new MoveControlGraphic(textGraphic);
		}
			private void Initialize()
			{
				if (_background == null)
				{
					byte[] pixelData = new byte[4*_size.Width*_size.Height];
					for (int n = 0; n < pixelData.Length; n += 4)
					{
						byte[] pixel = BitConverter.GetBytes(Color.FromArgb(196, 85, 85, 85).ToArgb());
						pixelData[n + 0] = pixel[0];
						pixelData[n + 1] = pixel[1];
						pixelData[n + 2] = pixel[2];
						pixelData[n + 3] = pixel[3];
					}
					base.Graphics.Add(_background = new ColorImageGraphic(_size.Height, _size.Width, pixelData));
				}

				if (_progressBarGraphic == null)
				{
					base.Graphics.Add(_progressBarGraphic = ProgressBarGraphic.Create(_style));
					var offset = Center(_size, _progressBarGraphic.Size) + new Size(0, 10);
					_progressBarGraphic.SpatialTransform.TranslationX = offset.X;
					_progressBarGraphic.SpatialTransform.TranslationY = offset.Y;
				}

				if (_progressTextGraphic == null)
				{
					base.Graphics.Add(_progressTextGraphic = new InvariantTextPrimitive());
					var offset = Center(_size, new Size(1, 1)) - new Size(0, 15);
					_progressTextGraphic.SpatialTransform.TranslationX = offset.X;
					_progressTextGraphic.SpatialTransform.TranslationY = offset.Y;
				}
			}